summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.appveyor.yml4
-rw-r--r--.gdbinit18
-rw-r--r--.gitignore20
-rw-r--r--.travis.yml8
-rw-r--r--CONTRIBUTING.md10
-rw-r--r--EXTENSIONS21
-rw-r--r--NEWS1747
-rw-r--r--README.md9
-rw-r--r--TSRM/TSRM.c186
-rw-r--r--TSRM/TSRM.h58
-rw-r--r--TSRM/tsrm.m474
-rw-r--r--TSRM/tsrm_win32.c2
-rw-r--r--TSRM/tsrm_win32.h2
-rw-r--r--UPGRADING1087
-rw-r--r--UPGRADING.INTERNALS391
-rw-r--r--Zend/Makefile.frag4
-rw-r--r--Zend/Zend.m4147
-rw-r--r--Zend/tests/001.phpt20
-rw-r--r--Zend/tests/002.phpt32
-rw-r--r--Zend/tests/003.phpt20
-rw-r--r--Zend/tests/004.phpt3
-rw-r--r--Zend/tests/005.phpt3
-rw-r--r--Zend/tests/006.phpt4
-rw-r--r--Zend/tests/007.phpt65
-rw-r--r--Zend/tests/008.phpt25
-rw-r--r--Zend/tests/009.phpt34
-rw-r--r--Zend/tests/010.phpt14
-rw-r--r--Zend/tests/011.phpt33
-rw-r--r--Zend/tests/012.phpt9
-rw-r--r--Zend/tests/013.phpt9
-rw-r--r--Zend/tests/014.phpt10
-rw-r--r--Zend/tests/015.phpt8
-rw-r--r--Zend/tests/017.phpt23
-rw-r--r--Zend/tests/018.phpt24
-rw-r--r--Zend/tests/019.phpt220
-rw-r--r--Zend/tests/020.phpt12
-rw-r--r--Zend/tests/022.phpt12
-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.phpt2
-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.phpt21
-rw-r--r--Zend/tests/038.phpt12
-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.phpt6
-rw-r--r--Zend/tests/access_modifiers_009.phpt12
-rw-r--r--Zend/tests/access_modifiers_010.phpt18
-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.phpt4
-rw-r--r--Zend/tests/add_003.phpt4
-rw-r--r--Zend/tests/add_004.phpt4
-rw-r--r--Zend/tests/add_007.phpt4
-rw-r--r--Zend/tests/anon/011.phpt6
-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.phpt10
-rw-r--r--Zend/tests/arg_unpack/string_keys.phpt8
-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.phpt4
-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.phpt2
-rw-r--r--Zend/tests/array_unpack/already_occupied.phpt48
-rw-r--r--Zend/tests/array_unpack/basic.phpt8
-rw-r--r--Zend/tests/array_unpack/classes.phpt14
-rw-r--r--Zend/tests/array_unpack/non_integer_keys.phpt8
-rw-r--r--Zend/tests/array_unpack/string_keys.phpt12
-rw-r--r--Zend/tests/array_unpack/undef_var.phpt4
-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/assert/bug70208.phpt24
-rw-r--r--Zend/tests/assert/expect_015.phpt226
-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_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/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.phpt4
-rw-r--r--Zend/tests/bug26010.phpt6
-rw-r--r--Zend/tests/bug26166.phpt16
-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.phpt17
-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/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/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/bug30998.phpt6
-rw-r--r--Zend/tests/bug31098.phpt2
-rw-r--r--Zend/tests/bug31102.phpt47
-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/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.phpt10
-rw-r--r--Zend/tests/bug37632.phpt106
-rw-r--r--Zend/tests/bug37667.phpt12
-rw-r--r--Zend/tests/bug37707.phpt6
-rw-r--r--Zend/tests/bug37811.phpt15
-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.phpt24
-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.phpt4
-rw-r--r--Zend/tests/bug39018.phpt40
-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.phpt8
-rw-r--r--Zend/tests/bug40621.phpt15
-rw-r--r--Zend/tests/bug40705.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.phpt16
-rw-r--r--Zend/tests/bug41075.phpt31
-rw-r--r--Zend/tests/bug41209.phpt2
-rw-r--r--Zend/tests/bug41421.phpt12
-rw-r--r--Zend/tests/bug41633_1.phpt4
-rw-r--r--Zend/tests/bug41633_2.phpt2
-rw-r--r--Zend/tests/bug41633_3.phpt4
-rw-r--r--Zend/tests/bug41633_4.phpt4
-rw-r--r--Zend/tests/bug42802.phpt4
-rw-r--r--Zend/tests/bug42819.phpt88
-rw-r--r--Zend/tests/bug42820.phpt2
-rw-r--r--Zend/tests/bug42937.phpt28
-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/bug43344_1.phpt51
-rw-r--r--Zend/tests/bug43344_11.phpt2
-rw-r--r--Zend/tests/bug43344_12.phpt2
-rw-r--r--Zend/tests/bug43344_13.phpt4
-rw-r--r--Zend/tests/bug43344_3.phpt2
-rw-r--r--Zend/tests/bug43344_4.phpt2
-rw-r--r--Zend/tests/bug43344_5.phpt4
-rw-r--r--Zend/tests/bug43344_7.phpt2
-rw-r--r--Zend/tests/bug43344_8.phpt2
-rw-r--r--Zend/tests/bug43344_9.phpt4
-rw-r--r--Zend/tests/bug43450.phpt14
-rw-r--r--Zend/tests/bug43483.phpt14
-rw-r--r--Zend/tests/bug43851.phpt6
-rw-r--r--Zend/tests/bug44069.phpt10
-rw-r--r--Zend/tests/bug44184.phpt18
-rw-r--r--Zend/tests/bug44653.phpt4
-rw-r--r--Zend/tests/bug44660.phpt56
-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.phpt6
-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.phpt2
-rw-r--r--Zend/tests/bug46246.phpt28
-rw-r--r--Zend/tests/bug46304.phpt45
-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.phpt10
-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.phpt6
-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/bug48693.phpt52
-rw-r--r--Zend/tests/bug48770.phpt58
-rw-r--r--Zend/tests/bug48770_2.phpt72
-rw-r--r--Zend/tests/bug48770_3.phpt62
-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/bug49893.phpt26
-rw-r--r--Zend/tests/bug49908.phpt14
-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.phpt2
-rw-r--r--Zend/tests/bug51176.phpt28
-rw-r--r--Zend/tests/bug51394.phpt6
-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.phpt8
-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/bug52361.phpt24
-rw-r--r--Zend/tests/bug52484.phpt6
-rw-r--r--Zend/tests/bug52484_2.phpt6
-rw-r--r--Zend/tests/bug52484_3.phpt6
-rw-r--r--Zend/tests/bug52614.phpt83
-rw-r--r--Zend/tests/bug52879.phpt8
-rw-r--r--Zend/tests/bug52940.phpt4
-rw-r--r--Zend/tests/bug53511.phpt18
-rw-r--r--Zend/tests/bug54039.phpt46
-rw-r--r--Zend/tests/bug54262.phpt17
-rw-r--r--Zend/tests/bug54265.phpt16
-rw-r--r--Zend/tests/bug54358.phpt4
-rw-r--r--Zend/tests/bug54367.phpt2
-rw-r--r--Zend/tests/bug54585.phpt17
-rw-r--r--Zend/tests/bug54624.phpt16
-rw-r--r--Zend/tests/bug55156.phpt22
-rw-r--r--Zend/tests/bug55247.phpt4
-rw-r--r--Zend/tests/bug55578.phpt2
-rw-r--r--Zend/tests/bug55825.phpt8
-rw-r--r--Zend/tests/bug60099.phpt2
-rw-r--r--Zend/tests/bug60444.phpt12
-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/bug60825.phpt10
-rw-r--r--Zend/tests/bug60833.phpt24
-rw-r--r--Zend/tests/bug60909_1.phpt4
-rw-r--r--Zend/tests/bug60978.phpt6
-rw-r--r--Zend/tests/bug61011.phpt48
-rw-r--r--Zend/tests/bug61095.phpt2
-rw-r--r--Zend/tests/bug61165.phpt6
-rw-r--r--Zend/tests/bug61225.phpt2
-rw-r--r--Zend/tests/bug61362.phpt8
-rw-r--r--Zend/tests/bug61767.phpt2
-rw-r--r--Zend/tests/bug62005.phpt17
-rw-r--r--Zend/tests/bug62097.phpt6
-rw-r--r--Zend/tests/bug62956.phpt8
-rw-r--r--Zend/tests/bug63111.phpt6
-rw-r--r--Zend/tests/bug63336.phpt22
-rw-r--r--Zend/tests/bug63462.phpt52
-rw-r--r--Zend/tests/bug63468.phpt24
-rw-r--r--Zend/tests/bug63635.phpt44
-rw-r--r--Zend/tests/bug64239_1.phpt6
-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.phpt2
-rw-r--r--Zend/tests/bug64515.phpt2
-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.phpt12
-rw-r--r--Zend/tests/bug65291.phpt10
-rw-r--r--Zend/tests/bug65322.phpt4
-rw-r--r--Zend/tests/bug65784.phpt70
-rw-r--r--Zend/tests/bug65911.phpt10
-rw-r--r--Zend/tests/bug66015.phpt2
-rw-r--r--Zend/tests/bug66218.phpt7
-rw-r--r--Zend/tests/bug66252.phpt4
-rw-r--r--Zend/tests/bug66608.phpt104
-rw-r--r--Zend/tests/bug66609.phpt18
-rw-r--r--Zend/tests/bug67314.phpt4
-rw-r--r--Zend/tests/bug67368.phpt2
-rw-r--r--Zend/tests/bug67436/a.inc10
-rw-r--r--Zend/tests/bug67436/b.inc10
-rw-r--r--Zend/tests/bug67436/bug67436.phpt10
-rw-r--r--Zend/tests/bug67436/bug67436_nohandler.phpt8
-rw-r--r--Zend/tests/bug67436/c.inc2
-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.phpt8
-rw-r--r--Zend/tests/bug68446.phpt6
-rw-r--r--Zend/tests/bug68797.phpt2
-rw-r--r--Zend/tests/bug68896.phpt8
-rw-r--r--Zend/tests/bug69017.phpt20
-rw-r--r--Zend/tests/bug69025.phpt6
-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.phpt6
-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.phpt10
-rw-r--r--Zend/tests/bug69446_2.phpt20
-rw-r--r--Zend/tests/bug69676.phpt6
-rw-r--r--Zend/tests/bug69732.phpt4
-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/bug69832.phpt10
-rw-r--r--Zend/tests/bug69871.phpt4
-rw-r--r--Zend/tests/bug69957.phpt64
-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.phpt16
-rw-r--r--Zend/tests/bug70117.phpt10
-rw-r--r--Zend/tests/bug70124.phpt24
-rw-r--r--Zend/tests/bug70156.phpt36
-rw-r--r--Zend/tests/bug70164.phpt10
-rw-r--r--Zend/tests/bug70179.phpt6
-rw-r--r--Zend/tests/bug70187.phpt2
-rw-r--r--Zend/tests/bug70215.phpt6
-rw-r--r--Zend/tests/bug70241.phpt4
-rw-r--r--Zend/tests/bug70258.phpt14
-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/bug70478.phpt10
-rw-r--r--Zend/tests/bug70547.phpt38
-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.phpt16
-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/bug70918.phpt24
-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/bug71067.phpt14
-rw-r--r--Zend/tests/bug71163.phpt16
-rw-r--r--Zend/tests/bug71221.phpt11
-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/bug71428.1.phpt2
-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.phpt32
-rw-r--r--Zend/tests/bug71914.phpt22
-rw-r--r--Zend/tests/bug71930.phpt6
-rw-r--r--Zend/tests/bug72038.phpt34
-rw-r--r--Zend/tests/bug72057.phpt2
-rw-r--r--Zend/tests/bug72101.phpt2
-rw-r--r--Zend/tests/bug72107.phpt12
-rw-r--r--Zend/tests/bug72215_2.phpt2
-rw-r--r--Zend/tests/bug72441.phpt4
-rw-r--r--Zend/tests/bug72508.phpt20
-rw-r--r--Zend/tests/bug72594.phpt12
-rw-r--r--Zend/tests/bug72598.phpt2
-rw-r--r--Zend/tests/bug72598_2.phpt8
-rw-r--r--Zend/tests/bug72911.phpt15
-rw-r--r--Zend/tests/bug72918.phpt2
-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/bug73338.phpt5
-rw-r--r--Zend/tests/bug73663.phpt6
-rw-r--r--Zend/tests/bug73663_2.phpt9
-rw-r--r--Zend/tests/bug73792.phpt2
-rw-r--r--Zend/tests/bug73916.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.phpt2
-rw-r--r--Zend/tests/bug74340.phpt4
-rw-r--r--Zend/tests/bug74408.phpt34
-rw-r--r--Zend/tests/bug74657.phpt6
-rw-r--r--Zend/tests/bug74840.phpt14
-rw-r--r--Zend/tests/bug75241.phpt10
-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.phpt4
-rw-r--r--Zend/tests/bug76667.phpt30
-rw-r--r--Zend/tests/bug76754.phpt2
-rw-r--r--Zend/tests/bug76860.phpt8
-rw-r--r--Zend/tests/bug76860_2.phpt8
-rw-r--r--Zend/tests/bug76869.phpt18
-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/bug77494.phpt2
-rw-r--r--Zend/tests/bug77738.phpt5
-rw-r--r--Zend/tests/bug77877.phpt14
-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/bug78379.phpt6
-rw-r--r--Zend/tests/bug78379_2.phpt12
-rw-r--r--Zend/tests/bug78396.phpt2
-rw-r--r--Zend/tests/bug78531.phpt45
-rw-r--r--Zend/tests/bug78868.phpt18
-rw-r--r--Zend/tests/bug78898.phpt28
-rw-r--r--Zend/tests/bug78999.phpt6
-rw-r--r--Zend/tests/bug79022.phpt36
-rw-r--r--Zend/tests/bug79155.phpt4
-rw-r--r--Zend/tests/bug_debug_backtrace.phpt2
-rw-r--r--Zend/tests/call_static.phpt8
-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.phpt15
-rw-r--r--Zend/tests/call_user_func_007.phpt2
-rw-r--r--Zend/tests/call_user_func_array_invalid_type.phpt18
-rw-r--r--Zend/tests/case_insensitive_constant_deprecation.phpt127
-rw-r--r--Zend/tests/cast_to_array.phptbin985 -> 1051 bytes
-rw-r--r--Zend/tests/cast_to_bool.phpt36
-rw-r--r--Zend/tests/cast_to_double.phpt36
-rw-r--r--Zend/tests/cast_to_int.phpt36
-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_007.phpt2
-rw-r--r--Zend/tests/class_alias_011.phpt12
-rw-r--r--Zend/tests/class_alias_017.phpt12
-rw-r--r--Zend/tests/class_constants_001.phpt6
-rw-r--r--Zend/tests/class_constants_002.phpt6
-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_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.phpt12
-rw-r--r--Zend/tests/closure_020.phpt18
-rw-r--r--Zend/tests/closure_021.phpt14
-rw-r--r--Zend/tests/closure_025.phpt13
-rw-r--r--Zend/tests/closure_026.phpt25
-rw-r--r--Zend/tests/closure_027.phpt8
-rw-r--r--Zend/tests/closure_028.phpt2
-rw-r--r--Zend/tests/closure_031.phpt6
-rw-r--r--Zend/tests/closure_033.phpt18
-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.phpt37
-rw-r--r--Zend/tests/closure_041.phpt44
-rw-r--r--Zend/tests/closure_043.phpt8
-rw-r--r--Zend/tests/closure_044.phpt22
-rw-r--r--Zend/tests/closure_046.phpt17
-rw-r--r--Zend/tests/closure_047.phpt8
-rw-r--r--Zend/tests/closure_048.phpt10
-rw-r--r--Zend/tests/closure_057.phpt12
-rw-r--r--Zend/tests/closure_058.phpt12
-rw-r--r--Zend/tests/closure_059.phpt12
-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_call_leak_with_exception.phpt4
-rw-r--r--Zend/tests/closures/closure_from_callable.inc250
-rw-r--r--Zend/tests/closures/closure_from_callable_basic.phpt8
-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.phpt2
-rw-r--r--Zend/tests/compare_001.phpt54
-rw-r--r--Zend/tests/compare_001_64bit.phpt54
-rw-r--r--Zend/tests/compare_002.phpt54
-rw-r--r--Zend/tests/compare_002_64bit.phpt54
-rw-r--r--Zend/tests/compare_003.phpt54
-rw-r--r--Zend/tests/compare_003_64bit.phpt54
-rw-r--r--Zend/tests/compare_004.phpt54
-rw-r--r--Zend/tests/compare_004_64bit.phpt54
-rw-r--r--Zend/tests/compare_005.phpt54
-rw-r--r--Zend/tests/compare_005_64bit.phpt54
-rw-r--r--Zend/tests/compare_006.phpt54
-rw-r--r--Zend/tests/compare_006_64bit.phpt54
-rw-r--r--Zend/tests/compound_assign_failure.phpt20
-rw-r--r--Zend/tests/compound_assign_with_numeric_strings.phpt6
-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/constant_expressions_arrays.phpt4
-rw-r--r--Zend/tests/constant_expressions_classes.phpt16
-rw-r--r--Zend/tests/constant_expressions_exceptions_002.phpt4
-rw-r--r--Zend/tests/constant_expressions_invalid_offset_type_error.phpt2
-rw-r--r--Zend/tests/constants_002.phpt12
-rw-r--r--Zend/tests/constants_005.phpt7
-rw-r--r--Zend/tests/constants_006.phpt10
-rw-r--r--Zend/tests/constants_007.phpt4
-rw-r--r--Zend/tests/constants_008.phpt2
-rw-r--r--Zend/tests/constants_009.phpt2
-rw-r--r--Zend/tests/custom_assert_deprecation.phpt12
-rw-r--r--Zend/tests/custom_assert_forbidden.phpt12
-rw-r--r--Zend/tests/debug_backtrace_options.phpt52
-rw-r--r--Zend/tests/debug_backtrace_with_include_and_this.phpt2
-rw-r--r--Zend/tests/decrement_001.phpt34
-rw-r--r--Zend/tests/decrement_001_64bit.phpt34
-rw-r--r--Zend/tests/defined_fn_no_ns_fallback.phpt16
-rw-r--r--Zend/tests/dereference_001.phpt24
-rw-r--r--Zend/tests/dereference_002.phpt16
-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.phpt16
-rw-r--r--Zend/tests/dereference_014.phpt24
-rw-r--r--Zend/tests/div_002.phpt4
-rw-r--r--Zend/tests/double_to_string.phpt36
-rw-r--r--Zend/tests/dval_to_lval_32.phpt26
-rw-r--r--Zend/tests/dval_to_lval_64.phpt22
-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_prop_name_leak.phpt13
-rw-r--r--Zend/tests/each_001.phpt12
-rw-r--r--Zend/tests/each_002.phpt33
-rw-r--r--Zend/tests/each_003.phpt27
-rw-r--r--Zend/tests/entry_block_with_predecessors.phpt2
-rw-r--r--Zend/tests/errmsg_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.phpt6
-rw-r--r--Zend/tests/errmsg_015.phpt4
-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.phpt4
-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.phpt4
-rw-r--r--Zend/tests/errmsg_033.phpt4
-rw-r--r--Zend/tests/errmsg_034.phpt4
-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/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.phpt14
-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_023.phpt2
-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.phpt6
-rw-r--r--Zend/tests/exception_handler_005.phpt4
-rw-r--r--Zend/tests/exception_handler_006.phpt4
-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_shadowed_dyn_property.phpt2
-rw-r--r--Zend/tests/foreach_undefined.phpt2
-rw-r--r--Zend/tests/foreach_unset_globals.phpt2
-rw-r--r--Zend/tests/fr47160.phpt60
-rw-r--r--Zend/tests/function_arguments/argument_count_incorrect_internal.phpt13
-rw-r--r--Zend/tests/function_arguments/argument_count_incorrect_internal_strict.phpt21
-rw-r--r--Zend/tests/function_arguments/argument_count_incorrect_userland.phpt28
-rw-r--r--Zend/tests/function_arguments/argument_count_incorrect_userland_strict.phpt34
-rw-r--r--Zend/tests/function_arguments_003.phpt2
-rw-r--r--Zend/tests/function_exists_basic.phpt4
-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.phpt4
-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.phpt8
-rw-r--r--Zend/tests/gc_027.phpt4
-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.phpt10
-rw-r--r--Zend/tests/gc_036.phpt8
-rw-r--r--Zend/tests/gc_038.phpt126
-rw-r--r--Zend/tests/gc_041.phpt6
-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.phpt6
-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/errors/resume_running_generator_error.phpt10
-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_2.phpt10
-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/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_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_deep_recursion.phpt16
-rw-r--r--Zend/tests/generators/yield_from_iterator.phpt8
-rw-r--r--Zend/tests/generators/yield_from_multi_tree.phpt50
-rw-r--r--Zend/tests/generators/yield_from_multi_tree_exception.phpt44
-rw-r--r--Zend/tests/generators/yield_unary_precedence.phpt10
-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.phpt12
-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.phpt22
-rw-r--r--Zend/tests/get_parent_class_001.phpt14
-rw-r--r--Zend/tests/globals_001.phpt2
-rw-r--r--Zend/tests/globals_002.phpt20
-rw-r--r--Zend/tests/globals_003.phpt24
-rw-r--r--Zend/tests/globals_004.phpt4
-rw-r--r--Zend/tests/grammar/regression_001.phpt6
-rw-r--r--Zend/tests/halt03.phpt2
-rw-r--r--Zend/tests/halt_compiler2.phpt2
-rw-r--r--Zend/tests/halt_compiler3.phpt2
-rw-r--r--Zend/tests/halt_compiler5.phpt5
-rw-r--r--Zend/tests/hex_overflow_32bit.phpt14
-rw-r--r--Zend/tests/illegal_offset_unset_isset_empty.phpt27
-rw-r--r--Zend/tests/include_stat_is_quiet.phpt2
-rw-r--r--Zend/tests/incompat_ctx_user.phpt11
-rw-r--r--Zend/tests/increment_001.phpt34
-rw-r--r--Zend/tests/indexing_001.phpt92
-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_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.phpt4
-rw-r--r--Zend/tests/int_overflow_32bit.phpt16
-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/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/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.phpt14
-rw-r--r--Zend/tests/list_keyed_conversions.phpt2
-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_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_022.phpt32
-rw-r--r--Zend/tests/magic_methods_001.phpt38
-rw-r--r--Zend/tests/magic_methods_002.phpt6
-rw-r--r--Zend/tests/magic_methods_003.phpt6
-rw-r--r--Zend/tests/magic_methods_004.phpt6
-rw-r--r--Zend/tests/magic_methods_005.phpt2
-rw-r--r--Zend/tests/magic_methods_006.phpt2
-rw-r--r--Zend/tests/magic_methods_007.phpt2
-rw-r--r--Zend/tests/magic_methods_008.phpt6
-rw-r--r--Zend/tests/magic_methods_009.phpt4
-rw-r--r--Zend/tests/magic_methods_010.phpt4
-rw-r--r--Zend/tests/method_argument_binding.phpt2
-rw-r--r--Zend/tests/method_exists_002.phpt48
-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.phpt2
-rw-r--r--Zend/tests/mul_001.phpt4
-rw-r--r--Zend/tests/multibyte/bug68665.phpt5
-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/nested_method_and_function.phpt24
-rw-r--r--Zend/tests/not_002.phpt4
-rw-r--r--Zend/tests/nowdoc_015.phpt4
-rw-r--r--Zend/tests/ns_010.phpt16
-rw-r--r--Zend/tests/ns_013.phpt2
-rw-r--r--Zend/tests/ns_015.phpt2
-rw-r--r--Zend/tests/ns_016.phpt2
-rw-r--r--Zend/tests/ns_017.phpt2
-rw-r--r--Zend/tests/ns_018.phpt2
-rw-r--r--Zend/tests/ns_019.phpt2
-rw-r--r--Zend/tests/ns_020.phpt2
-rw-r--r--Zend/tests/ns_021.phpt8
-rw-r--r--Zend/tests/ns_022.inc6
-rw-r--r--Zend/tests/ns_022.phpt2
-rw-r--r--Zend/tests/ns_025.phpt4
-rw-r--r--Zend/tests/ns_026.phpt4
-rw-r--r--Zend/tests/ns_027.inc4
-rw-r--r--Zend/tests/ns_027.phpt4
-rw-r--r--Zend/tests/ns_028.inc4
-rw-r--r--Zend/tests/ns_028.phpt4
-rw-r--r--Zend/tests/ns_031.phpt8
-rw-r--r--Zend/tests/ns_032.phpt8
-rw-r--r--Zend/tests/ns_034.phpt8
-rw-r--r--Zend/tests/ns_035.phpt4
-rw-r--r--Zend/tests/ns_036.phpt10
-rw-r--r--Zend/tests/ns_037.phpt16
-rw-r--r--Zend/tests/ns_039.phpt10
-rw-r--r--Zend/tests/ns_040.phpt16
-rw-r--r--Zend/tests/ns_041.phpt6
-rw-r--r--Zend/tests/ns_050.phpt2
-rw-r--r--Zend/tests/ns_051.phpt2
-rw-r--r--Zend/tests/ns_052.phpt2
-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.phpt26
-rw-r--r--Zend/tests/ns_058.phpt26
-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_069.phpt2
-rw-r--r--Zend/tests/ns_070.phpt6
-rw-r--r--Zend/tests/ns_071.phpt6
-rw-r--r--Zend/tests/ns_072.phpt6
-rw-r--r--Zend/tests/ns_073.phpt2
-rw-r--r--Zend/tests/ns_074.phpt2
-rw-r--r--Zend/tests/ns_076.phpt38
-rw-r--r--Zend/tests/ns_081.phpt4
-rw-r--r--Zend/tests/ns_084.phpt4
-rw-r--r--Zend/tests/ns_085.phpt4
-rw-r--r--Zend/tests/ns_086.phpt4
-rw-r--r--Zend/tests/ns_087.phpt4
-rw-r--r--Zend/tests/ns_094.phpt2
-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/return_type_in_function.phpt2
-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_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.phpt18
-rw-r--r--Zend/tests/objects_030.phpt18
-rw-r--r--Zend/tests/objects_032.phpt2
-rw-r--r--Zend/tests/oct_overflow.phpt16
-rw-r--r--Zend/tests/offset_array.phpt22
-rw-r--r--Zend/tests/offset_bool.phpt18
-rw-r--r--Zend/tests/offset_long.phpt18
-rw-r--r--Zend/tests/offset_null.phpt18
-rw-r--r--Zend/tests/offset_string.phpt38
-rw-r--r--Zend/tests/overloaded_func_001.phpt10
-rw-r--r--Zend/tests/parse_str_with_unpack.phpt16
-rw-r--r--Zend/tests/php_errormsg_misoptimization.phpt22
-rw-r--r--Zend/tests/pow_array_leak.phpt24
-rw-r--r--Zend/tests/property_exists.phpt48
-rw-r--r--Zend/tests/result_unused.phpt10
-rw-r--r--Zend/tests/return_types/014.phpt2
-rw-r--r--Zend/tests/return_types/018.phpt2
-rw-r--r--Zend/tests/return_types/019.phpt2
-rw-r--r--Zend/tests/return_types/023.phpt12
-rw-r--r--Zend/tests/return_types/028.phpt10
-rw-r--r--Zend/tests/return_types/029.phpt10
-rw-r--r--Zend/tests/return_types/030.phpt2
-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/bug70557.phpt6
-rw-r--r--Zend/tests/return_types/bug71092.phpt10
-rw-r--r--Zend/tests/return_types/bug71978.phpt14
-rw-r--r--Zend/tests/return_types/generators002.phpt2
-rw-r--r--Zend/tests/return_types/return_reference_separation.phpt6
-rw-r--r--Zend/tests/rope_with_exception.phpt36
-rw-r--r--Zend/tests/runtime_compile_time_binary_operands.phpt222
-rw-r--r--Zend/tests/selfParent_001.phpt18
-rw-r--r--Zend/tests/selfParent_002.phpt18
-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.phpt36
-rw-r--r--Zend/tests/settype_int.phpt36
-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/static_in_trait_insteadof_list.phpt18
-rw-r--r--Zend/tests/static_in_trait_insteadof_reference.phpt18
-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.phpt2
-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/sub_001.phpt4
-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_013.phpt344
-rw-r--r--Zend/tests/temporary_cleaning_014.phpt2
-rw-r--r--Zend/tests/temporary_cleaning_015.phpt4
-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.phpt8
-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/trait_exists_001.phpt6
-rw-r--r--Zend/tests/trait_type_errors.phpt43
-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/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.phpt4
-rw-r--r--Zend/tests/traits/bug60717.phpt92
-rw-r--r--Zend/tests/traits/bug60809.phpt32
-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/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.phpt12
-rw-r--r--Zend/tests/traits/bugs/interfaces.phpt2
-rw-r--r--Zend/tests/traits/conflict001.phpt4
-rw-r--r--Zend/tests/traits/conflict002.phpt2
-rw-r--r--Zend/tests/traits/error_001.phpt20
-rw-r--r--Zend/tests/traits/error_002.phpt2
-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.phpt8
-rw-r--r--Zend/tests/traits/error_012.phpt4
-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.phpt10
-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/language009.phpt4
-rw-r--r--Zend/tests/traits/language015.phpt8
-rw-r--r--Zend/tests/traits/language016.phpt8
-rw-r--r--Zend/tests/traits/language017.phpt8
-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.phpt16
-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/bug72629.phpt2
-rw-r--r--Zend/tests/try/bug74444.phpt130
-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/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.phpt32
-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.phpt2
-rw-r--r--Zend/tests/type_declarations/callable_001.phpt20
-rw-r--r--Zend/tests/type_declarations/callable_003.phpt4
-rw-r--r--Zend/tests/type_declarations/confusable_type_warning.phpt46
-rw-r--r--Zend/tests/type_declarations/internal_function_strict_mode.phpt12
-rw-r--r--Zend/tests/type_declarations/iterable_002.phpt2
-rw-r--r--Zend/tests/type_declarations/iterable_003.phpt4
-rw-r--r--Zend/tests/type_declarations/iterable_004.phpt2
-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_constant_defaults.phpt44
-rw-r--r--Zend/tests/type_declarations/scalar_constant_defaults_error.phpt2
-rw-r--r--Zend/tests/type_declarations/scalar_float_with_invalid_default.phpt2
-rw-r--r--Zend/tests/type_declarations/scalar_relative_typehint_disallowed.phpt2
-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/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.phpt2
-rw-r--r--Zend/tests/type_declarations/typed_properties_022.phpt2
-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.phpt2
-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_032.phpt8
-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_036.phpt6
-rw-r--r--Zend/tests/type_declarations/typed_properties_037.phpt2
-rw-r--r--Zend/tests/type_declarations/typed_properties_038.phpt22
-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.phpt26
-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.phpt16
-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.phpt14
-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/types_in_ast.phpt10
-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/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.phpt211
-rw-r--r--Zend/tests/type_declarations/union_types/type_checking_weak.phpt209
-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/internal_parent.phpt2
-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/typehints/bug76198.phpt2
-rw-r--r--Zend/tests/typehints/fully_qualified_scalar.phpt2
-rw-r--r--Zend/tests/unexpected_ref_bug.phpt9
-rw-r--r--Zend/tests/unset_cast_deprecated.phpt14
-rw-r--r--Zend/tests/unset_cast_removed.phpt12
-rw-r--r--Zend/tests/unset_cv01.phpt2
-rw-r--r--Zend/tests/unset_cv02.phpt2
-rw-r--r--Zend/tests/unset_cv03.phpt2
-rw-r--r--Zend/tests/unset_cv04.phpt2
-rw-r--r--Zend/tests/unset_cv05.phpt2
-rw-r--r--Zend/tests/unset_cv09.phpt2
-rw-r--r--Zend/tests/unset_cv10.phpt2
-rw-r--r--Zend/tests/unterminated_comment.phpt8
-rw-r--r--Zend/tests/use_function/no_global_fallback2.phpt10
-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/magic_const_deref.phpt24
-rw-r--r--Zend/tests/varSyntax/new_instanceof_expr.phpt18
-rw-r--r--Zend/tests/varSyntax/propertyOfStringError.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_suppressed_error.phpt4
-rw-r--r--Zend/tests/vm_stack_with_arg_extend.phpt8
-rw-r--r--Zend/tests/warning_during_heredoc_scan_ahead.phpt20
-rw-r--r--Zend/tests/weakrefs/weakmap_basic_map_behavior.phpt173
-rw-r--r--Zend/tests/weakrefs/weakmap_error_conditions.phpt96
-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.phpt107
-rw-r--r--Zend/tests/weakrefs/weakrefs_002.phpt4
-rw-r--r--Zend/tests/weakrefs/weakrefs_003.phpt20
-rw-r--r--Zend/tests/zend_signed_multiply-64bit-2.phpt4
-rw-r--r--Zend/zend.c141
-rw-r--r--Zend/zend.h8
-rw-r--r--Zend/zend_API.c499
-rw-r--r--Zend/zend_API.h253
-rw-r--r--Zend/zend_alloc.c2
-rw-r--r--Zend/zend_ast.c55
-rw-r--r--Zend/zend_ast.h1
-rw-r--r--Zend/zend_builtin_functions.c483
-rw-r--r--Zend/zend_builtin_functions.stub.php116
-rw-r--r--Zend/zend_builtin_functions_arginfo.h198
-rw-r--r--Zend/zend_closures.c92
-rw-r--r--Zend/zend_closures.stub.php20
-rw-r--r--Zend/zend_closures_arginfo.h24
-rw-r--r--Zend/zend_compile.c1314
-rw-r--r--Zend/zend_compile.h82
-rw-r--r--Zend/zend_config.w32.h12
-rw-r--r--Zend/zend_constants.c206
-rw-r--r--Zend/zend_constants.h26
-rw-r--r--Zend/zend_cpuinfo.h2
-rw-r--r--Zend/zend_errors.h8
-rw-r--r--Zend/zend_exceptions.c104
-rw-r--r--Zend/zend_exceptions.h1
-rw-r--r--Zend/zend_exceptions.stub.php68
-rw-r--r--Zend/zend_exceptions_arginfo.h55
-rw-r--r--Zend/zend_execute.c1643
-rw-r--r--Zend/zend_execute.h45
-rw-r--r--Zend/zend_execute_API.c104
-rw-r--r--Zend/zend_extensions.h2
-rw-r--r--Zend/zend_gc.c20
-rw-r--r--Zend/zend_gdb.c141
-rw-r--r--Zend/zend_gdb.h27
-rw-r--r--Zend/zend_generators.c58
-rw-r--r--Zend/zend_generators.stub.php20
-rw-r--r--Zend/zend_generators_arginfo.h24
-rw-r--r--Zend/zend_globals.h2
-rw-r--r--Zend/zend_hash.c31
-rw-r--r--Zend/zend_hash.h4
-rw-r--r--Zend/zend_highlight.h4
-rw-r--r--Zend/zend_inheritance.c542
-rw-r--r--Zend/zend_inheritance.h1
-rw-r--r--Zend/zend_ini.c10
-rw-r--r--Zend/zend_ini.h10
-rw-r--r--Zend/zend_ini_parser.y14
-rw-r--r--Zend/zend_interfaces.c79
-rw-r--r--Zend/zend_interfaces.h2
-rw-r--r--Zend/zend_interfaces.stub.php51
-rw-r--r--Zend/zend_interfaces_arginfo.h35
-rw-r--r--Zend/zend_iterators.c15
-rw-r--r--Zend/zend_language_parser.y159
-rw-r--r--Zend/zend_language_scanner.h2
-rw-r--r--Zend/zend_language_scanner.l24
-rw-r--r--Zend/zend_list.c13
-rw-r--r--Zend/zend_map_ptr.h26
-rw-r--r--Zend/zend_modules.h2
-rw-r--r--Zend/zend_object_handlers.c269
-rw-r--r--Zend/zend_object_handlers.h93
-rw-r--r--Zend/zend_objects.c8
-rw-r--r--Zend/zend_objects.h2
-rw-r--r--Zend/zend_objects_API.h2
-rw-r--r--Zend/zend_opcode.c29
-rw-r--r--Zend/zend_operators.c385
-rw-r--r--Zend/zend_operators.h79
-rw-r--r--Zend/zend_portability.h80
-rw-r--r--Zend/zend_smart_str.c2
-rw-r--r--Zend/zend_smart_str.h2
-rw-r--r--Zend/zend_smart_str_public.h2
-rw-r--r--Zend/zend_smart_string.h2
-rw-r--r--Zend/zend_smart_string_public.h2
-rw-r--r--Zend/zend_string.h9
-rw-r--r--Zend/zend_strtod.c16
-rw-r--r--Zend/zend_ts_hash.c16
-rw-r--r--Zend/zend_ts_hash.h4
-rw-r--r--Zend/zend_type_info.h10
-rw-r--r--Zend/zend_types.h234
-rw-r--r--Zend/zend_virtual_cwd.c2
-rw-r--r--Zend/zend_virtual_cwd.h2
-rw-r--r--Zend/zend_vm_def.h1226
-rw-r--r--Zend/zend_vm_execute.h11894
-rw-r--r--Zend/zend_vm_execute.skl8
-rwxr-xr-xZend/zend_vm_gen.php354
-rw-r--r--Zend/zend_vm_handlers.h1072
-rw-r--r--Zend/zend_vm_opcodes.c14
-rw-r--r--Zend/zend_vm_opcodes.h2
-rw-r--r--Zend/zend_weakrefs.c563
-rw-r--r--Zend/zend_weakrefs.h2
-rw-r--r--Zend/zend_weakrefs.stub.php33
-rw-r--r--Zend/zend_weakrefs_arginfo.h30
-rw-r--r--azure-pipelines.yml34
-rw-r--r--azure/community_job.yml5
-rw-r--r--azure/i386/job.yml9
-rw-r--r--azure/job.yml8
-rw-r--r--azure/macos/job.yml5
-rw-r--r--azure/msan_job.yml1
-rw-r--r--build/Makefile.global33
-rw-r--r--build/libtool.m45
-rw-r--r--build/php.m436
-rw-r--r--configure.ac86
-rw-r--r--docs/parameter-parsing-api.md1
-rw-r--r--docs/release-process.md9
-rw-r--r--docs/unix-build-system.md2
-rw-r--r--ext/bcmath/bcmath.c79
-rw-r--r--ext/bcmath/bcmath.stub.php21
-rw-r--r--ext/bcmath/bcmath_arginfo.h47
-rw-r--r--ext/bcmath/libbcmath/src/init.c2
-rw-r--r--ext/bcmath/libbcmath/src/raise.c4
-rw-r--r--ext/bcmath/libbcmath/src/raisemod.c6
-rw-r--r--ext/bcmath/php_bcmath.h2
-rw-r--r--ext/bcmath/tests/bcdiv_error1.phpt10
-rw-r--r--ext/bcmath/tests/bcmod_error2.phpt10
-rw-r--r--ext/bcmath/tests/bcpow_error1.phpt4
-rw-r--r--ext/bcmath/tests/bcpow_error2.phpt4
-rw-r--r--ext/bcmath/tests/bcsqrt_error1.phpt10
-rw-r--r--ext/bcmath/tests/bug.66364.phpt2
-rw-r--r--ext/bcmath/tests/bug44995.phpt2
-rw-r--r--ext/bcmath/tests/bug46781.phpt2
-rw-r--r--ext/bcmath/tests/bug54598.phpt2
-rw-r--r--ext/bcmath/tests/bug72093.phpt2
-rw-r--r--ext/bcmath/tests/bug75178.phpt6
-rw-r--r--ext/bcmath/tests/scale.phpt2
-rw-r--r--ext/bcmath/tests/scale_ini.phpt2
-rw-r--r--ext/bz2/bz2.c85
-rw-r--r--ext/bz2/bz2.stub.php42
-rw-r--r--ext/bz2/bz2_arginfo.h46
-rw-r--r--ext/bz2/bz2_filter.c2
-rw-r--r--ext/bz2/php_bz2.h2
-rw-r--r--ext/bz2/tests/001.phpt53
-rw-r--r--ext/bz2/tests/002.phpt48
-rw-r--r--ext/bz2/tests/003-mb.phpt23
-rw-r--r--ext/bz2/tests/003.phpt23
-rw-r--r--ext/bz2/tests/004.phpt42
-rw-r--r--ext/bz2/tests/005.phpt11
-rw-r--r--ext/bz2/tests/bug71263.phpt26
-rw-r--r--ext/bz2/tests/bzopen_string_filename_with_null_bytes.phpt23
-rw-r--r--ext/calendar/cal_unix.c14
-rw-r--r--ext/calendar/calendar.c150
-rw-r--r--ext/calendar/calendar.stub.php37
-rw-r--r--ext/calendar/calendar_arginfo.h74
-rw-r--r--ext/calendar/easter.c8
-rw-r--r--ext/calendar/tests/cal_days_in_month_error1.phpt21
-rw-r--r--ext/calendar/tests/cal_from_jd_error1.phpt11
-rw-r--r--ext/calendar/tests/cal_info.phpt11
-rw-r--r--ext/calendar/tests/cal_to_jd_error1.phpt11
-rw-r--r--ext/calendar/tests/easter_date.phpt12
-rw-r--r--ext/calendar/tests/jdtogregorian_overflow.phpt2
-rw-r--r--ext/calendar/tests/jdtojewish.phpt29
-rw-r--r--ext/calendar/tests/jdtojewish_hebrew.phpt2
-rw-r--r--ext/calendar/tests/jdtojewish_overflow.phpt2
-rw-r--r--ext/calendar/tests/jdtomonthname.phpt27
-rw-r--r--ext/calendar/tests/jdtounix_error1.phpt8
-rw-r--r--ext/calendar/tests/skipif.inc2
-rw-r--r--ext/calendar/tests/unixtojd.phpt2
-rw-r--r--ext/calendar/tests/unixtojd_error1.phpt8
-rw-r--r--ext/com_dotnet/com_com.c36
-rw-r--r--ext/com_dotnet/com_dotnet.c15
-rw-r--r--ext/com_dotnet/com_extension.c136
-rw-r--r--ext/com_dotnet/com_extension.stub.php66
-rw-r--r--ext/com_dotnet/com_extension_arginfo.h110
-rw-r--r--ext/com_dotnet/com_handlers.c162
-rw-r--r--ext/com_dotnet/com_iterator.c4
-rw-r--r--ext/com_dotnet/com_misc.c2
-rw-r--r--ext/com_dotnet/com_olechar.c2
-rw-r--r--ext/com_dotnet/com_persist.c40
-rw-r--r--ext/com_dotnet/com_saproxy.c82
-rw-r--r--ext/com_dotnet/com_typeinfo.c2
-rw-r--r--ext/com_dotnet/com_variant.c25
-rw-r--r--ext/com_dotnet/com_wrapper.c4
-rw-r--r--ext/com_dotnet/php_com_dotnet.h2
-rw-r--r--ext/com_dotnet/php_com_dotnet_internal.h6
-rw-r--r--ext/com_dotnet/tests/27974.phpt38
-rw-r--r--ext/com_dotnet/tests/bug33386.phpt26
-rw-r--r--ext/com_dotnet/tests/bug34272.phpt12
-rw-r--r--ext/com_dotnet/tests/bug39596.phpt12
-rw-r--r--ext/com_dotnet/tests/bug39606.phpt2
-rw-r--r--ext/com_dotnet/tests/bug66431_0.phpt6
-rw-r--r--ext/com_dotnet/tests/bug66431_1.phpt6
-rw-r--r--ext/com_dotnet/tests/bug77177.phpt2
-rw-r--r--ext/com_dotnet/tests/bug77578.phpt2
-rw-r--r--ext/com_dotnet/tests/bug77621.phpt2
-rw-r--r--ext/com_dotnet/tests/variants.phpt44
-rw-r--r--ext/com_dotnet/tests/variants_x64.phpt44
-rw-r--r--ext/ctype/ctype.c49
-rw-r--r--ext/ctype/ctype.stub.php23
-rw-r--r--ext/ctype/ctype_arginfo.h25
-rw-r--r--ext/ctype/php_ctype.h2
-rw-r--r--ext/ctype/tests/001.phpt4
-rw-r--r--ext/ctype/tests/002.phpt18
-rw-r--r--ext/ctype/tests/bug25745.phpt22
-rw-r--r--ext/ctype/tests/ctype_alnum_basic.phpt2
-rw-r--r--ext/ctype/tests/ctype_alnum_variation1.phpt2
-rw-r--r--ext/ctype/tests/ctype_alnum_variation2.phpt8
-rw-r--r--ext/ctype/tests/ctype_alnum_variation3.phpt2
-rw-r--r--ext/ctype/tests/ctype_alnum_variation4.phpt14
-rw-r--r--ext/ctype/tests/ctype_alpha_basic.phpt2
-rw-r--r--ext/ctype/tests/ctype_alpha_variation1.phpt8
-rw-r--r--ext/ctype/tests/ctype_alpha_variation2.phpt8
-rw-r--r--ext/ctype/tests/ctype_alpha_variation3.phpt2
-rw-r--r--ext/ctype/tests/ctype_alpha_variation4.phpt14
-rw-r--r--ext/ctype/tests/ctype_cntrl_basic.phpt2
-rw-r--r--ext/ctype/tests/ctype_cntrl_variation1.phpt2
-rw-r--r--ext/ctype/tests/ctype_cntrl_variation2.phpt8
-rw-r--r--ext/ctype/tests/ctype_cntrl_variation3.phpt2
-rw-r--r--ext/ctype/tests/ctype_cntrl_variation4.phpt14
-rw-r--r--ext/ctype/tests/ctype_digit_basic.phpt2
-rw-r--r--ext/ctype/tests/ctype_digit_variation1.phpt8
-rw-r--r--ext/ctype/tests/ctype_digit_variation2.phpt8
-rw-r--r--ext/ctype/tests/ctype_digit_variation3.phpt2
-rw-r--r--ext/ctype/tests/ctype_digit_variation4.phpt14
-rw-r--r--ext/ctype/tests/ctype_graph_basic.phpt2
-rw-r--r--ext/ctype/tests/ctype_graph_variation1.phpt8
-rw-r--r--ext/ctype/tests/ctype_graph_variation2.phpt8
-rw-r--r--ext/ctype/tests/ctype_graph_variation3.phpt2
-rw-r--r--ext/ctype/tests/ctype_graph_variation4.phpt14
-rw-r--r--ext/ctype/tests/ctype_lower_basic.phpt2
-rw-r--r--ext/ctype/tests/ctype_lower_variation1.phpt14
-rw-r--r--ext/ctype/tests/ctype_lower_variation2.phpt8
-rw-r--r--ext/ctype/tests/ctype_lower_variation3.phpt2
-rw-r--r--ext/ctype/tests/ctype_lower_variation4.phpt14
-rw-r--r--ext/ctype/tests/ctype_print_basic.phpt2
-rw-r--r--ext/ctype/tests/ctype_print_variation1.phpt8
-rw-r--r--ext/ctype/tests/ctype_print_variation2.phpt8
-rw-r--r--ext/ctype/tests/ctype_print_variation3.phpt2
-rw-r--r--ext/ctype/tests/ctype_print_variation4.phpt14
-rw-r--r--ext/ctype/tests/ctype_punct_basic.phpt2
-rw-r--r--ext/ctype/tests/ctype_punct_variation1.phpt2
-rw-r--r--ext/ctype/tests/ctype_punct_variation2.phpt8
-rw-r--r--ext/ctype/tests/ctype_punct_variation3.phpt2
-rw-r--r--ext/ctype/tests/ctype_punct_variation4.phpt14
-rw-r--r--ext/ctype/tests/ctype_space_basic.phpt2
-rw-r--r--ext/ctype/tests/ctype_space_variation1.phpt18
-rw-r--r--ext/ctype/tests/ctype_space_variation2.phpt8
-rw-r--r--ext/ctype/tests/ctype_space_variation3.phpt2
-rw-r--r--ext/ctype/tests/ctype_space_variation4.phpt14
-rw-r--r--ext/ctype/tests/ctype_upper_basic.phpt2
-rw-r--r--ext/ctype/tests/ctype_upper_variation1.phpt14
-rw-r--r--ext/ctype/tests/ctype_upper_variation2.phpt8
-rw-r--r--ext/ctype/tests/ctype_upper_variation3.phpt2
-rw-r--r--ext/ctype/tests/ctype_upper_variation4.phpt14
-rw-r--r--ext/ctype/tests/ctype_xdigit_basic.phpt2
-rw-r--r--ext/ctype/tests/ctype_xdigit_variation1.phpt8
-rw-r--r--ext/ctype/tests/ctype_xdigit_variation2.phpt8
-rw-r--r--ext/ctype/tests/ctype_xdigit_variation3.phpt2
-rw-r--r--ext/ctype/tests/ctype_xdigit_variation4.phpt10
-rw-r--r--ext/curl/config.m42
-rw-r--r--ext/curl/curl.stub.php119
-rw-r--r--ext/curl/curl_arginfo.h134
-rw-r--r--ext/curl/curl_file.c31
-rw-r--r--ext/curl/curl_file.stub.php24
-rw-r--r--ext/curl/curl_file_arginfo.h22
-rw-r--r--ext/curl/interface.c424
-rw-r--r--ext/curl/multi.c70
-rw-r--r--ext/curl/php_curl.h2
-rw-r--r--ext/curl/share.c12
-rw-r--r--ext/curl/tests/bug45161.phpt20
-rw-r--r--ext/curl/tests/bug46711.phpt6
-rw-r--r--ext/curl/tests/bug48203_multi.phpt68
-rw-r--r--ext/curl/tests/bug48207.phpt2
-rw-r--r--ext/curl/tests/bug54798-unix.phpt32
-rw-r--r--ext/curl/tests/bug54798.phpt32
-rw-r--r--ext/curl/tests/bug54995.phpt26
-rw-r--r--ext/curl/tests/bug55767.phpt2
-rw-r--r--ext/curl/tests/bug63363.phpt34
-rw-r--r--ext/curl/tests/bug63795.phpt4
-rw-r--r--ext/curl/tests/bug64267.phpt20
-rw-r--r--ext/curl/tests/bug65646_open_basedir_new.phpt1
-rw-r--r--ext/curl/tests/bug65646_open_basedir_old.phpt18
-rw-r--r--ext/curl/tests/bug67643.phpt26
-rw-r--r--ext/curl/tests/bug68937.phpt26
-rw-r--r--ext/curl/tests/bug68937_2.phpt28
-rw-r--r--ext/curl/tests/bug69316.phpt2
-rw-r--r--ext/curl/tests/bug69485.phpt6
-rw-r--r--ext/curl/tests/bug71523.phpt8
-rw-r--r--ext/curl/tests/bug72189.phpt8
-rw-r--r--ext/curl/tests/bug76675.phpt4
-rw-r--r--ext/curl/tests/bug77535.phpt2
-rw-r--r--ext/curl/tests/bug77711.phpt2
-rw-r--r--ext/curl/tests/bug79033.phpt6
-rw-r--r--ext/curl/tests/check_win_config.phpt12
-rw-r--r--ext/curl/tests/curl_basic_001.phpt2
-rw-r--r--ext/curl/tests/curl_basic_002.phpt2
-rw-r--r--ext/curl/tests/curl_basic_003.phpt2
-rw-r--r--ext/curl/tests/curl_basic_004.phpt2
-rw-r--r--ext/curl/tests/curl_basic_005.phpt2
-rw-r--r--ext/curl/tests/curl_basic_011.phpt2
-rw-r--r--ext/curl/tests/curl_basic_012.phpt2
-rw-r--r--ext/curl/tests/curl_basic_013.phpt2
-rw-r--r--ext/curl/tests/curl_basic_014.phpt2
-rw-r--r--ext/curl/tests/curl_basic_015.phpt2
-rw-r--r--ext/curl/tests/curl_basic_016.phpt63
-rw-r--r--ext/curl/tests/curl_basic_018.phpt2
-rw-r--r--ext/curl/tests/curl_basic_019.phpt2
-rw-r--r--ext/curl/tests/curl_basic_020.phpt2
-rw-r--r--ext/curl/tests/curl_basic_021.phpt2
-rw-r--r--ext/curl/tests/curl_basic_022.phpt7
-rw-r--r--ext/curl/tests/curl_basic_023.phpt2
-rw-r--r--ext/curl/tests/curl_basic_024.phpt2
-rw-r--r--ext/curl/tests/curl_close_basic.phpt2
-rw-r--r--ext/curl/tests/curl_copy_handle_basic.phpt2
-rw-r--r--ext/curl/tests/curl_copy_handle_basic_001.phpt2
-rw-r--r--ext/curl/tests/curl_copy_handle_basic_002.phpt2
-rw-r--r--ext/curl/tests/curl_copy_handle_basic_004.phpt2
-rw-r--r--ext/curl/tests/curl_copy_handle_basic_005.phpt2
-rw-r--r--ext/curl/tests/curl_copy_handle_basic_006.phpt2
-rw-r--r--ext/curl/tests/curl_copy_handle_basic_007.phpt2
-rw-r--r--ext/curl/tests/curl_copy_handle_variation1.phpt2
-rw-r--r--ext/curl/tests/curl_copy_handle_variation2.phpt2
-rw-r--r--ext/curl/tests/curl_copy_handle_variation3.phpt2
-rw-r--r--ext/curl/tests/curl_file_deleted_before_curl_close.phpt2
-rw-r--r--ext/curl/tests/curl_file_upload.phpt18
-rw-r--r--ext/curl/tests/curl_file_upload_stream.phpt2
-rw-r--r--ext/curl/tests/curl_ftp_pasv.phpt14
-rw-r--r--ext/curl/tests/curl_multi_close_basic.phpt2
-rw-r--r--ext/curl/tests/curl_multi_close_basic001.phpt16
-rw-r--r--ext/curl/tests/curl_multi_errno_strerror_001.phpt4
-rw-r--r--ext/curl/tests/curl_multi_getcontent_basic3.phpt52
-rw-r--r--ext/curl/tests/curl_multi_init_basic.phpt2
-rw-r--r--ext/curl/tests/curl_multi_segfault.phpt14
-rw-r--r--ext/curl/tests/curl_multi_select_basic1.phpt2
-rw-r--r--ext/curl/tests/curl_multi_setopt_basic001.phpt4
-rw-r--r--ext/curl/tests/curl_multi_strerror_001.phpt4
-rw-r--r--ext/curl/tests/curl_reset.phpt2
-rw-r--r--ext/curl/tests/curl_setopt_CURLOPT_READFUNCTION.phpt2
-rw-r--r--ext/curl/tests/curl_setopt_error.phpt32
-rw-r--r--ext/curl/tests/curl_share_errno_strerror_001.phpt4
-rw-r--r--ext/curl/tests/curl_strerror_001.phpt4
-rw-r--r--ext/curl/tests/curl_version_error_001.phpt4
-rw-r--r--ext/curl/tests/curl_write_callback.phpt4
-rw-r--r--ext/curl/tests/curl_writeheader_callback.phpt4
-rw-r--r--ext/date/php_date.c975
-rw-r--r--ext/date/php_date.h4
-rw-r--r--ext/date/php_date.stub.php289
-rw-r--r--ext/date/php_date_arginfo.h399
-rw-r--r--ext/date/tests/002.phpt72
-rw-r--r--ext/date/tests/003.phpt2
-rw-r--r--ext/date/tests/004.phpt24
-rw-r--r--ext/date/tests/005.phpt9
-rw-r--r--ext/date/tests/006.phpt5
-rw-r--r--ext/date/tests/007.phpt3
-rw-r--r--ext/date/tests/008.phpt3
-rw-r--r--ext/date/tests/009.phpt9
-rw-r--r--ext/date/tests/009_win32.phpt9
-rw-r--r--ext/date/tests/011.phpt5
-rw-r--r--ext/date/tests/012.phpt13
-rw-r--r--ext/date/tests/013.phpt12
-rw-r--r--ext/date/tests/014.phpt6
-rw-r--r--ext/date/tests/68062.phpt12
-rw-r--r--ext/date/tests/DateTimeImmutable_createFromInterface.phpt79
-rw-r--r--ext/date/tests/DateTimeImmutable_createFromMutable.phpt13
-rw-r--r--ext/date/tests/DateTimeZone_clone_basic1.phpt8
-rw-r--r--ext/date/tests/DateTimeZone_clone_basic2.phpt16
-rw-r--r--ext/date/tests/DateTimeZone_clone_basic3.phpt2
-rw-r--r--ext/date/tests/DateTimeZone_clone_basic4.phpt8
-rw-r--r--ext/date/tests/DateTimeZone_compare_basic1.phpt6
-rw-r--r--ext/date/tests/DateTimeZone_construct_basic.phpt2
-rw-r--r--ext/date/tests/DateTimeZone_construct_error.phpt2
-rw-r--r--ext/date/tests/DateTimeZone_extends_basic1.phpt10
-rw-r--r--ext/date/tests/DateTimeZone_getName_basic1.phpt2
-rw-r--r--ext/date/tests/DateTimeZone_getOffset_basic1.phpt2
-rw-r--r--ext/date/tests/DateTimeZone_getTransitions_basic1.phpt4
-rw-r--r--ext/date/tests/DateTimeZone_listAbbreviations_basic1.phpt2
-rw-r--r--ext/date/tests/DateTimeZone_listIdentifiers_basic1.phpt2
-rw-r--r--ext/date/tests/DateTimeZone_serialize_type_1.phpt2
-rw-r--r--ext/date/tests/DateTimeZone_serialize_type_2.phpt2
-rw-r--r--ext/date/tests/DateTimeZone_serialize_type_3.phpt2
-rw-r--r--ext/date/tests/DateTimeZone_verify.phpt2
-rw-r--r--ext/date/tests/DateTime_clone_basic1.phpt2
-rw-r--r--ext/date/tests/DateTime_clone_basic2.phpt16
-rw-r--r--ext/date/tests/DateTime_clone_basic3.phpt2
-rw-r--r--ext/date/tests/DateTime_clone_basic4.phpt8
-rw-r--r--ext/date/tests/DateTime_compare_basic1.phpt6
-rw-r--r--ext/date/tests/DateTime_construct_basic1.phpt2
-rw-r--r--ext/date/tests/DateTime_construct_error.phpt2
-rw-r--r--ext/date/tests/DateTime_createFromImmutable.phpt11
-rw-r--r--ext/date/tests/DateTime_createFromInterface.phpt79
-rw-r--r--ext/date/tests/DateTime_extends_basic1.phpt12
-rw-r--r--ext/date/tests/DateTime_extends_basic2.phpt4
-rw-r--r--ext/date/tests/DateTime_extends_basic3.phpt12
-rw-r--r--ext/date/tests/DateTime_fix_createFromFormat.phpt2
-rw-r--r--ext/date/tests/DateTime_format_basic1.phpt2
-rw-r--r--ext/date/tests/DateTime_format_basic2.phpt2
-rw-r--r--ext/date/tests/DateTime_getOffset_basic1.phpt2
-rw-r--r--ext/date/tests/DateTime_getTimeZone_basic1.phpt2
-rw-r--r--ext/date/tests/DateTime_modify_basic1.phpt2
-rw-r--r--ext/date/tests/DateTime_serialize.phpt2
-rw-r--r--ext/date/tests/DateTime_setDate_basic1.phpt2
-rw-r--r--ext/date/tests/DateTime_setISODate_basic1.phpt2
-rw-r--r--ext/date/tests/DateTime_setTime_basic1.phpt2
-rw-r--r--ext/date/tests/DateTime_setTimezone_basic1.phpt2
-rw-r--r--ext/date/tests/ExtendDateTime.phpt2
-rw-r--r--ext/date/tests/bug13142.phpt2
-rw-r--r--ext/date/tests/bug20382-1.phpt10
-rw-r--r--ext/date/tests/bug20382-2.phpt68
-rw-r--r--ext/date/tests/bug21399.phpt2
-rw-r--r--ext/date/tests/bug26198.phpt6
-rw-r--r--ext/date/tests/bug26317.phpt6
-rw-r--r--ext/date/tests/bug26320.phpt4
-rw-r--r--ext/date/tests/bug26694.phpt2
-rw-r--r--ext/date/tests/bug27780.phpt44
-rw-r--r--ext/date/tests/bug28024.phpt4
-rw-r--r--ext/date/tests/bug29150.phpt2
-rw-r--r--ext/date/tests/bug30096.phpt20
-rw-r--r--ext/date/tests/bug33578.phpt16
-rw-r--r--ext/date/tests/bug33869.phpt28
-rw-r--r--ext/date/tests/bug33957.phpt30
-rw-r--r--ext/date/tests/bug34676.phpt6
-rw-r--r--ext/date/tests/bug34771.phpt12
-rw-r--r--ext/date/tests/bug35425.phpt2
-rw-r--r--ext/date/tests/bug35624.phpt6
-rw-r--r--ext/date/tests/bug35885.phpt4
-rw-r--r--ext/date/tests/bug36988.phpt10
-rw-r--r--ext/date/tests/bug37747.phpt2
-rw-r--r--ext/date/tests/bug42910.phpt18
-rw-r--r--ext/date/tests/bug43808.phpt2
-rw-r--r--ext/date/tests/bug44562.phpt6
-rw-r--r--ext/date/tests/bug44742.phpt26
-rw-r--r--ext/date/tests/bug45543.phpt22
-rw-r--r--ext/date/tests/bug48476.phpt36
-rw-r--r--ext/date/tests/bug50392.phpt16
-rw-r--r--ext/date/tests/bug51096.phpt32
-rw-r--r--ext/date/tests/bug51866.phpt24
-rw-r--r--ext/date/tests/bug52062.phpt9
-rw-r--r--ext/date/tests/bug52808.phpt18
-rw-r--r--ext/date/tests/bug53437.phpt2
-rw-r--r--ext/date/tests/bug53437_var2.phpt2
-rw-r--r--ext/date/tests/bug53437_var3.phpt2
-rw-r--r--ext/date/tests/bug53437_var4.phpt20
-rw-r--r--ext/date/tests/bug53437_var5.phpt2
-rw-r--r--ext/date/tests/bug53437_var6.phpt2
-rw-r--r--ext/date/tests/bug54283.phpt4
-rw-r--r--ext/date/tests/bug61642.phpt20
-rw-r--r--ext/date/tests/bug62500.phpt2
-rw-r--r--ext/date/tests/bug63391.phpt2
-rw-r--r--ext/date/tests/bug63435.phpt10
-rw-r--r--ext/date/tests/bug63740.phpt30
-rw-r--r--ext/date/tests/bug64887.phpt28
-rw-r--r--ext/date/tests/bug65184.phpt18
-rw-r--r--ext/date/tests/bug66985.phpt14
-rw-r--r--ext/date/tests/bug67118.phpt30
-rw-r--r--ext/date/tests/bug70245.phpt9
-rw-r--r--ext/date/tests/bug72096.phpt4
-rw-r--r--ext/date/tests/bug73294.phpt18
-rw-r--r--ext/date/tests/bug73837.phpt6
-rw-r--r--ext/date/tests/bug73858.phpt2
-rw-r--r--ext/date/tests/bug74652.phpt18
-rw-r--r--ext/date/tests/bug74852.phpt2
-rw-r--r--ext/date/tests/bug75002.phpt4
-rw-r--r--ext/date/tests/bug75232.phpt4
-rw-r--r--ext/date/tests/checkdate_basic1.phpt2
-rw-r--r--ext/date/tests/date-time-modify-times.phpt42
-rw-r--r--ext/date/tests/date.phpt4
-rw-r--r--ext/date/tests/date_add_basic.phpt14
-rw-r--r--ext/date/tests/date_basic1.phpt2
-rw-r--r--ext/date/tests/date_create-1.phpt2
-rw-r--r--ext/date/tests/date_create-relative.phpt58
-rw-r--r--ext/date/tests/date_create_basic.phpt2
-rw-r--r--ext/date/tests/date_date_set_basic1.phpt2
-rw-r--r--ext/date/tests/date_default_timezone_get-1.phpt6
-rw-r--r--ext/date/tests/date_default_timezone_get-2.phpt4
-rw-r--r--ext/date/tests/date_default_timezone_get-3.phpt6
-rw-r--r--ext/date/tests/date_default_timezone_get-4.phpt2
-rw-r--r--ext/date/tests/date_default_timezone_set-1.phpt22
-rw-r--r--ext/date/tests/date_default_timezone_set_error.phpt19
-rw-r--r--ext/date/tests/date_diff.phpt72
-rw-r--r--ext/date/tests/date_format_basic1.phpt2
-rw-r--r--ext/date/tests/date_interval_bad_format_leak.phpt21
-rw-r--r--ext/date/tests/date_interval_prop_dim.phpt4
-rw-r--r--ext/date/tests/date_isodate_set_basic1.phpt2
-rw-r--r--ext/date/tests/date_modify_basic1.phpt2
-rw-r--r--ext/date/tests/date_offset_get_basic1.phpt2
-rw-r--r--ext/date/tests/date_parse_001.phpt4
-rw-r--r--ext/date/tests/date_parse_basic1.phpt2
-rw-r--r--ext/date/tests/date_parse_error.phpt20
-rw-r--r--ext/date/tests/date_period-immutable.phpt12
-rw-r--r--ext/date/tests/date_sub_basic.phpt14
-rw-r--r--ext/date/tests/date_sun_info_001.phpt4
-rw-r--r--ext/date/tests/date_sun_info_002.phpt6
-rw-r--r--ext/date/tests/date_sunrise_and_sunset_basic.phpt2
-rw-r--r--ext/date/tests/date_sunrise_variation7.phpt32
-rw-r--r--ext/date/tests/date_sunrise_variation8.phpt28
-rw-r--r--ext/date/tests/date_sunrise_variation9.phpt61
-rw-r--r--ext/date/tests/date_sunset_variation7.phpt34
-rw-r--r--ext/date/tests/date_sunset_variation8.phpt28
-rw-r--r--ext/date/tests/date_sunset_variation9.phpt61
-rw-r--r--ext/date/tests/date_time_immutable.phpt6
-rw-r--r--ext/date/tests/date_time_set_basic1.phpt2
-rw-r--r--ext/date/tests/date_timezone_get_basic1.phpt2
-rw-r--r--ext/date/tests/date_timezone_set_basic1.phpt2
-rw-r--r--ext/date/tests/default-timezone-1.phpt4
-rw-r--r--ext/date/tests/default-timezone-2.phpt4
-rw-r--r--ext/date/tests/examine_diff.inc80
-rw-r--r--ext/date/tests/format-negative-timestamp.phpt12
-rw-r--r--ext/date/tests/getdate_basic.phpt2
-rw-r--r--ext/date/tests/getdate_variation2.phpt10
-rw-r--r--ext/date/tests/getdate_variation3.phpt10
-rw-r--r--ext/date/tests/getdate_variation4.phpt12
-rw-r--r--ext/date/tests/getdate_variation5.phpt30
-rw-r--r--ext/date/tests/getdate_variation6.phpt8
-rw-r--r--ext/date/tests/getdate_variation7.phpt37
-rw-r--r--ext/date/tests/gettimeofday_basic.phpt2
-rw-r--r--ext/date/tests/gmdate_basic.phpt2
-rw-r--r--ext/date/tests/gmdate_variation10.phpt2
-rw-r--r--ext/date/tests/gmdate_variation11.phpt2
-rw-r--r--ext/date/tests/gmdate_variation12.phpt2
-rw-r--r--ext/date/tests/gmdate_variation13.phpt24
-rw-r--r--ext/date/tests/gmdate_variation14.phpt40
-rw-r--r--ext/date/tests/gmdate_variation3.phpt12
-rw-r--r--ext/date/tests/gmdate_variation4.phpt2
-rw-r--r--ext/date/tests/gmdate_variation5.phpt2
-rw-r--r--ext/date/tests/gmdate_variation6.phpt2
-rw-r--r--ext/date/tests/gmdate_variation7.phpt2
-rw-r--r--ext/date/tests/gmdate_variation9.phpt24
-rw-r--r--ext/date/tests/gmmktime_basic.phpt8
-rw-r--r--ext/date/tests/gmmktime_variation7.phpt2
-rw-r--r--ext/date/tests/gmmktime_variation8.phpt2
-rw-r--r--ext/date/tests/gmmktime_variation9.phpt14
-rw-r--r--ext/date/tests/gmstrftime_basic.phpt2
-rw-r--r--ext/date/tests/gmstrftime_variation10.phpt6
-rw-r--r--ext/date/tests/gmstrftime_variation11.phpt2
-rw-r--r--ext/date/tests/gmstrftime_variation12.phpt2
-rw-r--r--ext/date/tests/gmstrftime_variation13.phpt10
-rw-r--r--ext/date/tests/gmstrftime_variation14.phpt10
-rw-r--r--ext/date/tests/gmstrftime_variation15.phpt8
-rw-r--r--ext/date/tests/gmstrftime_variation16.phpt8
-rw-r--r--ext/date/tests/gmstrftime_variation17.phpt2
-rw-r--r--ext/date/tests/gmstrftime_variation18.phpt2
-rw-r--r--ext/date/tests/gmstrftime_variation19.phpt6
-rw-r--r--ext/date/tests/gmstrftime_variation20.phpt6
-rw-r--r--ext/date/tests/gmstrftime_variation21.phpt6
-rw-r--r--ext/date/tests/gmstrftime_variation22.phpt6
-rw-r--r--ext/date/tests/gmstrftime_variation3.phpt6
-rw-r--r--ext/date/tests/gmstrftime_variation4.phpt4
-rw-r--r--ext/date/tests/gmstrftime_variation5.phpt10
-rw-r--r--ext/date/tests/gmstrftime_variation6.phpt12
-rw-r--r--ext/date/tests/gmstrftime_variation7.phpt8
-rw-r--r--ext/date/tests/gmstrftime_variation8.phpt4
-rw-r--r--ext/date/tests/gmstrftime_variation9.phpt6
-rw-r--r--ext/date/tests/idate_basic.phpt2
-rw-r--r--ext/date/tests/idate_variation3.phpt41
-rw-r--r--ext/date/tests/idate_variation4.phpt20
-rw-r--r--ext/date/tests/idate_variation5.phpt16
-rw-r--r--ext/date/tests/idate_variation6.phpt2
-rw-r--r--ext/date/tests/localtime_basic.phpt2
-rw-r--r--ext/date/tests/localtime_variation3.phpt50
-rw-r--r--ext/date/tests/localtime_variation4.phpt10
-rw-r--r--ext/date/tests/localtime_variation5.phpt10
-rw-r--r--ext/date/tests/microtime_basic.phpt2
-rw-r--r--ext/date/tests/microtime_error.phpt42
-rw-r--r--ext/date/tests/mktime-3-64bit.phpt24
-rw-r--r--ext/date/tests/mktime-3.phpt26
-rw-r--r--ext/date/tests/mktime_basic1.phpt2
-rw-r--r--ext/date/tests/mktime_error.phpt22
-rw-r--r--ext/date/tests/oo_001.phpt40
-rw-r--r--ext/date/tests/rfc-datetime_and_daylight_saving_time-type1.phpt98
-rw-r--r--ext/date/tests/rfc-datetime_and_daylight_saving_time-type2.phpt98
-rw-r--r--ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-ba.phpt22
-rw-r--r--ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bd1.phpt10
-rw-r--r--ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bd2.phpt8
-rw-r--r--ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bs.phpt20
-rw-r--r--ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fa.phpt12
-rw-r--r--ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fd.phpt14
-rw-r--r--ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fs.phpt14
-rw-r--r--ext/date/tests/strftime_basic.phpt2
-rw-r--r--ext/date/tests/strftime_variation10.phpt12
-rw-r--r--ext/date/tests/strftime_variation11.phpt2
-rw-r--r--ext/date/tests/strftime_variation12.phpt2
-rw-r--r--ext/date/tests/strftime_variation13.phpt14
-rw-r--r--ext/date/tests/strftime_variation14.phpt14
-rw-r--r--ext/date/tests/strftime_variation15.phpt12
-rw-r--r--ext/date/tests/strftime_variation16.phpt12
-rw-r--r--ext/date/tests/strftime_variation17.phpt2
-rw-r--r--ext/date/tests/strftime_variation18.phpt2
-rw-r--r--ext/date/tests/strftime_variation19.phpt10
-rw-r--r--ext/date/tests/strftime_variation20.phpt10
-rw-r--r--ext/date/tests/strftime_variation21.phpt10
-rw-r--r--ext/date/tests/strftime_variation22.phpt10
-rw-r--r--ext/date/tests/strftime_variation23.phpt42
-rw-r--r--ext/date/tests/strftime_variation3.phpt6
-rw-r--r--ext/date/tests/strftime_variation4.phpt4
-rw-r--r--ext/date/tests/strftime_variation5.phpt10
-rw-r--r--ext/date/tests/strftime_variation6.phpt12
-rw-r--r--ext/date/tests/strftime_variation7.phpt8
-rw-r--r--ext/date/tests/strftime_variation8.phpt2
-rw-r--r--ext/date/tests/strftime_variation9.phpt12
-rw-r--r--ext/date/tests/strtotime-mysql-64bit.phpt12
-rw-r--r--ext/date/tests/strtotime-mysql.phpt12
-rw-r--r--ext/date/tests/strtotime-relative.phpt62
-rw-r--r--ext/date/tests/strtotime.phpt2
-rw-r--r--ext/date/tests/strtotime2.phpt26
-rw-r--r--ext/date/tests/strtotime3-64bit.phpt60
-rw-r--r--ext/date/tests/strtotime3.phpt60
-rw-r--r--ext/date/tests/strtotime_variation_scottish.phpt10
-rw-r--r--ext/date/tests/sunfuncts.phpt12
-rw-r--r--ext/date/tests/test-parse-from-format.phpt22
-rw-r--r--ext/date/tests/time_basic.phpt2
-rw-r--r--ext/date/tests/timezone-configuration.phpt12
-rw-r--r--ext/date/tests/timezone_abbreviations_list_basic1.phpt2
-rw-r--r--ext/date/tests/timezone_identifiers_list_basic1.phpt2
-rw-r--r--ext/date/tests/timezone_name_from_abbr_basic1.phpt4
-rw-r--r--ext/date/tests/timezone_offset_get_basic1.phpt2
-rw-r--r--ext/date/tests/timezone_offset_get_error.phpt92
-rw-r--r--ext/date/tests/timezone_open_basic1.phpt2
-rw-r--r--ext/date/tests/timezone_transitions_get_basic1.phpt2
-rw-r--r--ext/dba/dba.c113
-rw-r--r--ext/dba/dba.stub.php59
-rw-r--r--ext/dba/dba_arginfo.h58
-rw-r--r--ext/dba/dba_cdb.c2
-rw-r--r--ext/dba/dba_db1.c2
-rw-r--r--ext/dba/dba_db2.c2
-rw-r--r--ext/dba/dba_db3.c2
-rw-r--r--ext/dba/dba_db4.c2
-rw-r--r--ext/dba/dba_dbm.c2
-rw-r--r--ext/dba/dba_flatfile.c2
-rw-r--r--ext/dba/dba_gdbm.c2
-rw-r--r--ext/dba/dba_inifile.c2
-rw-r--r--ext/dba/dba_lmdb.c2
-rw-r--r--ext/dba/dba_ndbm.c2
-rw-r--r--ext/dba/dba_qdbm.c2
-rw-r--r--ext/dba/dba_tcadb.c2
-rw-r--r--ext/dba/libcdb/cdb.c2
-rw-r--r--ext/dba/libcdb/cdb.h2
-rw-r--r--ext/dba/libcdb/cdb_make.c2
-rw-r--r--ext/dba/libcdb/cdb_make.h2
-rw-r--r--ext/dba/libcdb/uint32.c2
-rw-r--r--ext/dba/libcdb/uint32.h2
-rw-r--r--ext/dba/libflatfile/flatfile.c2
-rw-r--r--ext/dba/libflatfile/flatfile.h2
-rw-r--r--ext/dba/libinifile/inifile.c2
-rw-r--r--ext/dba/libinifile/inifile.h2
-rw-r--r--ext/dba/php_dba.h2
-rw-r--r--ext/dba/php_tcadb.h2
-rw-r--r--ext/dba/tests/bug36436.phpt2
-rw-r--r--ext/dba/tests/bug38698.phpt18
-rw-r--r--ext/dba/tests/bug48240.phpt2
-rw-r--r--ext/dba/tests/bug62490.phpt8
-rw-r--r--ext/dba/tests/bug70825.phpt2
-rw-r--r--ext/dba/tests/bug71514.phpt2
-rw-r--r--ext/dba/tests/bug72885.phpt2
-rw-r--r--ext/dba/tests/clean.inc6
-rw-r--r--ext/dba/tests/dba001.phpt14
-rw-r--r--ext/dba/tests/dba002.phpt18
-rw-r--r--ext/dba/tests/dba003.phpt22
-rw-r--r--ext/dba/tests/dba004.phpt30
-rw-r--r--ext/dba/tests/dba005.phpt44
-rw-r--r--ext/dba/tests/dba006.phpt48
-rw-r--r--ext/dba/tests/dba007.phpt40
-rw-r--r--ext/dba/tests/dba009.phpt32
-rw-r--r--ext/dba/tests/dba011.phpt4
-rw-r--r--ext/dba/tests/dba015.phpt2
-rw-r--r--ext/dba/tests/dba016.phpt2
-rw-r--r--ext/dba/tests/dba_cdb.phpt8
-rw-r--r--ext/dba/tests/dba_cdb_001.phpt2
-rw-r--r--ext/dba/tests/dba_cdb_make.phpt40
-rw-r--r--ext/dba/tests/dba_cdb_read.phpt94
-rw-r--r--ext/dba/tests/dba_db1.phpt8
-rw-r--r--ext/dba/tests/dba_db2.phpt8
-rw-r--r--ext/dba/tests/dba_db3.phpt8
-rw-r--r--ext/dba/tests/dba_db4_000.phpt2
-rw-r--r--ext/dba/tests/dba_db4_018.phpt2
-rw-r--r--ext/dba/tests/dba_db4_optimize.phpt3
-rw-r--r--ext/dba/tests/dba_db4_sync.phpt3
-rw-r--r--ext/dba/tests/dba_dbm.phpt8
-rw-r--r--ext/dba/tests/dba_flatfile.phpt8
-rw-r--r--ext/dba/tests/dba_gdbm.phpt12
-rw-r--r--ext/dba/tests/dba_handler.inc178
-rw-r--r--ext/dba/tests/dba_handlers.phpt11
-rw-r--r--ext/dba/tests/dba_inifile.phpt8
-rw-r--r--ext/dba/tests/dba_lmdb.phpt10
-rw-r--r--ext/dba/tests/dba_ndbm.phpt8
-rw-r--r--ext/dba/tests/dba_optimize.phpt11
-rw-r--r--ext/dba/tests/dba_qdbm.phpt10
-rw-r--r--ext/dba/tests/dba_split.phpt6
-rw-r--r--ext/dba/tests/dba_sync.phpt11
-rw-r--r--ext/dba/tests/dba_tcadb.phpt4
-rw-r--r--ext/dba/tests/skipif.inc42
-rw-r--r--ext/dba/tests/test.inc10
-rw-r--r--ext/dom/attr.c27
-rw-r--r--ext/dom/cdatasection.c18
-rw-r--r--ext/dom/characterdata.c61
-rw-r--r--ext/dom/comment.c18
-rw-r--r--ext/dom/config.m414
-rw-r--r--ext/dom/config.w3214
-rw-r--r--ext/dom/document.c347
-rw-r--r--ext/dom/documentfragment.c24
-rw-r--r--ext/dom/documenttype.c2
-rw-r--r--ext/dom/dom.stub.php331
-rw-r--r--ext/dom/dom_arginfo.h397
-rw-r--r--ext/dom/dom_ce.h13
-rw-r--r--ext/dom/dom_fe.h212
-rw-r--r--ext/dom/dom_iterators.c2
-rw-r--r--ext/dom/dom_properties.h32
-rw-r--r--ext/dom/domconfiguration.c92
-rw-r--r--ext/dom/domerror.c122
-rw-r--r--ext/dom/domerrorhandler.c60
-rw-r--r--ext/dom/domexception.c2
-rw-r--r--ext/dom/domimplementation.c52
-rw-r--r--ext/dom/domimplementationlist.c73
-rw-r--r--ext/dom/domimplementationsource.c76
-rw-r--r--ext/dom/domlocator.c109
-rw-r--r--ext/dom/domstringlist.c73
-rw-r--r--ext/dom/element.c217
-rw-r--r--ext/dom/entity.c2
-rw-r--r--ext/dom/entityreference.c15
-rw-r--r--ext/dom/namednodemap.c106
-rw-r--r--ext/dom/namelist.c84
-rw-r--r--ext/dom/node.c256
-rw-r--r--ext/dom/nodelist.c27
-rw-r--r--ext/dom/notation.c2
-rw-r--r--ext/dom/php_dom.c156
-rw-r--r--ext/dom/php_dom.h7
-rw-r--r--ext/dom/processinginstruction.c17
-rw-r--r--ext/dom/string_extend.c75
-rw-r--r--ext/dom/tests/DOMAttr_ownerElement_error_001.phpt2
-rw-r--r--ext/dom/tests/DOMCDATASection_construct_error_001.phpt10
-rw-r--r--ext/dom/tests/DOMCharacterData_length_error_001.phpt2
-rw-r--r--ext/dom/tests/DOMComment_replaceData_error1.phpt4
-rw-r--r--ext/dom/tests/DOMComment_replaceData_error2.phpt4
-rw-r--r--ext/dom/tests/DOMDocument_adoptNode.phpt16
-rw-r--r--ext/dom/tests/DOMDocument_createAttribute_error.phpt20
-rw-r--r--ext/dom/tests/DOMDocument_relaxNGValidateSource_basic.phpt22
-rw-r--r--ext/dom/tests/DOMDocument_relaxNGValidateSource_error1.phpt24
-rw-r--r--ext/dom/tests/DOMDocument_relaxNGValidateSource_error2.phpt6
-rw-r--r--ext/dom/tests/DOMDocument_relaxNGValidate_basic.phpt4
-rw-r--r--ext/dom/tests/DOMDocument_relaxNGValidate_error1.phpt6
-rw-r--r--ext/dom/tests/DOMDocument_relaxNGValidate_error2.phpt6
-rw-r--r--ext/dom/tests/DOMDocument_savexml_basic.phpt14
-rw-r--r--ext/dom/tests/DOMDocument_strictErrorChecking_variation.phpt16
-rw-r--r--ext/dom/tests/DOMImplementation_createDocumentType_basic.phpt17
-rw-r--r--ext/dom/tests/DOMNode_cloneNode_basic.phpt78
-rw-r--r--ext/dom/tests/DOMNode_getLineNo_basic.phpt2
-rw-r--r--ext/dom/tests/DOMNode_getNodePath_basic.phpt2
-rw-r--r--ext/dom/tests/DOMNode_hasChildNodes_basic.phpt2
-rw-r--r--ext/dom/tests/DOMNode_insertBefore_error1.phpt4
-rw-r--r--ext/dom/tests/DOMNode_insertBefore_error2.phpt2
-rw-r--r--ext/dom/tests/DOMNode_insertBefore_error3.phpt2
-rw-r--r--ext/dom/tests/DOMNode_insertBefore_error4.phpt2
-rw-r--r--ext/dom/tests/DOMNode_insertBefore_error5.phpt2
-rw-r--r--ext/dom/tests/DOMNode_insertBefore_error6.phpt2
-rw-r--r--ext/dom/tests/DOMNode_issamenode_basic.phpt10
-rw-r--r--ext/dom/tests/DOMNode_removeChild_basic.phpt104
-rw-r--r--ext/dom/tests/DOMText_appendData_basic.phpt2
-rw-r--r--ext/dom/tests/bug28817.phpt20
-rw-r--r--ext/dom/tests/bug34276.phpt8
-rw-r--r--ext/dom/tests/bug36756.phpt2
-rw-r--r--ext/dom/tests/bug38474.phpt2
-rw-r--r--ext/dom/tests/bug42082.phpt2
-rw-r--r--ext/dom/tests/bug47430.phpt13
-rw-r--r--ext/dom/tests/bug54601.phpt3
-rw-r--r--ext/dom/tests/bug55700.phpt40
-rw-r--r--ext/dom/tests/bug65196.phpt2
-rw-r--r--ext/dom/tests/bug67081.phpt34
-rw-r--r--ext/dom/tests/bug67949.phpt12
-rw-r--r--ext/dom/tests/bug69373.phpt8
-rw-r--r--ext/dom/tests/bug69846.phpt2
-rw-r--r--ext/dom/tests/bug70558.phpt6
-rw-r--r--ext/dom/tests/bug74416.phpt2
-rw-r--r--ext/dom/tests/bug75451.phpt2
-rw-r--r--ext/dom/tests/bug78025.phpt2
-rw-r--r--ext/dom/tests/dom001.phpt21
-rw-r--r--ext/dom/tests/dom002.phpt8
-rw-r--r--ext/dom/tests/dom003.phpt8
-rw-r--r--ext/dom/tests/dom007.phpt12
-rw-r--r--ext/dom/tests/dom_comment_basic.phpt14
-rw-r--r--ext/dom/tests/dom_comment_variation.phpt8
-rw-r--r--ext/dom/tests/dom_set_attr_node.phpt10
-rw-r--r--ext/dom/tests/dom_test.inc6
-rw-r--r--ext/dom/tests/dom_xinclude.phpt4
-rw-r--r--ext/dom/tests/domdocument_createentityreference_001.phpt8
-rw-r--r--ext/dom/tests/domelement.phpt10
-rw-r--r--ext/dom/tests/domobject_debug_handler.phpt4
-rw-r--r--ext/dom/tests/domxpath.phpt24
-rw-r--r--ext/dom/text.c51
-rw-r--r--ext/dom/typeinfo.c70
-rw-r--r--ext/dom/userdatahandler.c55
-rw-r--r--ext/dom/xml_common.h2
-rw-r--r--ext/dom/xpath.c86
-rw-r--r--ext/enchant/enchant.c126
-rw-r--r--ext/enchant/enchant.stub.php73
-rw-r--r--ext/enchant/enchant_arginfo.h93
-rw-r--r--ext/enchant/php_enchant.h2
-rw-r--r--ext/enchant/tests/broker_describe.phpt10
-rw-r--r--ext/enchant/tests/broker_dict_exists.phpt2
-rw-r--r--ext/enchant/tests/broker_free_02.phpt2
-rw-r--r--ext/enchant/tests/broker_free_dict.phpt2
-rw-r--r--ext/enchant/tests/broker_request_dict.phpt2
-rw-r--r--ext/enchant/tests/broker_request_dict_01.phpt2
-rw-r--r--ext/enchant/tests/broker_set_ordering.phpt2
-rw-r--r--ext/enchant/tests/bug13181.phpt10
-rw-r--r--ext/enchant/tests/dict_add_to_personal.phpt4
-rw-r--r--ext/enchant/tests/dict_add_to_session.phpt2
-rw-r--r--ext/enchant/tests/dict_check.phpt4
-rw-r--r--ext/enchant/tests/dict_describe.phpt2
-rw-r--r--ext/enchant/tests/dict_get_error.phpt2
-rw-r--r--ext/enchant/tests/dict_is_in_session.phpt2
-rw-r--r--ext/enchant/tests/dict_quick_check.phpt2
-rw-r--r--ext/enchant/tests/dict_quick_check_01.phpt2
-rw-r--r--ext/enchant/tests/dict_store_replacement.phpt2
-rw-r--r--ext/enchant/tests/dict_suggest.phpt6
-rw-r--r--ext/enchant/tests/enchant_broker_set_dict_path.phpt2
-rw-r--r--ext/exif/exif.c159
-rw-r--r--ext/exif/exif.stub.php9
-rw-r--r--ext/exif/exif_arginfo.h23
-rw-r--r--ext/exif/php_exif.h2
-rw-r--r--ext/exif/tests/bug34704-mb.phpt2
-rw-r--r--ext/exif/tests/bug34704.phpt2
-rw-r--r--ext/exif/tests/bug50660/bug50660.phpt2
-rw-r--r--ext/exif/tests/bug60150.phpt2
-rw-r--r--ext/exif/tests/bug64739.phpt8
-rw-r--r--ext/exif/tests/bug68547.phpt2
-rw-r--r--ext/exif/tests/bug72627.phpt4
-rw-r--r--ext/exif/tests/bug72735/bug72682.phpt6
-rw-r--r--ext/exif/tests/bug72735/bug72735.phpt14
-rw-r--r--ext/exif/tests/bug72819/bug72819.phpt2
-rw-r--r--ext/exif/tests/bug73115/bug73115.phpt2
-rw-r--r--ext/exif/tests/bug73737.phpt4
-rw-r--r--ext/exif/tests/bug74428/bug74428.phpt2
-rw-r--r--ext/exif/tests/bug76409.phpt2
-rw-r--r--ext/exif/tests/bug76423.phpt2
-rw-r--r--ext/exif/tests/bug77184/bug77184.phpt2
-rw-r--r--ext/exif/tests/exif_encoding_crash.phpt2
-rw-r--r--ext/exif/tests/exif_imagetype_basic-mb.phpt2
-rw-r--r--ext/exif/tests/exif_imagetype_basic.phpt2
-rw-r--r--ext/exif/tests/exif_imagetype_error.phpt21
-rw-r--r--ext/exif/tests/exif_read_data_0.phpt2
-rw-r--r--ext/exif/tests/exif_read_exif_data_basic-mb.phpt64
-rw-r--r--ext/exif/tests/exif_read_exif_data_basic.phpt64
-rw-r--r--ext/exif/tests/exif_tagname_basic.phpt2
-rw-r--r--ext/exif/tests/sony.phpt4
-rwxr-xr-xext/ext_skel.php7
-rw-r--r--ext/ffi/ffi.c396
-rw-r--r--ext/ffi/ffi.g4
-rw-r--r--ext/ffi/ffi.stub.php96
-rw-r--r--ext/ffi/ffi_arginfo.h73
-rw-r--r--ext/ffi/ffi_parser.c2
-rw-r--r--ext/ffi/php_ffi.h2
-rw-r--r--ext/ffi/tests/002.phpt194
-rw-r--r--ext/ffi/tests/003.phpt12
-rw-r--r--ext/ffi/tests/004.phpt20
-rw-r--r--ext/ffi/tests/008.phpt14
-rw-r--r--ext/ffi/tests/012.phpt4
-rw-r--r--ext/ffi/tests/013.phpt46
-rw-r--r--ext/ffi/tests/015.phpt52
-rw-r--r--ext/ffi/tests/016.phpt20
-rw-r--r--ext/ffi/tests/017.phpt14
-rw-r--r--ext/ffi/tests/018.phpt14
-rw-r--r--ext/ffi/tests/019.phpt12
-rw-r--r--ext/ffi/tests/020.phpt62
-rw-r--r--ext/ffi/tests/021.phpt6
-rw-r--r--ext/ffi/tests/022.phpt16
-rw-r--r--ext/ffi/tests/023.phpt6
-rw-r--r--ext/ffi/tests/024.phpt40
-rw-r--r--ext/ffi/tests/025.phpt28
-rw-r--r--ext/ffi/tests/026.phpt2
-rw-r--r--ext/ffi/tests/027.phpt66
-rw-r--r--ext/ffi/tests/028.phpt42
-rw-r--r--ext/ffi/tests/029.phpt4
-rw-r--r--ext/ffi/tests/031.phpt16
-rw-r--r--ext/ffi/tests/032.phpt24
-rw-r--r--ext/ffi/tests/035.phpt4
-rw-r--r--ext/ffi/tests/036.phpt12
-rw-r--r--ext/ffi/tests/037.phpt8
-rw-r--r--ext/ffi/tests/038.phpt2
-rw-r--r--ext/ffi/tests/039.phpt2
-rw-r--r--ext/ffi/tests/041.phpt48
-rw-r--r--ext/ffi/tests/045.phpt12
-rw-r--r--ext/ffi/tests/100.phpt16
-rw-r--r--ext/ffi/tests/200.phpt15
-rw-r--r--ext/ffi/tests/301-win32.phpt8
-rw-r--r--ext/ffi/tests/bug77706.phpt16
-rw-r--r--ext/ffi/tests/bug78270_1.phpt4
-rw-r--r--ext/ffi/tests/bug78270_2.phpt2
-rw-r--r--ext/ffi/tests/bug78714.phpt2
-rw-r--r--ext/ffi/tests/bug79096.phpt4
-rw-r--r--ext/ffi/tests/list.phpt134
-rw-r--r--ext/ffi/tests/preload.inc20
-rw-r--r--ext/fileinfo/fileinfo.c88
-rw-r--r--ext/fileinfo/fileinfo.stub.php51
-rw-r--r--ext/fileinfo/fileinfo_arginfo.h51
-rw-r--r--ext/fileinfo/php_fileinfo.h2
-rw-r--r--ext/fileinfo/tests/bug57547.phpt10
-rw-r--r--ext/fileinfo/tests/bug61173.phpt2
-rw-r--r--ext/fileinfo/tests/bug61964-mb.phpt2
-rw-r--r--ext/fileinfo/tests/bug61964.phpt2
-rw-r--r--ext/fileinfo/tests/bug67516.phpt2
-rw-r--r--ext/fileinfo/tests/bug67647-mb.phpt4
-rw-r--r--ext/fileinfo/tests/bug68731.phpt6
-rw-r--r--ext/fileinfo/tests/bug68735.phpt8
-rw-r--r--ext/fileinfo/tests/bug68996.phpt4
-rw-r--r--ext/fileinfo/tests/bug69107.phpt2
-rw-r--r--ext/fileinfo/tests/bug71527-mb.phpt7
-rw-r--r--ext/fileinfo/tests/bug71527.phpt7
-rw-r--r--ext/fileinfo/tests/cve-2014-3538-mb.phpt4
-rw-r--r--ext/fileinfo/tests/cve-2014-3538-nojit.phpt4
-rw-r--r--ext/fileinfo/tests/cve-2014-3538.phpt4
-rw-r--r--ext/fileinfo/tests/finfo_buffer_basic-mb.phpt30
-rw-r--r--ext/fileinfo/tests/finfo_buffer_basic.phpt30
-rw-r--r--ext/fileinfo/tests/finfo_buffer_variation1-mb.phpt28
-rw-r--r--ext/fileinfo/tests/finfo_buffer_variation1.phpt28
-rw-r--r--ext/fileinfo/tests/finfo_close_basic.phpt2
-rw-r--r--ext/fileinfo/tests/finfo_close_error.phpt35
-rw-r--r--ext/fileinfo/tests/finfo_extension_flag.phpt2
-rw-r--r--ext/fileinfo/tests/finfo_file_001.phpt2
-rw-r--r--ext/fileinfo/tests/finfo_file_002.phpt6
-rw-r--r--ext/fileinfo/tests/finfo_file_basic.phpt2
-rw-r--r--ext/fileinfo/tests/finfo_file_regex.phpt2
-rw-r--r--ext/fileinfo/tests/finfo_open_001.phpt22
-rw-r--r--ext/fileinfo/tests/finfo_open_002.phpt2
-rw-r--r--ext/fileinfo/tests/finfo_open_basic.phpt4
-rw-r--r--ext/fileinfo/tests/finfo_open_error.phpt31
-rw-r--r--ext/fileinfo/tests/finfo_open_variation1.phpt2
-rw-r--r--ext/fileinfo/tests/finfo_phpinfo_basic.phpt2
-rw-r--r--ext/fileinfo/tests/finfo_set_flags_basic-mb.phpt10
-rw-r--r--ext/fileinfo/tests/finfo_set_flags_basic.phpt10
-rw-r--r--ext/fileinfo/tests/magic6
-rw-r--r--ext/fileinfo/tests/magicç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™2
-rw-r--r--ext/fileinfo/tests/mime_content_type_001.phpt2
-rw-r--r--ext/fileinfo/tests/skipif.inc2
-rw-r--r--ext/filter/callback_filter.c2
-rw-r--r--ext/filter/filter.c76
-rw-r--r--ext/filter/filter.stub.php32
-rw-r--r--ext/filter/filter_arginfo.h38
-rw-r--r--ext/filter/filter_private.h5
-rw-r--r--ext/filter/logical_filters.c11
-rw-r--r--ext/filter/php_filter.h3
-rw-r--r--ext/filter/sanitizing_filters.c30
-rw-r--r--ext/filter/tests/007.phpt27
-rw-r--r--ext/filter/tests/008.phpt10
-rw-r--r--ext/filter/tests/009.phpt10
-rw-r--r--ext/filter/tests/010.phpt4
-rw-r--r--ext/filter/tests/011.phpt18
-rw-r--r--ext/filter/tests/014.phpt6
-rw-r--r--ext/filter/tests/015.phpt2
-rw-r--r--ext/filter/tests/016.phpt2
-rw-r--r--ext/filter/tests/020.phpt27
-rw-r--r--ext/filter/tests/022.phpt4
-rw-r--r--ext/filter/tests/029.phpt22
-rw-r--r--ext/filter/tests/030.phpt42
-rw-r--r--ext/filter/tests/031.phpt10
-rw-r--r--ext/filter/tests/033.phpt21
-rw-r--r--ext/filter/tests/033_run.inc52
-rw-r--r--ext/filter/tests/034.phpt2
-rw-r--r--ext/filter/tests/037.phpt16
-rw-r--r--ext/filter/tests/039.phpt4
-rw-r--r--ext/filter/tests/040.phpt13
-rw-r--r--ext/filter/tests/043.phpt2
-rw-r--r--ext/filter/tests/044.phpt4
-rw-r--r--ext/filter/tests/046.phpt28
-rw-r--r--ext/filter/tests/047.phpt20
-rw-r--r--ext/filter/tests/048.phpt28
-rw-r--r--ext/filter/tests/049.phpt38
-rw-r--r--ext/filter/tests/050.phpt28
-rw-r--r--ext/filter/tests/054.phpt4
-rw-r--r--ext/filter/tests/055.phpt30
-rw-r--r--ext/filter/tests/056.phpt2
-rw-r--r--ext/filter/tests/058.phpt2
-rw-r--r--ext/filter/tests/061.phpt70
-rw-r--r--ext/filter/tests/PMOPB45.phpt4
-rw-r--r--ext/filter/tests/bug49510.phpt2
-rw-r--r--ext/filter/tests/bug51368.phpt4
-rw-r--r--ext/filter/tests/bug52209.phpt2
-rw-r--r--ext/filter/tests/bug53037.phpt2
-rw-r--r--ext/filter/tests/bug73054.phpt2
-rw-r--r--ext/filter/tests/bug7715.phpt20
-rw-r--r--ext/filter/tests/bug7733.phpt12
-rw-r--r--ext/filter/tests/callback_closure.phpt2
-rw-r--r--ext/filter/tests/callback_non_modified_var.phpt2
-rw-r--r--ext/filter/tests/deprecated.phpt19
-rw-r--r--ext/filter/tests/filter_ipv4_rfc6890.phpt16
-rw-r--r--ext/ftp/ftp.c6
-rw-r--r--ext/ftp/ftp.h2
-rw-r--r--ext/ftp/ftp.stub.php120
-rw-r--r--ext/ftp/ftp_arginfo.h194
-rw-r--r--ext/ftp/php_ftp.c350
-rw-r--r--ext/ftp/php_ftp.h2
-rw-r--r--ext/ftp/tests/004.phpt58
-rw-r--r--ext/ftp/tests/005.phpt2
-rw-r--r--ext/ftp/tests/006.phpt108
-rw-r--r--ext/ftp/tests/007.phpt331
-rw-r--r--ext/ftp/tests/ftp_fget_basic.phpt4
-rw-r--r--ext/ftp/tests/ftp_get_basic.phpt6
-rw-r--r--ext/ftp/tests/ftp_set_option_errors.phpt2
-rw-r--r--ext/ftp/tests/ftp_ssl_connect_error.phpt20
-rw-r--r--ext/ftp/tests/server.inc1048
-rw-r--r--ext/gd/CREDITS2
-rw-r--r--ext/gd/config.m417
-rw-r--r--ext/gd/config.w321
-rw-r--r--ext/gd/gd.c2212
-rw-r--r--ext/gd/gd.stub.php239
-rw-r--r--ext/gd/gd_arginfo.h570
-rw-r--r--ext/gd/gd_compat.c4
-rw-r--r--ext/gd/gd_ctx.c217
-rw-r--r--ext/gd/libgd/gd.h2
-rw-r--r--ext/gd/libgd/gd_gd.c2
-rw-r--r--ext/gd/libgd/gd_interpolation.c43
-rw-r--r--ext/gd/libgd/gd_matrix.c2
-rw-r--r--ext/gd/libgd/gd_security.c4
-rw-r--r--ext/gd/libgd/gd_tga.c6
-rw-r--r--ext/gd/libgd/gd_xbm.c4
-rw-r--r--ext/gd/libgd/gdtest.c2
-rw-r--r--ext/gd/php_gd.h8
-rw-r--r--ext/gd/tests/001-mb.phpt2
-rw-r--r--ext/gd/tests/001.phpt2
-rw-r--r--ext/gd/tests/bug22544-mb.phpt14
-rw-r--r--ext/gd/tests/bug22544.phpt14
-rw-r--r--ext/gd/tests/bug24155.phpt24
-rw-r--r--ext/gd/tests/bug24594.phpt116
-rw-r--r--ext/gd/tests/bug38212-mb.phpt14
-rw-r--r--ext/gd/tests/bug38212.phpt14
-rw-r--r--ext/gd/tests/bug39286-mb.phpt12
-rw-r--r--ext/gd/tests/bug39286.phpt12
-rw-r--r--ext/gd/tests/bug41442.phpt8
-rw-r--r--ext/gd/tests/bug42434.phpt4
-rw-r--r--ext/gd/tests/bug43073.phpt44
-rw-r--r--ext/gd/tests/bug43475.phpt32
-rw-r--r--ext/gd/tests/bug44849.phpt2
-rw-r--r--ext/gd/tests/bug47946.phpt2
-rw-r--r--ext/gd/tests/bug49600.phpt2
-rw-r--r--ext/gd/tests/bug50194.phpt2
-rw-r--r--ext/gd/tests/bug52070.phpt2
-rw-r--r--ext/gd/tests/bug53504.phpt22
-rw-r--r--ext/gd/tests/bug55005.phpt21
-rw-r--r--ext/gd/tests/bug64641.phpt20
-rw-r--r--ext/gd/tests/bug65148.phpt2
-rw-r--r--ext/gd/tests/bug66005.phpt2
-rw-r--r--ext/gd/tests/bug66356.phpt20
-rw-r--r--ext/gd/tests/bug67248.phpt28
-rw-r--r--ext/gd/tests/bug67325.phpt2
-rw-r--r--ext/gd/tests/bug70976.phpt3
-rw-r--r--ext/gd/tests/bug72339.phpt4
-rw-r--r--ext/gd/tests/bug72482_2.phpt2
-rw-r--r--ext/gd/tests/bug72494.phpt14
-rw-r--r--ext/gd/tests/bug72697.phpt12
-rw-r--r--ext/gd/tests/bug72709.phpt14
-rw-r--r--ext/gd/tests/bug72730.phpt15
-rw-r--r--ext/gd/tests/bug72913.phpt2
-rw-r--r--ext/gd/tests/bug73155.phpt2
-rw-r--r--ext/gd/tests/bug73157.phpt2
-rw-r--r--ext/gd/tests/bug73159.phpt2
-rw-r--r--ext/gd/tests/bug73161.phpt2
-rw-r--r--ext/gd/tests/bug73213.phpt2
-rw-r--r--ext/gd/tests/bug73272.phpt2
-rw-r--r--ext/gd/tests/bug73279.phpt2
-rw-r--r--ext/gd/tests/bug73279_old.phpt2
-rw-r--r--ext/gd/tests/bug73281.phpt2
-rw-r--r--ext/gd/tests/bug73291.phpt2
-rw-r--r--ext/gd/tests/bug73549.phpt2
-rw-r--r--ext/gd/tests/bug73614.phpt2
-rw-r--r--ext/gd/tests/bug73868.phpt2
-rw-r--r--ext/gd/tests/bug73869.phpt2
-rw-r--r--ext/gd/tests/bug73957.phpt2
-rw-r--r--ext/gd/tests/bug73968.phpt7
-rw-r--r--ext/gd/tests/bug74435.phpt7
-rw-r--r--ext/gd/tests/bug75111.phpt2
-rw-r--r--ext/gd/tests/bug75124.phpt2
-rw-r--r--ext/gd/tests/bug75437.phpt2
-rw-r--r--ext/gd/tests/bug75571.phpt2
-rw-r--r--ext/gd/tests/bug77195.phpt2
-rw-r--r--ext/gd/tests/bug77200.phpt2
-rw-r--r--ext/gd/tests/bug77269.phpt9
-rw-r--r--ext/gd/tests/bug77272.phpt4
-rw-r--r--ext/gd/tests/bug77391.phpt7
-rw-r--r--ext/gd/tests/bug77479.phpt4
-rw-r--r--ext/gd/tests/bug77700.phpt2
-rw-r--r--ext/gd/tests/bug77943.phpt2
-rw-r--r--ext/gd/tests/bug77973.phpt4
-rw-r--r--ext/gd/tests/bug79068.phpt8
-rw-r--r--ext/gd/tests/bug79068.pngbin798 -> 0 bytes
-rw-r--r--ext/gd/tests/colorat.phpt6
-rw-r--r--ext/gd/tests/colorclosest.phpt20
-rw-r--r--ext/gd/tests/colorresolve.phpt20
-rw-r--r--ext/gd/tests/copy.phpt8
-rw-r--r--ext/gd/tests/copypalette.phpt14
-rw-r--r--ext/gd/tests/copyresized.phpt44
-rw-r--r--ext/gd/tests/createfromstring.phpt8
-rw-r--r--ext/gd/tests/createfromwbmp2.phpt6
-rw-r--r--ext/gd/tests/createfromwbmp2_extern.phpt6
-rw-r--r--ext/gd/tests/dashedlines.phpt6
-rw-r--r--ext/gd/tests/func.inc160
-rw-r--r--ext/gd/tests/gd_info_basic.phpt6
-rw-r--r--ext/gd/tests/gd_info_variation1.phpt2
-rw-r--r--ext/gd/tests/gdimage_prevent_cloning.phpt20
-rw-r--r--ext/gd/tests/gdimage_prevent_serialization.phpt21
-rw-r--r--ext/gd/tests/gif.phpt84
-rw-r--r--ext/gd/tests/gif2gd.phpt18
-rw-r--r--ext/gd/tests/gif2jpg.phpt10
-rw-r--r--ext/gd/tests/gif2png.phpt10
-rw-r--r--ext/gd/tests/image2wbmp_error.phpt20
-rw-r--r--ext/gd/tests/imageantialias_error1.phpt18
-rw-r--r--ext/gd/tests/imageantialias_error2.phpt2
-rw-r--r--ext/gd/tests/imagebmp_nullbyte_injection.phpt13
-rw-r--r--ext/gd/tests/imagechar_error2.phpt17
-rw-r--r--ext/gd/tests/imagecharup_error2.phpt17
-rw-r--r--ext/gd/tests/imagecolorallocate_basic.phpt2
-rw-r--r--ext/gd/tests/imagecolorallocate_variation5.phpt41
-rw-r--r--ext/gd/tests/imagecolorallocate_variation6.phpt93
-rw-r--r--ext/gd/tests/imagecolorallocatealpha_error1.phpt25
-rw-r--r--ext/gd/tests/imagecolordeallocate_error1.phpt22
-rw-r--r--ext/gd/tests/imagecolordeallocate_error3.phpt15
-rw-r--r--ext/gd/tests/imagecolordeallocate_error4.phpt15
-rw-r--r--ext/gd/tests/imagecolorset_basic.phpt2
-rw-r--r--ext/gd/tests/imagecolorstotal_basic.phpt2
-rw-r--r--ext/gd/tests/imagecolorstotal_error.phpt54
-rw-r--r--ext/gd/tests/imagecolourstotal_basic.phpt2
-rw-r--r--ext/gd/tests/imageconvolution_error2.phpt12
-rw-r--r--ext/gd/tests/imageconvolution_error3.phpt20
-rw-r--r--ext/gd/tests/imagecreate_error.phpt21
-rw-r--r--ext/gd/tests/imagecreatefrombmp_basic.phpt2
-rw-r--r--ext/gd/tests/imagecreatefromstring_bmp.phpt2
-rw-r--r--ext/gd/tests/imagecreatefromstring_gif.phpt2
-rw-r--r--ext/gd/tests/imagecreatefromstring_png.phpt2
-rw-r--r--ext/gd/tests/imagecreatefromstring_webp.phpt2
-rw-r--r--ext/gd/tests/imagecreatetruecolor_error2.phpt19
-rw-r--r--ext/gd/tests/imageellipse_error7.phpt20
-rw-r--r--ext/gd/tests/imagefilledpolygon_basic.phpt2
-rw-r--r--ext/gd/tests/imagefilledpolygon_negative.phpt15
-rw-r--r--ext/gd/tests/imagefilltoborder_error6.phpt27
-rw-r--r--ext/gd/tests/imagefilter.phpt130
-rw-r--r--ext/gd/tests/imagefilter_error1.phpt11
-rw-r--r--ext/gd/tests/imagefilter_error10.phpt18
-rw-r--r--ext/gd/tests/imagefilter_error11.phpt18
-rw-r--r--ext/gd/tests/imagefilter_error12.phpt18
-rw-r--r--ext/gd/tests/imagefilter_error15.phpt18
-rw-r--r--ext/gd/tests/imagefilter_error17.phpt18
-rw-r--r--ext/gd/tests/imagefilter_error18.phpt18
-rw-r--r--ext/gd/tests/imagefilter_error20.phpt18
-rw-r--r--ext/gd/tests/imagefilter_error4.phpt18
-rw-r--r--ext/gd/tests/imagefilter_error6.phpt18
-rw-r--r--ext/gd/tests/imagefilter_error7.phpt18
-rw-r--r--ext/gd/tests/imagefilter_error8.phpt18
-rw-r--r--ext/gd/tests/imagefilter_error9.phpt18
-rw-r--r--ext/gd/tests/imagefttext.phpt54
-rw-r--r--ext/gd/tests/imagegammacorrect_error2.phpt17
-rw-r--r--ext/gd/tests/imagegammacorrect_variation2.phpt2
-rw-r--r--ext/gd/tests/imagegd2_nullbyte_injection.phpt11
-rw-r--r--ext/gd/tests/imagegd_nullbyte_injection.phpt11
-rw-r--r--ext/gd/tests/imagegd_truecolor.phpt2
-rw-r--r--ext/gd/tests/imagegif_nullbyte_injection.phpt15
-rw-r--r--ext/gd/tests/imageinterlace_error2.phpt17
-rw-r--r--ext/gd/tests/imageinterpolation_basic.phpt59
-rw-r--r--ext/gd/tests/imageistruecolor_error1.phpt24
-rw-r--r--ext/gd/tests/imagejpeg_nullbyte_injection.phpt15
-rw-r--r--ext/gd/tests/imagelayereffect_error3.phpt17
-rw-r--r--ext/gd/tests/imageloadfont_error2.phpt2
-rw-r--r--ext/gd/tests/imageloadfont_invalid.phpt2
-rw-r--r--ext/gd/tests/imageopenpolygon_basic.phpt10
-rw-r--r--ext/gd/tests/imagepalettetotruecolor_basic.phpt4
-rw-r--r--ext/gd/tests/imagepalettetotruecolor_error3.phpt15
-rw-r--r--ext/gd/tests/imagepng_nullbyte_injection.phpt13
-rw-r--r--ext/gd/tests/imagepolygon_aa.phpt4
-rw-r--r--ext/gd/tests/imagepolygon_basic.phpt1
-rw-r--r--ext/gd/tests/imagepolygon_negative.phpt15
-rw-r--r--ext/gd/tests/imagerectangle_error2.phpt19
-rw-r--r--ext/gd/tests/imageresolution_jpeg.phpt2
-rw-r--r--ext/gd/tests/imageresolution_png.phpt2
-rw-r--r--ext/gd/tests/imagesetthickness_error1.phpt22
-rw-r--r--ext/gd/tests/imagestring_error2.phpt17
-rw-r--r--ext/gd/tests/imagestringup_error2.phpt17
-rw-r--r--ext/gd/tests/imagetruecolortopalette_error1.phpt26
-rw-r--r--ext/gd/tests/imagetruecolortopalette_error3.phpt20
-rw-r--r--ext/gd/tests/imagetruecolortopalette_error4.phpt15
-rw-r--r--ext/gd/tests/imagewbmp-mb.phpt6
-rw-r--r--ext/gd/tests/imagewbmp.phpt6
-rw-r--r--ext/gd/tests/imagewbmp_nullbyte_injection.phpt15
-rw-r--r--ext/gd/tests/imagewebp_nullbyte_injection.phpt15
-rw-r--r--ext/gd/tests/imagexbm_nullbyte_injection.phpt11
-rw-r--r--ext/gd/tests/jpeg2png.phpt34
-rw-r--r--ext/gd/tests/jpeg2wbmp_error1.phpt46
-rw-r--r--ext/gd/tests/jpeg2wbmp_error2-mb.phpt37
-rw-r--r--ext/gd/tests/jpeg2wbmp_error2.phpt37
-rw-r--r--ext/gd/tests/jpeg2wbmp_error3.phpt49
-rw-r--r--ext/gd/tests/jpg2gd-mb.phpt34
-rw-r--r--ext/gd/tests/jpg2gd.phpt34
-rw-r--r--ext/gd/tests/libgd00100.phpt16
-rw-r--r--ext/gd/tests/libgd00101.phpt2
-rw-r--r--ext/gd/tests/libgd00106.phpt4
-rw-r--r--ext/gd/tests/libgd00191.phpt4
-rw-r--r--ext/gd/tests/lines.phpt43
-rw-r--r--ext/gd/tests/png2gd.phpt34
-rw-r--r--ext/gd/tests/png2wbmp_error1-mb.phpt46
-rw-r--r--ext/gd/tests/png2wbmp_error1.phpt46
-rw-r--r--ext/gd/tests/png2wbmp_error2.phpt37
-rw-r--r--ext/gd/tests/png2wbmp_error3.phpt49
-rw-r--r--ext/gd/tests/pngcomp.phpt6
-rw-r--r--ext/gd/tests/test_image_equals_file_palette.phpt2
-rw-r--r--ext/gd/tests/types.phpt10
-rw-r--r--ext/gd/tests/xbm2png.phpt10
-rw-r--r--ext/gd/tests/xpm2gd.phpt18
-rw-r--r--ext/gd/tests/xpm2jpg.phpt10
-rw-r--r--ext/gd/tests/xpm2png.phpt10
-rw-r--r--ext/gettext/gettext.c81
-rw-r--r--ext/gettext/gettext.stub.php27
-rw-r--r--ext/gettext/gettext_arginfo.h59
-rw-r--r--ext/gettext/php_gettext.h2
-rw-r--r--ext/gettext/tests/44938.phpt14
-rw-r--r--ext/gettext/tests/bug66267.phpt20
-rw-r--r--ext/gettext/tests/bug73730.phpt2
-rw-r--r--ext/gettext/tests/dcngettext.phpt5
-rw-r--r--ext/gettext/tests/gettext_bind_textdomain_codeset-retval.phpt6
-rw-r--r--ext/gmp/gmp.c312
-rw-r--r--ext/gmp/gmp.stub.php220
-rw-r--r--ext/gmp/gmp_arginfo.h183
-rw-r--r--ext/gmp/php_gmp.h2
-rw-r--r--ext/gmp/tests/003.phpt2
-rw-r--r--ext/gmp/tests/bug52906.phpt26
-rw-r--r--ext/gmp/tests/bug70284.phpt12
-rw-r--r--ext/gmp/tests/gmp_abs.phpt8
-rw-r--r--ext/gmp/tests/gmp_and.phpt8
-rw-r--r--ext/gmp/tests/gmp_clrbit.phpt18
-rw-r--r--ext/gmp/tests/gmp_cmp.phpt12
-rw-r--r--ext/gmp/tests/gmp_com.phpt6
-rw-r--r--ext/gmp/tests/gmp_div_q.phpt8
-rw-r--r--ext/gmp/tests/gmp_div_qr.phpt8
-rw-r--r--ext/gmp/tests/gmp_div_r.phpt8
-rw-r--r--ext/gmp/tests/gmp_divexact.phpt8
-rw-r--r--ext/gmp/tests/gmp_export.phpt6
-rw-r--r--ext/gmp/tests/gmp_fact.phpt8
-rw-r--r--ext/gmp/tests/gmp_gcd.phpt14
-rw-r--r--ext/gmp/tests/gmp_gcdext.phpt42
-rw-r--r--ext/gmp/tests/gmp_hamdist.phpt8
-rw-r--r--ext/gmp/tests/gmp_import.phpt6
-rw-r--r--ext/gmp/tests/gmp_init.phpt14
-rw-r--r--ext/gmp/tests/gmp_intval.phpt3
-rw-r--r--ext/gmp/tests/gmp_invert.phpt8
-rw-r--r--ext/gmp/tests/gmp_jacobi.phpt15
-rw-r--r--ext/gmp/tests/gmp_legendre.phpt15
-rw-r--r--ext/gmp/tests/gmp_mod.phpt8
-rw-r--r--ext/gmp/tests/gmp_neg.phpt8
-rw-r--r--ext/gmp/tests/gmp_or.phpt8
-rw-r--r--ext/gmp/tests/gmp_perfect_square.phpt4
-rw-r--r--ext/gmp/tests/gmp_popcount.phpt4
-rw-r--r--ext/gmp/tests/gmp_pow.phpt26
-rw-r--r--ext/gmp/tests/gmp_pown.phpt12
-rw-r--r--ext/gmp/tests/gmp_prob_prime.phpt10
-rw-r--r--ext/gmp/tests/gmp_random.phpt60
-rw-r--r--ext/gmp/tests/gmp_random_bits.phpt26
-rw-r--r--ext/gmp/tests/gmp_random_range.phpt54
-rw-r--r--ext/gmp/tests/gmp_random_seed-32bit.phpt232
-rw-r--r--ext/gmp/tests/gmp_random_seed.phpt154
-rw-r--r--ext/gmp/tests/gmp_remroot.phpt4
-rw-r--r--ext/gmp/tests/gmp_root.phpt4
-rw-r--r--ext/gmp/tests/gmp_scan0.phpt8
-rw-r--r--ext/gmp/tests/gmp_scan1.phpt8
-rw-r--r--ext/gmp/tests/gmp_setbit.phpt27
-rw-r--r--ext/gmp/tests/gmp_setbit_long.phpt2
-rw-r--r--ext/gmp/tests/gmp_sign.phpt8
-rw-r--r--ext/gmp/tests/gmp_sqrt.phpt8
-rw-r--r--ext/gmp/tests/gmp_sqrtrem.phpt4
-rw-r--r--ext/gmp/tests/gmp_strval.phpt20
-rw-r--r--ext/gmp/tests/gmp_sub.phpt12
-rw-r--r--ext/gmp/tests/gmp_testbit.phpt5
-rw-r--r--ext/gmp/tests/gmp_xor.phpt8
-rw-r--r--ext/hash/config.m43
-rw-r--r--ext/hash/config.w323
-rw-r--r--ext/hash/hash.c341
-rw-r--r--ext/hash/hash.stub.php53
-rw-r--r--ext/hash/hash_adler32.c2
-rw-r--r--ext/hash/hash_arginfo.h118
-rw-r--r--ext/hash/hash_crc32.c2
-rw-r--r--ext/hash/hash_fnv.c2
-rw-r--r--ext/hash/hash_gost.c5
-rw-r--r--ext/hash/hash_haval.c2
-rw-r--r--ext/hash/hash_joaat.c2
-rw-r--r--ext/hash/hash_md.c351
-rw-r--r--ext/hash/hash_ripemd.c2
-rw-r--r--ext/hash/hash_sha.c329
-rw-r--r--ext/hash/hash_sha3.c2
-rw-r--r--ext/hash/hash_snefru.c2
-rw-r--r--ext/hash/hash_tiger.c2
-rw-r--r--ext/hash/hash_whirlpool.c2
-rw-r--r--ext/hash/php_hash.h4
-rw-r--r--ext/hash/php_hash_adler32.h2
-rw-r--r--ext/hash/php_hash_crc32.h2
-rw-r--r--ext/hash/php_hash_crc32_tables.h2
-rw-r--r--ext/hash/php_hash_fnv.h2
-rw-r--r--ext/hash/php_hash_gost.h4
-rw-r--r--ext/hash/php_hash_haval.h2
-rw-r--r--ext/hash/php_hash_joaat.h2
-rw-r--r--ext/hash/php_hash_md.h52
-rw-r--r--ext/hash/php_hash_ripemd.h2
-rw-r--r--ext/hash/php_hash_sha.h27
-rw-r--r--ext/hash/php_hash_sha3.h2
-rw-r--r--ext/hash/php_hash_snefru.h2
-rw-r--r--ext/hash/php_hash_snefru_tables.h2
-rw-r--r--ext/hash/php_hash_tiger.h2
-rw-r--r--ext/hash/php_hash_tiger_tables.h2
-rw-r--r--ext/hash/php_hash_whirlpool.h2
-rw-r--r--ext/hash/php_hash_whirlpool_tables.h2
-rw-r--r--ext/hash/tests/fnv132.phpt348
-rw-r--r--ext/hash/tests/fnv164.phpt348
-rw-r--r--ext/hash/tests/fnv1a32.phpt614
-rw-r--r--ext/hash/tests/fnv1a64.phpt614
-rw-r--r--ext/hash/tests/hash-clone.phpt26
-rw-r--r--ext/hash/tests/hash_algos.phpt2
-rw-r--r--ext/hash/tests/hash_copy_001.phpt26
-rw-r--r--ext/hash/tests/hash_equals.phpt67
-rw-r--r--ext/hash/tests/hash_error.phpt23
-rw-r--r--ext/hash/tests/hash_file_basic.phpt2
-rw-r--r--ext/hash/tests/hash_file_basic1.phpt4
-rw-r--r--ext/hash/tests/hash_file_error.phpt21
-rw-r--r--ext/hash/tests/hash_hkdf_edges.phpt12
-rw-r--r--ext/hash/tests/hash_hkdf_error.phpt115
-rw-r--r--ext/hash/tests/hash_hkdf_rfc5869.phpt98
-rw-r--r--ext/hash/tests/hash_hmac_basic.phpt2
-rw-r--r--ext/hash/tests/hash_hmac_error.phpt51
-rw-r--r--ext/hash/tests/hash_hmac_file_basic.phpt16
-rw-r--r--ext/hash/tests/hash_hmac_file_error.phpt58
-rw-r--r--ext/hash/tests/hash_init_error.phpt59
-rw-r--r--ext/hash/tests/hash_pbkdf2_basic.phpt2
-rw-r--r--ext/hash/tests/hash_pbkdf2_error.phpt89
-rw-r--r--ext/hash/tests/haval.phpt24
-rw-r--r--ext/hash/tests/joaat.phpt22
-rw-r--r--ext/hash/tests/mhash_001.phpt20
-rw-r--r--ext/hash/tests/mhash_002.phpt14
-rw-r--r--ext/hash/tests/mhash_003.phpt24
-rw-r--r--ext/hash/tests/reuse.phpt12
-rw-r--r--ext/iconv/iconv.c102
-rw-r--r--ext/iconv/iconv.stub.php21
-rw-r--r--ext/iconv/iconv_arginfo.h59
-rw-r--r--ext/iconv/php_iconv.h2
-rw-r--r--ext/iconv/tests/bug37773.phpt2
-rw-r--r--ext/iconv/tests/bug53891.phpt2
-rw-r--r--ext/iconv/tests/bug55146.phpt2
-rw-r--r--ext/iconv/tests/bug60494.phpt2
-rw-r--r--ext/iconv/tests/bug63839.phpt4
-rw-r--r--ext/iconv/tests/bug66828.phpt2
-rw-r--r--ext/iconv/tests/bug68180.phpt2
-rw-r--r--ext/iconv/tests/bug76249.phpt2
-rw-r--r--ext/iconv/tests/bug77147.phpt2
-rw-r--r--ext/iconv/tests/eucjp2iso2022jp.phpt10
-rw-r--r--ext/iconv/tests/iconv003.phpt6
-rw-r--r--ext/iconv/tests/iconv_default_charset.phpt36
-rw-r--r--ext/iconv/tests/iconv_mime_decode.phpt24
-rw-r--r--ext/iconv/tests/iconv_mime_decode_headers.phpt4
-rw-r--r--ext/iconv/tests/iconv_mime_encode.phpt32
-rw-r--r--ext/iconv/tests/iconv_stream_filter_delimiter.phpt2
-rw-r--r--ext/iconv/tests/iconv_strlen.phpt4
-rw-r--r--ext/iconv/tests/iconv_strlen_basic.phpt2
-rw-r--r--ext/iconv/tests/iconv_strlen_error2.phpt2
-rw-r--r--ext/iconv/tests/iconv_strpos.phpt30
-rw-r--r--ext/iconv/tests/iconv_strpos_variation5.phpt10
-rw-r--r--ext/iconv/tests/iconv_strrpos.phpt28
-rw-r--r--ext/iconv/tests/iconv_substr.phpt31
-rw-r--r--ext/imap/php_imap.c636
-rw-r--r--ext/imap/php_imap.h6
-rw-r--r--ext/imap/php_imap.stub.php240
-rw-r--r--ext/imap/php_imap_arginfo.h332
-rw-r--r--ext/imap/tests/bug35669.phpt2
-rw-r--r--ext/imap/tests/bug44098.phpt4
-rw-r--r--ext/imap/tests/bug63126.phpt2
-rw-r--r--ext/imap/tests/bug75774.phpt12
-rw-r--r--ext/imap/tests/bug77020.phpt4
-rw-r--r--ext/imap/tests/clean.inc16
-rw-r--r--ext/imap/tests/imap_8bit_basic.phpt2
-rw-r--r--ext/imap/tests/imap_alerts_error.phpt2
-rw-r--r--ext/imap/tests/imap_append_basic.phpt4
-rw-r--r--ext/imap/tests/imap_base64_basic.phpt14
-rw-r--r--ext/imap/tests/imap_binary_basic.phpt2
-rw-r--r--ext/imap/tests/imap_body.phpt4
-rw-r--r--ext/imap/tests/imap_body_basic.phpt4
-rw-r--r--ext/imap/tests/imap_bodystruct_basic.phpt4
-rw-r--r--ext/imap/tests/imap_clearflag_full_basic.phpt4
-rw-r--r--ext/imap/tests/imap_close_basic.phpt4
-rw-r--r--ext/imap/tests/imap_close_error.phpt2
-rw-r--r--ext/imap/tests/imap_close_variation3.phpt47
-rw-r--r--ext/imap/tests/imap_close_variation4.phpt62
-rw-r--r--ext/imap/tests/imap_createmailbox_basic.phpt8
-rw-r--r--ext/imap/tests/imap_errors_basic.phpt2
-rw-r--r--ext/imap/tests/imap_fetch_overview_basic.phpt2
-rw-r--r--ext/imap/tests/imap_fetch_overview_error.phpt2
-rw-r--r--ext/imap/tests/imap_fetch_overview_variation3.phpt16
-rw-r--r--ext/imap/tests/imap_fetch_overview_variation4.phpt46
-rw-r--r--ext/imap/tests/imap_fetch_overview_variation5.phpt16
-rw-r--r--ext/imap/tests/imap_fetch_overview_variation6.phpt86
-rw-r--r--ext/imap/tests/imap_fetchbody_basic.phpt34
-rw-r--r--ext/imap/tests/imap_fetchbody_error.phpt2
-rw-r--r--ext/imap/tests/imap_fetchbody_variation4.phpt16
-rw-r--r--ext/imap/tests/imap_fetchbody_variation5.phpt46
-rw-r--r--ext/imap/tests/imap_fetchbody_variation6.phpt12
-rw-r--r--ext/imap/tests/imap_fetchheader_basic.phpt16
-rw-r--r--ext/imap/tests/imap_fetchheader_error.phpt2
-rw-r--r--ext/imap/tests/imap_fetchheader_variation3.phpt16
-rw-r--r--ext/imap/tests/imap_fetchheader_variation4.phpt45
-rw-r--r--ext/imap/tests/imap_fetchheader_variation5.phpt12
-rw-r--r--ext/imap/tests/imap_fetchstructure_basic.phpt2
-rw-r--r--ext/imap/tests/imap_gc_error.phpt10
-rw-r--r--ext/imap/tests/imap_getsubscribed_basic.phpt2
-rw-r--r--ext/imap/tests/imap_headerinfo_basic.phpt32
-rw-r--r--ext/imap/tests/imap_headerinfo_error.phpt2
-rw-r--r--ext/imap/tests/imap_include.inc182
-rw-r--r--ext/imap/tests/imap_list_basic.phpt2
-rw-r--r--ext/imap/tests/imap_lsub_basic.phpt2
-rw-r--r--ext/imap/tests/imap_mail_copy.phpt4
-rw-r--r--ext/imap/tests/imap_mail_copy_basic.phpt4
-rw-r--r--ext/imap/tests/imap_mail_move.phpt4
-rw-r--r--ext/imap/tests/imap_mail_move_basic.phpt4
-rw-r--r--ext/imap/tests/imap_mutf7_to_utf8.phpt4
-rw-r--r--ext/imap/tests/imap_renamemailbox_basic.phpt2
-rw-r--r--ext/imap/tests/imap_rfc822_parse_headers_basic.phpt30
-rw-r--r--ext/imap/tests/imap_undelete_error.phpt2
-rw-r--r--ext/imap/tests/imap_utf8.phpt4
-rw-r--r--ext/imap/tests/imap_utf8_to_mutf7_basic.phpt4
-rw-r--r--ext/imap/tests/skipif.inc2
-rw-r--r--ext/intl/ERROR_CONVENTIONS.md2
-rw-r--r--ext/intl/breakiterator/breakiterator_class.cpp19
-rw-r--r--ext/intl/breakiterator/breakiterator_class.h6
-rw-r--r--ext/intl/breakiterator/breakiterator_iterators.cpp6
-rw-r--r--ext/intl/breakiterator/breakiterator_iterators.h2
-rw-r--r--ext/intl/breakiterator/breakiterator_methods.cpp53
-rw-r--r--ext/intl/breakiterator/breakiterator_methods.h2
-rw-r--r--ext/intl/breakiterator/codepointiterator_internal.cpp2
-rw-r--r--ext/intl/breakiterator/codepointiterator_internal.h2
-rw-r--r--ext/intl/breakiterator/codepointiterator_methods.cpp6
-rw-r--r--ext/intl/breakiterator/codepointiterator_methods.h2
-rw-r--r--ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp24
-rw-r--r--ext/intl/breakiterator/rulebasedbreakiterator_methods.h2
-rw-r--r--ext/intl/calendar/calendar.stub.php278
-rw-r--r--ext/intl/calendar/calendar_arginfo.h354
-rw-r--r--ext/intl/calendar/calendar_class.cpp222
-rw-r--r--ext/intl/calendar/calendar_class.h6
-rw-r--r--ext/intl/calendar/calendar_methods.cpp235
-rw-r--r--ext/intl/calendar/calendar_methods.h2
-rw-r--r--ext/intl/calendar/gregoriancalendar_methods.cpp55
-rw-r--r--ext/intl/calendar/gregoriancalendar_methods.h2
-rw-r--r--ext/intl/collator/collator.c2
-rw-r--r--ext/intl/collator/collator.h2
-rw-r--r--ext/intl/collator/collator.stub.php71
-rw-r--r--ext/intl/collator/collator_arginfo.h115
-rw-r--r--ext/intl/collator/collator_attr.c22
-rw-r--r--ext/intl/collator/collator_attr.h2
-rw-r--r--ext/intl/collator/collator_class.c59
-rw-r--r--ext/intl/collator/collator_class.h2
-rw-r--r--ext/intl/collator/collator_compare.c9
-rw-r--r--ext/intl/collator/collator_compare.h2
-rw-r--r--ext/intl/collator/collator_convert.c28
-rw-r--r--ext/intl/collator/collator_convert.h2
-rw-r--r--ext/intl/collator/collator_create.c13
-rw-r--r--ext/intl/collator/collator_create.h2
-rw-r--r--ext/intl/collator/collator_error.c12
-rw-r--r--ext/intl/collator/collator_error.h2
-rw-r--r--ext/intl/collator/collator_is_numeric.c2
-rw-r--r--ext/intl/collator/collator_is_numeric.h2
-rw-r--r--ext/intl/collator/collator_locale.c9
-rw-r--r--ext/intl/collator/collator_locale.h2
-rw-r--r--ext/intl/collator/collator_sort.c21
-rw-r--r--ext/intl/collator/collator_sort.h2
-rw-r--r--ext/intl/common/common.stub.php22
-rw-r--r--ext/intl/common/common_arginfo.h26
-rw-r--r--ext/intl/common/common_date.cpp2
-rw-r--r--ext/intl/common/common_date.h2
-rw-r--r--ext/intl/common/common_enum.cpp36
-rw-r--r--ext/intl/common/common_enum.h6
-rw-r--r--ext/intl/common/common_error.c20
-rw-r--r--ext/intl/common/common_error.h2
-rw-r--r--ext/intl/converter/converter.c50
-rw-r--r--ext/intl/converter/converter.h2
-rw-r--r--ext/intl/dateformat/dateformat.c15
-rw-r--r--ext/intl/dateformat/dateformat.h2
-rw-r--r--ext/intl/dateformat/dateformat.stub.php138
-rw-r--r--ext/intl/dateformat/dateformat_arginfo.h161
-rw-r--r--ext/intl/dateformat/dateformat_attr.c34
-rw-r--r--ext/intl/dateformat/dateformat_attr.h2
-rw-r--r--ext/intl/dateformat/dateformat_attrcpp.cpp27
-rw-r--r--ext/intl/dateformat/dateformat_attrcpp.h2
-rw-r--r--ext/intl/dateformat/dateformat_class.c97
-rw-r--r--ext/intl/dateformat/dateformat_class.h6
-rw-r--r--ext/intl/dateformat/dateformat_create.cpp13
-rw-r--r--ext/intl/dateformat/dateformat_create.h2
-rw-r--r--ext/intl/dateformat/dateformat_data.c2
-rw-r--r--ext/intl/dateformat/dateformat_data.h2
-rw-r--r--ext/intl/dateformat/dateformat_format.c4
-rw-r--r--ext/intl/dateformat/dateformat_format.h2
-rw-r--r--ext/intl/dateformat/dateformat_format_object.cpp6
-rw-r--r--ext/intl/dateformat/dateformat_format_object.h2
-rw-r--r--ext/intl/dateformat/dateformat_helpers.cpp7
-rw-r--r--ext/intl/dateformat/dateformat_helpers.h2
-rw-r--r--ext/intl/dateformat/dateformat_parse.c8
-rw-r--r--ext/intl/dateformat/dateformat_parse.h2
-rw-r--r--ext/intl/formatter/formatter.c2
-rw-r--r--ext/intl/formatter/formatter.h2
-rw-r--r--ext/intl/formatter/formatter.stub.php90
-rw-r--r--ext/intl/formatter/formatter_arginfo.h146
-rw-r--r--ext/intl/formatter/formatter_attr.c47
-rw-r--r--ext/intl/formatter/formatter_attr.h2
-rw-r--r--ext/intl/formatter/formatter_class.c101
-rw-r--r--ext/intl/formatter/formatter_class.h7
-rw-r--r--ext/intl/formatter/formatter_data.c2
-rw-r--r--ext/intl/formatter/formatter_data.h2
-rw-r--r--ext/intl/formatter/formatter_format.c12
-rw-r--r--ext/intl/formatter/formatter_format.h2
-rw-r--r--ext/intl/formatter/formatter_main.c23
-rw-r--r--ext/intl/formatter/formatter_main.h2
-rw-r--r--ext/intl/formatter/formatter_parse.c12
-rw-r--r--ext/intl/formatter/formatter_parse.h2
-rw-r--r--ext/intl/grapheme/grapheme.h2
-rw-r--r--ext/intl/grapheme/grapheme.stub.php19
-rw-r--r--ext/intl/grapheme/grapheme_arginfo.h39
-rw-r--r--ext/intl/grapheme/grapheme_string.c36
-rw-r--r--ext/intl/grapheme/grapheme_util.c2
-rw-r--r--ext/intl/grapheme/grapheme_util.h2
-rw-r--r--ext/intl/idn/idn.c107
-rw-r--r--ext/intl/idn/idn.h2
-rw-r--r--ext/intl/idn/idn.stub.php5
-rw-r--r--ext/intl/idn/idn_arginfo.h10
-rw-r--r--ext/intl/intl_common.h2
-rw-r--r--ext/intl/intl_convert.c2
-rw-r--r--ext/intl/intl_convert.h2
-rw-r--r--ext/intl/intl_convertcpp.cpp2
-rw-r--r--ext/intl/intl_convertcpp.h2
-rw-r--r--ext/intl/intl_cppshims.h2
-rw-r--r--ext/intl/intl_data.h2
-rw-r--r--ext/intl/intl_error.c2
-rw-r--r--ext/intl/intl_error.h2
-rw-r--r--ext/intl/locale/locale.c2
-rw-r--r--ext/intl/locale/locale.h2
-rw-r--r--ext/intl/locale/locale.stub.php94
-rw-r--r--ext/intl/locale/locale_arginfo.h117
-rw-r--r--ext/intl/locale/locale_class.c80
-rw-r--r--ext/intl/locale/locale_class.h2
-rw-r--r--ext/intl/locale/locale_methods.c59
-rw-r--r--ext/intl/locale/locale_methods.h2
-rw-r--r--ext/intl/msgformat/msgformat.c23
-rw-r--r--ext/intl/msgformat/msgformat.h2
-rw-r--r--ext/intl/msgformat/msgformat.stub.php56
-rw-r--r--ext/intl/msgformat/msgformat_arginfo.h87
-rw-r--r--ext/intl/msgformat/msgformat_attr.c15
-rw-r--r--ext/intl/msgformat/msgformat_attr.h2
-rw-r--r--ext/intl/msgformat/msgformat_class.c59
-rw-r--r--ext/intl/msgformat/msgformat_class.h7
-rw-r--r--ext/intl/msgformat/msgformat_data.c2
-rw-r--r--ext/intl/msgformat/msgformat_data.h2
-rw-r--r--ext/intl/msgformat/msgformat_format.c12
-rw-r--r--ext/intl/msgformat/msgformat_format.h2
-rw-r--r--ext/intl/msgformat/msgformat_helpers.cpp2
-rw-r--r--ext/intl/msgformat/msgformat_helpers.h2
-rw-r--r--ext/intl/msgformat/msgformat_parse.c14
-rw-r--r--ext/intl/msgformat/msgformat_parse.h2
-rw-r--r--ext/intl/normalizer/normalizer.c3
-rw-r--r--ext/intl/normalizer/normalizer.h4
-rw-r--r--ext/intl/normalizer/normalizer.stub.php23
-rw-r--r--ext/intl/normalizer/normalizer_arginfo.h32
-rw-r--r--ext/intl/normalizer/normalizer_class.c24
-rw-r--r--ext/intl/normalizer/normalizer_class.h2
-rw-r--r--ext/intl/normalizer/normalizer_normalize.c40
-rw-r--r--ext/intl/normalizer/normalizer_normalize.h2
-rw-r--r--ext/intl/php_intl.c820
-rw-r--r--ext/intl/php_intl.h2
-rw-r--r--ext/intl/resourcebundle/resourcebundle.c2
-rw-r--r--ext/intl/resourcebundle/resourcebundle.h2
-rw-r--r--ext/intl/resourcebundle/resourcebundle.stub.php43
-rw-r--r--ext/intl/resourcebundle/resourcebundle_arginfo.h50
-rw-r--r--ext/intl/resourcebundle/resourcebundle_class.c97
-rw-r--r--ext/intl/resourcebundle/resourcebundle_class.h10
-rw-r--r--ext/intl/resourcebundle/resourcebundle_iterator.c2
-rw-r--r--ext/intl/resourcebundle/resourcebundle_iterator.h2
-rw-r--r--ext/intl/spoofchecker/spoofchecker.c2
-rw-r--r--ext/intl/spoofchecker/spoofchecker.h2
-rw-r--r--ext/intl/spoofchecker/spoofchecker.stub.php23
-rw-r--r--ext/intl/spoofchecker/spoofchecker_arginfo.h29
-rw-r--r--ext/intl/spoofchecker/spoofchecker_class.c52
-rw-r--r--ext/intl/spoofchecker/spoofchecker_class.h7
-rw-r--r--ext/intl/spoofchecker/spoofchecker_create.c6
-rw-r--r--ext/intl/spoofchecker/spoofchecker_create.h2
-rw-r--r--ext/intl/spoofchecker/spoofchecker_main.c12
-rw-r--r--ext/intl/spoofchecker/spoofchecker_main.h2
-rw-r--r--ext/intl/tests/badargs.phpt14
-rw-r--r--ext/intl/tests/breakiter___construct_error.phpt22
-rw-r--r--ext/intl/tests/breakiter_createCodePointInstance_basic.phpt2
-rw-r--r--ext/intl/tests/breakiter_createCodePointInstance_error.phpt16
-rw-r--r--ext/intl/tests/breakiter_current_basic.phpt2
-rw-r--r--ext/intl/tests/breakiter_factories_basic.phpt14
-rw-r--r--ext/intl/tests/breakiter_factories_error.phpt40
-rw-r--r--ext/intl/tests/breakiter_first_last_previous_current_error.phpt37
-rw-r--r--ext/intl/tests/breakiter_following_basic.phpt2
-rw-r--r--ext/intl/tests/breakiter_following_preceding_isBoundary_error.phpt49
-rw-r--r--ext/intl/tests/breakiter_getLocale_basic.phpt2
-rw-r--r--ext/intl/tests/breakiter_getLocale_basic2.phpt2
-rw-r--r--ext/intl/tests/breakiter_getLocale_basic3.phpt2
-rw-r--r--ext/intl/tests/breakiter_getLocale_error.phpt31
-rw-r--r--ext/intl/tests/breakiter_getPartsIterator_basic.phpt2
-rw-r--r--ext/intl/tests/breakiter_getPartsIterator_basic2.phpt2
-rw-r--r--ext/intl/tests/breakiter_getPartsIterator_error.phpt14
-rw-r--r--ext/intl/tests/breakiter_getPartsIterator_var1.phpt2
-rw-r--r--ext/intl/tests/breakiter_getText_error.phpt17
-rw-r--r--ext/intl/tests/breakiter_isBoundary_basic.phpt2
-rw-r--r--ext/intl/tests/breakiter_next_basic.phpt2
-rw-r--r--ext/intl/tests/breakiter_next_error.phpt25
-rw-r--r--ext/intl/tests/breakiter_preceding_basic.phpt2
-rw-r--r--ext/intl/tests/breakiter_preceding_basic2.phpt2
-rw-r--r--ext/intl/tests/breakiter_previous_basic.phpt2
-rw-r--r--ext/intl/tests/breakiter_setText_error.phpt42
-rw-r--r--ext/intl/tests/bug12887.phpt14
-rw-r--r--ext/intl/tests/bug14562.phpt22
-rw-r--r--ext/intl/tests/bug53512.phpt6
-rw-r--r--ext/intl/tests/bug53735.phpt2
-rw-r--r--ext/intl/tests/bug58756_MessageFormatter.phpt4
-rw-r--r--ext/intl/tests/bug58756_MessageFormatter_variant2.phpt4
-rw-r--r--ext/intl/tests/bug60192-compare.phpt6
-rw-r--r--ext/intl/tests/bug60192-getlocale.phpt6
-rw-r--r--ext/intl/tests/bug60192-getsortkey.phpt6
-rw-r--r--ext/intl/tests/bug60192-sort.phpt6
-rw-r--r--ext/intl/tests/bug60192-sortwithsortkeys.phpt6
-rw-r--r--ext/intl/tests/bug62017.phpt12
-rw-r--r--ext/intl/tests/bug62915-2.phpt18
-rw-r--r--ext/intl/tests/bug62915.phpt8
-rw-r--r--ext/intl/tests/bug65732.phpt2
-rw-r--r--ext/intl/tests/bug69374.phpt2
-rw-r--r--ext/intl/tests/bug69398.phpt2
-rw-r--r--ext/intl/tests/bug71020.phpt2
-rw-r--r--ext/intl/tests/bug72533.phpt12
-rw-r--r--ext/intl/tests/bug72639.phpt2
-rw-r--r--ext/intl/tests/bug74063.phpt17
-rw-r--r--ext/intl/tests/bug74433.phpt2
-rw-r--r--ext/intl/tests/bug74468.phpt2
-rw-r--r--ext/intl/tests/bug74484_MessageFormatter.phpt2
-rw-r--r--ext/intl/tests/bug74705.phpt2
-rw-r--r--ext/intl/tests/bug75090.phpt2
-rw-r--r--ext/intl/tests/bug75193.phpt2
-rw-r--r--ext/intl/tests/bug75318.phpt2
-rw-r--r--ext/intl/tests/bug76556.phpt2
-rw-r--r--ext/intl/tests/calendar_add_basic.phpt8
-rw-r--r--ext/intl/tests/calendar_add_error.phpt27
-rw-r--r--ext/intl/tests/calendar_before_after_error.phpt65
-rw-r--r--ext/intl/tests/calendar_clear_basic.phpt18
-rw-r--r--ext/intl/tests/calendar_clear_error.phpt8
-rw-r--r--ext/intl/tests/calendar_clear_variation1.phpt8
-rw-r--r--ext/intl/tests/calendar_createInstance_basic.phpt2
-rw-r--r--ext/intl/tests/calendar_createInstance_error.phpt18
-rw-r--r--ext/intl/tests/calendar_createInstance_variation1.phpt2
-rw-r--r--ext/intl/tests/calendar_equals_before_after_basic.phpt4
-rw-r--r--ext/intl/tests/calendar_equals_error.phpt33
-rw-r--r--ext/intl/tests/calendar_fieldDifference_basic.phpt20
-rw-r--r--ext/intl/tests/calendar_fieldDifference_error.phpt31
-rw-r--r--ext/intl/tests/calendar_fromDateTime_basic.phpt22
-rw-r--r--ext/intl/tests/calendar_fromDateTime_error.phpt23
-rw-r--r--ext/intl/tests/calendar_getAvailableLocales_basic.phpt4
-rw-r--r--ext/intl/tests/calendar_getAvailableLocales_error.phpt22
-rw-r--r--ext/intl/tests/calendar_getDayOfWeekType_basic.phpt12
-rw-r--r--ext/intl/tests/calendar_getDayOfWeekType_basic2.phpt12
-rw-r--r--ext/intl/tests/calendar_getDayOfWeekType_error.phpt20
-rw-r--r--ext/intl/tests/calendar_getErrorCode_error.phpt11
-rw-r--r--ext/intl/tests/calendar_getErrorCode_getErrorMessage_basic.phpt18
-rw-r--r--ext/intl/tests/calendar_getErrorMessage_error.phpt11
-rw-r--r--ext/intl/tests/calendar_getFirstDayOfWeek_basic.phpt4
-rw-r--r--ext/intl/tests/calendar_getFirstDayOfWeek_error.phpt17
-rw-r--r--ext/intl/tests/calendar_getKeywordValuesForLocale_basic.phpt2
-rw-r--r--ext/intl/tests/calendar_getKeywordValuesForLocale_error.phpt22
-rw-r--r--ext/intl/tests/calendar_getLocale_basic.phpt2
-rw-r--r--ext/intl/tests/calendar_getLocale_error.phpt27
-rw-r--r--ext/intl/tests/calendar_getMinimalDaysInFirstWeek_basic.phpt2
-rw-r--r--ext/intl/tests/calendar_getMinimalDaysInFirstWeek_error.phpt17
-rw-r--r--ext/intl/tests/calendar_getNow_basic.phpt2
-rw-r--r--ext/intl/tests/calendar_getNow_error.phpt22
-rw-r--r--ext/intl/tests/calendar_getSkipped_RepeatedWallTimeOption_error.phpt30
-rw-r--r--ext/intl/tests/calendar_getTimeZone_basic.phpt2
-rw-r--r--ext/intl/tests/calendar_getTimeZone_error.phpt17
-rw-r--r--ext/intl/tests/calendar_getTime_basic.phpt4
-rw-r--r--ext/intl/tests/calendar_getTime_error.phpt17
-rw-r--r--ext/intl/tests/calendar_getType_basic.phpt4
-rw-r--r--ext/intl/tests/calendar_getType_error.phpt17
-rw-r--r--ext/intl/tests/calendar_getWeekendTransition_basic.phpt2
-rw-r--r--ext/intl/tests/calendar_getWeekendTransition_error.phpt21
-rw-r--r--ext/intl/tests/calendar_getXMaximum_basic.phpt16
-rw-r--r--ext/intl/tests/calendar_getXMinimum_basic.phpt16
-rw-r--r--ext/intl/tests/calendar_get_Least_Greatest_Minimum_Maximum_error.phpt49
-rw-r--r--ext/intl/tests/calendar_get_basic.phpt4
-rw-r--r--ext/intl/tests/calendar_get_getActualMaximum_Minumum_error.phpt57
-rw-r--r--ext/intl/tests/calendar_get_getActualMaximum_Minumum_error2.phpt84
-rw-r--r--ext/intl/tests/calendar_get_setRepeatedWallTimeOption_basic.phpt10
-rw-r--r--ext/intl/tests/calendar_get_setSkippedWallTimeOption_basic.phpt14
-rw-r--r--ext/intl/tests/calendar_inDaylightTime_basic.phpt4
-rw-r--r--ext/intl/tests/calendar_inDaylightTime_error.phpt17
-rw-r--r--ext/intl/tests/calendar_isEquivalentTo_basic.phpt20
-rw-r--r--ext/intl/tests/calendar_isEquivalentTo_error.phpt42
-rw-r--r--ext/intl/tests/calendar_isLenient_error.phpt17
-rw-r--r--ext/intl/tests/calendar_isSet_basic.phpt4
-rw-r--r--ext/intl/tests/calendar_isSet_error.phpt20
-rw-r--r--ext/intl/tests/calendar_isWeekend_basic.phpt2
-rw-r--r--ext/intl/tests/calendar_isWeekend_error.phpt23
-rw-r--r--ext/intl/tests/calendar_is_set_lenient_basic.phpt4
-rw-r--r--ext/intl/tests/calendar_roll_basic.phpt4
-rw-r--r--ext/intl/tests/calendar_roll_error.phpt16
-rw-r--r--ext/intl/tests/calendar_roll_variation1.phpt4
-rw-r--r--ext/intl/tests/calendar_setFirstDayOfWeek_basic.phpt14
-rw-r--r--ext/intl/tests/calendar_setFirstDayOfWeek_error.phpt14
-rw-r--r--ext/intl/tests/calendar_setLenient_error.phpt29
-rw-r--r--ext/intl/tests/calendar_setMinimalDaysInFirstWeek_basic.phpt10
-rw-r--r--ext/intl/tests/calendar_setMinimalDaysInFirstWeek_error.phpt14
-rw-r--r--ext/intl/tests/calendar_setSkipped_RepeatedWallTimeOption_error.phpt54
-rw-r--r--ext/intl/tests/calendar_setTimeZone_basic.phpt4
-rw-r--r--ext/intl/tests/calendar_setTimeZone_error.phpt33
-rw-r--r--ext/intl/tests/calendar_setTimeZone_variation1.phpt4
-rw-r--r--ext/intl/tests/calendar_setTime_basic.phpt8
-rw-r--r--ext/intl/tests/calendar_setTime_error.phpt23
-rw-r--r--ext/intl/tests/calendar_set_basic.phpt4
-rw-r--r--ext/intl/tests/calendar_set_error.phpt29
-rw-r--r--ext/intl/tests/calendar_set_variation1.phpt10
-rw-r--r--ext/intl/tests/calendar_toDateTime_basic.phpt2
-rw-r--r--ext/intl/tests/calendar_toDateTime_error.phpt17
-rw-r--r--ext/intl/tests/collator_asort.phpt2
-rw-r--r--ext/intl/tests/collator_asort_variant2.phpt2
-rw-r--r--ext/intl/tests/collator_create2.phpt2
-rw-r--r--ext/intl/tests/collator_create3.phpt2
-rw-r--r--ext/intl/tests/collator_create4.phpt2
-rw-r--r--ext/intl/tests/collator_get_sort_key.phpt18
-rw-r--r--ext/intl/tests/collator_get_sort_key_variant2.phpt18
-rw-r--r--ext/intl/tests/collator_get_sort_key_variant3.phpt18
-rw-r--r--ext/intl/tests/collator_get_sort_key_variant4.phpt18
-rw-r--r--ext/intl/tests/collator_get_sort_key_variant5.phpt18
-rw-r--r--ext/intl/tests/collator_get_sort_key_variant6.phpt18
-rw-r--r--ext/intl/tests/collator_get_sort_key_variant7.phpt18
-rw-r--r--ext/intl/tests/collator_sort.phpt2
-rw-r--r--ext/intl/tests/collator_sort_variant2.phpt2
-rw-r--r--ext/intl/tests/cpbi_clone_equality.phpt2
-rw-r--r--ext/intl/tests/cpbi_getLastCodePoint_basic.phpt30
-rw-r--r--ext/intl/tests/cpbi_getLastCodePoint_error.phpt17
-rw-r--r--ext/intl/tests/cpbi_parts_iterator.phpt6
-rw-r--r--ext/intl/tests/dateformat___construct_bad_tz_cal.phpt20
-rw-r--r--ext/intl/tests/dateformat_bug65683.phpt2
-rw-r--r--ext/intl/tests/dateformat_bug71516.phpt2
-rw-r--r--ext/intl/tests/dateformat_calendars.phpt34
-rw-r--r--ext/intl/tests/dateformat_calendars_variant2.phpt34
-rw-r--r--ext/intl/tests/dateformat_calendars_variant3.phpt34
-rw-r--r--ext/intl/tests/dateformat_clone_bad_obj.phpt6
-rw-r--r--ext/intl/tests/dateformat_create_cal_arg.phpt2
-rw-r--r--ext/intl/tests/dateformat_create_cal_arg_variant2.phpt2
-rw-r--r--ext/intl/tests/dateformat_create_cal_arg_variant3.phpt2
-rw-r--r--ext/intl/tests/dateformat_create_cal_arg_variant4.phpt2
-rw-r--r--ext/intl/tests/dateformat_create_cal_arg_variant5.phpt2
-rw-r--r--ext/intl/tests/dateformat_format.phpt212
-rw-r--r--ext/intl/tests/dateformat_formatObject_calendar.phpt2
-rw-r--r--ext/intl/tests/dateformat_formatObject_calendar_variant2.phpt2
-rw-r--r--ext/intl/tests/dateformat_formatObject_calendar_variant3.phpt2
-rw-r--r--ext/intl/tests/dateformat_formatObject_calendar_variant4.phpt2
-rw-r--r--ext/intl/tests/dateformat_formatObject_calendar_variant5.phpt2
-rw-r--r--ext/intl/tests/dateformat_formatObject_datetime.phpt2
-rw-r--r--ext/intl/tests/dateformat_formatObject_datetime_variant2.phpt2
-rw-r--r--ext/intl/tests/dateformat_formatObject_datetime_variant3.phpt2
-rw-r--r--ext/intl/tests/dateformat_formatObject_datetime_variant4.phpt2
-rw-r--r--ext/intl/tests/dateformat_formatObject_datetime_variant5.phpt2
-rw-r--r--ext/intl/tests/dateformat_formatObject_error.phpt24
-rw-r--r--ext/intl/tests/dateformat_format_parse.phpt190
-rw-r--r--ext/intl/tests/dateformat_format_parse_version2.phpt190
-rw-r--r--ext/intl/tests/dateformat_format_relative.phpt72
-rw-r--r--ext/intl/tests/dateformat_format_variant2.phpt212
-rw-r--r--ext/intl/tests/dateformat_format_variant3.phpt212
-rw-r--r--ext/intl/tests/dateformat_getCalendarObject_error.phpt42
-rw-r--r--ext/intl/tests/dateformat_getTimeZone_error.phpt42
-rw-r--r--ext/intl/tests/dateformat_get_datetype.phpt40
-rw-r--r--ext/intl/tests/dateformat_get_locale.phpt52
-rw-r--r--ext/intl/tests/dateformat_get_set_calendar.phpt2
-rw-r--r--ext/intl/tests/dateformat_get_set_calendar_variant2.phpt2
-rw-r--r--ext/intl/tests/dateformat_get_set_calendar_variant3.phpt2
-rw-r--r--ext/intl/tests/dateformat_get_set_calendar_variant4.phpt2
-rw-r--r--ext/intl/tests/dateformat_get_set_calendar_variant5.phpt2
-rw-r--r--ext/intl/tests/dateformat_get_set_pattern2.phpt8
-rw-r--r--ext/intl/tests/dateformat_get_set_timezone.phpt2
-rw-r--r--ext/intl/tests/dateformat_get_set_timezone_variant2.phpt2
-rw-r--r--ext/intl/tests/dateformat_get_set_timezone_variant3.phpt2
-rw-r--r--ext/intl/tests/dateformat_get_set_timezone_variant4.phpt2
-rw-r--r--ext/intl/tests/dateformat_get_set_timezone_variant5.phpt2
-rw-r--r--ext/intl/tests/dateformat_get_timetype.phpt40
-rw-r--r--ext/intl/tests/dateformat_get_timezone_id.phpt36
-rw-r--r--ext/intl/tests/dateformat_is_set_lenient.phpt72
-rw-r--r--ext/intl/tests/dateformat_setTimeZone_error.phpt32
-rw-r--r--ext/intl/tests/dateformat_set_timezone_id2.phpt55
-rw-r--r--ext/intl/tests/dateformat_set_timezone_id3.phpt55
-rw-r--r--ext/intl/tests/formatter_clone.phpt2
-rw-r--r--ext/intl/tests/formatter_clone_bad_obj.phpt6
-rw-r--r--ext/intl/tests/formatter_fail.phpt118
-rw-r--r--ext/intl/tests/formatter_format2.phpt8
-rw-r--r--ext/intl/tests/formatter_format3.phpt8
-rw-r--r--ext/intl/tests/formatter_format4.phpt8
-rw-r--r--ext/intl/tests/formatter_format5.phpt8
-rw-r--r--ext/intl/tests/formatter_format6.phpt8
-rw-r--r--ext/intl/tests/formatter_format7.phpt8
-rw-r--r--ext/intl/tests/formatter_format8.phpt8
-rw-r--r--ext/intl/tests/formatter_get_set_pattern.phpt4
-rw-r--r--ext/intl/tests/formatter_get_set_pattern2.phpt4
-rw-r--r--ext/intl/tests/formatter_get_set_symbol2.phpt12
-rw-r--r--ext/intl/tests/formatter_get_set_text_attribute.phpt4
-rw-r--r--ext/intl/tests/formatter_get_set_text_attribute_var2.phpt4
-rw-r--r--ext/intl/tests/grapheme.phpt1512
-rw-r--r--ext/intl/tests/grapheme2.phpt1512
-rw-r--r--ext/intl/tests/gregoriancalendar___construct_basic.phpt2
-rw-r--r--ext/intl/tests/gregoriancalendar___construct_error.phpt49
-rw-r--r--ext/intl/tests/gregoriancalendar___construct_variant1.phpt2
-rw-r--r--ext/intl/tests/gregoriancalendar_getGregorianChange_error.phpt18
-rw-r--r--ext/intl/tests/gregoriancalendar_get_setGregorianChange_basic.phpt4
-rw-r--r--ext/intl/tests/gregoriancalendar_isLeapYear_basic.phpt4
-rw-r--r--ext/intl/tests/gregoriancalendar_isLeapYear_error.phpt36
-rw-r--r--ext/intl/tests/gregoriancalendar_setGregorianChange_error.phpt45
-rw-r--r--ext/intl/tests/idn_uts46_basic.phpt4
-rw-r--r--ext/intl/tests/idn_uts46_errors.phpt36
-rw-r--r--ext/intl/tests/ini_use_exceptions_basic.phpt4
-rw-r--r--ext/intl/tests/intl_get_error_code.phpt2
-rw-r--r--ext/intl/tests/intl_get_error_message.phpt4
-rw-r--r--ext/intl/tests/locale/bug74993.phpt41
-rw-r--r--ext/intl/tests/locale_accept.phpt29
-rw-r--r--ext/intl/tests/locale_bug66289.phpt2
-rw-r--r--ext/intl/tests/locale_bug72658.phpt6
-rw-r--r--ext/intl/tests/locale_bug74439.phpt2
-rw-r--r--ext/intl/tests/locale_compose_locale.phpt196
-rw-r--r--ext/intl/tests/locale_filter_matches2.phpt96
-rw-r--r--ext/intl/tests/locale_filter_matches3.phpt96
-rw-r--r--ext/intl/tests/locale_get_all_variants.phpt52
-rw-r--r--ext/intl/tests/locale_get_display_language.phpt18
-rw-r--r--ext/intl/tests/locale_get_display_name2.phpt20
-rw-r--r--ext/intl/tests/locale_get_display_name3.phpt20
-rw-r--r--ext/intl/tests/locale_get_display_name4.phpt20
-rw-r--r--ext/intl/tests/locale_get_display_name5.phpt20
-rw-r--r--ext/intl/tests/locale_get_display_name6.phpt20
-rw-r--r--ext/intl/tests/locale_get_display_name7.phpt20
-rw-r--r--ext/intl/tests/locale_get_keywords2.phpt22
-rw-r--r--ext/intl/tests/locale_get_primary_language.phpt4
-rw-r--r--ext/intl/tests/locale_lookup.phpt60
-rw-r--r--ext/intl/tests/locale_lookup_variant2.phpt60
-rw-r--r--ext/intl/tests/locale_parse_locale2.phpt2
-rw-r--r--ext/intl/tests/locale_set_default.phpt20
-rw-r--r--ext/intl/tests/msgfmt_bug70484.phpt38
-rw-r--r--ext/intl/tests/msgfmt_clone_bad_obj.phpt6
-rw-r--r--ext/intl/tests/msgfmt_fail2.phpt154
-rw-r--r--ext/intl/tests/msgfmt_format.phpt18
-rw-r--r--ext/intl/tests/msgfmt_format_datetime.phpt2
-rw-r--r--ext/intl/tests/msgfmt_format_intlcalendar.phpt4
-rw-r--r--ext/intl/tests/msgfmt_format_intlcalendar_variant2.phpt4
-rw-r--r--ext/intl/tests/msgfmt_format_intlcalendar_variant3.phpt4
-rw-r--r--ext/intl/tests/msgfmt_format_intlcalendar_variant4.phpt4
-rw-r--r--ext/intl/tests/msgfmt_format_mixed_params.phpt4
-rw-r--r--ext/intl/tests/msgfmt_format_simple_types_numeric_strings.phpt46
-rw-r--r--ext/intl/tests/msgfmt_format_subpatterns.phpt8
-rw-r--r--ext/intl/tests/msgfmt_format_subpatterns_named.phpt8
-rw-r--r--ext/intl/tests/msgfmt_millisecond_dates.phpt4
-rw-r--r--ext/intl/tests/msgfmt_parse.phpt32
-rw-r--r--ext/intl/tests/msgfmt_setPattern_cache.phpt4
-rw-r--r--ext/intl/tests/normalizer_get_raw_decomposition.phpt10
-rw-r--r--ext/intl/tests/normalizer_normalize.phpt170
-rw-r--r--ext/intl/tests/normalizer_normalize_kc_cf.phpt137
-rw-r--r--ext/intl/tests/rbbiter___construct_basic.phpt6
-rw-r--r--ext/intl/tests/rbbiter_getBinaryRules_basic.phpt2
-rw-r--r--ext/intl/tests/rbbiter_getBinaryRules_basic2.phpt2
-rw-r--r--ext/intl/tests/rbbiter_getRuleStatusVec_basic.phpt4
-rw-r--r--ext/intl/tests/rbbiter_getRuleStatus_basic.phpt6
-rw-r--r--ext/intl/tests/rbbiter_getRules_basic.phpt2
-rw-r--r--ext/intl/tests/rbbiter_getRules_basic2.phpt2
-rw-r--r--ext/intl/tests/resourcebundle.inc14
-rw-r--r--ext/intl/tests/resourcebundle_arrayaccess.phpt28
-rw-r--r--ext/intl/tests/resourcebundle_countable.phpt6
-rw-r--r--ext/intl/tests/resourcebundle_create.phpt42
-rw-r--r--ext/intl/tests/resourcebundle_individual.phpt36
-rw-r--r--ext/intl/tests/resourcebundle_iterator.phpt44
-rw-r--r--ext/intl/tests/resourcebundle_locales.phpt10
-rw-r--r--ext/intl/tests/resourcebundle_null_mandatory_args.phpt2
-rw-r--r--ext/intl/tests/resourcebundle_null_mandatory_args_variant2.phpt2
-rw-r--r--ext/intl/tests/resourcebundle_traversable.phpt8
-rw-r--r--ext/intl/tests/symfony_format_type_double_intl1.phpt30
-rw-r--r--ext/intl/tests/symfony_format_type_double_intl2.phpt30
-rw-r--r--ext/intl/tests/symfony_format_type_double_intl3.phpt30
-rw-r--r--ext/intl/tests/symfony_format_type_double_intl4.phpt30
-rw-r--r--ext/intl/tests/symfony_format_type_int32_intl1.phpt49
-rw-r--r--ext/intl/tests/symfony_format_type_int32_intl2.phpt33
-rw-r--r--ext/intl/tests/symfony_format_type_int32_intl3.phpt32
-rw-r--r--ext/intl/tests/symfony_format_type_int32_intl4.phpt30
-rw-r--r--ext/intl/tests/symfony_format_type_int32_intl5.phpt30
-rw-r--r--ext/intl/tests/symfony_format_type_int32_intl6.phpt32
-rw-r--r--ext/intl/tests/symfony_format_type_int32_intl7.phpt32
-rw-r--r--ext/intl/tests/symfony_format_type_int64_intl1.phpt30
-rw-r--r--ext/intl/tests/symfony_format_type_int64_intl2.phpt30
-rw-r--r--ext/intl/tests/symfony_format_type_int64_intl3.phpt30
-rw-r--r--ext/intl/tests/symfony_format_type_int64_intl4.phpt30
-rw-r--r--ext/intl/tests/symfony_format_type_int64_intl5.phpt30
-rw-r--r--ext/intl/tests/symfony_format_type_int64_intl6.phpt30
-rw-r--r--ext/intl/tests/symfony_format_type_int64_intl7.phpt30
-rw-r--r--ext/intl/tests/symfony_format_type_int64_intl8.phpt30
-rw-r--r--ext/intl/tests/timezone_clone_basic.phpt4
-rw-r--r--ext/intl/tests/timezone_clone_error.phpt6
-rw-r--r--ext/intl/tests/timezone_countEquivalentIDs_basic.phpt4
-rw-r--r--ext/intl/tests/timezone_countEquivalentIDs_error.phpt18
-rw-r--r--ext/intl/tests/timezone_createDefault_basic.phpt2
-rw-r--r--ext/intl/tests/timezone_createDefault_error.phpt16
-rw-r--r--ext/intl/tests/timezone_createEnumeration_basic.phpt4
-rw-r--r--ext/intl/tests/timezone_createEnumeration_error.phpt7
-rw-r--r--ext/intl/tests/timezone_createEnumeration_variation1.phpt4
-rw-r--r--ext/intl/tests/timezone_createEnumeration_variation2.phpt4
-rw-r--r--ext/intl/tests/timezone_createTimeZoneIDEnumeration_basic.phpt14
-rw-r--r--ext/intl/tests/timezone_createTimeZoneIDEnumeration_error.phpt24
-rw-r--r--ext/intl/tests/timezone_createTimeZoneIDEnumeration_variant1.phpt12
-rw-r--r--ext/intl/tests/timezone_createTimeZoneIDEnumeration_variant2.phpt12
-rw-r--r--ext/intl/tests/timezone_createTimeZone_basic.phpt2
-rw-r--r--ext/intl/tests/timezone_createTimeZone_error.phpt19
-rw-r--r--ext/intl/tests/timezone_equals_basic.phpt4
-rw-r--r--ext/intl/tests/timezone_equals_error.phpt6
-rw-r--r--ext/intl/tests/timezone_fromDateTimeZone_error.phpt32
-rw-r--r--ext/intl/tests/timezone_getCanonicalID_basic.phpt4
-rw-r--r--ext/intl/tests/timezone_getCanonicalID_error.phpt13
-rw-r--r--ext/intl/tests/timezone_getCanonicalID_variant1.phpt2
-rw-r--r--ext/intl/tests/timezone_getCanonicalID_variant1_2.phpt2
-rw-r--r--ext/intl/tests/timezone_getDSTSavings_basic.phpt4
-rw-r--r--ext/intl/tests/timezone_getDSTSavings_error.phpt11
-rw-r--r--ext/intl/tests/timezone_getDisplayName_basic.phpt4
-rw-r--r--ext/intl/tests/timezone_getDisplayName_error.phpt26
-rw-r--r--ext/intl/tests/timezone_getDisplayName_variant1.phpt4
-rw-r--r--ext/intl/tests/timezone_getDisplayName_variant2-49+.phpt2
-rw-r--r--ext/intl/tests/timezone_getDisplayName_variant3-49+.phpt2
-rw-r--r--ext/intl/tests/timezone_getDisplayName_variant4.phpt2
-rw-r--r--ext/intl/tests/timezone_getEquivalentID_basic.phpt4
-rw-r--r--ext/intl/tests/timezone_getEquivalentID_error.phpt19
-rw-r--r--ext/intl/tests/timezone_getErrorCodeMessage_basic.phpt2
-rw-r--r--ext/intl/tests/timezone_getErrorCode_error.phpt11
-rw-r--r--ext/intl/tests/timezone_getErrorMessage_error.phpt11
-rw-r--r--ext/intl/tests/timezone_getGMT_basic.phpt4
-rw-r--r--ext/intl/tests/timezone_getGMT_error.phpt16
-rw-r--r--ext/intl/tests/timezone_getID_error.phpt10
-rw-r--r--ext/intl/tests/timezone_getOffset_basic.phpt8
-rw-r--r--ext/intl/tests/timezone_getOffset_error.phpt15
-rw-r--r--ext/intl/tests/timezone_getRawOffset_basic.phpt4
-rw-r--r--ext/intl/tests/timezone_getRawOffset_error.phpt11
-rw-r--r--ext/intl/tests/timezone_getRegion_basic.phpt2
-rw-r--r--ext/intl/tests/timezone_getRegion_error.phpt19
-rw-r--r--ext/intl/tests/timezone_getTZDataVersion_error.phpt16
-rw-r--r--ext/intl/tests/timezone_getTZData_basic.phpt4
-rw-r--r--ext/intl/tests/timezone_getUnknown_basic.phpt2
-rw-r--r--ext/intl/tests/timezone_getUnknown_error.phpt25
-rw-r--r--ext/intl/tests/timezone_hasSameRules_basic.phpt4
-rw-r--r--ext/intl/tests/timezone_hasSameRules_error.phpt20
-rw-r--r--ext/intl/tests/timezone_toDateTimeZone_basic.phpt12
-rw-r--r--ext/intl/tests/timezone_toDateTimeZone_error.phpt18
-rw-r--r--ext/intl/tests/timezone_useDaylightTime_basic.phpt4
-rw-r--r--ext/intl/tests/timezone_useDaylightTime_error.phpt10
-rw-r--r--ext/intl/tests/transliterator_create_from_rule_error.phpt16
-rw-r--r--ext/intl/tests/transliterator_create_inverse_error.phpt11
-rw-r--r--ext/intl/tests/transliterator_get_error_code_error.phpt16
-rw-r--r--ext/intl/tests/transliterator_get_error_message_error.phpt16
-rw-r--r--ext/intl/tests/transliterator_list_ids_error.phpt17
-rw-r--r--ext/intl/tests/transliterator_transliterate_error.phpt32
-rw-r--r--ext/intl/tests/uconverter_getAvailable_wrongparam_001.phpt8
-rw-r--r--ext/intl/tests/ut_common.inc4
-rw-r--r--ext/intl/timezone/timezone.stub.php136
-rw-r--r--ext/intl/timezone/timezone_arginfo.h189
-rw-r--r--ext/intl/timezone/timezone_class.cpp143
-rw-r--r--ext/intl/timezone/timezone_class.h6
-rw-r--r--ext/intl/timezone/timezone_methods.cpp102
-rw-r--r--ext/intl/timezone/timezone_methods.h2
-rw-r--r--ext/intl/transliterator/transliterator.c2
-rw-r--r--ext/intl/transliterator/transliterator.h2
-rw-r--r--ext/intl/transliterator/transliterator.stub.php42
-rw-r--r--ext/intl/transliterator/transliterator_arginfo.h60
-rw-r--r--ext/intl/transliterator/transliterator_class.c99
-rw-r--r--ext/intl/transliterator/transliterator_class.h6
-rw-r--r--ext/intl/transliterator/transliterator_methods.c45
-rw-r--r--ext/intl/transliterator/transliterator_methods.h2
-rw-r--r--ext/intl/uchar/uchar.c128
-rw-r--r--ext/json/Makefile.frag2
-rw-r--r--ext/json/json.c48
-rw-r--r--ext/json/json.stub.php15
-rw-r--r--ext/json/json_arginfo.h23
-rw-r--r--ext/json/json_encoder.c2
-rw-r--r--ext/json/json_parser.y16
-rw-r--r--ext/json/json_scanner.re2
-rw-r--r--ext/json/php_json.h2
-rw-r--r--ext/json/php_json_encoder.h2
-rw-r--r--ext/json/php_json_parser.h2
-rw-r--r--ext/json/php_json_scanner.h2
-rw-r--r--ext/json/tests/001.phpt5
-rw-r--r--ext/json/tests/003.phpt5
-rw-r--r--ext/json/tests/bug40503.phpt2
-rw-r--r--ext/json/tests/bug42090.phpt14
-rw-r--r--ext/json/tests/bug46215.phpt2
-rw-r--r--ext/json/tests/bug46944.phpt8
-rw-r--r--ext/json/tests/bug47644.phpt2
-rw-r--r--ext/json/tests/bug54058.phpt4
-rw-r--r--ext/json/tests/bug61978.phpt32
-rw-r--r--ext/json/tests/bug62369.phpt26
-rw-r--r--ext/json/tests/bug63737.phpt8
-rw-r--r--ext/json/tests/bug64874_part1.phpt6
-rw-r--r--ext/json/tests/bug64874_part2.phpt4
-rw-r--r--ext/json/tests/bug66021.phpt2
-rw-r--r--ext/json/tests/bug66025.phpt4
-rw-r--r--ext/json/tests/bug68567.phpt2
-rw-r--r--ext/json/tests/bug68817.phpt2
-rw-r--r--ext/json/tests/bug68992.phpt8
-rw-r--r--ext/json/tests/bug71835.phpt12
-rw-r--r--ext/json/tests/bug72069.phpt8
-rw-r--r--ext/json/tests/bug72787.phpt9
-rw-r--r--ext/json/tests/bug73113.phpt4
-rw-r--r--ext/json/tests/fail001.phpt58
-rw-r--r--ext/json/tests/json_decode_basic.phpt48
-rw-r--r--ext/json/tests/json_decode_error.phpt32
-rw-r--r--ext/json/tests/json_decode_exceptions.phpt4
-rw-r--r--ext/json/tests/json_decode_invalid_utf8.phpt16
-rw-r--r--ext/json/tests/json_encode_basic.phpt104
-rw-r--r--ext/json/tests/json_encode_basic_utf8.phpt2
-rw-r--r--ext/json/tests/json_encode_exceptions.phpt4
-rw-r--r--ext/json/tests/json_encode_invalid_utf8.phpt10
-rw-r--r--ext/json/tests/json_encode_numeric.phpt12
-rw-r--r--ext/json/tests/json_encode_pretty_print.phpt10
-rw-r--r--ext/json/tests/json_exceptions_error_clearing.phpt12
-rw-r--r--ext/json/tests/json_last_error_error.phpt17
-rw-r--r--ext/json/tests/json_last_error_msg_error.phpt15
-rw-r--r--ext/json/tests/serialize.phpt56
-rw-r--r--ext/ldap/config.m42
-rw-r--r--ext/ldap/config.w321
-rw-r--r--ext/ldap/ldap.c637
-rw-r--r--ext/ldap/ldap.stub.php335
-rw-r--r--ext/ldap/ldap_arginfo.h350
-rw-r--r--ext/ldap/php_ldap.h2
-rw-r--r--ext/ldap/tests/bug48441.phpt14
-rw-r--r--ext/ldap/tests/bug48696.phpt15
-rw-r--r--ext/ldap/tests/bug73933.phpt12
-rw-r--r--ext/ldap/tests/bug77958.phpt30
-rw-r--r--ext/ldap/tests/connect.inc112
-rw-r--r--ext/ldap/tests/ldap_add_basic.phpt26
-rw-r--r--ext/ldap/tests/ldap_add_error.phpt98
-rw-r--r--ext/ldap/tests/ldap_add_ext.phpt30
-rw-r--r--ext/ldap/tests/ldap_bind_basic.phpt2
-rw-r--r--ext/ldap/tests/ldap_bind_error.phpt8
-rw-r--r--ext/ldap/tests/ldap_bind_ext.phpt42
-rw-r--r--ext/ldap/tests/ldap_bind_variation.phpt2
-rw-r--r--ext/ldap/tests/ldap_compare_basic.phpt6
-rw-r--r--ext/ldap/tests/ldap_compare_error.phpt28
-rw-r--r--ext/ldap/tests/ldap_connect_basic.phpt2
-rw-r--r--ext/ldap/tests/ldap_connect_error.phpt6
-rw-r--r--ext/ldap/tests/ldap_connect_ldap_conf.phpt2
-rw-r--r--ext/ldap/tests/ldap_connect_variation.phpt2
-rw-r--r--ext/ldap/tests/ldap_control_paged_results_variation1.phpt8
-rw-r--r--ext/ldap/tests/ldap_control_paged_results_variation2.phpt8
-rw-r--r--ext/ldap/tests/ldap_control_paged_results_variation3.phpt16
-rw-r--r--ext/ldap/tests/ldap_controls.phpt52
-rw-r--r--ext/ldap/tests/ldap_count_entries_basic.phpt2
-rw-r--r--ext/ldap/tests/ldap_count_entries_error.phpt23
-rw-r--r--ext/ldap/tests/ldap_delete_basic.phpt18
-rw-r--r--ext/ldap/tests/ldap_delete_error.phpt30
-rw-r--r--ext/ldap/tests/ldap_delete_ext.phpt30
-rw-r--r--ext/ldap/tests/ldap_dn2ufn.phpt7
-rw-r--r--ext/ldap/tests/ldap_err2str_basic.phpt2
-rw-r--r--ext/ldap/tests/ldap_err2str_error.phpt28
-rw-r--r--ext/ldap/tests/ldap_errno_basic.phpt16
-rw-r--r--ext/ldap/tests/ldap_errno_error.phpt23
-rw-r--r--ext/ldap/tests/ldap_error_basic.phpt16
-rw-r--r--ext/ldap/tests/ldap_error_error.phpt23
-rw-r--r--ext/ldap/tests/ldap_exop.phpt58
-rw-r--r--ext/ldap/tests/ldap_exop_passwd.phpt2
-rw-r--r--ext/ldap/tests/ldap_exop_passwd_error.phpt2
-rw-r--r--ext/ldap/tests/ldap_exop_refresh.phpt10
-rw-r--r--ext/ldap/tests/ldap_exop_whoami.phpt2
-rw-r--r--ext/ldap/tests/ldap_explode_dn.phpt10
-rw-r--r--ext/ldap/tests/ldap_first_attribute_basic.phpt4
-rw-r--r--ext/ldap/tests/ldap_first_attribute_error.phpt17
-rw-r--r--ext/ldap/tests/ldap_first_entry_basic.phpt6
-rw-r--r--ext/ldap/tests/ldap_first_entry_error.phpt27
-rw-r--r--ext/ldap/tests/ldap_first_reference_basic.phpt2
-rw-r--r--ext/ldap/tests/ldap_first_reference_error.phpt27
-rw-r--r--ext/ldap/tests/ldap_free_result_basic.phpt2
-rw-r--r--ext/ldap/tests/ldap_free_result_error.phpt23
-rw-r--r--ext/ldap/tests/ldap_get_attributes_basic.phpt4
-rw-r--r--ext/ldap/tests/ldap_get_attributes_error.phpt23
-rw-r--r--ext/ldap/tests/ldap_get_dn_basic.phpt4
-rw-r--r--ext/ldap/tests/ldap_get_dn_error.phpt23
-rw-r--r--ext/ldap/tests/ldap_get_entries_basic.phpt10
-rw-r--r--ext/ldap/tests/ldap_get_entries_error.phpt33
-rw-r--r--ext/ldap/tests/ldap_get_entries_variation.phpt10
-rw-r--r--ext/ldap/tests/ldap_get_option_basic.phpt6
-rw-r--r--ext/ldap/tests/ldap_get_option_controls.phpt68
-rw-r--r--ext/ldap/tests/ldap_get_option_error.phpt40
-rw-r--r--ext/ldap/tests/ldap_get_option_package_basic.phpt2
-rw-r--r--ext/ldap/tests/ldap_get_option_variation.phpt42
-rw-r--r--ext/ldap/tests/ldap_get_values_len_basic.phpt4
-rw-r--r--ext/ldap/tests/ldap_get_values_len_error.phpt16
-rw-r--r--ext/ldap/tests/ldap_list_basic.phpt6
-rw-r--r--ext/ldap/tests/ldap_list_error.phpt35
-rw-r--r--ext/ldap/tests/ldap_mod_add_basic.phpt14
-rw-r--r--ext/ldap/tests/ldap_mod_add_error.phpt34
-rw-r--r--ext/ldap/tests/ldap_mod_del_basic.phpt14
-rw-r--r--ext/ldap/tests/ldap_mod_del_error.phpt22
-rw-r--r--ext/ldap/tests/ldap_mod_ext.phpt60
-rw-r--r--ext/ldap/tests/ldap_mod_replace_basic.phpt14
-rw-r--r--ext/ldap/tests/ldap_mod_replace_error.phpt22
-rw-r--r--ext/ldap/tests/ldap_modify_basic.phpt22
-rw-r--r--ext/ldap/tests/ldap_modify_batch_basic.phpt38
-rw-r--r--ext/ldap/tests/ldap_modify_batch_error.phpt64
-rw-r--r--ext/ldap/tests/ldap_modify_error.phpt34
-rw-r--r--ext/ldap/tests/ldap_next_attribute_basic.phpt10
-rw-r--r--ext/ldap/tests/ldap_next_attribute_error.phpt14
-rw-r--r--ext/ldap/tests/ldap_next_entry_basic.phpt8
-rw-r--r--ext/ldap/tests/ldap_next_entry_error.phpt27
-rw-r--r--ext/ldap/tests/ldap_next_reference_basic.phpt2
-rw-r--r--ext/ldap/tests/ldap_next_reference_error.phpt27
-rw-r--r--ext/ldap/tests/ldap_option_reqcert_basic.phpt2
-rw-r--r--ext/ldap/tests/ldap_option_reqcert_error.phpt4
-rw-r--r--ext/ldap/tests/ldap_parse_reference_basic.phpt6
-rw-r--r--ext/ldap/tests/ldap_parse_reference_error.phpt31
-rw-r--r--ext/ldap/tests/ldap_parse_result_basic.phpt6
-rw-r--r--ext/ldap/tests/ldap_parse_result_controls.phpt16
-rw-r--r--ext/ldap/tests/ldap_parse_result_error.phpt17
-rw-r--r--ext/ldap/tests/ldap_read_basic.phpt6
-rw-r--r--ext/ldap/tests/ldap_read_error.phpt35
-rw-r--r--ext/ldap/tests/ldap_read_variation1.phpt4
-rw-r--r--ext/ldap/tests/ldap_rename_basic.phpt4
-rw-r--r--ext/ldap/tests/ldap_rename_error.phpt7
-rw-r--r--ext/ldap/tests/ldap_rename_ext.phpt28
-rw-r--r--ext/ldap/tests/ldap_sasl_bind_basic.phpt2
-rw-r--r--ext/ldap/tests/ldap_sasl_bind_error.phpt8
-rw-r--r--ext/ldap/tests/ldap_search_basic.phpt6
-rw-r--r--ext/ldap/tests/ldap_search_error.phpt14
-rw-r--r--ext/ldap/tests/ldap_search_overrides.phpt22
-rw-r--r--ext/ldap/tests/ldap_search_paged_result_controls.phpt16
-rw-r--r--ext/ldap/tests/ldap_search_sort_controls.phpt92
-rw-r--r--ext/ldap/tests/ldap_search_variation1.phpt6
-rw-r--r--ext/ldap/tests/ldap_search_variation2.phpt6
-rw-r--r--ext/ldap/tests/ldap_search_variation3.phpt10
-rw-r--r--ext/ldap/tests/ldap_search_variation4.phpt6
-rw-r--r--ext/ldap/tests/ldap_search_variation5.phpt14
-rw-r--r--ext/ldap/tests/ldap_search_variation6.phpt20
-rw-r--r--ext/ldap/tests/ldap_set_option_basic.phpt2
-rw-r--r--ext/ldap/tests/ldap_set_option_cafiles_basic.phpt22
-rw-r--r--ext/ldap/tests/ldap_set_option_ciphersuite_basic.phpt2
-rw-r--r--ext/ldap/tests/ldap_set_option_crlcheck_basic.phpt16
-rw-r--r--ext/ldap/tests/ldap_set_option_crlcheck_error.phpt2
-rw-r--r--ext/ldap/tests/ldap_set_option_error.phpt43
-rw-r--r--ext/ldap/tests/ldap_set_option_keepalive_basic.phpt16
-rw-r--r--ext/ldap/tests/ldap_set_option_reqcert_basic.phpt20
-rw-r--r--ext/ldap/tests/ldap_set_option_reqcert_error.phpt2
-rw-r--r--ext/ldap/tests/ldap_set_option_tls_protocol_min_basic.phpt20
-rw-r--r--ext/ldap/tests/ldap_set_option_variation.phpt38
-rw-r--r--ext/ldap/tests/ldap_set_rebind_proc_basic.phpt2
-rw-r--r--ext/ldap/tests/ldap_set_rebind_proc_error.phpt12
-rw-r--r--ext/ldap/tests/ldap_sort_basic.phpt201
-rw-r--r--ext/ldap/tests/ldap_sort_error.phpt45
-rw-r--r--ext/ldap/tests/ldap_sort_variation.phpt201
-rw-r--r--ext/ldap/tests/ldap_start_tls_basic.phpt2
-rw-r--r--ext/ldap/tests/ldap_start_tls_error.phpt27
-rw-r--r--ext/ldap/tests/ldap_unbind_basic.phpt2
-rw-r--r--ext/ldap/tests/ldap_unbind_error.phpt42
-rw-r--r--ext/ldap/tests/ldap_unbind_variation.phpt18
-rw-r--r--ext/ldap/tests/skipif.inc2
-rw-r--r--ext/ldap/tests/skipifbindfailure.inc10
-rw-r--r--ext/ldap/tests/skipifcontrol.inc12
-rw-r--r--ext/libxml/config.w323
-rw-r--r--ext/libxml/libxml.c38
-rw-r--r--ext/libxml/libxml.stub.php16
-rw-r--r--ext/libxml/libxml_arginfo.h26
-rw-r--r--ext/libxml/php_libxml.h2
-rw-r--r--ext/libxml/tests/001.phpt8
-rw-r--r--ext/libxml/tests/002.phpt56
-rw-r--r--ext/libxml/tests/003.phpt2
-rw-r--r--ext/libxml/tests/004.phpt52
-rw-r--r--ext/libxml/tests/bug42112.phpt4
-rw-r--r--ext/libxml/tests/bug54440.phpt6
-rw-r--r--ext/libxml/tests/bug61367-read.phpt35
-rw-r--r--ext/libxml/tests/bug61367-write.phpt20
-rw-r--r--ext/libxml/tests/bug63389.phpt12
-rw-r--r--ext/libxml/tests/bug76777.phpt2
-rw-r--r--ext/libxml/tests/libxml_disable_entity_loader.phpt5
-rw-r--r--ext/libxml/tests/libxml_set_external_entity_loader_basic.phpt20
-rw-r--r--ext/libxml/tests/libxml_set_external_entity_loader_error1.phpt18
-rw-r--r--ext/libxml/tests/libxml_set_external_entity_loader_variation1.phpt24
-rw-r--r--ext/libxml/tests/libxml_set_external_entity_loader_variation2.phpt10
-rw-r--r--ext/mbstring/libmbfl/filters/mbfilter_iso2022jp_mobile.c2
-rw-r--r--ext/mbstring/libmbfl/filters/mbfilter_uuencode.c2
-rw-r--r--ext/mbstring/libmbfl/mbfl/mbfilter.c252
-rw-r--r--ext/mbstring/libmbfl/mbfl/mbfilter.h10
-rw-r--r--ext/mbstring/mb_gpc.c2
-rw-r--r--ext/mbstring/mb_gpc.h2
-rw-r--r--ext/mbstring/mbstring.c801
-rw-r--r--ext/mbstring/mbstring.h16
-rw-r--r--ext/mbstring/mbstring.stub.php124
-rw-r--r--ext/mbstring/mbstring_arginfo.h304
-rw-r--r--ext/mbstring/php_mbregex.c93
-rw-r--r--ext/mbstring/php_mbregex.h18
-rw-r--r--ext/mbstring/php_unicode.c2
-rw-r--r--ext/mbstring/php_unicode.h2
-rw-r--r--ext/mbstring/tests/bug20087.phpt20
-rw-r--r--ext/mbstring/tests/bug28220.phpt18
-rw-r--r--ext/mbstring/tests/bug30549.phpt12
-rw-r--r--ext/mbstring/tests/bug43301.phpt33
-rw-r--r--ext/mbstring/tests/bug43840.phpt44
-rw-r--r--ext/mbstring/tests/bug43841.phpt61
-rw-r--r--ext/mbstring/tests/bug43994.phpt52
-rw-r--r--ext/mbstring/tests/bug45923.phpt80
-rw-r--r--ext/mbstring/tests/bug48697.phpt9
-rw-r--r--ext/mbstring/tests/bug52931.phpt24
-rw-r--r--ext/mbstring/tests/bug52981.phpt8
-rw-r--r--ext/mbstring/tests/bug62545.phpt2
-rw-r--r--ext/mbstring/tests/bug66797.phpt2
-rw-r--r--ext/mbstring/tests/bug66964.phpt13
-rw-r--r--ext/mbstring/tests/bug72164.phpt4
-rw-r--r--ext/mbstring/tests/bug72402.phpt4
-rw-r--r--ext/mbstring/tests/bug72994.phpt21
-rw-r--r--ext/mbstring/tests/bug73646.phpt7
-rw-r--r--ext/mbstring/tests/bug76704.phpt2
-rw-r--r--ext/mbstring/tests/bug79149.phpt4
-rw-r--r--ext/mbstring/tests/casefold.phpt10
-rw-r--r--ext/mbstring/tests/common.inc16
-rw-r--r--ext/mbstring/tests/htmlent.phpt4
-rw-r--r--ext/mbstring/tests/illformed_utf_sequences.phpt86
-rw-r--r--ext/mbstring/tests/mb_chr.phpt10
-rw-r--r--ext/mbstring/tests/mb_chr_ord.phpt16
-rw-r--r--ext/mbstring/tests/mb_convert_encoding.phpt8
-rw-r--r--ext/mbstring/tests/mb_convert_encoding_array.phpt8
-rw-r--r--ext/mbstring/tests/mb_convert_encoding_array2.phpt10
-rw-r--r--ext/mbstring/tests/mb_convert_variables.phpt48
-rw-r--r--ext/mbstring/tests/mb_decode_mimeheader_basic.phpt2
-rw-r--r--ext/mbstring/tests/mb_decode_mimeheader_variation2.phpt2
-rw-r--r--ext/mbstring/tests/mb_decode_mimeheader_variation3.phpt2
-rw-r--r--ext/mbstring/tests/mb_decode_numericentity.phpt12
-rw-r--r--ext/mbstring/tests/mb_detect_encoding.phpt8
-rw-r--r--ext/mbstring/tests/mb_encode_mimeheader_basic.phpt20
-rw-r--r--ext/mbstring/tests/mb_encode_mimeheader_basic2.phpt14
-rw-r--r--ext/mbstring/tests/mb_encode_mimeheader_basic3.phpt14
-rw-r--r--ext/mbstring/tests/mb_encode_mimeheader_variation6.phpt6
-rw-r--r--ext/mbstring/tests/mb_encode_numericentity.phpt12
-rw-r--r--ext/mbstring/tests/mb_encoding_aliases.phpt2
-rw-r--r--ext/mbstring/tests/mb_ereg.phpt34
-rw-r--r--ext/mbstring/tests/mb_ereg1.phpt37
-rw-r--r--ext/mbstring/tests/mb_ereg2.phpt13
-rw-r--r--ext/mbstring/tests/mb_ereg3.phpt52
-rw-r--r--ext/mbstring/tests/mb_ereg_basic.phpt32
-rw-r--r--ext/mbstring/tests/mb_ereg_replace.phpt6
-rw-r--r--ext/mbstring/tests/mb_ereg_replace_variation1.phpt58
-rw-r--r--ext/mbstring/tests/mb_ereg_search_pos.phpt6
-rw-r--r--ext/mbstring/tests/mb_ereg_search_setpos.phpt8
-rw-r--r--ext/mbstring/tests/mb_ereg_search_xxx.phpt42
-rw-r--r--ext/mbstring/tests/mb_ereg_variation1.phpt178
-rw-r--r--ext/mbstring/tests/mb_ereg_variation3.phpt44
-rw-r--r--ext/mbstring/tests/mb_ereg_variation4.phpt46
-rw-r--r--ext/mbstring/tests/mb_ereg_variation5.phpt28
-rw-r--r--ext/mbstring/tests/mb_ereg_variation6.phpt54
-rw-r--r--ext/mbstring/tests/mb_ereg_variation7.phpt32
-rw-r--r--ext/mbstring/tests/mb_get_info.phpt87
-rw-r--r--ext/mbstring/tests/mb_http_input.phpt18
-rw-r--r--ext/mbstring/tests/mb_http_output.phpt18
-rw-r--r--ext/mbstring/tests/mb_internal_encoding.phpt18
-rw-r--r--ext/mbstring/tests/mb_internal_encoding_ini_basic2.phpt2
-rw-r--r--ext/mbstring/tests/mb_internal_encoding_variation2.phpt10
-rw-r--r--ext/mbstring/tests/mb_ord.phpt12
-rw-r--r--ext/mbstring/tests/mb_parse_str.phpt45
-rw-r--r--ext/mbstring/tests/mb_parse_str02.phpt58
-rw-r--r--ext/mbstring/tests/mb_regex_encoding_variation2.phpt10
-rw-r--r--ext/mbstring/tests/mb_regex_set_options.phpt8
-rw-r--r--ext/mbstring/tests/mb_send_mail01.phpt4
-rw-r--r--ext/mbstring/tests/mb_send_mail02.phpt4
-rw-r--r--ext/mbstring/tests/mb_send_mail03.phpt4
-rw-r--r--ext/mbstring/tests/mb_send_mail04.phpt4
-rw-r--r--ext/mbstring/tests/mb_send_mail05.phpt4
-rw-r--r--ext/mbstring/tests/mb_send_mail06.phpt4
-rw-r--r--ext/mbstring/tests/mb_send_mail07.phpt4
-rw-r--r--ext/mbstring/tests/mb_split-compat-01.phpt6
-rw-r--r--ext/mbstring/tests/mb_split.phpt42
-rw-r--r--ext/mbstring/tests/mb_str_functions_opt-parameter.phpt2
-rw-r--r--ext/mbstring/tests/mb_str_split_utf8_utf16.phpt20
-rw-r--r--ext/mbstring/tests/mb_str_unknown_encoding.phpt2
-rw-r--r--ext/mbstring/tests/mb_stripos.phpt82
-rw-r--r--ext/mbstring/tests/mb_stripos_empty_needle.phpt94
-rw-r--r--ext/mbstring/tests/mb_stripos_invalid_offset.phpt93
-rw-r--r--ext/mbstring/tests/mb_stripos_variation5_Bug45923.phpt62
-rw-r--r--ext/mbstring/tests/mb_stristr_basic.phpt2
-rw-r--r--ext/mbstring/tests/mb_stristr_empty_needle.phpt37
-rw-r--r--ext/mbstring/tests/mb_stristr_error2.phpt2
-rw-r--r--ext/mbstring/tests/mb_stristr_variation5.phpt2
-rw-r--r--ext/mbstring/tests/mb_strlen.phpt16
-rw-r--r--ext/mbstring/tests/mb_strlen_variation3.phpt32
-rw-r--r--ext/mbstring/tests/mb_strpos.phpt114
-rw-r--r--ext/mbstring/tests/mb_strpos_empty_needle.phpt93
-rw-r--r--ext/mbstring/tests/mb_strpos_invalid_offset.phpt93
-rw-r--r--ext/mbstring/tests/mb_strpos_offset_errors.phpt56
-rw-r--r--ext/mbstring/tests/mb_strpos_variation5.phpt64
-rw-r--r--ext/mbstring/tests/mb_strrchr_basic.phpt2
-rw-r--r--ext/mbstring/tests/mb_strrchr_empty_needle.phpt37
-rw-r--r--ext/mbstring/tests/mb_strrchr_error2.phpt2
-rw-r--r--ext/mbstring/tests/mb_strrchr_variation5.phpt2
-rw-r--r--ext/mbstring/tests/mb_strrchr_variation6.phpt2
-rw-r--r--ext/mbstring/tests/mb_strrichr_basic.phpt2
-rw-r--r--ext/mbstring/tests/mb_strrichr_error2.phpt2
-rw-r--r--ext/mbstring/tests/mb_strrichr_variation5.phpt2
-rw-r--r--ext/mbstring/tests/mb_strripos_empty_needle.phpt94
-rw-r--r--ext/mbstring/tests/mb_strripos_variation5_Bug45923.phpt55
-rw-r--r--ext/mbstring/tests/mb_strrpos_empty_needle.phpt94
-rw-r--r--ext/mbstring/tests/mb_strrpos_encoding_3rd_param.phpt14
-rw-r--r--ext/mbstring/tests/mb_strrpos_variation5.phpt73
-rw-r--r--ext/mbstring/tests/mb_strstr.phpt4
-rw-r--r--ext/mbstring/tests/mb_strstr_basic.phpt2
-rw-r--r--ext/mbstring/tests/mb_strstr_empty_needle.phpt37
-rw-r--r--ext/mbstring/tests/mb_strstr_error2.phpt2
-rw-r--r--ext/mbstring/tests/mb_strstr_variation5.phpt2
-rw-r--r--ext/mbstring/tests/mb_strstr_variation6.phpt2
-rw-r--r--ext/mbstring/tests/mb_strtolower_basic.phpt8
-rw-r--r--ext/mbstring/tests/mb_strtolower_error2.phpt2
-rw-r--r--ext/mbstring/tests/mb_strtolower_variation3.phpt8
-rw-r--r--ext/mbstring/tests/mb_strtolower_variation4.phpt16
-rw-r--r--ext/mbstring/tests/mb_strtoupper_basic.phpt8
-rw-r--r--ext/mbstring/tests/mb_strtoupper_variation3.phpt8
-rw-r--r--ext/mbstring/tests/mb_strtoupper_variation4.phpt16
-rw-r--r--ext/mbstring/tests/mb_substitute_character_basic.phpt2
-rw-r--r--ext/mbstring/tests/mb_substitute_character_variation1.phpt18
-rw-r--r--ext/mbstring/tests/mb_substitute_character_variation2.phpt2
-rw-r--r--ext/mbstring/tests/mb_substr.phpt1
-rw-r--r--ext/mbstring/tests/mb_substr_count.phpt38
-rw-r--r--ext/mbstring/tests/mb_substr_variation4.phpt30
-rw-r--r--ext/mbstring/tests/mb_substr_variation5.phpt30
-rw-r--r--ext/mbstring/tests/mb_substr_variation6.phpt40
-rw-r--r--ext/mbstring/tests/mb_substr_variation7.phpt40
-rw-r--r--ext/mbstring/tests/overload01.phpt23
-rw-r--r--ext/mbstring/tests/overload02.phpt34
-rw-r--r--ext/mbstring/tests/zend_multibyte-01.phpt10
-rw-r--r--ext/mbstring/tests/zend_multibyte-11.phpt4
-rw-r--r--ext/mbstring/tests/zend_multibyte-15.phpt4
-rw-r--r--ext/mbstring/tests/zend_multibyte-16.phpt2
-rw-r--r--ext/mysqli/config.m42
-rw-r--r--ext/mysqli/mysqli.c93
-rw-r--r--ext/mysqli/mysqli_api.c178
-rw-r--r--ext/mysqli/mysqli_driver.c2
-rw-r--r--ext/mysqli/mysqli_exception.c2
-rw-r--r--ext/mysqli/mysqli_fe.c162
-rw-r--r--ext/mysqli/mysqli_fe.h2
-rw-r--r--ext/mysqli/mysqli_libmysql.h2
-rw-r--r--ext/mysqli/mysqli_mysqlnd.h2
-rw-r--r--ext/mysqli/mysqli_nonapi.c76
-rw-r--r--ext/mysqli/mysqli_priv.h2
-rw-r--r--ext/mysqli/mysqli_prop.c14
-rw-r--r--ext/mysqli/mysqli_report.c4
-rw-r--r--ext/mysqli/mysqli_result_iterator.c2
-rw-r--r--ext/mysqli/mysqli_warning.c17
-rw-r--r--ext/mysqli/php_mysqli.h2
-rw-r--r--ext/mysqli/php_mysqli_structs.h31
-rw-r--r--ext/mysqli/tests/001.phpt94
-rw-r--r--ext/mysqli/tests/002.phpt56
-rw-r--r--ext/mysqli/tests/003.phpt106
-rw-r--r--ext/mysqli/tests/004.phpt62
-rw-r--r--ext/mysqli/tests/005.phpt44
-rw-r--r--ext/mysqli/tests/006.phpt56
-rw-r--r--ext/mysqli/tests/007.phpt56
-rw-r--r--ext/mysqli/tests/008.phpt56
-rw-r--r--ext/mysqli/tests/009.phpt132
-rw-r--r--ext/mysqli/tests/010.phpt56
-rw-r--r--ext/mysqli/tests/011.phpt54
-rw-r--r--ext/mysqli/tests/012.phpt52
-rw-r--r--ext/mysqli/tests/013.phpt78
-rw-r--r--ext/mysqli/tests/014.phpt80
-rw-r--r--ext/mysqli/tests/015.phpt90
-rw-r--r--ext/mysqli/tests/016.phpt28
-rw-r--r--ext/mysqli/tests/017.phpt32
-rw-r--r--ext/mysqli/tests/018.phpt26
-rw-r--r--ext/mysqli/tests/019.phpt68
-rw-r--r--ext/mysqli/tests/020.phpt88
-rw-r--r--ext/mysqli/tests/021.phpt44
-rw-r--r--ext/mysqli/tests/022.phpt46
-rw-r--r--ext/mysqli/tests/023.phpt68
-rw-r--r--ext/mysqli/tests/024.phpt68
-rw-r--r--ext/mysqli/tests/025.phpt72
-rw-r--r--ext/mysqli/tests/026.phpt50
-rw-r--r--ext/mysqli/tests/027.phpt14
-rw-r--r--ext/mysqli/tests/028.phpt14
-rw-r--r--ext/mysqli/tests/029.phpt24
-rw-r--r--ext/mysqli/tests/030.phpt22
-rw-r--r--ext/mysqli/tests/031.phpt22
-rw-r--r--ext/mysqli/tests/032.phpt24
-rw-r--r--ext/mysqli/tests/033.phpt14
-rw-r--r--ext/mysqli/tests/034.phpt14
-rw-r--r--ext/mysqli/tests/035.phpt14
-rw-r--r--ext/mysqli/tests/036.phpt44
-rw-r--r--ext/mysqli/tests/037.phpt28
-rw-r--r--ext/mysqli/tests/038.phpt32
-rw-r--r--ext/mysqli/tests/039.phpt24
-rw-r--r--ext/mysqli/tests/040.phpt34
-rw-r--r--ext/mysqli/tests/041.phpt18
-rw-r--r--ext/mysqli/tests/042.phpt62
-rw-r--r--ext/mysqli/tests/043.phpt44
-rw-r--r--ext/mysqli/tests/044.phpt16
-rw-r--r--ext/mysqli/tests/045.phpt24
-rw-r--r--ext/mysqli/tests/046.phpt34
-rw-r--r--ext/mysqli/tests/047.phpt50
-rw-r--r--ext/mysqli/tests/048.phpt46
-rw-r--r--ext/mysqli/tests/049.phpt24
-rw-r--r--ext/mysqli/tests/050.phpt18
-rw-r--r--ext/mysqli/tests/051.phpt20
-rw-r--r--ext/mysqli/tests/052.phpt20
-rw-r--r--ext/mysqli/tests/053.phpt16
-rw-r--r--ext/mysqli/tests/054.phpt18
-rw-r--r--ext/mysqli/tests/055.phpt16
-rw-r--r--ext/mysqli/tests/056.phpt20
-rw-r--r--ext/mysqli/tests/057.phpt82
-rw-r--r--ext/mysqli/tests/058.phpt50
-rw-r--r--ext/mysqli/tests/059.phpt40
-rw-r--r--ext/mysqli/tests/060.phpt50
-rw-r--r--ext/mysqli/tests/061.phpt62
-rw-r--r--ext/mysqli/tests/062.phpt18
-rw-r--r--ext/mysqli/tests/063.phpt18
-rw-r--r--ext/mysqli/tests/064.phpt18
-rw-r--r--ext/mysqli/tests/065.phpt54
-rw-r--r--ext/mysqli/tests/066.phpt30
-rw-r--r--ext/mysqli/tests/067.phpt70
-rw-r--r--ext/mysqli/tests/068.phpt4
-rw-r--r--ext/mysqli/tests/069.phpt34
-rw-r--r--ext/mysqli/tests/070.phpt10
-rw-r--r--ext/mysqli/tests/071.phpt94
-rw-r--r--ext/mysqli/tests/072.phpt20
-rw-r--r--ext/mysqli/tests/073.phpt16
-rw-r--r--ext/mysqli/tests/074.phpt16
-rw-r--r--ext/mysqli/tests/bug28817.phpt38
-rw-r--r--ext/mysqli/tests/bug29311.phpt78
-rw-r--r--ext/mysqli/tests/bug30967.phpt18
-rw-r--r--ext/mysqli/tests/bug31141.phpt12
-rw-r--r--ext/mysqli/tests/bug31668.phpt52
-rw-r--r--ext/mysqli/tests/bug32405.phpt36
-rw-r--r--ext/mysqli/tests/bug33090.phpt18
-rw-r--r--ext/mysqli/tests/bug33263.phpt38
-rw-r--r--ext/mysqli/tests/bug34785.phpt56
-rw-r--r--ext/mysqli/tests/bug34810.phpt48
-rw-r--r--ext/mysqli/tests/bug35103.phpt62
-rw-r--r--ext/mysqli/tests/bug35517.phpt46
-rw-r--r--ext/mysqli/tests/bug35759.phpt86
-rw-r--r--ext/mysqli/tests/bug36420.phpt17
-rw-r--r--ext/mysqli/tests/bug36745.phpt18
-rw-r--r--ext/mysqli/tests/bug36802.phpt58
-rw-r--r--ext/mysqli/tests/bug36949.phpt52
-rw-r--r--ext/mysqli/tests/bug37090.phpt22
-rw-r--r--ext/mysqli/tests/bug38710.phpt2
-rw-r--r--ext/mysqli/tests/bug39457.phpt12
-rw-r--r--ext/mysqli/tests/bug42378.phpt338
-rw-r--r--ext/mysqli/tests/bug42548.phpt34
-rw-r--r--ext/mysqli/tests/bug44897.phpt68
-rw-r--r--ext/mysqli/tests/bug45019.phpt70
-rw-r--r--ext/mysqli/tests/bug45289.phpt38
-rw-r--r--ext/mysqli/tests/bug46109.phpt10
-rw-r--r--ext/mysqli/tests/bug46614.phpt12
-rw-r--r--ext/mysqli/tests/bug47050.phpt24
-rw-r--r--ext/mysqli/tests/bug48909.phpt46
-rw-r--r--ext/mysqli/tests/bug49027.phpt54
-rw-r--r--ext/mysqli/tests/bug49442.phpt162
-rw-r--r--ext/mysqli/tests/bug50772.phpt38
-rw-r--r--ext/mysqli/tests/bug51605.phpt40
-rw-r--r--ext/mysqli/tests/bug51647.phpt126
-rw-r--r--ext/mysqli/tests/bug52082.phpt24
-rw-r--r--ext/mysqli/tests/bug52891.phpt122
-rw-r--r--ext/mysqli/tests/bug53503.phpt42
-rw-r--r--ext/mysqli/tests/bug54221.phpt44
-rw-r--r--ext/mysqli/tests/bug54674.phpt20
-rw-r--r--ext/mysqli/tests/bug55283.phpt34
-rw-r--r--ext/mysqli/tests/bug55582.phpt26
-rw-r--r--ext/mysqli/tests/bug55653.phpt34
-rw-r--r--ext/mysqli/tests/bug62046.phpt52
-rw-r--r--ext/mysqli/tests/bug63398.phpt16
-rw-r--r--ext/mysqli/tests/bug66043.phpt2
-rw-r--r--ext/mysqli/tests/bug66124.phpt26
-rw-r--r--ext/mysqli/tests/bug66762.phpt16
-rw-r--r--ext/mysqli/tests/bug67839.phpt76
-rw-r--r--ext/mysqli/tests/bug68077.phpt58
-rw-r--r--ext/mysqli/tests/bug69899.phpt6
-rw-r--r--ext/mysqli/tests/bug70384.phpt62
-rw-r--r--ext/mysqli/tests/bug70949.phpt30
-rw-r--r--ext/mysqli/tests/bug72701.phpt4
-rw-r--r--ext/mysqli/tests/bug73462.phpt49
-rw-r--r--ext/mysqli/tests/bug74547.phpt16
-rw-r--r--ext/mysqli/tests/bug74737.phpt2
-rw-r--r--ext/mysqli/tests/bug74968.phpt12
-rw-r--r--ext/mysqli/tests/bug75018.phpt4
-rw-r--r--ext/mysqli/tests/bug75434.phpt2
-rw-r--r--ext/mysqli/tests/bug75448.phpt14
-rw-r--r--ext/mysqli/tests/bug77956.phpt44
-rw-r--r--ext/mysqli/tests/bug_bits.phpt14
-rw-r--r--ext/mysqli/tests/bug_mysql_49406.phpt138
-rw-r--r--ext/mysqli/tests/clean_table.inc6
-rw-r--r--ext/mysqli/tests/connect.inc296
-rw-r--r--ext/mysqli/tests/gracefull_fail_on_empty_result_set.phpt14
-rw-r--r--ext/mysqli/tests/local_infile_tools.inc288
-rw-r--r--ext/mysqli/tests/mysqli_affected_rows.phpt166
-rw-r--r--ext/mysqli/tests/mysqli_affected_rows_oo.phpt142
-rw-r--r--ext/mysqli/tests/mysqli_auth_pam.phpt36
-rw-r--r--ext/mysqli/tests/mysqli_autocommit.phpt175
-rw-r--r--ext/mysqli/tests/mysqli_autocommit_oo.phpt162
-rw-r--r--ext/mysqli/tests/mysqli_begin_transaction.phpt175
-rw-r--r--ext/mysqli/tests/mysqli_change_user.phpt220
-rw-r--r--ext/mysqli/tests/mysqli_change_user_get_lock.phpt116
-rw-r--r--ext/mysqli/tests/mysqli_change_user_insert_id.phpt62
-rw-r--r--ext/mysqli/tests/mysqli_change_user_locks_temporary.phpt126
-rw-r--r--ext/mysqli/tests/mysqli_change_user_new.phpt28
-rw-r--r--ext/mysqli/tests/mysqli_change_user_old.phpt136
-rw-r--r--ext/mysqli/tests/mysqli_change_user_oo.phpt88
-rw-r--r--ext/mysqli/tests/mysqli_change_user_prepared_statements.phpt30
-rw-r--r--ext/mysqli/tests/mysqli_change_user_rollback.phpt66
-rw-r--r--ext/mysqli/tests/mysqli_change_user_set_names.phpt258
-rw-r--r--ext/mysqli/tests/mysqli_character_set.phpt172
-rw-r--r--ext/mysqli/tests/mysqli_character_set_name.phpt113
-rw-r--r--ext/mysqli/tests/mysqli_character_set_name_oo.phpt97
-rw-r--r--ext/mysqli/tests/mysqli_class_mysqli_driver_interface.phpt148
-rw-r--r--ext/mysqli/tests/mysqli_class_mysqli_driver_reflection.phpt8
-rw-r--r--ext/mysqli/tests/mysqli_class_mysqli_interface.phpt502
-rw-r--r--ext/mysqli/tests/mysqli_class_mysqli_properties_no_conn.phpt574
-rw-r--r--ext/mysqli/tests/mysqli_class_mysqli_reflection.phpt130
-rw-r--r--ext/mysqli/tests/mysqli_class_mysqli_result_interface.phpt289
-rw-r--r--ext/mysqli/tests/mysqli_class_mysqli_result_reflection.phpt20
-rw-r--r--ext/mysqli/tests/mysqli_class_mysqli_stmt_interface.phpt183
-rw-r--r--ext/mysqli/tests/mysqli_class_mysqli_warning.phpt164
-rw-r--r--ext/mysqli/tests/mysqli_class_mysqli_warning_reflection.phpt8
-rw-r--r--ext/mysqli/tests/mysqli_close.phpt38
-rw-r--r--ext/mysqli/tests/mysqli_close_oo.phpt39
-rw-r--r--ext/mysqli/tests/mysqli_commit.phpt74
-rw-r--r--ext/mysqli/tests/mysqli_commit_oo.phpt168
-rw-r--r--ext/mysqli/tests/mysqli_connect.phpt274
-rw-r--r--ext/mysqli/tests/mysqli_connect_attr.phpt10
-rw-r--r--ext/mysqli/tests/mysqli_connect_errno.phpt42
-rw-r--r--ext/mysqli/tests/mysqli_connect_error.phpt40
-rw-r--r--ext/mysqli/tests/mysqli_connect_oo.phpt278
-rw-r--r--ext/mysqli/tests/mysqli_connect_oo_defaults.phpt294
-rw-r--r--ext/mysqli/tests/mysqli_connect_oo_warnings.phpt56
-rw-r--r--ext/mysqli/tests/mysqli_connect_twice.phpt86
-rw-r--r--ext/mysqli/tests/mysqli_constants.phpt456
-rw-r--r--ext/mysqli/tests/mysqli_constants_categories.phpt20
-rw-r--r--ext/mysqli/tests/mysqli_data_seek.phpt74
-rw-r--r--ext/mysqli/tests/mysqli_data_seek_oo.phpt92
-rw-r--r--ext/mysqli/tests/mysqli_debug.phpt65
-rw-r--r--ext/mysqli/tests/mysqli_debug_append.phpt128
-rw-r--r--ext/mysqli/tests/mysqli_debug_control_string.phpt88
-rw-r--r--ext/mysqli/tests/mysqli_debug_ini.phpt28
-rw-r--r--ext/mysqli/tests/mysqli_debug_mysqlnd_control_string.phpt400
-rw-r--r--ext/mysqli/tests/mysqli_debug_mysqlnd_only.phpt204
-rw-r--r--ext/mysqli/tests/mysqli_disable_reads_from_master.phpt36
-rw-r--r--ext/mysqli/tests/mysqli_driver.phpt200
-rw-r--r--ext/mysqli/tests/mysqli_driver_unclonable.phpt6
-rw-r--r--ext/mysqli/tests/mysqli_dump_debug_info.phpt57
-rw-r--r--ext/mysqli/tests/mysqli_dump_debug_info_oo.phpt38
-rw-r--r--ext/mysqli/tests/mysqli_embedded_connect.phpt26
-rw-r--r--ext/mysqli/tests/mysqli_enable_reads_from_master.phpt40
-rw-r--r--ext/mysqli/tests/mysqli_errno.phpt49
-rw-r--r--ext/mysqli/tests/mysqli_errno_oo.phpt50
-rw-r--r--ext/mysqli/tests/mysqli_error.phpt54
-rw-r--r--ext/mysqli/tests/mysqli_error_oo.phpt53
-rw-r--r--ext/mysqli/tests/mysqli_error_unicode.phpt48
-rw-r--r--ext/mysqli/tests/mysqli_expire_password.phpt130
-rw-r--r--ext/mysqli/tests/mysqli_explain_metadata.phpt254
-rw-r--r--ext/mysqli/tests/mysqli_fetch_all.phpt613
-rw-r--r--ext/mysqli/tests/mysqli_fetch_all_oo.phpt588
-rw-r--r--ext/mysqli/tests/mysqli_fetch_array.phpt564
-rw-r--r--ext/mysqli/tests/mysqli_fetch_array_assoc.phpt30
-rw-r--r--ext/mysqli/tests/mysqli_fetch_array_large.phpt298
-rw-r--r--ext/mysqli/tests/mysqli_fetch_array_many_rows.phpt196
-rw-r--r--ext/mysqli/tests/mysqli_fetch_array_oo.phpt540
-rw-r--r--ext/mysqli/tests/mysqli_fetch_assoc.phpt95
-rw-r--r--ext/mysqli/tests/mysqli_fetch_assoc_bit.phpt156
-rw-r--r--ext/mysqli/tests/mysqli_fetch_assoc_no_alias.phpt128
-rw-r--r--ext/mysqli/tests/mysqli_fetch_assoc_no_alias_utf8.phpt72
-rw-r--r--ext/mysqli/tests/mysqli_fetch_assoc_oo.phpt74
-rw-r--r--ext/mysqli/tests/mysqli_fetch_assoc_zerofill.phpt100
-rw-r--r--ext/mysqli/tests/mysqli_fetch_field.phpt144
-rw-r--r--ext/mysqli/tests/mysqli_fetch_field_direct.phpt44
-rw-r--r--ext/mysqli/tests/mysqli_fetch_field_direct_oo.phpt62
-rw-r--r--ext/mysqli/tests/mysqli_fetch_field_flags.phpt394
-rw-r--r--ext/mysqli/tests/mysqli_fetch_field_oo.phpt94
-rw-r--r--ext/mysqli/tests/mysqli_fetch_field_types.phpt190
-rw-r--r--ext/mysqli/tests/mysqli_fetch_fields.phpt84
-rw-r--r--ext/mysqli/tests/mysqli_fetch_lengths.phpt50
-rw-r--r--ext/mysqli/tests/mysqli_fetch_lengths_oo.phpt40
-rw-r--r--ext/mysqli/tests/mysqli_fetch_object.phpt264
-rw-r--r--ext/mysqli/tests/mysqli_fetch_object_no_constructor.phpt52
-rw-r--r--ext/mysqli/tests/mysqli_fetch_object_no_object.phpt16
-rw-r--r--ext/mysqli/tests/mysqli_fetch_object_oo.phpt244
-rw-r--r--ext/mysqli/tests/mysqli_fetch_row.phpt45
-rw-r--r--ext/mysqli/tests/mysqli_field_count.phpt58
-rw-r--r--ext/mysqli/tests/mysqli_field_seek.phpt162
-rw-r--r--ext/mysqli/tests/mysqli_field_tell.phpt65
-rw-r--r--ext/mysqli/tests/mysqli_fork.phpt400
-rw-r--r--ext/mysqli/tests/mysqli_free_result.phpt77
-rw-r--r--ext/mysqli/tests/mysqli_get_charset.phpt185
-rw-r--r--ext/mysqli/tests/mysqli_get_client_info.phpt8
-rw-r--r--ext/mysqli/tests/mysqli_get_client_stats.phpt1634
-rw-r--r--ext/mysqli/tests/mysqli_get_client_stats_implicit_free.phpt30
-rw-r--r--ext/mysqli/tests/mysqli_get_client_stats_off.phpt42
-rw-r--r--ext/mysqli/tests/mysqli_get_client_stats_ps.phpt148
-rw-r--r--ext/mysqli/tests/mysqli_get_client_stats_skipped.phpt46
-rw-r--r--ext/mysqli/tests/mysqli_get_client_version.phpt6
-rw-r--r--ext/mysqli/tests/mysqli_get_connection_stats.phpt97
-rw-r--r--ext/mysqli/tests/mysqli_get_connection_stats_off.phpt58
-rw-r--r--ext/mysqli/tests/mysqli_get_host_info.phpt26
-rw-r--r--ext/mysqli/tests/mysqli_get_proto_info.phpt19
-rw-r--r--ext/mysqli/tests/mysqli_get_server_info.phpt19
-rw-r--r--ext/mysqli/tests/mysqli_get_server_version.phpt20
-rw-r--r--ext/mysqli/tests/mysqli_get_warnings.phpt184
-rw-r--r--ext/mysqli/tests/mysqli_info.phpt120
-rw-r--r--ext/mysqli/tests/mysqli_init.phpt16
-rw-r--r--ext/mysqli/tests/mysqli_insert_id.phpt242
-rw-r--r--ext/mysqli/tests/mysqli_insert_packet_overflow.phpt130
-rw-r--r--ext/mysqli/tests/mysqli_kill.phpt105
-rw-r--r--ext/mysqli/tests/mysqli_last_insert_id.phpt332
-rw-r--r--ext/mysqli/tests/mysqli_max_links.phpt62
-rw-r--r--ext/mysqli/tests/mysqli_more_results.phpt89
-rw-r--r--ext/mysqli/tests/mysqli_multi_query.phpt161
-rw-r--r--ext/mysqli/tests/mysqli_mysqlnd_read_timeout.phpt16
-rw-r--r--ext/mysqli/tests/mysqli_mysqlnd_read_timeout_long.phpt22
-rw-r--r--ext/mysqli/tests/mysqli_mysqlnd_read_timeout_zero.phpt20
-rw-r--r--ext/mysqli/tests/mysqli_next_result.phpt87
-rw-r--r--ext/mysqli/tests/mysqli_no_reconnect.phpt224
-rw-r--r--ext/mysqli/tests/mysqli_num_fields.phpt61
-rw-r--r--ext/mysqli/tests/mysqli_num_rows.phpt99
-rw-r--r--ext/mysqli/tests/mysqli_open_bug74432.phpt18
-rw-r--r--ext/mysqli/tests/mysqli_options.phpt195
-rw-r--r--ext/mysqli/tests/mysqli_options_init_command.phpt82
-rw-r--r--ext/mysqli/tests/mysqli_options_int_and_float_native.phpt176
-rw-r--r--ext/mysqli/tests/mysqli_options_openbasedir.phpt10
-rw-r--r--ext/mysqli/tests/mysqli_pam_sha256.phpt34
-rw-r--r--ext/mysqli/tests/mysqli_pam_sha256_public_key_ini.phpt30
-rw-r--r--ext/mysqli/tests/mysqli_pam_sha256_public_key_option.phpt44
-rw-r--r--ext/mysqli/tests/mysqli_pam_sha256_public_key_option_invalid.phpt150
-rw-r--r--ext/mysqli/tests/mysqli_pconn_conn_multiple.phpt172
-rw-r--r--ext/mysqli/tests/mysqli_pconn_disabled.phpt76
-rw-r--r--ext/mysqli/tests/mysqli_pconn_kill.phpt153
-rw-r--r--ext/mysqli/tests/mysqli_pconn_limits.phpt112
-rw-r--r--ext/mysqli/tests/mysqli_pconn_max_links.phpt267
-rw-r--r--ext/mysqli/tests/mysqli_pconn_reuse.phpt132
-rw-r--r--ext/mysqli/tests/mysqli_pconn_twice.phpt68
-rw-r--r--ext/mysqli/tests/mysqli_pconnect.phpt102
-rw-r--r--ext/mysqli/tests/mysqli_phpinfo.phpt72
-rw-r--r--ext/mysqli/tests/mysqli_ping.phpt45
-rw-r--r--ext/mysqli/tests/mysqli_poll.phpt217
-rw-r--r--ext/mysqli/tests/mysqli_poll_kill.phpt338
-rw-r--r--ext/mysqli/tests/mysqli_poll_mixing_insert_select.phpt288
-rw-r--r--ext/mysqli/tests/mysqli_poll_reference.phpt358
-rw-r--r--ext/mysqli/tests/mysqli_prepare.phpt146
-rw-r--r--ext/mysqli/tests/mysqli_prepare_no_object.phpt36
-rw-r--r--ext/mysqli/tests/mysqli_ps_select_union.phpt484
-rw-r--r--ext/mysqli/tests/mysqli_query.phpt146
-rw-r--r--ext/mysqli/tests/mysqli_query_iterators.phpt104
-rw-r--r--ext/mysqli/tests/mysqli_query_stored_proc.phpt264
-rw-r--r--ext/mysqli/tests/mysqli_query_unicode.phpt114
-rw-r--r--ext/mysqli/tests/mysqli_real_connect.phpt301
-rw-r--r--ext/mysqli/tests/mysqli_real_connect_pconn.phpt262
-rw-r--r--ext/mysqli/tests/mysqli_real_escape_string.phpt59
-rw-r--r--ext/mysqli/tests/mysqli_real_escape_string_big5.phpt52
-rw-r--r--ext/mysqli/tests/mysqli_real_escape_string_eucjpms.phpt50
-rw-r--r--ext/mysqli/tests/mysqli_real_escape_string_euckr.phpt52
-rw-r--r--ext/mysqli/tests/mysqli_real_escape_string_gb2312.phpt52
-rw-r--r--ext/mysqli/tests/mysqli_real_escape_string_gbk.phpt52
-rw-r--r--ext/mysqli/tests/mysqli_real_escape_string_nobackslash.phpt66
-rw-r--r--ext/mysqli/tests/mysqli_real_escape_string_sjis.phpt36
-rw-r--r--ext/mysqli/tests/mysqli_real_escape_string_unicode.phpt99
-rw-r--r--ext/mysqli/tests/mysqli_real_query.phpt136
-rw-r--r--ext/mysqli/tests/mysqli_reap_async_query.phpt138
-rw-r--r--ext/mysqli/tests/mysqli_reconnect.phpt220
-rw-r--r--ext/mysqli/tests/mysqli_release_savepoint.phpt73
-rw-r--r--ext/mysqli/tests/mysqli_report.phpt505
-rw-r--r--ext/mysqli/tests/mysqli_report_new.phpt30
-rw-r--r--ext/mysqli/tests/mysqli_report_wo_ps.phpt118
-rw-r--r--ext/mysqli/tests/mysqli_result_invalid_mode.phpt18
-rw-r--r--ext/mysqli/tests/mysqli_result_references.phpt109
-rw-r--r--ext/mysqli/tests/mysqli_result_references_mysqlnd.phpt64
-rw-r--r--ext/mysqli/tests/mysqli_result_unclonable.phpt16
-rw-r--r--ext/mysqli/tests/mysqli_rollback.phpt73
-rw-r--r--ext/mysqli/tests/mysqli_savepoint.phpt59
-rw-r--r--ext/mysqli/tests/mysqli_select_db.phpt141
-rw-r--r--ext/mysqli/tests/mysqli_send_query.phpt48
-rw-r--r--ext/mysqli/tests/mysqli_set_charset.phpt143
-rw-r--r--ext/mysqli/tests/mysqli_set_opt.phpt74
-rw-r--r--ext/mysqli/tests/mysqli_sqlstate.phpt40
-rw-r--r--ext/mysqli/tests/mysqli_ssl_set.phpt59
-rw-r--r--ext/mysqli/tests/mysqli_stat.phpt37
-rw-r--r--ext/mysqli/tests/mysqli_stmt_affected_rows.phpt337
-rw-r--r--ext/mysqli/tests/mysqli_stmt_attr_get.phpt79
-rw-r--r--ext/mysqli/tests/mysqli_stmt_attr_get_prefetch.phpt20
-rw-r--r--ext/mysqli/tests/mysqli_stmt_attr_set.phpt509
-rw-r--r--ext/mysqli/tests/mysqli_stmt_big_prepare.phpt44
-rw-r--r--ext/mysqli/tests/mysqli_stmt_bind_limits.phpt204
-rw-r--r--ext/mysqli/tests/mysqli_stmt_bind_param.phpt728
-rw-r--r--ext/mysqli/tests/mysqli_stmt_bind_param_call_user_func.phpt630
-rw-r--r--ext/mysqli/tests/mysqli_stmt_bind_param_check_param_no_change.phpt92
-rw-r--r--ext/mysqli/tests/mysqli_stmt_bind_param_many_columns.phpt138
-rw-r--r--ext/mysqli/tests/mysqli_stmt_bind_param_references.phpt380
-rw-r--r--ext/mysqli/tests/mysqli_stmt_bind_param_type_juggling.phpt204
-rw-r--r--ext/mysqli/tests/mysqli_stmt_bind_result.phpt598
-rw-r--r--ext/mysqli/tests/mysqli_stmt_bind_result_bit.phpt284
-rw-r--r--ext/mysqli/tests/mysqli_stmt_bind_result_format.phpt616
-rw-r--r--ext/mysqli/tests/mysqli_stmt_bind_result_references.phpt454
-rw-r--r--ext/mysqli/tests/mysqli_stmt_bind_result_zerofill.phpt130
-rw-r--r--ext/mysqli/tests/mysqli_stmt_close.phpt105
-rw-r--r--ext/mysqli/tests/mysqli_stmt_data_seek.phpt101
-rw-r--r--ext/mysqli/tests/mysqli_stmt_datatype_change.phpt82
-rw-r--r--ext/mysqli/tests/mysqli_stmt_errno.phpt72
-rw-r--r--ext/mysqli/tests/mysqli_stmt_error.phpt72
-rw-r--r--ext/mysqli/tests/mysqli_stmt_execute.phpt184
-rw-r--r--ext/mysqli/tests/mysqli_stmt_execute_stored_proc.phpt240
-rw-r--r--ext/mysqli/tests/mysqli_stmt_execute_stored_proc_next_result.phpt144
-rw-r--r--ext/mysqli/tests/mysqli_stmt_execute_stored_proc_out.phpt62
-rw-r--r--ext/mysqli/tests/mysqli_stmt_fetch.phpt114
-rw-r--r--ext/mysqli/tests/mysqli_stmt_fetch_bit.phpt80
-rw-r--r--ext/mysqli/tests/mysqli_stmt_fetch_fields_win32_unicode.phpt68
-rw-r--r--ext/mysqli/tests/mysqli_stmt_fetch_geom.phpt244
-rw-r--r--ext/mysqli/tests/mysqli_stmt_field_count.phpt165
-rw-r--r--ext/mysqli/tests/mysqli_stmt_free_result.phpt99
-rw-r--r--ext/mysqli/tests/mysqli_stmt_get_result.phpt225
-rw-r--r--ext/mysqli/tests/mysqli_stmt_get_result2.phpt274
-rw-r--r--ext/mysqli/tests/mysqli_stmt_get_result_bit.phpt208
-rw-r--r--ext/mysqli/tests/mysqli_stmt_get_result_field_count.phpt44
-rw-r--r--ext/mysqli/tests/mysqli_stmt_get_result_geom.phpt242
-rw-r--r--ext/mysqli/tests/mysqli_stmt_get_result_metadata.phpt406
-rw-r--r--ext/mysqli/tests/mysqli_stmt_get_result_metadata_fetch_field.phpt84
-rw-r--r--ext/mysqli/tests/mysqli_stmt_get_result_non_select.phpt122
-rw-r--r--ext/mysqli/tests/mysqli_stmt_get_result_seek.phpt226
-rw-r--r--ext/mysqli/tests/mysqli_stmt_get_result_types.phpt474
-rw-r--r--ext/mysqli/tests/mysqli_stmt_get_warnings.phpt107
-rw-r--r--ext/mysqli/tests/mysqli_stmt_init.phpt61
-rw-r--r--ext/mysqli/tests/mysqli_stmt_insert_id.phpt96
-rw-r--r--ext/mysqli/tests/mysqli_stmt_multires.phpt160
-rw-r--r--ext/mysqli/tests/mysqli_stmt_num_rows.phpt195
-rw-r--r--ext/mysqli/tests/mysqli_stmt_param_count.phpt78
-rw-r--r--ext/mysqli/tests/mysqli_stmt_prepare.phpt55
-rw-r--r--ext/mysqli/tests/mysqli_stmt_reset.phpt137
-rw-r--r--ext/mysqli/tests/mysqli_stmt_result_metadata.phpt130
-rw-r--r--ext/mysqli/tests/mysqli_stmt_result_metadata_sqltests.phpt426
-rw-r--r--ext/mysqli/tests/mysqli_stmt_send_long_data.phpt162
-rw-r--r--ext/mysqli/tests/mysqli_stmt_send_long_data_packet_size_libmysql.phpt118
-rw-r--r--ext/mysqli/tests/mysqli_stmt_send_long_data_packet_size_mysqlnd.phpt114
-rw-r--r--ext/mysqli/tests/mysqli_stmt_sqlstate.phpt66
-rw-r--r--ext/mysqli/tests/mysqli_stmt_store_result.phpt142
-rw-r--r--ext/mysqli/tests/mysqli_stmt_unclonable.phpt18
-rw-r--r--ext/mysqli/tests/mysqli_store_result.phpt64
-rw-r--r--ext/mysqli/tests/mysqli_store_result_buffered_c.phpt28
-rw-r--r--ext/mysqli/tests/mysqli_store_result_copy.phpt350
-rw-r--r--ext/mysqli/tests/mysqli_thread_id.phpt38
-rw-r--r--ext/mysqli/tests/mysqli_thread_safe.phpt6
-rw-r--r--ext/mysqli/tests/mysqli_unclonable.phpt14
-rw-r--r--ext/mysqli/tests/mysqli_use_result.phpt65
-rw-r--r--ext/mysqli/tests/mysqli_warning_count.phpt45
-rw-r--r--ext/mysqli/tests/mysqli_warning_unclonable.phpt30
-rw-r--r--ext/mysqli/tests/reflection_tools.inc224
-rw-r--r--ext/mysqli/tests/skipif.inc2
-rw-r--r--ext/mysqli/tests/skipifconnectfailure.inc10
-rw-r--r--ext/mysqli/tests/skipifemb.inc6
-rw-r--r--ext/mysqli/tests/skipifnotemb.inc6
-rw-r--r--ext/mysqli/tests/table.inc20
-rw-r--r--ext/mysqlnd/mysql_float_to_double.h2
-rw-r--r--ext/mysqlnd/mysqlnd.h2
-rw-r--r--ext/mysqlnd/mysqlnd_alloc.c2
-rw-r--r--ext/mysqlnd/mysqlnd_alloc.h2
-rw-r--r--ext/mysqlnd/mysqlnd_auth.c2
-rw-r--r--ext/mysqlnd/mysqlnd_auth.h2
-rw-r--r--ext/mysqlnd/mysqlnd_block_alloc.c2
-rw-r--r--ext/mysqlnd/mysqlnd_block_alloc.h2
-rw-r--r--ext/mysqlnd/mysqlnd_charset.c2
-rw-r--r--ext/mysqlnd/mysqlnd_charset.h2
-rw-r--r--ext/mysqlnd/mysqlnd_commands.c2
-rw-r--r--ext/mysqlnd/mysqlnd_commands.h2
-rw-r--r--ext/mysqlnd/mysqlnd_connection.c4
-rw-r--r--ext/mysqlnd/mysqlnd_connection.h2
-rw-r--r--ext/mysqlnd/mysqlnd_debug.c2
-rw-r--r--ext/mysqlnd/mysqlnd_debug.h2
-rw-r--r--ext/mysqlnd/mysqlnd_driver.c2
-rw-r--r--ext/mysqlnd/mysqlnd_enum_n_def.h2
-rw-r--r--ext/mysqlnd/mysqlnd_ext_plugin.c2
-rw-r--r--ext/mysqlnd/mysqlnd_ext_plugin.h2
-rw-r--r--ext/mysqlnd/mysqlnd_libmysql_compat.h2
-rw-r--r--ext/mysqlnd/mysqlnd_loaddata.c2
-rw-r--r--ext/mysqlnd/mysqlnd_plugin.c2
-rw-r--r--ext/mysqlnd/mysqlnd_plugin.h2
-rw-r--r--ext/mysqlnd/mysqlnd_priv.h2
-rw-r--r--ext/mysqlnd/mysqlnd_protocol_frame_codec.c2
-rw-r--r--ext/mysqlnd/mysqlnd_protocol_frame_codec.h2
-rw-r--r--ext/mysqlnd/mysqlnd_ps.c2
-rw-r--r--ext/mysqlnd/mysqlnd_ps.h2
-rw-r--r--ext/mysqlnd/mysqlnd_ps_codec.c4
-rw-r--r--ext/mysqlnd/mysqlnd_read_buffer.c2
-rw-r--r--ext/mysqlnd/mysqlnd_read_buffer.h2
-rw-r--r--ext/mysqlnd/mysqlnd_result.c9
-rw-r--r--ext/mysqlnd/mysqlnd_result.h2
-rw-r--r--ext/mysqlnd/mysqlnd_result_meta.c2
-rw-r--r--ext/mysqlnd/mysqlnd_result_meta.h2
-rw-r--r--ext/mysqlnd/mysqlnd_reverse_api.c2
-rw-r--r--ext/mysqlnd/mysqlnd_reverse_api.h2
-rw-r--r--ext/mysqlnd/mysqlnd_statistics.c2
-rw-r--r--ext/mysqlnd/mysqlnd_statistics.h2
-rw-r--r--ext/mysqlnd/mysqlnd_structs.h2
-rw-r--r--ext/mysqlnd/mysqlnd_vio.c4
-rw-r--r--ext/mysqlnd/mysqlnd_vio.h2
-rw-r--r--ext/mysqlnd/mysqlnd_wireprotocol.c2
-rw-r--r--ext/mysqlnd/mysqlnd_wireprotocol.h2
-rw-r--r--ext/mysqlnd/php_mysqlnd.c2
-rw-r--r--ext/mysqlnd/php_mysqlnd.h2
-rw-r--r--ext/oci8/oci8.c4
-rw-r--r--ext/oci8/oci8_collection.c4
-rw-r--r--ext/oci8/oci8_failover.c2
-rw-r--r--ext/oci8/oci8_interface.c136
-rw-r--r--ext/oci8/oci8_lob.c2
-rw-r--r--ext/oci8/oci8_statement.c8
-rw-r--r--ext/oci8/package.xml2
-rw-r--r--ext/oci8/php_oci8.h2
-rw-r--r--ext/oci8/php_oci8_int.h10
-rw-r--r--ext/oci8/tests/array_bind_014.phpt4
-rw-r--r--ext/oci8/tests/b47243_1.phpt1
-rw-r--r--ext/oci8/tests/b47243_2.phpt1
-rw-r--r--ext/oci8/tests/b47243_3.phpt1
-rw-r--r--ext/oci8/tests/bind_boolean_1.phpt3
-rw-r--r--ext/oci8/tests/bind_char_1.phpt86
-rw-r--r--ext/oci8/tests/bind_char_1_11gR1.phpt86
-rw-r--r--ext/oci8/tests/bind_char_2.phpt46
-rw-r--r--ext/oci8/tests/bind_char_2_11gR1.phpt46
-rw-r--r--ext/oci8/tests/bind_char_3.phpt60
-rw-r--r--ext/oci8/tests/bind_char_3_11gR1.phpt60
-rw-r--r--ext/oci8/tests/bind_char_4.phpt60
-rw-r--r--ext/oci8/tests/bind_char_4_11gR1.phpt60
-rw-r--r--ext/oci8/tests/bind_empty.phpt3
-rw-r--r--ext/oci8/tests/bind_misccoltypes.phpt9
-rw-r--r--ext/oci8/tests/bind_misccoltypes_errs.phpt9
-rw-r--r--ext/oci8/tests/bind_number.phpt33
-rw-r--r--ext/oci8/tests/bind_query.phpt13
-rw-r--r--ext/oci8/tests/bind_rowid.phpt20
-rw-r--r--ext/oci8/tests/bind_sqltafc.phpt11
-rw-r--r--ext/oci8/tests/bind_sqltchr_1.phpt3
-rw-r--r--ext/oci8/tests/bind_sqltchr_2.phpt3
-rw-r--r--ext/oci8/tests/bind_sqltint.phpt7
-rw-r--r--ext/oci8/tests/bind_sqltnum.phpt7
-rw-r--r--ext/oci8/tests/bind_sqltnum_11g.phpt7
-rw-r--r--ext/oci8/tests/bind_unsupported_1.phpt3
-rw-r--r--ext/oci8/tests/bind_unsupported_2.phpt3
-rw-r--r--ext/oci8/tests/bind_unsupported_3.phpt3
-rw-r--r--ext/oci8/tests/bug27303_1.phpt6
-rw-r--r--ext/oci8/tests/bug27303_1_11gR1.phpt6
-rw-r--r--ext/oci8/tests/bug27303_2.phpt6
-rw-r--r--ext/oci8/tests/bug27303_2_11gR1.phpt6
-rw-r--r--ext/oci8/tests/bug27303_3.phpt14
-rw-r--r--ext/oci8/tests/bug27303_4.phpt6
-rw-r--r--ext/oci8/tests/bug27303_4_11gR1.phpt6
-rw-r--r--ext/oci8/tests/bug32325.phpt4
-rw-r--r--ext/oci8/tests/bug36010.phpt10
-rw-r--r--ext/oci8/tests/bug36096.phpt8
-rw-r--r--ext/oci8/tests/bug36403.phpt11
-rw-r--r--ext/oci8/tests/bug37220.phpt18
-rw-r--r--ext/oci8/tests/bug38173.phpt12
-rw-r--r--ext/oci8/tests/bug41069.phpt60
-rw-r--r--ext/oci8/tests/bug42134.phpt30
-rw-r--r--ext/oci8/tests/bug42173.phpt20
-rw-r--r--ext/oci8/tests/bug42496_1.phpt34
-rw-r--r--ext/oci8/tests/bug42496_2.phpt30
-rw-r--r--ext/oci8/tests/bug43497.phpt108
-rw-r--r--ext/oci8/tests/bug44008.phpt6
-rw-r--r--ext/oci8/tests/bug44113.phpt14
-rw-r--r--ext/oci8/tests/bug44206.phpt28
-rw-r--r--ext/oci8/tests/bug45458.phpt3
-rw-r--r--ext/oci8/tests/bug46994.phpt23
-rw-r--r--ext/oci8/tests/bug47189.phpt3
-rw-r--r--ext/oci8/tests/bug47281.phpt3
-rw-r--r--ext/oci8/tests/bug47281_tt.phpt3
-rw-r--r--ext/oci8/tests/bug51291_1.phpt3
-rw-r--r--ext/oci8/tests/bug51291_2.phpt3
-rw-r--r--ext/oci8/tests/bug68298.phpt7
-rw-r--r--ext/oci8/tests/bug71148.phpt3
-rw-r--r--ext/oci8/tests/bug71422.phpt17
-rw-r--r--ext/oci8/tests/bug71600.phpt3
-rw-r--r--ext/oci8/tests/bug72524.phpt3
-rw-r--r--ext/oci8/tests/bug74625.phpt3
-rw-r--r--ext/oci8/tests/calltimeout1.phpt3
-rw-r--r--ext/oci8/tests/clientversion.phpt3
-rw-r--r--ext/oci8/tests/coll_009.phpt4
-rw-r--r--ext/oci8/tests/coll_009_func.phpt4
-rw-r--r--ext/oci8/tests/coll_010.phpt4
-rw-r--r--ext/oci8/tests/coll_010_func.phpt4
-rw-r--r--ext/oci8/tests/coll_011.phpt4
-rw-r--r--ext/oci8/tests/coll_011_func.phpt4
-rw-r--r--ext/oci8/tests/coll_012.phpt4
-rw-r--r--ext/oci8/tests/coll_012_func.phpt4
-rw-r--r--ext/oci8/tests/coll_013.phpt4
-rw-r--r--ext/oci8/tests/coll_013_func.phpt4
-rw-r--r--ext/oci8/tests/coll_014.phpt4
-rw-r--r--ext/oci8/tests/coll_014_func.phpt4
-rw-r--r--ext/oci8/tests/coll_015.phpt4
-rw-r--r--ext/oci8/tests/coll_015_func.phpt4
-rw-r--r--ext/oci8/tests/coll_016.phpt4
-rw-r--r--ext/oci8/tests/coll_016_func.phpt4
-rw-r--r--ext/oci8/tests/coll_017.phpt4
-rw-r--r--ext/oci8/tests/coll_017_func.phpt4
-rw-r--r--ext/oci8/tests/commit_001.phpt22
-rw-r--r--ext/oci8/tests/commit_002.phpt9
-rw-r--r--ext/oci8/tests/commit_old.phpt16
-rw-r--r--ext/oci8/tests/conn_attr.inc70
-rw-r--r--ext/oci8/tests/conn_attr_1.phpt6
-rw-r--r--ext/oci8/tests/conn_attr_2.phpt16
-rw-r--r--ext/oci8/tests/conn_attr_4.phpt16
-rw-r--r--ext/oci8/tests/connect.phpt4
-rw-r--r--ext/oci8/tests/connect_1.phpt8
-rw-r--r--ext/oci8/tests/connect_1_old.phpt8
-rw-r--r--ext/oci8/tests/connect_old.phpt4
-rw-r--r--ext/oci8/tests/connect_scope1.phpt28
-rw-r--r--ext/oci8/tests/connect_scope2.phpt28
-rw-r--r--ext/oci8/tests/connect_scope_try1.phpt44
-rw-r--r--ext/oci8/tests/connect_scope_try2.phpt44
-rw-r--r--ext/oci8/tests/connect_scope_try3.phpt44
-rw-r--r--ext/oci8/tests/connect_scope_try4.phpt44
-rw-r--r--ext/oci8/tests/connect_scope_try5.phpt44
-rw-r--r--ext/oci8/tests/connect_scope_try6.phpt44
-rw-r--r--ext/oci8/tests/connect_without_oracle_home.phpt7
-rw-r--r--ext/oci8/tests/connect_without_oracle_home_11.phpt7
-rw-r--r--ext/oci8/tests/connect_without_oracle_home_old.phpt7
-rw-r--r--ext/oci8/tests/connect_without_oracle_home_old_11.phpt7
-rw-r--r--ext/oci8/tests/cursor_bind.phpt3
-rw-r--r--ext/oci8/tests/cursors.phpt24
-rw-r--r--ext/oci8/tests/cursors_old.phpt14
-rw-r--r--ext/oci8/tests/db_op_1.phpt3
-rw-r--r--ext/oci8/tests/db_op_2.phpt3
-rw-r--r--ext/oci8/tests/dbmsoutput.phpt33
-rw-r--r--ext/oci8/tests/debug.phpt4
-rw-r--r--ext/oci8/tests/default_prefetch0.phpt4
-rw-r--r--ext/oci8/tests/default_prefetch1.phpt4
-rw-r--r--ext/oci8/tests/default_prefetch2.phpt4
-rw-r--r--ext/oci8/tests/define.phpt2
-rw-r--r--ext/oci8/tests/define0.phpt5
-rw-r--r--ext/oci8/tests/define1.phpt2
-rw-r--r--ext/oci8/tests/define2.phpt20
-rw-r--r--ext/oci8/tests/define3.phpt6
-rw-r--r--ext/oci8/tests/define4.phpt12
-rw-r--r--ext/oci8/tests/define5.phpt10
-rw-r--r--ext/oci8/tests/define6.phpt3
-rw-r--r--ext/oci8/tests/define_old.phpt2
-rw-r--r--ext/oci8/tests/descriptors.phpt10
-rw-r--r--ext/oci8/tests/details.inc50
-rw-r--r--ext/oci8/tests/drcp_characterset.phpt8
-rw-r--r--ext/oci8/tests/drcp_conn_close1.phpt6
-rw-r--r--ext/oci8/tests/drcp_conn_close2.phpt6
-rw-r--r--ext/oci8/tests/drcp_functions.inc112
-rw-r--r--ext/oci8/tests/drcp_newconnect.phpt4
-rw-r--r--ext/oci8/tests/drcp_pconn_close1.phpt6
-rw-r--r--ext/oci8/tests/drcp_pconn_close2.phpt4
-rw-r--r--ext/oci8/tests/drcp_scope1.phpt40
-rw-r--r--ext/oci8/tests/drcp_scope2.phpt40
-rw-r--r--ext/oci8/tests/drcp_scope3.phpt8
-rw-r--r--ext/oci8/tests/drcp_scope4.phpt8
-rw-r--r--ext/oci8/tests/drcp_scope5.phpt10
-rw-r--r--ext/oci8/tests/driver_name.phpt2
-rw-r--r--ext/oci8/tests/driver_name_11gR2.phpt2
-rw-r--r--ext/oci8/tests/dupcolnames.phpt3
-rw-r--r--ext/oci8/tests/edition_1.phpt10
-rw-r--r--ext/oci8/tests/edition_2.phpt26
-rw-r--r--ext/oci8/tests/error3.phpt3
-rw-r--r--ext/oci8/tests/error_parse.phpt30
-rw-r--r--ext/oci8/tests/error_set.phpt3
-rw-r--r--ext/oci8/tests/extauth_01.phpt43
-rw-r--r--ext/oci8/tests/extauth_02.phpt43
-rw-r--r--ext/oci8/tests/extauth_03.phpt43
-rw-r--r--ext/oci8/tests/extauth_04.phpt15
-rw-r--r--ext/oci8/tests/fetch.phpt12
-rw-r--r--ext/oci8/tests/fetch_all1.phpt6
-rw-r--r--ext/oci8/tests/fetch_all2.phpt2
-rw-r--r--ext/oci8/tests/fetch_all4.phpt11
-rw-r--r--ext/oci8/tests/fetch_all5.phpt15
-rw-r--r--ext/oci8/tests/fetch_array.phpt40
-rw-r--r--ext/oci8/tests/fetch_assoc.phpt18
-rw-r--r--ext/oci8/tests/fetch_into.phpt6
-rw-r--r--ext/oci8/tests/fetch_into1.phpt14
-rw-r--r--ext/oci8/tests/fetch_into2.phpt14
-rw-r--r--ext/oci8/tests/fetch_object.phpt3
-rw-r--r--ext/oci8/tests/fetch_object_1.phpt3
-rw-r--r--ext/oci8/tests/fetch_object_2.phpt3
-rw-r--r--ext/oci8/tests/fetch_row.phpt6
-rw-r--r--ext/oci8/tests/field_funcs.phpt30
-rw-r--r--ext/oci8/tests/field_funcs2.phpt42
-rw-r--r--ext/oci8/tests/field_funcs3.phpt25
-rw-r--r--ext/oci8/tests/field_funcs_old.phpt30
-rw-r--r--ext/oci8/tests/imp_res_1.phpt3
-rw-r--r--ext/oci8/tests/imp_res_2.phpt3
-rw-r--r--ext/oci8/tests/imp_res_3.phpt3
-rw-r--r--ext/oci8/tests/imp_res_4.phpt3
-rw-r--r--ext/oci8/tests/imp_res_5.phpt3
-rw-r--r--ext/oci8/tests/imp_res_6.phpt3
-rw-r--r--ext/oci8/tests/imp_res_7.phpt3
-rw-r--r--ext/oci8/tests/imp_res_call_error.phpt3
-rw-r--r--ext/oci8/tests/imp_res_cancel.phpt3
-rw-r--r--ext/oci8/tests/imp_res_close.phpt3
-rw-r--r--ext/oci8/tests/imp_res_cursor.phpt3
-rw-r--r--ext/oci8/tests/imp_res_dbmsoutput.phpt3
-rw-r--r--ext/oci8/tests/imp_res_field.phpt3
-rw-r--r--ext/oci8/tests/imp_res_func_error.phpt3
-rw-r--r--ext/oci8/tests/imp_res_get_1.phpt3
-rw-r--r--ext/oci8/tests/imp_res_get_2.phpt3
-rw-r--r--ext/oci8/tests/imp_res_get_3.phpt3
-rw-r--r--ext/oci8/tests/imp_res_get_4.phpt3
-rw-r--r--ext/oci8/tests/imp_res_get_5.phpt3
-rw-r--r--ext/oci8/tests/imp_res_get_all.phpt3
-rw-r--r--ext/oci8/tests/imp_res_get_cancel.phpt3
-rw-r--r--ext/oci8/tests/imp_res_get_close_1.phpt3
-rw-r--r--ext/oci8/tests/imp_res_get_close_2.phpt3
-rw-r--r--ext/oci8/tests/imp_res_get_close_3.phpt3
-rw-r--r--ext/oci8/tests/imp_res_get_cursor.phpt3
-rw-r--r--ext/oci8/tests/imp_res_get_dbmsoutput.phpt3
-rw-r--r--ext/oci8/tests/imp_res_get_exec.phpt3
-rw-r--r--ext/oci8/tests/imp_res_get_none.phpt3
-rw-r--r--ext/oci8/tests/imp_res_insert.phpt3
-rw-r--r--ext/oci8/tests/imp_res_lob.phpt3
-rw-r--r--ext/oci8/tests/imp_res_prefetch.phpt3
-rw-r--r--ext/oci8/tests/ini_1.phpt3
-rw-r--r--ext/oci8/tests/lob_001.phptbin2130 -> 2099 bytes
-rw-r--r--ext/oci8/tests/lob_002.phpt9
-rw-r--r--ext/oci8/tests/lob_008.phpt2
-rw-r--r--ext/oci8/tests/lob_009.phpt2
-rw-r--r--ext/oci8/tests/lob_010.phpt2
-rw-r--r--ext/oci8/tests/lob_018.phpt19
-rw-r--r--ext/oci8/tests/lob_022.phpt8
-rw-r--r--ext/oci8/tests/lob_023.phpt2
-rw-r--r--ext/oci8/tests/lob_027.phpt14
-rw-r--r--ext/oci8/tests/lob_040.phpt16
-rw-r--r--ext/oci8/tests/lob_041.phpt8
-rw-r--r--ext/oci8/tests/lob_043.phpt11
-rw-r--r--ext/oci8/tests/lob_044.phpt9
-rw-r--r--ext/oci8/tests/lob_temp2.phpt2
-rw-r--r--ext/oci8/tests/null_byte_1.phpt3
-rw-r--r--ext/oci8/tests/null_byte_2.phpt3
-rw-r--r--ext/oci8/tests/null_byte_3.phpt3
-rw-r--r--ext/oci8/tests/password.phpt18
-rw-r--r--ext/oci8/tests/password_2.phpt16
-rw-r--r--ext/oci8/tests/password_new.phpt2
-rw-r--r--ext/oci8/tests/password_old.phpt2
-rw-r--r--ext/oci8/tests/pecl_bug10194.phpt2
-rw-r--r--ext/oci8/tests/pecl_bug16035.phpt3
-rw-r--r--ext/oci8/tests/pecl_bug16842.phpt3
-rw-r--r--ext/oci8/tests/pecl_bug6109.phpt10
-rw-r--r--ext/oci8/tests/pecl_bug8816.phpt18
-rw-r--r--ext/oci8/tests/prefetch.phpt4
-rw-r--r--ext/oci8/tests/prefetch_old.phpt6
-rw-r--r--ext/oci8/tests/refcur_prefetch_1.phpt22
-rw-r--r--ext/oci8/tests/refcur_prefetch_2.phpt24
-rw-r--r--ext/oci8/tests/refcur_prefetch_4.phpt22
-rw-r--r--ext/oci8/tests/reflection1.phpt3
-rw-r--r--ext/oci8/tests/reflection2.phpt3
-rw-r--r--ext/oci8/tests/serverversion.phpt4
-rw-r--r--ext/oci8/tests/statement_type.phpt8
-rw-r--r--ext/oci8/tests/statement_type_old.phpt12
-rw-r--r--ext/oci8/tests/testping.phpt12
-rw-r--r--ext/oci8/tests/xmltype_01.phpt56
-rw-r--r--ext/oci8/tests/xmltype_02.phpt9
-rw-r--r--ext/odbc/odbc.stub.php191
-rw-r--r--ext/odbc/odbc_arginfo.h248
-rw-r--r--ext/odbc/php_odbc.c422
-rw-r--r--ext/odbc/php_odbc.h2
-rw-r--r--ext/odbc/php_odbc_includes.h2
-rw-r--r--ext/odbc/tests/bug47803.phpt78
-rw-r--r--ext/odbc/tests/bug60616.phpt48
-rw-r--r--ext/odbc/tests/bug68087.phpt34
-rw-r--r--ext/odbc/tests/bug69354.phpt14
-rw-r--r--ext/odbc/tests/bug71171.phpt4
-rw-r--r--ext/odbc/tests/bug73448.phpt34
-rw-r--r--ext/odbc/tests/bug73725.phpt2
-rw-r--r--ext/odbc/tests/bug78473.phpt8
-rw-r--r--ext/odbc/tests/config.inc6
-rw-r--r--ext/odbc/tests/odbc_data_source_001.phpt4
-rw-r--r--ext/odbc/tests/odbc_free_result_001.phpt34
-rw-r--r--ext/odbc/tests/skipif.inc2
-rw-r--r--ext/opcache/Optimizer/block_pass.c1136
-rw-r--r--ext/opcache/Optimizer/compact_literals.c59
-rw-r--r--ext/opcache/Optimizer/dce.c3
-rw-r--r--ext/opcache/Optimizer/dfa_pass.c113
-rw-r--r--ext/opcache/Optimizer/escape_analysis.c21
-rw-r--r--ext/opcache/Optimizer/optimize_func_calls.c8
-rw-r--r--ext/opcache/Optimizer/optimize_temp_vars_5.c2
-rw-r--r--ext/opcache/Optimizer/pass1.c736
-rw-r--r--ext/opcache/Optimizer/pass1_5.c592
-rw-r--r--ext/opcache/Optimizer/pass2.c225
-rw-r--r--ext/opcache/Optimizer/pass3.c563
-rw-r--r--ext/opcache/Optimizer/sccp.c23
-rw-r--r--ext/opcache/Optimizer/ssa_integrity.c2
-rw-r--r--ext/opcache/Optimizer/zend_call_graph.c19
-rw-r--r--ext/opcache/Optimizer/zend_call_graph.h3
-rw-r--r--ext/opcache/Optimizer/zend_cfg.c2
-rw-r--r--ext/opcache/Optimizer/zend_cfg.h9
-rw-r--r--ext/opcache/Optimizer/zend_dfg.c4
-rw-r--r--ext/opcache/Optimizer/zend_dump.c108
-rw-r--r--ext/opcache/Optimizer/zend_dump.h3
-rw-r--r--ext/opcache/Optimizer/zend_func_info.c1538
-rw-r--r--ext/opcache/Optimizer/zend_func_info.h5
-rw-r--r--ext/opcache/Optimizer/zend_inference.c327
-rw-r--r--ext/opcache/Optimizer/zend_inference.h24
-rw-r--r--ext/opcache/Optimizer/zend_optimizer.c368
-rw-r--r--ext/opcache/Optimizer/zend_optimizer.h6
-rw-r--r--ext/opcache/Optimizer/zend_optimizer_internal.h3
-rw-r--r--ext/opcache/Optimizer/zend_ssa.c328
-rw-r--r--ext/opcache/Optimizer/zend_ssa.h11
-rw-r--r--ext/opcache/ZendAccelerator.c224
-rw-r--r--ext/opcache/ZendAccelerator.h24
-rw-r--r--ext/opcache/config.m479
-rw-r--r--ext/opcache/config.w3225
-rw-r--r--ext/opcache/jit/Makefile.frag17
-rw-r--r--ext/opcache/jit/Makefile.frag.w3216
-rw-r--r--ext/opcache/jit/dynasm/dasm_arm.h456
-rw-r--r--ext/opcache/jit/dynasm/dasm_arm.lua1125
-rw-r--r--ext/opcache/jit/dynasm/dasm_arm64.h518
-rw-r--r--ext/opcache/jit/dynasm/dasm_arm64.lua1166
-rw-r--r--ext/opcache/jit/dynasm/dasm_mips.h419
-rw-r--r--ext/opcache/jit/dynasm/dasm_mips.lua1008
-rw-r--r--ext/opcache/jit/dynasm/dasm_mips64.lua12
-rw-r--r--ext/opcache/jit/dynasm/dasm_ppc.h419
-rw-r--r--ext/opcache/jit/dynasm/dasm_ppc.lua1919
-rw-r--r--ext/opcache/jit/dynasm/dasm_proto.h83
-rw-r--r--ext/opcache/jit/dynasm/dasm_x64.lua12
-rw-r--r--ext/opcache/jit/dynasm/dasm_x86.h500
-rw-r--r--ext/opcache/jit/dynasm/dasm_x86.lua2274
-rw-r--r--ext/opcache/jit/dynasm/dynasm.lua1094
-rw-r--r--ext/opcache/jit/dynasm/minilua.c7770
-rw-r--r--ext/opcache/jit/libudis86/LICENSE22
-rw-r--r--ext/opcache/jit/libudis86/decode.c1266
-rw-r--r--ext/opcache/jit/libudis86/decode.h197
-rw-r--r--ext/opcache/jit/libudis86/extern.h113
-rw-r--r--ext/opcache/jit/libudis86/itab.c5946
-rw-r--r--ext/opcache/jit/libudis86/itab.h939
-rw-r--r--ext/opcache/jit/libudis86/syn-att.c228
-rw-r--r--ext/opcache/jit/libudis86/syn-intel.c224
-rw-r--r--ext/opcache/jit/libudis86/syn.c258
-rw-r--r--ext/opcache/jit/libudis86/syn.h53
-rw-r--r--ext/opcache/jit/libudis86/types.h260
-rw-r--r--ext/opcache/jit/libudis86/udint.h99
-rw-r--r--ext/opcache/jit/libudis86/udis86.c458
-rw-r--r--ext/opcache/jit/vtune/ittnotify_config.h596
-rw-r--r--ext/opcache/jit/vtune/ittnotify_types.h115
-rw-r--r--ext/opcache/jit/vtune/jitprofiling.c312
-rw-r--r--ext/opcache/jit/vtune/jitprofiling.h694
-rw-r--r--ext/opcache/jit/zend_elf.c109
-rw-r--r--ext/opcache/jit/zend_elf.h115
-rw-r--r--ext/opcache/jit/zend_jit.c3652
-rw-r--r--ext/opcache/jit/zend_jit.h109
-rw-r--r--ext/opcache/jit/zend_jit_disasm_x86.c519
-rw-r--r--ext/opcache/jit/zend_jit_gdb.c493
-rw-r--r--ext/opcache/jit/zend_jit_helpers.c1504
-rw-r--r--ext/opcache/jit/zend_jit_internal.h119
-rw-r--r--ext/opcache/jit/zend_jit_oprofile.c50
-rw-r--r--ext/opcache/jit/zend_jit_perf_dump.c246
-rw-r--r--ext/opcache/jit/zend_jit_vm_helpers.c268
-rw-r--r--ext/opcache/jit/zend_jit_vtune.c42
-rw-r--r--ext/opcache/jit/zend_jit_x86.dasc9827
-rw-r--r--ext/opcache/jit/zend_jit_x86.h309
-rw-r--r--ext/opcache/opcache.stub.php13
-rw-r--r--ext/opcache/opcache_arginfo.h24
-rw-r--r--ext/opcache/shared_alloc_mmap.c62
-rw-r--r--ext/opcache/shared_alloc_win32.c30
-rw-r--r--ext/opcache/tests/assign_obj_op_of_fetch_dim.phpt12
-rw-r--r--ext/opcache/tests/blacklist.inc2
-rw-r--r--ext/opcache/tests/block_pass_001.phpt2
-rw-r--r--ext/opcache/tests/bool_not_cv.phpt4
-rw-r--r--ext/opcache/tests/bug64353.phpt20
-rw-r--r--ext/opcache/tests/bug65665.phpt168
-rw-r--r--ext/opcache/tests/bug66176.phpt4
-rw-r--r--ext/opcache/tests/bug66251.phpt9
-rw-r--r--ext/opcache/tests/bug66334.phpt4
-rw-r--r--ext/opcache/tests/bug66338.phpt22
-rw-r--r--ext/opcache/tests/bug66440.phpt2
-rw-r--r--ext/opcache/tests/bug66474.phpt2
-rw-r--r--ext/opcache/tests/bug68252.phpt21
-rw-r--r--ext/opcache/tests/bug68644.phpt17
-rw-r--r--ext/opcache/tests/bug69038.phpt58
-rw-r--r--ext/opcache/tests/bug69159.phpt2
-rw-r--r--ext/opcache/tests/bug70207.phpt6
-rw-r--r--ext/opcache/tests/bug71843.phpt9
-rw-r--r--ext/opcache/tests/bug73402.phpt18
-rw-r--r--ext/opcache/tests/bug73583.phpt6
-rw-r--r--ext/opcache/tests/bug73668.phpt2
-rw-r--r--ext/opcache/tests/bug73746.phpt24
-rw-r--r--ext/opcache/tests/bug73789.phpt40
-rw-r--r--ext/opcache/tests/bug74019.phpt12
-rw-r--r--ext/opcache/tests/bug74152.phpt10
-rw-r--r--ext/opcache/tests/bug74456.phpt2
-rw-r--r--ext/opcache/tests/bug74596.phpt32
-rw-r--r--ext/opcache/tests/bug74980.phpt18
-rw-r--r--ext/opcache/tests/bug75230.phpt4
-rw-r--r--ext/opcache/tests/bug75357.phpt26
-rw-r--r--ext/opcache/tests/bug75370.phpt6
-rw-r--r--ext/opcache/tests/bug75556.phpt14
-rw-r--r--ext/opcache/tests/bug75687.phpt6
-rw-r--r--ext/opcache/tests/bug75729.phpt21
-rw-r--r--ext/opcache/tests/bug75893.phpt24
-rw-r--r--ext/opcache/tests/bug75938.phpt10
-rw-r--r--ext/opcache/tests/bug76074.phpt4
-rw-r--r--ext/opcache/tests/bug76094.phpt14
-rw-r--r--ext/opcache/tests/bug76446.phpt8
-rw-r--r--ext/opcache/tests/bug76463.phpt2
-rw-r--r--ext/opcache/tests/bug76477.phpt6
-rw-r--r--ext/opcache/tests/bug77058.phpt4
-rw-r--r--ext/opcache/tests/bug77191.phpt14
-rw-r--r--ext/opcache/tests/bug77266.phpt24
-rw-r--r--ext/opcache/tests/bug77743.phpt12
-rw-r--r--ext/opcache/tests/bug78014.inc2
-rw-r--r--ext/opcache/tests/bug78015.phpt2
-rw-r--r--ext/opcache/tests/bug78185.phpt6
-rw-r--r--ext/opcache/tests/bug78986.phpt2
-rw-r--r--ext/opcache/tests/compact_literals.phpt72
-rw-r--r--ext/opcache/tests/issue0115.phpt1
-rw-r--r--ext/opcache/tests/issue0140.phpt1
-rw-r--r--ext/opcache/tests/issue0149.phpt1
-rw-r--r--ext/opcache/tests/issue0183.phpt18
-rw-r--r--ext/opcache/tests/jit/array_elem.phpt28
-rw-r--r--ext/opcache/tests/jit/assign_001.phpt27
-rw-r--r--ext/opcache/tests/jit/assign_002.phpt29
-rw-r--r--ext/opcache/tests/jit/assign_003.phpt21
-rw-r--r--ext/opcache/tests/jit/assign_004.phpt24
-rw-r--r--ext/opcache/tests/jit/assign_005.phpt24
-rw-r--r--ext/opcache/tests/jit/assign_006.phpt22
-rw-r--r--ext/opcache/tests/jit/assign_007.phpt21
-rw-r--r--ext/opcache/tests/jit/assign_008.phpt21
-rw-r--r--ext/opcache/tests/jit/assign_009.phpt21
-rw-r--r--ext/opcache/tests/jit/assign_010.phpt21
-rw-r--r--ext/opcache/tests/jit/assign_011.phpt28
-rw-r--r--ext/opcache/tests/jit/assign_012.phpt28
-rw-r--r--ext/opcache/tests/jit/assign_013.phpt21
-rw-r--r--ext/opcache/tests/jit/assign_014.phpt22
-rw-r--r--ext/opcache/tests/jit/assign_015.phpt21
-rw-r--r--ext/opcache/tests/jit/assign_016.phpt21
-rw-r--r--ext/opcache/tests/jit/assign_017.phpt21
-rw-r--r--ext/opcache/tests/jit/assign_018.phpt26
-rw-r--r--ext/opcache/tests/jit/assign_019.phpt24
-rw-r--r--ext/opcache/tests/jit/assign_020.phpt22
-rw-r--r--ext/opcache/tests/jit/assign_021.phpt24
-rw-r--r--ext/opcache/tests/jit/assign_022.phpt24
-rw-r--r--ext/opcache/tests/jit/assign_023.phpt24
-rw-r--r--ext/opcache/tests/jit/assign_024.phpt23
-rw-r--r--ext/opcache/tests/jit/assign_025.phpt24
-rw-r--r--ext/opcache/tests/jit/assign_026.phpt25
-rw-r--r--ext/opcache/tests/jit/assign_027.phpt22
-rw-r--r--ext/opcache/tests/jit/assign_028.phpt21
-rw-r--r--ext/opcache/tests/jit/assign_029.phpt22
-rw-r--r--ext/opcache/tests/jit/assign_030.phpt23
-rw-r--r--ext/opcache/tests/jit/assign_031.phpt19
-rw-r--r--ext/opcache/tests/jit/assign_032.phpt27
-rw-r--r--ext/opcache/tests/jit/assign_033.phpt24
-rw-r--r--ext/opcache/tests/jit/assign_034.phpt21
-rw-r--r--ext/opcache/tests/jit/assign_035.phpt39
-rw-r--r--ext/opcache/tests/jit/assign_036.phpt43
-rw-r--r--ext/opcache/tests/jit/assign_dim_002.phpt137
-rw-r--r--ext/opcache/tests/jit/bug77857.phpt27
-rw-r--r--ext/opcache/tests/jit/cmp_001.phpt24
-rw-r--r--ext/opcache/tests/jit/cmp_002.phpt24
-rw-r--r--ext/opcache/tests/jit/cmp_003.phpt194
-rw-r--r--ext/opcache/tests/jit/cmp_004.phpt22
-rw-r--r--ext/opcache/tests/jit/const_001.phpt26
-rw-r--r--ext/opcache/tests/jit/defined_001.phpt38
-rw-r--r--ext/opcache/tests/jit/fetch_dim_func_args_001.phpt26
-rw-r--r--ext/opcache/tests/jit/fetch_dim_r_001.phpt45
-rw-r--r--ext/opcache/tests/jit/fetch_dim_r_002.phpt45
-rw-r--r--ext/opcache/tests/jit/fetch_dim_r_003.phpt61
-rw-r--r--ext/opcache/tests/jit/fetch_dim_r_004.phpt61
-rw-r--r--ext/opcache/tests/jit/fetch_dim_rw_001.phpt27
-rw-r--r--ext/opcache/tests/jit/fetch_obj_001.phpt137
-rw-r--r--ext/opcache/tests/jit/fetch_obj_002.phpt41
-rw-r--r--ext/opcache/tests/jit/fetch_obj_003.phpt46
-rw-r--r--ext/opcache/tests/jit/fetch_obj_004.phpt43
-rw-r--r--ext/opcache/tests/jit/inc_001.phpt22
-rw-r--r--ext/opcache/tests/jit/inc_002.phpt21
-rw-r--r--ext/opcache/tests/jit/inc_003.phpt22
-rw-r--r--ext/opcache/tests/jit/inc_004.phpt21
-rw-r--r--ext/opcache/tests/jit/inc_005.phpt23
-rw-r--r--ext/opcache/tests/jit/inc_006.phpt22
-rw-r--r--ext/opcache/tests/jit/inc_007.phpt21
-rw-r--r--ext/opcache/tests/jit/inc_008.phpt20
-rw-r--r--ext/opcache/tests/jit/inc_009.phpt22
-rw-r--r--ext/opcache/tests/jit/inc_010.phpt21
-rw-r--r--ext/opcache/tests/jit/inc_011.phpt22
-rw-r--r--ext/opcache/tests/jit/inc_012.phpt21
-rw-r--r--ext/opcache/tests/jit/inc_013.phpt23
-rw-r--r--ext/opcache/tests/jit/inc_014.phpt22
-rw-r--r--ext/opcache/tests/jit/inc_015.phpt21
-rw-r--r--ext/opcache/tests/jit/inc_016.phpt20
-rw-r--r--ext/opcache/tests/jit/inc_017.phpt20
-rw-r--r--ext/opcache/tests/jit/inc_018.phpt20
-rw-r--r--ext/opcache/tests/jit/inc_019.phpt27
-rw-r--r--ext/opcache/tests/jit/inc_020.phpt28
-rw-r--r--ext/opcache/tests/jit/jmpz_001.phpt26
-rw-r--r--ext/opcache/tests/jit/jmpz_ex_001.phpt32
-rw-r--r--ext/opcache/tests/jit/mod_001.phpt41
-rw-r--r--ext/opcache/tests/jit/mod_002.phpt53
-rw-r--r--ext/opcache/tests/jit/noval_001.phpt34
-rw-r--r--ext/opcache/tests/jit/recv_001.phpt23
-rw-r--r--ext/opcache/tests/jit/reg_alloc_001.phpt39
-rw-r--r--ext/opcache/tests/jit/reg_alloc_002.phpt28
-rw-r--r--ext/opcache/tests/jit/reg_alloc_003.phpt23
-rw-r--r--ext/opcache/tests/jit/send_val_001.phpt23
-rw-r--r--ext/opcache/tests/jit/send_var_ex_001.phpt30
-rw-r--r--ext/opcache/tests/jit/shift_left_001.phpt37
-rw-r--r--ext/opcache/tests/jit/shift_left_002.phpt49
-rw-r--r--ext/opcache/tests/jit/shift_right_001.phpt43
-rw-r--r--ext/opcache/tests/jit/shift_right_002.phpt55
-rw-r--r--ext/opcache/tests/jit/shift_right_003.phpt26
-rw-r--r--ext/opcache/tests/jit/skipif.inc3
-rw-r--r--ext/opcache/tests/jit/switch_jumptable.phpt40
-rw-r--r--ext/opcache/tests/jit/type_check_001.phpt25
-rw-r--r--ext/opcache/tests/jit/unreachable_block.phpt25
-rw-r--r--ext/opcache/tests/jmpz_jmp_elim.phpt2
-rw-r--r--ext/opcache/tests/opt/block_pass_001.phpt24
-rw-r--r--ext/opcache/tests/opt/block_pass_002.phpt19
-rw-r--r--ext/opcache/tests/opt/dce_001.phpt6
-rw-r--r--ext/opcache/tests/opt/dce_002.phpt12
-rw-r--r--ext/opcache/tests/opt/dce_003.phpt4
-rw-r--r--ext/opcache/tests/opt/dce_004.phpt8
-rw-r--r--ext/opcache/tests/opt/dce_005.phpt4
-rw-r--r--ext/opcache/tests/opt/dce_006.phpt6
-rw-r--r--ext/opcache/tests/opt/sccp_001.phpt8
-rw-r--r--ext/opcache/tests/opt/sccp_002.phpt22
-rw-r--r--ext/opcache/tests/opt/sccp_003.phpt22
-rw-r--r--ext/opcache/tests/opt/sccp_004.phpt24
-rw-r--r--ext/opcache/tests/opt/sccp_005.phpt6
-rw-r--r--ext/opcache/tests/opt/sccp_006.phpt4
-rw-r--r--ext/opcache/tests/opt/sccp_007.phpt14
-rw-r--r--ext/opcache/tests/opt/sccp_008.phpt12
-rw-r--r--ext/opcache/tests/opt/sccp_009.phpt8
-rw-r--r--ext/opcache/tests/opt/sccp_010.phpt20
-rw-r--r--ext/opcache/tests/opt/sccp_011.phpt20
-rw-r--r--ext/opcache/tests/opt/sccp_012.phpt24
-rw-r--r--ext/opcache/tests/opt/sccp_013.phpt10
-rw-r--r--ext/opcache/tests/opt/sccp_014.phpt12
-rw-r--r--ext/opcache/tests/opt/sccp_015.phpt16
-rw-r--r--ext/opcache/tests/opt/sccp_017.phpt12
-rw-r--r--ext/opcache/tests/opt/sccp_018.phpt14
-rw-r--r--ext/opcache/tests/opt/sccp_019.phpt10
-rw-r--r--ext/opcache/tests/opt/sccp_020.phpt12
-rw-r--r--ext/opcache/tests/opt/sccp_021.phpt22
-rw-r--r--ext/opcache/tests/opt/sccp_022.phpt14
-rw-r--r--ext/opcache/tests/opt/sccp_023.phpt12
-rw-r--r--ext/opcache/tests/opt/sccp_024.phpt6
-rw-r--r--ext/opcache/tests/opt/sccp_025.phpt42
-rw-r--r--ext/opcache/tests/opt/sccp_026.phpt2
-rw-r--r--ext/opcache/tests/opt/sccp_027.phpt18
-rw-r--r--ext/opcache/tests/opt/sccp_029.phpt2
-rw-r--r--ext/opcache/tests/opt/sccp_031.phpt36
-rw-r--r--ext/opcache/tests/optimize_func_calls.phpt18
-rw-r--r--ext/opcache/tests/optimize_static_001.phpt12
-rw-r--r--ext/opcache/tests/phi_remove_001.phpt96
-rw-r--r--ext/opcache/tests/phi_remove_002.phpt10
-rw-r--r--ext/opcache/tests/php_cli_server.inc106
-rw-r--r--ext/opcache/tests/preload.inc36
-rw-r--r--ext/opcache/tests/preload_009.phpt6
-rw-r--r--ext/opcache/tests/preload_011.phpt2
-rw-r--r--ext/opcache/tests/preload_012.phpt2
-rw-r--r--ext/opcache/tests/preload_bug78014.inc2
-rw-r--r--ext/opcache/tests/preload_bug78175_2.inc22
-rw-r--r--ext/opcache/tests/preload_bug78376.inc2
-rw-r--r--ext/opcache/tests/preload_bug78937.inc4
-rw-r--r--ext/opcache/tests/preload_globals.inc2
-rw-r--r--ext/opcache/tests/preload_loadable_classes_2.phpt4
-rw-r--r--ext/opcache/tests/revalidate_path_01.phpt29
-rw-r--r--ext/opcache/tests/ssa_bug_001.phpt2
-rw-r--r--ext/opcache/tests/ssa_bug_007.phpt24
-rw-r--r--ext/opcache/tests/ssa_bug_011.phpt10
-rw-r--r--ext/opcache/tests/wrong_inlining_002.phpt9
-rw-r--r--ext/opcache/tests/wrong_inlining_003.phpt2
-rw-r--r--ext/opcache/tests/wrong_inlining_004.phpt2
-rw-r--r--ext/opcache/zend_accelerator_debug.c2
-rw-r--r--ext/opcache/zend_accelerator_module.c65
-rw-r--r--ext/opcache/zend_accelerator_util_funcs.c21
-rw-r--r--ext/opcache/zend_file_cache.c65
-rw-r--r--ext/opcache/zend_persist.c92
-rw-r--r--ext/opcache/zend_persist_calc.c44
-rw-r--r--ext/opcache/zend_shared_alloc.c33
-rw-r--r--ext/opcache/zend_shared_alloc.h7
-rw-r--r--ext/openssl/openssl.c678
-rw-r--r--ext/openssl/openssl.stub.php177
-rw-r--r--ext/openssl/openssl_arginfo.h316
-rw-r--r--ext/openssl/php_openssl.h2
-rw-r--r--ext/openssl/tests/bug28382.phpt6
-rw-r--r--ext/openssl/tests/bug38255.phpt26
-rw-r--r--ext/openssl/tests/bug38261.phpt4
-rw-r--r--ext/openssl/tests/bug54992.phpt2
-rw-r--r--ext/openssl/tests/bug55646.phpt2
-rw-r--r--ext/openssl/tests/bug60632.phpt10
-rw-r--r--ext/openssl/tests/bug65538_002.phpt2
-rw-r--r--ext/openssl/tests/bug65729.phpt4
-rw-r--r--ext/openssl/tests/bug68912.phpt12
-rw-r--r--ext/openssl/tests/bug68920.phpt8
-rw-r--r--ext/openssl/tests/bug71475.phpt2
-rw-r--r--ext/openssl/tests/bug72165.phpt2
-rw-r--r--ext/openssl/tests/bug74022.phpt2
-rw-r--r--ext/openssl/tests/bug74022_2.phpt2
-rw-r--r--ext/openssl/tests/bug74720_0.phpt2
-rw-r--r--ext/openssl/tests/bug74720_1.phpt2
-rw-r--r--ext/openssl/tests/bug74798.phpt2
-rw-r--r--ext/openssl/tests/bug74903.phpt2
-rw-r--r--ext/openssl/tests/bug75307.phpt2
-rw-r--r--ext/openssl/tests/cve-2013-6420.phpt2
-rw-r--r--ext/openssl/tests/openssl_csr_export_bacis.phpt28
-rw-r--r--ext/openssl/tests/openssl_csr_export_to_file_basic.phpt28
-rw-r--r--ext/openssl/tests/openssl_csr_get_public_key_basic.phpt2
-rw-r--r--ext/openssl/tests/openssl_csr_get_subject_basic.phpt2
-rw-r--r--ext/openssl/tests/openssl_csr_new_basic.phpt11
-rw-r--r--ext/openssl/tests/openssl_csr_sign_basic.phpt26
-rw-r--r--ext/openssl/tests/openssl_decrypt_ccm.phpt6
-rw-r--r--ext/openssl/tests/openssl_decrypt_error.phpt12
-rw-r--r--ext/openssl/tests/openssl_decrypt_gcm.phpt6
-rw-r--r--ext/openssl/tests/openssl_encrypt_error.phpt24
-rw-r--r--ext/openssl/tests/openssl_error_string_basic.phpt26
-rw-r--r--ext/openssl/tests/openssl_open_basic.phpt2
-rw-r--r--ext/openssl/tests/openssl_peer_fingerprint_basic.phpt2
-rw-r--r--ext/openssl/tests/openssl_pkcs12_export_basic.phpt16
-rw-r--r--ext/openssl/tests/openssl_pkcs12_export_to_file_basic.phpt16
-rw-r--r--ext/openssl/tests/openssl_pkcs12_export_to_file_error.phpt6
-rw-r--r--ext/openssl/tests/openssl_pkcs7_decrypt_basic.phpt10
-rw-r--r--ext/openssl/tests/openssl_pkcs7_decrypt_error.phpt8
-rw-r--r--ext/openssl/tests/openssl_pkcs7_encrypt_basic.phpt10
-rw-r--r--ext/openssl/tests/openssl_pkcs7_read_basic.phpt9
-rw-r--r--ext/openssl/tests/openssl_pkcs7_sign_basic.phpt20
-rw-r--r--ext/openssl/tests/openssl_pkcs7_verify_basic.phpt12
-rw-r--r--ext/openssl/tests/openssl_pkey_new_basic.phpt2
-rw-r--r--ext/openssl/tests/openssl_pkey_new_error.phpt30
-rw-r--r--ext/openssl/tests/openssl_private_decrypt_basic.phpt2
-rw-r--r--ext/openssl/tests/openssl_public_decrypt_basic.phpt4
-rw-r--r--ext/openssl/tests/openssl_seal_basic.phpt18
-rw-r--r--ext/openssl/tests/openssl_sign_basic.phpt6
-rw-r--r--ext/openssl/tests/openssl_verify_basic.phpt4
-rw-r--r--ext/openssl/tests/openssl_x509_export_basic.phpt4
-rw-r--r--ext/openssl/tests/openssl_x509_export_to_file_basic.phpt4
-rw-r--r--ext/openssl/tests/openssl_x509_fingerprint_basic.phpt9
-rw-r--r--ext/openssl/tests/openssl_x509_free_basic.phpt3
-rw-r--r--ext/openssl/tests/openssl_x509_read_basic.phpt6
-rw-r--r--ext/openssl/tests/san_peer_matching.phpt2
-rw-r--r--ext/openssl/tests/sni_server_key_cert.phpt46
-rw-r--r--ext/openssl/tests/stream_security_level.phpt40
-rw-r--r--ext/openssl/tests/stream_verify_peer_name_003.phpt2
-rw-r--r--ext/openssl/xp_ssl.c26
-rw-r--r--ext/pcntl/pcntl.c262
-rw-r--r--ext/pcntl/pcntl.stub.php67
-rw-r--r--ext/pcntl/pcntl_arginfo.h117
-rw-r--r--ext/pcntl/php_pcntl.h2
-rw-r--r--ext/pcntl/php_signal.c4
-rw-r--r--ext/pcntl/php_signal.h2
-rw-r--r--ext/pcntl/tests/001.phpt82
-rw-r--r--ext/pcntl/tests/002.phpt96
-rw-r--r--ext/pcntl/tests/pcntl_alarm.phpt3
-rw-r--r--ext/pcntl/tests/pcntl_exec_2.phpt10
-rw-r--r--ext/pcntl/tests/pcntl_exec_3.phpt4
-rw-r--r--ext/pcntl/tests/pcntl_fork_basic.phpt6
-rw-r--r--ext/pcntl/tests/pcntl_signal.phpt8
-rw-r--r--ext/pcntl/tests/pcntl_wait.phpt57
-rw-r--r--ext/pcntl/tests/pcntl_wait_rusage1.phpt42
-rw-r--r--ext/pcntl/tests/pcntl_waitpid_rusage1.phpt42
-rw-r--r--ext/pcre/config.w321
-rw-r--r--ext/pcre/config0.m41
-rw-r--r--ext/pcre/pcre2lib/pcre2.h19
-rw-r--r--ext/pcre/pcre2lib/pcre2_auto_possess.c7
-rw-r--r--ext/pcre/pcre2lib/pcre2_compile.c535
-rw-r--r--ext/pcre/pcre2lib/pcre2_context.c2
-rw-r--r--ext/pcre/pcre2lib/pcre2_dfa_match.c129
-rw-r--r--ext/pcre/pcre2lib/pcre2_error.c3
-rw-r--r--ext/pcre/pcre2lib/pcre2_internal.h105
-rw-r--r--ext/pcre/pcre2lib/pcre2_intmodedep.h10
-rw-r--r--ext/pcre/pcre2lib/pcre2_jit_compile.c1845
-rw-r--r--ext/pcre/pcre2lib/pcre2_jit_match.c1
-rw-r--r--ext/pcre/pcre2lib/pcre2_jit_neon_inc.h343
-rw-r--r--ext/pcre/pcre2lib/pcre2_jit_simd_inc.h993
-rw-r--r--ext/pcre/pcre2lib/pcre2_maketables.c11
-rw-r--r--ext/pcre/pcre2lib/pcre2_match.c603
-rw-r--r--ext/pcre/pcre2lib/pcre2_match_data.c15
-rw-r--r--ext/pcre/pcre2lib/pcre2_printint.c2
-rw-r--r--ext/pcre/pcre2lib/pcre2_study.c306
-rw-r--r--ext/pcre/pcre2lib/pcre2_tables.c316
-rw-r--r--ext/pcre/pcre2lib/pcre2_ucd.c5623
-rw-r--r--ext/pcre/pcre2lib/pcre2_ucp.h7
-rw-r--r--ext/pcre/pcre2lib/sljit/sljitConfigInternal.h4
-rw-r--r--ext/pcre/pcre2lib/sljit/sljitExecAllocator.c27
-rw-r--r--ext/pcre/pcre2lib/sljit/sljitLir.c69
-rw-r--r--ext/pcre/pcre2lib/sljit/sljitLir.h22
-rw-r--r--ext/pcre/pcre2lib/sljit/sljitNativeARM_32.c126
-rw-r--r--ext/pcre/pcre2lib/sljit/sljitNativeARM_64.c111
-rw-r--r--ext/pcre/pcre2lib/sljit/sljitNativeARM_T2_32.c76
-rw-r--r--ext/pcre/pcre2lib/sljit/sljitNativeMIPS_32.c2
-rw-r--r--ext/pcre/pcre2lib/sljit/sljitNativeMIPS_common.c155
-rw-r--r--ext/pcre/pcre2lib/sljit/sljitNativePPC_32.c2
-rw-r--r--ext/pcre/pcre2lib/sljit/sljitNativePPC_64.c3
-rw-r--r--ext/pcre/pcre2lib/sljit/sljitNativePPC_common.c214
-rw-r--r--ext/pcre/pcre2lib/sljit/sljitNativeSPARC_32.c2
-rw-r--r--ext/pcre/pcre2lib/sljit/sljitNativeSPARC_common.c102
-rw-r--r--ext/pcre/pcre2lib/sljit/sljitNativeX86_32.c4
-rw-r--r--ext/pcre/pcre2lib/sljit/sljitNativeX86_64.c54
-rw-r--r--ext/pcre/pcre2lib/sljit/sljitNativeX86_common.c125
-rw-r--r--ext/pcre/pcre2lib/sljit/sljitUtils.c6
-rw-r--r--ext/pcre/php_pcre.c97
-rw-r--r--ext/pcre/php_pcre.h2
-rw-r--r--ext/pcre/php_pcre.stub.php39
-rw-r--r--ext/pcre/php_pcre_arginfo.h65
-rw-r--r--ext/pcre/tests/001.phpt14
-rw-r--r--ext/pcre/tests/002.phpt18
-rw-r--r--ext/pcre/tests/003.phpt16
-rw-r--r--ext/pcre/tests/005.phpt12
-rw-r--r--ext/pcre/tests/007.phpt8
-rw-r--r--ext/pcre/tests/bug20528.phpt4
-rw-r--r--ext/pcre/tests/bug21732.phpt18
-rw-r--r--ext/pcre/tests/bug26927.phpt6
-rw-r--r--ext/pcre/tests/bug27103.phpt6
-rw-r--r--ext/pcre/tests/bug37911.phpt4
-rw-r--r--ext/pcre/tests/bug41638.phpt2
-rw-r--r--ext/pcre/tests/bug44191.phpt2
-rw-r--r--ext/pcre/tests/bug44925.phpt4
-rw-r--r--ext/pcre/tests/bug47662.phpt2
-rw-r--r--ext/pcre/tests/bug73392.phpt20
-rw-r--r--ext/pcre/tests/bug73483.phpt2
-rw-r--r--ext/pcre/tests/bug75207.phpt2
-rw-r--r--ext/pcre/tests/bug76512.phpt2
-rw-r--r--ext/pcre/tests/bug76850.phpt2
-rw-r--r--ext/pcre/tests/bug77193.phpt14
-rw-r--r--ext/pcre/tests/bug77827.phpt2
-rw-r--r--ext/pcre/tests/cache_limit.phpt8
-rw-r--r--ext/pcre/tests/grep2.phpt10
-rw-r--r--ext/pcre/tests/marks.phpt2
-rw-r--r--ext/pcre/tests/no_jit_bug70110.phpt2
-rw-r--r--ext/pcre/tests/pcre.constants.phpt2
-rw-r--r--ext/pcre/tests/pcre_extra.phpt5
-rw-r--r--ext/pcre/tests/preg_filter.phpt2
-rw-r--r--ext/pcre/tests/preg_grep_error1.phpt23
-rw-r--r--ext/pcre/tests/preg_match_all_error1.phpt23
-rw-r--r--ext/pcre/tests/preg_match_all_error2.phpt20
-rw-r--r--ext/pcre/tests/preg_match_all_error3.phpt7
-rw-r--r--ext/pcre/tests/preg_match_basic_002.phpt2
-rw-r--r--ext/pcre/tests/preg_match_error1.phpt23
-rw-r--r--ext/pcre/tests/preg_match_error2.phpt23
-rw-r--r--ext/pcre/tests/preg_match_error4.phpt4
-rw-r--r--ext/pcre/tests/preg_match_variation1.phpt2
-rw-r--r--ext/pcre/tests/preg_replace2.phpt9
-rw-r--r--ext/pcre/tests/preg_replace_callback2.phpt6
-rw-r--r--ext/pcre/tests/preg_replace_callback3.phpt22
-rw-r--r--ext/pcre/tests/preg_replace_callback_array.phpt44
-rw-r--r--ext/pcre/tests/preg_replace_callback_array2.phpt41
-rw-r--r--ext/pcre/tests/preg_replace_callback_error1.phpt11
-rw-r--r--ext/pcre/tests/preg_replace_edit_basic.phpt2
-rw-r--r--ext/pcre/tests/preg_replace_error1.phpt3
-rw-r--r--ext/pcre/tests/preg_replace_error2.phpt13
-rw-r--r--ext/pcre/tests/preg_split_error1.phpt23
-rw-r--r--ext/pcre/tests/skip_001.inc2
-rw-r--r--ext/pcre/tests/skip_002.inc2
-rw-r--r--ext/pcre/tests/skip_003.inc2
-rw-r--r--ext/pcre/tests/split.phpt6
-rw-r--r--ext/pcre/tests/split2.phpt4
-rw-r--r--ext/pdo/pdo.c12
-rw-r--r--ext/pdo/pdo.stub.php133
-rw-r--r--ext/pdo/pdo_arginfo.h130
-rw-r--r--ext/pdo/pdo_dbh.c181
-rw-r--r--ext/pdo/pdo_sql_parser.re2
-rw-r--r--ext/pdo/pdo_sqlstate.c2
-rw-r--r--ext/pdo/pdo_stmt.c296
-rw-r--r--ext/pdo/php_pdo.h2
-rw-r--r--ext/pdo/php_pdo_driver.h2
-rw-r--r--ext/pdo/php_pdo_error.h2
-rw-r--r--ext/pdo/php_pdo_int.h2
-rw-r--r--ext/pdo/tests/bug_34630.phpt16
-rw-r--r--ext/pdo/tests/bug_34687.phpt6
-rw-r--r--ext/pdo/tests/bug_35671.phpt6
-rw-r--r--ext/pdo/tests/bug_36428.phpt2
-rw-r--r--ext/pdo/tests/bug_38394.phpt2
-rw-r--r--ext/pdo/tests/bug_39398.phpt2
-rw-r--r--ext/pdo/tests/bug_42917.phpt2
-rw-r--r--ext/pdo/tests/bug_43130.phpt4
-rw-r--r--ext/pdo/tests/bug_43139.phpt4
-rw-r--r--ext/pdo/tests/bug_44159.phpt6
-rw-r--r--ext/pdo/tests/bug_44173.phpt8
-rw-r--r--ext/pdo/tests/bug_44409.phpt28
-rw-r--r--ext/pdo/tests/bug_44861.phpt8
-rw-r--r--ext/pdo/tests/bug_47769.phpt20
-rw-r--r--ext/pdo/tests/bug_50458.phpt2
-rw-r--r--ext/pdo/tests/bug_52098.phpt2
-rw-r--r--ext/pdo/tests/bug_60665.phpt8
-rw-r--r--ext/pdo/tests/bug_61292.phpt20
-rw-r--r--ext/pdo/tests/bug_64172.phpt2
-rw-r--r--ext/pdo/tests/bug_65946.phpt32
-rw-r--r--ext/pdo/tests/bug_69356.phpt7
-rw-r--r--ext/pdo/tests/bug_71447.phpt46
-rw-r--r--ext/pdo/tests/bug_71885.phpt20
-rw-r--r--ext/pdo/tests/bug_79106.phpt44
-rw-r--r--ext/pdo/tests/bug_79106_collision.phpt38
-rw-r--r--ext/pdo/tests/pdo.inc8
-rw-r--r--ext/pdo/tests/pdo_005.phpt18
-rw-r--r--ext/pdo/tests/pdo_009.phpt24
-rw-r--r--ext/pdo/tests/pdo_010.phpt24
-rw-r--r--ext/pdo/tests/pdo_011.phpt44
-rw-r--r--ext/pdo/tests/pdo_012.phpt8
-rw-r--r--ext/pdo/tests/pdo_013.phpt14
-rw-r--r--ext/pdo/tests/pdo_014.phpt36
-rw-r--r--ext/pdo/tests/pdo_016.phpt64
-rw-r--r--ext/pdo/tests/pdo_016a.phpt64
-rw-r--r--ext/pdo/tests/pdo_017.phpt10
-rw-r--r--ext/pdo/tests/pdo_018.phpt134
-rw-r--r--ext/pdo/tests/pdo_019.phpt2
-rw-r--r--ext/pdo/tests/pdo_020.phpt6
-rw-r--r--ext/pdo/tests/pdo_021.phpt2
-rw-r--r--ext/pdo/tests/pdo_023.phpt22
-rw-r--r--ext/pdo/tests/pdo_024.phpt20
-rw-r--r--ext/pdo/tests/pdo_025.phpt10
-rw-r--r--ext/pdo/tests/pdo_026.phpt20
-rw-r--r--ext/pdo/tests/pdo_027.phpt2
-rw-r--r--ext/pdo/tests/pdo_028.phpt2
-rw-r--r--ext/pdo/tests/pdo_029.phpt24
-rw-r--r--ext/pdo/tests/pdo_030.phpt20
-rw-r--r--ext/pdo/tests/pdo_031.phpt2
-rw-r--r--ext/pdo/tests/pdo_034.phpt4
-rw-r--r--ext/pdo/tests/pdo_drivers_error.phpt15
-rw-r--r--ext/pdo/tests/pdo_dsn_containing_credentials.phpt60
-rw-r--r--ext/pdo/tests/pdo_test.inc132
-rw-r--r--ext/pdo/tests/pecl_bug_5217.phpt10
-rw-r--r--ext/pdo/tests/pecl_bug_5772.phpt4
-rw-r--r--ext/pdo_dblib/dblib_driver.c2
-rw-r--r--ext/pdo_dblib/dblib_stmt.c2
-rw-r--r--ext/pdo_dblib/pdo_dblib.c2
-rw-r--r--ext/pdo_dblib/php_pdo_dblib.h2
-rw-r--r--ext/pdo_dblib/php_pdo_dblib_int.h2
-rw-r--r--ext/pdo_dblib/tests/bug_50755.phpt2
-rw-r--r--ext/pdo_dblib/tests/config.inc44
-rw-r--r--ext/pdo_dblib/tests/timeout.phpt42
-rw-r--r--ext/pdo_dblib/tests/types.phpt42
-rw-r--r--ext/pdo_firebird/firebird_driver.c2
-rw-r--r--ext/pdo_firebird/firebird_statement.c2
-rw-r--r--ext/pdo_firebird/pdo_firebird.c2
-rw-r--r--ext/pdo_firebird/php_pdo_firebird.h2
-rw-r--r--ext/pdo_firebird/php_pdo_firebird_int.h2
-rw-r--r--ext/pdo_firebird/tests/bug_48877.phpt2
-rw-r--r--ext/pdo_firebird/tests/bug_73087.phpt14
-rw-r--r--ext/pdo_firebird/tests/bug_76488.phpt6
-rw-r--r--ext/pdo_firebird/tests/bug_77863.phpt4
-rw-r--r--ext/pdo_firebird/tests/connect.phpt6
-rw-r--r--ext/pdo_firebird/tests/ddl.phpt38
-rw-r--r--ext/pdo_firebird/tests/dialect_1.phpt64
-rw-r--r--ext/pdo_firebird/tests/execute.phpt48
-rw-r--r--ext/pdo_firebird/tests/testdb.inc2
-rw-r--r--ext/pdo_mysql/config.m42
-rw-r--r--ext/pdo_mysql/mysql_driver.c2
-rw-r--r--ext/pdo_mysql/mysql_statement.c2
-rw-r--r--ext/pdo_mysql/pdo_mysql.c2
-rw-r--r--ext/pdo_mysql/php_pdo_mysql.h2
-rw-r--r--ext/pdo_mysql/php_pdo_mysql_int.h2
-rw-r--r--ext/pdo_mysql/tests/bug41125.phpt62
-rw-r--r--ext/pdo_mysql/tests/bug44327.phpt50
-rw-r--r--ext/pdo_mysql/tests/bug46292.phpt54
-rw-r--r--ext/pdo_mysql/tests/bug54929.phpt14
-rw-r--r--ext/pdo_mysql/tests/bug63176.phpt22
-rw-r--r--ext/pdo_mysql/tests/bug68371.phpt86
-rw-r--r--ext/pdo_mysql/tests/bug70389.phpt6
-rw-r--r--ext/pdo_mysql/tests/bug70862.phpt38
-rw-r--r--ext/pdo_mysql/tests/bug75177.phpt4
-rw-r--r--ext/pdo_mysql/tests/bug_33689.phpt6
-rw-r--r--ext/pdo_mysql/tests/bug_38546.phpt64
-rw-r--r--ext/pdo_mysql/tests/bug_39858.phpt42
-rw-r--r--ext/pdo_mysql/tests/bug_41125.phpt2
-rw-r--r--ext/pdo_mysql/tests/bug_41997.phpt2
-rw-r--r--ext/pdo_mysql/tests/bug_42499.phpt16
-rw-r--r--ext/pdo_mysql/tests/bug_44454.phpt64
-rw-r--r--ext/pdo_mysql/tests/bug_44707.phpt40
-rw-r--r--ext/pdo_mysql/tests/bug_45120.phpt22
-rw-r--r--ext/pdo_mysql/tests/bug_61207.phpt24
-rw-r--r--ext/pdo_mysql/tests/bug_61411.phpt8
-rw-r--r--ext/pdo_mysql/tests/bug_pecl_12925.phpt22
-rw-r--r--ext/pdo_mysql/tests/bug_pecl_7976.phpt16
-rw-r--r--ext/pdo_mysql/tests/config.inc52
-rw-r--r--ext/pdo_mysql/tests/mysql_pdo_test.inc336
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql___construct.phpt566
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql___construct_ini.phpt74
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql___construct_options.phpt304
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql___construct_options_libmysql.phpt106
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql___construct_uri.phpt106
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_attr_autocommit.phpt120
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_attr_case.phpt112
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_attr_client_version.phpt32
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_attr_connection_status.phpt22
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_attr_driver_name.phpt22
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_attr_errmode.phpt294
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_attr_fetch_table_names.phpt24
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_attr_init_command.phpt34
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_attr_max_buffer_size.phpt82
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_attr_multi_statements.phpt56
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_attr_oracle_nulls.phpt120
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_attr_prefetch.phpt10
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_attr_server_info.phpt76
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_attr_server_version.phpt88
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_attr_statement_class.phpt191
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_begintransaction.phpt246
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_bit.phpt58
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_class_constants.phpt150
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_commit.phpt110
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_connect_charset.phpt30
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_errorcode.phpt108
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_errorinfo.phpt172
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_exec.phpt326
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_exec_ddl.phpt114
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_exec_load_data.phpt158
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_exec_select.phpt70
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_fetch_both.phpt94
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_get_attribute.phpt104
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_interface.phpt80
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_last_insert_id.phpt200
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_multi_stmt_nextrowset.phpt96
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_param_str_natl.phpt2
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_pconnect.phpt172
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_phpinfo.phpt24
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_prepare_emulated.phpt612
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_anonymous.phpt78
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_placeholder_everywhere.phpt74
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_prepare_load_data.phpt166
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_prepare_match_against.phpt40
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_prepare_native.phpt628
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_prepare_native_clear_error.phpt92
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_prepare_native_column.phpt26
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_prepare_native_dup_named_placeholder.phpt168
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_prepare_native_mixed_style.phpt26
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_prepare_native_named_placeholder.phpt90
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_prepare_native_placeholder_everywhere.phpt84
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_rollback.phpt112
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_stmt_bindcolumn.phpt154
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_stmt_bindparam.phpt214
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_stmt_bindparam_types.phpt308
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_stmt_bindvalue.phpt570
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_stmt_blobfromsteam.phpt212
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_stmt_blobs.phpt130
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_stmt_closecursor.phpt268
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_stmt_closecursor_empty.phpt78
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_stmt_columncount.phpt68
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_stmt_errorcode.phpt56
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_stmt_errorinfo.phpt82
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_non_select.phpt346
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize.phpt210
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize_simple.phpt90
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_stmt_fetchobject.phpt72
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_stmt_getcolumnmeta.phpt539
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_stmt_multiquery.phpt62
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_stmt_nextrowset.phpt128
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_stmt_rowcount.phpt26
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_stmt_unbuffered_2050.phpt196
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_stmt_variable_columncount.phpt198
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_subclass.phpt92
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_types.phpt276
-rw-r--r--ext/pdo_mysql/tests/pdo_mysql_types_zerofill.phpt218
-rw-r--r--ext/pdo_mysql/tests/pecl_bug_5200.phpt2
-rw-r--r--ext/pdo_mysql/tests/skipif.inc2
-rw-r--r--ext/pdo_mysql/tests/table.inc4
-rw-r--r--ext/pdo_oci/oci_driver.c40
-rw-r--r--ext/pdo_oci/oci_statement.c4
-rw-r--r--ext/pdo_oci/pdo_oci.c3
-rw-r--r--ext/pdo_oci/php_pdo_oci.h2
-rw-r--r--ext/pdo_oci/php_pdo_oci_int.h5
-rw-r--r--ext/pdo_oci/tests/bug46274.phpt2
-rw-r--r--ext/pdo_oci/tests/bug46274_2.phpt2
-rw-r--r--ext/pdo_oci/tests/bug57702.phpt50
-rw-r--r--ext/pdo_oci/tests/bug_33707.phpt2
-rw-r--r--ext/pdo_oci/tests/pdo_oci_attr_autocommit_2.phpt36
-rw-r--r--ext/pdo_oci/tests/pdo_oci_attr_call_timeout.phpt66
-rw-r--r--ext/pdo_oci/tests/pdo_oci_attr_case.phpt24
-rw-r--r--ext/pdo_oci/tests/pdo_oci_attr_client.phpt24
-rw-r--r--ext/pdo_oci/tests/pdo_oci_attr_nulls_1.phpt14
-rw-r--r--ext/pdo_oci/tests/pdo_oci_attr_server.phpt6
-rw-r--r--ext/pdo_oci/tests/pdo_oci_class_constants.phpt51
-rw-r--r--ext/pdo_oci/tests/pdo_oci_debugdumpparams.phpt37
-rw-r--r--ext/pdo_oci/tests/pdo_oci_fread_1.phpt8
-rw-r--r--ext/pdo_oci/tests/pdo_oci_quote1.phpt18
-rw-r--r--ext/pdo_oci/tests/pdo_oci_stmt_getcolumnmeta.phpt454
-rw-r--r--ext/pdo_oci/tests/pdo_oci_stream_1.phpt8
-rw-r--r--ext/pdo_oci/tests/pdo_oci_stream_2b.phpt12
-rw-r--r--ext/pdo_oci/tests/pecl_bug_6364.phpt2
-rw-r--r--ext/pdo_odbc/odbc_driver.c2
-rw-r--r--ext/pdo_odbc/odbc_stmt.c2
-rw-r--r--ext/pdo_odbc/pdo_odbc.c36
-rw-r--r--ext/pdo_odbc/php_pdo_odbc.h2
-rw-r--r--ext/pdo_odbc/php_pdo_odbc_int.h2
-rw-r--r--ext/pdo_odbc/tests/long_columns.phpt44
-rw-r--r--ext/pdo_odbc/tests/max_columns.phpt26
-rw-r--r--ext/pdo_pgsql/pdo_pgsql.c2
-rw-r--r--ext/pdo_pgsql/pgsql_driver.c26
-rw-r--r--ext/pdo_pgsql/pgsql_statement.c2
-rw-r--r--ext/pdo_pgsql/php_pdo_pgsql.h2
-rw-r--r--ext/pdo_pgsql/php_pdo_pgsql_int.h2
-rw-r--r--ext/pdo_pgsql/tests/bug43925.phpt18
-rw-r--r--ext/pdo_pgsql/tests/bug46274.phpt2
-rw-r--r--ext/pdo_pgsql/tests/bug48764.phpt18
-rw-r--r--ext/pdo_pgsql/tests/bug66584.phpt30
-rw-r--r--ext/pdo_pgsql/tests/bug67462.phpt12
-rw-r--r--ext/pdo_pgsql/tests/bug68371.phpt84
-rw-r--r--ext/pdo_pgsql/tests/bug69344.phpt26
-rw-r--r--ext/pdo_pgsql/tests/bug70313.phpt12
-rw-r--r--ext/pdo_pgsql/tests/bug70861.phpt10
-rw-r--r--ext/pdo_pgsql/tests/bug71885.phpt20
-rw-r--r--ext/pdo_pgsql/tests/bug71885_2.phpt14
-rw-r--r--ext/pdo_pgsql/tests/bug72294.phpt24
-rw-r--r--ext/pdo_pgsql/tests/bug72570.phpt4
-rw-r--r--ext/pdo_pgsql/tests/bug75402.phpt20
-rw-r--r--ext/pdo_pgsql/tests/bug_33876.phpt40
-rw-r--r--ext/pdo_pgsql/tests/config.inc18
-rw-r--r--ext/pdo_pgsql/tests/copy_from.phpt36
-rw-r--r--ext/pdo_pgsql/tests/copy_to.phpt28
-rw-r--r--ext/pdo_pgsql/tests/disable_prepares.phpt4
-rw-r--r--ext/pdo_pgsql/tests/is_in_transaction.phpt14
-rw-r--r--ext/pdo_pgsql/tests/large_objects.phpt20
-rw-r--r--ext/pdo_sqlite/pdo_sqlite.c2
-rw-r--r--ext/pdo_sqlite/php_pdo_sqlite.h2
-rw-r--r--ext/pdo_sqlite/php_pdo_sqlite_int.h2
-rw-r--r--ext/pdo_sqlite/sqlite_driver.c16
-rw-r--r--ext/pdo_sqlite/sqlite_statement.c2
-rw-r--r--ext/pdo_sqlite/tests/bug35336.phpt6
-rw-r--r--ext/pdo_sqlite/tests/bug43831.phpt24
-rw-r--r--ext/pdo_sqlite/tests/bug48773.phpt16
-rw-r--r--ext/pdo_sqlite/tests/bug50728.phpt4
-rw-r--r--ext/pdo_sqlite/tests/bug52487.phpt2
-rw-r--r--ext/pdo_sqlite/tests/bug66033.phpt24
-rw-r--r--ext/pdo_sqlite/tests/bug70862.phpt8
-rw-r--r--ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt49
-rw-r--r--ext/pdo_sqlite/tests/pdo_sqlite_createaggregate.phpt2
-rw-r--r--ext/pdo_sqlite/tests/pdo_sqlite_createaggregate_002.phpt4
-rw-r--r--ext/pdo_sqlite/tests/pdo_sqlite_createcollation.phpt2
-rw-r--r--ext/pdo_sqlite/tests/pdo_sqlite_createfunction.phpt2
-rw-r--r--ext/pdo_sqlite/tests/pdo_sqlite_createfunction_002.phpt2
-rw-r--r--ext/pdo_sqlite/tests/pdo_sqlite_createfunction_with_flags.phpt2
-rw-r--r--ext/pgsql/pgsql.c292
-rw-r--r--ext/pgsql/php_pgsql.h2
-rw-r--r--ext/pgsql/tests/01createdb.phpt18
-rw-r--r--ext/pgsql/tests/02connection.phpt26
-rw-r--r--ext/pgsql/tests/03sync_query.phpt46
-rw-r--r--ext/pgsql/tests/04async_query.phpt18
-rw-r--r--ext/pgsql/tests/05large_object.phpt2
-rw-r--r--ext/pgsql/tests/07optional.phpt6
-rw-r--r--ext/pgsql/tests/08escape.phpt72
-rw-r--r--ext/pgsql/tests/10pg_convert_json_array.phpt8
-rw-r--r--ext/pgsql/tests/15pg_delete.phpt4
-rw-r--r--ext/pgsql/tests/18pg_escape_bytea_before.phpt4
-rw-r--r--ext/pgsql/tests/18pg_escape_bytea_esc.phpt4
-rw-r--r--ext/pgsql/tests/18pg_escape_bytea_hex.phpt4
-rw-r--r--ext/pgsql/tests/22pg_fetch_object.phpt6
-rw-r--r--ext/pgsql/tests/23sync_query_params.phpt66
-rw-r--r--ext/pgsql/tests/24sync_query_prepared.phpt78
-rw-r--r--ext/pgsql/tests/25async_query_params.phpt88
-rw-r--r--ext/pgsql/tests/26async_query_prepared.phpt154
-rw-r--r--ext/pgsql/tests/29nb_async_connect.phpt36
-rw-r--r--ext/pgsql/tests/30nb_async_query_params.phpt24
-rw-r--r--ext/pgsql/tests/31nb_async_query_prepared.phpt38
-rw-r--r--ext/pgsql/tests/32nb_async_query.phpt26
-rw-r--r--ext/pgsql/tests/80_bug14383.phpt2
-rw-r--r--ext/pgsql/tests/80_bug24499.phpt26
-rw-r--r--ext/pgsql/tests/80_bug27597.phpt20
-rw-r--r--ext/pgsql/tests/80_bug32223.phpt6
-rw-r--r--ext/pgsql/tests/80_bug32223b.phpt2
-rw-r--r--ext/pgsql/tests/80_bug36625.phpt10
-rw-r--r--ext/pgsql/tests/80_bug39971.phpt2
-rw-r--r--ext/pgsql/tests/80_bug42783.phpt4
-rw-r--r--ext/pgsql/tests/bug71998.phpt80
-rw-r--r--ext/pgsql/tests/bug72028.phpt4
-rw-r--r--ext/pgsql/tests/bug72197.phpt10
-rw-r--r--ext/pgsql/tests/bug76548.phpt2
-rw-r--r--ext/pgsql/tests/bug77047.phpt6
-rw-r--r--ext/pgsql/tests/lcmess.inc18
-rw-r--r--ext/pgsql/tests/pg_insert_002.phpt2
-rw-r--r--ext/pgsql/tests/pg_update_001.phpt2
-rw-r--r--ext/pgsql/tests/skipif.inc26
-rw-r--r--ext/phar/dirstream.c5
-rw-r--r--ext/phar/func_interceptors.c6
-rw-r--r--ext/phar/phar/clicommand.inc660
-rw-r--r--ext/phar/phar/directorygraphiterator.inc26
-rw-r--r--ext/phar/phar/directorytreeiterator.inc62
-rw-r--r--ext/phar/phar/invertedregexiterator.inc12
-rw-r--r--ext/phar/phar/phar.inc86
-rw-r--r--ext/phar/phar/pharcommand.inc3132
-rw-r--r--ext/phar/phar_object.c925
-rw-r--r--ext/phar/phar_object.stub.php422
-rw-r--r--ext/phar/phar_object_arginfo.h356
-rw-r--r--ext/phar/tests/001.phpt2
-rw-r--r--ext/phar/tests/002.phpt12
-rw-r--r--ext/phar/tests/003.phpt4
-rw-r--r--ext/phar/tests/003a.phpt2
-rw-r--r--ext/phar/tests/011.phpt2
-rw-r--r--ext/phar/tests/013.phpt2
-rw-r--r--ext/phar/tests/014.phpt2
-rw-r--r--ext/phar/tests/016.phpt6
-rw-r--r--ext/phar/tests/016b.phpt2
-rw-r--r--ext/phar/tests/017.phpt2
-rw-r--r--ext/phar/tests/018.phpt4
-rw-r--r--ext/phar/tests/019.phpt8
-rw-r--r--ext/phar/tests/019b.phpt30
-rw-r--r--ext/phar/tests/019c.phpt38
-rw-r--r--ext/phar/tests/023.phpt2
-rw-r--r--ext/phar/tests/024-opcache-win32.phpt20
-rw-r--r--ext/phar/tests/024.phpt2
-rw-r--r--ext/phar/tests/025.phpt2
-rw-r--r--ext/phar/tests/026.phpt2
-rw-r--r--ext/phar/tests/027.phpt36
-rw-r--r--ext/phar/tests/028.phpt2
-rw-r--r--ext/phar/tests/029.phpt6
-rw-r--r--ext/phar/tests/030.phpt2
-rw-r--r--ext/phar/tests/033.phpt2
-rw-r--r--ext/phar/tests/033a.phpt16
-rw-r--r--ext/phar/tests/addfuncs.phpt2
-rw-r--r--ext/phar/tests/alias_acrobatics.phpt2
-rw-r--r--ext/phar/tests/badparameters.phpt283
-rw-r--r--ext/phar/tests/bug13727.phpt12
-rw-r--r--ext/phar/tests/bug13786.phpt16
-rw-r--r--ext/phar/tests/bug45218_SLOWTEST.phpt20
-rw-r--r--ext/phar/tests/bug46032.phpt4
-rw-r--r--ext/phar/tests/bug46060.phpt2
-rw-r--r--ext/phar/tests/bug47085.phpt2
-rw-r--r--ext/phar/tests/bug48377.2.phpt6
-rw-r--r--ext/phar/tests/bug48377.phpt6
-rw-r--r--ext/phar/tests/bug54395.phpt4
-rw-r--r--ext/phar/tests/bug60164.phpt2
-rw-r--r--ext/phar/tests/bug60261.phpt4
-rw-r--r--ext/phar/tests/bug64931/bug64931.phpt27
-rw-r--r--ext/phar/tests/bug65028.phpt236
-rw-r--r--ext/phar/tests/bug69324.phpt2
-rw-r--r--ext/phar/tests/bug69441.phpt4
-rw-r--r--ext/phar/tests/bug69453.phpt4
-rw-r--r--ext/phar/tests/bug69720.phpt8
-rw-r--r--ext/phar/tests/bug70019.phpt2
-rw-r--r--ext/phar/tests/bug71498.phpt2
-rw-r--r--ext/phar/tests/bug72321.phpt2
-rw-r--r--ext/phar/tests/bug72928.phpt2
-rw-r--r--ext/phar/tests/bug73035.phpt2
-rw-r--r--ext/phar/tests/bug73764.phpt2
-rw-r--r--ext/phar/tests/bug73768.phpt2
-rw-r--r--ext/phar/tests/bug74386.phpt2
-rw-r--r--ext/phar/tests/bug77022.phpt20
-rw-r--r--ext/phar/tests/bug77143.phpt2
-rw-r--r--ext/phar/tests/bug77247.phpt2
-rw-r--r--ext/phar/tests/cache_list/copyonwrite4a.phpt2
-rw-r--r--ext/phar/tests/cache_list/files/blog.phar.inc4
-rw-r--r--ext/phar/tests/cache_list/files/phar_oo_test.inc34
-rw-r--r--ext/phar/tests/cache_list/files/phar_test.inc88
-rw-r--r--ext/phar/tests/cache_list/files/write5.phar.inc4
-rw-r--r--ext/phar/tests/cache_list/files/write6.phar.inc4
-rw-r--r--ext/phar/tests/cache_list/frontcontroller22.phpt2
-rw-r--r--ext/phar/tests/cached_manifest_1.phpt4
-rw-r--r--ext/phar/tests/create_new_and_modify.phpt2
-rw-r--r--ext/phar/tests/create_new_phar.phpt6
-rw-r--r--ext/phar/tests/create_new_phar_b.phpt8
-rw-r--r--ext/phar/tests/create_new_phar_c.phpt4
-rw-r--r--ext/phar/tests/create_path_error.phpt47
-rw-r--r--ext/phar/tests/delete.phpt2
-rw-r--r--ext/phar/tests/delete_in_phar.phpt4
-rw-r--r--ext/phar/tests/delete_in_phar_b.phpt2
-rw-r--r--ext/phar/tests/delete_in_phar_confirm.phpt4
-rw-r--r--ext/phar/tests/dir.phpt2
-rw-r--r--ext/phar/tests/fatal_error_webphar.phpt2
-rw-r--r--ext/phar/tests/fgc_edgecases.phpt14
-rw-r--r--ext/phar/tests/files/blog.phar.inc4
-rw-r--r--ext/phar/tests/files/phar_oo_test.inc34
-rw-r--r--ext/phar/tests/files/phar_test.inc88
-rw-r--r--ext/phar/tests/fopen.phpt6
-rw-r--r--ext/phar/tests/fopen_edgecases.phpt14
-rw-r--r--ext/phar/tests/fopen_edgecases2.phpt12
-rw-r--r--ext/phar/tests/frontcontroller22.phpt2
-rw-r--r--ext/phar/tests/include_path.phpt4
-rw-r--r--ext/phar/tests/ini_set_off.phpt2
-rw-r--r--ext/phar/tests/invalid_alias.phpt18
-rw-r--r--ext/phar/tests/invalid_setstubalias.phpt18
-rw-r--r--ext/phar/tests/metadata_read.phpt8
-rw-r--r--ext/phar/tests/metadata_write.phpt8
-rw-r--r--ext/phar/tests/metadata_write_commit.phpt10
-rw-r--r--ext/phar/tests/mkdir.phpt2
-rw-r--r--ext/phar/tests/mounteddir.phpt12
-rw-r--r--ext/phar/tests/nophar.phpt2
-rw-r--r--ext/phar/tests/open_for_write_existing.phpt2
-rw-r--r--ext/phar/tests/open_for_write_existing_b.phpt13
-rw-r--r--ext/phar/tests/open_for_write_existing_c.phpt13
-rw-r--r--ext/phar/tests/open_for_write_newfile.phpt2
-rw-r--r--ext/phar/tests/open_for_write_newfile_b.phpt15
-rw-r--r--ext/phar/tests/open_for_write_newfile_c.phpt15
-rw-r--r--ext/phar/tests/opendir.phpt12
-rw-r--r--ext/phar/tests/opendir_edgecases.phpt12
-rw-r--r--ext/phar/tests/phar_begin_setstub_commit.phpt2
-rw-r--r--ext/phar/tests/phar_buildfromdirectory1.phpt10
-rw-r--r--ext/phar/tests/phar_buildfromdirectory2-win.phpt10
-rw-r--r--ext/phar/tests/phar_buildfromdirectory2.phpt12
-rw-r--r--ext/phar/tests/phar_buildfromdirectory4.phpt14
-rw-r--r--ext/phar/tests/phar_buildfromdirectory5.phpt14
-rw-r--r--ext/phar/tests/phar_buildfromdirectory6.phpt10
-rw-r--r--ext/phar/tests/phar_buildfromiterator1.phpt10
-rw-r--r--ext/phar/tests/phar_buildfromiterator10.phpt20
-rw-r--r--ext/phar/tests/phar_buildfromiterator4.phpt26
-rw-r--r--ext/phar/tests/phar_buildfromiterator5.phpt12
-rw-r--r--ext/phar/tests/phar_buildfromiterator6.phpt12
-rw-r--r--ext/phar/tests/phar_buildfromiterator7.phpt12
-rw-r--r--ext/phar/tests/phar_buildfromiterator8.phpt16
-rw-r--r--ext/phar/tests/phar_buildfromiterator9.phpt14
-rw-r--r--ext/phar/tests/phar_bz2.phpt5
-rw-r--r--ext/phar/tests/phar_commitwrite.phpt12
-rw-r--r--ext/phar/tests/phar_construct_invalidurl.phpt14
-rw-r--r--ext/phar/tests/phar_convert_again.phpt2
-rw-r--r--ext/phar/tests/phar_convert_repeated.phpt2
-rw-r--r--ext/phar/tests/phar_convert_repeated_b.phpt30
-rw-r--r--ext/phar/tests/phar_convert_tar.phpt2
-rw-r--r--ext/phar/tests/phar_convert_tar2.phpt2
-rw-r--r--ext/phar/tests/phar_convert_tar3.phpt2
-rw-r--r--ext/phar/tests/phar_convert_zip.phpt2
-rw-r--r--ext/phar/tests/phar_copy.phpt26
-rw-r--r--ext/phar/tests/phar_create_in_cwd.phpt24
-rw-r--r--ext/phar/tests/phar_createdefaultstub.phpt2
-rw-r--r--ext/phar/tests/phar_ctx_001.phpt2
-rw-r--r--ext/phar/tests/phar_decompress.phpt13
-rw-r--r--ext/phar/tests/phar_dir_iterate.phpt4
-rw-r--r--ext/phar/tests/phar_dotted_path.phpt2
-rw-r--r--ext/phar/tests/phar_extract.phpt43
-rw-r--r--ext/phar/tests/phar_extract2.phpt6
-rw-r--r--ext/phar/tests/phar_extract3.phpt12
-rw-r--r--ext/phar/tests/phar_get_supported_signatures_002.phpt3
-rw-r--r--ext/phar/tests/phar_get_supported_signatures_002a.phpt2
-rw-r--r--ext/phar/tests/phar_get_supportedcomp1.phpt2
-rw-r--r--ext/phar/tests/phar_get_supportedcomp2.phpt2
-rw-r--r--ext/phar/tests/phar_get_supportedcomp3.phpt2
-rw-r--r--ext/phar/tests/phar_get_supportedcomp4.phpt2
-rw-r--r--ext/phar/tests/phar_gobyebye-win32.phpt10
-rw-r--r--ext/phar/tests/phar_gobyebye.phpt10
-rw-r--r--ext/phar/tests/phar_gzip.phpt2
-rw-r--r--ext/phar/tests/phar_isvalidpharfilename.phpt6
-rw-r--r--ext/phar/tests/phar_magic.phpt2
-rw-r--r--ext/phar/tests/phar_metadata_read.phpt16
-rw-r--r--ext/phar/tests/phar_metadata_write.phpt8
-rw-r--r--ext/phar/tests/phar_mount.phpt2
-rw-r--r--ext/phar/tests/phar_offset_check.phpt26
-rw-r--r--ext/phar/tests/phar_offset_get_error.phpt6
-rw-r--r--ext/phar/tests/phar_oo_001.phpt20
-rw-r--r--ext/phar/tests/phar_oo_002.phpt40
-rw-r--r--ext/phar/tests/phar_oo_003.phpt16
-rw-r--r--ext/phar/tests/phar_oo_004.phpt74
-rw-r--r--ext/phar/tests/phar_oo_005.phpt14
-rw-r--r--ext/phar/tests/phar_oo_006.phpt18
-rw-r--r--ext/phar/tests/phar_oo_007.phpt12
-rw-r--r--ext/phar/tests/phar_oo_008.phpt34
-rw-r--r--ext/phar/tests/phar_oo_009.phpt6
-rw-r--r--ext/phar/tests/phar_oo_010.phpt2
-rw-r--r--ext/phar/tests/phar_oo_011.phpt2
-rw-r--r--ext/phar/tests/phar_oo_011b.phpt18
-rw-r--r--ext/phar/tests/phar_oo_012.phpt2
-rw-r--r--ext/phar/tests/phar_oo_012_confirm.phpt2
-rw-r--r--ext/phar/tests/phar_oo_012b.phpt24
-rw-r--r--ext/phar/tests/phar_oo_compressallbz2.phpt2
-rw-r--r--ext/phar/tests/phar_oo_compressallgz.phpt2
-rw-r--r--ext/phar/tests/phar_oo_compressed_001.phpt2
-rw-r--r--ext/phar/tests/phar_oo_compressed_001b.phpt2
-rw-r--r--ext/phar/tests/phar_oo_compressed_002.phpt2
-rw-r--r--ext/phar/tests/phar_oo_compressed_002b.phpt2
-rw-r--r--ext/phar/tests/phar_oo_getcontents.phpt6
-rw-r--r--ext/phar/tests/phar_oo_getcontentsgz.phpt2
-rw-r--r--ext/phar/tests/phar_oo_getmodified.phpt2
-rw-r--r--ext/phar/tests/phar_oo_iswriteable.phpt2
-rw-r--r--ext/phar/tests/phar_oo_nosig.phpt2
-rw-r--r--ext/phar/tests/phar_oo_uncompressall.phpt2
-rw-r--r--ext/phar/tests/phar_running.phpt4
-rw-r--r--ext/phar/tests/phar_setalias.phpt2
-rw-r--r--ext/phar/tests/phar_setalias2.phpt10
-rw-r--r--ext/phar/tests/phar_setdefaultstub.phpt16
-rw-r--r--ext/phar/tests/phar_setsignaturealgo2.phpt2
-rw-r--r--ext/phar/tests/phar_stub.phpt6
-rw-r--r--ext/phar/tests/phar_stub_error.phpt6
-rw-r--r--ext/phar/tests/phar_stub_write.phpt2
-rw-r--r--ext/phar/tests/phar_stub_write_file.phpt2
-rw-r--r--ext/phar/tests/phar_unlinkarchive.phpt11
-rw-r--r--ext/phar/tests/pharfileinfo_chmod.phpt5
-rw-r--r--ext/phar/tests/pharfileinfo_compression.phpt4
-rw-r--r--ext/phar/tests/pharfileinfo_construct.phpt2
-rw-r--r--ext/phar/tests/pharfileinfo_getcrc32.phpt4
-rw-r--r--ext/phar/tests/pharfileinfo_setmetadata.phpt6
-rw-r--r--ext/phar/tests/phpinfo_001.phpt2
-rw-r--r--ext/phar/tests/phpinfo_002.phpt2
-rw-r--r--ext/phar/tests/phpinfo_003.phpt2
-rw-r--r--ext/phar/tests/readfile_edgecases.phpt6
-rw-r--r--ext/phar/tests/refcount1.phpt2
-rw-r--r--ext/phar/tests/rename.phpt2
-rw-r--r--ext/phar/tests/rename_dir.phpt2
-rw-r--r--ext/phar/tests/security.phpt2
-rw-r--r--ext/phar/tests/stat.phpt2
-rw-r--r--ext/phar/tests/stat2_5.3.phpt7
-rw-r--r--ext/phar/tests/tar/033.phpt26
-rw-r--r--ext/phar/tests/tar/033a.phpt26
-rw-r--r--ext/phar/tests/tar/alias_acrobatics.phpt2
-rw-r--r--ext/phar/tests/tar/all.phpt2
-rw-r--r--ext/phar/tests/tar/badalias.phpt2
-rw-r--r--ext/phar/tests/tar/badchecksum.phpt6
-rw-r--r--ext/phar/tests/tar/bignames.phpt18
-rw-r--r--ext/phar/tests/tar/bignames_overflow.phpt4
-rw-r--r--ext/phar/tests/tar/bug49910.phpt4
-rw-r--r--ext/phar/tests/tar/bug64343.phpt2
-rw-r--r--ext/phar/tests/tar/bug67761.phpt4
-rw-r--r--ext/phar/tests/tar/bug71317-duplicate-filename.phpt18
-rw-r--r--ext/phar/tests/tar/bug71504.phpt4
-rw-r--r--ext/phar/tests/tar/create_new_and_modify.phpt2
-rw-r--r--ext/phar/tests/tar/create_new_phar_b.phpt8
-rw-r--r--ext/phar/tests/tar/delete.phpt2
-rw-r--r--ext/phar/tests/tar/delete_in_phar.phpt4
-rw-r--r--ext/phar/tests/tar/delete_in_phar_b.phpt2
-rw-r--r--ext/phar/tests/tar/delete_in_phar_confirm.phpt4
-rw-r--r--ext/phar/tests/tar/exists_as_phar.phpt6
-rw-r--r--ext/phar/tests/tar/files/corrupt_tarmaker.php.inc2
-rw-r--r--ext/phar/tests/tar/files/make_invalid_tar.php.inc4
-rw-r--r--ext/phar/tests/tar/links.phpt6
-rw-r--r--ext/phar/tests/tar/links2.phpt6
-rw-r--r--ext/phar/tests/tar/links3.phpt6
-rw-r--r--ext/phar/tests/tar/links4.phpt6
-rw-r--r--ext/phar/tests/tar/links5.phpt6
-rw-r--r--ext/phar/tests/tar/links6.phpt2
-rw-r--r--ext/phar/tests/tar/open_for_write_existing.phpt4
-rw-r--r--ext/phar/tests/tar/open_for_write_existing_b.phpt15
-rw-r--r--ext/phar/tests/tar/open_for_write_existing_c.phpt15
-rw-r--r--ext/phar/tests/tar/open_for_write_newfile.phpt4
-rw-r--r--ext/phar/tests/tar/open_for_write_newfile_b.phpt17
-rw-r--r--ext/phar/tests/tar/open_for_write_newfile_c.phpt17
-rw-r--r--ext/phar/tests/tar/phar_begin_setstub_commit.phpt2
-rw-r--r--ext/phar/tests/tar/phar_buildfromiterator4.phpt14
-rw-r--r--ext/phar/tests/tar/phar_buildfromiterator5.phpt12
-rw-r--r--ext/phar/tests/tar/phar_buildfromiterator6.phpt12
-rw-r--r--ext/phar/tests/tar/phar_buildfromiterator7.phpt12
-rw-r--r--ext/phar/tests/tar/phar_buildfromiterator8.phpt18
-rw-r--r--ext/phar/tests/tar/phar_buildfromiterator9.phpt14
-rw-r--r--ext/phar/tests/tar/phar_commitwrite.phpt12
-rw-r--r--ext/phar/tests/tar/phar_convert_phar.phpt2
-rw-r--r--ext/phar/tests/tar/phar_convert_phar2.phpt2
-rw-r--r--ext/phar/tests/tar/phar_convert_phar3.phpt2
-rw-r--r--ext/phar/tests/tar/phar_convert_phar4.phpt2
-rw-r--r--ext/phar/tests/tar/phar_copy.phpt22
-rw-r--r--ext/phar/tests/tar/phar_magic.phpt2
-rw-r--r--ext/phar/tests/tar/phar_setalias.phpt4
-rw-r--r--ext/phar/tests/tar/phar_setalias2.phpt8
-rw-r--r--ext/phar/tests/tar/phar_setdefaultstub.phpt24
-rw-r--r--ext/phar/tests/tar/phar_setsignaturealgo2.phpt2
-rw-r--r--ext/phar/tests/tar/phar_stub.phpt2
-rw-r--r--ext/phar/tests/tar/phar_stub_error.phpt6
-rw-r--r--ext/phar/tests/tar/refcount1.phpt4
-rw-r--r--ext/phar/tests/tar/rename.phpt4
-rw-r--r--ext/phar/tests/tar/rename_dir.phpt4
-rw-r--r--ext/phar/tests/tar/require_hash.phpt20
-rw-r--r--ext/phar/tests/tar/rmdir.phpt2
-rw-r--r--ext/phar/tests/tar/tar_001.phpt10
-rw-r--r--ext/phar/tests/tar/tar_002.phpt10
-rw-r--r--ext/phar/tests/tar/tar_003.phpt10
-rw-r--r--ext/phar/tests/tar/tar_004.phpt2
-rw-r--r--ext/phar/tests/tar/tar_bz2.phpt2
-rw-r--r--ext/phar/tests/tar/tar_gzip.phpt2
-rw-r--r--ext/phar/tests/tar/tar_makebz2.phpt2
-rw-r--r--ext/phar/tests/tar/tar_makegz.phpt2
-rw-r--r--ext/phar/tests/tar/tar_nohash.phpt8
-rw-r--r--ext/phar/tests/tar/tar_nostub.phpt16
-rw-r--r--ext/phar/tests/tar/tar_openssl_hash.phpt4
-rw-r--r--ext/phar/tests/tar/truncated.phpt6
-rw-r--r--ext/phar/tests/test_alias_unset.phpt4
-rw-r--r--ext/phar/tests/test_signaturealgos.phpt2
-rw-r--r--ext/phar/tests/test_unset.phpt2
-rw-r--r--ext/phar/tests/withphar.phpt2
-rw-r--r--ext/phar/tests/zf_test.phpt2
-rw-r--r--ext/phar/tests/zip/033.phpt34
-rw-r--r--ext/phar/tests/zip/033a.phpt26
-rw-r--r--ext/phar/tests/zip/alias_acrobatics.phpt2
-rw-r--r--ext/phar/tests/zip/all.phpt2
-rw-r--r--ext/phar/tests/zip/badalias.phpt2
-rw-r--r--ext/phar/tests/zip/bug48791.phpt2
-rw-r--r--ext/phar/tests/zip/bzip2.phpt16
-rw-r--r--ext/phar/tests/zip/corrupt_001.phpt10
-rw-r--r--ext/phar/tests/zip/corrupt_002.phpt6
-rw-r--r--ext/phar/tests/zip/corrupt_003.phpt6
-rw-r--r--ext/phar/tests/zip/corrupt_004.phpt6
-rw-r--r--ext/phar/tests/zip/corrupt_005.phpt6
-rw-r--r--ext/phar/tests/zip/corrupt_006.phpt6
-rw-r--r--ext/phar/tests/zip/corrupt_007.phpt6
-rw-r--r--ext/phar/tests/zip/corrupt_008.phpt62
-rw-r--r--ext/phar/tests/zip/corrupt_009.phpt6
-rw-r--r--ext/phar/tests/zip/corrupt_010.phpt6
-rw-r--r--ext/phar/tests/zip/create_new_and_modify.phpt2
-rw-r--r--ext/phar/tests/zip/create_new_phar_b.phpt8
-rw-r--r--ext/phar/tests/zip/delete.phpt2
-rw-r--r--ext/phar/tests/zip/delete_in_phar.phpt4
-rw-r--r--ext/phar/tests/zip/delete_in_phar_b.phpt2
-rw-r--r--ext/phar/tests/zip/delete_in_phar_confirm.phpt4
-rw-r--r--ext/phar/tests/zip/exists_as_phar.phpt6
-rw-r--r--ext/phar/tests/zip/files/corrupt_zipmaker.php.inc560
-rw-r--r--ext/phar/tests/zip/files/make_invalid_tar.php.inc10
-rw-r--r--ext/phar/tests/zip/getalias.phpt2
-rw-r--r--ext/phar/tests/zip/largezip.phpt2
-rw-r--r--ext/phar/tests/zip/metadata_write_commit.phpt10
-rw-r--r--ext/phar/tests/zip/notphar.phpt2
-rw-r--r--ext/phar/tests/zip/odt.phpt16
-rw-r--r--ext/phar/tests/zip/open_for_write_existing.phpt4
-rw-r--r--ext/phar/tests/zip/open_for_write_existing_b.phpt15
-rw-r--r--ext/phar/tests/zip/open_for_write_existing_c.phpt15
-rw-r--r--ext/phar/tests/zip/open_for_write_newfile.phpt4
-rw-r--r--ext/phar/tests/zip/open_for_write_newfile_b.phpt17
-rw-r--r--ext/phar/tests/zip/open_for_write_newfile_c.phpt17
-rw-r--r--ext/phar/tests/zip/phar_begin_setstub_commit.phpt2
-rw-r--r--ext/phar/tests/zip/phar_buildfromiterator4.phpt14
-rw-r--r--ext/phar/tests/zip/phar_buildfromiterator5.phpt12
-rw-r--r--ext/phar/tests/zip/phar_buildfromiterator6.phpt12
-rw-r--r--ext/phar/tests/zip/phar_buildfromiterator7.phpt12
-rw-r--r--ext/phar/tests/zip/phar_buildfromiterator8.phpt18
-rw-r--r--ext/phar/tests/zip/phar_buildfromiterator9.phpt14
-rw-r--r--ext/phar/tests/zip/phar_commitwrite.phpt12
-rw-r--r--ext/phar/tests/zip/phar_convert_phar.phpt2
-rw-r--r--ext/phar/tests/zip/phar_copy.phpt22
-rw-r--r--ext/phar/tests/zip/phar_magic.phpt2
-rw-r--r--ext/phar/tests/zip/phar_oo_compressallbz2.phpt2
-rw-r--r--ext/phar/tests/zip/phar_oo_compressallgz.phpt2
-rw-r--r--ext/phar/tests/zip/phar_setalias.phpt4
-rw-r--r--ext/phar/tests/zip/phar_setalias2.phpt8
-rw-r--r--ext/phar/tests/zip/phar_setdefaultstub.phpt24
-rw-r--r--ext/phar/tests/zip/phar_setsignaturealgo2.phpt2
-rw-r--r--ext/phar/tests/zip/phar_stub.phpt2
-rw-r--r--ext/phar/tests/zip/phar_stub_error.phpt6
-rw-r--r--ext/phar/tests/zip/refcount1.phpt4
-rw-r--r--ext/phar/tests/zip/rename.phpt2
-rw-r--r--ext/phar/tests/zip/rename_dir.phpt2
-rw-r--r--ext/phar/tests/zip/unixzip.phpt16
-rw-r--r--ext/phar/tests/zip/zlib.phpt8
-rw-r--r--ext/posix/php_posix.h2
-rw-r--r--ext/posix/posix.c237
-rw-r--r--ext/posix/posix.stub.php102
-rw-r--r--ext/posix/posix_arginfo.h159
-rw-r--r--ext/posix/tests/bug75696.phpt2
-rw-r--r--ext/posix/tests/posix_ctermid.phpt2
-rw-r--r--ext/posix/tests/posix_errno_error.phpt24
-rw-r--r--ext/posix/tests/posix_getcwd.phpt4
-rw-r--r--ext/posix/tests/posix_getgrgid.phpt2
-rw-r--r--ext/posix/tests/posix_getgrgid_basic.phpt6
-rw-r--r--ext/posix/tests/posix_getgrgid_error.phpt21
-rw-r--r--ext/posix/tests/posix_getgrgid_macosx.phpt2
-rw-r--r--ext/posix/tests/posix_getgroups_basic.phpt6
-rw-r--r--ext/posix/tests/posix_getpgid_error.phpt18
-rw-r--r--ext/posix/tests/posix_getpwuid_error.phpt18
-rw-r--r--ext/posix/tests/posix_getsid.phpt2
-rw-r--r--ext/posix/tests/posix_getsid_error.phpt9
-rw-r--r--ext/posix/tests/posix_initgroups.phpt3
-rw-r--r--ext/posix/tests/posix_kill_basic.phpt28
-rw-r--r--ext/posix/tests/posix_kill_error.phpt20
-rw-r--r--ext/posix/tests/posix_seteuid_variation4.phpt46
-rw-r--r--ext/posix/tests/posix_setgid_basic.phpt2
-rw-r--r--ext/posix/tests/posix_setgid_variation2.phpt2
-rw-r--r--ext/posix/tests/posix_setgid_variation4.phpt46
-rw-r--r--ext/posix/tests/posix_setgid_variation5.phpt2
-rw-r--r--ext/posix/tests/posix_setuid_variation4.phpt46
-rw-r--r--ext/posix/tests/posix_strerror_error.phpt18
-rw-r--r--ext/posix/tests/posix_times.phpt2
-rw-r--r--ext/posix/tests/posix_times_basic.phpt4
-rw-r--r--ext/posix/tests/posix_ttyname.phpt2
-rw-r--r--ext/posix/tests/posix_ttyname_error_wrongparams.phpt30
-rw-r--r--ext/posix/tests/posix_ttyname_variation6.phpt2
-rw-r--r--ext/pspell/php_pspell.h2
-rw-r--r--ext/pspell/pspell.c141
-rw-r--r--ext/pspell/pspell.stub.php39
-rw-r--r--ext/pspell/pspell_arginfo.h92
-rw-r--r--ext/pspell/tests/002.phpt16
-rw-r--r--ext/readline/php_readline.h2
-rw-r--r--ext/readline/readline.c93
-rw-r--r--ext/readline/readline.stub.php41
-rw-r--r--ext/readline/readline_arginfo.h58
-rw-r--r--ext/readline/readline_cli.c2
-rw-r--r--ext/readline/readline_cli.h2
-rw-r--r--ext/readline/tests/bug77812-libedit.phpt5
-rw-r--r--ext/readline/tests/bug77812-readline.phpt5
-rw-r--r--ext/readline/tests/libedit_callback_handler_install_001.phpt6
-rw-r--r--ext/readline/tests/readline_add_history_001.phpt4
-rw-r--r--ext/readline/tests/readline_callback_handler_install_001.phpt6
-rw-r--r--ext/readline/tests/readline_clear_history_001.phpt4
-rw-r--r--ext/readline/tests/readline_completion_function_001.phpt10
-rw-r--r--ext/readline/tests/readline_list_history_001.phpt4
-rw-r--r--ext/reflection/php_reflection.c1641
-rw-r--r--ext/reflection/php_reflection.h2
-rw-r--r--ext/reflection/php_reflection.stub.php647
-rw-r--r--ext/reflection/php_reflection_arginfo.h495
-rw-r--r--ext/reflection/tests/001.phpt30
-rw-r--r--ext/reflection/tests/002.phpt20
-rw-r--r--ext/reflection/tests/003.phpt18
-rw-r--r--ext/reflection/tests/004.phpt14
-rw-r--r--ext/reflection/tests/005.phpt18
-rw-r--r--ext/reflection/tests/006.phpt105
-rw-r--r--ext/reflection/tests/007.phpt117
-rw-r--r--ext/reflection/tests/008.phpt20
-rw-r--r--ext/reflection/tests/009.phpt2
-rw-r--r--ext/reflection/tests/010.phpt10
-rw-r--r--ext/reflection/tests/012.phpt2
-rw-r--r--ext/reflection/tests/017.phpt2
-rw-r--r--ext/reflection/tests/020.phpt14
-rw-r--r--ext/reflection/tests/021.phpt2
-rw-r--r--ext/reflection/tests/022.phpt2
-rw-r--r--ext/reflection/tests/023.phpt12
-rw-r--r--ext/reflection/tests/024.phpt6
-rw-r--r--ext/reflection/tests/025.phpt2
-rw-r--r--ext/reflection/tests/027.phpt6
-rw-r--r--ext/reflection/tests/028.phpt6
-rw-r--r--ext/reflection/tests/ReflectionClass_constructor_001.phpt8
-rw-r--r--ext/reflection/tests/ReflectionClass_constructor_002.phpt47
-rw-r--r--ext/reflection/tests/ReflectionClass_export_array_bug72222.phpt4
-rw-r--r--ext/reflection/tests/ReflectionClass_export_basic1.phpt22
-rw-r--r--ext/reflection/tests/ReflectionClass_export_basic2.phpt4
-rw-r--r--ext/reflection/tests/ReflectionClass_getConstant_basic.phpt12
-rw-r--r--ext/reflection/tests/ReflectionClass_getConstant_error.phpt20
-rw-r--r--ext/reflection/tests/ReflectionClass_getConstants_basic.phpt10
-rw-r--r--ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt76
-rw-r--r--ext/reflection/tests/ReflectionClass_getDefaultProperties_001.phpt82
-rw-r--r--ext/reflection/tests/ReflectionClass_getDocComment_001.phpt14
-rw-r--r--ext/reflection/tests/ReflectionClass_getExtensionName_basic.phpt4
-rw-r--r--ext/reflection/tests/ReflectionClass_getExtensionName_variation.phpt14
-rw-r--r--ext/reflection/tests/ReflectionClass_getExtension_basic.phpt4
-rw-r--r--ext/reflection/tests/ReflectionClass_getExtension_variation.phpt14
-rw-r--r--ext/reflection/tests/ReflectionClass_getInterfaces_001.phpt16
-rw-r--r--ext/reflection/tests/ReflectionClass_getMethod_001.phpt54
-rw-r--r--ext/reflection/tests/ReflectionClass_getMethod_002.phpt60
-rw-r--r--ext/reflection/tests/ReflectionClass_getMethods_001.phpt20
-rw-r--r--ext/reflection/tests/ReflectionClass_getMethods_003.phpt16
-rw-r--r--ext/reflection/tests/ReflectionClass_getModifierNames_basic.phpt38
-rw-r--r--ext/reflection/tests/ReflectionClass_getModifiers_basic.phpt4
-rw-r--r--ext/reflection/tests/ReflectionClass_getName_basic.phpt8
-rw-r--r--ext/reflection/tests/ReflectionClass_getParentClass.phpt7
-rw-r--r--ext/reflection/tests/ReflectionClass_getParentClass_001.phpt38
-rw-r--r--ext/reflection/tests/ReflectionClass_getProperties_001.phpt20
-rw-r--r--ext/reflection/tests/ReflectionClass_getProperties_003.phpt16
-rw-r--r--ext/reflection/tests/ReflectionClass_getProperty_001.phpt78
-rw-r--r--ext/reflection/tests/ReflectionClass_getProperty_002.phpt60
-rw-r--r--ext/reflection/tests/ReflectionClass_getProperty_003.phpt84
-rw-r--r--ext/reflection/tests/ReflectionClass_getProperty_004.phpt84
-rw-r--r--ext/reflection/tests/ReflectionClass_getStaticPropertyValue_001.phpt24
-rw-r--r--ext/reflection/tests/ReflectionClass_getStaticPropertyValue_002.phpt41
-rw-r--r--ext/reflection/tests/ReflectionClass_hasConstant_001.phpt6
-rw-r--r--ext/reflection/tests/ReflectionClass_hasConstant_002.phpt20
-rw-r--r--ext/reflection/tests/ReflectionClass_hasMethod_001.phpt46
-rw-r--r--ext/reflection/tests/ReflectionClass_hasMethod_002.phpt20
-rw-r--r--ext/reflection/tests/ReflectionClass_hasProperty_001.phpt46
-rw-r--r--ext/reflection/tests/ReflectionClass_hasProperty_002.phpt18
-rw-r--r--ext/reflection/tests/ReflectionClass_implementsInterface_001.phpt64
-rw-r--r--ext/reflection/tests/ReflectionClass_isCloneable_001.phpt4
-rw-r--r--ext/reflection/tests/ReflectionClass_isInstance_basic.phpt16
-rw-r--r--ext/reflection/tests/ReflectionClass_isInstantiable_basic.phpt16
-rw-r--r--ext/reflection/tests/ReflectionClass_isInstantiable_variation.phpt41
-rw-r--r--ext/reflection/tests/ReflectionClass_isInternal_basic.phpt2
-rw-r--r--ext/reflection/tests/ReflectionClass_isIterateable_001.phpt57
-rw-r--r--ext/reflection/tests/ReflectionClass_isIterateable_basic.phpt20
-rw-r--r--ext/reflection/tests/ReflectionClass_isIterateable_variation1.phpt4
-rw-r--r--ext/reflection/tests/ReflectionClass_isSubclassOf_002.phpt34
-rw-r--r--ext/reflection/tests/ReflectionClass_isSubclassOf_basic.phpt16
-rw-r--r--ext/reflection/tests/ReflectionClass_isUserDefined_basic.phpt2
-rw-r--r--ext/reflection/tests/ReflectionClass_modifiers_001.phpt10
-rw-r--r--ext/reflection/tests/ReflectionClass_newInstanceArgs_001.phpt69
-rw-r--r--ext/reflection/tests/ReflectionClass_newInstanceArgs_002.phpt10
-rw-r--r--ext/reflection/tests/ReflectionClass_newInstance_001.phpt63
-rw-r--r--ext/reflection/tests/ReflectionClass_setStaticPropertyValue_001.phpt24
-rw-r--r--ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt51
-rw-r--r--ext/reflection/tests/ReflectionClass_setStaticPropertyValue_003.phpt6
-rw-r--r--ext/reflection/tests/ReflectionClass_toString_001.phpt28
-rw-r--r--ext/reflection/tests/ReflectionClass_toString_002.phpt12
-rw-r--r--ext/reflection/tests/ReflectionClass_toString_003.phpt12
-rw-r--r--ext/reflection/tests/ReflectionExtension_bug66218.phpt1
-rw-r--r--ext/reflection/tests/ReflectionExtension_constructor_basic.phpt2
-rw-r--r--ext/reflection/tests/ReflectionExtension_constructor_error.phpt14
-rw-r--r--ext/reflection/tests/ReflectionExtension_export_basic.phpt2
-rw-r--r--ext/reflection/tests/ReflectionExtension_getClassNames_basic.phpt2
-rw-r--r--ext/reflection/tests/ReflectionExtension_getClassNames_variation1.phpt2
-rw-r--r--ext/reflection/tests/ReflectionExtension_getClasses_basic.phpt25
-rw-r--r--ext/reflection/tests/ReflectionExtension_getDependencies_basic.phpt2
-rw-r--r--ext/reflection/tests/ReflectionExtension_getDependencies_variation2.phpt2
-rw-r--r--ext/reflection/tests/ReflectionExtension_getName_basic.phpt2
-rw-r--r--ext/reflection/tests/ReflectionExtension_getVersion_basic.phpt2
-rw-r--r--ext/reflection/tests/ReflectionExtension_info_basic.phpt2
-rw-r--r--ext/reflection/tests/ReflectionExtension_isPersistant.phpt2
-rw-r--r--ext/reflection/tests/ReflectionExtension_isTemporary.phpt2
-rw-r--r--ext/reflection/tests/ReflectionFunction_001.phpt22
-rw-r--r--ext/reflection/tests/ReflectionFunction_construct.001.phpt22
-rw-r--r--ext/reflection/tests/ReflectionFunction_getClosureScopeClass.phpt6
-rw-r--r--ext/reflection/tests/ReflectionFunction_getClosure_basic.phpt6
-rw-r--r--ext/reflection/tests/ReflectionFunction_getDocComment.001.phpt12
-rw-r--r--ext/reflection/tests/ReflectionFunction_getFileName.002.phpt12
-rw-r--r--ext/reflection/tests/ReflectionFunction_isGenerator_basic.phpt18
-rw-r--r--ext/reflection/tests/ReflectionGenerator_basic.phpt38
-rw-r--r--ext/reflection/tests/ReflectionGenerator_getTrace.phpt4
-rw-r--r--ext/reflection/tests/ReflectionGenerator_in_Generator.phpt34
-rw-r--r--ext/reflection/tests/ReflectionMethod_006.phpt82
-rw-r--r--ext/reflection/tests/ReflectionMethod_basic2.phpt4
-rw-r--r--ext/reflection/tests/ReflectionMethod_constructor_basic.phpt70
-rw-r--r--ext/reflection/tests/ReflectionMethod_constructor_error1.phpt48
-rw-r--r--ext/reflection/tests/ReflectionMethod_constructor_error2.phpt30
-rw-r--r--ext/reflection/tests/ReflectionMethod_defaultArg.phpt6
-rw-r--r--ext/reflection/tests/ReflectionMethod_getClosureThis.phpt18
-rw-r--r--ext/reflection/tests/ReflectionMethod_getClosure_basic.phpt20
-rw-r--r--ext/reflection/tests/ReflectionMethod_getClosure_error.phpt45
-rw-r--r--ext/reflection/tests/ReflectionMethod_getDocComment_basic.phpt2
-rw-r--r--ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt16
-rw-r--r--ext/reflection/tests/ReflectionMethod_invokeArgs_error2.phpt2
-rw-r--r--ext/reflection/tests/ReflectionMethod_invokeArgs_error3.phpt40
-rw-r--r--ext/reflection/tests/ReflectionMethod_invoke_basic.phpt32
-rw-r--r--ext/reflection/tests/ReflectionMethod_invoke_error1.phpt6
-rw-r--r--ext/reflection/tests/ReflectionNamedType.phpt22
-rw-r--r--ext/reflection/tests/ReflectionObject___toString_basic1.phpt2
-rw-r--r--ext/reflection/tests/ReflectionObject___toString_basic2.phpt2
-rw-r--r--ext/reflection/tests/ReflectionObject_export_basic1.phpt2
-rw-r--r--ext/reflection/tests/ReflectionObject_export_basic2.phpt2
-rw-r--r--ext/reflection/tests/ReflectionObject_export_basic3.phpt2
-rw-r--r--ext/reflection/tests/ReflectionObject_getConstant_basic.phpt12
-rw-r--r--ext/reflection/tests/ReflectionObject_getConstants_basic.phpt10
-rw-r--r--ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt62
-rw-r--r--ext/reflection/tests/ReflectionObject_getName_basic.phpt4
-rw-r--r--ext/reflection/tests/ReflectionObject_isInstance_basic.phpt14
-rw-r--r--ext/reflection/tests/ReflectionObject_isInstantiable_basic.phpt16
-rw-r--r--ext/reflection/tests/ReflectionObject_isInstantiable_variation.phpt83
-rw-r--r--ext/reflection/tests/ReflectionObject_isInternal_basic.phpt2
-rw-r--r--ext/reflection/tests/ReflectionObject_isSubclassOf.002.phpt34
-rw-r--r--ext/reflection/tests/ReflectionObject_isSubclassOf_basic.phpt30
-rw-r--r--ext/reflection/tests/ReflectionObject_isSubclassOf_error.phpt14
-rw-r--r--ext/reflection/tests/ReflectionObject_isUserDefined_basic.phpt2
-rw-r--r--ext/reflection/tests/ReflectionParameter_001.phpt22
-rw-r--r--ext/reflection/tests/ReflectionParameter_002.phpt12
-rw-r--r--ext/reflection/tests/ReflectionParameter_003.phpt46
-rw-r--r--ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic1.phpt30
-rw-r--r--ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic2.phpt28
-rw-r--r--ext/reflection/tests/ReflectionParameter_DefaultValueConstant_error.phpt14
-rw-r--r--ext/reflection/tests/ReflectionParameter_export_basic.phpt6
-rw-r--r--ext/reflection/tests/ReflectionParameter_export_error2.phpt18
-rw-r--r--ext/reflection/tests/ReflectionParameter_export_error3.phpt4
-rw-r--r--ext/reflection/tests/ReflectionParameter_getDeclaringFunction_basic.phpt6
-rw-r--r--ext/reflection/tests/ReflectionParameter_getPosition_basic.phpt6
-rw-r--r--ext/reflection/tests/ReflectionParameter_invalidMethodInConstructor.phpt14
-rw-r--r--ext/reflection/tests/ReflectionParameter_isDefault.phpt2
-rw-r--r--ext/reflection/tests/ReflectionParameter_toString_basic.phpt6
-rw-r--r--ext/reflection/tests/ReflectionProperty_constructor_variation1.phpt38
-rw-r--r--ext/reflection/tests/ReflectionProperty_error.phpt45
-rw-r--r--ext/reflection/tests/ReflectionProperty_export_error.phpt14
-rw-r--r--ext/reflection/tests/ReflectionProperty_getDeclaringClass_variation1.phpt6
-rw-r--r--ext/reflection/tests/ReflectionProperty_getDefaultValue.phpt73
-rw-r--r--ext/reflection/tests/ReflectionProperty_getModifiers.001.phpt16
-rw-r--r--ext/reflection/tests/ReflectionProperty_getValue_error.phpt61
-rw-r--r--ext/reflection/tests/ReflectionProperty_hasDefaultValue.phpt60
-rw-r--r--ext/reflection/tests/ReflectionProperty_isDefault_basic.phpt7
-rw-r--r--ext/reflection/tests/ReflectionProperty_isInitialized.phpt19
-rw-r--r--ext/reflection/tests/ReflectionProperty_setValue_error.phpt59
-rw-r--r--ext/reflection/tests/ReflectionProperty_typed_static.phpt2
-rw-r--r--ext/reflection/tests/ReflectionType_001.phpt22
-rw-r--r--ext/reflection/tests/ReflectionZendExtension_error.phpt2
-rw-r--r--ext/reflection/tests/bug26640.phpt16
-rw-r--r--ext/reflection/tests/bug26695.phpt2
-rw-r--r--ext/reflection/tests/bug29268.phpt12
-rw-r--r--ext/reflection/tests/bug29523.phpt18
-rw-r--r--ext/reflection/tests/bug29828.phpt12
-rw-r--r--ext/reflection/tests/bug30146.phpt2
-rw-r--r--ext/reflection/tests/bug30148.phpt36
-rw-r--r--ext/reflection/tests/bug30209.phpt26
-rw-r--r--ext/reflection/tests/bug30856.phpt2
-rw-r--r--ext/reflection/tests/bug31651.phpt2
-rw-r--r--ext/reflection/tests/bug32981.phpt14
-rw-r--r--ext/reflection/tests/bug36434.phpt18
-rw-r--r--ext/reflection/tests/bug37816.phpt8
-rw-r--r--ext/reflection/tests/bug37964.phpt18
-rw-r--r--ext/reflection/tests/bug38132.phpt4
-rw-r--r--ext/reflection/tests/bug38217.phpt14
-rw-r--r--ext/reflection/tests/bug38653.phpt6
-rw-r--r--ext/reflection/tests/bug38942.phpt35
-rw-r--r--ext/reflection/tests/bug39001.phpt4
-rw-r--r--ext/reflection/tests/bug39067.phpt10
-rw-r--r--ext/reflection/tests/bug40431.phpt2
-rw-r--r--ext/reflection/tests/bug40794.phpt2
-rw-r--r--ext/reflection/tests/bug41061.phpt3
-rw-r--r--ext/reflection/tests/bug41884.phpt4
-rw-r--r--ext/reflection/tests/bug42976.phpt6
-rw-r--r--ext/reflection/tests/bug45139.phpt14
-rw-r--r--ext/reflection/tests/bug45571.phpt10
-rw-r--r--ext/reflection/tests/bug45765.phpt20
-rw-r--r--ext/reflection/tests/bug46064.phpt22
-rw-r--r--ext/reflection/tests/bug46064_2.phpt24
-rw-r--r--ext/reflection/tests/bug46205.phpt2
-rw-r--r--ext/reflection/tests/bug47254.phpt9
-rw-r--r--ext/reflection/tests/bug48757.phpt4
-rw-r--r--ext/reflection/tests/bug49074.phpt8
-rw-r--r--ext/reflection/tests/bug49719.phpt22
-rw-r--r--ext/reflection/tests/bug51905.phpt6
-rw-r--r--ext/reflection/tests/bug52854.phpt4
-rw-r--r--ext/reflection/tests/bug53366.phpt2
-rw-r--r--ext/reflection/tests/bug53915.phpt4
-rw-r--r--ext/reflection/tests/bug60367.phpt10
-rw-r--r--ext/reflection/tests/bug64239.phpt6
-rw-r--r--ext/reflection/tests/bug64936.phpt6
-rw-r--r--ext/reflection/tests/bug66430.phpt8
-rw-r--r--ext/reflection/tests/bug70982.phpt10
-rw-r--r--ext/reflection/tests/bug72661.phpt3
-rw-r--r--ext/reflection/tests/bug74454.inc2
-rw-r--r--ext/reflection/tests/bug74454.phpt8
-rw-r--r--ext/reflection/tests/bug74673.phpt17
-rw-r--r--ext/reflection/tests/bug74949.phpt4
-rw-r--r--ext/reflection/tests/bug76536.phpt2
-rw-r--r--ext/reflection/tests/bug77882.phpt2
-rw-r--r--ext/reflection/tests/bug78774.phpt6
-rw-r--r--ext/reflection/tests/bug78895.phpt12
-rw-r--r--ext/reflection/tests/closures_001.phpt10
-rw-r--r--ext/reflection/tests/closures_002.phpt6
-rw-r--r--ext/reflection/tests/closures_003.phpt2
-rw-r--r--ext/reflection/tests/closures_003_v1.phpt2
-rw-r--r--ext/reflection/tests/closures_004.phpt2
-rw-r--r--ext/reflection/tests/included4.inc4
-rw-r--r--ext/reflection/tests/parameters_001.phpt12
-rw-r--r--ext/reflection/tests/parameters_002.phpt75
-rw-r--r--ext/reflection/tests/property_exists.phpt95
-rw-r--r--ext/reflection/tests/request38992.phpt21
-rw-r--r--ext/reflection/tests/static_properties_002.phpt32
-rw-r--r--ext/reflection/tests/union_types.phpt112
-rw-r--r--ext/session/config.m44
-rw-r--r--ext/session/mod_files.c10
-rw-r--r--ext/session/mod_files.h2
-rw-r--r--ext/session/mod_mm.c4
-rw-r--r--ext/session/mod_mm.h2
-rw-r--r--ext/session/mod_user.c2
-rw-r--r--ext/session/mod_user.h2
-rw-r--r--ext/session/mod_user_class.c18
-rw-r--r--ext/session/php_session.h2
-rw-r--r--ext/session/session.c233
-rw-r--r--ext/session/session.stub.php83
-rw-r--r--ext/session/session_arginfo.h118
-rw-r--r--ext/session/tests/001.phpt4
-rw-r--r--ext/session/tests/003.phpt4
-rw-r--r--ext/session/tests/004.phpt2
-rw-r--r--ext/session/tests/005.phpt6
-rw-r--r--ext/session/tests/017.phpt8
-rw-r--r--ext/session/tests/019.phpt14
-rw-r--r--ext/session/tests/022.phpt4
-rw-r--r--ext/session/tests/023.phpt4
-rw-r--r--ext/session/tests/024.phpt2
-rw-r--r--ext/session/tests/025.phpt2
-rw-r--r--ext/session/tests/bug31454.phpt12
-rw-r--r--ext/session/tests/bug32330.phpt24
-rw-r--r--ext/session/tests/bug60634.phpt6
-rw-r--r--ext/session/tests/bug60634_error_1.phpt10
-rw-r--r--ext/session/tests/bug60634_error_2.phpt10
-rw-r--r--ext/session/tests/bug60634_error_3.phpt10
-rw-r--r--ext/session/tests/bug60634_error_4.phpt10
-rw-r--r--ext/session/tests/bug60634_error_5.phpt8
-rw-r--r--ext/session/tests/bug71162.phpt12
-rw-r--r--ext/session/tests/bug71972.phpt8
-rw-r--r--ext/session/tests/bug72562.phpt12
-rw-r--r--ext/session/tests/bug74514.phpt2
-rw-r--r--ext/session/tests/bug74541.phpt2
-rw-r--r--ext/session/tests/bug74833.phpt2
-rw-r--r--ext/session/tests/bug74892.phpt2
-rw-r--r--ext/session/tests/bug74936.phpt2
-rw-r--r--ext/session/tests/bug74941.phpt2
-rw-r--r--ext/session/tests/save_handler_closures.inc2
-rw-r--r--ext/session/tests/session_cache_expire_error.phpt169
-rw-r--r--ext/session/tests/session_cache_limiter_error.phpt8
-rw-r--r--ext/session/tests/session_decode_error2.phpt2
-rw-r--r--ext/session/tests/session_decode_variation3.phpt2
-rw-r--r--ext/session/tests/session_encode_error2.phpt11
-rw-r--r--ext/session/tests/session_regenerate_id_cookie.phpt22
-rw-r--r--ext/session/tests/session_save_path_variation4.phpt2
-rw-r--r--ext/session/tests/session_save_path_variation5.phpt2
-rw-r--r--ext/session/tests/session_set_save_handler_class_001.phpt102
-rw-r--r--ext/session/tests/session_set_save_handler_class_002.phpt72
-rw-r--r--ext/session/tests/session_set_save_handler_class_003.phpt26
-rw-r--r--ext/session/tests/session_set_save_handler_class_005.phpt18
-rw-r--r--ext/session/tests/session_set_save_handler_class_006.phpt20
-rw-r--r--ext/session/tests/session_set_save_handler_class_007.phpt44
-rw-r--r--ext/session/tests/session_set_save_handler_class_008.phpt44
-rw-r--r--ext/session/tests/session_set_save_handler_class_009.phpt44
-rw-r--r--ext/session/tests/session_set_save_handler_class_010.phpt44
-rw-r--r--ext/session/tests/session_set_save_handler_class_011.phpt54
-rw-r--r--ext/session/tests/session_set_save_handler_class_012.phpt48
-rw-r--r--ext/session/tests/session_set_save_handler_class_013.phpt37
-rw-r--r--ext/session/tests/session_set_save_handler_class_016.phpt76
-rw-r--r--ext/session/tests/session_set_save_handler_class_017.phpt86
-rw-r--r--ext/session/tests/session_set_save_handler_class_018.phpt94
-rw-r--r--ext/session/tests/session_set_save_handler_iface_001.phpt70
-rw-r--r--ext/session/tests/session_set_save_handler_iface_002.phpt99
-rw-r--r--ext/session/tests/session_set_save_handler_iface_003.phpt88
-rw-r--r--ext/session/tests/session_set_save_handler_sid_001.phpt90
-rw-r--r--ext/session/tests/session_set_save_handler_sid_002.phpt78
-rw-r--r--ext/session/tests/session_set_save_handler_variation4.phpt6
-rw-r--r--ext/session/tests/session_set_save_handler_variation5.phpt6
-rw-r--r--ext/session/tests/skipif.inc22
-rw-r--r--ext/shmop/php_shmop.h2
-rw-r--r--ext/shmop/shmop.c75
-rw-r--r--ext/shmop/shmop.stub.php19
-rw-r--r--ext/shmop/shmop_arginfo.h32
-rw-r--r--ext/shmop/tests/001.phpt108
-rw-r--r--ext/shmop/tests/002.phpt98
-rw-r--r--ext/simplexml/php_simplexml.h2
-rw-r--r--ext/simplexml/php_simplexml_exports.h2
-rw-r--r--ext/simplexml/simplexml.c374
-rw-r--r--ext/simplexml/simplexml.stub.php51
-rw-r--r--ext/simplexml/simplexml_arginfo.h76
-rw-r--r--ext/simplexml/sxe.c36
-rw-r--r--ext/simplexml/sxe.h2
-rw-r--r--ext/simplexml/sxe.stub.php25
-rw-r--r--ext/simplexml/sxe_arginfo.h16
-rw-r--r--ext/simplexml/tests/000.phpt15
-rw-r--r--ext/simplexml/tests/001-mb.phpt2
-rw-r--r--ext/simplexml/tests/001.phpt2
-rw-r--r--ext/simplexml/tests/002.phpt2
-rw-r--r--ext/simplexml/tests/003.phpt2
-rw-r--r--ext/simplexml/tests/004.phpt2
-rw-r--r--ext/simplexml/tests/006.phpt18
-rw-r--r--ext/simplexml/tests/007.phpt2
-rw-r--r--ext/simplexml/tests/009.phpt8
-rw-r--r--ext/simplexml/tests/009b.phpt3
-rw-r--r--ext/simplexml/tests/010.phpt2
-rw-r--r--ext/simplexml/tests/011.phpt2
-rw-r--r--ext/simplexml/tests/013.phpt2
-rw-r--r--ext/simplexml/tests/014.phpt2
-rw-r--r--ext/simplexml/tests/014a.phpt2
-rw-r--r--ext/simplexml/tests/014b.phpt2
-rw-r--r--ext/simplexml/tests/015.phpt2
-rw-r--r--ext/simplexml/tests/016.phpt2
-rw-r--r--ext/simplexml/tests/016a.phpt2
-rw-r--r--ext/simplexml/tests/017.phpt2
-rw-r--r--ext/simplexml/tests/019.phpt18
-rw-r--r--ext/simplexml/tests/020.phpt2
-rw-r--r--ext/simplexml/tests/021.phpt6
-rw-r--r--ext/simplexml/tests/022.phpt6
-rw-r--r--ext/simplexml/tests/023.phpt2
-rw-r--r--ext/simplexml/tests/024.phpt8
-rw-r--r--ext/simplexml/tests/025.phpt3
-rw-r--r--ext/simplexml/tests/026.phpt2
-rw-r--r--ext/simplexml/tests/027.phpt2
-rw-r--r--ext/simplexml/tests/028.phpt2
-rw-r--r--ext/simplexml/tests/029.phpt8
-rw-r--r--ext/simplexml/tests/030.phpt4
-rw-r--r--ext/simplexml/tests/031.phpt4
-rw-r--r--ext/simplexml/tests/032.phpt2
-rw-r--r--ext/simplexml/tests/033.phpt2
-rw-r--r--ext/simplexml/tests/035.phpt2
-rw-r--r--ext/simplexml/tests/036.phpt4
-rw-r--r--ext/simplexml/tests/037.phpt2
-rw-r--r--ext/simplexml/tests/SimpleXMLElement_addAttribute_basic.phpt8
-rw-r--r--ext/simplexml/tests/SimpleXMLElement_xpath_3.phpt20
-rw-r--r--ext/simplexml/tests/SimpleXMLElement_xpath_4.phpt2
-rw-r--r--ext/simplexml/tests/bug24392.phpt2
-rw-r--r--ext/simplexml/tests/bug27010.phpt2
-rw-r--r--ext/simplexml/tests/bug35785.phpt3
-rw-r--r--ext/simplexml/tests/bug36611.phpt2
-rw-r--r--ext/simplexml/tests/bug37076.phpt2
-rw-r--r--ext/simplexml/tests/bug37076_1.phpt2
-rw-r--r--ext/simplexml/tests/bug37565.phpt16
-rw-r--r--ext/simplexml/tests/bug38354.phpt8
-rw-r--r--ext/simplexml/tests/bug38406.phpt2
-rw-r--r--ext/simplexml/tests/bug40451.phpt8
-rw-r--r--ext/simplexml/tests/bug41175.phpt2
-rw-r--r--ext/simplexml/tests/bug41582.phpt2
-rw-r--r--ext/simplexml/tests/bug41861.phpt24
-rw-r--r--ext/simplexml/tests/bug41867.phpt2
-rw-r--r--ext/simplexml/tests/bug41947.phpt2
-rw-r--r--ext/simplexml/tests/bug42259.phpt2
-rw-r--r--ext/simplexml/tests/bug42369.phpt2
-rw-r--r--ext/simplexml/tests/bug43221.phpt2
-rw-r--r--ext/simplexml/tests/bug44478.phpt2
-rw-r--r--ext/simplexml/tests/bug45553.phpt2
-rw-r--r--ext/simplexml/tests/bug46003.phpt2
-rw-r--r--ext/simplexml/tests/bug46047.phpt2
-rw-r--r--ext/simplexml/tests/bug46048.phpt2
-rw-r--r--ext/simplexml/tests/bug51615.phpt2
-rw-r--r--ext/simplexml/tests/bug69169.phpt12
-rw-r--r--ext/simplexml/tests/bug72588.phpt20
-rw-r--r--ext/simplexml/tests/bug75245.phpt2
-rw-r--r--ext/simplexml/tests/bug76712.phpt2
-rw-r--r--ext/simplexml/tests/feature55218.phpt2
-rw-r--r--ext/simplexml/tests/profile02.phpt2
-rw-r--r--ext/simplexml/tests/profile11.phpt2
-rw-r--r--ext/simplexml/tests/profile12.phpt8
-rw-r--r--ext/simplexml/tests/profile13.phpt9
-rw-r--r--ext/simplexml/tests/simplexml_import_dom.phpt2
-rw-r--r--ext/simplexml/tests/simplexml_load_file.phpt6
-rw-r--r--ext/simplexml/tests/sxe_001.phpt2
-rw-r--r--ext/simplexml/tests/sxe_002.phpt8
-rw-r--r--ext/simplexml/tests/sxe_003.phpt24
-rw-r--r--ext/simplexml/tests/sxe_004.phpt76
-rw-r--r--ext/simplexml/tests/sxe_005.phpt14
-rw-r--r--ext/skeleton/skeleton.c11
-rw-r--r--ext/skeleton/skeleton.stub.php5
-rw-r--r--ext/snmp/php_snmp.h2
-rw-r--r--ext/snmp/snmp.c366
-rw-r--r--ext/snmp/snmp.stub.php120
-rw-r--r--ext/snmp/snmp_arginfo.h146
-rw-r--r--ext/snmp/tests/bug60749.phpt6
-rw-r--r--ext/snmp/tests/ipv6.phpt2
-rw-r--r--ext/snmp/tests/reflection.phpt38
-rw-r--r--ext/snmp/tests/skipif.inc4
-rw-r--r--ext/snmp/tests/snmp-object-error.phpt52
-rw-r--r--ext/snmp/tests/snmp-object-setSecurity_error.phpt4
-rw-r--r--ext/snmp/tests/snmp-object.phpt2
-rw-r--r--ext/snmp/tests/snmp2_get.phpt8
-rw-r--r--ext/snmp/tests/snmp2_real_walk.phpt11
-rw-r--r--ext/snmp/tests/snmp2_set.phpt12
-rw-r--r--ext/snmp/tests/snmp2_walk.phpt11
-rw-r--r--ext/snmp/tests/snmp3-error.phpt9
-rw-r--r--ext/snmp/tests/snmp3.phpt8
-rw-r--r--ext/snmp/tests/snmp_get_quick_print.phpt15
-rw-r--r--ext/snmp/tests/snmp_get_valueretrieval.phpt12
-rw-r--r--ext/snmp/tests/snmp_include.inc4
-rw-r--r--ext/snmp/tests/snmp_read_mib.phpt4
-rw-r--r--ext/snmp/tests/snmp_set_enum_print.phpt7
-rw-r--r--ext/snmp/tests/snmp_set_oid_output_format.phpt4
-rw-r--r--ext/snmp/tests/snmpget.phpt11
-rw-r--r--ext/snmp/tests/snmprealwalk.phpt11
-rw-r--r--ext/snmp/tests/snmpset.phpt12
-rw-r--r--ext/snmp/tests/snmpwalk.phpt11
-rw-r--r--ext/soap/php_encoding.c4
-rw-r--r--ext/soap/php_encoding.h2
-rw-r--r--ext/soap/php_http.c2
-rw-r--r--ext/soap/php_http.h2
-rw-r--r--ext/soap/php_packet_soap.c2
-rw-r--r--ext/soap/php_packet_soap.h2
-rw-r--r--ext/soap/php_schema.c2
-rw-r--r--ext/soap/php_schema.h2
-rw-r--r--ext/soap/php_sdl.c2
-rw-r--r--ext/soap/php_sdl.h2
-rw-r--r--ext/soap/php_soap.h2
-rw-r--r--ext/soap/php_xml.c2
-rw-r--r--ext/soap/php_xml.h2
-rw-r--r--ext/soap/soap.c324
-rw-r--r--ext/soap/soap.stub.php101
-rw-r--r--ext/soap/soap_arginfo.h133
-rw-r--r--ext/soap/tests/any.phpt16
-rw-r--r--ext/soap/tests/bug46760.phpt6
-rw-r--r--ext/soap/tests/bug48557.phpt62
-rw-r--r--ext/soap/tests/bug69137.phpt8
-rw-r--r--ext/soap/tests/bug70388.phpt6
-rw-r--r--ext/soap/tests/bug70875.phpt22
-rw-r--r--ext/soap/tests/bug71610.phpt2
-rw-r--r--ext/soap/tests/bug73037.phpt166
-rw-r--r--ext/soap/tests/bug77088.phpt23
-rw-r--r--ext/soap/tests/bug77410.phpt2
-rw-r--r--ext/soap/tests/bugs/bug28751.phpt4
-rw-r--r--ext/soap/tests/bugs/bug29795.phpt6
-rw-r--r--ext/soap/tests/bugs/bug30045.phpt12
-rw-r--r--ext/soap/tests/bugs/bug30106.phpt12
-rw-r--r--ext/soap/tests/bugs/bug30799.phpt6
-rw-r--r--ext/soap/tests/bugs/bug30928.phpt6
-rw-r--r--ext/soap/tests/bugs/bug30994.phpt34
-rw-r--r--ext/soap/tests/bugs/bug31422.phpt9
-rw-r--r--ext/soap/tests/bugs/bug31695.phpt6
-rw-r--r--ext/soap/tests/bugs/bug31755.phpt2
-rw-r--r--ext/soap/tests/bugs/bug32776.phpt4
-rw-r--r--ext/soap/tests/bugs/bug32941.phpt30
-rw-r--r--ext/soap/tests/bugs/bug34449.phpt4
-rw-r--r--ext/soap/tests/bugs/bug34643.phpt6
-rw-r--r--ext/soap/tests/bugs/bug34657.phpt12
-rw-r--r--ext/soap/tests/bugs/bug35142.phpt14
-rw-r--r--ext/soap/tests/bugs/bug35273.phpt6
-rw-r--r--ext/soap/tests/bugs/bug36226.phpt16
-rw-r--r--ext/soap/tests/bugs/bug36575.phpt16
-rw-r--r--ext/soap/tests/bugs/bug36999.phpt12
-rw-r--r--ext/soap/tests/bugs/bug37083.phpt22
-rw-r--r--ext/soap/tests/bugs/bug38004.phpt6
-rw-r--r--ext/soap/tests/bugs/bug38005.phpt12
-rw-r--r--ext/soap/tests/bugs/bug38055.phpt8
-rw-r--r--ext/soap/tests/bugs/bug38067.phpt8
-rw-r--r--ext/soap/tests/bugs/bug41004.phpt8
-rw-r--r--ext/soap/tests/bugs/bug41566.phpt4
-rw-r--r--ext/soap/tests/bugs/bug42086.phpt10
-rw-r--r--ext/soap/tests/bugs/bug42151.phpt24
-rw-r--r--ext/soap/tests/bugs/bug42183.phpt4
-rw-r--r--ext/soap/tests/bugs/bug42214.phpt6
-rw-r--r--ext/soap/tests/bugs/bug42692.phpt32
-rw-r--r--ext/soap/tests/bugs/bug43045.phpt10
-rw-r--r--ext/soap/tests/bugs/bug44882.phpt8
-rw-r--r--ext/soap/tests/bugs/bug46427.phpt8
-rw-r--r--ext/soap/tests/bugs/bug47049.phpt2
-rw-r--r--ext/soap/tests/bugs/bug47273.phpt8
-rw-r--r--ext/soap/tests/bugs/bug50675.phpt32
-rw-r--r--ext/soap/tests/bugs/bug50698_1.phpt2
-rw-r--r--ext/soap/tests/bugs/bug50698_2.phpt2
-rw-r--r--ext/soap/tests/bugs/bug50698_3.phpt2
-rw-r--r--ext/soap/tests/bugs/bug50698_4.phpt2
-rw-r--r--ext/soap/tests/bugs/bug50762.phpt22
-rw-r--r--ext/soap/tests/bugs/bug65018.phpt32
-rw-r--r--ext/soap/tests/bugs/bug66112.phpt12
-rw-r--r--ext/soap/tests/bugs/bug69085.phpt4
-rw-r--r--ext/soap/tests/bugs/bug69462.phpt14
-rw-r--r--ext/soap/tests/bugs/bug70469.phpt4
-rw-r--r--ext/soap/tests/bugs/bug77141.phpt2
-rw-r--r--ext/soap/tests/bugs/multiport.phpt2
-rw-r--r--ext/soap/tests/classmap001.phpt28
-rw-r--r--ext/soap/tests/classmap002.phpt14
-rw-r--r--ext/soap/tests/custom_content_type.phpt2
-rw-r--r--ext/soap/tests/fault_warning.phpt10
-rw-r--r--ext/soap/tests/interop/Round2/Base/r2_base_014s.phpt6
-rw-r--r--ext/soap/tests/interop/Round2/Base/r2_base_015s.phpt12
-rw-r--r--ext/soap/tests/interop/Round2/GroupB/r2_groupB_004s.phpt2
-rw-r--r--ext/soap/tests/interop/Round2/GroupB/r2_groupB_005s.phpt6
-rw-r--r--ext/soap/tests/interop/Round2/GroupB/round2_groupB.inc4
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/round4_groupH_complex_doclit.inc24
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/round4_groupH_complex_rpcenc.inc24
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/round4_groupH_simple_doclit.inc48
-rw-r--r--ext/soap/tests/interop/Round4/GroupH/round4_groupH_simple_rpcenc.inc48
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/round4_groupI_xsd.inc164
-rw-r--r--ext/soap/tests/interop/Round4/GroupI/round4_groupI_xsd.wsdl2
-rw-r--r--ext/soap/tests/schema/schema001.phpt6
-rw-r--r--ext/soap/tests/schema/schema002.phpt12
-rw-r--r--ext/soap/tests/schema/schema003.phpt12
-rw-r--r--ext/soap/tests/schema/schema004.phpt6
-rw-r--r--ext/soap/tests/schema/schema005.phpt14
-rw-r--r--ext/soap/tests/schema/schema006.phpt16
-rw-r--r--ext/soap/tests/schema/schema007.phpt16
-rw-r--r--ext/soap/tests/schema/schema008.phpt14
-rw-r--r--ext/soap/tests/schema/schema009.phpt6
-rw-r--r--ext/soap/tests/schema/schema010.phpt6
-rw-r--r--ext/soap/tests/schema/schema011.phpt14
-rw-r--r--ext/soap/tests/schema/schema012.phpt14
-rw-r--r--ext/soap/tests/schema/schema013.phpt6
-rw-r--r--ext/soap/tests/schema/schema014.phpt6
-rw-r--r--ext/soap/tests/schema/schema015.phpt26
-rw-r--r--ext/soap/tests/schema/schema016.phpt26
-rw-r--r--ext/soap/tests/schema/schema017.phpt20
-rw-r--r--ext/soap/tests/schema/schema018.phpt20
-rw-r--r--ext/soap/tests/schema/schema019.phpt20
-rw-r--r--ext/soap/tests/schema/schema020.phpt20
-rw-r--r--ext/soap/tests/schema/schema021.phpt14
-rw-r--r--ext/soap/tests/schema/schema022.phpt14
-rw-r--r--ext/soap/tests/schema/schema023.phpt12
-rw-r--r--ext/soap/tests/schema/schema024.phpt16
-rw-r--r--ext/soap/tests/schema/schema025.phpt14
-rw-r--r--ext/soap/tests/schema/schema026.phpt16
-rw-r--r--ext/soap/tests/schema/schema027.phpt12
-rw-r--r--ext/soap/tests/schema/schema028.phpt14
-rw-r--r--ext/soap/tests/schema/schema029.phpt18
-rw-r--r--ext/soap/tests/schema/schema030.phpt12
-rw-r--r--ext/soap/tests/schema/schema031.phpt12
-rw-r--r--ext/soap/tests/schema/schema032.phpt12
-rw-r--r--ext/soap/tests/schema/schema033.phpt22
-rw-r--r--ext/soap/tests/schema/schema034.phpt24
-rw-r--r--ext/soap/tests/schema/schema035.phpt26
-rw-r--r--ext/soap/tests/schema/schema036.phpt24
-rw-r--r--ext/soap/tests/schema/schema037.phpt12
-rw-r--r--ext/soap/tests/schema/schema038.phpt14
-rw-r--r--ext/soap/tests/schema/schema039.phpt18
-rw-r--r--ext/soap/tests/schema/schema040.phpt20
-rw-r--r--ext/soap/tests/schema/schema041.phpt18
-rw-r--r--ext/soap/tests/schema/schema042.phpt14
-rw-r--r--ext/soap/tests/schema/schema043.phpt28
-rw-r--r--ext/soap/tests/schema/schema044.phpt14
-rw-r--r--ext/soap/tests/schema/schema045.phpt28
-rw-r--r--ext/soap/tests/schema/schema046.phpt28
-rw-r--r--ext/soap/tests/schema/schema047.phpt24
-rw-r--r--ext/soap/tests/schema/schema048.phpt28
-rw-r--r--ext/soap/tests/schema/schema049.phpt30
-rw-r--r--ext/soap/tests/schema/schema050.phpt12
-rw-r--r--ext/soap/tests/schema/schema051.phpt12
-rw-r--r--ext/soap/tests/schema/schema052.phpt12
-rw-r--r--ext/soap/tests/schema/schema053.phpt12
-rw-r--r--ext/soap/tests/schema/schema055.phpt10
-rw-r--r--ext/soap/tests/schema/schema056.phpt12
-rw-r--r--ext/soap/tests/schema/schema057.phpt16
-rw-r--r--ext/soap/tests/schema/schema058.phpt14
-rw-r--r--ext/soap/tests/schema/schema059.phpt16
-rw-r--r--ext/soap/tests/schema/schema060.phpt14
-rw-r--r--ext/soap/tests/schema/schema061.phpt18
-rw-r--r--ext/soap/tests/schema/schema062.phpt14
-rw-r--r--ext/soap/tests/schema/schema064.phpt40
-rw-r--r--ext/soap/tests/schema/schema065.phpt8
-rw-r--r--ext/soap/tests/schema/schema066.phpt8
-rw-r--r--ext/soap/tests/schema/schema067.phpt8
-rw-r--r--ext/soap/tests/schema/schema068.phpt8
-rw-r--r--ext/soap/tests/schema/schema069.phpt10
-rw-r--r--ext/soap/tests/schema/schema070.phpt14
-rw-r--r--ext/soap/tests/schema/schema071.phpt12
-rw-r--r--ext/soap/tests/schema/schema072.phpt16
-rw-r--r--ext/soap/tests/schema/schema073.phpt14
-rw-r--r--ext/soap/tests/schema/schema074.phpt12
-rw-r--r--ext/soap/tests/schema/schema075.phpt10
-rw-r--r--ext/soap/tests/schema/schema076.phpt10
-rw-r--r--ext/soap/tests/schema/schema077.phpt10
-rw-r--r--ext/soap/tests/schema/schema078.phpt14
-rw-r--r--ext/soap/tests/schema/schema079.phpt14
-rw-r--r--ext/soap/tests/schema/schema080.phpt14
-rw-r--r--ext/soap/tests/schema/schema081.phpt12
-rw-r--r--ext/soap/tests/schema/schema082.phpt16
-rw-r--r--ext/soap/tests/schema/schema083.phpt14
-rw-r--r--ext/soap/tests/schema/schema084.phpt16
-rw-r--r--ext/soap/tests/schema/schema085.phpt28
-rw-r--r--ext/soap/tests/schema/test_schema.inc40
-rw-r--r--ext/soap/tests/server011.phpt2
-rw-r--r--ext/soap/tests/server016.phpt4
-rw-r--r--ext/soap/tests/server017.phpt2
-rw-r--r--ext/soap/tests/server018.phpt2
-rw-r--r--ext/soap/tests/server022.phpt8
-rw-r--r--ext/soap/tests/server023.phpt8
-rw-r--r--ext/soap/tests/server024.phpt20
-rw-r--r--ext/soap/tests/server025.phpt20
-rw-r--r--ext/soap/tests/server031.phpt36
-rw-r--r--ext/soap/tests/soap12/T01.phpt2
-rw-r--r--ext/soap/tests/soap12/T02.phpt2
-rw-r--r--ext/soap/tests/soap12/T03.phpt2
-rw-r--r--ext/soap/tests/soap12/T04.phpt2
-rw-r--r--ext/soap/tests/soap12/T05.phpt2
-rw-r--r--ext/soap/tests/soap12/T10.phpt4
-rw-r--r--ext/soap/tests/soap12/T11.phpt2
-rw-r--r--ext/soap/tests/soap12/T12.phpt2
-rw-r--r--ext/soap/tests/soap12/T13.phpt2
-rw-r--r--ext/soap/tests/soap12/T14.phpt2
-rw-r--r--ext/soap/tests/soap12/T15.phpt2
-rw-r--r--ext/soap/tests/soap12/T19.phpt2
-rw-r--r--ext/soap/tests/soap12/T22.phpt4
-rw-r--r--ext/soap/tests/soap12/T23.phpt6
-rw-r--r--ext/soap/tests/soap12/T24.phpt2
-rw-r--r--ext/soap/tests/soap12/T25.phpt2
-rw-r--r--ext/soap/tests/soap12/T26.phpt2
-rw-r--r--ext/soap/tests/soap12/T27.phpt4
-rw-r--r--ext/soap/tests/soap12/T28.phpt2
-rw-r--r--ext/soap/tests/soap12/T29.phpt2
-rw-r--r--ext/soap/tests/soap12/T31.phpt2
-rw-r--r--ext/soap/tests/soap12/T32.phpt2
-rw-r--r--ext/soap/tests/soap12/T33.phpt2
-rw-r--r--ext/soap/tests/soap12/T34.phpt4
-rw-r--r--ext/soap/tests/soap12/T35.phpt2
-rw-r--r--ext/soap/tests/soap12/T36.phpt4
-rw-r--r--ext/soap/tests/soap12/T37.phpt2
-rw-r--r--ext/soap/tests/soap12/T38_1.phpt6
-rw-r--r--ext/soap/tests/soap12/T38_2.phpt6
-rw-r--r--ext/soap/tests/soap12/T39.phpt2
-rw-r--r--ext/soap/tests/soap12/T40.phpt4
-rw-r--r--ext/soap/tests/soap12/T46.phpt4
-rw-r--r--ext/soap/tests/soap12/T49.phpt2
-rw-r--r--ext/soap/tests/soap12/T50.phpt2
-rw-r--r--ext/soap/tests/soap12/T52.phpt2
-rw-r--r--ext/soap/tests/soap12/T53.phpt2
-rw-r--r--ext/soap/tests/soap12/T54.phpt2
-rw-r--r--ext/soap/tests/soap12/T55.phpt2
-rw-r--r--ext/soap/tests/soap12/T58.phpt8
-rw-r--r--ext/soap/tests/soap12/T59.phpt4
-rw-r--r--ext/soap/tests/soap12/T63.phpt2
-rw-r--r--ext/soap/tests/soap12/T64.phpt2
-rw-r--r--ext/soap/tests/soap12/T65.phpt2
-rw-r--r--ext/soap/tests/soap12/T66.phpt2
-rw-r--r--ext/soap/tests/soap12/T67.phpt2
-rw-r--r--ext/soap/tests/soap12/T68.phpt2
-rw-r--r--ext/soap/tests/soap12/T69.phpt2
-rw-r--r--ext/soap/tests/soap12/T70.phpt2
-rw-r--r--ext/soap/tests/soap12/T71.phpt2
-rw-r--r--ext/soap/tests/soap12/T72.phpt2
-rw-r--r--ext/soap/tests/soap12/T74.phpt4
-rw-r--r--ext/soap/tests/soap12/T75.phpt2
-rw-r--r--ext/soap/tests/soap12/T76_1.phpt2
-rw-r--r--ext/soap/tests/soap12/T77_1.phpt2
-rw-r--r--ext/soap/tests/soap12/T77_2.phpt2
-rw-r--r--ext/soap/tests/soap12/T77_3.phpt2
-rw-r--r--ext/soap/tests/soap12/T78.phpt2
-rw-r--r--ext/soap/tests/soap12/T80.phpt2
-rw-r--r--ext/soap/tests/soap12/soap12-test.inc210
-rw-r--r--ext/soap/tests/typemap001.phpt42
-rw-r--r--ext/soap/tests/typemap002.phpt38
-rw-r--r--ext/soap/tests/typemap003.phpt28
-rw-r--r--ext/soap/tests/typemap004.phpt22
-rw-r--r--ext/soap/tests/typemap005.phpt44
-rw-r--r--ext/soap/tests/typemap006.phpt40
-rw-r--r--ext/soap/tests/typemap007.phpt28
-rw-r--r--ext/soap/tests/typemap008.phpt22
-rw-r--r--ext/soap/tests/typemap009.phpt34
-rw-r--r--ext/soap/tests/typemap010.phpt38
-rw-r--r--ext/soap/tests/typemap011.phpt24
-rw-r--r--ext/soap/tests/typemap012.phpt26
-rw-r--r--ext/soap/tests/typemap013.phpt38
-rw-r--r--ext/sockets/conversions.c11
-rw-r--r--ext/sockets/multicast.c12
-rw-r--r--ext/sockets/multicast.h2
-rw-r--r--ext/sockets/php_sockets.h2
-rw-r--r--ext/sockets/sendrecvmsg.c14
-rw-r--r--ext/sockets/sockets.c423
-rw-r--r--ext/sockets/sockets.stub.php124
-rw-r--r--ext/sockets/sockets_arginfo.h199
-rw-r--r--ext/sockets/tests/ai_idn_deprecation.phpt20
-rw-r--r--ext/sockets/tests/bug76839.phpt2
-rw-r--r--ext/sockets/tests/ipv4loop.phpt78
-rw-r--r--ext/sockets/tests/ipv6_skipif.inc4
-rw-r--r--ext/sockets/tests/ipv6loop.phpt74
-rw-r--r--ext/sockets/tests/mcast_helpers.php.inc10
-rw-r--r--ext/sockets/tests/mcast_ipv4_recv.phpt162
-rw-r--r--ext/sockets/tests/mcast_ipv6_recv.phpt160
-rw-r--r--ext/sockets/tests/mcast_ipv6_recv_limited.phpt46
-rw-r--r--ext/sockets/tests/socket_abstract_path.phpt4
-rw-r--r--ext/sockets/tests/socket_abstract_path_sendmsg.phpt4
-rw-r--r--ext/sockets/tests/socket_connect_params.phpt11
-rw-r--r--ext/sockets/tests/socket_create_listen_used.phpt3
-rw-r--r--ext/sockets/tests/socket_create_pair-wrongparams-win32.phpt13
-rw-r--r--ext/sockets/tests/socket_create_pair-wrongparams.phpt22
-rw-r--r--ext/sockets/tests/socket_export_stream-2.phpt46
-rw-r--r--ext/sockets/tests/socket_export_stream-3.phpt6
-rw-r--r--ext/sockets/tests/socket_export_stream-4-win.phpt52
-rw-r--r--ext/sockets/tests/socket_export_stream-4.phpt52
-rw-r--r--ext/sockets/tests/socket_getpeername_ipv4loop.phpt30
-rw-r--r--ext/sockets/tests/socket_getpeername_ipv6loop.phpt32
-rw-r--r--ext/sockets/tests/socket_import_stream-2.phpt40
-rw-r--r--ext/sockets/tests/socket_import_stream-3.phpt6
-rw-r--r--ext/sockets/tests/socket_import_stream-4-win.phpt52
-rw-r--r--ext/sockets/tests/socket_import_stream-4.phpt52
-rw-r--r--ext/sockets/tests/socket_listen-wrongparams.phpt4
-rw-r--r--ext/sockets/tests/socket_select-wrongparams-1.phpt2
-rw-r--r--ext/sockets/tests/socket_select-wrongparams-2.phpt5
-rw-r--r--ext/sockets/tests/socket_select-wrongparams-3.phpt28
-rw-r--r--ext/sockets/tests/socket_select_error.phpt17
-rw-r--r--ext/sockets/tests/socket_sendrecvmsg_multi_msg-unix.phpt16
-rw-r--r--ext/sockets/tests/socket_sendrecvmsg_multi_msg.phpt24
-rw-r--r--ext/sockets/tests/socket_sentto_recvfrom_ipv6_udp-win32.phpt9
-rw-r--r--ext/sockets/tests/socket_sentto_recvfrom_unix.phpt13
-rw-r--r--ext/sockets/tests/socket_set_block-retval.phpt12
-rw-r--r--ext/sockets/tests/socket_set_nonblock-retval.phpt12
-rw-r--r--ext/sockets/tests/socket_set_option_rcvtimeo.phpt2
-rw-r--r--ext/sockets/tests/socket_set_option_seolinger.phpt4
-rw-r--r--ext/sockets/tests/socket_set_option_sndtimeo.phpt2
-rw-r--r--ext/sockets/tests/socket_strerror.phpt2
-rw-r--r--ext/sockets/tests/unixloop.phpt68
-rw-r--r--ext/sockets/tests/wsaprotocol_info_0.phpt50
-rw-r--r--ext/sockets/unix_socket_constants.h2
-rw-r--r--ext/sockets/win32_socket_constants.h2
-rw-r--r--ext/sockets/windows_common.h2
-rw-r--r--ext/sodium/libsodium.c1045
-rw-r--r--ext/sodium/libsodium.stub.php185
-rw-r--r--ext/sodium/libsodium_arginfo.h380
-rw-r--r--ext/sodium/php_libsodium.h2
-rw-r--r--ext/sodium/sodium_pwhash.c12
-rw-r--r--ext/sodium/tests/installed.phpt2
-rw-r--r--ext/sodium/tests/pwhash_scrypt.phpt4
-rw-r--r--ext/sodium/tests/utils.phpt2
-rw-r--r--ext/spl/php_spl.c129
-rw-r--r--ext/spl/php_spl.h2
-rwxr-xr-xext/spl/php_spl.stub.php35
-rw-r--r--ext/spl/php_spl_arginfo.h65
-rw-r--r--ext/spl/spl_array.c215
-rw-r--r--ext/spl/spl_array.h2
-rw-r--r--ext/spl/spl_directory.c262
-rw-r--r--ext/spl/spl_directory.h2
-rw-r--r--ext/spl/spl_dllist.c110
-rw-r--r--ext/spl/spl_dllist.h2
-rw-r--r--ext/spl/spl_engine.c2
-rw-r--r--ext/spl/spl_engine.h6
-rw-r--r--ext/spl/spl_exceptions.c2
-rw-r--r--ext/spl/spl_exceptions.h2
-rw-r--r--ext/spl/spl_fixedarray.c136
-rw-r--r--ext/spl/spl_fixedarray.h2
-rw-r--r--ext/spl/spl_functions.c2
-rw-r--r--ext/spl/spl_functions.h2
-rw-r--r--ext/spl/spl_heap.c114
-rw-r--r--ext/spl/spl_heap.h2
-rw-r--r--ext/spl/spl_iterators.c333
-rw-r--r--ext/spl/spl_iterators.h2
-rw-r--r--ext/spl/spl_observer.c187
-rw-r--r--ext/spl/spl_observer.h2
-rw-r--r--ext/spl/tests/CallbackFilterIteratorTest-002.phpt28
-rw-r--r--ext/spl/tests/CallbackFilterIteratorTest.phpt16
-rw-r--r--ext/spl/tests/DirectoryIterator_by_reference.phpt2
-rw-r--r--ext/spl/tests/RecursiveCallbackFilterIteratorTest.phpt26
-rw-r--r--ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt2
-rw-r--r--ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt2
-rw-r--r--ext/spl/tests/SplDoublyLinkedList_add_invalid_offset.phpt6
-rw-r--r--ext/spl/tests/SplDoublyLinkedList_add_null_offset.phpt6
-rw-r--r--ext/spl/tests/SplDoublyLinkedList_debug-info.phpt16
-rw-r--r--ext/spl/tests/SplDoublyLinkedList_isEmpty_empty.phpt6
-rw-r--r--ext/spl/tests/SplDoublyLinkedList_isEmpty_not-empty.phpt16
-rw-r--r--ext/spl/tests/SplDoublyLinkedList_offsetExists_success.phpt6
-rw-r--r--ext/spl/tests/SplDoublyLinkedList_offsetUnset_negative-parameter.phpt24
-rw-r--r--ext/spl/tests/SplDoublyLinkedList_offsetUnset_parameter-larger-num-elements.phpt24
-rw-r--r--ext/spl/tests/SplFileInfo_setFileClass_error.phpt2
-rw-r--r--ext/spl/tests/SplFileInfo_setInfoClass_error.phpt2
-rw-r--r--ext/spl/tests/SplFileObject_fgetcsv_basic.phpt8
-rw-r--r--ext/spl/tests/SplFileObject_fgetcsv_delimiter_basic.phpt8
-rw-r--r--ext/spl/tests/SplFileObject_fgetcsv_delimiter_error.phpt8
-rw-r--r--ext/spl/tests/SplFileObject_fgetcsv_enclosure_basic.phpt8
-rw-r--r--ext/spl/tests/SplFileObject_fgetcsv_enclosure_error.phpt8
-rw-r--r--ext/spl/tests/SplFileObject_fgetcsv_escape_empty.phpt2
-rw-r--r--ext/spl/tests/SplFileObject_fputcsv.phpt9
-rw-r--r--ext/spl/tests/SplFileObject_fputcsv_002.phpt2
-rw-r--r--ext/spl/tests/SplFileObject_fputcsv_variation15.phpt2
-rw-r--r--ext/spl/tests/SplFileObject_ftruncate_error_001.phpt4
-rw-r--r--ext/spl/tests/SplFileObject_fwrite_variation_001.phpt2
-rw-r--r--ext/spl/tests/SplFileObject_fwrite_variation_002.phpt2
-rw-r--r--ext/spl/tests/SplFileObject_seek_error_001.phpt13
-rw-r--r--ext/spl/tests/SplFileObject_setCsvControl_variation002.phpt2
-rw-r--r--ext/spl/tests/SplFixedArray__construct_param_array.phpt4
-rw-r--r--ext/spl/tests/SplFixedArray__construct_param_string.phpt4
-rw-r--r--ext/spl/tests/SplFixedArray_construct_param_SplFixedArray.phpt4
-rw-r--r--ext/spl/tests/SplFixedArray_fromarray_indexes.phpt4
-rw-r--r--ext/spl/tests/SplFixedArray_fromarray_non_indexes.phpt6
-rw-r--r--ext/spl/tests/SplFixedArray_indirect_modification.phpt14
-rw-r--r--ext/spl/tests/SplFixedArray_key_setsize.phpt2
-rw-r--r--ext/spl/tests/SplFixedArray_offsetExists_less_than_zero.phpt2
-rw-r--r--ext/spl/tests/SplFixedArray_offsetUnset_string.phpt18
-rw-r--r--ext/spl/tests/SplObjectStorage_getHash.phpt2
-rw-r--r--ext/spl/tests/SplObjectStorage_offsetGet_missing_object.phpt4
-rw-r--r--ext/spl/tests/SplObjectStorage_unserialize_bad.phpt2
-rw-r--r--ext/spl/tests/SplObjectStorage_unserialize_invalid_parameter2.phpt2
-rw-r--r--ext/spl/tests/SplQueue_setIteratorMode_param_lifo.phpt6
-rw-r--r--ext/spl/tests/arrayObject___construct_basic2.phpt44
-rw-r--r--ext/spl/tests/arrayObject___construct_basic3.phpt44
-rw-r--r--ext/spl/tests/arrayObject___construct_basic4.phpt40
-rw-r--r--ext/spl/tests/arrayObject___construct_basic5.phpt40
-rw-r--r--ext/spl/tests/arrayObject___construct_basic6.phpt4
-rw-r--r--ext/spl/tests/arrayObject___construct_error2.phpt10
-rw-r--r--ext/spl/tests/arrayObject_asort_basic1.phpt12
-rw-r--r--ext/spl/tests/arrayObject_asort_basic2.phpt10
-rw-r--r--ext/spl/tests/arrayObject_clone_basic3.phpt2
-rw-r--r--ext/spl/tests/arrayObject_count_basic1.phpt14
-rw-r--r--ext/spl/tests/arrayObject_exchangeArray_basic3.phpt32
-rw-r--r--ext/spl/tests/arrayObject_getIteratorClass_basic1.phpt62
-rw-r--r--ext/spl/tests/arrayObject_ksort_basic1.phpt12
-rw-r--r--ext/spl/tests/arrayObject_ksort_basic2.phpt10
-rw-r--r--ext/spl/tests/arrayObject_magicMethods1.phpt40
-rw-r--r--ext/spl/tests/arrayObject_magicMethods2.phpt42
-rw-r--r--ext/spl/tests/arrayObject_magicMethods3.phpt40
-rw-r--r--ext/spl/tests/arrayObject_magicMethods4.phpt42
-rw-r--r--ext/spl/tests/arrayObject_magicMethods5.phpt42
-rw-r--r--ext/spl/tests/arrayObject_magicMethods6.phpt42
-rw-r--r--ext/spl/tests/arrayObject_natcasesort_basic1.phpt2
-rw-r--r--ext/spl/tests/arrayObject_natsort_basic1.phpt2
-rw-r--r--ext/spl/tests/arrayObject_setFlags_basic1.phpt2
-rw-r--r--ext/spl/tests/arrayObject_setFlags_basic2.phpt8
-rw-r--r--ext/spl/tests/arrayObject_setIteratorClass_error1.phpt23
-rw-r--r--ext/spl/tests/arrayObject_uasort_basic1.phpt2
-rw-r--r--ext/spl/tests/arrayObject_uasort_error1.phpt10
-rw-r--r--ext/spl/tests/arrayObject_uksort_basic1.phpt2
-rw-r--r--ext/spl/tests/arrayObject_uksort_error1.phpt10
-rw-r--r--ext/spl/tests/array_001.phpt3
-rw-r--r--ext/spl/tests/array_002.phpt3
-rw-r--r--ext/spl/tests/array_003.phpt21
-rw-r--r--ext/spl/tests/array_004.phpt12
-rw-r--r--ext/spl/tests/array_005.phpt99
-rw-r--r--ext/spl/tests/array_006.phpt15
-rw-r--r--ext/spl/tests/array_007.phpt29
-rw-r--r--ext/spl/tests/array_008.phpt15
-rw-r--r--ext/spl/tests/array_009.phpt5
-rw-r--r--ext/spl/tests/array_009a.phpt21
-rw-r--r--ext/spl/tests/array_010.phpt3
-rw-r--r--ext/spl/tests/array_011.phpt5
-rw-r--r--ext/spl/tests/array_012.phpt21
-rw-r--r--ext/spl/tests/array_013.phpt21
-rw-r--r--ext/spl/tests/array_014.phpt19
-rw-r--r--ext/spl/tests/array_015.phpt11
-rw-r--r--ext/spl/tests/array_016.phpt7
-rw-r--r--ext/spl/tests/array_017.phpt171
-rw-r--r--ext/spl/tests/array_018.phptbin632 -> 631 bytes
-rw-r--r--ext/spl/tests/array_019.phpt9
-rw-r--r--ext/spl/tests/array_020.phpt57
-rw-r--r--ext/spl/tests/array_021.phpt16
-rw-r--r--ext/spl/tests/array_022.phpt22
-rw-r--r--ext/spl/tests/array_024.phpt2
-rw-r--r--ext/spl/tests/array_026.phpt4
-rw-r--r--ext/spl/tests/bug28822.phpt2
-rw-r--r--ext/spl/tests/bug31185.phpt36
-rw-r--r--ext/spl/tests/bug32134.phpt5
-rw-r--r--ext/spl/tests/bug32394.phpt2
-rw-r--r--ext/spl/tests/bug33136.phpt35
-rw-r--r--ext/spl/tests/bug34548.phpt16
-rw-r--r--ext/spl/tests/bug36258.phpt8
-rw-r--r--ext/spl/tests/bug36287.phpt18
-rw-r--r--ext/spl/tests/bug36825.phpt16
-rw-r--r--ext/spl/tests/bug36941.phpt2
-rw-r--r--ext/spl/tests/bug37457.phpt78
-rw-r--r--ext/spl/tests/bug38618.phpt5
-rw-r--r--ext/spl/tests/bug40036.phpt2
-rw-r--r--ext/spl/tests/bug40091.phpt10
-rw-r--r--ext/spl/tests/bug40442.phpt2
-rw-r--r--ext/spl/tests/bug40872.phpt34
-rw-r--r--ext/spl/tests/bug41691.phpt12
-rw-r--r--ext/spl/tests/bug42364.phpt2
-rw-r--r--ext/spl/tests/bug42703.phpt24
-rw-r--r--ext/spl/tests/bug45216.phpt25
-rw-r--r--ext/spl/tests/bug45614.phpt12
-rw-r--r--ext/spl/tests/bug45622.phpt2
-rw-r--r--ext/spl/tests/bug45622b.phpt8
-rw-r--r--ext/spl/tests/bug46051.phpt4
-rw-r--r--ext/spl/tests/bug46160.phpt4
-rw-r--r--ext/spl/tests/bug48361.phpt2
-rw-r--r--ext/spl/tests/bug49263.phpt2
-rw-r--r--ext/spl/tests/bug50579.phpt18
-rw-r--r--ext/spl/tests/bug51068.phpt4
-rw-r--r--ext/spl/tests/bug51119.phpt2
-rw-r--r--ext/spl/tests/bug51374.phpt2
-rw-r--r--ext/spl/tests/bug53071.phpt14
-rw-r--r--ext/spl/tests/bug53362.phpt6
-rw-r--r--ext/spl/tests/bug54281.phpt2
-rw-r--r--ext/spl/tests/bug54291.phpt2
-rw-r--r--ext/spl/tests/bug54292.phpt4
-rw-r--r--ext/spl/tests/bug54304.phpt10
-rw-r--r--ext/spl/tests/bug54323.phpt2
-rw-r--r--ext/spl/tests/bug54384.phpt20
-rw-r--r--ext/spl/tests/bug55701.phpt2
-rw-r--r--ext/spl/tests/bug60201.phpt2
-rw-r--r--ext/spl/tests/bug61347.phpt4
-rw-r--r--ext/spl/tests/bug61453.phpt10
-rw-r--r--ext/spl/tests/bug62978.phpt6
-rw-r--r--ext/spl/tests/bug64023.phpt2
-rw-r--r--ext/spl/tests/bug65213.phpt2
-rw-r--r--ext/spl/tests/bug65545.phpt6
-rw-r--r--ext/spl/tests/bug66834.phpt48
-rw-r--r--ext/spl/tests/bug67359.phpt24
-rw-r--r--ext/spl/tests/bug67582.phpt4
-rw-r--r--ext/spl/tests/bug68128.phpt6
-rw-r--r--ext/spl/tests/bug68175.phpt2
-rw-r--r--ext/spl/tests/bug68479.phpt2
-rw-r--r--ext/spl/tests/bug68825.phpt2
-rw-r--r--ext/spl/tests/bug69108.phpt6
-rw-r--r--ext/spl/tests/bug69335.phpt8
-rw-r--r--ext/spl/tests/bug69845.phpt6
-rw-r--r--ext/spl/tests/bug69970.phpt12
-rw-r--r--ext/spl/tests/bug70068.phpt2
-rw-r--r--ext/spl/tests/bug70166.phpt2
-rw-r--r--ext/spl/tests/bug70168.phpt2
-rw-r--r--ext/spl/tests/bug70169.phpt2
-rw-r--r--ext/spl/tests/bug70365.phpt20
-rw-r--r--ext/spl/tests/bug70366.phpt20
-rw-r--r--ext/spl/tests/bug70730.phpt24
-rw-r--r--ext/spl/tests/bug70852.phpt2
-rw-r--r--ext/spl/tests/bug70959.phpt14
-rw-r--r--ext/spl/tests/bug71028.phpt2
-rw-r--r--ext/spl/tests/bug71202.phpt40
-rw-r--r--ext/spl/tests/bug71204.phpt2
-rw-r--r--ext/spl/tests/bug71617.phpt34
-rw-r--r--ext/spl/tests/bug71735.phpt4
-rw-r--r--ext/spl/tests/bug72051.phpt6
-rw-r--r--ext/spl/tests/bug72684.phpt4
-rw-r--r--ext/spl/tests/bug72888.phpt6
-rw-r--r--ext/spl/tests/bug73029.phpt2
-rw-r--r--ext/spl/tests/bug73423.phpt2
-rw-r--r--ext/spl/tests/bug73629.phpt2
-rw-r--r--ext/spl/tests/bug73686.phpt6
-rw-r--r--ext/spl/tests/bug73896.phpt6
-rw-r--r--ext/spl/tests/bug74519.phpt6
-rw-r--r--ext/spl/tests/bug75049.phpt2
-rw-r--r--ext/spl/tests/bug75717.phpt2
-rw-r--r--ext/spl/tests/bug76367.phpt2
-rw-r--r--ext/spl/tests/bug78863.phpt2
-rw-r--r--ext/spl/tests/class_implements_basic.phpt2
-rw-r--r--ext/spl/tests/class_implements_basic2.phpt2
-rw-r--r--ext/spl/tests/class_implements_variation.phpt2
-rw-r--r--ext/spl/tests/class_implements_variation1.phpt90
-rw-r--r--ext/spl/tests/class_uses_basic.phpt2
-rw-r--r--ext/spl/tests/class_uses_basic2.phpt4
-rw-r--r--ext/spl/tests/class_uses_variation.phpt2
-rw-r--r--ext/spl/tests/class_uses_variation1.phpt90
-rw-r--r--ext/spl/tests/countable_count_variation1.phpt32
-rw-r--r--ext/spl/tests/dit_001.phpt2
-rw-r--r--ext/spl/tests/dit_001_noglob.phpt2
-rw-r--r--ext/spl/tests/dit_002.phpt66
-rw-r--r--ext/spl/tests/dit_003.phpt4
-rw-r--r--ext/spl/tests/dit_004.phpt2
-rw-r--r--ext/spl/tests/dit_005.phpt2
-rw-r--r--ext/spl/tests/dit_006.phpt2
-rw-r--r--ext/spl/tests/dllist_001.phpt3
-rw-r--r--ext/spl/tests/dllist_002.phpt3
-rw-r--r--ext/spl/tests/dllist_003.phpt3
-rw-r--r--ext/spl/tests/dllist_004.phpt3
-rw-r--r--ext/spl/tests/dllist_005.phpt3
-rw-r--r--ext/spl/tests/dllist_006.phpt3
-rw-r--r--ext/spl/tests/dllist_007.phpt3
-rw-r--r--ext/spl/tests/dllist_008.phpt2
-rw-r--r--ext/spl/tests/dllist_010.phpt2
-rw-r--r--ext/spl/tests/dllist_011.phpt2
-rw-r--r--ext/spl/tests/dllist_012.phpt2
-rw-r--r--ext/spl/tests/dllist_013.phpt7
-rw-r--r--ext/spl/tests/dllist_memleak.phpt3
-rw-r--r--ext/spl/tests/dualiterator.inc378
-rw-r--r--ext/spl/tests/dualiterator_001.phpt13
-rw-r--r--ext/spl/tests/fileobject_001.phpt6
-rw-r--r--ext/spl/tests/fileobject_002.phpt25
-rw-r--r--ext/spl/tests/fileobject_003.phpt65
-rw-r--r--ext/spl/tests/fileobject_004.phpt2
-rw-r--r--ext/spl/tests/fileobject_005.phpt14
-rw-r--r--ext/spl/tests/filesystemiterator_flags.phpt14
-rw-r--r--ext/spl/tests/fixedarray_001.phpt2
-rw-r--r--ext/spl/tests/fixedarray_002.phpt6
-rw-r--r--ext/spl/tests/fixedarray_003.phpt6
-rw-r--r--ext/spl/tests/fixedarray_004.phpt6
-rw-r--r--ext/spl/tests/fixedarray_005.phpt14
-rw-r--r--ext/spl/tests/fixedarray_006.phpt8
-rw-r--r--ext/spl/tests/fixedarray_007.phpt10
-rw-r--r--ext/spl/tests/fixedarray_008.phpt10
-rw-r--r--ext/spl/tests/fixedarray_009.phpt6
-rw-r--r--ext/spl/tests/fixedarray_012.phpt4
-rw-r--r--ext/spl/tests/fixedarray_013.phpt6
-rw-r--r--ext/spl/tests/fixedarray_014.phpt6
-rw-r--r--ext/spl/tests/fixedarray_015.phpt4
-rw-r--r--ext/spl/tests/fixedarray_018.phpt2
-rw-r--r--ext/spl/tests/fixedarray_019.phpt2
-rw-r--r--ext/spl/tests/fixedarray_021.phpt18
-rw-r--r--ext/spl/tests/heap_001.phpt3
-rw-r--r--ext/spl/tests/heap_002.phpt3
-rw-r--r--ext/spl/tests/heap_003.phpt3
-rw-r--r--ext/spl/tests/heap_004.phpt3
-rw-r--r--ext/spl/tests/heap_005.phpt3
-rw-r--r--ext/spl/tests/heap_006.phpt3
-rw-r--r--ext/spl/tests/heap_007.phpt3
-rw-r--r--ext/spl/tests/heap_008.phpt3
-rw-r--r--ext/spl/tests/heap_009.phpt10
-rw-r--r--ext/spl/tests/heap_010.phpt2
-rw-r--r--ext/spl/tests/heap_011.phpt2
-rw-r--r--ext/spl/tests/heap_012.phpt2
-rw-r--r--ext/spl/tests/heap_corruption.phpt54
-rw-r--r--ext/spl/tests/heap_current_variation_001.phpt8
-rw-r--r--ext/spl/tests/heap_top_variation_002.phpt12
-rw-r--r--ext/spl/tests/heap_top_variation_003.phpt4
-rw-r--r--ext/spl/tests/iterator_001.phpt99
-rw-r--r--ext/spl/tests/iterator_002.phpt51
-rw-r--r--ext/spl/tests/iterator_003.phpt99
-rw-r--r--ext/spl/tests/iterator_004.phpt91
-rw-r--r--ext/spl/tests/iterator_005.phpt27
-rw-r--r--ext/spl/tests/iterator_006.phpt5
-rw-r--r--ext/spl/tests/iterator_007.phpt119
-rw-r--r--ext/spl/tests/iterator_008.phpt61
-rw-r--r--ext/spl/tests/iterator_009.phpt55
-rw-r--r--ext/spl/tests/iterator_010.phpt5
-rw-r--r--ext/spl/tests/iterator_011.phpt9
-rw-r--r--ext/spl/tests/iterator_012.phpt5
-rw-r--r--ext/spl/tests/iterator_013.phpt13
-rw-r--r--ext/spl/tests/iterator_014.phpt105
-rw-r--r--ext/spl/tests/iterator_015.phpt47
-rw-r--r--ext/spl/tests/iterator_016.phpt65
-rw-r--r--ext/spl/tests/iterator_018.phpt9
-rw-r--r--ext/spl/tests/iterator_021.phpt165
-rw-r--r--ext/spl/tests/iterator_022.phpt193
-rw-r--r--ext/spl/tests/iterator_023.phpt193
-rw-r--r--ext/spl/tests/iterator_024.phpt7
-rw-r--r--ext/spl/tests/iterator_025.phpt29
-rw-r--r--ext/spl/tests/iterator_026.phpt11
-rw-r--r--ext/spl/tests/iterator_027.phpt13
-rw-r--r--ext/spl/tests/iterator_028.phpt9
-rw-r--r--ext/spl/tests/iterator_029.phpt7
-rw-r--r--ext/spl/tests/iterator_030.phpt11
-rw-r--r--ext/spl/tests/iterator_031.phpt71
-rw-r--r--ext/spl/tests/iterator_032.phpt15
-rw-r--r--ext/spl/tests/iterator_033.phpt11
-rw-r--r--ext/spl/tests/iterator_034.phpt183
-rw-r--r--ext/spl/tests/iterator_036.phpt8
-rw-r--r--ext/spl/tests/iterator_037.phpt86
-rw-r--r--ext/spl/tests/iterator_038.phpt6
-rw-r--r--ext/spl/tests/iterator_039.phpt75
-rw-r--r--ext/spl/tests/iterator_040.phpt19
-rw-r--r--ext/spl/tests/iterator_041.phpt141
-rw-r--r--ext/spl/tests/iterator_041a.phpt143
-rw-r--r--ext/spl/tests/iterator_041b.phpt151
-rw-r--r--ext/spl/tests/iterator_042.phpt21
-rw-r--r--ext/spl/tests/iterator_043.phpt3
-rw-r--r--ext/spl/tests/iterator_044.phpt82
-rw-r--r--ext/spl/tests/iterator_045.phpt104
-rw-r--r--ext/spl/tests/iterator_046.phpt45
-rw-r--r--ext/spl/tests/iterator_047.phpt93
-rw-r--r--ext/spl/tests/iterator_048.phpt19
-rw-r--r--ext/spl/tests/iterator_049.phpt3
-rw-r--r--ext/spl/tests/iterator_049b.phptbin632 -> 613 bytes
-rw-r--r--ext/spl/tests/iterator_050.phpt19
-rw-r--r--ext/spl/tests/iterator_051.phpt19
-rw-r--r--ext/spl/tests/iterator_052.phpt47
-rw-r--r--ext/spl/tests/iterator_053.phpt47
-rw-r--r--ext/spl/tests/iterator_054.phpt19
-rw-r--r--ext/spl/tests/iterator_055.phpt19
-rw-r--r--ext/spl/tests/iterator_056.phpt14
-rw-r--r--ext/spl/tests/iterator_057.phpt4
-rw-r--r--ext/spl/tests/iterator_058.phpt14
-rw-r--r--ext/spl/tests/iterator_062.phpt4
-rw-r--r--ext/spl/tests/iterator_067.phpt6
-rw-r--r--ext/spl/tests/iterator_068.phpt26
-rw-r--r--ext/spl/tests/iterator_070.phpt2
-rw-r--r--ext/spl/tests/iterator_071.phpt2
-rw-r--r--ext/spl/tests/iterator_count.phpt12
-rw-r--r--ext/spl/tests/iterator_to_array.phpt11
-rw-r--r--ext/spl/tests/iterator_to_array_nonscalar_keys.phpt22
-rw-r--r--ext/spl/tests/multiple_iterator_001.phpt32
-rw-r--r--ext/spl/tests/observer_001.phpt86
-rw-r--r--ext/spl/tests/observer_002.phpt181
-rw-r--r--ext/spl/tests/observer_003.phpt17
-rw-r--r--ext/spl/tests/observer_004.phpt27
-rw-r--r--ext/spl/tests/observer_005.phpt51
-rw-r--r--ext/spl/tests/observer_006.phpt27
-rw-r--r--ext/spl/tests/observer_007.phpt3
-rw-r--r--ext/spl/tests/observer_008.phpt3
-rw-r--r--ext/spl/tests/observer_009.phpt3
-rw-r--r--ext/spl/tests/pqueue_001.phpt3
-rw-r--r--ext/spl/tests/pqueue_002.phpt3
-rw-r--r--ext/spl/tests/pqueue_003.phpt3
-rw-r--r--ext/spl/tests/pqueue_004.phpt3
-rw-r--r--ext/spl/tests/pqueue_compare_basic.phpt3
-rw-r--r--ext/spl/tests/recursiveIteratorIterator_beginchildren_error.phpt2
-rw-r--r--ext/spl/tests/recursiveIteratorIterator_callHasChildren_error.phpt2
-rw-r--r--ext/spl/tests/recursiveIteratorIterator_endchildren_error.phpt2
-rw-r--r--ext/spl/tests/recursiveIteratorIterator_nextelement_error.phpt2
-rw-r--r--ext/spl/tests/recursive_tree_iterator_001.phpt60
-rw-r--r--ext/spl/tests/recursive_tree_iterator_002.phpt6
-rw-r--r--ext/spl/tests/recursive_tree_iterator_003.phpt4
-rw-r--r--ext/spl/tests/recursive_tree_iterator_004.phpt36
-rw-r--r--ext/spl/tests/recursive_tree_iterator_005.phpt42
-rw-r--r--ext/spl/tests/recursive_tree_iterator_006.phpt74
-rw-r--r--ext/spl/tests/recursive_tree_iterator_007.phpt24
-rw-r--r--ext/spl/tests/recursive_tree_iterator_008.phpt20
-rw-r--r--ext/spl/tests/recursive_tree_iterator_setpostfix.phpt38
-rw-r--r--ext/spl/tests/recursivecomparedualiterator.inc86
-rw-r--r--ext/spl/tests/recursivedualiterator.inc92
-rw-r--r--ext/spl/tests/regexIterator_setMode_error.phpt10
-rw-r--r--ext/spl/tests/spl_001.phpt4
-rw-r--r--ext/spl/tests/spl_002.phpt10
-rw-r--r--ext/spl/tests/spl_003.phpt3
-rw-r--r--ext/spl/tests/spl_004.phpt57
-rw-r--r--ext/spl/tests/spl_006.phpt2
-rw-r--r--ext/spl/tests/spl_007.phpt3
-rw-r--r--ext/spl/tests/spl_autoload_001.phpt13
-rw-r--r--ext/spl/tests/spl_autoload_002.phpt3
-rw-r--r--ext/spl/tests/spl_autoload_003.phpt15
-rw-r--r--ext/spl/tests/spl_autoload_004.phpt5
-rw-r--r--ext/spl/tests/spl_autoload_005.phpt19
-rw-r--r--ext/spl/tests/spl_autoload_006.phpt5
-rw-r--r--ext/spl/tests/spl_autoload_007.phpt59
-rw-r--r--ext/spl/tests/spl_autoload_008.phpt79
-rw-r--r--ext/spl/tests/spl_autoload_009.phpt7
-rw-r--r--ext/spl/tests/spl_autoload_010.phpt3
-rw-r--r--ext/spl/tests/spl_autoload_011.phpt1
-rw-r--r--ext/spl/tests/spl_autoload_013.phpt4
-rw-r--r--ext/spl/tests/spl_autoload_014.phpt4
-rw-r--r--ext/spl/tests/spl_autoload_bug48541.phpt2
-rw-r--r--ext/spl/tests/spl_caching_iterator_constructor_flags.phpt2
-rw-r--r--ext/spl/tests/spl_cachingiterator___toString_basic.phpt2
-rw-r--r--ext/spl/tests/spl_fileinfo_getlinktarget_basic.phpt2
-rw-r--r--ext/spl/tests/spl_heap_count_basic.phpt4
-rw-r--r--ext/spl/tests/spl_heap_is_empty_basic.phpt3
-rw-r--r--ext/spl/tests/spl_iterator_apply_error.phpt10
-rw-r--r--ext/spl/tests/spl_iterator_apply_error_001.phpt6
-rw-r--r--ext/spl/tests/spl_iterator_caching_count_basic.phpt2
-rw-r--r--ext/spl/tests/spl_iterator_caching_count_error.phpt2
-rw-r--r--ext/spl/tests/spl_iterator_caching_getcache_error.phpt2
-rw-r--r--ext/spl/tests/spl_iterator_getcallchildren.phpt2
-rw-r--r--ext/spl/tests/spl_iterator_iterator_constructor.phpt2
-rw-r--r--ext/spl/tests/spl_iterator_to_array_error.phpt18
-rw-r--r--ext/spl/tests/spl_limit_iterator_check_limits.phpt2
-rw-r--r--ext/spl/tests/spl_object_id.phpt8
-rw-r--r--ext/spl/tests/spl_pq_top_error_corrupt.phpt14
-rw-r--r--ext/spl/tests/spl_pqueue_gc.phpt2
-rw-r--r--ext/spl/tests/unserialize.phpt22
-rw-r--r--ext/sqlite3/php_sqlite3.h2
-rw-r--r--ext/sqlite3/php_sqlite3_structs.h4
-rw-r--r--ext/sqlite3/sqlite3.c515
-rw-r--r--ext/sqlite3/sqlite3.stub.php131
-rw-r--r--ext/sqlite3/sqlite3_arginfo.h147
-rw-r--r--ext/sqlite3/tests/bug45798.phpt2
-rw-r--r--ext/sqlite3/tests/bug66550.phpt2
-rw-r--r--ext/sqlite3/tests/bug68760.phpt4
-rw-r--r--ext/sqlite3/tests/bug72668.phpt20
-rw-r--r--ext/sqlite3/tests/bug73333.phpt2
-rw-r--r--ext/sqlite3/tests/bug76665.phpt2
-rw-r--r--ext/sqlite3/tests/skipif.inc2
-rw-r--r--ext/sqlite3/tests/sqlite3_03_insert.phpt2
-rw-r--r--ext/sqlite3/tests/sqlite3_04_update.phpt4
-rw-r--r--ext/sqlite3/tests/sqlite3_05_delete.phpt4
-rw-r--r--ext/sqlite3/tests/sqlite3_06_prepared_stmt.phpt2
-rw-r--r--ext/sqlite3/tests/sqlite3_07_prepared_stmt.phpt2
-rw-r--r--ext/sqlite3/tests/sqlite3_08_udf.phpt4
-rw-r--r--ext/sqlite3/tests/sqlite3_09_blob_bound_param.phpt2
-rw-r--r--ext/sqlite3/tests/sqlite3_10_bound_value_name.phpt2
-rw-r--r--ext/sqlite3/tests/sqlite3_12_unfinalized_stmt_cleanup.phpt6
-rw-r--r--ext/sqlite3/tests/sqlite3_13_skip_all_cleanup.phpt2
-rw-r--r--ext/sqlite3/tests/sqlite3_15_open_error-win.phpt4
-rw-r--r--ext/sqlite3/tests/sqlite3_15_open_error.phpt4
-rw-r--r--ext/sqlite3/tests/sqlite3_16_select_no_results.phpt2
-rw-r--r--ext/sqlite3/tests/sqlite3_19_columninfo.phpt8
-rw-r--r--ext/sqlite3/tests/sqlite3_20_error.phpt4
-rw-r--r--ext/sqlite3/tests/sqlite3_21_security.phpt4
-rw-r--r--ext/sqlite3/tests/sqlite3_23_escape_string.phpt2
-rw-r--r--ext/sqlite3/tests/sqlite3_25_create_aggregate.phpt16
-rw-r--r--ext/sqlite3/tests/sqlite3_26_reset_prepared_stmt.phpt4
-rw-r--r--ext/sqlite3/tests/sqlite3_27_reset_prepared_stmt_result.phpt4
-rw-r--r--ext/sqlite3/tests/sqlite3_28_clear_bindings.phpt4
-rw-r--r--ext/sqlite3/tests/sqlite3_33_reset.phpt4
-rw-r--r--ext/sqlite3/tests/sqlite3_36_create_collation.phpt8
-rw-r--r--ext/sqlite3/tests/sqlite3_40_setauthorizer.phpt104
-rw-r--r--ext/sqlite3/tests/sqlite3_bind_bug68849.phpt8
-rw-r--r--ext/sqlite3/tests/sqlite3_blob_bind_resource.phpt8
-rw-r--r--ext/sqlite3/tests/sqlite3_bound_value_at_name.phpt2
-rw-r--r--ext/sqlite3/tests/sqlite3_enable_exceptions.phpt4
-rw-r--r--ext/sqlite3/tests/sqlite3_prepare_001.phpt4
-rw-r--r--ext/sqlite3/tests/sqlite3stmt_paramCount_basic.phpt16
-rw-r--r--ext/sqlite3/tests/stream_test.inc72
-rw-r--r--ext/standard/array.c657
-rw-r--r--ext/standard/assert.c91
-rw-r--r--ext/standard/base64.c4
-rw-r--r--ext/standard/base64.h2
-rwxr-xr-x[-rw-r--r--]ext/standard/basic_functions.c2825
-rw-r--r--ext/standard/basic_functions.h12
-rwxr-xr-xext/standard/basic_functions.stub.php1472
-rwxr-xr-xext/standard/basic_functions_arginfo.h2186
-rw-r--r--ext/standard/browscap.c14
-rw-r--r--ext/standard/config.m430
-rw-r--r--ext/standard/config.w326
-rw-r--r--ext/standard/crc32.c2
-rw-r--r--ext/standard/crc32.h2
-rw-r--r--ext/standard/credits.c2
-rw-r--r--ext/standard/credits.h2
-rw-r--r--ext/standard/crypt.c2
-rw-r--r--ext/standard/css.c2
-rw-r--r--ext/standard/css.h2
-rw-r--r--ext/standard/cyr_convert.c286
-rw-r--r--ext/standard/cyr_convert.h24
-rw-r--r--ext/standard/datetime.c4
-rw-r--r--ext/standard/datetime.h2
-rw-r--r--ext/standard/dir.c67
-rw-r--r--ext/standard/dl.c2
-rw-r--r--ext/standard/dl.h2
-rw-r--r--ext/standard/dns.c28
-rw-r--r--ext/standard/dns_win32.c16
-rw-r--r--ext/standard/exec.c32
-rw-r--r--ext/standard/exec.h2
-rw-r--r--ext/standard/file.c176
-rw-r--r--ext/standard/file.h3
-rw-r--r--ext/standard/filestat.c32
-rw-r--r--ext/standard/filters.c151
-rw-r--r--ext/standard/flock_compat.c2
-rw-r--r--ext/standard/flock_compat.h2
-rw-r--r--ext/standard/formatted_print.c118
-rw-r--r--ext/standard/fsock.c6
-rw-r--r--ext/standard/fsock.h2
-rw-r--r--ext/standard/ftok.c2
-rw-r--r--ext/standard/ftp_fopen_wrapper.c2
-rw-r--r--ext/standard/head.c6
-rw-r--r--ext/standard/head.h2
-rw-r--r--ext/standard/hrtime.c4
-rw-r--r--ext/standard/hrtime.h2
-rw-r--r--ext/standard/html.c4
-rw-r--r--ext/standard/html.h2
-rw-r--r--ext/standard/html_tables.h2
-rwxr-xr-xext/standard/html_tables/html_table_gen.php4
-rw-r--r--ext/standard/http.c6
-rw-r--r--ext/standard/http_fopen_wrapper.c2
-rw-r--r--ext/standard/image.c38
-rw-r--r--ext/standard/incomplete_class.c40
-rw-r--r--ext/standard/info.c30
-rw-r--r--ext/standard/info.h2
-rw-r--r--ext/standard/iptc.c6
-rw-r--r--ext/standard/lcg.c7
-rw-r--r--ext/standard/levenshtein.c8
-rw-r--r--ext/standard/link.c10
-rw-r--r--ext/standard/mail.c69
-rw-r--r--ext/standard/math.c229
-rw-r--r--ext/standard/md5.c2
-rw-r--r--ext/standard/md5.h2
-rw-r--r--ext/standard/metaphone.c4
-rw-r--r--ext/standard/microtime.c4
-rw-r--r--ext/standard/microtime.h2
-rw-r--r--ext/standard/mt_rand.c10
-rw-r--r--ext/standard/net.c2
-rw-r--r--ext/standard/pack.c6
-rw-r--r--ext/standard/pack.h2
-rw-r--r--ext/standard/pageinfo.c22
-rw-r--r--ext/standard/pageinfo.h2
-rw-r--r--ext/standard/password.c112
-rw-r--r--ext/standard/php_array.h2
-rw-r--r--ext/standard/php_assert.h2
-rw-r--r--ext/standard/php_browscap.h2
-rw-r--r--ext/standard/php_crypt.h2
-rw-r--r--ext/standard/php_crypt_r.c2
-rw-r--r--ext/standard/php_crypt_r.h2
-rw-r--r--ext/standard/php_dir.h2
-rw-r--r--ext/standard/php_dns.h2
-rw-r--r--ext/standard/php_ext_syslog.h2
-rw-r--r--ext/standard/php_filestat.h3
-rw-r--r--ext/standard/php_fopen_wrapper.c2
-rw-r--r--ext/standard/php_fopen_wrappers.h2
-rw-r--r--ext/standard/php_ftok.h2
-rw-r--r--ext/standard/php_http.h2
-rw-r--r--ext/standard/php_image.h4
-rw-r--r--ext/standard/php_incomplete_class.h6
-rw-r--r--ext/standard/php_iptc.h2
-rw-r--r--ext/standard/php_lcg.h2
-rw-r--r--ext/standard/php_link.h2
-rw-r--r--ext/standard/php_mail.h5
-rw-r--r--ext/standard/php_math.h7
-rw-r--r--ext/standard/php_metaphone.h2
-rw-r--r--ext/standard/php_mt_rand.h2
-rw-r--r--ext/standard/php_net.h2
-rw-r--r--ext/standard/php_password.h2
-rw-r--r--ext/standard/php_rand.h2
-rw-r--r--ext/standard/php_random.h2
-rw-r--r--ext/standard/php_smart_string.h2
-rw-r--r--ext/standard/php_smart_string_public.h2
-rw-r--r--ext/standard/php_standard.h3
-rw-r--r--ext/standard/php_string.h12
-rw-r--r--ext/standard/php_type.h2
-rw-r--r--ext/standard/php_uuencode.h2
-rw-r--r--ext/standard/php_var.h2
-rw-r--r--ext/standard/php_versioning.h2
-rw-r--r--ext/standard/proc_open.c65
-rw-r--r--ext/standard/proc_open.h2
-rw-r--r--ext/standard/quot_print.c2
-rw-r--r--ext/standard/quot_print.h2
-rw-r--r--ext/standard/rand.c2
-rw-r--r--ext/standard/random.c14
-rw-r--r--ext/standard/scanf.c26
-rw-r--r--ext/standard/scanf.h7
-rw-r--r--ext/standard/sha1.c2
-rw-r--r--ext/standard/sha1.h2
-rw-r--r--ext/standard/soundex.c2
-rw-r--r--ext/standard/streamsfuncs.c192
-rw-r--r--ext/standard/streamsfuncs.h2
-rw-r--r--ext/standard/string.c840
-rw-r--r--ext/standard/syslog.c6
-rw-r--r--ext/standard/tests/array/002.phpt52
-rw-r--r--ext/standard/tests/array/004.phpt10
-rw-r--r--ext/standard/tests/array/005.phpt24
-rw-r--r--ext/standard/tests/array/007.phpt28
-rw-r--r--ext/standard/tests/array/009.phpt125
-rw-r--r--ext/standard/tests/array/array_change_key_case.phpt8
-rw-r--r--ext/standard/tests/array/array_change_key_case_variation.phpt13
-rw-r--r--ext/standard/tests/array/array_change_key_case_variation4.phpt6
-rw-r--r--ext/standard/tests/array/array_change_key_case_variation6.phpt4
-rw-r--r--ext/standard/tests/array/array_change_key_case_variation8.phpt18
-rw-r--r--ext/standard/tests/array/array_chunk.phpt21
-rw-r--r--ext/standard/tests/array/array_chunk2.phpt24
-rw-r--r--ext/standard/tests/array/array_chunk_basic1.phpt4
-rw-r--r--ext/standard/tests/array/array_chunk_variation10.phpt17
-rw-r--r--ext/standard/tests/array/array_chunk_variation11.phpt17
-rw-r--r--ext/standard/tests/array/array_chunk_variation12.phpt17
-rw-r--r--ext/standard/tests/array/array_chunk_variation13.phpt17
-rw-r--r--ext/standard/tests/array/array_chunk_variation14.phpt17
-rw-r--r--ext/standard/tests/array/array_chunk_variation15.phpt17
-rw-r--r--ext/standard/tests/array/array_chunk_variation16.phpt17
-rw-r--r--ext/standard/tests/array/array_chunk_variation17.phpt17
-rw-r--r--ext/standard/tests/array/array_chunk_variation18.phpt17
-rw-r--r--ext/standard/tests/array/array_chunk_variation19.phpt17
-rw-r--r--ext/standard/tests/array/array_chunk_variation20.phpt17
-rw-r--r--ext/standard/tests/array/array_chunk_variation21.phpt17
-rw-r--r--ext/standard/tests/array/array_chunk_variation22.phpt17
-rw-r--r--ext/standard/tests/array/array_chunk_variation23.phpt17
-rw-r--r--ext/standard/tests/array/array_chunk_variation24.phpt17
-rw-r--r--ext/standard/tests/array/array_chunk_variation25.phpt17
-rw-r--r--ext/standard/tests/array/array_chunk_variation26.phpt17
-rw-r--r--ext/standard/tests/array/array_chunk_variation27.phpt17
-rw-r--r--ext/standard/tests/array/array_chunk_variation28.phpt17
-rw-r--r--ext/standard/tests/array/array_chunk_variation29.phpt17
-rw-r--r--ext/standard/tests/array/array_chunk_variation30.phpt17
-rw-r--r--ext/standard/tests/array/array_chunk_variation31.phpt17
-rw-r--r--ext/standard/tests/array/array_chunk_variation32.phpt17
-rw-r--r--ext/standard/tests/array/array_chunk_variation4.phpt4
-rw-r--r--ext/standard/tests/array/array_chunk_variation5.phpt49
-rw-r--r--ext/standard/tests/array/array_chunk_variation8.phpt17
-rw-r--r--ext/standard/tests/array/array_chunk_variation9.phpt17
-rw-r--r--ext/standard/tests/array/array_column_basic.phpt100
-rw-r--r--ext/standard/tests/array/array_column_error.phpt80
-rw-r--r--ext/standard/tests/array/array_column_variant_objects.phpt36
-rw-r--r--ext/standard/tests/array/array_combine.phpt48
-rw-r--r--ext/standard/tests/array/array_combine_error2.phpt36
-rw-r--r--ext/standard/tests/array/array_combine_variation3.phpt2
-rw-r--r--ext/standard/tests/array/array_combine_variation4.phpt16
-rw-r--r--ext/standard/tests/array/array_count_values.phpt28
-rw-r--r--ext/standard/tests/array/array_count_values2.phpt30
-rw-r--r--ext/standard/tests/array/array_count_values_variation.phpt6
-rw-r--r--ext/standard/tests/array/array_diff_1.phpt8
-rw-r--r--ext/standard/tests/array/array_diff_assoc_error.phpt21
-rw-r--r--ext/standard/tests/array/array_diff_assoc_variation1.phpt118
-rw-r--r--ext/standard/tests/array/array_diff_assoc_variation2.phpt118
-rw-r--r--ext/standard/tests/array/array_diff_assoc_variation3.phpt4
-rw-r--r--ext/standard/tests/array/array_diff_assoc_variation4.phpt2
-rw-r--r--ext/standard/tests/array/array_diff_assoc_variation6.phpt30
-rw-r--r--ext/standard/tests/array/array_diff_error.phpt20
-rw-r--r--ext/standard/tests/array/array_diff_key_error.phpt22
-rw-r--r--ext/standard/tests/array/array_diff_key_variation1.phpt232
-rw-r--r--ext/standard/tests/array/array_diff_key_variation2.phpt232
-rw-r--r--ext/standard/tests/array/array_diff_key_variation3.phpt232
-rw-r--r--ext/standard/tests/array/array_diff_key_variation4.phpt2
-rw-r--r--ext/standard/tests/array/array_diff_key_variation5.phpt2
-rw-r--r--ext/standard/tests/array/array_diff_key_variation6.phpt2
-rw-r--r--ext/standard/tests/array/array_diff_key_variation7.phpt2
-rw-r--r--ext/standard/tests/array/array_diff_key_variation8.phpt6
-rw-r--r--ext/standard/tests/array/array_diff_uassoc_error.phpt42
-rw-r--r--ext/standard/tests/array/array_diff_uassoc_variation1.phpt122
-rw-r--r--ext/standard/tests/array/array_diff_uassoc_variation10.phpt2
-rw-r--r--ext/standard/tests/array/array_diff_uassoc_variation11.phpt2
-rw-r--r--ext/standard/tests/array/array_diff_uassoc_variation12.phpt2
-rw-r--r--ext/standard/tests/array/array_diff_uassoc_variation13.phpt2
-rw-r--r--ext/standard/tests/array/array_diff_uassoc_variation2.phpt122
-rw-r--r--ext/standard/tests/array/array_diff_uassoc_variation4.phpt246
-rw-r--r--ext/standard/tests/array/array_diff_uassoc_variation5.phpt2
-rw-r--r--ext/standard/tests/array/array_diff_uassoc_variation6.phpt2
-rw-r--r--ext/standard/tests/array/array_diff_uassoc_variation7.phpt2
-rw-r--r--ext/standard/tests/array/array_diff_uassoc_variation8.phpt2
-rw-r--r--ext/standard/tests/array/array_diff_uassoc_variation9.phpt2
-rw-r--r--ext/standard/tests/array/array_diff_ukey_variation1.phpt232
-rw-r--r--ext/standard/tests/array/array_diff_ukey_variation10.phpt32
-rw-r--r--ext/standard/tests/array/array_diff_ukey_variation2.phpt232
-rw-r--r--ext/standard/tests/array/array_diff_ukey_variation3.phpt240
-rw-r--r--ext/standard/tests/array/array_diff_ukey_variation5.phpt6
-rw-r--r--ext/standard/tests/array/array_diff_ukey_variation6.phpt2
-rw-r--r--ext/standard/tests/array/array_diff_ukey_variation7.phpt2
-rw-r--r--ext/standard/tests/array/array_diff_ukey_variation8.phpt2
-rw-r--r--ext/standard/tests/array/array_diff_ukey_variation9.phpt2
-rw-r--r--ext/standard/tests/array/array_diff_variation1.phpt118
-rw-r--r--ext/standard/tests/array/array_diff_variation2.phpt118
-rw-r--r--ext/standard/tests/array/array_diff_variation3.phpt2
-rw-r--r--ext/standard/tests/array/array_diff_variation4.phpt2
-rw-r--r--ext/standard/tests/array/array_diff_variation8.phpt2
-rw-r--r--ext/standard/tests/array/array_diff_variation9.phpt28
-rw-r--r--ext/standard/tests/array/array_fill.phpt9
-rw-r--r--ext/standard/tests/array/array_fill_error.phpt45
-rw-r--r--ext/standard/tests/array/array_fill_keys.phpt13
-rw-r--r--ext/standard/tests/array/array_fill_keys_variation1.phpt2
-rw-r--r--ext/standard/tests/array/array_fill_keys_variation3.phpt20
-rw-r--r--ext/standard/tests/array/array_fill_keys_variation4.phpt2
-rw-r--r--ext/standard/tests/array/array_filter.phpt14
-rw-r--r--ext/standard/tests/array/array_filter_variation10.phpt21
-rw-r--r--ext/standard/tests/array/array_filter_variation4.phpt4
-rw-r--r--ext/standard/tests/array/array_filter_variation7.phpt4
-rw-r--r--ext/standard/tests/array/array_filter_variation9.phpt28
-rw-r--r--ext/standard/tests/array/array_flip.phpt6
-rw-r--r--ext/standard/tests/array/array_flip_variation4.phpt24
-rw-r--r--ext/standard/tests/array/array_intersect_1.phpt28
-rw-r--r--ext/standard/tests/array/array_intersect_assoc_error.phpt22
-rw-r--r--ext/standard/tests/array/array_intersect_assoc_variation1.phpt220
-rw-r--r--ext/standard/tests/array/array_intersect_assoc_variation2.phpt222
-rw-r--r--ext/standard/tests/array/array_intersect_assoc_variation3.phpt4
-rw-r--r--ext/standard/tests/array/array_intersect_assoc_variation4.phpt4
-rw-r--r--ext/standard/tests/array/array_intersect_assoc_variation5.phpt2
-rw-r--r--ext/standard/tests/array/array_intersect_assoc_variation6.phpt2
-rw-r--r--ext/standard/tests/array/array_intersect_assoc_variation7.phpt2
-rw-r--r--ext/standard/tests/array/array_intersect_assoc_variation8.phpt2
-rw-r--r--ext/standard/tests/array/array_intersect_assoc_variation9.phpt24
-rw-r--r--ext/standard/tests/array/array_intersect_error.phpt22
-rw-r--r--ext/standard/tests/array/array_intersect_key_error.phpt24
-rw-r--r--ext/standard/tests/array/array_intersect_key_variation1.phpt232
-rw-r--r--ext/standard/tests/array/array_intersect_key_variation2.phpt232
-rw-r--r--ext/standard/tests/array/array_intersect_key_variation3.phpt235
-rw-r--r--ext/standard/tests/array/array_intersect_key_variation4.phpt2
-rw-r--r--ext/standard/tests/array/array_intersect_key_variation5.phpt2
-rw-r--r--ext/standard/tests/array/array_intersect_key_variation6.phpt2
-rw-r--r--ext/standard/tests/array/array_intersect_key_variation7.phpt2
-rw-r--r--ext/standard/tests/array/array_intersect_key_variation8.phpt6
-rw-r--r--ext/standard/tests/array/array_intersect_uassoc_variation1.phpt232
-rw-r--r--ext/standard/tests/array/array_intersect_uassoc_variation10.phpt14
-rw-r--r--ext/standard/tests/array/array_intersect_uassoc_variation2.phpt232
-rw-r--r--ext/standard/tests/array/array_intersect_uassoc_variation3.phpt243
-rw-r--r--ext/standard/tests/array/array_intersect_uassoc_variation5.phpt2
-rw-r--r--ext/standard/tests/array/array_intersect_uassoc_variation6.phpt2
-rw-r--r--ext/standard/tests/array/array_intersect_uassoc_variation7.phpt2
-rw-r--r--ext/standard/tests/array/array_intersect_uassoc_variation8.phpt2
-rw-r--r--ext/standard/tests/array/array_intersect_ukey_variation1.phpt232
-rw-r--r--ext/standard/tests/array/array_intersect_ukey_variation2.phpt232
-rw-r--r--ext/standard/tests/array/array_intersect_ukey_variation4.phpt321
-rw-r--r--ext/standard/tests/array/array_intersect_ukey_variation5.phpt2
-rw-r--r--ext/standard/tests/array/array_intersect_ukey_variation6.phpt2
-rw-r--r--ext/standard/tests/array/array_intersect_ukey_variation7.phpt2
-rw-r--r--ext/standard/tests/array/array_intersect_ukey_variation8.phpt29
-rw-r--r--ext/standard/tests/array/array_intersect_ukey_variation9.phpt14
-rw-r--r--ext/standard/tests/array/array_intersect_variation1.phpt220
-rw-r--r--ext/standard/tests/array/array_intersect_variation2.phpt222
-rw-r--r--ext/standard/tests/array/array_intersect_variation3.phpt4
-rw-r--r--ext/standard/tests/array/array_intersect_variation4.phpt4
-rw-r--r--ext/standard/tests/array/array_intersect_variation5.phpt2
-rw-r--r--ext/standard/tests/array/array_intersect_variation6.phpt2
-rw-r--r--ext/standard/tests/array/array_intersect_variation7.phpt2
-rw-r--r--ext/standard/tests/array/array_intersect_variation8.phpt2
-rw-r--r--ext/standard/tests/array/array_intersect_variation9.phpt80
-rw-r--r--ext/standard/tests/array/array_key_exists.phpt102
-rw-r--r--ext/standard/tests/array/array_key_exists_object1.phpt85
-rw-r--r--ext/standard/tests/array/array_key_exists_object2.phpt91
-rw-r--r--ext/standard/tests/array/array_key_exists_variation1.phpt50
-rw-r--r--ext/standard/tests/array/array_key_exists_variation3.phpt26
-rw-r--r--ext/standard/tests/array/array_key_exists_variation6.phpt20
-rw-r--r--ext/standard/tests/array/array_key_exists_variation8.phpt18
-rw-r--r--ext/standard/tests/array/array_keys_error.phpt42
-rw-r--r--ext/standard/tests/array/array_keys_variation_003.phpt4
-rw-r--r--ext/standard/tests/array/array_map_001.phpt6
-rw-r--r--ext/standard/tests/array/array_map_error.phpt21
-rw-r--r--ext/standard/tests/array/array_map_object1.phpt47
-rw-r--r--ext/standard/tests/array/array_map_object2.phpt20
-rw-r--r--ext/standard/tests/array/array_map_object3.phpt20
-rw-r--r--ext/standard/tests/array/array_map_variation10.phpt18
-rw-r--r--ext/standard/tests/array/array_map_variation12.phpt31
-rw-r--r--ext/standard/tests/array/array_map_variation14.phpt20
-rw-r--r--ext/standard/tests/array/array_map_variation15.phpt12
-rw-r--r--ext/standard/tests/array/array_map_variation16.phpt40
-rw-r--r--ext/standard/tests/array/array_map_variation17.phpt70
-rw-r--r--ext/standard/tests/array/array_map_variation2.phpt33
-rw-r--r--ext/standard/tests/array/array_map_variation3.phpt2
-rw-r--r--ext/standard/tests/array/array_map_variation4.phpt12
-rw-r--r--ext/standard/tests/array/array_map_variation9.phpt4
-rw-r--r--ext/standard/tests/array/array_merge.phpt18
-rw-r--r--ext/standard/tests/array/array_merge_recursive_variation1.phpt224
-rw-r--r--ext/standard/tests/array/array_merge_recursive_variation2.phpt108
-rw-r--r--ext/standard/tests/array/array_merge_recursive_variation4.phpt6
-rw-r--r--ext/standard/tests/array/array_merge_variation1.phpt131
-rw-r--r--ext/standard/tests/array/array_merge_variation2.phpt108
-rw-r--r--ext/standard/tests/array/array_merge_variation3.phpt2
-rw-r--r--ext/standard/tests/array/array_multisort_basic1.phpt2
-rw-r--r--ext/standard/tests/array/array_multisort_basic2.phpt2
-rw-r--r--ext/standard/tests/array/array_multisort_case.phpt30
-rw-r--r--ext/standard/tests/array/array_multisort_error.phpt33
-rw-r--r--ext/standard/tests/array/array_multisort_incase.phpt30
-rw-r--r--ext/standard/tests/array/array_multisort_natural.phpt22
-rw-r--r--ext/standard/tests/array/array_multisort_natural_case.phpt30
-rw-r--r--ext/standard/tests/array/array_multisort_natural_incase.phpt30
-rw-r--r--ext/standard/tests/array/array_multisort_variation1.phpt101
-rw-r--r--ext/standard/tests/array/array_multisort_variation10.phpt4
-rw-r--r--ext/standard/tests/array/array_multisort_variation11.phpt3
-rw-r--r--ext/standard/tests/array/array_multisort_variation2.phpt106
-rw-r--r--ext/standard/tests/array/array_multisort_variation3.phpt104
-rw-r--r--ext/standard/tests/array/array_multisort_variation4.phpt2
-rw-r--r--ext/standard/tests/array/array_multisort_variation5.phpt2
-rw-r--r--ext/standard/tests/array/array_multisort_variation6.phpt2
-rw-r--r--ext/standard/tests/array/array_multisort_variation7.phpt8
-rw-r--r--ext/standard/tests/array/array_multisort_variation8.phpt12
-rw-r--r--ext/standard/tests/array/array_multisort_variation9.phpt8
-rw-r--r--ext/standard/tests/array/array_next_error2.phpt5
-rw-r--r--ext/standard/tests/array/array_pad.phpt30
-rw-r--r--ext/standard/tests/array/array_pad_variation6.phpt2
-rw-r--r--ext/standard/tests/array/array_product_variation1.phpt2
-rw-r--r--ext/standard/tests/array/array_product_variation2.phpt2
-rw-r--r--ext/standard/tests/array/array_product_variation3.phpt2
-rw-r--r--ext/standard/tests/array/array_product_variation4.phpt2
-rw-r--r--ext/standard/tests/array/array_push.phpt22
-rw-r--r--ext/standard/tests/array/array_push_error2.phpt13
-rw-r--r--ext/standard/tests/array/array_rand.phpt62
-rw-r--r--ext/standard/tests/array/array_rand_variation5.phpt46
-rw-r--r--ext/standard/tests/array/array_reduce_variation1.phpt6
-rw-r--r--ext/standard/tests/array/array_reduce_variation3.phpt2
-rw-r--r--ext/standard/tests/array/array_replace.phpt56
-rw-r--r--ext/standard/tests/array/array_reverse_variation3.phpt2
-rw-r--r--ext/standard/tests/array/array_reverse_variation4.phpt12
-rw-r--r--ext/standard/tests/array/array_search1.phpt9
-rw-r--r--ext/standard/tests/array/array_search_variation3.phpt20
-rw-r--r--ext/standard/tests/array/array_search_variation4.phpt2
-rw-r--r--ext/standard/tests/array/array_shift_variation2.phpt2
-rw-r--r--ext/standard/tests/array/array_slice.phpt40
-rw-r--r--ext/standard/tests/array/array_slice_variation1.phpt20
-rw-r--r--ext/standard/tests/array/array_slice_variation11.phpt105
-rw-r--r--ext/standard/tests/array/array_slice_variation2.phpt303
-rw-r--r--ext/standard/tests/array/array_slice_variation5.phpt4
-rw-r--r--ext/standard/tests/array/array_slice_variation6.phpt4
-rw-r--r--ext/standard/tests/array/array_splice_basic.phpt19
-rw-r--r--ext/standard/tests/array/array_splice_variation3.phpt10
-rw-r--r--ext/standard/tests/array/array_splice_variation4.phpt6
-rw-r--r--ext/standard/tests/array/array_sum.phpt8
-rw-r--r--ext/standard/tests/array/array_udiff_assoc_variation.phpt2
-rw-r--r--ext/standard/tests/array/array_udiff_assoc_variation1.phpt118
-rw-r--r--ext/standard/tests/array/array_udiff_assoc_variation2.phpt118
-rw-r--r--ext/standard/tests/array/array_udiff_assoc_variation4.phpt228
-rw-r--r--ext/standard/tests/array/array_udiff_assoc_variation5.phpt6
-rw-r--r--ext/standard/tests/array/array_udiff_uassoc_variation1.phpt118
-rw-r--r--ext/standard/tests/array/array_udiff_uassoc_variation2.phpt118
-rw-r--r--ext/standard/tests/array/array_udiff_uassoc_variation5.phpt229
-rw-r--r--ext/standard/tests/array/array_udiff_uassoc_variation6.phpt6
-rw-r--r--ext/standard/tests/array/array_udiff_variation1.phpt118
-rw-r--r--ext/standard/tests/array/array_udiff_variation2.phpt118
-rw-r--r--ext/standard/tests/array/array_udiff_variation4.phpt228
-rw-r--r--ext/standard/tests/array/array_udiff_variation5.phpt6
-rw-r--r--ext/standard/tests/array/array_uintersect_assoc_basic2.phpt2
-rw-r--r--ext/standard/tests/array/array_uintersect_assoc_variation1.phpt118
-rw-r--r--ext/standard/tests/array/array_uintersect_assoc_variation2.phpt118
-rw-r--r--ext/standard/tests/array/array_uintersect_assoc_variation4.phpt228
-rw-r--r--ext/standard/tests/array/array_uintersect_assoc_variation5.phpt6
-rw-r--r--ext/standard/tests/array/array_uintersect_uassoc_variation1.phpt118
-rw-r--r--ext/standard/tests/array/array_uintersect_uassoc_variation2.phpt118
-rw-r--r--ext/standard/tests/array/array_uintersect_uassoc_variation5.phpt229
-rw-r--r--ext/standard/tests/array/array_uintersect_uassoc_variation6.phpt6
-rw-r--r--ext/standard/tests/array/array_uintersect_variation1.phpt118
-rw-r--r--ext/standard/tests/array/array_uintersect_variation2.phpt118
-rw-r--r--ext/standard/tests/array/array_uintersect_variation4.phpt228
-rw-r--r--ext/standard/tests/array/array_uintersect_variation5.phpt6
-rw-r--r--ext/standard/tests/array/array_unique_variation3.phpt6
-rw-r--r--ext/standard/tests/array/array_unique_variation8.phpt8
-rw-r--r--ext/standard/tests/array/array_unshift.phpt9
-rw-r--r--ext/standard/tests/array/array_unshift_variation3.phpt2
-rw-r--r--ext/standard/tests/array/array_unshift_variation4.phpt12
-rw-r--r--ext/standard/tests/array/array_values.phptbin3050 -> 3050 bytes
-rw-r--r--ext/standard/tests/array/array_values_variation2.phpt2
-rw-r--r--ext/standard/tests/array/array_walk.phpt26
-rw-r--r--ext/standard/tests/array/array_walk_closure.phpt40
-rw-r--r--ext/standard/tests/array/array_walk_error2.phpt24
-rw-r--r--ext/standard/tests/array/array_walk_object1.phpt2
-rw-r--r--ext/standard/tests/array/array_walk_objects.phpt17
-rw-r--r--ext/standard/tests/array/array_walk_rec_objects.phpt17
-rw-r--r--ext/standard/tests/array/array_walk_recursive.phpt4
-rw-r--r--ext/standard/tests/array/array_walk_recursive1.phpt26
-rw-r--r--ext/standard/tests/array/array_walk_recursive_error2.phpt24
-rw-r--r--ext/standard/tests/array/array_walk_recursive_variation7.phpt7
-rw-r--r--ext/standard/tests/array/array_walk_recursive_variation8.phpt10
-rw-r--r--ext/standard/tests/array/array_walk_variation7.phpt7
-rw-r--r--ext/standard/tests/array/array_walk_variation8.phpt10
-rw-r--r--ext/standard/tests/array/arsort_basic.phpt6
-rw-r--r--ext/standard/tests/array/arsort_object1.phpt10
-rw-r--r--ext/standard/tests/array/arsort_object2.phpt2
-rw-r--r--ext/standard/tests/array/arsort_variation10.phpt6
-rw-r--r--ext/standard/tests/array/arsort_variation3.phpt2
-rw-r--r--ext/standard/tests/array/arsort_variation4.phpt6
-rw-r--r--ext/standard/tests/array/arsort_variation5.phpt2
-rw-r--r--ext/standard/tests/array/arsort_variation6.phpt6
-rw-r--r--ext/standard/tests/array/arsort_variation7.phpt6
-rw-r--r--ext/standard/tests/array/asort_basic.phpt6
-rw-r--r--ext/standard/tests/array/asort_object1.phpt10
-rw-r--r--ext/standard/tests/array/asort_object2.phpt2
-rw-r--r--ext/standard/tests/array/asort_variation10.phpt6
-rw-r--r--ext/standard/tests/array/asort_variation3.phpt2
-rw-r--r--ext/standard/tests/array/asort_variation4.phpt6
-rw-r--r--ext/standard/tests/array/asort_variation5.phpt2
-rw-r--r--ext/standard/tests/array/asort_variation6.phpt6
-rw-r--r--ext/standard/tests/array/asort_variation7.phpt6
-rw-r--r--ext/standard/tests/array/bug12776.phpt8
-rw-r--r--ext/standard/tests/array/bug14580.phpt8
-rw-r--r--ext/standard/tests/array/bug20381.phpt26
-rw-r--r--ext/standard/tests/array/bug20865.phpt6
-rw-r--r--ext/standard/tests/array/bug21918.phpt14
-rw-r--r--ext/standard/tests/array/bug22463.phpt22
-rw-r--r--ext/standard/tests/array/bug24220.phpt6
-rw-r--r--ext/standard/tests/array/bug24980.phpt16
-rw-r--r--ext/standard/tests/array/bug25708.phpt92
-rw-r--r--ext/standard/tests/array/bug25758.phpt4
-rw-r--r--ext/standard/tests/array/bug29493.phpt84
-rw-r--r--ext/standard/tests/array/bug30074.phpt4
-rw-r--r--ext/standard/tests/array/bug30266.phpt20
-rw-r--r--ext/standard/tests/array/bug31158.phpt4
-rw-r--r--ext/standard/tests/array/bug31213.phpt32
-rw-r--r--ext/standard/tests/array/bug34066.phpt26
-rw-r--r--ext/standard/tests/array/bug34066_1.phpt26
-rw-r--r--ext/standard/tests/array/bug35014.phpt23
-rw-r--r--ext/standard/tests/array/bug35014_64bit.phpt23
-rw-r--r--ext/standard/tests/array/bug35022.phpt2
-rw-r--r--ext/standard/tests/array/bug35821.phpt16
-rw-r--r--ext/standard/tests/array/bug39576.phpt16
-rw-r--r--ext/standard/tests/array/bug40191.phpt12
-rw-r--r--ext/standard/tests/array/bug41686.phpt12
-rw-r--r--ext/standard/tests/array/bug42177.phpt10
-rw-r--r--ext/standard/tests/array/bug42233.phpt6
-rw-r--r--ext/standard/tests/array/bug42838.phpt8
-rw-r--r--ext/standard/tests/array/bug43495.phpt13
-rw-r--r--ext/standard/tests/array/bug45312.phpt6
-rw-r--r--ext/standard/tests/array/bug61058.phpt11
-rw-r--r--ext/standard/tests/array/bug65251.phpt10
-rw-r--r--ext/standard/tests/array/bug67693.phpt4
-rw-r--r--ext/standard/tests/array/bug68553.phpt22
-rw-r--r--ext/standard/tests/array/bug69198.phpt2
-rw-r--r--ext/standard/tests/array/bug69299.phpt12
-rw-r--r--ext/standard/tests/array/bug69723.phpt26
-rw-r--r--ext/standard/tests/array/bug70713.phpt29
-rw-r--r--ext/standard/tests/array/bug71220.phpt10
-rw-r--r--ext/standard/tests/array/bug71334.phpt38
-rw-r--r--ext/standard/tests/array/bug71660.phpt2
-rw-r--r--ext/standard/tests/array/bug72622.phpt6
-rw-r--r--ext/standard/tests/array/bug76713.phpt10
-rw-r--r--ext/standard/tests/array/bug77395.phpt17
-rw-r--r--ext/standard/tests/array/bug77931.phpt28
-rw-r--r--ext/standard/tests/array/compact_variation1.phpt38
-rw-r--r--ext/standard/tests/array/compact_variation2.phpt10
-rw-r--r--ext/standard/tests/array/count_invalid_mode.phpt37
-rw-r--r--ext/standard/tests/array/count_recursive.phpt62
-rw-r--r--ext/standard/tests/array/count_variation3.phpt2
-rw-r--r--ext/standard/tests/array/current_basic.phpt2
-rw-r--r--ext/standard/tests/array/current_variation2.phpt4
-rw-r--r--ext/standard/tests/array/current_variation3.phpt2
-rw-r--r--ext/standard/tests/array/current_variation4.phpt2
-rw-r--r--ext/standard/tests/array/current_variation5.phpt3
-rw-r--r--ext/standard/tests/array/data.inc16
-rw-r--r--ext/standard/tests/array/each.phptbin9679 -> 0 bytes
-rw-r--r--ext/standard/tests/array/each_basic.phpt76
-rw-r--r--ext/standard/tests/array/each_error.phpt41
-rw-r--r--ext/standard/tests/array/each_variation1.phpt223
-rw-r--r--ext/standard/tests/array/each_variation2.phpt249
-rw-r--r--ext/standard/tests/array/each_variation3.phpt254
-rw-r--r--ext/standard/tests/array/each_variation4.phpt60
-rw-r--r--ext/standard/tests/array/each_variation5.phpt97
-rw-r--r--ext/standard/tests/array/each_variation6.phpt52
-rw-r--r--ext/standard/tests/array/end.phpt30
-rw-r--r--ext/standard/tests/array/end_64bit.phpt30
-rw-r--r--ext/standard/tests/array/end_basic.phpt2
-rw-r--r--ext/standard/tests/array/end_variation2.phpt2
-rw-r--r--ext/standard/tests/array/end_variation3.phpt2
-rw-r--r--ext/standard/tests/array/extract_error.phpt56
-rw-r--r--ext/standard/tests/array/extract_error_variation1.phpt14
-rw-r--r--ext/standard/tests/array/extract_typed_ref.phpt8
-rw-r--r--ext/standard/tests/array/extract_variation7.phpt2
-rw-r--r--ext/standard/tests/array/in_array_variation3.phpt20
-rw-r--r--ext/standard/tests/array/in_array_variation4.phpt4
-rw-r--r--ext/standard/tests/array/key_basic.phpt2
-rw-r--r--ext/standard/tests/array/key_variation2.phpt6
-rw-r--r--ext/standard/tests/array/key_variation3.phpt2
-rw-r--r--ext/standard/tests/array/key_variation4.phpt2
-rw-r--r--ext/standard/tests/array/krsort_basic.phpt16
-rw-r--r--ext/standard/tests/array/krsort_object.phpt10
-rw-r--r--ext/standard/tests/array/krsort_variation10.phpt6
-rw-r--r--ext/standard/tests/array/krsort_variation11.phpt6
-rw-r--r--ext/standard/tests/array/krsort_variation3.phpt10
-rw-r--r--ext/standard/tests/array/krsort_variation4.phpt6
-rw-r--r--ext/standard/tests/array/krsort_variation5.phpt8
-rw-r--r--ext/standard/tests/array/krsort_variation6.phpt6
-rw-r--r--ext/standard/tests/array/krsort_variation7.phpt12
-rw-r--r--ext/standard/tests/array/krsort_variation8.phptbin3320 -> 3320 bytes
-rw-r--r--ext/standard/tests/array/krsort_variation9.phpt18
-rw-r--r--ext/standard/tests/array/ksort_basic.phpt16
-rw-r--r--ext/standard/tests/array/ksort_object.phpt8
-rw-r--r--ext/standard/tests/array/ksort_variation10.phpt6
-rw-r--r--ext/standard/tests/array/ksort_variation11.phpt6
-rw-r--r--ext/standard/tests/array/ksort_variation3.phpt10
-rw-r--r--ext/standard/tests/array/ksort_variation4.phpt6
-rw-r--r--ext/standard/tests/array/ksort_variation5.phpt8
-rw-r--r--ext/standard/tests/array/ksort_variation6.phpt6
-rw-r--r--ext/standard/tests/array/ksort_variation7.phpt12
-rw-r--r--ext/standard/tests/array/ksort_variation8.phptbin3288 -> 3288 bytes
-rw-r--r--ext/standard/tests/array/ksort_variation9.phpt18
-rw-r--r--ext/standard/tests/array/max.phpt40
-rw-r--r--ext/standard/tests/array/max_basiclong_64bit.phpt2
-rw-r--r--ext/standard/tests/array/min.phpt40
-rw-r--r--ext/standard/tests/array/min_basiclong_64bit.phpt2
-rw-r--r--ext/standard/tests/array/natcasesort_object2.phpt26
-rw-r--r--ext/standard/tests/array/natcasesort_variation11.phpt8
-rw-r--r--ext/standard/tests/array/natcasesort_variation2.phpt10
-rw-r--r--ext/standard/tests/array/natcasesort_variation3.phpt6
-rw-r--r--ext/standard/tests/array/natcasesort_variation4.phpt12
-rw-r--r--ext/standard/tests/array/natcasesort_variation6.phpt2
-rw-r--r--ext/standard/tests/array/natcasesort_variation7.phpt26
-rw-r--r--ext/standard/tests/array/negative_index.phpt31
-rw-r--r--ext/standard/tests/array/next_basic.phpt2
-rw-r--r--ext/standard/tests/array/next_variation2.phpt2
-rw-r--r--ext/standard/tests/array/prev_basic.phpt2
-rw-r--r--ext/standard/tests/array/prev_error2.phpt4
-rw-r--r--ext/standard/tests/array/prev_error3.phpt5
-rw-r--r--ext/standard/tests/array/prev_variation2.phpt2
-rw-r--r--ext/standard/tests/array/range_bug70239_0.phpt12
-rw-r--r--ext/standard/tests/array/range_bug70239_1.phpt12
-rw-r--r--ext/standard/tests/array/range_bug70239_2.phpt11
-rw-r--r--ext/standard/tests/array/range_bug70239_3.phpt11
-rw-r--r--ext/standard/tests/array/range_errors.phpt164
-rw-r--r--ext/standard/tests/array/range_variation.phpt19
-rw-r--r--ext/standard/tests/array/reset_basic.phpt2
-rw-r--r--ext/standard/tests/array/reset_variation2.phpt2
-rw-r--r--ext/standard/tests/array/reset_variation3.phpt2
-rw-r--r--ext/standard/tests/array/rsort_basic.phpt14
-rw-r--r--ext/standard/tests/array/rsort_object1.phpt32
-rw-r--r--ext/standard/tests/array/rsort_object2.phpt48
-rw-r--r--ext/standard/tests/array/rsort_variation3.phpt10
-rw-r--r--ext/standard/tests/array/rsort_variation4.phpt4
-rw-r--r--ext/standard/tests/array/rsort_variation5.phpt26
-rw-r--r--ext/standard/tests/array/rsort_variation6.phpt4
-rw-r--r--ext/standard/tests/array/rsort_variation7.phpt4
-rw-r--r--ext/standard/tests/array/rsort_variation9.phpt24
-rw-r--r--ext/standard/tests/array/sizeof_variation4.phpt120
-rw-r--r--ext/standard/tests/array/sort_basic.phpt16
-rw-r--r--ext/standard/tests/array/sort_object1.phpt10
-rw-r--r--ext/standard/tests/array/sort_object2.phpt10
-rw-r--r--ext/standard/tests/array/sort_variation10.phpt6
-rw-r--r--ext/standard/tests/array/sort_variation11.phptbin3141 -> 3141 bytes
-rw-r--r--ext/standard/tests/array/sort_variation3.phpt12
-rw-r--r--ext/standard/tests/array/sort_variation4.phpt6
-rw-r--r--ext/standard/tests/array/sort_variation5.phpt2
-rw-r--r--ext/standard/tests/array/sort_variation6.phpt6
-rw-r--r--ext/standard/tests/array/sort_variation7.phpt6
-rw-r--r--ext/standard/tests/array/sort_variation8.phpt16
-rw-r--r--ext/standard/tests/array/sort_variation9.phpt16
-rw-r--r--ext/standard/tests/array/uasort_variation3.phptbin2568 -> 2569 bytes
-rw-r--r--ext/standard/tests/array/uasort_variation8.phpt16
-rw-r--r--ext/standard/tests/array/usort_basic.phpt2
-rw-r--r--ext/standard/tests/array/usort_object1.phpt60
-rw-r--r--ext/standard/tests/array/usort_object2.phpt2
-rw-r--r--ext/standard/tests/array/usort_variation10.phpt2
-rw-r--r--ext/standard/tests/array/usort_variation11.phpt18
-rw-r--r--ext/standard/tests/array/usort_variation3.phpt2
-rw-r--r--ext/standard/tests/array/usort_variation4.phpt2
-rw-r--r--ext/standard/tests/array/usort_variation5.phpt2
-rw-r--r--ext/standard/tests/array/usort_variation6.phpt2
-rw-r--r--ext/standard/tests/array/usort_variation7.phpt2
-rw-r--r--ext/standard/tests/array/usort_variation8.phpt20
-rw-r--r--ext/standard/tests/array/usort_variation9.phpt2
-rw-r--r--ext/standard/tests/array/var_export3.phpt14
-rw-r--r--ext/standard/tests/assert/assert.phpt27
-rw-r--r--ext/standard/tests/assert/assert02.phpt64
-rw-r--r--ext/standard/tests/assert/assert03.phpt27
-rw-r--r--ext/standard/tests/assert/assert04.phpt16
-rw-r--r--ext/standard/tests/assert/assert_basic.phpt21
-rw-r--r--ext/standard/tests/assert/assert_basic1.phpt13
-rw-r--r--ext/standard/tests/assert/assert_basic2.phpt5
-rw-r--r--ext/standard/tests/assert/assert_basic3.phpt10
-rw-r--r--ext/standard/tests/assert/assert_basic4.phpt5
-rw-r--r--ext/standard/tests/assert/assert_basic5.phpt15
-rw-r--r--ext/standard/tests/assert/assert_basic6.phpt27
-rw-r--r--ext/standard/tests/assert/assert_closures.phpt1
-rw-r--r--ext/standard/tests/assert/assert_error.phpt31
-rw-r--r--ext/standard/tests/assert/assert_error2.phpt17
-rw-r--r--ext/standard/tests/assert/assert_error3.phpt27
-rw-r--r--ext/standard/tests/assert/assert_error4.phpt28
-rw-r--r--ext/standard/tests/assert/assert_options_error.phpt13
-rw-r--r--ext/standard/tests/assert/assert_variation.phpt46
-rw-r--r--ext/standard/tests/assert/bug73303.phpt24
-rw-r--r--ext/standard/tests/bug49244.phpt4
-rw-r--r--ext/standard/tests/bug64370_var1.phpt2
-rw-r--r--ext/standard/tests/bug64370_var2.phpt16
-rw-r--r--ext/standard/tests/bug75220.phpt18
-rw-r--r--ext/standard/tests/class_object/bug71442.phpt26
-rw-r--r--ext/standard/tests/class_object/bug78638.phpt9
-rw-r--r--ext/standard/tests/class_object/class_exists_basic_001.phpt2
-rw-r--r--ext/standard/tests/class_object/forward_static_call_001.phpt48
-rw-r--r--ext/standard/tests/class_object/forward_static_call_002.phpt8
-rw-r--r--ext/standard/tests/class_object/forward_static_call_003.phpt30
-rw-r--r--ext/standard/tests/class_object/get_class_methods_basic_001.phpt6
-rw-r--r--ext/standard/tests/class_object/get_class_methods_basic_002.phpt66
-rw-r--r--ext/standard/tests/class_object/get_class_methods_basic_003.phpt22
-rw-r--r--ext/standard/tests/class_object/get_class_methods_variation_001.phpt20
-rw-r--r--ext/standard/tests/class_object/get_class_methods_variation_002.phpt2
-rw-r--r--ext/standard/tests/class_object/get_class_variation_001.phpt116
-rw-r--r--ext/standard/tests/class_object/get_class_vars_variation2.phpt2
-rw-r--r--ext/standard/tests/class_object/get_declared_classes_basic_001.phpt6
-rw-r--r--ext/standard/tests/class_object/get_declared_interfaces_basic_001.phpt6
-rw-r--r--ext/standard/tests/class_object/get_declared_traits_basic_001.phpt6
-rw-r--r--ext/standard/tests/class_object/get_object_vars_basic_001.phpt44
-rw-r--r--ext/standard/tests/class_object/get_object_vars_basic_002.phpt28
-rw-r--r--ext/standard/tests/class_object/get_object_vars_variation_001.phpt2
-rw-r--r--ext/standard/tests/class_object/get_parent_class_variation_002.phpt22
-rw-r--r--ext/standard/tests/class_object/is_a.phpt60
-rw-r--r--ext/standard/tests/class_object/is_a_variation_001.phpt4
-rw-r--r--ext/standard/tests/class_object/is_subclass_of_variation_001.phpt22
-rw-r--r--ext/standard/tests/class_object/is_subclass_of_variation_004.phpt22
-rw-r--r--ext/standard/tests/class_object/method_exists_basic_001.phpt34
-rw-r--r--ext/standard/tests/class_object/method_exists_basic_003.phpt2
-rw-r--r--ext/standard/tests/class_object/method_exists_variation_001.phpt22
-rw-r--r--ext/standard/tests/class_object/method_exists_variation_003.phpt2
-rw-r--r--ext/standard/tests/class_object/property_exists_error.phpt25
-rw-r--r--ext/standard/tests/class_object/property_exists_variation1.phpt2
-rw-r--r--ext/standard/tests/class_object/trait_exists_basic_001.phpt2
-rw-r--r--ext/standard/tests/dir/bug41693.phpt14
-rw-r--r--ext/standard/tests/dir/bug72625.phpt26
-rw-r--r--ext/standard/tests/dir/bug73877.phpt8
-rw-r--r--ext/standard/tests/dir/chdir_basic-win32-mb.phpt2
-rw-r--r--ext/standard/tests/dir/chdir_basic.phpt2
-rw-r--r--ext/standard/tests/dir/chdir_error2-win32-mb.phpt2
-rw-r--r--ext/standard/tests/dir/chdir_error2.phpt2
-rw-r--r--ext/standard/tests/dir/chdir_variation2-win32-mb.phpt2
-rw-r--r--ext/standard/tests/dir/chdir_variation2.phpt2
-rw-r--r--ext/standard/tests/dir/closedir_basic-win32-mb.phpt4
-rw-r--r--ext/standard/tests/dir/closedir_basic.phpt4
-rw-r--r--ext/standard/tests/dir/closedir_error-win32-mb.phpt51
-rw-r--r--ext/standard/tests/dir/closedir_variation2-win32-mb.phpt12
-rw-r--r--ext/standard/tests/dir/closedir_variation2.phpt12
-rw-r--r--ext/standard/tests/dir/closedir_variation3.phpt15
-rw-r--r--ext/standard/tests/dir/closedir_without_arg.phpt12
-rw-r--r--ext/standard/tests/dir/dir_basic-win32-mb.phpt11
-rw-r--r--ext/standard/tests/dir/dir_basic.phpt11
-rw-r--r--ext/standard/tests/dir/dir_bug73971.phpt4
-rw-r--r--ext/standard/tests/dir/dir_variation3.phpt2
-rw-r--r--ext/standard/tests/dir/dir_variation5.phpt2
-rw-r--r--ext/standard/tests/dir/dir_variation6.phpt4
-rw-r--r--ext/standard/tests/dir/dir_variation7.phpt10
-rw-r--r--ext/standard/tests/dir/dir_variation8.phpt8
-rw-r--r--ext/standard/tests/dir/dir_variation9.phpt8
-rw-r--r--ext/standard/tests/dir/getcwd_basic-win32-mb.phpt2
-rw-r--r--ext/standard/tests/dir/getcwd_basic.phpt2
-rw-r--r--ext/standard/tests/dir/opendir_basic-win32-mb.phpt2
-rw-r--r--ext/standard/tests/dir/opendir_basic.phpt2
-rw-r--r--ext/standard/tests/dir/opendir_error2.phpt6
-rw-r--r--ext/standard/tests/dir/opendir_variation3-win32-mb.phpt6
-rw-r--r--ext/standard/tests/dir/opendir_variation3.phpt6
-rw-r--r--ext/standard/tests/dir/opendir_variation4-win32-mb.phpt10
-rw-r--r--ext/standard/tests/dir/opendir_variation4.phpt10
-rw-r--r--ext/standard/tests/dir/opendir_variation5.phpt16
-rw-r--r--ext/standard/tests/dir/opendir_variation6-win32.phpt10
-rw-r--r--ext/standard/tests/dir/opendir_variation6.phpt10
-rw-r--r--ext/standard/tests/dir/opendir_variation7.phpt36
-rw-r--r--ext/standard/tests/dir/readdir_basic-win32-mb.phpt10
-rw-r--r--ext/standard/tests/dir/readdir_basic.phpt10
-rw-r--r--ext/standard/tests/dir/readdir_variation2-win32-mb.phpt8
-rw-r--r--ext/standard/tests/dir/readdir_variation2.phpt8
-rw-r--r--ext/standard/tests/dir/readdir_variation3-win32-mb.phpt8
-rw-r--r--ext/standard/tests/dir/readdir_variation3.phpt8
-rw-r--r--ext/standard/tests/dir/readdir_variation4-win32-mb.phpt24
-rw-r--r--ext/standard/tests/dir/readdir_variation4.phpt24
-rw-r--r--ext/standard/tests/dir/readdir_variation5.phpt28
-rw-r--r--ext/standard/tests/dir/readdir_variation6-win32-mb.phpt10
-rw-r--r--ext/standard/tests/dir/readdir_variation6.phpt10
-rw-r--r--ext/standard/tests/dir/readdir_variation7.phpt12
-rw-r--r--ext/standard/tests/dir/rewinddir_basic-win32-mb.phpt6
-rw-r--r--ext/standard/tests/dir/rewinddir_basic.phpt6
-rw-r--r--ext/standard/tests/dir/rewinddir_variation2-win32-mb.phpt12
-rw-r--r--ext/standard/tests/dir/rewinddir_variation2.phpt12
-rw-r--r--ext/standard/tests/dir/rewinddir_variation3.phpt17
-rw-r--r--ext/standard/tests/dir/scandir_basic-win32-mb.phpt2
-rw-r--r--ext/standard/tests/dir/scandir_basic.phpt2
-rw-r--r--ext/standard/tests/dir/scandir_error2.phpt6
-rw-r--r--ext/standard/tests/dir/scandir_variation10-win32-mb.phpt2
-rw-r--r--ext/standard/tests/dir/scandir_variation10.phpt2
-rw-r--r--ext/standard/tests/dir/scandir_variation3-win32-mb.phpt244
-rw-r--r--ext/standard/tests/dir/scandir_variation4-win32-mb.phpt2
-rw-r--r--ext/standard/tests/dir/scandir_variation4.phpt2
-rw-r--r--ext/standard/tests/dir/scandir_variation5.phpt12
-rw-r--r--ext/standard/tests/dir/scandir_variation6.phpt10
-rw-r--r--ext/standard/tests/dir/scandir_variation7.phpt24
-rw-r--r--ext/standard/tests/dir/scandir_variation8-win32-mb.phpt16
-rw-r--r--ext/standard/tests/dir/scandir_variation8.phpt16
-rw-r--r--ext/standard/tests/dir/scandir_variation9-win32-mb.phpt4
-rw-r--r--ext/standard/tests/dir/scandir_variation9.phpt4
-rw-r--r--ext/standard/tests/directory/DirectoryClass_basic_001.phpt11
-rw-r--r--ext/standard/tests/directory/DirectoryClass_error_001-mb.phpt78
-rw-r--r--ext/standard/tests/directory/DirectoryClass_error_001.phpt78
-rw-r--r--ext/standard/tests/directory/bug74589_utf8.phpt8
-rw-r--r--ext/standard/tests/file/001.phpt4
-rw-r--r--ext/standard/tests/file/003.phpt22
-rw-r--r--ext/standard/tests/file/004.phpt88
-rw-r--r--ext/standard/tests/file/005_error.phpt75
-rw-r--r--ext/standard/tests/file/005_variation-win32.phpt51
-rw-r--r--ext/standard/tests/file/006_error.phpt34
-rw-r--r--ext/standard/tests/file/006_variation2.phpt66
-rw-r--r--ext/standard/tests/file/007_basic.phpt220
-rw-r--r--ext/standard/tests/file/007_error.phpt185
-rw-r--r--ext/standard/tests/file/007_variation1.phpt2
-rw-r--r--ext/standard/tests/file/007_variation11-win32-mb.phpt2
-rw-r--r--ext/standard/tests/file/007_variation11-win32.phpt2
-rw-r--r--ext/standard/tests/file/007_variation11.phpt2
-rw-r--r--ext/standard/tests/file/007_variation13-win32.phpt2
-rw-r--r--ext/standard/tests/file/007_variation13.phpt2
-rw-r--r--ext/standard/tests/file/007_variation15.phpt4
-rw-r--r--ext/standard/tests/file/007_variation16.phpt2
-rw-r--r--ext/standard/tests/file/007_variation17.phpt2
-rw-r--r--ext/standard/tests/file/007_variation19.phpt2
-rw-r--r--ext/standard/tests/file/007_variation21.phpt2
-rw-r--r--ext/standard/tests/file/007_variation23.phpt4
-rw-r--r--ext/standard/tests/file/007_variation24.phpt2
-rw-r--r--ext/standard/tests/file/007_variation3.phpt2
-rw-r--r--ext/standard/tests/file/007_variation5.phpt2
-rw-r--r--ext/standard/tests/file/007_variation7.phpt4
-rw-r--r--ext/standard/tests/file/007_variation8.phpt2
-rw-r--r--ext/standard/tests/file/007_variation9.phpt2
-rw-r--r--ext/standard/tests/file/basename-win32.phpt46
-rw-r--r--ext/standard/tests/file/basename.phptbin8212 -> 6843 bytes
-rw-r--r--ext/standard/tests/file/basename_basic-win32.phpt2
-rw-r--r--ext/standard/tests/file/basename_basic.phpt2
-rw-r--r--ext/standard/tests/file/basename_bug66395-win32.phpt2
-rw-r--r--ext/standard/tests/file/basename_bug66395_variation2-win32.phpt2
-rw-r--r--ext/standard/tests/file/basename_variation1-win32.phpt24
-rw-r--r--ext/standard/tests/file/basename_variation1.phpt24
-rw-r--r--ext/standard/tests/file/basename_variation2-win32.phpt16
-rw-r--r--ext/standard/tests/file/basename_variation2.phpt16
-rw-r--r--ext/standard/tests/file/bug12556.phpt4
-rw-r--r--ext/standard/tests/file/bug22382.phpt2
-rw-r--r--ext/standard/tests/file/bug22414.phpt42
-rw-r--r--ext/standard/tests/file/bug24313.phpt2
-rw-r--r--ext/standard/tests/file/bug24482.phpt22
-rw-r--r--ext/standard/tests/file/bug26615.phpt4
-rw-r--r--ext/standard/tests/file/bug26938.phpt24
-rw-r--r--ext/standard/tests/file/bug27619.phpt16
-rw-r--r--ext/standard/tests/file/bug35740.phpt2
-rw-r--r--ext/standard/tests/file/bug35781.phpt2
-rw-r--r--ext/standard/tests/file/bug37158.phpt2
-rw-r--r--ext/standard/tests/file/bug37864.phpt8
-rw-r--r--ext/standard/tests/file/bug38450.phpt154
-rw-r--r--ext/standard/tests/file/bug38450_1.phpt154
-rw-r--r--ext/standard/tests/file/bug38450_2.phpt154
-rw-r--r--ext/standard/tests/file/bug38450_3.phpt154
-rw-r--r--ext/standard/tests/file/bug39538.phpt4
-rw-r--r--ext/standard/tests/file/bug39551.phpt10
-rw-r--r--ext/standard/tests/file/bug39673.phpt20
-rw-r--r--ext/standard/tests/file/bug39863.phpt17
-rw-r--r--ext/standard/tests/file/bug41655_2.phpt6
-rw-r--r--ext/standard/tests/file/bug41693.phpt13
-rw-r--r--ext/standard/tests/file/bug41815.phpt2
-rw-r--r--ext/standard/tests/file/bug43008.phpt12
-rw-r--r--ext/standard/tests/file/bug43137.phpt18
-rw-r--r--ext/standard/tests/file/bug43353.phpt2
-rw-r--r--ext/standard/tests/file/bug43522.phpt8
-rw-r--r--ext/standard/tests/file/bug44034.phpt4
-rw-r--r--ext/standard/tests/file/bug44805.phpt4
-rw-r--r--ext/standard/tests/file/bug45303.phpt2
-rw-r--r--ext/standard/tests/file/bug47517.phpt4
-rw-r--r--ext/standard/tests/file/bug52820.phpt2
-rw-r--r--ext/standard/tests/file/bug55124.phpt4
-rw-r--r--ext/standard/tests/file/bug60120.phpt2
-rw-r--r--ext/standard/tests/file/bug61961.phpt2
-rw-r--r--ext/standard/tests/file/bug63512.phpt14
-rw-r--r--ext/standard/tests/file/bug65701.phpt2
-rw-r--r--ext/standard/tests/file/bug68335.phpt2
-rw-r--r--ext/standard/tests/file/bug69442.phpt2
-rw-r--r--ext/standard/tests/file/bug71287.phpt12
-rw-r--r--ext/standard/tests/file/bug71882.phpt13
-rw-r--r--ext/standard/tests/file/bug72035.phpt7
-rw-r--r--ext/standard/tests/file/bug74719.phpt2
-rw-r--r--ext/standard/tests/file/bug75679.phpt2
-rw-r--r--ext/standard/tests/file/bug77552.phpt4
-rw-r--r--ext/standard/tests/file/bug79099.phpt26
-rw-r--r--ext/standard/tests/file/chgrp.phpt10
-rw-r--r--ext/standard/tests/file/chmod_basic-win32-mb.phpt8
-rw-r--r--ext/standard/tests/file/chmod_basic-win32.phpt8
-rw-r--r--ext/standard/tests/file/chmod_basic.phpt12
-rw-r--r--ext/standard/tests/file/chmod_error.phpt25
-rw-r--r--ext/standard/tests/file/chmod_variation1.phpt12
-rw-r--r--ext/standard/tests/file/chown.phpt2
-rw-r--r--ext/standard/tests/file/copy_error.phpt18
-rw-r--r--ext/standard/tests/file/copy_variation14.phpt2
-rw-r--r--ext/standard/tests/file/copy_variation16-win32.phpt2
-rw-r--r--ext/standard/tests/file/copy_variation4.phptbin4939 -> 4250 bytes
-rw-r--r--ext/standard/tests/file/copy_variation6-win32.phpt2
-rw-r--r--ext/standard/tests/file/directory_wrapper_fstat_basic.phpt2
-rw-r--r--ext/standard/tests/file/dirname_basic-win32.phpt66
-rw-r--r--ext/standard/tests/file/dirname_basic.phpt66
-rw-r--r--ext/standard/tests/file/dirname_no_path_normalization-win32.phpt12
-rw-r--r--ext/standard/tests/file/disk.phpt9
-rw-r--r--ext/standard/tests/file/disk_free_space_error-win32.phpt18
-rw-r--r--ext/standard/tests/file/disk_free_space_error.phpt18
-rw-r--r--ext/standard/tests/file/disk_free_space_variation.phpt44
-rw-r--r--ext/standard/tests/file/disk_total_space_error-win32.phpt10
-rw-r--r--ext/standard/tests/file/disk_total_space_error.phpt10
-rw-r--r--ext/standard/tests/file/disk_total_space_variation.phpt24
-rw-r--r--ext/standard/tests/file/fclose_variation1.phpt10
-rw-r--r--ext/standard/tests/file/feof_basic.phpt11
-rw-r--r--ext/standard/tests/file/fflush_basic.phpt2
-rw-r--r--ext/standard/tests/file/fgetc_basic.phpt4
-rw-r--r--ext/standard/tests/file/fgetc_variation2.phpt27
-rw-r--r--ext/standard/tests/file/fgetc_variation3.phpt18
-rw-r--r--ext/standard/tests/file/fgetcsv.phpt62
-rw-r--r--ext/standard/tests/file/fgetcsv_error_conditions.csv2
-rw-r--r--ext/standard/tests/file/fgetcsv_error_conditions.phpt61
-rw-r--r--ext/standard/tests/file/fgetcsv_variation25.phpt935
-rw-r--r--ext/standard/tests/file/fgetcsv_variation26.phpt585
-rw-r--r--ext/standard/tests/file/fgetcsv_variation27.phpt935
-rw-r--r--ext/standard/tests/file/fgetcsv_variation28.phpt935
-rw-r--r--ext/standard/tests/file/fgetcsv_variation3.phpt933
-rw-r--r--ext/standard/tests/file/fgetcsv_variation32.phpt2
-rw-r--r--ext/standard/tests/file/fgetcsv_variation4.phpt932
-rw-r--r--ext/standard/tests/file/fgetcsv_variation5.phpt934
-rw-r--r--ext/standard/tests/file/fgets_basic.phpt6
-rw-r--r--ext/standard/tests/file/fgets_error.phpt97
-rw-r--r--ext/standard/tests/file/fgets_socket_variation1.phpt4
-rw-r--r--ext/standard/tests/file/fgets_socket_variation2.phpt14
-rw-r--r--ext/standard/tests/file/fgets_variation1.phpt18
-rw-r--r--ext/standard/tests/file/fgets_variation2.phpt43
-rw-r--r--ext/standard/tests/file/fgets_variation3.phpt6
-rw-r--r--ext/standard/tests/file/fgets_variation4-win32-mb.phpt6
-rw-r--r--ext/standard/tests/file/fgets_variation4-win32.phpt6
-rw-r--r--ext/standard/tests/file/fgets_variation4.phpt6
-rw-r--r--ext/standard/tests/file/fgets_variation5.phpt6
-rw-r--r--ext/standard/tests/file/fgets_variation6-win32.phpt2
-rw-r--r--ext/standard/tests/file/fgets_variation6.phpt2
-rw-r--r--ext/standard/tests/file/fgetss.phpt144
-rw-r--r--ext/standard/tests/file/fgetss1.phpt73
-rw-r--r--ext/standard/tests/file/fgetss_basic1.phpt137
-rw-r--r--ext/standard/tests/file/fgetss_basic2-win32-mb.phpt218
-rw-r--r--ext/standard/tests/file/fgetss_basic2-win32.phpt218
-rw-r--r--ext/standard/tests/file/fgetss_basic2.phpt216
-rw-r--r--ext/standard/tests/file/fgetss_error.phpt108
-rw-r--r--ext/standard/tests/file/fgetss_variation1-win32.phpt192
-rw-r--r--ext/standard/tests/file/fgetss_variation1.phpt188
-rw-r--r--ext/standard/tests/file/fgetss_variation2.phpt436
-rw-r--r--ext/standard/tests/file/fgetss_variation3-win32.phpt573
-rw-r--r--ext/standard/tests/file/fgetss_variation3.phpt569
-rw-r--r--ext/standard/tests/file/fgetss_variation4.phpt170
-rw-r--r--ext/standard/tests/file/fgetss_variation5-win32.phpt222
-rw-r--r--ext/standard/tests/file/fgetss_variation5.phpt219
-rw-r--r--ext/standard/tests/file/file.inc6
-rw-r--r--ext/standard/tests/file/file_error.phpt16
-rw-r--r--ext/standard/tests/file/file_get_contents_basic001.phpt14
-rw-r--r--ext/standard/tests/file/file_get_contents_error.phpt27
-rw-r--r--ext/standard/tests/file/file_get_contents_error001.phpt2
-rw-r--r--ext/standard/tests/file/file_get_contents_error002.phpt8
-rw-r--r--ext/standard/tests/file/file_get_contents_file_put_contents_error.phpt35
-rw-r--r--ext/standard/tests/file/file_get_contents_variation1.phpt2
-rw-r--r--ext/standard/tests/file/file_get_contents_variation2.phpt2
-rw-r--r--ext/standard/tests/file/file_get_contents_variation7-win32-mb.phpt6
-rw-r--r--ext/standard/tests/file/file_get_contents_variation7-win32.phpt6
-rw-r--r--ext/standard/tests/file/file_get_contents_variation7.phpt6
-rw-r--r--ext/standard/tests/file/file_get_contents_variation8-win32.phpt26
-rw-r--r--ext/standard/tests/file/file_get_contents_variation8.phpt24
-rw-r--r--ext/standard/tests/file/file_put_contents.phpt21
-rw-r--r--ext/standard/tests/file/file_put_contents_variation1.phpt2
-rw-r--r--ext/standard/tests/file/file_put_contents_variation2.phpt24
-rw-r--r--ext/standard/tests/file/file_put_contents_variation4.phpt4
-rw-r--r--ext/standard/tests/file/file_put_contents_variation5.phpt2
-rw-r--r--ext/standard/tests/file/file_put_contents_variation6.phpt2
-rw-r--r--ext/standard/tests/file/file_put_contents_variation7-win32.phpt6
-rw-r--r--ext/standard/tests/file/file_put_contents_variation7.phpt6
-rw-r--r--ext/standard/tests/file/file_put_contents_variation8-win32.phpt36
-rw-r--r--ext/standard/tests/file/file_put_contents_variation8.phptbin2504 -> 2427 bytes
-rw-r--r--ext/standard/tests/file/file_variation6.phpt44
-rw-r--r--ext/standard/tests/file/file_variation8-win32.phpt6
-rw-r--r--ext/standard/tests/file/file_variation8.phpt6
-rw-r--r--ext/standard/tests/file/file_variation9.phpt2
-rw-r--r--ext/standard/tests/file/filegroup_error.phpt10
-rw-r--r--ext/standard/tests/file/filegroup_variation2.phpt6
-rw-r--r--ext/standard/tests/file/filegroup_variation3.phpt14
-rw-r--r--ext/standard/tests/file/fileinode_error.phpt12
-rw-r--r--ext/standard/tests/file/fileinode_variation2.phpt6
-rw-r--r--ext/standard/tests/file/fileinode_variation3.phpt14
-rw-r--r--ext/standard/tests/file/fileowner_error.phpt10
-rw-r--r--ext/standard/tests/file/fileowner_variation2.phpt6
-rw-r--r--ext/standard/tests/file/fileowner_variation3.phpt14
-rw-r--r--ext/standard/tests/file/fileperms_variation2.phpt6
-rw-r--r--ext/standard/tests/file/fileperms_variation3.phpt14
-rw-r--r--ext/standard/tests/file/filesize_error.phpt14
-rw-r--r--ext/standard/tests/file/filesize_variation3-win32.phpt72
-rw-r--r--ext/standard/tests/file/filesize_variation3.phpt27
-rw-r--r--ext/standard/tests/file/filesize_variation4-win32.phpt2
-rw-r--r--ext/standard/tests/file/filesize_variation4.phpt2
-rw-r--r--ext/standard/tests/file/filetype_error.phpt10
-rw-r--r--ext/standard/tests/file/filetype_variation2.phpt2
-rw-r--r--ext/standard/tests/file/filetype_variation3.phpt2
-rw-r--r--ext/standard/tests/file/flock.phpt33
-rw-r--r--ext/standard/tests/file/flock_error.phpt81
-rw-r--r--ext/standard/tests/file/flock_variation.phpt10
-rw-r--r--ext/standard/tests/file/fnmatch_variation.phpt146
-rw-r--r--ext/standard/tests/file/fopen_include_path.inc112
-rw-r--r--ext/standard/tests/file/fopen_unlink.phpt24
-rw-r--r--ext/standard/tests/file/fopen_variation10-win32.phpt12
-rw-r--r--ext/standard/tests/file/fopen_variation11-win32.phpt12
-rw-r--r--ext/standard/tests/file/fopen_variation12.phpt48
-rw-r--r--ext/standard/tests/file/fopen_variation13.phpt36
-rw-r--r--ext/standard/tests/file/fopen_variation14-win32.phpt80
-rw-r--r--ext/standard/tests/file/fopen_variation14.phpt56
-rw-r--r--ext/standard/tests/file/fopen_variation15-win32.phpt80
-rw-r--r--ext/standard/tests/file/fopen_variation15.phpt56
-rw-r--r--ext/standard/tests/file/fopen_variation16.phpt44
-rw-r--r--ext/standard/tests/file/fopen_variation17.phpt44
-rw-r--r--ext/standard/tests/file/fopen_variation19.phpt2
-rw-r--r--ext/standard/tests/file/fopen_variation5.phpt2
-rw-r--r--ext/standard/tests/file/fopen_variation6.phpt2
-rw-r--r--ext/standard/tests/file/fopen_variation7.phpt52
-rw-r--r--ext/standard/tests/file/fopen_variation8.phpt2
-rw-r--r--ext/standard/tests/file/fopen_variation9.phpt52
-rw-r--r--ext/standard/tests/file/fopencookie.phpt114
-rw-r--r--ext/standard/tests/file/fpassthru_basic.phpt32
-rw-r--r--ext/standard/tests/file/fputcsv.phpt9
-rw-r--r--ext/standard/tests/file/fputcsv_002.phpt2
-rw-r--r--ext/standard/tests/file/fputcsv_variation14.phpt54
-rw-r--r--ext/standard/tests/file/fputcsv_variation15.phpt9
-rw-r--r--ext/standard/tests/file/fputcsv_variation16.phpt2
-rw-r--r--ext/standard/tests/file/fputcsv_variation2.phpt440
-rw-r--r--ext/standard/tests/file/fputcsv_variation3.phpt440
-rw-r--r--ext/standard/tests/file/fputcsv_variation4.phpt440
-rw-r--r--ext/standard/tests/file/fread_basic.phpt2
-rw-r--r--ext/standard/tests/file/fread_error.phpt103
-rw-r--r--ext/standard/tests/file/fread_variation1.phpt148
-rw-r--r--ext/standard/tests/file/fread_variation2.phpt292
-rw-r--r--ext/standard/tests/file/fread_variation3-win32-mb.phpt112
-rw-r--r--ext/standard/tests/file/fread_variation3-win32.phpt112
-rw-r--r--ext/standard/tests/file/fread_variation3.phpt112
-rw-r--r--ext/standard/tests/file/fread_variation4.phpt220
-rw-r--r--ext/standard/tests/file/fscanf.phpt52
-rw-r--r--ext/standard/tests/file/fscanf_error.phpt66
-rw-r--r--ext/standard/tests/file/fscanf_variation10.phpt16
-rw-r--r--ext/standard/tests/file/fscanf_variation11.phpt58
-rw-r--r--ext/standard/tests/file/fscanf_variation12.phpt80
-rw-r--r--ext/standard/tests/file/fscanf_variation13.phpt24
-rw-r--r--ext/standard/tests/file/fscanf_variation14.phpt112
-rw-r--r--ext/standard/tests/file/fscanf_variation15.phpt68
-rw-r--r--ext/standard/tests/file/fscanf_variation16.phpt18
-rw-r--r--ext/standard/tests/file/fscanf_variation17.phpt58
-rw-r--r--ext/standard/tests/file/fscanf_variation18.phpt80
-rw-r--r--ext/standard/tests/file/fscanf_variation19.phpt28
-rw-r--r--ext/standard/tests/file/fscanf_variation2.phpt82
-rw-r--r--ext/standard/tests/file/fscanf_variation20.phpt88
-rw-r--r--ext/standard/tests/file/fscanf_variation21.phpt74
-rw-r--r--ext/standard/tests/file/fscanf_variation22.phpt26
-rw-r--r--ext/standard/tests/file/fscanf_variation23.phpt66
-rw-r--r--ext/standard/tests/file/fscanf_variation24.phpt88
-rw-r--r--ext/standard/tests/file/fscanf_variation25.phpt32
-rw-r--r--ext/standard/tests/file/fscanf_variation26.phpt36
-rw-r--r--ext/standard/tests/file/fscanf_variation27.phpt80
-rw-r--r--ext/standard/tests/file/fscanf_variation28.phpt68
-rw-r--r--ext/standard/tests/file/fscanf_variation29.phpt28
-rw-r--r--ext/standard/tests/file/fscanf_variation3.phpt68
-rw-r--r--ext/standard/tests/file/fscanf_variation30.phpt68
-rw-r--r--ext/standard/tests/file/fscanf_variation31.phpt80
-rw-r--r--ext/standard/tests/file/fscanf_variation32.phpt34
-rw-r--r--ext/standard/tests/file/fscanf_variation33.phpt90
-rw-r--r--ext/standard/tests/file/fscanf_variation34.phpt76
-rw-r--r--ext/standard/tests/file/fscanf_variation35.phpt18
-rw-r--r--ext/standard/tests/file/fscanf_variation36.phpt58
-rw-r--r--ext/standard/tests/file/fscanf_variation37.phpt80
-rw-r--r--ext/standard/tests/file/fscanf_variation38.phpt24
-rw-r--r--ext/standard/tests/file/fscanf_variation39.phpt80
-rw-r--r--ext/standard/tests/file/fscanf_variation4.phpt18
-rw-r--r--ext/standard/tests/file/fscanf_variation40.phpt68
-rw-r--r--ext/standard/tests/file/fscanf_variation41.phpt18
-rw-r--r--ext/standard/tests/file/fscanf_variation42.phpt58
-rw-r--r--ext/standard/tests/file/fscanf_variation43.phpt80
-rw-r--r--ext/standard/tests/file/fscanf_variation44.phpt24
-rw-r--r--ext/standard/tests/file/fscanf_variation45.phpt80
-rw-r--r--ext/standard/tests/file/fscanf_variation46.phpt68
-rw-r--r--ext/standard/tests/file/fscanf_variation47.phpt18
-rw-r--r--ext/standard/tests/file/fscanf_variation48.phpt58
-rw-r--r--ext/standard/tests/file/fscanf_variation49.phpt80
-rw-r--r--ext/standard/tests/file/fscanf_variation5.phpt58
-rw-r--r--ext/standard/tests/file/fscanf_variation50.phpt24
-rw-r--r--ext/standard/tests/file/fscanf_variation51.phpt126
-rw-r--r--ext/standard/tests/file/fscanf_variation6.phpt80
-rw-r--r--ext/standard/tests/file/fscanf_variation7.phpt24
-rw-r--r--ext/standard/tests/file/fscanf_variation8.phpt128
-rw-r--r--ext/standard/tests/file/fscanf_variation9.phpt80
-rw-r--r--ext/standard/tests/file/fseek_ftell_rewind_error1.phpt83
-rw-r--r--ext/standard/tests/file/fseek_ftell_rewind_error2.phpt79
-rw-r--r--ext/standard/tests/file/fseek_ftell_rewind_error3.phpt79
-rw-r--r--ext/standard/tests/file/fstat.phpt10
-rw-r--r--ext/standard/tests/file/fstat_basic.phpt2
-rw-r--r--ext/standard/tests/file/fstat_variation8.phpt10
-rw-r--r--ext/standard/tests/file/ftruncate.phptbin1137 -> 1143 bytes
-rw-r--r--ext/standard/tests/file/ftruncate_bug76422.phpt8
-rw-r--r--ext/standard/tests/file/ftruncate_error.phpt93
-rw-r--r--ext/standard/tests/file/ftruncate_variation4-win32.phpt558
-rw-r--r--ext/standard/tests/file/ftruncate_variation4.phpt476
-rw-r--r--ext/standard/tests/file/fwrite.phpt24
-rw-r--r--ext/standard/tests/file/fwrite_error.phpt82
-rw-r--r--ext/standard/tests/file/fwrite_variation1-win32-mb.phpt48
-rw-r--r--ext/standard/tests/file/fwrite_variation1.phpt48
-rw-r--r--ext/standard/tests/file/get_current_user.phpt3
-rw-r--r--ext/standard/tests/file/glob_variation-win32-mb.phpt45
-rw-r--r--ext/standard/tests/file/glob_variation-win32.phpt45
-rw-r--r--ext/standard/tests/file/glob_variation.phpt45
-rw-r--r--ext/standard/tests/file/glob_variation3.phpt2
-rw-r--r--ext/standard/tests/file/glob_variation4.phpt2
-rw-r--r--ext/standard/tests/file/glob_variation5.phpt2
-rw-r--r--ext/standard/tests/file/glob_variation6.phpt2
-rw-r--r--ext/standard/tests/file/include_streams.phpt180
-rw-r--r--ext/standard/tests/file/include_userstream_001.phpt108
-rw-r--r--ext/standard/tests/file/include_userstream_002.phpt146
-rw-r--r--ext/standard/tests/file/include_userstream_003.phpt166
-rw-r--r--ext/standard/tests/file/is_dir_variation3.phpt7
-rw-r--r--ext/standard/tests/file/is_dir_variation4.phpt14
-rw-r--r--ext/standard/tests/file/is_executable_error.phpt13
-rw-r--r--ext/standard/tests/file/is_executable_variation1.phpt14
-rw-r--r--ext/standard/tests/file/is_executable_variation2.phpt4
-rw-r--r--ext/standard/tests/file/is_executable_variation3.phpt4
-rw-r--r--ext/standard/tests/file/is_file_variation1.phpt2
-rw-r--r--ext/standard/tests/file/is_file_variation3.phpt8
-rw-r--r--ext/standard/tests/file/is_file_variation4.phpt14
-rw-r--r--ext/standard/tests/file/is_readable_error.phpt12
-rw-r--r--ext/standard/tests/file/is_readable_variation1.phpt18
-rw-r--r--ext/standard/tests/file/is_readable_variation2.phpt4
-rw-r--r--ext/standard/tests/file/is_readable_variation3.phpt8
-rw-r--r--ext/standard/tests/file/is_uploaded_file_basic.phpt10
-rw-r--r--ext/standard/tests/file/is_writable_error.phpt24
-rw-r--r--ext/standard/tests/file/is_writable_variation1.phpt36
-rw-r--r--ext/standard/tests/file/is_writable_variation2.phpt4
-rw-r--r--ext/standard/tests/file/is_writable_variation3.phpt7
-rw-r--r--ext/standard/tests/file/lchgrp_basic.phpt2
-rw-r--r--ext/standard/tests/file/lchown_basic.phpt2
-rw-r--r--ext/standard/tests/file/lchown_error.phpt25
-rw-r--r--ext/standard/tests/file/lstat_stat_error.phpt29
-rw-r--r--ext/standard/tests/file/lstat_stat_variation10.phpt2
-rw-r--r--ext/standard/tests/file/lstat_stat_variation11.phpt2
-rw-r--r--ext/standard/tests/file/lstat_stat_variation12.phpt2
-rw-r--r--ext/standard/tests/file/lstat_stat_variation13.phpt2
-rw-r--r--ext/standard/tests/file/lstat_stat_variation16.phpt2
-rw-r--r--ext/standard/tests/file/lstat_stat_variation17.phpt2
-rw-r--r--ext/standard/tests/file/lstat_stat_variation21.phpt2
-rw-r--r--ext/standard/tests/file/lstat_stat_variation3.phpt2
-rw-r--r--ext/standard/tests/file/lstat_stat_variation4.phpt2
-rw-r--r--ext/standard/tests/file/lstat_stat_variation5.phpt2
-rw-r--r--ext/standard/tests/file/lstat_stat_variation8.phpt2
-rw-r--r--ext/standard/tests/file/mkdir_rmdir_error.phpt36
-rw-r--r--ext/standard/tests/file/mkdir_rmdir_variation-win32-mb.phpt4
-rw-r--r--ext/standard/tests/file/mkdir_rmdir_variation-win32.phpt4
-rw-r--r--ext/standard/tests/file/mkdir_rmdir_variation2.phpt24
-rw-r--r--ext/standard/tests/file/mkdir_variation5-win32.phpt2
-rw-r--r--ext/standard/tests/file/mkdir_variation5.phpt2
-rw-r--r--ext/standard/tests/file/move_uploaded_file_basic.phpt12
-rw-r--r--ext/standard/tests/file/parse_ini_file.phpt6
-rw-r--r--ext/standard/tests/file/parse_ini_file_error.phpt13
-rw-r--r--ext/standard/tests/file/parse_ini_file_variation1.phpt2
-rw-r--r--ext/standard/tests/file/parse_ini_file_variation2.phpt2
-rw-r--r--ext/standard/tests/file/parse_ini_file_variation3.phpt7
-rw-r--r--ext/standard/tests/file/parse_ini_file_variation6-win32-mb.phpt6
-rw-r--r--ext/standard/tests/file/parse_ini_file_variation6-win32.phpt6
-rw-r--r--ext/standard/tests/file/parse_ini_file_variation6.phpt6
-rw-r--r--ext/standard/tests/file/pathinfo_basic1-win32.phpt78
-rw-r--r--ext/standard/tests/file/pathinfo_basic1.phpt78
-rw-r--r--ext/standard/tests/file/pathinfo_basic2-win32.phpt30
-rw-r--r--ext/standard/tests/file/pathinfo_basic2.phpt30
-rw-r--r--ext/standard/tests/file/pathinfo_variation3.phpt2
-rw-r--r--ext/standard/tests/file/pathinfo_variaton.phpt57
-rw-r--r--ext/standard/tests/file/php_fd_wrapper_03.phpt8
-rw-r--r--ext/standard/tests/file/php_fd_wrapper_04.phpt2
-rw-r--r--ext/standard/tests/file/popen_pclose_basic-win32-mb.phpt2
-rw-r--r--ext/standard/tests/file/popen_pclose_basic-win32.phpt2
-rw-r--r--ext/standard/tests/file/popen_pclose_error.phpt20
-rw-r--r--ext/standard/tests/file/proc_open01.phpt48
-rw-r--r--ext/standard/tests/file/readfile_error.phpt20
-rw-r--r--ext/standard/tests/file/readfile_variation10-win32.phpt24
-rw-r--r--ext/standard/tests/file/readfile_variation10.phptbin1853 -> 1727 bytes
-rw-r--r--ext/standard/tests/file/readfile_variation6.phpt2
-rw-r--r--ext/standard/tests/file/readfile_variation7.phpt2
-rw-r--r--ext/standard/tests/file/readfile_variation8-win32-mb.phpt6
-rw-r--r--ext/standard/tests/file/readfile_variation8-win32.phpt6
-rw-r--r--ext/standard/tests/file/readfile_variation9.phpt6
-rw-r--r--ext/standard/tests/file/readlink_realpath_error.phpt23
-rw-r--r--ext/standard/tests/file/readlink_variation1.phpt6
-rw-r--r--ext/standard/tests/file/realpath_error-win32.phpt29
-rw-r--r--ext/standard/tests/file/realpath_variation2.phpt2
-rw-r--r--ext/standard/tests/file/rename_basic.phpt2
-rw-r--r--ext/standard/tests/file/rename_variation13-win32.phptbin5225 -> 4379 bytes
-rw-r--r--ext/standard/tests/file/rename_variation13.phpt20
-rw-r--r--ext/standard/tests/file/rename_variation3-win32.phpt2
-rw-r--r--ext/standard/tests/file/rename_variation7-win32.phpt2
-rw-r--r--ext/standard/tests/file/rmdir_variation3-win32.phpt2
-rw-r--r--ext/standard/tests/file/rmdir_variation3.phpt2
-rw-r--r--ext/standard/tests/file/stat_basic-win32-mb.phpt4
-rw-r--r--ext/standard/tests/file/stat_basic-win32.phpt2
-rw-r--r--ext/standard/tests/file/stat_error-win32.phpt16
-rw-r--r--ext/standard/tests/file/stat_variation1-win32-mb.phpt2
-rw-r--r--ext/standard/tests/file/stat_variation1-win32.phpt2
-rw-r--r--ext/standard/tests/file/stat_variation2-win32.phpt2
-rw-r--r--ext/standard/tests/file/stat_variation3-win32.phpt2
-rw-r--r--ext/standard/tests/file/stat_variation4-win32.phpt2
-rw-r--r--ext/standard/tests/file/stat_variation5-win32.phpt2
-rw-r--r--ext/standard/tests/file/stat_variation6-win32.phpt13
-rw-r--r--ext/standard/tests/file/stat_variation8-win32.phpt2
-rw-r--r--ext/standard/tests/file/stream_001.phpt2
-rw-r--r--ext/standard/tests/file/stream_002.phpt17
-rw-r--r--ext/standard/tests/file/stream_get_line.phpt2
-rw-r--r--ext/standard/tests/file/stream_rfc2397_001.phpt2
-rw-r--r--ext/standard/tests/file/stream_rfc2397_002.phpt69
-rw-r--r--ext/standard/tests/file/stream_rfc2397_003.phpt23
-rw-r--r--ext/standard/tests/file/stream_rfc2397_004.phpt19
-rw-r--r--ext/standard/tests/file/stream_rfc2397_005.phpt25
-rw-r--r--ext/standard/tests/file/stream_rfc2397_006.phpt30
-rw-r--r--ext/standard/tests/file/stream_rfc2397_007.phpt131
-rw-r--r--ext/standard/tests/file/stream_supports_lock.phpt10
-rw-r--r--ext/standard/tests/file/symlink_link_linkinfo_is_link_error1.phpt22
-rw-r--r--ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt22
-rw-r--r--ext/standard/tests/file/symlink_link_linkinfo_is_link_variation9.phpt6
-rw-r--r--ext/standard/tests/file/tempnam_variation3-win32.phpt110
-rw-r--r--ext/standard/tests/file/tempnam_variation3.phpt19
-rw-r--r--ext/standard/tests/file/tempnam_variation7-win32.phpt93
-rw-r--r--ext/standard/tests/file/tempnam_variation7.phpt19
-rw-r--r--ext/standard/tests/file/touch.phpt3
-rw-r--r--ext/standard/tests/file/touch_error.phpt8
-rw-r--r--ext/standard/tests/file/touch_variation5-win32.phpt106
-rw-r--r--ext/standard/tests/file/touch_variation5.phpt106
-rw-r--r--ext/standard/tests/file/touch_variation6-win32.phpt106
-rw-r--r--ext/standard/tests/file/unlink_basic.phpt4
-rw-r--r--ext/standard/tests/file/unlink_error-win32-mb.phpt30
-rw-r--r--ext/standard/tests/file/unlink_error-win32.phpt30
-rw-r--r--ext/standard/tests/file/unlink_error.phpt31
-rw-r--r--ext/standard/tests/file/unlink_variation10.phpt12
-rw-r--r--ext/standard/tests/file/unlink_variation6.phpt2
-rw-r--r--ext/standard/tests/file/unlink_variation8-win32.phpt4
-rw-r--r--ext/standard/tests/file/unlink_variation8.phpt14
-rw-r--r--ext/standard/tests/file/unlink_variation9-win32.phpt8
-rw-r--r--ext/standard/tests/file/userdirstream.phpt38
-rw-r--r--ext/standard/tests/file/userstreams.phpt338
-rw-r--r--ext/standard/tests/file/userstreams_002.phpt70
-rw-r--r--ext/standard/tests/file/userstreams_003.phpt52
-rw-r--r--ext/standard/tests/file/userstreams_004.phpt32
-rw-r--r--ext/standard/tests/file/userstreams_005.phpt44
-rw-r--r--ext/standard/tests/file/userstreams_006.phpt31
-rw-r--r--ext/standard/tests/file/userstreams_007.phpt24
-rw-r--r--ext/standard/tests/file/userwrapper.phpt6
-rw-r--r--ext/standard/tests/file/windows_acls/bug44859.phpt48
-rw-r--r--ext/standard/tests/file/windows_acls/bug44859_2.phpt48
-rw-r--r--ext/standard/tests/file/windows_acls/bug44859_3.phpt22
-rw-r--r--ext/standard/tests/file/windows_acls/bug44859_4.phpt48
-rw-r--r--ext/standard/tests/file/windows_acls/common.inc244
-rw-r--r--ext/standard/tests/file/windows_links/bug78862.phpt8
-rw-r--r--ext/standard/tests/file/windows_links/common.inc18
-rw-r--r--ext/standard/tests/file/windows_links/readlink_compat.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/bug54028.phpt14
-rw-r--r--ext/standard/tests/file/windows_mb_path/bug54028_2.phpt14
-rw-r--r--ext/standard/tests/file/windows_mb_path/bug54977.phpt12
-rw-r--r--ext/standard/tests/file/windows_mb_path/bug61315.phpt2
-rw-r--r--ext/standard/tests/file/windows_mb_path/bug64506.phpt6
-rw-r--r--ext/standard/tests/file/windows_mb_path/bug64699.phpt6
-rw-r--r--ext/standard/tests/file/windows_mb_path/bug70903.phpt2
-rw-r--r--ext/standard/tests/file/windows_mb_path/bug71509.phpt2
-rw-r--r--ext/standard/tests/file/windows_mb_path/bug74923.phpt4
-rw-r--r--ext/standard/tests/file/windows_mb_path/bug75063_cp1251.phpt16
-rw-r--r--ext/standard/tests/file/windows_mb_path/bug75063_utf8.phpt14
-rw-r--r--ext/standard/tests/file/windows_mb_path/recursive_it.phpt34
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_big5_0.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_big5_1.phpt2
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_big5_2.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_big5_to_utf8_0.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_big5_to_utf8_1.phpt2
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_big5_to_utf8_2.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_0.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_1.phpt2
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_2.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_3.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_4.phpt2
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_5.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1251_0.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1251_1.phpt2
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1251_2.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1251_to_utf8_0.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1251_to_utf8_1.phpt2
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1251_to_utf8_2.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1251_zend_multibyte_0.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1251_zend_multibyte_1.phpt2
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1251_zend_multibyte_2.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1252_0.phpt2
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_0.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_1.phpt2
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_2.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_3.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_4.phpt2
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_5.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1253_0.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1253_1.phpt2
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1253_2.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1253_to_utf8_0.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1253_to_utf8_1.phpt2
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1253_to_utf8_2.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1254_0.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1254_1.phpt2
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1254_2.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1254_3.phpt2
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1254_to_utf8_0.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1254_to_utf8_1.phpt2
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1254_to_utf8_2.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1254_to_utf8_3.phpt2
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1255_0.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1255_1.phpt2
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1255_2.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1255_to_utf8_0.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1255_to_utf8_1.phpt2
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1255_to_utf8_2.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1256_0.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1256_1.phpt2
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1256_2.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1256_to_utf8_0.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1256_to_utf8_1.phpt2
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp1256_to_utf8_2.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp874_0.phpt30
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp874_1.phpt2
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp874_to_utf8_0.phpt30
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp874_to_utf8_1.phpt2
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp932_0.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp932_1.phpt2
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp932_2.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp932_3.phpt2
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp932_to_utf8_0.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp932_to_utf8_1.phpt2
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp932_to_utf8_2.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp936_0.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp936_1.phpt2
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp936_2.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp936_to_utf8_0.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp936_to_utf8_1.phpt2
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cp936_to_utf8_2.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_cwd_mb_names.phpt2
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_eucjp_to_utf8_0.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_eucjp_to_utf8_1.phpt2
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_eucjp_to_utf8_2.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_kartuli_utf8_0.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_kartuli_utf8_1.phpt2
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_kartuli_utf8_2.phpt8
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_kartuli_utf8_3.phpt2
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_long_path_0.phpt10
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_long_path_1.phpt10
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_long_path_2.phpt10
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_long_path_bug30730.phpt2
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_long_path_bug70943.phpt6
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_long_path_bug71103.phpt36
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_long_path_mkdir.phpt16
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_readdir_mb_names.phpt4
-rw-r--r--ext/standard/tests/file/windows_mb_path/test_rename_mb_names.phpt2
-rw-r--r--ext/standard/tests/file/windows_mb_path/util.inc212
-rw-r--r--ext/standard/tests/file/windows_mb_path/util_utf8.inc156
-rw-r--r--ext/standard/tests/filters/001.phpt39
-rw-r--r--ext/standard/tests/filters/basic.phpt20
-rw-r--r--ext/standard/tests/filters/bug22538.phpt12
-rw-r--r--ext/standard/tests/filters/bug35916.phpt30
-rw-r--r--ext/standard/tests/filters/bug46164-1.phpt14
-rw-r--r--ext/standard/tests/filters/bug46164-2.phpt16
-rw-r--r--ext/standard/tests/filters/chunked_001.phpt22
-rw-r--r--ext/standard/tests/filters/filter_errors.inc40
-rw-r--r--ext/standard/tests/filters/filter_errors_convert_base64_decode.phpt4
-rw-r--r--ext/standard/tests/filters/filter_errors_user.phpt84
-rw-r--r--ext/standard/tests/filters/object_init_failure.phpt2
-rw-r--r--ext/standard/tests/filters/object_init_failure_2.phpt2
-rw-r--r--ext/standard/tests/filters/php_user_filter_01.phpt2
-rw-r--r--ext/standard/tests/filters/php_user_filter_02.phpt2
-rw-r--r--ext/standard/tests/filters/php_user_filter_03.phpt2
-rw-r--r--ext/standard/tests/filters/stream_filter_remove_basic.phpt2
-rw-r--r--ext/standard/tests/filters/stream_filter_remove_error.phpt51
-rw-r--r--ext/standard/tests/filters/strip_tags_filter.phpt29
-rw-r--r--ext/standard/tests/general_functions/001.phpt20
-rw-r--r--ext/standard/tests/general_functions/002.phpt6
-rw-r--r--ext/standard/tests/general_functions/003.phpt16
-rw-r--r--ext/standard/tests/general_functions/004.phpt2
-rw-r--r--ext/standard/tests/general_functions/006.phpt6
-rw-r--r--ext/standard/tests/general_functions/007.phpt4
-rw-r--r--ext/standard/tests/general_functions/009.phpt4
-rw-r--r--ext/standard/tests/general_functions/010.phpt23
-rw-r--r--ext/standard/tests/general_functions/boolval.phpt22
-rw-r--r--ext/standard/tests/general_functions/bug25038.phpt10
-rw-r--r--ext/standard/tests/general_functions/bug29038.phpt4
-rw-r--r--ext/standard/tests/general_functions/bug32647.phpt15
-rw-r--r--ext/standard/tests/general_functions/bug35229.phpt4
-rw-r--r--ext/standard/tests/general_functions/bug36011.phpt40
-rw-r--r--ext/standard/tests/general_functions/bug40398.phpt70
-rw-r--r--ext/standard/tests/general_functions/bug41037.phpt4
-rw-r--r--ext/standard/tests/general_functions/bug41970.phpt24
-rw-r--r--ext/standard/tests/general_functions/bug44295.phpt2
-rw-r--r--ext/standard/tests/general_functions/bug44667.phpt4
-rw-r--r--ext/standard/tests/general_functions/bug46587.phpt10
-rw-r--r--ext/standard/tests/general_functions/bug47857.phpt32
-rw-r--r--ext/standard/tests/general_functions/bug49847.phpt14
-rw-r--r--ext/standard/tests/general_functions/bug55371.phpt16
-rw-r--r--ext/standard/tests/general_functions/bug60723.phpt4
-rw-r--r--ext/standard/tests/general_functions/bug67498.phpt2
-rw-r--r--ext/standard/tests/general_functions/bug70018.phpt6
-rw-r--r--ext/standard/tests/general_functions/bug71891.phpt8
-rw-r--r--ext/standard/tests/general_functions/bug72306.phpt4
-rw-r--r--ext/standard/tests/general_functions/bug72920.phpt14
-rw-r--r--ext/standard/tests/general_functions/bug76643.phpt2
-rw-r--r--ext/standard/tests/general_functions/call_user_func_array_variation_001.phpt4
-rw-r--r--ext/standard/tests/general_functions/call_user_func_return.phpt18
-rw-r--r--ext/standard/tests/general_functions/callbacks_001.phpt11
-rw-r--r--ext/standard/tests/general_functions/callbacks_002.phpt26
-rw-r--r--ext/standard/tests/general_functions/debug_zval_dump_o.phpt6
-rw-r--r--ext/standard/tests/general_functions/debug_zval_dump_v.phpt10
-rw-r--r--ext/standard/tests/general_functions/error_clear_last.phpt2
-rw-r--r--ext/standard/tests/general_functions/error_get_last.phpt27
-rw-r--r--ext/standard/tests/general_functions/escapeshellarg_bug71039.phpt6
-rw-r--r--ext/standard/tests/general_functions/escapeshellarg_variation1-win32.phpt8
-rw-r--r--ext/standard/tests/general_functions/escapeshellarg_variation1.phpt8
-rw-r--r--ext/standard/tests/general_functions/escapeshellcmd-win32.phpt22
-rw-r--r--ext/standard/tests/general_functions/escapeshellcmd_bug71039.phpt6
-rw-r--r--ext/standard/tests/general_functions/floatval.phpt64
-rw-r--r--ext/standard/tests/general_functions/floatval_basic.phpt30
-rw-r--r--ext/standard/tests/general_functions/floatval_variation1.phpt12
-rw-r--r--ext/standard/tests/general_functions/get_defined_constants_basic.phpt6
-rw-r--r--ext/standard/tests/general_functions/get_defined_vars_basic.phpt6
-rw-r--r--ext/standard/tests/general_functions/get_extension_funcs_basic.phpt6
-rw-r--r--ext/standard/tests/general_functions/get_extension_funcs_error.phpt40
-rw-r--r--ext/standard/tests/general_functions/get_include_path_basic.phpt15
-rw-r--r--ext/standard/tests/general_functions/get_included_files.phpt10
-rw-r--r--ext/standard/tests/general_functions/get_loaded_extensions_basic.phpt2
-rw-r--r--ext/standard/tests/general_functions/get_resource_type_basic.phpt2
-rw-r--r--ext/standard/tests/general_functions/getopt.phpt2
-rw-r--r--ext/standard/tests/general_functions/getopt_002.phpt2
-rw-r--r--ext/standard/tests/general_functions/getopt_003.phpt2
-rw-r--r--ext/standard/tests/general_functions/getopt_004.phpt2
-rw-r--r--ext/standard/tests/general_functions/getopt_005.phpt2
-rw-r--r--ext/standard/tests/general_functions/getrusage.phpt6
-rw-r--r--ext/standard/tests/general_functions/getrusage_basic.phpt4
-rw-r--r--ext/standard/tests/general_functions/getservbyname_basic.phpt10
-rw-r--r--ext/standard/tests/general_functions/getservbyport_basic.phpt24
-rw-r--r--ext/standard/tests/general_functions/getservbyport_variation1.phpt26
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_basic.phpt110
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_error.phpt38
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_variation1.phpt23
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_variation2.phpt33
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_variation3.phpt31
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_variation4.phpt47
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_variation5.phpt284
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_variation6.phpt25
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_variation7.phpt25
-rw-r--r--ext/standard/tests/general_functions/gettype_settype_variation8.phpt33
-rw-r--r--ext/standard/tests/general_functions/head.phpt6
-rw-r--r--ext/standard/tests/general_functions/include_path.phpt24
-rw-r--r--ext/standard/tests/general_functions/intval.phpt15
-rw-r--r--ext/standard/tests/general_functions/intval_variation1.phpt18
-rw-r--r--ext/standard/tests/general_functions/is_array.phpt15
-rw-r--r--ext/standard/tests/general_functions/is_bool.phpt15
-rw-r--r--ext/standard/tests/general_functions/is_callable_basic1.phpt2
-rw-r--r--ext/standard/tests/general_functions/is_callable_basic2.phpt50
-rw-r--r--ext/standard/tests/general_functions/is_callable_variation1.phpt2
-rw-r--r--ext/standard/tests/general_functions/is_callable_variation2.phpt2
-rw-r--r--ext/standard/tests/general_functions/is_countable_with_variables.phpt4
-rw-r--r--ext/standard/tests/general_functions/is_float.phpt35
-rw-r--r--ext/standard/tests/general_functions/is_float_64bit.phpt35
-rw-r--r--ext/standard/tests/general_functions/is_int.phpt31
-rw-r--r--ext/standard/tests/general_functions/is_int_64bit.phpt31
-rw-r--r--ext/standard/tests/general_functions/is_null.phpt15
-rw-r--r--ext/standard/tests/general_functions/is_numeric.phpt15
-rw-r--r--ext/standard/tests/general_functions/is_object.phpt15
-rw-r--r--ext/standard/tests/general_functions/is_resource.phpt6
-rw-r--r--ext/standard/tests/general_functions/is_resource_basic.phpt54
-rw-r--r--ext/standard/tests/general_functions/is_scalar.phpt19
-rw-r--r--ext/standard/tests/general_functions/is_string.phpt17
-rw-r--r--ext/standard/tests/general_functions/isset_basic1.phpt2
-rw-r--r--ext/standard/tests/general_functions/isset_basic2.phpt2
-rw-r--r--ext/standard/tests/general_functions/ob_get_flush_basic.phpt2
-rw-r--r--ext/standard/tests/general_functions/ob_get_flush_error.phpt11
-rw-r--r--ext/standard/tests/general_functions/ob_get_length_basic.phpt18
-rw-r--r--ext/standard/tests/general_functions/ob_start_closures.phpt2
-rw-r--r--ext/standard/tests/general_functions/output_add_rewrite_var_basic1.phpt2
-rw-r--r--ext/standard/tests/general_functions/output_add_rewrite_var_basic2.phpt2
-rw-r--r--ext/standard/tests/general_functions/output_add_rewrite_var_basic3.phpt2
-rw-r--r--ext/standard/tests/general_functions/output_add_rewrite_var_basic4.phpt2
-rw-r--r--ext/standard/tests/general_functions/parse_ini_file.phpt16
-rw-r--r--ext/standard/tests/general_functions/parse_ini_string_001.phpt6
-rw-r--r--ext/standard/tests/general_functions/parse_ini_string_002.phpt8
-rw-r--r--ext/standard/tests/general_functions/parse_ini_string_bug76068.phpt2
-rw-r--r--ext/standard/tests/general_functions/php_uname_basic.phpt2
-rw-r--r--ext/standard/tests/general_functions/php_uname_error.phpt36
-rw-r--r--ext/standard/tests/general_functions/phpcredits.phpt4
-rw-r--r--ext/standard/tests/general_functions/phpcredits2.phpt4
-rw-r--r--ext/standard/tests/general_functions/phpinfo.phpt7
-rw-r--r--ext/standard/tests/general_functions/phpinfo2.phpt7
-rw-r--r--ext/standard/tests/general_functions/print_r.phpt71
-rw-r--r--ext/standard/tests/general_functions/print_r_64bit.phpt59
-rw-r--r--ext/standard/tests/general_functions/proc_nice_basic-win.phpt92
-rw-r--r--ext/standard/tests/general_functions/proc_nice_basic.phpt30
-rw-r--r--ext/standard/tests/general_functions/proc_open-mb0.phpt27
-rw-r--r--ext/standard/tests/general_functions/proc_open-mb1.phpt21
-rw-r--r--ext/standard/tests/general_functions/proc_open.phpt16
-rw-r--r--ext/standard/tests/general_functions/proc_open02.phpt6
-rw-r--r--ext/standard/tests/general_functions/proc_open_array.phpt39
-rw-r--r--ext/standard/tests/general_functions/proc_open_pipes1.phpt2
-rw-r--r--ext/standard/tests/general_functions/proc_open_pipes3.phpt13
-rw-r--r--ext/standard/tests/general_functions/proc_open_redirect.phpt30
-rw-r--r--ext/standard/tests/general_functions/putenv.phpt21
-rw-r--r--ext/standard/tests/general_functions/putenv_bug75574_cp936_win.phpt2
-rw-r--r--ext/standard/tests/general_functions/putenv_bug75574_utf8.phpt2
-rw-r--r--ext/standard/tests/general_functions/rand.phpt24
-rw-r--r--ext/standard/tests/general_functions/register_tick_function_error.phpt14
-rw-r--r--ext/standard/tests/general_functions/sleep_basic.phpt10
-rw-r--r--ext/standard/tests/general_functions/sleep_error.phpt42
-rw-r--r--ext/standard/tests/general_functions/strval.phpt23
-rw-r--r--ext/standard/tests/general_functions/sys_getloadavg.phpt3
-rw-r--r--ext/standard/tests/general_functions/type.phpt93
-rw-r--r--ext/standard/tests/general_functions/uniqid_basic.phpt24
-rw-r--r--ext/standard/tests/general_functions/usleep_basic.phpt6
-rw-r--r--ext/standard/tests/general_functions/usleep_error.phpt43
-rw-r--r--ext/standard/tests/general_functions/var_dump.phpt45
-rw-r--r--ext/standard/tests/general_functions/var_dump_64bit.phpt45
-rw-r--r--ext/standard/tests/general_functions/var_export-locale.phpt24
-rw-r--r--ext/standard/tests/general_functions/var_export-locale_32.phpt32
-rw-r--r--ext/standard/tests/general_functions/var_export_basic1.phpt14
-rw-r--r--ext/standard/tests/general_functions/var_export_basic1_32.phpt16
-rw-r--r--ext/standard/tests/general_functions/var_export_basic2.phpt24
-rw-r--r--ext/standard/tests/general_functions/var_export_basic3.phpt56
-rw-r--r--ext/standard/tests/general_functions/var_export_basic4.phpt16
-rw-r--r--ext/standard/tests/general_functions/var_export_basic5.phpt16
-rw-r--r--ext/standard/tests/general_functions/var_export_basic6.phpt16
-rw-r--r--ext/standard/tests/general_functions/var_export_basic7.phpt16
-rw-r--r--ext/standard/tests/general_functions/var_export_basic9.phpt6
-rw-r--r--ext/standard/tests/general_functions/var_export_error2.phpt7
-rw-r--r--ext/standard/tests/general_functions/var_export_error3.phpt2
-rw-r--r--ext/standard/tests/hrtime/hrtime.phpt4
-rw-r--r--ext/standard/tests/http/bug38802.phpt42
-rw-r--r--ext/standard/tests/http/bug43510.phpt12
-rw-r--r--ext/standard/tests/http/bug47021.phpt2
-rw-r--r--ext/standard/tests/http/bug48929.phpt24
-rw-r--r--ext/standard/tests/http/bug53198.phpt22
-rw-r--r--ext/standard/tests/http/bug60570.phpt42
-rw-r--r--ext/standard/tests/http/bug61548.phpt10
-rw-r--r--ext/standard/tests/http/bug69337.phpt12
-rw-r--r--ext/standard/tests/http/bug75535.phpt4
-rw-r--r--ext/standard/tests/http/bug75981.phpt2
-rw-r--r--ext/standard/tests/http/bug76342.phpt2
-rw-r--r--ext/standard/tests/http/http_response_header_01.phpt4
-rw-r--r--ext/standard/tests/http/http_response_header_02.phpt4
-rw-r--r--ext/standard/tests/http/http_response_header_03.phpt6
-rw-r--r--ext/standard/tests/http/http_response_header_04.phpt4
-rw-r--r--ext/standard/tests/http/http_response_header_05.phpt4
-rw-r--r--ext/standard/tests/http/ignore_errors.phpt40
-rw-r--r--ext/standard/tests/http/server.inc146
-rw-r--r--ext/standard/tests/image/bug13213.phpt2
-rw-r--r--ext/standard/tests/image/bug71848.phpt2
-rw-r--r--ext/standard/tests/image/bug72278.phpt4
-rw-r--r--ext/standard/tests/image/getimagesize.phpt30
-rw-r--r--ext/standard/tests/image/getimagesize_246x247.phpt30
-rw-r--r--ext/standard/tests/image/getimagesize_384x385.phpt30
-rw-r--r--ext/standard/tests/image/getimagesize_basic.phpt2
-rw-r--r--ext/standard/tests/image/getimagesize_jpgapp.phpt4
-rw-r--r--ext/standard/tests/image/getimagesize_swc.phpt2
-rw-r--r--ext/standard/tests/image/getimagesize_tif_mm.phpt2
-rw-r--r--ext/standard/tests/image/getimagesize_variation2.phpt12
-rw-r--r--ext/standard/tests/image/getimagesize_variation3.phpt16
-rw-r--r--ext/standard/tests/image/getimagesize_variation4.phpt2
-rw-r--r--ext/standard/tests/image/getimagesize_variation_005.phpt2
-rw-r--r--ext/standard/tests/image/getimagesize_wbmp.phpt2
-rw-r--r--ext/standard/tests/image/getimagesize_xbm.phpt2
-rw-r--r--ext/standard/tests/image/image_type_to_extension.phpt16
-rw-r--r--ext/standard/tests/image/image_type_to_mime_type.phpt32
-rw-r--r--ext/standard/tests/image/image_type_to_mime_type_basic.phpt40
-rw-r--r--ext/standard/tests/image/image_type_to_mime_type_variation2.phpt2
-rw-r--r--ext/standard/tests/image/image_type_to_mime_type_variation3.phpt2
-rw-r--r--ext/standard/tests/image/image_type_to_mime_type_variation4.phpt2
-rw-r--r--ext/standard/tests/image/iptcembed_002.phpt4
-rw-r--r--ext/standard/tests/mail/bug51604.phpt9
-rw-r--r--ext/standard/tests/mail/bug66535.phpt9
-rw-r--r--ext/standard/tests/mail/bug69115.phpt2
-rw-r--r--ext/standard/tests/mail/bug69874.phpt9
-rw-r--r--ext/standard/tests/mail/bug69874_2.phpt9
-rw-r--r--ext/standard/tests/mail/bug73203.phpt12
-rw-r--r--ext/standard/tests/mail/ezmlm_hash_basic.phpt25
-rw-r--r--ext/standard/tests/mail/mail_basic.phpt9
-rw-r--r--ext/standard/tests/mail/mail_basic2.phpt2
-rw-r--r--ext/standard/tests/mail/mail_basic3.phpt35
-rw-r--r--ext/standard/tests/mail/mail_basic4.phpt36
-rw-r--r--ext/standard/tests/mail/mail_basic5.phpt2
-rw-r--r--ext/standard/tests/mail/mail_basic6.phpt2
-rw-r--r--ext/standard/tests/mail/mail_basic7.phpt73
-rw-r--r--ext/standard/tests/mail/mail_basic_alt1-win32.phpt46
-rw-r--r--ext/standard/tests/mail/mail_basic_alt2-win32.phpt46
-rw-r--r--ext/standard/tests/mail/mail_basic_alt3-win32.phpt46
-rw-r--r--ext/standard/tests/mail/mail_basic_alt4-win32.phpt46
-rw-r--r--ext/standard/tests/mail/mail_include.inc182
-rw-r--r--ext/standard/tests/mail/mail_log.phpt15
-rw-r--r--ext/standard/tests/mail/mail_skipif.inc16
-rw-r--r--ext/standard/tests/mail/mail_variation1.phpt2
-rw-r--r--ext/standard/tests/mail/mail_variation2.phpt2
-rw-r--r--ext/standard/tests/mail/mail_variation_alt1-win32.phpt46
-rw-r--r--ext/standard/tests/mail/mail_variation_alt2-win32.phpt46
-rw-r--r--ext/standard/tests/mail/mail_variation_alt3-win32.phpt46
-rw-r--r--ext/standard/tests/math/abs.phpt2
-rw-r--r--ext/standard/tests/math/abs_basic.phpt32
-rw-r--r--ext/standard/tests/math/abs_basiclong_64bit.phpt2
-rw-r--r--ext/standard/tests/math/abs_variation.phpt32
-rw-r--r--ext/standard/tests/math/acos_basic.phpt16
-rw-r--r--ext/standard/tests/math/acos_basiclong_64bit.phpt2
-rw-r--r--ext/standard/tests/math/acos_variation.phpt34
-rw-r--r--ext/standard/tests/math/acosh_basic.phpt8
-rw-r--r--ext/standard/tests/math/acosh_basiclong_64bit.phpt2
-rw-r--r--ext/standard/tests/math/acosh_variation.phpt34
-rw-r--r--ext/standard/tests/math/allowed_rounding_error.inc22
-rw-r--r--ext/standard/tests/math/asin_basic.phpt16
-rw-r--r--ext/standard/tests/math/asin_basiclong_64bit.phpt2
-rw-r--r--ext/standard/tests/math/asin_variation.phpt34
-rw-r--r--ext/standard/tests/math/asinh_basic.phpt8
-rw-r--r--ext/standard/tests/math/asinh_basiclong_64bit.phpt2
-rw-r--r--ext/standard/tests/math/asinh_variation.phpt34
-rw-r--r--ext/standard/tests/math/atan2_basic.phpt54
-rw-r--r--ext/standard/tests/math/atan2_basiclong_64bit.phpt4
-rw-r--r--ext/standard/tests/math/atan_basic.phpt8
-rw-r--r--ext/standard/tests/math/atan_basiclong_64bit.phpt2
-rw-r--r--ext/standard/tests/math/atan_variation.phpt34
-rw-r--r--ext/standard/tests/math/atanh_basic.phpt8
-rw-r--r--ext/standard/tests/math/atanh_basiclong_64bit.phpt2
-rw-r--r--ext/standard/tests/math/atanh_variation.phpt34
-rw-r--r--ext/standard/tests/math/base_convert_basic.phpt36
-rw-r--r--ext/standard/tests/math/base_convert_error.phpt33
-rw-r--r--ext/standard/tests/math/base_convert_variation1.phpt10
-rw-r--r--ext/standard/tests/math/bindec_basic.phpt40
-rw-r--r--ext/standard/tests/math/bindec_basic_64bit.phpt40
-rw-r--r--ext/standard/tests/math/bindec_basiclong_64bit.phpt2
-rw-r--r--ext/standard/tests/math/bindec_variation1.phpt22
-rw-r--r--ext/standard/tests/math/bindec_variation1_64bit.phpt22
-rw-r--r--ext/standard/tests/math/bug24142.phpt4
-rw-r--r--ext/standard/tests/math/bug30695.phpt4
-rw-r--r--ext/standard/tests/math/bug75514.phpt2
-rw-r--r--ext/standard/tests/math/ceil_basic.phpt46
-rw-r--r--ext/standard/tests/math/ceil_basiclong_64bit.phpt2
-rw-r--r--ext/standard/tests/math/ceil_variation1.phpt32
-rw-r--r--ext/standard/tests/math/cos_basic.phpt24
-rw-r--r--ext/standard/tests/math/cos_basiclong_64bit.phpt2
-rw-r--r--ext/standard/tests/math/cos_variation.phpt34
-rw-r--r--ext/standard/tests/math/cosh_basic.phpt16
-rw-r--r--ext/standard/tests/math/cosh_basiclong_64bit.phpt2
-rw-r--r--ext/standard/tests/math/cosh_variation.phpt34
-rw-r--r--ext/standard/tests/math/decbin_basic.phpt30
-rw-r--r--ext/standard/tests/math/decbin_basiclong_64bit.phpt2
-rw-r--r--ext/standard/tests/math/decbin_variation1.phpt8
-rw-r--r--ext/standard/tests/math/decbin_variation1_64bit.phpt8
-rw-r--r--ext/standard/tests/math/dechex_basic.phpt30
-rw-r--r--ext/standard/tests/math/dechex_basiclong_64bit.phpt2
-rw-r--r--ext/standard/tests/math/dechex_variation1.phpt8
-rw-r--r--ext/standard/tests/math/dechex_variation1_64bit.phpt8
-rw-r--r--ext/standard/tests/math/decoct_basic.phpt30
-rw-r--r--ext/standard/tests/math/decoct_basiclong_64bit.phpt2
-rw-r--r--ext/standard/tests/math/decoct_variation1.phpt8
-rw-r--r--ext/standard/tests/math/decoct_variation1_64bit.phpt8
-rw-r--r--ext/standard/tests/math/deg2rad_basic.phpt16
-rw-r--r--ext/standard/tests/math/deg2rad_basiclong_64bit.phpt2
-rw-r--r--ext/standard/tests/math/deg2rad_variation.phpt34
-rw-r--r--ext/standard/tests/math/exp_basic.phpt32
-rw-r--r--ext/standard/tests/math/exp_basiclong_64bit.phpt2
-rw-r--r--ext/standard/tests/math/expm1_basic.phpt32
-rw-r--r--ext/standard/tests/math/expm1_basiclong_64bit.phpt2
-rw-r--r--ext/standard/tests/math/fdiv.phpt78
-rw-r--r--ext/standard/tests/math/floor_basic.phpt46
-rw-r--r--ext/standard/tests/math/floor_basiclong_64bit.phpt2
-rw-r--r--ext/standard/tests/math/floor_variation1.phpt32
-rw-r--r--ext/standard/tests/math/fmod_basic.phpt54
-rw-r--r--ext/standard/tests/math/fmod_basiclong_64bit.phpt4
-rw-r--r--ext/standard/tests/math/hexdec_basic.phpt38
-rw-r--r--ext/standard/tests/math/hexdec_basic_64bit.phpt40
-rw-r--r--ext/standard/tests/math/hexdec_basiclong_64bit.phpt2
-rw-r--r--ext/standard/tests/math/hexdec_variation1.phpt22
-rw-r--r--ext/standard/tests/math/hexdec_variation1_64bit.phpt22
-rw-r--r--ext/standard/tests/math/hypot_basic.phpt60
-rw-r--r--ext/standard/tests/math/hypot_basiclong_64bit.phpt4
-rw-r--r--ext/standard/tests/math/is_finite_basic.phpt30
-rw-r--r--ext/standard/tests/math/is_finite_basiclong_64bit.phpt2
-rw-r--r--ext/standard/tests/math/is_infinite_basic.phpt30
-rw-r--r--ext/standard/tests/math/is_infinite_basiclong_64bit.phpt2
-rw-r--r--ext/standard/tests/math/is_nan_basic.phpt30
-rw-r--r--ext/standard/tests/math/is_nan_basiclong_64bit.phpt2
-rw-r--r--ext/standard/tests/math/lcg_value_basic.phpt36
-rw-r--r--ext/standard/tests/math/log10_basic.phpt12
-rw-r--r--ext/standard/tests/math/log10_basiclong_64bit.phpt2
-rw-r--r--ext/standard/tests/math/log10_variation.phpt34
-rw-r--r--ext/standard/tests/math/log1p_basic.phpt28
-rw-r--r--ext/standard/tests/math/log1p_basiclong_64bit.phpt2
-rw-r--r--ext/standard/tests/math/log_basic.phpt30
-rw-r--r--ext/standard/tests/math/log_basiclong_64bit.phpt2
-rw-r--r--ext/standard/tests/math/log_error.phpt16
-rw-r--r--ext/standard/tests/math/mt_rand_basic.phpt88
-rw-r--r--ext/standard/tests/math/number_format_basic.phpt38
-rw-r--r--ext/standard/tests/math/number_format_multichar.phpt34
-rw-r--r--ext/standard/tests/math/octdec_basic.phpt36
-rw-r--r--ext/standard/tests/math/octdec_basic_64bit.phpt38
-rw-r--r--ext/standard/tests/math/octdec_basiclong_64bit.phpt2
-rw-r--r--ext/standard/tests/math/octdec_variation1.phpt20
-rw-r--r--ext/standard/tests/math/pow.phpt2
-rw-r--r--ext/standard/tests/math/pow_basic.phpt42
-rw-r--r--ext/standard/tests/math/pow_basic2.phpt2
-rw-r--r--ext/standard/tests/math/pow_basic_64bit.phpt42
-rw-r--r--ext/standard/tests/math/pow_basiclong_64bit.phpt4
-rw-r--r--ext/standard/tests/math/pow_variation1.phpt14
-rw-r--r--ext/standard/tests/math/pow_variation1_64bit.phpt14
-rw-r--r--ext/standard/tests/math/pow_variation2.phpt14
-rw-r--r--ext/standard/tests/math/rad2deg_basic.phpt16
-rw-r--r--ext/standard/tests/math/rad2deg_basiclong_64bit.phpt2
-rw-r--r--ext/standard/tests/math/rad2deg_variation.phpt34
-rw-r--r--ext/standard/tests/math/rand_basic.phpt88
-rw-r--r--ext/standard/tests/math/round.phpt2
-rw-r--r--ext/standard/tests/math/round_basic.phpt52
-rw-r--r--ext/standard/tests/math/round_basiclong_64bit.phpt2
-rw-r--r--ext/standard/tests/math/round_bug71201.phpt2
-rw-r--r--ext/standard/tests/math/round_variation1.phpt32
-rw-r--r--ext/standard/tests/math/sin_basic.phpt24
-rw-r--r--ext/standard/tests/math/sin_basiclong_64bit.phpt2
-rw-r--r--ext/standard/tests/math/sin_variation.phpt34
-rw-r--r--ext/standard/tests/math/sinh_basic.phpt16
-rw-r--r--ext/standard/tests/math/sinh_basiclong_64bit.phpt2
-rw-r--r--ext/standard/tests/math/sinh_variation.phpt34
-rw-r--r--ext/standard/tests/math/sqrt_basiclong_64bit.phpt2
-rw-r--r--ext/standard/tests/math/sqrt_variation.phpt36
-rw-r--r--ext/standard/tests/math/srand_basic.phpt2
-rw-r--r--ext/standard/tests/math/tan_basic.phpt8
-rw-r--r--ext/standard/tests/math/tan_basiclong_64bit.phpt2
-rw-r--r--ext/standard/tests/math/tan_variation.phpt34
-rw-r--r--ext/standard/tests/math/tanh_basic.phpt16
-rw-r--r--ext/standard/tests/math/tanh_basiclong_64bit.phpt2
-rw-r--r--ext/standard/tests/math/tanh_variation.phpt34
-rw-r--r--ext/standard/tests/misc/browsernames.inc78
-rw-r--r--ext/standard/tests/misc/bug65550.phpt2
-rw-r--r--ext/standard/tests/misc/get_browser_basic.phpt4
-rw-r--r--ext/standard/tests/misc/get_browser_error.phpt8
-rw-r--r--ext/standard/tests/misc/get_browser_variation1.phpt4
-rw-r--r--ext/standard/tests/misc/time_nanosleep_error3.phpt8
-rw-r--r--ext/standard/tests/misc/time_nanosleep_error4.phpt8
-rw-r--r--ext/standard/tests/misc/time_nanosleep_error5.phpt8
-rw-r--r--ext/standard/tests/network/bug20134.phpt12
-rw-r--r--ext/standard/tests/network/bug41347.phpt11
-rw-r--r--ext/standard/tests/network/bug64330.phpt4
-rw-r--r--ext/standard/tests/network/bug74764.phpt4
-rw-r--r--ext/standard/tests/network/closelog_basic.phpt2
-rw-r--r--ext/standard/tests/network/fsockopen_error.phpt31
-rw-r--r--ext/standard/tests/network/gethostbyaddr_basic1.phpt2
-rw-r--r--ext/standard/tests/network/gethostbyaddr_error.phpt20
-rw-r--r--ext/standard/tests/network/gethostbyname_basic001.phpt2
-rw-r--r--ext/standard/tests/network/gethostbyname_basic003.phpt2
-rw-r--r--ext/standard/tests/network/gethostbyname_error001.phpt2
-rw-r--r--ext/standard/tests/network/gethostbyname_error002.phpt2
-rw-r--r--ext/standard/tests/network/gethostbyname_error003.phpt2
-rw-r--r--ext/standard/tests/network/gethostbyname_error004.phpt4
-rw-r--r--ext/standard/tests/network/gethostbyname_error006.phpt2
-rw-r--r--ext/standard/tests/network/gethostbynamel_basic1.phpt2
-rw-r--r--ext/standard/tests/network/gethostname.phpt6
-rw-r--r--ext/standard/tests/network/getprotobyname_basic.phpt2
-rw-r--r--ext/standard/tests/network/getprotobyname_error.phpt11
-rw-r--r--ext/standard/tests/network/getprotobynumber_basic.phpt2
-rw-r--r--ext/standard/tests/network/getprotobynumber_error.phpt11
-rw-r--r--ext/standard/tests/network/inet.phpt22
-rw-r--r--ext/standard/tests/network/inet_ipv6.phpt22
-rw-r--r--ext/standard/tests/network/ip.phpt36
-rw-r--r--ext/standard/tests/network/ip2long_variation2.phpt20
-rw-r--r--ext/standard/tests/network/ip2long_variation2_x64.phpt20
-rw-r--r--ext/standard/tests/network/ip_x86_64.phpt36
-rw-r--r--ext/standard/tests/network/setcookie.phpt66
-rw-r--r--ext/standard/tests/network/shutdown.phpt86
-rw-r--r--ext/standard/tests/network/socket_bug74429.phpt4
-rw-r--r--ext/standard/tests/network/syslog_basic.phpt2
-rw-r--r--ext/standard/tests/network/tcp4loop.phpt38
-rw-r--r--ext/standard/tests/network/tcp6loop.phpt38
-rw-r--r--ext/standard/tests/network/udgloop.phpt38
-rw-r--r--ext/standard/tests/network/udp4loop.phpt38
-rw-r--r--ext/standard/tests/network/udp6loop.phpt26
-rw-r--r--ext/standard/tests/network/unixloop.phpt50
-rw-r--r--ext/standard/tests/password/bug75221.phpt2
-rw-r--r--ext/standard/tests/password/password_bcrypt_errors.phpt51
-rw-r--r--ext/standard/tests/password/password_deprecated_salts.phpt20
-rw-r--r--ext/standard/tests/password/password_hash_argon2.phpt12
-rw-r--r--ext/standard/tests/password/password_hash_error.phpt79
-rw-r--r--ext/standard/tests/password/password_hash_error_argon2.phpt58
-rw-r--r--ext/standard/tests/password/password_needs_rehash_error.phpt33
-rw-r--r--ext/standard/tests/password/password_removed_salt_option.phpt20
-rw-r--r--ext/standard/tests/password/password_verify_error.phpt16
-rw-r--r--ext/standard/tests/php_version_win_const.phpt2
-rw-r--r--ext/standard/tests/random/reflection.phpt2
-rw-r--r--ext/standard/tests/serialize/001.phpt46
-rw-r--r--ext/standard/tests/serialize/002.phpt2
-rw-r--r--ext/standard/tests/serialize/003.phpt6
-rw-r--r--ext/standard/tests/serialize/005.phpt149
-rw-r--r--ext/standard/tests/serialize/006.phpt18
-rw-r--r--ext/standard/tests/serialize/autoload_implements.inc8
-rw-r--r--ext/standard/tests/serialize/autoload_interface.inc2
-rw-r--r--ext/standard/tests/serialize/bug14293.phpt18
-rw-r--r--ext/standard/tests/serialize/bug21957.phpt20
-rw-r--r--ext/standard/tests/serialize/bug23298.phpt8
-rw-r--r--ext/standard/tests/serialize/bug24063.phpt4
-rw-r--r--ext/standard/tests/serialize/bug25378.phpt2
-rw-r--r--ext/standard/tests/serialize/bug26762.phpt8
-rw-r--r--ext/standard/tests/serialize/bug28325.phpt6
-rw-r--r--ext/standard/tests/serialize/bug30234.phpt6
-rw-r--r--ext/standard/tests/serialize/bug31402.phpt2
-rw-r--r--ext/standard/tests/serialize/bug49649.phpt6
-rw-r--r--ext/standard/tests/serialize/bug49649_1.phpt6
-rw-r--r--ext/standard/tests/serialize/bug49649_2.phpt6
-rw-r--r--ext/standard/tests/serialize/bug65481.phpt34
-rw-r--r--ext/standard/tests/serialize/bug65806.phpt4
-rw-r--r--ext/standard/tests/serialize/bug67072.phpt2
-rw-r--r--ext/standard/tests/serialize/bug68044.phpt2
-rw-r--r--ext/standard/tests/serialize/bug68545.phpt2
-rw-r--r--ext/standard/tests/serialize/bug68594.phpt20
-rw-r--r--ext/standard/tests/serialize/bug68976.phpt10
-rw-r--r--ext/standard/tests/serialize/bug69152.phpt8
-rw-r--r--ext/standard/tests/serialize/bug69210.phpt20
-rw-r--r--ext/standard/tests/serialize/bug69425.phpt10
-rw-r--r--ext/standard/tests/serialize/bug69793.phpt6
-rw-r--r--ext/standard/tests/serialize/bug70172.phpt28
-rw-r--r--ext/standard/tests/serialize/bug70172_2.phpt36
-rw-r--r--ext/standard/tests/serialize/bug70213.phpt2
-rw-r--r--ext/standard/tests/serialize/bug70436.phpt30
-rw-r--r--ext/standard/tests/serialize/bug70513.phpt10
-rw-r--r--ext/standard/tests/serialize/bug71995.phpt14
-rw-r--r--ext/standard/tests/serialize/bug72731.phpt8
-rw-r--r--ext/standard/tests/serialize/bug73341.phpt4
-rw-r--r--ext/standard/tests/serialize/bug74300.phpt2
-rw-r--r--ext/standard/tests/serialize/bug76300.phpt22
-rw-r--r--ext/standard/tests/serialize/max_depth.phpt23
-rw-r--r--ext/standard/tests/serialize/precision.phpt42
-rw-r--r--ext/standard/tests/serialize/serialization_arrays_002.phpt24
-rw-r--r--ext/standard/tests/serialize/serialization_arrays_003.phpt22
-rw-r--r--ext/standard/tests/serialize/serialization_arrays_004.phpt76
-rw-r--r--ext/standard/tests/serialize/serialization_arrays_005.phpt41
-rw-r--r--ext/standard/tests/serialize/serialization_objects_002.phptbin7231 -> 7233 bytes
-rw-r--r--ext/standard/tests/serialize/serialization_objects_005.phpt2
-rw-r--r--ext/standard/tests/serialize/serialization_objects_007.phpt4
-rw-r--r--ext/standard/tests/serialize/serialization_objects_010.phpt14
-rw-r--r--ext/standard/tests/serialize/serialization_objects_011.phpt76
-rw-r--r--ext/standard/tests/serialize/serialization_objects_013.phpt22
-rw-r--r--ext/standard/tests/serialize/serialization_objects_014.phpt22
-rw-r--r--ext/standard/tests/serialize/serialization_objects_015.phpt22
-rw-r--r--ext/standard/tests/serialize/typed_property_refs.phpt20
-rw-r--r--ext/standard/tests/serialize/unserialize_mem_leak.phpt2
-rw-r--r--ext/standard/tests/streams/bug40459.phpt96
-rw-r--r--ext/standard/tests/streams/bug44712.phpt10
-rw-r--r--ext/standard/tests/streams/bug44818.phpt10
-rw-r--r--ext/standard/tests/streams/bug46024.phpt14
-rw-r--r--ext/standard/tests/streams/bug46426.phpt2
-rw-r--r--ext/standard/tests/streams/bug49936.phpt2
-rw-r--r--ext/standard/tests/streams/bug49936_win32.phpt4
-rw-r--r--ext/standard/tests/streams/bug53903.phpt8
-rw-r--r--ext/standard/tests/streams/bug54623.phpt9
-rw-r--r--ext/standard/tests/streams/bug54946.phpt8
-rw-r--r--ext/standard/tests/streams/bug60455_01.phpt2
-rw-r--r--ext/standard/tests/streams/bug60455_02.phpt24
-rw-r--r--ext/standard/tests/streams/bug60455_03.phpt36
-rw-r--r--ext/standard/tests/streams/bug60455_04.phpt24
-rw-r--r--ext/standard/tests/streams/bug60602.phpt60
-rw-r--r--ext/standard/tests/streams/bug61019.phpt92
-rw-r--r--ext/standard/tests/streams/bug61371-unix.phpt30
-rw-r--r--ext/standard/tests/streams/bug61371.phpt30
-rw-r--r--ext/standard/tests/streams/bug64166.phpt8
-rw-r--r--ext/standard/tests/streams/bug64166_2.phpt8
-rw-r--r--ext/standard/tests/streams/bug64166_3.phpt8
-rw-r--r--ext/standard/tests/streams/bug64433.phpt6
-rw-r--r--ext/standard/tests/streams/bug64433_srv.inc8
-rw-r--r--ext/standard/tests/streams/bug64770.phpt56
-rw-r--r--ext/standard/tests/streams/bug67626.phpt38
-rw-r--r--ext/standard/tests/streams/bug69521.phpt12
-rw-r--r--ext/standard/tests/streams/bug70198.phpt40
-rw-r--r--ext/standard/tests/streams/bug71245.phpt18
-rw-r--r--ext/standard/tests/streams/bug71884.phpt10
-rw-r--r--ext/standard/tests/streams/bug72771.phpt4
-rw-r--r--ext/standard/tests/streams/bug72853.phpt4
-rw-r--r--ext/standard/tests/streams/bug72857.phpt18
-rw-r--r--ext/standard/tests/streams/bug73457.phpt4
-rw-r--r--ext/standard/tests/streams/bug74090.phpt2
-rw-r--r--ext/standard/tests/streams/bug74951.phpt2
-rw-r--r--ext/standard/tests/streams/bug77664.phpt4
-rw-r--r--ext/standard/tests/streams/bug77680.phpt2
-rw-r--r--ext/standard/tests/streams/bug77765.phpt2
-rw-r--r--ext/standard/tests/streams/bug78883.phpt6
-rw-r--r--ext/standard/tests/streams/glob-wrapper.phpt4
-rw-r--r--ext/standard/tests/streams/opendir-001.phpt4
-rw-r--r--ext/standard/tests/streams/opendir-002.phpt2
-rw-r--r--ext/standard/tests/streams/opendir-003.phpt4
-rw-r--r--ext/standard/tests/streams/opendir-004.phpt2
-rw-r--r--ext/standard/tests/streams/proc_open_bug51800.phpt16
-rw-r--r--ext/standard/tests/streams/proc_open_bug51800_right.phpt4
-rw-r--r--ext/standard/tests/streams/proc_open_bug51800_right2.phpt12
-rw-r--r--ext/standard/tests/streams/proc_open_bug60120.phpt4
-rw-r--r--ext/standard/tests/streams/proc_open_bug64438.phpt6
-rw-r--r--ext/standard/tests/streams/proc_open_bug69900.phpt22
-rw-r--r--ext/standard/tests/streams/set_file_buffer.phpt1
-rw-r--r--ext/standard/tests/streams/stream_context_tcp_nodelay.phpt10
-rw-r--r--ext/standard/tests/streams/stream_context_tcp_nodelay_fopen.phpt14
-rw-r--r--ext/standard/tests/streams/stream_context_tcp_nodelay_server.phpt40
-rw-r--r--ext/standard/tests/streams/stream_get_contents_001.phpt2
-rw-r--r--ext/standard/tests/streams/stream_get_line_NUL_delimiter.phpt24
-rw-r--r--ext/standard/tests/streams/stream_get_meta_data_file_error.phpt42
-rw-r--r--ext/standard/tests/streams/stream_get_meta_data_file_variation1.phpt14
-rw-r--r--ext/standard/tests/streams/stream_get_meta_data_file_variation2.phpt4
-rw-r--r--ext/standard/tests/streams/stream_get_meta_data_file_variation5.phpt4
-rw-r--r--ext/standard/tests/streams/stream_get_meta_data_socket_variation1.phpt4
-rw-r--r--ext/standard/tests/streams/stream_get_meta_data_socket_variation2.phpt2
-rw-r--r--ext/standard/tests/streams/stream_get_meta_data_socket_variation3.phpt2
-rw-r--r--ext/standard/tests/streams/stream_get_meta_data_socket_variation4.phpt4
-rw-r--r--ext/standard/tests/streams/stream_multi_filters_close.phpt64
-rw-r--r--ext/standard/tests/streams/stream_resolve_include_path.phpt13
-rw-r--r--ext/standard/tests/streams/stream_set_chunk_size.phpt78
-rw-r--r--ext/standard/tests/streams/stream_set_timeout_error.phpt40
-rw-r--r--ext/standard/tests/strings/006.phpt4
-rw-r--r--ext/standard/tests/strings/007-win32.phpt4
-rw-r--r--ext/standard/tests/strings/007.phpt4
-rw-r--r--ext/standard/tests/strings/add-and-stripslashes.phpt6
-rw-r--r--ext/standard/tests/strings/addcslashes_001.phptbin1585 -> 1627 bytes
-rw-r--r--ext/standard/tests/strings/addslashes_variation2.phpt6
-rw-r--r--ext/standard/tests/strings/basename.phptbin1148 -> 1217 bytes
-rw-r--r--ext/standard/tests/strings/bin2hex.phpt2
-rw-r--r--ext/standard/tests/strings/bin2hex_basic.phpt14
-rw-r--r--ext/standard/tests/strings/bug20108.phpt6
-rw-r--r--ext/standard/tests/strings/bug20169.phpt10
-rw-r--r--ext/standard/tests/strings/bug21338.phpt4
-rw-r--r--ext/standard/tests/strings/bug21453.phpt10
-rw-r--r--ext/standard/tests/strings/bug22187.phpt4
-rw-r--r--ext/standard/tests/strings/bug22207.phpt4
-rw-r--r--ext/standard/tests/strings/bug22224.phpt8
-rw-r--r--ext/standard/tests/strings/bug24098.phpt2
-rw-r--r--ext/standard/tests/strings/bug24208.phpt13
-rw-r--r--ext/standard/tests/strings/bug24312.phpt4
-rw-r--r--ext/standard/tests/strings/bug25671.phpt12
-rw-r--r--ext/standard/tests/strings/bug26817.phpt20
-rw-r--r--ext/standard/tests/strings/bug26878.phpt4
-rw-r--r--ext/standard/tests/strings/bug27278.phpt4
-rw-r--r--ext/standard/tests/strings/bug27295.phpt4
-rw-r--r--ext/standard/tests/strings/bug27457.phpt20
-rw-r--r--ext/standard/tests/strings/bug28633.phpt4
-rw-r--r--ext/standard/tests/strings/bug29075.phpt10
-rw-r--r--ext/standard/tests/strings/bug29538.phpt4
-rw-r--r--ext/standard/tests/strings/bug33605.phpt12
-rw-r--r--ext/standard/tests/strings/bug36148.phpt8
-rw-r--r--ext/standard/tests/strings/bug36392.phpt10
-rw-r--r--ext/standard/tests/strings/bug37262.phpt8
-rw-r--r--ext/standard/tests/strings/bug38770.phpt2
-rw-r--r--ext/standard/tests/strings/bug39873.phpt8
-rw-r--r--ext/standard/tests/strings/bug40754.phpt78
-rw-r--r--ext/standard/tests/strings/bug44703.phpt12
-rw-r--r--ext/standard/tests/strings/bug45166.phpt4
-rw-r--r--ext/standard/tests/strings/bug48709.phpt18
-rw-r--r--ext/standard/tests/strings/bug54238.phpt7
-rw-r--r--ext/standard/tests/strings/bug54322.phpt14
-rw-r--r--ext/standard/tests/strings/bug55871.phpt10
-rw-r--r--ext/standard/tests/strings/bug61116.phpt16
-rw-r--r--ext/standard/tests/strings/bug62462.phpt2
-rw-r--r--ext/standard/tests/strings/bug63943.phpt8
-rw-r--r--ext/standard/tests/strings/bug65230.phpt18
-rw-r--r--ext/standard/tests/strings/bug65769.phpt30
-rw-r--r--ext/standard/tests/strings/bug65947.phpt4
-rw-r--r--ext/standard/tests/strings/bug68996.phpt2
-rw-r--r--ext/standard/tests/strings/bug69522.phpt2
-rw-r--r--ext/standard/tests/strings/bug70720.phpt2
-rw-r--r--ext/standard/tests/strings/bug71969.phpt4
-rw-r--r--ext/standard/tests/strings/bug72663_3.phpt8
-rw-r--r--ext/standard/tests/strings/bug72823.phpt2
-rw-r--r--ext/standard/tests/strings/bug77439.phpt9
-rw-r--r--ext/standard/tests/strings/bug78003.phpt2
-rw-r--r--ext/standard/tests/strings/bug78612.phpt2
-rw-r--r--ext/standard/tests/strings/chop_variation3.phptbin1973 -> 1995 bytes
-rw-r--r--ext/standard/tests/strings/chop_variation4.phptbin1836 -> 1930 bytes
-rw-r--r--ext/standard/tests/strings/chr_basic.phpt2
-rw-r--r--ext/standard/tests/strings/chr_error.phptbin823 -> 859 bytes
-rw-r--r--ext/standard/tests/strings/chr_variation1.phpt32
-rw-r--r--ext/standard/tests/strings/chunk_split.phpt13
-rw-r--r--ext/standard/tests/strings/chunk_split_variation1_32bit.phpt26
-rw-r--r--ext/standard/tests/strings/chunk_split_variation2_32bit.phpt25
-rw-r--r--ext/standard/tests/strings/chunk_split_variation3.phpt30
-rw-r--r--ext/standard/tests/strings/chunk_split_variation5.phptbin2279 -> 2206 bytes
-rw-r--r--ext/standard/tests/strings/chunk_split_variation8.phpt28
-rw-r--r--ext/standard/tests/strings/convert_cyr_string.phpt56
-rw-r--r--ext/standard/tests/strings/convert_cyr_string_basic.phpt169
-rw-r--r--ext/standard/tests/strings/convert_cyr_string_error.phpt54
-rw-r--r--ext/standard/tests/strings/convert_uudecode_basic.phpt6
-rw-r--r--ext/standard/tests/strings/convert_uuencode_basic.phpt2
-rw-r--r--ext/standard/tests/strings/count_chars.phpt2
-rw-r--r--ext/standard/tests/strings/count_chars_basic.phpt8
-rw-r--r--ext/standard/tests/strings/crc32.phpt2
-rw-r--r--ext/standard/tests/strings/crc32_variation3.phpt4
-rw-r--r--ext/standard/tests/strings/crc32_variation4.phpt2
-rw-r--r--ext/standard/tests/strings/crypt.phpt8
-rw-r--r--ext/standard/tests/strings/crypt_blowfish.phpt70
-rw-r--r--ext/standard/tests/strings/crypt_sha256.phpt84
-rw-r--r--ext/standard/tests/strings/crypt_sha512.phpt84
-rw-r--r--ext/standard/tests/strings/default_charset.phpt32
-rw-r--r--ext/standard/tests/strings/dirname_error.phpt25
-rw-r--r--ext/standard/tests/strings/dirname_multi.phpt13
-rw-r--r--ext/standard/tests/strings/dirname_multi_win.phpt15
-rw-r--r--ext/standard/tests/strings/explode.phpt56
-rw-r--r--ext/standard/tests/strings/explode1.phpt102
-rw-r--r--ext/standard/tests/strings/explode_variation4.phpt2
-rw-r--r--ext/standard/tests/strings/explode_variation5.phpt2
-rw-r--r--ext/standard/tests/strings/explode_variation6.phpt12
-rw-r--r--ext/standard/tests/strings/fprintf_error.phpt30
-rw-r--r--ext/standard/tests/strings/get_meta_tags.phpt4
-rw-r--r--ext/standard/tests/strings/hebrev_basic.phpt2
-rw-r--r--ext/standard/tests/strings/hebrevc_basic.phpt51
-rw-r--r--ext/standard/tests/strings/highlight_file.phpt20
-rw-r--r--ext/standard/tests/strings/html_entity_decode_html4.phpt504
-rw-r--r--ext/standard/tests/strings/html_entity_decode_html5.phpt4250
-rw-r--r--ext/standard/tests/strings/htmlentities-utf-2.phpt16
-rw-r--r--ext/standard/tests/strings/htmlentities-utf-3.phpt110
-rw-r--r--ext/standard/tests/strings/htmlentities-utf.phpt16
-rw-r--r--ext/standard/tests/strings/htmlentities01.phpt4
-rw-r--r--ext/standard/tests/strings/htmlentities02.phpt4
-rw-r--r--ext/standard/tests/strings/htmlentities03.phpt4
-rw-r--r--ext/standard/tests/strings/htmlentities04.phpt4
-rw-r--r--ext/standard/tests/strings/htmlentities05.phpt6
-rw-r--r--ext/standard/tests/strings/htmlentities06.phpt6
-rw-r--r--ext/standard/tests/strings/htmlentities07.phpt6
-rw-r--r--ext/standard/tests/strings/htmlentities08.phpt6
-rw-r--r--ext/standard/tests/strings/htmlentities09.phpt8
-rw-r--r--ext/standard/tests/strings/htmlentities10.phpt6
-rw-r--r--ext/standard/tests/strings/htmlentities11.phpt4
-rw-r--r--ext/standard/tests/strings/htmlentities12.phpt4
-rw-r--r--ext/standard/tests/strings/htmlentities13.phpt4
-rw-r--r--ext/standard/tests/strings/htmlentities14.phpt4
-rw-r--r--ext/standard/tests/strings/htmlentities16.phpt2
-rw-r--r--ext/standard/tests/strings/htmlentities17.phpt26
-rw-r--r--ext/standard/tests/strings/htmlentities18.phpt24
-rw-r--r--ext/standard/tests/strings/htmlentities19.phpt8
-rw-r--r--ext/standard/tests/strings/htmlentities20.phpt16
-rw-r--r--ext/standard/tests/strings/htmlentities23.phpt4
-rw-r--r--ext/standard/tests/strings/htmlentities24.phpt12
-rw-r--r--ext/standard/tests/strings/htmlentities_html4.phpt32
-rw-r--r--ext/standard/tests/strings/htmlentities_html5.phpt16
-rw-r--r--ext/standard/tests/strings/htmlspecialchars.phpt13
-rw-r--r--ext/standard/tests/strings/htmlspecialchars_basic.phpt2
-rw-r--r--ext/standard/tests/strings/htmlspecialchars_decode_variation6.phptbin1509 -> 1511 bytes
-rw-r--r--ext/standard/tests/strings/implode.phpt2
-rw-r--r--ext/standard/tests/strings/implode1.phptbin6079 -> 6073 bytes
-rw-r--r--ext/standard/tests/strings/join_basic.phpt2
-rw-r--r--ext/standard/tests/strings/join_error.phpt34
-rw-r--r--ext/standard/tests/strings/join_variation1.phpt40
-rw-r--r--ext/standard/tests/strings/join_variation2.phpt108
-rw-r--r--ext/standard/tests/strings/join_variation3.phpt6
-rw-r--r--ext/standard/tests/strings/join_variation4.phptbin2318 -> 2258 bytes
-rw-r--r--ext/standard/tests/strings/join_variation5.phpt30
-rw-r--r--ext/standard/tests/strings/lcfirst.phptbin6304 -> 5452 bytes
-rw-r--r--ext/standard/tests/strings/levenshtein.phpt8
-rw-r--r--ext/standard/tests/strings/ltrim.phpt16
-rw-r--r--ext/standard/tests/strings/ltrim_basic.phpt2
-rw-r--r--ext/standard/tests/strings/ltrim_error.phpt20
-rw-r--r--ext/standard/tests/strings/md5_basic1.phpt2
-rw-r--r--ext/standard/tests/strings/md5_basic2.phpt8
-rw-r--r--ext/standard/tests/strings/md5_file.phptbin2876 -> 2553 bytes
-rw-r--r--ext/standard/tests/strings/metaphone.phpt5
-rw-r--r--ext/standard/tests/strings/money_format_basic1.phpt103
-rw-r--r--ext/standard/tests/strings/money_format_error.phpt69
-rw-r--r--ext/standard/tests/strings/moneyformat.phpt20
-rw-r--r--ext/standard/tests/strings/nl2br.phpt20
-rw-r--r--ext/standard/tests/strings/nl_langinfo_basic.phpt2
-rw-r--r--ext/standard/tests/strings/number_format_basic.phpt40
-rw-r--r--ext/standard/tests/strings/ord_basic.phpt8
-rw-r--r--ext/standard/tests/strings/pack_A.phpt10
-rw-r--r--ext/standard/tests/strings/pack_Z.phpt4
-rw-r--r--ext/standard/tests/strings/parse_str_basic1.phpt16
-rw-r--r--ext/standard/tests/strings/parse_str_basic2.phpt2
-rw-r--r--ext/standard/tests/strings/parse_str_basic3.phptbin5634 -> 4325 bytes
-rw-r--r--ext/standard/tests/strings/parse_str_basic4.phpt2
-rw-r--r--ext/standard/tests/strings/pathinfo.phpt3
-rw-r--r--ext/standard/tests/strings/php_strip_whitespace.phpt18
-rw-r--r--ext/standard/tests/strings/print_basic.phpt2
-rw-r--r--ext/standard/tests/strings/print_variation1.phpt50
-rw-r--r--ext/standard/tests/strings/printf.phpt19
-rw-r--r--ext/standard/tests/strings/printf_64bit.phpt19
-rw-r--r--ext/standard/tests/strings/printf_basic1.phpt2
-rw-r--r--ext/standard/tests/strings/printf_basic2.phpt2
-rw-r--r--ext/standard/tests/strings/printf_basic3.phpt2
-rw-r--r--ext/standard/tests/strings/printf_basic4.phpt2
-rw-r--r--ext/standard/tests/strings/printf_basic5.phpt2
-rw-r--r--ext/standard/tests/strings/printf_basic6.phpt2
-rw-r--r--ext/standard/tests/strings/printf_basic7.phpt2
-rw-r--r--ext/standard/tests/strings/printf_basic8.phpt2
-rw-r--r--ext/standard/tests/strings/printf_basic9.phpt2
-rw-r--r--ext/standard/tests/strings/printf_error.phpt72
-rw-r--r--ext/standard/tests/strings/printf_variation1.phpt168
-rw-r--r--ext/standard/tests/strings/printf_variation2.phpt80
-rw-r--r--ext/standard/tests/strings/quoted_printable_decode_basic.phpt8
-rw-r--r--ext/standard/tests/strings/quoted_printable_encode_001.phpt14
-rw-r--r--ext/standard/tests/strings/quoted_printable_encode_002.phptbin7292 -> 7304 bytes
-rw-r--r--ext/standard/tests/strings/quotemeta_basic.phpt2
-rw-r--r--ext/standard/tests/strings/quotemeta_basic_1.phpt4
-rw-r--r--ext/standard/tests/strings/rtrim.phptbin2446 -> 2107 bytes
-rw-r--r--ext/standard/tests/strings/rtrim_basic.phpt2
-rw-r--r--ext/standard/tests/strings/rtrim_error.phpt20
-rw-r--r--ext/standard/tests/strings/setlocale-win32.phpt2
-rw-r--r--ext/standard/tests/strings/setlocale_error.phpt16
-rw-r--r--ext/standard/tests/strings/setlocale_variation1.phpt2
-rw-r--r--ext/standard/tests/strings/setlocale_variation2.phpt2
-rw-r--r--ext/standard/tests/strings/sha1.phpt20
-rw-r--r--ext/standard/tests/strings/sha1_basic.phpt2
-rw-r--r--ext/standard/tests/strings/sha1_file.phpt22
-rw-r--r--ext/standard/tests/strings/similar_text_basic.phpt2
-rw-r--r--ext/standard/tests/strings/soundex.phpt6
-rw-r--r--ext/standard/tests/strings/soundex_basic.phpt2
-rw-r--r--ext/standard/tests/strings/sprintf_error.phpt70
-rw-r--r--ext/standard/tests/strings/sprintf_variation1.phpt86
-rw-r--r--ext/standard/tests/strings/sprintf_variation18.phpt196
-rw-r--r--ext/standard/tests/strings/sprintf_variation2.phpt22
-rw-r--r--ext/standard/tests/strings/sprintf_variation23.phpt2
-rw-r--r--ext/standard/tests/strings/sprintf_variation36.phpt2
-rw-r--r--ext/standard/tests/strings/sprintf_variation48.phpt2
-rw-r--r--ext/standard/tests/strings/sscanf_basic1.phpt2
-rw-r--r--ext/standard/tests/strings/sscanf_basic2.phpt2
-rw-r--r--ext/standard/tests/strings/sscanf_basic3.phpt2
-rw-r--r--ext/standard/tests/strings/sscanf_basic4.phpt2
-rw-r--r--ext/standard/tests/strings/sscanf_basic5.phpt2
-rw-r--r--ext/standard/tests/strings/sscanf_basic6.phpt2
-rw-r--r--ext/standard/tests/strings/sscanf_basic7.phpt2
-rw-r--r--ext/standard/tests/strings/sscanf_basic8.phpt2
-rw-r--r--ext/standard/tests/strings/sscanf_error.phpt29
-rw-r--r--ext/standard/tests/strings/str_getcsv_002.phpt2
-rw-r--r--ext/standard/tests/strings/str_ireplace.phpt23
-rw-r--r--ext/standard/tests/strings/str_pad.phptbin9812 -> 8552 bytes
-rw-r--r--ext/standard/tests/strings/str_pad_variation1.phpt42
-rw-r--r--ext/standard/tests/strings/str_pad_variation2.phpt70
-rw-r--r--ext/standard/tests/strings/str_pad_variation5.phpt2
-rw-r--r--ext/standard/tests/strings/str_repeat.phptbin16698 -> 3055 bytes
-rw-r--r--ext/standard/tests/strings/str_repeat_variation1.phpt22
-rw-r--r--ext/standard/tests/strings/str_replace.phpt957
-rw-r--r--ext/standard/tests/strings/str_replace_basic.phpt12
-rw-r--r--ext/standard/tests/strings/str_replace_variation1.phpt2
-rw-r--r--ext/standard/tests/strings/str_replace_variation2.phptbin12675 -> 12833 bytes
-rw-r--r--ext/standard/tests/strings/str_replace_variation3.phpt38
-rw-r--r--ext/standard/tests/strings/str_rot13_basic.phpt14
-rw-r--r--ext/standard/tests/strings/str_shuffle_basic.phpt12
-rw-r--r--ext/standard/tests/strings/str_split_variation6.phpt34
-rw-r--r--ext/standard/tests/strings/str_split_variation6_64bit.phpt28
-rw-r--r--ext/standard/tests/strings/str_split_variation7.phpt34
-rw-r--r--ext/standard/tests/strings/str_split_variation7_64bit.phpt28
-rw-r--r--ext/standard/tests/strings/str_word_count.phpt96
-rw-r--r--ext/standard/tests/strings/str_word_count1.phpt30
-rw-r--r--ext/standard/tests/strings/strcasecmp.phptbin21284 -> 20649 bytes
-rw-r--r--ext/standard/tests/strings/strcmp.phptbin19060 -> 18464 bytes
-rw-r--r--ext/standard/tests/strings/strcmp_unterminated.phpt2
-rw-r--r--ext/standard/tests/strings/strcoll.phpt2
-rw-r--r--ext/standard/tests/strings/strcspn_variation10.phpt50
-rw-r--r--ext/standard/tests/strings/strcspn_variation12.phpt24
-rw-r--r--ext/standard/tests/strings/strcspn_variation6.phpt18
-rw-r--r--ext/standard/tests/strings/strcspn_variation7.phpt36
-rw-r--r--ext/standard/tests/strings/strcspn_variation8.phpt40
-rw-r--r--ext/standard/tests/strings/strcspn_variation9.phptbin2534 -> 2628 bytes
-rw-r--r--ext/standard/tests/strings/strip_tags.phpt28
-rw-r--r--ext/standard/tests/strings/stripcslashes_basic.phpt2
-rw-r--r--ext/standard/tests/strings/stripos.phpt81
-rw-r--r--ext/standard/tests/strings/stripos_error.phpt44
-rw-r--r--ext/standard/tests/strings/stripos_variation1.phpt38
-rw-r--r--ext/standard/tests/strings/stripos_variation10.phpt102
-rw-r--r--ext/standard/tests/strings/stripos_variation11.phpt184
-rw-r--r--ext/standard/tests/strings/stripos_variation2.phpt44
-rw-r--r--ext/standard/tests/strings/stripos_variation3.phpt2
-rw-r--r--ext/standard/tests/strings/stripos_variation4.phpt2
-rw-r--r--ext/standard/tests/strings/stripos_variation7.phpt19
-rw-r--r--ext/standard/tests/strings/stripslashes_variation2.phptbin9497 -> 9507 bytes
-rw-r--r--ext/standard/tests/strings/stripslashes_variation3.phpt12
-rw-r--r--ext/standard/tests/strings/stristr.phpt41
-rw-r--r--ext/standard/tests/strings/stristr2.phpt10
-rw-r--r--ext/standard/tests/strings/stristr_basic.phpt2
-rw-r--r--ext/standard/tests/strings/stristr_error.phpt60
-rw-r--r--ext/standard/tests/strings/stristr_variation2.phpt112
-rw-r--r--ext/standard/tests/strings/strlen.phptbin6420 -> 6096 bytes
-rw-r--r--ext/standard/tests/strings/strlen_basic.phpt2
-rw-r--r--ext/standard/tests/strings/strnatcasecmp_basic.phpt4
-rw-r--r--ext/standard/tests/strings/strnatcasecmp_variation1.phpt20
-rw-r--r--ext/standard/tests/strings/strnatcmp_basic.phpt2
-rw-r--r--ext/standard/tests/strings/strncasecmp_error.phpt27
-rw-r--r--ext/standard/tests/strings/strncasecmp_variation9.phpt4
-rw-r--r--ext/standard/tests/strings/strncmp_error.phpt19
-rw-r--r--ext/standard/tests/strings/strpbrk_basic.phpt2
-rw-r--r--ext/standard/tests/strings/strpbrk_error.phpt50
-rw-r--r--ext/standard/tests/strings/strpos.phptbin12013 -> 7996 bytes
-rw-r--r--ext/standard/tests/strings/strpos_number.phpt7
-rw-r--r--ext/standard/tests/strings/strpos_variation1.phpt23
-rw-r--r--ext/standard/tests/strings/strrchr_variation1.phptbin4854 -> 4371 bytes
-rw-r--r--ext/standard/tests/strings/strrchr_variation10.phpt86
-rw-r--r--ext/standard/tests/strings/strrchr_variation11.phpt94
-rw-r--r--ext/standard/tests/strings/strrchr_variation12.phptbin1765 -> 1127 bytes
-rw-r--r--ext/standard/tests/strings/strrchr_variation2.phpt12
-rw-r--r--ext/standard/tests/strings/strrchr_variation8.phpt6
-rw-r--r--ext/standard/tests/strings/strrev.phpt16
-rw-r--r--ext/standard/tests/strings/strripos.phpt34
-rw-r--r--ext/standard/tests/strings/strripos_basic1.phpt2
-rw-r--r--ext/standard/tests/strings/strripos_basic2.phpt2
-rw-r--r--ext/standard/tests/strings/strripos_offset.phpt75
-rw-r--r--ext/standard/tests/strings/strripos_variation1.phpt144
-rw-r--r--ext/standard/tests/strings/strripos_variation2.phpt164
-rw-r--r--ext/standard/tests/strings/strripos_variation3.phpt4
-rw-r--r--ext/standard/tests/strings/strripos_variation4.phpt4
-rw-r--r--ext/standard/tests/strings/strripos_variation5.phpt2
-rw-r--r--ext/standard/tests/strings/strripos_variation6.phpt23
-rw-r--r--ext/standard/tests/strings/strrpos.phpt30
-rw-r--r--ext/standard/tests/strings/strrpos_negative_offset.phpt41
-rw-r--r--ext/standard/tests/strings/strrpos_offset.phpt71
-rw-r--r--ext/standard/tests/strings/strrpos_variation1.phpt38
-rw-r--r--ext/standard/tests/strings/strrpos_variation10.phpt102
-rw-r--r--ext/standard/tests/strings/strrpos_variation11.phpt193
-rw-r--r--ext/standard/tests/strings/strrpos_variation14.phpt23
-rw-r--r--ext/standard/tests/strings/strrpos_variation15.phpt205
-rw-r--r--ext/standard/tests/strings/strrpos_variation2.phpt44
-rw-r--r--ext/standard/tests/strings/strrpos_variation3.phpt2
-rw-r--r--ext/standard/tests/strings/strrpos_variation4.phpt2
-rw-r--r--ext/standard/tests/strings/strrpos_variation7.phpt20
-rw-r--r--ext/standard/tests/strings/strspn_variation10.phpt50
-rw-r--r--ext/standard/tests/strings/strspn_variation11.phpt62
-rw-r--r--ext/standard/tests/strings/strspn_variation12.phpt56
-rw-r--r--ext/standard/tests/strings/strspn_variation6.phpt18
-rw-r--r--ext/standard/tests/strings/strspn_variation7.phpt32
-rw-r--r--ext/standard/tests/strings/strspn_variation8.phpt36
-rw-r--r--ext/standard/tests/strings/strspn_variation9.phptbin2533 -> 2627 bytes
-rw-r--r--ext/standard/tests/strings/strstr.phptbin11493 -> 9512 bytes
-rw-r--r--ext/standard/tests/strings/strstr_variation1.phpt23
-rw-r--r--ext/standard/tests/strings/strtok_variation4.phpt4
-rw-r--r--ext/standard/tests/strings/strtok_variation5.phpt38
-rw-r--r--ext/standard/tests/strings/strtok_variation6.phpt22
-rw-r--r--ext/standard/tests/strings/strtolower-win32.phptbin4875 -> 4406 bytes
-rw-r--r--ext/standard/tests/strings/strtolower.phptbin3886 -> 3417 bytes
-rw-r--r--ext/standard/tests/strings/strtoupper1-win32.phptbin4884 -> 4415 bytes
-rw-r--r--ext/standard/tests/strings/strtoupper1.phptbin3895 -> 3426 bytes
-rw-r--r--ext/standard/tests/strings/strtr_empty_search_string.phpt15
-rw-r--r--ext/standard/tests/strings/strtr_variation6.phpt62
-rw-r--r--ext/standard/tests/strings/strtr_variation8.phpt77
-rw-r--r--ext/standard/tests/strings/strval.phpt2
-rw-r--r--ext/standard/tests/strings/strval_basic.phpt16
-rw-r--r--ext/standard/tests/strings/strval_error.phpt25
-rw-r--r--ext/standard/tests/strings/strval_variation1.phpt70
-rw-r--r--ext/standard/tests/strings/strval_variation2.phpt2
-rw-r--r--ext/standard/tests/strings/substr.phptbin4781 -> 4223 bytes
-rw-r--r--ext/standard/tests/strings/substr_compare.phpt26
-rw-r--r--ext/standard/tests/strings/substr_count_basic.phpt33
-rw-r--r--ext/standard/tests/strings/substr_count_error.phpt38
-rw-r--r--ext/standard/tests/strings/substr_count_variation_001.phpt12
-rw-r--r--ext/standard/tests/strings/substr_replace_error.phpt22
-rw-r--r--ext/standard/tests/strings/trim1.phptbin2045 -> 1538 bytes
-rw-r--r--ext/standard/tests/strings/trim_basic.phpt2
-rw-r--r--ext/standard/tests/strings/trim_error.phpt20
-rw-r--r--ext/standard/tests/strings/ucfirst.phptbin5536 -> 4684 bytes
-rw-r--r--ext/standard/tests/strings/ucwords_basic.phpt2
-rw-r--r--ext/standard/tests/strings/unpack.phpt4
-rw-r--r--ext/standard/tests/strings/unpack_bug68225.phpt2
-rw-r--r--ext/standard/tests/strings/unpack_error.phpt19
-rw-r--r--ext/standard/tests/strings/unpack_offset.phpt4
-rw-r--r--ext/standard/tests/strings/url_t.phpt28
-rw-r--r--ext/standard/tests/strings/uuencode.phpt8
-rw-r--r--ext/standard/tests/strings/vfprintf_basic.phpt14
-rw-r--r--ext/standard/tests/strings/vfprintf_basic1.phpt2
-rw-r--r--ext/standard/tests/strings/vfprintf_basic2.phpt2
-rw-r--r--ext/standard/tests/strings/vfprintf_basic3.phpt2
-rw-r--r--ext/standard/tests/strings/vfprintf_basic4.phpt2
-rw-r--r--ext/standard/tests/strings/vfprintf_basic5.phpt2
-rw-r--r--ext/standard/tests/strings/vfprintf_basic6.phpt2
-rw-r--r--ext/standard/tests/strings/vfprintf_basic7.phpt2
-rw-r--r--ext/standard/tests/strings/vfprintf_basic7_64bit.phpt2
-rw-r--r--ext/standard/tests/strings/vfprintf_basic8.phpt2
-rw-r--r--ext/standard/tests/strings/vfprintf_basic9.phpt2
-rw-r--r--ext/standard/tests/strings/vfprintf_error1.phpt22
-rw-r--r--ext/standard/tests/strings/vfprintf_error3.phpt20
-rw-r--r--ext/standard/tests/strings/vfprintf_error4.phpt23
-rw-r--r--ext/standard/tests/strings/vfprintf_variation1.phpt28
-rw-r--r--ext/standard/tests/strings/vfprintf_variation10.phptbin2958 -> 2936 bytes
-rw-r--r--ext/standard/tests/strings/vfprintf_variation11.phpt2
-rw-r--r--ext/standard/tests/strings/vfprintf_variation11_64bit.phpt2
-rw-r--r--ext/standard/tests/strings/vfprintf_variation12.phpt26
-rw-r--r--ext/standard/tests/strings/vfprintf_variation12_64bit.phpt42
-rw-r--r--ext/standard/tests/strings/vfprintf_variation13.phpt2
-rw-r--r--ext/standard/tests/strings/vfprintf_variation13_64bit.phpt2
-rw-r--r--ext/standard/tests/strings/vfprintf_variation14.phpt26
-rw-r--r--ext/standard/tests/strings/vfprintf_variation14_64bit.phpt42
-rw-r--r--ext/standard/tests/strings/vfprintf_variation15.phpt2
-rw-r--r--ext/standard/tests/strings/vfprintf_variation15_64bit.phpt2
-rw-r--r--ext/standard/tests/strings/vfprintf_variation16.phpt22
-rw-r--r--ext/standard/tests/strings/vfprintf_variation16_64bit.phpt44
-rw-r--r--ext/standard/tests/strings/vfprintf_variation17.phpt2
-rw-r--r--ext/standard/tests/strings/vfprintf_variation18.phpt2
-rw-r--r--ext/standard/tests/strings/vfprintf_variation19.phpt2
-rw-r--r--ext/standard/tests/strings/vfprintf_variation19_64bit.phpt2
-rw-r--r--ext/standard/tests/strings/vfprintf_variation20.phpt90
-rw-r--r--ext/standard/tests/strings/vfprintf_variation21.phpt69
-rw-r--r--ext/standard/tests/strings/vfprintf_variation3.phpt2
-rw-r--r--ext/standard/tests/strings/vfprintf_variation4.phpt2
-rw-r--r--ext/standard/tests/strings/vfprintf_variation4_64bit.phpt55
-rw-r--r--ext/standard/tests/strings/vfprintf_variation5.phpt2
-rw-r--r--ext/standard/tests/strings/vfprintf_variation6.phpt2
-rw-r--r--ext/standard/tests/strings/vfprintf_variation7.phptbin2396 -> 2374 bytes
-rw-r--r--ext/standard/tests/strings/vfprintf_variation8.phpt42
-rw-r--r--ext/standard/tests/strings/vfprintf_variation9.phptbin1858 -> 1836 bytes
-rw-r--r--ext/standard/tests/strings/vprintf_basic1.phpt2
-rw-r--r--ext/standard/tests/strings/vprintf_basic2.phpt2
-rw-r--r--ext/standard/tests/strings/vprintf_basic3.phpt2
-rw-r--r--ext/standard/tests/strings/vprintf_basic4.phpt2
-rw-r--r--ext/standard/tests/strings/vprintf_basic5.phpt2
-rw-r--r--ext/standard/tests/strings/vprintf_basic6.phpt2
-rw-r--r--ext/standard/tests/strings/vprintf_basic7.phpt2
-rw-r--r--ext/standard/tests/strings/vprintf_basic7_64bit.phpt2
-rw-r--r--ext/standard/tests/strings/vprintf_basic8.phpt2
-rw-r--r--ext/standard/tests/strings/vprintf_basic9.phpt2
-rw-r--r--ext/standard/tests/strings/vprintf_variation1.phpt96
-rw-r--r--ext/standard/tests/strings/vprintf_variation10.phptbin2776 -> 2748 bytes
-rw-r--r--ext/standard/tests/strings/vprintf_variation11.phpt2
-rw-r--r--ext/standard/tests/strings/vprintf_variation11_64bit.phpt2
-rw-r--r--ext/standard/tests/strings/vprintf_variation12.phpt36
-rw-r--r--ext/standard/tests/strings/vprintf_variation12_64bit.phpt62
-rw-r--r--ext/standard/tests/strings/vprintf_variation13.phpt2
-rw-r--r--ext/standard/tests/strings/vprintf_variation13_64bit.phpt2
-rw-r--r--ext/standard/tests/strings/vprintf_variation14.phpt36
-rw-r--r--ext/standard/tests/strings/vprintf_variation14_64bit.phpt62
-rw-r--r--ext/standard/tests/strings/vprintf_variation15.phpt2
-rw-r--r--ext/standard/tests/strings/vprintf_variation15_64bit.phpt2
-rw-r--r--ext/standard/tests/strings/vprintf_variation16.phpt30
-rw-r--r--ext/standard/tests/strings/vprintf_variation16_64bit.phpt60
-rw-r--r--ext/standard/tests/strings/vprintf_variation17.phpt2
-rw-r--r--ext/standard/tests/strings/vprintf_variation18.phpt60
-rw-r--r--ext/standard/tests/strings/vprintf_variation19.phpt2
-rw-r--r--ext/standard/tests/strings/vprintf_variation19_64bit.phpt2
-rw-r--r--ext/standard/tests/strings/vprintf_variation2.phpt83
-rw-r--r--ext/standard/tests/strings/vprintf_variation3.phpt2
-rw-r--r--ext/standard/tests/strings/vprintf_variation4.phpt20
-rw-r--r--ext/standard/tests/strings/vprintf_variation4_64bit.phpt60
-rw-r--r--ext/standard/tests/strings/vprintf_variation5.phpt2
-rw-r--r--ext/standard/tests/strings/vprintf_variation6.phpt60
-rw-r--r--ext/standard/tests/strings/vprintf_variation7.phptbin2226 -> 2204 bytes
-rw-r--r--ext/standard/tests/strings/vprintf_variation8.phpt100
-rw-r--r--ext/standard/tests/strings/vprintf_variation9.phptbin1690 -> 1668 bytes
-rw-r--r--ext/standard/tests/strings/vsprintf_variation1.phpt31
-rw-r--r--ext/standard/tests/strings/vsprintf_variation12.phpt24
-rw-r--r--ext/standard/tests/strings/vsprintf_variation12_64bit.phpt50
-rw-r--r--ext/standard/tests/strings/vsprintf_variation14.phpt24
-rw-r--r--ext/standard/tests/strings/vsprintf_variation14_64bit.phpt50
-rw-r--r--ext/standard/tests/strings/vsprintf_variation15.phpt2
-rw-r--r--ext/standard/tests/strings/vsprintf_variation16.phpt20
-rw-r--r--ext/standard/tests/strings/vsprintf_variation16_64bit.phpt50
-rw-r--r--ext/standard/tests/strings/vsprintf_variation2.phpt26
-rw-r--r--ext/standard/tests/strings/vsprintf_variation4.phpt10
-rw-r--r--ext/standard/tests/strings/vsprintf_variation8.phpt92
-rw-r--r--ext/standard/tests/strings/wordwrap.phpt11
-rw-r--r--ext/standard/tests/strings/wordwrap_error.phpt35
-rw-r--r--ext/standard/tests/time/001.phpt16
-rw-r--r--ext/standard/tests/time/bug38524.phpt4
-rw-r--r--ext/standard/tests/time/bug60222.phpt22
-rw-r--r--ext/standard/tests/time/idate.phpt2
-rw-r--r--ext/standard/tests/time/strptime_basic.phpt2
-rw-r--r--ext/standard/tests/time/strptime_error.phpt31
-rw-r--r--ext/standard/tests/time/strptime_parts.phpt2
-rw-r--r--ext/standard/tests/url/base64_decode_basic_002.phpt2
-rw-r--r--ext/standard/tests/url/base64_decode_basic_003.phpt42
-rw-r--r--ext/standard/tests/url/base64_encode_basic_001.phpt6
-rw-r--r--ext/standard/tests/url/base64_encode_basic_002.phpt30
-rw-r--r--ext/standard/tests/url/bug47174.phpt2
-rw-r--r--ext/standard/tests/url/bug52327.phpt4
-rw-r--r--ext/standard/tests/url/bug55273.phpt6
-rw-r--r--ext/standard/tests/url/parse_url_basic_001.phpt42
-rw-r--r--ext/standard/tests/url/parse_url_basic_002.phpt4
-rw-r--r--ext/standard/tests/url/parse_url_basic_003.phpt4
-rw-r--r--ext/standard/tests/url/parse_url_basic_004.phpt4
-rw-r--r--ext/standard/tests/url/parse_url_basic_005.phpt4
-rw-r--r--ext/standard/tests/url/parse_url_basic_006.phpt4
-rw-r--r--ext/standard/tests/url/parse_url_basic_007.phpt4
-rw-r--r--ext/standard/tests/url/parse_url_basic_008.phpt20
-rw-r--r--ext/standard/tests/url/parse_url_basic_009.phpt8
-rw-r--r--ext/standard/tests/url/parse_url_basic_010.phpt6
-rw-r--r--ext/standard/tests/url/parse_url_error_002.phpt11
-rw-r--r--ext/standard/tests/url/parse_url_unterminated.phpt44
-rw-r--r--ext/standard/tests/versioning/version_compare.phpt22
-rw-r--r--ext/standard/tests/versioning/version_compare_invalid_operator.phpt10
-rw-r--r--ext/standard/type.c28
-rw-r--r--ext/standard/uniqid.c2
-rw-r--r--ext/standard/uniqid.h2
-rw-r--r--ext/standard/url.c12
-rw-r--r--ext/standard/url.h2
-rw-r--r--ext/standard/url_scanner_ex.h2
-rw-r--r--ext/standard/url_scanner_ex.re2
-rw-r--r--ext/standard/user_filters.c71
-rw-r--r--ext/standard/uuencode.c10
-rw-r--r--ext/standard/var.c45
-rw-r--r--ext/standard/var_unserializer.re9
-rw-r--r--ext/standard/versioning.c7
-rw-r--r--ext/sysvmsg/php_sysvmsg.h2
-rw-r--r--ext/sysvmsg/sysvmsg.c77
-rw-r--r--ext/sysvmsg/sysvmsg.stub.php29
-rw-r--r--ext/sysvmsg/sysvmsg_arginfo.h43
-rw-r--r--ext/sysvmsg/tests/001.phpt6
-rw-r--r--ext/sysvmsg/tests/002.phpt8
-rw-r--r--ext/sysvmsg/tests/005.phpt29
-rw-r--r--ext/sysvmsg/tests/006.phpt4
-rw-r--r--ext/sysvsem/php_sysvsem.h2
-rw-r--r--ext/sysvsem/sysvsem.c55
-rw-r--r--ext/sysvsem/sysvsem.stub.php22
-rw-r--r--ext/sysvsem/sysvsem_arginfo.h19
-rw-r--r--ext/sysvsem/tests/nowait.phpt116
-rw-r--r--ext/sysvsem/tests/sysv.phpt52
-rw-r--r--ext/sysvshm/php_sysvshm.h2
-rw-r--r--ext/sysvshm/sysvshm.c74
-rw-r--r--ext/sysvshm/sysvshm.stub.php35
-rw-r--r--ext/sysvshm/sysvshm_arginfo.h31
-rw-r--r--ext/sysvshm/tests/001.phpt13
-rw-r--r--ext/sysvshm/tests/002.phpt23
-rw-r--r--ext/sysvshm/tests/003.phpt42
-rw-r--r--ext/sysvshm/tests/004.phpt13
-rw-r--r--ext/sysvshm/tests/005.phpt18
-rw-r--r--ext/sysvshm/tests/006.phpt16
-rw-r--r--ext/sysvshm/tests/007.phpt28
-rw-r--r--ext/sysvshm/tests/bug72858.phpt4
-rw-r--r--ext/tidy/php_tidy.h2
-rw-r--r--ext/tidy/tests/002.phpt4
-rw-r--r--ext/tidy/tests/003.phpt6
-rw-r--r--ext/tidy/tests/005-mb.phpt4
-rw-r--r--ext/tidy/tests/005.phpt4
-rw-r--r--ext/tidy/tests/006.phpt4
-rw-r--r--ext/tidy/tests/007.phpt18
-rw-r--r--ext/tidy/tests/008.phpt4
-rw-r--r--ext/tidy/tests/009.phpt2
-rw-r--r--ext/tidy/tests/011.phpt2
-rw-r--r--ext/tidy/tests/012.phpt2
-rw-r--r--ext/tidy/tests/014.phpt6
-rw-r--r--ext/tidy/tests/015.phpt4
-rw-r--r--ext/tidy/tests/018.phpt8
-rw-r--r--ext/tidy/tests/019.phpt13
-rw-r--r--ext/tidy/tests/029.phpt10
-rw-r--r--ext/tidy/tidy.c261
-rw-r--r--ext/tidy/tidy.stub.php128
-rw-r--r--ext/tidy/tidy_arginfo.h182
-rw-r--r--ext/tokenizer/php_tokenizer.h2
-rw-r--r--ext/tokenizer/tests/001.phpt8
-rw-r--r--ext/tokenizer/tests/002.phpt12
-rw-r--r--ext/tokenizer/tests/003.phpt7
-rw-r--r--ext/tokenizer/tests/bad_character.phpt10
-rw-r--r--ext/tokenizer/tests/bug54089.phpt28
-rw-r--r--ext/tokenizer/tests/token_get_all_basic.phpt2
-rw-r--r--ext/tokenizer/tests/token_get_all_variation10.phpt2
-rw-r--r--ext/tokenizer/tests/token_get_all_variation11.phpt111
-rw-r--r--ext/tokenizer/tests/token_get_all_variation12.phpt43
-rw-r--r--ext/tokenizer/tests/token_get_all_variation13.phpt8
-rw-r--r--ext/tokenizer/tests/token_get_all_variation14.phpt75
-rw-r--r--ext/tokenizer/tests/token_get_all_variation15.phpt10
-rw-r--r--ext/tokenizer/tests/token_get_all_variation16.phpt2
-rw-r--r--ext/tokenizer/tests/token_get_all_variation17.phpt2
-rw-r--r--ext/tokenizer/tests/token_get_all_variation18.phpt20
-rw-r--r--ext/tokenizer/tests/token_get_all_variation19.phpt40
-rw-r--r--ext/tokenizer/tests/token_get_all_variation2.phpt2
-rw-r--r--ext/tokenizer/tests/token_get_all_variation3.phpt2
-rw-r--r--ext/tokenizer/tests/token_get_all_variation4.phpt197
-rw-r--r--ext/tokenizer/tests/token_get_all_variation5.phpt201
-rw-r--r--ext/tokenizer/tests/token_get_all_variation6.phpt2
-rw-r--r--ext/tokenizer/tests/token_get_all_variation7.phpt75
-rw-r--r--ext/tokenizer/tests/token_get_all_variation8.phpt229
-rw-r--r--ext/tokenizer/tests/token_get_all_variation9.phpt123
-rw-r--r--ext/tokenizer/tokenizer.c14
-rw-r--r--ext/tokenizer/tokenizer.stub.php5
-rw-r--r--ext/tokenizer/tokenizer_arginfo.h10
-rw-r--r--ext/tokenizer/tokenizer_data.c2
-rwxr-xr-xext/tokenizer/tokenizer_data_gen.sh2
-rw-r--r--ext/xml/compat.c2
-rw-r--r--ext/xml/expat_compat.h2
-rw-r--r--ext/xml/php_xml.h2
-rw-r--r--ext/xml/tests/bug25666.phpt4
-rw-r--r--ext/xml/tests/bug26528.phpt10
-rw-r--r--ext/xml/tests/bug26614.phpt30
-rw-r--r--ext/xml/tests/bug26614_libxml.phpt38
-rw-r--r--ext/xml/tests/bug30266.phpt4
-rw-r--r--ext/xml/tests/bug30875.phpt2
-rw-r--r--ext/xml/tests/bug32001.phpt236
-rw-r--r--ext/xml/tests/bug32001b.phpt128
-rw-r--r--ext/xml/tests/bug35447.phpt2
-rw-r--r--ext/xml/tests/bug71592.phpt2
-rw-r--r--ext/xml/tests/bug72085.phpt2
-rw-r--r--ext/xml/tests/bug72714.phpt2
-rw-r--r--ext/xml/tests/bug72793.phpt35
-rw-r--r--ext/xml/tests/bug76874.phpt31
-rw-r--r--ext/xml/tests/bug78563.phpt17
-rw-r--r--ext/xml/tests/bug78563_final.phpt15
-rw-r--r--ext/xml/tests/bug78563_serialize.phpt18
-rw-r--r--ext/xml/tests/xml001.phpt42
-rw-r--r--ext/xml/tests/xml002.phpt80
-rw-r--r--ext/xml/tests/xml003.phpt80
-rw-r--r--ext/xml/tests/xml004.phpt18
-rw-r--r--ext/xml/tests/xml007.phpt4
-rw-r--r--ext/xml/tests/xml009.phpt6
-rw-r--r--ext/xml/tests/xml010.phpt4
-rw-r--r--ext/xml/tests/xml_closures_001.phpt16
-rw-r--r--ext/xml/tests/xml_parser_set_option_variation3.phpt15
-rw-r--r--ext/xml/tests/xml_set_notation_decl_handler_basic.phpt36
-rw-r--r--ext/xml/tests/xml_set_processing_instruction_handler_basic.phpt8
-rw-r--r--ext/xml/tests/xml_set_start_namespace_decl_handler_basic.phpt10
-rw-r--r--ext/xml/xml.c397
-rw-r--r--ext/xml/xml.stub.php57
-rw-r--r--ext/xml/xml_arginfo.h82
-rw-r--r--ext/xmlreader/php_xmlreader.c290
-rw-r--r--ext/xmlreader/php_xmlreader.h2
-rw-r--r--ext/xmlreader/tests/001.phpt4
-rw-r--r--ext/xmlreader/tests/002.phpt8
-rw-r--r--ext/xmlreader/tests/003-get-errors.phpt2
-rw-r--r--ext/xmlreader/tests/003-mb.phpt82
-rw-r--r--ext/xmlreader/tests/003-move-errors.phpt2
-rw-r--r--ext/xmlreader/tests/003.phpt112
-rw-r--r--ext/xmlreader/tests/004.phpt26
-rw-r--r--ext/xmlreader/tests/005.phpt6
-rw-r--r--ext/xmlreader/tests/006.phpt18
-rw-r--r--ext/xmlreader/tests/007.phpt4
-rw-r--r--ext/xmlreader/tests/008.phpt6
-rw-r--r--ext/xmlreader/tests/009.phpt2
-rw-r--r--ext/xmlreader/tests/010.phpt2
-rw-r--r--ext/xmlreader/tests/011.phpt2
-rw-r--r--ext/xmlreader/tests/012.phpt6
-rw-r--r--ext/xmlreader/tests/013.phpt10
-rw-r--r--ext/xmlreader/tests/014.phpt2
-rw-r--r--ext/xmlreader/tests/015-get-errors.phpt2
-rw-r--r--ext/xmlreader/tests/015-move-errors.phpt2
-rw-r--r--ext/xmlreader/tests/015.phpt2
-rw-r--r--ext/xmlreader/tests/bug64230.phpt8
-rw-r--r--ext/xmlreader/tests/bug71805.phpt42
-rw-r--r--ext/xmlreader/tests/bug73053.phpt2
-rw-r--r--ext/xmlreader/tests/bug74457.phpt2
-rw-r--r--ext/xmlreader/tests/expand.phpt2
-rw-r--r--ext/xmlreader/tests/static.phpt33
-rw-r--r--ext/xmlreader/xmlreader.stub.php79
-rw-r--r--ext/xmlreader/xmlreader_arginfo.h82
-rw-r--r--ext/xmlrpc/libxmlrpc/xml_element.h2
-rw-r--r--ext/xmlrpc/php_xmlrpc.h2
-rw-r--r--ext/xmlrpc/tests/001.phpt4
-rw-r--r--ext/xmlrpc/tests/002.phpt8
-rw-r--r--ext/xmlrpc/tests/003.phpt18
-rw-r--r--ext/xmlrpc/tests/bug42736.phpt12
-rw-r--r--ext/xmlrpc/tests/bug45556.phpt8
-rw-r--r--ext/xmlrpc/tests/bug72155.phpt4
-rw-r--r--ext/xmlrpc/xmlrpc-epi-php.c115
-rw-r--r--ext/xmlrpc/xmlrpc.stub.php33
-rw-r--r--ext/xmlrpc/xmlrpc_arginfo.h65
-rw-r--r--ext/xmlwriter/php_xmlwriter.c1055
-rw-r--r--ext/xmlwriter/php_xmlwriter.h12
-rw-r--r--ext/xmlwriter/tests/001.phpt2
-rw-r--r--ext/xmlwriter/tests/002.phpt2
-rw-r--r--ext/xmlwriter/tests/003.phpt6
-rw-r--r--ext/xmlwriter/tests/004.phpt6
-rw-r--r--ext/xmlwriter/tests/005-mb.phpt2
-rw-r--r--ext/xmlwriter/tests/005.phpt2
-rw-r--r--ext/xmlwriter/tests/OO_001.phpt2
-rw-r--r--ext/xmlwriter/tests/OO_002.phpt2
-rw-r--r--ext/xmlwriter/tests/OO_003.phpt6
-rw-r--r--ext/xmlwriter/tests/OO_004.phpt6
-rw-r--r--ext/xmlwriter/tests/OO_005.phpt2
-rw-r--r--ext/xmlwriter/tests/bug41326.phpt2
-rw-r--r--ext/xmlwriter/tests/xmlwriter_set_indent_string_basic_001.phpt6
-rw-r--r--ext/xmlwriter/xmlwriter.stub.php172
-rw-r--r--ext/xmlwriter/xmlwriter_arginfo.h336
-rw-r--r--ext/xsl/php_xsl.c2
-rw-r--r--ext/xsl/php_xsl.h2
-rw-r--r--ext/xsl/tests/bug49634.phpt30
-rw-r--r--ext/xsl/tests/bug54446.phpt18
-rw-r--r--ext/xsl/tests/bug54446_with_ini.phpt18
-rw-r--r--ext/xsl/tests/bug71540.phpt6
-rw-r--r--ext/xsl/tests/xslt012.phpt6
-rw-r--r--ext/xsl/xsl_fe.h2
-rw-r--r--ext/xsl/xsltprocessor.c34
-rw-r--r--ext/zend_test/php_test.h2
-rw-r--r--ext/zend_test/test.c93
-rw-r--r--ext/zip/config.m425
-rw-r--r--ext/zip/config.w322
-rw-r--r--ext/zip/php_zip.c716
-rw-r--r--ext/zip/php_zip.h10
-rw-r--r--ext/zip/php_zip.stub.php186
-rw-r--r--ext/zip/php_zip_arginfo.h260
-rw-r--r--ext/zip/tests/bug14962.phpt6
-rw-r--r--ext/zip/tests/bug38943.inc14
-rw-r--r--ext/zip/tests/bug38943.phpt14
-rw-r--r--ext/zip/tests/bug40228-mb.phpt8
-rw-r--r--ext/zip/tests/bug40228.phpt8
-rw-r--r--ext/zip/tests/bug47667.phpt20
-rw-r--r--ext/zip/tests/bug49072.phpt4
-rw-r--r--ext/zip/tests/bug51353.phpt22
-rw-r--r--ext/zip/tests/bug53579.phpt2
-rw-r--r--ext/zip/tests/bug53603.phpt16
-rw-r--r--ext/zip/tests/bug64342_0.phpt30
-rw-r--r--ext/zip/tests/bug64342_1-mb.phpt28
-rw-r--r--ext/zip/tests/bug64342_1.phpt28
-rw-r--r--ext/zip/tests/bug70752.phpt2
-rw-r--r--ext/zip/tests/bug7214.phpt4
-rw-r--r--ext/zip/tests/bug72258.phpt8
-rw-r--r--ext/zip/tests/bug72374.phpt32
-rw-r--r--ext/zip/tests/bug76524.phpt2
-rw-r--r--ext/zip/tests/bug7658.phpt36
-rw-r--r--ext/zip/tests/bug8700.phpt4
-rw-r--r--ext/zip/tests/doubleclose.phpt30
-rw-r--r--ext/zip/tests/oo_addemptydir.phpt28
-rw-r--r--ext/zip/tests/oo_addemptydir_error.phpt8
-rw-r--r--ext/zip/tests/oo_addfile.phpt30
-rw-r--r--ext/zip/tests/oo_addpattern.phpt6
-rw-r--r--ext/zip/tests/oo_cancel.phpt39
-rw-r--r--ext/zip/tests/oo_close.phpt8
-rw-r--r--ext/zip/tests/oo_count.phpt2
-rw-r--r--ext/zip/tests/oo_delete.phpt32
-rw-r--r--ext/zip/tests/oo_encryption.phpt4
-rw-r--r--ext/zip/tests/oo_ext_zip.phpt14
-rw-r--r--ext/zip/tests/oo_extract.phpt32
-rw-r--r--ext/zip/tests/oo_getcomment.phpt6
-rw-r--r--ext/zip/tests/oo_getnameindex.phpt10
-rw-r--r--ext/zip/tests/oo_namelocate.phpt10
-rw-r--r--ext/zip/tests/oo_open.phpt14
-rw-r--r--ext/zip/tests/oo_progress.phpt40
-rw-r--r--ext/zip/tests/oo_properties.phpt4
-rw-r--r--ext/zip/tests/oo_rename.phpt24
-rw-r--r--ext/zip/tests/oo_setcomment.phpt8
-rw-r--r--ext/zip/tests/oo_setcomment_error.phpt4
-rw-r--r--ext/zip/tests/oo_setcompression.phpt10
-rw-r--r--ext/zip/tests/oo_setmtime.phpt76
-rw-r--r--ext/zip/tests/oo_stream.phpt4
-rw-r--r--ext/zip/tests/pecl12414.phpt28
-rw-r--r--ext/zip/tests/stream_meta_data.phpt2
-rw-r--r--ext/zip/tests/utils.inc28
-rw-r--r--ext/zip/tests/zip_entry_close.phpt12
-rw-r--r--ext/zip/tests/zip_open_error.phpt7
-rw-r--r--ext/zip/zip_stream.c2
-rw-r--r--ext/zlib/php_zlib.h2
-rw-r--r--ext/zlib/tests/004-mb.phpt10
-rw-r--r--ext/zlib/tests/004.phpt10
-rw-r--r--ext/zlib/tests/005.phpt38
-rw-r--r--ext/zlib/tests/006.phpt31
-rw-r--r--ext/zlib/tests/007.phpt49
-rw-r--r--ext/zlib/tests/bug60761.phpt12
-rw-r--r--ext/zlib/tests/bug67724.phpt4
-rw-r--r--ext/zlib/tests/bug71417.phpt40
-rw-r--r--ext/zlib/tests/bug75273.phpt62
-rw-r--r--ext/zlib/tests/bug75299.phpt2
-rw-r--r--ext/zlib/tests/bug_34821.phpt20
-rw-r--r--ext/zlib/tests/deflate_add_block_v123.phpt2
-rw-r--r--ext/zlib/tests/deflate_add_buffer_full.phpt2
-rw-r--r--ext/zlib/tests/deflate_add_error.phpt24
-rw-r--r--ext/zlib/tests/deflate_init_error.phpt51
-rw-r--r--ext/zlib/tests/dictionary_usage.phpt2
-rw-r--r--ext/zlib/tests/func.inc22
-rw-r--r--ext/zlib/tests/gzclose_basic.phpt22
-rw-r--r--ext/zlib/tests/gzcompress_basic1.phpt6
-rw-r--r--ext/zlib/tests/gzcompress_error1.phpt62
-rw-r--r--ext/zlib/tests/gzcompress_variation1.phpt2
-rw-r--r--ext/zlib/tests/gzdeflate_basic1.phpt6
-rw-r--r--ext/zlib/tests/gzdeflate_error1.phpt62
-rw-r--r--ext/zlib/tests/gzdeflate_variation1.phpt2
-rw-r--r--ext/zlib/tests/gzencode_basic1.phpt6
-rw-r--r--ext/zlib/tests/gzencode_error1.phpt71
-rw-r--r--ext/zlib/tests/gzencode_variation1-win32.phpt10
-rw-r--r--ext/zlib/tests/gzencode_variation1.phpt2
-rw-r--r--ext/zlib/tests/gzencode_variation2-win32.phpt2
-rw-r--r--ext/zlib/tests/gzencode_variation2.phpt2
-rw-r--r--ext/zlib/tests/gzeof_basic.phpt2
-rw-r--r--ext/zlib/tests/gzeof_variation1.phpt14
-rw-r--r--ext/zlib/tests/gzfile_basic.phpt2
-rw-r--r--ext/zlib/tests/gzfile_basic2.phpt2
-rw-r--r--ext/zlib/tests/gzfile_variation11.phpt2
-rw-r--r--ext/zlib/tests/gzfile_variation12.phpt2
-rw-r--r--ext/zlib/tests/gzfile_variation15.phpt2
-rw-r--r--ext/zlib/tests/gzfile_variation3.phpt2
-rw-r--r--ext/zlib/tests/gzfile_variation4.phpt12
-rw-r--r--ext/zlib/tests/gzfile_variation5.phpt10
-rw-r--r--ext/zlib/tests/gzfile_variation7.phpt10
-rw-r--r--ext/zlib/tests/gzfile_variation9.phpt2
-rw-r--r--ext/zlib/tests/gzgetc_basic.phpt2
-rw-r--r--ext/zlib/tests/gzgetc_basic_1.phpt16
-rw-r--r--ext/zlib/tests/gzgets_basic.phpt2
-rw-r--r--ext/zlib/tests/gzgetss.phpt32
-rw-r--r--ext/zlib/tests/gzinflate_error1.phpt42
-rw-r--r--ext/zlib/tests/gzopen_basic.phpt2
-rw-r--r--ext/zlib/tests/gzopen_basic2.phpt4
-rw-r--r--ext/zlib/tests/gzopen_include_path.inc112
-rw-r--r--ext/zlib/tests/gzopen_variation4.phpt168
-rw-r--r--ext/zlib/tests/gzopen_variation5.phpt46
-rw-r--r--ext/zlib/tests/gzopen_variation6.phpt2
-rw-r--r--ext/zlib/tests/gzopen_variation7.phpt2
-rw-r--r--ext/zlib/tests/gzopen_variation8.phpt2
-rw-r--r--ext/zlib/tests/gzopen_variation9.phpt8
-rw-r--r--ext/zlib/tests/gzpassthru_basic.phpt2
-rw-r--r--ext/zlib/tests/gzputs_basic.phpt2
-rw-r--r--ext/zlib/tests/gzread_basic.phpt2
-rw-r--r--ext/zlib/tests/gzread_error2.phpt24
-rw-r--r--ext/zlib/tests/gzread_variation1.phpt2
-rw-r--r--ext/zlib/tests/gzreadgzwrite.phpt8
-rw-r--r--ext/zlib/tests/gzreadgzwriteplain.phpt16
-rw-r--r--ext/zlib/tests/gzrewind_basic.phpt2
-rw-r--r--ext/zlib/tests/gzrewind_basic2.phpt2
-rw-r--r--ext/zlib/tests/gzrewind_variation1.phpt2
-rw-r--r--ext/zlib/tests/gzseek_basic.phpt2
-rw-r--r--ext/zlib/tests/gzseek_basic2.phpt2
-rw-r--r--ext/zlib/tests/gzseek_variation1.phpt2
-rw-r--r--ext/zlib/tests/gzseek_variation2.phpt2
-rw-r--r--ext/zlib/tests/gzseek_variation3.phpt2
-rw-r--r--ext/zlib/tests/gzseek_variation4.phpt2
-rw-r--r--ext/zlib/tests/gzseek_variation5.phpt2
-rw-r--r--ext/zlib/tests/gzseek_variation6.phpt2
-rw-r--r--ext/zlib/tests/gzseek_variation7.phpt2
-rw-r--r--ext/zlib/tests/gztell_basic.phpt2
-rw-r--r--ext/zlib/tests/gztell_basic2.phpt2
-rw-r--r--ext/zlib/tests/gzuncompress_basic1.phpt2
-rw-r--r--ext/zlib/tests/gzuncompress_error1.phpt41
-rw-r--r--ext/zlib/tests/gzwrite_basic.phpt2
-rw-r--r--ext/zlib/tests/gzwrite_error2.phpt2
-rw-r--r--ext/zlib/tests/gzwrite_variation1.phpt2
-rw-r--r--ext/zlib/tests/inflate_add_error.phpt24
-rw-r--r--ext/zlib/tests/inflate_init_error.phpt17
-rw-r--r--ext/zlib/tests/ob_gzhandler_legacy_002.phpt4
-rw-r--r--ext/zlib/tests/readgzfile_basic.phpt2
-rw-r--r--ext/zlib/tests/readgzfile_basic2.phpt2
-rw-r--r--ext/zlib/tests/readgzfile_variation10.phpt67
-rw-r--r--ext/zlib/tests/readgzfile_variation11.phpt2
-rw-r--r--ext/zlib/tests/readgzfile_variation12.phpt2
-rw-r--r--ext/zlib/tests/readgzfile_variation15.phpt2
-rw-r--r--ext/zlib/tests/readgzfile_variation3.phpt2
-rw-r--r--ext/zlib/tests/readgzfile_variation4.phpt12
-rw-r--r--ext/zlib/tests/readgzfile_variation5.phpt10
-rw-r--r--ext/zlib/tests/readgzfile_variation7.phpt10
-rw-r--r--ext/zlib/tests/readgzfile_variation9.phpt2
-rw-r--r--ext/zlib/tests/zlib_scheme_copy_basic.phpt2
-rw-r--r--ext/zlib/tests/zlib_scheme_copy_variation1.phpt2
-rw-r--r--ext/zlib/tests/zlib_scheme_copy_variation2.phpt2
-rw-r--r--ext/zlib/tests/zlib_scheme_dir_basic.phpt4
-rw-r--r--ext/zlib/tests/zlib_scheme_file_basic.phpt2
-rw-r--r--ext/zlib/tests/zlib_scheme_file_get_contents_basic.phpt2
-rw-r--r--ext/zlib/tests/zlib_scheme_file_put_contents_basic.phpt2
-rw-r--r--ext/zlib/tests/zlib_scheme_file_read_file_basic.phpt2
-rw-r--r--ext/zlib/tests/zlib_scheme_fopen_basic.phpt2
-rw-r--r--ext/zlib/tests/zlib_scheme_fopen_variation1.phpt2
-rw-r--r--ext/zlib/tests/zlib_scheme_rename_basic.phpt2
-rw-r--r--ext/zlib/tests/zlib_scheme_stat_basic.phpt2
-rw-r--r--ext/zlib/tests/zlib_scheme_stat_basic2.phpt2
-rw-r--r--ext/zlib/tests/zlib_scheme_unlink_basic.phpt2
-rw-r--r--ext/zlib/tests/zlib_wrapper_fflush_basic.phpt2
-rw-r--r--ext/zlib/tests/zlib_wrapper_flock_basic.phpt2
-rw-r--r--ext/zlib/tests/zlib_wrapper_fstat_basic.phpt2
-rw-r--r--ext/zlib/tests/zlib_wrapper_ftruncate_basic.phpt2
-rw-r--r--ext/zlib/tests/zlib_wrapper_meta_data_basic.phpt2
-rw-r--r--ext/zlib/zlib.c278
-rw-r--r--ext/zlib/zlib.stub.php79
-rw-r--r--ext/zlib/zlib_arginfo.h121
-rw-r--r--ext/zlib/zlib_filter.c2
-rw-r--r--ext/zlib/zlib_fopen_wrapper.c4
-rw-r--r--main/SAPI.c4
-rw-r--r--main/SAPI.h2
-rw-r--r--main/build-defs.h.in2
-rw-r--r--main/explicit_bzero.c2
-rw-r--r--main/fastcgi.c2
-rw-r--r--main/fastcgi.h2
-rw-r--r--main/fopen_wrappers.c2
-rw-r--r--main/fopen_wrappers.h2
-rw-r--r--main/getopt.c2
-rw-r--r--main/http_status_codes.h2
-rw-r--r--main/internal_functions.c.in2
-rw-r--r--main/internal_functions_win32.c2
-rw-r--r--main/main.c47
-rw-r--r--main/network.c10
-rw-r--r--main/output.c72
-rw-r--r--main/php.h5
-rw-r--r--main/php_compat.h2
-rw-r--r--main/php_content_types.c2
-rw-r--r--main/php_content_types.h2
-rw-r--r--main/php_getopt.h2
-rw-r--r--main/php_globals.h3
-rw-r--r--main/php_ini.c2
-rw-r--r--main/php_ini.h2
-rw-r--r--main/php_main.h2
-rw-r--r--main/php_memory_streams.h2
-rw-r--r--main/php_network.h2
-rw-r--r--main/php_open_temporary_file.c2
-rw-r--r--main/php_open_temporary_file.h2
-rw-r--r--main/php_output.h2
-rw-r--r--main/php_reentrancy.h2
-rw-r--r--main/php_scandir.c2
-rw-r--r--main/php_scandir.h2
-rw-r--r--main/php_stdint.h2
-rw-r--r--main/php_streams.h6
-rw-r--r--main/php_syslog.c2
-rw-r--r--main/php_syslog.h2
-rw-r--r--main/php_ticks.c2
-rw-r--r--main/php_ticks.h2
-rw-r--r--main/php_variables.c14
-rw-r--r--main/php_variables.h2
-rw-r--r--main/php_version.h10
-rw-r--r--main/reentrancy.c2
-rw-r--r--main/rfc1867.c4
-rw-r--r--main/rfc1867.h2
-rw-r--r--main/snprintf.c22
-rw-r--r--main/snprintf.h2
-rw-r--r--main/spprintf.c22
-rw-r--r--main/spprintf.h2
-rw-r--r--main/streams/cast.c6
-rw-r--r--main/streams/filter.c6
-rw-r--r--main/streams/glob_wrapper.c2
-rw-r--r--main/streams/memory.c2
-rw-r--r--main/streams/mmap.c2
-rw-r--r--main/streams/php_stream_context.h2
-rw-r--r--main/streams/php_stream_filter_api.h2
-rw-r--r--main/streams/php_stream_glob_wrapper.h2
-rw-r--r--main/streams/php_stream_mmap.h2
-rw-r--r--main/streams/php_stream_plain_wrapper.h2
-rw-r--r--main/streams/php_stream_transport.h2
-rw-r--r--main/streams/php_stream_userspace.h2
-rw-r--r--main/streams/php_streams_int.h2
-rw-r--r--main/streams/plain_wrapper.c16
-rw-r--r--main/streams/streams.c21
-rw-r--r--main/streams/transports.c10
-rw-r--r--main/streams/userspace.c10
-rw-r--r--main/streams/xp_socket.c4
-rw-r--r--main/strlcat.c2
-rw-r--r--main/strlcpy.c2
-rw-r--r--php.ini-development48
-rw-r--r--php.ini-production48
-rwxr-xr-xrun-tests.php87
-rw-r--r--sapi/apache2handler/apache_config.c2
-rw-r--r--sapi/apache2handler/config.m412
-rw-r--r--sapi/apache2handler/config.w326
-rw-r--r--sapi/apache2handler/mod_php.c32
-rw-r--r--sapi/apache2handler/mod_php7.c34
-rw-r--r--sapi/apache2handler/php.sym2
-rw-r--r--sapi/apache2handler/php_apache.h6
-rw-r--r--sapi/apache2handler/php_functions.c75
-rw-r--r--sapi/apache2handler/php_functions.stub.php21
-rw-r--r--sapi/apache2handler/php_functions_arginfo.h37
-rw-r--r--sapi/apache2handler/sapi_apache2.c8
-rw-r--r--sapi/cgi/cgi_main.c17
-rw-r--r--sapi/cgi/config9.m42
-rw-r--r--sapi/cgi/tests/003.phpt10
-rw-r--r--sapi/cgi/tests/004.phpt6
-rw-r--r--sapi/cgi/tests/006.phpt10
-rw-r--r--sapi/cgi/tests/007.phpt2
-rw-r--r--sapi/cgi/tests/008.phpt10
-rw-r--r--sapi/cgi/tests/011.phpt14
-rw-r--r--sapi/cgi/tests/apache_request_headers.phpt6
-rw-r--r--sapi/cgi/tests/apache_response_headers.phpt2
-rw-r--r--sapi/cgi/tests/bug75574_utf8.phpt2
-rw-r--r--sapi/cgi/tests/include.inc96
-rw-r--r--sapi/cgi/tests/skipif.inc4
-rw-r--r--sapi/cli/cli.h2
-rw-r--r--sapi/cli/config.m42
-rwxr-xr-xsapi/cli/generate_mime_type_map.php2
-rw-r--r--sapi/cli/mime_type_map.h2
-rw-r--r--sapi/cli/php_cli.c8
-rw-r--r--sapi/cli/php_cli_process_title.c6
-rw-r--r--sapi/cli/php_cli_process_title.h2
-rw-r--r--sapi/cli/php_cli_server.c10
-rw-r--r--sapi/cli/php_cli_server.h2
-rw-r--r--sapi/cli/php_http_parser.h2
-rw-r--r--sapi/cli/ps_title.h2
-rw-r--r--sapi/cli/tests/003-2.phpt2
-rw-r--r--sapi/cli/tests/004.phpt5
-rw-r--r--sapi/cli/tests/005.phpt38
-rw-r--r--sapi/cli/tests/006.phpt58
-rw-r--r--sapi/cli/tests/007.phpt10
-rw-r--r--sapi/cli/tests/008.phpt2
-rw-r--r--sapi/cli/tests/010.phpt2
-rw-r--r--sapi/cli/tests/011.phpt6
-rw-r--r--sapi/cli/tests/014.phpt10
-rw-r--r--sapi/cli/tests/016.phpt6
-rw-r--r--sapi/cli/tests/017.phpt6
-rw-r--r--sapi/cli/tests/022.phpt12
-rw-r--r--sapi/cli/tests/023.phpt8
-rw-r--r--sapi/cli/tests/argv_mb.phpt2
-rw-r--r--sapi/cli/tests/argv_mb_bug77111.phpt2
-rw-r--r--sapi/cli/tests/bug43177.phpt54
-rw-r--r--sapi/cli/tests/bug64529.phpt4
-rw-r--r--sapi/cli/tests/bug65066_100.phpt6
-rw-r--r--sapi/cli/tests/bug65066_422.phpt6
-rw-r--r--sapi/cli/tests/bug65066_511.phpt6
-rw-r--r--sapi/cli/tests/bug66606_2.phpt6
-rw-r--r--sapi/cli/tests/bug69655.phpt6
-rw-r--r--sapi/cli/tests/bug70264.phpt4
-rw-r--r--sapi/cli/tests/bug70470.phpt4
-rw-r--r--sapi/cli/tests/bug71005.phpt6
-rw-r--r--sapi/cli/tests/bug71624.phpt10
-rw-r--r--sapi/cli/tests/bug74600.phpt8
-rw-r--r--sapi/cli/tests/emptyheader.phpt4
-rw-r--r--sapi/cli/tests/php_cli_server.inc40
-rw-r--r--sapi/cli/tests/php_cli_server_004.phpt6
-rw-r--r--sapi/cli/tests/php_cli_server_005.phpt6
-rw-r--r--sapi/cli/tests/php_cli_server_006.phpt6
-rw-r--r--sapi/cli/tests/php_cli_server_007.phpt6
-rw-r--r--sapi/cli/tests/php_cli_server_008.phpt12
-rw-r--r--sapi/cli/tests/php_cli_server_009.phpt20
-rw-r--r--sapi/cli/tests/php_cli_server_010.phpt12
-rw-r--r--sapi/cli/tests/php_cli_server_012.phpt6
-rw-r--r--sapi/cli/tests/php_cli_server_013.phpt18
-rw-r--r--sapi/cli/tests/php_cli_server_014.phpt12
-rw-r--r--sapi/cli/tests/php_cli_server_015.phpt6
-rw-r--r--sapi/cli/tests/php_cli_server_016.phpt6
-rw-r--r--sapi/cli/tests/php_cli_server_017.phpt6
-rw-r--r--sapi/cli/tests/php_cli_server_020.phpt6
-rw-r--r--sapi/cli/tests/sapi_windows_set_ctrl_handler.phpt80
-rw-r--r--sapi/cli/tests/skipif.inc2
-rw-r--r--sapi/cli/tests/upload_2G.phpt6
-rw-r--r--sapi/embed/php_embed.c2
-rw-r--r--sapi/embed/php_embed.h2
-rw-r--r--sapi/fpm/config.m42
-rw-r--r--sapi/fpm/fpm/events/devpoll.c2
-rw-r--r--sapi/fpm/fpm/events/devpoll.h2
-rw-r--r--sapi/fpm/fpm/events/epoll.c2
-rw-r--r--sapi/fpm/fpm/events/epoll.h2
-rw-r--r--sapi/fpm/fpm/events/kqueue.c2
-rw-r--r--sapi/fpm/fpm/events/kqueue.h2
-rw-r--r--sapi/fpm/fpm/events/poll.c4
-rw-r--r--sapi/fpm/fpm/events/poll.h2
-rw-r--r--sapi/fpm/fpm/events/port.c2
-rw-r--r--sapi/fpm/fpm/events/port.h2
-rw-r--r--sapi/fpm/fpm/events/select.c2
-rw-r--r--sapi/fpm/fpm/events/select.h2
-rw-r--r--sapi/fpm/fpm/fpm_conf.c4
-rw-r--r--sapi/fpm/fpm/fpm_events.c2
-rw-r--r--sapi/fpm/fpm/fpm_log.c2
-rw-r--r--sapi/fpm/fpm/fpm_main.c19
-rw-r--r--sapi/fpm/fpm/fpm_signals.c2
-rw-r--r--sapi/fpm/tests/bug76601-reload-child-signals.phpt6
-rw-r--r--sapi/fpm/tests/fcgi.inc4
-rw-r--r--sapi/fpm/tests/getallheaders.phpt42
-rw-r--r--sapi/fpm/tests/response.inc2
-rw-r--r--sapi/fpm/tests/status-basic.phpt2
-rw-r--r--sapi/fpm/www.conf.in10
-rw-r--r--sapi/fuzzer/Makefile.frag18
-rw-r--r--sapi/fuzzer/README.md66
-rw-r--r--sapi/fuzzer/config.m494
-rw-r--r--sapi/fuzzer/corpus/exif/bug34704.jpgbin0 -> 9976 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug34704_2.jpgbin0 -> 9976 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug48378.jpegbin0 -> 2566 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug54002_1.jpegbin0 -> 87599 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug54002_2.jpegbin0 -> 87599 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug62523_1.jpg9
-rw-r--r--sapi/fuzzer/corpus/exif/bug62523_3.jpg12
-rw-r--r--sapi/fuzzer/corpus/exif/bug68113.jpgbin0 -> 368 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug68113_2.jpgbin0 -> 368 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug68799.jpgbin0 -> 735 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug72094_1.jpgbin0 -> 140 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug72094_2.jpgbin0 -> 140 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug72094_3.jpgbin0 -> 112 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug72094_4.jpgbin0 -> 32 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug72603.jpegbin0 -> 3711 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug72618.jpgbin0 -> 3711 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug72627.tiffbin0 -> 1250 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug73737.tiffbin0 -> 48 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug76130_1.jpgbin0 -> 3396 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug76130_2.jpgbin0 -> 1632 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug76423.jpgbin0 -> 1537 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug76557.jpgbin0 -> 2372 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug77540.jpgbin0 -> 91 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug77563.jpgbin0 -> 63 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug77753.tiffbin0 -> 873 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug77831.tiffbin0 -> 49 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug77950.tiffbin0 -> 1267 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/bug77988.jpgbin0 -> 1202 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/duplicate_copyright_tag_leak.tiffbin0 -> 9397 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/exif_encoding_crash.jpgbin0 -> 7599 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image007.jpgbin0 -> 283 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image008.jpgbin0 -> 527 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image009.jpgbin0 -> 527 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image010.jpgbin0 -> 741 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image011.jpgbin0 -> 741 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image012.jpgbin0 -> 721 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image013.jpgbin0 -> 721 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image014.jpgbin0 -> 935 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image015.jpgbin0 -> 935 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image016.tiffbin0 -> 1874 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image017.tiffbin0 -> 1874 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image018.tiffbin0 -> 2088 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image020.tiffbin0 -> 2068 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image021.tiffbin0 -> 2068 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image022.tiffbin0 -> 2282 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image023.tiffbin0 -> 2282 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image024.jpgbin0 -> 417 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image025.jpgbin0 -> 417 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image026.tiffbin0 -> 1984 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/image027.tiffbin0 -> 1984 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/tag_with_illegal_zero_components.jpegbin0 -> 43 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/temporary_buffer_leak.jpgbin0 -> 46 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/test1.jpgbin0 -> 523 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/test2.jpgbin0 -> 1240 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/test22.jpgbin0 -> 1240 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/test3.jpgbin0 -> 1240 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/test4.jpgbin0 -> 713 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/test5.jpgbin0 -> 603 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/test6.jpgbin0 -> 1240 bytes
-rw-r--r--sapi/fuzzer/corpus/exif/zero_length_makernote_leak.tiffbin0 -> 164 bytes
-rw-r--r--sapi/fuzzer/corpus/json/1.json1
-rw-r--r--sapi/fuzzer/corpus/json/10.json1
-rw-r--r--sapi/fuzzer/corpus/json/11.json1
-rw-r--r--sapi/fuzzer/corpus/json/12.json2
-rw-r--r--sapi/fuzzer/corpus/json/13.json1
-rw-r--r--sapi/fuzzer/corpus/json/14.json2
-rw-r--r--sapi/fuzzer/corpus/json/15.json1
-rw-r--r--sapi/fuzzer/corpus/json/16.json1
-rw-r--r--sapi/fuzzer/corpus/json/17.json1
-rw-r--r--sapi/fuzzer/corpus/json/18.json1
-rw-r--r--sapi/fuzzer/corpus/json/19.json1
-rw-r--r--sapi/fuzzer/corpus/json/2.json1
-rw-r--r--sapi/fuzzer/corpus/json/3.json1
-rw-r--r--sapi/fuzzer/corpus/json/4.json1
-rw-r--r--sapi/fuzzer/corpus/json/5.json5
-rw-r--r--sapi/fuzzer/corpus/json/6.json1
-rw-r--r--sapi/fuzzer/corpus/json/7.json2
-rw-r--r--sapi/fuzzer/corpus/json/8.json1
-rw-r--r--sapi/fuzzer/corpus/json/9.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail1.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail10.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail11.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail12.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail13.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail14.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail15.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail16.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail17.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail18.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail19.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail2.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail20.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail21.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail22.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail23.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail24.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail25.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail26.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail27.json2
-rw-r--r--sapi/fuzzer/corpus/json/fail28.json2
-rw-r--r--sapi/fuzzer/corpus/json/fail29.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail3.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail30.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail31.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail32.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail33.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail4.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail5.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail6.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail7.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail8.json1
-rw-r--r--sapi/fuzzer/corpus/json/fail9.json1
-rw-r--r--sapi/fuzzer/corpus/json/pass1.json58
-rw-r--r--sapi/fuzzer/corpus/json/pass2.json1
-rw-r--r--sapi/fuzzer/corpus/json/pass3.json6
-rw-r--r--sapi/fuzzer/corpus/unserialize/__serialize_0071
-rw-r--r--sapi/fuzzer/corpus/unserialize/bug71311
-rw-r--r--sapi/fuzzer/corpus/unserialize/bug713131
-rw-r--r--sapi/fuzzer/corpus/unserialize/bug73144_11
-rw-r--r--sapi/fuzzer/corpus/unserialize/bug73144_21
-rw-r--r--sapi/fuzzer/corpus/unserialize/bug738251
-rw-r--r--sapi/fuzzer/corpus/unserialize/bug741011
-rw-r--r--sapi/fuzzer/corpus/unserialize/bug741031
-rw-r--r--sapi/fuzzer/corpus/unserialize/bug741111
-rw-r--r--sapi/fuzzer/corpus/unserialize/bug746141
-rw-r--r--sapi/fuzzer/corpus/unserialize/bug750541
-rw-r--r--sapi/fuzzer/corpus/unserialize/int_min_iv1
-rw-r--r--sapi/fuzzer/corpus/unserialize/leak_176281
-rw-r--r--sapi/fuzzer/corpus/unserialize/leak_176391
-rw-r--r--sapi/fuzzer/corpus/unserialize/leak_176461
-rw-r--r--sapi/fuzzer/corpus/unserialize/splobjectstorage_negative_count1
-rw-r--r--sapi/fuzzer/dict/parser85
-rw-r--r--sapi/fuzzer/fuzzer-exif.c72
-rw-r--r--sapi/fuzzer/fuzzer-json.c70
-rw-r--r--sapi/fuzzer/fuzzer-mbstring.c76
-rw-r--r--sapi/fuzzer/fuzzer-parser.c55
-rw-r--r--sapi/fuzzer/fuzzer-sapi.c273
-rw-r--r--sapi/fuzzer/fuzzer-sapi.h22
-rw-r--r--sapi/fuzzer/fuzzer-unserialize.c90
-rw-r--r--sapi/fuzzer/fuzzer.h18
-rw-r--r--sapi/fuzzer/generate_parser_corpus.php24
-rw-r--r--sapi/fuzzer/generate_unserialize_dict.php9
-rw-r--r--sapi/fuzzer/json.dict52
-rw-r--r--sapi/litespeed/config.m42
-rw-r--r--sapi/litespeed/lsapi_main.c8
-rw-r--r--sapi/litespeed/lsapidef.h2
-rw-r--r--sapi/litespeed/lsapilib.c6
-rw-r--r--sapi/litespeed/lsapilib.h2
-rw-r--r--sapi/litespeed/lscriu.c2
-rw-r--r--sapi/litespeed/lscriu.h2
-rw-r--r--sapi/phpdbg/Makefile.frag2
-rw-r--r--sapi/phpdbg/README.md78
-rw-r--r--sapi/phpdbg/config.m46
-rwxr-xr-xsapi/phpdbg/create-test.php2
-rw-r--r--sapi/phpdbg/phpdbg.c113
-rw-r--r--sapi/phpdbg/phpdbg.h8
-rw-r--r--sapi/phpdbg/phpdbg.stub.php23
-rw-r--r--sapi/phpdbg/phpdbg_arginfo.h43
-rw-r--r--sapi/phpdbg/phpdbg_bp.c2
-rw-r--r--sapi/phpdbg/phpdbg_bp.h2
-rw-r--r--sapi/phpdbg/phpdbg_break.c2
-rw-r--r--sapi/phpdbg/phpdbg_break.h2
-rw-r--r--sapi/phpdbg/phpdbg_btree.c2
-rw-r--r--sapi/phpdbg/phpdbg_btree.h2
-rw-r--r--sapi/phpdbg/phpdbg_cmd.c2
-rw-r--r--sapi/phpdbg/phpdbg_cmd.h6
-rw-r--r--sapi/phpdbg/phpdbg_eol.c2
-rw-r--r--sapi/phpdbg/phpdbg_eol.h2
-rw-r--r--sapi/phpdbg/phpdbg_frame.c4
-rw-r--r--sapi/phpdbg/phpdbg_frame.h2
-rw-r--r--sapi/phpdbg/phpdbg_help.c6
-rw-r--r--sapi/phpdbg/phpdbg_help.h2
-rw-r--r--sapi/phpdbg/phpdbg_info.c2
-rw-r--r--sapi/phpdbg/phpdbg_info.h2
-rw-r--r--sapi/phpdbg/phpdbg_io.c2
-rw-r--r--sapi/phpdbg/phpdbg_io.h2
-rw-r--r--sapi/phpdbg/phpdbg_lexer.h2
-rw-r--r--sapi/phpdbg/phpdbg_list.c4
-rw-r--r--sapi/phpdbg/phpdbg_list.h2
-rw-r--r--sapi/phpdbg/phpdbg_opcode.c2
-rw-r--r--sapi/phpdbg/phpdbg_opcode.h2
-rw-r--r--sapi/phpdbg/phpdbg_out.c2
-rw-r--r--sapi/phpdbg/phpdbg_out.h2
-rw-r--r--sapi/phpdbg/phpdbg_parser.y30
-rw-r--r--sapi/phpdbg/phpdbg_print.c2
-rw-r--r--sapi/phpdbg/phpdbg_print.h2
-rw-r--r--sapi/phpdbg/phpdbg_prompt.c4
-rw-r--r--sapi/phpdbg/phpdbg_prompt.h2
-rw-r--r--sapi/phpdbg/phpdbg_rinit_hook.c2
-rw-r--r--sapi/phpdbg/phpdbg_rinit_hook.h2
-rw-r--r--sapi/phpdbg/phpdbg_set.c2
-rw-r--r--sapi/phpdbg/phpdbg_set.h2
-rw-r--r--sapi/phpdbg/phpdbg_sigio_win32.c2
-rw-r--r--sapi/phpdbg/phpdbg_sigio_win32.h2
-rw-r--r--sapi/phpdbg/phpdbg_utils.c6
-rw-r--r--sapi/phpdbg/phpdbg_utils.h2
-rw-r--r--sapi/phpdbg/phpdbg_wait.c2
-rw-r--r--sapi/phpdbg/phpdbg_wait.h2
-rw-r--r--sapi/phpdbg/phpdbg_watch.c4
-rw-r--r--sapi/phpdbg/phpdbg_watch.h2
-rw-r--r--sapi/phpdbg/phpdbg_webdata_transfer.c2
-rw-r--r--sapi/phpdbg/phpdbg_webdata_transfer.h2
-rw-r--r--sapi/phpdbg/phpdbg_win.c2
-rw-r--r--sapi/phpdbg/phpdbg_win.h2
-rw-r--r--sapi/phpdbg/tests/bug78297.phpt4
-rwxr-xr-xscripts/dev/bless_tests.php168
-rwxr-xr-xscripts/dev/check_parameters.php2
-rwxr-xr-xscripts/dev/gen_stub.php640
-rwxr-xr-xscripts/dev/genfiles2
-rwxr-xr-xscripts/dev/search_underscores.php2
-rw-r--r--scripts/dev/tidy.php11
-rw-r--r--tests/basic/011.phpt2
-rw-r--r--tests/basic/012.phpt4
-rw-r--r--tests/basic/025.phpt2
-rw-r--r--tests/basic/027.phpt33
-rw-r--r--tests/basic/bug20539.phpt8
-rw-r--r--tests/basic/bug54514.phpt6
-rw-r--r--tests/basic/bug71273.phpt16
-rw-r--r--tests/basic/enable_post_data_reading_01.phpt2
-rw-r--r--tests/basic/enable_post_data_reading_03.phpt2
-rw-r--r--tests/basic/enable_post_data_reading_04.phpt2
-rw-r--r--tests/basic/enable_post_data_reading_05.phpt2
-rw-r--r--tests/basic/enable_post_data_reading_06.phpt2
-rw-r--r--tests/basic/rfc1867_empty_upload.phpt4
-rw-r--r--tests/basic/rfc1867_max_file_size.phpt4
-rw-r--r--tests/basic/rfc1867_max_file_uploads_empty_files.phpt4
-rw-r--r--tests/basic/rfc1867_post_max_filesize.phpt4
-rw-r--r--tests/classes/__call_001.phpt12
-rw-r--r--tests/classes/__call_002.phpt4
-rw-r--r--tests/classes/__call_004.phpt28
-rw-r--r--tests/classes/__call_005.phpt20
-rw-r--r--tests/classes/__call_006.phpt40
-rw-r--r--tests/classes/__call_007.phpt40
-rw-r--r--tests/classes/__set__get_001.phpt46
-rw-r--r--tests/classes/__set__get_002.phpt4
-rw-r--r--tests/classes/__set__get_003.phpt4
-rw-r--r--tests/classes/__set__get_004.phpt28
-rw-r--r--tests/classes/__set__get_005.phpt56
-rw-r--r--tests/classes/abstract.phpt14
-rw-r--r--tests/classes/abstract_by_interface_001.phpt4
-rw-r--r--tests/classes/abstract_by_interface_002.phpt4
-rw-r--r--tests/classes/abstract_class.phpt8
-rw-r--r--tests/classes/abstract_derived.phpt3
-rw-r--r--tests/classes/abstract_final.phpt2
-rw-r--r--tests/classes/abstract_inherit.phpt2
-rw-r--r--tests/classes/abstract_not_declared.phpt2
-rw-r--r--tests/classes/abstract_redeclare.phpt8
-rw-r--r--tests/classes/abstract_static.phpt10
-rw-r--r--tests/classes/abstract_user_call.phpt23
-rw-r--r--tests/classes/array_access_001.phpt36
-rw-r--r--tests/classes/array_access_002.phpt36
-rw-r--r--tests/classes/array_access_003.phpt58
-rw-r--r--tests/classes/array_access_004.phpt58
-rw-r--r--tests/classes/array_access_005.phpt34
-rw-r--r--tests/classes/array_access_006.phpt32
-rw-r--r--tests/classes/array_access_007.phpt60
-rw-r--r--tests/classes/array_access_008.phpt34
-rw-r--r--tests/classes/array_access_009.phpt158
-rw-r--r--tests/classes/array_access_010.phpt113
-rw-r--r--tests/classes/array_access_011.phpt131
-rw-r--r--tests/classes/array_access_012.phpt23
-rw-r--r--tests/classes/array_access_013.phpt10
-rw-r--r--tests/classes/array_conversion_keys.phpt6
-rw-r--r--tests/classes/assign_op_property_001.phpt22
-rw-r--r--tests/classes/autoload_001.phpt6
-rw-r--r--tests/classes/autoload_002.phpt6
-rw-r--r--tests/classes/autoload_003.phpt6
-rw-r--r--tests/classes/autoload_004.phpt8
-rw-r--r--tests/classes/autoload_005.phpt8
-rw-r--r--tests/classes/autoload_006.phpt6
-rw-r--r--tests/classes/autoload_012.phpt15
-rw-r--r--tests/classes/autoload_021.phpt2
-rw-r--r--tests/classes/autoload_implements.inc8
-rw-r--r--tests/classes/autoload_interface.inc2
-rw-r--r--tests/classes/autoload_root.inc8
-rw-r--r--tests/classes/bug26737.phpt14
-rw-r--r--tests/classes/bug27468.phpt8
-rw-r--r--tests/classes/bug27504.phpt41
-rw-r--r--tests/classes/bug75765.phpt8
-rw-r--r--tests/classes/class_abstract.phpt6
-rw-r--r--tests/classes/class_final.phpt6
-rw-r--r--tests/classes/clone_001.phpt6
-rw-r--r--tests/classes/clone_002.phpt10
-rw-r--r--tests/classes/clone_003.phpt30
-rw-r--r--tests/classes/clone_004.phpt2
-rw-r--r--tests/classes/clone_006.phpt16
-rw-r--r--tests/classes/constants_basic_001.phpt14
-rw-r--r--tests/classes/constants_basic_002.phpt2
-rw-r--r--tests/classes/constants_basic_003.inc2
-rw-r--r--tests/classes/constants_comments_001.phpt22
-rw-r--r--tests/classes/constants_error_003.phpt5
-rw-r--r--tests/classes/constants_scope_001.phpt23
-rw-r--r--tests/classes/constants_visibility_001.phpt14
-rw-r--r--tests/classes/constants_visibility_002.phpt25
-rw-r--r--tests/classes/constants_visibility_003.phpt25
-rw-r--r--tests/classes/constants_visibility_004.phpt18
-rw-r--r--tests/classes/constants_visibility_005.phpt2
-rw-r--r--tests/classes/constants_visibility_006.phpt2
-rw-r--r--tests/classes/constants_visibility_007.phpt2
-rw-r--r--tests/classes/constants_visibility_error_001.phpt2
-rw-r--r--tests/classes/constants_visibility_error_002.phpt2
-rw-r--r--tests/classes/constants_visibility_error_003.phpt4
-rw-r--r--tests/classes/constants_visibility_error_004.phpt4
-rw-r--r--tests/classes/ctor_dtor.phpt24
-rw-r--r--tests/classes/ctor_dtor_inheritance.phpt50
-rw-r--r--tests/classes/ctor_failure.phpt2
-rw-r--r--tests/classes/ctor_in_interface_01.phpt8
-rw-r--r--tests/classes/ctor_in_interface_02.phpt16
-rw-r--r--tests/classes/ctor_in_interface_03.phpt8
-rw-r--r--tests/classes/ctor_in_interface_04.phpt14
-rw-r--r--tests/classes/ctor_name_clash.phpt23
-rw-r--r--tests/classes/ctor_visibility.phpt40
-rw-r--r--tests/classes/dereferencing_001.phpt26
-rw-r--r--tests/classes/destructor_and_exceptions.phpt42
-rw-r--r--tests/classes/destructor_and_globals.phpt4
-rw-r--r--tests/classes/destructor_visibility_001.phpt6
-rw-r--r--tests/classes/destructor_visibility_002.phpt6
-rw-r--r--tests/classes/destructor_visibility_003.phpt14
-rw-r--r--tests/classes/factory_001.phpt24
-rw-r--r--tests/classes/factory_and_singleton_001.phpt2
-rw-r--r--tests/classes/factory_and_singleton_002.phpt2
-rw-r--r--tests/classes/factory_and_singleton_009.phpt2
-rw-r--r--tests/classes/factory_and_singleton_010.phpt2
-rw-r--r--tests/classes/final.phpt12
-rw-r--r--tests/classes/final_abstract.phpt2
-rw-r--r--tests/classes/final_ctor1.phpt18
-rw-r--r--tests/classes/final_ctor2.phpt30
-rw-r--r--tests/classes/final_ctor3.phpt15
-rw-r--r--tests/classes/final_redeclare.phpt12
-rw-r--r--tests/classes/implicit_instantiation_001.phpt156
-rw-r--r--tests/classes/incdec_property_001.phpt22
-rw-r--r--tests/classes/incdec_property_002.phpt22
-rw-r--r--tests/classes/incdec_property_003.phpt22
-rw-r--r--tests/classes/incdec_property_004.phpt22
-rw-r--r--tests/classes/inheritance.phpt2
-rw-r--r--tests/classes/inheritance_002.phpt74
-rw-r--r--tests/classes/inheritance_003.phpt8
-rw-r--r--tests/classes/inheritance_004.phpt8
-rw-r--r--tests/classes/inheritance_005.phpt58
-rw-r--r--tests/classes/inheritance_006.phpt4
-rw-r--r--tests/classes/inheritance_007.phpt40
-rw-r--r--tests/classes/interface_and_extends.phpt8
-rw-r--r--tests/classes/interface_constant_inheritance_001.phpt4
-rw-r--r--tests/classes/interface_constant_inheritance_002.phpt4
-rw-r--r--tests/classes/interface_constant_inheritance_003.phpt4
-rw-r--r--tests/classes/interface_constant_inheritance_004.phpt2
-rw-r--r--tests/classes/interface_constant_inheritance_005.phpt2
-rw-r--r--tests/classes/interface_constant_inheritance_006.phpt2
-rw-r--r--tests/classes/interface_constant_inheritance_007.phpt2
-rw-r--r--tests/classes/interface_doubled.phpt88
-rw-r--r--tests/classes/interface_implemented.phpt38
-rw-r--r--tests/classes/interface_instantiate.phpt2
-rw-r--r--tests/classes/interface_member.phpt2
-rw-r--r--tests/classes/interface_method.phpt2
-rw-r--r--tests/classes/interface_method_final.phpt2
-rw-r--r--tests/classes/interface_method_private.phpt2
-rw-r--r--tests/classes/interface_must_be_implemented.phpt2
-rw-r--r--tests/classes/interface_optional_arg.phpt8
-rw-r--r--tests/classes/interface_optional_arg_002.phpt8
-rw-r--r--tests/classes/interface_optional_arg_003.phpt2
-rw-r--r--tests/classes/interfaces_001.phpt10
-rw-r--r--tests/classes/interfaces_002.phpt12
-rw-r--r--tests/classes/interfaces_003.phpt8
-rw-r--r--tests/classes/iterators_001.phpt86
-rw-r--r--tests/classes/iterators_002.phpt94
-rw-r--r--tests/classes/iterators_003.phpt98
-rw-r--r--tests/classes/iterators_004.phpt52
-rw-r--r--tests/classes/iterators_006.phpt52
-rw-r--r--tests/classes/iterators_007.phpt40
-rw-r--r--tests/classes/method_override_optional_arg_001.phpt20
-rw-r--r--tests/classes/method_override_optional_arg_002.phpt11
-rw-r--r--tests/classes/object_reference_001.phpt8
-rw-r--r--tests/classes/private_001.phpt12
-rw-r--r--tests/classes/private_002.phpt20
-rw-r--r--tests/classes/private_003.phpt24
-rw-r--r--tests/classes/private_003b.phpt24
-rw-r--r--tests/classes/private_004.phpt18
-rw-r--r--tests/classes/private_004b.phpt18
-rw-r--r--tests/classes/private_005.phpt18
-rw-r--r--tests/classes/private_006.phpt18
-rw-r--r--tests/classes/private_006b.phpt18
-rw-r--r--tests/classes/private_007.phpt18
-rw-r--r--tests/classes/private_007b.phpt18
-rw-r--r--tests/classes/private_members.phpt20
-rw-r--r--tests/classes/private_members_serialization.phpt14
-rw-r--r--tests/classes/private_redeclare.phpt30
-rw-r--r--tests/classes/property_recreate_private.phpt22
-rw-r--r--tests/classes/property_recreate_protected.phpt20
-rw-r--r--tests/classes/protected_001.phpt12
-rw-r--r--tests/classes/protected_001b.phpt12
-rw-r--r--tests/classes/protected_002.phpt20
-rw-r--r--tests/classes/serialize_001.phpt59
-rw-r--r--tests/classes/singleton_001.phpt22
-rw-r--r--tests/classes/static_mix_1.phpt12
-rw-r--r--tests/classes/static_mix_2.phpt12
-rw-r--r--tests/classes/static_properties_001.phpt2
-rw-r--r--tests/classes/static_properties_003.phpt4
-rw-r--r--tests/classes/static_properties_003_error1.phpt2
-rw-r--r--tests/classes/static_properties_003_error2.phpt2
-rw-r--r--tests/classes/static_properties_003_error3.phpt2
-rw-r--r--tests/classes/static_properties_003_error4.phpt2
-rw-r--r--tests/classes/static_properties_004.phpt2
-rw-r--r--tests/classes/static_this.phpt26
-rw-r--r--tests/classes/this.phpt8
-rw-r--r--tests/classes/tostring_001.phpt17
-rw-r--r--tests/classes/tostring_002.phpt16
-rw-r--r--tests/classes/tostring_003.phpt24
-rw-r--r--tests/classes/tostring_004.phpt10
-rw-r--r--tests/classes/type_hinting_001.phpt16
-rw-r--r--tests/classes/type_hinting_002.phpt2
-rw-r--r--tests/classes/type_hinting_003.phpt40
-rw-r--r--tests/classes/type_hinting_005a.phpt10
-rw-r--r--tests/classes/type_hinting_005c.phpt7
-rw-r--r--tests/classes/type_hinting_005d.phpt7
-rw-r--r--tests/classes/unset_properties.phpt124
-rw-r--r--tests/classes/visibility_000a.phpt24
-rw-r--r--tests/classes/visibility_000b.phpt24
-rw-r--r--tests/classes/visibility_000c.phpt24
-rw-r--r--tests/classes/visibility_001a.phpt24
-rw-r--r--tests/classes/visibility_001b.phpt24
-rw-r--r--tests/classes/visibility_001c.phpt24
-rw-r--r--tests/classes/visibility_002a.phpt24
-rw-r--r--tests/classes/visibility_002b.phpt24
-rw-r--r--tests/classes/visibility_002c.phpt24
-rw-r--r--tests/classes/visibility_003a.phpt24
-rw-r--r--tests/classes/visibility_003b.phpt24
-rw-r--r--tests/classes/visibility_003c.phpt24
-rw-r--r--tests/classes/visibility_004a.phpt24
-rw-r--r--tests/classes/visibility_004b.phpt24
-rw-r--r--tests/classes/visibility_004c.phpt24
-rw-r--r--tests/classes/visibility_005.phpt22
-rw-r--r--tests/func/003.phpt8
-rw-r--r--tests/func/005.phpt2
-rw-r--r--tests/func/005a.phpt2
-rw-r--r--tests/func/010.phpt30
-rw-r--r--tests/lang/002.phpt4
-rw-r--r--tests/lang/003.phpt18
-rw-r--r--tests/lang/004.phpt4
-rw-r--r--tests/lang/005.phpt6
-rw-r--r--tests/lang/006.phpt18
-rw-r--r--tests/lang/007.phpt16
-rw-r--r--tests/lang/008.phpt8
-rw-r--r--tests/lang/009.phpt2
-rw-r--r--tests/lang/010.phpt4
-rw-r--r--tests/lang/011.phpt4
-rw-r--r--tests/lang/012.phpt10
-rw-r--r--tests/lang/014.phpt2
-rw-r--r--tests/lang/015.inc2
-rw-r--r--tests/lang/016.inc2
-rw-r--r--tests/lang/017.phpt10
-rw-r--r--tests/lang/020.phpt56
-rw-r--r--tests/lang/022.phpt36
-rw-r--r--tests/lang/023-1.inc58
-rw-r--r--tests/lang/024.phpt58
-rw-r--r--tests/lang/025.phpt18
-rw-r--r--tests/lang/027.phpt4
-rw-r--r--tests/lang/028.phpt40
-rw-r--r--tests/lang/030.phpt18
-rw-r--r--tests/lang/031.phpt72
-rw-r--r--tests/lang/032.phpt12
-rw-r--r--tests/lang/033.phpt28
-rw-r--r--tests/lang/035.phpt26
-rw-r--r--tests/lang/036.phpt20
-rw-r--r--tests/lang/037.phpt20
-rw-r--r--tests/lang/038.phpt25
-rw-r--r--tests/lang/039.phpt22
-rw-r--r--tests/lang/040.phpt2
-rw-r--r--tests/lang/bison1.phpt4
-rw-r--r--tests/lang/bug17115.phpt17
-rw-r--r--tests/lang/bug18872.phpt4
-rw-r--r--tests/lang/bug19943.phpt22
-rw-r--r--tests/lang/bug20175.phpt94
-rw-r--r--tests/lang/bug21094.phpt6
-rw-r--r--tests/lang/bug21669.phpt16
-rw-r--r--tests/lang/bug21849.phpt8
-rw-r--r--tests/lang/bug21961.phpt74
-rw-r--r--tests/lang/bug22510.phpt106
-rw-r--r--tests/lang/bug22592.phpt4
-rw-r--r--tests/lang/bug22690.phpt13
-rw-r--r--tests/lang/bug23384.phpt5
-rw-r--r--tests/lang/bug23584.phpt4
-rw-r--r--tests/lang/bug23922.phpt21
-rw-r--r--tests/lang/bug24054.phpt8
-rw-r--r--tests/lang/bug24436.phpt8
-rw-r--r--tests/lang/bug24499.phpt5
-rw-r--r--tests/lang/bug24640.phpt13
-rw-r--r--tests/lang/bug24658.phpt8
-rw-r--r--tests/lang/bug24783.phpt10
-rw-r--r--tests/lang/bug24908.phpt12
-rw-r--r--tests/lang/bug24926.phpt29
-rw-r--r--tests/lang/bug24951.phpt12
-rw-r--r--tests/lang/bug25547.phpt6
-rw-r--r--tests/lang/bug25652.phpt22
-rw-r--r--tests/lang/bug25922.phpt6
-rw-r--r--tests/lang/bug26696.phpt20
-rw-r--r--tests/lang/bug26866.phpt18
-rw-r--r--tests/lang/bug26869.phpt8
-rw-r--r--tests/lang/bug27354.phpt8
-rw-r--r--tests/lang/bug27439.phpt74
-rw-r--r--tests/lang/bug27535.phpt14
-rw-r--r--tests/lang/bug28800.phpt8
-rw-r--r--tests/lang/bug29566.phpt2
-rw-r--r--tests/lang/bug29893.phpt12
-rw-r--r--tests/lang/bug29944.phpt14
-rw-r--r--tests/lang/bug30862.phpt4
-rw-r--r--tests/lang/bug32828.phpt2
-rw-r--r--tests/lang/bug35176.phpt2
-rw-r--r--tests/lang/bug43958.phpt8
-rw-r--r--tests/lang/bug44827.phpt9
-rw-r--r--tests/lang/bug71897.phpt4
-rw-r--r--tests/lang/bug73329.phpt14
-rw-r--r--tests/lang/bug7515.phpt10
-rw-r--r--tests/lang/catchable_error_001.phpt24
-rw-r--r--tests/lang/catchable_error_002.phpt34
-rw-r--r--tests/lang/compare_objects_basic1.phpt12
-rw-r--r--tests/lang/compare_objects_basic2.phpt2
-rw-r--r--tests/lang/each_binary_safety.phpt14
-rw-r--r--tests/lang/engine_assignExecutionOrder_001.phpt22
-rw-r--r--tests/lang/engine_assignExecutionOrder_002.phpt9
-rw-r--r--tests/lang/engine_assignExecutionOrder_008.phpt30
-rw-r--r--tests/lang/engine_assignExecutionOrder_009.phpt4
-rw-r--r--tests/lang/error_2_exception_001.phpt32
-rw-r--r--tests/lang/foreachLoop.001.phpt8
-rw-r--r--tests/lang/foreachLoop.002.phpt32
-rw-r--r--tests/lang/foreachLoop.003.phpt10
-rw-r--r--tests/lang/foreachLoop.004.phpt4
-rw-r--r--tests/lang/foreachLoop.009.phpt32
-rw-r--r--tests/lang/foreachLoop.010.phpt12
-rw-r--r--tests/lang/foreachLoop.011.phpt8
-rw-r--r--tests/lang/foreachLoop.012.phpt46
-rw-r--r--tests/lang/foreachLoop.013.phpt46
-rw-r--r--tests/lang/foreachLoop.014.phpt50
-rw-r--r--tests/lang/foreachLoop.015.phpt50
-rw-r--r--tests/lang/foreachLoop.016.phpt54
-rw-r--r--tests/lang/foreachLoopIterator.001.phpt82
-rw-r--r--tests/lang/foreachLoopIterator.002.phpt12
-rw-r--r--tests/lang/foreachLoopIteratorAggregate.001.phpt162
-rw-r--r--tests/lang/foreachLoopIteratorAggregate.002.phpt40
-rw-r--r--tests/lang/foreachLoopIteratorAggregate.003.phpt80
-rw-r--r--tests/lang/foreachLoopIteratorAggregate.004.phpt92
-rw-r--r--tests/lang/foreachLoopObjects.001.phpt18
-rw-r--r--tests/lang/foreachLoopObjects.002.phpt150
-rw-r--r--tests/lang/foreachLoopObjects.003.phpt56
-rw-r--r--tests/lang/foreachLoopObjects.004.phpt34
-rw-r--r--tests/lang/foreachLoopObjects.005.phpt42
-rw-r--r--tests/lang/foreachLoopObjects.006.phpt58
-rw-r--r--tests/lang/foreach_with_object_001.phpt2
-rw-r--r--tests/lang/foreach_with_references_001.phpt4
-rw-r--r--tests/lang/func_get_arg.002.phpt8
-rw-r--r--tests/lang/func_get_arg.004.phpt2
-rw-r--r--tests/lang/func_get_arg.005.phpt8
-rw-r--r--tests/lang/func_get_arg_variation.phpt9
-rw-r--r--tests/lang/func_get_args.001.phpt2
-rw-r--r--tests/lang/func_get_args.002.phpt2
-rw-r--r--tests/lang/func_get_args.004.phpt20
-rw-r--r--tests/lang/func_num_args.001.phpt2
-rw-r--r--tests/lang/func_num_args.002.phpt2
-rw-r--r--tests/lang/func_num_args.004.phpt20
-rw-r--r--tests/lang/operators/add_basiclong_64bit.phpt6
-rw-r--r--tests/lang/operators/add_variationStr.phpt4
-rw-r--r--tests/lang/operators/bitwiseAnd_basiclong_64bit.phpt6
-rw-r--r--tests/lang/operators/bitwiseAnd_variationStr.phpt4
-rw-r--r--tests/lang/operators/bitwiseNot_basiclong_64bit.phpt2
-rw-r--r--tests/lang/operators/bitwiseNot_variationStr.phpt2
-rw-r--r--tests/lang/operators/bitwiseOr_basiclong_64bit.phpt6
-rw-r--r--tests/lang/operators/bitwiseOr_variationStr.phpt4
-rw-r--r--tests/lang/operators/bitwiseShiftLeft_basiclong_64bit.phpt10
-rw-r--r--tests/lang/operators/bitwiseShiftLeft_variationStr.phpt4
-rw-r--r--tests/lang/operators/bitwiseShiftLeft_variationStr2.phpt2
-rw-r--r--tests/lang/operators/bitwiseShiftLeft_variationStr_64bit.phpt4
-rw-r--r--tests/lang/operators/bitwiseShiftRight_basiclong_64bit.phpt8
-rw-r--r--tests/lang/operators/bitwiseShiftRight_variationStr.phpt6
-rw-r--r--tests/lang/operators/bitwiseShiftRight_variationStr2.phpt2
-rw-r--r--tests/lang/operators/bitwiseXor_basiclong_64bit.phpt6
-rw-r--r--tests/lang/operators/bitwiseXor_variationStr.phpt4
-rw-r--r--tests/lang/operators/coalesce.phpt18
-rw-r--r--tests/lang/operators/divide_basiclong_64bit.phpt6
-rw-r--r--tests/lang/operators/divide_variationStr.phpt4
-rw-r--r--tests/lang/operators/modulus_basiclong_64bit.phpt12
-rw-r--r--tests/lang/operators/modulus_variationStr.phpt4
-rw-r--r--tests/lang/operators/multiply_basiclong_64bit.phpt6
-rw-r--r--tests/lang/operators/multiply_variationStr.phpt4
-rw-r--r--tests/lang/operators/negate_basiclong_64bit.phpt2
-rw-r--r--tests/lang/operators/negate_variationStr.phpt2
-rw-r--r--tests/lang/operators/operator_equals_basic.phpt2
-rw-r--r--tests/lang/operators/operator_equals_variation.phpt2
-rw-r--r--tests/lang/operators/operator_equals_variation_64bit.phpt2
-rw-r--r--tests/lang/operators/operator_gt_basic.phpt2
-rw-r--r--tests/lang/operators/operator_gt_or_equal_basic.phpt14
-rw-r--r--tests/lang/operators/operator_gt_or_equal_variation.phpt2
-rw-r--r--tests/lang/operators/operator_gt_or_equal_variation_64bit.phpt2
-rw-r--r--tests/lang/operators/operator_gt_variation.phpt2
-rw-r--r--tests/lang/operators/operator_gt_variation_64bit.phpt2
-rw-r--r--tests/lang/operators/operator_identical_basic.phpt2
-rw-r--r--tests/lang/operators/operator_identical_variation.phpt2
-rw-r--r--tests/lang/operators/operator_identical_variation_64bit.phpt2
-rw-r--r--tests/lang/operators/operator_lt_basic.phpt2
-rw-r--r--tests/lang/operators/operator_lt_or_equal_basic.phpt14
-rw-r--r--tests/lang/operators/operator_lt_or_equal_variation.phpt2
-rw-r--r--tests/lang/operators/operator_lt_or_equal_variation_64bit.phpt2
-rw-r--r--tests/lang/operators/operator_lt_variation.phpt2
-rw-r--r--tests/lang/operators/operator_lt_variation_64bit.phpt2
-rw-r--r--tests/lang/operators/operator_notequals_basic.phpt2
-rw-r--r--tests/lang/operators/operator_notequals_variation.phpt2
-rw-r--r--tests/lang/operators/operator_notequals_variation_64bit.phpt2
-rw-r--r--tests/lang/operators/operator_notidentical_basic.phpt2
-rw-r--r--tests/lang/operators/operator_notidentical_variation.phpt2
-rw-r--r--tests/lang/operators/operator_notidentical_variation_64bit.phpt2
-rw-r--r--tests/lang/operators/operator_spaceship_basic.phpt2
-rw-r--r--tests/lang/operators/overloaded_property_ref.phpt6
-rw-r--r--tests/lang/operators/postdec_basiclong_64bit.phpt2
-rw-r--r--tests/lang/operators/postdec_variationStr.phpt2
-rw-r--r--tests/lang/operators/postinc_basiclong_64bit.phpt2
-rw-r--r--tests/lang/operators/postinc_variationStr.phpt2
-rw-r--r--tests/lang/operators/predec_basiclong_64bit.phpt2
-rw-r--r--tests/lang/operators/predec_variationStr.phpt2
-rw-r--r--tests/lang/operators/preinc_basiclong_64bit.phpt2
-rw-r--r--tests/lang/operators/preinc_variationStr.phpt2
-rw-r--r--tests/lang/operators/subtract_basiclong_64bit.phpt6
-rw-r--r--tests/lang/operators/subtract_variationStr.phpt4
-rw-r--r--tests/lang/passByReference_001.phpt8
-rw-r--r--tests/lang/passByReference_002.phpt7
-rw-r--r--tests/lang/passByReference_003.phpt14
-rw-r--r--tests/lang/passByReference_004.phpt4
-rw-r--r--tests/lang/passByReference_005.phpt203
-rw-r--r--tests/lang/passByReference_006.phpt196
-rw-r--r--tests/lang/passByReference_007.phpt50
-rw-r--r--tests/lang/passByReference_008.phpt12
-rw-r--r--tests/lang/passByReference_009.phpt2
-rw-r--r--tests/lang/passByReference_010.phpt63
-rw-r--r--tests/lang/passByReference_012.phpt2
-rw-r--r--tests/lang/returnByReference.001.phpt2
-rw-r--r--tests/lang/returnByReference.002.phpt8
-rw-r--r--tests/lang/returnByReference.003.phpt6
-rw-r--r--tests/lang/returnByReference.004.phpt18
-rw-r--r--tests/lang/returnByReference.005.phpt18
-rw-r--r--tests/lang/returnByReference.006.phpt8
-rw-r--r--tests/lang/returnByReference.007.phpt24
-rw-r--r--tests/lang/returnByReference.008.phpt24
-rw-r--r--tests/lang/returnByReference.009.phpt6
-rw-r--r--tests/lang/short_tags.004.phpt4
-rw-r--r--tests/lang/static_basic_001.phpt40
-rw-r--r--tests/lang/static_basic_002.phpt6
-rw-r--r--tests/lang/static_variation_001.phpt26
-rw-r--r--tests/lang/static_variation_002.phpt26
-rw-r--r--tests/lang/string_decimals_001.phpt2
-rw-r--r--tests/lang/this_assignment.phpt2
-rw-r--r--tests/lang/throw_variation_001.phpt4
-rw-r--r--tests/lang/type_hints_002.phpt8
-rw-r--r--tests/lang/type_hints_003.phpt6
-rw-r--r--tests/output/bug46897.phpt4
-rw-r--r--tests/output/bug70970.phpt14
-rw-r--r--tests/output/bug74815.phpt19
-rw-r--r--tests/output/bug75236.phpt2
-rw-r--r--tests/output/ob_010.phpt2
-rw-r--r--tests/output/ob_011.phpt2
-rw-r--r--tests/output/ob_012.phpt26
-rw-r--r--tests/output/ob_014.phpt23
-rw-r--r--tests/output/ob_015.phpt23
-rw-r--r--tests/output/ob_017.phpt12
-rw-r--r--tests/output/ob_clean_basic_001.phpt2
-rw-r--r--tests/output/ob_end_clean_basic_001.phpt4
-rw-r--r--tests/output/ob_end_flush_basic_001.phpt4
-rw-r--r--tests/output/ob_flush_basic_001.phpt2
-rw-r--r--tests/output/ob_get_level_basic_001.phpt2
-rw-r--r--tests/output/ob_start_basic_002.phpt12
-rw-r--r--tests/output/ob_start_basic_003.phpt2
-rw-r--r--tests/output/ob_start_basic_004.phpt8
-rw-r--r--tests/output/ob_start_basic_005.phpt13
-rw-r--r--tests/output/ob_start_basic_006.phpt62
-rw-r--r--tests/output/ob_start_basic_unerasable_001.phpt8
-rw-r--r--tests/output/ob_start_basic_unerasable_002.phpt12
-rw-r--r--tests/output/ob_start_basic_unerasable_003.phpt10
-rw-r--r--tests/output/ob_start_basic_unerasable_004.phpt10
-rw-r--r--tests/output/ob_start_basic_unerasable_005.phpt16
-rw-r--r--tests/output/ob_start_callbacks.phpt8
-rw-r--r--tests/output/ob_start_error_001.phpt34
-rw-r--r--tests/output/ob_start_error_002.phpt14
-rw-r--r--tests/output/ob_start_error_003.phpt2
-rw-r--r--tests/output/ob_start_error_004.phpt2
-rw-r--r--tests/output/ob_start_error_005.phpt8
-rw-r--r--tests/output/stream_isatty.inc1
-rw-r--r--tests/output/stream_isatty_err.phpt3
-rw-r--r--tests/output/stream_isatty_in-err.phpt3
-rw-r--r--tests/output/stream_isatty_in-out-err.phpt3
-rw-r--r--tests/output/stream_isatty_in-out.phpt3
-rw-r--r--tests/output/stream_isatty_out-err.phpt3
-rw-r--r--tests/output/stream_isatty_out.phpt3
-rw-r--r--tests/quicktester.inc92
-rw-r--r--tests/run-test/test005.phpt36
-rw-r--r--tests/run-test/test008.phpt33
-rw-r--r--tests/run-test/test008a.phpt36
-rw-r--r--tests/security/open_basedir.inc4
-rw-r--r--tests/security/open_basedir_copy.phpt16
-rw-r--r--tests/security/open_basedir_dir.phpt16
-rw-r--r--tests/security/open_basedir_error_log_variation.phpt6
-rw-r--r--tests/security/open_basedir_file.phpt16
-rw-r--r--tests/security/open_basedir_file_get_contents.phpt16
-rw-r--r--tests/security/open_basedir_file_put_contents.phpt10
-rw-r--r--tests/security/open_basedir_fopen.phpt16
-rw-r--r--tests/security/open_basedir_opendir.phpt16
-rw-r--r--tests/security/open_basedir_parse_ini_file.phpt14
-rw-r--r--tests/security/open_basedir_scandir.phpt16
-rw-r--r--tests/strings/001.phpt84
-rw-r--r--tests/strings/002.phpt9
-rw-r--r--tests/strings/bug26703.phpt2
-rw-r--r--tests/strings/offsets_chaining_1.phpt2
-rw-r--r--tests/strings/offsets_chaining_2.phpt2
-rw-r--r--tests/strings/offsets_chaining_3.phpt2
-rw-r--r--tests/strings/offsets_chaining_4.phpt2
-rw-r--r--tests/strings/offsets_chaining_5.phpt2
-rwxr-xr-xtravis/compile.sh4
-rw-r--r--win32/build/Makefile8
-rw-r--r--win32/build/buildconf.js2
-rw-r--r--win32/build/config.w32.h.in8
-rw-r--r--win32/build/confutils.js38
-rw-r--r--win32/build/deplister.c2
-rw-r--r--win32/build/mkdist.php4
-rw-r--r--win32/build/phpize.js.in2
-rw-r--r--win32/codepage.c22
-rw-r--r--win32/codepage.h2
-rw-r--r--win32/console.c2
-rw-r--r--win32/console.h2
-rw-r--r--win32/dllmain.c2
-rw-r--r--win32/ftok.c2
-rw-r--r--win32/getrusage.c2
-rw-r--r--win32/getrusage.h2
-rw-r--r--win32/globals.c2
-rw-r--r--win32/grp.h2
-rw-r--r--win32/inet.c2
-rw-r--r--win32/inet.h2
-rw-r--r--win32/ioutil.c2
-rw-r--r--win32/ioutil.h2
-rw-r--r--win32/ipc.h2
-rw-r--r--win32/nice.c4
-rw-r--r--win32/nice.h2
-rw-r--r--win32/php_registry.h2
-rw-r--r--win32/php_win32_globals.h2
-rw-r--r--win32/registry.c2
-rw-r--r--win32/select.c2
-rw-r--r--win32/select.h2
-rw-r--r--win32/sendmail.c12
-rw-r--r--win32/signal.c25
-rw-r--r--win32/sockets.c2
-rw-r--r--win32/sockets.h2
-rw-r--r--win32/syslog.h2
-rw-r--r--win32/winutil.c2
-rw-r--r--win32/winutil.h2
10413 files changed, 207970 insertions, 194561 deletions
diff --git a/.appveyor.yml b/.appveyor.yml
index 61a2fc175c..97034c7c43 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -1,6 +1,6 @@
version: "{branch}.build.{build}"
-image: Visual Studio 2017
+image: Visual Studio 2019
branches:
except:
@@ -24,7 +24,7 @@ environment:
PHP_BUILD_OBJ_DIR: c:\obj
PHP_BUILD_CACHE_SDK_DIR: c:\build-cache\sdk
PHP_BUILD_SDK_BRANCH: php-sdk-2.2.0
- PHP_BUILD_CRT: vc15
+ PHP_BUILD_CRT: vs16
# ext and env setup for tests
#MYSQL_TEST_PASSWD: Password12!
#MYSQL_TEST_USER: root
diff --git a/.gdbinit b/.gdbinit
index 8e54830ef2..be901f80a2 100644
--- a/.gdbinit
+++ b/.gdbinit
@@ -252,16 +252,13 @@ define ____printzv_contents
____printzv &$zvalue->value.ref->val $arg1
end
if $type == 11
- printf "const: %s", $zvalue->value.str->val
- end
- if $type == 12
printf "CONSTANT_AST"
end
- if $type == 13
+ if $type == 12
printf "indirect: "
____printzv $zvalue->value.zv $arg1
end
- if $type == 14
+ if $type == 13
printf "pointer: %p", $zvalue->value.ptr
end
if $type == 15
@@ -271,18 +268,9 @@ define ____printzv_contents
printf "_BOOL"
end
if $type == 17
- printf "CALLABLE"
- end
- if $type == 18
- printf "ITERABLE"
- end
- if $type == 19
- printf "VOID"
- end
- if $type == 20
printf "_NUMBER"
end
- if $type > 20
+ if $type > 17
printf "unknown type %d", $type
end
printf "\n"
diff --git a/.gitignore b/.gitignore
index cd6e779831..af807328f6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -80,6 +80,9 @@ include/
libs/
modules/
+# Used by scripts/dev/gen_stub.php
+scripts/dev/PHP-Parser-*
+
# ------------------------------------------------------------------------------
# Configuration headers generated by the PHP build system
# ------------------------------------------------------------------------------
@@ -116,7 +119,7 @@ config.h.in
# ------------------------------------------------------------------------------
# SAPIs specific ignores
# ------------------------------------------------------------------------------
-/sapi/apache2handler/libphp7.module
+/sapi/apache2handler/libphp.module
/sapi/fpm/fpm/php-cgi
/sapi/fpm/init.d.php-fpm
/sapi/fpm/php-fpm.conf
@@ -168,8 +171,14 @@ php
/Zend/zend_language_parser.output
# ------------------------------------------------------------------------------
-# Extensions files additionally generated by `cd ext/name && phpize && ./configure`
+# Extensions files
# ------------------------------------------------------------------------------
+
+# Miscellaneous extensions files
+/ext/opcache/jit/zend_jit_x86.c
+/ext/opcache/minilua
+
+# Generated by `cd ext/name && phpize && ./configure`
/ext/*/build/
/ext/*/configure.ac
/ext/*/run-tests.php
@@ -182,7 +191,7 @@ php
/configure.bat
/configure.js
-# Generated by `/configure.(bat|js)` (architecture dependend)
+# Generated by `/configure.(bat|js)` (architecture dependent)
/config.nice.bat
# NTS debug build x86
@@ -200,7 +209,7 @@ php
# Generated by x64 compiler, includes Debug, Debug_TS, Release, Release_TS
/x64/
-# Miscellaneous files generated by Windows build sytem
+# Miscellaneous files generated by Windows build system
/main/config.w32.h
/win32/build/deplister.exe
/win32/build/deplister.obj
@@ -238,6 +247,9 @@ php
# Test results generated by `./run-tests.php`
php_test_results_*.txt
+# Temporary test information generated by `./run-tests.php`
+/run-test-info.php
+
# Temporary POST data placeholder files generated by `./run-tests.php`
phpt.*
diff --git a/.travis.yml b/.travis.yml
index c408d260cd..2c991431bf 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -67,11 +67,11 @@ env:
jobs:
include:
- - env: ENABLE_MAINTAINER_ZTS=0 ENABLE_DEBUG=0
+ - env: ENABLE_ZTS=0 ENABLE_DEBUG=0
arch: amd64
- - env: ENABLE_MAINTAINER_ZTS=1 ENABLE_DEBUG=1
+ - env: ENABLE_ZTS=1 ENABLE_DEBUG=1
arch: amd64
- - env: ENABLE_MAINTAINER_ZTS=1 ENABLE_DEBUG=1 SKIP_IO_CAPTURE_TESTS=1 ARM64=1
+ - env: ENABLE_ZTS=1 ENABLE_DEBUG=1 SKIP_IO_CAPTURE_TESTS=1 ARM64=1
arch: arm64
before_script:
@@ -88,7 +88,7 @@ before_script:
# Run PHPs run-tests.php
script:
- - ./sapi/cli/php run-tests.php -P -d extension=`pwd`/modules/zend_test.so $(if [ $ENABLE_DEBUG == 0 ]; then echo "-d opcache.enable_cli=1 -d opcache.protect_memory=1 -d zend_extension=`pwd`/modules/opcache.so"; fi) -g "FAIL,XFAIL,BORK,WARN,LEAK,SKIP" --offline --show-diff --show-slow 1000 --set-timeout 120 -j$(nproc)
+ - ./sapi/cli/php run-tests.php -P -d extension=`pwd`/modules/zend_test.so $(if [ $ENABLE_DEBUG == 0 ]; then echo "-d opcache.enable_cli=1 -d opcache.protect_memory=1 -d opcache.jit_buffer_size=16M -d zend_extension=`pwd`/modules/opcache.so"; fi) -g "FAIL,XFAIL,BORK,WARN,LEAK,SKIP" --offline --show-diff --show-slow 1000 --set-timeout 120 -j$(nproc)
- sapi/cli/php -d extension_dir=`pwd`/modules -r 'dl("zend_test");'
after_success:
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 5443be45f6..142244cdf0 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -262,8 +262,8 @@ included.
- Run `make test` to check your change doesn't break other features.
- Rebuild PHP with `--enable-debug` which will show some kinds of memory errors
and check the PHP and web server error logs after running your PHP tests.
-- Rebuild PHP with `--enable-maintainer-zts` to check your change compiles on
- multi-threaded web servers.
+- Rebuild PHP with `--enable-zts` to check your change compiles and operates
+ correctly in a thread safe PHP.
- Review the change once more just before submitting it.
## What happens after submitting contribution?
@@ -323,8 +323,8 @@ Having said that, here are the organizational rules:
`make test`.
7. For development use the `--enable-debug` switch to avoid memory leaks and the
- `--enable-maintainer-zts` switch to ensure your code handles TSRM correctly
- and doesn't break for those who need that.
+ `--enable-zts` switch to ensure your code handles TSRM correctly and doesn't
+ break for those who need that.
Currently we have the following branches in use:
@@ -410,8 +410,6 @@ New source code files should include the following header block:
```c
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/EXTENSIONS b/EXTENSIONS
index 754239fbaa..82ef4d5d54 100644
--- a/EXTENSIONS
+++ b/EXTENSIONS
@@ -60,7 +60,7 @@ SINCE: 5.3
-------------------------------------------------------------------------------
EXTENSION: phpdbg
PRIMARY MAINTAINER: Joe Watkins <krakjoe@php.net>, Bob Weinand <bwoebi@php.net>
-MAINTENANCE: Unkown
+MAINTENANCE: Unknown
STATUS: 5.6
-------------------------------------------------------------------------------
@@ -166,7 +166,7 @@ COMMENT: Use PostgreSQL 7.0.x or later. PostgreSQL 6.5.3 or less hav
-------------------------------------------------------------------------------
EXTENSION: sqlite3
PRIMARY MAINTAINER: Scott MacVicar <scottmac@php.net> (2008 - 2011)
- Christoph M. Becker <cmb@php.net> (2016 - 2018)
+ Christoph M. Becker <cmb@php.net> (2016 - 2019)
MAINTENANCE: Maintained
STATUS: Working
SINCE: 5.3
@@ -255,6 +255,7 @@ STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: com_dotnet
PRIMARY MAINTAINER: Wez Furlong <wez@php.net> (2003 - 2005)
+ Christoph M. Becker <cmb@php.net> (2018 - 2019)
MAINTENANCE: Maintained
STATUS: Windows
SINCE: 5.0
@@ -317,7 +318,7 @@ STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: gd
PRIMARY MAINTAINER: Pierre-Alain Joye <pajoye@php.net> (2002 - 2016)
- Christoph M. Becker <cmb@php.net> (2015 - 2018)
+ Christoph M. Becker <cmb@php.net> (2015 - 2019)
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
@@ -327,7 +328,7 @@ MAINTENANCE: Unknown
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: gmp
-PRIMARY MAINTAINER: Stanislav Malyshev <stas@php.net> (2000 - 2018)
+PRIMARY MAINTAINER: Stanislav Malyshev <stas@php.net> (2000 - 2019)
Antony Dovgal <tony2001@php.net> (2005 - 2010)
Nikita Popov <nikic@php.net> (2013 - 2019)
MAINTENANCE: Maintained
@@ -348,7 +349,7 @@ MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: intl
-PRIMARY MAINTAINER: Stanislav Malyshev <stas@php.net> (2008 - 2018)
+PRIMARY MAINTAINER: Stanislav Malyshev <stas@php.net> (2008 - 2019)
Anatol Belski <ab@php.net> (2017 - 2018)
MAINTENANCE: Maintained
STATUS: Working
@@ -358,6 +359,7 @@ EXTENSION: imap
PRIMARY MAINTAINER: Chuck Hagenbuch <chuck@horde.org> (1999 - 2004)
Ilia Alshanetsky <iliaa@php.net> (2002 - 2010)
Pierre-Alain Joye <pajoye@php.net> (2008 - 2010)
+ Bishop Bettini <bishop@php.net> (2018 - 2019)
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
@@ -412,6 +414,7 @@ EXTENSION: phar
PRIMARY MAINTAINER: Greg Beaver <cellog@php.net> (2008 - 2009)
Marcus Börger <helly@php.net> (2008 - 2008)
Steph Fox <sfox@php.net> (2008 - 2008)
+ Bishop Bettini <bishop@php.net> (2018 - 2019)
MAINTENANCE: Maintained
STATUS: Working
SINCE: 5.3
@@ -428,7 +431,7 @@ STATUS: Working
SINCE: 4.0.2
-------------------------------------------------------------------------------
EXTENSION: readline
-PRIMARY MAINTAINER: Unkown
+PRIMARY MAINTAINER: Unknown
MAINTENANCE: Unknown
STATUS: Working
-------------------------------------------------------------------------------
@@ -477,17 +480,17 @@ STATUS: Working
SINCE: 5.0.0
-------------------------------------------------------------------------------
EXTENSION: sysvmsg
-PRIMARY MAINTAINER: Unkown
+PRIMARY MAINTAINER: Unknown
MAINTENANCE: Unknown
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: sysvsem
-PRIMARY MAINTAINER: Unkown
+PRIMARY MAINTAINER: Unknown
MAINTENANCE: Unknown
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: sysvshm
-PRIMARY MAINTAINER: Unkown
+PRIMARY MAINTAINER: Unknown
MAINTENANCE: Unknown
STATUS: Working
-------------------------------------------------------------------------------
diff --git a/NEWS b/NEWS
index 9c2d4a8e5e..a41a74acc4 100644
--- a/NEWS
+++ b/NEWS
@@ -1,561 +1,75 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-
-?? ??? ????, PHP 7.4.4
-
-- Core:
- . Fixed bug #79244 (php crashes during parsing INI file). (Laruence)
-
-- COM:
- . Fixed bug #66322 (COMPersistHelper::SaveToFile can save to wrong location).
- (cmb)
- . Fixed bug #79242 (COM error constants don't match com_exception codes on
- x86). (cmb)
- . Fixed bug #79247 (Garbage collecting variant objects segfaults). (cmb)
- . Fixed bug #79248 (Traversing empty VT_ARRAY throws com_exception). (cmb)
-
-- CURL:
- . Fixed bug #79019 (Copied cURL handles upload empty file). (cmb)
-
-- DOM:
- . Fixed bug #77569: (Write Acess Violation in DomImplementation). (Nikita,
- cmb)
-
-- PCRE:
- . Fixed bug #79188 (Memory corruption in preg_replace/preg_replace_callback
- and unicode). (Nikita)
- . Fixed bug #79241 (Segmentation fault on preg_match()). (Nikita)
- . Fixed bug #79257 (Duplicate named groups (?J) prefer last alternative even
- if not matched). (Nikita)
-
-- Standard:
- . Fixed bug #79254 (getenv() w/o arguments not showing changes). (cmb)
-
-?? ??? ????, PHP 7.4.3
+?? ??? ????, PHP 8.0.0alpha1
- Core:
- . Fixed bug #79146 (cscript can fail to run on some systems). (clarodeus)
- . Fixed bug #79155 (Property nullability lost when using multiple property
- definition). (Nikita)
- . Fixed bug #78323 (Code 0 is returned on invalid options). (Ivan Mikheykin)
- . Fixed bug #78989 (Delayed variance check involving trait segfaults).
+ . Removed the pdo_odbc.db2_instance_name php.ini directive. (Kalle)
+ . Fixed bug #77619 (Wrong reflection on MultipleIterator::__construct).
+ (Fabien Villepinte)
+ . Fixed bug #65274 (Enhance undefined class constant error with class name).
(Nikita)
- . Fixed bug #79174 (cookie values with spaces fail to round-trip). (cmb)
- . Fixed bug #76047 (Use-after-free when accessing already destructed
- backtrace arguments). (Nikita)
+ . Fixed bug #49555 (Fatal error "Function must be a string" message should be
+ renamed). (Nikita)
+ . Fixed bug #70839 (Converting optional argument to variadic forbidden by LSP
+ checks). (Nikita)
- CURL:
- . Fixed bug #79078 (Hypothetical use-after-free in curl_multi_add_handle()).
- (cmb)
-
-- FFI:
- . Fixed bug #79096 (FFI Struct Segfault). (cmb)
-
-- IMAP:
- . Fixed bug #79112 (IMAP extension can't find OpenSSL libraries at configure
- time). (Nikita)
-
- -Intl:
- . Fixed bug #79212 (NumberFormatter::format() may detect wrong type). (cmb)
-
-- Libxml:
- . Fixed bug #79191 (Error in SoapClient ctor disables DOMDocument::save()).
- (Nikita, cmb)
-
-- MBString:
- . Fixed bug #79149 (SEGV in mb_convert_encoding with non-string encodings).
- (cmb)
-
-- MySQLi:
- . Fixed bug #78666 (Properties may emit a warning on var_dump()). (kocsismate)
-
-- MySQLnd:
- . Fixed bug #79084 (mysqlnd may fetch wrong column indexes with MYSQLI_BOTH).
- (cmb)
- . Fixed bug #79011 (MySQL caching_sha2_password Access denied for password
- with more than 20 chars). (Nikita)
-
-- Opcache:
- . Fixed bug #79114 (Eval class during preload causes class to be only half
- available). (Laruence)
- . Fixed bug #79128 (Preloading segfaults if preload_user is used). (Nikita)
- . Fixed bug #79193 (Incorrect type inference for self::$field =& $field).
- (Nikita)
-
-- OpenSSL:
- . Fixed bug #79145 (openssl memory leak). (cmb, Nikita)
-
-- Phar:
- . Fixed bug #76584 (PharFileInfo::decompress not working). (cmb)
-
-- Reflection:
- . Fixed bug #79115 (ReflectionClass::isCloneable call reflected class
- __destruct). (Nikita)
-
-- Standard:
- . Fixed bug #78902 (Memory leak when using stream_filter_append). (liudaixiao)
- . Fixed bug #78969 (PASSWORD_DEFAULT should match PASSWORD_BCRYPT instead of being null). (kocsismate)
-
-- Testing:
- . Fixed bug #78090 (bug45161.phpt takes forever to finish). (cmb)
-
-- XSL:
- . Fixed bug #70078 (XSL callbacks with nodes as parameter leak memory). (cmb)
-
-- Zip:
- . Add ZipArchive::CM_LZMA2 and ZipArchive::CM_XZ constants (since libzip 1.6.0). (Remi)
- . Add ZipArchive::RDONLY (since libzip 1.0.0). (Remi)
- . Add ZipArchive::ER_* missing constants. (Remi)
- . Add ZipArchive::LIBZIP_VERSION constant. (Remi)
- . Fixed bug #73119 (Wrong return for ZipArchive::addEmptyDir Method). (Remi)
-
-23 Jan 2020, PHP 7.4.2
-
-- Core:
- . Preloading support on Windows has been disabled. (Nikita)
- . Fixed bug #79022 (class_exists returns True for classes that are not ready
- to be used). (Laruence)
- . Fixed bug #78929 (plus signs in cookie values are converted to spaces).
- (Alexey Kachalin)
- . Fixed bug #78973 (Destructor during CV freeing causes segfault if opline
- never saved). (Nikita)
- . Fixed bug #78776 (Abstract method implementation from trait does not check
- "static"). (Nikita)
- . Fixed bug #78999 (Cycle leak when using function result as temporary).
- (Dmitry)
- . Fixed bug #79008 (General performance regression with PHP 7.4 on Windows).
- (cmb)
- . Fixed bug #79002 (Serializing uninitialized typed properties with __sleep
- makes unserialize throw). (Nikita)
-
-- CURL:
- . Fixed bug #79033 (Curl timeout error with specific url and post). (cmb)
- . Fixed bug #79063 (curl openssl does not respect PKG_CONFIG_PATH). (Nikita)
+ . Bumped required libcurl version to 7.29.0. (cmb)
- Date:
- . Fixed bug #79015 (undefined-behavior in php_date.c). (cmb)
-
-- DBA:
- . Fixed bug #78808 ([LMDB] MDB_MAP_FULL: Environment mapsize limit reached).
- (cmb)
-
-- Exif:
- . Fixed bug #79046 (NaN to int cast undefined behavior in exif). (Nikita)
-
-- Fileinfo:
- . Fixed bug #74170 (locale information change after mime_content_type).
- (Sergei Turchanov)
-
-- GD:
- . Fixed bug #79067 (gdTransformAffineCopy() may use unitialized values). (cmb)
- . Fixed bug #79068 (gdTransformAffineCopy() changes interpolation method).
+ . Fixed bug #65547 (Default value for sunrise/sunset zenith still wrong).
(cmb)
+ . Fixed bug #69044 (discrepancy between time and microtime). (krakjoe)
-- Libxml:
- . Fixed bug #79029 (Use After Free's in XMLReader / XMLWriter). (Laruence)
-
-- OPcache:
- . Fixed bug #78961 (erroneous optimization of re-assigned $GLOBALS). (Dmitry)
- . Fixed bug #78950 (Preloading trait method with static variables). (Nikita)
- . Fixed bug #78903 (Conflict in RTD key for closures results in crash).
- (Nikita)
- . Fixed bug #78986 (Opcache segfaults when inheriting ctor from immutable
- into mutable class). (Nikita)
- . Fixed bug #79040 (Warning Opcode handlers are unusable due to ASLR). (cmb)
- . Fixed bug #79055 (Typed property become unknown with OPcache file cache).
- (Nikita)
-
-- Pcntl:
- . Fixed bug #78402 (Converting null to string in error message is bad DX).
- (SATÅŒ KentarÅ)
-
-- PDO_PgSQL:
- . Fixed bug #78983 (pdo_pgsql config.w32 cannot find libpq-fe.h). (SATŌ
- KentarÅ)
- . Fixed bug #78980 (pgsqlGetNotify() overlooks dead connection). (SATŌ
- KentarÅ)
- . Fixed bug #78982 (pdo_pgsql returns dead persistent connection). (SATŌ
- KentarÅ)
-
-- Session:
- . Fixed bug #79031 (Session unserialization problem). (Nikita)
-
-- Shmop:
- . Fixed bug #78538 (shmop memory leak). (cmb)
-
-- Sqlite3:
- . Fixed bug #79056 (sqlite does not respect PKG_CONFIG_PATH during
- compilation). (Nikita)
-
-- Spl:
- . Fixed bug #78976 (SplFileObject::fputcsv returns -1 on failure). (cmb)
-
-- Standard:
- . Fixed bug #79000 (Non-blocking socket stream reports EAGAIN as error).
- (Nikita)
- . Fixed bug #54298 (Using empty additional_headers adding extraneous CRLF).
- (cmb)
-
-18 Dec 2019, PHP 7.4.1
-
-- Core:
- . Fixed bug #78810 (RW fetches do not throw "uninitialized property"
- exception). (Nikita)
- . Fixed bug #78868 (Calling __autoload() with incorrect EG(fake_scope) value).
- (Antony Dovgal, Dmitry)
- . Fixed bug #78296 (is_file fails to detect file). (cmb)
- . Fixed bug #78883 (fgets(STDIN) fails on Windows). (cmb)
- . Fixed bug #78898 (call_user_func(['parent', ...]) fails while other
- succeed). (Nikita)
- . Fixed bug #78904 (Uninitialized property triggers __get()). (Nikita)
- . Fixed bug #78926 (Segmentation fault on Symfony cache:clear). (Nikita)
-
-- GD:
- . Fixed bug #78849 (GD build broken with -D SIGNED_COMPARE_SLOW). (cmb)
- . Fixed bug #78923 (Artifacts when convoluting image with transparency).
- (wilson chen)
-
-- FPM:
- . Fixed bug #76601 (Partially working php-fpm ater incomplete reload).
- (Maksim Nikulin)
- . Fixed bug #78889 (php-fpm service fails to start). (Jakub Zelenka)
- . Fixed bug #78916 (php-fpm 7.4.0 don't send mail via mail()).
- (Jakub Zelenka)
-
-- Intl:
- . Implemented FR #78912 (INTL Support for accounting format). (cmb)
-
-- Mysqlnd:
- . Fixed bug #78823 (ZLIB_LIBS not added to EXTRA_LIBS). (Arjen de Korte)
-
-- OPcache:
- . Fixed $x = (bool)$x; with opcache (should emit undeclared variable notice).
- (Tyson Andre)
- . Fixed bug #78935 (Preloading removes classes that have dependencies).
- (Nikita, Dmitry)
-
-- PCRE:
- . Fixed bug #78853 (preg_match() may return integer > 1). (cmb)
-
-- Reflection:
- . Fixed bug #78895 (Reflection detects abstract non-static class as abstract
- static. IS_IMPLICIT_ABSTRACT is not longer used). (Dmitry)
-
-- Standard:
- . Fixed bug #77638 (var_export'ing certain class instances segfaults). (cmb)
- . Fixed bug #78840 (imploding $GLOBALS crashes). (cmb)
- . Fixed bug #78833 (Integer overflow in pack causes out-of-bound access).
- (cmb)
- . Fixed bug #78814 (strip_tags allows / in tag name => whitelist bypass).
- (cmb)
-
-28 Nov 2019, PHP 7.4.0
-
-- Core:
- . Implemented RFC: Deprecate curly brace syntax for accessing array elements
- and string offsets.
- https://wiki.php.net/rfc/deprecate_curly_braces_array_access (Andrey Gromov)
- . Implemented RFC: Deprecations for PHP 7.4.
- https://wiki.php.net/rfc/deprecations_php_7_4 (Kalle, Nikita)
- . Fixed bug #52752 (Crash when lexing). (Nikita)
- . Fixed bug #60677 (CGI doesn't properly validate shebang line contains #!).
- (Nikita)
- . Fixed bug #71030 (Self-assignment in list() may have inconsistent behavior).
- (Nikita)
- . Fixed bug #72530 (Use After Free in GC with Certain Destructors). (Nikita)
- . Fixed bug #75921 (Inconsistent: No warning in some cases when stdObj is
- created on the fly). (David Walker)
- . Implemented FR #76148 (Add array_key_exists() to the list of specially
- compiled functions). (Majkl578)
- . Fixed bug #76430 (__METHOD__ inconsistent outside of method).
- (Ryan McCullagh, Nikita)
- . Fixed bug #76451 (Aliases during inheritance type checks affected by
- opcache). (Nikita)
- . Implemented FR #77230 (Support custom CFLAGS and LDFLAGS from environment).
- (cmb)
- . Fixed bug #77345 (Stack Overflow caused by circular reference in garbage
- collection). (Alexandru Patranescu, Nikita, Dmitry)
- . Fixed bug #77812 (Interactive mode does not support PHP 7.3-style heredoc).
- (cmb, Nikita)
- . Fixed bug #77877 (call_user_func() passes $this to static methods).
- (Dmitry)
- . Fixed bug #78066 (PHP eats the first byte of a program that comes from
- process substitution). (Nikita)
- . Fixed bug #78151 (Segfault caused by indirect expressions in PHP 7.4a1).
- (Nikita)
- . Fixed bug #78154 (SEND_VAR_NO_REF does not always send reference). (Nikita)
- . Fixed bug #78182 (Segmentation fault during by-reference property
- assignment). (Nikita)
- . Fixed bug #78212 (Segfault in built-in webserver). (cmb)
- . Fixed bug #78220 (Can't access OneDrive folder). (cmb, ab)
- . Fixed bug #78226 (Unexpected __set behavior with typed properties). (Nikita)
- . Fixed bug #78239 (Deprecation notice during string conversion converted to
- exception hangs). (Nikita)
- . Fixed bug #78335 (Static properties/variables containing cycles report as
- leak). (Nikita)
- . Fixed bug #78340 (Include of stream wrapper not reading whole file).
- (Nikita)
- . Fixed bug #78344 (Segmentation fault on zend_check_protected). (Nikita)
- . Fixed bug #78356 (Array returned from ArrayAccess is incorrectly unpacked
- as argument). (Nikita)
- . Fixed bug #78379 (Cast to object confuses GC, causes crash). (Dmitry)
- . Fixed bug #78386 (fstat mode has unexpected value on PHP 7.4). (cmb)
- . Fixed bug #78396 (Second file_put_contents in Shutdown hangs script).
- (Nikita)
- . Fixed bug #78406 (Broken file includes with user-defined stream filters).
- (Nikita)
- . Fixed bug #78438 (Corruption when __unserializing deeply nested structures).
- (cmb, Nikita)
- . Fixed bug #78441 (Parse error due to heredoc identifier followed by digit).
- (cmb)
- . Fixed bug #78454 (Consecutive numeric separators cause OOM error).
- (Theodore Brown)
- . Fixed bug #78460 (PEAR installation failure). (Peter Kokot, L. Declercq)
- . Fixed bug #78531 (Crash when using undefined variable as object). (Dmitry)
- . Fixed bug #78535 (auto_detect_line_endings value not parsed as bool).
- (bugreportuser)
- . Fixed bug #78604 (token_get_all() does not properly tokenize FOO<?php with
- short_open_tag=0). (Nikita)
- . Fixed bug #78614 (Does not compile with DTRACE anymore).
- (tz at FreeBSD dot org)
- . Fixed bug #78620 (Out of memory error). (cmb, Nikita)
- . Fixed bug #78632 (method_exists() in php74 works differently from php73 in
- checking priv. methods). (Nikita)
- . Fixed bug #78644 (SEGFAULT in ZEND_UNSET_OBJ_SPEC_VAR_CONST_HANDLER).
- (Nikita)
- . Fixed bug #78658 (Memory corruption using Closure::bindTo). (Nikita)
- . Fixed bug #78656 (Parse errors classified as highest log-level). (Erik
- Lundin)
- . Fixed bug #78662 (stream_write bad error detection). (Remi)
- . Fixed bug #78768 (redefinition of typedef zend_property_info). (Nikita)
- . Fixed bug #78788 (./configure generates invalid php_version.h). (max)
- . Fixed incorrect usage of QM_ASSIGN instruction. It must not return IS_VAR.
- As a side effect, this allowed passing left hand list() "by reference",
- instead of compile-time error. (Dmitry)
-
-- CLI:
- . The built-in CLI server now reports the request method in log files.
- (Simon Welsh)
-
-- COM:
- . Deprecated registering of case-insensitive constants from typelibs. (cmb)
- . Fixed bug #78650 (new COM Crash). (cmb)
- . Fixed bug #78694 (Appending to a variant array causes segfault). (cmb)
-
-- CURL:
- . Fixed bug #76480 (Use curl_multi_wait() so that timeouts are respected).
- (Pierrick)
- . Implemented FR #77711 (CURLFile should support UNICODE filenames). (cmb)
- . Deprecated CURLPIPE_HTTP1. (cmb)
- . Deprecated $version parameter of curl_version(). (cmb)
-
-- Date:
- . Updated timelib to 2018.02. (Derick)
- . Fixed bug #69044 (discrepency between time and microtime). (krakjoe)
- . Fixed bug #70153 (\DateInterval incorrectly unserialized). (Maksim Iakunin)
- . Fixed bug #75232 (print_r of DateTime creating side-effect). (Nikita)
- . Fixed bug #78383 (Casting a DateTime to array no longer returns its
- properties). (Nikita)
- . Fixed bug #78751 (Serialising DatePeriod converts DateTimeImmutable). (cmb)
-
-- Exif:
- . Fixed bug #78333 (Exif crash (bus error) due to wrong alignment and
- invalid cast). (Nikita)
- . Fixed bug #78256 (heap-buffer-overflow on exif_process_user_comment).
- (CVE-2019-11042) (Stas)
- . Fixed bug #78222 (heap-buffer-overflow on exif_scan_thumbnail).
- (CVE-2019-11041) (Stas)
-
-- Fileinfo:
- . Fixed bug #78075 (finfo_file treats JSON file as text/plain). (Anatol)
- . Fixed bug #78183 (finfo_file shows wrong mime-type for .tga file).
- (Anatol)
-
-- Filter:
- . The filter extension no longer has the --with-pcre-dir on Unix builds,
- allowing the extension to be once more compiled as shared using
- ./configure. (Kalle)
-
-- FFI:
- . Added FFI extension. (Dmitry)
- . Fixed bug #78488 (OOB in ZEND_FUNCTION(ffi_trampoline)). (Dmitry)
- . Fixed bug #78543 (is_callable() on FFI\CData throws Exception). (cmb)
- . Fixed bug #78716 (Function name mangling is wrong for some parameter
- types). (cmb)
- . Fixed bug #78762 (Failing FFI::cast() may leak memory). (cmb)
- . Fixed bug #78761 (Zend memory heap corruption with preload and casting).
- (cmb)
- . Implement FR #78270 (Support __vectorcall convention with FFI). (cmb)
- . Added missing FFI::isNull(). (Philip Hofstetter)
+- DOM:
+ . Add property DOMXPath::$registerNodeNamespaces and constructor argument
+ that allow global flag to configure query() or evaluate() calls.
- FPM:
- . Implemented FR #72510 (systemd service should be hardened). (Craig Andrews)
- . Fixed bug #74083 (master PHP-fpm is stopped on multiple reloads).
- (Maksim Nikulin)
- . Fixed bug #78334 (fpm log prefix message includes wrong stdout/stderr
- notation). (Tsuyoshi Sadakata)
- . Fixed bug #78599 (env_path_info underflow in fpm_main.c can lead to RCE).
- (CVE-2019-11043) (Jakub Zelenka)
+ . Fixed bug #64865 (Search for .user.ini files from script dir up to
+ CONTEXT_DOCUMENT_ROOT). (Will Bender)
- GD:
- . Implemented the scatter filter (IMG_FILTER_SCATTER). (Kalle)
- . The bundled libgd behaves now like system libgd wrt. IMG_CROP_DEFAULT never
- falling back to IMG_CROP_SIDES.
- . The default $mode parameter of imagecropauto() has been changed to
- IMG_CROP_DEFAULT; passing -1 is now deprecated.
- . Added support for aspect ratio preserving scaling to a fixed height for
- imagescale(). (Andreas Treichel)
- . Added TGA read support. (cmb)
- . Fixed bug #73291 (imagecropauto() $threshold differs from external libgd).
- (cmb)
- . Fixed bug #76324 (cannot detect recent versions of freetype with
- pkg-config). (Eli Schwartz)
- . Fixed bug #78314 (missing freetype support/functions with external gd).
- (Remi)
-
-- GMP:
- . Fixed bug #78574 (broken shared build). (Remi)
-
-- Hash:
- . The hash extension is now an integral part of PHP and cannot be disabled
- as per RFC: https://wiki.php.net/rfc/permanent_hash_ext. (Kalle)
- . Implemented FR #71890 (crc32c checksum algorithm). (Andrew Brampton)
-
-- Iconv:
- . Fixed bug #78342 (Bus error in configure test for iconv //IGNORE). (Rainer
- Jung)
- . Fixed bug #78642 (Wrong libiconv version displayed). (gedas at martynas,
- cmb).
-
-- Libxml:
- . Fixed bug #78279 (libxml_disable_entity_loader settings is shared between
- requests (cgi-fcgi)). (Nikita)
-
-- InterBase:
- . Unbundled the InterBase extension and moved it to PECL. (Kalle)
+ . Fixed bug #55005 (imagepolygon num_points requirement). (cmb)
+ . Replaced gd resources with objects. (Mark Randall)
+ . Made the $num_points parameter of php_imagepolygon optional. (cmb)
+ . Removed deprecated image2wbmp(). (cmb)
+ . Removed deprecated png2wbmp() and jpeg2wbmp(). (cmb)
+ . Added imagegetinterpolation(). (cmb)
- Intl:
- . Raised requirements to ICU ≥ 50.1. (cmb)
- . Changed ResourceBundle to implement Countable. (LeSuisse)
- . Changed default of $variant parameter of idn_to_ascii() and idn_to_utf8().
- (cmb)
+ . Removed deprecated INTL_IDNA_VARIANT_2003. (cmb)
-- LDAP:
- . Deprecated ldap_control_paged_result_response and ldap_control_paged_result
+- JIT:
+ . Fixed bug #77857 (Wrong result if executed with JIT). (Laruence)
-- LiteSpeed:
- . Updated to LiteSpeed SAPI V7.5 (Fixed clean shutdown). (George Wang)
- . Updated to LiteSpeed SAPI V7.4.3 (increased response header count limit from
- 100 to 1000, added crash handler to cleanly shutdown PHP request, added
- CloudLinux mod_lsapi mode). (George Wang)
- . Fixed bug #76058 (After "POST data can't be buffered", using php://input
- makes huge tmp files). (George Wang)
+- LDAP:
+ . Removed deprecated ldap_sort. (mcmic)
- MBString:
- . Fixed bug #77907 (mb-functions do not respect default_encoding). (Nikita)
- . Fixed bug #78579 (mb_decode_numericentity: args number inconsistency).
- (cmb)
- . Fixed bug #78609 (mb_check_encoding() no longer supports stringable
- objects). (cmb)
+ . Removed the unused $is_hex parameter from mb_decode_numericentity(). (cmb)
- MySQLi:
- . Fixed bug #67348 (Reading $dbc->stat modifies $dbc->affected_rows).
- (Derick)
. Fixed bug #76809 (SSL settings aren't respected when persistent connections
are used). (fabiomsouto)
- . Fixed bug #78179 (MariaDB server version incorrectly detected). (cmb)
- . Fixed bug #78213 (Empty row pocket). (cmb)
-
-- MySQLnd:
- . Fixed connect_attr issues and added the _server_host connection attribute.
- (Qianqian Bu)
- . Fixed bug #60594 (mysqlnd exposes 160 lines of stats in phpinfo). (PeeHaa)
-- ODBC:
- . Fixed bug #78473 (odbc_close() closes arbitrary resources). (cmb)
+- mysqlnd:
+ . Fixed #60594 (mysqlnd exposes 160 lines of stats in phpinfo). (PeeHaa)
-- Opcache:
- . Implemented preloading RFC: https://wiki.php.net/rfc/preload. (Dmitry)
- . Add opcache.preload_user INI directive. (Dmitry)
- . Added new INI directive opcache.cache_id (Windows only). (cmb)
- . Fixed bug #78106 (Path resolution fails if opcache disabled during request).
- (Nikita)
- . Fixed bug #78175 (Preloading segfaults at preload time and at runtime).
- (Dmitry)
- . Fixed bug #78202 (Opcache stats for cache hits are capped at 32bit NUM).
- (cmb)
- . Fixed bug #78271 (Invalid result of if-else). (Nikita)
- . Fixed bug #78341 (Failure to detect smart branch in DFA pass). (Nikita)
- . Fixed bug #78376 (Incorrect preloading of constant static properties).
- (Dmitry)
- . Fixed bug #78429 (opcache_compile_file(__FILE__); segfaults). (cmb)
- . Fixed bug #78512 (Cannot make preload work). (Dmitry)
- . Fixed bug #78514 (Preloading segfaults with inherited typed property).
- (Nikita)
+- OpCache:
. Fixed bug #78654 (Incorrectly computed opcache checksum on files with
non-ascii characters). (mhagstrand)
-- OpenSSL:
- . Added TLS 1.3 support to streams including new tlsv1.3 stream.
- (Codarren Velvindron, Jakub Zelenka)
- . Added openssl_x509_verify function. (Ben Scholzen)
- . openssl_random_pseudo_bytes() now throws in error conditions.
- (Sammy Kaye Powers)
- . Changed the default config path (Windows only). (cmb)
- . Fixed bug #78231 (Segmentation fault upon stream_socket_accept of exported
- socket-to-stream). (Nikita)
- . Fixed bug #78391 (Assertion failure in openssl_random_pseudo_bytes).
- (Nikita)
- . Fixed bug #78775 (TLS issues from HTTP request affecting other encrypted
- connections). (Nikita)
-
-- Pcntl:
- . Fixed bug #77335 (PHP is preventing SIGALRM from specifying SA_RESTART).
- (Nikita)
-
- PCRE:
- . Implemented FR #77094 (Support flags in preg_replace_callback). (Nikita)
- . Fixed bug #72685 (Repeated UTF-8 validation of same string in UTF-8 mode).
- (Nikita)
- . Fixed bug #73948 (Preg_match_all should return NULLs on trailing optional
- capture groups).
- . Fixed bug #78338 (Array cross-border reading in PCRE). (cmb)
- . Fixed bug #78349 (Bundled pcre2 library missing LICENCE file). (Peter Kokot)
+ . Don't ignore invalid escape sequences. (sjon)
- PDO:
- . Implemented FR #71885 (Allow escaping question mark placeholders).
- https://wiki.php.net/rfc/pdo_escape_placeholders (Matteo)
. Fixed bug #77849 (Disable cloning of PDO handle/connection objects).
(camporter)
- . Implemented FR #78033 (PDO - support username & password specified in
- DSN). (sjon)
-
-- PDO_Firebird:
- . Implemented FR #65690 (PDO_Firebird should also support dialect 1).
- (Simonov Denis)
- . Implemented FR #77863 (PDO firebird support type Boolean in input
- parameters). (Simonov Denis)
-
-- PDO_MySQL:
- . Fixed bug #41997 (SP call yields additional empty result set). (cmb)
- . Fixed bug #78623 (Regression caused by "SP call yields additional empty
- result set"). (cmb)
- PDO_OCI:
- . Support Oracle Database tracing attributes ACTION, MODULE,
- CLIENT_INFO, and CLIENT_IDENTIFIER. (Cameron Porter)
- . Implemented FR #76908 (PDO_OCI getColumnMeta() not implemented).
- (Valentin Collet, Chris Jones, Remi)
-
-- PDO_SQLite:
- . Implemented sqlite_stmt_readonly in PDO_SQLite. (BohwaZ)
- . Raised requirements to SQLite 3.5.0. (cmb)
- . Fixed bug #78192 (SegFault when reuse statement after schema has changed).
- (Vincent Quatrevieux)
- . Fixed bug #78348 (Remove -lrt from pdo_sqlite.so). (Peter Kokot)
-
-- Phar:
- . Fixed bug #77919 (Potential UAF in Phar RSHUTDOWN). (cmb)
+ . Added support for setting and getting the oracle OCI 18c call timeout.
+ (camporter)
- phpdbg:
. Fixed bug #76596 (phpdbg support for display_errors=stderr). (kabel)
@@ -564,1203 +78,50 @@ PHP NEWS
(krakjoe)
. Fixed bug #77805 (phpdbg build fails when readline is shared). (krakjoe)
-- Recode:
- . Unbundled the recode extension. (cmb)
-
- Reflection:
- . Fixed bug #76737 (Unserialized reflection objects are broken, they
- shouldn't be serializable). (Nikita)
- . Fixed bug #78263 (\ReflectionReference::fromArrayElement() returns null
- while item is a reference). (Nikita)
- . Fixed bug #78410 (Cannot "manually" unserialize class that is final and
- extends an internal one). (Nikita)
. Fixed bug #78697 (ReflectionClass::implementsInterface - inaccurate error
message with traits). (villfa)
- . Fixed bug #78774 (ReflectionNamedType on Typed Properties Crash). (Nikita)
+ . Implement ReflectionProperty::hasDefaultValue and
+ Reflection::getDefaultValue (beberlei)
- Session:
. Fixed bug #78624 (session_gc return value for user defined session
handlers). (bshaffer)
- SimpleXML:
- . Implemented FR #65215 (SimpleXMLElement could register as implementing
- Countable). (LeSuisse)
. Fixed bug #75245 (Don't set content of elements with only whitespaces).
(eriklundin)
-- Sockets:
- . Fixed bug #67619 (Validate length on socket_write). (thiagooak)
- . Fixed bug #78665 (Multicasting may leak memory). (cmb)
-
- sodium:
. Fixed bug #77646 (sign_detached() strings not terminated). (Frank)
- . Fixed bug #78510 (Partially uninitialized buffer returned by
- sodium_crypto_generichash_init()). (Frank Denis, cmb)
- . Fixed bug #78516 (password_hash(): Memory cost is not in allowed range).
- (cmb, Nikita)
-
-- SPL:
- . Fixed bug #77518 (SeekableIterator::seek() should accept 'int' typehint as
- documented). (Nikita)
- . Fixed bug #78409 (Segfault when creating instance of ArrayIterator without
- constructor). (Nikita)
- . Fixed bug #78436 (Missing addref in SplPriorityQueue EXTR_BOTH mode).
- (Nikita)
- . Fixed bug #78456 (Segfault when serializing SplDoublyLinkedList). (Nikita)
- SQLite3:
- . Unbundled libsqlite. (cmb)
- . Raised requirements to SQLite 3.7.4. (cmb)
- . Forbid (un)serialization of SQLite3, SQLite3Stmt and SQLite3Result. (cmb)
- . Added support for the SQLite @name notation. (cmb, BohwaZ)
- . Added SQLite3Stmt::getSQL() to retrieve the SQL of the statement. (Bohwaz)
- . Implement FR ##70950 (Make SQLite3 Online Backup API available). (BohwaZ)
-
-- Standard:
- . Implemented password hashing registry RFC:
- https://wiki.php.net/rfc/password_registry. (Sara)
- . Implemented RFC where password_hash() has argon2i(d) implementations from
- ext/sodium when PHP is built without libargon:
- https://wiki.php.net/rfc/sodium.argon.hash (Sara)
- . Implemented FR #38301 (field enclosure behavior in fputcsv). (cmb)
- . Implemented FR #51496 (fgetcsv should take empty string as an escape). (cmb)
- . Fixed bug #73535 (php_sockop_write() returns 0 on error, can be used to
- trigger Denial of Service). (Nikita)
- . Fixed bug #74764 (Bindto IPv6 works with file_get_contents but fails with
- stream_socket_client). (Ville Hukkamäki)
- . Fixed bug #76859 (stream_get_line skips data if used with data-generating
- filter). (kkopachev)
- . Implemented FR #77377 (No way to handle CTRL+C in Windows). (Anatol)
- . Fixed bug #77930 (stream_copy_to_stream should use mmap more often).
- (Nikita)
- . Implemented FR #78177 (Make proc_open accept command array). (Nikita)
- . Fixed bug #78208 (password_needs_rehash() with an unknown algo should always
- return true). (Sara)
- . Fixed bug #78241 (touch() does not handle dates after 2038 in PHP 64-bit). (cmb)
- . Fixed bug #78282 (atime and mtime mismatch). (cmb)
- . Fixed bug #78326 (improper memory deallocation on stream_get_contents()
- with fixed length buffer). (Albert Casademont)
- . Fixed bug #78346 (strip_tags no longer handling nested php tags). (cmb)
- . Fixed bug #78506 (Error in a php_user_filter::filter() is not reported).
- (Nikita)
- . Fixed bug #78549 (Stack overflow due to nested serialized input). (Nikita)
- . Fixed bug #78759 (array_search in $GLOBALS). (Nikita)
-
-- Testing:
- . Fixed bug #78684 (PCRE bug72463_2 test is sending emails on Linux). (cmb)
-
-- Tidy:
- . Added TIDY_TAG_* constants for HTML5 elements. (cmb)
- . Fixed bug #76736 (wrong reflection for tidy_get_head, tidy_get_html,
- tidy_get_root, and tidy_getopt) (tandre)
-
-- WDDX:
- . Deprecated and unbundled the WDDX extension. (cmb)
-
-- Zip:
- . Fixed bug #78641 (addGlob can modify given remove_path value). (cmb)
-
-21 Nov 2019, PHP 7.3.12
-
-- Core:
- . Fixed bug #78658 (Memory corruption using Closure::bindTo). (Nikita)
- . Fixed bug #78656 (Parse errors classified as highest log-level). (Erik
- Lundin)
- . Fixed bug #78752 (Segfault if GC triggered while generator stack frame is
- being destroyed). (Nikita)
- . Fixed bug #78689 (Closure::fromCallable() doesn't handle
- [Closure, '__invoke']). (Nikita)
-
-- COM:
- . Fixed bug #78694 (Appending to a variant array causes segfault). (cmb)
-
-- Date:
- . Fixed bug #70153 (\DateInterval incorrectly unserialized). (Maksim Iakunin)
- . Fixed bug #78751 (Serialising DatePeriod converts DateTimeImmutable). (cmb)
-
-- Iconv:
- . Fixed bug #78642 (Wrong libiconv version displayed). (gedas at martynas,
- cmb).
-
-- OpCache:
- . Fixed bug #78654 (Incorrectly computed opcache checksum on files with
- non-ascii characters). (mhagstrand)
- . Fixed bug #78747 (OpCache corrupts custom extension result). (Nikita)
-
-- OpenSSL:
- . Fixed bug #78775 (TLS issues from HTTP request affecting other encrypted
- connections). (Nikita)
-
-- Reflection:
- . Fixed bug #78697 (ReflectionClass::ImplementsInterface - inaccurate error
- message with traits). (villfa)
-
-- Sockets:
- . Fixed bug #78665 (Multicasting may leak memory). (cmb)
-
-24 Oct 2019, PHP 7.3.11
-
-- Core:
- . Fixed bug #78535 (auto_detect_line_endings value not parsed as bool).
- (bugreportuser)
- . Fixed bug #78620 (Out of memory error). (cmb, Nikita)
-
-- Exif :
- . Fixed bug #78442 ('Illegal component' on exif_read_data since PHP7)
- (Kalle)
-
-- FPM:
- . Fixed bug #78599 (env_path_info underflow in fpm_main.c can lead to RCE).
- (CVE-2019-11043) (Jakub Zelenka)
- . Fixed bug #78413 (request_terminate_timeout does not take effect after
- fastcgi_finish_request). (Sergei Turchanov)
-
-- MBString:
- . Fixed bug #78633 (Heap buffer overflow (read) in mb_eregi). (cmb)
- . Fixed bug #78579 (mb_decode_numericentity: args number inconsistency).
- (cmb)
- . Fixed bug #78609 (mb_check_encoding() no longer supports stringable
- objects). (cmb)
-
-- MySQLi:
- . Fixed bug #76809 (SSL settings aren't respected when persistent connections
- are used). (fabiomsouto)
-
-- Mysqlnd:
- . Fixed bug #78525 (Memory leak in pdo when reusing native prepared
- statements). (Nikita)
-
-- PCRE:
- . Fixed bug #78272 (calling preg_match() before pcntl_fork() will freeze
- child process). (Nikita)
-
-- PDO_MySQL:
- . Fixed bug #78623 (Regression caused by "SP call yields additional empty
- result set"). (cmb)
-
-- Session:
- . Fixed bug #78624 (session_gc return value for user defined session
- handlers). (bshaffer)
+ . Added SQLite3::setAuthorizer() and respective class constants. (bohwaz)
- Standard:
- . Fixed bug #76342 (file_get_contents waits twice specified timeout).
- (Thomas Calvet)
- . Fixed bug #78612 (strtr leaks memory when integer keys are used and the
- subject string shorter). (Nikita)
+ . Implemented FR #78638 (__PHP_Incomplete_Class should be final). (Laruence)
+ . Fixed bug #77204 (getimagesize(): Read error! should mention file path).
+ (peter279k)
. Fixed bug #76859 (stream_get_line skips data if used with data-generating
filter). (kkopachev)
+ . Fixed bug #78385 (parse_url() does not include 'query' when question mark
+ is the last char). (Islam Israfilov)
-- Zip:
- . Fixed bug #78641 (addGlob can modify given remove_path value). (cmb)
-
-26 Sep 2019, PHP 7.3.10
-
-- Core:
- . Fixed bug #78220 (Can't access OneDrive folder). (cmb, ab)
- . Fixed bug #77922 (Double release of doc comment on inherited shadow
- property). (Nikita)
- . Fixed bug #78441 (Parse error due to heredoc identifier followed by digit).
- (cmb)
- . Fixed bug #77812 (Interactive mode does not support PHP 7.3-style heredoc).
- (cmb, Nikita)
-
-- FastCGI:
- . Fixed bug #78469 (FastCGI on_accept hook is not called when using named
- pipes on Windows). (Sergei Turchanov)
-
-- FPM:
- . Fixed bug #78334 (fpm log prefix message includes wrong stdout/stderr
- notation). (Tsuyoshi Sadakata)
-
-- Intl:
- . Ensure IDNA2003 rules are used with idn_to_ascii() and idn_to_utf8()
- when requested. (Sara)
-
-- MBString:
- . Fixed bug #78559 (Heap buffer overflow in mb_eregi). (cmb)
-
-- MySQLnd:
- . Fixed connect_attr issues and added the _server_host connection attribute.
- (Qianqian Bu)
-
-- ODBC:
- . Fixed bug #78473 (odbc_close() closes arbitrary resources). (cmb)
-
-- PDO_MySQL:
- . Fixed bug #41997 (SP call yields additional empty result set). (cmb)
-
-- sodium:
- . Fixed bug #78510 (Partially uninitialized buffer returned by
- sodium_crypto_generichash_init()). (Frank Denis, cmb)
-
-29 Aug 2019, PHP 7.3.9
-
-- Core:
- . Fixed bug #78363 (Buffer overflow in zendparse). (Nikita)
- . Fixed bug #78379 (Cast to object confuses GC, causes crash). (Dmitry)
- . Fixed bug #78412 (Generator incorrectly reports non-releasable $this as GC
- child). (Nikita)
-
-- Curl:
- . Fixed bug #77946 (Bad cURL resources returned by curl_multi_info_read()).
- (Abyr Valg)
-
-- Exif:
- . Fixed bug #78333 (Exif crash (bus error) due to wrong alignment and
- invalid cast). (Nikita)
-
-- FPM:
- . Fixed bug #77185 (Use-after-free in FPM master event handling).
- (Maksim Nikulin)
-
-- Iconv:
- . Fixed bug #78342 (Bus error in configure test for iconv //IGNORE). (Rainer
- Jung)
-
-- LiteSpeed:
- . Updated to LiteSpeed SAPI V7.5 (Fixed clean shutdown). (George Wang)
-
-- MBString:
- . Fixed bug #78380 (Oniguruma 6.9.3 fixes CVEs). (CVE-2019-13224) (Stas)
-
-- MySQLnd:
- . Fixed bug #78179 (MariaDB server version incorrectly detected). (cmb)
- . Fixed bug #78213 (Empty row pocket). (cmb)
-
-- Opcache:
- . Fixed bug #77191 (Assertion failure in dce_live_ranges() when silencing is
- used). (Nikita)
-
-- Standard:
- . Fixed bug #69100 (Bus error from stream_copy_to_stream (file -> SSL stream)
- with invalid length). (Nikita)
- . Fixed bug #78282 (atime and mtime mismatch). (cmb)
- . Fixed bug #78326 (improper memory deallocation on stream_get_contents()
- with fixed length buffer). (Albert Casademont)
- . Fixed bug #78346 (strip_tags no longer handling nested php tags). (cmb)
-
-01 Aug 2019, PHP 7.3.8
-
-- Core:
- . Added syslog.filter=raw option. (Erik Lundin)
- . Fixed bug #78212 (Segfault in built-in webserver). (cmb)
-
-- Date:
- . Fixed bug #69044 (discrepency between time and microtime). (krakjoe)
- . Updated timelib to 2018.02. (Derick)
-
-- EXIF:
- . Fixed bug #78256 (heap-buffer-overflow on exif_process_user_comment).
- (CVE-2019-11042) (Stas)
- . Fixed bug #78222 (heap-buffer-overflow on exif_scan_thumbnail).
- (CVE-2019-11041) (Stas)
-
-- FTP:
- . Fixed bug #78039 (FTP with SSL memory leak). (Nikita)
-
-- Libxml:
- . Fixed bug #78279 (libxml_disable_entity_loader settings is shared between
- requests (cgi-fcgi)). (Nikita)
-
-- LiteSpeed:
- . Updated to LiteSpeed SAPI V7.4.3 (increased response header count limit from
- 100 to 1000, added crash handler to cleanly shutdown PHP request, added
- CloudLinux mod_lsapi mode). (George Wang)
- . Fixed bug #76058 (After "POST data can't be buffered", using php://input
- makes huge tmp files). (George Wang)
-
-- Openssl:
- . Fixed bug #78231 (Segmentation fault upon stream_socket_accept of exported
- socket-to-stream). (Nikita)
-
-- Opcache:
- . Fixed bug #78189 (file cache strips last character of uname hash). (cmb)
- . Fixed bug #78202 (Opcache stats for cache hits are capped at 32bit NUM).
+- tidy:
+ . Removed the unused $use_include_path parameter from tidy_repair_string().
(cmb)
- . Fixed bug #78271 (Invalid result of if-else). (Nikita)
- . Fixed bug #78291 (opcache_get_configuration doesn't list all directives).
- (Andrew Collington)
- . Fixed bug #78341 (Failure to detect smart branch in DFA pass). (Nikita)
-
-- PCRE:
- . Fixed bug #78197 (PCRE2 version check in configure fails for "##.##-xxx"
- version strings). (pgnet, Peter Kokot)
- . Fixed bug #78338 (Array cross-border reading in PCRE). (cmb)
-
-- PDO_Sqlite:
- . Fixed bug #78192 (SegFault when reuse statement after schema has changed).
- (Vincent Quatrevieux)
-- Phar:
- . Fixed bug #77919 (Potential UAF in Phar RSHUTDOWN). (cmb)
-
-- Phpdbg:
- . Fixed bug #78297 (Include unexistent file memory leak). (Nikita)
-
-- SQLite:
- . Upgraded to SQLite 3.28.0. (cmb)
-
-- Standard:
- . Fixed bug #78241 (touch() does not handle dates after 2038 in PHP 64-bit). (cmb)
- . Fixed bug #78269 (password_hash uses weak options for argon2). (Remi)
-
-04 Jul 2019, PHP 7.3.7
-
-- Core:
- . Fixed bug #76980 (Interface gets skipped if autoloader throws an exception).
- (Nikita)
+- XML:
+ . Fixed bug #76874 (xml_parser_free() should never leak memory). (Nikita)
-- DOM:
- . Fixed bug #78025 (segfault when accessing properties of DOMDocumentType).
+- XMLWriter:
+ . Changed functions to accept/return XMLWriter objects instead of resources.
(cmb)
-- MySQLi:
- . Fixed bug #77956 (When mysqli.allow_local_infile = Off, use a meaningful
- error message). (Sjon Hortensius)
- . Fixed bug #38546 (bindParam incorrect processing of bool types).
- (camporter)
-
-- MySQLnd:
- . Fixed bug #77955 (Random segmentation fault in mysqlnd from php-fpm).
- (Nikita)
-
-- Opcache:
- . Fixed bug #78015 (Incorrect evaluation of expressions involving partials
- arrays in SCCP). (Nikita)
- . Fixed bug #78106 (Path resolution fails if opcache disabled during request).
- (Nikita)
-
-- OpenSSL:
- . Fixed bug #78079 (openssl_encrypt_ccm.phpt fails with OpenSSL 1.1.1c).
- (Jakub Zelenka)
-
-- phpdbg:
- . Fixed bug #78050 (SegFault phpdbg + opcache on include file twice).
- (Nikita)
-
-- Sockets:
- . Fixed bug #78038 (Socket_select fails when resource array contains
- references). (Nikita)
-
-- Sodium:
- . Fixed bug #78114 (segfault when calling sodium_* functions from eval). (cmb)
-
-- Standard:
- . Fixed bug #77135 (Extract with EXTR_SKIP should skip $this).
- (Craig Duncan, Dmitry)
- . Fixed bug #77937 (preg_match failed). (cmb, Anatol)
-
- Zip:
- . Fixed bug #76345 (zip.h not found). (Michael Maroszek)
-
-30 May 2019, PHP 7.3.6
-
-- cURL:
- . Implemented FR #72189 (Add missing CURL_VERSION_* constants). (Javier
- Spagnoletti)
-
-- Date:
- . Fixed bug #77909 (DatePeriod::__construct() with invalid recurrence count
- value). (Ignace Nyamagana Butera)
-
-- EXIF:
- . Fixed bug #77988 (heap-buffer-overflow on php_jpg_get16).
- (CVE-2019-11040) (Stas)
-
-- FPM:
- . Fixed bug #77934 (php-fpm kill -USR2 not working). (Jakub Zelenka)
- . Fixed bug #77921 (static.php.net doesn't work anymore). (Peter Kokot)
-
-- GD:
- . Fixed bug #77943 (imageantialias($image, false); does not work). (cmb)
- . Fixed bug #77973 (Uninitialized read in gdImageCreateFromXbm).
- (CVE-2019-11038) (cmb)
-
-- Iconv:
- . Fixed bug #78069 (Out-of-bounds read in iconv.c:_php_iconv_mime_decode()
- due to integer overflow). (CVE-2019-11039). (maris dot adam)
-
-- JSON:
- . Fixed bug #77843 (Use after free with json serializer). (Nikita)
-
-- Opcache:
- . Fixed possible crashes, because of inconsistent PCRE cache and opcache
- SHM reset. (Alexey Kalinin, Dmitry)
-
-- PDO_MySQL:
- . Fixed bug #77944 (Wrong meta pdo_type for bigint on LLP64). (cmb)
-
-- Reflection:
- . Fixed bug #75186 (Inconsistent reflection of Closure:::__invoke()). (Nikita)
-
-- Session:
- . Fixed bug #77911 (Wrong warning for session.sid_bits_per_character). (cmb)
-
-- SOAP:
- . Fixed bug #77945 (Segmentation fault when constructing SoapClient with
- WSDL_CACHE_BOTH). (Nikita)
-
-- SPL:
- . Fixed bug #77024 (SplFileObject::__toString() may return array). (Craig
- Duncan)
-
-- SQLite:
- . Fixed bug #77967 (Bypassing open_basedir restrictions via file uris). (Stas)
-
-- Standard:
- . Fixed bug #77931 (Warning for array_map mentions wrong type). (Nikita)
- . Fixed bug #78003 (strip_tags output change since PHP 7.3). (cmb)
-
-02 May 2019, PHP 7.3.5
-
-- Core:
- . Fixed bug #77903 (ArrayIterator stops iterating after offsetSet call).
- (Nikita)
-
-- CLI:
- . Fixed bug #77794 (Incorrect Date header format in built-in server).
- (kelunik)
-
-- EXIF
- . Fixed bug #77950 (Heap-buffer-overflow in _estrndup via exif_process_IFD_TAG).
- (CVE-2019-11036) (Stas)
-
-- Interbase:
- . Fixed bug #72175 (Impossibility of creating multiple connections to
- Interbase with php 7.x). (Nikita)
-
-- Intl:
- . Fixed bug #77895 (IntlDateFormatter::create fails in strict mode if $locale
- = null). (Nikita)
-
-- LDAP:
- . Fixed bug #77869 (Core dump when using server controls) (mcmic)
-
-- Mail
- . Fixed bug #77821 (Potential heap corruption in TSendMail()). (cmb)
-
-- mbstring:
- . Implemented FR #72777 (Implement regex stack limits for mbregex functions).
- (Yasuo Ohgaki, Stas)
-
-- MySQLi:
- . Fixed bug #77773 (Unbuffered queries leak memory - MySQLi / mysqlnd).
- (Nikita)
-
-- PCRE:
- . Fixed bug #77827 (preg_match does not ignore \r in regex flags). (requinix,
- cmb)
-
-- PDO:
- . Fixed bug #77849 (Disable cloning of PDO handle/connection objects).
- (camporter)
-
-- phpdbg:
- . Fixed bug #76801 (too many open files). (alekitto)
- . Fixed bug #77800 (phpdbg segfaults on listing some conditional breakpoints).
- (krakjoe)
- . Fixed bug #77805 (phpdbg build fails when readline is shared). (krakjoe)
-
-- Reflection:
- . Fixed bug #77772 (ReflectionClass::getMethods(null) doesn't work). (Nikita)
- . Fixed bug #77882 (Different behavior: always calls destructor). (Nikita)
-
-- Standard:
- . Fixed bug #77793 (Segmentation fault in extract() when overwriting
- reference with itself). (Nikita)
- . Fixed bug #77844 (Crash due to null pointer in parse_ini_string with
- INI_SCANNER_TYPED). (Nikita)
- . Fixed bug #77853 (Inconsistent substr_compare behaviour with empty
- haystack). (Nikita)
-
-04 Apr 2019, PHP 7.3.4
-
-- Core:
- . Fixed bug #77738 (Nullptr deref in zend_compile_expr). (Laruence)
- . Fixed bug #77660 (Segmentation fault on break 2147483648). (Laruence)
- . Fixed bug #77652 (Anonymous classes can lose their interface information).
- (Nikita)
- . Fixed bug #77345 (Stack Overflow caused by circular reference in garbage
- collection). (Alexandru Patranescu, Nikita, Dmitry)
- . Fixed bug #76956 (Wrong value for 'syslog.filter' documented in php.ini).
- (cmb)
-
-- Apache2Handler:
- . Fixed bug #77648 (BOM in sapi/apache2handler/php_functions.c). (cmb)
-
-- Bcmath:
- . Fixed bug #77742 (bcpow() implementation related to gcc compiler
- optimization). (Nikita)
-
-- CLI Server:
- . Fixed bug #77722 (Incorrect IP set to $_SERVER['REMOTE_ADDR'] on the
- localhost). (Nikita)
-
-- COM:
- . Fixed bug #77578 (Crash when php unload). (cmb)
-
-- EXIF:
- . Fixed bug #77753 (Heap-buffer-overflow in php_ifd_get32s). (CVE-2019-11034)
- (Stas)
- . Fixed bug #77831 (Heap-buffer-overflow in exif_iif_add_value).
- (CVE-2019-11035) (Stas)
-
-- FPM:
- . Fixed bug #77677 (FPM fails to build on AIX due to missing WCOREDUMP).
- (Kevin Adler)
-
-- GD:
- . Fixed bug #77700 (Writing truecolor images as GIF ignores interlace flag).
- (cmb)
-
-- MySQLi:
- . Fixed bug #77597 (mysqli_fetch_field hangs scripts). (Nikita)
-
-- Opcache:
- . Fixed bug #77743 (Incorrect pi node insertion for jmpznz with identical
- successors). (Nikita)
-
-- PCRE:
- . Fixed bug #76127 (preg_split does not raise an error on invalid UTF-8).
- (Nikita)
-
-- Phar:
- . Fixed bug #77697 (Crash on Big_Endian platform). (Laruence)
-
-- phpdbg:
- . Fixed bug #77767 (phpdbg break cmd aliases listed in help do not match
- actual aliases). (Miriam Lauter)
-
-- sodium:
- . Fixed bug #77646 (sign_detached() strings not terminated). (Frank)
-
-- SQLite3:
- . Added sqlite3.defensive INI directive. (BohwaZ)
-
-- Standard:
- . Fixed bug #77664 (Segmentation fault when using undefined constant in
- custom wrapper). (Laruence)
- . Fixed bug #77669 (Crash in extract() when overwriting extracted array).
- (Nikita)
- . Fixed bug #76717 (var_export() does not create a parsable value for
- PHP_INT_MIN). (Nikita)
- . Fixed bug #77765 (FTP stream wrapper should set the directory as
- executable). (Vlad Temian)
-
-07 Mar 2019, PHP 7.3.3
-
-- Core:
- . Fixed bug #77589 (Core dump using parse_ini_string with numeric sections).
- (Laruence)
- . Fixed bug #77329 (Buffer Overflow via overly long Error Messages).
- (Dmitry)
- . Fixed bug #77494 (Disabling class causes segfault on member access).
- (Dmitry)
- . Fixed bug #77498 (Custom extension Segmentation fault when declare static
- property). (Nikita)
- . Fixed bug #77530 (PHP crashes when parsing `(2)::class`). (Ekin)
- . Fixed bug #77546 (iptcembed broken function). (gdegoulet)
- . Fixed bug #77630 (rename() across the device may allow unwanted access
- during processing). (Stas)
-
-- COM:
- . Fixed bug #77621 (Already defined constants are not properly reported).
- (cmb)
- . Fixed bug #77626 (Persistence confusion in php_com_import_typelib()). (cmb)
-
-- EXIF:
- . Fixed bug #77509 (Uninitialized read in exif_process_IFD_in_TIFF). (Stas)
- . Fixed bug #77540 (Invalid Read on exif_process_SOFn). (Stas)
- . Fixed bug #77563 (Uninitialized read in exif_process_IFD_in_MAKERNOTE). (Stas)
- . Fixed bug #77659 (Uninitialized read in exif_process_IFD_in_MAKERNOTE). (Stas)
-
-- Mbstring:
- . Fixed bug #77514 (mb_ereg_replace() with trailing backslash adds null byte).
- (Nikita)
-
-- MySQL
- . Disabled LOCAL INFILE by default, can be enabled using php.ini directive
- mysqli.allow_local_infile for mysqli, or PDO::MYSQL_ATTR_LOCAL_INFILE
- attribute for pdo_mysql. (Darek Slusarczyk)
-
-- OpenSSL:
- . Fixed bug #77390 (feof might hang on TLS streams in case of fragmented TLS
- records). (Abyl Valg, Jakub Zelenka)
-
-- PDO_OCI:
- . Support Oracle Database tracing attributes ACTION, MODULE,
- CLIENT_INFO, and CLIENT_IDENTIFIER. (Cameron Porter)
-
-- PHAR:
- . Fixed bug #77396 (Null Pointer Dereference in phar_create_or_parse_filename).
- (bishop)
- . Fixed bug #77586 (phar_tar_writeheaders_int() buffer overflow). (bishop)
-
-- phpdbg:
- . Fixed bug #76596 (phpdbg support for display_errors=stderr). (kabel)
-
-- SPL:
- . Fixed bug #51068 (DirectoryIterator glob:// don't support current path
- relative queries). (Ahmed Abdou)
- . Fixed bug #77431 (openFile() silently truncates after a null byte). (cmb)
-
-- Standard:
- . Fixed bug #77552 (Unintialized php_stream_statbuf in stat functions).
- (John Stevenson)
- . Fixed bug #77612 (setcookie() sets incorrect SameSite header if all of its
- options filled). (Nikita)
-
-07 Feb 2019, PHP 7.3.2
-
-- Core:
- . Fixed bug #77369 (memcpy with negative length via crafted DNS response). (Stas)
- . Fixed bug #77387 (Recursion detection broken when printing GLOBALS).
- (Laruence)
- . Fixed bug #77376 ("undefined function" message no longer includes
- namespace). (Laruence)
- . Fixed bug #77357 (base64_encode / base64_decode doest not work on nested
- VM). (Nikita)
- . Fixed bug #77339 (__callStatic may get incorrect arguments). (Dmitry)
- . Fixed bug #77317 (__DIR__, __FILE__, realpath() reveal physical path for
- subst virtual drive). (Anatol)
- . Fixed bug #77263 (Segfault when using 2 RecursiveFilterIterator). (Dmitry)
- . Fixed bug #77447 (PHP 7.3 built with ASAN crashes in
- zend_cpu_supports_avx2). (Nikita)
- . Fixed bug #77484 (Zend engine crashes when calling realpath in invalid
- working dir). (Anatol)
-
-- Curl:
- . Fixed bug #76675 (Segfault with H2 server push). (Pedro Magalhães)
-
-- Fileinfo:
- . Fixed bug #77346 (webm files incorrectly detected as
- application/octet-stream). (Anatol)
-
-- FPM:
- . Fixed bug #77430 (php-fpm crashes with Main process exited, code=dumped,
- status=11/SEGV). (Jakub Zelenka)
-
-- GD:
- . Fixed bug #73281 (imagescale(…, IMG_BILINEAR_FIXED) can cause black border).
- (cmb)
- . Fixed bug #73614 (gdImageFilledArc() doesn't properly draw pies). (cmb)
- . Fixed bug #77272 (imagescale() may return image resource on failure). (cmb)
- . Fixed bug #77391 (1bpp BMPs may fail to be loaded). (Romain Déoux, cmb)
- . Fixed bug #77479 (imagewbmp() segfaults with very large images). (cmb)
-
-- ldap:
- . Fixed bug #77440 (ldap_bind using ldaps or ldap_start_tls()=exception in
- libcrypto-1_1-x64.dll). (Anatol)
-
-- Mbstring:
- . Fixed bug #77428 (mb_ereg_replace() doesn't replace a substitution
- variable). (Nikita)
- . Fixed bug #77454 (mb_scrub() silently truncates after a null byte).
- (64796c6e69 at gmail dot com)
-
-- MySQLnd:
- . Fixed bug #77308 (Unbuffered queries memory leak). (Dmitry)
- . Fixed bug #75684 (In mysqlnd_ext_plugin.h the plugin methods family has
- no external visibility). (Anatol)
-
-- Opcache:
- . Fixed bug #77266 (Assertion failed in dce_live_ranges). (Laruence)
- . Fixed bug #77257 (value of variable assigned in a switch() construct gets
- lost). (Nikita)
- . Fixed bug #77434 (php-fpm workers are segfaulting in zend_gc_addre).
- (Nikita)
- . Fixed bug #77361 (configure fails on 64-bit AIX when opcache enabled).
- (Kevin Adler)
- . Fixed bug #77287 (Opcache literal compaction is incompatible with EXT
- opcodes). (Nikita)
-
-- PCRE:
- . Fixed bug #77338 (get_browser with empty string). (Nikita)
-
-- PDO:
- . Fixed bug #77273 (array_walk_recursive corrupts value types leading to PDO
- failure). (Nikita)
-
-- PDO MySQL:
- . Fixed bug #77289 (PDO MySQL segfaults with persistent connection).
- (Lauri Kenttä)
-
-- SOAP:
- . Fixed bug #77410 (Segmentation Fault when executing method with an empty
- parameter). (Nikita)
-
-- Sockets:
- . Fixed bug #76839 (socket_recvfrom may return an invalid 'from' address
- on MacOS). (Michael Meyer)
-
-- SPL:
- . Fixed bug #77298 (segfault occurs when add property to unserialized empty
- ArrayObject). (jhdxr)
-
-- Standard:
- . Fixed bug #77395 (segfault about array_multisort). (Laruence)
- . Fixed bug #77439 (parse_str segfaults when inserting item into existing
- array). (Nikita)
-
-10 Jan 2019, PHP 7.3.1
-
-- Core:
- . Fixed bug #76654 (Build failure on Mac OS X on 32-bit Intel). (Ryandesign)
- . Fixed bug #71041 (zend_signal_startup() needs ZEND_API).
- (Valentin V. Bartenev)
- . Fixed bug #76046 (PHP generates "FE_FREE" opcode on the wrong line).
- (Nikita)
- . Fixed bug #77291 (magic methods inherited from a trait may be ignored).
- (cmb)
-
-- CURL:
- . Fixed bug #77264 (curl_getinfo returning microseconds, not seconds).
- (Pierrick)
-
-- COM:
- . Fixed bug #77177 (Serializing or unserializing COM objects crashes). (cmb)
-
-- Exif:
- . Fixed bug #77184 (Unsigned rational numbers are written out as signed
- rationals). (Colin Basnett)
-
-- GD:
- . Fixed bug #77195 (Incorrect error handling of imagecreatefromjpeg()). (cmb)
- . Fixed bug #77198 (auto cropping has insufficient precision). (cmb)
- . Fixed bug #77200 (imagecropauto(…, GD_CROP_SIDES) crops left but not right).
- (cmb)
- . Fixed bug #77269 (efree() on uninitialized Heap data in imagescale leads to
- use-after-free). (cmb)
- . Fixed bug #77270 (imagecolormatch Out Of Bounds Write on Heap). (cmb)
-
-- MBString:
- . Fixed bug #77367 (Negative size parameter in mb_split). (Stas)
- . Fixed bug #77370 (Buffer overflow on mb regex functions - fetch_token).
- (Stas)
- . Fixed bug #77371 (heap buffer overflow in mb regex functions
- - compile_string_node). (Stas)
- . Fixed bug #77381 (heap buffer overflow in multibyte match_at). (Stas)
- . Fixed bug #77382 (heap buffer overflow due to incorrect length in
- expand_case_fold_string). (Stas)
- . Fixed bug #77385 (buffer overflow in fetch_token). (Stas)
- . Fixed bug #77394 (Buffer overflow in multibyte case folding - unicode).
- (Stas)
- . Fixed bug #77418 (Heap overflow in utf32be_mbc_to_code). (Stas)
-
-- OCI8:
- . Fixed bug #76804 (oci_pconnect with OCI_CRED_EXT not working). (KoenigsKind)
- . Added oci_set_call_timeout() for call timeouts.
- . Added oci_set_db_operation() for the DBOP end-to-end-tracing attribute.
-
-- Opcache:
- . Fixed bug #77215 (CFG assertion failure on multiple finalizing switch
- frees in one block). (Nikita)
- . Fixed bug #77275 (OPcache optimization problem for ArrayAccess->offsetGet).
- (Nikita)
-
-- PCRE:
- . Fixed bug #77193 (Infinite loop in preg_replace_callback). (Anatol)
-
-- PDO:
- . Handle invalid index passed to PDOStatement::fetchColumn() as error. (Sergei
- Morozov)
-
-- Phar:
- . Fixed bug #77247 (heap buffer overflow in phar_detect_phar_fname_ext). (Stas)
-
-- Soap:
- . Fixed bug #77088 (Segfault when using SoapClient with null options).
- (Laruence)
-
-- Sockets:
- . Fixed bug #77136 (Unsupported IPV6_RECVPKTINFO constants on macOS).
- (Mizunashi Mana)
-
-- Sodium:
- . Fixed bug #77297 (SodiumException segfaults on PHP 7.3). (Nikita, Scott)
-
-- SPL:
- . Fixed bug #77359 (spl_autoload causes segfault). (Lauri Kenttä)
- . Fixed bug #77360 (class_uses causes segfault). (Lauri Kenttä)
-
-- SQLite3:
- . Fixed bug #77051 (Issue with re-binding on SQLite3). (BohwaZ)
-
-- Xmlrpc:
- . Fixed bug #77242 (heap out of bounds read in xmlrpc_decode()). (cmb)
- . Fixed bug #77380 (Global out of bounds read in xmlrpc base64 code). (Stas)
-
-06 Dec 2018, PHP 7.3.0
-
-- Core:
- . Improved PHP GC. (Dmitry, Nikita)
- . Redesigned the old ext_skel program written in PHP, run:
- 'php ext_skel.php' for all options. This means there are no dependencies,
- thus making it work on Windows out of the box. (Kalle)
- . Removed support for BeOS. (Kalle)
- . Add PHP_VERSION to phpinfo() <title/>. (github/MattJeevas)
- . Add net_get_interfaces(). (Sara, Joe, Anatol)
- . Added gc_status(). (Benjamin Eberlei)
- . Implemented flexible heredoc and nowdoc syntax, per
- RFC https://wiki.php.net/rfc/flexible_heredoc_nowdoc_syntaxes.
- (Thomas Punt)
- . Added support for references in list() and array destructuring, per
- RFC https://wiki.php.net/rfc/list_reference_assignment.
- (David Walker)
- . Improved effectiveness of ZEND_SECURE_ZERO for NetBSD and systems
- without native similar feature. (devnexen)
- . Added syslog.facility and syslog.ident INI entries for customizing syslog
- logging. (Philip Prindeville)
- . Fixed bug #75683 (Memory leak in zend_register_functions() in ZTS mode).
- (Dmitry)
- . Fixed bug #75031 (support append mode in temp/memory streams). (adsr)
- . Fixed bug #74860 (Uncaught exceptions not being formatted properly when
- error_log set to "syslog"). (Philip Prindeville)
- . Fixed bug #75220 (Segfault when calling is_callable on parent).
- (andrewnester)
- . Fixed bug #69954 (broken links and unused config items in distributed ini
- files). (petk)
- . Fixed bug #74922 (Composed class has fatal error with duplicate, equal const
- properties). (pmmaga)
- . Fixed bug #63911 (identical trait methods raise errors during composition).
- (pmmaga)
- . Fixed bug #75677 (Clang ignores fastcall calling convention on variadic
- function). (Li-Wen Hsu)
- . Fixed bug #54043 (Remove inconsitency of internal exceptions and user
- defined exceptions). (Nikita)
- . Fixed bug #53033 (Mathematical operations convert objects to integers).
- (Nikita)
- . Fixed bug #73108 (Internal class cast handler uses integer instead of
- float). (Nikita)
- . Fixed bug #75765 (Fatal error instead of Error exception when base class is
- not found). (Timur Ibragimov)
- . Fixed bug #76198 (Wording: "iterable" is not a scalar type). (Levi Morrison)
- . Fixed bug #76137 (config.guess/config.sub do not recognize RISC-V). (cmb)
- . Fixed bug #76427 (Segfault in zend_objects_store_put). (Laruence)
- . Fixed bug #76422 (ftruncate fails on files > 2GB). (Anatol)
- . Fixed bug #76509 (Inherited static properties can be desynchronized from
- their parent by ref). (Nikita)
- . Fixed bug #76439 (Changed behaviour in unclosed HereDoc). (Nikita, tpunt)
- . Fixed bug #63217 (Constant numeric strings become integers when used as
- ArrayAccess offset). (Rudi Theunissen, Dmitry)
- . Fixed bug #33502 (Some nullary functions don't check the number of
- arguments). (cmb)
- . Fixed bug #76392 (Error relocating sapi/cli/php: unsupported relocation
- type 37). (Peter Kokot)
- . The declaration and use of case-insensitive constants has been deprecated.
- (Nikita)
- . Added syslog.filter INI entry for syslog filtering. (Philip Prindeville)
- . Fixed bug #76667 (Segfault with divide-assign op and __get + __set).
- (Laruence)
- . Fixed bug #76030 (RE2C_FLAGS rarely honoured) (Cristian Rodríguez)
- . Fixed broken zend_read_static_property (Laruence)
- . Fixed bug #76773 (Traits used on the parent are ignored for child classes).
- (daverandom)
- . Fixed bug #76767 (‘asm’ operand has impossible constraints in zend_operators.h).
- (ondrej)
- . Fixed bug #76752 (Crash in ZEND_COALESCE_SPEC_TMP_HANDLER - assertion in
- _get_zval_ptr_tmp failed). (Laruence)
- . Fixed bug #76820 (Z_COPYABLE invalid definition). (mvdwerve, cmb)
- . Fixed bug #76510 (file_exists() stopped working for phar://). (cmb)
- . Fixed bug #76869 (Incorrect bypassing protected method accessibilty check).
- (Dmitry)
- . Fixed bug #72635 (Undefined class used by class constant in constexpr
- generates fatal error). (Nikita)
- . Fixed bug #76947 (file_put_contents() blocks the directory of the file
- (__DIR__)). (Anatol)
- . Fixed bug #76979 (define() error message does not mention resources as
- valid values). (Michael Moravec)
- . Fixed bug #76825 (Undefined symbols ___cpuid_count). (Laruence, cmb)
- . Fixed bug #77110 (undefined symbol zend_string_equal_val in C++ build).
- (Remi)
-
-- BCMath:
- . Implemented FR #67855 (No way to get current scale in use). (Chris Wright,
- cmb)
- . Fixed bug #66364 (BCMath bcmul ignores scale parameter). (cmb)
- . Fixed bug #75164 (split_bc_num() is pointless). (cmb)
- . Fixed bug #75169 (BCMath errors/warnings bypass PHP's error handling). (cmb)
-
-- CLI:
- . Fixed bug #44217 (Output after stdout/stderr closed cause immediate exit
- with status 0). (Robert Lu)
- . Fixed bug #77111 (php-win.exe corrupts unicode symbols from cli
- parameters). (Anatol)
-
-- cURL:
- . Expose curl constants from curl 7.50 to 7.61. (Pierrick)
- . Fixed bug #74125 (Fixed finding CURL on systems with multiarch support).
- (cebe)
-
-- Date:
- . Implemented FR #74668: Add DateTime::createFromImmutable() method.
- (majkl578, Rican7)
- . Fixed bug #75222 (DateInterval microseconds property always 0). (jhdxr)
- . Fixed bug #68406 (calling var_dump on a DateTimeZone object modifies it).
- (jhdxr)
- . Fixed bug #76131 (mismatch arginfo for date_create). (carusogabriel)
- . Updated timelib to 2018.01RC1 to address several bugs:
- . Fixed bug #75577 (DateTime::createFromFormat does not accept 'v' format
- specifier). (Derick)
- . Fixed bug #75642 (Wrap around behaviour for microseconds is not working).
- (Derick)
-
-- DBA:
- . Fixed bug #75264 (compiler warnings emitted). (petk)
-
-- DOM:
- . Fixed bug #76285 (DOMDocument::formatOutput attribute sometimes ignored).
- (Andrew Nester, Laruence, Anatol)
-
-- Fileinfo:
- . Fixed bug #77095 (slowness regression in 7.2/7.3 (compared to 7.1)).
- (Anatol)
-
-- Filter:
- . Added the 'add_slashes' sanitization mode (FILTER_SANITIZE_ADD_SLASHES).
- (Kalle)
-
-- FPM:
- . Added fpm_get_status function. (Till Backhaus)
- . Fixed bug #62596 (getallheaders() missing with PHP-FPM). (Remi)
- . Fixed bug #69031 (Long messages into stdout/stderr are truncated
- incorrectly) - added new log related FPM configuration options:
- log_limit, log_buffering and decorate_workers_output. (Jakub Zelenka)
-
-- ftp:
- . Fixed bug #77151 (ftp_close(): SSL_read on shutdown). (Remi)
-
-- GD:
- . Added support for WebP in imagecreatefromstring(). (Andreas Treichel, cmb)
-
-- GMP:
- . Export internal structures and accessor helpers for GMP object. (Sara)
- . Added gmp_binomial(n, k). (Nikita)
- . Added gmp_lcm(a, b). (Nikita)
- . Added gmp_perfect_power(a). (Nikita)
- . Added gmp_kronecker(a, b). (Nikita)
-
-- iconv:
- . Fixed bug #53891 (iconv_mime_encode() fails to Q-encode UTF-8 string). (cmb)
- . Fixed bug #77147 (Fixing 60494 ignored ICONV_MIME_DECODE_CONTINUE_ON_ERROR).
- (cmb)
-
-- IMAP:
- . Fixed bug #77020 (null pointer dereference in imap_mail). (cmb)
- . Fixed bug #77153 (imap_open allows to run arbitrary shell commands via
- mailbox parameter). (Stas)
-
-- Interbase:
- . Fixed bug #75453 (Incorrect reflection for ibase_[p]connect). (villfa)
- . Fixed bug #76443 (php+php_interbase.dll crash on module_shutdown). (Kalle)
-
-
-- intl:
- . Fixed bug #75317 (UConverter::setDestinationEncoding changes source instead
- of destination). (andrewnester)
- . Fixed bug #76829 (Incorrect validation of domain on idn_to_utf8()
- function). (Anatol)
-
-- JSON:
- . Added JSON_THROW_ON_ERROR flag. (Andrea)
-
-- LDAP:
- . Added ldap_exop_refresh helper for EXOP REFRESH operation with dds overlay.
- (Come)
- . Added full support for sending and parsing ldap controls. (Come)
- . Fixed bug #49876 (Fix LDAP path lookup on 64-bit distros). (dzuelke)
-
-- libxml2:
- . Fixed bug #75871 (use pkg-config where available). (pmmaga)
-
-- litespeed:
- . Fixed bug #75248 (Binary directory doesn't get created when building
- only litespeed SAPI). (petk)
- . Fixed bug #75251 (Missing program prefix and suffix). (petk)
-
-- MBstring:
- . Updated to Oniguruma 6.9.0. (cmb)
- . Fixed bug #65544 (mb title case conversion-first word in quotation isn't
- capitalized). (Nikita)
- . Fixed bug #71298 (MB_CASE_TITLE misbehaves with curled apostrophe/quote).
- (Nikita)
- . Fixed bug #73528 (Crash in zif_mb_send_mail). (Nikita)
- . Fixed bug #74929 (mbstring functions version 7.1.1 are slow compared to 5.3
- on Windows). (Nikita)
- . Fixed bug #76319 (mb_strtolower with invalid UTF-8 causes segmentation
- fault). (Nikita)
- . Fixed bug #76574 (use of undeclared identifiers INT_MAX and LONG_MAX). (cmb)
- . Fixed bug #76594 (Bus Error due to unaligned access in zend_ini.c
- OnUpdateLong). (cmb, Nikita)
- . Fixed bug #76706 (mbstring.http_output_conv_mimetypes is ignored). (cmb)
- . Fixed bug #76958 (Broken UTF7-IMAP conversion). (Nikita)
- . Fixed bug #77025 (mb_strpos throws Unknown encoding or conversion error).
- (Nikita)
- . Fixed bug #77165 (mb_check_encoding crashes when argument given an empty
- array). (Nikita)
-
-- Mysqlnd:
- . Fixed bug #76386 (Prepared Statement formatter truncates fractional seconds
- from date/time column). (Victor Csiky)
-
-- ODBC:
- . Removed support for ODBCRouter. (Kalle)
- . Removed support for Birdstep. (Kalle)
- . Fixed bug #77079 (odbc_fetch_object has incorrect type signature).
- (Jon Allen)
-
-- Opcache:
- . Fixed bug #76466 (Loop variable confusion). (Dmitry, Laruence, Nikita)
- . Fixed bug #76463 (var has array key type but not value type). (Laruence)
- . Fixed bug #76446 (zend_variables.c:73: zend_string_destroy: Assertion
- `!(zval_gc_flags((str)->gc)). (Nikita, Laruence)
- . Fixed bug #76711 (OPcache enabled triggers false-positive "Illegal string
- offset"). (Dmitry)
- . Fixed bug #77058 (Type inference in opcache causes side effects). (Nikita)
- . Fixed bug #77092 (array_diff_key() - segmentation fault). (Nikita)
-
-- OpenSSL:
- . Added openssl_pkey_derive function. (Jim Zubov)
- . Add min_proto_version and max_proto_version ssl stream options as well as
- related constants for possible TLS protocol values. (Jakub Zelenka)
-
-- PCRE:
- . Implemented https://wiki.php.net/rfc/pcre2-migration. (Anatol, Dmitry)
- . Upgrade PCRE2 to 10.32. (Anatol)
- . Fixed bug #75355 (preg_quote() does not quote # control character).
- (Michael Moravec)
- . Fixed bug #76512 (\w no longer includes unicode characters). (cmb)
- . Fixed bug #76514 (Regression in preg_match makes it fail with
- PREG_JIT_STACKLIMIT_ERROR). (Anatol)
- . Fixed bug #76909 (preg_match difference between 7.3 and < 7.3). (Anatol)
-
-- PDO_DBlib:
- . Implemented FR #69592 (allow 0-column rowsets to be skipped automatically).
- (fandrieu)
- . Expose TDS version as \PDO::DBLIB_ATTR_TDS_VERSION attribute on \PDO
- instance. (fandrieu)
- . Treat DATETIME2 columns like DATETIME. (fandrieu)
- . Fixed bug #74243 (allow locales.conf to drive datetime format). (fandrieu)
-
-- PDO_Firebird:
- . Fixed bug #74462 (PDO_Firebird returns only NULLs for results with boolean
- for FIREBIRD >= 3.0). (Dorin Marcoci)
-
-- PDO_OCI:
- . Fixed bug #74631 (PDO_PCO with PHP-FPM: OCI environment initialized
- before PHP-FPM sets it up). (Ingmar Runge)
-
-- PDO SQLite
- . Add support for additional open flags
-
-- pgsql:
- . Added new error constants for pg_result_error(): PGSQL_DIAG_SCHEMA_NAME,
- PGSQL_DIAG_TABLE_NAME, PGSQL_DIAG_COLUMN_NAME, PGSQL_DIAG_DATATYPE_NAME,
- PGSQL_DIAG_CONSTRAINT_NAME and PGSQL_DIAG_SEVERITY_NONLOCALIZED. (Kalle)
- . Fixed bug #77047 (pg_convert has a broken regex for the 'TIME WITHOUT
- TIMEZONE' data type). (Andy Gajetzki)
-
-- phar:
- . Fixed bug #74991 (include_path has a 4096 char limit in some cases).
- (bwbroersma)
- . Fixed bug #65414 (deal with leading slash when adding files correctly).
- (bishopb)
-
-- readline:
- . Added completion_append_character and completion_suppress_append options
- to readline_info() if linked against libreadline. (krageon)
-
-- Session:
- . Fixed bug #74941 (session fails to start after having headers sent).
- (morozov)
-
-- SimpleXML:
- . Fixed bug #54973 (SimpleXML casts integers wrong). (Nikita)
- . Fixed bug #76712 (Assignment of empty string creates extraneous text node).
- (cmb)
-
-- Sockets:
- . Fixed bug #67619 (Validate length on socket_write). (thiagooak)
-
-- SOAP:
- . Fixed bug #75464 (Wrong reflection on SoapClient::__setSoapHeaders).
- (villfa)
- . Fixed bug #70469 (SoapClient generates E_ERROR even if exceptions=1 is
- used). (Anton Artamonov)
- . Fixed bug #50675 (SoapClient can't handle object references correctly).
- (Cameron Porter)
- . Fixed bug #76348 (WSDL_CACHE_MEMORY causes Segmentation fault). (cmb)
- . Fixed bug #77141 (Signedness issue in SOAP when precision=-1). (cmb)
-
-- SPL:
- . Fixed bug #74977 (Appending AppendIterator leads to segfault).
- (Andrew Nester)
- . Fixed bug #75173 (incorrect behavior of AppendIterator::append in foreach
- loop). (jhdxr)
- . Fixed bug #74372 (autoloading file with syntax error uses next autoloader,
- may hide parse error). (Nikita)
- . Fixed bug #75878 (RecursiveTreeIterator::setPostfix has wrong signature).
- (cmb)
- . Fixed bug #74519 (strange behavior of AppendIterator). (jhdxr)
- . Fixed bug #76131 (mismatch arginfo for splarray constructor).
- (carusogabriel)
-
-- SQLite3:
- . Updated bundled libsqlite to 3.24.0. (cmb)
-
-- Standard:
- . Added is_countable() function. (Gabriel Caruso)
- . Added support for the SameSite cookie directive, including an alternative
- signature for setcookie(), setrawcookie() and session_set_cookie_params().
- (Frederik Bosch, pmmaga)
- . Remove superfluous warnings from inet_ntop()/inet_pton(). (daverandom)
- . Fixed bug #75916 (DNS_CAA record results contain garbage). (Mike,
- Philip Sharp)
- . Fixed unserialize(), to disable creation of unsupported data structures
- through manually crafted strings. (Dmitry)
- . Fixed bug #75409 (accept EFAULT in addition to ENOSYS as indicator
- that getrandom() is missing). (sarciszewski)
- . Fixed bug #74719 (fopen() should accept NULL as context). (Alexander Holman)
- . Fixed bug #69948 (path/domain are not sanitized in setcookie). (cmb)
- . Fixed bug #75996 (incorrect url in header for mt_rand). (tatarbj)
- . Added hrtime() function, to get high resolution time. (welting)
- . Fixed bug #48016 (stdClass::__setState is not defined although var_export()
- uses it). (Andrea)
- . Fixed bug #76136 (stream_socket_get_name should enclose IPv6 in brackets).
- (seliver)
- . Fixed bug #76688 (Disallow excessive parameters after options array).
- (pmmaga)
- . Fixed bug #76713 (Segmentation fault caused by property corruption).
- (Laruence)
- . Fixed bug #76755 (setcookie does not accept "double" type for expire time).
- (Laruence)
- . Fixed bug #76674 (improve array_* failure messages exposing what was passed
- instead of an array). (carusogabriel)
- . Fixed bug #76803 (ftruncate changes file pointer). (Anatol)
- . Fixed bug #76818 (Memory corruption and segfault). (Remi)
- . Fixed bug #77081 (ftruncate() changes seek pointer in c mode). (cmb, Anatol)
-
-- Testing:
- . Implemented FR #62055 (Make run-tests.php support --CGI-- sections). (cmb)
-
-- Tidy:
- . Support using tidyp instead of tidy. (devnexen)
- . Fixed bug #74707 (Tidy has incorrect ReflectionFunction param counts for
- functions taking tidy). (Gabriel Caruso)
- . Fixed arginfo for tidy::__construct(). (Tyson Andre)
-
-- Tokenizer:
- . Fixed bug #76437 (token_get_all with TOKEN_PARSE flag fails to recognise
- close tag). (Laruence)
- . Fixed bug #75218 (Change remaining uncatchable fatal errors for parsing
- into ParseError). (Nikita)
- . Fixed bug #76538 (token_get_all with TOKEN_PARSE flag fails to recognise
- close tag with newline). (Nikita)
- . Fixed bug #76991 (Incorrect tokenization of multiple invalid flexible
- heredoc strings). (Nikita)
-
-- XML:
- . Fixed bug #71592 (External entity processing never fails). (cmb)
+ . Fixed bug #72374 (remove_path strips first char of filename). (tyage)
+ . Add ZipArchive::setMtimeName and ZipArchive::setMtimeIndex methods. (Remi)
+ . Add ZipArchive::setProgressCallback method (since libzip 1.3.0). (Remi)
+ . Add ZipArchive::setCancelCallback method (since libzip 1.6.0). (Remi)
-- Zlib:
- . Added zlib/level context option for compress.zlib wrapper. (Sara)
+<<< NOTE: Insert NEWS from last stable release here prior to actual release! >>>
diff --git a/README.md b/README.md
index 6b9fe6e65e..204fe71489 100644
--- a/README.md
+++ b/README.md
@@ -11,12 +11,13 @@
PHP is a popular general-purpose scripting language that is especially suited to
web development. Fast, flexible and pragmatic, PHP powers everything from your
-blog to the most popular websites in the world. PHP is distributed under the PHP
-License v3.01.
+blog to the most popular websites in the world. PHP is distributed under the
+[PHP License v3.01](LICENSE).
[![Build status](https://travis-ci.org/php/php-src.svg?branch=master)](https://travis-ci.org/php/php-src)
-[![Build status](https://ci.appveyor.com/api/projects/status/meyur6fviaxgdwdy?svg=true)](https://ci.appveyor.com/project/php/php-src)
-[![Build Status](https://dev.azure.com/phpazuredevops/php/_apis/build/status/php.php-src?branchName=PHP-7.4)](https://dev.azure.com/phpazuredevops/php/_build/latest?definitionId=1&branchName=PHP-7.4)
+[![Build status](https://ci.appveyor.com/api/projects/status/meyur6fviaxgdwdy/branch/master?svg=true)](https://ci.appveyor.com/project/php/php-src)
+[![Build Status](https://dev.azure.com/phpazuredevops/php/_apis/build/status/php.php-src?branchName=master)](https://dev.azure.com/phpazuredevops/php/_build/latest?definitionId=1&branchName=master)
+[![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/php.svg)](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:php)
## Documentation
diff --git a/TSRM/TSRM.c b/TSRM/TSRM.c
index 1a8d5192ff..bcd5c806b1 100644
--- a/TSRM/TSRM.c
+++ b/TSRM/TSRM.c
@@ -102,31 +102,14 @@ static FILE *tsrm_error_file;
}
#endif
-#if defined(GNUPTH)
-static pth_key_t tls_key;
-# define tsrm_tls_set(what) pth_key_setdata(tls_key, (void*)(what))
-# define tsrm_tls_get() pth_key_getdata(tls_key)
-
-#elif defined(PTHREADS)
-/* Thread local storage */
-static pthread_key_t tls_key;
-# define tsrm_tls_set(what) pthread_setspecific(tls_key, (void*)(what))
-# define tsrm_tls_get() pthread_getspecific(tls_key)
-
-#elif defined(TSRM_ST)
-static int tls_key;
-# define tsrm_tls_set(what) st_thread_setspecific(tls_key, (void*)(what))
-# define tsrm_tls_get() st_thread_getspecific(tls_key)
-
-#elif defined(TSRM_WIN32)
+#if defined(TSRM_WIN32)
static DWORD tls_key;
# define tsrm_tls_set(what) TlsSetValue(tls_key, (void*)(what))
# define tsrm_tls_get() TlsGetValue(tls_key)
-
#else
-# define tsrm_tls_set(what)
-# define tsrm_tls_get() NULL
-# warning tsrm_set_interpreter_context is probably broken on this platform
+static pthread_key_t tls_key;
+# define tsrm_tls_set(what) pthread_setspecific(tls_key, (void*)(what))
+# define tsrm_tls_get() pthread_getspecific(tls_key)
#endif
TSRM_TLS uint8_t in_main_thread = 0;
@@ -135,16 +118,10 @@ TSRM_TLS uint8_t is_thread_shutdown = 0;
/* Startup TSRM (call once for the entire process) */
TSRM_API int tsrm_startup(int expected_threads, int expected_resources, int debug_level, char *debug_filename)
{/*{{{*/
-#if defined(GNUPTH)
- pth_init();
- pth_key_create(&tls_key, 0);
-#elif defined(PTHREADS)
- pthread_key_create( &tls_key, 0 );
-#elif defined(TSRM_ST)
- st_init();
- st_key_create(&tls_key, 0);
-#elif defined(TSRM_WIN32)
+#if defined(TSRM_WIN32)
tls_key = TlsAlloc();
+#else
+ pthread_key_create(&tls_key, 0);
#endif
/* ensure singleton */
@@ -232,13 +209,11 @@ TSRM_API void tsrm_shutdown(void)
if (tsrm_error_file!=stderr) {
fclose(tsrm_error_file);
}
-#if defined(GNUPTH)
- pth_kill();
-#elif defined(PTHREADS)
+#if defined(TSRM_WIN32)
+ TlsFree(tls_key);
+#else
pthread_setspecific(tls_key, 0);
pthread_key_delete(tls_key);
-#elif defined(TSRM_WIN32)
- TlsFree(tls_key);
#endif
if (tsrm_shutdown_handler) {
tsrm_shutdown_handler();
@@ -494,67 +469,6 @@ TSRM_API void *ts_resource_ex(ts_rsrc_id id, THREAD_T *th_id)
TSRM_SAFE_RETURN_RSRC(thread_resources->storage, id, thread_resources->count);
}/*}}}*/
-/* frees an interpreter context. You are responsible for making sure that
- * it is not linked into the TSRM hash, and not marked as the current interpreter */
-void tsrm_free_interpreter_context(void *context)
-{/*{{{*/
- tsrm_tls_entry *next, *thread_resources = (tsrm_tls_entry*)context;
- int i;
-
- while (thread_resources) {
- next = thread_resources->next;
-
- for (i=0; i<thread_resources->count; i++) {
- if (resource_types_table[i].dtor) {
- resource_types_table[i].dtor(thread_resources->storage[i]);
- }
- }
- for (i=0; i<thread_resources->count; i++) {
- if (!resource_types_table[i].fast_offset) {
- free(thread_resources->storage[i]);
- }
- }
- free(thread_resources->storage);
- free(thread_resources);
- thread_resources = next;
- }
-}/*}}}*/
-
-void *tsrm_set_interpreter_context(void *new_ctx)
-{/*{{{*/
- tsrm_tls_entry *current;
-
- current = tsrm_tls_get();
-
- /* TODO: unlink current from the global linked list, and replace it
- * it with the new context, protected by mutex where/if appropriate */
-
- /* Set thread local storage to this new thread resources structure */
- tsrm_tls_set(new_ctx);
-
- /* return old context, so caller can restore it when they're done */
- return current;
-}/*}}}*/
-
-
-/* allocates a new interpreter context */
-void *tsrm_new_interpreter_context(void)
-{/*{{{*/
- tsrm_tls_entry *new_ctx, *current;
- THREAD_T thread_id;
-
- thread_id = tsrm_thread_id();
- tsrm_mutex_lock(tsmm_mutex);
-
- current = tsrm_tls_get();
-
- allocate_new_resource(&new_ctx, thread_id);
-
- /* switch back to the context that was in use prior to our creation
- * of the new one */
- return tsrm_set_interpreter_context(current);
-}/*}}}*/
-
/* frees all resources allocated for the current thread */
void ts_free_thread(void)
@@ -637,8 +551,6 @@ void ts_free_id(ts_rsrc_id id)
}/*}}}*/
-
-
/*
* Utility Functions
*/
@@ -648,12 +560,8 @@ TSRM_API THREAD_T tsrm_thread_id(void)
{/*{{{*/
#ifdef TSRM_WIN32
return GetCurrentThreadId();
-#elif defined(GNUPTH)
- return pth_self();
-#elif defined(PTHREADS)
+#else
return pthread_self();
-#elif defined(TSRM_ST)
- return st_thread_self();
#endif
}/*}}}*/
@@ -665,14 +573,9 @@ TSRM_API MUTEX_T tsrm_mutex_alloc(void)
#ifdef TSRM_WIN32
mutexp = malloc(sizeof(CRITICAL_SECTION));
InitializeCriticalSection(mutexp);
-#elif defined(GNUPTH)
- mutexp = (MUTEX_T) malloc(sizeof(*mutexp));
- pth_mutex_init(mutexp);
-#elif defined(PTHREADS)
+#else
mutexp = (pthread_mutex_t *)malloc(sizeof(pthread_mutex_t));
pthread_mutex_init(mutexp,NULL);
-#elif defined(TSRM_ST)
- mutexp = st_mutex_new();
#endif
#ifdef THR_DEBUG
printf("Mutex created thread: %d\n",mythreadid());
@@ -688,13 +591,9 @@ TSRM_API void tsrm_mutex_free(MUTEX_T mutexp)
#ifdef TSRM_WIN32
DeleteCriticalSection(mutexp);
free(mutexp);
-#elif defined(GNUPTH)
- free(mutexp);
-#elif defined(PTHREADS)
+#else
pthread_mutex_destroy(mutexp);
free(mutexp);
-#elif defined(TSRM_ST)
- st_mutex_destroy(mutexp);
#endif
}
#ifdef THR_DEBUG
@@ -713,15 +612,8 @@ TSRM_API int tsrm_mutex_lock(MUTEX_T mutexp)
#ifdef TSRM_WIN32
EnterCriticalSection(mutexp);
return 0;
-#elif defined(GNUPTH)
- if (pth_mutex_acquire(mutexp, 0, NULL)) {
- return 0;
- }
- return -1;
-#elif defined(PTHREADS)
+#else
return pthread_mutex_lock(mutexp);
-#elif defined(TSRM_ST)
- return st_mutex_lock(mutexp);
#endif
}/*}}}*/
@@ -736,15 +628,8 @@ TSRM_API int tsrm_mutex_unlock(MUTEX_T mutexp)
#ifdef TSRM_WIN32
LeaveCriticalSection(mutexp);
return 0;
-#elif defined(GNUPTH)
- if (pth_mutex_release(mutexp)) {
- return 0;
- }
- return -1;
-#elif defined(PTHREADS)
+#else
return pthread_mutex_unlock(mutexp);
-#elif defined(TSRM_ST)
- return st_mutex_unlock(mutexp);
#endif
}/*}}}*/
@@ -755,12 +640,8 @@ TSRM_API int tsrm_mutex_unlock(MUTEX_T mutexp)
TSRM_API int tsrm_sigmask(int how, const sigset_t *set, sigset_t *oldset)
{/*{{{*/
TSRM_ERROR((TSRM_ERROR_LEVEL_INFO, "Changed sigmask in thread: %ld", tsrm_thread_id()));
- /* TODO: add support for other APIs */
-#ifdef PTHREADS
- return pthread_sigmask(how, set, oldset);
-#else
- return sigprocmask(how, set, oldset);
-#endif
+
+ return pthread_sigmask(how, set, oldset);
}/*}}}*/
#endif
@@ -842,6 +723,29 @@ TSRM_API void *tsrm_get_ls_cache(void)
return tsrm_tls_get();
}/*}}}*/
+/* Returns offset of tsrm_ls_cache slot from Thread Control Block address */
+TSRM_API size_t tsrm_get_ls_cache_tcb_offset(void)
+{/*{{{*/
+#if defined(__APPLE__) && defined(__x86_64__)
+ // TODO: Implement support for fast JIT ZTS code ???
+ return 0;
+#elif defined(__x86_64__) && defined(__GNUC__)
+ size_t ret;
+
+ asm ("movq _tsrm_ls_cache@gottpoff(%%rip),%0"
+ : "=r" (ret));
+ return ret;
+#elif defined(__i386__) && defined(__GNUC__)
+ size_t ret;
+
+ asm ("leal _tsrm_ls_cache@ntpoff,%0"
+ : "=r" (ret));
+ return ret;
+#else
+ return 0;
+#endif
+}/*}}}*/
+
TSRM_API uint8_t tsrm_is_main_thread(void)
{/*{{{*/
return in_main_thread;
@@ -854,16 +758,10 @@ TSRM_API uint8_t tsrm_is_shutdown(void)
TSRM_API const char *tsrm_api_name(void)
{/*{{{*/
-#if defined(GNUPTH)
- return "GNU Pth";
-#elif defined(PTHREADS)
- return "POSIX Threads";
-#elif defined(TSRM_ST)
- return "State Threads";
-#elif defined(TSRM_WIN32)
+#if defined(TSRM_WIN32)
return "Windows Threads";
#else
- return "Unknown";
+ return "POSIX Threads";
#endif
}/*}}}*/
diff --git a/TSRM/TSRM.h b/TSRM/TSRM.h
index d710eb6f75..75553edabc 100644
--- a/TSRM/TSRM.h
+++ b/TSRM/TSRM.h
@@ -44,14 +44,8 @@ typedef uintptr_t tsrm_uintptr_t;
# ifndef TSRM_INCLUDE_FULL_WINDOWS_HEADERS
# define WIN32_LEAN_AND_MEAN
# endif
-# include <windows.h>
-# include <shellapi.h>
-#elif defined(GNUPTH)
-# include <pth.h>
-#elif defined(PTHREADS)
+#else
# include <pthread.h>
-#elif defined(TSRM_ST)
-# include <st.h>
#endif
#if SIZEOF_SIZE_T == 4
@@ -68,15 +62,9 @@ typedef int ts_rsrc_id;
#ifdef TSRM_WIN32
# define THREAD_T DWORD
# define MUTEX_T CRITICAL_SECTION *
-#elif defined(GNUPTH)
-# define THREAD_T pth_t
-# define MUTEX_T pth_mutex_t *
-#elif defined(PTHREADS)
+#else
# define THREAD_T pthread_t
# define MUTEX_T pthread_mutex_t *
-#elif defined(TSRM_ST)
-# define THREAD_T st_thread_t
-# define MUTEX_T st_mutex_t
#endif
#include <signal.h>
@@ -143,13 +131,8 @@ TSRM_API void *tsrm_set_new_thread_begin_handler(tsrm_thread_begin_func_t new_th
TSRM_API void *tsrm_set_new_thread_end_handler(tsrm_thread_end_func_t new_thread_end_handler);
TSRM_API void *tsrm_set_shutdown_handler(tsrm_shutdown_func_t shutdown_handler);
-/* these 3 APIs should only be used by people that fully understand the threading model
- * used by PHP/Zend and the selected SAPI. */
-TSRM_API void *tsrm_new_interpreter_context(void);
-TSRM_API void *tsrm_set_interpreter_context(void *new_ctx);
-TSRM_API void tsrm_free_interpreter_context(void *context);
-
TSRM_API void *tsrm_get_ls_cache(void);
+TSRM_API size_t tsrm_get_ls_cache_tcb_offset(void);
TSRM_API uint8_t tsrm_is_main_thread(void);
TSRM_API uint8_t tsrm_is_shutdown(void);
TSRM_API const char *tsrm_api_name(void);
@@ -160,11 +143,21 @@ TSRM_API const char *tsrm_api_name(void);
# define TSRM_TLS __thread
#endif
+#ifndef __has_attribute
+# define __has_attribute(x) 0
+#endif
+
+#if !__has_attribute(tls_model)
+# define TSRM_TLS_MODEL_ATTR
+#elif __PIC__
+# define TSRM_TLS_MODEL_ATTR __attribute__((tls_model("initial-exec")))
+#else
+# define TSRM_TLS_MODEL_ATTR __attribute__((tls_model("local-exec")))
+#endif
+
#define TSRM_SHUFFLE_RSRC_ID(rsrc_id) ((rsrc_id)+1)
#define TSRM_UNSHUFFLE_RSRC_ID(rsrc_id) ((rsrc_id)-1)
-#define TSRMLS_FETCH_FROM_CTX(ctx) void ***tsrm_ls = (void ***) ctx
-#define TSRMLS_SET_CTX(ctx) ctx = (void ***) tsrm_get_ls_cache()
#define TSRMG(id, type, element) (TSRMG_BULK(id, type)->element)
#define TSRMG_BULK(id, type) ((type) (*((void ***) tsrm_get_ls_cache()))[TSRM_UNSHUFFLE_RSRC_ID(id)])
#define TSRMG_FAST(offset, type, element) (TSRMG_FAST_BULK(offset, type)->element)
@@ -174,18 +167,11 @@ TSRM_API const char *tsrm_api_name(void);
#define TSRMG_BULK_STATIC(id, type) ((type) (*((void ***) TSRMLS_CACHE))[TSRM_UNSHUFFLE_RSRC_ID(id)])
#define TSRMG_FAST_STATIC(offset, type, element) (TSRMG_FAST_BULK_STATIC(offset, type)->element)
#define TSRMG_FAST_BULK_STATIC(offset, type) ((type) (((char*) TSRMLS_CACHE)+(offset)))
-#define TSRMLS_CACHE_EXTERN() extern TSRM_TLS void *TSRMLS_CACHE;
-#define TSRMLS_CACHE_DEFINE() TSRM_TLS void *TSRMLS_CACHE = NULL;
+#define TSRMLS_CACHE_EXTERN() extern TSRM_TLS void *TSRMLS_CACHE TSRM_TLS_MODEL_ATTR;
+#define TSRMLS_CACHE_DEFINE() TSRM_TLS void *TSRMLS_CACHE TSRM_TLS_MODEL_ATTR = NULL;
#define TSRMLS_CACHE_UPDATE() TSRMLS_CACHE = tsrm_get_ls_cache()
#define TSRMLS_CACHE _tsrm_ls_cache
-/* BC only */
-#define TSRMLS_D void
-#define TSRMLS_DC
-#define TSRMLS_C
-#define TSRMLS_CC
-#define TSRMLS_FETCH()
-
#ifdef __cplusplus
}
#endif
@@ -195,10 +181,6 @@ TSRM_API const char *tsrm_api_name(void);
#define tsrm_env_lock()
#define tsrm_env_unlock()
-#define TSRMLS_FETCH()
-#define TSRMLS_FETCH_FROM_CTX(ctx)
-#define TSRMLS_SET_CTX(ctx)
-
#define TSRMG_STATIC(id, type, element)
#define TSRMLS_CACHE_EXTERN()
#define TSRMLS_CACHE_DEFINE()
@@ -207,12 +189,6 @@ TSRM_API const char *tsrm_api_name(void);
#define TSRM_TLS
-/* BC only */
-#define TSRMLS_D void
-#define TSRMLS_DC
-#define TSRMLS_C
-#define TSRMLS_CC
-
#endif /* ZTS */
#endif /* TSRM_H */
diff --git a/TSRM/tsrm.m4 b/TSRM/tsrm.m4
index 0330d7a7da..9f5c8001d8 100644
--- a/TSRM/tsrm.m4
+++ b/TSRM/tsrm.m4
@@ -1,44 +1,6 @@
dnl This file contains TSRM specific autoconf macros.
dnl
-dnl TSRM_CHECK_PTH
-dnl
-AC_DEFUN([TSRM_CHECK_PTH],[
-AC_MSG_CHECKING(for GNU Pth)
-PTH_PREFIX="`$1 --prefix`"
-if test -z "$PTH_PREFIX"; then
- AC_MSG_RESULT(Please check your Pth installation)
-fi
-
-CPPFLAGS="$CPPFLAGS `$1 --cflags`"
-LDFLAGS="$LDFLAGS `$1 --ldflags`"
-LIBS="$LIBS `$1 --libs`"
-
-AC_DEFINE(GNUPTH, 1, [Whether you use GNU Pth])
-AC_MSG_RESULT(yes - installed in $PTH_PREFIX)
-])
-
-dnl
-dnl TSRM_CHECK_ST
-dnl
-AC_DEFUN([TSRM_CHECK_ST],[
- if test -r "$1/include/st.h"; then
- CPPFLAGS="$CPPFLAGS -I$1/include"
- LDFLAGS="$LDFLAGS -L$1/lib"
- elif test -r "$1/st.h"; then
- CPPFLAGS="$CPPFLAGS -I$1"
- LDFLAGS="$LDFLAGS -L$1"
- fi
- AC_CHECK_HEADERS(st.h,[],[
- AC_MSG_ERROR([Sorry[,] I was unable to locate the State Threads header file. Please specify the prefix using --with-tsrm-st=/prefix])
- ])
- LIBS="$LIBS -lst"
- AC_MSG_CHECKING(for SGI's State Threads)
- AC_MSG_RESULT(yes)
- AC_DEFINE(TSRM_ST, 1, [ ])
-])
-
-dnl
dnl TSRM_CHECK_PTHREADS
dnl
AC_DEFUN([TSRM_CHECK_PTHREADS],[
@@ -53,39 +15,3 @@ AC_DEFINE(PTHREADS, 1, Whether to use Pthreads)
AC_MSG_CHECKING(for POSIX threads)
AC_MSG_RESULT(yes)
])
-
-dnl
-dnl TSRM_THREADS_CHECKS
-dnl
-dnl For the thread implementations, we always use --with-* to maintain
-dnl consistency.
-dnl
-AC_DEFUN([TSRM_THREADS_CHECKS],[
-AC_ARG_WITH([tsrm-pth],
- [AS_HELP_STRING([[--with-tsrm-pth[=pth-config]]],
- [Use GNU Pth])],
- [TSRM_PTH=$withval],
- [TSRM_PTH=no])
-
-AC_ARG_WITH([tsrm-st],
- [AS_HELP_STRING([--with-tsrm-st],
- [Use SGI's State Threads])],
- [TSRM_ST=$withval],
- [TSRM_ST=no])
-
-AC_ARG_WITH([tsrm-pthreads],
- [AS_HELP_STRING([--with-tsrm-pthreads],
- [Use POSIX threads (default)])],
- [TSRM_PTHREADS=$withval],
- [TSRM_PTHREADS=yes])
-
-test "$TSRM_PTH" = "yes" && TSRM_PTH=pth-config
-
-if test "$TSRM_PTH" != "no"; then
- TSRM_CHECK_PTH($TSRM_PTH)
-elif test "$TSRM_ST" != "no"; then
- TSRM_CHECK_ST($TSRM_ST)
-elif test "$TSRM_PTHREADS" != "no"; then
- TSRM_CHECK_PTHREADS
-fi
-])
diff --git a/TSRM/tsrm_win32.c b/TSRM/tsrm_win32.c
index 40331f122c..5287bd23d6 100644
--- a/TSRM/tsrm_win32.c
+++ b/TSRM/tsrm_win32.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/TSRM/tsrm_win32.h b/TSRM/tsrm_win32.h
index 1ae9beaf2c..4af6225c93 100644
--- a/TSRM/tsrm_win32.h
+++ b/TSRM/tsrm_win32.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/UPGRADING b/UPGRADING
index 49634eabcd..574ab6a963 100644
--- a/UPGRADING
+++ b/UPGRADING
@@ -1,4 +1,4 @@
-PHP 7.4 UPGRADE NOTES
+PHP 8.0 UPGRADE NOTES
1. Backward Incompatible Changes
2. New Features
@@ -12,9 +12,8 @@ PHP 7.4 UPGRADE NOTES
10. New Global Constants
11. Changes to INI File Handling
12. Windows Support
-13. Migration to pkg-config
-14. Other Changes
-15. Performance Improvements
+13. Other Changes
+14. Performance Improvements
========================================
@@ -22,817 +21,449 @@ PHP 7.4 UPGRADE NOTES
========================================
- Core:
- . Trying to use values of type null, bool, int, float or resource as an
- array (such as $null["key"]) will now generate a notice. This does not
- affect array accesses performed by list().
- RFC: https://wiki.php.net/rfc/notice-for-non-valid-array-container
- . get_declared_classes() no longer returns anonymous classes that haven't
- been instantiated yet.
- . "fn" is now a reserved keyword. In particular, it can no longer be used as a
- function or class name. It can still be used as a method or class constant
- name.
- . Passing the result of a (non-reference) list() assignment by reference is
- consistently disallowed now. Previously this worked if the right-hand side
- was a simple (CV) variable and did not occur as part of the list().
- . `<?php` at the end of the file (without trailing newline) will now be
- interpreted as an opening PHP tag. Previously it was interpreted either as
- `<? php` and resulted in a syntax error (with short_open_tag=1) or was
- interpreted as a literal `<?php` string (with short_open_tag=0).
- . When using include/require on a stream, stream_set_option() will be invoked
- with the STREAM_OPTION_READ_BUFFER option. Custom stream wrapper
- implementations may need to implement the stream_set_option() method to
- avoid a warning (always returning false is a sufficient implementation).
- . The "creating default object from empty value" warning is now consistently
- thrown if a falsy value is promoted into an stdClass object. Previously some
- cases like `$null->prop[0] = $val` missed this warning.
- . Previously get_declared_classes() always returned parent classes before
- child classes. This is no longer the case. No particular order is guaranteed
- for the get_declared_classes() return value.
-
-- BCMath:
- . BCMath functions will now warn if a non well-formed number is passed, such
- as "32foo". The argument will be interpreted as zero (as before).
-
-- Curl:
- . Attempting to serialize a CURLFile class will now generate an exception.
- Previously the exception was only thrown on unserialization.
- . Using CURLPIPE_HTTP1 is deprecated, and is no longer supported as of cURL
- 7.62.0.
- . The $version parameter of curl_version() is deprecated. If any value not
- equal to the default CURLVERSION_NOW is passed, a warning is raised and the
- parameter is ignored.
-
-- Date:
- . Calling var_dump() or similar on a DateTime(Immutable) instance will no
- longer leave behind accessible properties on the object.
- . Comparison of DateInterval objects (using ==, < and so on) will now generate
- a warning and always return false. Previously all DateInterval objects were
- considered equal, unless they had properties.
-
-- Intl:
- . The default parameter value of idn_to_ascii() and idn_to_utf8() is now
- INTL_IDNA_VARIANT_UTS46 instead of the deprecated INTL_IDNA_VARIANT_2003.
-
-- MySQLi:
- . The embedded server functionality has been removed. It was broken since
- at least PHP 7.0.
- . The undocumented mysqli::$stat property has been removed in favor of
- mysqli::stat().
-
-- Openssl:
- . The openssl_random_pseudo_bytes() function will now throw an exception in
- error situations, similar to random_bytes(). In particular, an Error is
- thrown if the number of requested bytes is less than *or equal to* zero,
- and an Exception is thrown if sufficient randomness cannot be gathered.
- The $crypto_strong output argument is guaranteed to always be true if the
- function does not throw, so explicitly checking it is not necessary.
- RFC: http://php.net/manual/de/function.openssl-random-pseudo-bytes.php
-
-- Pcntl:
- . The $restart_syscalls flag for pcntl_signal() will now be respected for
- SIGALARM. Previously it was hardcoded to false. To reduce the backwards
- compatibility impact, the default for SIGALARM will remain false however.
-
-- PCRE:
- . When PREG_UNMATCHED_AS_NULL mode is used, trailing unmatched capturing
- groups will now also be set to null (or [null, -1] if offset capture is
- enabled). This means that the size of the $matches will always be the same.
-
-- PEAR:
- . Installation of PEAR (including PECL) is no longer enabled by default. It
- can be explicitly enabled using --with-pear. This option is deprecated and
- may be removed in the future.
-
-- PDO:
- . Attempting to serialize a PDO or PDOStatement instance will now generate
- an Exception rather than a PDOException, consistent with other internal
- classes which do not support serialization.
-
-- Reflection:
- . Reflection objects will now generate an exception if an attempt is made
- to serialize them. Serialization for reflection objects was never
- supported and resulted in corrupted reflection objects. It has been
- explicitly prohibited now.
- . The signature of the ReflectionMethod::getClosure() method changed to
- account for existing behavior with static methods:
- Before: ReflectionMethod::getClosure($object)
- After: ReflectionMethod::getClosure($object = null)
- The new signature is also (LSP) compatible with older PHP versions.
-
-- SPL:
- . Calling get_object_vars() on an ArrayObject instance will now always return
- the properties of the ArrayObject itself (or a subclass). Previously it
- returned the values of the wrapped array/object unless the STD_PROP_LIST
- flag was specified. Other affected operations are:
-
- * ReflectionObject::getProperties()
- * reset(), current(), etc. Use Iterator methods instead.
- * Potentially others working on object properties as a list.
- * Other internal functions that iterate over an array, but which
- previously silently accepted an ArrayObject as well; eg curl_setopt()
- when used with an option that expects an array.
-
- (array) casts are *not* affected. They will continue to return either the
- wrapped array, or the ArrayObject properties, depending on whether the
- STD_PROP_LIST flag is used.
- . SplPriorityQueue::setExtractFlags() will throw an exception if zero is
- passed. Previously this would generate a recoverable fatal error on the
- next extraction operation.
- . ArrayObject, ArrayIterator, SplDoublyLinkedList and SplObjectStorage now
- support the __serialize() + __unserialize() mechanism in addition to the
- Serializable interface. This means that serialization payloads created on
- older PHP versions can still be unserialized, but new payloads created by
- PHP 7.4 will not be understood by older versions.
-
-- Standard:
- . The "o" serialization format has been removed. As it is never produced by
- PHP, this may only break unserialization of manually crafted strings.
- . Password hashing algorithm identifiers are now nullable strings rather
- than integers.
-
- * PASSWORD_DEFAULT was int 1; now is null in PHP <7.4.3 and string '2y' afterwards
- * PASSWORD_BCRYPT was int 1; now is string '2y'
- * PASSWORD_ARGON2I was int 2; now is string 'argon2i'
- * PASSWORD_ARGON2ID was int 3; now is string 'argon2id'
-
- Applications correctly using the constants PASSWORD_DEFAULT,
- PASSWORD_BCRYPT, PASSWORD_ARGON2I, and PASSWORD_ARGON2ID will continue to
- function correctly.
- . htmlentities() will now throw a notice (instead of a strict standards
- warning) if it is used with an encoding for which only basic entity
- substitution is supported, in which case it is equivalent to
- htmlspecialchars().
- . fread() and fwrite() will now return false if the operation failed.
- Previously an empty string or 0 was returned. EAGAIN/EWOULDBLOCK are not
- considered failures.
- . fread() and fwrite() on plain files will now throw a notice on failure,
- such as when trying to write to a read-only file resource.
- . The stream_read() and stream_write() methods on stream wrappers now
- interpret "false" as a failure return values. If no data is available, but
- no error occurred, an empty string should be returned instead.
- . round(-0.0) will now return -0.0 rather than +0.0.
-
-- Tokenizer:
- . token_get_all() will now emit a T_BAD_CHARACTER token for unexpected
- characters instead of leaving behind holes in the token stream.
-
-========================================
-2. New Features
-========================================
-
-- Core:
- . Added support for typed properties. For example:
-
- class User {
- public int $id;
- public string $name;
- }
-
- This will enforce that $user->id can only be assigned integers and
- $user->name can only be assigned strings. For more information see the
- RFC: https://wiki.php.net/rfc/typed_properties_v2
-
- . Added support for arrow functions with implicit by-value scope binding.
- For example:
-
- $factor = 10;
- $nums = array_map(fn($num) => $num * $factor, $nums);
-
- RFC: https://wiki.php.net/rfc/arrow_functions_v2
-
- . Added support for limited return type covariance and argument type
- contravariance. The following code will now work:
-
- class A {}
- class B extends A {}
-
- class Producer {
- public function method(): A {}
+ . Methods with the same name as the class are no longer interpreted as
+ constructors. The __construct() method should be used instead.
+ . Removed ability to call non-static methods statically.
+ . Removed (unset) cast.
+ . Removed track_errors ini directive. This means that $php_errormsg is no
+ longer available. The error_get_last() function may be used instead.
+ . Removed the ability to define case-insensitive constants. The third
+ argument to define() may no longer be true.
+ . Access to undefined constants now always results in an Error exception.
+ Previously, unqualified constant accesses resulted in a warning and were
+ interpreted as strings.
+ . Removed ability to specify an autoloader using an __autoload() function.
+ spl_autoload_register() should be used instead.
+ . Removed the $errcontext argument for custom error handlers.
+ . Removed create_function(). Anonymous functions may be used instead.
+ . Removed each(). foreach or ArrayIterator should be used instead.
+ . Removed ability to unbind $this from closures that were created from a
+ method, using Closure::fromCallable() or ReflectionMethod::getClosure().
+ . Also removed ability to unbind $this from proper closures that contain uses
+ of $this.
+ . Removed ability to use array_key_exists() with objects. Use one of isset()
+ or property_exists() instead.
+ . Made the behavior of array_key_exists() regarding the type of the key
+ parameter consistent with isset() and normal array access. All key types now use
+ the usual coercions and array/object keys throw a TypeError.
+ . Any array that has a number n as its first numeric key will use n+1 for
+ its next implicit key. Even if n is negative.
+ RFC: https://wiki.php.net/rfc/negative_array_index
+ . The default error_reporting level is now E_ALL. Previously it excluded
+ E_NOTICE and E_DEPRECATED.
+ . display_startup_errors is now enabled by default.
+ . Using "parent" inside a class that has no parent will now result in a
+ fatal compile-time error.
+ . The @ operator will no longer silence fatal errors (E_ERROR, E_CORE_ERROR,
+ E_COMPILE_ERROR, E_USER_ERROR, E_RECOVERABLE_ERROR, E_PARSE). Error handlers
+ that expect error_reporting to be 0 when @ is used, should be adjusted to
+ use a mask check instead:
+
+ // Replace
+ function my_error_handler($err_no, $err_msg, $filename, $linenum) {
+ if (error_reporting() == 0) {
+ return; // Silenced
+ }
+ // ...
}
- class ChildProducer extends Producer {
- public function method(): B {}
- }
-
- Full variance support is only available if autoloading is used. Inside a
- single file only non-cyclic type references are possible, because all
- classes need to be available before they are referenced.
- RFC: https://wiki.php.net/rfc/covariant-returns-and-contravariant-parameters
-
- . Added support for coalesce assign (??=) operator. For example:
- $array['key'] ??= computeDefault();
- // is roughly equivalent to
- if (!isset($array['key'])) {
- $array['key'] = computeDefault();
+ // With
+ function my_error_handler($err_no, $err_msg, $filename, $linenum) {
+ if (!(error_reporting() & $err_no)) {
+ return; // Silenced
+ }
+ // ...
}
- RFC: https://wiki.php.net/rfc/null_coalesce_equal_operator
-
- . Added support for unpacking inside arrays. For example:
-
- $arr1 = [3, 4];
- $arr2 = [1, 2, ...$arr1, 5];
- // $arr2 == [1, 2, 3, 4, 5]
-
- RFC: https://wiki.php.net/rfc/spread_operator_for_array
-
- . Added support for underscore separators in numeric literals. Some examples:
-
- 6.674_083e-11; // float
- 299_792_458; // decimal
- 0xCAFE_F00D; // hexadecimal
- 0b0101_1111; // binary
-
- RFC: https://wiki.php.net/rfc/numeric_literal_separator
-
- . Support for WeakReferences has been added.
- RFC: https://wiki.php.net/rfc/weakrefs
+ Additionally, care should be taken that error messages are not displayed in
+ production environments, which can result in information leaks. Please
+ ensure that display_errors=Off is used in conjunction with error logging.
+ . Inheritance errors due to incompatible method signatures (LSP violations)
+ will now always generate a fatal error. Previously a warning was generated
+ in some cases.
+ RFC: https://wiki.php.net/rfc/lsp_errors
+ . The precedence of the concatenation operator has changed relative to
+ bitshifts and addition as well as subtraction.
+ RFC: https://wiki.php.net/rfc/concatenation_precedence
+ . Arguments with a default-value that resolves to null at run-time will no
+ longer implicitly mark the argument type as nullable. Either use an explicit
+ nullable type, or an explicit null default value instead.
+
+ // Replace
+ function test(int $arg = CONST_RESOLVING_TO_NULL) {}
+ // With
+ function test(?int $arg = CONST_RESOLVING_TO_NULL) {}
+ // Or
+ function test(int $arg = null) {}
+ . A number of warnings have been converted into Error exceptions:
+
+ * Attempting to write to a property of a non-object. Previously this
+ implicitly created an stdClass object for null, false and empty strings.
+ * Attempting to append an element to an array for which the PHP_INT_MAX key
+ is already used.
+ * Attempting to use an invalid type (array or object) as an array key or
+ string offset.
+ * Attempting to write to an array index of a scalar value.
+ * Attempting to unpack a non-array/Traversable.
+
+ A number of notices have been converted into warnings:
+
+ * Attempting to read an undefined variable.
+ * Attempting to read an undefined property.
+ * Attempting to read a property of a non-object.
+ * Attempting to access an array index of a non-array.
+ * Attempting to convert an array to string.
+ * Attempting to use a resource as an array key.
+ * Attempting to use null, a boolean or a float as a string offset.
+ * Attempting to read an out-of-bounds string offset.
+ * Attempting to assign an empty string to a string offset.
+
+ RFC: https://wiki.php.net/rfc/engine_warnings
+ . Attempting to assign multiple bytes to a string offset will now emit a warning.
+ . Unexpected characters in source files (such as null bytes outside of
+ strings) will now result in a ParseError exception instead of a compile
+ warning.
+ . Uncaught exceptions now go through "clean shutdown", which means that
+ destructors will be called after an uncaught exception.
+ . Compile time fatal error "Only variables can be passed by reference" has been
+ delayed until run-time and converted to "Cannot pass parameter by reference"
+ exception.
+ . Some "Only variables should be passed by reference" notices have been converted
+ to "Cannot pass parameter by reference" exception.
- . Throwing exceptions from __toString() is now permitted. Previously this
- resulted in a fatal error. Existing recoverable fatals in string conversions
- have been converted to Error exceptions.
- RFC: https://wiki.php.net/rfc/tostring_exceptions
+- COM:
+ . Removed the ability to import case-insensitive constants from type
+ libraries. The second argument to com_load_typelib() may no longer be false;
+ com.autoregister_casesensitive may no longer be disabled; case-insensitive
+ markers in com.typelib_file are ignored.
-- CURL:
- . CURLFile now supports stream wrappers in addition to plain file names, if
- the extension has been built against libcurl >= 7.56.0. The streams may
- need to be seekable.
+- Date:
+ . mktime() and gmmktime() now require at least one argument. time() can be
+ used to get the current timestamp.
+
+- dom:
+ . Remove unimplemented classes from ext/dom that had no behavior and contained
+ test data. These classes have also been removed in the latest version of DOM
+ standard:
+
+ * DOMNameList
+ * DomImplementationList
+ * DOMConfiguration
+ * DomError
+ * DomErrorHandler
+ * DOMImplementationSource
+ * DOMLocator
+ * DOMUserDataHandler
+ * DOMTypeInfo
+
+- Exif:
+ . Removed read_exif_data(). exif_read_data() should be used instead.
- Filter:
- . The FILTER_VALIDATE_FLOAT filter now supports the min_range and max_range
- options, with the same semantics as FILTER_VALIDATE_INT.
-
-- FFI:
- . A new extension which provides a simple way to call native functions, access
- native variables and create/access data structures defined in C libraries.
- RFC: https://wiki.php.net/rfc/ffi
+ . The FILTER_FLAG_SCHEME_REQUIRED and FILTER_FLAG_HOST_REQUIRED flags for the
+ FILTER_VALIDATE_URL filter have been removed. The scheme and host are (and
+ have been) always required.
+ . The INPUT_REQUEST and INPUT_SESSION source for filter_input() etc have been
+ removed. These were never implemented and their use always generated a
+ warning.
- GD:
- . Added the "scatter" image filter (IMG_FILTER_SCATTER) to apply a scatter
- filter to images. This filter has the following prototype:
-
- imagefilter($im, IMG_FILTER_SCATTER, int $sub, int $plus, array $colors = []);
+ . The GD extension now uses objects as the underlying data structure for
+ images, rather than resources. These objects are completely opaque, i.e.
+ they don't have any methods.
+ . The deprecated function image2wbmp() has been removed.
+ RFC: https://wiki.php.net/rfc/image2wbmp
+ . The deprecated functions png2wbmp() and jpeg2wbmp() have been removed.
+ RFC: https://wiki.php.net/rfc/deprecate-png-jpeg-2wbmp
+ . The default $mode parameter of imagecropauto() no longer accepts -1.
+ IMG_CROP_DEFAULT should be used instead.
+
+- GMP:
+ . gmp_random() has been removed. One of gmp_random_range() or
+ gmp_random_bits() should be used instead.
- The $colors array can be populated with a set of indexed colors to
- apply the scatter pixel shifting on.
-
- Note, the result of this filter is always random.
+- Intl:
+ . The deprecated constant INTL_IDNA_VARIANT_2003 has been removed.
+ RFC: https://wiki.php.net/rfc/deprecate-and-remove-intl_idna_variant_2003
+ . The deprecated Normalizer::NONE constant has been removed.
+ . The IntlDateFormatter::RELATIVE_FULL, IntlDateFormatter::RELATIVE_LONG,
+ IntlDateFormatter::RELATIVE_MEDIUM, and IntlDateFormatter::RELATIVE_SHORT constants
+ have been added.
-- Hash:
- . Added "crc32c" hash using Castagnoli's polynomial. This crc32 variant is
- used by storage systems, such as iSCSI, SCTP, Btrfs and ext4.
+- LDAP:
+ . The deprecated function ldap_sort has been removed.
- Mbstring:
- . Added mb_str_split() function, which provides the same functionality as
- str_split(), but operating on code points rather than bytes.
- RFC: https://wiki.php.net/rfc/mb_str_split
- . Added mbstring.regex_retry_limit ini setting defaulting to 1000000. It
- limits the amount of backtracking that may be performed during one mbregex
- match and thus protects against exponential backtracking attacks (ReDOS).
- This setting only takes effect when linking against oniguruma >= 6.8.0.
-
-- OPcache:
- . Support for preloading code has been added.
- RFC: https://wiki.php.net/rfc/preload
+ . The mbstring.func_overload directive has been removed. The related
+ MB_OVERLOAD_MAIL, MB_OVERLOAD_STRING, and MB_OVERLOAD_REGEX constants have
+ also been removed. Finally, the "func_overload" and "func_overload_list"
+ entries in mb_get_info() have been removed.
+ . mb_parse_str() can no longer be used without specifying a result array.
+ . A number of deprecated mbregex aliases have been removed. See the following
+ list for which functions should be used instead:
+
+ * mbregex_encoding() -> mb_regex_encoding()
+ * mbereg() -> mb_ereg()
+ * mberegi() -> mb_eregi()
+ * mbereg_replace() -> mb_ereg_replace()
+ * mberegi_replace() -> mb_eregi_replace()
+ * mbsplit() -> mb_split()
+ * mbereg_match() -> mb_ereg_match()
+ * mbereg_search() -> mb_ereg_search()
+ * mbereg_search_pos() -> mb_ereg_search_pos()
+ * mbereg_search_regs() -> mb_ereg_search_regs()
+ * mbereg_search_init() -> mb_ereg_search_init()
+ * mbereg_search_getregs() -> mb_ereg_search_getregs()
+ * mbereg_search_getpos() -> mb_ereg_search_getpos()
+ * mbereg_search_setpos() -> mb_ereg_search_setpos()
+
+ . The 'e' modifier for mb_ereg_replace() has been removed.
+ mb_ereg_replace_callback() should be used instead.
+ . A non-string pattern argument to mb_ereg_replace() will now be interpreted
+ as a string instead of an ASCII codepoint. The previous behavior may be
+ restored with an explicit call to chr().
+ . The needle argument for mb_strpos(), mb_strrpos(), mb_stripos(), mb_strripos(),
+ mb_strstr(), mb_stristr(), mb_strrchr() and mb_strrichr() can now be empty.
+ . The $is_hex parameter, which was not used internally, has been removed from
+ mb_decode_numericentity().
+ . The legacy behaviour of passing the encoding as the third argument instead of an offset for the mb_strrpos
+ function has been removed, provide an explicit 0 offset with the encoding as the fourth argument.
- PCRE:
- . The preg_replace_callback() and preg_replace_callback_array() functions now
- accept an additional $flags argument, with support for the
- PREG_OFFSET_CAPTURE and PREG_UNMATCHED_AS_NULL flags. This influences the
- format of the matches array passed to the callback function.
+ . When passing invalid escape sequences they are no longer interpreted as
+ literals. This behaviour previously required the X modifier - which is
+ now ignored.
- PDO:
- . The username and password can now be specified as part of the PDO DSN for
- the mysql, mssql, sybase, dblib, firebird and oci drivers. Previously this
- was only supported by the pgsql driver. If a username/password is specified
- both in the constructor and the DSN, the constructor takes precedence.
+ . The method PDOStatement::setFetchMode() now accepts the following signature:
- new PDO("mysql:host=xxx;port=xxx;dbname=xxx;user=xxx;password=xxx");
+ PDOStatement::setFetchMode($mode, $classname, $params)
-- PDO_OCI:
- . PDOStatement::getColumnMeta() is now available
+- PDO_ODBC:
+ . The php.ini directive pdo_odbc.db2_instance_name has been removed
-- PDO_SQLite:
- . PDOStatement::getAttribute(PDO::SQLITE_ATTR_READONLY_STATEMENT) allows
- checking whether the statement is read-only, i.e. if it doesn't modify
- the database.
- . PDO::setAttribute(PDO::SQLITE_ATTR_EXTENDED_RESULT_CODES, true) enables the
- use of SQLite3 extended result codes in errorInfo().
+- Reflection:
+ . The method signatures
-- SQLite3:
- . Added SQLite3::lastExtendedErrorCode() to fetch the last extended result
- code.
- . Added SQLite3::enableExtendedResultCodes($enable = true), which will make
- SQLite3::lastErrorCode() return extended result codes.
+ ReflectionClass::newInstance($args)
+ ReflectionFunction::invoke($args)
+ ReflectionMethod::invoke($object, $args)
-- Standard:
- . strip_tags() now also accepts an array of allowed tags: Instead of
- strip_tags($str, '<a><p>') you can now write strip_tags($str, ['a', 'p']).
+ have been changed to:
- . A new mechanism for custom object serialization has been added, which
- uses two new magic methods:
+ ReflectionClass::newInstance(...$args)
+ ReflectionFunction::invoke(...$args)
+ ReflectionMethod::invoke($object, ...$args)
- // Returns array containing all the necessary state of the object.
- public function __serialize(): array;
+ Code that must be compatible with both PHP 7 and PHP 8 can use the following
+ signatures to be compatible with both versions:
- // Restores the object state from the given data array.
- public function __unserialize(array $data): void;
+ ReflectionClass::newInstance($arg = null, ...$args)
+ ReflectionFunction::invoke($arg = null, ...$args)
+ ReflectionMethod::invoke($object, $arg = null, ...$args)
- The new serialization mechanism supersedes the Serializable interface,
- which will be deprecated in the future.
+ . The ReflectionType::__toString() method will now return a complete debug
+ representation of the type, and is no longer deprecated. In particular the
+ result will include a nullability indicator for nullable types. The format
+ of the return value is not stable and may change between PHP versions.
- RFC: https://wiki.php.net/rfc/custom_object_serialization
+- Socket:
+ . The deprecated AI_IDN_ALLOW_UNASSIGNED and AI_IDN_USE_STD3_ASCII_RULES
+ flags for socket_addrinfo_lookup() have been removed.
- . A new 'max_depth' option for unserialize(), as well as an
- unserialize_max_depth ini setting have been added. These control the
- maximum depth of structures permitted during unserialization, and are
- intended to prevent stack overflows. The default depth limit is 4096 and
- can be disabled by setting unserialize_max_depth=0.
+- SPL:
+ . SplFileObject::fgetss() has been removed.
+ . SplHeap::compare($a, $b) now specifies a method signature. Inheriting
+ classes implementing this method will now have to use a compatible
+ method signature.
- . array_merge() and array_merge_recursive() may now be called without any
- arguments, in which case they will return an empty array. This is useful
- in conjunction with the spread operator, e.g. array_merge(...$arrays).
+- Standard:
+ . assert() will no longer evaluate string arguments, instead they will be
+ treated like any other argument. assert($a == $b) should be used instead of
+ assert('$a == $b'). The assert.quiet_eval ini directive and
+ ASSERT_QUIET_EVAL constants have also been removed, as they would no longer
+ have any effect.
+ . parse_str() can no longer be used without specifying a result array.
+ . fgetss() has been removed.
+ . The string.strip_tags filter has been removed.
+ . The needle argument of strpos(), strrpos(), stripos(), strripos(), strstr(),
+ strchr(), strrchr(), and stristr() will now always be interpreted as a
+ string. Previously non-string needles were interpreted as an ASCII code
+ point. An explicit call to chr() can be used to restore the previous
+ behavior.
+ . The needle argument for strpos(), strrpos(), stripos(), strripos(), strstr(),
+ stristr() and strrchr() can now be empty.
+ . The length argument for substr(), substr_count(), substr_compare(), and
+ iconv_substr() can now be null. Null values will behave as if no length
+ argument was provided and will therefore return the remainder of the string
+ instead of an empty string.
+ . The length argument for array_splice() can now be null. Null values will
+ behave identically to omitting the argument, thus removing everything from
+ the 'offset' to the end of the array.
+ . The 'salt' option of password_hash() is no longer supported. If the 'salt'
+ option is used a warning is generated, the provided salt is ignored, and a
+ generated salt is used instead.
+ . The quotemeta() function will now return an empty string if an empty string
+ was passed. Previously false was returned.
+ . hebrevc() has been removed.
+ . convert_cyr_string() has been removed.
+ . money_format() has been removed.
+ . ezmlm_hash() has been removed.
+ . get_magic_quotes_gpc() and get_magic_quotes_gpc_runtime() has been removed.
+ . FILTER_SANITIZE_MAGIC_QUOTES has been removed.
+ . Calling implode() with parameters in a reverse order ($pieces, $glue) is no
+ longer supported.
+ . parse_url() will now distinguish absent and empty queries and fragments:
+
+ http://example.com/foo => query = null, fragment = null
+ http://example.com/foo? => query = "", fragment = null
+ http://example.com/foo# => query = null, fragment = ""
+ http://example.com/foo?# => query = "", fragment = ""
+
+ Previously all cases resulted in query and fragment being null.
+
+- tidy:
+ . The $use_include_path parameter, which was not used internally, has been
+ removed from tidy_repair_string().
+
+- XML:
+ . xml_parser_create(_ns) will now return an XmlParser object rather than a
+ resource. Return value checks using is_resource() should be replaced with
+ checks for `false`. The xml_parser_free() function no longer has an effect,
+ instead the XmlParser instance is automatically destroyed if it is no longer
+ referenced.
+
+- XMLWriter:
+ . The XMLWriter functions now accept and return, respectively, XMLWriter
+ objects instead of resources.
- . proc_open() now accepts an array instead of a string for the command. In
- this case the process will be opened directly (without going through a
- shell) and PHP will take care of any necessary argument escaping.
+- Zip:
+ . The remove_path option of ZipArchive::addGlob() and ::addPattern() is now
+ treated as arbitrary string prefix (for consistency with the add_path
+ option), whereas formerly it was treated as directory name. This means that
+ if no trailing directory separator is given, the following character is
+ no longer stripped from the filename.
- proc_open(['php', '-r', 'echo "Hello World\n";'], $descriptors, $pipes);
+- Zlib:
+ . gzgetss() has been removed.
- . proc_open() now supports "redirect" and "null" descriptors. For example:
+========================================
+2. New Features
+========================================
- // Like 2>&1 on the shell
- proc_open($cmd, [1 => ['pipe', 'w'], 2 => ['redirect', 1]], $pipes);
- // Like 2>/dev/null or 2>nul on the shell
- proc_open($cmd, [1 => ['pipe', 'w'], 2 => ['null']], $pipes);
+- Core:
+ . Added support for union types.
+ RFC: https://wiki.php.net/rfc/union_types_v2
+ . Added WeakMap.
+ RFC: https://wiki.php.net/rfc/weak_maps
+ . Added ValueError class.
+ . Any number of function parameters may now be replaced by a variadic
+ argument, as long as the types are compatible. For example, the following
+ code is now allowed:
+
+ class A {
+ public function method(int $many, string $parameters, $here) {}
+ }
+ class B extends A {
+ public function method(...$everything) {}
+ }
+ . It is now possible to fetch the class name of an object using
+ `$object::class`. The result is the same as `get_class($object)`.
+ RFC: https://wiki.php.net/rfc/class_name_literal_on_object
+ . New and instanceof can now be used with arbitary expressions, using
+ `new (expression)(...$args)` and `$obj instanceof (expression)`.
+ RFC: https://wiki.php.net/rfc/variable_syntax_tweaks
+ . Some consistency fixes to variable syntax have been applied, for example
+ writing `Foo::BAR::$baz` is now allowed.
+ RFC: https://wiki.php.net/rfc/variable_syntax_tweaks
- . password_hash() has argon2i(d) implementations from ext/sodium when PHP is
- built without libargon.
- RFC: https://wiki.php.net/rfc/sodium.argon.hash
+- Date:
+ . Added DateTime::createFromInterface() and
+ DateTimeImmutable::createFromInterface().
========================================
3. Changes in SAPI modules
========================================
+- CGI and FPM will now use CONTEXT_DOCUMENT_ROOT to scan for .user.ini files,
+ if it is defined. Otherwise, DOCUMENT_ROOT will be used as before. This
+ improves support for Apache mod_userdir and mod_alias.
+
========================================
4. Deprecated Functionality
========================================
-- Core:
- . Nesting ternary operators without explicit parentheses is deprecated:
-
- // Code like
- $a ? $b : $c ? $d : $e
- // should be replaced by (current interpretation)
- ($a ? $b : $c) ? $d : $e
- // or (likely intended interpretation)
- $a ? $b : ($c ? $d : $e)
-
- RFC: https://wiki.php.net/rfc/ternary_associativity
- . The array and string offset access syntax using curly braces is deprecated.
- Use $str[$idx] instead of $str{$idx}.
- RFC: https://wiki.php.net/rfc/deprecate_curly_braces_array_access
- . The (real) cast is deprecated, use (float) instead.
- . Unbinding $this of a non-static method through a combination of
- ReflectionMethod::getClosure() and closure rebinding is deprecated. Doing
- so is equivalent to calling a non-static method statically, which has been
- deprecated since PHP 7.0.
- . Unbinding $this of a non-static closure that uses $this is deprecated.
- . Using "parent" inside a class without a parent is deprecated, and will throw
- a compile-time error in the future. Currently an error will only be
- generated if/when the parent is accessed at run-time.
- . The allow_url_include ini directive is deprecated. Enabling it will generate
- a deprecation notice at startup.
-
-- COM:
- . Importing type libraries with case-insensitive constant registering has been
- deprecated.
-
-- Filter:
- . FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES
- instead.
-
-- Mbstring:
- . Passing a non-string pattern to mb_ereg_replace() is deprecated. Currently
- non-string patterns are interpreted as ASCII codepoints. In PHP 8 the
- pattern will be interpreted as a string instead.
- . Passing the encoding as 3rd parameter to mb_strrpos() is deprecated. Instead
- pass a 0 offset and encoding as 4th parameter.
-
-- LDAP:
- . ldap_control_paged_result_response and ldap_control_paged_result are
- deprecated. Pagination controls can be sent along with ldap_search instead.
-
-- Reflection:
- . Calls to ReflectionType::__toString() now generate a deprecation notice.
- This method has been deprecated in favor of ReflectionNamedType::getName()
- in the documentation since PHP 7.1, but did not throw a deprecation notice
- for technical reasons.
- . The export() methods on all Reflection classes are deprecated. Construct a
- Reflection object and convert it to string instead:
-
- // ReflectionClass::export(Foo::class, false) is:
- echo new ReflectionClass(Foo::class), "\n";
- // $str = ReflectionClass::export(Foo::class, true) is:
- $str = (string) new ReflectionClass(Foo::class);
-
-- Socket:
- . The AI_IDN_ALLOW_UNASSIGNED and AI_IDN_USE_STD3_ASCII_RULES flags for
- socket_addrinfo_lookup() are deprecated, due to an upstream deprecation in
- glibc.
-
-- Standard:
- . Passing invalid characters to ''base_convert()'', ''bindec()'', ''octdec()''
- and ''hexdec()'' will now generate a deprecation notice. The result will
- still be computed as if the invalid characters did not exist. Leading and
- trailing whitespace, as well as prefixes of type 0x (depending on base)
- continue to be allowed.
- . Using array_key_exists() on objects is deprecated. Instead either isset()
- or property_exists() should be used.
- . The is_real() function is deprecated, use is_float() instead.
- . The get_magic_quotes_gpc() and get_magic_quotes_runtime() functions are
- deprecated. They always return false.
- . The hebrevc() function is deprecated. It can be replaced with
- nl2br(hebrev($str)), or preferably the use of Unicode RTL support.
- . The convert_cyr_string() function is deprecated. It can be replaced by one
- of mb_convert_string(), iconv() or UConverter.
- . The money_format() function is deprecated. It can be replaced by the
- intl NumberFormatter functionality.
- . The ezmlm_hash() function is deprecated.
- . The restore_include_path() function is deprecated. It can be replaced by
- ini_restore('include_path').
- . Passing parameters to implode() in reverse order is deprecated, use
- implode($glue, $parts) instead of implode($parts, $glue).
-
========================================
5. Changed Functions
========================================
-- SPL:
- . SplFileObject::fputcsv(), ::fgetcsv() and ::setCsvControl() now accept an
- empty string as $escape argument, which disables the proprietary PHP
- escaping mechanism. SplFileObject::getCsvControl() now may also return an
- empty string for the third array element, accordingly.
-
-- Standard:
- . fputcsv() and fgetcsv() now accept an empty string as $escape argument,
- which disables the proprietary PHP escaping mechanism. The behavior of
- str_getcsv() has been adjusted accordingly (formerly, an empty string was
- identical to using the default).
- . proc_open() on Windows can be passed a "create_process_group" option. It
- is required, if the child process is supposed to handle CTRL events.
- . password_hash() now accepts nullable string and int as $algo argument.
- . password_needs_rehash() now accepts nullable string and int as $algo
- argument.
-
========================================
6. New Functions
========================================
-- Core:
- . Added get_mangled_object_vars($object) function, which returns the mangled
- object properties. It returns the same result as (array) $object, with the
- exception that it ignores overloaded array casts, such as used by
- ArrayObject.
-
-- GD:
- . Added imagecreatefromtga() function, which allows reading images in TGA
- format. TGA support is now also indicated by gd_info() and imagetypes().
- Note that TGA images are not recognized by imagecreatefromstring() and
- getimagesize().
-
-- OpenSSL:
- . Added openssl_x509_verify(mixed cert, mixed key) function that verifies the
- signature of the certificate using a public key. A wrapper around the
- OpenSSL's X509_verify() function.
- See <https://github.com/php/php-src/pull/3624>.
-
-- Pcntl:
- . Added bool pcntl_unshare(int flags) function which allows dissociating
- parts of the process execution context which are currently being shared with
- other processes. Explicitly, it allows you to unshare the mount, IPC, UTS,
- network, PID, user and cgroup namespaces.
-
- SQLite3:
- . Added SQLite3Stmt::getSQL() to retrieve the SQL of the statement. If true is
- passed as $expanded argument, query parameters will be replaced in the
- return value by their currently bound value, if libsqlite ≥ 3.14 is used.
- . Added SQLite3::backup() to create database backups via the SQLite3 online
- backup API.
-
-- Standard
- . bool sapi_windows_set_ctrl_handler(callable handler, [, bool add = true]) -
- set or remove a handler function upon receiving a CTRL event. The handler
- function is expected to have this signature: "function handler(int $event)".
- . bool sapi_windows_generate_ctrl_event(int type, int pid) - send a CTRL event
- to another process.
- . array password_algos() - return a complete list of all registered password
- hashing algorithms. For more details see the RFC:
- https://wiki.php.net/rfc/password_registry
+ . Add SQLite3::setAuthorizer() and respective class constants to set a
+ userland callback that will be used to authorize or not an action on the
+ database.
+ PR: https://github.com/php/php-src/pull/4797
+
+- Standard:
+ . Added fdiv() method, which performs a floating-point division under
+ IEEE 754 semantics. Division by zero is considered well-defined and
+ will return one of Inf, -Inf or NaN.
========================================
7. New Classes and Interfaces
========================================
-- Reflection:
- . A new ReflectionReference class has been added, which allows detecting
- references and comparing them for identity. For more details see the RFC:
- https://wiki.php.net/rfc/reference_reflection
-
========================================
8. Removed Extensions and SAPIs
========================================
-- Interbase:
- . The interbase extension has been moved to PECL. Access to an InterBase
- and/or FireBird based database is still available with the PDO_Firebird
- extension. For more details see the RFC:
- https://wiki.php.net/rfc/deprecate-and-remove-ext-interbase
-
-- Recode:
- . The recode extension has been moved to PECL. For character set/encoding
- conversion the iconv or mbstring extensions could be used instead.
- RFC: https://wiki.php.net/rfc/unbundle_recode
-
-- WDDX:
- . The WDDX extension has been deprecated and moved to PECL.
- RFC: https://wiki.php.net/rfc/deprecate-and-remove-ext-wddx
-
========================================
9. Other Changes to Extensions
========================================
- DBA:
- . As of PHP 7.4.2, dba_open() accepts a fifth optional parameter for lmdb
- databases which allows to specify the mapsize. The parameter defaults to
- zero, in which case the compiled in default mapsize (usually 1048576) will
- be used. The mapsize should be a multiple of the page size of the OS.
+- CURL:
+ . The CURL extension now requires at least libcurl 7.29.0.
- GD:
- . The behavior of imagecropauto() in the bundled libgd has been synced with
- that of system libgd:
- * IMG_CROP_DEFAULT is no longer falling back to IMG_CROP_SIDES
- * Threshold-cropping now uses the algorithm of system libgd
- . The default $mode parameter of imagecropauto() has been changed to
- IMG_CROP_DEFAULT; passing -1 is now deprecated.
- . imagescale() now supports aspect ratio preserving scaling to a fixed height
- by passing -1 as $new_width.
-
-- Filter:
- . The filter extension no longer exposes --with-pcre-dir for Unix builds and
- can now reliably be built as shared when using ./configure once more.
-
-- Hash:
- . The hash extension cannot be disabled anymore and is always an integral part
- of any PHP build, similar to the date extension.
-
-- Intl:
- . The Intl extension now requires at least ICU 50.1.
- . ResourceBundle now implements Countable.
-
-- Ldap:
- . Support for nsldap has been removed.
- . Support for umich_ldap has been removed.
-
-- Libxml:
- . All libxml based extensions now require libxml 2.7.6 or newer.
-
-- Mbstring:
- . The oniguruma library is no longer bundled with PHP, instead libonig needs
- to be available on the system. Alternatively --disable-mbregex can be used
- to disable the mbregex component.
-
-- OPcache:
- . The --disable-opcache-file|--enable-opcache-file configure options have been
- removed in favor of the opcache.file_cache INI directive.
-
-- PDO:
- . It is now possible to escape question marks in SQL queries to avoid them
- being interpreted as parameter placeholders. Writing "??" allows sending
- a single question mark to the database and e.g. use the PostgreSQL JSON key
- exists "?" operator. For more details see the RFC:
- https://wiki.php.net/rfc/pdo_escape_placeholders
-
-- PDO_Firebird:
- . The extension now also support dialect 1 in addition to dialect 3.
-
-- Reflection:
- . Numeric value of class, property, function and constant modifiers was
- changed. Don't filter methods and properties through
- ReflectionClass::getMethods() and ReflectionClass::getProperties(), or test
- results of Reflection...::getModifiers(), using hard-coded numeric values.
- Use corresponding constants instead (e.g. ReflectionMethod::IS_PUBLIC).
-
-- SimpleXML:
- . SimpleXMLElement now implements Countable.
-
-- SQLite3:
- . The bundled libsqlite has been removed. To build the SQLite3 extension a
- system libsqlite3 ≥ 3.7.4 is now required. To build the PDO_SQLite extension
- a system libsqlite3 ≥ 3.5.0 is now required.
- . (Un)serialization of SQLite3, SQLite3Stmt and SQLite3Result is now
- explicitly forbidden. Formerly, serialization of instances of these classes
- was possible, but unserialization yielded unusable objects.
- . The @param notation can now also be used to denote SQL query parameters.
-
-- Zip:
- . The bundled libzip library has been removed. A system libzip >= 0.11 is now
- necessary to build the extension.
+ . The $num_points parameter of imagepolygon(), imageopenpolygon() and
+ imagefilledpolygon() is now optional, i.e. these functions may be called
+ with either 3 or 4 arguments. If the arguments is omitted, it is calculated
+ as count($points)/2.
+ . The function imagegetinterpolation() to get the current interpolation method
+ has been added.
========================================
10. New Global Constants
========================================
-- Mbstring:
- . MB_ONIGURUMA_VERSION specifies the version of the oniguruma library against
- which mbregex has been built.
-
-- Socket:
- . Added FreeBSD-specific socket options:
- . SO_LABEL
- . SO_PEERLABEL
- . SO_LISTENQLIMIT
- . SO_LISTENQLEN
- . SO_USER_COOKIE
-
-- Standard:
- . PHP_WINDOWS_EVENT_CTRL_C
- . PHP_WINDOWS_EVENT_CTRL_BREAK
-
-- Tidy:
- . TIDY_TAG_ARTICLE
- . TIDY_TAG_ASIDE
- . TIDY_TAG_AUDIO
- . TIDY_TAG_BDI
- . TIDY_TAG_CANVAS
- . TIDY_TAG_COMMAND
- . TIDY_TAG_DATALIST
- . TIDY_TAG_DETAILS
- . TIDY_TAG_DIALOG
- . TIDY_TAG_FIGCAPTION
- . TIDY_TAG_FIGURE
- . TIDY_TAG_FOOTER
- . TIDY_TAG_HEADER
- . TIDY_TAG_HGROUP
- . TIDY_TAG_MAIN
- . TIDY_TAG_MARK
- . TIDY_TAG_MENUITEM
- . TIDY_TAG_METER
- . TIDY_TAG_NAV
- . TIDY_TAG_OUTPUT
- . TIDY_TAG_PROGRESS
- . TIDY_TAG_SECTION
- . TIDY_TAG_SOURCE
- . TIDY_TAG_SUMMARY
- . TIDY_TAG_TEMPLATE
- . TIDY_TAG_TIME
- . TIDY_TAG_TRACK
- . TIDY_TAG_VIDEO
+- Filter:
+ . FILTER_VALIDATE_BOOL has been added as an alias for FILTER_VALIDATE_BOOLEAN.
+ The new name is preferred, as it uses the canonical type name.
========================================
11. Changes to INI File Handling
========================================
-- zend.exception_ignore_args
- . New INI directive to include or exclude arguments from stack traces
- generated for exceptions.
-
-- opcache.preload_user
- . New INI directive to specify the user account under which preloading code
- is executed, if it was to be run as root otherwise (which is not allowed
- for security reasons).
-
========================================
12. Windows Support
========================================
-- stat:
- . The stat implementation has been refactored.
- - An inode number is delivered and is based on the NTFS file index.
- - The device number is now based on the volume serial number.
-
- Note that both values are derived from the system and provided as is on 64-bit
- systems. On 32-bit systems, these values might overflow the 32-bit integer in
- PHP, so they're fake.
-
-- CTRL+C and CTRL+BREAK on console can be caught by setting a handler function
- with sapi_windows_set_ctrl_handler().
-
-- configure now regards additional CFLAGS and LDFLAGS set as environment
- variables.
-
-- OPcache now supports an arbitrary amount of separate caches per user via
- the INI directive opcache.cache_id. All processes with the same cache ID and
- user share an OPcache instance.
-
-- The OpenSSL default config path has been changed to
- "C:\Program Files\Common Files\SSL\openssl.cnf" and
- "C:\Program Files (x86)\Common Files\SSL\openssl.cnf", respectively.
-
-========================================
-13. Migration to pkg-config
-========================================
-
-A number of extensions have been migrated to exclusively use pkg-config for the
-detection of library dependencies. Generally, this means that instead of using
---with-foo-dir=DIR or similar only --with-foo is used. Custom library paths can
-be specified either by adding additional directories to PKG_CONFIG_PATH or by
-explicitly specifying compilation options through FOO_CFLAGS and FOO_LIBS.
-
-The following extensions and SAPIs are affected:
-
-- Curl:
- . --with-curl no longer accepts a directory.
-
-- Enchant:
- . --with-enchant no longer accepts a directory.
-
-- FPM:
- . --with-fpm-systemd now uses only pkg-config for libsystem checks. The
- libsystemd minimum required version is 209.
-
-- GD:
- . --with-gd becomes --enable-gd (whether to enable the extension at all) and
- --with-external-gd (to opt into using an external libgd, rather than the
- bundled one).
- . --with-png-dir has been removed. libpng is required.
- . --with-zlib-dir has been removed. zlib is required.
- . --with-freetype-dir becomes --with-freetype.
- . --with-jpeg-dir becomes --with-jpeg.
- . --with-webp-dir becomes --with-webp.
- . --with-xpm-dir becomes --with-xpm.
-
-- IMAP:
- . --with-kerberos no longer accepts a directory.
-
-- Intl:
- . --with-icu-dir has been removed. If --enable-intl is passed, then libicu is
- always required.
-
-- Ldap:
- . --with-ldap-sasl no longer accepts a directory.
-
-- Libxml:
- . --with-libxml-dir has been removed.
- . --enable-libxml becomes --with-libxml.
- . --with-libexpat-dir has been renamed to --with-expat and no longer accepts a
- directory.
-
-- LiteSpeed:
- . --with-litespeed becomes --enable-litespeed.
-
-- Mbstring:
- . --with-onig has been removed. Unless --disable-mbregex has been passed,
- libonig is required.
-
-- ODBC:
- . --with-iodbc no longer accepts a directory.
- . --with-unixODBC without a directory now uses pkg-config (preferred).
- Directory is still accepted for old versions without libodbc.pc.
-
-- OpenSSL:
- . --with-openssl no longer accepts a directory.
- . --with-kerberos no longer accepts a directory.
-
-- PCRE:
- . --with-pcre-regex has been removed. Instead --with-external-pcre is provided
- to opt into using an external PCRE library, rather than the bundled one.
-
-- PDO_SQLite:
- . --with-pdo-sqlite no longer accepts a directory.
-
-- Readline:
- . --with-libedit no longer accepts a directory.
-
-- Sodium:
- . --with-sodium no longer accepts a directory.
-
-- SQLite3:
- . --with-sqlite3 no longer accepts a directory.
-
-- XSL:
- . --with-xsl no longer accepts a directory.
-
-- Zip:
- . --with-libzip has been removed.
- . --enable-zip becomes --with-zip.
+- php-test-pack:
+ . The test runner has been renamed from run-test.php to run-tests.php, to
+ match its name in php-src.
========================================
-14. Other Changes
+13. Other Changes
========================================
========================================
-15. Performance Improvements
+14. Performance Improvements
========================================
-- Core:
- . A specialized VM opcode for the array_key_exists() function has been added,
- which improves performance of this function if it can be statically
- resolved. In namespaced code, this may require writing \array_key_exists()
- or explicitly importing the function.
-
-- PCRE:
- . When preg_match() in UTF-8 mode ("u" modifier) is repeatedly called on the
- same string (but possibly different offsets), it will only be checked for
- UTF-8 validity once.
+- array_slice() on an array without gaps will no longer scan the whole array to find
+ the start offset. This may significantly reduce the runtime of the function
+ with large offsets and small lengths.
diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS
index 84aea93828..297d1d7b2c 100644
--- a/UPGRADING.INTERNALS
+++ b/UPGRADING.INTERNALS
@@ -1,31 +1,18 @@
-PHP 7.4 INTERNALS UPGRADE NOTES
+PHP 8.0 INTERNALS UPGRADE NOTES
1. Internal API changes
- a. php_sys_symlink() and php_sys_link()
- b. zend_lookup_class_ex() and zend_fetch_class_by_name()
- c. Function/property/class flags
- d. Removed zend_check_private()
- e. php_win32_error_to_msg() memory management
- f. get_properties_for() handler / Z_OBJDEBUG_P
- g. Required object handlers
- h. Immutable classes and op_arrays
- i. php_fgetcsv() and php_fputcsv()
- j. Removed add_get_assoc_*() and add_get_index_*()
- k. Class declaration opcodes
- l. HASH_FLAG_INITIALIZED
- m. write_property return value
- n. Assignments to references
- o. ZEND_COMPILE_EXTENDED_INFO split
- p. ZEND_EXT_FCALL_BEGIN can access arguments
- q. ZEND_COMPILE_IGNORE_USER_FUNCTIONS and ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS
- r. TSRM environment locking
- s. Typed references support
- t. Exceptions thrown by string conversions.
- u. Removed uint and ulong typedefs
- v. Compound assignment opcodes
- w. APACHE symbol removed
- x. php_error_docref0() renamed to php_error_docref()
- y. Stream wrapper read/write ops
+ a. Object Handlers API
+ b. ZEND_OVERLOADED_FUNCTION and corresponding call_method() object handler
+ c. TSRM changes
+ d. get() and set() object handlers
+ e. zend_parse_parameters 'L' specifier
+ f. Arginfo argument types
+ g. zend_free_op type and should_free argument of zend_get_zval_ptr()
+ h. zend_value_error()
+ i. get_closure() object handler
+ j. compare_objects() and compare() object handlers
+ k. The 'I' length modifier
+ l. Some VM instructions switched to IS_TMP_VAR result insted of IS_VAR
2. Build system changes
a. Abstract
@@ -33,295 +20,103 @@ PHP 7.4 INTERNALS UPGRADE NOTES
c. Windows build system changes
3. Module changes
- a. ext/xml
- b. ext/hash
========================
1. Internal API changes
========================
- a. php_sys_symlink() and php_sys_link() portability macros have been
- added, which behave like POSIX's symlink() and link(), respectively, on
- POSIX compliant systems and on Windows.
-
- b. zend_lookup_class_ex() and zend_fetch_class_by_name() prototypes were
- changed to accept optional lower-case class name as zend_string*,
- instead of zval*.
-
- c. Function/property/class flags changes
- - ZEND_ACC_IMPLEMENTED_ABSTRACT is removed (it was used only internally
- during inheritance).
- - ZEND_ACC_IMPLICIT_PUBLIC is removed (it was used only for reflection)
- - ZEND_ACC_SHADOW property flag is removed. Instead of creating shadow
- clone, now we use the same private property_info, and should also
- check property_info->ce (in the same way as with methods).
- - ZEND_ACC_ANON_BOUND is replaced with ZEND_ACC_LINKED. This flag is set
- not only during anonymous classes declaration, but also during any
- run-time or compile-time class declaration.
- - ZEND_ACC_NO_RT_ARENA renamed into ZEND_ACC_HEAP_RT_CACHE. Now it's used
- not only for closures, but also for pseudo-main op_arrays.
- - ZEND_ACC_... flags are re-numbered.
-
- d. zend_check_private() is removed. Use (func->common.scope == scope) instead.
-
- e. Pointers returned by php_win32_error_to_msg() have to be freed using
- php_win32_error_msg_free(). Same regarding php_win_err() vs.
- php_win_err_free().
-
- f. A new, optional object handler with the signature
-
- HashTable *get_properties_for(zval *obj, zend_prop_purpose purpose)
-
- has been introduced, where zend_prop_purpose (currently) takes one of:
-
- ZEND_PROP_PURPOSE_DEBUG // var_dump etc.
- ZEND_PROP_PURPOSE_ARRAY_CAST // (array) $obj
- ZEND_PROP_PURPOSE_SERIALIZE // "O"-format serialization (__wakeup)
- ZEND_PROP_PURPOSE_VAR_EXPORT // var_export (__set_state)
- ZEND_PROP_PURPOSE_JSON // json_encode
-
- The handler returns a non-null HashTable with increased refcounted, and
- the return value must be released using zend_release_properties().
-
- This handler serves the same general function as get_properties(), but
- provides more control over different property uses, while also making
- it possible to return a temporary property table.
-
- get_properties() is still used in cases where none of the above purposes
- apply, but overloading get_properties() is generally discouraged. If you
- want to provide purposes for general usage rather than just debugging or
- serialization, please prefer using properly declared properties.
-
- get_debug_info() is superseded by get_properties_for() with the
- ZEND_PROP_PURPOSE_DEBUG purpose, but remains available for backwards-
- compatibility reasons. However, while it is fine to define this handler,
- it should never be directly called by consuming code.
-
- The Z_OBJDEBUG_P macro has been removed. It should be replaced by calls to
- zend_get_properties_for() with the ZEND_PROP_PURPOSE_DEBUG purpose:
-
- // OLD
- int is_temp;
- HashTable *ht = Z_OBJDEBUG_P(obj, is_temp);
- // ...
- if (is_temp) {
- zend_hash_destroy(ht);
- FREE_HASHTABLE(ht);
- }
-
- // NEW
- HashTable *ht = zend_get_properties_for(obj, ZEND_PROP_PURPOSE_DEBUG);
- // ...
- zend_release_properties(ht);
-
- g. The following object handlers are now required (must be non-NULL):
-
- * free_obj
- * dtor_obj
- * read_property
- * write_property
- * read_dimension
- * write_dimension
- * get_property_ptr_ptr
- * has_property
- * unset_property
- * has_dimension
- * unset_dimension
- * get_properties
- * get_method
- * get_constructor
- * get_class_name
- * get_gc
-
- It is recommended to initialize object handler structures by copying the
- std object handlers and only overwriting those you want to change.
-
- h. Opcache may make classes and op_arrays immutable. Such classes are marked
- by ZEND_ACC_IMMUTABLE flag, they are not going to be copied from opcache
- shared memory to process memory and must not be modified at all.
- Few related data structures were changed to allow addressing mutable data
- structures from immutable ones. This access is implemented through
- ZEND_MAP_PTR... abstraction macros and, basically, uses additional level of
- indirection. op_array->run_time_cache, op_array->static_variables_ptr and
- class_entry->static_members_table now have to be accessed through
- ZEND_MAP_PTR... macros.
- It's also not allowed to change op_array->reserved[] handles of immutable
- op_arrays. Instead, now you have to reserve op_array handle using
- zend_get_op_array_extension_handle() during MINIT and access its value
- using ZEND_OP_ARRAY_EXTENSION(op_array, handle).
-
- i. The type of the escape parameter of php_fgetcsv() and php_fputcsv() has
- been changed from char to int. This allows to pass the new constant macro
- PHP_CSV_NO_ESCAPE to this parameter, to disable PHP's proprietary escape
- mechanism.
-
- j. add_get_assoc_*() and add_get_index_*() are removed. Use add_assoc*(),
- add_index*() or zend_hash_*() API functions instead.
-
- k. Complex class declaration opcodes ZEND_ADD_INTERFACE, ZEND_ADD_TRAIT,
- ZEND_BIND_TRAITS and ZEND_VERIFY_ABSTRACT_CLASS were removed. Information
- about interfaces and traits is kept in zend_class_entry structure and
- actual linked performed by ZEND_DECLARE_...CLASS... opcode(s).
- Linked classes have ZEND_ACC_LINKED flag set.
-
- l. HASH_FLAG_INITIALIZED was reverted into HASH_FLAG_UNINITIALIZED. Special
- HT_IS_INITIALIZED() and HT_INVALIDATE() macro were introduced to hide
- implementation details.
-
- m. The write_property() object handler now returns the assigned value (after
- possible type coercions) rather than void. For extensions, it should
- usually be sufficient to return whatever was passed as the argument.
-
- n. Assignments to references now need to ensure that they respect property
- types that affect the reference. This means that references should no
- longer be directly assigned to, and instead a set of specialized macros of
- the form ZEND_TRY_ASSIGN* needs to be used. You can find detailed porting
- instructions as well as a compatibility shim in the wiki:
- https://wiki.php.net/rfc/typed_properties_v2#assignments_to_references
-
- o. ZEND_COMPILE_EXTENDED_INFO has been split into:
- ZEND_COMPILE_EXTENDED_FCALL and ZEND_COMPILE_EXTENDED_STMT
- This allows tooling to choose between profiling and debugging behaviour
- ZEND_COMPILE_EXTENDED_INFO remains and preserves behaviour.
-
- p. ZEND_EXT_BEGIN_FCALL is emitted after arguments are sent, this means
- that handlers may access arguments.
-
- q. ZEND_COMPILE_IGNORE_USER_FUNCTIONS and ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS
- are respected by zend_get_call_op such that when set, the only possible
- call opcodes are ZEND_DO_FCALL and ZEND_DO_FCALL_BY_NAME, previously they
- were ignored by zend_get_call_op.
-
- r. TSRM adds tsrm_env_lock() and tsrm_env_unlock() for ZTS:
- code that may change environ and may run concurrently with user code in ZTS
- is expected to use this exclusion API to maintain as much safety as
- reasonable. This results in "thread safe" getenv/putenv in Windows and
- Unix, however functions that may read the environment without exclusion
- still exist, for example:
- - setlocale
- - mktime
- - tzset
- The above is not an exhaustive list of such functions, while getenv/putenv
- will behave as if they are safe, care should still be taken in
- multi-threaded environments.
-
- s. Correct support for typed properties requires the use of new macros to
- assign values to references. For more information see
- https://wiki.php.net/rfc/typed_properties_v2#impact_on_extensions.
-
- t. convert_to_string() and zval_get_string() are now more likely to result in
- an exception. For instructions on how to gracefully handle this see
- https://wiki.php.net/rfc/tostring_exceptions#extension_guidelines.
-
- u. The typedefs uint and ulong are no longer guaranteed to be available, and
- have to be replaced with standard types.
-
- v. Compound assignment opcodes were changed. Instead of ZEND_ASSIGN_ADD (and
- others) with 0, ZEND_ASSIGN_DIM, ZEND_ASSIGN_OBJ or
- ZEND_ASSIGN_STATIC_PROP in extended value, now we use ZEND_ASSIGN_OP,
- ZEND_ASSIGN_DIM_OP, ZEND_ASSIGN_OBJ_OP and ZEND_ASSIGN_STATIC_PROP_OP with
- ZEND_ADD (or other) in extended_value.
-
- w. APACHE symbol has been removed and is no longer defined.
-
- x. php_error_docref0() has been removed and renamed to php_error_docref().
-
- y. The read and write operations of php_stream_ops now return ssize_t, with
- negative values indicating an error.
+ a. Object Handlers API and some related functions, e.g. zend_call_method() and
+ zend_objects_clone_obj() were changed to receive zend_object* instead of
+ zval* and zend_string* instead of zval* for property names.
+
+ b. ZEND_OVERLOADED_FUNCTION and corresponding call_method() object handler
+ were removed. ZEND_INTERNAL_FUNCTION with ZEND_ACC_CALL_VIA_HANDLER and
+ defined "handler" callback should be used instead. This "handler" callback
+ should also take care about function cleanup. See ext/zend_test/test.c
+ for example.
+
+ c. The following things have been removed from TSRM:
+ - TSRMLS_DC
+ - TSRMLS_D
+ - TSRMLS_CC
+ - TSRMLS_C
+ - TSRMLS_FETCH
+ - TSRMLS_FETCH_FROM_CTX
+ - TSRMLS_SET_CTX
+ - tsrm_new_interpreter_context
+ - tsrm_set_interpreter_context
+ - tsrm_free_interpreter_context
+ - support for GNUPTH, SGI ST, and BETHREADS
+
+ d. The get() and set() object handlers have been removed. The get() handler
+ can generally be replaced with cast_object(). Some uses of set() may be
+ replaced by do_operation(). If set() was used to overload direct
+ assignments using "=", then this is no longer supported and the
+ functionality should be provided in some other way (for example, as
+ modification of an object property).
+
+ e. The zend_parse_parameters 'L' specifier and the Z_PARAM_STRICT_LONG()
+ family of macros have been removed. Use 'l' and Z_PARAM_LONG() instead,
+ which, despite the confusing name, actually have stricter input validation.
+
+ f. Arginfo argument types for internal functions are no longer checked.
+ Instead type checks should be performed using the zend_parse_parameters()
+ or ZEND_PARSE_PARAMETERS_*() APIs.
+
+ g. zend_free_op type and "should_free" argument of zend_get_zval_ptr() were
+ removed. It's possible to get the old "should_free" value using the
+ following code.
+
+ zval *ret = zend_get_zval_ptr(opline, opline->op1_type, &opline->op1,
+ execute_data, BP_VAR_R);
+ zval *should_free = (op_type & (IS_TMP_VAR|IS_VAR)) ? ret : NULL;
+
+ h. Added the zend_value_error() function, which is intended to be used
+ to raise ValueError when inappropriate argument values are passed
+ to functions.
+
+ i. get_closure() object handlers now accept an additional zend_bool parameter
+ `check_only`. If it is true, the handler is called to check whether the
+ object is callable; in this case the handler should not throw an exception.
+
+ j. compare_objects() handler was removed. Extensions should use compare() object
+ handler instead and check if both arguments are objects and have the same
+ compare handler, using ZEND_COMPARE_OBJECTS_FALLBACK() macro.
+
+ k. The 'I' length modifier, used to denote 32 and 64bit integer from the custom
+ snprintf and spprintf implementations has been removed.
+ Use the ZEND_LONG_FMT, ZEND_ULONG_FMT and ZEND_XLONG_FMT macros defined in
+ php-src/Zend/zend_long.h
+
+ The 'v' format from the custom snprintf and spprintf implementations has
+ been removed. Use the standard 's' format instead.
+
+ l. Some VM instructions switched to IS_TMP_VAR result insted of IS_VAR.
+ Actually, all assignments (ZEND_ASSIGN, ZEND_ASSIGN_DIM, ZEND_ASSIGN_OBJ,
+ ZEND_ASSIGN_STATIC_PROP), all compound assignments (ZEND_ASSIGN_OP,
+ ZEND_ASSIGN_DIM_OP, ZEND_ASSIGN_OBJ_OP, ZEND_ASSIGN_STATIC_PROP_OP) and all
+ pre increments/decrements (ZEND_PRE_INC, ZEND_PRE_DEC, ZEND_PRE_INC_OBJ
+ ZEND_PRE_DEC_OBJ, ZEND_PRE_INC_STATIC_PROP ZEND_PRE_DEC_STATIC_PROP).
========================
2. Build system changes
========================
a. Abstract
- - The hash extension is now always available, meaning the --enable-hash
- configure argument has been removed.
- - The filter extension no longer exposes the --with-pcre-dir configure
- argument and therefore allows shared builds with ./configure for Unix
- builds.
- - Symbols HAVE_DATE, HAVE_REFLECTION, and HAVE_SPL have been removed. It
- should be considered to have these extensions always available.
- - Removed unused build time symbols: PHP_ADA_INCLUDE, PHP_ADA_LFLAGS,
- PHP_ADA_LIBS, PHP_APACHE_INCLUDE, PHP_APACHE_TARGET, PHP_FHTTPD_INCLUDE,
- PHP_FHTTPD_LIB, PHP_FHTTPD_TARGET, PHP_CFLAGS, PHP_DBASE_LIB,
- PHP_BUILD_DEBUG, PHP_GDBM_INCLUDE, PHP_IBASE_INCLUDE, PHP_IBASE_LFLAGS,
- PHP_IBASE_LIBS, PHP_IFX_INCLUDE, PHP_IFX_LFLAGS, PHP_IFX_LIBS,
- PHP_INSTALL_IT, PHP_IODBC_INCLUDE, PHP_IODBC_LFLAGS, PHP_IODBC_LIBS,
- PHP_MSQL_LFLAGS, PHP_MSQL_INCLUDE, PHP_MSQL_LFLAGS, PHP_MSQL_LIBS,
- PHP_MYSQL_INCLUDE, PHP_MYSQL_LIBS, PHP_MYSQL_TYPE, PHP_OCI8_SHARED_LIBADD,
- PHP_ORACLE_SHARED_LIBADD, PHP_ORACLE_DIR, PHP_ORACLE_VERSION,
- PHP_PGSQL_INCLUDE, PHP_PGSQL_LFLAGS, PHP_PGSQL_LIBS, PHP_SOLID_INCLUDE,
- PHP_SOLID_LIBS, PHP_EMPRESS_INCLUDE, PHP_EMPRESS_LIBS, PHP_SYBASE_INCLUDE,
- PHP_SYBASE_LFLAGS, PHP_SYBASE_LIBS, PHP_DBM_TYPE, PHP_DBM_LIB,
- PHP_LDAP_LFLAGS, PHP_LDAP_INCLUDE, PHP_LDAP_LIBS.
- - Removed unused symbols: HAVE_CURL_EASY_STRERROR, HAVE_CURL_MULTI_STRERROR,
- HAVE_MPIR, HAVE_MBSTR_CN, HAVE_MBSTR_JA, HAVE_MBSTR_KR, HAVE_MBSTR_RU,
- HAVE_MBSTR_TW.
+ - Symbol HAVE_HASH_EXT is removed and is no longer defined. It should be
+ considered to have hash extension always available since PHP 7.4.
+ - Symbol HAVE_PCRE is removed and is no longer defined. It should be
+ considered to have pcre extension always available since PHP 7.4.
+ - Symbol HAVE_LOCALE_H has been removed and is no longer defined.
b. Unix build system changes
- - Added --ini-path and --ini-dir options to php-config.
- - configure --help now also outputs --program-suffix and --program-prefix
- information by using the Autoconf AC_ARG_PROGRAM macro.
- - Obsolescent macros AC_FUNC_VPRINTF and AC_FUNC_UTIME_NULL have been
- removed. Symbols HAVE_VPRINTF and HAVE_UTIME_NULL are no longer defined
- since they are not needed on the current systems.
- - Local PHP m4 unused or obsolete macros have been removed:
- PHP_TARGET_RDYNAMIC, PHP_SOLARIS_PIC_WEIRDNESS, PHP_SYS_LFS,
- PHP_AC_BROKEN_SPRINTF, PHP_EXTENSION, PHP_DECLARED_TIMEZONE,
- PHP_CHECK_TYPES, PHP_CHECK_64BIT, PHP_READDIR_R_TYPE,
- PHP_SETUP_KERBEROS.
- - Local PHP_TM_GMTOFF m4 macro replaced with Autoconf's AC_CHECK_MEMBERS.
- The HAVE_TM_GMTOFF symbol is replaced with HAVE_STRUCT_TM_TM_GMTOFF and
- HAVE_TM_ZONE symbol is replaced with HAVE_STRUCT_TM_TM_ZONE.
- - new --enable-rtld-now build option allow to switch dlopen behavior
- from RTLD_LAZY to RTLD_NOW
- - Minimum Bison version is 3.0+ for generating parser files.
- - PHP_PROG_BISON macro now takes two optional arguments - minimum required
- version and excluded versions that aren't supported.
- - PHP_PROG_RE2C is not called in the generated configure.ac for extensions
- anymore and now takes one optional argument - minimum required version.
- - with-pcre-valgrind and with-valgrind are merged, and valgrind detected by
- pkgconfig
- - Removed unused AC_PROG_CC_C_O check and the NO_MINUS_C_MINUS_O symbol.
- - Obsolescant checks for headers and functions that are part of C89 have
- been removed. The following symbols are therefore no longer defined by the
- PHP build system at the configure step and shouldn't be used anymore:
- HAVE_SETLOCALE, HAVE_LOCALECONV, HAVE_STRSTR, HAVE_STRTOL, HAVE_STRBRK,
- HAVE_PERROR, HAVE_STRFTIME, HAVE_TZNAME, HAVE_STDARG_H, HAVE_STRING_H,
- HAVE_STDLIB_H, HAVE_SYS_VARARGS_H, HAVE_ASSERT_H, HAVE_SYS_DIR_H,
- TM_IN_SYS_TIME, HAVE_STRTOD, HAVE_STRCOLL, HAVE_ERRNO_H, HAVE_MEMCPY,
- HAVE_SNPRINTF, HAVE_STDIO_H, HAVE_STRPBRK, HAVE_TIME_H, HAVE_LIMITS_H,
- HAVE_STRTOUL, HAVE_SYS_NDIR_H, HAVE_SYS_TIMES_H, PHP_HAVE_STDINT_TYPES,
- HAVE_SIGNAL_H, HAVE_STRERROR.
- - Removed unused check for dev/arandom and the HAVE_DEV_ARANDOM symbol.
- - Remove unused functions checks: HAVE_MBSINIT, HAVE_MEMPCPY, HAVE_SETPGID,
- HAVE_STRPNCPY, HAVE_STRTOULL, HAVE_VSNPRINTF, HAVE_CUSERID, HAVE_LRAND48,
- HAVE_RANDOM, HAVE_SRAND48, HAVE_SRANDOM, HAVE_STRDUP, HAVE_GCVT,
- HAVE_ISASCII, HAVE_LINK, HAVE_LOCKF, HAVE_SOCKOPT, HAVE_SETVBUF, HAVE_SIN,
- HAVE_TEMPNAM.
- - Unused check for struct cmsghdr and symbol HAVE_CMSGHDR have been removed.
- - Unused ApplicationServices/ApplicationServices.h headers check and
- HAVE_APPLICATIONSERVICES_APPLICATIONSERVICES_H symbol have been removed.
- - PHP_DEBUG_MACRO macro has been removed.
- - PHP_CHECK_CONFIGURE_OPTIONS macro has been removed. Default Autoconf's
- --enable-option-checking=fatal option can be used in the configure step
- to enable error when invalid options are used.
- - Removed unused check and symbols HAVE_SHM_MMAP_ZERO, HAVE_SHM_MMAP_FILE.
- - Removed unused check and symbol MISSING_MSGHDR_MSGFLAGS.
- c. Windows build system changes
+ 1. --enable-maintainer-zts is renamed --enable-zts for parity with Windows
+ and as recognition that ZTS is not a "maintainer" or experimental feature.
- . Visual Studio 2019 is utilized for the Windows builds
- . Removed unused defined symbol HAVE_LIBBIND.
+ c. Windows build system changes
========================
3. Module changes
========================
- a. ext/xml
- - The public (internal) API of the ext/xml extension has been removed. All
- functions and structures are private to the extension now.
-
- b. ext/hash
- - The hash extension is now always available, allowing extensions to rely
- on its functionality to be available without compile time checks.
diff --git a/Zend/Makefile.frag b/Zend/Makefile.frag
index c5728af3c1..4160fe2b5e 100644
--- a/Zend/Makefile.frag
+++ b/Zend/Makefile.frag
@@ -13,7 +13,7 @@ $(srcdir)/zend_language_parser.c: $(srcdir)/zend_language_parser.y
# Tweak zendparse to be exported through ZEND_API. This has to be revisited once
# bison supports foreign skeletons and that bison version is used. Read
# https://git.savannah.gnu.org/cgit/bison.git/tree/data/README.md for more.
- @$(YACC) -p zend -v -d $(srcdir)/zend_language_parser.y -o $@
+ @$(YACC) $(YFLAGS) -v -d $(srcdir)/zend_language_parser.y -o $@
@$(SED) -e 's,^int zendparse\(.*\),ZEND_API int zendparse\1,g' < $@ \
> $@.tmp && \
mv $@.tmp $@
@@ -27,7 +27,7 @@ $(srcdir)/zend_language_parser.c: $(srcdir)/zend_language_parser.y
$(srcdir)/zend_ini_parser.h: $(srcdir)/zend_ini_parser.c
$(srcdir)/zend_ini_parser.c: $(srcdir)/zend_ini_parser.y
- @$(YACC) -p ini_ -v -d $(srcdir)/zend_ini_parser.y -o $@
+ $(YACC) $(YFLAGS) -v -d $(srcdir)/zend_ini_parser.y -o $@
$(srcdir)/zend_ini_scanner.c: $(srcdir)/zend_ini_scanner.l
@(cd $(top_srcdir); $(RE2C) $(RE2C_FLAGS) --no-generation-date --case-inverted -cbdFt Zend/zend_ini_scanner_defs.h -oZend/zend_ini_scanner.c Zend/zend_ini_scanner.l)
diff --git a/Zend/Zend.m4 b/Zend/Zend.m4
index d6919ae1e1..fc4634580e 100644
--- a/Zend/Zend.m4
+++ b/Zend/Zend.m4
@@ -148,8 +148,6 @@ _LT_AC_TRY_DLOPEN_SELF([
dnl Checks for library functions.
AC_CHECK_FUNCS(getpid kill finite sigsetjmp)
-AC_CHECK_DECLS([isfinite, isnan, isinf], [], [], [[#include <math.h>]])
-
ZEND_CHECK_FLOAT_PRECISION
dnl Test whether double cast to long preserves least significant bits.
@@ -157,6 +155,7 @@ AC_MSG_CHECKING(whether double cast to long preserves least significant bits)
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <limits.h>
+#include <stdlib.h>
int main()
{
@@ -191,11 +190,11 @@ dnl LIBZEND_OTHER_CHECKS
dnl
AC_DEFUN([LIBZEND_OTHER_CHECKS],[
-AC_ARG_ENABLE([maintainer-zts],
- [AS_HELP_STRING([--enable-maintainer-zts],
- [Enable thread safety - for code maintainers only!!])],
- [ZEND_MAINTAINER_ZTS=$enableval],
- [ZEND_MAINTAINER_ZTS=no])
+AC_ARG_ENABLE([zts],
+ [AS_HELP_STRING([--enable-zts],
+ [Enable thread safety])],
+ [ZEND_ZTS=$enableval],
+ [ZEND_ZTS=no])
AC_ARG_ENABLE([inline-optimization],
[AS_HELP_STRING([--disable-inline-optimization],
@@ -204,7 +203,7 @@ AC_ARG_ENABLE([inline-optimization],
[ZEND_INLINE_OPTIMIZATION=yes])
AC_MSG_CHECKING(whether to enable thread-safety)
-AC_MSG_RESULT($ZEND_MAINTAINER_ZTS)
+AC_MSG_RESULT($ZEND_ZTS)
AC_MSG_CHECKING(whether to enable inline optimization for GCC)
AC_MSG_RESULT($ZEND_INLINE_OPTIMIZATION)
@@ -225,7 +224,7 @@ fi
test -n "$GCC" && CFLAGS="$CFLAGS -Wall -Wno-strict-aliasing"
test -n "$DEBUG_CFLAGS" && CFLAGS="$CFLAGS $DEBUG_CFLAGS"
-if test "$ZEND_MAINTAINER_ZTS" = "yes"; then
+if test "$ZEND_ZTS" = "yes"; then
AC_DEFINE(ZTS,1,[ ])
CFLAGS="$CFLAGS -DZTS"
fi
@@ -256,6 +255,7 @@ AC_MSG_CHECKING(for MM alignment and log values)
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdio.h>
+#include <stdlib.h>
typedef union _mm_align_test {
void *ptr;
@@ -385,135 +385,6 @@ else
fi
AC_MSG_RESULT($ZEND_GCC_GLOBAL_REGS)
-dnl Check if atof() accepts NAN.
-AC_CACHE_CHECK(whether atof() accepts NAN, ac_cv_atof_accept_nan,[
-AC_RUN_IFELSE([AC_LANG_SOURCE([[
-#include <math.h>
-#include <stdlib.h>
-
-#ifdef HAVE_ISNAN
-#define zend_isnan(a) isnan(a)
-#elif defined(HAVE_FPCLASS)
-#define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))
-#else
-#define zend_isnan(a) 0
-#endif
-
-int main(int argc, char** argv)
-{
- return zend_isnan(atof("NAN")) ? 0 : 1;
-}
-]])],[
- ac_cv_atof_accept_nan=yes
-],[
- ac_cv_atof_accept_nan=no
-],[
- ac_cv_atof_accept_nan=no
-])])
-if test "$ac_cv_atof_accept_nan" = "yes"; then
- AC_DEFINE([HAVE_ATOF_ACCEPTS_NAN], 1, [whether atof() accepts NAN])
-fi
-
-dnl Check if atof() accepts INF.
-AC_CACHE_CHECK(whether atof() accepts INF, ac_cv_atof_accept_inf,[
-AC_RUN_IFELSE([AC_LANG_SOURCE([[
-#include <math.h>
-#include <stdlib.h>
-
-#ifdef HAVE_ISINF
-#define zend_isinf(a) isinf(a)
-#elif defined(INFINITY)
-/* Might not work, but is required by ISO C99 */
-#define zend_isinf(a) (((a)==INFINITY)?1:0)
-#elif defined(HAVE_FPCLASS)
-#define zend_isinf(a) ((fpclass(a) == FP_PINF) || (fpclass(a) == FP_NINF))
-#else
-#define zend_isinf(a) 0
-#endif
-
-int main(int argc, char** argv)
-{
- return zend_isinf(atof("INF")) && zend_isinf(atof("-INF")) ? 0 : 1;
-}
-]])],[
- ac_cv_atof_accept_inf=yes
-],[
- ac_cv_atof_accept_inf=no
-],[
- ac_cv_atof_accept_inf=no
-])])
-if test "$ac_cv_atof_accept_inf" = "yes"; then
- AC_DEFINE([HAVE_ATOF_ACCEPTS_INF], 1, [whether atof() accepts INF])
-fi
-
-dnl Check if HUGE_VAL == INF.
-AC_CACHE_CHECK(whether HUGE_VAL == INF, ac_cv_huge_val_inf,[
-AC_RUN_IFELSE([AC_LANG_SOURCE([[
-#include <math.h>
-#include <stdlib.h>
-
-#ifdef HAVE_ISINF
-#define zend_isinf(a) isinf(a)
-#elif defined(INFINITY)
-/* Might not work, but is required by ISO C99 */
-#define zend_isinf(a) (((a)==INFINITY)?1:0)
-#elif defined(HAVE_FPCLASS)
-#define zend_isinf(a) ((fpclass(a) == FP_PINF) || (fpclass(a) == FP_NINF))
-#else
-#define zend_isinf(a) 0
-#endif
-
-int main(int argc, char** argv)
-{
- return zend_isinf(HUGE_VAL) ? 0 : 1;
-}
-]])],[
- ac_cv_huge_val_inf=yes
-],[
- ac_cv_huge_val_inf=no
-],[
- ac_cv_huge_val_inf=yes
-])])
-dnl This is the most probable fallback so we assume yes in case of cross compile.
-if test "$ac_cv_huge_val_inf" = "yes"; then
- AC_DEFINE([HAVE_HUGE_VAL_INF], 1, [whether HUGE_VAL == INF])
-fi
-
-dnl Check if HUGE_VAL + -HUGEVAL == NAN.
-AC_CACHE_CHECK(whether HUGE_VAL + -HUGEVAL == NAN, ac_cv_huge_val_nan,[
-AC_RUN_IFELSE([AC_LANG_SOURCE([[
-#include <math.h>
-#include <stdlib.h>
-
-#ifdef HAVE_ISNAN
-#define zend_isnan(a) isnan(a)
-#elif defined(HAVE_FPCLASS)
-#define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))
-#else
-#define zend_isnan(a) 0
-#endif
-
-int main(int argc, char** argv)
-{
-#if defined(__sparc__) && !(__GNUC__ >= 3)
- /* prevent bug #27830 */
- return 1;
-#else
- return zend_isnan(HUGE_VAL + -HUGE_VAL) ? 0 : 1;
-#endif
-}
-]])],[
- ac_cv_huge_val_nan=yes
-],[
- ac_cv_huge_val_nan=no
-],[
- ac_cv_huge_val_nan=yes
-])])
-dnl This is the most probable fallback so we assume yes in case of cross compile.
-if test "$ac_cv_huge_val_nan" = "yes"; then
- AC_DEFINE([HAVE_HUGE_VAL_NAN], 1, [whether HUGE_VAL + -HUGEVAL == NAN])
-fi
-
dnl Check whether __cpuid_count is available.
AC_CACHE_CHECK(whether __cpuid_count is available, ac_cv_cpuid_count_available, [
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
diff --git a/Zend/tests/001.phpt b/Zend/tests/001.phpt
index c7c2060dc2..d041d20a3b 100644
--- a/Zend/tests/001.phpt
+++ b/Zend/tests/001.phpt
@@ -4,39 +4,39 @@ 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);
diff --git a/Zend/tests/002.phpt b/Zend/tests/002.phpt
index e89f71ef51..1311e3b570 100644
--- a/Zend/tests/002.phpt
+++ b/Zend/tests/002.phpt
@@ -4,45 +4,45 @@ 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));
+ var_dump(func_get_arg(-10));
+ var_dump(func_get_arg(0));
+ var_dump(func_get_arg(1));
}
function test2($a) {
- var_dump(func_get_arg(0));
- var_dump(func_get_arg(1));
+ var_dump(func_get_arg(0));
+ var_dump(func_get_arg(1));
}
function test3($a, $b) {
- var_dump(func_get_arg(0));
- var_dump(func_get_arg(1));
- var_dump(func_get_arg(2));
+ var_dump(func_get_arg(0));
+ var_dump(func_get_arg(1));
+ var_dump(func_get_arg(2));
}
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) {
+ var_dump(func_get_arg(0));
+ var_dump(func_get_arg(1));
+ }
}
test::test1(1);
diff --git a/Zend/tests/003.phpt b/Zend/tests/003.phpt
index b1ef79ebcb..6680956f7e 100644
--- a/Zend/tests/003.phpt
+++ b/Zend/tests/003.phpt
@@ -4,39 +4,39 @@ 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);
diff --git a/Zend/tests/004.phpt b/Zend/tests/004.phpt
index 179684d076..2f733f1bd8 100644
--- a/Zend/tests/004.phpt
+++ b/Zend/tests/004.phpt
@@ -3,7 +3,6 @@ strncmp() tests
--FILE--
<?php
-var_dump(strncmp("", ""));
var_dump(strncmp("", "", 100));
var_dump(strncmp("aef", "dfsgbdf", -1));
var_dump(strncmp("fghjkl", "qwer", 0));
@@ -13,8 +12,6 @@ var_dump(strncmp("qwerty", "qwerty123", 7));
echo "Done\n";
?>
--EXPECTF--
-Warning: strncmp() expects exactly 3 parameters, 2 given in %s on line %d
-NULL
int(0)
Warning: Length must be greater than or equal to 0 in %s on line %d
diff --git a/Zend/tests/005.phpt b/Zend/tests/005.phpt
index 6ad1b0f63d..f4abfb6c51 100644
--- a/Zend/tests/005.phpt
+++ b/Zend/tests/005.phpt
@@ -3,7 +3,6 @@ strcasecmp() tests
--FILE--
<?php
-var_dump(strcasecmp(""));
var_dump(strcasecmp("", ""));
var_dump(strcasecmp("aef", "dfsgbdf"));
var_dump(strcasecmp("qwe", "qwer"));
@@ -15,8 +14,6 @@ var_dump(strcasecmp("01", "01"));
echo "Done\n";
?>
--EXPECTF--
-Warning: strcasecmp() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
int(0)
int(-3)
int(-1)
diff --git a/Zend/tests/006.phpt b/Zend/tests/006.phpt
index 64c74ff134..12907fd36e 100644
--- a/Zend/tests/006.phpt
+++ b/Zend/tests/006.phpt
@@ -3,7 +3,6 @@ strncasecmp() tests
--FILE--
<?php
-var_dump(strncasecmp(""));
var_dump(strncasecmp("", "", -1));
var_dump(strncasecmp("aef", "dfsgbdf", 0));
var_dump(strncasecmp("aef", "dfsgbdf", 10));
@@ -16,9 +15,6 @@ var_dump(strncasecmp("01", "01", 1000));
echo "Done\n";
?>
--EXPECTF--
-Warning: strncasecmp() expects exactly 3 parameters, 1 given in %s on line %d
-NULL
-
Warning: Length must be greater than or equal to 0 in %s on line %d
bool(false)
int(0)
diff --git a/Zend/tests/007.phpt b/Zend/tests/007.phpt
deleted file mode 100644
index 6120181269..0000000000
--- a/Zend/tests/007.phpt
+++ /dev/null
@@ -1,65 +0,0 @@
---TEST--
-each() tests
---FILE--
-<?php
-
-var_dump(each());
-$var = 1;
-var_dump(each($var));
-$var = "string";
-var_dump(each($var));
-$var = array(1,2,3);
-var_dump(each($var));
-$var = array("a"=>1,"b"=>2,"c"=>3);
-var_dump(each($var));
-
-$a = array(1);
-$a [] =&$a[0];
-
-var_dump(each($a));
-
-
-echo "Done\n";
-?>
---EXPECTF--
-Warning: each() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-array(4) {
- [1]=>
- int(1)
- ["value"]=>
- int(1)
- [0]=>
- int(0)
- ["key"]=>
- int(0)
-}
-array(4) {
- [1]=>
- int(1)
- ["value"]=>
- int(1)
- [0]=>
- string(1) "a"
- ["key"]=>
- string(1) "a"
-}
-array(4) {
- [1]=>
- int(1)
- ["value"]=>
- int(1)
- [0]=>
- int(0)
- ["key"]=>
- int(0)
-}
-Done
diff --git a/Zend/tests/008.phpt b/Zend/tests/008.phpt
index 0766c3e1a4..6f885c0dc5 100644
--- a/Zend/tests/008.phpt
+++ b/Zend/tests/008.phpt
@@ -3,12 +3,13 @@ define() tests
--FILE--
<?php
-var_dump(define());
-var_dump(define("TRUE"));
-var_dump(define("TRUE", 1));
-var_dump(define("TRUE", 1, array(1)));
+try {
+ var_dump(define(array(1,2,3,4,5), 1));
+} catch (TypeError $e) {
+ echo "TypeError: ", $e->getMessage(), "\n";
+}
-var_dump(define(array(1,2,3,4,5), 1));
+var_dump(define("TRUE", 1));
var_dump(define(" ", 1));
var_dump(define("[[[", 2));
var_dump(define("test const", 3));
@@ -24,18 +25,10 @@ var_dump(constant("test const"));
echo "Done\n";
?>
--EXPECTF--
-Warning: define() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: define() expects at least 2 parameters, 1 given in %s on line %d
-NULL
-bool(true)
-
-Warning: define() expects parameter 3 to be bool, array given in %s on line %d
-NULL
+TypeError: define() expects parameter 1 to be string, array given
-Warning: define() expects parameter 1 to be string, array given in %s on line %d
-NULL
+Notice: Constant TRUE already defined in %s on line %d
+bool(false)
bool(true)
bool(true)
bool(true)
diff --git a/Zend/tests/009.phpt b/Zend/tests/009.phpt
index 82cfabee49..d6ac1be4e2 100644
--- a/Zend/tests/009.phpt
+++ b/Zend/tests/009.phpt
@@ -4,21 +4,22 @@ 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;
@@ -26,7 +27,11 @@ $f1->bar();
$f2->bar();
var_dump(get_class());
-var_dump(get_class("qwerty"));
+try {
+ var_dump(get_class("qwerty"));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump(get_class($f1));
var_dump(get_class($f2));
@@ -36,22 +41,13 @@ $f1->testNull();
echo "Done\n";
?>
--EXPECTF--
-Deprecated: Non-static method foo::bar() should not be called statically in %s on line %d
-string(3) "foo"
-
-Deprecated: Non-static method foo::bar() should not be called statically in %s on line %d
-string(3) "foo"
string(3) "foo"
string(3) "foo"
Warning: get_class() called without object from outside a class in %s on line %d
bool(false)
-
-Warning: get_class() expects parameter 1 to be object, string given in %s on line %d
-bool(false)
+get_class() expects parameter 1 to be object, string given
string(3) "foo"
string(4) "foo2"
-
-Warning: get_class() expects parameter 1 to be object, null given in %s on line %d
-bool(false)
+get_class() expects parameter 1 to be object, null given
Done
diff --git a/Zend/tests/010.phpt b/Zend/tests/010.phpt
index eef3bc594f..a4a862cac2 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;
diff --git a/Zend/tests/011.phpt b/Zend/tests/011.phpt
index 7bcab0798f..36213af171 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"));
@@ -53,11 +51,6 @@ $bar->test();
echo "Done\n";
?>
--EXPECTF--
-Warning: property_exists() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: property_exists() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
bool(true)
bool(true)
bool(true)
diff --git a/Zend/tests/012.phpt b/Zend/tests/012.phpt
index 40f68e9794..c238229066 100644
--- a/Zend/tests/012.phpt
+++ b/Zend/tests/012.phpt
@@ -6,10 +6,8 @@ class_exists() tests
class foo {
}
-var_dump(class_exists());
var_dump(class_exists("qwerty"));
var_dump(class_exists(""));
-var_dump(class_exists(array()));
var_dump(class_exists("test", false));
var_dump(class_exists("foo", false));
var_dump(class_exists("foo"));
@@ -18,14 +16,9 @@ var_dump(class_exists("stdClass"));
echo "Done\n";
?>
---EXPECTF--
-Warning: class_exists() expects at least 1 parameter, 0 given in %s on line %d
-NULL
+--EXPECT--
bool(false)
bool(false)
-
-Warning: class_exists() expects parameter 1 to be string, array given in %s on line %d
-NULL
bool(false)
bool(true)
bool(true)
diff --git a/Zend/tests/013.phpt b/Zend/tests/013.phpt
index aec10e53f1..fd8320b536 100644
--- a/Zend/tests/013.phpt
+++ b/Zend/tests/013.phpt
@@ -6,10 +6,8 @@ interface_exists() tests
interface foo {
}
-var_dump(interface_exists());
var_dump(interface_exists("qwerty"));
var_dump(interface_exists(""));
-var_dump(interface_exists(array()));
var_dump(interface_exists("test", false));
var_dump(interface_exists("foo", false));
var_dump(interface_exists("foo"));
@@ -18,14 +16,9 @@ var_dump(interface_exists("stdClass"));
echo "Done\n";
?>
---EXPECTF--
-Warning: interface_exists() expects at least 1 parameter, 0 given in %s on line %d
-NULL
+--EXPECT--
bool(false)
bool(false)
-
-Warning: interface_exists() expects parameter 1 to be string, array given in %s on line %d
-NULL
bool(false)
bool(true)
bool(true)
diff --git a/Zend/tests/014.phpt b/Zend/tests/014.phpt
index a2c5335923..c02fee9385 100644
--- a/Zend/tests/014.phpt
+++ b/Zend/tests/014.phpt
@@ -8,13 +8,9 @@ var_dump(get_included_files());
include(__DIR__."/014.inc");
var_dump(get_included_files());
-var_dump(get_included_files(1,1));
-
include_once(__DIR__."/014.inc");
var_dump(get_included_files());
-var_dump(get_included_files(1));
-
include(__DIR__."/014.inc");
var_dump(get_included_files());
@@ -31,18 +27,12 @@ array(2) {
[1]=>
string(%d) "%s"
}
-
-Warning: get_included_files() expects exactly 0 parameters, 2 given in %s on line %d
-NULL
array(2) {
[0]=>
string(%d) "%s"
[1]=>
string(%d) "%s"
}
-
-Warning: get_included_files() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
array(2) {
[0]=>
string(%d) "%s"
diff --git a/Zend/tests/015.phpt b/Zend/tests/015.phpt
index ccf5e4ddb0..deea89d14d 100644
--- a/Zend/tests/015.phpt
+++ b/Zend/tests/015.phpt
@@ -3,9 +3,7 @@ trigger_error() tests
--FILE--
<?php
-var_dump(trigger_error());
var_dump(trigger_error("error"));
-var_dump(trigger_error(array()));
var_dump(trigger_error("error", -1));
var_dump(trigger_error("error", 0));
var_dump(trigger_error("error", E_USER_WARNING));
@@ -14,15 +12,9 @@ var_dump(trigger_error("error", E_USER_DEPRECATED));
echo "Done\n";
?>
--EXPECTF--
-Warning: trigger_error() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
Notice: error in %s on line %d
bool(true)
-Warning: trigger_error() expects parameter 1 to be string, array given in %s on line %d
-NULL
-
Warning: Invalid error type specified in %s on line %d
bool(false)
diff --git a/Zend/tests/017.phpt b/Zend/tests/017.phpt
index ed1b2a38a5..619365cbce 100644
--- a/Zend/tests/017.phpt
+++ b/Zend/tests/017.phpt
@@ -3,8 +3,6 @@ builtin functions tests
--FILE--
<?php
-var_dump(get_resource_type());
-var_dump(get_resource_type(""));
$fp = fopen(__FILE__, "r");
var_dump(get_resource_type($fp));
fclose($fp);
@@ -14,11 +12,9 @@ var_dump(gettype(get_loaded_extensions()));
var_dump(count(get_loaded_extensions()));
var_dump(gettype(get_loaded_extensions(true)));
var_dump(count(get_loaded_extensions(true)));
-var_dump(get_loaded_extensions(true, true));
define("USER_CONSTANT", "test");
-var_dump(get_defined_constants(true, true));
var_dump(gettype(get_defined_constants(true)));
var_dump(gettype(get_defined_constants()));
var_dump(count(get_defined_constants()));
@@ -29,11 +25,9 @@ function test () {
var_dump(gettype(get_defined_functions()));
var_dump(count(get_defined_functions()));
-var_dump(get_declared_interfaces(true));
var_dump(gettype(get_declared_interfaces()));
var_dump(count(get_declared_interfaces()));
-var_dump(get_extension_funcs());
var_dump(get_extension_funcs(true));
var_dump(gettype(get_extension_funcs("standard")));
var_dump(count(get_extension_funcs("standard")));
@@ -44,36 +38,19 @@ var_dump(count(get_extension_funcs("zend")));
echo "Done\n";
?>
--EXPECTF--
-Warning: get_resource_type() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: get_resource_type() expects parameter 1 to be resource, string given in %s on line %d
-NULL
string(6) "stream"
string(7) "Unknown"
string(5) "array"
int(%d)
string(5) "array"
int(%d)
-
-Warning: get_loaded_extensions() expects at most 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: get_defined_constants() expects at most 1 parameter, 2 given in %s on line %d
-NULL
string(5) "array"
string(5) "array"
int(%d)
string(5) "array"
int(%d)
-
-Warning: get_declared_interfaces() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
string(5) "array"
int(%d)
-
-Warning: get_extension_funcs() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
bool(false)
string(5) "array"
int(%d)
diff --git a/Zend/tests/018.phpt b/Zend/tests/018.phpt
index 5ced729fce..74c5edcb1f 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..3b3c923850 100644
--- a/Zend/tests/019.phpt
+++ b/Zend/tests/019.phpt
@@ -243,7 +243,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 +360,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 +367,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 +379,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 +391,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 +403,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 +415,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 +427,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 +439,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 +451,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 +463,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 +475,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 +487,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 +499,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 +511,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 +523,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 +535,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 +547,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 +559,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 +571,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 +583,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 +595,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 +607,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 +619,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 +631,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 +643,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 +655,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 +667,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 +679,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 +696,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 +712,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 +739,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 +766,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 +793,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 +826,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 +850,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 +870,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 +886,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 +917,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 +937,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 +953,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 +982,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 +998,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 +1027,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 +1043,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 +1078,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 +1106,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 +1130,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 +1150,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 +1166,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 +1195,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 +1208,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 +1228,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 +1262,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 +1292,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 +1301,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 +1310,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 +1329,3 @@ bool(false)
bool(false)
bool(true)
int(10)
-===DONE===
diff --git a/Zend/tests/020.phpt b/Zend/tests/020.phpt
index 1e2bcff387..dc7a34be06 100644
--- a/Zend/tests/020.phpt
+++ b/Zend/tests/020.phpt
@@ -3,16 +3,14 @@ func_get_arg() invalid usage
--FILE--
<?php
-var_dump(func_get_arg(1,2,3));
var_dump(func_get_arg(1));
-var_dump(func_get_arg());
function bar() {
- var_dump(func_get_arg(1));
+ var_dump(func_get_arg(1));
}
function foo() {
- bar(func_get_arg(1));
+ bar(func_get_arg(1));
}
foo(1,2);
@@ -20,15 +18,9 @@ foo(1,2);
echo "Done\n";
?>
--EXPECTF--
-Warning: func_get_arg() expects exactly 1 parameter, 3 given in %s on line %d
-NULL
-
Warning: func_get_arg(): Called from the global scope - no function context in %s on line %d
bool(false)
-Warning: func_get_arg() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
Warning: func_get_arg(): Argument 1 not passed to function in %s on line %d
bool(false)
Done
diff --git a/Zend/tests/022.phpt b/Zend/tests/022.phpt
index 1226e2719f..d2b4075627 100644
--- a/Zend/tests/022.phpt
+++ b/Zend/tests/022.phpt
@@ -1,19 +1,19 @@
--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();
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..d4e34972ee 100644
--- a/Zend/tests/024.phpt
+++ b/Zend/tests/024.phpt
@@ -15,43 +15,43 @@ var_dump($a->$b->{$c[1]});
?>
--EXPECTF--
-Notice: Undefined variable: a in %s on line %d
+Warning: Undefined variable: a in %s on line %d
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
NULL
-Notice: Undefined variable: a in %s on line %d
+Warning: Undefined variable: a in %s on line %d
-Notice: Undefined variable: c in %s on line %d
+Warning: Undefined variable: c in %s on line %d
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
NULL
-Notice: Undefined variable: a in %s on line %d
+Warning: Undefined variable: a in %s on line %d
int(1)
-Notice: Undefined variable: a in %s on line %d
+Warning: Undefined variable: a in %s on line %d
-Notice: Undefined variable: b in %s on line %d
+Warning: Undefined variable: b in %s on line %d
int(0)
-Notice: Undefined variable: a in %s on line %d
+Warning: Undefined variable: a in %s on line %d
NULL
-Notice: Undefined variable: b in %s on line %d
+Warning: Undefined variable: b in %s on line %d
int(1)
-Notice: Trying to get property '1' of non-object in %s on line %d
+Warning: Trying to get property '1' of non-object in %s on line %d
NULL
-Notice: Trying to get property '1' of non-object in %s on line %d
+Warning: Trying to get property '1' of non-object in %s on line %d
NULL
-Notice: Undefined variable: c in %s on line %d
+Warning: Undefined variable: c in %s on line %d
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
-Notice: Trying to get property '1' of non-object in %s on line %d
+Warning: Trying to get property '1' of non-object in %s on line %d
-Notice: Trying to get property '' of non-object in %s on line %d
+Warning: Trying to get property '' of non-object in %s on line %d
NULL
diff --git a/Zend/tests/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..9008abb791 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: Trying to get property 'a' of non-object in %s on line %d
ok
-
-Warning: Creating default object from empty value in %s on line %d
+Attempt to assign property 'a' of non-object
ok
diff --git a/Zend/tests/028.phpt b/Zend/tests/028.phpt
index 24dafffc68..e9673020fd 100644
--- a/Zend/tests/028.phpt
+++ b/Zend/tests/028.phpt
@@ -20,7 +20,7 @@ bool(true)
Notice: Undefined offset: 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..652db2de20 100644
--- a/Zend/tests/033.phpt
+++ b/Zend/tests/033.phpt
@@ -9,52 +9,58 @@ echo $arr[1][2][3][4][5];
$arr[1][2][3][4][5]->foo;
-$arr[1][2][3][4][5]->foo = 1;
+try {
+ $arr[1][2][3][4][5]->foo = 1;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
$arr[][] = 2;
-$arr[][]->bar = 2;
+try {
+ $arr[][]->bar = 2;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
?>
--EXPECTF--
-Notice: Undefined variable: arr in %s on line %d
+Warning: Undefined variable: arr in %s on line %d
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
-Notice: Undefined variable: arr in %s on line %d
+Warning: Undefined variable: arr in %s on line %d
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
-Notice: Undefined variable: arr in %s on line %d
+Warning: Undefined variable: arr in %s on line %d
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
-Notice: Trying to get property 'foo' of non-object in %s on line %d
-
-Warning: Creating default object from empty value in %s on line %d
-
-Warning: Creating default object from empty value in %s on line %d
+Warning: Trying to get property 'foo' of non-object in %s on line %d
+Attempt to assign property 'foo' of non-object
+Attempt to assign property 'bar' of non-object
diff --git a/Zend/tests/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..6b6549d935 100644
--- a/Zend/tests/036.phpt
+++ b/Zend/tests/036.phpt
@@ -3,14 +3,19 @@ Trying to use lambda in array offset
--FILE--
<?php
-$test[function(){}] = 1;
-$a{function() { }} = 1;
+try {
+ $test[function(){}] = 1;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $a{function() { }} = 1;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
?>
--EXPECTF--
-
-Deprecated: Array and string offset access syntax with curly braces is deprecated in %s line %d
-
-Warning: Illegal offset type in %s on line %d
-
-Warning: Illegal offset type in %s on line %d
+Deprecated: Array and string offset access syntax with curly braces is deprecated in %s on line %d
+Illegal offset type
+Illegal offset type
diff --git a/Zend/tests/038.phpt b/Zend/tests/038.phpt
index 963e73f9ea..e55757bbcd 100644
--- a/Zend/tests/038.phpt
+++ b/Zend/tests/038.phpt
@@ -3,10 +3,12 @@ Trying to use lambda as array key
--FILE--
<?php
-var_dump(array(function() { } => 1));
+try {
+ var_dump(array(function() { } => 1));
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Warning: Illegal offset type in %s on line %d
-array(0) {
-}
+--EXPECT--
+Illegal offset type
diff --git a/Zend/tests/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..2d4d584a8f 100644
--- a/Zend/tests/access_modifiers_008.phpt
+++ b/Zend/tests/access_modifiers_008.phpt
@@ -6,13 +6,13 @@ 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();
diff --git a/Zend/tests/access_modifiers_009.phpt b/Zend/tests/access_modifiers_009.phpt
index cb01fa13fb..452b5406eb 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();
diff --git a/Zend/tests/access_modifiers_010.phpt b/Zend/tests/access_modifiers_010.phpt
index dd2e3e36b9..50597ff552 100644
--- a/Zend/tests/access_modifiers_010.phpt
+++ b/Zend/tests/access_modifiers_010.phpt
@@ -4,24 +4,24 @@ 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;
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..5d862ef729 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;
diff --git a/Zend/tests/add_003.phpt b/Zend/tests/add_003.phpt
index f0066ee3cd..b70ff022ec 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;
diff --git a/Zend/tests/add_004.phpt b/Zend/tests/add_004.phpt
index a46f70b818..161c4c2b39 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;
diff --git a/Zend/tests/add_007.phpt b/Zend/tests/add_007.phpt
index 3b24a1c99c..e490826d8f 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;
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/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..6b73efa416 100644
--- a/Zend/tests/arg_unpack/non_integer_keys.phpt
+++ b/Zend/tests/arg_unpack/non_integer_keys.phpt
@@ -3,17 +3,17 @@ 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";
}
?>
diff --git a/Zend/tests/arg_unpack/string_keys.phpt b/Zend/tests/arg_unpack/string_keys.phpt
index c2913db5b4..7b620b0830 100644
--- a/Zend/tests/arg_unpack/string_keys.phpt
+++ b/Zend/tests/arg_unpack/string_keys.phpt
@@ -8,14 +8,14 @@ set_error_handler(function($errno, $errstr) {
});
try {
- var_dump(...[1, 2, "foo" => 3, 4]);
+ var_dump(...[1, 2, "foo" => 3, 4]);
} catch (Error $ex) {
- var_dump($ex->getMessage());
+ var_dump($ex->getMessage());
}
try {
- var_dump(...new ArrayIterator([1, 2, "foo" => 3, 4]));
+ var_dump(...new ArrayIterator([1, 2, "foo" => 3, 4]));
} catch (Error $ex) {
- var_dump($ex->getMessage());
+ var_dump($ex->getMessage());
}
?>
diff --git a/Zend/tests/argument_restriction_001.phpt b/Zend/tests/argument_restriction_001.phpt
index 9c21dc2cce..c7deb760a0 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 %sargument_restriction_001.php on line %d
diff --git a/Zend/tests/argument_restriction_002.phpt b/Zend/tests/argument_restriction_002.phpt
index 4deb2d206b..f80e9779ff 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 %sargument_restriction_002.php on line %d
diff --git a/Zend/tests/argument_restriction_003.phpt b/Zend/tests/argument_restriction_003.phpt
index c24e0ba852..7857d377ae 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 %sargument_restriction_003.php 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..0982ccde4a 100644
--- a/Zend/tests/argument_restriction_005.phpt
+++ b/Zend/tests/argument_restriction_005.phpt
@@ -3,8 +3,8 @@ 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--
diff --git a/Zend/tests/argument_restriction_006.phpt b/Zend/tests/argument_restriction_006.phpt
index 2df0e1e90d..5298c6959d 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 = Array) in %sargument_restriction_006.php 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..0a86bf7e9c 100644
--- a/Zend/tests/array_offset.phpt
+++ b/Zend/tests/array_offset.phpt
@@ -1,5 +1,5 @@
--TEST--
-Ensure "undefined offset" notice formats message corectly when undefined key is negative
+Ensure "undefined offset" notice formats message correctly when undefined key is negative
--FILE--
<?php
diff --git a/Zend/tests/array_unpack/already_occupied.phpt b/Zend/tests/array_unpack/already_occupied.phpt
index 27a18b6ced..b2febe0021 100644
--- a/Zend/tests/array_unpack/already_occupied.phpt
+++ b/Zend/tests/array_unpack/already_occupied.phpt
@@ -6,36 +6,28 @@ Appending to an array via unpack may fail
<?php
$arr = [1, 2, 3];
-var_dump([PHP_INT_MAX-1 => 0, ...$arr]);
-
-var_dump([PHP_INT_MAX-1 => 0, ...[1, 2, 3]]);
-
-const ARR = [1, 2, 3];
-const ARR2 = [PHP_INT_MAX-1 => 0, ...ARR];
-var_dump(ARR2);
-
-?>
---EXPECTF--
-Warning: Cannot add element to the array as the next element is already occupied in %s on line %d
-array(2) {
- [9223372036854775806]=>
- int(0)
- [9223372036854775807]=>
- int(1)
+try {
+ var_dump([PHP_INT_MAX-1 => 0, ...$arr]);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
}
-Warning: Cannot add element to the array as the next element is already occupied in %s on line %d
-array(2) {
- [9223372036854775806]=>
- int(0)
- [9223372036854775807]=>
- int(1)
+try {
+ var_dump([PHP_INT_MAX-1 => 0, ...[1, 2, 3]]);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
}
-Warning: Cannot add element to the array as the next element is already occupied in %s on line %d
-array(2) {
- [9223372036854775806]=>
- int(0)
- [9223372036854775807]=>
- int(1)
+const ARR = [1, 2, 3];
+function test($x = [PHP_INT_MAX-1 => 0, ...ARR]) {}
+try {
+ test();
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
}
+
+?>
+--EXPECT--
+Cannot add element to the array as the next element is already occupied
+Cannot add element to the array as the next element is already occupied
+Cannot add element to the array as the next element is already occupied
diff --git a/Zend/tests/array_unpack/basic.phpt b/Zend/tests/array_unpack/basic.phpt
index 3363c487ec..dece3b8265 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([...[]]);
diff --git a/Zend/tests/array_unpack/classes.phpt b/Zend/tests/array_unpack/classes.phpt
index 573c5f1c32..a459a229e3 100644
--- a/Zend/tests/array_unpack/classes.phpt
+++ b/Zend/tests/array_unpack/classes.phpt
@@ -4,23 +4,23 @@ 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) {
diff --git a/Zend/tests/array_unpack/non_integer_keys.phpt b/Zend/tests/array_unpack/non_integer_keys.phpt
index 5c93102907..0e082e71f3 100644
--- a/Zend/tests/array_unpack/non_integer_keys.phpt
+++ b/Zend/tests/array_unpack/non_integer_keys.phpt
@@ -3,14 +3,14 @@ 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--
diff --git a/Zend/tests/array_unpack/string_keys.phpt b/Zend/tests/array_unpack/string_keys.phpt
index 6032d7cc3f..c06a2b4b8b 100644
--- a/Zend/tests/array_unpack/string_keys.phpt
+++ b/Zend/tests/array_unpack/string_keys.phpt
@@ -4,16 +4,16 @@ 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--
diff --git a/Zend/tests/array_unpack/undef_var.phpt b/Zend/tests/array_unpack/undef_var.phpt
index fff1f6171e..945717db76 100644
--- a/Zend/tests/array_unpack/undef_var.phpt
+++ b/Zend/tests/array_unpack/undef_var.phpt
@@ -6,9 +6,9 @@ array unpacking with undefinded variable
var_dump([...$arr]);
--EXPECTF--
-Notice: Undefined variable: arr in %s on line %d
+Warning: Undefined variable: arr in %s on line %d
Fatal error: Uncaught Error: Only arrays and Traversables can be unpacked in %s:%d
Stack trace:
#0 {main}
- thrown in %s on line %d \ No newline at end of file
+ thrown in %s on line %d
diff --git a/Zend/tests/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..76254fc69a 100644
--- a/Zend/tests/arrow_functions/002.phpt
+++ b/Zend/tests/arrow_functions/002.phpt
@@ -9,5 +9,5 @@ var_dump((fn() => $b + $c)());
?>
--EXPECTF--
-Notice: Undefined variable: c in %s on line %d
+Warning: Undefined variable: c in %s on line %d
int(1)
diff --git a/Zend/tests/arrow_functions/003.phpt b/Zend/tests/arrow_functions/003.phpt
index 5e77743fad..4e6998c9d1 100644
--- a/Zend/tests/arrow_functions/003.phpt
+++ b/Zend/tests/arrow_functions/003.phpt
@@ -14,8 +14,8 @@ var_dump($fn());
?>
--EXPECTF--
-Notice: Undefined variable: a in %s on line %d
+Warning: Undefined variable: a in %s on line %d
NULL
-Notice: Undefined variable: 5 in %s on line %d
+Warning: Undefined variable: 5 in %s on line %d
NULL
diff --git a/Zend/tests/assert/bug70208.phpt b/Zend/tests/assert/bug70208.phpt
deleted file mode 100644
index 6b7dfaeb33..0000000000
--- a/Zend/tests/assert/bug70208.phpt
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-Bug #70208 (scope information must be preserved with assert())
---FILE--
-<?php
-
-function non_class_scope() {
- return true;
-}
-
-class test {
- protected $prop = 1;
-
- public function __construct() {
- assert('non_class_scope();');
- var_dump($this->prop);
- }
-}
-
-new test;
-
-?>
---EXPECTF--
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
-int(1)
diff --git a/Zend/tests/assert/expect_015.phpt b/Zend/tests/assert/expect_015.phpt
index 7f8b0a0935..9b2cabd59f 100644
--- a/Zend/tests/assert/expect_015.phpt
+++ b/Zend/tests/assert/expect_015.phpt
@@ -6,137 +6,137 @@ 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"};
+ }
+ }
}));
-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();
+ 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) {
}
@@ -204,7 +204,7 @@ Warning: assert(): assert(0 && ($a = function &(array &$a, ?X $b = null) use($c,
})) failed in %sexpect_015.php 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) {
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_dim_obj_null_return.phpt b/Zend/tests/assign_dim_obj_null_return.phpt
index cff877fd8f..1641992a0c 100644
--- a/Zend/tests/assign_dim_obj_null_return.phpt
+++ b/Zend/tests/assign_dim_obj_null_return.phpt
@@ -7,50 +7,77 @@ function test() {
$array = [PHP_INT_MAX => 42];
$true = true;
- var_dump($array[] = 123);
- var_dump($array[[]] = 123);
- var_dump($array[new stdClass] = 123);
- var_dump($true[123] = 456);
-
- var_dump($array[] += 123);
- var_dump($array[[]] += 123);
- var_dump($array[new stdClass] += 123);
- var_dump($true[123] += 456);
-
- var_dump($true->foo = 123);
- var_dump($true->foo += 123);
-}
-
-test();
+ try {
+ var_dump($array[] = 123);
+ } catch (Error $e) {
+ echo $e->getMessage(), "\n";
+ }
-?>
---EXPECTF--
-Warning: Cannot add element to the array as the next element is already occupied in %s on line %d
-NULL
+ try {
+ var_dump($array[[]] = 123);
+ } catch (Error $e) {
+ echo $e->getMessage(), "\n";
+ }
-Warning: Illegal offset type in %s on line %d
-NULL
+ try {
+ var_dump($array[new stdClass] = 123);
+ } catch (Error $e) {
+ echo $e->getMessage(), "\n";
+ }
-Warning: Illegal offset type in %s on line %d
-NULL
+ try {
+ var_dump($true[123] = 456);
+ } catch (Error $e) {
+ echo $e->getMessage(), "\n";
+ }
-Warning: Cannot use a scalar value as an array in %s on line %d
-NULL
+ try {
+ var_dump($array[] += 123);
+ } catch (Error $e) {
+ echo $e->getMessage(), "\n";
+ }
-Warning: Cannot add element to the array as the next element is already occupied in %s on line %d
-NULL
+ try {
+ var_dump($array[[]] += 123);
+ } catch (Error $e) {
+ echo $e->getMessage(), "\n";
+ }
-Warning: Illegal offset type in %s on line %d
-NULL
+ try {
+ var_dump($array[new stdClass] += 123);
+ } catch (Error $e) {
+ echo $e->getMessage(), "\n";
+ }
-Warning: Illegal offset type in %s on line %d
-NULL
+ try {
+ var_dump($true[123] += 456);
+ } catch (Error $e) {
+ echo $e->getMessage(), "\n";
+ }
-Warning: Cannot use a scalar value as an array in %s on line %d
-NULL
+ try {
+ var_dump($true->foo = 123);
+ } catch (Error $e) {
+ echo $e->getMessage(), "\n";
+ }
+ try {
+ var_dump($true->foo += 123);
+ } catch (Error $e) {
+ echo $e->getMessage(), "\n";
+ }
+}
-Warning: Attempt to assign property 'foo' of non-object in %s on line %d
-NULL
+test();
-Warning: Attempt to assign property 'foo' of non-object in %s on line %d
-NULL
+?>
+--EXPECT--
+Cannot add element to the array as the next element is already occupied
+Illegal offset type
+Illegal offset type
+Cannot use a scalar value as an array
+Cannot add element to the array as the next element is already occupied
+Illegal offset type
+Illegal offset type
+Cannot use a scalar value as an array
+Attempt to assign property 'foo' of non-object
+Attempt to assign property 'foo' of non-object
diff --git a/Zend/tests/assign_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/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..1a73b3df1b 100644
--- a/Zend/tests/bug24773.phpt
+++ b/Zend/tests/bug24773.phpt
@@ -2,8 +2,8 @@
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
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..7e5668e47f 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
===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..7067c23e0d 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
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/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..d9e1ae43b1 100644
--- a/Zend/tests/bug29883.phpt
+++ b/Zend/tests/bug29883.phpt
@@ -15,7 +15,7 @@ bool(false)
bool(true)
bool(true)
-Notice: Uninitialized string offset: -10 in %s on line 6
+Warning: Uninitialized string offset: -10 in %s on line %d
string(0) ""
string(1) "u"
string(1) "u"
diff --git a/Zend/tests/bug29890.phpt b/Zend/tests/bug29890.phpt
index 1fdcdc4291..6f1e874882 100644
--- a/Zend/tests/bug29890.phpt
+++ b/Zend/tests/bug29890.phpt
@@ -2,7 +2,7 @@
Bug #29890 (crash if error handler fails)
--FILE--
<?php
-function customErrorHandler($fErrNo,$fErrStr,$fErrFile,$fErrLine,$fClass) {
+function customErrorHandler($fErrNo,$fErrStr,$fErrFile,$fErrLine) {
echo "error :".$fErrStr."\n";
}
diff --git a/Zend/tests/bug29896.phpt b/Zend/tests/bug29896.phpt
index 35a92d459c..6b96ac4704 100644
--- a/Zend/tests/bug29896.phpt
+++ b/Zend/tests/bug29896.phpt
@@ -2,7 +2,7 @@
Bug #29896 (Backtrace argument list out of sync)
--FILE--
<?php
-function userErrorHandler($num, $msg, $file, $line, $vars)
+function userErrorHandler($num, $msg, $file, $line)
{
debug_print_backtrace();
}
@@ -22,6 +22,6 @@ function GenerateError2($A1)
GenerateError2("Test2");
?>
--EXPECTF--
-#0 userErrorHandler(8, Undefined variable: b, %sbug29896.php, 11, Array ([A1] => Test1)) called at [%sbug29896.php:11]
+#0 userErrorHandler(2, Undefined variable: b, %s, %d) called at [%s:%d]
#1 GenerateError1(Test1) called at [%sbug29896.php:16]
#2 GenerateError2(Test2) called at [%sbug29896.php:19]
diff --git a/Zend/tests/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..6cefd62ea7 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/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/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..3276782c01 100644
--- a/Zend/tests/bug31098.phpt
+++ b/Zend/tests/bug31098.phpt
@@ -44,7 +44,7 @@ ok
ok
ok
-Notice: Trying to get property 'wrong' of non-object in %s on line %d
+Warning: Trying to get property 'wrong' of non-object in %s on line %d
ok
Warning: Illegal string offset 'wrong' in %s on line %d
diff --git a/Zend/tests/bug31102.phpt b/Zend/tests/bug31102.phpt
index fd6da0f7c2..fd3a4332fd 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
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..1e01d41772 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() expects parameter 2 to 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/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..d790c46dca 100644
--- a/Zend/tests/bug37251.phpt
+++ b/Zend/tests/bug37251.phpt
@@ -3,15 +3,15 @@ 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..fbfae5b254 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();
diff --git a/Zend/tests/bug37667.phpt b/Zend/tests/bug37667.phpt
index ecf43c5b80..38adb4e998 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,7 +26,6 @@ $obj->property[] = 2;
var_dump($obj);
?>
-===DONE===
--EXPECTF--
string(3) "bar"
@@ -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/bug37811.phpt b/Zend/tests/bug37811.phpt
index 96645d0354..d1d5872da0 100644
--- a/Zend/tests/bug37811.phpt
+++ b/Zend/tests/bug37811.phpt
@@ -5,10 +5,10 @@ Bug #37811 (define not using toString on objects)
class TestClass
{
- function __toString()
- {
- return "Foo";
- }
+ function __toString()
+ {
+ return "Foo";
+ }
}
define("Bar",new TestClass);
@@ -23,6 +23,7 @@ string(3) "Foo"
Warning: Constants may only evaluate to scalar values, arrays or resources in %sbug37811.php on line %d
-Warning: Use of undefined constant Baz - assumed 'Baz' (this will throw an Error in a future version of PHP) in %sbug37811.php on line %d
-string(3) "Baz"
-===DONE===
+Fatal error: Uncaught Error: Undefined constant 'Baz' in %s:%d
+Stack trace:
+#0 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/bug38047.phpt b/Zend/tests/bug38047.phpt
deleted file mode 100644
index e6eeb6631d..0000000000
--- a/Zend/tests/bug38047.phpt
+++ /dev/null
@@ -1,51 +0,0 @@
---TEST--
-Bug #38047 ("file" and "line" sometimes not set in backtrace from inside error handler)
---FILE--
-<?php
-error_reporting(E_ALL);
-set_error_handler('kalus_error_handler');
-ini_set("display_errors", "on");
-
-class A {
- function A_ftk($a) {
- }
-}
-
-function kalus_error_handler($error_code, $error_string, $filename, $line, $symbols) {
- echo "$error_string\n";
- get_error_context();
-}
-
-function get_error_context() {
- $backtrace = debug_backtrace();
- $n = 1;
- foreach ($backtrace as $call) {
- echo $n++." ";
- if (isset($call["file"])) {
- echo $call["file"];
- if (isset($call["line"])) {
- echo ":".$call["line"];
- }
- }
- if (isset($call["function"])) {
- echo " ".$call["function"]."()";
- }
- echo "\n";
- }
- echo "\n";
-}
-
-//This will not create file and line items for the call into the error handler
-$page["name"] = A::A_ftk();
-?>
---EXPECTF--
-Non-static method A::A_ftk() should not be called statically
-1 %sbug38047.php:13 get_error_context()
-2 %sbug38047.php:36 kalus_error_handler()
-
-
-Fatal error: Uncaught ArgumentCountError: Too few arguments to function A::A_ftk(), 0 passed in %sbug38047.php on line 36 and exactly 1 expected in %sbug38047.php:7
-Stack trace:
-#0 %sbug38047.php(36): A::A_ftk()
-#1 {main}
- thrown in %sbug38047.php on line 7
diff --git a/Zend/tests/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..b4de5f10c4 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 {
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..9fa3e0d26b 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) { }
diff --git a/Zend/tests/bug39018.phpt b/Zend/tests/bug39018.phpt
index a00e1fb819..43198b5c85 100644
--- a/Zend/tests/bug39018.phpt
+++ b/Zend/tests/bug39018.phpt
@@ -62,44 +62,44 @@ print "\nDone\n";
?>
--EXPECTF--
-Notice: String offset cast occurred in %s on line %d
+Warning: String offset cast occurred in %s on line %d
-Notice: Uninitialized string offset: %s in %s on line 6
+Warning: Uninitialized string offset: %s in %s on line %d
-Notice: Uninitialized string offset: 0 in %s on line %d
+Warning: Uninitialized string offset: 0 in %s on line %d
-Notice: Uninitialized string offset: 0 in %s on line %d
+Warning: Uninitialized string offset: 0 in %s on line %d
-Notice: String offset cast occurred in %s on line %d
+Warning: String offset cast occurred in %s on line %d
-Notice: Uninitialized string offset: %i in %s on line %d
+Warning: Uninitialized string offset: %i in %s on line %d
-Notice: String offset cast occurred in %s on line %d
+Warning: String offset cast occurred in %s on line %d
-Notice: Uninitialized string offset: %i in %s on line %d
+Warning: Uninitialized string offset: %i in %s on line %d
-Notice: Uninitialized string offset: 0 in %s on line %d
+Warning: Uninitialized string offset: 0 in %s on line %d
-Notice: Uninitialized string offset: 4 in %s on line %d
+Warning: Uninitialized string offset: 4 in %s on line %d
-Notice: Uninitialized string offset: 4 in %s on line %d
+Warning: Uninitialized string offset: 4 in %s on line %d
-Notice: Uninitialized string offset: 4 in %s on line %d
+Warning: Uninitialized string offset: 4 in %s on line %d
-Notice: Uninitialized string offset: 4 in %s on line %d
+Warning: Uninitialized string offset: 4 in %s on line %d
-Notice: Uninitialized string offset: 4 in %s on line %d
+Warning: Uninitialized string offset: 4 in %s on line %d
-Notice: String offset cast occurred in %s on line %d
+Warning: String offset cast occurred in %s on line %d
-Notice: Uninitialized string offset: 12 in %s on line %d
+Warning: Uninitialized string offset: 12 in %s on line %d
-Notice: String offset cast occurred in %s on line %d
+Warning: String offset cast occurred in %s on line %d
-Notice: Uninitialized string offset: 12 in %s on line %d
+Warning: Uninitialized string offset: 12 in %s on line %d
-Notice: String offset cast occurred in %s on line %d
+Warning: String offset cast occurred in %s on line %d
-Notice: String offset cast occurred in %s on line %d
+Warning: String offset cast occurred in %s on line %d
b
Done
diff --git a/Zend/tests/bug39036.phpt b/Zend/tests/bug39036.phpt
index 419810eaa1..4179ba5420 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..dc31073eb9 100644
--- a/Zend/tests/bug39304.phpt
+++ b/Zend/tests/bug39304.phpt
@@ -7,6 +7,6 @@ Bug #39304 (Segmentation fault with list unpacking of string offset)
var_dump($a,$b);
?>
--EXPECTF--
-Notice: Uninitialized string offset: 0 in %sbug39304.php on line %d
+Warning: Uninitialized string offset: 0 in %s on line %d
NULL
NULL
diff --git a/Zend/tests/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..473e5cb43a 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,7 +16,7 @@ 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--
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..3a11637fec 100644
--- a/Zend/tests/bug40705.phpt
+++ b/Zend/tests/bug40705.phpt
@@ -14,7 +14,7 @@ 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--
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..055e5f574d 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 ();
diff --git a/Zend/tests/bug41075.phpt b/Zend/tests/bug41075.phpt
deleted file mode 100644
index 03cf3a42f3..0000000000
--- a/Zend/tests/bug41075.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Bug #41075 (memleak when creating default object caused exception)
---FILE--
-<?php
-
-function err($errno, $errstr, $errfile, $errline)
-{
- throw new Exception($errstr);
-}
-
-set_error_handler("err");
-
-class test {
- function foo() {
- $var = $this->blah->prop = "string";
- var_dump($this->blah);
- }
-}
-
-$t = new test;
-try {
- $t->foo();
-} catch (Exception $e) {
- var_dump($e->getMessage());
-}
-
-echo "Done\n";
-?>
---EXPECT--
-string(40) "Creating default object from empty value"
-Done
diff --git a/Zend/tests/bug41209.phpt b/Zend/tests/bug41209.phpt
index 3924f99ac8..da9f57163d 100644
--- a/Zend/tests/bug41209.phpt
+++ b/Zend/tests/bug41209.phpt
@@ -41,6 +41,6 @@ echo "Done\n";
--EXPECTF--
Fatal error: Uncaught ErrorException: Undefined variable: id in %s:%d
Stack trace:
-#0 %s(%d): env::errorHandler(8, '%s', '%s', 34, Array)
+#0 %s(%d): env::errorHandler(2, 'Undefined varia...', '%s', %d)
#1 {main}
thrown in %s on line %d
diff --git a/Zend/tests/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..180e6ac970 100644
--- a/Zend/tests/bug41633_2.phpt
+++ b/Zend/tests/bug41633_2.phpt
@@ -3,7 +3,7 @@ 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";
?>
diff --git a/Zend/tests/bug41633_3.phpt b/Zend/tests/bug41633_3.phpt
index dd4b75c9d9..c7afb65a87 100644
--- a/Zend/tests/bug41633_3.phpt
+++ b/Zend/tests/bug41633_3.phpt
@@ -3,8 +3,8 @@ 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;
?>
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/bug42802.phpt b/Zend/tests/bug42802.phpt
index ebfb528827..1294bdbb2f 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";
diff --git a/Zend/tests/bug42819.phpt b/Zend/tests/bug42819.phpt
index d0b5c0b2ee..615aabc8ed 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";
diff --git a/Zend/tests/bug42820.phpt b/Zend/tests/bug42820.phpt
index a53ed1af68..af9230be10 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'));
diff --git a/Zend/tests/bug42937.phpt b/Zend/tests/bug42937.phpt
index 2ade186b9c..0aeeec8637 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();
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..3608effab7 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/bug43344_1.phpt b/Zend/tests/bug43344_1.phpt
index 4635240699..aca548ba5f 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_11.phpt b/Zend/tests/bug43344_11.phpt
index 27c3160f5a..47a59eb280 100644
--- a/Zend/tests/bug43344_11.phpt
+++ b/Zend/tests/bug43344_11.phpt
@@ -3,7 +3,7 @@ Bug #43344.11 (Wrong error message for undefined namespace constant)
--FILE--
<?php
function f($a=namespace\bar) {
- return $a;
+ return $a;
}
echo f()."\n";
?>
diff --git a/Zend/tests/bug43344_12.phpt b/Zend/tests/bug43344_12.phpt
index 71031f5819..3224a7de92 100644
--- a/Zend/tests/bug43344_12.phpt
+++ b/Zend/tests/bug43344_12.phpt
@@ -3,7 +3,7 @@ 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";
?>
diff --git a/Zend/tests/bug43344_13.phpt b/Zend/tests/bug43344_13.phpt
index bdce5a8a75..6b08562b29 100644
--- a/Zend/tests/bug43344_13.phpt
+++ b/Zend/tests/bug43344_13.phpt
@@ -3,8 +3,8 @@ 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";
?>
diff --git a/Zend/tests/bug43344_3.phpt b/Zend/tests/bug43344_3.phpt
index 5450759bcc..6b1b6c46c9 100644
--- a/Zend/tests/bug43344_3.phpt
+++ b/Zend/tests/bug43344_3.phpt
@@ -4,7 +4,7 @@ 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";
?>
diff --git a/Zend/tests/bug43344_4.phpt b/Zend/tests/bug43344_4.phpt
index c147766bf6..0e2e3c7886 100644
--- a/Zend/tests/bug43344_4.phpt
+++ b/Zend/tests/bug43344_4.phpt
@@ -4,7 +4,7 @@ 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";
?>
diff --git a/Zend/tests/bug43344_5.phpt b/Zend/tests/bug43344_5.phpt
index 8cc333fd31..5ca2144438 100644
--- a/Zend/tests/bug43344_5.phpt
+++ b/Zend/tests/bug43344_5.phpt
@@ -4,8 +4,8 @@ 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";
?>
diff --git a/Zend/tests/bug43344_7.phpt b/Zend/tests/bug43344_7.phpt
index dfab0cad90..965419c12a 100644
--- a/Zend/tests/bug43344_7.phpt
+++ b/Zend/tests/bug43344_7.phpt
@@ -4,7 +4,7 @@ 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";
?>
diff --git a/Zend/tests/bug43344_8.phpt b/Zend/tests/bug43344_8.phpt
index b1e6f61a54..b0c247c8e3 100644
--- a/Zend/tests/bug43344_8.phpt
+++ b/Zend/tests/bug43344_8.phpt
@@ -4,7 +4,7 @@ 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";
?>
diff --git a/Zend/tests/bug43344_9.phpt b/Zend/tests/bug43344_9.phpt
index 7f7f2df38f..edaa332b93 100644
--- a/Zend/tests/bug43344_9.phpt
+++ b/Zend/tests/bug43344_9.phpt
@@ -4,8 +4,8 @@ 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";
?>
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/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/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..fbe4a90dcd 100644
--- a/Zend/tests/bug44660.phpt
+++ b/Zend/tests/bug44660.phpt
@@ -8,42 +8,62 @@ $a = true;
echo "--> read access: ";
echo $a->p;
-echo "\n--> direct assignment: ";
-$a->p = $s;
+echo "\n--> direct assignment:\n";
+try {
+ $a->p = $s;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
-echo "\n--> increment: ";
-$a->p++;
+echo "\n--> increment:\n";
+try {
+ $a->p++;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
-echo "\n--> reference assignment:";
-$a->p =& $s;
+echo "\n--> reference assignment:\n";
+try {
+ $a->p =& $s;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
-echo "\n--> reference assignment:";
-$s =& $a->p;
+echo "\n--> reference assignment:\n";
+try {
+ $s =& $a->p;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
-echo "\n--> indexed assignment:";
-$a->p[0] = $s;
+echo "\n--> indexed assignment:\n";
+try {
+ $a->p[0] = $s;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
echo "\n--> Confirm assignments have had no impact:\n";
var_dump($a);
?>
--EXPECTF--
--> read access:
-Notice: Trying to get property 'p' of non-object in %sbug44660.php on line 6
+Warning: Trying to get property 'p' of non-object in %s on line %d
---> direct assignment:
-Warning: Attempt to assign property 'p' of non-object in %sbug44660.php on line 9
+--> direct assignment:
+Attempt to assign property 'p' of non-object
---> increment:
-Warning: Attempt to increment/decrement property 'p' of non-object in %sbug44660.php on line 12
+--> increment:
+Attempt to increment/decrement property 'p' of non-object
--> reference assignment:
-Warning: Attempt to modify property 'p' of non-object in %sbug44660.php on line 15
+Attempt to modify property 'p' of non-object
--> reference assignment:
-Warning: Attempt to modify property 'p' of non-object in %sbug44660.php on line 18
+Attempt to modify property 'p' of non-object
--> indexed assignment:
-Warning: Attempt to modify property 'p' of non-object in %sbug44660.php on line 21
+Attempt to modify property 'p' of non-object
--> Confirm assignments have had no impact:
bool(true)
diff --git a/Zend/tests/bug44899.phpt b/Zend/tests/bug44899.phpt
index d62033a24e..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..11968091e3 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() expects parameter 1 to be a valid callback, cannot access self:: when no class scope is active
diff --git a/Zend/tests/bug45186_2.phpt b/Zend/tests/bug45186_2.phpt
index 7c813a909c..5e962dd29a 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() expects parameter 1 to be a valid callback, class 'bar' does not have a method 'www'
+call_user_func() expects parameter 1 to be a valid callback, cannot access self:: when no class scope is active
diff --git a/Zend/tests/bug45744.phpt b/Zend/tests/bug45744.phpt
index c1e2a4841c..0984b8591d 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) {
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..525c4df6c5 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 parameters, 1 given
DONE
diff --git a/Zend/tests/bug46196.phpt b/Zend/tests/bug46196.phpt
index 7a6a753d87..9b2ca618ee 100644
--- a/Zend/tests/bug46196.phpt
+++ b/Zend/tests/bug46196.phpt
@@ -22,10 +22,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..f8b9a0b525 100644
--- a/Zend/tests/bug46304.phpt
+++ b/Zend/tests/bug46304.phpt
@@ -6,9 +6,6 @@ Bug #46304 (defining namespaced constant using define())
define('NS1\ns2\const1','value1');
define('ns1\ns2\const2','value2');
define('ns1\NS2\coNSt3','value3');
-define('NS1\ns2\const4','value4', true);
-define('ns1\ns2\const5','value5', true);
-define('ns1\NS2\coNSt6','value6', true);
print NS1\ns2\const1 . "\n";
print ns1\ns2\const1 . "\n";
@@ -22,29 +19,9 @@ print NS1\ns2\coNSt3 . "\n";
print ns1\ns2\coNSt3 . "\n";
print ns1\ns2\coNSt3 . "\n";
-print NS1\ns2\const4 . "\n";
-print ns1\ns2\const4 . "\n";
-print ns1\NS2\const4 . "\n";
-print ns1\ns2\coNSt4 . "\n";
-
-print NS1\ns2\const5 . "\n";
-print ns1\ns2\const5 . "\n";
-print ns1\NS2\const5 . "\n";
-print ns1\ns2\coNSt5 . "\n";
-
-print NS1\ns2\const6 . "\n";
-print ns1\ns2\const6 . "\n";
-print ns1\NS2\const6 . "\n";
-print ns1\ns2\coNSt6 . "\n";
-
print NS1\ns2\coNSt1 . "\n";
?>
--EXPECTF--
-Deprecated: define(): Declaration of case-insensitive constants is deprecated in %s on line 6
-
-Deprecated: define(): Declaration of case-insensitive constants is deprecated in %s on line 7
-
-Deprecated: define(): Declaration of case-insensitive constants is deprecated in %s on line 8
value1
value1
value1
@@ -54,28 +31,6 @@ value2
value3
value3
value3
-value4
-value4
-value4
-
-Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "NS1\ns2\const4" in %s on line 25
-value4
-value5
-value5
-value5
-
-Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "ns1\ns2\const5" in %s on line 30
-value5
-
-Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "ns1\NS2\coNSt6" in %s on line 32
-value6
-
-Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "ns1\NS2\coNSt6" in %s on line 33
-value6
-
-Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "ns1\NS2\coNSt6" in %s on line 34
-value6
-value6
Fatal error: Uncaught Error: Undefined constant 'NS1\ns2\coNSt1' in %sbug46304.php:%d
Stack trace:
diff --git a/Zend/tests/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..f607365bdc 100644
--- a/Zend/tests/bug47054.phpt
+++ b/Zend/tests/bug47054.phpt
@@ -24,8 +24,6 @@ $c->s();
get_called_class();
-D::m();
-
?>
--EXPECTF--
Called class: D
@@ -33,11 +31,3 @@ Called class: C
Called class: C
Warning: get_called_class() called from outside a class in %s on line %d
-
-Deprecated: Non-static method D::m() should not be called statically in %s on line %d
-
-Fatal error: Uncaught Error: Using $this when not in object context in %s:%d
-Stack trace:
-#0 %s(%d): D::m()
-#1 {main}
- thrown in %s on line %d
diff --git a/Zend/tests/bug47109.phpt b/Zend/tests/bug47109.phpt
index 0b86a2bcd3..4f8f4b9328 100644
--- a/Zend/tests/bug47109.phpt
+++ b/Zend/tests/bug47109.phpt
@@ -5,6 +5,6 @@ Bug #47109 (Memory leak on $a->{"a"."b"} when $a is not an object)
$a->{"a"."b"};
?>
--EXPECTF--
-Notice: Undefined variable: a in %sbug47109.php on line 2
+Warning: Undefined variable: a in %s on line %d
-Notice: Trying to get property 'ab' of non-object in %sbug47109.php on line 2
+Warning: Trying to get property 'ab' of non-object in %s on line %d
diff --git a/Zend/tests/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..7a44cc6e7f 100644
--- a/Zend/tests/bug47572.phpt
+++ b/Zend/tests/bug47572.phpt
@@ -14,4 +14,7 @@ $foo = new Foo();
?>
--EXPECTF--
-Warning: Use of undefined constant FOO - assumed 'FOO' (this will throw an Error in a future version of PHP) in %s on line %d
+Fatal error: Uncaught Error: Undefined constant 'FOO' in %s:%d
+Stack trace:
+#0 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/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..a30c8a8170 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 {
}
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/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..e96047c79b 100644
--- a/Zend/tests/bug48770.phpt
+++ b/Zend/tests/bug48770.phpt
@@ -6,43 +6,43 @@ See Bug #48770
<?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) {
- static $avoid_crash = 0;
+ public function func($str) {
+ static $avoid_crash = 0;
- if ($avoid_crash++ == 1) {
- print "This method shouldn't be called when using parent::func!\n";
- return;
- }
+ 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);
- }
+ 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);
+ }
}
class C extends B {
- public function func($str) {
- parent::func($str);
- }
+ public function func($str) {
+ parent::func($str);
+ }
}
$c = new C;
diff --git a/Zend/tests/bug48770_2.phpt b/Zend/tests/bug48770_2.phpt
index d7984eac4f..d94ae1b217 100644
--- a/Zend/tests/bug48770_2.phpt
+++ b/Zend/tests/bug48770_2.phpt
@@ -6,49 +6,57 @@ See Bug #48770
<?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--
+--EXPECT--
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
+call_user_func_array() expects parameter 1 to be a valid callback, cannot access private method A::func22()
+call_user_func_array() expects parameter 1 to be a valid callback, class 'A' does not have a method 'inexistent'
diff --git a/Zend/tests/bug48770_3.phpt b/Zend/tests/bug48770_3.phpt
index 5c6eacb470..cbd74df25a 100644
--- a/Zend/tests/bug48770_3.phpt
+++ b/Zend/tests/bug48770_3.phpt
@@ -6,46 +6,50 @@ See Bug #48770
<?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, '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() expects parameter 1 to be a valid callback, class 'B' 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/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..e108918b13 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 {
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..e3beb2a2e4 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 );
}
}
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..48623b30f2 100644
--- a/Zend/tests/bug51394.phpt
+++ b/Zend/tests/bug51394.phpt
@@ -6,8 +6,8 @@ error_reporting=-1
<?php
function eh()
{
- throw new Exception("error!");
- return false;
+ throw new Exception("error!");
+ return false;
}
set_error_handler("eh");
@@ -15,6 +15,6 @@ $a = $empty($b);
--EXPECTF--
Fatal error: Uncaught Exception: error! in %sbug51394.php:%d
Stack trace:
-#0 %sbug51394.php(%d): eh(8, 'Undefined varia%s', '%s', %d, Array)
+#0 %s(%d): eh(2, 'Undefined varia...', '%s', %d)
#1 {main}
thrown in %sbug51394.php on line %d
diff --git a/Zend/tests/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..beb50bad90 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 class 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..6c3d721716 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');
@@ -16,4 +16,8 @@ register_shutdown_function('exploDe');
--EXPECTF--
int(1)
-Warning: explode() expects at least 2 parameters, 0 given in Unknown on line %d
+Fatal error: Uncaught ArgumentCountError: explode() expects at least 2 parameters, 0 given in [no active file]:0
+Stack trace:
+#0 [internal function]: explode()
+#1 {main}
+ thrown in [no active file] on line 0
diff --git a/Zend/tests/bug52001.phpt b/Zend/tests/bug52001.phpt
index cf55d195b9..36170eb96b 100644
--- a/Zend/tests/bug52001.phpt
+++ b/Zend/tests/bug52001.phpt
@@ -11,7 +11,7 @@ var_dump($temp1);
function a($b,$c) {}
?>
--EXPECTF--
-Notice: Undefined variable: var in %sbug52001.php on line 2
+Warning: Undefined variable: var in %s on line %d
-Notice: Undefined variable: in %sbug52001.php on line 2
+Warning: Undefined variable: in %s on line %d
int(1)
diff --git a/Zend/tests/bug52041.phpt b/Zend/tests/bug52041.phpt
index a1eb1f841b..e5aca5c82e 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' of non-object
-Notice: Undefined variable: x in %sbug52041.php on line 3
+Warning: Undefined variable: x in %s on line %d
+Attempt to modify property 'a' of non-object
-Warning: Creating default object from empty value in %sbug52041.php on line 11
+Warning: Undefined variable: x in %s on line %d
+Attempt to increment/decrement property 'a' of non-object
-Notice: Undefined property: stdClass::$a in %sbug52041.php on line 11
+Warning: Undefined variable: x in %s on line %d
+Attempt to modify property 'a' of non-object
-Warning: Creating default object from empty value in %sbug52041.php on line 11
+Warning: Undefined variable: x in %s on line %d
+Attempt to assign property 'a' of non-object
-Notice: Undefined property: stdClass::$b in %sbug52041.php on line 11
+Warning: Undefined variable: x in %s on line %d
+Attempt to modify property 'a' of non-object
-Notice: Undefined variable: x in %sbug52041.php on line 3
+Warning: Undefined variable: x in %s on line %d
-Notice: Undefined variable: x in %sbug52041.php on line 3
+Warning: Undefined variable: x in %s on line %d
-Notice: Undefined variable: x in %sbug52041.php on line 3
+Warning: Undefined variable: x in %s on line %d
-Notice: Undefined offset: 0 in %sbug52041.php on line 15
+Notice: Undefined offset: 0 in %s on line %d
-Notice: Undefined variable: x in %sbug52041.php on line 3
+Warning: Undefined variable: x in %s on line %d
-Notice: Undefined offset: 0 in %sbug52041.php on line 16
+Notice: Undefined offset: 0 in %s on line %d
-Notice: Undefined offset: 0 in %sbug52041.php on line 16
+Notice: Undefined offset: 0 in %s on line %d
-Notice: Undefined variable: x in %sbug52041.php on line 3
+Warning: Undefined variable: x in %s on line %d
-Notice: Undefined offset: 0 in %sbug52041.php on line 17
+Notice: Undefined offset: 0 in %s on line %d
-Notice: Undefined variable: x in %sbug52041.php on line 3
+Warning: Undefined variable: x in %s on line %d
-Notice: Undefined offset: 0 in %sbug52041.php on line 18
+Notice: Undefined offset: 0 in %s on line %d
-Notice: Undefined offset: 0 in %sbug52041.php on line 18
+Notice: Undefined offset: 0 in %s on line %d
-Notice: Undefined variable: x in %sbug52041.php on line 3
+Warning: Undefined variable: x in %s on line %d
NULL
diff --git a/Zend/tests/bug52051.phpt b/Zend/tests/bug52051.phpt
deleted file mode 100644
index acfddbc36d..0000000000
--- a/Zend/tests/bug52051.phpt
+++ /dev/null
@@ -1,34 +0,0 @@
---TEST--
-Bug #52051 (handling of case sensitivity of old-style constructors changed in 5.3+)
---FILE--
-<?php
-
-class AA {
- function AA() { echo "foo\n"; }
-}
-class bb extends AA {}
-class CC extends bb {
- function CC() { parent::bb(); }
-}
-new CC();
-
-class A {
- function A() { echo "bar\n"; }
-}
-class B extends A {}
-class C extends B {
- function C() { parent::B(); }
-}
-new C();
-
-?>
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; AA has a deprecated constructor in %s on line %d
-
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; CC has a deprecated constructor in %s on line %d
-
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in %s on line %d
-
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; C has a deprecated constructor in %s on line %d
-foo
-bar
diff --git a/Zend/tests/bug52160.phpt b/Zend/tests/bug52160.phpt
deleted file mode 100644
index f0a57000e0..0000000000
--- a/Zend/tests/bug52160.phpt
+++ /dev/null
@@ -1,34 +0,0 @@
---TEST--
-Bug #52160 (Invalid E_DEPRECATED redefined constructor error)
---FILE--
-<?php
-
-class bar {
- function __construct() { }
- static function bar() {
- var_dump(1);
- }
-}
-
-bar::bar();
-
-class foo {
- static function foo() {
- var_dump(2);
- }
- function __construct() { }
-}
-
-foo::foo();
-
-class baz {
- static function baz() {
- var_dump(3);
- }
-}
-
-?>
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; baz has a deprecated constructor in %s on line %d
-
-Fatal error: Constructor baz::baz() cannot be static in %s on line %d
diff --git a/Zend/tests/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/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..9b40b4cae7 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();
diff --git a/Zend/tests/bug52484_2.phpt b/Zend/tests/bug52484_2.phpt
index 3b12950c66..698f2d94b5 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();
diff --git a/Zend/tests/bug52484_3.phpt b/Zend/tests/bug52484_3.phpt
index 995e624dfc..3bb5743963 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();
diff --git a/Zend/tests/bug52614.phpt b/Zend/tests/bug52614.phpt
index 0a1dca6882..30c1fc488a 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,15 @@ $foo->f1()[0]++;
var_dump($foo->a1[0]);
$foo->f6()[0]++;
var_dump($foo->a1[0]);
---EXPECTF--
+--EXPECT--
NULL
array(0) {
}
array(0) {
}
-
-Warning: Creating default object from empty value in %sbug52614.php on line 52
+Attempt to assign property 'a' of non-object
NULL
-object(stdClass)#%d (1) {
+object(stdClass)#3 (1) {
["a"]=>
int(1)
}
diff --git a/Zend/tests/bug52879.phpt b/Zend/tests/bug52879.phpt
index 6c3232f32d..09369d2d2f 100644
--- a/Zend/tests/bug52879.phpt
+++ b/Zend/tests/bug52879.phpt
@@ -3,10 +3,10 @@ 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;
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/bug53511.phpt b/Zend/tests/bug53511.phpt
index 0075655428..620ceb4e9c 100644
--- a/Zend/tests/bug53511.phpt
+++ b/Zend/tests/bug53511.phpt
@@ -3,18 +3,18 @@ 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();
diff --git a/Zend/tests/bug54039.phpt b/Zend/tests/bug54039.phpt
index ccdfe94305..aade872bf2 100644
--- a/Zend/tests/bug54039.phpt
+++ b/Zend/tests/bug54039.phpt
@@ -3,41 +3,41 @@ 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();
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/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/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/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..163cc721fb 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;
}
}
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..8ce75c4431 100644
--- a/Zend/tests/bug55825.phpt
+++ b/Zend/tests/bug55825.phpt
@@ -3,10 +3,10 @@ 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;
diff --git a/Zend/tests/bug60099.phpt b/Zend/tests/bug60099.phpt
index 8cca3440fb..a8745fa522 100644
--- a/Zend/tests/bug60099.phpt
+++ b/Zend/tests/bug60099.phpt
@@ -3,7 +3,7 @@ Bug #60099 (__halt_compiler() works in braced namespaces)
--FILE--
<?php
namespace foo {
- __halt_compiler();
+ __halt_compiler();
?>
--EXPECTF--
diff --git a/Zend/tests/bug60444.phpt b/Zend/tests/bug60444.phpt
index 38f81bc413..a86e1d422f 100644
--- a/Zend/tests/bug60444.phpt
+++ b/Zend/tests/bug60444.phpt
@@ -3,14 +3,14 @@ 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";
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/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..e709a55c7f 100644
--- a/Zend/tests/bug60909_1.phpt
+++ b/Zend/tests/bug60909_1.phpt
@@ -10,10 +10,10 @@ 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/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/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..68f6797ccf 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,7 +18,7 @@ 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--
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/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..3bc1e49d09 100644
--- a/Zend/tests/bug61767.phpt
+++ b/Zend/tests/bug61767.phpt
@@ -19,7 +19,7 @@ Error handler called (Undefined variable: undefined)
Fatal error: Uncaught ErrorException: Undefined variable: undefined in %sbug61767.php:%d
Stack trace:
-#0 %sbug61767.php(%d): {closure}(%s, 'Undefined varia...', '%s', %d, Array)
+#0 %sbug61767.php(%d): {closure}(%s, 'Undefined varia...', '%s', %d)
#1 {main}
thrown in %sbug61767.php on line %d
Shutting down
diff --git a/Zend/tests/bug62005.phpt b/Zend/tests/bug62005.phpt
deleted file mode 100644
index 83158d5cc2..0000000000
--- a/Zend/tests/bug62005.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-Bug #62005 (unexpected behavior when incrementally assigning to a member of a null object)
---FILE--
-<?php
-function add_points($player, $points) {
- $player->energy += $points;
- print_r($player);
-}
-add_points(NULL, 2);
---EXPECTF--
-Warning: Creating default object from empty value in %sbug62005.php on line %d
-
-Notice: Undefined property: stdClass::$energy in %sbug62005.php on line 3
-stdClass Object
-(
- [energy] => 2
-)
diff --git a/Zend/tests/bug62097.phpt b/Zend/tests/bug62097.phpt
index 07e93bfa88..dda3b34a26 100644
--- a/Zend/tests/bug62097.phpt
+++ b/Zend/tests/bug62097.phpt
@@ -7,9 +7,9 @@ if (PHP_INT_MAX !== 2147483647)
--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/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/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..ca66c4caed 100644
--- a/Zend/tests/bug63468.phpt
+++ b/Zend/tests/bug63468.phpt
@@ -4,23 +4,23 @@ 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;
diff --git a/Zend/tests/bug63635.phpt b/Zend/tests/bug63635.phpt
index 035588b295..df3afef178 100644
--- a/Zend/tests/bug63635.phpt
+++ b/Zend/tests/bug63635.phpt
@@ -3,35 +3,35 @@ 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--
diff --git a/Zend/tests/bug64239_1.phpt b/Zend/tests/bug64239_1.phpt
index 10d44c1817..aa20578b89 100644
--- a/Zend/tests/bug64239_1.phpt
+++ b/Zend/tests/bug64239_1.phpt
@@ -3,15 +3,15 @@ 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"));
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..c81caf72dc 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];
}
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/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..490c47194b 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 %sbug64988.php on line 17
diff --git a/Zend/tests/bug65108.phpt b/Zend/tests/bug65108.phpt
index 23e1e856d7..55c6b8c5b3 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();
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..2ae2780bb6 100644
--- a/Zend/tests/bug65322.phpt
+++ b/Zend/tests/bug65322.phpt
@@ -15,10 +15,10 @@ set_error_handler(function($_, $msg, $file) {
/* This is just a particular example of a non-fatal compile-time error
* If this breaks in future, just find another example and use it instead */
-eval('class A { function test() { } } class B extends A { function test($a) { } }');
+eval('class A { private function __invoke() { } }');
?>
--EXPECTF--
-string(62) "Declaration of B::test($a) should be compatible with A::test()"
+string(76) "The magic method __invoke() must have public visibility and cannot be static"
string(%d) "%s(%d) : eval()'d code"
string(1) "X"
diff --git a/Zend/tests/bug65784.phpt b/Zend/tests/bug65784.phpt
index 43369e2d60..8982048e12 100644
--- a/Zend/tests/bug65784.phpt
+++ b/Zend/tests/bug65784.phpt
@@ -3,53 +3,53 @@ 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();
diff --git a/Zend/tests/bug65911.phpt b/Zend/tests/bug65911.phpt
index 753c8c6c7d..b9d973eb45 100644
--- a/Zend/tests/bug65911.phpt
+++ b/Zend/tests/bug65911.phpt
@@ -6,11 +6,11 @@ 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();
diff --git a/Zend/tests/bug66015.phpt b/Zend/tests/bug66015.phpt
index 5e0815240d..1222ab3a96 100644
--- a/Zend/tests/bug66015.phpt
+++ b/Zend/tests/bug66015.phpt
@@ -24,7 +24,6 @@ class Test
$test = new Test();
?>
-===DONE===
--EXPECT--
array (
1 => 'first',
@@ -32,4 +31,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..8b5919801e 100644
--- a/Zend/tests/bug66252.phpt
+++ b/Zend/tests/bug66252.phpt
@@ -3,10 +3,10 @@ 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";
diff --git a/Zend/tests/bug66608.phpt b/Zend/tests/bug66608.phpt
index 5a499a1dab..b4e761ddc4 100644
--- a/Zend/tests/bug66608.phpt
+++ b/Zend/tests/bug66608.phpt
@@ -3,58 +3,58 @@ 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--
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..3ef225de03 100644
--- a/Zend/tests/bug67314.phpt
+++ b/Zend/tests/bug67314.phpt
@@ -15,8 +15,8 @@ echo "made it once\n";
crash();
echo "ok\n";
--EXPECTF--
-Notice: Undefined variable: i in %sbug67314.php on line 4
+Warning: Undefined variable: i in %s on line %d
made it once
-Notice: Undefined variable: i in %sbug67314.php on line 4
+Warning: Undefined variable: i in %s on line %d
ok
diff --git a/Zend/tests/bug67368.phpt b/Zend/tests/bug67368.phpt
index b3aff293a0..39d8bd30d6 100644
--- a/Zend/tests/bug67368.phpt
+++ b/Zend/tests/bug67368.phpt
@@ -5,7 +5,7 @@ report_memleaks=1
--FILE--
<?php
class FooBar {
- const bar = ["bar" => 3]["bar"];
+ const bar = ["bar" => 3]["bar"];
}
echo "okey";
--EXPECT--
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..0d8ec87006 100644
--- a/Zend/tests/bug67436/bug67436.phpt
+++ b/Zend/tests/bug67436/bug67436.phpt
@@ -2,16 +2,19 @@
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();
@@ -19,5 +22,6 @@ a::staticTest();
$b = new b();
$b->test();
--EXPECT--
+string(76) "The magic method __invoke() must have public visibility and cannot be static"
b::test()
a::test(c::TESTCONSTANT)
diff --git a/Zend/tests/bug67436/bug67436_nohandler.phpt b/Zend/tests/bug67436/bug67436_nohandler.phpt
index a155ccc842..64c7f70642 100644
--- a/Zend/tests/bug67436/bug67436_nohandler.phpt
+++ b/Zend/tests/bug67436/bug67436_nohandler.phpt
@@ -4,9 +4,9 @@ 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();
@@ -14,6 +14,6 @@ a::staticTest();
$b = new b();
$b->test();
--EXPECTF--
-Warning: Declaration of b::test() should be compatible with a::test($arg = c::TESTCONSTANT) in %s%ebug67436%eb.inc on line %d
+Warning: The magic method __invoke() must have public visibility and cannot be static in %s on line %d
b::test()
a::test(c::TESTCONSTANT)
diff --git a/Zend/tests/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/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..b480bffab5 100644
--- a/Zend/tests/bug68370.phpt
+++ b/Zend/tests/bug68370.phpt
@@ -3,10 +3,10 @@ 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();
diff --git a/Zend/tests/bug68446.phpt b/Zend/tests/bug68446.phpt
index 9648966691..1f682af9aa 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);
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..988e98e31e 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;
}
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/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..0eb5afb080 100644
--- a/Zend/tests/bug69315.phpt
+++ b/Zend/tests/bug69315.phpt
@@ -12,6 +12,9 @@ var_dump(defined("PHP_VERSION"));
var_dump(constant("PHP_VERSION"));
var_dump(call_user_func("strlen"));
var_dump(is_string("xxx"));
+var_dump(is_string());
+
+?>
--EXPECTF--
bool(false)
bool(true)
@@ -30,3 +33,6 @@ NULL
Warning: is_string() has been disabled for security reasons in %sbug69315.php on line %d
NULL
+
+Warning: is_string() has been disabled for security reasons in %s on line %d
+NULL
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..e68443b803 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;
diff --git a/Zend/tests/bug69446_2.phpt b/Zend/tests/bug69446_2.phpt
index b7c6e0e329..8ef2300e93 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;
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..690318fbfa 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);
}
@@ -20,7 +20,7 @@ $wpq->interesting =& ret_assoc();
$x = $wpq->interesting;
printf("%s\n", $x);
--EXPECTF--
-Notice: Undefined property: wpq::$interesting in %sbug69732.php on line 6
+Warning: Undefined property: wpq::$interesting in %s on line %d
Notice: Indirect modification of overloaded property wpq::$interesting has no effect in %sbug69732.php on line 16
diff --git a/Zend/tests/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..e419756d26 100644
--- a/Zend/tests/bug69755.phpt
+++ b/Zend/tests/bug69755.phpt
@@ -5,4 +5,7 @@ Bug #69755: segfault in ZEND_CONCAT_SPEC_TMPVAR_CONST_HANDLER
c . 10;
?>
--EXPECTF--
-Warning: Use of undefined constant c - assumed 'c' (this will throw an Error in a future version of PHP) in %sbug69755.php on line 2
+Fatal error: Uncaught Error: Undefined constant 'c' in %s:%d
+Stack trace:
+#0 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/bug69767.phpt b/Zend/tests/bug69767.phpt
index 9458546dea..095bfd89d5 100644
--- a/Zend/tests/bug69767.phpt
+++ b/Zend/tests/bug69767.phpt
@@ -5,4 +5,4 @@ Bug #69767 (Default parameter value with wrong type segfaults)
function foo(String $bar = 0) {}
?>
--EXPECTF--
-Fatal error: Default value for parameters with a string type can only be string or NULL in %sbug69767.php on line %d
+Fatal error: Cannot use int as default value for parameter $bar of type string in %s on line %d
diff --git a/Zend/tests/bug69788.phpt b/Zend/tests/bug69788.phpt
index ff028411b1..e847b3b0a5 100644
--- a/Zend/tests/bug69788.phpt
+++ b/Zend/tests/bug69788.phpt
@@ -3,6 +3,7 @@ Bug #69788: Malformed script causes Uncaught Error in php-cgi, valgrind SIGILL
--FILE--
<?php [t.[]]; ?>
--EXPECTF--
-Warning: Use of undefined constant t - assumed 't' (this will throw an Error in a future version of PHP) in %s on line %d
-
-Notice: Array to string conversion in %s on line %d
+Fatal error: Uncaught Error: Undefined constant 't' in %s:%d
+Stack trace:
+#0 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/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..705d12e488 100644
--- a/Zend/tests/bug69871.phpt
+++ b/Zend/tests/bug69871.phpt
@@ -7,9 +7,9 @@ opcache.enable=0
$a = true;
if (isset($a) && 0) {
- var_dump(true);
+ var_dump(true);
} else {
- var_dump(false);
+ var_dump(false);
}
?>
diff --git a/Zend/tests/bug69957.phpt b/Zend/tests/bug69957.phpt
index 01b024e778..188e56405b 100644
--- a/Zend/tests/bug69957.phpt
+++ b/Zend/tests/bug69957.phpt
@@ -4,59 +4,59 @@ 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());
}
?>
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..657c532622 100644
--- a/Zend/tests/bug70089.phpt
+++ b/Zend/tests/bug70089.phpt
@@ -8,26 +8,26 @@ 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..cc46be6458 100644
--- a/Zend/tests/bug70117.phpt
+++ b/Zend/tests/bug70117.phpt
@@ -4,14 +4,14 @@ 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());
diff --git a/Zend/tests/bug70124.phpt b/Zend/tests/bug70124.phpt
index f32a8613fe..4a6c46cbfa 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..258d594421 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";
}
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..851a6b855e 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 { }
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..11f59dd95b 100644
--- a/Zend/tests/bug70258.phpt
+++ b/Zend/tests/bug70258.phpt
@@ -12,13 +12,13 @@ if ($zend_mm_enabled === "0") {
--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/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..d185cbc3a6 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--
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..b33d47a6a9 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;
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..71ff19a0b5 100644
--- a/Zend/tests/bug70895.phpt
+++ b/Zend/tests/bug70895.phpt
@@ -3,13 +3,23 @@ Bug #70895 null ptr deref and segfault with crafted callable
--FILE--
<?php
-array_map("%n", 0);
-array_map("%n %i", 0);
-array_map("%n %i aoeu %f aoeu %p", 0);
+try {
+ array_map("%n", 0);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ array_map("%n %i", 0);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ array_map("%n %i aoeu %f aoeu %p", 0);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTREGEX--
-Warning: array_map\(\) expects parameter 1 to be a valid callback, function '%n' not found or invalid function name in .+
-
-Warning: array_map\(\) expects parameter 1 to be a valid callback, function '%n %i' not found or invalid function name in .+
-
-Warning: array_map\(\) expects parameter 1 to be a valid callback, function '%n %i aoeu %f aoeu %p' not found or invalid function name in .+bug70895.php on line \d+
+--EXPECT--
+array_map() expects parameter 1 to be a valid callback, function '%n' not found or invalid function name
+array_map() expects parameter 1 to be a valid callback, function '%n %i' not found or invalid function name
+array_map() expects parameter 1 to be a valid callback, function '%n %i aoeu %f aoeu %p' not found or invalid function name
diff --git a/Zend/tests/bug70898.phpt b/Zend/tests/bug70898.phpt
index e31ee894bf..fa6e96d83f 100644
--- a/Zend/tests/bug70898.phpt
+++ b/Zend/tests/bug70898.phpt
@@ -2,21 +2,15 @@
Bug #70895 null ptr deref and segfault with crafted callable
--FILE--
<?php
- function m($f,$a){
- return array_map($f,0);
- }
+function m($f,$a){
+ return array_map($f,0);
+}
- echo implode(m("",m("",m("",m("",m("0000000000000000000000000000000000",("")))))));
+try {
+ echo implode(m("",m("",m("",m("",m("0000000000000000000000000000000000",("")))))));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Warning: array_map() expects parameter 1 to be a valid callback, function '0000000000000000000000000000000000' not found or invalid function name in %sbug70898.php on line %d
-
-Warning: array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name in %sbug70898.php on line %d
-
-Warning: array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name in %sbug70898.php on line %d
-
-Warning: array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name in %sbug70898.php on line %d
-
-Warning: array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name in %sbug70898.php on line %d
-
-Warning: implode(): Argument must be an array in %sbug70898.php on line %d
+--EXPECT--
+array_map() expects parameter 1 to be a valid callback, function '0000000000000000000000000000000000' not found or invalid function name
diff --git a/Zend/tests/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/bug70918.phpt b/Zend/tests/bug70918.phpt
index 81e2192d8a..d376d2147a 100644
--- a/Zend/tests/bug70918.phpt
+++ b/Zend/tests/bug70918.phpt
@@ -3,39 +3,39 @@ 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--
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..ad2115e4a0 100644
--- a/Zend/tests/bug70957.phpt
+++ b/Zend/tests/bug70957.phpt
@@ -19,4 +19,4 @@ class B extends Foo
}
?>
--EXPECTF--
-Warning: Declaration of T::bar() should be compatible with Foo::bar($a = 'Foo') in %sbug70957.php on line %d
+Fatal error: Declaration of T::bar() must be compatible with Foo::bar($a = 'Foo') in %sbug70957.php on line %d
diff --git a/Zend/tests/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/bug71067.phpt b/Zend/tests/bug71067.phpt
index b2a1b31811..efad6e4c11 100644
--- a/Zend/tests/bug71067.phpt
+++ b/Zend/tests/bug71067.phpt
@@ -6,13 +6,13 @@ 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..b55a14a2bd 100644
--- a/Zend/tests/bug71221.phpt
+++ b/Zend/tests/bug71221.phpt
@@ -2,9 +2,10 @@
Bug #71221 (Null pointer deref (segfault) in get_defined_vars via ob_start)
--FILE--
<?php
-ob_start("get_defined_vars");
-ob_end_clean();
-?>
-okey
+register_shutdown_function("get_defined_vars");
--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/bug71428.1.phpt b/Zend/tests/bug71428.1.phpt
index 490fc30070..acecd85fc5 100644
--- a/Zend/tests/bug71428.1.phpt
+++ b/Zend/tests/bug71428.1.phpt
@@ -9,4 +9,4 @@ class B extends A {
public function m(array $a = []) {}
}
--EXPECTF--
-Warning: Declaration of B::m(array $a = Array) should be compatible with A::m(?array $a = NULL) in %sbug71428.1.php on line 6
+Fatal error: Declaration of B::m(array $a = Array) must be compatible with A::m(?array $a = NULL) in %sbug71428.1.php on line 6
diff --git a/Zend/tests/bug71428.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..35b805a2a7 100644
--- a/Zend/tests/bug71841.phpt
+++ b/Zend/tests/bug71841.phpt
@@ -1,23 +1,33 @@
--TEST--
Bug #71841 (EG(error_zval) is not handled well)
---INI--
-error_reporting=0
--FILE--
<?php
$z = unserialize('O:1:"A":0:{}');
-var_dump($z->e.=0);
-var_dump(++$z->x);
-var_dump($z->y++);
+@var_dump($z->e.=0);
+@var_dump(++$z->x);
+@var_dump($z->y++);
$y = array(PHP_INT_MAX => 0);
-var_dump($y[] .= 0);
-var_dump(++$y[]);
-var_dump($y[]++);
+try {
+ var_dump($y[] .= 0);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(++$y[]);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump($y[]++);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
?>
--EXPECT--
NULL
NULL
NULL
-NULL
-NULL
-NULL
+Cannot add element to the array as the next element is already occupied
+Cannot add element to the array as the next element is already occupied
+Cannot add element to the array as the next element is already occupied
diff --git a/Zend/tests/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..44207af965 100644
--- a/Zend/tests/bug72038.phpt
+++ b/Zend/tests/bug72038.phpt
@@ -3,23 +3,31 @@ 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);
-test($baz = &$bar);
-var_dump($baz);
+try {
+ test($foo = new stdClass);
+ var_dump($foo);
+} catch (Throwable $e) {
+ echo "Exception: " . $e->getMessage() . "\n";
+}
+try {
+ test($bar = 2);
+ var_dump($bar);
+} catch (Throwable $e) {
+ echo "Exception: " . $e->getMessage() . "\n";
+}
+try {
+ test($baz = &$bar);
+ var_dump($baz);
+} catch (Throwable $e) {
+ echo "Exception: " . $e->getMessage() . "\n";
+}
function test(&$param) {
$param = 1;
}
?>
---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--
+Exception: Cannot pass parameter 1 by reference
+Exception: Cannot pass parameter 1 by reference
int(1)
diff --git a/Zend/tests/bug72057.phpt b/Zend/tests/bug72057.phpt
index 406efe3efc..a518d82948 100644
--- a/Zend/tests/bug72057.phpt
+++ b/Zend/tests/bug72057.phpt
@@ -13,7 +13,7 @@ set_error_handler(
--EXPECTF--
Fatal error: Uncaught Exception: My custom error in %s:%d
Stack trace:
-#0 %s(%d): {closure}(8, 'A non well form...', '%s', %d, Array)
+#0 %s(%d): {closure}(8, 'A non well form...', '%s', %d)
#1 %s(%d): {closure}('7as')
#2 {main}
thrown in %s on line %d
diff --git a/Zend/tests/bug72101.phpt b/Zend/tests/bug72101.phpt
index 808627be3b..23861958fd 100644
--- a/Zend/tests/bug72101.phpt
+++ b/Zend/tests/bug72101.phpt
@@ -76,7 +76,7 @@ $foo->bar($a, $b, $c);
--EXPECTF--
Fatal error: Uncaught Error: Class 'DoesNotExists' not found in %sbug72101.php:61
Stack trace:
-#0 %sbug72101.php(8): {closure}(2, 'Parameter 1 to ...', '%s', 8, Array)
+#0 %sbug72101.php(8): {closure}(2, 'Parameter 1 to ...', '%s', 8)
#1 %sbug72101.php(27): PHPUnit_Framework_MockObject_Stub_ReturnCallback->invoke(Object(PHPUnit_Framework_MockObject_Invocation_Static))
#2 %sbug72101.php(19): PHPUnit_Framework_MockObject_Matcher->invoked(Object(PHPUnit_Framework_MockObject_Invocation_Static))
#3 %sbug72101.php(52): PHPUnit_Framework_MockObject_InvocationMocker->invoke(Object(PHPUnit_Framework_MockObject_Invocation_Static))
diff --git a/Zend/tests/bug72107.phpt b/Zend/tests/bug72107.phpt
index 3f4c46cf70..c22f657ebb 100644
--- a/Zend/tests/bug72107.phpt
+++ b/Zend/tests/bug72107.phpt
@@ -6,9 +6,11 @@ set_error_handler('func_get_args');
function test($a) {
echo $undef;
}
-test(1);
+try {
+ test(1);
+} catch (\Error $e) {
+ echo $e->getMessage();
+}
?>
---EXPECTF--
-Warning: Cannot call func_get_args() dynamically in %s on line %d
-
-Notice: Undefined variable: undef in %s on line %d
+--EXPECT--
+Cannot call func_get_args() dynamically
diff --git a/Zend/tests/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/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..5ffbe1ef34 100644
--- a/Zend/tests/bug72594.phpt
+++ b/Zend/tests/bug72594.phpt
@@ -5,12 +5,12 @@ 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..eeee510279 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 {
diff --git a/Zend/tests/bug72598_2.phpt b/Zend/tests/bug72598_2.phpt
index c3943806ff..d58e18c978 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);
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/bug72944.phpt b/Zend/tests/bug72944.phpt
index 0ee8bd62c6..0ddc99ff3b 100644
--- a/Zend/tests/bug72944.phpt
+++ b/Zend/tests/bug72944.phpt
@@ -2,11 +2,10 @@
Bug #72944 (Null pointer deref in zval_delref_p).
--FILE--
<?php
+define('e', 'e');
("a"== e & $A = $A? 0 : 0) ?:0;
echo "OK\n";
?>
--EXPECTF--
-Warning: Use of undefined constant e - assumed 'e' (this will throw an Error in a future version of PHP) in %sbug72944.php on line 2
-
-Notice: Undefined variable: A in %sbug72944.php on line 2
+Warning: Undefined variable: A in %s on line %d
OK
diff --git a/Zend/tests/bug73163.phpt b/Zend/tests/bug73163.phpt
deleted file mode 100644
index 5c0560458d..0000000000
--- a/Zend/tests/bug73163.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-Bug #73163 (PHP hangs if error handler throws while accessing undef const in default value)
---FILE--
-<?php
-
-function doSomething(string $value = UNDEFINED) {
-}
-
-set_error_handler(function($errno, $errstr) {
- throw new Exception($errstr);
-});
-
-doSomething();
-
-?>
---EXPECTF--
-Fatal error: Uncaught Exception: Use of undefined constant UNDEFINED - assumed 'UNDEFINED' (this will throw an Error in a future version of PHP) in %s:%d
-Stack trace:
-#0 %s(%d): {closure}(%s)
-#1 %s(%d): doSomething()
-#2 {main}
- thrown in %s on line %d
diff --git a/Zend/tests/bug73181.phpt b/Zend/tests/bug73181.phpt
deleted file mode 100644
index 3ab93ebf5b..0000000000
--- a/Zend/tests/bug73181.phpt
+++ /dev/null
@@ -1,21 +0,0 @@
---TEST--
-Bug #73181: parse_str() without a second argument leads to crash
---FILE--
-<?php
-
-function x() {
- parse_str("1&x");
- var_dump(get_defined_vars());
-}
-
-x();
-
-?>
---EXPECTF--
-Deprecated: parse_str(): Calling parse_str() without the result argument is deprecated in %s on line %d
-array(2) {
- [1]=>
- string(0) ""
- ["x"]=>
- string(0) ""
-}
diff --git a/Zend/tests/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/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..72fb44df89 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: Cannot pass parameter 1 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..8af16b169b 100644
--- a/Zend/tests/bug73792.phpt
+++ b/Zend/tests/bug73792.phpt
@@ -5,7 +5,7 @@ Bug #73792 (invalid foreach loop hangs script)
$a = 'aaa';
foreach ($a['bbb'] as &$value) {
- echo 'loop';
+ echo 'loop';
}
unset($value);
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/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..ab4dce0a5a 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
+Unsupported operand types
+Unsupported operand types
+Unsupported operand types
diff --git a/Zend/tests/bug74164.phpt b/Zend/tests/bug74164.phpt
index 354b2f51e0..b623dcb1db 100644
--- a/Zend/tests/bug74164.phpt
+++ b/Zend/tests/bug74164.phpt
@@ -6,7 +6,7 @@ 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');
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/bug74657.phpt b/Zend/tests/bug74657.phpt
index 4c84bde7bd..fb9b3d6a4d 100644
--- a/Zend/tests/bug74657.phpt
+++ b/Zend/tests/bug74657.phpt
@@ -7,13 +7,13 @@ 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);
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..d6c2d79e2d 100644
--- a/Zend/tests/bug75241.phpt
+++ b/Zend/tests/bug75241.phpt
@@ -2,12 +2,12 @@
Bug #75241 (Null pointer dereference in zend_mm_alloc_small())
--FILE--
<?php
-function eh(){}
-
-set_error_handler('eh');
$d->d = &$d + $d->d/=0;
var_dump($d);
?>
---EXPECT--
-float(INF)
+--EXPECTF--
+Fatal error: Uncaught Error: Attempt to modify property 'd' of non-object in %s:%d
+Stack trace:
+#0 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/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..a8649262b5 100644
--- a/Zend/tests/bug75921.phpt
+++ b/Zend/tests/bug75921.phpt
@@ -3,78 +3,65 @@ Bug #75921: Inconsistent error when creating stdObject from empty variable
--FILE--
<?php
-$null->a = 42;
+try {
+ $null->a = 42;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump($null);
unset($null);
-$null->a['hello'] = 42;
+try {
+ $null->a['hello'] = 42;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump($null);
unset($null);
-$null->a->b = 42;
+try {
+ $null->a->b = 42;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump($null);
unset($null);
-$null->a['hello']->b = 42;
+try {
+ $null->a['hello']->b = 42;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump($null);
unset($null);
-$null->a->b['hello'] = 42;
+try {
+ $null->a->b['hello'] = 42;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump($null);
unset($null);
?>
--EXPECTF--
-Warning: Creating default object from empty value in %sbug75921.php on line 3
-object(stdClass)#1 (1) {
- ["a"]=>
- int(42)
-}
+Attempt to assign property 'a' of non-object
-Warning: Creating default object from empty value in %sbug75921.php on line 7
-object(stdClass)#1 (1) {
- ["a"]=>
- array(1) {
- ["hello"]=>
- int(42)
- }
-}
-
-Warning: Creating default object from empty value in %sbug75921.php on line 11
-
-Warning: Creating default object from empty value in %sbug75921.php on line 11
-object(stdClass)#1 (1) {
- ["a"]=>
- object(stdClass)#2 (1) {
- ["b"]=>
- int(42)
- }
-}
+Warning: Undefined variable: null in %s on line %d
+NULL
+Attempt to modify property 'a' of non-object
-Warning: Creating default object from empty value in %sbug75921.php on line 15
+Warning: Undefined variable: null in %s on line %d
+NULL
+Attempt to modify property 'a' of non-object
-Warning: Creating default object from empty value in %sbug75921.php on line 15
-object(stdClass)#1 (1) {
- ["a"]=>
- array(1) {
- ["hello"]=>
- object(stdClass)#2 (1) {
- ["b"]=>
- int(42)
- }
- }
-}
+Warning: Undefined variable: null in %s on line %d
+NULL
+Attempt to modify property 'a' of non-object
-Warning: Creating default object from empty value in %sbug75921.php on line 19
+Warning: Undefined variable: null in %s on line %d
+NULL
+Attempt to modify property 'a' of non-object
-Warning: Creating default object from empty value in %sbug75921.php on line 19
-object(stdClass)#1 (1) {
- ["a"]=>
- object(stdClass)#2 (1) {
- ["b"]=>
- array(1) {
- ["hello"]=>
- int(42)
- }
- }
-}
+Warning: Undefined variable: null in %s on line %d
+NULL
diff --git a/Zend/tests/bug76025.phpt b/Zend/tests/bug76025.phpt
index 2619984d1e..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..17d1550562 100644
--- a/Zend/tests/bug76534.phpt
+++ b/Zend/tests/bug76534.phpt
@@ -3,7 +3,7 @@ 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";
@@ -12,6 +12,6 @@ $y = &$x["bar"];
--EXPECTF--
Fatal error: Uncaught Exception: Illegal string offset 'bar' in %sbug76534.php:%d
Stack trace:
-#0 %sbug76534.php(%d): {closure}(2, 'Illegal string ...', '%s', %d, Array)
+#0 %sbug76534.php(%d): {closure}(2, 'Illegal string ...', '%s', %d)
#1 {main}
thrown in %sbug76534.php on line %d
diff --git a/Zend/tests/bug76667.phpt b/Zend/tests/bug76667.phpt
index 15dc34693d..1510c0f73a 100644
--- a/Zend/tests/bug76667.phpt
+++ b/Zend/tests/bug76667.phpt
@@ -4,35 +4,35 @@ Bug #76667 (Segfault with divide-assign op and __get + __set)
<?php
class T {
- public function __get($k)
- {
- return $undefined->$k;
- }
-
- public function __set($k, $v)
- {
- return $this->$v /= 0;
- }
+ public function __get($k)
+ {
+ return $undefined->$k;
+ }
+
+ public function __set($k, $v)
+ {
+ return $this->$v /= 0;
+ }
};
$x = new T;
$x->x = 1;
?>
--EXPECTF--
-Notice: Undefined variable: undefined in %sbug76667.php on line %d
+Warning: Undefined variable: undefined in %s on line %d
-Notice: Trying to get property '1' of non-object in %sbug76667.php on line %d
+Warning: Trying to get property '1' of non-object in %s on line %d
Warning: Division by zero in %sbug76667.php on line %d
-Notice: Undefined variable: undefined in %sbug76667.php on line %d
+Warning: Undefined variable: undefined in %s on line %d
-Notice: Trying to get property 'NAN' of non-object in %sbug76667.php on line %d
+Warning: Trying to get property 'NAN' of non-object in %s on line %d
Warning: Division by zero in %sbug76667.php on line %d
-Notice: Undefined variable: undefined in %sbug76667.php on line %d
+Warning: Undefined variable: undefined in %s on line %d
-Notice: Trying to get property 'NAN' of non-object in %sbug76667.php on line %d
+Warning: Trying to get property 'NAN' of non-object in %s on line %d
Warning: Division by zero in %sbug76667.php on line %d
diff --git a/Zend/tests/bug76754.phpt b/Zend/tests/bug76754.phpt
index 424f1fbffc..5cdac04fcf 100644
--- a/Zend/tests/bug76754.phpt
+++ b/Zend/tests/bug76754.phpt
@@ -8,7 +8,7 @@ opcache.enable_cli=0
class FOO
{
- private const FOO = 'BAR';
+ private const FOO = 'BAR';
}
class BAR extends FOO { }
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..825bed0eb1 100644
--- a/Zend/tests/bug76869.phpt
+++ b/Zend/tests/bug76869.phpt
@@ -1,22 +1,22 @@
--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--
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/bug77494.phpt b/Zend/tests/bug77494.phpt
index 1793f6b219..adab05bef7 100644
--- a/Zend/tests/bug77494.phpt
+++ b/Zend/tests/bug77494.phpt
@@ -12,5 +12,5 @@ var_dump($a->name);
--EXPECTF--
Warning: CURLFile() has been disabled for security reasons in %sbug77494.php on line 2
-Notice: Undefined property: CURLFile::$name in %sbug77494.php on line 3
+Warning: Undefined property: CURLFile::$name in %s on line %d
NULL
diff --git a/Zend/tests/bug77738.phpt b/Zend/tests/bug77738.phpt
index e3a453c405..c664a31344 100644
--- a/Zend/tests/bug77738.phpt
+++ b/Zend/tests/bug77738.phpt
@@ -5,4 +5,7 @@ Bug #77738 (Nullptr deref in zend_compile_expr)
__COMPILER_HALT_OFFSET__;
; // <- important
--EXPECTF--
-Warning: Use of undefined constant __COMPILER_HALT_OFFSET__ - assumed '__COMPILER_HALT_OFFSET__' %sbug77738.php on line %d
+Fatal error: Uncaught Error: Undefined constant '__COMPILER_HALT_OFFSET__' in %s:%d
+Stack trace:
+#0 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/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/bug78154.phpt b/Zend/tests/bug78154.phpt
index 2a69ebe811..4016a88973 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: Cannot pass parameter 3 by reference
+Exception: Cannot pass parameter 3 by reference
diff --git a/Zend/tests/bug78182.phpt b/Zend/tests/bug78182.phpt
index 4b0f08dc3b..d7f10e94df 100644
--- a/Zend/tests/bug78182.phpt
+++ b/Zend/tests/bug78182.phpt
@@ -4,12 +4,13 @@ Bug #78182: Segmentation fault during by-reference property assignment
<?php
$varName = 'var';
$propName = 'prop';
-$$varName->$propName =& $$varName;
+try {
+ $$varName->$propName =& $$varName;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump($var);
?>
---EXPECTF--
-Warning: Creating default object from empty value in %s on line %d
-object(stdClass)#1 (1) {
- ["prop"]=>
- *RECURSION*
-}
+--EXPECT--
+Attempt to modify property 'prop' of non-object
+NULL
diff --git a/Zend/tests/bug78239.phpt b/Zend/tests/bug78239.phpt
index 94908a785b..aa81af4452 100644
--- a/Zend/tests/bug78239.phpt
+++ b/Zend/tests/bug78239.phpt
@@ -1,5 +1,7 @@
--TEST--
Bug #78239: Deprecation notice during string conversion converted to exception hangs
+--SKIPIF--
+<?php if (!extension_loaded("zend-test")) die("skip requires zend-test extension"); ?>
--FILE--
<?php
function handleError($level, $message, $file = '', $line = 0, $context = [])
@@ -9,21 +11,12 @@ function handleError($level, $message, $file = '', $line = 0, $context = [])
set_error_handler('handleError');
-class A
-{
-
- public function abc(): bool
- {
- return false;
- }
-}
-
-$r = new ReflectionMethod("A", "abc");
-(string)$r->getReturnType() ?: "";
+$r = new _ZendTestClass;
+(string)$r ?: "";
?>
--EXPECTF--
-Fatal error: Uncaught ErrorException: Function ReflectionType::__toString() is deprecated in %s:%d
+Fatal error: Uncaught ErrorException: Function _ZendTestClass::__toString() is deprecated in %s:%d
Stack trace:
#0 %s(%d): handleError(%s)
#1 {main}
diff --git a/Zend/tests/bug78379.phpt b/Zend/tests/bug78379.phpt
index e48e9b7ca4..ebe0d1e329 100644
--- a/Zend/tests/bug78379.phpt
+++ b/Zend/tests/bug78379.phpt
@@ -5,9 +5,9 @@ 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/bug78531.phpt b/Zend/tests/bug78531.phpt
index ba460ee05a..1e8f0b34d1 100644
--- a/Zend/tests/bug78531.phpt
+++ b/Zend/tests/bug78531.phpt
@@ -2,17 +2,36 @@
Bug #78531 (Crash when using undefined variable as object)
--FILE--
<?php
-@$u1->a += 5;
-var_dump($u1->a);
-@$x = ++$u2->a;
-var_dump($u2->a);
-@$x = $u3->a++;
-var_dump($u3->a);
-@$u4->a->a += 5;
-var_dump($u4->a->a);
+try {
+ $u1->a += 5;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $x = ++$u2->a;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $x = $u3->a++;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $u4->a->a += 5;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECT--
-int(5)
-int(1)
-int(1)
-int(5) \ No newline at end of file
+--EXPECTF--
+Warning: Undefined variable: u1 in %s on line %d
+Attempt to assign property 'a' of non-object
+
+Warning: Undefined variable: u2 in %s on line %d
+Attempt to increment/decrement property 'a' of non-object
+
+Warning: Undefined variable: u3 in %s on line %d
+Attempt to increment/decrement property 'a' of non-object
+
+Warning: Undefined variable: u4 in %s on line %d
+Attempt to modify property 'a' of non-object
diff --git a/Zend/tests/bug78868.phpt b/Zend/tests/bug78868.phpt
index 172af2a930..f6b66c765e 100644
--- a/Zend/tests/bug78868.phpt
+++ b/Zend/tests/bug78868.phpt
@@ -3,22 +3,22 @@ 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);
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/bug78999.phpt b/Zend/tests/bug78999.phpt
index d4ec16b972..e44a38f077 100644
--- a/Zend/tests/bug78999.phpt
+++ b/Zend/tests/bug78999.phpt
@@ -3,9 +3,9 @@ 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());
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/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/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..4debb412dc 100644
--- a/Zend/tests/call_static.phpt
+++ b/Zend/tests/call_static.phpt
@@ -4,10 +4,10 @@ __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');
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..3d2becdc78 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() expects parameter 1 to be a valid callback, cannot access private method testing\foo::priv()
+call_user_func() expects parameter 1 to be a valid callback, cannot access protected method testing\foo::prot()
diff --git a/Zend/tests/call_user_func_002.phpt b/Zend/tests/call_user_func_002.phpt
index 454c6fda96..cc07ffab16 100644
--- a/Zend/tests/call_user_func_002.phpt
+++ b/Zend/tests/call_user_func_002.phpt
@@ -4,26 +4,38 @@ Testing call_user_func() with autoload and passing invalid params
<?php
spl_autoload_register(function ($class) {
- var_dump($class);
+ var_dump($class);
});
-call_user_func(array('foo', 'bar'));
-call_user_func(array('', 'bar'));
-call_user_func(array($foo, 'bar'));
-call_user_func(array($foo, ''));
+try {
+ call_user_func(array('foo', 'bar'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ call_user_func(array('', 'bar'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ call_user_func(array($foo, 'bar'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ call_user_func(array($foo, ''));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
--EXPECTF--
string(3) "foo"
+call_user_func() expects parameter 1 to be a valid callback, class 'foo' not found
+call_user_func() expects parameter 1 to be a valid callback, class '' not found
-Warning: call_user_func() expects parameter 1 to be a valid callback, class 'foo' not found in %s on line %d
+Warning: Undefined variable: foo in %s on line %d
+call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object
-Warning: call_user_func() expects parameter 1 to be a valid callback, class '' not found in %s on line %d
-
-Notice: Undefined variable: foo in %s on line %d
-
-Warning: call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in %s on line %d
-
-Notice: Undefined variable: foo in %s on line %d
-
-Warning: call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in %s on line %d
+Warning: Undefined variable: foo in %s on line %d
+call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object
diff --git a/Zend/tests/call_user_func_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..fd130eb773 100644
--- a/Zend/tests/call_user_func_005.phpt
+++ b/Zend/tests/call_user_func_005.phpt
@@ -4,21 +4,20 @@ 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
string(1) "x"
array(1) {
[0]=>
diff --git a/Zend/tests/call_user_func_007.phpt b/Zend/tests/call_user_func_007.phpt
index ed44320c3f..d3f2747c13 100644
--- a/Zend/tests/call_user_func_007.phpt
+++ b/Zend/tests/call_user_func_007.phpt
@@ -13,7 +13,7 @@ var_dump($a);
--EXPECTF--
Notice: Undefined offset: 0 in %s on line %d
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
Warning: Parameter 1 to foo() expected to be a reference, value given in %s on line %d
array(0) {
diff --git a/Zend/tests/call_user_func_array_invalid_type.phpt b/Zend/tests/call_user_func_array_invalid_type.phpt
new file mode 100644
index 0000000000..d1c70f0fef
--- /dev/null
+++ b/Zend/tests/call_user_func_array_invalid_type.phpt
@@ -0,0 +1,18 @@
+--TEST--
+call_user_func_array() generating TypeError
+--FILE--
+<?php
+class drv {
+ function func() {
+ }
+}
+
+$drv = new drv;
+try {
+ call_user_func_array(array($drv, 'func'), null);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+?>
+--EXPECT--
+call_user_func_array() expects parameter 2 to be array, null given
diff --git a/Zend/tests/case_insensitive_constant_deprecation.phpt b/Zend/tests/case_insensitive_constant_deprecation.phpt
deleted file mode 100644
index e7a92c8c4c..0000000000
--- a/Zend/tests/case_insensitive_constant_deprecation.phpt
+++ /dev/null
@@ -1,127 +0,0 @@
---TEST--
-Case-insensitive constants are deprecated
---FILE--
-<?php
-
-namespace {
- define('FOO', 42, true); // Deprecated
- define('NS\FOO', 24, true); // Deprecated
-
- var_dump(FOO); // Ok
- var_dump(foo); // Deprecated
-
- var_dump(NS\FOO); // Ok
- var_dump(ns\FOO); // Ok
- var_dump(ns\foo); // Deprecated
-
- var_dump(defined('FOO')); // Ok
- var_dump(defined('foo')); // Ok
- var_dump(defined('NS\FOO')); // Ok
- var_dump(defined('ns\FOO')); // Ok
- var_dump(defined('ns\foo')); // Ok
-
- var_dump(constant('FOO')); // Ok
- var_dump(constant('foo')); // Deprecated
- var_dump(constant('NS\FOO')); // Ok
- var_dump(constant('ns\FOO')); // Ok
- var_dump(constant('ns\foo')); // Deprecated
-}
-
-namespace NS {
- var_dump(FOO); // Ok
- var_dump(foo); // Deprecated
-}
-
-namespace ns {
- var_dump(FOO); // Ok
- var_dump(foo); // Deprecated
-}
-
-namespace Other {
- var_dump(FOO); // Ok
- var_dump(foo); // Deprecated
-
- var_dump(defined('FOO')); // Ok
- var_dump(defined('foo')); // Ok
- var_dump(defined('NS\FOO')); // Ok
- var_dump(defined('ns\FOO')); // Ok
- var_dump(defined('ns\foo')); // Ok
-
- var_dump(constant('FOO')); // Ok
- var_dump(constant('foo')); // Deprecated
- var_dump(constant('NS\FOO')); // Ok
- var_dump(constant('ns\FOO')); // Ok
- var_dump(constant('ns\foo')); // Deprecated
-
- const C1 = FOO; // Ok
- var_dump(C1);
- const C2 = foo; // Deprecated
- var_dump(C2);
- const C3 = 1 + FOO; // Ok
- var_dump(C3);
- const C4 = 1 + foo; // Deprecated
- var_dump(C4);
-}
-
-?>
---EXPECTF--
-Deprecated: define(): Declaration of case-insensitive constants is deprecated in %s on line 4
-
-Deprecated: define(): Declaration of case-insensitive constants is deprecated in %s on line 5
-int(42)
-
-Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 8
-int(42)
-int(24)
-int(24)
-
-Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "NS\FOO" in %s on line 12
-int(24)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-int(42)
-
-Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 21
-int(42)
-int(24)
-int(24)
-
-Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "NS\FOO" in %s on line 24
-int(24)
-int(24)
-
-Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "NS\FOO" in %s on line 29
-int(24)
-int(24)
-
-Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "NS\FOO" in %s on line 34
-int(24)
-int(42)
-
-Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 39
-int(42)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-bool(true)
-int(42)
-
-Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 48
-int(42)
-int(24)
-int(24)
-
-Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "NS\FOO" in %s on line 51
-int(24)
-int(42)
-
-Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 55
-int(42)
-int(43)
-
-Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 59
-int(43)
diff --git a/Zend/tests/cast_to_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..6151c00f84 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";
diff --git a/Zend/tests/cast_to_int.phpt b/Zend/tests/cast_to_int.phpt
index 2a637e15e5..5dbab23fd2 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";
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_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_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_constants_001.phpt b/Zend/tests/class_constants_001.phpt
index f36b1af9f6..68b4e289b8 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 class 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..c34b3620e1 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();
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_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..de68e9cca1
--- /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..c080946970
--- /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..02ff350ca2 100644
--- a/Zend/tests/clone_003.phpt
+++ b/Zend/tests/clone_003.phpt
@@ -7,7 +7,7 @@ $a = clone $b;
?>
--EXPECTF--
-Notice: Undefined variable: b in %s on line %d
+Warning: Undefined variable: b in %s on line %d
Fatal error: Uncaught Error: __clone method called on non-object in %s:%d
Stack trace:
diff --git a/Zend/tests/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..f02045f5b1 100644
--- a/Zend/tests/closure_012.phpt
+++ b/Zend/tests/closure_012.phpt
@@ -16,8 +16,8 @@ $lambda();
var_dump($i);
?>
--EXPECTF--
-Notice: Undefined variable: i in %sclosure_012.php on line 2
+Warning: Undefined variable: i in %s on line %d
-Notice: Undefined variable: i in %sclosure_012.php on line 7
+Warning: Undefined variable: i in %s on line %d
NULL
int(2)
diff --git a/Zend/tests/closure_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..05efffb9d4 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();
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_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..ab5fde2026 100644
--- a/Zend/tests/closure_027.phpt
+++ b/Zend/tests/closure_027.phpt
@@ -4,7 +4,7 @@ Closure 027: Testing Closure type-hint
<?php
function test(closure $a) {
- var_dump($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,7 +27,7 @@ object(stdClass)#%d (0) {
}
NULL
-Notice: Undefined variable: y in %s on line %d
+Warning: Undefined variable: y in %s on line %d
Exception: Too few arguments to function {closure}(), 0 passed in %s on line %d and exactly 1 expected
Fatal error: Uncaught TypeError: Argument 1 passed to test() must be an instance of Closure, instance of stdClass given, called in %s on line %d and defined in %s:%d
diff --git a/Zend/tests/closure_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..d86f590682 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;
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..9c59e798f7 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);
@@ -25,21 +25,12 @@ $ca = $a->getIncrementor();
$cas = $a->getStaticIncrementor();
$ca->bindTo($a, array());
-$ca->bindTo(array(), 'A');
-$ca->bindTo($a, array(), "");
-$ca->bindTo();
$cas->bindTo($a, 'A');
?>
--EXPECTF--
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
Warning: Class 'Array' not found in %s on line %d
-Warning: Closure::bindTo() expects parameter 1 to be object, array given in %s on line 25
-
-Warning: Closure::bindTo() expects at most 2 parameters, 3 given in %s on line %d
-
-Warning: Closure::bindTo() expects at least 1 parameter, 0 given in %s on line %d
-
Warning: Cannot bind an instance to a static closure in %s on line %d
diff --git a/Zend/tests/closure_041.phpt b/Zend/tests/closure_041.phpt
index cfe4f9487f..20e5217095 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);
@@ -81,9 +79,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..13c3e519b9 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();
diff --git a/Zend/tests/closure_044.phpt b/Zend/tests/closure_044.phpt
index 225d7540d2..e886f5e764 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,7 +31,7 @@ $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";
@@ -51,9 +51,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 +66,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_046.phpt b/Zend/tests/closure_046.phpt
index e10cc1b57e..5f0a0ba160 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";
@@ -51,9 +49,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_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..2a83778954 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";
diff --git a/Zend/tests/closure_059.phpt b/Zend/tests/closure_059.phpt
index 299d8f5d9d..68fd10321f 100644
--- a/Zend/tests/closure_059.phpt
+++ b/Zend/tests/closure_059.phpt
@@ -18,19 +18,19 @@ $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
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 f01e393570..2c574c49c0 100644
--- a/Zend/tests/closure_061.phpt
+++ b/Zend/tests/closure_061.phpt
@@ -175,9 +175,7 @@ Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure
-------------------
bindTo(null, Cls::class):
-Unbinding $this of a method is deprecated
-
-Success!
+Cannot unbind $this of method
bindTo(new Cls, Cls::class):
Success!
@@ -210,10 +208,10 @@ bindTo(new ClsUnrelated, SplDoublyLinkedList::class):
Cannot bind method SplDoublyLinkedList::count() to object of class ClsUnrelated
bindTo(null, null):
-Cannot unbind $this of internal method
+Cannot unbind $this of method
bindTo(null, SplDoublyLinkedList::class):
-Cannot unbind $this of internal method
+Cannot unbind $this of method
bindTo(new SplDoublyLinkedList, null):
Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure()
diff --git a/Zend/tests/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_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/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..72cb5bc68c 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";
@@ -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
@@ -118,4 +117,3 @@ Access public instance method of parent object through "self::" to parent method
Access proteced 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..54d7d804d3 100644
--- a/Zend/tests/closures/closure_instantiate.phpt
+++ b/Zend/tests/closures/closure_instantiate.phpt
@@ -12,7 +12,7 @@ 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();
}
diff --git a/Zend/tests/compare_001.phpt b/Zend/tests/compare_001.phpt
index d9f3f080bc..dcf305d742 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";
diff --git a/Zend/tests/compare_001_64bit.phpt b/Zend/tests/compare_001_64bit.phpt
index f72f91d17b..2536073089 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";
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..c52df79634 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";
diff --git a/Zend/tests/compare_003_64bit.phpt b/Zend/tests/compare_003_64bit.phpt
index 2c361257ae..af18782857 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";
diff --git a/Zend/tests/compare_004.phpt b/Zend/tests/compare_004.phpt
index 1d13f36334..f53f22a9e5 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";
diff --git a/Zend/tests/compare_004_64bit.phpt b/Zend/tests/compare_004_64bit.phpt
index 8a69ae7816..cdd8802996 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";
diff --git a/Zend/tests/compare_005.phpt b/Zend/tests/compare_005.phpt
index 43ed96e70b..87241a50e2 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";
diff --git a/Zend/tests/compare_005_64bit.phpt b/Zend/tests/compare_005_64bit.phpt
index 821f2a0ee4..ab3d0cf0bc 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";
diff --git a/Zend/tests/compare_006.phpt b/Zend/tests/compare_006.phpt
index 1c212c5487..824c162b82 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";
diff --git a/Zend/tests/compare_006_64bit.phpt b/Zend/tests/compare_006_64bit.phpt
index 41973a990d..f85b0d28c0 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";
diff --git a/Zend/tests/compound_assign_failure.phpt b/Zend/tests/compound_assign_failure.phpt
index 2e35ab4fff..673baecff0 100644
--- a/Zend/tests/compound_assign_failure.phpt
+++ b/Zend/tests/compound_assign_failure.phpt
@@ -6,30 +6,30 @@ 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;
diff --git a/Zend/tests/compound_assign_with_numeric_strings.phpt b/Zend/tests/compound_assign_with_numeric_strings.phpt
index e5cdb344ef..a801991a1e 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,7 +32,7 @@ try{
$n %= $n;
var_dump($n);
} catch (DivisionByZeroError $e) {
- echo "\nException: " . $e->getMessage() . "\n";
+ echo "\nException: " . $e->getMessage() . "\n";
}
$n = "-1";
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/constant_expressions_arrays.phpt b/Zend/tests/constant_expressions_arrays.phpt
index 2ab03453de..d087f7928e 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);
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_exceptions_002.phpt b/Zend/tests/constant_expressions_exceptions_002.phpt
index fc15af5e9a..c10bd10843 100644
--- a/Zend/tests/constant_expressions_exceptions_002.phpt
+++ b/Zend/tests/constant_expressions_exceptions_002.phpt
@@ -3,9 +3,9 @@ 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
diff --git a/Zend/tests/constant_expressions_invalid_offset_type_error.phpt b/Zend/tests/constant_expressions_invalid_offset_type_error.phpt
index 52d2194e26..649c3a325a 100644
--- a/Zend/tests/constant_expressions_invalid_offset_type_error.phpt
+++ b/Zend/tests/constant_expressions_invalid_offset_type_error.phpt
@@ -8,7 +8,7 @@ const C2 = [C1, [] => 1];
?>
--EXPECTF--
-Fatal error: Uncaught Error: Illegal offset type in %s:%d
+Fatal error: Uncaught TypeError: Illegal offset type in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
diff --git a/Zend/tests/constants_002.phpt b/Zend/tests/constants_002.phpt
index b0cf1db61f..ddb2e67307 100644
--- a/Zend/tests/constants_002.phpt
+++ b/Zend/tests/constants_002.phpt
@@ -4,7 +4,11 @@ Defining constants with non-scalar values
<?php
define('foo', new stdClass);
-var_dump(foo);
+try {
+ var_dump(foo);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
define('foo', fopen(__FILE__, 'r'));
var_dump(foo);
@@ -12,7 +16,5 @@ var_dump(foo);
?>
--EXPECTF--
Warning: Constants may only evaluate to scalar values, arrays or resources in %s on line %d
-
-Warning: Use of undefined constant foo - assumed 'foo' (this will throw an Error in a future version of PHP) in %s on line %d
-string(%d) "foo"
-resource(%d) of type (stream)
+Undefined constant 'foo'
+resource(5) of type (stream)
diff --git a/Zend/tests/constants_005.phpt b/Zend/tests/constants_005.phpt
index b5a3a6bd38..27ab0259d1 100644
--- a/Zend/tests/constants_005.phpt
+++ b/Zend/tests/constants_005.phpt
@@ -2,11 +2,10 @@
Persistent case insensitive and user defined constants
--FILE--
<?php
-var_dump(ZEND_THREAD_safe);
+var_dump(defined('ZEND_THREAD_safe'));
define("ZEND_THREAD_safe", 123);
var_dump(ZEND_THREAD_safe);
?>
---EXPECTF--
-Warning: Use of undefined constant ZEND_THREAD_safe - assumed 'ZEND_THREAD_safe' (this will throw an Error in a future version of PHP) in %s on line %d
-string(16) "ZEND_THREAD_safe"
+--EXPECT--
+bool(false)
int(123)
diff --git a/Zend/tests/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..6a8f00edec 100644
--- a/Zend/tests/constants_008.phpt
+++ b/Zend/tests/constants_008.phpt
@@ -8,7 +8,7 @@ const a = 1;
if (defined('a')) {
- print a;
+ print a;
}
?>
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/custom_assert_deprecation.phpt b/Zend/tests/custom_assert_deprecation.phpt
deleted file mode 100644
index b4e22843dd..0000000000
--- a/Zend/tests/custom_assert_deprecation.phpt
+++ /dev/null
@@ -1,12 +0,0 @@
---TEST--
-Defining a free-standing assert() function is deprecated
---FILE--
-<?php
-
-namespace FooBar;
-
-function assert() {}
-
-?>
---EXPECTF--
-Deprecated: Defining a custom assert() function is deprecated, as the function has special semantics in %s on line %d
diff --git a/Zend/tests/custom_assert_forbidden.phpt b/Zend/tests/custom_assert_forbidden.phpt
new file mode 100644
index 0000000000..492a656f39
--- /dev/null
+++ b/Zend/tests/custom_assert_forbidden.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Defining a free-standing assert() function is deprecated
+--FILE--
+<?php
+
+namespace FooBar;
+
+function assert() {}
+
+?>
+--EXPECTF--
+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/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..3ee3a7312f 100644
--- a/Zend/tests/debug_backtrace_with_include_and_this.phpt
+++ b/Zend/tests/debug_backtrace_with_include_and_this.phpt
@@ -28,7 +28,7 @@ try {
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/decrement_001.phpt b/Zend/tests/decrement_001.phpt
index b768b5a8e5..22d95b16ac 100644
--- a/Zend/tests/decrement_001.phpt
+++ b/Zend/tests/decrement_001.phpt
@@ -8,26 +8,26 @@ 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);
+ $var--;
+ var_dump($var);
}
echo "Done\n";
diff --git a/Zend/tests/decrement_001_64bit.phpt b/Zend/tests/decrement_001_64bit.phpt
index ac4f10d682..cce9875a78 100644
--- a/Zend/tests/decrement_001_64bit.phpt
+++ b/Zend/tests/decrement_001_64bit.phpt
@@ -8,26 +8,26 @@ 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);
+ $var--;
+ var_dump($var);
}
echo "Done\n";
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..048196012f 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
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"
diff --git a/Zend/tests/dereference_002.phpt b/Zend/tests/dereference_002.phpt
index 7290df7714..e196b91e67 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,7 +70,7 @@ array(2) {
}
int(1)
-Notice: Trying to access array offset on value of type int in %s on line %d
+Warning: Trying to access array offset on value of type int in %s on line %d
NULL
Notice: Undefined offset: 4 in %s on line %d
diff --git a/Zend/tests/dereference_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..4d677c6ea1 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..f3a2e9c6f1 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;
diff --git a/Zend/tests/dereference_014.phpt b/Zend/tests/dereference_014.phpt
index 189dca7a38..c6f21ab0ed 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: Trying to get property 'a' of non-object in %s on line %d
NULL
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
-Notice: Trying to get property 'b' of non-object in %s on line %d
+Warning: Trying to get property 'b' of non-object in %s on line %d
NULL
diff --git a/Zend/tests/div_002.phpt b/Zend/tests/div_002.phpt
index be7b38e5b2..1fc006def5 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;
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..9aeea65060 100644
--- a/Zend/tests/dval_to_lval_32.phpt
+++ b/Zend/tests/dval_to_lval_32.phpt
@@ -7,20 +7,20 @@ if (PHP_INT_SIZE != 4)
?>
--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..3d6b736b8f 100644
--- a/Zend/tests/dval_to_lval_64.phpt
+++ b/Zend/tests/dval_to_lval_64.phpt
@@ -7,18 +7,18 @@ if (PHP_INT_SIZE != 8)
?>
--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..9028b1c801 100644
--- a/Zend/tests/dynamic_call_004.phpt
+++ b/Zend/tests/dynamic_call_004.phpt
@@ -7,7 +7,7 @@ $a::$b();
?>
--EXPECTF--
-Notice: Undefined variable: a in %s on line %d
+Warning: Undefined variable: a in %s on line %d
Fatal error: Uncaught Error: Class name must be a valid object or a string in %s:%d
Stack trace:
diff --git a/Zend/tests/dynamic_call_005.phpt b/Zend/tests/dynamic_call_005.phpt
index 840e298b82..91d1cb914c 100644
--- a/Zend/tests/dynamic_call_005.phpt
+++ b/Zend/tests/dynamic_call_005.phpt
@@ -6,24 +6,31 @@ Dynamic calls to scope introspection functions are forbidden
function test_calls($func) {
$i = 1;
- array_map($func, [['i' => new stdClass]]);
- var_dump($i);
+ try {
+ array_map($func, [['i' => new stdClass]]);
+ var_dump($i);
+ } catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+ }
- $func(['i' => new stdClass]);
- var_dump($i);
+ try {
+ $func(['i' => new stdClass]);
+ var_dump($i);
+ } catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+ }
- call_user_func($func, ['i' => new stdClass]);
- var_dump($i);
+ try {
+ call_user_func($func, ['i' => new stdClass]);
+ var_dump($i);
+ } catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+ }
}
test_calls('extract');
?>
---EXPECTF--
-Warning: Cannot call extract() dynamically in %s on line %d
-int(1)
-
-Warning: Cannot call extract() dynamically in %s on line %d
-int(1)
-
-Warning: Cannot call extract() dynamically in %s on line %d
-int(1)
+--EXPECT--
+Cannot call extract() dynamically
+Cannot call extract() dynamically
+Cannot call extract() dynamically
diff --git a/Zend/tests/dynamic_call_006.phpt b/Zend/tests/dynamic_call_006.phpt
index 058e22fda0..e6ea719158 100644
--- a/Zend/tests/dynamic_call_006.phpt
+++ b/Zend/tests/dynamic_call_006.phpt
@@ -3,46 +3,56 @@ Dynamic calls to scope introspection functions are forbidden (function variation
--FILE--
<?php
function test() {
- $func = 'extract';
- $func(['a' => 'b']);
- $func = 'compact';
- $func(['a']);
-
- $func = 'parse_str';
- $func('a=b');
-
- $func = 'get_defined_vars';
- $func();
-
- $func = 'assert';
- $func('1==2');
-
- $func = 'func_get_args';
- $func();
-
- $func = 'func_get_arg';
- $func(1);
-
- $func = 'func_num_args';
- $func();
+ try {
+ $func = 'extract';
+ $func(['a' => 'b']);
+ } catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+ }
+
+ try {
+ $func = 'compact';
+ $func(['a']);
+ } catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+ }
+
+ try {
+ $func = 'get_defined_vars';
+ $func();
+ } catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+ }
+
+ try {
+ $func = 'func_get_args';
+ $func();
+ } catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+ }
+
+ try {
+ $func = 'func_get_arg';
+ $func(1);
+ } catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+ }
+
+ try {
+ $func = 'func_num_args';
+ $func();
+ } catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+ }
}
test();
?>
---EXPECTF--
-Warning: Cannot call extract() dynamically in %s on line %d
-
-Warning: Cannot call compact() dynamically in %s on line %d
-
-Warning: Cannot call parse_str() with a single argument dynamically in %s on line %d
-
-Warning: Cannot call get_defined_vars() dynamically in %s on line %d
-
-Warning: Cannot call assert() with string argument dynamically in %s on line %d
-
-Warning: Cannot call func_get_args() dynamically in %s on line %d
-
-Warning: Cannot call func_get_arg() dynamically in %s on line %d
-
-Warning: Cannot call func_num_args() dynamically in %s on line %d
+--EXPECT--
+Cannot call extract() dynamically
+Cannot call compact() dynamically
+Cannot call get_defined_vars() dynamically
+Cannot call func_get_args() dynamically
+Cannot call func_get_arg() dynamically
+Cannot call func_num_args() dynamically
diff --git a/Zend/tests/dynamic_call_007.phpt b/Zend/tests/dynamic_call_007.phpt
index 61ae182914..f1312b95b4 100644
--- a/Zend/tests/dynamic_call_007.phpt
+++ b/Zend/tests/dynamic_call_007.phpt
@@ -5,13 +5,17 @@ Dynamic calls to scope introspection functions are forbidden (misoptimization)
function test() {
$i = 1;
- array_map('extract', [['i' => new stdClass]]);
+ try {
+ array_map('extract', [['i' => new stdClass]]);
+ } catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+ }
$i += 1;
var_dump($i);
}
test();
?>
---EXPECTF--
-Warning: Cannot call extract() dynamically in %s on line %d
+--EXPECT--
+Cannot call extract() dynamically
int(2)
diff --git a/Zend/tests/dynamic_call_008.phpt b/Zend/tests/dynamic_call_008.phpt
index 24240472d1..1916bcf913 100644
--- a/Zend/tests/dynamic_call_008.phpt
+++ b/Zend/tests/dynamic_call_008.phpt
@@ -4,10 +4,14 @@ Don't optimize dynamic call to non-dynamic one if it drops the warning
<?php
function test() {
- ((string) 'extract')(['a' => 42]);
+ try {
+ ((string) 'extract')(['a' => 42]);
+ } catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+ }
}
test();
?>
---EXPECTF--
-Warning: Cannot call extract() dynamically in %s on line %d
+--EXPECT--
+Cannot call extract() dynamically
diff --git a/Zend/tests/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_prop_name_leak.phpt b/Zend/tests/dynamic_prop_name_leak.phpt
new file mode 100644
index 0000000000..093a42400d
--- /dev/null
+++ b/Zend/tests/dynamic_prop_name_leak.phpt
@@ -0,0 +1,13 @@
+--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/entry_block_with_predecessors.phpt b/Zend/tests/entry_block_with_predecessors.phpt
index ffc3147f1c..45c3302fc0 100644
--- a/Zend/tests/entry_block_with_predecessors.phpt
+++ b/Zend/tests/entry_block_with_predecessors.phpt
@@ -28,6 +28,6 @@ test2();
?>
--EXPECTF--
-Notice: Undefined variable: a in %s on line %d
+Warning: Undefined variable: a in %s on line %d
int(1)
int(2)
diff --git a/Zend/tests/errmsg_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..6346868679 100644
--- a/Zend/tests/errmsg_013.phpt
+++ b/Zend/tests/errmsg_013.phpt
@@ -4,11 +4,11 @@ errmsg: default value for parameters with array type can only be an array or NUL
<?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..ceac72c5d2 100644
--- a/Zend/tests/errmsg_015.phpt
+++ b/Zend/tests/errmsg_015.phpt
@@ -4,8 +4,8 @@ errmsg: __clone() cannot accept any arguments
<?php
class test {
- function __clone($var) {
- }
+ function __clone($var) {
+ }
}
echo "Done\n";
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..5f6ab0f08f 100644
--- a/Zend/tests/errmsg_019.phpt
+++ b/Zend/tests/errmsg_019.phpt
@@ -4,8 +4,8 @@ errmsg: __destruct() cannot take arguments
<?php
class test {
- function __destruct($var) {
- }
+ function __destruct($var) {
+ }
}
echo "Done\n";
diff --git a/Zend/tests/errmsg_022.phpt b/Zend/tests/errmsg_022.phpt
index aba8d750c6..068ce147f3 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: Cannot pass parameter 1 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..20c2762a32 100644
--- a/Zend/tests/errmsg_032.phpt
+++ b/Zend/tests/errmsg_032.phpt
@@ -5,8 +5,8 @@ errmsg: __construct() cannot be static
class test {
- static function __construct() {
- }
+ static function __construct() {
+ }
}
echo "Done\n";
diff --git a/Zend/tests/errmsg_033.phpt b/Zend/tests/errmsg_033.phpt
index e5f36912b0..72b1490ea5 100644
--- a/Zend/tests/errmsg_033.phpt
+++ b/Zend/tests/errmsg_033.phpt
@@ -5,8 +5,8 @@ errmsg: __destruct() cannot be static
class test {
- static function __destruct() {
- }
+ static function __destruct() {
+ }
}
echo "Done\n";
diff --git a/Zend/tests/errmsg_034.phpt b/Zend/tests/errmsg_034.phpt
index a8bfc80b9a..940754ad7b 100644
--- a/Zend/tests/errmsg_034.phpt
+++ b/Zend/tests/errmsg_034.phpt
@@ -5,8 +5,8 @@ errmsg: __clone() cannot be static
class test {
- static function __clone() {
- }
+ static function __clone() {
+ }
}
echo "Done\n";
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..8ecee5ca3b 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(76) "The magic method __invoke() must have public visibility and cannot be static"
string(%d) "%s(%d) : eval()'d code"
-Notice: Undefined variable: undefined in %s on line %d
+Warning: Undefined variable: undefined in %s on line %d
diff --git a/Zend/tests/error_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..c21b363113 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..8a70e7d17b 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..77b3914e7a 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..3b6d3cb487 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..216365a3a1 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/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..4f5d07c7cf 100644
--- a/Zend/tests/exception_013.phpt
+++ b/Zend/tests/exception_013.phpt
@@ -3,25 +3,25 @@ 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);
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..260cfbd8e2 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: Argument 1 passed to foo() must be callable, string given, called in %s on line %d and defined in %s:%d
+Stack trace:
+#0 %s(%d): foo('C::foo')
+#1 {main}
-Exception: Argument 1 passed to foo() must be callable, string given, called in %s on line %d
-Fatal error: Uncaught Error: Cannot call abstract method C::foo() in %sexception_017.php:%d
+Fatal error: Uncaught Error: Cannot call abstract method C::foo() in %s:%d
Stack trace:
#0 {main}
- thrown in %sexception_017.php on line %d
+ thrown in %s on line %d
diff --git a/Zend/tests/exception_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_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..6552141b73 100644
--- a/Zend/tests/exception_handler_004.phpt
+++ b/Zend/tests/exception_handler_004.phpt
@@ -5,8 +5,6 @@ exception handler tests - 4
set_exception_handler("fo");
set_exception_handler(array("", ""));
-set_exception_handler();
-set_exception_handler("foo", "bar");
echo "Done\n";
?>
@@ -14,8 +12,4 @@ echo "Done\n";
Warning: set_exception_handler() expects the argument (fo) to be a valid callback in %s on line %d
Warning: set_exception_handler() expects the argument (::) to be a valid callback in %s on line %d
-
-Warning: set_exception_handler() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: set_exception_handler() expects exactly 1 parameter, 2 given in %s on line %d
Done
diff --git a/Zend/tests/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/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_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..bc1d8bbc71 100644
--- a/Zend/tests/foreach_undefined.phpt
+++ b/Zend/tests/foreach_undefined.phpt
@@ -8,7 +8,7 @@ foreach($a as $val);
echo "Done\n";
?>
--EXPECTF--
-Notice: Undefined variable: a in %s on line %d
+Warning: Undefined variable: a in %s on line %d
Warning: Invalid argument supplied for foreach() in %s on line %d
Done
diff --git a/Zend/tests/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/function_arguments/argument_count_incorrect_internal.phpt b/Zend/tests/function_arguments/argument_count_incorrect_internal.phpt
index a8ba71c0bf..5c0770ff65 100644
--- a/Zend/tests/function_arguments/argument_count_incorrect_internal.phpt
+++ b/Zend/tests/function_arguments/argument_count_incorrect_internal.phpt
@@ -2,9 +2,10 @@
Call internal function with incorrect number of arguments
--FILE--
<?php
-substr("foo");
-array_diff([]);
---EXPECTF--
-Warning: substr() expects at least 2 parameters, 1 given in %s
-
-Warning: array_diff(): at least 2 parameters are required, 1 given in %s
+try {
+ substr("foo");
+} catch (ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
+--EXPECT--
+substr() expects at least 2 parameters, 1 given
diff --git a/Zend/tests/function_arguments/argument_count_incorrect_internal_strict.phpt b/Zend/tests/function_arguments/argument_count_incorrect_internal_strict.phpt
index 8775bece88..33337bb908 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,20 @@ 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
+ArgumentCountError
+At least 2 parameters are required, 1 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..1e7969b44c 100644
--- a/Zend/tests/function_arguments/argument_count_incorrect_userland.phpt
+++ b/Zend/tests/function_arguments/argument_count_incorrect_userland.phpt
@@ -3,35 +3,35 @@ 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
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..e47d03d5f6 100644
--- a/Zend/tests/function_arguments/argument_count_incorrect_userland_strict.phpt
+++ b/Zend/tests/function_arguments/argument_count_incorrect_userland_strict.phpt
@@ -4,42 +4,42 @@ 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
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..025a4a7d41 100644
--- a/Zend/tests/function_exists_basic.phpt
+++ b/Zend/tests/function_exists_basic.phpt
@@ -24,11 +24,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 +35,3 @@ User defined function: bool(true)
Case sensitivity: bool(true)
Non existent function: bool(false)
Method: bool(false)
-===Done===
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..409d2d8f16 100644
--- a/Zend/tests/gc_012.phpt
+++ b/Zend/tests/gc_012.phpt
@@ -6,8 +6,8 @@ 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);
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..3f1b0f0187 100644
--- a/Zend/tests/gc_023.phpt
+++ b/Zend/tests/gc_023.phpt
@@ -6,16 +6,16 @@ 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
diff --git a/Zend/tests/gc_027.phpt b/Zend/tests/gc_027.phpt
index d499cc314a..7f94b82e81 100644
--- a/Zend/tests/gc_027.phpt
+++ b/Zend/tests/gc_027.phpt
@@ -5,9 +5,9 @@ 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--
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..56b4aae866 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;
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_038.phpt b/Zend/tests/gc_038.phpt
index 737025ae2d..d3219531d6 100644
--- a/Zend/tests/gc_038.phpt
+++ b/Zend/tests/gc_038.phpt
@@ -5,115 +5,115 @@ 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;
+ @$x += 5;
+ $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;
+ @$x -= 5;
+ $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;
+ @$x *= 5;
+ $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;
+ @$x /= 5;
+ $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;
+ @$x %= 5;
+ $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;
+ @$x <<= 5;
+ $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;
+ @$x >>= 5;
+ $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;
+ @$x |= 1;
+ $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;
+ @$x &= 1;
+ $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;
+ @$x ^= 1;
+ $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;
+ @$x **= 1;
+ $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();
?>
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/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..df62fcebe2 100644
--- a/Zend/tests/generators/bug63066.phpt
+++ b/Zend/tests/generators/bug63066.phpt
@@ -4,12 +4,12 @@ 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
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/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/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_2.phpt b/Zend/tests/generators/generator_with_type_check_2.phpt
index ba1216224c..d4ebbd2ad3 100644
--- a/Zend/tests/generators/generator_with_type_check_2.phpt
+++ b/Zend/tests/generators/generator_with_type_check_2.phpt
@@ -4,15 +4,15 @@ 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";
}
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/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..abf9a3c894 100644
--- a/Zend/tests/generators/throw_not_an_exception.phpt
+++ b/Zend/tests/generators/throw_not_an_exception.phpt
@@ -12,9 +12,8 @@ $gen->throw(new stdClass);
?>
--EXPECTF--
-Fatal error: Uncaught Error: Cannot throw objects that do not implement Throwable in %s:%d
+Fatal error: Uncaught TypeError: Generator::throw() expects parameter 1 to be Throwable, object given in %s:%d
Stack trace:
-#0 [internal function]: gen()
-#1 %s(%d): Generator->throw(Object(stdClass))
-#2 {main}
+#0 %s(%d): Generator->throw(Object(stdClass))
+#1 {main}
thrown in %s on line %d
diff --git a/Zend/tests/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_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_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_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 9bec138149..a8fd195bd6 100644
--- a/Zend/tests/generators/yield_from_multi_tree.phpt
+++ b/Zend/tests/generators/yield_from_multi_tree.phpt
@@ -4,41 +4,41 @@ 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) {
- if ($level % 2) {
- yield $gen->current();
- }
- yield from $gen;
+ if ($level % 2) {
+ yield $gen->current();
+ }
+ 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_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_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..a5939ccd5f 100644
--- a/Zend/tests/get_class_vars_001.phpt
+++ b/Zend/tests/get_class_vars_001.phpt
@@ -4,15 +4,15 @@ 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;
}
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..3ba411bff5 100644
--- a/Zend/tests/get_defined_functions_basic.phpt
+++ b/Zend/tests/get_defined_functions_basic.phpt
@@ -16,44 +16,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_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/globals_001.phpt b/Zend/tests/globals_001.phpt
index 9a9c5401fe..821f345b81 100644
--- a/Zend/tests/globals_001.phpt
+++ b/Zend/tests/globals_001.phpt
@@ -29,6 +29,6 @@ string(%d) "%s"
Notice: Undefined index: PHP_SELF in %s on line %d
NULL
-Notice: Undefined variable: _SERVER in %s on line %d
+Warning: Undefined variable: _SERVER in %s on line %d
NULL
Done
diff --git a/Zend/tests/globals_002.phpt b/Zend/tests/globals_002.phpt
index d57e350092..b8f2dadd4d 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();
@@ -32,6 +32,6 @@ string(%d) "%s"
Notice: Undefined index: PHP_SELF in %s on line %d
NULL
-Notice: Undefined variable: _SERVER in %s on line %d
+Warning: Undefined variable: _SERVER in %s on line %d
NULL
Done
diff --git a/Zend/tests/globals_003.phpt b/Zend/tests/globals_003.phpt
index cdd4d211af..d7a175389e 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();
@@ -38,6 +38,6 @@ string(%d) "%s"
Notice: Undefined index: PHP_SELF in %s on line %d
NULL
-Notice: Undefined variable: _SERVER in %s on line %d
+Warning: Undefined variable: _SERVER in %s on line %d
NULL
Done
diff --git a/Zend/tests/globals_004.phpt b/Zend/tests/globals_004.phpt
index 0f2f7f0764..4aaf2438d7 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();
@@ -23,6 +23,6 @@ string(%d) "%s"
Notice: Undefined index: PHP_SELF in %s on line %d
NULL
-Notice: Undefined variable: _SERVER in %s on line %d
+Warning: Undefined variable: _SERVER in %s on line %d
NULL
Done
diff --git a/Zend/tests/grammar/regression_001.phpt b/Zend/tests/grammar/regression_001.phpt
index 657b36b853..d559c555e8 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,11 +13,11 @@ Foo::
function();
Foo::
- function();
+ function();
Foo::
- function(
+ function(
);
diff --git a/Zend/tests/halt03.phpt b/Zend/tests/halt03.phpt
index 6e0931b02f..deacebe4ab 100644
--- a/Zend/tests/halt03.phpt
+++ b/Zend/tests/halt03.phpt
@@ -4,7 +4,7 @@ __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..f0a5323e66 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==
diff --git a/Zend/tests/halt_compiler5.phpt b/Zend/tests/halt_compiler5.phpt
index 71d973e4f7..51167b6c3b 100644
--- a/Zend/tests/halt_compiler5.phpt
+++ b/Zend/tests/halt_compiler5.phpt
@@ -5,4 +5,7 @@ Using __COMPILER_HALF_OFFSET__ with trailing {} (OSS-Fuzz #17895)
__COMPILER_HALT_OFFSET__;
{}
--EXPECTF--
-Warning: Use of undefined constant __COMPILER_HALT_OFFSET__ - assumed '__COMPILER_HALT_OFFSET__' (this will throw an Error in a future version of PHP) in %s on line %d
+Fatal error: Uncaught Error: Undefined constant '__COMPILER_HALT_OFFSET__' in %s:%d
+Stack trace:
+#0 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/hex_overflow_32bit.phpt b/Zend/tests/hex_overflow_32bit.phpt
index 529757dd56..4d4e95818c 100644
--- a/Zend/tests/hex_overflow_32bit.phpt
+++ b/Zend/tests/hex_overflow_32bit.phpt
@@ -8,15 +8,15 @@ precision=14
<?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..932885bd66 100644
--- a/Zend/tests/include_stat_is_quiet.phpt
+++ b/Zend/tests/include_stat_is_quiet.phpt
@@ -25,6 +25,6 @@ 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
diff --git a/Zend/tests/incompat_ctx_user.phpt b/Zend/tests/incompat_ctx_user.phpt
index 25c95ba219..8c7461e4f7 100644
--- a/Zend/tests/incompat_ctx_user.phpt
+++ b/Zend/tests/incompat_ctx_user.phpt
@@ -4,18 +4,17 @@ Incompatible context call (non-internal function)
<?php
class A {
- function foo() { var_dump(get_class($this)); }
+ function foo() { var_dump(get_class($this)); }
}
class B {
- function bar() { A::foo(); }
+ function bar() { A::foo(); }
}
$b = new B;
try {
- $b->bar();
+ $b->bar();
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
?>
--EXPECTF--
-Deprecated: Non-static method A::foo() should not be called statically in %s on line %d
-Exception: Using $this when not in object context
+Exception: Non-static method A::foo() cannot be called statically
diff --git a/Zend/tests/increment_001.phpt b/Zend/tests/increment_001.phpt
index 16323381b8..92f32bb657 100644
--- a/Zend/tests/increment_001.phpt
+++ b/Zend/tests/increment_001.phpt
@@ -8,26 +8,26 @@ 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);
+ $var++;
+ var_dump($var);
}
echo "Done\n";
diff --git a/Zend/tests/indexing_001.phpt b/Zend/tests/indexing_001.phpt
index f247a420b5..5a5fbef054 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"]=>
@@ -66,15 +77,18 @@ array(1) {
Warning: Illegal string offset 'foo' in %s on line %d
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
+
+Warning: Only the first byte will be assigned to the string offset in %s on line %d
string(1) "A"
Warning: Illegal string offset 'foo' in %s on line %d
-Notice: Array to string conversion in %s on line %d
-string(1) "A"
+Warning: Array to string conversion in %s on line %d
-Warning: Cannot use a scalar value as an array in %s on line %d
+Warning: Only the first byte will be assigned to the string offset in %s on line %d
+string(1) "A"
+Cannot use a scalar value as an array
float(0.1)
array(1) {
["foo"]=>
@@ -92,14 +106,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 +119,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 +136,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 +149,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 +167,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 +180,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 +189,3 @@ array(1) {
int(1)
}
}
-
-Done
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_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..ffa5cdbf89 100644
--- a/Zend/tests/inference_infinite_loop.phpt
+++ b/Zend/tests/inference_infinite_loop.phpt
@@ -14,4 +14,4 @@ test();
?>
--EXPECTF--
-Notice: Undefined variable: a in %s on line %d
+Warning: Undefined variable: a in %s on line %d
diff --git a/Zend/tests/instanceof.phpt b/Zend/tests/instanceof.phpt
index 97d67ff567..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..27170420f0 100644
--- a/Zend/tests/instanceof_001.phpt
+++ b/Zend/tests/instanceof_001.phpt
@@ -8,7 +8,7 @@ var_dump($a instanceof stdClass);
var_dump(new stdCLass instanceof stdClass);
-$b = create_function('', 'return new stdClass;');
+$b = function() { return new stdClass; };
var_dump($b() instanceof stdClass);
$c = array(new stdClass);
@@ -20,8 +20,6 @@ var_dump(@$inexistent instanceof stdClass);
--EXPECTF--
bool(true)
bool(true)
-
-Deprecated: Function create_function() is deprecated in %s on line %d
bool(true)
bool(true)
bool(false)
diff --git a/Zend/tests/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_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/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..7b29c1e6b8 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: Trying to get property '' of non-object 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/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..62bcaef823 100644
--- a/Zend/tests/jump17.phpt
+++ b/Zend/tests/jump17.phpt
@@ -4,18 +4,18 @@ 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--
diff --git a/Zend/tests/list_keyed_conversions.phpt b/Zend/tests/list_keyed_conversions.phpt
index bf0349b327..1dd48de9f2 100644
--- a/Zend/tests/list_keyed_conversions.phpt
+++ b/Zend/tests/list_keyed_conversions.phpt
@@ -29,6 +29,6 @@ int(1)
int(0)
int(1)
-Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
+Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
Notice: Undefined offset: 1 in %s on line %d
diff --git a/Zend/tests/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_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_022.phpt b/Zend/tests/lsb_022.phpt
index 016fde83c9..da918f8b26 100644
--- a/Zend/tests/lsb_022.phpt
+++ b/Zend/tests/lsb_022.phpt
@@ -3,24 +3,24 @@ 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--
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..fdbb97be40 100644
--- a/Zend/tests/magic_methods_002.phpt
+++ b/Zend/tests/magic_methods_002.phpt
@@ -4,9 +4,9 @@ Testing __unset with private visibility
<?php
class foo {
- private function __unset($a) {
- print "unset\n";
- }
+ private function __unset($a) {
+ print "unset\n";
+ }
}
?>
diff --git a/Zend/tests/magic_methods_003.phpt b/Zend/tests/magic_methods_003.phpt
index 7e965ba3fd..cd96d15b2f 100644
--- a/Zend/tests/magic_methods_003.phpt
+++ b/Zend/tests/magic_methods_003.phpt
@@ -4,9 +4,9 @@ Testing __unset declaring as static
<?php
class foo {
- static function __unset($a) {
- print "unset\n";
- }
+ static function __unset($a) {
+ print "unset\n";
+ }
}
?>
diff --git a/Zend/tests/magic_methods_004.phpt b/Zend/tests/magic_methods_004.phpt
index 8caf5d4aa1..3c1df73d09 100644
--- a/Zend/tests/magic_methods_004.phpt
+++ b/Zend/tests/magic_methods_004.phpt
@@ -4,9 +4,9 @@ Testing __unset() with protected visibility
<?php
class foo {
- protected function __unset($a) {
- print "unset\n";
- }
+ protected function __unset($a) {
+ print "unset\n";
+ }
}
?>
diff --git a/Zend/tests/magic_methods_005.phpt b/Zend/tests/magic_methods_005.phpt
index 76ab30087e..8e7749381c 100644
--- a/Zend/tests/magic_methods_005.phpt
+++ b/Zend/tests/magic_methods_005.phpt
@@ -4,7 +4,7 @@ Testing __call() declaration in interface with wrong modifier
<?php
interface a {
- static function __call($a, $b);
+ static function __call($a, $b);
}
?>
diff --git a/Zend/tests/magic_methods_006.phpt b/Zend/tests/magic_methods_006.phpt
index 2e84a41c5c..68eac7439d 100644
--- a/Zend/tests/magic_methods_006.phpt
+++ b/Zend/tests/magic_methods_006.phpt
@@ -4,7 +4,7 @@ Testing __callstatic declaration in interface with missing the 'static' modifier
<?php
interface a {
- function __callstatic($a, $b);
+ function __callstatic($a, $b);
}
?>
diff --git a/Zend/tests/magic_methods_007.phpt b/Zend/tests/magic_methods_007.phpt
index 0630c63e9f..63f4cadff5 100644
--- a/Zend/tests/magic_methods_007.phpt
+++ b/Zend/tests/magic_methods_007.phpt
@@ -4,7 +4,7 @@ Testing __set() declaration in abstract class with wrong modifier
<?php
abstract class b {
- abstract protected function __set($a);
+ abstract protected function __set($a);
}
?>
diff --git a/Zend/tests/magic_methods_008.phpt b/Zend/tests/magic_methods_008.phpt
index 25731516e6..7d7a839afe 100644
--- a/Zend/tests/magic_methods_008.phpt
+++ b/Zend/tests/magic_methods_008.phpt
@@ -4,12 +4,12 @@ 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) {
+ }
}
?>
diff --git a/Zend/tests/magic_methods_009.phpt b/Zend/tests/magic_methods_009.phpt
index 2b514c3bff..ff609ce452 100644
--- a/Zend/tests/magic_methods_009.phpt
+++ b/Zend/tests/magic_methods_009.phpt
@@ -4,8 +4,8 @@ Testing __callstatic declaration with wrong modifier
<?php
class a {
- static protected function __callstatic($a, $b) {
- }
+ static protected function __callstatic($a, $b) {
+ }
}
?>
diff --git a/Zend/tests/magic_methods_010.phpt b/Zend/tests/magic_methods_010.phpt
index 06d46dbd28..8ec3f23e61 100644
--- a/Zend/tests/magic_methods_010.phpt
+++ b/Zend/tests/magic_methods_010.phpt
@@ -4,8 +4,8 @@ Testing __toString() declaration with wrong modifier
<?php
class a {
- static protected function __toString($a, $b) {
- }
+ static protected function __toString($a, $b) {
+ }
}
?>
diff --git a/Zend/tests/method_argument_binding.phpt b/Zend/tests/method_argument_binding.phpt
index dea12621a3..32acd93c63 100644
--- a/Zend/tests/method_argument_binding.phpt
+++ b/Zend/tests/method_argument_binding.phpt
@@ -43,4 +43,4 @@ class E extends D {
--EXPECTF--
int(2)
-Notice: Undefined variable: x in %s on line %d
+Warning: Undefined variable: x in %s on line %d
diff --git a/Zend/tests/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/methods-on-non-objects-call-user-func.phpt b/Zend/tests/methods-on-non-objects-call-user-func.phpt
index 027aa64c20..63884abc79 100644
--- a/Zend/tests/methods-on-non-objects-call-user-func.phpt
+++ b/Zend/tests/methods-on-non-objects-call-user-func.phpt
@@ -2,11 +2,12 @@
call_user_func() in combination with "Call to a member function method() on a non-object"
--FILE--
<?php
-$comparator= null;
-var_dump(call_user_func([$comparator, 'compare'], 1, 2));
-echo "Alive\n";
+$comparator = null;
+try {
+ var_dump(call_user_func([$comparator, 'compare'], 1, 2));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Warning: call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in %s on line %d
-NULL
-Alive
+--EXPECT--
+call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object
diff --git a/Zend/tests/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..a393a43644 100644
--- a/Zend/tests/mod_001.phpt
+++ b/Zend/tests/mod_001.phpt
@@ -10,7 +10,7 @@ try {
$c = $a % $b;
var_dump($c);
} catch (DivisionByZeroError $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
echo "Done\n";
diff --git a/Zend/tests/mul_001.phpt b/Zend/tests/mul_001.phpt
index ea587902d0..b57c61776c 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;
diff --git a/Zend/tests/multibyte/bug68665.phpt b/Zend/tests/multibyte/bug68665.phpt
index 6846776570..f770118ad4 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");
}
@@ -17,7 +14,5 @@ internal_encoding=big5
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/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/not_002.phpt b/Zend/tests/not_002.phpt
index 11efcaa2ea..38691a1a51 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;
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_010.phpt b/Zend/tests/ns_010.phpt
index e0ccd349ed..9364f89a12 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();
diff --git a/Zend/tests/ns_013.phpt b/Zend/tests/ns_013.phpt
index ef73b1395f..063e27930c 100644
--- a/Zend/tests/ns_013.phpt
+++ b/Zend/tests/ns_013.phpt
@@ -5,7 +5,7 @@
namespace test\ns1;
function strlen($x) {
- return __FUNCTION__;
+ return __FUNCTION__;
}
echo strlen("Hello"),"\n";
diff --git a/Zend/tests/ns_015.phpt b/Zend/tests/ns_015.phpt
index 405d3e4518..7c954c2af3 100644
--- a/Zend/tests/ns_015.phpt
+++ b/Zend/tests/ns_015.phpt
@@ -5,7 +5,7 @@
namespace test\ns1;
function strlen($x) {
- return __FUNCTION__;
+ return __FUNCTION__;
}
echo \strlen("Hello"),"\n";
diff --git a/Zend/tests/ns_016.phpt b/Zend/tests/ns_016.phpt
index bee8b5bee3..19942cfacf 100644
--- a/Zend/tests/ns_016.phpt
+++ b/Zend/tests/ns_016.phpt
@@ -5,7 +5,7 @@
namespace test\ns1;
function strlen($x) {
- return __FUNCTION__;
+ return __FUNCTION__;
}
$x = "test\\ns1\\strlen";
diff --git a/Zend/tests/ns_017.phpt b/Zend/tests/ns_017.phpt
index d48afd5f01..1cb8ac2eb5 100644
--- a/Zend/tests/ns_017.phpt
+++ b/Zend/tests/ns_017.phpt
@@ -5,7 +5,7 @@
namespace test\ns1;
function strlen($x) {
- return __FUNCTION__;
+ return __FUNCTION__;
}
$x = "strlen";
diff --git a/Zend/tests/ns_018.phpt b/Zend/tests/ns_018.phpt
index 9ad2fb89b5..2ef8d104f2 100644
--- a/Zend/tests/ns_018.phpt
+++ b/Zend/tests/ns_018.phpt
@@ -5,7 +5,7 @@
namespace test;
function foo() {
- return __FUNCTION__;
+ return __FUNCTION__;
}
$x = __NAMESPACE__ . "\\foo";
diff --git a/Zend/tests/ns_019.phpt b/Zend/tests/ns_019.phpt
index 91aea33e10..1fa1e227ba 100644
--- a/Zend/tests/ns_019.phpt
+++ b/Zend/tests/ns_019.phpt
@@ -3,7 +3,7 @@
--FILE--
<?php
function foo() {
- return __FUNCTION__;
+ return __FUNCTION__;
}
$x = __NAMESPACE__ . "\\foo";
diff --git a/Zend/tests/ns_020.phpt b/Zend/tests/ns_020.phpt
index 5a391771e9..7915683d6a 100644
--- a/Zend/tests/ns_020.phpt
+++ b/Zend/tests/ns_020.phpt
@@ -5,7 +5,7 @@
namespace X;
use X as Y;
function foo() {
- echo __FUNCTION__,"\n";
+ echo __FUNCTION__,"\n";
}
foo();
\X\foo();
diff --git a/Zend/tests/ns_021.phpt b/Zend/tests/ns_021.phpt
index 405468399f..5c160e7d07 100644
--- a/Zend/tests/ns_021.phpt
+++ b/Zend/tests/ns_021.phpt
@@ -5,13 +5,13 @@
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();
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..bcddaa0a7c 100644
--- a/Zend/tests/ns_022.phpt
+++ b/Zend/tests/ns_022.phpt
@@ -9,7 +9,7 @@ use a\b\c as test;
require "ns_022.inc";
function foo() {
- echo __FUNCTION__,"\n";
+ echo __FUNCTION__,"\n";
}
test\foo();
diff --git a/Zend/tests/ns_025.phpt b/Zend/tests/ns_025.phpt
index 917a710d95..44e90de5d1 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";
}
}
diff --git a/Zend/tests/ns_026.phpt b/Zend/tests/ns_026.phpt
index 530e135230..83bbf618f9 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";
}
}
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..9035b4ecd2 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";
}
}
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..37abf5064d 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";
}
}
diff --git a/Zend/tests/ns_031.phpt b/Zend/tests/ns_031.phpt
index 840c08621c..0459ee207e 100644
--- a/Zend/tests/ns_031.phpt
+++ b/Zend/tests/ns_031.phpt
@@ -5,13 +5,13 @@
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");
diff --git a/Zend/tests/ns_032.phpt b/Zend/tests/ns_032.phpt
index 5717a33685..290afe141e 100644
--- a/Zend/tests/ns_032.phpt
+++ b/Zend/tests/ns_032.phpt
@@ -3,13 +3,13 @@
--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");
diff --git a/Zend/tests/ns_034.phpt b/Zend/tests/ns_034.phpt
index 76775f1180..bba26b3baa 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;
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..db649d6739 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();
diff --git a/Zend/tests/ns_039.phpt b/Zend/tests/ns_039.phpt
index c5e79e48c5..fa40d9b016 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;
diff --git a/Zend/tests/ns_040.phpt b/Zend/tests/ns_040.phpt
index 42a3ac07e9..f5b9942c12 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;
diff --git a/Zend/tests/ns_041.phpt b/Zend/tests/ns_041.phpt
index bd9dfbd093..3a2fe7758b 100644
--- a/Zend/tests/ns_041.phpt
+++ b/Zend/tests/ns_041.phpt
@@ -17,5 +17,7 @@ ok
ok
ok
-Warning: Use of undefined constant BAR - assumed 'BAR' (this will throw an Error in a future version of PHP) in %sns_041.php on line 9
-BAR
+Fatal error: Uncaught Error: Undefined constant 'test\ns1\BAR' in %s:%d
+Stack trace:
+#0 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/ns_050.phpt b/Zend/tests/ns_050.phpt
index f827ec858d..e7cc750a2b 100644
--- a/Zend/tests/ns_050.phpt
+++ b/Zend/tests/ns_050.phpt
@@ -7,7 +7,7 @@ namespace test\ns1;
const INI_ALL = 0;
function foo($x = INI_ALL) {
- var_dump($x);
+ var_dump($x);
}
foo();
--EXPECT--
diff --git a/Zend/tests/ns_051.phpt b/Zend/tests/ns_051.phpt
index b95b53f78b..ee8c369a3c 100644
--- a/Zend/tests/ns_051.phpt
+++ b/Zend/tests/ns_051.phpt
@@ -5,7 +5,7 @@
namespace test\ns1;
function foo($x = INI_ALL) {
- var_dump($x);
+ var_dump($x);
}
foo();
--EXPECT--
diff --git a/Zend/tests/ns_052.phpt b/Zend/tests/ns_052.phpt
index cb0a05ff9f..06700d948d 100644
--- a/Zend/tests/ns_052.phpt
+++ b/Zend/tests/ns_052.phpt
@@ -7,7 +7,7 @@ namespace test\ns1;
const INI_ALL = 0;
function foo($x = \INI_ALL) {
- var_dump($x);
+ var_dump($x);
}
foo();
--EXPECT--
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..ad44d09d28 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;
diff --git a/Zend/tests/ns_058.phpt b/Zend/tests/ns_058.phpt
index 54e84aa030..6672d8a0b0 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;
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_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..7acdffba82 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);
diff --git a/Zend/tests/ns_072.phpt b/Zend/tests/ns_072.phpt
index 932a38b3ba..c422eedd4e 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 {
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_076.phpt b/Zend/tests/ns_076.phpt
index ea97e924b1..0db8aeba62 100644
--- a/Zend/tests/ns_076.phpt
+++ b/Zend/tests/ns_076.phpt
@@ -3,26 +3,28 @@
--FILE--
<?php
namespace foo;
+use Error;
-$a = array(unknown => unknown);
-
-echo unknown;
-echo "\n";
-var_dump($a);
-echo \unknown;
---EXPECTF--
-Warning: Use of undefined constant unknown - assumed 'unknown' (this will throw an Error in a future version of PHP) in %sns_076.php on line %d
+try {
+ $a = array(unknown => unknown);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
-Warning: Use of undefined constant unknown - assumed 'unknown' (this will throw an Error in a future version of PHP) in %sns_076.php on line %d
+try {
+ echo unknown;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
-Warning: Use of undefined constant unknown - assumed 'unknown' (this will throw an Error in a future version of PHP) in %sns_076.php on line %d
-unknown
-array(1) {
- ["unknown"]=>
- %s(7) "unknown"
+try {
+ echo \unknown;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
}
-Fatal error: Uncaught Error: Undefined constant 'unknown' in %sns_076.php:%d
-Stack trace:
-#0 {main}
- thrown in %sns_076.php on line %d
+?>
+--EXPECT--
+Undefined constant 'foo\unknown'
+Undefined constant 'foo\unknown'
+Undefined constant 'unknown'
diff --git a/Zend/tests/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..dca09caad1 100644
--- a/Zend/tests/ns_085.phpt
+++ b/Zend/tests/ns_085.phpt
@@ -5,14 +5,14 @@
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;
diff --git a/Zend/tests/ns_086.phpt b/Zend/tests/ns_086.phpt
index ed4b8a238c..292a2fd3bd 100644
--- a/Zend/tests/ns_086.phpt
+++ b/Zend/tests/ns_086.phpt
@@ -14,14 +14,14 @@ 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;
diff --git a/Zend/tests/ns_087.phpt b/Zend/tests/ns_087.phpt
index b2f0a89b22..6ada416a23 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,7 +13,7 @@ new bar;
$a = 'oops';
namespace {
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_094.phpt b/Zend/tests/ns_094.phpt
index a809437a1b..06947bb6dd 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
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/return_type_in_function.phpt b/Zend/tests/object_types/return_type_in_function.phpt
index dc7e0463fd..61f6845b47 100644
--- a/Zend/tests/object_types/return_type_in_function.phpt
+++ b/Zend/tests/object_types/return_type_in_function.phpt
@@ -4,7 +4,7 @@ Adding a function object return type
<?php
function a() : object {
- return 12345;
+ return 12345;
}
a();
--EXPECTF--
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..6ae7d57468 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..9a23522cb2 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_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..b5f063625e 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";
+ }
}
diff --git a/Zend/tests/objects_030.phpt b/Zend/tests/objects_030.phpt
index c42babc183..55ac88f886 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";
+ }
}
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/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/offset_array.phpt b/Zend/tests/offset_array.phpt
index a1d0a43c69..97b6a06b1c 100644
--- a/Zend/tests/offset_array.phpt
+++ b/Zend/tests/offset_array.phpt
@@ -17,10 +17,18 @@ $fp = fopen(__FILE__, "r");
var_dump($arr[$fp]);
$obj = new stdClass;
-var_dump($arr[$obj]);
+try {
+ var_dump($arr[$obj]);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
$arr1 = Array(1,2,3);
-var_dump($arr[$arr1]);
+try {
+ var_dump($arr[$arr1]);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done\n";
?>
@@ -36,12 +44,8 @@ NULL
int(2)
int(1)
-Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
+Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
int(%d)
-
-Warning: Illegal offset type in %s on line %d
-NULL
-
-Warning: Illegal offset type in %s on line %d
-NULL
+Illegal offset type
+Illegal offset type
Done
diff --git a/Zend/tests/offset_bool.phpt b/Zend/tests/offset_bool.phpt
index 8ed9f28e43..ae8df6d2b5 100644
--- a/Zend/tests/offset_bool.phpt
+++ b/Zend/tests/offset_bool.phpt
@@ -25,30 +25,30 @@ var_dump($bool[$arr]);
echo "Done\n";
?>
--EXPECTF--
-Notice: Trying to access array offset on value of type bool in %s on line %d
+Warning: Trying to access array offset on value of type bool in %s on line %d
NULL
-Notice: Trying to access array offset on value of type bool in %s on line %d
+Warning: Trying to access array offset on value of type bool in %s on line %d
NULL
-Notice: Trying to access array offset on value of type bool in %s on line %d
+Warning: Trying to access array offset on value of type bool in %s on line %d
NULL
-Notice: Trying to access array offset on value of type bool in %s on line %d
+Warning: Trying to access array offset on value of type bool in %s on line %d
NULL
-Notice: Trying to access array offset on value of type bool in %s on line %d
+Warning: Trying to access array offset on value of type bool in %s on line %d
NULL
-Notice: Trying to access array offset on value of type bool in %s on line %d
+Warning: Trying to access array offset on value of type bool in %s on line %d
NULL
-Notice: Trying to access array offset on value of type bool in %s on line %d
+Warning: Trying to access array offset on value of type bool in %s on line %d
NULL
-Notice: Trying to access array offset on value of type bool in %s on line %d
+Warning: Trying to access array offset on value of type bool in %s on line %d
NULL
-Notice: Trying to access array offset on value of type bool in %s on line %d
+Warning: Trying to access array offset on value of type bool in %s on line %d
NULL
Done
diff --git a/Zend/tests/offset_long.phpt b/Zend/tests/offset_long.phpt
index 4c6b3972d2..17dfe0d29b 100644
--- a/Zend/tests/offset_long.phpt
+++ b/Zend/tests/offset_long.phpt
@@ -25,30 +25,30 @@ var_dump($long[$arr]);
echo "Done\n";
?>
--EXPECTF--
-Notice: Trying to access array offset on value of type int in %s on line %d
+Warning: Trying to access array offset on value of type int in %s on line %d
NULL
-Notice: Trying to access array offset on value of type int in %s on line %d
+Warning: Trying to access array offset on value of type int in %s on line %d
NULL
-Notice: Trying to access array offset on value of type int in %s on line %d
+Warning: Trying to access array offset on value of type int in %s on line %d
NULL
-Notice: Trying to access array offset on value of type int in %s on line %d
+Warning: Trying to access array offset on value of type int in %s on line %d
NULL
-Notice: Trying to access array offset on value of type int in %s on line %d
+Warning: Trying to access array offset on value of type int in %s on line %d
NULL
-Notice: Trying to access array offset on value of type int in %s on line %d
+Warning: Trying to access array offset on value of type int in %s on line %d
NULL
-Notice: Trying to access array offset on value of type int in %s on line %d
+Warning: Trying to access array offset on value of type int in %s on line %d
NULL
-Notice: Trying to access array offset on value of type int in %s on line %d
+Warning: Trying to access array offset on value of type int in %s on line %d
NULL
-Notice: Trying to access array offset on value of type int in %s on line %d
+Warning: Trying to access array offset on value of type int in %s on line %d
NULL
Done
diff --git a/Zend/tests/offset_null.phpt b/Zend/tests/offset_null.phpt
index ad0b1f3049..ae02eece77 100644
--- a/Zend/tests/offset_null.phpt
+++ b/Zend/tests/offset_null.phpt
@@ -25,30 +25,30 @@ var_dump($null[$arr]);
echo "Done\n";
?>
--EXPECTF--
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
NULL
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
NULL
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
NULL
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
NULL
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
NULL
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
NULL
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
NULL
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
NULL
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
NULL
Done
diff --git a/Zend/tests/offset_string.phpt b/Zend/tests/offset_string.phpt
index 3ad48e7412..1a9667cb8f 100644
--- a/Zend/tests/offset_string.phpt
+++ b/Zend/tests/offset_string.phpt
@@ -17,23 +17,35 @@ var_dump($str[TRUE]);
var_dump($str[FALSE]);
$fp = fopen(__FILE__, "r");
-var_dump($str[$fp]);
+try {
+ var_dump($str[$fp]);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
$obj = new stdClass;
-var_dump($str[$obj]);
+try {
+ var_dump($str[$obj]);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
$arr = Array(1,2,3);
-var_dump($str[$arr]);
+try {
+ var_dump($str[$arr]);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done\n";
?>
--EXPECTF--
string(1) "i"
-Notice: String offset cast occurred in %s on line %d
+Warning: String offset cast occurred in %s on line %d
string(1) "S"
-Notice: String offset cast occurred in %s on line %d
+Warning: String offset cast occurred in %s on line %d
string(1) "S"
Warning: Illegal string offset 'run away' in %s on line %d
@@ -46,20 +58,14 @@ string(1) "o"
Notice: A non well formed numeric value encountered in %s on line %d
string(1) "r"
-Notice: String offset cast occurred in %s on line %d
+Warning: String offset cast occurred in %s on line %d
string(1) "i"
-Notice: String offset cast occurred in %s on line %d
+Warning: String offset cast occurred in %s on line %d
string(1) "S"
-
-Warning: Illegal offset type in %s on line %d
-string(1) "%s"
-
-Warning: Illegal offset type in %s on line %d
+Illegal offset type
Notice: Object of class stdClass could not be converted to int in %s on line %d
-string(1) "%s"
-
-Warning: Illegal offset type in %s on line %d
-string(1) "i"
+Illegal offset type
+Illegal offset type
Done
diff --git a/Zend/tests/overloaded_func_001.phpt b/Zend/tests/overloaded_func_001.phpt
index 31585d505a..7fc435f920 100644
--- a/Zend/tests/overloaded_func_001.phpt
+++ b/Zend/tests/overloaded_func_001.phpt
@@ -6,10 +6,10 @@ if (!extension_loaded('zend-test')) die('skip zend-test extension not loaded');
?>
--FILE--
<?php
+$o = new _ZendTestChildClass();
+var_dump($o->test());
var_dump(_ZendTestClass::test());
?>
---EXPECTF--
-Fatal error: Uncaught Error: Cannot call overloaded function for non-object in %soverloaded_func_001.php:%d
-Stack trace:
-#0 {main}
- thrown in %soverloaded_func_001.php on line %d
+--EXPECT--
+string(4) "test"
+string(4) "test"
diff --git a/Zend/tests/parse_str_with_unpack.phpt b/Zend/tests/parse_str_with_unpack.phpt
deleted file mode 100644
index 8daa711374..0000000000
--- a/Zend/tests/parse_str_with_unpack.phpt
+++ /dev/null
@@ -1,16 +0,0 @@
---TEST--
-Calling parse_str through argument unpacking
---FILE--
-<?php
-
-function test() {
- $i = 0;
- parse_str(...["i=41"]);
- var_dump($i + 1);
-}
-test();
-
-?>
---EXPECTF--
-Deprecated: parse_str(): Calling parse_str() without the result argument is deprecated in %s on line %d
-int(42)
diff --git a/Zend/tests/php_errormsg_misoptimization.phpt b/Zend/tests/php_errormsg_misoptimization.phpt
deleted file mode 100644
index ae389db248..0000000000
--- a/Zend/tests/php_errormsg_misoptimization.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-The variable $php_errormsg shouldn't be optimized as it may be unpredictably modified
---INI--
-track_errors=1
---FILE--
-<?php
-
-function test() {
- $php_errormsg = 1;
- echo $undef;
- var_dump($php_errormsg + 1);
-}
-test();
-
-?>
---EXPECTF--
-Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0
-
-Notice: Undefined variable: undef in %s on line %d
-
-Warning: A non-numeric value encountered in %s on line %d
-int(1)
diff --git a/Zend/tests/pow_array_leak.phpt b/Zend/tests/pow_array_leak.phpt
index e9165bbbc5..a17a290458 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(1) {
+ [0]=>
+ int(0)
+}
+Unsupported operand types
+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/result_unused.phpt b/Zend/tests/result_unused.phpt
index 12892e8415..95ae7a5a15 100644
--- a/Zend/tests/result_unused.phpt
+++ b/Zend/tests/result_unused.phpt
@@ -14,15 +14,15 @@ $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_types/014.phpt b/Zend/tests/return_types/014.phpt
index 655c5a9cc6..25bd79fb81 100644
--- a/Zend/tests/return_types/014.phpt
+++ b/Zend/tests/return_types/014.phpt
@@ -4,7 +4,7 @@ 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
diff --git a/Zend/tests/return_types/018.phpt b/Zend/tests/return_types/018.phpt
index 2512c6cf49..8c745a1f65 100644
--- a/Zend/tests/return_types/018.phpt
+++ b/Zend/tests/return_types/018.phpt
@@ -4,7 +4,7 @@ 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
diff --git a/Zend/tests/return_types/019.phpt b/Zend/tests/return_types/019.phpt
index 166b624563..4be32b2474 100644
--- a/Zend/tests/return_types/019.phpt
+++ b/Zend/tests/return_types/019.phpt
@@ -4,7 +4,7 @@ __clone cannot declare a return type
<?php
class Foo {
- function __clone() : Foo {}
+ function __clone() : Foo {}
}
--EXPECTF--
Fatal error: %s::%s() cannot declare a return type in %s on line %d
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/028.phpt b/Zend/tests/return_types/028.phpt
index 8ded158a82..5e69006af7 100644
--- a/Zend/tests/return_types/028.phpt
+++ b/Zend/tests/return_types/028.phpt
@@ -4,15 +4,15 @@ 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();
}
?>
diff --git a/Zend/tests/return_types/029.phpt b/Zend/tests/return_types/029.phpt
index adc07cde7f..5741763abb 100644
--- a/Zend/tests/return_types/029.phpt
+++ b/Zend/tests/return_types/029.phpt
@@ -6,11 +6,11 @@ opcache.enable=0
<?php
function foo() : array {
- try {
- throw new Exception("xxxx");
- } finally {
- return null;
- }
+ try {
+ throw new Exception("xxxx");
+ } finally {
+ return null;
+ }
}
foo();
diff --git a/Zend/tests/return_types/030.phpt b/Zend/tests/return_types/030.phpt
index fc41fa6ee6..8117a7d7ce 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([]);
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/bug70557.phpt b/Zend/tests/return_types/bug70557.phpt
index cb4eb498b9..5917197045 100644
--- a/Zend/tests/return_types/bug70557.phpt
+++ b/Zend/tests/return_types/bug70557.phpt
@@ -6,13 +6,13 @@ opcache.enable=0
<?php
function getNumber() : int {
- return "foo";
+ return "foo";
}
try {
- getNumber();
+ getNumber();
} catch (TypeError $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
?>
--EXPECT--
diff --git a/Zend/tests/return_types/bug71092.phpt b/Zend/tests/return_types/bug71092.phpt
index 1d4fe983b3..abc43356bc 100644
--- a/Zend/tests/return_types/bug71092.phpt
+++ b/Zend/tests/return_types/bug71092.phpt
@@ -6,11 +6,11 @@ opcache.enable=0
<?php
function boom(): array {
- $data = [['id']];
- switch ($data[0]) {
- case ['id']:
- return null;
- }
+ $data = [['id']];
+ switch ($data[0]) {
+ case ['id']:
+ return null;
+ }
}
boom();
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/generators002.phpt b/Zend/tests/return_types/generators002.phpt
index 90bada714b..2e42f4b052 100644
--- a/Zend/tests/return_types/generators002.phpt
+++ b/Zend/tests/return_types/generators002.phpt
@@ -6,4 +6,4 @@ 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: Generators may only declare a return type containing Generator, Iterator, Traversable, or iterable, StdClass is not permitted in %s on line %d
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/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..8c15a9658f 100644
--- a/Zend/tests/runtime_compile_time_binary_operands.phpt
+++ b/Zend/tests/runtime_compile_time_binary_operands.phpt
@@ -6,120 +6,120 @@ memory_limit=256M
<?php
$operands = [
- "==",
- "!=",
- "===",
- "!==",
- "<",
- "<=",
- ">",
- ">=",
- "<=>",
- "+",
- "-",
- "*",
- "/",
- "%",
- "**",
- ".",
- "|",
- "&",
- "^",
- "or",
- "and",
- "xor",
- "||",
- "&&",
+ "==",
+ "!=",
+ "===",
+ "!==",
+ "<",
+ "<=",
+ ">",
+ ">=",
+ "<=>",
+ "+",
+ "-",
+ "*",
+ "/",
+ "%",
+ "**",
+ ".",
+ "|",
+ "&",
+ "^",
+ "or",
+ "and",
+ "xor",
+ "||",
+ "&&",
];
$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);
- $error = "echo '" . addcslashes("$op1_p $operator $op2_p", "\\'") . '\', "\n"; $f++;';
+ $op1_p = makeParam($op1);
+ $op2_p = makeParam($op2);
- $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;
+ $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;
}
$filename = __DIR__ . DIRECTORY_SEPARATOR . 'compare_binary_operands_temp.php';
@@ -128,14 +128,14 @@ $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 ($operands as $operand) {
+ $line = prepareLine($left, $right, function() use ($left, $right, $operand) {
+ return eval("return @(\$left $operand \$right);");
+ }, $operand);
+ fwrite($file, $line . "\n");
+ }
+ }
}
fclose($file);
@@ -143,12 +143,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 +155,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/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..8c74a95b14 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";
diff --git a/Zend/tests/settype_int.phpt b/Zend/tests/settype_int.phpt
index f278bf1bcd..9dac9c5b8f 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";
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/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_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..02e7ccb666 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..db7644c321 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..a0f89e9186 100644
--- a/Zend/tests/str_offset_004.phpt
+++ b/Zend/tests/str_offset_004.phpt
@@ -45,5 +45,7 @@ Warning: Illegal string offset: -20 in %sstr_offset_004.php 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/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..3f875f22bb 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/sub_001.phpt b/Zend/tests/sub_001.phpt
index ef02c38241..165c64153b 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;
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_013.phpt b/Zend/tests/temporary_cleaning_013.phpt
index 34e4080f56..d9e7dd82f5 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"; }
?>
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/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..a499d8ac76 100644
--- a/Zend/tests/this_in_eval.phpt
+++ b/Zend/tests/this_in_eval.phpt
@@ -3,10 +3,10 @@ $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();
diff --git a/Zend/tests/this_in_extract.phpt b/Zend/tests/this_in_extract.phpt
index 9903d7d794..ef0a25a279 100644
--- a/Zend/tests/this_in_extract.phpt
+++ b/Zend/tests/this_in_extract.phpt
@@ -15,5 +15,5 @@ foo();
--EXPECTF--
Cannot re-assign $this
-Notice: Undefined variable: a in %s on line %d
+Warning: Undefined variable: a in %s on line %d
NULL
diff --git a/Zend/tests/this_in_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/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..50f5d619ad
--- /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--
+Return value of C::test1() must be of the type int, string returned
+Argument 1 passed to C::test2() must be of the type int, string given, called in %s on line %d
+Argument 1 passed to C::test3() must be of the type int, string given, called 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/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..fa1dc9bf95 100644
--- a/Zend/tests/traits/bug60145.phpt
+++ b/Zend/tests/traits/bug60145.phpt
@@ -8,9 +8,9 @@ trait foo {
}
interface MyInterface {
- use foo;
+ use foo;
- public function b();
+ public function b();
}
--EXPECTF--
diff --git a/Zend/tests/traits/bug60717.phpt b/Zend/tests/traits/bug60717.phpt
index d38b1c0c24..0f5cadb066 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 = null, $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 = null, $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;
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/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/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..080b6b7cce 100644
--- a/Zend/tests/traits/bugs/case-sensitive.phpt
+++ b/Zend/tests/traits/bugs/case-sensitive.phpt
@@ -5,18 +5,18 @@ 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--
diff --git a/Zend/tests/traits/bugs/interfaces.phpt b/Zend/tests/traits/bugs/interfaces.phpt
index 97ec174a7f..e68e54f3de 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 {
diff --git a/Zend/tests/traits/conflict001.phpt b/Zend/tests/traits/conflict001.phpt
index 11dababdb5..c288df7351 100644
--- a/Zend/tests/traits/conflict001.phpt
+++ b/Zend/tests/traits/conflict001.phpt
@@ -17,8 +17,8 @@ trait THello2 {
}
class TraitsTest {
- use THello1;
- use THello2;
+ use THello1;
+ use THello2;
}
?>
--EXPECTF--
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/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..0c2f19d2df 100644
--- a/Zend/tests/traits/error_002.phpt
+++ b/Zend/tests/traits/error_002.phpt
@@ -4,7 +4,7 @@ Trying to use an undefined trait
<?php
class A {
- use abc;
+ use abc;
}
?>
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..5042a4be1c 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;
diff --git a/Zend/tests/traits/error_012.phpt b/Zend/tests/traits/error_012.phpt
index 50a454c324..999fed6c8e 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;
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..e494eb680e 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;
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/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/language015.phpt b/Zend/tests/traits/language015.phpt
index 0c9fb4afb2..1d92529323 100644
--- a/Zend/tests/traits/language015.phpt
+++ b/Zend/tests/traits/language015.phpt
@@ -3,15 +3,15 @@ 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..2c07235fe9 100644
--- a/Zend/tests/traits/language016.phpt
+++ b/Zend/tests/traits/language016.phpt
@@ -3,15 +3,15 @@ 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..68169f9ba5 100644
--- a/Zend/tests/traits/language017.phpt
+++ b/Zend/tests/traits/language017.phpt
@@ -3,15 +3,15 @@ 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..b23f8df27a 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;
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/bug72629.phpt b/Zend/tests/try/bug72629.phpt
index 034a63b306..2e8e40d6b2 100644
--- a/Zend/tests/try/bug72629.phpt
+++ b/Zend/tests/try/bug72629.phpt
@@ -7,7 +7,7 @@ $var = null;
$e = &$var;
try {
- throw new Exception;
+ throw new Exception;
} catch (Exception $e) { }
var_dump($var === $e);
diff --git a/Zend/tests/try/bug74444.phpt b/Zend/tests/try/bug74444.phpt
index 74e0c9d46f..949f83cb23 100644
--- a/Zend/tests/try/bug74444.phpt
+++ b/Zend/tests/try/bug74444.phpt
@@ -4,71 +4,71 @@ 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();
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/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..8d5fa1e431 100644
--- a/Zend/tests/try/try_finally_010.phpt
+++ b/Zend/tests/try/try_finally_010.phpt
@@ -3,27 +3,27 @@ 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--
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..09af9a98f2 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));
diff --git a/Zend/tests/type_declarations/callable_001.phpt b/Zend/tests/type_declarations/callable_001.phpt
index 3113bedcf0..d93e70923a 100644
--- a/Zend/tests/type_declarations/callable_001.phpt
+++ b/Zend/tests/type_declarations/callable_001.phpt
@@ -14,19 +14,13 @@ $closure = function () {};
foo("strpos");
foo("foo");
-foo(array("bar", "baz"));
-foo(array("bar", "foo"));
foo($closure);
+foo(array("bar", "foo"));
+foo(array("bar", "baz"));
--EXPECTF--
string(6) "strpos"
string(3) "foo"
-
-Deprecated: Non-static method bar::baz() should not be called statically in %s on line %d
-array(2) {
- [0]=>
- string(3) "bar"
- [1]=>
- string(3) "baz"
+object(Closure)#1 (0) {
}
array(2) {
[0]=>
@@ -34,5 +28,9 @@ array(2) {
[1]=>
string(3) "foo"
}
-object(Closure)#%d (0) {
-}
+
+Fatal error: Uncaught TypeError: Argument 1 passed to foo() must be callable, array given, called in %s on line %d and defined in %s:%d
+Stack trace:
+#0 %s(%d): foo(Array)
+#1 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/type_declarations/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..e0202cee06
--- /dev/null
+++ b/Zend/tests/type_declarations/confusable_type_warning.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Warnings for confusable types
+--FILE--
+<?php
+
+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/internal_function_strict_mode.phpt b/Zend/tests/type_declarations/internal_function_strict_mode.phpt
index a9e7c9a56b..1019aa5024 100644
--- a/Zend/tests/type_declarations/internal_function_strict_mode.phpt
+++ b/Zend/tests/type_declarations/internal_function_strict_mode.phpt
@@ -6,23 +6,23 @@ 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;
}
?>
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..0b6c032b9f 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 {
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/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_constant_defaults.phpt b/Zend/tests/type_declarations/scalar_constant_defaults.phpt
index b9076c6b52..e42cb32bde 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
+Argument 1 passed to int_val_default_null() must be of the type int, null given, called in %s on line %d
Testing int with null null constant
+Argument 1 passed to int_val_default_null() must be of the type int, null given, called in %s on line %d
+Testing nullable int with default null constant
+NULL
+Testing nullable int with null null constant
NULL
diff --git a/Zend/tests/type_declarations/scalar_constant_defaults_error.phpt b/Zend/tests/type_declarations/scalar_constant_defaults_error.phpt
index 750edb77fa..d897bb4822 100644
--- a/Zend/tests/type_declarations/scalar_constant_defaults_error.phpt
+++ b/Zend/tests/type_declarations/scalar_constant_defaults_error.phpt
@@ -6,7 +6,7 @@ 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());
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_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_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/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..eb4b61ac02 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 {
diff --git a/Zend/tests/type_declarations/typed_properties_022.phpt b/Zend/tests/type_declarations/typed_properties_022.phpt
index 7e947825c9..8c72efd5b1 100644
--- a/Zend/tests/type_declarations/typed_properties_022.phpt
+++ b/Zend/tests/type_declarations/typed_properties_022.phpt
@@ -3,7 +3,7 @@ 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();
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..d38d5ddb94 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 {
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_032.phpt b/Zend/tests/type_declarations/typed_properties_032.phpt
index f3ceeb5cd9..2542b6e9ec 100644
--- a/Zend/tests/type_declarations/typed_properties_032.phpt
+++ b/Zend/tests/type_declarations/typed_properties_032.phpt
@@ -3,11 +3,11 @@ 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());
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_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..9a76791bcd 100644
--- a/Zend/tests/type_declarations/typed_properties_037.phpt
+++ b/Zend/tests/type_declarations/typed_properties_037.phpt
@@ -3,7 +3,7 @@ Test typed properties var_dump uninitialized
--FILE--
<?php
$foo = new class {
- public int $bar = 10, $qux;
+ public int $bar = 10, $qux;
};
var_dump($foo);
diff --git a/Zend/tests/type_declarations/typed_properties_038.phpt b/Zend/tests/type_declarations/typed_properties_038.phpt
index 44e5d04c7f..0ac406f9a6 100644
--- a/Zend/tests/type_declarations/typed_properties_038.phpt
+++ b/Zend/tests/type_declarations/typed_properties_038.phpt
@@ -4,37 +4,37 @@ 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);
@@ -44,7 +44,7 @@ object(class@anonymous)#1 (1) {
["bar"]=>
int(%d)
}
-string(60) "Typed property class@anonymous::$bar must be int, float used"
+string(65) "Cannot assign float to property class@anonymous::$bar of type int"
object(class@anonymous)#1 (1) {
["bar"]=>
int(%d)
@@ -54,7 +54,7 @@ object(class@anonymous)#1 (1) {
["bar"]=>
int(%d)
}
-string(60) "Typed property class@anonymous::$bar must be int, float used"
+string(65) "Cannot assign float to property class@anonymous::$bar of type int"
object(class@anonymous)#1 (1) {
["bar"]=>
int(%d)
diff --git a/Zend/tests/type_declarations/typed_properties_039.phpt b/Zend/tests/type_declarations/typed_properties_039.phpt
index 62413d804c..47ae17f0ab 100644
--- a/Zend/tests/type_declarations/typed_properties_039.phpt
+++ b/Zend/tests/type_declarations/typed_properties_039.phpt
@@ -25,7 +25,7 @@ var_dump($objs);
?>
--EXPECTF--
-Fatal error: Uncaught TypeError: Typed property A::$foo must be int, A used in %s:%d
+Fatal error: Uncaught TypeError: Cannot assign A to property A::$foo of type int in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
diff --git a/Zend/tests/type_declarations/typed_properties_040.phpt b/Zend/tests/type_declarations/typed_properties_040.phpt
index 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..bb524fcf75 100644
--- a/Zend/tests/type_declarations/typed_properties_046.phpt
+++ b/Zend/tests/type_declarations/typed_properties_046.phpt
@@ -3,27 +3,27 @@ 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..d81b51d049 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";
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..c92ed5afc4 100644
--- a/Zend/tests/type_declarations/typed_properties_078.phpt
+++ b/Zend/tests/type_declarations/typed_properties_078.phpt
@@ -4,9 +4,9 @@ Typed references must be kept track of and always be only the intersection of th
<?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/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/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..2807397734
--- /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 types 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..72d2e6c291
--- /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
+Argument 1 passed to Test::method() must be of type X|Y|Z|int, instance of 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/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..f098b638dc
--- /dev/null
+++ b/Zend/tests/type_declarations/union_types/type_checking_strict.phpt
@@ -0,0 +1,211 @@
+--TEST--
+Behavior of union type checks (strict)
+--SKIPIF--
+<?php
+if (!extension_loaded('json')) die('skip requires json');
+?>
+--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('1 passed to {closure}()', '...', $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, object given
+new WithToString => Argument ... must be of type int|float, object 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, object given
+new WithToString => Argument ... must be of type int|float|false, object 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, object given
+new WithToString => Argument ... must be of type int|float|bool, object 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, object given
+new WithToString => Argument ... must be of type int|bool, object 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, object given
+new WithToString => Argument ... must be of type string|int|null, object 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, object given
+new WithToString => Argument ... must be of type string|bool, object 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, object given
+new WithToString => Argument ... must be of type array|float, object 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, object given
+new WithToString => Argument ... must be of type array|string, object 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, object given
+new WithToString => Argument ... must be of type array|bool, object 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..441eaab854
--- /dev/null
+++ b/Zend/tests/type_declarations/union_types/type_checking_weak.phpt
@@ -0,0 +1,209 @@
+--TEST--
+Behavior of union type checks (weak)
+--SKIPIF--
+<?php
+if (!extension_loaded('json')) die('skip requires json');
+?>
+--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('1 passed to {closure}()', '...', $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" => 42 (A non well formed numeric value encountered)
+"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, object given
+new WithToString => Argument ... must be of type int|float, object given
+
+Type int|float|false:
+42 => 42
+42.0 => 42.0
+INF => INF
+"42" => 42
+"42.0" => 42.0
+"42x" => 42 (A non well formed numeric value encountered)
+"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, object given
+new WithToString => Argument ... must be of type int|float|false, object given
+
+Type int|float|bool:
+42 => 42
+42.0 => 42.0
+INF => INF
+"42" => 42
+"42.0" => 42.0
+"42x" => 42 (A non well formed numeric value encountered)
+"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, object given
+new WithToString => Argument ... must be of type int|float|bool, object given
+
+Type int|bool:
+42 => 42
+42.0 => 42
+INF => true
+"42" => 42
+"42.0" => 42
+"42x" => 42 (A non well formed numeric value encountered)
+"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, object given
+new WithToString => Argument ... must be of type int|bool, object 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, object 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, object given
+new WithToString => "__toString()"
+
+Type float|array:
+42 => 42.0
+42.0 => 42.0
+INF => INF
+"42" => 42.0
+"42.0" => 42.0
+"42x" => 42.0 (A non well formed numeric value encountered)
+"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, object given
+new WithToString => Argument ... must be of type array|float, object 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, object 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, object given
+new WithToString => Argument ... must be of type array|bool, object 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/internal_parent.phpt b/Zend/tests/type_declarations/variance/internal_parent.phpt
index eaef902b66..d31dcb17a8 100644
--- a/Zend/tests/type_declarations/variance/internal_parent.phpt
+++ b/Zend/tests/type_declarations/variance/internal_parent.phpt
@@ -9,4 +9,4 @@ class Test extends DateTime {
?>
--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, $time, ?Wrong $timezone = NULL) and DateTime::createFromFormat(string $format, string $time, ?DateTimeZone $timezone = NULL), because class Wrong is not available 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/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/unexpected_ref_bug.phpt b/Zend/tests/unexpected_ref_bug.phpt
index a4e74e7a67..0d78410d1a 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
Done.
diff --git a/Zend/tests/unset_cast_deprecated.phpt b/Zend/tests/unset_cast_deprecated.phpt
deleted file mode 100644
index 6744c85f02..0000000000
--- a/Zend/tests/unset_cast_deprecated.phpt
+++ /dev/null
@@ -1,14 +0,0 @@
---TEST--
-The (unset) cast is deprecated
---FILE--
-<?php
-
-$x = 1;
-var_dump((unset) $x);
-var_dump($x);
-
-?>
---EXPECTF--
-Deprecated: The (unset) cast is deprecated in %s on line %d
-NULL
-int(1)
diff --git a/Zend/tests/unset_cast_removed.phpt b/Zend/tests/unset_cast_removed.phpt
new file mode 100644
index 0000000000..9f2f798ed0
--- /dev/null
+++ b/Zend/tests/unset_cast_removed.phpt
@@ -0,0 +1,12 @@
+--TEST--
+The (unset) cast is removed
+--FILE--
+<?php
+
+$x = 1;
+var_dump((unset) $x);
+var_dump($x);
+
+?>
+--EXPECTF--
+Fatal error: The (unset) cast is no longer supported in %s on line %d
diff --git a/Zend/tests/unset_cv01.phpt b/Zend/tests/unset_cv01.phpt
index 99af118d10..508a0cbf3e 100644
--- a/Zend/tests/unset_cv01.phpt
+++ b/Zend/tests/unset_cv01.phpt
@@ -10,4 +10,4 @@ echo $x;
--EXPECTF--
ok
-Notice: Undefined variable: x in %sunset_cv01.php on line %d
+Warning: Undefined variable: x in %s on line %d
diff --git a/Zend/tests/unset_cv02.phpt b/Zend/tests/unset_cv02.phpt
index cb2475350c..915b165eca 100644
--- a/Zend/tests/unset_cv02.phpt
+++ b/Zend/tests/unset_cv02.phpt
@@ -10,4 +10,4 @@ echo $x;
--EXPECTF--
ok
-Notice: Undefined variable: x in %sunset_cv02.php on line %d
+Warning: Undefined variable: x in %s on line %d
diff --git a/Zend/tests/unset_cv03.phpt b/Zend/tests/unset_cv03.phpt
index 221abe2d88..dce3fce5f1 100644
--- a/Zend/tests/unset_cv03.phpt
+++ b/Zend/tests/unset_cv03.phpt
@@ -10,4 +10,4 @@ echo $x;
--EXPECTF--
ok
-Notice: Undefined variable: x in %sunset_cv03.php on line %d
+Warning: Undefined variable: x in %s on line %d
diff --git a/Zend/tests/unset_cv04.phpt b/Zend/tests/unset_cv04.phpt
index 5044cb1c8d..816a5f9ce4 100644
--- a/Zend/tests/unset_cv04.phpt
+++ b/Zend/tests/unset_cv04.phpt
@@ -13,4 +13,4 @@ f();
--EXPECTF--
ok
-Notice: Undefined variable: x in %sunset_cv04.php on line %d
+Warning: Undefined variable: x in %s on line %d
diff --git a/Zend/tests/unset_cv05.phpt b/Zend/tests/unset_cv05.phpt
index 073ee4bee4..a389d651ad 100644
--- a/Zend/tests/unset_cv05.phpt
+++ b/Zend/tests/unset_cv05.phpt
@@ -17,6 +17,6 @@ echo $_SESSION;
echo "\nok\n";
?>
--EXPECTF--
-Notice: Array to string conversion in %sunset_cv05.php on line %d
+Warning: Array to string conversion in %s on line %d
Array
ok
diff --git a/Zend/tests/unset_cv09.phpt b/Zend/tests/unset_cv09.phpt
index a5407ad64e..a52062575c 100644
--- a/Zend/tests/unset_cv09.phpt
+++ b/Zend/tests/unset_cv09.phpt
@@ -10,5 +10,5 @@ echo "ok\n";
--EXPECTF--
ok
-Notice: Undefined variable: x in %sunset_cv09.php on line %d
+Warning: Undefined variable: x in %s on line %d
ok
diff --git a/Zend/tests/unset_cv10.phpt b/Zend/tests/unset_cv10.phpt
index 335463b0ca..97a79bb973 100644
--- a/Zend/tests/unset_cv10.phpt
+++ b/Zend/tests/unset_cv10.phpt
@@ -12,5 +12,5 @@ echo "ok\n";
--EXPECTF--
ok
-Notice: Undefined variable: x in %sunset_cv10.php on line %d
+Warning: Undefined variable: x in %s on line %d
ok
diff --git a/Zend/tests/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_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/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..e880f0f1ff
--- /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: Trying to get property 'prop' of non-object in %s on line %d
+NULL
+Call to a member function method() on string
+int(42)
+int(42)
diff --git a/Zend/tests/varSyntax/magic_const_deref.phpt b/Zend/tests/varSyntax/magic_const_deref.phpt
new file mode 100644
index 0000000000..28ca4b7f40
--- /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: Trying to get property 'prop' of non-object in %s on line %d
+NULL
+Call to a member function method() on string
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..446f1372cd 100644
--- a/Zend/tests/varSyntax/propertyOfStringError.phpt
+++ b/Zend/tests/varSyntax/propertyOfStringError.phpt
@@ -7,4 +7,4 @@ Cannot take property of a string
?>
--EXPECTF--
-Notice: Trying to get property 'bar' of non-object in %s on line %d
+Warning: Trying to get property 'bar' of non-object in %s on line %d
diff --git a/Zend/tests/variadic/by_ref_error.phpt b/Zend/tests/variadic/by_ref_error.phpt
index 7f21014146..bc7378785a 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: Cannot pass parameter 1 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_suppressed_error.phpt b/Zend/tests/variadic/typehint_suppressed_error.phpt
index ebc44c38b1..e7906ea2f2 100644
--- a/Zend/tests/variadic/typehint_suppressed_error.phpt
+++ b/Zend/tests/variadic/typehint_suppressed_error.phpt
@@ -8,9 +8,9 @@ function test(array... $args) {
}
try {
- test([0], [1], 2);
+ test([0], [1], 2);
} catch(Error $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
?>
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
deleted file mode 100644
index 099d1c087f..0000000000
--- a/Zend/tests/warning_during_heredoc_scan_ahead.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-No warnings should be thrown during heredoc scan-ahead
---FILE--
-<?php
-
-<<<TEST
-${x}
-\400
-${/*}
-TEST;
-
-?>
---EXPECTF--
-Warning: Unexpected character in input: '' (ASCII=1) state=0 in %s on line %d
-
-Warning: Octal escape sequence overflow \400 is greater than \377 in %s on line %d
-
-Warning: Unterminated comment starting line %d in %s on line %d
-
-Parse error: syntax error, unexpected end of file 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..6eb283c662
--- /dev/null
+++ b/Zend/tests/weakrefs/weakmap_basic_map_behavior.phpt
@@ -0,0 +1,173 @@
+--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";
+}
+
+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..75a824f422
--- /dev/null
+++ b/Zend/tests/weakrefs/weakmap_error_conditions.phpt
@@ -0,0 +1,96 @@
+--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";
+}
+
+try {
+ $map->prop = 1;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump($map->prop);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $r =& $map->prop;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ isset($map->prop);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ unset($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";
+}
+
+?>
+--EXPECT--
+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
+WeakMap objects do not support properties
+WeakMap objects do not support properties
+WeakMap objects do not support property references
+WeakMap objects do not support properties
+WeakMap objects do not support properties
+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..5e57dead56
--- /dev/null
+++ b/Zend/tests/weakrefs/weakmap_weakness.phpt
@@ -0,0 +1,107 @@
+--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 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 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..66dc932372 100644
--- a/Zend/tests/weakrefs/weakrefs_003.phpt
+++ b/Zend/tests/weakrefs/weakrefs_003.phpt
@@ -5,33 +5,33 @@ WeakReference object handlers
$wr = WeakReference::create(new stdClass);
try {
- $wr->disallow;
+ $wr->disallow;
} catch (Error $ex) {
- var_dump($ex->getMessage());
+ var_dump($ex->getMessage());
}
try {
- $wr->disallow = "writes";
+ $wr->disallow = "writes";
} catch (Error $ex) {
- var_dump($ex->getMessage());
+ var_dump($ex->getMessage());
}
try {
- isset($wr->disallow);
+ isset($wr->disallow);
} catch (Error $ex) {
- var_dump($ex->getMessage());
+ var_dump($ex->getMessage());
}
try {
- unset($wr->disallow);
+ unset($wr->disallow);
} 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--
diff --git a/Zend/tests/zend_signed_multiply-64bit-2.phpt b/Zend/tests/zend_signed_multiply-64bit-2.phpt
index aa8ee47db6..ff0e88a78d 100644
--- a/Zend/tests/zend_signed_multiply-64bit-2.phpt
+++ b/Zend/tests/zend_signed_multiply-64bit-2.phpt
@@ -6,11 +6,11 @@ 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--
diff --git a/Zend/zend.c b/Zend/zend.c
index 97ac3327ca..9f3c05f973 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -94,7 +94,7 @@ ZEND_API zend_bool zend_rc_debug = 0;
static ZEND_INI_MH(OnUpdateErrorReporting) /* {{{ */
{
if (!new_value) {
- EG(error_reporting) = E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED;
+ EG(error_reporting) = E_ALL;
} else {
EG(error_reporting) = atoi(ZSTR_VAL(new_value));
}
@@ -594,12 +594,20 @@ static void function_copy_ctor(zval *zv) /* {{{ */
new_arg_info = pemalloc(sizeof(zend_arg_info) * num_args, 1);
memcpy(new_arg_info, arg_info, sizeof(zend_arg_info) * num_args);
for (i = 0 ; i < num_args; i++) {
- if (ZEND_TYPE_IS_CLASS(arg_info[i].type)) {
+ if (ZEND_TYPE_HAS_LIST(arg_info[i].type)) {
+ zend_type_list *old_list = ZEND_TYPE_LIST(arg_info[i].type);
+ zend_type_list *new_list = pemalloc(ZEND_TYPE_LIST_SIZE(old_list->num_types), 1);
+ memcpy(new_list, old_list, ZEND_TYPE_LIST_SIZE(old_list->num_types));
+ ZEND_TYPE_SET_PTR(new_arg_info[i].type, new_list);
+
+ zend_type *list_type;
+ ZEND_TYPE_LIST_FOREACH(new_list, list_type) {
+ zend_string *name = zend_string_dup(ZEND_TYPE_NAME(*list_type), 1);
+ ZEND_TYPE_SET_PTR(*list_type, name);
+ } ZEND_TYPE_LIST_FOREACH_END();
+ } else if (ZEND_TYPE_HAS_NAME(arg_info[i].type)) {
zend_string *name = zend_string_dup(ZEND_TYPE_NAME(arg_info[i].type), 1);
-
- new_arg_info[i].type =
- ZEND_TYPE_ENCODE_CLASS(
- name, ZEND_TYPE_ALLOW_NULL(arg_info[i].type));
+ ZEND_TYPE_SET_PTR(new_arg_info[i].type, name);
}
}
func->common.arg_info = new_arg_info + 1;
@@ -642,14 +650,16 @@ static void compiler_globals_ctor(zend_compiler_globals *compiler_globals) /* {{
#if ZEND_MAP_PTR_KIND == ZEND_MAP_PTR_KIND_PTR_OR_OFFSET
/* Map region is going to be created and resized at run-time. */
- compiler_globals->map_ptr_base = NULL;
+ ZEND_MAP_PTR_SET_REAL_BASE(compiler_globals->map_ptr_base, NULL);
compiler_globals->map_ptr_size = 0;
compiler_globals->map_ptr_last = global_map_ptr_last;
if (compiler_globals->map_ptr_last) {
/* Allocate map_ptr table */
+ void *base;
compiler_globals->map_ptr_size = ZEND_MM_ALIGNED_SIZE_EX(compiler_globals->map_ptr_last, 4096);
- compiler_globals->map_ptr_base = pemalloc(compiler_globals->map_ptr_size * sizeof(void*), 1);
- memset(compiler_globals->map_ptr_base, 0, compiler_globals->map_ptr_last * sizeof(void*));
+ base = pemalloc(compiler_globals->map_ptr_size * sizeof(void*), 1);
+ ZEND_MAP_PTR_SET_REAL_BASE(compiler_globals->map_ptr_base, base);
+ memset(base, 0, compiler_globals->map_ptr_last * sizeof(void*));
}
#else
# error "Unknown ZEND_MAP_PTR_KIND"
@@ -674,9 +684,9 @@ static void compiler_globals_dtor(zend_compiler_globals *compiler_globals) /* {{
if (compiler_globals->script_encoding_list) {
pefree((char*)compiler_globals->script_encoding_list, 1);
}
- if (compiler_globals->map_ptr_base) {
- free(compiler_globals->map_ptr_base);
- compiler_globals->map_ptr_base = NULL;
+ if (ZEND_MAP_PTR_REAL_BASE(compiler_globals->map_ptr_base)) {
+ free(ZEND_MAP_PTR_REAL_BASE(compiler_globals->map_ptr_base));
+ ZEND_MAP_PTR_SET_REAL_BASE(compiler_globals->map_ptr_base, NULL);
compiler_globals->map_ptr_size = 0;
}
}
@@ -905,10 +915,10 @@ int zend_startup(zend_utility_functions *utility_functions) /* {{{ */
*/
CG(map_ptr_size) = 1024 * 1024; // TODO: initial size ???
CG(map_ptr_last) = 0;
- CG(map_ptr_base) = pemalloc(CG(map_ptr_size) * sizeof(void*), 1);
+ ZEND_MAP_PTR_SET_REAL_BASE(CG(map_ptr_base), pemalloc(CG(map_ptr_size) * sizeof(void*), 1));
# elif ZEND_MAP_PTR_KIND == ZEND_MAP_PTR_KIND_PTR_OR_OFFSET
/* Map region is going to be created and resized at run-time. */
- CG(map_ptr_base) = NULL;
+ ZEND_MAP_PTR_SET_REAL_BASE(CG(map_ptr_base), NULL);
CG(map_ptr_size) = 0;
CG(map_ptr_last) = 0;
# else
@@ -952,6 +962,15 @@ void zend_register_standard_ini_entries(void) /* {{{ */
}
/* }}} */
+static zend_class_entry *resolve_type_name(zend_string *type_name) {
+ zend_string *lc_type_name = zend_string_tolower(type_name);
+ zend_class_entry *ce = zend_hash_find_ptr(CG(class_table), lc_type_name);
+
+ ZEND_ASSERT(ce && ce->type == ZEND_INTERNAL_CLASS);
+ zend_string_release(lc_type_name);
+ return ce;
+}
+
static void zend_resolve_property_types(void) /* {{{ */
{
zend_class_entry *ce;
@@ -964,16 +983,14 @@ static void zend_resolve_property_types(void) /* {{{ */
if (UNEXPECTED(ZEND_CLASS_HAS_TYPE_HINTS(ce))) {
ZEND_HASH_FOREACH_PTR(&ce->properties_info, prop_info) {
- if (ZEND_TYPE_IS_NAME(prop_info->type)) {
- zend_string *type_name = ZEND_TYPE_NAME(prop_info->type);
- zend_string *lc_type_name = zend_string_tolower(type_name);
- zend_class_entry *prop_ce = zend_hash_find_ptr(CG(class_table), lc_type_name);
-
- ZEND_ASSERT(prop_ce && prop_ce->type == ZEND_INTERNAL_CLASS);
- prop_info->type = ZEND_TYPE_ENCODE_CE(prop_ce, ZEND_TYPE_ALLOW_NULL(prop_info->type));
- zend_string_release(lc_type_name);
- zend_string_release(type_name);
- }
+ zend_type *single_type;
+ ZEND_TYPE_FOREACH(prop_info->type, single_type) {
+ if (ZEND_TYPE_HAS_NAME(*single_type)) {
+ zend_string *type_name = ZEND_TYPE_NAME(*single_type);
+ ZEND_TYPE_SET_CE(*single_type, resolve_type_name(type_name));
+ zend_string_release(type_name);
+ }
+ } ZEND_TYPE_FOREACH_END();
} ZEND_HASH_FOREACH_END();
}
ce->ce_flags |= ZEND_ACC_PROPERTY_TYPES_RESOLVED;
@@ -1018,8 +1035,10 @@ int zend_post_startup(void) /* {{{ */
compiler_globals->function_table = NULL;
free(compiler_globals->class_table);
compiler_globals->class_table = NULL;
- free(compiler_globals->map_ptr_base);
- compiler_globals->map_ptr_base = NULL;
+ if (ZEND_MAP_PTR_REAL_BASE(compiler_globals->map_ptr_base)) {
+ free(ZEND_MAP_PTR_REAL_BASE(compiler_globals->map_ptr_base));
+ }
+ ZEND_MAP_PTR_SET_REAL_BASE(compiler_globals->map_ptr_base, NULL);
if ((script_encoding_list = (zend_encoding **)compiler_globals->script_encoding_list)) {
compiler_globals_ctor(compiler_globals);
compiler_globals->script_encoding_list = (const zend_encoding **)script_encoding_list;
@@ -1074,9 +1093,9 @@ void zend_shutdown(void) /* {{{ */
ts_free_id(executor_globals_id);
ts_free_id(compiler_globals_id);
#else
- if (CG(map_ptr_base)) {
- free(CG(map_ptr_base));
- CG(map_ptr_base) = NULL;
+ if (ZEND_MAP_PTR_REAL_BASE(CG(map_ptr_base))) {
+ free(ZEND_MAP_PTR_REAL_BASE(CG(map_ptr_base)));
+ ZEND_MAP_PTR_SET_REAL_BASE(CG(map_ptr_base), NULL);
CG(map_ptr_size) = 0;
}
#endif
@@ -1144,7 +1163,7 @@ ZEND_API void zend_append_version_info(const zend_extension *extension) /* {{{ *
}
/* }}} */
-ZEND_API char *get_zend_version(void) /* {{{ */
+ZEND_API const char *get_zend_version(void) /* {{{ */
{
return zend_version_info;
}
@@ -1160,7 +1179,7 @@ ZEND_API void zend_activate(void) /* {{{ */
init_executor();
startup_scanner();
if (CG(map_ptr_last)) {
- memset(CG(map_ptr_base), 0, CG(map_ptr_last) * sizeof(void*));
+ memset(ZEND_MAP_PTR_REAL_BASE(CG(map_ptr_base)), 0, CG(map_ptr_last) * sizeof(void*));
}
}
/* }}} */
@@ -1248,19 +1267,19 @@ ZEND_API zval *zend_get_configuration_directive(zend_string *name) /* {{{ */
} while (0)
static ZEND_COLD void zend_error_va_list(
- int type, const char *error_filename, uint32_t error_lineno,
+ int orig_type, const char *error_filename, uint32_t error_lineno,
const char *format, va_list args)
{
va_list usr_copy;
- zval params[5];
+ zval params[4];
zval retval;
zval orig_user_error_handler;
zend_bool in_compilation;
zend_class_entry *saved_class_entry;
zend_stack loop_var_stack;
zend_stack delayed_oplines_stack;
- zend_array *symbol_table;
zend_class_entry *orig_fake_scope;
+ int type = orig_type & E_ALL;
/* Report about uncaught exception in case of fatal errors */
if (EG(exception)) {
@@ -1307,7 +1326,7 @@ static ZEND_COLD void zend_error_va_list(
if (Z_TYPE(EG(user_error_handler)) == IS_UNDEF
|| !(EG(user_error_handler_error_reporting) & type)
|| EG(error_handling) != EH_NORMAL) {
- zend_error_cb(type, error_filename, error_lineno, format, args);
+ zend_error_cb(orig_type, error_filename, error_lineno, format, args);
} else switch (type) {
case E_ERROR:
case E_PARSE:
@@ -1316,7 +1335,7 @@ static ZEND_COLD void zend_error_va_list(
case E_COMPILE_ERROR:
case E_COMPILE_WARNING:
/* The error may not be safe to handle in user-space */
- zend_error_cb(type, error_filename, error_lineno, format, args);
+ zend_error_cb(orig_type, error_filename, error_lineno, format, args);
break;
default:
/* Handle the error in user space */
@@ -1334,15 +1353,6 @@ static ZEND_COLD void zend_error_va_list(
ZVAL_LONG(&params[3], error_lineno);
- symbol_table = zend_rebuild_symbol_table();
-
- /* during shutdown the symbol table table can be still null */
- if (!symbol_table) {
- ZVAL_NULL(&params[4]);
- } else {
- ZVAL_ARR(&params[4], zend_array_dup(symbol_table));
- }
-
ZVAL_COPY_VALUE(&orig_user_error_handler, &EG(user_error_handler));
ZVAL_UNDEF(&EG(user_error_handler));
@@ -1363,16 +1373,16 @@ static ZEND_COLD void zend_error_va_list(
orig_fake_scope = EG(fake_scope);
EG(fake_scope) = NULL;
- if (call_user_function(CG(function_table), NULL, &orig_user_error_handler, &retval, 5, params) == SUCCESS) {
+ if (call_user_function(CG(function_table), NULL, &orig_user_error_handler, &retval, 4, params) == SUCCESS) {
if (Z_TYPE(retval) != IS_UNDEF) {
if (Z_TYPE(retval) == IS_FALSE) {
- zend_error_cb(type, error_filename, error_lineno, format, args);
+ zend_error_cb(orig_type, error_filename, error_lineno, format, args);
}
zval_ptr_dtor(&retval);
}
} else if (!EG(exception)) {
/* The user error handler failed, use built-in error handler */
- zend_error_cb(type, error_filename, error_lineno, format, args);
+ zend_error_cb(orig_type, error_filename, error_lineno, format, args);
}
EG(fake_scope) = orig_fake_scope;
@@ -1384,7 +1394,6 @@ static ZEND_COLD void zend_error_va_list(
CG(in_compilation) = 1;
}
- zval_ptr_dtor(&params[4]);
zval_ptr_dtor(&params[2]);
zval_ptr_dtor(&params[1]);
@@ -1560,37 +1569,28 @@ ZEND_API ZEND_COLD void zend_type_error(const char *format, ...) /* {{{ */
va_end(va);
} /* }}} */
-ZEND_API ZEND_COLD void zend_internal_type_error(zend_bool throw_exception, const char *format, ...) /* {{{ */
+ZEND_API ZEND_COLD void zend_argument_count_error(const char *format, ...) /* {{{ */
{
va_list va;
char *message = NULL;
va_start(va, format);
zend_vspprintf(&message, 0, format, va);
- if (throw_exception) {
- zend_throw_exception(zend_ce_type_error, message, 0);
- } else {
- zend_error(E_WARNING, "%s", message);
- }
+ zend_throw_exception(zend_ce_argument_count_error, message, 0);
efree(message);
va_end(va);
} /* }}} */
-ZEND_API ZEND_COLD void zend_internal_argument_count_error(zend_bool throw_exception, const char *format, ...) /* {{{ */
+ZEND_API ZEND_COLD void zend_value_error(const char *format, ...) /* {{{ */
{
va_list va;
char *message = NULL;
va_start(va, format);
zend_vspprintf(&message, 0, format, va);
- if (throw_exception) {
- zend_throw_exception(zend_ce_argument_count_error, message, 0);
- } else {
- zend_error(E_WARNING, "%s", message);
- }
+ zend_throw_exception(zend_ce_value_error, message, 0);
efree(message);
-
va_end(va);
} /* }}} */
@@ -1648,9 +1648,10 @@ ZEND_API int zend_execute_scripts(int type, zval *retval, int file_count, ...) /
int i;
zend_file_handle *file_handle;
zend_op_array *op_array;
+ int ret = SUCCESS;
va_start(files, file_count);
- for (i = 0; i < file_count; i++) {
+ for (i = 0; i < file_count && ret != FAILURE; i++) {
file_handle = va_arg(files, zend_file_handle *);
if (!file_handle) {
continue;
@@ -1670,18 +1671,18 @@ ZEND_API int zend_execute_scripts(int type, zval *retval, int file_count, ...) /
}
if (EG(exception)) {
zend_exception_error(EG(exception), E_ERROR);
+ ret = FAILURE;
}
}
destroy_op_array(op_array);
efree_size(op_array, sizeof(zend_op_array));
} else if (type==ZEND_REQUIRE) {
- va_end(files);
- return FAILURE;
+ ret = FAILURE;
}
}
va_end(files);
- return SUCCESS;
+ return ret;
}
/* }}} */
@@ -1731,12 +1732,12 @@ ZEND_API void *zend_map_ptr_new(void)
#elif ZEND_MAP_PTR_KIND == ZEND_MAP_PTR_KIND_PTR_OR_OFFSET
/* Grow map_ptr table */
CG(map_ptr_size) = ZEND_MM_ALIGNED_SIZE_EX(CG(map_ptr_last) + 1, 4096);
- CG(map_ptr_base) = perealloc(CG(map_ptr_base), CG(map_ptr_size) * sizeof(void*), 1);
+ ZEND_MAP_PTR_SET_REAL_BASE(CG(map_ptr_base), perealloc(ZEND_MAP_PTR_REAL_BASE(CG(map_ptr_base)), CG(map_ptr_size) * sizeof(void*), 1));
#else
# error "Unknown ZEND_MAP_PTR_KIND"
#endif
}
- ptr = (void**)CG(map_ptr_base) + CG(map_ptr_last);
+ ptr = (void**)ZEND_MAP_PTR_REAL_BASE(CG(map_ptr_base)) + CG(map_ptr_last);
*ptr = NULL;
CG(map_ptr_last)++;
#if ZEND_MAP_PTR_KIND == ZEND_MAP_PTR_KIND_PTR
@@ -1760,12 +1761,12 @@ ZEND_API void zend_map_ptr_extend(size_t last)
#elif ZEND_MAP_PTR_KIND == ZEND_MAP_PTR_KIND_PTR_OR_OFFSET
/* Grow map_ptr table */
CG(map_ptr_size) = ZEND_MM_ALIGNED_SIZE_EX(last, 4096);
- CG(map_ptr_base) = perealloc(CG(map_ptr_base), CG(map_ptr_size) * sizeof(void*), 1);
+ ZEND_MAP_PTR_SET_REAL_BASE(CG(map_ptr_base), perealloc(ZEND_MAP_PTR_REAL_BASE(CG(map_ptr_base)), CG(map_ptr_size) * sizeof(void*), 1));
#else
# error "Unknown ZEND_MAP_PTR_KIND"
#endif
}
- ptr = (void**)CG(map_ptr_base) + CG(map_ptr_last);
+ ptr = (void**)ZEND_MAP_PTR_REAL_BASE(CG(map_ptr_base)) + CG(map_ptr_last);
memset(ptr, 0, (last - CG(map_ptr_last)) * sizeof(void*));
CG(map_ptr_last) = last;
}
diff --git a/Zend/zend.h b/Zend/zend.h
index 9aefc8d26a..b965a765e3 100644
--- a/Zend/zend.h
+++ b/Zend/zend.h
@@ -20,7 +20,7 @@
#ifndef ZEND_H
#define ZEND_H
-#define ZEND_VERSION "3.4.0"
+#define ZEND_VERSION "4.0.0-dev"
#define ZEND_ENGINE_3
@@ -244,7 +244,7 @@ ZEND_API zend_string *zend_strpprintf(size_t max_len, const char *format, ...) Z
ZEND_API size_t zend_spprintf_unchecked(char **message, size_t max_len, const char *format, ...);
ZEND_API zend_string *zend_strpprintf_unchecked(size_t max_len, const char *format, ...);
-ZEND_API char *get_zend_version(void);
+ZEND_API const char *get_zend_version(void);
ZEND_API int zend_make_printable_zval(zval *expr, zval *expr_copy);
ZEND_API size_t zend_print_zval(zval *expr, int indent);
ZEND_API void zend_print_zval_r(zval *expr, int indent);
@@ -300,8 +300,8 @@ ZEND_API ZEND_COLD ZEND_NORETURN void zend_error_at_noreturn(int type, const cha
ZEND_API ZEND_COLD void zend_throw_error(zend_class_entry *exception_ce, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
ZEND_API ZEND_COLD void zend_type_error(const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 1, 2);
-ZEND_API ZEND_COLD void zend_internal_type_error(zend_bool throw_exception, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
-ZEND_API ZEND_COLD void zend_internal_argument_count_error(zend_bool throw_exception, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
+ZEND_API ZEND_COLD void zend_argument_count_error(const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 1, 2);
+ZEND_API ZEND_COLD void zend_value_error(const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 1, 2);
ZEND_COLD void zenderror(const char *error);
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index b7af44a32a..a3e452bf7d 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -91,12 +91,12 @@ ZEND_API ZEND_COLD void zend_wrong_param_count(void) /* {{{ */
const char *space;
const char *class_name = get_active_class_name(&space);
- zend_internal_argument_count_error(ZEND_ARG_USES_STRICT_TYPES(), "Wrong parameter count for %s%s%s()", class_name, space, get_active_function_name());
+ zend_argument_count_error("Wrong parameter count for %s%s%s()", class_name, space, get_active_function_name());
}
/* }}} */
/* Argument parsing API -- andrei */
-ZEND_API char *zend_get_type_by_const(int type) /* {{{ */
+ZEND_API const char *zend_get_type_by_const(int type) /* {{{ */
{
switch(type) {
case IS_FALSE:
@@ -131,7 +131,7 @@ ZEND_API char *zend_get_type_by_const(int type) /* {{{ */
}
/* }}} */
-ZEND_API char *zend_zval_type_name(const zval *arg) /* {{{ */
+ZEND_API const char *zend_zval_type_name(const zval *arg) /* {{{ */
{
ZVAL_DEREF(arg);
return zend_get_type_by_const(Z_TYPE_P(arg));
@@ -174,28 +174,7 @@ ZEND_API ZEND_COLD int ZEND_FASTCALL zend_wrong_parameters_none_error(void) /* {
zend_function *active_function = EG(current_execute_data)->func;
const char *class_name = active_function->common.scope ? ZSTR_VAL(active_function->common.scope->name) : "";
- zend_internal_argument_count_error(
- ZEND_ARG_USES_STRICT_TYPES(),
- "%s%s%s() expects %s %d parameter%s, %d given",
- class_name, \
- class_name[0] ? "::" : "", \
- ZSTR_VAL(active_function->common.function_name),
- "exactly",
- 0,
- "s",
- num_args);
- return FAILURE;
-}
-/* }}} */
-
-ZEND_API ZEND_COLD int ZEND_FASTCALL zend_wrong_parameters_none_exception(void) /* {{{ */
-{
- int num_args = ZEND_CALL_NUM_ARGS(EG(current_execute_data));
- zend_function *active_function = EG(current_execute_data)->func;
- const char *class_name = active_function->common.scope ? ZSTR_VAL(active_function->common.scope->name) : "";
-
- zend_internal_argument_count_error(
- 1,
+ zend_argument_count_error(
"%s%s%s() expects %s %d parameter%s, %d given",
class_name, \
class_name[0] ? "::" : "", \
@@ -214,27 +193,7 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameters_count_error(int min_
zend_function *active_function = EG(current_execute_data)->func;
const char *class_name = active_function->common.scope ? ZSTR_VAL(active_function->common.scope->name) : "";
- zend_internal_argument_count_error(
- ZEND_ARG_USES_STRICT_TYPES(),
- "%s%s%s() expects %s %d parameter%s, %d given",
- class_name, \
- class_name[0] ? "::" : "", \
- ZSTR_VAL(active_function->common.function_name),
- min_num_args == max_num_args ? "exactly" : num_args < min_num_args ? "at least" : "at most",
- num_args < min_num_args ? min_num_args : max_num_args,
- (num_args < min_num_args ? min_num_args : max_num_args) == 1 ? "" : "s",
- num_args);
-}
-/* }}} */
-
-ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameters_count_exception(int min_num_args, int max_num_args) /* {{{ */
-{
- int num_args = ZEND_CALL_NUM_ARGS(EG(current_execute_data));
- zend_function *active_function = EG(current_execute_data)->func;
- const char *class_name = active_function->common.scope ? ZSTR_VAL(active_function->common.scope->name) : "";
-
- zend_internal_argument_count_error(
- 1,
+ zend_argument_count_error(
"%s%s%s() expects %s %d parameter%s, %d given",
class_name, \
class_name[0] ? "::" : "", \
@@ -259,30 +218,12 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_type_error(int num, z
return;
}
class_name = get_active_class_name(&space);
- zend_internal_type_error(ZEND_ARG_USES_STRICT_TYPES(), "%s%s%s() expects parameter %d to be %s, %s given",
- class_name, space, get_active_function_name(), num, expected_error[expected_type], zend_zval_type_name(arg));
-}
-/* }}} */
-
-ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_type_exception(int num, zend_expected_type expected_type, zval *arg) /* {{{ */
-{
- const char *space;
- const char *class_name;
- static const char * const expected_error[] = {
- Z_EXPECTED_TYPES(Z_EXPECTED_TYPE_STR)
- NULL
- };
-
- if (EG(exception)) {
- return;
- }
- class_name = get_active_class_name(&space);
- zend_internal_type_error(1, "%s%s%s() expects parameter %d to be %s, %s given",
+ zend_type_error("%s%s%s() expects parameter %d to be %s, %s given",
class_name, space, get_active_function_name(), num, expected_error[expected_type], zend_zval_type_name(arg));
}
/* }}} */
-ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_error(int num, char *name, zval *arg) /* {{{ */
+ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_error(int num, const char *name, zval *arg) /* {{{ */
{
const char *space;
const char *class_name;
@@ -291,21 +232,7 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_error(int num,
return;
}
class_name = get_active_class_name(&space);
- zend_internal_type_error(ZEND_ARG_USES_STRICT_TYPES(), "%s%s%s() expects parameter %d to be %s, %s given",
- class_name, space, get_active_function_name(), num, name, zend_zval_type_name(arg));
-}
-/* }}} */
-
-ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_exception(int num, char *name, zval *arg) /* {{{ */
-{
- const char *space;
- const char *class_name;
-
- if (EG(exception)) {
- return;
- }
- class_name = get_active_class_name(&space);
- zend_internal_type_error(1, "%s%s%s() expects parameter %d to be %s, %s given",
+ zend_type_error("%s%s%s() expects parameter %d to be %s, %s given",
class_name, space, get_active_function_name(), num, name, zend_zval_type_name(arg));
}
/* }}} */
@@ -319,33 +246,7 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_error(int num, char *e
return;
}
class_name = get_active_class_name(&space);
- zend_internal_type_error(ZEND_ARG_USES_STRICT_TYPES(), "%s%s%s() expects parameter %d to be a valid callback, %s",
- class_name, space, get_active_function_name(), num, error);
- efree(error);
-}
-/* }}} */
-
-ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_exception(int num, char *error) /* {{{ */
-{
- const char *space;
- const char *class_name;
-
- if (EG(exception)) {
- return;
- }
- class_name = get_active_class_name(&space);
- zend_internal_type_error(1, "%s%s%s() expects parameter %d to be a valid callback, %s",
- class_name, space, get_active_function_name(), num, error);
- efree(error);
-}
-/* }}} */
-
-ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_deprecated(int num, char *error) /* {{{ */
-{
- const char *space;
- const char *class_name = get_active_class_name(&space);
-
- zend_error(E_DEPRECATED, "%s%s%s() expects parameter %d to be a valid callback, %s",
+ zend_type_error("%s%s%s() expects parameter %d to be a valid callback, %s",
class_name, space, get_active_function_name(), num, error);
efree(error);
}
@@ -370,7 +271,7 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_class(zval *arg, zend_class_entry **pc
const char *space;
const char *class_name = get_active_class_name(&space);
- zend_internal_type_error(ZEND_ARG_USES_STRICT_TYPES(), "%s%s%s() expects parameter %d to be a class name derived from %s, '%s' given",
+ zend_type_error("%s%s%s() expects parameter %d to be a class name derived from %s, '%s' given",
class_name, space, get_active_function_name(), num,
ZSTR_VAL(ce_base->name), Z_STRVAL_P(arg));
*pce = NULL;
@@ -381,7 +282,7 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_class(zval *arg, zend_class_entry **pc
const char *space;
const char *class_name = get_active_class_name(&space);
- zend_internal_type_error(ZEND_ARG_USES_STRICT_TYPES(), "%s%s%s() expects parameter %d to be a valid class name, '%s' given",
+ zend_type_error("%s%s%s() expects parameter %d to be a valid class name, '%s' given",
class_name, space, get_active_function_name(), num,
Z_STRVAL_P(arg));
return 0;
@@ -462,50 +363,6 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_long_slow(zval *arg, zend_long *dest)
}
/* }}} */
-ZEND_API int ZEND_FASTCALL zend_parse_arg_long_cap_weak(zval *arg, zend_long *dest) /* {{{ */
-{
- if (EXPECTED(Z_TYPE_P(arg) == IS_DOUBLE)) {
- if (UNEXPECTED(zend_isnan(Z_DVAL_P(arg)))) {
- return 0;
- }
- *dest = zend_dval_to_lval_cap(Z_DVAL_P(arg));
- } else if (EXPECTED(Z_TYPE_P(arg) == IS_STRING)) {
- double d;
- int type;
-
- if (UNEXPECTED((type = is_numeric_str_function(Z_STR_P(arg), dest, &d)) != IS_LONG)) {
- if (EXPECTED(type != 0)) {
- if (UNEXPECTED(zend_isnan(d))) {
- return 0;
- }
- *dest = zend_dval_to_lval_cap(d);
- } else {
- return 0;
- }
- }
- if (UNEXPECTED(EG(exception))) {
- return 0;
- }
- } else if (EXPECTED(Z_TYPE_P(arg) < IS_TRUE)) {
- *dest = 0;
- } else if (EXPECTED(Z_TYPE_P(arg) == IS_TRUE)) {
- *dest = 1;
- } else {
- return 0;
- }
- return 1;
-}
-/* }}} */
-
-ZEND_API int ZEND_FASTCALL zend_parse_arg_long_cap_slow(zval *arg, zend_long *dest) /* {{{ */
-{
- if (UNEXPECTED(ZEND_ARG_USES_STRICT_TYPES())) {
- return 0;
- }
- return zend_parse_arg_long_cap_weak(arg, dest);
-}
-/* }}} */
-
ZEND_API int ZEND_FASTCALL zend_parse_arg_double_weak(zval *arg, double *dest) /* {{{ */
{
if (EXPECTED(Z_TYPE_P(arg) == IS_LONG)) {
@@ -547,36 +404,52 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_double_slow(zval *arg, double *dest) /
}
/* }}} */
+ZEND_API int ZEND_FASTCALL zend_parse_arg_number_slow(zval *arg, zval **dest) /* {{{ */
+{
+ if (UNEXPECTED(ZEND_ARG_USES_STRICT_TYPES())) {
+ return 0;
+ }
+ if (Z_TYPE_P(arg) == IS_STRING) {
+ zend_string *str = Z_STR_P(arg);
+ zend_long lval;
+ double dval;
+ zend_uchar type = is_numeric_string(ZSTR_VAL(str), ZSTR_LEN(str), &lval, &dval, -1);
+ if (type == IS_LONG) {
+ ZVAL_LONG(arg, lval);
+ } else if (type == IS_DOUBLE) {
+ ZVAL_DOUBLE(arg, dval);
+ } else {
+ return 0;
+ }
+ zend_string_release(str);
+ } else if (Z_TYPE_P(arg) < IS_TRUE) {
+ ZVAL_LONG(arg, 0);
+ } else if (Z_TYPE_P(arg) == IS_TRUE) {
+ ZVAL_LONG(arg, 1);
+ } else {
+ return 0;
+ }
+ *dest = arg;
+ return 1;
+}
+/* }}} */
+
ZEND_API int ZEND_FASTCALL zend_parse_arg_str_weak(zval *arg, zend_string **dest) /* {{{ */
{
if (EXPECTED(Z_TYPE_P(arg) < IS_STRING)) {
convert_to_string(arg);
*dest = Z_STR_P(arg);
} else if (UNEXPECTED(Z_TYPE_P(arg) == IS_OBJECT)) {
+ zend_object *zobj = Z_OBJ_P(arg);
+
if (Z_OBJ_HANDLER_P(arg, cast_object)) {
zval obj;
- if (Z_OBJ_HANDLER_P(arg, cast_object)(arg, &obj, IS_STRING) == SUCCESS) {
- zval_ptr_dtor(arg);
+ if (zobj->handlers->cast_object(zobj, &obj, IS_STRING) == SUCCESS) {
+ OBJ_RELEASE(zobj);
ZVAL_COPY_VALUE(arg, &obj);
*dest = Z_STR_P(arg);
return 1;
}
- } else if (Z_OBJ_HANDLER_P(arg, get)) {
- zval rv;
- zval *z = Z_OBJ_HANDLER_P(arg, get)(arg, &rv);
-
- if (Z_TYPE_P(z) != IS_OBJECT) {
- zval_ptr_dtor(arg);
- if (Z_TYPE_P(z) == IS_STRING) {
- ZVAL_COPY_VALUE(arg, z);
- } else {
- ZVAL_STR(arg, zval_get_string_func(z));
- zval_ptr_dtor(z);
- }
- *dest = Z_STR_P(arg);
- return 1;
- }
- zval_ptr_dtor(z);
}
return 0;
} else {
@@ -595,7 +468,7 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_str_slow(zval *arg, zend_string **dest
}
/* }}} */
-static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, const char **spec, char **error, int *severity) /* {{{ */
+static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, const char **spec, char **error) /* {{{ */
{
const char *spec_walk = *spec;
char c = *spec_walk++;
@@ -620,7 +493,6 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons
switch (c) {
case 'l':
- case 'L':
{
zend_long *p = va_arg(*va, zend_long *);
zend_bool *is_null = NULL;
@@ -629,7 +501,7 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons
is_null = va_arg(*va, zend_bool *);
}
- if (!zend_parse_arg_long(arg, p, is_null, check_null, c == 'L')) {
+ if (!zend_parse_arg_long(arg, p, is_null, check_null)) {
return "int";
}
}
@@ -810,23 +682,16 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons
}
if (zend_fcall_info_init(arg, 0, fci, fcc, NULL, &is_callable_error) == SUCCESS) {
- if (is_callable_error) {
- *severity = E_DEPRECATED;
- zend_spprintf(error, 0, "to be a valid callback, %s", is_callable_error);
- efree(is_callable_error);
- *spec = spec_walk;
- return "";
- }
+ ZEND_ASSERT(!is_callable_error);
break;
+ }
+
+ if (is_callable_error) {
+ zend_spprintf(error, 0, "to be a valid callback, %s", is_callable_error);
+ efree(is_callable_error);
+ return "";
} else {
- if (is_callable_error) {
- *severity = E_ERROR;
- zend_spprintf(error, 0, "to be a valid callback, %s", is_callable_error);
- efree(is_callable_error);
- return "";
- } else {
- return "valid callback";
- }
+ return "valid callback";
}
}
@@ -838,9 +703,9 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons
}
break;
- case 'Z':
- /* 'Z' iz not supported anymore and should be replaced with 'z' */
- ZEND_ASSERT(c != 'Z');
+ case 'Z': /* replace with 'z' */
+ case 'L': /* replace with 'l' */
+ ZEND_ASSERT(0 && "ZPP modifier no longer supported");
default:
return "unknown";
}
@@ -855,9 +720,8 @@ static int zend_parse_arg(int arg_num, zval *arg, va_list *va, const char **spec
{
const char *expected_type = NULL;
char *error = NULL;
- int severity = 0;
- expected_type = zend_parse_arg_impl(arg_num, arg, va, spec, &error, &severity);
+ expected_type = zend_parse_arg_impl(arg_num, arg, va, spec, &error);
if (expected_type) {
if (EG(exception)) {
return FAILURE;
@@ -865,23 +729,18 @@ static int zend_parse_arg(int arg_num, zval *arg, va_list *va, const char **spec
if (!(flags & ZEND_PARSE_PARAMS_QUIET) && (*expected_type || error)) {
const char *space;
const char *class_name = get_active_class_name(&space);
- zend_bool throw_exception =
- ZEND_ARG_USES_STRICT_TYPES() || (flags & ZEND_PARSE_PARAMS_THROW);
if (error) {
- zend_internal_type_error(throw_exception, "%s%s%s() expects parameter %d %s",
+ zend_type_error("%s%s%s() expects parameter %d %s",
class_name, space, get_active_function_name(), arg_num, error);
efree(error);
} else {
- zend_internal_type_error(throw_exception,
- "%s%s%s() expects parameter %d to be %s, %s given",
+ zend_type_error("%s%s%s() expects parameter %d to be %s, %s given",
class_name, space, get_active_function_name(), arg_num, expected_type,
zend_zval_type_name(arg));
}
}
- if (severity != E_DEPRECATED) {
- return FAILURE;
- }
+ return FAILURE;
}
return SUCCESS;
@@ -983,8 +842,7 @@ static int zend_parse_va_args(int num_args, const char *type_spec, va_list *va,
if (!(flags & ZEND_PARSE_PARAMS_QUIET)) {
zend_function *active_function = EG(current_execute_data)->func;
const char *class_name = active_function->common.scope ? ZSTR_VAL(active_function->common.scope->name) : "";
- zend_bool throw_exception = ZEND_ARG_USES_STRICT_TYPES() || (flags & ZEND_PARSE_PARAMS_THROW);
- zend_internal_argument_count_error(throw_exception, "%s%s%s() expects %s %d parameter%s, %d given",
+ zend_argument_count_error("%s%s%s() expects %s %d parameter%s, %d given",
class_name,
class_name[0] ? "::" : "",
ZSTR_VAL(active_function->common.function_name),
@@ -1073,20 +931,6 @@ ZEND_API int zend_parse_parameters(int num_args, const char *type_spec, ...) /*
}
/* }}} */
-ZEND_API int zend_parse_parameters_throw(int num_args, const char *type_spec, ...) /* {{{ */
-{
- va_list va;
- int retval;
- int flags = ZEND_PARSE_PARAMS_THROW;
-
- va_start(va, type_spec);
- retval = zend_parse_va_args(num_args, type_spec, &va, flags);
- va_end(va);
-
- return retval;
-}
-/* }}} */
-
ZEND_API int zend_parse_method_parameters(int num_args, zval *this_ptr, const char *type_spec, ...) /* {{{ */
{
va_list va;
@@ -1167,7 +1011,8 @@ ZEND_API int zend_parse_method_parameters_ex(int flags, int num_args, zval *this
* because it may call __set from the uninitialized object otherwise. */
ZEND_API void zend_merge_properties(zval *obj, HashTable *properties) /* {{{ */
{
- const zend_object_handlers *obj_ht = Z_OBJ_HT_P(obj);
+ zend_object *zobj = Z_OBJ_P(obj);
+ zend_object_write_property_t write_property = zobj->handlers->write_property;
zend_class_entry *old_scope = EG(fake_scope);
zend_string *key;
zval *value;
@@ -1175,10 +1020,7 @@ ZEND_API void zend_merge_properties(zval *obj, HashTable *properties) /* {{{ */
EG(fake_scope) = Z_OBJCE_P(obj);
ZEND_HASH_FOREACH_STR_KEY_VAL(properties, key, value) {
if (key) {
- zval member;
-
- ZVAL_STR(&member, key);
- obj_ht->write_property(obj, &member, value, NULL);
+ write_property(zobj, key, value, NULL);
}
} ZEND_HASH_FOREACH_END();
EG(fake_scope) = old_scope;
@@ -1188,7 +1030,6 @@ ZEND_API void zend_merge_properties(zval *obj, HashTable *properties) /* {{{ */
ZEND_API int zend_update_class_constants(zend_class_entry *class_type) /* {{{ */
{
if (!(class_type->ce_flags & ZEND_ACC_CONSTANTS_UPDATED)) {
- zend_class_entry *ce;
zend_class_constant *c;
zval *val;
zend_property_info *prop_info;
@@ -1214,39 +1055,33 @@ ZEND_API int zend_update_class_constants(zend_class_entry *class_type) /* {{{ */
}
}
- ce = class_type;
- while (ce) {
- ZEND_HASH_FOREACH_PTR(&ce->properties_info, prop_info) {
- if (prop_info->ce == ce) {
- if (prop_info->flags & ZEND_ACC_STATIC) {
- val = CE_STATIC_MEMBERS(class_type) + prop_info->offset;
- } else {
- val = (zval*)((char*)class_type->default_properties_table + prop_info->offset - OBJ_PROP_TO_OFFSET(0));
+ ZEND_HASH_FOREACH_PTR(&class_type->properties_info, prop_info) {
+ if (prop_info->flags & ZEND_ACC_STATIC) {
+ val = CE_STATIC_MEMBERS(class_type) + prop_info->offset;
+ } else {
+ val = (zval*)((char*)class_type->default_properties_table + prop_info->offset - OBJ_PROP_TO_OFFSET(0));
+ }
+ if (Z_TYPE_P(val) == IS_CONSTANT_AST) {
+ if (ZEND_TYPE_IS_SET(prop_info->type)) {
+ zval tmp;
+
+ ZVAL_COPY(&tmp, val);
+ if (UNEXPECTED(zval_update_constant_ex(&tmp, prop_info->ce) != SUCCESS)) {
+ zval_ptr_dtor(&tmp);
+ return FAILURE;
}
- if (Z_TYPE_P(val) == IS_CONSTANT_AST) {
- if (prop_info->type) {
- zval tmp;
-
- ZVAL_COPY(&tmp, val);
- if (UNEXPECTED(zval_update_constant_ex(&tmp, ce) != SUCCESS)) {
- zval_ptr_dtor(&tmp);
- return FAILURE;
- }
- /* property initializers must always be evaluated with strict types */;
- if (UNEXPECTED(!zend_verify_property_type(prop_info, &tmp, /* strict */ 1))) {
- zval_ptr_dtor(&tmp);
- return FAILURE;
- }
- zval_ptr_dtor(val);
- ZVAL_COPY_VALUE(val, &tmp);
- } else if (UNEXPECTED(zval_update_constant_ex(val, ce) != SUCCESS)) {
- return FAILURE;
- }
+ /* property initializers must always be evaluated with strict types */;
+ if (UNEXPECTED(!zend_verify_property_type(prop_info, &tmp, /* strict */ 1))) {
+ zval_ptr_dtor(&tmp);
+ return FAILURE;
}
+ zval_ptr_dtor(val);
+ ZVAL_COPY_VALUE(val, &tmp);
+ } else if (UNEXPECTED(zval_update_constant_ex(val, prop_info->ce) != SUCCESS)) {
+ return FAILURE;
}
- } ZEND_HASH_FOREACH_END();
- ce = ce->parent;
- }
+ }
+ } ZEND_HASH_FOREACH_END();
class_type->ce_flags |= ZEND_ACC_CONSTANTS_UPDATED;
}
@@ -1301,7 +1136,7 @@ ZEND_API void object_properties_init_ex(zend_object *object, HashTable *properti
(property_info->flags & ZEND_ACC_STATIC) == 0) {
zval *slot = OBJ_PROP(object, property_info->offset);
- if (UNEXPECTED(property_info->type)) {
+ if (UNEXPECTED(ZEND_TYPE_IS_SET(property_info->type))) {
zval tmp;
ZVAL_COPY_VALUE(&tmp, prop);
@@ -1690,7 +1525,7 @@ ZEND_API int array_set_zval_key(HashTable *ht, zval *key, zval *value) /* {{{ */
result = zend_symtable_update(ht, ZSTR_EMPTY_ALLOC(), value);
break;
case IS_RESOURCE:
- zend_error(E_NOTICE, "Resource ID#%d used as offset, casting to integer (%d)", Z_RES_HANDLE_P(key), Z_RES_HANDLE_P(key));
+ zend_error(E_WARNING, "Resource ID#%d used as offset, casting to integer (%d)", Z_RES_HANDLE_P(key), Z_RES_HANDLE_P(key));
result = zend_hash_index_update(ht, Z_RES_HANDLE_P(key), value);
break;
case IS_FALSE:
@@ -1706,7 +1541,7 @@ ZEND_API int array_set_zval_key(HashTable *ht, zval *key, zval *value) /* {{{ */
result = zend_hash_index_update(ht, zend_dval_to_lval(Z_DVAL_P(key)), value);
break;
default:
- zend_error(E_WARNING, "Illegal offset type");
+ zend_type_error("Illegal offset type");
result = NULL;
}
@@ -1801,11 +1636,11 @@ ZEND_API int add_property_stringl_ex(zval *arg, const char *key, size_t key_len,
ZEND_API int add_property_zval_ex(zval *arg, const char *key, size_t key_len, zval *value) /* {{{ */
{
- zval z_key;
+ zend_string *str;
- ZVAL_STRINGL(&z_key, key, key_len);
- Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, value, NULL);
- zval_ptr_dtor(&z_key);
+ str = zend_string_init(key, key_len, 0);
+ Z_OBJ_HANDLER_P(arg, write_property)(Z_OBJ_P(arg), str, value, NULL);
+ zend_string_release_ex(str, 0);
return SUCCESS;
}
/* }}} */
@@ -2204,21 +2039,17 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
} else {
internal_function->required_num_args = info->required_num_args;
}
- if (info->return_reference) {
+ if (ZEND_ARG_SEND_MODE(info)) {
internal_function->fn_flags |= ZEND_ACC_RETURN_REFERENCE;
}
- if (ptr->arg_info[ptr->num_args].is_variadic) {
+ if (ZEND_ARG_IS_VARIADIC(&ptr->arg_info[ptr->num_args])) {
internal_function->fn_flags |= ZEND_ACC_VARIADIC;
/* Don't count the variadic argument */
internal_function->num_args--;
}
if (ZEND_TYPE_IS_SET(info->type)) {
- if (ZEND_TYPE_IS_CLASS(info->type)) {
- const char *type_name = (const char*)info->type;
-
- if (type_name[0] == '?') {
- type_name++;
- }
+ if (ZEND_TYPE_HAS_NAME(info->type)) {
+ const char *type_name = ZEND_TYPE_LITERAL_NAME(info->type);
if (!scope && (!strcasecmp(type_name, "self") || !strcasecmp(type_name, "parent"))) {
zend_error_noreturn(E_CORE_ERROR, "Cannot declare a return type of %s outside of a class scope", type_name);
}
@@ -2298,29 +2129,19 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
memcpy(new_arg_info, arg_info, sizeof(zend_arg_info) * num_args);
reg_function->common.arg_info = new_arg_info + 1;
for (i = 0; i < num_args; i++) {
- if (ZEND_TYPE_IS_CLASS(new_arg_info[i].type)) {
- const char *class_name = (const char*)new_arg_info[i].type;
- zend_bool allow_null = 0;
- zend_string *str;
-
- if (class_name[0] == '?') {
- class_name++;
- allow_null = 1;
- }
- str = zend_string_init_interned(class_name, strlen(class_name), 1);
- new_arg_info[i].type = ZEND_TYPE_ENCODE_CLASS(str, allow_null);
+ if (ZEND_TYPE_HAS_CLASS(new_arg_info[i].type)) {
+ ZEND_ASSERT(ZEND_TYPE_HAS_NAME(new_arg_info[i].type)
+ && "Only simple classes are currently supported");
+ const char *class_name = ZEND_TYPE_LITERAL_NAME(new_arg_info[i].type);
+ ZEND_TYPE_SET_PTR(new_arg_info[i].type,
+ zend_string_init_interned(class_name, strlen(class_name), 1));
}
}
}
if (scope) {
- /* Look for ctor, dtor, clone
- * If it's an old-style constructor, store it only if we don't have
- * a constructor already.
- */
- if ((fname_len == class_name_len) && !ctor && !memcmp(ZSTR_VAL(lowercase_name), lc_class_name, class_name_len+1)) {
- ctor = reg_function;
- } else if (zend_string_equals_literal(lowercase_name, "serialize")) {
+ /* Look for ctor, dtor, clone */
+ if (zend_string_equals_literal(lowercase_name, "serialize")) {
serialize_func = reg_function;
} else if (zend_string_equals_literal(lowercase_name, "unserialize")) {
unserialize_func = reg_function;
@@ -2402,26 +2223,22 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
if (ctor->common.fn_flags & ZEND_ACC_STATIC) {
zend_error(error_type, "Constructor %s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(ctor->common.function_name));
}
- ctor->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
}
if (dtor) {
dtor->common.fn_flags |= ZEND_ACC_DTOR;
if (dtor->common.fn_flags & ZEND_ACC_STATIC) {
zend_error(error_type, "Destructor %s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(dtor->common.function_name));
}
- dtor->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
}
if (clone) {
if (clone->common.fn_flags & ZEND_ACC_STATIC) {
zend_error(error_type, "%s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(clone->common.function_name));
}
- clone->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
}
if (__call) {
if (__call->common.fn_flags & ZEND_ACC_STATIC) {
zend_error(error_type, "Method %s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(__call->common.function_name));
}
- __call->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
}
if (__callstatic) {
if (!(__callstatic->common.fn_flags & ZEND_ACC_STATIC)) {
@@ -2433,31 +2250,26 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
if (__tostring->common.fn_flags & ZEND_ACC_STATIC) {
zend_error(error_type, "Method %s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(__tostring->common.function_name));
}
- __tostring->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
}
if (__get) {
if (__get->common.fn_flags & ZEND_ACC_STATIC) {
zend_error(error_type, "Method %s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(__get->common.function_name));
}
- __get->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
}
if (__set) {
if (__set->common.fn_flags & ZEND_ACC_STATIC) {
zend_error(error_type, "Method %s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(__set->common.function_name));
}
- __set->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
}
if (__unset) {
if (__unset->common.fn_flags & ZEND_ACC_STATIC) {
zend_error(error_type, "Method %s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(__unset->common.function_name));
}
- __unset->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
}
if (__isset) {
if (__isset->common.fn_flags & ZEND_ACC_STATIC) {
zend_error(error_type, "Method %s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(__isset->common.function_name));
}
- __isset->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC;
}
if (__debugInfo) {
if (__debugInfo->common.fn_flags & ZEND_ACC_STATIC) {
@@ -2838,6 +2650,7 @@ ZEND_API int zend_disable_function(char *function_name, size_t function_name_len
zend_free_internal_arg_info(func);
func->fn_flags &= ~(ZEND_ACC_VARIADIC | ZEND_ACC_HAS_TYPE_HINTS | ZEND_ACC_HAS_RETURN_TYPE);
func->num_args = 0;
+ func->required_num_args = 0;
func->arg_info = NULL;
func->handler = ZEND_FN(display_disabled_function);
return SUCCESS;
@@ -2991,11 +2804,8 @@ static int zend_is_callable_check_class(zend_string *name, zend_class_entry *sco
ZEND_API void zend_release_fcall_info_cache(zend_fcall_info_cache *fcc) {
if (fcc->function_handler &&
- ((fcc->function_handler->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) ||
- fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY ||
- fcc->function_handler->type == ZEND_OVERLOADED_FUNCTION)) {
- if (fcc->function_handler->type != ZEND_OVERLOADED_FUNCTION &&
- fcc->function_handler->common.function_name) {
+ (fcc->function_handler->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE)) {
+ if (fcc->function_handler->common.function_name) {
zend_string_release_ex(fcc->function_handler->common.function_name, 0);
}
zend_free_trampoline(fcc->function_handler);
@@ -3189,30 +2999,9 @@ get_function_via_handler:
zend_spprintf(error, 0, "cannot call abstract method %s::%s()", ZSTR_VAL(fcc->calling_scope->name), ZSTR_VAL(fcc->function_handler->common.function_name));
}
} else if (!fcc->object && !(fcc->function_handler->common.fn_flags & ZEND_ACC_STATIC)) {
- int severity;
- char *verb;
- if (fcc->function_handler->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
- severity = E_DEPRECATED;
- verb = "should not";
- } else {
- /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
- severity = E_ERROR;
- verb = "cannot";
- }
- if ((check_flags & IS_CALLABLE_CHECK_IS_STATIC) != 0) {
- retval = 0;
- }
+ retval = 0;
if (error) {
- zend_spprintf(error, 0, "non-static method %s::%s() %s be called statically", ZSTR_VAL(fcc->calling_scope->name), ZSTR_VAL(fcc->function_handler->common.function_name), verb);
- if (severity != E_DEPRECATED) {
- retval = 0;
- }
- } else if (retval) {
- if (severity == E_ERROR) {
- zend_throw_error(NULL, "Non-static method %s::%s() %s be called statically", ZSTR_VAL(fcc->calling_scope->name), ZSTR_VAL(fcc->function_handler->common.function_name), verb);
- } else {
- zend_error(severity, "Non-static method %s::%s() %s be called statically", ZSTR_VAL(fcc->calling_scope->name), ZSTR_VAL(fcc->function_handler->common.function_name), verb);
- }
+ zend_spprintf(error, 0, "non-static method %s::%s() cannot be called statically", ZSTR_VAL(fcc->calling_scope->name), ZSTR_VAL(fcc->function_handler->common.function_name));
}
}
if (retval
@@ -3303,16 +3092,18 @@ try_again:
zend_class_entry *calling_scope;
zend_function *fptr;
zend_object *object;
- if (Z_OBJ_HANDLER_P(callable, get_closure)
- && Z_OBJ_HANDLER_P(callable, get_closure)(callable, &calling_scope, &fptr, &object) == SUCCESS) {
- zend_class_entry *ce = Z_OBJCE_P(callable);
+ zend_object *zobj = Z_OBJ_P(callable);
+
+ if (zobj->handlers->get_closure
+ && zobj->handlers->get_closure(zobj, &calling_scope, &fptr, &object, 1) == SUCCESS) {
+ zend_class_entry *ce = zobj->ce;
zend_string *callable_name = zend_string_alloc(
ZSTR_LEN(ce->name) + sizeof("::__invoke") - 1, 0);
memcpy(ZSTR_VAL(callable_name), ZSTR_VAL(ce->name), ZSTR_LEN(ce->name));
memcpy(ZSTR_VAL(callable_name) + ZSTR_LEN(ce->name), "::__invoke", sizeof("::__invoke"));
return callable_name;
}
- return zval_get_string(callable);
+ return zval_get_string_func(callable);
}
case IS_REFERENCE:
callable = Z_REFVAL_P(callable);
@@ -3429,17 +3220,12 @@ check_func:
}
return 0;
case IS_OBJECT:
- if (Z_OBJ_HANDLER_P(callable, get_closure)) {
- if (Z_OBJ_HANDLER_P(callable, get_closure)(callable, &fcc->calling_scope, &fcc->function_handler, &fcc->object) == SUCCESS) {
- fcc->called_scope = fcc->calling_scope;
- if (fcc == &fcc_local) {
- zend_release_fcall_info_cache(fcc);
- }
- return 1;
- } else {
- /* Discard exceptions thrown from Z_OBJ_HANDLER_P(callable, get_closure) */
- zend_clear_exception();
+ if (Z_OBJ_HANDLER_P(callable, get_closure) && Z_OBJ_HANDLER_P(callable, get_closure)(Z_OBJ_P(callable), &fcc->calling_scope, &fcc->function_handler, &fcc->object, 1) == SUCCESS) {
+ fcc->called_scope = fcc->calling_scope;
+ if (fcc == &fcc_local) {
+ zend_release_fcall_info_cache(fcc);
}
+ return 1;
}
if (error) *error = estrdup("no array or string given");
return 0;
@@ -3472,7 +3258,7 @@ ZEND_API zend_bool zend_make_callable(zval *callable, zend_string **callable_nam
{
zend_fcall_info_cache fcc;
- if (zend_is_callable_ex(callable, NULL, IS_CALLABLE_STRICT, callable_name, &fcc, NULL)) {
+ if (zend_is_callable_ex(callable, NULL, 0, callable_name, &fcc, NULL)) {
if (Z_TYPE_P(callable) == IS_STRING && fcc.calling_scope) {
zval_ptr_dtor_str(callable);
array_init(callable);
@@ -3928,7 +3714,7 @@ ZEND_API int zend_try_assign_typed_ref_zval_ex(zend_reference *ref, zval *zv, ze
ZEND_API int zend_declare_property_ex(zend_class_entry *ce, zend_string *name, zval *property, int access_type, zend_string *doc_comment) /* {{{ */
{
- return zend_declare_typed_property(ce, name, property, access_type, doc_comment, 0);
+ return zend_declare_typed_property(ce, name, property, access_type, doc_comment, (zend_type) ZEND_TYPE_INIT_NONE(0));
}
/* }}} */
@@ -4106,13 +3892,11 @@ ZEND_API int zend_declare_class_constant_string(zend_class_entry *ce, const char
ZEND_API void zend_update_property_ex(zend_class_entry *scope, zval *object, zend_string *name, zval *value) /* {{{ */
{
- zval property;
zend_class_entry *old_scope = EG(fake_scope);
EG(fake_scope) = scope;
- ZVAL_STR(&property, name);
- Z_OBJ_HT_P(object)->write_property(object, &property, value, NULL);
+ Z_OBJ_HT_P(object)->write_property(Z_OBJ_P(object), name, value, NULL);
EG(fake_scope) = old_scope;
}
@@ -4120,14 +3904,14 @@ ZEND_API void zend_update_property_ex(zend_class_entry *scope, zval *object, zen
ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, const char *name, size_t name_length, zval *value) /* {{{ */
{
- zval property;
+ zend_string *property;
zend_class_entry *old_scope = EG(fake_scope);
EG(fake_scope) = scope;
- ZVAL_STRINGL(&property, name, name_length);
- Z_OBJ_HT_P(object)->write_property(object, &property, value, NULL);
- zval_ptr_dtor(&property);
+ property = zend_string_init(name, name_length, 0);
+ Z_OBJ_HT_P(object)->write_property(Z_OBJ_P(object), property, value, NULL);
+ zend_string_release_ex(property, 0);
EG(fake_scope) = old_scope;
}
@@ -4144,14 +3928,14 @@ ZEND_API void zend_update_property_null(zend_class_entry *scope, zval *object, c
ZEND_API void zend_unset_property(zend_class_entry *scope, zval *object, const char *name, size_t name_length) /* {{{ */
{
- zval property;
+ zend_string *property;
zend_class_entry *old_scope = EG(fake_scope);
EG(fake_scope) = scope;
- ZVAL_STRINGL(&property, name, name_length);
- Z_OBJ_HT_P(object)->unset_property(object, &property, 0);
- zval_ptr_dtor(&property);
+ property = zend_string_init(name, name_length, 0);
+ Z_OBJ_HT_P(object)->unset_property(Z_OBJ_P(object), property, 0);
+ zend_string_release_ex(property, 0);
EG(fake_scope) = old_scope;
}
@@ -4235,7 +4019,7 @@ ZEND_API int zend_update_static_property_ex(zend_class_entry *scope, zend_string
ZEND_ASSERT(!Z_ISREF_P(value));
Z_TRY_ADDREF_P(value);
- if (prop_info->type) {
+ if (ZEND_TYPE_IS_SET(prop_info->type)) {
ZVAL_COPY_VALUE(&tmp, value);
if (!zend_verify_property_type(prop_info, &tmp, /* strict */ 0)) {
Z_TRY_DELREF_P(value);
@@ -4316,13 +4100,12 @@ ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, const
ZEND_API zval *zend_read_property_ex(zend_class_entry *scope, zval *object, zend_string *name, zend_bool silent, zval *rv) /* {{{ */
{
- zval property, *value;
+ zval *value;
zend_class_entry *old_scope = EG(fake_scope);
EG(fake_scope) = scope;
- ZVAL_STR(&property, name);
- value = Z_OBJ_HT_P(object)->read_property(object, &property, silent?BP_VAR_IS:BP_VAR_R, NULL, rv);
+ value = Z_OBJ_HT_P(object)->read_property(Z_OBJ_P(object), name, silent?BP_VAR_IS:BP_VAR_R, NULL, rv);
EG(fake_scope) = old_scope;
return value;
@@ -4493,7 +4276,7 @@ ZEND_API zend_bool zend_is_iterable(zval *iterable) /* {{{ */
case IS_ARRAY:
return 1;
case IS_OBJECT:
- return instanceof_function(Z_OBJCE_P(iterable), zend_ce_traversable);
+ return zend_class_implements_interface(Z_OBJCE_P(iterable), zend_ce_traversable);
default:
return 0;
}
@@ -4510,7 +4293,7 @@ ZEND_API zend_bool zend_is_countable(zval *countable) /* {{{ */
return 1;
}
- return instanceof_function(Z_OBJCE_P(countable), zend_ce_countable);
+ return zend_class_implements_interface(Z_OBJCE_P(countable), zend_ce_countable);
default:
return 0;
}
diff --git a/Zend/zend_API.h b/Zend/zend_API.h
index 2a3b582902..70879fe2a8 100644
--- a/Zend/zend_API.h
+++ b/Zend/zend_API.h
@@ -27,6 +27,7 @@
#include "zend_operators.h"
#include "zend_variables.h"
#include "zend_execute.h"
+#include "zend_type_info.h"
BEGIN_EXTERN_C()
@@ -95,34 +96,55 @@ typedef struct _zend_fcall_info_cache {
#define ZEND_FE_END { NULL, NULL, NULL, 0, 0 }
-#define ZEND_ARG_INFO(pass_by_ref, name) { #name, 0, pass_by_ref, 0},
-#define ZEND_ARG_PASS_INFO(pass_by_ref) { NULL, 0, pass_by_ref, 0},
-#define ZEND_ARG_OBJ_INFO(pass_by_ref, name, classname, allow_null) { #name, ZEND_TYPE_ENCODE_CLASS_CONST(#classname, allow_null), pass_by_ref, 0 },
-#define ZEND_ARG_ARRAY_INFO(pass_by_ref, name, allow_null) { #name, ZEND_TYPE_ENCODE(IS_ARRAY, allow_null), pass_by_ref, 0 },
-#define ZEND_ARG_CALLABLE_INFO(pass_by_ref, name, allow_null) { #name, ZEND_TYPE_ENCODE(IS_CALLABLE, allow_null), pass_by_ref, 0 },
-#define ZEND_ARG_TYPE_INFO(pass_by_ref, name, type_hint, allow_null) { #name, ZEND_TYPE_ENCODE(type_hint, allow_null), pass_by_ref, 0 },
-#define ZEND_ARG_VARIADIC_INFO(pass_by_ref, name) { #name, 0, pass_by_ref, 1 },
-#define ZEND_ARG_VARIADIC_TYPE_INFO(pass_by_ref, name, type_hint, allow_null) { #name, ZEND_TYPE_ENCODE(type_hint, allow_null), pass_by_ref, 1 },
-#define ZEND_ARG_VARIADIC_OBJ_INFO(pass_by_ref, name, classname, allow_null) { #name, ZEND_TYPE_ENCODE_CLASS_CONST(#classname, allow_null), pass_by_ref, 1 },
+#define _ZEND_ARG_INFO_FLAGS(pass_by_ref, is_variadic) \
+ (((pass_by_ref) << _ZEND_SEND_MODE_SHIFT) | ((is_variadic) ? _ZEND_IS_VARIADIC_BIT : 0))
+
+#define ZEND_ARG_INFO(pass_by_ref, name) \
+ { #name, ZEND_TYPE_INIT_NONE(_ZEND_ARG_INFO_FLAGS(pass_by_ref, 0))},
+#define ZEND_ARG_OBJ_INFO(pass_by_ref, name, classname, allow_null) \
+ { #name, ZEND_TYPE_INIT_CLASS_CONST(#classname, allow_null, _ZEND_ARG_INFO_FLAGS(pass_by_ref, 0)) },
+#define ZEND_ARG_ARRAY_INFO(pass_by_ref, name, allow_null) \
+ { #name, ZEND_TYPE_INIT_CODE(IS_ARRAY, allow_null, _ZEND_ARG_INFO_FLAGS(pass_by_ref, 0)) },
+#define ZEND_ARG_CALLABLE_INFO(pass_by_ref, name, allow_null) \
+ { #name, ZEND_TYPE_INIT_CODE(IS_CALLABLE, allow_null, _ZEND_ARG_INFO_FLAGS(pass_by_ref, 0)) },
+#define ZEND_ARG_TYPE_INFO(pass_by_ref, name, type_hint, allow_null) \
+ { #name, ZEND_TYPE_INIT_CODE(type_hint, allow_null, _ZEND_ARG_INFO_FLAGS(pass_by_ref, 0)) },
+#define ZEND_ARG_TYPE_MASK(pass_by_ref, name, type_mask) \
+ { #name, ZEND_TYPE_INIT_MASK(type_mask | _ZEND_ARG_INFO_FLAGS(pass_by_ref, 0)) },
+#define ZEND_ARG_VARIADIC_INFO(pass_by_ref, name) \
+ { #name, ZEND_TYPE_INIT_NONE(_ZEND_ARG_INFO_FLAGS(pass_by_ref, 1)) },
+#define ZEND_ARG_VARIADIC_TYPE_INFO(pass_by_ref, name, type_hint, allow_null) \
+ { #name, ZEND_TYPE_INIT_CODE(type_hint, allow_null, _ZEND_ARG_INFO_FLAGS(pass_by_ref, 1)) },
+#define ZEND_ARG_VARIADIC_OBJ_INFO(pass_by_ref, name, classname, allow_null) \
+ { #name, ZEND_TYPE_INIT_CLASS_CONST(#classname, allow_null, _ZEND_ARG_INFO_FLAGS(pass_by_ref, 1)) },
#define ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(name, return_reference, required_num_args, class_name, allow_null) \
static const zend_internal_arg_info name[] = { \
- { (const char*)(zend_uintptr_t)(required_num_args), ZEND_TYPE_ENCODE_CLASS_CONST(#class_name, allow_null), return_reference, 0 },
+ { (const char*)(zend_uintptr_t)(required_num_args), \
+ ZEND_TYPE_INIT_CLASS_CONST(#class_name, allow_null, _ZEND_ARG_INFO_FLAGS(return_reference, 0)) },
#define ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO(name, class_name, allow_null) \
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(name, 0, -1, class_name, allow_null)
+#define ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(name, return_reference, required_num_args, type) \
+ static const zend_internal_arg_info name[] = { \
+ { (const char*)(zend_uintptr_t)(required_num_args), ZEND_TYPE_INIT_MASK(type | _ZEND_ARG_INFO_FLAGS(return_reference, 0)) },
+
+#define ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(name, return_reference, required_num_args, class_name, type) \
+ static const zend_internal_arg_info name[] = { \
+ { (const char*)(zend_uintptr_t)(required_num_args), ZEND_TYPE_INIT_CLASS_CONST_MASK(#class_name, type | _ZEND_ARG_INFO_FLAGS(return_reference, 0)) },
+
#define ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, type, allow_null) \
static const zend_internal_arg_info name[] = { \
- { (const char*)(zend_uintptr_t)(required_num_args), ZEND_TYPE_ENCODE(type, allow_null), return_reference, 0 },
+ { (const char*)(zend_uintptr_t)(required_num_args), ZEND_TYPE_INIT_CODE(type, allow_null, _ZEND_ARG_INFO_FLAGS(return_reference, 0)) },
#define ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(name, type, allow_null) \
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(name, 0, -1, type, allow_null)
#define ZEND_BEGIN_ARG_INFO_EX(name, _unused, return_reference, required_num_args) \
static const zend_internal_arg_info name[] = { \
- { (const char*)(zend_uintptr_t)(required_num_args), 0, return_reference, 0 },
+ { (const char*)(zend_uintptr_t)(required_num_args), ZEND_TYPE_INIT_NONE(_ZEND_ARG_INFO_FLAGS(return_reference, 0)) },
#define ZEND_BEGIN_ARG_INFO(name, _unused) \
- ZEND_BEGIN_ARG_INFO_EX(name, 0, ZEND_RETURN_VALUE, -1)
+ ZEND_BEGIN_ARG_INFO_EX(name, {}, ZEND_RETURN_VALUE, -1)
#define ZEND_END_ARG_INFO() };
/* Name macros */
@@ -249,16 +271,18 @@ ZEND_API int zend_copy_parameters_array(int param_count, zval *argument_array);
#define zend_parse_parameters_none() \
(EXPECTED(ZEND_NUM_ARGS() == 0) ? SUCCESS : (zend_wrong_parameters_none_error(), FAILURE))
#define zend_parse_parameters_none_throw() \
- (EXPECTED(ZEND_NUM_ARGS() == 0) ? SUCCESS : (zend_wrong_parameters_none_exception(), FAILURE))
+ zend_parse_parameters_none()
/* Parameter parsing API -- andrei */
+#define ZEND_PARSE_PARAMS_THROW 0 /* No longer used, zpp always uses exceptions */
#define ZEND_PARSE_PARAMS_QUIET (1<<1)
-#define ZEND_PARSE_PARAMS_THROW (1<<2)
ZEND_API int zend_parse_parameters(int num_args, const char *type_spec, ...);
ZEND_API int zend_parse_parameters_ex(int flags, int num_args, const char *type_spec, ...);
-ZEND_API int zend_parse_parameters_throw(int num_args, const char *type_spec, ...);
-ZEND_API char *zend_zval_type_name(const zval *arg);
+/* NOTE: This must have at least one value in __VA_ARGS__ for the expression to be valid */
+#define zend_parse_parameters_throw(num_args, ...) \
+ zend_parse_parameters(num_args, __VA_ARGS__)
+ZEND_API const char *zend_zval_type_name(const zval *arg);
ZEND_API zend_string *zend_zval_get_type(const zval *arg);
ZEND_API int zend_parse_method_parameters(int num_args, zval *this_ptr, const char *type_spec, ...);
@@ -298,11 +322,8 @@ ZEND_API ZEND_COLD void zend_wrong_param_count(void);
#define IS_CALLABLE_CHECK_SYNTAX_ONLY (1<<0)
#define IS_CALLABLE_CHECK_NO_ACCESS (1<<1)
-#define IS_CALLABLE_CHECK_IS_STATIC (1<<2)
#define IS_CALLABLE_CHECK_SILENT (1<<3)
-#define IS_CALLABLE_STRICT (IS_CALLABLE_CHECK_IS_STATIC)
-
ZEND_API void zend_release_fcall_info_cache(zend_fcall_info_cache *fcc);
ZEND_API zend_string *zend_get_callable_name_ex(zval *callable, zend_object *object);
ZEND_API zend_string *zend_get_callable_name(zval *callable);
@@ -360,7 +381,7 @@ ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, const c
ZEND_API zval *zend_read_static_property_ex(zend_class_entry *scope, zend_string *name, zend_bool silent);
ZEND_API zval *zend_read_static_property(zend_class_entry *scope, const char *name, size_t name_length, zend_bool silent);
-ZEND_API char *zend_get_type_by_const(int type);
+ZEND_API const char *zend_get_type_by_const(int type);
#define ZEND_THIS (&EX(This))
@@ -477,7 +498,6 @@ ZEND_API extern const zend_fcall_info_cache empty_fcall_info_cache;
* fci->param_count = 0;
* fci->params = NULL;
* The callable_name argument may be NULL.
- * Set check_flags to IS_CALLABLE_STRICT for every new usage!
*/
ZEND_API int zend_fcall_info_init(zval *callable, uint32_t check_flags, zend_fcall_info *fci, zend_fcall_info_cache *fcc, zend_string **callable_name, char **error);
@@ -542,7 +562,7 @@ static zend_always_inline int zend_forbid_dynamic_call(const char *func_name)
ZEND_ASSERT(ex != NULL && ex->func != NULL);
if (ZEND_CALL_INFO(ex) & ZEND_CALL_DYNAMIC) {
- zend_error(E_WARNING, "Cannot call %s dynamically", func_name);
+ zend_throw_error(NULL, "Cannot call %s dynamically", func_name);
return FAILURE;
}
@@ -632,30 +652,35 @@ END_EXTERN_C()
#define RETVAL_ARR(r) ZVAL_ARR(return_value, r)
#define RETVAL_EMPTY_ARRAY() ZVAL_EMPTY_ARRAY(return_value)
#define RETVAL_OBJ(r) ZVAL_OBJ(return_value, r)
+#define RETVAL_COPY(zv) ZVAL_COPY(return_value, zv)
+#define RETVAL_COPY_VALUE(zv) ZVAL_COPY_VALUE(return_value, zv)
#define RETVAL_ZVAL(zv, copy, dtor) ZVAL_ZVAL(return_value, zv, copy, dtor)
#define RETVAL_FALSE ZVAL_FALSE(return_value)
#define RETVAL_TRUE ZVAL_TRUE(return_value)
-#define RETURN_BOOL(b) { RETVAL_BOOL(b); return; }
-#define RETURN_NULL() { RETVAL_NULL(); return;}
-#define RETURN_LONG(l) { RETVAL_LONG(l); return; }
-#define RETURN_DOUBLE(d) { RETVAL_DOUBLE(d); return; }
-#define RETURN_STR(s) { RETVAL_STR(s); return; }
-#define RETURN_INTERNED_STR(s) { RETVAL_INTERNED_STR(s); return; }
-#define RETURN_NEW_STR(s) { RETVAL_NEW_STR(s); return; }
-#define RETURN_STR_COPY(s) { RETVAL_STR_COPY(s); return; }
-#define RETURN_STRING(s) { RETVAL_STRING(s); return; }
-#define RETURN_STRINGL(s, l) { RETVAL_STRINGL(s, l); return; }
-#define RETURN_EMPTY_STRING() { RETVAL_EMPTY_STRING(); return; }
-#define RETURN_RES(r) { RETVAL_RES(r); return; }
-#define RETURN_ARR(r) { RETVAL_ARR(r); return; }
-#define RETURN_EMPTY_ARRAY() { RETVAL_EMPTY_ARRAY(); return; }
-#define RETURN_OBJ(r) { RETVAL_OBJ(r); return; }
-#define RETURN_ZVAL(zv, copy, dtor) { RETVAL_ZVAL(zv, copy, dtor); return; }
-#define RETURN_FALSE { RETVAL_FALSE; return; }
-#define RETURN_TRUE { RETVAL_TRUE; return; }
-
-#define HASH_OF(p) (Z_TYPE_P(p)==IS_ARRAY ? Z_ARRVAL_P(p) : ((Z_TYPE_P(p)==IS_OBJECT ? Z_OBJ_HT_P(p)->get_properties((p)) : NULL)))
+#define RETURN_BOOL(b) do { RETVAL_BOOL(b); return; } while (0)
+#define RETURN_NULL() do { RETVAL_NULL(); return;} while (0)
+#define RETURN_LONG(l) do { RETVAL_LONG(l); return; } while (0)
+#define RETURN_DOUBLE(d) do { RETVAL_DOUBLE(d); return; } while (0)
+#define RETURN_STR(s) do { RETVAL_STR(s); return; } while (0)
+#define RETURN_INTERNED_STR(s) do { RETVAL_INTERNED_STR(s); return; } while (0)
+#define RETURN_NEW_STR(s) do { RETVAL_NEW_STR(s); return; } while (0)
+#define RETURN_STR_COPY(s) do { RETVAL_STR_COPY(s); return; } while (0)
+#define RETURN_STRING(s) do { RETVAL_STRING(s); return; } while (0)
+#define RETURN_STRINGL(s, l) do { RETVAL_STRINGL(s, l); return; } while (0)
+#define RETURN_EMPTY_STRING() do { RETVAL_EMPTY_STRING(); return; } while (0)
+#define RETURN_RES(r) do { RETVAL_RES(r); return; } while (0)
+#define RETURN_ARR(r) do { RETVAL_ARR(r); return; } while (0)
+#define RETURN_EMPTY_ARRAY() do { RETVAL_EMPTY_ARRAY(); return; } while (0)
+#define RETURN_OBJ(r) do { RETVAL_OBJ(r); return; } while (0)
+#define RETURN_COPY(zv) do { RETVAL_COPY(zv); return; } while (0)
+#define RETURN_COPY_VALUE(zv) do { RETVAL_COPY_VALUE(zv); return; } while (0)
+#define RETURN_ZVAL(zv, copy, dtor) do { RETVAL_ZVAL(zv, copy, dtor); return; } while (0)
+#define RETURN_FALSE do { RETVAL_FALSE; return; } while (0)
+#define RETURN_TRUE do { RETVAL_TRUE; return; } while (0)
+#define RETURN_THROWS() do { ZEND_ASSERT(EG(exception)); (void) return_value; return; } while (0)
+
+#define HASH_OF(p) (Z_TYPE_P(p)==IS_ARRAY ? Z_ARRVAL_P(p) : ((Z_TYPE_P(p)==IS_OBJECT ? Z_OBJ_HT_P(p)->get_properties(Z_OBJ_P(p)) : NULL)))
#define ZVAL_IS_NULL(z) (Z_TYPE_P(z) == IS_NULL)
/* For compatibility */
@@ -1107,7 +1132,9 @@ static zend_always_inline zval *zend_try_array_init(zval *zv)
_(Z_EXPECTED_RESOURCE, "resource") \
_(Z_EXPECTED_PATH, "a valid path") \
_(Z_EXPECTED_OBJECT, "object") \
- _(Z_EXPECTED_DOUBLE, "float")
+ _(Z_EXPECTED_DOUBLE, "float") \
+ _(Z_EXPECTED_NUMBER, "int or float") \
+ _(Z_EXPECTED_STRING_OR_ARRAY, "string or array") \
#define Z_EXPECTED_TYPE_ENUM(id, str) id,
#define Z_EXPECTED_TYPE_STR(id, str) str,
@@ -1118,16 +1145,10 @@ typedef enum _zend_expected_type {
} zend_expected_type;
ZEND_API ZEND_COLD int ZEND_FASTCALL zend_wrong_parameters_none_error(void);
-ZEND_API ZEND_COLD int ZEND_FASTCALL zend_wrong_parameters_none_exception(void);
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameters_count_error(int min_num_args, int max_num_args);
-ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameters_count_exception(int min_num_args, int max_num_args);
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_type_error(int num, zend_expected_type expected_type, zval *arg);
-ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_type_exception(int num, zend_expected_type expected_type, zval *arg);
-ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_error(int num, char *name, zval *arg);
-ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_exception(int num, char *name, zval *arg);
+ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_error(int num, const char *name, zval *arg);
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_error(int num, char *error);
-ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_deprecated(int num, char *error);
-ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_exception(int num, char *error);
#define ZPP_ERROR_OK 0
#define ZPP_ERROR_FAILURE 1
@@ -1161,11 +1182,7 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_exception(int num, cha
(UNEXPECTED(_num_args > _max_num_args) && \
EXPECTED(_max_num_args >= 0))) { \
if (!(_flags & ZEND_PARSE_PARAMS_QUIET)) { \
- if (_flags & ZEND_PARSE_PARAMS_THROW) { \
- zend_wrong_parameters_count_exception(_min_num_args, _max_num_args); \
- } else { \
- zend_wrong_parameters_count_error(_min_num_args, _max_num_args); \
- } \
+ zend_wrong_parameters_count_error(_min_num_args, _max_num_args); \
} \
_error_code = ZPP_ERROR_FAILURE; \
break; \
@@ -1187,23 +1204,11 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_exception(int num, cha
if (UNEXPECTED(_error_code != ZPP_ERROR_OK)) { \
if (!(_flags & ZEND_PARSE_PARAMS_QUIET)) { \
if (_error_code == ZPP_ERROR_WRONG_CALLBACK) { \
- if (_flags & ZEND_PARSE_PARAMS_THROW) { \
- zend_wrong_callback_exception(_i, _error); \
- } else { \
- zend_wrong_callback_error(_i, _error); \
- } \
+ zend_wrong_callback_error(_i, _error); \
} else if (_error_code == ZPP_ERROR_WRONG_CLASS) { \
- if (_flags & ZEND_PARSE_PARAMS_THROW) { \
- zend_wrong_parameter_class_exception(_i, _error, _arg); \
- } else { \
- zend_wrong_parameter_class_error(_i, _error, _arg); \
- } \
+ zend_wrong_parameter_class_error(_i, _error, _arg); \
} else if (_error_code == ZPP_ERROR_WRONG_ARG) { \
- if (_flags & ZEND_PARSE_PARAMS_THROW) { \
- zend_wrong_parameter_type_exception(_i, _expected_type, _arg); \
- } else { \
- zend_wrong_parameter_type_error(_i, _expected_type, _arg); \
- } \
+ zend_wrong_parameter_type_error(_i, _expected_type, _arg); \
} \
} \
failure; \
@@ -1250,6 +1255,9 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_exception(int num, cha
#define Z_PARAM_ARRAY(dest) \
Z_PARAM_ARRAY_EX(dest, 0, 0)
+#define Z_PARAM_ARRAY_OR_NULL(dest) \
+ Z_PARAM_ARRAY_EX(dest, 1, 0)
+
/* old "A" */
#define Z_PARAM_ARRAY_OR_OBJECT_EX2(dest, check_null, deref, separate) \
Z_PARAM_PROLOGUE(deref, separate); \
@@ -1316,14 +1324,11 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_exception(int num, cha
if (!_error) { \
_expected_type = Z_EXPECTED_FUNC; \
_error_code = ZPP_ERROR_WRONG_ARG; \
- break; \
} else { \
_error_code = ZPP_ERROR_WRONG_CALLBACK; \
- break; \
} \
- } else if (UNEXPECTED(_error != NULL)) { \
- zend_wrong_callback_deprecated(_i, _error); \
- }
+ break; \
+ } \
#define Z_PARAM_FUNC_EX(dest_fci, dest_fcc, check_null, separate) \
Z_PARAM_FUNC_EX2(dest_fci, dest_fcc, check_null, separate, separate)
@@ -1364,7 +1369,7 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_exception(int num, cha
/* old "l" */
#define Z_PARAM_LONG_EX2(dest, is_null, check_null, deref, separate) \
Z_PARAM_PROLOGUE(deref, separate); \
- if (UNEXPECTED(!zend_parse_arg_long(_arg, &dest, &is_null, check_null, 0))) { \
+ if (UNEXPECTED(!zend_parse_arg_long(_arg, &dest, &is_null, check_null))) { \
_expected_type = Z_EXPECTED_LONG; \
_error_code = ZPP_ERROR_WRONG_ARG; \
break; \
@@ -1376,20 +1381,23 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_exception(int num, cha
#define Z_PARAM_LONG(dest) \
Z_PARAM_LONG_EX(dest, _dummy, 0, 0)
-/* old "L" */
-#define Z_PARAM_STRICT_LONG_EX2(dest, is_null, check_null, deref, separate) \
- Z_PARAM_PROLOGUE(deref, separate); \
- if (UNEXPECTED(!zend_parse_arg_long(_arg, &dest, &is_null, check_null, 1))) { \
- _expected_type = Z_EXPECTED_LONG; \
- _error_code = ZPP_ERROR_WRONG_ARG; \
- break; \
- }
+#define Z_PARAM_LONG_OR_NULL(dest, is_null) \
+ Z_PARAM_LONG_EX(dest, is_null, 1, 0)
+
+/* no old equivalent */
+#define Z_PARAM_NUMBER_EX(dest, check_null) \
+ Z_PARAM_PROLOGUE(0, 0); \
+ if (UNEXPECTED(!zend_parse_arg_number(_arg, &dest, check_null))) { \
+ _expected_type = Z_EXPECTED_NUMBER; \
+ _error_code = ZPP_ERROR_WRONG_ARG; \
+ break; \
+ }
-#define Z_PARAM_STRICT_LONG_EX(dest, is_null, check_null, separate) \
- Z_PARAM_STRICT_LONG_EX2(dest, is_null, check_null, separate, separate)
+#define Z_PARAM_NUMBER_OR_NULL(dest) \
+ Z_PARAM_NUMBER_EX(dest, 1)
-#define Z_PARAM_STRICT_LONG(dest) \
- Z_PARAM_STRICT_LONG_EX(dest, _dummy, 0, 0)
+#define Z_PARAM_NUMBER(dest) \
+ Z_PARAM_NUMBER_EX(dest, 0)
/* old "o" */
#define Z_PARAM_OBJECT_EX2(dest, check_null, deref, separate) \
@@ -1487,6 +1495,9 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_exception(int num, cha
#define Z_PARAM_STRING(dest, dest_len) \
Z_PARAM_STRING_EX(dest, dest_len, 0, 0)
+#define Z_PARAM_STRING_OR_NULL(dest, dest_len) \
+ Z_PARAM_STRING_EX(dest, dest_len, 1, 0)
+
/* old "S" */
#define Z_PARAM_STR_EX2(dest, check_null, deref, separate) \
Z_PARAM_PROLOGUE(deref, separate); \
@@ -1513,14 +1524,6 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_exception(int num, cha
#define Z_PARAM_ZVAL(dest) \
Z_PARAM_ZVAL_EX(dest, 0, 0)
-/* old "z" (with dereference) */
-#define Z_PARAM_ZVAL_DEREF_EX(dest, check_null, separate) \
- Z_PARAM_PROLOGUE(1, separate); \
- zend_parse_arg_zval_deref(_arg, &dest, check_null);
-
-#define Z_PARAM_ZVAL_DEREF(dest) \
- Z_PARAM_ZVAL_DEREF_EX(dest, 0, 0)
-
/* old "+" and "*" */
#define Z_PARAM_VARIADIC_EX(spec, dest, dest_num, post_varargs) do { \
int _num_varargs = _num_args - _i - (post_varargs); \
@@ -1538,6 +1541,14 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_exception(int num, cha
#define Z_PARAM_VARIADIC(spec, dest, dest_num) \
Z_PARAM_VARIADIC_EX(spec, dest, dest_num, 0)
+#define Z_PARAM_STR_OR_ARRAY_HT(dest_str, dest_ht) \
+ Z_PARAM_PROLOGUE(0, 0); \
+ if (UNEXPECTED(!zend_parse_arg_str_or_array_ht(_arg, &dest_str, &dest_ht))) { \
+ _expected_type = Z_EXPECTED_STRING_OR_ARRAY; \
+ _error_code = ZPP_ERROR_WRONG_ARG; \
+ break; \
+ }
+
/* End of new parameter parsing API */
/* Inlined implementations shared by new and old parameter parsing APIs */
@@ -1547,12 +1558,11 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_bool_slow(zval *arg, zend_bool *dest);
ZEND_API int ZEND_FASTCALL zend_parse_arg_bool_weak(zval *arg, zend_bool *dest);
ZEND_API int ZEND_FASTCALL zend_parse_arg_long_slow(zval *arg, zend_long *dest);
ZEND_API int ZEND_FASTCALL zend_parse_arg_long_weak(zval *arg, zend_long *dest);
-ZEND_API int ZEND_FASTCALL zend_parse_arg_long_cap_slow(zval *arg, zend_long *dest);
-ZEND_API int ZEND_FASTCALL zend_parse_arg_long_cap_weak(zval *arg, zend_long *dest);
ZEND_API int ZEND_FASTCALL zend_parse_arg_double_slow(zval *arg, double *dest);
ZEND_API int ZEND_FASTCALL zend_parse_arg_double_weak(zval *arg, double *dest);
ZEND_API int ZEND_FASTCALL zend_parse_arg_str_slow(zval *arg, zend_string **dest);
ZEND_API int ZEND_FASTCALL zend_parse_arg_str_weak(zval *arg, zend_string **dest);
+ZEND_API int ZEND_FASTCALL zend_parse_arg_number_slow(zval *arg, zval **dest);
static zend_always_inline int zend_parse_arg_bool(zval *arg, zend_bool *dest, zend_bool *is_null, int check_null)
{
@@ -1572,7 +1582,7 @@ static zend_always_inline int zend_parse_arg_bool(zval *arg, zend_bool *dest, ze
return 1;
}
-static zend_always_inline int zend_parse_arg_long(zval *arg, zend_long *dest, zend_bool *is_null, int check_null, int cap)
+static zend_always_inline int zend_parse_arg_long(zval *arg, zend_long *dest, zend_bool *is_null, int check_null)
{
if (check_null) {
*is_null = 0;
@@ -1582,8 +1592,6 @@ static zend_always_inline int zend_parse_arg_long(zval *arg, zend_long *dest, ze
} else if (check_null && Z_TYPE_P(arg) == IS_NULL) {
*is_null = 1;
*dest = 0;
- } else if (cap) {
- return zend_parse_arg_long_cap_slow(arg, dest);
} else {
return zend_parse_arg_long_slow(arg, dest);
}
@@ -1606,6 +1614,18 @@ static zend_always_inline int zend_parse_arg_double(zval *arg, double *dest, zen
return 1;
}
+static zend_always_inline int zend_parse_arg_number(zval *arg, zval **dest, int check_null)
+{
+ if (EXPECTED(Z_TYPE_P(arg) == IS_LONG || Z_TYPE_P(arg) == IS_DOUBLE)) {
+ *dest = arg;
+ } else if (check_null && EXPECTED(Z_TYPE_P(arg) == IS_NULL)) {
+ *dest = NULL;
+ } else {
+ return zend_parse_arg_number_slow(arg, dest);
+ }
+ return 1;
+}
+
static zend_always_inline int zend_parse_arg_str(zval *arg, zend_string **dest, int check_null)
{
if (EXPECTED(Z_TYPE_P(arg) == IS_STRING)) {
@@ -1679,15 +1699,16 @@ static zend_always_inline int zend_parse_arg_array_ht(zval *arg, HashTable **des
if (EXPECTED(Z_TYPE_P(arg) == IS_ARRAY)) {
*dest = Z_ARRVAL_P(arg);
} else if (or_object && EXPECTED(Z_TYPE_P(arg) == IS_OBJECT)) {
+ zend_object *zobj = Z_OBJ_P(arg);
if (separate
- && Z_OBJ_P(arg)->properties
- && UNEXPECTED(GC_REFCOUNT(Z_OBJ_P(arg)->properties) > 1)) {
- if (EXPECTED(!(GC_FLAGS(Z_OBJ_P(arg)->properties) & IS_ARRAY_IMMUTABLE))) {
- GC_DELREF(Z_OBJ_P(arg)->properties);
+ && zobj->properties
+ && UNEXPECTED(GC_REFCOUNT(zobj->properties) > 1)) {
+ if (EXPECTED(!(GC_FLAGS(zobj->properties) & IS_ARRAY_IMMUTABLE))) {
+ GC_DELREF(zobj->properties);
}
- Z_OBJ_P(arg)->properties = zend_array_dup(Z_OBJ_P(arg)->properties);
+ zobj->properties = zend_array_dup(zobj->properties);
}
- *dest = Z_OBJ_HT_P(arg)->get_properties(arg);
+ *dest = zobj->handlers->get_properties(zobj);
} else if (check_null && EXPECTED(Z_TYPE_P(arg) == IS_NULL)) {
*dest = NULL;
} else {
@@ -1746,6 +1767,22 @@ static zend_always_inline void zend_parse_arg_zval_deref(zval *arg, zval **dest,
*dest = (check_null && UNEXPECTED(Z_TYPE_P(arg) == IS_NULL)) ? NULL : arg;
}
+static zend_always_inline int zend_parse_arg_str_or_array_ht(
+ zval *arg, zend_string **dest_str, HashTable **dest_ht)
+{
+ if (EXPECTED(Z_TYPE_P(arg) == IS_STRING)) {
+ *dest_str = Z_STR_P(arg);
+ *dest_ht = NULL;
+ } else if (EXPECTED(Z_TYPE_P(arg) == IS_ARRAY)) {
+ *dest_ht = Z_ARRVAL_P(arg);
+ *dest_str = NULL;
+ } else {
+ *dest_ht = NULL;
+ return zend_parse_arg_str_slow(arg, dest_str);
+ }
+ return 1;
+}
+
END_EXTERN_C()
#endif /* ZEND_API_H */
diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c
index 21ccf85049..982bb03874 100644
--- a/Zend/zend_alloc.c
+++ b/Zend/zend_alloc.c
@@ -260,7 +260,7 @@ struct _zend_mm_heap {
int peak_chunks_count; /* peak number of allocated chunks for current request */
int cached_chunks_count; /* number of cached chunks */
double avg_chunks_count; /* average number of chunks allocated per request */
- int last_chunks_delete_boundary; /* numer of chunks after last deletion */
+ int last_chunks_delete_boundary; /* number of chunks after last deletion */
int last_chunks_delete_count; /* number of deletion over the last boundary */
#if ZEND_MM_CUSTOM
union {
diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c
index 338ff09f76..c88e6658ed 100644
--- a/Zend/zend_ast.c
+++ b/Zend/zend_ast.c
@@ -411,9 +411,9 @@ static int zend_ast_add_array_element(zval *result, zval *offset, zval *expr)
switch (Z_TYPE_P(offset)) {
case IS_UNDEF:
if (!zend_hash_next_index_insert(Z_ARRVAL_P(result), expr)) {
- zend_error(E_WARNING,
+ zend_throw_error(NULL,
"Cannot add element to the array as the next element is already occupied");
- zval_ptr_dtor_nogc(expr);
+ return FAILURE;
}
break;
case IS_STRING:
@@ -436,11 +436,11 @@ static int zend_ast_add_array_element(zval *result, zval *offset, zval *expr)
zend_hash_index_update(Z_ARRVAL_P(result), zend_dval_to_lval(Z_DVAL_P(offset)), expr);
break;
case IS_RESOURCE:
- zend_error(E_NOTICE, "Resource ID#%d used as offset, casting to integer (%d)", Z_RES_HANDLE_P(offset), Z_RES_HANDLE_P(offset));
+ zend_error(E_WARNING, "Resource ID#%d used as offset, casting to integer (%d)", Z_RES_HANDLE_P(offset), Z_RES_HANDLE_P(offset));
zend_hash_index_update(Z_ARRVAL_P(result), Z_RES_HANDLE_P(offset), expr);
break;
default:
- zend_throw_error(NULL, "Illegal offset type");
+ zend_type_error("Illegal offset type");
return FAILURE;
}
return SUCCESS;
@@ -458,8 +458,9 @@ static int zend_ast_add_unpacked_element(zval *result, zval *expr) {
return FAILURE;
} else {
if (!zend_hash_next_index_insert(Z_ARRVAL_P(result), val)) {
- zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
- break;
+ zend_throw_error(NULL,
+ "Cannot add element to the array as the next element is already occupied");
+ return FAILURE;
}
Z_TRY_ADDREF_P(val);
}
@@ -530,8 +531,7 @@ ZEND_API int ZEND_FASTCALL zend_ast_evaluate(zval *result, zend_ast *ast, zend_c
if (UNEXPECTED(zv == NULL)) {
ZVAL_UNDEF(result);
- ret = zend_use_undefined_constant(name, ast->attr, result);
- break;
+ return FAILURE;
}
ZVAL_COPY_OR_DUP(result, zv);
break;
@@ -910,8 +910,9 @@ ZEND_API void zend_ast_apply(zend_ast *ast, zend_ast_apply_func fn) {
* 160 left &
* 170 non-associative == != === !==
* 180 non-associative < <= > >= <=>
+ * 185 left .
* 190 left << >>
- * 200 left + - .
+ * 200 left + -
* 210 left * / %
* 220 right !
* 230 non-associative instanceof
@@ -1312,6 +1313,23 @@ static ZEND_COLD void zend_ast_export_class_no_header(smart_str *str, zend_ast_d
smart_str_appends(str, "}");
}
+static ZEND_COLD void zend_ast_export_type(smart_str *str, zend_ast *ast, int indent) {
+ if (ast->kind == ZEND_AST_TYPE_UNION) {
+ zend_ast_list *list = zend_ast_get_list(ast);
+ for (uint32_t i = 0; i < list->children; i++) {
+ if (i != 0) {
+ smart_str_appendc(str, '|');
+ }
+ zend_ast_export_type(str, list->child[i], indent);
+ }
+ return;
+ }
+ if (ast->attr & ZEND_TYPE_NULLABLE) {
+ smart_str_appendc(str, '?');
+ }
+ zend_ast_export_ns_name(str, ast, 0, indent);
+}
+
#define BINARY_OP(_op, _p, _pl, _pr) do { \
op = _op; \
p = _p; \
@@ -1421,10 +1439,7 @@ tail_call:
zend_ast_export_ex(str, decl->child[1], 0, indent);
if (decl->child[3]) {
smart_str_appends(str, ": ");
- if (decl->child[3]->attr & ZEND_TYPE_NULLABLE) {
- smart_str_appendc(str, '?');
- }
- zend_ast_export_ns_name(str, decl->child[3], 0, indent);
+ zend_ast_export_type(str, decl->child[3], indent);
}
if (decl->child[2]) {
if (decl->kind == ZEND_AST_ARROW_FUNC) {
@@ -1514,11 +1529,7 @@ simple_list:
}
if (type_ast) {
- if (type_ast->attr & ZEND_TYPE_NULLABLE) {
- smart_str_appendc(str, '?');
- }
- zend_ast_export_ns_name(
- str, type_ast, 0, indent);
+ zend_ast_export_type(str, type_ast, indent);
smart_str_appendc(str, ' ');
}
@@ -1738,8 +1749,7 @@ simple_list:
case ZEND_MOD: BINARY_OP(" % ", 210, 210, 211);
case ZEND_SL: BINARY_OP(" << ", 190, 190, 191);
case ZEND_SR: BINARY_OP(" >> ", 190, 190, 191);
- case ZEND_PARENTHESIZED_CONCAT: /* fallthrough */
- case ZEND_CONCAT: BINARY_OP(" . ", 200, 200, 201);
+ case ZEND_CONCAT: BINARY_OP(" . ", 185, 185, 186);
case ZEND_BW_OR: BINARY_OP(" | ", 140, 140, 141);
case ZEND_BW_AND: BINARY_OP(" & ", 160, 160, 161);
case ZEND_BW_XOR: BINARY_OP(" ^ ", 150, 150, 151);
@@ -1989,10 +1999,7 @@ simple_list:
break;
case ZEND_AST_PARAM:
if (ast->child[0]) {
- if (ast->child[0]->attr & ZEND_TYPE_NULLABLE) {
- smart_str_appendc(str, '?');
- }
- zend_ast_export_ns_name(str, ast->child[0], 0, indent);
+ zend_ast_export_type(str, ast->child[0], indent);
smart_str_appendc(str, ' ');
}
if (ast->attr & ZEND_PARAM_REF) {
diff --git a/Zend/zend_ast.h b/Zend/zend_ast.h
index fd6dd1677a..5b8aae6f96 100644
--- a/Zend/zend_ast.h
+++ b/Zend/zend_ast.h
@@ -61,6 +61,7 @@ enum _zend_ast_kind {
ZEND_AST_NAME_LIST,
ZEND_AST_TRAIT_ADAPTATIONS,
ZEND_AST_USE,
+ ZEND_AST_TYPE_UNION,
/* 0 child nodes */
ZEND_AST_MAGIC_CONST = 0 << ZEND_AST_NUM_CHILDREN_SHIFT,
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
index 266b50599b..80651a880e 100644
--- a/Zend/zend_builtin_functions.c
+++ b/Zend/zend_builtin_functions.c
@@ -37,7 +37,6 @@ static ZEND_FUNCTION(strcmp);
static ZEND_FUNCTION(strncmp);
static ZEND_FUNCTION(strcasecmp);
static ZEND_FUNCTION(strncasecmp);
-static ZEND_FUNCTION(each);
static ZEND_FUNCTION(error_reporting);
static ZEND_FUNCTION(define);
static ZEND_FUNCTION(defined);
@@ -68,7 +67,6 @@ static ZEND_FUNCTION(get_declared_traits);
static ZEND_FUNCTION(get_declared_interfaces);
static ZEND_FUNCTION(get_defined_functions);
static ZEND_FUNCTION(get_defined_vars);
-static ZEND_FUNCTION(create_function);
static ZEND_FUNCTION(get_resource_type);
static ZEND_FUNCTION(get_resources);
static ZEND_FUNCTION(get_loaded_extensions);
@@ -87,219 +85,69 @@ static ZEND_FUNCTION(gc_enable);
static ZEND_FUNCTION(gc_disable);
static ZEND_FUNCTION(gc_status);
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO(arginfo_zend__void, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_func_get_arg, 0, 0, 1)
- ZEND_ARG_INFO(0, arg_num)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_strlen, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_strcmp, 0, 0, 2)
- ZEND_ARG_INFO(0, str1)
- ZEND_ARG_INFO(0, str2)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_strncmp, 0, 0, 3)
- ZEND_ARG_INFO(0, str1)
- ZEND_ARG_INFO(0, str2)
- ZEND_ARG_INFO(0, len)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_each, 0, 0, 1)
- ZEND_ARG_INFO(1, arr)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_error_reporting, 0, 0, 0)
- ZEND_ARG_INFO(0, new_error_level)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_define, 0, 0, 2)
- ZEND_ARG_INFO(0, constant_name)
- ZEND_ARG_INFO(0, value)
- ZEND_ARG_INFO(0, case_insensitive)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_defined, 0, 0, 1)
- ZEND_ARG_INFO(0, constant_name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_get_class, 0, 0, 0)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_is_subclass_of, 0, 0, 2)
- ZEND_ARG_INFO(0, object)
- ZEND_ARG_INFO(0, class_name)
- ZEND_ARG_INFO(0, allow_string)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_get_class_vars, 0, 0, 1)
- ZEND_ARG_INFO(0, class_name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_get_object_vars, 0, 0, 1)
- ZEND_ARG_INFO(0, obj)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_get_mangled_object_vars, 0, 0, 1)
- ZEND_ARG_INFO(0, obj)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_get_class_methods, 0, 0, 1)
- ZEND_ARG_INFO(0, class)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_method_exists, 0, 0, 2)
- ZEND_ARG_INFO(0, object)
- ZEND_ARG_INFO(0, method)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_property_exists, 0, 0, 2)
- ZEND_ARG_INFO(0, object_or_class)
- ZEND_ARG_INFO(0, property_name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_class_exists, 0, 0, 1)
- ZEND_ARG_INFO(0, classname)
- ZEND_ARG_INFO(0, autoload)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_trait_exists, 0, 0, 1)
- ZEND_ARG_INFO(0, traitname)
- ZEND_ARG_INFO(0, autoload)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_function_exists, 0, 0, 1)
- ZEND_ARG_INFO(0, function_name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_class_alias, 0, 0, 2)
- ZEND_ARG_INFO(0, user_class_name)
- ZEND_ARG_INFO(0, alias_name)
- ZEND_ARG_INFO(0, autoload)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_trigger_error, 0, 0, 1)
- ZEND_ARG_INFO(0, message)
- ZEND_ARG_INFO(0, error_type)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_set_error_handler, 0, 0, 1)
- ZEND_ARG_INFO(0, error_handler)
- ZEND_ARG_INFO(0, error_types)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_set_exception_handler, 0, 0, 1)
- ZEND_ARG_INFO(0, exception_handler)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_get_defined_functions, 0, 0, 0)
- ZEND_ARG_INFO(0, exclude_disabled)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_create_function, 0, 0, 2)
- ZEND_ARG_INFO(0, args)
- ZEND_ARG_INFO(0, code)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_get_resource_type, 0, 0, 1)
- ZEND_ARG_INFO(0, res)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_get_resources, 0, 0, 0)
- ZEND_ARG_INFO(0, type)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_get_loaded_extensions, 0, 0, 0)
- ZEND_ARG_INFO(0, zend_extensions)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_get_defined_constants, 0, 0, 0)
- ZEND_ARG_INFO(0, categorize)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_debug_backtrace, 0, 0, 0)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, limit)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_debug_print_backtrace, 0, 0, 0)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, limit)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_extension_loaded, 0, 0, 1)
- ZEND_ARG_INFO(0, extension_name)
-ZEND_END_ARG_INFO()
+#include "zend_builtin_functions_arginfo.h"
/* }}} */
static const zend_function_entry builtin_functions[] = { /* {{{ */
- ZEND_FE(zend_version, arginfo_zend__void)
- ZEND_FE(func_num_args, arginfo_zend__void)
+ ZEND_FE(zend_version, arginfo_zend_version)
+ ZEND_FE(func_num_args, arginfo_func_num_args)
ZEND_FE(func_get_arg, arginfo_func_get_arg)
- ZEND_FE(func_get_args, arginfo_zend__void)
+ ZEND_FE(func_get_args, arginfo_func_get_args)
ZEND_FE(strlen, arginfo_strlen)
ZEND_FE(strcmp, arginfo_strcmp)
ZEND_FE(strncmp, arginfo_strncmp)
ZEND_FE(strcasecmp, arginfo_strcmp)
ZEND_FE(strncasecmp, arginfo_strncmp)
- ZEND_FE(each, arginfo_each)
ZEND_FE(error_reporting, arginfo_error_reporting)
ZEND_FE(define, arginfo_define)
ZEND_FE(defined, arginfo_defined)
ZEND_FE(get_class, arginfo_get_class)
- ZEND_FE(get_called_class, arginfo_zend__void)
- ZEND_FE(get_parent_class, arginfo_get_class)
+ ZEND_FE(get_called_class, arginfo_get_called_class)
+ ZEND_FE(get_parent_class, arginfo_get_parent_class)
ZEND_FE(method_exists, arginfo_method_exists)
ZEND_FE(property_exists, arginfo_property_exists)
ZEND_FE(class_exists, arginfo_class_exists)
- ZEND_FE(interface_exists, arginfo_class_exists)
+ ZEND_FE(interface_exists, arginfo_interface_exists)
ZEND_FE(trait_exists, arginfo_trait_exists)
ZEND_FE(function_exists, arginfo_function_exists)
ZEND_FE(class_alias, arginfo_class_alias)
- ZEND_FE(get_included_files, arginfo_zend__void)
- ZEND_FALIAS(get_required_files, get_included_files, arginfo_zend__void)
+ ZEND_FE(get_included_files, arginfo_get_included_files)
+ ZEND_FALIAS(get_required_files, get_included_files, arginfo_get_required_files)
ZEND_FE(is_subclass_of, arginfo_is_subclass_of)
- ZEND_FE(is_a, arginfo_is_subclass_of)
+ ZEND_FE(is_a, arginfo_is_a)
ZEND_FE(get_class_vars, arginfo_get_class_vars)
ZEND_FE(get_object_vars, arginfo_get_object_vars)
ZEND_FE(get_mangled_object_vars, arginfo_get_mangled_object_vars)
ZEND_FE(get_class_methods, arginfo_get_class_methods)
ZEND_FE(trigger_error, arginfo_trigger_error)
- ZEND_FALIAS(user_error, trigger_error, arginfo_trigger_error)
+ ZEND_FALIAS(user_error, trigger_error, arginfo_user_error)
ZEND_FE(set_error_handler, arginfo_set_error_handler)
- ZEND_FE(restore_error_handler, arginfo_zend__void)
+ ZEND_FE(restore_error_handler, arginfo_restore_error_handler)
ZEND_FE(set_exception_handler, arginfo_set_exception_handler)
- ZEND_FE(restore_exception_handler, arginfo_zend__void)
- ZEND_FE(get_declared_classes, arginfo_zend__void)
- ZEND_FE(get_declared_traits, arginfo_zend__void)
- ZEND_FE(get_declared_interfaces, arginfo_zend__void)
+ ZEND_FE(restore_exception_handler, arginfo_restore_exception_handler)
+ ZEND_FE(get_declared_classes, arginfo_get_declared_classes)
+ ZEND_FE(get_declared_traits, arginfo_get_declared_traits)
+ ZEND_FE(get_declared_interfaces, arginfo_get_declared_interfaces)
ZEND_FE(get_defined_functions, arginfo_get_defined_functions)
- ZEND_FE(get_defined_vars, arginfo_zend__void)
- ZEND_DEP_FE(create_function, arginfo_create_function)
+ ZEND_FE(get_defined_vars, arginfo_get_defined_vars)
ZEND_FE(get_resource_type, arginfo_get_resource_type)
ZEND_FE(get_resources, arginfo_get_resources)
ZEND_FE(get_loaded_extensions, arginfo_get_loaded_extensions)
ZEND_FE(extension_loaded, arginfo_extension_loaded)
- ZEND_FE(get_extension_funcs, arginfo_extension_loaded)
+ ZEND_FE(get_extension_funcs, arginfo_get_extension_funcs)
ZEND_FE(get_defined_constants, arginfo_get_defined_constants)
ZEND_FE(debug_backtrace, arginfo_debug_backtrace)
ZEND_FE(debug_print_backtrace, arginfo_debug_print_backtrace)
#if ZEND_DEBUG && defined(ZTS)
- ZEND_FE(zend_thread_id, NULL)
+ ZEND_FE(zend_thread_id, arginfo_zend_thread_id)
#endif
- ZEND_FE(gc_mem_caches, arginfo_zend__void)
- ZEND_FE(gc_collect_cycles, arginfo_zend__void)
- ZEND_FE(gc_enabled, arginfo_zend__void)
- ZEND_FE(gc_enable, arginfo_zend__void)
- ZEND_FE(gc_disable, arginfo_zend__void)
- ZEND_FE(gc_status, arginfo_zend__void)
+ ZEND_FE(gc_mem_caches, arginfo_gc_mem_caches)
+ ZEND_FE(gc_collect_cycles, arginfo_gc_collect_cycles)
+ ZEND_FE(gc_enabled, arginfo_gc_enabled)
+ ZEND_FE(gc_enable, arginfo_gc_enable)
+ ZEND_FE(gc_disable, arginfo_gc_disable)
+ ZEND_FE(gc_status, arginfo_gc_status)
ZEND_FE_END
};
/* }}} */
@@ -342,9 +190,7 @@ int zend_startup_builtin_functions(void) /* {{{ */
Get the version of the Zend Engine */
ZEND_FUNCTION(zend_version)
{
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
RETURN_STRINGL(ZEND_VERSION, sizeof(ZEND_VERSION)-1);
}
@@ -355,9 +201,7 @@ ZEND_FUNCTION(zend_version)
Returns number of freed bytes */
ZEND_FUNCTION(gc_mem_caches)
{
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
RETURN_LONG(zend_mm_gc(zend_mm_get_heap()));
}
@@ -368,9 +212,7 @@ ZEND_FUNCTION(gc_mem_caches)
Returns number of freed zvals */
ZEND_FUNCTION(gc_collect_cycles)
{
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
RETURN_LONG(gc_collect_cycles());
}
@@ -380,9 +222,7 @@ ZEND_FUNCTION(gc_collect_cycles)
Returns status of the circular reference collector */
ZEND_FUNCTION(gc_enabled)
{
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
RETURN_BOOL(gc_enabled());
}
@@ -394,9 +234,7 @@ ZEND_FUNCTION(gc_enable)
{
zend_string *key;
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
key = zend_string_init("zend.enable_gc", sizeof("zend.enable_gc")-1, 0);
zend_alter_ini_entry_chars(key, "1", sizeof("1")-1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
@@ -410,9 +248,7 @@ ZEND_FUNCTION(gc_disable)
{
zend_string *key;
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
key = zend_string_init("zend.enable_gc", sizeof("zend.enable_gc")-1, 0);
zend_alter_ini_entry_chars(key, "0", sizeof("0")-1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
@@ -426,9 +262,7 @@ ZEND_FUNCTION(gc_status)
{
zend_gc_status status;
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
zend_gc_get_status(&status);
@@ -447,9 +281,7 @@ ZEND_FUNCTION(func_num_args)
{
zend_execute_data *ex = EX(prev_execute_data);
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
if (ZEND_CALL_INFO(ex) & ZEND_CALL_CODE) {
zend_error(E_WARNING, "func_num_args(): Called from the global scope - no function context");
@@ -474,7 +306,7 @@ ZEND_FUNCTION(func_get_arg)
zend_execute_data *ex;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &requested_offset) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (requested_offset < 0) {
@@ -668,66 +500,6 @@ ZEND_FUNCTION(strncasecmp)
}
/* }}} */
-/* {{{ proto mixed each(array &arr)
- Return the currently pointed key..value pair in the passed array, and advance the pointer to the next element, or false if there is no element at this place */
-ZEND_FUNCTION(each)
-{
- zval *array, *entry, tmp;
- zend_ulong num_key;
- HashTable *target_hash;
- zend_string *key;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "z/", &array) == FAILURE) {
- return;
- }
-
- if (!EG(each_deprecation_thrown)) {
- zend_error(E_DEPRECATED, "The each() function is deprecated. This message will be suppressed on further calls");
- EG(each_deprecation_thrown) = 1;
- }
-
- target_hash = HASH_OF(array);
- if (!target_hash) {
- zend_error(E_WARNING,"Variable passed to each() is not an array or object");
- return;
- }
- while (1) {
- entry = zend_hash_get_current_data(target_hash);
- if (!entry) {
- RETURN_FALSE;
- } else if (Z_TYPE_P(entry) == IS_INDIRECT) {
- entry = Z_INDIRECT_P(entry);
- if (Z_TYPE_P(entry) == IS_UNDEF) {
- zend_hash_move_forward(target_hash);
- continue;
- }
- }
- break;
- }
- array_init_size(return_value, 4);
- zend_hash_real_init_mixed(Z_ARRVAL_P(return_value));
-
- /* add value elements */
- ZVAL_DEREF(entry);
- if (Z_REFCOUNTED_P(entry)) {
- GC_ADDREF_EX(Z_COUNTED_P(entry), 2);
- }
- zend_hash_index_add_new(Z_ARRVAL_P(return_value), 1, entry);
- zend_hash_add_new(Z_ARRVAL_P(return_value), ZSTR_KNOWN(ZEND_STR_VALUE), entry);
-
- /* add the key elements */
- if (zend_hash_get_current_key(target_hash, &key, &num_key) == HASH_KEY_IS_STRING) {
- ZVAL_STR_COPY(&tmp, key);
- Z_TRY_ADDREF(tmp);
- } else {
- ZVAL_LONG(&tmp, num_key);
- }
- zend_hash_index_add_new(Z_ARRVAL_P(return_value), 0, &tmp);
- zend_hash_add_new(Z_ARRVAL_P(return_value), ZSTR_KNOWN(ZEND_STR_KEY), &tmp);
- zend_hash_move_forward(target_hash);
-}
-/* }}} */
-
/* {{{ proto int error_reporting([int new_error_level])
Return the current error_reporting level, and if an argument was passed - change to the new level */
ZEND_FUNCTION(error_reporting)
@@ -851,7 +623,6 @@ ZEND_FUNCTION(define)
zend_string *name;
zval *val, val_free;
zend_bool non_cs = 0;
- int case_sensitive = CONST_CS;
zend_constant c;
ZEND_PARSE_PARAMETERS_START(2, 3)
@@ -861,18 +632,19 @@ ZEND_FUNCTION(define)
Z_PARAM_BOOL(non_cs)
ZEND_PARSE_PARAMETERS_END();
- if (non_cs) {
- case_sensitive = 0;
- }
-
if (zend_memnstr(ZSTR_VAL(name), "::", sizeof("::") - 1, ZSTR_VAL(name) + ZSTR_LEN(name))) {
zend_error(E_WARNING, "Class constants cannot be defined or redefined");
RETURN_FALSE;
}
+ if (non_cs) {
+ zend_error(E_WARNING,
+ "define(): Declaration of case-insensitive constants is no longer supported");
+ RETURN_FALSE;
+ }
+
ZVAL_UNDEF(&val_free);
-repeat:
switch (Z_TYPE_P(val)) {
case IS_LONG:
case IS_DOUBLE:
@@ -893,17 +665,10 @@ repeat:
}
break;
case IS_OBJECT:
- if (Z_TYPE(val_free) == IS_UNDEF) {
- if (Z_OBJ_HT_P(val)->get) {
- zval rv;
- val = Z_OBJ_HT_P(val)->get(val, &rv);
- ZVAL_COPY_VALUE(&val_free, val);
- goto repeat;
- } else if (Z_OBJ_HT_P(val)->cast_object) {
- if (Z_OBJ_HT_P(val)->cast_object(val, &val_free, IS_STRING) == SUCCESS) {
- val = &val_free;
- break;
- }
+ if (Z_OBJ_HT_P(val)->cast_object) {
+ if (Z_OBJ_HT_P(val)->cast_object(Z_OBJ_P(val), &val_free, IS_STRING) == SUCCESS) {
+ val = &val_free;
+ break;
}
}
/* no break */
@@ -917,13 +682,8 @@ repeat:
zval_ptr_dtor(&val_free);
register_constant:
- if (non_cs) {
- zend_error(E_DEPRECATED,
- "define(): Declaration of case-insensitive constants is deprecated");
- }
-
/* non persistent */
- ZEND_CONSTANT_SET_FLAGS(&c, case_sensitive, PHP_USER_CONSTANT);
+ ZEND_CONSTANT_SET_FLAGS(&c, CONST_CS, PHP_USER_CONSTANT);
c.name = zend_string_copy(name);
if (zend_register_constant(&c) == SUCCESS) {
RETURN_TRUE;
@@ -944,7 +704,7 @@ ZEND_FUNCTION(defined)
Z_PARAM_STR(name)
ZEND_PARSE_PARAMETERS_END();
- if (zend_get_constant_ex(name, zend_get_executed_scope(), ZEND_FETCH_CLASS_SILENT | ZEND_GET_CONSTANT_NO_DEPRECATION_CHECK)) {
+ if (zend_get_constant_ex(name, zend_get_executed_scope(), ZEND_FETCH_CLASS_SILENT)) {
RETURN_TRUE;
} else {
RETURN_FALSE;
@@ -959,7 +719,7 @@ ZEND_FUNCTION(get_class)
zval *obj = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|o", &obj) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (!obj) {
@@ -983,9 +743,7 @@ ZEND_FUNCTION(get_called_class)
{
zend_class_entry *called_scope;
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
called_scope = zend_get_called_scope(execute_data);
if (called_scope) {
@@ -1008,7 +766,7 @@ ZEND_FUNCTION(get_parent_class)
zend_class_entry *ce = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|z", &arg) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!ZEND_NUM_ARGS()) {
@@ -1157,7 +915,7 @@ ZEND_FUNCTION(get_class_vars)
zend_class_entry *ce, *scope;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &class_name) == FAILURE) {
- return;
+ RETURN_THROWS();
}
ce = zend_lookup_class(class_name);
@@ -1192,13 +950,12 @@ ZEND_FUNCTION(get_object_vars)
Z_PARAM_OBJECT(obj)
ZEND_PARSE_PARAMETERS_END();
- properties = Z_OBJ_HT_P(obj)->get_properties(obj);
+ zobj = Z_OBJ_P(obj);
+ properties = zobj->handlers->get_properties(zobj);
if (properties == NULL) {
- RETURN_FALSE;
+ RETURN_EMPTY_ARRAY();
}
- zobj = Z_OBJ_P(obj);
-
if (!zobj->ce->default_properties_count && properties == zobj->properties && !GC_IS_RECURSIVE(properties)) {
/* fast copy */
if (EXPECTED(zobj->handlers == &std_object_handlers)) {
@@ -1260,7 +1017,7 @@ ZEND_FUNCTION(get_mangled_object_vars)
Z_PARAM_OBJECT(obj)
ZEND_PARSE_PARAMETERS_END();
- properties = Z_OBJ_HT_P(obj)->get_properties(obj);
+ properties = Z_OBJ_HT_P(obj)->get_properties(Z_OBJ_P(obj));
if (!properties) {
ZVAL_EMPTY_ARRAY(return_value);
return;
@@ -1304,7 +1061,7 @@ ZEND_FUNCTION(get_class_methods)
zend_string *key;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &klass) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (Z_TYPE_P(klass) == IS_OBJECT) {
@@ -1408,10 +1165,9 @@ ZEND_FUNCTION(property_exists)
zend_string *property;
zend_class_entry *ce;
zend_property_info *property_info;
- zval property_z;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zS", &object, &property) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (property == NULL) {
@@ -1437,10 +1193,8 @@ ZEND_FUNCTION(property_exists)
RETURN_TRUE;
}
- ZVAL_STR(&property_z, property);
-
if (Z_TYPE_P(object) == IS_OBJECT &&
- Z_OBJ_HANDLER_P(object, has_property)(object, &property_z, 2, NULL)) {
+ Z_OBJ_HANDLER_P(object, has_property)(Z_OBJ_P(object), property, 2, NULL)) {
RETURN_TRUE;
}
RETURN_FALSE;
@@ -1550,7 +1304,7 @@ ZEND_FUNCTION(class_alias)
zend_bool autoload = 1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ss|b", &class_name, &alias_name, &alias_name_len, &autoload) == FAILURE) {
- return;
+ RETURN_THROWS();
}
ce = zend_lookup_class_ex(class_name, NULL, !autoload ? ZEND_FETCH_CLASS_NO_AUTOLOAD : 0);
@@ -1580,9 +1334,7 @@ ZEND_FUNCTION(get_included_files)
{
zend_string *entry;
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
array_init(return_value);
ZEND_HASH_FOREACH_STR_KEY(&EG(included_files), entry) {
@@ -1593,7 +1345,7 @@ ZEND_FUNCTION(get_included_files)
}
/* }}} */
-/* {{{ proto void trigger_error(string message [, int error_type])
+/* {{{ proto bool trigger_error(string message [, int error_type])
Generates a user-level error/warning/notice message */
ZEND_FUNCTION(trigger_error)
{
@@ -1602,7 +1354,7 @@ ZEND_FUNCTION(trigger_error)
size_t message_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &message, &message_len, &error_type) == FAILURE) {
- return;
+ RETURN_THROWS();
}
switch (error_type) {
@@ -1630,7 +1382,7 @@ ZEND_FUNCTION(set_error_handler)
zend_long error_type = E_ALL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|l", &error_handler, &error_type) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (Z_TYPE_P(error_handler) != IS_NULL) { /* NULL == unset */
@@ -1664,9 +1416,7 @@ ZEND_FUNCTION(set_error_handler)
Restores the previously defined error handler function */
ZEND_FUNCTION(restore_error_handler)
{
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
if (Z_TYPE(EG(user_error_handler)) != IS_UNDEF) {
zval zeh;
@@ -1697,7 +1447,7 @@ ZEND_FUNCTION(set_exception_handler)
zval *exception_handler;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &exception_handler) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (Z_TYPE_P(exception_handler) != IS_NULL) { /* NULL == unset */
@@ -1729,9 +1479,7 @@ ZEND_FUNCTION(set_exception_handler)
Restores the previously defined exception handler function */
ZEND_FUNCTION(restore_exception_handler)
{
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
if (Z_TYPE(EG(user_exception_handler)) != IS_UNDEF) {
zval_ptr_dtor(&EG(user_exception_handler));
@@ -1762,9 +1510,7 @@ static inline void get_declared_class_impl(INTERNAL_FUNCTION_PARAMETERS, int fla
zend_string *key;
zend_class_entry *ce;
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
array_init(return_value);
ZEND_HASH_FOREACH_STR_KEY_PTR(EG(class_table), key, ce) {
@@ -1813,7 +1559,7 @@ ZEND_FUNCTION(get_defined_functions)
char *disable_functions = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &exclude_disabled) == FAILURE) {
- return;
+ RETURN_THROWS();
}
array_init(&internal);
@@ -1849,94 +1595,27 @@ ZEND_FUNCTION(get_defined_functions)
ZEND_FUNCTION(get_defined_vars)
{
zend_array *symbol_table;
+
+ ZEND_PARSE_PARAMETERS_NONE();
+
if (zend_forbid_dynamic_call("get_defined_vars()") == FAILURE) {
return;
}
symbol_table = zend_rebuild_symbol_table();
if (UNEXPECTED(symbol_table == NULL)) {
- return;
+ RETURN_EMPTY_ARRAY();
}
RETURN_ARR(zend_array_dup(symbol_table));
}
/* }}} */
-#define LAMBDA_TEMP_FUNCNAME "__lambda_func"
-/* {{{ proto string create_function(string args, string code)
- Creates an anonymous function, and returns its name (funny, eh?) */
-ZEND_FUNCTION(create_function)
-{
- zend_string *function_name;
- char *eval_code, *function_args, *function_code;
- size_t eval_code_length, function_args_len, function_code_len;
- int retval;
- char *eval_name;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &function_args, &function_args_len, &function_code, &function_code_len) == FAILURE) {
- return;
- }
-
- eval_code = (char *) emalloc(sizeof("function " LAMBDA_TEMP_FUNCNAME)
- +function_args_len
- +2 /* for the args parentheses */
- +2 /* for the curly braces */
- +function_code_len);
-
- eval_code_length = sizeof("function " LAMBDA_TEMP_FUNCNAME "(") - 1;
- memcpy(eval_code, "function " LAMBDA_TEMP_FUNCNAME "(", eval_code_length);
-
- memcpy(eval_code + eval_code_length, function_args, function_args_len);
- eval_code_length += function_args_len;
-
- eval_code[eval_code_length++] = ')';
- eval_code[eval_code_length++] = '{';
-
- memcpy(eval_code + eval_code_length, function_code, function_code_len);
- eval_code_length += function_code_len;
-
- eval_code[eval_code_length++] = '}';
- eval_code[eval_code_length] = '\0';
-
- eval_name = zend_make_compiled_string_description("runtime-created function");
- retval = zend_eval_stringl(eval_code, eval_code_length, NULL, eval_name);
- efree(eval_code);
- efree(eval_name);
-
- if (retval==SUCCESS) {
- zend_op_array *func;
- HashTable *static_variables;
-
- func = zend_hash_str_find_ptr(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME)-1);
- if (!func) {
- zend_error_noreturn(E_CORE_ERROR, "Unexpected inconsistency in create_function()");
- RETURN_FALSE;
- }
- if (func->refcount) {
- (*func->refcount)++;
- }
- static_variables = func->static_variables;
- func->static_variables = NULL;
- zend_hash_str_del(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME)-1);
- func->static_variables = static_variables;
-
- function_name = zend_string_alloc(sizeof("0lambda_")+MAX_LENGTH_OF_LONG, 0);
- ZSTR_VAL(function_name)[0] = '\0';
-
- do {
- ZSTR_LEN(function_name) = snprintf(ZSTR_VAL(function_name) + 1, sizeof("lambda_")+MAX_LENGTH_OF_LONG, "lambda_%d", ++EG(lambda_count)) + 1;
- } while (zend_hash_add_ptr(EG(function_table), function_name, func) == NULL);
- RETURN_NEW_STR(function_name);
- } else {
- zend_hash_str_del(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME)-1);
- RETURN_FALSE;
- }
-}
-/* }}} */
-
#if ZEND_DEBUG && defined(ZTS)
ZEND_FUNCTION(zend_thread_id)
{
+ ZEND_PARSE_PARAMETERS_NONE();
+
RETURN_LONG((zend_long)tsrm_thread_id());
}
#endif
@@ -1949,7 +1628,7 @@ ZEND_FUNCTION(get_resource_type)
zval *z_resource_type;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &z_resource_type) == FAILURE) {
- return;
+ RETURN_THROWS();
}
resource_type = zend_rsrc_list_get_rsrc_type(Z_RES_P(z_resource_type));
@@ -1971,7 +1650,7 @@ ZEND_FUNCTION(get_resources)
zval *val;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|S", &type) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!type) {
@@ -2024,7 +1703,7 @@ ZEND_FUNCTION(get_loaded_extensions)
zend_bool zendext = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &zendext) == FAILURE) {
- return;
+ RETURN_THROWS();
}
array_init(return_value);
@@ -2048,7 +1727,7 @@ ZEND_FUNCTION(get_defined_constants)
zend_bool categorize = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &categorize) == FAILURE) {
- return;
+ RETURN_THROWS();
}
array_init(return_value);
@@ -2234,7 +1913,7 @@ ZEND_FUNCTION(debug_print_backtrace)
zend_long limit = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|ll", &options, &limit) == FAILURE) {
- return;
+ RETURN_THROWS();
}
ZVAL_UNDEF(&arg_array);
@@ -2622,7 +2301,7 @@ ZEND_FUNCTION(debug_backtrace)
zend_long limit = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|ll", &options, &limit) == FAILURE) {
- return;
+ RETURN_THROWS();
}
zend_fetch_debug_backtrace(return_value, 1, options, limit);
@@ -2637,7 +2316,7 @@ ZEND_FUNCTION(extension_loaded)
zend_string *lcname;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &extension_name) == FAILURE) {
- return;
+ RETURN_THROWS();
}
lcname = zend_string_tolower(extension_name);
@@ -2661,7 +2340,7 @@ ZEND_FUNCTION(get_extension_funcs)
zend_function *zif;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &extension_name) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (strncasecmp(ZSTR_VAL(extension_name), "zend", sizeof("zend"))) {
lcname = zend_string_tolower(extension_name);
diff --git a/Zend/zend_builtin_functions.stub.php b/Zend/zend_builtin_functions.stub.php
new file mode 100644
index 0000000000..47f0869869
--- /dev/null
+++ b/Zend/zend_builtin_functions.stub.php
@@ -0,0 +1,116 @@
+<?php
+
+function zend_version(): string {}
+
+function func_num_args(): int {}
+
+/** @return mixed */
+function func_get_arg(int $arg_num) {}
+
+function func_get_args(): array|false {}
+
+function strlen(string $str): int {}
+
+function strcmp(string $str1, string $str2): int {}
+
+function strncmp(string $str1, string $str2, int $len): int|false {}
+
+function error_reporting($new_error_level = UNKNOWN): int {}
+
+function define(string $constant_name, $value, bool $case_insensitive = false): bool {}
+
+function defined(string $constant_name): bool {}
+
+function get_class(object $object = UNKNOWN): string|false {}
+
+function get_called_class(): string|false {}
+
+function get_parent_class($object = UNKNOWN): string|false {}
+
+function is_subclass_of($object, string $class_name, bool $allow_string = true): bool {}
+
+function is_a($object, string $class_name, bool $allow_string = false): bool {}
+
+function get_class_vars(string $class_name): array|false {}
+
+function get_object_vars(object $obj): array {}
+
+function get_mangled_object_vars(object $obj): array {}
+
+function get_class_methods($class): ?array {}
+
+function method_exists($object_or_class, string $method): bool {}
+
+function property_exists($object_or_class, string $property_name): ?bool {}
+
+function class_exists(string $classname, bool $autoload = true): bool {}
+
+function interface_exists(string $classname, bool $autoload = true): bool {}
+
+function trait_exists(string $traitname, bool $autoload = true): bool {}
+
+function function_exists(string $function_name): bool {}
+
+function class_alias(string $user_class_name, string $alias_name, bool $autoload = true): bool {}
+
+function get_included_files(): array {}
+
+/** @alias get_included_files */
+function get_required_files(): array {}
+
+function trigger_error(string $message, int $error_type = E_USER_NOTICE): bool {}
+
+/** @alias trigger_error */
+function user_error(string $message, int $error_type = E_USER_NOTICE): bool {}
+
+/** @return mixed */
+function set_error_handler($error_handler, int $error_types = E_ALL) {}
+
+function restore_error_handler(): bool {}
+
+/** @return mixed */
+function set_exception_handler($exception_handler) {}
+
+function restore_exception_handler(): bool {}
+
+function get_declared_classes(): array {}
+
+function get_declared_traits(): array {}
+
+function get_declared_interfaces(): array {}
+
+function get_defined_functions(bool $exclude_disabled = false): array {}
+
+function get_defined_vars(): array {}
+
+function get_resource_type($res): string {}
+
+function get_resources(string $type = UNKNOWN): array {}
+
+function get_loaded_extensions(bool $zend_extensions = false): array {}
+
+function get_defined_constants(bool $categorize = false): array {}
+
+function debug_backtrace(int $options = DEBUG_BACKTRACE_PROVIDE_OBJECT, int $limit = 0): array {}
+
+function debug_print_backtrace(int $options = 0, int $limit = 0): void {}
+
+function extension_loaded(string $extension_name): bool {}
+
+function get_extension_funcs(string $extension_name): array|false {}
+
+#if ZEND_DEBUG && defined(ZTS)
+function zend_thread_id(): int {}
+#endif
+
+function gc_mem_caches(): int {}
+
+function gc_collect_cycles(): int {}
+
+function gc_enabled(): bool {}
+
+function gc_enable(): void {}
+
+function gc_disable(): void {}
+
+function gc_status(): array {}
diff --git a/Zend/zend_builtin_functions_arginfo.h b/Zend/zend_builtin_functions_arginfo.h
new file mode 100644
index 0000000000..3b1df2ab49
--- /dev/null
+++ b/Zend/zend_builtin_functions_arginfo.h
@@ -0,0 +1,198 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_version, 0, 0, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_func_num_args, 0, 0, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_func_get_arg, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, arg_num, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_func_get_args, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_strlen, 0, 1, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_strcmp, 0, 2, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, str1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, str2, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_strncmp, 0, 3, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, str1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, str2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, len, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_error_reporting, 0, 0, IS_LONG, 0)
+ ZEND_ARG_INFO(0, new_error_level)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_define, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, constant_name, IS_STRING, 0)
+ ZEND_ARG_INFO(0, value)
+ ZEND_ARG_TYPE_INFO(0, case_insensitive, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_defined, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, constant_name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_get_class, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, object, IS_OBJECT, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_get_called_class, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_get_parent_class, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, object)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_is_subclass_of, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, object)
+ ZEND_ARG_TYPE_INFO(0, class_name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, allow_string, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_is_a arginfo_is_subclass_of
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_get_class_vars, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, class_name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_get_object_vars, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, obj, IS_OBJECT, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_get_mangled_object_vars arginfo_get_object_vars
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_get_class_methods, 0, 1, IS_ARRAY, 1)
+ ZEND_ARG_INFO(0, class)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_method_exists, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, object_or_class)
+ ZEND_ARG_TYPE_INFO(0, method, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_property_exists, 0, 2, _IS_BOOL, 1)
+ ZEND_ARG_INFO(0, object_or_class)
+ ZEND_ARG_TYPE_INFO(0, property_name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_exists, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, classname, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, autoload, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_interface_exists arginfo_class_exists
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_trait_exists, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, traitname, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, autoload, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_function_exists, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, function_name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_alias, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, user_class_name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, alias_name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, autoload, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_get_included_files, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_get_required_files arginfo_get_included_files
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_trigger_error, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, message, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, error_type, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_user_error arginfo_trigger_error
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_set_error_handler, 0, 0, 1)
+ ZEND_ARG_INFO(0, error_handler)
+ ZEND_ARG_TYPE_INFO(0, error_types, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_restore_error_handler, 0, 0, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_set_exception_handler, 0, 0, 1)
+ ZEND_ARG_INFO(0, exception_handler)
+ZEND_END_ARG_INFO()
+
+#define arginfo_restore_exception_handler arginfo_restore_error_handler
+
+#define arginfo_get_declared_classes arginfo_get_included_files
+
+#define arginfo_get_declared_traits arginfo_get_included_files
+
+#define arginfo_get_declared_interfaces arginfo_get_included_files
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_get_defined_functions, 0, 0, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, exclude_disabled, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_get_defined_vars arginfo_get_included_files
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_get_resource_type, 0, 1, IS_STRING, 0)
+ ZEND_ARG_INFO(0, res)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_get_resources, 0, 0, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, type, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_get_loaded_extensions, 0, 0, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, zend_extensions, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_get_defined_constants, 0, 0, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, categorize, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_debug_backtrace, 0, 0, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, limit, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_debug_print_backtrace, 0, 0, IS_VOID, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, limit, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_extension_loaded, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, extension_name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_get_extension_funcs, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, extension_name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#if ZEND_DEBUG && defined(ZTS)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_thread_id, 0, 0, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#define arginfo_gc_mem_caches arginfo_func_num_args
+
+#define arginfo_gc_collect_cycles arginfo_func_num_args
+
+#define arginfo_gc_enabled arginfo_restore_error_handler
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_gc_enable, 0, 0, IS_VOID, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_gc_disable arginfo_gc_enable
+
+#define arginfo_gc_status arginfo_get_included_files
diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c
index 92f1398d84..06a54f943c 100644
--- a/Zend/zend_closures.c
+++ b/Zend/zend_closures.c
@@ -26,6 +26,7 @@
#include "zend_objects.h"
#include "zend_objects_API.h"
#include "zend_globals.h"
+#include "zend_closures_arginfo.h"
#define ZEND_CLOSURE_PRINT_NAME "Closure object"
@@ -84,16 +85,12 @@ static zend_bool zend_valid_closure_binding(
}
} else if (is_fake_closure && func->common.scope
&& !(func->common.fn_flags & ZEND_ACC_STATIC)) {
- if (func->type == ZEND_INTERNAL_FUNCTION) {
- zend_error(E_WARNING, "Cannot unbind $this of internal method");
- return 0;
- } else {
- zend_error(E_DEPRECATED, "Unbinding $this of a method is deprecated");
- }
+ zend_error(E_WARNING, "Cannot unbind $this of method");
+ return 0;
} else if (!is_fake_closure && !Z_ISUNDEF(closure->this_ptr)
&& (func->common.fn_flags & ZEND_ACC_USES_THIS)) {
- // TODO: Only deprecate if it had $this *originally*?
- zend_error(E_DEPRECATED, "Unbinding $this of closure is deprecated");
+ zend_error(E_WARNING, "Cannot unbind $this of closure using $this");
+ return 0;
}
if (scope && scope != func->common.scope && scope->type == ZEND_INTERNAL_CLASS) {
@@ -127,7 +124,7 @@ ZEND_METHOD(Closure, call)
fci.params = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "o*", &newthis, &fci.params, &fci.param_count) == FAILURE) {
- return;
+ RETURN_THROWS();
}
closure = (zend_closure *) Z_OBJ_P(ZEND_THIS);
@@ -199,7 +196,7 @@ ZEND_METHOD(Closure, bind)
zend_class_entry *ce, *called_scope;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oo!|z", &zclosure, zend_ce_closure, &newthis, &scope_arg) == FAILURE) {
- return;
+ RETURN_THROWS();
}
closure = (zend_closure *)Z_OBJ_P(zclosure);
@@ -336,12 +333,12 @@ ZEND_METHOD(Closure, fromCallable)
char *error = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &callable) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (Z_TYPE_P(callable) == IS_OBJECT && instanceof_function(Z_OBJCE_P(callable), zend_ce_closure)) {
/* It's already a closure */
- RETURN_ZVAL(callable, 1, 0);
+ RETURN_COPY(callable);
}
/* create closure as if it were called from parent scope */
@@ -349,7 +346,7 @@ ZEND_METHOD(Closure, fromCallable)
success = zend_create_closure_from_callable(return_value, callable, &error);
EG(current_execute_data) = execute_data;
- if (success == FAILURE || error) {
+ if (success == FAILURE) {
if (error) {
zend_type_error("Failed to create closure from callable: %s", error);
efree(error);
@@ -367,9 +364,10 @@ static ZEND_COLD zend_function *zend_closure_get_constructor(zend_object *object
}
/* }}} */
-static int zend_closure_compare_objects(zval *o1, zval *o2) /* {{{ */
+static int zend_closure_compare(zval *o1, zval *o2) /* {{{ */
{
- return (Z_OBJ_P(o1) != Z_OBJ_P(o2));
+ ZEND_COMPARE_OBJECTS_FALLBACK(o1, o2);
+ return Z_OBJ_P(o1) != Z_OBJ_P(o2);
}
/* }}} */
@@ -425,28 +423,28 @@ static zend_function *zend_closure_get_method(zend_object **object, zend_string
}
/* }}} */
-static ZEND_COLD zval *zend_closure_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) /* {{{ */
+static ZEND_COLD zval *zend_closure_read_property(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv) /* {{{ */
{
ZEND_CLOSURE_PROPERTY_ERROR();
return &EG(uninitialized_zval);
}
/* }}} */
-static ZEND_COLD zval *zend_closure_write_property(zval *object, zval *member, zval *value, void **cache_slot) /* {{{ */
+static ZEND_COLD zval *zend_closure_write_property(zend_object *object, zend_string *member, zval *value, void **cache_slot) /* {{{ */
{
ZEND_CLOSURE_PROPERTY_ERROR();
return &EG(error_zval);
}
/* }}} */
-static ZEND_COLD zval *zend_closure_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) /* {{{ */
+static ZEND_COLD zval *zend_closure_get_property_ptr_ptr(zend_object *object, zend_string *member, int type, void **cache_slot) /* {{{ */
{
ZEND_CLOSURE_PROPERTY_ERROR();
return NULL;
}
/* }}} */
-static ZEND_COLD int zend_closure_has_property(zval *object, zval *member, int has_set_exists, void **cache_slot) /* {{{ */
+static ZEND_COLD int zend_closure_has_property(zend_object *object, zend_string *member, int has_set_exists, void **cache_slot) /* {{{ */
{
if (has_set_exists != ZEND_PROPERTY_EXISTS) {
ZEND_CLOSURE_PROPERTY_ERROR();
@@ -455,7 +453,7 @@ static ZEND_COLD int zend_closure_has_property(zval *object, zval *member, int h
}
/* }}} */
-static ZEND_COLD void zend_closure_unset_property(zval *object, zval *member, void **cache_slot) /* {{{ */
+static ZEND_COLD void zend_closure_unset_property(zend_object *object, zend_string *member, void **cache_slot) /* {{{ */
{
ZEND_CLOSURE_PROPERTY_ERROR();
}
@@ -491,9 +489,9 @@ static zend_object *zend_closure_new(zend_class_entry *class_type) /* {{{ */
}
/* }}} */
-static zend_object *zend_closure_clone(zval *zobject) /* {{{ */
+static zend_object *zend_closure_clone(zend_object *zobject) /* {{{ */
{
- zend_closure *closure = (zend_closure *)Z_OBJ_P(zobject);
+ zend_closure *closure = (zend_closure *)zobject;
zval result;
zend_create_closure(&result, &closure->func,
@@ -502,9 +500,9 @@ static zend_object *zend_closure_clone(zval *zobject) /* {{{ */
}
/* }}} */
-int zend_closure_get_closure(zval *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr) /* {{{ */
+int zend_closure_get_closure(zend_object *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr, zend_bool check_only) /* {{{ */
{
- zend_closure *closure = (zend_closure *)Z_OBJ_P(obj);
+ zend_closure *closure = (zend_closure *)obj;
*fptr_ptr = &closure->func;
*ce_ptr = closure->called_scope;
@@ -518,9 +516,9 @@ int zend_closure_get_closure(zval *obj, zend_class_entry **ce_ptr, zend_function
}
/* }}} */
-static HashTable *zend_closure_get_debug_info(zval *object, int *is_temp) /* {{{ */
+static HashTable *zend_closure_get_debug_info(zend_object *object, int *is_temp) /* {{{ */
{
- zend_closure *closure = (zend_closure *)Z_OBJ_P(object);
+ zend_closure *closure = (zend_closure *)object;
zval val;
struct _zend_arg_info *arg_info = closure->func.common.arg_info;
HashTable *debug_info;
@@ -559,16 +557,16 @@ static HashTable *zend_closure_get_debug_info(zval *object, int *is_temp) /* {{{
if (arg_info->name) {
if (zstr_args) {
name = zend_strpprintf(0, "%s$%s",
- arg_info->pass_by_reference ? "&" : "",
+ ZEND_ARG_SEND_MODE(arg_info) ? "&" : "",
ZSTR_VAL(arg_info->name));
} else {
name = zend_strpprintf(0, "%s$%s",
- arg_info->pass_by_reference ? "&" : "",
+ ZEND_ARG_SEND_MODE(arg_info) ? "&" : "",
((zend_internal_arg_info*)arg_info)->name);
}
} else {
name = zend_strpprintf(0, "%s$param%d",
- arg_info->pass_by_reference ? "&" : "",
+ ZEND_ARG_SEND_MODE(arg_info) ? "&" : "",
i + 1);
}
ZVAL_NEW_STR(&info, zend_strpprintf(0, "%s", i >= required ? "<optional>" : "<required>"));
@@ -583,9 +581,9 @@ static HashTable *zend_closure_get_debug_info(zval *object, int *is_temp) /* {{{
}
/* }}} */
-static HashTable *zend_closure_get_gc(zval *obj, zval **table, int *n) /* {{{ */
+static HashTable *zend_closure_get_gc(zend_object *obj, zval **table, int *n) /* {{{ */
{
- zend_closure *closure = (zend_closure *)Z_OBJ_P(obj);
+ zend_closure *closure = (zend_closure *)obj;
*table = Z_TYPE(closure->this_ptr) != IS_NULL ? &closure->this_ptr : NULL;
*n = Z_TYPE(closure->this_ptr) != IS_NULL ? 1 : 0;
@@ -602,32 +600,12 @@ ZEND_COLD ZEND_METHOD(Closure, __construct)
}
/* }}} */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_closure_bindto, 0, 0, 1)
- ZEND_ARG_INFO(0, newthis)
- ZEND_ARG_INFO(0, newscope)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_closure_bind, 0, 0, 2)
- ZEND_ARG_INFO(0, closure)
- ZEND_ARG_INFO(0, newthis)
- ZEND_ARG_INFO(0, newscope)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_closure_call, 0, 0, 1)
- ZEND_ARG_INFO(0, newthis)
- ZEND_ARG_VARIADIC_INFO(0, parameters)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_closure_fromcallable, 0, 0, 1)
- ZEND_ARG_INFO(0, callable)
-ZEND_END_ARG_INFO()
-
static const zend_function_entry closure_functions[] = {
- ZEND_ME(Closure, __construct, NULL, ZEND_ACC_PRIVATE)
- ZEND_ME(Closure, bind, arginfo_closure_bind, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- ZEND_MALIAS(Closure, bindTo, bind, arginfo_closure_bindto, ZEND_ACC_PUBLIC)
- ZEND_ME(Closure, call, arginfo_closure_call, ZEND_ACC_PUBLIC)
- ZEND_ME(Closure, fromCallable, arginfo_closure_fromcallable, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_ME(Closure, __construct, arginfo_class_Closure___construct, ZEND_ACC_PRIVATE)
+ ZEND_ME(Closure, bind, arginfo_class_Closure_bind, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_MALIAS(Closure, bindTo, bind, arginfo_class_Closure_bindTo, ZEND_ACC_PUBLIC)
+ ZEND_ME(Closure, call, arginfo_class_Closure_call, ZEND_ACC_PUBLIC)
+ ZEND_ME(Closure, fromCallable, arginfo_class_Closure_fromCallable, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
ZEND_FE_END
};
@@ -651,7 +629,7 @@ void zend_register_closure_ce(void) /* {{{ */
closure_handlers.get_property_ptr_ptr = zend_closure_get_property_ptr_ptr;
closure_handlers.has_property = zend_closure_has_property;
closure_handlers.unset_property = zend_closure_unset_property;
- closure_handlers.compare_objects = zend_closure_compare_objects;
+ closure_handlers.compare = zend_closure_compare;
closure_handlers.clone_obj = zend_closure_clone;
closure_handlers.get_debug_info = zend_closure_get_debug_info;
closure_handlers.get_closure = zend_closure_get_closure;
diff --git a/Zend/zend_closures.stub.php b/Zend/zend_closures.stub.php
new file mode 100644
index 0000000000..ad15daa526
--- /dev/null
+++ b/Zend/zend_closures.stub.php
@@ -0,0 +1,20 @@
+<?php
+
+Class Closure
+{
+ private function __construct() {}
+
+ /** @return ?Closure */
+ static function bind(Closure $closure, ?object $newthis, $newscope = UNKNOWN) {}
+
+ /** @return ?Closure */
+ function bindTo(?object $newthis, $newscope = UNKNOWN) {}
+
+ function call(object $newthis, ...$parameters) {}
+
+ /**
+ * @param callable $callable Not a proper type annotation due to bug #78770
+ * @return Closure
+ */
+ function fromCallable($callable) {}
+}
diff --git a/Zend/zend_closures_arginfo.h b/Zend/zend_closures_arginfo.h
new file mode 100644
index 0000000000..91d019dc94
--- /dev/null
+++ b/Zend/zend_closures_arginfo.h
@@ -0,0 +1,24 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Closure___construct, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Closure_bind, 0, 0, 2)
+ ZEND_ARG_OBJ_INFO(0, closure, Closure, 0)
+ ZEND_ARG_TYPE_INFO(0, newthis, IS_OBJECT, 1)
+ ZEND_ARG_INFO(0, newscope)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Closure_bindTo, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, newthis, IS_OBJECT, 1)
+ ZEND_ARG_INFO(0, newscope)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Closure_call, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, newthis, IS_OBJECT, 0)
+ ZEND_ARG_VARIADIC_INFO(0, parameters)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Closure_fromCallable, 0, 0, 1)
+ ZEND_ARG_INFO(0, callable)
+ZEND_END_ARG_INFO()
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 5661f26439..d43bb6f4a3 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -60,6 +60,10 @@ typedef struct _zend_loop_var {
} zend_loop_var;
static inline uint32_t zend_alloc_cache_slots(unsigned count) {
+ if (count == 0) {
+ return (uint32_t) -1;
+ }
+
zend_op_array *op_array = CG(active_op_array);
uint32_t ret = op_array->cache_size;
op_array->cache_size += count * sizeof(void*);
@@ -71,7 +75,7 @@ static inline uint32_t zend_alloc_cache_slot(void) {
}
ZEND_API zend_op_array *(*zend_compile_file)(zend_file_handle *file_handle, int type);
-ZEND_API zend_op_array *(*zend_compile_string)(zval *source_string, char *filename);
+ZEND_API zend_op_array *(*zend_compile_string)(zval *source_string, const char *filename);
#ifndef ZTS
ZEND_API zend_compiler_globals compiler_globals;
@@ -123,6 +127,7 @@ static void zend_destroy_property_info_internal(zval *zv) /* {{{ */
zend_property_info *property_info = Z_PTR_P(zv);
zend_string_release(property_info->name);
+ zend_type_release(property_info->type, /* persistent */ 1);
free(property_info);
}
/* }}} */
@@ -206,6 +211,8 @@ typedef struct _builtin_type_info {
} builtin_type_info;
static const builtin_type_info builtin_types[] = {
+ {ZEND_STRL("null"), IS_NULL},
+ {ZEND_STRL("false"), IS_FALSE},
{ZEND_STRL("int"), IS_LONG},
{ZEND_STRL("float"), IS_DOUBLE},
{ZEND_STRL("string"), IS_STRING},
@@ -216,6 +223,19 @@ static const builtin_type_info builtin_types[] = {
{NULL, 0, IS_UNDEF}
};
+typedef struct {
+ const char *name;
+ size_t name_len;
+ const char *correct_name;
+} confusable_type_info;
+
+static const confusable_type_info confusable_types[] = {
+ {ZEND_STRL("boolean"), "bool"},
+ {ZEND_STRL("integer"), "int"},
+ {ZEND_STRL("double"), "float"},
+ {ZEND_STRL("resource"), NULL},
+ {NULL, 0, NULL},
+};
static zend_always_inline zend_uchar zend_lookup_builtin_type_by_name(const zend_string *name) /* {{{ */
{
@@ -233,6 +253,43 @@ static zend_always_inline zend_uchar zend_lookup_builtin_type_by_name(const zend
}
/* }}} */
+static zend_always_inline zend_bool zend_is_confusable_type(const zend_string *name, const char **correct_name) /* {{{ */
+{
+ const confusable_type_info *info = confusable_types;
+
+ /* Intentionally using case-sensitive comparison here, because "integer" is likely intended
+ * as a scalar type, while "Integer" is likely a class type. */
+ for (; info->name; ++info) {
+ if (ZSTR_LEN(name) == info->name_len
+ && memcmp(ZSTR_VAL(name), info->name, info->name_len) == 0
+ ) {
+ *correct_name = info->correct_name;
+ return 1;
+ }
+ }
+
+ return 0;
+}
+/* }}} */
+
+static void *zend_hash_find_ptr_lc(HashTable *ht, const char *str, size_t len) {
+ void *result;
+ zend_string *lcname;
+ ALLOCA_FLAG(use_heap);
+
+ ZSTR_ALLOCA_ALLOC(lcname, len, use_heap);
+ zend_str_tolower_copy(ZSTR_VAL(lcname), str, len);
+ result = zend_hash_find_ptr(ht, lcname);
+ ZSTR_ALLOCA_FREE(lcname, use_heap);
+
+ return result;
+}
+
+static zend_bool zend_is_not_imported(zend_string *name) {
+ /* Assuming "name" is unqualified here. */
+ return !FC(imports)
+ || zend_hash_find_ptr_lc(FC(imports), ZSTR_VAL(name), ZSTR_LEN(name)) == NULL;
+}
void zend_oparray_context_begin(zend_oparray_context *prev_context) /* {{{ */
{
@@ -464,17 +521,6 @@ static int lookup_cv(zend_string *name) /* {{{ */{
}
/* }}} */
-void zend_del_literal(zend_op_array *op_array, int n) /* {{{ */
-{
- zval_ptr_dtor_nogc(CT_CONSTANT_EX(op_array, n));
- if (n + 1 == op_array->last_literal) {
- op_array->last_literal--;
- } else {
- ZVAL_UNDEF(CT_CONSTANT_EX(op_array, n));
- }
-}
-/* }}} */
-
static inline zend_string *zval_make_interned_string(zval *zv) /* {{{ */
{
ZEND_ASSERT(Z_TYPE_P(zv) == IS_STRING);
@@ -594,10 +640,6 @@ static int zend_add_const_name_literal(zend_string *name, zend_bool unqualified)
zend_str_tolower(ZSTR_VAL(tmp_name), ns_len);
zend_add_literal_string(&tmp_name);
- /* lowercased namespace name & lowercased constant name */
- tmp_name = zend_string_tolower(name);
- zend_add_literal_string(&tmp_name);
-
if (!unqualified) {
return ret;
}
@@ -609,11 +651,6 @@ static int zend_add_const_name_literal(zend_string *name, zend_bool unqualified)
tmp_name = zend_string_init(after_ns, after_ns_len, 0);
zend_add_literal_string(&tmp_name);
- /* lowercased unqualified constant name */
- tmp_name = zend_string_alloc(after_ns_len, 0);
- zend_str_tolower_copy(ZSTR_VAL(tmp_name), after_ns, after_ns_len);
- zend_add_literal_string(&tmp_name);
-
return ret;
}
/* }}} */
@@ -681,13 +718,43 @@ void zend_do_free(znode *op1) /* {{{ */
if (op1->op_type == IS_TMP_VAR) {
zend_op *opline = &CG(active_op_array)->opcodes[CG(active_op_array)->last-1];
- while (opline->opcode == ZEND_END_SILENCE) {
+ while (opline->opcode == ZEND_END_SILENCE ||
+ opline->opcode == ZEND_OP_DATA) {
opline--;
}
if (opline->result_type == IS_TMP_VAR && opline->result.var == op1->u.op.var) {
- if (opline->opcode == ZEND_BOOL || opline->opcode == ZEND_BOOL_NOT) {
- return;
+ switch (opline->opcode) {
+ case ZEND_BOOL:
+ case ZEND_BOOL_NOT:
+ /* boolean resuls don't have to be freed */
+ return;
+ case ZEND_POST_INC_STATIC_PROP:
+ case ZEND_POST_DEC_STATIC_PROP:
+ case ZEND_POST_INC_OBJ:
+ case ZEND_POST_DEC_OBJ:
+ case ZEND_POST_INC:
+ case ZEND_POST_DEC:
+ /* convert $i++ to ++$i */
+ opline->opcode -= 2;
+ opline->result_type = IS_UNUSED;
+ return;
+ case ZEND_ASSIGN:
+ case ZEND_ASSIGN_DIM:
+ case ZEND_ASSIGN_OBJ:
+ case ZEND_ASSIGN_STATIC_PROP:
+ case ZEND_ASSIGN_OP:
+ case ZEND_ASSIGN_DIM_OP:
+ case ZEND_ASSIGN_OBJ_OP:
+ case ZEND_ASSIGN_STATIC_PROP_OP:
+ case ZEND_PRE_INC_STATIC_PROP:
+ case ZEND_PRE_DEC_STATIC_PROP:
+ case ZEND_PRE_INC_OBJ:
+ case ZEND_PRE_DEC_OBJ:
+ case ZEND_PRE_INC:
+ case ZEND_PRE_DEC:
+ opline->result_type = IS_UNUSED;
+ return;
}
}
@@ -811,19 +878,6 @@ zend_string *zend_prefix_with_ns(zend_string *name) {
}
}
-void *zend_hash_find_ptr_lc(HashTable *ht, const char *str, size_t len) {
- void *result;
- zend_string *lcname;
- ALLOCA_FLAG(use_heap);
-
- ZSTR_ALLOCA_ALLOC(lcname, len, use_heap);
- zend_str_tolower_copy(ZSTR_VAL(lcname), str, len);
- result = zend_hash_find_ptr(ht, lcname);
- ZSTR_ALLOCA_FREE(lcname, use_heap);
-
- return result;
-}
-
zend_string *zend_resolve_non_class_name(
zend_string *name, uint32_t type, zend_bool *is_fully_qualified,
zend_bool case_sensitive, HashTable *current_import_sub
@@ -995,10 +1049,9 @@ ZEND_API void function_add_ref(zend_function *function) /* {{{ */
if (op_array->refcount) {
(*op_array->refcount)++;
}
- if (op_array->static_variables) {
- if (!(GC_FLAGS(op_array->static_variables) & IS_ARRAY_IMMUTABLE)) {
- GC_ADDREF(op_array->static_variables);
- }
+ if (op_array->static_variables
+ && !(GC_FLAGS(op_array->static_variables) & IS_ARRAY_IMMUTABLE)) {
+ GC_ADDREF(op_array->static_variables);
}
if (CG(compiler_options) & ZEND_COMPILE_PRELOAD) {
@@ -1098,6 +1151,107 @@ ZEND_API int do_bind_class(zval *lcname, zend_string *lc_parent_name) /* {{{ */
}
/* }}} */
+static zend_string *add_type_string(zend_string *type, zend_string *new_type) {
+ zend_string *result;
+ if (type == NULL) {
+ return zend_string_copy(new_type);
+ }
+
+ // TODO: Switch to smart_str?
+ result = zend_string_alloc(ZSTR_LEN(type) + ZSTR_LEN(new_type) + 1, 0);
+ memcpy(ZSTR_VAL(result), ZSTR_VAL(type), ZSTR_LEN(type));
+ ZSTR_VAL(result)[ZSTR_LEN(type)] = '|';
+ memcpy(ZSTR_VAL(result) + ZSTR_LEN(type) + 1, ZSTR_VAL(new_type), ZSTR_LEN(new_type));
+ ZSTR_VAL(result)[ZSTR_LEN(type) + ZSTR_LEN(new_type) + 1] = '\0';
+ zend_string_release(type);
+ return result;
+}
+
+static zend_string *resolve_class_name(zend_string *name, zend_class_entry *scope) {
+ if (scope) {
+ if (zend_string_equals_literal_ci(name, "self")) {
+ name = scope->name;
+ } else if (zend_string_equals_literal_ci(name, "parent") && scope->parent) {
+ name = scope->parent->name;
+ }
+ }
+ return name;
+}
+
+zend_string *zend_type_to_string_resolved(zend_type type, zend_class_entry *scope) {
+ zend_string *str = NULL;
+ if (ZEND_TYPE_HAS_LIST(type)) {
+ zend_type *list_type;
+ ZEND_TYPE_LIST_FOREACH(ZEND_TYPE_LIST(type), list_type) {
+ if (ZEND_TYPE_HAS_CE(*list_type)) {
+ str = add_type_string(str, ZEND_TYPE_CE(*list_type)->name);
+ } else {
+ str = add_type_string(str, resolve_class_name(ZEND_TYPE_NAME(*list_type), scope));
+ }
+ } ZEND_TYPE_LIST_FOREACH_END();
+ } else if (ZEND_TYPE_HAS_NAME(type)) {
+ str = zend_string_copy(resolve_class_name(ZEND_TYPE_NAME(type), scope));
+ } else if (ZEND_TYPE_HAS_CE(type)) {
+ str = zend_string_copy(ZEND_TYPE_CE(type)->name);
+ }
+
+ uint32_t type_mask = ZEND_TYPE_FULL_MASK(type);
+ if (type_mask & MAY_BE_CALLABLE) {
+ str = add_type_string(str, ZSTR_KNOWN(ZEND_STR_CALLABLE));
+ }
+ if (type_mask & MAY_BE_ITERABLE) {
+ str = add_type_string(str, ZSTR_KNOWN(ZEND_STR_ITERABLE));
+ }
+ if (type_mask & MAY_BE_OBJECT) {
+ str = add_type_string(str, ZSTR_KNOWN(ZEND_STR_OBJECT));
+ }
+ if (type_mask & MAY_BE_ARRAY) {
+ str = add_type_string(str, ZSTR_KNOWN(ZEND_STR_ARRAY));
+ }
+ if (type_mask & MAY_BE_STRING) {
+ str = add_type_string(str, ZSTR_KNOWN(ZEND_STR_STRING));
+ }
+ if (type_mask & MAY_BE_LONG) {
+ str = add_type_string(str, ZSTR_KNOWN(ZEND_STR_INT));
+ }
+ if (type_mask & MAY_BE_DOUBLE) {
+ str = add_type_string(str, ZSTR_KNOWN(ZEND_STR_FLOAT));
+ }
+ if ((type_mask & MAY_BE_BOOL) == MAY_BE_BOOL) {
+ str = add_type_string(str, ZSTR_KNOWN(ZEND_STR_BOOL));
+ } else if (type_mask & MAY_BE_FALSE) {
+ str = add_type_string(str, ZSTR_KNOWN(ZEND_STR_FALSE));
+ }
+ if (type_mask & MAY_BE_VOID) {
+ str = add_type_string(str, ZSTR_KNOWN(ZEND_STR_VOID));
+ }
+
+ if (type_mask & MAY_BE_NULL) {
+ zend_bool is_union = !str || memchr(ZSTR_VAL(str), '|', ZSTR_LEN(str)) != NULL;
+ if (!is_union) {
+ zend_string *nullable_str = zend_string_alloc(ZSTR_LEN(str) + 1, 0);
+ ZSTR_VAL(nullable_str)[0] = '?';
+ memcpy(ZSTR_VAL(nullable_str) + 1, ZSTR_VAL(str), ZSTR_LEN(str));
+ ZSTR_VAL(nullable_str)[ZSTR_LEN(nullable_str)] = '\0';
+ zend_string_release(str);
+ return nullable_str;
+ }
+
+ str = add_type_string(str, ZSTR_KNOWN(ZEND_STR_NULL_LOWERCASE));
+ }
+ return str;
+}
+
+ZEND_API zend_string *zend_type_to_string(zend_type type) {
+ return zend_type_to_string_resolved(type, NULL);
+}
+
+static zend_bool is_generator_compatible_class_type(zend_string *name) {
+ return zend_string_equals_literal_ci(name, "Traversable")
+ || zend_string_equals_literal_ci(name, "Iterator")
+ || zend_string_equals_literal_ci(name, "Generator");
+}
+
static void zend_mark_function_as_generator() /* {{{ */
{
if (!CG(active_op_array)->function_name) {
@@ -1106,20 +1260,25 @@ static void zend_mark_function_as_generator() /* {{{ */
}
if (CG(active_op_array)->fn_flags & ZEND_ACC_HAS_RETURN_TYPE) {
- zend_arg_info return_info = CG(active_op_array)->arg_info[-1];
-
- if (ZEND_TYPE_CODE(return_info.type) != IS_ITERABLE) {
- const char *msg = "Generators may only declare a return type of Generator, Iterator, Traversable, or iterable, %s is not permitted";
-
- if (!ZEND_TYPE_IS_CLASS(return_info.type)) {
- zend_error_noreturn(E_COMPILE_ERROR, msg, zend_get_type_by_const(ZEND_TYPE_CODE(return_info.type)));
- }
+ zend_type return_type = CG(active_op_array)->arg_info[-1].type;
+ zend_bool valid_type = (ZEND_TYPE_FULL_MASK(return_type) & MAY_BE_ITERABLE) != 0;
+ if (!valid_type) {
+ zend_type *single_type;
+ ZEND_TYPE_FOREACH(return_type, single_type) {
+ if (ZEND_TYPE_HAS_NAME(*single_type)
+ && is_generator_compatible_class_type(ZEND_TYPE_NAME(*single_type))) {
+ valid_type = 1;
+ break;
+ }
+ } ZEND_TYPE_FOREACH_END();
+ }
- if (!zend_string_equals_literal_ci(ZEND_TYPE_NAME(return_info.type), "Traversable")
- && !zend_string_equals_literal_ci(ZEND_TYPE_NAME(return_info.type), "Iterator")
- && !zend_string_equals_literal_ci(ZEND_TYPE_NAME(return_info.type), "Generator")) {
- zend_error_noreturn(E_COMPILE_ERROR, msg, ZSTR_VAL(ZEND_TYPE_NAME(return_info.type)));
- }
+ if (!valid_type) {
+ zend_string *str = zend_type_to_string(return_type);
+ zend_error_noreturn(E_COMPILE_ERROR,
+ "Generators may only declare a return type containing " \
+ "Generator, Iterator, Traversable, or iterable, %s is not permitted",
+ ZSTR_VAL(str));
}
}
@@ -1259,28 +1418,27 @@ ZEND_API int zend_unmangle_property_name_ex(const zend_string *name, const char
}
/* }}} */
-static zend_constant *zend_lookup_reserved_const(const char *name, size_t len) /* {{{ */
-{
- zend_constant *c = zend_hash_find_ptr_lc(EG(zend_constants), name, len);
- if (c && !(ZEND_CONSTANT_FLAGS(c) & CONST_CS) && (ZEND_CONSTANT_FLAGS(c) & CONST_CT_SUBST)) {
- return c;
+static zend_bool can_ct_eval_const(zend_constant *c) {
+ if (ZEND_CONSTANT_FLAGS(c) & CONST_DEPRECATED) {
+ return 0;
}
- return NULL;
+ if ((ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT)
+ && !(CG(compiler_options) & ZEND_COMPILE_NO_PERSISTENT_CONSTANT_SUBSTITUTION)
+ && !((ZEND_CONSTANT_FLAGS(c) & CONST_NO_FILE_CACHE)
+ && (CG(compiler_options) & ZEND_COMPILE_WITH_FILE_CACHE))) {
+ return 1;
+ }
+ if (Z_TYPE(c->value) < IS_OBJECT
+ && !(CG(compiler_options) & ZEND_COMPILE_NO_CONSTANT_SUBSTITUTION)) {
+ return 1;
+ }
+ return 0;
}
-/* }}} */
static zend_bool zend_try_ct_eval_const(zval *zv, zend_string *name, zend_bool is_fully_qualified) /* {{{ */
{
- zend_constant *c;
-
- /* Substitute case-sensitive (or lowercase) constants */
- c = zend_hash_find_ptr(EG(zend_constants), name);
- if (c && (
- ((ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT)
- && !(CG(compiler_options) & ZEND_COMPILE_NO_PERSISTENT_CONSTANT_SUBSTITUTION)
- && (!(ZEND_CONSTANT_FLAGS(c) & CONST_NO_FILE_CACHE) || !(CG(compiler_options) & ZEND_COMPILE_WITH_FILE_CACHE)))
- || (Z_TYPE(c->value) < IS_OBJECT && !(CG(compiler_options) & ZEND_COMPILE_NO_CONSTANT_SUBSTITUTION))
- )) {
+ zend_constant *c = zend_hash_find_ptr(EG(zend_constants), name);
+ if (c && can_ct_eval_const(c)) {
ZVAL_COPY_OR_DUP(zv, &c->value);
return 1;
}
@@ -1294,14 +1452,13 @@ static zend_bool zend_try_ct_eval_const(zval *zv, zend_string *name, zend_bool i
zend_get_unqualified_name(name, &lookup_name, &lookup_len);
}
- c = zend_lookup_reserved_const(lookup_name, lookup_len);
- if (c) {
- ZVAL_COPY_OR_DUP(zv, &c->value);
+ if ((c = zend_get_special_const(lookup_name, lookup_len))) {
+ ZVAL_COPY_VALUE(zv, &c->value);
return 1;
}
- }
- return 0;
+ return 0;
+ }
}
/* }}} */
@@ -1361,6 +1518,17 @@ static uint32_t zend_get_class_fetch_type_ast(zend_ast *name_ast) /* {{{ */
}
/* }}} */
+static zend_string *zend_resolve_const_class_name_reference(zend_ast *ast, const char *type)
+{
+ zend_string *class_name = zend_ast_get_str(ast);
+ if (ZEND_FETCH_CLASS_DEFAULT != zend_get_class_fetch_type_ast(ast)) {
+ zend_error_noreturn(E_COMPILE_ERROR,
+ "Cannot use '%s' as %s, as it is reserved",
+ ZSTR_VAL(class_name), type);
+ }
+ return zend_resolve_class_name(class_name, ast->attr);
+}
+
static void zend_ensure_valid_class_fetch_type(uint32_t fetch_type) /* {{{ */
{
if (fetch_type != ZEND_FETCH_CLASS_DEFAULT && zend_is_scope_known()) {
@@ -1370,7 +1538,7 @@ static void zend_ensure_valid_class_fetch_type(uint32_t fetch_type) /* {{{ */
fetch_type == ZEND_FETCH_CLASS_SELF ? "self" :
fetch_type == ZEND_FETCH_CLASS_PARENT ? "parent" : "static");
} else if (fetch_type == ZEND_FETCH_CLASS_PARENT && !ce->parent_name) {
- zend_error(E_DEPRECATED,
+ zend_error_noreturn(E_COMPILE_ERROR,
"Cannot use \"parent\" when current class scope has no parent");
}
}
@@ -1383,7 +1551,7 @@ static zend_bool zend_try_compile_const_expr_resolve_class_name(zval *zv, zend_a
zval *class_name;
if (class_ast->kind != ZEND_AST_ZVAL) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use ::class with dynamic class name");
+ return 0;
}
class_name = zend_ast_get_zval(class_ast);
@@ -1932,7 +2100,7 @@ static inline uint32_t zend_emit_jump(uint32_t opnum_target) /* {{{ */
}
/* }}} */
-ZEND_API int zend_is_smart_branch(zend_op *opline) /* {{{ */
+ZEND_API int zend_is_smart_branch(const zend_op *opline) /* {{{ */
{
switch (opline->opcode) {
case ZEND_IS_IDENTICAL:
@@ -1964,12 +2132,18 @@ static inline uint32_t zend_emit_cond_jump(zend_uchar opcode, znode *cond, uint3
uint32_t opnum = get_next_op_number();
zend_op *opline;
- if ((cond->op_type & (IS_CV|IS_CONST))
- && opnum > 0
- && zend_is_smart_branch(CG(active_op_array)->opcodes + opnum - 1)) {
- /* emit extra NOP to avoid incorrect SMART_BRANCH in very rare cases */
- zend_emit_op(NULL, ZEND_NOP, NULL, NULL);
- opnum = get_next_op_number();
+ if (cond->op_type == IS_TMP_VAR && opnum > 0) {
+ opline = CG(active_op_array)->opcodes + opnum - 1;
+ if (opline->result_type == IS_TMP_VAR
+ && opline->result.var == cond->u.op.var
+ && zend_is_smart_branch(opline)) {
+ if (opcode == ZEND_JMPZ) {
+ opline->result_type = IS_TMP_VAR | IS_SMART_BRANCH_JMPZ;
+ } else {
+ ZEND_ASSERT(opcode == ZEND_JMPNZ);
+ opline->result_type = IS_TMP_VAR | IS_SMART_BRANCH_JMPNZ;
+ }
+ }
}
opline = zend_emit_op(NULL, opcode, cond, NULL);
opline->op2.opline_num = opnum_target;
@@ -2086,14 +2260,25 @@ static void zend_compile_memoized_expr(znode *result, zend_ast *expr) /* {{{ */
}
/* }}} */
+static size_t zend_type_get_num_classes(zend_type type) {
+ if (!ZEND_TYPE_HAS_CLASS(type)) {
+ return 0;
+ }
+ if (ZEND_TYPE_HAS_LIST(type)) {
+ return ZEND_TYPE_LIST(type)->num_types;
+ }
+ return 1;
+}
+
static void zend_emit_return_type_check(
znode *expr, zend_arg_info *return_info, zend_bool implicit) /* {{{ */
{
- if (ZEND_TYPE_IS_SET(return_info->type)) {
+ zend_type type = return_info->type;
+ if (ZEND_TYPE_IS_SET(type)) {
zend_op *opline;
/* `return ...;` is illegal in a void function (but `return;` isn't) */
- if (ZEND_TYPE_CODE(return_info->type) == IS_VOID) {
+ if (ZEND_TYPE_CONTAINS_CODE(type, IS_VOID)) {
if (expr) {
if (expr->op_type == IS_CONST && Z_TYPE(expr->u.constant) == IS_NULL) {
zend_error_noreturn(E_COMPILE_ERROR,
@@ -2108,7 +2293,7 @@ static void zend_emit_return_type_check(
}
if (!expr && !implicit) {
- if (ZEND_TYPE_ALLOW_NULL(return_info->type)) {
+ if (ZEND_TYPE_ALLOW_NULL(type)) {
zend_error_noreturn(E_COMPILE_ERROR,
"A function with return type must return a value "
"(did you mean \"return null;\" instead of \"return;\"?)");
@@ -2119,12 +2304,7 @@ static void zend_emit_return_type_check(
}
if (expr && expr->op_type == IS_CONST) {
- if ((ZEND_TYPE_CODE(return_info->type) == Z_TYPE(expr->u.constant))
- ||((ZEND_TYPE_CODE(return_info->type) == _IS_BOOL)
- && (Z_TYPE(expr->u.constant) == IS_FALSE
- || Z_TYPE(expr->u.constant) == IS_TRUE))
- || (ZEND_TYPE_ALLOW_NULL(return_info->type)
- && Z_TYPE(expr->u.constant) == IS_NULL)) {
+ if (ZEND_TYPE_CONTAINS_CODE(type, Z_TYPE(expr->u.constant))) {
/* we don't need run-time check */
return;
}
@@ -2135,12 +2315,8 @@ static void zend_emit_return_type_check(
opline->result_type = expr->op_type = IS_TMP_VAR;
opline->result.var = expr->u.op.var = get_temporary_variable();
}
- if (ZEND_TYPE_IS_CLASS(return_info->type)) {
- opline->op2.num = CG(active_op_array)->cache_size;
- CG(active_op_array)->cache_size += sizeof(void*);
- } else {
- opline->op2.num = -1;
- }
+
+ opline->op2.num = zend_alloc_cache_slots(zend_type_get_num_classes(return_info->type));
}
}
/* }}} */
@@ -2388,6 +2564,16 @@ static zend_bool is_this_fetch(zend_ast *ast) /* {{{ */
}
/* }}} */
+static zend_bool this_guaranteed_exists() /* {{{ */
+{
+ zend_op_array *op_array = CG(active_op_array);
+ /* Instance methods always have a $this.
+ * This also includes closures that have a scope and use $this. */
+ return op_array->scope != NULL
+ && (op_array->fn_flags & ZEND_ACC_STATIC) == 0;
+}
+/* }}} */
+
static zend_op *zend_compile_simple_var(znode *result, zend_ast *ast, uint32_t type, int delayed) /* {{{ */
{
if (is_this_fetch(ast)) {
@@ -2490,14 +2676,14 @@ static zend_op *zend_delayed_compile_prop(znode *result, zend_ast *ast, uint32_t
zend_op *opline;
if (is_this_fetch(obj_ast)) {
- obj_node.op_type = IS_UNUSED;
+ if (this_guaranteed_exists()) {
+ obj_node.op_type = IS_UNUSED;
+ } else {
+ zend_emit_op(&obj_node, ZEND_FETCH_THIS, NULL, NULL);
+ }
CG(active_op_array)->fn_flags |= ZEND_ACC_USES_THIS;
} else {
opline = zend_delayed_compile_var(&obj_node, obj_ast, type, 0);
- if (opline && type == BP_VAR_W && (opline->opcode == ZEND_FETCH_STATIC_PROP_W || opline->opcode == ZEND_FETCH_OBJ_W)) {
- opline->extended_value |= ZEND_FETCH_OBJ_WRITE;
- }
-
zend_separate_if_call_and_write(&obj_node, obj_ast, type);
}
zend_compile_expr(&prop_node, prop_ast);
@@ -2752,7 +2938,7 @@ void zend_compile_assign(znode *result, zend_ast *ast) /* {{{ */
zend_delayed_compile_var(&var_node, var_ast, BP_VAR_W, 0);
zend_compile_expr(&expr_node, expr_ast);
zend_delayed_compile_end(offset);
- zend_emit_op(result, ZEND_ASSIGN, &var_node, &expr_node);
+ zend_emit_op_tmp(result, ZEND_ASSIGN, &var_node, &expr_node);
return;
case ZEND_AST_STATIC_PROP:
offset = zend_delayed_compile_begin();
@@ -2761,6 +2947,8 @@ void zend_compile_assign(znode *result, zend_ast *ast) /* {{{ */
opline = zend_delayed_compile_end(offset);
opline->opcode = ZEND_ASSIGN_STATIC_PROP;
+ opline->result_type = IS_TMP_VAR;
+ result->op_type = IS_TMP_VAR;
zend_emit_op_data(&expr_node);
return;
@@ -2784,6 +2972,8 @@ void zend_compile_assign(znode *result, zend_ast *ast) /* {{{ */
opline = zend_delayed_compile_end(offset);
opline->opcode = ZEND_ASSIGN_DIM;
+ opline->result_type = IS_TMP_VAR;
+ result->op_type = IS_TMP_VAR;
opline = zend_emit_op_data(&expr_node);
return;
@@ -2794,6 +2984,8 @@ void zend_compile_assign(znode *result, zend_ast *ast) /* {{{ */
opline = zend_delayed_compile_end(offset);
opline->opcode = ZEND_ASSIGN_OBJ;
+ opline->result_type = IS_TMP_VAR;
+ result->op_type = IS_TMP_VAR;
zend_emit_op_data(&expr_node);
return;
@@ -2917,7 +3109,7 @@ void zend_compile_compound_assign(znode *result, zend_ast *ast) /* {{{ */
zend_delayed_compile_var(&var_node, var_ast, BP_VAR_RW, 0);
zend_compile_expr(&expr_node, expr_ast);
zend_delayed_compile_end(offset);
- opline = zend_emit_op(result, ZEND_ASSIGN_OP, &var_node, &expr_node);
+ opline = zend_emit_op_tmp(result, ZEND_ASSIGN_OP, &var_node, &expr_node);
opline->extended_value = opcode;
return;
case ZEND_AST_STATIC_PROP:
@@ -2929,6 +3121,8 @@ void zend_compile_compound_assign(znode *result, zend_ast *ast) /* {{{ */
cache_slot = opline->extended_value;
opline->opcode = ZEND_ASSIGN_STATIC_PROP_OP;
opline->extended_value = opcode;
+ opline->result_type = IS_TMP_VAR;
+ result->op_type = IS_TMP_VAR;
opline = zend_emit_op_data(&expr_node);
opline->extended_value = cache_slot;
@@ -2941,6 +3135,8 @@ void zend_compile_compound_assign(znode *result, zend_ast *ast) /* {{{ */
opline = zend_delayed_compile_end(offset);
opline->opcode = ZEND_ASSIGN_DIM_OP;
opline->extended_value = opcode;
+ opline->result_type = IS_TMP_VAR;
+ result->op_type = IS_TMP_VAR;
zend_emit_op_data(&expr_node);
return;
@@ -2953,6 +3149,8 @@ void zend_compile_compound_assign(znode *result, zend_ast *ast) /* {{{ */
cache_slot = opline->extended_value;
opline->opcode = ZEND_ASSIGN_OBJ_OP;
opline->extended_value = opcode;
+ opline->result_type = IS_TMP_VAR;
+ result->op_type = IS_TMP_VAR;
opline = zend_emit_op_data(&expr_node);
opline->extended_value = cache_slot;
@@ -2994,26 +3192,26 @@ uint32_t zend_compile_args(zend_ast *ast, zend_function *fbc) /* {{{ */
}
arg_count++;
- if (zend_is_variable_or_call(arg)) {
- if (zend_is_call(arg)) {
- zend_compile_var(&arg_node, arg, BP_VAR_R, 0);
- if (arg_node.op_type & (IS_CONST|IS_TMP_VAR)) {
- /* Function call was converted into builtin instruction */
- opcode = ZEND_SEND_VAL;
- } else {
- if (fbc) {
- if (ARG_MUST_BE_SENT_BY_REF(fbc, arg_num)) {
- opcode = ZEND_SEND_VAR_NO_REF;
- } else if (ARG_MAY_BE_SENT_BY_REF(fbc, arg_num)) {
- opcode = ZEND_SEND_VAL;
- } else {
- opcode = ZEND_SEND_VAR;
- }
+ if (zend_is_call(arg)) {
+ zend_compile_var(&arg_node, arg, BP_VAR_R, 0);
+ if (arg_node.op_type & (IS_CONST|IS_TMP_VAR)) {
+ /* Function call was converted into builtin instruction */
+ opcode = ZEND_SEND_VAL;
+ } else {
+ if (fbc) {
+ if (ARG_MUST_BE_SENT_BY_REF(fbc, arg_num)) {
+ opcode = ZEND_SEND_VAR_NO_REF;
+ } else if (ARG_MAY_BE_SENT_BY_REF(fbc, arg_num)) {
+ opcode = ZEND_SEND_VAL;
} else {
- opcode = ZEND_SEND_VAR_NO_REF_EX;
+ opcode = ZEND_SEND_VAR;
}
+ } else {
+ opcode = ZEND_SEND_VAR_NO_REF_EX;
}
- } else if (fbc) {
+ }
+ } else if (zend_is_variable(arg)) {
+ if (fbc) {
if (ARG_SHOULD_BE_SENT_BY_REF(fbc, arg_num)) {
zend_compile_var(&arg_node, arg, BP_VAR_W, 1);
opcode = ZEND_SEND_REF;
@@ -3067,11 +3265,9 @@ uint32_t zend_compile_args(zend_ast *ast, zend_function *fbc) /* {{{ */
opcode = ZEND_SEND_VAR_EX;
}
} else {
- if (fbc) {
+ /* Delay "Only variables can be passed by reference" error to execution */
+ if (fbc && !ARG_MUST_BE_SENT_BY_REF(fbc, arg_num)) {
opcode = ZEND_SEND_VAL;
- if (ARG_MUST_BE_SENT_BY_REF(fbc, arg_num)) {
- zend_error_noreturn(E_COMPILE_ERROR, "Only variables can be passed by reference");
- }
} else {
opcode = ZEND_SEND_VAL_EX;
}
@@ -3092,7 +3288,7 @@ ZEND_API zend_uchar zend_get_call_op(const zend_op *init_op, zend_function *fbc)
if (fbc) {
if (fbc->type == ZEND_INTERNAL_FUNCTION && !(CG(compiler_options) & ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS)) {
if (init_op->opcode == ZEND_INIT_FCALL && !zend_execute_internal) {
- if (!(fbc->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED|ZEND_ACC_HAS_TYPE_HINTS|ZEND_ACC_RETURN_REFERENCE))) {
+ if (!(fbc->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED))) {
return ZEND_DO_ICALL;
} else {
return ZEND_DO_FCALL_BY_NAME;
@@ -3211,9 +3407,7 @@ int zend_compile_func_strlen(znode *result, zend_ast_list *args) /* {{{ */
{
znode arg_node;
- if ((CG(compiler_options) & ZEND_COMPILE_NO_BUILTIN_STRLEN)
- || args->children != 1
- ) {
+ if (args->children != 1) {
return FAILURE;
}
@@ -3249,6 +3443,21 @@ int zend_compile_func_typecheck(znode *result, zend_ast_list *args, uint32_t typ
}
/* }}} */
+static int zend_compile_func_is_scalar(znode *result, zend_ast_list *args) /* {{{ */
+{
+ znode arg_node;
+ zend_op *opline;
+
+ if (args->children != 1) {
+ return FAILURE;
+ }
+
+ zend_compile_expr(&arg_node, args->child[0]);
+ opline = zend_emit_op_tmp(result, ZEND_TYPE_CHECK, &arg_node, NULL);
+ opline->extended_value = (1 << IS_FALSE | 1 << IS_TRUE | 1 << IS_DOUBLE | 1 << IS_LONG | 1 << IS_STRING);
+ return SUCCESS;
+}
+
int zend_compile_func_cast(znode *result, zend_ast_list *args, uint32_t type) /* {{{ */
{
znode arg_node;
@@ -3259,8 +3468,12 @@ int zend_compile_func_cast(znode *result, zend_ast_list *args, uint32_t type) /*
}
zend_compile_expr(&arg_node, args->child[0]);
- opline = zend_emit_op_tmp(result, ZEND_CAST, &arg_node, NULL);
- opline->extended_value = type;
+ if (type == _IS_BOOL) {
+ opline = zend_emit_op_tmp(result, ZEND_BOOL, &arg_node, NULL);
+ } else {
+ opline = zend_emit_op_tmp(result, ZEND_CAST, &arg_node, NULL);
+ opline->extended_value = type;
+ }
return SUCCESS;
}
/* }}} */
@@ -3293,13 +3506,6 @@ int zend_compile_func_defined(znode *result, zend_ast_list *args) /* {{{ */
LITERAL_STR(opline->op1, name);
opline->extended_value = zend_alloc_cache_slot();
- /* Lowercase constant name in a separate literal */
- {
- zval c;
- zend_string *lcname = zend_string_tolower(name);
- ZVAL_NEW_STR(&c, lcname);
- zend_add_literal(&c);
- }
return SUCCESS;
}
/* }}} */
@@ -3770,6 +3976,8 @@ int zend_try_compile_special_func(znode *result, zend_string *lcname, zend_ast_l
return zend_compile_func_typecheck(result, args, IS_OBJECT);
} else if (zend_string_equals_literal(lcname, "is_resource")) {
return zend_compile_func_typecheck(result, args, IS_RESOURCE);
+ } else if (zend_string_equals_literal(lcname, "is_scalar")) {
+ return zend_compile_func_is_scalar(result, args);
} else if (zend_string_equals_literal(lcname, "boolval")) {
return zend_compile_func_cast(result, args, _IS_BOOL);
} else if (zend_string_equals_literal(lcname, "intval")) {
@@ -3897,7 +4105,11 @@ void zend_compile_method_call(znode *result, zend_ast *ast, uint32_t type) /* {{
zend_function *fbc = NULL;
if (is_this_fetch(obj_ast)) {
- obj_node.op_type = IS_UNUSED;
+ if (this_guaranteed_exists()) {
+ obj_node.op_type = IS_UNUSED;
+ } else {
+ zend_emit_op(&obj_node, ZEND_FETCH_THIS, NULL, NULL);
+ }
CG(active_op_array)->fn_flags |= ZEND_ACC_USES_THIS;
} else {
zend_compile_expr(&obj_node, obj_ast);
@@ -3942,6 +4154,24 @@ static zend_bool zend_is_constructor(zend_string *name) /* {{{ */
}
/* }}} */
+static zend_function *zend_get_compatible_func_or_null(zend_class_entry *ce, zend_string *lcname) /* {{{ */
+{
+ zend_function *fbc = zend_hash_find_ptr(&ce->function_table, lcname);
+ if (!fbc || (fbc->common.fn_flags & ZEND_ACC_PUBLIC) || ce == CG(active_class_entry)) {
+ return fbc;
+ }
+
+ if (!(fbc->common.fn_flags & ZEND_ACC_PRIVATE)
+ && (fbc->common.scope->ce_flags & ZEND_ACC_LINKED)
+ && (!CG(active_class_entry) || (CG(active_class_entry)->ce_flags & ZEND_ACC_LINKED))
+ && zend_check_protected(zend_get_function_root_class(fbc), CG(active_class_entry))) {
+ return fbc;
+ }
+
+ return NULL;
+}
+/* }}} */
+
void zend_compile_static_call(znode *result, zend_ast *ast, uint32_t type) /* {{{ */
{
zend_ast *class_ast = ast->child[0];
@@ -4000,18 +4230,7 @@ void zend_compile_static_call(znode *result, zend_ast *ast, uint32_t type) /* {{
}
if (ce) {
zend_string *lcname = Z_STR_P(CT_CONSTANT(opline->op2) + 1);
- fbc = zend_hash_find_ptr(&ce->function_table, lcname);
- if (fbc && !(fbc->common.fn_flags & ZEND_ACC_PUBLIC)) {
- if (ce != CG(active_class_entry)
- && ((fbc->common.fn_flags & ZEND_ACC_PRIVATE)
- || !(fbc->common.scope->ce_flags & ZEND_ACC_LINKED)
- || (CG(active_class_entry)
- && !(CG(active_class_entry)->ce_flags & ZEND_ACC_LINKED))
- || !zend_check_protected(zend_get_function_root_class(fbc), CG(active_class_entry)))) {
- /* incompatibe function */
- fbc = NULL;
- }
- }
+ fbc = zend_get_compatible_func_or_null(ce, lcname);
}
}
@@ -5265,11 +5484,11 @@ ZEND_API void zend_set_function_arg_flags(zend_function *func) /* {{{ */
n = MIN(func->common.num_args, MAX_ARG_FLAG_NUM);
i = 0;
while (i < n) {
- ZEND_SET_ARG_FLAG(func, i + 1, func->common.arg_info[i].pass_by_reference);
+ ZEND_SET_ARG_FLAG(func, i + 1, ZEND_ARG_SEND_MODE(&func->common.arg_info[i]));
i++;
}
- if (UNEXPECTED(func->common.fn_flags & ZEND_ACC_VARIADIC && func->common.arg_info[i].pass_by_reference)) {
- uint32_t pass_by_reference = func->common.arg_info[i].pass_by_reference;
+ if (UNEXPECTED(func->common.fn_flags & ZEND_ACC_VARIADIC && ZEND_ARG_SEND_MODE(&func->common.arg_info[i]))) {
+ uint32_t pass_by_reference = ZEND_ARG_SEND_MODE(&func->common.arg_info[i]);
while (i < MAX_ARG_FLAG_NUM) {
ZEND_SET_ARG_FLAG(func, i + 1, pass_by_reference);
i++;
@@ -5279,18 +5498,11 @@ ZEND_API void zend_set_function_arg_flags(zend_function *func) /* {{{ */
}
/* }}} */
-static zend_type zend_compile_typename(zend_ast *ast, zend_bool force_allow_null) /* {{{ */
+static zend_type zend_compile_single_typename(zend_ast *ast)
{
- zend_bool allow_null = force_allow_null;
- zend_ast_attr orig_ast_attr = ast->attr;
- zend_type type;
- if (ast->attr & ZEND_TYPE_NULLABLE) {
- allow_null = 1;
- ast->attr &= ~ZEND_TYPE_NULLABLE;
- }
-
+ ZEND_ASSERT(!(ast->attr & ZEND_TYPE_NULLABLE));
if (ast->kind == ZEND_AST_TYPE) {
- return ZEND_TYPE_ENCODE(ast->attr, allow_null);
+ return (zend_type) ZEND_TYPE_INIT_CODE(ast->attr, 0, 0);
} else {
zend_string *class_name = zend_ast_get_str(ast);
zend_uchar type_code = zend_lookup_builtin_type_by_name(class_name);
@@ -5301,8 +5513,10 @@ static zend_type zend_compile_typename(zend_ast *ast, zend_bool force_allow_null
"Type declaration '%s' must be unqualified",
ZSTR_VAL(zend_string_tolower(class_name)));
}
- type = ZEND_TYPE_ENCODE(type_code, allow_null);
+ return (zend_type) ZEND_TYPE_INIT_CODE(type_code, 0, 0);
} else {
+ const char *correct_name;
+ zend_string *orig_name = zend_ast_get_str(ast);
uint32_t fetch_type = zend_get_class_fetch_type_ast(ast);
if (fetch_type == ZEND_FETCH_CLASS_DEFAULT) {
class_name = zend_resolve_class_name_ast(ast);
@@ -5312,7 +5526,154 @@ static zend_type zend_compile_typename(zend_ast *ast, zend_bool force_allow_null
zend_string_addref(class_name);
}
- type = ZEND_TYPE_ENCODE_CLASS(class_name, allow_null);
+ if (ast->attr == ZEND_NAME_NOT_FQ
+ && zend_is_confusable_type(orig_name, &correct_name)
+ && zend_is_not_imported(orig_name)) {
+ const char *extra =
+ FC(current_namespace) ? " or import the class with \"use\"" : "";
+ if (correct_name) {
+ zend_error(E_COMPILE_WARNING,
+ "\"%s\" will be interpreted as a class name. Did you mean \"%s\"? "
+ "Write \"\\%s\"%s to suppress this warning",
+ ZSTR_VAL(orig_name), correct_name, ZSTR_VAL(class_name), extra);
+ } else {
+ zend_error(E_COMPILE_WARNING,
+ "\"%s\" is not a supported builtin type "
+ "and will be interpreted as a class name. "
+ "Write \"\\%s\"%s to suppress this warning",
+ ZSTR_VAL(orig_name), ZSTR_VAL(class_name), extra);
+ }
+ }
+
+ return (zend_type) ZEND_TYPE_INIT_CLASS(class_name, 0, 0);
+ }
+ }
+}
+
+static zend_bool zend_type_contains_traversable(zend_type type) {
+ zend_type *single_type;
+ ZEND_TYPE_FOREACH(type, single_type) {
+ if (ZEND_TYPE_HAS_NAME(*single_type)
+ && zend_string_equals_literal_ci(ZEND_TYPE_NAME(*single_type), "Traversable")) {
+ return 1;
+ }
+ } ZEND_TYPE_FOREACH_END();
+ return 0;
+}
+
+// TODO: Ideally we'd canonicalize "iterable" into "array|Traversable" and essentially
+// treat it as a built-in type alias.
+static zend_type zend_compile_typename(
+ zend_ast *ast, zend_bool force_allow_null, zend_bool use_arena) /* {{{ */
+{
+ zend_bool allow_null = force_allow_null;
+ zend_ast_attr orig_ast_attr = ast->attr;
+ zend_type type = ZEND_TYPE_INIT_NONE(0);
+ if (ast->attr & ZEND_TYPE_NULLABLE) {
+ allow_null = 1;
+ ast->attr &= ~ZEND_TYPE_NULLABLE;
+ }
+
+ if (ast->kind == ZEND_AST_TYPE_UNION) {
+ zend_ast_list *list = zend_ast_get_list(ast);
+ for (uint32_t i = 0; i < list->children; i++) {
+ zend_ast *type_ast = list->child[i];
+ zend_type single_type = zend_compile_single_typename(type_ast);
+ uint32_t type_mask_overlap =
+ ZEND_TYPE_PURE_MASK(type) & ZEND_TYPE_PURE_MASK(single_type);
+ if (type_mask_overlap) {
+ zend_type overlap_type = ZEND_TYPE_INIT_MASK(type_mask_overlap);
+ zend_string *overlap_type_str = zend_type_to_string(overlap_type);
+ zend_error_noreturn(E_COMPILE_ERROR,
+ "Duplicate type %s is redundant", ZSTR_VAL(overlap_type_str));
+ }
+ ZEND_TYPE_FULL_MASK(type) |= ZEND_TYPE_PURE_MASK(single_type);
+ ZEND_TYPE_FULL_MASK(single_type) &= ~_ZEND_TYPE_MAY_BE_MASK;
+
+ if (ZEND_TYPE_HAS_CLASS(single_type)) {
+ if (!ZEND_TYPE_HAS_CLASS(type)) {
+ /* The first class type can be stored directly as the type ptr payload. */
+ ZEND_TYPE_SET_PTR(type, ZEND_TYPE_NAME(single_type));
+ ZEND_TYPE_FULL_MASK(type) |= _ZEND_TYPE_NAME_BIT;
+ } else {
+ zend_type_list *list;
+ if (ZEND_TYPE_HAS_LIST(type)) {
+ /* Add name to existing name list. */
+ zend_type_list *old_list = ZEND_TYPE_LIST(type);
+ if (use_arena) {
+ // TODO: Add a zend_arena_realloc API?
+ list = zend_arena_alloc(
+ &CG(arena), ZEND_TYPE_LIST_SIZE(old_list->num_types + 1));
+ memcpy(list, old_list, ZEND_TYPE_LIST_SIZE(old_list->num_types));
+ } else {
+ list = erealloc(old_list, ZEND_TYPE_LIST_SIZE(old_list->num_types + 1));
+ }
+ } else {
+ /* Switch from single name to name list. */
+ size_t size = ZEND_TYPE_LIST_SIZE(2);
+ list = use_arena ? zend_arena_alloc(&CG(arena), size) : emalloc(size);
+ list->num_types = 1;
+ list->types[0] = type;
+ ZEND_TYPE_FULL_MASK(list->types[0]) &= ~_ZEND_TYPE_MAY_BE_MASK;
+ }
+
+ list->types[list->num_types++] = single_type;
+ ZEND_TYPE_SET_LIST(type, list);
+ if (use_arena) {
+ ZEND_TYPE_FULL_MASK(type) |= _ZEND_TYPE_ARENA_BIT;
+ }
+
+ /* Check for trivially redundant class types */
+ for (size_t i = 0; i < list->num_types - 1; i++) {
+ if (zend_string_equals_ci(
+ ZEND_TYPE_NAME(list->types[i]), ZEND_TYPE_NAME(single_type))) {
+ zend_string *single_type_str = zend_type_to_string(single_type);
+ zend_error_noreturn(E_COMPILE_ERROR,
+ "Duplicate type %s is redundant", ZSTR_VAL(single_type_str));
+ }
+ }
+ }
+ }
+ }
+ } else {
+ type = zend_compile_single_typename(ast);
+ }
+
+ if (allow_null) {
+ ZEND_TYPE_FULL_MASK(type) |= MAY_BE_NULL;
+ }
+
+ uint32_t type_mask = ZEND_TYPE_PURE_MASK(type);
+ if ((type_mask & (MAY_BE_ARRAY|MAY_BE_ITERABLE)) == (MAY_BE_ARRAY|MAY_BE_ITERABLE)) {
+ zend_string *type_str = zend_type_to_string(type);
+ zend_error_noreturn(E_COMPILE_ERROR,
+ "Type %s contains both iterable and array, which is redundant", ZSTR_VAL(type_str));
+ }
+
+ if ((type_mask & MAY_BE_ITERABLE) && zend_type_contains_traversable(type)) {
+ zend_string *type_str = zend_type_to_string(type);
+ zend_error_noreturn(E_COMPILE_ERROR,
+ "Type %s contains both iterable and Traversable, which is redundant",
+ ZSTR_VAL(type_str));
+ }
+
+ if ((type_mask & MAY_BE_OBJECT) && ZEND_TYPE_HAS_CLASS(type)) {
+ zend_string *type_str = zend_type_to_string(type);
+ zend_error_noreturn(E_COMPILE_ERROR,
+ "Type %s contains both object and a class type, which is redundant",
+ ZSTR_VAL(type_str));
+ }
+
+ if ((type_mask & MAY_BE_VOID) && (ZEND_TYPE_HAS_CLASS(type) || type_mask != MAY_BE_VOID)) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Void can only be used as a standalone type");
+ }
+
+ if ((type_mask & (MAY_BE_NULL|MAY_BE_FALSE))
+ && !ZEND_TYPE_HAS_CLASS(type) && !(type_mask & ~(MAY_BE_NULL|MAY_BE_FALSE))) {
+ if (type_mask == MAY_BE_NULL) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Null can not be used as a standalone type");
+ } else {
+ zend_error_noreturn(E_COMPILE_ERROR, "False can not be used as a standalone type");
}
}
@@ -5321,6 +5682,24 @@ static zend_type zend_compile_typename(zend_ast *ast, zend_bool force_allow_null
}
/* }}} */
+/* May convert value from int to float. */
+static zend_bool zend_is_valid_default_value(zend_type type, zval *value)
+{
+ ZEND_ASSERT(ZEND_TYPE_IS_SET(type));
+ if (ZEND_TYPE_CONTAINS_CODE(type, Z_TYPE_P(value))) {
+ return 1;
+ }
+ if ((ZEND_TYPE_FULL_MASK(type) & MAY_BE_DOUBLE) && Z_TYPE_P(value) == IS_LONG) {
+ /* Integers are allowed as initializers for floating-point values. */
+ convert_to_double(value);
+ return 1;
+ }
+ if ((ZEND_TYPE_FULL_MASK(type) & MAY_BE_ITERABLE) && Z_TYPE_P(value) == IS_ARRAY) {
+ return 1;
+ }
+ return 0;
+}
+
void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast) /* {{{ */
{
zend_ast_list *list = zend_ast_get_list(ast);
@@ -5332,14 +5711,10 @@ void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast) /* {{{ */
/* Use op_array->arg_info[-1] for return type */
arg_infos = safe_emalloc(sizeof(zend_arg_info), list->children + 1, 0);
arg_infos->name = NULL;
- arg_infos->pass_by_reference = (op_array->fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0;
- arg_infos->is_variadic = 0;
- arg_infos->type = zend_compile_typename(return_type_ast, 0);
-
- if (ZEND_TYPE_CODE(arg_infos->type) == IS_VOID && ZEND_TYPE_ALLOW_NULL(arg_infos->type)) {
- zend_error_noreturn(E_COMPILE_ERROR, "Void type cannot be nullable");
- }
-
+ arg_infos->type = zend_compile_typename(
+ return_type_ast, /* force_allow_null */ 0, /* use_arena */ 0);
+ ZEND_TYPE_FULL_MASK(arg_infos->type) |= _ZEND_ARG_INFO_FLAGS(
+ (op_array->fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0, /* is_variadic */ 0);
arg_infos++;
op_array->fn_flags |= ZEND_ACC_HAS_RETURN_TYPE;
} else {
@@ -5407,75 +5782,26 @@ void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast) /* {{{ */
arg_info = &arg_infos[i];
arg_info->name = zend_string_copy(name);
- arg_info->pass_by_reference = is_ref;
- arg_info->is_variadic = is_variadic;
- /* TODO: Keep compatibility, but may be better reset "allow_null" ??? */
- arg_info->type = ZEND_TYPE_ENCODE(0, 1);
+ arg_info->type = (zend_type) ZEND_TYPE_INIT_NONE(0);
if (type_ast) {
- zend_bool has_null_default = default_ast
- && (Z_TYPE(default_node.u.constant) == IS_NULL
- || (Z_TYPE(default_node.u.constant) == IS_CONSTANT_AST
- && Z_ASTVAL(default_node.u.constant)->kind == ZEND_AST_CONSTANT
- && strcasecmp(ZSTR_VAL(zend_ast_get_constant_name(Z_ASTVAL(default_node.u.constant))), "NULL") == 0));
+ uint32_t default_type = default_ast ? Z_TYPE(default_node.u.constant) : IS_UNDEF;
op_array->fn_flags |= ZEND_ACC_HAS_TYPE_HINTS;
- arg_info->type = zend_compile_typename(type_ast, has_null_default);
+ arg_info->type = zend_compile_typename(
+ type_ast, default_type == IS_NULL, /* use_arena */ 0);
- if (ZEND_TYPE_CODE(arg_info->type) == IS_VOID) {
+ if (ZEND_TYPE_FULL_MASK(arg_info->type) & MAY_BE_VOID) {
zend_error_noreturn(E_COMPILE_ERROR, "void cannot be used as a parameter type");
}
- if (type_ast->kind == ZEND_AST_TYPE) {
- if (ZEND_TYPE_CODE(arg_info->type) == IS_ARRAY) {
- if (default_ast && !has_null_default
- && Z_TYPE(default_node.u.constant) != IS_ARRAY
- && Z_TYPE(default_node.u.constant) != IS_CONSTANT_AST
- ) {
- zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters "
- "with array type can only be an array or NULL");
- }
- } else if (ZEND_TYPE_CODE(arg_info->type) == IS_CALLABLE && default_ast) {
- if (!has_null_default && Z_TYPE(default_node.u.constant) != IS_CONSTANT_AST) {
- zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters "
- "with callable type can only be NULL");
- }
- }
- } else {
- if (default_ast && !has_null_default && Z_TYPE(default_node.u.constant) != IS_CONSTANT_AST) {
- if (ZEND_TYPE_IS_CLASS(arg_info->type)) {
- zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters "
- "with a class type can only be NULL");
- } else switch (ZEND_TYPE_CODE(arg_info->type)) {
- case IS_DOUBLE:
- if (Z_TYPE(default_node.u.constant) != IS_DOUBLE && Z_TYPE(default_node.u.constant) != IS_LONG) {
- zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters "
- "with a float type can only be float, integer, or NULL");
- }
- convert_to_double(&default_node.u.constant);
- break;
-
- case IS_ITERABLE:
- if (Z_TYPE(default_node.u.constant) != IS_ARRAY) {
- zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters "
- "with iterable type can only be an array or NULL");
- }
- break;
-
- case IS_OBJECT:
- zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters "
- "with an object type can only be NULL");
- break;
-
- default:
- if (!ZEND_SAME_FAKE_TYPE(ZEND_TYPE_CODE(arg_info->type), Z_TYPE(default_node.u.constant))) {
- zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters "
- "with a %s type can only be %s or NULL",
- zend_get_type_by_const(ZEND_TYPE_CODE(arg_info->type)), zend_get_type_by_const(ZEND_TYPE_CODE(arg_info->type)));
- }
- break;
- }
- }
+ if (default_type > IS_NULL && default_type != IS_CONSTANT_AST
+ && !zend_is_valid_default_value(arg_info->type, &default_node.u.constant)) {
+ zend_string *type_str = zend_type_to_string(arg_info->type);
+ zend_error_noreturn(E_COMPILE_ERROR,
+ "Cannot use %s as default value for parameter $%s of type %s",
+ zend_get_type_by_const(default_type),
+ ZSTR_VAL(name), ZSTR_VAL(type_str));
}
}
@@ -5485,22 +5811,14 @@ void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast) /* {{{ */
if (type_ast) {
/* Allocate cache slot to speed-up run-time class resolution */
- if (opline->opcode == ZEND_RECV_INIT) {
- if (ZEND_TYPE_IS_CLASS(arg_info->type)) {
- opline->extended_value = zend_alloc_cache_slot();
- }
- } else {
- if (ZEND_TYPE_IS_CLASS(arg_info->type)) {
- opline->op2.num = op_array->cache_size;
- op_array->cache_size += sizeof(void*);
- } else {
- opline->op2.num = -1;
- }
- }
- } else {
- if (opline->opcode != ZEND_RECV_INIT) {
- opline->op2.num = -1;
- }
+ opline->extended_value =
+ zend_alloc_cache_slots(zend_type_get_num_classes(arg_info->type));
+ }
+
+ ZEND_TYPE_FULL_MASK(arg_info->type) |= _ZEND_ARG_INFO_FLAGS(is_ref, is_variadic);
+ if (opcode == ZEND_RECV) {
+ opline->op2.num = type_ast ?
+ ZEND_TYPE_FULL_MASK(arg_info->type) : MAY_BE_ANY;
}
}
@@ -5701,18 +6019,30 @@ static void zend_compile_implicit_closure_uses(closure_info *info)
ZEND_HASH_FOREACH_END();
}
+static void zend_check_magic_method_attr(uint32_t attr, const char* method, zend_bool is_static) /* {{{ */
+{
+ if (is_static) {
+ if (!(attr & ZEND_ACC_PUBLIC) || !(attr & ZEND_ACC_STATIC)) {
+ zend_error(E_WARNING, "The magic method %s() must have public visibility and be static", method);
+ }
+ } else if (!(attr & ZEND_ACC_PUBLIC) || (attr & ZEND_ACC_STATIC)) {
+ zend_error(E_WARNING,
+ "The magic method %s() must have public visibility and cannot be static",
+ method);
+ }
+}
+/* }}} */
+
void zend_begin_method_decl(zend_op_array *op_array, zend_string *name, zend_bool has_body) /* {{{ */
{
zend_class_entry *ce = CG(active_class_entry);
zend_bool in_interface = (ce->ce_flags & ZEND_ACC_INTERFACE) != 0;
- zend_bool in_trait = (ce->ce_flags & ZEND_ACC_TRAIT) != 0;
- zend_bool is_public = (op_array->fn_flags & ZEND_ACC_PUBLIC) != 0;
- zend_bool is_static = (op_array->fn_flags & ZEND_ACC_STATIC) != 0;
+ uint32_t fn_flags = op_array->fn_flags;
zend_string *lcname;
if (in_interface) {
- if (!is_public || (op_array->fn_flags & (ZEND_ACC_FINAL|ZEND_ACC_ABSTRACT))) {
+ if (!(fn_flags & ZEND_ACC_PUBLIC) || (fn_flags & (ZEND_ACC_FINAL|ZEND_ACC_ABSTRACT))) {
zend_error_noreturn(E_COMPILE_ERROR, "Access type for interface method "
"%s::%s() must be omitted", ZSTR_VAL(ce->name), ZSTR_VAL(name));
}
@@ -5747,134 +6077,48 @@ void zend_begin_method_decl(zend_op_array *op_array, zend_string *name, zend_boo
ZSTR_VAL(ce->name), ZSTR_VAL(name));
}
- if (in_interface) {
- if (ZSTR_VAL(lcname)[0] != '_' || ZSTR_VAL(lcname)[1] != '_') {
- /* pass */
- } else if (zend_string_equals_literal(lcname, ZEND_CALL_FUNC_NAME)) {
- if (!is_public || is_static) {
- zend_error(E_WARNING, "The magic method __call() must have "
- "public visibility and cannot be static");
- }
- } else if (zend_string_equals_literal(lcname, ZEND_CALLSTATIC_FUNC_NAME)) {
- if (!is_public || !is_static) {
- zend_error(E_WARNING, "The magic method __callStatic() must have "
- "public visibility and be static");
- }
- } else if (zend_string_equals_literal(lcname, ZEND_GET_FUNC_NAME)) {
- if (!is_public || is_static) {
- zend_error(E_WARNING, "The magic method __get() must have "
- "public visibility and cannot be static");
- }
- } else if (zend_string_equals_literal(lcname, ZEND_SET_FUNC_NAME)) {
- if (!is_public || is_static) {
- zend_error(E_WARNING, "The magic method __set() must have "
- "public visibility and cannot be static");
- }
- } else if (zend_string_equals_literal(lcname, ZEND_UNSET_FUNC_NAME)) {
- if (!is_public || is_static) {
- zend_error(E_WARNING, "The magic method __unset() must have "
- "public visibility and cannot be static");
- }
- } else if (zend_string_equals_literal(lcname, ZEND_ISSET_FUNC_NAME)) {
- if (!is_public || is_static) {
- zend_error(E_WARNING, "The magic method __isset() must have "
- "public visibility and cannot be static");
- }
- } else if (zend_string_equals_literal(lcname, ZEND_TOSTRING_FUNC_NAME)) {
- if (!is_public || is_static) {
- zend_error(E_WARNING, "The magic method __toString() must have "
- "public visibility and cannot be static");
- }
- } else if (zend_string_equals_literal(lcname, ZEND_INVOKE_FUNC_NAME)) {
- if (!is_public || is_static) {
- zend_error(E_WARNING, "The magic method __invoke() must have "
- "public visibility and cannot be static");
- }
- } else if (zend_string_equals_literal(lcname, ZEND_DEBUGINFO_FUNC_NAME)) {
- if (!is_public || is_static) {
- zend_error(E_WARNING, "The magic method __debugInfo() must have "
- "public visibility and cannot be static");
- }
- }
- } else {
- if (!in_trait && zend_string_equals_ci(lcname, ce->name)) {
- if (!ce->constructor) {
- ce->constructor = (zend_function *) op_array;
- }
- } else if (zend_string_equals_literal(lcname, "serialize")) {
- ce->serialize_func = (zend_function *) op_array;
- } else if (zend_string_equals_literal(lcname, "unserialize")) {
- ce->unserialize_func = (zend_function *) op_array;
- } else if (ZSTR_VAL(lcname)[0] != '_' || ZSTR_VAL(lcname)[1] != '_') {
- if (!is_static) {
- op_array->fn_flags |= ZEND_ACC_ALLOW_STATIC;
- }
- } else if (zend_string_equals_literal(lcname, ZEND_CONSTRUCTOR_FUNC_NAME)) {
- ce->constructor = (zend_function *) op_array;
- } else if (zend_string_equals_literal(lcname, ZEND_DESTRUCTOR_FUNC_NAME)) {
- ce->destructor = (zend_function *) op_array;
- } else if (zend_string_equals_literal(lcname, ZEND_CLONE_FUNC_NAME)) {
- ce->clone = (zend_function *) op_array;
- } else if (zend_string_equals_literal(lcname, ZEND_CALL_FUNC_NAME)) {
- if (!is_public || is_static) {
- zend_error(E_WARNING, "The magic method __call() must have "
- "public visibility and cannot be static");
- }
- ce->__call = (zend_function *) op_array;
- } else if (zend_string_equals_literal(lcname, ZEND_CALLSTATIC_FUNC_NAME)) {
- if (!is_public || !is_static) {
- zend_error(E_WARNING, "The magic method __callStatic() must have "
- "public visibility and be static");
- }
- ce->__callstatic = (zend_function *) op_array;
- } else if (zend_string_equals_literal(lcname, ZEND_GET_FUNC_NAME)) {
- if (!is_public || is_static) {
- zend_error(E_WARNING, "The magic method __get() must have "
- "public visibility and cannot be static");
- }
- ce->__get = (zend_function *) op_array;
- ce->ce_flags |= ZEND_ACC_USE_GUARDS;
- } else if (zend_string_equals_literal(lcname, ZEND_SET_FUNC_NAME)) {
- if (!is_public || is_static) {
- zend_error(E_WARNING, "The magic method __set() must have "
- "public visibility and cannot be static");
- }
- ce->__set = (zend_function *) op_array;
- ce->ce_flags |= ZEND_ACC_USE_GUARDS;
- } else if (zend_string_equals_literal(lcname, ZEND_UNSET_FUNC_NAME)) {
- if (!is_public || is_static) {
- zend_error(E_WARNING, "The magic method __unset() must have "
- "public visibility and cannot be static");
- }
- ce->__unset = (zend_function *) op_array;
- ce->ce_flags |= ZEND_ACC_USE_GUARDS;
- } else if (zend_string_equals_literal(lcname, ZEND_ISSET_FUNC_NAME)) {
- if (!is_public || is_static) {
- zend_error(E_WARNING, "The magic method __isset() must have "
- "public visibility and cannot be static");
- }
- ce->__isset = (zend_function *) op_array;
- ce->ce_flags |= ZEND_ACC_USE_GUARDS;
- } else if (zend_string_equals_literal(lcname, ZEND_TOSTRING_FUNC_NAME)) {
- if (!is_public || is_static) {
- zend_error(E_WARNING, "The magic method __toString() must have "
- "public visibility and cannot be static");
- }
- ce->__tostring = (zend_function *) op_array;
- } else if (zend_string_equals_literal(lcname, ZEND_INVOKE_FUNC_NAME)) {
- if (!is_public || is_static) {
- zend_error(E_WARNING, "The magic method __invoke() must have "
- "public visibility and cannot be static");
- }
- } else if (zend_string_equals_literal(lcname, ZEND_DEBUGINFO_FUNC_NAME)) {
- if (!is_public || is_static) {
- zend_error(E_WARNING, "The magic method __debugInfo() must have "
- "public visibility and cannot be static");
- }
- ce->__debugInfo = (zend_function *) op_array;
- } else if (!is_static) {
- op_array->fn_flags |= ZEND_ACC_ALLOW_STATIC;
- }
+ if (zend_string_equals_literal(lcname, "serialize")) {
+ ce->serialize_func = (zend_function *) op_array;
+ } else if (zend_string_equals_literal(lcname, "unserialize")) {
+ ce->unserialize_func = (zend_function *) op_array;
+ } else if (ZSTR_VAL(lcname)[0] != '_' || ZSTR_VAL(lcname)[1] != '_') {
+ /* pass */
+ } else if (zend_string_equals_literal(lcname, ZEND_CONSTRUCTOR_FUNC_NAME)) {
+ ce->constructor = (zend_function *) op_array;
+ } else if (zend_string_equals_literal(lcname, ZEND_DESTRUCTOR_FUNC_NAME)) {
+ ce->destructor = (zend_function *) op_array;
+ } else if (zend_string_equals_literal(lcname, ZEND_CLONE_FUNC_NAME)) {
+ ce->clone = (zend_function *) op_array;
+ } else if (zend_string_equals_literal(lcname, ZEND_CALL_FUNC_NAME)) {
+ zend_check_magic_method_attr(fn_flags, "__call", 0);
+ ce->__call = (zend_function *) op_array;
+ } else if (zend_string_equals_literal(lcname, ZEND_CALLSTATIC_FUNC_NAME)) {
+ zend_check_magic_method_attr(fn_flags, "__callStatic", 1);
+ ce->__callstatic = (zend_function *) op_array;
+ } else if (zend_string_equals_literal(lcname, ZEND_GET_FUNC_NAME)) {
+ zend_check_magic_method_attr(fn_flags, "__get", 0);
+ ce->__get = (zend_function *) op_array;
+ ce->ce_flags |= ZEND_ACC_USE_GUARDS;
+ } else if (zend_string_equals_literal(lcname, ZEND_SET_FUNC_NAME)) {
+ zend_check_magic_method_attr(fn_flags, "__set", 0);
+ ce->__set = (zend_function *) op_array;
+ ce->ce_flags |= ZEND_ACC_USE_GUARDS;
+ } else if (zend_string_equals_literal(lcname, ZEND_UNSET_FUNC_NAME)) {
+ zend_check_magic_method_attr(fn_flags, "__unset", 0);
+ ce->__unset = (zend_function *) op_array;
+ ce->ce_flags |= ZEND_ACC_USE_GUARDS;
+ } else if (zend_string_equals_literal(lcname, ZEND_ISSET_FUNC_NAME)) {
+ zend_check_magic_method_attr(fn_flags, "__isset", 0);
+ ce->__isset = (zend_function *) op_array;
+ ce->ce_flags |= ZEND_ACC_USE_GUARDS;
+ } else if (zend_string_equals_literal(lcname, ZEND_TOSTRING_FUNC_NAME)) {
+ zend_check_magic_method_attr(fn_flags, "__toString", 0);
+ ce->__tostring = (zend_function *) op_array;
+ } else if (zend_string_equals_literal(lcname, ZEND_INVOKE_FUNC_NAME)) {
+ zend_check_magic_method_attr(fn_flags, "__invoke", 0);
+ } else if (zend_string_equals_literal(lcname, ZEND_DEBUGINFO_FUNC_NAME)) {
+ zend_check_magic_method_attr(fn_flags, "__debugInfo", 0);
+ ce->__debugInfo = (zend_function *) op_array;
}
zend_string_release_ex(lcname, 0);
@@ -5883,7 +6127,6 @@ void zend_begin_method_decl(zend_op_array *op_array, zend_string *name, zend_boo
static void zend_begin_func_decl(znode *result, zend_op_array *op_array, zend_ast_decl *decl, zend_bool toplevel) /* {{{ */
{
- zend_ast *params_ast = decl->child[0];
zend_string *unqualified_name, *name, *lcname, *key;
zend_op *opline;
@@ -5900,18 +6143,14 @@ static void zend_begin_func_decl(znode *result, zend_op_array *op_array, zend_as
}
}
- if (zend_string_equals_literal(lcname, ZEND_AUTOLOAD_FUNC_NAME)) {
- if (zend_ast_get_list(params_ast)->children != 1) {
- zend_error_noreturn(E_COMPILE_ERROR, "%s() must take exactly 1 argument",
- ZEND_AUTOLOAD_FUNC_NAME);
- }
-
- zend_error(E_DEPRECATED, "__autoload() is deprecated, use spl_autoload_register() instead");
+ if (zend_string_equals_literal(lcname, "__autoload")) {
+ zend_error_noreturn(E_COMPILE_ERROR,
+ "__autoload() is no longer supported, use spl_autoload_register() instead");
}
if (zend_string_equals_literal_ci(unqualified_name, "assert")) {
- zend_error(E_DEPRECATED,
- "Defining a custom assert() function is deprecated, "
+ zend_error(E_COMPILE_ERROR,
+ "Defining a custom assert() function is not allowed, "
"as the function has special semantics");
}
@@ -6083,17 +6322,16 @@ void zend_compile_prop_decl(zend_ast *ast, zend_ast *type_ast, uint32_t flags) /
zend_string *name = zval_make_interned_string(zend_ast_get_zval(name_ast));
zend_string *doc_comment = NULL;
zval value_zv;
- zend_type type = 0;
+ zend_type type = ZEND_TYPE_INIT_NONE(0);
if (type_ast) {
- type = zend_compile_typename(type_ast, 0);
+ type = zend_compile_typename(type_ast, /* force_allow_null */ 0, /* use_arena */ 1);
- if (ZEND_TYPE_CODE(type) == IS_VOID || ZEND_TYPE_CODE(type) == IS_CALLABLE) {
+ if (ZEND_TYPE_FULL_MASK(type) & (MAY_BE_VOID|MAY_BE_CALLABLE)) {
+ zend_string *str = zend_type_to_string(type);
zend_error_noreturn(E_COMPILE_ERROR,
"Property %s::$%s cannot have type %s",
- ZSTR_VAL(ce->name),
- ZSTR_VAL(name),
- zend_get_type_by_const(ZEND_TYPE_CODE(type)));
+ ZSTR_VAL(ce->name), ZSTR_VAL(name), ZSTR_VAL(str));
}
}
@@ -6116,36 +6354,19 @@ void zend_compile_prop_decl(zend_ast *ast, zend_ast *type_ast, uint32_t flags) /
if (value_ast) {
zend_const_expr_to_zval(&value_zv, value_ast);
- if (ZEND_TYPE_IS_SET(type) && !Z_CONSTANT(value_zv)) {
+ if (ZEND_TYPE_IS_SET(type) && !Z_CONSTANT(value_zv)
+ && !zend_is_valid_default_value(type, &value_zv)) {
+ zend_string *str = zend_type_to_string(type);
if (Z_TYPE(value_zv) == IS_NULL) {
- if (!ZEND_TYPE_ALLOW_NULL(type)) {
- const char *name = ZEND_TYPE_IS_CLASS(type)
- ? ZSTR_VAL(ZEND_TYPE_NAME(type)) : zend_get_type_by_const(ZEND_TYPE_CODE(type));
- zend_error_noreturn(E_COMPILE_ERROR,
- "Default value for property of type %s may not be null. "
- "Use the nullable type ?%s to allow null default value",
- name, name);
- }
- } else if (ZEND_TYPE_IS_CLASS(type)) {
zend_error_noreturn(E_COMPILE_ERROR,
- "Property of type %s may not have default value", ZSTR_VAL(ZEND_TYPE_NAME(type)));
- } else if (ZEND_TYPE_CODE(type) == IS_ARRAY || ZEND_TYPE_CODE(type) == IS_ITERABLE) {
- if (Z_TYPE(value_zv) != IS_ARRAY) {
- zend_error_noreturn(E_COMPILE_ERROR,
- "Default value for property of type %s can only be an array",
- zend_get_type_by_const(ZEND_TYPE_CODE(type)));
- }
- } else if (ZEND_TYPE_CODE(type) == IS_DOUBLE) {
- if (Z_TYPE(value_zv) != IS_DOUBLE && Z_TYPE(value_zv) != IS_LONG) {
- zend_error_noreturn(E_COMPILE_ERROR,
- "Default value for property of type float can only be float or int");
- }
- convert_to_double(&value_zv);
- } else if (!ZEND_SAME_FAKE_TYPE(ZEND_TYPE_CODE(type), Z_TYPE(value_zv))) {
+ "Default value for property of type %s may not be null. "
+ "Use the nullable type ?%s to allow null default value",
+ ZSTR_VAL(str), ZSTR_VAL(str));
+ } else {
zend_error_noreturn(E_COMPILE_ERROR,
- "Default value for property of type %s can only be %s",
- zend_get_type_by_const(ZEND_TYPE_CODE(type)),
- zend_get_type_by_const(ZEND_TYPE_CODE(type)));
+ "Cannot use %s as default value for property %s::$%s of type %s",
+ zend_get_type_by_const(Z_TYPE(value_zv)),
+ ZSTR_VAL(ce->name), ZSTR_VAL(name), ZSTR_VAL(str));
}
}
} else if (!ZEND_TYPE_IS_SET(type)) {
@@ -6168,6 +6389,18 @@ void zend_compile_prop_group(zend_ast *list) /* {{{ */
}
/* }}} */
+static void zend_check_const_and_trait_alias_attr(uint32_t attr, const char* entity) /* {{{ */
+{
+ if (attr & ZEND_ACC_STATIC) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot use 'static' as %s modifier", entity);
+ } else if (attr & ZEND_ACC_ABSTRACT) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot use 'abstract' as %s modifier", entity);
+ } else if (attr & ZEND_ACC_FINAL) {
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot use 'final' as %s modifier", entity);
+ }
+}
+/* }}} */
+
void zend_compile_class_const_decl(zend_ast *ast) /* {{{ */
{
zend_ast_list *list = zend_ast_get_list(ast);
@@ -6189,13 +6422,7 @@ void zend_compile_class_const_decl(zend_ast *ast) /* {{{ */
zval value_zv;
if (UNEXPECTED(ast->attr & (ZEND_ACC_STATIC|ZEND_ACC_ABSTRACT|ZEND_ACC_FINAL))) {
- if (ast->attr & ZEND_ACC_STATIC) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use 'static' as constant modifier");
- } else if (ast->attr & ZEND_ACC_ABSTRACT) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use 'abstract' as constant modifier");
- } else if (ast->attr & ZEND_ACC_FINAL) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use 'final' as constant modifier");
- }
+ zend_check_const_and_trait_alias_attr(ast->attr, "constant");
}
zend_const_expr_to_zval(&value_zv, value_ast);
@@ -6212,7 +6439,7 @@ static void zend_compile_method_ref(zend_ast *ast, zend_trait_method_reference *
method_ref->method_name = zend_string_copy(zend_ast_get_str(method_ast));
if (class_ast) {
- method_ref->class_name = zend_resolve_class_name_ast(class_ast);
+ method_ref->class_name = zend_resolve_const_class_name_reference(class_ast, "trait name");
} else {
method_ref->class_name = NULL;
}
@@ -6232,7 +6459,8 @@ static void zend_compile_trait_precedence(zend_ast *ast) /* {{{ */
for (i = 0; i < insteadof_list->children; ++i) {
zend_ast *name_ast = insteadof_list->child[i];
- precedence->exclude_class_names[i] = zend_resolve_class_name_ast(name_ast);
+ precedence->exclude_class_names[i] =
+ zend_resolve_const_class_name_reference(name_ast, "trait name");
}
zend_add_to_list(&CG(active_class_entry)->trait_precedences, precedence);
@@ -6247,13 +6475,7 @@ static void zend_compile_trait_alias(zend_ast *ast) /* {{{ */
zend_trait_alias *alias;
- if (modifiers == ZEND_ACC_STATIC) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use 'static' as method modifier");
- } else if (modifiers == ZEND_ACC_ABSTRACT) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use 'abstract' as method modifier");
- } else if (modifiers == ZEND_ACC_FINAL) {
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use 'final' as method modifier");
- }
+ zend_check_const_and_trait_alias_attr(modifiers, "method");
alias = emalloc(sizeof(zend_trait_alias));
zend_compile_method_ref(method_ref_ast, &alias->trait_method);
@@ -6276,28 +6498,19 @@ void zend_compile_use_trait(zend_ast *ast) /* {{{ */
zend_class_entry *ce = CG(active_class_entry);
uint32_t i;
- ce->ce_flags |= ZEND_ACC_IMPLEMENT_TRAITS;
ce->trait_names = erealloc(ce->trait_names, sizeof(zend_class_name) * (ce->num_traits + traits->children));
for (i = 0; i < traits->children; ++i) {
zend_ast *trait_ast = traits->child[i];
- zend_string *name = zend_ast_get_str(trait_ast);
if (ce->ce_flags & ZEND_ACC_INTERFACE) {
+ zend_string *name = zend_ast_get_str(trait_ast);
zend_error_noreturn(E_COMPILE_ERROR, "Cannot use traits inside of interfaces. "
"%s is used in %s", ZSTR_VAL(name), ZSTR_VAL(ce->name));
}
- switch (zend_get_class_fetch_type(name)) {
- case ZEND_FETCH_CLASS_SELF:
- case ZEND_FETCH_CLASS_PARENT:
- case ZEND_FETCH_CLASS_STATIC:
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot use '%s' as trait name "
- "as it is reserved", ZSTR_VAL(name));
- break;
- }
-
- ce->trait_names[ce->num_traits].name = zend_resolve_class_name_ast(trait_ast);
+ ce->trait_names[ce->num_traits].name =
+ zend_resolve_const_class_name_reference(trait_ast, "trait name");
ce->trait_names[ce->num_traits].lc_name = zend_string_tolower(ce->trait_names[ce->num_traits].name);
ce->num_traits++;
}
@@ -6332,19 +6545,11 @@ void zend_compile_implements(zend_ast *ast) /* {{{ */
for (i = 0; i < list->children; ++i) {
zend_ast *class_ast = list->child[i];
- zend_string *name = zend_ast_get_str(class_ast);
-
- if (!zend_is_const_default_class_ref(class_ast)) {
- efree(interface_names);
- zend_error_noreturn(E_COMPILE_ERROR,
- "Cannot use '%s' as interface name as it is reserved", ZSTR_VAL(name));
- }
-
- interface_names[i].name = zend_resolve_class_name_ast(class_ast);
+ interface_names[i].name =
+ zend_resolve_const_class_name_reference(class_ast, "interface name");
interface_names[i].lc_name = zend_string_tolower(interface_names[i].name);
}
- ce->ce_flags |= ZEND_ACC_IMPLEMENT_INTERFACES;
ce->num_interfaces = list->children;
ce->interface_names = interface_names;
}
@@ -6424,24 +6629,8 @@ zend_op *zend_compile_class_decl(zend_ast *ast, zend_bool toplevel) /* {{{ */
}
if (extends_ast) {
- znode extends_node;
- zend_string *extends_name;
-
- if (!zend_is_const_default_class_ref(extends_ast)) {
- extends_name = zend_ast_get_str(extends_ast);
- zend_error_noreturn(E_COMPILE_ERROR,
- "Cannot use '%s' as class name as it is reserved", ZSTR_VAL(extends_name));
- }
-
- zend_compile_expr(&extends_node, extends_ast);
- if (extends_node.op_type != IS_CONST || Z_TYPE(extends_node.u.constant) != IS_STRING) {
- zend_error_noreturn(E_COMPILE_ERROR, "Illegal class name");
- }
- extends_name = Z_STR(extends_node.u.constant);
- ce->parent_name = zend_resolve_class_name(extends_name,
- extends_ast->kind == ZEND_AST_ZVAL ? extends_ast->attr : ZEND_NAME_FQ);
- zend_string_release_ex(extends_name, 0);
- ce->ce_flags |= ZEND_ACC_INHERITED;
+ ce->parent_name =
+ zend_resolve_const_class_name_reference(extends_ast, "class name");
}
CG(active_class_entry) = ce;
@@ -6451,11 +6640,6 @@ zend_op *zend_compile_class_decl(zend_ast *ast, zend_bool toplevel) /* {{{ */
/* Reset lineno for final opcodes and errors */
CG(zend_lineno) = ast->lineno;
- if (!(ce->ce_flags & ZEND_ACC_IMPLEMENT_TRAITS)) {
- /* For traits this check is delayed until after trait binding */
- zend_check_deprecated_constructor(ce);
- }
-
if (ce->constructor) {
ce->constructor->common.fn_flags |= ZEND_ACC_CTOR;
if (ce->constructor->common.fn_flags & ZEND_ACC_STATIC) {
@@ -6506,7 +6690,7 @@ zend_op *zend_compile_class_decl(zend_ast *ast, zend_bool toplevel) /* {{{ */
if (toplevel
/* We currently don't early-bind classes that implement interfaces or use traits */
- && !(ce->ce_flags & (ZEND_ACC_IMPLEMENT_INTERFACES|ZEND_ACC_IMPLEMENT_TRAITS))
+ && !ce->num_interfaces && !ce->num_traits
&& !(CG(compiler_options) & ZEND_COMPILE_PRELOAD)) {
if (extends_ast) {
zend_class_entry *parent_ce = zend_lookup_class_ex(
@@ -6524,13 +6708,11 @@ zend_op *zend_compile_class_decl(zend_ast *ast, zend_bool toplevel) /* {{{ */
}
CG(zend_lineno) = ast->lineno;
}
- } else {
- if (EXPECTED(zend_hash_add_ptr(CG(class_table), lcname, ce) != NULL)) {
- zend_string_release(lcname);
- zend_build_properties_info_table(ce);
- ce->ce_flags |= ZEND_ACC_LINKED;
- return NULL;
- }
+ } else if (EXPECTED(zend_hash_add_ptr(CG(class_table), lcname, ce) != NULL)) {
+ zend_string_release(lcname);
+ zend_build_properties_info_table(ce);
+ ce->ce_flags |= ZEND_ACC_LINKED;
+ return NULL;
}
}
@@ -6569,7 +6751,7 @@ zend_op *zend_compile_class_decl(zend_ast *ast, zend_bool toplevel) /* {{{ */
if (extends_ast && toplevel
&& (CG(compiler_options) & ZEND_COMPILE_DELAYED_BINDING)
/* We currently don't early-bind classes that implement interfaces or use traits */
- && !(ce->ce_flags & (ZEND_ACC_IMPLEMENT_INTERFACES|ZEND_ACC_IMPLEMENT_TRAITS))
+ && !ce->num_interfaces && !ce->num_traits
) {
CG(active_op_array)->fn_flags |= ZEND_ACC_EARLY_BINDING;
opline->opcode = ZEND_DECLARE_CLASS_DELAYED;
@@ -6665,11 +6847,6 @@ void zend_compile_use(zend_ast *ast) /* {{{ */
new_name = zend_string_copy(old_name);
if (!current_ns) {
- if (type == T_CLASS && zend_string_equals_literal(new_name, "strict")) {
- zend_error_noreturn(E_COMPILE_ERROR,
- "You seem to be trying to use a different language...");
- }
-
zend_error(E_WARNING, "The use statement with non-compound name '%s' "
"has no effect", ZSTR_VAL(new_name));
}
@@ -6698,10 +6875,8 @@ void zend_compile_use(zend_ast *ast) /* {{{ */
}
zend_string_efree(ns_name);
- } else {
- if (zend_have_seen_symbol(lookup_name, type)) {
- zend_check_already_in_use(type, old_name, new_name, lookup_name);
- }
+ } else if (zend_have_seen_symbol(lookup_name, type)) {
+ zend_check_already_in_use(type, old_name, new_name, lookup_name);
}
zend_string_addref(old_name);
@@ -6754,7 +6929,7 @@ void zend_compile_const_decl(zend_ast *ast) /* {{{ */
value_node.op_type = IS_CONST;
zend_const_expr_to_zval(value_zv, value_ast);
- if (zend_lookup_reserved_const(ZSTR_VAL(unqualified_name), ZSTR_LEN(unqualified_name))) {
+ if (zend_get_special_const(ZSTR_VAL(unqualified_name), ZSTR_LEN(unqualified_name))) {
zend_error_noreturn(E_COMPILE_ERROR,
"Cannot redeclare constant '%s'", ZSTR_VAL(unqualified_name));
}
@@ -7167,12 +7342,10 @@ static zend_bool zend_try_ct_eval_array(zval *result, zend_ast *ast) /* {{{ */
zend_error_noreturn(E_COMPILE_ERROR, "Illegal offset type");
break;
}
- } else {
- if (!zend_hash_next_index_insert(Z_ARRVAL_P(result), value)) {
- zval_ptr_dtor_nogc(value);
- zval_ptr_dtor(result);
- return 0;
- }
+ } else if (!zend_hash_next_index_insert(Z_ARRVAL_P(result), value)) {
+ zval_ptr_dtor_nogc(value);
+ zval_ptr_dtor(result);
+ return 0;
}
}
@@ -7186,16 +7359,6 @@ void zend_compile_binary_op(znode *result, zend_ast *ast) /* {{{ */
zend_ast *right_ast = ast->child[1];
uint32_t opcode = ast->attr;
- if ((opcode == ZEND_ADD || opcode == ZEND_SUB) && left_ast->kind == ZEND_AST_BINARY_OP && left_ast->attr == ZEND_CONCAT) {
- zend_error(E_DEPRECATED, "The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence");
- }
- if ((opcode == ZEND_SL || opcode == ZEND_SR) && ((left_ast->kind == ZEND_AST_BINARY_OP && left_ast->attr == ZEND_CONCAT) || (right_ast->kind == ZEND_AST_BINARY_OP && right_ast->attr == ZEND_CONCAT))) {
- zend_error(E_DEPRECATED, "The behavior of unparenthesized expressions containing both '.' and '>>'/'<<' will change in PHP 8: '<<'/'>>' will take a higher precedence");
- }
- if (opcode == ZEND_PARENTHESIZED_CONCAT) {
- opcode = ZEND_CONCAT;
- }
-
znode left_node, right_node;
zend_compile_expr(&left_node, left_ast);
zend_compile_expr(&right_node, right_ast);
@@ -7234,8 +7397,28 @@ void zend_compile_binary_op(znode *result, zend_ast *ast) /* {{{ */
break;
}
}
- }
- if (opcode == ZEND_CONCAT) {
+ } else if (opcode == ZEND_IS_IDENTICAL || opcode == ZEND_IS_NOT_IDENTICAL) {
+ /* convert $x === null to is_null($x) (i.e. ZEND_TYPE_CHECK opcode). Do the same thing for false/true. (covers IS_NULL, IS_FALSE, and IS_TRUE) */
+ if (left_node.op_type == IS_CONST) {
+ if (Z_TYPE(left_node.u.constant) <= IS_TRUE && Z_TYPE(left_node.u.constant) >= IS_NULL) {
+ zend_op *opline = zend_emit_op_tmp(result, ZEND_TYPE_CHECK, &right_node, NULL);
+ opline->extended_value =
+ (opcode == ZEND_IS_IDENTICAL) ?
+ (1 << Z_TYPE(left_node.u.constant)) :
+ (MAY_BE_ANY - (1 << Z_TYPE(left_node.u.constant)));
+ return;
+ }
+ } else if (right_node.op_type == IS_CONST) {
+ if (Z_TYPE(right_node.u.constant) <= IS_TRUE && Z_TYPE(right_node.u.constant) >= IS_NULL) {
+ zend_op *opline = zend_emit_op_tmp(result, ZEND_TYPE_CHECK, &left_node, NULL);
+ opline->extended_value =
+ (opcode == ZEND_IS_IDENTICAL) ?
+ (1 << Z_TYPE(right_node.u.constant)) :
+ (MAY_BE_ANY - (1 << Z_TYPE(right_node.u.constant)));
+ return;
+ }
+ }
+ } else if (opcode == ZEND_CONCAT) {
/* convert constant operands to strings at compile-time */
if (left_node.op_type == IS_CONST) {
if (Z_TYPE(left_node.u.constant) == IS_ARRAY) {
@@ -7318,12 +7501,11 @@ void zend_compile_unary_pm(znode *result, zend_ast *ast) /* {{{ */
zend_compile_expr(&expr_node, expr_ast);
- if (expr_node.op_type == IS_CONST) {
- if (zend_try_ct_eval_unary_pm(&result->u.constant, ast->kind, &expr_node.u.constant)) {
- result->op_type = IS_CONST;
- zval_ptr_dtor(&expr_node.u.constant);
- return;
- }
+ if (expr_node.op_type == IS_CONST
+ && zend_try_ct_eval_unary_pm(&result->u.constant, ast->kind, &expr_node.u.constant)) {
+ result->op_type = IS_CONST;
+ zval_ptr_dtor(&expr_node.u.constant);
+ return;
}
lefthand_node.op_type = IS_CONST;
@@ -7422,13 +7604,17 @@ void zend_compile_pre_incdec(znode *result, zend_ast *ast) /* {{{ */
if (var_ast->kind == ZEND_AST_PROP) {
zend_op *opline = zend_compile_prop(result, var_ast, BP_VAR_RW, 0);
opline->opcode = ast->kind == ZEND_AST_PRE_INC ? ZEND_PRE_INC_OBJ : ZEND_PRE_DEC_OBJ;
+ opline->result_type = IS_TMP_VAR;
+ result->op_type = IS_TMP_VAR;
} else if (var_ast->kind == ZEND_AST_STATIC_PROP) {
zend_op *opline = zend_compile_static_prop(result, var_ast, BP_VAR_RW, 0, 0);
opline->opcode = ast->kind == ZEND_AST_PRE_INC ? ZEND_PRE_INC_STATIC_PROP : ZEND_PRE_DEC_STATIC_PROP;
+ opline->result_type = IS_TMP_VAR;
+ result->op_type = IS_TMP_VAR;
} else {
znode var_node;
zend_compile_var(&var_node, var_ast, BP_VAR_RW, 0);
- zend_emit_op(result, ast->kind == ZEND_AST_PRE_INC ? ZEND_PRE_INC : ZEND_PRE_DEC,
+ zend_emit_op_tmp(result, ast->kind == ZEND_AST_PRE_INC ? ZEND_PRE_INC : ZEND_PRE_DEC,
&var_node, NULL);
}
}
@@ -7442,11 +7628,13 @@ void zend_compile_cast(znode *result, zend_ast *ast) /* {{{ */
zend_compile_expr(&expr_node, expr_ast);
- opline = zend_emit_op_tmp(result, ZEND_CAST, &expr_node, NULL);
- opline->extended_value = ast->attr;
-
- if (ast->attr == IS_NULL) {
- zend_error(E_DEPRECATED, "The (unset) cast is deprecated");
+ if (ast->attr == _IS_BOOL) {
+ opline = zend_emit_op_tmp(result, ZEND_BOOL, &expr_node, NULL);
+ } else if (ast->attr == IS_NULL) {
+ zend_error(E_COMPILE_ERROR, "The (unset) cast is no longer supported");
+ } else {
+ opline = zend_emit_op_tmp(result, ZEND_CAST, &expr_node, NULL);
+ opline->extended_value = ast->attr;
}
}
/* }}} */
@@ -7607,20 +7795,26 @@ void zend_compile_assign_coalesce(znode *result, zend_ast *ast) /* {{{ */
opline = &CG(active_op_array)->opcodes[CG(active_op_array)->last-1];
switch (var_ast->kind) {
case ZEND_AST_VAR:
- zend_emit_op(&assign_node, ZEND_ASSIGN, &var_node_w, &default_node);
+ zend_emit_op_tmp(&assign_node, ZEND_ASSIGN, &var_node_w, &default_node);
break;
case ZEND_AST_STATIC_PROP:
opline->opcode = ZEND_ASSIGN_STATIC_PROP;
+ opline->result_type = IS_TMP_VAR;
+ var_node_w.op_type = IS_TMP_VAR;
zend_emit_op_data(&default_node);
assign_node = var_node_w;
break;
case ZEND_AST_DIM:
opline->opcode = ZEND_ASSIGN_DIM;
+ opline->result_type = IS_TMP_VAR;
+ var_node_w.op_type = IS_TMP_VAR;
zend_emit_op_data(&default_node);
assign_node = var_node_w;
break;
case ZEND_AST_PROP:
opline->opcode = ZEND_ASSIGN_OBJ;
+ opline->result_type = IS_TMP_VAR;
+ var_node_w.op_type = IS_TMP_VAR;
zend_emit_op_data(&default_node);
assign_node = var_node_w;
break;
@@ -7999,19 +8193,13 @@ void zend_compile_const(znode *result, zend_ast *ast) /* {{{ */
opline = zend_emit_op_tmp(result, ZEND_FETCH_CONSTANT, NULL, NULL);
opline->op2_type = IS_CONST;
- if (is_fully_qualified) {
+ if (is_fully_qualified || !FC(current_namespace)) {
opline->op2.constant = zend_add_const_name_literal(
resolved_name, 0);
} else {
- opline->op1.num = IS_CONSTANT_UNQUALIFIED;
- if (FC(current_namespace)) {
- opline->op1.num |= IS_CONSTANT_IN_NAMESPACE;
- opline->op2.constant = zend_add_const_name_literal(
- resolved_name, 1);
- } else {
- opline->op2.constant = zend_add_const_name_literal(
- resolved_name, 0);
- }
+ opline->op1.num = IS_CONSTANT_UNQUALIFIED_IN_NAMESPACE;
+ opline->op2.constant = zend_add_const_name_literal(
+ resolved_name, 1);
}
opline->extended_value = zend_alloc_cache_slot();
}
@@ -8058,15 +8246,27 @@ void zend_compile_class_const(znode *result, zend_ast *ast) /* {{{ */
void zend_compile_class_name(znode *result, zend_ast *ast) /* {{{ */
{
zend_ast *class_ast = ast->child[0];
- zend_op *opline;
if (zend_try_compile_const_expr_resolve_class_name(&result->u.constant, class_ast)) {
result->op_type = IS_CONST;
return;
}
- opline = zend_emit_op_tmp(result, ZEND_FETCH_CLASS_NAME, NULL, NULL);
- opline->op1.num = zend_get_class_fetch_type(zend_ast_get_str(class_ast));
+ if (class_ast->kind == ZEND_AST_ZVAL) {
+ zend_op *opline = zend_emit_op_tmp(result, ZEND_FETCH_CLASS_NAME, NULL, NULL);
+ opline->op1.num = zend_get_class_fetch_type(zend_ast_get_str(class_ast));
+ } else {
+ znode expr_node;
+ zend_compile_expr(&expr_node, class_ast);
+ if (expr_node.op_type == IS_CONST) {
+ /* Unlikely case that happen if class_ast is constant folded.
+ * Handle it here, to avoid needing a CONST specialization in the VM. */
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot use ::class on value of type %s",
+ zend_get_type_by_const(Z_TYPE(expr_node.u.constant)));
+ }
+
+ zend_emit_op_tmp(result, ZEND_FETCH_CLASS_NAME, &expr_node, NULL);
+ }
}
/* }}} */
@@ -8303,6 +8503,11 @@ void zend_compile_const_expr_class_name(zend_ast **ast_ptr) /* {{{ */
{
zend_ast *ast = *ast_ptr;
zend_ast *class_ast = ast->child[0];
+ if (class_ast->kind != ZEND_AST_ZVAL) {
+ zend_error_noreturn(E_COMPILE_ERROR,
+ "(expression)::class cannot be used in constant expressions");
+ }
+
zend_string *class_name = zend_ast_get_str(class_ast);
uint32_t fetch_type = zend_get_class_fetch_type(class_name);
@@ -8342,7 +8547,8 @@ void zend_compile_const_expr_const(zend_ast **ast_ptr) /* {{{ */
}
zend_ast_destroy(ast);
- *ast_ptr = zend_ast_create_constant(resolved_name, !is_fully_qualified ? IS_CONSTANT_UNQUALIFIED : 0);
+ *ast_ptr = zend_ast_create_constant(resolved_name,
+ !is_fully_qualified && FC(current_namespace) ? IS_CONSTANT_UNQUALIFIED_IN_NAMESPACE : 0);
}
/* }}} */
diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h
index c21554e464..6c438b6902 100644
--- a/Zend/zend_compile.h
+++ b/Zend/zend_compile.h
@@ -51,7 +51,7 @@ typedef struct _zend_op zend_op;
/* On 64-bit systems less optimal, but more compact VM code leads to better
* performance. So on 32-bit systems we use absolute addresses for jump
- * targets and constants, but on 64-bit systems realtive 32-bit offsets */
+ * targets and constants, but on 64-bit systems relative 32-bit offsets */
#if SIZEOF_SIZE_T == 4
# define ZEND_USE_ABS_JMP_ADDR 1
# define ZEND_USE_ABS_CONST_ADDR 1
@@ -206,7 +206,7 @@ typedef struct _zend_oparray_context {
/* Property or method overrides private one | | | */
#define ZEND_ACC_CHANGED (1 << 3) /* | X | X | */
/* | | | */
-/* Staic method or property | | | */
+/* Static method or property | | | */
#define ZEND_ACC_STATIC (1 << 4) /* | X | X | */
/* | | | */
/* Final class or method | | | */
@@ -229,7 +229,7 @@ typedef struct _zend_oparray_context {
/* op_array or class is preloaded | | | */
#define ZEND_ACC_PRELOADED (1 << 10) /* X | X | | */
/* | | | */
-/* Class Flags (unused: 24...) | | | */
+/* Class Flags (unused: 13, 14, 15, 24...) | | | */
/* =========== | | | */
/* | | | */
/* Special class types | | | */
@@ -237,10 +237,10 @@ typedef struct _zend_oparray_context {
#define ZEND_ACC_TRAIT (1 << 1) /* X | | | */
#define ZEND_ACC_ANON_CLASS (1 << 2) /* X | | | */
/* | | | */
-/* Class linked with parent, interfacs and traits | | | */
+/* Class linked with parent, interfaces and traits | | | */
#define ZEND_ACC_LINKED (1 << 3) /* X | | | */
/* | | | */
-/* class is abstarct, since it is set by any | | | */
+/* Class is abstract, since it is set by any | | | */
/* abstract method | | | */
#define ZEND_ACC_IMPLICIT_ABSTRACT_CLASS (1 << 4) /* X | | | */
/* | | | */
@@ -251,15 +251,6 @@ typedef struct _zend_oparray_context {
/* Class constants updated | | | */
#define ZEND_ACC_CONSTANTS_UPDATED (1 << 12) /* X | | | */
/* | | | */
-/* Class extends another class | | | */
-#define ZEND_ACC_INHERITED (1 << 13) /* X | | | */
-/* | | | */
-/* Class implements interface(s) | | | */
-#define ZEND_ACC_IMPLEMENT_INTERFACES (1 << 14) /* X | | | */
-/* | | | */
-/* Class uses trait(s) | | | */
-#define ZEND_ACC_IMPLEMENT_TRAITS (1 << 15) /* X | | | */
-/* | | | */
/* User class has methods with static variables | | | */
#define ZEND_HAS_STATIC_IN_METHODS (1 << 16) /* X | | | */
/* | | | */
@@ -284,7 +275,7 @@ typedef struct _zend_oparray_context {
/* Whether this class was used in its unlinked state. | | | */
#define ZEND_ACC_HAS_UNLINKED_USES (1 << 23) /* X | | | */
/* | | | */
-/* Function Flags (unused: 23, 26) | | | */
+/* Function Flags (unused: 17, 23, 26) | | | */
/* ============== | | | */
/* | | | */
/* deprecation flag | | | */
@@ -306,10 +297,6 @@ typedef struct _zend_oparray_context {
/* ZEND_DECLARE_CLASS_DELAYED opcodes | | | */
#define ZEND_ACC_EARLY_BINDING (1 << 16) /* | X | | */
/* | | | */
-/* method flag (bc only), any method that has this | | | */
-/* flag can be used statically and non statically. | | | */
-#define ZEND_ACC_ALLOW_STATIC (1 << 17) /* | X | | */
-/* | | | */
/* call through user function trampoline. e.g. | | | */
/* __call, __callstatic | | | */
#define ZEND_ACC_CALL_VIA_TRAMPOLINE (1 << 18) /* | X | | */
@@ -387,16 +374,12 @@ typedef struct _zend_class_constant {
typedef struct _zend_internal_arg_info {
const char *name;
zend_type type;
- zend_uchar pass_by_reference;
- zend_bool is_variadic;
} zend_internal_arg_info;
/* arg_info for user functions */
typedef struct _zend_arg_info {
zend_string *name;
zend_type type;
- zend_uchar pass_by_reference;
- zend_bool is_variadic;
} zend_arg_info;
/* the following structure repeats the layout of zend_internal_arg_info,
@@ -407,8 +390,6 @@ typedef struct _zend_arg_info {
typedef struct _zend_internal_function_info {
zend_uintptr_t required_num_args;
zend_type type;
- zend_bool return_reference;
- zend_bool _is_variadic;
} zend_internal_function_info;
struct _zend_op_array {
@@ -493,7 +474,7 @@ union _zend_function {
zend_function *prototype;
uint32_t num_args;
uint32_t required_num_args;
- zend_arg_info *arg_info;
+ zend_arg_info *arg_info; /* index -1 represents the return value info, if any */
} common;
zend_op_array op_array;
@@ -706,6 +687,10 @@ struct _zend_execute_data {
#define IS_VAR (1<<2)
#define IS_CV (1<<3) /* Compiled variable */
+/* Used for result.type of smart branch instructions */
+#define IS_SMART_BRANCH_JMPZ (1<<4)
+#define IS_SMART_BRANCH_JMPNZ (1<<5)
+
#define ZEND_EXTRA_VALUE 1
#include "zend_globals.h"
@@ -722,7 +707,7 @@ void zend_file_context_begin(zend_file_context *prev_context);
void zend_file_context_end(zend_file_context *prev_context);
extern ZEND_API zend_op_array *(*zend_compile_file)(zend_file_handle *file_handle, int type);
-extern ZEND_API zend_op_array *(*zend_compile_string)(zval *source_string, char *filename);
+extern ZEND_API zend_op_array *(*zend_compile_string)(zval *source_string, const char *filename);
ZEND_API int ZEND_FASTCALL lex_scan(zval *zendlval, zend_parser_stack_elem *elem);
void startup_scanner(void);
@@ -780,7 +765,7 @@ ZEND_API void function_add_ref(zend_function *function);
/* helper functions in zend_language_scanner.l */
ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type);
-ZEND_API zend_op_array *compile_string(zval *source_string, char *filename);
+ZEND_API zend_op_array *compile_string(zval *source_string, const char *filename);
ZEND_API zend_op_array *compile_filename(int type, zval *filename);
ZEND_API int zend_execute_scripts(int type, zval *retval, int file_count, ...);
ZEND_API int open_file_for_scanning(zend_file_handle *file_handle);
@@ -789,6 +774,8 @@ ZEND_API void destroy_op_array(zend_op_array *op_array);
ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle);
ZEND_API void zend_cleanup_internal_class_data(zend_class_entry *ce);
ZEND_API void zend_cleanup_internal_classes(void);
+ZEND_API void zend_type_release(zend_type type, zend_bool persistent);
+
ZEND_API ZEND_COLD void zend_user_exception_handler(void);
@@ -830,7 +817,7 @@ ZEND_API char *zend_make_compiled_string_description(const char *name);
ZEND_API void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify_handlers);
uint32_t zend_get_class_fetch_type(zend_string *name);
ZEND_API zend_uchar zend_get_call_op(const zend_op *init_op, zend_function *fbc);
-ZEND_API int zend_is_smart_branch(zend_op *opline);
+ZEND_API int zend_is_smart_branch(const zend_op *opline);
typedef zend_bool (*zend_auto_global_callback)(zend_string *name);
typedef struct _zend_auto_global {
@@ -851,6 +838,9 @@ int ZEND_FASTCALL zendlex(zend_parser_stack_elem *elem);
void zend_assert_valid_class_name(const zend_string *const_name);
+zend_string *zend_type_to_string_resolved(zend_type type, zend_class_entry *scope);
+ZEND_API zend_string *zend_type_to_string(zend_type type);
+
/* BEGIN: OPCODES */
#include "zend_vm_opcodes.h"
@@ -893,14 +883,11 @@ void zend_assert_valid_class_name(const zend_string *const_name);
#define BP_VAR_FUNC_ARG 4
#define BP_VAR_UNSET 5
-#define ZEND_INTERNAL_FUNCTION 1
-#define ZEND_USER_FUNCTION 2
-#define ZEND_OVERLOADED_FUNCTION 3
-#define ZEND_EVAL_CODE 4
-#define ZEND_OVERLOADED_FUNCTION_TEMPORARY 5
+#define ZEND_INTERNAL_FUNCTION 1
+#define ZEND_USER_FUNCTION 2
+#define ZEND_EVAL_CODE 4
-/* A quick check (type == ZEND_USER_FUNCTION || type == ZEND_EVAL_CODE) */
-#define ZEND_USER_CODE(type) ((type & 1) == 0)
+#define ZEND_USER_CODE(type) ((type) != ZEND_INTERNAL_FUNCTION)
#define ZEND_INTERNAL_CLASS 1
#define ZEND_USER_CLASS 2
@@ -921,7 +908,6 @@ void zend_assert_valid_class_name(const zend_string *const_name);
/* Only one of these can ever be in use */
#define ZEND_FETCH_REF 1
#define ZEND_FETCH_DIM_WRITE 2
-#define ZEND_FETCH_OBJ_WRITE 3
#define ZEND_FETCH_OBJ_FLAGS 3
#define ZEND_ISEMPTY (1<<0)
@@ -935,12 +921,20 @@ void zend_assert_valid_class_name(const zend_string *const_name);
#define ZEND_SEND_BY_REF 1u
#define ZEND_SEND_PREFER_REF 2u
+/* The send mode and is_variadic flag are stored as part of zend_type */
+#define _ZEND_SEND_MODE_SHIFT _ZEND_TYPE_EXTRA_FLAGS_SHIFT
+#define _ZEND_IS_VARIADIC_BIT (1 << (_ZEND_TYPE_EXTRA_FLAGS_SHIFT + 2))
+#define ZEND_ARG_SEND_MODE(arg_info) \
+ ((ZEND_TYPE_FULL_MASK((arg_info)->type) >> _ZEND_SEND_MODE_SHIFT) & 3)
+#define ZEND_ARG_IS_VARIADIC(arg_info) \
+ ((ZEND_TYPE_FULL_MASK((arg_info)->type) & _ZEND_IS_VARIADIC_BIT) != 0)
+
#define ZEND_DIM_IS (1 << 0) /* isset fetch needed for null coalesce */
#define ZEND_DIM_ALTERNATIVE_SYNTAX (1 << 1) /* deprecated curly brace usage */
-#define IS_CONSTANT_UNQUALIFIED 0x010
-#define IS_CONSTANT_CLASS 0x080 /* __CLASS__ in trait */
-#define IS_CONSTANT_IN_NAMESPACE 0x100
+/* Make sure these don't clash with ZEND_FETCH_CLASS_* flags. */
+#define IS_CONSTANT_CLASS 0x400 /* __CLASS__ in trait */
+#define IS_CONSTANT_UNQUALIFIED_IN_NAMESPACE 0x800
static zend_always_inline int zend_check_arg_send_type(const zend_function *zf, uint32_t arg_num, uint32_t mask)
{
@@ -951,7 +945,7 @@ static zend_always_inline int zend_check_arg_send_type(const zend_function *zf,
}
arg_num = zf->common.num_args;
}
- return UNEXPECTED((zf->common.arg_info[arg_num].pass_by_reference & mask) != 0);
+ return UNEXPECTED((ZEND_ARG_SEND_MODE(&zf->common.arg_info[arg_num]) & mask) != 0);
}
#define ARG_MUST_BE_SENT_BY_REF(zf, arg_num) \
@@ -1018,11 +1012,11 @@ static zend_always_inline int zend_check_arg_send_type(const zend_function *zf,
(((opcode) >= ZEND_ADD) && ((opcode) <= ZEND_POW))
/* Pseudo-opcodes that are used only temporarily during compilation */
-#define ZEND_PARENTHESIZED_CONCAT 252 /* removed with PHP 8 */
#define ZEND_GOTO 253
#define ZEND_BRK 254
#define ZEND_CONT 255
+
END_EXTERN_C()
#define ZEND_CLONE_FUNC_NAME "__clone"
@@ -1035,7 +1029,6 @@ END_EXTERN_C()
#define ZEND_CALL_FUNC_NAME "__call"
#define ZEND_CALLSTATIC_FUNC_NAME "__callstatic"
#define ZEND_TOSTRING_FUNC_NAME "__tostring"
-#define ZEND_AUTOLOAD_FUNC_NAME "__autoload"
#define ZEND_INVOKE_FUNC_NAME "__invoke"
#define ZEND_DEBUGINFO_FUNC_NAME "__debuginfo"
@@ -1064,9 +1057,6 @@ END_EXTERN_C()
/* disable constant substitution at compile-time */
#define ZEND_COMPILE_NO_CONSTANT_SUBSTITUTION (1<<6)
-/* disable usage of builtin instruction for strlen() */
-#define ZEND_COMPILE_NO_BUILTIN_STRLEN (1<<7)
-
/* disable substitution of persistent constants at compile-time */
#define ZEND_COMPILE_NO_PERSISTENT_CONSTANT_SUBSTITUTION (1<<8)
diff --git a/Zend/zend_config.w32.h b/Zend/zend_config.w32.h
index 19a5165e4b..47387895e5 100644
--- a/Zend/zend_config.w32.h
+++ b/Zend/zend_config.w32.h
@@ -47,18 +47,6 @@
#endif
#define strcasecmp(s1, s2) _stricmp(s1, s2)
#define strncasecmp(s1, s2, n) _strnicmp(s1, s2, n)
-#if defined(__cplusplus) && __cplusplus >= 201103L
-extern "C++" {
-#include <cmath>
-#define zend_isnan std::isnan
-#define zend_isinf std::isinf
-#define zend_finite std::isfinite
-}
-#else
-#define zend_isinf(a) ((_fpclass(a) == _FPCLASS_PINF) || (_fpclass(a) == _FPCLASS_NINF))
-#define zend_finite(x) _finite(x)
-#define zend_isnan(x) _isnan(x)
-#endif
#ifndef __cplusplus
/* This will cause the compilation process to be MUCH longer, but will generate
diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c
index 49ee762c60..958bd36d1d 100644
--- a/Zend/zend_constants.c
+++ b/Zend/zend_constants.c
@@ -33,6 +33,9 @@
#define MARK_CONSTANT_VISITED(zv) Z_ACCESS_FLAGS_P(zv) |= IS_CONSTANT_VISITED_MARK
#define RESET_CONSTANT_VISITED(zv) Z_ACCESS_FLAGS_P(zv) &= ~IS_CONSTANT_VISITED_MARK
+/* Use for special null/true/false constants. */
+static zend_constant *null_const, *true_const, *false_const;
+
void free_zend_constant(zval *zv)
{
zend_constant *c = Z_PTR_P(zv);
@@ -99,7 +102,6 @@ void clean_module_constants(int module_number)
int zend_startup_constants(void)
{
EG(zend_constants) = (HashTable *) malloc(sizeof(HashTable));
-
zend_hash_init(EG(zend_constants), 128, NULL, ZEND_CONSTANT_DTOR, 1);
return SUCCESS;
}
@@ -128,14 +130,17 @@ void zend_register_standard_constants(void)
REGISTER_MAIN_LONG_CONSTANT("DEBUG_BACKTRACE_PROVIDE_OBJECT", DEBUG_BACKTRACE_PROVIDE_OBJECT, CONST_PERSISTENT | CONST_CS);
REGISTER_MAIN_LONG_CONSTANT("DEBUG_BACKTRACE_IGNORE_ARGS", DEBUG_BACKTRACE_IGNORE_ARGS, CONST_PERSISTENT | CONST_CS);
- /* true/false constants */
- {
- REGISTER_MAIN_BOOL_CONSTANT("TRUE", 1, CONST_PERSISTENT | CONST_CT_SUBST);
- REGISTER_MAIN_BOOL_CONSTANT("FALSE", 0, CONST_PERSISTENT | CONST_CT_SUBST);
- REGISTER_MAIN_BOOL_CONSTANT("ZEND_THREAD_SAFE", ZTS_V, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_BOOL_CONSTANT("ZEND_DEBUG_BUILD", ZEND_DEBUG, CONST_PERSISTENT | CONST_CS);
- }
- REGISTER_MAIN_NULL_CONSTANT("NULL", CONST_PERSISTENT | CONST_CT_SUBST);
+ REGISTER_MAIN_BOOL_CONSTANT("ZEND_THREAD_SAFE", ZTS_V, CONST_PERSISTENT | CONST_CS);
+ REGISTER_MAIN_BOOL_CONSTANT("ZEND_DEBUG_BUILD", ZEND_DEBUG, CONST_PERSISTENT | CONST_CS);
+
+ /* Special constants true/false/null. */
+ REGISTER_MAIN_BOOL_CONSTANT("TRUE", 1, CONST_PERSISTENT);
+ REGISTER_MAIN_BOOL_CONSTANT("FALSE", 0, CONST_PERSISTENT);
+ REGISTER_MAIN_NULL_CONSTANT("NULL", CONST_PERSISTENT);
+
+ true_const = zend_hash_str_find_ptr(EG(zend_constants), "TRUE", sizeof("TRUE")-1);
+ false_const = zend_hash_str_find_ptr(EG(zend_constants), "FALSE", sizeof("FALSE")-1);
+ null_const = zend_hash_str_find_ptr(EG(zend_constants), "NULL", sizeof("NULL")-1);
}
@@ -188,7 +193,7 @@ ZEND_API void zend_register_double_constant(const char *name, size_t name_len, d
}
-ZEND_API void zend_register_stringl_constant(const char *name, size_t name_len, char *strval, size_t strlen, int flags, int module_number)
+ZEND_API void zend_register_stringl_constant(const char *name, size_t name_len, const char *strval, size_t strlen, int flags, int module_number)
{
zend_constant c;
@@ -199,12 +204,12 @@ ZEND_API void zend_register_stringl_constant(const char *name, size_t name_len,
}
-ZEND_API void zend_register_string_constant(const char *name, size_t name_len, char *strval, int flags, int module_number)
+ZEND_API void zend_register_string_constant(const char *name, size_t name_len, const char *strval, int flags, int module_number)
{
zend_register_stringl_constant(name, name_len, strval, strlen(strval), flags, module_number);
}
-static zend_constant *zend_get_special_constant(const char *name, size_t name_len)
+static zend_constant *zend_get_halt_offset_constant(const char *name, size_t name_len)
{
zend_constant *c;
static const char haltoff[] = "__COMPILER_HALT_OFFSET__";
@@ -230,6 +235,37 @@ static zend_constant *zend_get_special_constant(const char *name, size_t name_le
}
}
+ZEND_API zend_constant *_zend_get_special_const(const char *name, size_t len) /* {{{ */
+{
+ if (len == 4) {
+ if ((name[0] == 'n' || name[0] == 'N') &&
+ (name[1] == 'u' || name[1] == 'U') &&
+ (name[2] == 'l' || name[2] == 'L') &&
+ (name[3] == 'l' || name[3] == 'L')
+ ) {
+ return null_const;
+ }
+ if ((name[0] == 't' || name[0] == 'T') &&
+ (name[1] == 'r' || name[1] == 'R') &&
+ (name[2] == 'u' || name[2] == 'U') &&
+ (name[3] == 'e' || name[3] == 'E')
+ ) {
+ return true_const;
+ }
+ } else {
+ if ((name[0] == 'f' || name[0] == 'F') &&
+ (name[1] == 'a' || name[1] == 'A') &&
+ (name[2] == 'l' || name[2] == 'L') &&
+ (name[3] == 's' || name[3] == 'S') &&
+ (name[4] == 'e' || name[4] == 'E')
+ ) {
+ return false_const;
+ }
+ }
+ return NULL;
+}
+/* }}} */
+
ZEND_API int zend_verify_const_access(zend_class_constant *c, zend_class_entry *scope) /* {{{ */
{
if (Z_ACCESS_FLAGS(c->value) & ZEND_ACC_PUBLIC) {
@@ -243,80 +279,52 @@ ZEND_API int zend_verify_const_access(zend_class_constant *c, zend_class_entry *
}
/* }}} */
-static inline zend_constant *zend_get_constant_str_impl(const char *name, size_t name_len)
+static zend_constant *zend_get_constant_str_impl(const char *name, size_t name_len)
{
- zend_constant *c;
- ALLOCA_FLAG(use_heap)
-
- if ((c = zend_hash_str_find_ptr(EG(zend_constants), name, name_len)) == NULL) {
- char *lcname = do_alloca(name_len + 1, use_heap);
- zend_str_tolower_copy(lcname, name, name_len);
- if ((c = zend_hash_str_find_ptr(EG(zend_constants), lcname, name_len)) != NULL) {
- if (ZEND_CONSTANT_FLAGS(c) & CONST_CS) {
- c = NULL;
- }
- } else {
- c = zend_get_special_constant(name, name_len);
- }
- free_alloca(lcname, use_heap);
+ zend_constant *c = zend_hash_str_find_ptr(EG(zend_constants), name, name_len);
+ if (c) {
+ return c;
+ }
+
+ c = zend_get_halt_offset_constant(name, name_len);
+ if (c) {
+ return c;
}
- return c;
+ return zend_get_special_const(name, name_len);
}
ZEND_API zval *zend_get_constant_str(const char *name, size_t name_len)
{
zend_constant *c = zend_get_constant_str_impl(name, name_len);
- return c ? &c->value : NULL;
+ if (c) {
+ return &c->value;
+ }
+ return NULL;
}
-static inline zend_constant *zend_get_constant_impl(zend_string *name)
+static zend_constant *zend_get_constant_impl(zend_string *name)
{
- zval *zv;
- zend_constant *c;
- ALLOCA_FLAG(use_heap)
-
- zv = zend_hash_find(EG(zend_constants), name);
- if (zv == NULL) {
- char *lcname = do_alloca(ZSTR_LEN(name) + 1, use_heap);
- zend_str_tolower_copy(lcname, ZSTR_VAL(name), ZSTR_LEN(name));
- zv = zend_hash_str_find(EG(zend_constants), lcname, ZSTR_LEN(name));
- if (zv != NULL) {
- c = Z_PTR_P(zv);
- if (ZEND_CONSTANT_FLAGS(c) & CONST_CS) {
- c = NULL;
- }
- } else {
- c = zend_get_special_constant(ZSTR_VAL(name), ZSTR_LEN(name));
- }
- free_alloca(lcname, use_heap);
+ zend_constant *c = zend_hash_find_ptr(EG(zend_constants), name);
+ if (c) {
return c;
- } else {
- return (zend_constant *) Z_PTR_P(zv);
}
+
+ c = zend_get_halt_offset_constant(ZSTR_VAL(name), ZSTR_LEN(name));
+ if (c) {
+ return c;
+ }
+
+ return zend_get_special_const(ZSTR_VAL(name), ZSTR_LEN(name));
}
ZEND_API zval *zend_get_constant(zend_string *name)
{
zend_constant *c = zend_get_constant_impl(name);
- return c ? &c->value : NULL;
-}
-
-static zend_bool is_access_deprecated(const zend_constant *c, const char *access_name) {
- const char *ns_sep = zend_memrchr(ZSTR_VAL(c->name), '\\', ZSTR_LEN(c->name));
- if (ns_sep) {
- /* Namespaces are always case-insensitive. Only compare shortname. */
- size_t shortname_offset = ns_sep - ZSTR_VAL(c->name) + 1;
- size_t shortname_len = ZSTR_LEN(c->name) - shortname_offset;
- return memcmp(
- access_name + shortname_offset,
- ZSTR_VAL(c->name) + shortname_offset,
- shortname_len
- ) != 0;
- } else {
- /* No namespace, compare whole name */
- return memcmp(access_name, ZSTR_VAL(c->name), ZSTR_LEN(c->name)) != 0;
+ if (c) {
+ return &c->value;
}
+ return NULL;
}
ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope, uint32_t flags)
@@ -421,33 +429,22 @@ failure:
size_t lcname_len;
ALLOCA_FLAG(use_heap)
+ /* Lowercase the namespace portion */
lcname_len = prefix_len + 1 + const_name_len;
lcname = do_alloca(lcname_len + 1, use_heap);
zend_str_tolower_copy(lcname, name, prefix_len);
- /* Check for namespace constant */
lcname[prefix_len] = '\\';
memcpy(lcname + prefix_len + 1, constant_name, const_name_len + 1);
- if ((c = zend_hash_str_find_ptr(EG(zend_constants), lcname, lcname_len)) == NULL) {
- /* try lowercase */
- zend_str_tolower(lcname + prefix_len + 1, const_name_len);
- if ((c = zend_hash_str_find_ptr(EG(zend_constants), lcname, lcname_len)) != NULL) {
- if ((ZEND_CONSTANT_FLAGS(c) & CONST_CS) != 0) {
- c = NULL;
- }
- }
- }
+ c = zend_hash_str_find_ptr(EG(zend_constants), lcname, lcname_len);
free_alloca(lcname, use_heap);
if (!c) {
- if (!(flags & IS_CONSTANT_UNQUALIFIED)) {
- return NULL;
+ if (flags & IS_CONSTANT_UNQUALIFIED_IN_NAMESPACE) {
+ /* name requires runtime resolution, need to check non-namespaced name */
+ c = zend_get_constant_str_impl(constant_name, const_name_len);
}
-
- /* name requires runtime resolution, need to check non-namespaced name */
- c = zend_get_constant_str_impl(constant_name, const_name_len);
- name = constant_name;
}
} else {
if (cname) {
@@ -458,18 +455,15 @@ failure:
}
if (!c) {
+ if (!(flags & ZEND_FETCH_CLASS_SILENT)) {
+ zend_throw_error(NULL, "Undefined constant '%s'", name);
+ }
return NULL;
}
- if (!(flags & ZEND_GET_CONSTANT_NO_DEPRECATION_CHECK)) {
- if (!(ZEND_CONSTANT_FLAGS(c) & (CONST_CS|CONST_CT_SUBST)) && is_access_deprecated(c, name)) {
- zend_error(E_DEPRECATED,
- "Case-insensitive constants are deprecated. "
- "The correct casing for this constant is \"%s\"",
- ZSTR_VAL(c->name));
- }
+ if (!(flags & ZEND_FETCH_CLASS_SILENT) && (ZEND_CONSTANT_FLAGS(c) & CONST_DEPRECATED)) {
+ zend_error(E_DEPRECATED, "Constant %s is deprecated", name);
}
-
return &c->value;
}
@@ -491,38 +485,30 @@ ZEND_API int zend_register_constant(zend_constant *c)
zend_string *lowercase_name = NULL;
zend_string *name;
int ret = SUCCESS;
+ zend_bool persistent = (ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT) != 0;
#if 0
printf("Registering constant for module %d\n", c->module_number);
#endif
- if (!(ZEND_CONSTANT_FLAGS(c) & CONST_CS)) {
- lowercase_name = zend_string_tolower_ex(c->name, ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT);
+ char *slash = strrchr(ZSTR_VAL(c->name), '\\');
+ if (slash) {
+ lowercase_name = zend_string_init(ZSTR_VAL(c->name), ZSTR_LEN(c->name), persistent);
+ zend_str_tolower(ZSTR_VAL(lowercase_name), slash - ZSTR_VAL(c->name));
lowercase_name = zend_new_interned_string(lowercase_name);
name = lowercase_name;
} else {
- char *slash = strrchr(ZSTR_VAL(c->name), '\\');
- if (slash) {
- lowercase_name = zend_string_init(ZSTR_VAL(c->name), ZSTR_LEN(c->name), ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT);
- zend_str_tolower(ZSTR_VAL(lowercase_name), slash - ZSTR_VAL(c->name));
- lowercase_name = zend_new_interned_string(lowercase_name);
- name = lowercase_name;
- } else {
- name = c->name;
- }
+ name = c->name;
}
- /* Check if the user is trying to define the internal pseudo constant name __COMPILER_HALT_OFFSET__ */
+ /* Check if the user is trying to define any special constant */
if (zend_string_equals_literal(name, "__COMPILER_HALT_OFFSET__")
- || zend_hash_add_constant(EG(zend_constants), name, c) == NULL) {
-
- /* The internal __COMPILER_HALT_OFFSET__ is prefixed by NULL byte */
- if (ZSTR_VAL(c->name)[0] == '\0' && ZSTR_LEN(c->name) > sizeof("\0__COMPILER_HALT_OFFSET__")-1
- && memcmp(ZSTR_VAL(name), "\0__COMPILER_HALT_OFFSET__", sizeof("\0__COMPILER_HALT_OFFSET__")) == 0) {
- }
+ || (!persistent && zend_get_special_const(ZSTR_VAL(name), ZSTR_LEN(name)))
+ || zend_hash_add_constant(EG(zend_constants), name, c) == NULL
+ ) {
zend_error(E_NOTICE,"Constant %s already defined", ZSTR_VAL(name));
zend_string_release(c->name);
- if (!(ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT)) {
+ if (!persistent) {
zval_ptr_dtor_nogc(&c->value);
}
ret = FAILURE;
diff --git a/Zend/zend_constants.h b/Zend/zend_constants.h
index ba0c798dc6..9b5a63a026 100644
--- a/Zend/zend_constants.h
+++ b/Zend/zend_constants.h
@@ -22,16 +22,13 @@
#include "zend_globals.h"
-#define CONST_CS (1<<0) /* Case Sensitive */
-#define CONST_PERSISTENT (1<<1) /* Persistent */
-#define CONST_CT_SUBST (1<<2) /* Allow compile-time substitution */
-#define CONST_NO_FILE_CACHE (1<<3) /* Can't be saved in file cache */
+#define CONST_CS 0 /* No longer used -- always case sensitive */
+#define CONST_PERSISTENT (1<<0) /* Persistent */
+#define CONST_NO_FILE_CACHE (1<<1) /* Can't be saved in file cache */
+#define CONST_DEPRECATED (1<<2) /* Deprecated */
#define PHP_USER_CONSTANT 0x7fffff /* a constant defined in user space */
-/* Flag for zend_get_constant_ex(). Must not class with ZEND_FETCH_CLASS_* flags. */
-#define ZEND_GET_CONSTANT_NO_DEPRECATION_CHECK 0x1000
-
typedef struct _zend_constant {
zval value;
zend_string *name;
@@ -83,12 +80,23 @@ ZEND_API void zend_register_bool_constant(const char *name, size_t name_len, zen
ZEND_API void zend_register_null_constant(const char *name, size_t name_len, int flags, int module_number);
ZEND_API void zend_register_long_constant(const char *name, size_t name_len, zend_long lval, int flags, int module_number);
ZEND_API void zend_register_double_constant(const char *name, size_t name_len, double dval, int flags, int module_number);
-ZEND_API void zend_register_string_constant(const char *name, size_t name_len, char *strval, int flags, int module_number);
-ZEND_API void zend_register_stringl_constant(const char *name, size_t name_len, char *strval, size_t strlen, int flags, int module_number);
+ZEND_API void zend_register_string_constant(const char *name, size_t name_len, const char *strval, int flags, int module_number);
+ZEND_API void zend_register_stringl_constant(const char *name, size_t name_len, const char *strval, size_t strlen, int flags, int module_number);
ZEND_API int zend_register_constant(zend_constant *c);
#ifdef ZTS
void zend_copy_constants(HashTable *target, HashTable *sourc);
#endif
+
+ZEND_API zend_constant *_zend_get_special_const(const char *name, size_t name_len);
+
+static zend_always_inline zend_constant *zend_get_special_const(
+ const char *name, size_t name_len) {
+ if (name_len == 4 || name_len == 5) {
+ return _zend_get_special_const(name, name_len);
+ }
+ return NULL;
+}
+
END_EXTERN_C()
#define ZEND_CONSTANT_DTOR free_zend_constant
diff --git a/Zend/zend_cpuinfo.h b/Zend/zend_cpuinfo.h
index c0949e3638..0b6b54e51a 100644
--- a/Zend/zend_cpuinfo.h
+++ b/Zend/zend_cpuinfo.h
@@ -12,7 +12,7 @@
| obtain it through the world-wide-web, please send a note to |
| license@zend.com so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
- | Authors: Xinchen Hui <xinchen.h@zend.com> |
+ | Authors: Xinchen Hui <laruence@php.net> |
+----------------------------------------------------------------------+
*/
diff --git a/Zend/zend_errors.h b/Zend/zend_errors.h
index 441458c033..dd7539523d 100644
--- a/Zend/zend_errors.h
+++ b/Zend/zend_errors.h
@@ -36,7 +36,15 @@
#define E_DEPRECATED (1<<13L)
#define E_USER_DEPRECATED (1<<14L)
+/* Indicates that this usually fatal error should not result in a bailout */
+#define E_DONT_BAIL (1<<15L)
+
#define E_ALL (E_ERROR | E_WARNING | E_PARSE | E_NOTICE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING | E_USER_ERROR | E_USER_WARNING | E_USER_NOTICE | E_RECOVERABLE_ERROR | E_DEPRECATED | E_USER_DEPRECATED | E_STRICT)
#define E_CORE (E_CORE_ERROR | E_CORE_WARNING)
+/* Fatal errors that are ignored by the silence operator */
+#define E_FATAL_ERRORS (E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR | E_PARSE)
+
+#define E_HAS_ONLY_FATAL_ERRORS(mask) !((mask) & ~E_FATAL_ERRORS)
+
#endif /* ZEND_ERRORS_H */
diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c
index 8672ed8e00..f3846d326b 100644
--- a/Zend/zend_exceptions.c
+++ b/Zend/zend_exceptions.c
@@ -27,6 +27,7 @@
#include "zend_vm.h"
#include "zend_dtrace.h"
#include "zend_smart_str.h"
+#include "zend_exceptions_arginfo.h"
ZEND_API zend_class_entry *zend_ce_throwable;
ZEND_API zend_class_entry *zend_ce_exception;
@@ -36,6 +37,7 @@ ZEND_API zend_class_entry *zend_ce_compile_error;
ZEND_API zend_class_entry *zend_ce_parse_error;
ZEND_API zend_class_entry *zend_ce_type_error;
ZEND_API zend_class_entry *zend_ce_argument_count_error;
+ZEND_API zend_class_entry *zend_ce_value_error;
ZEND_API zend_class_entry *zend_ce_arithmetic_error;
ZEND_API zend_class_entry *zend_ce_division_by_zero_error;
@@ -156,8 +158,9 @@ ZEND_API ZEND_COLD void zend_throw_exception_internal(zval *exception) /* {{{ */
if (exception && (Z_OBJCE_P(exception) == zend_ce_parse_error || Z_OBJCE_P(exception) == zend_ce_compile_error)) {
return;
}
- if(EG(exception)) {
+ if (EG(exception)) {
zend_exception_error(EG(exception), E_ERROR);
+ zend_bailout();
}
zend_error_noreturn(E_CORE_ERROR, "Exception thrown without a stack frame");
}
@@ -286,7 +289,7 @@ ZEND_METHOD(exception, __construct)
ce = base_ce;
}
zend_throw_error(NULL, "Wrong parameters for %s([string $message [, long $code [, Throwable $previous = NULL]]])", ZSTR_VAL(ce->name));
- return;
+ RETURN_THROWS();
}
if (message) {
@@ -352,7 +355,7 @@ ZEND_METHOD(error_exception, __construct)
ce = zend_ce_error_exception;
}
zend_throw_error(NULL, "Wrong parameters for %s([string $message [, long $code, [ long $severity, [ string $filename, [ long $lineno [, Throwable $previous = NULL]]]]]])", ZSTR_VAL(ce->name));
- return;
+ RETURN_THROWS();
}
object = ZEND_THIS;
@@ -388,11 +391,6 @@ ZEND_METHOD(error_exception, __construct)
}
/* }}} */
-#define DEFAULT_0_PARAMS \
- if (zend_parse_parameters_none() == FAILURE) { \
- return; \
- }
-
#define GET_PROPERTY(object, id) \
zend_read_property_ex(i_get_exception_base(object), (object), ZSTR_KNOWN(id), 0, &rv)
#define GET_PROPERTY_SILENT(object, id) \
@@ -404,7 +402,7 @@ ZEND_METHOD(exception, getFile)
{
zval *prop, rv;
- DEFAULT_0_PARAMS;
+ ZEND_PARSE_PARAMETERS_NONE();
prop = GET_PROPERTY(ZEND_THIS, ZEND_STR_FILE);
ZVAL_DEREF(prop);
@@ -418,7 +416,7 @@ ZEND_METHOD(exception, getLine)
{
zval *prop, rv;
- DEFAULT_0_PARAMS;
+ ZEND_PARSE_PARAMETERS_NONE();
prop = GET_PROPERTY(ZEND_THIS, ZEND_STR_LINE);
ZVAL_DEREF(prop);
@@ -432,7 +430,7 @@ ZEND_METHOD(exception, getMessage)
{
zval *prop, rv;
- DEFAULT_0_PARAMS;
+ ZEND_PARSE_PARAMETERS_NONE();
prop = GET_PROPERTY(ZEND_THIS, ZEND_STR_MESSAGE);
ZVAL_DEREF(prop);
@@ -446,7 +444,7 @@ ZEND_METHOD(exception, getCode)
{
zval *prop, rv;
- DEFAULT_0_PARAMS;
+ ZEND_PARSE_PARAMETERS_NONE();
prop = GET_PROPERTY(ZEND_THIS, ZEND_STR_CODE);
ZVAL_DEREF(prop);
@@ -460,7 +458,7 @@ ZEND_METHOD(exception, getTrace)
{
zval *prop, rv;
- DEFAULT_0_PARAMS;
+ ZEND_PARSE_PARAMETERS_NONE();
prop = GET_PROPERTY(ZEND_THIS, ZEND_STR_TRACE);
ZVAL_DEREF(prop);
@@ -474,7 +472,7 @@ ZEND_METHOD(error_exception, getSeverity)
{
zval *prop, rv;
- DEFAULT_0_PARAMS;
+ ZEND_PARSE_PARAMETERS_NONE();
prop = GET_PROPERTY(ZEND_THIS, ZEND_STR_SEVERITY);
ZVAL_DEREF(prop);
@@ -622,14 +620,15 @@ ZEND_METHOD(exception, getTraceAsString)
smart_str str = {0};
uint32_t num = 0;
- DEFAULT_0_PARAMS;
+ ZEND_PARSE_PARAMETERS_NONE();
object = ZEND_THIS;
base_ce = i_get_exception_base(object);
trace = zend_read_property_ex(base_ce, object, ZSTR_KNOWN(ZEND_STR_TRACE), 1, &rv);
if (Z_TYPE_P(trace) != IS_ARRAY) {
- RETURN_FALSE;
+ zend_type_error("Trace is not an array");
+ return;
}
ZEND_HASH_FOREACH_NUM_KEY_VAL(Z_ARRVAL_P(trace), index, frame) {
if (Z_TYPE_P(frame) != IS_ARRAY) {
@@ -655,7 +654,7 @@ ZEND_METHOD(exception, getPrevious)
{
zval rv;
- DEFAULT_0_PARAMS;
+ ZEND_PARSE_PARAMETERS_NONE();
ZVAL_COPY(return_value, GET_PROPERTY_SILENT(ZEND_THIS, ZEND_STR_PREVIOUS));
} /* }}} */
@@ -671,7 +670,7 @@ ZEND_METHOD(exception, __toString)
zval rv, tmp;
zend_string *fname;
- DEFAULT_0_PARAMS;
+ ZEND_PARSE_PARAMETERS_NONE();
str = ZSTR_EMPTY_ALLOC();
@@ -757,14 +756,14 @@ ZEND_METHOD(exception, __toString)
/** {{{ Throwable method definition */
static const zend_function_entry zend_funcs_throwable[] = {
- ZEND_ABSTRACT_ME(throwable, getMessage, NULL)
- ZEND_ABSTRACT_ME(throwable, getCode, NULL)
- ZEND_ABSTRACT_ME(throwable, getFile, NULL)
- ZEND_ABSTRACT_ME(throwable, getLine, NULL)
- ZEND_ABSTRACT_ME(throwable, getTrace, NULL)
- ZEND_ABSTRACT_ME(throwable, getPrevious, NULL)
- ZEND_ABSTRACT_ME(throwable, getTraceAsString, NULL)
- ZEND_ABSTRACT_ME(throwable, __toString, NULL)
+ ZEND_ABSTRACT_ME(throwable, getMessage, arginfo_class_Throwable_getMessage)
+ ZEND_ABSTRACT_ME(throwable, getCode, arginfo_class_Throwable_getCode)
+ ZEND_ABSTRACT_ME(throwable, getFile, arginfo_class_Throwable_getFile)
+ ZEND_ABSTRACT_ME(throwable, getLine, arginfo_class_Throwable_getLine)
+ ZEND_ABSTRACT_ME(throwable, getTrace, arginfo_class_Throwable_getTrace)
+ ZEND_ABSTRACT_ME(throwable, getPrevious, arginfo_class_Throwable_getPrevious)
+ ZEND_ABSTRACT_ME(throwable, getTraceAsString, arginfo_class_Throwable_getTraceAsString)
+ ZEND_ABSTRACT_ME(throwable, __toString, arginfo_class_Throwable___toString)
ZEND_FE_END
};
/* }}} */
@@ -779,39 +778,24 @@ static const zend_function_entry zend_funcs_throwable[] = {
* And never try to change the state of exceptions and never implement anything
* that gives the user anything to accomplish this.
*/
-ZEND_BEGIN_ARG_INFO_EX(arginfo_exception___construct, 0, 0, 0)
- ZEND_ARG_INFO(0, message)
- ZEND_ARG_INFO(0, code)
- ZEND_ARG_INFO(0, previous)
-ZEND_END_ARG_INFO()
-
static const zend_function_entry default_exception_functions[] = {
- ZEND_ME(exception, __clone, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
- ZEND_ME(exception, __construct, arginfo_exception___construct, ZEND_ACC_PUBLIC)
- ZEND_ME(exception, __wakeup, NULL, ZEND_ACC_PUBLIC)
- ZEND_ME(exception, getMessage, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
- ZEND_ME(exception, getCode, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
- ZEND_ME(exception, getFile, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
- ZEND_ME(exception, getLine, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
- ZEND_ME(exception, getTrace, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
- ZEND_ME(exception, getPrevious, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
- ZEND_ME(exception, getTraceAsString, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
- ZEND_ME(exception, __toString, NULL, 0)
+ ZEND_ME(exception, __clone, arginfo_class_Exception___clone, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
+ ZEND_ME(exception, __construct, arginfo_class_Exception___construct, ZEND_ACC_PUBLIC)
+ ZEND_ME(exception, __wakeup, arginfo_class_Exception___wakeup, ZEND_ACC_PUBLIC)
+ ZEND_ME(exception, getMessage, arginfo_class_Exception_getMessage, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
+ ZEND_ME(exception, getCode, arginfo_class_Exception_getCode, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
+ ZEND_ME(exception, getFile, arginfo_class_Exception_getFile, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
+ ZEND_ME(exception, getLine, arginfo_class_Exception_getLine, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
+ ZEND_ME(exception, getTrace, arginfo_class_Exception_getTrace, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
+ ZEND_ME(exception, getPrevious, arginfo_class_Exception_getPrevious, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
+ ZEND_ME(exception, getTraceAsString, arginfo_class_Exception_getTraceAsString, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
+ ZEND_ME(exception, __toString, arginfo_class_Exception___toString, 0)
ZEND_FE_END
};
-ZEND_BEGIN_ARG_INFO_EX(arginfo_error_exception___construct, 0, 0, 0)
- ZEND_ARG_INFO(0, message)
- ZEND_ARG_INFO(0, code)
- ZEND_ARG_INFO(0, severity)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, lineno)
- ZEND_ARG_INFO(0, previous)
-ZEND_END_ARG_INFO()
-
static const zend_function_entry error_exception_functions[] = {
- ZEND_ME(error_exception, __construct, arginfo_error_exception___construct, ZEND_ACC_PUBLIC)
- ZEND_ME(error_exception, getSeverity, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
+ ZEND_ME(error_exception, __construct, arginfo_class_ErrorException___construct, ZEND_ACC_PUBLIC)
+ ZEND_ME(error_exception, getSeverity, arginfo_class_ErrorException_getSeverity, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
ZEND_FE_END
};
/* }}} */
@@ -872,6 +856,10 @@ void zend_register_default_exception(void) /* {{{ */
zend_ce_argument_count_error = zend_register_internal_class_ex(&ce, zend_ce_type_error);
zend_ce_argument_count_error->create_object = zend_default_exception_new;
+ INIT_CLASS_ENTRY(ce, "ValueError", NULL);
+ zend_ce_value_error = zend_register_internal_class_ex(&ce, zend_ce_error);
+ zend_ce_value_error->create_object = zend_default_exception_new;
+
INIT_CLASS_ENTRY(ce, "ArithmeticError", NULL);
zend_ce_arithmetic_error = zend_register_internal_class_ex(&ce, zend_ce_error);
zend_ce_arithmetic_error->create_object = zend_default_exception_new;
@@ -986,7 +974,8 @@ ZEND_API ZEND_COLD void zend_exception_error(zend_object *ex, int severity) /* {
zend_string *file = zval_get_string(GET_PROPERTY_SILENT(&exception, ZEND_STR_FILE));
zend_long line = zval_get_long(GET_PROPERTY_SILENT(&exception, ZEND_STR_LINE));
- zend_error_helper(ce_exception == zend_ce_parse_error ? E_PARSE : E_COMPILE_ERROR,
+ zend_error_helper(
+ (ce_exception == zend_ce_parse_error ? E_PARSE : E_COMPILE_ERROR) | E_DONT_BAIL,
ZSTR_VAL(file), line, "%s", ZSTR_VAL(message));
zend_string_release_ex(file, 0);
@@ -996,7 +985,7 @@ ZEND_API ZEND_COLD void zend_exception_error(zend_object *ex, int severity) /* {
zend_string *str, *file = NULL;
zend_long line = 0;
- zend_call_method_with_0_params(&exception, ce_exception, &ex->ce->__tostring, "__tostring", &tmp);
+ zend_call_method_with_0_params(Z_OBJ(exception), ce_exception, &ex->ce->__tostring, "__tostring", &tmp);
if (!EG(exception)) {
if (Z_TYPE(tmp) != IS_STRING) {
zend_error(E_WARNING, "%s::__toString() must return a string", ZSTR_VAL(ce_exception->name));
@@ -1029,7 +1018,8 @@ ZEND_API ZEND_COLD void zend_exception_error(zend_object *ex, int severity) /* {
file = zval_get_string(GET_PROPERTY_SILENT(&exception, ZEND_STR_FILE));
line = zval_get_long(GET_PROPERTY_SILENT(&exception, ZEND_STR_LINE));
- zend_error_va(severity, (file && ZSTR_LEN(file) > 0) ? ZSTR_VAL(file) : NULL, line,
+ zend_error_va(severity | E_DONT_BAIL,
+ (file && ZSTR_LEN(file) > 0) ? ZSTR_VAL(file) : NULL, line,
"Uncaught %s\n thrown", ZSTR_VAL(str));
zend_string_release_ex(str, 0);
diff --git a/Zend/zend_exceptions.h b/Zend/zend_exceptions.h
index 5f31c4b25b..ec6f0a0201 100644
--- a/Zend/zend_exceptions.h
+++ b/Zend/zend_exceptions.h
@@ -32,6 +32,7 @@ extern ZEND_API zend_class_entry *zend_ce_compile_error;
extern ZEND_API zend_class_entry *zend_ce_parse_error;
extern ZEND_API zend_class_entry *zend_ce_type_error;
extern ZEND_API zend_class_entry *zend_ce_argument_count_error;
+extern ZEND_API zend_class_entry *zend_ce_value_error;
extern ZEND_API zend_class_entry *zend_ce_arithmetic_error;
extern ZEND_API zend_class_entry *zend_ce_division_by_zero_error;
diff --git a/Zend/zend_exceptions.stub.php b/Zend/zend_exceptions.stub.php
new file mode 100644
index 0000000000..96d581caf9
--- /dev/null
+++ b/Zend/zend_exceptions.stub.php
@@ -0,0 +1,68 @@
+<?php
+
+interface Throwable
+{
+ /** @return string */
+ function getMessage();
+
+ /** @return int */
+ function getCode();
+
+ /** @return string */
+ function getFile();
+
+ /** @return int */
+ function getLine();
+
+ /** @return array */
+ function getTrace();
+
+ /** @return ?Throwable */
+ function getPrevious();
+
+ /** @return string */
+ function getTraceAsString();
+
+ /** @return string */
+ function __toString();
+}
+
+class Exception implements Throwable
+{
+ final private function __clone() {}
+
+ function __construct(string $message = UNKNOWN, int $code = 0, ?Throwable $previous = null) {}
+
+ function __wakeup() {}
+
+ /** @return string */
+ final function getMessage() {}
+
+ /** @return int */
+ final function getCode() {}
+
+ /** @return string */
+ final function getFile() {}
+
+ /** @return int */
+ final function getLine() {}
+
+ /** @return array */
+ final function getTrace() {}
+
+ /** @return ?Throwable */
+ final function getPrevious() {}
+
+ /** @return string */
+ final function getTraceAsString() {}
+
+ /** @return string */
+ function __toString() {}
+}
+
+class ErrorException extends Exception
+{
+ function __construct(string $message = UNKNOWN, int $code = 0, int $severity = E_ERROR, string $filename = UNKNOWN, int $lineno = 0, ?Throwable $previous = null) {}
+
+ final function getSeverity() {}
+}
diff --git a/Zend/zend_exceptions_arginfo.h b/Zend/zend_exceptions_arginfo.h
new file mode 100644
index 0000000000..c2f83e47e5
--- /dev/null
+++ b/Zend/zend_exceptions_arginfo.h
@@ -0,0 +1,55 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Throwable_getMessage, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_Throwable_getCode arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Throwable_getFile arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Throwable_getLine arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Throwable_getTrace arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Throwable_getPrevious arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Throwable_getTraceAsString arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Throwable___toString arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Exception___clone arginfo_class_Throwable_getMessage
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Exception___construct, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, message, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, code, IS_LONG, 0)
+ ZEND_ARG_OBJ_INFO(0, previous, Throwable, 1)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_Exception___wakeup arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Exception_getMessage arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Exception_getCode arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Exception_getFile arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Exception_getLine arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Exception_getTrace arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Exception_getPrevious arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Exception_getTraceAsString arginfo_class_Throwable_getMessage
+
+#define arginfo_class_Exception___toString arginfo_class_Throwable_getMessage
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ErrorException___construct, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, message, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, code, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, severity, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, lineno, IS_LONG, 0)
+ ZEND_ARG_OBJ_INFO(0, previous, Throwable, 1)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ErrorException_getSeverity arginfo_class_Throwable_getMessage
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index e9017ecde9..140038e4c3 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -39,6 +39,7 @@
#include "zend_dtrace.h"
#include "zend_inheritance.h"
#include "zend_type_info.h"
+#include "zend_smart_str.h"
/* Virtual current working directory support */
#include "zend_virtual_cwd.h"
@@ -109,16 +110,16 @@
typedef int (ZEND_FASTCALL *incdec_t)(zval *);
-#define get_zval_ptr(op_type, node, should_free, type) _get_zval_ptr(op_type, node, should_free, type EXECUTE_DATA_CC OPLINE_CC)
-#define get_zval_ptr_deref(op_type, node, should_free, type) _get_zval_ptr_deref(op_type, node, should_free, type EXECUTE_DATA_CC OPLINE_CC)
-#define get_zval_ptr_undef(op_type, node, should_free, type) _get_zval_ptr_undef(op_type, node, should_free, type EXECUTE_DATA_CC OPLINE_CC)
-#define get_op_data_zval_ptr_r(op_type, node, should_free) _get_op_data_zval_ptr_r(op_type, node, should_free EXECUTE_DATA_CC OPLINE_CC)
-#define get_op_data_zval_ptr_deref_r(op_type, node, should_free) _get_op_data_zval_ptr_deref_r(op_type, node, should_free EXECUTE_DATA_CC OPLINE_CC)
-#define get_zval_ptr_ptr(op_type, node, should_free, type) _get_zval_ptr_ptr(op_type, node, should_free, type EXECUTE_DATA_CC)
-#define get_zval_ptr_ptr_undef(op_type, node, should_free, type) _get_zval_ptr_ptr(op_type, node, should_free, type EXECUTE_DATA_CC)
-#define get_obj_zval_ptr(op_type, node, should_free, type) _get_obj_zval_ptr(op_type, node, should_free, type EXECUTE_DATA_CC OPLINE_CC)
-#define get_obj_zval_ptr_undef(op_type, node, should_free, type) _get_obj_zval_ptr_undef(op_type, node, should_free, type EXECUTE_DATA_CC OPLINE_CC)
-#define get_obj_zval_ptr_ptr(op_type, node, should_free, type) _get_obj_zval_ptr_ptr(op_type, node, should_free, type EXECUTE_DATA_CC)
+#define get_zval_ptr(op_type, node, type) _get_zval_ptr(op_type, node, type EXECUTE_DATA_CC OPLINE_CC)
+#define get_zval_ptr_deref(op_type, node, type) _get_zval_ptr_deref(op_type, node, type EXECUTE_DATA_CC OPLINE_CC)
+#define get_zval_ptr_undef(op_type, node, type) _get_zval_ptr_undef(op_type, node, type EXECUTE_DATA_CC OPLINE_CC)
+#define get_op_data_zval_ptr_r(op_type, node) _get_op_data_zval_ptr_r(op_type, node EXECUTE_DATA_CC OPLINE_CC)
+#define get_op_data_zval_ptr_deref_r(op_type, node) _get_op_data_zval_ptr_deref_r(op_type, node EXECUTE_DATA_CC OPLINE_CC)
+#define get_zval_ptr_ptr(op_type, node, type) _get_zval_ptr_ptr(op_type, node, type EXECUTE_DATA_CC)
+#define get_zval_ptr_ptr_undef(op_type, node, type) _get_zval_ptr_ptr(op_type, node, type EXECUTE_DATA_CC)
+#define get_obj_zval_ptr(op_type, node, type) _get_obj_zval_ptr(op_type, node, type EXECUTE_DATA_CC OPLINE_CC)
+#define get_obj_zval_ptr_undef(op_type, node, type) _get_obj_zval_ptr_undef(op_type, node, type EXECUTE_DATA_CC OPLINE_CC)
+#define get_obj_zval_ptr_ptr(op_type, node, type) _get_obj_zval_ptr_ptr(op_type, node, type EXECUTE_DATA_CC)
#define RETURN_VALUE_USED(opline) ((opline)->result_type != IS_UNUSED)
@@ -141,13 +142,12 @@ ZEND_API const zend_internal_function zend_pass_function = {
{NULL,NULL,NULL,NULL} /* reserved */
};
-#define FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op, result) do { \
- zval *__container_to_free = (free_op); \
- if (UNEXPECTED(__container_to_free) \
- && EXPECTED(Z_REFCOUNTED_P(__container_to_free))) { \
+#define FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_var) do { \
+ zval *__container_to_free = EX_VAR(free_var); \
+ if (UNEXPECTED(Z_REFCOUNTED_P(__container_to_free))) { \
zend_refcounted *__ref = Z_COUNTED_P(__container_to_free); \
if (UNEXPECTED(!GC_DELREF(__ref))) { \
- zval *__zv = (result); \
+ zval *__zv = EX_VAR(opline->result.var); \
if (EXPECTED(Z_TYPE_P(__zv) == IS_INDIRECT)) { \
ZVAL_COPY(__zv, Z_INDIRECT_P(__zv)); \
} \
@@ -156,20 +156,16 @@ ZEND_API const zend_internal_function zend_pass_function = {
} \
} while (0)
-#define FREE_OP(should_free) \
- if (should_free) { \
- zval_ptr_dtor_nogc(should_free); \
- }
-
-#define FREE_UNFETCHED_OP(type, var) \
+#define FREE_OP(type, var) \
if ((type) & (IS_TMP_VAR|IS_VAR)) { \
zval_ptr_dtor_nogc(EX_VAR(var)); \
}
-#define FREE_OP_VAR_PTR(should_free) \
- if (should_free) { \
- zval_ptr_dtor_nogc(should_free); \
- }
+#define FREE_UNFETCHED_OP(type, var) \
+ FREE_OP(type, var)
+
+#define FREE_OP_VAR_PTR(type, var) \
+ FREE_OP(type, var)
#define CV_DEF_OF(i) (EX(func)->op_array.vars[i])
@@ -241,29 +237,26 @@ ZEND_API zval* zend_get_compiled_variable_value(const zend_execute_data *execute
return EX_VAR(var);
}
-static zend_always_inline zval *_get_zval_ptr_tmp(uint32_t var, zend_free_op *should_free EXECUTE_DATA_DC)
+static zend_always_inline zval *_get_zval_ptr_tmp(uint32_t var EXECUTE_DATA_DC)
{
zval *ret = EX_VAR(var);
- *should_free = ret;
ZEND_ASSERT(Z_TYPE_P(ret) != IS_REFERENCE);
return ret;
}
-static zend_always_inline zval *_get_zval_ptr_var(uint32_t var, zend_free_op *should_free EXECUTE_DATA_DC)
+static zend_always_inline zval *_get_zval_ptr_var(uint32_t var EXECUTE_DATA_DC)
{
zval *ret = EX_VAR(var);
- *should_free = ret;
return ret;
}
-static zend_always_inline zval *_get_zval_ptr_var_deref(uint32_t var, zend_free_op *should_free EXECUTE_DATA_DC)
+static zend_always_inline zval *_get_zval_ptr_var_deref(uint32_t var EXECUTE_DATA_DC)
{
zval *ret = EX_VAR(var);
- *should_free = ret;
ZVAL_DEREF(ret);
return ret;
}
@@ -272,7 +265,7 @@ static zend_never_inline ZEND_COLD zval* zval_undefined_cv(uint32_t var EXECUTE_
{
if (EXPECTED(EG(exception) == NULL)) {
zend_string *cv = CV_DEF_OF(EX_VAR_TO_NUM(var));
- zend_error(E_NOTICE, "Undefined variable: %s", ZSTR_VAL(cv));
+ zend_error(E_WARNING, "Undefined variable: %s", ZSTR_VAL(cv));
}
return &EG(uninitialized_zval);
}
@@ -390,17 +383,16 @@ static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_W(uint32_t var EXECUTE_D
return ret;
}
-static zend_always_inline zval *_get_zval_ptr(int op_type, znode_op node, zend_free_op *should_free, int type EXECUTE_DATA_DC OPLINE_DC)
+static zend_always_inline zval *_get_zval_ptr(int op_type, znode_op node, int type EXECUTE_DATA_DC OPLINE_DC)
{
if (op_type & (IS_TMP_VAR|IS_VAR)) {
if (!ZEND_DEBUG || op_type == IS_VAR) {
- return _get_zval_ptr_var(node.var, should_free EXECUTE_DATA_CC);
+ return _get_zval_ptr_var(node.var EXECUTE_DATA_CC);
} else {
ZEND_ASSERT(op_type == IS_TMP_VAR);
- return _get_zval_ptr_tmp(node.var, should_free EXECUTE_DATA_CC);
+ return _get_zval_ptr_tmp(node.var EXECUTE_DATA_CC);
}
} else {
- *should_free = NULL;
if (op_type == IS_CONST) {
return RT_CONSTANT(opline, node);
} else if (op_type == IS_CV) {
@@ -411,17 +403,16 @@ static zend_always_inline zval *_get_zval_ptr(int op_type, znode_op node, zend_f
}
}
-static zend_always_inline zval *_get_op_data_zval_ptr_r(int op_type, znode_op node, zend_free_op *should_free EXECUTE_DATA_DC OPLINE_DC)
+static zend_always_inline zval *_get_op_data_zval_ptr_r(int op_type, znode_op node EXECUTE_DATA_DC OPLINE_DC)
{
if (op_type & (IS_TMP_VAR|IS_VAR)) {
if (!ZEND_DEBUG || op_type == IS_VAR) {
- return _get_zval_ptr_var(node.var, should_free EXECUTE_DATA_CC);
+ return _get_zval_ptr_var(node.var EXECUTE_DATA_CC);
} else {
ZEND_ASSERT(op_type == IS_TMP_VAR);
- return _get_zval_ptr_tmp(node.var, should_free EXECUTE_DATA_CC);
+ return _get_zval_ptr_tmp(node.var EXECUTE_DATA_CC);
}
} else {
- *should_free = NULL;
if (op_type == IS_CONST) {
return RT_CONSTANT(opline + 1, node);
} else if (op_type == IS_CV) {
@@ -432,17 +423,16 @@ static zend_always_inline zval *_get_op_data_zval_ptr_r(int op_type, znode_op no
}
}
-static zend_always_inline ZEND_ATTRIBUTE_UNUSED zval *_get_zval_ptr_deref(int op_type, znode_op node, zend_free_op *should_free, int type EXECUTE_DATA_DC OPLINE_DC)
+static zend_always_inline ZEND_ATTRIBUTE_UNUSED zval *_get_zval_ptr_deref(int op_type, znode_op node, int type EXECUTE_DATA_DC OPLINE_DC)
{
if (op_type & (IS_TMP_VAR|IS_VAR)) {
if (op_type == IS_TMP_VAR) {
- return _get_zval_ptr_tmp(node.var, should_free EXECUTE_DATA_CC);
+ return _get_zval_ptr_tmp(node.var EXECUTE_DATA_CC);
} else {
ZEND_ASSERT(op_type == IS_VAR);
- return _get_zval_ptr_var_deref(node.var, should_free EXECUTE_DATA_CC);
+ return _get_zval_ptr_var_deref(node.var EXECUTE_DATA_CC);
}
} else {
- *should_free = NULL;
if (op_type == IS_CONST) {
return RT_CONSTANT(opline, node);
} else if (op_type == IS_CV) {
@@ -453,17 +443,16 @@ static zend_always_inline ZEND_ATTRIBUTE_UNUSED zval *_get_zval_ptr_deref(int op
}
}
-static zend_always_inline ZEND_ATTRIBUTE_UNUSED zval *_get_op_data_zval_ptr_deref_r(int op_type, znode_op node, zend_free_op *should_free EXECUTE_DATA_DC OPLINE_DC)
+static zend_always_inline ZEND_ATTRIBUTE_UNUSED zval *_get_op_data_zval_ptr_deref_r(int op_type, znode_op node EXECUTE_DATA_DC OPLINE_DC)
{
if (op_type & (IS_TMP_VAR|IS_VAR)) {
if (op_type == IS_TMP_VAR) {
- return _get_zval_ptr_tmp(node.var, should_free EXECUTE_DATA_CC);
+ return _get_zval_ptr_tmp(node.var EXECUTE_DATA_CC);
} else {
ZEND_ASSERT(op_type == IS_VAR);
- return _get_zval_ptr_var_deref(node.var, should_free EXECUTE_DATA_CC);
+ return _get_zval_ptr_var_deref(node.var EXECUTE_DATA_CC);
}
} else {
- *should_free = NULL;
if (op_type == IS_CONST) {
return RT_CONSTANT(opline + 1, node);
} else if (op_type == IS_CV) {
@@ -474,17 +463,16 @@ static zend_always_inline ZEND_ATTRIBUTE_UNUSED zval *_get_op_data_zval_ptr_dere
}
}
-static zend_always_inline zval *_get_zval_ptr_undef(int op_type, znode_op node, zend_free_op *should_free, int type EXECUTE_DATA_DC OPLINE_DC)
+static zend_always_inline zval *_get_zval_ptr_undef(int op_type, znode_op node, int type EXECUTE_DATA_DC OPLINE_DC)
{
if (op_type & (IS_TMP_VAR|IS_VAR)) {
if (!ZEND_DEBUG || op_type == IS_VAR) {
- return _get_zval_ptr_var(node.var, should_free EXECUTE_DATA_CC);
+ return _get_zval_ptr_var(node.var EXECUTE_DATA_CC);
} else {
ZEND_ASSERT(op_type == IS_TMP_VAR);
- return _get_zval_ptr_tmp(node.var, should_free EXECUTE_DATA_CC);
+ return _get_zval_ptr_tmp(node.var EXECUTE_DATA_CC);
}
} else {
- *should_free = NULL;
if (op_type == IS_CONST) {
return RT_CONSTANT(opline, node);
} else if (op_type == IS_CV) {
@@ -495,55 +483,48 @@ static zend_always_inline zval *_get_zval_ptr_undef(int op_type, znode_op node,
}
}
-static zend_always_inline zval *_get_zval_ptr_ptr_var(uint32_t var, zend_free_op *should_free EXECUTE_DATA_DC)
+static zend_always_inline zval *_get_zval_ptr_ptr_var(uint32_t var EXECUTE_DATA_DC)
{
zval *ret = EX_VAR(var);
if (EXPECTED(Z_TYPE_P(ret) == IS_INDIRECT)) {
- *should_free = NULL;
ret = Z_INDIRECT_P(ret);
- } else {
- *should_free = ret;
}
return ret;
}
-static inline zval *_get_zval_ptr_ptr(int op_type, znode_op node, zend_free_op *should_free, int type EXECUTE_DATA_DC)
+static inline zval *_get_zval_ptr_ptr(int op_type, znode_op node, int type EXECUTE_DATA_DC)
{
if (op_type == IS_CV) {
- *should_free = NULL;
return _get_zval_ptr_cv(node.var, type EXECUTE_DATA_CC);
} else /* if (op_type == IS_VAR) */ {
ZEND_ASSERT(op_type == IS_VAR);
- return _get_zval_ptr_ptr_var(node.var, should_free EXECUTE_DATA_CC);
+ return _get_zval_ptr_ptr_var(node.var EXECUTE_DATA_CC);
}
}
-static inline ZEND_ATTRIBUTE_UNUSED zval *_get_obj_zval_ptr(int op_type, znode_op op, zend_free_op *should_free, int type EXECUTE_DATA_DC OPLINE_DC)
+static inline ZEND_ATTRIBUTE_UNUSED zval *_get_obj_zval_ptr(int op_type, znode_op op, int type EXECUTE_DATA_DC OPLINE_DC)
{
if (op_type == IS_UNUSED) {
- *should_free = NULL;
return &EX(This);
}
- return get_zval_ptr(op_type, op, should_free, type);
+ return get_zval_ptr(op_type, op, type);
}
-static inline ZEND_ATTRIBUTE_UNUSED zval *_get_obj_zval_ptr_undef(int op_type, znode_op op, zend_free_op *should_free, int type EXECUTE_DATA_DC OPLINE_DC)
+static inline ZEND_ATTRIBUTE_UNUSED zval *_get_obj_zval_ptr_undef(int op_type, znode_op op, int type EXECUTE_DATA_DC OPLINE_DC)
{
if (op_type == IS_UNUSED) {
- *should_free = NULL;
return &EX(This);
}
- return get_zval_ptr_undef(op_type, op, should_free, type);
+ return get_zval_ptr_undef(op_type, op, type);
}
-static inline ZEND_ATTRIBUTE_UNUSED zval *_get_obj_zval_ptr_ptr(int op_type, znode_op node, zend_free_op *should_free, int type EXECUTE_DATA_DC)
+static inline ZEND_ATTRIBUTE_UNUSED zval *_get_obj_zval_ptr_ptr(int op_type, znode_op node, int type EXECUTE_DATA_DC)
{
if (op_type == IS_UNUSED) {
- *should_free = NULL;
return &EX(This);
}
- return get_zval_ptr_ptr(op_type, node, should_free, type);
+ return get_zval_ptr_ptr(op_type, node, type);
}
static inline void zend_assign_to_variable_reference(zval *variable_ptr, zval *value_ptr)
@@ -599,39 +580,26 @@ static zend_never_inline ZEND_COLD int zend_wrong_assign_to_variable_reference(z
return 1;
}
-static void zend_format_type(zend_type type, const char **part1, const char **part2) {
- *part1 = ZEND_TYPE_ALLOW_NULL(type) ? "?" : "";
- if (ZEND_TYPE_IS_CLASS(type)) {
- if (ZEND_TYPE_IS_CE(type)) {
- *part2 = ZSTR_VAL(ZEND_TYPE_CE(type)->name);
- } else {
- *part2 = ZSTR_VAL(ZEND_TYPE_NAME(type));
- }
- } else {
- *part2 = zend_get_type_by_const(ZEND_TYPE_CODE(type));
- }
-}
-
static zend_never_inline ZEND_COLD void zend_throw_auto_init_in_prop_error(zend_property_info *prop, const char *type) {
- const char *prop_type1, *prop_type2;
- zend_format_type(prop->type, &prop_type1, &prop_type2);
+ zend_string *type_str = zend_type_to_string(prop->type);
zend_type_error(
- "Cannot auto-initialize an %s inside property %s::$%s of type %s%s",
+ "Cannot auto-initialize an %s inside property %s::$%s of type %s",
type,
ZSTR_VAL(prop->ce->name), zend_get_unmangled_property_name(prop->name),
- prop_type1, prop_type2
+ ZSTR_VAL(type_str)
);
+ zend_string_release(type_str);
}
static zend_never_inline ZEND_COLD void zend_throw_auto_init_in_ref_error(zend_property_info *prop, const char *type) {
- const char *prop_type1, *prop_type2;
- zend_format_type(prop->type, &prop_type1, &prop_type2);
+ zend_string *type_str = zend_type_to_string(prop->type);
zend_type_error(
- "Cannot auto-initialize an %s inside a reference held by property %s::$%s of type %s%s",
+ "Cannot auto-initialize an %s inside a reference held by property %s::$%s of type %s",
type,
ZSTR_VAL(prop->ce->name), zend_get_unmangled_property_name(prop->name),
- prop_type1, prop_type2
+ ZSTR_VAL(type_str)
);
+ zend_string_release(type_str);
}
static zend_never_inline ZEND_COLD void zend_throw_access_uninit_prop_by_ref_error(
@@ -642,80 +610,60 @@ static zend_never_inline ZEND_COLD void zend_throw_access_uninit_prop_by_ref_err
zend_get_unmangled_property_name(prop->name));
}
-static zend_never_inline zend_bool zend_verify_ref_stdClass_assignable(zend_reference *ref);
-static zend_never_inline zend_bool zend_verify_ref_array_assignable(zend_reference *ref);
-
/* this should modify object only if it's empty */
-static zend_never_inline ZEND_COLD zval* ZEND_FASTCALL make_real_object(zval *object, zval *property OPLINE_DC EXECUTE_DATA_DC)
-{
- zend_object *obj;
- zval *ref = NULL;
- if (Z_ISREF_P(object)) {
- ref = object;
- object = Z_REFVAL_P(object);
- }
-
- if (UNEXPECTED(Z_TYPE_P(object) > IS_FALSE &&
- (Z_TYPE_P(object) != IS_STRING || Z_STRLEN_P(object) != 0))) {
- if (opline->op1_type != IS_VAR || EXPECTED(!Z_ISERROR_P(object))) {
- zend_string *tmp_property_name;
- zend_string *property_name = zval_get_tmp_string(property, &tmp_property_name);
-
- if (opline->opcode == ZEND_PRE_INC_OBJ
- || opline->opcode == ZEND_PRE_DEC_OBJ
- || opline->opcode == ZEND_POST_INC_OBJ
- || opline->opcode == ZEND_POST_DEC_OBJ) {
- zend_error(E_WARNING, "Attempt to increment/decrement property '%s' of non-object", ZSTR_VAL(property_name));
- } else if (opline->opcode == ZEND_FETCH_OBJ_W
- || opline->opcode == ZEND_FETCH_OBJ_RW
- || opline->opcode == ZEND_FETCH_OBJ_FUNC_ARG
- || opline->opcode == ZEND_ASSIGN_OBJ_REF) {
- zend_error(E_WARNING, "Attempt to modify property '%s' of non-object", ZSTR_VAL(property_name));
- } else {
- zend_error(E_WARNING, "Attempt to assign property '%s' of non-object", ZSTR_VAL(property_name));
- }
- zend_tmp_string_release(tmp_property_name);
- }
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- return NULL;
+static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_throw_non_object_error(zval *object, zval *property OPLINE_DC EXECUTE_DATA_DC)
+{
+ zend_string *tmp_property_name;
+ zend_string *property_name = zval_get_tmp_string(property, &tmp_property_name);
+
+ if (opline->opcode == ZEND_PRE_INC_OBJ
+ || opline->opcode == ZEND_PRE_DEC_OBJ
+ || opline->opcode == ZEND_POST_INC_OBJ
+ || opline->opcode == ZEND_POST_DEC_OBJ) {
+ zend_throw_error(NULL,
+ "Attempt to increment/decrement property '%s' of non-object",
+ ZSTR_VAL(property_name));
+ } else if (opline->opcode == ZEND_FETCH_OBJ_W
+ || opline->opcode == ZEND_FETCH_OBJ_RW
+ || opline->opcode == ZEND_FETCH_OBJ_FUNC_ARG
+ || opline->opcode == ZEND_ASSIGN_OBJ_REF) {
+ zend_throw_error(NULL,
+ "Attempt to modify property '%s' of non-object", ZSTR_VAL(property_name));
+ } else {
+ zend_throw_error(NULL,
+ "Attempt to assign property '%s' of non-object", ZSTR_VAL(property_name));
}
+ zend_tmp_string_release(tmp_property_name);
- if (ref && ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(ref))) {
- if (UNEXPECTED(!zend_verify_ref_stdClass_assignable(Z_REF_P(ref)))) {
- if (RETURN_VALUE_USED(opline)) {
- ZVAL_UNDEF(EX_VAR(opline->result.var));
- }
- return NULL;
- }
+ if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
}
+}
- zval_ptr_dtor_nogc(object);
- object_init(object);
- Z_ADDREF_P(object);
- obj = Z_OBJ_P(object);
- zend_error(E_WARNING, "Creating default object from empty value");
- if (GC_REFCOUNT(obj) == 1) {
- /* the enclosing container was deleted, obj is unreferenced */
- OBJ_RELEASE(obj);
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- return NULL;
+/* Test used to preserve old error messages for non-union types.
+ * We might want to canonicalize all type errors instead. */
+static zend_bool is_union_type(zend_type type) {
+ if (ZEND_TYPE_HAS_LIST(type)) {
+ return 1;
+ }
+ uint32_t type_mask_without_null = ZEND_TYPE_PURE_MASK_WITHOUT_NULL(type);
+ if (ZEND_TYPE_HAS_CLASS(type)) {
+ return type_mask_without_null != 0;
}
- Z_DELREF_P(object);
- return object;
+ if (type_mask_without_null == MAY_BE_BOOL) {
+ return 0;
+ }
+ /* Check that only one bit is set. */
+ return (type_mask_without_null & (type_mask_without_null - 1)) != 0;
}
static ZEND_COLD void zend_verify_type_error_common(
const zend_function *zf, const zend_arg_info *arg_info,
- const zend_class_entry *ce, zval *value,
+ void **cache_slot, zval *value,
const char **fname, const char **fsep, const char **fclass,
- const char **need_msg, const char **need_kind, const char **need_or_null,
- const char **given_msg, const char **given_kind)
+ zend_string **need_msg, const char **given_msg, const char **given_kind)
{
- zend_bool is_interface = 0;
+ smart_str str = {0};
*fname = ZSTR_VAL(zf->common.function_name);
if (zf->common.scope) {
*fsep = "::";
@@ -725,50 +673,69 @@ static ZEND_COLD void zend_verify_type_error_common(
*fclass = "";
}
- if (ZEND_TYPE_IS_CLASS(arg_info->type)) {
+ if (is_union_type(arg_info->type)) {
+ zend_string *type_str = zend_type_to_string(arg_info->type);
+ smart_str_appends(&str, "be of type ");
+ smart_str_append(&str, type_str);
+ zend_string_release(type_str);
+ } else if (ZEND_TYPE_HAS_CLASS(arg_info->type)) {
+ zend_bool is_interface = 0;
+ zend_class_entry *ce = *cache_slot;
+ if (!ce) {
+ ce = zend_fetch_class(ZEND_TYPE_NAME(arg_info->type),
+ (ZEND_FETCH_CLASS_AUTO | ZEND_FETCH_CLASS_NO_AUTOLOAD));
+ }
if (ce) {
if (ce->ce_flags & ZEND_ACC_INTERFACE) {
- *need_msg = "implement interface ";
+ smart_str_appends(&str, "implement interface ");
is_interface = 1;
} else {
- *need_msg = "be an instance of ";
+ smart_str_appends(&str, "be an instance of ");
}
- *need_kind = ZSTR_VAL(ce->name);
+ smart_str_append(&str, ce->name);
} else {
/* We don't know whether it's a class or interface, assume it's a class */
+ smart_str_appends(&str, "be an instance of ");
+ smart_str_append(&str, ZEND_TYPE_NAME(arg_info->type));
+ }
- *need_msg = "be an instance of ";
- *need_kind = ZSTR_VAL(ZEND_TYPE_NAME(arg_info->type));
+ if (ZEND_TYPE_ALLOW_NULL(arg_info->type)) {
+ smart_str_appends(&str, is_interface ? " or be null" : " or null");
}
} else {
- switch (ZEND_TYPE_CODE(arg_info->type)) {
- case IS_OBJECT:
- *need_msg = "be an ";
- *need_kind = "object";
+ uint32_t type_mask = ZEND_TYPE_PURE_MASK_WITHOUT_NULL(arg_info->type);
+ switch (type_mask) {
+ case MAY_BE_OBJECT:
+ smart_str_appends(&str, "be an object");
break;
- case IS_CALLABLE:
- *need_msg = "be callable";
- *need_kind = "";
+ case MAY_BE_CALLABLE:
+ smart_str_appends(&str, "be callable");
break;
- case IS_ITERABLE:
- *need_msg = "be iterable";
- *need_kind = "";
+ case MAY_BE_ITERABLE:
+ smart_str_appends(&str, "be iterable");
break;
default:
- *need_msg = "be of the type ";
- *need_kind = zend_get_type_by_const(ZEND_TYPE_CODE(arg_info->type));
+ {
+ /* Hack to print the type without null */
+ zend_type type = arg_info->type;
+ ZEND_TYPE_FULL_MASK(type) &= ~MAY_BE_NULL;
+ zend_string *type_str = zend_type_to_string(type);
+ smart_str_appends(&str, "be of the type ");
+ smart_str_append(&str, type_str);
+ zend_string_release(type_str);
break;
+ }
}
- }
- if (ZEND_TYPE_ALLOW_NULL(arg_info->type)) {
- *need_or_null = is_interface ? " or be null" : " or null";
- } else {
- *need_or_null = "";
+ if (ZEND_TYPE_ALLOW_NULL(arg_info->type)) {
+ smart_str_appends(&str, " or null");
+ }
}
+ *need_msg = smart_str_extract(&str);
+
if (value) {
- if (ZEND_TYPE_IS_CLASS(arg_info->type) && Z_TYPE_P(value) == IS_OBJECT) {
+ if (ZEND_TYPE_HAS_CLASS(arg_info->type) && Z_TYPE_P(value) == IS_OBJECT) {
*given_msg = "instance of ";
*given_kind = ZSTR_VAL(Z_OBJCE_P(value)->name);
} else {
@@ -781,13 +748,14 @@ static ZEND_COLD void zend_verify_type_error_common(
}
}
-static ZEND_COLD void zend_verify_arg_error(
+ZEND_API ZEND_COLD void zend_verify_arg_error(
const zend_function *zf, const zend_arg_info *arg_info,
- int arg_num, const zend_class_entry *ce, zval *value)
+ int arg_num, void **cache_slot, zval *value)
{
zend_execute_data *ptr = EG(current_execute_data)->prev_execute_data;
const char *fname, *fsep, *fclass;
- const char *need_msg, *need_kind, *need_or_null, *given_msg, *given_kind;
+ zend_string *need_msg;
+ const char *given_msg, *given_kind;
if (EG(exception)) {
/* The type verification itself might have already thrown an exception
@@ -797,189 +765,237 @@ static ZEND_COLD void zend_verify_arg_error(
if (value) {
zend_verify_type_error_common(
- zf, arg_info, ce, value,
- &fname, &fsep, &fclass, &need_msg, &need_kind, &need_or_null, &given_msg, &given_kind);
+ zf, arg_info, cache_slot, value,
+ &fname, &fsep, &fclass, &need_msg, &given_msg, &given_kind);
if (zf->common.type == ZEND_USER_FUNCTION) {
if (ptr && ptr->func && ZEND_USER_CODE(ptr->func->common.type)) {
- zend_type_error("Argument %d passed to %s%s%s() must %s%s%s, %s%s given, called in %s on line %d",
- arg_num, fclass, fsep, fname, need_msg, need_kind, need_or_null, given_msg, given_kind,
+ zend_type_error("Argument %d passed to %s%s%s() must %s, %s%s given, called in %s on line %d",
+ arg_num, fclass, fsep, fname, ZSTR_VAL(need_msg), given_msg, given_kind,
ZSTR_VAL(ptr->func->op_array.filename), ptr->opline->lineno);
} else {
- zend_type_error("Argument %d passed to %s%s%s() must %s%s%s, %s%s given", arg_num, fclass, fsep, fname, need_msg, need_kind, need_or_null, given_msg, given_kind);
+ zend_type_error("Argument %d passed to %s%s%s() must %s, %s%s given", arg_num, fclass, fsep, fname, ZSTR_VAL(need_msg), given_msg, given_kind);
}
} else {
- zend_type_error("Argument %d passed to %s%s%s() must %s%s%s, %s%s given", arg_num, fclass, fsep, fname, need_msg, need_kind, need_or_null, given_msg, given_kind);
+ zend_type_error("Argument %d passed to %s%s%s() must %s, %s%s given", arg_num, fclass, fsep, fname, ZSTR_VAL(need_msg), given_msg, given_kind);
}
+
+ zend_string_release(need_msg);
} else {
zend_missing_arg_error(ptr);
}
}
-static int is_null_constant(zend_class_entry *scope, zval *default_value)
+static zend_bool zend_verify_weak_scalar_type_hint(uint32_t type_mask, zval *arg)
{
- if (Z_TYPE_P(default_value) == IS_CONSTANT_AST) {
- zval constant;
-
- ZVAL_COPY(&constant, default_value);
- if (UNEXPECTED(zval_update_constant_ex(&constant, scope) != SUCCESS)) {
- return 0;
- }
- if (Z_TYPE(constant) == IS_NULL) {
+ zend_long lval;
+ double dval;
+ zend_string *str;
+ zend_bool bval;
+
+ /* Type preference order: int -> float -> string -> bool */
+ if (type_mask & MAY_BE_LONG) {
+ /* For an int|float union type and string value,
+ * determine chosen type by is_numeric_string() semantics. */
+ if ((type_mask & MAY_BE_DOUBLE) && Z_TYPE_P(arg) == IS_STRING) {
+ zend_uchar type = is_numeric_string(Z_STRVAL_P(arg), Z_STRLEN_P(arg), &lval, &dval, -1);
+ if (type == IS_LONG) {
+ zend_string_release(Z_STR_P(arg));
+ ZVAL_LONG(arg, lval);
+ return 1;
+ }
+ if (type == IS_DOUBLE) {
+ zend_string_release(Z_STR_P(arg));
+ ZVAL_DOUBLE(arg, dval);
+ return 1;
+ }
+ } else if (zend_parse_arg_long_weak(arg, &lval)) {
+ zval_ptr_dtor(arg);
+ ZVAL_LONG(arg, lval);
return 1;
}
- zval_ptr_dtor_nogc(&constant);
+ }
+ if ((type_mask & MAY_BE_DOUBLE) && zend_parse_arg_double_weak(arg, &dval)) {
+ zval_ptr_dtor(arg);
+ ZVAL_DOUBLE(arg, dval);
+ return 1;
+ }
+ if ((type_mask & MAY_BE_STRING) && zend_parse_arg_str_weak(arg, &str)) {
+ /* on success "arg" is converted to IS_STRING */
+ return 1;
+ }
+ if ((type_mask & MAY_BE_BOOL) == MAY_BE_BOOL && zend_parse_arg_bool_weak(arg, &bval)) {
+ zval_ptr_dtor(arg);
+ ZVAL_BOOL(arg, bval);
+ return 1;
}
return 0;
}
-static zend_bool zend_verify_weak_scalar_type_hint(zend_uchar type_hint, zval *arg)
-{
- switch (type_hint) {
- case _IS_BOOL: {
- zend_bool dest;
-
- if (!zend_parse_arg_bool_weak(arg, &dest)) {
- return 0;
+#if ZEND_DEBUG
+/* Used to sanity-check internal arginfo types without performing any actual type conversions. */
+static zend_bool zend_verify_weak_scalar_type_hint_no_sideeffect(uint32_t type_mask, zval *arg)
+{
+ zend_long lval;
+ double dval;
+ zend_bool bval;
+
+ if (type_mask & MAY_BE_LONG) {
+ if (Z_TYPE_P(arg) == IS_STRING) {
+ /* Handle this case separately to avoid the "non well-formed" warning */
+ zend_uchar type = is_numeric_string(Z_STRVAL_P(arg), Z_STRLEN_P(arg), NULL, &dval, 1);
+ if (type == IS_LONG) {
+ return 1;
}
- zval_ptr_dtor(arg);
- ZVAL_BOOL(arg, dest);
- return 1;
- }
- case IS_LONG: {
- zend_long dest;
+ if (type == IS_DOUBLE) {
+ if ((type_mask & MAY_BE_DOUBLE)
+ || (!zend_isnan(dval) && ZEND_DOUBLE_FITS_LONG(dval))) {
+ return 1;
+ }
- if (!zend_parse_arg_long_weak(arg, &dest)) {
- return 0;
}
- zval_ptr_dtor(arg);
- ZVAL_LONG(arg, dest);
+ }
+ if (zend_parse_arg_long_weak(arg, &lval)) {
return 1;
}
- case IS_DOUBLE: {
- double dest;
-
- if (!zend_parse_arg_double_weak(arg, &dest)) {
- return 0;
+ }
+ if (type_mask & MAY_BE_DOUBLE) {
+ if (Z_TYPE_P(arg) == IS_STRING) {
+ /* Handle this case separately to avoid the "non well-formed" warning */
+ if (is_numeric_string(Z_STRVAL_P(arg), Z_STRLEN_P(arg), NULL, NULL, 1) != 0) {
+ return 1;
}
- zval_ptr_dtor(arg);
- ZVAL_DOUBLE(arg, dest);
- return 1;
}
- case IS_STRING: {
- zend_string *dest;
-
- /* on success "arg" is converted to IS_STRING */
- return zend_parse_arg_str_weak(arg, &dest);
+ if (zend_parse_arg_double_weak(arg, &dval)) {
+ return 1;
}
- default:
- return 0;
}
+ /* We don't call cast_object here, because this check must be side-effect free. As this
+ * is only used for a sanity check of arginfo/zpp consistency, it's okay if we accept
+ * more than actually allowed here. */
+ if ((type_mask & MAY_BE_STRING) && (Z_TYPE_P(arg) < IS_STRING || Z_TYPE_P(arg) == IS_OBJECT)) {
+ return 1;
+ }
+ if ((type_mask & MAY_BE_BOOL) == MAY_BE_BOOL && zend_parse_arg_bool_weak(arg, &bval)) {
+ return 1;
+ }
+ return 0;
}
+#endif
-static zend_bool zend_verify_scalar_type_hint(zend_uchar type_hint, zval *arg, zend_bool strict)
+ZEND_API zend_bool zend_verify_scalar_type_hint(uint32_t type_mask, zval *arg, zend_bool strict, zend_bool is_internal_arg)
{
if (UNEXPECTED(strict)) {
/* SSTH Exception: IS_LONG may be accepted as IS_DOUBLE (converted) */
- if (type_hint != IS_DOUBLE || Z_TYPE_P(arg) != IS_LONG) {
+ if (!(type_mask & MAY_BE_DOUBLE) || Z_TYPE_P(arg) != IS_LONG) {
return 0;
}
} else if (UNEXPECTED(Z_TYPE_P(arg) == IS_NULL)) {
- /* NULL may be accepted only by nullable hints (this is already checked) */
- return 0;
+ /* NULL may be accepted only by nullable hints (this is already checked).
+ * As an exception for internal functions, null is allowed for scalar types in weak mode. */
+ return is_internal_arg
+ && (type_mask & (MAY_BE_TRUE|MAY_BE_FALSE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_STRING));
+ }
+#if ZEND_DEBUG
+ if (is_internal_arg) {
+ return zend_verify_weak_scalar_type_hint_no_sideeffect(type_mask, arg);
}
- return zend_verify_weak_scalar_type_hint(type_hint, arg);
+#endif
+ return zend_verify_weak_scalar_type_hint(type_mask, arg);
}
ZEND_COLD zend_never_inline void zend_verify_property_type_error(zend_property_info *info, zval *property)
{
- const char *prop_type1, *prop_type2;
+ zend_string *type_str;
/* we _may_ land here in case reading already errored and runtime cache thus has not been updated (i.e. it contains a valid but unrelated info) */
if (EG(exception)) {
return;
}
- // TODO Switch to a more standard error message?
- zend_format_type(info->type, &prop_type1, &prop_type2);
- (void) prop_type1;
- if (ZEND_TYPE_IS_CLASS(info->type)) {
- zend_type_error("Typed property %s::$%s must be an instance of %s%s, %s used",
- ZSTR_VAL(info->ce->name),
- zend_get_unmangled_property_name(info->name),
- prop_type2,
- ZEND_TYPE_ALLOW_NULL(info->type) ? " or null" : "",
- Z_TYPE_P(property) == IS_OBJECT ? ZSTR_VAL(Z_OBJCE_P(property)->name) : zend_get_type_by_const(Z_TYPE_P(property)));
- } else {
- zend_type_error("Typed property %s::$%s must be %s%s, %s used",
- ZSTR_VAL(info->ce->name),
- zend_get_unmangled_property_name(info->name),
- prop_type2,
- ZEND_TYPE_ALLOW_NULL(info->type) ? " or null" : "",
- Z_TYPE_P(property) == IS_OBJECT ? ZSTR_VAL(Z_OBJCE_P(property)->name) : zend_get_type_by_const(Z_TYPE_P(property)));
- }
+ type_str = zend_type_to_string(info->type);
+ zend_type_error("Cannot assign %s to property %s::$%s of type %s",
+ Z_TYPE_P(property) == IS_OBJECT ? ZSTR_VAL(Z_OBJCE_P(property)->name) : zend_get_type_by_const(Z_TYPE_P(property)),
+ ZSTR_VAL(info->ce->name),
+ zend_get_unmangled_property_name(info->name),
+ ZSTR_VAL(type_str));
+ zend_string_release(type_str);
}
-static zend_bool zend_resolve_class_type(zend_type *type, zend_class_entry *self_ce) {
- zend_class_entry *ce;
- zend_string *name = ZEND_TYPE_NAME(*type);
+static zend_class_entry *resolve_single_class_type(zend_string *name, zend_class_entry *self_ce) {
if (zend_string_equals_literal_ci(name, "self")) {
/* We need to explicitly check for this here, to avoid updating the type in the trait and
* later using the wrong "self" when the trait is used in a class. */
if (UNEXPECTED((self_ce->ce_flags & ZEND_ACC_TRAIT) != 0)) {
- zend_throw_error(NULL, "Cannot write a%s value to a 'self' typed static property of a trait", ZEND_TYPE_ALLOW_NULL(*type) ? " non-null" : "");
- return 0;
+ return NULL;
}
- ce = self_ce;
+ return self_ce;
} else if (zend_string_equals_literal_ci(name, "parent")) {
- if (UNEXPECTED(!self_ce->parent)) {
- zend_throw_error(NULL, "Cannot access parent:: when current class scope has no parent");
- return 0;
- }
- ce = self_ce->parent;
+ return self_ce->parent;
} else {
- ce = zend_lookup_class_ex(name, NULL, ZEND_FETCH_CLASS_NO_AUTOLOAD);
- if (UNEXPECTED(!ce)) {
- return 0;
- }
+ return zend_lookup_class_ex(name, NULL, ZEND_FETCH_CLASS_NO_AUTOLOAD);
}
-
- zend_string_release(name);
- *type = ZEND_TYPE_ENCODE_CE(ce, ZEND_TYPE_ALLOW_NULL(*type));
- return 1;
}
+static zend_bool zend_check_and_resolve_property_class_type(
+ zend_property_info *info, zend_class_entry *object_ce) {
+ zend_class_entry *ce;
+ if (ZEND_TYPE_HAS_LIST(info->type)) {
+ zend_type *list_type;
+ ZEND_TYPE_LIST_FOREACH(ZEND_TYPE_LIST(info->type), list_type) {
+ if (ZEND_TYPE_HAS_NAME(*list_type)) {
+ zend_string *name = ZEND_TYPE_NAME(*list_type);
+ ce = resolve_single_class_type(name, info->ce);
+ if (!ce) {
+ continue;
+ }
+ zend_string_release(name);
+ ZEND_TYPE_SET_CE(*list_type, ce);
+ } else {
+ ce = ZEND_TYPE_CE(*list_type);
+ }
+ if (instanceof_function(object_ce, ce)) {
+ return 1;
+ }
+ } ZEND_TYPE_LIST_FOREACH_END();
+ return 0;
+ } else {
+ if (UNEXPECTED(ZEND_TYPE_HAS_NAME(info->type))) {
+ zend_string *name = ZEND_TYPE_NAME(info->type);
+ ce = resolve_single_class_type(name, info->ce);
+ if (UNEXPECTED(!ce)) {
+ return 0;
+ }
+
+ zend_string_release(name);
+ ZEND_TYPE_SET_CE(info->type, ce);
+ } else {
+ ce = ZEND_TYPE_CE(info->type);
+ }
+ return instanceof_function(object_ce, ce);
+ }
+}
static zend_always_inline zend_bool i_zend_check_property_type(zend_property_info *info, zval *property, zend_bool strict)
{
ZEND_ASSERT(!Z_ISREF_P(property));
- if (ZEND_TYPE_IS_CLASS(info->type)) {
- if (UNEXPECTED(Z_TYPE_P(property) != IS_OBJECT)) {
- return Z_TYPE_P(property) == IS_NULL && ZEND_TYPE_ALLOW_NULL(info->type);
- }
-
- if (UNEXPECTED(!ZEND_TYPE_IS_CE(info->type)) && UNEXPECTED(!zend_resolve_class_type(&info->type, info->ce))) {
- return 0;
- }
-
- return instanceof_function(Z_OBJCE_P(property), ZEND_TYPE_CE(info->type));
+ if (EXPECTED(ZEND_TYPE_CONTAINS_CODE(info->type, Z_TYPE_P(property)))) {
+ return 1;
}
- ZEND_ASSERT(ZEND_TYPE_CODE(info->type) != IS_CALLABLE);
- if (EXPECTED(ZEND_TYPE_CODE(info->type) == Z_TYPE_P(property))) {
+ if (ZEND_TYPE_HAS_CLASS(info->type) && Z_TYPE_P(property) == IS_OBJECT
+ && zend_check_and_resolve_property_class_type(info, Z_OBJCE_P(property))) {
return 1;
- } else if (EXPECTED(Z_TYPE_P(property) == IS_NULL)) {
- return ZEND_TYPE_ALLOW_NULL(info->type);
- } else if (ZEND_TYPE_CODE(info->type) == _IS_BOOL && EXPECTED(Z_TYPE_P(property) == IS_FALSE || Z_TYPE_P(property) == IS_TRUE)) {
+ }
+
+ ZEND_ASSERT(!(ZEND_TYPE_FULL_MASK(info->type) & MAY_BE_CALLABLE));
+ if ((ZEND_TYPE_FULL_MASK(info->type) & MAY_BE_ITERABLE) && zend_is_iterable(property)) {
return 1;
- } else if (ZEND_TYPE_CODE(info->type) == IS_ITERABLE) {
- return zend_is_iterable(property);
- } else {
- return zend_verify_scalar_type_hint(ZEND_TYPE_CODE(info->type), property, strict);
}
+ return zend_verify_scalar_type_hint(ZEND_TYPE_FULL_MASK(info->type), property, strict, 0);
}
-static zend_bool zend_always_inline i_zend_verify_property_type(zend_property_info *info, zval *property, zend_bool strict)
+static zend_always_inline zend_bool i_zend_verify_property_type(zend_property_info *info, zval *property, zend_bool strict)
{
if (i_zend_check_property_type(info, property, strict)) {
return 1;
@@ -1008,140 +1024,181 @@ static zend_never_inline zval* zend_assign_to_typed_prop(zend_property_info *inf
return zend_assign_to_variable(property_val, &tmp, IS_TMP_VAR, EX_USES_STRICT_TYPES());
}
-
-static zend_always_inline zend_bool zend_check_type(
- zend_type type,
- zval *arg, zend_class_entry **ce, void **cache_slot,
- zval *default_value, zend_class_entry *scope,
- zend_bool is_return_type)
+static zend_always_inline zend_bool zend_check_type_slow(
+ zend_type type, zval *arg, zend_reference *ref, void **cache_slot, zend_class_entry *scope,
+ zend_bool is_return_type, zend_bool is_internal)
{
- zend_reference *ref = NULL;
-
- if (!ZEND_TYPE_IS_SET(type)) {
- return 1;
- }
-
- if (UNEXPECTED(Z_ISREF_P(arg))) {
- ref = Z_REF_P(arg);
- arg = Z_REFVAL_P(arg);
- }
-
- if (ZEND_TYPE_IS_CLASS(type)) {
- if (EXPECTED(*cache_slot)) {
- *ce = (zend_class_entry *) *cache_slot;
+ uint32_t type_mask;
+ if (ZEND_TYPE_HAS_CLASS(type) && Z_TYPE_P(arg) == IS_OBJECT) {
+ zend_class_entry *ce;
+ if (ZEND_TYPE_HAS_LIST(type)) {
+ zend_type *list_type;
+ ZEND_TYPE_LIST_FOREACH(ZEND_TYPE_LIST(type), list_type) {
+ if (*cache_slot) {
+ ce = *cache_slot;
+ } else {
+ ce = zend_fetch_class(ZEND_TYPE_NAME(*list_type),
+ (ZEND_FETCH_CLASS_AUTO | ZEND_FETCH_CLASS_NO_AUTOLOAD));
+ if (!ce) {
+ cache_slot++;
+ continue;
+ }
+ *cache_slot = ce;
+ }
+ if (instanceof_function(Z_OBJCE_P(arg), ce)) {
+ return 1;
+ }
+ cache_slot++;
+ } ZEND_TYPE_LIST_FOREACH_END();
} else {
- *ce = zend_fetch_class(ZEND_TYPE_NAME(type), (ZEND_FETCH_CLASS_AUTO | ZEND_FETCH_CLASS_NO_AUTOLOAD));
- if (UNEXPECTED(!*ce)) {
- return Z_TYPE_P(arg) == IS_NULL && (ZEND_TYPE_ALLOW_NULL(type) || (default_value && is_null_constant(scope, default_value)));
+ if (EXPECTED(*cache_slot)) {
+ ce = (zend_class_entry *) *cache_slot;
+ } else {
+ ce = zend_fetch_class(ZEND_TYPE_NAME(type), (ZEND_FETCH_CLASS_AUTO | ZEND_FETCH_CLASS_NO_AUTOLOAD));
+ if (UNEXPECTED(!ce)) {
+ goto builtin_types;
+ }
+ *cache_slot = (void *) ce;
+ }
+ if (instanceof_function(Z_OBJCE_P(arg), ce)) {
+ return 1;
}
- *cache_slot = (void *) *ce;
- }
- if (EXPECTED(Z_TYPE_P(arg) == IS_OBJECT)) {
- return instanceof_function(Z_OBJCE_P(arg), *ce);
}
- return Z_TYPE_P(arg) == IS_NULL && (ZEND_TYPE_ALLOW_NULL(type) || (default_value && is_null_constant(scope, default_value)));
- } else if (EXPECTED(ZEND_TYPE_CODE(type) == Z_TYPE_P(arg))) {
- return 1;
}
- if (Z_TYPE_P(arg) == IS_NULL && (ZEND_TYPE_ALLOW_NULL(type) || (default_value && is_null_constant(scope, default_value)))) {
- /* Null passed to nullable type */
+builtin_types:
+ type_mask = ZEND_TYPE_FULL_MASK(type);
+ if ((type_mask & MAY_BE_CALLABLE) && zend_is_callable(arg, IS_CALLABLE_CHECK_SILENT, NULL)) {
return 1;
}
-
- if (ZEND_TYPE_CODE(type) == IS_CALLABLE) {
- return zend_is_callable(arg, IS_CALLABLE_CHECK_SILENT, NULL);
- } else if (ZEND_TYPE_CODE(type) == IS_ITERABLE) {
- return zend_is_iterable(arg);
- } else if (ZEND_TYPE_CODE(type) == _IS_BOOL &&
- EXPECTED(Z_TYPE_P(arg) == IS_FALSE || Z_TYPE_P(arg) == IS_TRUE)) {
+ if ((type_mask & MAY_BE_ITERABLE) && zend_is_iterable(arg)) {
return 1;
- } else if (ref && ZEND_REF_HAS_TYPE_SOURCES(ref)) {
- return 0; /* we cannot have conversions for typed refs */
- } else {
- return zend_verify_scalar_type_hint(ZEND_TYPE_CODE(type), arg,
- is_return_type ? ZEND_RET_USES_STRICT_TYPES() : ZEND_ARG_USES_STRICT_TYPES());
}
+ if (ref && ZEND_REF_HAS_TYPE_SOURCES(ref)) {
+ /* We cannot have conversions for typed refs. */
+ return 0;
+ }
+ if (is_internal && is_return_type) {
+ /* For internal returns, the type has to match exactly, because we're not
+ * going to check it for non-debug builds, and there will be no chance to
+ * apply coercions. */
+ return 0;
+ }
+
+ return zend_verify_scalar_type_hint(type_mask, arg,
+ is_return_type ? ZEND_RET_USES_STRICT_TYPES() : ZEND_ARG_USES_STRICT_TYPES(),
+ is_internal);
/* Special handling for IS_VOID is not necessary (for return types),
* because this case is already checked at compile-time. */
}
-static zend_always_inline int zend_verify_arg_type(zend_function *zf, uint32_t arg_num, zval *arg, zval *default_value, void **cache_slot)
+static zend_always_inline zend_bool zend_check_type(
+ zend_type type, zval *arg, void **cache_slot, zend_class_entry *scope,
+ zend_bool is_return_type, zend_bool is_internal)
{
- zend_arg_info *cur_arg_info;
- zend_class_entry *ce;
+ zend_reference *ref = NULL;
+ ZEND_ASSERT(ZEND_TYPE_IS_SET(type));
- if (EXPECTED(arg_num <= zf->common.num_args)) {
- cur_arg_info = &zf->common.arg_info[arg_num-1];
- } else if (UNEXPECTED(zf->common.fn_flags & ZEND_ACC_VARIADIC)) {
- cur_arg_info = &zf->common.arg_info[zf->common.num_args];
- } else {
- return 1;
+ if (UNEXPECTED(Z_ISREF_P(arg))) {
+ ref = Z_REF_P(arg);
+ arg = Z_REFVAL_P(arg);
}
- ce = NULL;
- if (UNEXPECTED(!zend_check_type(cur_arg_info->type, arg, &ce, cache_slot, default_value, zf->common.scope, 0))) {
- zend_verify_arg_error(zf, cur_arg_info, arg_num, ce, arg);
- return 0;
+ if (EXPECTED(ZEND_TYPE_CONTAINS_CODE(type, Z_TYPE_P(arg)))) {
+ return 1;
}
- return 1;
+ return zend_check_type_slow(type, arg, ref, cache_slot, scope, is_return_type, is_internal);
}
-static zend_always_inline int zend_verify_recv_arg_type(zend_function *zf, uint32_t arg_num, zval *arg, zval *default_value, void **cache_slot)
+static zend_always_inline int zend_verify_recv_arg_type(zend_function *zf, uint32_t arg_num, zval *arg, void **cache_slot)
{
- zend_arg_info *cur_arg_info = &zf->common.arg_info[arg_num-1];
- zend_class_entry *ce;
+ zend_arg_info *cur_arg_info;
ZEND_ASSERT(arg_num <= zf->common.num_args);
cur_arg_info = &zf->common.arg_info[arg_num-1];
- ce = NULL;
- if (UNEXPECTED(!zend_check_type(cur_arg_info->type, arg, &ce, cache_slot, default_value, zf->common.scope, 0))) {
- zend_verify_arg_error(zf, cur_arg_info, arg_num, ce, arg);
+ if (ZEND_TYPE_IS_SET(cur_arg_info->type)
+ && UNEXPECTED(!zend_check_type(cur_arg_info->type, arg, cache_slot, zf->common.scope, 0, 0))) {
+ zend_verify_arg_error(zf, cur_arg_info, arg_num, cache_slot, arg);
return 0;
}
return 1;
}
-static zend_always_inline int zend_verify_variadic_arg_type(zend_function *zf, uint32_t arg_num, zval *arg, zval *default_value, void **cache_slot)
+static zend_always_inline int zend_verify_variadic_arg_type(zend_function *zf, uint32_t arg_num, zval *arg, void **cache_slot)
{
zend_arg_info *cur_arg_info;
- zend_class_entry *ce;
ZEND_ASSERT(arg_num > zf->common.num_args);
ZEND_ASSERT(zf->common.fn_flags & ZEND_ACC_VARIADIC);
cur_arg_info = &zf->common.arg_info[zf->common.num_args];
- ce = NULL;
- if (UNEXPECTED(!zend_check_type(cur_arg_info->type, arg, &ce, cache_slot, default_value, zf->common.scope, 0))) {
- zend_verify_arg_error(zf, cur_arg_info, arg_num, ce, arg);
+ if (ZEND_TYPE_IS_SET(cur_arg_info->type)
+ && UNEXPECTED(!zend_check_type(cur_arg_info->type, arg, cache_slot, zf->common.scope, 0, 0))) {
+ zend_verify_arg_error(zf, cur_arg_info, arg_num, cache_slot, arg);
return 0;
}
return 1;
}
-static zend_never_inline int zend_verify_internal_arg_types(zend_function *fbc, zend_execute_data *call)
+static zend_never_inline ZEND_ATTRIBUTE_UNUSED int zend_verify_internal_arg_types(zend_function *fbc, zend_execute_data *call)
{
uint32_t i;
uint32_t num_args = ZEND_CALL_NUM_ARGS(call);
- zval *p = ZEND_CALL_ARG(call, 1);
- void *dummy_cache_slot;
+ zval *arg = ZEND_CALL_ARG(call, 1);
for (i = 0; i < num_args; ++i) {
- dummy_cache_slot = NULL;
- if (UNEXPECTED(!zend_verify_arg_type(fbc, i + 1, p, NULL, &dummy_cache_slot))) {
- EG(current_execute_data) = call->prev_execute_data;
+ zend_arg_info *cur_arg_info;
+ void *dummy_cache_slot = NULL;
+
+ if (EXPECTED(i < fbc->common.num_args)) {
+ cur_arg_info = &fbc->common.arg_info[i];
+ } else if (UNEXPECTED(fbc->common.fn_flags & ZEND_ACC_VARIADIC)) {
+ cur_arg_info = &fbc->common.arg_info[fbc->common.num_args];
+ } else {
+ break;
+ }
+
+ if (ZEND_TYPE_IS_SET(cur_arg_info->type)
+ && UNEXPECTED(!zend_check_type(cur_arg_info->type, arg, &dummy_cache_slot, fbc->common.scope, 0, /* is_internal */ 1))) {
return 0;
}
- p++;
+ arg++;
}
return 1;
}
+#if ZEND_DEBUG
+/* Determine whether an internal call should throw, because the passed arguments violate
+ * an arginfo constraint. This is only checked in debug builds. In release builds, we
+ * trust that arginfo matches what is enforced by zend_parse_parameters. */
+static zend_always_inline zend_bool zend_internal_call_should_throw(zend_function *fbc, zend_execute_data *call)
+{
+ if (fbc->common.required_num_args > ZEND_CALL_NUM_ARGS(call)) {
+ return 1;
+ }
+
+ if ((fbc->common.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) &&
+ !zend_verify_internal_arg_types(fbc, call)) {
+ return 1;
+ }
+
+ return 0;
+}
+
+static ZEND_COLD void zend_internal_call_arginfo_violation(zend_function *fbc)
+{
+ zend_error(E_CORE_ERROR, "Arginfo / zpp mismatch during call of %s%s%s()",
+ fbc->common.scope ? ZSTR_VAL(fbc->common.scope->name) : "",
+ fbc->common.scope ? "::" : "",
+ ZSTR_VAL(fbc->common.function_name));
+}
+#endif
+
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_missing_arg_error(zend_execute_data *execute_data)
{
zend_execute_data *ptr = EX(prev_execute_data);
@@ -1167,35 +1224,39 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_missing_arg_error(zend_execute_data *
}
}
-static ZEND_COLD void zend_verify_return_error(
- const zend_function *zf, const zend_class_entry *ce, zval *value)
+ZEND_API ZEND_COLD void zend_verify_return_error(
+ const zend_function *zf, void **cache_slot, zval *value)
{
const zend_arg_info *arg_info = &zf->common.arg_info[-1];
const char *fname, *fsep, *fclass;
- const char *need_msg, *need_kind, *need_or_null, *given_msg, *given_kind;
+ zend_string *need_msg;
+ const char *given_msg, *given_kind;
zend_verify_type_error_common(
- zf, arg_info, ce, value,
- &fname, &fsep, &fclass, &need_msg, &need_kind, &need_or_null, &given_msg, &given_kind);
+ zf, arg_info, cache_slot, value,
+ &fname, &fsep, &fclass, &need_msg, &given_msg, &given_kind);
- zend_type_error("Return value of %s%s%s() must %s%s%s, %s%s returned",
- fclass, fsep, fname, need_msg, need_kind, need_or_null, given_msg, given_kind);
+ zend_type_error("Return value of %s%s%s() must %s, %s%s returned",
+ fclass, fsep, fname, ZSTR_VAL(need_msg), given_msg, given_kind);
+
+ zend_string_release(need_msg);
}
#if ZEND_DEBUG
static ZEND_COLD void zend_verify_internal_return_error(
- const zend_function *zf, const zend_class_entry *ce, zval *value)
+ const zend_function *zf, void **cache_slot, zval *value)
{
const zend_arg_info *arg_info = &zf->common.arg_info[-1];
const char *fname, *fsep, *fclass;
- const char *need_msg, *need_kind, *need_or_null, *given_msg, *given_kind;
+ zend_string *need_msg;
+ const char *given_msg, *given_kind;
zend_verify_type_error_common(
- zf, arg_info, ce, value,
- &fname, &fsep, &fclass, &need_msg, &need_kind, &need_or_null, &given_msg, &given_kind);
+ zf, arg_info, cache_slot, value,
+ &fname, &fsep, &fclass, &need_msg, &given_msg, &given_kind);
- zend_error_noreturn(E_CORE_ERROR, "Return value of %s%s%s() must %s%s%s, %s%s returned",
- fclass, fsep, fname, need_msg, need_kind, need_or_null, given_msg, given_kind);
+ zend_error_noreturn(E_CORE_ERROR, "Return value of %s%s%s() must %s, %s%s returned",
+ fclass, fsep, fname, ZSTR_VAL(need_msg), given_msg, given_kind);
}
static ZEND_COLD void zend_verify_void_return_error(const zend_function *zf, const char *returned_msg, const char *returned_kind)
@@ -1219,10 +1280,9 @@ static ZEND_COLD void zend_verify_void_return_error(const zend_function *zf, con
static int zend_verify_internal_return_type(zend_function *zf, zval *ret)
{
zend_internal_arg_info *ret_info = zf->internal_function.arg_info - 1;
- zend_class_entry *ce = NULL;
void *dummy_cache_slot = NULL;
- if (ZEND_TYPE_CODE(ret_info->type) == IS_VOID) {
+ if (ZEND_TYPE_FULL_MASK(ret_info->type) & MAY_BE_VOID) {
if (UNEXPECTED(Z_TYPE_P(ret) != IS_NULL)) {
zend_verify_void_return_error(zf, zend_zval_type_name(ret), "");
return 0;
@@ -1230,8 +1290,8 @@ static int zend_verify_internal_return_type(zend_function *zf, zval *ret)
return 1;
}
- if (UNEXPECTED(!zend_check_type(ret_info->type, ret, &ce, &dummy_cache_slot, NULL, NULL, 1))) {
- zend_verify_internal_return_error(zf, ce, ret);
+ if (UNEXPECTED(!zend_check_type(ret_info->type, ret, &dummy_cache_slot, NULL, 1, /* is_internal */ 1))) {
+ zend_verify_internal_return_error(zf, &dummy_cache_slot, ret);
return 0;
}
@@ -1239,36 +1299,11 @@ static int zend_verify_internal_return_type(zend_function *zf, zval *ret)
}
#endif
-static zend_always_inline void zend_verify_return_type(zend_function *zf, zval *ret, void **cache_slot)
-{
- zend_arg_info *ret_info = zf->common.arg_info - 1;
- zend_class_entry *ce = NULL;
-
- if (UNEXPECTED(!zend_check_type(ret_info->type, ret, &ce, cache_slot, NULL, NULL, 1))) {
- zend_verify_return_error(zf, ce, ret);
- }
-}
-
static ZEND_COLD int zend_verify_missing_return_type(const zend_function *zf, void **cache_slot)
{
- zend_arg_info *ret_info = zf->common.arg_info - 1;
-
- if (ZEND_TYPE_IS_SET(ret_info->type) && UNEXPECTED(ZEND_TYPE_CODE(ret_info->type) != IS_VOID)) {
- zend_class_entry *ce = NULL;
- if (ZEND_TYPE_IS_CLASS(ret_info->type)) {
- if (EXPECTED(*cache_slot)) {
- ce = (zend_class_entry*) *cache_slot;
- } else {
- ce = zend_fetch_class(ZEND_TYPE_NAME(ret_info->type), (ZEND_FETCH_CLASS_AUTO | ZEND_FETCH_CLASS_NO_AUTOLOAD));
- if (ce) {
- *cache_slot = (void*)ce;
- }
- }
- }
- zend_verify_return_error(zf, ce, NULL);
- return 0;
- }
- return 1;
+ /* VERIFY_RETURN_TYPE is not emitted for "void" functions, so this is always an error. */
+ zend_verify_return_error(zf, cache_slot, NULL);
+ return 0;
}
static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_use_object_as_array(void)
@@ -1278,12 +1313,12 @@ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_use_object_as_array(v
static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_illegal_offset(void)
{
- zend_error(E_WARNING, "Illegal offset type");
+ zend_type_error("Illegal offset type");
}
static zend_never_inline void zend_assign_to_object_dim(zval *object, zval *dim, zval *value OPLINE_DC EXECUTE_DATA_DC)
{
- Z_OBJ_HT_P(object)->write_dimension(object, dim, value);
+ Z_OBJ_HT_P(object)->write_dimension(Z_OBJ_P(object), dim, value);
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), value);
@@ -1314,25 +1349,15 @@ static zend_always_inline int zend_binary_op(zval *ret, zval *op1, zval *op2 OPL
static zend_never_inline void zend_binary_assign_op_obj_dim(zval *object, zval *property OPLINE_DC EXECUTE_DATA_DC)
{
- zend_free_op free_op_data1;
zval *value;
zval *z;
zval rv, res;
- value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data1);
- if ((z = Z_OBJ_HT_P(object)->read_dimension(object, property, BP_VAR_R, &rv)) != NULL) {
+ value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1);
+ if ((z = Z_OBJ_HT_P(object)->read_dimension(Z_OBJ_P(object), property, BP_VAR_R, &rv)) != NULL) {
- if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) {
- zval rv2;
- zval *value = Z_OBJ_HT_P(z)->get(z, &rv2);
-
- if (z == &rv) {
- zval_ptr_dtor(&rv);
- }
- ZVAL_COPY_VALUE(z, value);
- }
if (zend_binary_op(&res, z, value OPLINE_CC) == SUCCESS) {
- Z_OBJ_HT_P(object)->write_dimension(object, property, &res);
+ Z_OBJ_HT_P(object)->write_dimension(Z_OBJ_P(object), property, &res);
}
if (z == &rv) {
zval_ptr_dtor(&rv);
@@ -1347,7 +1372,7 @@ static zend_never_inline void zend_binary_assign_op_obj_dim(zval *object, zval *
ZVAL_NULL(EX_VAR(opline->result.var));
}
}
- FREE_OP(free_op_data1);
+ FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
}
static zend_never_inline void zend_binary_assign_op_typed_ref(zend_reference *ref, zval *value OPLINE_DC EXECUTE_DATA_DC)
@@ -1397,7 +1422,7 @@ try_again:
case IS_NULL:
case IS_FALSE:
case IS_TRUE:
- zend_error(E_NOTICE, "String offset cast occurred");
+ zend_error(E_WARNING, "String offset cast occurred");
break;
case IS_REFERENCE:
dim = Z_REFVAL_P(dim);
@@ -1527,7 +1552,7 @@ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_wrong_property_read(z
{
zend_string *tmp_property_name;
zend_string *property_name = zval_get_tmp_string(property, &tmp_property_name);
- zend_error(E_NOTICE, "Trying to get property '%s' of non-object", ZSTR_VAL(property_name));
+ zend_error(E_WARNING, "Trying to get property '%s' of non-object", ZSTR_VAL(property_name));
zend_tmp_string_release(tmp_property_name);
}
@@ -1539,12 +1564,6 @@ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_deprecated_function(c
ZSTR_VAL(fbc->common.function_name));
}
-static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_abstract_method(const zend_function *fbc)
-{
- zend_throw_error(NULL, "Cannot call abstract method %s::%s()",
- ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
-}
-
static zend_never_inline void zend_assign_to_string_offset(zval *str, zval *dim, zval *value OPLINE_DC EXECUTE_DATA_DC)
{
zend_uchar c;
@@ -1579,13 +1598,17 @@ static zend_never_inline void zend_assign_to_string_offset(zval *str, zval *dim,
c = (zend_uchar)Z_STRVAL_P(value)[0];
}
- if (string_len == 0) {
- /* Error on empty input string */
- zend_error(E_WARNING, "Cannot assign an empty string to a string offset");
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
+ if (string_len != 1) {
+ if (string_len == 0) {
+ /* Error on empty input string */
+ zend_throw_error(NULL, "Cannot assign an empty string to a string offset");
+ if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ }
+ return;
}
- return;
+
+ zend_error(E_WARNING, "Only the first byte will be assigned to the string offset");
}
if (offset < 0) { /* Handle negative offset */
@@ -1619,50 +1642,51 @@ static zend_property_info *zend_get_prop_not_accepting_double(zend_reference *re
{
zend_property_info *prop;
ZEND_REF_FOREACH_TYPE_SOURCES(ref, prop) {
- if (ZEND_TYPE_CODE(prop->type) != IS_DOUBLE) {
+ if (!(ZEND_TYPE_FULL_MASK(prop->type) & MAY_BE_DOUBLE)) {
return prop;
}
} ZEND_REF_FOREACH_TYPE_SOURCES_END();
return NULL;
}
-static ZEND_COLD zend_long zend_throw_incdec_ref_error(zend_reference *ref OPLINE_DC)
+static ZEND_COLD zend_long zend_throw_incdec_ref_error(
+ zend_reference *ref, zend_property_info *error_prop OPLINE_DC)
{
- zend_property_info *error_prop = zend_get_prop_not_accepting_double(ref);
- /* Currently there should be no way for a typed reference to accept both int and double.
- * Generalize this and the related property code once this becomes possible. */
- ZEND_ASSERT(error_prop);
+ zend_string *type_str = zend_type_to_string(error_prop->type);
if (ZEND_IS_INCREMENT(opline->opcode)) {
zend_type_error(
- "Cannot increment a reference held by property %s::$%s of type %sint past its maximal value",
+ "Cannot increment a reference held by property %s::$%s of type %s past its maximal value",
ZSTR_VAL(error_prop->ce->name),
zend_get_unmangled_property_name(error_prop->name),
- ZEND_TYPE_ALLOW_NULL(error_prop->type) ? "?" : "");
+ ZSTR_VAL(type_str));
+ zend_string_release(type_str);
return ZEND_LONG_MAX;
} else {
zend_type_error(
- "Cannot decrement a reference held by property %s::$%s of type %sint past its minimal value",
+ "Cannot decrement a reference held by property %s::$%s of type %s past its minimal value",
ZSTR_VAL(error_prop->ce->name),
zend_get_unmangled_property_name(error_prop->name),
- ZEND_TYPE_ALLOW_NULL(error_prop->type) ? "?" : "");
+ ZSTR_VAL(type_str));
+ zend_string_release(type_str);
return ZEND_LONG_MIN;
}
}
static ZEND_COLD zend_long zend_throw_incdec_prop_error(zend_property_info *prop OPLINE_DC) {
- const char *prop_type1, *prop_type2;
- zend_format_type(prop->type, &prop_type1, &prop_type2);
+ zend_string *type_str = zend_type_to_string(prop->type);
if (ZEND_IS_INCREMENT(opline->opcode)) {
- zend_type_error("Cannot increment property %s::$%s of type %s%s past its maximal value",
+ zend_type_error("Cannot increment property %s::$%s of type %s past its maximal value",
ZSTR_VAL(prop->ce->name),
zend_get_unmangled_property_name(prop->name),
- prop_type1, prop_type2);
+ ZSTR_VAL(type_str));
+ zend_string_release(type_str);
return ZEND_LONG_MAX;
} else {
- zend_type_error("Cannot decrement property %s::$%s of type %s%s past its minimal value",
+ zend_type_error("Cannot decrement property %s::$%s of type %s past its minimal value",
ZSTR_VAL(prop->ce->name),
zend_get_unmangled_property_name(prop->name),
- prop_type1, prop_type2);
+ ZSTR_VAL(type_str));
+ zend_string_release(type_str);
return ZEND_LONG_MIN;
}
}
@@ -1685,8 +1709,11 @@ static void zend_incdec_typed_ref(zend_reference *ref, zval *copy OPLINE_DC EXEC
}
if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_DOUBLE) && Z_TYPE_P(copy) == IS_LONG) {
- zend_long val = zend_throw_incdec_ref_error(ref OPLINE_CC);
- ZVAL_LONG(var_ptr, val);
+ zend_property_info *error_prop = zend_get_prop_not_accepting_double(ref);
+ if (UNEXPECTED(error_prop)) {
+ zend_long val = zend_throw_incdec_ref_error(ref, error_prop OPLINE_CC);
+ ZVAL_LONG(var_ptr, val);
+ }
} else if (UNEXPECTED(!zend_verify_ref_assignable_zval(ref, var_ptr, EX_USES_STRICT_TYPES()))) {
zval_ptr_dtor(var_ptr);
ZVAL_COPY_VALUE(var_ptr, copy);
@@ -1713,8 +1740,10 @@ static void zend_incdec_typed_prop(zend_property_info *prop_info, zval *var_ptr,
}
if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_DOUBLE) && Z_TYPE_P(copy) == IS_LONG) {
- zend_long val = zend_throw_incdec_prop_error(prop_info OPLINE_CC);
- ZVAL_LONG(var_ptr, val);
+ if (!(ZEND_TYPE_FULL_MASK(prop_info->type) & MAY_BE_DOUBLE)) {
+ zend_long val = zend_throw_incdec_prop_error(prop_info OPLINE_CC);
+ ZVAL_LONG(var_ptr, val);
+ }
} else if (UNEXPECTED(!zend_verify_property_type(prop_info, var_ptr, EX_USES_STRICT_TYPES()))) {
zval_ptr_dtor(var_ptr);
ZVAL_COPY_VALUE(var_ptr, copy);
@@ -1732,7 +1761,8 @@ static void zend_pre_incdec_property_zval(zval *prop, zend_property_info *prop_i
} else {
fast_long_decrement_function(prop);
}
- if (UNEXPECTED(Z_TYPE_P(prop) != IS_LONG) && UNEXPECTED(prop_info)) {
+ if (UNEXPECTED(Z_TYPE_P(prop) != IS_LONG) && UNEXPECTED(prop_info)
+ && !(ZEND_TYPE_FULL_MASK(prop_info->type) & MAY_BE_DOUBLE)) {
zend_long val = zend_throw_incdec_prop_error(prop_info OPLINE_CC);
ZVAL_LONG(prop, val);
}
@@ -1770,7 +1800,8 @@ static void zend_post_incdec_property_zval(zval *prop, zend_property_info *prop_
} else {
fast_long_decrement_function(prop);
}
- if (UNEXPECTED(Z_TYPE_P(prop) != IS_LONG) && UNEXPECTED(prop_info)) {
+ if (UNEXPECTED(Z_TYPE_P(prop) != IS_LONG) && UNEXPECTED(prop_info)
+ && !(ZEND_TYPE_FULL_MASK(prop_info->type) & MAY_BE_DOUBLE)) {
zend_long val = zend_throw_incdec_prop_error(prop_info OPLINE_CC);
ZVAL_LONG(prop, val);
}
@@ -1797,30 +1828,20 @@ static void zend_post_incdec_property_zval(zval *prop, zend_property_info *prop_
}
}
-static zend_never_inline void zend_post_incdec_overloaded_property(zval *object, zval *property, void **cache_slot OPLINE_DC EXECUTE_DATA_DC)
+static zend_never_inline void zend_post_incdec_overloaded_property(zend_object *object, zend_string *name, void **cache_slot OPLINE_DC EXECUTE_DATA_DC)
{
- zval rv, obj;
+ zval rv;
zval *z;
zval z_copy;
- ZVAL_OBJ(&obj, Z_OBJ_P(object));
- Z_ADDREF(obj);
- z = Z_OBJ_HT(obj)->read_property(&obj, property, BP_VAR_R, cache_slot, &rv);
+ GC_ADDREF(object);
+ z =object->handlers->read_property(object, name, BP_VAR_R, cache_slot, &rv);
if (UNEXPECTED(EG(exception))) {
- OBJ_RELEASE(Z_OBJ(obj));
+ OBJ_RELEASE(object);
ZVAL_UNDEF(EX_VAR(opline->result.var));
return;
}
- if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
- zval rv2;
- zval *value = Z_OBJ_HT_P(z)->get(z, &rv2);
- if (z == &rv) {
- zval_ptr_dtor(&rv);
- }
- ZVAL_COPY_VALUE(z, value);
- }
-
ZVAL_COPY_DEREF(&z_copy, z);
ZVAL_COPY(EX_VAR(opline->result.var), &z_copy);
if (ZEND_IS_INCREMENT(opline->opcode)) {
@@ -1828,38 +1849,28 @@ static zend_never_inline void zend_post_incdec_overloaded_property(zval *object,
} else {
decrement_function(&z_copy);
}
- Z_OBJ_HT(obj)->write_property(&obj, property, &z_copy, cache_slot);
- OBJ_RELEASE(Z_OBJ(obj));
+ object->handlers->write_property(object, name, &z_copy, cache_slot);
+ OBJ_RELEASE(object);
zval_ptr_dtor(&z_copy);
zval_ptr_dtor(z);
}
-static zend_never_inline void zend_pre_incdec_overloaded_property(zval *object, zval *property, void **cache_slot OPLINE_DC EXECUTE_DATA_DC)
+static zend_never_inline void zend_pre_incdec_overloaded_property(zend_object *object, zend_string *name, void **cache_slot OPLINE_DC EXECUTE_DATA_DC)
{
zval rv;
- zval *z, obj;
+ zval *z;
zval z_copy;
- ZVAL_OBJ(&obj, Z_OBJ_P(object));
- Z_ADDREF(obj);
- z = Z_OBJ_HT(obj)->read_property(&obj, property, BP_VAR_R, cache_slot, &rv);
+ GC_ADDREF(object);
+ z = object->handlers->read_property(object, name, BP_VAR_R, cache_slot, &rv);
if (UNEXPECTED(EG(exception))) {
- OBJ_RELEASE(Z_OBJ(obj));
+ OBJ_RELEASE(object);
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
}
return;
}
- if (UNEXPECTED(Z_TYPE_P(z) == IS_OBJECT) && Z_OBJ_HT_P(z)->get) {
- zval rv2;
- zval *value = Z_OBJ_HT_P(z)->get(z, &rv2);
-
- if (z == &rv) {
- zval_ptr_dtor(&rv);
- }
- ZVAL_COPY_VALUE(z, value);
- }
ZVAL_COPY_DEREF(&z_copy, z);
if (ZEND_IS_INCREMENT(opline->opcode)) {
increment_function(&z_copy);
@@ -1869,45 +1880,35 @@ static zend_never_inline void zend_pre_incdec_overloaded_property(zval *object,
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), &z_copy);
}
- Z_OBJ_HT(obj)->write_property(&obj, property, &z_copy, cache_slot);
- OBJ_RELEASE(Z_OBJ(obj));
+ object->handlers->write_property(object, name, &z_copy, cache_slot);
+ OBJ_RELEASE(object);
zval_ptr_dtor(&z_copy);
zval_ptr_dtor(z);
}
-static zend_never_inline void zend_assign_op_overloaded_property(zval *object, zval *property, void **cache_slot, zval *value OPLINE_DC EXECUTE_DATA_DC)
+static zend_never_inline void zend_assign_op_overloaded_property(zend_object *object, zend_string *name, void **cache_slot, zval *value OPLINE_DC EXECUTE_DATA_DC)
{
zval *z;
- zval rv, obj, res;
+ zval rv, res;
- ZVAL_OBJ(&obj, Z_OBJ_P(object));
- Z_ADDREF(obj);
- z = Z_OBJ_HT(obj)->read_property(&obj, property, BP_VAR_R, cache_slot, &rv);
+ GC_ADDREF(object);
+ z = object->handlers->read_property(object, name, BP_VAR_R, cache_slot, &rv);
if (UNEXPECTED(EG(exception))) {
- OBJ_RELEASE(Z_OBJ(obj));
+ OBJ_RELEASE(object);
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_UNDEF(EX_VAR(opline->result.var));
}
return;
}
- if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) {
- zval rv2;
- zval *value = Z_OBJ_HT_P(z)->get(z, &rv2);
-
- if (z == &rv) {
- zval_ptr_dtor(&rv);
- }
- ZVAL_COPY_VALUE(z, value);
- }
if (zend_binary_op(&res, z, value OPLINE_CC) == SUCCESS) {
- Z_OBJ_HT(obj)->write_property(&obj, property, &res, cache_slot);
+ object->handlers->write_property(object, name, &res, cache_slot);
}
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), &res);
}
zval_ptr_dtor(z);
zval_ptr_dtor(&res);
- OBJ_RELEASE(Z_OBJ(obj));
+ OBJ_RELEASE(object);
}
/* Utility Functions for Extensions */
@@ -1973,16 +1974,10 @@ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_invalid_method_call(z
static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_non_static_method_call(const zend_function *fbc)
{
- if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
- zend_error(E_DEPRECATED,
- "Non-static method %s::%s() should not be called statically",
- ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
- } else {
- zend_throw_error(
- zend_ce_error,
- "Non-static method %s::%s() cannot be called statically",
- ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
- }
+ zend_throw_error(
+ zend_ce_error,
+ "Non-static method %s::%s() cannot be called statically",
+ ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
}
static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_param_must_be_ref(const zend_function *func, uint32_t arg_num)
@@ -1996,17 +1991,17 @@ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_param_must_be_ref(con
static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_use_scalar_as_array(void)
{
- zend_error(E_WARNING, "Cannot use a scalar value as an array");
+ zend_throw_error(NULL, "Cannot use a scalar value as an array");
}
static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_cannot_add_element(void)
{
- zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
+ zend_throw_error(NULL, "Cannot add element to the array as the next element is already occupied");
}
static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_use_resource_as_offset(const zval *dim)
{
- zend_error(E_NOTICE, "Resource ID#%d used as offset, casting to integer (%d)", Z_RES_HANDLE_P(dim), Z_RES_HANDLE_P(dim));
+ zend_error(E_WARNING, "Resource ID#%d used as offset, casting to integer (%d)", Z_RES_HANDLE_P(dim), Z_RES_HANDLE_P(dim));
}
static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_use_new_element_for_string(void)
@@ -2016,8 +2011,6 @@ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_use_new_element_for_s
static ZEND_COLD void zend_binary_assign_op_dim_slow(zval *container, zval *dim OPLINE_DC EXECUTE_DATA_DC)
{
- zend_free_op free_op_data1;
-
if (UNEXPECTED(Z_TYPE_P(container) == IS_STRING)) {
if (opline->op2_type == IS_UNUSED) {
zend_use_new_element_for_string();
@@ -2025,11 +2018,10 @@ static ZEND_COLD void zend_binary_assign_op_dim_slow(zval *container, zval *dim
zend_check_string_offset(dim, BP_VAR_RW EXECUTE_DATA_CC);
zend_wrong_string_offset(EXECUTE_DATA_C);
}
- } else if (EXPECTED(!Z_ISERROR_P(container))) {
+ } else {
zend_use_scalar_as_array();
}
- get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data1);
- FREE_OP(free_op_data1);
+ FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
}
static zend_never_inline zend_uchar slow_index_convert(const zval *dim, zend_value *value EXECUTE_DATA_DC)
@@ -2191,13 +2183,13 @@ fetch_from_array:
retval = zend_hash_next_index_insert(Z_ARRVAL_P(container), &EG(uninitialized_zval));
if (UNEXPECTED(retval == NULL)) {
zend_cannot_add_element();
- ZVAL_ERROR(result);
+ ZVAL_UNDEF(result);
return;
}
} else {
retval = zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), dim, dim_type, type EXECUTE_DATA_CC);
if (UNEXPECTED(!retval)) {
- ZVAL_ERROR(result);
+ ZVAL_UNDEF(result);
return;
}
}
@@ -2212,7 +2204,7 @@ fetch_from_array:
if (type != BP_VAR_UNSET) {
if (ZEND_REF_HAS_TYPE_SOURCES(ref)) {
if (UNEXPECTED(!zend_verify_ref_array_assignable(ref))) {
- ZVAL_ERROR(result);
+ ZVAL_UNDEF(result);
return;
}
}
@@ -2230,7 +2222,7 @@ fetch_from_array:
zend_check_string_offset(dim, type EXECUTE_DATA_CC);
zend_wrong_string_offset(EXECUTE_DATA_C);
}
- ZVAL_ERROR(result);
+ ZVAL_UNDEF(result);
} else if (EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
if (ZEND_CONST_COND(dim_type == IS_CV, dim != NULL) && UNEXPECTED(Z_TYPE_P(dim) == IS_UNDEF)) {
dim = ZVAL_UNDEFINED_OP2();
@@ -2238,7 +2230,7 @@ fetch_from_array:
if (dim_type == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
dim++;
}
- retval = Z_OBJ_HT_P(container)->read_dimension(container, dim, type, result);
+ retval = Z_OBJ_HT_P(container)->read_dimension(Z_OBJ_P(container), dim, type, result);
if (UNEXPECTED(retval == &EG(uninitialized_zval))) {
zend_class_entry *ce = Z_OBJCE_P(container);
@@ -2262,7 +2254,8 @@ fetch_from_array:
ZVAL_INDIRECT(result, retval);
}
} else {
- ZVAL_ERROR(result);
+ ZEND_ASSERT(EG(exception) && "read_dimension() returned NULL without exception");
+ ZVAL_UNDEF(result);
}
} else {
if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
@@ -2280,15 +2273,13 @@ return_null:
}
ZVAL_NULL(result);
}
- } else if (EXPECTED(Z_ISERROR_P(container))) {
- ZVAL_ERROR(result);
} else {
if (type == BP_VAR_UNSET) {
- zend_error(E_WARNING, "Cannot unset offset in a non-array variable");
- ZVAL_NULL(result);
+ zend_throw_error(NULL, "Cannot unset offset in a non-array variable");
+ ZVAL_UNDEF(result);
} else {
zend_use_scalar_as_array();
- ZVAL_ERROR(result);
+ ZVAL_UNDEF(result);
}
}
}
@@ -2353,7 +2344,7 @@ try_string_offset:
case IS_FALSE:
case IS_TRUE:
if (type != BP_VAR_IS) {
- zend_error(E_NOTICE, "String offset cast occurred");
+ zend_error(E_WARNING, "String offset cast occurred");
}
break;
case IS_REFERENCE:
@@ -2371,7 +2362,7 @@ try_string_offset:
if (UNEXPECTED(Z_STRLEN_P(container) < ((offset < 0) ? -(size_t)offset : ((size_t)offset + 1)))) {
if (type != BP_VAR_IS) {
- zend_error(E_NOTICE, "Uninitialized string offset: " ZEND_LONG_FMT, offset);
+ zend_error(E_WARNING, "Uninitialized string offset: " ZEND_LONG_FMT, offset);
ZVAL_EMPTY_STRING(result);
} else {
ZVAL_NULL(result);
@@ -2393,7 +2384,7 @@ try_string_offset:
if (dim_type == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
dim++;
}
- retval = Z_OBJ_HT_P(container)->read_dimension(container, dim, type, result);
+ retval = Z_OBJ_HT_P(container)->read_dimension(Z_OBJ_P(container), dim, type, result);
ZEND_ASSERT(result != NULL);
if (retval) {
@@ -2413,7 +2404,7 @@ try_string_offset:
ZVAL_UNDEFINED_OP2();
}
if (!is_list && type != BP_VAR_IS) {
- zend_error(E_NOTICE, "Trying to access array offset on value of type %s",
+ zend_error(E_WARNING, "Trying to access array offset on value of type %s",
zend_zval_type_name(container));
}
ZVAL_NULL(result);
@@ -2467,13 +2458,14 @@ str_idx:
hval = 1;
goto num_idx;
} else if (Z_TYPE_P(offset) == IS_RESOURCE) {
+ zend_use_resource_as_offset(offset);
hval = Z_RES_HANDLE_P(offset);
goto num_idx;
} else if (/*OP2_TYPE == IS_CV &&*/ Z_TYPE_P(offset) == IS_UNDEF) {
ZVAL_UNDEFINED_OP2();
goto str_idx;
} else {
- zend_error(E_WARNING, "Illegal offset type in isset or empty");
+ zend_type_error("Illegal offset type in isset or empty");
return NULL;
}
}
@@ -2485,7 +2477,7 @@ static zend_never_inline int ZEND_FASTCALL zend_isset_dim_slow(zval *container,
}
if (/*OP1_TYPE != IS_CONST &&*/ EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
- return Z_OBJ_HT_P(container)->has_dimension(container, offset, 0);
+ return Z_OBJ_HT_P(container)->has_dimension(Z_OBJ_P(container), offset, 0);
} else if (EXPECTED(Z_TYPE_P(container) == IS_STRING)) { /* string offsets */
zend_long lval;
@@ -2524,7 +2516,7 @@ static zend_never_inline int ZEND_FASTCALL zend_isempty_dim_slow(zval *container
}
if (/*OP1_TYPE != IS_CONST &&*/ EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
- return !Z_OBJ_HT_P(container)->has_dimension(container, offset, 1);
+ return !Z_OBJ_HT_P(container)->has_dimension(Z_OBJ_P(container), offset, 1);
} else if (EXPECTED(Z_TYPE_P(container) == IS_STRING)) { /* string offsets */
zend_long lval;
@@ -2556,7 +2548,7 @@ str_offset:
}
}
-static zend_never_inline uint32_t ZEND_FASTCALL zend_array_key_exists_fast(HashTable *ht, zval *key OPLINE_DC EXECUTE_DATA_DC)
+static zend_never_inline zend_bool ZEND_FASTCALL zend_array_key_exists_fast(HashTable *ht, zval *key OPLINE_DC EXECUTE_DATA_DC)
{
zend_string *str;
zend_ulong hval;
@@ -2568,14 +2560,27 @@ try_again:
goto num_key;
}
str_key:
- return zend_hash_find_ind(ht, str) != NULL ? IS_TRUE : IS_FALSE;
+ return zend_hash_find_ind(ht, str) != NULL;
} else if (EXPECTED(Z_TYPE_P(key) == IS_LONG)) {
hval = Z_LVAL_P(key);
num_key:
- return zend_hash_index_find(ht, hval) != NULL ? IS_TRUE : IS_FALSE;
+ return zend_hash_index_find(ht, hval) != NULL;
} else if (EXPECTED(Z_ISREF_P(key))) {
key = Z_REFVAL_P(key);
goto try_again;
+ } else if (Z_TYPE_P(key) == IS_DOUBLE) {
+ hval = zend_dval_to_lval(Z_DVAL_P(key));
+ goto num_key;
+ } else if (Z_TYPE_P(key) == IS_FALSE) {
+ hval = 0;
+ goto num_key;
+ } else if (Z_TYPE_P(key) == IS_TRUE) {
+ hval = 1;
+ goto num_key;
+ } else if (Z_TYPE_P(key) == IS_RESOURCE) {
+ zend_use_resource_as_offset(key);
+ hval = Z_RES_HANDLE_P(key);
+ goto num_key;
} else if (Z_TYPE_P(key) <= IS_NULL) {
if (UNEXPECTED(Z_TYPE_P(key) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
@@ -2583,31 +2588,23 @@ num_key:
str = ZSTR_EMPTY_ALLOC();
goto str_key;
} else {
- zend_error(E_WARNING, "array_key_exists(): The first argument should be either a string or an integer");
- return IS_FALSE;
+ zend_type_error("Illegal offset type");
+ return 0;
}
}
-static zend_never_inline uint32_t ZEND_FASTCALL zend_array_key_exists_slow(zval *subject, zval *key OPLINE_DC EXECUTE_DATA_DC)
+static ZEND_COLD void ZEND_FASTCALL zend_array_key_exists_error(
+ zval *subject, zval *key OPLINE_DC EXECUTE_DATA_DC)
{
- if (EXPECTED(Z_TYPE_P(subject) == IS_OBJECT)) {
- zend_error(E_DEPRECATED, "array_key_exists(): "
- "Using array_key_exists() on objects is deprecated. "
- "Use isset() or property_exists() instead");
-
- HashTable *ht = zend_get_properties_for(subject, ZEND_PROP_PURPOSE_ARRAY_CAST);
- uint32_t result = zend_array_key_exists_fast(ht, key OPLINE_CC EXECUTE_DATA_CC);
- zend_release_properties(ht);
- return result;
- } else {
- if (UNEXPECTED(Z_TYPE_P(key) == IS_UNDEF)) {
- ZVAL_UNDEFINED_OP1();
- }
- if (UNEXPECTED(Z_TYPE_INFO_P(subject) == IS_UNDEF)) {
- ZVAL_UNDEFINED_OP2();
- }
- zend_internal_type_error(EX_USES_STRICT_TYPES(), "array_key_exists() expects parameter 2 to be array, %s given", zend_get_type_by_const(Z_TYPE_P(subject)));
- return IS_NULL;
+ if (Z_TYPE_P(key) == IS_UNDEF) {
+ ZVAL_UNDEFINED_OP1();
+ }
+ if (Z_TYPE_P(subject) == IS_UNDEF) {
+ ZVAL_UNDEFINED_OP2();
+ }
+ if (!EG(exception)) {
+ zend_type_error("array_key_exists() expects parameter 2 to be array, %s given",
+ zend_get_type_by_const(Z_TYPE_P(subject)));
}
}
@@ -2616,38 +2613,15 @@ static zend_always_inline zend_bool promotes_to_array(zval *val) {
|| (Z_ISREF_P(val) && Z_TYPE_P(Z_REFVAL_P(val)) <= IS_FALSE);
}
-static zend_always_inline zend_bool promotes_to_object(zval *val) {
- ZVAL_DEREF(val);
- return Z_TYPE_P(val) <= IS_FALSE
- || (Z_TYPE_P(val) == IS_STRING && Z_STRLEN_P(val) == 0);
-}
-
static zend_always_inline zend_bool check_type_array_assignable(zend_type type) {
- if (!type) {
+ if (!ZEND_TYPE_IS_SET(type)) {
return 1;
}
- return ZEND_TYPE_IS_CODE(type)
- && (ZEND_TYPE_CODE(type) == IS_ARRAY || ZEND_TYPE_CODE(type) == IS_ITERABLE);
+ return (ZEND_TYPE_FULL_MASK(type) & (MAY_BE_ITERABLE|MAY_BE_ARRAY)) != 0;
}
-static zend_always_inline zend_bool check_type_stdClass_assignable(zend_type type) {
- if (!type) {
- return 1;
- }
- if (ZEND_TYPE_IS_CLASS(type)) {
- if (ZEND_TYPE_IS_CE(type)) {
- return ZEND_TYPE_CE(type) == zend_standard_class_def;
- } else {
- return zend_string_equals_literal_ci(ZEND_TYPE_NAME(type), "stdclass");
- }
- } else {
- return ZEND_TYPE_CODE(type) == IS_OBJECT;
- }
-}
-
-/* Checks whether an array can be assigned to the reference. Returns conflicting property if
- * assignment is not possible, NULL otherwise. */
-static zend_never_inline zend_bool zend_verify_ref_array_assignable(zend_reference *ref) {
+/* Checks whether an array can be assigned to the reference. Throws error if not assignable. */
+ZEND_API zend_bool zend_verify_ref_array_assignable(zend_reference *ref) {
zend_property_info *prop;
ZEND_ASSERT(ZEND_REF_HAS_TYPE_SOURCES(ref));
ZEND_REF_FOREACH_TYPE_SOURCES(ref, prop) {
@@ -2659,20 +2633,6 @@ static zend_never_inline zend_bool zend_verify_ref_array_assignable(zend_referen
return 1;
}
-/* Checks whether an stdClass can be assigned to the reference. Returns conflicting property if
- * assignment is not possible, NULL otherwise. */
-static zend_never_inline zend_bool zend_verify_ref_stdClass_assignable(zend_reference *ref) {
- zend_property_info *prop;
- ZEND_ASSERT(ZEND_REF_HAS_TYPE_SOURCES(ref));
- ZEND_REF_FOREACH_TYPE_SOURCES(ref, prop) {
- if (!check_type_stdClass_assignable(prop->type)) {
- zend_throw_auto_init_in_ref_error(prop, "stdClass");
- return 0;
- }
- } ZEND_REF_FOREACH_TYPE_SOURCES_END();
- return 1;
-}
-
static zend_property_info *zend_object_fetch_property_type_info(
zend_object *obj, zval *slot)
{
@@ -2708,21 +2668,6 @@ static zend_never_inline zend_bool zend_handle_fetch_obj_flags(
}
}
break;
- case ZEND_FETCH_OBJ_WRITE:
- if (promotes_to_object(ptr)) {
- if (!prop_info) {
- prop_info = zend_object_fetch_property_type_info(obj, ptr);
- if (!prop_info) {
- break;
- }
- }
- if (!check_type_stdClass_assignable(prop_info->type)) {
- zend_throw_auto_init_in_prop_error(prop_info, "stdClass");
- if (result) ZVAL_ERROR(result);
- return 0;
- }
- }
- break;
case ZEND_FETCH_REF:
if (Z_TYPE_P(ptr) != IS_REFERENCE) {
if (!prop_info) {
@@ -2752,8 +2697,10 @@ static zend_never_inline zend_bool zend_handle_fetch_obj_flags(
static zend_always_inline void zend_fetch_property_address(zval *result, zval *container, uint32_t container_op_type, zval *prop_ptr, uint32_t prop_op_type, void **cache_slot, int type, uint32_t flags, zend_bool init_undef OPLINE_DC EXECUTE_DATA_DC)
{
zval *ptr;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
- if (container_op_type != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) {
+ if (container_op_type != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) {
do {
if (Z_ISREF_P(container) && Z_TYPE_P(Z_REFVAL_P(container)) == IS_OBJECT) {
container = Z_REFVAL_P(container);
@@ -2772,17 +2719,16 @@ static zend_always_inline void zend_fetch_property_address(zval *result, zval *c
return;
}
- container = make_real_object(container, prop_ptr OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!container)) {
- ZVAL_ERROR(result);
- return;
- }
+ zend_throw_non_object_error(container, prop_ptr OPLINE_CC EXECUTE_DATA_CC);
+ ZVAL_ERROR(result);
+ return;
} while (0);
}
+
+ zobj = Z_OBJ_P(container);
if (prop_op_type == IS_CONST &&
- EXPECTED(Z_OBJCE_P(container) == CACHED_PTR_EX(cache_slot))) {
+ EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
- zend_object *zobj = Z_OBJ_P(container);
if (EXPECTED(IS_VALID_PROPERTY_OFFSET(prop_offset))) {
ptr = OBJ_PROP(zobj, prop_offset);
@@ -2810,18 +2756,24 @@ static zend_always_inline void zend_fetch_property_address(zval *result, zval *c
}
}
}
- ptr = Z_OBJ_HT_P(container)->get_property_ptr_ptr(container, prop_ptr, type, cache_slot);
+
+ if (prop_op_type == IS_CONST) {
+ name = Z_STR_P(prop_ptr);
+ } else {
+ name = zval_get_tmp_string(prop_ptr, &tmp_name);
+ }
+ ptr = zobj->handlers->get_property_ptr_ptr(zobj, name, type, cache_slot);
if (NULL == ptr) {
- ptr = Z_OBJ_HT_P(container)->read_property(container, prop_ptr, type, cache_slot, result);
+ ptr = zobj->handlers->read_property(zobj, name, type, cache_slot, result);
if (ptr == result) {
if (UNEXPECTED(Z_ISREF_P(ptr) && Z_REFCOUNT_P(ptr) == 1)) {
ZVAL_UNREF(ptr);
}
- return;
+ goto end;
}
} else if (UNEXPECTED(Z_ISERROR_P(ptr))) {
ZVAL_ERROR(result);
- return;
+ goto end;
}
ZVAL_INDIRECT(result, ptr);
@@ -2832,18 +2784,23 @@ static zend_always_inline void zend_fetch_property_address(zval *result, zval *c
prop_info = CACHED_PTR_EX(cache_slot + 2);
if (prop_info) {
if (UNEXPECTED(!zend_handle_fetch_obj_flags(result, ptr, NULL, prop_info, flags))) {
- return;
+ goto end;
}
}
} else {
if (UNEXPECTED(!zend_handle_fetch_obj_flags(result, ptr, Z_OBJ_P(container), NULL, flags))) {
- return;
+ goto end;
}
}
}
if (init_undef && UNEXPECTED(Z_TYPE_P(ptr) == IS_UNDEF)) {
ZVAL_NULL(ptr);
}
+
+end:
+ if (prop_op_type != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
}
static zend_always_inline void zend_assign_to_property_reference(zval *container, uint32_t container_op_type, zval *prop_ptr, uint32_t prop_op_type, zval *value_ptr OPLINE_DC EXECUTE_DATA_DC)
@@ -2864,8 +2821,6 @@ static zend_always_inline void zend_assign_to_property_reference(zval *container
zend_throw_error(NULL, "Cannot assign by reference to overloaded object");
zval_ptr_dtor(&variable);
variable_ptr = &EG(uninitialized_zval);
- } else if (/*OP_DATA_TYPE == IS_VAR &&*/ UNEXPECTED(Z_ISERROR_P(value_ptr))) {
- variable_ptr = &EG(uninitialized_zval);
} else if (/*OP_DATA_TYPE == IS_VAR &&*/
(opline->extended_value & ZEND_RETURNS_FUNCTION) &&
UNEXPECTED(!Z_ISREF_P(value_ptr))) {
@@ -2921,7 +2876,6 @@ static zend_never_inline void zend_assign_to_property_reference_var_var(zval *co
}
static zend_never_inline int zend_fetch_static_property_address_ex(zval **retval, zend_property_info **prop_info, uint32_t cache_slot, int fetch_type OPLINE_DC EXECUTE_DATA_DC) {
- zend_free_op free_op1;
zend_string *name, *tmp_name;
zend_class_entry *ce;
zend_property_info *property_info;
@@ -2963,7 +2917,7 @@ static zend_never_inline int zend_fetch_static_property_address_ex(zval **retval
if (EXPECTED(op1_type == IS_CONST)) {
name = Z_STR_P(RT_CONSTANT(opline, opline->op1));
} else {
- zval *varname = get_zval_ptr_undef(opline->op1_type, opline->op1, &free_op1, BP_VAR_R);
+ zval *varname = get_zval_ptr_undef(opline->op1_type, opline->op1, BP_VAR_R);
if (EXPECTED(Z_TYPE_P(varname) == IS_STRING)) {
name = Z_STR_P(varname);
tmp_name = NULL;
@@ -2980,9 +2934,7 @@ static zend_never_inline int zend_fetch_static_property_address_ex(zval **retval
if (UNEXPECTED(op1_type != IS_CONST)) {
zend_tmp_string_release(tmp_name);
- if (op1_type != IS_CV) {
- zval_ptr_dtor_nogc(free_op1);
- }
+ FREE_OP(op1_type, opline->op1.var);
}
if (UNEXPECTED(*retval == NULL)) {
@@ -3009,7 +2961,8 @@ static zend_always_inline int zend_fetch_static_property_address(zval **retval,
property_info = CACHED_PTR(cache_slot + sizeof(void *) * 2);
if ((fetch_type == BP_VAR_R || fetch_type == BP_VAR_RW)
- && UNEXPECTED(Z_TYPE_P(*retval) == IS_UNDEF) && UNEXPECTED(property_info->type != 0)) {
+ && UNEXPECTED(Z_TYPE_P(*retval) == IS_UNDEF)
+ && UNEXPECTED(ZEND_TYPE_IS_SET(property_info->type))) {
zend_throw_error(NULL, "Typed static property %s::$%s must not be accessed before initialization",
ZSTR_VAL(property_info->ce->name),
zend_get_unmangled_property_name(property_info->name));
@@ -3022,7 +2975,7 @@ static zend_always_inline int zend_fetch_static_property_address(zval **retval,
}
}
- if (flags && property_info->type) {
+ if (flags && ZEND_TYPE_IS_SET(property_info->type)) {
zend_handle_fetch_obj_flags(NULL, *retval, NULL, property_info, flags);
}
@@ -3034,92 +2987,86 @@ static zend_always_inline int zend_fetch_static_property_address(zval **retval,
}
ZEND_API ZEND_COLD void zend_throw_ref_type_error_type(zend_property_info *prop1, zend_property_info *prop2, zval *zv) {
- const char *prop1_type1, *prop1_type2, *prop2_type1, *prop2_type2;
- zend_format_type(prop1->type, &prop1_type1, &prop1_type2);
- zend_format_type(prop2->type, &prop2_type1, &prop2_type2);
- zend_type_error("Reference with value of type %s held by property %s::$%s of type %s%s is not compatible with property %s::$%s of type %s%s",
+ zend_string *type1_str = zend_type_to_string(prop1->type);
+ zend_string *type2_str = zend_type_to_string(prop2->type);
+ zend_type_error("Reference with value of type %s held by property %s::$%s of type %s is not compatible with property %s::$%s of type %s",
Z_TYPE_P(zv) == IS_OBJECT ? ZSTR_VAL(Z_OBJCE_P(zv)->name) : zend_get_type_by_const(Z_TYPE_P(zv)),
ZSTR_VAL(prop1->ce->name),
zend_get_unmangled_property_name(prop1->name),
- prop1_type1, prop1_type2,
+ ZSTR_VAL(type1_str),
ZSTR_VAL(prop2->ce->name),
zend_get_unmangled_property_name(prop2->name),
- prop2_type1, prop2_type2
+ ZSTR_VAL(type2_str)
);
+ zend_string_release(type1_str);
+ zend_string_release(type2_str);
}
ZEND_API ZEND_COLD void zend_throw_ref_type_error_zval(zend_property_info *prop, zval *zv) {
- const char *prop_type1, *prop_type2;
- zend_format_type(prop->type, &prop_type1, &prop_type2);
- zend_type_error("Cannot assign %s to reference held by property %s::$%s of type %s%s",
+ zend_string *type_str = zend_type_to_string(prop->type);
+ zend_type_error("Cannot assign %s to reference held by property %s::$%s of type %s",
Z_TYPE_P(zv) == IS_OBJECT ? ZSTR_VAL(Z_OBJCE_P(zv)->name) : zend_get_type_by_const(Z_TYPE_P(zv)),
ZSTR_VAL(prop->ce->name),
zend_get_unmangled_property_name(prop->name),
- prop_type1, prop_type2
+ ZSTR_VAL(type_str)
);
+ zend_string_release(type_str);
}
ZEND_API ZEND_COLD void zend_throw_conflicting_coercion_error(zend_property_info *prop1, zend_property_info *prop2, zval *zv) {
- const char *prop1_type1, *prop1_type2, *prop2_type1, *prop2_type2;
- zend_format_type(prop1->type, &prop1_type1, &prop1_type2);
- zend_format_type(prop2->type, &prop2_type1, &prop2_type2);
- zend_type_error("Cannot assign %s to reference held by property %s::$%s of type %s%s and property %s::$%s of type %s%s, as this would result in an inconsistent type conversion",
+ zend_string *type1_str = zend_type_to_string(prop1->type);
+ zend_string *type2_str = zend_type_to_string(prop2->type);
+ zend_type_error("Cannot assign %s to reference held by property %s::$%s of type %s and property %s::$%s of type %s, as this would result in an inconsistent type conversion",
Z_TYPE_P(zv) == IS_OBJECT ? ZSTR_VAL(Z_OBJCE_P(zv)->name) : zend_get_type_by_const(Z_TYPE_P(zv)),
ZSTR_VAL(prop1->ce->name),
zend_get_unmangled_property_name(prop1->name),
- prop1_type1, prop1_type2,
+ ZSTR_VAL(type1_str),
ZSTR_VAL(prop2->ce->name),
zend_get_unmangled_property_name(prop2->name),
- prop2_type1, prop2_type2
+ ZSTR_VAL(type2_str)
);
+ zend_string_release(type1_str);
+ zend_string_release(type2_str);
}
/* 1: valid, 0: invalid, -1: may be valid after type coercion */
static zend_always_inline int i_zend_verify_type_assignable_zval(
- zend_type *type_ptr, zend_class_entry *self_ce, zval *zv, zend_bool strict) {
- zend_type type = *type_ptr;
- zend_uchar type_code;
+ zend_property_info *info, zval *zv, zend_bool strict) {
+ zend_type type = info->type;
+ uint32_t type_mask;
zend_uchar zv_type = Z_TYPE_P(zv);
- if (ZEND_TYPE_ALLOW_NULL(type) && zv_type == IS_NULL) {
+ if (EXPECTED(ZEND_TYPE_CONTAINS_CODE(type, zv_type))) {
return 1;
}
- if (ZEND_TYPE_IS_CLASS(type)) {
- if (!ZEND_TYPE_IS_CE(type)) {
- if (!zend_resolve_class_type(type_ptr, self_ce)) {
- return 0;
- }
- type = *type_ptr;
- }
- return zv_type == IS_OBJECT && instanceof_function(Z_OBJCE_P(zv), ZEND_TYPE_CE(type));
- }
-
- type_code = ZEND_TYPE_CODE(type);
- if (type_code == zv_type ||
- (type_code == _IS_BOOL && (zv_type == IS_FALSE || zv_type == IS_TRUE))) {
+ if (ZEND_TYPE_HAS_CLASS(type) && zv_type == IS_OBJECT
+ && zend_check_and_resolve_property_class_type(info, Z_OBJCE_P(zv))) {
return 1;
}
- if (type_code == IS_ITERABLE) {
+ type_mask = ZEND_TYPE_FULL_MASK(type);
+ ZEND_ASSERT(!(type_mask & MAY_BE_CALLABLE));
+ if (type_mask & MAY_BE_ITERABLE) {
return zend_is_iterable(zv);
}
/* SSTH Exception: IS_LONG may be accepted as IS_DOUBLE (converted) */
if (strict) {
- if (type_code == IS_DOUBLE && zv_type == IS_LONG) {
+ if ((type_mask & MAY_BE_DOUBLE) && zv_type == IS_LONG) {
return -1;
}
return 0;
}
- /* No weak conversions for arrays and objects */
- if (type_code == IS_ARRAY || type_code == IS_OBJECT) {
+ /* NULL may be accepted only by nullable hints (this is already checked) */
+ if (zv_type == IS_NULL) {
return 0;
}
- /* NULL may be accepted only by nullable hints (this is already checked) */
- if (zv_type == IS_NULL) {
+ /* Does not contain any type to which a coercion is possible */
+ if (!(type_mask & (MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_STRING))
+ && (type_mask & MAY_BE_BOOL) != MAY_BE_BOOL) {
return 0;
}
@@ -3132,37 +3079,62 @@ ZEND_API zend_bool ZEND_FASTCALL zend_verify_ref_assignable_zval(zend_reference
zend_property_info *prop;
/* The value must satisfy each property type, and coerce to the same value for each property
- * type. Right now, the latter rule means that *if* coercion is necessary, then all types
- * must be the same (modulo nullability). To handle this, remember the first type we see and
- * compare against it when coercion becomes necessary. */
- zend_property_info *seen_prop = NULL;
- zend_uchar seen_type;
- zend_bool needs_coercion = 0;
+ * type. Remember the first coerced type and value we've seen for this purpose. */
+ zend_property_info *first_prop = NULL;
+ zval coerced_value;
+ ZVAL_UNDEF(&coerced_value);
ZEND_ASSERT(Z_TYPE_P(zv) != IS_REFERENCE);
ZEND_REF_FOREACH_TYPE_SOURCES(ref, prop) {
- int result = i_zend_verify_type_assignable_zval(&prop->type, prop->ce, zv, strict);
+ int result = i_zend_verify_type_assignable_zval(prop, zv, strict);
if (result == 0) {
+type_error:
zend_throw_ref_type_error_zval(prop, zv);
+ zval_ptr_dtor(&coerced_value);
return 0;
}
if (result < 0) {
- needs_coercion = 1;
- }
-
- if (!seen_prop) {
- seen_prop = prop;
- seen_type = ZEND_TYPE_IS_CLASS(prop->type) ? IS_OBJECT : ZEND_TYPE_CODE(prop->type);
- } else if (needs_coercion && seen_type != ZEND_TYPE_CODE(prop->type)) {
- zend_throw_conflicting_coercion_error(seen_prop, prop, zv);
- return 0;
+ if (!first_prop) {
+ first_prop = prop;
+ ZVAL_COPY(&coerced_value, zv);
+ if (!zend_verify_weak_scalar_type_hint(
+ ZEND_TYPE_FULL_MASK(prop->type), &coerced_value)) {
+ goto type_error;
+ }
+ } else if (Z_ISUNDEF(coerced_value)) {
+ /* A previous property did not require coercion, but this one does,
+ * so they are incompatible. */
+ goto conflicting_coercion_error;
+ } else {
+ zval tmp;
+ ZVAL_COPY(&tmp, zv);
+ if (!zend_verify_weak_scalar_type_hint(ZEND_TYPE_FULL_MASK(prop->type), &tmp)) {
+ zval_ptr_dtor(&tmp);
+ goto type_error;
+ }
+ if (!zend_is_identical(&coerced_value, &tmp)) {
+ zval_ptr_dtor(&tmp);
+ goto conflicting_coercion_error;
+ }
+ }
+ } else {
+ if (!first_prop) {
+ first_prop = prop;
+ } else if (!Z_ISUNDEF(coerced_value)) {
+ /* A previous property required coercion, but this one doesn't,
+ * so they are incompatible. */
+conflicting_coercion_error:
+ zend_throw_conflicting_coercion_error(first_prop, prop, zv);
+ zval_ptr_dtor(&coerced_value);
+ return 0;
+ }
}
} ZEND_REF_FOREACH_TYPE_SOURCES_END();
- if (UNEXPECTED(needs_coercion && !zend_verify_weak_scalar_type_hint(seen_type, zv))) {
- zend_throw_ref_type_error_zval(seen_prop, zv);
- return 0;
+ if (!Z_ISUNDEF(coerced_value)) {
+ zval_ptr_dtor(zv);
+ ZVAL_COPY_VALUE(zv, &coerced_value);
}
return 1;
@@ -3216,21 +3188,23 @@ ZEND_API zend_bool ZEND_FASTCALL zend_verify_prop_assignable_by_ref(zend_propert
int result;
val = Z_REFVAL_P(val);
- result = i_zend_verify_type_assignable_zval(&prop_info->type, prop_info->ce, val, strict);
+ result = i_zend_verify_type_assignable_zval(prop_info, val, strict);
if (result > 0) {
return 1;
}
if (result < 0) {
- zend_property_info *ref_prop = ZEND_REF_FIRST_SOURCE(Z_REF_P(orig_val));
- if (ZEND_TYPE_CODE(prop_info->type) != ZEND_TYPE_CODE(ref_prop->type)) {
- /* Invalid due to conflicting coercion */
+ /* This is definitely an error, but we still need to determined why: Either because
+ * the value is simply illegal for the type, or because or a conflicting coercion. */
+ zval tmp;
+ ZVAL_COPY(&tmp, val);
+ if (zend_verify_weak_scalar_type_hint(ZEND_TYPE_FULL_MASK(prop_info->type), &tmp)) {
+ zend_property_info *ref_prop = ZEND_REF_FIRST_SOURCE(Z_REF_P(orig_val));
zend_throw_ref_type_error_type(ref_prop, prop_info, val);
+ zval_ptr_dtor(&tmp);
return 0;
}
- if (zend_verify_weak_scalar_type_hint(ZEND_TYPE_CODE(prop_info->type), val)) {
- return 1;
- }
+ zval_ptr_dtor(&tmp);
}
} else {
ZVAL_DEREF(val);
@@ -3313,7 +3287,7 @@ static zend_never_inline void zend_fetch_this_var(int type OPLINE_DC EXECUTE_DAT
Z_ADDREF_P(result);
} else {
ZVAL_NULL(result);
- zend_error(E_NOTICE,"Undefined variable: this");
+ zend_error(E_WARNING, "Undefined variable: this");
}
break;
case BP_VAR_IS:
@@ -3399,15 +3373,7 @@ static zend_always_inline void i_free_compiled_variables(zend_execute_data *exec
zval *cv = EX_VAR_NUM(0);
int count = EX(func)->op_array.last_var;
while (EXPECTED(count != 0)) {
- if (Z_REFCOUNTED_P(cv)) {
- zend_refcounted *r = Z_COUNTED_P(cv);
- if (!GC_DELREF(r)) {
- ZVAL_NULL(cv);
- rc_dtor_func(r);
- } else {
- gc_check_possible_root(r);
- }
- }
+ i_zval_ptr_dtor(cv);
cv++;
count--;
}
@@ -3925,7 +3891,8 @@ static void cleanup_live_vars(zend_execute_data *execute_data, uint32_t op_num,
}
} else if (kind == ZEND_LIVE_SILENCE) {
/* restore previous error_reporting value */
- if (!EG(error_reporting) && Z_LVAL_P(var) != 0) {
+ if (E_HAS_ONLY_FATAL_ERRORS(EG(error_reporting))
+ && !E_HAS_ONLY_FATAL_ERRORS(Z_LVAL_P(var))) {
EG(error_reporting) = Z_LVAL_P(var);
}
}
@@ -4001,9 +3968,7 @@ static zend_never_inline zend_execute_data *zend_init_dynamic_call_string(zend_s
if (UNEXPECTED(!(fbc->common.fn_flags & ZEND_ACC_STATIC))) {
zend_non_static_method_call(fbc);
- if (UNEXPECTED(EG(exception) != NULL)) {
- return NULL;
- }
+ return NULL;
}
if (EXPECTED(fbc->type == ZEND_USER_FUNCTION) && UNEXPECTED(!RUN_TIME_CACHE(&fbc->op_array))) {
init_func_run_time_cache(&fbc->op_array);
@@ -4034,7 +3999,7 @@ static zend_never_inline zend_execute_data *zend_init_dynamic_call_string(zend_s
}
/* }}} */
-static zend_never_inline zend_execute_data *zend_init_dynamic_call_object(zval *function, uint32_t num_args) /* {{{ */
+static zend_never_inline zend_execute_data *zend_init_dynamic_call_object(zend_object *function, uint32_t num_args) /* {{{ */
{
zend_function *fbc;
void *object_or_called_scope;
@@ -4042,8 +4007,8 @@ static zend_never_inline zend_execute_data *zend_init_dynamic_call_object(zval *
zend_object *object;
uint32_t call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_DYNAMIC;
- if (EXPECTED(Z_OBJ_HANDLER_P(function, get_closure)) &&
- EXPECTED(Z_OBJ_HANDLER_P(function, get_closure)(function, &called_scope, &fbc, &object) == SUCCESS)) {
+ if (EXPECTED(function->handlers->get_closure) &&
+ EXPECTED(function->handlers->get_closure(function, &called_scope, &fbc, &object, 0) == SUCCESS)) {
object_or_called_scope = called_scope;
if (fbc->common.fn_flags & ZEND_ACC_CLOSURE) {
@@ -4063,7 +4028,7 @@ static zend_never_inline zend_execute_data *zend_init_dynamic_call_object(zval *
object_or_called_scope = object;
}
} else {
- zend_throw_error(NULL, "Function name must be a string");
+ zend_throw_error(NULL, "Object of type %s is not callable", ZSTR_VAL(function->ce->name));
return NULL;
}
@@ -4125,9 +4090,7 @@ static zend_never_inline zend_execute_data *zend_init_dynamic_call_array(zend_ar
}
if (!(fbc->common.fn_flags & ZEND_ACC_STATIC)) {
zend_non_static_method_call(fbc);
- if (UNEXPECTED(EG(exception) != NULL)) {
- return NULL;
- }
+ return NULL;
}
object_or_called_scope = called_scope;
} else {
@@ -4150,7 +4113,7 @@ static zend_never_inline zend_execute_data *zend_init_dynamic_call_array(zend_ar
}
}
} else {
- zend_throw_error(NULL, "Function name must be a string");
+ zend_throw_error(NULL, "Array callback must have exactly two elements");
return NULL;
}
@@ -4259,43 +4222,6 @@ already_compiled:
}
/* }}} */
-static ZEND_COLD int ZEND_FASTCALL zend_do_fcall_overloaded(zend_execute_data *call, zval *ret) /* {{{ */
-{
- zend_function *fbc = call->func;
- zend_object *object;
-
- /* Not sure what should be done here if it's a static method */
- if (UNEXPECTED(Z_TYPE(call->This) != IS_OBJECT)) {
- zend_vm_stack_free_args(call);
- if (fbc->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY) {
- zend_string_release_ex(fbc->common.function_name, 0);
- }
- efree(fbc);
- zend_vm_stack_free_call_frame(call);
-
- zend_throw_error(NULL, "Cannot call overloaded function for non-object");
- return 0;
- }
-
- object = Z_OBJ(call->This);
-
- ZVAL_NULL(ret);
-
- EG(current_execute_data) = call;
- object->handlers->call_method(fbc->common.function_name, object, call, ret);
- EG(current_execute_data) = call->prev_execute_data;
-
- zend_vm_stack_free_args(call);
-
- if (fbc->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY) {
- zend_string_release_ex(fbc->common.function_name, 0);
- }
- efree(fbc);
-
- return 1;
-}
-/* }}} */
-
static zend_never_inline zend_bool ZEND_FASTCALL zend_fe_reset_iterator(zval *array_ptr, int by_ref OPLINE_DC EXECUTE_DATA_DC) /* {{{ */
{
zend_class_entry *ce = Z_OBJCE_P(array_ptr);
@@ -4343,95 +4269,33 @@ static zend_always_inline int _zend_quick_get_constant(
const zval *key, uint32_t flags, int check_defined_only OPLINE_DC EXECUTE_DATA_DC) /* {{{ */
{
zval *zv;
- const zval *orig_key = key;
zend_constant *c = NULL;
+ /* null/true/false are resolved during compilation, so don't check for them here. */
zv = zend_hash_find_ex(EG(zend_constants), Z_STR_P(key), 1);
if (zv) {
c = (zend_constant*)Z_PTR_P(zv);
- } else {
+ } else if (flags & IS_CONSTANT_UNQUALIFIED_IN_NAMESPACE) {
key++;
zv = zend_hash_find_ex(EG(zend_constants), Z_STR_P(key), 1);
- if (zv && (ZEND_CONSTANT_FLAGS((zend_constant*)Z_PTR_P(zv)) & CONST_CS) == 0) {
+ if (zv) {
c = (zend_constant*)Z_PTR_P(zv);
- } else {
- if ((flags & (IS_CONSTANT_IN_NAMESPACE|IS_CONSTANT_UNQUALIFIED)) == (IS_CONSTANT_IN_NAMESPACE|IS_CONSTANT_UNQUALIFIED)) {
- key++;
- zv = zend_hash_find_ex(EG(zend_constants), Z_STR_P(key), 1);
- if (zv) {
- c = (zend_constant*)Z_PTR_P(zv);
- } else {
- key++;
- zv = zend_hash_find_ex(EG(zend_constants), Z_STR_P(key), 1);
- if (zv && (ZEND_CONSTANT_FLAGS((zend_constant*)Z_PTR_P(zv)) & CONST_CS) == 0) {
- c = (zend_constant*)Z_PTR_P(zv);
- }
- }
- }
}
}
if (!c) {
if (!check_defined_only) {
- if ((opline->op1.num & IS_CONSTANT_UNQUALIFIED) != 0) {
- char *actual = (char *)zend_memrchr(Z_STRVAL_P(RT_CONSTANT(opline, opline->op2)), '\\', Z_STRLEN_P(RT_CONSTANT(opline, opline->op2)));
- if (!actual) {
- ZVAL_STR_COPY(EX_VAR(opline->result.var), Z_STR_P(RT_CONSTANT(opline, opline->op2)));
- } else {
- actual++;
- ZVAL_STRINGL(EX_VAR(opline->result.var),
- actual, Z_STRLEN_P(RT_CONSTANT(opline, opline->op2)) - (actual - Z_STRVAL_P(RT_CONSTANT(opline, opline->op2))));
- }
- /* non-qualified constant - allow text substitution */
- zend_error(E_WARNING, "Use of undefined constant %s - assumed '%s' (this will throw an Error in a future version of PHP)",
- Z_STRVAL_P(EX_VAR(opline->result.var)), Z_STRVAL_P(EX_VAR(opline->result.var)));
- } else {
- zend_throw_error(NULL, "Undefined constant '%s'", Z_STRVAL_P(RT_CONSTANT(opline, opline->op2)));
- ZVAL_UNDEF(EX_VAR(opline->result.var));
- }
+ zend_throw_error(NULL, "Undefined constant '%s'", Z_STRVAL_P(RT_CONSTANT(opline, opline->op2)));
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
}
return FAILURE;
}
if (!check_defined_only) {
ZVAL_COPY_OR_DUP(EX_VAR(opline->result.var), &c->value);
- if (!(ZEND_CONSTANT_FLAGS(c) & (CONST_CS|CONST_CT_SUBST))) {
- const char *ns_sep;
- size_t shortname_offset;
- size_t shortname_len;
- zend_bool is_deprecated;
-
- if (flags & IS_CONSTANT_UNQUALIFIED) {
- const zval *access_key;
-
- if (!(flags & IS_CONSTANT_IN_NAMESPACE)) {
- access_key = orig_key - 1;
- } else {
- if (key < orig_key + 2) {
- goto check_short_name;
- } else {
- access_key = orig_key + 2;
- }
- }
- is_deprecated = !zend_string_equals(c->name, Z_STR_P(access_key));
- } else {
-check_short_name:
- ns_sep = zend_memrchr(ZSTR_VAL(c->name), '\\', ZSTR_LEN(c->name));
- ZEND_ASSERT(ns_sep);
- /* Namespaces are always case-insensitive. Only compare shortname. */
- shortname_offset = ns_sep - ZSTR_VAL(c->name) + 1;
- shortname_len = ZSTR_LEN(c->name) - shortname_offset;
-
- is_deprecated = memcmp(ZSTR_VAL(c->name) + shortname_offset, Z_STRVAL_P(orig_key - 1) + shortname_offset, shortname_len) != 0;
- }
-
- if (is_deprecated) {
- zend_error(E_DEPRECATED,
- "Case-insensitive constants are deprecated. "
- "The correct casing for this constant is \"%s\"",
- ZSTR_VAL(c->name));
- return SUCCESS;
- }
+ if (ZEND_CONSTANT_FLAGS(c) & CONST_DEPRECATED) {
+ zend_error(E_DEPRECATED, "Constant %s is deprecated", ZSTR_VAL(c->name));
+ return SUCCESS;
}
}
@@ -4533,68 +4397,68 @@ static zend_always_inline zend_execute_data *_zend_vm_stack_push_call_frame(uint
OPLINE++
-#ifndef VM_SMART_OPCODES
-# define VM_SMART_OPCODES 1
-#endif
-
-#if VM_SMART_OPCODES
-# define ZEND_VM_REPEATABLE_OPCODE \
+#define ZEND_VM_REPEATABLE_OPCODE \
do {
-# define ZEND_VM_REPEAT_OPCODE(_opcode) \
+#define ZEND_VM_REPEAT_OPCODE(_opcode) \
} while (UNEXPECTED((++opline)->opcode == _opcode)); \
OPLINE = opline; \
ZEND_VM_CONTINUE()
-# define ZEND_VM_SMART_BRANCH(_result, _check) do { \
+#define ZEND_VM_SMART_BRANCH(_result, _check) do { \
if ((_check) && UNEXPECTED(EG(exception))) { \
- break; \
- } \
- if (EXPECTED((opline+1)->opcode == ZEND_JMPZ)) { \
+ OPLINE = EX(opline); \
+ } else if (EXPECTED(opline->result_type == (IS_SMART_BRANCH_JMPZ|IS_TMP_VAR))) { \
if (_result) { \
ZEND_VM_SET_NEXT_OPCODE(opline + 2); \
} else { \
ZEND_VM_SET_OPCODE(OP_JMP_ADDR(opline + 1, (opline+1)->op2)); \
} \
- } else if (EXPECTED((opline+1)->opcode == ZEND_JMPNZ)) { \
+ } else if (EXPECTED(opline->result_type == (IS_SMART_BRANCH_JMPNZ|IS_TMP_VAR))) { \
if (!(_result)) { \
ZEND_VM_SET_NEXT_OPCODE(opline + 2); \
} else { \
ZEND_VM_SET_OPCODE(OP_JMP_ADDR(opline + 1, (opline+1)->op2)); \
} \
} else { \
- break; \
+ ZVAL_BOOL(EX_VAR(opline->result.var), _result); \
+ ZEND_VM_SET_NEXT_OPCODE(opline + 1); \
} \
ZEND_VM_CONTINUE(); \
} while (0)
-# define ZEND_VM_SMART_BRANCH_JMPZ(_result, _check) do { \
+#define ZEND_VM_SMART_BRANCH_JMPZ(_result, _check) do { \
if ((_check) && UNEXPECTED(EG(exception))) { \
- break; \
- } \
- if (_result) { \
+ OPLINE = EX(opline); \
+ } else if (_result) { \
ZEND_VM_SET_NEXT_OPCODE(opline + 2); \
} else { \
ZEND_VM_SET_OPCODE(OP_JMP_ADDR(opline + 1, (opline+1)->op2)); \
} \
ZEND_VM_CONTINUE(); \
} while (0)
-# define ZEND_VM_SMART_BRANCH_JMPNZ(_result, _check) do { \
+#define ZEND_VM_SMART_BRANCH_JMPNZ(_result, _check) do { \
if ((_check) && UNEXPECTED(EG(exception))) { \
- break; \
- } \
- if (!(_result)) { \
+ OPLINE = EX(opline); \
+ } else if (!(_result)) { \
ZEND_VM_SET_NEXT_OPCODE(opline + 2); \
} else { \
ZEND_VM_SET_OPCODE(OP_JMP_ADDR(opline + 1, (opline+1)->op2)); \
} \
ZEND_VM_CONTINUE(); \
} while (0)
+#define ZEND_VM_SMART_BRANCH_NONE(_result, _check) do { \
+ ZVAL_BOOL(EX_VAR(opline->result.var), _result); \
+ ZEND_VM_NEXT_OPCODE_EX(_check, 1); \
+ ZEND_VM_CONTINUE(); \
+ } while (0)
#define ZEND_VM_SMART_BRANCH_TRUE() do { \
- if (EXPECTED((opline+1)->opcode == ZEND_JMPNZ)) { \
+ if (EXPECTED(opline->result_type == (IS_SMART_BRANCH_JMPNZ|IS_TMP_VAR))) { \
ZEND_VM_SET_OPCODE(OP_JMP_ADDR(opline + 1, (opline+1)->op2)); \
- ZEND_VM_CONTINUE(); \
- } else if (EXPECTED((opline+1)->opcode == ZEND_JMPZ)) { \
+ } else if (EXPECTED(opline->result_type == (IS_SMART_BRANCH_JMPZ|IS_TMP_VAR))) { \
ZEND_VM_SET_NEXT_OPCODE(opline + 2); \
- ZEND_VM_CONTINUE(); \
+ } else { \
+ ZVAL_TRUE(EX_VAR(opline->result.var)); \
+ ZEND_VM_SET_NEXT_OPCODE(opline + 1); \
} \
+ ZEND_VM_CONTINUE(); \
} while (0)
#define ZEND_VM_SMART_BRANCH_TRUE_JMPZ() do { \
ZEND_VM_SET_NEXT_OPCODE(opline + 2); \
@@ -4604,14 +4468,20 @@ static zend_always_inline zend_execute_data *_zend_vm_stack_push_call_frame(uint
ZEND_VM_SET_OPCODE(OP_JMP_ADDR(opline + 1, (opline+1)->op2)); \
ZEND_VM_CONTINUE(); \
} while (0)
+#define ZEND_VM_SMART_BRANCH_TRUE_NONE() do { \
+ ZVAL_TRUE(EX_VAR(opline->result.var)); \
+ ZEND_VM_NEXT_OPCODE(); \
+ } while (0)
#define ZEND_VM_SMART_BRANCH_FALSE() do { \
- if (EXPECTED((opline+1)->opcode == ZEND_JMPNZ)) { \
+ if (EXPECTED(opline->result_type == (IS_SMART_BRANCH_JMPNZ|IS_TMP_VAR))) { \
ZEND_VM_SET_NEXT_OPCODE(opline + 2); \
- ZEND_VM_CONTINUE(); \
- } else if (EXPECTED((opline+1)->opcode == ZEND_JMPZ)) { \
+ } else if (EXPECTED(opline->result_type == (IS_SMART_BRANCH_JMPZ|IS_TMP_VAR))) { \
ZEND_VM_SET_OPCODE(OP_JMP_ADDR(opline + 1, (opline+1)->op2)); \
- ZEND_VM_CONTINUE(); \
+ } else { \
+ ZVAL_FALSE(EX_VAR(opline->result.var)); \
+ ZEND_VM_SET_NEXT_OPCODE(opline + 1); \
} \
+ ZEND_VM_CONTINUE(); \
} while (0)
#define ZEND_VM_SMART_BRANCH_FALSE_JMPZ() do { \
ZEND_VM_SET_OPCODE(OP_JMP_ADDR(opline + 1, (opline+1)->op2)); \
@@ -4621,15 +4491,10 @@ static zend_always_inline zend_execute_data *_zend_vm_stack_push_call_frame(uint
ZEND_VM_SET_NEXT_OPCODE(opline + 2); \
ZEND_VM_CONTINUE(); \
} while (0)
-#else
-# define ZEND_VM_REPEATABLE_OPCODE
-# define ZEND_VM_REPEAT_OPCODE(_opcode)
-# define ZEND_VM_SMART_BRANCH(_result, _check)
-# define ZEND_VM_SMART_BRANCH_JMPZ(_result, _check)
-# define ZEND_VM_SMART_BRANCH_JMPNZ(_result, _check)
-# define ZEND_VM_SMART_BRANCH_TRUE()
-# define ZEND_VM_SMART_BRANCH_FALSE()
-#endif
+#define ZEND_VM_SMART_BRANCH_FALSE_NONE() do { \
+ ZVAL_FALSE(EX_VAR(opline->result.var)); \
+ ZEND_VM_NEXT_OPCODE(); \
+ } while (0)
#ifdef __GNUC__
# define ZEND_VM_GUARD(name) __asm__("#" #name)
@@ -4665,27 +4530,21 @@ ZEND_API user_opcode_handler_t zend_get_user_opcode_handler(zend_uchar opcode)
return zend_user_opcode_handlers[opcode];
}
-ZEND_API zval *zend_get_zval_ptr(const zend_op *opline, int op_type, const znode_op *node, const zend_execute_data *execute_data, zend_free_op *should_free, int type)
+ZEND_API zval *zend_get_zval_ptr(const zend_op *opline, int op_type, const znode_op *node, const zend_execute_data *execute_data, int type)
{
zval *ret;
switch (op_type) {
case IS_CONST:
ret = RT_CONSTANT(opline, *node);
- *should_free = NULL;
break;
case IS_TMP_VAR:
case IS_VAR:
- ret = EX_VAR(node->var);
- *should_free = ret;
- break;
case IS_CV:
ret = EX_VAR(node->var);
- *should_free = NULL;
break;
default:
ret = NULL;
- *should_free = ret;
break;
}
return ret;
diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h
index cb100f55e9..44b48e914c 100644
--- a/Zend/zend_execute.h
+++ b/Zend/zend_execute.h
@@ -44,10 +44,10 @@ ZEND_API zend_class_entry *zend_lookup_class(zend_string *name);
ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, zend_string *lcname, uint32_t flags);
ZEND_API zend_class_entry *zend_get_called_scope(zend_execute_data *ex);
ZEND_API zend_object *zend_get_this_object(zend_execute_data *ex);
-ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name);
-ZEND_API int zend_eval_stringl(char *str, size_t str_len, zval *retval_ptr, char *string_name);
-ZEND_API int zend_eval_string_ex(char *str, zval *retval_ptr, char *string_name, int handle_exceptions);
-ZEND_API int zend_eval_stringl_ex(char *str, size_t str_len, zval *retval_ptr, char *string_name, int handle_exceptions);
+ZEND_API int zend_eval_string(const char *str, zval *retval_ptr, const char *string_name);
+ZEND_API int zend_eval_stringl(const char *str, size_t str_len, zval *retval_ptr, const char *string_name);
+ZEND_API int zend_eval_string_ex(const char *str, zval *retval_ptr, const char *string_name, int handle_exceptions);
+ZEND_API int zend_eval_stringl_ex(const char *str, size_t str_len, zval *retval_ptr, const char *string_name, int handle_exceptions);
/* export zend_pass_function to allow comparisons against it */
extern ZEND_API const zend_internal_function zend_pass_function;
@@ -60,6 +60,14 @@ ZEND_API zend_bool ZEND_FASTCALL zend_verify_prop_assignable_by_ref(zend_propert
ZEND_API ZEND_COLD void zend_throw_ref_type_error_zval(zend_property_info *prop, zval *zv);
ZEND_API ZEND_COLD void zend_throw_ref_type_error_type(zend_property_info *prop1, zend_property_info *prop2, zval *zv);
+ZEND_API zend_bool zend_verify_scalar_type_hint(uint32_t type_mask, zval *arg, zend_bool strict, zend_bool is_internal_arg);
+ZEND_API ZEND_COLD void zend_verify_arg_error(
+ const zend_function *zf, const zend_arg_info *arg_info,
+ int arg_num, void **cache_slot, zval *value);
+ZEND_API ZEND_COLD void zend_verify_return_error(
+ const zend_function *zf, void **cache_slot, zval *value);
+ZEND_API zend_bool zend_verify_ref_array_assignable(zend_reference *ref);
+
#define ZEND_REF_TYPE_SOURCES(ref) \
(ref)->sources
@@ -120,11 +128,6 @@ static zend_always_inline zval* zend_assign_to_variable(zval *variable_ptr, zval
break;
}
}
- if (Z_TYPE_P(variable_ptr) == IS_OBJECT &&
- UNEXPECTED(Z_OBJ_HANDLER_P(variable_ptr, set) != NULL)) {
- Z_OBJ_HANDLER_P(variable_ptr, set)(variable_ptr, value);
- return variable_ptr;
- }
garbage = Z_COUNTED_P(variable_ptr);
zend_copy_to_variable(variable_ptr, value, value_type, ref);
if (GC_DELREF(garbage) == 0) {
@@ -145,7 +148,6 @@ static zend_always_inline zval* zend_assign_to_variable(zval *variable_ptr, zval
ZEND_API int zval_update_constant(zval *pp);
ZEND_API int zval_update_constant_ex(zval *pp, zend_class_entry *scope);
-ZEND_API ZEND_COLD int zend_use_undefined_constant(zend_string *name, zend_ast_attr attr, zval *result);
/* dedicated Zend executor functions - do not use! */
struct _zend_vm_stack {
@@ -230,15 +232,7 @@ static zend_always_inline void zend_vm_stack_free_extra_args_ex(uint32_t call_in
uint32_t count = ZEND_CALL_NUM_ARGS(call) - call->func->op_array.num_args;
zval *p = ZEND_CALL_VAR_NUM(call, call->func->op_array.last_var + call->func->op_array.T);
do {
- if (Z_REFCOUNTED_P(p)) {
- zend_refcounted *r = Z_COUNTED_P(p);
- if (!GC_DELREF(r)) {
- ZVAL_NULL(p);
- rc_dtor_func(r);
- } else {
- gc_check_possible_root(r);
- }
- }
+ i_zval_ptr_dtor(p);
p++;
} while (--count);
}
@@ -257,13 +251,7 @@ static zend_always_inline void zend_vm_stack_free_args(zend_execute_data *call)
zval *p = ZEND_CALL_ARG(call, 1);
do {
- if (Z_REFCOUNTED_P(p)) {
- zend_refcounted *r = Z_COUNTED_P(p);
- if (!GC_DELREF(r)) {
- ZVAL_NULL(p);
- rc_dtor_func(r);
- }
- }
+ zval_ptr_dtor_nogc(p);
p++;
} while (--num_args);
}
@@ -328,10 +316,7 @@ ZEND_API zval* zend_get_compiled_variable_value(const zend_execute_data *execute
ZEND_API int zend_set_user_opcode_handler(zend_uchar opcode, user_opcode_handler_t handler);
ZEND_API user_opcode_handler_t zend_get_user_opcode_handler(zend_uchar opcode);
-/* former zend_execute_locks.h */
-typedef zval* zend_free_op;
-
-ZEND_API zval *zend_get_zval_ptr(const zend_op *opline, int op_type, const znode_op *node, const zend_execute_data *execute_data, zend_free_op *should_free, int type);
+ZEND_API zval *zend_get_zval_ptr(const zend_op *opline, int op_type, const znode_op *node, const zend_execute_data *execute_data, int type);
ZEND_API void zend_clean_and_cache_symbol_table(zend_array *symbol_table);
ZEND_API void zend_free_compiled_variables(zend_execute_data *execute_data);
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index 4277df1a1f..e2410cf6af 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -180,8 +180,6 @@ void init_executor(void) /* {{{ */
EG(ht_iterators) = EG(ht_iterators_slots);
memset(EG(ht_iterators), 0, sizeof(EG(ht_iterators_slots)));
- EG(each_deprecation_thrown) = 0;
-
EG(persistent_constants_count) = EG(zend_constants)->nNumUsed;
EG(persistent_functions_count) = EG(function_table)->nNumUsed;
EG(persistent_classes_count) = EG(class_table)->nNumUsed;
@@ -560,41 +558,6 @@ ZEND_API zend_bool zend_is_executing(void) /* {{{ */
}
/* }}} */
-ZEND_API ZEND_COLD int zend_use_undefined_constant(zend_string *name, zend_ast_attr attr, zval *result) /* {{{ */
-{
- char *colon;
-
- if (UNEXPECTED(EG(exception))) {
- return FAILURE;
- } else if ((colon = (char*)zend_memrchr(ZSTR_VAL(name), ':', ZSTR_LEN(name)))) {
- zend_throw_error(NULL, "Undefined class constant '%s'", ZSTR_VAL(name));
- return FAILURE;
- } else if ((attr & IS_CONSTANT_UNQUALIFIED) == 0) {
- zend_throw_error(NULL, "Undefined constant '%s'", ZSTR_VAL(name));
- return FAILURE;
- } else {
- char *actual = ZSTR_VAL(name);
- size_t actual_len = ZSTR_LEN(name);
- char *slash = (char *) zend_memrchr(actual, '\\', actual_len);
-
- if (slash) {
- actual = slash + 1;
- actual_len -= (actual - ZSTR_VAL(name));
- }
-
- zend_error(E_WARNING, "Use of undefined constant %s - assumed '%s' (this will throw an Error in a future version of PHP)", actual, actual);
- if (EG(exception)) {
- return FAILURE;
- } else {
- zend_string *result_str = zend_string_init(actual, actual_len, 0);
- zval_ptr_dtor_nogc(result);
- ZVAL_NEW_STR(result, result_str);
- }
- }
- return SUCCESS;
-}
-/* }}} */
-
ZEND_API int zval_update_constant_ex(zval *p, zend_class_entry *scope) /* {{{ */
{
if (Z_TYPE_P(p) == IS_CONSTANT_AST) {
@@ -603,10 +566,10 @@ ZEND_API int zval_update_constant_ex(zval *p, zend_class_entry *scope) /* {{{ */
if (ast->kind == ZEND_AST_CONSTANT) {
zend_string *name = zend_ast_get_constant_name(ast);
zval *zv = zend_get_constant_ex(name, scope, ast->attr);
-
if (UNEXPECTED(zv == NULL)) {
- return zend_use_undefined_constant(name, ast->attr, p);
+ return FAILURE;
}
+
zval_ptr_dtor_nogc(p);
ZVAL_COPY_OR_DUP(p, zv);
} else {
@@ -708,20 +671,9 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /
EG(current_execute_data) = dummy_execute_data.prev_execute_data;
}
return FAILURE;
- } else if (error) {
- /* Capitalize the first latter of the error message */
- if (error[0] >= 'a' && error[0] <= 'z') {
- error[0] += ('A' - 'a');
- }
- zend_error(E_DEPRECATED, "%s", error);
- efree(error);
- if (UNEXPECTED(EG(exception))) {
- if (EG(current_execute_data) == &dummy_execute_data) {
- EG(current_execute_data) = dummy_execute_data.prev_execute_data;
- }
- return FAILURE;
- }
}
+
+ ZEND_ASSERT(!error);
}
func = fci_cache->function_handler;
@@ -815,8 +767,10 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /
/* We must re-initialize function again */
fci_cache->function_handler = NULL;
}
- } else if (func->type == ZEND_INTERNAL_FUNCTION) {
+ } else {
int call_via_handler = (func->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) != 0;
+
+ ZEND_ASSERT(func->type == ZEND_INTERNAL_FUNCTION);
ZVAL_NULL(fci->retval);
call->prev_execute_data = EG(current_execute_data);
EG(current_execute_data) = call;
@@ -838,30 +792,6 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /
/* We must re-initialize function again */
fci_cache->function_handler = NULL;
}
- } else { /* ZEND_OVERLOADED_FUNCTION */
- ZVAL_NULL(fci->retval);
-
- /* Not sure what should be done here if it's a static method */
- if (fci->object) {
- call->prev_execute_data = EG(current_execute_data);
- EG(current_execute_data) = call;
- fci->object->handlers->call_method(func->common.function_name, fci->object, call, fci->retval);
- EG(current_execute_data) = call->prev_execute_data;
- } else {
- zend_throw_error(NULL, "Cannot call overloaded function for non-object");
- }
-
- zend_vm_stack_free_args(call);
-
- if (func->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY) {
- zend_string_release_ex(func->common.function_name, 0);
- }
- efree(func);
-
- if (EG(exception)) {
- zval_ptr_dtor(fci->retval);
- ZVAL_UNDEF(fci->retval);
- }
}
zend_vm_stack_free_call_frame(call);
@@ -937,16 +867,10 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, zend_string *
}
if (!EG(autoload_func)) {
- zend_function *func = zend_fetch_function(ZSTR_KNOWN(ZEND_STR_MAGIC_AUTOLOAD));
-
- if (func) {
- EG(autoload_func) = func;
- } else {
- if (!key) {
- zend_string_release_ex(lc_name, 0);
- }
- return NULL;
+ if (!key) {
+ zend_string_release_ex(lc_name, 0);
}
+ return NULL;
}
@@ -1051,7 +975,7 @@ ZEND_API zend_object *zend_get_this_object(zend_execute_data *ex) /* {{{ */
}
/* }}} */
-ZEND_API int zend_eval_stringl(char *str, size_t str_len, zval *retval_ptr, char *string_name) /* {{{ */
+ZEND_API int zend_eval_stringl(const char *str, size_t str_len, zval *retval_ptr, const char *string_name) /* {{{ */
{
zval pv;
zend_op_array *new_op_array;
@@ -1115,13 +1039,13 @@ ZEND_API int zend_eval_stringl(char *str, size_t str_len, zval *retval_ptr, char
}
/* }}} */
-ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name) /* {{{ */
+ZEND_API int zend_eval_string(const char *str, zval *retval_ptr, const char *string_name) /* {{{ */
{
return zend_eval_stringl(str, strlen(str), retval_ptr, string_name);
}
/* }}} */
-ZEND_API int zend_eval_stringl_ex(char *str, size_t str_len, zval *retval_ptr, char *string_name, int handle_exceptions) /* {{{ */
+ZEND_API int zend_eval_stringl_ex(const char *str, size_t str_len, zval *retval_ptr, const char *string_name, int handle_exceptions) /* {{{ */
{
int result;
@@ -1134,7 +1058,7 @@ ZEND_API int zend_eval_stringl_ex(char *str, size_t str_len, zval *retval_ptr, c
}
/* }}} */
-ZEND_API int zend_eval_string_ex(char *str, zval *retval_ptr, char *string_name, int handle_exceptions) /* {{{ */
+ZEND_API int zend_eval_string_ex(const char *str, zval *retval_ptr, const char *string_name, int handle_exceptions) /* {{{ */
{
return zend_eval_stringl_ex(str, strlen(str), retval_ptr, string_name, handle_exceptions);
}
diff --git a/Zend/zend_extensions.h b/Zend/zend_extensions.h
index 19cbf557c5..87c7748c36 100644
--- a/Zend/zend_extensions.h
+++ b/Zend/zend_extensions.h
@@ -44,7 +44,7 @@ You can use the following macro to check the extension API version for compatibi
/* The first number is the engine version and the rest is the date (YYYYMMDD).
* This way engine 2/3 API no. is always greater than engine 1 API no.. */
-#define ZEND_EXTENSION_API_NO 320190902
+#define ZEND_EXTENSION_API_NO 420190128
typedef struct _zend_extension_version_info {
int zend_extension_api_no;
diff --git a/Zend/zend_gc.c b/Zend/zend_gc.c
index 7cecd53410..30698f4484 100644
--- a/Zend/zend_gc.c
+++ b/Zend/zend_gc.c
@@ -702,10 +702,8 @@ tail_call:
if (EXPECTED(!(OBJ_FLAGS(ref) & IS_OBJ_FREE_CALLED))) {
int n;
zval *zv, *end;
- zval tmp;
- ZVAL_OBJ(&tmp, obj);
- ht = obj->handlers->get_gc(&tmp, &zv, &n);
+ ht = obj->handlers->get_gc(obj, &zv, &n);
end = zv + n;
if (EXPECTED(!ht) || UNEXPECTED(GC_REF_CHECK_COLOR(ht, GC_BLACK))) {
ht = NULL;
@@ -822,10 +820,8 @@ static void gc_mark_grey(zend_refcounted *ref, gc_stack *stack)
if (EXPECTED(!(OBJ_FLAGS(ref) & IS_OBJ_FREE_CALLED))) {
int n;
zval *zv, *end;
- zval tmp;
- ZVAL_OBJ(&tmp, obj);
- ht = obj->handlers->get_gc(&tmp, &zv, &n);
+ ht = obj->handlers->get_gc(obj, &zv, &n);
end = zv + n;
if (EXPECTED(!ht) || UNEXPECTED(GC_REF_CHECK_COLOR(ht, GC_GREY))) {
ht = NULL;
@@ -1008,10 +1004,8 @@ tail_call:
if (EXPECTED(!(OBJ_FLAGS(ref) & IS_OBJ_FREE_CALLED))) {
int n;
zval *zv, *end;
- zval tmp;
- ZVAL_OBJ(&tmp, obj);
- ht = obj->handlers->get_gc(&tmp, &zv, &n);
+ ht = obj->handlers->get_gc(obj, &zv, &n);
end = zv + n;
if (EXPECTED(!ht) || UNEXPECTED(!GC_REF_CHECK_COLOR(ht, GC_GREY))) {
ht = NULL;
@@ -1171,7 +1165,6 @@ static int gc_collect_white(zend_refcounted *ref, uint32_t *flags, gc_stack *sta
if (EXPECTED(!(OBJ_FLAGS(ref) & IS_OBJ_FREE_CALLED))) {
int n;
zval *zv, *end;
- zval tmp;
/* optimization: color is GC_BLACK (0) */
if (!GC_INFO(ref)) {
@@ -1182,8 +1175,7 @@ static int gc_collect_white(zend_refcounted *ref, uint32_t *flags, gc_stack *sta
|| obj->ce->destructor != NULL)) {
*flags |= GC_HAS_DESTRUCTORS;
}
- ZVAL_OBJ(&tmp, obj);
- ht = obj->handlers->get_gc(&tmp, &zv, &n);
+ ht = obj->handlers->get_gc(obj, &zv, &n);
end = zv + n;
if (EXPECTED(!ht) || UNEXPECTED(GC_REF_CHECK_COLOR(ht, GC_BLACK))) {
ht = NULL;
@@ -1357,10 +1349,8 @@ tail_call:
if (EXPECTED(!(OBJ_FLAGS(ref) & IS_OBJ_FREE_CALLED))) {
int n;
zval *zv, *end;
- zval tmp;
- ZVAL_OBJ(&tmp, obj);
- ht = obj->handlers->get_gc(&tmp, &zv, &n);
+ ht = obj->handlers->get_gc(obj, &zv, &n);
end = zv + n;
if (EXPECTED(!ht)) {
if (!n) return count;
diff --git a/Zend/zend_gdb.c b/Zend/zend_gdb.c
new file mode 100644
index 0000000000..0fff742048
--- /dev/null
+++ b/Zend/zend_gdb.c
@@ -0,0 +1,141 @@
+/*
+ +----------------------------------------------------------------------+
+ | Zend Engine |
+ +----------------------------------------------------------------------+
+ | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 2.00 of the Zend license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.zend.com/license/2_00.txt. |
+ | If you did not receive a copy of the Zend license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@zend.com so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Dmitry Stogov <dmitry@zend.com> |
+ | Xinchen Hui <xinchen.h@zend.com> |
+ +----------------------------------------------------------------------+
+*/
+
+#include "zend.h"
+#include "zend_gdb.h"
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+enum {
+ ZEND_GDBJIT_NOACTION,
+ ZEND_GDBJIT_REGISTER,
+ ZEND_GDBJIT_UNREGISTER
+};
+
+typedef struct _zend_gdbjit_code_entry {
+ struct _zend_gdbjit_code_entry *next_entry;
+ struct _zend_gdbjit_code_entry *prev_entry;
+ const char *symfile_addr;
+ uint64_t symfile_size;
+} zend_gdbjit_code_entry;
+
+typedef struct _zend_gdbjit_descriptor {
+ uint32_t version;
+ uint32_t action_flag;
+ struct _zend_gdbjit_code_entry *relevant_entry;
+ struct _zend_gdbjit_code_entry *first_entry;
+} zend_gdbjit_descriptor;
+
+ZEND_API zend_gdbjit_descriptor __jit_debug_descriptor = {
+ 1, ZEND_GDBJIT_NOACTION, NULL, NULL
+};
+
+ZEND_API zend_never_inline void __jit_debug_register_code()
+{
+ __asm__ __volatile__("");
+}
+
+ZEND_API int zend_gdb_register_code(const void *object, size_t size)
+{
+ zend_gdbjit_code_entry *entry;
+
+ entry = malloc(sizeof(zend_gdbjit_code_entry) + size);
+ if (entry == NULL) {
+ return 0;
+ }
+
+ entry->symfile_addr = ((char*)entry) + sizeof(zend_gdbjit_code_entry);
+ entry->symfile_size = size;
+
+ memcpy((char *)entry->symfile_addr, object, size);
+
+ entry->prev_entry = NULL;
+ entry->next_entry = __jit_debug_descriptor.first_entry;
+
+ if (entry->next_entry) {
+ entry->next_entry->prev_entry = entry;
+ }
+ __jit_debug_descriptor.first_entry = entry;
+
+ /* Notify GDB */
+ __jit_debug_descriptor.relevant_entry = entry;
+ __jit_debug_descriptor.action_flag = ZEND_GDBJIT_REGISTER;
+ __jit_debug_register_code();
+
+ return 1;
+}
+
+ZEND_API void zend_gdb_unregister_all(void)
+{
+ zend_gdbjit_code_entry *entry;
+
+ __jit_debug_descriptor.action_flag = ZEND_GDBJIT_UNREGISTER;
+ while ((entry = __jit_debug_descriptor.first_entry)) {
+ __jit_debug_descriptor.first_entry = entry->next_entry;
+ if (entry->next_entry) {
+ entry->next_entry->prev_entry = NULL;
+ }
+ /* Notify GDB */
+ __jit_debug_descriptor.relevant_entry = entry;
+ __jit_debug_register_code();
+
+ free(entry);
+ }
+}
+
+ZEND_API int zend_gdb_present(void)
+{
+ int ret = 0;
+ int fd = open("/proc/self/status", O_RDONLY);
+
+ if (fd > 0) {
+ char buf[1024];
+ ssize_t n = read(fd, buf, sizeof(buf) - 1);
+ char *s;
+ pid_t pid;
+
+ if (n > 0) {
+ buf[n] = 0;
+ s = strstr(buf, "TracerPid:");
+ if (s) {
+ s += sizeof("TracerPid:") - 1;
+ while (*s == ' ' || *s == '\t') {
+ s++;
+ }
+ pid = atoi(s);
+ if (pid) {
+ char out[1024];
+ sprintf(buf, "/proc/%d/exe", (int)pid);
+ if (readlink(buf, out, sizeof(out) - 1) > 0) {
+ if (strstr(out, "gdb")) {
+ ret = 1;
+ }
+ }
+ }
+ }
+ }
+
+ close(fd);
+ }
+
+ return ret;
+}
diff --git a/Zend/zend_gdb.h b/Zend/zend_gdb.h
new file mode 100644
index 0000000000..220b70888f
--- /dev/null
+++ b/Zend/zend_gdb.h
@@ -0,0 +1,27 @@
+/*
+ +----------------------------------------------------------------------+
+ | Zend Engine |
+ +----------------------------------------------------------------------+
+ | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 2.00 of the Zend license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.zend.com/license/2_00.txt. |
+ | If you did not receive a copy of the Zend license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@zend.com so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Dmitry Stogov <dmitry@zend.com> |
+ | Xinchen Hui <laruence@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+#ifndef ZEND_GDB
+#define ZEND_GDB
+
+ZEND_API int zend_gdb_register_code(const void *object, size_t size);
+ZEND_API void zend_gdb_unregister_all(void);
+ZEND_API int zend_gdb_present(void);
+
+#endif
diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c
index 7031e9a810..ce79dca537 100644
--- a/Zend/zend_generators.c
+++ b/Zend/zend_generators.c
@@ -23,6 +23,7 @@
#include "zend_exceptions.h"
#include "zend_generators.h"
#include "zend_closures.h"
+#include "zend_generators_arginfo.h"
ZEND_API zend_class_entry *zend_ce_generator;
ZEND_API zend_class_entry *zend_ce_ClosedGeneratorException;
@@ -328,9 +329,9 @@ static uint32_t calc_gc_buffer_size(zend_generator *generator) /* {{{ */
}
/* }}} */
-static HashTable *zend_generator_get_gc(zval *object, zval **table, int *n) /* {{{ */
+static HashTable *zend_generator_get_gc(zend_object *object, zval **table, int *n) /* {{{ */
{
- zend_generator *generator = (zend_generator*) Z_OBJ_P(object);
+ zend_generator *generator = (zend_generator*)object;
zend_execute_data *execute_data = generator->execute_data;
zend_op_array *op_array;
zval *gc_buffer;
@@ -894,9 +895,7 @@ ZEND_METHOD(Generator, rewind)
{
zend_generator *generator;
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
generator = (zend_generator *) Z_OBJ_P(ZEND_THIS);
@@ -910,9 +909,7 @@ ZEND_METHOD(Generator, valid)
{
zend_generator *generator;
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
generator = (zend_generator *) Z_OBJ_P(ZEND_THIS);
@@ -930,9 +927,7 @@ ZEND_METHOD(Generator, current)
{
zend_generator *generator, *root;
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
generator = (zend_generator *) Z_OBJ_P(ZEND_THIS);
@@ -953,9 +948,7 @@ ZEND_METHOD(Generator, key)
{
zend_generator *generator, *root;
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
generator = (zend_generator *) Z_OBJ_P(ZEND_THIS);
@@ -976,9 +969,7 @@ ZEND_METHOD(Generator, next)
{
zend_generator *generator;
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
generator = (zend_generator *) Z_OBJ_P(ZEND_THIS);
@@ -1033,7 +1024,7 @@ ZEND_METHOD(Generator, throw)
zend_generator *generator;
ZEND_PARSE_PARAMETERS_START(1, 1)
- Z_PARAM_ZVAL(exception)
+ Z_PARAM_OBJECT_OF_CLASS(exception, zend_ce_throwable);
ZEND_PARSE_PARAMETERS_END();
Z_TRY_ADDREF_P(exception);
@@ -1069,9 +1060,7 @@ ZEND_METHOD(Generator, getReturn)
{
zend_generator *generator;
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
generator = (zend_generator *) Z_OBJ_P(ZEND_THIS);
@@ -1198,26 +1187,15 @@ zend_object_iterator *zend_generator_get_iterator(zend_class_entry *ce, zval *ob
}
/* }}} */
-ZEND_BEGIN_ARG_INFO(arginfo_generator_void, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_generator_send, 0, 0, 1)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_generator_throw, 0, 0, 1)
- ZEND_ARG_INFO(0, exception)
-ZEND_END_ARG_INFO()
-
static const zend_function_entry generator_functions[] = {
- ZEND_ME(Generator, rewind, arginfo_generator_void, ZEND_ACC_PUBLIC)
- ZEND_ME(Generator, valid, arginfo_generator_void, ZEND_ACC_PUBLIC)
- ZEND_ME(Generator, current, arginfo_generator_void, ZEND_ACC_PUBLIC)
- ZEND_ME(Generator, key, arginfo_generator_void, ZEND_ACC_PUBLIC)
- ZEND_ME(Generator, next, arginfo_generator_void, ZEND_ACC_PUBLIC)
- ZEND_ME(Generator, send, arginfo_generator_send, ZEND_ACC_PUBLIC)
- ZEND_ME(Generator, throw, arginfo_generator_throw, ZEND_ACC_PUBLIC)
- ZEND_ME(Generator, getReturn,arginfo_generator_void, ZEND_ACC_PUBLIC)
+ ZEND_ME(Generator, rewind, arginfo_class_Generator_rewind, ZEND_ACC_PUBLIC)
+ ZEND_ME(Generator, valid, arginfo_class_Generator_valid, ZEND_ACC_PUBLIC)
+ ZEND_ME(Generator, current, arginfo_class_Generator_current, ZEND_ACC_PUBLIC)
+ ZEND_ME(Generator, key, arginfo_class_Generator_key, ZEND_ACC_PUBLIC)
+ ZEND_ME(Generator, next, arginfo_class_Generator_next, ZEND_ACC_PUBLIC)
+ ZEND_ME(Generator, send, arginfo_class_Generator_send, ZEND_ACC_PUBLIC)
+ ZEND_ME(Generator, throw, arginfo_class_Generator_throw, ZEND_ACC_PUBLIC)
+ ZEND_ME(Generator, getReturn,arginfo_class_Generator_getReturn, ZEND_ACC_PUBLIC)
ZEND_FE_END
};
diff --git a/Zend/zend_generators.stub.php b/Zend/zend_generators.stub.php
new file mode 100644
index 0000000000..759bd4cd48
--- /dev/null
+++ b/Zend/zend_generators.stub.php
@@ -0,0 +1,20 @@
+<?php
+
+final class Generator implements Iterator
+{
+ function rewind(): void {}
+
+ function valid(): bool {}
+
+ function current() {}
+
+ function key() {}
+
+ function next(): void {}
+
+ function send($value) {}
+
+ function throw(Throwable $exception) {}
+
+ function getReturn() {}
+}
diff --git a/Zend/zend_generators_arginfo.h b/Zend/zend_generators_arginfo.h
new file mode 100644
index 0000000000..a65d6b1b12
--- /dev/null
+++ b/Zend/zend_generators_arginfo.h
@@ -0,0 +1,24 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Generator_rewind, 0, 0, IS_VOID, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Generator_valid, 0, 0, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Generator_current, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_Generator_key arginfo_class_Generator_current
+
+#define arginfo_class_Generator_next arginfo_class_Generator_rewind
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Generator_send, 0, 0, 1)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Generator_throw, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, exception, Throwable, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_Generator_getReturn arginfo_class_Generator_current
diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h
index 2e9fff40ad..2dc769a5ef 100644
--- a/Zend/zend_globals.h
+++ b/Zend/zend_globals.h
@@ -234,8 +234,6 @@ struct _zend_executor_globals {
zend_function trampoline;
zend_op call_trampoline_op;
- zend_bool each_deprecation_thrown;
-
HashTable weakrefs;
zend_bool exception_ignore_args;
diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c
index c2c8cf825f..7a251ecaca 100644
--- a/Zend/zend_hash.c
+++ b/Zend/zend_hash.c
@@ -102,14 +102,14 @@ static zend_always_inline uint32_t zend_hash_check_size(uint32_t nSize)
#if defined(ZEND_WIN32)
if (BitScanReverse(&index, nSize - 1)) {
- return 0x2 << ((31 - index) ^ 0x1f);
+ return 0x2u << ((31 - index) ^ 0x1f);
} else {
/* nSize is ensured to be in the valid range, fall back to it
rather than using an undefined bis scan result. */
return nSize;
}
#elif (defined(__GNUC__) || __has_builtin(__builtin_clz)) && defined(PHP_HAVE_BUILTIN_CLZ)
- return 0x2 << (__builtin_clz(nSize - 1) ^ 0x1f);
+ return 0x2u << (__builtin_clz(nSize - 1) ^ 0x1f);
#else
nSize -= 1;
nSize |= (nSize >> 1);
@@ -234,7 +234,7 @@ static zend_always_inline void _zend_hash_init_int(HashTable *ht, uint32_t nSize
ht->nNumUsed = 0;
ht->nNumOfElements = 0;
ht->nInternalPointer = 0;
- ht->nNextFreeElement = 0;
+ ht->nNextFreeElement = ZEND_LONG_MIN;
ht->pDestructor = pDestructor;
ht->nTableSize = zend_hash_check_size(nSize);
}
@@ -964,6 +964,10 @@ static zend_always_inline zval *_zend_hash_index_add_or_update_i(HashTable *ht,
IS_CONSISTENT(ht);
HT_ASSERT_RC1(ht);
+ if ((flag & HASH_ADD_NEXT) && h == ZEND_LONG_MIN) {
+ h = 0;
+ }
+
if (HT_FLAGS(ht) & HASH_FLAG_PACKED) {
if (h < ht->nNumUsed) {
p = ht->arData + h;
@@ -1028,8 +1032,8 @@ convert_to_hash:
p = ht->arData + idx;
Z_NEXT(p->val) = HT_HASH(ht, nIndex);
HT_HASH(ht, nIndex) = HT_IDX_TO_HASH(idx);
- if ((zend_long)h >= (zend_long)ht->nNextFreeElement) {
- ht->nNextFreeElement = h < ZEND_LONG_MAX ? h + 1 : ZEND_LONG_MAX;
+ if ((zend_long)h >= ht->nNextFreeElement) {
+ ht->nNextFreeElement = (zend_long)h < ZEND_LONG_MAX ? h + 1 : ZEND_LONG_MAX;
}
add:
ht->nNumOfElements++;
@@ -1168,7 +1172,7 @@ static void ZEND_FASTCALL zend_hash_do_resize(HashTable *ht)
}
}
-ZEND_API int ZEND_FASTCALL zend_hash_rehash(HashTable *ht)
+ZEND_API void ZEND_FASTCALL zend_hash_rehash(HashTable *ht)
{
Bucket *p;
uint32_t nIndex, i;
@@ -1180,7 +1184,7 @@ ZEND_API int ZEND_FASTCALL zend_hash_rehash(HashTable *ht)
ht->nNumUsed = 0;
HT_HASH_RESET(ht);
}
- return SUCCESS;
+ return;
}
HT_HASH_RESET(ht);
@@ -1258,7 +1262,6 @@ ZEND_API int ZEND_FASTCALL zend_hash_rehash(HashTable *ht)
_zend_hash_iterators_update(ht, old_num_used, ht->nNumUsed);
}
}
- return SUCCESS;
}
static zend_always_inline void _zend_hash_del_el_ex(HashTable *ht, uint32_t idx, Bucket *p, Bucket *prev)
@@ -1702,7 +1705,7 @@ ZEND_API void ZEND_FASTCALL zend_hash_clean(HashTable *ht)
}
ht->nNumUsed = 0;
ht->nNumOfElements = 0;
- ht->nNextFreeElement = 0;
+ ht->nNextFreeElement = ZEND_LONG_MIN;
ht->nInternalPointer = 0;
}
@@ -1741,7 +1744,7 @@ ZEND_API void ZEND_FASTCALL zend_symtable_clean(HashTable *ht)
}
ht->nNumUsed = 0;
ht->nNumOfElements = 0;
- ht->nNextFreeElement = 0;
+ ht->nNextFreeElement = ZEND_LONG_MIN;
ht->nInternalPointer = 0;
}
@@ -2055,7 +2058,7 @@ ZEND_API HashTable* ZEND_FASTCALL zend_array_dup(HashTable *source)
target->nTableMask = HT_MIN_MASK;
target->nNumUsed = 0;
target->nNumOfElements = 0;
- target->nNextFreeElement = 0;
+ target->nNextFreeElement = ZEND_LONG_MIN;
target->nInternalPointer = 0;
target->nTableSize = HT_MIN_SIZE;
HT_SET_DATA_ADDR(target, &uninitialized_bucket);
@@ -2465,7 +2468,7 @@ ZEND_API void zend_hash_bucket_packed_swap(Bucket *p, Bucket *q)
q->h = h;
}
-ZEND_API int ZEND_FASTCALL zend_hash_sort_ex(HashTable *ht, sort_func_t sort, compare_func_t compar, zend_bool renumber)
+ZEND_API void ZEND_FASTCALL zend_hash_sort_ex(HashTable *ht, sort_func_t sort, compare_func_t compar, zend_bool renumber)
{
Bucket *p;
uint32_t i, j;
@@ -2474,7 +2477,7 @@ ZEND_API int ZEND_FASTCALL zend_hash_sort_ex(HashTable *ht, sort_func_t sort, co
HT_ASSERT_RC1(ht);
if (!(ht->nNumOfElements>1) && !(renumber && ht->nNumOfElements>0)) { /* Doesn't require sorting */
- return SUCCESS;
+ return;
}
if (HT_IS_WITHOUT_HOLES(ht)) {
@@ -2529,8 +2532,6 @@ ZEND_API int ZEND_FASTCALL zend_hash_sort_ex(HashTable *ht, sort_func_t sort, co
zend_hash_rehash(ht);
}
}
-
- return SUCCESS;
}
static zend_always_inline int zend_hash_compare_impl(HashTable *ht1, HashTable *ht2, compare_func_t compar, zend_bool ordered) {
diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h
index f1e2d34685..7263c47a82 100644
--- a/Zend/zend_hash.h
+++ b/Zend/zend_hash.h
@@ -265,7 +265,7 @@ ZEND_API void zend_hash_bucket_swap(Bucket *p, Bucket *q);
ZEND_API void zend_hash_bucket_renum_swap(Bucket *p, Bucket *q);
ZEND_API void zend_hash_bucket_packed_swap(Bucket *p, Bucket *q);
ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t compar, zend_bool ordered);
-ZEND_API int ZEND_FASTCALL zend_hash_sort_ex(HashTable *ht, sort_func_t sort_func, compare_func_t compare_func, zend_bool renumber);
+ZEND_API void ZEND_FASTCALL zend_hash_sort_ex(HashTable *ht, sort_func_t sort_func, compare_func_t compare_func, zend_bool renumber);
ZEND_API zval* ZEND_FASTCALL zend_hash_minmax(const HashTable *ht, compare_func_t compar, uint32_t flag);
#define zend_hash_sort(ht, compare_func, renumber) \
@@ -277,7 +277,7 @@ ZEND_API zval* ZEND_FASTCALL zend_hash_minmax(const HashTable *ht, compare_func_
#define zend_hash_next_free_element(ht) \
(ht)->nNextFreeElement
-ZEND_API int ZEND_FASTCALL zend_hash_rehash(HashTable *ht);
+ZEND_API void ZEND_FASTCALL zend_hash_rehash(HashTable *ht);
#if !ZEND_DEBUG && defined(HAVE_BUILTIN_CONSTANT_P)
# define zend_new_array(size) \
diff --git a/Zend/zend_highlight.h b/Zend/zend_highlight.h
index 92a4dbccd3..8ea1518ca6 100644
--- a/Zend/zend_highlight.h
+++ b/Zend/zend_highlight.h
@@ -39,8 +39,8 @@ typedef struct _zend_syntax_highlighter_ini {
BEGIN_EXTERN_C()
ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini);
ZEND_API void zend_strip(void);
-ZEND_API int highlight_file(char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini);
-ZEND_API int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, char *str_name);
+ZEND_API int highlight_file(const char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini);
+ZEND_API int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, const char *str_name);
ZEND_API void zend_html_putc(char c);
ZEND_API void zend_html_puts(const char *s, size_t len);
END_EXTERN_C()
diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c
index 6bd35a6bb7..5abe1c55d4 100644
--- a/Zend/zend_inheritance.c
+++ b/Zend/zend_inheritance.c
@@ -29,8 +29,7 @@
static void add_dependency_obligation(zend_class_entry *ce, zend_class_entry *dependency_ce);
static void add_compatibility_obligation(
- zend_class_entry *ce, const zend_function *child_fn, const zend_function *parent_fn,
- zend_bool always_error);
+ zend_class_entry *ce, const zend_function *child_fn, const zend_function *parent_fn);
static void add_property_compatibility_obligation(
zend_class_entry *ce, const zend_property_info *child_prop,
const zend_property_info *parent_prop);
@@ -41,14 +40,31 @@ static void overridden_ptr_dtor(zval *zv) /* {{{ */
}
/* }}} */
+static void zend_type_copy_ctor(zend_type *type, zend_bool persistent) {
+ if (ZEND_TYPE_HAS_LIST(*type)) {
+ zend_type_list *old_list = ZEND_TYPE_LIST(*type);
+ size_t size = ZEND_TYPE_LIST_SIZE(old_list->num_types);
+ zend_type_list *new_list = ZEND_TYPE_USES_ARENA(*type)
+ ? zend_arena_alloc(&CG(arena), size) : pemalloc(size, persistent);
+ memcpy(new_list, old_list, ZEND_TYPE_LIST_SIZE(old_list->num_types));
+ ZEND_TYPE_SET_PTR(*type, new_list);
+
+ zend_type *list_type;
+ ZEND_TYPE_LIST_FOREACH(new_list, list_type) {
+ ZEND_ASSERT(ZEND_TYPE_HAS_NAME(*list_type));
+ zend_string_addref(ZEND_TYPE_NAME(*list_type));
+ } ZEND_TYPE_LIST_FOREACH_END();
+ } else if (ZEND_TYPE_HAS_NAME(*type)) {
+ zend_string_addref(ZEND_TYPE_NAME(*type));
+ }
+}
+
static zend_property_info *zend_duplicate_property_info_internal(zend_property_info *property_info) /* {{{ */
{
zend_property_info* new_property_info = pemalloc(sizeof(zend_property_info), 1);
memcpy(new_property_info, property_info, sizeof(zend_property_info));
zend_string_addref(new_property_info->name);
- if (ZEND_TYPE_IS_NAME(new_property_info->type)) {
- zend_string_addref(ZEND_TYPE_NAME(new_property_info->type));
- }
+ zend_type_copy_ctor(&new_property_info->type, /* persistent */ 1);
return new_property_info;
}
@@ -220,7 +236,8 @@ static zend_bool class_visible(zend_class_entry *ce) {
}
}
-static zend_class_entry *lookup_class(zend_class_entry *scope, zend_string *name) {
+static zend_class_entry *lookup_class(
+ zend_class_entry *scope, zend_string *name, zend_bool register_unresolved) {
zend_class_entry *ce;
if (!CG(in_compilation)) {
uint32_t flags = ZEND_FETCH_CLASS_ALLOW_UNLINKED | ZEND_FETCH_CLASS_NO_AUTOLOAD;
@@ -229,12 +246,14 @@ static zend_class_entry *lookup_class(zend_class_entry *scope, zend_string *name
return ce;
}
- /* We'll autoload this class and process delayed variance obligations later. */
- if (!CG(delayed_autoloads)) {
- ALLOC_HASHTABLE(CG(delayed_autoloads));
- zend_hash_init(CG(delayed_autoloads), 0, NULL, NULL, 0);
+ if (register_unresolved) {
+ /* We'll autoload this class and process delayed variance obligations later. */
+ if (!CG(delayed_autoloads)) {
+ ALLOC_HASHTABLE(CG(delayed_autoloads));
+ zend_hash_init(CG(delayed_autoloads), 0, NULL, NULL, 0);
+ }
+ zend_hash_add_empty_element(CG(delayed_autoloads), name);
}
- zend_hash_add_empty_element(CG(delayed_autoloads), name);
} else {
ce = zend_lookup_class_ex(name, NULL, ZEND_FETCH_CLASS_NO_AUTOLOAD);
if (ce && class_visible(ce)) {
@@ -303,6 +322,17 @@ static zend_bool unlinked_instanceof(zend_class_entry *ce1, zend_class_entry *ce
return 0;
}
+static zend_bool zend_type_contains_traversable(zend_type type) {
+ zend_type *single_type;
+ ZEND_TYPE_FOREACH(type, single_type) {
+ if (ZEND_TYPE_HAS_NAME(*single_type)
+ && zend_string_equals_literal_ci(ZEND_TYPE_NAME(*single_type), "Traversable")) {
+ return 1;
+ }
+ } ZEND_TYPE_FOREACH_END();
+ return 0;
+}
+
/* Unresolved means that class declarations that are currently not available are needed to
* determine whether the inheritance is valid or not. At runtime UNRESOLVED should be treated
* as an ERROR. */
@@ -312,85 +342,136 @@ typedef enum {
INHERITANCE_SUCCESS = 1,
} inheritance_status;
+static inheritance_status zend_perform_covariant_class_type_check(
+ zend_class_entry *fe_scope, zend_string *fe_class_name,
+ zend_class_entry *proto_scope, zend_type proto_type,
+ zend_bool register_unresolved) {
+ zend_bool have_unresolved = 0;
+ zend_class_entry *fe_ce = NULL;
+ if (ZEND_TYPE_FULL_MASK(proto_type) & MAY_BE_OBJECT) {
+ /* Currently, any class name would be allowed here. We still perform a class lookup
+ * for forward-compatibility reasons, as we may have named types in the future that
+ * are not classes (such as enums or typedefs). */
+ if (!fe_ce) fe_ce = lookup_class(fe_scope, fe_class_name, register_unresolved);
+ if (!fe_ce) {
+ have_unresolved = 1;
+ } else {
+ return INHERITANCE_SUCCESS;
+ }
+ }
+ if (ZEND_TYPE_FULL_MASK(proto_type) & MAY_BE_ITERABLE) {
+ if (!fe_ce) fe_ce = lookup_class(fe_scope, fe_class_name, register_unresolved);
+ if (!fe_ce) {
+ have_unresolved = 1;
+ } else if (unlinked_instanceof(fe_ce, zend_ce_traversable)) {
+ return INHERITANCE_SUCCESS;
+ }
+ }
+
+ zend_type *single_type;
+ ZEND_TYPE_FOREACH(proto_type, single_type) {
+ if (ZEND_TYPE_HAS_NAME(*single_type)) {
+ zend_string *proto_class_name =
+ resolve_class_name(proto_scope, ZEND_TYPE_NAME(*single_type));
+ if (zend_string_equals_ci(fe_class_name, proto_class_name)) {
+ return INHERITANCE_SUCCESS;
+ }
+
+ /* Make sure to always load both classes, to avoid only registering one of them as
+ * a delayed autoload. */
+ if (!fe_ce) fe_ce = lookup_class(fe_scope, fe_class_name, register_unresolved);
+ zend_class_entry *proto_ce =
+ lookup_class(proto_scope, proto_class_name, register_unresolved);
+ if (!fe_ce || !proto_ce) {
+ have_unresolved = 1;
+ } else if (unlinked_instanceof(fe_ce, proto_ce)) {
+ return INHERITANCE_SUCCESS;
+ }
+ }
+ } ZEND_TYPE_FOREACH_END();
+
+ return have_unresolved ? INHERITANCE_UNRESOLVED : INHERITANCE_ERROR;
+}
+
static inheritance_status zend_perform_covariant_type_check(
- zend_string **unresolved_class,
- const zend_function *fe, zend_arg_info *fe_arg_info,
- const zend_function *proto, zend_arg_info *proto_arg_info) /* {{{ */
+ zend_class_entry *fe_scope, zend_type fe_type,
+ zend_class_entry *proto_scope, zend_type proto_type) /* {{{ */
{
- zend_type fe_type = fe_arg_info->type, proto_type = proto_arg_info->type;
ZEND_ASSERT(ZEND_TYPE_IS_SET(fe_type) && ZEND_TYPE_IS_SET(proto_type));
- if (ZEND_TYPE_ALLOW_NULL(fe_type) && !ZEND_TYPE_ALLOW_NULL(proto_type)) {
- return INHERITANCE_ERROR;
- }
-
- if (ZEND_TYPE_IS_CLASS(proto_type)) {
- zend_string *fe_class_name, *proto_class_name;
- zend_class_entry *fe_ce, *proto_ce;
- if (!ZEND_TYPE_IS_CLASS(fe_type)) {
+ /* Builtin types may be removed, but not added */
+ uint32_t fe_type_mask = ZEND_TYPE_PURE_MASK(fe_type);
+ uint32_t proto_type_mask = ZEND_TYPE_PURE_MASK(proto_type);
+ uint32_t added_types = fe_type_mask & ~proto_type_mask;
+ if (added_types) {
+ // TODO: Make "iterable" an alias of "array|Traversable" instead,
+ // so these special cases will be handled automatically.
+ if (added_types == MAY_BE_ITERABLE
+ && (proto_type_mask & MAY_BE_ARRAY)
+ && zend_type_contains_traversable(proto_type)) {
+ /* Replacing array|Traversable with iterable is okay */
+ } else if (added_types == MAY_BE_ARRAY && (proto_type_mask & MAY_BE_ITERABLE)) {
+ /* Replacing iterable with array is okay */
+ } else {
+ /* Otherwise adding new types is illegal */
return INHERITANCE_ERROR;
}
+ }
- fe_class_name = resolve_class_name(fe->common.scope, ZEND_TYPE_NAME(fe_type));
- proto_class_name = resolve_class_name(proto->common.scope, ZEND_TYPE_NAME(proto_type));
- if (zend_string_equals_ci(fe_class_name, proto_class_name)) {
- return INHERITANCE_SUCCESS;
+ if (ZEND_TYPE_HAS_NAME(fe_type)) {
+ zend_string *fe_class_name = resolve_class_name(fe_scope, ZEND_TYPE_NAME(fe_type));
+ inheritance_status status = zend_perform_covariant_class_type_check(
+ fe_scope, fe_class_name, proto_scope, proto_type, /* register_unresolved */ 0);
+ if (status != INHERITANCE_UNRESOLVED) {
+ return status;
}
- /* Make sure to always load both classes, to avoid only registering one of them as
- * a delayed autoload. */
- fe_ce = lookup_class(fe->common.scope, fe_class_name);
- proto_ce = lookup_class(proto->common.scope, proto_class_name);
- if (!fe_ce) {
- *unresolved_class = fe_class_name;
- return INHERITANCE_UNRESOLVED;
- }
- if (!proto_ce) {
- *unresolved_class = proto_class_name;
- return INHERITANCE_UNRESOLVED;
- }
+ zend_perform_covariant_class_type_check(
+ fe_scope, fe_class_name, proto_scope, proto_type, /* register_unresolved */ 1);
+ return INHERITANCE_UNRESOLVED;
+ }
+
+ if (ZEND_TYPE_HAS_LIST(fe_type)) {
+ zend_type *list_type;
+ zend_bool all_success = 1;
- return unlinked_instanceof(fe_ce, proto_ce) ? INHERITANCE_SUCCESS : INHERITANCE_ERROR;
- } else if (ZEND_TYPE_CODE(proto_type) == IS_ITERABLE) {
- if (ZEND_TYPE_IS_CLASS(fe_type)) {
+ /* First try to check whether we can succeed without resolving anything */
+ ZEND_TYPE_LIST_FOREACH(ZEND_TYPE_LIST(fe_type), list_type) {
+ ZEND_ASSERT(ZEND_TYPE_HAS_NAME(*list_type));
zend_string *fe_class_name =
- resolve_class_name(fe->common.scope, ZEND_TYPE_NAME(fe_type));
- zend_class_entry *fe_ce = lookup_class(fe->common.scope, fe_class_name);
- if (!fe_ce) {
- *unresolved_class = fe_class_name;
- return INHERITANCE_UNRESOLVED;
+ resolve_class_name(fe_scope, ZEND_TYPE_NAME(*list_type));
+ inheritance_status status = zend_perform_covariant_class_type_check(
+ fe_scope, fe_class_name, proto_scope, proto_type, /* register_unresolved */ 0);
+ if (status == INHERITANCE_ERROR) {
+ return INHERITANCE_ERROR;
}
- return unlinked_instanceof(fe_ce, zend_ce_traversable)
- ? INHERITANCE_SUCCESS : INHERITANCE_ERROR;
- }
- return ZEND_TYPE_CODE(fe_type) == IS_ITERABLE || ZEND_TYPE_CODE(fe_type) == IS_ARRAY
- ? INHERITANCE_SUCCESS : INHERITANCE_ERROR;
- } else if (ZEND_TYPE_CODE(proto_type) == IS_OBJECT) {
- if (ZEND_TYPE_IS_CLASS(fe_type)) {
- /* Currently, any class name would be allowed here. We still perform a class lookup
- * for forward-compatibility reasons, as we may have named types in the future that
- * are not classes (such as enums or typedefs). */
- zend_string *fe_class_name =
- resolve_class_name(fe->common.scope, ZEND_TYPE_NAME(fe_type));
- zend_class_entry *fe_ce = lookup_class(fe->common.scope, fe_class_name);
- if (!fe_ce) {
- *unresolved_class = fe_class_name;
- return INHERITANCE_UNRESOLVED;
+ if (status != INHERITANCE_SUCCESS) {
+ all_success = 0;
}
+ } ZEND_TYPE_LIST_FOREACH_END();
+
+ /* All individual checks succeeded, overall success */
+ if (all_success) {
return INHERITANCE_SUCCESS;
}
- return ZEND_TYPE_CODE(fe_type) == IS_OBJECT ? INHERITANCE_SUCCESS : INHERITANCE_ERROR;
- } else {
- return ZEND_TYPE_CODE(fe_type) == ZEND_TYPE_CODE(proto_type)
- ? INHERITANCE_SUCCESS : INHERITANCE_ERROR;
+ /* Register all classes that may have to be resolved */
+ ZEND_TYPE_LIST_FOREACH(ZEND_TYPE_LIST(fe_type), list_type) {
+ ZEND_ASSERT(ZEND_TYPE_HAS_NAME(*list_type));
+ zend_string *fe_class_name =
+ resolve_class_name(fe_scope, ZEND_TYPE_NAME(*list_type));
+ zend_perform_covariant_class_type_check(
+ fe_scope, fe_class_name, proto_scope, proto_type, /* register_unresolved */ 1);
+ } ZEND_TYPE_LIST_FOREACH_END();
+ return INHERITANCE_UNRESOLVED;
}
+
+ return INHERITANCE_SUCCESS;
}
/* }}} */
static inheritance_status zend_do_perform_arg_type_hint_check(
- zend_string **unresolved_class,
const zend_function *fe, zend_arg_info *fe_arg_info,
const zend_function *proto, zend_arg_info *proto_arg_info) /* {{{ */
{
@@ -407,15 +488,16 @@ static inheritance_status zend_do_perform_arg_type_hint_check(
/* Contravariant type check is performed as a covariant type check with swapped
* argument order. */
return zend_perform_covariant_type_check(
- unresolved_class, proto, proto_arg_info, fe, fe_arg_info);
+ proto->common.scope, proto_arg_info->type, fe->common.scope, fe_arg_info->type);
}
/* }}} */
static inheritance_status zend_do_perform_implementation_check(
- zend_string **unresolved_class, const zend_function *fe, const zend_function *proto) /* {{{ */
+ const zend_function *fe, const zend_function *proto) /* {{{ */
{
- uint32_t i, num_args;
+ uint32_t i, num_args, proto_num_args, fe_num_args;
inheritance_status status, local_status;
+ zend_bool proto_is_variadic, fe_is_variadic;
/* If it's a user function then arg_info == NULL means we don't have any parameters but
* we still need to do the arg number checks. We are only willing to ignore this for internal
@@ -435,9 +517,8 @@ static inheritance_status zend_do_perform_implementation_check(
/* If the prototype method is private do not enforce a signature */
ZEND_ASSERT(!(proto->common.fn_flags & ZEND_ACC_PRIVATE));
- /* check number of arguments */
- if (proto->common.required_num_args < fe->common.required_num_args
- || proto->common.num_args > fe->common.num_args) {
+ /* The number of required arguments cannot increase. */
+ if (proto->common.required_num_args < fe->common.required_num_args) {
return INHERITANCE_ERROR;
}
@@ -447,39 +528,39 @@ static inheritance_status zend_do_perform_implementation_check(
return INHERITANCE_ERROR;
}
- if ((proto->common.fn_flags & ZEND_ACC_VARIADIC)
- && !(fe->common.fn_flags & ZEND_ACC_VARIADIC)) {
+ proto_is_variadic = (proto->common.fn_flags & ZEND_ACC_VARIADIC) != 0;
+ fe_is_variadic = (fe->common.fn_flags & ZEND_ACC_VARIADIC) != 0;
+
+ /* A variadic function cannot become non-variadic */
+ if (proto_is_variadic && !fe_is_variadic) {
return INHERITANCE_ERROR;
}
- /* For variadic functions any additional (optional) arguments that were added must be
- * checked against the signature of the variadic argument, so in this case we have to
- * go through all the parameters of the function and not just those present in the
- * prototype. */
- num_args = proto->common.num_args;
- if (proto->common.fn_flags & ZEND_ACC_VARIADIC) {
- num_args++;
- if (fe->common.num_args >= proto->common.num_args) {
- num_args = fe->common.num_args;
- if (fe->common.fn_flags & ZEND_ACC_VARIADIC) {
- num_args++;
- }
- }
- }
+ /* The variadic argument is not included in the stored argument count. */
+ proto_num_args = proto->common.num_args + proto_is_variadic;
+ fe_num_args = fe->common.num_args + fe_is_variadic;
+ num_args = MAX(proto_num_args, fe_num_args);
status = INHERITANCE_SUCCESS;
for (i = 0; i < num_args; i++) {
- zend_arg_info *fe_arg_info = &fe->common.arg_info[i];
-
- zend_arg_info *proto_arg_info;
- if (i < proto->common.num_args) {
- proto_arg_info = &proto->common.arg_info[i];
- } else {
- proto_arg_info = &proto->common.arg_info[proto->common.num_args];
+ zend_arg_info *proto_arg_info =
+ i < proto_num_args ? &proto->common.arg_info[i] :
+ proto_is_variadic ? &proto->common.arg_info[proto_num_args - 1] : NULL;
+ zend_arg_info *fe_arg_info =
+ i < fe_num_args ? &fe->common.arg_info[i] :
+ fe_is_variadic ? &fe->common.arg_info[fe_num_args - 1] : NULL;
+ if (!proto_arg_info) {
+ /* A new (optional) argument has been added, which is fine. */
+ continue;
+ }
+ if (!fe_arg_info) {
+ /* An argument has been removed. This is considered illegal, because arity checks
+ * work based on a model where passing more than the declared number of parameters
+ * to a function is an error. */
+ return INHERITANCE_ERROR;
}
- local_status = zend_do_perform_arg_type_hint_check(
- unresolved_class, fe, fe_arg_info, proto, proto_arg_info);
+ local_status = zend_do_perform_arg_type_hint_check(fe, fe_arg_info, proto, proto_arg_info);
if (UNEXPECTED(local_status != INHERITANCE_SUCCESS)) {
if (UNEXPECTED(local_status == INHERITANCE_ERROR)) {
@@ -490,7 +571,7 @@ static inheritance_status zend_do_perform_implementation_check(
}
/* by-ref constraints on arguments are invariant */
- if (fe_arg_info->pass_by_reference != proto_arg_info->pass_by_reference) {
+ if (ZEND_ARG_SEND_MODE(fe_arg_info) != ZEND_ARG_SEND_MODE(proto_arg_info)) {
return INHERITANCE_ERROR;
}
}
@@ -504,7 +585,8 @@ static inheritance_status zend_do_perform_implementation_check(
}
local_status = zend_perform_covariant_type_check(
- unresolved_class, fe, fe->common.arg_info - 1, proto, proto->common.arg_info - 1);
+ fe->common.scope, fe->common.arg_info[-1].type,
+ proto->common.scope, proto->common.arg_info[-1].type);
if (UNEXPECTED(local_status != INHERITANCE_SUCCESS)) {
if (UNEXPECTED(local_status == INHERITANCE_ERROR)) {
@@ -521,33 +603,10 @@ static inheritance_status zend_do_perform_implementation_check(
static ZEND_COLD void zend_append_type_hint(smart_str *str, const zend_function *fptr, zend_arg_info *arg_info, int return_hint) /* {{{ */
{
-
- if (ZEND_TYPE_IS_SET(arg_info->type) && ZEND_TYPE_ALLOW_NULL(arg_info->type)) {
- smart_str_appendc(str, '?');
- }
-
- if (ZEND_TYPE_IS_CLASS(arg_info->type)) {
- const char *class_name;
- size_t class_name_len;
-
- class_name = ZSTR_VAL(ZEND_TYPE_NAME(arg_info->type));
- class_name_len = ZSTR_LEN(ZEND_TYPE_NAME(arg_info->type));
-
- if (!strcasecmp(class_name, "self") && fptr->common.scope) {
- class_name = ZSTR_VAL(fptr->common.scope->name);
- class_name_len = ZSTR_LEN(fptr->common.scope->name);
- } else if (!strcasecmp(class_name, "parent") && fptr->common.scope && fptr->common.scope->parent) {
- class_name = ZSTR_VAL(fptr->common.scope->parent->name);
- class_name_len = ZSTR_LEN(fptr->common.scope->parent->name);
- }
-
- smart_str_appendl(str, class_name, class_name_len);
- if (!return_hint) {
- smart_str_appendc(str, ' ');
- }
- } else if (ZEND_TYPE_IS_CODE(arg_info->type)) {
- const char *type_name = zend_get_type_by_const(ZEND_TYPE_CODE(arg_info->type));
- smart_str_appends(str, type_name);
+ if (ZEND_TYPE_IS_SET(arg_info->type)) {
+ zend_string *type_str = zend_type_to_string_resolved(arg_info->type, fptr->common.scope);
+ smart_str_append(str, type_str);
+ zend_string_release(type_str);
if (!return_hint) {
smart_str_appendc(str, ' ');
}
@@ -584,11 +643,11 @@ static ZEND_COLD zend_string *zend_get_function_declaration(const zend_function
for (i = 0; i < num_args;) {
zend_append_type_hint(&str, fptr, arg_info, 0);
- if (arg_info->pass_by_reference) {
+ if (ZEND_ARG_SEND_MODE(arg_info)) {
smart_str_appendc(&str, '&');
}
- if (arg_info->is_variadic) {
+ if (ZEND_ARG_IS_VARIADIC(arg_info)) {
smart_str_appends(&str, "...");
}
@@ -605,7 +664,7 @@ static ZEND_COLD zend_string *zend_get_function_declaration(const zend_function
smart_str_append_unsigned(&str, i);
}
- if (i >= required && !arg_info->is_variadic) {
+ if (i >= required && !ZEND_ARG_IS_VARIADIC(arg_info)) {
smart_str_appends(&str, " = ");
if (fptr->type == ZEND_USER_FUNCTION) {
zend_op *precv = NULL;
@@ -685,66 +744,41 @@ static zend_always_inline uint32_t func_lineno(const zend_function *fn) {
}
static void ZEND_COLD emit_incompatible_method_error(
- int error_level, const char *error_verb,
const zend_function *child, const zend_function *parent,
- inheritance_status status, zend_string *unresolved_class) {
+ inheritance_status status) {
zend_string *parent_prototype = zend_get_function_declaration(parent);
zend_string *child_prototype = zend_get_function_declaration(child);
if (status == INHERITANCE_UNRESOLVED) {
- zend_error_at(error_level, NULL, func_lineno(child),
+ /* Fetch the first unresolved class from registered autoloads */
+ zend_string *unresolved_class = NULL;
+ ZEND_HASH_FOREACH_STR_KEY(CG(delayed_autoloads), unresolved_class) {
+ break;
+ } ZEND_HASH_FOREACH_END();
+ ZEND_ASSERT(unresolved_class);
+
+ zend_error_at(E_COMPILE_ERROR, NULL, func_lineno(child),
"Could not check compatibility between %s and %s, because class %s is not available",
ZSTR_VAL(child_prototype), ZSTR_VAL(parent_prototype), ZSTR_VAL(unresolved_class));
} else {
- zend_error_at(error_level, NULL, func_lineno(child),
- "Declaration of %s %s be compatible with %s",
- ZSTR_VAL(child_prototype), error_verb, ZSTR_VAL(parent_prototype));
+ zend_error_at(E_COMPILE_ERROR, NULL, func_lineno(child),
+ "Declaration of %s must be compatible with %s",
+ ZSTR_VAL(child_prototype), ZSTR_VAL(parent_prototype));
}
zend_string_efree(child_prototype);
zend_string_efree(parent_prototype);
}
-static void ZEND_COLD emit_incompatible_method_error_or_warning(
- const zend_function *child, const zend_function *parent,
- inheritance_status status, zend_string *unresolved_class, zend_bool always_error) {
- int error_level;
- const char *error_verb;
- if (always_error ||
- (child->common.prototype &&
- (child->common.prototype->common.fn_flags & ZEND_ACC_ABSTRACT)) ||
- ((parent->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) &&
- (!(child->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
- zend_perform_covariant_type_check(&unresolved_class, child, child->common.arg_info - 1, parent, parent->common.arg_info - 1) != INHERITANCE_SUCCESS))
- ) {
- error_level = E_COMPILE_ERROR;
- error_verb = "must";
- } else {
- error_level = E_WARNING;
- error_verb = "should";
- }
- emit_incompatible_method_error(
- error_level, error_verb, child, parent, status, unresolved_class);
-}
-
static void perform_delayable_implementation_check(
zend_class_entry *ce, const zend_function *fe,
- const zend_function *proto, zend_bool always_error)
+ const zend_function *proto)
{
- zend_string *unresolved_class;
- inheritance_status status = zend_do_perform_implementation_check(
- &unresolved_class, fe, proto);
-
+ inheritance_status status = zend_do_perform_implementation_check(fe, proto);
if (UNEXPECTED(status != INHERITANCE_SUCCESS)) {
if (EXPECTED(status == INHERITANCE_UNRESOLVED)) {
- add_compatibility_obligation(ce, fe, proto, always_error);
+ add_compatibility_obligation(ce, fe, proto);
} else {
ZEND_ASSERT(status == INHERITANCE_ERROR);
- if (always_error) {
- emit_incompatible_method_error(
- E_COMPILE_ERROR, "must", fe, proto, status, unresolved_class);
- } else {
- emit_incompatible_method_error_or_warning(
- fe, proto, status, unresolved_class, always_error);
- }
+ emit_incompatible_method_error(fe, proto, status);
}
}
}
@@ -843,13 +877,9 @@ static zend_always_inline inheritance_status do_inheritance_check_on_method_ex(z
if (!checked) {
if (check_only) {
- zend_string *unresolved_class;
-
- return zend_do_perform_implementation_check(
- &unresolved_class, child, parent);
+ return zend_do_perform_implementation_check(child, parent);
}
- perform_delayable_implementation_check(
- ce, child, parent, /*always_error*/0);
+ perform_delayable_implementation_check(ce, child, parent);
}
return INHERITANCE_SUCCESS;
}
@@ -897,50 +927,38 @@ static zend_always_inline void do_inherit_method(zend_string *key, zend_function
inheritance_status property_types_compatible(
const zend_property_info *parent_info, const zend_property_info *child_info) {
- zend_string *parent_name, *child_name;
- zend_class_entry *parent_type_ce, *child_type_ce;
- if (parent_info->type == child_info->type) {
+ if (ZEND_TYPE_PURE_MASK(parent_info->type) == ZEND_TYPE_PURE_MASK(child_info->type)
+ && ZEND_TYPE_NAME(parent_info->type) == ZEND_TYPE_NAME(child_info->type)) {
return INHERITANCE_SUCCESS;
}
- if (!ZEND_TYPE_IS_CLASS(parent_info->type) || !ZEND_TYPE_IS_CLASS(child_info->type) ||
- ZEND_TYPE_ALLOW_NULL(parent_info->type) != ZEND_TYPE_ALLOW_NULL(child_info->type)) {
+ if (ZEND_TYPE_IS_SET(parent_info->type) != ZEND_TYPE_IS_SET(child_info->type)) {
return INHERITANCE_ERROR;
}
- parent_name = ZEND_TYPE_IS_CE(parent_info->type)
- ? ZEND_TYPE_CE(parent_info->type)->name
- : resolve_class_name(parent_info->ce, ZEND_TYPE_NAME(parent_info->type));
- child_name = ZEND_TYPE_IS_CE(child_info->type)
- ? ZEND_TYPE_CE(child_info->type)->name
- : resolve_class_name(child_info->ce, ZEND_TYPE_NAME(child_info->type));
- if (zend_string_equals_ci(parent_name, child_name)) {
+ /* Perform a covariant type check in both directions to determined invariance. */
+ inheritance_status status1 = zend_perform_covariant_type_check(
+ child_info->ce, child_info->type, parent_info->ce, parent_info->type);
+ inheritance_status status2 = zend_perform_covariant_type_check(
+ parent_info->ce, parent_info->type, child_info->ce, child_info->type);
+ if (status1 == INHERITANCE_SUCCESS && status2 == INHERITANCE_SUCCESS) {
return INHERITANCE_SUCCESS;
}
-
- /* Check for class aliases */
- parent_type_ce = ZEND_TYPE_IS_CE(parent_info->type)
- ? ZEND_TYPE_CE(parent_info->type)
- : lookup_class(parent_info->ce, parent_name);
- child_type_ce = ZEND_TYPE_IS_CE(child_info->type)
- ? ZEND_TYPE_CE(child_info->type)
- : lookup_class(child_info->ce, child_name);
- if (!parent_type_ce || !child_type_ce) {
- return INHERITANCE_UNRESOLVED;
+ if (status1 == INHERITANCE_ERROR || status2 == INHERITANCE_ERROR) {
+ return INHERITANCE_ERROR;
}
- return parent_type_ce == child_type_ce ? INHERITANCE_SUCCESS : INHERITANCE_ERROR;
+ ZEND_ASSERT(status1 == INHERITANCE_UNRESOLVED || status2 == INHERITANCE_UNRESOLVED);
+ return INHERITANCE_UNRESOLVED;
}
static void emit_incompatible_property_error(
const zend_property_info *child, const zend_property_info *parent) {
+ zend_string *type_str = zend_type_to_string_resolved(parent->type, parent->ce);
zend_error_noreturn(E_COMPILE_ERROR,
- "Type of %s::$%s must be %s%s (as in class %s)",
+ "Type of %s::$%s must be %s (as in class %s)",
ZSTR_VAL(child->ce->name),
zend_get_unmangled_property_name(child->name),
- ZEND_TYPE_ALLOW_NULL(parent->type) ? "?" : "",
- ZEND_TYPE_IS_CLASS(parent->type)
- ? ZSTR_VAL(ZEND_TYPE_IS_CE(parent->type) ? ZEND_TYPE_CE(parent->type)->name : resolve_class_name(parent->ce, ZEND_TYPE_NAME(parent->type)))
- : zend_get_type_by_const(ZEND_TYPE_CODE(parent->type)),
+ ZSTR_VAL(type_str),
ZSTR_VAL(parent->ce->name));
}
@@ -957,12 +975,12 @@ static void do_inherit_property(zend_property_info *parent_info, zend_string *ke
if (!(parent_info->flags & ZEND_ACC_PRIVATE)) {
if (UNEXPECTED((parent_info->flags & ZEND_ACC_STATIC) != (child_info->flags & ZEND_ACC_STATIC))) {
zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare %s%s::$%s as %s%s::$%s",
- (parent_info->flags & ZEND_ACC_STATIC) ? "static " : "non static ", ZSTR_VAL(ce->parent->name), ZSTR_VAL(key),
+ (parent_info->flags & ZEND_ACC_STATIC) ? "static " : "non static ", ZSTR_VAL(parent_info->ce->name), ZSTR_VAL(key),
(child_info->flags & ZEND_ACC_STATIC) ? "static " : "non static ", ZSTR_VAL(ce->name), ZSTR_VAL(key));
}
if (UNEXPECTED((child_info->flags & ZEND_ACC_PPP_MASK) > (parent_info->flags & ZEND_ACC_PPP_MASK))) {
- zend_error_noreturn(E_COMPILE_ERROR, "Access level to %s::$%s must be %s (as in class %s)%s", ZSTR_VAL(ce->name), ZSTR_VAL(key), zend_visibility_string(parent_info->flags), ZSTR_VAL(ce->parent->name), (parent_info->flags&ZEND_ACC_PUBLIC) ? "" : " or weaker");
+ zend_error_noreturn(E_COMPILE_ERROR, "Access level to %s::$%s must be %s (as in class %s)%s", ZSTR_VAL(ce->name), ZSTR_VAL(key), zend_visibility_string(parent_info->flags), ZSTR_VAL(parent_info->ce->name), (parent_info->flags&ZEND_ACC_PUBLIC) ? "" : " or weaker");
} else if ((child_info->flags & ZEND_ACC_STATIC) == 0) {
int parent_num = OBJ_PROP_TO_NUM(parent_info->offset);
int child_num = OBJ_PROP_TO_NUM(child_info->offset);
@@ -987,7 +1005,7 @@ static void do_inherit_property(zend_property_info *parent_info, zend_string *ke
"Type of %s::$%s must not be defined (as in class %s)",
ZSTR_VAL(ce->name),
ZSTR_VAL(key),
- ZSTR_VAL(ce->parent->name));
+ ZSTR_VAL(parent_info->ce->name));
}
}
} else {
@@ -1055,7 +1073,7 @@ static void do_inherit_class_constant(zend_string *name, zend_class_constant *pa
c = (zend_class_constant*)Z_PTR_P(zv);
if (UNEXPECTED((Z_ACCESS_FLAGS(c->value) & ZEND_ACC_PPP_MASK) > (Z_ACCESS_FLAGS(parent_const->value) & ZEND_ACC_PPP_MASK))) {
zend_error_noreturn(E_COMPILE_ERROR, "Access level to %s::%s must be %s (as in class %s)%s",
- ZSTR_VAL(ce->name), ZSTR_VAL(name), zend_visibility_string(Z_ACCESS_FLAGS(parent_const->value)), ZSTR_VAL(ce->parent->name), (Z_ACCESS_FLAGS(parent_const->value) & ZEND_ACC_PUBLIC) ? "" : " or weaker");
+ ZSTR_VAL(ce->name), ZSTR_VAL(name), zend_visibility_string(Z_ACCESS_FLAGS(parent_const->value)), ZSTR_VAL(parent_const->ce->name), (Z_ACCESS_FLAGS(parent_const->value) & ZEND_ACC_PUBLIC) ? "" : " or weaker");
}
} else if (!(Z_ACCESS_FLAGS(parent_const->value) & ZEND_ACC_PRIVATE)) {
if (Z_TYPE(parent_const->value) == IS_CONSTANT_AST) {
@@ -1143,7 +1161,7 @@ ZEND_API void zend_do_inheritance_ex(zend_class_entry *ce, zend_class_entry *par
/* Inherit interfaces */
if (parent_ce->num_interfaces) {
- if (!(ce->ce_flags & ZEND_ACC_IMPLEMENT_INTERFACES)) {
+ if (!ce->num_interfaces) {
zend_do_inherit_interfaces(ce, parent_ce);
} else {
uint32_t i;
@@ -1502,14 +1520,11 @@ static void zend_add_magic_methods(zend_class_entry* ce, zend_string* mname, zen
ce->serialize_func = fe;
} else if (zend_string_equals_literal(mname, "unserialize")) {
ce->unserialize_func = fe;
- } else if (ZSTR_LEN(ce->name) != ZSTR_LEN(mname) && (ZSTR_VAL(mname)[0] != '_' || ZSTR_VAL(mname)[1] != '_')) {
+ } else if (ZSTR_VAL(mname)[0] != '_' || ZSTR_VAL(mname)[1] != '_') {
/* pass */
} else if (zend_string_equals_literal(mname, ZEND_CLONE_FUNC_NAME)) {
ce->clone = fe;
} else if (zend_string_equals_literal(mname, ZEND_CONSTRUCTOR_FUNC_NAME)) {
- if (ce->constructor && (!ce->parent || ce->constructor != ce->parent->constructor)) {
- zend_error_noreturn(E_COMPILE_ERROR, "%s has colliding constructor definitions coming from traits", ZSTR_VAL(ce->name));
- }
ce->constructor = fe;
} else if (zend_string_equals_literal(mname, ZEND_DESTRUCTOR_FUNC_NAME)) {
ce->destructor = fe;
@@ -1533,17 +1548,6 @@ static void zend_add_magic_methods(zend_class_entry* ce, zend_string* mname, zen
ce->__tostring = fe;
} else if (zend_string_equals_literal(mname, ZEND_DEBUGINFO_FUNC_NAME)) {
ce->__debugInfo = fe;
- } else if (ZSTR_LEN(ce->name) == ZSTR_LEN(mname)) {
- zend_string *lowercase_name = zend_string_tolower(ce->name);
- lowercase_name = zend_new_interned_string(lowercase_name);
- if (!memcmp(ZSTR_VAL(mname), ZSTR_VAL(lowercase_name), ZSTR_LEN(mname))) {
- if (ce->constructor && (!ce->parent || ce->constructor != ce->parent->constructor)) {
- zend_error_noreturn(E_COMPILE_ERROR, "%s has colliding constructor definitions coming from traits", ZSTR_VAL(ce->name));
- }
- ce->constructor = fe;
- fe->common.fn_flags |= ZEND_ACC_CTOR;
- }
- zend_string_release_ex(lowercase_name, 0);
}
}
/* }}} */
@@ -1569,13 +1573,11 @@ static void zend_add_trait_method(zend_class_entry *ce, const char *name, zend_s
if ((existing_fn = zend_hash_find_ptr(*overridden, key)) != NULL) {
if (existing_fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
/* Make sure the trait method is compatible with previosly declared abstract method */
- perform_delayable_implementation_check(
- ce, fn, existing_fn, /*always_error*/ 1);
+ perform_delayable_implementation_check(ce, fn, existing_fn);
}
if (fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
/* Make sure the abstract declaration is compatible with previous declaration */
- perform_delayable_implementation_check(
- ce, existing_fn, fn, /*always_error*/ 1);
+ perform_delayable_implementation_check(ce, existing_fn, fn);
return;
}
}
@@ -1588,8 +1590,7 @@ static void zend_add_trait_method(zend_class_entry *ce, const char *name, zend_s
} else if ((fn->common.fn_flags & ZEND_ACC_ABSTRACT)
&& !(existing_fn->common.fn_flags & ZEND_ACC_ABSTRACT)) {
/* Make sure the abstract declaration is compatible with previous declaration */
- perform_delayable_implementation_check(
- ce, existing_fn, fn, /*always_error*/ 1);
+ perform_delayable_implementation_check(ce, existing_fn, fn);
return;
} else if (UNEXPECTED((existing_fn->common.scope->ce_flags & ZEND_ACC_TRAIT)
&& !(existing_fn->common.fn_flags & ZEND_ACC_ABSTRACT))) {
@@ -2026,9 +2027,7 @@ static void zend_do_traits_property_binding(zend_class_entry *ce, zend_class_ent
Z_TRY_ADDREF_P(prop_value);
doc_comment = property_info->doc_comment ? zend_string_copy(property_info->doc_comment) : NULL;
- if (ZEND_TYPE_IS_NAME(property_info->type)) {
- zend_string_addref(ZEND_TYPE_NAME(property_info->type));
- }
+ zend_type_copy_ctor(&property_info->type, /* persistent */ 0);
zend_declare_typed_property(ce, prop_name, prop_value, flags, doc_comment, property_info->type);
zend_string_release_ex(prop_name, 0);
} ZEND_HASH_FOREACH_END();
@@ -2138,32 +2137,6 @@ static void zend_do_bind_traits(zend_class_entry *ce) /* {{{ */
zend_do_traits_property_binding(ce, traits);
efree(traits);
-
- /* Emit E_DEPRECATED for PHP 4 constructors */
- zend_check_deprecated_constructor(ce);
-}
-/* }}} */
-
-
-static zend_bool zend_has_deprecated_constructor(const zend_class_entry *ce) /* {{{ */
-{
- const zend_string *constructor_name;
- if (!ce->constructor) {
- return 0;
- }
- constructor_name = ce->constructor->common.function_name;
- return !zend_binary_strcasecmp(
- ZSTR_VAL(ce->name), ZSTR_LEN(ce->name),
- ZSTR_VAL(constructor_name), ZSTR_LEN(constructor_name)
- );
-}
-/* }}} */
-
-void zend_check_deprecated_constructor(const zend_class_entry *ce) /* {{{ */
-{
- if (zend_has_deprecated_constructor(ce)) {
- zend_error(E_DEPRECATED, "Methods with the same name as their class will not be constructors in a future version of PHP; %s has a deprecated constructor", ZSTR_VAL(ce->name));
- }
}
/* }}} */
@@ -2241,7 +2214,6 @@ typedef struct {
* so use copies of functions here as well. */
zend_function parent_fn;
zend_function child_fn;
- zend_bool always_error;
};
struct {
const zend_property_info *parent_prop;
@@ -2289,8 +2261,7 @@ static void add_dependency_obligation(zend_class_entry *ce, zend_class_entry *de
}
static void add_compatibility_obligation(
- zend_class_entry *ce, const zend_function *child_fn, const zend_function *parent_fn,
- zend_bool always_error) {
+ zend_class_entry *ce, const zend_function *child_fn, const zend_function *parent_fn) {
HashTable *obligations = get_or_init_obligations_for_class(ce);
variance_obligation *obligation = emalloc(sizeof(variance_obligation));
obligation->type = OBLIGATION_COMPATIBILITY;
@@ -2305,7 +2276,6 @@ static void add_compatibility_obligation(
} else {
memcpy(&obligation->parent_fn, parent_fn, sizeof(zend_op_array));
}
- obligation->always_error = always_error;
zend_hash_next_index_insert_ptr(obligations, obligation);
}
@@ -2333,18 +2303,14 @@ static int check_variance_obligation(zval *zv) {
return ZEND_HASH_APPLY_KEEP;
}
} else if (obligation->type == OBLIGATION_COMPATIBILITY) {
- zend_string *unresolved_class;
inheritance_status status = zend_do_perform_implementation_check(
- &unresolved_class, &obligation->child_fn, &obligation->parent_fn);
-
+ &obligation->child_fn, &obligation->parent_fn);
if (UNEXPECTED(status != INHERITANCE_SUCCESS)) {
if (EXPECTED(status == INHERITANCE_UNRESOLVED)) {
return ZEND_HASH_APPLY_KEEP;
}
ZEND_ASSERT(status == INHERITANCE_ERROR);
- emit_incompatible_method_error_or_warning(
- &obligation->child_fn, &obligation->parent_fn, status, unresolved_class,
- obligation->always_error);
+ emit_incompatible_method_error(&obligation->child_fn, &obligation->parent_fn, status);
}
/* Either the compatibility check was successful or only threw a warning. */
} else {
@@ -2407,17 +2373,14 @@ static void report_variance_errors(zend_class_entry *ce) {
ZEND_ASSERT(obligations != NULL);
ZEND_HASH_FOREACH_PTR(obligations, obligation) {
- inheritance_status status;
- zend_string *unresolved_class;
-
if (obligation->type == OBLIGATION_COMPATIBILITY) {
- /* Just used to fetch the unresolved_class in this case. */
- status = zend_do_perform_implementation_check(
- &unresolved_class, &obligation->child_fn, &obligation->parent_fn);
+ /* Just used to populate the delayed_autoloads table,
+ * which will be used when printing the "unresolved" error. */
+ inheritance_status status = zend_do_perform_implementation_check(
+ &obligation->child_fn, &obligation->parent_fn);
ZEND_ASSERT(status == INHERITANCE_UNRESOLVED);
- emit_incompatible_method_error_or_warning(
- &obligation->child_fn, &obligation->parent_fn,
- status, unresolved_class, obligation->always_error);
+ emit_incompatible_method_error(
+ &obligation->child_fn, &obligation->parent_fn, status);
} else if (obligation->type == OBLIGATION_PROPERTY_COMPATIBILITY) {
emit_incompatible_property_error(obligation->child_prop, obligation->parent_prop);
} else {
@@ -2497,10 +2460,10 @@ ZEND_API int zend_do_link_class(zend_class_entry *ce, zend_string *lc_parent_nam
}
zend_do_inheritance(ce, parent);
}
- if (ce->ce_flags & ZEND_ACC_IMPLEMENT_TRAITS) {
+ if (ce->num_traits) {
zend_do_bind_traits(ce);
}
- if (ce->ce_flags & ZEND_ACC_IMPLEMENT_INTERFACES) {
+ if (interfaces) {
zend_do_implement_interfaces(ce, interfaces);
}
if ((ce->ce_flags & (ZEND_ACC_IMPLICIT_ABSTRACT_CLASS|ZEND_ACC_INTERFACE|ZEND_ACC_TRAIT|ZEND_ACC_EXPLICIT_ABSTRACT_CLASS)) == ZEND_ACC_IMPLICIT_ABSTRACT_CLASS) {
@@ -2530,7 +2493,6 @@ ZEND_API int zend_do_link_class(zend_class_entry *ce, zend_string *lc_parent_nam
/* Check whether early binding is prevented due to unresolved types in inheritance checks. */
static inheritance_status zend_can_early_bind(zend_class_entry *ce, zend_class_entry *parent_ce) /* {{{ */
{
- inheritance_status ret = INHERITANCE_SUCCESS;
zend_string *key;
zend_function *parent_func;
zend_property_info *parent_info;
@@ -2543,11 +2505,7 @@ static inheritance_status zend_can_early_bind(zend_class_entry *ce, zend_class_e
do_inheritance_check_on_method_ex(child_func, parent_func, ce, NULL, 1, 0);
if (UNEXPECTED(status != INHERITANCE_SUCCESS)) {
- if (EXPECTED(status == INHERITANCE_UNRESOLVED)) {
- return INHERITANCE_UNRESOLVED;
- }
- ZEND_ASSERT(status == INHERITANCE_ERROR);
- ret = INHERITANCE_ERROR;
+ return status;
}
}
} ZEND_HASH_FOREACH_END();
@@ -2564,17 +2522,13 @@ static inheritance_status zend_can_early_bind(zend_class_entry *ce, zend_class_e
if (ZEND_TYPE_IS_SET(child_info->type)) {
inheritance_status status = property_types_compatible(parent_info, child_info);
if (UNEXPECTED(status != INHERITANCE_SUCCESS)) {
- if (EXPECTED(status == INHERITANCE_UNRESOLVED)) {
- return INHERITANCE_UNRESOLVED;
- }
- ZEND_ASSERT(status == INHERITANCE_ERROR);
- ret = INHERITANCE_ERROR;
+ return status;
}
}
}
} ZEND_HASH_FOREACH_END();
- return ret;
+ return INHERITANCE_SUCCESS;
}
/* }}} */
diff --git a/Zend/zend_inheritance.h b/Zend/zend_inheritance.h
index c4e9e10675..6cf2d1b78d 100644
--- a/Zend/zend_inheritance.h
+++ b/Zend/zend_inheritance.h
@@ -33,7 +33,6 @@ ZEND_API void zend_do_inheritance_ex(zend_class_entry *ce, zend_class_entry *par
ZEND_API int zend_do_link_class(zend_class_entry *ce, zend_string *lc_parent_name);
void zend_verify_abstract_class(zend_class_entry *ce);
-void zend_check_deprecated_constructor(const zend_class_entry *ce);
void zend_build_properties_info_table(zend_class_entry *ce);
zend_bool zend_try_early_bind(zend_class_entry *ce, zend_class_entry *parent_ce, zend_string *lcname, zval *delayed_early_binding);
diff --git a/Zend/zend_ini.c b/Zend/zend_ini.c
index e4b9e6bc5e..b33161cc74 100644
--- a/Zend/zend_ini.c
+++ b/Zend/zend_ini.c
@@ -390,7 +390,7 @@ ZEND_API int zend_restore_ini_entry(zend_string *name, int stage) /* {{{ */
}
/* }}} */
-ZEND_API int zend_ini_register_displayer(char *name, uint32_t name_length, void (*displayer)(zend_ini_entry *ini_entry, int type)) /* {{{ */
+ZEND_API int zend_ini_register_displayer(const char *name, uint32_t name_length, void (*displayer)(zend_ini_entry *ini_entry, int type)) /* {{{ */
{
zend_ini_entry *ini_entry;
@@ -408,7 +408,7 @@ ZEND_API int zend_ini_register_displayer(char *name, uint32_t name_length, void
* Data retrieval
*/
-ZEND_API zend_long zend_ini_long(char *name, size_t name_length, int orig) /* {{{ */
+ZEND_API zend_long zend_ini_long(const char *name, size_t name_length, int orig) /* {{{ */
{
zend_ini_entry *ini_entry;
@@ -425,7 +425,7 @@ ZEND_API zend_long zend_ini_long(char *name, size_t name_length, int orig) /* {{
}
/* }}} */
-ZEND_API double zend_ini_double(char *name, size_t name_length, int orig) /* {{{ */
+ZEND_API double zend_ini_double(const char *name, size_t name_length, int orig) /* {{{ */
{
zend_ini_entry *ini_entry;
@@ -442,7 +442,7 @@ ZEND_API double zend_ini_double(char *name, size_t name_length, int orig) /* {{{
}
/* }}} */
-ZEND_API char *zend_ini_string_ex(char *name, size_t name_length, int orig, zend_bool *exists) /* {{{ */
+ZEND_API char *zend_ini_string_ex(const char *name, size_t name_length, int orig, zend_bool *exists) /* {{{ */
{
zend_ini_entry *ini_entry;
@@ -466,7 +466,7 @@ ZEND_API char *zend_ini_string_ex(char *name, size_t name_length, int orig, zend
}
/* }}} */
-ZEND_API char *zend_ini_string(char *name, size_t name_length, int orig) /* {{{ */
+ZEND_API char *zend_ini_string(const char *name, size_t name_length, int orig) /* {{{ */
{
zend_bool exists = 1;
char *return_value;
diff --git a/Zend/zend_ini.h b/Zend/zend_ini.h
index 596444880a..ba8cc25f0a 100644
--- a/Zend/zend_ini.h
+++ b/Zend/zend_ini.h
@@ -81,14 +81,14 @@ ZEND_API int zend_alter_ini_entry_chars_ex(zend_string *name, const char *value,
ZEND_API int zend_restore_ini_entry(zend_string *name, int stage);
ZEND_API void display_ini_entries(zend_module_entry *module);
-ZEND_API zend_long zend_ini_long(char *name, size_t name_length, int orig);
-ZEND_API double zend_ini_double(char *name, size_t name_length, int orig);
-ZEND_API char *zend_ini_string(char *name, size_t name_length, int orig);
-ZEND_API char *zend_ini_string_ex(char *name, size_t name_length, int orig, zend_bool *exists);
+ZEND_API zend_long zend_ini_long(const char *name, size_t name_length, int orig);
+ZEND_API double zend_ini_double(const char *name, size_t name_length, int orig);
+ZEND_API char *zend_ini_string(const char *name, size_t name_length, int orig);
+ZEND_API char *zend_ini_string_ex(const char *name, size_t name_length, int orig, zend_bool *exists);
ZEND_API zend_string *zend_ini_get_value(zend_string *name);
ZEND_API zend_bool zend_ini_parse_bool(zend_string *str);
-ZEND_API int zend_ini_register_displayer(char *name, uint32_t name_length, void (*displayer)(zend_ini_entry *ini_entry, int type));
+ZEND_API int zend_ini_register_displayer(const char *name, uint32_t name_length, void (*displayer)(zend_ini_entry *ini_entry, int type));
ZEND_API ZEND_INI_DISP(zend_ini_boolean_displayer_cb);
ZEND_API ZEND_INI_DISP(zend_ini_color_displayer_cb);
diff --git a/Zend/zend_ini_parser.y b/Zend/zend_ini_parser.y
index 749f929a9b..a204496a35 100644
--- a/Zend/zend_ini_parser.y
+++ b/Zend/zend_ini_parser.y
@@ -32,8 +32,6 @@
#include "win32/syslog.h"
#endif
-#define YYSTYPE zval
-
int ini_parse(void);
#define ZEND_INI_PARSER_CB (CG(ini_parser_param))->ini_parser_cb
@@ -289,7 +287,9 @@ static void zval_ini_dtor(zval *zv)
%}
%expect 0
+%define api.prefix {ini_}
%define api.pure full
+%define api.value.type {zval}
%define parse.error verbose
%token TC_SECTION
@@ -309,7 +309,7 @@ static void zval_ini_dtor(zval *zv)
%token END_OF_LINE
%token '=' ':' ',' '.' '"' '\'' '^' '+' '-' '/' '*' '%' '$' '~' '<' '>' '?' '@' '{' '}'
%left '|' '&' '^'
-%right '~' '!'
+%precedence '~' '!'
%destructor { zval_ini_dtor(&$$); } TC_RAW TC_CONSTANT TC_NUMBER TC_STRING TC_WHITESPACE TC_LABEL TC_OFFSET TC_VARNAME BOOL_TRUE BOOL_FALSE NULL_NULL cfg_var_ref constant_literal constant_string encapsed_list expr option_offset section_string_or_value string_or_value var_string_list var_string_list_section
@@ -317,7 +317,7 @@ static void zval_ini_dtor(zval *zv)
statement_list:
statement_list statement
- | /* empty */
+ | %empty
;
statement:
@@ -351,7 +351,7 @@ statement:
section_string_or_value:
var_string_list_section { $$ = $1; }
- | /* empty */ { zend_ini_init_string(&$$); }
+ | %empty { zend_ini_init_string(&$$); }
;
string_or_value:
@@ -364,13 +364,13 @@ string_or_value:
option_offset:
var_string_list { $$ = $1; }
- | /* empty */ { zend_ini_init_string(&$$); }
+ | %empty { zend_ini_init_string(&$$); }
;
encapsed_list:
encapsed_list cfg_var_ref { zend_ini_add_string(&$$, &$1, &$2); zend_string_free(Z_STR($2)); }
| encapsed_list TC_QUOTED_STRING { zend_ini_add_string(&$$, &$1, &$2); zend_string_free(Z_STR($2)); }
- | /* empty */ { zend_ini_init_string(&$$); }
+ | %empty { zend_ini_init_string(&$$); }
;
var_string_list_section:
diff --git a/Zend/zend_interfaces.c b/Zend/zend_interfaces.c
index ff6784be31..b6fdec95be 100644
--- a/Zend/zend_interfaces.c
+++ b/Zend/zend_interfaces.c
@@ -20,6 +20,7 @@
#include "zend_API.h"
#include "zend_interfaces.h"
#include "zend_exceptions.h"
+#include "zend_interfaces_arginfo.h"
ZEND_API zend_class_entry *zend_ce_traversable;
ZEND_API zend_class_entry *zend_ce_aggregate;
@@ -30,7 +31,7 @@ ZEND_API zend_class_entry *zend_ce_countable;
/* {{{ zend_call_method
Only returns the returned zval if retval_ptr != NULL */
-ZEND_API zval* zend_call_method(zval *object, zend_class_entry *obj_ce, zend_function **fn_proxy, const char *function_name, size_t function_name_len, zval *retval_ptr, int param_count, zval* arg1, zval* arg2)
+ZEND_API zval* zend_call_method(zend_object *object, zend_class_entry *obj_ce, zend_function **fn_proxy, const char *function_name, size_t function_name_len, zval *retval_ptr, int param_count, zval* arg1, zval* arg2)
{
int result;
zend_fcall_info fci;
@@ -45,7 +46,7 @@ ZEND_API zval* zend_call_method(zval *object, zend_class_entry *obj_ce, zend_fun
}
fci.size = sizeof(fci);
- fci.object = object ? Z_OBJ_P(object) : NULL;
+ fci.object = object;
fci.retval = retval_ptr ? retval_ptr : &retval;
fci.param_count = param_count;
fci.params = params;
@@ -62,7 +63,7 @@ ZEND_API zval* zend_call_method(zval *object, zend_class_entry *obj_ce, zend_fun
ZVAL_UNDEF(&fci.function_name); /* Unused */
if (!obj_ce) {
- obj_ce = object ? Z_OBJCE_P(object) : NULL;
+ obj_ce = object ? object->ce : NULL;
}
if (!fn_proxy || !*fn_proxy) {
if (EXPECTED(obj_ce)) {
@@ -87,7 +88,7 @@ ZEND_API zval* zend_call_method(zval *object, zend_class_entry *obj_ce, zend_fun
}
if (object) {
- fcic.called_scope = Z_OBJCE_P(object);
+ fcic.called_scope = object->ce;
} else {
zend_class_entry *called_scope = zend_get_called_scope(EG(current_execute_data));
@@ -99,13 +100,13 @@ ZEND_API zval* zend_call_method(zval *object, zend_class_entry *obj_ce, zend_fun
fcic.called_scope = called_scope;
}
}
- fcic.object = object ? Z_OBJ_P(object) : NULL;
+ fcic.object = object;
result = zend_call_function(&fci, &fcic);
}
if (result == FAILURE) {
/* error at c-level */
if (!obj_ce) {
- obj_ce = object ? Z_OBJCE_P(object) : NULL;
+ obj_ce = object ? object->ce : NULL;
}
if (!EG(exception)) {
zend_error_noreturn(E_CORE_ERROR, "Couldn't execute method %s%s%s", obj_ce ? ZSTR_VAL(obj_ce->name) : "", obj_ce ? "::" : "", function_name);
@@ -124,7 +125,7 @@ ZEND_API zval* zend_call_method(zval *object, zend_class_entry *obj_ce, zend_fun
/* {{{ zend_user_it_new_iterator */
ZEND_API void zend_user_it_new_iterator(zend_class_entry *ce, zval *object, zval *retval)
{
- zend_call_method_with_0_params(object, ce, &ce->iterator_funcs_ptr->zf_new_iterator, "getiterator", retval);
+ zend_call_method_with_0_params(Z_OBJ_P(object), ce, &ce->iterator_funcs_ptr->zf_new_iterator, "getiterator", retval);
}
/* }}} */
@@ -160,7 +161,7 @@ ZEND_API int zend_user_it_valid(zend_object_iterator *_iter)
zval more;
int result;
- zend_call_method_with_0_params(object, iter->ce, &iter->ce->iterator_funcs_ptr->zf_valid, "valid", &more);
+ zend_call_method_with_0_params(Z_OBJ_P(object), iter->ce, &iter->ce->iterator_funcs_ptr->zf_valid, "valid", &more);
result = i_zend_is_true(&more);
zval_ptr_dtor(&more);
return result ? SUCCESS : FAILURE;
@@ -176,7 +177,7 @@ ZEND_API zval *zend_user_it_get_current_data(zend_object_iterator *_iter)
zval *object = &iter->it.data;
if (Z_ISUNDEF(iter->value)) {
- zend_call_method_with_0_params(object, iter->ce, &iter->ce->iterator_funcs_ptr->zf_current, "current", &iter->value);
+ zend_call_method_with_0_params(Z_OBJ_P(object), iter->ce, &iter->ce->iterator_funcs_ptr->zf_current, "current", &iter->value);
}
return &iter->value;
}
@@ -189,10 +190,10 @@ ZEND_API void zend_user_it_get_current_key(zend_object_iterator *_iter, zval *ke
zval *object = &iter->it.data;
zval retval;
- zend_call_method_with_0_params(object, iter->ce, &iter->ce->iterator_funcs_ptr->zf_key, "key", &retval);
+ zend_call_method_with_0_params(Z_OBJ_P(object), iter->ce, &iter->ce->iterator_funcs_ptr->zf_key, "key", &retval);
if (Z_TYPE(retval) != IS_UNDEF) {
- ZVAL_ZVAL(key, &retval, 1, 1);
+ ZVAL_COPY_VALUE(key, &retval);
} else {
if (!EG(exception)) {
zend_error(E_WARNING, "Nothing returned from %s::key()", ZSTR_VAL(iter->ce->name));
@@ -210,7 +211,7 @@ ZEND_API void zend_user_it_move_forward(zend_object_iterator *_iter)
zval *object = &iter->it.data;
zend_user_it_invalidate_current(_iter);
- zend_call_method_with_0_params(object, iter->ce, &iter->ce->iterator_funcs_ptr->zf_next, "next", NULL);
+ zend_call_method_with_0_params(Z_OBJ_P(object), iter->ce, &iter->ce->iterator_funcs_ptr->zf_next, "next", NULL);
}
/* }}} */
@@ -221,7 +222,7 @@ ZEND_API void zend_user_it_rewind(zend_object_iterator *_iter)
zval *object = &iter->it.data;
zend_user_it_invalidate_current(_iter);
- zend_call_method_with_0_params(object, iter->ce, &iter->ce->iterator_funcs_ptr->zf_rewind, "rewind", NULL);
+ zend_call_method_with_0_params(Z_OBJ_P(object), iter->ce, &iter->ce->iterator_funcs_ptr->zf_rewind, "rewind", NULL);
}
/* }}} */
@@ -438,7 +439,7 @@ ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, size_t *b
zval retval;
int result;
- zend_call_method_with_0_params(object, ce, &ce->serialize_func, "serialize", &retval);
+ zend_call_method_with_0_params(Z_OBJ_P(object), ce, &ce->serialize_func, "serialize", &retval);
if (Z_TYPE(retval) == IS_UNDEF || EG(exception)) {
@@ -479,7 +480,7 @@ ZEND_API int zend_user_unserialize(zval *object, zend_class_entry *ce, const uns
ZVAL_STRINGL(&zdata, (char*)buf, buf_len);
- zend_call_method_with_1_params(object, ce, &ce->unserialize_func, "unserialize", NULL, &zdata);
+ zend_call_method_with_1_params(Z_OBJ_P(object), ce, &ce->unserialize_func, "unserialize", NULL, &zdata);
zval_ptr_dtor(&zdata);
@@ -511,7 +512,7 @@ static int zend_implement_serializable(zend_class_entry *interface, zend_class_e
{
if (class_type->parent
&& (class_type->parent->serialize || class_type->parent->unserialize)
- && !instanceof_function_ex(class_type->parent, zend_ce_serializable, 1)) {
+ && !zend_class_implements_interface(class_type->parent, zend_ce_serializable)) {
return FAILURE;
}
if (!class_type->serialize) {
@@ -533,57 +534,37 @@ static int zend_implement_countable(zend_class_entry *interface, zend_class_entr
/* {{{ function tables */
static const zend_function_entry zend_funcs_aggregate[] = {
- ZEND_ABSTRACT_ME(iterator, getIterator, NULL)
+ ZEND_ABSTRACT_ME(iterator, getIterator, arginfo_class_IteratorAggregate_getIterator)
ZEND_FE_END
};
static const zend_function_entry zend_funcs_iterator[] = {
- ZEND_ABSTRACT_ME(iterator, current, NULL)
- ZEND_ABSTRACT_ME(iterator, next, NULL)
- ZEND_ABSTRACT_ME(iterator, key, NULL)
- ZEND_ABSTRACT_ME(iterator, valid, NULL)
- ZEND_ABSTRACT_ME(iterator, rewind, NULL)
+ ZEND_ABSTRACT_ME(iterator, current, arginfo_class_Iterator_current)
+ ZEND_ABSTRACT_ME(iterator, next, arginfo_class_Iterator_next)
+ ZEND_ABSTRACT_ME(iterator, key, arginfo_class_Iterator_key)
+ ZEND_ABSTRACT_ME(iterator, valid, arginfo_class_Iterator_valid)
+ ZEND_ABSTRACT_ME(iterator, rewind, arginfo_class_Iterator_rewind)
ZEND_FE_END
};
static const zend_function_entry *zend_funcs_traversable = NULL;
-ZEND_BEGIN_ARG_INFO_EX(arginfo_arrayaccess_offset, 0, 0, 1)
- ZEND_ARG_INFO(0, offset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_arrayaccess_offset_get, 0, 0, 1) /* actually this should be return by ref but atm cannot be */
- ZEND_ARG_INFO(0, offset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_arrayaccess_offset_value, 0, 0, 2)
- ZEND_ARG_INFO(0, offset)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
static const zend_function_entry zend_funcs_arrayaccess[] = {
- ZEND_ABSTRACT_ME(arrayaccess, offsetExists, arginfo_arrayaccess_offset)
- ZEND_ABSTRACT_ME(arrayaccess, offsetGet, arginfo_arrayaccess_offset_get)
- ZEND_ABSTRACT_ME(arrayaccess, offsetSet, arginfo_arrayaccess_offset_value)
- ZEND_ABSTRACT_ME(arrayaccess, offsetUnset, arginfo_arrayaccess_offset)
+ ZEND_ABSTRACT_ME(arrayaccess, offsetExists, arginfo_class_ArrayAccess_offsetExists)
+ ZEND_ABSTRACT_ME(arrayaccess, offsetGet, arginfo_class_ArrayAccess_offsetGet)
+ ZEND_ABSTRACT_ME(arrayaccess, offsetSet, arginfo_class_ArrayAccess_offsetSet)
+ ZEND_ABSTRACT_ME(arrayaccess, offsetUnset, arginfo_class_ArrayAccess_offsetUnset)
ZEND_FE_END
};
-ZEND_BEGIN_ARG_INFO(arginfo_serializable_serialize, 0)
- ZEND_ARG_INFO(0, serialized)
-ZEND_END_ARG_INFO()
-
static const zend_function_entry zend_funcs_serializable[] = {
- ZEND_ABSTRACT_ME(serializable, serialize, NULL)
- ZEND_FENTRY(unserialize, NULL, arginfo_serializable_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT)
+ ZEND_ABSTRACT_ME(serializable, serialize, arginfo_class_Serializable_serialize)
+ ZEND_FENTRY(unserialize, NULL, arginfo_class_Serializable_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT)
ZEND_FE_END
};
-ZEND_BEGIN_ARG_INFO(arginfo_countable_count, 0)
-ZEND_END_ARG_INFO()
-
static const zend_function_entry zend_funcs_countable[] = {
- ZEND_ABSTRACT_ME(Countable, count, arginfo_countable_count)
+ ZEND_ABSTRACT_ME(Countable, count, arginfo_class_Countable_count)
ZEND_FE_END
};
/* }}} */
diff --git a/Zend/zend_interfaces.h b/Zend/zend_interfaces.h
index 44770a1813..e7d0315ac5 100644
--- a/Zend/zend_interfaces.h
+++ b/Zend/zend_interfaces.h
@@ -37,7 +37,7 @@ typedef struct _zend_user_iterator {
zval value;
} zend_user_iterator;
-ZEND_API zval* zend_call_method(zval *object_pp, zend_class_entry *obj_ce, zend_function **fn_proxy, const char *function_name, size_t function_name_len, zval *retval, int param_count, zval* arg1, zval* arg2);
+ZEND_API zval* zend_call_method(zend_object *object, zend_class_entry *obj_ce, zend_function **fn_proxy, const char *function_name, size_t function_name_len, zval *retval, int param_count, zval* arg1, zval* arg2);
#define zend_call_method_with_0_params(obj, obj_ce, fn_proxy, function_name, retval) \
zend_call_method(obj, obj_ce, fn_proxy, function_name, sizeof(function_name)-1, retval, 0, NULL, NULL)
diff --git a/Zend/zend_interfaces.stub.php b/Zend/zend_interfaces.stub.php
new file mode 100644
index 0000000000..882a21e600
--- /dev/null
+++ b/Zend/zend_interfaces.stub.php
@@ -0,0 +1,51 @@
+<?php
+
+interface Traversable {}
+
+interface IteratorAggregate extends Traversable
+{
+ /** @return Traversable */
+ function getIterator();
+}
+
+interface Iterator extends Traversable
+{
+ function current();
+
+ /** @return void */
+ function next();
+
+ function key();
+
+ /** @return bool */
+ function valid();
+
+ /** @return void */
+ function rewind();
+}
+
+interface ArrayAccess
+{
+ function offsetExists($offset);
+
+ /* actually this should be return by ref but atm cannot be */
+ function offsetGet($offset);
+
+ function offsetSet($offset, $value);
+
+ function offsetUnset($offset);
+}
+
+interface Serializable
+{
+ /** @return string */
+ function serialize();
+
+ function unserialize(string $serialized);
+}
+
+interface Countable
+{
+ /** @return int */
+ function count();
+}
diff --git a/Zend/zend_interfaces_arginfo.h b/Zend/zend_interfaces_arginfo.h
new file mode 100644
index 0000000000..fee57057af
--- /dev/null
+++ b/Zend/zend_interfaces_arginfo.h
@@ -0,0 +1,35 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IteratorAggregate_getIterator, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_Iterator_current arginfo_class_IteratorAggregate_getIterator
+
+#define arginfo_class_Iterator_next arginfo_class_IteratorAggregate_getIterator
+
+#define arginfo_class_Iterator_key arginfo_class_IteratorAggregate_getIterator
+
+#define arginfo_class_Iterator_valid arginfo_class_IteratorAggregate_getIterator
+
+#define arginfo_class_Iterator_rewind arginfo_class_IteratorAggregate_getIterator
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ArrayAccess_offsetExists, 0, 0, 1)
+ ZEND_ARG_INFO(0, offset)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ArrayAccess_offsetGet arginfo_class_ArrayAccess_offsetExists
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ArrayAccess_offsetSet, 0, 0, 2)
+ ZEND_ARG_INFO(0, offset)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ArrayAccess_offsetUnset arginfo_class_ArrayAccess_offsetExists
+
+#define arginfo_class_Serializable_serialize arginfo_class_IteratorAggregate_getIterator
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Serializable_unserialize, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, serialized, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_Countable_count arginfo_class_IteratorAggregate_getIterator
diff --git a/Zend/zend_iterators.c b/Zend/zend_iterators.c
index 379a316c38..9823390a98 100644
--- a/Zend/zend_iterators.c
+++ b/Zend/zend_iterators.c
@@ -24,37 +24,34 @@ static zend_class_entry zend_iterator_class_entry;
static void iter_wrapper_free(zend_object *object);
static void iter_wrapper_dtor(zend_object *object);
-static HashTable *iter_wrapper_get_gc(zval *object, zval **table, int *n);
+static HashTable *iter_wrapper_get_gc(zend_object *object, zval **table, int *n);
static const zend_object_handlers iterator_object_handlers = {
0,
iter_wrapper_free,
iter_wrapper_dtor,
- NULL,
+ NULL, /* clone_obj */
NULL, /* prop read */
NULL, /* prop write */
NULL, /* read dim */
NULL, /* write dim */
- NULL,
- NULL, /* get */
- NULL, /* set */
+ NULL, /* get_property_ptr_ptr */
NULL, /* has prop */
NULL, /* unset prop */
NULL, /* has dim */
NULL, /* unset dim */
NULL, /* props get */
NULL, /* method get */
- NULL, /* call */
NULL, /* get ctor */
NULL, /* get class name */
- NULL, /* compare */
NULL, /* cast */
NULL, /* count */
NULL, /* get_debug_info */
NULL, /* get_closure */
iter_wrapper_get_gc,
NULL, /* do_operation */
- NULL /* compare */
+ NULL, /* compare */
+ NULL /* get_properties_for */
};
ZEND_API void zend_register_iterator_wrapper(void)
@@ -72,7 +69,7 @@ static void iter_wrapper_dtor(zend_object *object)
{
}
-static HashTable *iter_wrapper_get_gc(zval *object, zval **table, int *n) {
+static HashTable *iter_wrapper_get_gc(zend_object *object, zval **table, int *n) {
/* TODO: We need a get_gc iterator handler */
*table = NULL;
*n = 0;
diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y
index 56a354b9cc..02dbd091dc 100644
--- a/Zend/zend_language_parser.y
+++ b/Zend/zend_language_parser.y
@@ -1,5 +1,4 @@
%require "3.0"
-%{
/*
+----------------------------------------------------------------------+
| Zend Engine |
@@ -20,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-#include "zend_compile.h"
+%code top {
#include "zend.h"
#include "zend_list.h"
#include "zend_globals.h"
@@ -33,22 +32,22 @@
#define yytnamerr zend_yytnamerr
static YYSIZE_T zend_yytnamerr(char*, const char*);
-#define YYSTYPE zend_parser_stack_elem
-
#ifdef _MSC_VER
#define YYMALLOC malloc
#define YYFREE free
#endif
+}
-%}
+%code requires {
+#include "zend_compile.h"
+}
+%define api.prefix {zend}
%define api.pure full
+%define api.value.type {zend_parser_stack_elem}
%define parse.error verbose
%expect 0
-%code requires {
-}
-
%destructor { zend_ast_destroy($$); } <ast>
%destructor { if ($$) zend_string_release_ex($$, 0); } <str>
@@ -71,14 +70,15 @@ static YYSIZE_T zend_yytnamerr(char*, const char*);
%left '&'
%nonassoc T_IS_EQUAL T_IS_NOT_EQUAL T_IS_IDENTICAL T_IS_NOT_IDENTICAL T_SPACESHIP
%nonassoc '<' T_IS_SMALLER_OR_EQUAL '>' T_IS_GREATER_OR_EQUAL
+%left '.'
%left T_SL T_SR
-%left '+' '-' '.'
+%left '+' '-'
%left '*' '/' '%'
%precedence '!'
%precedence T_INSTANCEOF
%precedence '~' T_INT_CAST T_DOUBLE_CAST T_STRING_CAST T_ARRAY_CAST T_OBJECT_CAST T_BOOL_CAST T_UNSET_CAST '@'
%right T_POW
-%precedence T_NEW T_CLONE
+%precedence T_CLONE
/* Resolve danging else conflict */
%precedence T_NOELSE
@@ -241,7 +241,8 @@ static YYSIZE_T zend_yytnamerr(char*, const char*);
%type <ast> new_expr anonymous_class class_name class_name_reference simple_variable
%type <ast> internal_functions_in_yacc
%type <ast> exit_expr scalar backticks_expr lexical_var function_call member_name property_name
-%type <ast> variable_class_name dereferencable_scalar constant dereferencable
+%type <ast> variable_class_name dereferencable_scalar constant class_constant
+%type <ast> fully_dereferencable array_object_dereferencable
%type <ast> callable_expr callable_variable static_member new_variable
%type <ast> encaps_var encaps_var_offset isset_variables
%type <ast> top_statement_list use_declarations const_list inner_statement_list if_stmt
@@ -249,13 +250,13 @@ static YYSIZE_T zend_yytnamerr(char*, const char*);
%type <ast> echo_expr_list unset_variables catch_name_list catch_list parameter_list class_statement_list
%type <ast> implements_list case_list if_stmt_without_else
%type <ast> non_empty_parameter_list argument_list non_empty_argument_list property_list
-%type <ast> class_const_list class_const_decl name_list trait_adaptations method_body non_empty_for_exprs
+%type <ast> class_const_list class_const_decl class_name_list trait_adaptations method_body non_empty_for_exprs
%type <ast> ctor_arguments alt_if_stmt_without_else trait_adaptation_list lexical_vars
%type <ast> lexical_var_list encaps_list
%type <ast> array_pair non_empty_array_pair_list array_pair_list possible_array_pair
%type <ast> isset_variable type return_type type_expr
%type <ast> identifier
-%type <ast> inline_function
+%type <ast> inline_function union_type
%type <num> returns_ref function fn is_reference is_variadic variable_modifiers
%type <num> method_modifiers non_empty_member_modifiers member_modifier
@@ -296,7 +297,7 @@ identifier:
top_statement_list:
top_statement_list top_statement { $$ = zend_ast_list_add($1, $2); }
- | /* empty */ { $$ = zend_ast_create_list(0, ZEND_AST_STMT_LIST); }
+ | %empty { $$ = zend_ast_create_list(0, ZEND_AST_STMT_LIST); }
;
namespace_name:
@@ -356,7 +357,7 @@ mixed_group_use_declaration:
;
possible_comma:
- /* empty */
+ %empty
| ','
;
@@ -406,7 +407,7 @@ const_list:
inner_statement_list:
inner_statement_list inner_statement
{ $$ = zend_ast_list_add($1, $2); }
- | /* empty */
+ | %empty
{ $$ = zend_ast_create_list(0, ZEND_AST_STMT_LIST); }
;
@@ -462,19 +463,19 @@ statement:
;
catch_list:
- /* empty */
+ %empty
{ $$ = zend_ast_create_list(0, ZEND_AST_CATCH_LIST); }
| catch_list T_CATCH '(' catch_name_list T_VARIABLE ')' '{' inner_statement_list '}'
{ $$ = zend_ast_list_add($1, zend_ast_create(ZEND_AST_CATCH, $4, $5, $8)); }
;
catch_name_list:
- name { $$ = zend_ast_create_list(1, ZEND_AST_NAME_LIST, $1); }
- | catch_name_list '|' name { $$ = zend_ast_list_add($1, $3); }
+ class_name { $$ = zend_ast_create_list(1, ZEND_AST_NAME_LIST, $1); }
+ | catch_name_list '|' class_name { $$ = zend_ast_list_add($1, $3); }
;
finally_statement:
- /* empty */ { $$ = NULL; }
+ %empty { $$ = NULL; }
| T_FINALLY '{' inner_statement_list '}' { $$ = $3; }
;
@@ -495,12 +496,12 @@ function_declaration_statement:
;
is_reference:
- /* empty */ { $$ = 0; }
+ %empty { $$ = 0; }
| '&' { $$ = ZEND_PARAM_REF; }
;
is_variadic:
- /* empty */ { $$ = 0; }
+ %empty { $$ = 0; }
| T_ELLIPSIS { $$ = ZEND_PARAM_VARIADIC; }
;
@@ -537,18 +538,18 @@ interface_declaration_statement:
;
extends_from:
- /* empty */ { $$ = NULL; }
- | T_EXTENDS name { $$ = $2; }
+ %empty { $$ = NULL; }
+ | T_EXTENDS class_name { $$ = $2; }
;
interface_extends_list:
- /* empty */ { $$ = NULL; }
- | T_EXTENDS name_list { $$ = $2; }
+ %empty { $$ = NULL; }
+ | T_EXTENDS class_name_list { $$ = $2; }
;
implements_list:
- /* empty */ { $$ = NULL; }
- | T_IMPLEMENTS name_list { $$ = $2; }
+ %empty { $$ = NULL; }
+ | T_IMPLEMENTS class_name_list { $$ = $2; }
;
foreach_variable:
@@ -581,7 +582,7 @@ switch_case_list:
;
case_list:
- /* empty */ { $$ = zend_ast_create_list(0, ZEND_AST_SWITCH_LIST); }
+ %empty { $$ = zend_ast_create_list(0, ZEND_AST_SWITCH_LIST); }
| case_list T_CASE expr case_separator inner_statement_list
{ $$ = zend_ast_list_add($1, zend_ast_create(ZEND_AST_SWITCH_CASE, $3, $5)); }
| case_list T_DEFAULT case_separator inner_statement_list
@@ -633,7 +634,7 @@ alt_if_stmt:
parameter_list:
non_empty_parameter_list { $$ = $1; }
- | /* empty */ { $$ = zend_ast_create_list(0, ZEND_AST_PARAM_LIST); }
+ | %empty { $$ = zend_ast_create_list(0, ZEND_AST_PARAM_LIST); }
;
@@ -653,13 +654,14 @@ parameter:
optional_type:
- /* empty */ { $$ = NULL; }
+ %empty { $$ = NULL; }
| type_expr { $$ = $1; }
;
type_expr:
type { $$ = $1; }
| '?' type { $$ = $2; $$->attr |= ZEND_TYPE_NULLABLE; }
+ | union_type { $$ = $1; }
;
type:
@@ -668,8 +670,13 @@ type:
| name { $$ = $1; }
;
+union_type:
+ type '|' type { $$ = zend_ast_create_list(2, ZEND_AST_TYPE_UNION, $1, $3); }
+ | union_type '|' type { $$ = zend_ast_list_add($1, $3); }
+;
+
return_type:
- /* empty */ { $$ = NULL; }
+ %empty { $$ = NULL; }
| ':' type_expr { $$ = $2; }
;
@@ -715,7 +722,7 @@ static_var:
class_statement_list:
class_statement_list class_statement
{ $$ = zend_ast_list_add($1, $2); }
- | /* empty */
+ | %empty
{ $$ = zend_ast_create_list(0, ZEND_AST_STMT_LIST); }
;
@@ -726,7 +733,7 @@ class_statement:
$$->attr = $1; }
| method_modifiers T_CONST class_const_list ';'
{ $$ = $3; $$->attr = $1; }
- | T_USE name_list trait_adaptations
+ | T_USE class_name_list trait_adaptations
{ $$ = zend_ast_create(ZEND_AST_USE_TRAIT, $2, $3); }
| method_modifiers function returns_ref identifier backup_doc_comment '(' parameter_list ')'
return_type backup_fn_flags method_body backup_fn_flags
@@ -734,9 +741,9 @@ class_statement:
zend_ast_get_str($4), $7, NULL, $11, $9); CG(extra_fn_flags) = $10; }
;
-name_list:
- name { $$ = zend_ast_create_list(1, ZEND_AST_NAME_LIST, $1); }
- | name_list ',' name { $$ = zend_ast_list_add($1, $3); }
+class_name_list:
+ class_name { $$ = zend_ast_create_list(1, ZEND_AST_NAME_LIST, $1); }
+ | class_name_list ',' class_name { $$ = zend_ast_list_add($1, $3); }
;
trait_adaptations:
@@ -758,7 +765,7 @@ trait_adaptation:
;
trait_precedence:
- absolute_trait_method_reference T_INSTEADOF name_list
+ absolute_trait_method_reference T_INSTEADOF class_name_list
{ $$ = zend_ast_create(ZEND_AST_TRAIT_PRECEDENCE, $1, $3); }
;
@@ -780,7 +787,7 @@ trait_method_reference:
;
absolute_trait_method_reference:
- name T_PAAMAYIM_NEKUDOTAYIM identifier
+ class_name T_PAAMAYIM_NEKUDOTAYIM identifier
{ $$ = zend_ast_create(ZEND_AST_METHOD_REFERENCE, $1, $3); }
;
@@ -795,7 +802,7 @@ variable_modifiers:
;
method_modifiers:
- /* empty */ { $$ = ZEND_ACC_PUBLIC; }
+ %empty { $$ = ZEND_ACC_PUBLIC; }
| non_empty_member_modifiers
{ $$ = $1; if (!($$ & ZEND_ACC_PPP_MASK)) { $$ |= ZEND_ACC_PUBLIC; } }
;
@@ -849,7 +856,7 @@ echo_expr:
;
for_exprs:
- /* empty */ { $$ = NULL; }
+ %empty { $$ = NULL; }
| non_empty_for_exprs { $$ = $1; }
;
@@ -966,7 +973,6 @@ expr:
| '(' expr ')' {
$$ = $2;
if ($$->kind == ZEND_AST_CONDITIONAL) $$->attr = ZEND_PARENTHESIZED_CONDITIONAL;
- if ($$->kind == ZEND_AST_BINARY_OP && $$->attr == ZEND_CONCAT) $$->attr = ZEND_PARENTHESIZED_CONCAT;
}
| new_expr { $$ = $1; }
| expr '?' expr ':' expr
@@ -1020,24 +1026,24 @@ function:
;
backup_doc_comment:
- /* empty */ { $$ = CG(doc_comment); CG(doc_comment) = NULL; }
+ %empty { $$ = CG(doc_comment); CG(doc_comment) = NULL; }
;
backup_fn_flags:
- %prec PREC_ARROW_FUNCTION /* empty */ { $$ = CG(extra_fn_flags); CG(extra_fn_flags) = 0; }
+ %prec PREC_ARROW_FUNCTION %empty { $$ = CG(extra_fn_flags); CG(extra_fn_flags) = 0; }
;
backup_lex_pos:
- /* empty */ { $$ = LANG_SCNG(yy_text); }
+ %empty { $$ = LANG_SCNG(yy_text); }
;
returns_ref:
- /* empty */ { $$ = 0; }
+ %empty { $$ = 0; }
| '&' { $$ = ZEND_ACC_RETURN_REFERENCE; }
;
lexical_vars:
- /* empty */ { $$ = NULL; }
+ %empty { $$ = NULL; }
| T_USE '(' lexical_var_list ')' { $$ = $3; }
;
@@ -1072,15 +1078,16 @@ class_name:
class_name_reference:
class_name { $$ = $1; }
| new_variable { $$ = $1; }
+ | '(' expr ')' { $$ = $2; }
;
exit_expr:
- /* empty */ { $$ = NULL; }
+ %empty { $$ = NULL; }
| '(' optional_expr ')' { $$ = $2; }
;
backticks_expr:
- /* empty */
+ %empty
{ $$ = zend_ast_create_zval_from_str(ZSTR_EMPTY_ALLOC()); }
| T_ENCAPSED_AND_WHITESPACE { $$ = $1; }
| encaps_list { $$ = $1; }
@@ -1088,7 +1095,7 @@ backticks_expr:
ctor_arguments:
- /* empty */ { $$ = zend_ast_create_list(0, ZEND_AST_ARG_LIST); }
+ %empty { $$ = zend_ast_create_list(0, ZEND_AST_ARG_LIST); }
| argument_list { $$ = $1; }
;
@@ -1097,11 +1104,23 @@ dereferencable_scalar:
T_ARRAY '(' array_pair_list ')' { $$ = $3; $$->attr = ZEND_ARRAY_SYNTAX_LONG; }
| '[' array_pair_list ']' { $$ = $2; $$->attr = ZEND_ARRAY_SYNTAX_SHORT; }
| T_CONSTANT_ENCAPSED_STRING { $$ = $1; }
+ | '"' encaps_list '"' { $$ = $2; }
;
scalar:
T_LNUMBER { $$ = $1; }
| T_DNUMBER { $$ = $1; }
+ | T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE T_END_HEREDOC { $$ = $2; }
+ | T_START_HEREDOC T_END_HEREDOC
+ { $$ = zend_ast_create_zval_from_str(ZSTR_EMPTY_ALLOC()); }
+ | T_START_HEREDOC encaps_list T_END_HEREDOC { $$ = $2; }
+ | dereferencable_scalar { $$ = $1; }
+ | constant { $$ = $1; }
+ | class_constant { $$ = $1; }
+;
+
+constant:
+ name { $$ = zend_ast_create(ZEND_AST_CONST, $1); }
| T_LINE { $$ = zend_ast_create_ex(ZEND_AST_MAGIC_CONST, T_LINE); }
| T_FILE { $$ = zend_ast_create_ex(ZEND_AST_MAGIC_CONST, T_FILE); }
| T_DIR { $$ = zend_ast_create_ex(ZEND_AST_MAGIC_CONST, T_DIR); }
@@ -1110,36 +1129,34 @@ scalar:
| T_FUNC_C { $$ = zend_ast_create_ex(ZEND_AST_MAGIC_CONST, T_FUNC_C); }
| T_NS_C { $$ = zend_ast_create_ex(ZEND_AST_MAGIC_CONST, T_NS_C); }
| T_CLASS_C { $$ = zend_ast_create_ex(ZEND_AST_MAGIC_CONST, T_CLASS_C); }
- | T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE T_END_HEREDOC { $$ = $2; }
- | T_START_HEREDOC T_END_HEREDOC
- { $$ = zend_ast_create_zval_from_str(ZSTR_EMPTY_ALLOC()); }
- | '"' encaps_list '"' { $$ = $2; }
- | T_START_HEREDOC encaps_list T_END_HEREDOC { $$ = $2; }
- | dereferencable_scalar { $$ = $1; }
- | constant { $$ = $1; }
;
-constant:
- name { $$ = zend_ast_create(ZEND_AST_CONST, $1); }
- | class_name T_PAAMAYIM_NEKUDOTAYIM identifier
+class_constant:
+ class_name T_PAAMAYIM_NEKUDOTAYIM identifier
{ $$ = zend_ast_create_class_const_or_name($1, $3); }
| variable_class_name T_PAAMAYIM_NEKUDOTAYIM identifier
{ $$ = zend_ast_create_class_const_or_name($1, $3); }
;
optional_expr:
- /* empty */ { $$ = NULL; }
+ %empty { $$ = NULL; }
| expr { $$ = $1; }
;
variable_class_name:
- dereferencable { $$ = $1; }
+ fully_dereferencable { $$ = $1; }
;
-dereferencable:
+fully_dereferencable:
variable { $$ = $1; }
| '(' expr ')' { $$ = $2; }
| dereferencable_scalar { $$ = $1; }
+ | class_constant { $$ = $1; }
+;
+
+array_object_dereferencable:
+ fully_dereferencable { $$ = $1; }
+ | constant { $$ = $1; }
;
callable_expr:
@@ -1151,13 +1168,11 @@ callable_expr:
callable_variable:
simple_variable
{ $$ = zend_ast_create(ZEND_AST_VAR, $1); }
- | dereferencable '[' optional_expr ']'
- { $$ = zend_ast_create(ZEND_AST_DIM, $1, $3); }
- | constant '[' optional_expr ']'
+ | array_object_dereferencable '[' optional_expr ']'
{ $$ = zend_ast_create(ZEND_AST_DIM, $1, $3); }
- | dereferencable '{' expr '}'
+ | array_object_dereferencable '{' expr '}'
{ $$ = zend_ast_create_ex(ZEND_AST_DIM, ZEND_DIM_ALTERNATIVE_SYNTAX, $1, $3); }
- | dereferencable T_OBJECT_OPERATOR property_name argument_list
+ | array_object_dereferencable T_OBJECT_OPERATOR property_name argument_list
{ $$ = zend_ast_create(ZEND_AST_METHOD_CALL, $1, $3, $4); }
| function_call { $$ = $1; }
;
@@ -1167,7 +1182,7 @@ variable:
{ $$ = $1; }
| static_member
{ $$ = $1; }
- | dereferencable T_OBJECT_OPERATOR property_name
+ | array_object_dereferencable T_OBJECT_OPERATOR property_name
{ $$ = zend_ast_create(ZEND_AST_PROP, $1, $3); }
;
@@ -1217,7 +1232,7 @@ array_pair_list:
;
possible_array_pair:
- /* empty */ { $$ = NULL; }
+ %empty { $$ = NULL; }
| array_pair { $$ = $1; }
;
@@ -1350,7 +1365,7 @@ static YYSIZE_T zend_yytnamerr(char *yyres, const char *yystr)
str = LANG_SCNG(yy_text);
end = memchr(str, '\n', LANG_SCNG(yy_leng));
- yystr_len = (unsigned int)yystrlen(yystr);
+ yystr_len = (unsigned int)strlen(yystr);
if ((tok1 = memchr(yystr, '(', yystr_len)) != NULL
&& (tok2 = zend_memrchr(yystr, ')', yystr_len)) != NULL) {
@@ -1378,7 +1393,7 @@ static YYSIZE_T zend_yytnamerr(char *yyres, const char *yystr)
/* One of the expected tokens */
if (!yyres) {
- return yystrlen(yystr) - (*yystr == '"' ? 2 : 0);
+ return strlen(yystr) - (*yystr == '"' ? 2 : 0);
}
if (*yystr == '"') {
diff --git a/Zend/zend_language_scanner.h b/Zend/zend_language_scanner.h
index 3640b9a5ea..4d51a064fc 100644
--- a/Zend/zend_language_scanner.h
+++ b/Zend/zend_language_scanner.h
@@ -66,7 +66,7 @@ typedef struct _zend_heredoc_label {
BEGIN_EXTERN_C()
ZEND_API void zend_save_lexical_state(zend_lex_state *lex_state);
ZEND_API void zend_restore_lexical_state(zend_lex_state *lex_state);
-ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename);
+ZEND_API int zend_prepare_string_for_scanning(zval *str, const char *filename);
ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter, const zend_encoding *old_encoding);
ZEND_API int zend_multibyte_set_filter(const zend_encoding *onetime_encoding);
ZEND_API void zend_lex_tstring(zval *zv);
diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l
index 412356cdc1..0c066c52ab 100644
--- a/Zend/zend_language_scanner.l
+++ b/Zend/zend_language_scanner.l
@@ -687,7 +687,7 @@ zend_op_array *compile_filename(int type, zval *filename)
return retval;
}
-ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename)
+ZEND_API int zend_prepare_string_for_scanning(zval *str, const char *filename)
{
char *buf;
size_t size, old_len;
@@ -755,7 +755,7 @@ ZEND_API size_t zend_get_scanned_file_offset(void)
return offset;
}
-zend_op_array *compile_string(zval *source_string, char *filename)
+zend_op_array *compile_string(zval *source_string, const char *filename)
{
zend_lex_state original_lex_state;
zend_op_array *op_array = NULL;
@@ -786,7 +786,7 @@ zend_op_array *compile_string(zval *source_string, char *filename)
BEGIN_EXTERN_C()
-int highlight_file(char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini)
+int highlight_file(const char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini)
{
zend_lex_state original_lex_state;
zend_file_handle file_handle;
@@ -808,7 +808,7 @@ int highlight_file(char *filename, zend_syntax_highlighter_ini *syntax_highlight
return SUCCESS;
}
-int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, char *str_name)
+int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini, const char *str_name)
{
zend_lex_state original_lex_state;
zval tmp;
@@ -2192,8 +2192,11 @@ inline_char_handler:
if (YYCURSOR < YYLIMIT) {
YYCURSOR++;
- } else if (!SCNG(heredoc_scan_ahead)) {
- zend_error(E_COMPILE_WARNING, "Unterminated comment starting line %d", CG(zend_lineno));
+ } else {
+ zend_throw_exception_ex(zend_ce_parse_error, 0, "Unterminated comment starting line %d", CG(zend_lineno));
+ if (PARSER_MODE()) {
+ RETURN_TOKEN(T_ERROR);
+ }
}
yyleng = YYCURSOR - SCNG(yy_text);
@@ -2861,14 +2864,7 @@ nowdoc_scan_done:
RETURN_TOKEN(END);
}
- if (!SCNG(heredoc_scan_ahead)) {
- zend_error(E_COMPILE_WARNING, "Unexpected character in input: '%c' (ASCII=%d) state=%d", yytext[0], yytext[0], YYSTATE);
- }
- if (PARSER_MODE()) {
- goto restart;
- } else {
- RETURN_TOKEN(T_BAD_CHARACTER);
- }
+ RETURN_TOKEN(T_BAD_CHARACTER);
}
*/
diff --git a/Zend/zend_list.c b/Zend/zend_list.c
index 21d013a589..2288cf6913 100644
--- a/Zend/zend_list.c
+++ b/Zend/zend_list.c
@@ -113,7 +113,7 @@ ZEND_API void *zend_fetch_resource2(zend_resource *res, const char *resource_typ
if (resource_type_name) {
const char *space;
const char *class_name = get_active_class_name(&space);
- zend_error(E_WARNING, "%s%s%s(): supplied resource is not a valid %s resource", class_name, space, get_active_function_name(), resource_type_name);
+ zend_type_error("%s%s%s(): supplied resource is not a valid %s resource", class_name, space, get_active_function_name(), resource_type_name);
}
return NULL;
@@ -128,7 +128,7 @@ ZEND_API void *zend_fetch_resource(zend_resource *res, const char *resource_type
if (resource_type_name) {
const char *space;
const char *class_name = get_active_class_name(&space);
- zend_error(E_WARNING, "%s%s%s(): supplied resource is not a valid %s resource", class_name, space, get_active_function_name(), resource_type_name);
+ zend_type_error("%s%s%s(): supplied resource is not a valid %s resource", class_name, space, get_active_function_name(), resource_type_name);
}
return NULL;
@@ -140,14 +140,14 @@ ZEND_API void *zend_fetch_resource_ex(zval *res, const char *resource_type_name,
if (res == NULL) {
if (resource_type_name) {
class_name = get_active_class_name(&space);
- zend_error(E_WARNING, "%s%s%s(): no %s resource supplied", class_name, space, get_active_function_name(), resource_type_name);
+ zend_type_error("%s%s%s(): no %s resource supplied", class_name, space, get_active_function_name(), resource_type_name);
}
return NULL;
}
if (Z_TYPE_P(res) != IS_RESOURCE) {
if (resource_type_name) {
class_name = get_active_class_name(&space);
- zend_error(E_WARNING, "%s%s%s(): supplied argument is not a valid %s resource", class_name, space, get_active_function_name(), resource_type_name);
+ zend_type_error("%s%s%s(): supplied argument is not a valid %s resource", class_name, space, get_active_function_name(), resource_type_name);
}
return NULL;
}
@@ -161,14 +161,14 @@ ZEND_API void *zend_fetch_resource2_ex(zval *res, const char *resource_type_name
if (res == NULL) {
if (resource_type_name) {
class_name = get_active_class_name(&space);
- zend_error(E_WARNING, "%s%s%s(): no %s resource supplied", class_name, space, get_active_function_name(), resource_type_name);
+ zend_type_error("%s%s%s(): no %s resource supplied", class_name, space, get_active_function_name(), resource_type_name);
}
return NULL;
}
if (Z_TYPE_P(res) != IS_RESOURCE) {
if (resource_type_name) {
class_name = get_active_class_name(&space);
- zend_error(E_WARNING, "%s%s%s(): supplied argument is not a valid %s resource", class_name, space, get_active_function_name(), resource_type_name);
+ zend_type_error("%s%s%s(): supplied argument is not a valid %s resource", class_name, space, get_active_function_name(), resource_type_name);
}
return NULL;
}
@@ -209,6 +209,7 @@ void plist_entry_destructor(zval *zv)
ZEND_API int zend_init_rsrc_list(void)
{
zend_hash_init(&EG(regular_list), 8, NULL, list_entry_destructor, 0);
+ EG(regular_list).nNextFreeElement = 0;
return SUCCESS;
}
diff --git a/Zend/zend_map_ptr.h b/Zend/zend_map_ptr.h
index 5c88ce0bc4..c6930473cf 100644
--- a/Zend/zend_map_ptr.h
+++ b/Zend/zend_map_ptr.h
@@ -46,6 +46,11 @@
# define ZEND_MAP_PTR_NEW(ptr) do { \
ZEND_MAP_PTR(ptr) = zend_map_ptr_new(); \
} while (0)
+# define ZEND_MAP_PTR_REAL_BASE(base) \
+ (base)
+# define ZEND_MAP_PTR_SET_REAL_BASE(base, ptr) do { \
+ base = (ptr); \
+ } while (0)
#elif ZEND_MAP_PTR_KIND == ZEND_MAP_PTR_KIND_PTR_OR_OFFSET
# define ZEND_MAP_PTR(ptr) \
ptr ## __ptr
@@ -54,19 +59,19 @@
# define ZEND_MAP_PTR_IS_OFFSET(ptr) \
(((uintptr_t)ZEND_MAP_PTR(ptr)) & 1L)
# define ZEND_MAP_PTR_OFFSET2PTR(ptr) \
- ((void**)((char*)CG(map_ptr_base) + (uintptr_t)ZEND_MAP_PTR(ptr) - 1))
+ ((void**)((char*)CG(map_ptr_base) + (uintptr_t)ZEND_MAP_PTR(ptr)))
# define ZEND_MAP_PTR_PTR2OFFSET(ptr) \
- ((void*)((uintptr_t)(((char*)(ptr)) - ((char*)CG(map_ptr_base))) | 1L))
+ ((void*)(((char*)(ptr)) - ((char*)CG(map_ptr_base))))
# define ZEND_MAP_PTR_GET(ptr) \
- (ZEND_MAP_PTR_IS_OFFSET(ptr) ? \
- *(ZEND_MAP_PTR_OFFSET2PTR(ptr)) : \
- (void*)(*(ZEND_MAP_PTR(ptr))))
+ (*(ZEND_MAP_PTR_IS_OFFSET(ptr) ? \
+ ZEND_MAP_PTR_OFFSET2PTR(ptr) : \
+ ((void**)(ZEND_MAP_PTR(ptr)))))
# define ZEND_MAP_PTR_SET(ptr, val) do { \
+ void **__p = (void**)(ZEND_MAP_PTR(ptr)); \
if (ZEND_MAP_PTR_IS_OFFSET(ptr)) { \
- *(ZEND_MAP_PTR_OFFSET2PTR(ptr)) = (val); \
- } else { \
- *(ZEND_MAP_PTR(ptr)) = (val); \
+ __p = ZEND_MAP_PTR_OFFSET2PTR(ptr); \
} \
+ *__p = (val); \
} while (0)
# define ZEND_MAP_PTR_INIT(ptr, val) do { \
ZEND_MAP_PTR(ptr) = (val); \
@@ -74,6 +79,11 @@
# define ZEND_MAP_PTR_NEW(ptr) do { \
ZEND_MAP_PTR(ptr) = zend_map_ptr_new(); \
} while (0)
+# define ZEND_MAP_PTR_REAL_BASE(base) \
+ ((void*)(((uintptr_t)(base)) + 1))
+# define ZEND_MAP_PTR_SET_REAL_BASE(base, ptr) do { \
+ base = (void*)(((uintptr_t)(ptr)) - 1); \
+ } while (0)
#else
# error "Unknown ZEND_MAP_PTR_KIND"
#endif
diff --git a/Zend/zend_modules.h b/Zend/zend_modules.h
index 908acd7d32..047d9d77ce 100644
--- a/Zend/zend_modules.h
+++ b/Zend/zend_modules.h
@@ -31,7 +31,7 @@
#define ZEND_MODULE_INFO_FUNC_ARGS zend_module_entry *zend_module
#define ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU zend_module
-#define ZEND_MODULE_API_NO 20190902
+#define ZEND_MODULE_API_NO 20190128
#ifdef ZTS
#define USING_ZTS 1
#else
diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c
index 610b15c6aa..57529afa3f 100644
--- a/Zend/zend_object_handlers.c
+++ b/Zend/zend_object_handlers.c
@@ -104,10 +104,8 @@ ZEND_API void rebuild_object_properties(zend_object *zobj) /* {{{ */
}
/* }}} */
-ZEND_API HashTable *zend_std_get_properties(zval *object) /* {{{ */
+ZEND_API HashTable *zend_std_get_properties(zend_object *zobj) /* {{{ */
{
- zend_object *zobj;
- zobj = Z_OBJ_P(object);
if (!zobj->properties) {
rebuild_object_properties(zobj);
}
@@ -115,15 +113,13 @@ ZEND_API HashTable *zend_std_get_properties(zval *object) /* {{{ */
}
/* }}} */
-ZEND_API HashTable *zend_std_get_gc(zval *object, zval **table, int *n) /* {{{ */
+ZEND_API HashTable *zend_std_get_gc(zend_object *zobj, zval **table, int *n) /* {{{ */
{
- if (Z_OBJ_HANDLER_P(object, get_properties) != zend_std_get_properties) {
+ if (zobj->handlers->get_properties != zend_std_get_properties) {
*table = NULL;
*n = 0;
- return Z_OBJ_HANDLER_P(object, get_properties)(object);
+ return zobj->handlers->get_properties(zobj);
} else {
- zend_object *zobj = Z_OBJ_P(object);
-
if (zobj->properties) {
*table = NULL;
*n = 0;
@@ -142,15 +138,15 @@ ZEND_API HashTable *zend_std_get_gc(zval *object, zval **table, int *n) /* {{{ *
}
/* }}} */
-ZEND_API HashTable *zend_std_get_debug_info(zval *object, int *is_temp) /* {{{ */
+ZEND_API HashTable *zend_std_get_debug_info(zend_object *object, int *is_temp) /* {{{ */
{
- zend_class_entry *ce = Z_OBJCE_P(object);
+ zend_class_entry *ce = object->ce;
zval retval;
HashTable *ht;
if (!ce->__debugInfo) {
*is_temp = 0;
- return Z_OBJ_HANDLER_P(object, get_properties)(object);
+ return object->handlers->get_properties(object);
}
zend_call_method_with_0_params(object, ce, &ce->__debugInfo, ZEND_DEBUGINFO_FUNC_NAME, &retval);
@@ -458,7 +454,7 @@ found:
}
offset = property_info->offset;
- if (EXPECTED(!property_info->type)) {
+ if (EXPECTED(!ZEND_TYPE_IS_SET(property_info->type))) {
property_info = NULL;
} else {
*info_ptr = property_info;
@@ -652,23 +648,16 @@ ZEND_API uint32_t *zend_get_property_guard(zend_object *zobj, zend_string *membe
}
/* }}} */
-ZEND_API zval *zend_std_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) /* {{{ */
+ZEND_API zval *zend_std_read_property(zend_object *zobj, zend_string *name, int type, void **cache_slot, zval *rv) /* {{{ */
{
- zend_object *zobj;
- zend_string *name, *tmp_name;
zval *retval;
uintptr_t property_offset;
zend_property_info *prop_info = NULL;
uint32_t *guard = NULL;
-
- zobj = Z_OBJ_P(object);
- name = zval_try_get_tmp_string(member, &tmp_name);
- if (UNEXPECTED(!name)) {
- return &EG(uninitialized_zval);
- }
+ zend_string *tmp_name = NULL;
#if DEBUG_OBJECT_HANDLERS
- fprintf(stderr, "Read object #%d property: %s\n", Z_OBJ_HANDLE_P(object), ZSTR_VAL(name));
+ fprintf(stderr, "Read object #%d property: %s\n", zobj->handle, ZSTR_VAL(name));
#endif
/* make zend_get_property_info silent if we have getter - we may want to use it */
@@ -793,7 +782,7 @@ uninit_error:
ZSTR_VAL(prop_info->ce->name),
ZSTR_VAL(name));
} else {
- zend_error(E_NOTICE,"Undefined property: %s::$%s", ZSTR_VAL(zobj->ce->name), ZSTR_VAL(name));
+ zend_error(E_WARNING, "Undefined property: %s::$%s", ZSTR_VAL(zobj->ce->name), ZSTR_VAL(name));
}
}
retval = &EG(uninitialized_zval);
@@ -805,21 +794,13 @@ exit:
}
/* }}} */
-ZEND_API zval *zend_std_write_property(zval *object, zval *member, zval *value, void **cache_slot) /* {{{ */
+ZEND_API zval *zend_std_write_property(zend_object *zobj, zend_string *name, zval *value, void **cache_slot) /* {{{ */
{
- zend_object *zobj;
- zend_string *name, *tmp_name;
zval *variable_ptr, tmp;
uintptr_t property_offset;
zend_property_info *prop_info = NULL;
ZEND_ASSERT(!Z_ISREF_P(value));
- zobj = Z_OBJ_P(object);
- name = zval_try_get_tmp_string(member, &tmp_name);
- if (UNEXPECTED(!name)) {
- return value;
- }
-
property_offset = zend_get_property_offset(zobj->ce, name, (zobj->ce->__set != NULL), cache_slot, &prop_info);
if (EXPECTED(IS_VALID_PROPERTY_OFFSET(property_offset))) {
@@ -912,7 +893,6 @@ write_std_property:
}
exit:
- zend_tmp_string_release(tmp_name);
return variable_ptr;
}
/* }}} */
@@ -923,12 +903,12 @@ static ZEND_COLD zend_never_inline void zend_bad_array_access(zend_class_entry *
}
/* }}} */
-ZEND_API zval *zend_std_read_dimension(zval *object, zval *offset, int type, zval *rv) /* {{{ */
+ZEND_API zval *zend_std_read_dimension(zend_object *object, zval *offset, int type, zval *rv) /* {{{ */
{
- zend_class_entry *ce = Z_OBJCE_P(object);
- zval tmp_offset, tmp_object;
+ zend_class_entry *ce = object->ce;
+ zval tmp_offset;
- if (EXPECTED(instanceof_function_ex(ce, zend_ce_arrayaccess, 1) != 0)) {
+ if (EXPECTED(zend_class_implements_interface(ce, zend_ce_arrayaccess) != 0)) {
if (offset == NULL) {
/* [] construct */
ZVAL_NULL(&tmp_offset);
@@ -936,17 +916,16 @@ ZEND_API zval *zend_std_read_dimension(zval *object, zval *offset, int type, zva
ZVAL_COPY_DEREF(&tmp_offset, offset);
}
- Z_ADDREF_P(object);
- ZVAL_OBJ(&tmp_object, Z_OBJ_P(object));
+ GC_ADDREF(object);
if (type == BP_VAR_IS) {
- zend_call_method_with_1_params(&tmp_object, ce, NULL, "offsetexists", rv, &tmp_offset);
+ zend_call_method_with_1_params(object, ce, NULL, "offsetexists", rv, &tmp_offset);
if (UNEXPECTED(Z_ISUNDEF_P(rv))) {
- zval_ptr_dtor(&tmp_object);
+ OBJ_RELEASE(object);
zval_ptr_dtor(&tmp_offset);
return NULL;
}
if (!i_zend_is_true(rv)) {
- zval_ptr_dtor(&tmp_object);
+ OBJ_RELEASE(object);
zval_ptr_dtor(&tmp_offset);
zval_ptr_dtor(rv);
return &EG(uninitialized_zval);
@@ -954,9 +933,9 @@ ZEND_API zval *zend_std_read_dimension(zval *object, zval *offset, int type, zva
zval_ptr_dtor(rv);
}
- zend_call_method_with_1_params(&tmp_object, ce, NULL, "offsetget", rv, &tmp_offset);
+ zend_call_method_with_1_params(object, ce, NULL, "offsetget", rv, &tmp_offset);
- zval_ptr_dtor(&tmp_object);
+ OBJ_RELEASE(object);
zval_ptr_dtor(&tmp_offset);
if (UNEXPECTED(Z_TYPE_P(rv) == IS_UNDEF)) {
@@ -973,21 +952,20 @@ ZEND_API zval *zend_std_read_dimension(zval *object, zval *offset, int type, zva
}
/* }}} */
-ZEND_API void zend_std_write_dimension(zval *object, zval *offset, zval *value) /* {{{ */
+ZEND_API void zend_std_write_dimension(zend_object *object, zval *offset, zval *value) /* {{{ */
{
- zend_class_entry *ce = Z_OBJCE_P(object);
- zval tmp_offset, tmp_object;
+ zend_class_entry *ce = object->ce;
+ zval tmp_offset;
- if (EXPECTED(instanceof_function_ex(ce, zend_ce_arrayaccess, 1) != 0)) {
+ if (EXPECTED(zend_class_implements_interface(ce, zend_ce_arrayaccess) != 0)) {
if (!offset) {
ZVAL_NULL(&tmp_offset);
} else {
ZVAL_COPY_DEREF(&tmp_offset, offset);
}
- Z_ADDREF_P(object);
- ZVAL_OBJ(&tmp_object, Z_OBJ_P(object));
- zend_call_method_with_2_params(&tmp_object, ce, NULL, "offsetset", NULL, &tmp_offset, value);
- zval_ptr_dtor(&tmp_object);
+ GC_ADDREF(object);
+ zend_call_method_with_2_params(object, ce, NULL, "offsetset", NULL, &tmp_offset, value);
+ OBJ_RELEASE(object);
zval_ptr_dtor(&tmp_offset);
} else {
zend_bad_array_access(ce);
@@ -995,25 +973,24 @@ ZEND_API void zend_std_write_dimension(zval *object, zval *offset, zval *value)
}
/* }}} */
-ZEND_API int zend_std_has_dimension(zval *object, zval *offset, int check_empty) /* {{{ */
+ZEND_API int zend_std_has_dimension(zend_object *object, zval *offset, int check_empty) /* {{{ */
{
- zend_class_entry *ce = Z_OBJCE_P(object);
- zval retval, tmp_offset, tmp_object;
+ zend_class_entry *ce = object->ce;
+ zval retval, tmp_offset;
int result;
- if (EXPECTED(instanceof_function_ex(ce, zend_ce_arrayaccess, 1) != 0)) {
+ if (EXPECTED(zend_class_implements_interface(ce, zend_ce_arrayaccess) != 0)) {
ZVAL_COPY_DEREF(&tmp_offset, offset);
- Z_ADDREF_P(object);
- ZVAL_OBJ(&tmp_object, Z_OBJ_P(object));
- zend_call_method_with_1_params(&tmp_object, ce, NULL, "offsetexists", &retval, &tmp_offset);
+ GC_ADDREF(object);
+ zend_call_method_with_1_params(object, ce, NULL, "offsetexists", &retval, &tmp_offset);
result = i_zend_is_true(&retval);
zval_ptr_dtor(&retval);
if (check_empty && result && EXPECTED(!EG(exception))) {
- zend_call_method_with_1_params(&tmp_object, ce, NULL, "offsetget", &retval, &tmp_offset);
+ zend_call_method_with_1_params(object, ce, NULL, "offsetget", &retval, &tmp_offset);
result = i_zend_is_true(&retval);
zval_ptr_dtor(&retval);
}
- zval_ptr_dtor(&tmp_object);
+ OBJ_RELEASE(object);
zval_ptr_dtor(&tmp_offset);
} else {
zend_bad_array_access(ce);
@@ -1023,22 +1000,14 @@ ZEND_API int zend_std_has_dimension(zval *object, zval *offset, int check_empty)
}
/* }}} */
-ZEND_API zval *zend_std_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) /* {{{ */
+ZEND_API zval *zend_std_get_property_ptr_ptr(zend_object *zobj, zend_string *name, int type, void **cache_slot) /* {{{ */
{
- zend_object *zobj;
- zend_string *name, *tmp_name;
zval *retval = NULL;
uintptr_t property_offset;
zend_property_info *prop_info = NULL;
- zobj = Z_OBJ_P(object);
- name = zval_try_get_tmp_string(member, &tmp_name);
- if (UNEXPECTED(!name)) {
- return &EG(error_zval);
- }
-
#if DEBUG_OBJECT_HANDLERS
- fprintf(stderr, "Ptr object #%d property: %s\n", Z_OBJ_HANDLE_P(object), ZSTR_VAL(name));
+ fprintf(stderr, "Ptr object #%d property: %s\n", object->handle, ZSTR_VAL(name));
#endif
property_offset = zend_get_property_offset(zobj->ce, name, (zobj->ce->__get != NULL), cache_slot, &prop_info);
@@ -1057,7 +1026,7 @@ ZEND_API zval *zend_std_get_property_ptr_ptr(zval *object, zval *member, int typ
retval = &EG(error_zval);
} else {
ZVAL_NULL(retval);
- zend_error(E_NOTICE, "Undefined property: %s::$%s", ZSTR_VAL(zobj->ce->name), ZSTR_VAL(name));
+ zend_error(E_WARNING, "Undefined property: %s::$%s", ZSTR_VAL(zobj->ce->name), ZSTR_VAL(name));
}
}
} else {
@@ -1074,7 +1043,6 @@ ZEND_API zval *zend_std_get_property_ptr_ptr(zval *object, zval *member, int typ
zobj->properties = zend_array_dup(zobj->properties);
}
if (EXPECTED((retval = zend_hash_find(zobj->properties, name)) != NULL)) {
- zend_tmp_string_release(tmp_name);
return retval;
}
}
@@ -1087,31 +1055,22 @@ ZEND_API zval *zend_std_get_property_ptr_ptr(zval *object, zval *member, int typ
/* Notice is thrown after creation of the property, to avoid EG(std_property_info)
* being overwritten in an error handler. */
if (UNEXPECTED(type == BP_VAR_RW || type == BP_VAR_R)) {
- zend_error(E_NOTICE, "Undefined property: %s::$%s", ZSTR_VAL(zobj->ce->name), ZSTR_VAL(name));
+ zend_error(E_WARNING, "Undefined property: %s::$%s", ZSTR_VAL(zobj->ce->name), ZSTR_VAL(name));
}
}
} else if (zobj->ce->__get == NULL) {
retval = &EG(error_zval);
}
- zend_tmp_string_release(tmp_name);
return retval;
}
/* }}} */
-ZEND_API void zend_std_unset_property(zval *object, zval *member, void **cache_slot) /* {{{ */
+ZEND_API void zend_std_unset_property(zend_object *zobj, zend_string *name, void **cache_slot) /* {{{ */
{
- zend_object *zobj;
- zend_string *name, *tmp_name;
uintptr_t property_offset;
zend_property_info *prop_info = NULL;
- zobj = Z_OBJ_P(object);
- name = zval_try_get_tmp_string(member, &tmp_name);
- if (UNEXPECTED(!name)) {
- return;
- }
-
property_offset = zend_get_property_offset(zobj->ce, name, (zobj->ce->__unset != NULL), cache_slot, &prop_info);
if (EXPECTED(IS_VALID_PROPERTY_OFFSET(property_offset))) {
@@ -1129,12 +1088,12 @@ ZEND_API void zend_std_unset_property(zval *object, zval *member, void **cache_s
if (zobj->properties) {
HT_FLAGS(zobj->properties) |= HASH_FLAG_HAS_EMPTY_IND;
}
- goto exit;
+ return;
}
if (UNEXPECTED(Z_PROP_FLAG_P(slot) == IS_PROP_UNINIT)) {
/* Reset the IS_PROP_UNINIT flag, if it exists and bypass __unset(). */
Z_PROP_FLAG_P(slot) = 0;
- goto exit;
+ return;
}
} else if (EXPECTED(IS_DYNAMIC_PROPERTY_OFFSET(property_offset))
&& EXPECTED(zobj->properties != NULL)) {
@@ -1145,10 +1104,10 @@ ZEND_API void zend_std_unset_property(zval *object, zval *member, void **cache_s
zobj->properties = zend_array_dup(zobj->properties);
}
if (EXPECTED(zend_hash_del(zobj->properties, name) != FAILURE)) {
- goto exit;
+ return;
}
} else if (UNEXPECTED(EG(exception))) {
- goto exit;
+ return;
}
/* magic unset */
@@ -1163,28 +1122,24 @@ ZEND_API void zend_std_unset_property(zval *object, zval *member, void **cache_s
/* Trigger the correct error */
zend_wrong_offset(zobj->ce, name);
ZEND_ASSERT(EG(exception));
- goto exit;
+ return;
} else {
/* Nothing to do: The property already does not exist. */
}
}
-
-exit:
- zend_tmp_string_release(tmp_name);
}
/* }}} */
-ZEND_API void zend_std_unset_dimension(zval *object, zval *offset) /* {{{ */
+ZEND_API void zend_std_unset_dimension(zend_object *object, zval *offset) /* {{{ */
{
- zend_class_entry *ce = Z_OBJCE_P(object);
- zval tmp_offset, tmp_object;
+ zend_class_entry *ce = object->ce;
+ zval tmp_offset;
- if (instanceof_function_ex(ce, zend_ce_arrayaccess, 1)) {
+ if (zend_class_implements_interface(ce, zend_ce_arrayaccess)) {
ZVAL_COPY_DEREF(&tmp_offset, offset);
- Z_ADDREF_P(object);
- ZVAL_OBJ(&tmp_object, Z_OBJ_P(object));
- zend_call_method_with_1_params(&tmp_object, ce, NULL, "offsetunset", NULL, &tmp_offset);
- zval_ptr_dtor(&tmp_object);
+ GC_ADDREF(object);
+ zend_call_method_with_1_params(object, ce, NULL, "offsetunset", NULL, &tmp_offset);
+ OBJ_RELEASE(object);
zval_ptr_dtor(&tmp_offset);
} else {
zend_bad_array_access(ce);
@@ -1304,6 +1259,13 @@ static ZEND_COLD zend_never_inline void zend_bad_method_call(zend_function *fbc,
}
/* }}} */
+static ZEND_COLD zend_never_inline void zend_abstract_method_call(zend_function *fbc) /* {{{ */
+{
+ zend_throw_error(NULL, "Cannot call abstract method %s::%s()",
+ ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
+}
+/* }}} */
+
ZEND_API zend_function *zend_std_get_method(zend_object **obj_ptr, zend_string *method_name, const zval *key) /* {{{ */
{
zend_object *zobj = *obj_ptr;
@@ -1364,6 +1326,10 @@ ZEND_API zend_function *zend_std_get_method(zend_object **obj_ptr, zend_string *
}
exit:
+ if (fbc && UNEXPECTED(fbc->common.fn_flags & ZEND_ACC_ABSTRACT)) {
+ zend_abstract_method_call(fbc);
+ fbc = NULL;
+ }
if (UNEXPECTED(!key)) {
ZSTR_ALLOCA_FREE(lc_method_name, use_heap);
}
@@ -1413,12 +1379,8 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_st
/* Call the top-level defined __call().
* see: tests/classes/__call_004.phpt */
- zend_class_entry *call_ce = object->ce;
-
- while (!call_ce->__call) {
- call_ce = call_ce->parent;
- }
- return zend_get_user_call_function(call_ce, function_name);
+ ZEND_ASSERT(object->ce->__call);
+ return zend_get_user_call_function(object->ce, function_name);
} else if (ce->__callstatic) {
return zend_get_user_callstatic_function(ce, function_name);
} else {
@@ -1449,6 +1411,11 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_st
}
}
+ if (fbc && UNEXPECTED(fbc->common.fn_flags & ZEND_ACC_ABSTRACT)) {
+ zend_abstract_method_call(fbc);
+ fbc = NULL;
+ }
+
if (UNEXPECTED(!key)) {
zend_string_release_ex(lc_function_name, 0);
}
@@ -1536,7 +1503,7 @@ undeclared_property:
ZVAL_DEINDIRECT(ret);
if (UNEXPECTED((type == BP_VAR_R || type == BP_VAR_RW)
- && Z_TYPE_P(ret) == IS_UNDEF && property_info->type != 0)) {
+ && Z_TYPE_P(ret) == IS_UNDEF && ZEND_TYPE_IS_SET(property_info->type))) {
zend_throw_error(NULL, "Typed static property %s::$%s must not be accessed before initialization",
ZSTR_VAL(property_info->ce->name),
zend_get_unmangled_property_name(property_name));
@@ -1600,6 +1567,33 @@ ZEND_API int zend_std_compare_objects(zval *o1, zval *o2) /* {{{ */
{
zend_object *zobj1, *zobj2;
+ if (Z_TYPE_P(o1) != Z_TYPE_P(o2)) {
+ /* Object and non-object */
+ zval casted;
+ if (Z_TYPE_P(o1) == IS_OBJECT) {
+ ZEND_ASSERT(Z_TYPE_P(o2) != IS_OBJECT);
+ if (Z_OBJ_HT_P(o1)->cast_object) {
+ if (Z_OBJ_HT_P(o1)->cast_object(Z_OBJ_P(o1), &casted, ((Z_TYPE_P(o2) == IS_FALSE || Z_TYPE_P(o2) == IS_TRUE) ? _IS_BOOL : Z_TYPE_P(o2))) == FAILURE) {
+ return 1;
+ }
+ int ret = zend_compare(&casted, o2);
+ zval_ptr_dtor(&casted);
+ return ret;
+ }
+ } else {
+ ZEND_ASSERT(Z_TYPE_P(o2) == IS_OBJECT);
+ if (Z_OBJ_HT_P(o2)->cast_object) {
+ if (Z_OBJ_HT_P(o2)->cast_object(Z_OBJ_P(o2), &casted, ((Z_TYPE_P(o1) == IS_FALSE || Z_TYPE_P(o1) == IS_TRUE) ? _IS_BOOL : Z_TYPE_P(o1))) == FAILURE) {
+ return -1;
+ }
+ int ret = zend_compare(o1, &casted);
+ zval_ptr_dtor(&casted);
+ return ret;
+ }
+ }
+ return 1;
+ }
+
zobj1 = Z_OBJ_P(o1);
zobj2 = Z_OBJ_P(o2);
@@ -1636,15 +1630,12 @@ ZEND_API int zend_std_compare_objects(zval *o1, zval *o2) /* {{{ */
if (Z_TYPE_P(p1) != IS_UNDEF) {
if (Z_TYPE_P(p2) != IS_UNDEF) {
- zval result;
+ int ret;
- if (compare_function(&result, p1, p2)==FAILURE) {
+ ret = zend_compare(p1, p2);
+ if (ret != 0) {
Z_UNPROTECT_RECURSION_P(o1);
- return 1;
- }
- if (Z_LVAL(result) != 0) {
- Z_UNPROTECT_RECURSION_P(o1);
- return Z_LVAL(result);
+ return ret;
}
} else {
Z_UNPROTECT_RECURSION_P(o1);
@@ -1672,20 +1663,13 @@ ZEND_API int zend_std_compare_objects(zval *o1, zval *o2) /* {{{ */
}
/* }}} */
-ZEND_API int zend_std_has_property(zval *object, zval *member, int has_set_exists, void **cache_slot) /* {{{ */
+ZEND_API int zend_std_has_property(zend_object *zobj, zend_string *name, int has_set_exists, void **cache_slot) /* {{{ */
{
- zend_object *zobj;
int result;
zval *value = NULL;
- zend_string *name, *tmp_name;
uintptr_t property_offset;
zend_property_info *prop_info = NULL;
-
- zobj = Z_OBJ_P(object);
- name = zval_try_get_tmp_string(member, &tmp_name);
- if (UNEXPECTED(!name)) {
- return 0;
- }
+ zend_string *tmp_name = NULL;
property_offset = zend_get_property_offset(zobj->ce, name, 1, cache_slot, &prop_info);
@@ -1787,14 +1771,14 @@ ZEND_API zend_string *zend_std_get_class_name(const zend_object *zobj) /* {{{ */
}
/* }}} */
-ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int type) /* {{{ */
+ZEND_API int zend_std_cast_object_tostring(zend_object *readobj, zval *writeobj, int type) /* {{{ */
{
zval retval;
zend_class_entry *ce;
switch (type) {
case IS_STRING:
- ce = Z_OBJCE_P(readobj);
+ ce = readobj->ce;
if (ce->__tostring) {
zend_call_method_with_0_params(readobj, ce, &ce->__tostring, "__tostring", &retval);
if (EXPECTED(Z_TYPE(retval) == IS_STRING)) {
@@ -1811,17 +1795,17 @@ ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int ty
ZVAL_TRUE(writeobj);
return SUCCESS;
case IS_LONG:
- ce = Z_OBJCE_P(readobj);
+ ce = readobj->ce;
zend_error(E_NOTICE, "Object of class %s could not be converted to int", ZSTR_VAL(ce->name));
ZVAL_LONG(writeobj, 1);
return SUCCESS;
case IS_DOUBLE:
- ce = Z_OBJCE_P(readobj);
+ ce = readobj->ce;
zend_error(E_NOTICE, "Object of class %s could not be converted to float", ZSTR_VAL(ce->name));
ZVAL_DOUBLE(writeobj, 1);
return SUCCESS;
case _IS_NUMBER:
- ce = Z_OBJCE_P(readobj);
+ ce = readobj->ce;
zend_error(E_NOTICE, "Object of class %s could not be converted to number", ZSTR_VAL(ce->name));
ZVAL_LONG(writeobj, 1);
return SUCCESS;
@@ -1833,10 +1817,10 @@ ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int ty
}
/* }}} */
-ZEND_API int zend_std_get_closure(zval *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr) /* {{{ */
+ZEND_API int zend_std_get_closure(zend_object *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr, zend_bool check_only) /* {{{ */
{
zval *func;
- zend_class_entry *ce = Z_OBJCE_P(obj);
+ zend_class_entry *ce = obj->ce;
if ((func = zend_hash_find_ex(&ce->function_table, ZSTR_KNOWN(ZEND_STR_MAGIC_INVOKE), 1)) == NULL) {
return FAILURE;
@@ -1850,20 +1834,20 @@ ZEND_API int zend_std_get_closure(zval *obj, zend_class_entry **ce_ptr, zend_fun
}
} else {
if (obj_ptr) {
- *obj_ptr = Z_OBJ_P(obj);
+ *obj_ptr = obj;
}
}
return SUCCESS;
}
/* }}} */
-ZEND_API HashTable *zend_std_get_properties_for(zval *obj, zend_prop_purpose purpose) {
+ZEND_API HashTable *zend_std_get_properties_for(zend_object *obj, zend_prop_purpose purpose) {
HashTable *ht;
switch (purpose) {
case ZEND_PROP_PURPOSE_DEBUG:
- if (Z_OBJ_HT_P(obj)->get_debug_info) {
+ if (obj->handlers->get_debug_info) {
int is_temp;
- ht = Z_OBJ_HT_P(obj)->get_debug_info(obj, &is_temp);
+ ht = obj->handlers->get_debug_info(obj, &is_temp);
if (ht && !is_temp && !(GC_FLAGS(ht) & GC_IMMUTABLE)) {
GC_ADDREF(ht);
}
@@ -1874,8 +1858,7 @@ ZEND_API HashTable *zend_std_get_properties_for(zval *obj, zend_prop_purpose pur
case ZEND_PROP_PURPOSE_SERIALIZE:
case ZEND_PROP_PURPOSE_VAR_EXPORT:
case ZEND_PROP_PURPOSE_JSON:
- case _ZEND_PROP_PURPOSE_ARRAY_KEY_EXISTS:
- ht = Z_OBJ_HT_P(obj)->get_properties(obj);
+ ht = obj->handlers->get_properties(obj);
if (ht && !(GC_FLAGS(ht) & GC_IMMUTABLE)) {
GC_ADDREF(ht);
}
@@ -1887,11 +1870,13 @@ ZEND_API HashTable *zend_std_get_properties_for(zval *obj, zend_prop_purpose pur
}
ZEND_API HashTable *zend_get_properties_for(zval *obj, zend_prop_purpose purpose) {
- if (Z_OBJ_HT_P(obj)->get_properties_for) {
- return Z_OBJ_HT_P(obj)->get_properties_for(obj, purpose);
+ zend_object *zobj = Z_OBJ_P(obj);
+
+ if (zobj->handlers->get_properties_for) {
+ return zobj->handlers->get_properties_for(zobj, purpose);
}
- return zend_std_get_properties_for(obj, purpose);
+ return zend_std_get_properties_for(zobj, purpose);
}
ZEND_API const zend_object_handlers std_object_handlers = {
@@ -1906,24 +1891,20 @@ ZEND_API const zend_object_handlers std_object_handlers = {
zend_std_read_dimension, /* read_dimension */
zend_std_write_dimension, /* write_dimension */
zend_std_get_property_ptr_ptr, /* get_property_ptr_ptr */
- NULL, /* get */
- NULL, /* set */
zend_std_has_property, /* has_property */
zend_std_unset_property, /* unset_property */
zend_std_has_dimension, /* has_dimension */
zend_std_unset_dimension, /* unset_dimension */
zend_std_get_properties, /* get_properties */
zend_std_get_method, /* get_method */
- NULL, /* call_method */
zend_std_get_constructor, /* get_constructor */
zend_std_get_class_name, /* get_class_name */
- zend_std_compare_objects, /* compare_objects */
zend_std_cast_object_tostring, /* cast_object */
NULL, /* count_elements */
zend_std_get_debug_info, /* get_debug_info */
zend_std_get_closure, /* get_closure */
zend_std_get_gc, /* get_gc */
NULL, /* do_operation */
- NULL, /* compare */
+ zend_std_compare_objects, /* compare */
NULL, /* get_properties_for */
};
diff --git a/Zend/zend_object_handlers.h b/Zend/zend_object_handlers.h
index 770a67cbdd..19b7ff993f 100644
--- a/Zend/zend_object_handlers.h
+++ b/Zend/zend_object_handlers.h
@@ -41,10 +41,10 @@ struct _zend_property_info;
symbol table, its reference count should be 0.
*/
/* Used to fetch property from the object, read-only */
-typedef zval *(*zend_object_read_property_t)(zval *object, zval *member, int type, void **cache_slot, zval *rv);
+typedef zval *(*zend_object_read_property_t)(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv);
/* Used to fetch dimension from the object, read-only */
-typedef zval *(*zend_object_read_dimension_t)(zval *object, zval *offset, int type, zval *rv);
+typedef zval *(*zend_object_read_dimension_t)(zend_object *object, zval *offset, int type, zval *rv);
/* The following rule applies to write_property() and write_dimension() implementations:
@@ -54,23 +54,14 @@ typedef zval *(*zend_object_read_dimension_t)(zval *object, zval *offset, int ty
You must return the final value of the assigned property.
*/
/* Used to set property of the object */
-typedef zval *(*zend_object_write_property_t)(zval *object, zval *member, zval *value, void **cache_slot);
+typedef zval *(*zend_object_write_property_t)(zend_object *object, zend_string *member, zval *value, void **cache_slot);
/* Used to set dimension of the object */
-typedef void (*zend_object_write_dimension_t)(zval *object, zval *offset, zval *value);
+typedef void (*zend_object_write_dimension_t)(zend_object *object, zval *offset, zval *value);
/* Used to create pointer to the property of the object, for future direct r/w access */
-typedef zval *(*zend_object_get_property_ptr_ptr_t)(zval *object, zval *member, int type, void **cache_slot);
-
-/* Used to set object value. Can be used to override assignments and scalar
- write ops (like ++, +=) on the object */
-typedef void (*zend_object_set_t)(zval *object, zval *value);
-
-/* Used to get object value. Can be used when converting object value to
- * one of the basic types and when using scalar ops (like ++, +=) on the object
- */
-typedef zval* (*zend_object_get_t)(zval *object, zval *rv);
+typedef zval *(*zend_object_get_property_ptr_ptr_t)(zend_object *object, zend_string *member, int type, void **cache_slot);
/* Used to check if a property of the object exists */
/* param has_set_exists:
@@ -78,21 +69,21 @@ typedef zval* (*zend_object_get_t)(zval *object, zval *rv);
* 1 (set) whether property exists and is true
* 2 (exists) whether property exists
*/
-typedef int (*zend_object_has_property_t)(zval *object, zval *member, int has_set_exists, void **cache_slot);
+typedef int (*zend_object_has_property_t)(zend_object *object, zend_string *member, int has_set_exists, void **cache_slot);
/* Used to check if a dimension of the object exists */
-typedef int (*zend_object_has_dimension_t)(zval *object, zval *member, int check_empty);
+typedef int (*zend_object_has_dimension_t)(zend_object *object, zval *member, int check_empty);
/* Used to remove a property of the object */
-typedef void (*zend_object_unset_property_t)(zval *object, zval *member, void **cache_slot);
+typedef void (*zend_object_unset_property_t)(zend_object *object, zend_string *member, void **cache_slot);
/* Used to remove a dimension of the object */
-typedef void (*zend_object_unset_dimension_t)(zval *object, zval *offset);
+typedef void (*zend_object_unset_dimension_t)(zend_object *object, zval *offset);
/* Used to get hash of the properties of the object, as hash of zval's */
-typedef HashTable *(*zend_object_get_properties_t)(zval *object);
+typedef HashTable *(*zend_object_get_properties_t)(zend_object *object);
-typedef HashTable *(*zend_object_get_debug_info_t)(zval *object, int *is_temp);
+typedef HashTable *(*zend_object_get_debug_info_t)(zend_object *object, int *is_temp);
typedef enum _zend_prop_purpose {
/* Used for debugging. Supersedes get_debug_info handler. */
@@ -107,47 +98,43 @@ typedef enum _zend_prop_purpose {
ZEND_PROP_PURPOSE_VAR_EXPORT,
/* Used for json_encode(). */
ZEND_PROP_PURPOSE_JSON,
- /* array_key_exists(). Not intended for general use! */
- _ZEND_PROP_PURPOSE_ARRAY_KEY_EXISTS,
/* Dummy member to ensure that "default" is specified. */
_ZEND_PROP_PURPOSE_NON_EXHAUSTIVE_ENUM
} zend_prop_purpose;
/* The return value must be released using zend_release_properties(). */
-typedef zend_array *(*zend_object_get_properties_for_t)(zval *object, zend_prop_purpose purpose);
+typedef zend_array *(*zend_object_get_properties_for_t)(zend_object *object, zend_prop_purpose purpose);
/* Used to call methods */
/* args on stack! */
/* Andi - EX(fbc) (function being called) needs to be initialized already in the INIT fcall opcode so that the parameters can be parsed the right way. We need to add another callback for this.
*/
-typedef int (*zend_object_call_method_t)(zend_string *method, zend_object *object, INTERNAL_FUNCTION_PARAMETERS);
typedef zend_function *(*zend_object_get_method_t)(zend_object **object, zend_string *method, const zval *key);
typedef zend_function *(*zend_object_get_constructor_t)(zend_object *object);
/* Object maintenance/destruction */
typedef void (*zend_object_dtor_obj_t)(zend_object *object);
typedef void (*zend_object_free_obj_t)(zend_object *object);
-typedef zend_object* (*zend_object_clone_obj_t)(zval *object);
+typedef zend_object* (*zend_object_clone_obj_t)(zend_object *object);
/* Get class name for display in var_dump and other debugging functions.
* Must be defined and must return a non-NULL value. */
typedef zend_string *(*zend_object_get_class_name_t)(const zend_object *object);
typedef int (*zend_object_compare_t)(zval *object1, zval *object2);
-typedef int (*zend_object_compare_zvals_t)(zval *result, zval *op1, zval *op2);
/* Cast an object to some other type.
* readobj and retval must point to distinct zvals.
*/
-typedef int (*zend_object_cast_t)(zval *readobj, zval *retval, int type);
+typedef int (*zend_object_cast_t)(zend_object *readobj, zval *retval, int type);
/* updates *count to hold the number of elements present and returns SUCCESS.
* Returns FAILURE if the object does not have any sense of overloaded dimensions */
-typedef int (*zend_object_count_elements_t)(zval *object, zend_long *count);
+typedef int (*zend_object_count_elements_t)(zend_object *object, zend_long *count);
-typedef int (*zend_object_get_closure_t)(zval *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr);
+typedef int (*zend_object_get_closure_t)(zend_object *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr, zend_bool check_only);
-typedef HashTable *(*zend_object_get_gc_t)(zval *object, zval **table, int *n);
+typedef HashTable *(*zend_object_get_gc_t)(zend_object *object, zval **table, int *n);
typedef int (*zend_object_do_operation_t)(zend_uchar opcode, zval *result, zval *op1, zval *op2);
@@ -163,25 +150,21 @@ struct _zend_object_handlers {
zend_object_read_dimension_t read_dimension; /* required */
zend_object_write_dimension_t write_dimension; /* required */
zend_object_get_property_ptr_ptr_t get_property_ptr_ptr; /* required */
- zend_object_get_t get; /* optional */
- zend_object_set_t set; /* optional */
zend_object_has_property_t has_property; /* required */
zend_object_unset_property_t unset_property; /* required */
zend_object_has_dimension_t has_dimension; /* required */
zend_object_unset_dimension_t unset_dimension; /* required */
zend_object_get_properties_t get_properties; /* required */
zend_object_get_method_t get_method; /* required */
- zend_object_call_method_t call_method; /* optional */
zend_object_get_constructor_t get_constructor; /* required */
zend_object_get_class_name_t get_class_name; /* required */
- zend_object_compare_t compare_objects; /* optional */
zend_object_cast_t cast_object; /* optional */
zend_object_count_elements_t count_elements; /* optional */
zend_object_get_debug_info_t get_debug_info; /* optional */
zend_object_get_closure_t get_closure; /* optional */
zend_object_get_gc_t get_gc; /* required */
zend_object_do_operation_t do_operation; /* optional */
- zend_object_compare_zvals_t compare; /* optional */
+ zend_object_compare_t compare; /* required */
zend_object_get_properties_for_t get_properties_for; /* optional */
};
@@ -205,23 +188,23 @@ ZEND_API zval *zend_std_get_static_property(zend_class_entry *ce, zend_string *p
ZEND_API ZEND_COLD zend_bool zend_std_unset_static_property(zend_class_entry *ce, zend_string *property_name);
ZEND_API zend_function *zend_std_get_constructor(zend_object *object);
ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce, zend_string *member, int silent);
-ZEND_API HashTable *zend_std_get_properties(zval *object);
-ZEND_API HashTable *zend_std_get_gc(zval *object, zval **table, int *n);
-ZEND_API HashTable *zend_std_get_debug_info(zval *object, int *is_temp);
-ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int type);
-ZEND_API zval *zend_std_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot);
-ZEND_API zval *zend_std_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv);
-ZEND_API zval *zend_std_write_property(zval *object, zval *member, zval *value, void **cache_slot);
-ZEND_API int zend_std_has_property(zval *object, zval *member, int has_set_exists, void **cache_slot);
-ZEND_API void zend_std_unset_property(zval *object, zval *member, void **cache_slot);
-ZEND_API zval *zend_std_read_dimension(zval *object, zval *offset, int type, zval *rv);
-ZEND_API void zend_std_write_dimension(zval *object, zval *offset, zval *value);
-ZEND_API int zend_std_has_dimension(zval *object, zval *offset, int check_empty);
-ZEND_API void zend_std_unset_dimension(zval *object, zval *offset);
+ZEND_API HashTable *zend_std_get_properties(zend_object *object);
+ZEND_API HashTable *zend_std_get_gc(zend_object *object, zval **table, int *n);
+ZEND_API HashTable *zend_std_get_debug_info(zend_object *object, int *is_temp);
+ZEND_API int zend_std_cast_object_tostring(zend_object *object, zval *writeobj, int type);
+ZEND_API zval *zend_std_get_property_ptr_ptr(zend_object *object, zend_string *member, int type, void **cache_slot);
+ZEND_API zval *zend_std_read_property(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv);
+ZEND_API zval *zend_std_write_property(zend_object *object, zend_string *member, zval *value, void **cache_slot);
+ZEND_API int zend_std_has_property(zend_object *object, zend_string *member, int has_set_exists, void **cache_slot);
+ZEND_API void zend_std_unset_property(zend_object *object, zend_string *member, void **cache_slot);
+ZEND_API zval *zend_std_read_dimension(zend_object *object, zval *offset, int type, zval *rv);
+ZEND_API void zend_std_write_dimension(zend_object *object, zval *offset, zval *value);
+ZEND_API int zend_std_has_dimension(zend_object *object, zval *offset, int check_empty);
+ZEND_API void zend_std_unset_dimension(zend_object *object, zval *offset);
ZEND_API zend_function *zend_std_get_method(zend_object **obj_ptr, zend_string *method_name, const zval *key);
ZEND_API zend_string *zend_std_get_class_name(const zend_object *zobj);
ZEND_API int zend_std_compare_objects(zval *o1, zval *o2);
-ZEND_API int zend_std_get_closure(zval *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr);
+ZEND_API int zend_std_get_closure(zend_object *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr, zend_bool check_only);
ZEND_API void rebuild_object_properties(zend_object *zobj);
ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope);
@@ -234,7 +217,7 @@ ZEND_API uint32_t *zend_get_property_guard(zend_object *zobj, zend_string *membe
/* Default behavior for get_properties_for. For use as a fallback in custom
* get_properties_for implementations. */
-ZEND_API HashTable *zend_std_get_properties_for(zval *obj, zend_prop_purpose purpose);
+ZEND_API HashTable *zend_std_get_properties_for(zend_object *obj, zend_prop_purpose purpose);
/* Will call get_properties_for handler or use default behavior. For use by
* consumers of the get_properties_for API. */
@@ -254,6 +237,16 @@ ZEND_API HashTable *zend_get_properties_for(zval *obj, zend_prop_purpose purpose
} \
} while (0)
+/* Fallback to default comparison implementation if the arguments aren't both objects
+ * and have the same compare() handler. You'll likely want to use this unless you
+ * explicitly wish to support comparisons between objects and non-objects. */
+#define ZEND_COMPARE_OBJECTS_FALLBACK(op1, op2) \
+ if (Z_TYPE_P(op1) != IS_OBJECT || \
+ Z_TYPE_P(op2) != IS_OBJECT || \
+ Z_OBJ_HT_P(op1)->compare != Z_OBJ_HT_P(op2)->compare) { \
+ return zend_std_compare_objects(op1, op2); \
+ }
+
END_EXTERN_C()
#endif
diff --git a/Zend/zend_objects.c b/Zend/zend_objects.c
index ac9412a1c6..13a6b45a7c 100644
--- a/Zend/zend_objects.c
+++ b/Zend/zend_objects.c
@@ -63,7 +63,7 @@ ZEND_API void zend_object_std_dtor(zend_object *object)
if (UNEXPECTED(Z_ISREF_P(p)) &&
(ZEND_DEBUG || ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(p)))) {
zend_property_info *prop_info = zend_get_property_info_for_slot(object, p);
- if (prop_info->type) {
+ if (ZEND_TYPE_IS_SET(prop_info->type)) {
ZEND_REF_DEL_TYPE_SOURCE(Z_REF_P(p), prop_info);
}
}
@@ -214,7 +214,7 @@ ZEND_API void ZEND_FASTCALL zend_objects_clone_members(zend_object *new_object,
if (UNEXPECTED(Z_ISREF_P(dst)) &&
(ZEND_DEBUG || ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(dst)))) {
zend_property_info *prop_info = zend_get_property_info_for_slot(new_object, dst);
- if (prop_info->type) {
+ if (ZEND_TYPE_IS_SET(prop_info->type)) {
ZEND_REF_ADD_TYPE_SOURCE(Z_REF_P(dst), prop_info);
}
}
@@ -290,14 +290,12 @@ ZEND_API void ZEND_FASTCALL zend_objects_clone_members(zend_object *new_object,
}
}
-ZEND_API zend_object *zend_objects_clone_obj(zval *zobject)
+ZEND_API zend_object *zend_objects_clone_obj(zend_object *old_object)
{
- zend_object *old_object;
zend_object *new_object;
/* assume that create isn't overwritten, so when clone depends on the
* overwritten one then it must itself be overwritten */
- old_object = Z_OBJ_P(zobject);
new_object = zend_objects_new(old_object->ce);
/* zend_objects_clone_members() expect the properties to be initialized. */
diff --git a/Zend/zend_objects.h b/Zend/zend_objects.h
index cb0015599b..91d388154d 100644
--- a/Zend/zend_objects.h
+++ b/Zend/zend_objects.h
@@ -29,7 +29,7 @@ ZEND_API void ZEND_FASTCALL zend_objects_clone_members(zend_object *new_object,
ZEND_API void zend_object_std_dtor(zend_object *object);
ZEND_API void zend_objects_destroy_object(zend_object *object);
-ZEND_API zend_object *zend_objects_clone_obj(zval *object);
+ZEND_API zend_object *zend_objects_clone_obj(zend_object *object);
END_EXTERN_C()
#endif /* ZEND_OBJECTS_H */
diff --git a/Zend/zend_objects_API.h b/Zend/zend_objects_API.h
index b9a838e7bb..85ce701cd7 100644
--- a/Zend/zend_objects_API.h
+++ b/Zend/zend_objects_API.h
@@ -107,7 +107,7 @@ static inline zend_property_info *zend_get_property_info_for_slot(zend_object *o
static inline zend_property_info *zend_get_typed_property_info_for_slot(zend_object *obj, zval *slot)
{
zend_property_info *prop_info = zend_get_property_info_for_slot(obj, slot);
- if (prop_info && prop_info->type) {
+ if (prop_info && ZEND_TYPE_IS_SET(prop_info->type)) {
return prop_info;
}
return NULL;
diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c
index d0d49934fe..881626b71e 100644
--- a/Zend/zend_opcode.c
+++ b/Zend/zend_opcode.c
@@ -102,6 +102,22 @@ ZEND_API void destroy_zend_function(zend_function *function)
zend_function_dtor(&tmp);
}
+ZEND_API void zend_type_release(zend_type type, zend_bool persistent) {
+ if (ZEND_TYPE_HAS_LIST(type)) {
+ zend_type *list_type;
+ ZEND_TYPE_LIST_FOREACH(ZEND_TYPE_LIST(type), list_type) {
+ if (ZEND_TYPE_HAS_NAME(*list_type)) {
+ zend_string_release(ZEND_TYPE_NAME(*list_type));
+ }
+ } ZEND_TYPE_LIST_FOREACH_END();
+ if (!ZEND_TYPE_USES_ARENA(type)) {
+ pefree(ZEND_TYPE_LIST(type), persistent);
+ }
+ } else if (ZEND_TYPE_HAS_NAME(type)) {
+ zend_string_release(ZEND_TYPE_NAME(type));
+ }
+}
+
void zend_free_internal_arg_info(zend_internal_function *function) {
if ((function->fn_flags & (ZEND_ACC_HAS_RETURN_TYPE|ZEND_ACC_HAS_TYPE_HINTS)) &&
function->arg_info) {
@@ -114,9 +130,7 @@ void zend_free_internal_arg_info(zend_internal_function *function) {
num_args++;
}
for (i = 0 ; i < num_args; i++) {
- if (ZEND_TYPE_IS_CLASS(arg_info[i].type)) {
- zend_string_release_ex(ZEND_TYPE_NAME(arg_info[i].type), 1);
- }
+ zend_type_release(arg_info[i].type, /* persistent */ 1);
}
free(arg_info);
}
@@ -303,9 +317,7 @@ ZEND_API void destroy_zend_class(zval *zv)
if (prop_info->doc_comment) {
zend_string_release_ex(prop_info->doc_comment, 0);
}
- if (ZEND_TYPE_IS_NAME(prop_info->type)) {
- zend_string_release(ZEND_TYPE_NAME(prop_info->type));
- }
+ zend_type_release(prop_info->type, /* persistent */ 0);
}
} ZEND_HASH_FOREACH_END();
zend_hash_destroy(&ce->properties_info);
@@ -496,9 +508,7 @@ ZEND_API void destroy_op_array(zend_op_array *op_array)
if (arg_info[i].name) {
zend_string_release_ex(arg_info[i].name, 0);
}
- if (ZEND_TYPE_IS_CLASS(arg_info[i].type)) {
- zend_string_release_ex(ZEND_TYPE_NAME(arg_info[i].type), 0);
- }
+ zend_type_release(arg_info[i].type, /* persistent */ 0);
}
efree(arg_info);
}
@@ -1075,7 +1085,6 @@ ZEND_API binary_op_type get_binary_op(int opcode)
return (binary_op_type) shift_left_function;
case ZEND_SR:
return (binary_op_type) shift_right_function;
- case ZEND_PARENTHESIZED_CONCAT:
case ZEND_FAST_CONCAT:
case ZEND_CONCAT:
return (binary_op_type) concat_function;
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c
index 656316cc4e..a1f3024d4e 100644
--- a/Zend/zend_operators.c
+++ b/Zend/zend_operators.c
@@ -138,18 +138,11 @@ ZEND_API zend_long ZEND_FASTCALL zend_atol(const char *str, size_t str_len) /* {
#define convert_object_to_type(op, dst, ctype, conv_func) \
ZVAL_UNDEF(dst); \
if (Z_OBJ_HT_P(op)->cast_object) { \
- if (Z_OBJ_HT_P(op)->cast_object(op, dst, ctype) == FAILURE) { \
+ if (Z_OBJ_HT_P(op)->cast_object(Z_OBJ_P(op), dst, ctype) == FAILURE) { \
zend_error(E_RECOVERABLE_ERROR, \
"Object of class %s could not be converted to %s", ZSTR_VAL(Z_OBJCE_P(op)->name),\
zend_get_type_by_const(ctype)); \
} \
- } else if (Z_OBJ_HT_P(op)->get) { \
- zval *newop = Z_OBJ_HT_P(op)->get(op, dst); \
- if (Z_TYPE_P(newop) != IS_OBJECT) { \
- /* for safety - avoid loop */ \
- ZVAL_COPY_VALUE(dst, newop); \
- conv_func(dst); \
- } \
}
/* }}} */
@@ -566,7 +559,7 @@ try_again:
break;
}
case IS_ARRAY:
- zend_error(E_NOTICE, "Array to string conversion");
+ zend_error(E_WARNING, "Array to string conversion");
zval_ptr_dtor(op);
ZVAL_INTERNED_STR(op, ZSTR_KNOWN(ZEND_STR_ARRAY_CAPITALIZED));
break;
@@ -574,21 +567,11 @@ try_again:
zval tmp;
if (Z_OBJ_HT_P(op)->cast_object) {
- if (Z_OBJ_HT_P(op)->cast_object(op, &tmp, IS_STRING) == SUCCESS) {
+ if (Z_OBJ_HT_P(op)->cast_object(Z_OBJ_P(op), &tmp, IS_STRING) == SUCCESS) {
zval_ptr_dtor(op);
ZVAL_COPY_VALUE(op, &tmp);
return;
}
- } else if (Z_OBJ_HT_P(op)->get) {
- zval *z = Z_OBJ_HT_P(op)->get(op, &tmp);
- if (Z_TYPE_P(z) != IS_OBJECT) {
- zend_string *str = zval_get_string(z);
- zval_ptr_dtor(z);
- zval_ptr_dtor(op);
- ZVAL_STR(op, str);
- return;
- }
- zval_ptr_dtor(z);
}
if (!EG(exception)) {
zend_throw_error(NULL, "Object of class %s could not be converted to string", ZSTR_VAL(Z_OBJCE_P(op)->name));
@@ -886,23 +869,15 @@ try_again:
return zend_strpprintf(0, "%.*G", (int) EG(precision), Z_DVAL_P(op));
}
case IS_ARRAY:
- zend_error(E_NOTICE, "Array to string conversion");
+ zend_error(E_WARNING, "Array to string conversion");
return (try && UNEXPECTED(EG(exception))) ?
NULL : ZSTR_KNOWN(ZEND_STR_ARRAY_CAPITALIZED);
case IS_OBJECT: {
zval tmp;
if (Z_OBJ_HT_P(op)->cast_object) {
- if (Z_OBJ_HT_P(op)->cast_object(op, &tmp, IS_STRING) == SUCCESS) {
+ if (Z_OBJ_HT_P(op)->cast_object(Z_OBJ_P(op), &tmp, IS_STRING) == SUCCESS) {
return Z_STR(tmp);
}
- } else if (Z_OBJ_HT_P(op)->get) {
- zval *z = Z_OBJ_HT_P(op)->get(op, &tmp);
- if (Z_TYPE_P(z) != IS_OBJECT) {
- zend_string *str = try ? zval_try_get_string(z) : zval_get_string(z);
- zval_ptr_dtor(z);
- return str;
- }
- zval_ptr_dtor(z);
}
if (!EG(exception)) {
zend_throw_error(NULL, "Object of class %s could not be converted to string", ZSTR_VAL(Z_OBJCE_P(op)->name));
@@ -1222,37 +1197,22 @@ ZEND_API int ZEND_FASTCALL pow_function(zval *result, zval *op1, zval *op2) /* {
} else if (!converted) {
ZEND_TRY_BINARY_OBJECT_OPERATION(ZEND_POW, pow_function);
- if (EXPECTED(op1 != op2)) {
- if (Z_TYPE_P(op1) == IS_ARRAY) {
- if (op1 == result) {
- zval_ptr_dtor(result);
- }
- ZVAL_LONG(result, 0);
- return SUCCESS;
- } else {
- op1 = zendi_convert_scalar_to_number(op1, &op1_copy, result, 0);
- }
- if (Z_TYPE_P(op2) == IS_ARRAY) {
- if (op1 == result) {
- zval_ptr_dtor(result);
- }
- ZVAL_LONG(result, 1L);
- return SUCCESS;
- } else {
- op2 = zendi_convert_scalar_to_number(op2, &op2_copy, result, 0);
+ if (Z_TYPE_P(op1) == IS_ARRAY || Z_TYPE_P(op2) == IS_ARRAY) {
+ if (result != op1) {
+ ZVAL_UNDEF(result);
}
+ zend_throw_error(NULL, "Unsupported operand types");
+ return FAILURE;
+ }
+
+ if (EXPECTED(op1 != op2)) {
+ op1 = zendi_convert_scalar_to_number(op1, &op1_copy, result, 0);
+ op2 = zendi_convert_scalar_to_number(op2, &op2_copy, result, 0);
} else {
- if (Z_TYPE_P(op1) == IS_ARRAY) {
- if (op1 == result) {
- zval_ptr_dtor(result);
- }
- ZVAL_LONG(result, 0);
- return SUCCESS;
- } else {
- op1 = zendi_convert_scalar_to_number(op1, &op1_copy, result, 0);
- }
+ op1 = zendi_convert_scalar_to_number(op1, &op1_copy, result, 0);
op2 = op1;
}
+
if (EG(exception)) {
if (result != op1) {
ZVAL_UNDEF(result);
@@ -2002,98 +1962,69 @@ ZEND_API int ZEND_FASTCALL numeric_compare_function(zval *op1, zval *op2) /* {{{
}
/* }}} */
-static zend_always_inline void zend_free_obj_get_result(zval *op) /* {{{ */
-{
- ZEND_ASSERT(!Z_REFCOUNTED_P(op) || Z_REFCOUNT_P(op) != 0);
- zval_ptr_dtor(op);
-}
-/* }}} */
-
-static void ZEND_FASTCALL convert_compare_result_to_long(zval *result) /* {{{ */
+ZEND_API int ZEND_FASTCALL compare_function(zval *result, zval *op1, zval *op2) /* {{{ */
{
- if (Z_TYPE_P(result) == IS_DOUBLE) {
- ZVAL_LONG(result, ZEND_NORMALIZE_BOOL(Z_DVAL_P(result)));
- } else {
- convert_to_long(result);
- }
+ ZVAL_LONG(result, zend_compare(op1, op2));
+ return SUCCESS;
}
/* }}} */
-ZEND_API int ZEND_FASTCALL compare_function(zval *result, zval *op1, zval *op2) /* {{{ */
+ZEND_API int ZEND_FASTCALL zend_compare(zval *op1, zval *op2) /* {{{ */
{
- int ret;
int converted = 0;
zval op1_copy, op2_copy;
- zval *op_free, tmp_free;
while (1) {
switch (TYPE_PAIR(Z_TYPE_P(op1), Z_TYPE_P(op2))) {
case TYPE_PAIR(IS_LONG, IS_LONG):
- ZVAL_LONG(result, Z_LVAL_P(op1)>Z_LVAL_P(op2)?1:(Z_LVAL_P(op1)<Z_LVAL_P(op2)?-1:0));
- return SUCCESS;
+ return Z_LVAL_P(op1)>Z_LVAL_P(op2)?1:(Z_LVAL_P(op1)<Z_LVAL_P(op2)?-1:0);
case TYPE_PAIR(IS_DOUBLE, IS_LONG):
- Z_DVAL_P(result) = Z_DVAL_P(op1) - (double)Z_LVAL_P(op2);
- ZVAL_LONG(result, ZEND_NORMALIZE_BOOL(Z_DVAL_P(result)));
- return SUCCESS;
+ return ZEND_NORMALIZE_BOOL(Z_DVAL_P(op1) - (double)Z_LVAL_P(op2));
case TYPE_PAIR(IS_LONG, IS_DOUBLE):
- Z_DVAL_P(result) = (double)Z_LVAL_P(op1) - Z_DVAL_P(op2);
- ZVAL_LONG(result, ZEND_NORMALIZE_BOOL(Z_DVAL_P(result)));
- return SUCCESS;
+ return ZEND_NORMALIZE_BOOL((double)Z_LVAL_P(op1) - Z_DVAL_P(op2));
case TYPE_PAIR(IS_DOUBLE, IS_DOUBLE):
if (Z_DVAL_P(op1) == Z_DVAL_P(op2)) {
- ZVAL_LONG(result, 0);
+ return 0;
} else {
- Z_DVAL_P(result) = Z_DVAL_P(op1) - Z_DVAL_P(op2);
- ZVAL_LONG(result, ZEND_NORMALIZE_BOOL(Z_DVAL_P(result)));
+ return ZEND_NORMALIZE_BOOL(Z_DVAL_P(op1) - Z_DVAL_P(op2));
}
- return SUCCESS;
case TYPE_PAIR(IS_ARRAY, IS_ARRAY):
- ZVAL_LONG(result, zend_compare_arrays(op1, op2));
- return SUCCESS;
+ return zend_compare_arrays(op1, op2);
case TYPE_PAIR(IS_NULL, IS_NULL):
case TYPE_PAIR(IS_NULL, IS_FALSE):
case TYPE_PAIR(IS_FALSE, IS_NULL):
case TYPE_PAIR(IS_FALSE, IS_FALSE):
case TYPE_PAIR(IS_TRUE, IS_TRUE):
- ZVAL_LONG(result, 0);
- return SUCCESS;
+ return 0;
case TYPE_PAIR(IS_NULL, IS_TRUE):
- ZVAL_LONG(result, -1);
- return SUCCESS;
+ return -1;
case TYPE_PAIR(IS_TRUE, IS_NULL):
- ZVAL_LONG(result, 1);
- return SUCCESS;
+ return 1;
case TYPE_PAIR(IS_STRING, IS_STRING):
if (Z_STR_P(op1) == Z_STR_P(op2)) {
- ZVAL_LONG(result, 0);
- return SUCCESS;
+ return 0;
}
- ZVAL_LONG(result, zendi_smart_strcmp(Z_STR_P(op1), Z_STR_P(op2)));
- return SUCCESS;
+ return zendi_smart_strcmp(Z_STR_P(op1), Z_STR_P(op2));
case TYPE_PAIR(IS_NULL, IS_STRING):
- ZVAL_LONG(result, Z_STRLEN_P(op2) == 0 ? 0 : -1);
- return SUCCESS;
+ return Z_STRLEN_P(op2) == 0 ? 0 : -1;
case TYPE_PAIR(IS_STRING, IS_NULL):
- ZVAL_LONG(result, Z_STRLEN_P(op1) == 0 ? 0 : 1);
- return SUCCESS;
+ return Z_STRLEN_P(op1) == 0 ? 0 : 1;
case TYPE_PAIR(IS_OBJECT, IS_NULL):
- ZVAL_LONG(result, 1);
- return SUCCESS;
+ return 1;
case TYPE_PAIR(IS_NULL, IS_OBJECT):
- ZVAL_LONG(result, -1);
- return SUCCESS;
+ return -1;
default:
if (Z_ISREF_P(op1)) {
@@ -2104,109 +2035,41 @@ ZEND_API int ZEND_FASTCALL compare_function(zval *result, zval *op1, zval *op2)
continue;
}
- if (Z_TYPE_P(op1) == IS_OBJECT && Z_OBJ_HANDLER_P(op1, compare)) {
- ret = Z_OBJ_HANDLER_P(op1, compare)(result, op1, op2);
- if (UNEXPECTED(Z_TYPE_P(result) != IS_LONG)) {
- convert_compare_result_to_long(result);
- }
- return ret;
- } else if (Z_TYPE_P(op2) == IS_OBJECT && Z_OBJ_HANDLER_P(op2, compare)) {
- ret = Z_OBJ_HANDLER_P(op2, compare)(result, op1, op2);
- if (UNEXPECTED(Z_TYPE_P(result) != IS_LONG)) {
- convert_compare_result_to_long(result);
- }
- return ret;
+ if (Z_TYPE_P(op1) == IS_OBJECT
+ && Z_TYPE_P(op2) == IS_OBJECT
+ && Z_OBJ_P(op1) == Z_OBJ_P(op2)) {
+ return 0;
+ } else if (Z_TYPE_P(op1) == IS_OBJECT) {
+ return Z_OBJ_HANDLER_P(op1, compare)(op1, op2);
+ } else if (Z_TYPE_P(op2) == IS_OBJECT) {
+ return Z_OBJ_HANDLER_P(op2, compare)(op1, op2);
}
- if (Z_TYPE_P(op1) == IS_OBJECT && Z_TYPE_P(op2) == IS_OBJECT) {
- if (Z_OBJ_P(op1) == Z_OBJ_P(op2)) {
- /* object handles are identical, apparently this is the same object */
- ZVAL_LONG(result, 0);
- return SUCCESS;
- }
- if (Z_OBJ_HANDLER_P(op1, compare_objects) == Z_OBJ_HANDLER_P(op2, compare_objects)) {
- ZVAL_LONG(result, Z_OBJ_HANDLER_P(op1, compare_objects)(op1, op2));
- return SUCCESS;
- }
- }
- if (Z_TYPE_P(op1) == IS_OBJECT) {
- if (Z_OBJ_HT_P(op1)->get) {
- zval rv;
- op_free = Z_OBJ_HT_P(op1)->get(op1, &rv);
- ret = compare_function(result, op_free, op2);
- zend_free_obj_get_result(op_free);
- return ret;
- } else if (Z_TYPE_P(op2) != IS_OBJECT && Z_OBJ_HT_P(op1)->cast_object) {
- ZVAL_UNDEF(&tmp_free);
- if (Z_OBJ_HT_P(op1)->cast_object(op1, &tmp_free, ((Z_TYPE_P(op2) == IS_FALSE || Z_TYPE_P(op2) == IS_TRUE) ? _IS_BOOL : Z_TYPE_P(op2))) == FAILURE) {
- ZVAL_LONG(result, 1);
- zend_free_obj_get_result(&tmp_free);
- return SUCCESS;
- }
- ret = compare_function(result, &tmp_free, op2);
- zend_free_obj_get_result(&tmp_free);
- return ret;
- }
- }
- if (Z_TYPE_P(op2) == IS_OBJECT) {
- if (Z_OBJ_HT_P(op2)->get) {
- zval rv;
- op_free = Z_OBJ_HT_P(op2)->get(op2, &rv);
- ret = compare_function(result, op1, op_free);
- zend_free_obj_get_result(op_free);
- return ret;
- } else if (Z_TYPE_P(op1) != IS_OBJECT && Z_OBJ_HT_P(op2)->cast_object) {
- ZVAL_UNDEF(&tmp_free);
- if (Z_OBJ_HT_P(op2)->cast_object(op2, &tmp_free, ((Z_TYPE_P(op1) == IS_FALSE || Z_TYPE_P(op1) == IS_TRUE) ? _IS_BOOL : Z_TYPE_P(op1))) == FAILURE) {
- ZVAL_LONG(result, -1);
- zend_free_obj_get_result(&tmp_free);
- return SUCCESS;
- }
- ret = compare_function(result, op1, &tmp_free);
- zend_free_obj_get_result(&tmp_free);
- return ret;
- } else if (Z_TYPE_P(op1) == IS_OBJECT) {
- ZVAL_LONG(result, 1);
- return SUCCESS;
- }
- }
if (!converted) {
if (Z_TYPE_P(op1) < IS_TRUE) {
- ZVAL_LONG(result, zval_is_true(op2) ? -1 : 0);
- return SUCCESS;
+ return zval_is_true(op2) ? -1 : 0;
} else if (Z_TYPE_P(op1) == IS_TRUE) {
- ZVAL_LONG(result, zval_is_true(op2) ? 0 : 1);
- return SUCCESS;
+ return zval_is_true(op2) ? 0 : 1;
} else if (Z_TYPE_P(op2) < IS_TRUE) {
- ZVAL_LONG(result, zval_is_true(op1) ? 1 : 0);
- return SUCCESS;
+ return zval_is_true(op1) ? 1 : 0;
} else if (Z_TYPE_P(op2) == IS_TRUE) {
- ZVAL_LONG(result, zval_is_true(op1) ? 0 : -1);
- return SUCCESS;
+ return zval_is_true(op1) ? 0 : -1;
} else {
- op1 = zendi_convert_scalar_to_number(op1, &op1_copy, result, 1);
- op2 = zendi_convert_scalar_to_number(op2, &op2_copy, result, 1);
+ op1 = _zendi_convert_scalar_to_number(op1, &op1_copy);
+ op2 = _zendi_convert_scalar_to_number(op2, &op2_copy);
if (EG(exception)) {
- if (result != op1) {
- ZVAL_UNDEF(result);
- }
- return FAILURE;
+ return 1; /* to stop comparison of arrays */
}
converted = 1;
}
} else if (Z_TYPE_P(op1)==IS_ARRAY) {
- ZVAL_LONG(result, 1);
- return SUCCESS;
+ return 1;
} else if (Z_TYPE_P(op2)==IS_ARRAY) {
- ZVAL_LONG(result, -1);
- return SUCCESS;
+ return -1;
} else {
ZEND_ASSERT(0);
zend_throw_error(NULL, "Unsupported operand types");
- if (result != op1) {
- ZVAL_UNDEF(result);
- }
- return FAILURE;
+ return 1;
}
}
}
@@ -2271,91 +2134,75 @@ ZEND_API int ZEND_FASTCALL is_not_identical_function(zval *result, zval *op1, zv
ZEND_API int ZEND_FASTCALL is_equal_function(zval *result, zval *op1, zval *op2) /* {{{ */
{
- if (compare_function(result, op1, op2) == FAILURE) {
- return FAILURE;
- }
- ZVAL_BOOL(result, (Z_LVAL_P(result) == 0));
+ ZVAL_BOOL(result, zend_compare(op1, op2) == 0);
return SUCCESS;
}
/* }}} */
ZEND_API int ZEND_FASTCALL is_not_equal_function(zval *result, zval *op1, zval *op2) /* {{{ */
{
- if (compare_function(result, op1, op2) == FAILURE) {
- return FAILURE;
- }
- ZVAL_BOOL(result, (Z_LVAL_P(result) != 0));
+ ZVAL_BOOL(result, (zend_compare(op1, op2) != 0));
return SUCCESS;
}
/* }}} */
ZEND_API int ZEND_FASTCALL is_smaller_function(zval *result, zval *op1, zval *op2) /* {{{ */
{
- if (compare_function(result, op1, op2) == FAILURE) {
- return FAILURE;
- }
- ZVAL_BOOL(result, (Z_LVAL_P(result) < 0));
+ ZVAL_BOOL(result, (zend_compare(op1, op2) < 0));
return SUCCESS;
}
/* }}} */
ZEND_API int ZEND_FASTCALL is_smaller_or_equal_function(zval *result, zval *op1, zval *op2) /* {{{ */
{
- if (compare_function(result, op1, op2) == FAILURE) {
- return FAILURE;
- }
- ZVAL_BOOL(result, (Z_LVAL_P(result) <= 0));
+ ZVAL_BOOL(result, (zend_compare(op1, op2) <= 0));
return SUCCESS;
}
/* }}} */
-static zend_always_inline zend_bool instanceof_class(const zend_class_entry *instance_ce, const zend_class_entry *ce) /* {{{ */
-{
- do {
- if (instance_ce == ce) {
- return 1;
- }
- instance_ce = instance_ce->parent;
- } while (instance_ce);
- return 0;
-}
-/* }}} */
-
-static zend_bool ZEND_FASTCALL instanceof_interface(const zend_class_entry *instance_ce, const zend_class_entry *ce) /* {{{ */
+ZEND_API zend_bool ZEND_FASTCALL zend_class_implements_interface(const zend_class_entry *class_ce, const zend_class_entry *interface_ce) /* {{{ */
{
uint32_t i;
+ ZEND_ASSERT(!(class_ce->ce_flags & ZEND_ACC_INTERFACE));
+ ZEND_ASSERT(interface_ce->ce_flags & ZEND_ACC_INTERFACE);
- if (instance_ce->num_interfaces) {
- ZEND_ASSERT(instance_ce->ce_flags & ZEND_ACC_RESOLVED_INTERFACES);
- for (i = 0; i < instance_ce->num_interfaces; i++) {
- if (instance_ce->interfaces[i] == ce) {
+ if (class_ce->num_interfaces) {
+ ZEND_ASSERT(class_ce->ce_flags & ZEND_ACC_RESOLVED_INTERFACES);
+ for (i = 0; i < class_ce->num_interfaces; i++) {
+ if (class_ce->interfaces[i] == interface_ce) {
return 1;
}
}
}
- return instance_ce == ce;
-}
-/* }}} */
-
-// TODO: It would make more sense to expose instanceof_class + instanceof_interface instead
-ZEND_API zend_bool ZEND_FASTCALL instanceof_function_ex(const zend_class_entry *instance_ce, const zend_class_entry *ce, zend_bool is_interface) /* {{{ */
-{
- if (is_interface) {
- ZEND_ASSERT(ce->ce_flags & ZEND_ACC_INTERFACE);
- return instanceof_interface(instance_ce, ce);
- } else {
- ZEND_ASSERT(!(ce->ce_flags & ZEND_ACC_INTERFACE));
- return instanceof_class(instance_ce, ce);
- }
+ return 0;
}
/* }}} */
-ZEND_API zend_bool ZEND_FASTCALL instanceof_function(const zend_class_entry *instance_ce, const zend_class_entry *ce) /* {{{ */
+ZEND_API zend_bool ZEND_FASTCALL instanceof_function_slow(const zend_class_entry *instance_ce, const zend_class_entry *ce) /* {{{ */
{
+ ZEND_ASSERT(instance_ce != ce && "Should have been checked already");
if (ce->ce_flags & ZEND_ACC_INTERFACE) {
- return instanceof_interface(instance_ce, ce);
+ uint32_t i;
+
+ if (instance_ce->num_interfaces) {
+ ZEND_ASSERT(instance_ce->ce_flags & ZEND_ACC_RESOLVED_INTERFACES);
+ for (i = 0; i < instance_ce->num_interfaces; i++) {
+ if (instance_ce->interfaces[i] == ce) {
+ return 1;
+ }
+ }
+ }
+ return 0;
} else {
- return instanceof_class(instance_ce, ce);
+ while (1) {
+ instance_ce = instance_ce->parent;
+ if (instance_ce == ce) {
+ return 1;
+ }
+ if (instance_ce == NULL) {
+ return 0;
+ }
+ }
}
}
/* }}} */
@@ -2489,18 +2336,7 @@ try_again:
}
break;
case IS_OBJECT:
- if (Z_OBJ_HANDLER_P(op1, get)
- && Z_OBJ_HANDLER_P(op1, set)) {
- /* proxy object */
- zval rv;
- zval *val;
-
- val = Z_OBJ_HANDLER_P(op1, get)(op1, &rv);
- Z_TRY_ADDREF_P(val);
- increment_function(val);
- Z_OBJ_HANDLER_P(op1, set)(op1, val);
- zval_ptr_dtor(val);
- } else if (Z_OBJ_HANDLER_P(op1, do_operation)) {
+ if (Z_OBJ_HANDLER_P(op1, do_operation)) {
zval op2;
int res;
@@ -2556,18 +2392,7 @@ try_again:
}
break;
case IS_OBJECT:
- if (Z_OBJ_HANDLER_P(op1, get)
- && Z_OBJ_HANDLER_P(op1, set)) {
- /* proxy object */
- zval rv;
- zval *val;
-
- val = Z_OBJ_HANDLER_P(op1, get)(op1, &rv);
- Z_TRY_ADDREF_P(val);
- decrement_function(val);
- Z_OBJ_HANDLER_P(op1, set)(op1, val);
- zval_ptr_dtor(val);
- } else if (Z_OBJ_HANDLER_P(op1, do_operation)) {
+ if (Z_OBJ_HANDLER_P(op1, do_operation)) {
zval op2;
int res;
@@ -2596,23 +2421,14 @@ ZEND_API int ZEND_FASTCALL zend_is_true(zval *op) /* {{{ */
ZEND_API int ZEND_FASTCALL zend_object_is_true(zval *op) /* {{{ */
{
- if (Z_OBJ_HT_P(op)->cast_object) {
+ zend_object *zobj = Z_OBJ_P(op);
+
+ if (zobj->handlers->cast_object) {
zval tmp;
- if (Z_OBJ_HT_P(op)->cast_object(op, &tmp, _IS_BOOL) == SUCCESS) {
+ if (zobj->handlers->cast_object(zobj, &tmp, _IS_BOOL) == SUCCESS) {
return Z_TYPE(tmp) == IS_TRUE;
}
- zend_error(E_RECOVERABLE_ERROR, "Object of class %s could not be converted to bool", ZSTR_VAL(Z_OBJ_P(op)->ce->name));
- } else if (Z_OBJ_HT_P(op)->get) {
- int result;
- zval rv;
- zval *tmp = Z_OBJ_HT_P(op)->get(op, &rv);
-
- if (Z_TYPE_P(tmp) != IS_OBJECT) {
- /* for safety - avoid loop */
- result = i_zend_is_true(tmp);
- zval_ptr_dtor(tmp);
- return result;
- }
+ zend_error(E_RECOVERABLE_ERROR, "Object of class %s could not be converted to bool", ZSTR_VAL(zobj->ce->name));
}
return 1;
}
@@ -2958,12 +2774,7 @@ string_cmp:
static int hash_zval_compare_function(zval *z1, zval *z2) /* {{{ */
{
- zval result;
-
- if (compare_function(&result, z1, z2)==FAILURE) {
- return 1;
- }
- return Z_LVAL(result);
+ return zend_compare(z1, z2);
}
/* }}} */
@@ -2985,10 +2796,10 @@ ZEND_API int ZEND_FASTCALL zend_compare_objects(zval *o1, zval *o2) /* {{{ */
return 0;
}
- if (Z_OBJ_HT_P(o1)->compare_objects == NULL) {
+ if (Z_OBJ_HT_P(o1)->compare == NULL) {
return 1;
} else {
- return Z_OBJ_HT_P(o1)->compare_objects(o1, o2);
+ return Z_OBJ_HT_P(o1)->compare(o1, o2);
}
}
/* }}} */
diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h
index c5f4ae84a8..8b9e06f17e 100644
--- a/Zend/zend_operators.h
+++ b/Zend/zend_operators.h
@@ -63,8 +63,13 @@ ZEND_API int ZEND_FASTCALL is_not_equal_function(zval *result, zval *op1, zval *
ZEND_API int ZEND_FASTCALL is_smaller_function(zval *result, zval *op1, zval *op2);
ZEND_API int ZEND_FASTCALL is_smaller_or_equal_function(zval *result, zval *op1, zval *op2);
-ZEND_API zend_bool ZEND_FASTCALL instanceof_function_ex(const zend_class_entry *instance_ce, const zend_class_entry *ce, zend_bool is_interface);
-ZEND_API zend_bool ZEND_FASTCALL instanceof_function(const zend_class_entry *instance_ce, const zend_class_entry *ce);
+ZEND_API zend_bool ZEND_FASTCALL zend_class_implements_interface(const zend_class_entry *class_ce, const zend_class_entry *interface_ce);
+ZEND_API zend_bool ZEND_FASTCALL instanceof_function_slow(const zend_class_entry *instance_ce, const zend_class_entry *ce);
+
+static zend_always_inline zend_bool instanceof_function(
+ const zend_class_entry *instance_ce, const zend_class_entry *ce) {
+ return instance_ce == ce || instanceof_function_slow(instance_ce, ce);
+}
/**
* Checks whether the string "str" with length "length" is numeric. The value
@@ -148,10 +153,13 @@ static zend_always_inline const char *
zend_memnstr(const char *haystack, const char *needle, size_t needle_len, const char *end)
{
const char *p = haystack;
- const char ne = needle[needle_len-1];
ptrdiff_t off_p;
size_t off_s;
+ if (needle_len == 0) {
+ return p;
+ }
+
if (needle_len == 1) {
return (const char *)memchr(p, *needle, (end-p));
}
@@ -164,6 +172,7 @@ zend_memnstr(const char *haystack, const char *needle, size_t needle_len, const
}
if (EXPECTED(off_s < 1024 || needle_len < 9)) { /* glibc memchr is faster when needle is too short */
+ const char ne = needle[needle_len-1];
end -= needle_len;
while (p <= end) {
@@ -206,10 +215,13 @@ static zend_always_inline const char *
zend_memnrstr(const char *haystack, const char *needle, size_t needle_len, const char *end)
{
const char *p = end;
- const char ne = needle[needle_len-1];
ptrdiff_t off_p;
size_t off_s;
+ if (needle_len == 0) {
+ return p;
+ }
+
if (needle_len == 1) {
return (const char *)zend_memrchr(haystack, *needle, (p - haystack));
}
@@ -222,6 +234,7 @@ zend_memnrstr(const char *haystack, const char *needle, size_t needle_len, const
}
if (EXPECTED(off_s < 1024 || needle_len < 3)) {
+ const char ne = needle[needle_len-1];
p -= needle_len;
do {
@@ -388,6 +401,8 @@ again:
return result;
}
+ZEND_API int ZEND_FASTCALL zend_compare(zval *op1, zval *op2);
+
ZEND_API int ZEND_FASTCALL compare_function(zval *result, zval *op1, zval *op2);
ZEND_API int ZEND_FASTCALL numeric_compare_function(zval *op1, zval *op2);
@@ -500,9 +515,15 @@ ZEND_API void zend_update_current_locale(void);
#define ZVAL_OFFSETOF_TYPE \
(offsetof(zval, u1.type_info) - offsetof(zval, value))
+#if defined(HAVE_ASM_GOTO) && !__has_feature(memory_sanitizer)
+# define ZEND_USE_ASM_ARITHMETIC 1
+#else
+# define ZEND_USE_ASM_ARITHMETIC 0
+#endif
+
static zend_always_inline void fast_long_increment_function(zval *op1)
{
-#if defined(HAVE_ASM_GOTO) && defined(__i386__) && !(4 == __GNUC__ && 8 == __GNUC_MINOR__)
+#if ZEND_USE_ASM_ARITHMETIC && defined(__i386__) && !(4 == __GNUC__ && 8 == __GNUC_MINOR__)
__asm__ goto(
"addl $1,(%0)\n\t"
"jo %l1\n"
@@ -513,7 +534,7 @@ static zend_always_inline void fast_long_increment_function(zval *op1)
return;
overflow: ZEND_ATTRIBUTE_COLD_LABEL
ZVAL_DOUBLE(op1, (double)ZEND_LONG_MAX + 1.0);
-#elif defined(HAVE_ASM_GOTO) && defined(__x86_64__)
+#elif ZEND_USE_ASM_ARITHMETIC && defined(__x86_64__)
__asm__ goto(
"addq $1,(%0)\n\t"
"jo %l1\n"
@@ -524,7 +545,7 @@ overflow: ZEND_ATTRIBUTE_COLD_LABEL
return;
overflow: ZEND_ATTRIBUTE_COLD_LABEL
ZVAL_DOUBLE(op1, (double)ZEND_LONG_MAX + 1.0);
-#elif defined(HAVE_ASM_GOTO) && defined(__aarch64__)
+#elif ZEND_USE_ASM_ARITHMETIC && defined(__aarch64__)
__asm__ goto (
"ldr x5, [%0]\n\t"
"adds x5, x5, 1\n\t"
@@ -565,7 +586,7 @@ overflow: ZEND_ATTRIBUTE_COLD_LABEL
static zend_always_inline void fast_long_decrement_function(zval *op1)
{
-#if defined(HAVE_ASM_GOTO) && defined(__i386__) && !(4 == __GNUC__ && 8 == __GNUC_MINOR__)
+#if ZEND_USE_ASM_ARITHMETIC && defined(__i386__) && !(4 == __GNUC__ && 8 == __GNUC_MINOR__)
__asm__ goto(
"subl $1,(%0)\n\t"
"jo %l1\n"
@@ -576,7 +597,7 @@ static zend_always_inline void fast_long_decrement_function(zval *op1)
return;
overflow: ZEND_ATTRIBUTE_COLD_LABEL
ZVAL_DOUBLE(op1, (double)ZEND_LONG_MIN - 1.0);
-#elif defined(HAVE_ASM_GOTO) && defined(__x86_64__)
+#elif ZEND_USE_ASM_ARITHMETIC && defined(__x86_64__)
__asm__ goto(
"subq $1,(%0)\n\t"
"jo %l1\n"
@@ -587,7 +608,7 @@ overflow: ZEND_ATTRIBUTE_COLD_LABEL
return;
overflow: ZEND_ATTRIBUTE_COLD_LABEL
ZVAL_DOUBLE(op1, (double)ZEND_LONG_MIN - 1.0);
-#elif defined(HAVE_ASM_GOTO) && defined(__aarch64__)
+#elif ZEND_USE_ASM_ARITHMETIC && defined(__aarch64__)
__asm__ goto (
"ldr x5, [%0]\n\t"
"subs x5 ,x5, 1\n\t"
@@ -628,7 +649,7 @@ overflow: ZEND_ATTRIBUTE_COLD_LABEL
static zend_always_inline void fast_long_add_function(zval *result, zval *op1, zval *op2)
{
-#if defined(HAVE_ASM_GOTO) && defined(__i386__) && !(4 == __GNUC__ && 8 == __GNUC_MINOR__)
+#if ZEND_USE_ASM_ARITHMETIC && defined(__i386__) && !(4 == __GNUC__ && 8 == __GNUC_MINOR__)
__asm__ goto(
"movl (%1), %%eax\n\t"
"addl (%2), %%eax\n\t"
@@ -646,7 +667,7 @@ static zend_always_inline void fast_long_add_function(zval *result, zval *op1, z
return;
overflow: ZEND_ATTRIBUTE_COLD_LABEL
ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) + (double) Z_LVAL_P(op2));
-#elif defined(HAVE_ASM_GOTO) && defined(__x86_64__)
+#elif ZEND_USE_ASM_ARITHMETIC && defined(__x86_64__)
__asm__ goto(
"movq (%1), %%rax\n\t"
"addq (%2), %%rax\n\t"
@@ -664,7 +685,7 @@ overflow: ZEND_ATTRIBUTE_COLD_LABEL
return;
overflow: ZEND_ATTRIBUTE_COLD_LABEL
ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) + (double) Z_LVAL_P(op2));
-#elif defined(HAVE_ASM_GOTO) && defined(__aarch64__)
+#elif ZEND_USE_ASM_ARITHMETIC && defined(__aarch64__)
__asm__ goto(
"ldr x5, [%1]\n\t"
"ldr x6, [%2]\n\t"
@@ -738,7 +759,7 @@ static zend_always_inline int fast_add_function(zval *result, zval *op1, zval *o
static zend_always_inline void fast_long_sub_function(zval *result, zval *op1, zval *op2)
{
-#if defined(HAVE_ASM_GOTO) && defined(__i386__) && !(4 == __GNUC__ && 8 == __GNUC_MINOR__)
+#if ZEND_USE_ASM_ARITHMETIC && defined(__i386__) && !(4 == __GNUC__ && 8 == __GNUC_MINOR__)
__asm__ goto(
"movl (%1), %%eax\n\t"
"subl (%2), %%eax\n\t"
@@ -756,7 +777,7 @@ static zend_always_inline void fast_long_sub_function(zval *result, zval *op1, z
return;
overflow: ZEND_ATTRIBUTE_COLD_LABEL
ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) - (double) Z_LVAL_P(op2));
-#elif defined(HAVE_ASM_GOTO) && defined(__x86_64__)
+#elif ZEND_USE_ASM_ARITHMETIC && defined(__x86_64__)
__asm__ goto(
"movq (%1), %%rax\n\t"
"subq (%2), %%rax\n\t"
@@ -774,7 +795,7 @@ overflow: ZEND_ATTRIBUTE_COLD_LABEL
return;
overflow: ZEND_ATTRIBUTE_COLD_LABEL
ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) - (double) Z_LVAL_P(op2));
-#elif defined(HAVE_ASM_GOTO) && defined(__aarch64__)
+#elif ZEND_USE_ASM_ARITHMETIC && defined(__aarch64__)
__asm__ goto(
"ldr x5, [%1]\n\t"
"ldr x6, [%2]\n\t"
@@ -836,7 +857,6 @@ static zend_always_inline int zend_fast_equal_strings(zend_string *s1, zend_stri
static zend_always_inline int fast_equal_check_function(zval *op1, zval *op2)
{
- zval result;
if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
return Z_LVAL_P(op1) == Z_LVAL_P(op2);
@@ -854,28 +874,23 @@ static zend_always_inline int fast_equal_check_function(zval *op1, zval *op2)
return zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2));
}
}
- compare_function(&result, op1, op2);
- return Z_LVAL(result) == 0;
+ return zend_compare(op1, op2) == 0;
}
static zend_always_inline int fast_equal_check_long(zval *op1, zval *op2)
{
- zval result;
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
return Z_LVAL_P(op1) == Z_LVAL_P(op2);
}
- compare_function(&result, op1, op2);
- return Z_LVAL(result) == 0;
+ return zend_compare(op1, op2) == 0;
}
static zend_always_inline int fast_equal_check_string(zval *op1, zval *op2)
{
- zval result;
if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) {
return zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2));
}
- compare_function(&result, op1, op2);
- return Z_LVAL(result) == 0;
+ return zend_compare(op1, op2) == 0;
}
static zend_always_inline zend_bool fast_is_identical_function(zval *op1, zval *op2)
@@ -899,19 +914,7 @@ static zend_always_inline zend_bool fast_is_not_identical_function(zval *op1, zv
}
#define ZEND_TRY_BINARY_OP1_OBJECT_OPERATION(opcode, binary_op) \
- if (UNEXPECTED(Z_TYPE_P(op1) == IS_OBJECT) \
- && op1 == result \
- && UNEXPECTED(Z_OBJ_HANDLER_P(op1, get)) \
- && EXPECTED(Z_OBJ_HANDLER_P(op1, set))) { \
- int ret; \
- zval rv; \
- zval *objval = Z_OBJ_HANDLER_P(op1, get)(op1, &rv); \
- Z_TRY_ADDREF_P(objval); \
- ret = binary_op(objval, objval, op2); \
- Z_OBJ_HANDLER_P(op1, set)(op1, objval); \
- zval_ptr_dtor(objval); \
- return ret; \
- } else if (UNEXPECTED(Z_TYPE_P(op1) == IS_OBJECT) \
+ if (UNEXPECTED(Z_TYPE_P(op1) == IS_OBJECT) \
&& UNEXPECTED(Z_OBJ_HANDLER_P(op1, do_operation))) { \
if (EXPECTED(SUCCESS == Z_OBJ_HANDLER_P(op1, do_operation)(opcode, result, op1, op2))) { \
return SUCCESS; \
diff --git a/Zend/zend_portability.h b/Zend/zend_portability.h
index 58c42a289e..c561e0fdf2 100644
--- a/Zend/zend_portability.h
+++ b/Zend/zend_portability.h
@@ -438,49 +438,23 @@ char *alloca();
#define ZEND_BIT_TEST(bits, bit) \
(((bits)[(bit) / (sizeof((bits)[0])*8)] >> ((bit) & (sizeof((bits)[0])*8-1))) & 1)
-/* We always define a function, even if there's a macro or expression we could
- * alias, so that using it in contexts where we can't make function calls
- * won't fail to compile on some machines and not others.
- */
-static zend_always_inline double _zend_get_inf(void) /* {{{ */
-{
-#ifdef INFINITY
- return INFINITY;
-#elif HAVE_HUGE_VAL_INF
- return HUGE_VAL;
-#elif defined(__i386__) || defined(_X86_) || defined(ALPHA) || defined(_ALPHA) || defined(__alpha)
-# define _zend_DOUBLE_INFINITY_HIGH 0x7ff00000
- double val = 0.0;
- ((uint32_t*)&val)[1] = _zend_DOUBLE_INFINITY_HIGH;
- ((uint32_t*)&val)[0] = 0;
- return val;
-#elif HAVE_ATOF_ACCEPTS_INF
- return atof("INF");
-#else
- return 1.0/0.0;
-#endif
-} /* }}} */
-#define ZEND_INFINITY (_zend_get_inf())
-
-static zend_always_inline double _zend_get_nan(void) /* {{{ */
-{
-#ifdef NAN
- return NAN;
-#elif HAVE_HUGE_VAL_NAN
- return HUGE_VAL + -HUGE_VAL;
-#elif defined(__i386__) || defined(_X86_) || defined(ALPHA) || defined(_ALPHA) || defined(__alpha)
-# define _zend_DOUBLE_QUIET_NAN_HIGH 0xfff80000
- double val = 0.0;
- ((uint32_t*)&val)[1] = _zend_DOUBLE_QUIET_NAN_HIGH;
- ((uint32_t*)&val)[0] = 0;
- return val;
-#elif HAVE_ATOF_ACCEPTS_NAN
- return atof("NAN");
-#else
- return 0.0/0.0;
-#endif
-} /* }}} */
-#define ZEND_NAN (_zend_get_nan())
+#define ZEND_INFINITY INFINITY
+
+#define ZEND_NAN NAN
+
+#if defined(__cplusplus) && __cplusplus >= 201103L
+extern "C++" {
+# include <cmath>
+}
+# define zend_isnan std::isnan
+# define zend_isinf std::isinf
+# define zend_finite std::isfinite
+#else
+# include <math.h>
+# define zend_isnan(a) isnan(a)
+# define zend_isinf(a) isinf(a)
+# define zend_finite(a) isfinite(a)
+#endif
#define ZEND_STRL(str) (str), (sizeof(str)-1)
#define ZEND_STRS(str) (str), (sizeof(str))
@@ -507,18 +481,6 @@ static zend_always_inline double _zend_get_nan(void) /* {{{ */
#define ZEND_VALID_SOCKET(sock) ((sock) >= 0)
#endif
-/* va_copy() is __va_copy() in old gcc versions.
- * According to the autoconf manual, using
- * memcpy(&dst, &src, sizeof(va_list))
- * gives maximum portability. */
-#ifndef va_copy
-# ifdef __va_copy
-# define va_copy(dest, src) __va_copy((dest), (src))
-# else
-# define va_copy(dest, src) memcpy(&(dest), &(src), sizeof(va_list))
-# endif
-#endif
-
/* Intrinsics macros start. */
/* Memory sanitizer is incompatible with ifunc resolvers. Even if the resolver
@@ -648,12 +610,4 @@ static zend_always_inline double _zend_get_nan(void) /* {{{ */
# define ZEND_PREFER_RELOAD
#endif
-#if defined(ZEND_WIN32) && defined(_DEBUG) && defined(PHP_WIN32_DEBUG_HEAP)
-# define ZEND_IGNORE_LEAKS_BEGIN() _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) & ~_CRTDBG_ALLOC_MEM_DF)
-# define ZEND_IGNORE_LEAKS_END() _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_ALLOC_MEM_DF)
-#else
-# define ZEND_IGNORE_LEAKS_BEGIN()
-# define ZEND_IGNORE_LEAKS_END()
-#endif
-
#endif /* ZEND_PORTABILITY_H */
diff --git a/Zend/zend_smart_str.c b/Zend/zend_smart_str.c
index 1a5eb455ad..3916902e8d 100644
--- a/Zend/zend_smart_str.c
+++ b/Zend/zend_smart_str.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/Zend/zend_smart_str.h b/Zend/zend_smart_str.h
index 2dab1f809a..9211e54bee 100644
--- a/Zend/zend_smart_str.h
+++ b/Zend/zend_smart_str.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/Zend/zend_smart_str_public.h b/Zend/zend_smart_str_public.h
index ba0b399881..eef4a7100a 100644
--- a/Zend/zend_smart_str_public.h
+++ b/Zend/zend_smart_str_public.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/Zend/zend_smart_string.h b/Zend/zend_smart_string.h
index 4580e43769..1f74a63218 100644
--- a/Zend/zend_smart_string.h
+++ b/Zend/zend_smart_string.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/Zend/zend_smart_string_public.h b/Zend/zend_smart_string_public.h
index e39d67c16e..c575d514ce 100644
--- a/Zend/zend_smart_string_public.h
+++ b/Zend/zend_smart_string_public.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/Zend/zend_string.h b/Zend/zend_string.h
index b4a0ddef95..f2076beee1 100644
--- a/Zend/zend_string.h
+++ b/Zend/zend_string.h
@@ -480,7 +480,6 @@ EMPTY_SWITCH_DEFAULT_CASE()
_(ZEND_STR_THIS, "this") \
_(ZEND_STR_VALUE, "value") \
_(ZEND_STR_KEY, "key") \
- _(ZEND_STR_MAGIC_AUTOLOAD, "__autoload") \
_(ZEND_STR_MAGIC_INVOKE, "__invoke") \
_(ZEND_STR_PREVIOUS, "previous") \
_(ZEND_STR_CODE, "code") \
@@ -507,6 +506,14 @@ EMPTY_SWITCH_DEFAULT_CASE()
_(ZEND_STR_ARGV, "argv") \
_(ZEND_STR_ARGC, "argc") \
_(ZEND_STR_ARRAY_CAPITALIZED, "Array") \
+ _(ZEND_STR_BOOL, "bool") \
+ _(ZEND_STR_INT, "int") \
+ _(ZEND_STR_FLOAT, "float") \
+ _(ZEND_STR_CALLABLE, "callable") \
+ _(ZEND_STR_ITERABLE, "iterable") \
+ _(ZEND_STR_VOID, "void") \
+ _(ZEND_STR_FALSE, "false") \
+ _(ZEND_STR_NULL_LOWERCASE, "null") \
typedef enum _zend_known_string_id {
diff --git a/Zend/zend_strtod.c b/Zend/zend_strtod.c
index 2228e2262c..08f8424e8c 100644
--- a/Zend/zend_strtod.c
+++ b/Zend/zend_strtod.c
@@ -546,7 +546,6 @@ Bigint {
static Bigint *freelist[Kmax+1];
static void destroy_freelist(void);
-static void free_p5s(void);
#ifdef ZTS
static MUTEX_T dtoa_mutex;
@@ -565,8 +564,6 @@ ZEND_API int zend_startup_strtod(void) /* {{{ */
ZEND_API int zend_shutdown_strtod(void) /* {{{ */
{
destroy_freelist();
- free_p5s();
-
#ifdef ZTS
tsrm_mutex_free(dtoa_mutex);
dtoa_mutex = NULL;
@@ -4543,19 +4540,6 @@ static void destroy_freelist(void)
FREE_DTOA_LOCK(0)
}
-static void free_p5s(void)
-{
- Bigint **listp, *tmp;
-
- ACQUIRE_DTOA_LOCK(1)
- listp = &p5s;
- while ((tmp = *listp) != NULL) {
- *listp = tmp->next;
- free(tmp);
- }
- FREE_DTOA_LOCK(1)
-}
-
#ifdef __cplusplus
}
#endif
diff --git a/Zend/zend_ts_hash.c b/Zend/zend_ts_hash.c
index 3cff54bf6c..6b69b49e15 100644
--- a/Zend/zend_ts_hash.c
+++ b/Zend/zend_ts_hash.c
@@ -264,15 +264,11 @@ ZEND_API void zend_ts_hash_merge_ex(TsHashTable *target, TsHashTable *source, co
end_read(source);
}
-ZEND_API int zend_ts_hash_sort(TsHashTable *ht, sort_func_t sort_func, compare_func_t compare_func, int renumber)
+ZEND_API void zend_ts_hash_sort(TsHashTable *ht, sort_func_t sort_func, compare_func_t compare_func, int renumber)
{
- int retval;
-
begin_write(ht);
- retval = zend_hash_sort_ex(TS_HASH(ht), sort_func, compare_func, renumber);
+ zend_hash_sort_ex(TS_HASH(ht), sort_func, compare_func, renumber);
end_write(ht);
-
- return retval;
}
ZEND_API int zend_ts_hash_compare(TsHashTable *ht1, TsHashTable *ht2, compare_func_t compar, zend_bool ordered)
@@ -310,15 +306,11 @@ ZEND_API int zend_ts_hash_num_elements(TsHashTable *ht)
return retval;
}
-ZEND_API int zend_ts_hash_rehash(TsHashTable *ht)
+ZEND_API void zend_ts_hash_rehash(TsHashTable *ht)
{
- int retval;
-
begin_write(ht);
- retval = zend_hash_rehash(TS_HASH(ht));
+ zend_hash_rehash(TS_HASH(ht));
end_write(ht);
-
- return retval;
}
ZEND_API zval *zend_ts_hash_str_find(TsHashTable *ht, const char *key, size_t len)
diff --git a/Zend/zend_ts_hash.h b/Zend/zend_ts_hash.h
index 35a4250d34..88aa4d45f4 100644
--- a/Zend/zend_ts_hash.h
+++ b/Zend/zend_ts_hash.h
@@ -73,13 +73,13 @@ ZEND_API void zend_ts_hash_copy(TsHashTable *target, TsHashTable *source, copy_c
ZEND_API void zend_ts_hash_copy_to_hash(HashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor);
ZEND_API void zend_ts_hash_merge(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, int overwrite);
ZEND_API void zend_ts_hash_merge_ex(TsHashTable *target, TsHashTable *source, copy_ctor_func_t pCopyConstructor, merge_checker_func_t pMergeSource, void *pParam);
-ZEND_API int zend_ts_hash_sort(TsHashTable *ht, sort_func_t sort_func, compare_func_t compare_func, int renumber);
+ZEND_API void zend_ts_hash_sort(TsHashTable *ht, sort_func_t sort_func, compare_func_t compare_func, int renumber);
ZEND_API int zend_ts_hash_compare(TsHashTable *ht1, TsHashTable *ht2, compare_func_t compar, zend_bool ordered);
ZEND_API zval *zend_ts_hash_minmax(TsHashTable *ht, compare_func_t compar, int flag);
ZEND_API int zend_ts_hash_num_elements(TsHashTable *ht);
-ZEND_API int zend_ts_hash_rehash(TsHashTable *ht);
+ZEND_API void zend_ts_hash_rehash(TsHashTable *ht);
#if ZEND_DEBUG
/* debug */
diff --git a/Zend/zend_type_info.h b/Zend/zend_type_info.h
index 72550b6fc3..752e6a4b85 100644
--- a/Zend/zend_type_info.h
+++ b/Zend/zend_type_info.h
@@ -25,6 +25,7 @@
#define MAY_BE_NULL (1 << IS_NULL)
#define MAY_BE_FALSE (1 << IS_FALSE)
#define MAY_BE_TRUE (1 << IS_TRUE)
+#define MAY_BE_BOOL (MAY_BE_FALSE|MAY_BE_TRUE)
#define MAY_BE_LONG (1 << IS_LONG)
#define MAY_BE_DOUBLE (1 << IS_DOUBLE)
#define MAY_BE_STRING (1 << IS_STRING)
@@ -34,6 +35,12 @@
#define MAY_BE_ANY (MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)
#define MAY_BE_REF (1 << IS_REFERENCE) /* may be reference */
+/* These are used in zend_type, but not for type inference.
+ * They are allowed to overlap with types used during inference. */
+#define MAY_BE_CALLABLE (1 << IS_CALLABLE)
+#define MAY_BE_ITERABLE (1 << IS_ITERABLE)
+#define MAY_BE_VOID (1 << IS_VOID)
+
#define MAY_BE_ARRAY_SHIFT (IS_REFERENCE)
#define MAY_BE_ARRAY_OF_NULL (MAY_BE_NULL << MAY_BE_ARRAY_SHIFT)
@@ -52,7 +59,6 @@
#define MAY_BE_ARRAY_KEY_STRING (1<<22)
#define MAY_BE_ARRAY_KEY_ANY (MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_KEY_STRING)
-#define MAY_BE_ERROR (1<<23)
-#define MAY_BE_CLASS (1<<24)
+#define MAY_BE_CLASS (1<<23)
#endif /* ZEND_TYPE_INFO_H */
diff --git a/Zend/zend_types.h b/Zend/zend_types.h
index 7b8c079c45..1b314afa24 100644
--- a/Zend/zend_types.h
+++ b/Zend/zend_types.h
@@ -15,7 +15,7 @@
| Authors: Andi Gutmans <andi@php.net> |
| Zeev Suraski <zeev@php.net> |
| Dmitry Stogov <dmitry@php.net> |
- | Xinchen Hui <xinchen.h@zend.com> |
+ | Xinchen Hui <laruence@php.net> |
+----------------------------------------------------------------------+
*/
@@ -105,73 +105,179 @@ typedef void (*copy_ctor_func_t)(zval *pElement);
* zend_type - is an abstraction layer to represent information about type hint.
* It shouldn't be used directly. Only through ZEND_TYPE_* macros.
*
- * ZEND_TYPE_IS_SET() - checks if type-hint exists
- * ZEND_TYPE_IS_CODE() - checks if type-hint refer to standard type
- * ZEND_TYPE_IS_CLASS() - checks if type-hint refer to some class
- * ZEND_TYPE_IS_CE() - checks if type-hint refer to some class by zend_class_entry *
- * ZEND_TYPE_IS_NAME() - checks if type-hint refer to some class by zend_string *
+ * ZEND_TYPE_IS_SET() - checks if there is a type-hint
+ * ZEND_TYPE_HAS_ONLY_MASK() - checks if type-hint refer to standard type only
+ * ZEND_TYPE_HAS_CLASS() - checks if type-hint contains some class
+ * ZEND_TYPE_HAS_CE() - checks if type-hint contains some class as zend_class_entry *
+ * ZEND_TYPE_HAS_NAME() - checks if type-hint contains some class as zend_string *
*
* ZEND_TYPE_NAME() - returns referenced class name
* ZEND_TYPE_CE() - returns referenced class entry
- * ZEND_TYPE_CODE() - returns standard type code (e.g. IS_LONG, _IS_BOOL)
+ * ZEND_TYPE_PURE_MASK() - returns MAY_BE_* type mask
+ * ZEND_TYPE_FULL_MASK() - returns MAY_BE_* type mask together with other flags
*
* ZEND_TYPE_ALLOW_NULL() - checks if NULL is allowed
*
- * ZEND_TYPE_ENCODE() and ZEND_TYPE_ENCODE_CLASS() should be used for
- * construction.
+ * ZEND_TYPE_INIT_*() should be used for construction.
*/
-typedef uintptr_t zend_type;
+typedef struct {
+ /* Not using a union here, because there's no good way to initialize them
+ * in a way that is supported in both C and C++ (designated initializers
+ * are only supported since C++20). */
+ void *ptr;
+ uint32_t type_mask;
+ /* TODO: We could use the extra 32-bit of padding on 64-bit systems. */
+} zend_type;
+
+typedef struct {
+ uint32_t num_types;
+ zend_type types[1];
+} zend_type_list;
+
+#define _ZEND_TYPE_EXTRA_FLAGS_SHIFT 24
+#define _ZEND_TYPE_MASK ((1u << 24) - 1)
+/* Only one of these bits may be set. */
+#define _ZEND_TYPE_NAME_BIT (1u << 23)
+#define _ZEND_TYPE_CE_BIT (1u << 22)
+#define _ZEND_TYPE_LIST_BIT (1u << 21)
+#define _ZEND_TYPE_KIND_MASK (_ZEND_TYPE_LIST_BIT|_ZEND_TYPE_CE_BIT|_ZEND_TYPE_NAME_BIT)
+/* Whether the type list is arena allocated */
+#define _ZEND_TYPE_ARENA_BIT (1u << 20)
+/* Type mask excluding the flags above. */
+#define _ZEND_TYPE_MAY_BE_MASK ((1u << 20) - 1)
+/* Must have same value as MAY_BE_NULL */
+#define _ZEND_TYPE_NULLABLE_BIT 0x2
#define ZEND_TYPE_IS_SET(t) \
- ((t) > Z_L(0x3))
+ (((t).type_mask & _ZEND_TYPE_MASK) != 0)
+
+#define ZEND_TYPE_HAS_CLASS(t) \
+ ((((t).type_mask) & _ZEND_TYPE_KIND_MASK) != 0)
-#define ZEND_TYPE_IS_CODE(t) \
- (((t) > Z_L(0x3)) && ((t) <= Z_L(0x3ff)))
+#define ZEND_TYPE_HAS_CE(t) \
+ ((((t).type_mask) & _ZEND_TYPE_CE_BIT) != 0)
-#define ZEND_TYPE_IS_CLASS(t) \
- ((t) > Z_L(0x3ff))
+#define ZEND_TYPE_HAS_NAME(t) \
+ ((((t).type_mask) & _ZEND_TYPE_NAME_BIT) != 0)
-#define ZEND_TYPE_IS_CE(t) \
- (((t) & Z_L(0x2)) != 0)
+#define ZEND_TYPE_HAS_LIST(t) \
+ ((((t).type_mask) & _ZEND_TYPE_LIST_BIT) != 0)
-#define ZEND_TYPE_IS_NAME(t) \
- (ZEND_TYPE_IS_CLASS(t) && !ZEND_TYPE_IS_CE(t))
+#define ZEND_TYPE_USES_ARENA(t) \
+ ((((t).type_mask) & _ZEND_TYPE_ARENA_BIT) != 0)
+
+#define ZEND_TYPE_IS_ONLY_MASK(t) \
+ (ZEND_TYPE_IS_SET(t) && (t).ptr == NULL)
#define ZEND_TYPE_NAME(t) \
- ((zend_string*)((t) & ~Z_L(0x3)))
+ ((zend_string *) (t).ptr)
+
+#define ZEND_TYPE_LITERAL_NAME(t) \
+ ((const char *) (t).ptr)
#define ZEND_TYPE_CE(t) \
- ((zend_class_entry*)((t) & ~Z_L(0x3)))
+ ((zend_class_entry *) (t).ptr)
+
+#define ZEND_TYPE_LIST(t) \
+ ((zend_type_list *) (t).ptr)
+
+#define ZEND_TYPE_LIST_SIZE(num_types) \
+ (sizeof(zend_type_list) + ((num_types) - 1) * sizeof(zend_type))
+
+/* This iterates over a zend_type_list. */
+#define ZEND_TYPE_LIST_FOREACH(list, type_ptr) do { \
+ zend_type *_list = (list)->types; \
+ zend_type *_end = _list + (list)->num_types; \
+ for (; _list < _end; _list++) { \
+ type_ptr = _list;
+
+#define ZEND_TYPE_LIST_FOREACH_END() \
+ } \
+} while (0)
+
+/* This iterates over any zend_type. If it's a type list, all list elements will
+ * be visited. If it's a single type, only the single type is visited. */
+#define ZEND_TYPE_FOREACH(type, type_ptr) do { \
+ zend_type *_cur, *_end; \
+ if (ZEND_TYPE_HAS_LIST(type)) { \
+ zend_type_list *_list = ZEND_TYPE_LIST(type); \
+ _cur = _list->types; \
+ _end = _cur + _list->num_types; \
+ } else { \
+ _cur = &(type); \
+ _end = _cur + 1; \
+ } \
+ do { \
+ type_ptr = _cur;
+
+#define ZEND_TYPE_FOREACH_END() \
+ } while (++_cur < _end); \
+} while (0)
+
+#define ZEND_TYPE_SET_PTR(t, _ptr) \
+ ((t).ptr = (_ptr))
+
+#define ZEND_TYPE_SET_PTR_AND_KIND(t, _ptr, kind_bit) do { \
+ (t).ptr = (_ptr); \
+ (t).type_mask &= ~_ZEND_TYPE_KIND_MASK; \
+ (t).type_mask |= (kind_bit); \
+} while (0)
+
+#define ZEND_TYPE_SET_CE(t, ce) \
+ ZEND_TYPE_SET_PTR_AND_KIND(t, ce, _ZEND_TYPE_CE_BIT)
+
+#define ZEND_TYPE_SET_LIST(t, list) \
+ ZEND_TYPE_SET_PTR_AND_KIND(t, list, _ZEND_TYPE_LIST_BIT)
+
+/* FULL_MASK() includes the MAY_BE_* type mask, the CE/NAME bits, as well as extra reserved bits.
+ * The PURE_MASK() only includes the MAY_BE_* type mask. */
+#define ZEND_TYPE_FULL_MASK(t) \
+ ((t).type_mask)
-#define ZEND_TYPE_CODE(t) \
- ((t) >> Z_L(2))
+#define ZEND_TYPE_PURE_MASK(t) \
+ ((t).type_mask & _ZEND_TYPE_MAY_BE_MASK)
+
+#define ZEND_TYPE_FULL_MASK_WITHOUT_NULL(t) \
+ ((t).type_mask & ~_ZEND_TYPE_NULLABLE_BIT)
+
+#define ZEND_TYPE_PURE_MASK_WITHOUT_NULL(t) \
+ ((t).type_mask & _ZEND_TYPE_MAY_BE_MASK & ~_ZEND_TYPE_NULLABLE_BIT)
+
+#define ZEND_TYPE_CONTAINS_CODE(t, code) \
+ (((t).type_mask & (1u << (code))) != 0)
#define ZEND_TYPE_ALLOW_NULL(t) \
- (((t) & Z_L(0x1)) != 0)
+ (((t).type_mask & _ZEND_TYPE_NULLABLE_BIT) != 0)
+
+#define ZEND_TYPE_INIT_NONE(extra_flags) \
+ { NULL, (extra_flags) }
-#define ZEND_TYPE_WITHOUT_NULL(t) \
- ((t) & ~Z_L(0x1))
+#define ZEND_TYPE_INIT_MASK(_type_mask) \
+ { NULL, (_type_mask) }
-#define ZEND_TYPE_ENCODE(code, allow_null) \
- (((code) << Z_L(2)) | ((allow_null) ? Z_L(0x1) : Z_L(0x0)))
+#define ZEND_TYPE_INIT_CODE(code, allow_null, extra_flags) \
+ ZEND_TYPE_INIT_MASK(((code) == _IS_BOOL ? MAY_BE_BOOL : (1 << (code))) \
+ | ((allow_null) ? _ZEND_TYPE_NULLABLE_BIT : 0) | (extra_flags))
-#define ZEND_TYPE_ENCODE_CE(ce, allow_null) \
- (((uintptr_t)(ce)) | ((allow_null) ? Z_L(0x3) : Z_L(0x2)))
+#define ZEND_TYPE_INIT_PTR(ptr, type_kind, allow_null, extra_flags) \
+ { (void *) (ptr), \
+ (type_kind) | ((allow_null) ? _ZEND_TYPE_NULLABLE_BIT : 0) | (extra_flags) }
-#define ZEND_TYPE_ENCODE_CLASS(class_name, allow_null) \
- (((uintptr_t)(class_name)) | ((allow_null) ? Z_L(0x1) : Z_L(0x0)))
+#define ZEND_TYPE_INIT_PTR_MASK(ptr, type_mask) \
+ { (void *) (ptr), (type_mask) }
-#define ZEND_TYPE_ENCODE_CLASS_CONST_0(class_name) \
- ((zend_type) class_name)
-#define ZEND_TYPE_ENCODE_CLASS_CONST_1(class_name) \
- ((zend_type) "?" class_name)
-#define ZEND_TYPE_ENCODE_CLASS_CONST_Q2(macro, class_name) \
- macro(class_name)
-#define ZEND_TYPE_ENCODE_CLASS_CONST_Q1(allow_null, class_name) \
- ZEND_TYPE_ENCODE_CLASS_CONST_Q2(ZEND_TYPE_ENCODE_CLASS_CONST_ ##allow_null, class_name)
-#define ZEND_TYPE_ENCODE_CLASS_CONST(class_name, allow_null) \
- ZEND_TYPE_ENCODE_CLASS_CONST_Q1(allow_null, class_name)
+#define ZEND_TYPE_INIT_CE(_ce, allow_null, extra_flags) \
+ ZEND_TYPE_INIT_PTR(_ce, _ZEND_TYPE_CE_BIT, allow_null, extra_flags)
+
+#define ZEND_TYPE_INIT_CLASS(class_name, allow_null, extra_flags) \
+ ZEND_TYPE_INIT_PTR(class_name, _ZEND_TYPE_NAME_BIT, allow_null, extra_flags)
+
+#define ZEND_TYPE_INIT_CLASS_CONST(class_name, allow_null, extra_flags) \
+ ZEND_TYPE_INIT_PTR(class_name, _ZEND_TYPE_NAME_BIT, allow_null, extra_flags)
+
+#define ZEND_TYPE_INIT_CLASS_CONST_MASK(class_name, type_mask) \
+ ZEND_TYPE_INIT_PTR_MASK(class_name, _ZEND_TYPE_NAME_BIT | (type_mask))
typedef union _zend_value {
zend_long lval; /* long value */
@@ -408,7 +514,7 @@ struct _zend_ast_ref {
/*zend_ast ast; zend_ast follows the zend_ast_ref structure */
};
-/* regular data types */
+/* Regular data types: Must be in sync with zend_variables.c. */
#define IS_UNDEF 0
#define IS_NULL 1
#define IS_FALSE 2
@@ -420,22 +526,23 @@ struct _zend_ast_ref {
#define IS_OBJECT 8
#define IS_RESOURCE 9
#define IS_REFERENCE 10
+#define IS_CONSTANT_AST 11 /* Constant expressions */
-/* constant expressions */
-#define IS_CONSTANT_AST 11
+/* Fake types used only for type hinting.
+ * These are allowed to overlap with the types below. */
+#define IS_CALLABLE 12
+#define IS_ITERABLE 13
+#define IS_VOID 14
/* internal types */
-#define IS_INDIRECT 13
-#define IS_PTR 14
-#define IS_ALIAS_PTR 15
+#define IS_INDIRECT 12
+#define IS_PTR 13
+#define IS_ALIAS_PTR 14
#define _IS_ERROR 15
-/* fake types used only for type hinting (Z_TYPE(zv) can not use them) */
+/* used for casts */
#define _IS_BOOL 16
-#define IS_CALLABLE 17
-#define IS_ITERABLE 18
-#define IS_VOID 19
-#define _IS_NUMBER 20
+#define _IS_NUMBER 17
static zend_always_inline zend_uchar zval_get_type(const zval* pz) {
return pz->u1.v.type;
@@ -545,7 +652,7 @@ static zend_always_inline uint32_t zval_gc_info(uint32_t gc_type_info) {
/* zval_gc_flags(zval.value->gc.u.type_info) (common flags) */
#define GC_COLLECTABLE (1<<4)
#define GC_PROTECTED (1<<5) /* used for recursion detection */
-#define GC_IMMUTABLE (1<<6) /* can't be canged in place */
+#define GC_IMMUTABLE (1<<6) /* can't be changed in place */
#define GC_PERSISTENT (1<<7) /* allocated using malloc */
#define GC_PERSISTENT_LOCAL (1<<8) /* persistent, but thread-local */
@@ -713,7 +820,7 @@ static zend_always_inline uint32_t zval_gc_info(uint32_t gc_type_info) {
#define Z_OBJCE(zval) (Z_OBJ(zval)->ce)
#define Z_OBJCE_P(zval_p) Z_OBJCE(*(zval_p))
-#define Z_OBJPROP(zval) Z_OBJ_HT((zval))->get_properties(&(zval))
+#define Z_OBJPROP(zval) Z_OBJ_HT((zval))->get_properties(Z_OBJ(zval))
#define Z_OBJPROP_P(zval_p) Z_OBJPROP(*(zval_p))
#define Z_RES(zval) (zval).value.res
@@ -775,17 +882,17 @@ static zend_always_inline uint32_t zval_gc_info(uint32_t gc_type_info) {
(b) ? IS_TRUE : IS_FALSE; \
} while (0)
-#define ZVAL_LONG(z, l) { \
+#define ZVAL_LONG(z, l) do { \
zval *__z = (z); \
Z_LVAL_P(__z) = l; \
Z_TYPE_INFO_P(__z) = IS_LONG; \
- }
+ } while (0)
-#define ZVAL_DOUBLE(z, d) { \
+#define ZVAL_DOUBLE(z, d) do { \
zval *__z = (z); \
Z_DVAL_P(__z) = d; \
Z_TYPE_INFO_P(__z) = IS_DOUBLE; \
- }
+ } while (0)
#define ZVAL_STR(z, s) do { \
zval *__z = (z); \
@@ -1226,12 +1333,7 @@ static zend_always_inline uint32_t zval_delref_p(zval* pz) {
#define SEPARATE_ZVAL_IF_NOT_REF(zv) do { \
zval *__zv = (zv); \
if (Z_TYPE_P(__zv) == IS_ARRAY) { \
- if (Z_REFCOUNT_P(__zv) > 1) { \
- if (Z_REFCOUNTED_P(__zv)) { \
- Z_DELREF_P(__zv); \
- } \
- ZVAL_ARR(__zv, zend_array_dup(Z_ARR_P(__zv)));\
- } \
+ SEPARATE_ARRAY(__zv); \
} \
} while (0)
@@ -1266,7 +1368,7 @@ static zend_always_inline uint32_t zval_delref_p(zval* pz) {
} \
} while (0)
-/* Properties store a flag distinguishing unset and unintialized properties
+/* Properties store a flag distinguishing unset and uninitialized properties
* (both use IS_UNDEF type) in the Z_EXTRA space. As such we also need to copy
* the Z_EXTRA space when copying property default values etc. We define separate
* macros for this purpose, so this workaround is easier to remove in the future. */
diff --git a/Zend/zend_virtual_cwd.c b/Zend/zend_virtual_cwd.c
index 177c66ed7f..2e012237b3 100644
--- a/Zend/zend_virtual_cwd.c
+++ b/Zend/zend_virtual_cwd.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/Zend/zend_virtual_cwd.h b/Zend/zend_virtual_cwd.h
index 574bee992b..84a1562c77 100644
--- a/Zend/zend_virtual_cwd.h
+++ b/Zend/zend_virtual_cwd.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index 26679777af..1ecb226042 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -47,7 +47,6 @@ ZEND_VM_HELPER(zend_add_helper, ANY, ANY, zval *op_1, zval *op_2)
ZEND_VM_HOT_NOCONSTCONST_HANDLER(1, ZEND_ADD, CONST|TMPVARCV, CONST|TMPVARCV)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2, *result;
double d1, d2;
@@ -107,7 +106,6 @@ ZEND_VM_HELPER(zend_sub_helper, ANY, ANY, zval *op_1, zval *op_2)
ZEND_VM_HOT_NOCONSTCONST_HANDLER(2, ZEND_SUB, CONST|TMPVARCV, CONST|TMPVARCV)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2, *result;
double d1, d2;
@@ -167,7 +165,6 @@ ZEND_VM_HELPER(zend_mul_helper, ANY, ANY, zval *op_1, zval *op_2)
ZEND_VM_COLD_CONSTCONST_HANDLER(3, ZEND_MUL, CONST|TMPVARCV, CONST|TMPVARCV, SPEC(COMMUTATIVE))
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2, *result;
double d1, d2;
@@ -209,7 +206,6 @@ ZEND_VM_C_LABEL(mul_double):
ZEND_VM_COLD_CONSTCONST_HANDLER(4, ZEND_DIV, CONST|TMPVAR|CV, CONST|TMPVAR|CV)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
SAVE_OPLINE();
@@ -255,7 +251,6 @@ ZEND_VM_HELPER(zend_mod_helper, ANY, ANY, zval *op_1, zval *op_2)
ZEND_VM_COLD_CONSTCONST_HANDLER(5, ZEND_MOD, CONST|TMPVARCV, CONST|TMPVARCV)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2, *result;
op1 = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
@@ -304,7 +299,6 @@ ZEND_VM_HELPER(zend_shift_left_helper, ANY, ANY, zval *op_1, zval *op_2)
ZEND_VM_COLD_CONSTCONST_HANDLER(6, ZEND_SL, CONST|TMPVARCV, CONST|TMPVARCV)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
op1 = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
@@ -347,7 +341,6 @@ ZEND_VM_HELPER(zend_shift_right_helper, ANY, ANY, zval *op_1, zval *op_2)
ZEND_VM_COLD_CONSTCONST_HANDLER(7, ZEND_SR, CONST|TMPVARCV, CONST|TMPVARCV)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
op1 = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
@@ -367,7 +360,6 @@ ZEND_VM_COLD_CONSTCONST_HANDLER(7, ZEND_SR, CONST|TMPVARCV, CONST|TMPVARCV)
ZEND_VM_COLD_CONSTCONST_HANDLER(12, ZEND_POW, CONST|TMPVAR|CV, CONST|TMPVAR|CV)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
SAVE_OPLINE();
@@ -382,7 +374,6 @@ ZEND_VM_COLD_CONSTCONST_HANDLER(12, ZEND_POW, CONST|TMPVAR|CV, CONST|TMPVAR|CV)
ZEND_VM_HANDLER(8, ZEND_CONCAT, CONST|TMPVAR|CV, CONST|TMPVAR|CV, SPEC(NO_CONST_CONST))
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
op1 = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
@@ -454,7 +445,6 @@ ZEND_VM_HANDLER(8, ZEND_CONCAT, CONST|TMPVAR|CV, CONST|TMPVAR|CV, SPEC(NO_CONST_
ZEND_VM_COLD_CONSTCONST_HANDLER(16, ZEND_IS_IDENTICAL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV, SPEC(COMMUTATIVE))
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
zend_bool result;
@@ -465,14 +455,11 @@ ZEND_VM_COLD_CONSTCONST_HANDLER(16, ZEND_IS_IDENTICAL, CONST|TMP|VAR|CV, CONST|T
FREE_OP1();
FREE_OP2();
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
ZEND_VM_COLD_CONSTCONST_HANDLER(17, ZEND_IS_NOT_IDENTICAL, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV, SPEC(COMMUTATIVE))
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
zend_bool result;
@@ -483,12 +470,11 @@ ZEND_VM_COLD_CONSTCONST_HANDLER(17, ZEND_IS_NOT_IDENTICAL, CONST|TMP|VAR|CV, CON
FREE_OP1();
FREE_OP2();
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
ZEND_VM_HELPER(zend_is_equal_helper, ANY, ANY, zval *op_1, zval *op_2)
{
+ int ret;
USE_OPLINE
SAVE_OPLINE();
@@ -498,31 +484,19 @@ ZEND_VM_HELPER(zend_is_equal_helper, ANY, ANY, zval *op_1, zval *op_2)
if (UNEXPECTED(Z_TYPE_INFO_P(op_2) == IS_UNDEF)) {
op_2 = ZVAL_UNDEFINED_OP2();
}
- compare_function(EX_VAR(opline->result.var), op_1, op_2);
+ ret = zend_compare(op_1, op_2);
if (OP1_TYPE & (IS_TMP_VAR|IS_VAR)) {
zval_ptr_dtor_nogc(op_1);
}
if (OP2_TYPE & (IS_TMP_VAR|IS_VAR)) {
zval_ptr_dtor_nogc(op_2);
}
- if (UNEXPECTED(EG(exception))) {
- HANDLE_EXCEPTION();
- }
- if (Z_LVAL_P(EX_VAR(opline->result.var)) == 0) {
- ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- } else {
- ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- }
+ ZEND_VM_SMART_BRANCH(ret == 0, 1);
}
ZEND_VM_COLD_CONSTCONST_HANDLER(18, ZEND_IS_EQUAL, CONST|TMPVAR|CV, CONST|TMPVAR|CV, SPEC(SMART_BRANCH,COMMUTATIVE))
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
double d1, d2;
@@ -535,13 +509,9 @@ ZEND_VM_COLD_CONSTCONST_HANDLER(18, ZEND_IS_EQUAL, CONST|TMPVAR|CV, CONST|TMPVAR
if (EXPECTED(Z_LVAL_P(op1) == Z_LVAL_P(op2))) {
ZEND_VM_C_LABEL(is_equal_true):
ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
ZEND_VM_C_LABEL(is_equal_false):
ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -584,6 +554,7 @@ ZEND_VM_C_LABEL(is_equal_double):
ZEND_VM_HELPER(zend_is_not_equal_helper, ANY, ANY, zval *op_1, zval *op_2)
{
+ int ret;
USE_OPLINE
SAVE_OPLINE();
@@ -593,31 +564,19 @@ ZEND_VM_HELPER(zend_is_not_equal_helper, ANY, ANY, zval *op_1, zval *op_2)
if (UNEXPECTED(Z_TYPE_INFO_P(op_2) == IS_UNDEF)) {
op_2 = ZVAL_UNDEFINED_OP2();
}
- compare_function(EX_VAR(opline->result.var), op_1, op_2);
+ ret = zend_compare(op_1, op_2);
if (OP1_TYPE & (IS_TMP_VAR|IS_VAR)) {
zval_ptr_dtor_nogc(op_1);
}
if (OP2_TYPE & (IS_TMP_VAR|IS_VAR)) {
zval_ptr_dtor_nogc(op_2);
}
- if (UNEXPECTED(EG(exception))) {
- HANDLE_EXCEPTION();
- }
- if (Z_LVAL_P(EX_VAR(opline->result.var)) != 0) {
- ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- } else {
- ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- }
+ ZEND_VM_SMART_BRANCH(ret != 0, 1);
}
ZEND_VM_COLD_CONSTCONST_HANDLER(19, ZEND_IS_NOT_EQUAL, CONST|TMPVAR|CV, CONST|TMPVAR|CV, SPEC(SMART_BRANCH,COMMUTATIVE))
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
double d1, d2;
@@ -630,13 +589,9 @@ ZEND_VM_COLD_CONSTCONST_HANDLER(19, ZEND_IS_NOT_EQUAL, CONST|TMPVAR|CV, CONST|TM
if (EXPECTED(Z_LVAL_P(op1) != Z_LVAL_P(op2))) {
ZEND_VM_C_LABEL(is_not_equal_true):
ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
ZEND_VM_C_LABEL(is_not_equal_false):
ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -679,6 +634,7 @@ ZEND_VM_C_LABEL(is_not_equal_double):
ZEND_VM_HELPER(zend_is_smaller_helper, ANY, ANY, zval *op_1, zval *op_2)
{
+ int ret;
USE_OPLINE
SAVE_OPLINE();
@@ -688,31 +644,19 @@ ZEND_VM_HELPER(zend_is_smaller_helper, ANY, ANY, zval *op_1, zval *op_2)
if (UNEXPECTED(Z_TYPE_INFO_P(op_2) == IS_UNDEF)) {
op_2 = ZVAL_UNDEFINED_OP2();
}
- compare_function(EX_VAR(opline->result.var), op_1, op_2);
+ ret = zend_compare(op_1, op_2);
if (OP1_TYPE & (IS_TMP_VAR|IS_VAR)) {
zval_ptr_dtor_nogc(op_1);
}
if (OP2_TYPE & (IS_TMP_VAR|IS_VAR)) {
zval_ptr_dtor_nogc(op_2);
}
- if (UNEXPECTED(EG(exception))) {
- HANDLE_EXCEPTION();
- }
- if (Z_LVAL_P(EX_VAR(opline->result.var)) < 0) {
- ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- } else {
- ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- }
+ ZEND_VM_SMART_BRANCH(ret < 0, 1);
}
ZEND_VM_HOT_NOCONSTCONST_HANDLER(20, ZEND_IS_SMALLER, CONST|TMPVARCV, CONST|TMPVARCV, SPEC(SMART_BRANCH))
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
double d1, d2;
@@ -725,13 +669,9 @@ ZEND_VM_HOT_NOCONSTCONST_HANDLER(20, ZEND_IS_SMALLER, CONST|TMPVARCV, CONST|TMPV
if (EXPECTED(Z_LVAL_P(op1) < Z_LVAL_P(op2))) {
ZEND_VM_C_LABEL(is_smaller_true):
ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
ZEND_VM_C_LABEL(is_smaller_false):
ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -759,6 +699,7 @@ ZEND_VM_C_LABEL(is_smaller_double):
ZEND_VM_HELPER(zend_is_smaller_or_equal_helper, ANY, ANY, zval *op_1, zval *op_2)
{
+ int ret;
USE_OPLINE
SAVE_OPLINE();
@@ -768,31 +709,19 @@ ZEND_VM_HELPER(zend_is_smaller_or_equal_helper, ANY, ANY, zval *op_1, zval *op_2
if (UNEXPECTED(Z_TYPE_INFO_P(op_2) == IS_UNDEF)) {
op_2 = ZVAL_UNDEFINED_OP2();
}
- compare_function(EX_VAR(opline->result.var), op_1, op_2);
+ ret = zend_compare(op_1, op_2);
if (OP1_TYPE & (IS_TMP_VAR|IS_VAR)) {
zval_ptr_dtor_nogc(op_1);
}
if (OP2_TYPE & (IS_TMP_VAR|IS_VAR)) {
zval_ptr_dtor_nogc(op_2);
}
- if (UNEXPECTED(EG(exception))) {
- HANDLE_EXCEPTION();
- }
- if (Z_LVAL_P(EX_VAR(opline->result.var)) <= 0) {
- ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- } else {
- ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- }
+ ZEND_VM_SMART_BRANCH(ret <= 0, 1);
}
ZEND_VM_HOT_NOCONSTCONST_HANDLER(21, ZEND_IS_SMALLER_OR_EQUAL, CONST|TMPVARCV, CONST|TMPVARCV, SPEC(SMART_BRANCH))
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
double d1, d2;
@@ -840,7 +769,6 @@ ZEND_VM_C_LABEL(is_smaller_or_equal_double):
ZEND_VM_COLD_CONSTCONST_HANDLER(170, ZEND_SPACESHIP, CONST|TMPVAR|CV, CONST|TMPVAR|CV)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
SAVE_OPLINE();
@@ -873,10 +801,9 @@ ZEND_VM_HELPER(zend_bw_or_helper, ANY, ANY, zval *op_1, zval *op_2)
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
-ZEND_VM_COLD_CONSTCONST_HANDLER(9, ZEND_BW_OR, CONST|TMPVARCV, CONST|TMPVARCV, SPEC(COMMUTATIVE))
+ZEND_VM_HOT_NOCONSTCONST_HANDLER(9, ZEND_BW_OR, CONST|TMPVARCV, CONST|TMPVARCV, SPEC(COMMUTATIVE))
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
op1 = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
@@ -913,10 +840,9 @@ ZEND_VM_HELPER(zend_bw_and_helper, ANY, ANY, zval *op_1, zval *op_2)
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
-ZEND_VM_COLD_CONSTCONST_HANDLER(10, ZEND_BW_AND, CONST|TMPVARCV, CONST|TMPVARCV, SPEC(COMMUTATIVE))
+ZEND_VM_HOT_NOCONSTCONST_HANDLER(10, ZEND_BW_AND, CONST|TMPVARCV, CONST|TMPVARCV, SPEC(COMMUTATIVE))
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
op1 = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
@@ -953,10 +879,9 @@ ZEND_VM_HELPER(zend_bw_xor_helper, ANY, ANY, zval *op_1, zval *op_2)
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
-ZEND_VM_COLD_CONSTCONST_HANDLER(11, ZEND_BW_XOR, CONST|TMPVARCV, CONST|TMPVARCV, SPEC(COMMUTATIVE))
+ZEND_VM_HOT_NOCONSTCONST_HANDLER(11, ZEND_BW_XOR, CONST|TMPVARCV, CONST|TMPVARCV, SPEC(COMMUTATIVE))
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
op1 = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
@@ -975,7 +900,6 @@ ZEND_VM_COLD_CONSTCONST_HANDLER(11, ZEND_BW_XOR, CONST|TMPVARCV, CONST|TMPVARCV,
ZEND_VM_COLD_CONSTCONST_HANDLER(15, ZEND_BOOL_XOR, CONST|TMPVAR|CV, CONST|TMPVAR|CV, SPEC(COMMUTATIVE))
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
SAVE_OPLINE();
@@ -987,10 +911,22 @@ ZEND_VM_COLD_CONSTCONST_HANDLER(15, ZEND_BOOL_XOR, CONST|TMPVAR|CV, CONST|TMPVAR
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
-ZEND_VM_COLD_CONST_HANDLER(13, ZEND_BW_NOT, CONST|TMPVAR|CV, ANY)
+ZEND_VM_HELPER(zend_bw_not_helper, ANY, ANY, zval *op_1)
+{
+ USE_OPLINE
+
+ SAVE_OPLINE();
+ if (UNEXPECTED(Z_TYPE_P(op_1) == IS_UNDEF)) {
+ op_1 = ZVAL_UNDEFINED_OP1();
+ }
+ bitwise_not_function(EX_VAR(opline->result.var), op_1);
+ FREE_OP1();
+ ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
+}
+
+ZEND_VM_HOT_NOCONST_HANDLER(13, ZEND_BW_NOT, CONST|TMPVARCV, ANY)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1;
op1 = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
@@ -999,20 +935,13 @@ ZEND_VM_COLD_CONST_HANDLER(13, ZEND_BW_NOT, CONST|TMPVAR|CV, ANY)
ZEND_VM_NEXT_OPCODE();
}
- SAVE_OPLINE();
- if (OP1_TYPE == IS_CV && UNEXPECTED(Z_TYPE_P(op1) == IS_UNDEF)) {
- op1 = ZVAL_UNDEFINED_OP1();
- }
- bitwise_not_function(EX_VAR(opline->result.var), op1);
- FREE_OP1();
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
+ ZEND_VM_DISPATCH_TO_HELPER(zend_bw_not_helper, op_1, op1);
}
ZEND_VM_COLD_CONST_HANDLER(14, ZEND_BOOL_NOT, CONST|TMPVAR|CV, ANY)
{
USE_OPLINE
zval *val;
- zend_free_op free_op1;
val = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
if (Z_TYPE_INFO_P(val) == IS_TRUE) {
@@ -1063,21 +992,17 @@ ZEND_VM_COLD_HELPER(zend_undefined_function_helper, ANY, ANY)
ZEND_VM_HANDLER(28, ZEND_ASSIGN_OBJ_OP, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, OP)
{
USE_OPLINE
- zend_free_op free_op1, free_op2, free_op_data;
zval *object;
zval *property;
zval *value;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = GET_OP1_OBJ_ZVAL_PTR_PTR_UNDEF(BP_VAR_RW);
-
- if (OP1_TYPE == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_DISPATCH_TO_HELPER(zend_this_not_in_object_context_helper);
- }
-
property = GET_OP2_ZVAL_PTR(BP_VAR_R);
do {
@@ -1092,16 +1017,24 @@ ZEND_VM_HANDLER(28, ZEND_ASSIGN_OBJ_OP, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, OP)
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
ZEND_VM_C_LABEL(assign_op_object):
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if (OP2_TYPE == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ UNDEF_RESULT();
+ break;
+ }
+ }
cache_slot = (OP2_TYPE == IS_CONST) ? CACHE_ADDR((opline+1)->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -1138,7 +1071,10 @@ ZEND_VM_C_LABEL(assign_op_object):
}
}
} else {
- zend_assign_op_overloaded_property(object, property, cache_slot, value OPLINE_CC EXECUTE_DATA_CC);
+ zend_assign_op_overloaded_property(zobj, name, cache_slot, value OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if (OP2_TYPE != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
@@ -1155,7 +1091,6 @@ ZEND_VM_HANDLER(29, ZEND_ASSIGN_STATIC_PROP_OP, ANY, ANY, OP)
/* This helper actually never will receive IS_VAR as second op, and has the same handling for VAR and TMP in the first op, but for interoperability with the other binary_assign_op helpers, it is necessary to "include" it */
USE_OPLINE
- zend_free_op free_op_data;
zval *prop, *value;
zend_property_info *prop_info;
zend_reference *ref;
@@ -1181,7 +1116,7 @@ ZEND_VM_HANDLER(29, ZEND_ASSIGN_STATIC_PROP_OP, ANY, ANY, OP)
}
}
- if (UNEXPECTED(prop_info->type)) {
+ if (UNEXPECTED(ZEND_TYPE_IS_SET(prop_info->type))) {
/* special case for typed properties */
zend_binary_assign_op_typed_prop(prop_info, prop, value OPLINE_CC EXECUTE_DATA_CC);
} else {
@@ -1201,7 +1136,6 @@ ZEND_VM_HANDLER(29, ZEND_ASSIGN_STATIC_PROP_OP, ANY, ANY, OP)
ZEND_VM_HANDLER(27, ZEND_ASSIGN_DIM_OP, VAR|CV, CONST|TMPVAR|UNUSED|NEXT|CV, OP)
{
USE_OPLINE
- zend_free_op free_op1, free_op2, free_op_data1;
zval *var_ptr;
zval *value, *container, *dim;
@@ -1230,7 +1164,7 @@ ZEND_VM_C_LABEL(assign_dim_op_new_array):
}
}
- value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data1);
+ value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1);
do {
if (OP2_TYPE != IS_UNUSED && UNEXPECTED(Z_ISREF_P(var_ptr))) {
@@ -1247,7 +1181,7 @@ ZEND_VM_C_LABEL(assign_dim_op_new_array):
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
- FREE_OP(free_op_data1);
+ FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
} else {
if (EXPECTED(Z_ISREF_P(container))) {
container = Z_REFVAL_P(container);
@@ -1286,7 +1220,6 @@ ZEND_VM_C_LABEL(assign_dim_op_ret_null):
ZEND_VM_HANDLER(26, ZEND_ASSIGN_OP, VAR|CV, CONST|TMPVAR|CV, OP)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *var_ptr;
zval *value;
@@ -1294,26 +1227,20 @@ ZEND_VM_HANDLER(26, ZEND_ASSIGN_OP, VAR|CV, CONST|TMPVAR|CV, OP)
value = GET_OP2_ZVAL_PTR(BP_VAR_R);
var_ptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_RW);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_ISERROR_P(var_ptr))) {
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- do {
- if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_REFERENCE)) {
- zend_reference *ref = Z_REF_P(var_ptr);
- var_ptr = Z_REFVAL_P(var_ptr);
- if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
- zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
- break;
- }
+ do {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_REFERENCE)) {
+ zend_reference *ref = Z_REF_P(var_ptr);
+ var_ptr = Z_REFVAL_P(var_ptr);
+ if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
+ zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
- zend_binary_op(var_ptr, var_ptr, value OPLINE_CC);
- } while (0);
-
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
+ zend_binary_op(var_ptr, var_ptr, value OPLINE_CC);
+ } while (0);
+
+ if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
+ ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
FREE_OP2();
@@ -1324,20 +1251,16 @@ ZEND_VM_HANDLER(26, ZEND_ASSIGN_OP, VAR|CV, CONST|TMPVAR|CV, OP)
ZEND_VM_HANDLER(132, ZEND_PRE_INC_OBJ, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CACHE_SLOT)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *object;
zval *property;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = GET_OP1_OBJ_ZVAL_PTR_PTR_UNDEF(BP_VAR_RW);
-
- if (OP1_TYPE == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_DISPATCH_TO_HELPER(zend_this_not_in_object_context_helper);
- }
-
property = GET_OP2_ZVAL_PTR(BP_VAR_R);
do {
@@ -1350,16 +1273,24 @@ ZEND_VM_HANDLER(132, ZEND_PRE_INC_OBJ, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CACH
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
ZEND_VM_C_LABEL(pre_incdec_object):
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if (OP2_TYPE == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ UNDEF_RESULT();
+ break;
+ }
+ }
cache_slot = (OP2_TYPE == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -1373,7 +1304,10 @@ ZEND_VM_C_LABEL(pre_incdec_object):
zend_pre_incdec_property_zval(zptr, prop_info OPLINE_CC EXECUTE_DATA_CC);
}
} else {
- zend_pre_incdec_overloaded_property(object, property, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ zend_pre_incdec_overloaded_property(zobj, name, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if (OP2_TYPE != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
@@ -1390,20 +1324,16 @@ ZEND_VM_HANDLER(133, ZEND_PRE_DEC_OBJ, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CACH
ZEND_VM_HANDLER(134, ZEND_POST_INC_OBJ, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CACHE_SLOT)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *object;
zval *property;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = GET_OP1_OBJ_ZVAL_PTR_PTR_UNDEF(BP_VAR_RW);
-
- if (OP1_TYPE == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_DISPATCH_TO_HELPER(zend_this_not_in_object_context_helper);
- }
-
property = GET_OP2_ZVAL_PTR(BP_VAR_R);
do {
@@ -1416,16 +1346,24 @@ ZEND_VM_HANDLER(134, ZEND_POST_INC_OBJ, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CAC
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
ZEND_VM_C_LABEL(post_incdec_object):
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if (OP2_TYPE == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
+ }
cache_slot = (OP2_TYPE == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
ZVAL_NULL(EX_VAR(opline->result.var));
} else {
@@ -1438,7 +1376,10 @@ ZEND_VM_C_LABEL(post_incdec_object):
zend_post_incdec_property_zval(zptr, prop_info OPLINE_CC EXECUTE_DATA_CC);
}
} else {
- zend_post_incdec_overloaded_property(object, property, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ zend_post_incdec_overloaded_property(zobj, name, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if (OP2_TYPE != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
@@ -1466,7 +1407,8 @@ ZEND_VM_HANDLER(38, ZEND_PRE_INC_STATIC_PROP, ANY, ANY, CACHE_SLOT)
HANDLE_EXCEPTION();
}
- zend_pre_incdec_property_zval(prop, prop_info->type ? prop_info : NULL OPLINE_CC EXECUTE_DATA_CC);
+ zend_pre_incdec_property_zval(prop,
+ ZEND_TYPE_IS_SET(prop_info->type) ? prop_info : NULL OPLINE_CC EXECUTE_DATA_CC);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -1491,7 +1433,8 @@ ZEND_VM_HANDLER(40, ZEND_POST_INC_STATIC_PROP, ANY, ANY, CACHE_SLOT)
HANDLE_EXCEPTION();
}
- zend_post_incdec_property_zval(prop, prop_info->type ? prop_info : NULL OPLINE_CC EXECUTE_DATA_CC);
+ zend_post_incdec_property_zval(prop,
+ ZEND_TYPE_IS_SET(prop_info->type) ? prop_info : NULL OPLINE_CC EXECUTE_DATA_CC);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -1505,18 +1448,10 @@ ZEND_VM_HANDLER(41, ZEND_POST_DEC_STATIC_PROP, ANY, ANY, CACHE_SLOT)
ZEND_VM_HELPER(zend_pre_inc_helper, VAR|CV, ANY)
{
USE_OPLINE
- zend_free_op free_op1;
zval *var_ptr;
var_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF(BP_VAR_RW);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_ISERROR_P(var_ptr))) {
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- ZEND_VM_NEXT_OPCODE();
- }
-
SAVE_OPLINE();
if (OP1_TYPE == IS_CV && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_UNDEF)) {
ZVAL_NULL(var_ptr);
@@ -1546,7 +1481,6 @@ ZEND_VM_HELPER(zend_pre_inc_helper, VAR|CV, ANY)
ZEND_VM_HOT_HANDLER(34, ZEND_PRE_INC, VAR|CV, ANY, SPEC(RETVAL))
{
USE_OPLINE
- zend_free_op free_op1;
zval *var_ptr;
var_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF(BP_VAR_RW);
@@ -1565,18 +1499,10 @@ ZEND_VM_HOT_HANDLER(34, ZEND_PRE_INC, VAR|CV, ANY, SPEC(RETVAL))
ZEND_VM_HELPER(zend_pre_dec_helper, VAR|CV, ANY)
{
USE_OPLINE
- zend_free_op free_op1;
zval *var_ptr;
var_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF(BP_VAR_RW);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_ISERROR_P(var_ptr))) {
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- ZEND_VM_NEXT_OPCODE();
- }
-
SAVE_OPLINE();
if (OP1_TYPE == IS_CV && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_UNDEF)) {
ZVAL_NULL(var_ptr);
@@ -1607,7 +1533,6 @@ ZEND_VM_HELPER(zend_pre_dec_helper, VAR|CV, ANY)
ZEND_VM_HOT_HANDLER(35, ZEND_PRE_DEC, VAR|CV, ANY, SPEC(RETVAL))
{
USE_OPLINE
- zend_free_op free_op1;
zval *var_ptr;
var_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF(BP_VAR_RW);
@@ -1626,16 +1551,10 @@ ZEND_VM_HOT_HANDLER(35, ZEND_PRE_DEC, VAR|CV, ANY, SPEC(RETVAL))
ZEND_VM_HELPER(zend_post_inc_helper, VAR|CV, ANY)
{
USE_OPLINE
- zend_free_op free_op1;
zval *var_ptr;
var_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF(BP_VAR_RW);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_ISERROR_P(var_ptr))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- }
-
SAVE_OPLINE();
if (OP1_TYPE == IS_CV && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_UNDEF)) {
ZVAL_NULL(var_ptr);
@@ -1664,7 +1583,6 @@ ZEND_VM_HELPER(zend_post_inc_helper, VAR|CV, ANY)
ZEND_VM_HOT_HANDLER(36, ZEND_POST_INC, VAR|CV, ANY)
{
USE_OPLINE
- zend_free_op free_op1;
zval *var_ptr;
var_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF(BP_VAR_RW);
@@ -1681,16 +1599,10 @@ ZEND_VM_HOT_HANDLER(36, ZEND_POST_INC, VAR|CV, ANY)
ZEND_VM_HELPER(zend_post_dec_helper, VAR|CV, ANY)
{
USE_OPLINE
- zend_free_op free_op1;
zval *var_ptr;
var_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF(BP_VAR_RW);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_ISERROR_P(var_ptr))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- }
-
SAVE_OPLINE();
if (OP1_TYPE == IS_CV && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_UNDEF)) {
ZVAL_NULL(var_ptr);
@@ -1719,7 +1631,6 @@ ZEND_VM_HELPER(zend_post_dec_helper, VAR|CV, ANY)
ZEND_VM_HOT_HANDLER(37, ZEND_POST_DEC, VAR|CV, ANY)
{
USE_OPLINE
- zend_free_op free_op1;
zval *var_ptr;
var_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF(BP_VAR_RW);
@@ -1736,7 +1647,6 @@ ZEND_VM_HOT_HANDLER(37, ZEND_POST_DEC, VAR|CV, ANY)
ZEND_VM_HANDLER(136, ZEND_ECHO, CONST|TMPVAR|CV, ANY)
{
USE_OPLINE
- zend_free_op free_op1;
zval *z;
SAVE_OPLINE();
@@ -1766,7 +1676,6 @@ ZEND_VM_HANDLER(136, ZEND_ECHO, CONST|TMPVAR|CV, ANY)
ZEND_VM_HELPER(zend_fetch_var_address_helper, CONST|TMPVAR|CV, UNUSED, int type)
{
USE_OPLINE
- zend_free_op free_op1;
zval *varname;
zval *retval;
zend_string *name, *tmp_name;
@@ -1808,7 +1717,7 @@ ZEND_VM_C_LABEL(fetch_this):
} else if (type == BP_VAR_IS) {
retval = &EG(uninitialized_zval);
} else {
- zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name));
+ zend_error(E_WARNING, "Undefined variable: %s", ZSTR_VAL(name));
if (type == BP_VAR_RW) {
retval = zend_hash_update(target_symbol_table, name, &EG(uninitialized_zval));
} else {
@@ -1827,7 +1736,7 @@ ZEND_VM_C_LABEL(fetch_this):
} else if (type == BP_VAR_IS) {
retval = &EG(uninitialized_zval);
} else {
- zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name));
+ zend_error(E_WARNING, "Undefined variable: %s", ZSTR_VAL(name));
if (type == BP_VAR_RW) {
ZVAL_NULL(retval);
} else {
@@ -1915,7 +1824,7 @@ ZEND_VM_HANDLER(173, ZEND_FETCH_STATIC_PROP_R, ANY, CLASS_FETCH, CACHE_SLOT)
}
/* No specialization for op_types (CONST|TMPVAR|CV, UNUSED|CLASS_FETCH|CONST|VAR) */
-ZEND_VM_HANDLER(174, ZEND_FETCH_STATIC_PROP_W, ANY, CLASS_FETCH, FETCH_REF|DIM_OBJ_WRITE|CACHE_SLOT)
+ZEND_VM_HANDLER(174, ZEND_FETCH_STATIC_PROP_W, ANY, CLASS_FETCH, FETCH_REF|DIM_WRITE|CACHE_SLOT)
{
ZEND_VM_DISPATCH_TO_HELPER(zend_fetch_static_prop_helper, type, BP_VAR_W);
}
@@ -1950,7 +1859,6 @@ ZEND_VM_HANDLER(176, ZEND_FETCH_STATIC_PROP_IS, ANY, CLASS_FETCH, CACHE_SLOT)
ZEND_VM_COLD_CONSTCONST_HANDLER(81, ZEND_FETCH_DIM_R, CONST|TMPVAR|CV, CONST|TMPVAR|CV)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container, *dim, *value;
SAVE_OPLINE();
@@ -1986,7 +1894,6 @@ ZEND_VM_C_LABEL(fetch_dim_r_slow):
ZEND_VM_HANDLER(84, ZEND_FETCH_DIM_W, VAR|CV, CONST|TMPVAR|UNUSED|NEXT|CV)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container;
SAVE_OPLINE();
@@ -1994,8 +1901,7 @@ ZEND_VM_HANDLER(84, ZEND_FETCH_DIM_W, VAR|CV, CONST|TMPVAR|UNUSED|NEXT|CV)
zend_fetch_dimension_address_W(container, GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R), OP2_TYPE OPLINE_CC EXECUTE_DATA_CC);
FREE_OP2();
if (OP1_TYPE == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -2003,7 +1909,6 @@ ZEND_VM_HANDLER(84, ZEND_FETCH_DIM_W, VAR|CV, CONST|TMPVAR|UNUSED|NEXT|CV)
ZEND_VM_HANDLER(87, ZEND_FETCH_DIM_RW, VAR|CV, CONST|TMPVAR|UNUSED|NEXT|CV)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container;
SAVE_OPLINE();
@@ -2011,8 +1916,7 @@ ZEND_VM_HANDLER(87, ZEND_FETCH_DIM_RW, VAR|CV, CONST|TMPVAR|UNUSED|NEXT|CV)
zend_fetch_dimension_address_RW(container, GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R), OP2_TYPE OPLINE_CC EXECUTE_DATA_CC);
FREE_OP2();
if (OP1_TYPE == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -2020,7 +1924,6 @@ ZEND_VM_HANDLER(87, ZEND_FETCH_DIM_RW, VAR|CV, CONST|TMPVAR|UNUSED|NEXT|CV)
ZEND_VM_COLD_CONSTCONST_HANDLER(90, ZEND_FETCH_DIM_IS, CONST|TMPVAR|CV, CONST|TMPVAR|CV)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container;
SAVE_OPLINE();
@@ -2077,7 +1980,6 @@ ZEND_VM_COLD_CONSTCONST_HANDLER(93, ZEND_FETCH_DIM_FUNC_ARG, CONST|TMP|VAR|CV, C
ZEND_VM_HANDLER(96, ZEND_FETCH_DIM_UNSET, VAR|CV, CONST|TMPVAR|CV)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container;
SAVE_OPLINE();
@@ -2085,8 +1987,7 @@ ZEND_VM_HANDLER(96, ZEND_FETCH_DIM_UNSET, VAR|CV, CONST|TMPVAR|CV)
zend_fetch_dimension_address_UNSET(container, GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R), OP2_TYPE OPLINE_CC EXECUTE_DATA_CC);
FREE_OP2();
if (OP1_TYPE == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -2094,19 +1995,12 @@ ZEND_VM_HANDLER(96, ZEND_FETCH_DIM_UNSET, VAR|CV, CONST|TMPVAR|CV)
ZEND_VM_HOT_OBJ_HANDLER(82, ZEND_FETCH_OBJ_R, CONST|TMPVAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CACHE_SLOT)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
- zend_free_op free_op2;
zval *offset;
void **cache_slot = NULL;
SAVE_OPLINE();
container = GET_OP1_OBJ_ZVAL_PTR_UNDEF(BP_VAR_R);
-
- if (OP1_TYPE == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_DISPATCH_TO_HELPER(zend_this_not_in_object_context_helper);
- }
-
offset = GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R);
if (OP1_TYPE == IS_CONST ||
@@ -2133,9 +2027,11 @@ ZEND_VM_HOT_OBJ_HANDLER(82, ZEND_FETCH_OBJ_R, CONST|TMPVAR|UNUSED|THIS|CV, CONST
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if (OP2_TYPE == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value & ~ZEND_FETCH_REF /* FUNC_ARG fetch may contain it */);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -2160,10 +2056,10 @@ ZEND_VM_C_LABEL(fetch_obj_r_fast_copy):
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (!ZEND_VM_SPEC || (OP1_TYPE & (IS_TMP_VAR|IS_VAR)) != 0) {
ZEND_VM_C_GOTO(fetch_obj_r_copy);
@@ -2174,7 +2070,7 @@ ZEND_VM_C_LABEL(fetch_obj_r_fast_copy):
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -2186,11 +2082,22 @@ ZEND_VM_C_LABEL(fetch_obj_r_fast_copy):
}
}
}
- } else if (OP2_TYPE == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
- ZVAL_UNDEFINED_OP2();
+ } else {
+ if (OP2_TYPE == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
+ ZVAL_UNDEFINED_OP2();
+ }
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+
+ if (OP2_TYPE != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
ZEND_VM_C_LABEL(fetch_obj_r_copy):
@@ -2206,19 +2113,14 @@ ZEND_VM_C_LABEL(fetch_obj_r_finish):
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
-ZEND_VM_HANDLER(85, ZEND_FETCH_OBJ_W, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, FETCH_REF|DIM_OBJ_WRITE|CACHE_SLOT)
+ZEND_VM_HANDLER(85, ZEND_FETCH_OBJ_W, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, FETCH_REF|DIM_WRITE|CACHE_SLOT)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *property, *container, *result;
SAVE_OPLINE();
container = GET_OP1_OBJ_ZVAL_PTR_PTR_UNDEF(BP_VAR_W);
- if (OP1_TYPE == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_DISPATCH_TO_HELPER(zend_this_not_in_object_context_helper);
- }
-
property = GET_OP2_ZVAL_PTR(BP_VAR_R);
result = EX_VAR(opline->result.var);
zend_fetch_property_address(
@@ -2227,7 +2129,7 @@ ZEND_VM_HANDLER(85, ZEND_FETCH_OBJ_W, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, FETCH
BP_VAR_W, opline->extended_value & ZEND_FETCH_OBJ_FLAGS, 1 OPLINE_CC EXECUTE_DATA_CC);
FREE_OP2();
if (OP1_TYPE == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -2235,21 +2137,16 @@ ZEND_VM_HANDLER(85, ZEND_FETCH_OBJ_W, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, FETCH
ZEND_VM_HANDLER(88, ZEND_FETCH_OBJ_RW, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CACHE_SLOT)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *property, *container, *result;
SAVE_OPLINE();
container = GET_OP1_OBJ_ZVAL_PTR_PTR_UNDEF(BP_VAR_RW);
-
- if (OP1_TYPE == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_DISPATCH_TO_HELPER(zend_this_not_in_object_context_helper);
- }
property = GET_OP2_ZVAL_PTR(BP_VAR_R);
result = EX_VAR(opline->result.var);
zend_fetch_property_address(result, container, OP1_TYPE, property, OP2_TYPE, ((OP2_TYPE == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL), BP_VAR_RW, 0, 1 OPLINE_CC EXECUTE_DATA_CC);
FREE_OP2();
if (OP1_TYPE == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -2257,19 +2154,12 @@ ZEND_VM_HANDLER(88, ZEND_FETCH_OBJ_RW, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CACH
ZEND_VM_COLD_CONST_HANDLER(91, ZEND_FETCH_OBJ_IS, CONST|TMPVAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CACHE_SLOT)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
- zend_free_op free_op2;
zval *offset;
void **cache_slot = NULL;
SAVE_OPLINE();
container = GET_OP1_OBJ_ZVAL_PTR(BP_VAR_IS);
-
- if (OP1_TYPE == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_DISPATCH_TO_HELPER(zend_this_not_in_object_context_helper);
- }
-
offset = GET_OP2_ZVAL_PTR(BP_VAR_R);
if (OP1_TYPE == IS_CONST ||
@@ -2289,9 +2179,11 @@ ZEND_VM_COLD_CONST_HANDLER(91, ZEND_FETCH_OBJ_IS, CONST|TMPVAR|UNUSED|THIS|CV, C
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if (OP2_TYPE == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -2316,10 +2208,10 @@ ZEND_VM_C_LABEL(fetch_obj_is_fast_copy):
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (!ZEND_VM_SPEC || (OP1_TYPE & (IS_TMP_VAR|IS_VAR)) != 0) {
ZEND_VM_C_GOTO(fetch_obj_is_copy);
@@ -2330,7 +2222,7 @@ ZEND_VM_C_LABEL(fetch_obj_is_fast_copy):
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -2342,9 +2234,19 @@ ZEND_VM_C_LABEL(fetch_obj_is_fast_copy):
}
}
}
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+
+ if (OP2_TYPE != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
ZEND_VM_C_LABEL(fetch_obj_is_copy):
@@ -2380,22 +2282,16 @@ ZEND_VM_COLD_CONST_HANDLER(94, ZEND_FETCH_OBJ_FUNC_ARG, CONST|TMP|VAR|UNUSED|THI
ZEND_VM_HANDLER(97, ZEND_FETCH_OBJ_UNSET, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CACHE_SLOT)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container, *property, *result;
SAVE_OPLINE();
container = GET_OP1_OBJ_ZVAL_PTR_PTR_UNDEF(BP_VAR_UNSET);
-
- if (OP1_TYPE == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_DISPATCH_TO_HELPER(zend_this_not_in_object_context_helper);
- }
-
property = GET_OP2_ZVAL_PTR(BP_VAR_R);
result = EX_VAR(opline->result.var);
zend_fetch_property_address(result, container, OP1_TYPE, property, OP2_TYPE, ((OP2_TYPE == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL), BP_VAR_UNSET, 0, 1 OPLINE_CC EXECUTE_DATA_CC);
FREE_OP2();
if (OP1_TYPE == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -2403,7 +2299,6 @@ ZEND_VM_HANDLER(97, ZEND_FETCH_OBJ_UNSET, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, C
ZEND_VM_HANDLER(98, ZEND_FETCH_LIST_R, CONST|TMPVARCV, CONST|TMPVAR|CV)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container;
SAVE_OPLINE();
@@ -2416,7 +2311,6 @@ ZEND_VM_HANDLER(98, ZEND_FETCH_LIST_R, CONST|TMPVARCV, CONST|TMPVAR|CV)
ZEND_VM_HANDLER(155, ZEND_FETCH_LIST_W, VAR, CONST|TMPVAR|CV)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container, *dim;
SAVE_OPLINE();
@@ -2440,16 +2334,12 @@ ZEND_VM_HANDLER(155, ZEND_FETCH_LIST_W, VAR, CONST|TMPVAR|CV)
ZEND_VM_HANDLER(24, ZEND_ASSIGN_OBJ, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CACHE_SLOT, SPEC(OP_DATA=CONST|TMP|VAR|CV))
{
USE_OPLINE
- zend_free_op free_op1, free_op2, free_op_data;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = GET_OP1_OBJ_ZVAL_PTR_PTR_UNDEF(BP_VAR_W);
-
- if (OP1_TYPE == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_DISPATCH_TO_HELPER(zend_this_not_in_object_context_helper);
- }
-
property = GET_OP2_ZVAL_PTR(BP_VAR_R);
value = GET_OP_DATA_ZVAL_PTR(BP_VAR_R);
@@ -2458,16 +2348,15 @@ ZEND_VM_HANDLER(24, ZEND_ASSIGN_OBJ, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CACHE_
object = Z_REFVAL_P(object);
ZEND_VM_C_GOTO(assign_object);
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- ZEND_VM_C_GOTO(free_and_exit_assign_obj);
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ ZEND_VM_C_GOTO(free_and_exit_assign_obj);
}
ZEND_VM_C_LABEL(assign_object):
+ zobj = Z_OBJ_P(object);
if (OP2_TYPE == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -2557,11 +2446,26 @@ ZEND_VM_C_LABEL(fast_assign_obj):
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (OP2_TYPE == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (OP2_TYPE == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ FREE_OP_DATA();
+ UNDEF_RESULT();
+ ZEND_VM_C_GOTO(exit_assign_obj);
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (OP2_TYPE == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (OP2_TYPE != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
ZEND_VM_C_LABEL(free_and_exit_assign_obj):
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ ZVAL_COPY_DEREF(EX_VAR(opline->result.var), value);
}
FREE_OP_DATA();
ZEND_VM_C_LABEL(exit_assign_obj):
@@ -2575,7 +2479,6 @@ ZEND_VM_C_LABEL(exit_assign_obj):
ZEND_VM_HANDLER(25, ZEND_ASSIGN_STATIC_PROP, ANY, ANY, CACHE_SLOT, SPEC(OP_DATA=CONST|TMP|VAR|CV))
{
USE_OPLINE
- zend_free_op free_op_data;
zval *prop, *value;
zend_property_info *prop_info;
@@ -2589,7 +2492,7 @@ ZEND_VM_HANDLER(25, ZEND_ASSIGN_STATIC_PROP, ANY, ANY, CACHE_SLOT, SPEC(OP_DATA=
value = GET_OP_DATA_ZVAL_PTR(BP_VAR_R);
- if (UNEXPECTED(prop_info->type)) {
+ if (UNEXPECTED(ZEND_TYPE_IS_SET(prop_info->type))) {
value = zend_assign_to_typed_prop(prop_info, prop, value EXECUTE_DATA_CC);
FREE_OP_DATA();
} else {
@@ -2607,9 +2510,7 @@ ZEND_VM_HANDLER(25, ZEND_ASSIGN_STATIC_PROP, ANY, ANY, CACHE_SLOT, SPEC(OP_DATA=
ZEND_VM_HANDLER(23, ZEND_ASSIGN_DIM, VAR|CV, CONST|TMPVAR|UNUSED|NEXT|CV, SPEC(OP_DATA=CONST|TMP|VAR|CV))
{
USE_OPLINE
- zend_free_op free_op1;
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op2, free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
@@ -2635,11 +2536,12 @@ ZEND_VM_C_LABEL(try_assign_dim_array):
Z_ADDREF_P(value);
}
} else if (OP_DATA_TYPE == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
}
- FREE_OP_DATA();
+ zval_ptr_dtor_nogc(free_op_data);
}
} else if (OP_DATA_TYPE == IS_CONST) {
if (UNEXPECTED(Z_REFCOUNTED_P(value))) {
@@ -2702,9 +2604,7 @@ ZEND_VM_C_LABEL(try_assign_dim_array):
ZEND_VM_C_GOTO(try_assign_dim_array);
}
} else {
- if (OP1_TYPE != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = GET_OP2_ZVAL_PTR(BP_VAR_R);
ZEND_VM_C_LABEL(assign_dim_error):
FREE_UNFETCHED_OP_DATA();
@@ -2724,7 +2624,6 @@ ZEND_VM_C_LABEL(assign_dim_error):
ZEND_VM_HANDLER(22, ZEND_ASSIGN, VAR|CV, CONST|TMP|VAR|CV, SPEC(RETVAL))
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *value;
zval *variable_ptr;
@@ -2732,19 +2631,12 @@ ZEND_VM_HANDLER(22, ZEND_ASSIGN, VAR|CV, CONST|TMP|VAR|CV, SPEC(RETVAL))
value = GET_OP2_ZVAL_PTR(BP_VAR_R);
variable_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF(BP_VAR_W);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
- FREE_OP2();
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- value = zend_assign_to_variable(variable_ptr, value, OP2_TYPE, EX_USES_STRICT_TYPES());
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
- FREE_OP1_VAR_PTR();
- /* zend_assign_to_variable() always takes care of op2, never free it! */
+ value = zend_assign_to_variable(variable_ptr, value, OP2_TYPE, EX_USES_STRICT_TYPES());
+ if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
+ FREE_OP1_VAR_PTR();
+ /* zend_assign_to_variable() always takes care of op2, never free it! */
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -2752,7 +2644,6 @@ ZEND_VM_HANDLER(22, ZEND_ASSIGN, VAR|CV, CONST|TMP|VAR|CV, SPEC(RETVAL))
ZEND_VM_HANDLER(30, ZEND_ASSIGN_REF, VAR|CV, VAR|CV, SRC)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *variable_ptr;
zval *value_ptr;
@@ -2760,15 +2651,11 @@ ZEND_VM_HANDLER(30, ZEND_ASSIGN_REF, VAR|CV, VAR|CV, SRC)
value_ptr = GET_OP2_ZVAL_PTR_PTR(BP_VAR_W);
variable_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF(BP_VAR_W);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
- variable_ptr = &EG(uninitialized_zval);
- } else if (OP1_TYPE == IS_VAR &&
+ if (OP1_TYPE == IS_VAR &&
UNEXPECTED(Z_TYPE_P(EX_VAR(opline->op1.var)) != IS_INDIRECT)) {
zend_throw_error(NULL, "Cannot assign by reference to an array dimension of an object");
variable_ptr = &EG(uninitialized_zval);
- } else if (OP2_TYPE == IS_VAR && UNEXPECTED(Z_ISERROR_P(value_ptr))) {
- variable_ptr = &EG(uninitialized_zval);
} else if (OP2_TYPE == IS_VAR &&
opline->extended_value == ZEND_RETURNS_FUNCTION &&
UNEXPECTED(!Z_ISREF_P(value_ptr))) {
@@ -2792,17 +2679,11 @@ ZEND_VM_HANDLER(30, ZEND_ASSIGN_REF, VAR|CV, VAR|CV, SRC)
ZEND_VM_HANDLER(32, ZEND_ASSIGN_OBJ_REF, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CACHE_SLOT|SRC, SPEC(OP_DATA=VAR|CV))
{
USE_OPLINE
- zend_free_op free_op1, free_op2, free_op_data;
zval *property, *container, *value_ptr;
SAVE_OPLINE();
container = GET_OP1_OBJ_ZVAL_PTR_PTR_UNDEF(BP_VAR_W);
-
- if (OP1_TYPE == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_DISPATCH_TO_HELPER(zend_this_not_in_object_context_helper);
- }
-
property = GET_OP2_ZVAL_PTR(BP_VAR_R);
value_ptr = GET_OP_DATA_ZVAL_PTR_PTR(BP_VAR_W);
@@ -2835,7 +2716,6 @@ ZEND_VM_HANDLER(32, ZEND_ASSIGN_OBJ_REF, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CA
ZEND_VM_HANDLER(33, ZEND_ASSIGN_STATIC_PROP_REF, ANY, ANY, CACHE_SLOT|SRC)
{
USE_OPLINE
- zend_free_op free_op_data;
zval *prop, *value_ptr;
zend_property_info *prop_info;
@@ -2849,13 +2729,11 @@ ZEND_VM_HANDLER(33, ZEND_ASSIGN_STATIC_PROP_REF, ANY, ANY, CACHE_SLOT|SRC)
value_ptr = GET_OP_DATA_ZVAL_PTR_PTR(BP_VAR_W);
- if (OP_DATA_TYPE == IS_VAR && UNEXPECTED(Z_ISERROR_P(value_ptr))) {
- prop = &EG(uninitialized_zval);
- } else if (OP_DATA_TYPE == IS_VAR && (opline->extended_value & ZEND_RETURNS_FUNCTION) && UNEXPECTED(!Z_ISREF_P(value_ptr))) {
+ if (OP_DATA_TYPE == IS_VAR && (opline->extended_value & ZEND_RETURNS_FUNCTION) && UNEXPECTED(!Z_ISREF_P(value_ptr))) {
if (UNEXPECTED(!zend_wrong_assign_to_variable_reference(prop, value_ptr OPLINE_CC EXECUTE_DATA_CC))) {
prop = &EG(uninitialized_zval);
}
- } else if (UNEXPECTED(prop_info->type)) {
+ } else if (UNEXPECTED(ZEND_TYPE_IS_SET(prop_info->type))) {
prop = zend_assign_to_typed_property_reference(prop_info, prop, value_ptr EXECUTE_DATA_CC);
} else {
zend_assign_to_variable_reference(prop, value_ptr);
@@ -2995,8 +2873,8 @@ ZEND_VM_HOT_HANDLER(42, ZEND_JMP, JMP_ADDR, ANY)
ZEND_VM_HOT_NOCONST_HANDLER(43, ZEND_JMPZ, CONST|TMPVAR|CV, JMP_ADDR)
{
USE_OPLINE
- zend_free_op free_op1;
zval *val;
+ zend_uchar op1_type;
val = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
@@ -3014,20 +2892,23 @@ ZEND_VM_HOT_NOCONST_HANDLER(43, ZEND_JMPZ, CONST|TMPVAR|CV, JMP_ADDR)
}
SAVE_OPLINE();
+ op1_type = OP1_TYPE;
if (i_zend_is_true(val)) {
opline++;
} else {
opline = OP_JMP_ADDR(opline, opline->op2);
}
- FREE_OP1();
+ if (op1_type & (IS_TMP_VAR|IS_VAR)) {
+ zval_ptr_dtor_nogc(val);
+ }
ZEND_VM_JMP(opline);
}
ZEND_VM_HOT_NOCONST_HANDLER(44, ZEND_JMPNZ, CONST|TMPVAR|CV, JMP_ADDR)
{
USE_OPLINE
- zend_free_op free_op1;
zval *val;
+ zend_uchar op1_type;
val = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
@@ -3045,20 +2926,23 @@ ZEND_VM_HOT_NOCONST_HANDLER(44, ZEND_JMPNZ, CONST|TMPVAR|CV, JMP_ADDR)
}
SAVE_OPLINE();
+ op1_type = OP1_TYPE;
if (i_zend_is_true(val)) {
opline = OP_JMP_ADDR(opline, opline->op2);
} else {
opline++;
}
- FREE_OP1();
+ if (op1_type & (IS_TMP_VAR|IS_VAR)) {
+ zval_ptr_dtor_nogc(val);
+ }
ZEND_VM_JMP(opline);
}
ZEND_VM_HANDLER(45, ZEND_JMPZNZ, CONST|TMPVAR|CV, JMP_ADDR, JMP_ADDR)
{
USE_OPLINE
- zend_free_op free_op1;
zval *val;
+ zend_uchar op1_type;
val = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
@@ -3077,19 +2961,21 @@ ZEND_VM_HANDLER(45, ZEND_JMPZNZ, CONST|TMPVAR|CV, JMP_ADDR, JMP_ADDR)
}
SAVE_OPLINE();
+ op1_type = OP1_TYPE;
if (i_zend_is_true(val)) {
opline = ZEND_OFFSET_TO_OPLINE(opline, opline->extended_value);
} else {
opline = OP_JMP_ADDR(opline, opline->op2);
}
- FREE_OP1();
+ if (op1_type & (IS_TMP_VAR|IS_VAR)) {
+ zval_ptr_dtor_nogc(val);
+ }
ZEND_VM_JMP(opline);
}
ZEND_VM_COLD_CONST_HANDLER(46, ZEND_JMPZ_EX, CONST|TMPVAR|CV, JMP_ADDR)
{
USE_OPLINE
- zend_free_op free_op1;
zval *val;
int ret;
@@ -3126,7 +3012,6 @@ ZEND_VM_COLD_CONST_HANDLER(46, ZEND_JMPZ_EX, CONST|TMPVAR|CV, JMP_ADDR)
ZEND_VM_COLD_CONST_HANDLER(47, ZEND_JMPNZ_EX, CONST|TMPVAR|CV, JMP_ADDR)
{
USE_OPLINE
- zend_free_op free_op1;
zval *val;
int ret;
@@ -3173,19 +3058,29 @@ ZEND_VM_HOT_HANDLER(127, ZEND_FE_FREE, TMPVAR, ANY)
zval *var;
USE_OPLINE
- SAVE_OPLINE();
var = EX_VAR(opline->op1.var);
- if (Z_TYPE_P(var) != IS_ARRAY && Z_FE_ITER_P(var) != (uint32_t)-1) {
- zend_hash_iterator_del(Z_FE_ITER_P(var));
+ if (Z_TYPE_P(var) != IS_ARRAY) {
+ SAVE_OPLINE();
+ if (Z_FE_ITER_P(var) != (uint32_t)-1) {
+ zend_hash_iterator_del(Z_FE_ITER_P(var));
+ }
+ zval_ptr_dtor_nogc(var);
+ ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
- zval_ptr_dtor_nogc(var);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
+
+ /* This is freeing an array. Use an inlined version of zval_ptr_dtor_nogc. */
+ /* PHP only needs to save the opline and check for an exception if the last reference to the array was garbage collected (destructors of elements in the array could throw an exception) */
+ if (Z_REFCOUNTED_P(var) && !Z_DELREF_P(var)) {
+ SAVE_OPLINE();
+ rc_dtor_func(Z_COUNTED_P(var));
+ ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
+ }
+ ZEND_VM_NEXT_OPCODE();
}
ZEND_VM_COLD_CONSTCONST_HANDLER(53, ZEND_FAST_CONCAT, CONST|TMPVAR|CV, CONST|TMPVAR|CV)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
zend_string *op1_str, *op2_str, *str;
@@ -3306,7 +3201,6 @@ ZEND_VM_COLD_CONSTCONST_HANDLER(53, ZEND_FAST_CONCAT, CONST|TMPVAR|CV, CONST|TMP
ZEND_VM_HANDLER(54, ZEND_ROPE_INIT, UNUSED, CONST|TMPVAR|CV, NUM)
{
USE_OPLINE
- zend_free_op free_op2;
zend_string **rope;
zval *var;
@@ -3342,7 +3236,6 @@ ZEND_VM_HANDLER(54, ZEND_ROPE_INIT, UNUSED, CONST|TMPVAR|CV, NUM)
ZEND_VM_HANDLER(55, ZEND_ROPE_ADD, TMP, CONST|TMPVAR|CV, NUM)
{
USE_OPLINE
- zend_free_op free_op2;
zend_string **rope;
zval *var;
@@ -3378,7 +3271,6 @@ ZEND_VM_HANDLER(55, ZEND_ROPE_ADD, TMP, CONST|TMPVAR|CV, NUM)
ZEND_VM_HANDLER(56, ZEND_ROPE_END, TMP, CONST|TMPVAR|CV, NUM)
{
USE_OPLINE
- zend_free_op free_op2;
zend_string **rope;
zval *var, *ret;
uint32_t i;
@@ -3434,7 +3326,6 @@ ZEND_VM_HANDLER(56, ZEND_ROPE_END, TMP, CONST|TMPVAR|CV, NUM)
ZEND_VM_HANDLER(109, ZEND_FETCH_CLASS, UNUSED|CLASS_FETCH, CONST|TMPVAR|UNUSED|CV, CACHE_SLOT)
{
- zend_free_op free_op2;
zval *class_name;
USE_OPLINE
@@ -3480,7 +3371,6 @@ ZEND_VM_HOT_OBJ_HANDLER(112, ZEND_INIT_METHOD_CALL, CONST|TMPVAR|UNUSED|THIS|CV,
{
USE_OPLINE
zval *function_name;
- zend_free_op free_op1, free_op2;
zval *object;
zend_function *fbc;
zend_class_entry *called_scope;
@@ -3492,10 +3382,6 @@ ZEND_VM_HOT_OBJ_HANDLER(112, ZEND_INIT_METHOD_CALL, CONST|TMPVAR|UNUSED|THIS|CV,
object = GET_OP1_OBJ_ZVAL_PTR_UNDEF(BP_VAR_R);
- if (OP1_TYPE == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_DISPATCH_TO_HELPER(zend_this_not_in_object_context_helper);
- }
-
if (OP2_TYPE != IS_CONST) {
function_name = GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R);
}
@@ -3575,7 +3461,6 @@ ZEND_VM_HOT_OBJ_HANDLER(112, ZEND_INIT_METHOD_CALL, CONST|TMPVAR|UNUSED|THIS|CV,
HANDLE_EXCEPTION();
}
if (OP2_TYPE == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE))) &&
EXPECTED(obj == orig_obj)) {
CACHE_POLYMORPHIC_PTR(opline->result.num, called_scope, fbc);
@@ -3606,9 +3491,12 @@ ZEND_VM_HOT_OBJ_HANDLER(112, ZEND_INIT_METHOD_CALL, CONST|TMPVAR|UNUSED|THIS|CV,
} else if (OP1_TYPE & (IS_VAR|IS_TMP_VAR|IS_CV)) {
if (OP1_TYPE == IS_CV) {
GC_ADDREF(obj); /* For $this pointer */
- } else if (free_op1 != object) {
- GC_ADDREF(obj); /* For $this pointer */
- FREE_OP1();
+ } else {
+ zval *free_op1 = EX_VAR(opline->op1.var);
+ if (free_op1 != object) {
+ GC_ADDREF(obj); /* For $this pointer */
+ zval_ptr_dtor_nogc(free_op1);
+ }
}
/* CV may be changed indirectly (e.g. when it's a reference) */
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS | ZEND_CALL_RELEASE_THIS;
@@ -3667,8 +3555,6 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, UNUSED|CLASS_FETCH|CONST|VAR,
EXPECTED(CACHED_PTR(opline->result.num) == ce)) {
fbc = CACHED_PTR(opline->result.num + sizeof(void*));
} else if (OP2_TYPE != IS_UNUSED) {
- zend_free_op free_op2;
-
function_name = GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R);
if (OP2_TYPE != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
@@ -3684,7 +3570,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, UNUSED|CLASS_FETCH|CONST|VAR,
HANDLE_EXCEPTION();
}
}
- zend_throw_error(NULL, "Function name must be a string");
+ zend_throw_error(NULL, "Method name must be a string");
FREE_OP2();
HANDLE_EXCEPTION();
} while (0);
@@ -3704,7 +3590,6 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, UNUSED|CLASS_FETCH|CONST|VAR,
HANDLE_EXCEPTION();
}
if (OP2_TYPE == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE)))) {
CACHE_POLYMORPHIC_PTR(opline->result.num, ce, fbc);
}
@@ -3735,13 +3620,9 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, UNUSED|CLASS_FETCH|CONST|VAR,
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS;
} else {
zend_non_static_method_call(fbc);
- if (UNEXPECTED(EG(exception) != NULL)) {
- HANDLE_EXCEPTION();
- }
- ZEND_VM_C_GOTO(check_parent_and_self);
+ HANDLE_EXCEPTION();
}
} else {
-ZEND_VM_C_LABEL(check_parent_and_self):
/* previous opcode is ZEND_FETCH_CLASS */
if (OP1_TYPE == IS_UNUSED
&& ((opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_PARENT ||
@@ -3794,7 +3675,6 @@ ZEND_VM_HOT_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST, NUM|CACHE_SLOT)
ZEND_VM_HANDLER(128, ZEND_INIT_DYNAMIC_CALL, ANY, CONST|TMPVAR|CV, NUM)
{
USE_OPLINE
- zend_free_op free_op2;
zval *function_name;
zend_execute_data *call;
@@ -3805,7 +3685,7 @@ ZEND_VM_C_LABEL(try_function_name):
if (OP2_TYPE != IS_CONST && EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
call = zend_init_dynamic_call_string(Z_STR_P(function_name), opline->extended_value);
} else if (OP2_TYPE != IS_CONST && EXPECTED(Z_TYPE_P(function_name) == IS_OBJECT)) {
- call = zend_init_dynamic_call_object(function_name, opline->extended_value);
+ call = zend_init_dynamic_call_object(Z_OBJ_P(function_name), opline->extended_value);
} else if (EXPECTED(Z_TYPE_P(function_name) == IS_ARRAY)) {
call = zend_init_dynamic_call_array(Z_ARRVAL_P(function_name), opline->extended_value);
} else if ((OP2_TYPE & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(function_name) == IS_REFERENCE)) {
@@ -3813,12 +3693,13 @@ ZEND_VM_C_LABEL(try_function_name):
ZEND_VM_C_GOTO(try_function_name);
} else {
if (OP2_TYPE == IS_CV && UNEXPECTED(Z_TYPE_P(function_name) == IS_UNDEF)) {
- ZVAL_UNDEFINED_OP2();
+ function_name = ZVAL_UNDEFINED_OP2();
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
}
- zend_throw_error(NULL, "Function name must be a string");
+ zend_throw_error(NULL, "Value of type %s is not callable",
+ zend_get_type_by_const(Z_TYPE_P(function_name)));
call = NULL;
}
@@ -3849,7 +3730,6 @@ ZEND_VM_C_LABEL(try_function_name):
ZEND_VM_HANDLER(118, ZEND_INIT_USER_CALL, CONST, CONST|TMPVAR|CV, NUM)
{
USE_OPLINE
- zend_free_op free_op2;
zval *function_name;
zend_fcall_info_cache fcc;
char *error = NULL;
@@ -3861,16 +3741,8 @@ ZEND_VM_HANDLER(118, ZEND_INIT_USER_CALL, CONST, CONST|TMPVAR|CV, NUM)
SAVE_OPLINE();
function_name = GET_OP2_ZVAL_PTR(BP_VAR_R);
if (zend_is_callable_ex(function_name, NULL, 0, NULL, &fcc, &error)) {
+ ZEND_ASSERT(!error);
func = fcc.function_handler;
- if (error) {
- efree(error);
- /* This is the only soft error is_callable() can generate */
- zend_non_static_method_call(func);
- if (UNEXPECTED(EG(exception) != NULL)) {
- FREE_OP2();
- HANDLE_EXCEPTION();
- }
- }
object_or_called_scope = fcc.called_scope;
if (func->common.fn_flags & ZEND_ACC_CLOSURE) {
/* Delay closure destruction until its invocation */
@@ -3903,14 +3775,10 @@ ZEND_VM_HANDLER(118, ZEND_INIT_USER_CALL, CONST, CONST|TMPVAR|CV, NUM)
init_func_run_time_cache(&func->op_array);
}
} else {
- zend_internal_type_error(EX_USES_STRICT_TYPES(), "%s() expects parameter 1 to be a valid callback, %s", Z_STRVAL_P(RT_CONSTANT(opline, opline->op1)), error);
+ zend_type_error("%s() expects parameter 1 to be a valid callback, %s", Z_STRVAL_P(RT_CONSTANT(opline, opline->op1)), error);
efree(error);
FREE_OP2();
- if (UNEXPECTED(EG(exception))) {
- HANDLE_EXCEPTION();
- }
- func = (zend_function*)&zend_pass_function;
- object_or_called_scope = NULL;
+ HANDLE_EXCEPTION();
}
call = zend_vm_stack_push_call_frame(call_info,
@@ -3999,6 +3867,10 @@ ZEND_VM_HOT_HANDLER(129, ZEND_DO_ICALL, ANY, ANY, SPEC(RETVAL))
call->prev_execute_data = execute_data;
EG(current_execute_data) = call;
+#if ZEND_DEBUG
+ zend_bool should_throw = zend_internal_call_should_throw(fbc, call);
+#endif
+
ret = RETURN_VALUE_USED(opline) ? EX_VAR(opline->result.var) : &retval;
ZVAL_NULL(ret);
@@ -4006,6 +3878,9 @@ ZEND_VM_HOT_HANDLER(129, ZEND_DO_ICALL, ANY, ANY, SPEC(RETVAL))
#if ZEND_DEBUG
if (!EG(exception) && call->func) {
+ if (should_throw) {
+ zend_internal_call_arginfo_violation(call->func);
+ }
ZEND_ASSERT(!(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
zend_verify_internal_return_type(call->func, ret));
ZEND_ASSERT((call->func->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)
@@ -4094,15 +3969,9 @@ ZEND_VM_HOT_HANDLER(131, ZEND_DO_FCALL_BY_NAME, ANY, ANY, SPEC(RETVAL))
call->prev_execute_data = execute_data;
EG(current_execute_data) = call;
- if (UNEXPECTED(fbc->common.fn_flags & ZEND_ACC_HAS_TYPE_HINTS)
- && UNEXPECTED(!zend_verify_internal_arg_types(fbc, call))) {
- UNDEF_RESULT();
- if (!RETURN_VALUE_USED(opline)) {
- ret = &retval;
- ZVAL_UNDEF(ret);
- }
- ZEND_VM_C_GOTO(fcall_by_name_end);
- }
+#if ZEND_DEBUG
+ zend_bool should_throw = zend_internal_call_should_throw(fbc, call);
+#endif
ret = RETURN_VALUE_USED(opline) ? EX_VAR(opline->result.var) : &retval;
ZVAL_NULL(ret);
@@ -4111,6 +3980,9 @@ ZEND_VM_HOT_HANDLER(131, ZEND_DO_FCALL_BY_NAME, ANY, ANY, SPEC(RETVAL))
#if ZEND_DEBUG
if (!EG(exception) && call->func) {
+ if (should_throw) {
+ zend_internal_call_arginfo_violation(call->func);
+ }
ZEND_ASSERT(!(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
zend_verify_internal_return_type(call->func, ret));
ZEND_ASSERT((call->func->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)
@@ -4143,27 +4015,9 @@ ZEND_VM_HOT_HANDLER(60, ZEND_DO_FCALL, ANY, ANY, SPEC(RETVAL))
zend_execute_data *call = EX(call);
zend_function *fbc = call->func;
zval *ret;
- zval retval;
SAVE_OPLINE();
EX(call) = call->prev_execute_data;
- if (UNEXPECTED((fbc->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) != 0)) {
- if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_ABSTRACT) != 0)) {
- zend_abstract_method(fbc);
-ZEND_VM_C_LABEL(fcall_except):
- UNDEF_RESULT();
- if (!RETURN_VALUE_USED(opline)) {
- ret = &retval;
- ZVAL_UNDEF(ret);
- }
- ZEND_VM_C_GOTO(fcall_end);
- } else {
- zend_deprecated_function(fbc);
- if (UNEXPECTED(EG(exception) != NULL)) {
- ZEND_VM_C_GOTO(fcall_except);
- }
- }
- }
if (EXPECTED(fbc->type == ZEND_USER_FUNCTION)) {
ret = NULL;
@@ -4185,14 +4039,28 @@ ZEND_VM_C_LABEL(fcall_except):
ZEND_ADD_CALL_FLAG(call, ZEND_CALL_TOP);
zend_execute_ex(call);
}
- } else if (EXPECTED(fbc->type < ZEND_USER_FUNCTION)) {
+ } else {
+ zval retval;
+ ZEND_ASSERT(fbc->type == ZEND_INTERNAL_FUNCTION);
+
+ if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_DEPRECATED) != 0)) {
+ zend_deprecated_function(fbc);
+ if (UNEXPECTED(EG(exception) != NULL)) {
+ UNDEF_RESULT();
+ if (!RETURN_VALUE_USED(opline)) {
+ ret = &retval;
+ ZVAL_UNDEF(ret);
+ }
+ ZEND_VM_C_GOTO(fcall_end);
+ }
+ }
+
call->prev_execute_data = execute_data;
EG(current_execute_data) = call;
- if (UNEXPECTED(fbc->common.fn_flags & ZEND_ACC_HAS_TYPE_HINTS)
- && UNEXPECTED(!zend_verify_internal_arg_types(fbc, call))) {
- ZEND_VM_C_GOTO(fcall_except);
- }
+#if ZEND_DEBUG
+ zend_bool should_throw = zend_internal_call_should_throw(fbc, call);
+#endif
ret = RETURN_VALUE_USED(opline) ? EX_VAR(opline->result.var) : &retval;
ZVAL_NULL(ret);
@@ -4206,6 +4074,9 @@ ZEND_VM_C_LABEL(fcall_except):
#if ZEND_DEBUG
if (!EG(exception) && call->func) {
+ if (should_throw) {
+ zend_internal_call_arginfo_violation(call->func);
+ }
ZEND_ASSERT(!(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
zend_verify_internal_return_type(call->func, ret));
ZEND_ASSERT((call->func->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)
@@ -4220,19 +4091,6 @@ ZEND_VM_C_LABEL(fcall_end):
if (!RETURN_VALUE_USED(opline)) {
i_zval_ptr_dtor(ret);
}
- } else { /* ZEND_OVERLOADED_FUNCTION */
- ret = RETURN_VALUE_USED(opline) ? EX_VAR(opline->result.var) : &retval;
-
- call->prev_execute_data = execute_data;
-
- if (UNEXPECTED(!zend_do_fcall_overloaded(call, ret))) {
- UNDEF_RESULT();
- HANDLE_EXCEPTION();
- }
-
- if (!RETURN_VALUE_USED(opline)) {
- zval_ptr_dtor(ret);
- }
}
if (UNEXPECTED(ZEND_CALL_INFO(call) & ZEND_CALL_RELEASE_THIS)) {
@@ -4253,16 +4111,15 @@ ZEND_VM_COLD_CONST_HANDLER(124, ZEND_VERIFY_RETURN_TYPE, CONST|TMP|VAR|UNUSED|CV
{
USE_OPLINE
- SAVE_OPLINE();
if (OP1_TYPE == IS_UNUSED) {
+ SAVE_OPLINE();
zend_verify_missing_return_type(EX(func), CACHE_ADDR(opline->op2.num));
+ HANDLE_EXCEPTION();
} else {
/* prevents "undefined variable opline" errors */
#if !ZEND_VM_SPEC || (OP1_TYPE != IS_UNUSED)
zval *retval_ref, *retval_ptr;
- zend_free_op free_op1;
zend_arg_info *ret_info = EX(func)->common.arg_info - 1;
-
retval_ref = retval_ptr = GET_OP1_ZVAL_PTR(BP_VAR_R);
if (OP1_TYPE == IS_CONST) {
@@ -4277,26 +4134,35 @@ ZEND_VM_COLD_CONST_HANDLER(124, ZEND_VERIFY_RETURN_TYPE, CONST|TMP|VAR|UNUSED|CV
ZVAL_DEREF(retval_ptr);
}
- if (UNEXPECTED(!ZEND_TYPE_IS_CLASS(ret_info->type)
- && ZEND_TYPE_CODE(ret_info->type) != IS_CALLABLE
- && ZEND_TYPE_CODE(ret_info->type) != IS_ITERABLE
- && !ZEND_SAME_FAKE_TYPE(ZEND_TYPE_CODE(ret_info->type), Z_TYPE_P(retval_ptr))
- && !(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)
- && retval_ref != retval_ptr)
- ) {
- /* A cast might happen - unwrap the reference if this is a by-value return */
- if (Z_REFCOUNT_P(retval_ref) == 1) {
- ZVAL_UNREF(retval_ref);
+ if (EXPECTED(ZEND_TYPE_CONTAINS_CODE(ret_info->type, Z_TYPE_P(retval_ptr)))) {
+ ZEND_VM_NEXT_OPCODE();
+ }
+
+ zend_reference *ref = NULL;
+ void *cache_slot = CACHE_ADDR(opline->op2.num);
+ if (UNEXPECTED(retval_ref != retval_ptr)) {
+ if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
+ ref = Z_REF_P(retval_ref);
} else {
- Z_DELREF_P(retval_ref);
- ZVAL_COPY(retval_ref, retval_ptr);
+ /* A cast might happen - unwrap the reference if this is a by-value return */
+ if (Z_REFCOUNT_P(retval_ref) == 1) {
+ ZVAL_UNREF(retval_ref);
+ } else {
+ Z_DELREF_P(retval_ref);
+ ZVAL_COPY(retval_ref, retval_ptr);
+ }
+ retval_ptr = retval_ref;
}
- retval_ptr = retval_ref;
}
- zend_verify_return_type(EX(func), retval_ptr, CACHE_ADDR(opline->op2.num));
+
+ SAVE_OPLINE();
+ if (UNEXPECTED(!zend_check_type_slow(ret_info->type, retval_ptr, ref, cache_slot, NULL, 1, 0))) {
+ zend_verify_return_error(EX(func), cache_slot, retval_ptr);
+ HANDLE_EXCEPTION();
+ }
+ ZEND_VM_NEXT_OPCODE();
#endif
}
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
ZEND_VM_INLINE_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY)
@@ -4304,7 +4170,6 @@ ZEND_VM_INLINE_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY)
USE_OPLINE
zval *retval_ptr;
zval *return_value;
- zend_free_op free_op1;
retval_ptr = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
return_value = EX(return_value);
@@ -4316,9 +4181,9 @@ ZEND_VM_INLINE_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY)
}
} else if (!return_value) {
if (OP1_TYPE & (IS_VAR|IS_TMP_VAR)) {
- if (Z_REFCOUNTED_P(free_op1) && !Z_DELREF_P(free_op1)) {
+ if (Z_REFCOUNTED_P(retval_ptr) && !Z_DELREF_P(retval_ptr)) {
SAVE_OPLINE();
- rc_dtor_func(Z_COUNTED_P(free_op1));
+ rc_dtor_func(Z_COUNTED_P(retval_ptr));
}
}
} else {
@@ -4376,7 +4241,6 @@ ZEND_VM_COLD_CONST_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY, SRC)
{
USE_OPLINE
zval *retval_ptr;
- zend_free_op free_op1;
SAVE_OPLINE();
@@ -4513,7 +4377,6 @@ ZEND_VM_HANDLER(161, ZEND_GENERATOR_RETURN, CONST|TMP|VAR|CV, ANY)
{
USE_OPLINE
zval *retval;
- zend_free_op free_op1;
zend_generator *generator = zend_get_running_generator(EXECUTE_DATA_C);
@@ -4553,11 +4416,10 @@ ZEND_VM_HANDLER(161, ZEND_GENERATOR_RETURN, CONST|TMP|VAR|CV, ANY)
ZEND_VM_RETURN();
}
-ZEND_VM_COLD_CONST_HANDLER(108, ZEND_THROW, CONST|TMP|VAR|CV, ANY)
+ZEND_VM_COLD_CONST_HANDLER(108, ZEND_THROW, CONST|TMPVAR|CV, ANY)
{
USE_OPLINE
zval *value;
- zend_free_op free_op1;
SAVE_OPLINE();
value = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
@@ -4583,13 +4445,10 @@ ZEND_VM_COLD_CONST_HANDLER(108, ZEND_THROW, CONST|TMP|VAR|CV, ANY)
} while (0);
zend_exception_save();
- if (OP1_TYPE != IS_TMP_VAR) {
- Z_TRY_ADDREF_P(value);
- }
-
+ Z_TRY_ADDREF_P(value);
zend_throw_exception_object(value);
zend_exception_restore();
- FREE_OP1_IF_VAR();
+ FREE_OP1();
HANDLE_EXCEPTION();
}
@@ -4650,7 +4509,6 @@ ZEND_VM_HOT_HANDLER(65, ZEND_SEND_VAL, CONST|TMPVAR, NUM)
{
USE_OPLINE
zval *value, *arg;
- zend_free_op free_op1;
value = GET_OP1_ZVAL_PTR(BP_VAR_R);
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
@@ -4681,7 +4539,6 @@ ZEND_VM_HOT_SEND_HANDLER(116, ZEND_SEND_VAL_EX, CONST|TMP, NUM, SPEC(QUICK_ARG))
{
USE_OPLINE
zval *value, *arg;
- zend_free_op free_op1;
uint32_t arg_num = opline->op2.num;
if (EXPECTED(arg_num <= MAX_ARG_FLAG_NUM)) {
@@ -4707,7 +4564,6 @@ ZEND_VM_HOT_HANDLER(117, ZEND_SEND_VAR, VAR|CV, NUM)
{
USE_OPLINE
zval *varptr, *arg;
- zend_free_op free_op1;
varptr = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
if (OP1_TYPE == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(varptr) == IS_UNDEF)) {
@@ -4744,7 +4600,6 @@ ZEND_VM_HOT_HANDLER(117, ZEND_SEND_VAR, VAR|CV, NUM)
ZEND_VM_HANDLER(106, ZEND_SEND_VAR_NO_REF, VAR, NUM)
{
USE_OPLINE
- zend_free_op free_op1;
zval *varptr, *arg;
varptr = GET_OP1_ZVAL_PTR(BP_VAR_R);
@@ -4764,7 +4619,6 @@ ZEND_VM_HANDLER(106, ZEND_SEND_VAR_NO_REF, VAR, NUM)
ZEND_VM_HOT_SEND_HANDLER(50, ZEND_SEND_VAR_NO_REF_EX, VAR, NUM, SPEC(QUICK_ARG))
{
USE_OPLINE
- zend_free_op free_op1;
zval *varptr, *arg;
uint32_t arg_num = opline->op2.num;
@@ -4805,19 +4659,12 @@ ZEND_VM_HOT_SEND_HANDLER(50, ZEND_SEND_VAR_NO_REF_EX, VAR, NUM, SPEC(QUICK_ARG))
ZEND_VM_HANDLER(67, ZEND_SEND_REF, VAR|CV, NUM)
{
USE_OPLINE
- zend_free_op free_op1;
zval *varptr, *arg;
SAVE_OPLINE();
varptr = GET_OP1_ZVAL_PTR_PTR(BP_VAR_W);
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
- if (OP1_TYPE == IS_VAR && UNEXPECTED(Z_ISERROR_P(varptr))) {
- ZVAL_NEW_EMPTY_REF(arg);
- ZVAL_NULL(Z_REFVAL_P(arg));
- ZEND_VM_NEXT_OPCODE();
- }
-
if (Z_ISREF_P(varptr)) {
Z_ADDREF_P(varptr);
} else {
@@ -4833,7 +4680,6 @@ ZEND_VM_HOT_SEND_HANDLER(66, ZEND_SEND_VAR_EX, VAR|CV, NUM, SPEC(QUICK_ARG))
{
USE_OPLINE
zval *varptr, *arg;
- zend_free_op free_op1;
uint32_t arg_num = opline->op2.num;
if (EXPECTED(arg_num <= MAX_ARG_FLAG_NUM)) {
@@ -4900,7 +4746,6 @@ ZEND_VM_HOT_HANDLER(185, ZEND_SEND_FUNC_ARG, VAR, NUM)
{
USE_OPLINE
zval *varptr, *arg;
- zend_free_op free_op1;
if (UNEXPECTED(ZEND_CALL_INFO(EX(call)) & ZEND_CALL_SEND_ARG_BY_REF)) {
ZEND_VM_DISPATCH_TO_HANDLER(ZEND_SEND_REF);
@@ -4929,7 +4774,6 @@ ZEND_VM_HOT_HANDLER(185, ZEND_SEND_FUNC_ARG, VAR, NUM)
ZEND_VM_HANDLER(165, ZEND_SEND_UNPACK, ANY, ANY)
{
USE_OPLINE
- zend_free_op free_op1;
zval *args;
int arg_num;
@@ -4995,7 +4839,7 @@ ZEND_VM_C_LABEL(send_again):
zend_object_iterator *iter;
if (!ce || !ce->get_iterator) {
- zend_error(E_WARNING, "Only arrays and Traversables can be unpacked");
+ zend_type_error("Only arrays and Traversables can be unpacked");
} else {
iter = ce->get_iterator(ce, args, 0);
@@ -5072,7 +4916,7 @@ ZEND_VM_C_LABEL(send_again):
if (OP1_TYPE == IS_CV && UNEXPECTED(Z_TYPE_P(args) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- zend_error(E_WARNING, "Only arrays and Traversables can be unpacked");
+ zend_type_error("Only arrays and Traversables can be unpacked");
}
FREE_OP1();
@@ -5082,7 +4926,6 @@ ZEND_VM_C_LABEL(send_again):
ZEND_VM_HANDLER(119, ZEND_SEND_ARRAY, ANY, ANY, NUM)
{
USE_OPLINE
- zend_free_op free_op1;
zval *args;
SAVE_OPLINE();
@@ -5095,16 +4938,10 @@ ZEND_VM_HANDLER(119, ZEND_SEND_ARRAY, ANY, ANY, NUM)
ZEND_VM_C_GOTO(send_array);
}
}
- zend_internal_type_error(EX_USES_STRICT_TYPES(), "call_user_func_array() expects parameter 2 to be array, %s given", zend_get_type_by_const(Z_TYPE_P(args)));
- if (ZEND_CALL_INFO(EX(call)) & ZEND_CALL_CLOSURE) {
- OBJ_RELEASE(ZEND_CLOSURE_OBJECT(EX(call)->func));
- } else if (ZEND_CALL_INFO(EX(call)) & ZEND_CALL_RELEASE_THIS) {
- OBJ_RELEASE(Z_OBJ(EX(call)->This));
- }
- EX(call)->func = (zend_function*)&zend_pass_function;
- Z_OBJ(EX(call)->This) = NULL;
- ZEND_CALL_INFO(EX(call)) &= ~(ZEND_CALL_RELEASE_THIS | ZEND_CALL_HAS_THIS);
+ zend_type_error("call_user_func_array() expects parameter 2 to be array, %s given", zend_get_type_by_const(Z_TYPE_P(args)));
FREE_UNFETCHED_OP2();
+ FREE_OP1();
+ HANDLE_EXCEPTION();
} else {
uint32_t arg_num;
HashTable *ht;
@@ -5114,7 +4951,6 @@ ZEND_VM_HANDLER(119, ZEND_SEND_ARRAY, ANY, ANY, NUM)
ZEND_VM_C_LABEL(send_array):
ht = Z_ARRVAL_P(args);
if (OP2_TYPE != IS_UNUSED) {
- zend_free_op free_op2;
zval *op2 = GET_OP2_ZVAL_PTR(BP_VAR_R);
uint32_t skip = opline->extended_value;
uint32_t count = zend_hash_num_elements(ht);
@@ -5193,7 +5029,6 @@ ZEND_VM_HANDLER(120, ZEND_SEND_USER, CONST|TMP|VAR|CV, NUM)
{
USE_OPLINE
zval *arg, *param;
- zend_free_op free_op1;
SAVE_OPLINE();
@@ -5208,22 +5043,55 @@ ZEND_VM_HANDLER(120, ZEND_SEND_USER, CONST|TMP|VAR|CV, NUM)
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
-ZEND_VM_HOT_HANDLER(63, ZEND_RECV, NUM, UNUSED|CACHE_SLOT)
+ZEND_VM_COLD_HELPER(zend_missing_arg_helper, ANY, ANY)
+{
+#ifdef ZEND_VM_IP_GLOBAL_REG
+ USE_OPLINE
+
+ SAVE_OPLINE();
+#endif
+ zend_missing_arg_error(execute_data);
+ HANDLE_EXCEPTION();
+}
+
+ZEND_VM_COLD_HELPER(zend_verify_recv_arg_type_helper, ANY, ANY, zval *op_1)
+{
+ USE_OPLINE
+
+ SAVE_OPLINE();
+ if (UNEXPECTED(!zend_verify_recv_arg_type(EX(func), opline->op1.num, op_1, CACHE_ADDR(opline->extended_value)))) {
+ HANDLE_EXCEPTION();
+ }
+
+ ZEND_VM_NEXT_OPCODE();
+}
+
+ZEND_VM_HOT_HANDLER(63, ZEND_RECV, NUM, UNUSED, CACHE_SLOT)
{
USE_OPLINE
uint32_t arg_num = opline->op1.num;
+ zval *param;
if (UNEXPECTED(arg_num > EX_NUM_ARGS())) {
- SAVE_OPLINE();
- zend_missing_arg_error(execute_data);
- HANDLE_EXCEPTION();
- } else {
- zval *param = EX_VAR(opline->result.var);
+ ZEND_VM_DISPATCH_TO_HELPER(zend_missing_arg_helper);
+ }
- SAVE_OPLINE();
- if (UNEXPECTED(!zend_verify_recv_arg_type(EX(func), arg_num, param, NULL, CACHE_ADDR(opline->op2.num)))) {
- HANDLE_EXCEPTION();
- }
+ param = EX_VAR(opline->result.var);
+
+ if (UNEXPECTED(!(opline->op2.num & (1u << Z_TYPE_P(param))))) {
+ ZEND_VM_DISPATCH_TO_HELPER(zend_verify_recv_arg_type_helper, op_1, param);
+ }
+
+ ZEND_VM_NEXT_OPCODE();
+}
+
+ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_RECV, op->op2.num == MAY_BE_ANY, ZEND_RECV_NOTYPE, NUM, NUM, CACHE_SLOT)
+{
+ USE_OPLINE
+ uint32_t arg_num = opline->op1.num;
+
+ if (UNEXPECTED(arg_num > EX_NUM_ARGS())) {
+ ZEND_VM_DISPATCH_TO_HELPER(zend_missing_arg_helper);
}
ZEND_VM_NEXT_OPCODE();
@@ -5267,10 +5135,8 @@ ZEND_VM_HOT_HANDLER(64, ZEND_RECV_INIT, NUM, CONST, CACHE_SLOT)
} else {
ZEND_VM_C_LABEL(recv_init_check_type):
if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0)) {
- zval *default_value = RT_CONSTANT(opline, opline->op2);
-
SAVE_OPLINE();
- if (UNEXPECTED(!zend_verify_recv_arg_type(EX(func), arg_num, param, default_value, CACHE_ADDR(opline->extended_value)))) {
+ if (UNEXPECTED(!zend_verify_recv_arg_type(EX(func), arg_num, param, CACHE_ADDR(opline->extended_value)))) {
HANDLE_EXCEPTION();
}
}
@@ -5280,7 +5146,7 @@ ZEND_VM_C_LABEL(recv_init_check_type):
ZEND_VM_NEXT_OPCODE();
}
-ZEND_VM_HANDLER(164, ZEND_RECV_VARIADIC, NUM, UNUSED|CACHE_SLOT)
+ZEND_VM_HANDLER(164, ZEND_RECV_VARIADIC, NUM, UNUSED, CACHE_SLOT)
{
USE_OPLINE
uint32_t arg_num = opline->op1.num;
@@ -5300,7 +5166,7 @@ ZEND_VM_HANDLER(164, ZEND_RECV_VARIADIC, NUM, UNUSED|CACHE_SLOT)
param = EX_VAR_NUM(EX(func)->op_array.last_var + EX(func)->op_array.T);
if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0)) {
do {
- zend_verify_variadic_arg_type(EX(func), arg_num, param, NULL, CACHE_ADDR(opline->op2.num));
+ zend_verify_variadic_arg_type(EX(func), arg_num, param, CACHE_ADDR(opline->extended_value));
if (Z_OPT_REFCOUNTED_P(param)) Z_ADDREF_P(param);
ZEND_HASH_FILL_ADD(param);
param++;
@@ -5324,7 +5190,6 @@ ZEND_VM_COLD_CONST_HANDLER(52, ZEND_BOOL, CONST|TMPVAR|CV, ANY)
{
USE_OPLINE
zval *val;
- zend_free_op free_op1;
val = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
if (Z_TYPE_INFO_P(val) == IS_TRUE) {
@@ -5349,6 +5214,7 @@ ZEND_VM_COLD_CONST_HANDLER(52, ZEND_BOOL, CONST|TMPVAR|CV, ANY)
ZEND_VM_HELPER(zend_case_helper, ANY, ANY, zval *op_1, zval *op_2)
{
+ int ret;
USE_OPLINE
SAVE_OPLINE();
@@ -5358,28 +5224,16 @@ ZEND_VM_HELPER(zend_case_helper, ANY, ANY, zval *op_1, zval *op_2)
if (UNEXPECTED(Z_TYPE_INFO_P(op_2) == IS_UNDEF)) {
op_2 = ZVAL_UNDEFINED_OP2();
}
- compare_function(EX_VAR(opline->result.var), op_1, op_2);
+ ret = zend_compare(op_1, op_2);
if (OP2_TYPE & (IS_TMP_VAR|IS_VAR)) {
zval_ptr_dtor_nogc(op_2);
}
- if (UNEXPECTED(EG(exception))) {
- HANDLE_EXCEPTION();
- }
- if (Z_LVAL_P(EX_VAR(opline->result.var)) == 0) {
- ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- } else {
- ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- }
+ ZEND_VM_SMART_BRANCH(ret == 0, 1);
}
ZEND_VM_HANDLER(48, ZEND_CASE, TMPVAR, CONST|TMPVAR|CV)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
double d1, d2;
@@ -5390,13 +5244,9 @@ ZEND_VM_HANDLER(48, ZEND_CASE, TMPVAR, CONST|TMPVAR|CV)
if (EXPECTED(Z_LVAL_P(op1) == Z_LVAL_P(op2))) {
ZEND_VM_C_LABEL(case_true):
ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
ZEND_VM_C_LABEL(case_false):
ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -5506,8 +5356,8 @@ ZEND_VM_HANDLER(68, ZEND_NEW, UNUSED|CLASS_FETCH|CONST|VAR, UNUSED|CACHE_SLOT, N
ZEND_VM_COLD_CONST_HANDLER(110, ZEND_CLONE, CONST|TMPVAR|UNUSED|THIS|CV, ANY)
{
USE_OPLINE
- zend_free_op free_op1;
zval *obj;
+ zend_object *zobj;
zend_class_entry *ce, *scope;
zend_function *clone;
zend_object_clone_obj_t clone_call;
@@ -5515,10 +5365,6 @@ ZEND_VM_COLD_CONST_HANDLER(110, ZEND_CLONE, CONST|TMPVAR|UNUSED|THIS|CV, ANY)
SAVE_OPLINE();
obj = GET_OP1_OBJ_ZVAL_PTR_UNDEF(BP_VAR_R);
- if (OP1_TYPE == IS_UNUSED && UNEXPECTED(Z_TYPE_P(obj) == IS_UNDEF)) {
- ZEND_VM_DISPATCH_TO_HELPER(zend_this_not_in_object_context_helper);
- }
-
do {
if (OP1_TYPE == IS_CONST ||
(OP1_TYPE != IS_UNUSED && UNEXPECTED(Z_TYPE_P(obj) != IS_OBJECT))) {
@@ -5541,9 +5387,10 @@ ZEND_VM_COLD_CONST_HANDLER(110, ZEND_CLONE, CONST|TMPVAR|UNUSED|THIS|CV, ANY)
}
} while (0);
- ce = Z_OBJCE_P(obj);
+ zobj = Z_OBJ_P(obj);
+ ce = zobj->ce;
clone = ce->clone;
- clone_call = Z_OBJ_HT_P(obj)->clone_obj;
+ clone_call = zobj->handlers->clone_obj;
if (UNEXPECTED(clone_call == NULL)) {
zend_throw_error(NULL, "Trying to clone an uncloneable object of class %s", ZSTR_VAL(ce->name));
FREE_OP1();
@@ -5564,7 +5411,7 @@ ZEND_VM_COLD_CONST_HANDLER(110, ZEND_CLONE, CONST|TMPVAR|UNUSED|THIS|CV, ANY)
}
}
- ZVAL_OBJ(EX_VAR(opline->result.var), clone_call(obj));
+ ZVAL_OBJ(EX_VAR(opline->result.var), clone_call(zobj));
FREE_OP1();
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
@@ -5646,7 +5493,8 @@ ZEND_VM_HANDLER(181, ZEND_FETCH_CLASS_CONSTANT, VAR|CONST|UNUSED|CLASS_FETCH, CO
}
CACHE_POLYMORPHIC_PTR(opline->extended_value, ce, value);
} else {
- zend_throw_error(NULL, "Undefined class constant '%s'", Z_STRVAL_P(RT_CONSTANT(opline, opline->op2)));
+ zend_throw_error(NULL, "Undefined class constant '%s::%s'",
+ ZSTR_VAL(ce->name), Z_STRVAL_P(RT_CONSTANT(opline, opline->op2)));
ZVAL_UNDEF(EX_VAR(opline->result.var));
HANDLE_EXCEPTION();
}
@@ -5660,7 +5508,6 @@ ZEND_VM_HANDLER(181, ZEND_FETCH_CLASS_CONSTANT, VAR|CONST|UNUSED|CLASS_FETCH, CO
ZEND_VM_HANDLER(72, ZEND_ADD_ARRAY_ELEMENT, CONST|TMP|VAR|CV, CONST|TMPVAR|UNUSED|NEXT|CV, REF)
{
USE_OPLINE
- zend_free_op free_op1;
zval *expr_ptr, new_expr;
SAVE_OPLINE();
@@ -5699,7 +5546,6 @@ ZEND_VM_HANDLER(72, ZEND_ADD_ARRAY_ELEMENT, CONST|TMP|VAR|CV, CONST|TMPVAR|UNUSE
}
if (OP2_TYPE != IS_UNUSED) {
- zend_free_op free_op2;
zval *offset = GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R);
zend_string *str;
zend_ulong hval;
@@ -5758,7 +5604,6 @@ ZEND_VM_C_LABEL(num_index):
ZEND_VM_HANDLER(147, ZEND_ADD_ARRAY_UNPACK, ANY, ANY)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1;
SAVE_OPLINE();
@@ -5792,7 +5637,7 @@ ZEND_VM_C_LABEL(add_unpack_again):
zend_object_iterator *iter;
if (!ce || !ce->get_iterator) {
- zend_throw_error(NULL, "Only arrays and Traversables can be unpacked");
+ zend_type_error("Only arrays and Traversables can be unpacked");
} else {
iter = ce->get_iterator(ce, op1, 0);
if (UNEXPECTED(!iter)) {
@@ -5886,7 +5731,6 @@ ZEND_VM_HANDLER(71, ZEND_INIT_ARRAY, CONST|TMP|VAR|CV|UNUSED, CONST|TMPVAR|UNUSE
ZEND_VM_COLD_CONST_HANDLER(51, ZEND_CAST, CONST|TMP|VAR|CV, ANY, TYPE)
{
USE_OPLINE
- zend_free_op free_op1;
zval *expr;
zval *result = EX_VAR(opline->result.var);
HashTable *ht;
@@ -5895,12 +5739,6 @@ ZEND_VM_COLD_CONST_HANDLER(51, ZEND_CAST, CONST|TMP|VAR|CV, ANY, TYPE)
expr = GET_OP1_ZVAL_PTR(BP_VAR_R);
switch (opline->extended_value) {
- case IS_NULL:
- ZVAL_NULL(result);
- break;
- case _IS_BOOL:
- ZVAL_BOOL(result, zend_is_true(expr));
- break;
case IS_LONG:
ZVAL_LONG(result, zval_get_long(expr));
break;
@@ -5911,6 +5749,7 @@ ZEND_VM_COLD_CONST_HANDLER(51, ZEND_CAST, CONST|TMP|VAR|CV, ANY, TYPE)
ZVAL_STR(result, zval_get_string(expr));
break;
default:
+ ZEND_ASSERT(opline->extended_value != _IS_BOOL && "Must use ZEND_BOOL instead");
if (OP1_TYPE & (IS_VAR|IS_CV)) {
ZVAL_DEREF(expr);
}
@@ -5954,6 +5793,7 @@ ZEND_VM_COLD_CONST_HANDLER(51, ZEND_CAST, CONST|TMP|VAR|CV, ANY, TYPE)
}
}
} else {
+ ZEND_ASSERT(opline->extended_value == IS_OBJECT);
ZVAL_OBJ(result, zend_objects_new(zend_standard_class_def));
if (Z_TYPE_P(expr) == IS_ARRAY) {
ht = zend_symtable_to_proptable(Z_ARR_P(expr));
@@ -5982,7 +5822,6 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMPVAR|CV, ANY, EVAL)
{
USE_OPLINE
zend_op_array *new_op_array;
- zend_free_op free_op1;
zval *inc_filename;
SAVE_OPLINE();
@@ -6072,7 +5911,6 @@ ZEND_VM_HANDLER(74, ZEND_UNSET_VAR, CONST|TMPVAR|CV, UNUSED, VAR_FETCH)
zval *varname;
zend_string *name, *tmp_name;
HashTable *target_symbol_table;
- zend_free_op free_op1;
SAVE_OPLINE();
@@ -6111,7 +5949,6 @@ ZEND_VM_COLD_HANDLER(179, ZEND_UNSET_STATIC_PROP, ANY, ANY, CACHE_SLOT)
zval *varname;
zend_string *name, *tmp_name = NULL;
zend_class_entry *ce;
- zend_free_op free_op1;
SAVE_OPLINE();
@@ -6146,7 +5983,11 @@ ZEND_VM_COLD_HANDLER(179, ZEND_UNSET_STATIC_PROP, ANY, ANY, CACHE_SLOT)
if (OP1_TYPE == IS_CV && UNEXPECTED(Z_TYPE_P(varname) == IS_UNDEF)) {
varname = ZVAL_UNDEFINED_OP1();
}
- name = zval_get_tmp_string(varname, &tmp_name);
+ name = zval_try_get_tmp_string(varname, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ FREE_OP1();
+ HANDLE_EXCEPTION();
+ }
}
zend_std_unset_static_property(ce, name);
@@ -6159,7 +6000,6 @@ ZEND_VM_COLD_HANDLER(179, ZEND_UNSET_STATIC_PROP, ANY, ANY, CACHE_SLOT)
ZEND_VM_HANDLER(75, ZEND_UNSET_DIM, VAR|CV, CONST|TMPVAR|CV)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container;
zval *offset;
zend_ulong hval;
@@ -6217,7 +6057,7 @@ ZEND_VM_C_LABEL(num_index_dim):
key = ZSTR_EMPTY_ALLOC();
ZEND_VM_C_GOTO(str_index_dim);
} else {
- zend_error(E_WARNING, "Illegal offset type in unset");
+ zend_type_error("Illegal offset type in unset");
}
break;
} else if (Z_ISREF_P(container)) {
@@ -6236,7 +6076,7 @@ ZEND_VM_C_LABEL(num_index_dim):
if (OP2_TYPE == IS_CONST && Z_EXTRA_P(offset) == ZEND_EXTRA_VALUE) {
offset++;
}
- Z_OBJ_HT_P(container)->unset_dimension(container, offset);
+ Z_OBJ_HT_P(container)->unset_dimension(Z_OBJ_P(container), offset);
} else if (OP1_TYPE != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_STRING)) {
zend_throw_error(NULL, "Cannot unset string offsets");
}
@@ -6250,15 +6090,12 @@ ZEND_VM_C_LABEL(num_index_dim):
ZEND_VM_HANDLER(76, ZEND_UNSET_OBJ, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CACHE_SLOT)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
container = GET_OP1_OBJ_ZVAL_PTR_PTR_UNDEF(BP_VAR_UNSET);
- if (OP1_TYPE == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_DISPATCH_TO_HELPER(zend_this_not_in_object_context_helper);
- }
offset = GET_OP2_ZVAL_PTR(BP_VAR_R);
do {
@@ -6276,7 +6113,18 @@ ZEND_VM_HANDLER(76, ZEND_UNSET_OBJ, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CACHE_S
break;
}
}
- Z_OBJ_HT_P(container)->unset_property(container, offset, ((OP2_TYPE == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL));
+ if (OP2_TYPE == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ break;
+ }
+ }
+ Z_OBJ_HT_P(container)->unset_property(Z_OBJ_P(container), name, ((OP2_TYPE == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL));
+ if (OP2_TYPE != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
} while (0);
FREE_OP2();
@@ -6287,7 +6135,6 @@ ZEND_VM_HANDLER(76, ZEND_UNSET_OBJ, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CACHE_S
ZEND_VM_HANDLER(77, ZEND_FE_RESET_R, CONST|TMP|VAR|CV, JMP_ADDR)
{
USE_OPLINE
- zend_free_op free_op1;
zval *array_ptr, *result;
SAVE_OPLINE();
@@ -6304,20 +6151,27 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET_R, CONST|TMP|VAR|CV, JMP_ADDR)
FREE_OP1_IF_VAR();
ZEND_VM_NEXT_OPCODE();
} else if (OP1_TYPE != IS_CONST && EXPECTED(Z_TYPE_P(array_ptr) == IS_OBJECT)) {
- if (!Z_OBJCE_P(array_ptr)->get_iterator) {
+ zend_object *zobj = Z_OBJ_P(array_ptr);
+ if (!zobj->ce->get_iterator) {
+ HashTable *properties;
+
result = EX_VAR(opline->result.var);
- ZVAL_COPY_VALUE(result, array_ptr);
+ ZVAL_OBJ(result, zobj);
if (OP1_TYPE != IS_TMP_VAR) {
- Z_ADDREF_P(array_ptr);
+ GC_ADDREF(zobj);
}
- if (Z_OBJ_P(array_ptr)->properties
- && UNEXPECTED(GC_REFCOUNT(Z_OBJ_P(array_ptr)->properties) > 1)) {
- if (EXPECTED(!(GC_FLAGS(Z_OBJ_P(array_ptr)->properties) & IS_ARRAY_IMMUTABLE))) {
- GC_DELREF(Z_OBJ_P(array_ptr)->properties);
+ properties = zobj->properties;
+ if (properties) {
+ if (UNEXPECTED(GC_REFCOUNT(properties) > 1)) {
+ if (EXPECTED(!(GC_FLAGS(properties) & IS_ARRAY_IMMUTABLE))) {
+ GC_DELREF(properties);
+ }
+ properties = zobj->properties = zend_array_dup(properties);
}
- Z_OBJ_P(array_ptr)->properties = zend_array_dup(Z_OBJ_P(array_ptr)->properties);
+ } else {
+ properties = zobj->handlers->get_properties(zobj);
}
- Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_OBJPROP_P(array_ptr), 0);
+ Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(properties, 0);
FREE_OP1_IF_VAR();
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
@@ -6345,7 +6199,6 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET_R, CONST|TMP|VAR|CV, JMP_ADDR)
ZEND_VM_COLD_CONST_HANDLER(125, ZEND_FE_RESET_RW, CONST|TMP|VAR|CV, JMP_ADDR)
{
USE_OPLINE
- zend_free_op free_op1;
zval *array_ptr, *array_ref;
SAVE_OPLINE();
@@ -6778,25 +6631,15 @@ ZEND_VM_HOT_HANDLER(154, ZEND_ISSET_ISEMPTY_CV, CV, UNUSED, ISSET, SPEC(ISSET))
if (Z_TYPE_P(value) > IS_NULL &&
(!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL)) {
ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else {
int result;
SAVE_OPLINE();
result = !i_zend_is_true(value);
- if (UNEXPECTED(EG(exception))) {
- ZVAL_UNDEF(EX_VAR(opline->result.var));
- HANDLE_EXCEPTION();
- }
- ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH(result, 1);
}
}
@@ -6805,7 +6648,6 @@ ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMPVAR|CV, UNUSED, VAR_FETCH|
USE_OPLINE
zval *value;
int result;
- zend_free_op free_op1;
zval *varname;
zend_string *name, *tmp_name;
HashTable *target_symbol_table;
@@ -6843,8 +6685,6 @@ ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMPVAR|CV, UNUSED, VAR_FETCH|
}
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
/* No specialization for op_types (CONST|TMPVAR|CV, UNUSED|CLASS_FETCH|CONST|VAR) */
@@ -6866,14 +6706,11 @@ ZEND_VM_HANDLER(180, ZEND_ISSET_ISEMPTY_STATIC_PROP, ANY, CLASS_FETCH, ISSET|CAC
}
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
ZEND_VM_COLD_CONSTCONST_HANDLER(115, ZEND_ISSET_ISEMPTY_DIM_OBJ, CONST|TMPVAR|CV, CONST|TMPVAR|CV, ISSET)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container;
int result;
zend_ulong hval;
@@ -6908,6 +6745,10 @@ ZEND_VM_C_LABEL(num_index_prop):
ZEND_VM_C_GOTO(isset_again);
} else {
value = zend_find_array_dim_slow(ht, offset EXECUTE_DATA_CC);
+ if (UNEXPECTED(EG(exception))) {
+ result = 0;
+ ZEND_VM_C_GOTO(isset_dim_obj_exit);
+ }
}
if (!(opline->extended_value & ZEND_ISEMPTY)) {
@@ -6919,8 +6760,6 @@ ZEND_VM_C_LABEL(num_index_prop):
/* avoid exception check */
FREE_OP2();
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
} else {
result = (value == NULL || !i_zend_is_true(value));
@@ -6946,25 +6785,18 @@ ZEND_VM_C_LABEL(isset_dim_obj_exit):
FREE_OP2();
FREE_OP1();
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
ZEND_VM_COLD_CONST_HANDLER(148, ZEND_ISSET_ISEMPTY_PROP_OBJ, CONST|TMPVAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, ISSET|CACHE_SLOT)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container;
int result;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
container = GET_OP1_OBJ_ZVAL_PTR(BP_VAR_IS);
-
- if (OP1_TYPE == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_DISPATCH_TO_HELPER(zend_this_not_in_object_context_helper);
- }
-
offset = GET_OP2_ZVAL_PTR(BP_VAR_R);
if (OP1_TYPE == IS_CONST ||
@@ -6981,26 +6813,37 @@ ZEND_VM_COLD_CONST_HANDLER(148, ZEND_ISSET_ISEMPTY_PROP_OBJ, CONST|TMPVAR|UNUSED
}
}
+ if (OP2_TYPE == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ result = 0;
+ ZEND_VM_C_GOTO(isset_object_finish);
+ }
+ }
+
result =
(opline->extended_value & ZEND_ISEMPTY) ^
- Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY), ((OP2_TYPE == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+ Z_OBJ_HT_P(container)->has_property(Z_OBJ_P(container), name, (opline->extended_value & ZEND_ISEMPTY), ((OP2_TYPE == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+
+ if (OP2_TYPE != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
ZEND_VM_C_LABEL(isset_object_finish):
FREE_OP2();
FREE_OP1();
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
ZEND_VM_HANDLER(194, ZEND_ARRAY_KEY_EXISTS, CV|TMPVAR|CONST, CV|TMPVAR|CONST)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *key, *subject;
HashTable *ht;
- uint32_t result;
+ zend_bool result;
SAVE_OPLINE();
@@ -7018,14 +6861,13 @@ ZEND_VM_C_LABEL(array_key_exists_array):
ZEND_VM_C_GOTO(array_key_exists_array);
}
}
- result = zend_array_key_exists_slow(subject, key OPLINE_CC EXECUTE_DATA_CC);
+ zend_array_key_exists_error(subject, key OPLINE_CC EXECUTE_DATA_CC);
+ result = 0;
}
FREE_OP2();
FREE_OP1();
- ZEND_VM_SMART_BRANCH(result == IS_TRUE, 1);
- Z_TYPE_INFO_P(EX_VAR(opline->result.var)) = result;
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
+ ZEND_VM_SMART_BRANCH(result, 1);
}
/* No specialization for op_types (CONST|TMPVAR|UNUSED|CV, ANY) */
@@ -7035,7 +6877,6 @@ ZEND_VM_COLD_HANDLER(79, ZEND_EXIT, ANY, ANY)
SAVE_OPLINE();
if (OP1_TYPE != IS_UNUSED) {
- zend_free_op free_op1;
zval *ptr = GET_OP1_ZVAL_PTR(BP_VAR_R);
do {
@@ -7064,9 +6905,10 @@ ZEND_VM_HANDLER(57, ZEND_BEGIN_SILENCE, ANY, ANY)
ZVAL_LONG(EX_VAR(opline->result.var), EG(error_reporting));
- if (EG(error_reporting)) {
+ if (!E_HAS_ONLY_FATAL_ERRORS(EG(error_reporting))) {
do {
- EG(error_reporting) = 0;
+ /* Do not silence fatal errors */
+ EG(error_reporting) &= E_FATAL_ERRORS;
if (!EG(error_reporting_ini_entry)) {
zval *zv = zend_hash_find_ex(EG(ini_directives), ZSTR_KNOWN(ZEND_STR_ERROR_REPORTING), 1);
if (zv) {
@@ -7095,7 +6937,8 @@ ZEND_VM_HANDLER(58, ZEND_END_SILENCE, TMP, ANY)
{
USE_OPLINE
- if (!EG(error_reporting) && Z_LVAL_P(EX_VAR(opline->op1.var)) != 0) {
+ if (E_HAS_ONLY_FATAL_ERRORS(EG(error_reporting))
+ && !E_HAS_ONLY_FATAL_ERRORS(Z_LVAL_P(EX_VAR(opline->op1.var)))) {
EG(error_reporting) = Z_LVAL_P(EX_VAR(opline->op1.var));
}
ZEND_VM_NEXT_OPCODE();
@@ -7104,7 +6947,6 @@ ZEND_VM_HANDLER(58, ZEND_END_SILENCE, TMP, ANY)
ZEND_VM_COLD_CONST_HANDLER(152, ZEND_JMP_SET, CONST|TMP|VAR|CV, JMP_ADDR)
{
USE_OPLINE
- zend_free_op free_op1;
zval *value;
zval *ref = NULL;
int ret;
@@ -7154,7 +6996,6 @@ ZEND_VM_COLD_CONST_HANDLER(152, ZEND_JMP_SET, CONST|TMP|VAR|CV, JMP_ADDR)
ZEND_VM_COLD_CONST_HANDLER(169, ZEND_COALESCE, CONST|TMP|VAR|CV, JMP_ADDR)
{
USE_OPLINE
- zend_free_op free_op1;
zval *value;
zval *ref = NULL;
@@ -7194,7 +7035,6 @@ ZEND_VM_COLD_CONST_HANDLER(169, ZEND_COALESCE, CONST|TMP|VAR|CV, JMP_ADDR)
ZEND_VM_HOT_HANDLER(31, ZEND_QM_ASSIGN, CONST|TMP|VAR|CV, ANY)
{
USE_OPLINE
- zend_free_op free_op1;
zval *value;
zval *result = EX_VAR(opline->result.var);
@@ -7361,7 +7201,6 @@ ZEND_VM_HANDLER(105, ZEND_TICKS, ANY, ANY, NUM)
ZEND_VM_HANDLER(138, ZEND_INSTANCEOF, TMPVAR|CV, UNUSED|CLASS_FETCH|CONST|VAR, CACHE_SLOT)
{
USE_OPLINE
- zend_free_op free_op1;
zval *expr;
zend_bool result;
@@ -7403,8 +7242,6 @@ ZEND_VM_C_LABEL(try_instanceof):
}
FREE_OP1();
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
ZEND_VM_HOT_HANDLER(104, ZEND_EXT_NOP, ANY, ANY)
@@ -7529,7 +7366,10 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY)
break; /* return value is zend_class_entry pointer */
default:
- zval_ptr_dtor_nogc(EX_VAR(throw_op->result.var));
+ /* smart branch opcodes may not initialize result */
+ if (!zend_is_smart_branch(throw_op)) {
+ zval_ptr_dtor_nogc(EX_VAR(throw_op->result.var));
+ }
}
}
@@ -7570,7 +7410,6 @@ ZEND_VM_HANDLER(150, ZEND_USER_OPCODE, ANY, ANY)
ZEND_VM_HANDLER(143, ZEND_DECLARE_CONST, CONST, CONST)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *name;
zval *val;
zend_constant c;
@@ -7662,7 +7501,7 @@ ZEND_VM_COLD_HELPER(zend_yield_in_closed_generator_helper, ANY, ANY)
HANDLE_EXCEPTION();
}
-ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSED, SRC)
+ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMPVAR|CV|UNUSED, SRC)
{
USE_OPLINE
@@ -7681,8 +7520,6 @@ ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSE
/* Set the new yielded value */
if (OP1_TYPE != IS_UNUSED) {
- zend_free_op free_op1;
-
if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
/* Constants and temporary variables aren't yieldable by reference,
* but we still allow them with a notice. */
@@ -7751,26 +7588,12 @@ ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSE
/* Set the new yielded key */
if (OP2_TYPE != IS_UNUSED) {
- zend_free_op free_op2;
zval *key = GET_OP2_ZVAL_PTR(BP_VAR_R);
-
- /* Consts, temporary variables and references need copying */
- if (OP2_TYPE == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (OP2_TYPE == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((OP2_TYPE & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
- FREE_OP2_IF_VAR();
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (OP2_TYPE == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
+ if ((OP2_TYPE & (IS_CV|IS_VAR)) && UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE) {
+ key = Z_REFVAL_P(key);
}
+ ZVAL_COPY(&generator->key, key);
+ FREE_OP2();
if (Z_TYPE(generator->key) == IS_LONG
&& Z_LVAL(generator->key) > generator->largest_used_integer_key
@@ -7803,17 +7626,14 @@ ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSE
ZEND_VM_RETURN();
}
-ZEND_VM_HANDLER(166, ZEND_YIELD_FROM, CONST|TMP|VAR|CV, ANY)
+ZEND_VM_HANDLER(166, ZEND_YIELD_FROM, CONST|TMPVAR|CV, ANY)
{
USE_OPLINE
-
zend_generator *generator = zend_get_running_generator(EXECUTE_DATA_C);
-
zval *val;
- zend_free_op free_op1;
SAVE_OPLINE();
- val = GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R);
+ val = GET_OP1_ZVAL_PTR(BP_VAR_R);
if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
zend_throw_error(NULL, "Cannot use \"yield from\" in a force-closed generator");
@@ -7822,23 +7642,21 @@ ZEND_VM_HANDLER(166, ZEND_YIELD_FROM, CONST|TMP|VAR|CV, ANY)
HANDLE_EXCEPTION();
}
+ZEND_VM_C_LABEL(yield_from_try_again):
if (Z_TYPE_P(val) == IS_ARRAY) {
ZVAL_COPY_VALUE(&generator->values, val);
- if (OP1_TYPE != IS_TMP_VAR && Z_OPT_REFCOUNTED_P(val)) {
+ if (Z_OPT_REFCOUNTED_P(val)) {
Z_ADDREF_P(val);
}
Z_FE_POS(generator->values) = 0;
-
- FREE_OP1_IF_VAR();
+ FREE_OP1();
} else if (OP1_TYPE != IS_CONST && Z_TYPE_P(val) == IS_OBJECT && Z_OBJCE_P(val)->get_iterator) {
zend_class_entry *ce = Z_OBJCE_P(val);
if (ce == zend_ce_generator) {
zend_generator *new_gen = (zend_generator *) Z_OBJ_P(val);
- if (OP1_TYPE != IS_TMP_VAR) {
- Z_ADDREF_P(val);
- }
- FREE_OP1_IF_VAR();
+ Z_ADDREF_P(val);
+ FREE_OP1();
if (Z_ISUNDEF(new_gen->retval)) {
if (UNEXPECTED(zend_generator_get_current(new_gen) == generator)) {
@@ -7884,6 +7702,9 @@ ZEND_VM_HANDLER(166, ZEND_YIELD_FROM, CONST|TMP|VAR|CV, ANY)
ZVAL_OBJ(&generator->values, &iter->std);
}
+ } else if ((OP1_TYPE & (IS_VAR|IS_CV)) && Z_TYPE_P(val) == IS_REFERENCE) {
+ val = Z_REFVAL_P(val);
+ ZEND_VM_C_GOTO(yield_from_try_again);
} else {
zend_throw_error(NULL, "Can use \"yield from\" only with arrays and Traversables");
UNDEF_RESULT();
@@ -7968,7 +7789,6 @@ ZEND_VM_HANDLER(163, ZEND_FAST_RET, ANY, TRY_CATCH)
ZEND_VM_HOT_HANDLER(168, ZEND_BIND_GLOBAL, CV, CONST, CACHE_SLOT)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zend_string *varname;
zval *value;
zval *variable_ptr;
@@ -8052,7 +7872,6 @@ ZEND_VM_COLD_CONST_HANDLER(121, ZEND_STRLEN, CONST|TMPVAR|CV, ANY)
{
USE_OPLINE
zval *value;
- zend_free_op free_op1;
value = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
if (EXPECTED(Z_TYPE_P(value) == IS_STRING)) {
@@ -8090,9 +7909,9 @@ ZEND_VM_COLD_CONST_HANDLER(121, ZEND_STRLEN, CONST|TMPVAR|CV, ANY)
zval_ptr_dtor(&tmp);
}
if (!EG(exception)) {
- zend_internal_type_error(strict, "strlen() expects parameter 1 to be string, %s given", zend_get_type_by_const(Z_TYPE_P(value)));
+ zend_type_error("strlen() expects parameter 1 to be string, %s given", zend_get_type_by_const(Z_TYPE_P(value)));
}
- ZVAL_NULL(EX_VAR(opline->result.var));
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
} while (0);
}
FREE_OP1();
@@ -8104,12 +7923,11 @@ ZEND_VM_HOT_NOCONST_HANDLER(123, ZEND_TYPE_CHECK, CONST|TMPVAR|CV, ANY, TYPE_MAS
USE_OPLINE
zval *value;
int result = 0;
- zend_free_op free_op1;
value = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
if ((opline->extended_value >> (uint32_t)Z_TYPE_P(value)) & 1) {
ZEND_VM_C_LABEL(type_check_resource):
- if (EXPECTED(Z_TYPE_P(value) != IS_RESOURCE)
+ if (opline->extended_value != MAY_BE_RESOURCE
|| EXPECTED(NULL != zend_rsrc_list_get_rsrc_type(Z_RES_P(value)))) {
result = 1;
}
@@ -8131,12 +7949,8 @@ ZEND_VM_C_LABEL(type_check_resource):
SAVE_OPLINE();
FREE_OP1();
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
}
@@ -8150,13 +7964,9 @@ ZEND_VM_HOT_HANDLER(122, ZEND_DEFINED, CONST, ANY, CACHE_SLOT)
if (!IS_SPECIAL_CACHE_VAL(c)) {
ZEND_VM_C_LABEL(defined_true):
ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else if (EXPECTED(zend_hash_num_elements(EG(zend_constants)) == DECODE_SPECIAL_CACHE_NUM(c))) {
ZEND_VM_C_LABEL(defined_false):
ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
}
if (zend_quick_check_constant(RT_CONSTANT(opline, opline->op1) OPLINE_CC EXECUTE_DATA_CC) != SUCCESS) {
@@ -8182,14 +7992,32 @@ ZEND_VM_HANDLER(151, ZEND_ASSERT_CHECK, ANY, JMP_ADDR)
}
}
-ZEND_VM_HANDLER(157, ZEND_FETCH_CLASS_NAME, UNUSED|CLASS_FETCH, ANY)
+ZEND_VM_HANDLER(157, ZEND_FETCH_CLASS_NAME, CV|TMPVAR|UNUSED|CLASS_FETCH, ANY)
{
uint32_t fetch_type;
zend_class_entry *called_scope, *scope;
USE_OPLINE
- fetch_type = opline->op1.num;
+ if (OP1_TYPE != IS_UNUSED) {
+ zval *op = GET_OP1_ZVAL_PTR(BP_VAR_R);
+ SAVE_OPLINE();
+ if (UNEXPECTED(Z_TYPE_P(op) != IS_OBJECT)) {
+ ZVAL_DEREF(op);
+ if (Z_TYPE_P(op) != IS_OBJECT) {
+ zend_type_error("Cannot use ::class on value of type %s",
+ zend_get_type_by_const(Z_TYPE_P(op)));
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ FREE_OP1();
+ HANDLE_EXCEPTION();
+ }
+ }
+ ZVAL_STR_COPY(EX_VAR(opline->result.var), Z_OBJCE_P(op)->name);
+ FREE_OP1();
+ ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
+ }
+
+ fetch_type = opline->op1.num;
scope = EX(func)->op_array.scope;
if (UNEXPECTED(scope == NULL)) {
SAVE_OPLINE();
@@ -8291,14 +8119,9 @@ ZEND_VM_HANDLER(158, ZEND_CALL_TRAMPOLINE, ANY, ANY)
EG(current_execute_data) = call;
- if (UNEXPECTED(fbc->common.fn_flags & ZEND_ACC_HAS_TYPE_HINTS)
- && UNEXPECTED(!zend_verify_internal_arg_types(fbc, call))) {
- zend_vm_stack_free_call_frame(call);
- if (ret) {
- ZVAL_UNDEF(ret);
- }
- ZEND_VM_C_GOTO(call_trampoline_end);
- }
+#if ZEND_DEBUG
+ zend_bool should_throw = zend_internal_call_should_throw(fbc, call);
+#endif
if (ret == NULL) {
ZVAL_NULL(&retval);
@@ -8314,6 +8137,9 @@ ZEND_VM_HANDLER(158, ZEND_CALL_TRAMPOLINE, ANY, ANY)
#if ZEND_DEBUG
if (!EG(exception) && call->func) {
+ if (should_throw) {
+ zend_internal_call_arginfo_violation(call->func);
+ }
ZEND_ASSERT(!(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
zend_verify_internal_return_type(call->func, ret));
ZEND_ASSERT((call->func->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)
@@ -8323,7 +8149,6 @@ ZEND_VM_HANDLER(158, ZEND_CALL_TRAMPOLINE, ANY, ANY)
EG(current_execute_data) = call->prev_execute_data;
-ZEND_VM_C_LABEL(call_trampoline_end):
zend_vm_stack_free_args(call);
if (ret == &retval) {
zval_ptr_dtor(ret);
@@ -8355,7 +8180,6 @@ ZEND_VM_C_LABEL(call_trampoline_end):
ZEND_VM_HANDLER(182, ZEND_BIND_LEXICAL, TMP, CV, REF)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *closure, *var;
closure = GET_OP1_ZVAL_PTR(BP_VAR_R);
@@ -8388,7 +8212,6 @@ ZEND_VM_HANDLER(182, ZEND_BIND_LEXICAL, TMP, CV, REF)
ZEND_VM_HANDLER(183, ZEND_BIND_STATIC, CV, UNUSED, REF)
{
USE_OPLINE
- zend_free_op free_op1;
HashTable *ht;
zval *value;
zval *variable_ptr;
@@ -8439,7 +8262,7 @@ ZEND_VM_HANDLER(183, ZEND_BIND_STATIC, CV, UNUSED, REF)
ZEND_VM_NEXT_OPCODE();
}
-ZEND_VM_HANDLER(184, ZEND_FETCH_THIS, UNUSED, UNUSED)
+ZEND_VM_HOT_HANDLER(184, ZEND_FETCH_THIS, UNUSED, UNUSED)
{
USE_OPLINE
@@ -8513,7 +8336,6 @@ ZEND_VM_HANDLER(140, ZEND_MAKE_REF, VAR|CV, UNUSED)
ZEND_VM_COLD_CONSTCONST_HANDLER(187, ZEND_SWITCH_LONG, CONST|TMPVARCV, CONST, JMP_ADDR)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op, *jump_zv;
HashTable *jumptable;
@@ -8542,7 +8364,6 @@ ZEND_VM_COLD_CONSTCONST_HANDLER(187, ZEND_SWITCH_LONG, CONST|TMPVARCV, CONST, JM
ZEND_VM_COLD_CONSTCONST_HANDLER(188, ZEND_SWITCH_STRING, CONST|TMPVARCV, CONST, JMP_ADDR)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op, *jump_zv;
HashTable *jumptable;
@@ -8576,7 +8397,6 @@ ZEND_VM_COLD_CONSTCONST_HANDLER(188, ZEND_SWITCH_STRING, CONST|TMPVARCV, CONST,
ZEND_VM_COLD_CONSTCONST_HANDLER(189, ZEND_IN_ARRAY, CONST|TMP|VAR|CV, CONST, NUM)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1;
HashTable *ht = Z_ARRVAL_P(RT_CONSTANT(opline, opline->op2));
zval *result;
@@ -8595,13 +8415,12 @@ ZEND_VM_COLD_CONSTCONST_HANDLER(189, ZEND_IN_ARRAY, CONST|TMP|VAR|CV, CONST, NUM
result = zend_hash_find_ex(ht, ZSTR_EMPTY_ALLOC(), 1);
} else {
zend_string *key;
- zval key_tmp, result_tmp, *val;
+ zval key_tmp, *val;
result = NULL;
ZEND_HASH_FOREACH_STR_KEY_VAL(ht, key, val) {
ZVAL_STR(&key_tmp, key);
- compare_function(&result_tmp, op1, &key_tmp);
- if (Z_LVAL(result_tmp) == 0) {
+ if (zend_compare(op1, &key_tmp) == 0) {
result = val;
break;
}
@@ -8609,14 +8428,11 @@ ZEND_VM_COLD_CONSTCONST_HANDLER(189, ZEND_IN_ARRAY, CONST|TMP|VAR|CV, CONST, NUM
}
FREE_OP1();
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result != NULL);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
ZEND_VM_COLD_CONST_HANDLER(190, ZEND_COUNT, CONST|TMPVAR|CV, UNUSED)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1;
zend_long count;
@@ -8627,9 +8443,11 @@ ZEND_VM_COLD_CONST_HANDLER(190, ZEND_COUNT, CONST|TMPVAR|CV, UNUSED)
count = zend_array_count(Z_ARRVAL_P(op1));
break;
} else if (Z_TYPE_P(op1) == IS_OBJECT) {
+ zend_object *zobj = Z_OBJ_P(op1);
+
/* first, we check if the handler is defined */
- if (Z_OBJ_HT_P(op1)->count_elements) {
- if (SUCCESS == Z_OBJ_HT_P(op1)->count_elements(op1, &count)) {
+ if (zobj->handlers->count_elements) {
+ if (SUCCESS == zobj->handlers->count_elements(zobj, &count)) {
break;
}
if (UNEXPECTED(EG(exception))) {
@@ -8639,10 +8457,10 @@ ZEND_VM_COLD_CONST_HANDLER(190, ZEND_COUNT, CONST|TMPVAR|CV, UNUSED)
}
/* if not and the object implements Countable we call its count() method */
- if (instanceof_function(Z_OBJCE_P(op1), zend_ce_countable)) {
+ if (zend_class_implements_interface(zobj->ce, zend_ce_countable)) {
zval retval;
- zend_call_method_with_0_params(op1, NULL, NULL, "count", &retval);
+ zend_call_method_with_0_params(zobj, NULL, NULL, "count", &retval);
count = zval_get_long(&retval);
zval_ptr_dtor(&retval);
break;
@@ -8685,7 +8503,6 @@ ZEND_VM_COLD_CONST_HANDLER(191, ZEND_GET_CLASS, UNUSED|CONST|TMPVAR|CV, UNUSED)
ZEND_VM_NEXT_OPCODE();
}
} else {
- zend_free_op free_op1;
zval *op1;
SAVE_OPLINE();
@@ -8700,8 +8517,8 @@ ZEND_VM_COLD_CONST_HANDLER(191, ZEND_GET_CLASS, UNUSED|CONST|TMPVAR|CV, UNUSED)
if (OP1_TYPE == IS_CV && UNEXPECTED(Z_TYPE_P(op1) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- zend_error(E_WARNING, "get_class() expects parameter 1 to be object, %s given", zend_get_type_by_const(Z_TYPE_P(op1)));
- ZVAL_FALSE(EX_VAR(opline->result.var));
+ zend_type_error("get_class() expects parameter 1 to be object, %s given", zend_get_type_by_const(Z_TYPE_P(op1)));
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
}
break;
}
@@ -8732,7 +8549,6 @@ ZEND_VM_HANDLER(192, ZEND_GET_CALLED_CLASS, UNUSED, UNUSED)
ZEND_VM_COLD_CONST_HANDLER(193, ZEND_GET_TYPE, CONST|TMP|VAR|CV, UNUSED)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1;
zend_string *type;
@@ -8834,7 +8650,6 @@ ZEND_VM_HANDLER(172, ZEND_FUNC_GET_ARGS, UNUSED|CONST, UNUSED)
ZEND_VM_HANDLER(167, ZEND_COPY_TMP, TMPVAR, UNUSED)
{
USE_OPLINE
- zend_free_op free_op1;
zval *value = GET_OP1_ZVAL_PTR(BP_VAR_R);
zval *result = EX_VAR(opline->result.var);
ZVAL_COPY(result, value);
@@ -8959,7 +8774,7 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_MUL, (op1_info == MAY_BE_DOUBLE && op2_info =
ZEND_VM_NEXT_OPCODE();
}
-ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_EQUAL, (op1_info == MAY_BE_LONG && op2_info == MAY_BE_LONG), ZEND_IS_EQUAL_LONG, CONST|TMPVARCV, CONST|TMPVARCV, SPEC(SMART_BRANCH,NO_CONST_CONST,COMMUTATIVE))
+ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_EQUAL|ZEND_IS_IDENTICAL, (op1_info == MAY_BE_LONG && op2_info == MAY_BE_LONG), ZEND_IS_EQUAL_LONG, CONST|TMPVARCV, CONST|TMPVARCV, SPEC(SMART_BRANCH,NO_CONST_CONST,COMMUTATIVE))
{
USE_OPLINE
zval *op1, *op2;
@@ -8969,11 +8784,9 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_EQUAL, (op1_info == MAY_BE_LONG && op2_inf
op2 = GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R);
result = (Z_LVAL_P(op1) == Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
-ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_EQUAL, (op1_info == MAY_BE_DOUBLE && op2_info == MAY_BE_DOUBLE), ZEND_IS_EQUAL_DOUBLE, CONST|TMPVARCV, CONST|TMPVARCV, SPEC(SMART_BRANCH,NO_CONST_CONST,COMMUTATIVE))
+ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_EQUAL|ZEND_IS_IDENTICAL, (op1_info == MAY_BE_DOUBLE && op2_info == MAY_BE_DOUBLE), ZEND_IS_EQUAL_DOUBLE, CONST|TMPVARCV, CONST|TMPVARCV, SPEC(SMART_BRANCH,NO_CONST_CONST,COMMUTATIVE))
{
USE_OPLINE
zval *op1, *op2;
@@ -8983,11 +8796,9 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_EQUAL, (op1_info == MAY_BE_DOUBLE && op2_i
op2 = GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R);
result = (Z_DVAL_P(op1) == Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
-ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_NOT_EQUAL, (op1_info == MAY_BE_LONG && op2_info == MAY_BE_LONG), ZEND_IS_NOT_EQUAL_LONG, CONST|TMPVARCV, CONST|TMPVARCV, SPEC(SMART_BRANCH,NO_CONST_CONST,COMMUTATIVE))
+ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_NOT_EQUAL|ZEND_IS_NOT_IDENTICAL, (op1_info == MAY_BE_LONG && op2_info == MAY_BE_LONG), ZEND_IS_NOT_EQUAL_LONG, CONST|TMPVARCV, CONST|TMPVARCV, SPEC(SMART_BRANCH,NO_CONST_CONST,COMMUTATIVE))
{
USE_OPLINE
zval *op1, *op2;
@@ -8997,11 +8808,9 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_NOT_EQUAL, (op1_info == MAY_BE_LONG && op2
op2 = GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R);
result = (Z_LVAL_P(op1) != Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
-ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_NOT_EQUAL, (op1_info == MAY_BE_DOUBLE && op2_info == MAY_BE_DOUBLE), ZEND_IS_NOT_EQUAL_DOUBLE, CONST|TMPVARCV, CONST|TMPVARCV, SPEC(SMART_BRANCH,NO_CONST_CONST,COMMUTATIVE))
+ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_NOT_EQUAL|ZEND_IS_NOT_IDENTICAL, (op1_info == MAY_BE_DOUBLE && op2_info == MAY_BE_DOUBLE), ZEND_IS_NOT_EQUAL_DOUBLE, CONST|TMPVARCV, CONST|TMPVARCV, SPEC(SMART_BRANCH,NO_CONST_CONST,COMMUTATIVE))
{
USE_OPLINE
zval *op1, *op2;
@@ -9011,8 +8820,35 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_NOT_EQUAL, (op1_info == MAY_BE_DOUBLE && o
op2 = GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R);
result = (Z_DVAL_P(op1) != Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+}
+
+ZEND_VM_TYPE_SPEC_HANDLER(ZEND_IS_IDENTICAL, op->op1_type == IS_CV && (op->op2_type & (IS_CONST|IS_CV)) && !(op1_info & (MAY_BE_UNDEF|MAY_BE_REF)) && !(op2_info & (MAY_BE_UNDEF|MAY_BE_REF)), ZEND_IS_IDENTICAL_NOTHROW, CV, CONST|CV, SPEC(COMMUTATIVE))
+{
+ /* This is declared below the specializations for MAY_BE_LONG/MAY_BE_DOUBLE so those will be used instead if possible. */
+ /* This optimizes $x === SOME_CONST_EXPR and $x === $y for non-refs and non-undef, which can't throw. */
+ /* (Infinite recursion when comparing arrays is an uncatchable fatal error) */
+ USE_OPLINE
+ zval *op1, *op2;
+ zend_bool result;
+
+ op1 = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
+ op2 = GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R);
+ result = fast_is_identical_function(op1, op2);
+ /* Free is a no-op for const/cv */
+ ZEND_VM_SMART_BRANCH(result, 0);
+}
+
+ZEND_VM_TYPE_SPEC_HANDLER(ZEND_IS_NOT_IDENTICAL, op->op1_type == IS_CV && (op->op2_type & (IS_CONST|IS_CV)) && !(op1_info & (MAY_BE_UNDEF|MAY_BE_REF)) && !(op2_info & (MAY_BE_UNDEF|MAY_BE_REF)), ZEND_IS_NOT_IDENTICAL_NOTHROW, CV, CONST|CV, SPEC(COMMUTATIVE))
+{
+ USE_OPLINE
+ zval *op1, *op2;
+ zend_bool result;
+
+ op1 = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
+ op2 = GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R);
+ result = fast_is_identical_function(op1, op2);
+ /* Free is a no-op for const/cv */
+ ZEND_VM_SMART_BRANCH(!result, 0);
}
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_SMALLER, (op1_info == MAY_BE_LONG && op2_info == MAY_BE_LONG), ZEND_IS_SMALLER_LONG, CONST|TMPVARCV, CONST|TMPVARCV, SPEC(SMART_BRANCH,NO_CONST_CONST))
@@ -9025,8 +8861,6 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_SMALLER, (op1_info == MAY_BE_LONG && op2_i
op2 = GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R);
result = (Z_LVAL_P(op1) < Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_SMALLER, (op1_info == MAY_BE_DOUBLE && op2_info == MAY_BE_DOUBLE), ZEND_IS_SMALLER_DOUBLE, CONST|TMPVARCV, CONST|TMPVARCV, SPEC(SMART_BRANCH,NO_CONST_CONST))
@@ -9039,8 +8873,6 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_SMALLER, (op1_info == MAY_BE_DOUBLE && op2
op2 = GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R);
result = (Z_DVAL_P(op1) < Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_SMALLER_OR_EQUAL, (op1_info == MAY_BE_LONG && op2_info == MAY_BE_LONG), ZEND_IS_SMALLER_OR_EQUAL_LONG, CONST|TMPVARCV, CONST|TMPVARCV, SPEC(SMART_BRANCH,NO_CONST_CONST))
@@ -9053,8 +8885,6 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_SMALLER_OR_EQUAL, (op1_info == MAY_BE_LONG
op2 = GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R);
result = (Z_LVAL_P(op1) <= Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_SMALLER_OR_EQUAL, (op1_info == MAY_BE_DOUBLE && op2_info == MAY_BE_DOUBLE), ZEND_IS_SMALLER_OR_EQUAL_DOUBLE, CONST|TMPVARCV, CONST|TMPVARCV, SPEC(SMART_BRANCH,NO_CONST_CONST))
@@ -9067,8 +8897,6 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_IS_SMALLER_OR_EQUAL, (op1_info == MAY_BE_DOUB
op2 = GET_OP2_ZVAL_PTR_UNDEF(BP_VAR_R);
result = (Z_DVAL_P(op1) <= Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_PRE_INC, (res_info == MAY_BE_LONG && op1_info == MAY_BE_LONG), ZEND_PRE_INC_LONG_NO_OVERFLOW, CV, ANY, SPEC(RETVAL))
@@ -9170,7 +8998,6 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_POST_DEC, (op1_info == MAY_BE_LONG), ZEND_POS
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_QM_ASSIGN, (op1_info == MAY_BE_LONG), ZEND_QM_ASSIGN_LONG, CONST|TMPVARCV, ANY)
{
USE_OPLINE
- zend_free_op free_op1;
zval *value;
value = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
@@ -9181,7 +9008,6 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_QM_ASSIGN, (op1_info == MAY_BE_LONG), ZEND_QM
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_QM_ASSIGN, (op1_info == MAY_BE_DOUBLE), ZEND_QM_ASSIGN_DOUBLE, CONST|TMPVARCV, ANY)
{
USE_OPLINE
- zend_free_op free_op1;
zval *value;
value = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
@@ -9192,7 +9018,6 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_QM_ASSIGN, (op1_info == MAY_BE_DOUBLE), ZEND_
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_QM_ASSIGN, ((op->op1_type == IS_CONST) ? !Z_REFCOUNTED_P(RT_CONSTANT(op, op->op1)) : (!(op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE))))), ZEND_QM_ASSIGN_NOREF, CONST|TMPVARCV, ANY)
{
USE_OPLINE
- zend_free_op free_op1;
zval *value;
value = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
@@ -9203,7 +9028,6 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_QM_ASSIGN, ((op->op1_type == IS_CONST) ? !Z_R
ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_FETCH_DIM_R, (!(op2_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF))), ZEND_FETCH_DIM_R_INDEX, CONST|TMPVAR|CV, CONST|TMPVARCV, SPEC(NO_CONST_CONST))
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container, *dim, *value;
zend_long offset;
HashTable *ht;
@@ -9257,7 +9081,6 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_SEND_VAR, (op1_info & (MAY_BE_UNDEF|MAY_BE_RE
{
USE_OPLINE
zval *varptr, *arg;
- zend_free_op free_op1;
varptr = GET_OP1_ZVAL_PTR_UNDEF(BP_VAR_R);
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
@@ -9275,7 +9098,6 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_SEND_VAR_EX, op->op2.num <= MAX_ARG_FLAG_NUM
{
USE_OPLINE
zval *varptr, *arg;
- zend_free_op free_op1;
uint32_t arg_num = opline->op2.num;
if (QUICK_ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
@@ -9298,7 +9120,6 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_SEND_VAL, op->op1_type == IS_CONST && !Z_REFC
{
USE_OPLINE
zval *value, *arg;
- zend_free_op free_op1;
value = GET_OP1_ZVAL_PTR(BP_VAR_R);
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
@@ -9310,7 +9131,6 @@ ZEND_VM_HOT_TYPE_SPEC_HANDLER(ZEND_SEND_VAL_EX, op->op2.num <= MAX_ARG_FLAG_NUM
{
USE_OPLINE
zval *value, *arg;
- zend_free_op free_op1;
uint32_t arg_num = opline->op2.num;
if (QUICK_ARG_MUST_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index 4da5094a79..b6a11e81d1 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -578,6 +578,7 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_shift_right_
static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_is_equal_helper_SPEC(zval *op_1, zval *op_2 ZEND_OPCODE_HANDLER_ARGS_DC)
{
+ int ret;
USE_OPLINE
SAVE_OPLINE();
@@ -587,29 +588,19 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_is_equal_hel
if (UNEXPECTED(Z_TYPE_INFO_P(op_2) == IS_UNDEF)) {
op_2 = ZVAL_UNDEFINED_OP2();
}
- compare_function(EX_VAR(opline->result.var), op_1, op_2);
+ ret = zend_compare(op_1, op_2);
if (opline->op1_type & (IS_TMP_VAR|IS_VAR)) {
zval_ptr_dtor_nogc(op_1);
}
if (opline->op2_type & (IS_TMP_VAR|IS_VAR)) {
zval_ptr_dtor_nogc(op_2);
}
- if (UNEXPECTED(EG(exception))) {
- HANDLE_EXCEPTION();
- }
- if (Z_LVAL_P(EX_VAR(opline->result.var)) == 0) {
- ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- } else {
- ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- }
+ ZEND_VM_SMART_BRANCH(ret == 0, 1);
}
static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_is_not_equal_helper_SPEC(zval *op_1, zval *op_2 ZEND_OPCODE_HANDLER_ARGS_DC)
{
+ int ret;
USE_OPLINE
SAVE_OPLINE();
@@ -619,29 +610,19 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_is_not_equal
if (UNEXPECTED(Z_TYPE_INFO_P(op_2) == IS_UNDEF)) {
op_2 = ZVAL_UNDEFINED_OP2();
}
- compare_function(EX_VAR(opline->result.var), op_1, op_2);
+ ret = zend_compare(op_1, op_2);
if (opline->op1_type & (IS_TMP_VAR|IS_VAR)) {
zval_ptr_dtor_nogc(op_1);
}
if (opline->op2_type & (IS_TMP_VAR|IS_VAR)) {
zval_ptr_dtor_nogc(op_2);
}
- if (UNEXPECTED(EG(exception))) {
- HANDLE_EXCEPTION();
- }
- if (Z_LVAL_P(EX_VAR(opline->result.var)) != 0) {
- ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- } else {
- ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- }
+ ZEND_VM_SMART_BRANCH(ret != 0, 1);
}
static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_is_smaller_helper_SPEC(zval *op_1, zval *op_2 ZEND_OPCODE_HANDLER_ARGS_DC)
{
+ int ret;
USE_OPLINE
SAVE_OPLINE();
@@ -651,29 +632,19 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_is_smaller_h
if (UNEXPECTED(Z_TYPE_INFO_P(op_2) == IS_UNDEF)) {
op_2 = ZVAL_UNDEFINED_OP2();
}
- compare_function(EX_VAR(opline->result.var), op_1, op_2);
+ ret = zend_compare(op_1, op_2);
if (opline->op1_type & (IS_TMP_VAR|IS_VAR)) {
zval_ptr_dtor_nogc(op_1);
}
if (opline->op2_type & (IS_TMP_VAR|IS_VAR)) {
zval_ptr_dtor_nogc(op_2);
}
- if (UNEXPECTED(EG(exception))) {
- HANDLE_EXCEPTION();
- }
- if (Z_LVAL_P(EX_VAR(opline->result.var)) < 0) {
- ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- } else {
- ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- }
+ ZEND_VM_SMART_BRANCH(ret < 0, 1);
}
static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_is_smaller_or_equal_helper_SPEC(zval *op_1, zval *op_2 ZEND_OPCODE_HANDLER_ARGS_DC)
{
+ int ret;
USE_OPLINE
SAVE_OPLINE();
@@ -683,25 +654,14 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_is_smaller_o
if (UNEXPECTED(Z_TYPE_INFO_P(op_2) == IS_UNDEF)) {
op_2 = ZVAL_UNDEFINED_OP2();
}
- compare_function(EX_VAR(opline->result.var), op_1, op_2);
+ ret = zend_compare(op_1, op_2);
if (opline->op1_type & (IS_TMP_VAR|IS_VAR)) {
zval_ptr_dtor_nogc(op_1);
}
if (opline->op2_type & (IS_TMP_VAR|IS_VAR)) {
zval_ptr_dtor_nogc(op_2);
}
- if (UNEXPECTED(EG(exception))) {
- HANDLE_EXCEPTION();
- }
- if (Z_LVAL_P(EX_VAR(opline->result.var)) <= 0) {
- ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- } else {
- ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- }
+ ZEND_VM_SMART_BRANCH(ret <= 0, 1);
}
static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_bw_or_helper_SPEC(zval *op_1, zval *op_2 ZEND_OPCODE_HANDLER_ARGS_DC)
@@ -767,6 +727,19 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_bw_xor_helpe
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
+static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_bw_not_helper_SPEC(zval *op_1 ZEND_OPCODE_HANDLER_ARGS_DC)
+{
+ USE_OPLINE
+
+ SAVE_OPLINE();
+ if (UNEXPECTED(Z_TYPE_P(op_1) == IS_UNDEF)) {
+ op_1 = ZVAL_UNDEFINED_OP1();
+ }
+ bitwise_not_function(EX_VAR(opline->result.var), op_1);
+ FREE_OP(opline->op1_type, opline->op1.var);
+ ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
+}
+
static zend_never_inline ZEND_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -797,7 +770,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_STATIC_PROP_OP_SPEC_HAN
/* This helper actually never will receive IS_VAR as second op, and has the same handling for VAR and TMP in the first op, but for interoperability with the other binary_assign_op helpers, it is necessary to "include" it */
USE_OPLINE
- zend_free_op free_op_data;
zval *prop, *value;
zend_property_info *prop_info;
zend_reference *ref;
@@ -811,7 +783,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_STATIC_PROP_OP_SPEC_HAN
HANDLE_EXCEPTION();
}
- value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data);
+ value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1);
do {
if (UNEXPECTED(Z_ISREF_P(prop))) {
@@ -823,7 +795,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_STATIC_PROP_OP_SPEC_HAN
}
}
- if (UNEXPECTED(prop_info->type)) {
+ if (UNEXPECTED(ZEND_TYPE_IS_SET(prop_info->type))) {
/* special case for typed properties */
zend_binary_assign_op_typed_prop(prop_info, prop, value OPLINE_CC EXECUTE_DATA_CC);
} else {
@@ -835,7 +807,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_STATIC_PROP_OP_SPEC_HAN
ZVAL_COPY(EX_VAR(opline->result.var), prop);
}
- FREE_OP(free_op_data);
+ FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
/* assign_static_prop has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -853,7 +825,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_STATIC_PROP_SPEC_HANDL
HANDLE_EXCEPTION();
}
- zend_pre_incdec_property_zval(prop, prop_info->type ? prop_info : NULL OPLINE_CC EXECUTE_DATA_CC);
+ zend_pre_incdec_property_zval(prop,
+ ZEND_TYPE_IS_SET(prop_info->type) ? prop_info : NULL OPLINE_CC EXECUTE_DATA_CC);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -872,7 +845,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_STATIC_PROP_SPEC_HAND
HANDLE_EXCEPTION();
}
- zend_post_incdec_property_zval(prop, prop_info->type ? prop_info : NULL OPLINE_CC EXECUTE_DATA_CC);
+ zend_post_incdec_property_zval(prop,
+ ZEND_TYPE_IS_SET(prop_info->type) ? prop_info : NULL OPLINE_CC EXECUTE_DATA_CC);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -964,7 +938,6 @@ static zend_never_inline ZEND_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_us
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_STATIC_PROP_SPEC_OP_DATA_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *prop, *value;
zend_property_info *prop_info;
@@ -978,7 +951,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_STATIC_PROP_SPEC_OP_DAT
value = RT_CONSTANT((opline+1), (opline+1)->op1);
- if (UNEXPECTED(prop_info->type)) {
+ if (UNEXPECTED(ZEND_TYPE_IS_SET(prop_info->type))) {
value = zend_assign_to_typed_prop(prop_info, prop, value EXECUTE_DATA_CC);
} else {
@@ -996,7 +969,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_STATIC_PROP_SPEC_OP_DAT
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_STATIC_PROP_SPEC_OP_DATA_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data;
zval *prop, *value;
zend_property_info *prop_info;
@@ -1008,11 +980,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_STATIC_PROP_SPEC_OP_DAT
HANDLE_EXCEPTION();
}
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
- if (UNEXPECTED(prop_info->type)) {
+ if (UNEXPECTED(ZEND_TYPE_IS_SET(prop_info->type))) {
value = zend_assign_to_typed_prop(prop_info, prop, value EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
} else {
value = zend_assign_to_variable(prop, value, IS_TMP_VAR, EX_USES_STRICT_TYPES());
}
@@ -1028,7 +1000,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_STATIC_PROP_SPEC_OP_DAT
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_STATIC_PROP_SPEC_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data;
zval *prop, *value;
zend_property_info *prop_info;
@@ -1040,11 +1011,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_STATIC_PROP_SPEC_OP_DAT
HANDLE_EXCEPTION();
}
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
- if (UNEXPECTED(prop_info->type)) {
+ if (UNEXPECTED(ZEND_TYPE_IS_SET(prop_info->type))) {
value = zend_assign_to_typed_prop(prop_info, prop, value EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
} else {
value = zend_assign_to_variable(prop, value, IS_VAR, EX_USES_STRICT_TYPES());
}
@@ -1060,7 +1031,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_STATIC_PROP_SPEC_OP_DAT
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_STATIC_PROP_SPEC_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *prop, *value;
zend_property_info *prop_info;
@@ -1074,7 +1044,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_STATIC_PROP_SPEC_OP_DAT
value = _get_zval_ptr_cv_BP_VAR_R((opline+1)->op1.var EXECUTE_DATA_CC);
- if (UNEXPECTED(prop_info->type)) {
+ if (UNEXPECTED(ZEND_TYPE_IS_SET(prop_info->type))) {
value = zend_assign_to_typed_prop(prop_info, prop, value EXECUTE_DATA_CC);
} else {
@@ -1092,7 +1062,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_STATIC_PROP_SPEC_OP_DAT
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_STATIC_PROP_REF_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data;
zval *prop, *value_ptr;
zend_property_info *prop_info;
@@ -1104,15 +1073,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_STATIC_PROP_REF_SPEC_HA
HANDLE_EXCEPTION();
}
- value_ptr = get_zval_ptr_ptr((opline+1)->op1_type, (opline+1)->op1, &free_op_data, BP_VAR_W);
+ value_ptr = get_zval_ptr_ptr((opline+1)->op1_type, (opline+1)->op1, BP_VAR_W);
- if ((opline+1)->op1_type == IS_VAR && UNEXPECTED(Z_ISERROR_P(value_ptr))) {
- prop = &EG(uninitialized_zval);
- } else if ((opline+1)->op1_type == IS_VAR && (opline->extended_value & ZEND_RETURNS_FUNCTION) && UNEXPECTED(!Z_ISREF_P(value_ptr))) {
+ if ((opline+1)->op1_type == IS_VAR && (opline->extended_value & ZEND_RETURNS_FUNCTION) && UNEXPECTED(!Z_ISREF_P(value_ptr))) {
if (UNEXPECTED(!zend_wrong_assign_to_variable_reference(prop, value_ptr OPLINE_CC EXECUTE_DATA_CC))) {
prop = &EG(uninitialized_zval);
}
- } else if (UNEXPECTED(prop_info->type)) {
+ } else if (UNEXPECTED(ZEND_TYPE_IS_SET(prop_info->type))) {
prop = zend_assign_to_typed_property_reference(prop_info, prop, value_ptr EXECUTE_DATA_CC);
} else {
zend_assign_to_variable_reference(prop, value_ptr);
@@ -1122,7 +1089,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_STATIC_PROP_REF_SPEC_HA
ZVAL_COPY(EX_VAR(opline->result.var), prop);
}
- if (free_op_data) {zval_ptr_dtor_nogc(free_op_data);};
+ if ((opline+1)->op1_type == IS_VAR) {zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));};
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -1263,6 +1230,10 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_ICALL_SPEC_RETV
call->prev_execute_data = execute_data;
EG(current_execute_data) = call;
+#if ZEND_DEBUG
+ zend_bool should_throw = zend_internal_call_should_throw(fbc, call);
+#endif
+
ret = 0 ? EX_VAR(opline->result.var) : &retval;
ZVAL_NULL(ret);
@@ -1270,6 +1241,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_ICALL_SPEC_RETV
#if ZEND_DEBUG
if (!EG(exception) && call->func) {
+ if (should_throw) {
+ zend_internal_call_arginfo_violation(call->func);
+ }
ZEND_ASSERT(!(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
zend_verify_internal_return_type(call->func, ret));
ZEND_ASSERT((call->func->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)
@@ -1308,6 +1282,10 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_ICALL_SPEC_RETV
call->prev_execute_data = execute_data;
EG(current_execute_data) = call;
+#if ZEND_DEBUG
+ zend_bool should_throw = zend_internal_call_should_throw(fbc, call);
+#endif
+
ret = 1 ? EX_VAR(opline->result.var) : &retval;
ZVAL_NULL(ret);
@@ -1315,6 +1293,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_ICALL_SPEC_RETV
#if ZEND_DEBUG
if (!EG(exception) && call->func) {
+ if (should_throw) {
+ zend_internal_call_arginfo_violation(call->func);
+ }
ZEND_ASSERT(!(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
zend_verify_internal_return_type(call->func, ret));
ZEND_ASSERT((call->func->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)
@@ -1426,15 +1407,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_FCALL_BY_NAME_S
call->prev_execute_data = execute_data;
EG(current_execute_data) = call;
- if (UNEXPECTED(fbc->common.fn_flags & ZEND_ACC_HAS_TYPE_HINTS)
- && UNEXPECTED(!zend_verify_internal_arg_types(fbc, call))) {
- UNDEF_RESULT();
- if (!0) {
- ret = &retval;
- ZVAL_UNDEF(ret);
- }
- goto fcall_by_name_end;
- }
+#if ZEND_DEBUG
+ zend_bool should_throw = zend_internal_call_should_throw(fbc, call);
+#endif
ret = 0 ? EX_VAR(opline->result.var) : &retval;
ZVAL_NULL(ret);
@@ -1443,6 +1418,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_FCALL_BY_NAME_S
#if ZEND_DEBUG
if (!EG(exception) && call->func) {
+ if (should_throw) {
+ zend_internal_call_arginfo_violation(call->func);
+ }
ZEND_ASSERT(!(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
zend_verify_internal_return_type(call->func, ret));
ZEND_ASSERT((call->func->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)
@@ -1510,15 +1488,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_FCALL_BY_NAME_S
call->prev_execute_data = execute_data;
EG(current_execute_data) = call;
- if (UNEXPECTED(fbc->common.fn_flags & ZEND_ACC_HAS_TYPE_HINTS)
- && UNEXPECTED(!zend_verify_internal_arg_types(fbc, call))) {
- UNDEF_RESULT();
- if (!1) {
- ret = &retval;
- ZVAL_UNDEF(ret);
- }
- goto fcall_by_name_end;
- }
+#if ZEND_DEBUG
+ zend_bool should_throw = zend_internal_call_should_throw(fbc, call);
+#endif
ret = 1 ? EX_VAR(opline->result.var) : &retval;
ZVAL_NULL(ret);
@@ -1527,6 +1499,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_FCALL_BY_NAME_S
#if ZEND_DEBUG
if (!EG(exception) && call->func) {
+ if (should_throw) {
+ zend_internal_call_arginfo_violation(call->func);
+ }
ZEND_ASSERT(!(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
zend_verify_internal_return_type(call->func, ret));
ZEND_ASSERT((call->func->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)
@@ -1559,27 +1534,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_FCALL_SPEC_RETV
zend_execute_data *call = EX(call);
zend_function *fbc = call->func;
zval *ret;
- zval retval;
SAVE_OPLINE();
EX(call) = call->prev_execute_data;
- if (UNEXPECTED((fbc->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) != 0)) {
- if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_ABSTRACT) != 0)) {
- zend_abstract_method(fbc);
-fcall_except:
- UNDEF_RESULT();
- if (!0) {
- ret = &retval;
- ZVAL_UNDEF(ret);
- }
- goto fcall_end;
- } else {
- zend_deprecated_function(fbc);
- if (UNEXPECTED(EG(exception) != NULL)) {
- goto fcall_except;
- }
- }
- }
if (EXPECTED(fbc->type == ZEND_USER_FUNCTION)) {
ret = NULL;
@@ -1601,14 +1558,28 @@ fcall_except:
ZEND_ADD_CALL_FLAG(call, ZEND_CALL_TOP);
zend_execute_ex(call);
}
- } else if (EXPECTED(fbc->type < ZEND_USER_FUNCTION)) {
+ } else {
+ zval retval;
+ ZEND_ASSERT(fbc->type == ZEND_INTERNAL_FUNCTION);
+
+ if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_DEPRECATED) != 0)) {
+ zend_deprecated_function(fbc);
+ if (UNEXPECTED(EG(exception) != NULL)) {
+ UNDEF_RESULT();
+ if (!0) {
+ ret = &retval;
+ ZVAL_UNDEF(ret);
+ }
+ goto fcall_end;
+ }
+ }
+
call->prev_execute_data = execute_data;
EG(current_execute_data) = call;
- if (UNEXPECTED(fbc->common.fn_flags & ZEND_ACC_HAS_TYPE_HINTS)
- && UNEXPECTED(!zend_verify_internal_arg_types(fbc, call))) {
- goto fcall_except;
- }
+#if ZEND_DEBUG
+ zend_bool should_throw = zend_internal_call_should_throw(fbc, call);
+#endif
ret = 0 ? EX_VAR(opline->result.var) : &retval;
ZVAL_NULL(ret);
@@ -1622,6 +1593,9 @@ fcall_except:
#if ZEND_DEBUG
if (!EG(exception) && call->func) {
+ if (should_throw) {
+ zend_internal_call_arginfo_violation(call->func);
+ }
ZEND_ASSERT(!(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
zend_verify_internal_return_type(call->func, ret));
ZEND_ASSERT((call->func->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)
@@ -1636,19 +1610,6 @@ fcall_end:
if (!0) {
i_zval_ptr_dtor(ret);
}
- } else { /* ZEND_OVERLOADED_FUNCTION */
- ret = 0 ? EX_VAR(opline->result.var) : &retval;
-
- call->prev_execute_data = execute_data;
-
- if (UNEXPECTED(!zend_do_fcall_overloaded(call, ret))) {
- UNDEF_RESULT();
- HANDLE_EXCEPTION();
- }
-
- if (!0) {
- zval_ptr_dtor(ret);
- }
}
if (UNEXPECTED(ZEND_CALL_INFO(call) & ZEND_CALL_RELEASE_THIS)) {
@@ -1671,27 +1632,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_FCALL_SPEC_RETV
zend_execute_data *call = EX(call);
zend_function *fbc = call->func;
zval *ret;
- zval retval;
SAVE_OPLINE();
EX(call) = call->prev_execute_data;
- if (UNEXPECTED((fbc->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) != 0)) {
- if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_ABSTRACT) != 0)) {
- zend_abstract_method(fbc);
-fcall_except:
- UNDEF_RESULT();
- if (!1) {
- ret = &retval;
- ZVAL_UNDEF(ret);
- }
- goto fcall_end;
- } else {
- zend_deprecated_function(fbc);
- if (UNEXPECTED(EG(exception) != NULL)) {
- goto fcall_except;
- }
- }
- }
if (EXPECTED(fbc->type == ZEND_USER_FUNCTION)) {
ret = NULL;
@@ -1713,14 +1656,28 @@ fcall_except:
ZEND_ADD_CALL_FLAG(call, ZEND_CALL_TOP);
zend_execute_ex(call);
}
- } else if (EXPECTED(fbc->type < ZEND_USER_FUNCTION)) {
+ } else {
+ zval retval;
+ ZEND_ASSERT(fbc->type == ZEND_INTERNAL_FUNCTION);
+
+ if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_DEPRECATED) != 0)) {
+ zend_deprecated_function(fbc);
+ if (UNEXPECTED(EG(exception) != NULL)) {
+ UNDEF_RESULT();
+ if (!1) {
+ ret = &retval;
+ ZVAL_UNDEF(ret);
+ }
+ goto fcall_end;
+ }
+ }
+
call->prev_execute_data = execute_data;
EG(current_execute_data) = call;
- if (UNEXPECTED(fbc->common.fn_flags & ZEND_ACC_HAS_TYPE_HINTS)
- && UNEXPECTED(!zend_verify_internal_arg_types(fbc, call))) {
- goto fcall_except;
- }
+#if ZEND_DEBUG
+ zend_bool should_throw = zend_internal_call_should_throw(fbc, call);
+#endif
ret = 1 ? EX_VAR(opline->result.var) : &retval;
ZVAL_NULL(ret);
@@ -1734,6 +1691,9 @@ fcall_except:
#if ZEND_DEBUG
if (!EG(exception) && call->func) {
+ if (should_throw) {
+ zend_internal_call_arginfo_violation(call->func);
+ }
ZEND_ASSERT(!(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
zend_verify_internal_return_type(call->func, ret));
ZEND_ASSERT((call->func->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)
@@ -1748,19 +1708,6 @@ fcall_end:
if (!1) {
i_zval_ptr_dtor(ret);
}
- } else { /* ZEND_OVERLOADED_FUNCTION */
- ret = 1 ? EX_VAR(opline->result.var) : &retval;
-
- call->prev_execute_data = execute_data;
-
- if (UNEXPECTED(!zend_do_fcall_overloaded(call, ret))) {
- UNDEF_RESULT();
- HANDLE_EXCEPTION();
- }
-
- if (!1) {
- zval_ptr_dtor(ret);
- }
}
if (UNEXPECTED(ZEND_CALL_INFO(call) & ZEND_CALL_RELEASE_THIS)) {
@@ -1870,12 +1817,11 @@ static zend_never_inline ZEND_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_ca
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_UNPACK_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *args;
int arg_num;
SAVE_OPLINE();
- args = get_zval_ptr_undef(opline->op1_type, opline->op1, &free_op1, BP_VAR_R);
+ args = get_zval_ptr_undef(opline->op1_type, opline->op1, BP_VAR_R);
arg_num = ZEND_CALL_NUM_ARGS(EX(call)) + 1;
send_again:
@@ -1906,7 +1852,7 @@ send_again:
ZEND_HASH_FOREACH_STR_KEY_VAL(ht, name, arg) {
if (name) {
zend_throw_error(NULL, "Cannot unpack array with string keys");
- FREE_OP(free_op1);
+ FREE_OP(opline->op1_type, opline->op1.var);
HANDLE_EXCEPTION();
}
@@ -1936,12 +1882,12 @@ send_again:
zend_object_iterator *iter;
if (!ce || !ce->get_iterator) {
- zend_error(E_WARNING, "Only arrays and Traversables can be unpacked");
+ zend_type_error("Only arrays and Traversables can be unpacked");
} else {
iter = ce->get_iterator(ce, args, 0);
if (UNEXPECTED(!iter)) {
- FREE_OP(free_op1);
+ FREE_OP(opline->op1_type, opline->op1.var);
if (!EG(exception)) {
zend_throw_exception_ex(
NULL, 0, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name)
@@ -2013,21 +1959,20 @@ send_again:
if (opline->op1_type == IS_CV && UNEXPECTED(Z_TYPE_P(args) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- zend_error(E_WARNING, "Only arrays and Traversables can be unpacked");
+ zend_type_error("Only arrays and Traversables can be unpacked");
}
- FREE_OP(free_op1);
+ FREE_OP(opline->op1_type, opline->op1.var);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_ARRAY_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *args;
SAVE_OPLINE();
- args = get_zval_ptr(opline->op1_type, opline->op1, &free_op1, BP_VAR_R);
+ args = get_zval_ptr(opline->op1_type, opline->op1, BP_VAR_R);
if (UNEXPECTED(Z_TYPE_P(args) != IS_ARRAY)) {
if ((opline->op1_type & (IS_VAR|IS_CV)) && Z_ISREF_P(args)) {
@@ -2036,16 +1981,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_ARRAY_SPEC_HANDLER(ZEND_O
goto send_array;
}
}
- zend_internal_type_error(EX_USES_STRICT_TYPES(), "call_user_func_array() expects parameter 2 to be array, %s given", zend_get_type_by_const(Z_TYPE_P(args)));
- if (ZEND_CALL_INFO(EX(call)) & ZEND_CALL_CLOSURE) {
- OBJ_RELEASE(ZEND_CLOSURE_OBJECT(EX(call)->func));
- } else if (ZEND_CALL_INFO(EX(call)) & ZEND_CALL_RELEASE_THIS) {
- OBJ_RELEASE(Z_OBJ(EX(call)->This));
- }
- EX(call)->func = (zend_function*)&zend_pass_function;
- Z_OBJ(EX(call)->This) = NULL;
- ZEND_CALL_INFO(EX(call)) &= ~(ZEND_CALL_RELEASE_THIS | ZEND_CALL_HAS_THIS);
+ zend_type_error("call_user_func_array() expects parameter 2 to be array, %s given", zend_get_type_by_const(Z_TYPE_P(args)));
FREE_UNFETCHED_OP(opline->op2_type, opline->op2.var);
+ FREE_OP(opline->op1_type, opline->op1.var);
+ HANDLE_EXCEPTION();
} else {
uint32_t arg_num;
HashTable *ht;
@@ -2055,8 +1994,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_ARRAY_SPEC_HANDLER(ZEND_O
send_array:
ht = Z_ARRVAL_P(args);
if (opline->op2_type != IS_UNUSED) {
- zend_free_op free_op2;
- zval *op2 = get_zval_ptr(opline->op2_type, opline->op2, &free_op2, BP_VAR_R);
+ zval *op2 = get_zval_ptr(opline->op2_type, opline->op2, BP_VAR_R);
uint32_t skip = opline->extended_value;
uint32_t count = zend_hash_num_elements(ht);
zend_long len = zval_get_long(op2);
@@ -2098,7 +2036,7 @@ send_array:
param++;
} ZEND_HASH_FOREACH_END();
}
- FREE_OP(free_op2);
+ FREE_OP(opline->op2_type, opline->op2.var);
} else {
zend_vm_stack_extend_call_frame(&EX(call), 0, zend_hash_num_elements(ht));
arg_num = 1;
@@ -2126,12 +2064,48 @@ send_array:
} ZEND_HASH_FOREACH_END();
}
}
- FREE_OP(free_op1);
+ FREE_OP(opline->op1_type, opline->op1.var);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
+static zend_never_inline ZEND_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_missing_arg_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS)
+{
+#ifdef ZEND_VM_IP_GLOBAL_REG
+ USE_OPLINE
+
+ SAVE_OPLINE();
+#endif
+ zend_missing_arg_error(execute_data);
+ HANDLE_EXCEPTION();
+}
+
+static zend_never_inline ZEND_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_verify_recv_arg_type_helper_SPEC(zval *op_1 ZEND_OPCODE_HANDLER_ARGS_DC)
+{
+ USE_OPLINE
+
+ SAVE_OPLINE();
+ if (UNEXPECTED(!zend_verify_recv_arg_type(EX(func), opline->op1.num, op_1, CACHE_ADDR(opline->extended_value)))) {
+ HANDLE_EXCEPTION();
+ }
+
+ ZEND_VM_NEXT_OPCODE();
+}
+
+static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RECV_NOTYPE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ uint32_t arg_num = opline->op1.num;
+
+ if (UNEXPECTED(arg_num > EX_NUM_ARGS())) {
+ ZEND_VM_TAIL_CALL(zend_missing_arg_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
+ }
+
+ ZEND_VM_NEXT_OPCODE();
+}
+
static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_case_helper_SPEC(zval *op_1, zval *op_2 ZEND_OPCODE_HANDLER_ARGS_DC)
{
+ int ret;
USE_OPLINE
SAVE_OPLINE();
@@ -2141,32 +2115,20 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_case_helper_
if (UNEXPECTED(Z_TYPE_INFO_P(op_2) == IS_UNDEF)) {
op_2 = ZVAL_UNDEFINED_OP2();
}
- compare_function(EX_VAR(opline->result.var), op_1, op_2);
+ ret = zend_compare(op_1, op_2);
if (opline->op2_type & (IS_TMP_VAR|IS_VAR)) {
zval_ptr_dtor_nogc(op_2);
}
- if (UNEXPECTED(EG(exception))) {
- HANDLE_EXCEPTION();
- }
- if (Z_LVAL_P(EX_VAR(opline->result.var)) == 0) {
- ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- } else {
- ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- }
+ ZEND_VM_SMART_BRANCH(ret == 0, 1);
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_UNPACK_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1;
SAVE_OPLINE();
- op1 = get_zval_ptr(opline->op1_type, opline->op1, &free_op1, BP_VAR_R);
+ op1 = get_zval_ptr(opline->op1_type, opline->op1, BP_VAR_R);
add_unpack_again:
if (EXPECTED(Z_TYPE_P(op1) == IS_ARRAY)) {
@@ -2177,7 +2139,7 @@ add_unpack_again:
ZEND_HASH_FOREACH_STR_KEY_VAL(ht, key, val) {
if (key) {
zend_throw_error(NULL, "Cannot unpack array with string keys");
- FREE_OP(free_op1);
+ FREE_OP(opline->op1_type, opline->op1.var);
HANDLE_EXCEPTION();
} else {
if (Z_ISREF_P(val) && Z_REFCOUNT_P(val) == 1) {
@@ -2196,11 +2158,11 @@ add_unpack_again:
zend_object_iterator *iter;
if (!ce || !ce->get_iterator) {
- zend_throw_error(NULL, "Only arrays and Traversables can be unpacked");
+ zend_type_error("Only arrays and Traversables can be unpacked");
} else {
iter = ce->get_iterator(ce, op1, 0);
if (UNEXPECTED(!iter)) {
- FREE_OP(free_op1);
+ FREE_OP(opline->op1_type, opline->op1.var);
if (!EG(exception)) {
zend_throw_exception_ex(
NULL, 0, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name)
@@ -2262,7 +2224,7 @@ add_unpack_again:
zend_throw_error(NULL, "Only arrays and Traversables can be unpacked");
}
- FREE_OP(free_op1);
+ FREE_OP(opline->op1_type, opline->op1.var);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -2272,7 +2234,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_STATIC_PROP
zval *varname;
zend_string *name, *tmp_name = NULL;
zend_class_entry *ce;
- zend_free_op free_op1;
SAVE_OPLINE();
@@ -2298,7 +2259,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_STATIC_PROP
ce = Z_CE_P(EX_VAR(opline->op2.var));
}
- varname = get_zval_ptr_undef(opline->op1_type, opline->op1, &free_op1, BP_VAR_R);
+ varname = get_zval_ptr_undef(opline->op1_type, opline->op1, BP_VAR_R);
if (opline->op1_type == IS_CONST) {
name = Z_STR_P(varname);
} else if (EXPECTED(Z_TYPE_P(varname) == IS_STRING)) {
@@ -2307,13 +2268,17 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_STATIC_PROP
if (opline->op1_type == IS_CV && UNEXPECTED(Z_TYPE_P(varname) == IS_UNDEF)) {
varname = ZVAL_UNDEFINED_OP1();
}
- name = zval_get_tmp_string(varname, &tmp_name);
+ name = zval_try_get_tmp_string(varname, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ FREE_OP(opline->op1_type, opline->op1.var);
+ HANDLE_EXCEPTION();
+ }
}
zend_std_unset_static_property(ce, name);
zend_tmp_string_release(tmp_name);
- FREE_OP(free_op1);
+ FREE_OP(opline->op1_type, opline->op1.var);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -2335,8 +2300,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_STATIC_PROP_SPEC
}
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_EXIT_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -2345,8 +2308,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_EXIT_SPEC_HANDLER
SAVE_OPLINE();
if (opline->op1_type != IS_UNUSED) {
- zend_free_op free_op1;
- zval *ptr = get_zval_ptr(opline->op1_type, opline->op1, &free_op1, BP_VAR_R);
+ zval *ptr = get_zval_ptr(opline->op1_type, opline->op1, BP_VAR_R);
do {
if (Z_TYPE_P(ptr) == IS_LONG) {
@@ -2362,7 +2324,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_EXIT_SPEC_HANDLER
zend_print_zval(ptr, 0);
}
} while (0);
- FREE_OP(free_op1);
+ FREE_OP(opline->op1_type, opline->op1.var);
}
zend_bailout();
ZEND_VM_NEXT_OPCODE(); /* Never reached */
@@ -2374,9 +2336,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BEGIN_SILENCE_SPEC_HANDLER(ZEN
ZVAL_LONG(EX_VAR(opline->result.var), EG(error_reporting));
- if (EG(error_reporting)) {
+ if (!E_HAS_ONLY_FATAL_ERRORS(EG(error_reporting))) {
do {
- EG(error_reporting) = 0;
+ /* Do not silence fatal errors */
+ EG(error_reporting) &= E_FATAL_ERRORS;
if (!EG(error_reporting_ini_entry)) {
zval *zv = zend_hash_find_ex(EG(ini_directives), ZSTR_KNOWN(ZEND_STR_ERROR_REPORTING), 1);
if (zv) {
@@ -2612,7 +2575,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(
break; /* return value is zend_class_entry pointer */
default:
- zval_ptr_dtor_nogc(EX_VAR(throw_op->result.var));
+ /* smart branch opcodes may not initialize result */
+ if (!zend_is_smart_branch(throw_op)) {
+ zval_ptr_dtor_nogc(EX_VAR(throw_op->result.var));
+ }
}
}
@@ -2796,14 +2762,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CALL_TRAMPOLINE_SPEC_HANDLER(Z
EG(current_execute_data) = call;
- if (UNEXPECTED(fbc->common.fn_flags & ZEND_ACC_HAS_TYPE_HINTS)
- && UNEXPECTED(!zend_verify_internal_arg_types(fbc, call))) {
- zend_vm_stack_free_call_frame(call);
- if (ret) {
- ZVAL_UNDEF(ret);
- }
- goto call_trampoline_end;
- }
+#if ZEND_DEBUG
+ zend_bool should_throw = zend_internal_call_should_throw(fbc, call);
+#endif
if (ret == NULL) {
ZVAL_NULL(&retval);
@@ -2819,6 +2780,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CALL_TRAMPOLINE_SPEC_HANDLER(Z
#if ZEND_DEBUG
if (!EG(exception) && call->func) {
+ if (should_throw) {
+ zend_internal_call_arginfo_violation(call->func);
+ }
ZEND_ASSERT(!(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
zend_verify_internal_return_type(call->func, ret));
ZEND_ASSERT((call->func->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)
@@ -2828,7 +2792,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CALL_TRAMPOLINE_SPEC_HANDLER(Z
EG(current_execute_data) = call->prev_execute_data;
-call_trampoline_end:
zend_vm_stack_free_args(call);
if (ret == &retval) {
zval_ptr_dtor(ret);
@@ -2908,7 +2871,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_DYNAMIC_CALL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *function_name;
zend_execute_data *call;
@@ -2919,7 +2881,7 @@ try_function_name:
if (IS_CONST != IS_CONST && EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
call = zend_init_dynamic_call_string(Z_STR_P(function_name), opline->extended_value);
} else if (IS_CONST != IS_CONST && EXPECTED(Z_TYPE_P(function_name) == IS_OBJECT)) {
- call = zend_init_dynamic_call_object(function_name, opline->extended_value);
+ call = zend_init_dynamic_call_object(Z_OBJ_P(function_name), opline->extended_value);
} else if (EXPECTED(Z_TYPE_P(function_name) == IS_ARRAY)) {
call = zend_init_dynamic_call_array(Z_ARRVAL_P(function_name), opline->extended_value);
} else if ((IS_CONST & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(function_name) == IS_REFERENCE)) {
@@ -2927,12 +2889,13 @@ try_function_name:
goto try_function_name;
} else {
if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(function_name) == IS_UNDEF)) {
- ZVAL_UNDEFINED_OP2();
+ function_name = ZVAL_UNDEFINED_OP2();
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
}
- zend_throw_error(NULL, "Function name must be a string");
+ zend_throw_error(NULL, "Value of type %s is not callable",
+ zend_get_type_by_const(Z_TYPE_P(function_name)));
call = NULL;
}
@@ -3061,10 +3024,8 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RECV_INIT_SPEC_CON
} else {
recv_init_check_type:
if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0)) {
- zval *default_value = RT_CONSTANT(opline, opline->op2);
-
SAVE_OPLINE();
- if (UNEXPECTED(!zend_verify_recv_arg_type(EX(func), arg_num, param, default_value, CACHE_ADDR(opline->extended_value)))) {
+ if (UNEXPECTED(!zend_verify_recv_arg_type(EX(func), arg_num, param, CACHE_ADDR(opline->extended_value)))) {
HANDLE_EXCEPTION();
}
}
@@ -3077,18 +3038,17 @@ recv_init_check_type:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_DYNAMIC_CALL_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *function_name;
zend_execute_data *call;
SAVE_OPLINE();
- function_name = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ function_name = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
try_function_name:
if ((IS_TMP_VAR|IS_VAR) != IS_CONST && EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
call = zend_init_dynamic_call_string(Z_STR_P(function_name), opline->extended_value);
} else if ((IS_TMP_VAR|IS_VAR) != IS_CONST && EXPECTED(Z_TYPE_P(function_name) == IS_OBJECT)) {
- call = zend_init_dynamic_call_object(function_name, opline->extended_value);
+ call = zend_init_dynamic_call_object(Z_OBJ_P(function_name), opline->extended_value);
} else if (EXPECTED(Z_TYPE_P(function_name) == IS_ARRAY)) {
call = zend_init_dynamic_call_array(Z_ARRVAL_P(function_name), opline->extended_value);
} else if (((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(function_name) == IS_REFERENCE)) {
@@ -3096,16 +3056,17 @@ try_function_name:
goto try_function_name;
} else {
if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_P(function_name) == IS_UNDEF)) {
- ZVAL_UNDEFINED_OP2();
+ function_name = ZVAL_UNDEFINED_OP2();
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
}
- zend_throw_error(NULL, "Function name must be a string");
+ zend_throw_error(NULL, "Value of type %s is not callable",
+ zend_get_type_by_const(Z_TYPE_P(function_name)));
call = NULL;
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (UNEXPECTED(!call)) {
HANDLE_EXCEPTION();
}
@@ -3133,18 +3094,16 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RECV_SPEC_UNUSED_H
{
USE_OPLINE
uint32_t arg_num = opline->op1.num;
+ zval *param;
if (UNEXPECTED(arg_num > EX_NUM_ARGS())) {
- SAVE_OPLINE();
- zend_missing_arg_error(execute_data);
- HANDLE_EXCEPTION();
- } else {
- zval *param = EX_VAR(opline->result.var);
+ ZEND_VM_TAIL_CALL(zend_missing_arg_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
+ }
- SAVE_OPLINE();
- if (UNEXPECTED(!zend_verify_recv_arg_type(EX(func), arg_num, param, NULL, CACHE_ADDR(opline->op2.num)))) {
- HANDLE_EXCEPTION();
- }
+ param = EX_VAR(opline->result.var);
+
+ if (UNEXPECTED(!(opline->op2.num & (1u << Z_TYPE_P(param))))) {
+ ZEND_VM_TAIL_CALL(zend_verify_recv_arg_type_helper_SPEC(param ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
}
ZEND_VM_NEXT_OPCODE();
@@ -3170,7 +3129,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RECV_VARIADIC_SPEC_UNUSED_HAND
param = EX_VAR_NUM(EX(func)->op_array.last_var + EX(func)->op_array.T);
if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0)) {
do {
- zend_verify_variadic_arg_type(EX(func), arg_num, param, NULL, CACHE_ADDR(opline->op2.num));
+ zend_verify_variadic_arg_type(EX(func), arg_num, param, CACHE_ADDR(opline->extended_value));
if (Z_OPT_REFCOUNTED_P(param)) Z_ADDREF_P(param);
ZEND_HASH_FILL_ADD(param);
param++;
@@ -3193,7 +3152,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RECV_VARIADIC_SPEC_UNUSED_HAND
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_DYNAMIC_CALL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *function_name;
zend_execute_data *call;
@@ -3204,7 +3162,7 @@ try_function_name:
if (IS_CV != IS_CONST && EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
call = zend_init_dynamic_call_string(Z_STR_P(function_name), opline->extended_value);
} else if (IS_CV != IS_CONST && EXPECTED(Z_TYPE_P(function_name) == IS_OBJECT)) {
- call = zend_init_dynamic_call_object(function_name, opline->extended_value);
+ call = zend_init_dynamic_call_object(Z_OBJ_P(function_name), opline->extended_value);
} else if (EXPECTED(Z_TYPE_P(function_name) == IS_ARRAY)) {
call = zend_init_dynamic_call_array(Z_ARRVAL_P(function_name), opline->extended_value);
} else if ((IS_CV & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(function_name) == IS_REFERENCE)) {
@@ -3212,12 +3170,13 @@ try_function_name:
goto try_function_name;
} else {
if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_P(function_name) == IS_UNDEF)) {
- ZVAL_UNDEFINED_OP2();
+ function_name = ZVAL_UNDEFINED_OP2();
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
}
- zend_throw_error(NULL, "Function name must be a string");
+ zend_throw_error(NULL, "Value of type %s is not callable",
+ zend_get_type_by_const(Z_TYPE_P(function_name)));
call = NULL;
}
@@ -3247,7 +3206,6 @@ try_function_name:
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_NOT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1;
op1 = RT_CONSTANT(opline, opline->op1);
@@ -3256,13 +3214,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_NOT_SPEC_CONST
ZEND_VM_NEXT_OPCODE();
}
- SAVE_OPLINE();
- if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(op1) == IS_UNDEF)) {
- op1 = ZVAL_UNDEFINED_OP1();
- }
- bitwise_not_function(EX_VAR(opline->result.var), op1);
-
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
+ ZEND_VM_TAIL_CALL(zend_bw_not_helper_SPEC(op1 ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
}
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_NOT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -3270,7 +3222,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_NOT_SPEC_CON
USE_OPLINE
zval *val;
-
val = RT_CONSTANT(opline, opline->op1);
if (Z_TYPE_INFO_P(val) == IS_TRUE) {
ZVAL_FALSE(EX_VAR(opline->result.var));
@@ -3295,7 +3246,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_NOT_SPEC_CON
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ECHO_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *z;
SAVE_OPLINE();
@@ -3324,8 +3274,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ECHO_SPEC_CONST_HANDLER(ZEND_O
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZ_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *val;
+ zend_uchar op1_type;
val = RT_CONSTANT(opline, opline->op1);
@@ -3343,20 +3293,23 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZ_SPEC_CONST_H
}
SAVE_OPLINE();
+ op1_type = IS_CONST;
if (i_zend_is_true(val)) {
opline++;
} else {
opline = OP_JMP_ADDR(opline, opline->op2);
}
-
+ if (op1_type & (IS_TMP_VAR|IS_VAR)) {
+ zval_ptr_dtor_nogc(val);
+ }
ZEND_VM_JMP(opline);
}
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPNZ_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *val;
+ zend_uchar op1_type;
val = RT_CONSTANT(opline, opline->op1);
@@ -3374,20 +3327,23 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPNZ_SPEC_CONST_
}
SAVE_OPLINE();
+ op1_type = IS_CONST;
if (i_zend_is_true(val)) {
opline = OP_JMP_ADDR(opline, opline->op2);
} else {
opline++;
}
-
+ if (op1_type & (IS_TMP_VAR|IS_VAR)) {
+ zval_ptr_dtor_nogc(val);
+ }
ZEND_VM_JMP(opline);
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZNZ_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *val;
+ zend_uchar op1_type;
val = RT_CONSTANT(opline, opline->op1);
@@ -3406,19 +3362,21 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZNZ_SPEC_CONST_HANDLER(ZEND
}
SAVE_OPLINE();
+ op1_type = IS_CONST;
if (i_zend_is_true(val)) {
opline = ZEND_OFFSET_TO_OPLINE(opline, opline->extended_value);
} else {
opline = OP_JMP_ADDR(opline, opline->op2);
}
-
+ if (op1_type & (IS_TMP_VAR|IS_VAR)) {
+ zval_ptr_dtor_nogc(val);
+ }
ZEND_VM_JMP(opline);
}
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZ_EX_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *val;
int ret;
@@ -3455,7 +3413,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZ_EX_SPEC_CONS
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPNZ_EX_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *val;
int ret;
@@ -3493,7 +3450,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_SPEC_CONST_
USE_OPLINE
zval *retval_ptr;
zval *return_value;
- zend_free_op free_op1;
retval_ptr = RT_CONSTANT(opline, opline->op1);
return_value = EX(return_value);
@@ -3505,9 +3461,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_SPEC_CONST_
}
} else if (!return_value) {
if (IS_CONST & (IS_VAR|IS_TMP_VAR)) {
- if (Z_REFCOUNTED_P(free_op1) && !Z_DELREF_P(free_op1)) {
+ if (Z_REFCOUNTED_P(retval_ptr) && !Z_DELREF_P(retval_ptr)) {
SAVE_OPLINE();
- rc_dtor_func(Z_COUNTED_P(free_op1));
+ rc_dtor_func(Z_COUNTED_P(retval_ptr));
}
}
} else {
@@ -3566,7 +3522,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_BY_REF_SPE
USE_OPLINE
zval *retval_ptr;
-
SAVE_OPLINE();
do {
@@ -3626,7 +3581,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GENERATOR_RETURN_SPEC_CONST_HA
USE_OPLINE
zval *retval;
-
zend_generator *generator = zend_get_running_generator(EXECUTE_DATA_C);
SAVE_OPLINE();
@@ -3670,7 +3624,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_THROW_SPEC_CONST_
USE_OPLINE
zval *value;
-
SAVE_OPLINE();
value = RT_CONSTANT(opline, opline->op1);
@@ -3695,10 +3648,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_THROW_SPEC_CONST_
} while (0);
zend_exception_save();
- if (IS_CONST != IS_TMP_VAR) {
- Z_TRY_ADDREF_P(value);
- }
-
+ Z_TRY_ADDREF_P(value);
zend_throw_exception_object(value);
zend_exception_restore();
@@ -3763,7 +3713,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAL_SPEC_CONS
USE_OPLINE
zval *value, *arg;
-
value = RT_CONSTANT(opline, opline->op1);
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
ZVAL_COPY_VALUE(arg, value);
@@ -3779,7 +3728,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAL_EX_SPEC_CONST_HANDLER
{
USE_OPLINE
zval *value, *arg;
-
uint32_t arg_num = opline->op2.num;
if (EXPECTED(0)) {
@@ -3805,7 +3753,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAL_EX_SPEC_C
{
USE_OPLINE
zval *value, *arg;
-
uint32_t arg_num = opline->op2.num;
if (EXPECTED(1)) {
@@ -3832,7 +3779,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_USER_SPEC_CONST_HANDLER(Z
USE_OPLINE
zval *arg, *param;
-
SAVE_OPLINE();
if (UNEXPECTED(ARG_MUST_BE_SENT_BY_REF(EX(call)->func, opline->op2.num))) {
@@ -3851,7 +3797,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_SPEC_CONST_H
USE_OPLINE
zval *val;
-
val = RT_CONSTANT(opline, opline->op1);
if (Z_TYPE_INFO_P(val) == IS_TRUE) {
ZVAL_TRUE(EX_VAR(opline->result.var));
@@ -3876,8 +3821,8 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_SPEC_CONST_H
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *obj;
+ zend_object *zobj;
zend_class_entry *ce, *scope;
zend_function *clone;
zend_object_clone_obj_t clone_call;
@@ -3885,10 +3830,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_CONST_
SAVE_OPLINE();
obj = RT_CONSTANT(opline, opline->op1);
- if (IS_CONST == IS_UNUSED && UNEXPECTED(Z_TYPE_P(obj) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
do {
if (IS_CONST == IS_CONST ||
(IS_CONST != IS_UNUSED && UNEXPECTED(Z_TYPE_P(obj) != IS_OBJECT))) {
@@ -3911,9 +3852,10 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_CONST_
}
} while (0);
- ce = Z_OBJCE_P(obj);
+ zobj = Z_OBJ_P(obj);
+ ce = zobj->ce;
clone = ce->clone;
- clone_call = Z_OBJ_HT_P(obj)->clone_obj;
+ clone_call = zobj->handlers->clone_obj;
if (UNEXPECTED(clone_call == NULL)) {
zend_throw_error(NULL, "Trying to clone an uncloneable object of class %s", ZSTR_VAL(ce->name));
@@ -3934,7 +3876,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_CONST_
}
}
- ZVAL_OBJ(EX_VAR(opline->result.var), clone_call(obj));
+ ZVAL_OBJ(EX_VAR(opline->result.var), clone_call(zobj));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -3942,7 +3884,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_CONST_
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CAST_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *expr;
zval *result = EX_VAR(opline->result.var);
HashTable *ht;
@@ -3951,12 +3892,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CAST_SPEC_CONST_H
expr = RT_CONSTANT(opline, opline->op1);
switch (opline->extended_value) {
- case IS_NULL:
- ZVAL_NULL(result);
- break;
- case _IS_BOOL:
- ZVAL_BOOL(result, zend_is_true(expr));
- break;
case IS_LONG:
ZVAL_LONG(result, zval_get_long(expr));
break;
@@ -3967,6 +3902,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CAST_SPEC_CONST_H
ZVAL_STR(result, zval_get_string(expr));
break;
default:
+ ZEND_ASSERT(opline->extended_value != _IS_BOOL && "Must use ZEND_BOOL instead");
if (IS_CONST & (IS_VAR|IS_CV)) {
ZVAL_DEREF(expr);
}
@@ -4009,6 +3945,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CAST_SPEC_CONST_H
}
}
} else {
+ ZEND_ASSERT(opline->extended_value == IS_OBJECT);
ZVAL_OBJ(result, zend_objects_new(zend_standard_class_def));
if (Z_TYPE_P(expr) == IS_ARRAY) {
ht = zend_symtable_to_proptable(Z_ARR_P(expr));
@@ -4036,7 +3973,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HAN
{
USE_OPLINE
zend_op_array *new_op_array;
-
zval *inc_filename;
SAVE_OPLINE();
@@ -4101,7 +4037,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HAN
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *array_ptr, *result;
SAVE_OPLINE();
@@ -4117,20 +4052,27 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_CONST_HANDLER(
ZEND_VM_NEXT_OPCODE();
} else if (IS_CONST != IS_CONST && EXPECTED(Z_TYPE_P(array_ptr) == IS_OBJECT)) {
- if (!Z_OBJCE_P(array_ptr)->get_iterator) {
+ zend_object *zobj = Z_OBJ_P(array_ptr);
+ if (!zobj->ce->get_iterator) {
+ HashTable *properties;
+
result = EX_VAR(opline->result.var);
- ZVAL_COPY_VALUE(result, array_ptr);
+ ZVAL_OBJ(result, zobj);
if (IS_CONST != IS_TMP_VAR) {
- Z_ADDREF_P(array_ptr);
+ GC_ADDREF(zobj);
}
- if (Z_OBJ_P(array_ptr)->properties
- && UNEXPECTED(GC_REFCOUNT(Z_OBJ_P(array_ptr)->properties) > 1)) {
- if (EXPECTED(!(GC_FLAGS(Z_OBJ_P(array_ptr)->properties) & IS_ARRAY_IMMUTABLE))) {
- GC_DELREF(Z_OBJ_P(array_ptr)->properties);
+ properties = zobj->properties;
+ if (properties) {
+ if (UNEXPECTED(GC_REFCOUNT(properties) > 1)) {
+ if (EXPECTED(!(GC_FLAGS(properties) & IS_ARRAY_IMMUTABLE))) {
+ GC_DELREF(properties);
+ }
+ properties = zobj->properties = zend_array_dup(properties);
}
- Z_OBJ_P(array_ptr)->properties = zend_array_dup(Z_OBJ_P(array_ptr)->properties);
+ } else {
+ properties = zobj->handlers->get_properties(zobj);
}
- Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_OBJPROP_P(array_ptr), 0);
+ Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(properties, 0);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
@@ -4156,7 +4098,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_CONST_HANDLER(
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *array_ptr, *array_ref;
SAVE_OPLINE();
@@ -4249,7 +4190,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMP_SET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *value;
zval *ref = NULL;
int ret;
@@ -4298,7 +4238,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMP_SET_SPEC_CONS
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COALESCE_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *value;
zval *ref = NULL;
@@ -4337,7 +4276,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COALESCE_SPEC_CON
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_QM_ASSIGN_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *value;
zval *result = EX_VAR(opline->result.var);
@@ -4385,12 +4323,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DECLARE_CLASS_SPEC_CONST_HANDL
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zend_generator *generator = zend_get_running_generator(EXECUTE_DATA_C);
-
zval *val;
-
SAVE_OPLINE();
val = RT_CONSTANT(opline, opline->op1);
@@ -4401,9 +4336,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_CONST_HANDLER(
HANDLE_EXCEPTION();
}
+yield_from_try_again:
if (Z_TYPE_P(val) == IS_ARRAY) {
ZVAL_COPY_VALUE(&generator->values, val);
- if (IS_CONST != IS_TMP_VAR && Z_OPT_REFCOUNTED_P(val)) {
+ if (Z_OPT_REFCOUNTED_P(val)) {
Z_ADDREF_P(val);
}
Z_FE_POS(generator->values) = 0;
@@ -4413,9 +4349,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_CONST_HANDLER(
if (ce == zend_ce_generator) {
zend_generator *new_gen = (zend_generator *) Z_OBJ_P(val);
- if (IS_CONST != IS_TMP_VAR) {
- Z_ADDREF_P(val);
- }
+ Z_ADDREF_P(val);
if (Z_ISUNDEF(new_gen->retval)) {
if (UNEXPECTED(zend_generator_get_current(new_gen) == generator)) {
@@ -4460,6 +4394,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_CONST_HANDLER(
ZVAL_OBJ(&generator->values, &iter->std);
}
+ } else if ((IS_CONST & (IS_VAR|IS_CV)) && Z_TYPE_P(val) == IS_REFERENCE) {
+ val = Z_REFVAL_P(val);
+ goto yield_from_try_again;
} else {
zend_throw_error(NULL, "Can use \"yield from\" only with arrays and Traversables");
UNDEF_RESULT();
@@ -4491,7 +4428,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_STRLEN_SPEC_CONST
USE_OPLINE
zval *value;
-
value = RT_CONSTANT(opline, opline->op1);
if (EXPECTED(Z_TYPE_P(value) == IS_STRING)) {
ZVAL_LONG(EX_VAR(opline->result.var), Z_STRLEN_P(value));
@@ -4528,9 +4464,9 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_STRLEN_SPEC_CONST
zval_ptr_dtor(&tmp);
}
if (!EG(exception)) {
- zend_internal_type_error(strict, "strlen() expects parameter 1 to be string, %s given", zend_get_type_by_const(Z_TYPE_P(value)));
+ zend_type_error("strlen() expects parameter 1 to be string, %s given", zend_get_type_by_const(Z_TYPE_P(value)));
}
- ZVAL_NULL(EX_VAR(opline->result.var));
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
} while (0);
}
@@ -4543,11 +4479,10 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_TYPE_CHECK_SPEC_C
zval *value;
int result = 0;
-
value = RT_CONSTANT(opline, opline->op1);
if ((opline->extended_value >> (uint32_t)Z_TYPE_P(value)) & 1) {
type_check_resource:
- if (EXPECTED(Z_TYPE_P(value) != IS_RESOURCE)
+ if (opline->extended_value != MAY_BE_RESOURCE
|| EXPECTED(NULL != zend_rsrc_list_get_rsrc_type(Z_RES_P(value)))) {
result = 1;
}
@@ -4569,12 +4504,8 @@ type_check_resource:
SAVE_OPLINE();
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
}
@@ -4588,13 +4519,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DEFINED_SPEC_CONST
if (!IS_SPECIAL_CACHE_VAL(c)) {
defined_true:
ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else if (EXPECTED(zend_hash_num_elements(EG(zend_constants)) == DECODE_SPECIAL_CACHE_NUM(c))) {
defined_false:
ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
}
if (zend_quick_check_constant(RT_CONSTANT(opline, opline->op1) OPLINE_CC EXECUTE_DATA_CC) != SUCCESS) {
@@ -4608,7 +4535,6 @@ defined_false:
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_QM_ASSIGN_LONG_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *value;
value = RT_CONSTANT(opline, opline->op1);
@@ -4619,7 +4545,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_QM_ASSIGN_LONG_SPE
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_QM_ASSIGN_DOUBLE_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *value;
value = RT_CONSTANT(opline, opline->op1);
@@ -4630,7 +4555,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_QM_ASSIGN_DOUBLE_S
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_QM_ASSIGN_NOREF_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *value;
value = RT_CONSTANT(opline, opline->op1);
@@ -4643,7 +4567,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAL_SIMPLE_SP
USE_OPLINE
zval *value, *arg;
-
value = RT_CONSTANT(opline, opline->op1);
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
ZVAL_COPY_VALUE(arg, value);
@@ -4654,7 +4577,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAL_EX_SIMPLE
{
USE_OPLINE
zval *value, *arg;
-
uint32_t arg_num = opline->op2.num;
if (QUICK_ARG_MUST_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
@@ -4669,7 +4591,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAL_EX_SIMPLE
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2, *result;
double d1, d2;
@@ -4708,7 +4629,6 @@ add_double:
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SUB_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2, *result;
double d1, d2;
@@ -4747,7 +4667,6 @@ sub_double:
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_MUL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2, *result;
double d1, d2;
@@ -4789,7 +4708,6 @@ mul_double:
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DIV_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
SAVE_OPLINE();
@@ -4804,7 +4722,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DIV_SPEC_CONST_CO
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_MOD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2, *result;
op1 = RT_CONSTANT(opline, opline->op1);
@@ -4832,7 +4749,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_MOD_SPEC_CONST_CO
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
op1 = RT_CONSTANT(opline, opline->op1);
@@ -4854,7 +4770,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SL_SPEC_CONST_CON
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
op1 = RT_CONSTANT(opline, opline->op1);
@@ -4874,7 +4789,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SR_SPEC_CONST_CON
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POW_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
SAVE_OPLINE();
@@ -4889,7 +4803,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POW_SPEC_CONST_CO
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
zend_bool result;
@@ -4900,14 +4813,11 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
zend_bool result;
@@ -4918,14 +4828,11 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -4938,13 +4845,9 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CON
if (EXPECTED(Z_LVAL_P(op1) == Z_LVAL_P(op2))) {
is_equal_true:
ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_equal_false:
ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -4988,7 +4891,6 @@ is_equal_double:
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -5001,13 +4903,9 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC
if (EXPECTED(Z_LVAL_P(op1) != Z_LVAL_P(op2))) {
is_not_equal_true:
ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_not_equal_false:
ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -5051,7 +4949,6 @@ is_not_equal_double:
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -5064,13 +4961,9 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_C
if (EXPECTED(Z_LVAL_P(op1) < Z_LVAL_P(op2))) {
is_smaller_true:
ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_smaller_false:
ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -5099,7 +4992,6 @@ is_smaller_double:
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -5147,7 +5039,6 @@ is_smaller_or_equal_double:
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SPACESHIP_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
SAVE_OPLINE();
@@ -5162,7 +5053,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SPACESHIP_SPEC_CO
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_OR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
op1 = RT_CONSTANT(opline, opline->op1);
@@ -5181,7 +5071,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_OR_SPEC_CONST_
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_AND_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
op1 = RT_CONSTANT(opline, opline->op1);
@@ -5200,7 +5089,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_AND_SPEC_CONST
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_XOR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
op1 = RT_CONSTANT(opline, opline->op1);
@@ -5219,7 +5107,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_XOR_SPEC_CONST
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
SAVE_OPLINE();
@@ -5234,7 +5121,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_CON
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container, *dim, *value;
SAVE_OPLINE();
@@ -5270,7 +5156,6 @@ fetch_dim_r_slow:
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
SAVE_OPLINE();
@@ -5303,19 +5188,12 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_AR
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
-
zval *offset;
void **cache_slot = NULL;
SAVE_OPLINE();
container = RT_CONSTANT(opline, opline->op1);
-
- if (IS_CONST == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
offset = RT_CONSTANT(opline, opline->op2);
if (IS_CONST == IS_CONST ||
@@ -5342,9 +5220,11 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value & ~ZEND_FETCH_REF /* FUNC_ARG fetch may contain it */);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -5369,10 +5249,10 @@ fetch_obj_r_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || (IS_CONST & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_r_copy;
@@ -5383,7 +5263,7 @@ fetch_obj_r_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -5395,11 +5275,22 @@ fetch_obj_r_fast_copy:
}
}
}
- } else if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
- ZVAL_UNDEFINED_OP2();
+ } else {
+ if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
+ ZVAL_UNDEFINED_OP2();
+ }
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_r_copy:
@@ -5418,19 +5309,12 @@ fetch_obj_r_finish:
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
-
zval *offset;
void **cache_slot = NULL;
SAVE_OPLINE();
container = RT_CONSTANT(opline, opline->op1);
-
- if (IS_CONST == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
offset = RT_CONSTANT(opline, opline->op2);
if (IS_CONST == IS_CONST ||
@@ -5450,9 +5334,11 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -5477,10 +5363,10 @@ fetch_obj_is_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || (IS_CONST & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_is_copy;
@@ -5491,7 +5377,7 @@ fetch_obj_is_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -5503,9 +5389,19 @@ fetch_obj_is_fast_copy:
}
}
}
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_is_copy:
@@ -5541,7 +5437,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_AR
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_LIST_R_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
SAVE_OPLINE();
@@ -5554,7 +5449,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_LIST_R_SPEC_CONST_CONST_
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
zend_string *op1_str, *op2_str, *str;
@@ -5676,7 +5570,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_
{
USE_OPLINE
zval *function_name;
- zend_free_op free_op1;
zval *object;
zend_function *fbc;
zend_class_entry *called_scope;
@@ -5688,10 +5581,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_
object = RT_CONSTANT(opline, opline->op1);
- if (IS_CONST == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
if (IS_CONST != IS_CONST) {
function_name = RT_CONSTANT(opline, opline->op2);
}
@@ -5771,7 +5660,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_
HANDLE_EXCEPTION();
}
if (IS_CONST == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE))) &&
EXPECTED(obj == orig_obj)) {
CACHE_POLYMORPHIC_PTR(opline->result.num, called_scope, fbc);
@@ -5801,9 +5689,12 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_
} else if (IS_CONST & (IS_VAR|IS_TMP_VAR|IS_CV)) {
if (IS_CONST == IS_CV) {
GC_ADDREF(obj); /* For $this pointer */
- } else if (free_op1 != object) {
- GC_ADDREF(obj); /* For $this pointer */
-
+ } else {
+ zval *free_op1 = EX_VAR(opline->op1.var);
+ if (free_op1 != object) {
+ GC_ADDREF(obj); /* For $this pointer */
+ zval_ptr_dtor_nogc(free_op1);
+ }
}
/* CV may be changed indirectly (e.g. when it's a reference) */
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS | ZEND_CALL_RELEASE_THIS;
@@ -5862,8 +5753,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
EXPECTED(CACHED_PTR(opline->result.num) == ce)) {
fbc = CACHED_PTR(opline->result.num + sizeof(void*));
} else if (IS_CONST != IS_UNUSED) {
-
-
function_name = RT_CONSTANT(opline, opline->op2);
if (IS_CONST != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
@@ -5879,7 +5768,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
HANDLE_EXCEPTION();
}
}
- zend_throw_error(NULL, "Function name must be a string");
+ zend_throw_error(NULL, "Method name must be a string");
HANDLE_EXCEPTION();
} while (0);
@@ -5899,7 +5788,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
HANDLE_EXCEPTION();
}
if (IS_CONST == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE)))) {
CACHE_POLYMORPHIC_PTR(opline->result.num, ce, fbc);
}
@@ -5930,13 +5818,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS;
} else {
zend_non_static_method_call(fbc);
- if (UNEXPECTED(EG(exception) != NULL)) {
- HANDLE_EXCEPTION();
- }
- goto check_parent_and_self;
+ HANDLE_EXCEPTION();
}
} else {
-check_parent_and_self:
/* previous opcode is ZEND_FETCH_CLASS */
if (IS_CONST == IS_UNUSED
&& ((opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_PARENT ||
@@ -5961,7 +5845,6 @@ check_parent_and_self:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *function_name;
zend_fcall_info_cache fcc;
char *error = NULL;
@@ -5973,16 +5856,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CONS
SAVE_OPLINE();
function_name = RT_CONSTANT(opline, opline->op2);
if (zend_is_callable_ex(function_name, NULL, 0, NULL, &fcc, &error)) {
+ ZEND_ASSERT(!error);
func = fcc.function_handler;
- if (error) {
- efree(error);
- /* This is the only soft error is_callable() can generate */
- zend_non_static_method_call(func);
- if (UNEXPECTED(EG(exception) != NULL)) {
-
- HANDLE_EXCEPTION();
- }
- }
object_or_called_scope = fcc.called_scope;
if (func->common.fn_flags & ZEND_ACC_CLOSURE) {
/* Delay closure destruction until its invocation */
@@ -6014,14 +5889,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CONS
init_func_run_time_cache(&func->op_array);
}
} else {
- zend_internal_type_error(EX_USES_STRICT_TYPES(), "%s() expects parameter 1 to be a valid callback, %s", Z_STRVAL_P(RT_CONSTANT(opline, opline->op1)), error);
+ zend_type_error("%s() expects parameter 1 to be a valid callback, %s", Z_STRVAL_P(RT_CONSTANT(opline, opline->op1)), error);
efree(error);
- if (UNEXPECTED(EG(exception))) {
- HANDLE_EXCEPTION();
- }
- func = (zend_function*)&zend_pass_function;
- object_or_called_scope = NULL;
+ HANDLE_EXCEPTION();
}
call = zend_vm_stack_push_call_frame(call_info,
@@ -6092,7 +5963,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_CONSTANT_SPEC_CONS
}
CACHE_POLYMORPHIC_PTR(opline->extended_value, ce, value);
} else {
- zend_throw_error(NULL, "Undefined class constant '%s'", Z_STRVAL_P(RT_CONSTANT(opline, opline->op2)));
+ zend_throw_error(NULL, "Undefined class constant '%s::%s'",
+ ZSTR_VAL(ce->name), Z_STRVAL_P(RT_CONSTANT(opline, opline->op2)));
ZVAL_UNDEF(EX_VAR(opline->result.var));
HANDLE_EXCEPTION();
}
@@ -6106,7 +5978,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_CONSTANT_SPEC_CONS
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *expr_ptr, new_expr;
SAVE_OPLINE();
@@ -6145,7 +6016,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_C
}
if (IS_CONST != IS_UNUSED) {
-
zval *offset = RT_CONSTANT(opline, opline->op2);
zend_string *str;
zend_ulong hval;
@@ -6225,7 +6095,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_CONST_HA
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
int result;
zend_ulong hval;
@@ -6260,6 +6129,10 @@ num_index_prop:
goto isset_again;
} else {
value = zend_find_array_dim_slow(ht, offset EXECUTE_DATA_CC);
+ if (UNEXPECTED(EG(exception))) {
+ result = 0;
+ goto isset_dim_obj_exit;
+ }
}
if (!(opline->extended_value & ZEND_ISEMPTY)) {
@@ -6271,8 +6144,6 @@ num_index_prop:
/* avoid exception check */
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
} else {
result = (value == NULL || !i_zend_is_true(value));
@@ -6298,25 +6169,18 @@ isset_dim_obj_exit:
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
int result;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
container = RT_CONSTANT(opline, opline->op1);
-
- if (IS_CONST == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
offset = RT_CONSTANT(opline, opline->op2);
if (IS_CONST == IS_CONST ||
@@ -6333,26 +6197,37 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PRO
}
}
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ result = 0;
+ goto isset_object_finish;
+ }
+ }
+
result =
(opline->extended_value & ZEND_ISEMPTY) ^
- Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY), ((IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+ Z_OBJ_HT_P(container)->has_property(Z_OBJ_P(container), name, (opline->extended_value & ZEND_ISEMPTY), ((IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
isset_object_finish:
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ARRAY_KEY_EXISTS_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *key, *subject;
HashTable *ht;
- uint32_t result;
+ zend_bool result;
SAVE_OPLINE();
@@ -6370,13 +6245,12 @@ array_key_exists_array:
goto array_key_exists_array;
}
}
- result = zend_array_key_exists_slow(subject, key OPLINE_CC EXECUTE_DATA_CC);
+ zend_array_key_exists_error(subject, key OPLINE_CC EXECUTE_DATA_CC);
+ result = 0;
}
- ZEND_VM_SMART_BRANCH(result == IS_TRUE, 1);
- Z_TYPE_INFO_P(EX_VAR(opline->result.var)) = result;
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
+ ZEND_VM_SMART_BRANCH(result, 1);
}
/* No specialization for op_types (CONST|TMPVAR|UNUSED|CV, ANY) */
@@ -6413,7 +6287,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DECLARE_CLASS_DELAYED_SPEC_CON
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DECLARE_CONST_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *name;
zval *val;
zend_constant c;
@@ -6461,8 +6334,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CONST_HANDLER
/* Set the new yielded value */
if (IS_CONST != IS_UNUSED) {
-
-
if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
/* Constants and temporary variables aren't yieldable by reference,
* but we still allow them with a notice. */
@@ -6530,26 +6401,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CONST_HANDLER
/* Set the new yielded key */
if (IS_CONST != IS_UNUSED) {
-
zval *key = RT_CONSTANT(opline, opline->op2);
-
- /* Consts, temporary variables and references need copying */
- if (IS_CONST == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_CONST == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_CONST & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
-
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_CONST == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
+ if ((IS_CONST & (IS_CV|IS_VAR)) && UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE) {
+ key = Z_REFVAL_P(key);
}
+ ZVAL_COPY(&generator->key, key);
if (Z_TYPE(generator->key) == IS_LONG
&& Z_LVAL(generator->key) > generator->largest_used_integer_key
@@ -6585,7 +6441,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CONST_HANDLER
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SWITCH_LONG_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op, *jump_zv;
HashTable *jumptable;
@@ -6614,7 +6469,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SWITCH_LONG_SPEC_
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SWITCH_STRING_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op, *jump_zv;
HashTable *jumptable;
@@ -6648,7 +6502,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SWITCH_STRING_SPE
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IN_ARRAY_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1;
HashTable *ht = Z_ARRVAL_P(RT_CONSTANT(opline, opline->op2));
zval *result;
@@ -6667,13 +6520,12 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IN_ARRAY_SPEC_CON
result = zend_hash_find_ex(ht, ZSTR_EMPTY_ALLOC(), 1);
} else {
zend_string *key;
- zval key_tmp, result_tmp, *val;
+ zval key_tmp, *val;
result = NULL;
ZEND_HASH_FOREACH_STR_KEY_VAL(ht, key, val) {
ZVAL_STR(&key_tmp, key);
- compare_function(&result_tmp, op1, &key_tmp);
- if (Z_LVAL(result_tmp) == 0) {
+ if (zend_compare(op1, &key_tmp) == 0) {
result = val;
break;
}
@@ -6681,14 +6533,11 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IN_ARRAY_SPEC_CON
}
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result != NULL);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_SPEC_CONST_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2, *result;
double d1, d2;
@@ -6727,7 +6576,6 @@ add_double:
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SUB_SPEC_CONST_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2, *result;
double d1, d2;
@@ -6766,7 +6614,6 @@ sub_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_MOD_SPEC_CONST_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2, *result;
op1 = RT_CONSTANT(opline, opline->op1);
@@ -6794,7 +6641,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_MOD_SPEC_CONST_TMPVARCV_HANDLE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SL_SPEC_CONST_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
op1 = RT_CONSTANT(opline, opline->op1);
@@ -6816,7 +6662,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SL_SPEC_CONST_TMPVARCV_HANDLER
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SR_SPEC_CONST_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
op1 = RT_CONSTANT(opline, opline->op1);
@@ -6836,7 +6681,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SR_SPEC_CONST_TMPVARCV_HANDLER
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_CONST_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -6848,14 +6692,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_CONST_TMPVARCV
if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_LONG)) {
if (EXPECTED(Z_LVAL_P(op1) < Z_LVAL_P(op2))) {
is_smaller_true:
-
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_TRUE_NONE();
} else {
is_smaller_false:
-
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_FALSE_NONE();
}
} else if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -6884,7 +6724,6 @@ is_smaller_double:
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_CONST_TMPVARCV_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -6897,13 +6736,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_CO
if (EXPECTED(Z_LVAL_P(op1) < Z_LVAL_P(op2))) {
is_smaller_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_smaller_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -6932,7 +6767,6 @@ is_smaller_double:
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_CONST_TMPVARCV_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -6945,13 +6779,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_CO
if (EXPECTED(Z_LVAL_P(op1) < Z_LVAL_P(op2))) {
is_smaller_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPNZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_smaller_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPNZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -6980,7 +6810,6 @@ is_smaller_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_CONST_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -6992,12 +6821,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_CONST
if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_LONG)) {
if (EXPECTED(Z_LVAL_P(op1) <= Z_LVAL_P(op2))) {
is_smaller_or_equal_true:
-
+ ZEND_VM_SMART_BRANCH_TRUE_NONE();
ZVAL_TRUE(EX_VAR(opline->result.var));
ZEND_VM_NEXT_OPCODE();
} else {
is_smaller_or_equal_false:
-
+ ZEND_VM_SMART_BRANCH_FALSE_NONE();
ZVAL_FALSE(EX_VAR(opline->result.var));
ZEND_VM_NEXT_OPCODE();
}
@@ -7028,7 +6857,6 @@ is_smaller_or_equal_double:
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_CONST_TMPVARCV_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -7076,7 +6904,6 @@ is_smaller_or_equal_double:
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_CONST_TMPVARCV_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -7166,9 +6993,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SPEC_CONST_TMP
op1 = RT_CONSTANT(opline, opline->op1);
op2 = EX_VAR(opline->op2.var);
result = (Z_LVAL_P(op1) < Z_LVAL_P(op2));
-
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_NONE(result, 0);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SPEC_CONST_TMPVARCV_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -7181,8 +7006,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SP
op2 = EX_VAR(opline->op2.var);
result = (Z_LVAL_P(op1) < Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SPEC_CONST_TMPVARCV_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -7195,8 +7018,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SP
op2 = EX_VAR(opline->op2.var);
result = (Z_LVAL_P(op1) < Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPNZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_SPEC_CONST_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -7208,9 +7029,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_SPEC_CONST_T
op1 = RT_CONSTANT(opline, opline->op1);
op2 = EX_VAR(opline->op2.var);
result = (Z_DVAL_P(op1) < Z_DVAL_P(op2));
-
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_NONE(result, 0);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_SPEC_CONST_TMPVARCV_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -7223,8 +7042,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_
op2 = EX_VAR(opline->op2.var);
result = (Z_DVAL_P(op1) < Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_SPEC_CONST_TMPVARCV_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -7237,8 +7054,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_
op2 = EX_VAR(opline->op2.var);
result = (Z_DVAL_P(op1) < Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPNZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_CONST_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -7250,9 +7065,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_
op1 = RT_CONSTANT(opline, opline->op1);
op2 = EX_VAR(opline->op2.var);
result = (Z_LVAL_P(op1) <= Z_LVAL_P(op2));
-
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_NONE(result, 0);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_CONST_TMPVARCV_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -7265,8 +7078,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA
op2 = EX_VAR(opline->op2.var);
result = (Z_LVAL_P(op1) <= Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_CONST_TMPVARCV_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -7279,8 +7090,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA
op2 = EX_VAR(opline->op2.var);
result = (Z_LVAL_P(op1) <= Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPNZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_CONST_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -7292,9 +7101,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPE
op1 = RT_CONSTANT(opline, opline->op1);
op2 = EX_VAR(opline->op2.var);
result = (Z_DVAL_P(op1) <= Z_DVAL_P(op2));
-
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_NONE(result, 0);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_CONST_TMPVARCV_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -7307,8 +7114,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA
op2 = EX_VAR(opline->op2.var);
result = (Z_DVAL_P(op1) <= Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_CONST_TMPVARCV_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -7321,14 +7126,11 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA
op2 = EX_VAR(opline->op2.var);
result = (Z_DVAL_P(op1) <= Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPNZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_R_INDEX_SPEC_CONST_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container, *dim, *value;
zend_long offset;
HashTable *ht;
@@ -7381,41 +7183,38 @@ fetch_dim_r_index_undef:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DIV_SPEC_CONST_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *op1, *op2;
SAVE_OPLINE();
op1 = RT_CONSTANT(opline, opline->op1);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
fast_div_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POW_SPEC_CONST_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *op1, *op2;
SAVE_OPLINE();
op1 = RT_CONSTANT(opline, opline->op1);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
pow_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_CONST_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *op1, *op2;
op1 = RT_CONSTANT(opline, opline->op1);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if ((IS_CONST == IS_CONST || EXPECTED(Z_TYPE_P(op1) == IS_STRING)) &&
((IS_TMP_VAR|IS_VAR) == IS_CONST || EXPECTED(Z_TYPE_P(op2) == IS_STRING))) {
@@ -7475,7 +7274,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_CONST_TMPVAR_HANDL
}
concat_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
}
@@ -7483,27 +7282,25 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_CONST_TMPVAR_HANDL
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SPACESHIP_SPEC_CONST_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *op1, *op2;
SAVE_OPLINE();
op1 = RT_CONSTANT(opline, opline->op1);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
compare_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CONST_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *container, *dim, *value;
SAVE_OPLINE();
container = RT_CONSTANT(opline, opline->op1);
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (IS_CONST != IS_CONST) {
if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
fetch_dim_r_array:
@@ -7526,7 +7323,7 @@ fetch_dim_r_slow:
} else {
zend_fetch_dimension_address_read_R(container, dim, (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -7534,13 +7331,12 @@ fetch_dim_r_slow:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_CONST_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *container;
SAVE_OPLINE();
container = RT_CONSTANT(opline, opline->op1);
- zend_fetch_dimension_address_read_IS(container, _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op2);
+ zend_fetch_dimension_address_read_IS(container, _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -7567,20 +7363,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CONST_
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CONST_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
- zend_free_op free_op2;
zval *offset;
void **cache_slot = NULL;
SAVE_OPLINE();
container = RT_CONSTANT(opline, opline->op1);
-
- if (IS_CONST == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (IS_CONST == IS_CONST ||
(IS_CONST != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT))) {
@@ -7606,9 +7395,11 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value & ~ZEND_FETCH_REF /* FUNC_ARG fetch may contain it */);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -7633,10 +7424,10 @@ fetch_obj_r_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || (IS_CONST & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_r_copy;
@@ -7647,7 +7438,7 @@ fetch_obj_r_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -7659,11 +7450,22 @@ fetch_obj_r_fast_copy:
}
}
}
- } else if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
- ZVAL_UNDEFINED_OP2();
+ } else {
+ if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
+ ZVAL_UNDEFINED_OP2();
+ }
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_r_copy:
@@ -7674,7 +7476,7 @@ fetch_obj_r_copy:
} while (0);
fetch_obj_r_finish:
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -7682,20 +7484,13 @@ fetch_obj_r_finish:
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CONST_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
- zend_free_op free_op2;
zval *offset;
void **cache_slot = NULL;
SAVE_OPLINE();
container = RT_CONSTANT(opline, opline->op1);
-
- if (IS_CONST == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (IS_CONST == IS_CONST ||
(IS_CONST != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT))) {
@@ -7714,9 +7509,11 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -7741,10 +7538,10 @@ fetch_obj_is_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || (IS_CONST & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_is_copy;
@@ -7755,7 +7552,7 @@ fetch_obj_is_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -7767,9 +7564,19 @@ fetch_obj_is_fast_copy:
}
}
}
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_is_copy:
@@ -7780,7 +7587,7 @@ fetch_obj_is_copy:
} while (0);
fetch_obj_is_finish:
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -7805,26 +7612,24 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_AR
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_LIST_R_SPEC_CONST_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *container;
SAVE_OPLINE();
container = RT_CONSTANT(opline, opline->op1);
- zend_fetch_dimension_address_LIST_r(container, _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op2);
+ zend_fetch_dimension_address_LIST_r(container, _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_CONST_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *op1, *op2;
zend_string *op1_str, *op2_str, *str;
op1 = RT_CONSTANT(opline, opline->op1);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if ((IS_CONST == IS_CONST || EXPECTED(Z_TYPE_P(op1) == IS_STRING)) &&
((IS_TMP_VAR|IS_VAR) == IS_CONST || EXPECTED(Z_TYPE_P(op2) == IS_STRING))) {
zend_string *op1_str = Z_STR_P(op1);
@@ -7932,7 +7737,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_CONST_TMPVAR_
}
} while (0);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -7940,7 +7745,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_
{
USE_OPLINE
zval *function_name;
- zend_free_op free_op1, free_op2;
zval *object;
zend_function *fbc;
zend_class_entry *called_scope;
@@ -7952,12 +7756,8 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_
object = RT_CONSTANT(opline, opline->op1);
- if (IS_CONST == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
- function_name = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ function_name = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
}
if ((IS_TMP_VAR|IS_VAR) != IS_CONST &&
@@ -7976,7 +7776,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_
}
}
zend_throw_error(NULL, "Method name must be a string");
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
HANDLE_EXCEPTION();
} while (0);
@@ -7995,16 +7795,16 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_
object = ZVAL_UNDEFINED_OP1();
if (UNEXPECTED(EG(exception) != NULL)) {
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
}
HANDLE_EXCEPTION();
}
}
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
- function_name = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ function_name = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
}
zend_invalid_method_call(object, function_name);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
HANDLE_EXCEPTION();
}
@@ -8021,7 +7821,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_
zend_object *orig_obj = obj;
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
- function_name = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ function_name = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
}
/* First, locate the function. */
@@ -8030,12 +7830,11 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_
if (EXPECTED(!EG(exception))) {
zend_undefined_method(obj->ce, Z_STR_P(function_name));
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
HANDLE_EXCEPTION();
}
if ((IS_TMP_VAR|IS_VAR) == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE))) &&
EXPECTED(obj == orig_obj)) {
CACHE_POLYMORPHIC_PTR(opline->result.num, called_scope, fbc);
@@ -8050,7 +7849,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_
}
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
}
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS;
@@ -8065,9 +7864,12 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_
} else if (IS_CONST & (IS_VAR|IS_TMP_VAR|IS_CV)) {
if (IS_CONST == IS_CV) {
GC_ADDREF(obj); /* For $this pointer */
- } else if (free_op1 != object) {
- GC_ADDREF(obj); /* For $this pointer */
-
+ } else {
+ zval *free_op1 = EX_VAR(opline->op1.var);
+ if (free_op1 != object) {
+ GC_ADDREF(obj); /* For $this pointer */
+ zval_ptr_dtor_nogc(free_op1);
+ }
}
/* CV may be changed indirectly (e.g. when it's a reference) */
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS | ZEND_CALL_RELEASE_THIS;
@@ -8126,9 +7928,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
EXPECTED(CACHED_PTR(opline->result.num) == ce)) {
fbc = CACHED_PTR(opline->result.num + sizeof(void*));
} else if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED) {
- zend_free_op free_op2;
-
- function_name = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ function_name = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
do {
@@ -8143,8 +7943,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
HANDLE_EXCEPTION();
}
}
- zend_throw_error(NULL, "Function name must be a string");
- zval_ptr_dtor_nogc(free_op2);
+ zend_throw_error(NULL, "Method name must be a string");
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
HANDLE_EXCEPTION();
} while (0);
}
@@ -8159,11 +7959,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
if (EXPECTED(!EG(exception))) {
zend_undefined_method(ce, Z_STR_P(function_name));
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
HANDLE_EXCEPTION();
}
if ((IS_TMP_VAR|IS_VAR) == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE)))) {
CACHE_POLYMORPHIC_PTR(opline->result.num, ce, fbc);
}
@@ -8171,7 +7970,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
init_func_run_time_cache(&fbc->op_array);
}
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
}
} else {
if (UNEXPECTED(ce->constructor == NULL)) {
@@ -8194,13 +7993,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS;
} else {
zend_non_static_method_call(fbc);
- if (UNEXPECTED(EG(exception) != NULL)) {
- HANDLE_EXCEPTION();
- }
- goto check_parent_and_self;
+ HANDLE_EXCEPTION();
}
} else {
-check_parent_and_self:
/* previous opcode is ZEND_FETCH_CLASS */
if (IS_CONST == IS_UNUSED
&& ((opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_PARENT ||
@@ -8225,7 +8020,6 @@ check_parent_and_self:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *function_name;
zend_fcall_info_cache fcc;
char *error = NULL;
@@ -8235,18 +8029,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_TMPV
uint32_t call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_DYNAMIC;
SAVE_OPLINE();
- function_name = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ function_name = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (zend_is_callable_ex(function_name, NULL, 0, NULL, &fcc, &error)) {
+ ZEND_ASSERT(!error);
func = fcc.function_handler;
- if (error) {
- efree(error);
- /* This is the only soft error is_callable() can generate */
- zend_non_static_method_call(func);
- if (UNEXPECTED(EG(exception) != NULL)) {
- zval_ptr_dtor_nogc(free_op2);
- HANDLE_EXCEPTION();
- }
- }
object_or_called_scope = fcc.called_scope;
if (func->common.fn_flags & ZEND_ACC_CLOSURE) {
/* Delay closure destruction until its invocation */
@@ -8265,7 +8051,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_TMPV
call_info |= ZEND_CALL_RELEASE_THIS | ZEND_CALL_HAS_THIS;
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) && UNEXPECTED(EG(exception))) {
if (call_info & ZEND_CALL_CLOSURE) {
zend_object_release(ZEND_CLOSURE_OBJECT(func));
@@ -8279,14 +8065,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_TMPV
init_func_run_time_cache(&func->op_array);
}
} else {
- zend_internal_type_error(EX_USES_STRICT_TYPES(), "%s() expects parameter 1 to be a valid callback, %s", Z_STRVAL_P(RT_CONSTANT(opline, opline->op1)), error);
+ zend_type_error("%s() expects parameter 1 to be a valid callback, %s", Z_STRVAL_P(RT_CONSTANT(opline, opline->op1)), error);
efree(error);
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(EG(exception))) {
- HANDLE_EXCEPTION();
- }
- func = (zend_function*)&zend_pass_function;
- object_or_called_scope = NULL;
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ HANDLE_EXCEPTION();
}
call = zend_vm_stack_push_call_frame(call_info,
@@ -8300,7 +8082,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_TMPV
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *expr_ptr, new_expr;
SAVE_OPLINE();
@@ -8339,8 +8120,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_T
}
if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED) {
- zend_free_op free_op2;
- zval *offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ zval *offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
zend_string *str;
zend_ulong hval;
@@ -8385,7 +8165,7 @@ num_index:
zend_illegal_offset();
zval_ptr_dtor_nogc(expr_ptr);
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
} else {
if (!zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr)) {
zend_cannot_add_element();
@@ -8419,7 +8199,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_TMPVAR_H
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CONST_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *container;
int result;
zend_ulong hval;
@@ -8427,7 +8206,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CON
SAVE_OPLINE();
container = RT_CONSTANT(opline, opline->op1);
- offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
HashTable *ht;
@@ -8454,6 +8233,10 @@ num_index_prop:
goto isset_again;
} else {
value = zend_find_array_dim_slow(ht, offset EXECUTE_DATA_CC);
+ if (UNEXPECTED(EG(exception))) {
+ result = 0;
+ goto isset_dim_obj_exit;
+ }
}
if (!(opline->extended_value & ZEND_ISEMPTY)) {
@@ -8463,10 +8246,8 @@ num_index_prop:
if (IS_CONST & (IS_CONST|IS_CV)) {
/* avoid exception check */
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
} else {
result = (value == NULL || !i_zend_is_true(value));
@@ -8489,29 +8270,22 @@ num_index_prop:
}
isset_dim_obj_exit:
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CONST_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *container;
int result;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
container = RT_CONSTANT(opline, opline->op1);
-
- if (IS_CONST == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (IS_CONST == IS_CONST ||
(IS_CONST != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT))) {
@@ -8527,31 +8301,42 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PRO
}
}
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ result = 0;
+ goto isset_object_finish;
+ }
+ }
+
result =
(opline->extended_value & ZEND_ISEMPTY) ^
- Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+ Z_OBJ_HT_P(container)->has_property(Z_OBJ_P(container), name, (opline->extended_value & ZEND_ISEMPTY), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
isset_object_finish:
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ARRAY_KEY_EXISTS_SPEC_CONST_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *key, *subject;
HashTable *ht;
- uint32_t result;
+ zend_bool result;
SAVE_OPLINE();
key = RT_CONSTANT(opline, opline->op1);
- subject = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ subject = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(subject) == IS_ARRAY)) {
array_key_exists_array:
@@ -8564,158 +8349,17 @@ array_key_exists_array:
goto array_key_exists_array;
}
}
- result = zend_array_key_exists_slow(subject, key OPLINE_CC EXECUTE_DATA_CC);
+ zend_array_key_exists_error(subject, key OPLINE_CC EXECUTE_DATA_CC);
+ result = 0;
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
- ZEND_VM_SMART_BRANCH(result == IS_TRUE, 1);
- Z_TYPE_INFO_P(EX_VAR(opline->result.var)) = result;
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
+ ZEND_VM_SMART_BRANCH(result, 1);
}
/* No specialization for op_types (CONST|TMPVAR|UNUSED|CV, ANY) */
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
-
- zend_generator *generator = zend_get_running_generator(EXECUTE_DATA_C);
-
- SAVE_OPLINE();
- if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
- ZEND_VM_TAIL_CALL(zend_yield_in_closed_generator_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- /* Destroy the previously yielded value */
- zval_ptr_dtor(&generator->value);
-
- /* Destroy the previously yielded key */
- zval_ptr_dtor(&generator->key);
-
- /* Set the new yielded value */
- if (IS_CONST != IS_UNUSED) {
-
-
- if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
- /* Constants and temporary variables aren't yieldable by reference,
- * but we still allow them with a notice. */
- if (IS_CONST & (IS_CONST|IS_TMP_VAR)) {
- zval *value;
-
- zend_error(E_NOTICE, "Only variable references should be yielded by reference");
-
- value = RT_CONSTANT(opline, opline->op1);
- ZVAL_COPY_VALUE(&generator->value, value);
- if (IS_CONST == IS_CONST) {
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->value))) {
- Z_ADDREF(generator->value);
- }
- }
- } else {
- zval *value_ptr = NULL;
-
- /* If a function call result is yielded and the function did
- * not return by reference we throw a notice. */
- do {
- if (IS_CONST == IS_VAR) {
- ZEND_ASSERT(value_ptr != &EG(uninitialized_zval));
- if (opline->extended_value == ZEND_RETURNS_FUNCTION
- && !Z_ISREF_P(value_ptr)) {
- zend_error(E_NOTICE, "Only variable references should be yielded by reference");
- ZVAL_COPY(&generator->value, value_ptr);
- break;
- }
- }
- if (Z_ISREF_P(value_ptr)) {
- Z_ADDREF_P(value_ptr);
- } else {
- ZVAL_MAKE_REF_EX(value_ptr, 2);
- }
- ZVAL_REF(&generator->value, Z_REF_P(value_ptr));
- } while (0);
-
- }
- } else {
- zval *value = RT_CONSTANT(opline, opline->op1);
-
- /* Consts, temporary variables and references need copying */
- if (IS_CONST == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->value, value);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->value))) {
- Z_ADDREF(generator->value);
- }
- } else if (IS_CONST == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->value, value);
- } else if ((IS_CONST & (IS_VAR|IS_CV)) && Z_ISREF_P(value)) {
- ZVAL_COPY(&generator->value, Z_REFVAL_P(value));
-
- } else {
- ZVAL_COPY_VALUE(&generator->value, value);
- if (IS_CONST == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
- }
- }
- }
- } else {
- /* If no value was specified yield null */
- ZVAL_NULL(&generator->value);
- }
-
- /* Set the new yielded key */
- if (IS_TMP_VAR != IS_UNUSED) {
- zend_free_op free_op2;
- zval *key = _get_zval_ptr_tmp(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
-
- /* Consts, temporary variables and references need copying */
- if (IS_TMP_VAR == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_TMP_VAR == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_TMP_VAR & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
-
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_TMP_VAR == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
- }
-
- if (Z_TYPE(generator->key) == IS_LONG
- && Z_LVAL(generator->key) > generator->largest_used_integer_key
- ) {
- generator->largest_used_integer_key = Z_LVAL(generator->key);
- }
- } else {
- /* If no key was specified we use auto-increment keys */
- generator->largest_used_integer_key++;
- ZVAL_LONG(&generator->key, generator->largest_used_integer_key);
- }
-
- if (RETURN_VALUE_USED(opline)) {
- /* If the return value of yield is used set the send
- * target and initialize it to NULL */
- generator->send_target = EX_VAR(opline->result.var);
- ZVAL_NULL(generator->send_target);
- } else {
- generator->send_target = NULL;
- }
-
- /* We increment to the next op, so we are at the correct position when the
- * generator is resumed. */
- ZEND_VM_INC_OPCODE();
-
- /* The GOTO VM uses a local opline variable. We need to set the opline
- * variable in execute_data so we don't resume at an old position. */
- SAVE_OPLINE();
-
- ZEND_VM_RETURN();
-}
-
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -8734,8 +8378,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_VAR_HANDLER(Z
/* Set the new yielded value */
if (IS_CONST != IS_UNUSED) {
-
-
if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
/* Constants and temporary variables aren't yieldable by reference,
* but we still allow them with a notice. */
@@ -8802,27 +8444,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_VAR_HANDLER(Z
}
/* Set the new yielded key */
- if (IS_VAR != IS_UNUSED) {
- zend_free_op free_op2;
- zval *key = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
-
- /* Consts, temporary variables and references need copying */
- if (IS_VAR == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_VAR == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_VAR & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
- zval_ptr_dtor_nogc(free_op2);
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_VAR == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
+ if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED) {
+ zval *key = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ if (((IS_TMP_VAR|IS_VAR) & (IS_CV|IS_VAR)) && UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE) {
+ key = Z_REFVAL_P(key);
}
+ ZVAL_COPY(&generator->key, key);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (Z_TYPE(generator->key) == IS_LONG
&& Z_LVAL(generator->key) > generator->largest_used_integer_key
@@ -8858,7 +8486,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_VAR_HANDLER(Z
static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_UNUSED(int type ZEND_OPCODE_HANDLER_ARGS_DC)
{
USE_OPLINE
-
zval *varname;
zval *retval;
zend_string *name, *tmp_name;
@@ -8900,7 +8527,7 @@ fetch_this:
} else if (type == BP_VAR_IS) {
retval = &EG(uninitialized_zval);
} else {
- zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name));
+ zend_error(E_WARNING, "Undefined variable: %s", ZSTR_VAL(name));
if (type == BP_VAR_RW) {
retval = zend_hash_update(target_symbol_table, name, &EG(uninitialized_zval));
} else {
@@ -8919,7 +8546,7 @@ fetch_this:
} else if (type == BP_VAR_IS) {
retval = &EG(uninitialized_zval);
} else {
- zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name));
+ zend_error(E_WARNING, "Undefined variable: %s", ZSTR_VAL(name));
if (type == BP_VAR_RW) {
ZVAL_NULL(retval);
} else {
@@ -9044,8 +8671,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
EXPECTED(CACHED_PTR(opline->result.num) == ce)) {
fbc = CACHED_PTR(opline->result.num + sizeof(void*));
} else if (IS_UNUSED != IS_UNUSED) {
-
-
function_name = NULL;
if (IS_UNUSED != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
@@ -9061,7 +8686,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
HANDLE_EXCEPTION();
}
}
- zend_throw_error(NULL, "Function name must be a string");
+ zend_throw_error(NULL, "Method name must be a string");
HANDLE_EXCEPTION();
} while (0);
@@ -9081,7 +8706,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
HANDLE_EXCEPTION();
}
if (IS_UNUSED == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE)))) {
CACHE_POLYMORPHIC_PTR(opline->result.num, ce, fbc);
}
@@ -9112,13 +8736,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS;
} else {
zend_non_static_method_call(fbc);
- if (UNEXPECTED(EG(exception) != NULL)) {
- HANDLE_EXCEPTION();
- }
- goto check_parent_and_self;
+ HANDLE_EXCEPTION();
}
} else {
-check_parent_and_self:
/* previous opcode is ZEND_FETCH_CLASS */
if (IS_CONST == IS_UNUSED
&& ((opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_PARENT ||
@@ -9144,16 +8764,15 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_VERIFY_RETURN_TYP
{
USE_OPLINE
- SAVE_OPLINE();
if (IS_CONST == IS_UNUSED) {
+ SAVE_OPLINE();
zend_verify_missing_return_type(EX(func), CACHE_ADDR(opline->op2.num));
+ HANDLE_EXCEPTION();
} else {
/* prevents "undefined variable opline" errors */
#if 0 || (IS_CONST != IS_UNUSED)
zval *retval_ref, *retval_ptr;
-
zend_arg_info *ret_info = EX(func)->common.arg_info - 1;
-
retval_ref = retval_ptr = RT_CONSTANT(opline, opline->op1);
if (IS_CONST == IS_CONST) {
@@ -9168,26 +8787,35 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_VERIFY_RETURN_TYP
ZVAL_DEREF(retval_ptr);
}
- if (UNEXPECTED(!ZEND_TYPE_IS_CLASS(ret_info->type)
- && ZEND_TYPE_CODE(ret_info->type) != IS_CALLABLE
- && ZEND_TYPE_CODE(ret_info->type) != IS_ITERABLE
- && !ZEND_SAME_FAKE_TYPE(ZEND_TYPE_CODE(ret_info->type), Z_TYPE_P(retval_ptr))
- && !(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)
- && retval_ref != retval_ptr)
- ) {
- /* A cast might happen - unwrap the reference if this is a by-value return */
- if (Z_REFCOUNT_P(retval_ref) == 1) {
- ZVAL_UNREF(retval_ref);
+ if (EXPECTED(ZEND_TYPE_CONTAINS_CODE(ret_info->type, Z_TYPE_P(retval_ptr)))) {
+ ZEND_VM_NEXT_OPCODE();
+ }
+
+ zend_reference *ref = NULL;
+ void *cache_slot = CACHE_ADDR(opline->op2.num);
+ if (UNEXPECTED(retval_ref != retval_ptr)) {
+ if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
+ ref = Z_REF_P(retval_ref);
} else {
- Z_DELREF_P(retval_ref);
- ZVAL_COPY(retval_ref, retval_ptr);
+ /* A cast might happen - unwrap the reference if this is a by-value return */
+ if (Z_REFCOUNT_P(retval_ref) == 1) {
+ ZVAL_UNREF(retval_ref);
+ } else {
+ Z_DELREF_P(retval_ref);
+ ZVAL_COPY(retval_ref, retval_ptr);
+ }
+ retval_ptr = retval_ref;
}
- retval_ptr = retval_ref;
}
- zend_verify_return_type(EX(func), retval_ptr, CACHE_ADDR(opline->op2.num));
+
+ SAVE_OPLINE();
+ if (UNEXPECTED(!zend_check_type_slow(ret_info->type, retval_ptr, ref, cache_slot, NULL, 1, 0))) {
+ zend_verify_return_error(EX(func), cache_slot, retval_ptr);
+ HANDLE_EXCEPTION();
+ }
+ ZEND_VM_NEXT_OPCODE();
#endif
}
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_NEW_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -9264,7 +8892,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_NEW_SPEC_CONST_UNUSED_HANDLER(
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *expr_ptr, new_expr;
SAVE_OPLINE();
@@ -9303,7 +8930,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_U
}
if (IS_UNUSED != IS_UNUSED) {
-
zval *offset = NULL;
zend_string *str;
zend_ulong hval;
@@ -9387,7 +9013,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CONST_UNUSED_HA
zend_string *name, *tmp_name;
HashTable *target_symbol_table;
-
SAVE_OPLINE();
varname = RT_CONSTANT(opline, opline->op1);
@@ -9424,7 +9049,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_U
USE_OPLINE
zval *value;
int result;
-
zval *varname;
zend_string *name, *tmp_name;
HashTable *target_symbol_table;
@@ -9461,8 +9085,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_U
}
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
/* No specialization for op_types (CONST|TMPVAR|CV, UNUSED|CLASS_FETCH|CONST|VAR) */
@@ -9520,8 +9142,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_UNUSED_HANDLE
/* Set the new yielded value */
if (IS_CONST != IS_UNUSED) {
-
-
if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
/* Constants and temporary variables aren't yieldable by reference,
* but we still allow them with a notice. */
@@ -9589,26 +9209,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_UNUSED_HANDLE
/* Set the new yielded key */
if (IS_UNUSED != IS_UNUSED) {
-
zval *key = NULL;
-
- /* Consts, temporary variables and references need copying */
- if (IS_UNUSED == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_UNUSED == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_UNUSED & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
-
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_UNUSED == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
+ if ((IS_UNUSED & (IS_CV|IS_VAR)) && UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE) {
+ key = Z_REFVAL_P(key);
}
+ ZVAL_COPY(&generator->key, key);
if (Z_TYPE(generator->key) == IS_LONG
&& Z_LVAL(generator->key) > generator->largest_used_integer_key
@@ -9644,7 +9249,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_UNUSED_HANDLE
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COUNT_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1;
zend_long count;
@@ -9655,9 +9259,11 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COUNT_SPEC_CONST_
count = zend_array_count(Z_ARRVAL_P(op1));
break;
} else if (Z_TYPE_P(op1) == IS_OBJECT) {
+ zend_object *zobj = Z_OBJ_P(op1);
+
/* first, we check if the handler is defined */
- if (Z_OBJ_HT_P(op1)->count_elements) {
- if (SUCCESS == Z_OBJ_HT_P(op1)->count_elements(op1, &count)) {
+ if (zobj->handlers->count_elements) {
+ if (SUCCESS == zobj->handlers->count_elements(zobj, &count)) {
break;
}
if (UNEXPECTED(EG(exception))) {
@@ -9667,10 +9273,10 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COUNT_SPEC_CONST_
}
/* if not and the object implements Countable we call its count() method */
- if (instanceof_function(Z_OBJCE_P(op1), zend_ce_countable)) {
+ if (zend_class_implements_interface(zobj->ce, zend_ce_countable)) {
zval retval;
- zend_call_method_with_0_params(op1, NULL, NULL, "count", &retval);
+ zend_call_method_with_0_params(zobj, NULL, NULL, "count", &retval);
count = zval_get_long(&retval);
zval_ptr_dtor(&retval);
break;
@@ -9713,7 +9319,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GET_CLASS_SPEC_CO
ZEND_VM_NEXT_OPCODE();
}
} else {
-
zval *op1;
SAVE_OPLINE();
@@ -9728,8 +9333,8 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GET_CLASS_SPEC_CO
if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(op1) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- zend_error(E_WARNING, "get_class() expects parameter 1 to be object, %s given", zend_get_type_by_const(Z_TYPE_P(op1)));
- ZVAL_FALSE(EX_VAR(opline->result.var));
+ zend_type_error("get_class() expects parameter 1 to be object, %s given", zend_get_type_by_const(Z_TYPE_P(op1)));
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
}
break;
}
@@ -9741,7 +9346,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GET_CLASS_SPEC_CO
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GET_TYPE_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1;
zend_string *type;
@@ -9835,7 +9439,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FUNC_GET_ARGS_SPEC_CONST_UNUSE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DIV_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
SAVE_OPLINE();
@@ -9850,7 +9453,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DIV_SPEC_CONST_CV_HANDLER(ZEND
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POW_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
SAVE_OPLINE();
@@ -9865,7 +9467,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POW_SPEC_CONST_CV_HANDLER(ZEND
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
op1 = RT_CONSTANT(opline, opline->op1);
@@ -9937,7 +9538,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_CONST_CV_HANDLER(Z
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SPACESHIP_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
SAVE_OPLINE();
@@ -9952,7 +9552,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SPACESHIP_SPEC_CONST_CV_HANDLE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container, *dim, *value;
SAVE_OPLINE();
@@ -9988,7 +9587,6 @@ fetch_dim_r_slow:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
SAVE_OPLINE();
@@ -10021,19 +9619,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CONST_
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
-
zval *offset;
void **cache_slot = NULL;
SAVE_OPLINE();
container = RT_CONSTANT(opline, opline->op1);
-
- if (IS_CONST == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
offset = EX_VAR(opline->op2.var);
if (IS_CONST == IS_CONST ||
@@ -10060,9 +9651,11 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if (IS_CV == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value & ~ZEND_FETCH_REF /* FUNC_ARG fetch may contain it */);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -10087,10 +9680,10 @@ fetch_obj_r_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || (IS_CONST & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_r_copy;
@@ -10101,7 +9694,7 @@ fetch_obj_r_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -10113,11 +9706,22 @@ fetch_obj_r_fast_copy:
}
}
}
- } else if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
- ZVAL_UNDEFINED_OP2();
+ } else {
+ if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
+ ZVAL_UNDEFINED_OP2();
+ }
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_r_copy:
@@ -10136,19 +9740,12 @@ fetch_obj_r_finish:
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
-
zval *offset;
void **cache_slot = NULL;
SAVE_OPLINE();
container = RT_CONSTANT(opline, opline->op1);
-
- if (IS_CONST == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
offset = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
if (IS_CONST == IS_CONST ||
@@ -10168,9 +9765,11 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if (IS_CV == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -10195,10 +9794,10 @@ fetch_obj_is_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || (IS_CONST & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_is_copy;
@@ -10209,7 +9808,7 @@ fetch_obj_is_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -10221,9 +9820,19 @@ fetch_obj_is_fast_copy:
}
}
}
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_is_copy:
@@ -10259,7 +9868,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_AR
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_LIST_R_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
SAVE_OPLINE();
@@ -10272,7 +9880,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_LIST_R_SPEC_CONST_CV_HAN
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
zend_string *op1_str, *op2_str, *str;
@@ -10394,7 +10001,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_
{
USE_OPLINE
zval *function_name;
- zend_free_op free_op1;
zval *object;
zend_function *fbc;
zend_class_entry *called_scope;
@@ -10406,10 +10012,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_
object = RT_CONSTANT(opline, opline->op1);
- if (IS_CONST == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
if (IS_CV != IS_CONST) {
function_name = EX_VAR(opline->op2.var);
}
@@ -10489,7 +10091,6 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_
HANDLE_EXCEPTION();
}
if (IS_CV == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE))) &&
EXPECTED(obj == orig_obj)) {
CACHE_POLYMORPHIC_PTR(opline->result.num, called_scope, fbc);
@@ -10519,9 +10120,12 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_
} else if (IS_CONST & (IS_VAR|IS_TMP_VAR|IS_CV)) {
if (IS_CONST == IS_CV) {
GC_ADDREF(obj); /* For $this pointer */
- } else if (free_op1 != object) {
- GC_ADDREF(obj); /* For $this pointer */
-
+ } else {
+ zval *free_op1 = EX_VAR(opline->op1.var);
+ if (free_op1 != object) {
+ GC_ADDREF(obj); /* For $this pointer */
+ zval_ptr_dtor_nogc(free_op1);
+ }
}
/* CV may be changed indirectly (e.g. when it's a reference) */
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS | ZEND_CALL_RELEASE_THIS;
@@ -10580,8 +10184,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
EXPECTED(CACHED_PTR(opline->result.num) == ce)) {
fbc = CACHED_PTR(opline->result.num + sizeof(void*));
} else if (IS_CV != IS_UNUSED) {
-
-
function_name = EX_VAR(opline->op2.var);
if (IS_CV != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
@@ -10597,7 +10199,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
HANDLE_EXCEPTION();
}
}
- zend_throw_error(NULL, "Function name must be a string");
+ zend_throw_error(NULL, "Method name must be a string");
HANDLE_EXCEPTION();
} while (0);
@@ -10617,7 +10219,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
HANDLE_EXCEPTION();
}
if (IS_CV == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE)))) {
CACHE_POLYMORPHIC_PTR(opline->result.num, ce, fbc);
}
@@ -10648,13 +10249,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS;
} else {
zend_non_static_method_call(fbc);
- if (UNEXPECTED(EG(exception) != NULL)) {
- HANDLE_EXCEPTION();
- }
- goto check_parent_and_self;
+ HANDLE_EXCEPTION();
}
} else {
-check_parent_and_self:
/* previous opcode is ZEND_FETCH_CLASS */
if (IS_CONST == IS_UNUSED
&& ((opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_PARENT ||
@@ -10679,7 +10276,6 @@ check_parent_and_self:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *function_name;
zend_fcall_info_cache fcc;
char *error = NULL;
@@ -10691,16 +10287,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CV_H
SAVE_OPLINE();
function_name = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
if (zend_is_callable_ex(function_name, NULL, 0, NULL, &fcc, &error)) {
+ ZEND_ASSERT(!error);
func = fcc.function_handler;
- if (error) {
- efree(error);
- /* This is the only soft error is_callable() can generate */
- zend_non_static_method_call(func);
- if (UNEXPECTED(EG(exception) != NULL)) {
-
- HANDLE_EXCEPTION();
- }
- }
object_or_called_scope = fcc.called_scope;
if (func->common.fn_flags & ZEND_ACC_CLOSURE) {
/* Delay closure destruction until its invocation */
@@ -10732,14 +10320,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CV_H
init_func_run_time_cache(&func->op_array);
}
} else {
- zend_internal_type_error(EX_USES_STRICT_TYPES(), "%s() expects parameter 1 to be a valid callback, %s", Z_STRVAL_P(RT_CONSTANT(opline, opline->op1)), error);
+ zend_type_error("%s() expects parameter 1 to be a valid callback, %s", Z_STRVAL_P(RT_CONSTANT(opline, opline->op1)), error);
efree(error);
- if (UNEXPECTED(EG(exception))) {
- HANDLE_EXCEPTION();
- }
- func = (zend_function*)&zend_pass_function;
- object_or_called_scope = NULL;
+ HANDLE_EXCEPTION();
}
call = zend_vm_stack_push_call_frame(call_info,
@@ -10753,7 +10337,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CV_H
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *expr_ptr, new_expr;
SAVE_OPLINE();
@@ -10792,7 +10375,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_C
}
if (IS_CV != IS_UNUSED) {
-
zval *offset = EX_VAR(opline->op2.var);
zend_string *str;
zend_ulong hval;
@@ -10872,7 +10454,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_CV_HANDL
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
int result;
zend_ulong hval;
@@ -10907,6 +10488,10 @@ num_index_prop:
goto isset_again;
} else {
value = zend_find_array_dim_slow(ht, offset EXECUTE_DATA_CC);
+ if (UNEXPECTED(EG(exception))) {
+ result = 0;
+ goto isset_dim_obj_exit;
+ }
}
if (!(opline->extended_value & ZEND_ISEMPTY)) {
@@ -10918,8 +10503,6 @@ num_index_prop:
/* avoid exception check */
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
} else {
result = (value == NULL || !i_zend_is_true(value));
@@ -10945,25 +10528,18 @@ isset_dim_obj_exit:
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
int result;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
container = RT_CONSTANT(opline, opline->op1);
-
- if (IS_CONST == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
offset = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
if (IS_CONST == IS_CONST ||
@@ -10980,26 +10556,37 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PRO
}
}
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ result = 0;
+ goto isset_object_finish;
+ }
+ }
+
result =
(opline->extended_value & ZEND_ISEMPTY) ^
- Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY), ((IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+ Z_OBJ_HT_P(container)->has_property(Z_OBJ_P(container), name, (opline->extended_value & ZEND_ISEMPTY), ((IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
isset_object_finish:
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ARRAY_KEY_EXISTS_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *key, *subject;
HashTable *ht;
- uint32_t result;
+ zend_bool result;
SAVE_OPLINE();
@@ -11017,13 +10604,12 @@ array_key_exists_array:
goto array_key_exists_array;
}
}
- result = zend_array_key_exists_slow(subject, key OPLINE_CC EXECUTE_DATA_CC);
+ zend_array_key_exists_error(subject, key OPLINE_CC EXECUTE_DATA_CC);
+ result = 0;
}
- ZEND_VM_SMART_BRANCH(result == IS_TRUE, 1);
- Z_TYPE_INFO_P(EX_VAR(opline->result.var)) = result;
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
+ ZEND_VM_SMART_BRANCH(result, 1);
}
/* No specialization for op_types (CONST|TMPVAR|UNUSED|CV, ANY) */
@@ -11046,8 +10632,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CV_HANDLER(ZE
/* Set the new yielded value */
if (IS_CONST != IS_UNUSED) {
-
-
if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
/* Constants and temporary variables aren't yieldable by reference,
* but we still allow them with a notice. */
@@ -11115,26 +10699,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CV_HANDLER(ZE
/* Set the new yielded key */
if (IS_CV != IS_UNUSED) {
-
zval *key = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
-
- /* Consts, temporary variables and references need copying */
- if (IS_CV == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_CV == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_CV & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
-
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_CV == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
+ if ((IS_CV & (IS_CV|IS_VAR)) && UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE) {
+ key = Z_REFVAL_P(key);
}
+ ZVAL_COPY(&generator->key, key);
if (Z_TYPE(generator->key) == IS_LONG
&& Z_LVAL(generator->key) > generator->largest_used_integer_key
@@ -11167,10 +10736,23 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CV_HANDLER(ZE
ZEND_VM_RETURN();
}
-static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_QM_ASSIGN_LONG_SPEC_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_NOT_SPEC_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
+ zval *op1;
+
+ op1 = EX_VAR(opline->op1.var);
+ if (EXPECTED(Z_TYPE_INFO_P(op1) == IS_LONG)) {
+ ZVAL_LONG(EX_VAR(opline->result.var), ~Z_LVAL_P(op1));
+ ZEND_VM_NEXT_OPCODE();
+ }
+ ZEND_VM_TAIL_CALL(zend_bw_not_helper_SPEC(op1 ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
+}
+
+static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_QM_ASSIGN_LONG_SPEC_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
zval *value;
value = EX_VAR(opline->op1.var);
@@ -11181,7 +10763,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_QM_ASSIGN_LONG_SPE
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_QM_ASSIGN_DOUBLE_SPEC_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *value;
value = EX_VAR(opline->op1.var);
@@ -11192,7 +10773,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_QM_ASSIGN_DOUBLE_S
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_QM_ASSIGN_NOREF_SPEC_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *value;
value = EX_VAR(opline->op1.var);
@@ -11203,7 +10783,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_QM_ASSIGN_NOREF_SP
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2, *result;
double d1, d2;
@@ -11242,7 +10821,6 @@ add_double:
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SUB_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2, *result;
double d1, d2;
@@ -11281,7 +10859,6 @@ sub_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_MUL_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2, *result;
double d1, d2;
@@ -11323,7 +10900,6 @@ mul_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_MOD_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2, *result;
op1 = EX_VAR(opline->op1.var);
@@ -11351,7 +10927,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_MOD_SPEC_TMPVARCV_CONST_HANDLE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SL_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
op1 = EX_VAR(opline->op1.var);
@@ -11373,7 +10948,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SL_SPEC_TMPVARCV_CONST_HANDLER
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SR_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
op1 = EX_VAR(opline->op1.var);
@@ -11393,7 +10967,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SR_SPEC_TMPVARCV_CONST_HANDLER
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -11405,14 +10978,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_TMPVARCV_CONST
if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_LONG)) {
if (EXPECTED(Z_LVAL_P(op1) < Z_LVAL_P(op2))) {
is_smaller_true:
-
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_TRUE_NONE();
} else {
is_smaller_false:
-
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_FALSE_NONE();
}
} else if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -11441,7 +11010,6 @@ is_smaller_double:
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_TMPVARCV_CONST_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -11454,13 +11022,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_TM
if (EXPECTED(Z_LVAL_P(op1) < Z_LVAL_P(op2))) {
is_smaller_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_smaller_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -11489,7 +11053,6 @@ is_smaller_double:
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_TMPVARCV_CONST_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -11502,13 +11065,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_TM
if (EXPECTED(Z_LVAL_P(op1) < Z_LVAL_P(op2))) {
is_smaller_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPNZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_smaller_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPNZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -11537,7 +11096,6 @@ is_smaller_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -11549,12 +11107,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_TMPVA
if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_LONG)) {
if (EXPECTED(Z_LVAL_P(op1) <= Z_LVAL_P(op2))) {
is_smaller_or_equal_true:
-
+ ZEND_VM_SMART_BRANCH_TRUE_NONE();
ZVAL_TRUE(EX_VAR(opline->result.var));
ZEND_VM_NEXT_OPCODE();
} else {
is_smaller_or_equal_false:
-
+ ZEND_VM_SMART_BRANCH_FALSE_NONE();
ZVAL_FALSE(EX_VAR(opline->result.var));
ZEND_VM_NEXT_OPCODE();
}
@@ -11585,7 +11143,6 @@ is_smaller_or_equal_double:
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_TMPVARCV_CONST_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -11633,7 +11190,6 @@ is_smaller_or_equal_double:
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_TMPVARCV_CONST_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -11678,10 +11234,9 @@ is_smaller_or_equal_double:
ZEND_VM_TAIL_CALL(zend_is_smaller_or_equal_helper_SPEC(op1, op2 ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
}
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_OR_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_OR_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
op1 = EX_VAR(opline->op1.var);
@@ -11697,10 +11252,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_OR_SPEC_TMPVARCV_CONST_HAND
ZEND_VM_TAIL_CALL(zend_bw_or_helper_SPEC(op1, op2 ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
}
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_AND_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_AND_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
op1 = EX_VAR(opline->op1.var);
@@ -11716,10 +11270,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_AND_SPEC_TMPVARCV_CONST_HAN
ZEND_VM_TAIL_CALL(zend_bw_and_helper_SPEC(op1, op2 ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
}
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_XOR_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_XOR_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
op1 = EX_VAR(opline->op1.var);
@@ -11738,7 +11291,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_XOR_SPEC_TMPVARCV_CONST_HAN
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_LIST_R_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
SAVE_OPLINE();
@@ -11751,7 +11303,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_LIST_R_SPEC_TMPVARCV_CON
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SWITCH_LONG_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op, *jump_zv;
HashTable *jumptable;
@@ -11780,7 +11331,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SWITCH_LONG_SPEC_TMPVARCV_CONS
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SWITCH_STRING_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op, *jump_zv;
HashTable *jumptable;
@@ -11930,9 +11480,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_CO
op1 = EX_VAR(opline->op1.var);
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_LVAL_P(op1) == Z_LVAL_P(op2));
-
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_NONE(result, 0);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -11945,8 +11493,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_LONG_SPEC
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_LVAL_P(op1) == Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -11959,8 +11505,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_LONG_SPEC
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_LVAL_P(op1) == Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPNZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -11972,9 +11516,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_
op1 = EX_VAR(opline->op1.var);
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_DVAL_P(op1) == Z_DVAL_P(op2));
-
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_NONE(result, 0);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -11987,8 +11529,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_DOUBLE_SP
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_DVAL_P(op1) == Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12001,8 +11541,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_DOUBLE_SP
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_DVAL_P(op1) == Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPNZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12014,9 +11552,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARC
op1 = EX_VAR(opline->op1.var);
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_LVAL_P(op1) != Z_LVAL_P(op2));
-
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_NONE(result, 0);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12029,8 +11565,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_LONG_
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_LVAL_P(op1) != Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12043,8 +11577,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_LONG_
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_LVAL_P(op1) != Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPNZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12056,9 +11588,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVA
op1 = EX_VAR(opline->op1.var);
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_DVAL_P(op1) != Z_DVAL_P(op2));
-
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_NONE(result, 0);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12071,8 +11601,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_DOUBL
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_DVAL_P(op1) != Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12085,8 +11613,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_DOUBL
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_DVAL_P(op1) != Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPNZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12098,9 +11624,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_
op1 = EX_VAR(opline->op1.var);
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_LVAL_P(op1) < Z_LVAL_P(op2));
-
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_NONE(result, 0);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_CONST_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12113,8 +11637,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SP
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_LVAL_P(op1) < Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_CONST_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12127,8 +11649,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SP
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_LVAL_P(op1) < Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPNZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12140,9 +11660,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARC
op1 = EX_VAR(opline->op1.var);
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_DVAL_P(op1) < Z_DVAL_P(op2));
-
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_NONE(result, 0);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_CONST_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12155,8 +11673,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_DVAL_P(op1) < Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_CONST_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12169,8 +11685,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_DVAL_P(op1) < Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPNZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12182,9 +11696,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_
op1 = EX_VAR(opline->op1.var);
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_LVAL_P(op1) <= Z_LVAL_P(op2));
-
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_NONE(result, 0);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12197,8 +11709,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_LVAL_P(op1) <= Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12211,8 +11721,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_LVAL_P(op1) <= Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPNZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12224,9 +11732,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPE
op1 = EX_VAR(opline->op1.var);
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_DVAL_P(op1) <= Z_DVAL_P(op2));
-
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_NONE(result, 0);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12239,8 +11745,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_DVAL_P(op1) <= Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12253,14 +11757,11 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA
op2 = RT_CONSTANT(opline, opline->op2);
result = (Z_DVAL_P(op1) <= Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPNZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_SPEC_TMPVARCV_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2, *result;
double d1, d2;
@@ -12299,7 +11800,6 @@ add_double:
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SUB_SPEC_TMPVARCV_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2, *result;
double d1, d2;
@@ -12338,7 +11838,6 @@ sub_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_MUL_SPEC_TMPVARCV_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2, *result;
double d1, d2;
@@ -12380,7 +11879,6 @@ mul_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_MOD_SPEC_TMPVARCV_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2, *result;
op1 = EX_VAR(opline->op1.var);
@@ -12408,7 +11906,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_MOD_SPEC_TMPVARCV_TMPVARCV_HAN
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SL_SPEC_TMPVARCV_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
op1 = EX_VAR(opline->op1.var);
@@ -12430,7 +11927,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SL_SPEC_TMPVARCV_TMPVARCV_HAND
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SR_SPEC_TMPVARCV_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
op1 = EX_VAR(opline->op1.var);
@@ -12450,7 +11946,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SR_SPEC_TMPVARCV_TMPVARCV_HAND
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_TMPVARCV_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -12462,14 +11957,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_TMPVARCV_TMPVA
if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_LONG)) {
if (EXPECTED(Z_LVAL_P(op1) < Z_LVAL_P(op2))) {
is_smaller_true:
-
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_TRUE_NONE();
} else {
is_smaller_false:
-
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_FALSE_NONE();
}
} else if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -12498,7 +11989,6 @@ is_smaller_double:
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_TMPVARCV_TMPVARCV_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -12511,13 +12001,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_TM
if (EXPECTED(Z_LVAL_P(op1) < Z_LVAL_P(op2))) {
is_smaller_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_smaller_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -12546,7 +12032,6 @@ is_smaller_double:
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_TMPVARCV_TMPVARCV_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -12559,13 +12044,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_TM
if (EXPECTED(Z_LVAL_P(op1) < Z_LVAL_P(op2))) {
is_smaller_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPNZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_smaller_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPNZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -12594,7 +12075,6 @@ is_smaller_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_TMPVARCV_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -12606,12 +12086,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_TMPVA
if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_LONG)) {
if (EXPECTED(Z_LVAL_P(op1) <= Z_LVAL_P(op2))) {
is_smaller_or_equal_true:
-
+ ZEND_VM_SMART_BRANCH_TRUE_NONE();
ZVAL_TRUE(EX_VAR(opline->result.var));
ZEND_VM_NEXT_OPCODE();
} else {
is_smaller_or_equal_false:
-
+ ZEND_VM_SMART_BRANCH_FALSE_NONE();
ZVAL_FALSE(EX_VAR(opline->result.var));
ZEND_VM_NEXT_OPCODE();
}
@@ -12642,7 +12122,6 @@ is_smaller_or_equal_double:
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_TMPVARCV_TMPVARCV_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -12690,7 +12169,6 @@ is_smaller_or_equal_double:
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_TMPVARCV_TMPVARCV_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -12735,10 +12213,9 @@ is_smaller_or_equal_double:
ZEND_VM_TAIL_CALL(zend_is_smaller_or_equal_helper_SPEC(op1, op2 ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
}
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_OR_SPEC_TMPVARCV_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_OR_SPEC_TMPVARCV_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
op1 = EX_VAR(opline->op1.var);
@@ -12754,10 +12231,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_OR_SPEC_TMPVARCV_TMPVARCV_H
ZEND_VM_TAIL_CALL(zend_bw_or_helper_SPEC(op1, op2 ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
}
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_AND_SPEC_TMPVARCV_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_AND_SPEC_TMPVARCV_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
op1 = EX_VAR(opline->op1.var);
@@ -12773,10 +12249,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_AND_SPEC_TMPVARCV_TMPVARCV_
ZEND_VM_TAIL_CALL(zend_bw_and_helper_SPEC(op1, op2 ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
}
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_XOR_SPEC_TMPVARCV_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_XOR_SPEC_TMPVARCV_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
op1 = EX_VAR(opline->op1.var);
@@ -12911,9 +12386,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TM
op1 = EX_VAR(opline->op1.var);
op2 = EX_VAR(opline->op2.var);
result = (Z_LVAL_P(op1) == Z_LVAL_P(op2));
-
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_NONE(result, 0);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12926,8 +12399,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_LONG_SPEC
op2 = EX_VAR(opline->op2.var);
result = (Z_LVAL_P(op1) == Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12940,8 +12411,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_LONG_SPEC
op2 = EX_VAR(opline->op2.var);
result = (Z_LVAL_P(op1) == Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPNZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12953,9 +12422,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_
op1 = EX_VAR(opline->op1.var);
op2 = EX_VAR(opline->op2.var);
result = (Z_DVAL_P(op1) == Z_DVAL_P(op2));
-
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_NONE(result, 0);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12968,8 +12435,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_DOUBLE_SP
op2 = EX_VAR(opline->op2.var);
result = (Z_DVAL_P(op1) == Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12982,8 +12447,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_DOUBLE_SP
op2 = EX_VAR(opline->op2.var);
result = (Z_DVAL_P(op1) == Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPNZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -12995,9 +12458,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARC
op1 = EX_VAR(opline->op1.var);
op2 = EX_VAR(opline->op2.var);
result = (Z_LVAL_P(op1) != Z_LVAL_P(op2));
-
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_NONE(result, 0);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -13010,8 +12471,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_LONG_
op2 = EX_VAR(opline->op2.var);
result = (Z_LVAL_P(op1) != Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -13024,8 +12483,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_LONG_
op2 = EX_VAR(opline->op2.var);
result = (Z_LVAL_P(op1) != Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPNZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -13037,9 +12494,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVA
op1 = EX_VAR(opline->op1.var);
op2 = EX_VAR(opline->op2.var);
result = (Z_DVAL_P(op1) != Z_DVAL_P(op2));
-
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_NONE(result, 0);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -13052,8 +12507,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_DOUBL
op2 = EX_VAR(opline->op2.var);
result = (Z_DVAL_P(op1) != Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -13066,8 +12519,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_DOUBL
op2 = EX_VAR(opline->op2.var);
result = (Z_DVAL_P(op1) != Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPNZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -13079,9 +12530,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_
op1 = EX_VAR(opline->op1.var);
op2 = EX_VAR(opline->op2.var);
result = (Z_LVAL_P(op1) < Z_LVAL_P(op2));
-
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_NONE(result, 0);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -13094,8 +12543,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SP
op2 = EX_VAR(opline->op2.var);
result = (Z_LVAL_P(op1) < Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -13108,8 +12555,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_LONG_SP
op2 = EX_VAR(opline->op2.var);
result = (Z_LVAL_P(op1) < Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPNZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -13121,9 +12566,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARC
op1 = EX_VAR(opline->op1.var);
op2 = EX_VAR(opline->op2.var);
result = (Z_DVAL_P(op1) < Z_DVAL_P(op2));
-
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_NONE(result, 0);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -13136,8 +12579,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_
op2 = EX_VAR(opline->op2.var);
result = (Z_DVAL_P(op1) < Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -13150,8 +12591,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_DOUBLE_
op2 = EX_VAR(opline->op2.var);
result = (Z_DVAL_P(op1) < Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPNZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -13163,9 +12602,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_
op1 = EX_VAR(opline->op1.var);
op2 = EX_VAR(opline->op2.var);
result = (Z_LVAL_P(op1) <= Z_LVAL_P(op2));
-
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_NONE(result, 0);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -13178,8 +12615,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA
op2 = EX_VAR(opline->op2.var);
result = (Z_LVAL_P(op1) <= Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -13192,8 +12627,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA
op2 = EX_VAR(opline->op2.var);
result = (Z_LVAL_P(op1) <= Z_LVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPNZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -13205,9 +12638,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPE
op1 = EX_VAR(opline->op1.var);
op2 = EX_VAR(opline->op2.var);
result = (Z_DVAL_P(op1) <= Z_DVAL_P(op2));
-
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_NONE(result, 0);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -13220,8 +12651,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA
op2 = EX_VAR(opline->op2.var);
result = (Z_DVAL_P(op1) <= Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -13234,27 +12663,23 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUA
op2 = EX_VAR(opline->op2.var);
result = (Z_DVAL_P(op1) <= Z_DVAL_P(op2));
ZEND_VM_SMART_BRANCH_JMPNZ(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_LIST_R_SPEC_TMPVARCV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *container;
SAVE_OPLINE();
container = EX_VAR(opline->op1.var);
- zend_fetch_dimension_address_LIST_r(container, _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op2);
+ zend_fetch_dimension_address_LIST_r(container, _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_LIST_R_SPEC_TMPVARCV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
SAVE_OPLINE();
@@ -13264,34 +12689,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_LIST_R_SPEC_TMPVARCV_CV_
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_NOT_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
- zend_free_op free_op1;
- zval *op1;
-
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- if (EXPECTED(Z_TYPE_INFO_P(op1) == IS_LONG)) {
- ZVAL_LONG(EX_VAR(opline->result.var), ~Z_LVAL_P(op1));
- ZEND_VM_NEXT_OPCODE();
- }
-
- SAVE_OPLINE();
- if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_P(op1) == IS_UNDEF)) {
- op1 = ZVAL_UNDEFINED_OP1();
- }
- bitwise_not_function(EX_VAR(opline->result.var), op1);
- zval_ptr_dtor_nogc(free_op1);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
-}
-
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_NOT_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
zval *val;
- zend_free_op free_op1;
- val = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ val = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (Z_TYPE_INFO_P(val) == IS_TRUE) {
ZVAL_FALSE(EX_VAR(opline->result.var));
} else if (EXPECTED(Z_TYPE_INFO_P(val) <= IS_TRUE)) {
@@ -13306,7 +12709,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_NOT_SPEC_TMPVAR_HANDLER(Z
} else {
SAVE_OPLINE();
ZVAL_BOOL(EX_VAR(opline->result.var), !i_zend_is_true(val));
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
ZEND_VM_NEXT_OPCODE();
@@ -13315,11 +12718,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_NOT_SPEC_TMPVAR_HANDLER(Z
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ECHO_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *z;
SAVE_OPLINE();
- z = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ z = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (Z_TYPE_P(z) == IS_STRING) {
zend_string *str = Z_STR_P(z);
@@ -13338,17 +12740,17 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ECHO_SPEC_TMPVAR_HANDLER(ZEND_
zend_string_release_ex(str, 0);
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZ_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *val;
+ zend_uchar op1_type;
- val = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ val = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (Z_TYPE_INFO_P(val) == IS_TRUE) {
ZEND_VM_NEXT_OPCODE();
@@ -13364,22 +12766,25 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZ_SPEC_TMPVAR_H
}
SAVE_OPLINE();
+ op1_type = (IS_TMP_VAR|IS_VAR);
if (i_zend_is_true(val)) {
opline++;
} else {
opline = OP_JMP_ADDR(opline, opline->op2);
}
- zval_ptr_dtor_nogc(free_op1);
+ if (op1_type & (IS_TMP_VAR|IS_VAR)) {
+ zval_ptr_dtor_nogc(val);
+ }
ZEND_VM_JMP(opline);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPNZ_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *val;
+ zend_uchar op1_type;
- val = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ val = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (Z_TYPE_INFO_P(val) == IS_TRUE) {
ZEND_VM_JMP_EX(OP_JMP_ADDR(opline, opline->op2), 0);
@@ -13395,22 +12800,25 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPNZ_SPEC_TMPVAR_
}
SAVE_OPLINE();
+ op1_type = (IS_TMP_VAR|IS_VAR);
if (i_zend_is_true(val)) {
opline = OP_JMP_ADDR(opline, opline->op2);
} else {
opline++;
}
- zval_ptr_dtor_nogc(free_op1);
+ if (op1_type & (IS_TMP_VAR|IS_VAR)) {
+ zval_ptr_dtor_nogc(val);
+ }
ZEND_VM_JMP(opline);
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZNZ_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *val;
+ zend_uchar op1_type;
- val = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ val = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_INFO_P(val) == IS_TRUE)) {
ZEND_VM_SET_RELATIVE_OPCODE(opline, opline->extended_value);
@@ -13427,23 +12835,25 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZNZ_SPEC_TMPVAR_HANDLER(ZEN
}
SAVE_OPLINE();
+ op1_type = (IS_TMP_VAR|IS_VAR);
if (i_zend_is_true(val)) {
opline = ZEND_OFFSET_TO_OPLINE(opline, opline->extended_value);
} else {
opline = OP_JMP_ADDR(opline, opline->op2);
}
- zval_ptr_dtor_nogc(free_op1);
+ if (op1_type & (IS_TMP_VAR|IS_VAR)) {
+ zval_ptr_dtor_nogc(val);
+ }
ZEND_VM_JMP(opline);
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZ_EX_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *val;
int ret;
- val = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ val = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (Z_TYPE_INFO_P(val) == IS_TRUE) {
ZVAL_TRUE(EX_VAR(opline->result.var));
@@ -13462,7 +12872,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZ_EX_SPEC_TMPVAR_HANDLER(ZE
SAVE_OPLINE();
ret = i_zend_is_true(val);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
if (ret) {
ZVAL_TRUE(EX_VAR(opline->result.var));
opline++;
@@ -13476,11 +12886,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZ_EX_SPEC_TMPVAR_HANDLER(ZE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPNZ_EX_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *val;
int ret;
- val = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ val = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (Z_TYPE_INFO_P(val) == IS_TRUE) {
ZVAL_TRUE(EX_VAR(opline->result.var));
@@ -13498,7 +12907,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPNZ_EX_SPEC_TMPVAR_HANDLER(Z
SAVE_OPLINE();
ret = i_zend_is_true(val);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
if (ret) {
ZVAL_TRUE(EX_VAR(opline->result.var));
opline = OP_JMP_ADDR(opline, opline->op2);
@@ -13523,22 +12932,68 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_FREE_SPEC_TMPVA
zval *var;
USE_OPLINE
- SAVE_OPLINE();
var = EX_VAR(opline->op1.var);
- if (Z_TYPE_P(var) != IS_ARRAY && Z_FE_ITER_P(var) != (uint32_t)-1) {
- zend_hash_iterator_del(Z_FE_ITER_P(var));
+ if (Z_TYPE_P(var) != IS_ARRAY) {
+ SAVE_OPLINE();
+ if (Z_FE_ITER_P(var) != (uint32_t)-1) {
+ zend_hash_iterator_del(Z_FE_ITER_P(var));
+ }
+ zval_ptr_dtor_nogc(var);
+ ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
- zval_ptr_dtor_nogc(var);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
+
+ /* This is freeing an array. Use an inlined version of zval_ptr_dtor_nogc. */
+ /* PHP only needs to save the opline and check for an exception if the last reference to the array was garbage collected (destructors of elements in the array could throw an exception) */
+ if (Z_REFCOUNTED_P(var) && !Z_DELREF_P(var)) {
+ SAVE_OPLINE();
+ rc_dtor_func(Z_COUNTED_P(var));
+ ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
+ }
+ ZEND_VM_NEXT_OPCODE();
+}
+
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_THROW_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zval *value;
+
+ SAVE_OPLINE();
+ value = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+
+ do {
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST || UNEXPECTED(Z_TYPE_P(value) != IS_OBJECT)) {
+ if (((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_CV)) && Z_ISREF_P(value)) {
+ value = Z_REFVAL_P(value);
+ if (EXPECTED(Z_TYPE_P(value) == IS_OBJECT)) {
+ break;
+ }
+ }
+ if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_P(value) == IS_UNDEF)) {
+ ZVAL_UNDEFINED_OP1();
+ if (UNEXPECTED(EG(exception) != NULL)) {
+ HANDLE_EXCEPTION();
+ }
+ }
+ zend_throw_error(NULL, "Can only throw objects");
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ HANDLE_EXCEPTION();
+ }
+ } while (0);
+
+ zend_exception_save();
+ Z_TRY_ADDREF_P(value);
+ zend_throw_exception_object(value);
+ zend_exception_restore();
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ HANDLE_EXCEPTION();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAL_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
zval *value, *arg;
- zend_free_op free_op1;
- value = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
ZVAL_COPY_VALUE(arg, value);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
@@ -13553,9 +13008,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_SPEC_TMPVAR_HANDLER(ZEND_
{
USE_OPLINE
zval *val;
- zend_free_op free_op1;
- val = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ val = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (Z_TYPE_INFO_P(val) == IS_TRUE) {
ZVAL_TRUE(EX_VAR(opline->result.var));
} else if (EXPECTED(Z_TYPE_INFO_P(val) <= IS_TRUE)) {
@@ -13570,7 +13024,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_SPEC_TMPVAR_HANDLER(ZEND_
} else {
SAVE_OPLINE();
ZVAL_BOOL(EX_VAR(opline->result.var), i_zend_is_true(val));
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
ZEND_VM_NEXT_OPCODE();
@@ -13579,18 +13033,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_SPEC_TMPVAR_HANDLER(ZEND_
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *obj;
+ zend_object *zobj;
zend_class_entry *ce, *scope;
zend_function *clone;
zend_object_clone_obj_t clone_call;
SAVE_OPLINE();
- obj = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED && UNEXPECTED(Z_TYPE_P(obj) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
+ obj = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
do {
if ((IS_TMP_VAR|IS_VAR) == IS_CONST ||
@@ -13609,17 +13059,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_TMPVAR_HANDLER(ZEND
}
}
zend_throw_error(NULL, "__clone method called on non-object");
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
HANDLE_EXCEPTION();
}
} while (0);
- ce = Z_OBJCE_P(obj);
+ zobj = Z_OBJ_P(obj);
+ ce = zobj->ce;
clone = ce->clone;
- clone_call = Z_OBJ_HT_P(obj)->clone_obj;
+ clone_call = zobj->handlers->clone_obj;
if (UNEXPECTED(clone_call == NULL)) {
zend_throw_error(NULL, "Trying to clone an uncloneable object of class %s", ZSTR_VAL(ce->name));
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZVAL_UNDEF(EX_VAR(opline->result.var));
HANDLE_EXCEPTION();
}
@@ -13630,16 +13081,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_TMPVAR_HANDLER(ZEND
if (UNEXPECTED(clone->common.fn_flags & ZEND_ACC_PRIVATE)
|| UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), scope))) {
zend_wrong_clone_call(clone, scope);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZVAL_UNDEF(EX_VAR(opline->result.var));
HANDLE_EXCEPTION();
}
}
}
- ZVAL_OBJ(EX_VAR(opline->result.var), clone_call(obj));
+ ZVAL_OBJ(EX_VAR(opline->result.var), clone_call(zobj));
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -13647,13 +13098,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_TMPVAR_HA
{
USE_OPLINE
zend_op_array *new_op_array;
- zend_free_op free_op1;
zval *inc_filename;
SAVE_OPLINE();
- inc_filename = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ inc_filename = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
new_op_array = zend_include_or_eval(inc_filename, opline->extended_value);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
if (UNEXPECTED(EG(exception) != NULL)) {
if (new_op_array != ZEND_FAKE_OP_ARRAY && new_op_array != NULL) {
destroy_op_array(new_op_array);
@@ -13709,16 +13159,120 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_TMPVAR_HA
ZEND_VM_NEXT_OPCODE();
}
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zend_generator *generator = zend_get_running_generator(EXECUTE_DATA_C);
+ zval *val;
+
+ SAVE_OPLINE();
+ val = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+
+ if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
+ zend_throw_error(NULL, "Cannot use \"yield from\" in a force-closed generator");
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ UNDEF_RESULT();
+ HANDLE_EXCEPTION();
+ }
+
+yield_from_try_again:
+ if (Z_TYPE_P(val) == IS_ARRAY) {
+ ZVAL_COPY_VALUE(&generator->values, val);
+ if (Z_OPT_REFCOUNTED_P(val)) {
+ Z_ADDREF_P(val);
+ }
+ Z_FE_POS(generator->values) = 0;
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ } else if ((IS_TMP_VAR|IS_VAR) != IS_CONST && Z_TYPE_P(val) == IS_OBJECT && Z_OBJCE_P(val)->get_iterator) {
+ zend_class_entry *ce = Z_OBJCE_P(val);
+ if (ce == zend_ce_generator) {
+ zend_generator *new_gen = (zend_generator *) Z_OBJ_P(val);
+
+ Z_ADDREF_P(val);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+
+ if (Z_ISUNDEF(new_gen->retval)) {
+ if (UNEXPECTED(zend_generator_get_current(new_gen) == generator)) {
+ zend_throw_error(NULL, "Impossible to yield from the Generator being currently run");
+ zval_ptr_dtor(val);
+ UNDEF_RESULT();
+ HANDLE_EXCEPTION();
+ } else {
+ zend_generator_yield_from(generator, new_gen);
+ }
+ } else if (UNEXPECTED(new_gen->execute_data == NULL)) {
+ zend_throw_error(NULL, "Generator passed to yield from was aborted without proper return and is unable to continue");
+ zval_ptr_dtor(val);
+ UNDEF_RESULT();
+ HANDLE_EXCEPTION();
+ } else {
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), &new_gen->retval);
+ }
+ ZEND_VM_NEXT_OPCODE();
+ }
+ } else {
+ zend_object_iterator *iter = ce->get_iterator(ce, val, 0);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+
+ if (UNEXPECTED(!iter) || UNEXPECTED(EG(exception))) {
+ if (!EG(exception)) {
+ zend_throw_error(NULL, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name));
+ }
+ UNDEF_RESULT();
+ HANDLE_EXCEPTION();
+ }
+
+ iter->index = 0;
+ if (iter->funcs->rewind) {
+ iter->funcs->rewind(iter);
+ if (UNEXPECTED(EG(exception) != NULL)) {
+ OBJ_RELEASE(&iter->std);
+ UNDEF_RESULT();
+ HANDLE_EXCEPTION();
+ }
+ }
+
+ ZVAL_OBJ(&generator->values, &iter->std);
+ }
+ } else if (((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_CV)) && Z_TYPE_P(val) == IS_REFERENCE) {
+ val = Z_REFVAL_P(val);
+ goto yield_from_try_again;
+ } else {
+ zend_throw_error(NULL, "Can use \"yield from\" only with arrays and Traversables");
+ UNDEF_RESULT();
+ HANDLE_EXCEPTION();
+ }
+
+ /* This is the default return value
+ * when the expression is a Generator, it will be overwritten in zend_generator_resume() */
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_NULL(EX_VAR(opline->result.var));
+ }
+
+ /* This generator has no send target (though the generator we delegate to might have one) */
+ generator->send_target = NULL;
+
+ /* We increment to the next op, so we are at the correct position when the
+ * generator is resumed. */
+ ZEND_VM_INC_OPCODE();
+
+ /* The GOTO VM uses a local opline variable. We need to set the opline
+ * variable in execute_data so we don't resume at an old position. */
+ SAVE_OPLINE();
+
+ ZEND_VM_RETURN();
+}
+
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_STRLEN_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
zval *value;
- zend_free_op free_op1;
- value = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(value) == IS_STRING)) {
ZVAL_LONG(EX_VAR(opline->result.var), Z_STRLEN_P(value));
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE();
} else {
zend_bool strict;
@@ -13727,7 +13281,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_STRLEN_SPEC_TMPVAR_HANDLER(ZEN
value = Z_REFVAL_P(value);
if (EXPECTED(Z_TYPE_P(value) == IS_STRING)) {
ZVAL_LONG(EX_VAR(opline->result.var), Z_STRLEN_P(value));
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE();
}
}
@@ -13751,12 +13305,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_STRLEN_SPEC_TMPVAR_HANDLER(ZEN
zval_ptr_dtor(&tmp);
}
if (!EG(exception)) {
- zend_internal_type_error(strict, "strlen() expects parameter 1 to be string, %s given", zend_get_type_by_const(Z_TYPE_P(value)));
+ zend_type_error("strlen() expects parameter 1 to be string, %s given", zend_get_type_by_const(Z_TYPE_P(value)));
}
- ZVAL_NULL(EX_VAR(opline->result.var));
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
} while (0);
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -13765,12 +13319,11 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_TYPE_CHECK_SPEC_TM
USE_OPLINE
zval *value;
int result = 0;
- zend_free_op free_op1;
- value = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if ((opline->extended_value >> (uint32_t)Z_TYPE_P(value)) & 1) {
type_check_resource:
- if (EXPECTED(Z_TYPE_P(value) != IS_RESOURCE)
+ if (opline->extended_value != MAY_BE_RESOURCE
|| EXPECTED(NULL != zend_rsrc_list_get_rsrc_type(Z_RES_P(value)))) {
result = 1;
}
@@ -13790,28 +13343,86 @@ type_check_resource:
}
if ((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) {
SAVE_OPLINE();
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
}
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_NAME_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ uint32_t fetch_type;
+ zend_class_entry *called_scope, *scope;
+ USE_OPLINE
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED) {
+ zval *op = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ SAVE_OPLINE();
+ if (UNEXPECTED(Z_TYPE_P(op) != IS_OBJECT)) {
+ ZVAL_DEREF(op);
+ if (Z_TYPE_P(op) != IS_OBJECT) {
+ zend_type_error("Cannot use ::class on value of type %s",
+ zend_get_type_by_const(Z_TYPE_P(op)));
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ HANDLE_EXCEPTION();
+ }
+ }
+
+ ZVAL_STR_COPY(EX_VAR(opline->result.var), Z_OBJCE_P(op)->name);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
+ }
+
+ fetch_type = opline->op1.num;
+ scope = EX(func)->op_array.scope;
+ if (UNEXPECTED(scope == NULL)) {
+ SAVE_OPLINE();
+ zend_throw_error(NULL, "Cannot use \"%s\" when no class scope is active",
+ fetch_type == ZEND_FETCH_CLASS_SELF ? "self" :
+ fetch_type == ZEND_FETCH_CLASS_PARENT ? "parent" : "static");
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ HANDLE_EXCEPTION();
+ }
+
+ switch (fetch_type) {
+ case ZEND_FETCH_CLASS_SELF:
+ ZVAL_STR_COPY(EX_VAR(opline->result.var), scope->name);
+ break;
+ case ZEND_FETCH_CLASS_PARENT:
+ if (UNEXPECTED(scope->parent == NULL)) {
+ SAVE_OPLINE();
+ zend_throw_error(NULL,
+ "Cannot use \"parent\" when current class scope has no parent");
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ HANDLE_EXCEPTION();
+ }
+ ZVAL_STR_COPY(EX_VAR(opline->result.var), scope->parent->name);
+ break;
+ case ZEND_FETCH_CLASS_STATIC:
+ if (Z_TYPE(EX(This)) == IS_OBJECT) {
+ called_scope = Z_OBJCE(EX(This));
+ } else {
+ called_scope = Z_CE(EX(This));
+ }
+ ZVAL_STR_COPY(EX_VAR(opline->result.var), called_scope->name);
+ break;
+ EMPTY_SWITCH_DEFAULT_CASE()
+ }
+ ZEND_VM_NEXT_OPCODE();
+}
+
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DIV_SPEC_TMPVAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
SAVE_OPLINE();
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
op2 = RT_CONSTANT(opline, opline->op2);
fast_div_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -13819,14 +13430,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DIV_SPEC_TMPVAR_CONST_HANDLER(
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POW_SPEC_TMPVAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
SAVE_OPLINE();
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
op2 = RT_CONSTANT(opline, opline->op2);
pow_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -13834,10 +13444,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POW_SPEC_TMPVAR_CONST_HANDLER(
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_TMPVAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
op2 = RT_CONSTANT(opline, opline->op2);
if (((IS_TMP_VAR|IS_VAR) == IS_CONST || EXPECTED(Z_TYPE_P(op1) == IS_STRING)) &&
@@ -13897,7 +13506,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_TMPVAR_CONST_HANDL
op2 = ZVAL_UNDEFINED_OP2();
}
concat_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -13906,11 +13515,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_TMPVAR_CONST_HANDL
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMPVAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
double d1, d2;
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
op2 = RT_CONSTANT(opline, opline->op2);
if (1 && (IS_TMP_VAR|IS_VAR) == IS_CONST && IS_CONST == IS_CONST) {
/* pass */
@@ -13918,14 +13526,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMPVAR_CONST_HAN
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
if (EXPECTED(Z_LVAL_P(op1) == Z_LVAL_P(op2))) {
is_equal_true:
-
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_TRUE_NONE();
} else {
is_equal_false:
-
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_FALSE_NONE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -13969,11 +13573,10 @@ is_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMPVAR_CONST_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
double d1, d2;
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
op2 = RT_CONSTANT(opline, opline->op2);
if (1 && (IS_TMP_VAR|IS_VAR) == IS_CONST && IS_CONST == IS_CONST) {
/* pass */
@@ -13982,13 +13585,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMPVAR_CONST_JMP
if (EXPECTED(Z_LVAL_P(op1) == Z_LVAL_P(op2))) {
is_equal_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_equal_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -14032,11 +13631,10 @@ is_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMPVAR_CONST_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
double d1, d2;
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
op2 = RT_CONSTANT(opline, opline->op2);
if (1 && (IS_TMP_VAR|IS_VAR) == IS_CONST && IS_CONST == IS_CONST) {
/* pass */
@@ -14045,13 +13643,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMPVAR_CONST_JMP
if (EXPECTED(Z_LVAL_P(op1) == Z_LVAL_P(op2))) {
is_equal_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPNZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_equal_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPNZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -14095,11 +13689,10 @@ is_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMPVAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
double d1, d2;
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
op2 = RT_CONSTANT(opline, opline->op2);
if (1 && (IS_TMP_VAR|IS_VAR) == IS_CONST && IS_CONST == IS_CONST) {
/* pass */
@@ -14107,14 +13700,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMPVAR_CONST
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
if (EXPECTED(Z_LVAL_P(op1) != Z_LVAL_P(op2))) {
is_not_equal_true:
-
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_TRUE_NONE();
} else {
is_not_equal_false:
-
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_FALSE_NONE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -14158,11 +13747,10 @@ is_not_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMPVAR_CONST_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
double d1, d2;
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
op2 = RT_CONSTANT(opline, opline->op2);
if (1 && (IS_TMP_VAR|IS_VAR) == IS_CONST && IS_CONST == IS_CONST) {
/* pass */
@@ -14171,13 +13759,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMPVAR_CONST
if (EXPECTED(Z_LVAL_P(op1) != Z_LVAL_P(op2))) {
is_not_equal_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_not_equal_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -14221,11 +13805,10 @@ is_not_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMPVAR_CONST_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
double d1, d2;
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
op2 = RT_CONSTANT(opline, opline->op2);
if (1 && (IS_TMP_VAR|IS_VAR) == IS_CONST && IS_CONST == IS_CONST) {
/* pass */
@@ -14234,13 +13817,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMPVAR_CONST
if (EXPECTED(Z_LVAL_P(op1) != Z_LVAL_P(op2))) {
is_not_equal_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPNZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_not_equal_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPNZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -14284,14 +13863,13 @@ is_not_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SPACESHIP_SPEC_TMPVAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
SAVE_OPLINE();
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
op2 = RT_CONSTANT(opline, opline->op2);
compare_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -14299,14 +13877,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SPACESHIP_SPEC_TMPVAR_CONST_HA
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_TMPVAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
SAVE_OPLINE();
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
op2 = RT_CONSTANT(opline, opline->op2);
boolean_xor_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -14314,11 +13891,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_TMPVAR_CONST_HAN
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_TMPVAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container, *dim, *value;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
dim = RT_CONSTANT(opline, opline->op2);
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
@@ -14343,40 +13919,32 @@ fetch_dim_r_slow:
zend_fetch_dimension_address_read_R(container, dim, IS_CONST OPLINE_CC EXECUTE_DATA_CC);
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_TMPVAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
zend_fetch_dimension_address_read_IS(container, RT_CONSTANT(opline, opline->op2), IS_CONST OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_TMPVAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
-
zval *offset;
void **cache_slot = NULL;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
+ container = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
offset = RT_CONSTANT(opline, opline->op2);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST ||
@@ -14403,9 +13971,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_TMPVAR_CONST_
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value & ~ZEND_FETCH_REF /* FUNC_ARG fetch may contain it */);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -14430,10 +14000,10 @@ fetch_obj_r_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || ((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_r_copy;
@@ -14444,7 +14014,7 @@ fetch_obj_r_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -14456,11 +14026,22 @@ fetch_obj_r_fast_copy:
}
}
}
- } else if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
- ZVAL_UNDEFINED_OP2();
+ } else {
+ if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
+ ZVAL_UNDEFINED_OP2();
+ }
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_r_copy:
@@ -14472,26 +14053,19 @@ fetch_obj_r_copy:
fetch_obj_r_finish:
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_TMPVAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
-
zval *offset;
void **cache_slot = NULL;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
+ container = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
offset = RT_CONSTANT(opline, opline->op2);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST ||
@@ -14511,9 +14085,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_TMPVAR_CONST
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -14538,10 +14114,10 @@ fetch_obj_is_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || ((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_is_copy;
@@ -14552,7 +14128,7 @@ fetch_obj_is_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -14564,9 +14140,19 @@ fetch_obj_is_fast_copy:
}
}
}
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_is_copy:
@@ -14578,19 +14164,18 @@ fetch_obj_is_copy:
fetch_obj_is_finish:
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_TMPVAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
zend_string *op1_str, *op2_str, *str;
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
op2 = RT_CONSTANT(opline, opline->op2);
if (((IS_TMP_VAR|IS_VAR) == IS_CONST || EXPECTED(Z_TYPE_P(op1) == IS_STRING)) &&
(IS_CONST == IS_CONST || EXPECTED(Z_TYPE_P(op2) == IS_STRING))) {
@@ -14698,7 +14283,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_TMPVAR_CONST_
zend_string_release_ex(op2_str, 0);
}
} while (0);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -14707,7 +14292,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
{
USE_OPLINE
zval *function_name;
- zend_free_op free_op1;
zval *object;
zend_function *fbc;
zend_class_entry *called_scope;
@@ -14717,11 +14301,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
SAVE_OPLINE();
- object = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
+ object = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_CONST != IS_CONST) {
function_name = RT_CONSTANT(opline, opline->op2);
@@ -14738,13 +14318,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
} else if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(function_name) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP2();
if (UNEXPECTED(EG(exception) != NULL)) {
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
HANDLE_EXCEPTION();
}
}
zend_throw_error(NULL, "Method name must be a string");
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
HANDLE_EXCEPTION();
} while (0);
}
@@ -14772,7 +14352,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
}
zend_invalid_method_call(object, function_name);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
HANDLE_EXCEPTION();
}
} while (0);
@@ -14798,11 +14378,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
zend_undefined_method(obj->ce, Z_STR_P(function_name));
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
HANDLE_EXCEPTION();
}
if (IS_CONST == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE))) &&
EXPECTED(obj == orig_obj)) {
CACHE_POLYMORPHIC_PTR(opline->result.num, called_scope, fbc);
@@ -14822,7 +14401,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS;
if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0)) {
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
if (((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_TMP_VAR)) && UNEXPECTED(EG(exception))) {
HANDLE_EXCEPTION();
@@ -14833,9 +14412,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
} else if ((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_TMP_VAR|IS_CV)) {
if ((IS_TMP_VAR|IS_VAR) == IS_CV) {
GC_ADDREF(obj); /* For $this pointer */
- } else if (free_op1 != object) {
- GC_ADDREF(obj); /* For $this pointer */
- zval_ptr_dtor_nogc(free_op1);
+ } else {
+ zval *free_op1 = EX_VAR(opline->op1.var);
+ if (free_op1 != object) {
+ GC_ADDREF(obj); /* For $this pointer */
+ zval_ptr_dtor_nogc(free_op1);
+ }
}
/* CV may be changed indirectly (e.g. when it's a reference) */
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS | ZEND_CALL_RELEASE_THIS;
@@ -14852,24 +14434,19 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_TMPVAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
double d1, d2;
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
op2 = RT_CONSTANT(opline, opline->op2);
if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
if (EXPECTED(Z_LVAL_P(op1) == Z_LVAL_P(op2))) {
case_true:
ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
case_false:
ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -14908,14 +14485,13 @@ case_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_TMPVAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
int result;
zend_ulong hval;
zval *offset;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
offset = RT_CONSTANT(opline, opline->op2);
if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
@@ -14943,6 +14519,10 @@ num_index_prop:
goto isset_again;
} else {
value = zend_find_array_dim_slow(ht, offset EXECUTE_DATA_CC);
+ if (UNEXPECTED(EG(exception))) {
+ result = 0;
+ goto isset_dim_obj_exit;
+ }
}
if (!(opline->extended_value & ZEND_ISEMPTY)) {
@@ -14954,8 +14534,6 @@ num_index_prop:
/* avoid exception check */
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
} else {
result = (value == NULL || !i_zend_is_true(value));
@@ -14979,27 +14557,20 @@ num_index_prop:
isset_dim_obj_exit:
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_TMPVAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
int result;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
+ container = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
offset = RT_CONSTANT(opline, opline->op2);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST ||
@@ -15016,30 +14587,41 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_TM
}
}
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ result = 0;
+ goto isset_object_finish;
+ }
+ }
+
result =
(opline->extended_value & ZEND_ISEMPTY) ^
- Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY), ((IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+ Z_OBJ_HT_P(container)->has_property(Z_OBJ_P(container), name, (opline->extended_value & ZEND_ISEMPTY), ((IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
isset_object_finish:
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ARRAY_KEY_EXISTS_SPEC_TMPVAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *key, *subject;
HashTable *ht;
- uint32_t result;
+ zend_bool result;
SAVE_OPLINE();
- key = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ key = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
subject = RT_CONSTANT(opline, opline->op2);
if (EXPECTED(Z_TYPE_P(subject) == IS_ARRAY)) {
@@ -15053,25 +14635,23 @@ array_key_exists_array:
goto array_key_exists_array;
}
}
- result = zend_array_key_exists_slow(subject, key OPLINE_CC EXECUTE_DATA_CC);
+ zend_array_key_exists_error(subject, key OPLINE_CC EXECUTE_DATA_CC);
+ result = 0;
}
- zval_ptr_dtor_nogc(free_op1);
- ZEND_VM_SMART_BRANCH(result == IS_TRUE, 1);
- Z_TYPE_INFO_P(EX_VAR(opline->result.var)) = result;
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ ZEND_VM_SMART_BRANCH(result, 1);
}
/* No specialization for op_types (CONST|TMPVAR|UNUSED|CV, ANY) */
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_TMPVAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *expr;
zend_bool result;
SAVE_OPLINE();
- expr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ expr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
try_instanceof:
if (Z_TYPE_P(expr) == IS_OBJECT) {
@@ -15089,7 +14669,7 @@ try_instanceof:
ce = zend_fetch_class(NULL, opline->op2.num);
if (UNEXPECTED(ce == NULL)) {
ZEND_ASSERT(EG(exception));
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZVAL_UNDEF(EX_VAR(opline->result.var));
HANDLE_EXCEPTION();
}
@@ -15106,21 +14686,18 @@ try_instanceof:
}
result = 0;
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_R_INDEX_SPEC_TMPVAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container, *dim, *value;
zend_long offset;
HashTable *ht;
- container = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
dim = RT_CONSTANT(opline, opline->op2);
if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
fetch_dim_r_index_array:
@@ -15134,7 +14711,7 @@ fetch_dim_r_index_array:
ZVAL_COPY_DEREF(EX_VAR(opline->result.var), value);
if ((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) {
SAVE_OPLINE();
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
ZEND_VM_NEXT_OPCODE();
@@ -15153,7 +14730,7 @@ fetch_dim_r_index_slow:
dim++;
}
zend_fetch_dimension_address_read_R_slow(container, dim OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -15161,19 +14738,18 @@ fetch_dim_r_index_undef:
ZVAL_NULL(EX_VAR(opline->result.var));
SAVE_OPLINE();
zend_undefined_offset(offset);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_R_INDEX_SPEC_TMPVAR_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container, *dim, *value;
zend_long offset;
HashTable *ht;
- container = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
dim = EX_VAR(opline->op2.var);
if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
fetch_dim_r_index_array:
@@ -15187,7 +14763,7 @@ fetch_dim_r_index_array:
ZVAL_COPY_DEREF(EX_VAR(opline->result.var), value);
if ((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) {
SAVE_OPLINE();
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
ZEND_VM_NEXT_OPCODE();
@@ -15206,7 +14782,7 @@ fetch_dim_r_index_slow:
dim++;
}
zend_fetch_dimension_address_read_R_slow(container, dim OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -15214,48 +14790,45 @@ fetch_dim_r_index_undef:
ZVAL_NULL(EX_VAR(opline->result.var));
SAVE_OPLINE();
zend_undefined_offset(offset);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DIV_SPEC_TMPVAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
SAVE_OPLINE();
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
fast_div_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op1);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POW_SPEC_TMPVAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
SAVE_OPLINE();
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
pow_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op1);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_TMPVAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (((IS_TMP_VAR|IS_VAR) == IS_CONST || EXPECTED(Z_TYPE_P(op1) == IS_STRING)) &&
((IS_TMP_VAR|IS_VAR) == IS_CONST || EXPECTED(Z_TYPE_P(op2) == IS_STRING))) {
@@ -15314,8 +14887,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_TMPVAR_TMPVAR_HAND
op2 = ZVAL_UNDEFINED_OP2();
}
concat_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op1);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
}
@@ -15323,26 +14896,21 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_TMPVAR_TMPVAR_HAND
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMPVAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
double d1, d2;
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (1 && (IS_TMP_VAR|IS_VAR) == IS_CONST && (IS_TMP_VAR|IS_VAR) == IS_CONST) {
/* pass */
} else if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
if (EXPECTED(Z_LVAL_P(op1) == Z_LVAL_P(op2))) {
is_equal_true:
-
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_TRUE_NONE();
} else {
is_equal_false:
-
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_FALSE_NONE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -15386,12 +14954,11 @@ is_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMPVAR_TMPVAR_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
double d1, d2;
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (1 && (IS_TMP_VAR|IS_VAR) == IS_CONST && (IS_TMP_VAR|IS_VAR) == IS_CONST) {
/* pass */
} else if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
@@ -15399,13 +14966,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMPVAR_TMPVAR_JM
if (EXPECTED(Z_LVAL_P(op1) == Z_LVAL_P(op2))) {
is_equal_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_equal_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -15449,12 +15012,11 @@ is_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMPVAR_TMPVAR_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
double d1, d2;
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (1 && (IS_TMP_VAR|IS_VAR) == IS_CONST && (IS_TMP_VAR|IS_VAR) == IS_CONST) {
/* pass */
} else if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
@@ -15462,13 +15024,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_TMPVAR_TMPVAR_JM
if (EXPECTED(Z_LVAL_P(op1) == Z_LVAL_P(op2))) {
is_equal_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPNZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_equal_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPNZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -15512,26 +15070,21 @@ is_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMPVAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
double d1, d2;
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (1 && (IS_TMP_VAR|IS_VAR) == IS_CONST && (IS_TMP_VAR|IS_VAR) == IS_CONST) {
/* pass */
} else if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
if (EXPECTED(Z_LVAL_P(op1) != Z_LVAL_P(op2))) {
is_not_equal_true:
-
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_TRUE_NONE();
} else {
is_not_equal_false:
-
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_FALSE_NONE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -15575,12 +15128,11 @@ is_not_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMPVAR_TMPVAR_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
double d1, d2;
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (1 && (IS_TMP_VAR|IS_VAR) == IS_CONST && (IS_TMP_VAR|IS_VAR) == IS_CONST) {
/* pass */
} else if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
@@ -15588,13 +15140,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMPVAR_TMPVA
if (EXPECTED(Z_LVAL_P(op1) != Z_LVAL_P(op2))) {
is_not_equal_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_not_equal_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -15638,12 +15186,11 @@ is_not_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMPVAR_TMPVAR_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
double d1, d2;
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (1 && (IS_TMP_VAR|IS_VAR) == IS_CONST && (IS_TMP_VAR|IS_VAR) == IS_CONST) {
/* pass */
} else if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
@@ -15651,13 +15198,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_TMPVAR_TMPVA
if (EXPECTED(Z_LVAL_P(op1) != Z_LVAL_P(op2))) {
is_not_equal_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPNZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_not_equal_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPNZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -15701,42 +15244,39 @@ is_not_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SPACESHIP_SPEC_TMPVAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
SAVE_OPLINE();
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
compare_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op1);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_TMPVAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
SAVE_OPLINE();
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
boolean_xor_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op1);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_TMPVAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container, *dim, *value;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
fetch_dim_r_array:
@@ -15759,42 +15299,34 @@ fetch_dim_r_slow:
} else {
zend_fetch_dimension_address_read_R(container, dim, (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
}
- zval_ptr_dtor_nogc(free_op2);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_TMPVAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- zend_fetch_dimension_address_read_IS(container, _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op2);
- zval_ptr_dtor_nogc(free_op1);
+ container = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ zend_fetch_dimension_address_read_IS(container, _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_TMPVAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
- zend_free_op free_op2;
zval *offset;
void **cache_slot = NULL;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST ||
((IS_TMP_VAR|IS_VAR) != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT))) {
@@ -15820,9 +15352,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_TMPVAR_TMPVAR
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value & ~ZEND_FETCH_REF /* FUNC_ARG fetch may contain it */);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -15847,10 +15381,10 @@ fetch_obj_r_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || ((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_r_copy;
@@ -15861,7 +15395,7 @@ fetch_obj_r_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -15873,11 +15407,22 @@ fetch_obj_r_fast_copy:
}
}
}
- } else if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
- ZVAL_UNDEFINED_OP2();
+ } else {
+ if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
+ ZVAL_UNDEFINED_OP2();
+ }
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_r_copy:
@@ -15888,28 +15433,21 @@ fetch_obj_r_copy:
} while (0);
fetch_obj_r_finish:
- zval_ptr_dtor_nogc(free_op2);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_TMPVAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
- zend_free_op free_op2;
zval *offset;
void **cache_slot = NULL;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST ||
((IS_TMP_VAR|IS_VAR) != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT))) {
@@ -15928,9 +15466,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_TMPVAR_TMPVA
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -15955,10 +15495,10 @@ fetch_obj_is_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || ((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_is_copy;
@@ -15969,7 +15509,7 @@ fetch_obj_is_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -15981,9 +15521,19 @@ fetch_obj_is_fast_copy:
}
}
}
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_is_copy:
@@ -15994,21 +15544,20 @@ fetch_obj_is_copy:
} while (0);
fetch_obj_is_finish:
- zval_ptr_dtor_nogc(free_op2);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_TMPVAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
zend_string *op1_str, *op2_str, *str;
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (((IS_TMP_VAR|IS_VAR) == IS_CONST || EXPECTED(Z_TYPE_P(op1) == IS_STRING)) &&
((IS_TMP_VAR|IS_VAR) == IS_CONST || EXPECTED(Z_TYPE_P(op2) == IS_STRING))) {
zend_string *op1_str = Z_STR_P(op1);
@@ -16115,8 +15664,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_TMPVAR_TMPVAR
zend_string_release_ex(op2_str, 0);
}
} while (0);
- zval_ptr_dtor_nogc(free_op1);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -16124,7 +15673,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_T
{
USE_OPLINE
zval *function_name;
- zend_free_op free_op1, free_op2;
zval *object;
zend_function *fbc;
zend_class_entry *called_scope;
@@ -16134,14 +15682,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_T
SAVE_OPLINE();
- object = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
+ object = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
- function_name = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ function_name = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
}
if ((IS_TMP_VAR|IS_VAR) != IS_CONST &&
@@ -16155,13 +15699,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_T
} else if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_P(function_name) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP2();
if (UNEXPECTED(EG(exception) != NULL)) {
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
HANDLE_EXCEPTION();
}
}
zend_throw_error(NULL, "Method name must be a string");
- zval_ptr_dtor_nogc(free_op2);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
HANDLE_EXCEPTION();
} while (0);
}
@@ -16179,17 +15723,17 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_T
object = ZVAL_UNDEFINED_OP1();
if (UNEXPECTED(EG(exception) != NULL)) {
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
}
HANDLE_EXCEPTION();
}
}
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
- function_name = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ function_name = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
}
zend_invalid_method_call(object, function_name);
- zval_ptr_dtor_nogc(free_op2);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
HANDLE_EXCEPTION();
}
} while (0);
@@ -16205,7 +15749,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_T
zend_object *orig_obj = obj;
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
- function_name = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ function_name = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
}
/* First, locate the function. */
@@ -16214,12 +15758,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_T
if (EXPECTED(!EG(exception))) {
zend_undefined_method(obj->ce, Z_STR_P(function_name));
}
- zval_ptr_dtor_nogc(free_op2);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
HANDLE_EXCEPTION();
}
if ((IS_TMP_VAR|IS_VAR) == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE))) &&
EXPECTED(obj == orig_obj)) {
CACHE_POLYMORPHIC_PTR(opline->result.num, called_scope, fbc);
@@ -16234,12 +15777,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_T
}
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
}
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS;
if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0)) {
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
if (((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_TMP_VAR)) && UNEXPECTED(EG(exception))) {
HANDLE_EXCEPTION();
@@ -16250,9 +15793,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_T
} else if ((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_TMP_VAR|IS_CV)) {
if ((IS_TMP_VAR|IS_VAR) == IS_CV) {
GC_ADDREF(obj); /* For $this pointer */
- } else if (free_op1 != object) {
- GC_ADDREF(obj); /* For $this pointer */
- zval_ptr_dtor_nogc(free_op1);
+ } else {
+ zval *free_op1 = EX_VAR(opline->op1.var);
+ if (free_op1 != object) {
+ GC_ADDREF(obj); /* For $this pointer */
+ zval_ptr_dtor_nogc(free_op1);
+ }
}
/* CV may be changed indirectly (e.g. when it's a reference) */
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS | ZEND_CALL_RELEASE_THIS;
@@ -16269,24 +15815,19 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_T
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_TMPVAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
double d1, d2;
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
if (EXPECTED(Z_LVAL_P(op1) == Z_LVAL_P(op2))) {
case_true:
ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
case_false:
ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -16311,7 +15852,7 @@ case_double:
} else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) {
int result = zend_fast_equal_strings(Z_STR_P(op1), Z_STR_P(op2));
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (result) {
goto case_true;
} else {
@@ -16325,15 +15866,14 @@ case_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_TMPVAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container;
int result;
zend_ulong hval;
zval *offset;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
HashTable *ht;
@@ -16360,6 +15900,10 @@ num_index_prop:
goto isset_again;
} else {
value = zend_find_array_dim_slow(ht, offset EXECUTE_DATA_CC);
+ if (UNEXPECTED(EG(exception))) {
+ result = 0;
+ goto isset_dim_obj_exit;
+ }
}
if (!(opline->extended_value & ZEND_ISEMPTY)) {
@@ -16369,10 +15913,8 @@ num_index_prop:
if ((IS_TMP_VAR|IS_VAR) & (IS_CONST|IS_CV)) {
/* avoid exception check */
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
} else {
result = (value == NULL || !i_zend_is_true(value));
@@ -16395,29 +15937,22 @@ num_index_prop:
}
isset_dim_obj_exit:
- zval_ptr_dtor_nogc(free_op2);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_TMPVAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container;
int result;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST ||
((IS_TMP_VAR|IS_VAR) != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT))) {
@@ -16433,31 +15968,42 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_TM
}
}
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ result = 0;
+ goto isset_object_finish;
+ }
+ }
+
result =
(opline->extended_value & ZEND_ISEMPTY) ^
- Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+ Z_OBJ_HT_P(container)->has_property(Z_OBJ_P(container), name, (opline->extended_value & ZEND_ISEMPTY), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
isset_object_finish:
- zval_ptr_dtor_nogc(free_op2);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ARRAY_KEY_EXISTS_SPEC_TMPVAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *key, *subject;
HashTable *ht;
- uint32_t result;
+ zend_bool result;
SAVE_OPLINE();
- key = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- subject = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ key = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ subject = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(subject) == IS_ARRAY)) {
array_key_exists_array:
@@ -16470,26 +16016,24 @@ array_key_exists_array:
goto array_key_exists_array;
}
}
- result = zend_array_key_exists_slow(subject, key OPLINE_CC EXECUTE_DATA_CC);
+ zend_array_key_exists_error(subject, key OPLINE_CC EXECUTE_DATA_CC);
+ result = 0;
}
- zval_ptr_dtor_nogc(free_op2);
- zval_ptr_dtor_nogc(free_op1);
- ZEND_VM_SMART_BRANCH(result == IS_TRUE, 1);
- Z_TYPE_INFO_P(EX_VAR(opline->result.var)) = result;
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ ZEND_VM_SMART_BRANCH(result, 1);
}
/* No specialization for op_types (CONST|TMPVAR|UNUSED|CV, ANY) */
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_TMPVAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *expr;
zend_bool result;
SAVE_OPLINE();
- expr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ expr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
try_instanceof:
if (Z_TYPE_P(expr) == IS_OBJECT) {
@@ -16507,7 +16051,7 @@ try_instanceof:
ce = zend_fetch_class(NULL, opline->op2.num);
if (UNEXPECTED(ce == NULL)) {
ZEND_ASSERT(EG(exception));
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZVAL_UNDEF(EX_VAR(opline->result.var));
HANDLE_EXCEPTION();
}
@@ -16524,23 +16068,20 @@ try_instanceof:
}
result = 0;
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_TMPVAR_UNUSED(int type ZEND_OPCODE_HANDLER_ARGS_DC)
{
USE_OPLINE
- zend_free_op free_op1;
zval *varname;
zval *retval;
zend_string *name, *tmp_name;
HashTable *target_symbol_table;
SAVE_OPLINE();
- varname = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ varname = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
name = Z_STR_P(varname);
@@ -16553,7 +16094,7 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_ad
}
name = zval_try_get_tmp_string(varname, &tmp_name);
if (UNEXPECTED(!name)) {
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZVAL_UNDEF(EX_VAR(opline->result.var));
HANDLE_EXCEPTION();
}
@@ -16575,7 +16116,7 @@ fetch_this:
} else if (type == BP_VAR_IS) {
retval = &EG(uninitialized_zval);
} else {
- zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name));
+ zend_error(E_WARNING, "Undefined variable: %s", ZSTR_VAL(name));
if (type == BP_VAR_RW) {
retval = zend_hash_update(target_symbol_table, name, &EG(uninitialized_zval));
} else {
@@ -16594,7 +16135,7 @@ fetch_this:
} else if (type == BP_VAR_IS) {
retval = &EG(uninitialized_zval);
} else {
- zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name));
+ zend_error(E_WARNING, "Undefined variable: %s", ZSTR_VAL(name));
if (type == BP_VAR_RW) {
ZVAL_NULL(retval);
} else {
@@ -16605,7 +16146,7 @@ fetch_this:
}
if (!(opline->extended_value & ZEND_FETCH_GLOBAL_LOCK)) {
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
}
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
@@ -16661,11 +16202,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMPVAR_UNUSED_H
zval *varname;
zend_string *name, *tmp_name;
HashTable *target_symbol_table;
- zend_free_op free_op1;
SAVE_OPLINE();
- varname = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ varname = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
name = Z_STR_P(varname);
@@ -16678,7 +16218,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMPVAR_UNUSED_H
}
name = zval_try_get_tmp_string(varname, &tmp_name);
if (UNEXPECTED(!name)) {
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
HANDLE_EXCEPTION();
}
}
@@ -16689,7 +16229,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_TMPVAR_UNUSED_H
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
zend_tmp_string_release(tmp_name);
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -16699,13 +16239,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMPVAR_
USE_OPLINE
zval *value;
int result;
- zend_free_op free_op1;
zval *varname;
zend_string *name, *tmp_name;
HashTable *target_symbol_table;
SAVE_OPLINE();
- varname = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ varname = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
name = Z_STR_P(varname);
} else {
@@ -16718,7 +16257,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMPVAR_
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
zend_tmp_string_release(tmp_name);
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
if (!value) {
result = (opline->extended_value & ZEND_ISEMPTY);
@@ -16737,20 +16276,17 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMPVAR_
}
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
/* No specialization for op_types (CONST|TMPVAR|CV, UNUSED|CLASS_FETCH|CONST|VAR) */
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_TMPVAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *expr;
zend_bool result;
SAVE_OPLINE();
- expr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ expr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
try_instanceof:
if (Z_TYPE_P(expr) == IS_OBJECT) {
@@ -16768,7 +16304,7 @@ try_instanceof:
ce = zend_fetch_class(NULL, opline->op2.num);
if (UNEXPECTED(ce == NULL)) {
ZEND_ASSERT(EG(exception));
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZVAL_UNDEF(EX_VAR(opline->result.var));
HANDLE_EXCEPTION();
}
@@ -16785,29 +16321,28 @@ try_instanceof:
}
result = 0;
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COUNT_SPEC_TMPVAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1;
zend_long count;
SAVE_OPLINE();
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
while (1) {
if (Z_TYPE_P(op1) == IS_ARRAY) {
count = zend_array_count(Z_ARRVAL_P(op1));
break;
} else if (Z_TYPE_P(op1) == IS_OBJECT) {
+ zend_object *zobj = Z_OBJ_P(op1);
+
/* first, we check if the handler is defined */
- if (Z_OBJ_HT_P(op1)->count_elements) {
- if (SUCCESS == Z_OBJ_HT_P(op1)->count_elements(op1, &count)) {
+ if (zobj->handlers->count_elements) {
+ if (SUCCESS == zobj->handlers->count_elements(zobj, &count)) {
break;
}
if (UNEXPECTED(EG(exception))) {
@@ -16817,10 +16352,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COUNT_SPEC_TMPVAR_UNUSED_HANDL
}
/* if not and the object implements Countable we call its count() method */
- if (instanceof_function(Z_OBJCE_P(op1), zend_ce_countable)) {
+ if (zend_class_implements_interface(zobj->ce, zend_ce_countable)) {
zval retval;
- zend_call_method_with_0_params(op1, NULL, NULL, "count", &retval);
+ zend_call_method_with_0_params(zobj, NULL, NULL, "count", &retval);
count = zval_get_long(&retval);
zval_ptr_dtor(&retval);
break;
@@ -16844,7 +16379,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COUNT_SPEC_TMPVAR_UNUSED_HANDL
}
ZVAL_LONG(EX_VAR(opline->result.var), count);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -16863,11 +16398,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GET_CLASS_SPEC_TMPVAR_UNUSED_H
ZEND_VM_NEXT_OPCODE();
}
} else {
- zend_free_op free_op1;
zval *op1;
SAVE_OPLINE();
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
while (1) {
if (Z_TYPE_P(op1) == IS_OBJECT) {
ZVAL_STR_COPY(EX_VAR(opline->result.var), Z_OBJCE_P(op1)->name);
@@ -16878,12 +16412,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GET_CLASS_SPEC_TMPVAR_UNUSED_H
if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_P(op1) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- zend_error(E_WARNING, "get_class() expects parameter 1 to be object, %s given", zend_get_type_by_const(Z_TYPE_P(op1)));
- ZVAL_FALSE(EX_VAR(opline->result.var));
+ zend_type_error("get_class() expects parameter 1 to be object, %s given", zend_get_type_by_const(Z_TYPE_P(op1)));
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
}
break;
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
}
@@ -16891,8 +16425,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GET_CLASS_SPEC_TMPVAR_UNUSED_H
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COPY_TMP_SPEC_TMPVAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
- zval *value = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ zval *value = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
zval *result = EX_VAR(opline->result.var);
ZVAL_COPY(result, value);
ZEND_VM_NEXT_OPCODE();
@@ -16901,14 +16434,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COPY_TMP_SPEC_TMPVAR_UNUSED_HA
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DIV_SPEC_TMPVAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
SAVE_OPLINE();
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
op2 = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
fast_div_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -16916,14 +16448,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DIV_SPEC_TMPVAR_CV_HANDLER(ZEN
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POW_SPEC_TMPVAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
SAVE_OPLINE();
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
op2 = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
pow_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -16931,10 +16462,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POW_SPEC_TMPVAR_CV_HANDLER(ZEN
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_TMPVAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
op2 = EX_VAR(opline->op2.var);
if (((IS_TMP_VAR|IS_VAR) == IS_CONST || EXPECTED(Z_TYPE_P(op1) == IS_STRING)) &&
@@ -16994,7 +16524,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_TMPVAR_CV_HANDLER(
op2 = ZVAL_UNDEFINED_OP2();
}
concat_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -17003,14 +16533,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_TMPVAR_CV_HANDLER(
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SPACESHIP_SPEC_TMPVAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
SAVE_OPLINE();
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
op2 = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
compare_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -17018,11 +16547,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SPACESHIP_SPEC_TMPVAR_CV_HANDL
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_TMPVAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container, *dim, *value;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
dim = EX_VAR(opline->op2.var);
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
@@ -17047,40 +16575,32 @@ fetch_dim_r_slow:
zend_fetch_dimension_address_read_R(container, dim, IS_CV OPLINE_CC EXECUTE_DATA_CC);
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_TMPVAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
zend_fetch_dimension_address_read_IS(container, EX_VAR(opline->op2.var), IS_CV OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_TMPVAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
-
zval *offset;
void **cache_slot = NULL;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
+ container = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
offset = EX_VAR(opline->op2.var);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST ||
@@ -17107,9 +16627,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_TMPVAR_CV_HAN
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if (IS_CV == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value & ~ZEND_FETCH_REF /* FUNC_ARG fetch may contain it */);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -17134,10 +16656,10 @@ fetch_obj_r_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || ((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_r_copy;
@@ -17148,7 +16670,7 @@ fetch_obj_r_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -17160,11 +16682,22 @@ fetch_obj_r_fast_copy:
}
}
}
- } else if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
- ZVAL_UNDEFINED_OP2();
+ } else {
+ if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
+ ZVAL_UNDEFINED_OP2();
+ }
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_r_copy:
@@ -17176,26 +16709,19 @@ fetch_obj_r_copy:
fetch_obj_r_finish:
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_TMPVAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
-
zval *offset;
void **cache_slot = NULL;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
+ container = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
offset = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST ||
@@ -17215,9 +16741,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_TMPVAR_CV_HA
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if (IS_CV == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -17242,10 +16770,10 @@ fetch_obj_is_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || ((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_is_copy;
@@ -17256,7 +16784,7 @@ fetch_obj_is_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -17268,9 +16796,19 @@ fetch_obj_is_fast_copy:
}
}
}
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_is_copy:
@@ -17282,19 +16820,18 @@ fetch_obj_is_copy:
fetch_obj_is_finish:
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_TMPVAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
zend_string *op1_str, *op2_str, *str;
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
op2 = EX_VAR(opline->op2.var);
if (((IS_TMP_VAR|IS_VAR) == IS_CONST || EXPECTED(Z_TYPE_P(op1) == IS_STRING)) &&
(IS_CV == IS_CONST || EXPECTED(Z_TYPE_P(op2) == IS_STRING))) {
@@ -17402,7 +16939,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_TMPVAR_CV_HAN
zend_string_release_ex(op2_str, 0);
}
} while (0);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -17411,7 +16948,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
{
USE_OPLINE
zval *function_name;
- zend_free_op free_op1;
zval *object;
zend_function *fbc;
zend_class_entry *called_scope;
@@ -17421,11 +16957,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
SAVE_OPLINE();
- object = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
+ object = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_CV != IS_CONST) {
function_name = EX_VAR(opline->op2.var);
@@ -17442,13 +16974,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
} else if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_P(function_name) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP2();
if (UNEXPECTED(EG(exception) != NULL)) {
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
HANDLE_EXCEPTION();
}
}
zend_throw_error(NULL, "Method name must be a string");
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
HANDLE_EXCEPTION();
} while (0);
}
@@ -17476,7 +17008,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
}
zend_invalid_method_call(object, function_name);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
HANDLE_EXCEPTION();
}
} while (0);
@@ -17502,11 +17034,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
zend_undefined_method(obj->ce, Z_STR_P(function_name));
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
HANDLE_EXCEPTION();
}
if (IS_CV == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE))) &&
EXPECTED(obj == orig_obj)) {
CACHE_POLYMORPHIC_PTR(opline->result.num, called_scope, fbc);
@@ -17526,7 +17057,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS;
if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0)) {
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
if (((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_TMP_VAR)) && UNEXPECTED(EG(exception))) {
HANDLE_EXCEPTION();
@@ -17537,9 +17068,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
} else if ((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_TMP_VAR|IS_CV)) {
if ((IS_TMP_VAR|IS_VAR) == IS_CV) {
GC_ADDREF(obj); /* For $this pointer */
- } else if (free_op1 != object) {
- GC_ADDREF(obj); /* For $this pointer */
- zval_ptr_dtor_nogc(free_op1);
+ } else {
+ zval *free_op1 = EX_VAR(opline->op1.var);
+ if (free_op1 != object) {
+ GC_ADDREF(obj); /* For $this pointer */
+ zval_ptr_dtor_nogc(free_op1);
+ }
}
/* CV may be changed indirectly (e.g. when it's a reference) */
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS | ZEND_CALL_RELEASE_THIS;
@@ -17556,24 +17090,19 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_TMPVAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
double d1, d2;
- op1 = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
op2 = EX_VAR(opline->op2.var);
if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
if (EXPECTED(Z_LVAL_P(op1) == Z_LVAL_P(op2))) {
case_true:
ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
case_false:
ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -17612,14 +17141,13 @@ case_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_TMPVAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
int result;
zend_ulong hval;
zval *offset;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
offset = EX_VAR(opline->op2.var);
if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
@@ -17647,6 +17175,10 @@ num_index_prop:
goto isset_again;
} else {
value = zend_find_array_dim_slow(ht, offset EXECUTE_DATA_CC);
+ if (UNEXPECTED(EG(exception))) {
+ result = 0;
+ goto isset_dim_obj_exit;
+ }
}
if (!(opline->extended_value & ZEND_ISEMPTY)) {
@@ -17658,8 +17190,6 @@ num_index_prop:
/* avoid exception check */
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
} else {
result = (value == NULL || !i_zend_is_true(value));
@@ -17683,27 +17213,20 @@ num_index_prop:
isset_dim_obj_exit:
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_TMPVAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
int result;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- container = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
+ container = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
offset = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST ||
@@ -17720,30 +17243,41 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_TM
}
}
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ result = 0;
+ goto isset_object_finish;
+ }
+ }
+
result =
(opline->extended_value & ZEND_ISEMPTY) ^
- Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY), ((IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+ Z_OBJ_HT_P(container)->has_property(Z_OBJ_P(container), name, (opline->extended_value & ZEND_ISEMPTY), ((IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
isset_object_finish:
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ARRAY_KEY_EXISTS_SPEC_TMPVAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *key, *subject;
HashTable *ht;
- uint32_t result;
+ zend_bool result;
SAVE_OPLINE();
- key = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ key = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
subject = EX_VAR(opline->op2.var);
if (EXPECTED(Z_TYPE_P(subject) == IS_ARRAY)) {
@@ -17757,13 +17291,12 @@ array_key_exists_array:
goto array_key_exists_array;
}
}
- result = zend_array_key_exists_slow(subject, key OPLINE_CC EXECUTE_DATA_CC);
+ zend_array_key_exists_error(subject, key OPLINE_CC EXECUTE_DATA_CC);
+ result = 0;
}
- zval_ptr_dtor_nogc(free_op1);
- ZEND_VM_SMART_BRANCH(result == IS_TRUE, 1);
- Z_TYPE_INFO_P(EX_VAR(opline->result.var)) = result;
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ ZEND_VM_SMART_BRANCH(result, 1);
}
/* No specialization for op_types (CONST|TMPVAR|UNUSED|CV, ANY) */
@@ -17772,9 +17305,8 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_SPEC_TMP_HA
USE_OPLINE
zval *retval_ptr;
zval *return_value;
- zend_free_op free_op1;
- retval_ptr = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ retval_ptr = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
return_value = EX(return_value);
if (IS_TMP_VAR == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(retval_ptr) == IS_UNDEF)) {
SAVE_OPLINE();
@@ -17784,9 +17316,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_SPEC_TMP_HA
}
} else if (!return_value) {
if (IS_TMP_VAR & (IS_VAR|IS_TMP_VAR)) {
- if (Z_REFCOUNTED_P(free_op1) && !Z_DELREF_P(free_op1)) {
+ if (Z_REFCOUNTED_P(retval_ptr) && !Z_DELREF_P(retval_ptr)) {
SAVE_OPLINE();
- rc_dtor_func(Z_COUNTED_P(free_op1));
+ rc_dtor_func(Z_COUNTED_P(retval_ptr));
}
}
} else {
@@ -17844,7 +17376,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_TMP_HANDLER
{
USE_OPLINE
zval *retval_ptr;
- zend_free_op free_op1;
SAVE_OPLINE();
@@ -17854,9 +17385,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_TMP_HANDLER
/* Not supposed to happen, but we'll allow it */
zend_error(E_NOTICE, "Only variable references should be returned by reference");
- retval_ptr = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ retval_ptr = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
if (!EX(return_value)) {
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
} else {
if (IS_TMP_VAR == IS_VAR && UNEXPECTED(Z_ISREF_P(retval_ptr))) {
ZVAL_COPY_VALUE(EX(return_value), retval_ptr);
@@ -17904,12 +17435,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GENERATOR_RETURN_SPEC_TMP_HAND
{
USE_OPLINE
zval *retval;
- zend_free_op free_op1;
zend_generator *generator = zend_get_running_generator(EXECUTE_DATA_C);
SAVE_OPLINE();
- retval = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ retval = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
/* Copy return value into generator->retval */
if ((IS_TMP_VAR & (IS_CONST|IS_TMP_VAR))) {
@@ -17944,51 +17474,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GENERATOR_RETURN_SPEC_TMP_HAND
ZEND_VM_RETURN();
}
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_THROW_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
- zval *value;
- zend_free_op free_op1;
-
- SAVE_OPLINE();
- value = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- do {
- if (IS_TMP_VAR == IS_CONST || UNEXPECTED(Z_TYPE_P(value) != IS_OBJECT)) {
- if ((IS_TMP_VAR & (IS_VAR|IS_CV)) && Z_ISREF_P(value)) {
- value = Z_REFVAL_P(value);
- if (EXPECTED(Z_TYPE_P(value) == IS_OBJECT)) {
- break;
- }
- }
- if (IS_TMP_VAR == IS_CV && UNEXPECTED(Z_TYPE_P(value) == IS_UNDEF)) {
- ZVAL_UNDEFINED_OP1();
- if (UNEXPECTED(EG(exception) != NULL)) {
- HANDLE_EXCEPTION();
- }
- }
- zend_throw_error(NULL, "Can only throw objects");
- zval_ptr_dtor_nogc(free_op1);
- HANDLE_EXCEPTION();
- }
- } while (0);
-
- zend_exception_save();
- if (IS_TMP_VAR != IS_TMP_VAR) {
- Z_TRY_ADDREF_P(value);
- }
-
- zend_throw_exception_object(value);
- zend_exception_restore();
-
- HANDLE_EXCEPTION();
-}
-
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAL_EX_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
zval *value, *arg;
- zend_free_op free_op1;
uint32_t arg_num = opline->op2.num;
if (EXPECTED(0)) {
@@ -17999,7 +17488,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAL_EX_SPEC_TMP_HANDLER(Z
send_val_by_ref:
ZEND_VM_TAIL_CALL(zend_cannot_pass_by_ref_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- value = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
ZVAL_COPY_VALUE(arg, value);
if (IS_TMP_VAR == IS_CONST) {
@@ -18014,7 +17503,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAL_EX_SPEC_T
{
USE_OPLINE
zval *value, *arg;
- zend_free_op free_op1;
uint32_t arg_num = opline->op2.num;
if (EXPECTED(1)) {
@@ -18025,7 +17513,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAL_EX_SPEC_T
send_val_by_ref:
ZEND_VM_TAIL_CALL(zend_cannot_pass_by_ref_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- value = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
ZVAL_COPY_VALUE(arg, value);
if (IS_TMP_VAR == IS_CONST) {
@@ -18040,7 +17528,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_USER_SPEC_TMP_HANDLER(ZEN
{
USE_OPLINE
zval *arg, *param;
- zend_free_op free_op1;
SAVE_OPLINE();
@@ -18048,31 +17535,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_USER_SPEC_TMP_HANDLER(ZEN
zend_param_must_be_ref(EX(call)->func, opline->op2.num);
}
- arg = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ arg = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
param = ZEND_CALL_VAR(EX(call), opline->result.var);
ZVAL_COPY(param, arg);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CAST_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *expr;
zval *result = EX_VAR(opline->result.var);
HashTable *ht;
SAVE_OPLINE();
- expr = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ expr = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
switch (opline->extended_value) {
- case IS_NULL:
- ZVAL_NULL(result);
- break;
- case _IS_BOOL:
- ZVAL_BOOL(result, zend_is_true(expr));
- break;
case IS_LONG:
ZVAL_LONG(result, zval_get_long(expr));
break;
@@ -18083,6 +17563,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CAST_SPEC_TMP_HANDLER(ZEND_OPC
ZVAL_STR(result, zval_get_string(expr));
break;
default:
+ ZEND_ASSERT(opline->extended_value != _IS_BOOL && "Must use ZEND_BOOL instead");
if (IS_TMP_VAR & (IS_VAR|IS_CV)) {
ZVAL_DEREF(expr);
}
@@ -18125,6 +17606,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CAST_SPEC_TMP_HANDLER(ZEND_OPC
}
}
} else {
+ ZEND_ASSERT(opline->extended_value == IS_OBJECT);
ZVAL_OBJ(result, zend_objects_new(zend_standard_class_def));
if (Z_TYPE_P(expr) == IS_ARRAY) {
ht = zend_symtable_to_proptable(Z_ARR_P(expr));
@@ -18145,19 +17627,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CAST_SPEC_TMP_HANDLER(ZEND_OPC
}
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *array_ptr, *result;
SAVE_OPLINE();
- array_ptr = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ array_ptr = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(array_ptr) == IS_ARRAY)) {
result = EX_VAR(opline->result.var);
ZVAL_COPY_VALUE(result, array_ptr);
@@ -18168,26 +17649,33 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_TMP_HANDLER(ZE
ZEND_VM_NEXT_OPCODE();
} else if (IS_TMP_VAR != IS_CONST && EXPECTED(Z_TYPE_P(array_ptr) == IS_OBJECT)) {
- if (!Z_OBJCE_P(array_ptr)->get_iterator) {
+ zend_object *zobj = Z_OBJ_P(array_ptr);
+ if (!zobj->ce->get_iterator) {
+ HashTable *properties;
+
result = EX_VAR(opline->result.var);
- ZVAL_COPY_VALUE(result, array_ptr);
+ ZVAL_OBJ(result, zobj);
if (IS_TMP_VAR != IS_TMP_VAR) {
- Z_ADDREF_P(array_ptr);
+ GC_ADDREF(zobj);
}
- if (Z_OBJ_P(array_ptr)->properties
- && UNEXPECTED(GC_REFCOUNT(Z_OBJ_P(array_ptr)->properties) > 1)) {
- if (EXPECTED(!(GC_FLAGS(Z_OBJ_P(array_ptr)->properties) & IS_ARRAY_IMMUTABLE))) {
- GC_DELREF(Z_OBJ_P(array_ptr)->properties);
+ properties = zobj->properties;
+ if (properties) {
+ if (UNEXPECTED(GC_REFCOUNT(properties) > 1)) {
+ if (EXPECTED(!(GC_FLAGS(properties) & IS_ARRAY_IMMUTABLE))) {
+ GC_DELREF(properties);
+ }
+ properties = zobj->properties = zend_array_dup(properties);
}
- Z_OBJ_P(array_ptr)->properties = zend_array_dup(Z_OBJ_P(array_ptr)->properties);
+ } else {
+ properties = zobj->handlers->get_properties(zobj);
}
- Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_OBJPROP_P(array_ptr), 0);
+ Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(properties, 0);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
zend_bool is_empty = zend_fe_reset_iterator(array_ptr, 0 OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
if (UNEXPECTED(EG(exception))) {
HANDLE_EXCEPTION();
} else if (is_empty) {
@@ -18200,7 +17688,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_TMP_HANDLER(ZE
zend_error(E_WARNING, "Invalid argument supplied for foreach()");
ZVAL_UNDEF(EX_VAR(opline->result.var));
Z_FE_ITER_P(EX_VAR(opline->result.var)) = (uint32_t)-1;
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_JMP(OP_JMP_ADDR(opline, opline->op2));
}
}
@@ -18208,7 +17696,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_TMP_HANDLER(ZE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *array_ptr, *array_ref;
SAVE_OPLINE();
@@ -18219,7 +17706,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_TMP_HANDLER(Z
array_ptr = Z_REFVAL_P(array_ref);
}
} else {
- array_ref = array_ptr = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ array_ref = array_ptr = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
}
if (EXPECTED(Z_TYPE_P(array_ptr) == IS_ARRAY)) {
@@ -18275,7 +17762,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_TMP_HANDLER(Z
if (IS_TMP_VAR == IS_VAR) {
} else {
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
}
if (UNEXPECTED(EG(exception))) {
HANDLE_EXCEPTION();
@@ -18292,7 +17779,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_TMP_HANDLER(Z
if (IS_TMP_VAR == IS_VAR) {
} else {
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
}
ZEND_VM_JMP(OP_JMP_ADDR(opline, opline->op2));
}
@@ -18302,7 +17789,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_END_SILENCE_SPEC_TMP_HANDLER(Z
{
USE_OPLINE
- if (!EG(error_reporting) && Z_LVAL_P(EX_VAR(opline->op1.var)) != 0) {
+ if (E_HAS_ONLY_FATAL_ERRORS(EG(error_reporting))
+ && !E_HAS_ONLY_FATAL_ERRORS(Z_LVAL_P(EX_VAR(opline->op1.var)))) {
EG(error_reporting) = Z_LVAL_P(EX_VAR(opline->op1.var));
}
ZEND_VM_NEXT_OPCODE();
@@ -18311,13 +17799,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_END_SILENCE_SPEC_TMP_HANDLER(Z
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMP_SET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *value;
zval *ref = NULL;
int ret;
SAVE_OPLINE();
- value = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV) && Z_ISREF_P(value)) {
if (IS_TMP_VAR == IS_VAR) {
@@ -18329,7 +17816,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMP_SET_SPEC_TMP_HANDLER(ZEND_
ret = i_zend_is_true(value);
if (UNEXPECTED(EG(exception))) {
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZVAL_UNDEF(EX_VAR(opline->result.var));
HANDLE_EXCEPTION();
}
@@ -18354,19 +17841,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMP_SET_SPEC_TMP_HANDLER(ZEND_
ZEND_VM_JMP_EX(OP_JMP_ADDR(opline, opline->op2), 0);
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COALESCE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *value;
zval *ref = NULL;
SAVE_OPLINE();
- value = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR & (IS_VAR|IS_CV)) && Z_ISREF_P(value)) {
if (IS_TMP_VAR & IS_VAR) {
@@ -18394,18 +17880,17 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COALESCE_SPEC_TMP_HANDLER(ZEND
ZEND_VM_JMP_EX(OP_JMP_ADDR(opline, opline->op2), 0);
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_QM_ASSIGN_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *value;
zval *result = EX_VAR(opline->result.var);
- value = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
if (IS_TMP_VAR == IS_CV && UNEXPECTED(Z_TYPE_P(value) == IS_UNDEF)) {
SAVE_OPLINE();
ZVAL_UNDEFINED_OP1();
@@ -18437,145 +17922,34 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_QM_ASSIGN_SPEC_TMP
ZEND_VM_NEXT_OPCODE();
}
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
-
- zend_generator *generator = zend_get_running_generator(EXECUTE_DATA_C);
-
- zval *val;
- zend_free_op free_op1;
-
- SAVE_OPLINE();
- val = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
- zend_throw_error(NULL, "Cannot use \"yield from\" in a force-closed generator");
- zval_ptr_dtor_nogc(free_op1);
- UNDEF_RESULT();
- HANDLE_EXCEPTION();
- }
-
- if (Z_TYPE_P(val) == IS_ARRAY) {
- ZVAL_COPY_VALUE(&generator->values, val);
- if (IS_TMP_VAR != IS_TMP_VAR && Z_OPT_REFCOUNTED_P(val)) {
- Z_ADDREF_P(val);
- }
- Z_FE_POS(generator->values) = 0;
-
- } else if (IS_TMP_VAR != IS_CONST && Z_TYPE_P(val) == IS_OBJECT && Z_OBJCE_P(val)->get_iterator) {
- zend_class_entry *ce = Z_OBJCE_P(val);
- if (ce == zend_ce_generator) {
- zend_generator *new_gen = (zend_generator *) Z_OBJ_P(val);
-
- if (IS_TMP_VAR != IS_TMP_VAR) {
- Z_ADDREF_P(val);
- }
-
- if (Z_ISUNDEF(new_gen->retval)) {
- if (UNEXPECTED(zend_generator_get_current(new_gen) == generator)) {
- zend_throw_error(NULL, "Impossible to yield from the Generator being currently run");
- zval_ptr_dtor(val);
- UNDEF_RESULT();
- HANDLE_EXCEPTION();
- } else {
- zend_generator_yield_from(generator, new_gen);
- }
- } else if (UNEXPECTED(new_gen->execute_data == NULL)) {
- zend_throw_error(NULL, "Generator passed to yield from was aborted without proper return and is unable to continue");
- zval_ptr_dtor(val);
- UNDEF_RESULT();
- HANDLE_EXCEPTION();
- } else {
- if (RETURN_VALUE_USED(opline)) {
- ZVAL_COPY(EX_VAR(opline->result.var), &new_gen->retval);
- }
- ZEND_VM_NEXT_OPCODE();
- }
- } else {
- zend_object_iterator *iter = ce->get_iterator(ce, val, 0);
- zval_ptr_dtor_nogc(free_op1);
-
- if (UNEXPECTED(!iter) || UNEXPECTED(EG(exception))) {
- if (!EG(exception)) {
- zend_throw_error(NULL, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name));
- }
- UNDEF_RESULT();
- HANDLE_EXCEPTION();
- }
-
- iter->index = 0;
- if (iter->funcs->rewind) {
- iter->funcs->rewind(iter);
- if (UNEXPECTED(EG(exception) != NULL)) {
- OBJ_RELEASE(&iter->std);
- UNDEF_RESULT();
- HANDLE_EXCEPTION();
- }
- }
-
- ZVAL_OBJ(&generator->values, &iter->std);
- }
- } else {
- zend_throw_error(NULL, "Can use \"yield from\" only with arrays and Traversables");
- UNDEF_RESULT();
- HANDLE_EXCEPTION();
- }
-
- /* This is the default return value
- * when the expression is a Generator, it will be overwritten in zend_generator_resume() */
- if (RETURN_VALUE_USED(opline)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
-
- /* This generator has no send target (though the generator we delegate to might have one) */
- generator->send_target = NULL;
-
- /* We increment to the next op, so we are at the correct position when the
- * generator is resumed. */
- ZEND_VM_INC_OPCODE();
-
- /* The GOTO VM uses a local opline variable. We need to set the opline
- * variable in execute_data so we don't resume at an old position. */
- SAVE_OPLINE();
-
- ZEND_VM_RETURN();
-}
-
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
zend_bool result;
SAVE_OPLINE();
- op1 = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
op2 = RT_CONSTANT(opline, opline->op2);
result = fast_is_identical_function(op1, op2);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
zend_bool result;
SAVE_OPLINE();
- op1 = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
op2 = RT_CONSTANT(opline, opline->op2);
result = fast_is_not_identical_function(op1, op2);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -18617,7 +17991,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_TMP_CO
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_ADD_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zend_string **rope;
zval *var;
@@ -18653,7 +18026,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_ADD_SPEC_TMP_CONST_HANDLE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_END_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zend_string **rope;
zval *var, *ret;
uint32_t i;
@@ -18710,7 +18082,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_END_SPEC_TMP_CONST_HANDLE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *expr_ptr, new_expr;
SAVE_OPLINE();
@@ -18724,7 +18095,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CON
}
} else {
- expr_ptr = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ expr_ptr = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
if (IS_TMP_VAR == IS_TMP_VAR) {
/* pass */
} else if (IS_TMP_VAR == IS_CONST) {
@@ -18749,7 +18120,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CON
}
if (IS_CONST != IS_UNUSED) {
-
zval *offset = RT_CONSTANT(opline, opline->op2);
zend_string *str;
zend_ulong hval;
@@ -18845,8 +18215,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CONST_HANDLER(Z
/* Set the new yielded value */
if (IS_TMP_VAR != IS_UNUSED) {
- zend_free_op free_op1;
-
if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
/* Constants and temporary variables aren't yieldable by reference,
* but we still allow them with a notice. */
@@ -18855,7 +18223,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CONST_HANDLER(Z
zend_error(E_NOTICE, "Only variable references should be yielded by reference");
- value = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
ZVAL_COPY_VALUE(&generator->value, value);
if (IS_TMP_VAR == IS_CONST) {
if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->value))) {
@@ -18887,7 +18255,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CONST_HANDLER(Z
}
} else {
- zval *value = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ zval *value = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
/* Consts, temporary variables and references need copying */
if (IS_TMP_VAR == IS_CONST) {
@@ -18914,26 +18282,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CONST_HANDLER(Z
/* Set the new yielded key */
if (IS_CONST != IS_UNUSED) {
-
zval *key = RT_CONSTANT(opline, opline->op2);
-
- /* Consts, temporary variables and references need copying */
- if (IS_CONST == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_CONST == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_CONST & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
-
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_CONST == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
+ if ((IS_CONST & (IS_CV|IS_VAR)) && UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE) {
+ key = Z_REFVAL_P(key);
}
+ ZVAL_COPY(&generator->key, key);
if (Z_TYPE(generator->key) == IS_LONG
&& Z_LVAL(generator->key) > generator->largest_used_integer_key
@@ -18969,13 +18322,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CONST_HANDLER(Z
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IN_ARRAY_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1;
HashTable *ht = Z_ARRVAL_P(RT_CONSTANT(opline, opline->op2));
zval *result;
SAVE_OPLINE();
- op1 = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) {
result = zend_hash_find_ex(ht, Z_STR_P(op1), IS_TMP_VAR == IS_CONST);
} else if (opline->extended_value) {
@@ -18988,22 +18340,19 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IN_ARRAY_SPEC_TMP_CONST_HANDLE
result = zend_hash_find_ex(ht, ZSTR_EMPTY_ALLOC(), 1);
} else {
zend_string *key;
- zval key_tmp, result_tmp, *val;
+ zval key_tmp, *val;
result = NULL;
ZEND_HASH_FOREACH_STR_KEY_VAL(ht, key, val) {
ZVAL_STR(&key_tmp, key);
- compare_function(&result_tmp, op1, &key_tmp);
- if (Z_LVAL(result_tmp) == 0) {
+ if (zend_compare(op1, &key_tmp) == 0) {
result = val;
break;
}
} ZEND_HASH_FOREACH_END();
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result != NULL);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_TMP_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -19045,20 +18394,19 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_TMP_TM
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_ADD_SPEC_TMP_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zend_string **rope;
zval *var;
/* op1 and result are the same */
rope = (zend_string**)EX_VAR(opline->op1.var);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
- var = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ var = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
rope[opline->extended_value] = Z_STR_P(var);
if (UNEXPECTED(Z_REFCOUNTED_P(var))) {
Z_ADDREF_P(var);
}
} else {
- var = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ var = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(var) == IS_STRING)) {
if ((IS_TMP_VAR|IS_VAR) == IS_CV) {
rope[opline->extended_value] = zend_string_copy(Z_STR_P(var));
@@ -19071,7 +18419,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_ADD_SPEC_TMP_TMPVAR_HANDL
ZVAL_UNDEFINED_OP2();
}
rope[opline->extended_value] = zval_get_string_func(var);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
}
@@ -19081,7 +18429,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_ADD_SPEC_TMP_TMPVAR_HANDL
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_END_SPEC_TMP_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zend_string **rope;
zval *var, *ret;
uint32_t i;
@@ -19090,13 +18437,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_END_SPEC_TMP_TMPVAR_HANDL
rope = (zend_string**)EX_VAR(opline->op1.var);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
- var = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ var = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
rope[opline->extended_value] = Z_STR_P(var);
if (UNEXPECTED(Z_REFCOUNTED_P(var))) {
Z_ADDREF_P(var);
}
} else {
- var = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ var = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(var) == IS_STRING)) {
if ((IS_TMP_VAR|IS_VAR) == IS_CV) {
rope[opline->extended_value] = zend_string_copy(Z_STR_P(var));
@@ -19109,7 +18456,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_END_SPEC_TMP_TMPVAR_HANDL
ZVAL_UNDEFINED_OP2();
}
rope[opline->extended_value] = zval_get_string_func(var);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (UNEXPECTED(EG(exception))) {
for (i = 0; i <= opline->extended_value; i++) {
zend_string_release_ex(rope[i], 0);
@@ -19138,7 +18485,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_END_SPEC_TMP_TMPVAR_HANDL
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *expr_ptr, new_expr;
SAVE_OPLINE();
@@ -19152,7 +18498,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_TMP
}
} else {
- expr_ptr = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ expr_ptr = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
if (IS_TMP_VAR == IS_TMP_VAR) {
/* pass */
} else if (IS_TMP_VAR == IS_CONST) {
@@ -19177,8 +18523,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_TMP
}
if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED) {
- zend_free_op free_op2;
- zval *offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ zval *offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
zend_string *str;
zend_ulong hval;
@@ -19223,7 +18568,7 @@ num_index:
zend_illegal_offset();
zval_ptr_dtor_nogc(expr_ptr);
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
} else {
if (!zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr)) {
zend_cannot_add_element();
@@ -19254,43 +18599,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_TMP_TMPVAR_HAN
}
}
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
- zend_free_op free_op1, free_op2;
- zval *op1, *op2;
- zend_bool result;
-
- SAVE_OPLINE();
- op1 = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_tmp(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- result = fast_is_identical_function(op1, op2);
- zval_ptr_dtor_nogc(free_op1);
- zval_ptr_dtor_nogc(free_op2);
- ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
-}
-
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
- zend_free_op free_op1, free_op2;
- zval *op1, *op2;
- zend_bool result;
-
- SAVE_OPLINE();
- op1 = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_tmp(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- result = fast_is_not_identical_function(op1, op2);
- zval_ptr_dtor_nogc(free_op1);
- zval_ptr_dtor_nogc(free_op2);
- ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
-}
-
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -19309,8 +18618,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_TMP_HANDLER(ZEN
/* Set the new yielded value */
if (IS_TMP_VAR != IS_UNUSED) {
- zend_free_op free_op1;
-
if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
/* Constants and temporary variables aren't yieldable by reference,
* but we still allow them with a notice. */
@@ -19319,7 +18626,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_TMP_HANDLER(ZEN
zend_error(E_NOTICE, "Only variable references should be yielded by reference");
- value = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
ZVAL_COPY_VALUE(&generator->value, value);
if (IS_TMP_VAR == IS_CONST) {
if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->value))) {
@@ -19351,7 +18658,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_TMP_HANDLER(ZEN
}
} else {
- zval *value = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ zval *value = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
/* Consts, temporary variables and references need copying */
if (IS_TMP_VAR == IS_CONST) {
@@ -19377,27 +18684,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_TMP_HANDLER(ZEN
}
/* Set the new yielded key */
- if (IS_TMP_VAR != IS_UNUSED) {
- zend_free_op free_op2;
- zval *key = _get_zval_ptr_tmp(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
-
- /* Consts, temporary variables and references need copying */
- if (IS_TMP_VAR == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_TMP_VAR == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_TMP_VAR & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
-
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_TMP_VAR == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
+ if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED) {
+ zval *key = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ if (((IS_TMP_VAR|IS_VAR) & (IS_CV|IS_VAR)) && UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE) {
+ key = Z_REFVAL_P(key);
}
+ ZVAL_COPY(&generator->key, key);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (Z_TYPE(generator->key) == IS_LONG
&& Z_LVAL(generator->key) > generator->largest_used_integer_key
@@ -19430,144 +18723,34 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_TMP_HANDLER(ZEN
ZEND_VM_RETURN();
}
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
- zend_generator *generator = zend_get_running_generator(EXECUTE_DATA_C);
+ zval *op1, *op2;
+ zend_bool result;
SAVE_OPLINE();
- if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
- ZEND_VM_TAIL_CALL(zend_yield_in_closed_generator_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- /* Destroy the previously yielded value */
- zval_ptr_dtor(&generator->value);
-
- /* Destroy the previously yielded key */
- zval_ptr_dtor(&generator->key);
-
- /* Set the new yielded value */
- if (IS_TMP_VAR != IS_UNUSED) {
- zend_free_op free_op1;
-
- if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
- /* Constants and temporary variables aren't yieldable by reference,
- * but we still allow them with a notice. */
- if (IS_TMP_VAR & (IS_CONST|IS_TMP_VAR)) {
- zval *value;
-
- zend_error(E_NOTICE, "Only variable references should be yielded by reference");
-
- value = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- ZVAL_COPY_VALUE(&generator->value, value);
- if (IS_TMP_VAR == IS_CONST) {
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->value))) {
- Z_ADDREF(generator->value);
- }
- }
- } else {
- zval *value_ptr = NULL;
-
- /* If a function call result is yielded and the function did
- * not return by reference we throw a notice. */
- do {
- if (IS_TMP_VAR == IS_VAR) {
- ZEND_ASSERT(value_ptr != &EG(uninitialized_zval));
- if (opline->extended_value == ZEND_RETURNS_FUNCTION
- && !Z_ISREF_P(value_ptr)) {
- zend_error(E_NOTICE, "Only variable references should be yielded by reference");
- ZVAL_COPY(&generator->value, value_ptr);
- break;
- }
- }
- if (Z_ISREF_P(value_ptr)) {
- Z_ADDREF_P(value_ptr);
- } else {
- ZVAL_MAKE_REF_EX(value_ptr, 2);
- }
- ZVAL_REF(&generator->value, Z_REF_P(value_ptr));
- } while (0);
-
- }
- } else {
- zval *value = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- /* Consts, temporary variables and references need copying */
- if (IS_TMP_VAR == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->value, value);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->value))) {
- Z_ADDREF(generator->value);
- }
- } else if (IS_TMP_VAR == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->value, value);
- } else if ((IS_TMP_VAR & (IS_VAR|IS_CV)) && Z_ISREF_P(value)) {
- ZVAL_COPY(&generator->value, Z_REFVAL_P(value));
-
- } else {
- ZVAL_COPY_VALUE(&generator->value, value);
- if (IS_TMP_VAR == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
- }
- }
- }
- } else {
- /* If no value was specified yield null */
- ZVAL_NULL(&generator->value);
- }
-
- /* Set the new yielded key */
- if (IS_VAR != IS_UNUSED) {
- zend_free_op free_op2;
- zval *key = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
-
- /* Consts, temporary variables and references need copying */
- if (IS_VAR == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_VAR == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_VAR & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
- zval_ptr_dtor_nogc(free_op2);
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_VAR == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
- }
-
- if (Z_TYPE(generator->key) == IS_LONG
- && Z_LVAL(generator->key) > generator->largest_used_integer_key
- ) {
- generator->largest_used_integer_key = Z_LVAL(generator->key);
- }
- } else {
- /* If no key was specified we use auto-increment keys */
- generator->largest_used_integer_key++;
- ZVAL_LONG(&generator->key, generator->largest_used_integer_key);
- }
-
- if (RETURN_VALUE_USED(opline)) {
- /* If the return value of yield is used set the send
- * target and initialize it to NULL */
- generator->send_target = EX_VAR(opline->result.var);
- ZVAL_NULL(generator->send_target);
- } else {
- generator->send_target = NULL;
- }
+ op1 = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_tmp(opline->op2.var EXECUTE_DATA_CC);
+ result = fast_is_identical_function(op1, op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ ZEND_VM_SMART_BRANCH(result, 1);
+}
- /* We increment to the next op, so we are at the correct position when the
- * generator is resumed. */
- ZEND_VM_INC_OPCODE();
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zval *op1, *op2;
+ zend_bool result;
- /* The GOTO VM uses a local opline variable. We need to set the opline
- * variable in execute_data so we don't resume at an old position. */
SAVE_OPLINE();
-
- ZEND_VM_RETURN();
+ op1 = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_tmp(opline->op2.var EXECUTE_DATA_CC);
+ result = fast_is_not_identical_function(op1, op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ ZEND_VM_SMART_BRANCH(result, 1);
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -19593,17 +18776,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_VERIFY_RETURN_TYPE_SPEC_TMP_UN
{
USE_OPLINE
- SAVE_OPLINE();
if (IS_TMP_VAR == IS_UNUSED) {
+ SAVE_OPLINE();
zend_verify_missing_return_type(EX(func), CACHE_ADDR(opline->op2.num));
+ HANDLE_EXCEPTION();
} else {
/* prevents "undefined variable opline" errors */
#if 0 || (IS_TMP_VAR != IS_UNUSED)
zval *retval_ref, *retval_ptr;
- zend_free_op free_op1;
zend_arg_info *ret_info = EX(func)->common.arg_info - 1;
-
- retval_ref = retval_ptr = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ retval_ref = retval_ptr = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
if (IS_TMP_VAR == IS_CONST) {
ZVAL_COPY(EX_VAR(opline->result.var), retval_ptr);
@@ -19617,32 +18799,40 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_VERIFY_RETURN_TYPE_SPEC_TMP_UN
ZVAL_DEREF(retval_ptr);
}
- if (UNEXPECTED(!ZEND_TYPE_IS_CLASS(ret_info->type)
- && ZEND_TYPE_CODE(ret_info->type) != IS_CALLABLE
- && ZEND_TYPE_CODE(ret_info->type) != IS_ITERABLE
- && !ZEND_SAME_FAKE_TYPE(ZEND_TYPE_CODE(ret_info->type), Z_TYPE_P(retval_ptr))
- && !(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)
- && retval_ref != retval_ptr)
- ) {
- /* A cast might happen - unwrap the reference if this is a by-value return */
- if (Z_REFCOUNT_P(retval_ref) == 1) {
- ZVAL_UNREF(retval_ref);
+ if (EXPECTED(ZEND_TYPE_CONTAINS_CODE(ret_info->type, Z_TYPE_P(retval_ptr)))) {
+ ZEND_VM_NEXT_OPCODE();
+ }
+
+ zend_reference *ref = NULL;
+ void *cache_slot = CACHE_ADDR(opline->op2.num);
+ if (UNEXPECTED(retval_ref != retval_ptr)) {
+ if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
+ ref = Z_REF_P(retval_ref);
} else {
- Z_DELREF_P(retval_ref);
- ZVAL_COPY(retval_ref, retval_ptr);
+ /* A cast might happen - unwrap the reference if this is a by-value return */
+ if (Z_REFCOUNT_P(retval_ref) == 1) {
+ ZVAL_UNREF(retval_ref);
+ } else {
+ Z_DELREF_P(retval_ref);
+ ZVAL_COPY(retval_ref, retval_ptr);
+ }
+ retval_ptr = retval_ref;
}
- retval_ptr = retval_ref;
}
- zend_verify_return_type(EX(func), retval_ptr, CACHE_ADDR(opline->op2.num));
+
+ SAVE_OPLINE();
+ if (UNEXPECTED(!zend_check_type_slow(ret_info->type, retval_ptr, ref, cache_slot, NULL, 1, 0))) {
+ zend_verify_return_error(EX(func), cache_slot, retval_ptr);
+ HANDLE_EXCEPTION();
+ }
+ ZEND_VM_NEXT_OPCODE();
#endif
}
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *expr_ptr, new_expr;
SAVE_OPLINE();
@@ -19656,7 +18846,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_UNU
}
} else {
- expr_ptr = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ expr_ptr = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
if (IS_TMP_VAR == IS_TMP_VAR) {
/* pass */
} else if (IS_TMP_VAR == IS_CONST) {
@@ -19681,7 +18871,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_UNU
}
if (IS_UNUSED != IS_UNUSED) {
-
zval *offset = NULL;
zend_string *str;
zend_ulong hval;
@@ -19777,8 +18966,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_UNUSED_HANDLER(
/* Set the new yielded value */
if (IS_TMP_VAR != IS_UNUSED) {
- zend_free_op free_op1;
-
if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
/* Constants and temporary variables aren't yieldable by reference,
* but we still allow them with a notice. */
@@ -19787,7 +18974,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_UNUSED_HANDLER(
zend_error(E_NOTICE, "Only variable references should be yielded by reference");
- value = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
ZVAL_COPY_VALUE(&generator->value, value);
if (IS_TMP_VAR == IS_CONST) {
if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->value))) {
@@ -19819,7 +19006,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_UNUSED_HANDLER(
}
} else {
- zval *value = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ zval *value = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
/* Consts, temporary variables and references need copying */
if (IS_TMP_VAR == IS_CONST) {
@@ -19846,26 +19033,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_UNUSED_HANDLER(
/* Set the new yielded key */
if (IS_UNUSED != IS_UNUSED) {
-
zval *key = NULL;
-
- /* Consts, temporary variables and references need copying */
- if (IS_UNUSED == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_UNUSED == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_UNUSED & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
-
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_UNUSED == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
+ if ((IS_UNUSED & (IS_CV|IS_VAR)) && UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE) {
+ key = Z_REFVAL_P(key);
}
+ ZVAL_COPY(&generator->key, key);
if (Z_TYPE(generator->key) == IS_LONG
&& Z_LVAL(generator->key) > generator->largest_used_integer_key
@@ -19901,19 +19073,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_UNUSED_HANDLER(
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GET_TYPE_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1;
zend_string *type;
SAVE_OPLINE();
- op1 = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
type = zend_zval_get_type(op1);
if (EXPECTED(type)) {
ZVAL_INTERNED_STR(EX_VAR(opline->result.var), type);
} else {
ZVAL_STRING(EX_VAR(opline->result.var), "unknown type");
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -19956,7 +19127,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_TMP_CV
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_ADD_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zend_string **rope;
zval *var;
@@ -19992,7 +19162,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_ADD_SPEC_TMP_CV_HANDLER(Z
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_END_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zend_string **rope;
zval *var, *ret;
uint32_t i;
@@ -20049,7 +19218,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_END_SPEC_TMP_CV_HANDLER(Z
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *expr_ptr, new_expr;
SAVE_OPLINE();
@@ -20063,7 +19231,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CV_
}
} else {
- expr_ptr = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ expr_ptr = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
if (IS_TMP_VAR == IS_TMP_VAR) {
/* pass */
} else if (IS_TMP_VAR == IS_CONST) {
@@ -20088,7 +19256,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_CV_
}
if (IS_CV != IS_UNUSED) {
-
zval *offset = EX_VAR(opline->op2.var);
zend_string *str;
zend_ulong hval;
@@ -20184,8 +19351,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CV_HANDLER(ZEND
/* Set the new yielded value */
if (IS_TMP_VAR != IS_UNUSED) {
- zend_free_op free_op1;
-
if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
/* Constants and temporary variables aren't yieldable by reference,
* but we still allow them with a notice. */
@@ -20194,7 +19359,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CV_HANDLER(ZEND
zend_error(E_NOTICE, "Only variable references should be yielded by reference");
- value = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
ZVAL_COPY_VALUE(&generator->value, value);
if (IS_TMP_VAR == IS_CONST) {
if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->value))) {
@@ -20226,7 +19391,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CV_HANDLER(ZEND
}
} else {
- zval *value = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ zval *value = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
/* Consts, temporary variables and references need copying */
if (IS_TMP_VAR == IS_CONST) {
@@ -20253,26 +19418,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CV_HANDLER(ZEND
/* Set the new yielded key */
if (IS_CV != IS_UNUSED) {
-
zval *key = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
-
- /* Consts, temporary variables and references need copying */
- if (IS_CV == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_CV == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_CV & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
-
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_CV == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
+ if ((IS_CV & (IS_CV|IS_VAR)) && UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE) {
+ key = Z_REFVAL_P(key);
}
+ ZVAL_COPY(&generator->key, key);
if (Z_TYPE(generator->key) == IS_LONG
&& Z_LVAL(generator->key) > generator->largest_used_integer_key
@@ -20308,10 +19458,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CV_HANDLER(ZEND
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BIND_LEXICAL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *closure, *var;
- closure = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ closure = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
if (opline->extended_value & ZEND_BIND_REF) {
/* By-ref binding */
var = _get_zval_ptr_cv_BP_VAR_W(opline->op2.var EXECUTE_DATA_CC);
@@ -20341,17 +19490,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BIND_LEXICAL_SPEC_TMP_CV_HANDL
static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_pre_inc_helper_SPEC_VAR(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *var_ptr;
- var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_ISERROR_P(var_ptr))) {
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- ZEND_VM_NEXT_OPCODE();
- }
+ var_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
SAVE_OPLINE();
if (IS_VAR == IS_CV && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_UNDEF)) {
@@ -20375,17 +19516,16 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_pre_inc_help
ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_SPEC_VAR_RETVAL_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *var_ptr;
- var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ var_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(var_ptr) == IS_LONG)) {
fast_long_increment_function(var_ptr);
@@ -20401,10 +19541,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_SPEC_VAR_R
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_SPEC_VAR_RETVAL_USED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *var_ptr;
- var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ var_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(var_ptr) == IS_LONG)) {
fast_long_increment_function(var_ptr);
@@ -20420,17 +19559,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_SPEC_VAR_R
static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_pre_dec_helper_SPEC_VAR(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *var_ptr;
- var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_ISERROR_P(var_ptr))) {
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- ZEND_VM_NEXT_OPCODE();
- }
+ var_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
SAVE_OPLINE();
if (IS_VAR == IS_CV && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_UNDEF)) {
@@ -20455,17 +19586,16 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_pre_dec_help
ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_DEC_SPEC_VAR_RETVAL_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *var_ptr;
- var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ var_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(var_ptr) == IS_LONG)) {
fast_long_decrement_function(var_ptr);
@@ -20481,10 +19611,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_DEC_SPEC_VAR_R
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_DEC_SPEC_VAR_RETVAL_USED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *var_ptr;
- var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ var_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(var_ptr) == IS_LONG)) {
fast_long_decrement_function(var_ptr);
@@ -20500,15 +19629,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_DEC_SPEC_VAR_R
static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_post_inc_helper_SPEC_VAR(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *var_ptr;
- var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_ISERROR_P(var_ptr))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- }
+ var_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
SAVE_OPLINE();
if (IS_VAR == IS_CV && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_UNDEF)) {
@@ -20531,17 +19654,16 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_post_inc_hel
increment_function(var_ptr);
} while (0);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *var_ptr;
- var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ var_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(var_ptr) == IS_LONG)) {
ZVAL_LONG(EX_VAR(opline->result.var), Z_LVAL_P(var_ptr));
@@ -20555,15 +19677,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_SPEC_VAR_
static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_post_dec_helper_SPEC_VAR(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *var_ptr;
- var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_ISERROR_P(var_ptr))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- }
+ var_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
SAVE_OPLINE();
if (IS_VAR == IS_CV && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_UNDEF)) {
@@ -20586,17 +19702,16 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_post_dec_hel
decrement_function(var_ptr);
} while (0);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_DEC_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *var_ptr;
- var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ var_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(var_ptr) == IS_LONG)) {
ZVAL_LONG(EX_VAR(opline->result.var), Z_LVAL_P(var_ptr));
@@ -20612,9 +19727,8 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_SPEC_VAR_HA
USE_OPLINE
zval *retval_ptr;
zval *return_value;
- zend_free_op free_op1;
- retval_ptr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ retval_ptr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
return_value = EX(return_value);
if (IS_VAR == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(retval_ptr) == IS_UNDEF)) {
SAVE_OPLINE();
@@ -20624,9 +19738,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_SPEC_VAR_HA
}
} else if (!return_value) {
if (IS_VAR & (IS_VAR|IS_TMP_VAR)) {
- if (Z_REFCOUNTED_P(free_op1) && !Z_DELREF_P(free_op1)) {
+ if (Z_REFCOUNTED_P(retval_ptr) && !Z_DELREF_P(retval_ptr)) {
SAVE_OPLINE();
- rc_dtor_func(Z_COUNTED_P(free_op1));
+ rc_dtor_func(Z_COUNTED_P(retval_ptr));
}
}
} else {
@@ -20684,7 +19798,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER
{
USE_OPLINE
zval *retval_ptr;
- zend_free_op free_op1;
SAVE_OPLINE();
@@ -20694,9 +19807,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER
/* Not supposed to happen, but we'll allow it */
zend_error(E_NOTICE, "Only variable references should be returned by reference");
- retval_ptr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ retval_ptr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (!EX(return_value)) {
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
} else {
if (IS_VAR == IS_VAR && UNEXPECTED(Z_ISREF_P(retval_ptr))) {
ZVAL_COPY_VALUE(EX(return_value), retval_ptr);
@@ -20711,7 +19824,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER
break;
}
- retval_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ retval_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_VAR) {
ZEND_ASSERT(retval_ptr != &EG(uninitialized_zval));
@@ -20720,7 +19833,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER
if (EX(return_value)) {
ZVAL_NEW_REF(EX(return_value), retval_ptr);
} else {
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
}
break;
}
@@ -20735,7 +19848,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER
ZVAL_REF(EX(return_value), Z_REF_P(retval_ptr));
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
} while (0);
ZEND_VM_TAIL_CALL(zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
@@ -20745,12 +19858,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GENERATOR_RETURN_SPEC_VAR_HAND
{
USE_OPLINE
zval *retval;
- zend_free_op free_op1;
zend_generator *generator = zend_get_running_generator(EXECUTE_DATA_C);
SAVE_OPLINE();
- retval = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ retval = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
/* Copy return value into generator->retval */
if ((IS_VAR & (IS_CONST|IS_TMP_VAR))) {
@@ -20785,53 +19897,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GENERATOR_RETURN_SPEC_VAR_HAND
ZEND_VM_RETURN();
}
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_THROW_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
- zval *value;
- zend_free_op free_op1;
-
- SAVE_OPLINE();
- value = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- do {
- if (IS_VAR == IS_CONST || UNEXPECTED(Z_TYPE_P(value) != IS_OBJECT)) {
- if ((IS_VAR & (IS_VAR|IS_CV)) && Z_ISREF_P(value)) {
- value = Z_REFVAL_P(value);
- if (EXPECTED(Z_TYPE_P(value) == IS_OBJECT)) {
- break;
- }
- }
- if (IS_VAR == IS_CV && UNEXPECTED(Z_TYPE_P(value) == IS_UNDEF)) {
- ZVAL_UNDEFINED_OP1();
- if (UNEXPECTED(EG(exception) != NULL)) {
- HANDLE_EXCEPTION();
- }
- }
- zend_throw_error(NULL, "Can only throw objects");
- zval_ptr_dtor_nogc(free_op1);
- HANDLE_EXCEPTION();
- }
- } while (0);
-
- zend_exception_save();
- if (IS_VAR != IS_TMP_VAR) {
- Z_TRY_ADDREF_P(value);
- }
-
- zend_throw_exception_object(value);
- zend_exception_restore();
- zval_ptr_dtor_nogc(free_op1);
- HANDLE_EXCEPTION();
-}
-
static zend_always_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_SPEC_VAR_INLINE_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
zval *varptr, *arg;
- zend_free_op free_op1;
- varptr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ varptr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(varptr) == IS_UNDEF)) {
SAVE_OPLINE();
ZVAL_UNDEFINED_OP1();
@@ -20871,10 +19942,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_SPEC_VAR_HANDLER(ZEND
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_NO_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *varptr, *arg;
- varptr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ varptr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
ZVAL_COPY_VALUE(arg, varptr);
@@ -20891,7 +19961,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_NO_REF_SPEC_VAR_HANDL
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_NO_REF_EX_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *varptr, *arg;
uint32_t arg_num = opline->op2.num;
@@ -20900,7 +19969,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_NO_REF_EX_SPEC_VAR_HA
ZEND_VM_TAIL_CALL(ZEND_SEND_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- varptr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ varptr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
ZVAL_COPY_VALUE(arg, varptr);
@@ -20913,7 +19982,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_NO_REF_EX_SPEC_VAR_HA
ZEND_VM_TAIL_CALL(ZEND_SEND_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- varptr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ varptr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
ZVAL_COPY_VALUE(arg, varptr);
@@ -20932,7 +20001,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_NO_REF_EX_SPEC_VAR_HA
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_NO_REF_EX_SPEC_VAR_QUICK_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *varptr, *arg;
uint32_t arg_num = opline->op2.num;
@@ -20941,7 +20009,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_NO_REF_EX
ZEND_VM_TAIL_CALL(ZEND_SEND_VAR_SPEC_VAR_INLINE_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- varptr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ varptr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
ZVAL_COPY_VALUE(arg, varptr);
@@ -20954,7 +20022,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_NO_REF_EX
ZEND_VM_TAIL_CALL(ZEND_SEND_VAR_SPEC_VAR_INLINE_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- varptr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ varptr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
ZVAL_COPY_VALUE(arg, varptr);
@@ -20973,19 +20041,12 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_NO_REF_EX
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *varptr, *arg;
SAVE_OPLINE();
- varptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ varptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_ISERROR_P(varptr))) {
- ZVAL_NEW_EMPTY_REF(arg);
- ZVAL_NULL(Z_REFVAL_P(arg));
- ZEND_VM_NEXT_OPCODE();
- }
-
if (Z_ISREF_P(varptr)) {
Z_ADDREF_P(varptr);
} else {
@@ -20993,7 +20054,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_REF_SPEC_VAR_HANDLER(ZEND
}
ZVAL_REF(arg, Z_REF_P(varptr));
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE();
}
@@ -21001,7 +20062,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_EX_SPEC_VAR_HANDLER(Z
{
USE_OPLINE
zval *varptr, *arg;
- zend_free_op free_op1;
uint32_t arg_num = opline->op2.num;
if (EXPECTED(0)) {
@@ -21013,7 +20073,7 @@ send_var_by_ref:
ZEND_VM_TAIL_CALL(ZEND_SEND_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- varptr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ varptr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(varptr) == IS_UNDEF)) {
SAVE_OPLINE();
ZVAL_UNDEFINED_OP1();
@@ -21049,7 +20109,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_EX_SPEC_V
{
USE_OPLINE
zval *varptr, *arg;
- zend_free_op free_op1;
uint32_t arg_num = opline->op2.num;
if (EXPECTED(1)) {
@@ -21061,7 +20120,7 @@ send_var_by_ref:
ZEND_VM_TAIL_CALL(ZEND_SEND_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- varptr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ varptr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(varptr) == IS_UNDEF)) {
SAVE_OPLINE();
ZVAL_UNDEFINED_OP1();
@@ -21097,13 +20156,12 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_FUNC_ARG_SPEC
{
USE_OPLINE
zval *varptr, *arg;
- zend_free_op free_op1;
if (UNEXPECTED(ZEND_CALL_INFO(EX(call)) & ZEND_CALL_SEND_ARG_BY_REF)) {
ZEND_VM_TAIL_CALL(ZEND_SEND_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- varptr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ varptr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
if (UNEXPECTED(Z_ISREF_P(varptr))) {
@@ -21127,7 +20185,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_USER_SPEC_VAR_HANDLER(ZEN
{
USE_OPLINE
zval *arg, *param;
- zend_free_op free_op1;
SAVE_OPLINE();
@@ -21135,31 +20192,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_USER_SPEC_VAR_HANDLER(ZEN
zend_param_must_be_ref(EX(call)->func, opline->op2.num);
}
- arg = _get_zval_ptr_var_deref(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ arg = _get_zval_ptr_var_deref(opline->op1.var EXECUTE_DATA_CC);
param = ZEND_CALL_VAR(EX(call), opline->result.var);
ZVAL_COPY(param, arg);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CAST_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *expr;
zval *result = EX_VAR(opline->result.var);
HashTable *ht;
SAVE_OPLINE();
- expr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ expr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
switch (opline->extended_value) {
- case IS_NULL:
- ZVAL_NULL(result);
- break;
- case _IS_BOOL:
- ZVAL_BOOL(result, zend_is_true(expr));
- break;
case IS_LONG:
ZVAL_LONG(result, zval_get_long(expr));
break;
@@ -21170,6 +20220,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CAST_SPEC_VAR_HANDLER(ZEND_OPC
ZVAL_STR(result, zval_get_string(expr));
break;
default:
+ ZEND_ASSERT(opline->extended_value != _IS_BOOL && "Must use ZEND_BOOL instead");
if (IS_VAR & (IS_VAR|IS_CV)) {
ZVAL_DEREF(expr);
}
@@ -21182,7 +20233,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CAST_SPEC_VAR_HANDLER(ZEND_OPC
if (Z_OPT_REFCOUNTED_P(result)) Z_ADDREF_P(result);
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -21213,6 +20264,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CAST_SPEC_VAR_HANDLER(ZEND_OPC
}
}
} else {
+ ZEND_ASSERT(opline->extended_value == IS_OBJECT);
ZVAL_OBJ(result, zend_objects_new(zend_standard_class_def));
if (Z_TYPE_P(expr) == IS_ARRAY) {
ht = zend_symtable_to_proptable(Z_ARR_P(expr));
@@ -21233,19 +20285,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CAST_SPEC_VAR_HANDLER(ZEND_OPC
}
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *array_ptr, *result;
SAVE_OPLINE();
- array_ptr = _get_zval_ptr_var_deref(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ array_ptr = _get_zval_ptr_var_deref(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(array_ptr) == IS_ARRAY)) {
result = EX_VAR(opline->result.var);
ZVAL_COPY_VALUE(result, array_ptr);
@@ -21254,30 +20305,37 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_VAR_HANDLER(ZE
}
Z_FE_POS_P(result) = 0;
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE();
} else if (IS_VAR != IS_CONST && EXPECTED(Z_TYPE_P(array_ptr) == IS_OBJECT)) {
- if (!Z_OBJCE_P(array_ptr)->get_iterator) {
+ zend_object *zobj = Z_OBJ_P(array_ptr);
+ if (!zobj->ce->get_iterator) {
+ HashTable *properties;
+
result = EX_VAR(opline->result.var);
- ZVAL_COPY_VALUE(result, array_ptr);
+ ZVAL_OBJ(result, zobj);
if (IS_VAR != IS_TMP_VAR) {
- Z_ADDREF_P(array_ptr);
+ GC_ADDREF(zobj);
}
- if (Z_OBJ_P(array_ptr)->properties
- && UNEXPECTED(GC_REFCOUNT(Z_OBJ_P(array_ptr)->properties) > 1)) {
- if (EXPECTED(!(GC_FLAGS(Z_OBJ_P(array_ptr)->properties) & IS_ARRAY_IMMUTABLE))) {
- GC_DELREF(Z_OBJ_P(array_ptr)->properties);
+ properties = zobj->properties;
+ if (properties) {
+ if (UNEXPECTED(GC_REFCOUNT(properties) > 1)) {
+ if (EXPECTED(!(GC_FLAGS(properties) & IS_ARRAY_IMMUTABLE))) {
+ GC_DELREF(properties);
+ }
+ properties = zobj->properties = zend_array_dup(properties);
}
- Z_OBJ_P(array_ptr)->properties = zend_array_dup(Z_OBJ_P(array_ptr)->properties);
+ } else {
+ properties = zobj->handlers->get_properties(zobj);
}
- Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_OBJPROP_P(array_ptr), 0);
+ Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(properties, 0);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
zend_bool is_empty = zend_fe_reset_iterator(array_ptr, 0 OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
if (UNEXPECTED(EG(exception))) {
HANDLE_EXCEPTION();
} else if (is_empty) {
@@ -21290,7 +20348,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_VAR_HANDLER(ZE
zend_error(E_WARNING, "Invalid argument supplied for foreach()");
ZVAL_UNDEF(EX_VAR(opline->result.var));
Z_FE_ITER_P(EX_VAR(opline->result.var)) = (uint32_t)-1;
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_JMP(OP_JMP_ADDR(opline, opline->op2));
}
}
@@ -21298,18 +20356,17 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_VAR_HANDLER(ZE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *array_ptr, *array_ref;
SAVE_OPLINE();
if (IS_VAR == IS_VAR || IS_VAR == IS_CV) {
- array_ref = array_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ array_ref = array_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (Z_ISREF_P(array_ref)) {
array_ptr = Z_REFVAL_P(array_ref);
}
} else {
- array_ref = array_ptr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ array_ref = array_ptr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
}
if (EXPECTED(Z_TYPE_P(array_ptr) == IS_ARRAY)) {
@@ -21333,7 +20390,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_VAR_HANDLER(Z
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_ARRVAL_P(array_ptr), 0);
if (IS_VAR == IS_VAR) {
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
}
ZEND_VM_NEXT_OPCODE();
} else if (IS_VAR != IS_CONST && EXPECTED(Z_TYPE_P(array_ptr) == IS_OBJECT)) {
@@ -21358,15 +20415,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_VAR_HANDLER(Z
}
Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_OBJPROP_P(array_ptr), 0);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
zend_bool is_empty = zend_fe_reset_iterator(array_ptr, 1 OPLINE_CC EXECUTE_DATA_CC);
if (IS_VAR == IS_VAR) {
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
} else {
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
}
if (UNEXPECTED(EG(exception))) {
HANDLE_EXCEPTION();
@@ -21381,9 +20438,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_VAR_HANDLER(Z
ZVAL_UNDEF(EX_VAR(opline->result.var));
Z_FE_ITER_P(EX_VAR(opline->result.var)) = (uint32_t)-1;
if (IS_VAR == IS_VAR) {
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
} else {
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
}
ZEND_VM_JMP(OP_JMP_ADDR(opline, opline->op2));
}
@@ -21724,13 +20781,12 @@ fe_fetch_w_exit:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMP_SET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *value;
zval *ref = NULL;
int ret;
SAVE_OPLINE();
- value = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) && Z_ISREF_P(value)) {
if (IS_VAR == IS_VAR) {
@@ -21742,7 +20798,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMP_SET_SPEC_VAR_HANDLER(ZEND_
ret = i_zend_is_true(value);
if (UNEXPECTED(EG(exception))) {
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZVAL_UNDEF(EX_VAR(opline->result.var));
HANDLE_EXCEPTION();
}
@@ -21767,19 +20823,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMP_SET_SPEC_VAR_HANDLER(ZEND_
ZEND_VM_JMP_EX(OP_JMP_ADDR(opline, opline->op2), 0);
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COALESCE_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *value;
zval *ref = NULL;
SAVE_OPLINE();
- value = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if ((IS_VAR & (IS_VAR|IS_CV)) && Z_ISREF_P(value)) {
if (IS_VAR & IS_VAR) {
@@ -21807,18 +20862,17 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COALESCE_SPEC_VAR_HANDLER(ZEND
ZEND_VM_JMP_EX(OP_JMP_ADDR(opline, opline->op2), 0);
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE();
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_QM_ASSIGN_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *value;
zval *result = EX_VAR(opline->result.var);
- value = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_CV && UNEXPECTED(Z_TYPE_P(value) == IS_UNDEF)) {
SAVE_OPLINE();
ZVAL_UNDEFINED_OP1();
@@ -21850,120 +20904,12 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_QM_ASSIGN_SPEC_VAR
ZEND_VM_NEXT_OPCODE();
}
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
-
- zend_generator *generator = zend_get_running_generator(EXECUTE_DATA_C);
-
- zval *val;
- zend_free_op free_op1;
-
- SAVE_OPLINE();
- val = _get_zval_ptr_var_deref(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
- zend_throw_error(NULL, "Cannot use \"yield from\" in a force-closed generator");
- zval_ptr_dtor_nogc(free_op1);
- UNDEF_RESULT();
- HANDLE_EXCEPTION();
- }
-
- if (Z_TYPE_P(val) == IS_ARRAY) {
- ZVAL_COPY_VALUE(&generator->values, val);
- if (IS_VAR != IS_TMP_VAR && Z_OPT_REFCOUNTED_P(val)) {
- Z_ADDREF_P(val);
- }
- Z_FE_POS(generator->values) = 0;
-
- zval_ptr_dtor_nogc(free_op1);
- } else if (IS_VAR != IS_CONST && Z_TYPE_P(val) == IS_OBJECT && Z_OBJCE_P(val)->get_iterator) {
- zend_class_entry *ce = Z_OBJCE_P(val);
- if (ce == zend_ce_generator) {
- zend_generator *new_gen = (zend_generator *) Z_OBJ_P(val);
-
- if (IS_VAR != IS_TMP_VAR) {
- Z_ADDREF_P(val);
- }
- zval_ptr_dtor_nogc(free_op1);
-
- if (Z_ISUNDEF(new_gen->retval)) {
- if (UNEXPECTED(zend_generator_get_current(new_gen) == generator)) {
- zend_throw_error(NULL, "Impossible to yield from the Generator being currently run");
- zval_ptr_dtor(val);
- UNDEF_RESULT();
- HANDLE_EXCEPTION();
- } else {
- zend_generator_yield_from(generator, new_gen);
- }
- } else if (UNEXPECTED(new_gen->execute_data == NULL)) {
- zend_throw_error(NULL, "Generator passed to yield from was aborted without proper return and is unable to continue");
- zval_ptr_dtor(val);
- UNDEF_RESULT();
- HANDLE_EXCEPTION();
- } else {
- if (RETURN_VALUE_USED(opline)) {
- ZVAL_COPY(EX_VAR(opline->result.var), &new_gen->retval);
- }
- ZEND_VM_NEXT_OPCODE();
- }
- } else {
- zend_object_iterator *iter = ce->get_iterator(ce, val, 0);
- zval_ptr_dtor_nogc(free_op1);
-
- if (UNEXPECTED(!iter) || UNEXPECTED(EG(exception))) {
- if (!EG(exception)) {
- zend_throw_error(NULL, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name));
- }
- UNDEF_RESULT();
- HANDLE_EXCEPTION();
- }
-
- iter->index = 0;
- if (iter->funcs->rewind) {
- iter->funcs->rewind(iter);
- if (UNEXPECTED(EG(exception) != NULL)) {
- OBJ_RELEASE(&iter->std);
- UNDEF_RESULT();
- HANDLE_EXCEPTION();
- }
- }
-
- ZVAL_OBJ(&generator->values, &iter->std);
- }
- } else {
- zend_throw_error(NULL, "Can use \"yield from\" only with arrays and Traversables");
- UNDEF_RESULT();
- HANDLE_EXCEPTION();
- }
-
- /* This is the default return value
- * when the expression is a Generator, it will be overwritten in zend_generator_resume() */
- if (RETURN_VALUE_USED(opline)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
-
- /* This generator has no send target (though the generator we delegate to might have one) */
- generator->send_target = NULL;
-
- /* We increment to the next op, so we are at the correct position when the
- * generator is resumed. */
- ZEND_VM_INC_OPCODE();
-
- /* The GOTO VM uses a local opline variable. We need to set the opline
- * variable in execute_data so we don't resume at an old position. */
- SAVE_OPLINE();
-
- ZEND_VM_RETURN();
-}
-
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_SIMPLE_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
zval *varptr, *arg;
- zend_free_op free_op1;
- varptr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ varptr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
if (IS_VAR == IS_CV) {
@@ -21979,14 +20925,13 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_EX_SIMPLE
{
USE_OPLINE
zval *varptr, *arg;
- zend_free_op free_op1;
uint32_t arg_num = opline->op2.num;
if (QUICK_ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
ZEND_VM_TAIL_CALL(ZEND_SEND_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
}
- varptr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ varptr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
if (IS_VAR == IS_CV) {
@@ -22001,61 +20946,51 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_EX_SIMPLE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
zend_bool result;
SAVE_OPLINE();
- op1 = _get_zval_ptr_var_deref(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var_deref(opline->op1.var EXECUTE_DATA_CC);
op2 = RT_CONSTANT(opline, opline->op2);
result = fast_is_identical_function(op1, op2);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1, *op2;
zend_bool result;
SAVE_OPLINE();
- op1 = _get_zval_ptr_var_deref(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var_deref(opline->op1.var EXECUTE_DATA_CC);
op2 = RT_CONSTANT(opline, opline->op2);
result = fast_is_not_identical_function(op1, op2);
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op_data;
zval *object;
zval *property;
zval *value;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- object = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
+ object = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
property = RT_CONSTANT(opline, opline->op2);
do {
- value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data);
+ value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1);
if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
@@ -22066,16 +21001,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_VAR_CONST_H
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
assign_op_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ UNDEF_RESULT();
+ break;
+ }
+ }
cache_slot = (IS_CONST == IS_CONST) ? CACHE_ADDR((opline+1)->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -22112,13 +21055,16 @@ assign_op_object:
}
}
} else {
- zend_assign_op_overloaded_property(object, property, cache_slot, value OPLINE_CC EXECUTE_DATA_CC);
+ zend_assign_op_overloaded_property(zobj, name, cache_slot, value OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
- FREE_OP(free_op_data);
+ FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -22127,12 +21073,11 @@ assign_op_object:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op_data1;
zval *var_ptr;
zval *value, *container, *dim;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
assign_dim_op_array:
@@ -22156,7 +21101,7 @@ assign_dim_op_new_array:
}
}
- value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data1);
+ value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1);
do {
if (IS_CONST != IS_UNUSED && UNEXPECTED(Z_ISREF_P(var_ptr))) {
@@ -22173,7 +21118,7 @@ assign_dim_op_new_array:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
- FREE_OP(free_op_data1);
+ FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
} else {
if (EXPECTED(Z_ISREF_P(container))) {
container = Z_REFVAL_P(container);
@@ -22204,64 +21149,53 @@ assign_dim_op_ret_null:
}
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OP_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *var_ptr;
zval *value;
SAVE_OPLINE();
value = RT_CONSTANT(opline, opline->op2);
- var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ var_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_ISERROR_P(var_ptr))) {
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- do {
- if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_REFERENCE)) {
- zend_reference *ref = Z_REF_P(var_ptr);
- var_ptr = Z_REFVAL_P(var_ptr);
- if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
- zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
- break;
- }
+ do {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_REFERENCE)) {
+ zend_reference *ref = Z_REF_P(var_ptr);
+ var_ptr = Z_REFVAL_P(var_ptr);
+ if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
+ zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
- zend_binary_op(var_ptr, var_ptr, value OPLINE_CC);
- } while (0);
-
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
+ zend_binary_op(var_ptr, var_ptr, value OPLINE_CC);
+ } while (0);
+
+ if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
+ ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object;
zval *property;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- object = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
+ object = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
property = RT_CONSTANT(opline, opline->op2);
do {
@@ -22274,16 +21208,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_VAR_CONST_HAN
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
pre_incdec_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ UNDEF_RESULT();
+ break;
+ }
+ }
cache_slot = (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -22297,31 +21239,30 @@ pre_incdec_object:
zend_pre_incdec_property_zval(zptr, prop_info OPLINE_CC EXECUTE_DATA_CC);
}
} else {
- zend_pre_incdec_overloaded_property(object, property, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ zend_pre_incdec_overloaded_property(zobj, name, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object;
zval *property;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- object = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
+ object = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
property = RT_CONSTANT(opline, opline->op2);
do {
@@ -22334,16 +21275,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_VAR_CONST_HA
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
post_incdec_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
+ }
cache_slot = (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
ZVAL_NULL(EX_VAR(opline->result.var));
} else {
@@ -22356,27 +21305,28 @@ post_incdec_object:
zend_post_incdec_property_zval(zptr, prop_info OPLINE_CC EXECUTE_DATA_CC);
}
} else {
- zend_post_incdec_overloaded_property(object, property, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ zend_post_incdec_overloaded_property(zobj, name, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
zend_fetch_dimension_address_W(container, RT_CONSTANT(opline, opline->op2), IS_CONST OPLINE_CC EXECUTE_DATA_CC);
if (IS_VAR == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -22384,16 +21334,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_CONST_HAN
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
zend_fetch_dimension_address_RW(container, RT_CONSTANT(opline, opline->op2), IS_CONST OPLINE_CC EXECUTE_DATA_CC);
if (IS_VAR == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -22420,16 +21368,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_CO
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
zend_fetch_dimension_address_UNSET(container, RT_CONSTANT(opline, opline->op2), IS_CONST OPLINE_CC EXECUTE_DATA_CC);
if (IS_VAR == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -22437,16 +21383,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_VAR_CONST
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *property, *container, *result;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
property = RT_CONSTANT(opline, opline->op2);
result = EX_VAR(opline->result.var);
zend_fetch_property_address(
@@ -22455,7 +21396,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_CONST_HAN
BP_VAR_W, opline->extended_value & ZEND_FETCH_OBJ_FLAGS, 1 OPLINE_CC EXECUTE_DATA_CC);
if (IS_VAR == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -22463,21 +21404,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_CONST_HAN
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *property, *container, *result;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
property = RT_CONSTANT(opline, opline->op2);
result = EX_VAR(opline->result.var);
zend_fetch_property_address(result, container, IS_VAR, property, IS_CONST, ((IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL), BP_VAR_RW, 0, 1 OPLINE_CC EXECUTE_DATA_CC);
if (IS_VAR == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -22502,22 +21438,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_CO
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container, *property, *result;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
property = RT_CONSTANT(opline, opline->op2);
result = EX_VAR(opline->result.var);
zend_fetch_property_address(result, container, IS_VAR, property, IS_CONST, ((IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL), BP_VAR_UNSET, 0, 1 OPLINE_CC EXECUTE_DATA_CC);
if (IS_VAR == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -22525,11 +21455,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_CONST
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_LIST_W_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container, *dim;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
dim = RT_CONSTANT(opline, opline->op2);
if (IS_VAR == IS_VAR
@@ -22548,16 +21477,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_LIST_W_SPEC_VAR_CONST_HA
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CONST_OP_DATA_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- object = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
+ object = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
property = RT_CONSTANT(opline, opline->op2);
value = RT_CONSTANT((opline+1), (opline+1)->op1);
@@ -22566,16 +21491,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CONST_OP_D
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CONST == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -22665,16 +21589,31 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ ZVAL_COPY_DEREF(EX_VAR(opline->result.var), value);
}
exit_assign_obj:
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -22683,34 +21622,29 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CONST_OP_DATA_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op_data;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- object = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
+ object = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
property = RT_CONSTANT(opline, opline->op2);
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CONST == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -22800,16 +21734,31 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ ZVAL_COPY_DEREF(EX_VAR(opline->result.var), value);
}
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
exit_assign_obj:
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -22818,34 +21767,29 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CONST_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op_data;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- object = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
+ object = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
property = RT_CONSTANT(opline, opline->op2);
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CONST == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -22935,16 +21879,31 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ ZVAL_COPY_DEREF(EX_VAR(opline->result.var), value);
}
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
exit_assign_obj:
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -22953,16 +21912,12 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CONST_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- object = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
+ object = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
property = RT_CONSTANT(opline, opline->op2);
value = _get_zval_ptr_cv_BP_VAR_R((opline+1)->op1.var EXECUTE_DATA_CC);
@@ -22971,16 +21926,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CONST_OP_D
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CONST == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -23070,16 +22024,31 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ ZVAL_COPY_DEREF(EX_VAR(opline->result.var), value);
}
exit_assign_obj:
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -23088,15 +22057,13 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CONST_OP_DATA_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
SAVE_OPLINE();
- orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_ARRAY)) {
try_assign_dim_array:
@@ -23116,11 +22083,12 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_CONST == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
}
-
+ zval_ptr_dtor_nogc(free_op_data);
}
} else if (IS_CONST == IS_CONST) {
if (UNEXPECTED(Z_REFCOUNTED_P(value))) {
@@ -23182,9 +22150,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = RT_CONSTANT(opline, opline->op2);
assign_dim_error:
@@ -23196,7 +22162,7 @@ assign_dim_error:
if (IS_CONST != IS_UNUSED) {
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_dim has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -23204,27 +22170,25 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CONST_OP_DATA_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
SAVE_OPLINE();
- orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_ARRAY)) {
try_assign_dim_array:
SEPARATE_ARRAY(object_ptr);
if (IS_CONST == IS_UNUSED) {
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) {
ZVAL_DEREF(value);
}
variable_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(object_ptr), value);
if (UNEXPECTED(variable_ptr == NULL)) {
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
zend_cannot_add_element();
goto assign_dim_error;
} else if (IS_TMP_VAR == IS_CV) {
@@ -23232,6 +22196,7 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_TMP_VAR == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
@@ -23253,7 +22218,7 @@ try_assign_dim_array:
if (UNEXPECTED(variable_ptr == NULL)) {
goto assign_dim_error;
}
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
value = zend_assign_to_variable(variable_ptr, value, IS_TMP_VAR, EX_USES_STRICT_TYPES());
}
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -23268,14 +22233,14 @@ try_assign_dim_array:
}
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) {
dim = RT_CONSTANT(opline, opline->op2);
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_CONST == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
dim++;
}
zend_assign_to_object_dim(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
} else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
if (IS_CONST == IS_UNUSED) {
zend_use_new_element_for_string();
@@ -23283,9 +22248,9 @@ try_assign_dim_array:
UNDEF_RESULT();
} else {
dim = RT_CONSTANT(opline, opline->op2);
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
zend_assign_to_string_offset(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
}
} else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) {
if (Z_ISREF_P(orig_object_ptr)
@@ -23299,9 +22264,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = RT_CONSTANT(opline, opline->op2);
assign_dim_error:
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
@@ -23313,7 +22276,7 @@ assign_dim_error:
if (IS_CONST != IS_UNUSED) {
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_dim has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -23321,27 +22284,25 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CONST_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
SAVE_OPLINE();
- orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_ARRAY)) {
try_assign_dim_array:
SEPARATE_ARRAY(object_ptr);
if (IS_CONST == IS_UNUSED) {
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_CV || IS_VAR == IS_VAR) {
ZVAL_DEREF(value);
}
variable_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(object_ptr), value);
if (UNEXPECTED(variable_ptr == NULL)) {
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
zend_cannot_add_element();
goto assign_dim_error;
} else if (IS_VAR == IS_CV) {
@@ -23349,6 +22310,7 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_VAR == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
@@ -23370,7 +22332,7 @@ try_assign_dim_array:
if (UNEXPECTED(variable_ptr == NULL)) {
goto assign_dim_error;
}
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
value = zend_assign_to_variable(variable_ptr, value, IS_VAR, EX_USES_STRICT_TYPES());
}
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -23385,14 +22347,14 @@ try_assign_dim_array:
}
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) {
dim = RT_CONSTANT(opline, opline->op2);
- value = _get_zval_ptr_var_deref((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var_deref((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_CONST == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
dim++;
}
zend_assign_to_object_dim(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
} else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
if (IS_CONST == IS_UNUSED) {
zend_use_new_element_for_string();
@@ -23400,9 +22362,9 @@ try_assign_dim_array:
UNDEF_RESULT();
} else {
dim = RT_CONSTANT(opline, opline->op2);
- value = _get_zval_ptr_var_deref((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var_deref((opline+1)->op1.var EXECUTE_DATA_CC);
zend_assign_to_string_offset(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
}
} else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) {
if (Z_ISREF_P(orig_object_ptr)
@@ -23416,9 +22378,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = RT_CONSTANT(opline, opline->op2);
assign_dim_error:
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
@@ -23430,7 +22390,7 @@ assign_dim_error:
if (IS_CONST != IS_UNUSED) {
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_dim has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -23438,15 +22398,13 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CONST_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
SAVE_OPLINE();
- orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_ARRAY)) {
try_assign_dim_array:
@@ -23466,11 +22424,12 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_CV == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
}
-
+ zval_ptr_dtor_nogc(free_op_data);
}
} else if (IS_CV == IS_CONST) {
if (UNEXPECTED(Z_REFCOUNTED_P(value))) {
@@ -23532,9 +22491,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = RT_CONSTANT(opline, opline->op2);
assign_dim_error:
@@ -23546,7 +22503,7 @@ assign_dim_error:
if (IS_CONST != IS_UNUSED) {
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_dim has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -23554,27 +22511,19 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_CONST_RETVAL_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *value;
zval *variable_ptr;
SAVE_OPLINE();
value = RT_CONSTANT(opline, opline->op2);
- variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
+ variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
- if (UNEXPECTED(0)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- value = zend_assign_to_variable(variable_ptr, value, IS_CONST, EX_USES_STRICT_TYPES());
- if (UNEXPECTED(0)) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
- /* zend_assign_to_variable() always takes care of op2, never free it! */
+ value = zend_assign_to_variable(variable_ptr, value, IS_CONST, EX_USES_STRICT_TYPES());
+ if (UNEXPECTED(0)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ /* zend_assign_to_variable() always takes care of op2, never free it! */
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -23582,27 +22531,19 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_CONST_RETVAL_U
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_CONST_RETVAL_USED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *value;
zval *variable_ptr;
SAVE_OPLINE();
value = RT_CONSTANT(opline, opline->op2);
- variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
-
- if (UNEXPECTED(1)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- value = zend_assign_to_variable(variable_ptr, value, IS_CONST, EX_USES_STRICT_TYPES());
- if (UNEXPECTED(1)) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
- /* zend_assign_to_variable() always takes care of op2, never free it! */
+ value = zend_assign_to_variable(variable_ptr, value, IS_CONST, EX_USES_STRICT_TYPES());
+ if (UNEXPECTED(1)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ /* zend_assign_to_variable() always takes care of op2, never free it! */
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -23610,20 +22551,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_CONST_RETVAL_U
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_VAR_CONST_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op_data;
zval *property, *container, *value_ptr;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
property = RT_CONSTANT(opline, opline->op2);
- value_ptr = _get_zval_ptr_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value_ptr = _get_zval_ptr_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (1) {
if (IS_VAR == IS_UNUSED) {
@@ -23643,9 +22578,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_VAR_CONST_
zend_assign_to_property_reference(container, IS_VAR, property, IS_CONST, value_ptr OPLINE_CC EXECUTE_DATA_CC);
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
- if (UNEXPECTED(free_op_data)) {zval_ptr_dtor_nogc(free_op_data);};
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));;
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -23653,17 +22588,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_VAR_CONST_
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_VAR_CONST_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *property, *container, *value_ptr;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
property = RT_CONSTANT(opline, opline->op2);
value_ptr = _get_zval_ptr_cv_BP_VAR_W((opline+1)->op1.var EXECUTE_DATA_CC);
@@ -23686,7 +22615,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_VAR_CONST_
zend_assign_to_property_reference(container, IS_VAR, property, IS_CONST, value_ptr OPLINE_CC EXECUTE_DATA_CC);
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_EX(1, 2);
@@ -23738,8 +22667,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
EXPECTED(CACHED_PTR(opline->result.num) == ce)) {
fbc = CACHED_PTR(opline->result.num + sizeof(void*));
} else if (IS_CONST != IS_UNUSED) {
-
-
function_name = RT_CONSTANT(opline, opline->op2);
if (IS_CONST != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
@@ -23755,7 +22682,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
HANDLE_EXCEPTION();
}
}
- zend_throw_error(NULL, "Function name must be a string");
+ zend_throw_error(NULL, "Method name must be a string");
HANDLE_EXCEPTION();
} while (0);
@@ -23775,7 +22702,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
HANDLE_EXCEPTION();
}
if (IS_CONST == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE)))) {
CACHE_POLYMORPHIC_PTR(opline->result.num, ce, fbc);
}
@@ -23806,13 +22732,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS;
} else {
zend_non_static_method_call(fbc);
- if (UNEXPECTED(EG(exception) != NULL)) {
- HANDLE_EXCEPTION();
- }
- goto check_parent_and_self;
+ HANDLE_EXCEPTION();
}
} else {
-check_parent_and_self:
/* previous opcode is ZEND_FETCH_CLASS */
if (IS_VAR == IS_UNUSED
&& ((opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_PARENT ||
@@ -23894,7 +22816,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_CONSTANT_SPEC_VAR_
}
CACHE_POLYMORPHIC_PTR(opline->extended_value, ce, value);
} else {
- zend_throw_error(NULL, "Undefined class constant '%s'", Z_STRVAL_P(RT_CONSTANT(opline, opline->op2)));
+ zend_throw_error(NULL, "Undefined class constant '%s::%s'",
+ ZSTR_VAL(ce->name), Z_STRVAL_P(RT_CONSTANT(opline, opline->op2)));
ZVAL_UNDEF(EX_VAR(opline->result.var));
HANDLE_EXCEPTION();
}
@@ -23908,21 +22831,20 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_CONSTANT_SPEC_VAR_
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *expr_ptr, new_expr;
SAVE_OPLINE();
if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) &&
UNEXPECTED(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
- expr_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ expr_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (Z_ISREF_P(expr_ptr)) {
Z_ADDREF_P(expr_ptr);
} else {
ZVAL_MAKE_REF_EX(expr_ptr, 2);
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
} else {
- expr_ptr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ expr_ptr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_TMP_VAR) {
/* pass */
} else if (IS_VAR == IS_CONST) {
@@ -23947,7 +22869,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CON
}
if (IS_CONST != IS_UNUSED) {
-
zval *offset = RT_CONSTANT(opline, opline->op2);
zend_string *str;
zend_ulong hval;
@@ -24027,14 +22948,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_VAR_CONST_HAND
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
zval *offset;
zend_ulong hval;
zend_string *key;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
offset = RT_CONSTANT(opline, opline->op2);
do {
@@ -24085,7 +23005,7 @@ num_index_dim:
key = ZSTR_EMPTY_ALLOC();
goto str_index_dim;
} else {
- zend_error(E_WARNING, "Illegal offset type in unset");
+ zend_type_error("Illegal offset type in unset");
}
break;
} else if (Z_ISREF_P(container)) {
@@ -24104,28 +23024,25 @@ num_index_dim:
if (IS_CONST == IS_CONST && Z_EXTRA_P(offset) == ZEND_EXTRA_VALUE) {
offset++;
}
- Z_OBJ_HT_P(container)->unset_dimension(container, offset);
+ Z_OBJ_HT_P(container)->unset_dimension(Z_OBJ_P(container), offset);
} else if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_STRING)) {
zend_throw_error(NULL, "Cannot unset string offsets");
}
} while (0);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
offset = RT_CONSTANT(opline, opline->op2);
do {
@@ -24143,10 +23060,21 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_VAR_CONST_HANDL
break;
}
}
- Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL));
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ break;
+ }
+ }
+ Z_OBJ_HT_P(container)->unset_property(Z_OBJ_P(container), name, ((IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL));
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
} while (0);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -24169,8 +23097,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CONST_HANDLER(Z
/* Set the new yielded value */
if (IS_VAR != IS_UNUSED) {
- zend_free_op free_op1;
-
if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
/* Constants and temporary variables aren't yieldable by reference,
* but we still allow them with a notice. */
@@ -24179,7 +23105,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CONST_HANDLER(Z
zend_error(E_NOTICE, "Only variable references should be yielded by reference");
- value = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
ZVAL_COPY_VALUE(&generator->value, value);
if (IS_VAR == IS_CONST) {
if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->value))) {
@@ -24187,7 +23113,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CONST_HANDLER(Z
}
}
} else {
- zval *value_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ zval *value_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
/* If a function call result is yielded and the function did
* not return by reference we throw a notice. */
@@ -24209,10 +23135,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CONST_HANDLER(Z
ZVAL_REF(&generator->value, Z_REF_P(value_ptr));
} while (0);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
}
} else {
- zval *value = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ zval *value = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
/* Consts, temporary variables and references need copying */
if (IS_VAR == IS_CONST) {
@@ -24224,7 +23150,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CONST_HANDLER(Z
ZVAL_COPY_VALUE(&generator->value, value);
} else if ((IS_VAR & (IS_VAR|IS_CV)) && Z_ISREF_P(value)) {
ZVAL_COPY(&generator->value, Z_REFVAL_P(value));
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
} else {
ZVAL_COPY_VALUE(&generator->value, value);
if (IS_VAR == IS_CV) {
@@ -24239,26 +23165,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CONST_HANDLER(Z
/* Set the new yielded key */
if (IS_CONST != IS_UNUSED) {
-
zval *key = RT_CONSTANT(opline, opline->op2);
-
- /* Consts, temporary variables and references need copying */
- if (IS_CONST == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_CONST == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_CONST & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
-
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_CONST == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
+ if ((IS_CONST & (IS_CV|IS_VAR)) && UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE) {
+ key = Z_REFVAL_P(key);
}
+ ZVAL_COPY(&generator->key, key);
if (Z_TYPE(generator->key) == IS_LONG
&& Z_LVAL(generator->key) > generator->largest_used_integer_key
@@ -24294,13 +23205,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CONST_HANDLER(Z
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IN_ARRAY_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1;
HashTable *ht = Z_ARRVAL_P(RT_CONSTANT(opline, opline->op2));
zval *result;
SAVE_OPLINE();
- op1 = _get_zval_ptr_var_deref(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var_deref(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) {
result = zend_hash_find_ex(ht, Z_STR_P(op1), IS_VAR == IS_CONST);
} else if (opline->extended_value) {
@@ -24313,46 +23223,39 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IN_ARRAY_SPEC_VAR_CONST_HANDLE
result = zend_hash_find_ex(ht, ZSTR_EMPTY_ALLOC(), 1);
} else {
zend_string *key;
- zval key_tmp, result_tmp, *val;
+ zval key_tmp, *val;
result = NULL;
ZEND_HASH_FOREACH_STR_KEY_VAL(ht, key, val) {
ZVAL_STR(&key_tmp, key);
- compare_function(&result_tmp, op1, &key_tmp);
- if (Z_LVAL(result_tmp) == 0) {
+ if (zend_compare(op1, &key_tmp) == 0) {
result = val;
break;
}
} ZEND_HASH_FOREACH_END();
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result != NULL);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_VAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2, free_op_data;
zval *object;
zval *property;
zval *value;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- object = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ object = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
do {
- value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data);
+ value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1);
if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
@@ -24363,16 +23266,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_VAR_TMPVAR_
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
assign_op_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ UNDEF_RESULT();
+ break;
+ }
+ }
cache_slot = ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR((opline+1)->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -24409,13 +23320,16 @@ assign_op_object:
}
}
} else {
- zend_assign_op_overloaded_property(object, property, cache_slot, value OPLINE_CC EXECUTE_DATA_CC);
+ zend_assign_op_overloaded_property(zobj, name, cache_slot, value OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
- FREE_OP(free_op_data);
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -24424,18 +23338,17 @@ assign_op_object:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_VAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2, free_op_data1;
zval *var_ptr;
zval *value, *container, *dim;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
assign_dim_op_array:
SEPARATE_ARRAY(container);
assign_dim_op_new_array:
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED) {
var_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(container), &EG(uninitialized_zval));
if (UNEXPECTED(!var_ptr)) {
@@ -24453,7 +23366,7 @@ assign_dim_op_new_array:
}
}
- value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data1);
+ value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1);
do {
if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED && UNEXPECTED(Z_ISREF_P(var_ptr))) {
@@ -24470,7 +23383,7 @@ assign_dim_op_new_array:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
- FREE_OP(free_op_data1);
+ FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
} else {
if (EXPECTED(Z_ISREF_P(container))) {
container = Z_REFVAL_P(container);
@@ -24479,7 +23392,7 @@ assign_dim_op_new_array:
}
}
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
if ((IS_TMP_VAR|IS_VAR) == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
@@ -24501,67 +23414,56 @@ assign_dim_op_ret_null:
}
}
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OP_SPEC_VAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *var_ptr;
zval *value;
SAVE_OPLINE();
- value = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ var_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_ISERROR_P(var_ptr))) {
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- do {
- if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_REFERENCE)) {
- zend_reference *ref = Z_REF_P(var_ptr);
- var_ptr = Z_REFVAL_P(var_ptr);
- if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
- zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
- break;
- }
+ do {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_REFERENCE)) {
+ zend_reference *ref = Z_REF_P(var_ptr);
+ var_ptr = Z_REFVAL_P(var_ptr);
+ if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
+ zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
- zend_binary_op(var_ptr, var_ptr, value OPLINE_CC);
- } while (0);
-
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
+ zend_binary_op(var_ptr, var_ptr, value OPLINE_CC);
+ } while (0);
+
+ if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
+ ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_VAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *object;
zval *property;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- object = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ object = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
do {
if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
@@ -24573,16 +23475,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_VAR_TMPVAR_HA
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
pre_incdec_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ UNDEF_RESULT();
+ break;
+ }
+ }
cache_slot = ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -24596,33 +23506,32 @@ pre_incdec_object:
zend_pre_incdec_property_zval(zptr, prop_info OPLINE_CC EXECUTE_DATA_CC);
}
} else {
- zend_pre_incdec_overloaded_property(object, property, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ zend_pre_incdec_overloaded_property(zobj, name, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_VAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *object;
zval *property;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- object = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ object = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
do {
if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
@@ -24634,16 +23543,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_VAR_TMPVAR_H
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
post_incdec_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
+ }
cache_slot = ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
ZVAL_NULL(EX_VAR(opline->result.var));
} else {
@@ -24656,28 +23573,29 @@ post_incdec_object:
zend_post_incdec_property_zval(zptr, prop_info OPLINE_CC EXECUTE_DATA_CC);
}
} else {
- zend_post_incdec_overloaded_property(object, property, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ zend_post_incdec_overloaded_property(zobj, name, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- zend_fetch_dimension_address_W(container, _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op2);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ zend_fetch_dimension_address_W(container, _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (IS_VAR == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -24685,16 +23603,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_TMPVAR_HA
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_VAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- zend_fetch_dimension_address_RW(container, _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op2);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ zend_fetch_dimension_address_RW(container, _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (IS_VAR == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -24721,16 +23637,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_TM
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_VAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- zend_fetch_dimension_address_UNSET(container, _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op2);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ zend_fetch_dimension_address_UNSET(container, _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (IS_VAR == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -24738,25 +23652,20 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_VAR_TMPVA
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *property, *container, *result;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
result = EX_VAR(opline->result.var);
zend_fetch_property_address(
result, container, IS_VAR, property, (IS_TMP_VAR|IS_VAR),
(((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_FETCH_OBJ_FLAGS) : NULL),
BP_VAR_W, opline->extended_value & ZEND_FETCH_OBJ_FLAGS, 1 OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (IS_VAR == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -24764,21 +23673,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_TMPVAR_HA
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_VAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *property, *container, *result;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
result = EX_VAR(opline->result.var);
zend_fetch_property_address(result, container, IS_VAR, property, (IS_TMP_VAR|IS_VAR), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL), BP_VAR_RW, 0, 1 OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (IS_VAR == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -24803,22 +23707,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_TM
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container, *property, *result;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
result = EX_VAR(opline->result.var);
zend_fetch_property_address(result, container, IS_VAR, property, (IS_TMP_VAR|IS_VAR), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL), BP_VAR_UNSET, 0, 1 OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (IS_VAR == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -24826,12 +23724,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_TMPVA
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_LIST_W_SPEC_VAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container, *dim;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (IS_VAR == IS_VAR
&& Z_TYPE_P(EX_VAR(opline->op1.var)) != IS_INDIRECT
@@ -24843,24 +23740,20 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_LIST_W_SPEC_VAR_TMPVAR_H
zend_fetch_dimension_address_W(container, dim, (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_TMPVAR_OP_DATA_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- object = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ object = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
value = RT_CONSTANT((opline+1), (opline+1)->op1);
if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
@@ -24868,16 +23761,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_TMPVAR_OP_
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -24967,16 +23859,31 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ ZVAL_COPY_DEREF(EX_VAR(opline->result.var), value);
}
exit_assign_obj:
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -24985,34 +23892,29 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_TMPVAR_OP_DATA_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2, free_op_data;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- object = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ object = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -25102,16 +24004,31 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ ZVAL_COPY_DEREF(EX_VAR(opline->result.var), value);
}
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
exit_assign_obj:
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -25120,34 +24037,29 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_TMPVAR_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2, free_op_data;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- object = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ object = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -25237,16 +24149,31 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ ZVAL_COPY_DEREF(EX_VAR(opline->result.var), value);
}
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
exit_assign_obj:
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -25255,17 +24182,13 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_TMPVAR_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- object = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ object = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
value = _get_zval_ptr_cv_BP_VAR_R((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
@@ -25273,16 +24196,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_TMPVAR_OP_
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -25372,16 +24294,31 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ ZVAL_COPY_DEREF(EX_VAR(opline->result.var), value);
}
exit_assign_obj:
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -25390,15 +24327,13 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_TMPVAR_OP_DATA_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op2, free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
SAVE_OPLINE();
- orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_ARRAY)) {
try_assign_dim_array:
@@ -25418,11 +24353,12 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_CONST == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
}
-
+ zval_ptr_dtor_nogc(free_op_data);
}
} else if (IS_CONST == IS_CONST) {
if (UNEXPECTED(Z_REFCOUNTED_P(value))) {
@@ -25430,7 +24366,7 @@ try_assign_dim_array:
}
}
} else {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
variable_ptr = zend_fetch_dimension_address_inner_W_CONST(Z_ARRVAL_P(object_ptr), dim EXECUTE_DATA_CC);
} else {
@@ -25453,7 +24389,7 @@ try_assign_dim_array:
}
}
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
value = RT_CONSTANT((opline+1), (opline+1)->op1);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
@@ -25467,7 +24403,7 @@ try_assign_dim_array:
UNDEF_RESULT();
} else {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
value = RT_CONSTANT((opline+1), (opline+1)->op1);
zend_assign_to_string_offset(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
@@ -25476,7 +24412,7 @@ try_assign_dim_array:
if (Z_ISREF_P(orig_object_ptr)
&& ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(orig_object_ptr))
&& !zend_verify_ref_array_assignable(Z_REF_P(orig_object_ptr))) {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
UNDEF_RESULT();
} else {
@@ -25484,10 +24420,8 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ zend_use_scalar_as_array();
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
assign_dim_error:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -25496,9 +24430,9 @@ assign_dim_error:
}
}
if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED) {
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_dim has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -25506,27 +24440,25 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_TMPVAR_OP_DATA_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op2, free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
SAVE_OPLINE();
- orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_ARRAY)) {
try_assign_dim_array:
SEPARATE_ARRAY(object_ptr);
if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED) {
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) {
ZVAL_DEREF(value);
}
variable_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(object_ptr), value);
if (UNEXPECTED(variable_ptr == NULL)) {
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
zend_cannot_add_element();
goto assign_dim_error;
} else if (IS_TMP_VAR == IS_CV) {
@@ -25534,6 +24466,7 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_TMP_VAR == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
@@ -25546,7 +24479,7 @@ try_assign_dim_array:
}
}
} else {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
variable_ptr = zend_fetch_dimension_address_inner_W_CONST(Z_ARRVAL_P(object_ptr), dim EXECUTE_DATA_CC);
} else {
@@ -25555,7 +24488,7 @@ try_assign_dim_array:
if (UNEXPECTED(variable_ptr == NULL)) {
goto assign_dim_error;
}
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
value = zend_assign_to_variable(variable_ptr, value, IS_TMP_VAR, EX_USES_STRICT_TYPES());
}
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -25569,31 +24502,31 @@ try_assign_dim_array:
}
}
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
dim++;
}
zend_assign_to_object_dim(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
} else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED) {
zend_use_new_element_for_string();
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
UNDEF_RESULT();
} else {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
zend_assign_to_string_offset(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
}
} else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) {
if (Z_ISREF_P(orig_object_ptr)
&& ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(orig_object_ptr))
&& !zend_verify_ref_array_assignable(Z_REF_P(orig_object_ptr))) {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
UNDEF_RESULT();
} else {
@@ -25601,10 +24534,8 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ zend_use_scalar_as_array();
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
assign_dim_error:
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -25613,9 +24544,9 @@ assign_dim_error:
}
}
if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED) {
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_dim has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -25623,27 +24554,25 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_TMPVAR_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op2, free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
SAVE_OPLINE();
- orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_ARRAY)) {
try_assign_dim_array:
SEPARATE_ARRAY(object_ptr);
if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED) {
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_CV || IS_VAR == IS_VAR) {
ZVAL_DEREF(value);
}
variable_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(object_ptr), value);
if (UNEXPECTED(variable_ptr == NULL)) {
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
zend_cannot_add_element();
goto assign_dim_error;
} else if (IS_VAR == IS_CV) {
@@ -25651,6 +24580,7 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_VAR == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
@@ -25663,7 +24593,7 @@ try_assign_dim_array:
}
}
} else {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
variable_ptr = zend_fetch_dimension_address_inner_W_CONST(Z_ARRVAL_P(object_ptr), dim EXECUTE_DATA_CC);
} else {
@@ -25672,7 +24602,7 @@ try_assign_dim_array:
if (UNEXPECTED(variable_ptr == NULL)) {
goto assign_dim_error;
}
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
value = zend_assign_to_variable(variable_ptr, value, IS_VAR, EX_USES_STRICT_TYPES());
}
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -25686,31 +24616,31 @@ try_assign_dim_array:
}
}
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- value = _get_zval_ptr_var_deref((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var_deref((opline+1)->op1.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
dim++;
}
zend_assign_to_object_dim(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
} else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED) {
zend_use_new_element_for_string();
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
UNDEF_RESULT();
} else {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- value = _get_zval_ptr_var_deref((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var_deref((opline+1)->op1.var EXECUTE_DATA_CC);
zend_assign_to_string_offset(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
}
} else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) {
if (Z_ISREF_P(orig_object_ptr)
&& ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(orig_object_ptr))
&& !zend_verify_ref_array_assignable(Z_REF_P(orig_object_ptr))) {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
UNDEF_RESULT();
} else {
@@ -25718,10 +24648,8 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ zend_use_scalar_as_array();
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
assign_dim_error:
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -25730,9 +24658,9 @@ assign_dim_error:
}
}
if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED) {
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_dim has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -25740,15 +24668,13 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_TMPVAR_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op2, free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
SAVE_OPLINE();
- orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_ARRAY)) {
try_assign_dim_array:
@@ -25768,11 +24694,12 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_CV == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
}
-
+ zval_ptr_dtor_nogc(free_op_data);
}
} else if (IS_CV == IS_CONST) {
if (UNEXPECTED(Z_REFCOUNTED_P(value))) {
@@ -25780,7 +24707,7 @@ try_assign_dim_array:
}
}
} else {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
variable_ptr = zend_fetch_dimension_address_inner_W_CONST(Z_ARRVAL_P(object_ptr), dim EXECUTE_DATA_CC);
} else {
@@ -25803,7 +24730,7 @@ try_assign_dim_array:
}
}
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
value = _get_zval_ptr_cv_deref_BP_VAR_R((opline+1)->op1.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
@@ -25817,7 +24744,7 @@ try_assign_dim_array:
UNDEF_RESULT();
} else {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
value = _get_zval_ptr_cv_deref_BP_VAR_R((opline+1)->op1.var EXECUTE_DATA_CC);
zend_assign_to_string_offset(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
@@ -25826,7 +24753,7 @@ try_assign_dim_array:
if (Z_ISREF_P(orig_object_ptr)
&& ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(orig_object_ptr))
&& !zend_verify_ref_array_assignable(Z_REF_P(orig_object_ptr))) {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
UNDEF_RESULT();
} else {
@@ -25834,10 +24761,8 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ zend_use_scalar_as_array();
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
assign_dim_error:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -25846,9 +24771,9 @@ assign_dim_error:
}
}
if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED) {
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_dim has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -25856,20 +24781,14 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_VAR_TMPVAR_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2, free_op_data;
zval *property, *container, *value_ptr;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
- if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
-
- value_ptr = _get_zval_ptr_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value_ptr = _get_zval_ptr_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (1) {
if (IS_VAR == IS_UNUSED) {
@@ -25889,9 +24808,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_VAR_TMPVAR
zend_assign_to_property_reference(container, IS_VAR, property, (IS_TMP_VAR|IS_VAR), value_ptr OPLINE_CC EXECUTE_DATA_CC);
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(free_op_data)) {zval_ptr_dtor_nogc(free_op_data);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));;
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -25899,18 +24818,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_VAR_TMPVAR
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_VAR_TMPVAR_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *property, *container, *value_ptr;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
value_ptr = _get_zval_ptr_cv_BP_VAR_W((opline+1)->op1.var EXECUTE_DATA_CC);
@@ -25932,8 +24845,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_VAR_TMPVAR
zend_assign_to_property_reference(container, IS_VAR, property, (IS_TMP_VAR|IS_VAR), value_ptr OPLINE_CC EXECUTE_DATA_CC);
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -25984,9 +24897,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
EXPECTED(CACHED_PTR(opline->result.num) == ce)) {
fbc = CACHED_PTR(opline->result.num + sizeof(void*));
} else if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED) {
- zend_free_op free_op2;
-
- function_name = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ function_name = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
do {
@@ -26001,8 +24912,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
HANDLE_EXCEPTION();
}
}
- zend_throw_error(NULL, "Function name must be a string");
- zval_ptr_dtor_nogc(free_op2);
+ zend_throw_error(NULL, "Method name must be a string");
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
HANDLE_EXCEPTION();
} while (0);
}
@@ -26017,11 +24928,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
if (EXPECTED(!EG(exception))) {
zend_undefined_method(ce, Z_STR_P(function_name));
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
HANDLE_EXCEPTION();
}
if ((IS_TMP_VAR|IS_VAR) == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE)))) {
CACHE_POLYMORPHIC_PTR(opline->result.num, ce, fbc);
}
@@ -26029,7 +24939,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
init_func_run_time_cache(&fbc->op_array);
}
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
}
} else {
if (UNEXPECTED(ce->constructor == NULL)) {
@@ -26052,13 +24962,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS;
} else {
zend_non_static_method_call(fbc);
- if (UNEXPECTED(EG(exception) != NULL)) {
- HANDLE_EXCEPTION();
- }
- goto check_parent_and_self;
+ HANDLE_EXCEPTION();
}
} else {
-check_parent_and_self:
/* previous opcode is ZEND_FETCH_CLASS */
if (IS_VAR == IS_UNUSED
&& ((opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_PARENT ||
@@ -26083,21 +24989,20 @@ check_parent_and_self:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *expr_ptr, new_expr;
SAVE_OPLINE();
if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) &&
UNEXPECTED(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
- expr_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ expr_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (Z_ISREF_P(expr_ptr)) {
Z_ADDREF_P(expr_ptr);
} else {
ZVAL_MAKE_REF_EX(expr_ptr, 2);
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
} else {
- expr_ptr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ expr_ptr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_TMP_VAR) {
/* pass */
} else if (IS_VAR == IS_CONST) {
@@ -26122,8 +25027,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_TMP
}
if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED) {
- zend_free_op free_op2;
- zval *offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ zval *offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
zend_string *str;
zend_ulong hval;
@@ -26168,7 +25072,7 @@ num_index:
zend_illegal_offset();
zval_ptr_dtor_nogc(expr_ptr);
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
} else {
if (!zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr)) {
zend_cannot_add_element();
@@ -26202,15 +25106,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_VAR_TMPVAR_HAN
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container;
zval *offset;
zend_ulong hval;
zend_string *key;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
do {
if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
@@ -26260,7 +25163,7 @@ num_index_dim:
key = ZSTR_EMPTY_ALLOC();
goto str_index_dim;
} else {
- zend_error(E_WARNING, "Illegal offset type in unset");
+ zend_type_error("Illegal offset type in unset");
}
break;
} else if (Z_ISREF_P(container)) {
@@ -26279,30 +25182,27 @@ num_index_dim:
if ((IS_TMP_VAR|IS_VAR) == IS_CONST && Z_EXTRA_P(offset) == ZEND_EXTRA_VALUE) {
offset++;
}
- Z_OBJ_HT_P(container)->unset_dimension(container, offset);
+ Z_OBJ_HT_P(container)->unset_dimension(Z_OBJ_P(container), offset);
} else if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_STRING)) {
zend_throw_error(NULL, "Cannot unset string offsets");
}
} while (0);
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_VAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
- offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+ offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
do {
if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) {
@@ -26319,107 +25219,26 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_VAR_TMPVAR_HAND
break;
}
}
- Z_OBJ_HT_P(container)->unset_property(container, offset, (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL));
- } while (0);
-
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
-}
-
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
- zend_free_op free_op1, free_op2;
- zval *op1, *op2;
- zend_bool result;
-
- SAVE_OPLINE();
- op1 = _get_zval_ptr_var_deref(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_tmp(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- result = fast_is_identical_function(op1, op2);
- zval_ptr_dtor_nogc(free_op1);
- zval_ptr_dtor_nogc(free_op2);
- ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
-}
-
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
- zend_free_op free_op1, free_op2;
- zval *op1, *op2;
- zend_bool result;
-
- SAVE_OPLINE();
- op1 = _get_zval_ptr_var_deref(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_tmp(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- result = fast_is_not_identical_function(op1, op2);
- zval_ptr_dtor_nogc(free_op1);
- zval_ptr_dtor_nogc(free_op2);
- ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
-}
-
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_TMP_RETVAL_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
- zend_free_op free_op1, free_op2;
- zval *value;
- zval *variable_ptr;
-
- SAVE_OPLINE();
- value = _get_zval_ptr_tmp(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(0)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- value = zend_assign_to_variable(variable_ptr, value, IS_TMP_VAR, EX_USES_STRICT_TYPES());
- if (UNEXPECTED(0)) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
- /* zend_assign_to_variable() always takes care of op2, never free it! */
- }
-
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
-}
-
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_TMP_RETVAL_USED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
- zend_free_op free_op1, free_op2;
- zval *value;
- zval *variable_ptr;
-
- SAVE_OPLINE();
- value = _get_zval_ptr_tmp(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(1)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ break;
+ }
}
- } else {
- value = zend_assign_to_variable(variable_ptr, value, IS_TMP_VAR, EX_USES_STRICT_TYPES());
- if (UNEXPECTED(1)) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ Z_OBJ_HT_P(container)->unset_property(Z_OBJ_P(container), name, (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL));
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
- /* zend_assign_to_variable() always takes care of op2, never free it! */
- }
+ } while (0);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -26438,8 +25257,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEN
/* Set the new yielded value */
if (IS_VAR != IS_UNUSED) {
- zend_free_op free_op1;
-
if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
/* Constants and temporary variables aren't yieldable by reference,
* but we still allow them with a notice. */
@@ -26448,7 +25265,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEN
zend_error(E_NOTICE, "Only variable references should be yielded by reference");
- value = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
ZVAL_COPY_VALUE(&generator->value, value);
if (IS_VAR == IS_CONST) {
if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->value))) {
@@ -26456,7 +25273,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEN
}
}
} else {
- zval *value_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ zval *value_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
/* If a function call result is yielded and the function did
* not return by reference we throw a notice. */
@@ -26478,10 +25295,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEN
ZVAL_REF(&generator->value, Z_REF_P(value_ptr));
} while (0);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
}
} else {
- zval *value = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ zval *value = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
/* Consts, temporary variables and references need copying */
if (IS_VAR == IS_CONST) {
@@ -26493,7 +25310,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEN
ZVAL_COPY_VALUE(&generator->value, value);
} else if ((IS_VAR & (IS_VAR|IS_CV)) && Z_ISREF_P(value)) {
ZVAL_COPY(&generator->value, Z_REFVAL_P(value));
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
} else {
ZVAL_COPY_VALUE(&generator->value, value);
if (IS_VAR == IS_CV) {
@@ -26507,27 +25324,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEN
}
/* Set the new yielded key */
- if (IS_TMP_VAR != IS_UNUSED) {
- zend_free_op free_op2;
- zval *key = _get_zval_ptr_tmp(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
-
- /* Consts, temporary variables and references need copying */
- if (IS_TMP_VAR == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_TMP_VAR == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_TMP_VAR & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
-
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_TMP_VAR == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
+ if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED) {
+ zval *key = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ if (((IS_TMP_VAR|IS_VAR) & (IS_CV|IS_VAR)) && UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE) {
+ key = Z_REFVAL_P(key);
}
+ ZVAL_COPY(&generator->key, key);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (Z_TYPE(generator->key) == IS_LONG
&& Z_LVAL(generator->key) > generator->largest_used_integer_key
@@ -26560,66 +25363,122 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEN
ZEND_VM_RETURN();
}
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
zend_bool result;
SAVE_OPLINE();
- op1 = _get_zval_ptr_var_deref(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_var_deref(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var_deref(opline->op1.var EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_tmp(opline->op2.var EXECUTE_DATA_CC);
result = fast_is_identical_function(op1, op2);
- zval_ptr_dtor_nogc(free_op1);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
+}
+
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zval *op1, *op2;
+ zend_bool result;
+
+ SAVE_OPLINE();
+ op1 = _get_zval_ptr_var_deref(opline->op1.var EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_tmp(opline->op2.var EXECUTE_DATA_CC);
+ result = fast_is_not_identical_function(op1, op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ ZEND_VM_SMART_BRANCH(result, 1);
+}
+
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_TMP_RETVAL_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zval *value;
+ zval *variable_ptr;
+
+ SAVE_OPLINE();
+ value = _get_zval_ptr_tmp(opline->op2.var EXECUTE_DATA_CC);
+ variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+
+ value = zend_assign_to_variable(variable_ptr, value, IS_TMP_VAR, EX_USES_STRICT_TYPES());
+ if (UNEXPECTED(0)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
+ }
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ /* zend_assign_to_variable() always takes care of op2, never free it! */
+
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_TMP_RETVAL_USED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zval *value;
+ zval *variable_ptr;
+
+ SAVE_OPLINE();
+ value = _get_zval_ptr_tmp(opline->op2.var EXECUTE_DATA_CC);
+ variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
+
+ value = zend_assign_to_variable(variable_ptr, value, IS_TMP_VAR, EX_USES_STRICT_TYPES());
+ if (UNEXPECTED(1)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
+ }
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ /* zend_assign_to_variable() always takes care of op2, never free it! */
+
+ ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
+}
+
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zval *op1, *op2;
+ zend_bool result;
+
+ SAVE_OPLINE();
+ op1 = _get_zval_ptr_var_deref(opline->op1.var EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var_deref(opline->op2.var EXECUTE_DATA_CC);
+ result = fast_is_identical_function(op1, op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ ZEND_VM_SMART_BRANCH(result, 1);
+}
+
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *op1, *op2;
zend_bool result;
SAVE_OPLINE();
- op1 = _get_zval_ptr_var_deref(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_var_deref(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var_deref(opline->op1.var EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var_deref(opline->op2.var EXECUTE_DATA_CC);
result = fast_is_not_identical_function(op1, op2);
- zval_ptr_dtor_nogc(free_op1);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_VAR_RETVAL_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *value;
zval *variable_ptr;
SAVE_OPLINE();
- value = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(0)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- value = zend_assign_to_variable(variable_ptr, value, IS_VAR, EX_USES_STRICT_TYPES());
- if (UNEXPECTED(0)) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
- /* zend_assign_to_variable() always takes care of op2, never free it! */
+ value = zend_assign_to_variable(variable_ptr, value, IS_VAR, EX_USES_STRICT_TYPES());
+ if (UNEXPECTED(0)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ /* zend_assign_to_variable() always takes care of op2, never free it! */
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -26627,27 +25486,19 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_VAR_RETVAL_UNU
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_VAR_RETVAL_USED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *value;
zval *variable_ptr;
SAVE_OPLINE();
- value = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(1)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- value = zend_assign_to_variable(variable_ptr, value, IS_VAR, EX_USES_STRICT_TYPES());
- if (UNEXPECTED(1)) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
- /* zend_assign_to_variable() always takes care of op2, never free it! */
+ value = zend_assign_to_variable(variable_ptr, value, IS_VAR, EX_USES_STRICT_TYPES());
+ if (UNEXPECTED(1)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ /* zend_assign_to_variable() always takes care of op2, never free it! */
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -26655,23 +25506,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_VAR_RETVAL_USE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *variable_ptr;
zval *value_ptr;
SAVE_OPLINE();
- value_ptr = _get_zval_ptr_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value_ptr = _get_zval_ptr_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
- variable_ptr = &EG(uninitialized_zval);
- } else if (IS_VAR == IS_VAR &&
+ if (IS_VAR == IS_VAR &&
UNEXPECTED(Z_TYPE_P(EX_VAR(opline->op1.var)) != IS_INDIRECT)) {
zend_throw_error(NULL, "Cannot assign by reference to an array dimension of an object");
variable_ptr = &EG(uninitialized_zval);
- } else if (IS_VAR == IS_VAR && UNEXPECTED(Z_ISERROR_P(value_ptr))) {
- variable_ptr = &EG(uninitialized_zval);
} else if (IS_VAR == IS_VAR &&
opline->extended_value == ZEND_RETURNS_FUNCTION &&
UNEXPECTED(!Z_ISREF_P(value_ptr))) {
@@ -26687,161 +25533,19 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_VAR_VAR_HANDLE
ZVAL_COPY(EX_VAR(opline->result.var), variable_ptr);
}
- if (UNEXPECTED(free_op2)) {zval_ptr_dtor_nogc(free_op2);};
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
-
- zend_generator *generator = zend_get_running_generator(EXECUTE_DATA_C);
-
- SAVE_OPLINE();
- if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
- ZEND_VM_TAIL_CALL(zend_yield_in_closed_generator_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- /* Destroy the previously yielded value */
- zval_ptr_dtor(&generator->value);
-
- /* Destroy the previously yielded key */
- zval_ptr_dtor(&generator->key);
-
- /* Set the new yielded value */
- if (IS_VAR != IS_UNUSED) {
- zend_free_op free_op1;
-
- if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
- /* Constants and temporary variables aren't yieldable by reference,
- * but we still allow them with a notice. */
- if (IS_VAR & (IS_CONST|IS_TMP_VAR)) {
- zval *value;
-
- zend_error(E_NOTICE, "Only variable references should be yielded by reference");
-
- value = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- ZVAL_COPY_VALUE(&generator->value, value);
- if (IS_VAR == IS_CONST) {
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->value))) {
- Z_ADDREF(generator->value);
- }
- }
- } else {
- zval *value_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- /* If a function call result is yielded and the function did
- * not return by reference we throw a notice. */
- do {
- if (IS_VAR == IS_VAR) {
- ZEND_ASSERT(value_ptr != &EG(uninitialized_zval));
- if (opline->extended_value == ZEND_RETURNS_FUNCTION
- && !Z_ISREF_P(value_ptr)) {
- zend_error(E_NOTICE, "Only variable references should be yielded by reference");
- ZVAL_COPY(&generator->value, value_ptr);
- break;
- }
- }
- if (Z_ISREF_P(value_ptr)) {
- Z_ADDREF_P(value_ptr);
- } else {
- ZVAL_MAKE_REF_EX(value_ptr, 2);
- }
- ZVAL_REF(&generator->value, Z_REF_P(value_ptr));
- } while (0);
-
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
- }
- } else {
- zval *value = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- /* Consts, temporary variables and references need copying */
- if (IS_VAR == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->value, value);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->value))) {
- Z_ADDREF(generator->value);
- }
- } else if (IS_VAR == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->value, value);
- } else if ((IS_VAR & (IS_VAR|IS_CV)) && Z_ISREF_P(value)) {
- ZVAL_COPY(&generator->value, Z_REFVAL_P(value));
- zval_ptr_dtor_nogc(free_op1);
- } else {
- ZVAL_COPY_VALUE(&generator->value, value);
- if (IS_VAR == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
- }
- }
- }
- } else {
- /* If no value was specified yield null */
- ZVAL_NULL(&generator->value);
- }
-
- /* Set the new yielded key */
- if (IS_VAR != IS_UNUSED) {
- zend_free_op free_op2;
- zval *key = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
-
- /* Consts, temporary variables and references need copying */
- if (IS_VAR == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_VAR == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_VAR & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
- zval_ptr_dtor_nogc(free_op2);
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_VAR == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
- }
-
- if (Z_TYPE(generator->key) == IS_LONG
- && Z_LVAL(generator->key) > generator->largest_used_integer_key
- ) {
- generator->largest_used_integer_key = Z_LVAL(generator->key);
- }
- } else {
- /* If no key was specified we use auto-increment keys */
- generator->largest_used_integer_key++;
- ZVAL_LONG(&generator->key, generator->largest_used_integer_key);
- }
-
- if (RETURN_VALUE_USED(opline)) {
- /* If the return value of yield is used set the send
- * target and initialize it to NULL */
- generator->send_target = EX_VAR(opline->result.var);
- ZVAL_NULL(generator->send_target);
- } else {
- generator->send_target = NULL;
- }
-
- /* We increment to the next op, so we are at the correct position when the
- * generator is resumed. */
- ZEND_VM_INC_OPCODE();
-
- /* The GOTO VM uses a local opline variable. We need to set the opline
- * variable in execute_data so we don't resume at an old position. */
- SAVE_OPLINE();
-
- ZEND_VM_RETURN();
-}
-
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op_data1;
zval *var_ptr;
zval *value, *container, *dim;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
assign_dim_op_array:
@@ -26865,7 +25569,7 @@ assign_dim_op_new_array:
}
}
- value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data1);
+ value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1);
do {
if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_ISREF_P(var_ptr))) {
@@ -26882,7 +25586,7 @@ assign_dim_op_new_array:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
- FREE_OP(free_op_data1);
+ FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
} else {
if (EXPECTED(Z_ISREF_P(container))) {
container = Z_REFVAL_P(container);
@@ -26913,23 +25617,21 @@ assign_dim_op_ret_null:
}
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
zend_fetch_dimension_address_W(container, NULL, IS_UNUSED OPLINE_CC EXECUTE_DATA_CC);
if (IS_VAR == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -26937,16 +25639,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_UNUSED_HA
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
zend_fetch_dimension_address_RW(container, NULL, IS_UNUSED OPLINE_CC EXECUTE_DATA_CC);
if (IS_VAR == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -26973,15 +25673,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_UN
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_OP_DATA_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
SAVE_OPLINE();
- orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_ARRAY)) {
try_assign_dim_array:
@@ -27001,11 +25699,12 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_CONST == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
}
-
+ zval_ptr_dtor_nogc(free_op_data);
}
} else if (IS_CONST == IS_CONST) {
if (UNEXPECTED(Z_REFCOUNTED_P(value))) {
@@ -27067,9 +25766,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = NULL;
assign_dim_error:
@@ -27081,7 +25778,7 @@ assign_dim_error:
if (IS_UNUSED != IS_UNUSED) {
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_dim has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -27089,27 +25786,25 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_OP_DATA_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
SAVE_OPLINE();
- orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_ARRAY)) {
try_assign_dim_array:
SEPARATE_ARRAY(object_ptr);
if (IS_UNUSED == IS_UNUSED) {
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) {
ZVAL_DEREF(value);
}
variable_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(object_ptr), value);
if (UNEXPECTED(variable_ptr == NULL)) {
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
zend_cannot_add_element();
goto assign_dim_error;
} else if (IS_TMP_VAR == IS_CV) {
@@ -27117,6 +25812,7 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_TMP_VAR == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
@@ -27138,7 +25834,7 @@ try_assign_dim_array:
if (UNEXPECTED(variable_ptr == NULL)) {
goto assign_dim_error;
}
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
value = zend_assign_to_variable(variable_ptr, value, IS_TMP_VAR, EX_USES_STRICT_TYPES());
}
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -27153,14 +25849,14 @@ try_assign_dim_array:
}
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) {
dim = NULL;
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_UNUSED == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
dim++;
}
zend_assign_to_object_dim(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
} else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
if (IS_UNUSED == IS_UNUSED) {
zend_use_new_element_for_string();
@@ -27168,9 +25864,9 @@ try_assign_dim_array:
UNDEF_RESULT();
} else {
dim = NULL;
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
zend_assign_to_string_offset(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
}
} else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) {
if (Z_ISREF_P(orig_object_ptr)
@@ -27184,9 +25880,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = NULL;
assign_dim_error:
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
@@ -27198,7 +25892,7 @@ assign_dim_error:
if (IS_UNUSED != IS_UNUSED) {
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_dim has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -27206,27 +25900,25 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
SAVE_OPLINE();
- orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_ARRAY)) {
try_assign_dim_array:
SEPARATE_ARRAY(object_ptr);
if (IS_UNUSED == IS_UNUSED) {
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_CV || IS_VAR == IS_VAR) {
ZVAL_DEREF(value);
}
variable_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(object_ptr), value);
if (UNEXPECTED(variable_ptr == NULL)) {
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
zend_cannot_add_element();
goto assign_dim_error;
} else if (IS_VAR == IS_CV) {
@@ -27234,6 +25926,7 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_VAR == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
@@ -27255,7 +25948,7 @@ try_assign_dim_array:
if (UNEXPECTED(variable_ptr == NULL)) {
goto assign_dim_error;
}
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
value = zend_assign_to_variable(variable_ptr, value, IS_VAR, EX_USES_STRICT_TYPES());
}
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -27270,14 +25963,14 @@ try_assign_dim_array:
}
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) {
dim = NULL;
- value = _get_zval_ptr_var_deref((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var_deref((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_UNUSED == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
dim++;
}
zend_assign_to_object_dim(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
} else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
if (IS_UNUSED == IS_UNUSED) {
zend_use_new_element_for_string();
@@ -27285,9 +25978,9 @@ try_assign_dim_array:
UNDEF_RESULT();
} else {
dim = NULL;
- value = _get_zval_ptr_var_deref((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var_deref((opline+1)->op1.var EXECUTE_DATA_CC);
zend_assign_to_string_offset(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
}
} else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) {
if (Z_ISREF_P(orig_object_ptr)
@@ -27301,9 +25994,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = NULL;
assign_dim_error:
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
@@ -27315,7 +26006,7 @@ assign_dim_error:
if (IS_UNUSED != IS_UNUSED) {
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_dim has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -27323,15 +26014,13 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
SAVE_OPLINE();
- orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_ARRAY)) {
try_assign_dim_array:
@@ -27351,11 +26040,12 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_CV == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
}
-
+ zval_ptr_dtor_nogc(free_op_data);
}
} else if (IS_CV == IS_CONST) {
if (UNEXPECTED(Z_REFCOUNTED_P(value))) {
@@ -27417,9 +26107,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = NULL;
assign_dim_error:
@@ -27431,7 +26119,7 @@ assign_dim_error:
if (IS_UNUSED != IS_UNUSED) {
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_dim has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -27481,8 +26169,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
EXPECTED(CACHED_PTR(opline->result.num) == ce)) {
fbc = CACHED_PTR(opline->result.num + sizeof(void*));
} else if (IS_UNUSED != IS_UNUSED) {
-
-
function_name = NULL;
if (IS_UNUSED != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
@@ -27498,7 +26184,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
HANDLE_EXCEPTION();
}
}
- zend_throw_error(NULL, "Function name must be a string");
+ zend_throw_error(NULL, "Method name must be a string");
HANDLE_EXCEPTION();
} while (0);
@@ -27518,7 +26204,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
HANDLE_EXCEPTION();
}
if (IS_UNUSED == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE)))) {
CACHE_POLYMORPHIC_PTR(opline->result.num, ce, fbc);
}
@@ -27549,13 +26234,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS;
} else {
zend_non_static_method_call(fbc);
- if (UNEXPECTED(EG(exception) != NULL)) {
- HANDLE_EXCEPTION();
- }
- goto check_parent_and_self;
+ HANDLE_EXCEPTION();
}
} else {
-check_parent_and_self:
/* previous opcode is ZEND_FETCH_CLASS */
if (IS_VAR == IS_UNUSED
&& ((opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_PARENT ||
@@ -27581,17 +26262,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_VERIFY_RETURN_TYPE_SPEC_VAR_UN
{
USE_OPLINE
- SAVE_OPLINE();
if (IS_VAR == IS_UNUSED) {
+ SAVE_OPLINE();
zend_verify_missing_return_type(EX(func), CACHE_ADDR(opline->op2.num));
+ HANDLE_EXCEPTION();
} else {
/* prevents "undefined variable opline" errors */
#if 0 || (IS_VAR != IS_UNUSED)
zval *retval_ref, *retval_ptr;
- zend_free_op free_op1;
zend_arg_info *ret_info = EX(func)->common.arg_info - 1;
-
- retval_ref = retval_ptr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ retval_ref = retval_ptr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_CONST) {
ZVAL_COPY(EX_VAR(opline->result.var), retval_ptr);
@@ -27605,26 +26285,35 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_VERIFY_RETURN_TYPE_SPEC_VAR_UN
ZVAL_DEREF(retval_ptr);
}
- if (UNEXPECTED(!ZEND_TYPE_IS_CLASS(ret_info->type)
- && ZEND_TYPE_CODE(ret_info->type) != IS_CALLABLE
- && ZEND_TYPE_CODE(ret_info->type) != IS_ITERABLE
- && !ZEND_SAME_FAKE_TYPE(ZEND_TYPE_CODE(ret_info->type), Z_TYPE_P(retval_ptr))
- && !(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)
- && retval_ref != retval_ptr)
- ) {
- /* A cast might happen - unwrap the reference if this is a by-value return */
- if (Z_REFCOUNT_P(retval_ref) == 1) {
- ZVAL_UNREF(retval_ref);
+ if (EXPECTED(ZEND_TYPE_CONTAINS_CODE(ret_info->type, Z_TYPE_P(retval_ptr)))) {
+ ZEND_VM_NEXT_OPCODE();
+ }
+
+ zend_reference *ref = NULL;
+ void *cache_slot = CACHE_ADDR(opline->op2.num);
+ if (UNEXPECTED(retval_ref != retval_ptr)) {
+ if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
+ ref = Z_REF_P(retval_ref);
} else {
- Z_DELREF_P(retval_ref);
- ZVAL_COPY(retval_ref, retval_ptr);
+ /* A cast might happen - unwrap the reference if this is a by-value return */
+ if (Z_REFCOUNT_P(retval_ref) == 1) {
+ ZVAL_UNREF(retval_ref);
+ } else {
+ Z_DELREF_P(retval_ref);
+ ZVAL_COPY(retval_ref, retval_ptr);
+ }
+ retval_ptr = retval_ref;
}
- retval_ptr = retval_ref;
}
- zend_verify_return_type(EX(func), retval_ptr, CACHE_ADDR(opline->op2.num));
+
+ SAVE_OPLINE();
+ if (UNEXPECTED(!zend_check_type_slow(ret_info->type, retval_ptr, ref, cache_slot, NULL, 1, 0))) {
+ zend_verify_return_error(EX(func), cache_slot, retval_ptr);
+ HANDLE_EXCEPTION();
+ }
+ ZEND_VM_NEXT_OPCODE();
#endif
}
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_NEW_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -27701,21 +26390,20 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_NEW_SPEC_VAR_UNUSED_HANDLER(ZE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *expr_ptr, new_expr;
SAVE_OPLINE();
if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) &&
UNEXPECTED(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
- expr_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ expr_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (Z_ISREF_P(expr_ptr)) {
Z_ADDREF_P(expr_ptr);
} else {
ZVAL_MAKE_REF_EX(expr_ptr, 2);
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
} else {
- expr_ptr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ expr_ptr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_TMP_VAR) {
/* pass */
} else if (IS_VAR == IS_CONST) {
@@ -27740,7 +26428,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_UNU
}
if (IS_UNUSED != IS_UNUSED) {
-
zval *offset = NULL;
zend_string *str;
zend_ulong hval;
@@ -27851,8 +26538,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER(
/* Set the new yielded value */
if (IS_VAR != IS_UNUSED) {
- zend_free_op free_op1;
-
if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
/* Constants and temporary variables aren't yieldable by reference,
* but we still allow them with a notice. */
@@ -27861,7 +26546,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER(
zend_error(E_NOTICE, "Only variable references should be yielded by reference");
- value = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
ZVAL_COPY_VALUE(&generator->value, value);
if (IS_VAR == IS_CONST) {
if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->value))) {
@@ -27869,7 +26554,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER(
}
}
} else {
- zval *value_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ zval *value_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
/* If a function call result is yielded and the function did
* not return by reference we throw a notice. */
@@ -27891,10 +26576,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER(
ZVAL_REF(&generator->value, Z_REF_P(value_ptr));
} while (0);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
}
} else {
- zval *value = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ zval *value = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
/* Consts, temporary variables and references need copying */
if (IS_VAR == IS_CONST) {
@@ -27906,7 +26591,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER(
ZVAL_COPY_VALUE(&generator->value, value);
} else if ((IS_VAR & (IS_VAR|IS_CV)) && Z_ISREF_P(value)) {
ZVAL_COPY(&generator->value, Z_REFVAL_P(value));
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
} else {
ZVAL_COPY_VALUE(&generator->value, value);
if (IS_VAR == IS_CV) {
@@ -27921,26 +26606,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER(
/* Set the new yielded key */
if (IS_UNUSED != IS_UNUSED) {
-
zval *key = NULL;
-
- /* Consts, temporary variables and references need copying */
- if (IS_UNUSED == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_UNUSED == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_UNUSED & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
-
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_UNUSED == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
+ if ((IS_UNUSED & (IS_CV|IS_VAR)) && UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE) {
+ key = Z_REFVAL_P(key);
}
+ ZVAL_COPY(&generator->key, key);
if (Z_TYPE(generator->key) == IS_LONG
&& Z_LVAL(generator->key) > generator->largest_used_integer_key
@@ -28009,44 +26679,39 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_MAKE_REF_SPEC_VAR_UNUSED_HANDL
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GET_TYPE_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *op1;
zend_string *type;
SAVE_OPLINE();
- op1 = _get_zval_ptr_var_deref(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ op1 = _get_zval_ptr_var_deref(opline->op1.var EXECUTE_DATA_CC);
type = zend_zval_get_type(op1);
if (EXPECTED(type)) {
ZVAL_INTERNED_STR(EX_VAR(opline->result.var), type);
} else {
ZVAL_STRING(EX_VAR(opline->result.var), "unknown type");
}
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op_data;
zval *object;
zval *property;
zval *value;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- object = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
+ object = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
do {
- value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data);
+ value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1);
if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
@@ -28057,16 +26722,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_VAR_CV_HAND
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
assign_op_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ UNDEF_RESULT();
+ break;
+ }
+ }
cache_slot = (IS_CV == IS_CONST) ? CACHE_ADDR((opline+1)->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -28103,13 +26776,16 @@ assign_op_object:
}
}
} else {
- zend_assign_op_overloaded_property(object, property, cache_slot, value OPLINE_CC EXECUTE_DATA_CC);
+ zend_assign_op_overloaded_property(zobj, name, cache_slot, value OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
- FREE_OP(free_op_data);
+ FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -28118,12 +26794,11 @@ assign_op_object:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op_data1;
zval *var_ptr;
zval *value, *container, *dim;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
assign_dim_op_array:
@@ -28147,7 +26822,7 @@ assign_dim_op_new_array:
}
}
- value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data1);
+ value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1);
do {
if (IS_CV != IS_UNUSED && UNEXPECTED(Z_ISREF_P(var_ptr))) {
@@ -28164,7 +26839,7 @@ assign_dim_op_new_array:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
- FREE_OP(free_op_data1);
+ FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
} else {
if (EXPECTED(Z_ISREF_P(container))) {
container = Z_REFVAL_P(container);
@@ -28195,64 +26870,53 @@ assign_dim_op_ret_null:
}
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OP_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *var_ptr;
zval *value;
SAVE_OPLINE();
value = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
- var_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ var_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_ISERROR_P(var_ptr))) {
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- do {
- if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_REFERENCE)) {
- zend_reference *ref = Z_REF_P(var_ptr);
- var_ptr = Z_REFVAL_P(var_ptr);
- if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
- zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
- break;
- }
+ do {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_REFERENCE)) {
+ zend_reference *ref = Z_REF_P(var_ptr);
+ var_ptr = Z_REFVAL_P(var_ptr);
+ if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
+ zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
- zend_binary_op(var_ptr, var_ptr, value OPLINE_CC);
- } while (0);
-
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
+ zend_binary_op(var_ptr, var_ptr, value OPLINE_CC);
+ } while (0);
+
+ if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
+ ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object;
zval *property;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- object = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
+ object = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
do {
@@ -28265,16 +26929,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_VAR_CV_HANDLE
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
pre_incdec_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ UNDEF_RESULT();
+ break;
+ }
+ }
cache_slot = (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -28288,31 +26960,30 @@ pre_incdec_object:
zend_pre_incdec_property_zval(zptr, prop_info OPLINE_CC EXECUTE_DATA_CC);
}
} else {
- zend_pre_incdec_overloaded_property(object, property, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ zend_pre_incdec_overloaded_property(zobj, name, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object;
zval *property;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- object = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
+ object = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
do {
@@ -28325,16 +26996,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_VAR_CV_HANDL
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
post_incdec_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
+ }
cache_slot = (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
ZVAL_NULL(EX_VAR(opline->result.var));
} else {
@@ -28347,27 +27026,28 @@ post_incdec_object:
zend_post_incdec_property_zval(zptr, prop_info OPLINE_CC EXECUTE_DATA_CC);
}
} else {
- zend_post_incdec_overloaded_property(object, property, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ zend_post_incdec_overloaded_property(zobj, name, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
zend_fetch_dimension_address_W(container, EX_VAR(opline->op2.var), IS_CV OPLINE_CC EXECUTE_DATA_CC);
if (IS_VAR == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -28375,16 +27055,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_VAR_CV_HANDLE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
zend_fetch_dimension_address_RW(container, EX_VAR(opline->op2.var), IS_CV OPLINE_CC EXECUTE_DATA_CC);
if (IS_VAR == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -28411,16 +27089,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_VAR_CV
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
zend_fetch_dimension_address_UNSET(container, EX_VAR(opline->op2.var), IS_CV OPLINE_CC EXECUTE_DATA_CC);
if (IS_VAR == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -28428,16 +27104,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_VAR_CV_HA
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *property, *container, *result;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
result = EX_VAR(opline->result.var);
zend_fetch_property_address(
@@ -28446,7 +27117,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_CV_HANDLE
BP_VAR_W, opline->extended_value & ZEND_FETCH_OBJ_FLAGS, 1 OPLINE_CC EXECUTE_DATA_CC);
if (IS_VAR == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -28454,21 +27125,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_VAR_CV_HANDLE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *property, *container, *result;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
result = EX_VAR(opline->result.var);
zend_fetch_property_address(result, container, IS_VAR, property, IS_CV, ((IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL), BP_VAR_RW, 0, 1 OPLINE_CC EXECUTE_DATA_CC);
if (IS_VAR == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -28493,22 +27159,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_VAR_CV
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container, *property, *result;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
result = EX_VAR(opline->result.var);
zend_fetch_property_address(result, container, IS_VAR, property, IS_CV, ((IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL), BP_VAR_UNSET, 0, 1 OPLINE_CC EXECUTE_DATA_CC);
if (IS_VAR == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -28516,11 +27176,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_CV_HA
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_LIST_W_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container, *dim;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
dim = EX_VAR(opline->op2.var);
if (IS_VAR == IS_VAR
@@ -28539,16 +27198,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_LIST_W_SPEC_VAR_CV_HANDL
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CV_OP_DATA_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- object = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
+ object = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
value = RT_CONSTANT((opline+1), (opline+1)->op1);
@@ -28557,16 +27212,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CV_OP_DATA
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CV == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -28656,16 +27310,31 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ ZVAL_COPY_DEREF(EX_VAR(opline->result.var), value);
}
exit_assign_obj:
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -28674,34 +27343,29 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CV_OP_DATA_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op_data;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- object = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
+ object = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CV == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -28791,16 +27455,31 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ ZVAL_COPY_DEREF(EX_VAR(opline->result.var), value);
}
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
exit_assign_obj:
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -28809,34 +27488,29 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CV_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op_data;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- object = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
+ object = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CV == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -28926,16 +27600,31 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ ZVAL_COPY_DEREF(EX_VAR(opline->result.var), value);
}
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
exit_assign_obj:
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -28944,16 +27633,12 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CV_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- object = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
+ object = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
value = _get_zval_ptr_cv_BP_VAR_R((opline+1)->op1.var EXECUTE_DATA_CC);
@@ -28962,16 +27647,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CV_OP_DATA
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CV == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -29061,16 +27745,31 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ ZVAL_COPY_DEREF(EX_VAR(opline->result.var), value);
}
exit_assign_obj:
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -29079,15 +27778,13 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CV_OP_DATA_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
SAVE_OPLINE();
- orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_ARRAY)) {
try_assign_dim_array:
@@ -29107,11 +27804,12 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_CONST == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
}
-
+ zval_ptr_dtor_nogc(free_op_data);
}
} else if (IS_CONST == IS_CONST) {
if (UNEXPECTED(Z_REFCOUNTED_P(value))) {
@@ -29173,9 +27871,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
assign_dim_error:
@@ -29187,7 +27883,7 @@ assign_dim_error:
if (IS_CV != IS_UNUSED) {
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_dim has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -29195,27 +27891,25 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CV_OP_DATA_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
SAVE_OPLINE();
- orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_ARRAY)) {
try_assign_dim_array:
SEPARATE_ARRAY(object_ptr);
if (IS_CV == IS_UNUSED) {
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) {
ZVAL_DEREF(value);
}
variable_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(object_ptr), value);
if (UNEXPECTED(variable_ptr == NULL)) {
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
zend_cannot_add_element();
goto assign_dim_error;
} else if (IS_TMP_VAR == IS_CV) {
@@ -29223,6 +27917,7 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_TMP_VAR == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
@@ -29244,7 +27939,7 @@ try_assign_dim_array:
if (UNEXPECTED(variable_ptr == NULL)) {
goto assign_dim_error;
}
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
value = zend_assign_to_variable(variable_ptr, value, IS_TMP_VAR, EX_USES_STRICT_TYPES());
}
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -29259,14 +27954,14 @@ try_assign_dim_array:
}
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) {
dim = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_CV == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
dim++;
}
zend_assign_to_object_dim(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
} else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
if (IS_CV == IS_UNUSED) {
zend_use_new_element_for_string();
@@ -29274,9 +27969,9 @@ try_assign_dim_array:
UNDEF_RESULT();
} else {
dim = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
zend_assign_to_string_offset(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
}
} else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) {
if (Z_ISREF_P(orig_object_ptr)
@@ -29290,9 +27985,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
assign_dim_error:
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
@@ -29304,7 +27997,7 @@ assign_dim_error:
if (IS_CV != IS_UNUSED) {
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_dim has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -29312,27 +28005,25 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CV_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
SAVE_OPLINE();
- orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_ARRAY)) {
try_assign_dim_array:
SEPARATE_ARRAY(object_ptr);
if (IS_CV == IS_UNUSED) {
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_CV || IS_VAR == IS_VAR) {
ZVAL_DEREF(value);
}
variable_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(object_ptr), value);
if (UNEXPECTED(variable_ptr == NULL)) {
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
zend_cannot_add_element();
goto assign_dim_error;
} else if (IS_VAR == IS_CV) {
@@ -29340,6 +28031,7 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_VAR == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
@@ -29361,7 +28053,7 @@ try_assign_dim_array:
if (UNEXPECTED(variable_ptr == NULL)) {
goto assign_dim_error;
}
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
value = zend_assign_to_variable(variable_ptr, value, IS_VAR, EX_USES_STRICT_TYPES());
}
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -29376,14 +28068,14 @@ try_assign_dim_array:
}
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) {
dim = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
- value = _get_zval_ptr_var_deref((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var_deref((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_CV == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
dim++;
}
zend_assign_to_object_dim(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
} else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
if (IS_CV == IS_UNUSED) {
zend_use_new_element_for_string();
@@ -29391,9 +28083,9 @@ try_assign_dim_array:
UNDEF_RESULT();
} else {
dim = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
- value = _get_zval_ptr_var_deref((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var_deref((opline+1)->op1.var EXECUTE_DATA_CC);
zend_assign_to_string_offset(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
}
} else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) {
if (Z_ISREF_P(orig_object_ptr)
@@ -29407,9 +28099,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
assign_dim_error:
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
@@ -29421,7 +28111,7 @@ assign_dim_error:
if (IS_CV != IS_UNUSED) {
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_dim has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -29429,15 +28119,13 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_VAR_CV_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
SAVE_OPLINE();
- orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ orig_object_ptr = object_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_ARRAY)) {
try_assign_dim_array:
@@ -29457,11 +28145,12 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_CV == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
}
-
+ zval_ptr_dtor_nogc(free_op_data);
}
} else if (IS_CV == IS_CONST) {
if (UNEXPECTED(Z_REFCOUNTED_P(value))) {
@@ -29523,9 +28212,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_VAR != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
assign_dim_error:
@@ -29537,7 +28224,7 @@ assign_dim_error:
if (IS_CV != IS_UNUSED) {
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
/* assign_dim has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -29545,27 +28232,19 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_CV_RETVAL_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *value;
zval *variable_ptr;
SAVE_OPLINE();
value = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
- variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
-
- if (UNEXPECTED(0)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- value = zend_assign_to_variable(variable_ptr, value, IS_CV, EX_USES_STRICT_TYPES());
- if (UNEXPECTED(0)) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
- /* zend_assign_to_variable() always takes care of op2, never free it! */
+ value = zend_assign_to_variable(variable_ptr, value, IS_CV, EX_USES_STRICT_TYPES());
+ if (UNEXPECTED(0)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ /* zend_assign_to_variable() always takes care of op2, never free it! */
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -29573,27 +28252,19 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_CV_RETVAL_UNUS
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_CV_RETVAL_USED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *value;
zval *variable_ptr;
SAVE_OPLINE();
value = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
- variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
-
- if (UNEXPECTED(1)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- value = zend_assign_to_variable(variable_ptr, value, IS_CV, EX_USES_STRICT_TYPES());
- if (UNEXPECTED(1)) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
- /* zend_assign_to_variable() always takes care of op2, never free it! */
+ value = zend_assign_to_variable(variable_ptr, value, IS_CV, EX_USES_STRICT_TYPES());
+ if (UNEXPECTED(1)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
+ /* zend_assign_to_variable() always takes care of op2, never free it! */
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -29601,23 +28272,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_VAR_CV_RETVAL_USED
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *variable_ptr;
zval *value_ptr;
SAVE_OPLINE();
value_ptr = _get_zval_ptr_cv_BP_VAR_W(opline->op2.var EXECUTE_DATA_CC);
- variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ variable_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
- if (IS_VAR == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
- variable_ptr = &EG(uninitialized_zval);
- } else if (IS_VAR == IS_VAR &&
+ if (IS_VAR == IS_VAR &&
UNEXPECTED(Z_TYPE_P(EX_VAR(opline->op1.var)) != IS_INDIRECT)) {
zend_throw_error(NULL, "Cannot assign by reference to an array dimension of an object");
variable_ptr = &EG(uninitialized_zval);
- } else if (IS_CV == IS_VAR && UNEXPECTED(Z_ISERROR_P(value_ptr))) {
- variable_ptr = &EG(uninitialized_zval);
} else if (IS_CV == IS_VAR &&
opline->extended_value == ZEND_RETURNS_FUNCTION &&
UNEXPECTED(!Z_ISREF_P(value_ptr))) {
@@ -29633,27 +28299,21 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_VAR_CV_HANDLER
ZVAL_COPY(EX_VAR(opline->result.var), variable_ptr);
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_VAR_CV_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op_data;
zval *property, *container, *value_ptr;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
- value_ptr = _get_zval_ptr_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value_ptr = _get_zval_ptr_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (1) {
if (IS_VAR == IS_UNUSED) {
@@ -29673,9 +28333,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_VAR_CV_OP_
zend_assign_to_property_reference(container, IS_VAR, property, IS_CV, value_ptr OPLINE_CC EXECUTE_DATA_CC);
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
- if (UNEXPECTED(free_op_data)) {zval_ptr_dtor_nogc(free_op_data);};
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));;
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -29683,17 +28343,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_VAR_CV_OP_
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_VAR_CV_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *property, *container, *value_ptr;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
-
- if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
value_ptr = _get_zval_ptr_cv_BP_VAR_W((opline+1)->op1.var EXECUTE_DATA_CC);
@@ -29716,7 +28370,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_VAR_CV_OP_
zend_assign_to_property_reference(container, IS_VAR, property, IS_CV, value_ptr OPLINE_CC EXECUTE_DATA_CC);
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_EX(1, 2);
@@ -29768,8 +28422,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
EXPECTED(CACHED_PTR(opline->result.num) == ce)) {
fbc = CACHED_PTR(opline->result.num + sizeof(void*));
} else if (IS_CV != IS_UNUSED) {
-
-
function_name = EX_VAR(opline->op2.var);
if (IS_CV != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
@@ -29785,7 +28437,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
HANDLE_EXCEPTION();
}
}
- zend_throw_error(NULL, "Function name must be a string");
+ zend_throw_error(NULL, "Method name must be a string");
HANDLE_EXCEPTION();
} while (0);
@@ -29805,7 +28457,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
HANDLE_EXCEPTION();
}
if (IS_CV == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE)))) {
CACHE_POLYMORPHIC_PTR(opline->result.num, ce, fbc);
}
@@ -29836,13 +28487,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS;
} else {
zend_non_static_method_call(fbc);
- if (UNEXPECTED(EG(exception) != NULL)) {
- HANDLE_EXCEPTION();
- }
- goto check_parent_and_self;
+ HANDLE_EXCEPTION();
}
} else {
-check_parent_and_self:
/* previous opcode is ZEND_FETCH_CLASS */
if (IS_VAR == IS_UNUSED
&& ((opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_PARENT ||
@@ -29867,21 +28514,20 @@ check_parent_and_self:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *expr_ptr, new_expr;
SAVE_OPLINE();
if ((IS_VAR == IS_VAR || IS_VAR == IS_CV) &&
UNEXPECTED(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
- expr_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ expr_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (Z_ISREF_P(expr_ptr)) {
Z_ADDREF_P(expr_ptr);
} else {
ZVAL_MAKE_REF_EX(expr_ptr, 2);
}
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
} else {
- expr_ptr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ expr_ptr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_TMP_VAR) {
/* pass */
} else if (IS_VAR == IS_CONST) {
@@ -29906,7 +28552,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CV_
}
if (IS_CV != IS_UNUSED) {
-
zval *offset = EX_VAR(opline->op2.var);
zend_string *str;
zend_ulong hval;
@@ -29986,14 +28631,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_VAR_CV_HANDLER
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
zval *offset;
zend_ulong hval;
zend_string *key;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
offset = EX_VAR(opline->op2.var);
do {
@@ -30044,7 +28688,7 @@ num_index_dim:
key = ZSTR_EMPTY_ALLOC();
goto str_index_dim;
} else {
- zend_error(E_WARNING, "Illegal offset type in unset");
+ zend_type_error("Illegal offset type in unset");
}
break;
} else if (Z_ISREF_P(container)) {
@@ -30063,28 +28707,25 @@ num_index_dim:
if (IS_CV == IS_CONST && Z_EXTRA_P(offset) == ZEND_EXTRA_VALUE) {
offset++;
}
- Z_OBJ_HT_P(container)->unset_dimension(container, offset);
+ Z_OBJ_HT_P(container)->unset_dimension(Z_OBJ_P(container), offset);
} else if (IS_VAR != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_STRING)) {
zend_throw_error(NULL, "Cannot unset string offsets");
}
} while (0);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
- container = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
- if (IS_VAR == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
+ container = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
offset = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
do {
@@ -30102,10 +28743,21 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_VAR_CV_HANDLER(
break;
}
}
- Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL));
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ break;
+ }
+ }
+ Z_OBJ_HT_P(container)->unset_property(Z_OBJ_P(container), name, ((IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL));
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
} while (0);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -30128,8 +28780,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CV_HANDLER(ZEND
/* Set the new yielded value */
if (IS_VAR != IS_UNUSED) {
- zend_free_op free_op1;
-
if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
/* Constants and temporary variables aren't yieldable by reference,
* but we still allow them with a notice. */
@@ -30138,7 +28788,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CV_HANDLER(ZEND
zend_error(E_NOTICE, "Only variable references should be yielded by reference");
- value = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
ZVAL_COPY_VALUE(&generator->value, value);
if (IS_VAR == IS_CONST) {
if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->value))) {
@@ -30146,7 +28796,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CV_HANDLER(ZEND
}
}
} else {
- zval *value_ptr = _get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ zval *value_ptr = _get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC);
/* If a function call result is yielded and the function did
* not return by reference we throw a notice. */
@@ -30168,10 +28818,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CV_HANDLER(ZEND
ZVAL_REF(&generator->value, Z_REF_P(value_ptr));
} while (0);
- if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
}
} else {
- zval *value = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ zval *value = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
/* Consts, temporary variables and references need copying */
if (IS_VAR == IS_CONST) {
@@ -30183,7 +28833,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CV_HANDLER(ZEND
ZVAL_COPY_VALUE(&generator->value, value);
} else if ((IS_VAR & (IS_VAR|IS_CV)) && Z_ISREF_P(value)) {
ZVAL_COPY(&generator->value, Z_REFVAL_P(value));
- zval_ptr_dtor_nogc(free_op1);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
} else {
ZVAL_COPY_VALUE(&generator->value, value);
if (IS_VAR == IS_CV) {
@@ -30198,26 +28848,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CV_HANDLER(ZEND
/* Set the new yielded key */
if (IS_CV != IS_UNUSED) {
-
zval *key = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
-
- /* Consts, temporary variables and references need copying */
- if (IS_CV == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_CV == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_CV & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
-
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_CV == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
+ if ((IS_CV & (IS_CV|IS_VAR)) && UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE) {
+ key = Z_REFVAL_P(key);
}
+ ZVAL_COPY(&generator->key, key);
if (Z_TYPE(generator->key) == IS_LONG
&& Z_LVAL(generator->key) > generator->largest_used_integer_key
@@ -30395,8 +29030,8 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CHECK_FUNC_ARG_SPE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *obj;
+ zend_object *zobj;
zend_class_entry *ce, *scope;
zend_function *clone;
zend_object_clone_obj_t clone_call;
@@ -30404,10 +29039,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_UNUSED_HANDLER(ZEND
SAVE_OPLINE();
obj = &EX(This);
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(obj) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
do {
if (IS_UNUSED == IS_CONST ||
(IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(obj) != IS_OBJECT))) {
@@ -30430,9 +29061,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_UNUSED_HANDLER(ZEND
}
} while (0);
- ce = Z_OBJCE_P(obj);
+ zobj = Z_OBJ_P(obj);
+ ce = zobj->ce;
clone = ce->clone;
- clone_call = Z_OBJ_HT_P(obj)->clone_obj;
+ clone_call = zobj->handlers->clone_obj;
if (UNEXPECTED(clone_call == NULL)) {
zend_throw_error(NULL, "Trying to clone an uncloneable object of class %s", ZSTR_VAL(ce->name));
@@ -30453,7 +29085,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_UNUSED_HANDLER(ZEND
}
}
- ZVAL_OBJ(EX_VAR(opline->result.var), clone_call(obj));
+ ZVAL_OBJ(EX_VAR(opline->result.var), clone_call(zobj));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -30464,8 +29096,26 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_NAME_SPEC_UNUSED_H
zend_class_entry *called_scope, *scope;
USE_OPLINE
- fetch_type = opline->op1.num;
+ if (IS_UNUSED != IS_UNUSED) {
+ zval *op = NULL;
+ SAVE_OPLINE();
+ if (UNEXPECTED(Z_TYPE_P(op) != IS_OBJECT)) {
+ ZVAL_DEREF(op);
+ if (Z_TYPE_P(op) != IS_OBJECT) {
+ zend_type_error("Cannot use ::class on value of type %s",
+ zend_get_type_by_const(Z_TYPE_P(op)));
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+
+ HANDLE_EXCEPTION();
+ }
+ }
+
+ ZVAL_STR_COPY(EX_VAR(opline->result.var), Z_OBJCE_P(op)->name);
+
+ ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
+ }
+ fetch_type = opline->op1.num;
scope = EX(func)->op_array.scope;
if (UNEXPECTED(scope == NULL)) {
SAVE_OPLINE();
@@ -30506,25 +29156,21 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_NAME_SPEC_UNUSED_H
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data;
zval *object;
zval *property;
zval *value;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = &EX(This);
-
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = RT_CONSTANT(opline, opline->op2);
do {
- value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data);
+ value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1);
if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
@@ -30535,16 +29181,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_UNUSED_CONS
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
assign_op_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ UNDEF_RESULT();
+ break;
+ }
+ }
cache_slot = (IS_CONST == IS_CONST) ? CACHE_ADDR((opline+1)->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -30581,11 +29235,14 @@ assign_op_object:
}
}
} else {
- zend_assign_op_overloaded_property(object, property, cache_slot, value OPLINE_CC EXECUTE_DATA_CC);
+ zend_assign_op_overloaded_property(zobj, name, cache_slot, value OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
- FREE_OP(free_op_data);
+ FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
/* assign_obj has two opcodes! */
@@ -30596,20 +29253,16 @@ assign_op_object:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object;
zval *property;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = &EX(This);
-
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = RT_CONSTANT(opline, opline->op2);
do {
@@ -30622,16 +29275,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_UNUSED_CONST_
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
pre_incdec_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ UNDEF_RESULT();
+ break;
+ }
+ }
cache_slot = (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -30645,7 +29306,10 @@ pre_incdec_object:
zend_pre_incdec_property_zval(zptr, prop_info OPLINE_CC EXECUTE_DATA_CC);
}
} else {
- zend_pre_incdec_overloaded_property(object, property, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ zend_pre_incdec_overloaded_property(zobj, name, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
@@ -30656,20 +29320,16 @@ pre_incdec_object:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object;
zval *property;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = &EX(This);
-
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = RT_CONSTANT(opline, opline->op2);
do {
@@ -30682,16 +29342,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_UNUSED_CONST
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
post_incdec_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
+ }
cache_slot = (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
ZVAL_NULL(EX_VAR(opline->result.var));
} else {
@@ -30704,7 +29372,10 @@ post_incdec_object:
zend_post_incdec_property_zval(zptr, prop_info OPLINE_CC EXECUTE_DATA_CC);
}
} else {
- zend_post_incdec_overloaded_property(object, property, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ zend_post_incdec_overloaded_property(zobj, name, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
@@ -30715,19 +29386,12 @@ post_incdec_object:
static zend_always_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_UNUSED_CONST_INLINE_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
-
zval *offset;
void **cache_slot = NULL;
SAVE_OPLINE();
container = &EX(This);
-
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
offset = RT_CONSTANT(opline, opline->op2);
if (IS_UNUSED == IS_CONST ||
@@ -30754,9 +29418,11 @@ static zend_always_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value & ~ZEND_FETCH_REF /* FUNC_ARG fetch may contain it */);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -30781,10 +29447,10 @@ fetch_obj_r_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || (IS_UNUSED & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_r_copy;
@@ -30795,7 +29461,7 @@ fetch_obj_r_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -30807,11 +29473,22 @@ fetch_obj_r_fast_copy:
}
}
}
- } else if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
- ZVAL_UNDEFINED_OP2();
+ } else {
+ if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
+ ZVAL_UNDEFINED_OP2();
+ }
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_r_copy:
@@ -30835,16 +29512,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_UNUSED_CONST_
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *property, *container, *result;
SAVE_OPLINE();
container = &EX(This);
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = RT_CONSTANT(opline, opline->op2);
result = EX_VAR(opline->result.var);
zend_fetch_property_address(
@@ -30853,7 +29525,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_CONST_
BP_VAR_W, opline->extended_value & ZEND_FETCH_OBJ_FLAGS, 1 OPLINE_CC EXECUTE_DATA_CC);
if (IS_UNUSED == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -30861,21 +29533,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_CONST_
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *property, *container, *result;
SAVE_OPLINE();
container = &EX(This);
-
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
property = RT_CONSTANT(opline, opline->op2);
result = EX_VAR(opline->result.var);
zend_fetch_property_address(result, container, IS_UNUSED, property, IS_CONST, ((IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL), BP_VAR_RW, 0, 1 OPLINE_CC EXECUTE_DATA_CC);
if (IS_UNUSED == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -30883,19 +29550,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_UNUSED_CONST
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
-
zval *offset;
void **cache_slot = NULL;
SAVE_OPLINE();
container = &EX(This);
-
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
offset = RT_CONSTANT(opline, opline->op2);
if (IS_UNUSED == IS_CONST ||
@@ -30915,9 +29575,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_CONST
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -30942,10 +29604,10 @@ fetch_obj_is_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || (IS_UNUSED & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_is_copy;
@@ -30956,7 +29618,7 @@ fetch_obj_is_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -30968,9 +29630,19 @@ fetch_obj_is_fast_copy:
}
}
}
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_is_copy:
@@ -31006,22 +29678,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_UNUSED
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container, *property, *result;
SAVE_OPLINE();
container = &EX(This);
-
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = RT_CONSTANT(opline, opline->op2);
result = EX_VAR(opline->result.var);
zend_fetch_property_address(result, container, IS_UNUSED, property, IS_CONST, ((IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL), BP_VAR_UNSET, 0, 1 OPLINE_CC EXECUTE_DATA_CC);
if (IS_UNUSED == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -31029,16 +29695,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_CO
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CONST_OP_DATA_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = &EX(This);
-
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = RT_CONSTANT(opline, opline->op2);
value = RT_CONSTANT((opline+1), (opline+1)->op1);
@@ -31047,16 +29709,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CONST_O
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CONST == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -31146,11 +29807,26 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ ZVAL_COPY_DEREF(EX_VAR(opline->result.var), value);
}
exit_assign_obj:
@@ -31164,34 +29840,29 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CONST_OP_DATA_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = &EX(This);
-
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = RT_CONSTANT(opline, opline->op2);
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CONST == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -31281,13 +29952,28 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ ZVAL_COPY_DEREF(EX_VAR(opline->result.var), value);
}
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
exit_assign_obj:
@@ -31299,34 +29985,29 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CONST_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = &EX(This);
-
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = RT_CONSTANT(opline, opline->op2);
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CONST == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -31416,13 +30097,28 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ ZVAL_COPY_DEREF(EX_VAR(opline->result.var), value);
}
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
exit_assign_obj:
@@ -31434,16 +30130,12 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CONST_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = &EX(This);
-
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = RT_CONSTANT(opline, opline->op2);
value = _get_zval_ptr_cv_BP_VAR_R((opline+1)->op1.var EXECUTE_DATA_CC);
@@ -31452,16 +30144,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CONST_O
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CONST == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -31551,11 +30242,26 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ ZVAL_COPY_DEREF(EX_VAR(opline->result.var), value);
}
exit_assign_obj:
@@ -31569,20 +30275,14 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_UNUSED_CONST_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data;
zval *property, *container, *value_ptr;
SAVE_OPLINE();
container = &EX(This);
-
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = RT_CONSTANT(opline, opline->op2);
- value_ptr = _get_zval_ptr_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value_ptr = _get_zval_ptr_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (1) {
if (IS_UNUSED == IS_UNUSED) {
@@ -31603,7 +30303,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_UNUSED_CON
}
- if (UNEXPECTED(free_op_data)) {zval_ptr_dtor_nogc(free_op_data);};
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));;
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -31611,17 +30311,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_UNUSED_CON
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_UNUSED_CONST_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *property, *container, *value_ptr;
SAVE_OPLINE();
container = &EX(This);
-
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = RT_CONSTANT(opline, opline->op2);
value_ptr = _get_zval_ptr_cv_BP_VAR_W((opline+1)->op1.var EXECUTE_DATA_CC);
@@ -31653,7 +30347,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_UNUSED_CON
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_INIT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zend_string **rope;
zval *var;
@@ -31688,7 +30381,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_INIT_SPEC_UNUSED_CONST_HA
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
-
zval *class_name;
USE_OPLINE
@@ -31733,7 +30425,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_S
{
USE_OPLINE
zval *function_name;
- zend_free_op free_op1;
zval *object;
zend_function *fbc;
zend_class_entry *called_scope;
@@ -31745,10 +30436,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_S
object = &EX(This);
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
if (IS_CONST != IS_CONST) {
function_name = RT_CONSTANT(opline, opline->op2);
}
@@ -31828,7 +30515,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_S
HANDLE_EXCEPTION();
}
if (IS_CONST == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE))) &&
EXPECTED(obj == orig_obj)) {
CACHE_POLYMORPHIC_PTR(opline->result.num, called_scope, fbc);
@@ -31858,9 +30544,12 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_S
} else if (IS_UNUSED & (IS_VAR|IS_TMP_VAR|IS_CV)) {
if (IS_UNUSED == IS_CV) {
GC_ADDREF(obj); /* For $this pointer */
- } else if (free_op1 != object) {
- GC_ADDREF(obj); /* For $this pointer */
-
+ } else {
+ zval *free_op1 = EX_VAR(opline->op1.var);
+ if (free_op1 != object) {
+ GC_ADDREF(obj); /* For $this pointer */
+ zval_ptr_dtor_nogc(free_op1);
+ }
}
/* CV may be changed indirectly (e.g. when it's a reference) */
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS | ZEND_CALL_RELEASE_THIS;
@@ -31919,8 +30608,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_U
EXPECTED(CACHED_PTR(opline->result.num) == ce)) {
fbc = CACHED_PTR(opline->result.num + sizeof(void*));
} else if (IS_CONST != IS_UNUSED) {
-
-
function_name = RT_CONSTANT(opline, opline->op2);
if (IS_CONST != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
@@ -31936,7 +30623,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_U
HANDLE_EXCEPTION();
}
}
- zend_throw_error(NULL, "Function name must be a string");
+ zend_throw_error(NULL, "Method name must be a string");
HANDLE_EXCEPTION();
} while (0);
@@ -31956,7 +30643,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_U
HANDLE_EXCEPTION();
}
if (IS_CONST == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE)))) {
CACHE_POLYMORPHIC_PTR(opline->result.num, ce, fbc);
}
@@ -31987,13 +30673,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_U
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS;
} else {
zend_non_static_method_call(fbc);
- if (UNEXPECTED(EG(exception) != NULL)) {
- HANDLE_EXCEPTION();
- }
- goto check_parent_and_self;
+ HANDLE_EXCEPTION();
}
} else {
-check_parent_and_self:
/* previous opcode is ZEND_FETCH_CLASS */
if (IS_UNUSED == IS_UNUSED
&& ((opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_PARENT ||
@@ -32091,7 +30773,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_CONSTANT_SPEC_UNUS
}
CACHE_POLYMORPHIC_PTR(opline->extended_value, ce, value);
} else {
- zend_throw_error(NULL, "Undefined class constant '%s'", Z_STRVAL_P(RT_CONSTANT(opline, opline->op2)));
+ zend_throw_error(NULL, "Undefined class constant '%s::%s'",
+ ZSTR_VAL(ce->name), Z_STRVAL_P(RT_CONSTANT(opline, opline->op2)));
ZVAL_UNDEF(EX_VAR(opline->result.var));
HANDLE_EXCEPTION();
}
@@ -32126,15 +30809,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_UNUSED_CONST_H
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
container = &EX(This);
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
offset = RT_CONSTANT(opline, opline->op2);
do {
@@ -32152,7 +30832,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_UNUSED_CONST_HA
break;
}
}
- Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL));
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ break;
+ }
+ }
+ Z_OBJ_HT_P(container)->unset_property(Z_OBJ_P(container), name, ((IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL));
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
} while (0);
@@ -32162,18 +30853,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_UNUSED_CONST_HA
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
int result;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
container = &EX(This);
-
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
offset = RT_CONSTANT(opline, opline->op2);
if (IS_UNUSED == IS_CONST ||
@@ -32190,16 +30876,28 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UN
}
}
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ result = 0;
+ goto isset_object_finish;
+ }
+ }
+
result =
(opline->extended_value & ZEND_ISEMPTY) ^
- Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY), ((IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+ Z_OBJ_HT_P(container)->has_property(Z_OBJ_P(container), name, (opline->extended_value & ZEND_ISEMPTY), ((IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
isset_object_finish:
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -32221,8 +30919,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CONST_HANDLE
/* Set the new yielded value */
if (IS_UNUSED != IS_UNUSED) {
-
-
if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
/* Constants and temporary variables aren't yieldable by reference,
* but we still allow them with a notice. */
@@ -32290,26 +30986,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CONST_HANDLE
/* Set the new yielded key */
if (IS_CONST != IS_UNUSED) {
-
zval *key = RT_CONSTANT(opline, opline->op2);
-
- /* Consts, temporary variables and references need copying */
- if (IS_CONST == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_CONST == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_CONST & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
-
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_CONST == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
+ if ((IS_CONST & (IS_CV|IS_VAR)) && UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE) {
+ key = Z_REFVAL_P(key);
}
+ ZVAL_COPY(&generator->key, key);
if (Z_TYPE(generator->key) == IS_LONG
&& Z_LVAL(generator->key) > generator->largest_used_integer_key
@@ -32345,25 +31026,21 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CONST_HANDLE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_UNUSED_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2, free_op_data;
zval *object;
zval *property;
zval *value;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = &EX(This);
-
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
do {
- value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data);
+ value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1);
if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
@@ -32374,16 +31051,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_UNUSED_TMPV
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
assign_op_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ UNDEF_RESULT();
+ break;
+ }
+ }
cache_slot = ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR((opline+1)->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -32420,12 +31105,15 @@ assign_op_object:
}
}
} else {
- zend_assign_op_overloaded_property(object, property, cache_slot, value OPLINE_CC EXECUTE_DATA_CC);
+ zend_assign_op_overloaded_property(zobj, name, cache_slot, value OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
- FREE_OP(free_op_data);
- zval_ptr_dtor_nogc(free_op2);
+ FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
@@ -32435,21 +31123,17 @@ assign_op_object:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_UNUSED_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *object;
zval *property;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = &EX(This);
-
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
do {
if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
@@ -32461,16 +31145,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_UNUSED_TMPVAR
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
pre_incdec_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ UNDEF_RESULT();
+ break;
+ }
+ }
cache_slot = ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -32484,11 +31176,14 @@ pre_incdec_object:
zend_pre_incdec_property_zval(zptr, prop_info OPLINE_CC EXECUTE_DATA_CC);
}
} else {
- zend_pre_incdec_overloaded_property(object, property, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ zend_pre_incdec_overloaded_property(zobj, name, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -32496,21 +31191,17 @@ pre_incdec_object:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_UNUSED_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *object;
zval *property;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = &EX(This);
-
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
do {
if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
@@ -32522,16 +31213,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_UNUSED_TMPVA
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
post_incdec_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
+ }
cache_slot = ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
ZVAL_NULL(EX_VAR(opline->result.var));
} else {
@@ -32544,11 +31243,14 @@ post_incdec_object:
zend_post_incdec_property_zval(zptr, prop_info OPLINE_CC EXECUTE_DATA_CC);
}
} else {
- zend_post_incdec_overloaded_property(object, property, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ zend_post_incdec_overloaded_property(zobj, name, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -32556,20 +31258,13 @@ post_incdec_object:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_UNUSED_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
- zend_free_op free_op2;
zval *offset;
void **cache_slot = NULL;
SAVE_OPLINE();
container = &EX(This);
-
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (IS_UNUSED == IS_CONST ||
(IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT))) {
@@ -32595,9 +31290,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_UNUSED_TMPVAR
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value & ~ZEND_FETCH_REF /* FUNC_ARG fetch may contain it */);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -32622,10 +31319,10 @@ fetch_obj_r_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || (IS_UNUSED & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_r_copy;
@@ -32636,7 +31333,7 @@ fetch_obj_r_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -32648,11 +31345,22 @@ fetch_obj_r_fast_copy:
}
}
}
- } else if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
- ZVAL_UNDEFINED_OP2();
+ } else {
+ if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
+ ZVAL_UNDEFINED_OP2();
+ }
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_r_copy:
@@ -32663,7 +31371,7 @@ fetch_obj_r_copy:
} while (0);
fetch_obj_r_finish:
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -32671,25 +31379,20 @@ fetch_obj_r_finish:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *property, *container, *result;
SAVE_OPLINE();
container = &EX(This);
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
result = EX_VAR(opline->result.var);
zend_fetch_property_address(
result, container, IS_UNUSED, property, (IS_TMP_VAR|IS_VAR),
(((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_FETCH_OBJ_FLAGS) : NULL),
BP_VAR_W, opline->extended_value & ZEND_FETCH_OBJ_FLAGS, 1 OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (IS_UNUSED == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -32697,21 +31400,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_TMPVAR
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_UNUSED_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *property, *container, *result;
SAVE_OPLINE();
container = &EX(This);
-
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
result = EX_VAR(opline->result.var);
zend_fetch_property_address(result, container, IS_UNUSED, property, (IS_TMP_VAR|IS_VAR), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL), BP_VAR_RW, 0, 1 OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (IS_UNUSED == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -32719,20 +31417,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_UNUSED_TMPVA
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
- zend_free_op free_op2;
zval *offset;
void **cache_slot = NULL;
SAVE_OPLINE();
container = &EX(This);
-
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (IS_UNUSED == IS_CONST ||
(IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT))) {
@@ -32751,9 +31442,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_TMPVA
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -32778,10 +31471,10 @@ fetch_obj_is_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || (IS_UNUSED & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_is_copy;
@@ -32792,7 +31485,7 @@ fetch_obj_is_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -32804,9 +31497,19 @@ fetch_obj_is_fast_copy:
}
}
}
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_is_copy:
@@ -32817,7 +31520,7 @@ fetch_obj_is_copy:
} while (0);
fetch_obj_is_finish:
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -32842,22 +31545,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_UNUSED
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container, *property, *result;
SAVE_OPLINE();
container = &EX(This);
-
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
result = EX_VAR(opline->result.var);
zend_fetch_property_address(result, container, IS_UNUSED, property, (IS_TMP_VAR|IS_VAR), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL), BP_VAR_UNSET, 0, 1 OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (IS_UNUSED == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -32865,17 +31562,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_TM
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_TMPVAR_OP_DATA_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = &EX(This);
-
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
value = RT_CONSTANT((opline+1), (opline+1)->op1);
if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
@@ -32883,16 +31576,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_TMPVAR_
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -32982,15 +31674,30 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ ZVAL_COPY_DEREF(EX_VAR(opline->result.var), value);
}
exit_assign_obj:
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
@@ -33000,34 +31707,29 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_TMPVAR_OP_DATA_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2, free_op_data;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = &EX(This);
-
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -33117,15 +31819,30 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ ZVAL_COPY_DEREF(EX_VAR(opline->result.var), value);
}
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
exit_assign_obj:
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
@@ -33135,34 +31852,29 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_TMPVAR_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2, free_op_data;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = &EX(This);
-
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -33252,15 +31964,30 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ ZVAL_COPY_DEREF(EX_VAR(opline->result.var), value);
}
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
exit_assign_obj:
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
@@ -33270,17 +31997,13 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_TMPVAR_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = &EX(This);
-
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
value = _get_zval_ptr_cv_BP_VAR_R((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
@@ -33288,16 +32011,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_TMPVAR_
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -33387,15 +32109,30 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ ZVAL_COPY_DEREF(EX_VAR(opline->result.var), value);
}
exit_assign_obj:
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
@@ -33405,20 +32142,14 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_UNUSED_TMPVAR_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2, free_op_data;
zval *property, *container, *value_ptr;
SAVE_OPLINE();
container = &EX(This);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
-
- value_ptr = _get_zval_ptr_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value_ptr = _get_zval_ptr_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (1) {
if (IS_UNUSED == IS_UNUSED) {
@@ -33438,8 +32169,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_UNUSED_TMP
zend_assign_to_property_reference(container, IS_UNUSED, property, (IS_TMP_VAR|IS_VAR), value_ptr OPLINE_CC EXECUTE_DATA_CC);
}
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(free_op_data)) {zval_ptr_dtor_nogc(free_op_data);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));;
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -33447,18 +32178,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_UNUSED_TMP
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_UNUSED_TMPVAR_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *property, *container, *value_ptr;
SAVE_OPLINE();
container = &EX(This);
-
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
value_ptr = _get_zval_ptr_cv_BP_VAR_W((opline+1)->op1.var EXECUTE_DATA_CC);
@@ -33480,7 +32205,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_UNUSED_TMP
zend_assign_to_property_reference(container, IS_UNUSED, property, (IS_TMP_VAR|IS_VAR), value_ptr OPLINE_CC EXECUTE_DATA_CC);
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -33489,20 +32214,19 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_UNUSED_TMP
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_INIT_SPEC_UNUSED_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zend_string **rope;
zval *var;
/* Compiler allocates the necessary number of zval slots to keep the rope */
rope = (zend_string**)EX_VAR(opline->result.var);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
- var = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ var = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
rope[0] = Z_STR_P(var);
if (UNEXPECTED(Z_REFCOUNTED_P(var))) {
Z_ADDREF_P(var);
}
} else {
- var = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ var = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(var) == IS_STRING)) {
if ((IS_TMP_VAR|IS_VAR) == IS_CV) {
rope[0] = zend_string_copy(Z_STR_P(var));
@@ -33515,7 +32239,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_INIT_SPEC_UNUSED_TMPVAR_H
ZVAL_UNDEFINED_OP2();
}
rope[0] = zval_get_string_func(var);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
}
@@ -33524,7 +32248,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_INIT_SPEC_UNUSED_TMPVAR_H
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_UNUSED_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
- zend_free_op free_op2;
zval *class_name;
USE_OPLINE
@@ -33536,13 +32259,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_UNUSED_TMPVAR
zend_class_entry *ce = CACHED_PTR(opline->extended_value);
if (UNEXPECTED(ce == NULL)) {
- class_name = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ class_name = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
ce = zend_fetch_class_by_name(Z_STR_P(class_name), Z_STR_P(class_name + 1), opline->op1.num);
CACHE_PTR(opline->extended_value, ce);
}
Z_CE_P(EX_VAR(opline->result.var)) = ce;
} else {
- class_name = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ class_name = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
try_class_name:
if (Z_TYPE_P(class_name) == IS_OBJECT) {
Z_CE_P(EX_VAR(opline->result.var)) = Z_OBJCE_P(class_name);
@@ -33562,7 +32285,7 @@ try_class_name:
}
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -33570,7 +32293,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_T
{
USE_OPLINE
zval *function_name;
- zend_free_op free_op1, free_op2;
zval *object;
zend_function *fbc;
zend_class_entry *called_scope;
@@ -33582,12 +32304,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_T
object = &EX(This);
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
- function_name = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ function_name = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
}
if ((IS_TMP_VAR|IS_VAR) != IS_CONST &&
@@ -33606,7 +32324,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_T
}
}
zend_throw_error(NULL, "Method name must be a string");
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
HANDLE_EXCEPTION();
} while (0);
@@ -33625,16 +32343,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_T
object = ZVAL_UNDEFINED_OP1();
if (UNEXPECTED(EG(exception) != NULL)) {
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
}
HANDLE_EXCEPTION();
}
}
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
- function_name = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ function_name = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
}
zend_invalid_method_call(object, function_name);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
HANDLE_EXCEPTION();
}
@@ -33651,7 +32369,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_T
zend_object *orig_obj = obj;
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
- function_name = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ function_name = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
}
/* First, locate the function. */
@@ -33660,12 +32378,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_T
if (EXPECTED(!EG(exception))) {
zend_undefined_method(obj->ce, Z_STR_P(function_name));
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
HANDLE_EXCEPTION();
}
if ((IS_TMP_VAR|IS_VAR) == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE))) &&
EXPECTED(obj == orig_obj)) {
CACHE_POLYMORPHIC_PTR(opline->result.num, called_scope, fbc);
@@ -33680,7 +32397,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_T
}
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
}
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS;
@@ -33695,9 +32412,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_T
} else if (IS_UNUSED & (IS_VAR|IS_TMP_VAR|IS_CV)) {
if (IS_UNUSED == IS_CV) {
GC_ADDREF(obj); /* For $this pointer */
- } else if (free_op1 != object) {
- GC_ADDREF(obj); /* For $this pointer */
-
+ } else {
+ zval *free_op1 = EX_VAR(opline->op1.var);
+ if (free_op1 != object) {
+ GC_ADDREF(obj); /* For $this pointer */
+ zval_ptr_dtor_nogc(free_op1);
+ }
}
/* CV may be changed indirectly (e.g. when it's a reference) */
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS | ZEND_CALL_RELEASE_THIS;
@@ -33756,9 +32476,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_U
EXPECTED(CACHED_PTR(opline->result.num) == ce)) {
fbc = CACHED_PTR(opline->result.num + sizeof(void*));
} else if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED) {
- zend_free_op free_op2;
-
- function_name = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ function_name = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
do {
@@ -33773,8 +32491,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_U
HANDLE_EXCEPTION();
}
}
- zend_throw_error(NULL, "Function name must be a string");
- zval_ptr_dtor_nogc(free_op2);
+ zend_throw_error(NULL, "Method name must be a string");
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
HANDLE_EXCEPTION();
} while (0);
}
@@ -33789,11 +32507,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_U
if (EXPECTED(!EG(exception))) {
zend_undefined_method(ce, Z_STR_P(function_name));
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
HANDLE_EXCEPTION();
}
if ((IS_TMP_VAR|IS_VAR) == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE)))) {
CACHE_POLYMORPHIC_PTR(opline->result.num, ce, fbc);
}
@@ -33801,7 +32518,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_U
init_func_run_time_cache(&fbc->op_array);
}
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
}
} else {
if (UNEXPECTED(ce->constructor == NULL)) {
@@ -33824,13 +32541,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_U
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS;
} else {
zend_non_static_method_call(fbc);
- if (UNEXPECTED(EG(exception) != NULL)) {
- HANDLE_EXCEPTION();
- }
- goto check_parent_and_self;
+ HANDLE_EXCEPTION();
}
} else {
-check_parent_and_self:
/* previous opcode is ZEND_FETCH_CLASS */
if (IS_UNUSED == IS_UNUSED
&& ((opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_PARENT ||
@@ -33876,16 +32589,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_UNUSED_TMPVAR_
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_UNUSED_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *container;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
container = &EX(This);
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
- offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
do {
if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) {
@@ -33902,10 +32612,21 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_UNUSED_TMPVAR_H
break;
}
}
- Z_OBJ_HT_P(container)->unset_property(container, offset, (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL));
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ break;
+ }
+ }
+ Z_OBJ_HT_P(container)->unset_property(Z_OBJ_P(container), name, (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL));
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
} while (0);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -33913,19 +32634,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_UNUSED_TMPVAR_H
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UNUSED_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *container;
int result;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
container = &EX(This);
-
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (IS_UNUSED == IS_CONST ||
(IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT))) {
@@ -33941,159 +32657,31 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UN
}
}
- result =
- (opline->extended_value & ZEND_ISEMPTY) ^
- Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
-
-isset_object_finish:
- zval_ptr_dtor_nogc(free_op2);
-
- ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
-}
-
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
-
- zend_generator *generator = zend_get_running_generator(EXECUTE_DATA_C);
-
- SAVE_OPLINE();
- if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
- ZEND_VM_TAIL_CALL(zend_yield_in_closed_generator_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- /* Destroy the previously yielded value */
- zval_ptr_dtor(&generator->value);
-
- /* Destroy the previously yielded key */
- zval_ptr_dtor(&generator->key);
-
- /* Set the new yielded value */
- if (IS_UNUSED != IS_UNUSED) {
-
-
- if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
- /* Constants and temporary variables aren't yieldable by reference,
- * but we still allow them with a notice. */
- if (IS_UNUSED & (IS_CONST|IS_TMP_VAR)) {
- zval *value;
-
- zend_error(E_NOTICE, "Only variable references should be yielded by reference");
-
- value = NULL;
- ZVAL_COPY_VALUE(&generator->value, value);
- if (IS_UNUSED == IS_CONST) {
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->value))) {
- Z_ADDREF(generator->value);
- }
- }
- } else {
- zval *value_ptr = NULL;
-
- /* If a function call result is yielded and the function did
- * not return by reference we throw a notice. */
- do {
- if (IS_UNUSED == IS_VAR) {
- ZEND_ASSERT(value_ptr != &EG(uninitialized_zval));
- if (opline->extended_value == ZEND_RETURNS_FUNCTION
- && !Z_ISREF_P(value_ptr)) {
- zend_error(E_NOTICE, "Only variable references should be yielded by reference");
- ZVAL_COPY(&generator->value, value_ptr);
- break;
- }
- }
- if (Z_ISREF_P(value_ptr)) {
- Z_ADDREF_P(value_ptr);
- } else {
- ZVAL_MAKE_REF_EX(value_ptr, 2);
- }
- ZVAL_REF(&generator->value, Z_REF_P(value_ptr));
- } while (0);
-
- }
- } else {
- zval *value = NULL;
-
- /* Consts, temporary variables and references need copying */
- if (IS_UNUSED == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->value, value);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->value))) {
- Z_ADDREF(generator->value);
- }
- } else if (IS_UNUSED == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->value, value);
- } else if ((IS_UNUSED & (IS_VAR|IS_CV)) && Z_ISREF_P(value)) {
- ZVAL_COPY(&generator->value, Z_REFVAL_P(value));
-
- } else {
- ZVAL_COPY_VALUE(&generator->value, value);
- if (IS_UNUSED == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
- }
- }
- }
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(offset);
} else {
- /* If no value was specified yield null */
- ZVAL_NULL(&generator->value);
- }
-
- /* Set the new yielded key */
- if (IS_TMP_VAR != IS_UNUSED) {
- zend_free_op free_op2;
- zval *key = _get_zval_ptr_tmp(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
-
- /* Consts, temporary variables and references need copying */
- if (IS_TMP_VAR == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_TMP_VAR == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_TMP_VAR & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
-
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_TMP_VAR == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
- }
-
- if (Z_TYPE(generator->key) == IS_LONG
- && Z_LVAL(generator->key) > generator->largest_used_integer_key
- ) {
- generator->largest_used_integer_key = Z_LVAL(generator->key);
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ result = 0;
+ goto isset_object_finish;
}
- } else {
- /* If no key was specified we use auto-increment keys */
- generator->largest_used_integer_key++;
- ZVAL_LONG(&generator->key, generator->largest_used_integer_key);
}
- if (RETURN_VALUE_USED(opline)) {
- /* If the return value of yield is used set the send
- * target and initialize it to NULL */
- generator->send_target = EX_VAR(opline->result.var);
- ZVAL_NULL(generator->send_target);
- } else {
- generator->send_target = NULL;
- }
+ result =
+ (opline->extended_value & ZEND_ISEMPTY) ^
+ Z_OBJ_HT_P(container)->has_property(Z_OBJ_P(container), name, (opline->extended_value & ZEND_ISEMPTY), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
- /* We increment to the next op, so we are at the correct position when the
- * generator is resumed. */
- ZEND_VM_INC_OPCODE();
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
- /* The GOTO VM uses a local opline variable. We need to set the opline
- * variable in execute_data so we don't resume at an old position. */
- SAVE_OPLINE();
+isset_object_finish:
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
- ZEND_VM_RETURN();
+ ZEND_VM_SMART_BRANCH(result, 1);
}
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -34112,8 +32700,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_VAR_HANDLER(
/* Set the new yielded value */
if (IS_UNUSED != IS_UNUSED) {
-
-
if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
/* Constants and temporary variables aren't yieldable by reference,
* but we still allow them with a notice. */
@@ -34180,27 +32766,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_VAR_HANDLER(
}
/* Set the new yielded key */
- if (IS_VAR != IS_UNUSED) {
- zend_free_op free_op2;
- zval *key = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
-
- /* Consts, temporary variables and references need copying */
- if (IS_VAR == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_VAR == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_VAR & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
- zval_ptr_dtor_nogc(free_op2);
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_VAR == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
+ if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED) {
+ zval *key = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ if (((IS_TMP_VAR|IS_VAR) & (IS_CV|IS_VAR)) && UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE) {
+ key = Z_REFVAL_P(key);
}
+ ZVAL_COPY(&generator->key, key);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (Z_TYPE(generator->key) == IS_LONG
&& Z_LVAL(generator->key) > generator->largest_used_integer_key
@@ -34235,7 +32807,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_VAR_HANDLER(
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
-
zval *class_name;
USE_OPLINE
@@ -34321,8 +32892,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_U
EXPECTED(CACHED_PTR(opline->result.num) == ce)) {
fbc = CACHED_PTR(opline->result.num + sizeof(void*));
} else if (IS_UNUSED != IS_UNUSED) {
-
-
function_name = NULL;
if (IS_UNUSED != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
@@ -34338,7 +32907,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_U
HANDLE_EXCEPTION();
}
}
- zend_throw_error(NULL, "Function name must be a string");
+ zend_throw_error(NULL, "Method name must be a string");
HANDLE_EXCEPTION();
} while (0);
@@ -34358,7 +32927,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_U
HANDLE_EXCEPTION();
}
if (IS_UNUSED == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE)))) {
CACHE_POLYMORPHIC_PTR(opline->result.num, ce, fbc);
}
@@ -34389,13 +32957,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_U
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS;
} else {
zend_non_static_method_call(fbc);
- if (UNEXPECTED(EG(exception) != NULL)) {
- HANDLE_EXCEPTION();
- }
- goto check_parent_and_self;
+ HANDLE_EXCEPTION();
}
} else {
-check_parent_and_self:
/* previous opcode is ZEND_FETCH_CLASS */
if (IS_UNUSED == IS_UNUSED
&& ((opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_PARENT ||
@@ -34421,16 +32985,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_VERIFY_RETURN_TYPE_SPEC_UNUSED
{
USE_OPLINE
- SAVE_OPLINE();
if (IS_UNUSED == IS_UNUSED) {
+ SAVE_OPLINE();
zend_verify_missing_return_type(EX(func), CACHE_ADDR(opline->op2.num));
+ HANDLE_EXCEPTION();
} else {
/* prevents "undefined variable opline" errors */
#if 0 || (IS_UNUSED != IS_UNUSED)
zval *retval_ref, *retval_ptr;
-
zend_arg_info *ret_info = EX(func)->common.arg_info - 1;
-
retval_ref = retval_ptr = NULL;
if (IS_UNUSED == IS_CONST) {
@@ -34445,26 +33008,35 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_VERIFY_RETURN_TYPE_SPEC_UNUSED
ZVAL_DEREF(retval_ptr);
}
- if (UNEXPECTED(!ZEND_TYPE_IS_CLASS(ret_info->type)
- && ZEND_TYPE_CODE(ret_info->type) != IS_CALLABLE
- && ZEND_TYPE_CODE(ret_info->type) != IS_ITERABLE
- && !ZEND_SAME_FAKE_TYPE(ZEND_TYPE_CODE(ret_info->type), Z_TYPE_P(retval_ptr))
- && !(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)
- && retval_ref != retval_ptr)
- ) {
- /* A cast might happen - unwrap the reference if this is a by-value return */
- if (Z_REFCOUNT_P(retval_ref) == 1) {
- ZVAL_UNREF(retval_ref);
+ if (EXPECTED(ZEND_TYPE_CONTAINS_CODE(ret_info->type, Z_TYPE_P(retval_ptr)))) {
+ ZEND_VM_NEXT_OPCODE();
+ }
+
+ zend_reference *ref = NULL;
+ void *cache_slot = CACHE_ADDR(opline->op2.num);
+ if (UNEXPECTED(retval_ref != retval_ptr)) {
+ if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
+ ref = Z_REF_P(retval_ref);
} else {
- Z_DELREF_P(retval_ref);
- ZVAL_COPY(retval_ref, retval_ptr);
+ /* A cast might happen - unwrap the reference if this is a by-value return */
+ if (Z_REFCOUNT_P(retval_ref) == 1) {
+ ZVAL_UNREF(retval_ref);
+ } else {
+ Z_DELREF_P(retval_ref);
+ ZVAL_COPY(retval_ref, retval_ptr);
+ }
+ retval_ptr = retval_ref;
}
- retval_ptr = retval_ref;
}
- zend_verify_return_type(EX(func), retval_ptr, CACHE_ADDR(opline->op2.num));
+
+ SAVE_OPLINE();
+ if (UNEXPECTED(!zend_check_type_slow(ret_info->type, retval_ptr, ref, cache_slot, NULL, 1, 0))) {
+ zend_verify_return_error(EX(func), cache_slot, retval_ptr);
+ HANDLE_EXCEPTION();
+ }
+ ZEND_VM_NEXT_OPCODE();
#endif
}
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_NEW_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -34578,8 +33150,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_UNUSED_HANDL
/* Set the new yielded value */
if (IS_UNUSED != IS_UNUSED) {
-
-
if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
/* Constants and temporary variables aren't yieldable by reference,
* but we still allow them with a notice. */
@@ -34647,26 +33217,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_UNUSED_HANDL
/* Set the new yielded key */
if (IS_UNUSED != IS_UNUSED) {
-
zval *key = NULL;
-
- /* Consts, temporary variables and references need copying */
- if (IS_UNUSED == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_UNUSED == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_UNUSED & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
-
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_UNUSED == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
+ if ((IS_UNUSED & (IS_CV|IS_VAR)) && UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE) {
+ key = Z_REFVAL_P(key);
}
+ ZVAL_COPY(&generator->key, key);
if (Z_TYPE(generator->key) == IS_LONG
&& Z_LVAL(generator->key) > generator->largest_used_integer_key
@@ -34699,7 +33254,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_UNUSED_HANDL
ZEND_VM_RETURN();
}
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_THIS_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_THIS_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -34739,7 +33294,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GET_CLASS_SPEC_UNUSED_UNUSED_H
ZEND_VM_NEXT_OPCODE();
}
} else {
-
zval *op1;
SAVE_OPLINE();
@@ -34754,8 +33308,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GET_CLASS_SPEC_UNUSED_UNUSED_H
if (IS_UNUSED == IS_CV && UNEXPECTED(Z_TYPE_P(op1) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- zend_error(E_WARNING, "get_class() expects parameter 1 to be object, %s given", zend_get_type_by_const(Z_TYPE_P(op1)));
- ZVAL_FALSE(EX_VAR(opline->result.var));
+ zend_type_error("get_class() expects parameter 1 to be object, %s given", zend_get_type_by_const(Z_TYPE_P(op1)));
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
}
break;
}
@@ -34869,25 +33423,21 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FUNC_GET_ARGS_SPEC_UNUSED_UNUS
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data;
zval *object;
zval *property;
zval *value;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = &EX(This);
-
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
do {
- value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data);
+ value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1);
if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
@@ -34898,16 +33448,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_UNUSED_CV_H
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
assign_op_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ UNDEF_RESULT();
+ break;
+ }
+ }
cache_slot = (IS_CV == IS_CONST) ? CACHE_ADDR((opline+1)->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -34944,11 +33502,14 @@ assign_op_object:
}
}
} else {
- zend_assign_op_overloaded_property(object, property, cache_slot, value OPLINE_CC EXECUTE_DATA_CC);
+ zend_assign_op_overloaded_property(zobj, name, cache_slot, value OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
- FREE_OP(free_op_data);
+ FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
/* assign_obj has two opcodes! */
@@ -34959,20 +33520,16 @@ assign_op_object:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object;
zval *property;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = &EX(This);
-
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
do {
@@ -34985,16 +33542,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_UNUSED_CV_HAN
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
pre_incdec_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ UNDEF_RESULT();
+ break;
+ }
+ }
cache_slot = (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -35008,7 +33573,10 @@ pre_incdec_object:
zend_pre_incdec_property_zval(zptr, prop_info OPLINE_CC EXECUTE_DATA_CC);
}
} else {
- zend_pre_incdec_overloaded_property(object, property, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ zend_pre_incdec_overloaded_property(zobj, name, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
@@ -35019,20 +33587,16 @@ pre_incdec_object:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object;
zval *property;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = &EX(This);
-
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
do {
@@ -35045,16 +33609,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_UNUSED_CV_HA
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
post_incdec_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
+ }
cache_slot = (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
ZVAL_NULL(EX_VAR(opline->result.var));
} else {
@@ -35067,7 +33639,10 @@ post_incdec_object:
zend_post_incdec_property_zval(zptr, prop_info OPLINE_CC EXECUTE_DATA_CC);
}
} else {
- zend_post_incdec_overloaded_property(object, property, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ zend_post_incdec_overloaded_property(zobj, name, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
@@ -35078,19 +33653,12 @@ post_incdec_object:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
-
zval *offset;
void **cache_slot = NULL;
SAVE_OPLINE();
container = &EX(This);
-
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
offset = EX_VAR(opline->op2.var);
if (IS_UNUSED == IS_CONST ||
@@ -35117,9 +33685,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_UNUSED_CV_HAN
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if (IS_CV == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value & ~ZEND_FETCH_REF /* FUNC_ARG fetch may contain it */);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -35144,10 +33714,10 @@ fetch_obj_r_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || (IS_UNUSED & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_r_copy;
@@ -35158,7 +33728,7 @@ fetch_obj_r_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -35170,11 +33740,22 @@ fetch_obj_r_fast_copy:
}
}
}
- } else if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
- ZVAL_UNDEFINED_OP2();
+ } else {
+ if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
+ ZVAL_UNDEFINED_OP2();
+ }
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_r_copy:
@@ -35193,16 +33774,11 @@ fetch_obj_r_finish:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *property, *container, *result;
SAVE_OPLINE();
container = &EX(This);
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
result = EX_VAR(opline->result.var);
zend_fetch_property_address(
@@ -35211,7 +33787,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_CV_HAN
BP_VAR_W, opline->extended_value & ZEND_FETCH_OBJ_FLAGS, 1 OPLINE_CC EXECUTE_DATA_CC);
if (IS_UNUSED == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -35219,21 +33795,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_UNUSED_CV_HAN
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *property, *container, *result;
SAVE_OPLINE();
container = &EX(This);
-
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
result = EX_VAR(opline->result.var);
zend_fetch_property_address(result, container, IS_UNUSED, property, IS_CV, ((IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL), BP_VAR_RW, 0, 1 OPLINE_CC EXECUTE_DATA_CC);
if (IS_UNUSED == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -35241,19 +33812,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_UNUSED_CV_HA
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
-
zval *offset;
void **cache_slot = NULL;
SAVE_OPLINE();
container = &EX(This);
-
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
offset = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
if (IS_UNUSED == IS_CONST ||
@@ -35273,9 +33837,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_CV_HA
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if (IS_CV == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -35300,10 +33866,10 @@ fetch_obj_is_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || (IS_UNUSED & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_is_copy;
@@ -35314,7 +33880,7 @@ fetch_obj_is_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -35326,9 +33892,19 @@ fetch_obj_is_fast_copy:
}
}
}
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_is_copy:
@@ -35364,22 +33940,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_UNUSED
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container, *property, *result;
SAVE_OPLINE();
container = &EX(This);
-
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
result = EX_VAR(opline->result.var);
zend_fetch_property_address(result, container, IS_UNUSED, property, IS_CV, ((IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL), BP_VAR_UNSET, 0, 1 OPLINE_CC EXECUTE_DATA_CC);
if (IS_UNUSED == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -35387,16 +33957,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_UNUSED_CV
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CV_OP_DATA_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = &EX(This);
-
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
value = RT_CONSTANT((opline+1), (opline+1)->op1);
@@ -35405,16 +33971,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CV_OP_D
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CV == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -35504,11 +34069,26 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ ZVAL_COPY_DEREF(EX_VAR(opline->result.var), value);
}
exit_assign_obj:
@@ -35522,34 +34102,29 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CV_OP_DATA_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = &EX(This);
-
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CV == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -35639,13 +34214,28 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ ZVAL_COPY_DEREF(EX_VAR(opline->result.var), value);
}
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
exit_assign_obj:
@@ -35657,34 +34247,29 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CV_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = &EX(This);
-
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CV == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -35774,13 +34359,28 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ ZVAL_COPY_DEREF(EX_VAR(opline->result.var), value);
}
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
exit_assign_obj:
@@ -35792,16 +34392,12 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CV_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = &EX(This);
-
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
value = _get_zval_ptr_cv_BP_VAR_R((opline+1)->op1.var EXECUTE_DATA_CC);
@@ -35810,16 +34406,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CV_OP_D
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CV == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -35909,11 +34504,26 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ ZVAL_COPY_DEREF(EX_VAR(opline->result.var), value);
}
exit_assign_obj:
@@ -35927,20 +34537,14 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_UNUSED_CV_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data;
zval *property, *container, *value_ptr;
SAVE_OPLINE();
container = &EX(This);
-
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
- value_ptr = _get_zval_ptr_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value_ptr = _get_zval_ptr_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (1) {
if (IS_UNUSED == IS_UNUSED) {
@@ -35961,7 +34565,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_UNUSED_CV_
}
- if (UNEXPECTED(free_op_data)) {zval_ptr_dtor_nogc(free_op_data);};
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));;
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -35969,17 +34573,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_UNUSED_CV_
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_UNUSED_CV_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *property, *container, *value_ptr;
SAVE_OPLINE();
container = &EX(This);
-
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
value_ptr = _get_zval_ptr_cv_BP_VAR_W((opline+1)->op1.var EXECUTE_DATA_CC);
@@ -36011,7 +34609,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_UNUSED_CV_
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_INIT_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zend_string **rope;
zval *var;
@@ -36046,7 +34643,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ROPE_INIT_SPEC_UNUSED_CV_HANDL
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
-
zval *class_name;
USE_OPLINE
@@ -36091,7 +34687,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_C
{
USE_OPLINE
zval *function_name;
- zend_free_op free_op1;
zval *object;
zend_function *fbc;
zend_class_entry *called_scope;
@@ -36103,10 +34698,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_C
object = &EX(This);
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
if (IS_CV != IS_CONST) {
function_name = EX_VAR(opline->op2.var);
}
@@ -36186,7 +34777,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_C
HANDLE_EXCEPTION();
}
if (IS_CV == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE))) &&
EXPECTED(obj == orig_obj)) {
CACHE_POLYMORPHIC_PTR(opline->result.num, called_scope, fbc);
@@ -36216,9 +34806,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_C
} else if (IS_UNUSED & (IS_VAR|IS_TMP_VAR|IS_CV)) {
if (IS_UNUSED == IS_CV) {
GC_ADDREF(obj); /* For $this pointer */
- } else if (free_op1 != object) {
- GC_ADDREF(obj); /* For $this pointer */
-
+ } else {
+ zval *free_op1 = EX_VAR(opline->op1.var);
+ if (free_op1 != object) {
+ GC_ADDREF(obj); /* For $this pointer */
+ zval_ptr_dtor_nogc(free_op1);
+ }
}
/* CV may be changed indirectly (e.g. when it's a reference) */
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS | ZEND_CALL_RELEASE_THIS;
@@ -36277,8 +34870,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_U
EXPECTED(CACHED_PTR(opline->result.num) == ce)) {
fbc = CACHED_PTR(opline->result.num + sizeof(void*));
} else if (IS_CV != IS_UNUSED) {
-
-
function_name = EX_VAR(opline->op2.var);
if (IS_CV != IS_CONST) {
if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
@@ -36294,7 +34885,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_U
HANDLE_EXCEPTION();
}
}
- zend_throw_error(NULL, "Function name must be a string");
+ zend_throw_error(NULL, "Method name must be a string");
HANDLE_EXCEPTION();
} while (0);
@@ -36314,7 +34905,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_U
HANDLE_EXCEPTION();
}
if (IS_CV == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE)))) {
CACHE_POLYMORPHIC_PTR(opline->result.num, ce, fbc);
}
@@ -36345,13 +34935,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_U
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS;
} else {
zend_non_static_method_call(fbc);
- if (UNEXPECTED(EG(exception) != NULL)) {
- HANDLE_EXCEPTION();
- }
- goto check_parent_and_self;
+ HANDLE_EXCEPTION();
}
} else {
-check_parent_and_self:
/* previous opcode is ZEND_FETCH_CLASS */
if (IS_UNUSED == IS_UNUSED
&& ((opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_PARENT ||
@@ -36397,15 +34983,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_UNUSED_CV_HAND
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
container = &EX(This);
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
offset = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
do {
@@ -36423,7 +35006,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_UNUSED_CV_HANDL
break;
}
}
- Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL));
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ break;
+ }
+ }
+ Z_OBJ_HT_P(container)->unset_property(Z_OBJ_P(container), name, ((IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL));
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
} while (0);
@@ -36433,18 +35027,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_UNUSED_CV_HANDL
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
int result;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
container = &EX(This);
-
- if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
offset = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
if (IS_UNUSED == IS_CONST ||
@@ -36461,16 +35050,28 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UN
}
}
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ result = 0;
+ goto isset_object_finish;
+ }
+ }
+
result =
(opline->extended_value & ZEND_ISEMPTY) ^
- Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY), ((IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+ Z_OBJ_HT_P(container)->has_property(Z_OBJ_P(container), name, (opline->extended_value & ZEND_ISEMPTY), ((IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
isset_object_finish:
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -36492,8 +35093,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CV_HANDLER(Z
/* Set the new yielded value */
if (IS_UNUSED != IS_UNUSED) {
-
-
if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
/* Constants and temporary variables aren't yieldable by reference,
* but we still allow them with a notice. */
@@ -36561,26 +35160,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CV_HANDLER(Z
/* Set the new yielded key */
if (IS_CV != IS_UNUSED) {
-
zval *key = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
-
- /* Consts, temporary variables and references need copying */
- if (IS_CV == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_CV == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_CV & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
-
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_CV == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
+ if ((IS_CV & (IS_CV|IS_VAR)) && UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE) {
+ key = Z_REFVAL_P(key);
}
+ ZVAL_COPY(&generator->key, key);
if (Z_TYPE(generator->key) == IS_LONG
&& Z_LVAL(generator->key) > generator->largest_used_integer_key
@@ -36613,33 +35197,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CV_HANDLER(Z
ZEND_VM_RETURN();
}
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_NOT_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
-
- zval *op1;
-
- op1 = EX_VAR(opline->op1.var);
- if (EXPECTED(Z_TYPE_INFO_P(op1) == IS_LONG)) {
- ZVAL_LONG(EX_VAR(opline->result.var), ~Z_LVAL_P(op1));
- ZEND_VM_NEXT_OPCODE();
- }
-
- SAVE_OPLINE();
- if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_P(op1) == IS_UNDEF)) {
- op1 = ZVAL_UNDEFINED_OP1();
- }
- bitwise_not_function(EX_VAR(opline->result.var), op1);
-
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
-}
-
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_NOT_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
zval *val;
-
val = EX_VAR(opline->op1.var);
if (Z_TYPE_INFO_P(val) == IS_TRUE) {
ZVAL_FALSE(EX_VAR(opline->result.var));
@@ -36664,18 +35226,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_NOT_SPEC_CV_HANDLER(ZEND_
static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_pre_inc_helper_SPEC_CV(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *var_ptr;
var_ptr = EX_VAR(opline->op1.var);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_ISERROR_P(var_ptr))) {
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- ZEND_VM_NEXT_OPCODE();
- }
-
SAVE_OPLINE();
if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_UNDEF)) {
ZVAL_NULL(var_ptr);
@@ -36704,7 +35258,6 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_pre_inc_help
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_SPEC_CV_RETVAL_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *var_ptr;
var_ptr = EX_VAR(opline->op1.var);
@@ -36723,7 +35276,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_SPEC_CV_RE
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_SPEC_CV_RETVAL_USED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *var_ptr;
var_ptr = EX_VAR(opline->op1.var);
@@ -36742,18 +35294,10 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_SPEC_CV_RE
static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_pre_dec_helper_SPEC_CV(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *var_ptr;
var_ptr = EX_VAR(opline->op1.var);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_ISERROR_P(var_ptr))) {
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- ZEND_VM_NEXT_OPCODE();
- }
-
SAVE_OPLINE();
if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_UNDEF)) {
ZVAL_NULL(var_ptr);
@@ -36783,7 +35327,6 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_pre_dec_help
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_DEC_SPEC_CV_RETVAL_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *var_ptr;
var_ptr = EX_VAR(opline->op1.var);
@@ -36802,7 +35345,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_DEC_SPEC_CV_RE
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_DEC_SPEC_CV_RETVAL_USED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *var_ptr;
var_ptr = EX_VAR(opline->op1.var);
@@ -36821,16 +35363,10 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_DEC_SPEC_CV_RE
static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_post_inc_helper_SPEC_CV(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *var_ptr;
var_ptr = EX_VAR(opline->op1.var);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_ISERROR_P(var_ptr))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- }
-
SAVE_OPLINE();
if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_UNDEF)) {
ZVAL_NULL(var_ptr);
@@ -36858,7 +35394,6 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_post_inc_hel
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *var_ptr;
var_ptr = EX_VAR(opline->op1.var);
@@ -36875,16 +35410,10 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_SPEC_CV_H
static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_post_dec_helper_SPEC_CV(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *var_ptr;
var_ptr = EX_VAR(opline->op1.var);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_ISERROR_P(var_ptr))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
- }
-
SAVE_OPLINE();
if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_P(var_ptr) == IS_UNDEF)) {
ZVAL_NULL(var_ptr);
@@ -36912,7 +35441,6 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_post_dec_hel
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_DEC_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *var_ptr;
var_ptr = EX_VAR(opline->op1.var);
@@ -36929,7 +35457,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_DEC_SPEC_CV_H
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ECHO_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *z;
SAVE_OPLINE();
@@ -36958,8 +35485,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ECHO_SPEC_CV_HANDLER(ZEND_OPCO
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZ_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *val;
+ zend_uchar op1_type;
val = EX_VAR(opline->op1.var);
@@ -36977,20 +35504,23 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZ_SPEC_CV_HANDL
}
SAVE_OPLINE();
+ op1_type = IS_CV;
if (i_zend_is_true(val)) {
opline++;
} else {
opline = OP_JMP_ADDR(opline, opline->op2);
}
-
+ if (op1_type & (IS_TMP_VAR|IS_VAR)) {
+ zval_ptr_dtor_nogc(val);
+ }
ZEND_VM_JMP(opline);
}
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPNZ_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *val;
+ zend_uchar op1_type;
val = EX_VAR(opline->op1.var);
@@ -37008,20 +35538,23 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPNZ_SPEC_CV_HAND
}
SAVE_OPLINE();
+ op1_type = IS_CV;
if (i_zend_is_true(val)) {
opline = OP_JMP_ADDR(opline, opline->op2);
} else {
opline++;
}
-
+ if (op1_type & (IS_TMP_VAR|IS_VAR)) {
+ zval_ptr_dtor_nogc(val);
+ }
ZEND_VM_JMP(opline);
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZNZ_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *val;
+ zend_uchar op1_type;
val = EX_VAR(opline->op1.var);
@@ -37040,19 +35573,21 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZNZ_SPEC_CV_HANDLER(ZEND_OP
}
SAVE_OPLINE();
+ op1_type = IS_CV;
if (i_zend_is_true(val)) {
opline = ZEND_OFFSET_TO_OPLINE(opline, opline->extended_value);
} else {
opline = OP_JMP_ADDR(opline, opline->op2);
}
-
+ if (op1_type & (IS_TMP_VAR|IS_VAR)) {
+ zval_ptr_dtor_nogc(val);
+ }
ZEND_VM_JMP(opline);
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZ_EX_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *val;
int ret;
@@ -37089,7 +35624,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZ_EX_SPEC_CV_HANDLER(ZEND_O
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPNZ_EX_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *val;
int ret;
@@ -37127,7 +35661,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_SPEC_CV_HAN
USE_OPLINE
zval *retval_ptr;
zval *return_value;
- zend_free_op free_op1;
retval_ptr = EX_VAR(opline->op1.var);
return_value = EX(return_value);
@@ -37139,9 +35672,9 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_SPEC_CV_HAN
}
} else if (!return_value) {
if (IS_CV & (IS_VAR|IS_TMP_VAR)) {
- if (Z_REFCOUNTED_P(free_op1) && !Z_DELREF_P(free_op1)) {
+ if (Z_REFCOUNTED_P(retval_ptr) && !Z_DELREF_P(retval_ptr)) {
SAVE_OPLINE();
- rc_dtor_func(Z_COUNTED_P(free_op1));
+ rc_dtor_func(Z_COUNTED_P(retval_ptr));
}
}
} else {
@@ -37200,7 +35733,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CV_HANDLER(
USE_OPLINE
zval *retval_ptr;
-
SAVE_OPLINE();
do {
@@ -37260,7 +35792,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GENERATOR_RETURN_SPEC_CV_HANDL
USE_OPLINE
zval *retval;
-
zend_generator *generator = zend_get_running_generator(EXECUTE_DATA_C);
SAVE_OPLINE();
@@ -37304,7 +35835,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_THROW_SPEC_CV_HANDLER(ZEND_OPC
USE_OPLINE
zval *value;
-
SAVE_OPLINE();
value = EX_VAR(opline->op1.var);
@@ -37329,10 +35859,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_THROW_SPEC_CV_HANDLER(ZEND_OPC
} while (0);
zend_exception_save();
- if (IS_CV != IS_TMP_VAR) {
- Z_TRY_ADDREF_P(value);
- }
-
+ Z_TRY_ADDREF_P(value);
zend_throw_exception_object(value);
zend_exception_restore();
@@ -37344,7 +35871,6 @@ static zend_always_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_SP
USE_OPLINE
zval *varptr, *arg;
-
varptr = EX_VAR(opline->op1.var);
if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(varptr) == IS_UNDEF)) {
SAVE_OPLINE();
@@ -37385,19 +35911,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_SPEC_CV_HANDLER(ZEND_
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *varptr, *arg;
SAVE_OPLINE();
varptr = _get_zval_ptr_cv_BP_VAR_W(opline->op1.var EXECUTE_DATA_CC);
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_ISERROR_P(varptr))) {
- ZVAL_NEW_EMPTY_REF(arg);
- ZVAL_NULL(Z_REFVAL_P(arg));
- ZEND_VM_NEXT_OPCODE();
- }
-
if (Z_ISREF_P(varptr)) {
Z_ADDREF_P(varptr);
} else {
@@ -37412,7 +35931,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_EX_SPEC_CV_HANDLER(ZE
{
USE_OPLINE
zval *varptr, *arg;
-
uint32_t arg_num = opline->op2.num;
if (EXPECTED(0)) {
@@ -37460,7 +35978,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_EX_SPEC_C
{
USE_OPLINE
zval *varptr, *arg;
-
uint32_t arg_num = opline->op2.num;
if (EXPECTED(1)) {
@@ -37509,7 +36026,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_USER_SPEC_CV_HANDLER(ZEND
USE_OPLINE
zval *arg, *param;
-
SAVE_OPLINE();
if (UNEXPECTED(ARG_MUST_BE_SENT_BY_REF(EX(call)->func, opline->op2.num))) {
@@ -37528,7 +36044,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_SPEC_CV_HANDLER(ZEND_OPCO
USE_OPLINE
zval *val;
-
val = EX_VAR(opline->op1.var);
if (Z_TYPE_INFO_P(val) == IS_TRUE) {
ZVAL_TRUE(EX_VAR(opline->result.var));
@@ -37553,8 +36068,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_SPEC_CV_HANDLER(ZEND_OPCO
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *obj;
+ zend_object *zobj;
zend_class_entry *ce, *scope;
zend_function *clone;
zend_object_clone_obj_t clone_call;
@@ -37562,10 +36077,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_CV_HANDLER(ZEND_OPC
SAVE_OPLINE();
obj = EX_VAR(opline->op1.var);
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(obj) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
do {
if (IS_CV == IS_CONST ||
(IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(obj) != IS_OBJECT))) {
@@ -37588,9 +36099,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_CV_HANDLER(ZEND_OPC
}
} while (0);
- ce = Z_OBJCE_P(obj);
+ zobj = Z_OBJ_P(obj);
+ ce = zobj->ce;
clone = ce->clone;
- clone_call = Z_OBJ_HT_P(obj)->clone_obj;
+ clone_call = zobj->handlers->clone_obj;
if (UNEXPECTED(clone_call == NULL)) {
zend_throw_error(NULL, "Trying to clone an uncloneable object of class %s", ZSTR_VAL(ce->name));
@@ -37611,7 +36123,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_CV_HANDLER(ZEND_OPC
}
}
- ZVAL_OBJ(EX_VAR(opline->result.var), clone_call(obj));
+ ZVAL_OBJ(EX_VAR(opline->result.var), clone_call(zobj));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -37619,7 +36131,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_CV_HANDLER(ZEND_OPC
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CAST_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *expr;
zval *result = EX_VAR(opline->result.var);
HashTable *ht;
@@ -37628,12 +36139,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CAST_SPEC_CV_HANDLER(ZEND_OPCO
expr = _get_zval_ptr_cv_BP_VAR_R(opline->op1.var EXECUTE_DATA_CC);
switch (opline->extended_value) {
- case IS_NULL:
- ZVAL_NULL(result);
- break;
- case _IS_BOOL:
- ZVAL_BOOL(result, zend_is_true(expr));
- break;
case IS_LONG:
ZVAL_LONG(result, zval_get_long(expr));
break;
@@ -37644,6 +36149,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CAST_SPEC_CV_HANDLER(ZEND_OPCO
ZVAL_STR(result, zval_get_string(expr));
break;
default:
+ ZEND_ASSERT(opline->extended_value != _IS_BOOL && "Must use ZEND_BOOL instead");
if (IS_CV & (IS_VAR|IS_CV)) {
ZVAL_DEREF(expr);
}
@@ -37686,6 +36192,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CAST_SPEC_CV_HANDLER(ZEND_OPCO
}
}
} else {
+ ZEND_ASSERT(opline->extended_value == IS_OBJECT);
ZVAL_OBJ(result, zend_objects_new(zend_standard_class_def));
if (Z_TYPE_P(expr) == IS_ARRAY) {
ht = zend_symtable_to_proptable(Z_ARR_P(expr));
@@ -37713,7 +36220,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLE
{
USE_OPLINE
zend_op_array *new_op_array;
-
zval *inc_filename;
SAVE_OPLINE();
@@ -37778,7 +36284,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *array_ptr, *result;
SAVE_OPLINE();
@@ -37794,20 +36299,27 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_CV_HANDLER(ZEN
ZEND_VM_NEXT_OPCODE();
} else if (IS_CV != IS_CONST && EXPECTED(Z_TYPE_P(array_ptr) == IS_OBJECT)) {
- if (!Z_OBJCE_P(array_ptr)->get_iterator) {
+ zend_object *zobj = Z_OBJ_P(array_ptr);
+ if (!zobj->ce->get_iterator) {
+ HashTable *properties;
+
result = EX_VAR(opline->result.var);
- ZVAL_COPY_VALUE(result, array_ptr);
+ ZVAL_OBJ(result, zobj);
if (IS_CV != IS_TMP_VAR) {
- Z_ADDREF_P(array_ptr);
+ GC_ADDREF(zobj);
}
- if (Z_OBJ_P(array_ptr)->properties
- && UNEXPECTED(GC_REFCOUNT(Z_OBJ_P(array_ptr)->properties) > 1)) {
- if (EXPECTED(!(GC_FLAGS(Z_OBJ_P(array_ptr)->properties) & IS_ARRAY_IMMUTABLE))) {
- GC_DELREF(Z_OBJ_P(array_ptr)->properties);
+ properties = zobj->properties;
+ if (properties) {
+ if (UNEXPECTED(GC_REFCOUNT(properties) > 1)) {
+ if (EXPECTED(!(GC_FLAGS(properties) & IS_ARRAY_IMMUTABLE))) {
+ GC_DELREF(properties);
+ }
+ properties = zobj->properties = zend_array_dup(properties);
}
- Z_OBJ_P(array_ptr)->properties = zend_array_dup(Z_OBJ_P(array_ptr)->properties);
+ } else {
+ properties = zobj->handlers->get_properties(zobj);
}
- Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(Z_OBJPROP_P(array_ptr), 0);
+ Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(properties, 0);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
@@ -37833,7 +36345,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_CV_HANDLER(ZEN
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *array_ptr, *array_ref;
SAVE_OPLINE();
@@ -37926,7 +36437,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_CV_HANDLER(ZE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMP_SET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *value;
zval *ref = NULL;
int ret;
@@ -37975,7 +36485,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMP_SET_SPEC_CV_HANDLER(ZEND_O
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COALESCE_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *value;
zval *ref = NULL;
@@ -38014,7 +36523,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COALESCE_SPEC_CV_HANDLER(ZEND_
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_QM_ASSIGN_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *value;
zval *result = EX_VAR(opline->result.var);
@@ -38053,14 +36561,11 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_QM_ASSIGN_SPEC_CV_
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zend_generator *generator = zend_get_running_generator(EXECUTE_DATA_C);
-
zval *val;
-
SAVE_OPLINE();
- val = _get_zval_ptr_cv_deref_BP_VAR_R(opline->op1.var EXECUTE_DATA_CC);
+ val = _get_zval_ptr_cv_BP_VAR_R(opline->op1.var EXECUTE_DATA_CC);
if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
zend_throw_error(NULL, "Cannot use \"yield from\" in a force-closed generator");
@@ -38069,9 +36574,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_CV_HANDLER(ZEN
HANDLE_EXCEPTION();
}
+yield_from_try_again:
if (Z_TYPE_P(val) == IS_ARRAY) {
ZVAL_COPY_VALUE(&generator->values, val);
- if (IS_CV != IS_TMP_VAR && Z_OPT_REFCOUNTED_P(val)) {
+ if (Z_OPT_REFCOUNTED_P(val)) {
Z_ADDREF_P(val);
}
Z_FE_POS(generator->values) = 0;
@@ -38081,9 +36587,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_CV_HANDLER(ZEN
if (ce == zend_ce_generator) {
zend_generator *new_gen = (zend_generator *) Z_OBJ_P(val);
- if (IS_CV != IS_TMP_VAR) {
- Z_ADDREF_P(val);
- }
+ Z_ADDREF_P(val);
if (Z_ISUNDEF(new_gen->retval)) {
if (UNEXPECTED(zend_generator_get_current(new_gen) == generator)) {
@@ -38128,6 +36632,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_CV_HANDLER(ZEN
ZVAL_OBJ(&generator->values, &iter->std);
}
+ } else if ((IS_CV & (IS_VAR|IS_CV)) && Z_TYPE_P(val) == IS_REFERENCE) {
+ val = Z_REFVAL_P(val);
+ goto yield_from_try_again;
} else {
zend_throw_error(NULL, "Can use \"yield from\" only with arrays and Traversables");
UNDEF_RESULT();
@@ -38159,7 +36666,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_STRLEN_SPEC_CV_HANDLER(ZEND_OP
USE_OPLINE
zval *value;
-
value = EX_VAR(opline->op1.var);
if (EXPECTED(Z_TYPE_P(value) == IS_STRING)) {
ZVAL_LONG(EX_VAR(opline->result.var), Z_STRLEN_P(value));
@@ -38196,9 +36702,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_STRLEN_SPEC_CV_HANDLER(ZEND_OP
zval_ptr_dtor(&tmp);
}
if (!EG(exception)) {
- zend_internal_type_error(strict, "strlen() expects parameter 1 to be string, %s given", zend_get_type_by_const(Z_TYPE_P(value)));
+ zend_type_error("strlen() expects parameter 1 to be string, %s given", zend_get_type_by_const(Z_TYPE_P(value)));
}
- ZVAL_NULL(EX_VAR(opline->result.var));
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
} while (0);
}
@@ -38211,11 +36717,10 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_TYPE_CHECK_SPEC_CV
zval *value;
int result = 0;
-
value = EX_VAR(opline->op1.var);
if ((opline->extended_value >> (uint32_t)Z_TYPE_P(value)) & 1) {
type_check_resource:
- if (EXPECTED(Z_TYPE_P(value) != IS_RESOURCE)
+ if (opline->extended_value != MAY_BE_RESOURCE
|| EXPECTED(NULL != zend_rsrc_list_get_rsrc_type(Z_RES_P(value)))) {
result = 1;
}
@@ -38237,15 +36742,74 @@ type_check_resource:
SAVE_OPLINE();
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
} else {
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
}
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ uint32_t fetch_type;
+ zend_class_entry *called_scope, *scope;
+ USE_OPLINE
+
+ if (IS_CV != IS_UNUSED) {
+ zval *op = _get_zval_ptr_cv_BP_VAR_R(opline->op1.var EXECUTE_DATA_CC);
+ SAVE_OPLINE();
+ if (UNEXPECTED(Z_TYPE_P(op) != IS_OBJECT)) {
+ ZVAL_DEREF(op);
+ if (Z_TYPE_P(op) != IS_OBJECT) {
+ zend_type_error("Cannot use ::class on value of type %s",
+ zend_get_type_by_const(Z_TYPE_P(op)));
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+
+ HANDLE_EXCEPTION();
+ }
+ }
+
+ ZVAL_STR_COPY(EX_VAR(opline->result.var), Z_OBJCE_P(op)->name);
+
+ ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
+ }
+
+ fetch_type = opline->op1.num;
+ scope = EX(func)->op_array.scope;
+ if (UNEXPECTED(scope == NULL)) {
+ SAVE_OPLINE();
+ zend_throw_error(NULL, "Cannot use \"%s\" when no class scope is active",
+ fetch_type == ZEND_FETCH_CLASS_SELF ? "self" :
+ fetch_type == ZEND_FETCH_CLASS_PARENT ? "parent" : "static");
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ HANDLE_EXCEPTION();
+ }
+
+ switch (fetch_type) {
+ case ZEND_FETCH_CLASS_SELF:
+ ZVAL_STR_COPY(EX_VAR(opline->result.var), scope->name);
+ break;
+ case ZEND_FETCH_CLASS_PARENT:
+ if (UNEXPECTED(scope->parent == NULL)) {
+ SAVE_OPLINE();
+ zend_throw_error(NULL,
+ "Cannot use \"parent\" when current class scope has no parent");
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ HANDLE_EXCEPTION();
+ }
+ ZVAL_STR_COPY(EX_VAR(opline->result.var), scope->parent->name);
+ break;
+ case ZEND_FETCH_CLASS_STATIC:
+ if (Z_TYPE(EX(This)) == IS_OBJECT) {
+ called_scope = Z_OBJCE(EX(This));
+ } else {
+ called_scope = Z_CE(EX(This));
+ }
+ ZVAL_STR_COPY(EX_VAR(opline->result.var), called_scope->name);
+ break;
+ EMPTY_SWITCH_DEFAULT_CASE()
+ }
+ ZEND_VM_NEXT_OPCODE();
+}
+
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_LONG_NO_OVERFLOW_SPEC_CV_RETVAL_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -38399,7 +36963,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_SIMPLE_SP
USE_OPLINE
zval *varptr, *arg;
-
varptr = EX_VAR(opline->op1.var);
arg = ZEND_CALL_VAR(EX(call), opline->result.var);
@@ -38416,7 +36979,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_EX_SIMPLE
{
USE_OPLINE
zval *varptr, *arg;
-
uint32_t arg_num = opline->op2.num;
if (QUICK_ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
@@ -38438,7 +37000,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAR_EX_SIMPLE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DIV_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
SAVE_OPLINE();
@@ -38453,7 +37014,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DIV_SPEC_CV_CONST_HANDLER(ZEND
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POW_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
SAVE_OPLINE();
@@ -38468,7 +37028,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POW_SPEC_CV_CONST_HANDLER(ZEND
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
op1 = EX_VAR(opline->op1.var);
@@ -38540,7 +37099,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_CV_CONST_HANDLER(Z
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
zend_bool result;
@@ -38551,14 +37109,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CV_CONST_HAN
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
zend_bool result;
@@ -38569,14 +37124,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CV_CONST
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -38588,14 +37140,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_CONST_HANDLER
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
if (EXPECTED(Z_LVAL_P(op1) == Z_LVAL_P(op2))) {
is_equal_true:
-
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_TRUE_NONE();
} else {
is_equal_false:
-
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_FALSE_NONE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -38639,7 +37187,6 @@ is_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_CONST_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -38652,13 +37199,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_CONST_JMPZ_HA
if (EXPECTED(Z_LVAL_P(op1) == Z_LVAL_P(op2))) {
is_equal_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_equal_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -38702,7 +37245,6 @@ is_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_CONST_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -38715,13 +37257,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_CONST_JMPNZ_H
if (EXPECTED(Z_LVAL_P(op1) == Z_LVAL_P(op2))) {
is_equal_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPNZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_equal_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPNZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -38765,7 +37303,6 @@ is_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -38777,14 +37314,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_CONST_HAN
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
if (EXPECTED(Z_LVAL_P(op1) != Z_LVAL_P(op2))) {
is_not_equal_true:
-
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_TRUE_NONE();
} else {
is_not_equal_false:
-
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_FALSE_NONE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -38828,7 +37361,6 @@ is_not_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_CONST_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -38841,13 +37373,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_CONST_JMP
if (EXPECTED(Z_LVAL_P(op1) != Z_LVAL_P(op2))) {
is_not_equal_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_not_equal_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -38891,7 +37419,6 @@ is_not_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_CONST_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -38904,13 +37431,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_CONST_JMP
if (EXPECTED(Z_LVAL_P(op1) != Z_LVAL_P(op2))) {
is_not_equal_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPNZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_not_equal_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPNZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -38954,7 +37477,6 @@ is_not_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SPACESHIP_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
SAVE_OPLINE();
@@ -38969,7 +37491,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SPACESHIP_SPEC_CV_CONST_HANDLE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
SAVE_OPLINE();
@@ -38984,25 +37505,21 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_CV_CONST_HANDLER
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data;
zval *object;
zval *property;
zval *value;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = EX_VAR(opline->op1.var);
-
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = RT_CONSTANT(opline, opline->op2);
do {
- value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data);
+ value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1);
if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
@@ -39013,16 +37530,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_CV_CONST_HA
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
assign_op_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ UNDEF_RESULT();
+ break;
+ }
+ }
cache_slot = (IS_CONST == IS_CONST) ? CACHE_ADDR((opline+1)->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -39059,11 +37584,14 @@ assign_op_object:
}
}
} else {
- zend_assign_op_overloaded_property(object, property, cache_slot, value OPLINE_CC EXECUTE_DATA_CC);
+ zend_assign_op_overloaded_property(zobj, name, cache_slot, value OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
- FREE_OP(free_op_data);
+ FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
/* assign_obj has two opcodes! */
@@ -39074,7 +37602,6 @@ assign_op_object:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data1;
zval *var_ptr;
zval *value, *container, *dim;
@@ -39103,7 +37630,7 @@ assign_dim_op_new_array:
}
}
- value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data1);
+ value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1);
do {
if (IS_CONST != IS_UNUSED && UNEXPECTED(Z_ISREF_P(var_ptr))) {
@@ -39120,7 +37647,7 @@ assign_dim_op_new_array:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
- FREE_OP(free_op_data1);
+ FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
} else {
if (EXPECTED(Z_ISREF_P(container))) {
container = Z_REFVAL_P(container);
@@ -39158,7 +37685,6 @@ assign_dim_op_ret_null:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OP_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *var_ptr;
zval *value;
@@ -39166,26 +37692,20 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OP_SPEC_CV_CONST_HANDLE
value = RT_CONSTANT(opline, opline->op2);
var_ptr = _get_zval_ptr_cv_BP_VAR_RW(opline->op1.var EXECUTE_DATA_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_ISERROR_P(var_ptr))) {
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- do {
- if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_REFERENCE)) {
- zend_reference *ref = Z_REF_P(var_ptr);
- var_ptr = Z_REFVAL_P(var_ptr);
- if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
- zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
- break;
- }
+ do {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_REFERENCE)) {
+ zend_reference *ref = Z_REF_P(var_ptr);
+ var_ptr = Z_REFVAL_P(var_ptr);
+ if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
+ zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
- zend_binary_op(var_ptr, var_ptr, value OPLINE_CC);
- } while (0);
-
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
+ zend_binary_op(var_ptr, var_ptr, value OPLINE_CC);
+ } while (0);
+
+ if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
+ ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
@@ -39195,20 +37715,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OP_SPEC_CV_CONST_HANDLE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object;
zval *property;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = EX_VAR(opline->op1.var);
-
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = RT_CONSTANT(opline, opline->op2);
do {
@@ -39221,16 +37737,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_CV_CONST_HAND
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
pre_incdec_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ UNDEF_RESULT();
+ break;
+ }
+ }
cache_slot = (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -39244,7 +37768,10 @@ pre_incdec_object:
zend_pre_incdec_property_zval(zptr, prop_info OPLINE_CC EXECUTE_DATA_CC);
}
} else {
- zend_pre_incdec_overloaded_property(object, property, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ zend_pre_incdec_overloaded_property(zobj, name, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
@@ -39255,20 +37782,16 @@ pre_incdec_object:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object;
zval *property;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = EX_VAR(opline->op1.var);
-
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = RT_CONSTANT(opline, opline->op2);
do {
@@ -39281,16 +37804,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_CV_CONST_HAN
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
post_incdec_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
+ }
cache_slot = (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
ZVAL_NULL(EX_VAR(opline->result.var));
} else {
@@ -39303,7 +37834,10 @@ post_incdec_object:
zend_post_incdec_property_zval(zptr, prop_info OPLINE_CC EXECUTE_DATA_CC);
}
} else {
- zend_post_incdec_overloaded_property(object, property, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ zend_post_incdec_overloaded_property(zobj, name, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
@@ -39314,7 +37848,6 @@ post_incdec_object:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container, *dim, *value;
SAVE_OPLINE();
@@ -39350,7 +37883,6 @@ fetch_dim_r_slow:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
SAVE_OPLINE();
@@ -39358,8 +37890,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_CONST_HAND
zend_fetch_dimension_address_W(container, RT_CONSTANT(opline, opline->op2), IS_CONST OPLINE_CC EXECUTE_DATA_CC);
if (IS_CV == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -39367,7 +37898,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_CONST_HAND
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
SAVE_OPLINE();
@@ -39375,8 +37905,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_CV_CONST_HAN
zend_fetch_dimension_address_RW(container, RT_CONSTANT(opline, opline->op2), IS_CONST OPLINE_CC EXECUTE_DATA_CC);
if (IS_CV == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -39384,7 +37913,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_CV_CONST_HAN
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
SAVE_OPLINE();
@@ -39417,7 +37945,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_CON
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
SAVE_OPLINE();
@@ -39425,8 +37952,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_CV_CONST_
zend_fetch_dimension_address_UNSET(container, RT_CONSTANT(opline, opline->op2), IS_CONST OPLINE_CC EXECUTE_DATA_CC);
if (IS_CV == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -39434,19 +37960,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_CV_CONST_
static zend_always_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CV_CONST_INLINE_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
-
zval *offset;
void **cache_slot = NULL;
SAVE_OPLINE();
container = EX_VAR(opline->op1.var);
-
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
offset = RT_CONSTANT(opline, opline->op2);
if (IS_CV == IS_CONST ||
@@ -39473,9 +37992,11 @@ static zend_always_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value & ~ZEND_FETCH_REF /* FUNC_ARG fetch may contain it */);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -39500,10 +38021,10 @@ fetch_obj_r_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || (IS_CV & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_r_copy;
@@ -39514,7 +38035,7 @@ fetch_obj_r_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -39526,11 +38047,22 @@ fetch_obj_r_fast_copy:
}
}
}
- } else if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
- ZVAL_UNDEFINED_OP2();
+ } else {
+ if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
+ ZVAL_UNDEFINED_OP2();
+ }
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_r_copy:
@@ -39554,16 +38086,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CV_CONST_HAND
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *property, *container, *result;
SAVE_OPLINE();
container = EX_VAR(opline->op1.var);
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = RT_CONSTANT(opline, opline->op2);
result = EX_VAR(opline->result.var);
zend_fetch_property_address(
@@ -39572,7 +38099,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_CONST_HAND
BP_VAR_W, opline->extended_value & ZEND_FETCH_OBJ_FLAGS, 1 OPLINE_CC EXECUTE_DATA_CC);
if (IS_CV == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -39580,21 +38107,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_CONST_HAND
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *property, *container, *result;
SAVE_OPLINE();
container = EX_VAR(opline->op1.var);
-
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
property = RT_CONSTANT(opline, opline->op2);
result = EX_VAR(opline->result.var);
zend_fetch_property_address(result, container, IS_CV, property, IS_CONST, ((IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL), BP_VAR_RW, 0, 1 OPLINE_CC EXECUTE_DATA_CC);
if (IS_CV == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -39602,19 +38124,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_CV_CONST_HAN
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
-
zval *offset;
void **cache_slot = NULL;
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_IS(opline->op1.var EXECUTE_DATA_CC);
-
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
offset = RT_CONSTANT(opline, opline->op2);
if (IS_CV == IS_CONST ||
@@ -39634,9 +38149,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_CONST_HAN
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -39661,10 +38178,10 @@ fetch_obj_is_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || (IS_CV & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_is_copy;
@@ -39675,7 +38192,7 @@ fetch_obj_is_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -39687,9 +38204,19 @@ fetch_obj_is_fast_copy:
}
}
}
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_is_copy:
@@ -39725,22 +38252,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CV_CON
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container, *property, *result;
SAVE_OPLINE();
container = EX_VAR(opline->op1.var);
-
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = RT_CONSTANT(opline, opline->op2);
result = EX_VAR(opline->result.var);
zend_fetch_property_address(result, container, IS_CV, property, IS_CONST, ((IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL), BP_VAR_UNSET, 0, 1 OPLINE_CC EXECUTE_DATA_CC);
if (IS_CV == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -39748,16 +38269,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_CONST_
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CONST_OP_DATA_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = EX_VAR(opline->op1.var);
-
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = RT_CONSTANT(opline, opline->op2);
value = RT_CONSTANT((opline+1), (opline+1)->op1);
@@ -39766,16 +38283,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CONST_OP_DA
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CONST == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -39865,11 +38381,26 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ ZVAL_COPY_DEREF(EX_VAR(opline->result.var), value);
}
exit_assign_obj:
@@ -39883,34 +38414,29 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CONST_OP_DATA_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = EX_VAR(opline->op1.var);
-
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = RT_CONSTANT(opline, opline->op2);
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CONST == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -40000,13 +38526,28 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ ZVAL_COPY_DEREF(EX_VAR(opline->result.var), value);
}
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
exit_assign_obj:
@@ -40018,34 +38559,29 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CONST_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = EX_VAR(opline->op1.var);
-
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = RT_CONSTANT(opline, opline->op2);
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CONST == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -40135,13 +38671,28 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ ZVAL_COPY_DEREF(EX_VAR(opline->result.var), value);
}
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
exit_assign_obj:
@@ -40153,16 +38704,12 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CONST_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = EX_VAR(opline->op1.var);
-
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = RT_CONSTANT(opline, opline->op2);
value = _get_zval_ptr_cv_BP_VAR_R((opline+1)->op1.var EXECUTE_DATA_CC);
@@ -40171,16 +38718,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CONST_OP_DA
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CONST == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -40270,11 +38816,26 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ ZVAL_COPY_DEREF(EX_VAR(opline->result.var), value);
}
exit_assign_obj:
@@ -40288,9 +38849,7 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CONST_OP_DATA_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
@@ -40316,11 +38875,12 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_CONST == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
}
-
+ zval_ptr_dtor_nogc(free_op_data);
}
} else if (IS_CONST == IS_CONST) {
if (UNEXPECTED(Z_REFCOUNTED_P(value))) {
@@ -40382,9 +38942,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = RT_CONSTANT(opline, opline->op2);
assign_dim_error:
@@ -40404,9 +38962,7 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CONST_OP_DATA_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
@@ -40418,13 +38974,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CONST_OP_DA
try_assign_dim_array:
SEPARATE_ARRAY(object_ptr);
if (IS_CONST == IS_UNUSED) {
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) {
ZVAL_DEREF(value);
}
variable_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(object_ptr), value);
if (UNEXPECTED(variable_ptr == NULL)) {
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
zend_cannot_add_element();
goto assign_dim_error;
} else if (IS_TMP_VAR == IS_CV) {
@@ -40432,6 +38988,7 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_TMP_VAR == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
@@ -40453,7 +39010,7 @@ try_assign_dim_array:
if (UNEXPECTED(variable_ptr == NULL)) {
goto assign_dim_error;
}
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
value = zend_assign_to_variable(variable_ptr, value, IS_TMP_VAR, EX_USES_STRICT_TYPES());
}
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -40468,14 +39025,14 @@ try_assign_dim_array:
}
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) {
dim = RT_CONSTANT(opline, opline->op2);
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_CONST == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
dim++;
}
zend_assign_to_object_dim(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
} else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
if (IS_CONST == IS_UNUSED) {
zend_use_new_element_for_string();
@@ -40483,9 +39040,9 @@ try_assign_dim_array:
UNDEF_RESULT();
} else {
dim = RT_CONSTANT(opline, opline->op2);
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
zend_assign_to_string_offset(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
}
} else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) {
if (Z_ISREF_P(orig_object_ptr)
@@ -40499,9 +39056,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = RT_CONSTANT(opline, opline->op2);
assign_dim_error:
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
@@ -40521,9 +39076,7 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CONST_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
@@ -40535,13 +39088,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CONST_OP_DA
try_assign_dim_array:
SEPARATE_ARRAY(object_ptr);
if (IS_CONST == IS_UNUSED) {
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_CV || IS_VAR == IS_VAR) {
ZVAL_DEREF(value);
}
variable_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(object_ptr), value);
if (UNEXPECTED(variable_ptr == NULL)) {
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
zend_cannot_add_element();
goto assign_dim_error;
} else if (IS_VAR == IS_CV) {
@@ -40549,6 +39102,7 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_VAR == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
@@ -40570,7 +39124,7 @@ try_assign_dim_array:
if (UNEXPECTED(variable_ptr == NULL)) {
goto assign_dim_error;
}
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
value = zend_assign_to_variable(variable_ptr, value, IS_VAR, EX_USES_STRICT_TYPES());
}
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -40585,14 +39139,14 @@ try_assign_dim_array:
}
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) {
dim = RT_CONSTANT(opline, opline->op2);
- value = _get_zval_ptr_var_deref((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var_deref((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_CONST == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
dim++;
}
zend_assign_to_object_dim(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
} else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
if (IS_CONST == IS_UNUSED) {
zend_use_new_element_for_string();
@@ -40600,9 +39154,9 @@ try_assign_dim_array:
UNDEF_RESULT();
} else {
dim = RT_CONSTANT(opline, opline->op2);
- value = _get_zval_ptr_var_deref((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var_deref((opline+1)->op1.var EXECUTE_DATA_CC);
zend_assign_to_string_offset(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
}
} else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) {
if (Z_ISREF_P(orig_object_ptr)
@@ -40616,9 +39170,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = RT_CONSTANT(opline, opline->op2);
assign_dim_error:
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
@@ -40638,9 +39190,7 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CONST_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
@@ -40666,11 +39216,12 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_CV == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
}
-
+ zval_ptr_dtor_nogc(free_op_data);
}
} else if (IS_CV == IS_CONST) {
if (UNEXPECTED(Z_REFCOUNTED_P(value))) {
@@ -40732,9 +39283,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = RT_CONSTANT(opline, opline->op2);
assign_dim_error:
@@ -40754,7 +39303,6 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_CONST_RETVAL_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *value;
zval *variable_ptr;
@@ -40762,27 +39310,19 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_CONST_RETVAL_UN
value = RT_CONSTANT(opline, opline->op2);
variable_ptr = EX_VAR(opline->op1.var);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
-
- if (UNEXPECTED(0)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- value = zend_assign_to_variable(variable_ptr, value, IS_CONST, EX_USES_STRICT_TYPES());
- if (UNEXPECTED(0)) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
-
- /* zend_assign_to_variable() always takes care of op2, never free it! */
+ value = zend_assign_to_variable(variable_ptr, value, IS_CONST, EX_USES_STRICT_TYPES());
+ if (UNEXPECTED(0)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
+ /* zend_assign_to_variable() always takes care of op2, never free it! */
+
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_CONST_RETVAL_USED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *value;
zval *variable_ptr;
@@ -40790,40 +39330,27 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_CONST_RETVAL_US
value = RT_CONSTANT(opline, opline->op2);
variable_ptr = EX_VAR(opline->op1.var);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
-
- if (UNEXPECTED(1)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- value = zend_assign_to_variable(variable_ptr, value, IS_CONST, EX_USES_STRICT_TYPES());
- if (UNEXPECTED(1)) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
-
- /* zend_assign_to_variable() always takes care of op2, never free it! */
+ value = zend_assign_to_variable(variable_ptr, value, IS_CONST, EX_USES_STRICT_TYPES());
+ if (UNEXPECTED(1)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
+ /* zend_assign_to_variable() always takes care of op2, never free it! */
+
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_CV_CONST_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data;
zval *property, *container, *value_ptr;
SAVE_OPLINE();
container = EX_VAR(opline->op1.var);
-
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = RT_CONSTANT(opline, opline->op2);
- value_ptr = _get_zval_ptr_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value_ptr = _get_zval_ptr_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (1) {
if (IS_CV == IS_UNUSED) {
@@ -40844,7 +39371,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_CV_CONST_O
}
- if (UNEXPECTED(free_op_data)) {zval_ptr_dtor_nogc(free_op_data);};
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));;
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -40852,17 +39379,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_CV_CONST_O
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_CV_CONST_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *property, *container, *value_ptr;
SAVE_OPLINE();
container = EX_VAR(opline->op1.var);
-
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = RT_CONSTANT(opline, opline->op2);
value_ptr = _get_zval_ptr_cv_BP_VAR_W((opline+1)->op1.var EXECUTE_DATA_CC);
@@ -40894,7 +39415,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_CV_CONST_O
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
zend_string *op1_str, *op2_str, *str;
@@ -41016,7 +39536,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_S
{
USE_OPLINE
zval *function_name;
- zend_free_op free_op1;
zval *object;
zend_function *fbc;
zend_class_entry *called_scope;
@@ -41028,10 +39547,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_S
object = EX_VAR(opline->op1.var);
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
if (IS_CONST != IS_CONST) {
function_name = RT_CONSTANT(opline, opline->op2);
}
@@ -41111,7 +39626,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_S
HANDLE_EXCEPTION();
}
if (IS_CONST == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE))) &&
EXPECTED(obj == orig_obj)) {
CACHE_POLYMORPHIC_PTR(opline->result.num, called_scope, fbc);
@@ -41141,9 +39655,12 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_S
} else if (IS_CV & (IS_VAR|IS_TMP_VAR|IS_CV)) {
if (IS_CV == IS_CV) {
GC_ADDREF(obj); /* For $this pointer */
- } else if (free_op1 != object) {
- GC_ADDREF(obj); /* For $this pointer */
-
+ } else {
+ zval *free_op1 = EX_VAR(opline->op1.var);
+ if (free_op1 != object) {
+ GC_ADDREF(obj); /* For $this pointer */
+ zval_ptr_dtor_nogc(free_op1);
+ }
}
/* CV may be changed indirectly (e.g. when it's a reference) */
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS | ZEND_CALL_RELEASE_THIS;
@@ -41160,7 +39677,6 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_S
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *expr_ptr, new_expr;
SAVE_OPLINE();
@@ -41199,7 +39715,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CONS
}
if (IS_CONST != IS_UNUSED) {
-
zval *offset = RT_CONSTANT(opline, opline->op2);
zend_string *str;
zend_ulong hval;
@@ -41279,7 +39794,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CV_CONST_HANDL
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
zval *offset;
zend_ulong hval;
@@ -41337,7 +39851,7 @@ num_index_dim:
key = ZSTR_EMPTY_ALLOC();
goto str_index_dim;
} else {
- zend_error(E_WARNING, "Illegal offset type in unset");
+ zend_type_error("Illegal offset type in unset");
}
break;
} else if (Z_ISREF_P(container)) {
@@ -41356,7 +39870,7 @@ num_index_dim:
if (IS_CONST == IS_CONST && Z_EXTRA_P(offset) == ZEND_EXTRA_VALUE) {
offset++;
}
- Z_OBJ_HT_P(container)->unset_dimension(container, offset);
+ Z_OBJ_HT_P(container)->unset_dimension(Z_OBJ_P(container), offset);
} else if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_STRING)) {
zend_throw_error(NULL, "Cannot unset string offsets");
}
@@ -41369,15 +39883,12 @@ num_index_dim:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
container = EX_VAR(opline->op1.var);
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
offset = RT_CONSTANT(opline, opline->op2);
do {
@@ -41395,7 +39906,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_CV_CONST_HANDLE
break;
}
}
- Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL));
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ break;
+ }
+ }
+ Z_OBJ_HT_P(container)->unset_property(Z_OBJ_P(container), name, ((IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL));
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
} while (0);
@@ -41405,7 +39927,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_CV_CONST_HANDLE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
int result;
zend_ulong hval;
@@ -41440,6 +39961,10 @@ num_index_prop:
goto isset_again;
} else {
value = zend_find_array_dim_slow(ht, offset EXECUTE_DATA_CC);
+ if (UNEXPECTED(EG(exception))) {
+ result = 0;
+ goto isset_dim_obj_exit;
+ }
}
if (!(opline->extended_value & ZEND_ISEMPTY)) {
@@ -41451,8 +39976,6 @@ num_index_prop:
/* avoid exception check */
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
} else {
result = (value == NULL || !i_zend_is_true(value));
@@ -41478,25 +40001,18 @@ isset_dim_obj_exit:
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
int result;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_IS(opline->op1.var EXECUTE_DATA_CC);
-
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
offset = RT_CONSTANT(opline, opline->op2);
if (IS_CV == IS_CONST ||
@@ -41513,26 +40029,37 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CV
}
}
+ if (IS_CONST == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ result = 0;
+ goto isset_object_finish;
+ }
+ }
+
result =
(opline->extended_value & ZEND_ISEMPTY) ^
- Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY), ((IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+ Z_OBJ_HT_P(container)->has_property(Z_OBJ_P(container), name, (opline->extended_value & ZEND_ISEMPTY), ((IS_CONST == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+
+ if (IS_CONST != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
isset_object_finish:
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ARRAY_KEY_EXISTS_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *key, *subject;
HashTable *ht;
- uint32_t result;
+ zend_bool result;
SAVE_OPLINE();
@@ -41550,20 +40077,18 @@ array_key_exists_array:
goto array_key_exists_array;
}
}
- result = zend_array_key_exists_slow(subject, key OPLINE_CC EXECUTE_DATA_CC);
+ zend_array_key_exists_error(subject, key OPLINE_CC EXECUTE_DATA_CC);
+ result = 0;
}
- ZEND_VM_SMART_BRANCH(result == IS_TRUE, 1);
- Z_TYPE_INFO_P(EX_VAR(opline->result.var)) = result;
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
+ ZEND_VM_SMART_BRANCH(result, 1);
}
/* No specialization for op_types (CONST|TMPVAR|UNUSED|CV, ANY) */
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *expr;
zend_bool result;
@@ -41605,8 +40130,6 @@ try_instanceof:
}
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -41628,8 +40151,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CONST_HANDLER(ZE
/* Set the new yielded value */
if (IS_CV != IS_UNUSED) {
-
-
if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
/* Constants and temporary variables aren't yieldable by reference,
* but we still allow them with a notice. */
@@ -41697,26 +40218,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CONST_HANDLER(ZE
/* Set the new yielded key */
if (IS_CONST != IS_UNUSED) {
-
zval *key = RT_CONSTANT(opline, opline->op2);
-
- /* Consts, temporary variables and references need copying */
- if (IS_CONST == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_CONST == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_CONST & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
-
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_CONST == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
+ if ((IS_CONST & (IS_CV|IS_VAR)) && UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE) {
+ key = Z_REFVAL_P(key);
}
+ ZVAL_COPY(&generator->key, key);
if (Z_TYPE(generator->key) == IS_LONG
&& Z_LVAL(generator->key) > generator->largest_used_integer_key
@@ -41752,7 +40258,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CONST_HANDLER(ZE
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BIND_GLOBAL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zend_string *varname;
zval *value;
zval *variable_ptr;
@@ -41835,7 +40340,6 @@ check_indirect:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IN_ARRAY_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1;
HashTable *ht = Z_ARRVAL_P(RT_CONSTANT(opline, opline->op2));
zval *result;
@@ -41854,13 +40358,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IN_ARRAY_SPEC_CV_CONST_HANDLER
result = zend_hash_find_ex(ht, ZSTR_EMPTY_ALLOC(), 1);
} else {
zend_string *key;
- zval key_tmp, result_tmp, *val;
+ zval key_tmp, *val;
result = NULL;
ZEND_HASH_FOREACH_STR_KEY_VAL(ht, key, val) {
ZVAL_STR(&key_tmp, key);
- compare_function(&result_tmp, op1, &key_tmp);
- if (Z_LVAL(result_tmp) == 0) {
+ if (zend_compare(op1, &key_tmp) == 0) {
result = val;
break;
}
@@ -41868,14 +40371,40 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IN_ARRAY_SPEC_CV_CONST_HANDLER
}
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result != NULL);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
-static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_R_INDEX_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_NOTHROW_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ /* This is declared below the specializations for MAY_BE_LONG/MAY_BE_DOUBLE so those will be used instead if possible. */
+ /* This optimizes $x === SOME_CONST_EXPR and $x === $y for non-refs and non-undef, which can't throw. */
+ /* (Infinite recursion when comparing arrays is an uncatchable fatal error) */
+ USE_OPLINE
+ zval *op1, *op2;
+ zend_bool result;
+
+ op1 = EX_VAR(opline->op1.var);
+ op2 = RT_CONSTANT(opline, opline->op2);
+ result = fast_is_identical_function(op1, op2);
+ /* Free is a no-op for const/cv */
+ ZEND_VM_SMART_BRANCH(result, 0);
+}
+
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_NOTHROW_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
+ zval *op1, *op2;
+ zend_bool result;
+ op1 = EX_VAR(opline->op1.var);
+ op2 = RT_CONSTANT(opline, opline->op2);
+ result = fast_is_identical_function(op1, op2);
+ /* Free is a no-op for const/cv */
+ ZEND_VM_SMART_BRANCH(!result, 0);
+}
+
+static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_R_INDEX_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
zval *container, *dim, *value;
zend_long offset;
HashTable *ht;
@@ -41928,7 +40457,6 @@ fetch_dim_r_index_undef:
static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_R_INDEX_SPEC_CV_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container, *dim, *value;
zend_long offset;
HashTable *ht;
@@ -41981,41 +40509,38 @@ fetch_dim_r_index_undef:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DIV_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *op1, *op2;
SAVE_OPLINE();
op1 = _get_zval_ptr_cv_BP_VAR_R(opline->op1.var EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
fast_div_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POW_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *op1, *op2;
SAVE_OPLINE();
op1 = _get_zval_ptr_cv_BP_VAR_R(opline->op1.var EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
pow_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *op1, *op2;
op1 = EX_VAR(opline->op1.var);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if ((IS_CV == IS_CONST || EXPECTED(Z_TYPE_P(op1) == IS_STRING)) &&
((IS_TMP_VAR|IS_VAR) == IS_CONST || EXPECTED(Z_TYPE_P(op2) == IS_STRING))) {
@@ -42075,7 +40600,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_CV_TMPVAR_HANDLER(
}
concat_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
}
@@ -42083,26 +40608,21 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_CV_TMPVAR_HANDLER(
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *op1, *op2;
double d1, d2;
op1 = EX_VAR(opline->op1.var);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (1 && IS_CV == IS_CONST && (IS_TMP_VAR|IS_VAR) == IS_CONST) {
/* pass */
} else if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
if (EXPECTED(Z_LVAL_P(op1) == Z_LVAL_P(op2))) {
is_equal_true:
-
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_TRUE_NONE();
} else {
is_equal_false:
-
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_FALSE_NONE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -42146,12 +40666,11 @@ is_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_TMPVAR_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *op1, *op2;
double d1, d2;
op1 = EX_VAR(opline->op1.var);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (1 && IS_CV == IS_CONST && (IS_TMP_VAR|IS_VAR) == IS_CONST) {
/* pass */
} else if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
@@ -42159,13 +40678,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_TMPVAR_JMPZ_H
if (EXPECTED(Z_LVAL_P(op1) == Z_LVAL_P(op2))) {
is_equal_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_equal_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -42209,12 +40724,11 @@ is_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_TMPVAR_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *op1, *op2;
double d1, d2;
op1 = EX_VAR(opline->op1.var);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (1 && IS_CV == IS_CONST && (IS_TMP_VAR|IS_VAR) == IS_CONST) {
/* pass */
} else if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
@@ -42222,13 +40736,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_TMPVAR_JMPNZ_
if (EXPECTED(Z_LVAL_P(op1) == Z_LVAL_P(op2))) {
is_equal_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPNZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_equal_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPNZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -42272,26 +40782,21 @@ is_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *op1, *op2;
double d1, d2;
op1 = EX_VAR(opline->op1.var);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (1 && IS_CV == IS_CONST && (IS_TMP_VAR|IS_VAR) == IS_CONST) {
/* pass */
} else if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
if (EXPECTED(Z_LVAL_P(op1) != Z_LVAL_P(op2))) {
is_not_equal_true:
-
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_TRUE_NONE();
} else {
is_not_equal_false:
-
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_FALSE_NONE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -42335,12 +40840,11 @@ is_not_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_TMPVAR_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *op1, *op2;
double d1, d2;
op1 = EX_VAR(opline->op1.var);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (1 && IS_CV == IS_CONST && (IS_TMP_VAR|IS_VAR) == IS_CONST) {
/* pass */
} else if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
@@ -42348,13 +40852,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_TMPVAR_JM
if (EXPECTED(Z_LVAL_P(op1) != Z_LVAL_P(op2))) {
is_not_equal_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_not_equal_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -42398,12 +40898,11 @@ is_not_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_TMPVAR_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *op1, *op2;
double d1, d2;
op1 = EX_VAR(opline->op1.var);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (1 && IS_CV == IS_CONST && (IS_TMP_VAR|IS_VAR) == IS_CONST) {
/* pass */
} else if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
@@ -42411,13 +40910,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_TMPVAR_JM
if (EXPECTED(Z_LVAL_P(op1) != Z_LVAL_P(op2))) {
is_not_equal_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPNZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_not_equal_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPNZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -42461,55 +40956,49 @@ is_not_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SPACESHIP_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *op1, *op2;
SAVE_OPLINE();
op1 = _get_zval_ptr_cv_BP_VAR_R(opline->op1.var EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
compare_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *op1, *op2;
SAVE_OPLINE();
op1 = _get_zval_ptr_cv_BP_VAR_R(opline->op1.var EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
boolean_xor_function(EX_VAR(opline->result.var), op1, op2);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2, free_op_data;
zval *object;
zval *property;
zval *value;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = EX_VAR(opline->op1.var);
-
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
do {
- value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data);
+ value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1);
if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
@@ -42520,16 +41009,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_CV_TMPVAR_H
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
assign_op_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ UNDEF_RESULT();
+ break;
+ }
+ }
cache_slot = ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR((opline+1)->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -42566,12 +41063,15 @@ assign_op_object:
}
}
} else {
- zend_assign_op_overloaded_property(object, property, cache_slot, value OPLINE_CC EXECUTE_DATA_CC);
+ zend_assign_op_overloaded_property(zobj, name, cache_slot, value OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
- FREE_OP(free_op_data);
- zval_ptr_dtor_nogc(free_op2);
+ FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
@@ -42581,7 +41081,6 @@ assign_op_object:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2, free_op_data1;
zval *var_ptr;
zval *value, *container, *dim;
@@ -42592,7 +41091,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_CV_TMPVAR_H
assign_dim_op_array:
SEPARATE_ARRAY(container);
assign_dim_op_new_array:
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED) {
var_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(container), &EG(uninitialized_zval));
if (UNEXPECTED(!var_ptr)) {
@@ -42610,7 +41109,7 @@ assign_dim_op_new_array:
}
}
- value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data1);
+ value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1);
do {
if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED && UNEXPECTED(Z_ISREF_P(var_ptr))) {
@@ -42627,7 +41126,7 @@ assign_dim_op_new_array:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
- FREE_OP(free_op_data1);
+ FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
} else {
if (EXPECTED(Z_ISREF_P(container))) {
container = Z_REFVAL_P(container);
@@ -42636,7 +41135,7 @@ assign_dim_op_new_array:
}
}
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
if ((IS_TMP_VAR|IS_VAR) == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
@@ -42658,7 +41157,7 @@ assign_dim_op_ret_null:
}
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -42666,37 +41165,30 @@ assign_dim_op_ret_null:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OP_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *var_ptr;
zval *value;
SAVE_OPLINE();
- value = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
var_ptr = _get_zval_ptr_cv_BP_VAR_RW(opline->op1.var EXECUTE_DATA_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_ISERROR_P(var_ptr))) {
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- do {
- if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_REFERENCE)) {
- zend_reference *ref = Z_REF_P(var_ptr);
- var_ptr = Z_REFVAL_P(var_ptr);
- if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
- zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
- break;
- }
+ do {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_REFERENCE)) {
+ zend_reference *ref = Z_REF_P(var_ptr);
+ var_ptr = Z_REFVAL_P(var_ptr);
+ if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
+ zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
- zend_binary_op(var_ptr, var_ptr, value OPLINE_CC);
- } while (0);
-
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
+ zend_binary_op(var_ptr, var_ptr, value OPLINE_CC);
+ } while (0);
+
+ if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
+ ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -42704,21 +41196,17 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OP_SPEC_CV_TMPVAR_HANDL
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *object;
zval *property;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = EX_VAR(opline->op1.var);
-
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
do {
if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
@@ -42730,16 +41218,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_CV_TMPVAR_HAN
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
pre_incdec_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ UNDEF_RESULT();
+ break;
+ }
+ }
cache_slot = ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -42753,11 +41249,14 @@ pre_incdec_object:
zend_pre_incdec_property_zval(zptr, prop_info OPLINE_CC EXECUTE_DATA_CC);
}
} else {
- zend_pre_incdec_overloaded_property(object, property, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ zend_pre_incdec_overloaded_property(zobj, name, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -42765,21 +41264,17 @@ pre_incdec_object:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *object;
zval *property;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = EX_VAR(opline->op1.var);
-
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
do {
if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
@@ -42791,16 +41286,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_CV_TMPVAR_HA
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
post_incdec_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
+ }
cache_slot = ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
ZVAL_NULL(EX_VAR(opline->result.var));
} else {
@@ -42813,11 +41316,14 @@ post_incdec_object:
zend_post_incdec_property_zval(zptr, prop_info OPLINE_CC EXECUTE_DATA_CC);
}
} else {
- zend_post_incdec_overloaded_property(object, property, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ zend_post_incdec_overloaded_property(zobj, name, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -42825,12 +41331,11 @@ post_incdec_object:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *container, *dim, *value;
SAVE_OPLINE();
container = EX_VAR(opline->op1.var);
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (IS_CV != IS_CONST) {
if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
fetch_dim_r_array:
@@ -42853,7 +41358,7 @@ fetch_dim_r_slow:
} else {
zend_fetch_dimension_address_read_R(container, dim, (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -42861,16 +41366,14 @@ fetch_dim_r_slow:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container;
SAVE_OPLINE();
container = EX_VAR(opline->op1.var);
- zend_fetch_dimension_address_W(container, _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op2);
+ zend_fetch_dimension_address_W(container, _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (IS_CV == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -42878,16 +41381,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_TMPVAR_HAN
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container;
SAVE_OPLINE();
container = EX_VAR(opline->op1.var);
- zend_fetch_dimension_address_RW(container, _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op2);
+ zend_fetch_dimension_address_RW(container, _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (IS_CV == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -42895,13 +41396,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_CV_TMPVAR_HA
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *container;
SAVE_OPLINE();
container = EX_VAR(opline->op1.var);
- zend_fetch_dimension_address_read_IS(container, _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op2);
+ zend_fetch_dimension_address_read_IS(container, _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -42928,16 +41428,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_TMP
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container;
SAVE_OPLINE();
container = EX_VAR(opline->op1.var);
- zend_fetch_dimension_address_UNSET(container, _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op2);
+ zend_fetch_dimension_address_UNSET(container, _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC), (IS_TMP_VAR|IS_VAR) OPLINE_CC EXECUTE_DATA_CC);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (IS_CV == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -42945,20 +41443,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_CV_TMPVAR
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
- zend_free_op free_op2;
zval *offset;
void **cache_slot = NULL;
SAVE_OPLINE();
container = EX_VAR(opline->op1.var);
-
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (IS_CV == IS_CONST ||
(IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT))) {
@@ -42984,9 +41475,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CV_TMPVAR_HAN
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value & ~ZEND_FETCH_REF /* FUNC_ARG fetch may contain it */);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -43011,10 +41504,10 @@ fetch_obj_r_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || (IS_CV & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_r_copy;
@@ -43025,7 +41518,7 @@ fetch_obj_r_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -43037,11 +41530,22 @@ fetch_obj_r_fast_copy:
}
}
}
- } else if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
- ZVAL_UNDEFINED_OP2();
+ } else {
+ if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
+ ZVAL_UNDEFINED_OP2();
+ }
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_r_copy:
@@ -43052,7 +41556,7 @@ fetch_obj_r_copy:
} while (0);
fetch_obj_r_finish:
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -43060,25 +41564,20 @@ fetch_obj_r_finish:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *property, *container, *result;
SAVE_OPLINE();
container = EX_VAR(opline->op1.var);
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
result = EX_VAR(opline->result.var);
zend_fetch_property_address(
result, container, IS_CV, property, (IS_TMP_VAR|IS_VAR),
(((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_FETCH_OBJ_FLAGS) : NULL),
BP_VAR_W, opline->extended_value & ZEND_FETCH_OBJ_FLAGS, 1 OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (IS_CV == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -43086,21 +41585,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_TMPVAR_HAN
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *property, *container, *result;
SAVE_OPLINE();
container = EX_VAR(opline->op1.var);
-
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
result = EX_VAR(opline->result.var);
zend_fetch_property_address(result, container, IS_CV, property, (IS_TMP_VAR|IS_VAR), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL), BP_VAR_RW, 0, 1 OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (IS_CV == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -43108,20 +41602,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_CV_TMPVAR_HA
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
- zend_free_op free_op2;
zval *offset;
void **cache_slot = NULL;
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_IS(opline->op1.var EXECUTE_DATA_CC);
-
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (IS_CV == IS_CONST ||
(IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT))) {
@@ -43140,9 +41627,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_TMPVAR_HA
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -43167,10 +41656,10 @@ fetch_obj_is_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || (IS_CV & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_is_copy;
@@ -43181,7 +41670,7 @@ fetch_obj_is_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -43193,9 +41682,19 @@ fetch_obj_is_fast_copy:
}
}
}
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_is_copy:
@@ -43206,7 +41705,7 @@ fetch_obj_is_copy:
} while (0);
fetch_obj_is_finish:
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -43231,22 +41730,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CV_TMP
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1, free_op2;
zval *container, *property, *result;
SAVE_OPLINE();
container = EX_VAR(opline->op1.var);
-
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
result = EX_VAR(opline->result.var);
zend_fetch_property_address(result, container, IS_CV, property, (IS_TMP_VAR|IS_VAR), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL), BP_VAR_UNSET, 0, 1 OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (IS_CV == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -43254,17 +41747,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_TMPVAR
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_TMPVAR_OP_DATA_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = EX_VAR(opline->op1.var);
-
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
value = RT_CONSTANT((opline+1), (opline+1)->op1);
if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
@@ -43272,16 +41761,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_TMPVAR_OP_D
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -43371,15 +41859,30 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ ZVAL_COPY_DEREF(EX_VAR(opline->result.var), value);
}
exit_assign_obj:
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
@@ -43389,34 +41892,29 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_TMPVAR_OP_DATA_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2, free_op_data;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = EX_VAR(opline->op1.var);
-
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -43506,15 +42004,30 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ ZVAL_COPY_DEREF(EX_VAR(opline->result.var), value);
}
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
exit_assign_obj:
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
@@ -43524,34 +42037,29 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_TMPVAR_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2, free_op_data;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = EX_VAR(opline->op1.var);
-
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -43641,15 +42149,30 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ ZVAL_COPY_DEREF(EX_VAR(opline->result.var), value);
}
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
exit_assign_obj:
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
@@ -43659,17 +42182,13 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_TMPVAR_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = EX_VAR(opline->op1.var);
-
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
value = _get_zval_ptr_cv_BP_VAR_R((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
@@ -43677,16 +42196,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_TMPVAR_OP_D
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -43776,15 +42294,30 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, ((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ ZVAL_COPY_DEREF(EX_VAR(opline->result.var), value);
}
exit_assign_obj:
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
/* assign_obj has two opcodes! */
ZEND_VM_NEXT_OPCODE_EX(1, 2);
@@ -43794,9 +42327,7 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_TMPVAR_OP_DATA_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op2, free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
@@ -43822,11 +42353,12 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_CONST == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
}
-
+ zval_ptr_dtor_nogc(free_op_data);
}
} else if (IS_CONST == IS_CONST) {
if (UNEXPECTED(Z_REFCOUNTED_P(value))) {
@@ -43834,7 +42366,7 @@ try_assign_dim_array:
}
}
} else {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
variable_ptr = zend_fetch_dimension_address_inner_W_CONST(Z_ARRVAL_P(object_ptr), dim EXECUTE_DATA_CC);
} else {
@@ -43857,7 +42389,7 @@ try_assign_dim_array:
}
}
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
value = RT_CONSTANT((opline+1), (opline+1)->op1);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
@@ -43871,7 +42403,7 @@ try_assign_dim_array:
UNDEF_RESULT();
} else {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
value = RT_CONSTANT((opline+1), (opline+1)->op1);
zend_assign_to_string_offset(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
@@ -43880,7 +42412,7 @@ try_assign_dim_array:
if (Z_ISREF_P(orig_object_ptr)
&& ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(orig_object_ptr))
&& !zend_verify_ref_array_assignable(Z_REF_P(orig_object_ptr))) {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
UNDEF_RESULT();
} else {
@@ -43888,10 +42420,8 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ zend_use_scalar_as_array();
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
assign_dim_error:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -43900,7 +42430,7 @@ assign_dim_error:
}
}
if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED) {
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
}
/* assign_dim has two opcodes! */
@@ -43910,9 +42440,7 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_TMPVAR_OP_DATA_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op2, free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
@@ -43924,13 +42452,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_TMPVAR_OP_D
try_assign_dim_array:
SEPARATE_ARRAY(object_ptr);
if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED) {
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) {
ZVAL_DEREF(value);
}
variable_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(object_ptr), value);
if (UNEXPECTED(variable_ptr == NULL)) {
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
zend_cannot_add_element();
goto assign_dim_error;
} else if (IS_TMP_VAR == IS_CV) {
@@ -43938,6 +42466,7 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_TMP_VAR == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
@@ -43950,7 +42479,7 @@ try_assign_dim_array:
}
}
} else {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
variable_ptr = zend_fetch_dimension_address_inner_W_CONST(Z_ARRVAL_P(object_ptr), dim EXECUTE_DATA_CC);
} else {
@@ -43959,7 +42488,7 @@ try_assign_dim_array:
if (UNEXPECTED(variable_ptr == NULL)) {
goto assign_dim_error;
}
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
value = zend_assign_to_variable(variable_ptr, value, IS_TMP_VAR, EX_USES_STRICT_TYPES());
}
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -43973,31 +42502,31 @@ try_assign_dim_array:
}
}
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
dim++;
}
zend_assign_to_object_dim(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
} else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED) {
zend_use_new_element_for_string();
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
UNDEF_RESULT();
} else {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
zend_assign_to_string_offset(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
}
} else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) {
if (Z_ISREF_P(orig_object_ptr)
&& ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(orig_object_ptr))
&& !zend_verify_ref_array_assignable(Z_REF_P(orig_object_ptr))) {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
UNDEF_RESULT();
} else {
@@ -44005,10 +42534,8 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ zend_use_scalar_as_array();
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
assign_dim_error:
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -44017,7 +42544,7 @@ assign_dim_error:
}
}
if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED) {
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
}
/* assign_dim has two opcodes! */
@@ -44027,9 +42554,7 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_TMPVAR_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op2, free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
@@ -44041,13 +42566,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_TMPVAR_OP_D
try_assign_dim_array:
SEPARATE_ARRAY(object_ptr);
if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED) {
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_CV || IS_VAR == IS_VAR) {
ZVAL_DEREF(value);
}
variable_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(object_ptr), value);
if (UNEXPECTED(variable_ptr == NULL)) {
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
zend_cannot_add_element();
goto assign_dim_error;
} else if (IS_VAR == IS_CV) {
@@ -44055,6 +42580,7 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_VAR == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
@@ -44067,7 +42593,7 @@ try_assign_dim_array:
}
}
} else {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
variable_ptr = zend_fetch_dimension_address_inner_W_CONST(Z_ARRVAL_P(object_ptr), dim EXECUTE_DATA_CC);
} else {
@@ -44076,7 +42602,7 @@ try_assign_dim_array:
if (UNEXPECTED(variable_ptr == NULL)) {
goto assign_dim_error;
}
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
value = zend_assign_to_variable(variable_ptr, value, IS_VAR, EX_USES_STRICT_TYPES());
}
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -44090,31 +42616,31 @@ try_assign_dim_array:
}
}
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- value = _get_zval_ptr_var_deref((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var_deref((opline+1)->op1.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
dim++;
}
zend_assign_to_object_dim(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
} else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED) {
zend_use_new_element_for_string();
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
UNDEF_RESULT();
} else {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- value = _get_zval_ptr_var_deref((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var_deref((opline+1)->op1.var EXECUTE_DATA_CC);
zend_assign_to_string_offset(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
}
} else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) {
if (Z_ISREF_P(orig_object_ptr)
&& ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(orig_object_ptr))
&& !zend_verify_ref_array_assignable(Z_REF_P(orig_object_ptr))) {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
UNDEF_RESULT();
} else {
@@ -44122,10 +42648,8 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ zend_use_scalar_as_array();
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
assign_dim_error:
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -44134,7 +42658,7 @@ assign_dim_error:
}
}
if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED) {
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
}
/* assign_dim has two opcodes! */
@@ -44144,9 +42668,7 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_TMPVAR_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op2, free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
@@ -44172,11 +42694,12 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_CV == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
}
-
+ zval_ptr_dtor_nogc(free_op_data);
}
} else if (IS_CV == IS_CONST) {
if (UNEXPECTED(Z_REFCOUNTED_P(value))) {
@@ -44184,7 +42707,7 @@ try_assign_dim_array:
}
}
} else {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
variable_ptr = zend_fetch_dimension_address_inner_W_CONST(Z_ARRVAL_P(object_ptr), dim EXECUTE_DATA_CC);
} else {
@@ -44207,7 +42730,7 @@ try_assign_dim_array:
}
}
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
value = _get_zval_ptr_cv_deref_BP_VAR_R((opline+1)->op1.var EXECUTE_DATA_CC);
if ((IS_TMP_VAR|IS_VAR) == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
@@ -44221,7 +42744,7 @@ try_assign_dim_array:
UNDEF_RESULT();
} else {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
value = _get_zval_ptr_cv_deref_BP_VAR_R((opline+1)->op1.var EXECUTE_DATA_CC);
zend_assign_to_string_offset(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
@@ -44230,7 +42753,7 @@ try_assign_dim_array:
if (Z_ISREF_P(orig_object_ptr)
&& ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(orig_object_ptr))
&& !zend_verify_ref_array_assignable(Z_REF_P(orig_object_ptr))) {
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
UNDEF_RESULT();
} else {
@@ -44238,10 +42761,8 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
- dim = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ zend_use_scalar_as_array();
+ dim = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
assign_dim_error:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -44250,7 +42771,7 @@ assign_dim_error:
}
}
if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED) {
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
}
/* assign_dim has two opcodes! */
@@ -44260,20 +42781,14 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_CV_TMPVAR_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2, free_op_data;
zval *property, *container, *value_ptr;
SAVE_OPLINE();
container = EX_VAR(opline->op1.var);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
-
- value_ptr = _get_zval_ptr_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value_ptr = _get_zval_ptr_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (1) {
if (IS_CV == IS_UNUSED) {
@@ -44293,8 +42808,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_CV_TMPVAR_
zend_assign_to_property_reference(container, IS_CV, property, (IS_TMP_VAR|IS_VAR), value_ptr OPLINE_CC EXECUTE_DATA_CC);
}
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(free_op_data)) {zval_ptr_dtor_nogc(free_op_data);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));;
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -44302,18 +42817,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_CV_TMPVAR_
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_CV_TMPVAR_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *property, *container, *value_ptr;
SAVE_OPLINE();
container = EX_VAR(opline->op1.var);
-
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- property = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ property = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
value_ptr = _get_zval_ptr_cv_BP_VAR_W((opline+1)->op1.var EXECUTE_DATA_CC);
@@ -44335,7 +42844,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_CV_TMPVAR_
zend_assign_to_property_reference(container, IS_CV, property, (IS_TMP_VAR|IS_VAR), value_ptr OPLINE_CC EXECUTE_DATA_CC);
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -44344,13 +42853,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_CV_TMPVAR_
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *op1, *op2;
zend_string *op1_str, *op2_str, *str;
op1 = EX_VAR(opline->op1.var);
- op2 = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if ((IS_CV == IS_CONST || EXPECTED(Z_TYPE_P(op1) == IS_STRING)) &&
((IS_TMP_VAR|IS_VAR) == IS_CONST || EXPECTED(Z_TYPE_P(op2) == IS_STRING))) {
zend_string *op1_str = Z_STR_P(op1);
@@ -44458,7 +42966,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_CV_TMPVAR_HAN
}
} while (0);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -44466,7 +42974,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMPVA
{
USE_OPLINE
zval *function_name;
- zend_free_op free_op1, free_op2;
zval *object;
zend_function *fbc;
zend_class_entry *called_scope;
@@ -44478,12 +42985,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMPVA
object = EX_VAR(opline->op1.var);
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
- function_name = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ function_name = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
}
if ((IS_TMP_VAR|IS_VAR) != IS_CONST &&
@@ -44502,7 +43005,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMPVA
}
}
zend_throw_error(NULL, "Method name must be a string");
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
HANDLE_EXCEPTION();
} while (0);
@@ -44521,16 +43024,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMPVA
object = ZVAL_UNDEFINED_OP1();
if (UNEXPECTED(EG(exception) != NULL)) {
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
}
HANDLE_EXCEPTION();
}
}
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
- function_name = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ function_name = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
}
zend_invalid_method_call(object, function_name);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
HANDLE_EXCEPTION();
}
@@ -44547,7 +43050,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMPVA
zend_object *orig_obj = obj;
if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
- function_name = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ function_name = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
}
/* First, locate the function. */
@@ -44556,12 +43059,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMPVA
if (EXPECTED(!EG(exception))) {
zend_undefined_method(obj->ce, Z_STR_P(function_name));
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
HANDLE_EXCEPTION();
}
if ((IS_TMP_VAR|IS_VAR) == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE))) &&
EXPECTED(obj == orig_obj)) {
CACHE_POLYMORPHIC_PTR(opline->result.num, called_scope, fbc);
@@ -44576,7 +43078,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMPVA
}
if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
}
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS;
@@ -44591,9 +43093,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMPVA
} else if (IS_CV & (IS_VAR|IS_TMP_VAR|IS_CV)) {
if (IS_CV == IS_CV) {
GC_ADDREF(obj); /* For $this pointer */
- } else if (free_op1 != object) {
- GC_ADDREF(obj); /* For $this pointer */
-
+ } else {
+ zval *free_op1 = EX_VAR(opline->op1.var);
+ if (free_op1 != object) {
+ GC_ADDREF(obj); /* For $this pointer */
+ zval_ptr_dtor_nogc(free_op1);
+ }
}
/* CV may be changed indirectly (e.g. when it's a reference) */
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS | ZEND_CALL_RELEASE_THIS;
@@ -44610,7 +43115,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMPVA
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *expr_ptr, new_expr;
SAVE_OPLINE();
@@ -44649,8 +43153,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_TMPV
}
if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED) {
- zend_free_op free_op2;
- zval *offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ zval *offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
zend_string *str;
zend_ulong hval;
@@ -44695,7 +43198,7 @@ num_index:
zend_illegal_offset();
zval_ptr_dtor_nogc(expr_ptr);
}
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
} else {
if (!zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr)) {
zend_cannot_add_element();
@@ -44729,7 +43232,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CV_TMPVAR_HAND
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *container;
zval *offset;
zend_ulong hval;
@@ -44737,7 +43239,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_TMPVAR_HANDL
SAVE_OPLINE();
container = EX_VAR(opline->op1.var);
- offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
do {
if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
@@ -44787,7 +43289,7 @@ num_index_dim:
key = ZSTR_EMPTY_ALLOC();
goto str_index_dim;
} else {
- zend_error(E_WARNING, "Illegal offset type in unset");
+ zend_type_error("Illegal offset type in unset");
}
break;
} else if (Z_ISREF_P(container)) {
@@ -44806,13 +43308,13 @@ num_index_dim:
if ((IS_TMP_VAR|IS_VAR) == IS_CONST && Z_EXTRA_P(offset) == ZEND_EXTRA_VALUE) {
offset++;
}
- Z_OBJ_HT_P(container)->unset_dimension(container, offset);
+ Z_OBJ_HT_P(container)->unset_dimension(Z_OBJ_P(container), offset);
} else if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_STRING)) {
zend_throw_error(NULL, "Cannot unset string offsets");
}
} while (0);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -44820,16 +43322,13 @@ num_index_dim:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *container;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
container = EX_VAR(opline->op1.var);
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
- offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
do {
if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) {
@@ -44846,10 +43345,21 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_CV_TMPVAR_HANDL
break;
}
}
- Z_OBJ_HT_P(container)->unset_property(container, offset, (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL));
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ break;
+ }
+ }
+ Z_OBJ_HT_P(container)->unset_property(Z_OBJ_P(container), name, (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL));
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
} while (0);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -44857,7 +43367,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_CV_TMPVAR_HANDL
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *container;
int result;
zend_ulong hval;
@@ -44865,7 +43374,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CV_
SAVE_OPLINE();
container = EX_VAR(opline->op1.var);
- offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
HashTable *ht;
@@ -44892,6 +43401,10 @@ num_index_prop:
goto isset_again;
} else {
value = zend_find_array_dim_slow(ht, offset EXECUTE_DATA_CC);
+ if (UNEXPECTED(EG(exception))) {
+ result = 0;
+ goto isset_dim_obj_exit;
+ }
}
if (!(opline->extended_value & ZEND_ISEMPTY)) {
@@ -44901,10 +43414,8 @@ num_index_prop:
if (IS_CV & (IS_CONST|IS_CV)) {
/* avoid exception check */
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
} else {
result = (value == NULL || !i_zend_is_true(value));
@@ -44927,29 +43438,22 @@ num_index_prop:
}
isset_dim_obj_exit:
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *container;
int result;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_IS(opline->op1.var EXECUTE_DATA_CC);
-
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- offset = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ offset = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (IS_CV == IS_CONST ||
(IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT))) {
@@ -44965,31 +43469,42 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CV
}
}
+ if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ result = 0;
+ goto isset_object_finish;
+ }
+ }
+
result =
(opline->extended_value & ZEND_ISEMPTY) ^
- Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+ Z_OBJ_HT_P(container)->has_property(Z_OBJ_P(container), name, (opline->extended_value & ZEND_ISEMPTY), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+
+ if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
isset_object_finish:
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ARRAY_KEY_EXISTS_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *key, *subject;
HashTable *ht;
- uint32_t result;
+ zend_bool result;
SAVE_OPLINE();
key = EX_VAR(opline->op1.var);
- subject = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ subject = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
if (EXPECTED(Z_TYPE_P(subject) == IS_ARRAY)) {
array_key_exists_array:
@@ -45002,110 +43517,17 @@ array_key_exists_array:
goto array_key_exists_array;
}
}
- result = zend_array_key_exists_slow(subject, key OPLINE_CC EXECUTE_DATA_CC);
+ zend_array_key_exists_error(subject, key OPLINE_CC EXECUTE_DATA_CC);
+ result = 0;
}
- zval_ptr_dtor_nogc(free_op2);
-
- ZEND_VM_SMART_BRANCH(result == IS_TRUE, 1);
- Z_TYPE_INFO_P(EX_VAR(opline->result.var)) = result;
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
-}
-
-/* No specialization for op_types (CONST|TMPVAR|UNUSED|CV, ANY) */
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
- zend_free_op free_op2;
- zval *op1, *op2;
- zend_bool result;
-
- SAVE_OPLINE();
- op1 = _get_zval_ptr_cv_deref_BP_VAR_R(opline->op1.var EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_tmp(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- result = fast_is_identical_function(op1, op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
- zval_ptr_dtor_nogc(free_op2);
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
-}
-
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
- zend_free_op free_op2;
- zval *op1, *op2;
- zend_bool result;
-
- SAVE_OPLINE();
- op1 = _get_zval_ptr_cv_deref_BP_VAR_R(opline->op1.var EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_tmp(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- result = fast_is_not_identical_function(op1, op2);
-
- zval_ptr_dtor_nogc(free_op2);
- ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
-}
-
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_TMP_RETVAL_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
- zend_free_op free_op2;
- zval *value;
- zval *variable_ptr;
-
- SAVE_OPLINE();
- value = _get_zval_ptr_tmp(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- variable_ptr = EX_VAR(opline->op1.var);
-
- if (IS_CV == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(0)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- value = zend_assign_to_variable(variable_ptr, value, IS_TMP_VAR, EX_USES_STRICT_TYPES());
- if (UNEXPECTED(0)) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
-
- /* zend_assign_to_variable() always takes care of op2, never free it! */
- }
-
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
-}
-
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_TMP_RETVAL_USED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
- zend_free_op free_op2;
- zval *value;
- zval *variable_ptr;
-
- SAVE_OPLINE();
- value = _get_zval_ptr_tmp(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
- variable_ptr = EX_VAR(opline->op1.var);
-
- if (IS_CV == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(1)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- value = zend_assign_to_variable(variable_ptr, value, IS_TMP_VAR, EX_USES_STRICT_TYPES());
- if (UNEXPECTED(1)) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
-
- /* zend_assign_to_variable() always takes care of op2, never free it! */
- }
-
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+/* No specialization for op_types (CONST|TMPVAR|UNUSED|CV, ANY) */
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -45124,8 +43546,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CV_TMP_HANDLER(ZEND
/* Set the new yielded value */
if (IS_CV != IS_UNUSED) {
-
-
if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
/* Constants and temporary variables aren't yieldable by reference,
* but we still allow them with a notice. */
@@ -45192,27 +43612,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CV_TMP_HANDLER(ZEND
}
/* Set the new yielded key */
- if (IS_TMP_VAR != IS_UNUSED) {
- zend_free_op free_op2;
- zval *key = _get_zval_ptr_tmp(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
-
- /* Consts, temporary variables and references need copying */
- if (IS_TMP_VAR == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_TMP_VAR == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_TMP_VAR & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
-
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_TMP_VAR == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
+ if ((IS_TMP_VAR|IS_VAR) != IS_UNUSED) {
+ zval *key = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
+ if (((IS_TMP_VAR|IS_VAR) & (IS_CV|IS_VAR)) && UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE) {
+ key = Z_REFVAL_P(key);
}
+ ZVAL_COPY(&generator->key, key);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
if (Z_TYPE(generator->key) == IS_LONG
&& Z_LVAL(generator->key) > generator->largest_used_integer_key
@@ -45245,118 +43651,161 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CV_TMP_HANDLER(ZEND
ZEND_VM_RETURN();
}
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *op1, *op2;
zend_bool result;
SAVE_OPLINE();
op1 = _get_zval_ptr_cv_deref_BP_VAR_R(opline->op1.var EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_var_deref(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_tmp(opline->op2.var EXECUTE_DATA_CC);
result = fast_is_identical_function(op1, op2);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
+}
+
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zval *op1, *op2;
+ zend_bool result;
+
+ SAVE_OPLINE();
+ op1 = _get_zval_ptr_cv_deref_BP_VAR_R(opline->op1.var EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_tmp(opline->op2.var EXECUTE_DATA_CC);
+ result = fast_is_not_identical_function(op1, op2);
+
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ ZEND_VM_SMART_BRANCH(result, 1);
+}
+
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_TMP_RETVAL_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zval *value;
+ zval *variable_ptr;
+
+ SAVE_OPLINE();
+ value = _get_zval_ptr_tmp(opline->op2.var EXECUTE_DATA_CC);
+ variable_ptr = EX_VAR(opline->op1.var);
+
+ value = zend_assign_to_variable(variable_ptr, value, IS_TMP_VAR, EX_USES_STRICT_TYPES());
+ if (UNEXPECTED(0)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
+ }
+
+ /* zend_assign_to_variable() always takes care of op2, never free it! */
+
+ ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
+}
+
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_TMP_RETVAL_USED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zval *value;
+ zval *variable_ptr;
+
+ SAVE_OPLINE();
+ value = _get_zval_ptr_tmp(opline->op2.var EXECUTE_DATA_CC);
+ variable_ptr = EX_VAR(opline->op1.var);
+
+ value = zend_assign_to_variable(variable_ptr, value, IS_TMP_VAR, EX_USES_STRICT_TYPES());
+ if (UNEXPECTED(1)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
+ }
+
+ /* zend_assign_to_variable() always takes care of op2, never free it! */
+
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zval *op1, *op2;
+ zend_bool result;
+
+ SAVE_OPLINE();
+ op1 = _get_zval_ptr_cv_deref_BP_VAR_R(opline->op1.var EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var_deref(opline->op2.var EXECUTE_DATA_CC);
+ result = fast_is_identical_function(op1, op2);
+
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
+ ZEND_VM_SMART_BRANCH(result, 1);
+}
+
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *op1, *op2;
zend_bool result;
SAVE_OPLINE();
op1 = _get_zval_ptr_cv_deref_BP_VAR_R(opline->op1.var EXECUTE_DATA_CC);
- op2 = _get_zval_ptr_var_deref(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ op2 = _get_zval_ptr_var_deref(opline->op2.var EXECUTE_DATA_CC);
result = fast_is_not_identical_function(op1, op2);
- zval_ptr_dtor_nogc(free_op2);
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_VAR_RETVAL_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *value;
zval *variable_ptr;
SAVE_OPLINE();
- value = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
variable_ptr = EX_VAR(opline->op1.var);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(0)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- value = zend_assign_to_variable(variable_ptr, value, IS_VAR, EX_USES_STRICT_TYPES());
- if (UNEXPECTED(0)) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
-
- /* zend_assign_to_variable() always takes care of op2, never free it! */
+ value = zend_assign_to_variable(variable_ptr, value, IS_VAR, EX_USES_STRICT_TYPES());
+ if (UNEXPECTED(0)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
+ /* zend_assign_to_variable() always takes care of op2, never free it! */
+
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_VAR_RETVAL_USED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *value;
zval *variable_ptr;
SAVE_OPLINE();
- value = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC);
variable_ptr = EX_VAR(opline->op1.var);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
- zval_ptr_dtor_nogc(free_op2);
- if (UNEXPECTED(1)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- value = zend_assign_to_variable(variable_ptr, value, IS_VAR, EX_USES_STRICT_TYPES());
- if (UNEXPECTED(1)) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
-
- /* zend_assign_to_variable() always takes care of op2, never free it! */
+ value = zend_assign_to_variable(variable_ptr, value, IS_VAR, EX_USES_STRICT_TYPES());
+ if (UNEXPECTED(1)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
+ /* zend_assign_to_variable() always takes care of op2, never free it! */
+
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op2;
zval *variable_ptr;
zval *value_ptr;
SAVE_OPLINE();
- value_ptr = _get_zval_ptr_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
+ value_ptr = _get_zval_ptr_ptr_var(opline->op2.var EXECUTE_DATA_CC);
variable_ptr = EX_VAR(opline->op1.var);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
- variable_ptr = &EG(uninitialized_zval);
- } else if (IS_CV == IS_VAR &&
+ if (IS_CV == IS_VAR &&
UNEXPECTED(Z_TYPE_P(EX_VAR(opline->op1.var)) != IS_INDIRECT)) {
zend_throw_error(NULL, "Cannot assign by reference to an array dimension of an object");
variable_ptr = &EG(uninitialized_zval);
- } else if (IS_VAR == IS_VAR && UNEXPECTED(Z_ISERROR_P(value_ptr))) {
- variable_ptr = &EG(uninitialized_zval);
} else if (IS_VAR == IS_VAR &&
opline->extended_value == ZEND_RETURNS_FUNCTION &&
UNEXPECTED(!Z_ISREF_P(value_ptr))) {
@@ -45372,7 +43821,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_CV_VAR_HANDLER
ZVAL_COPY(EX_VAR(opline->result.var), variable_ptr);
}
- if (UNEXPECTED(free_op2)) {zval_ptr_dtor_nogc(free_op2);};
+ zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -45380,7 +43829,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_CV_VAR_HANDLER
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *expr;
zend_bool result;
@@ -45422,154 +43870,11 @@ try_instanceof:
}
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
-}
-
-static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
-{
- USE_OPLINE
-
- zend_generator *generator = zend_get_running_generator(EXECUTE_DATA_C);
-
- SAVE_OPLINE();
- if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
- ZEND_VM_TAIL_CALL(zend_yield_in_closed_generator_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
- /* Destroy the previously yielded value */
- zval_ptr_dtor(&generator->value);
-
- /* Destroy the previously yielded key */
- zval_ptr_dtor(&generator->key);
-
- /* Set the new yielded value */
- if (IS_CV != IS_UNUSED) {
-
-
- if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
- /* Constants and temporary variables aren't yieldable by reference,
- * but we still allow them with a notice. */
- if (IS_CV & (IS_CONST|IS_TMP_VAR)) {
- zval *value;
-
- zend_error(E_NOTICE, "Only variable references should be yielded by reference");
-
- value = _get_zval_ptr_cv_BP_VAR_R(opline->op1.var EXECUTE_DATA_CC);
- ZVAL_COPY_VALUE(&generator->value, value);
- if (IS_CV == IS_CONST) {
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->value))) {
- Z_ADDREF(generator->value);
- }
- }
- } else {
- zval *value_ptr = _get_zval_ptr_cv_BP_VAR_W(opline->op1.var EXECUTE_DATA_CC);
-
- /* If a function call result is yielded and the function did
- * not return by reference we throw a notice. */
- do {
- if (IS_CV == IS_VAR) {
- ZEND_ASSERT(value_ptr != &EG(uninitialized_zval));
- if (opline->extended_value == ZEND_RETURNS_FUNCTION
- && !Z_ISREF_P(value_ptr)) {
- zend_error(E_NOTICE, "Only variable references should be yielded by reference");
- ZVAL_COPY(&generator->value, value_ptr);
- break;
- }
- }
- if (Z_ISREF_P(value_ptr)) {
- Z_ADDREF_P(value_ptr);
- } else {
- ZVAL_MAKE_REF_EX(value_ptr, 2);
- }
- ZVAL_REF(&generator->value, Z_REF_P(value_ptr));
- } while (0);
-
- }
- } else {
- zval *value = _get_zval_ptr_cv_BP_VAR_R(opline->op1.var EXECUTE_DATA_CC);
-
- /* Consts, temporary variables and references need copying */
- if (IS_CV == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->value, value);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->value))) {
- Z_ADDREF(generator->value);
- }
- } else if (IS_CV == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->value, value);
- } else if ((IS_CV & (IS_VAR|IS_CV)) && Z_ISREF_P(value)) {
- ZVAL_COPY(&generator->value, Z_REFVAL_P(value));
-
- } else {
- ZVAL_COPY_VALUE(&generator->value, value);
- if (IS_CV == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
- }
- }
- }
- } else {
- /* If no value was specified yield null */
- ZVAL_NULL(&generator->value);
- }
-
- /* Set the new yielded key */
- if (IS_VAR != IS_UNUSED) {
- zend_free_op free_op2;
- zval *key = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC);
-
- /* Consts, temporary variables and references need copying */
- if (IS_VAR == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_VAR == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_VAR & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
- zval_ptr_dtor_nogc(free_op2);
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_VAR == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
- }
-
- if (Z_TYPE(generator->key) == IS_LONG
- && Z_LVAL(generator->key) > generator->largest_used_integer_key
- ) {
- generator->largest_used_integer_key = Z_LVAL(generator->key);
- }
- } else {
- /* If no key was specified we use auto-increment keys */
- generator->largest_used_integer_key++;
- ZVAL_LONG(&generator->key, generator->largest_used_integer_key);
- }
-
- if (RETURN_VALUE_USED(opline)) {
- /* If the return value of yield is used set the send
- * target and initialize it to NULL */
- generator->send_target = EX_VAR(opline->result.var);
- ZVAL_NULL(generator->send_target);
- } else {
- generator->send_target = NULL;
- }
-
- /* We increment to the next op, so we are at the correct position when the
- * generator is resumed. */
- ZEND_VM_INC_OPCODE();
-
- /* The GOTO VM uses a local opline variable. We need to set the opline
- * variable in execute_data so we don't resume at an old position. */
- SAVE_OPLINE();
-
- ZEND_VM_RETURN();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data1;
zval *var_ptr;
zval *value, *container, *dim;
@@ -45598,7 +43903,7 @@ assign_dim_op_new_array:
}
}
- value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data1);
+ value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1);
do {
if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_ISREF_P(var_ptr))) {
@@ -45615,7 +43920,7 @@ assign_dim_op_new_array:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
- FREE_OP(free_op_data1);
+ FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
} else {
if (EXPECTED(Z_ISREF_P(container))) {
container = Z_REFVAL_P(container);
@@ -45653,7 +43958,6 @@ assign_dim_op_ret_null:
static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CV_UNUSED(int type ZEND_OPCODE_HANDLER_ARGS_DC)
{
USE_OPLINE
-
zval *varname;
zval *retval;
zend_string *name, *tmp_name;
@@ -45695,7 +43999,7 @@ fetch_this:
} else if (type == BP_VAR_IS) {
retval = &EG(uninitialized_zval);
} else {
- zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name));
+ zend_error(E_WARNING, "Undefined variable: %s", ZSTR_VAL(name));
if (type == BP_VAR_RW) {
retval = zend_hash_update(target_symbol_table, name, &EG(uninitialized_zval));
} else {
@@ -45714,7 +44018,7 @@ fetch_this:
} else if (type == BP_VAR_IS) {
retval = &EG(uninitialized_zval);
} else {
- zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name));
+ zend_error(E_WARNING, "Undefined variable: %s", ZSTR_VAL(name));
if (type == BP_VAR_RW) {
ZVAL_NULL(retval);
} else {
@@ -45778,7 +44082,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_IS_SPEC_CV_UNUSED_HANDLE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
SAVE_OPLINE();
@@ -45786,8 +44089,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_UNUSED_HAN
zend_fetch_dimension_address_W(container, NULL, IS_UNUSED OPLINE_CC EXECUTE_DATA_CC);
if (IS_CV == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -45795,7 +44097,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_UNUSED_HAN
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
SAVE_OPLINE();
@@ -45803,8 +44104,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_CV_UNUSED_HA
zend_fetch_dimension_address_RW(container, NULL, IS_UNUSED OPLINE_CC EXECUTE_DATA_CC);
if (IS_CV == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -45831,9 +44131,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_UNU
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_OP_DATA_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
@@ -45859,11 +44157,12 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_CONST == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
}
-
+ zval_ptr_dtor_nogc(free_op_data);
}
} else if (IS_CONST == IS_CONST) {
if (UNEXPECTED(Z_REFCOUNTED_P(value))) {
@@ -45925,9 +44224,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = NULL;
assign_dim_error:
@@ -45947,9 +44244,7 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_OP_DATA_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
@@ -45961,13 +44256,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_OP_D
try_assign_dim_array:
SEPARATE_ARRAY(object_ptr);
if (IS_UNUSED == IS_UNUSED) {
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) {
ZVAL_DEREF(value);
}
variable_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(object_ptr), value);
if (UNEXPECTED(variable_ptr == NULL)) {
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
zend_cannot_add_element();
goto assign_dim_error;
} else if (IS_TMP_VAR == IS_CV) {
@@ -45975,6 +44270,7 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_TMP_VAR == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
@@ -45996,7 +44292,7 @@ try_assign_dim_array:
if (UNEXPECTED(variable_ptr == NULL)) {
goto assign_dim_error;
}
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
value = zend_assign_to_variable(variable_ptr, value, IS_TMP_VAR, EX_USES_STRICT_TYPES());
}
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -46011,14 +44307,14 @@ try_assign_dim_array:
}
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) {
dim = NULL;
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_UNUSED == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
dim++;
}
zend_assign_to_object_dim(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
} else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
if (IS_UNUSED == IS_UNUSED) {
zend_use_new_element_for_string();
@@ -46026,9 +44322,9 @@ try_assign_dim_array:
UNDEF_RESULT();
} else {
dim = NULL;
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
zend_assign_to_string_offset(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
}
} else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) {
if (Z_ISREF_P(orig_object_ptr)
@@ -46042,9 +44338,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = NULL;
assign_dim_error:
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
@@ -46064,9 +44358,7 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
@@ -46078,13 +44370,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_OP_D
try_assign_dim_array:
SEPARATE_ARRAY(object_ptr);
if (IS_UNUSED == IS_UNUSED) {
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_CV || IS_VAR == IS_VAR) {
ZVAL_DEREF(value);
}
variable_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(object_ptr), value);
if (UNEXPECTED(variable_ptr == NULL)) {
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
zend_cannot_add_element();
goto assign_dim_error;
} else if (IS_VAR == IS_CV) {
@@ -46092,6 +44384,7 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_VAR == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
@@ -46113,7 +44406,7 @@ try_assign_dim_array:
if (UNEXPECTED(variable_ptr == NULL)) {
goto assign_dim_error;
}
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
value = zend_assign_to_variable(variable_ptr, value, IS_VAR, EX_USES_STRICT_TYPES());
}
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -46128,14 +44421,14 @@ try_assign_dim_array:
}
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) {
dim = NULL;
- value = _get_zval_ptr_var_deref((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var_deref((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_UNUSED == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
dim++;
}
zend_assign_to_object_dim(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
} else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
if (IS_UNUSED == IS_UNUSED) {
zend_use_new_element_for_string();
@@ -46143,9 +44436,9 @@ try_assign_dim_array:
UNDEF_RESULT();
} else {
dim = NULL;
- value = _get_zval_ptr_var_deref((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var_deref((opline+1)->op1.var EXECUTE_DATA_CC);
zend_assign_to_string_offset(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
}
} else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) {
if (Z_ISREF_P(orig_object_ptr)
@@ -46159,9 +44452,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = NULL;
assign_dim_error:
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
@@ -46181,9 +44472,7 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_UNUSED_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
@@ -46209,11 +44498,12 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_CV == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
}
-
+ zval_ptr_dtor_nogc(free_op_data);
}
} else if (IS_CV == IS_CONST) {
if (UNEXPECTED(Z_REFCOUNTED_P(value))) {
@@ -46275,9 +44565,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = NULL;
assign_dim_error:
@@ -46298,16 +44586,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_VERIFY_RETURN_TYPE_SPEC_CV_UNU
{
USE_OPLINE
- SAVE_OPLINE();
if (IS_CV == IS_UNUSED) {
+ SAVE_OPLINE();
zend_verify_missing_return_type(EX(func), CACHE_ADDR(opline->op2.num));
+ HANDLE_EXCEPTION();
} else {
/* prevents "undefined variable opline" errors */
#if 0 || (IS_CV != IS_UNUSED)
zval *retval_ref, *retval_ptr;
-
zend_arg_info *ret_info = EX(func)->common.arg_info - 1;
-
retval_ref = retval_ptr = _get_zval_ptr_cv_BP_VAR_R(opline->op1.var EXECUTE_DATA_CC);
if (IS_CV == IS_CONST) {
@@ -46322,32 +44609,40 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_VERIFY_RETURN_TYPE_SPEC_CV_UNU
ZVAL_DEREF(retval_ptr);
}
- if (UNEXPECTED(!ZEND_TYPE_IS_CLASS(ret_info->type)
- && ZEND_TYPE_CODE(ret_info->type) != IS_CALLABLE
- && ZEND_TYPE_CODE(ret_info->type) != IS_ITERABLE
- && !ZEND_SAME_FAKE_TYPE(ZEND_TYPE_CODE(ret_info->type), Z_TYPE_P(retval_ptr))
- && !(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)
- && retval_ref != retval_ptr)
- ) {
- /* A cast might happen - unwrap the reference if this is a by-value return */
- if (Z_REFCOUNT_P(retval_ref) == 1) {
- ZVAL_UNREF(retval_ref);
+ if (EXPECTED(ZEND_TYPE_CONTAINS_CODE(ret_info->type, Z_TYPE_P(retval_ptr)))) {
+ ZEND_VM_NEXT_OPCODE();
+ }
+
+ zend_reference *ref = NULL;
+ void *cache_slot = CACHE_ADDR(opline->op2.num);
+ if (UNEXPECTED(retval_ref != retval_ptr)) {
+ if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
+ ref = Z_REF_P(retval_ref);
} else {
- Z_DELREF_P(retval_ref);
- ZVAL_COPY(retval_ref, retval_ptr);
+ /* A cast might happen - unwrap the reference if this is a by-value return */
+ if (Z_REFCOUNT_P(retval_ref) == 1) {
+ ZVAL_UNREF(retval_ref);
+ } else {
+ Z_DELREF_P(retval_ref);
+ ZVAL_COPY(retval_ref, retval_ptr);
+ }
+ retval_ptr = retval_ref;
}
- retval_ptr = retval_ref;
}
- zend_verify_return_type(EX(func), retval_ptr, CACHE_ADDR(opline->op2.num));
+
+ SAVE_OPLINE();
+ if (UNEXPECTED(!zend_check_type_slow(ret_info->type, retval_ptr, ref, cache_slot, NULL, 1, 0))) {
+ zend_verify_return_error(EX(func), cache_slot, retval_ptr);
+ HANDLE_EXCEPTION();
+ }
+ ZEND_VM_NEXT_OPCODE();
#endif
}
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *expr_ptr, new_expr;
SAVE_OPLINE();
@@ -46386,7 +44681,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_UNUS
}
if (IS_UNUSED != IS_UNUSED) {
-
zval *offset = NULL;
zend_string *str;
zend_ulong hval;
@@ -46492,7 +44786,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_VAR_SPEC_CV_UNUSED_HANDL
zend_string *name, *tmp_name;
HashTable *target_symbol_table;
-
SAVE_OPLINE();
varname = EX_VAR(opline->op1.var);
@@ -46534,25 +44827,15 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_CV_S
if (Z_TYPE_P(value) > IS_NULL &&
(!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL)) {
ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else {
int result;
SAVE_OPLINE();
result = !i_zend_is_true(value);
- if (UNEXPECTED(EG(exception))) {
- ZVAL_UNDEF(EX_VAR(opline->result.var));
- HANDLE_EXCEPTION();
- }
- ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH(result, 1);
}
}
@@ -46566,25 +44849,15 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_CV_S
if (Z_TYPE_P(value) > IS_NULL &&
(!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL)) {
ZEND_VM_SMART_BRANCH_TRUE();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
ZEND_VM_SMART_BRANCH_FALSE();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else {
int result;
SAVE_OPLINE();
result = !i_zend_is_true(value);
- if (UNEXPECTED(EG(exception))) {
- ZVAL_UNDEF(EX_VAR(opline->result.var));
- HANDLE_EXCEPTION();
- }
- ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH(result, 1);
}
}
@@ -46593,7 +44866,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_UNUS
USE_OPLINE
zval *value;
int result;
-
zval *varname;
zend_string *name, *tmp_name;
HashTable *target_symbol_table;
@@ -46630,15 +44902,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_UNUS
}
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
/* No specialization for op_types (CONST|TMPVAR|CV, UNUSED|CLASS_FETCH|CONST|VAR) */
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *expr;
zend_bool result;
@@ -46680,8 +44949,6 @@ try_instanceof:
}
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -46703,8 +44970,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CV_UNUSED_HANDLER(Z
/* Set the new yielded value */
if (IS_CV != IS_UNUSED) {
-
-
if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
/* Constants and temporary variables aren't yieldable by reference,
* but we still allow them with a notice. */
@@ -46772,26 +45037,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CV_UNUSED_HANDLER(Z
/* Set the new yielded key */
if (IS_UNUSED != IS_UNUSED) {
-
zval *key = NULL;
-
- /* Consts, temporary variables and references need copying */
- if (IS_UNUSED == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_UNUSED == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_UNUSED & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
-
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_UNUSED == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
+ if ((IS_UNUSED & (IS_CV|IS_VAR)) && UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE) {
+ key = Z_REFVAL_P(key);
}
+ ZVAL_COPY(&generator->key, key);
if (Z_TYPE(generator->key) == IS_LONG
&& Z_LVAL(generator->key) > generator->largest_used_integer_key
@@ -46827,7 +45077,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CV_UNUSED_HANDLER(Z
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BIND_STATIC_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
HashTable *ht;
zval *value;
zval *variable_ptr;
@@ -46927,7 +45176,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_MAKE_REF_SPEC_CV_UNUSED_HANDLE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COUNT_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1;
zend_long count;
@@ -46938,9 +45186,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COUNT_SPEC_CV_UNUSED_HANDLER(Z
count = zend_array_count(Z_ARRVAL_P(op1));
break;
} else if (Z_TYPE_P(op1) == IS_OBJECT) {
+ zend_object *zobj = Z_OBJ_P(op1);
+
/* first, we check if the handler is defined */
- if (Z_OBJ_HT_P(op1)->count_elements) {
- if (SUCCESS == Z_OBJ_HT_P(op1)->count_elements(op1, &count)) {
+ if (zobj->handlers->count_elements) {
+ if (SUCCESS == zobj->handlers->count_elements(zobj, &count)) {
break;
}
if (UNEXPECTED(EG(exception))) {
@@ -46950,10 +45200,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COUNT_SPEC_CV_UNUSED_HANDLER(Z
}
/* if not and the object implements Countable we call its count() method */
- if (instanceof_function(Z_OBJCE_P(op1), zend_ce_countable)) {
+ if (zend_class_implements_interface(zobj->ce, zend_ce_countable)) {
zval retval;
- zend_call_method_with_0_params(op1, NULL, NULL, "count", &retval);
+ zend_call_method_with_0_params(zobj, NULL, NULL, "count", &retval);
count = zval_get_long(&retval);
zval_ptr_dtor(&retval);
break;
@@ -46996,7 +45246,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GET_CLASS_SPEC_CV_UNUSED_HANDL
ZEND_VM_NEXT_OPCODE();
}
} else {
-
zval *op1;
SAVE_OPLINE();
@@ -47011,8 +45260,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GET_CLASS_SPEC_CV_UNUSED_HANDL
if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_P(op1) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- zend_error(E_WARNING, "get_class() expects parameter 1 to be object, %s given", zend_get_type_by_const(Z_TYPE_P(op1)));
- ZVAL_FALSE(EX_VAR(opline->result.var));
+ zend_type_error("get_class() expects parameter 1 to be object, %s given", zend_get_type_by_const(Z_TYPE_P(op1)));
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
}
break;
}
@@ -47024,7 +45273,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GET_CLASS_SPEC_CV_UNUSED_HANDL
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GET_TYPE_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1;
zend_string *type;
@@ -47043,7 +45291,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GET_TYPE_SPEC_CV_UNUSED_HANDLE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DIV_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
SAVE_OPLINE();
@@ -47058,7 +45305,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DIV_SPEC_CV_CV_HANDLER(ZEND_OP
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POW_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
SAVE_OPLINE();
@@ -47073,7 +45319,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POW_SPEC_CV_CV_HANDLER(ZEND_OP
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
op1 = EX_VAR(opline->op1.var);
@@ -47145,7 +45390,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_CV_CV_HANDLER(ZEND
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
zend_bool result;
@@ -47156,14 +45400,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CV_CV_HANDLE
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
zend_bool result;
@@ -47174,14 +45415,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CV_CV_HA
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -47193,14 +45431,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_CV_HANDLER(ZE
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
if (EXPECTED(Z_LVAL_P(op1) == Z_LVAL_P(op2))) {
is_equal_true:
-
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_TRUE_NONE();
} else {
is_equal_false:
-
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_FALSE_NONE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -47244,7 +45478,6 @@ is_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_CV_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -47257,13 +45490,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_CV_JMPZ_HANDL
if (EXPECTED(Z_LVAL_P(op1) == Z_LVAL_P(op2))) {
is_equal_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_equal_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -47307,7 +45536,6 @@ is_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_CV_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -47320,13 +45548,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CV_CV_JMPNZ_HAND
if (EXPECTED(Z_LVAL_P(op1) == Z_LVAL_P(op2))) {
is_equal_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPNZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_equal_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPNZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -47370,7 +45594,6 @@ is_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -47382,14 +45605,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_CV_HANDLE
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
if (EXPECTED(Z_LVAL_P(op1) != Z_LVAL_P(op2))) {
is_not_equal_true:
-
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_TRUE_NONE();
} else {
is_not_equal_false:
-
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
+ ZEND_VM_SMART_BRANCH_FALSE_NONE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -47433,7 +45652,6 @@ is_not_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_CV_JMPZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -47446,13 +45664,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_CV_JMPZ_H
if (EXPECTED(Z_LVAL_P(op1) != Z_LVAL_P(op2))) {
is_not_equal_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_not_equal_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -47496,7 +45710,6 @@ is_not_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_CV_JMPNZ_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
double d1, d2;
@@ -47509,13 +45722,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CV_CV_JMPNZ_
if (EXPECTED(Z_LVAL_P(op1) != Z_LVAL_P(op2))) {
is_not_equal_true:
ZEND_VM_SMART_BRANCH_TRUE_JMPNZ();
- ZVAL_TRUE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
} else {
is_not_equal_false:
ZEND_VM_SMART_BRANCH_FALSE_JMPNZ();
- ZVAL_FALSE(EX_VAR(opline->result.var));
- ZEND_VM_NEXT_OPCODE();
}
} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
d1 = (double)Z_LVAL_P(op1);
@@ -47559,7 +45768,6 @@ is_not_equal_double:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SPACESHIP_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
SAVE_OPLINE();
@@ -47574,7 +45782,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SPACESHIP_SPEC_CV_CV_HANDLER(Z
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
SAVE_OPLINE();
@@ -47589,25 +45796,21 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_CV_CV_HANDLER(ZE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data;
zval *object;
zval *property;
zval *value;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = EX_VAR(opline->op1.var);
-
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
do {
- value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data);
+ value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1);
if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
@@ -47618,16 +45821,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_CV_CV_HANDL
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
assign_op_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ UNDEF_RESULT();
+ break;
+ }
+ }
cache_slot = (IS_CV == IS_CONST) ? CACHE_ADDR((opline+1)->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -47664,11 +45875,14 @@ assign_op_object:
}
}
} else {
- zend_assign_op_overloaded_property(object, property, cache_slot, value OPLINE_CC EXECUTE_DATA_CC);
+ zend_assign_op_overloaded_property(zobj, name, cache_slot, value OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
- FREE_OP(free_op_data);
+ FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
/* assign_obj has two opcodes! */
@@ -47679,7 +45893,6 @@ assign_op_object:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_OP_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data1;
zval *var_ptr;
zval *value, *container, *dim;
@@ -47708,7 +45921,7 @@ assign_dim_op_new_array:
}
}
- value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data1);
+ value = get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1);
do {
if (IS_CV != IS_UNUSED && UNEXPECTED(Z_ISREF_P(var_ptr))) {
@@ -47725,7 +45938,7 @@ assign_dim_op_new_array:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
- FREE_OP(free_op_data1);
+ FREE_OP((opline+1)->op1_type, (opline+1)->op1.var);
} else {
if (EXPECTED(Z_ISREF_P(container))) {
container = Z_REFVAL_P(container);
@@ -47763,7 +45976,6 @@ assign_dim_op_ret_null:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OP_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *var_ptr;
zval *value;
@@ -47771,26 +45983,20 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OP_SPEC_CV_CV_HANDLER(Z
value = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
var_ptr = _get_zval_ptr_cv_BP_VAR_RW(opline->op1.var EXECUTE_DATA_CC);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_ISERROR_P(var_ptr))) {
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- do {
- if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_REFERENCE)) {
- zend_reference *ref = Z_REF_P(var_ptr);
- var_ptr = Z_REFVAL_P(var_ptr);
- if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
- zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
- break;
- }
+ do {
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_REFERENCE)) {
+ zend_reference *ref = Z_REF_P(var_ptr);
+ var_ptr = Z_REFVAL_P(var_ptr);
+ if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(ref))) {
+ zend_binary_assign_op_typed_ref(ref, value OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
- zend_binary_op(var_ptr, var_ptr, value OPLINE_CC);
- } while (0);
-
- if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
+ zend_binary_op(var_ptr, var_ptr, value OPLINE_CC);
+ } while (0);
+
+ if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
+ ZVAL_COPY(EX_VAR(opline->result.var), var_ptr);
}
@@ -47800,20 +46006,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OP_SPEC_CV_CV_HANDLER(Z
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object;
zval *property;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = EX_VAR(opline->op1.var);
-
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
do {
@@ -47826,16 +46028,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_CV_CV_HANDLER
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
pre_incdec_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ UNDEF_RESULT();
+ break;
+ }
+ }
cache_slot = (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -47849,7 +46059,10 @@ pre_incdec_object:
zend_pre_incdec_property_zval(zptr, prop_info OPLINE_CC EXECUTE_DATA_CC);
}
} else {
- zend_pre_incdec_overloaded_property(object, property, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ zend_pre_incdec_overloaded_property(zobj, name, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
@@ -47860,20 +46073,16 @@ pre_incdec_object:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object;
zval *property;
zval *zptr;
void **cache_slot;
zend_property_info *prop_info;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = EX_VAR(opline->op1.var);
-
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
do {
@@ -47886,16 +46095,24 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_CV_CV_HANDLE
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- break;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ break;
}
post_incdec_object:
/* here we are sure we are dealing with an object */
+ zobj = Z_OBJ_P(object);
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
+ }
cache_slot = (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL;
- if (EXPECTED((zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, cache_slot)) != NULL)) {
+ if (EXPECTED((zptr = zobj->handlers->get_property_ptr_ptr(zobj, name, BP_VAR_RW, cache_slot)) != NULL)) {
if (UNEXPECTED(Z_ISERROR_P(zptr))) {
ZVAL_NULL(EX_VAR(opline->result.var));
} else {
@@ -47908,7 +46125,10 @@ post_incdec_object:
zend_post_incdec_property_zval(zptr, prop_info OPLINE_CC EXECUTE_DATA_CC);
}
} else {
- zend_post_incdec_overloaded_property(object, property, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ zend_post_incdec_overloaded_property(zobj, name, cache_slot OPLINE_CC EXECUTE_DATA_CC);
+ }
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
}
} while (0);
@@ -47919,7 +46139,6 @@ post_incdec_object:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container, *dim, *value;
SAVE_OPLINE();
@@ -47955,7 +46174,6 @@ fetch_dim_r_slow:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
SAVE_OPLINE();
@@ -47963,8 +46181,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_CV_HANDLER
zend_fetch_dimension_address_W(container, EX_VAR(opline->op2.var), IS_CV OPLINE_CC EXECUTE_DATA_CC);
if (IS_CV == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -47972,7 +46189,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_W_SPEC_CV_CV_HANDLER
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
SAVE_OPLINE();
@@ -47980,8 +46196,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_CV_CV_HANDLE
zend_fetch_dimension_address_RW(container, EX_VAR(opline->op2.var), IS_CV OPLINE_CC EXECUTE_DATA_CC);
if (IS_CV == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -47989,7 +46204,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_RW_SPEC_CV_CV_HANDLE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
SAVE_OPLINE();
@@ -48022,7 +46236,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CV_CV_
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container;
SAVE_OPLINE();
@@ -48030,8 +46243,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_CV_CV_HAN
zend_fetch_dimension_address_UNSET(container, EX_VAR(opline->op2.var), IS_CV OPLINE_CC EXECUTE_DATA_CC);
if (IS_CV == IS_VAR) {
- zval *result = EX_VAR(opline->result.var);
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -48039,19 +46251,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_UNSET_SPEC_CV_CV_HAN
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
-
zval *offset;
void **cache_slot = NULL;
SAVE_OPLINE();
container = EX_VAR(opline->op1.var);
-
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
offset = EX_VAR(opline->op2.var);
if (IS_CV == IS_CONST ||
@@ -48078,9 +46283,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CV_CV_HANDLER
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if (IS_CV == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value & ~ZEND_FETCH_REF /* FUNC_ARG fetch may contain it */);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -48105,10 +46312,10 @@ fetch_obj_r_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || (IS_CV & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_r_copy;
@@ -48119,7 +46326,7 @@ fetch_obj_r_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -48131,11 +46338,22 @@ fetch_obj_r_fast_copy:
}
}
}
- } else if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
- ZVAL_UNDEFINED_OP2();
+ } else {
+ if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(offset) == IS_UNDEF)) {
+ ZVAL_UNDEFINED_OP2();
+ }
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_R, cache_slot, EX_VAR(opline->result.var));
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_r_copy:
@@ -48154,16 +46372,11 @@ fetch_obj_r_finish:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *property, *container, *result;
SAVE_OPLINE();
container = EX_VAR(opline->op1.var);
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
result = EX_VAR(opline->result.var);
zend_fetch_property_address(
@@ -48172,7 +46385,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_CV_HANDLER
BP_VAR_W, opline->extended_value & ZEND_FETCH_OBJ_FLAGS, 1 OPLINE_CC EXECUTE_DATA_CC);
if (IS_CV == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -48180,21 +46393,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_W_SPEC_CV_CV_HANDLER
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *property, *container, *result;
SAVE_OPLINE();
container = EX_VAR(opline->op1.var);
-
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
result = EX_VAR(opline->result.var);
zend_fetch_property_address(result, container, IS_CV, property, IS_CV, ((IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL), BP_VAR_RW, 0, 1 OPLINE_CC EXECUTE_DATA_CC);
if (IS_CV == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -48202,19 +46410,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_CV_CV_HANDLE
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
-
zval *offset;
void **cache_slot = NULL;
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_IS(opline->op1.var EXECUTE_DATA_CC);
-
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
offset = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
if (IS_CV == IS_CONST ||
@@ -48234,9 +46435,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_CV_HANDLE
/* here we are sure we are dealing with an object */
do {
zend_object *zobj = Z_OBJ_P(container);
+ zend_string *name, *tmp_name;
zval *retval;
if (IS_CV == IS_CONST) {
+ name = Z_STR_P(offset);
cache_slot = CACHE_ADDR(opline->extended_value);
if (EXPECTED(zobj->ce == CACHED_PTR_EX(cache_slot))) {
@@ -48261,10 +46464,10 @@ fetch_obj_is_fast_copy:
Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
- (EXPECTED(p->key == Z_STR_P(offset)) ||
- (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ (EXPECTED(p->key == name) ||
+ (EXPECTED(p->h == ZSTR_H(name)) &&
EXPECTED(p->key != NULL) &&
- EXPECTED(zend_string_equal_content(p->key, Z_STR_P(offset)))))) {
+ EXPECTED(zend_string_equal_content(p->key, name))))) {
retval = &p->val;
if (0 || (IS_CV & (IS_TMP_VAR|IS_VAR)) != 0) {
goto fetch_obj_is_copy;
@@ -48275,7 +46478,7 @@ fetch_obj_is_fast_copy:
}
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
}
- retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
+ retval = zend_hash_find_ex(zobj->properties, name, 1);
if (EXPECTED(retval)) {
uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -48287,9 +46490,19 @@ fetch_obj_is_fast_copy:
}
}
}
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ break;
+ }
}
- retval = zobj->handlers->read_property(container, offset, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_IS, cache_slot, EX_VAR(opline->result.var));
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
if (retval != EX_VAR(opline->result.var)) {
fetch_obj_is_copy:
@@ -48325,22 +46538,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CV_CV_
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op1;
zval *container, *property, *result;
SAVE_OPLINE();
container = EX_VAR(opline->op1.var);
-
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
result = EX_VAR(opline->result.var);
zend_fetch_property_address(result, container, IS_CV, property, IS_CV, ((IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL), BP_VAR_UNSET, 0, 1 OPLINE_CC EXECUTE_DATA_CC);
if (IS_CV == IS_VAR) {
- FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(free_op1, result);
+ FREE_VAR_PTR_AND_EXTRACT_RESULT_IF_NECESSARY(opline->op1.var);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -48348,16 +46555,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_CV_HAN
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CV_OP_DATA_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = EX_VAR(opline->op1.var);
-
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
value = RT_CONSTANT((opline+1), (opline+1)->op1);
@@ -48366,16 +46569,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CV_OP_DATA_
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CV == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -48465,11 +46667,26 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ ZVAL_COPY_DEREF(EX_VAR(opline->result.var), value);
}
exit_assign_obj:
@@ -48483,34 +46700,29 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CV_OP_DATA_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = EX_VAR(opline->op1.var);
-
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CV == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -48600,13 +46812,28 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ ZVAL_COPY_DEREF(EX_VAR(opline->result.var), value);
}
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
exit_assign_obj:
@@ -48618,34 +46845,29 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CV_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data;
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = EX_VAR(opline->op1.var);
-
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
if (Z_ISREF_P(object) && Z_TYPE_P(Z_REFVAL_P(object)) == IS_OBJECT) {
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CV == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -48735,13 +46957,28 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ ZVAL_COPY_DEREF(EX_VAR(opline->result.var), value);
}
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
exit_assign_obj:
@@ -48753,16 +46990,12 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CV_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object, *property, *value, tmp;
+ zend_object *zobj;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
object = EX_VAR(opline->op1.var);
-
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
value = _get_zval_ptr_cv_BP_VAR_R((opline+1)->op1.var EXECUTE_DATA_CC);
@@ -48771,16 +47004,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CV_OP_DATA_
object = Z_REFVAL_P(object);
goto assign_object;
}
- object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
- if (UNEXPECTED(!object)) {
- value = &EG(uninitialized_zval);
- goto free_and_exit_assign_obj;
- }
+ zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
+ value = &EG(uninitialized_zval);
+ goto free_and_exit_assign_obj;
}
assign_object:
+ zobj = Z_OBJ_P(object);
if (IS_CV == IS_CONST &&
- EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(opline->extended_value))) {
+ EXPECTED(zobj->ce == CACHED_PTR(opline->extended_value))) {
void **cache_slot = CACHE_ADDR(opline->extended_value);
uintptr_t prop_offset = (uintptr_t)CACHED_PTR_EX(cache_slot + 1);
zend_object *zobj = Z_OBJ_P(object);
@@ -48870,11 +47102,26 @@ fast_assign_obj:
ZVAL_DEREF(value);
}
- value = Z_OBJ_HT_P(object)->write_property(object, property, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(property);
+ } else {
+ name = zval_try_get_tmp_string(property, &tmp_name);
+ if (UNEXPECTED(!name)) {
+
+ UNDEF_RESULT();
+ goto exit_assign_obj;
+ }
+ }
+
+ value = zobj->handlers->write_property(zobj, name, value, (IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
free_and_exit_assign_obj:
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
+ ZVAL_COPY_DEREF(EX_VAR(opline->result.var), value);
}
exit_assign_obj:
@@ -48888,9 +47135,7 @@ exit_assign_obj:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CV_OP_DATA_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
@@ -48916,11 +47161,12 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_CONST == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
}
-
+ zval_ptr_dtor_nogc(free_op_data);
}
} else if (IS_CONST == IS_CONST) {
if (UNEXPECTED(Z_REFCOUNTED_P(value))) {
@@ -48982,9 +47228,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
assign_dim_error:
@@ -49004,9 +47248,7 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CV_OP_DATA_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
@@ -49018,13 +47260,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CV_OP_DATA_
try_assign_dim_array:
SEPARATE_ARRAY(object_ptr);
if (IS_CV == IS_UNUSED) {
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) {
ZVAL_DEREF(value);
}
variable_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(object_ptr), value);
if (UNEXPECTED(variable_ptr == NULL)) {
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
zend_cannot_add_element();
goto assign_dim_error;
} else if (IS_TMP_VAR == IS_CV) {
@@ -49032,6 +47274,7 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_TMP_VAR == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
@@ -49053,7 +47296,7 @@ try_assign_dim_array:
if (UNEXPECTED(variable_ptr == NULL)) {
goto assign_dim_error;
}
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
value = zend_assign_to_variable(variable_ptr, value, IS_TMP_VAR, EX_USES_STRICT_TYPES());
}
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -49068,14 +47311,14 @@ try_assign_dim_array:
}
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) {
dim = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_CV == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
dim++;
}
zend_assign_to_object_dim(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
} else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
if (IS_CV == IS_UNUSED) {
zend_use_new_element_for_string();
@@ -49083,9 +47326,9 @@ try_assign_dim_array:
UNDEF_RESULT();
} else {
dim = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
- value = _get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC);
zend_assign_to_string_offset(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
}
} else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) {
if (Z_ISREF_P(orig_object_ptr)
@@ -49099,9 +47342,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
assign_dim_error:
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
@@ -49121,9 +47362,7 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CV_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
@@ -49135,13 +47374,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CV_OP_DATA_
try_assign_dim_array:
SEPARATE_ARRAY(object_ptr);
if (IS_CV == IS_UNUSED) {
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_VAR == IS_CV || IS_VAR == IS_VAR) {
ZVAL_DEREF(value);
}
variable_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(object_ptr), value);
if (UNEXPECTED(variable_ptr == NULL)) {
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
zend_cannot_add_element();
goto assign_dim_error;
} else if (IS_VAR == IS_CV) {
@@ -49149,6 +47388,7 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_VAR == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
@@ -49170,7 +47410,7 @@ try_assign_dim_array:
if (UNEXPECTED(variable_ptr == NULL)) {
goto assign_dim_error;
}
- value = _get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
value = zend_assign_to_variable(variable_ptr, value, IS_VAR, EX_USES_STRICT_TYPES());
}
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
@@ -49185,14 +47425,14 @@ try_assign_dim_array:
}
if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) {
dim = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
- value = _get_zval_ptr_var_deref((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var_deref((opline+1)->op1.var EXECUTE_DATA_CC);
if (IS_CV == IS_CONST && Z_EXTRA_P(dim) == ZEND_EXTRA_VALUE) {
dim++;
}
zend_assign_to_object_dim(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
} else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
if (IS_CV == IS_UNUSED) {
zend_use_new_element_for_string();
@@ -49200,9 +47440,9 @@ try_assign_dim_array:
UNDEF_RESULT();
} else {
dim = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
- value = _get_zval_ptr_var_deref((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value = _get_zval_ptr_var_deref((opline+1)->op1.var EXECUTE_DATA_CC);
zend_assign_to_string_offset(object_ptr, dim, value OPLINE_CC EXECUTE_DATA_CC);
- zval_ptr_dtor_nogc(free_op_data);
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
}
} else if (EXPECTED(Z_TYPE_P(object_ptr) <= IS_FALSE)) {
if (Z_ISREF_P(orig_object_ptr)
@@ -49216,9 +47456,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
assign_dim_error:
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
@@ -49238,9 +47476,7 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_DIM_SPEC_CV_CV_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *object_ptr, *orig_object_ptr;
- zend_free_op free_op_data;
zval *value;
zval *variable_ptr;
zval *dim;
@@ -49266,11 +47502,12 @@ try_assign_dim_array:
Z_ADDREF_P(value);
}
} else if (IS_CV == IS_VAR) {
+ zval *free_op_data = EX_VAR((opline+1)->op1.var);
if (value != free_op_data) {
if (Z_REFCOUNTED_P(value)) {
Z_ADDREF_P(value);
}
-
+ zval_ptr_dtor_nogc(free_op_data);
}
} else if (IS_CV == IS_CONST) {
if (UNEXPECTED(Z_REFCOUNTED_P(value))) {
@@ -49332,9 +47569,7 @@ try_assign_dim_array:
goto try_assign_dim_array;
}
} else {
- if (IS_CV != IS_VAR || EXPECTED(!Z_ISERROR_P(object_ptr))) {
- zend_use_scalar_as_array();
- }
+ zend_use_scalar_as_array();
dim = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
assign_dim_error:
@@ -49354,7 +47589,6 @@ assign_dim_error:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_CV_RETVAL_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *value;
zval *variable_ptr;
@@ -49362,27 +47596,19 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_CV_RETVAL_UNUSE
value = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
variable_ptr = EX_VAR(opline->op1.var);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
-
- if (UNEXPECTED(0)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- value = zend_assign_to_variable(variable_ptr, value, IS_CV, EX_USES_STRICT_TYPES());
- if (UNEXPECTED(0)) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
-
- /* zend_assign_to_variable() always takes care of op2, never free it! */
+ value = zend_assign_to_variable(variable_ptr, value, IS_CV, EX_USES_STRICT_TYPES());
+ if (UNEXPECTED(0)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
+ /* zend_assign_to_variable() always takes care of op2, never free it! */
+
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_CV_RETVAL_USED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *value;
zval *variable_ptr;
@@ -49390,27 +47616,19 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_SPEC_CV_CV_RETVAL_USED_
value = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
variable_ptr = EX_VAR(opline->op1.var);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
-
- if (UNEXPECTED(1)) {
- ZVAL_NULL(EX_VAR(opline->result.var));
- }
- } else {
- value = zend_assign_to_variable(variable_ptr, value, IS_CV, EX_USES_STRICT_TYPES());
- if (UNEXPECTED(1)) {
- ZVAL_COPY(EX_VAR(opline->result.var), value);
- }
-
- /* zend_assign_to_variable() always takes care of op2, never free it! */
+ value = zend_assign_to_variable(variable_ptr, value, IS_CV, EX_USES_STRICT_TYPES());
+ if (UNEXPECTED(1)) {
+ ZVAL_COPY(EX_VAR(opline->result.var), value);
}
+ /* zend_assign_to_variable() always takes care of op2, never free it! */
+
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *variable_ptr;
zval *value_ptr;
@@ -49418,15 +47636,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_CV_CV_HANDLER(
value_ptr = _get_zval_ptr_cv_BP_VAR_W(opline->op2.var EXECUTE_DATA_CC);
variable_ptr = EX_VAR(opline->op1.var);
- if (IS_CV == IS_VAR && UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
- variable_ptr = &EG(uninitialized_zval);
- } else if (IS_CV == IS_VAR &&
+ if (IS_CV == IS_VAR &&
UNEXPECTED(Z_TYPE_P(EX_VAR(opline->op1.var)) != IS_INDIRECT)) {
zend_throw_error(NULL, "Cannot assign by reference to an array dimension of an object");
variable_ptr = &EG(uninitialized_zval);
- } else if (IS_CV == IS_VAR && UNEXPECTED(Z_ISERROR_P(value_ptr))) {
- variable_ptr = &EG(uninitialized_zval);
} else if (IS_CV == IS_VAR &&
opline->extended_value == ZEND_RETURNS_FUNCTION &&
UNEXPECTED(!Z_ISREF_P(value_ptr))) {
@@ -49449,20 +47663,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_CV_CV_HANDLER(
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_CV_CV_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
- zend_free_op free_op_data;
zval *property, *container, *value_ptr;
SAVE_OPLINE();
container = EX_VAR(opline->op1.var);
-
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
- value_ptr = _get_zval_ptr_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC);
+ value_ptr = _get_zval_ptr_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC);
if (1) {
if (IS_CV == IS_UNUSED) {
@@ -49483,7 +47691,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_CV_CV_OP_D
}
- if (UNEXPECTED(free_op_data)) {zval_ptr_dtor_nogc(free_op_data);};
+ zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));;
ZEND_VM_NEXT_OPCODE_EX(1, 2);
}
@@ -49491,17 +47699,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_CV_CV_OP_D
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_CV_CV_OP_DATA_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *property, *container, *value_ptr;
SAVE_OPLINE();
container = EX_VAR(opline->op1.var);
-
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
property = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
value_ptr = _get_zval_ptr_cv_BP_VAR_W((opline+1)->op1.var EXECUTE_DATA_CC);
@@ -49533,7 +47735,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_REF_SPEC_CV_CV_OP_D
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *op1, *op2;
zend_string *op1_str, *op2_str, *str;
@@ -49655,7 +47856,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HA
{
USE_OPLINE
zval *function_name;
- zend_free_op free_op1;
zval *object;
zend_function *fbc;
zend_class_entry *called_scope;
@@ -49667,10 +47867,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HA
object = EX_VAR(opline->op1.var);
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
if (IS_CV != IS_CONST) {
function_name = EX_VAR(opline->op2.var);
}
@@ -49750,7 +47946,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HA
HANDLE_EXCEPTION();
}
if (IS_CV == IS_CONST &&
- EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE))) &&
EXPECTED(obj == orig_obj)) {
CACHE_POLYMORPHIC_PTR(opline->result.num, called_scope, fbc);
@@ -49780,9 +47975,12 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HA
} else if (IS_CV & (IS_VAR|IS_TMP_VAR|IS_CV)) {
if (IS_CV == IS_CV) {
GC_ADDREF(obj); /* For $this pointer */
- } else if (free_op1 != object) {
- GC_ADDREF(obj); /* For $this pointer */
-
+ } else {
+ zval *free_op1 = EX_VAR(opline->op1.var);
+ if (free_op1 != object) {
+ GC_ADDREF(obj); /* For $this pointer */
+ zval_ptr_dtor_nogc(free_op1);
+ }
}
/* CV may be changed indirectly (e.g. when it's a reference) */
call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_HAS_THIS | ZEND_CALL_RELEASE_THIS;
@@ -49799,7 +47997,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HA
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *expr_ptr, new_expr;
SAVE_OPLINE();
@@ -49838,7 +48035,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CV_CV_H
}
if (IS_CV != IS_UNUSED) {
-
zval *offset = EX_VAR(opline->op2.var);
zend_string *str;
zend_ulong hval;
@@ -49918,7 +48114,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CV_CV_HANDLER(
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_DIM_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
zval *offset;
zend_ulong hval;
@@ -49976,7 +48171,7 @@ num_index_dim:
key = ZSTR_EMPTY_ALLOC();
goto str_index_dim;
} else {
- zend_error(E_WARNING, "Illegal offset type in unset");
+ zend_type_error("Illegal offset type in unset");
}
break;
} else if (Z_ISREF_P(container)) {
@@ -49995,7 +48190,7 @@ num_index_dim:
if (IS_CV == IS_CONST && Z_EXTRA_P(offset) == ZEND_EXTRA_VALUE) {
offset++;
}
- Z_OBJ_HT_P(container)->unset_dimension(container, offset);
+ Z_OBJ_HT_P(container)->unset_dimension(Z_OBJ_P(container), offset);
} else if (IS_CV != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_STRING)) {
zend_throw_error(NULL, "Cannot unset string offsets");
}
@@ -50008,15 +48203,12 @@ num_index_dim:
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
container = EX_VAR(opline->op1.var);
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
offset = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
do {
@@ -50034,7 +48226,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_CV_CV_HANDLER(Z
break;
}
}
- Z_OBJ_HT_P(container)->unset_property(container, offset, ((IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL));
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ break;
+ }
+ }
+ Z_OBJ_HT_P(container)->unset_property(Z_OBJ_P(container), name, ((IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL));
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
} while (0);
@@ -50044,7 +48247,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_OBJ_SPEC_CV_CV_HANDLER(Z
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
int result;
zend_ulong hval;
@@ -50079,6 +48281,10 @@ num_index_prop:
goto isset_again;
} else {
value = zend_find_array_dim_slow(ht, offset EXECUTE_DATA_CC);
+ if (UNEXPECTED(EG(exception))) {
+ result = 0;
+ goto isset_dim_obj_exit;
+ }
}
if (!(opline->extended_value & ZEND_ISEMPTY)) {
@@ -50090,8 +48296,6 @@ num_index_prop:
/* avoid exception check */
ZEND_VM_SMART_BRANCH(result, 0);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE();
}
} else {
result = (value == NULL || !i_zend_is_true(value));
@@ -50117,25 +48321,18 @@ isset_dim_obj_exit:
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *container;
int result;
zval *offset;
+ zend_string *name, *tmp_name;
SAVE_OPLINE();
container = _get_zval_ptr_cv_BP_VAR_IS(opline->op1.var EXECUTE_DATA_CC);
-
- if (IS_CV == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
- ZEND_VM_TAIL_CALL(zend_this_not_in_object_context_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
- }
-
offset = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
if (IS_CV == IS_CONST ||
@@ -50152,26 +48349,37 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CV
}
}
+ if (IS_CV == IS_CONST) {
+ name = Z_STR_P(offset);
+ } else {
+ name = zval_try_get_tmp_string(offset, &tmp_name);
+ if (UNEXPECTED(!name)) {
+ result = 0;
+ goto isset_object_finish;
+ }
+ }
+
result =
(opline->extended_value & ZEND_ISEMPTY) ^
- Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISEMPTY), ((IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+ Z_OBJ_HT_P(container)->has_property(Z_OBJ_P(container), name, (opline->extended_value & ZEND_ISEMPTY), ((IS_CV == IS_CONST) ? CACHE_ADDR(opline->extended_value & ~ZEND_ISEMPTY) : NULL));
+
+ if (IS_CV != IS_CONST) {
+ zend_tmp_string_release(tmp_name);
+ }
isset_object_finish:
ZEND_VM_SMART_BRANCH(result, 1);
- ZVAL_BOOL(EX_VAR(opline->result.var), result);
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ARRAY_KEY_EXISTS_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
-
zval *key, *subject;
HashTable *ht;
- uint32_t result;
+ zend_bool result;
SAVE_OPLINE();
@@ -50189,13 +48397,12 @@ array_key_exists_array:
goto array_key_exists_array;
}
}
- result = zend_array_key_exists_slow(subject, key OPLINE_CC EXECUTE_DATA_CC);
+ zend_array_key_exists_error(subject, key OPLINE_CC EXECUTE_DATA_CC);
+ result = 0;
}
- ZEND_VM_SMART_BRANCH(result == IS_TRUE, 1);
- Z_TYPE_INFO_P(EX_VAR(opline->result.var)) = result;
- ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
+ ZEND_VM_SMART_BRANCH(result, 1);
}
/* No specialization for op_types (CONST|TMPVAR|UNUSED|CV, ANY) */
@@ -50218,8 +48425,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CV_HANDLER(ZEND_
/* Set the new yielded value */
if (IS_CV != IS_UNUSED) {
-
-
if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
/* Constants and temporary variables aren't yieldable by reference,
* but we still allow them with a notice. */
@@ -50287,26 +48492,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CV_HANDLER(ZEND_
/* Set the new yielded key */
if (IS_CV != IS_UNUSED) {
-
zval *key = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC);
-
- /* Consts, temporary variables and references need copying */
- if (IS_CV == IS_CONST) {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->key))) {
- Z_ADDREF(generator->key);
- }
- } else if (IS_CV == IS_TMP_VAR) {
- ZVAL_COPY_VALUE(&generator->key, key);
- } else if ((IS_CV & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
- ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
-
- } else {
- ZVAL_COPY_VALUE(&generator->key, key);
- if (IS_CV == IS_CV) {
- if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
- }
+ if ((IS_CV & (IS_CV|IS_VAR)) && UNEXPECTED(Z_TYPE_P(key)) == IS_REFERENCE) {
+ key = Z_REFVAL_P(key);
}
+ ZVAL_COPY(&generator->key, key);
if (Z_TYPE(generator->key) == IS_LONG
&& Z_LVAL(generator->key) > generator->largest_used_integer_key
@@ -50339,6 +48529,35 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CV_HANDLER(ZEND_
ZEND_VM_RETURN();
}
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_NOTHROW_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ /* This is declared below the specializations for MAY_BE_LONG/MAY_BE_DOUBLE so those will be used instead if possible. */
+ /* This optimizes $x === SOME_CONST_EXPR and $x === $y for non-refs and non-undef, which can't throw. */
+ /* (Infinite recursion when comparing arrays is an uncatchable fatal error) */
+ USE_OPLINE
+ zval *op1, *op2;
+ zend_bool result;
+
+ op1 = EX_VAR(opline->op1.var);
+ op2 = EX_VAR(opline->op2.var);
+ result = fast_is_identical_function(op1, op2);
+ /* Free is a no-op for const/cv */
+ ZEND_VM_SMART_BRANCH(result, 0);
+}
+
+static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_NOTHROW_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+{
+ USE_OPLINE
+ zval *op1, *op2;
+ zend_bool result;
+
+ op1 = EX_VAR(opline->op1.var);
+ op2 = EX_VAR(opline->op2.var);
+ result = fast_is_identical_function(op1, op2);
+ /* Free is a no-op for const/cv */
+ ZEND_VM_SMART_BRANCH(!result, 0);
+}
+
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_NULL_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
USE_OPLINE
@@ -50683,10 +48902,10 @@ ZEND_API void execute_ex(zend_execute_data *ex)
(void*)&&ZEND_NULL_LABEL,
(void*)&&ZEND_POW_SPEC_CV_CV_LABEL,
(void*)&&ZEND_BW_NOT_SPEC_CONST_LABEL,
- (void*)&&ZEND_BW_NOT_SPEC_TMPVAR_LABEL,
- (void*)&&ZEND_BW_NOT_SPEC_TMPVAR_LABEL,
+ (void*)&&ZEND_BW_NOT_SPEC_TMPVARCV_LABEL,
+ (void*)&&ZEND_BW_NOT_SPEC_TMPVARCV_LABEL,
(void*)&&ZEND_NULL_LABEL,
- (void*)&&ZEND_BW_NOT_SPEC_CV_LABEL,
+ (void*)&&ZEND_BW_NOT_SPEC_TMPVARCV_LABEL,
(void*)&&ZEND_BOOL_NOT_SPEC_CONST_LABEL,
(void*)&&ZEND_BOOL_NOT_SPEC_TMPVAR_LABEL,
(void*)&&ZEND_BOOL_NOT_SPEC_TMPVAR_LABEL,
@@ -52243,8 +50462,8 @@ ZEND_API void execute_ex(zend_execute_data *ex)
(void*)&&ZEND_SEND_VAR_NO_REF_SPEC_VAR_LABEL,
(void*)&&ZEND_CATCH_SPEC_CONST_LABEL,
(void*)&&ZEND_THROW_SPEC_CONST_LABEL,
- (void*)&&ZEND_THROW_SPEC_TMP_LABEL,
- (void*)&&ZEND_THROW_SPEC_VAR_LABEL,
+ (void*)&&ZEND_THROW_SPEC_TMPVAR_LABEL,
+ (void*)&&ZEND_THROW_SPEC_TMPVAR_LABEL,
(void*)&&ZEND_NULL_LABEL,
(void*)&&ZEND_THROW_SPEC_CV_LABEL,
(void*)&&ZEND_FETCH_CLASS_SPEC_UNUSED_CONST_LABEL,
@@ -52538,32 +50757,36 @@ ZEND_API void execute_ex(zend_execute_data *ex)
(void*)&&ZEND_NULL_LABEL,
(void*)&&ZEND_FETCH_LIST_W_SPEC_VAR_CV_LABEL,
(void*)&&ZEND_SEPARATE_SPEC_VAR_UNUSED_LABEL,
+ (void*)&&ZEND_NULL_LABEL,
+ (void*)&&ZEND_FETCH_CLASS_NAME_SPEC_TMPVAR_LABEL,
+ (void*)&&ZEND_FETCH_CLASS_NAME_SPEC_TMPVAR_LABEL,
(void*)&&ZEND_FETCH_CLASS_NAME_SPEC_UNUSED_LABEL,
+ (void*)&&ZEND_FETCH_CLASS_NAME_SPEC_CV_LABEL,
(void*)&&ZEND_CALL_TRAMPOLINE_SPEC_LABEL,
(void*)&&ZEND_DISCARD_EXCEPTION_SPEC_LABEL,
(void*)&&ZEND_YIELD_SPEC_CONST_CONST_LABEL,
- (void*)&&ZEND_YIELD_SPEC_CONST_TMP_LABEL,
- (void*)&&ZEND_YIELD_SPEC_CONST_VAR_LABEL,
+ (void*)&&ZEND_YIELD_SPEC_CONST_TMPVAR_LABEL,
+ (void*)&&ZEND_YIELD_SPEC_CONST_TMPVAR_LABEL,
(void*)&&ZEND_YIELD_SPEC_CONST_UNUSED_LABEL,
(void*)&&ZEND_YIELD_SPEC_CONST_CV_LABEL,
(void*)&&ZEND_YIELD_SPEC_TMP_CONST_LABEL,
- (void*)&&ZEND_YIELD_SPEC_TMP_TMP_LABEL,
- (void*)&&ZEND_YIELD_SPEC_TMP_VAR_LABEL,
+ (void*)&&ZEND_YIELD_SPEC_TMP_TMPVAR_LABEL,
+ (void*)&&ZEND_YIELD_SPEC_TMP_TMPVAR_LABEL,
(void*)&&ZEND_YIELD_SPEC_TMP_UNUSED_LABEL,
(void*)&&ZEND_YIELD_SPEC_TMP_CV_LABEL,
(void*)&&ZEND_YIELD_SPEC_VAR_CONST_LABEL,
- (void*)&&ZEND_YIELD_SPEC_VAR_TMP_LABEL,
- (void*)&&ZEND_YIELD_SPEC_VAR_VAR_LABEL,
+ (void*)&&ZEND_YIELD_SPEC_VAR_TMPVAR_LABEL,
+ (void*)&&ZEND_YIELD_SPEC_VAR_TMPVAR_LABEL,
(void*)&&ZEND_YIELD_SPEC_VAR_UNUSED_LABEL,
(void*)&&ZEND_YIELD_SPEC_VAR_CV_LABEL,
(void*)&&ZEND_YIELD_SPEC_UNUSED_CONST_LABEL,
- (void*)&&ZEND_YIELD_SPEC_UNUSED_TMP_LABEL,
- (void*)&&ZEND_YIELD_SPEC_UNUSED_VAR_LABEL,
+ (void*)&&ZEND_YIELD_SPEC_UNUSED_TMPVAR_LABEL,
+ (void*)&&ZEND_YIELD_SPEC_UNUSED_TMPVAR_LABEL,
(void*)&&ZEND_YIELD_SPEC_UNUSED_UNUSED_LABEL,
(void*)&&ZEND_YIELD_SPEC_UNUSED_CV_LABEL,
(void*)&&ZEND_YIELD_SPEC_CV_CONST_LABEL,
- (void*)&&ZEND_YIELD_SPEC_CV_TMP_LABEL,
- (void*)&&ZEND_YIELD_SPEC_CV_VAR_LABEL,
+ (void*)&&ZEND_YIELD_SPEC_CV_TMPVAR_LABEL,
+ (void*)&&ZEND_YIELD_SPEC_CV_TMPVAR_LABEL,
(void*)&&ZEND_YIELD_SPEC_CV_UNUSED_LABEL,
(void*)&&ZEND_YIELD_SPEC_CV_CV_LABEL,
(void*)&&ZEND_GENERATOR_RETURN_SPEC_CONST_LABEL,
@@ -52576,8 +50799,8 @@ ZEND_API void execute_ex(zend_execute_data *ex)
(void*)&&ZEND_RECV_VARIADIC_SPEC_UNUSED_LABEL,
(void*)&&ZEND_SEND_UNPACK_SPEC_LABEL,
(void*)&&ZEND_YIELD_FROM_SPEC_CONST_LABEL,
- (void*)&&ZEND_YIELD_FROM_SPEC_TMP_LABEL,
- (void*)&&ZEND_YIELD_FROM_SPEC_VAR_LABEL,
+ (void*)&&ZEND_YIELD_FROM_SPEC_TMPVAR_LABEL,
+ (void*)&&ZEND_YIELD_FROM_SPEC_TMPVAR_LABEL,
(void*)&&ZEND_NULL_LABEL,
(void*)&&ZEND_YIELD_FROM_SPEC_CV_LABEL,
(void*)&&ZEND_COPY_TMP_SPEC_TMPVAR_UNUSED_LABEL,
@@ -52692,6 +50915,7 @@ ZEND_API void execute_ex(zend_execute_data *ex)
(void*)&&ZEND_ARRAY_KEY_EXISTS_SPEC_CV_TMPVAR_LABEL,
(void*)&&ZEND_NULL_LABEL,
(void*)&&ZEND_ARRAY_KEY_EXISTS_SPEC_CV_CV_LABEL,
+ (void*)&&ZEND_RECV_NOTYPE_SPEC_LABEL,
(void*)&&ZEND_JMP_FORWARD_SPEC_LABEL,
(void*)&&ZEND_NULL_LABEL,
(void*)&&ZEND_NULL_LABEL,
@@ -53218,6 +51442,16 @@ ZEND_API void execute_ex(zend_execute_data *ex)
(void*)&&ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_LABEL,
(void*)&&ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ_LABEL,
(void*)&&ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ_LABEL,
+ (void*)&&ZEND_IS_IDENTICAL_NOTHROW_SPEC_CV_CONST_LABEL,
+ (void*)&&ZEND_NULL_LABEL,
+ (void*)&&ZEND_NULL_LABEL,
+ (void*)&&ZEND_NULL_LABEL,
+ (void*)&&ZEND_IS_IDENTICAL_NOTHROW_SPEC_CV_CV_LABEL,
+ (void*)&&ZEND_IS_NOT_IDENTICAL_NOTHROW_SPEC_CV_CONST_LABEL,
+ (void*)&&ZEND_NULL_LABEL,
+ (void*)&&ZEND_NULL_LABEL,
+ (void*)&&ZEND_NULL_LABEL,
+ (void*)&&ZEND_IS_NOT_IDENTICAL_NOTHROW_SPEC_CV_CV_LABEL,
(void*)&&ZEND_NULL_LABEL,
(void*)&&ZEND_NULL_LABEL,
(void*)&&ZEND_NULL_LABEL,
@@ -53832,6 +52066,10 @@ zend_leave_helper_SPEC_LABEL:
VM_TRACE(ZEND_SEND_ARRAY_SPEC)
ZEND_SEND_ARRAY_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
+ HYBRID_CASE(ZEND_RECV_NOTYPE_SPEC):
+ VM_TRACE(ZEND_RECV_NOTYPE_SPEC)
+ ZEND_RECV_NOTYPE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ HYBRID_BREAK();
HYBRID_CASE(ZEND_ADD_ARRAY_UNPACK_SPEC):
VM_TRACE(ZEND_ADD_ARRAY_UNPACK_SPEC)
ZEND_ADD_ARRAY_UNPACK_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
@@ -53990,7 +52228,6 @@ zend_leave_helper_SPEC_LABEL:
USE_OPLINE
zval *retval_ptr;
zval *return_value;
- zend_free_op free_op1;
retval_ptr = RT_CONSTANT(opline, opline->op1);
return_value = EX(return_value);
@@ -54002,9 +52239,9 @@ zend_leave_helper_SPEC_LABEL:
}
} else if (!return_value) {
if (IS_CONST & (IS_VAR|IS_TMP_VAR)) {
- if (Z_REFCOUNTED_P(free_op1) && !Z_DELREF_P(free_op1)) {
+ if (Z_REFCOUNTED_P(retval_ptr) && !Z_DELREF_P(retval_ptr)) {
SAVE_OPLINE();
- rc_dtor_func(Z_COUNTED_P(free_op1));
+ rc_dtor_func(Z_COUNTED_P(retval_ptr));
}
}
} else {
@@ -54522,13 +52759,9 @@ zend_leave_helper_SPEC_LABEL:
VM_TRACE(ZEND_ARRAY_KEY_EXISTS_SPEC_CONST_TMPVAR)
ZEND_ARRAY_KEY_EXISTS_SPEC_CONST_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
- HYBRID_CASE(ZEND_YIELD_SPEC_CONST_TMP):
- VM_TRACE(ZEND_YIELD_SPEC_CONST_TMP)
- ZEND_YIELD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
- HYBRID_BREAK();
- HYBRID_CASE(ZEND_YIELD_SPEC_CONST_VAR):
- VM_TRACE(ZEND_YIELD_SPEC_CONST_VAR)
- ZEND_YIELD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ HYBRID_CASE(ZEND_YIELD_SPEC_CONST_TMPVAR):
+ VM_TRACE(ZEND_YIELD_SPEC_CONST_TMPVAR)
+ ZEND_YIELD_SPEC_CONST_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
HYBRID_CASE(ZEND_FETCH_R_SPEC_CONST_UNUSED):
VM_TRACE(ZEND_FETCH_R_SPEC_CONST_UNUSED)
@@ -54694,6 +52927,10 @@ zend_leave_helper_SPEC_LABEL:
VM_TRACE(ZEND_YIELD_SPEC_CONST_CV)
ZEND_YIELD_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
+ HYBRID_CASE(ZEND_BW_NOT_SPEC_TMPVARCV):
+ VM_TRACE(ZEND_BW_NOT_SPEC_TMPVARCV)
+ ZEND_BW_NOT_SPEC_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ HYBRID_BREAK();
HYBRID_CASE(ZEND_QM_ASSIGN_LONG_SPEC_TMPVARCV):
VM_TRACE(ZEND_QM_ASSIGN_LONG_SPEC_TMPVARCV)
ZEND_QM_ASSIGN_LONG_SPEC_TMPVARCV_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
@@ -55110,10 +53347,6 @@ zend_leave_helper_SPEC_LABEL:
VM_TRACE(ZEND_FETCH_LIST_R_SPEC_TMPVARCV_CV)
ZEND_FETCH_LIST_R_SPEC_TMPVARCV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
- HYBRID_CASE(ZEND_BW_NOT_SPEC_TMPVAR):
- VM_TRACE(ZEND_BW_NOT_SPEC_TMPVAR)
- ZEND_BW_NOT_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
- HYBRID_BREAK();
HYBRID_CASE(ZEND_BOOL_NOT_SPEC_TMPVAR):
VM_TRACE(ZEND_BOOL_NOT_SPEC_TMPVAR)
ZEND_BOOL_NOT_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
@@ -55150,6 +53383,10 @@ zend_leave_helper_SPEC_LABEL:
VM_TRACE(ZEND_FE_FREE_SPEC_TMPVAR)
ZEND_FE_FREE_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
+ HYBRID_CASE(ZEND_THROW_SPEC_TMPVAR):
+ VM_TRACE(ZEND_THROW_SPEC_TMPVAR)
+ ZEND_THROW_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ HYBRID_BREAK();
HYBRID_CASE(ZEND_SEND_VAL_SPEC_TMPVAR):
VM_TRACE(ZEND_SEND_VAL_SPEC_TMPVAR)
ZEND_SEND_VAL_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
@@ -55166,6 +53403,10 @@ zend_leave_helper_SPEC_LABEL:
VM_TRACE(ZEND_INCLUDE_OR_EVAL_SPEC_TMPVAR)
ZEND_INCLUDE_OR_EVAL_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
+ HYBRID_CASE(ZEND_YIELD_FROM_SPEC_TMPVAR):
+ VM_TRACE(ZEND_YIELD_FROM_SPEC_TMPVAR)
+ ZEND_YIELD_FROM_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ HYBRID_BREAK();
HYBRID_CASE(ZEND_STRLEN_SPEC_TMPVAR):
VM_TRACE(ZEND_STRLEN_SPEC_TMPVAR)
ZEND_STRLEN_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
@@ -55174,6 +53415,10 @@ zend_leave_helper_SPEC_LABEL:
VM_TRACE(ZEND_TYPE_CHECK_SPEC_TMPVAR)
ZEND_TYPE_CHECK_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
+ HYBRID_CASE(ZEND_FETCH_CLASS_NAME_SPEC_TMPVAR):
+ VM_TRACE(ZEND_FETCH_CLASS_NAME_SPEC_TMPVAR)
+ ZEND_FETCH_CLASS_NAME_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ HYBRID_BREAK();
HYBRID_CASE(ZEND_DIV_SPEC_TMPVAR_CONST):
VM_TRACE(ZEND_DIV_SPEC_TMPVAR_CONST)
ZEND_DIV_SPEC_TMPVAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
@@ -55468,9 +53713,8 @@ zend_leave_helper_SPEC_LABEL:
USE_OPLINE
zval *retval_ptr;
zval *return_value;
- zend_free_op free_op1;
- retval_ptr = _get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ retval_ptr = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
return_value = EX(return_value);
if (IS_TMP_VAR == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(retval_ptr) == IS_UNDEF)) {
SAVE_OPLINE();
@@ -55480,9 +53724,9 @@ zend_leave_helper_SPEC_LABEL:
}
} else if (!return_value) {
if (IS_TMP_VAR & (IS_VAR|IS_TMP_VAR)) {
- if (Z_REFCOUNTED_P(free_op1) && !Z_DELREF_P(free_op1)) {
+ if (Z_REFCOUNTED_P(retval_ptr) && !Z_DELREF_P(retval_ptr)) {
SAVE_OPLINE();
- rc_dtor_func(Z_COUNTED_P(free_op1));
+ rc_dtor_func(Z_COUNTED_P(retval_ptr));
}
}
} else {
@@ -55544,10 +53788,6 @@ zend_leave_helper_SPEC_LABEL:
VM_TRACE(ZEND_GENERATOR_RETURN_SPEC_TMP)
ZEND_GENERATOR_RETURN_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
- HYBRID_CASE(ZEND_THROW_SPEC_TMP):
- VM_TRACE(ZEND_THROW_SPEC_TMP)
- ZEND_THROW_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
- HYBRID_BREAK();
HYBRID_CASE(ZEND_SEND_VAL_EX_SPEC_TMP):
VM_TRACE(ZEND_SEND_VAL_EX_SPEC_TMP)
ZEND_SEND_VAL_EX_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
@@ -55588,10 +53828,6 @@ zend_leave_helper_SPEC_LABEL:
VM_TRACE(ZEND_QM_ASSIGN_SPEC_TMP)
ZEND_QM_ASSIGN_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
- HYBRID_CASE(ZEND_YIELD_FROM_SPEC_TMP):
- VM_TRACE(ZEND_YIELD_FROM_SPEC_TMP)
- ZEND_YIELD_FROM_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
- HYBRID_BREAK();
HYBRID_CASE(ZEND_IS_IDENTICAL_SPEC_TMP_CONST):
VM_TRACE(ZEND_IS_IDENTICAL_SPEC_TMP_CONST)
ZEND_IS_IDENTICAL_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
@@ -55656,6 +53892,10 @@ zend_leave_helper_SPEC_LABEL:
VM_TRACE(ZEND_INIT_ARRAY_SPEC_TMP_TMPVAR)
ZEND_INIT_ARRAY_SPEC_TMP_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
+ HYBRID_CASE(ZEND_YIELD_SPEC_TMP_TMPVAR):
+ VM_TRACE(ZEND_YIELD_SPEC_TMP_TMPVAR)
+ ZEND_YIELD_SPEC_TMP_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ HYBRID_BREAK();
HYBRID_CASE(ZEND_IS_IDENTICAL_SPEC_TMP_TMP):
VM_TRACE(ZEND_IS_IDENTICAL_SPEC_TMP_TMP)
ZEND_IS_IDENTICAL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
@@ -55664,14 +53904,6 @@ zend_leave_helper_SPEC_LABEL:
VM_TRACE(ZEND_IS_NOT_IDENTICAL_SPEC_TMP_TMP)
ZEND_IS_NOT_IDENTICAL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
- HYBRID_CASE(ZEND_YIELD_SPEC_TMP_TMP):
- VM_TRACE(ZEND_YIELD_SPEC_TMP_TMP)
- ZEND_YIELD_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
- HYBRID_BREAK();
- HYBRID_CASE(ZEND_YIELD_SPEC_TMP_VAR):
- VM_TRACE(ZEND_YIELD_SPEC_TMP_VAR)
- ZEND_YIELD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
- HYBRID_BREAK();
HYBRID_CASE(ZEND_FETCH_DIM_FUNC_ARG_SPEC_TMP_UNUSED):
VM_TRACE(ZEND_FETCH_DIM_FUNC_ARG_SPEC_TMP_UNUSED)
ZEND_FETCH_DIM_FUNC_ARG_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
@@ -55758,9 +53990,8 @@ zend_leave_helper_SPEC_LABEL:
USE_OPLINE
zval *retval_ptr;
zval *return_value;
- zend_free_op free_op1;
- retval_ptr = _get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC);
+ retval_ptr = _get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC);
return_value = EX(return_value);
if (IS_VAR == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(retval_ptr) == IS_UNDEF)) {
SAVE_OPLINE();
@@ -55770,9 +54001,9 @@ zend_leave_helper_SPEC_LABEL:
}
} else if (!return_value) {
if (IS_VAR & (IS_VAR|IS_TMP_VAR)) {
- if (Z_REFCOUNTED_P(free_op1) && !Z_DELREF_P(free_op1)) {
+ if (Z_REFCOUNTED_P(retval_ptr) && !Z_DELREF_P(retval_ptr)) {
SAVE_OPLINE();
- rc_dtor_func(Z_COUNTED_P(free_op1));
+ rc_dtor_func(Z_COUNTED_P(retval_ptr));
}
}
} else {
@@ -55834,10 +54065,6 @@ zend_leave_helper_SPEC_LABEL:
VM_TRACE(ZEND_GENERATOR_RETURN_SPEC_VAR)
ZEND_GENERATOR_RETURN_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
- HYBRID_CASE(ZEND_THROW_SPEC_VAR):
- VM_TRACE(ZEND_THROW_SPEC_VAR)
- ZEND_THROW_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
- HYBRID_BREAK();
HYBRID_CASE(ZEND_SEND_VAR_SPEC_VAR):
VM_TRACE(ZEND_SEND_VAR_SPEC_VAR)
ZEND_SEND_VAR_SPEC_VAR_INLINE_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
@@ -55906,10 +54133,6 @@ zend_leave_helper_SPEC_LABEL:
VM_TRACE(ZEND_QM_ASSIGN_SPEC_VAR)
ZEND_QM_ASSIGN_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
- HYBRID_CASE(ZEND_YIELD_FROM_SPEC_VAR):
- VM_TRACE(ZEND_YIELD_FROM_SPEC_VAR)
- ZEND_YIELD_FROM_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
- HYBRID_BREAK();
HYBRID_CASE(ZEND_SEND_VAR_SIMPLE_SPEC_VAR):
VM_TRACE(ZEND_SEND_VAR_SIMPLE_SPEC_VAR)
ZEND_SEND_VAR_SIMPLE_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
@@ -56178,6 +54401,10 @@ zend_leave_helper_SPEC_LABEL:
VM_TRACE(ZEND_UNSET_OBJ_SPEC_VAR_TMPVAR)
ZEND_UNSET_OBJ_SPEC_VAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
+ HYBRID_CASE(ZEND_YIELD_SPEC_VAR_TMPVAR):
+ VM_TRACE(ZEND_YIELD_SPEC_VAR_TMPVAR)
+ ZEND_YIELD_SPEC_VAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ HYBRID_BREAK();
HYBRID_CASE(ZEND_IS_IDENTICAL_SPEC_VAR_TMP):
VM_TRACE(ZEND_IS_IDENTICAL_SPEC_VAR_TMP)
ZEND_IS_IDENTICAL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
@@ -56194,10 +54421,6 @@ zend_leave_helper_SPEC_LABEL:
VM_TRACE(ZEND_ASSIGN_SPEC_VAR_TMP_RETVAL_USED)
ZEND_ASSIGN_SPEC_VAR_TMP_RETVAL_USED_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
- HYBRID_CASE(ZEND_YIELD_SPEC_VAR_TMP):
- VM_TRACE(ZEND_YIELD_SPEC_VAR_TMP)
- ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
- HYBRID_BREAK();
HYBRID_CASE(ZEND_IS_IDENTICAL_SPEC_VAR_VAR):
VM_TRACE(ZEND_IS_IDENTICAL_SPEC_VAR_VAR)
ZEND_IS_IDENTICAL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
@@ -56218,10 +54441,6 @@ zend_leave_helper_SPEC_LABEL:
VM_TRACE(ZEND_ASSIGN_REF_SPEC_VAR_VAR)
ZEND_ASSIGN_REF_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
- HYBRID_CASE(ZEND_YIELD_SPEC_VAR_VAR):
- VM_TRACE(ZEND_YIELD_SPEC_VAR_VAR)
- ZEND_YIELD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
- HYBRID_BREAK();
HYBRID_CASE(ZEND_ASSIGN_DIM_OP_SPEC_VAR_UNUSED):
VM_TRACE(ZEND_ASSIGN_DIM_OP_SPEC_VAR_UNUSED)
ZEND_ASSIGN_DIM_OP_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
@@ -56634,13 +54853,9 @@ zend_leave_helper_SPEC_LABEL:
VM_TRACE(ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UNUSED_TMPVAR)
ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_UNUSED_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
- HYBRID_CASE(ZEND_YIELD_SPEC_UNUSED_TMP):
- VM_TRACE(ZEND_YIELD_SPEC_UNUSED_TMP)
- ZEND_YIELD_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
- HYBRID_BREAK();
- HYBRID_CASE(ZEND_YIELD_SPEC_UNUSED_VAR):
- VM_TRACE(ZEND_YIELD_SPEC_UNUSED_VAR)
- ZEND_YIELD_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ HYBRID_CASE(ZEND_YIELD_SPEC_UNUSED_TMPVAR):
+ VM_TRACE(ZEND_YIELD_SPEC_UNUSED_TMPVAR)
+ ZEND_YIELD_SPEC_UNUSED_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
HYBRID_CASE(ZEND_FETCH_CLASS_SPEC_UNUSED_UNUSED):
VM_TRACE(ZEND_FETCH_CLASS_SPEC_UNUSED_UNUSED)
@@ -56782,10 +54997,6 @@ zend_leave_helper_SPEC_LABEL:
VM_TRACE(ZEND_YIELD_SPEC_UNUSED_CV)
ZEND_YIELD_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
- HYBRID_CASE(ZEND_BW_NOT_SPEC_CV):
- VM_TRACE(ZEND_BW_NOT_SPEC_CV)
- ZEND_BW_NOT_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
- HYBRID_BREAK();
HYBRID_CASE(ZEND_BOOL_NOT_SPEC_CV):
VM_TRACE(ZEND_BOOL_NOT_SPEC_CV)
ZEND_BOOL_NOT_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
@@ -56844,7 +55055,6 @@ zend_leave_helper_SPEC_LABEL:
USE_OPLINE
zval *retval_ptr;
zval *return_value;
- zend_free_op free_op1;
retval_ptr = EX_VAR(opline->op1.var);
return_value = EX(return_value);
@@ -56856,9 +55066,9 @@ zend_leave_helper_SPEC_LABEL:
}
} else if (!return_value) {
if (IS_CV & (IS_VAR|IS_TMP_VAR)) {
- if (Z_REFCOUNTED_P(free_op1) && !Z_DELREF_P(free_op1)) {
+ if (Z_REFCOUNTED_P(retval_ptr) && !Z_DELREF_P(retval_ptr)) {
SAVE_OPLINE();
- rc_dtor_func(Z_COUNTED_P(free_op1));
+ rc_dtor_func(Z_COUNTED_P(retval_ptr));
}
}
} else {
@@ -56992,6 +55202,10 @@ zend_leave_helper_SPEC_LABEL:
VM_TRACE(ZEND_TYPE_CHECK_SPEC_CV)
ZEND_TYPE_CHECK_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
+ HYBRID_CASE(ZEND_FETCH_CLASS_NAME_SPEC_CV):
+ VM_TRACE(ZEND_FETCH_CLASS_NAME_SPEC_CV)
+ ZEND_FETCH_CLASS_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ HYBRID_BREAK();
HYBRID_CASE(ZEND_PRE_INC_LONG_NO_OVERFLOW_SPEC_CV_RETVAL_UNUSED):
VM_TRACE(ZEND_PRE_INC_LONG_NO_OVERFLOW_SPEC_CV_RETVAL_UNUSED)
ZEND_PRE_INC_LONG_NO_OVERFLOW_SPEC_CV_RETVAL_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
@@ -57268,6 +55482,14 @@ zend_leave_helper_SPEC_LABEL:
VM_TRACE(ZEND_IN_ARRAY_SPEC_CV_CONST)
ZEND_IN_ARRAY_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
+ HYBRID_CASE(ZEND_IS_IDENTICAL_NOTHROW_SPEC_CV_CONST):
+ VM_TRACE(ZEND_IS_IDENTICAL_NOTHROW_SPEC_CV_CONST)
+ ZEND_IS_IDENTICAL_NOTHROW_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ HYBRID_BREAK();
+ HYBRID_CASE(ZEND_IS_NOT_IDENTICAL_NOTHROW_SPEC_CV_CONST):
+ VM_TRACE(ZEND_IS_NOT_IDENTICAL_NOTHROW_SPEC_CV_CONST)
+ ZEND_IS_NOT_IDENTICAL_NOTHROW_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ HYBRID_BREAK();
HYBRID_CASE(ZEND_FETCH_DIM_R_INDEX_SPEC_CV_CONST):
VM_TRACE(ZEND_FETCH_DIM_R_INDEX_SPEC_CV_CONST)
ZEND_FETCH_DIM_R_INDEX_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
@@ -57464,6 +55686,10 @@ zend_leave_helper_SPEC_LABEL:
VM_TRACE(ZEND_ARRAY_KEY_EXISTS_SPEC_CV_TMPVAR)
ZEND_ARRAY_KEY_EXISTS_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
+ HYBRID_CASE(ZEND_YIELD_SPEC_CV_TMPVAR):
+ VM_TRACE(ZEND_YIELD_SPEC_CV_TMPVAR)
+ ZEND_YIELD_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ HYBRID_BREAK();
HYBRID_CASE(ZEND_IS_IDENTICAL_SPEC_CV_TMP):
VM_TRACE(ZEND_IS_IDENTICAL_SPEC_CV_TMP)
ZEND_IS_IDENTICAL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
@@ -57480,10 +55706,6 @@ zend_leave_helper_SPEC_LABEL:
VM_TRACE(ZEND_ASSIGN_SPEC_CV_TMP_RETVAL_USED)
ZEND_ASSIGN_SPEC_CV_TMP_RETVAL_USED_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
- HYBRID_CASE(ZEND_YIELD_SPEC_CV_TMP):
- VM_TRACE(ZEND_YIELD_SPEC_CV_TMP)
- ZEND_YIELD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
- HYBRID_BREAK();
HYBRID_CASE(ZEND_IS_IDENTICAL_SPEC_CV_VAR):
VM_TRACE(ZEND_IS_IDENTICAL_SPEC_CV_VAR)
ZEND_IS_IDENTICAL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
@@ -57508,10 +55730,6 @@ zend_leave_helper_SPEC_LABEL:
VM_TRACE(ZEND_INSTANCEOF_SPEC_CV_VAR)
ZEND_INSTANCEOF_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
- HYBRID_CASE(ZEND_YIELD_SPEC_CV_VAR):
- VM_TRACE(ZEND_YIELD_SPEC_CV_VAR)
- ZEND_YIELD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
- HYBRID_BREAK();
HYBRID_CASE(ZEND_ASSIGN_DIM_OP_SPEC_CV_UNUSED):
VM_TRACE(ZEND_ASSIGN_DIM_OP_SPEC_CV_UNUSED)
ZEND_ASSIGN_DIM_OP_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
@@ -57844,6 +56062,14 @@ zend_leave_helper_SPEC_LABEL:
VM_TRACE(ZEND_YIELD_SPEC_CV_CV)
ZEND_YIELD_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
HYBRID_BREAK();
+ HYBRID_CASE(ZEND_IS_IDENTICAL_NOTHROW_SPEC_CV_CV):
+ VM_TRACE(ZEND_IS_IDENTICAL_NOTHROW_SPEC_CV_CV)
+ ZEND_IS_IDENTICAL_NOTHROW_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ HYBRID_BREAK();
+ HYBRID_CASE(ZEND_IS_NOT_IDENTICAL_NOTHROW_SPEC_CV_CV):
+ VM_TRACE(ZEND_IS_NOT_IDENTICAL_NOTHROW_SPEC_CV_CV)
+ ZEND_IS_NOT_IDENTICAL_NOTHROW_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+ HYBRID_BREAK();
HYBRID_CASE(HYBRID_HALT):
#ifdef ZEND_VM_FP_GLOBAL_REG
execute_data = orig_execute_data;
@@ -58220,10 +56446,10 @@ void zend_vm_init(void)
ZEND_NULL_HANDLER,
ZEND_POW_SPEC_CV_CV_HANDLER,
ZEND_BW_NOT_SPEC_CONST_HANDLER,
- ZEND_BW_NOT_SPEC_TMPVAR_HANDLER,
- ZEND_BW_NOT_SPEC_TMPVAR_HANDLER,
+ ZEND_BW_NOT_SPEC_TMPVARCV_HANDLER,
+ ZEND_BW_NOT_SPEC_TMPVARCV_HANDLER,
ZEND_NULL_HANDLER,
- ZEND_BW_NOT_SPEC_CV_HANDLER,
+ ZEND_BW_NOT_SPEC_TMPVARCV_HANDLER,
ZEND_BOOL_NOT_SPEC_CONST_HANDLER,
ZEND_BOOL_NOT_SPEC_TMPVAR_HANDLER,
ZEND_BOOL_NOT_SPEC_TMPVAR_HANDLER,
@@ -59780,8 +58006,8 @@ void zend_vm_init(void)
ZEND_SEND_VAR_NO_REF_SPEC_VAR_HANDLER,
ZEND_CATCH_SPEC_CONST_HANDLER,
ZEND_THROW_SPEC_CONST_HANDLER,
- ZEND_THROW_SPEC_TMP_HANDLER,
- ZEND_THROW_SPEC_VAR_HANDLER,
+ ZEND_THROW_SPEC_TMPVAR_HANDLER,
+ ZEND_THROW_SPEC_TMPVAR_HANDLER,
ZEND_NULL_HANDLER,
ZEND_THROW_SPEC_CV_HANDLER,
ZEND_FETCH_CLASS_SPEC_UNUSED_CONST_HANDLER,
@@ -60075,32 +58301,36 @@ void zend_vm_init(void)
ZEND_NULL_HANDLER,
ZEND_FETCH_LIST_W_SPEC_VAR_CV_HANDLER,
ZEND_SEPARATE_SPEC_VAR_UNUSED_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_FETCH_CLASS_NAME_SPEC_TMPVAR_HANDLER,
+ ZEND_FETCH_CLASS_NAME_SPEC_TMPVAR_HANDLER,
ZEND_FETCH_CLASS_NAME_SPEC_UNUSED_HANDLER,
+ ZEND_FETCH_CLASS_NAME_SPEC_CV_HANDLER,
ZEND_CALL_TRAMPOLINE_SPEC_HANDLER,
ZEND_DISCARD_EXCEPTION_SPEC_HANDLER,
ZEND_YIELD_SPEC_CONST_CONST_HANDLER,
- ZEND_YIELD_SPEC_CONST_TMP_HANDLER,
- ZEND_YIELD_SPEC_CONST_VAR_HANDLER,
+ ZEND_YIELD_SPEC_CONST_TMPVAR_HANDLER,
+ ZEND_YIELD_SPEC_CONST_TMPVAR_HANDLER,
ZEND_YIELD_SPEC_CONST_UNUSED_HANDLER,
ZEND_YIELD_SPEC_CONST_CV_HANDLER,
ZEND_YIELD_SPEC_TMP_CONST_HANDLER,
- ZEND_YIELD_SPEC_TMP_TMP_HANDLER,
- ZEND_YIELD_SPEC_TMP_VAR_HANDLER,
+ ZEND_YIELD_SPEC_TMP_TMPVAR_HANDLER,
+ ZEND_YIELD_SPEC_TMP_TMPVAR_HANDLER,
ZEND_YIELD_SPEC_TMP_UNUSED_HANDLER,
ZEND_YIELD_SPEC_TMP_CV_HANDLER,
ZEND_YIELD_SPEC_VAR_CONST_HANDLER,
- ZEND_YIELD_SPEC_VAR_TMP_HANDLER,
- ZEND_YIELD_SPEC_VAR_VAR_HANDLER,
+ ZEND_YIELD_SPEC_VAR_TMPVAR_HANDLER,
+ ZEND_YIELD_SPEC_VAR_TMPVAR_HANDLER,
ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER,
ZEND_YIELD_SPEC_VAR_CV_HANDLER,
ZEND_YIELD_SPEC_UNUSED_CONST_HANDLER,
- ZEND_YIELD_SPEC_UNUSED_TMP_HANDLER,
- ZEND_YIELD_SPEC_UNUSED_VAR_HANDLER,
+ ZEND_YIELD_SPEC_UNUSED_TMPVAR_HANDLER,
+ ZEND_YIELD_SPEC_UNUSED_TMPVAR_HANDLER,
ZEND_YIELD_SPEC_UNUSED_UNUSED_HANDLER,
ZEND_YIELD_SPEC_UNUSED_CV_HANDLER,
ZEND_YIELD_SPEC_CV_CONST_HANDLER,
- ZEND_YIELD_SPEC_CV_TMP_HANDLER,
- ZEND_YIELD_SPEC_CV_VAR_HANDLER,
+ ZEND_YIELD_SPEC_CV_TMPVAR_HANDLER,
+ ZEND_YIELD_SPEC_CV_TMPVAR_HANDLER,
ZEND_YIELD_SPEC_CV_UNUSED_HANDLER,
ZEND_YIELD_SPEC_CV_CV_HANDLER,
ZEND_GENERATOR_RETURN_SPEC_CONST_HANDLER,
@@ -60113,8 +58343,8 @@ void zend_vm_init(void)
ZEND_RECV_VARIADIC_SPEC_UNUSED_HANDLER,
ZEND_SEND_UNPACK_SPEC_HANDLER,
ZEND_YIELD_FROM_SPEC_CONST_HANDLER,
- ZEND_YIELD_FROM_SPEC_TMP_HANDLER,
- ZEND_YIELD_FROM_SPEC_VAR_HANDLER,
+ ZEND_YIELD_FROM_SPEC_TMPVAR_HANDLER,
+ ZEND_YIELD_FROM_SPEC_TMPVAR_HANDLER,
ZEND_NULL_HANDLER,
ZEND_YIELD_FROM_SPEC_CV_HANDLER,
ZEND_COPY_TMP_SPEC_TMPVAR_UNUSED_HANDLER,
@@ -60229,6 +58459,7 @@ void zend_vm_init(void)
ZEND_ARRAY_KEY_EXISTS_SPEC_CV_TMPVAR_HANDLER,
ZEND_NULL_HANDLER,
ZEND_ARRAY_KEY_EXISTS_SPEC_CV_CV_HANDLER,
+ ZEND_RECV_NOTYPE_SPEC_HANDLER,
ZEND_JMP_FORWARD_SPEC_HANDLER,
ZEND_NULL_HANDLER,
ZEND_NULL_HANDLER,
@@ -60755,6 +58986,16 @@ void zend_vm_init(void)
ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_HANDLER,
ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ_HANDLER,
ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ_HANDLER,
+ ZEND_IS_IDENTICAL_NOTHROW_SPEC_CV_CONST_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_IS_IDENTICAL_NOTHROW_SPEC_CV_CV_HANDLER,
+ ZEND_IS_NOT_IDENTICAL_NOTHROW_SPEC_CV_CONST_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_NULL_HANDLER,
+ ZEND_IS_NOT_IDENTICAL_NOTHROW_SPEC_CV_CV_HANDLER,
ZEND_NULL_HANDLER,
ZEND_NULL_HANDLER,
ZEND_NULL_HANDLER,
@@ -61281,45 +59522,45 @@ void zend_vm_init(void)
2149 | SPEC_RULE_ISSET,
2151 | SPEC_RULE_OP2,
2156,
- 2157,
- 2158,
- 2159,
- 2160 | SPEC_RULE_OP1 | SPEC_RULE_OP2,
- 2185 | SPEC_RULE_OP1,
- 2190,
- 2191,
- 2192,
- 2193,
- 2194 | SPEC_RULE_OP1,
- 2199,
- 2200,
- 2201 | SPEC_RULE_OP1,
- 2206 | SPEC_RULE_OP1 | SPEC_RULE_OP2,
- 2231,
- 2232 | SPEC_RULE_OP1,
- 2237,
- 2238,
- 2239,
- 2240,
+ 2157 | SPEC_RULE_OP1,
+ 2162,
+ 2163,
+ 2164 | SPEC_RULE_OP1 | SPEC_RULE_OP2,
+ 2189 | SPEC_RULE_OP1,
+ 2194,
+ 2195,
+ 2196,
+ 2197,
+ 2198 | SPEC_RULE_OP1,
+ 2203,
+ 2204,
+ 2205 | SPEC_RULE_OP1,
+ 2210 | SPEC_RULE_OP1 | SPEC_RULE_OP2,
+ 2235,
+ 2236 | SPEC_RULE_OP1,
2241,
2242,
2243,
2244,
- 2245 | SPEC_RULE_OP1,
- 2250,
- 2251,
- 2252,
- 2253,
+ 2245,
+ 2246,
+ 2247,
+ 2248,
+ 2249 | SPEC_RULE_OP1,
2254,
- 2255 | SPEC_RULE_OP1,
- 2260 | SPEC_RULE_OP1,
- 2265 | SPEC_RULE_OP1,
- 2270 | SPEC_RULE_OP1,
- 2275 | SPEC_RULE_OP1,
- 2280,
- 2281 | SPEC_RULE_OP1,
- 2286 | SPEC_RULE_OP1 | SPEC_RULE_OP2,
- 3203
+ 2255,
+ 2256,
+ 2257,
+ 2258,
+ 2259 | SPEC_RULE_OP1,
+ 2264 | SPEC_RULE_OP1,
+ 2269 | SPEC_RULE_OP1,
+ 2274 | SPEC_RULE_OP1,
+ 2279 | SPEC_RULE_OP1,
+ 2284,
+ 2285 | SPEC_RULE_OP1,
+ 2290 | SPEC_RULE_OP1 | SPEC_RULE_OP2,
+ 3218
};
#if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID)
zend_opcode_handler_funcs = labels;
@@ -61333,17 +59574,13 @@ void zend_vm_init(void)
VM_TRACE_START();
}
-static HashTable *zend_handlers_table = NULL;
-
void zend_vm_dtor(void)
{
VM_TRACE_END();
- if (zend_handlers_table) {
- zend_hash_destroy(zend_handlers_table);
- free(zend_handlers_table);
- }
}
+static HashTable *zend_handlers_table = NULL;
+
static void init_opcode_serialiser(void)
{
int i;
@@ -61408,7 +59645,7 @@ ZEND_API int zend_vm_kind(void)
return ZEND_VM_KIND;
}
-static const void* ZEND_FASTCALL zend_vm_get_opcode_handler_ex(uint32_t spec, const zend_op* op)
+static uint32_t ZEND_FASTCALL zend_vm_get_opcode_handler_idx(uint32_t spec, const zend_op* op)
{
static const int zend_vm_decode[] = {
_UNUSED_CODE, /* 0 = IS_UNUSED */
@@ -61435,20 +59672,20 @@ static const void* ZEND_FASTCALL zend_vm_get_opcode_handler_ex(uint32_t spec, co
offset = offset * 2 + (op->extended_value & ZEND_ISEMPTY);
} else if (spec & SPEC_RULE_SMART_BRANCH) {
offset = offset * 3;
- if ((op+1)->opcode == ZEND_JMPZ) {
+ if (op->result_type == (IS_SMART_BRANCH_JMPZ|IS_TMP_VAR)) {
offset += 1;
- } else if ((op+1)->opcode == ZEND_JMPNZ) {
+ } else if (op->result_type == (IS_SMART_BRANCH_JMPNZ|IS_TMP_VAR)) {
offset += 2;
}
}
}
- return zend_opcode_handlers[(spec & SPEC_START_MASK) + offset];
+ return (spec & SPEC_START_MASK) + offset;
}
#if (ZEND_VM_KIND != ZEND_VM_KIND_HYBRID) || !ZEND_VM_SPEC
static const void *zend_vm_get_opcode_handler(zend_uchar opcode, const zend_op* op)
{
- return zend_vm_get_opcode_handler_ex(zend_spec_handlers[opcode], op);
+ return zend_opcode_handlers[zend_vm_get_opcode_handler_idx(zend_spec_handlers[opcode], op)];
}
#endif
@@ -61456,35 +59693,7 @@ static const void *zend_vm_get_opcode_handler(zend_uchar opcode, const zend_op*
static const void *zend_vm_get_opcode_handler_func(zend_uchar opcode, const zend_op* op)
{
uint32_t spec = zend_spec_handlers[opcode];
- static const int zend_vm_decode[] = {
- _UNUSED_CODE, /* 0 = IS_UNUSED */
- _CONST_CODE, /* 1 = IS_CONST */
- _TMP_CODE, /* 2 = IS_TMP_VAR */
- _UNUSED_CODE, /* 3 */
- _VAR_CODE, /* 4 = IS_VAR */
- _UNUSED_CODE, /* 5 */
- _UNUSED_CODE, /* 6 */
- _UNUSED_CODE, /* 7 */
- _CV_CODE /* 8 = IS_CV */
- };
- uint32_t offset = 0;
- if (spec & SPEC_RULE_OP1) offset = offset * 5 + zend_vm_decode[op->op1_type];
- if (spec & SPEC_RULE_OP2) offset = offset * 5 + zend_vm_decode[op->op2_type];
- if (spec & SPEC_EXTRA_MASK) {
- if (spec & SPEC_RULE_OP_DATA) offset = offset * 5 + zend_vm_decode[(op + 1)->op1_type];
- else if (spec & SPEC_RULE_RETVAL) offset = offset * 2 + (op->result_type != IS_UNUSED);
- else if (spec & SPEC_RULE_QUICK_ARG) offset = offset * 2 + (op->op2.num <= MAX_ARG_FLAG_NUM);
- else if (spec & SPEC_RULE_SMART_BRANCH) {
- offset = offset * 3;
- if ((op+1)->opcode == ZEND_JMPZ) {
- offset += 1;
- } else if ((op+1)->opcode == ZEND_JMPNZ) {
- offset += 2;
- }
- }
- else if (spec & SPEC_RULE_ISSET) offset = offset * 2 + (op->extended_value & ZEND_ISEMPTY);
- }
- return zend_opcode_handler_funcs[(spec & SPEC_START_MASK) + offset];
+ return zend_opcode_handler_funcs[zend_vm_get_opcode_handler_idx(spec, op)];
}
#endif
@@ -61498,7 +59707,7 @@ ZEND_API void ZEND_FASTCALL zend_vm_set_opcode_handler(zend_op* op)
zend_swap_operands(op);
}
}
- op->handler = zend_vm_get_opcode_handler_ex(zend_spec_handlers[opcode], op);
+ op->handler = zend_opcode_handlers[zend_vm_get_opcode_handler_idx(zend_spec_handlers[opcode], op)];
}
ZEND_API void ZEND_FASTCALL zend_vm_set_opcode_handler_ex(zend_op* op, uint32_t op1_info, uint32_t op2_info, uint32_t res_info)
@@ -61511,7 +59720,7 @@ ZEND_API void ZEND_FASTCALL zend_vm_set_opcode_handler_ex(zend_op* op, uint32_t
if (op->op1_type == IS_CONST && op->op2_type == IS_CONST) {
break;
}
- spec = 2312 | SPEC_RULE_OP1 | SPEC_RULE_OP2 | SPEC_RULE_COMMUTATIVE;
+ spec = 2317 | SPEC_RULE_OP1 | SPEC_RULE_OP2 | SPEC_RULE_COMMUTATIVE;
if (op->op1_type < op->op2_type) {
zend_swap_operands(op);
}
@@ -61519,7 +59728,7 @@ ZEND_API void ZEND_FASTCALL zend_vm_set_opcode_handler_ex(zend_op* op, uint32_t
if (op->op1_type == IS_CONST && op->op2_type == IS_CONST) {
break;
}
- spec = 2337 | SPEC_RULE_OP1 | SPEC_RULE_OP2 | SPEC_RULE_COMMUTATIVE;
+ spec = 2342 | SPEC_RULE_OP1 | SPEC_RULE_OP2 | SPEC_RULE_COMMUTATIVE;
if (op->op1_type < op->op2_type) {
zend_swap_operands(op);
}
@@ -61527,7 +59736,7 @@ ZEND_API void ZEND_FASTCALL zend_vm_set_opcode_handler_ex(zend_op* op, uint32_t
if (op->op1_type == IS_CONST && op->op2_type == IS_CONST) {
break;
}
- spec = 2362 | SPEC_RULE_OP1 | SPEC_RULE_OP2 | SPEC_RULE_COMMUTATIVE;
+ spec = 2367 | SPEC_RULE_OP1 | SPEC_RULE_OP2 | SPEC_RULE_COMMUTATIVE;
if (op->op1_type < op->op2_type) {
zend_swap_operands(op);
}
@@ -61538,17 +59747,17 @@ ZEND_API void ZEND_FASTCALL zend_vm_set_opcode_handler_ex(zend_op* op, uint32_t
if (op->op1_type == IS_CONST && op->op2_type == IS_CONST) {
break;
}
- spec = 2387 | SPEC_RULE_OP1 | SPEC_RULE_OP2;
+ spec = 2392 | SPEC_RULE_OP1 | SPEC_RULE_OP2;
} else if (op1_info == MAY_BE_LONG && op2_info == MAY_BE_LONG) {
if (op->op1_type == IS_CONST && op->op2_type == IS_CONST) {
break;
}
- spec = 2412 | SPEC_RULE_OP1 | SPEC_RULE_OP2;
+ spec = 2417 | SPEC_RULE_OP1 | SPEC_RULE_OP2;
} else if (op1_info == MAY_BE_DOUBLE && op2_info == MAY_BE_DOUBLE) {
if (op->op1_type == IS_CONST && op->op2_type == IS_CONST) {
break;
}
- spec = 2437 | SPEC_RULE_OP1 | SPEC_RULE_OP2;
+ spec = 2442 | SPEC_RULE_OP1 | SPEC_RULE_OP2;
}
break;
case ZEND_MUL:
@@ -61559,17 +59768,53 @@ ZEND_API void ZEND_FASTCALL zend_vm_set_opcode_handler_ex(zend_op* op, uint32_t
if (op->op1_type == IS_CONST && op->op2_type == IS_CONST) {
break;
}
- spec = 2462 | SPEC_RULE_OP1 | SPEC_RULE_OP2 | SPEC_RULE_COMMUTATIVE;
+ spec = 2467 | SPEC_RULE_OP1 | SPEC_RULE_OP2 | SPEC_RULE_COMMUTATIVE;
} else if (op1_info == MAY_BE_LONG && op2_info == MAY_BE_LONG) {
if (op->op1_type == IS_CONST && op->op2_type == IS_CONST) {
break;
}
- spec = 2487 | SPEC_RULE_OP1 | SPEC_RULE_OP2 | SPEC_RULE_COMMUTATIVE;
+ spec = 2492 | SPEC_RULE_OP1 | SPEC_RULE_OP2 | SPEC_RULE_COMMUTATIVE;
+ } else if (op1_info == MAY_BE_DOUBLE && op2_info == MAY_BE_DOUBLE) {
+ if (op->op1_type == IS_CONST && op->op2_type == IS_CONST) {
+ break;
+ }
+ spec = 2517 | SPEC_RULE_OP1 | SPEC_RULE_OP2 | SPEC_RULE_COMMUTATIVE;
+ }
+ break;
+ case ZEND_IS_IDENTICAL:
+ if (op->op1_type < op->op2_type) {
+ zend_swap_operands(op);
+ }
+ if (op1_info == MAY_BE_LONG && op2_info == MAY_BE_LONG) {
+ if (op->op1_type == IS_CONST && op->op2_type == IS_CONST) {
+ break;
+ }
+ spec = 2542 | SPEC_RULE_OP1 | SPEC_RULE_OP2 | SPEC_RULE_SMART_BRANCH | SPEC_RULE_COMMUTATIVE;
+ } else if (op1_info == MAY_BE_DOUBLE && op2_info == MAY_BE_DOUBLE) {
+ if (op->op1_type == IS_CONST && op->op2_type == IS_CONST) {
+ break;
+ }
+ spec = 2617 | SPEC_RULE_OP1 | SPEC_RULE_OP2 | SPEC_RULE_SMART_BRANCH | SPEC_RULE_COMMUTATIVE;
+ } else if (op->op1_type == IS_CV && (op->op2_type & (IS_CONST|IS_CV)) && !(op1_info & (MAY_BE_UNDEF|MAY_BE_REF)) && !(op2_info & (MAY_BE_UNDEF|MAY_BE_REF))) {
+ spec = 2842 | SPEC_RULE_OP2 | SPEC_RULE_COMMUTATIVE;
+ }
+ break;
+ case ZEND_IS_NOT_IDENTICAL:
+ if (op->op1_type < op->op2_type) {
+ zend_swap_operands(op);
+ }
+ if (op1_info == MAY_BE_LONG && op2_info == MAY_BE_LONG) {
+ if (op->op1_type == IS_CONST && op->op2_type == IS_CONST) {
+ break;
+ }
+ spec = 2692 | SPEC_RULE_OP1 | SPEC_RULE_OP2 | SPEC_RULE_SMART_BRANCH | SPEC_RULE_COMMUTATIVE;
} else if (op1_info == MAY_BE_DOUBLE && op2_info == MAY_BE_DOUBLE) {
if (op->op1_type == IS_CONST && op->op2_type == IS_CONST) {
break;
}
- spec = 2512 | SPEC_RULE_OP1 | SPEC_RULE_OP2 | SPEC_RULE_COMMUTATIVE;
+ spec = 2767 | SPEC_RULE_OP1 | SPEC_RULE_OP2 | SPEC_RULE_SMART_BRANCH | SPEC_RULE_COMMUTATIVE;
+ } else if (op->op1_type == IS_CV && (op->op2_type & (IS_CONST|IS_CV)) && !(op1_info & (MAY_BE_UNDEF|MAY_BE_REF)) && !(op2_info & (MAY_BE_UNDEF|MAY_BE_REF))) {
+ spec = 2847 | SPEC_RULE_OP2 | SPEC_RULE_COMMUTATIVE;
}
break;
case ZEND_IS_EQUAL:
@@ -61580,12 +59825,12 @@ ZEND_API void ZEND_FASTCALL zend_vm_set_opcode_handler_ex(zend_op* op, uint32_t
if (op->op1_type == IS_CONST && op->op2_type == IS_CONST) {
break;
}
- spec = 2537 | SPEC_RULE_OP1 | SPEC_RULE_OP2 | SPEC_RULE_SMART_BRANCH | SPEC_RULE_COMMUTATIVE;
+ spec = 2542 | SPEC_RULE_OP1 | SPEC_RULE_OP2 | SPEC_RULE_SMART_BRANCH | SPEC_RULE_COMMUTATIVE;
} else if (op1_info == MAY_BE_DOUBLE && op2_info == MAY_BE_DOUBLE) {
if (op->op1_type == IS_CONST && op->op2_type == IS_CONST) {
break;
}
- spec = 2612 | SPEC_RULE_OP1 | SPEC_RULE_OP2 | SPEC_RULE_SMART_BRANCH | SPEC_RULE_COMMUTATIVE;
+ spec = 2617 | SPEC_RULE_OP1 | SPEC_RULE_OP2 | SPEC_RULE_SMART_BRANCH | SPEC_RULE_COMMUTATIVE;
}
break;
case ZEND_IS_NOT_EQUAL:
@@ -61596,12 +59841,12 @@ ZEND_API void ZEND_FASTCALL zend_vm_set_opcode_handler_ex(zend_op* op, uint32_t
if (op->op1_type == IS_CONST && op->op2_type == IS_CONST) {
break;
}
- spec = 2687 | SPEC_RULE_OP1 | SPEC_RULE_OP2 | SPEC_RULE_SMART_BRANCH | SPEC_RULE_COMMUTATIVE;
+ spec = 2692 | SPEC_RULE_OP1 | SPEC_RULE_OP2 | SPEC_RULE_SMART_BRANCH | SPEC_RULE_COMMUTATIVE;
} else if (op1_info == MAY_BE_DOUBLE && op2_info == MAY_BE_DOUBLE) {
if (op->op1_type == IS_CONST && op->op2_type == IS_CONST) {
break;
}
- spec = 2762 | SPEC_RULE_OP1 | SPEC_RULE_OP2 | SPEC_RULE_SMART_BRANCH | SPEC_RULE_COMMUTATIVE;
+ spec = 2767 | SPEC_RULE_OP1 | SPEC_RULE_OP2 | SPEC_RULE_SMART_BRANCH | SPEC_RULE_COMMUTATIVE;
}
break;
case ZEND_IS_SMALLER:
@@ -61609,12 +59854,12 @@ ZEND_API void ZEND_FASTCALL zend_vm_set_opcode_handler_ex(zend_op* op, uint32_t
if (op->op1_type == IS_CONST && op->op2_type == IS_CONST) {
break;
}
- spec = 2837 | SPEC_RULE_OP1 | SPEC_RULE_OP2 | SPEC_RULE_SMART_BRANCH;
+ spec = 2852 | SPEC_RULE_OP1 | SPEC_RULE_OP2 | SPEC_RULE_SMART_BRANCH;
} else if (op1_info == MAY_BE_DOUBLE && op2_info == MAY_BE_DOUBLE) {
if (op->op1_type == IS_CONST && op->op2_type == IS_CONST) {
break;
}
- spec = 2912 | SPEC_RULE_OP1 | SPEC_RULE_OP2 | SPEC_RULE_SMART_BRANCH;
+ spec = 2927 | SPEC_RULE_OP1 | SPEC_RULE_OP2 | SPEC_RULE_SMART_BRANCH;
}
break;
case ZEND_IS_SMALLER_OR_EQUAL:
@@ -61622,69 +59867,74 @@ ZEND_API void ZEND_FASTCALL zend_vm_set_opcode_handler_ex(zend_op* op, uint32_t
if (op->op1_type == IS_CONST && op->op2_type == IS_CONST) {
break;
}
- spec = 2987 | SPEC_RULE_OP1 | SPEC_RULE_OP2 | SPEC_RULE_SMART_BRANCH;
+ spec = 3002 | SPEC_RULE_OP1 | SPEC_RULE_OP2 | SPEC_RULE_SMART_BRANCH;
} else if (op1_info == MAY_BE_DOUBLE && op2_info == MAY_BE_DOUBLE) {
if (op->op1_type == IS_CONST && op->op2_type == IS_CONST) {
break;
}
- spec = 3062 | SPEC_RULE_OP1 | SPEC_RULE_OP2 | SPEC_RULE_SMART_BRANCH;
+ spec = 3077 | SPEC_RULE_OP1 | SPEC_RULE_OP2 | SPEC_RULE_SMART_BRANCH;
}
break;
case ZEND_QM_ASSIGN:
if (op1_info == MAY_BE_LONG) {
- spec = 3149 | SPEC_RULE_OP1;
+ spec = 3164 | SPEC_RULE_OP1;
} else if (op1_info == MAY_BE_DOUBLE) {
- spec = 3154 | SPEC_RULE_OP1;
+ spec = 3169 | SPEC_RULE_OP1;
} else if ((op->op1_type == IS_CONST) ? !Z_REFCOUNTED_P(RT_CONSTANT(op, op->op1)) : (!(op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE))))) {
- spec = 3159 | SPEC_RULE_OP1;
+ spec = 3174 | SPEC_RULE_OP1;
}
break;
case ZEND_PRE_INC:
if (res_info == MAY_BE_LONG && op1_info == MAY_BE_LONG) {
- spec = 3137 | SPEC_RULE_RETVAL;
+ spec = 3152 | SPEC_RULE_RETVAL;
} else if (op1_info == MAY_BE_LONG) {
- spec = 3139 | SPEC_RULE_RETVAL;
+ spec = 3154 | SPEC_RULE_RETVAL;
}
break;
case ZEND_PRE_DEC:
if (res_info == MAY_BE_LONG && op1_info == MAY_BE_LONG) {
- spec = 3141 | SPEC_RULE_RETVAL;
+ spec = 3156 | SPEC_RULE_RETVAL;
} else if (op1_info == MAY_BE_LONG) {
- spec = 3143 | SPEC_RULE_RETVAL;
+ spec = 3158 | SPEC_RULE_RETVAL;
}
break;
case ZEND_POST_INC:
if (res_info == MAY_BE_LONG && op1_info == MAY_BE_LONG) {
- spec = 3145;
+ spec = 3160;
} else if (op1_info == MAY_BE_LONG) {
- spec = 3146;
+ spec = 3161;
}
break;
case ZEND_POST_DEC:
if (res_info == MAY_BE_LONG && op1_info == MAY_BE_LONG) {
- spec = 3147;
+ spec = 3162;
} else if (op1_info == MAY_BE_LONG) {
- spec = 3148;
+ spec = 3163;
}
break;
case ZEND_JMP:
if (OP_JMP_ADDR(op, op->op1) > op) {
- spec = 2311;
+ spec = 2316;
+ }
+ break;
+ case ZEND_RECV:
+ if (op->op2.num == MAY_BE_ANY) {
+ spec = 2315;
}
break;
case ZEND_SEND_VAL:
if (op->op1_type == IS_CONST && !Z_REFCOUNTED_P(RT_CONSTANT(op, op->op1))) {
- spec = 3199;
+ spec = 3214;
}
break;
case ZEND_SEND_VAR_EX:
if (op->op2.num <= MAX_ARG_FLAG_NUM && (op1_info & (MAY_BE_UNDEF|MAY_BE_REF)) == 0) {
- spec = 3194 | SPEC_RULE_OP1;
+ spec = 3209 | SPEC_RULE_OP1;
}
break;
case ZEND_FE_FETCH_R:
if (op->op2_type == IS_CV && (op1_info & (MAY_BE_UNDEF|MAY_BE_ANY|MAY_BE_REF)) == MAY_BE_ARRAY) {
- spec = 3201 | SPEC_RULE_RETVAL;
+ spec = 3216 | SPEC_RULE_RETVAL;
}
break;
case ZEND_FETCH_DIM_R:
@@ -61692,25 +59942,23 @@ ZEND_API void ZEND_FASTCALL zend_vm_set_opcode_handler_ex(zend_op* op, uint32_t
if (op->op1_type == IS_CONST && op->op2_type == IS_CONST) {
break;
}
- spec = 3164 | SPEC_RULE_OP1 | SPEC_RULE_OP2;
+ spec = 3179 | SPEC_RULE_OP1 | SPEC_RULE_OP2;
}
break;
case ZEND_SEND_VAL_EX:
if (op->op2.num <= MAX_ARG_FLAG_NUM && op->op1_type == IS_CONST && !Z_REFCOUNTED_P(RT_CONSTANT(op, op->op1))) {
- spec = 3200;
+ spec = 3215;
}
break;
case ZEND_SEND_VAR:
if ((op1_info & (MAY_BE_UNDEF|MAY_BE_REF)) == 0) {
- spec = 3189 | SPEC_RULE_OP1;
+ spec = 3204 | SPEC_RULE_OP1;
}
break;
case ZEND_BW_OR:
case ZEND_BW_AND:
case ZEND_BW_XOR:
case ZEND_BOOL_XOR:
- case ZEND_IS_IDENTICAL:
- case ZEND_IS_NOT_IDENTICAL:
if (op->op1_type < op->op2_type) {
zend_swap_operands(op);
}
@@ -61725,7 +59973,7 @@ ZEND_API void ZEND_FASTCALL zend_vm_set_opcode_handler_ex(zend_op* op, uint32_t
default:
break;
}
- op->handler = zend_vm_get_opcode_handler_ex(spec, op);
+ op->handler = zend_opcode_handlers[zend_vm_get_opcode_handler_idx(spec, op)];
}
ZEND_API int ZEND_FASTCALL zend_vm_call_opcode_handler(zend_execute_data* ex)
diff --git a/Zend/zend_vm_execute.skl b/Zend/zend_vm_execute.skl
index 3e520e9bac..27aae16391 100644
--- a/Zend/zend_vm_execute.skl
+++ b/Zend/zend_vm_execute.skl
@@ -67,17 +67,13 @@ void {%INITIALIZER_NAME%}(void)
VM_TRACE_START();
}
-static HashTable *zend_handlers_table = NULL;
-
void zend_vm_dtor(void)
{
VM_TRACE_END();
- if (zend_handlers_table) {
- zend_hash_destroy(zend_handlers_table);
- free(zend_handlers_table);
- }
}
+static HashTable *zend_handlers_table = NULL;
+
static void init_opcode_serialiser(void)
{
int i;
diff --git a/Zend/zend_vm_gen.php b/Zend/zend_vm_gen.php
index 22586cbd0b..d2d4d0d111 100755
--- a/Zend/zend_vm_gen.php
+++ b/Zend/zend_vm_gen.php
@@ -77,7 +77,7 @@ $vm_op_flags = array(
"ZEND_VM_EXT_ARRAY_INIT" => 1<<19,
"ZEND_VM_EXT_REF" => 1<<20,
"ZEND_VM_EXT_FETCH_REF" => 1<<21,
- "ZEND_VM_EXT_DIM_OBJ_WRITE" => 1<<22,
+ "ZEND_VM_EXT_DIM_WRITE" => 1<<22,
"ZEND_VM_EXT_MASK" => 0x0f000000,
"ZEND_VM_EXT_NUM" => 0x01000000,
"ZEND_VM_EXT_LAST_CATCH" => 0x02000000,
@@ -134,7 +134,7 @@ $vm_ext_decode = array(
"FETCH_REF" => ZEND_VM_EXT_FETCH_REF,
"SRC" => ZEND_VM_EXT_SRC,
"CACHE_SLOT" => ZEND_VM_EXT_CACHE_SLOT,
- "DIM_OBJ_WRITE" => ZEND_VM_EXT_DIM_OBJ_WRITE,
+ "DIM_WRITE" => ZEND_VM_EXT_DIM_WRITE,
);
$vm_kind_name = array(
@@ -208,54 +208,32 @@ $op2_type = array(
"TMPVARCV" => "(IS_TMP_VAR|IS_VAR|IS_CV)",
);
-$op1_free = array(
- "ANY" => "(free_op1 != NULL)",
- "TMP" => "1",
- "VAR" => "(free_op1 != NULL)",
- "CONST" => "0",
- "UNUSED" => "0",
- "CV" => "0",
- "TMPVAR" => "???",
- "TMPVARCV" => "???",
-);
-
-$op2_free = array(
- "ANY" => "(free_op2 != NULL)",
- "TMP" => "1",
- "VAR" => "(free_op2 != NULL)",
- "CONST" => "0",
- "UNUSED" => "0",
- "CV" => "0",
- "TMPVAR" => "???",
- "TMPVARCV" => "???",
-);
-
$op1_get_zval_ptr = array(
- "ANY" => "get_zval_ptr(opline->op1_type, opline->op1, &free_op1, \\1)",
- "TMP" => "_get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC)",
- "VAR" => "_get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC)",
+ "ANY" => "get_zval_ptr(opline->op1_type, opline->op1, \\1)",
+ "TMP" => "_get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC)",
"CONST" => "RT_CONSTANT(opline, opline->op1)",
"UNUSED" => "NULL",
"CV" => "_get_zval_ptr_cv_\\1(opline->op1.var EXECUTE_DATA_CC)",
- "TMPVAR" => "_get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC)",
+ "TMPVAR" => "_get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC)",
"TMPVARCV" => "???",
);
$op2_get_zval_ptr = array(
- "ANY" => "get_zval_ptr(opline->op2_type, opline->op2, &free_op2, \\1)",
- "TMP" => "_get_zval_ptr_tmp(opline->op2.var, &free_op2 EXECUTE_DATA_CC)",
- "VAR" => "_get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC)",
+ "ANY" => "get_zval_ptr(opline->op2_type, opline->op2, \\1)",
+ "TMP" => "_get_zval_ptr_tmp(opline->op2.var EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC)",
"CONST" => "RT_CONSTANT(opline, opline->op2)",
"UNUSED" => "NULL",
"CV" => "_get_zval_ptr_cv_\\1(opline->op2.var EXECUTE_DATA_CC)",
- "TMPVAR" => "_get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC)",
+ "TMPVAR" => "_get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC)",
"TMPVARCV" => "???",
);
$op1_get_zval_ptr_ptr = array(
- "ANY" => "get_zval_ptr_ptr(opline->op1_type, opline->op1, &free_op1, \\1)",
+ "ANY" => "get_zval_ptr_ptr(opline->op1_type, opline->op1, \\1)",
"TMP" => "NULL",
- "VAR" => "_get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC)",
"CONST" => "NULL",
"UNUSED" => "NULL",
"CV" => "_get_zval_ptr_cv_\\1(opline->op1.var EXECUTE_DATA_CC)",
@@ -264,9 +242,9 @@ $op1_get_zval_ptr_ptr = array(
);
$op2_get_zval_ptr_ptr = array(
- "ANY" => "get_zval_ptr_ptr(opline->op2_type, opline->op2, &free_op2, \\1)",
+ "ANY" => "get_zval_ptr_ptr(opline->op2_type, opline->op2, \\1)",
"TMP" => "NULL",
- "VAR" => "_get_zval_ptr_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_ptr_var(opline->op2.var EXECUTE_DATA_CC)",
"CONST" => "NULL",
"UNUSED" => "NULL",
"CV" => "_get_zval_ptr_cv_\\1(opline->op2.var EXECUTE_DATA_CC)",
@@ -275,9 +253,9 @@ $op2_get_zval_ptr_ptr = array(
);
$op1_get_zval_ptr_deref = array(
- "ANY" => "get_zval_ptr_deref(opline->op1_type, opline->op1, &free_op1, \\1)",
- "TMP" => "_get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC)",
- "VAR" => "_get_zval_ptr_var_deref(opline->op1.var, &free_op1 EXECUTE_DATA_CC)",
+ "ANY" => "get_zval_ptr_deref(opline->op1_type, opline->op1, \\1)",
+ "TMP" => "_get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_var_deref(opline->op1.var EXECUTE_DATA_CC)",
"CONST" => "RT_CONSTANT(opline, opline->op1)",
"UNUSED" => "NULL",
"CV" => "_get_zval_ptr_cv_deref_\\1(opline->op1.var EXECUTE_DATA_CC)",
@@ -286,9 +264,9 @@ $op1_get_zval_ptr_deref = array(
);
$op2_get_zval_ptr_deref = array(
- "ANY" => "get_zval_ptr_deref(opline->op2_type, opline->op2, &free_op2, \\1)",
- "TMP" => "_get_zval_ptr_tmp(opline->op2.var, &free_op2 EXECUTE_DATA_CC)",
- "VAR" => "_get_zval_ptr_var_deref(opline->op2.var, &free_op2 EXECUTE_DATA_CC)",
+ "ANY" => "get_zval_ptr_deref(opline->op2_type, opline->op2, \\1)",
+ "TMP" => "_get_zval_ptr_tmp(opline->op2.var EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_var_deref(opline->op2.var EXECUTE_DATA_CC)",
"CONST" => "RT_CONSTANT(opline, opline->op2)",
"UNUSED" => "NULL",
"CV" => "_get_zval_ptr_cv_deref_\\1(opline->op2.var EXECUTE_DATA_CC)",
@@ -297,31 +275,31 @@ $op2_get_zval_ptr_deref = array(
);
$op1_get_zval_ptr_undef = array(
- "ANY" => "get_zval_ptr_undef(opline->op1_type, opline->op1, &free_op1, \\1)",
- "TMP" => "_get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC)",
- "VAR" => "_get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC)",
+ "ANY" => "get_zval_ptr_undef(opline->op1_type, opline->op1, \\1)",
+ "TMP" => "_get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC)",
"CONST" => "RT_CONSTANT(opline, opline->op1)",
"UNUSED" => "NULL",
"CV" => "EX_VAR(opline->op1.var)",
- "TMPVAR" => "_get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC)",
+ "TMPVAR" => "_get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC)",
"TMPVARCV" => "EX_VAR(opline->op1.var)",
);
$op2_get_zval_ptr_undef = array(
- "ANY" => "get_zval_ptr_undef(opline->op2_type, opline->op2, &free_op2, \\1)",
- "TMP" => "_get_zval_ptr_tmp(opline->op2.var, &free_op2 EXECUTE_DATA_CC)",
- "VAR" => "_get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC)",
+ "ANY" => "get_zval_ptr_undef(opline->op2_type, opline->op2, \\1)",
+ "TMP" => "_get_zval_ptr_tmp(opline->op2.var EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC)",
"CONST" => "RT_CONSTANT(opline, opline->op2)",
"UNUSED" => "NULL",
"CV" => "EX_VAR(opline->op2.var)",
- "TMPVAR" => "_get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC)",
+ "TMPVAR" => "_get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC)",
"TMPVARCV" => "EX_VAR(opline->op2.var)",
);
$op1_get_zval_ptr_ptr_undef = array(
- "ANY" => "get_zval_ptr_ptr_undef(opline->op1_type, opline->op1, &free_op1, \\1)",
+ "ANY" => "get_zval_ptr_ptr_undef(opline->op1_type, opline->op1, \\1)",
"TMP" => "NULL",
- "VAR" => "_get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC)",
"CONST" => "NULL",
"UNUSED" => "NULL",
"CV" => "EX_VAR(opline->op1.var)",
@@ -330,9 +308,9 @@ $op1_get_zval_ptr_ptr_undef = array(
);
$op2_get_zval_ptr_ptr_undef = array(
- "ANY" => "get_zval_ptr_ptr_undef(opline->op2_type, opline->op2, &free_op2, \\1)",
+ "ANY" => "get_zval_ptr_ptr_undef(opline->op2_type, opline->op2, \\1)",
"TMP" => "NULL",
- "VAR" => "_get_zval_ptr_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_ptr_var(opline->op2.var EXECUTE_DATA_CC)",
"CONST" => "NULL",
"UNUSED" => "NULL",
"CV" => "EX_VAR(opline->op2.var)",
@@ -341,53 +319,53 @@ $op2_get_zval_ptr_ptr_undef = array(
);
$op1_get_obj_zval_ptr = array(
- "ANY" => "get_obj_zval_ptr(opline->op1_type, opline->op1, &free_op1, \\1)",
- "TMP" => "_get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC)",
- "VAR" => "_get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC)",
+ "ANY" => "get_obj_zval_ptr(opline->op1_type, opline->op1, \\1)",
+ "TMP" => "_get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC)",
"CONST" => "RT_CONSTANT(opline, opline->op1)",
"UNUSED" => "&EX(This)",
"CV" => "_get_zval_ptr_cv_\\1(opline->op1.var EXECUTE_DATA_CC)",
- "TMPVAR" => "_get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC)",
+ "TMPVAR" => "_get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC)",
"TMPVARCV" => "???",
);
$op2_get_obj_zval_ptr = array(
- "ANY" => "get_obj_zval_ptr(opline->op2_type, opline->op2, &free_op2, \\1)",
- "TMP" => "_get_zval_ptr_tmp(opline->op2.var, &free_op2 EXECUTE_DATA_CC)",
- "VAR" => "_get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC)",
+ "ANY" => "get_obj_zval_ptr(opline->op2_type, opline->op2, \\1)",
+ "TMP" => "_get_zval_ptr_tmp(opline->op2.var EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC)",
"CONST" => "RT_CONSTANT(opline, opline->op2)",
"UNUSED" => "&EX(This)",
"CV" => "_get_zval_ptr_cv_\\1(opline->op2.var EXECUTE_DATA_CC)",
- "TMPVAR" => "_get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC)",
+ "TMPVAR" => "_get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC)",
"TMPVARCV" => "???",
);
$op1_get_obj_zval_ptr_undef = array(
- "ANY" => "get_obj_zval_ptr_undef(opline->op1_type, opline->op1, &free_op1, \\1)",
- "TMP" => "_get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC)",
- "VAR" => "_get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC)",
+ "ANY" => "get_obj_zval_ptr_undef(opline->op1_type, opline->op1, \\1)",
+ "TMP" => "_get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC)",
"CONST" => "RT_CONSTANT(opline, opline->op1)",
"UNUSED" => "&EX(This)",
"CV" => "EX_VAR(opline->op1.var)",
- "TMPVAR" => "_get_zval_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC)",
+ "TMPVAR" => "_get_zval_ptr_var(opline->op1.var EXECUTE_DATA_CC)",
"TMPVARCV" => "EX_VAR(opline->op1.var)",
);
$op2_get_obj_zval_ptr_undef = array(
- "ANY" => "get_obj_zval_ptr_undef(opline->op2_type, opline->op2, &free_op2, \\1)",
- "TMP" => "_get_zval_ptr_tmp(opline->op2.var, &free_op2 EXECUTE_DATA_CC)",
- "VAR" => "_get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC)",
+ "ANY" => "get_obj_zval_ptr_undef(opline->op2_type, opline->op2, \\1)",
+ "TMP" => "_get_zval_ptr_tmp(opline->op2.var EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC)",
"CONST" => "RT_CONSTANT(opline, opline->op2)",
"UNUSED" => "&EX(This)",
"CV" => "EX_VAR(opline->op2.var)",
- "TMPVAR" => "_get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC)",
+ "TMPVAR" => "_get_zval_ptr_var(opline->op2.var EXECUTE_DATA_CC)",
"TMPVARCV" => "EX_VAR(opline->op2.var)",
);
$op1_get_obj_zval_ptr_deref = array(
- "ANY" => "get_obj_zval_ptr(opline->op1_type, opline->op1, &free_op1, \\1)",
- "TMP" => "_get_zval_ptr_tmp(opline->op1.var, &free_op1 EXECUTE_DATA_CC)",
- "VAR" => "_get_zval_ptr_var_deref(opline->op1.var, &free_op1 EXECUTE_DATA_CC)",
+ "ANY" => "get_obj_zval_ptr(opline->op1_type, opline->op1, \\1)",
+ "TMP" => "_get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_var_deref(opline->op1.var EXECUTE_DATA_CC)",
"CONST" => "RT_CONSTANT(opline, opline->op1)",
"UNUSED" => "&EX(This)",
"CV" => "_get_zval_ptr_cv_deref_\\1(opline->op1.var EXECUTE_DATA_CC)",
@@ -396,9 +374,9 @@ $op1_get_obj_zval_ptr_deref = array(
);
$op2_get_obj_zval_ptr_deref = array(
- "ANY" => "get_obj_zval_ptr(opline->op2_type, opline->op2, &free_op2, \\1)",
- "TMP" => "_get_zval_ptr_tmp(opline->op2.var, &free_op2 EXECUTE_DATA_CC)",
- "VAR" => "_get_zval_ptr_var_deref(opline->op2.var, &free_op2 EXECUTE_DATA_CC)",
+ "ANY" => "get_obj_zval_ptr(opline->op2_type, opline->op2, \\1)",
+ "TMP" => "_get_zval_ptr_tmp(opline->op2.var EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_var_deref(opline->op2.var EXECUTE_DATA_CC)",
"CONST" => "RT_CONSTANT(opline, opline->op2)",
"UNUSED" => "&EX(This)",
"CV" => "_get_zval_ptr_cv_deref_\\1(opline->op2.var EXECUTE_DATA_CC)",
@@ -407,9 +385,9 @@ $op2_get_obj_zval_ptr_deref = array(
);
$op1_get_obj_zval_ptr_ptr = array(
- "ANY" => "get_obj_zval_ptr_ptr(opline->op1_type, opline->op1, &free_op1, \\1)",
+ "ANY" => "get_obj_zval_ptr_ptr(opline->op1_type, opline->op1, \\1)",
"TMP" => "NULL",
- "VAR" => "_get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC)",
"CONST" => "NULL",
"UNUSED" => "&EX(This)",
"CV" => "_get_zval_ptr_cv_\\1(opline->op1.var EXECUTE_DATA_CC)",
@@ -418,9 +396,9 @@ $op1_get_obj_zval_ptr_ptr = array(
);
$op2_get_obj_zval_ptr_ptr = array(
- "ANY" => "get_obj_zval_ptr_ptr(opline->op2_type, opline->op2, &free_op2, \\1)",
+ "ANY" => "get_obj_zval_ptr_ptr(opline->op2_type, opline->op2, \\1)",
"TMP" => "NULL",
- "VAR" => "_get_zval_ptr_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_ptr_var(opline->op2.var EXECUTE_DATA_CC)",
"CONST" => "NULL",
"UNUSED" => "&EX(This)",
"CV" => "_get_zval_ptr_cv_\\1(opline->op2.var EXECUTE_DATA_CC)",
@@ -429,9 +407,9 @@ $op2_get_obj_zval_ptr_ptr = array(
);
$op1_get_obj_zval_ptr_ptr_undef = array(
- "ANY" => "get_obj_zval_ptr_ptr(opline->op1_type, opline->op1, &free_op1, \\1)",
+ "ANY" => "get_obj_zval_ptr_ptr(opline->op1_type, opline->op1, \\1)",
"TMP" => "NULL",
- "VAR" => "_get_zval_ptr_ptr_var(opline->op1.var, &free_op1 EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_ptr_var(opline->op1.var EXECUTE_DATA_CC)",
"CONST" => "NULL",
"UNUSED" => "&EX(This)",
"CV" => "EX_VAR(opline->op1.var)",
@@ -440,9 +418,9 @@ $op1_get_obj_zval_ptr_ptr_undef = array(
);
$op2_get_obj_zval_ptr_ptr_undef = array(
- "ANY" => "get_obj_zval_ptr_ptr(opline->op2_type, opline->op2, &free_op2, \\1)",
+ "ANY" => "get_obj_zval_ptr_ptr(opline->op2_type, opline->op2, \\1)",
"TMP" => "NULL",
- "VAR" => "_get_zval_ptr_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_ptr_var(opline->op2.var EXECUTE_DATA_CC)",
"CONST" => "NULL",
"UNUSED" => "&EX(This)",
"CV" => "EX_VAR(opline->op2.var)",
@@ -451,31 +429,31 @@ $op2_get_obj_zval_ptr_ptr_undef = array(
);
$op1_free_op = array(
- "ANY" => "FREE_OP(free_op1)",
- "TMP" => "zval_ptr_dtor_nogc(free_op1)",
- "VAR" => "zval_ptr_dtor_nogc(free_op1)",
+ "ANY" => "FREE_OP(opline->op1_type, opline->op1.var)",
+ "TMP" => "zval_ptr_dtor_nogc(EX_VAR(opline->op1.var))",
+ "VAR" => "zval_ptr_dtor_nogc(EX_VAR(opline->op1.var))",
"CONST" => "",
"UNUSED" => "",
"CV" => "",
- "TMPVAR" => "zval_ptr_dtor_nogc(free_op1)",
+ "TMPVAR" => "zval_ptr_dtor_nogc(EX_VAR(opline->op1.var))",
"TMPVARCV" => "???",
);
$op2_free_op = array(
- "ANY" => "FREE_OP(free_op2)",
- "TMP" => "zval_ptr_dtor_nogc(free_op2)",
- "VAR" => "zval_ptr_dtor_nogc(free_op2)",
+ "ANY" => "FREE_OP(opline->op2_type, opline->op2.var)",
+ "TMP" => "zval_ptr_dtor_nogc(EX_VAR(opline->op2.var))",
+ "VAR" => "zval_ptr_dtor_nogc(EX_VAR(opline->op2.var))",
"CONST" => "",
"UNUSED" => "",
"CV" => "",
- "TMPVAR" => "zval_ptr_dtor_nogc(free_op2)",
+ "TMPVAR" => "zval_ptr_dtor_nogc(EX_VAR(opline->op2.var))",
"TMPVARCV" => "???",
);
$op1_free_op_if_var = array(
- "ANY" => "if (opline->op1_type == IS_VAR) {zval_ptr_dtor_nogc(free_op1);}",
+ "ANY" => "if (opline->op1_type == IS_VAR) {zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));}",
"TMP" => "",
- "VAR" => "zval_ptr_dtor_nogc(free_op1)",
+ "VAR" => "zval_ptr_dtor_nogc(EX_VAR(opline->op1.var))",
"CONST" => "",
"UNUSED" => "",
"CV" => "",
@@ -484,9 +462,9 @@ $op1_free_op_if_var = array(
);
$op2_free_op_if_var = array(
- "ANY" => "if (opline->op2_type == IS_VAR) {zval_ptr_dtor_nogc(free_op2);}",
+ "ANY" => "if (opline->op2_type == IS_VAR) {zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));}",
"TMP" => "",
- "VAR" => "zval_ptr_dtor_nogc(free_op2)",
+ "VAR" => "zval_ptr_dtor_nogc(EX_VAR(opline->op2.var))",
"CONST" => "",
"UNUSED" => "",
"CV" => "",
@@ -495,9 +473,9 @@ $op2_free_op_if_var = array(
);
$op1_free_op_var_ptr = array(
- "ANY" => "if (free_op1) {zval_ptr_dtor_nogc(free_op1);}",
+ "ANY" => "if (opline->op1_type == IS_VAR) {zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));}",
"TMP" => "",
- "VAR" => "if (UNEXPECTED(free_op1)) {zval_ptr_dtor_nogc(free_op1);}",
+ "VAR" => "zval_ptr_dtor_nogc(EX_VAR(opline->op1.var))",
"CONST" => "",
"UNUSED" => "",
"CV" => "",
@@ -506,9 +484,9 @@ $op1_free_op_var_ptr = array(
);
$op2_free_op_var_ptr = array(
- "ANY" => "if (free_op2) {zval_ptr_dtor_nogc(free_op2);}",
+ "ANY" => "if (opline->op2_type == IS_VAR) {zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));}",
"TMP" => "",
- "VAR" => "if (UNEXPECTED(free_op2)) {zval_ptr_dtor_nogc(free_op2);}",
+ "VAR" => "zval_ptr_dtor_nogc(EX_VAR(opline->op2.var))",
"CONST" => "",
"UNUSED" => "",
"CV" => "",
@@ -550,20 +528,20 @@ $op_data_type = array(
);
$op_data_get_zval_ptr = array(
- "ANY" => "get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data)",
- "TMP" => "_get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC)",
- "VAR" => "_get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC)",
+ "ANY" => "get_op_data_zval_ptr_r((opline+1)->op1_type, (opline+1)->op1)",
+ "TMP" => "_get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC)",
"CONST" => "RT_CONSTANT((opline+1), (opline+1)->op1)",
"UNUSED" => "NULL",
"CV" => "_get_zval_ptr_cv_\\1((opline+1)->op1.var EXECUTE_DATA_CC)",
- "TMPVAR" => "_get_zval_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC)",
+ "TMPVAR" => "_get_zval_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC)",
"TMPVARCV" => "???",
);
$op_data_get_zval_ptr_deref = array(
- "ANY" => "get_op_data_zval_ptr_deref_r((opline+1)->op1_type, (opline+1)->op1, &free_op_data)",
- "TMP" => "_get_zval_ptr_tmp((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC)",
- "VAR" => "_get_zval_ptr_var_deref((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC)",
+ "ANY" => "get_op_data_zval_ptr_deref_r((opline+1)->op1_type, (opline+1)->op1)",
+ "TMP" => "_get_zval_ptr_tmp((opline+1)->op1.var EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_var_deref((opline+1)->op1.var EXECUTE_DATA_CC)",
"CONST" => "RT_CONSTANT((opline+1), (opline+1)->op1)",
"UNUSED" => "NULL",
"CV" => "_get_zval_ptr_cv_deref_\\1((opline+1)->op1.var EXECUTE_DATA_CC)",
@@ -572,9 +550,9 @@ $op_data_get_zval_ptr_deref = array(
);
$op_data_get_zval_ptr_ptr = array(
- "ANY" => "get_zval_ptr_ptr((opline+1)->op1_type, (opline+1)->op1, &free_op_data, \\1)",
+ "ANY" => "get_zval_ptr_ptr((opline+1)->op1_type, (opline+1)->op1, \\1)",
"TMP" => "NULL",
- "VAR" => "_get_zval_ptr_ptr_var((opline+1)->op1.var, &free_op_data EXECUTE_DATA_CC)",
+ "VAR" => "_get_zval_ptr_ptr_var((opline+1)->op1.var EXECUTE_DATA_CC)",
"CONST" => "NULL",
"UNUSED" => "NULL",
"CV" => "_get_zval_ptr_cv_\\1((opline+1)->op1.var EXECUTE_DATA_CC)",
@@ -583,20 +561,20 @@ $op_data_get_zval_ptr_ptr = array(
);
$op_data_free_op = array(
- "ANY" => "FREE_OP(free_op_data)",
- "TMP" => "zval_ptr_dtor_nogc(free_op_data)",
- "VAR" => "zval_ptr_dtor_nogc(free_op_data)",
+ "ANY" => "FREE_OP((opline+1)->op1_type, (opline+1)->op1.var)",
+ "TMP" => "zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var))",
+ "VAR" => "zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var))",
"CONST" => "",
"UNUSED" => "",
"CV" => "",
- "TMPVAR" => "zval_ptr_dtor_nogc(free_op_data)",
+ "TMPVAR" => "zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var))",
"TMPVARCV" => "???",
);
$op_data_free_op_var_ptr = array(
- "ANY" => "if (free_op_data) {zval_ptr_dtor_nogc(free_op_data);}",
+ "ANY" => "if ((opline+1)->op1_type == IS_VAR) {zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));}",
"TMP" => "",
- "VAR" => "if (UNEXPECTED(free_op_data)) {zval_ptr_dtor_nogc(free_op_data);}",
+ "VAR" => "zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));",
"CONST" => "",
"UNUSED" => "",
"CV" => "",
@@ -771,7 +749,7 @@ function gen_code($f, $spec, $kind, $export, $code, $op1, $op2, $name, $extra_sp
$op1_get_obj_zval_ptr_deref, $op2_get_obj_zval_ptr_deref,
$op1_get_obj_zval_ptr_ptr, $op2_get_obj_zval_ptr_ptr,
$op1_get_obj_zval_ptr_ptr_undef, $op2_get_obj_zval_ptr_ptr_undef,
- $op1_free, $op2_free, $op1_free_unfetched, $op2_free_unfetched,
+ $op1_free_unfetched, $op2_free_unfetched,
$op1_free_op, $op2_free_op, $op1_free_op_if_var, $op2_free_op_if_var,
$op1_free_op_var_ptr, $op2_free_op_var_ptr, $prefix,
$op_data_type, $op_data_get_zval_ptr,
@@ -782,8 +760,6 @@ function gen_code($f, $spec, $kind, $export, $code, $op1, $op2, $name, $extra_sp
$specialized_replacements = array(
"/OP1_TYPE/" => $op1_type[$op1],
"/OP2_TYPE/" => $op2_type[$op2],
- "/OP1_FREE/" => $op1_free[$op1],
- "/OP2_FREE/" => $op2_free[$op2],
"/GET_OP1_ZVAL_PTR\(([^)]*)\)/" => $op1_get_zval_ptr[$op1],
"/GET_OP2_ZVAL_PTR\(([^)]*)\)/" => $op2_get_zval_ptr[$op2],
"/GET_OP1_ZVAL_PTR_DEREF\(([^)]*)\)/" => $op1_get_zval_ptr_deref[$op1],
@@ -835,19 +811,19 @@ function gen_code($f, $spec, $kind, $export, $code, $op1, $op2, $name, $extra_sp
($extra_spec['SMART_BRANCH'] == 1 ?
"ZEND_VM_SMART_BRANCH_JMPZ(\\1, \\2)"
: ($extra_spec['SMART_BRANCH'] == 2 ?
- "ZEND_VM_SMART_BRANCH_JMPNZ(\\1, \\2)" : ""))
+ "ZEND_VM_SMART_BRANCH_JMPNZ(\\1, \\2)" : "ZEND_VM_SMART_BRANCH_NONE(\\1, \\2)"))
: "ZEND_VM_SMART_BRANCH(\\1, \\2)",
"/ZEND_VM_SMART_BRANCH_TRUE\(\s*\)/" => isset($extra_spec['SMART_BRANCH']) ?
($extra_spec['SMART_BRANCH'] == 1 ?
"ZEND_VM_SMART_BRANCH_TRUE_JMPZ()"
: ($extra_spec['SMART_BRANCH'] == 2 ?
- "ZEND_VM_SMART_BRANCH_TRUE_JMPNZ()" : ""))
+ "ZEND_VM_SMART_BRANCH_TRUE_JMPNZ()" : "ZEND_VM_SMART_BRANCH_TRUE_NONE()"))
: "ZEND_VM_SMART_BRANCH_TRUE()",
"/ZEND_VM_SMART_BRANCH_FALSE\(\s*\)/" => isset($extra_spec['SMART_BRANCH']) ?
($extra_spec['SMART_BRANCH'] == 1 ?
"ZEND_VM_SMART_BRANCH_FALSE_JMPZ()"
: ($extra_spec['SMART_BRANCH'] == 2 ?
- "ZEND_VM_SMART_BRANCH_FALSE_JMPNZ()" : ""))
+ "ZEND_VM_SMART_BRANCH_FALSE_JMPNZ()" : "ZEND_VM_SMART_BRANCH_FALSE_NONE()"))
: "ZEND_VM_SMART_BRANCH_FALSE()",
"/opline->extended_value\s*&\s*ZEND_ISEMPTY/" => isset($extra_spec['ISSET']) ?
($extra_spec['ISSET'] == 0 ? "0" : "1")
@@ -983,44 +959,6 @@ function gen_code($f, $spec, $kind, $export, $code, $op1, $op2, $name, $extra_sp
break;
}
- /* Remove unused free_op1 and free_op2 declarations */
- if ($spec && preg_match_all('/^\s*zend_free_op\s+[^;]+;\s*$/m', $code, $matches, PREG_SET_ORDER)) {
- $n = 0;
- foreach ($matches as $match) {
- $code = preg_replace('/'.preg_quote($match[0],'/').'/', "\$D$n", $code);
- ++$n;
- }
- $del_free_op1 = (strpos($code, "free_op1") === false);
- $del_free_op2 = (strpos($code, "free_op2") === false);
- $del_free_op_data = (strpos($code, "free_op_data") === false);
- $n = 0;
- foreach ($matches as $match) {
- $dcl = $match[0];
- $changed = 0;
- if ($del_free_op1 && strpos($dcl, "free_op1") !== false) {
- $dcl = preg_replace("/free_op1\s*,\s*/", "", $dcl);
- $dcl = preg_replace("/free_op1\s*;/", ";", $dcl);
- $changed = 1;
- }
- if ($del_free_op2 && strpos($dcl, "free_op2") !== false) {
- $dcl = preg_replace("/free_op2\s*,\s*/", "", $dcl);
- $dcl = preg_replace("/free_op2\s*;/", ";", $dcl);
- $changed = 1;
- }
- if ($del_free_op_data && strpos($dcl, "free_op_data") !== false) {
- $dcl = preg_replace("/free_op_data\s*,\s*/", "", $dcl);
- $dcl = preg_replace("/free_op_data\s*;/", ";", $dcl);
- $changed = 1;
- }
- if ($changed) {
- $dcl = preg_replace("/,\s*;/", ";", $dcl);
- $dcl = preg_replace("/zend_free_op\s*;/", "", $dcl);
- }
- $code = preg_replace("/\\\$D$n/", $dcl, $code);
- ++$n;
- }
- }
-
/* Remove unnecessary ';' */
$code = preg_replace('/^\s*;\s*$/m', '', $code);
@@ -2456,19 +2394,22 @@ function gen_vm($def, $skel) {
strpos($line,"ZEND_VM_HOT_OBJ_TYPE_SPEC_HANDLER(") === 0) {
// Parsing opcode handler's definition
if (preg_match(
- "/^ZEND_VM_(HOT_|INLINE_|HOT_OBJ_|HOT_SEND_|HOT_NOCONST_|HOT_NOCONSTCONST_)?TYPE_SPEC_HANDLER\(\s*([A-Z_]+)\s*,\s*((?:[^(,]|\([^()]*|(?R)*\))*),\s*([A-Za-z_]+)\s*,\s*([A-Z_|]+)\s*,\s*([A-Z_|]+)\s*(,\s*([A-Z_|]+)\s*)?(,\s*SPEC\(([A-Z_|=,]+)\)\s*)?\)/",
+ "/^ZEND_VM_(HOT_|INLINE_|HOT_OBJ_|HOT_SEND_|HOT_NOCONST_|HOT_NOCONSTCONST_)?TYPE_SPEC_HANDLER\(\s*([A-Z_|]+)\s*,\s*((?:[^(,]|\([^()]*|(?R)*\))*),\s*([A-Za-z_]+)\s*,\s*([A-Z_|]+)\s*,\s*([A-Z_|]+)\s*(,\s*([A-Z_|]+)\s*)?(,\s*SPEC\(([A-Z_|=,]+)\)\s*)?\)/",
$line,
$m) == 0) {
die("ERROR ($def:$lineno): Invalid ZEND_VM_TYPE_HANDLER_HANDLER definition.\n");
}
$hot = !empty($m[1]) ? $m[1] : false;
- $orig_op = $m[2];
- if (!isset($opnames[$orig_op])) {
- die("ERROR ($def:$lineno): Opcode with name '$orig_op' is not defined.\n");
- }
- $orig_code = $opnames[$orig_op];
- $condition = $m[3];
+ $orig_op_list = $m[2];
$code = $extra_num++;
+ foreach (explode('|', $orig_op_list) as $orig_op) {
+ if (!isset($opnames[$orig_op])) {
+ die("ERROR ($def:$lineno): Opcode with name '$orig_op' is not defined.\n");
+ }
+ $orig_code = $opnames[$orig_op];
+ $condition = $m[3];
+ $opcodes[$orig_code]['type_spec'][$code] = $condition;
+ }
$op = $m[4];
$op1 = parse_operand_spec($def, $lineno, $m[5], $flags1);
$op2 = parse_operand_spec($def, $lineno, $m[6], $flags2);
@@ -2480,7 +2421,6 @@ function gen_vm($def, $skel) {
if (isset($opcodes[$code])) {
die("ERROR ($def:$lineno): Opcode with name '$code' is already defined.\n");
}
- $opcodes[$orig_code]['type_spec'][$code] = $condition;
$used_extra_spec["TYPE"] = 1;
$opcodes[$code] = array("op"=>$op,"op1"=>$op1,"op2"=>$op2,"code"=>"","flags"=>$flags,"hot"=>$hot,"is_type_spec"=>true);
if (isset($m[10])) {
@@ -2756,10 +2696,10 @@ function gen_vm($def, $skel) {
out($f, "\n");
// Generate zend_vm_get_opcode_handler() function
- out($f, "static const void* ZEND_FASTCALL zend_vm_get_opcode_handler_ex(uint32_t spec, const zend_op* op)\n");
+ out($f, "static uint32_t ZEND_FASTCALL zend_vm_get_opcode_handler_idx(uint32_t spec, const zend_op* op)\n");
out($f, "{\n");
if (!ZEND_VM_SPEC) {
- out($f, "\treturn zend_opcode_handlers[spec];\n");
+ out($f, "\treturn spec;\n");
} else {
out($f, "\tstatic const int zend_vm_decode[] = {\n");
out($f, "\t\t_UNUSED_CODE, /* 0 = IS_UNUSED */\n");
@@ -2808,9 +2748,9 @@ function gen_vm($def, $skel) {
if (isset($used_extra_spec["SMART_BRANCH"])) {
out($f, "\t\t{$else}if (spec & SPEC_RULE_SMART_BRANCH) {\n");
out($f, "\t\t\toffset = offset * 3;\n");
- out($f, "\t\t\tif ((op+1)->opcode == ZEND_JMPZ) {\n");
+ out($f, "\t\t\tif (op->result_type == (IS_SMART_BRANCH_JMPZ|IS_TMP_VAR)) {\n");
out($f, "\t\t\t\toffset += 1;\n");
- out($f, "\t\t\t} else if ((op+1)->opcode == ZEND_JMPNZ) {\n");
+ out($f, "\t\t\t} else if (op->result_type == (IS_SMART_BRANCH_JMPNZ|IS_TMP_VAR)) {\n");
out($f, "\t\t\t\toffset += 2;\n");
out($f, "\t\t\t}\n");
$else = "} else ";
@@ -2820,16 +2760,16 @@ function gen_vm($def, $skel) {
}
out($f, "\t}\n");
}
- out($f, "\treturn zend_opcode_handlers[(spec & SPEC_START_MASK) + offset];\n");
+ out($f, "\treturn (spec & SPEC_START_MASK) + offset;\n");
}
out($f, "}\n\n");
out($f, "#if (ZEND_VM_KIND != ZEND_VM_KIND_HYBRID) || !ZEND_VM_SPEC\n");
out($f, "static const void *zend_vm_get_opcode_handler(zend_uchar opcode, const zend_op* op)\n");
out($f, "{\n");
if (!ZEND_VM_SPEC) {
- out($f, "\treturn zend_vm_get_opcode_handler_ex(opcode, op);\n");
+ out($f, "\treturn zend_opcode_handlers[zend_vm_get_opcode_handler_idx(opcode, op)];\n");
} else {
- out($f, "\treturn zend_vm_get_opcode_handler_ex(zend_spec_handlers[opcode], op);\n");
+ out($f, "\treturn zend_opcode_handlers[zend_vm_get_opcode_handler_idx(zend_spec_handlers[opcode], op)];\n");
}
out($f, "}\n");
out($f, "#endif\n\n");
@@ -2839,65 +2779,11 @@ function gen_vm($def, $skel) {
out($f, "#if ZEND_VM_KIND == ZEND_VM_KIND_HYBRID\n");
out($f,"static const void *zend_vm_get_opcode_handler_func(zend_uchar opcode, const zend_op* op)\n");
out($f, "{\n");
- out($f, "\tuint32_t spec = zend_spec_handlers[opcode];\n");
+ out($f, "\tuint32_t spec = zend_spec_handlers[opcode];\n");
if (!ZEND_VM_SPEC) {
out($f, "\treturn zend_opcode_handler_funcs[spec];\n");
} else {
- out($f, "\tstatic const int zend_vm_decode[] = {\n");
- out($f, "\t\t_UNUSED_CODE, /* 0 = IS_UNUSED */\n");
- out($f, "\t\t_CONST_CODE, /* 1 = IS_CONST */\n");
- out($f, "\t\t_TMP_CODE, /* 2 = IS_TMP_VAR */\n");
- out($f, "\t\t_UNUSED_CODE, /* 3 */\n");
- out($f, "\t\t_VAR_CODE, /* 4 = IS_VAR */\n");
- out($f, "\t\t_UNUSED_CODE, /* 5 */\n");
- out($f, "\t\t_UNUSED_CODE, /* 6 */\n");
- out($f, "\t\t_UNUSED_CODE, /* 7 */\n");
- out($f, "\t\t_CV_CODE /* 8 = IS_CV */\n");
- out($f, "\t};\n");
- out($f, "\tuint32_t offset = 0;\n");
- out($f, "\tif (spec & SPEC_RULE_OP1) offset = offset * 5 + zend_vm_decode[op->op1_type];\n");
- out($f, "\tif (spec & SPEC_RULE_OP2) offset = offset * 5 + zend_vm_decode[op->op2_type];\n");
-
- if (isset($used_extra_spec["OP_DATA"]) ||
- isset($used_extra_spec["RETVAL"]) ||
- isset($used_extra_spec["QUICK_ARG"]) ||
- isset($used_extra_spec["SMART_BRANCH"]) ||
- isset($used_extra_spec["ISSET"])) {
-
- $else = "";
- out($f, "\tif (spec & SPEC_EXTRA_MASK) {\n");
-
- if (isset($used_extra_spec["OP_DATA"])) {
- out($f, "\t\t{$else}if (spec & SPEC_RULE_OP_DATA) offset = offset * 5 + zend_vm_decode[(op + 1)->op1_type];\n");
- $else = "else ";
- }
- if (isset($used_extra_spec["RETVAL"])) {
- out($f, "\t\t{$else}if (spec & SPEC_RULE_RETVAL) offset = offset * 2 + (op->result_type != IS_UNUSED);\n");
- $else = "else ";
- }
- if (isset($used_extra_spec["QUICK_ARG"])) {
- out($f, "\t\t{$else}if (spec & SPEC_RULE_QUICK_ARG) offset = offset * 2 + (op->op2.num <= MAX_ARG_FLAG_NUM);\n");
- $else = "else ";
- }
- if (isset($used_extra_spec["SMART_BRANCH"])) {
- out($f, "\t\t{$else}if (spec & SPEC_RULE_SMART_BRANCH) {\n");
- out($f, "\t\t\toffset = offset * 3;\n");
- out($f, "\t\t\tif ((op+1)->opcode == ZEND_JMPZ) {\n");
- out($f, "\t\t\t\toffset += 1;\n");
- out($f, "\t\t\t} else if ((op+1)->opcode == ZEND_JMPNZ) {\n");
- out($f, "\t\t\t\toffset += 2;\n");
- out($f, "\t\t\t}\n");
- out($f, "\t\t}\n");
- $else = "else ";
- }
- if (isset($used_extra_spec["ISSET"])) {
- out($f, "\t\t{$else}if (spec & SPEC_RULE_ISSET) offset = offset * 2 + (op->extended_value & ZEND_ISEMPTY);\n");
- $else = "else ";
- }
- out($f, "\t}\n");
- }
-
- out($f, "\treturn zend_opcode_handler_funcs[(spec & SPEC_START_MASK) + offset];\n");
+ out($f, "\treturn zend_opcode_handler_funcs[zend_vm_get_opcode_handler_idx(spec, op)];\n");
}
out($f, "}\n\n");
out($f, "#endif\n\n");
@@ -2908,7 +2794,7 @@ function gen_vm($def, $skel) {
out($f, "{\n");
out($f, "\tzend_uchar opcode = zend_user_opcodes[op->opcode];\n");
if (!ZEND_VM_SPEC) {
- out($f, "\top->handler = zend_vm_get_opcode_handler(opcode, op);\n");
+ out($f, "\top->handler = zend_opcode_handlers[zend_vm_get_opcode_handler_idx(opcode, op)];\n");
} else {
out($f, "\n");
out($f, "\tif (zend_spec_handlers[op->opcode] & SPEC_RULE_COMMUTATIVE) {\n");
@@ -2916,7 +2802,7 @@ function gen_vm($def, $skel) {
out($f, "\t\t\tzend_swap_operands(op);\n");
out($f, "\t\t}\n");
out($f, "\t}\n");
- out($f, "\top->handler = zend_vm_get_opcode_handler_ex(zend_spec_handlers[opcode], op);\n");
+ out($f, "\top->handler = zend_opcode_handlers[zend_vm_get_opcode_handler_idx(zend_spec_handlers[opcode], op)];\n");
}
out($f, "}\n\n");
@@ -2925,7 +2811,7 @@ function gen_vm($def, $skel) {
out($f, "{\n");
out($f, "\tzend_uchar opcode = zend_user_opcodes[op->opcode];\n");
if (!ZEND_VM_SPEC) {
- out($f, "\top->handler = zend_vm_get_opcode_handler_ex(opcode, op);\n");
+ out($f, "\top->handler = zend_opcode_handlers[zend_vm_get_opcode_handler_idx(opcode, op)];\n");
} else {
out($f, "\tuint32_t spec = zend_spec_handlers[opcode];\n");
if (isset($used_extra_spec["TYPE"])) {
@@ -2994,7 +2880,7 @@ function gen_vm($def, $skel) {
out($f, "\t\t\tbreak;\n");
out($f, "\t}\n");
}
- out($f, "\top->handler = zend_vm_get_opcode_handler_ex(spec, op);\n");
+ out($f, "\top->handler = zend_opcode_handlers[zend_vm_get_opcode_handler_idx(spec, op)];\n");
}
out($f, "}\n\n");
diff --git a/Zend/zend_vm_handlers.h b/Zend/zend_vm_handlers.h
index 7aa1a93981..e5d50a4083 100644
--- a/Zend/zend_vm_handlers.h
+++ b/Zend/zend_vm_handlers.h
@@ -180,9 +180,9 @@
_(298, ZEND_POW_SPEC_CV_TMPVAR) \
_(300, ZEND_POW_SPEC_CV_CV) \
_(301, ZEND_BW_NOT_SPEC_CONST) \
- _(302, ZEND_BW_NOT_SPEC_TMPVAR) \
- _(303, ZEND_BW_NOT_SPEC_TMPVAR) \
- _(305, ZEND_BW_NOT_SPEC_CV) \
+ _(302, ZEND_BW_NOT_SPEC_TMPVARCV) \
+ _(303, ZEND_BW_NOT_SPEC_TMPVARCV) \
+ _(305, ZEND_BW_NOT_SPEC_TMPVARCV) \
_(306, ZEND_BOOL_NOT_SPEC_CONST) \
_(307, ZEND_BOOL_NOT_SPEC_TMPVAR) \
_(308, ZEND_BOOL_NOT_SPEC_TMPVAR) \
@@ -962,8 +962,8 @@
_(1859, ZEND_SEND_VAR_NO_REF_SPEC_VAR) \
_(1860, ZEND_CATCH_SPEC_CONST) \
_(1861, ZEND_THROW_SPEC_CONST) \
- _(1862, ZEND_THROW_SPEC_TMP) \
- _(1863, ZEND_THROW_SPEC_VAR) \
+ _(1862, ZEND_THROW_SPEC_TMPVAR) \
+ _(1863, ZEND_THROW_SPEC_TMPVAR) \
_(1865, ZEND_THROW_SPEC_CV) \
_(1866, ZEND_FETCH_CLASS_SPEC_UNUSED_CONST) \
_(1867, ZEND_FETCH_CLASS_SPEC_UNUSED_TMPVAR) \
@@ -1161,412 +1161,408 @@
_(2153, ZEND_FETCH_LIST_W_SPEC_VAR_TMPVAR) \
_(2155, ZEND_FETCH_LIST_W_SPEC_VAR_CV) \
_(2156, ZEND_SEPARATE_SPEC_VAR_UNUSED) \
- _(2157, ZEND_FETCH_CLASS_NAME_SPEC_UNUSED) \
- _(2158, ZEND_CALL_TRAMPOLINE_SPEC) \
- _(2159, ZEND_DISCARD_EXCEPTION_SPEC) \
- _(2160, ZEND_YIELD_SPEC_CONST_CONST) \
- _(2161, ZEND_YIELD_SPEC_CONST_TMP) \
- _(2162, ZEND_YIELD_SPEC_CONST_VAR) \
- _(2163, ZEND_YIELD_SPEC_CONST_UNUSED) \
- _(2164, ZEND_YIELD_SPEC_CONST_CV) \
- _(2165, ZEND_YIELD_SPEC_TMP_CONST) \
- _(2166, ZEND_YIELD_SPEC_TMP_TMP) \
- _(2167, ZEND_YIELD_SPEC_TMP_VAR) \
- _(2168, ZEND_YIELD_SPEC_TMP_UNUSED) \
- _(2169, ZEND_YIELD_SPEC_TMP_CV) \
- _(2170, ZEND_YIELD_SPEC_VAR_CONST) \
- _(2171, ZEND_YIELD_SPEC_VAR_TMP) \
- _(2172, ZEND_YIELD_SPEC_VAR_VAR) \
- _(2173, ZEND_YIELD_SPEC_VAR_UNUSED) \
- _(2174, ZEND_YIELD_SPEC_VAR_CV) \
- _(2175, ZEND_YIELD_SPEC_UNUSED_CONST) \
- _(2176, ZEND_YIELD_SPEC_UNUSED_TMP) \
- _(2177, ZEND_YIELD_SPEC_UNUSED_VAR) \
- _(2178, ZEND_YIELD_SPEC_UNUSED_UNUSED) \
- _(2179, ZEND_YIELD_SPEC_UNUSED_CV) \
- _(2180, ZEND_YIELD_SPEC_CV_CONST) \
- _(2181, ZEND_YIELD_SPEC_CV_TMP) \
- _(2182, ZEND_YIELD_SPEC_CV_VAR) \
- _(2183, ZEND_YIELD_SPEC_CV_UNUSED) \
- _(2184, ZEND_YIELD_SPEC_CV_CV) \
- _(2185, ZEND_GENERATOR_RETURN_SPEC_CONST) \
- _(2186, ZEND_GENERATOR_RETURN_SPEC_TMP) \
- _(2187, ZEND_GENERATOR_RETURN_SPEC_VAR) \
- _(2189, ZEND_GENERATOR_RETURN_SPEC_CV) \
- _(2190, ZEND_FAST_CALL_SPEC) \
- _(2191, ZEND_FAST_RET_SPEC) \
- _(2192, ZEND_RECV_VARIADIC_SPEC_UNUSED) \
- _(2193, ZEND_SEND_UNPACK_SPEC) \
- _(2194, ZEND_YIELD_FROM_SPEC_CONST) \
- _(2195, ZEND_YIELD_FROM_SPEC_TMP) \
- _(2196, ZEND_YIELD_FROM_SPEC_VAR) \
- _(2198, ZEND_YIELD_FROM_SPEC_CV) \
- _(2199, ZEND_COPY_TMP_SPEC_TMPVAR_UNUSED) \
- _(2200, ZEND_BIND_GLOBAL_SPEC_CV_CONST) \
- _(2201, ZEND_COALESCE_SPEC_CONST) \
- _(2202, ZEND_COALESCE_SPEC_TMP) \
- _(2203, ZEND_COALESCE_SPEC_VAR) \
- _(2205, ZEND_COALESCE_SPEC_CV) \
- _(2206, ZEND_SPACESHIP_SPEC_CONST_CONST) \
- _(2207, ZEND_SPACESHIP_SPEC_CONST_TMPVAR) \
- _(2208, ZEND_SPACESHIP_SPEC_CONST_TMPVAR) \
- _(2210, ZEND_SPACESHIP_SPEC_CONST_CV) \
- _(2211, ZEND_SPACESHIP_SPEC_TMPVAR_CONST) \
- _(2212, ZEND_SPACESHIP_SPEC_TMPVAR_TMPVAR) \
- _(2213, ZEND_SPACESHIP_SPEC_TMPVAR_TMPVAR) \
- _(2215, ZEND_SPACESHIP_SPEC_TMPVAR_CV) \
- _(2216, ZEND_SPACESHIP_SPEC_TMPVAR_CONST) \
+ _(2158, ZEND_FETCH_CLASS_NAME_SPEC_TMPVAR) \
+ _(2159, ZEND_FETCH_CLASS_NAME_SPEC_TMPVAR) \
+ _(2160, ZEND_FETCH_CLASS_NAME_SPEC_UNUSED) \
+ _(2161, ZEND_FETCH_CLASS_NAME_SPEC_CV) \
+ _(2162, ZEND_CALL_TRAMPOLINE_SPEC) \
+ _(2163, ZEND_DISCARD_EXCEPTION_SPEC) \
+ _(2164, ZEND_YIELD_SPEC_CONST_CONST) \
+ _(2165, ZEND_YIELD_SPEC_CONST_TMPVAR) \
+ _(2166, ZEND_YIELD_SPEC_CONST_TMPVAR) \
+ _(2167, ZEND_YIELD_SPEC_CONST_UNUSED) \
+ _(2168, ZEND_YIELD_SPEC_CONST_CV) \
+ _(2169, ZEND_YIELD_SPEC_TMP_CONST) \
+ _(2170, ZEND_YIELD_SPEC_TMP_TMPVAR) \
+ _(2171, ZEND_YIELD_SPEC_TMP_TMPVAR) \
+ _(2172, ZEND_YIELD_SPEC_TMP_UNUSED) \
+ _(2173, ZEND_YIELD_SPEC_TMP_CV) \
+ _(2174, ZEND_YIELD_SPEC_VAR_CONST) \
+ _(2175, ZEND_YIELD_SPEC_VAR_TMPVAR) \
+ _(2176, ZEND_YIELD_SPEC_VAR_TMPVAR) \
+ _(2177, ZEND_YIELD_SPEC_VAR_UNUSED) \
+ _(2178, ZEND_YIELD_SPEC_VAR_CV) \
+ _(2179, ZEND_YIELD_SPEC_UNUSED_CONST) \
+ _(2180, ZEND_YIELD_SPEC_UNUSED_TMPVAR) \
+ _(2181, ZEND_YIELD_SPEC_UNUSED_TMPVAR) \
+ _(2182, ZEND_YIELD_SPEC_UNUSED_UNUSED) \
+ _(2183, ZEND_YIELD_SPEC_UNUSED_CV) \
+ _(2184, ZEND_YIELD_SPEC_CV_CONST) \
+ _(2185, ZEND_YIELD_SPEC_CV_TMPVAR) \
+ _(2186, ZEND_YIELD_SPEC_CV_TMPVAR) \
+ _(2187, ZEND_YIELD_SPEC_CV_UNUSED) \
+ _(2188, ZEND_YIELD_SPEC_CV_CV) \
+ _(2189, ZEND_GENERATOR_RETURN_SPEC_CONST) \
+ _(2190, ZEND_GENERATOR_RETURN_SPEC_TMP) \
+ _(2191, ZEND_GENERATOR_RETURN_SPEC_VAR) \
+ _(2193, ZEND_GENERATOR_RETURN_SPEC_CV) \
+ _(2194, ZEND_FAST_CALL_SPEC) \
+ _(2195, ZEND_FAST_RET_SPEC) \
+ _(2196, ZEND_RECV_VARIADIC_SPEC_UNUSED) \
+ _(2197, ZEND_SEND_UNPACK_SPEC) \
+ _(2198, ZEND_YIELD_FROM_SPEC_CONST) \
+ _(2199, ZEND_YIELD_FROM_SPEC_TMPVAR) \
+ _(2200, ZEND_YIELD_FROM_SPEC_TMPVAR) \
+ _(2202, ZEND_YIELD_FROM_SPEC_CV) \
+ _(2203, ZEND_COPY_TMP_SPEC_TMPVAR_UNUSED) \
+ _(2204, ZEND_BIND_GLOBAL_SPEC_CV_CONST) \
+ _(2205, ZEND_COALESCE_SPEC_CONST) \
+ _(2206, ZEND_COALESCE_SPEC_TMP) \
+ _(2207, ZEND_COALESCE_SPEC_VAR) \
+ _(2209, ZEND_COALESCE_SPEC_CV) \
+ _(2210, ZEND_SPACESHIP_SPEC_CONST_CONST) \
+ _(2211, ZEND_SPACESHIP_SPEC_CONST_TMPVAR) \
+ _(2212, ZEND_SPACESHIP_SPEC_CONST_TMPVAR) \
+ _(2214, ZEND_SPACESHIP_SPEC_CONST_CV) \
+ _(2215, ZEND_SPACESHIP_SPEC_TMPVAR_CONST) \
+ _(2216, ZEND_SPACESHIP_SPEC_TMPVAR_TMPVAR) \
_(2217, ZEND_SPACESHIP_SPEC_TMPVAR_TMPVAR) \
- _(2218, ZEND_SPACESHIP_SPEC_TMPVAR_TMPVAR) \
- _(2220, ZEND_SPACESHIP_SPEC_TMPVAR_CV) \
- _(2226, ZEND_SPACESHIP_SPEC_CV_CONST) \
- _(2227, ZEND_SPACESHIP_SPEC_CV_TMPVAR) \
- _(2228, ZEND_SPACESHIP_SPEC_CV_TMPVAR) \
- _(2230, ZEND_SPACESHIP_SPEC_CV_CV) \
- _(2231, ZEND_FUNC_NUM_ARGS_SPEC_UNUSED_UNUSED) \
- _(2232, ZEND_FUNC_GET_ARGS_SPEC_CONST_UNUSED) \
- _(2235, ZEND_FUNC_GET_ARGS_SPEC_UNUSED_UNUSED) \
- _(2237, ZEND_FETCH_STATIC_PROP_R_SPEC) \
- _(2238, ZEND_FETCH_STATIC_PROP_W_SPEC) \
- _(2239, ZEND_FETCH_STATIC_PROP_RW_SPEC) \
- _(2240, ZEND_FETCH_STATIC_PROP_IS_SPEC) \
- _(2241, ZEND_FETCH_STATIC_PROP_FUNC_ARG_SPEC) \
- _(2242, ZEND_FETCH_STATIC_PROP_UNSET_SPEC) \
- _(2243, ZEND_UNSET_STATIC_PROP_SPEC) \
- _(2244, ZEND_ISSET_ISEMPTY_STATIC_PROP_SPEC) \
- _(2245, ZEND_FETCH_CLASS_CONSTANT_SPEC_CONST_CONST) \
- _(2247, ZEND_FETCH_CLASS_CONSTANT_SPEC_VAR_CONST) \
- _(2248, ZEND_FETCH_CLASS_CONSTANT_SPEC_UNUSED_CONST) \
- _(2250, ZEND_BIND_LEXICAL_SPEC_TMP_CV) \
- _(2251, ZEND_BIND_STATIC_SPEC_CV_UNUSED) \
- _(2252, ZEND_FETCH_THIS_SPEC_UNUSED_UNUSED) \
- _(2253, ZEND_SEND_FUNC_ARG_SPEC_VAR) \
- _(2254, ZEND_ISSET_ISEMPTY_THIS_SPEC_UNUSED_UNUSED) \
- _(2255, ZEND_SWITCH_LONG_SPEC_CONST_CONST) \
- _(2256, ZEND_SWITCH_LONG_SPEC_TMPVARCV_CONST) \
- _(2257, ZEND_SWITCH_LONG_SPEC_TMPVARCV_CONST) \
- _(2259, ZEND_SWITCH_LONG_SPEC_TMPVARCV_CONST) \
- _(2260, ZEND_SWITCH_STRING_SPEC_CONST_CONST) \
- _(2261, ZEND_SWITCH_STRING_SPEC_TMPVARCV_CONST) \
- _(2262, ZEND_SWITCH_STRING_SPEC_TMPVARCV_CONST) \
- _(2264, ZEND_SWITCH_STRING_SPEC_TMPVARCV_CONST) \
- _(2265, ZEND_IN_ARRAY_SPEC_CONST_CONST) \
- _(2266, ZEND_IN_ARRAY_SPEC_TMP_CONST) \
- _(2267, ZEND_IN_ARRAY_SPEC_VAR_CONST) \
- _(2269, ZEND_IN_ARRAY_SPEC_CV_CONST) \
- _(2270, ZEND_COUNT_SPEC_CONST_UNUSED) \
- _(2271, ZEND_COUNT_SPEC_TMPVAR_UNUSED) \
- _(2272, ZEND_COUNT_SPEC_TMPVAR_UNUSED) \
- _(2274, ZEND_COUNT_SPEC_CV_UNUSED) \
- _(2275, ZEND_GET_CLASS_SPEC_CONST_UNUSED) \
- _(2276, ZEND_GET_CLASS_SPEC_TMPVAR_UNUSED) \
- _(2277, ZEND_GET_CLASS_SPEC_TMPVAR_UNUSED) \
- _(2278, ZEND_GET_CLASS_SPEC_UNUSED_UNUSED) \
- _(2279, ZEND_GET_CLASS_SPEC_CV_UNUSED) \
- _(2280, ZEND_GET_CALLED_CLASS_SPEC_UNUSED_UNUSED) \
- _(2281, ZEND_GET_TYPE_SPEC_CONST_UNUSED) \
- _(2282, ZEND_GET_TYPE_SPEC_TMP_UNUSED) \
- _(2283, ZEND_GET_TYPE_SPEC_VAR_UNUSED) \
- _(2285, ZEND_GET_TYPE_SPEC_CV_UNUSED) \
- _(2286, ZEND_ARRAY_KEY_EXISTS_SPEC_CONST_CONST) \
- _(2287, ZEND_ARRAY_KEY_EXISTS_SPEC_CONST_TMPVAR) \
- _(2288, ZEND_ARRAY_KEY_EXISTS_SPEC_CONST_TMPVAR) \
- _(2290, ZEND_ARRAY_KEY_EXISTS_SPEC_CONST_CV) \
- _(2291, ZEND_ARRAY_KEY_EXISTS_SPEC_TMPVAR_CONST) \
- _(2292, ZEND_ARRAY_KEY_EXISTS_SPEC_TMPVAR_TMPVAR) \
- _(2293, ZEND_ARRAY_KEY_EXISTS_SPEC_TMPVAR_TMPVAR) \
- _(2295, ZEND_ARRAY_KEY_EXISTS_SPEC_TMPVAR_CV) \
- _(2296, ZEND_ARRAY_KEY_EXISTS_SPEC_TMPVAR_CONST) \
+ _(2219, ZEND_SPACESHIP_SPEC_TMPVAR_CV) \
+ _(2220, ZEND_SPACESHIP_SPEC_TMPVAR_CONST) \
+ _(2221, ZEND_SPACESHIP_SPEC_TMPVAR_TMPVAR) \
+ _(2222, ZEND_SPACESHIP_SPEC_TMPVAR_TMPVAR) \
+ _(2224, ZEND_SPACESHIP_SPEC_TMPVAR_CV) \
+ _(2230, ZEND_SPACESHIP_SPEC_CV_CONST) \
+ _(2231, ZEND_SPACESHIP_SPEC_CV_TMPVAR) \
+ _(2232, ZEND_SPACESHIP_SPEC_CV_TMPVAR) \
+ _(2234, ZEND_SPACESHIP_SPEC_CV_CV) \
+ _(2235, ZEND_FUNC_NUM_ARGS_SPEC_UNUSED_UNUSED) \
+ _(2236, ZEND_FUNC_GET_ARGS_SPEC_CONST_UNUSED) \
+ _(2239, ZEND_FUNC_GET_ARGS_SPEC_UNUSED_UNUSED) \
+ _(2241, ZEND_FETCH_STATIC_PROP_R_SPEC) \
+ _(2242, ZEND_FETCH_STATIC_PROP_W_SPEC) \
+ _(2243, ZEND_FETCH_STATIC_PROP_RW_SPEC) \
+ _(2244, ZEND_FETCH_STATIC_PROP_IS_SPEC) \
+ _(2245, ZEND_FETCH_STATIC_PROP_FUNC_ARG_SPEC) \
+ _(2246, ZEND_FETCH_STATIC_PROP_UNSET_SPEC) \
+ _(2247, ZEND_UNSET_STATIC_PROP_SPEC) \
+ _(2248, ZEND_ISSET_ISEMPTY_STATIC_PROP_SPEC) \
+ _(2249, ZEND_FETCH_CLASS_CONSTANT_SPEC_CONST_CONST) \
+ _(2251, ZEND_FETCH_CLASS_CONSTANT_SPEC_VAR_CONST) \
+ _(2252, ZEND_FETCH_CLASS_CONSTANT_SPEC_UNUSED_CONST) \
+ _(2254, ZEND_BIND_LEXICAL_SPEC_TMP_CV) \
+ _(2255, ZEND_BIND_STATIC_SPEC_CV_UNUSED) \
+ _(2256, ZEND_FETCH_THIS_SPEC_UNUSED_UNUSED) \
+ _(2257, ZEND_SEND_FUNC_ARG_SPEC_VAR) \
+ _(2258, ZEND_ISSET_ISEMPTY_THIS_SPEC_UNUSED_UNUSED) \
+ _(2259, ZEND_SWITCH_LONG_SPEC_CONST_CONST) \
+ _(2260, ZEND_SWITCH_LONG_SPEC_TMPVARCV_CONST) \
+ _(2261, ZEND_SWITCH_LONG_SPEC_TMPVARCV_CONST) \
+ _(2263, ZEND_SWITCH_LONG_SPEC_TMPVARCV_CONST) \
+ _(2264, ZEND_SWITCH_STRING_SPEC_CONST_CONST) \
+ _(2265, ZEND_SWITCH_STRING_SPEC_TMPVARCV_CONST) \
+ _(2266, ZEND_SWITCH_STRING_SPEC_TMPVARCV_CONST) \
+ _(2268, ZEND_SWITCH_STRING_SPEC_TMPVARCV_CONST) \
+ _(2269, ZEND_IN_ARRAY_SPEC_CONST_CONST) \
+ _(2270, ZEND_IN_ARRAY_SPEC_TMP_CONST) \
+ _(2271, ZEND_IN_ARRAY_SPEC_VAR_CONST) \
+ _(2273, ZEND_IN_ARRAY_SPEC_CV_CONST) \
+ _(2274, ZEND_COUNT_SPEC_CONST_UNUSED) \
+ _(2275, ZEND_COUNT_SPEC_TMPVAR_UNUSED) \
+ _(2276, ZEND_COUNT_SPEC_TMPVAR_UNUSED) \
+ _(2278, ZEND_COUNT_SPEC_CV_UNUSED) \
+ _(2279, ZEND_GET_CLASS_SPEC_CONST_UNUSED) \
+ _(2280, ZEND_GET_CLASS_SPEC_TMPVAR_UNUSED) \
+ _(2281, ZEND_GET_CLASS_SPEC_TMPVAR_UNUSED) \
+ _(2282, ZEND_GET_CLASS_SPEC_UNUSED_UNUSED) \
+ _(2283, ZEND_GET_CLASS_SPEC_CV_UNUSED) \
+ _(2284, ZEND_GET_CALLED_CLASS_SPEC_UNUSED_UNUSED) \
+ _(2285, ZEND_GET_TYPE_SPEC_CONST_UNUSED) \
+ _(2286, ZEND_GET_TYPE_SPEC_TMP_UNUSED) \
+ _(2287, ZEND_GET_TYPE_SPEC_VAR_UNUSED) \
+ _(2289, ZEND_GET_TYPE_SPEC_CV_UNUSED) \
+ _(2290, ZEND_ARRAY_KEY_EXISTS_SPEC_CONST_CONST) \
+ _(2291, ZEND_ARRAY_KEY_EXISTS_SPEC_CONST_TMPVAR) \
+ _(2292, ZEND_ARRAY_KEY_EXISTS_SPEC_CONST_TMPVAR) \
+ _(2294, ZEND_ARRAY_KEY_EXISTS_SPEC_CONST_CV) \
+ _(2295, ZEND_ARRAY_KEY_EXISTS_SPEC_TMPVAR_CONST) \
+ _(2296, ZEND_ARRAY_KEY_EXISTS_SPEC_TMPVAR_TMPVAR) \
_(2297, ZEND_ARRAY_KEY_EXISTS_SPEC_TMPVAR_TMPVAR) \
- _(2298, ZEND_ARRAY_KEY_EXISTS_SPEC_TMPVAR_TMPVAR) \
- _(2300, ZEND_ARRAY_KEY_EXISTS_SPEC_TMPVAR_CV) \
- _(2306, ZEND_ARRAY_KEY_EXISTS_SPEC_CV_CONST) \
- _(2307, ZEND_ARRAY_KEY_EXISTS_SPEC_CV_TMPVAR) \
- _(2308, ZEND_ARRAY_KEY_EXISTS_SPEC_CV_TMPVAR) \
- _(2310, ZEND_ARRAY_KEY_EXISTS_SPEC_CV_CV) \
- _(2311, ZEND_JMP_FORWARD_SPEC) \
- _(2317, ZEND_ADD_LONG_NO_OVERFLOW_SPEC_TMPVARCV_CONST) \
- _(2318, ZEND_ADD_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
- _(2319, ZEND_ADD_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
- _(2321, ZEND_ADD_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
+ _(2299, ZEND_ARRAY_KEY_EXISTS_SPEC_TMPVAR_CV) \
+ _(2300, ZEND_ARRAY_KEY_EXISTS_SPEC_TMPVAR_CONST) \
+ _(2301, ZEND_ARRAY_KEY_EXISTS_SPEC_TMPVAR_TMPVAR) \
+ _(2302, ZEND_ARRAY_KEY_EXISTS_SPEC_TMPVAR_TMPVAR) \
+ _(2304, ZEND_ARRAY_KEY_EXISTS_SPEC_TMPVAR_CV) \
+ _(2310, ZEND_ARRAY_KEY_EXISTS_SPEC_CV_CONST) \
+ _(2311, ZEND_ARRAY_KEY_EXISTS_SPEC_CV_TMPVAR) \
+ _(2312, ZEND_ARRAY_KEY_EXISTS_SPEC_CV_TMPVAR) \
+ _(2314, ZEND_ARRAY_KEY_EXISTS_SPEC_CV_CV) \
+ _(2315, ZEND_RECV_NOTYPE_SPEC) \
+ _(2316, ZEND_JMP_FORWARD_SPEC) \
_(2322, ZEND_ADD_LONG_NO_OVERFLOW_SPEC_TMPVARCV_CONST) \
_(2323, ZEND_ADD_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
_(2324, ZEND_ADD_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
_(2326, ZEND_ADD_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
- _(2332, ZEND_ADD_LONG_NO_OVERFLOW_SPEC_TMPVARCV_CONST) \
- _(2333, ZEND_ADD_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
- _(2334, ZEND_ADD_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
- _(2336, ZEND_ADD_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
- _(2342, ZEND_ADD_LONG_SPEC_TMPVARCV_CONST) \
- _(2343, ZEND_ADD_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(2344, ZEND_ADD_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(2346, ZEND_ADD_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(2327, ZEND_ADD_LONG_NO_OVERFLOW_SPEC_TMPVARCV_CONST) \
+ _(2328, ZEND_ADD_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
+ _(2329, ZEND_ADD_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
+ _(2331, ZEND_ADD_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
+ _(2337, ZEND_ADD_LONG_NO_OVERFLOW_SPEC_TMPVARCV_CONST) \
+ _(2338, ZEND_ADD_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
+ _(2339, ZEND_ADD_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
+ _(2341, ZEND_ADD_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
_(2347, ZEND_ADD_LONG_SPEC_TMPVARCV_CONST) \
_(2348, ZEND_ADD_LONG_SPEC_TMPVARCV_TMPVARCV) \
_(2349, ZEND_ADD_LONG_SPEC_TMPVARCV_TMPVARCV) \
_(2351, ZEND_ADD_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(2357, ZEND_ADD_LONG_SPEC_TMPVARCV_CONST) \
- _(2358, ZEND_ADD_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(2359, ZEND_ADD_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(2361, ZEND_ADD_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(2367, ZEND_ADD_DOUBLE_SPEC_TMPVARCV_CONST) \
- _(2368, ZEND_ADD_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(2369, ZEND_ADD_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(2371, ZEND_ADD_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(2352, ZEND_ADD_LONG_SPEC_TMPVARCV_CONST) \
+ _(2353, ZEND_ADD_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(2354, ZEND_ADD_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(2356, ZEND_ADD_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(2362, ZEND_ADD_LONG_SPEC_TMPVARCV_CONST) \
+ _(2363, ZEND_ADD_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(2364, ZEND_ADD_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(2366, ZEND_ADD_LONG_SPEC_TMPVARCV_TMPVARCV) \
_(2372, ZEND_ADD_DOUBLE_SPEC_TMPVARCV_CONST) \
_(2373, ZEND_ADD_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
_(2374, ZEND_ADD_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
_(2376, ZEND_ADD_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(2382, ZEND_ADD_DOUBLE_SPEC_TMPVARCV_CONST) \
- _(2383, ZEND_ADD_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(2384, ZEND_ADD_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(2386, ZEND_ADD_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(2388, ZEND_SUB_LONG_NO_OVERFLOW_SPEC_CONST_TMPVARCV) \
- _(2389, ZEND_SUB_LONG_NO_OVERFLOW_SPEC_CONST_TMPVARCV) \
- _(2391, ZEND_SUB_LONG_NO_OVERFLOW_SPEC_CONST_TMPVARCV) \
- _(2392, ZEND_SUB_LONG_NO_OVERFLOW_SPEC_TMPVARCV_CONST) \
- _(2393, ZEND_SUB_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
- _(2394, ZEND_SUB_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
- _(2396, ZEND_SUB_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
+ _(2377, ZEND_ADD_DOUBLE_SPEC_TMPVARCV_CONST) \
+ _(2378, ZEND_ADD_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(2379, ZEND_ADD_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(2381, ZEND_ADD_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(2387, ZEND_ADD_DOUBLE_SPEC_TMPVARCV_CONST) \
+ _(2388, ZEND_ADD_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(2389, ZEND_ADD_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(2391, ZEND_ADD_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(2393, ZEND_SUB_LONG_NO_OVERFLOW_SPEC_CONST_TMPVARCV) \
+ _(2394, ZEND_SUB_LONG_NO_OVERFLOW_SPEC_CONST_TMPVARCV) \
+ _(2396, ZEND_SUB_LONG_NO_OVERFLOW_SPEC_CONST_TMPVARCV) \
_(2397, ZEND_SUB_LONG_NO_OVERFLOW_SPEC_TMPVARCV_CONST) \
_(2398, ZEND_SUB_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
_(2399, ZEND_SUB_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
_(2401, ZEND_SUB_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
- _(2407, ZEND_SUB_LONG_NO_OVERFLOW_SPEC_TMPVARCV_CONST) \
- _(2408, ZEND_SUB_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
- _(2409, ZEND_SUB_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
- _(2411, ZEND_SUB_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
- _(2413, ZEND_SUB_LONG_SPEC_CONST_TMPVARCV) \
- _(2414, ZEND_SUB_LONG_SPEC_CONST_TMPVARCV) \
- _(2416, ZEND_SUB_LONG_SPEC_CONST_TMPVARCV) \
- _(2417, ZEND_SUB_LONG_SPEC_TMPVARCV_CONST) \
- _(2418, ZEND_SUB_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(2419, ZEND_SUB_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(2421, ZEND_SUB_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(2402, ZEND_SUB_LONG_NO_OVERFLOW_SPEC_TMPVARCV_CONST) \
+ _(2403, ZEND_SUB_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
+ _(2404, ZEND_SUB_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
+ _(2406, ZEND_SUB_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
+ _(2412, ZEND_SUB_LONG_NO_OVERFLOW_SPEC_TMPVARCV_CONST) \
+ _(2413, ZEND_SUB_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
+ _(2414, ZEND_SUB_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
+ _(2416, ZEND_SUB_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
+ _(2418, ZEND_SUB_LONG_SPEC_CONST_TMPVARCV) \
+ _(2419, ZEND_SUB_LONG_SPEC_CONST_TMPVARCV) \
+ _(2421, ZEND_SUB_LONG_SPEC_CONST_TMPVARCV) \
_(2422, ZEND_SUB_LONG_SPEC_TMPVARCV_CONST) \
_(2423, ZEND_SUB_LONG_SPEC_TMPVARCV_TMPVARCV) \
_(2424, ZEND_SUB_LONG_SPEC_TMPVARCV_TMPVARCV) \
_(2426, ZEND_SUB_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(2432, ZEND_SUB_LONG_SPEC_TMPVARCV_CONST) \
- _(2433, ZEND_SUB_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(2434, ZEND_SUB_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(2436, ZEND_SUB_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(2438, ZEND_SUB_DOUBLE_SPEC_CONST_TMPVARCV) \
- _(2439, ZEND_SUB_DOUBLE_SPEC_CONST_TMPVARCV) \
- _(2441, ZEND_SUB_DOUBLE_SPEC_CONST_TMPVARCV) \
- _(2442, ZEND_SUB_DOUBLE_SPEC_TMPVARCV_CONST) \
- _(2443, ZEND_SUB_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(2444, ZEND_SUB_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(2446, ZEND_SUB_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(2427, ZEND_SUB_LONG_SPEC_TMPVARCV_CONST) \
+ _(2428, ZEND_SUB_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(2429, ZEND_SUB_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(2431, ZEND_SUB_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(2437, ZEND_SUB_LONG_SPEC_TMPVARCV_CONST) \
+ _(2438, ZEND_SUB_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(2439, ZEND_SUB_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(2441, ZEND_SUB_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(2443, ZEND_SUB_DOUBLE_SPEC_CONST_TMPVARCV) \
+ _(2444, ZEND_SUB_DOUBLE_SPEC_CONST_TMPVARCV) \
+ _(2446, ZEND_SUB_DOUBLE_SPEC_CONST_TMPVARCV) \
_(2447, ZEND_SUB_DOUBLE_SPEC_TMPVARCV_CONST) \
_(2448, ZEND_SUB_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
_(2449, ZEND_SUB_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
_(2451, ZEND_SUB_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(2457, ZEND_SUB_DOUBLE_SPEC_TMPVARCV_CONST) \
- _(2458, ZEND_SUB_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(2459, ZEND_SUB_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(2461, ZEND_SUB_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(2467, ZEND_MUL_LONG_NO_OVERFLOW_SPEC_TMPVARCV_CONST) \
- _(2468, ZEND_MUL_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
- _(2469, ZEND_MUL_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
- _(2471, ZEND_MUL_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
+ _(2452, ZEND_SUB_DOUBLE_SPEC_TMPVARCV_CONST) \
+ _(2453, ZEND_SUB_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(2454, ZEND_SUB_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(2456, ZEND_SUB_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(2462, ZEND_SUB_DOUBLE_SPEC_TMPVARCV_CONST) \
+ _(2463, ZEND_SUB_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(2464, ZEND_SUB_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(2466, ZEND_SUB_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
_(2472, ZEND_MUL_LONG_NO_OVERFLOW_SPEC_TMPVARCV_CONST) \
_(2473, ZEND_MUL_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
_(2474, ZEND_MUL_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
_(2476, ZEND_MUL_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
- _(2482, ZEND_MUL_LONG_NO_OVERFLOW_SPEC_TMPVARCV_CONST) \
- _(2483, ZEND_MUL_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
- _(2484, ZEND_MUL_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
- _(2486, ZEND_MUL_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
- _(2492, ZEND_MUL_LONG_SPEC_TMPVARCV_CONST) \
- _(2493, ZEND_MUL_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(2494, ZEND_MUL_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(2496, ZEND_MUL_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(2477, ZEND_MUL_LONG_NO_OVERFLOW_SPEC_TMPVARCV_CONST) \
+ _(2478, ZEND_MUL_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
+ _(2479, ZEND_MUL_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
+ _(2481, ZEND_MUL_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
+ _(2487, ZEND_MUL_LONG_NO_OVERFLOW_SPEC_TMPVARCV_CONST) \
+ _(2488, ZEND_MUL_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
+ _(2489, ZEND_MUL_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
+ _(2491, ZEND_MUL_LONG_NO_OVERFLOW_SPEC_TMPVARCV_TMPVARCV) \
_(2497, ZEND_MUL_LONG_SPEC_TMPVARCV_CONST) \
_(2498, ZEND_MUL_LONG_SPEC_TMPVARCV_TMPVARCV) \
_(2499, ZEND_MUL_LONG_SPEC_TMPVARCV_TMPVARCV) \
_(2501, ZEND_MUL_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(2507, ZEND_MUL_LONG_SPEC_TMPVARCV_CONST) \
- _(2508, ZEND_MUL_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(2509, ZEND_MUL_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(2511, ZEND_MUL_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(2517, ZEND_MUL_DOUBLE_SPEC_TMPVARCV_CONST) \
- _(2518, ZEND_MUL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(2519, ZEND_MUL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(2521, ZEND_MUL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(2502, ZEND_MUL_LONG_SPEC_TMPVARCV_CONST) \
+ _(2503, ZEND_MUL_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(2504, ZEND_MUL_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(2506, ZEND_MUL_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(2512, ZEND_MUL_LONG_SPEC_TMPVARCV_CONST) \
+ _(2513, ZEND_MUL_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(2514, ZEND_MUL_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(2516, ZEND_MUL_LONG_SPEC_TMPVARCV_TMPVARCV) \
_(2522, ZEND_MUL_DOUBLE_SPEC_TMPVARCV_CONST) \
_(2523, ZEND_MUL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
_(2524, ZEND_MUL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
_(2526, ZEND_MUL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(2532, ZEND_MUL_DOUBLE_SPEC_TMPVARCV_CONST) \
- _(2533, ZEND_MUL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(2534, ZEND_MUL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(2536, ZEND_MUL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(2552, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_CONST) \
- _(2553, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPZ) \
- _(2554, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPNZ) \
- _(2555, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(2556, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2557, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2558, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(2559, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2560, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2564, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(2565, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2566, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2567, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_CONST) \
- _(2568, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPZ) \
- _(2569, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPNZ) \
- _(2570, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(2571, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2572, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2573, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(2574, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2575, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2579, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(2580, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2581, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2597, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_CONST) \
- _(2598, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPZ) \
- _(2599, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPNZ) \
- _(2600, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(2601, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2602, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2603, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(2604, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2605, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2609, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(2610, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2611, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2627, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST) \
- _(2628, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPZ) \
- _(2629, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPNZ) \
- _(2630, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(2631, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2632, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2633, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(2634, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2635, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2639, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(2640, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2641, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2642, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST) \
- _(2643, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPZ) \
- _(2644, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPNZ) \
- _(2645, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(2646, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2647, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2648, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(2649, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2650, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2654, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(2655, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2656, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2672, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST) \
- _(2673, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPZ) \
- _(2674, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPNZ) \
- _(2675, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(2676, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2677, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2678, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(2679, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2680, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2684, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(2685, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2686, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2702, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_CONST) \
- _(2703, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPZ) \
- _(2704, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPNZ) \
- _(2705, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(2706, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2707, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2708, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(2709, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2710, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2714, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(2715, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2716, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2717, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_CONST) \
- _(2718, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPZ) \
- _(2719, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPNZ) \
- _(2720, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(2721, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2722, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2723, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(2724, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2725, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2729, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(2730, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2731, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2747, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_CONST) \
- _(2748, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPZ) \
- _(2749, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPNZ) \
- _(2750, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(2751, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2752, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2753, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(2754, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2755, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2759, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(2760, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2761, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2777, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST) \
- _(2778, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPZ) \
- _(2779, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPNZ) \
- _(2780, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(2781, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2782, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2783, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(2784, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2785, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2789, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(2790, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2791, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2792, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST) \
- _(2793, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPZ) \
- _(2794, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPNZ) \
- _(2795, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(2796, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2797, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2798, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(2799, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2800, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2804, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(2805, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2806, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2822, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST) \
- _(2823, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPZ) \
- _(2824, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPNZ) \
- _(2825, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(2826, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2827, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2828, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(2829, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2830, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2834, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(2835, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2836, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2840, ZEND_IS_SMALLER_LONG_SPEC_CONST_TMPVARCV) \
- _(2841, ZEND_IS_SMALLER_LONG_SPEC_CONST_TMPVARCV_JMPZ) \
- _(2842, ZEND_IS_SMALLER_LONG_SPEC_CONST_TMPVARCV_JMPNZ) \
- _(2843, ZEND_IS_SMALLER_LONG_SPEC_CONST_TMPVARCV) \
- _(2844, ZEND_IS_SMALLER_LONG_SPEC_CONST_TMPVARCV_JMPZ) \
- _(2845, ZEND_IS_SMALLER_LONG_SPEC_CONST_TMPVARCV_JMPNZ) \
- _(2849, ZEND_IS_SMALLER_LONG_SPEC_CONST_TMPVARCV) \
- _(2850, ZEND_IS_SMALLER_LONG_SPEC_CONST_TMPVARCV_JMPZ) \
- _(2851, ZEND_IS_SMALLER_LONG_SPEC_CONST_TMPVARCV_JMPNZ) \
- _(2852, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_CONST) \
- _(2853, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_CONST_JMPZ) \
- _(2854, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_CONST_JMPNZ) \
- _(2855, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(2856, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2857, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2858, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(2859, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2860, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2864, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(2865, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2866, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2527, ZEND_MUL_DOUBLE_SPEC_TMPVARCV_CONST) \
+ _(2528, ZEND_MUL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(2529, ZEND_MUL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(2531, ZEND_MUL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(2537, ZEND_MUL_DOUBLE_SPEC_TMPVARCV_CONST) \
+ _(2538, ZEND_MUL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(2539, ZEND_MUL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(2541, ZEND_MUL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(2557, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_CONST) \
+ _(2558, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPZ) \
+ _(2559, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPNZ) \
+ _(2560, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(2561, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2562, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2563, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(2564, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2565, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2569, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(2570, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2571, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2572, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_CONST) \
+ _(2573, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPZ) \
+ _(2574, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPNZ) \
+ _(2575, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(2576, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2577, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2578, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(2579, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2580, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2584, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(2585, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2586, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2602, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_CONST) \
+ _(2603, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPZ) \
+ _(2604, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPNZ) \
+ _(2605, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(2606, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2607, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2608, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(2609, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2610, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2614, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(2615, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2616, ZEND_IS_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2632, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST) \
+ _(2633, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPZ) \
+ _(2634, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPNZ) \
+ _(2635, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(2636, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2637, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2638, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(2639, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2640, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2644, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(2645, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2646, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2647, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST) \
+ _(2648, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPZ) \
+ _(2649, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPNZ) \
+ _(2650, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(2651, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2652, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2653, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(2654, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2655, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2659, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(2660, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2661, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2677, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST) \
+ _(2678, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPZ) \
+ _(2679, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPNZ) \
+ _(2680, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(2681, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2682, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2683, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(2684, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2685, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2689, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(2690, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2691, ZEND_IS_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2707, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_CONST) \
+ _(2708, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPZ) \
+ _(2709, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPNZ) \
+ _(2710, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(2711, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2712, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2713, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(2714, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2715, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2719, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(2720, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2721, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2722, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_CONST) \
+ _(2723, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPZ) \
+ _(2724, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPNZ) \
+ _(2725, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(2726, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2727, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2728, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(2729, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2730, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2734, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(2735, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2736, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2752, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_CONST) \
+ _(2753, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPZ) \
+ _(2754, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPNZ) \
+ _(2755, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(2756, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2757, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2758, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(2759, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2760, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2764, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(2765, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2766, ZEND_IS_NOT_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2782, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST) \
+ _(2783, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPZ) \
+ _(2784, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPNZ) \
+ _(2785, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(2786, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2787, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2788, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(2789, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2790, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2794, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(2795, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2796, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2797, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST) \
+ _(2798, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPZ) \
+ _(2799, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPNZ) \
+ _(2800, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(2801, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2802, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2803, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(2804, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2805, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2809, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(2810, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2811, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2827, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST) \
+ _(2828, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPZ) \
+ _(2829, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPNZ) \
+ _(2830, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(2831, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2832, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2833, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(2834, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2835, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2839, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(2840, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2841, ZEND_IS_NOT_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2842, ZEND_IS_IDENTICAL_NOTHROW_SPEC_CV_CONST) \
+ _(2846, ZEND_IS_IDENTICAL_NOTHROW_SPEC_CV_CV) \
+ _(2847, ZEND_IS_NOT_IDENTICAL_NOTHROW_SPEC_CV_CONST) \
+ _(2851, ZEND_IS_NOT_IDENTICAL_NOTHROW_SPEC_CV_CV) \
+ _(2855, ZEND_IS_SMALLER_LONG_SPEC_CONST_TMPVARCV) \
+ _(2856, ZEND_IS_SMALLER_LONG_SPEC_CONST_TMPVARCV_JMPZ) \
+ _(2857, ZEND_IS_SMALLER_LONG_SPEC_CONST_TMPVARCV_JMPNZ) \
+ _(2858, ZEND_IS_SMALLER_LONG_SPEC_CONST_TMPVARCV) \
+ _(2859, ZEND_IS_SMALLER_LONG_SPEC_CONST_TMPVARCV_JMPZ) \
+ _(2860, ZEND_IS_SMALLER_LONG_SPEC_CONST_TMPVARCV_JMPNZ) \
+ _(2864, ZEND_IS_SMALLER_LONG_SPEC_CONST_TMPVARCV) \
+ _(2865, ZEND_IS_SMALLER_LONG_SPEC_CONST_TMPVARCV_JMPZ) \
+ _(2866, ZEND_IS_SMALLER_LONG_SPEC_CONST_TMPVARCV_JMPNZ) \
_(2867, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_CONST) \
_(2868, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_CONST_JMPZ) \
_(2869, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_CONST_JMPNZ) \
@@ -1579,39 +1575,39 @@
_(2879, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV) \
_(2880, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
_(2881, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2897, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_CONST) \
- _(2898, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_CONST_JMPZ) \
- _(2899, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_CONST_JMPNZ) \
- _(2900, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(2901, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2902, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2903, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(2904, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2905, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2909, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(2910, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2911, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2915, ZEND_IS_SMALLER_DOUBLE_SPEC_CONST_TMPVARCV) \
- _(2916, ZEND_IS_SMALLER_DOUBLE_SPEC_CONST_TMPVARCV_JMPZ) \
- _(2917, ZEND_IS_SMALLER_DOUBLE_SPEC_CONST_TMPVARCV_JMPNZ) \
- _(2918, ZEND_IS_SMALLER_DOUBLE_SPEC_CONST_TMPVARCV) \
- _(2919, ZEND_IS_SMALLER_DOUBLE_SPEC_CONST_TMPVARCV_JMPZ) \
- _(2920, ZEND_IS_SMALLER_DOUBLE_SPEC_CONST_TMPVARCV_JMPNZ) \
- _(2924, ZEND_IS_SMALLER_DOUBLE_SPEC_CONST_TMPVARCV) \
- _(2925, ZEND_IS_SMALLER_DOUBLE_SPEC_CONST_TMPVARCV_JMPZ) \
- _(2926, ZEND_IS_SMALLER_DOUBLE_SPEC_CONST_TMPVARCV_JMPNZ) \
- _(2927, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_CONST) \
- _(2928, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_CONST_JMPZ) \
- _(2929, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_CONST_JMPNZ) \
- _(2930, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(2931, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2932, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2933, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(2934, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2935, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2939, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(2940, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2941, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2882, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_CONST) \
+ _(2883, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_CONST_JMPZ) \
+ _(2884, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_CONST_JMPNZ) \
+ _(2885, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(2886, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2887, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2888, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(2889, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2890, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2894, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(2895, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2896, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2912, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_CONST) \
+ _(2913, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_CONST_JMPZ) \
+ _(2914, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_CONST_JMPNZ) \
+ _(2915, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(2916, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2917, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2918, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(2919, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2920, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2924, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(2925, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2926, ZEND_IS_SMALLER_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2930, ZEND_IS_SMALLER_DOUBLE_SPEC_CONST_TMPVARCV) \
+ _(2931, ZEND_IS_SMALLER_DOUBLE_SPEC_CONST_TMPVARCV_JMPZ) \
+ _(2932, ZEND_IS_SMALLER_DOUBLE_SPEC_CONST_TMPVARCV_JMPNZ) \
+ _(2933, ZEND_IS_SMALLER_DOUBLE_SPEC_CONST_TMPVARCV) \
+ _(2934, ZEND_IS_SMALLER_DOUBLE_SPEC_CONST_TMPVARCV_JMPZ) \
+ _(2935, ZEND_IS_SMALLER_DOUBLE_SPEC_CONST_TMPVARCV_JMPNZ) \
+ _(2939, ZEND_IS_SMALLER_DOUBLE_SPEC_CONST_TMPVARCV) \
+ _(2940, ZEND_IS_SMALLER_DOUBLE_SPEC_CONST_TMPVARCV_JMPZ) \
+ _(2941, ZEND_IS_SMALLER_DOUBLE_SPEC_CONST_TMPVARCV_JMPNZ) \
_(2942, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_CONST) \
_(2943, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_CONST_JMPZ) \
_(2944, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_CONST_JMPNZ) \
@@ -1624,39 +1620,39 @@
_(2954, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
_(2955, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
_(2956, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2972, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_CONST) \
- _(2973, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_CONST_JMPZ) \
- _(2974, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_CONST_JMPNZ) \
- _(2975, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(2976, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2977, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2978, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(2979, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2980, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2984, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(2985, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(2986, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(2990, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_CONST_TMPVARCV) \
- _(2991, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_CONST_TMPVARCV_JMPZ) \
- _(2992, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_CONST_TMPVARCV_JMPNZ) \
- _(2993, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_CONST_TMPVARCV) \
- _(2994, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_CONST_TMPVARCV_JMPZ) \
- _(2995, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_CONST_TMPVARCV_JMPNZ) \
- _(2999, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_CONST_TMPVARCV) \
- _(3000, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_CONST_TMPVARCV_JMPZ) \
- _(3001, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_CONST_TMPVARCV_JMPNZ) \
- _(3002, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_CONST) \
- _(3003, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPZ) \
- _(3004, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPNZ) \
- _(3005, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(3006, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(3007, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(3008, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(3009, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(3010, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(3014, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(3015, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(3016, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2957, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_CONST) \
+ _(2958, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_CONST_JMPZ) \
+ _(2959, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_CONST_JMPNZ) \
+ _(2960, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(2961, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2962, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2963, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(2964, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2965, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2969, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(2970, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2971, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2987, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_CONST) \
+ _(2988, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_CONST_JMPZ) \
+ _(2989, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_CONST_JMPNZ) \
+ _(2990, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(2991, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2992, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2993, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(2994, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(2995, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(2999, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(3000, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(3001, ZEND_IS_SMALLER_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(3005, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_CONST_TMPVARCV) \
+ _(3006, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_CONST_TMPVARCV_JMPZ) \
+ _(3007, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_CONST_TMPVARCV_JMPNZ) \
+ _(3008, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_CONST_TMPVARCV) \
+ _(3009, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_CONST_TMPVARCV_JMPZ) \
+ _(3010, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_CONST_TMPVARCV_JMPNZ) \
+ _(3014, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_CONST_TMPVARCV) \
+ _(3015, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_CONST_TMPVARCV_JMPZ) \
+ _(3016, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_CONST_TMPVARCV_JMPNZ) \
_(3017, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_CONST) \
_(3018, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPZ) \
_(3019, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPNZ) \
@@ -1669,39 +1665,39 @@
_(3029, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
_(3030, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
_(3031, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(3047, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_CONST) \
- _(3048, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPZ) \
- _(3049, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPNZ) \
- _(3050, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(3051, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(3052, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(3053, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(3054, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(3055, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(3059, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
- _(3060, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(3061, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(3065, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_CONST_TMPVARCV) \
- _(3066, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_CONST_TMPVARCV_JMPZ) \
- _(3067, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_CONST_TMPVARCV_JMPNZ) \
- _(3068, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_CONST_TMPVARCV) \
- _(3069, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_CONST_TMPVARCV_JMPZ) \
- _(3070, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_CONST_TMPVARCV_JMPNZ) \
- _(3074, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_CONST_TMPVARCV) \
- _(3075, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_CONST_TMPVARCV_JMPZ) \
- _(3076, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_CONST_TMPVARCV_JMPNZ) \
- _(3077, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST) \
- _(3078, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPZ) \
- _(3079, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPNZ) \
- _(3080, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(3081, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(3082, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(3083, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(3084, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(3085, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(3089, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(3090, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(3091, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(3032, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_CONST) \
+ _(3033, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPZ) \
+ _(3034, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPNZ) \
+ _(3035, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(3036, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(3037, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(3038, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(3039, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(3040, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(3044, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(3045, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(3046, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(3062, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_CONST) \
+ _(3063, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPZ) \
+ _(3064, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_CONST_JMPNZ) \
+ _(3065, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(3066, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(3067, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(3068, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(3069, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(3070, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(3074, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV) \
+ _(3075, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(3076, ZEND_IS_SMALLER_OR_EQUAL_LONG_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(3080, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_CONST_TMPVARCV) \
+ _(3081, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_CONST_TMPVARCV_JMPZ) \
+ _(3082, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_CONST_TMPVARCV_JMPNZ) \
+ _(3083, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_CONST_TMPVARCV) \
+ _(3084, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_CONST_TMPVARCV_JMPZ) \
+ _(3085, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_CONST_TMPVARCV_JMPNZ) \
+ _(3089, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_CONST_TMPVARCV) \
+ _(3090, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_CONST_TMPVARCV_JMPZ) \
+ _(3091, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_CONST_TMPVARCV_JMPNZ) \
_(3092, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST) \
_(3093, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPZ) \
_(3094, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPNZ) \
@@ -1714,63 +1710,75 @@
_(3104, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
_(3105, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
_(3106, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(3122, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST) \
- _(3123, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPZ) \
- _(3124, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPNZ) \
- _(3125, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(3126, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(3127, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(3128, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(3129, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(3130, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(3134, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
- _(3135, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
- _(3136, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
- _(3137, ZEND_PRE_INC_LONG_NO_OVERFLOW_SPEC_CV_RETVAL_UNUSED) \
- _(3138, ZEND_PRE_INC_LONG_NO_OVERFLOW_SPEC_CV_RETVAL_USED) \
- _(3139, ZEND_PRE_INC_LONG_SPEC_CV_RETVAL_UNUSED) \
- _(3140, ZEND_PRE_INC_LONG_SPEC_CV_RETVAL_USED) \
- _(3141, ZEND_PRE_DEC_LONG_NO_OVERFLOW_SPEC_CV_RETVAL_UNUSED) \
- _(3142, ZEND_PRE_DEC_LONG_NO_OVERFLOW_SPEC_CV_RETVAL_USED) \
- _(3143, ZEND_PRE_DEC_LONG_SPEC_CV_RETVAL_UNUSED) \
- _(3144, ZEND_PRE_DEC_LONG_SPEC_CV_RETVAL_USED) \
- _(3145, ZEND_POST_INC_LONG_NO_OVERFLOW_SPEC_CV) \
- _(3146, ZEND_POST_INC_LONG_SPEC_CV) \
- _(3147, ZEND_POST_DEC_LONG_NO_OVERFLOW_SPEC_CV) \
- _(3148, ZEND_POST_DEC_LONG_SPEC_CV) \
- _(3149, ZEND_QM_ASSIGN_LONG_SPEC_CONST) \
- _(3150, ZEND_QM_ASSIGN_LONG_SPEC_TMPVARCV) \
- _(3151, ZEND_QM_ASSIGN_LONG_SPEC_TMPVARCV) \
- _(3153, ZEND_QM_ASSIGN_LONG_SPEC_TMPVARCV) \
- _(3154, ZEND_QM_ASSIGN_DOUBLE_SPEC_CONST) \
- _(3155, ZEND_QM_ASSIGN_DOUBLE_SPEC_TMPVARCV) \
- _(3156, ZEND_QM_ASSIGN_DOUBLE_SPEC_TMPVARCV) \
- _(3158, ZEND_QM_ASSIGN_DOUBLE_SPEC_TMPVARCV) \
- _(3159, ZEND_QM_ASSIGN_NOREF_SPEC_CONST) \
- _(3160, ZEND_QM_ASSIGN_NOREF_SPEC_TMPVARCV) \
- _(3161, ZEND_QM_ASSIGN_NOREF_SPEC_TMPVARCV) \
- _(3163, ZEND_QM_ASSIGN_NOREF_SPEC_TMPVARCV) \
- _(3165, ZEND_FETCH_DIM_R_INDEX_SPEC_CONST_TMPVARCV) \
- _(3166, ZEND_FETCH_DIM_R_INDEX_SPEC_CONST_TMPVARCV) \
- _(3168, ZEND_FETCH_DIM_R_INDEX_SPEC_CONST_TMPVARCV) \
- _(3169, ZEND_FETCH_DIM_R_INDEX_SPEC_TMPVAR_CONST) \
- _(3170, ZEND_FETCH_DIM_R_INDEX_SPEC_TMPVAR_TMPVARCV) \
- _(3171, ZEND_FETCH_DIM_R_INDEX_SPEC_TMPVAR_TMPVARCV) \
- _(3173, ZEND_FETCH_DIM_R_INDEX_SPEC_TMPVAR_TMPVARCV) \
- _(3174, ZEND_FETCH_DIM_R_INDEX_SPEC_TMPVAR_CONST) \
- _(3175, ZEND_FETCH_DIM_R_INDEX_SPEC_TMPVAR_TMPVARCV) \
- _(3176, ZEND_FETCH_DIM_R_INDEX_SPEC_TMPVAR_TMPVARCV) \
- _(3178, ZEND_FETCH_DIM_R_INDEX_SPEC_TMPVAR_TMPVARCV) \
- _(3184, ZEND_FETCH_DIM_R_INDEX_SPEC_CV_CONST) \
- _(3185, ZEND_FETCH_DIM_R_INDEX_SPEC_CV_TMPVARCV) \
- _(3186, ZEND_FETCH_DIM_R_INDEX_SPEC_CV_TMPVARCV) \
- _(3188, ZEND_FETCH_DIM_R_INDEX_SPEC_CV_TMPVARCV) \
- _(3191, ZEND_SEND_VAR_SIMPLE_SPEC_VAR) \
- _(3193, ZEND_SEND_VAR_SIMPLE_SPEC_CV) \
- _(3196, ZEND_SEND_VAR_EX_SIMPLE_SPEC_VAR) \
- _(3198, ZEND_SEND_VAR_EX_SIMPLE_SPEC_CV) \
- _(3199, ZEND_SEND_VAL_SIMPLE_SPEC_CONST) \
- _(3200, ZEND_SEND_VAL_EX_SIMPLE_SPEC_CONST) \
- _(3201, ZEND_FE_FETCH_R_SIMPLE_SPEC_VAR_CV_RETVAL_UNUSED) \
- _(3202, ZEND_FE_FETCH_R_SIMPLE_SPEC_VAR_CV_RETVAL_USED) \
- _(3202+1, ZEND_NULL)
+ _(3107, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST) \
+ _(3108, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPZ) \
+ _(3109, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPNZ) \
+ _(3110, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(3111, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(3112, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(3113, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(3114, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(3115, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(3119, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(3120, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(3121, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(3137, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST) \
+ _(3138, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPZ) \
+ _(3139, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_CONST_JMPNZ) \
+ _(3140, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(3141, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(3142, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(3143, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(3144, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(3145, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(3149, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV) \
+ _(3150, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPZ) \
+ _(3151, ZEND_IS_SMALLER_OR_EQUAL_DOUBLE_SPEC_TMPVARCV_TMPVARCV_JMPNZ) \
+ _(3152, ZEND_PRE_INC_LONG_NO_OVERFLOW_SPEC_CV_RETVAL_UNUSED) \
+ _(3153, ZEND_PRE_INC_LONG_NO_OVERFLOW_SPEC_CV_RETVAL_USED) \
+ _(3154, ZEND_PRE_INC_LONG_SPEC_CV_RETVAL_UNUSED) \
+ _(3155, ZEND_PRE_INC_LONG_SPEC_CV_RETVAL_USED) \
+ _(3156, ZEND_PRE_DEC_LONG_NO_OVERFLOW_SPEC_CV_RETVAL_UNUSED) \
+ _(3157, ZEND_PRE_DEC_LONG_NO_OVERFLOW_SPEC_CV_RETVAL_USED) \
+ _(3158, ZEND_PRE_DEC_LONG_SPEC_CV_RETVAL_UNUSED) \
+ _(3159, ZEND_PRE_DEC_LONG_SPEC_CV_RETVAL_USED) \
+ _(3160, ZEND_POST_INC_LONG_NO_OVERFLOW_SPEC_CV) \
+ _(3161, ZEND_POST_INC_LONG_SPEC_CV) \
+ _(3162, ZEND_POST_DEC_LONG_NO_OVERFLOW_SPEC_CV) \
+ _(3163, ZEND_POST_DEC_LONG_SPEC_CV) \
+ _(3164, ZEND_QM_ASSIGN_LONG_SPEC_CONST) \
+ _(3165, ZEND_QM_ASSIGN_LONG_SPEC_TMPVARCV) \
+ _(3166, ZEND_QM_ASSIGN_LONG_SPEC_TMPVARCV) \
+ _(3168, ZEND_QM_ASSIGN_LONG_SPEC_TMPVARCV) \
+ _(3169, ZEND_QM_ASSIGN_DOUBLE_SPEC_CONST) \
+ _(3170, ZEND_QM_ASSIGN_DOUBLE_SPEC_TMPVARCV) \
+ _(3171, ZEND_QM_ASSIGN_DOUBLE_SPEC_TMPVARCV) \
+ _(3173, ZEND_QM_ASSIGN_DOUBLE_SPEC_TMPVARCV) \
+ _(3174, ZEND_QM_ASSIGN_NOREF_SPEC_CONST) \
+ _(3175, ZEND_QM_ASSIGN_NOREF_SPEC_TMPVARCV) \
+ _(3176, ZEND_QM_ASSIGN_NOREF_SPEC_TMPVARCV) \
+ _(3178, ZEND_QM_ASSIGN_NOREF_SPEC_TMPVARCV) \
+ _(3180, ZEND_FETCH_DIM_R_INDEX_SPEC_CONST_TMPVARCV) \
+ _(3181, ZEND_FETCH_DIM_R_INDEX_SPEC_CONST_TMPVARCV) \
+ _(3183, ZEND_FETCH_DIM_R_INDEX_SPEC_CONST_TMPVARCV) \
+ _(3184, ZEND_FETCH_DIM_R_INDEX_SPEC_TMPVAR_CONST) \
+ _(3185, ZEND_FETCH_DIM_R_INDEX_SPEC_TMPVAR_TMPVARCV) \
+ _(3186, ZEND_FETCH_DIM_R_INDEX_SPEC_TMPVAR_TMPVARCV) \
+ _(3188, ZEND_FETCH_DIM_R_INDEX_SPEC_TMPVAR_TMPVARCV) \
+ _(3189, ZEND_FETCH_DIM_R_INDEX_SPEC_TMPVAR_CONST) \
+ _(3190, ZEND_FETCH_DIM_R_INDEX_SPEC_TMPVAR_TMPVARCV) \
+ _(3191, ZEND_FETCH_DIM_R_INDEX_SPEC_TMPVAR_TMPVARCV) \
+ _(3193, ZEND_FETCH_DIM_R_INDEX_SPEC_TMPVAR_TMPVARCV) \
+ _(3199, ZEND_FETCH_DIM_R_INDEX_SPEC_CV_CONST) \
+ _(3200, ZEND_FETCH_DIM_R_INDEX_SPEC_CV_TMPVARCV) \
+ _(3201, ZEND_FETCH_DIM_R_INDEX_SPEC_CV_TMPVARCV) \
+ _(3203, ZEND_FETCH_DIM_R_INDEX_SPEC_CV_TMPVARCV) \
+ _(3206, ZEND_SEND_VAR_SIMPLE_SPEC_VAR) \
+ _(3208, ZEND_SEND_VAR_SIMPLE_SPEC_CV) \
+ _(3211, ZEND_SEND_VAR_EX_SIMPLE_SPEC_VAR) \
+ _(3213, ZEND_SEND_VAR_EX_SIMPLE_SPEC_CV) \
+ _(3214, ZEND_SEND_VAL_SIMPLE_SPEC_CONST) \
+ _(3215, ZEND_SEND_VAL_EX_SIMPLE_SPEC_CONST) \
+ _(3216, ZEND_FE_FETCH_R_SIMPLE_SPEC_VAR_CV_RETVAL_UNUSED) \
+ _(3217, ZEND_FE_FETCH_R_SIMPLE_SPEC_VAR_CV_RETVAL_USED) \
+ _(3217+1, ZEND_NULL)
diff --git a/Zend/zend_vm_opcodes.c b/Zend/zend_vm_opcodes.c
index 3290d760be..65733779e4 100644
--- a/Zend/zend_vm_opcodes.c
+++ b/Zend/zend_vm_opcodes.c
@@ -234,7 +234,7 @@ static uint32_t zend_vm_opcodes_flags[195] = {
0x80000b0b,
0x80000b0b,
0x00000707,
- 0x00000007,
+ 0x0000000b,
0x00000007,
0x80000707,
0x80000303,
@@ -284,7 +284,7 @@ static uint32_t zend_vm_opcodes_flags[195] = {
0x00000000,
0x01040310,
0x00000003,
- 0x0000a110,
+ 0x00040110,
0x00040310,
0x00001007,
0x00001001,
@@ -329,7 +329,7 @@ static uint32_t zend_vm_opcodes_flags[195] = {
0x01000000,
0x00001001,
0x02042003,
- 0x00000003,
+ 0x00000007,
0x00040771,
0x00000057,
0x0b000003,
@@ -378,16 +378,16 @@ static uint32_t zend_vm_opcodes_flags[195] = {
0x00020101,
0x00000701,
0x00000101,
- 0x00000071,
+ 0x00000075,
0x00000000,
0x00000000,
- 0x0b000303,
+ 0x0b000703,
0x00000003,
0x00000020,
0x00003000,
- 0x0000a110,
+ 0x00040110,
0x00000000,
- 0x00000003,
+ 0x00000007,
0x00000105,
0x00040301,
0x00002003,
diff --git a/Zend/zend_vm_opcodes.h b/Zend/zend_vm_opcodes.h
index d06f44e889..60bcb66643 100644
--- a/Zend/zend_vm_opcodes.h
+++ b/Zend/zend_vm_opcodes.h
@@ -54,7 +54,7 @@
#define ZEND_VM_EXT_ARRAY_INIT 0x00080000
#define ZEND_VM_EXT_REF 0x00100000
#define ZEND_VM_EXT_FETCH_REF 0x00200000
-#define ZEND_VM_EXT_DIM_OBJ_WRITE 0x00400000
+#define ZEND_VM_EXT_DIM_WRITE 0x00400000
#define ZEND_VM_EXT_MASK 0x0f000000
#define ZEND_VM_EXT_NUM 0x01000000
#define ZEND_VM_EXT_LAST_CATCH 0x02000000
diff --git a/Zend/zend_weakrefs.c b/Zend/zend_weakrefs.c
index b73a5963aa..c3f7bf5bb2 100644
--- a/Zend/zend_weakrefs.c
+++ b/Zend/zend_weakrefs.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 2.00 of the Zend license, |
@@ -20,35 +18,152 @@
#include "zend_interfaces.h"
#include "zend_objects_API.h"
#include "zend_weakrefs.h"
+#include "zend_weakrefs_arginfo.h"
typedef struct _zend_weakref {
zend_object *referent;
zend_object std;
} zend_weakref;
+typedef struct _zend_weakmap {
+ HashTable ht;
+ zend_object std;
+} zend_weakmap;
+
+typedef struct _zend_weakmap_iterator {
+ zend_object_iterator it;
+ uint32_t ht_iter;
+} zend_weakmap_iterator;
+
+/* The EG(weakrefs) ht is a map from object address a tagged pointer, that may be one of
+ * zend_weakref*, zend_weakmap* or HashTable*. */
+#define ZEND_WEAKREF_TAG_REF 0
+#define ZEND_WEAKREF_TAG_MAP 1
+#define ZEND_WEAKREF_TAG_HT 2
+#define ZEND_WEAKREF_GET_TAG(p) (((uintptr_t) (p)) & 3)
+#define ZEND_WEAKREF_GET_PTR(p) ((void *) (((uintptr_t) (p)) & ~3))
+#define ZEND_WEAKREF_ENCODE(p, t) ((void *) (((uintptr_t) (p)) | (t)))
+
zend_class_entry *zend_ce_weakref;
+zend_class_entry *zend_ce_weakmap;
static zend_object_handlers zend_weakref_handlers;
+static zend_object_handlers zend_weakmap_handlers;
#define zend_weakref_from(o) ((zend_weakref*)(((char*) o) - XtOffsetOf(zend_weakref, std)))
#define zend_weakref_fetch(z) zend_weakref_from(Z_OBJ_P(z))
-static void zend_weakref_unref(zval *zv) {
- zend_weakref *wr = (zend_weakref*) Z_PTR_P(zv);
+#define zend_weakmap_from(o) ((zend_weakmap*)(((char*) o) - XtOffsetOf(zend_weakmap, std)))
+#define zend_weakmap_fetch(z) zend_weakmap_from(Z_OBJ_P(z))
+
+static inline void zend_weakref_unref_single(
+ void *ptr, uintptr_t tag, zend_ulong obj_addr)
+{
+ if (tag == ZEND_WEAKREF_TAG_REF) {
+ zend_weakref *wr = ptr;
+ wr->referent = NULL;
+ } else {
+ ZEND_ASSERT(tag == ZEND_WEAKREF_TAG_MAP);
+ zend_weakmap *wm = ptr;
+ zend_hash_index_del(&wm->ht, obj_addr);
+ }
+}
+
+static void zend_weakref_unref(zend_ulong obj_addr, void *tagged_ptr) {
+ void *ptr = ZEND_WEAKREF_GET_PTR(tagged_ptr);
+ uintptr_t tag = ZEND_WEAKREF_GET_TAG(tagged_ptr);
+ if (tag == ZEND_WEAKREF_TAG_HT) {
+ HashTable *ht = ptr;
+ ZEND_HASH_FOREACH_PTR(ht, tagged_ptr) {
+ zend_weakref_unref_single(
+ ZEND_WEAKREF_GET_PTR(tagged_ptr), ZEND_WEAKREF_GET_TAG(tagged_ptr), obj_addr);
+ } ZEND_HASH_FOREACH_END();
+ zend_hash_destroy(ht);
+ FREE_HASHTABLE(ht);
+ } else {
+ zend_weakref_unref_single(ptr, tag, obj_addr);
+ }
+}
- GC_DEL_FLAGS(wr->referent, IS_OBJ_WEAKLY_REFERENCED);
+static void zend_weakref_register(zend_object *object, void *payload) {
+ GC_ADD_FLAGS(object, IS_OBJ_WEAKLY_REFERENCED);
- wr->referent = NULL;
+ zend_ulong obj_addr = (zend_ulong) object;
+ zval *zv = zend_hash_index_find(&EG(weakrefs), obj_addr);
+ if (!zv) {
+ zend_hash_index_add_new_ptr(&EG(weakrefs), obj_addr, payload);
+ return;
+ }
+
+ void *tagged_ptr = Z_PTR_P(zv);
+ if (ZEND_WEAKREF_GET_TAG(tagged_ptr) == ZEND_WEAKREF_TAG_HT) {
+ HashTable *ht = ZEND_WEAKREF_GET_PTR(tagged_ptr);
+ zend_hash_index_add_new_ptr(ht, (zend_ulong) payload, payload);
+ return;
+ }
+
+ /* Convert simple pointer to hashtable. */
+ HashTable *ht = emalloc(sizeof(HashTable));
+ zend_hash_init(ht, 0, NULL, NULL, 0);
+ zend_hash_index_add_new_ptr(ht, (zend_ulong) tagged_ptr, tagged_ptr);
+ zend_hash_index_add_new_ptr(ht, (zend_ulong) payload, payload);
+ zend_hash_index_update_ptr(
+ &EG(weakrefs), obj_addr, ZEND_WEAKREF_ENCODE(ht, ZEND_WEAKREF_TAG_HT));
+}
+
+static void zend_weakref_unregister(zend_object *object, void *payload) {
+ zend_ulong obj_addr = (zend_ulong) object;
+ void *tagged_ptr = zend_hash_index_find_ptr(&EG(weakrefs), obj_addr);
+ ZEND_ASSERT(tagged_ptr && "Weakref not registered?");
+
+ void *ptr = ZEND_WEAKREF_GET_PTR(tagged_ptr);
+ uintptr_t tag = ZEND_WEAKREF_GET_TAG(tagged_ptr);
+ if (tag != ZEND_WEAKREF_TAG_HT) {
+ ZEND_ASSERT(tagged_ptr == payload);
+ zend_weakref_unref_single(ptr, tag, obj_addr);
+ zend_hash_index_del(&EG(weakrefs), obj_addr);
+ GC_DEL_FLAGS(object, IS_OBJ_WEAKLY_REFERENCED);
+ return;
+ }
+
+ HashTable *ht = ptr;
+ tagged_ptr = zend_hash_index_find_ptr(ht, (zend_ulong) payload);
+ ZEND_ASSERT(tagged_ptr && "Weakref not registered?");
+ ZEND_ASSERT(tagged_ptr == payload);
+ zend_weakref_unref_single(
+ ZEND_WEAKREF_GET_PTR(payload), ZEND_WEAKREF_GET_TAG(payload), obj_addr);
+ zend_hash_index_del(ht, (zend_ulong) payload);
+ if (zend_hash_num_elements(ht) == 0) {
+ GC_DEL_FLAGS(object, IS_OBJ_WEAKLY_REFERENCED);
+ zend_hash_destroy(ht);
+ FREE_HASHTABLE(ht);
+ zend_hash_index_del(&EG(weakrefs), obj_addr);
+ }
}
void zend_weakrefs_init() {
- zend_hash_init(&EG(weakrefs), 8, NULL, zend_weakref_unref, 0);
+ zend_hash_init(&EG(weakrefs), 8, NULL, NULL, 0);
}
void zend_weakrefs_notify(zend_object *object) {
- zend_hash_index_del(&EG(weakrefs), (zend_ulong) object);
+ /* Annoyingly we can't use the HT destructor here, because we need access to the key (which
+ * is the object address), which is not provided to the dtor. */
+ zend_ulong obj_addr = (zend_ulong) object;
+ void *tagged_ptr = zend_hash_index_find_ptr(&EG(weakrefs), obj_addr);
+#if ZEND_DEBUG
+ ZEND_ASSERT(tagged_ptr && "Tracking of the IS_OBJ_WEAKLY_REFERENCE flag should be precise");
+#endif
+ if (tagged_ptr) {
+ zend_weakref_unref(obj_addr, tagged_ptr);
+ zend_hash_index_del(&EG(weakrefs), obj_addr);
+ }
}
void zend_weakrefs_shutdown() {
+ zend_ulong obj_addr;
+ void *tagged_ptr;
+ ZEND_HASH_FOREACH_NUM_KEY_PTR(&EG(weakrefs), obj_addr, tagged_ptr) {
+ zend_weakref_unref(obj_addr, tagged_ptr);
+ } ZEND_HASH_FOREACH_END();
zend_hash_destroy(&EG(weakrefs));
}
@@ -63,16 +178,32 @@ static zend_object* zend_weakref_new(zend_class_entry *ce) {
}
static zend_always_inline zend_bool zend_weakref_find(zval *referent, zval *return_value) {
- zend_weakref *wr = zend_hash_index_find_ptr(&EG(weakrefs), (zend_ulong) Z_OBJ_P(referent));
-
- if (!wr) {
+ void *tagged_ptr = zend_hash_index_find_ptr(&EG(weakrefs), (zend_ulong) Z_OBJ_P(referent));
+ if (!tagged_ptr) {
return 0;
}
- GC_ADDREF(&wr->std);
- ZVAL_OBJ(return_value, &wr->std);
+ void *ptr = ZEND_WEAKREF_GET_PTR(tagged_ptr);
+ uintptr_t tag = ZEND_WEAKREF_GET_TAG(tagged_ptr);
+ if (tag == ZEND_WEAKREF_TAG_REF) {
+ zend_weakref *wr;
+found_weakref:
+ wr = ptr;
+ GC_ADDREF(&wr->std);
+ ZVAL_OBJ(return_value, &wr->std);
+ return 1;
+ }
+
+ if (tag == ZEND_WEAKREF_TAG_HT) {
+ ZEND_HASH_FOREACH(ptr, tagged_ptr) {
+ if (ZEND_WEAKREF_GET_TAG(tagged_ptr) == ZEND_WEAKREF_TAG_REF) {
+ ptr = ZEND_WEAKREF_GET_PTR(tagged_ptr);
+ goto found_weakref;
+ }
+ } ZEND_HASH_FOREACH_END();
+ }
- return 1;
+ return 0;
}
static zend_always_inline void zend_weakref_create(zval *referent, zval *return_value) {
@@ -81,12 +212,9 @@ static zend_always_inline void zend_weakref_create(zval *referent, zval *return_
object_init_ex(return_value, zend_ce_weakref);
wr = zend_weakref_fetch(return_value);
-
wr->referent = Z_OBJ_P(referent);
- zend_hash_index_add_ptr(&EG(weakrefs), (zend_ulong) wr->referent, wr);
-
- GC_ADD_FLAGS(wr->referent, IS_OBJ_WEAKLY_REFERENCED);
+ zend_weakref_register(wr->referent, ZEND_WEAKREF_ENCODE(wr, ZEND_WEAKREF_TAG_REF));
}
static zend_always_inline void zend_weakref_get(zval *weakref, zval *return_value) {
@@ -102,53 +230,45 @@ static void zend_weakref_free(zend_object *zo) {
zend_weakref *wr = zend_weakref_from(zo);
if (wr->referent) {
- zend_hash_index_del(
- &EG(weakrefs), (zend_ulong) wr->referent);
+ zend_weakref_unregister(wr->referent, ZEND_WEAKREF_ENCODE(wr, ZEND_WEAKREF_TAG_REF));
}
zend_object_std_dtor(&wr->std);
}
-#define zend_weakref_unsupported(thing) \
- zend_throw_error(NULL, "WeakReference objects do not support " thing);
+#define zend_weakref_unsupported(object, thing) \
+ zend_throw_error(NULL, "%s objects do not support " thing, ZSTR_VAL(object->ce->name));
-static ZEND_COLD zval* zend_weakref_no_write(zval *object, zval *member, zval *value, void **rtc) {
- zend_weakref_unsupported("properties");
+static ZEND_COLD zval* zend_weakref_no_write(zend_object *object, zend_string *member, zval *value, void **rtc) {
+ zend_weakref_unsupported(object, "properties");
return &EG(uninitialized_zval);
}
-static ZEND_COLD zval* zend_weakref_no_read(zval *object, zval *member, int type, void **rtc, zval *rv) {
+static ZEND_COLD zval* zend_weakref_no_read(zend_object *object, zend_string *member, int type, void **rtc, zval *rv) {
if (!EG(exception)) {
- zend_weakref_unsupported("properties");
+ zend_weakref_unsupported(object, "properties");
}
return &EG(uninitialized_zval);
}
-static ZEND_COLD zval *zend_weakref_no_read_ptr(zval *object, zval *member, int type, void **rtc) {
- zend_weakref_unsupported("property references");
+static ZEND_COLD zval *zend_weakref_no_read_ptr(zend_object *object, zend_string *member, int type, void **rtc) {
+ zend_weakref_unsupported(object, "property references");
return NULL;
}
-static ZEND_COLD int zend_weakref_no_isset(zval *object, zval *member, int hse, void **rtc) {
+static ZEND_COLD int zend_weakref_no_isset(zend_object *object, zend_string *member, int hse, void **rtc) {
if (hse != 2) {
- zend_weakref_unsupported("properties");
+ zend_weakref_unsupported(object, "properties");
}
return 0;
}
-static ZEND_COLD void zend_weakref_no_unset(zval *object, zval *member, void **rtc) {
- zend_weakref_unsupported("properties");
+static ZEND_COLD void zend_weakref_no_unset(zend_object *object, zend_string *member, void **rtc) {
+ zend_weakref_unsupported(object, "properties");
}
-ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(zend_weakref_create_arginfo, 0, 1, WeakReference, 0)
- ZEND_ARG_TYPE_INFO(0, referent, IS_OBJECT, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(zend_weakref_get_arginfo, 0, 0, IS_OBJECT, 1)
-ZEND_END_ARG_INFO()
-
ZEND_COLD ZEND_METHOD(WeakReference, __construct)
{
zend_throw_error(NULL,
@@ -160,7 +280,7 @@ ZEND_METHOD(WeakReference, create)
{
zval *referent;
- ZEND_PARSE_PARAMETERS_START_EX(ZEND_PARSE_PARAMS_THROW, 1,1)
+ ZEND_PARSE_PARAMETERS_START(1,1)
Z_PARAM_OBJECT(referent)
ZEND_PARSE_PARAMETERS_END();
@@ -173,16 +293,339 @@ ZEND_METHOD(WeakReference, create)
ZEND_METHOD(WeakReference, get)
{
- ZEND_PARSE_PARAMETERS_START_EX(ZEND_PARSE_PARAMS_THROW, 0, 0)
- ZEND_PARSE_PARAMETERS_END();
+ ZEND_PARSE_PARAMETERS_NONE();
zend_weakref_get(getThis(), return_value);
}
static const zend_function_entry zend_weakref_methods[] = {
- ZEND_ME(WeakReference, __construct, NULL, ZEND_ACC_PUBLIC)
- ZEND_ME(WeakReference, create, zend_weakref_create_arginfo, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- ZEND_ME(WeakReference, get, zend_weakref_get_arginfo, ZEND_ACC_PUBLIC)
+ ZEND_ME(WeakReference, __construct, arginfo_class_WeakReference___construct, ZEND_ACC_PUBLIC)
+ ZEND_ME(WeakReference, create, arginfo_class_WeakReference_create, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_ME(WeakReference, get, arginfo_class_WeakReference_get, ZEND_ACC_PUBLIC)
+ ZEND_FE_END
+};
+
+static zend_object *zend_weakmap_create_object(zend_class_entry *ce)
+{
+ zend_weakmap *wm = zend_object_alloc(sizeof(zend_weakmap), ce);
+ zend_object_std_init(&wm->std, ce);
+ wm->std.handlers = &zend_weakmap_handlers;
+
+ zend_hash_init(&wm->ht, 0, NULL, ZVAL_PTR_DTOR, 0);
+ return &wm->std;
+}
+
+static void zend_weakmap_free_obj(zend_object *object)
+{
+ zend_weakmap *wm = zend_weakmap_from(object);
+ zend_ulong obj_addr;
+ ZEND_HASH_FOREACH_NUM_KEY(&wm->ht, obj_addr) {
+ zend_weakref_unregister(
+ (zend_object *) obj_addr, ZEND_WEAKREF_ENCODE(wm, ZEND_WEAKREF_TAG_MAP));
+ } ZEND_HASH_FOREACH_END();
+ zend_hash_destroy(&wm->ht);
+ zend_object_std_dtor(&wm->std);
+}
+
+static zval *zend_weakmap_read_dimension(zend_object *object, zval *offset, int type, zval *rv)
+{
+ if (offset == NULL) {
+ zend_throw_error(NULL, "Cannot append to WeakMap");
+ return NULL;
+ }
+
+ if (Z_TYPE_P(offset) != IS_OBJECT) {
+ zend_type_error("WeakMap key must be an object");
+ return NULL;
+ }
+
+ zend_weakmap *wm = zend_weakmap_from(object);
+ zend_object *obj_key = Z_OBJ_P(offset);
+ zval *zv = zend_hash_index_find(&wm->ht, (zend_ulong) obj_key);
+ if (zv == NULL) {
+ if (type != BP_VAR_IS) {
+ zend_throw_error(NULL,
+ "Object %s#%d not contained in WeakMap", ZSTR_VAL(obj_key->ce->name), obj_key->handle);
+ return NULL;
+ }
+ return NULL;
+ }
+
+ if (type == BP_VAR_W || type == BP_VAR_RW) {
+ ZVAL_MAKE_REF(zv);
+ }
+ return zv;
+}
+
+static void zend_weakmap_write_dimension(zend_object *object, zval *offset, zval *value)
+{
+ if (offset == NULL) {
+ zend_throw_error(NULL, "Cannot append to WeakMap");
+ return;
+ }
+
+ if (Z_TYPE_P(offset) != IS_OBJECT) {
+ zend_type_error("WeakMap key must be an object");
+ return;
+ }
+
+ zend_weakmap *wm = zend_weakmap_from(object);
+ zend_object *obj_key = Z_OBJ_P(offset);
+ Z_TRY_ADDREF_P(value);
+
+ zval *zv = zend_hash_index_find(&wm->ht, (zend_ulong) obj_key);
+ if (zv) {
+ zval_ptr_dtor(zv);
+ ZVAL_COPY_VALUE(zv, value);
+ return;
+ }
+
+ zend_weakref_register(obj_key, ZEND_WEAKREF_ENCODE(wm, ZEND_WEAKREF_TAG_MAP));
+ zend_hash_index_add_new(&wm->ht, (zend_ulong) obj_key, value);
+}
+
+static int zend_weakmap_has_dimension(zend_object *object, zval *offset, int check_empty)
+{
+ if (Z_TYPE_P(offset) != IS_OBJECT) {
+ zend_type_error("WeakMap key must be an object");
+ return 0;
+ }
+
+ zend_weakmap *wm = zend_weakmap_from(object);
+ zval *zv = zend_hash_index_find(&wm->ht, (zend_ulong) Z_OBJ_P(offset));
+ if (!zv) {
+ return 0;
+ }
+
+ if (check_empty) {
+ return i_zend_is_true(zv);
+ }
+ return Z_TYPE_P(zv) != IS_NULL;
+}
+
+static void zend_weakmap_unset_dimension(zend_object *object, zval *offset)
+{
+ if (Z_TYPE_P(offset) != IS_OBJECT) {
+ zend_type_error("WeakMap key must be an object");
+ return;
+ }
+
+ zend_weakmap *wm = zend_weakmap_from(object);
+ zend_object *obj_key = Z_OBJ_P(offset);
+ zend_weakref_unregister(obj_key, ZEND_WEAKREF_ENCODE(wm, ZEND_WEAKREF_TAG_MAP));
+}
+
+static int zend_weakmap_count_elements(zend_object *object, zend_long *count)
+{
+ zend_weakmap *wm = zend_weakmap_from(object);
+ *count = zend_hash_num_elements(&wm->ht);
+ return SUCCESS;
+}
+
+static HashTable *zend_weakmap_get_properties_for(zend_object *object, zend_prop_purpose purpose)
+{
+ if (purpose != ZEND_PROP_PURPOSE_DEBUG) {
+ return NULL;
+ }
+
+ zend_weakmap *wm = zend_weakmap_from(object);
+ HashTable *ht;
+ ALLOC_HASHTABLE(ht);
+ zend_hash_init(ht, zend_hash_num_elements(&wm->ht), NULL, ZVAL_PTR_DTOR, 0);
+
+ zend_ulong obj_addr;
+ zval *val;
+ ZEND_HASH_FOREACH_NUM_KEY_VAL(&wm->ht, obj_addr, val) {
+ zval pair;
+ zval obj_zv;
+ array_init(&pair);
+
+ ZVAL_OBJ(&obj_zv, (zend_object *) obj_addr);
+ Z_ADDREF(obj_zv);
+ add_assoc_zval(&pair, "key", &obj_zv);
+ Z_TRY_ADDREF_P(val);
+ add_assoc_zval(&pair, "value", val);
+
+ zend_hash_next_index_insert(ht, &pair);
+ } ZEND_HASH_FOREACH_END();
+
+ return ht;
+}
+
+static HashTable *zend_weakmap_get_gc(zend_object *object, zval **table, int *n)
+{
+ zend_weakmap *wm = zend_weakmap_from(object);
+ *table = NULL;
+ *n = 0;
+ return &wm->ht;
+}
+
+static zend_object *zend_weakmap_clone_obj(zend_object *old_object)
+{
+ zend_object *new_object = zend_weakmap_create_object(zend_ce_weakmap);
+ zend_weakmap *old_wm = zend_weakmap_from(old_object);
+ zend_weakmap *new_wm = zend_weakmap_from(new_object);
+ zend_hash_copy(&new_wm->ht, &old_wm->ht, NULL);
+
+ zend_ulong obj_addr;
+ zval *val;
+ ZEND_HASH_FOREACH_NUM_KEY_VAL(&new_wm->ht, obj_addr, val) {
+ zend_weakref_register(
+ (zend_object *) obj_addr, ZEND_WEAKREF_ENCODE(new_wm, ZEND_WEAKREF_TAG_MAP));
+ zval_add_ref(val);
+ } ZEND_HASH_FOREACH_END();
+ return new_object;
+}
+
+static HashPosition *zend_weakmap_iterator_get_pos_ptr(zend_weakmap_iterator *iter) {
+ ZEND_ASSERT(iter->ht_iter != (uint32_t) -1);
+ return &EG(ht_iterators)[iter->ht_iter].pos;
+}
+
+static void zend_weakmap_iterator_dtor(zend_object_iterator *obj_iter)
+{
+ zend_weakmap_iterator *iter = (zend_weakmap_iterator *) obj_iter;
+ zend_hash_iterator_del(iter->ht_iter);
+ zval_ptr_dtor(&iter->it.data);
+}
+
+static int zend_weakmap_iterator_valid(zend_object_iterator *obj_iter)
+{
+ zend_weakmap_iterator *iter = (zend_weakmap_iterator *) obj_iter;
+ zend_weakmap *wm = zend_weakmap_fetch(&iter->it.data);
+ HashPosition *pos = zend_weakmap_iterator_get_pos_ptr(iter);
+ return zend_hash_has_more_elements_ex(&wm->ht, pos);
+}
+
+static zval *zend_weakmap_iterator_get_current_data(zend_object_iterator *obj_iter)
+{
+ zend_weakmap_iterator *iter = (zend_weakmap_iterator *) obj_iter;
+ zend_weakmap *wm = zend_weakmap_fetch(&iter->it.data);
+ HashPosition *pos = zend_weakmap_iterator_get_pos_ptr(iter);
+ return zend_hash_get_current_data_ex(&wm->ht, pos);
+}
+
+static void zend_weakmap_iterator_get_current_key(zend_object_iterator *obj_iter, zval *key)
+{
+ zend_weakmap_iterator *iter = (zend_weakmap_iterator *) obj_iter;
+ zend_weakmap *wm = zend_weakmap_fetch(&iter->it.data);
+ HashPosition *pos = zend_weakmap_iterator_get_pos_ptr(iter);
+
+ zend_string *string_key;
+ zend_ulong num_key;
+ int key_type = zend_hash_get_current_key_ex(&wm->ht, &string_key, &num_key, pos);
+ if (key_type != HASH_KEY_IS_LONG) {
+ ZEND_ASSERT(0 && "Must have integer key");
+ }
+
+ ZVAL_OBJ(key, (zend_object *) num_key);
+ Z_ADDREF_P(key);
+}
+
+static void zend_weakmap_iterator_move_forward(zend_object_iterator *obj_iter)
+{
+ zend_weakmap_iterator *iter = (zend_weakmap_iterator *) obj_iter;
+ zend_weakmap *wm = zend_weakmap_fetch(&iter->it.data);
+ HashPosition *pos = zend_weakmap_iterator_get_pos_ptr(iter);
+ zend_hash_move_forward_ex(&wm->ht, pos);
+}
+
+static void zend_weakmap_iterator_rewind(zend_object_iterator *obj_iter)
+{
+ zend_weakmap_iterator *iter = (zend_weakmap_iterator *) obj_iter;
+ zend_weakmap *wm = zend_weakmap_fetch(&iter->it.data);
+ HashPosition *pos = zend_weakmap_iterator_get_pos_ptr(iter);
+ zend_hash_internal_pointer_reset_ex(&wm->ht, pos);
+}
+
+static const zend_object_iterator_funcs zend_weakmap_iterator_funcs = {
+ zend_weakmap_iterator_dtor,
+ zend_weakmap_iterator_valid,
+ zend_weakmap_iterator_get_current_data,
+ zend_weakmap_iterator_get_current_key,
+ zend_weakmap_iterator_move_forward,
+ zend_weakmap_iterator_rewind,
+ NULL
+};
+
+static zend_object_iterator *zend_weakmap_get_iterator(
+ zend_class_entry *ce, zval *object, int by_ref)
+{
+ zend_weakmap *wm = zend_weakmap_fetch(object);
+ zend_weakmap_iterator *iter = emalloc(sizeof(zend_weakmap_iterator));
+ zend_iterator_init(&iter->it);
+ iter->it.funcs = &zend_weakmap_iterator_funcs;
+ ZVAL_COPY(&iter->it.data, object);
+ iter->ht_iter = zend_hash_iterator_add(&wm->ht, 0);
+ return &iter->it;
+}
+
+ZEND_METHOD(WeakMap, offsetGet)
+{
+ zval *key;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &key) == FAILURE) {
+ return;
+ }
+
+ zval *zv = zend_weakmap_read_dimension(Z_OBJ_P(ZEND_THIS), key, BP_VAR_R, NULL);
+ if (!zv) {
+ return;
+ }
+
+ ZVAL_COPY(return_value, zv);
+}
+
+ZEND_METHOD(WeakMap, offsetSet)
+{
+ zval *key, *value;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &key, &value) == FAILURE) {
+ return;
+ }
+
+ zend_weakmap_write_dimension(Z_OBJ_P(ZEND_THIS), key, value);
+}
+
+ZEND_METHOD(WeakMap, offsetExists)
+{
+ zval *key;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &key) == FAILURE) {
+ return;
+ }
+
+ RETURN_BOOL(zend_weakmap_has_dimension(Z_OBJ_P(ZEND_THIS), key, /* check_empty */ 0));
+}
+
+ZEND_METHOD(WeakMap, offsetUnset)
+{
+ zval *key;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &key) == FAILURE) {
+ return;
+ }
+
+ zend_weakmap_unset_dimension(Z_OBJ_P(ZEND_THIS), key);
+}
+
+ZEND_METHOD(WeakMap, count)
+{
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
+ zend_long count;
+ zend_weakmap_count_elements(Z_OBJ_P(ZEND_THIS), &count);
+ RETURN_LONG(count);
+}
+
+static const zend_function_entry zend_weakmap_methods[] = {
+ ZEND_ME(WeakMap, offsetGet, arginfo_class_WeakMap_offsetGet, ZEND_ACC_PUBLIC)
+ ZEND_ME(WeakMap, offsetSet, arginfo_class_WeakMap_offsetSet, ZEND_ACC_PUBLIC)
+ ZEND_ME(WeakMap, offsetExists, arginfo_class_WeakMap_offsetExists, ZEND_ACC_PUBLIC)
+ ZEND_ME(WeakMap, offsetUnset, arginfo_class_WeakMap_offsetUnset, ZEND_ACC_PUBLIC)
+ ZEND_ME(WeakMap, count, arginfo_class_WeakMap_count, ZEND_ACC_PUBLIC)
ZEND_FE_END
};
@@ -208,6 +651,36 @@ void zend_register_weakref_ce(void) /* {{{ */
zend_weakref_handlers.unset_property = zend_weakref_no_unset;
zend_weakref_handlers.get_property_ptr_ptr = zend_weakref_no_read_ptr;
zend_weakref_handlers.clone_obj = NULL;
+
+ INIT_CLASS_ENTRY(ce, "WeakMap", zend_weakmap_methods);
+ zend_ce_weakmap = zend_register_internal_class(&ce);
+ zend_ce_weakmap->ce_flags |= ZEND_ACC_FINAL;
+
+ zend_ce_weakmap->create_object = zend_weakmap_create_object;
+ zend_ce_weakmap->get_iterator = zend_weakmap_get_iterator;
+ zend_ce_weakmap->serialize = zend_class_serialize_deny;
+ zend_ce_weakmap->unserialize = zend_class_unserialize_deny;
+
+ /* Must happen after get_iterator is assigned. */
+ zend_class_implements(
+ zend_ce_weakmap, 3, zend_ce_arrayaccess, zend_ce_countable, zend_ce_traversable);
+
+ memcpy(&zend_weakmap_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ zend_weakmap_handlers.offset = XtOffsetOf(zend_weakmap, std);
+ zend_weakmap_handlers.free_obj = zend_weakmap_free_obj;
+ zend_weakmap_handlers.read_dimension = zend_weakmap_read_dimension;
+ zend_weakmap_handlers.write_dimension = zend_weakmap_write_dimension;
+ zend_weakmap_handlers.has_dimension = zend_weakmap_has_dimension;
+ zend_weakmap_handlers.unset_dimension = zend_weakmap_unset_dimension;
+ zend_weakmap_handlers.count_elements = zend_weakmap_count_elements;
+ zend_weakmap_handlers.get_properties_for = zend_weakmap_get_properties_for;
+ zend_weakmap_handlers.get_gc = zend_weakmap_get_gc;
+ zend_weakmap_handlers.clone_obj = zend_weakmap_clone_obj;
+ zend_weakmap_handlers.read_property = zend_weakref_no_read;
+ zend_weakmap_handlers.write_property = zend_weakref_no_write;
+ zend_weakmap_handlers.has_property = zend_weakref_no_isset;
+ zend_weakmap_handlers.unset_property = zend_weakref_no_unset;
+ zend_weakmap_handlers.get_property_ptr_ptr = zend_weakref_no_read_ptr;
}
/* }}} */
diff --git a/Zend/zend_weakrefs.h b/Zend/zend_weakrefs.h
index c8a65e2563..cf902f3dd4 100644
--- a/Zend/zend_weakrefs.h
+++ b/Zend/zend_weakrefs.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 2.00 of the Zend license, |
diff --git a/Zend/zend_weakrefs.stub.php b/Zend/zend_weakrefs.stub.php
new file mode 100644
index 0000000000..aada11bc79
--- /dev/null
+++ b/Zend/zend_weakrefs.stub.php
@@ -0,0 +1,33 @@
+<?php
+
+final class WeakReference {
+ public function __construct();
+
+ public static function create(): WeakReference;
+
+ public function get(): ?object;
+}
+
+final class WeakMap implements ArrayAccess, Countable, Traversable {
+ //public function __construct();
+
+ /**
+ * @param object $object
+ * @return mixed
+ */
+ public function offsetGet($object);
+
+ /**
+ * @param object $object
+ * @param mixed $value
+ */
+ public function offsetSet($object, $value): void;
+
+ /** @param object $object */
+ public function offsetExists($object): bool;
+
+ /** @param object $object */
+ public function offsetUnset($object): void;
+
+ public function count(): int;
+}
diff --git a/Zend/zend_weakrefs_arginfo.h b/Zend/zend_weakrefs_arginfo.h
new file mode 100644
index 0000000000..b10c1b63b5
--- /dev/null
+++ b/Zend/zend_weakrefs_arginfo.h
@@ -0,0 +1,30 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_WeakReference___construct, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_WeakReference_create, 0, 0, WeakReference, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_WeakReference_get, 0, 0, IS_OBJECT, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_WeakMap_offsetGet, 0, 0, 1)
+ ZEND_ARG_INFO(0, object)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_WeakMap_offsetSet, 0, 2, IS_VOID, 0)
+ ZEND_ARG_INFO(0, object)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_WeakMap_offsetExists, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, object)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_WeakMap_offsetUnset, 0, 1, IS_VOID, 0)
+ ZEND_ARG_INFO(0, object)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_WeakMap_count, 0, 0, IS_LONG, 0)
+ZEND_END_ARG_INFO()
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 688d36c148..b59550766d 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -15,75 +15,75 @@ jobs:
- template: azure/job.yml
parameters:
configurationName: DEBUG_NTS
- configurationParameters: '--enable-debug --disable-maintainer-zts'
+ configurationParameters: '--enable-debug --disable-zts'
- template: azure/job.yml
parameters:
configurationName: RELEASE_ZTS
- configurationParameters: '--disable-debug --enable-maintainer-zts'
+ configurationParameters: '--disable-debug --enable-zts'
- template: azure/i386/job.yml
parameters:
configurationName: I386_DEBUG_ZTS
- configurationParameters: '--enable-debug --enable-maintainer-zts'
+ configurationParameters: '--enable-debug --enable-zts'
- template: azure/macos/job.yml
parameters:
configurationName: MACOS_DEBUG_NTS
- configurationParameters: '--enable-debug --disable-maintainer-zts'
+ configurationParameters: '--enable-debug --disable-zts'
- ${{ if eq(variables['Build.Reason'], 'Schedule') }}:
- template: azure/job.yml
parameters:
configurationName: DEBUG_ZTS
- configurationParameters: '--enable-debug --enable-maintainer-zts'
+ configurationParameters: '--enable-debug --enable-zts'
- template: azure/job.yml
parameters:
configurationName: RELEASE_NTS
- configurationParameters: '--disable-debug --disable-maintainer-zts'
+ configurationParameters: '--disable-debug --disable-zts'
- template: azure/i386/job.yml
parameters:
configurationName: I386_DEBUG_NTS
- configurationParameters: '--enable-debug --disable-maintainer-zts'
+ configurationParameters: '--enable-debug --disable-zts'
- template: azure/i386/job.yml
parameters:
configurationName: I386_RELEASE_NTS
- configurationParameters: '--disable-debug --disable-maintainer-zts'
+ configurationParameters: '--disable-debug --disable-zts'
- template: azure/i386/job.yml
parameters:
configurationName: I386_RELEASE_ZTS
- configurationParameters: '--disable-debug --enable-maintainer-zts'
+ configurationParameters: '--disable-debug --enable-zts'
- template: azure/macos/job.yml
parameters:
configurationName: MACOS_DEBUG_ZTS
- configurationParameters: '--enable-debug --enable-maintainer-zts'
+ configurationParameters: '--enable-debug --enable-zts'
- template: azure/macos/job.yml
parameters:
configurationName: MACOS_RELEASE_NTS
- configurationParameters: '--disable-debug --disable-maintainer-zts'
+ configurationParameters: '--disable-debug --disable-zts'
- template: azure/macos/job.yml
parameters:
configurationName: MACOS_RELEASE_ZTS
- configurationParameters: '--disable-debug --enable-maintainer-zts'
+ configurationParameters: '--disable-debug --enable-zts'
- template: azure/job.yml
parameters:
configurationName: DEBUG_ZTS_ASAN_UBSAN
configurationParameters: >-
- --enable-debug --enable-maintainer-zts
+ --enable-debug --enable-zts
CFLAGS='-fsanitize=undefined,address -DZEND_TRACK_ARENA_ALLOC'
LDFLAGS='-fsanitize=undefined,address'
runTestsParameters: --asan
- timeoutInMinutes: 120
+ timeoutInMinutes: 150
- template: azure/msan_job.yml
parameters:
configurationName: DEBUG_ZTS_MSAN
- configurationParameters: '--enable-debug --enable-maintainer-zts'
+ configurationParameters: '--enable-debug --enable-zts'
runTestsParameters: --asan
- template: azure/community_job.yml
parameters:
configurationName: COMMUNITY
configurationParameters: >-
- --enable-debug --enable-maintainer-zts
+ --enable-debug --enable-zts
CFLAGS='-fsanitize=undefined,address -fno-sanitize-recover -DZEND_TRACK_ARENA_ALLOC'
LDFLAGS='-fsanitize=undefined,address'
- template: azure/coverage_job.yml
parameters:
configurationName: COVERAGE_DEBUG_ZTS
- configurationParameters: '--enable-debug --disable-maintainer-zts'
+ configurationParameters: '--enable-debug --disable-zts'
timeoutInMinutes: 90
diff --git a/azure/community_job.yml b/azure/community_job.yml
index f8529826a9..d169bc0dbf 100644
--- a/azure/community_job.yml
+++ b/azure/community_job.yml
@@ -46,6 +46,7 @@ jobs:
echo zend_extension=opcache.so > /etc/php.d/opcache.ini
echo opcache.enable_cli=1 >> /etc/php.d/opcache.ini
echo opcache.protect_memory=1 >> /etc/php.d/opcache.ini
+ echo opcache.jit_buffer_size=1G >> /etc/php.d/opcache.ini
displayName: 'Install Build'
- script: |
git clone https://github.com/laravel/framework.git --branch=master --depth=1
@@ -56,6 +57,8 @@ jobs:
# Avoid test using exit(), which thus leaks.
# We can use USE_TRACKED_ALLOC=1 if more of these show up.
sed -i "s/function_exists('pcntl_fork')/false/" tests/Filesystem/FilesystemTest.php
+ # Work around PHP 8 incompatibility in Doctrine
+ sed -i 's/function query()/function query($statement = null)/' vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php
php vendor/bin/phpunit
displayName: 'Test Laravel'
- script: |
@@ -63,6 +66,8 @@ jobs:
cd symfony
php7.3 /usr/bin/composer install --no-progress
php7.3 ./phpunit install
+ # Work around PHP 8 incompatibility in Doctrine
+ sed -i 's/function query()/function query($statement = null)/' vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php
export USE_ZEND_ALLOC=0
export USE_TRACKED_ALLOC=1
export ASAN_OPTIONS=exitcode=139
diff --git a/azure/i386/job.yml b/azure/i386/job.yml
index f1508b8633..abd476a024 100644
--- a/azure/i386/job.yml
+++ b/azure/i386/job.yml
@@ -10,8 +10,8 @@ jobs:
- template: apt.yml
- script: |
./buildconf --force
- export CFLAGS=-m32
- export CXXFLAGS=-m32
+ export CFLAGS="-m32 -msse2"
+ export CXXFLAGS="-m32 -msse2"
export LDFLAGS=-L/usr/lib/i386-linux-gnu
export PKG_CONFIG=/usr/bin/i686-linux-gnu-pkg-config
./configure ${{ parameters.configurationParameters }} \
@@ -90,3 +90,8 @@ jobs:
configurationName: ${{ parameters.configurationName }}
runTestsName: 'OpCache'
runTestsParameters: -d zend_extension=opcache.so
+ - template: test.yml
+ parameters:
+ configurationName: ${{ parameters.configurationName }}
+ runTestsName: 'JIT'
+ runTestsParameters: -d zend_extension=opcache.so -d opcache.jit_buffer_size=16M
diff --git a/azure/job.yml b/azure/job.yml
index 918c107118..d6e837da6b 100644
--- a/azure/job.yml
+++ b/azure/job.yml
@@ -33,3 +33,11 @@ jobs:
runTestsParameters: >-
${{ parameters.runTestsParameters }}
-d zend_extension=opcache.so
+ - template: test.yml
+ parameters:
+ configurationName: ${{ parameters.configurationName }}
+ runTestsName: 'JIT'
+ runTestsParameters: >-
+ ${{ parameters.runTestsParameters }}
+ -d zend_extension=opcache.so
+ -d opcache.jit_buffer_size=16M
diff --git a/azure/macos/job.yml b/azure/macos/job.yml
index 1a6aefd633..7fa9de5188 100644
--- a/azure/macos/job.yml
+++ b/azure/macos/job.yml
@@ -84,3 +84,8 @@ jobs:
configurationName: ${{ parameters.configurationName }}
runTestsName: 'OpCache'
runTestsParameters: -d zend_extension=opcache.so -d opcache.enable_cli=1 -d opcache.protect_memory=1
+ - template: test.yml
+ parameters:
+ configurationName: ${{ parameters.configurationName }}
+ runTestsName: 'JIT'
+ runTestsParameters: -d zend_extension=opcache.so -d opcache.enable_cli=1 -d opcache.protect_memory=1 -d opcache.jit_buffer_size=16M
diff --git a/azure/msan_job.yml b/azure/msan_job.yml
index c623f55d36..73a67509c8 100644
--- a/azure/msan_job.yml
+++ b/azure/msan_job.yml
@@ -31,6 +31,7 @@ jobs:
--disable-xmlreader \
--disable-xmlwriter \
--without-pcre-jit \
+ --disable-opcache-jit \
--enable-phpdbg \
--enable-fpm \
--with-pdo-mysql=mysqlnd \
diff --git a/build/Makefile.global b/build/Makefile.global
index 82e0d69f35..86cd287610 100644
--- a/build/Makefile.global
+++ b/build/Makefile.global
@@ -15,22 +15,22 @@ build-modules: $(PHP_MODULES) $(PHP_ZEND_EX)
build-binaries: $(PHP_BINARIES)
-libphp$(PHP_MAJOR_VERSION).la: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
- $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -rpath $(phptempdir) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@
+libphp.la: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
+ $(LIBTOOL) --mode=link --tag=disable-static $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -rpath $(phptempdir) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@
-@$(LIBTOOL) --silent --mode=install cp $@ $(phptempdir)/$@ >/dev/null 2>&1
-libs/libphp$(PHP_MAJOR_VERSION).bundle: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
- $(CC) $(MH_BUNDLE_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(PHP_GLOBAL_OBJS:.lo=.o) $(PHP_SAPI_OBJS:.lo=.o) $(PHP_FRAMEWORKS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@ && cp $@ libs/libphp$(PHP_MAJOR_VERSION).so
+libs/libphp.bundle: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
+ $(CC) $(MH_BUNDLE_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(PHP_GLOBAL_OBJS:.lo=.o) $(PHP_SAPI_OBJS:.lo=.o) $(PHP_FRAMEWORKS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@ && cp $@ libs/libphp.so
install: $(all_targets) $(install_targets)
install-sapi: $(OVERALL_TARGET)
@echo "Installing PHP SAPI module: $(PHP_SAPI)"
-@$(mkinstalldirs) $(INSTALL_ROOT)$(bindir)
- -@if test ! -r $(phptempdir)/libphp$(PHP_MAJOR_VERSION).$(SHLIB_DL_SUFFIX_NAME); then \
+ -@if test ! -r $(phptempdir)/libphp.$(SHLIB_DL_SUFFIX_NAME); then \
for i in 0.0.0 0.0 0; do \
- if test -r $(phptempdir)/libphp$(PHP_MAJOR_VERSION).$(SHLIB_DL_SUFFIX_NAME).$$i; then \
- $(LN_S) $(phptempdir)/libphp$(PHP_MAJOR_VERSION).$(SHLIB_DL_SUFFIX_NAME).$$i $(phptempdir)/libphp$(PHP_MAJOR_VERSION).$(SHLIB_DL_SUFFIX_NAME); \
+ if test -r $(phptempdir)/libphp.$(SHLIB_DL_SUFFIX_NAME).$$i; then \
+ $(LN_S) $(phptempdir)/libphp.$(SHLIB_DL_SUFFIX_NAME).$$i $(phptempdir)/libphp.$(SHLIB_DL_SUFFIX_NAME); \
break; \
fi; \
done; \
@@ -115,7 +115,7 @@ clean:
find . -name \*.la -o -name \*.a | xargs rm -f
find . -name \*.so | xargs rm -f
find . -name .libs -a -type d|xargs rm -rf
- rm -f libphp$(PHP_MAJOR_VERSION).la $(SAPI_CLI_PATH) $(SAPI_CGI_PATH) $(SAPI_LITESPEED_PATH) $(SAPI_FPM_PATH) $(OVERALL_TARGET) modules/* libs/*
+ rm -f libphp.la $(SAPI_CLI_PATH) $(SAPI_CGI_PATH) $(SAPI_LITESPEED_PATH) $(SAPI_FPM_PATH) $(OVERALL_TARGET) modules/* libs/*
distclean: clean
rm -f Makefile config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h main/internal_functions_cli.c main/internal_functions.c Zend/zend_dtrace_gen.h Zend/zend_dtrace_gen.h.bak Zend/zend_config.h
@@ -137,11 +137,26 @@ prof-clean:
find . -name \*.lo -o -name \*.o | xargs rm -f
find . -name \*.la -o -name \*.a | xargs rm -f
find . -name \*.so | xargs rm -f
- rm -f libphp$(PHP_MAJOR_VERSION).la $(SAPI_CLI_PATH) $(SAPI_CGI_PATH) $(SAPI_LITESPEED_PATH) $(SAPI_FPM_PATH) $(OVERALL_TARGET) modules/* libs/*
+ rm -f libphp.la $(SAPI_CLI_PATH) $(SAPI_CGI_PATH) $(SAPI_LITESPEED_PATH) $(SAPI_FPM_PATH) $(OVERALL_TARGET) modules/* libs/*
prof-use:
CCACHE_DISABLE=1 $(MAKE) PROF_FLAGS=-fprofile-use all
+# olny php above 7.1.0 supports nullable return type
+%_arginfo.h: %.stub.php
+ @if test -e "$(top_srcdir)/scripts/dev/gen_stub.php"; then \
+ if test ! -z "$(PHP_EXECUTABLE)" && test -x "$(PHP_EXECUTABLE)"; then \
+ $(PHP_EXECUTABLE) $(top_srcdir)/scripts/dev/gen_stub.php $<; \
+ elif type php >/dev/null 2>/dev/null; then \
+ if test `php -v | head -n1 | cut -d" " -f 2 | sed "s/$$/\n7.0.99/" | sort -rV | head -n1` != "7.0.99"; then \
+ php $(top_srcdir)/scripts/dev/gen_stub.php $<; \
+ fi; \
+ fi; \
+ fi;
+
+# As we don't track includes, this is just a heuristic
+%.c: %_arginfo.h
+ @touch $@
.PHONY: all clean install distclean test prof-gen prof-clean prof-use
.NOEXPORT:
diff --git a/build/libtool.m4 b/build/libtool.m4
index f7f5164292..577dad4cbe 100644
--- a/build/libtool.m4
+++ b/build/libtool.m4
@@ -945,6 +945,7 @@ else
#endif
#include <stdio.h>
+#include <stdlib.h>
#ifdef RTLD_GLOBAL
# define LT_DLGLOBAL RTLD_GLOBAL
@@ -978,10 +979,6 @@ else
# endif
#endif
-#ifdef __cplusplus
-extern "C" void exit (int);
-#endif
-
void fnord() { int i=42;}
int main ()
{
diff --git a/build/php.m4 b/build/php.m4
index 7392876478..8cdfb4da51 100644
--- a/build/php.m4
+++ b/build/php.m4
@@ -81,7 +81,7 @@ AC_DEFUN([PHP_DEFINE],[
dnl
dnl PHP_SUBST(varname)
dnl
-dnl Adds variable with it's value into Makefile, e.g.:
+dnl Adds variable with its value into Makefile, e.g.:
dnl CC = gcc
dnl
AC_DEFUN([PHP_SUBST],[
@@ -89,14 +89,14 @@ AC_DEFUN([PHP_SUBST],[
])
dnl
-dnl PHP_SUBST_OLD(varname)
+dnl PHP_SUBST_OLD(varname, [VALUE])
dnl
dnl Same as PHP_SUBST() but also substitutes all @VARNAME@ instances in every
dnl file passed to AC_OUTPUT.
dnl
AC_DEFUN([PHP_SUBST_OLD],[
- PHP_SUBST($1)
- AC_SUBST($1)
+ AC_SUBST($@)
+ PHP_SUBST([$1])
])
dnl
@@ -745,7 +745,7 @@ dnl
dnl PHP_BUILD_THREAD_SAFE
dnl
AC_DEFUN([PHP_BUILD_THREAD_SAFE],[
- enable_maintainer_zts=yes
+ enable_zts=yes
if test "$pthreads_working" != "yes"; then
AC_MSG_ERROR([ZTS currently requires working POSIX threads. We were unable to verify that your system supports Pthreads.])
fi
@@ -768,7 +768,7 @@ dnl PHP_BUILD_SHARED
dnl
AC_DEFUN([PHP_BUILD_SHARED],[
PHP_BUILD_PROGRAM
- OVERALL_TARGET=libphp[]$PHP_MAJOR_VERSION[.la]
+ OVERALL_TARGET=libphp.la
php_sapi_module=shared
php_c_pre=$shared_c_pre
@@ -785,7 +785,7 @@ dnl PHP_BUILD_STATIC
dnl
AC_DEFUN([PHP_BUILD_STATIC],[
PHP_BUILD_PROGRAM
- OVERALL_TARGET=libphp[]$PHP_MAJOR_VERSION[.la]
+ OVERALL_TARGET=libphp.la
php_sapi_module=static
])
@@ -794,7 +794,7 @@ dnl PHP_BUILD_BUNDLE
dnl
AC_DEFUN([PHP_BUILD_BUNDLE],[
PHP_BUILD_PROGRAM
- OVERALL_TARGET=libs/libphp[]$PHP_MAJOR_VERSION[.bundle]
+ OVERALL_TARGET=libs/libphp.bundle
php_sapi_module=static
])
@@ -851,7 +851,7 @@ AC_DEFUN([PHP_SHARED_MODULE],[
\$(LIBTOOL) --mode=install cp $3/$1.$suffix \$(phplibdir)
$3/$1.$suffix: \$($2) \$(translit($1,a-z_-,A-Z__)_SHARED_DEPENDENCIES)
- \$(LIBTOOL) --mode=link ifelse($4,,[\$(CC)],[\$(CXX)]) \$(COMMON_FLAGS) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(LDFLAGS) $additional_flags -o [\$]@ -export-dynamic -avoid-version -prefer-pic -module -rpath \$(phplibdir) \$(EXTRA_LDFLAGS) \$($2) \$(translit($1,a-z_-,A-Z__)_SHARED_LIBADD)
+ \$(LIBTOOL) --mode=link --tag=disable-static ifelse($4,,[\$(CC)],[\$(CXX)]) \$(COMMON_FLAGS) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(LDFLAGS) $additional_flags -o [\$]@ -export-dynamic -avoid-version -prefer-pic -module -rpath \$(phplibdir) \$(EXTRA_LDFLAGS) \$($2) \$(translit($1,a-z_-,A-Z__)_SHARED_LIBADD)
EOF
])
@@ -1120,7 +1120,7 @@ AC_CACHE_CHECK(for type of reentrant time-related functions, ac_cv_time_r_type,[
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <time.h>
-main() {
+int main() {
char buf[27];
struct tm t;
time_t old = 0;
@@ -1136,7 +1136,7 @@ return (1);
],[
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <time.h>
-main() {
+int main() {
struct tm t, *s;
time_t old = 0;
char buf[27], *p;
@@ -1175,8 +1175,9 @@ AC_DEFUN([PHP_DOES_PWRITE_WORK],[
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
+#include <stdlib.h>
$1
- main() {
+ int main() {
int fd = open("conftest_in", O_WRONLY|O_CREAT, 0600);
if (fd < 0) exit(1);
@@ -1208,8 +1209,9 @@ AC_DEFUN([PHP_DOES_PREAD_WORK],[
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
+#include <stdlib.h>
$1
- main() {
+ int main() {
char buf[3];
int fd = open("conftest_in", O_RDONLY);
if (fd < 0) exit(1);
@@ -1462,6 +1464,7 @@ dnl Even newer glibcs have a different seeker definition.
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#define _GNU_SOURCE
#include <stdio.h>
+#include <stdlib.h>
struct cookiedata {
__off64_t pos;
@@ -1478,7 +1481,7 @@ int seeker(void *cookie, __off64_t *position, int whence)
cookie_io_functions_t funcs = {reader, writer, seeker, closer};
-main() {
+int main() {
struct cookiedata g = { 0 };
FILE *fp = fopencookie(&g, "r", funcs);
@@ -1597,7 +1600,7 @@ AC_DEFUN([PHP_CHECK_FUNC_LIB],[
if test "$found" = "yes"; then
ac_libs=$LIBS
LIBS="$LIBS -l$2"
- AC_RUN_IFELSE([AC_LANG_SOURCE([[main() { return (0); }]])],[found=yes],[found=no],[found=no])
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[int main() { return (0); }]])],[found=yes],[found=no],[found=no])
LIBS=$ac_libs
fi
@@ -1812,6 +1815,7 @@ AC_DEFUN([PHP_PROG_BISON], [
done
if test "$php_bison_check" != "invalid"; then
+ PHP_SUBST_OLD([YFLAGS], [-Wall])
AC_MSG_RESULT([$php_bison_version (ok)])
else
AC_MSG_RESULT([$php_bison_version])
@@ -2277,7 +2281,7 @@ AC_DEFUN([PHP_TEST_WRITE_STDOUT],[
#define TEXT "This is the test message -- "
-main()
+int main()
{
int n;
diff --git a/configure.ac b/configure.ac
index 501730ba47..1c1964a9ee 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,7 +17,7 @@ dnl Basic autoconf initialization, generation of config.nice.
dnl ----------------------------------------------------------------------------
AC_PREREQ([2.68])
-AC_INIT([PHP],[7.4.3-dev],[https://bugs.php.net],[php],[https://www.php.net])
+AC_INIT([PHP],[8.0.0-dev],[https://bugs.php.net],[php],[https://www.php.net])
AC_CONFIG_SRCDIR([main/php_version.h])
AC_CONFIG_AUX_DIR([build])
AC_PRESERVE_HELP_ORDER
@@ -61,48 +61,6 @@ AH_BOTTOM([
#include <string.h>
-#if defined(__cplusplus) && __cplusplus >= 201103L
-extern "C++" {
-#include <cmath>
-#define zend_isnan std::isnan
-#define zend_isinf std::isinf
-#define zend_finite std::isfinite
-}
-#else
-#include <math.h>
-
-#ifndef zend_isnan
-#if HAVE_DECL_ISNAN
-#define zend_isnan(a) isnan(a)
-#elif defined(HAVE_FPCLASS)
-#define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))
-#else
-#define zend_isnan(a) ((a) != (a))
-#endif
-#endif
-
-#if HAVE_DECL_ISINF
-#define zend_isinf(a) isinf(a)
-#elif defined(INFINITY)
-/* Might not work, but is required by ISO C99 */
-#define zend_isinf(a) (((a)==INFINITY || (a)==-INFINITY)?1:0)
-#elif defined(HAVE_FPCLASS)
-#define zend_isinf(a) ((fpclass(a) == FP_PINF) || (fpclass(a) == FP_NINF))
-#else
-#define zend_isinf(a) 0
-#endif
-
-#if HAVE_DECL_ISFINITE
-#define zend_finite(a) isfinite(a)
-#elif defined(HAVE_FINITE)
-#define zend_finite(a) finite(a)
-#elif defined(fpclassify)
-#define zend_finite(a) ((fpclassify((a))!=FP_INFINITE&&fpclassify((a))!=FP_NAN)?1:0)
-#else
-#define zend_finite(a) (zend_isnan(a) ? 0 : zend_isinf(a) ? 0 : 1)
-#endif
-
-#endif
#endif /* ifndef ZEND_ACCONFIG_H_NO_C_PROTOS */
#endif /* PHP_CONFIG_H */
@@ -178,6 +136,7 @@ PKG_PROG_PKG_CONFIG
AC_PROG_CC([cc gcc])
PHP_DETECT_ICC
PHP_DETECT_SUNCC
+AC_PROG_CC_C99
AC_PROG_CPP
AC_USE_SYSTEM_EXTENSIONS
AC_PROG_LN_S
@@ -323,9 +282,9 @@ dnl SAPI configuration.
dnl ----------------------------------------------------------------------------
dnl Paths to the targets are relative to the build directory.
-SAPI_SHARED=libs/libphp[]$PHP_MAJOR_VERSION[.]$SHLIB_DL_SUFFIX_NAME
-SAPI_STATIC=libs/libphp[]$PHP_MAJOR_VERSION[.a]
-SAPI_LIBTOOL=libphp[]$PHP_MAJOR_VERSION[.la]
+SAPI_SHARED=libs/libphp.[]$SHLIB_DL_SUFFIX_NAME
+SAPI_STATIC=libs/libphp.a
+SAPI_LIBTOOL=libphp.la
PHP_CONFIGURE_PART(Configuring SAPI modules)
@@ -349,7 +308,7 @@ if test -z "$PHP_INSTALLED_SAPIS"; then
fi
dnl Force ZTS.
-if test "$enable_maintainer_zts" = "yes"; then
+if test "$enable_zts" = "yes"; then
dnl Add pthreads linker and compiler flags.
if test -n "$ac_cv_pthreads_lib"; then
LIBS="$LIBS -l$ac_cv_pthreads_lib"
@@ -412,7 +371,6 @@ dnl Then headers.
dnl ----------------------------------------------------------------------------
dnl QNX requires unix.h to allow functions in libunix to work properly.
-dnl locale.h is checked for supporting old code in extensions such as imagick.
AC_CHECK_HEADERS([ \
inttypes.h \
stdint.h \
@@ -430,7 +388,6 @@ fcntl.h \
grp.h \
ieeefp.h \
langinfo.h \
-locale.h \
malloc.h \
monetary.h \
netdb.h \
@@ -635,7 +592,6 @@ statfs \
statvfs \
std_syslog \
strcasecmp \
-strfmon \
strnlen \
strptime \
strtok_r \
@@ -663,6 +619,8 @@ AC_CACHE_CHECK([for getaddrinfo], ac_cv_func_getaddrinfo,
[[struct addrinfo *g,h;g=&h;getaddrinfo("","",g,&g);]])],[AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <netdb.h>
#include <sys/types.h>
+#include <string.h>
+#include <stdlib.h>
#ifndef AF_INET
# include <sys/socket.h>
#endif
@@ -848,6 +806,18 @@ else
ZEND_DEBUG=no
fi
+PHP_ARG_ENABLE([debug-assertions],
+ [whether to enable debug assertions in release mode],
+ [AS_HELP_STRING([--enable-debug-assertions],
+ [Compile with debug assertions even in release mode])],
+ [no],
+ [no])
+
+if test "$PHP_DEBUG_ASSERTIONS" = "yes"; then
+ PHP_DEBUG=1
+ ZEND_DEBUG=yes
+fi
+
PHP_ARG_ENABLE([rtld-now],
[whether to dlopen extensions with RTLD_NOW instead of RTLD_LAZY],
[AS_HELP_STRING([--enable-rtld-now],
@@ -1091,7 +1061,9 @@ enable_static=yes
case $php_sapi_module in
shared[)]
- enable_static=no
+ if test "$PHP_CGI" = "no" && test "$PHP_CLI" = "no" && test "$PHP_FPM" = "no" && test "$PHP_LITESPEED" = "no" && test "$PHP_PHPDBG" = "no"; then
+ enable_static=no
+ fi
case $with_pic in
yes)
standard_libtool_flag='-prefer-pic'
@@ -1180,7 +1152,7 @@ LIBZEND_BASIC_CHECKS
LIBZEND_DLSYM_CHECK
LIBZEND_OTHER_CHECKS
-if test "$ZEND_MAINTAINER_ZTS" = "yes"; then
+if test "$ZEND_ZTS" = "yes"; then
AC_DEFINE(ZTS,1,[ ])
PHP_THREAD_SAFETY=yes
else
@@ -1201,7 +1173,7 @@ unset LIBS LDFLAGS
PHP_HELP_SEPARATOR([TSRM:])
PHP_CONFIGURE_PART(Configuring TSRM)
if test "$PHP_THREAD_SAFETY" = "yes"; then
- TSRM_THREADS_CHECKS
+ TSRM_CHECK_PTHREADS
fi
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LDFLAGS"
@@ -1249,7 +1221,7 @@ if test -z "$EXTENSION_DIR"; then
else
part1=no-debug
fi
- if test "$enable_maintainer_zts" = "yes"; then
+ if test "$enable_zts" = "yes"; then
part2=zts
else
part2=non-zts
@@ -1257,7 +1229,7 @@ if test -z "$EXTENSION_DIR"; then
extbasedir=$part1-$part2-$extbasedir
EXTENSION_DIR=$libdir/extensions/$extbasedir
else
- if test "$enable_maintainer_zts" = "yes"; then
+ if test "$enable_zts" = "yes"; then
extbasedir=$extbasedir-zts
fi
@@ -1506,7 +1478,7 @@ PHP_ADD_SOURCES(Zend, \
zend_iterators.c zend_interfaces.c zend_exceptions.c zend_strtod.c zend_gc.c \
zend_closures.c zend_weakrefs.c zend_float.c zend_string.c zend_signal.c zend_generators.c \
zend_virtual_cwd.c zend_ast.c zend_objects.c zend_object_handlers.c zend_objects_API.c \
- zend_default_classes.c zend_inheritance.c zend_smart_str.c zend_cpuinfo.c, \
+ zend_default_classes.c zend_inheritance.c zend_smart_str.c zend_cpuinfo.c zend_gdb.c, \
-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
dnl Selectively disable optimization due to high RAM usage during compiling the
@@ -1592,7 +1564,7 @@ cat <<X
| |
| You have built PHP for Apache's current non-threaded MPM. |
| If you change Apache to use a threaded MPM you must reconfigure |
-| PHP with --enable-maintainer-zts |
+| PHP with --enable-zts |
X
fi
fi
diff --git a/docs/parameter-parsing-api.md b/docs/parameter-parsing-api.md
index d4d24b1dbf..e038a20dee 100644
--- a/docs/parameter-parsing-api.md
+++ b/docs/parameter-parsing-api.md
@@ -75,7 +75,6 @@ f - function or array containing php method call info (returned as
h - array (returned as HashTable*)
H - array or HASH_OF(object) (returned as HashTable*)
l - long (zend_long)
-L - long, limits out-of-range numbers to LONG_MAX/LONG_MIN (zend_long, ZEND_LONG_MAX/ZEND_LONG_MIN)
o - object of any type (zval*)
O - object of specific type given by class entry (zval*, zend_class_entry)
p - valid path (string without null bytes in the middle) and its length (char*, size_t)
diff --git a/docs/release-process.md b/docs/release-process.md
index cb04009060..abb7711b73 100644
--- a/docs/release-process.md
+++ b/docs/release-process.md
@@ -338,6 +338,9 @@
php-announce@ is its own completely separate email. This is to make sure
that replies to the announcement on php-general@ or internals@ will not
accidentally hit the php-announce@ mailinglist.
+
+11. Post tweet with release announcement and link to news article on php.net
+ ([@official_php](https://twitter.com/official_php))
## Re-releasing the same version (or -pl)
@@ -417,6 +420,10 @@
2. Timely get used to the differences in preparing and announcing a stable
release.
+ 3. Before releasing X.Y.0, merge the NEWS entries of the pre-releases, so that
+ there is only a single section about PHP X.Y.0, instead of individual
+ sections for each pre-release.
+
## Prime the selection of the Release Managers of the next version
1. About three months before the scheduled release of the first alpha of the
@@ -439,6 +446,8 @@
`gpg --fingerprint "$USER@php.net"`. Let one or more of the previous RMs
sign your key. Publish your public key to pgp.mit.edu with:
`gpg --keyserver pgp.mit.edu --send-keys $KEYID`
+ Add new keys in the php-keyring.gpg in distribution repository using:
+ `gpg2 --export --export-options export-minimal --armor <all RM keys>`
3. Request karma to edit `main/php_version.h` and `Zend/zend.h`. Possibly karma
for other restricted parts of php-src might come in question. To edit
diff --git a/docs/unix-build-system.md b/docs/unix-build-system.md
index c576b5e075..4df945a62b 100644
--- a/docs/unix-build-system.md
+++ b/docs/unix-build-system.md
@@ -108,7 +108,7 @@ regarding how PHP is supposed to be built (shared module, program, etc).
For example for APXS:
```m4
-PHP_SELECT_SAPI(apache, shared, sapi_apache.c mod_php7.c php_apache.c)
+PHP_SELECT_SAPI(apache, shared, sapi_apache.c mod_php.c php_apache.c)
```
## General info
diff --git a/ext/bcmath/bcmath.c b/ext/bcmath/bcmath.c
index ecfce4f54d..5d0d47f7c0 100644
--- a/ext/bcmath/bcmath.c
+++ b/ext/bcmath/bcmath.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -25,6 +23,8 @@
#if HAVE_BCMATH
#include "php_ini.h"
+#include "zend_exceptions.h"
+#include "bcmath_arginfo.h"
#include "ext/standard/info.h"
#include "php_bcmath.h"
#include "libbcmath/src/bcmath.h"
@@ -33,67 +33,6 @@ ZEND_DECLARE_MODULE_GLOBALS(bcmath)
static PHP_GINIT_FUNCTION(bcmath);
static PHP_GSHUTDOWN_FUNCTION(bcmath);
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_bcadd, 0, 0, 2)
- ZEND_ARG_INFO(0, left_operand)
- ZEND_ARG_INFO(0, right_operand)
- ZEND_ARG_INFO(0, scale)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_bcsub, 0, 0, 2)
- ZEND_ARG_INFO(0, left_operand)
- ZEND_ARG_INFO(0, right_operand)
- ZEND_ARG_INFO(0, scale)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_bcmul, 0, 0, 2)
- ZEND_ARG_INFO(0, left_operand)
- ZEND_ARG_INFO(0, right_operand)
- ZEND_ARG_INFO(0, scale)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_bcdiv, 0, 0, 2)
- ZEND_ARG_INFO(0, left_operand)
- ZEND_ARG_INFO(0, right_operand)
- ZEND_ARG_INFO(0, scale)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_bcmod, 0, 0, 2)
- ZEND_ARG_INFO(0, left_operand)
- ZEND_ARG_INFO(0, right_operand)
- ZEND_ARG_INFO(0, scale)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_bcpowmod, 0, 0, 3)
- ZEND_ARG_INFO(0, x)
- ZEND_ARG_INFO(0, y)
- ZEND_ARG_INFO(0, mod)
- ZEND_ARG_INFO(0, scale)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_bcpow, 0, 0, 2)
- ZEND_ARG_INFO(0, x)
- ZEND_ARG_INFO(0, y)
- ZEND_ARG_INFO(0, scale)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_bcsqrt, 0, 0, 1)
- ZEND_ARG_INFO(0, operand)
- ZEND_ARG_INFO(0, scale)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_bccomp, 0, 0, 2)
- ZEND_ARG_INFO(0, left_operand)
- ZEND_ARG_INFO(0, right_operand)
- ZEND_ARG_INFO(0, scale)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_bcscale, 0, 0, 0)
- ZEND_ARG_INFO(0, scale)
-ZEND_END_ARG_INFO()
-
-/* }}} */
-
static const zend_function_entry bcmath_functions[] = {
PHP_FE(bcadd, arginfo_bcadd)
PHP_FE(bcsub, arginfo_bcsub)
@@ -346,7 +285,7 @@ PHP_FUNCTION(bcdiv)
RETVAL_STR(bc_num2str_ex(result, scale));
break;
case -1: /* division by zero */
- php_error_docref(NULL, E_WARNING, "Division by zero");
+ zend_throw_exception_ex(zend_ce_division_by_zero_error, 0, "Division by zero");
break;
}
@@ -388,7 +327,7 @@ PHP_FUNCTION(bcmod)
RETVAL_STR(bc_num2str_ex(result, scale));
break;
case -1:
- php_error_docref(NULL, E_WARNING, "Division by zero");
+ zend_throw_exception_ex(zend_ce_division_by_zero_error, 0, "Modulo by zero");
break;
}
@@ -400,10 +339,10 @@ PHP_FUNCTION(bcmod)
/* }}} */
/* {{{ proto string bcpowmod(string x, string y, string mod [, int scale])
- Returns the value of an arbitrary precision number raised to the power of another reduced by a modulous */
+ Returns the value of an arbitrary precision number raised to the power of another reduced by a modulus */
PHP_FUNCTION(bcpowmod)
{
- zend_string *left, *right, *modulous;
+ zend_string *left, *right, *modulus;
bc_num first, second, mod, result;
zend_long scale = BCG(bc_precision);
int scale_int;
@@ -411,7 +350,7 @@ PHP_FUNCTION(bcpowmod)
ZEND_PARSE_PARAMETERS_START(3, 4)
Z_PARAM_STR(left)
Z_PARAM_STR(right)
- Z_PARAM_STR(modulous)
+ Z_PARAM_STR(modulus)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(scale)
ZEND_PARSE_PARAMETERS_END();
@@ -422,7 +361,7 @@ PHP_FUNCTION(bcpowmod)
bc_init_num(&result);
php_str2num(&first, ZSTR_VAL(left));
php_str2num(&second, ZSTR_VAL(right));
- php_str2num(&mod, ZSTR_VAL(modulous));
+ php_str2num(&mod, ZSTR_VAL(modulus));
scale_int = (int) ((int)scale < 0 ? 0 : scale);
@@ -500,7 +439,7 @@ PHP_FUNCTION(bcsqrt)
if (bc_sqrt (&result, scale) != 0) {
RETVAL_STR(bc_num2str_ex(result, scale));
} else {
- php_error_docref(NULL, E_WARNING, "Square root of negative number");
+ zend_value_error("Square root of negative number");
}
bc_free_num(&result);
diff --git a/ext/bcmath/bcmath.stub.php b/ext/bcmath/bcmath.stub.php
new file mode 100644
index 0000000000..0a975352bb
--- /dev/null
+++ b/ext/bcmath/bcmath.stub.php
@@ -0,0 +1,21 @@
+<?php
+
+function bcadd(string $left_operand, string $right_operand, int $scale = UNKNOWN): string {}
+
+function bcsub(string $left_operand, string $right_operand, int $scale = UNKNOWN): string {}
+
+function bcmul(string $left_operand, string $right_operand, int $scale = UNKNOWN): string {}
+
+function bcdiv(string $dividend, string $divisor, int $scale = UNKNOWN): string {}
+
+function bcmod(string $dividend, string $divisor, int $scale = UNKNOWN): string {}
+
+function bcpowmod(string $base, string $exponent, string $modulus, int $scale = UNKNOWN): string|false {}
+
+function bcpow(string $base, string $exponent, int $scale = UNKNOWN): string {}
+
+function bcsqrt(string $operand, int $scale = UNKNOWN): string {}
+
+function bccomp(string $left_operand, string $right_operand, int $scale = UNKNOWN): int {}
+
+function bcscale(int $scale = UNKNOWN): int {}
diff --git a/ext/bcmath/bcmath_arginfo.h b/ext/bcmath/bcmath_arginfo.h
new file mode 100644
index 0000000000..dd246518dc
--- /dev/null
+++ b/ext/bcmath/bcmath_arginfo.h
@@ -0,0 +1,47 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_bcadd, 0, 2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, left_operand, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, right_operand, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, scale, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_bcsub arginfo_bcadd
+
+#define arginfo_bcmul arginfo_bcadd
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_bcdiv, 0, 2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, dividend, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, divisor, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, scale, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_bcmod arginfo_bcdiv
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_bcpowmod, 0, 3, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, base, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, exponent, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, modulus, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, scale, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_bcpow, 0, 2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, base, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, exponent, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, scale, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_bcsqrt, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, operand, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, scale, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_bccomp, 0, 2, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, left_operand, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, right_operand, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, scale, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_bcscale, 0, 0, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, scale, IS_LONG, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/bcmath/libbcmath/src/init.c b/ext/bcmath/libbcmath/src/init.c
index a125947a3e..676076f89d 100644
--- a/ext/bcmath/libbcmath/src/init.c
+++ b/ext/bcmath/libbcmath/src/init.c
@@ -82,7 +82,7 @@ _bc_free_num_ex (num, persistent)
}
-/* Intitialize the number package! */
+/* Initialize the number package! */
void
bc_init_numbers (void)
diff --git a/ext/bcmath/libbcmath/src/raise.c b/ext/bcmath/libbcmath/src/raise.c
index e00a62e215..700a50f50c 100644
--- a/ext/bcmath/libbcmath/src/raise.c
+++ b/ext/bcmath/libbcmath/src/raise.c
@@ -54,10 +54,10 @@ bc_raise (bc_num num1, bc_num num2, bc_num *result, int scale)
/* Check the exponent for scale digits and convert to a long. */
if (num2->n_scale != 0)
- php_error_docref (NULL, E_WARNING, "non-zero scale in exponent");
+ php_error_docref (NULL, E_WARNING, "Non-zero scale in exponent");
exponent = bc_num2long (num2);
if (exponent == 0 && (num2->n_len > 1 || num2->n_value[0] != 0))
- php_error_docref (NULL, E_WARNING, "exponent too large");
+ php_error_docref (NULL, E_WARNING, "Exponent too large");
/* Special case if exponent is a zero. */
if (exponent == 0)
diff --git a/ext/bcmath/libbcmath/src/raisemod.c b/ext/bcmath/libbcmath/src/raisemod.c
index 58f9532545..2865903940 100644
--- a/ext/bcmath/libbcmath/src/raisemod.c
+++ b/ext/bcmath/libbcmath/src/raisemod.c
@@ -79,21 +79,21 @@ bc_raisemod (bc_num base, bc_num expo, bc_num mod, bc_num *result, int scale)
/* Check the base for scale digits. */
if (power->n_scale != 0)
{
- php_error_docref (NULL, E_WARNING, "non-zero scale in base");
+ php_error_docref (NULL, E_WARNING, "Non-zero scale in base");
_bc_truncate (&power);
}
/* Check the exponent for scale digits. */
if (exponent->n_scale != 0)
{
- php_error_docref (NULL, E_WARNING, "non-zero scale in exponent");
+ php_error_docref (NULL, E_WARNING, "Non-zero scale in exponent");
_bc_truncate (&exponent);
}
/* Check the modulus for scale digits. */
if (modulus->n_scale != 0)
{
- php_error_docref (NULL, E_WARNING, "non-zero scale in modulus");
+ php_error_docref (NULL, E_WARNING, "Non-zero scale in modulus");
_bc_truncate (&modulus);
}
diff --git a/ext/bcmath/php_bcmath.h b/ext/bcmath/php_bcmath.h
index 375513bc92..5c97780ead 100644
--- a/ext/bcmath/php_bcmath.h
+++ b/ext/bcmath/php_bcmath.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/bcmath/tests/bcdiv_error1.phpt b/ext/bcmath/tests/bcdiv_error1.phpt
index c69d36bb9c..a89ae98cfb 100644
--- a/ext/bcmath/tests/bcdiv_error1.phpt
+++ b/ext/bcmath/tests/bcdiv_error1.phpt
@@ -8,7 +8,11 @@ antoni@solucionsinternet.com
<?php if(!extension_loaded("bcmath")) print "skip"; ?>
--FILE--
<?php
-echo bcdiv('10.99', '0');
+try {
+ bcdiv('10.99', '0');
+} catch (DivisionByZeroError $ex) {
+ echo $ex->getMessage(), PHP_EOL;
+}
?>
---EXPECTF--
-Warning: bcdiv(): Division by zero in %s.php on line %d
+--EXPECT--
+Division by zero
diff --git a/ext/bcmath/tests/bcmod_error2.phpt b/ext/bcmath/tests/bcmod_error2.phpt
index 714615d7d1..c4d49486b3 100644
--- a/ext/bcmath/tests/bcmod_error2.phpt
+++ b/ext/bcmath/tests/bcmod_error2.phpt
@@ -6,7 +6,11 @@ bcmod() - mod by 0
bcmath.scale=0
--FILE--
<?php
-echo bcmod("10", "0");
+try {
+ bcmod("10", "0");
+} catch (DivisionByZeroError $ex) {
+ echo $ex->getMessage(), PHP_EOL;
+}
?>
---EXPECTF--
-Warning: bcmod(): Division by zero in %s on line %d
+--EXPECT--
+Modulo by zero
diff --git a/ext/bcmath/tests/bcpow_error1.phpt b/ext/bcmath/tests/bcpow_error1.phpt
index d3189f062a..822b70eb86 100644
--- a/ext/bcmath/tests/bcpow_error1.phpt
+++ b/ext/bcmath/tests/bcpow_error1.phpt
@@ -8,8 +8,6 @@ if (!extension_loaded('bcmath')) die('skip bcmath extension is not available');
<?php
var_dump(bcpow('1', '1.1', 2));
?>
-===DONE===
--EXPECTF--
-Warning: bcpow(): non-zero scale in exponent in %s on line %d
+Warning: bcpow(): Non-zero scale in exponent in %s on line %d
string(4) "1.00"
-===DONE===
diff --git a/ext/bcmath/tests/bcpow_error2.phpt b/ext/bcmath/tests/bcpow_error2.phpt
index 49fd0b88d3..95c3f80b08 100644
--- a/ext/bcmath/tests/bcpow_error2.phpt
+++ b/ext/bcmath/tests/bcpow_error2.phpt
@@ -8,8 +8,6 @@ if (!extension_loaded('bcmath')) die('skip bcmath extension is not available');
<?php
var_dump(bcpow('0', '9223372036854775808', 2));
?>
-===DONE===
--EXPECTF--
-Warning: bcpow(): exponent too large in %s on line %d
+Warning: bcpow(): Exponent too large in %s on line %d
string(4) "1.00"
-===DONE===
diff --git a/ext/bcmath/tests/bcsqrt_error1.phpt b/ext/bcmath/tests/bcsqrt_error1.phpt
index 1f213dbc82..bbc69f3952 100644
--- a/ext/bcmath/tests/bcsqrt_error1.phpt
+++ b/ext/bcmath/tests/bcsqrt_error1.phpt
@@ -7,7 +7,11 @@ antoni@solucionsinternet.com
<?php if(!extension_loaded("bcmath")) print "skip"; ?>
--FILE--
<?php
-echo bcsqrt('-9');
+try {
+ bcsqrt('-9');
+} catch (ValueError $ex) {
+ echo $ex->getMessage(), PHP_EOL;
+}
?>
---EXPECTF--
-Warning: bcsqrt(): Square root of negative number in %s.php on line %d
+--EXPECT--
+Square root of negative number
diff --git a/ext/bcmath/tests/bug.66364.phpt b/ext/bcmath/tests/bug.66364.phpt
index 564f40e6da..08777c5f59 100644
--- a/ext/bcmath/tests/bug.66364.phpt
+++ b/ext/bcmath/tests/bug.66364.phpt
@@ -8,7 +8,5 @@ if (!extension_loaded('bcmath')) die('skip bcmath extension not available');
<?php
var_dump(bcmul('0.3', '0.2', 4));
?>
-===DONE===
--EXPECT--
string(6) "0.0600"
-===DONE===
diff --git a/ext/bcmath/tests/bug44995.phpt b/ext/bcmath/tests/bug44995.phpt
index 6eb591f92b..9758022225 100644
--- a/ext/bcmath/tests/bug44995.phpt
+++ b/ext/bcmath/tests/bug44995.phpt
@@ -9,8 +9,6 @@ if (!extension_loaded('bcmath')) die('skip bcmath extension not available');
var_dump(bcpowmod('4', '4', '3', 1));
var_dump(bcpowmod('3234', '32345', '22345', 1));
?>
-===DONE===
--EXPECT--
string(3) "1.0"
string(7) "17334.0"
-===DONE===
diff --git a/ext/bcmath/tests/bug46781.phpt b/ext/bcmath/tests/bug46781.phpt
index caffe83860..d9e4fe5111 100644
--- a/ext/bcmath/tests/bug46781.phpt
+++ b/ext/bcmath/tests/bug46781.phpt
@@ -9,8 +9,6 @@ if (!extension_loaded('bcmath')) die('skip bcmath extension is not available');
var_dump(bcadd('-0.0', '-0.0', 1));
var_dump(bccomp('-0.0', '0', 1));
?>
-===DONE===
--EXPECT--
string(3) "0.0"
int(0)
-===DONE===
diff --git a/ext/bcmath/tests/bug54598.phpt b/ext/bcmath/tests/bug54598.phpt
index 6ccd61a2d0..5f3337fadc 100644
--- a/ext/bcmath/tests/bug54598.phpt
+++ b/ext/bcmath/tests/bug54598.phpt
@@ -9,8 +9,6 @@ if (!extension_loaded('bcmath')) die('skip bcmath extension is not available');
var_dump(bcpowmod(5, 0, 1));
var_dump(bcpowmod(5, 0, 1, 3));
?>
-===DONE===
--EXPECT--
string(1) "0"
string(5) "0.000"
-===DONE===
diff --git a/ext/bcmath/tests/bug72093.phpt b/ext/bcmath/tests/bug72093.phpt
index 4295384a30..235a4e04a3 100644
--- a/ext/bcmath/tests/bug72093.phpt
+++ b/ext/bcmath/tests/bug72093.phpt
@@ -12,5 +12,5 @@ var_dump(bcpowmod(1, 1.2, 1, 1));
--EXPECTF--
string(1) "1"
-Warning: bcpowmod(): non-zero scale in exponent in %s on line %d
+Warning: bcpowmod(): Non-zero scale in exponent in %s on line %d
string(3) "0.0"
diff --git a/ext/bcmath/tests/bug75178.phpt b/ext/bcmath/tests/bug75178.phpt
index e7661755ad..2b7ab4b2c6 100644
--- a/ext/bcmath/tests/bug75178.phpt
+++ b/ext/bcmath/tests/bug75178.phpt
@@ -9,11 +9,9 @@ if (!extension_loaded('bcmath')) die('skip bcmath extension is not available');
var_dump(bcpowmod('4.1', '4', '3', 3));
var_dump(bcpowmod('4', '4', '3.1', 3));
?>
-===DONE===
--EXPECTF--
-Warning: bcpowmod(): non-zero scale in base in %s on line %d
+Warning: bcpowmod(): Non-zero scale in base in %s on line %d
string(5) "1.000"
-Warning: bcpowmod(): non-zero scale in modulus in %s on line %d
+Warning: bcpowmod(): Non-zero scale in modulus in %s on line %d
string(5) "1.000"
-===DONE===
diff --git a/ext/bcmath/tests/scale.phpt b/ext/bcmath/tests/scale.phpt
index d49e530511..e2e65cab22 100644
--- a/ext/bcmath/tests/scale.phpt
+++ b/ext/bcmath/tests/scale.phpt
@@ -15,7 +15,6 @@ echo
'bcsqrt: ', bcsqrt('4', 5), PHP_EOL,
'bcsub: ', bcsub('2', '1', 5), PHP_EOL;
?>
-===DONE===
--EXPECT--
bcadd: 3.00000
bcdiv: 2.00000
@@ -24,4 +23,3 @@ bcpow: 2.00000
bcpowmod: 2.00000
bcsqrt: 2.00000
bcsub: 1.00000
-===DONE===
diff --git a/ext/bcmath/tests/scale_ini.phpt b/ext/bcmath/tests/scale_ini.phpt
index 66d9d482bf..c75cf8edda 100644
--- a/ext/bcmath/tests/scale_ini.phpt
+++ b/ext/bcmath/tests/scale_ini.phpt
@@ -17,7 +17,6 @@ echo
'bcsqrt: ', bcsqrt('4'), PHP_EOL,
'bcsub: ', bcsub('2', '1'), PHP_EOL;
?>
-===DONE===
--EXPECT--
bcadd: 3.00000
bcdiv: 2.00000
@@ -26,4 +25,3 @@ bcpow: 2.00000
bcpowmod: 2.00000
bcsqrt: 2.00000
bcsub: 1.00000
-===DONE===
diff --git a/ext/bz2/bz2.c b/ext/bz2/bz2.c
index 7b54766575..c90c117d71 100644
--- a/ext/bz2/bz2.c
+++ b/ext/bz2/bz2.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -22,6 +20,7 @@
#include "php.h"
#include "php_bz2.h"
+#include "bz2_arginfo.h"
#if HAVE_BZ2
@@ -50,57 +49,12 @@ static PHP_FUNCTION(bzerror);
static PHP_FUNCTION(bzcompress);
static PHP_FUNCTION(bzdecompress);
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_bzread, 0, 0, 1)
- ZEND_ARG_INFO(0, bz)
- ZEND_ARG_INFO(0, length)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_bzopen, 0)
- ZEND_ARG_INFO(0, file)
- ZEND_ARG_INFO(0, mode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_bzerrno, 0)
- ZEND_ARG_INFO(0, bz)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_bzerrstr, 0)
- ZEND_ARG_INFO(0, bz)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_bzerror, 0)
- ZEND_ARG_INFO(0, bz)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_bzcompress, 0, 0, 1)
- ZEND_ARG_INFO(0, source)
- ZEND_ARG_INFO(0, blocksize)
- ZEND_ARG_INFO(0, workfactor)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_bzdecompress, 0, 0, 1)
- ZEND_ARG_INFO(0, source)
- ZEND_ARG_INFO(0, small)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_bzwrite, 0, 0, 2)
- ZEND_ARG_INFO(0, fp)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, length)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_bzflush, 0)
- ZEND_ARG_INFO(0, fp)
-ZEND_END_ARG_INFO()
-/* }}} */
-
static const zend_function_entry bz2_functions[] = {
PHP_FE(bzopen, arginfo_bzopen)
PHP_FE(bzread, arginfo_bzread)
PHP_FALIAS(bzwrite, fwrite, arginfo_bzwrite)
PHP_FALIAS(bzflush, fflush, arginfo_bzflush)
- PHP_FALIAS(bzclose, fclose, arginfo_bzflush)
+ PHP_FALIAS(bzclose, fclose, arginfo_bzclose)
PHP_FE(bzerrno, arginfo_bzerrno)
PHP_FE(bzerrstr, arginfo_bzerrstr)
PHP_FE(bzerror, arginfo_bzerror)
@@ -379,14 +333,14 @@ static PHP_FUNCTION(bzread)
zend_string *data;
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "r|l", &bz, &len)) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
php_stream_from_zval(stream, bz);
- if ((len + 1) < 1) {
- php_error_docref(NULL, E_WARNING, "length may not be negative");
- RETURN_FALSE;
+ if (len < 0) {
+ zend_value_error("Length cannot be negative");
+ RETURN_THROWS();
}
data = php_stream_read_to_str(stream, len);
@@ -409,23 +363,24 @@ static PHP_FUNCTION(bzopen)
php_stream *stream = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zs", &file, &mode, &mode_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (mode_len != 1 || (mode[0] != 'r' && mode[0] != 'w')) {
- php_error_docref(NULL, E_WARNING, "'%s' is not a valid mode for bzopen(). Only 'w' and 'r' are supported.", mode);
- RETURN_FALSE;
+ zend_value_error("'%s' is not a valid mode for bzopen(). Only 'w' and 'r' are supported.", mode);
+ RETURN_THROWS();
}
/* If it's not a resource its a string containing the filename to open */
if (Z_TYPE_P(file) == IS_STRING) {
if (Z_STRLEN_P(file) == 0) {
- php_error_docref(NULL, E_WARNING, "filename cannot be empty");
+ php_error_docref(NULL, E_WARNING, "Filename cannot be empty");
RETURN_FALSE;
}
if (CHECK_ZVAL_NULL_PATH(file)) {
- RETURN_FALSE;
+ zend_type_error("Filename must not contain null bytes");
+ RETURN_THROWS();
}
stream = php_stream_bz2open(NULL, Z_STRVAL_P(file), mode, REPORT_ERRORS, NULL);
@@ -438,10 +393,10 @@ static PHP_FUNCTION(bzopen)
stream_mode_len = strlen(stream->mode);
if (stream_mode_len != 1 && !(stream_mode_len == 2 && memchr(stream->mode, 'b', 2))) {
- php_error_docref(NULL, E_WARNING, "cannot use stream opened in mode '%s'", stream->mode);
+ php_error_docref(NULL, E_WARNING, "Cannot use stream opened in mode '%s'", stream->mode);
RETURN_FALSE;
} else if (stream_mode_len == 1 && stream->mode[0] != 'r' && stream->mode[0] != 'w' && stream->mode[0] != 'a' && stream->mode[0] != 'x') {
- php_error_docref(NULL, E_WARNING, "cannot use stream opened in mode '%s'", stream->mode);
+ php_error_docref(NULL, E_WARNING, "Cannot use stream opened in mode '%s'", stream->mode);
RETURN_FALSE;
}
@@ -449,7 +404,7 @@ static PHP_FUNCTION(bzopen)
case 'r':
/* only "r" and "rb" are supported */
if (stream->mode[0] != mode[0] && !(stream_mode_len == 2 && stream->mode[1] != mode[0])) {
- php_error_docref(NULL, E_WARNING, "cannot read from a stream opened in write only mode");
+ php_error_docref(NULL, E_WARNING, "Cannot read from a stream opened in write only mode");
RETURN_FALSE;
}
break;
@@ -475,8 +430,8 @@ static PHP_FUNCTION(bzopen)
stream = php_stream_bz2open_from_BZFILE(bz, mode, stream);
} else {
- php_error_docref(NULL, E_WARNING, "first parameter has to be string or file-resource");
- RETURN_FALSE;
+ zend_type_error("First parameter has to be string or file-resource");
+ RETURN_THROWS();
}
if (stream) {
@@ -527,7 +482,7 @@ static PHP_FUNCTION(bzcompress)
unsigned int dest_len; /* Length of the destination buffer */
if (zend_parse_parameters(argc, "s|ll", &source, &source_len, &zblock_size, &zwork_factor) == FAILURE) {
- return;
+ RETURN_THROWS();
}
/* Assign them to easy to use variables, dest_len is initially the length of the data
@@ -579,7 +534,7 @@ static PHP_FUNCTION(bzdecompress)
bz_stream bzs;
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &source, &source_len, &small)) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
bzs.bzalloc = NULL;
@@ -646,7 +601,7 @@ static void php_bz2_error(INTERNAL_FUNCTION_PARAMETERS, int opt)
struct php_bz2_stream_data_t *self;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &bzp) == FAILURE) {
- return;
+ RETURN_THROWS();
}
php_stream_from_zval(stream, bzp);
diff --git a/ext/bz2/bz2.stub.php b/ext/bz2/bz2.stub.php
new file mode 100644
index 0000000000..b4898481d0
--- /dev/null
+++ b/ext/bz2/bz2.stub.php
@@ -0,0 +1,42 @@
+<?php
+
+/**
+ * @param string|resource $file
+ * @return resource|false
+ */
+ function bzopen($file, string $mode) {}
+
+/** @param resource $bz */
+function bzread($bz, int $length = 1024): string|false {}
+
+/** @param resource $bz */
+function bzwrite($bz, string $str, int $length = UNKNOWN): int|false {}
+
+/**
+ * @param resource $bz
+ */
+function bzflush($bz): bool {}
+
+/**
+ * @param resource $bz
+ */
+function bzclose($bz): bool {}
+
+/**
+ * @param resource $bz
+ */
+function bzerrno($bz): int {}
+
+/**
+ * @param resource $bz
+ */
+function bzerrstr($bz): string {}
+
+/**
+ * @param resource $bz
+ */
+function bzerror($bz): array {}
+
+function bzcompress(string $source, int $blocksize = 4, int $workfactor = 0): string|int {}
+
+function bzdecompress(string $source, int $small = 0): string|int|false {}
diff --git a/ext/bz2/bz2_arginfo.h b/ext/bz2/bz2_arginfo.h
new file mode 100644
index 0000000000..5010a959a3
--- /dev/null
+++ b/ext/bz2/bz2_arginfo.h
@@ -0,0 +1,46 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_bzopen, 0, 0, 2)
+ ZEND_ARG_INFO(0, file)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_bzread, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, bz)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_bzwrite, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, bz)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_bzflush, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, bz)
+ZEND_END_ARG_INFO()
+
+#define arginfo_bzclose arginfo_bzflush
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_bzerrno, 0, 1, IS_LONG, 0)
+ ZEND_ARG_INFO(0, bz)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_bzerrstr, 0, 1, IS_STRING, 0)
+ ZEND_ARG_INFO(0, bz)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_bzerror, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_INFO(0, bz)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_bzcompress, 0, 1, MAY_BE_STRING|MAY_BE_LONG)
+ ZEND_ARG_TYPE_INFO(0, source, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, blocksize, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, workfactor, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_bzdecompress, 0, 1, MAY_BE_STRING|MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, source, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, small, IS_LONG, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/bz2/bz2_filter.c b/ext/bz2/bz2_filter.c
index e7d7c3334f..40e01edca0 100644
--- a/ext/bz2/bz2_filter.c
+++ b/ext/bz2/bz2_filter.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/bz2/php_bz2.h b/ext/bz2/php_bz2.h
index 9523f32e14..bfa3ce690d 100644
--- a/ext/bz2/php_bz2.h
+++ b/ext/bz2/php_bz2.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/bz2/tests/001.phpt b/ext/bz2/tests/001.phpt
index 5a6b2878b8..1064e2b6a5 100644
--- a/ext/bz2/tests/001.phpt
+++ b/ext/bz2/tests/001.phpt
@@ -5,39 +5,48 @@ bzopen() and invalid parameters
--FILE--
<?php
-var_dump(bzopen());
-var_dump(bzopen("", ""));
-var_dump(bzopen("", "r"));
+try {
+ var_dump(bzopen("", ""));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+ var_dump(bzopen("", "r"));
var_dump(bzopen("", "w"));
-var_dump(bzopen("", "x"));
-var_dump(bzopen("", "rw"));
-var_dump(bzopen("no_such_file", "r"));
+
+try {
+ var_dump(bzopen("", "x"));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+try {
+ var_dump(bzopen("", "rw"));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+try {
+ var_dump(bzopen("no_such_file", "r"));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
$fp = fopen(__FILE__,"r");
var_dump(bzopen($fp, "r"));
-echo "Done\n";
?>
--EXPECTF--
-Warning: bzopen() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: bzopen(): '' is not a valid mode for bzopen(). Only 'w' and 'r' are supported. in %s on line %d
-bool(false)
-
-Warning: bzopen(): filename cannot be empty in %s on line %d
-bool(false)
-
-Warning: bzopen(): filename cannot be empty in %s on line %d
-bool(false)
+'' is not a valid mode for bzopen(). Only 'w' and 'r' are supported.
-Warning: bzopen(): 'x' is not a valid mode for bzopen(). Only 'w' and 'r' are supported. in %s on line %d
+Warning: bzopen(): Filename cannot be empty in %s on line %d
bool(false)
-Warning: bzopen(): 'rw' is not a valid mode for bzopen(). Only 'w' and 'r' are supported. in %s on line %d
+Warning: bzopen(): Filename cannot be empty in %s on line %d
bool(false)
+'x' is not a valid mode for bzopen(). Only 'w' and 'r' are supported.
+'rw' is not a valid mode for bzopen(). Only 'w' and 'r' are supported.
-Warning: bzopen(no_such_file): failed to open stream: No such file or directory in %s on line %d
+Warning: bzopen(no_such_file): Failed to open stream: No such file or directory in %s on line %d
bool(false)
resource(%d) of type (stream)
-Done
diff --git a/ext/bz2/tests/002.phpt b/ext/bz2/tests/002.phpt
index a69514a711..78c4a9bbdf 100644
--- a/ext/bz2/tests/002.phpt
+++ b/ext/bz2/tests/002.phpt
@@ -28,10 +28,18 @@ $fp = fopen("bz_open_002.txt", "wb");
var_dump(bzopen($fp, "w"));
$fp = fopen("bz_open_002.txt", "br");
-var_dump(bzopen($fp, "r"));
+try {
+ var_dump(bzopen($fp, "r"));
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
$fp = fopen("bz_open_002.txt", "br");
-var_dump(bzopen($fp, "w"));
+try {
+ var_dump(bzopen($fp, "w"));
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
$fp = fopen("bz_open_002.txt", "r");
var_dump(bzopen($fp, "w"));
@@ -71,59 +79,53 @@ var_dump(bzopen($fp, "w"));
@unlink("bz_open_002.txt");
-echo "Done\n";
?>
--EXPECTF--
resource(%d) of type (stream)
resource(%d) of type (stream)
resource(%d) of type (stream)
-Warning: bzopen(): cannot read from a stream opened in write only mode in %s on line %d
+Warning: bzopen(): Cannot read from a stream opened in write only mode in %s on line %d
bool(false)
resource(%d) of type (stream)
resource(%d) of type (stream)
-Warning: fopen(bz_open_002.txt): failed to open stream: Bad file %s in %s on line %d
-
-Warning: bzopen(): first parameter has to be string or file-resource in %s on line %d
-bool(false)
-
-Warning: fopen(bz_open_002.txt): failed to open stream: Bad file %s in %s on line %d
+Warning: fopen(bz_open_002.txt): Failed to open stream: Bad file %s in %s on line %d
+First parameter has to be string or file-resource
-Warning: bzopen(): first parameter has to be string or file-resource in %s on line %d
-bool(false)
+Warning: fopen(bz_open_002.txt): Failed to open stream: Bad file %s in %s on line %d
+First parameter has to be string or file-resource
Warning: bzopen(): cannot write to a stream opened in read only mode in %s on line %d
bool(false)
-Warning: bzopen(): cannot read from a stream opened in write only mode in %s on line %d
+Warning: bzopen(): Cannot read from a stream opened in write only mode in %s on line %d
bool(false)
-Warning: bzopen(): cannot use stream opened in mode 'rw' in %s on line %d
+Warning: bzopen(): Cannot use stream opened in mode 'rw' in %s on line %d
bool(false)
-Warning: bzopen(): cannot use stream opened in mode 'rw' in %s on line %d
+Warning: bzopen(): Cannot use stream opened in mode 'rw' in %s on line %d
bool(false)
-Warning: bzopen(): cannot use stream opened in mode 'wr' in %s on line %d
+Warning: bzopen(): Cannot use stream opened in mode 'wr' in %s on line %d
bool(false)
-Warning: bzopen(): cannot use stream opened in mode 'wr' in %s on line %d
+Warning: bzopen(): Cannot use stream opened in mode 'wr' in %s on line %d
bool(false)
-Warning: bzopen(): cannot use stream opened in mode 'r+' in %s on line %d
+Warning: bzopen(): Cannot use stream opened in mode 'r+' in %s on line %d
bool(false)
-Warning: bzopen(): cannot use stream opened in mode 'r+' in %s on line %d
+Warning: bzopen(): Cannot use stream opened in mode 'r+' in %s on line %d
bool(false)
-Warning: bzopen(): cannot use stream opened in mode 'w+' in %s on line %d
+Warning: bzopen(): Cannot use stream opened in mode 'w+' in %s on line %d
bool(false)
-Warning: bzopen(): cannot use stream opened in mode 'w+' in %s on line %d
+Warning: bzopen(): Cannot use stream opened in mode 'w+' in %s on line %d
bool(false)
-Warning: bzopen(): cannot read from a stream opened in write only mode in %s on line %d
+Warning: bzopen(): Cannot read from a stream opened in write only mode in %s on line %d
bool(false)
resource(%d) of type (stream)
-Done
diff --git a/ext/bz2/tests/003-mb.phpt b/ext/bz2/tests/003-mb.phpt
index ad43b0d11e..c01a3d18c8 100644
--- a/ext/bz2/tests/003-mb.phpt
+++ b/ext/bz2/tests/003-mb.phpt
@@ -6,26 +6,22 @@ bzread() tests
<?php
$fd = bzopen(__DIR__."/003ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.txt.bz2","r");
-var_dump(bzread());
-var_dump(bzread($fd, 1 ,0));
var_dump(bzread($fd, 0));
-var_dump(bzread($fd, -10));
+
+try {
+ var_dump(bzread($fd, -10));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
var_dump(bzread($fd, 1));
var_dump(bzread($fd, 2));
var_dump(bzread($fd, 100000));
-echo "Done\n";
?>
---EXPECTF--
-Warning: bzread() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: bzread() expects at most 2 parameters, 3 given in %s on line %d
-bool(false)
+--EXPECT--
string(0) ""
-
-Warning: bzread(): length may not be negative in %s on line %d
-bool(false)
+Length cannot be negative
string(1) "R"
string(2) "is"
string(251) "ing up from the heart of the desert
@@ -37,4 +33,3 @@ Rising up for Jerusalem
Rising up from the heat of the desert
Heading out for Jerusalem
"
-Done
diff --git a/ext/bz2/tests/003.phpt b/ext/bz2/tests/003.phpt
index feb806e424..6c1f8ea4a9 100644
--- a/ext/bz2/tests/003.phpt
+++ b/ext/bz2/tests/003.phpt
@@ -6,26 +6,22 @@ bzread() tests
<?php
$fd = bzopen(__DIR__."/003.txt.bz2","r");
-var_dump(bzread());
-var_dump(bzread($fd, 1 ,0));
var_dump(bzread($fd, 0));
-var_dump(bzread($fd, -10));
+
+try {
+ var_dump(bzread($fd, -10));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
var_dump(bzread($fd, 1));
var_dump(bzread($fd, 2));
var_dump(bzread($fd, 100000));
-echo "Done\n";
?>
---EXPECTF--
-Warning: bzread() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: bzread() expects at most 2 parameters, 3 given in %s on line %d
-bool(false)
+--EXPECT--
string(0) ""
-
-Warning: bzread(): length may not be negative in %s on line %d
-bool(false)
+Length cannot be negative
string(1) "R"
string(2) "is"
string(251) "ing up from the heart of the desert
@@ -37,4 +33,3 @@ Rising up for Jerusalem
Rising up from the heat of the desert
Heading out for Jerusalem
"
-Done
diff --git a/ext/bz2/tests/004.phpt b/ext/bz2/tests/004.phpt
index 2225433e0e..15eb90f89a 100644
--- a/ext/bz2/tests/004.phpt
+++ b/ext/bz2/tests/004.phpt
@@ -36,14 +36,30 @@ var_dump(bzerrstr($fd2));
var_dump(bzerrno($fd2));
bzclose($fd2);
-var_dump(bzread($fd2));
-var_dump(bzerror($fd2));
-var_dump(bzerrstr($fd2));
-var_dump(bzerrno($fd2));
+try {
+ var_dump(bzread($fd2));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(bzerror($fd2));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(bzerrstr($fd2));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(bzerrno($fd2));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
array(2) {
["errno"]=>
int(0)
@@ -96,16 +112,8 @@ array(2) {
}
string(10) "DATA_ERROR"
int(-4)
-
-Warning: bzread(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: bzerror(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: bzerrstr(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: bzerrno(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+bzread(): supplied resource is not a valid stream resource
+bzerror(): supplied resource is not a valid stream resource
+bzerrstr(): supplied resource is not a valid stream resource
+bzerrno(): supplied resource is not a valid stream resource
Done
diff --git a/ext/bz2/tests/005.phpt b/ext/bz2/tests/005.phpt
index 27dffb9c1b..ff14e65659 100644
--- a/ext/bz2/tests/005.phpt
+++ b/ext/bz2/tests/005.phpt
@@ -10,7 +10,6 @@ Drifting further everyday
Getting lost within myself
Nothing matters no one else";
-var_dump(bzcompress());
var_dump(bzcompress(1,1,1));
var_dump(bzcompress($string, 100));
var_dump(bzcompress($string, 100, -1));
@@ -23,8 +22,6 @@ $data2 = bzcompress($string, 1, 10);
$data3 = $data2;
$data3[3] = 0;
-var_dump(bzdecompress());
-var_dump(bzdecompress(1,1,1));
var_dump(bzdecompress(1,1));
var_dump(bzdecompress($data3));
var_dump(bzdecompress($data3,1));
@@ -38,19 +35,11 @@ var_dump(bzdecompress($data2));
echo "Done\n";
?>
--EXPECTF--
-Warning: bzcompress() expects at least 1 parameter, 0 given in %s on line %d
-NULL
string(%d) "BZ%a"
int(-2)
int(-2)
int(-2)
int(-2)
-
-Warning: bzdecompress() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: bzdecompress() expects at most 2 parameters, 3 given in %s on line %d
-bool(false)
int(-5)
int(-5)
int(-5)
diff --git a/ext/bz2/tests/bug71263.phpt b/ext/bz2/tests/bug71263.phpt
index d5c3ff91da..108469a293 100644
--- a/ext/bz2/tests/bug71263.phpt
+++ b/ext/bz2/tests/bug71263.phpt
@@ -8,11 +8,11 @@ Bug #71263: fread() does not detects decoding errors from filter bzip2.decompres
// Should notices be generated?
function test($case) {
- $plain = "The quick brown fox jumps over the lazy dog.";
- $fn = "bug71263.bz2";
- $compressed = (string) bzcompress($plain);
- echo "Compressed len = ", strlen($compressed), "\n";
-
+ $plain = "The quick brown fox jumps over the lazy dog.";
+ $fn = "bug71263.bz2";
+ $compressed = (string) bzcompress($plain);
+ echo "Compressed len = ", strlen($compressed), "\n";
+
if ($case == 1) {
// Set a random byte in the middle of the compressed data
// --> php_bz2_decompress_filter() detects fatal error
@@ -22,24 +22,24 @@ function test($case) {
// Truncate the compressed data
// --> php_bz2_decompress_filter() does not detect errors,
// --> fread() displays the empty string:
- $compressed = substr($compressed, 0, strlen($compressed) - 20);
+ $compressed = substr($compressed, 0, strlen($compressed) - 20);
} else {
// Corrupted final CRC
// --> php_bz2_decompress_filter() detects fatal error
// --> fread() displays an empty string, then the correct plain text, no error detected:
- $compressed[strlen($compressed)-2] = 'X';
+ $compressed[strlen($compressed)-2] = 'X';
}
- file_put_contents($fn, $compressed);
-
- $r = fopen($fn, "r");
- stream_filter_append($r, 'bzip2.decompress', STREAM_FILTER_READ);
+ file_put_contents($fn, $compressed);
+
+ $r = fopen($fn, "r");
+ stream_filter_append($r, 'bzip2.decompress', STREAM_FILTER_READ);
while (!feof($r)) {
$s = fread($r, 100);
echo "read: "; var_dump($s);
}
- fclose($r);
- unlink($fn);
+ fclose($r);
+ unlink($fn);
}
test(1);
diff --git a/ext/bz2/tests/bzopen_string_filename_with_null_bytes.phpt b/ext/bz2/tests/bzopen_string_filename_with_null_bytes.phpt
new file mode 100644
index 0000000000..9a05015bb9
--- /dev/null
+++ b/ext/bz2/tests/bzopen_string_filename_with_null_bytes.phpt
@@ -0,0 +1,23 @@
+--TEST--
+bzopen(): throw TypeError if filename contains null bytes
+--SKIPIF--
+<?php if (!extension_loaded("bz2")) print "skip"; ?>
+--FILE--
+<?php
+
+try {
+ bzopen("file\0", "w");
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+try {
+ bzopen("file\0", "r");
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+?>
+--EXPECT--
+Filename must not contain null bytes
+Filename must not contain null bytes
diff --git a/ext/calendar/cal_unix.c b/ext/calendar/cal_unix.c
index e24ac56a25..1d3401283d 100644
--- a/ext/calendar/cal_unix.c
+++ b/ext/calendar/cal_unix.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -31,13 +29,14 @@ PHP_FUNCTION(unixtojd)
struct tm *ta, tmbuf;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &ts) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!ts) {
ts = time(NULL);
} else if (ts < 0) {
- RETURN_FALSE;
+ zend_value_error("Timestamp must not be negative");
+ RETURN_THROWS();
}
if (!(ta = php_localtime_r(&ts, &tmbuf))) {
@@ -55,12 +54,13 @@ PHP_FUNCTION(jdtounix)
zend_long uday;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &uday) == FAILURE) {
- return;
+ RETURN_THROWS();
}
uday -= 2440588 /* J.D. of 1.1.1970 */;
- if (uday < 0 || uday > 24755) { /* before beginning of unix epoch or behind end of unix epoch */
- RETURN_FALSE;
+ if (uday < 0 || uday > 24755) {
+ zend_value_error("jday must be within the Unix epoch");
+ RETURN_THROWS();
}
RETURN_LONG(uday * 24 * 3600);
diff --git a/ext/calendar/calendar.c b/ext/calendar/calendar.c
index 3c7236de9a..a4a094fcdf 100644
--- a/ext/calendar/calendar.c
+++ b/ext/calendar/calendar.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -25,6 +23,7 @@
#include "php.h"
#include "ext/standard/info.h"
+#include "calendar_arginfo.h"
#include "php_calendar.h"
#include "sdncal.h"
@@ -36,100 +35,6 @@
#undef CAL_GREGORIAN
#endif
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_unixtojd, 0, 0, 0)
- ZEND_ARG_INFO(0, timestamp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_jdtounix, 0)
- ZEND_ARG_INFO(0, jday)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_cal_info, 0, 0, 0)
- ZEND_ARG_INFO(0, calendar)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_cal_days_in_month, 0)
- ZEND_ARG_INFO(0, calendar)
- ZEND_ARG_INFO(0, month)
- ZEND_ARG_INFO(0, year)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_cal_to_jd, 0)
- ZEND_ARG_INFO(0, calendar)
- ZEND_ARG_INFO(0, month)
- ZEND_ARG_INFO(0, day)
- ZEND_ARG_INFO(0, year)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_cal_from_jd, 0)
- ZEND_ARG_INFO(0, jd)
- ZEND_ARG_INFO(0, calendar)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_jdtogregorian, 0)
- ZEND_ARG_INFO(0, juliandaycount)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_gregoriantojd, 0)
- ZEND_ARG_INFO(0, month)
- ZEND_ARG_INFO(0, day)
- ZEND_ARG_INFO(0, year)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_jdtojulian, 0)
- ZEND_ARG_INFO(0, juliandaycount)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_juliantojd, 0)
- ZEND_ARG_INFO(0, month)
- ZEND_ARG_INFO(0, day)
- ZEND_ARG_INFO(0, year)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_jdtojewish, 0, 0, 1)
- ZEND_ARG_INFO(0, juliandaycount)
- ZEND_ARG_INFO(0, hebrew)
- ZEND_ARG_INFO(0, fl)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_jewishtojd, 0)
- ZEND_ARG_INFO(0, month)
- ZEND_ARG_INFO(0, day)
- ZEND_ARG_INFO(0, year)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_jdtofrench, 0)
- ZEND_ARG_INFO(0, juliandaycount)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_frenchtojd, 0)
- ZEND_ARG_INFO(0, month)
- ZEND_ARG_INFO(0, day)
- ZEND_ARG_INFO(0, year)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_jddayofweek, 0, 0, 1)
- ZEND_ARG_INFO(0, juliandaycount)
- ZEND_ARG_INFO(0, mode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_jdmonthname, 0)
- ZEND_ARG_INFO(0, juliandaycount)
- ZEND_ARG_INFO(0, mode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_easter_date, 0, 0, 0)
- ZEND_ARG_INFO(0, year)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_easter_days, 0, 0, 0)
- ZEND_ARG_INFO(0, year)
- ZEND_ARG_INFO(0, method)
-ZEND_END_ARG_INFO()
-
-/* }}} */
-
static const zend_function_entry calendar_functions[] = {
PHP_FE(jdtogregorian, arginfo_jdtogregorian)
PHP_FE(gregoriantojd, arginfo_gregoriantojd)
@@ -293,9 +198,8 @@ PHP_FUNCTION(cal_info)
{
zend_long cal = -1;
-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &cal) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (cal == -1) {
@@ -313,8 +217,8 @@ PHP_FUNCTION(cal_info)
if (cal != -1 && (cal < 0 || cal >= CAL_NUM_CALS)) {
- php_error_docref(NULL, E_WARNING, "invalid calendar ID " ZEND_LONG_FMT, cal);
- RETURN_FALSE;
+ zend_value_error("Invalid calendar ID: " ZEND_LONG_FMT, cal);
+ RETURN_THROWS();
}
_php_cal_info(cal, return_value);
@@ -331,12 +235,12 @@ PHP_FUNCTION(cal_days_in_month)
zend_long sdn_start, sdn_next;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lll", &cal, &month, &year) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (cal < 0 || cal >= CAL_NUM_CALS) {
- php_error_docref(NULL, E_WARNING, "invalid calendar ID " ZEND_LONG_FMT, cal);
- RETURN_FALSE;
+ zend_value_error("Invalid calendar ID: " ZEND_LONG_FMT, cal);
+ RETURN_THROWS();
}
calendar = &cal_conversion_table[cal];
@@ -344,8 +248,8 @@ PHP_FUNCTION(cal_days_in_month)
sdn_start = calendar->to_jd(year, month, 1);
if (sdn_start == 0) {
- php_error_docref(NULL, E_WARNING, "invalid date");
- RETURN_FALSE;
+ zend_value_error("Invalid date");
+ RETURN_THROWS();
}
sdn_next = calendar->to_jd(year, 1 + month, 1);
@@ -377,12 +281,12 @@ PHP_FUNCTION(cal_to_jd)
zend_long cal, month, day, year;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "llll", &cal, &month, &day, &year) != SUCCESS) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (cal < 0 || cal >= CAL_NUM_CALS) {
- php_error_docref(NULL, E_WARNING, "invalid calendar ID " ZEND_LONG_FMT, cal);
- RETURN_FALSE;
+ zend_value_error("Invalid calendar ID: " ZEND_LONG_FMT, cal);
+ RETURN_THROWS();
}
RETURN_LONG(cal_conversion_table[cal].to_jd(year, month, day));
@@ -398,12 +302,12 @@ PHP_FUNCTION(cal_from_jd)
const struct cal_entry_t *calendar;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll", &jd, &cal) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (cal < 0 || cal >= CAL_NUM_CALS) {
- php_error_docref(NULL, E_WARNING, "invalid calendar ID " ZEND_LONG_FMT, cal);
- RETURN_FALSE;
+ zend_value_error("Invalid calendar ID: " ZEND_LONG_FMT, cal);
+ RETURN_THROWS();
}
calendar = &cal_conversion_table[cal];
@@ -449,7 +353,7 @@ PHP_FUNCTION(jdtogregorian)
int year, month, day;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &julday) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
SdnToGregorian(julday, &year, &month, &day);
@@ -465,7 +369,7 @@ PHP_FUNCTION(gregoriantojd)
zend_long year, month, day;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lll", &month, &day, &year) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
RETURN_LONG(GregorianToSdn(year, month, day));
@@ -480,7 +384,7 @@ PHP_FUNCTION(jdtojulian)
int year, month, day;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &julday) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
SdnToJulian(julday, &year, &month, &day);
@@ -496,7 +400,7 @@ PHP_FUNCTION(juliantojd)
zend_long year, month, day;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lll", &month, &day, &year) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
RETURN_LONG(JulianToSdn(year, month, day));
@@ -609,7 +513,7 @@ PHP_FUNCTION(jdtojewish)
char *dayp, *yearp;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|bl", &julday, &heb, &fl) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
SdnToJewish(julday, &year, &month, &day);
@@ -617,8 +521,8 @@ PHP_FUNCTION(jdtojewish)
RETURN_NEW_STR(zend_strpprintf(0, "%i/%i/%i", month, day, year));
} else {
if (year <= 0 || year > 9999) {
- php_error_docref(NULL, E_WARNING, "Year out of range (0-9999)");
- RETURN_FALSE;
+ zend_value_error("Year out of range (0-9999)");
+ RETURN_THROWS();
}
RETVAL_NEW_STR(zend_strpprintf(0, "%s %s %s", heb_number_to_chars(day, fl, &dayp), JEWISH_HEB_MONTH_NAME(year)[month], heb_number_to_chars(year, fl, &yearp)));
@@ -640,7 +544,7 @@ PHP_FUNCTION(jewishtojd)
zend_long year, month, day;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lll", &month, &day, &year) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
RETURN_LONG(JewishToSdn(year, month, day));
@@ -655,7 +559,7 @@ PHP_FUNCTION(jdtofrench)
int year, month, day;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &julday) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
SdnToFrench(julday, &year, &month, &day);
@@ -671,7 +575,7 @@ PHP_FUNCTION(frenchtojd)
zend_long year, month, day;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lll", &month, &day, &year) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
RETURN_LONG(FrenchToSdn(year, month, day));
@@ -687,7 +591,7 @@ PHP_FUNCTION(jddayofweek)
const char *daynamel, *daynames;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l", &julday, &mode) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
day = DayOfWeek(julday);
@@ -718,7 +622,7 @@ PHP_FUNCTION(jdmonthname)
int month, day, year;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll", &julday, &mode) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
switch (mode) {
diff --git a/ext/calendar/calendar.stub.php b/ext/calendar/calendar.stub.php
new file mode 100644
index 0000000000..88b5b5fe39
--- /dev/null
+++ b/ext/calendar/calendar.stub.php
@@ -0,0 +1,37 @@
+<?php
+
+function cal_days_in_month(int $calendar, int $month, int $year): int {}
+
+function cal_from_jd(int $jd, int $calendar): array {}
+
+function cal_info(?int $calendar = UNKNOWN): array {}
+
+function cal_to_jd(int $calendar, int $month, int $day, int $year): int {}
+
+function easter_date(int $year = UNKNOWN, int $method = CAL_EASTER_DEFAULT): int {}
+
+function easter_days(int $year = UNKNOWN, int $method = CAL_EASTER_DEFAULT): int {}
+
+function frenchtojd(int $month, int $day, int $year): int {}
+
+function gregoriantojd(int $month, int $day, int $year): int {}
+
+function jddayofweek(int $juliandaycount, int $mode = CAL_DOW_DAYNO): int|string {}
+
+function jdmonthname(int $juliandaycount, int $mode): string {}
+
+function jdtofrench(int $juliandaycount): string {}
+
+function jdtogregorian(int $juliandaycount): string {}
+
+function jdtojewish(int $juliandaycount, bool $hebrew = false, int $fl = 0): string {}
+
+function jdtojulian(int $juliandaycount): string {}
+
+function jdtounix(int $jday): int {}
+
+function jewishtojd(int $month, int $day, int $year): int {}
+
+function juliantojd(int $month, int $day, int $year): int {}
+
+function unixtojd(int $timestamp = UNKNOWN): int|false {}
diff --git a/ext/calendar/calendar_arginfo.h b/ext/calendar/calendar_arginfo.h
new file mode 100644
index 0000000000..ab0064d016
--- /dev/null
+++ b/ext/calendar/calendar_arginfo.h
@@ -0,0 +1,74 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_cal_days_in_month, 0, 3, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, calendar, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, month, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, year, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_cal_from_jd, 0, 2, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, jd, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, calendar, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_cal_info, 0, 0, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, calendar, IS_LONG, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_cal_to_jd, 0, 4, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, calendar, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, month, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, day, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, year, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_easter_date, 0, 0, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, year, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, method, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_easter_days arginfo_easter_date
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_frenchtojd, 0, 3, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, month, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, day, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, year, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_gregoriantojd arginfo_frenchtojd
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_jddayofweek, 0, 1, MAY_BE_LONG|MAY_BE_STRING)
+ ZEND_ARG_TYPE_INFO(0, juliandaycount, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_jdmonthname, 0, 2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, juliandaycount, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_jdtofrench, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, juliandaycount, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_jdtogregorian arginfo_jdtofrench
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_jdtojewish, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, juliandaycount, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, hebrew, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, fl, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_jdtojulian arginfo_jdtofrench
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_jdtounix, 0, 1, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, jday, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_jewishtojd arginfo_frenchtojd
+
+#define arginfo_juliantojd arginfo_frenchtojd
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_unixtojd, 0, 0, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, timestamp, IS_LONG, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/calendar/easter.c b/ext/calendar/easter.c
index 2b9a2562e1..98087d318c 100644
--- a/ext/calendar/easter.c
+++ b/ext/calendar/easter.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -47,12 +45,12 @@ static void _cal_easter(INTERNAL_FUNCTION_PARAMETERS, zend_long gm)
if (zend_parse_parameters(ZEND_NUM_ARGS(),
"|ll", &year, &method) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (gm && (year<1970 || year>2037)) { /* out of range for timestamps */
- php_error_docref(NULL, E_WARNING, "This function is only valid for years between 1970 and 2037 inclusive");
- RETURN_FALSE;
+ zend_value_error("This function is only valid for years between 1970 and 2037 inclusive");
+ RETURN_THROWS();
}
golden = (year % 19) + 1; /* the Golden number */
diff --git a/ext/calendar/tests/cal_days_in_month_error1.phpt b/ext/calendar/tests/cal_days_in_month_error1.phpt
index aeb304e8ec..b7c82f2cbe 100644
--- a/ext/calendar/tests/cal_days_in_month_error1.phpt
+++ b/ext/calendar/tests/cal_days_in_month_error1.phpt
@@ -6,12 +6,17 @@ edgarsandi - <edgar.r.sandi@gmail.com>
<?php include 'skipif.inc'; ?>
--FILE--
<?php
-var_dump(cal_days_in_month(-1, 4, 2017));
-var_dump(cal_days_in_month(CAL_GREGORIAN,0, 2009));
+try {
+ cal_days_in_month(-1, 4, 2017);
+} catch (ValueError $ex) {
+ echo "{$ex->getMessage()}\n";
+}
+try{
+ cal_days_in_month(CAL_GREGORIAN,0, 2009);
+} catch (ValueError $ex) {
+ echo "{$ex->getMessage()}\n";
+}
?>
---EXPECTF--
-Warning: cal_days_in_month(): invalid calendar ID -1 in %s on line %d
-bool(false)
-
-Warning: cal_days_in_month(): invalid date in %s on line %d
-bool(false)
+--EXPECT--
+Invalid calendar ID: -1
+Invalid date
diff --git a/ext/calendar/tests/cal_from_jd_error1.phpt b/ext/calendar/tests/cal_from_jd_error1.phpt
index c4873815ac..8539117c0d 100644
--- a/ext/calendar/tests/cal_from_jd_error1.phpt
+++ b/ext/calendar/tests/cal_from_jd_error1.phpt
@@ -6,8 +6,11 @@ edgarsandi - <edgar.r.sandi@gmail.com>
<?php include 'skipif.inc'; ?>
--FILE--
<?php
-var_dump(cal_from_jd(1748326, -1));
+try {
+ cal_from_jd(1748326, -1);
+} catch (ValueError $ex) {
+ echo "{$ex->getMessage()}\n";
+}
?>
---EXPECTF--
-Warning: cal_from_jd(): invalid calendar ID -1 in %s on line %d
-bool(false)
+--EXPECT--
+Invalid calendar ID: -1
diff --git a/ext/calendar/tests/cal_info.phpt b/ext/calendar/tests/cal_info.phpt
index 68f31c16da..3e7e3b3188 100644
--- a/ext/calendar/tests/cal_info.phpt
+++ b/ext/calendar/tests/cal_info.phpt
@@ -8,9 +8,13 @@ date.timezone=UTC
<?php
print_r(cal_info());
print_r(cal_info(1));
- print_r(cal_info(99999));
+ try {
+ cal_info(99999);
+ } catch (ValueError $ex) {
+ echo "{$ex->getMessage()}\n";
+ }
?>
---EXPECTF--
+--EXPECT--
Array
(
[0] => Array
@@ -212,5 +216,4 @@ Array
[calname] => Julian
[calsymbol] => CAL_JULIAN
)
-
-Warning: cal_info(): invalid calendar ID 99999 in %s on line %d
+Invalid calendar ID: 99999
diff --git a/ext/calendar/tests/cal_to_jd_error1.phpt b/ext/calendar/tests/cal_to_jd_error1.phpt
index deb5e80e1d..c1911a77b7 100644
--- a/ext/calendar/tests/cal_to_jd_error1.phpt
+++ b/ext/calendar/tests/cal_to_jd_error1.phpt
@@ -6,8 +6,11 @@ edgarsandi - <edgar.r.sandi@gmail.com>
<?php include 'skipif.inc'; ?>
--FILE--
<?php
-var_dump(cal_to_jd(-1, 8, 26, 74));
+try {
+ cal_to_jd(-1, 8, 26, 74);
+} catch (ValueError $ex) {
+ echo "{$ex->getMessage()}\n";
+}
?>
---EXPECTF--
-Warning: cal_to_jd(): invalid calendar ID -1 in %s on line %d
-bool(false)
+--EXPECT--
+Invalid calendar ID: -1
diff --git a/ext/calendar/tests/easter_date.phpt b/ext/calendar/tests/easter_date.phpt
index 4e0aaa137f..a7cdbea516 100644
--- a/ext/calendar/tests/easter_date.phpt
+++ b/ext/calendar/tests/easter_date.phpt
@@ -12,12 +12,14 @@ putenv('TZ=UTC');
echo date("Y-m-d", easter_date(2000))."\n";
echo date("Y-m-d", easter_date(2001))."\n";
echo date("Y-m-d", easter_date(2002))."\n";
-echo date("Y-m-d", easter_date(1492))."\n";
+try {
+ easter_date(1492);
+} catch (ValueError $ex) {
+ echo "{$ex->getMessage()}\n";
+}
?>
---EXPECTF--
+--EXPECT--
2000-04-23
2001-04-15
2002-03-31
-
-Warning: easter_date(): This function is only valid for years between 1970 and 2037 inclusive in %s on line %d
-1970-01-01
+This function is only valid for years between 1970 and 2037 inclusive
diff --git a/ext/calendar/tests/jdtogregorian_overflow.phpt b/ext/calendar/tests/jdtogregorian_overflow.phpt
index 28f5298e19..9d4a1d6b4d 100644
--- a/ext/calendar/tests/jdtogregorian_overflow.phpt
+++ b/ext/calendar/tests/jdtogregorian_overflow.phpt
@@ -10,7 +10,7 @@ if (PHP_INT_SIZE != 4) die('skip this test is for 32bit platforms only');
--FILE--
<?php
for ($i=536838860; $i<536838870; $i++) {
- echo $i, ':', jdtogregorian($i), PHP_EOL;
+ echo $i, ':', jdtogregorian($i), PHP_EOL;
}
echo 'DONE', PHP_EOL;
?>
diff --git a/ext/calendar/tests/jdtojewish.phpt b/ext/calendar/tests/jdtojewish.phpt
index d6971c0663..4fd104c50c 100644
--- a/ext/calendar/tests/jdtojewish.phpt
+++ b/ext/calendar/tests/jdtojewish.phpt
@@ -6,21 +6,25 @@ jdtojewish() function
<?php
var_dump(jdtojewish(gregoriantojd(10,28,2002))."\r\n".
- jdtojewish(gregoriantojd(10,28,2002),true)."\r\n".
- jdtojewish(gregoriantojd(10,28,2002),true, CAL_JEWISH_ADD_ALAFIM_GERESH)."\r\n".
- jdtojewish(gregoriantojd(10,28,2002),true, CAL_JEWISH_ADD_ALAFIM)."\r\n".
- jdtojewish(gregoriantojd(10,28,2002),true, CAL_JEWISH_ADD_ALAFIM_GERESH+CAL_JEWISH_ADD_ALAFIM)."\r\n".
- jdtojewish(gregoriantojd(10,28,2002),true, CAL_JEWISH_ADD_GERESHAYIM)."\r\n".
- jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM)."\r\n".
- jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM+CAL_JEWISH_ADD_ALAFIM_GERESH)."\r\n".
- jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM+CAL_JEWISH_ADD_ALAFIM)."\r\n".
- jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM+CAL_JEWISH_ADD_ALAFIM+CAL_JEWISH_ADD_ALAFIM_GERESH)."\r\n".
- jdtojewish(gregoriantojd(3,10,2007))."\r\n");
+ jdtojewish(gregoriantojd(10,28,2002),true)."\r\n".
+ jdtojewish(gregoriantojd(10,28,2002),true, CAL_JEWISH_ADD_ALAFIM_GERESH)."\r\n".
+ jdtojewish(gregoriantojd(10,28,2002),true, CAL_JEWISH_ADD_ALAFIM)."\r\n".
+ jdtojewish(gregoriantojd(10,28,2002),true, CAL_JEWISH_ADD_ALAFIM_GERESH+CAL_JEWISH_ADD_ALAFIM)."\r\n".
+ jdtojewish(gregoriantojd(10,28,2002),true, CAL_JEWISH_ADD_GERESHAYIM)."\r\n".
+ jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM)."\r\n".
+ jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM+CAL_JEWISH_ADD_ALAFIM_GERESH)."\r\n".
+ jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM+CAL_JEWISH_ADD_ALAFIM)."\r\n".
+ jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM+CAL_JEWISH_ADD_ALAFIM+CAL_JEWISH_ADD_ALAFIM_GERESH)."\r\n".
+ jdtojewish(gregoriantojd(3,10,2007))."\r\n");
echo jdtojewish(gregoriantojd(11,5,2002)) . "\n";
echo jdtojewish(gregoriantojd(11,29,2004)) . "\n";
echo jdtojewish(gregoriantojd(1,1,9998)) . "\n";
-echo jdtojewish(gregoriantojd(1,1,9998),true) . "\n";
+try {
+ jdtojewish(gregoriantojd(1,1,9998),true);
+} catch (ValueError $ex) {
+ echo "{$ex->getMessage()}\n";
+}
?>
--EXPECTF--
string(%d) "2/22/5763
@@ -38,5 +42,4 @@ string(%d) "2/22/5763
2/30/5763
3/16/5765
3/8/13758
-
-Warning: jdtojewish(): Year out of range (0-9999) in %s on line %d
+Year out of range (0-9999)
diff --git a/ext/calendar/tests/jdtojewish_hebrew.phpt b/ext/calendar/tests/jdtojewish_hebrew.phpt
index ab5030202a..f7df0358f7 100644
--- a/ext/calendar/tests/jdtojewish_hebrew.phpt
+++ b/ext/calendar/tests/jdtojewish_hebrew.phpt
@@ -18,7 +18,6 @@ for ($year = 5000; $year <= 5001; $year++) {
echo "\n";
}
?>
-===DONE===
--EXPECT--
normal year 5000
e020faf9f8e920e4
@@ -50,4 +49,3 @@ e020faeee5e620e4e0
e020e0e120e4e0
e020e0ece5ec20e4e0
-===DONE===
diff --git a/ext/calendar/tests/jdtojewish_overflow.phpt b/ext/calendar/tests/jdtojewish_overflow.phpt
index 1d1c2eefb9..17a47e06e1 100644
--- a/ext/calendar/tests/jdtojewish_overflow.phpt
+++ b/ext/calendar/tests/jdtojewish_overflow.phpt
@@ -9,7 +9,7 @@ if (!extension_loaded('calendar')) die('skip ext/calendar required');
--FILE--
<?php
for ($i=324542840; $i<324542850; $i++) {
- echo $i, ':', jdtojewish($i), PHP_EOL;
+ echo $i, ':', jdtojewish($i), PHP_EOL;
}
echo 'DONE', PHP_EOL;
?>
diff --git a/ext/calendar/tests/jdtomonthname.phpt b/ext/calendar/tests/jdtomonthname.phpt
index 2ad50a450e..004c219bf9 100644
--- a/ext/calendar/tests/jdtomonthname.phpt
+++ b/ext/calendar/tests/jdtomonthname.phpt
@@ -9,19 +9,18 @@ $jd_days = Array(
2453396,
2440588,
-1,
- array(),
10000000
);
foreach ($jd_days as $jd_day) {
- echo "=== ", $jd_day, "\n";
+ echo "=== ", $jd_day, "\n";
var_dump(jdmonthname($jd_day,0));
var_dump(jdmonthname($jd_day,1));
var_dump(jdmonthname($jd_day,2));
var_dump(jdmonthname($jd_day,3));
var_dump(jdmonthname($jd_day,4));
var_dump(jdmonthname($jd_day,5));
- echo "\n";
+ echo "\n";
}
echo "Done\n";
@@ -52,28 +51,6 @@ string(0) ""
string(0) ""
string(0) ""
-===
-Notice: Array to string conversion in %sjdtomonthname.php on line %d
-Array
-
-Warning: jdmonthname() expects parameter 1 to be int, array given in %s on line %d
-bool(false)
-
-Warning: jdmonthname() expects parameter 1 to be int, array given in %s on line %d
-bool(false)
-
-Warning: jdmonthname() expects parameter 1 to be int, array given in %s on line %d
-bool(false)
-
-Warning: jdmonthname() expects parameter 1 to be int, array given in %s on line %d
-bool(false)
-
-Warning: jdmonthname() expects parameter 1 to be int, array given in %s on line %d
-bool(false)
-
-Warning: jdmonthname() expects parameter 1 to be int, array given in %s on line %d
-bool(false)
-
=== 10000000
string(3) "Dec"
string(8) "December"
diff --git a/ext/calendar/tests/jdtounix_error1.phpt b/ext/calendar/tests/jdtounix_error1.phpt
index 5d4ea38834..e47cced1b1 100644
--- a/ext/calendar/tests/jdtounix_error1.phpt
+++ b/ext/calendar/tests/jdtounix_error1.phpt
@@ -8,7 +8,11 @@ date.timezone=UTC
<?php include 'skipif.inc'; ?>
--FILE--
<?php
-var_dump(jdtounix(2440579)) . PHP_EOL;
+try {
+ jdtounix(2440579);
+} catch (ValueError $ex) {
+ echo $ex->getMessage(), PHP_EOL;
+}
?>
--EXPECT--
-bool(false)
+jday must be within the Unix epoch
diff --git a/ext/calendar/tests/skipif.inc b/ext/calendar/tests/skipif.inc
index 71cdc73630..e867fafd29 100644
--- a/ext/calendar/tests/skipif.inc
+++ b/ext/calendar/tests/skipif.inc
@@ -1,4 +1,4 @@
<?php
if(!extension_loaded("calendar"))
- print "skip - CALENDAR extension not available";
+ print "skip - CALENDAR extension not available";
?>
diff --git a/ext/calendar/tests/unixtojd.phpt b/ext/calendar/tests/unixtojd.phpt
index 01b3773007..28a05c0c6f 100644
--- a/ext/calendar/tests/unixtojd.phpt
+++ b/ext/calendar/tests/unixtojd.phpt
@@ -13,7 +13,7 @@ putenv('TZ=UTC');
// -adding a call direct to GetEnvironmentVariableA just before tzset() is called to check the value of 'TZ' returns 'UTC'
// putting a call to date_default_timezone_set() here doesn't help
//
-// on Windows, the only thing that gets this test to pass is to put TZ=UTC in --ENV-- section
+// on Windows, the only thing that gets this test to pass is to put TZ=UTC in--ENV-- section
// -since putenv() is written to call tzset() when env var is TZ, I assume that putenv("TZ=UTC") is intended to work
// and should work on all platforms(including Windows).
// easter_date.phpt passes
diff --git a/ext/calendar/tests/unixtojd_error1.phpt b/ext/calendar/tests/unixtojd_error1.phpt
index 88de9830ac..856fc1bcf4 100644
--- a/ext/calendar/tests/unixtojd_error1.phpt
+++ b/ext/calendar/tests/unixtojd_error1.phpt
@@ -10,13 +10,17 @@ date.timezone=UTC
<?php
putenv('TZ=UTC');
-var_dump(unixtojd(-1)) . PHP_EOL;
+try {
+ unixtojd(-1);
+} catch (ValueError $ex) {
+ echo $ex->getMessage(), PHP_EOL;
+}
var_dump(unixtojd(false)) . PHP_EOL;
var_dump(unixtojd(null)) . PHP_EOL;
var_dump(unixtojd(time())) . PHP_EOL;
?>
--EXPECTF--
-bool(false)
+Timestamp must not be negative
int(%d)
int(%d)
int(%d)
diff --git a/ext/com_dotnet/com_com.c b/ext/com_dotnet/com_com.c
index 58a22a9c62..58c7f7b963 100644
--- a/ext/com_dotnet/com_com.c
+++ b/ext/com_dotnet/com_com.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -60,19 +58,17 @@ PHP_FUNCTION(com_create_instance)
ZEND_NUM_ARGS(), "s|s!ls",
&module_name, &module_name_len, &server_name, &server_name_len,
&cp, &typelib_name, &typelib_name_len) &&
- FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET,
+ FAILURE == zend_parse_parameters(
ZEND_NUM_ARGS(), "sa|ls",
&module_name, &module_name_len, &server_params, &cp,
&typelib_name, &typelib_name_len)) {
-
- php_com_throw_exception(E_INVALIDARG, "Could not create COM object - invalid arguments!");
- return;
+ RETURN_THROWS();
}
cp_it = php_win32_cp_get_by_id((DWORD)cp);
if (!cp_it) {
php_com_throw_exception(E_INVALIDARG, "Could not create COM object - invalid codepage!");
- return;
+ RETURN_THROWS();
}
obj->code_page = (int)cp;
@@ -120,7 +116,7 @@ PHP_FUNCTION(com_create_instance)
if (server_name && !COMG(allow_dcom)) {
php_com_throw_exception(E_ERROR, "DCOM has been disabled by your administrator [com.allow_dcom=0]");
- return;
+ RETURN_THROWS();
}
moniker = php_com_string_to_olestring(module_name, module_name_len, obj->code_page);
@@ -235,7 +231,7 @@ PHP_FUNCTION(com_create_instance)
php_com_throw_exception(res, msg);
efree(msg);
- return;
+ RETURN_THROWS();
}
/* we got the object and it lives ! */
@@ -302,8 +298,7 @@ PHP_FUNCTION(com_get_active_object)
php_com_initialize();
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "s|l",
&module_name, &module_name_len, &code_page)) {
- php_com_throw_exception(E_INVALIDARG, "Invalid arguments!");
- return;
+ RETURN_THROWS();
}
module = php_com_string_to_olestring(module_name, module_name_len, (int)code_page);
@@ -501,7 +496,7 @@ int php_com_do_invoke_byref(php_com_dotnet_object *obj, zend_internal_function *
if (f->arg_info) {
for (i = 0; i < nargs; i++) {
- if (f->arg_info[nargs - i - 1].pass_by_reference) {
+ if (ZEND_ARG_SEND_MODE(&f->arg_info[nargs - i - 1])) {
byref_count++;
}
}
@@ -510,7 +505,7 @@ int php_com_do_invoke_byref(php_com_dotnet_object *obj, zend_internal_function *
if (byref_count) {
byref_vals = (VARIANT*)safe_emalloc(sizeof(VARIANT), byref_count, 0);
for (j = 0, i = 0; i < nargs; i++) {
- if (f->arg_info[nargs - i - 1].pass_by_reference) {
+ if (ZEND_ARG_SEND_MODE(&f->arg_info[nargs - i - 1])) {
/* put the value into byref_vals instead */
php_com_variant_from_zval(&byref_vals[j], &args[nargs - i - 1], obj->code_page);
@@ -557,7 +552,7 @@ int php_com_do_invoke_byref(php_com_dotnet_object *obj, zend_internal_function *
if (f && f->arg_info) {
for (i = 0, j = 0; i < nargs; i++) {
/* if this was byref, update the zval */
- if (f->arg_info[nargs - i - 1].pass_by_reference) {
+ if (ZEND_ARG_SEND_MODE(&f->arg_info[nargs - i - 1])) {
zval *arg = &args[nargs - i - 1];
ZVAL_DEREF(arg);
@@ -671,7 +666,7 @@ PHP_FUNCTION(com_create_guid)
OLECHAR *guid_string;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
php_com_initialize();
@@ -704,7 +699,7 @@ PHP_FUNCTION(com_event_sink)
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "Oo|z/",
&object, php_com_variant_class_entry, &sinkobject, &sink)) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
php_com_initialize();
@@ -765,7 +760,7 @@ PHP_FUNCTION(com_print_typeinfo)
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "z/|s!b", &arg1, &ifacename,
&ifacelen, &wantsink)) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
php_com_initialize();
@@ -797,7 +792,7 @@ PHP_FUNCTION(com_message_pump)
DWORD result;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &timeoutms) == FAILURE)
- RETURN_FALSE;
+ RETURN_THROWS();
php_com_initialize();
result = MsgWaitForMultipleObjects(0, NULL, FALSE, (DWORD)timeoutms, QS_ALLINPUT);
@@ -828,11 +823,12 @@ PHP_FUNCTION(com_load_typelib)
int cached = 0;
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "s|b", &name, &namelen, &cs)) {
- return;
+ RETURN_THROWS();
}
if (!cs) {
- php_error_docref(NULL, E_DEPRECATED, "Declaration of case-insensitive constants is deprecated");
+ php_error_docref(NULL, E_WARNING, "Declaration of case-insensitive constants is no longer supported");
+ RETURN_FALSE;
}
RETVAL_FALSE;
diff --git a/ext/com_dotnet/com_dotnet.c b/ext/com_dotnet/com_dotnet.c
index 7222615986..bee7116fc3 100644
--- a/ext/com_dotnet/com_dotnet.c
+++ b/ext/com_dotnet/com_dotnet.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -207,7 +205,7 @@ PHP_FUNCTION(com_dotnet_create_instance)
snprintf(buf, sizeof(buf), "Failed to init .Net runtime [%s] %s", where, err);
php_win32_error_msg_free(err);
php_com_throw_exception(hr, buf);
- return;
+ RETURN_THROWS();
}
stuff = (struct dotnet_runtime_stuff*)COMG(dotnet_runtime_stuff);
@@ -221,7 +219,7 @@ PHP_FUNCTION(com_dotnet_create_instance)
php_win32_error_msg_free(err);
php_com_throw_exception(hr, buf);
ZVAL_NULL(object);
- return;
+ RETURN_THROWS();
}
where = "QI: System._AppDomain";
@@ -233,7 +231,7 @@ PHP_FUNCTION(com_dotnet_create_instance)
php_win32_error_msg_free(err);
php_com_throw_exception(hr, buf);
ZVAL_NULL(object);
- return;
+ RETURN_THROWS();
}
}
@@ -243,14 +241,13 @@ PHP_FUNCTION(com_dotnet_create_instance)
&assembly_name, &assembly_name_len,
&datatype_name, &datatype_name_len,
&cp)) {
- php_com_throw_exception(E_INVALIDARG, "Could not create .Net object - invalid arguments!");
- return;
+ RETURN_THROWS();
}
cp_it = php_win32_cp_get_by_id((DWORD)cp);
if (!cp_it) {
php_com_throw_exception(E_INVALIDARG, "Could not create .Net object - invalid codepage!");
- return;
+ RETURN_THROWS();
}
obj->code_page = (int)cp_it->id;
@@ -314,7 +311,7 @@ PHP_FUNCTION(com_dotnet_create_instance)
snprintf(buf, sizeof(buf), "Failed to instantiate .Net object [%s] [0x%08x] %s", where, hr, err);
php_win32_error_msg_free(err);
php_com_throw_exception(hr, buf);
- return;
+ RETURN_THROWS();
}
}
/* }}} */
diff --git a/ext/com_dotnet/com_extension.c b/ext/com_dotnet/com_extension.c
index c77d089188..1353f48cb4 100644
--- a/ext/com_dotnet/com_extension.c
+++ b/ext/com_dotnet/com_extension.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -29,6 +27,7 @@
#include "php_com_dotnet_internal.h"
#include "Zend/zend_exceptions.h"
#include "Zend/zend_interfaces.h"
+#include "com_extension_arginfo.h"
ZEND_DECLARE_MODULE_GLOBALS(com_dotnet)
static PHP_GINIT_FUNCTION(com_dotnet);
@@ -38,116 +37,21 @@ zend_class_entry
*php_com_exception_class_entry,
*php_com_saproxy_class_entry;
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_set, 0, 0, 2)
- ZEND_ARG_INFO(0, variant)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_left_right, 0, 0, 2)
- ZEND_ARG_INFO(0, left)
- ZEND_ARG_INFO(0, right)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_abs, 0, 0, 1)
- ZEND_ARG_INFO(0, left)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_fix, 0, 0, 1)
- ZEND_ARG_INFO(0, left)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_int, 0, 0, 1)
- ZEND_ARG_INFO(0, left)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_neg, 0, 0, 1)
- ZEND_ARG_INFO(0, left)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_not, 0, 0, 1)
- ZEND_ARG_INFO(0, left)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_round, 0, 0, 2)
- ZEND_ARG_INFO(0, left)
- ZEND_ARG_INFO(0, decimals)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_cmp, 0, 0, 2)
- ZEND_ARG_INFO(0, left)
- ZEND_ARG_INFO(0, right)
- ZEND_ARG_INFO(0, lcid)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_date_to_timestamp, 0, 0, 1)
- ZEND_ARG_INFO(0, variant)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_date_from_timestamp, 0, 0, 1)
- ZEND_ARG_INFO(0, timestamp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_get_type, 0, 0, 1)
- ZEND_ARG_INFO(0, variant)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_set_type, 0, 0, 2)
- ZEND_ARG_INFO(0, variant)
- ZEND_ARG_INFO(0, type)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_cast, 0, 0, 2)
- ZEND_ARG_INFO(0, variant)
- ZEND_ARG_INFO(0, type)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_com_get_active_object, 0, 0, 1)
- ZEND_ARG_INFO(0, progid)
- ZEND_ARG_INFO(0, code_page)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_com_create_guid, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_com_event_sink, 0, 0, 2)
- ZEND_ARG_INFO(0, comobject)
- ZEND_ARG_INFO(0, sinkobject)
- ZEND_ARG_INFO(0, sinkinterface)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_com_print_typeinfo, 0, 0, 1)
- ZEND_ARG_INFO(0, comobject)
- ZEND_ARG_INFO(0, dispinterface)
- ZEND_ARG_INFO(0, wantsink)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_com_message_pump, 0, 0, 0)
- ZEND_ARG_INFO(0, timeoutms)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_com_load_typelib, 0, 0, 1)
- ZEND_ARG_INFO(0, typelib_name)
- ZEND_ARG_INFO(0, case_insensitive)
-ZEND_END_ARG_INFO()
-/* }}} */
-
static const zend_function_entry com_dotnet_functions[] = {
PHP_FE(variant_set, arginfo_variant_set)
- PHP_FE(variant_add, arginfo_left_right)
- PHP_FE(variant_cat, arginfo_left_right)
- PHP_FE(variant_sub, arginfo_left_right)
- PHP_FE(variant_mul, arginfo_left_right)
- PHP_FE(variant_and, arginfo_left_right)
- PHP_FE(variant_div, arginfo_left_right)
- PHP_FE(variant_eqv, arginfo_left_right)
- PHP_FE(variant_idiv, arginfo_left_right)
- PHP_FE(variant_imp, arginfo_left_right)
- PHP_FE(variant_mod, arginfo_left_right)
- PHP_FE(variant_or, arginfo_left_right)
- PHP_FE(variant_pow, arginfo_left_right)
- PHP_FE(variant_xor, arginfo_left_right)
+ PHP_FE(variant_add, arginfo_variant_add)
+ PHP_FE(variant_cat, arginfo_variant_add)
+ PHP_FE(variant_sub, arginfo_variant_add)
+ PHP_FE(variant_mul, arginfo_variant_add)
+ PHP_FE(variant_and, arginfo_variant_add)
+ PHP_FE(variant_div, arginfo_variant_add)
+ PHP_FE(variant_eqv, arginfo_variant_add)
+ PHP_FE(variant_idiv, arginfo_variant_add)
+ PHP_FE(variant_imp, arginfo_variant_add)
+ PHP_FE(variant_mod, arginfo_variant_add)
+ PHP_FE(variant_or, arginfo_variant_add)
+ PHP_FE(variant_pow, arginfo_variant_add)
+ PHP_FE(variant_xor, arginfo_variant_add)
PHP_FE(variant_abs, arginfo_variant_abs)
PHP_FE(variant_fix, arginfo_variant_fix)
PHP_FE(variant_int, arginfo_variant_int)
@@ -235,8 +139,7 @@ static PHP_INI_MH(OnTypeLibFileUpdate)
modifier = php_strtok_r(NULL, "#", &strtok_buf);
if (modifier != NULL) {
if (!strcmp(modifier, "cis") || !strcmp(modifier, "case_insensitive")) {
- php_error_docref("com.configuration", E_DEPRECATED, "Declaration of case-insensitive constants is deprecated");
- mode &= ~CONST_CS;
+ php_error_docref("com.configuration", E_WARNING, "Declaration of case-insensitive constants is no longer supported; #cis modifier ignored");
}
}
@@ -267,7 +170,8 @@ static PHP_INI_MH(OnTypeLibFileUpdate)
static ZEND_INI_MH(OnAutoregisterCasesensitive)
{
if (!zend_ini_parse_bool(new_value)) {
- php_error_docref("com.configuration", E_DEPRECATED, "Declaration of case-insensitive constants is deprecated");
+ php_error_docref("com.configuration", E_WARNING, "Declaration of case-insensitive constants is no longer supported");
+ return FAILURE;
}
return OnUpdateBool(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
}
@@ -342,11 +246,7 @@ PHP_MINIT_FUNCTION(com_dotnet)
#define COM_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_CS|CONST_PERSISTENT)
#if SIZEOF_ZEND_LONG == 8
-# define COM_ERR_CONST(x) { \
- zend_long __tmp; \
- ULongToIntPtr(x, &__tmp); \
- REGISTER_LONG_CONSTANT(#x, __tmp, CONST_CS|CONST_PERSISTENT); \
-}
+# define COM_ERR_CONST(x) REGISTER_LONG_CONSTANT(#x, (zend_long) (ULONG) (x), CONST_CS|CONST_PERSISTENT)
#else
# define COM_ERR_CONST COM_CONST
#endif
diff --git a/ext/com_dotnet/com_extension.stub.php b/ext/com_dotnet/com_extension.stub.php
new file mode 100644
index 0000000000..83cfc50350
--- /dev/null
+++ b/ext/com_dotnet/com_extension.stub.php
@@ -0,0 +1,66 @@
+<?php
+
+function variant_set(variant $variant, $value): void {}
+
+function variant_add($left, $right): variant {}
+
+function variant_cat($left, $right): variant {}
+
+function variant_sub($left, $right): variant {}
+
+function variant_mul($left, $right): variant {}
+
+function variant_and($left, $right): variant {}
+
+function variant_div($left, $right): variant {}
+
+function variant_eqv($left, $right): variant {}
+
+function variant_idiv($left, $right): variant {}
+
+function variant_imp($left, $right): variant {}
+
+function variant_mod($left, $right): variant {}
+
+function variant_or($left, $right): variant {}
+
+function variant_pow($left, $right): variant {}
+
+function variant_xor($left, $right): variant {}
+
+function variant_abs($left): variant {}
+
+function variant_fix($left): variant {}
+
+function variant_int($left): variant {}
+
+function variant_neg($left): variant {}
+
+function variant_not($left): variant {}
+
+function variant_round($left, int $decimals): ?variant {}
+
+function variant_cmp($left, $right, int $lcid = UNKNOWN, int $flags = 0) {}
+
+function variant_date_to_timestamp(variant $variant): ?int {}
+
+/** @return variant|false */
+function variant_date_from_timestamp(int $timestamp) {}
+
+function variant_get_type(variant $variant): int {}
+
+function variant_set_type(variant $variant, int $type): void {}
+
+function variant_cast(variant $variant, int $type): variant {}
+
+function com_get_active_object(string $progid, int $code_page = UNKNOWN): variant {}
+
+function com_create_guid(): string|false {}
+
+function com_event_sink(variant $comobject, object $sinkobject, $sinkinterface = UNKNOWN): bool {}
+
+function com_print_typeinfo($comobject, ?string $dispinterface = null, bool $wantsink = false): bool {}
+
+function com_message_pump(int $timeoutms = 0): bool {}
+
+function com_load_typelib(string $typelib_name, bool $case_insensitive = true) {}
diff --git a/ext/com_dotnet/com_extension_arginfo.h b/ext/com_dotnet/com_extension_arginfo.h
new file mode 100644
index 0000000000..b8ffef8077
--- /dev/null
+++ b/ext/com_dotnet/com_extension_arginfo.h
@@ -0,0 +1,110 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_variant_set, 0, 2, IS_VOID, 0)
+ ZEND_ARG_OBJ_INFO(0, variant, variant, 0)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_variant_add, 0, 2, variant, 0)
+ ZEND_ARG_INFO(0, left)
+ ZEND_ARG_INFO(0, right)
+ZEND_END_ARG_INFO()
+
+#define arginfo_variant_cat arginfo_variant_add
+
+#define arginfo_variant_sub arginfo_variant_add
+
+#define arginfo_variant_mul arginfo_variant_add
+
+#define arginfo_variant_and arginfo_variant_add
+
+#define arginfo_variant_div arginfo_variant_add
+
+#define arginfo_variant_eqv arginfo_variant_add
+
+#define arginfo_variant_idiv arginfo_variant_add
+
+#define arginfo_variant_imp arginfo_variant_add
+
+#define arginfo_variant_mod arginfo_variant_add
+
+#define arginfo_variant_or arginfo_variant_add
+
+#define arginfo_variant_pow arginfo_variant_add
+
+#define arginfo_variant_xor arginfo_variant_add
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_variant_abs, 0, 1, variant, 0)
+ ZEND_ARG_INFO(0, left)
+ZEND_END_ARG_INFO()
+
+#define arginfo_variant_fix arginfo_variant_abs
+
+#define arginfo_variant_int arginfo_variant_abs
+
+#define arginfo_variant_neg arginfo_variant_abs
+
+#define arginfo_variant_not arginfo_variant_abs
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_variant_round, 0, 2, variant, 1)
+ ZEND_ARG_INFO(0, left)
+ ZEND_ARG_TYPE_INFO(0, decimals, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_cmp, 0, 0, 2)
+ ZEND_ARG_INFO(0, left)
+ ZEND_ARG_INFO(0, right)
+ ZEND_ARG_TYPE_INFO(0, lcid, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_variant_date_to_timestamp, 0, 1, IS_LONG, 1)
+ ZEND_ARG_OBJ_INFO(0, variant, variant, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_variant_date_from_timestamp, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, timestamp, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_variant_get_type, 0, 1, IS_LONG, 0)
+ ZEND_ARG_OBJ_INFO(0, variant, variant, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_variant_set_type, 0, 2, IS_VOID, 0)
+ ZEND_ARG_OBJ_INFO(0, variant, variant, 0)
+ ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_variant_cast, 0, 2, variant, 0)
+ ZEND_ARG_OBJ_INFO(0, variant, variant, 0)
+ ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_com_get_active_object, 0, 1, variant, 0)
+ ZEND_ARG_TYPE_INFO(0, progid, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, code_page, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_com_create_guid, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_com_event_sink, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, comobject, variant, 0)
+ ZEND_ARG_TYPE_INFO(0, sinkobject, IS_OBJECT, 0)
+ ZEND_ARG_INFO(0, sinkinterface)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_com_print_typeinfo, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, comobject)
+ ZEND_ARG_TYPE_INFO(0, dispinterface, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, wantsink, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_com_message_pump, 0, 0, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, timeoutms, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_com_load_typelib, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, typelib_name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, case_insensitive, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/com_dotnet/com_handlers.c b/ext/com_dotnet/com_handlers.c
index d42e7453f8..31e01061e3 100644
--- a/ext/com_dotnet/com_handlers.c
+++ b/ext/com_dotnet/com_handlers.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -27,7 +25,7 @@
#include "php_com_dotnet_internal.h"
#include "Zend/zend_exceptions.h"
-static zval *com_property_read(zval *object, zval *member, int type, void **cahce_slot, zval *rv)
+static zval *com_property_read(zend_object *object, zend_string *member, int type, void **cahce_slot, zval *rv)
{
php_com_dotnet_object *obj;
VARIANT v;
@@ -35,21 +33,22 @@ static zval *com_property_read(zval *object, zval *member, int type, void **cahc
ZVAL_NULL(rv);
- obj = CDNO_FETCH(object);
+ obj = (php_com_dotnet_object*) object;
if (V_VT(&obj->v) == VT_DISPATCH) {
VariantInit(&v);
- convert_to_string_ex(member);
-
- res = php_com_do_invoke(obj, Z_STRVAL_P(member), Z_STRLEN_P(member),
+ res = php_com_do_invoke(obj, ZSTR_VAL(member), ZSTR_LEN(member),
DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, 0, NULL, 1);
if (res == SUCCESS) {
php_com_zval_from_variant(rv, &v, obj->code_page);
VariantClear(&v);
} else if (res == DISP_E_BADPARAMCOUNT) {
- php_com_saproxy_create(object, rv, member);
+ zval zv;
+
+ ZVAL_STR(&zv, member);
+ php_com_saproxy_create(object, rv, &zv);
}
} else {
php_com_throw_exception(E_INVALIDARG, "this variant has no properties");
@@ -58,18 +57,17 @@ static zval *com_property_read(zval *object, zval *member, int type, void **cahc
return rv;
}
-static zval *com_property_write(zval *object, zval *member, zval *value, void **cache_slot)
+static zval *com_property_write(zend_object *object, zend_string *member, zval *value, void **cache_slot)
{
php_com_dotnet_object *obj;
VARIANT v;
- obj = CDNO_FETCH(object);
+ obj = (php_com_dotnet_object*) object;
if (V_VT(&obj->v) == VT_DISPATCH) {
VariantInit(&v);
- convert_to_string_ex(member);
- if (SUCCESS == php_com_do_invoke(obj, Z_STRVAL_P(member), Z_STRLEN_P(member),
+ if (SUCCESS == php_com_do_invoke(obj, ZSTR_VAL(member), ZSTR_LEN(member),
DISPATCH_PROPERTYPUT|DISPATCH_PROPERTYPUTREF, &v, 1, value, 0)) {
VariantClear(&v);
}
@@ -79,14 +77,14 @@ static zval *com_property_write(zval *object, zval *member, zval *value, void **
return value;
}
-static zval *com_read_dimension(zval *object, zval *offset, int type, zval *rv)
+static zval *com_read_dimension(zend_object *object, zval *offset, int type, zval *rv)
{
php_com_dotnet_object *obj;
VARIANT v;
ZVAL_NULL(rv);
- obj = CDNO_FETCH(object);
+ obj = (php_com_dotnet_object*) object;
if (V_VT(&obj->v) == VT_DISPATCH) {
VariantInit(&v);
@@ -115,14 +113,14 @@ static zval *com_read_dimension(zval *object, zval *offset, int type, zval *rv)
return rv;
}
-static void com_write_dimension(zval *object, zval *offset, zval *value)
+static void com_write_dimension(zend_object *object, zval *offset, zval *value)
{
php_com_dotnet_object *obj;
zval args[2];
VARIANT v;
HRESULT res;
- obj = CDNO_FETCH(object);
+ obj = (php_com_dotnet_object*) object;
if (offset == NULL) {
php_com_throw_exception(DISP_E_BADINDEX, "appending to variants is not supported");
@@ -184,29 +182,15 @@ static zval *com_get_property_ptr_ptr(zval *object, zval *member, int type, void
return NULL;
}
-#if 0
-static void com_object_set(zval **property, zval *value)
-{
- /* Not yet implemented in the engine */
-}
-
-static zval *com_object_get(zval *property)
-{
- /* Not yet implemented in the engine */
- return NULL;
-}
-#endif
-
-static int com_property_exists(zval *object, zval *member, int check_empty, void **cache_slot)
+static int com_property_exists(zend_object *object, zend_string *member, int check_empty, void **cache_slot)
{
DISPID dispid;
php_com_dotnet_object *obj;
- obj = CDNO_FETCH(object);
+ obj = (php_com_dotnet_object*) object;
if (V_VT(&obj->v) == VT_DISPATCH) {
- convert_to_string_ex(member);
- if (SUCCEEDED(php_com_get_id_of_name(obj, Z_STRVAL_P(member), Z_STRLEN_P(member), &dispid))) {
+ if (SUCCEEDED(php_com_get_id_of_name(obj, ZSTR_VAL(member), ZSTR_LEN(member), &dispid))) {
/* TODO: distinguish between property and method! */
return 1;
}
@@ -217,23 +201,23 @@ static int com_property_exists(zval *object, zval *member, int check_empty, void
return 0;
}
-static int com_dimension_exists(zval *object, zval *member, int check_empty)
+static int com_dimension_exists(zend_object *object, zval *member, int check_empty)
{
php_error_docref(NULL, E_WARNING, "Operation not yet supported on a COM object");
return 0;
}
-static void com_property_delete(zval *object, zval *member, void **cache_slot)
+static void com_property_delete(zend_object *object, zend_string *member, void **cache_slot)
{
php_error_docref(NULL, E_WARNING, "Cannot delete properties from a COM object");
}
-static void com_dimension_delete(zval *object, zval *offset)
+static void com_dimension_delete(zend_object *object, zval *offset)
{
php_error_docref(NULL, E_WARNING, "Cannot delete properties from a COM object");
}
-static HashTable *com_properties_get(zval *object)
+static HashTable *com_properties_get(zend_object *object)
{
/* TODO: use type-info to get all the names and values ?
* DANGER: if we do that, there is a strong possibility for
@@ -264,11 +248,42 @@ static void function_dtor(zval *zv)
static PHP_FUNCTION(com_method_handler)
{
zval *object = getThis();
+ zend_string *method = EX(func)->common.function_name;
+ zval *args = NULL;
+ php_com_dotnet_object *obj = CDNO_FETCH(object);
+ int nargs;
+ VARIANT v;
+ int ret = FAILURE;
+
+ if (V_VT(&obj->v) != VT_DISPATCH) {
+ goto exit;
+ }
- Z_OBJ_HANDLER_P(object, call_method)(
- ((zend_internal_function*)EX(func))->function_name,
- Z_OBJ_P(object),
- INTERNAL_FUNCTION_PARAM_PASSTHRU);
+ nargs = ZEND_NUM_ARGS();
+
+ if (nargs) {
+ args = (zval *)safe_emalloc(sizeof(zval), nargs, 0);
+ zend_get_parameters_array_ex(nargs, args);
+ }
+
+ VariantInit(&v);
+
+ if (SUCCESS == php_com_do_invoke_byref(obj, (zend_internal_function*)EX(func), DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, nargs, args)) {
+ php_com_zval_from_variant(return_value, &v, obj->code_page);
+ ret = SUCCESS;
+ VariantClear(&v);
+ }
+
+ if (args) {
+ efree(args);
+ }
+
+exit:
+ /* Cleanup trampoline */
+ ZEND_ASSERT(EX(func)->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE);
+ zend_string_release(EX(func)->common.function_name);
+ zend_free_trampoline(EX(func));
+ EX(func) = NULL;
}
static zend_function *com_method_get(zend_object **object_ptr, zend_string *name, const zval *key)
@@ -288,7 +303,8 @@ static zend_function *com_method_get(zend_object **object_ptr, zend_string *name
/* check cache */
if (obj->method_cache == NULL || NULL == (fptr = zend_hash_find_ptr(obj->method_cache, name))) {
- f.type = ZEND_OVERLOADED_FUNCTION;
+ memset(&f, 0, sizeof(zend_internal_function));
+ f.type = ZEND_INTERNAL_FUNCTION;
f.num_args = 0;
f.arg_info = NULL;
f.scope = obj->ce;
@@ -318,10 +334,8 @@ static zend_function *com_method_get(zend_object **object_ptr, zend_string *name
f.arg_info = ecalloc(bindptr.lpfuncdesc->cParams, sizeof(zend_arg_info));
for (i = 0; i < bindptr.lpfuncdesc->cParams; i++) {
- f.arg_info[i].type = ZEND_TYPE_ENCODE(0,1);
- if (bindptr.lpfuncdesc->lprgelemdescParam[i].paramdesc.wParamFlags & PARAMFLAG_FOUT) {
- f.arg_info[i].pass_by_reference = ZEND_SEND_BY_REF;
- }
+ zend_bool by_ref = (bindptr.lpfuncdesc->lprgelemdescParam[i].paramdesc.wParamFlags & PARAMFLAG_FOUT) != 0;
+ f.arg_info[i].type = (zend_type) ZEND_TYPE_INIT_NONE(_ZEND_ARG_INFO_FLAGS(by_ref, 0));
}
f.num_args = bindptr.lpfuncdesc->cParams;
@@ -363,6 +377,7 @@ static zend_function *com_method_get(zend_object **object_ptr, zend_string *name
if (fptr) {
/* duplicate this into a new chunk of emalloc'd memory,
* since the engine will efree it */
+ zend_string_addref(fptr->function_name);
func = emalloc(sizeof(*fptr));
memcpy(func, fptr, sizeof(*fptr));
@@ -372,40 +387,6 @@ static zend_function *com_method_get(zend_object **object_ptr, zend_string *name
return NULL;
}
-static int com_call_method(zend_string *method, zend_object *object, INTERNAL_FUNCTION_PARAMETERS)
-{
- zval *args = NULL;
- php_com_dotnet_object *obj = (php_com_dotnet_object*)object;
- int nargs;
- VARIANT v;
- int ret = FAILURE;
-
- if (V_VT(&obj->v) != VT_DISPATCH) {
- return FAILURE;
- }
-
- nargs = ZEND_NUM_ARGS();
-
- if (nargs) {
- args = (zval *)safe_emalloc(sizeof(zval), nargs, 0);
- zend_get_parameters_array_ex(nargs, args);
- }
-
- VariantInit(&v);
-
- if (SUCCESS == php_com_do_invoke_byref(obj, (zend_internal_function*)EX(func), DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, nargs, args)) {
- php_com_zval_from_variant(return_value, &v, obj->code_page);
- ret = SUCCESS;
- VariantClear(&v);
- }
-
- if (args) {
- efree(args);
- }
-
- return ret;
-}
-
static zend_function *com_constructor_get(zend_object *object)
{
php_com_dotnet_object *obj = (php_com_dotnet_object *) object;
@@ -456,6 +437,8 @@ static int com_objects_compare(zval *object1, zval *object2)
* So, we have this declaration here to fix it */
STDAPI VarCmp(LPVARIANT pvarLeft, LPVARIANT pvarRight, LCID lcid, DWORD flags);
+ ZEND_COMPARE_OBJECTS_FALLBACK(object1, object2);
+
obja = CDNO_FETCH(object1);
objb = CDNO_FETCH(object2);
@@ -478,14 +461,14 @@ static int com_objects_compare(zval *object1, zval *object2)
return ret;
}
-static int com_object_cast(zval *readobj, zval *writeobj, int type)
+static int com_object_cast(zend_object *readobj, zval *writeobj, int type)
{
php_com_dotnet_object *obj;
VARIANT v;
VARTYPE vt = VT_EMPTY;
HRESULT res = S_OK;
- obj = CDNO_FETCH(readobj);
+ obj = (php_com_dotnet_object*) readobj;
ZVAL_NULL(writeobj);
VariantInit(&v);
@@ -535,12 +518,12 @@ static int com_object_cast(zval *readobj, zval *writeobj, int type)
return zend_std_cast_object_tostring(readobj, writeobj, type);
}
-static int com_object_count(zval *object, zend_long *count)
+static int com_object_count(zend_object *object, zend_long *count)
{
php_com_dotnet_object *obj;
LONG ubound = 0, lbound = 0;
- obj = CDNO_FETCH(object);
+ obj = (php_com_dotnet_object*) object;
if (!V_ISARRAY(&obj->v)) {
return FAILURE;
@@ -564,23 +547,22 @@ zend_object_handlers php_com_object_handlers = {
com_read_dimension,
com_write_dimension,
com_get_property_ptr_ptr,
- NULL, /* com_object_get, */
- NULL, /* com_object_set, */
com_property_exists,
com_property_delete,
com_dimension_exists,
com_dimension_delete,
com_properties_get,
com_method_get,
- com_call_method,
com_constructor_get,
com_class_name_get,
- com_objects_compare,
com_object_cast,
com_object_count,
NULL, /* get_debug_info */
NULL, /* get_closure */
com_get_gc, /* get_gc */
+ NULL, /* do_operation */
+ com_objects_compare, /* compare */
+ NULL, /* get_properties_for */
};
void php_com_object_enable_event_sink(php_com_dotnet_object *obj, int enable)
@@ -636,11 +618,11 @@ void php_com_object_free_storage(zend_object *object)
zend_object_std_dtor(object);
}
-zend_object* php_com_object_clone(zval *object)
+zend_object* php_com_object_clone(zend_object *object)
{
php_com_dotnet_object *cloneobj, *origobject;
- origobject = (php_com_dotnet_object*)Z_OBJ_P(object);
+ origobject = (php_com_dotnet_object*) object;
cloneobj = (php_com_dotnet_object*)emalloc(sizeof(php_com_dotnet_object));
memcpy(cloneobj, origobject, sizeof(*cloneobj));
diff --git a/ext/com_dotnet/com_iterator.c b/ext/com_dotnet/com_iterator.c
index c3206497cf..0272d48cd3 100644
--- a/ext/com_dotnet/com_iterator.c
+++ b/ext/com_dotnet/com_iterator.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -150,7 +148,7 @@ zend_object_iterator *php_com_iter_get(zend_class_entry *ce, zval *object, int b
obj = CDNO_FETCH(object);
if (V_VT(&obj->v) != VT_DISPATCH && !V_ISARRAY(&obj->v)) {
- php_error_docref(NULL, E_WARNING, "variant is not an object or array VT=%d", V_VT(&obj->v));
+ php_error_docref(NULL, E_WARNING, "Variant is not an object or array VT=%d", V_VT(&obj->v));
return NULL;
}
diff --git a/ext/com_dotnet/com_misc.c b/ext/com_dotnet/com_misc.c
index 13a94033e6..24230761c1 100644
--- a/ext/com_dotnet/com_misc.c
+++ b/ext/com_dotnet/com_misc.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/com_dotnet/com_olechar.c b/ext/com_dotnet/com_olechar.c
index 6c5b6430bd..665773b120 100644
--- a/ext/com_dotnet/com_olechar.c
+++ b/ext/com_dotnet/com_olechar.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/com_dotnet/com_persist.c b/ext/com_dotnet/com_persist.c
index f2d60c1e72..656215dd1a 100644
--- a/ext/com_dotnet/com_persist.c
+++ b/ext/com_dotnet/com_persist.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -287,12 +285,11 @@ PHP_COM_DOTNET_API IStream *php_com_wrapper_export_stream(php_stream *stream)
}
#define CPH_ME(fname, arginfo) PHP_ME(com_persist, fname, arginfo, ZEND_ACC_PUBLIC)
-#define CPH_SME(fname, arginfo) PHP_ME(com_persist, fname, arginfo, ZEND_ACC_ALLOW_STATIC|ZEND_ACC_PUBLIC)
#define CPH_METHOD(fname) static PHP_METHOD(com_persist, fname)
#define CPH_FETCH() php_com_persist_helper *helper = (php_com_persist_helper*)Z_OBJ_P(getThis());
-#define CPH_NO_OBJ() if (helper->unk == NULL) { php_com_throw_exception(E_INVALIDARG, "No COM object is associated with this helper instance"); return; }
+#define CPH_NO_OBJ() if (helper->unk == NULL) { php_com_throw_exception(E_INVALIDARG, "No COM object is associated with this helper instance"); RETURN_THROWS(); }
typedef struct {
zend_object std;
@@ -383,8 +380,7 @@ CPH_METHOD(SaveToFile)
if (helper->ipf) {
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "p!|b",
&filename, &filename_len, &remember)) {
- php_com_throw_exception(E_INVALIDARG, "Invalid arguments");
- return;
+ RETURN_THROWS();
}
if (filename) {
@@ -447,8 +443,7 @@ CPH_METHOD(LoadFromFile)
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "p|l",
&filename, &filename_len, &flags)) {
- php_com_throw_exception(E_INVALIDARG, "Invalid arguments");
- return;
+ RETURN_THROWS();
}
if (!(fullpath = expand_filepath(filename, NULL))) {
@@ -495,7 +490,7 @@ CPH_METHOD(GetMaxStreamSize)
res = IPersistStream_GetSizeMax(helper->ips, &size);
} else {
php_com_throw_exception(res, NULL);
- return;
+ RETURN_THROWS();
}
}
@@ -543,21 +538,20 @@ CPH_METHOD(LoadFromStream)
CPH_FETCH();
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zstm)) {
- php_com_throw_exception(E_INVALIDARG, "invalid arguments");
- return;
+ RETURN_THROWS();
}
php_stream_from_zval_no_verify(stream, zstm);
if (stream == NULL) {
php_com_throw_exception(E_INVALIDARG, "expected a stream");
- return;
+ RETURN_THROWS();
}
stm = php_com_wrapper_export_stream(stream);
if (stm == NULL) {
php_com_throw_exception(E_UNEXPECTED, "failed to wrap stream");
- return;
+ RETURN_THROWS();
}
res = S_OK;
@@ -587,7 +581,7 @@ CPH_METHOD(LoadFromStream)
if (FAILED(res)) {
php_com_throw_exception(res, NULL);
- RETURN_NULL();
+ RETURN_THROWS();
}
}
/* }}} */
@@ -605,21 +599,20 @@ CPH_METHOD(SaveToStream)
CPH_NO_OBJ();
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zstm)) {
- php_com_throw_exception(E_INVALIDARG, "invalid arguments");
- return;
+ RETURN_THROWS();
}
php_stream_from_zval_no_verify(stream, zstm);
if (stream == NULL) {
php_com_throw_exception(E_INVALIDARG, "expected a stream");
- return;
+ RETURN_THROWS();
}
stm = php_com_wrapper_export_stream(stream);
if (stm == NULL) {
php_com_throw_exception(E_UNEXPECTED, "failed to wrap stream");
- return;
+ RETURN_THROWS();
}
res = get_persist_stream_init(helper);
@@ -636,7 +629,7 @@ CPH_METHOD(SaveToStream)
if (FAILED(res)) {
php_com_throw_exception(res, NULL);
- return;
+ RETURN_THROWS();
}
RETURN_TRUE;
@@ -653,8 +646,7 @@ CPH_METHOD(__construct)
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "|O!",
&zobj, php_com_variant_class_entry)) {
- php_com_throw_exception(E_INVALIDARG, "invalid arguments");
- return;
+ RETURN_THROWS();
}
if (!zobj) {
@@ -665,7 +657,7 @@ CPH_METHOD(__construct)
if (V_VT(&obj->v) != VT_DISPATCH || V_DISPATCH(&obj->v) == NULL) {
php_com_throw_exception(E_INVALIDARG, "parameter must represent an IDispatch COM object");
- return;
+ RETURN_THROWS();
}
/* it is always safe to cast an interface to IUnknown */
@@ -710,9 +702,9 @@ static void helper_free_storage(zend_object *obj)
}
-static zend_object* helper_clone(zval *obj)
+static zend_object* helper_clone(zend_object *obj)
{
- php_com_persist_helper *clone, *object = (php_com_persist_helper*)Z_OBJ_P(obj);
+ php_com_persist_helper *clone, *object = (php_com_persist_helper*) obj;
clone = emalloc(sizeof(*object));
memcpy(clone, object, sizeof(*object));
diff --git a/ext/com_dotnet/com_saproxy.c b/ext/com_dotnet/com_saproxy.c
index 5f43c9fe25..2b42315151 100644
--- a/ext/com_dotnet/com_saproxy.c
+++ b/ext/com_dotnet/com_saproxy.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -37,7 +35,6 @@
typedef struct {
zend_object std;
/* the object we a proxying for; we hold a refcount to it */
- zval *zobj;
php_com_dotnet_object *obj;
/* how many dimensions we are indirecting to get into this element */
@@ -69,7 +66,7 @@ static inline void clone_indices(php_com_saproxy *dest, php_com_saproxy *src, in
}
}
-static zval *saproxy_property_read(zval *object, zval *member, int type, void **cache_slot, zval *rv)
+static zval *saproxy_property_read(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv)
{
ZVAL_NULL(rv);
@@ -78,15 +75,15 @@ static zval *saproxy_property_read(zval *object, zval *member, int type, void **
return rv;
}
-static zval *saproxy_property_write(zval *object, zval *member, zval *value, void **cache_slot)
+static zval *saproxy_property_write(zend_object *object, zend_string *member, zval *value, void **cache_slot)
{
php_com_throw_exception(E_INVALIDARG, "safearray has no properties");
return value;
}
-static zval *saproxy_read_dimension(zval *object, zval *offset, int type, zval *rv)
+static zval *saproxy_read_dimension(zend_object *object, zval *offset, int type, zval *rv)
{
- php_com_saproxy *proxy = SA_FETCH(object);
+ php_com_saproxy *proxy = (php_com_saproxy*) object;
UINT dims, i;
SAFEARRAY *sa;
LONG ubound, lbound;
@@ -202,9 +199,9 @@ static zval *saproxy_read_dimension(zval *object, zval *offset, int type, zval *
return rv;
}
-static void saproxy_write_dimension(zval *object, zval *offset, zval *value)
+static void saproxy_write_dimension(zend_object *object, zval *offset, zval *value)
{
- php_com_saproxy *proxy = SA_FETCH(object);
+ php_com_saproxy *proxy = (php_com_saproxy*) object;
UINT dims, i;
HRESULT res;
VARIANT v;
@@ -275,41 +272,29 @@ static void saproxy_write_dimension(zval *object, zval *offset, zval *value)
}
}
-#if 0
-static void saproxy_object_set(zval **property, zval *value)
-{
-}
-
-static zval *saproxy_object_get(zval *property)
-{
- /* Not yet implemented in the engine */
- return NULL;
-}
-#endif
-
-static int saproxy_property_exists(zval *object, zval *member, int check_empty, void **cache_slot)
+static int saproxy_property_exists(zend_object *object, zend_string *member, int check_empty, void **cache_slot)
{
/* no properties */
return 0;
}
-static int saproxy_dimension_exists(zval *object, zval *member, int check_empty)
+static int saproxy_dimension_exists(zend_object *object, zval *member, int check_empty)
{
php_error_docref(NULL, E_WARNING, "Operation not yet supported on a COM object");
return 0;
}
-static void saproxy_property_delete(zval *object, zval *member, void **cache_slot)
+static void saproxy_property_delete(zend_object *object, zend_string *member, void **cache_slot)
{
php_error_docref(NULL, E_WARNING, "Cannot delete properties from a COM object");
}
-static void saproxy_dimension_delete(zval *object, zval *offset)
+static void saproxy_dimension_delete(zend_object *object, zval *offset)
{
php_error_docref(NULL, E_WARNING, "Cannot delete properties from a COM object");
}
-static HashTable *saproxy_properties_get(zval *object)
+static HashTable *saproxy_properties_get(zend_object *object)
{
/* no properties */
return NULL;
@@ -321,11 +306,6 @@ static zend_function *saproxy_method_get(zend_object **object, zend_string *name
return NULL;
}
-static int saproxy_call_method(zend_string *method, zend_object *object, INTERNAL_FUNCTION_PARAMETERS)
-{
- return FAILURE;
-}
-
static zend_function *saproxy_constructor_get(zend_object *object)
{
/* user cannot instantiate */
@@ -339,17 +319,18 @@ static zend_string* saproxy_class_name_get(const zend_object *object)
static int saproxy_objects_compare(zval *object1, zval *object2)
{
+ ZEND_COMPARE_OBJECTS_FALLBACK(object1, object2);
return -1;
}
-static int saproxy_object_cast(zval *readobj, zval *writeobj, int type)
+static int saproxy_object_cast(zend_object *readobj, zval *writeobj, int type)
{
return FAILURE;
}
-static int saproxy_count_elements(zval *object, zend_long *count)
+static int saproxy_count_elements(zend_object *object, zend_long *count)
{
- php_com_saproxy *proxy = SA_FETCH(object);
+ php_com_saproxy *proxy = (php_com_saproxy*) object;
LONG ubound, lbound;
if (!V_ISARRAY(&proxy->obj->v)) {
@@ -375,21 +356,22 @@ static void saproxy_free_storage(zend_object *object)
//??? }
//??? }
+ OBJ_RELEASE(&proxy->obj->zo);
+
zend_object_std_dtor(object);
- zval_ptr_dtor(proxy->zobj);
efree(proxy->indices);
}
-static zend_object* saproxy_clone(zval *object)
+static zend_object* saproxy_clone(zend_object *object)
{
- php_com_saproxy *proxy = (php_com_saproxy *)Z_OBJ_P(object);
+ php_com_saproxy *proxy = (php_com_saproxy *) object;
php_com_saproxy *cloneproxy;
cloneproxy = emalloc(sizeof(*cloneproxy));
memcpy(cloneproxy, proxy, sizeof(*cloneproxy));
- Z_ADDREF_P(cloneproxy->zobj);
+ GC_ADDREF(&cloneproxy->obj->zo);
cloneproxy->indices = safe_emalloc(cloneproxy->dimensions, sizeof(zval *), 0);
clone_indices(cloneproxy, proxy, proxy->dimensions);
@@ -406,40 +388,40 @@ zend_object_handlers php_com_saproxy_handlers = {
saproxy_read_dimension,
saproxy_write_dimension,
NULL,
- NULL, /* saproxy_object_get, */
- NULL, /* saproxy_object_set, */
saproxy_property_exists,
saproxy_property_delete,
saproxy_dimension_exists,
saproxy_dimension_delete,
saproxy_properties_get,
saproxy_method_get,
- saproxy_call_method,
saproxy_constructor_get,
saproxy_class_name_get,
- saproxy_objects_compare,
saproxy_object_cast,
- saproxy_count_elements
+ saproxy_count_elements,
+ NULL, /* get_debug_info */
+ NULL, /* get_closure */
+ NULL, /* get_gc */
+ NULL, /* do_operation */
+ saproxy_objects_compare, /* compare */
+ NULL, /* get_properties_for */
};
-int php_com_saproxy_create(zval *com_object, zval *proxy_out, zval *index)
+int php_com_saproxy_create(zend_object *com_object, zval *proxy_out, zval *index)
{
php_com_saproxy *proxy, *rel = NULL;
proxy = ecalloc(1, sizeof(*proxy));
proxy->dimensions = 1;
- if (Z_OBJCE_P(com_object) == php_com_saproxy_class_entry) {
- rel = SA_FETCH(com_object);
+ if (com_object->ce == php_com_saproxy_class_entry) {
+ rel = (php_com_saproxy*) com_object;
proxy->obj = rel->obj;
- proxy->zobj = rel->zobj;
proxy->dimensions += rel->dimensions;
} else {
- proxy->obj = CDNO_FETCH(com_object);
- proxy->zobj = com_object;
+ proxy->obj = (php_com_dotnet_object*) com_object;
}
- Z_ADDREF_P(proxy->zobj);
+ GC_ADDREF(&proxy->obj->zo);
proxy->indices = safe_emalloc(proxy->dimensions, sizeof(zval *), 0);
if (rel) {
diff --git a/ext/com_dotnet/com_typeinfo.c b/ext/com_dotnet/com_typeinfo.c
index 44d0340af5..fe1d18f5d6 100644
--- a/ext/com_dotnet/com_typeinfo.c
+++ b/ext/com_dotnet/com_typeinfo.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/com_dotnet/com_variant.c b/ext/com_dotnet/com_variant.c
index aef7fabe7f..bc4c7950e0 100644
--- a/ext/com_dotnet/com_variant.c
+++ b/ext/com_dotnet/com_variant.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -452,8 +450,7 @@ PHP_FUNCTION(com_variant_create_instance)
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(),
"z!|ll", &zvalue, &vt, &codepage)) {
- php_com_throw_exception(E_INVALIDARG, "Invalid arguments");
- return;
+ RETURN_THROWS();
}
php_com_initialize();
@@ -514,7 +511,7 @@ PHP_FUNCTION(variant_set)
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(),
"Oz!", &zobj, php_com_variant_class_entry, &zvalue)) {
- return;
+ RETURN_THROWS();
}
obj = CDNO_FETCH(zobj);
@@ -592,7 +589,7 @@ static void variant_binary_operation(enum variant_binary_opcode op, INTERNAL_FUN
php_com_variant_from_zval(vright, zright, codepage);
} else {
- return;
+ RETURN_THROWS();
}
switch (op) {
@@ -778,7 +775,7 @@ static void variant_unary_operation(enum variant_unary_opcode op, INTERNAL_FUNCT
vleft = &left_val;
php_com_variant_from_zval(vleft, zleft, codepage);
} else {
- return;
+ RETURN_THROWS();
}
switch (op) {
@@ -876,7 +873,7 @@ PHP_FUNCTION(variant_round)
vleft = &left_val;
php_com_variant_from_zval(vleft, zleft, codepage);
} else {
- return;
+ RETURN_THROWS();
}
if (SUCCEEDED(VarRound(vleft, (int)decimals, &vres))) {
@@ -936,7 +933,7 @@ PHP_FUNCTION(variant_cmp)
php_com_variant_from_zval(vright, zright, codepage);
} else {
- return;
+ RETURN_THROWS();
}
ZVAL_LONG(return_value, VarCmp(vleft, vright, (LCID)lcid, (ULONG)flags));
@@ -958,7 +955,7 @@ PHP_FUNCTION(variant_date_to_timestamp)
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(),
"O", &zleft, php_com_variant_class_entry)) {
- return;
+ RETURN_THROWS();
}
obj = CDNO_FETCH(zleft);
@@ -997,7 +994,7 @@ PHP_FUNCTION(variant_date_from_timestamp)
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "l",
&timestamp)) {
- return;
+ RETURN_THROWS();
}
if (timestamp < 0) {
@@ -1043,7 +1040,7 @@ PHP_FUNCTION(variant_get_type)
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(),
"O", &zobj, php_com_variant_class_entry)) {
- return;
+ RETURN_THROWS();
}
obj = CDNO_FETCH(zobj);
@@ -1062,7 +1059,7 @@ PHP_FUNCTION(variant_set_type)
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(),
"Ol", &zobj, php_com_variant_class_entry, &vt)) {
- return;
+ RETURN_THROWS();
}
obj = CDNO_FETCH(zobj);
@@ -1098,7 +1095,7 @@ PHP_FUNCTION(variant_cast)
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(),
"Ol", &zobj, php_com_variant_class_entry, &vt)) {
- return;
+ RETURN_THROWS();
}
obj = CDNO_FETCH(zobj);
diff --git a/ext/com_dotnet/com_wrapper.c b/ext/com_dotnet/com_wrapper.c
index 78d8912a90..c4f41a4916 100644
--- a/ext/com_dotnet/com_wrapper.c
+++ b/ext/com_dotnet/com_wrapper.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -499,7 +497,7 @@ static void generate_dispids(php_dispatchex *disp)
char namebuf[32];
if (keytype == HASH_KEY_IS_LONG) {
- snprintf(namebuf, sizeof(namebuf), "%d", pid);
+ snprintf(namebuf, sizeof(namebuf), ZEND_ULONG_FMT, pid);
name = zend_string_init(namebuf, strlen(namebuf), 0);
} else {
zend_string_addref(name);
diff --git a/ext/com_dotnet/php_com_dotnet.h b/ext/com_dotnet/php_com_dotnet.h
index 50894158f5..e770fd3a94 100644
--- a/ext/com_dotnet/php_com_dotnet.h
+++ b/ext/com_dotnet/php_com_dotnet.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/com_dotnet/php_com_dotnet_internal.h b/ext/com_dotnet/php_com_dotnet_internal.h
index 676d2f9330..3ee7ec4eba 100644
--- a/ext/com_dotnet/php_com_dotnet_internal.h
+++ b/ext/com_dotnet/php_com_dotnet_internal.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -72,14 +70,14 @@ zend_class_entry *php_com_variant_class_entry, *php_com_exception_class_entry, *
/* com_handlers.c */
zend_object* php_com_object_new(zend_class_entry *ce);
-zend_object* php_com_object_clone(zval *object);
+zend_object* php_com_object_clone(zend_object *object);
void php_com_object_free_storage(zend_object *object);
zend_object_handlers php_com_object_handlers;
void php_com_object_enable_event_sink(php_com_dotnet_object *obj, int enable);
/* com_saproxy.c */
zend_object_iterator *php_com_saproxy_iter_get(zend_class_entry *ce, zval *object, int by_ref);
-int php_com_saproxy_create(zval *com_object, zval *proxy_out, zval *index);
+int php_com_saproxy_create(zend_object *com_object, zval *proxy_out, zval *index);
/* com_olechar.c */
PHP_COM_DOTNET_API char *php_com_olestring_to_string(OLECHAR *olestring,
diff --git a/ext/com_dotnet/tests/27974.phpt b/ext/com_dotnet/tests/27974.phpt
index 960a630304..c76dda9ed5 100644
--- a/ext/com_dotnet/tests/27974.phpt
+++ b/ext/com_dotnet/tests/27974.phpt
@@ -8,26 +8,26 @@ if (!extension_loaded("com_dotnet")) print "skip COM/.Net support not present";
error_reporting(E_ALL);
try {
- $v = new VARIANT(array("123", "456", "789"));
- var_dump($v);
- print $v[0] . "\n";
- print $v[1] . "\n";
- print $v[2] . "\n";
- $v[1] = "hello";
- foreach ($v as $item) {
- var_dump($item);
- }
- try {
- $v[3] = "shouldn't work";
- } catch (com_exception $e) {
- if ($e->getCode() != DISP_E_BADINDEX) {
- throw $e;
- }
- echo "Got BADINDEX exception OK!\n";
- }
- echo "OK!";
+ $v = new VARIANT(array("123", "456", "789"));
+ var_dump($v);
+ print $v[0] . "\n";
+ print $v[1] . "\n";
+ print $v[2] . "\n";
+ $v[1] = "hello";
+ foreach ($v as $item) {
+ var_dump($item);
+ }
+ try {
+ $v[3] = "shouldn't work";
+ } catch (com_exception $e) {
+ if ($e->getCode() != DISP_E_BADINDEX) {
+ throw $e;
+ }
+ echo "Got BADINDEX exception OK!\n";
+ }
+ echo "OK!";
} catch (Exception $e) {
- print $e;
+ print $e;
}
?>
--EXPECT--
diff --git a/ext/com_dotnet/tests/bug33386.phpt b/ext/com_dotnet/tests/bug33386.phpt
index 102e69749b..7f305d2eb5 100644
--- a/ext/com_dotnet/tests/bug33386.phpt
+++ b/ext/com_dotnet/tests/bug33386.phpt
@@ -15,22 +15,22 @@ class twoFuncs {
}
try {
- $ciTF = new twoFuncs;
+ $ciTF = new twoFuncs;
- $oScript = new COM("MSScriptControl.ScriptControl");
- $oScript->Language = "VBScript";
+ $oScript = new COM("MSScriptControl.ScriptControl");
+ $oScript->Language = "VBScript";
- $oScript->AddObject ("tfA", $ciTF, true);
- foreach (array(1,2) as $i) {
- $oScript->ExecuteStatement ("tfA.func$i");
- $oScript->ExecuteStatement ("func$i");
- }
- $oScript->AddObject ("tfB", $ciTF);
- foreach (array(1,2) as $i) {
- $oScript->ExecuteStatement ("tfB.func$i");
- }
+ $oScript->AddObject ("tfA", $ciTF, true);
+ foreach (array(1,2) as $i) {
+ $oScript->ExecuteStatement ("tfA.func$i");
+ $oScript->ExecuteStatement ("func$i");
+ }
+ $oScript->AddObject ("tfB", $ciTF);
+ foreach (array(1,2) as $i) {
+ $oScript->ExecuteStatement ("tfB.func$i");
+ }
} catch (Exception $e) {
- print $e;
+ print $e;
}
?>
--EXPECT--
diff --git a/ext/com_dotnet/tests/bug34272.phpt b/ext/com_dotnet/tests/bug34272.phpt
index feb63c93c3..ce8a552dfd 100644
--- a/ext/com_dotnet/tests/bug34272.phpt
+++ b/ext/com_dotnet/tests/bug34272.phpt
@@ -8,13 +8,13 @@ if (!extension_loaded("com_dotnet")) print "skip COM/.Net support not present";
error_reporting(E_ALL);
try {
- $dict = new COM("Scripting.Dictionary");
- $dict->add('foo', array());
- print sizeof($dict['foo'])."\n";
- $dict->add('bar', array(23));
- print sizeof($dict['bar'])." \n";
+ $dict = new COM("Scripting.Dictionary");
+ $dict->add('foo', array());
+ print sizeof($dict['foo'])."\n";
+ $dict->add('bar', array(23));
+ print sizeof($dict['bar'])." \n";
} catch (Exception $e) {
- print $e;
+ print $e;
}
?>
--EXPECT--
diff --git a/ext/com_dotnet/tests/bug39596.phpt b/ext/com_dotnet/tests/bug39596.phpt
index bd89326560..1510db49cf 100644
--- a/ext/com_dotnet/tests/bug39596.phpt
+++ b/ext/com_dotnet/tests/bug39596.phpt
@@ -8,13 +8,13 @@ if (!extension_loaded("com_dotnet")) print "skip COM/.Net support not present";
error_reporting(E_ALL);
try {
- $binding_string = array('aaa','bbb','ccc');
- $v = new VARIANT( $binding_string, VT_ARRAY );
- foreach ($v AS $element) {
- print $element."\n";
- }
+ $binding_string = array('aaa','bbb','ccc');
+ $v = new VARIANT( $binding_string, VT_ARRAY );
+ foreach ($v AS $element) {
+ print $element."\n";
+ }
} catch (Exception $e) {
- print $e;
+ print $e;
}
?>
--EXPECT--
diff --git a/ext/com_dotnet/tests/bug39606.phpt b/ext/com_dotnet/tests/bug39606.phpt
index 314e9ce8a2..f646c6a7c3 100644
--- a/ext/com_dotnet/tests/bug39606.phpt
+++ b/ext/com_dotnet/tests/bug39606.phpt
@@ -15,8 +15,6 @@ $typelib = $root.'\activeds.tlb';
var_dump(com_load_typelib($typelib));
var_dump(com_load_typelib($typelib));
?>
-===DONE===
--EXPECT--
bool(true)
bool(true)
-===DONE===
diff --git a/ext/com_dotnet/tests/bug66431_0.phpt b/ext/com_dotnet/tests/bug66431_0.phpt
index e022c18e12..4a0062a7e1 100644
--- a/ext/com_dotnet/tests/bug66431_0.phpt
+++ b/ext/com_dotnet/tests/bug66431_0.phpt
@@ -22,12 +22,11 @@ $result = ($check_text == $text);
var_dump($result);
if (!$result) {
- echo "Expected: '$check_text'\n";
- echo "Have: '$text'\n";
+ echo "Expected: '$check_text'\n";
+ echo "Have: '$text'\n";
}
?>
-===DONE===
--CLEAN--
<?php
@@ -39,4 +38,3 @@ if (file_exists($fpath)) {
?>
--EXPECT--
bool(true)
-===DONE===
diff --git a/ext/com_dotnet/tests/bug66431_1.phpt b/ext/com_dotnet/tests/bug66431_1.phpt
index e68e411125..e99131d27b 100644
--- a/ext/com_dotnet/tests/bug66431_1.phpt
+++ b/ext/com_dotnet/tests/bug66431_1.phpt
@@ -40,12 +40,11 @@ $result = (trim($check_text) == $text);
var_dump($result);
if (!$result) {
- echo "Expected: '$check_text'\n";
- echo "Have: '$text'\n";
+ echo "Expected: '$check_text'\n";
+ echo "Have: '$text'\n";
}
?>
-===DONE===
--CLEAN--
<?php
@@ -57,4 +56,3 @@ if (file_exists($fpath)) {
?>
--EXPECT--
bool(true)
-===DONE===
diff --git a/ext/com_dotnet/tests/bug77177.phpt b/ext/com_dotnet/tests/bug77177.phpt
index 901358248c..8fcfd5a378 100644
--- a/ext/com_dotnet/tests/bug77177.phpt
+++ b/ext/com_dotnet/tests/bug77177.phpt
@@ -31,7 +31,6 @@ foreach ($strings as $string) {
var_dump(unserialize($string));
}
?>
-===DONE===
--EXPECTF--
Exception: Serialization of 'com' is not allowed
Exception: Serialization of 'dotnet' is not allowed
@@ -54,4 +53,3 @@ Warning: Erroneous data format for unserializing 'variant' in %s on line %d
Notice: unserialize(): Error at offset 17 of 18 bytes in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/com_dotnet/tests/bug77578.phpt b/ext/com_dotnet/tests/bug77578.phpt
index e68494468e..910f24909b 100644
--- a/ext/com_dotnet/tests/bug77578.phpt
+++ b/ext/com_dotnet/tests/bug77578.phpt
@@ -15,9 +15,7 @@ $command = "$php $iniopt -d com.autoregister_typelib=1 -r \"new COM('WbemScripti
exec($command, $output, $status);
var_dump($output, $status);
?>
-===DONE===
--EXPECT--
array(0) {
}
int(0)
-===DONE===
diff --git a/ext/com_dotnet/tests/bug77621.phpt b/ext/com_dotnet/tests/bug77621.phpt
index 5c24494637..32e879dcd0 100644
--- a/ext/com_dotnet/tests/bug77621.phpt
+++ b/ext/com_dotnet/tests/bug77621.phpt
@@ -12,7 +12,5 @@ define('ADSTYPE_INVALID', 0);
$root = dirname(array_change_key_case($_SERVER, CASE_UPPER)['COMSPEC']);
com_load_typelib("$root\activeds.tlb");
?>
-===DONE===
--EXPECTF--
Warning: com_load_typelib(): Type library constant ADSTYPE_INVALID is already defined in %s on line %d
-===DONE===
diff --git a/ext/com_dotnet/tests/variants.phpt b/ext/com_dotnet/tests/variants.phpt
index a99e896680..0bcd473f61 100644
--- a/ext/com_dotnet/tests/variants.phpt
+++ b/ext/com_dotnet/tests/variants.phpt
@@ -10,34 +10,34 @@ error_reporting(E_ALL);
$v = new VARIANT();
if (VT_EMPTY != variant_get_type($v)) {
- echo "VT_EMPTY: bork\n";
+ echo "VT_EMPTY: bork\n";
}
$values = array(VT_I4 => 42, VT_R8 => 3.5, VT_BSTR => "hello", VT_BOOL => false);
$binary_ops = array('add', 'cat', 'sub', 'mul', 'and', 'div',
- 'eqv', 'idiv', 'imp', 'mod', 'or', 'pow', 'xor');
+ 'eqv', 'idiv', 'imp', 'mod', 'or', 'pow', 'xor');
foreach ($values as $t => $val) {
- $v = new VARIANT($val);
- if ($t != variant_get_type($v)) {
- printf("Bork: [%d] %d: %s\n", $t, variant_get_type($v), $val);
- print $v . "\n";
- }
- $results = array();
-
- foreach ($values as $op2) {
- echo "--\n";
- foreach ($binary_ops as $op) {
- try {
- echo "$op: " . call_user_func('variant_' . $op, $v, $op2) . "\n";
- } catch (com_exception $e) {
- echo "$op:\n";
- echo "\tvariant_$op($v, $op2)\n";
- echo "\texception " . $e->getMessage();
- printf("\tcode %08x\n\n", $e->getCode());
- }
- }
- }
+ $v = new VARIANT($val);
+ if ($t != variant_get_type($v)) {
+ printf("Bork: [%d] %d: %s\n", $t, variant_get_type($v), $val);
+ print $v . "\n";
+ }
+ $results = array();
+
+ foreach ($values as $op2) {
+ echo "--\n";
+ foreach ($binary_ops as $op) {
+ try {
+ echo "$op: " . call_user_func('variant_' . $op, $v, $op2) . "\n";
+ } catch (com_exception $e) {
+ echo "$op:\n";
+ echo "\tvariant_$op($v, $op2)\n";
+ echo "\texception " . $e->getMessage();
+ printf("\tcode %08x\n\n", $e->getCode());
+ }
+ }
+ }
}
echo "OK!";
diff --git a/ext/com_dotnet/tests/variants_x64.phpt b/ext/com_dotnet/tests/variants_x64.phpt
index e9e7c23b97..88f9f3e126 100644
--- a/ext/com_dotnet/tests/variants_x64.phpt
+++ b/ext/com_dotnet/tests/variants_x64.phpt
@@ -13,34 +13,34 @@ error_reporting(E_ALL);
$v = new VARIANT();
if (VT_EMPTY != variant_get_type($v)) {
- echo "VT_EMPTY: bork\n";
+ echo "VT_EMPTY: bork\n";
}
$values = array(VT_I8 => 42, VT_R8 => 3.5, VT_BSTR => "hello", VT_BOOL => false);
$binary_ops = array('add', 'cat', 'sub', 'mul', 'and', 'div',
- 'eqv', 'idiv', 'imp', 'mod', 'or', 'pow', 'xor');
+ 'eqv', 'idiv', 'imp', 'mod', 'or', 'pow', 'xor');
foreach ($values as $t => $val) {
- $v = new VARIANT($val);
- if ($t != variant_get_type($v)) {
- printf("Bork: [%d] %d: %s\n", $t, variant_get_type($v), $val);
- print $v . "\n";
- }
- $results = array();
-
- foreach ($values as $op2) {
- echo "--\n";
- foreach ($binary_ops as $op) {
- try {
- echo "$op: " . call_user_func('variant_' . $op, $v, $op2) . "\n";
- } catch (com_exception $e) {
- echo "$op:\n";
- echo "\tvariant_$op($v, $op2)\n";
- echo "\texception " . $e->getMessage();
- printf("\tcode %08x\n\n", $e->getCode());
- }
- }
- }
+ $v = new VARIANT($val);
+ if ($t != variant_get_type($v)) {
+ printf("Bork: [%d] %d: %s\n", $t, variant_get_type($v), $val);
+ print $v . "\n";
+ }
+ $results = array();
+
+ foreach ($values as $op2) {
+ echo "--\n";
+ foreach ($binary_ops as $op) {
+ try {
+ echo "$op: " . call_user_func('variant_' . $op, $v, $op2) . "\n";
+ } catch (com_exception $e) {
+ echo "$op:\n";
+ echo "\tvariant_$op($v, $op2)\n";
+ echo "\texception " . $e->getMessage();
+ printf("\tcode %08x\n\n", $e->getCode());
+ }
+ }
+ }
}
echo "OK!";
diff --git a/ext/ctype/ctype.c b/ext/ctype/ctype.c
index d12976df18..0e80cad16a 100644
--- a/ext/ctype/ctype.c
+++ b/ext/ctype/ctype.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -23,6 +21,7 @@
#include "php.h"
#include "php_ini.h"
#include "php_ctype.h"
+#include "ctype_arginfo.h"
#include "SAPI.h"
#include "ext/standard/info.h"
@@ -43,52 +42,6 @@ static PHP_FUNCTION(ctype_punct);
static PHP_FUNCTION(ctype_space);
static PHP_FUNCTION(ctype_upper);
static PHP_FUNCTION(ctype_xdigit);
-
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO(arginfo_ctype_alnum, 0)
- ZEND_ARG_INFO(0, text)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ctype_alpha, 0)
- ZEND_ARG_INFO(0, text)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ctype_cntrl, 0)
- ZEND_ARG_INFO(0, text)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ctype_digit, 0)
- ZEND_ARG_INFO(0, text)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ctype_lower, 0)
- ZEND_ARG_INFO(0, text)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ctype_graph, 0)
- ZEND_ARG_INFO(0, text)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ctype_print, 0)
- ZEND_ARG_INFO(0, text)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ctype_punct, 0)
- ZEND_ARG_INFO(0, text)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ctype_space, 0)
- ZEND_ARG_INFO(0, text)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ctype_upper, 0)
- ZEND_ARG_INFO(0, text)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ctype_xdigit, 0)
- ZEND_ARG_INFO(0, text)
-ZEND_END_ARG_INFO()
-
/* }}} */
/* {{{ ctype_functions[]
diff --git a/ext/ctype/ctype.stub.php b/ext/ctype/ctype.stub.php
new file mode 100644
index 0000000000..7bcc44e6ae
--- /dev/null
+++ b/ext/ctype/ctype.stub.php
@@ -0,0 +1,23 @@
+<?php
+
+function ctype_alnum($text): bool {}
+
+function ctype_alpha($text): bool {}
+
+function ctype_cntrl($text): bool {}
+
+function ctype_digit($text): bool {}
+
+function ctype_lower($text): bool {}
+
+function ctype_graph($text): bool {}
+
+function ctype_print($text): bool {}
+
+function ctype_punct($text): bool {}
+
+function ctype_space($text): bool {}
+
+function ctype_upper($text): bool {}
+
+function ctype_xdigit($text): bool {}
diff --git a/ext/ctype/ctype_arginfo.h b/ext/ctype/ctype_arginfo.h
new file mode 100644
index 0000000000..d22d9d3d69
--- /dev/null
+++ b/ext/ctype/ctype_arginfo.h
@@ -0,0 +1,25 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ctype_alnum, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, text)
+ZEND_END_ARG_INFO()
+
+#define arginfo_ctype_alpha arginfo_ctype_alnum
+
+#define arginfo_ctype_cntrl arginfo_ctype_alnum
+
+#define arginfo_ctype_digit arginfo_ctype_alnum
+
+#define arginfo_ctype_lower arginfo_ctype_alnum
+
+#define arginfo_ctype_graph arginfo_ctype_alnum
+
+#define arginfo_ctype_print arginfo_ctype_alnum
+
+#define arginfo_ctype_punct arginfo_ctype_alnum
+
+#define arginfo_ctype_space arginfo_ctype_alnum
+
+#define arginfo_ctype_upper arginfo_ctype_alnum
+
+#define arginfo_ctype_xdigit arginfo_ctype_alnum
diff --git a/ext/ctype/php_ctype.h b/ext/ctype/php_ctype.h
index 3265f50e06..4fb5d93a09 100644
--- a/ext/ctype/php_ctype.h
+++ b/ext/ctype/php_ctype.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/ctype/tests/001.phpt b/ext/ctype/tests/001.phpt
index edb1f52ab0..1351faed94 100644
--- a/ext/ctype/tests/001.phpt
+++ b/ext/ctype/tests/001.phpt
@@ -9,9 +9,9 @@ ctype on integers
function ctype_test_001($function) {
$n=0;
for($a=0;$a<256;$a++) {
- if($function($a)) $n++;
+ if($function($a)) $n++;
}
- echo "$function $n\n";
+ echo "$function $n\n";
}
ctype_test_001("ctype_lower");
ctype_test_001("ctype_upper");
diff --git a/ext/ctype/tests/002.phpt b/ext/ctype/tests/002.phpt
index e949db3992..b1dd87f306 100644
--- a/ext/ctype/tests/002.phpt
+++ b/ext/ctype/tests/002.phpt
@@ -9,15 +9,15 @@ setlocale(LC_ALL,"C");
print "LOCALE is '" . setlocale(LC_ALL,0) . "'\n";
function ctype_test_002($function) {
- $n1 = $n2 = $n3 = 0;
- // test portable POSIX characters 0..127
- for ($a=0;$a<128;$a++) {
- $c = chr($a);
- if($function($a)) $n1++;
- if($function("$c$c$c")) $n2++;
- if($function("1-$c$c$c-x")) $n3++;
- }
- print "$function $n1 $n2 $n3\n";
+ $n1 = $n2 = $n3 = 0;
+ // test portable POSIX characters 0..127
+ for ($a=0;$a<128;$a++) {
+ $c = chr($a);
+ if($function($a)) $n1++;
+ if($function("$c$c$c")) $n2++;
+ if($function("1-$c$c$c-x")) $n3++;
+ }
+ print "$function $n1 $n2 $n3\n";
}
ctype_test_002("ctype_lower");
diff --git a/ext/ctype/tests/bug25745.phpt b/ext/ctype/tests/bug25745.phpt
index ecacebbed6..3996dd8242 100644
--- a/ext/ctype/tests/bug25745.phpt
+++ b/ext/ctype/tests/bug25745.phpt
@@ -5,20 +5,20 @@ Bug #25745 (ctype functions fail with non-ascii characters)
--FILE--
<?php
$funcs = array(
- "ctype_alnum", "ctype_alpha", "ctype_cntrl", "ctype_digit",
- "ctype_graph", "ctype_lower", "ctype_print", "ctype_punct",
- "ctype_space", "ctype_upper", "ctype_xdigit"
+ "ctype_alnum", "ctype_alpha", "ctype_cntrl", "ctype_digit",
+ "ctype_graph", "ctype_lower", "ctype_print", "ctype_punct",
+ "ctype_space", "ctype_upper", "ctype_xdigit"
);
foreach ($funcs as $ctype_func) {
- for ($i = 0; $i < 256; $i++) {
- $a = $ctype_func($i);
- $b = $ctype_func(chr($i));
- if ($a != $b) {
- echo "broken... $ctype_func($i) = $a, $ctype_func(chr($i)) = $b\n";
- exit;
- }
- }
+ for ($i = 0; $i < 256; $i++) {
+ $a = $ctype_func($i);
+ $b = $ctype_func(chr($i));
+ if ($a != $b) {
+ echo "broken... $ctype_func($i) = $a, $ctype_func(chr($i)) = $b\n";
+ exit;
+ }
+ }
}
echo "ok\n";
?>
diff --git a/ext/ctype/tests/ctype_alnum_basic.phpt b/ext/ctype/tests/ctype_alnum_basic.phpt
index 0ff710e31e..0931fe4893 100644
--- a/ext/ctype/tests/ctype_alnum_basic.phpt
+++ b/ext/ctype/tests/ctype_alnum_basic.phpt
@@ -21,9 +21,7 @@ var_dump(ctype_alnum($c2));
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_alnum() : basic functionality ***
bool(true)
bool(false)
-===DONE===
diff --git a/ext/ctype/tests/ctype_alnum_variation1.phpt b/ext/ctype/tests/ctype_alnum_variation1.phpt
index 3818ec6b89..c86b926215 100644
--- a/ext/ctype/tests/ctype_alnum_variation1.phpt
+++ b/ext/ctype/tests/ctype_alnum_variation1.phpt
@@ -98,7 +98,6 @@ fclose($fp);
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_alnum() : usage variations ***
@@ -176,4 +175,3 @@ bool(false)
-- Iteration 25 --
bool(false)
-===DONE===
diff --git a/ext/ctype/tests/ctype_alnum_variation2.phpt b/ext/ctype/tests/ctype_alnum_variation2.phpt
index 3e802dea88..0898190d17 100644
--- a/ext/ctype/tests/ctype_alnum_variation2.phpt
+++ b/ext/ctype/tests/ctype_alnum_variation2.phpt
@@ -19,14 +19,13 @@ echo "*** Testing ctype_alnum() : usage variations ***\n";
$orig = setlocale(LC_CTYPE, "C");
for ($i = 0; $i < 256; $i++) {
- if (ctype_alnum($i)) {
- echo "character code $i is alpha numeric\n";
- }
+ if (ctype_alnum($i)) {
+ echo "character code $i is alpha numeric\n";
+ }
}
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_alnum() : usage variations ***
character code 48 is alpha numeric
@@ -91,4 +90,3 @@ character code 119 is alpha numeric
character code 120 is alpha numeric
character code 121 is alpha numeric
character code 122 is alpha numeric
-===DONE===
diff --git a/ext/ctype/tests/ctype_alnum_variation3.phpt b/ext/ctype/tests/ctype_alnum_variation3.phpt
index 1f21f7d3bc..1fbf5b49f8 100644
--- a/ext/ctype/tests/ctype_alnum_variation3.phpt
+++ b/ext/ctype/tests/ctype_alnum_variation3.phpt
@@ -54,7 +54,6 @@ foreach($values as $value) {
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_alnum() : usage variations ***
@@ -126,4 +125,3 @@ bool(false)
-- Iteration 23 --
bool(false)
-===DONE===
diff --git a/ext/ctype/tests/ctype_alnum_variation4.phpt b/ext/ctype/tests/ctype_alnum_variation4.phpt
index c4f3a3dd75..64c6175806 100644
--- a/ext/ctype/tests/ctype_alnum_variation4.phpt
+++ b/ext/ctype/tests/ctype_alnum_variation4.phpt
@@ -23,22 +23,21 @@ $hex_values = array(0x30, 0x31, 0x32, 0x33);
echo "\n-- Octal Values --\n";
$iterator = 1;
foreach($octal_values as $c) {
- echo "-- Iteration $iterator --\n";
- var_dump(ctype_alnum($c));
- $iterator++;
+ echo "-- Iteration $iterator --\n";
+ var_dump(ctype_alnum($c));
+ $iterator++;
}
echo "\n-- Hexadecimal Values --\n";
$iterator = 1;
foreach($hex_values as $c) {
- echo "-- Iteration $iterator --\n";
- var_dump(ctype_alnum($c));
- $iterator++;
+ echo "-- Iteration $iterator --\n";
+ var_dump(ctype_alnum($c));
+ $iterator++;
}
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_alnum() : usage variations ***
@@ -61,4 +60,3 @@ bool(true)
bool(true)
-- Iteration 4 --
bool(true)
-===DONE===
diff --git a/ext/ctype/tests/ctype_alpha_basic.phpt b/ext/ctype/tests/ctype_alpha_basic.phpt
index bc7283f51a..28e1ca4e12 100644
--- a/ext/ctype/tests/ctype_alpha_basic.phpt
+++ b/ext/ctype/tests/ctype_alpha_basic.phpt
@@ -21,9 +21,7 @@ var_dump(ctype_alpha($c2));
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_alpha() : basic functionality ***
bool(true)
bool(false)
-===DONE===
diff --git a/ext/ctype/tests/ctype_alpha_variation1.phpt b/ext/ctype/tests/ctype_alpha_variation1.phpt
index 3e00766cd6..e96256df98 100644
--- a/ext/ctype/tests/ctype_alpha_variation1.phpt
+++ b/ext/ctype/tests/ctype_alpha_variation1.phpt
@@ -24,9 +24,9 @@ unset ($unset_var);
// get a class
class classA
{
- public function __toString() {
- return "abcdef";
- }
+ public function __toString() {
+ return "abcdef";
+ }
}
// heredoc string
@@ -98,7 +98,6 @@ fclose($fp);
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_alpha() : usage variations ***
@@ -176,4 +175,3 @@ bool(false)
-- Iteration 25 --
bool(false)
-===DONE===
diff --git a/ext/ctype/tests/ctype_alpha_variation2.phpt b/ext/ctype/tests/ctype_alpha_variation2.phpt
index 170e3f0c74..89777f9813 100644
--- a/ext/ctype/tests/ctype_alpha_variation2.phpt
+++ b/ext/ctype/tests/ctype_alpha_variation2.phpt
@@ -19,14 +19,13 @@ echo "*** Testing ctype_alpha() : usage variations ***\n";
$orig = setlocale(LC_CTYPE, "C");
for ($i = 0; $i < 256; $i++) {
- if (ctype_alpha($i)) {
- echo "character code $i is alphabetic\n";
- }
+ if (ctype_alpha($i)) {
+ echo "character code $i is alphabetic\n";
+ }
}
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_alpha() : usage variations ***
character code 65 is alphabetic
@@ -81,4 +80,3 @@ character code 119 is alphabetic
character code 120 is alphabetic
character code 121 is alphabetic
character code 122 is alphabetic
-===DONE===
diff --git a/ext/ctype/tests/ctype_alpha_variation3.phpt b/ext/ctype/tests/ctype_alpha_variation3.phpt
index 388ffe8d11..4eebef4e19 100644
--- a/ext/ctype/tests/ctype_alpha_variation3.phpt
+++ b/ext/ctype/tests/ctype_alpha_variation3.phpt
@@ -55,7 +55,6 @@ foreach($values as $value) {
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_alpha() : usage variations ***
@@ -127,4 +126,3 @@ bool(false)
-- Iteration 23 --
bool(false)
-===DONE===
diff --git a/ext/ctype/tests/ctype_alpha_variation4.phpt b/ext/ctype/tests/ctype_alpha_variation4.phpt
index 480bab79f0..ba801c6845 100644
--- a/ext/ctype/tests/ctype_alpha_variation4.phpt
+++ b/ext/ctype/tests/ctype_alpha_variation4.phpt
@@ -23,22 +23,21 @@ $hex_values = array (0x41, 0x42, 0x43, 0x44);
echo "\n-- Octal Values --\n";
$iterator = 1;
foreach($octal_values as $c) {
- echo "-- Iteration $iterator --\n";
- var_dump(ctype_alpha($c));
- $iterator++;
+ echo "-- Iteration $iterator --\n";
+ var_dump(ctype_alpha($c));
+ $iterator++;
}
echo "\n-- Hexadecimal Values --\n";
$iterator = 1;
foreach($hex_values as $c) {
- echo "-- Iteration $iterator --\n";
- var_dump(ctype_alpha($c));
- $iterator++;
+ echo "-- Iteration $iterator --\n";
+ var_dump(ctype_alpha($c));
+ $iterator++;
}
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_alpha() : usage variations ***
@@ -61,4 +60,3 @@ bool(true)
bool(true)
-- Iteration 4 --
bool(true)
-===DONE===
diff --git a/ext/ctype/tests/ctype_cntrl_basic.phpt b/ext/ctype/tests/ctype_cntrl_basic.phpt
index 1c1707eab2..bb6cd1c2df 100644
--- a/ext/ctype/tests/ctype_cntrl_basic.phpt
+++ b/ext/ctype/tests/ctype_cntrl_basic.phpt
@@ -21,9 +21,7 @@ var_dump(ctype_cntrl($c2));
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_cntrl() : basic functionality ***
bool(true)
bool(false)
-===DONE===
diff --git a/ext/ctype/tests/ctype_cntrl_variation1.phpt b/ext/ctype/tests/ctype_cntrl_variation1.phpt
index 72a1f5f783..9408d720f9 100644
--- a/ext/ctype/tests/ctype_cntrl_variation1.phpt
+++ b/ext/ctype/tests/ctype_cntrl_variation1.phpt
@@ -99,7 +99,6 @@ fclose($fp);
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_cntrl() : usage variations ***
@@ -177,4 +176,3 @@ bool(false)
-- Iteration 25 --
bool(false)
-===DONE===
diff --git a/ext/ctype/tests/ctype_cntrl_variation2.phpt b/ext/ctype/tests/ctype_cntrl_variation2.phpt
index 5a5ada8e36..411666608f 100644
--- a/ext/ctype/tests/ctype_cntrl_variation2.phpt
+++ b/ext/ctype/tests/ctype_cntrl_variation2.phpt
@@ -19,14 +19,13 @@ echo "*** Testing ctype_cntrl() : usage variations ***\n";
$orig = setlocale(LC_CTYPE, "C");
for ($i = 0; $i < 256; $i++) {
- if (ctype_cntrl($i)) {
- echo "character code $i is control character\n";
- }
+ if (ctype_cntrl($i)) {
+ echo "character code $i is control character\n";
+ }
}
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_cntrl() : usage variations ***
character code 0 is control character
@@ -62,4 +61,3 @@ character code 29 is control character
character code 30 is control character
character code 31 is control character
character code 127 is control character
-===DONE===
diff --git a/ext/ctype/tests/ctype_cntrl_variation3.phpt b/ext/ctype/tests/ctype_cntrl_variation3.phpt
index 31e2ee2ea1..9d21f89da1 100644
--- a/ext/ctype/tests/ctype_cntrl_variation3.phpt
+++ b/ext/ctype/tests/ctype_cntrl_variation3.phpt
@@ -62,7 +62,6 @@ foreach($values as $value) {
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_cntrl() : usage variations ***
@@ -155,4 +154,3 @@ bool(false)
-- Iteration 30 --
bool(true)
-===DONE===
diff --git a/ext/ctype/tests/ctype_cntrl_variation4.phpt b/ext/ctype/tests/ctype_cntrl_variation4.phpt
index dfad6ba2d8..0a2e1260df 100644
--- a/ext/ctype/tests/ctype_cntrl_variation4.phpt
+++ b/ext/ctype/tests/ctype_cntrl_variation4.phpt
@@ -23,21 +23,20 @@ $hex_values = array(0x1, 0x2, 0x3, 0x4);
echo "\n-- Octal Values --\n";
$iterator = 1;
foreach($octal_values as $c) {
- echo "-- Iteration $iterator --\n";
- var_dump(ctype_cntrl($c));
- $iterator++;
+ echo "-- Iteration $iterator --\n";
+ var_dump(ctype_cntrl($c));
+ $iterator++;
}
echo "\n-- Hexadecimal Values --\n";
$iterator = 1;
foreach($hex_values as $c) {
- echo "-- Iteration $iterator --\n";
- var_dump(ctype_cntrl($c));
- $iterator++;
+ echo "-- Iteration $iterator --\n";
+ var_dump(ctype_cntrl($c));
+ $iterator++;
}
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_cntrl() : usage variations ***
@@ -60,4 +59,3 @@ bool(true)
bool(true)
-- Iteration 4 --
bool(true)
-===DONE===
diff --git a/ext/ctype/tests/ctype_digit_basic.phpt b/ext/ctype/tests/ctype_digit_basic.phpt
index faf75251db..3f60ad6f40 100644
--- a/ext/ctype/tests/ctype_digit_basic.phpt
+++ b/ext/ctype/tests/ctype_digit_basic.phpt
@@ -21,9 +21,7 @@ var_dump(ctype_digit($c2));
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_digit() : basic functionality ***
bool(true)
bool(false)
-===DONE===
diff --git a/ext/ctype/tests/ctype_digit_variation1.phpt b/ext/ctype/tests/ctype_digit_variation1.phpt
index 7233595139..77ddc21ce4 100644
--- a/ext/ctype/tests/ctype_digit_variation1.phpt
+++ b/ext/ctype/tests/ctype_digit_variation1.phpt
@@ -24,9 +24,9 @@ unset ($unset_var);
// get a class
class classA
{
- public function __toString() {
- return "123456";
- }
+ public function __toString() {
+ return "123456";
+ }
}
// heredoc string
@@ -98,7 +98,6 @@ fclose($fp);
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_digit() : usage variations ***
@@ -176,4 +175,3 @@ bool(false)
-- Iteration 25 --
bool(false)
-===DONE===
diff --git a/ext/ctype/tests/ctype_digit_variation2.phpt b/ext/ctype/tests/ctype_digit_variation2.phpt
index f4e3514aaf..9b5c1fb679 100644
--- a/ext/ctype/tests/ctype_digit_variation2.phpt
+++ b/ext/ctype/tests/ctype_digit_variation2.phpt
@@ -19,14 +19,13 @@ echo "*** Testing ctype_digit() : usage variations ***\n";
$orig = setlocale(LC_CTYPE, "C");
for ($i = 0; $i < 256; $i++) {
- if (ctype_digit($i)) {
- echo "character code $i is a numeric digit\n";
- }
+ if (ctype_digit($i)) {
+ echo "character code $i is a numeric digit\n";
+ }
}
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_digit() : usage variations ***
character code 48 is a numeric digit
@@ -39,4 +38,3 @@ character code 54 is a numeric digit
character code 55 is a numeric digit
character code 56 is a numeric digit
character code 57 is a numeric digit
-===DONE===
diff --git a/ext/ctype/tests/ctype_digit_variation3.phpt b/ext/ctype/tests/ctype_digit_variation3.phpt
index 5c428f6b30..a042984a99 100644
--- a/ext/ctype/tests/ctype_digit_variation3.phpt
+++ b/ext/ctype/tests/ctype_digit_variation3.phpt
@@ -61,7 +61,6 @@ foreach($values as $value) {
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_digit() : usage variations ***
@@ -157,4 +156,3 @@ bool(false)
-- Iteration 31 --
bool(false)
-===DONE===
diff --git a/ext/ctype/tests/ctype_digit_variation4.phpt b/ext/ctype/tests/ctype_digit_variation4.phpt
index 19e8a0cf4c..2c87759ddd 100644
--- a/ext/ctype/tests/ctype_digit_variation4.phpt
+++ b/ext/ctype/tests/ctype_digit_variation4.phpt
@@ -23,22 +23,21 @@ $hex_values = array (0x31, 0x32, 0x33, 0x34);
echo "\n-- Octal Values --\n";
$iterator = 1;
foreach($octal_values as $c) {
- echo "-- Iteration $iterator --\n";
- var_dump(ctype_digit($c));
- $iterator++;
+ echo "-- Iteration $iterator --\n";
+ var_dump(ctype_digit($c));
+ $iterator++;
}
echo "\n-- Hexadecimal Values --\n";
$iterator = 1;
foreach($hex_values as $c) {
- echo "-- Iteration $iterator --\n";
- var_dump(ctype_digit($c));
- $iterator++;
+ echo "-- Iteration $iterator --\n";
+ var_dump(ctype_digit($c));
+ $iterator++;
}
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_digit() : usage variations ***
@@ -61,4 +60,3 @@ bool(true)
bool(true)
-- Iteration 4 --
bool(true)
-===DONE===
diff --git a/ext/ctype/tests/ctype_graph_basic.phpt b/ext/ctype/tests/ctype_graph_basic.phpt
index d920728ac1..6acf210672 100644
--- a/ext/ctype/tests/ctype_graph_basic.phpt
+++ b/ext/ctype/tests/ctype_graph_basic.phpt
@@ -21,9 +21,7 @@ var_dump(ctype_graph($c2));
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_graph() : basic functionality ***
bool(true)
bool(false)
-===DONE===
diff --git a/ext/ctype/tests/ctype_graph_variation1.phpt b/ext/ctype/tests/ctype_graph_variation1.phpt
index 3105922fdc..2fb529ee88 100644
--- a/ext/ctype/tests/ctype_graph_variation1.phpt
+++ b/ext/ctype/tests/ctype_graph_variation1.phpt
@@ -24,9 +24,9 @@ unset ($unset_var);
// get a class
class classA
{
- public function __toString() {
- return "myClass";
- }
+ public function __toString() {
+ return "myClass";
+ }
}
// heredoc string
@@ -98,7 +98,6 @@ fclose($fp);
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_graph() : usage variations ***
@@ -176,4 +175,3 @@ bool(false)
-- Iteration 25 --
bool(false)
-===DONE===
diff --git a/ext/ctype/tests/ctype_graph_variation2.phpt b/ext/ctype/tests/ctype_graph_variation2.phpt
index cd8812d5d5..3c21133279 100644
--- a/ext/ctype/tests/ctype_graph_variation2.phpt
+++ b/ext/ctype/tests/ctype_graph_variation2.phpt
@@ -19,14 +19,13 @@ echo "*** Testing ctype_graph() : usage variations ***\n";
$orig = setlocale(LC_CTYPE, "C");
for ($i = 0; $i < 256; $i++) {
- if (ctype_graph($i)) {
- echo "character code $i is a printable character\n";
- }
+ if (ctype_graph($i)) {
+ echo "character code $i is a printable character\n";
+ }
}
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_graph() : usage variations ***
character code 33 is a printable character
@@ -123,4 +122,3 @@ character code 123 is a printable character
character code 124 is a printable character
character code 125 is a printable character
character code 126 is a printable character
-===DONE===
diff --git a/ext/ctype/tests/ctype_graph_variation3.phpt b/ext/ctype/tests/ctype_graph_variation3.phpt
index d28cdec8e1..e6dac7c775 100644
--- a/ext/ctype/tests/ctype_graph_variation3.phpt
+++ b/ext/ctype/tests/ctype_graph_variation3.phpt
@@ -58,7 +58,6 @@ foreach($values as $value) {
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_graph() : usage variations ***
@@ -145,4 +144,3 @@ bool(false)
-- Iteration 28 --
bool(false)
-===DONE===
diff --git a/ext/ctype/tests/ctype_graph_variation4.phpt b/ext/ctype/tests/ctype_graph_variation4.phpt
index 389f7a47ff..3b3b028002 100644
--- a/ext/ctype/tests/ctype_graph_variation4.phpt
+++ b/ext/ctype/tests/ctype_graph_variation4.phpt
@@ -23,22 +23,21 @@ $hex_values = array (0x31, 0x32, 0x33, 0x34);
echo "\n-- Octal Values --\n";
$iterator = 1;
foreach($octal_values as $c) {
- echo "-- Iteration $iterator --\n";
- var_dump(ctype_graph($c));
- $iterator++;
+ echo "-- Iteration $iterator --\n";
+ var_dump(ctype_graph($c));
+ $iterator++;
}
echo "\n-- Hexadecimal Values --\n";
$iterator = 1;
foreach($hex_values as $c) {
- echo "-- Iteration $iterator --\n";
- var_dump(ctype_graph($c));
- $iterator++;
+ echo "-- Iteration $iterator --\n";
+ var_dump(ctype_graph($c));
+ $iterator++;
}
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_graph() : usage variations ***
@@ -61,4 +60,3 @@ bool(true)
bool(true)
-- Iteration 4 --
bool(true)
-===DONE===
diff --git a/ext/ctype/tests/ctype_lower_basic.phpt b/ext/ctype/tests/ctype_lower_basic.phpt
index c9fdf3cc94..0009460df0 100644
--- a/ext/ctype/tests/ctype_lower_basic.phpt
+++ b/ext/ctype/tests/ctype_lower_basic.phpt
@@ -21,9 +21,7 @@ var_dump(ctype_lower($c2));
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_lower() : basic functionality ***
bool(true)
bool(false)
-===DONE===
diff --git a/ext/ctype/tests/ctype_lower_variation1.phpt b/ext/ctype/tests/ctype_lower_variation1.phpt
index e47fb9e1a2..94ff0f1654 100644
--- a/ext/ctype/tests/ctype_lower_variation1.phpt
+++ b/ext/ctype/tests/ctype_lower_variation1.phpt
@@ -24,9 +24,9 @@ unset ($unset_var);
// get a class
class classA
{
- public function __toString() {
- return "class";
- }
+ public function __toString() {
+ return "class";
+ }
}
// heredoc string
@@ -89,16 +89,15 @@ $inputs = array(
// loop through each element of $inputs to check the behavior of ctype_lower()
$iterator = 1;
foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump( ctype_lower($input) );
- $iterator++;
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( ctype_lower($input) );
+ $iterator++;
};
fclose($fp);
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_lower() : usage variations ***
@@ -176,4 +175,3 @@ bool(false)
-- Iteration 25 --
bool(false)
-===DONE===
diff --git a/ext/ctype/tests/ctype_lower_variation2.phpt b/ext/ctype/tests/ctype_lower_variation2.phpt
index 12793d180f..ca96134b88 100644
--- a/ext/ctype/tests/ctype_lower_variation2.phpt
+++ b/ext/ctype/tests/ctype_lower_variation2.phpt
@@ -19,14 +19,13 @@ echo "*** Testing ctype_lower() : usage variations ***\n";
$orig = setlocale(LC_CTYPE, "C");
for ($i = 0; $i < 256; $i++) {
- if (ctype_lower($i)) {
- echo "character code $i is a lower case character\n";
- }
+ if (ctype_lower($i)) {
+ echo "character code $i is a lower case character\n";
+ }
}
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_lower() : usage variations ***
character code 97 is a lower case character
@@ -55,4 +54,3 @@ character code 119 is a lower case character
character code 120 is a lower case character
character code 121 is a lower case character
character code 122 is a lower case character
-===DONE===
diff --git a/ext/ctype/tests/ctype_lower_variation3.phpt b/ext/ctype/tests/ctype_lower_variation3.phpt
index 7ba92e47dd..cdaa61da3e 100644
--- a/ext/ctype/tests/ctype_lower_variation3.phpt
+++ b/ext/ctype/tests/ctype_lower_variation3.phpt
@@ -56,7 +56,6 @@ foreach($values as $value) {
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_lower() : usage variations ***
@@ -137,4 +136,3 @@ bool(false)
-- Iteration 26 --
bool(false)
-===DONE===
diff --git a/ext/ctype/tests/ctype_lower_variation4.phpt b/ext/ctype/tests/ctype_lower_variation4.phpt
index 835fc011ff..a47074ed20 100644
--- a/ext/ctype/tests/ctype_lower_variation4.phpt
+++ b/ext/ctype/tests/ctype_lower_variation4.phpt
@@ -23,22 +23,21 @@ $hex_values = array (0x61, 0x62, 0x63, 0x64);
echo "\n-- Octal Values --\n";
$iterator = 1;
foreach($octal_values as $c) {
- echo "-- Iteration $iterator --\n";
- var_dump(ctype_lower($c));
- $iterator++;
+ echo "-- Iteration $iterator --\n";
+ var_dump(ctype_lower($c));
+ $iterator++;
}
echo "\n-- Hexadecimal Values --\n";
$iterator = 1;
foreach($hex_values as $c) {
- echo "-- Iteration $iterator --\n";
- var_dump(ctype_lower($c));
- $iterator++;
+ echo "-- Iteration $iterator --\n";
+ var_dump(ctype_lower($c));
+ $iterator++;
}
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_lower() : usage variations ***
@@ -61,4 +60,3 @@ bool(true)
bool(true)
-- Iteration 4 --
bool(true)
-===DONE===
diff --git a/ext/ctype/tests/ctype_print_basic.phpt b/ext/ctype/tests/ctype_print_basic.phpt
index 33a70fe735..15228391e1 100644
--- a/ext/ctype/tests/ctype_print_basic.phpt
+++ b/ext/ctype/tests/ctype_print_basic.phpt
@@ -21,9 +21,7 @@ var_dump(ctype_print($c2));
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_print() : basic functionality ***
bool(true)
bool(false)
-===DONE===
diff --git a/ext/ctype/tests/ctype_print_variation1.phpt b/ext/ctype/tests/ctype_print_variation1.phpt
index 7599b259da..3e4bef3e53 100644
--- a/ext/ctype/tests/ctype_print_variation1.phpt
+++ b/ext/ctype/tests/ctype_print_variation1.phpt
@@ -24,9 +24,9 @@ unset ($unset_var);
// get a class
class classA
{
- public function __toString() {
- return "Class A object";
- }
+ public function __toString() {
+ return "Class A object";
+ }
}
// heredoc string
@@ -98,7 +98,6 @@ fclose($fp);
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_print() : usage variations ***
@@ -176,4 +175,3 @@ bool(false)
-- Iteration 25 --
bool(false)
-===DONE===
diff --git a/ext/ctype/tests/ctype_print_variation2.phpt b/ext/ctype/tests/ctype_print_variation2.phpt
index 1573bed988..c2151fa34c 100644
--- a/ext/ctype/tests/ctype_print_variation2.phpt
+++ b/ext/ctype/tests/ctype_print_variation2.phpt
@@ -19,14 +19,13 @@ echo "*** Testing ctype_print() : usage variations ***\n";
$orig = setlocale(LC_CTYPE, "C");
for ($i = 0; $i < 256; $i++) {
- if (ctype_print($i)) {
- echo "character code $i is a printable character\n";
- }
+ if (ctype_print($i)) {
+ echo "character code $i is a printable character\n";
+ }
}
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_print() : usage variations ***
character code 32 is a printable character
@@ -124,4 +123,3 @@ character code 123 is a printable character
character code 124 is a printable character
character code 125 is a printable character
character code 126 is a printable character
-===DONE===
diff --git a/ext/ctype/tests/ctype_print_variation3.phpt b/ext/ctype/tests/ctype_print_variation3.phpt
index b669150ada..7b11032732 100644
--- a/ext/ctype/tests/ctype_print_variation3.phpt
+++ b/ext/ctype/tests/ctype_print_variation3.phpt
@@ -53,7 +53,6 @@ foreach($values as $value) {
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_print() : usage variations ***
@@ -125,4 +124,3 @@ bool(true)
-- Iteration 23 --
bool(false)
-===DONE===
diff --git a/ext/ctype/tests/ctype_print_variation4.phpt b/ext/ctype/tests/ctype_print_variation4.phpt
index 7d1ed99284..05cfe8fbde 100644
--- a/ext/ctype/tests/ctype_print_variation4.phpt
+++ b/ext/ctype/tests/ctype_print_variation4.phpt
@@ -23,21 +23,20 @@ $hex_values = array (0x20, 0x21, 0x23, 0x24);
echo "\n-- Octal Values --\n";
$iterator = 1;
foreach($octal_values as $c) {
- echo "-- Iteration $iterator --\n";
- var_dump(ctype_print($c));
- $iterator++;
+ echo "-- Iteration $iterator --\n";
+ var_dump(ctype_print($c));
+ $iterator++;
}
echo "\n-- Hexadecimal Values --\n";
$iterator = 1;
foreach($hex_values as $c) {
- echo "-- Iteration $iterator --\n";
- var_dump(ctype_print($c));
- $iterator++;
+ echo "-- Iteration $iterator --\n";
+ var_dump(ctype_print($c));
+ $iterator++;
}
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_print() : usage variations ***
@@ -60,4 +59,3 @@ bool(true)
bool(true)
-- Iteration 4 --
bool(true)
-===DONE===
diff --git a/ext/ctype/tests/ctype_punct_basic.phpt b/ext/ctype/tests/ctype_punct_basic.phpt
index 76a0278c05..93fff21783 100644
--- a/ext/ctype/tests/ctype_punct_basic.phpt
+++ b/ext/ctype/tests/ctype_punct_basic.phpt
@@ -22,9 +22,7 @@ var_dump(ctype_punct($c2));
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_punct() : basic functionality ***
bool(true)
bool(false)
-===DONE===
diff --git a/ext/ctype/tests/ctype_punct_variation1.phpt b/ext/ctype/tests/ctype_punct_variation1.phpt
index 740f1dae80..67abc10f64 100644
--- a/ext/ctype/tests/ctype_punct_variation1.phpt
+++ b/ext/ctype/tests/ctype_punct_variation1.phpt
@@ -99,7 +99,6 @@ fclose($fp);
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_punct() : usage variations ***
@@ -177,4 +176,3 @@ bool(false)
-- Iteration 25 --
bool(false)
-===DONE===
diff --git a/ext/ctype/tests/ctype_punct_variation2.phpt b/ext/ctype/tests/ctype_punct_variation2.phpt
index 50f4f2c6f0..9fcfef0e21 100644
--- a/ext/ctype/tests/ctype_punct_variation2.phpt
+++ b/ext/ctype/tests/ctype_punct_variation2.phpt
@@ -20,14 +20,13 @@ echo "*** Testing ctype_punct() : usage variations ***\n";
$orig = setlocale(LC_CTYPE, "C");
for ($c = 1; $c < 256; $c++) {
- if (ctype_punct($c)) {
- echo "character code $c is punctuation\n";
- }
+ if (ctype_punct($c)) {
+ echo "character code $c is punctuation\n";
+ }
}
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_punct() : usage variations ***
character code 33 is punctuation
@@ -62,4 +61,3 @@ character code 123 is punctuation
character code 124 is punctuation
character code 125 is punctuation
character code 126 is punctuation
-===DONE===
diff --git a/ext/ctype/tests/ctype_punct_variation3.phpt b/ext/ctype/tests/ctype_punct_variation3.phpt
index 14bf8affad..3d6989d173 100644
--- a/ext/ctype/tests/ctype_punct_variation3.phpt
+++ b/ext/ctype/tests/ctype_punct_variation3.phpt
@@ -56,7 +56,6 @@ foreach($values as $value) {
};
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_punct() : usage variations ***
@@ -137,4 +136,3 @@ bool(true)
-- Iteration 26 --
bool(false)
-===DONE===
diff --git a/ext/ctype/tests/ctype_punct_variation4.phpt b/ext/ctype/tests/ctype_punct_variation4.phpt
index 744d40e785..e96c12568e 100644
--- a/ext/ctype/tests/ctype_punct_variation4.phpt
+++ b/ext/ctype/tests/ctype_punct_variation4.phpt
@@ -24,22 +24,21 @@ $hex_values = array(0x21, 0x22, 0x23, 0x24);
echo "\n-- Octal Values --\n";
$iterator = 1;
foreach($octal_values as $c) {
- echo "-- Iteration $iterator --\n";
- var_dump(ctype_punct($c));
- $iterator++;
+ echo "-- Iteration $iterator --\n";
+ var_dump(ctype_punct($c));
+ $iterator++;
}
echo "\n-- Hexadecimal Values --\n";
$iterator = 1;
foreach($hex_values as $c) {
- echo "-- Iteration $iterator --\n";
- var_dump(ctype_punct($c));
- $iterator++;
+ echo "-- Iteration $iterator --\n";
+ var_dump(ctype_punct($c));
+ $iterator++;
}
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_punct() : usage variations ***
@@ -62,4 +61,3 @@ bool(true)
bool(true)
-- Iteration 4 --
bool(true)
-===DONE===
diff --git a/ext/ctype/tests/ctype_space_basic.phpt b/ext/ctype/tests/ctype_space_basic.phpt
index b66648e7a3..ab0255a5ff 100644
--- a/ext/ctype/tests/ctype_space_basic.phpt
+++ b/ext/ctype/tests/ctype_space_basic.phpt
@@ -21,9 +21,7 @@ var_dump(ctype_space($c2));
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_space() : basic functionality ***
bool(true)
bool(false)
-===DONE===
diff --git a/ext/ctype/tests/ctype_space_variation1.phpt b/ext/ctype/tests/ctype_space_variation1.phpt
index 5334b6c63a..7d16cd445e 100644
--- a/ext/ctype/tests/ctype_space_variation1.phpt
+++ b/ext/ctype/tests/ctype_space_variation1.phpt
@@ -24,14 +24,14 @@ unset ($unset_var);
// get a class
class classA
{
- public function __toString() {
- return "\n\t\r";
- }
+ public function __toString() {
+ return "\n\t\r";
+ }
}
// heredoc string
$heredoc = <<<EOT
-
+\t
EOT;
// get a resource variable
@@ -89,16 +89,15 @@ $inputs = array(
// loop through each element of $inputs to check the behavior of ctype_space()
$iterator = 1;
foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump( ctype_space($input) );
- $iterator++;
-};
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( ctype_space($input) );
+ $iterator++;
+}
fclose($fp);
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_space() : usage variations ***
@@ -176,4 +175,3 @@ bool(false)
-- Iteration 25 --
bool(false)
-===DONE===
diff --git a/ext/ctype/tests/ctype_space_variation2.phpt b/ext/ctype/tests/ctype_space_variation2.phpt
index ba706333e8..f11611d420 100644
--- a/ext/ctype/tests/ctype_space_variation2.phpt
+++ b/ext/ctype/tests/ctype_space_variation2.phpt
@@ -19,13 +19,12 @@ echo "*** Testing ctype_space() : usage variations ***\n";
$orig = setlocale(LC_CTYPE, "C");
for ($c = 1; $c < 256; $c++) {
- if (ctype_space($c)) {
- echo "character code $c is a space character\n";
- }
+ if (ctype_space($c)) {
+ echo "character code $c is a space character\n";
+ }
}
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_space() : usage variations ***
character code 9 is a space character
@@ -34,4 +33,3 @@ character code 11 is a space character
character code 12 is a space character
character code 13 is a space character
character code 32 is a space character
-===DONE===
diff --git a/ext/ctype/tests/ctype_space_variation3.phpt b/ext/ctype/tests/ctype_space_variation3.phpt
index 78ad296d27..dce5ff6a98 100644
--- a/ext/ctype/tests/ctype_space_variation3.phpt
+++ b/ext/ctype/tests/ctype_space_variation3.phpt
@@ -56,7 +56,6 @@ foreach($values as $value) {
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_space() : usage variations ***
@@ -137,4 +136,3 @@ bool(true)
-- Iteration 26 --
bool(true)
-===DONE===
diff --git a/ext/ctype/tests/ctype_space_variation4.phpt b/ext/ctype/tests/ctype_space_variation4.phpt
index 24a662b4cb..0447d4ec1f 100644
--- a/ext/ctype/tests/ctype_space_variation4.phpt
+++ b/ext/ctype/tests/ctype_space_variation4.phpt
@@ -23,21 +23,20 @@ $hex_values = array (0x9, 0xA, 0xB, 0xC, 0xD, 0x20);
echo "\n-- Octal Values --\n";
$iterator = 1;
foreach($octal_values as $c) {
- echo "-- Iteration $iterator --\n";
- var_dump(ctype_space($c));
- $iterator++;
+ echo "-- Iteration $iterator --\n";
+ var_dump(ctype_space($c));
+ $iterator++;
}
echo "\n-- Hexadecimal Values --\n";
$iterator = 1;
foreach($hex_values as $c) {
- echo "-- Iteration $iterator --\n";
- var_dump(ctype_space($c));
- $iterator++;
+ echo "-- Iteration $iterator --\n";
+ var_dump(ctype_space($c));
+ $iterator++;
}
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_space() : usage variations ***
@@ -68,4 +67,3 @@ bool(true)
bool(true)
-- Iteration 6 --
bool(true)
-===DONE===
diff --git a/ext/ctype/tests/ctype_upper_basic.phpt b/ext/ctype/tests/ctype_upper_basic.phpt
index a528123f94..3e0ce36eb8 100644
--- a/ext/ctype/tests/ctype_upper_basic.phpt
+++ b/ext/ctype/tests/ctype_upper_basic.phpt
@@ -21,9 +21,7 @@ var_dump(ctype_upper($c2));
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_upper() : basic functionality ***
bool(true)
bool(false)
-===DONE===
diff --git a/ext/ctype/tests/ctype_upper_variation1.phpt b/ext/ctype/tests/ctype_upper_variation1.phpt
index ac0fb29ad8..3cbbe33a33 100644
--- a/ext/ctype/tests/ctype_upper_variation1.phpt
+++ b/ext/ctype/tests/ctype_upper_variation1.phpt
@@ -24,9 +24,9 @@ unset ($unset_var);
// get a class
class classA
{
- public function __toString() {
- return "HELLO";
- }
+ public function __toString() {
+ return "HELLO";
+ }
}
// heredoc string
@@ -89,16 +89,15 @@ $inputs = array(
// loop through each element of $inputs to check the behavior of ctype_upper()
$iterator = 1;
foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump( ctype_upper($input) );
- $iterator++;
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( ctype_upper($input) );
+ $iterator++;
};
fclose($fp);
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_upper() : usage variations ***
@@ -176,4 +175,3 @@ bool(false)
-- Iteration 25 --
bool(false)
-===DONE===
diff --git a/ext/ctype/tests/ctype_upper_variation2.phpt b/ext/ctype/tests/ctype_upper_variation2.phpt
index 5026f7f1a5..645ead4471 100644
--- a/ext/ctype/tests/ctype_upper_variation2.phpt
+++ b/ext/ctype/tests/ctype_upper_variation2.phpt
@@ -18,14 +18,13 @@ echo "*** Testing ctype_upper() : usage variations ***\n";
$orig = setlocale(LC_CTYPE, "C");
for ($i = 0; $i < 256; $i++) {
- if (ctype_upper($i)) {
- echo "character code $i is a uppercase character\n";
- }
+ if (ctype_upper($i)) {
+ echo "character code $i is a uppercase character\n";
+ }
}
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_upper() : usage variations ***
character code 65 is a uppercase character
@@ -54,4 +53,3 @@ character code 87 is a uppercase character
character code 88 is a uppercase character
character code 89 is a uppercase character
character code 90 is a uppercase character
-===DONE===
diff --git a/ext/ctype/tests/ctype_upper_variation3.phpt b/ext/ctype/tests/ctype_upper_variation3.phpt
index 23dfe34369..610c92308b 100644
--- a/ext/ctype/tests/ctype_upper_variation3.phpt
+++ b/ext/ctype/tests/ctype_upper_variation3.phpt
@@ -55,7 +55,6 @@ foreach($values as $value) {
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_upper() : usage variations ***
@@ -136,4 +135,3 @@ bool(false)
-- Iteration 26 --
bool(false)
-===DONE===
diff --git a/ext/ctype/tests/ctype_upper_variation4.phpt b/ext/ctype/tests/ctype_upper_variation4.phpt
index ed001744e1..28e572a7c5 100644
--- a/ext/ctype/tests/ctype_upper_variation4.phpt
+++ b/ext/ctype/tests/ctype_upper_variation4.phpt
@@ -22,22 +22,21 @@ $hex_values = array(0x41, 0x42, 0x43, 0x44);
echo "\n-- Octal Values --\n";
$iterator = 1;
foreach($octal_values as $c) {
- echo "-- Iteration $iterator --\n";
- var_dump(ctype_upper($c));
- $iterator++;
+ echo "-- Iteration $iterator --\n";
+ var_dump(ctype_upper($c));
+ $iterator++;
}
echo "\n-- Hexadecimal Values --\n";
$iterator = 1;
foreach($hex_values as $c) {
- echo "-- Iteration $iterator --\n";
- var_dump(ctype_upper($c));
- $iterator++;
+ echo "-- Iteration $iterator --\n";
+ var_dump(ctype_upper($c));
+ $iterator++;
}
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_upper() : usage variations ***
@@ -60,4 +59,3 @@ bool(true)
bool(true)
-- Iteration 4 --
bool(true)
-===DONE===
diff --git a/ext/ctype/tests/ctype_xdigit_basic.phpt b/ext/ctype/tests/ctype_xdigit_basic.phpt
index 7fa2995b2d..d47e9290f8 100644
--- a/ext/ctype/tests/ctype_xdigit_basic.phpt
+++ b/ext/ctype/tests/ctype_xdigit_basic.phpt
@@ -20,9 +20,7 @@ var_dump(ctype_xdigit($c2));
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_xdigit() : basic functionality ***
bool(true)
bool(false)
-===DONE===
diff --git a/ext/ctype/tests/ctype_xdigit_variation1.phpt b/ext/ctype/tests/ctype_xdigit_variation1.phpt
index ddbbd1680a..4c183ef374 100644
--- a/ext/ctype/tests/ctype_xdigit_variation1.phpt
+++ b/ext/ctype/tests/ctype_xdigit_variation1.phpt
@@ -89,16 +89,15 @@ $inputs = array(
// loop through each element of $inputs to check the behavior of ctype_xdigit()
$iterator = 1;
foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump( ctype_xdigit($input) );
- $iterator++;
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( ctype_xdigit($input) );
+ $iterator++;
};
fclose($fp);
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_xdigit() : usage variations ***
@@ -176,4 +175,3 @@ bool(false)
-- Iteration 25 --
bool(false)
-===DONE===
diff --git a/ext/ctype/tests/ctype_xdigit_variation2.phpt b/ext/ctype/tests/ctype_xdigit_variation2.phpt
index 4927e6215a..bb2795c189 100644
--- a/ext/ctype/tests/ctype_xdigit_variation2.phpt
+++ b/ext/ctype/tests/ctype_xdigit_variation2.phpt
@@ -19,14 +19,13 @@ echo "*** Testing ctype_xdigit() : usage variations ***\n";
$orig = setlocale(LC_CTYPE, "C");
for($c = 1; $c < 256; $c++) {
- if (ctype_xdigit($c)) {
- echo "character code $c is a hexadecimal 'digit'\n";
- }
+ if (ctype_xdigit($c)) {
+ echo "character code $c is a hexadecimal 'digit'\n";
+ }
}
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_xdigit() : usage variations ***
character code 48 is a hexadecimal 'digit'
@@ -51,4 +50,3 @@ character code 99 is a hexadecimal 'digit'
character code 100 is a hexadecimal 'digit'
character code 101 is a hexadecimal 'digit'
character code 102 is a hexadecimal 'digit'
-===DONE===
diff --git a/ext/ctype/tests/ctype_xdigit_variation3.phpt b/ext/ctype/tests/ctype_xdigit_variation3.phpt
index 79f7776b99..bc8ca44d2a 100644
--- a/ext/ctype/tests/ctype_xdigit_variation3.phpt
+++ b/ext/ctype/tests/ctype_xdigit_variation3.phpt
@@ -56,7 +56,6 @@ foreach($values as $value) {
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_xdigit() : usage variations ***
@@ -137,4 +136,3 @@ bool(false)
-- Iteration 26 --
bool(false)
-===DONE===
diff --git a/ext/ctype/tests/ctype_xdigit_variation4.phpt b/ext/ctype/tests/ctype_xdigit_variation4.phpt
index fe97c3f3c2..9f7a88f3ab 100644
--- a/ext/ctype/tests/ctype_xdigit_variation4.phpt
+++ b/ext/ctype/tests/ctype_xdigit_variation4.phpt
@@ -35,25 +35,24 @@ $hex_values2 = array(0x61, 0x62, 0x63, 0x64);
echo "\n-- Octal values --\n";
echo "'Incorrect' Integers: \n";
foreach($octal_values1 as $c) {
- var_dump(ctype_xdigit($c));
+ var_dump(ctype_xdigit($c));
}
echo "'Correct' Integers: \n";
foreach($octal_values2 as $c) {
- var_dump(ctype_xdigit($c));
+ var_dump(ctype_xdigit($c));
}
echo "\n-- Hexadecimal values --\n";
echo "'Incorrect' Integers: \n";
foreach($hex_values1 as $c) {
- var_dump(ctype_xdigit($c));
+ var_dump(ctype_xdigit($c));
}
echo "'Correct' Integers: \n";
foreach($hex_values2 as $c) {
- var_dump(ctype_xdigit($c));
+ var_dump(ctype_xdigit($c));
}
setlocale(LC_CTYPE, $orig);
?>
-===DONE===
--EXPECT--
*** Testing ctype_xdigit() : usage variations ***
@@ -80,4 +79,3 @@ bool(true)
bool(true)
bool(true)
bool(true)
-===DONE===
diff --git a/ext/curl/config.m4 b/ext/curl/config.m4
index 5799aa8f90..051d97743b 100644
--- a/ext/curl/config.m4
+++ b/ext/curl/config.m4
@@ -4,7 +4,7 @@ PHP_ARG_WITH([curl],
[Include cURL support])])
if test "$PHP_CURL" != "no"; then
- PKG_CHECK_MODULES([CURL], [libcurl >= 7.15.5])
+ PKG_CHECK_MODULES([CURL], [libcurl >= 7.29.0])
PKG_CHECK_VAR([CURL_FEATURES], [libcurl], [supported_features])
PHP_EVAL_LIBLINE($CURL_LIBS, CURL_SHARED_LIBADD)
diff --git a/ext/curl/curl.stub.php b/ext/curl/curl.stub.php
new file mode 100644
index 0000000000..08ad7f6340
--- /dev/null
+++ b/ext/curl/curl.stub.php
@@ -0,0 +1,119 @@
+<?php
+
+/** @param resource $handle */
+function curl_close($handle): void {}
+
+/**
+ * @param resource $handle
+ * @return resource|false
+ */
+function curl_copy_handle($handle) {}
+
+/** @param resource $handle */
+function curl_errno($handle): int {}
+
+/** @param resource $handle */
+function curl_error($handle): string {}
+
+/** @param resource $handle */
+function curl_escape($handle, string $string): string|false {}
+
+/** @param resource $handle */
+function curl_exec($handle): string|bool {}
+
+function curl_file_create(
+ string $filename,
+ string $mimetype = UNKNOWN,
+ string $postname = UNKNOWN
+): CURLFile {}
+
+/**
+ * @param resource $handle
+ * @return mixed
+ */
+function curl_getinfo($handle, int $option = UNKNOWN) {}
+
+/**
+ * @param resource $handle
+ * @return resource|false
+ */
+function curl_init(string $url = UNKNOWN) {}
+
+/**
+ * @param resource $multi_handle
+ * @param resource $handle
+ */
+function curl_multi_add_handle($multi_handle, $handle): int {}
+
+/** @param resource $multi_handle */
+function curl_multi_close($multi_handle): void {}
+
+/** @param resource $multi_handle */
+function curl_multi_errno($multi_handle): int {}
+
+/** @param resource $multi_handle */
+function curl_multi_exec($multi_handle, &$still_running): int {}
+
+/** @param resource $multi_handle */
+function curl_multi_getcontent($multi_handle): ?string {}
+
+/** @param resource $multi_handle */
+function curl_multi_info_read($multi_handle, &$msgs_in_queue = null): array|false {}
+
+/** @return resource */
+function curl_multi_init() {}
+
+/**
+ * @param resource $multi_handle
+ * @param resource $handle
+ */
+function curl_multi_remove_handle($multi_handle, $handle): int {}
+
+/** @param resource $multi_handle */
+function curl_multi_select($multi_handle, float $timeout = 1.0): int {}
+
+/**
+ * @param resource $multi_handle
+ * @param mixed $value
+ */
+function curl_multi_setopt($multi_handle, int $option, $value): bool {}
+
+function curl_multi_strerror(int $error_number): ?string {}
+
+#if LIBCURL_VERSION_NUM >= 0x071200 /* 7.18.0 */
+/** @param resource $handle */
+function curl_pause($handle, int $bitmask): int {}
+#endif
+
+/** @param resource $handle */
+function curl_reset($handle): void {}
+
+/** @param resource $handle */
+function curl_setopt_array($handle, array $options): bool {}
+
+/**
+ * @param resource $handle
+ * @param mixed $value
+ */
+function curl_setopt($handle, int $option, $value): bool {}
+
+/** @param resource $share_handle */
+function curl_share_close($share_handle): void {}
+
+/** @param resource $share_handle */
+function curl_share_errno($share_handle): int {}
+
+/** @return resource */
+function curl_share_init() {}
+
+/** @param resource $share_handle */
+function curl_share_setopt($share_handle, int $option, $value): bool {}
+
+function curl_share_strerror(int $error_number): ?string {}
+
+function curl_strerror(int $error_number): ?string {}
+
+/** @param resource $handle */
+function curl_unescape($handle, string $string): string|false {}
+
+function curl_version(int $age = UNKNOWN): array|false {}
diff --git a/ext/curl/curl_arginfo.h b/ext/curl/curl_arginfo.h
new file mode 100644
index 0000000000..a7ae7a071b
--- /dev/null
+++ b/ext/curl/curl_arginfo.h
@@ -0,0 +1,134 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_close, 0, 1, IS_VOID, 0)
+ ZEND_ARG_INFO(0, handle)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_curl_copy_handle, 0, 0, 1)
+ ZEND_ARG_INFO(0, handle)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_errno, 0, 1, IS_LONG, 0)
+ ZEND_ARG_INFO(0, handle)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_error, 0, 1, IS_STRING, 0)
+ ZEND_ARG_INFO(0, handle)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_curl_escape, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, handle)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_curl_exec, 0, 1, MAY_BE_STRING|MAY_BE_BOOL)
+ ZEND_ARG_INFO(0, handle)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_curl_file_create, 0, 1, CURLFile, 0)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mimetype, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, postname, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_curl_getinfo, 0, 0, 1)
+ ZEND_ARG_INFO(0, handle)
+ ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_curl_init, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, url, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_multi_add_handle, 0, 2, IS_LONG, 0)
+ ZEND_ARG_INFO(0, multi_handle)
+ ZEND_ARG_INFO(0, handle)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_multi_close, 0, 1, IS_VOID, 0)
+ ZEND_ARG_INFO(0, multi_handle)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_multi_errno, 0, 1, IS_LONG, 0)
+ ZEND_ARG_INFO(0, multi_handle)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_multi_exec, 0, 2, IS_LONG, 0)
+ ZEND_ARG_INFO(0, multi_handle)
+ ZEND_ARG_INFO(1, still_running)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_multi_getcontent, 0, 1, IS_STRING, 1)
+ ZEND_ARG_INFO(0, multi_handle)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_curl_multi_info_read, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, multi_handle)
+ ZEND_ARG_INFO(1, msgs_in_queue)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_curl_multi_init, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_curl_multi_remove_handle arginfo_curl_multi_add_handle
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_multi_select, 0, 1, IS_LONG, 0)
+ ZEND_ARG_INFO(0, multi_handle)
+ ZEND_ARG_TYPE_INFO(0, timeout, IS_DOUBLE, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_multi_setopt, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, multi_handle)
+ ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_multi_strerror, 0, 1, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, error_number, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#if LIBCURL_VERSION_NUM >= 0x071200 /* 7.18.0 */
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_pause, 0, 2, IS_LONG, 0)
+ ZEND_ARG_INFO(0, handle)
+ ZEND_ARG_TYPE_INFO(0, bitmask, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#define arginfo_curl_reset arginfo_curl_close
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_setopt_array, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, handle)
+ ZEND_ARG_TYPE_INFO(0, options, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_setopt, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, handle)
+ ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_share_close, 0, 1, IS_VOID, 0)
+ ZEND_ARG_INFO(0, share_handle)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_share_errno, 0, 1, IS_LONG, 0)
+ ZEND_ARG_INFO(0, share_handle)
+ZEND_END_ARG_INFO()
+
+#define arginfo_curl_share_init arginfo_curl_multi_init
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_curl_share_setopt, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, share_handle)
+ ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+#define arginfo_curl_share_strerror arginfo_curl_multi_strerror
+
+#define arginfo_curl_strerror arginfo_curl_multi_strerror
+
+#define arginfo_curl_unescape arginfo_curl_escape
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_curl_version, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, age, IS_LONG, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/curl/curl_file.c b/ext/curl/curl_file.c
index a35e29147c..d08d77fb51 100644
--- a/ext/curl/curl_file.c
+++ b/ext/curl/curl_file.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -24,6 +22,8 @@
#include "Zend/zend_exceptions.h"
#include "Zend/zend_interfaces.h"
#include "php_curl.h"
+#include "curl_arginfo.h"
+#include "curl_file_arginfo.h"
#if HAVE_CURL
PHP_CURL_API zend_class_entry *curl_CURLFile_class;
@@ -73,9 +73,7 @@ static void curlfile_get_property(char *name, size_t name_len, INTERNAL_FUNCTION
{
zval *res, rv;
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
res = zend_read_property(curl_CURLFile_class, ZEND_THIS, name, name_len, 1, &rv);
ZVAL_COPY_DEREF(return_value, res);
}
@@ -131,24 +129,13 @@ ZEND_METHOD(CURLFile, setPostFilename)
}
/* }}} */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_curlfile_create, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, mimetype)
- ZEND_ARG_INFO(0, postname)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curlfile_name, 0)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-
static const zend_function_entry curlfile_funcs[] = {
- PHP_ME(CURLFile, __construct, arginfo_curlfile_create, ZEND_ACC_PUBLIC)
- PHP_ME(CURLFile, getFilename, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(CURLFile, getMimeType, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(CURLFile, setMimeType, arginfo_curlfile_name, ZEND_ACC_PUBLIC)
- PHP_ME(CURLFile, getPostFilename, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(CURLFile, setPostFilename, arginfo_curlfile_name, ZEND_ACC_PUBLIC)
+ PHP_ME(CURLFile, __construct, arginfo_class_CURLFile___construct, ZEND_ACC_PUBLIC)
+ PHP_ME(CURLFile, getFilename, arginfo_class_CURLFile_getFilename, ZEND_ACC_PUBLIC)
+ PHP_ME(CURLFile, getMimeType, arginfo_class_CURLFile_getMimeType, ZEND_ACC_PUBLIC)
+ PHP_ME(CURLFile, setMimeType, arginfo_class_CURLFile_setMimeType, ZEND_ACC_PUBLIC)
+ PHP_ME(CURLFile, getPostFilename, arginfo_class_CURLFile_getPostFilename, ZEND_ACC_PUBLIC)
+ PHP_ME(CURLFile, setPostFilename, arginfo_class_CURLFile_setPostFilename, ZEND_ACC_PUBLIC)
PHP_FE_END
};
diff --git a/ext/curl/curl_file.stub.php b/ext/curl/curl_file.stub.php
new file mode 100644
index 0000000000..e6e21f9a02
--- /dev/null
+++ b/ext/curl/curl_file.stub.php
@@ -0,0 +1,24 @@
+<?php
+
+class CURLFile {
+ public function __construct(
+ string $filename,
+ string $mimetype = UNKNOWN,
+ string $postname = UNKNOWN
+ ) {}
+
+ /** @return string */
+ public function getFilename() {}
+
+ /** @return string */
+ public function getMimeType() {}
+
+ /** @return string */
+ public function getPostFilename() {}
+
+ /** @return void */
+ public function setMimeType(string $mime) {}
+
+ /** @return void */
+ public function setPostFilename(string $postname) {}
+}
diff --git a/ext/curl/curl_file_arginfo.h b/ext/curl/curl_file_arginfo.h
new file mode 100644
index 0000000000..df50ab29dd
--- /dev/null
+++ b/ext/curl/curl_file_arginfo.h
@@ -0,0 +1,22 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_CURLFile___construct, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mimetype, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, postname, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_CURLFile_getFilename, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_CURLFile_getMimeType arginfo_class_CURLFile_getFilename
+
+#define arginfo_class_CURLFile_getPostFilename arginfo_class_CURLFile_getFilename
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_CURLFile_setMimeType, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, mime, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_CURLFile_setPostFilename, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, postname, IS_STRING, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/curl/interface.c b/ext/curl/interface.c
index 668f7a71d9..b86dd01178 100644
--- a/ext/curl/interface.c
+++ b/ext/curl/interface.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -63,6 +61,7 @@
#include "ext/standard/file.h"
#include "ext/standard/url.h"
#include "php_curl.h"
+#include "curl_arginfo.h"
int le_curl;
int le_curl_multi_handle;
@@ -114,20 +113,16 @@ static int php_curl_option_str(php_curl *ch, zend_long option, const char *str,
return FAILURE;
}
-#if LIBCURL_VERSION_NUM >= 0x071100
if (make_copy) {
-#endif
char *copystr;
/* Strings passed to libcurl as 'char *' arguments, are copied by the library since 7.17.0 */
copystr = estrndup(str, len);
error = curl_easy_setopt(ch->cp, option, copystr);
zend_llist_add_element(&ch->to_free->str, &copystr);
-#if LIBCURL_VERSION_NUM >= 0x071100
} else {
error = curl_easy_setopt(ch->cp, option, str);
}
-#endif
SAVE_CURL_ERROR(ch, error);
@@ -138,23 +133,7 @@ static int php_curl_option_url(php_curl *ch, const char *url, const size_t len)
{
/* Disable file:// if open_basedir are used */
if (PG(open_basedir) && *PG(open_basedir)) {
-#if LIBCURL_VERSION_NUM >= 0x071304
curl_easy_setopt(ch->cp, CURLOPT_PROTOCOLS, CURLPROTO_ALL & ~CURLPROTO_FILE);
-#else
- php_url *uri;
-
- if (!(uri = php_url_parse_ex(url, len))) {
- php_error_docref(NULL, E_WARNING, "Invalid URL '%s'", url);
- return FAILURE;
- }
-
- if (uri->scheme && zend_string_equals_literal_ci(uri->scheme, "file")) {
- php_error_docref(NULL, E_WARNING, "Protocol 'file' disabled in cURL");
- php_url_free(uri);
- return FAILURE;
- }
- php_url_free(uri);
-#endif
}
#if LIBCURL_VERSION_NUM > 0x073800 && defined(PHP_WIN32)
@@ -236,154 +215,6 @@ void _php_curl_verify_handlers(php_curl *ch, int reporterror) /* {{{ */
}
/* }}} */
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_curl_version, 0, 0, 0)
- ZEND_ARG_INFO(0, version)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_curl_init, 0, 0, 0)
- ZEND_ARG_INFO(0, url)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_copy_handle, 0)
- ZEND_ARG_INFO(0, ch)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_setopt, 0)
- ZEND_ARG_INFO(0, ch)
- ZEND_ARG_INFO(0, option)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_setopt_array, 0)
- ZEND_ARG_INFO(0, ch)
- ZEND_ARG_ARRAY_INFO(0, options, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_exec, 0)
- ZEND_ARG_INFO(0, ch)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_curl_getinfo, 0, 0, 1)
- ZEND_ARG_INFO(0, ch)
- ZEND_ARG_INFO(0, option)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_error, 0)
- ZEND_ARG_INFO(0, ch)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_errno, 0)
- ZEND_ARG_INFO(0, ch)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_close, 0)
- ZEND_ARG_INFO(0, ch)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_reset, 0)
- ZEND_ARG_INFO(0, ch)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_escape, 0)
- ZEND_ARG_INFO(0, ch)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_unescape, 0)
- ZEND_ARG_INFO(0, ch)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_multi_setopt, 0)
- ZEND_ARG_INFO(0, sh)
- ZEND_ARG_INFO(0, option)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_multi_init, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_multi_add_handle, 0)
- ZEND_ARG_INFO(0, mh)
- ZEND_ARG_INFO(0, ch)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_multi_remove_handle, 0)
- ZEND_ARG_INFO(0, mh)
- ZEND_ARG_INFO(0, ch)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_curl_multi_select, 0, 0, 1)
- ZEND_ARG_INFO(0, mh)
- ZEND_ARG_INFO(0, timeout)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_curl_multi_exec, 0, 0, 1)
- ZEND_ARG_INFO(0, mh)
- ZEND_ARG_INFO(1, still_running)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_multi_getcontent, 0)
- ZEND_ARG_INFO(0, ch)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_curl_multi_info_read, 0, 0, 1)
- ZEND_ARG_INFO(0, mh)
- ZEND_ARG_INFO(1, msgs_in_queue)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_multi_close, 0)
- ZEND_ARG_INFO(0, mh)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_multi_errno, 0)
- ZEND_ARG_INFO(0, mh)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_strerror, 0)
- ZEND_ARG_INFO(0, errornum)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_multi_strerror, 0)
- ZEND_ARG_INFO(0, errornum)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_share_strerror, 0)
- ZEND_ARG_INFO(0, errornum)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_share_init, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_share_close, 0)
- ZEND_ARG_INFO(0, sh)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_share_setopt, 0)
- ZEND_ARG_INFO(0, sh)
- ZEND_ARG_INFO(0, option)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_curl_share_errno, 0)
- ZEND_ARG_INFO(0, sh)
-ZEND_END_ARG_INFO()
-
-#if LIBCURL_VERSION_NUM >= 0x071200 /* Available since 7.18.0 */
-ZEND_BEGIN_ARG_INFO(arginfo_curl_pause, 0)
- ZEND_ARG_INFO(0, ch)
- ZEND_ARG_INFO(0, bitmask)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_curlfile_create, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, mimetype)
- ZEND_ARG_INFO(0, postname)
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ curl_functions[]
*/
static const zend_function_entry curl_functions[] = {
@@ -403,9 +234,8 @@ static const zend_function_entry curl_functions[] = {
PHP_FE(curl_reset, arginfo_curl_reset)
PHP_FE(curl_escape, arginfo_curl_escape)
PHP_FE(curl_unescape, arginfo_curl_unescape)
-#if LIBCURL_VERSION_NUM >= 0x071200 /* 7.18.0 */
PHP_FE(curl_pause, arginfo_curl_pause)
-#endif
+ PHP_FE(curl_file_create, arginfo_curl_file_create)
PHP_FE(curl_multi_init, arginfo_curl_multi_init)
PHP_FE(curl_multi_add_handle, arginfo_curl_multi_add_handle)
PHP_FE(curl_multi_remove_handle, arginfo_curl_multi_remove_handle)
@@ -420,7 +250,6 @@ static const zend_function_entry curl_functions[] = {
PHP_FE(curl_share_close, arginfo_curl_share_close)
PHP_FE(curl_share_setopt, arginfo_curl_share_setopt)
PHP_FE(curl_share_errno, arginfo_curl_share_errno)
- PHP_FE(curl_file_create, arginfo_curlfile_create)
PHP_FE_END
};
/* }}} */
@@ -487,15 +316,11 @@ PHP_MINFO_FUNCTION(curl)
{"Largefile", CURL_VERSION_LARGEFILE},
{"libz", CURL_VERSION_LIBZ},
{"NTLM", CURL_VERSION_NTLM},
-#if LIBCURL_VERSION_NUM >= 0x071600 /* 7.22.0 */
{"NTLMWB", CURL_VERSION_NTLM_WB},
-#endif
{"SPNEGO", CURL_VERSION_SPNEGO},
{"SSL", CURL_VERSION_SSL},
{"SSPI", CURL_VERSION_SSPI},
-#if LIBCURL_VERSION_NUM >= 0x071504 /* 7.21.4 */
{"TLS-SRP", CURL_VERSION_TLSAUTH_SRP},
-#endif
#if LIBCURL_VERSION_NUM >= 0x072100 /* 7.33.0 */
{"HTTP2", CURL_VERSION_HTTP2},
#endif
@@ -559,8 +384,6 @@ PHP_MINFO_FUNCTION(curl)
}
#endif
-#if LIBCURL_VERSION_NUM >= 0x071300
-
if (d->iconv_ver_num) {
php_info_print_table_row(2, "IconV Version", d->iconv_ver_num);
}
@@ -568,7 +391,7 @@ PHP_MINFO_FUNCTION(curl)
if (d->libssh_version) {
php_info_print_table_row(2, "libSSH Version", d->libssh_version);
}
-#endif
+
php_info_print_table_end();
DISPLAY_INI_ENTRIES();
@@ -935,13 +758,12 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURLOPT_MAX_RECV_SPEED_LARGE);
REGISTER_CURL_CONSTANT(CURLOPT_MAX_SEND_SPEED_LARGE);
-#if LIBCURL_VERSION_NUM >= 0x071000 /* Available since 7.16.0 */
+ /* Available since 7.16.0 */
REGISTER_CURL_CONSTANT(CURLE_SSL_CACERT_BADFILE);
REGISTER_CURL_CONSTANT(CURLOPT_SSL_SESSIONID_CACHE);
REGISTER_CURL_CONSTANT(CURLMOPT_PIPELINING);
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071001 /* Available since 7.16.1 */
+ /* Available since 7.16.1 */
REGISTER_CURL_CONSTANT(CURLE_SSH);
REGISTER_CURL_CONSTANT(CURLOPT_FTP_SSL_CCC);
REGISTER_CURL_CONSTANT(CURLOPT_SSH_AUTH_TYPES);
@@ -950,26 +772,22 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURLFTPSSL_CCC_ACTIVE);
REGISTER_CURL_CONSTANT(CURLFTPSSL_CCC_NONE);
REGISTER_CURL_CONSTANT(CURLFTPSSL_CCC_PASSIVE);
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071002 /* Available since 7.16.2 */
+ /* Available since 7.16.2 */
REGISTER_CURL_CONSTANT(CURLOPT_CONNECTTIMEOUT_MS);
REGISTER_CURL_CONSTANT(CURLOPT_HTTP_CONTENT_DECODING);
REGISTER_CURL_CONSTANT(CURLOPT_HTTP_TRANSFER_DECODING);
REGISTER_CURL_CONSTANT(CURLOPT_TIMEOUT_MS);
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071003 /* Available since 7.16.3 */
+ /* Available since 7.16.3 */
REGISTER_CURL_CONSTANT(CURLMOPT_MAXCONNECTS);
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071004 /* Available since 7.16.4 */
+ /* Available since 7.16.4 */
REGISTER_CURL_CONSTANT(CURLOPT_KRBLEVEL);
REGISTER_CURL_CONSTANT(CURLOPT_NEW_DIRECTORY_PERMS);
REGISTER_CURL_CONSTANT(CURLOPT_NEW_FILE_PERMS);
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071100 /* Available since 7.17.0 */
+ /* Available since 7.17.0 */
REGISTER_CURL_CONSTANT(CURLOPT_APPEND);
REGISTER_CURL_CONSTANT(CURLOPT_DIRLISTONLY);
REGISTER_CURL_CONSTANT(CURLOPT_USE_SSL);
@@ -978,13 +796,11 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURLUSESSL_CONTROL);
REGISTER_CURL_CONSTANT(CURLUSESSL_NONE);
REGISTER_CURL_CONSTANT(CURLUSESSL_TRY);
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071101 /* Available since 7.17.1 */
+ /* Available since 7.17.1 */
REGISTER_CURL_CONSTANT(CURLOPT_SSH_HOST_PUBLIC_KEY_MD5);
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071200 /* Available since 7.18.0 */
+ /* Available since 7.18.0 */
REGISTER_CURL_CONSTANT(CURLOPT_PROXY_TRANSFER_MODE);
REGISTER_CURL_CONSTANT(CURLPAUSE_ALL);
REGISTER_CURL_CONSTANT(CURLPAUSE_CONT);
@@ -997,13 +813,11 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURLPROXY_SOCKS4A);
REGISTER_CURL_CONSTANT(CURLPROXY_SOCKS5_HOSTNAME);
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071202 /* Available since 7.18.2 */
+ /* Available since 7.18.2 */
REGISTER_CURL_CONSTANT(CURLINFO_REDIRECT_URL);
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071300 /* Available since 7.19.0 */
+ /* Available since 7.19.0 */
REGISTER_CURL_CONSTANT(CURLINFO_APPCONNECT_TIME);
REGISTER_CURL_CONSTANT(CURLINFO_PRIMARY_IP);
@@ -1019,9 +833,8 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURLSSH_AUTH_NONE);
REGISTER_CURL_CONSTANT(CURLSSH_AUTH_PASSWORD);
REGISTER_CURL_CONSTANT(CURLSSH_AUTH_PUBLICKEY);
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071301 /* Available since 7.19.1 */
+ /* Available since 7.19.1 */
REGISTER_CURL_CONSTANT(CURLINFO_CERTINFO);
REGISTER_CURL_CONSTANT(CURLOPT_CERTINFO);
REGISTER_CURL_CONSTANT(CURLOPT_PASSWORD);
@@ -1032,13 +845,11 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURL_REDIR_POST_301);
REGISTER_CURL_CONSTANT(CURL_REDIR_POST_302);
REGISTER_CURL_CONSTANT(CURL_REDIR_POST_ALL);
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071303 /* Available since 7.19.3 */
+ /* Available since 7.19.3 */
REGISTER_CURL_CONSTANT(CURLAUTH_DIGEST_IE);
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071304 /* Available since 7.19.4 */
+ /* Available since 7.19.4 */
REGISTER_CURL_CONSTANT(CURLINFO_CONDITION_UNMET);
REGISTER_CURL_CONSTANT(CURLOPT_NOPROXY);
@@ -1067,14 +878,12 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURLFTP_CREATE_DIR);
REGISTER_CURL_CONSTANT(CURLFTP_CREATE_DIR_NONE);
REGISTER_CURL_CONSTANT(CURLFTP_CREATE_DIR_RETRY);
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071306 /* Available since 7.19.6 */
+ /* Available since 7.19.6 */
REGISTER_CURL_CONSTANT(CURL_VERSION_CURLDEBUG);
REGISTER_CURL_CONSTANT(CURLOPT_SSH_KNOWNHOSTS);
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071400 /* Available since 7.20.0 */
+ /* Available since 7.20.0 */
REGISTER_CURL_CONSTANT(CURLINFO_RTSP_CLIENT_CSEQ);
REGISTER_CURL_CONSTANT(CURLINFO_RTSP_CSEQ_RECV);
REGISTER_CURL_CONSTANT(CURLINFO_RTSP_SERVER_CSEQ);
@@ -1106,9 +915,8 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURL_RTSPREQ_SET_PARAMETER);
REGISTER_CURL_CONSTANT(CURL_RTSPREQ_SETUP);
REGISTER_CURL_CONSTANT(CURL_RTSPREQ_TEARDOWN);
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071500 /* Available since 7.21.0 */
+ /* Available since 7.21.0 */
REGISTER_CURL_CONSTANT(CURLINFO_LOCAL_IP);
REGISTER_CURL_CONSTANT(CURLINFO_LOCAL_PORT);
REGISTER_CURL_CONSTANT(CURLINFO_PRIMARY_PORT);
@@ -1123,59 +931,49 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURL_FNMATCHFUNC_FAIL);
REGISTER_CURL_CONSTANT(CURL_FNMATCHFUNC_MATCH);
REGISTER_CURL_CONSTANT(CURL_FNMATCHFUNC_NOMATCH);
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071502 /* Available since 7.21.2 */
+ /* Available since 7.21.2 */
REGISTER_CURL_CONSTANT(CURLPROTO_GOPHER);
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071503 /* Available since 7.21.3 */
+ /* Available since 7.21.3 */
REGISTER_CURL_CONSTANT(CURLAUTH_ONLY);
REGISTER_CURL_CONSTANT(CURLOPT_RESOLVE);
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071504 /* Available since 7.21.4 */
+ /* Available since 7.21.4 */
REGISTER_CURL_CONSTANT(CURLOPT_TLSAUTH_PASSWORD);
REGISTER_CURL_CONSTANT(CURLOPT_TLSAUTH_TYPE);
REGISTER_CURL_CONSTANT(CURLOPT_TLSAUTH_USERNAME);
REGISTER_CURL_CONSTANT(CURL_TLSAUTH_SRP);
REGISTER_CURL_CONSTANT(CURL_VERSION_TLSAUTH_SRP);
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071506 /* Available since 7.21.6 */
+ /* Available since 7.21.6 */
REGISTER_CURL_CONSTANT(CURLOPT_ACCEPT_ENCODING);
REGISTER_CURL_CONSTANT(CURLOPT_TRANSFER_ENCODING);
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071600 /* Available since 7.22.0 */
+ /* Available since 7.22.0 */
REGISTER_CURL_CONSTANT(CURLAUTH_NTLM_WB);
REGISTER_CURL_CONSTANT(CURLGSSAPI_DELEGATION_FLAG);
REGISTER_CURL_CONSTANT(CURLGSSAPI_DELEGATION_POLICY_FLAG);
REGISTER_CURL_CONSTANT(CURLOPT_GSSAPI_DELEGATION);
REGISTER_CURL_CONSTANT(CURL_VERSION_NTLM_WB);
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071800 /* Available since 7.24.0 */
+ /* Available since 7.24.0 */
REGISTER_CURL_CONSTANT(CURLOPT_ACCEPTTIMEOUT_MS);
REGISTER_CURL_CONSTANT(CURLOPT_DNS_SERVERS);
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071900 /* Available since 7.25.0 */
+ /* Available since 7.25.0 */
REGISTER_CURL_CONSTANT(CURLOPT_MAIL_AUTH);
REGISTER_CURL_CONSTANT(CURLOPT_SSL_OPTIONS);
REGISTER_CURL_CONSTANT(CURLOPT_TCP_KEEPALIVE);
REGISTER_CURL_CONSTANT(CURLOPT_TCP_KEEPIDLE);
REGISTER_CURL_CONSTANT(CURLOPT_TCP_KEEPINTVL);
REGISTER_CURL_CONSTANT(CURLSSLOPT_ALLOW_BEAST);
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071901 /* Available since 7.25.1 */
+ /* Available since 7.25.1 */
REGISTER_CURL_CONSTANT(CURL_REDIR_POST_303);
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071c00 /* Available since 7.28.0 */
+ /* Available since 7.28.0 */
REGISTER_CURL_CONSTANT(CURLSSH_AUTH_AGENT);
-#endif
#if LIBCURL_VERSION_NUM >= 0x071e00 /* Available since 7.30.0 */
REGISTER_CURL_CONSTANT(CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE);
@@ -1529,7 +1327,6 @@ static size_t curl_write(char *data, size_t size, size_t nmemb, void *ctx)
}
/* }}} */
-#if LIBCURL_VERSION_NUM >= 0x071500 /* Available since 7.21.0 */
/* {{{ curl_fnmatch
*/
static int curl_fnmatch(void *ctx, const char *pattern, const char *string)
@@ -1575,7 +1372,6 @@ static int curl_fnmatch(void *ctx, const char *pattern, const char *string)
return rval;
}
/* }}} */
-#endif
/* {{{ curl_progress
*/
@@ -1833,7 +1629,7 @@ PHP_FUNCTION(curl_version)
ZEND_PARSE_PARAMETERS_END();
if (uversion == CURLVERSION_NOW) {
- php_error_docref(NULL, E_DEPRECATED, "the $version parameter is deprecated");
+ php_error_docref(NULL, E_DEPRECATED, "The $version parameter is deprecated");
} else if (ZEND_NUM_ARGS() > 0) {
php_error_docref(NULL, E_WARNING, "$version argument ignored");
}
@@ -1873,12 +1669,10 @@ PHP_FUNCTION(curl_version)
if (d->age >= 2) {
CAAS("libidn", d->libidn);
}
-#if LIBCURL_VERSION_NUM >= 0x071001 /* Available since 7.16.1 */
if (d->age >= 3) {
CAAL("iconv_ver_num", d->iconv_ver_num);
CAAS("libssh_version", d->libssh_version);
}
-#endif
#if LIBCURL_VERSION_NUM >= 0x073900 /* Available since 7.57.0 */
if (d->age >= 4) {
CAAL("brotli_ver_num", d->brotli_ver_num);
@@ -1899,9 +1693,7 @@ php_curl *alloc_curl_handle()
ch->handlers->write_header = ecalloc(1, sizeof(php_curl_write));
ch->handlers->read = ecalloc(1, sizeof(php_curl_read));
ch->handlers->progress = NULL;
-#if LIBCURL_VERSION_NUM >= 0x071500 /* Available since 7.21.0 */
ch->handlers->fnmatch = NULL;
-#endif
ch->clone = emalloc(sizeof(uint32_t));
*ch->clone = 1;
@@ -1920,7 +1712,6 @@ php_curl *alloc_curl_handle()
}
/* }}} */
-#if LIBCURL_VERSION_NUM >= 0x071301 /* Available since 7.19.1 */
/* {{{ create_certinfo
*/
static void create_certinfo(struct curl_certinfo *ci, zval *listcode)
@@ -1954,7 +1745,6 @@ static void create_certinfo(struct curl_certinfo *ci, zval *listcode)
}
}
/* }}} */
-#endif
/* {{{ _php_curl_set_default_options()
Set default options for a handle */
@@ -2054,12 +1844,7 @@ void _php_setup_easy_copy_handlers(php_curl *ch, php_curl *source)
ch->handlers->write_header->fp = source->handlers->write_header->fp;
ch->handlers->read->fp = source->handlers->read->fp;
ch->handlers->read->res = source->handlers->read->res;
-#if CURLOPT_PASSWDDATA != 0
- if (!Z_ISUNDEF(source->handlers->passwd)) {
- ZVAL_COPY(&ch->handlers->passwd, &source->handlers->passwd);
- curl_easy_setopt(source->cp, CURLOPT_PASSWDDATA, (void *) ch);
- }
-#endif
+
if (!Z_ISUNDEF(source->handlers->write->func_name)) {
ZVAL_COPY(&ch->handlers->write->func_name, &source->handlers->write->func_name);
}
@@ -2084,7 +1869,6 @@ void _php_setup_easy_copy_handlers(php_curl *ch, php_curl *source)
curl_easy_setopt(ch->cp, CURLOPT_PROGRESSDATA, (void *) ch);
}
-#if LIBCURL_VERSION_NUM >= 0x071500
if (source->handlers->fnmatch) {
ch->handlers->fnmatch = ecalloc(1, sizeof(php_curl_fnmatch));
if (!Z_ISUNDEF(source->handlers->fnmatch->func_name)) {
@@ -2093,7 +1877,6 @@ void _php_setup_easy_copy_handlers(php_curl *ch, php_curl *source)
ch->handlers->fnmatch->method = source->handlers->fnmatch->method;
curl_easy_setopt(ch->cp, CURLOPT_FNMATCH_DATA, (void *) ch);
}
-#endif
efree(ch->to_free->slist);
efree(ch->to_free);
@@ -2372,13 +2155,9 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
case CURLOPT_SSL_VERIFYHOST:
lval = zval_get_long(zvalue);
if (lval == 1) {
-#if LIBCURL_VERSION_NUM <= 0x071c00 /* 7.28.0 */
- php_error_docref(NULL, E_NOTICE, "CURLOPT_SSL_VERIFYHOST with value 1 is deprecated and will be removed as of libcurl 7.28.1. It is recommended to use value 2 instead");
-#else
php_error_docref(NULL, E_NOTICE, "CURLOPT_SSL_VERIFYHOST no longer accepts the value 1, value 2 will be used instead");
error = curl_easy_setopt(ch->cp, option, 2);
break;
-#endif
}
case CURLOPT_AUTOREFERER:
case CURLOPT_BUFFERSIZE:
@@ -2435,71 +2214,37 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
case CURLOPT_CONNECT_ONLY:
case CURLOPT_LOCALPORT:
case CURLOPT_LOCALPORTRANGE:
-#if LIBCURL_VERSION_NUM >= 0x071000 /* Available since 7.16.0 */
case CURLOPT_SSL_SESSIONID_CACHE:
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071001 /* Available since 7.16.1 */
case CURLOPT_FTP_SSL_CCC:
case CURLOPT_SSH_AUTH_TYPES:
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071002 /* Available since 7.16.2 */
case CURLOPT_CONNECTTIMEOUT_MS:
case CURLOPT_HTTP_CONTENT_DECODING:
case CURLOPT_HTTP_TRANSFER_DECODING:
case CURLOPT_TIMEOUT_MS:
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071004 /* Available since 7.16.4 */
case CURLOPT_NEW_DIRECTORY_PERMS:
case CURLOPT_NEW_FILE_PERMS:
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071100 /* Available since 7.17.0 */
case CURLOPT_USE_SSL:
case CURLOPT_APPEND:
case CURLOPT_DIRLISTONLY:
-#else
- case CURLOPT_FTP_SSL:
- case CURLOPT_FTPAPPEND:
- case CURLOPT_FTPLISTONLY:
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071200 /* Available since 7.18.0 */
case CURLOPT_PROXY_TRANSFER_MODE:
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071300 /* Available since 7.19.0 */
case CURLOPT_ADDRESS_SCOPE:
-#endif
-#if LIBCURL_VERSION_NUM > 0x071301 /* Available since 7.19.1 */
case CURLOPT_CERTINFO:
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071304 /* Available since 7.19.4 */
case CURLOPT_PROTOCOLS:
case CURLOPT_REDIR_PROTOCOLS:
case CURLOPT_SOCKS5_GSSAPI_NEC:
case CURLOPT_TFTP_BLKSIZE:
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071400 /* Available since 7.20.0 */
case CURLOPT_FTP_USE_PRET:
case CURLOPT_RTSP_CLIENT_CSEQ:
case CURLOPT_RTSP_REQUEST:
case CURLOPT_RTSP_SERVER_CSEQ:
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071500 /* Available since 7.21.0 */
case CURLOPT_WILDCARDMATCH:
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071504 /* Available since 7.21.4 */
case CURLOPT_TLSAUTH_TYPE:
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071600 /* Available since 7.22.0 */
case CURLOPT_GSSAPI_DELEGATION:
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071800 /* Available since 7.24.0 */
case CURLOPT_ACCEPTTIMEOUT_MS:
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071900 /* Available since 7.25.0 */
case CURLOPT_SSL_OPTIONS:
case CURLOPT_TCP_KEEPALIVE:
case CURLOPT_TCP_KEEPIDLE:
case CURLOPT_TCP_KEEPINTVL:
-#endif
#if LIBCURL_VERSION_NUM >= 0x071f00 /* Available since 7.31.0 */
case CURLOPT_SASL_IR:
#endif
@@ -2562,13 +2307,11 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
case CURLOPT_HTTP09_ALLOWED:
#endif
lval = zval_get_long(zvalue);
-#if LIBCURL_VERSION_NUM >= 0x071304
if ((option == CURLOPT_PROTOCOLS || option == CURLOPT_REDIR_PROTOCOLS) &&
(PG(open_basedir) && *PG(open_basedir)) && (lval & CURLPROTO_FILE)) {
php_error_docref(NULL, E_WARNING, "CURLPROTO_FILE cannot be activated when an open_basedir is set");
return 1;
}
-#endif
# if defined(ZTS)
if (option == CURLOPT_DNS_USE_GLOBAL_CACHE && lval) {
php_error_docref(NULL, E_WARNING, "CURLOPT_DNS_USE_GLOBAL_CACHE cannot be activated when thread safety is enabled");
@@ -2604,40 +2347,22 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
case CURLOPT_USERPWD:
case CURLOPT_COOKIELIST:
case CURLOPT_FTP_ALTERNATIVE_TO_USER:
-#if LIBCURL_VERSION_NUM >= 0x071101 /* Available since 7.17.1 */
case CURLOPT_SSH_HOST_PUBLIC_KEY_MD5:
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071301 /* Available since 7.19.1 */
case CURLOPT_PASSWORD:
case CURLOPT_PROXYPASSWORD:
case CURLOPT_PROXYUSERNAME:
case CURLOPT_USERNAME:
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071304 /* Available since 7.19.4 */
case CURLOPT_NOPROXY:
case CURLOPT_SOCKS5_GSSAPI_SERVICE:
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071400 /* Available since 7.20.0 */
case CURLOPT_MAIL_FROM:
case CURLOPT_RTSP_STREAM_URI:
case CURLOPT_RTSP_TRANSPORT:
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071504 /* Available since 7.21.4 */
case CURLOPT_TLSAUTH_PASSWORD:
case CURLOPT_TLSAUTH_USERNAME:
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071506 /* Available since 7.21.6 */
case CURLOPT_ACCEPT_ENCODING:
case CURLOPT_TRANSFER_ENCODING:
-#else
- case CURLOPT_ENCODING:
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071800 /* Available since 7.24.0 */
case CURLOPT_DNS_SERVERS:
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071900 /* Available since 7.25.0 */
case CURLOPT_MAIL_AUTH:
-#endif
#if LIBCURL_VERSION_NUM >= 0x072200 /* Available since 7.34.0 */
case CURLOPT_LOGIN_OPTIONS:
#endif
@@ -2690,9 +2415,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
case CURLOPT_FTPPORT:
case CURLOPT_RANGE:
case CURLOPT_FTP_ACCOUNT:
-#if LIBCURL_VERSION_NUM >= 0x071400 /* Available since 7.20.0 */
case CURLOPT_RTSP_SESSION_ID:
-#endif
#if LIBCURL_VERSION_NUM >= 0x072100 /* Available since 7.33.0 */
case CURLOPT_DNS_INTERFACE:
case CURLOPT_DNS_LOCAL_IP4:
@@ -2702,11 +2425,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
#if LIBCURL_VERSION_NUM >= 0x072800 /* Available since 7.40.0 */
case CURLOPT_UNIX_SOCKET_PATH:
#endif
-#if LIBCURL_VERSION_NUM >= 0x071004 /* Available since 7.16.4 */
case CURLOPT_KRBLEVEL:
-#else
- case CURLOPT_KRB4LEVEL:
-#endif
{
if (Z_ISNULL_P(zvalue)) {
error = curl_easy_setopt(ch->cp, option, NULL);
@@ -2779,7 +2498,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
ch->handlers->write->method = PHP_CURL_FILE;
ZVAL_COPY(&ch->handlers->write->stream, zvalue);
} else {
- php_error_docref(NULL, E_WARNING, "the provided file handle is not writable");
+ php_error_docref(NULL, E_WARNING, "The provided file handle is not writable");
return FAILURE;
}
break;
@@ -2797,7 +2516,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
ch->handlers->write_header->method = PHP_CURL_FILE;
ZVAL_COPY(&ch->handlers->write_header->stream, zvalue);
} else {
- php_error_docref(NULL, E_WARNING, "the provided file handle is not writable");
+ php_error_docref(NULL, E_WARNING, "The provided file handle is not writable");
return FAILURE;
}
break;
@@ -2826,7 +2545,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
zval_ptr_dtor(&ch->handlers->std_err);
ZVAL_COPY(&ch->handlers->std_err, zvalue);
} else {
- php_error_docref(NULL, E_WARNING, "the provided file handle is not writable");
+ php_error_docref(NULL, E_WARNING, "The provided file handle is not writable");
return FAILURE;
}
/* break omitted intentionally */
@@ -2844,12 +2563,8 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
case CURLOPT_PREQUOTE:
case CURLOPT_QUOTE:
case CURLOPT_TELNETOPTIONS:
-#if LIBCURL_VERSION_NUM >= 0x071400 /* Available since 7.20.0 */
case CURLOPT_MAIL_RCPT:
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071503 /* Available since 7.21.3 */
case CURLOPT_RESOLVE:
-#endif
#if LIBCURL_VERSION_NUM >= 0x072500 /* Available since 7.37.0 */
case CURLOPT_PROXYHEADER:
#endif
@@ -2884,16 +2599,12 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
case CURLOPT_TELNETOPTIONS:
name = "CURLOPT_TELNETOPTIONS";
break;
-#if LIBCURL_VERSION_NUM >= 0x071400 /* Available since 7.20.0 */
case CURLOPT_MAIL_RCPT:
name = "CURLOPT_MAIL_RCPT";
break;
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071503 /* Available since 7.21.3 */
case CURLOPT_RESOLVE:
name = "CURLOPT_RESOLVE";
break;
-#endif
#if LIBCURL_VERSION_NUM >= 0x072500 /* Available since 7.37.0 */
case CURLOPT_PROXYHEADER:
name = "CURLOPT_PROXYHEADER";
@@ -2939,12 +2650,6 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
case CURLOPT_FOLLOWLOCATION:
lval = zend_is_true(zvalue);
-#if LIBCURL_VERSION_NUM < 0x071304
- if (lval && PG(open_basedir) && *PG(open_basedir)) {
- php_error_docref(NULL, E_WARNING, "CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set");
- return FAILURE;
- }
-#endif
error = curl_easy_setopt(ch->cp, option, lval);
break;
@@ -2961,25 +2666,12 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
if (Z_TYPE_P(zvalue) == IS_ARRAY || Z_TYPE_P(zvalue) == IS_OBJECT) {
return build_mime_structure_from_hash(ch, zvalue);
} else {
-#if LIBCURL_VERSION_NUM >= 0x071101
zend_string *tmp_str;
zend_string *str = zval_get_tmp_string(zvalue, &tmp_str);
/* with curl 7.17.0 and later, we can use COPYPOSTFIELDS, but we have to provide size before */
error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, ZSTR_LEN(str));
error = curl_easy_setopt(ch->cp, CURLOPT_COPYPOSTFIELDS, ZSTR_VAL(str));
zend_tmp_string_release(tmp_str);
-#else
- char *post = NULL;
- zend_string *tmp_str;
- zend_string *str = zval_get_tmp_string(zvalue, &tmp_str);
-
- post = estrndup(ZSTR_VAL(str), ZSTR_LEN(str));
- zend_llist_add_element(&ch->to_free->str, &post);
-
- curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDS, post);
- error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, ZSTR_LEN(str));
- zend_tmp_string_release(tmp_str);
-#endif
}
break;
@@ -3032,12 +2724,10 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
error = curl_easy_setopt(ch->cp, option, (curl_off_t)lval);
break;
-#if LIBCURL_VERSION_NUM >= 0x071301 /* Available since 7.19.1 */
case CURLOPT_POSTREDIR:
lval = zval_get_long(zvalue);
error = curl_easy_setopt(ch->cp, CURLOPT_POSTREDIR, lval & CURL_REDIR_POST_ALL);
break;
-#endif
/* the following options deal with files, therefore the open_basedir check
* is required.
@@ -3047,17 +2737,11 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
case CURLOPT_RANDOM_FILE:
case CURLOPT_SSLCERT:
case CURLOPT_NETRC_FILE:
-#if LIBCURL_VERSION_NUM >= 0x071001 /* Available since 7.16.1 */
case CURLOPT_SSH_PRIVATE_KEYFILE:
case CURLOPT_SSH_PUBLIC_KEYFILE:
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071300 /* Available since 7.19.0 */
case CURLOPT_CRLFILE:
case CURLOPT_ISSUERCERT:
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071306 /* Available since 7.19.6 */
case CURLOPT_SSH_KNOWNHOSTS:
-#endif
{
zend_string *tmp_str;
zend_string *str = zval_get_tmp_string(zvalue, &tmp_str);
@@ -3094,7 +2778,6 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
}
break;
-#if LIBCURL_VERSION_NUM >= 0x071500 /* Available since 7.21.0 */
case CURLOPT_FNMATCH_FUNCTION:
curl_easy_setopt(ch->cp, CURLOPT_FNMATCH_FUNCTION, curl_fnmatch);
curl_easy_setopt(ch->cp, CURLOPT_FNMATCH_DATA, ch);
@@ -3107,7 +2790,6 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
ZVAL_COPY(&ch->handlers->fnmatch->func_name, zvalue);
ch->handlers->fnmatch->method = PHP_CURL_USER;
break;
-#endif
}
@@ -3135,7 +2817,7 @@ PHP_FUNCTION(curl_setopt)
ZEND_PARSE_PARAMETERS_END();
if ((ch = (php_curl*)zend_fetch_resource(Z_RES_P(zid), le_curl_name, le_curl)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (options <= 0 && options != CURLOPT_SAFE_UPLOAD) {
@@ -3166,7 +2848,7 @@ PHP_FUNCTION(curl_setopt_array)
ZEND_PARSE_PARAMETERS_END();
if ((ch = (php_curl*)zend_fetch_resource(Z_RES_P(zid), le_curl_name, le_curl)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(arr), option, string_key, entry) {
@@ -3213,7 +2895,7 @@ PHP_FUNCTION(curl_exec)
ZEND_PARSE_PARAMETERS_END();
if ((ch = (php_curl*)zend_fetch_resource(Z_RES_P(zid), le_curl_name, le_curl)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
_php_curl_verify_handlers(ch, 1);
@@ -3272,7 +2954,7 @@ PHP_FUNCTION(curl_getinfo)
ZEND_PARSE_PARAMETERS_END();
if ((ch = (php_curl*)zend_fetch_resource(Z_RES_P(zid), le_curl_name, le_curl)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (ZEND_NUM_ARGS() < 2) {
@@ -3283,10 +2965,8 @@ PHP_FUNCTION(curl_getinfo)
long as there's no 32-bit int overflow. */
long l_code;
double d_code;
-#if LIBCURL_VERSION_NUM > 0x071301 /* 7.19.1 */
struct curl_certinfo *ci = NULL;
zval listcode;
-#endif
#if LIBCURL_VERSION_NUM >= 0x073d00 /* 7.61.0 */
curl_off_t co;
#endif
@@ -3359,24 +3039,17 @@ PHP_FUNCTION(curl_getinfo)
if (curl_easy_getinfo(ch->cp, CURLINFO_REDIRECT_TIME, &d_code) == CURLE_OK) {
CAAD("redirect_time", d_code);
}
-#if LIBCURL_VERSION_NUM >= 0x071202 /* Available since 7.18.2 */
if (curl_easy_getinfo(ch->cp, CURLINFO_REDIRECT_URL, &s_code) == CURLE_OK) {
CAAS("redirect_url", s_code);
}
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071300 /* Available since 7.19.0 */
if (curl_easy_getinfo(ch->cp, CURLINFO_PRIMARY_IP, &s_code) == CURLE_OK) {
CAAS("primary_ip", s_code);
}
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071301 /* Available since 7.19.1 */
if (curl_easy_getinfo(ch->cp, CURLINFO_CERTINFO, &ci) == CURLE_OK) {
array_init(&listcode);
create_certinfo(ci, &listcode);
CAAZ("certinfo", &listcode);
}
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071500 /* Available since 7.21.0 */
if (curl_easy_getinfo(ch->cp, CURLINFO_PRIMARY_PORT, &l_code) == CURLE_OK) {
CAAL("primary_port", l_code);
}
@@ -3386,7 +3059,6 @@ PHP_FUNCTION(curl_getinfo)
if (curl_easy_getinfo(ch->cp, CURLINFO_LOCAL_PORT, &l_code) == CURLE_OK) {
CAAL("local_port", l_code);
}
-#endif
#if LIBCURL_VERSION_NUM >= 0x073200 /* Available since 7.50.0 */
if (curl_easy_getinfo(ch->cp, CURLINFO_HTTP_VERSION, &l_code) == CURLE_OK) {
CAAL("http_version", l_code);
@@ -3437,7 +3109,6 @@ PHP_FUNCTION(curl_getinfo)
} else {
RETURN_FALSE;
}
-#if LIBCURL_VERSION_NUM >= 0x071301 /* Available since 7.19.1 */
case CURLINFO_CERTINFO: {
struct curl_certinfo *ci = NULL;
@@ -3450,7 +3121,6 @@ PHP_FUNCTION(curl_getinfo)
}
break;
}
-#endif
default: {
int type = CURLINFO_TYPEMASK & option;
switch (type) {
@@ -3536,7 +3206,7 @@ PHP_FUNCTION(curl_error)
ZEND_PARSE_PARAMETERS_END();
if ((ch = (php_curl*)zend_fetch_resource(Z_RES_P(zid), le_curl_name, le_curl)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (ch->err.no) {
@@ -3560,7 +3230,7 @@ PHP_FUNCTION(curl_errno)
ZEND_PARSE_PARAMETERS_END();
if ((ch = (php_curl*)zend_fetch_resource(Z_RES_P(zid), le_curl_name, le_curl)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
RETURN_LONG(ch->err.no);
@@ -3579,7 +3249,7 @@ PHP_FUNCTION(curl_close)
ZEND_PARSE_PARAMETERS_END();
if ((ch = (php_curl*)zend_fetch_resource(Z_RES_P(zid), le_curl_name, le_curl)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (ch->in_callback) {
@@ -3652,12 +3322,10 @@ static void _php_curl_close_ex(php_curl *ch)
efree(ch->handlers->progress);
}
-#if LIBCURL_VERSION_NUM >= 0x071500 /* Available since 7.21.0 */
if (ch->handlers->fnmatch) {
zval_ptr_dtor(&ch->handlers->fnmatch->func_name);
efree(ch->handlers->fnmatch);
}
-#endif
efree(ch->handlers);
#if LIBCURL_VERSION_NUM >= 0x073800 /* 7.56.0 */
@@ -3733,13 +3401,11 @@ static void _php_curl_reset_handlers(php_curl *ch)
ch->handlers->progress = NULL;
}
-#if LIBCURL_VERSION_NUM >= 0x071500 /* Available since 7.21.0 */
if (ch->handlers->fnmatch) {
zval_ptr_dtor(&ch->handlers->fnmatch->func_name);
efree(ch->handlers->fnmatch);
ch->handlers->fnmatch = NULL;
}
-#endif
}
/* }}} */
@@ -3756,7 +3422,7 @@ PHP_FUNCTION(curl_reset)
ZEND_PARSE_PARAMETERS_END();
if ((ch = (php_curl*)zend_fetch_resource(Z_RES_P(zid), le_curl_name, le_curl)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (ch->in_callback) {
@@ -3785,7 +3451,7 @@ PHP_FUNCTION(curl_escape)
ZEND_PARSE_PARAMETERS_END();
if ((ch = (php_curl*)zend_fetch_resource(Z_RES_P(zid), le_curl_name, le_curl)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (ZEND_SIZE_T_INT_OVFL(ZSTR_LEN(str))) {
@@ -3817,7 +3483,7 @@ PHP_FUNCTION(curl_unescape)
ZEND_PARSE_PARAMETERS_END();
if ((ch = (php_curl*)zend_fetch_resource(Z_RES_P(zid), le_curl_name, le_curl)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (ZEND_SIZE_T_INT_OVFL(ZSTR_LEN(str))) {
@@ -3833,7 +3499,6 @@ PHP_FUNCTION(curl_unescape)
}
/* }}} */
-#if LIBCURL_VERSION_NUM >= 0x071200 /* 7.18.0 */
/* {{{ proto void curl_pause(resource ch, int bitmask)
pause and unpause a connection */
PHP_FUNCTION(curl_pause)
@@ -3848,12 +3513,11 @@ PHP_FUNCTION(curl_pause)
ZEND_PARSE_PARAMETERS_END();
if ((ch = (php_curl*)zend_fetch_resource(Z_RES_P(zid), le_curl_name, le_curl)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
RETURN_LONG(curl_easy_pause(ch->cp, bitmask));
}
/* }}} */
-#endif
#endif /* HAVE_CURL */
diff --git a/ext/curl/multi.c b/ext/curl/multi.c
index eeae16d28c..51399fe01f 100644
--- a/ext/curl/multi.c
+++ b/ext/curl/multi.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -55,9 +53,7 @@ PHP_FUNCTION(curl_multi_init)
{
php_curlm *mh;
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
mh = ecalloc(1, sizeof(php_curlm));
mh->multi = curl_multi_init();
@@ -85,11 +81,11 @@ PHP_FUNCTION(curl_multi_add_handle)
ZEND_PARSE_PARAMETERS_END();
if ((mh = (php_curlm *)zend_fetch_resource(Z_RES_P(z_mh), le_curl_multi_handle_name, le_curl_multi_handle)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ((ch = (php_curl *)zend_fetch_resource(Z_RES_P(z_ch), le_curl_name, le_curl)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
_php_curl_verify_handlers(ch, 1);
@@ -173,11 +169,11 @@ PHP_FUNCTION(curl_multi_remove_handle)
ZEND_PARSE_PARAMETERS_END();
if ((mh = (php_curlm *)zend_fetch_resource(Z_RES_P(z_mh), le_curl_multi_handle_name, le_curl_multi_handle)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ((ch = (php_curl *)zend_fetch_resource(Z_RES_P(z_ch), le_curl_name, le_curl)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
error = curl_multi_remove_handle(mh->multi, ch->cp);
@@ -189,18 +185,6 @@ PHP_FUNCTION(curl_multi_remove_handle)
}
/* }}} */
-#if LIBCURL_VERSION_NUM < 0x071c00
-static void _make_timeval_struct(struct timeval *to, double timeout) /* {{{ */
-{
- unsigned long conv;
-
- conv = (unsigned long) (timeout * 1000000.0);
- to->tv_sec = conv / 1000000;
- to->tv_usec = conv % 1000000;
-}
-/* }}} */
-#endif
-
/* {{{ proto int curl_multi_select(resource mh[, double timeout])
Get all the sockets associated with the cURL extension, which can then be "selected" */
PHP_FUNCTION(curl_multi_select)
@@ -208,15 +192,7 @@ PHP_FUNCTION(curl_multi_select)
zval *z_mh;
php_curlm *mh;
double timeout = 1.0;
-#if LIBCURL_VERSION_NUM >= 0x071c00 /* Available since 7.28.0 */
int numfds = 0;
-#else
- fd_set readfds;
- fd_set writefds;
- fd_set exceptfds;
- int maxfd;
- struct timeval to;
-#endif
CURLMcode error = CURLM_OK;
ZEND_PARSE_PARAMETERS_START(1,2)
@@ -226,10 +202,9 @@ PHP_FUNCTION(curl_multi_select)
ZEND_PARSE_PARAMETERS_END();
if ((mh = (php_curlm *)zend_fetch_resource(Z_RES_P(z_mh), le_curl_multi_handle_name, le_curl_multi_handle)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
-#if LIBCURL_VERSION_NUM >= 0x071c00 /* Available since 7.28.0 */
error = curl_multi_wait(mh->multi, NULL, 0, (unsigned long) (timeout * 1000.0), &numfds);
if (CURLM_OK != error) {
SAVE_CURLM_ERROR(mh, error);
@@ -237,21 +212,6 @@ PHP_FUNCTION(curl_multi_select)
}
RETURN_LONG(numfds);
-#else
- _make_timeval_struct(&to, timeout);
-
- FD_ZERO(&readfds);
- FD_ZERO(&writefds);
- FD_ZERO(&exceptfds);
-
- error = curl_multi_fdset(mh->multi, &readfds, &writefds, &exceptfds, &maxfd);
- SAVE_CURLM_ERROR(mh, error);
-
- if (maxfd == -1) {
- RETURN_LONG(-1);
- }
- RETURN_LONG(select(maxfd + 1, &readfds, &writefds, &exceptfds, &to));
-#endif
}
/* }}} */
@@ -271,7 +231,7 @@ PHP_FUNCTION(curl_multi_exec)
ZEND_PARSE_PARAMETERS_END();
if ((mh = (php_curlm *)zend_fetch_resource(Z_RES_P(z_mh), le_curl_multi_handle_name, le_curl_multi_handle)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
{
@@ -283,7 +243,7 @@ PHP_FUNCTION(curl_multi_exec)
pz_ch = (zval *)zend_llist_get_next_ex(&mh->easyh, &pos)) {
if ((ch = (php_curl *)zend_fetch_resource(Z_RES_P(pz_ch), le_curl_name, le_curl)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
_php_curl_verify_handlers(ch, 1);
@@ -311,7 +271,7 @@ PHP_FUNCTION(curl_multi_getcontent)
ZEND_PARSE_PARAMETERS_END();
if ((ch = (php_curl *)zend_fetch_resource(Z_RES_P(z_ch), le_curl_name, le_curl)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (ch->handlers->write->method == PHP_CURL_RETURN) {
@@ -344,7 +304,7 @@ PHP_FUNCTION(curl_multi_info_read)
ZEND_PARSE_PARAMETERS_END();
if ((mh = (php_curlm *)zend_fetch_resource(Z_RES_P(z_mh), le_curl_multi_handle_name, le_curl_multi_handle)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
tmp_msg = curl_multi_info_read(mh->multi, &queued_msgs);
@@ -398,7 +358,7 @@ PHP_FUNCTION(curl_multi_close)
ZEND_PARSE_PARAMETERS_END();
if ((mh = (php_curlm *)zend_fetch_resource(Z_RES_P(z_mh), le_curl_multi_handle_name, le_curl_multi_handle)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
zend_list_close(Z_RES_P(z_mh));
@@ -450,7 +410,7 @@ PHP_FUNCTION(curl_multi_errno)
ZEND_PARSE_PARAMETERS_END();
if ((mh = (php_curlm *)zend_fetch_resource(Z_RES_P(z_mh), le_curl_multi_handle_name, le_curl_multi_handle)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
RETURN_LONG(mh->err.no);
@@ -558,12 +518,8 @@ static int _php_curl_multi_setopt(php_curlm *mh, zend_long option, zval *zvalue,
CURLMcode error = CURLM_OK;
switch (option) {
-#if LIBCURL_VERSION_NUM >= 0x071000 /* 7.16.0 */
case CURLMOPT_PIPELINING:
-#endif
-#if LIBCURL_VERSION_NUM >= 0x071003 /* 7.16.3 */
case CURLMOPT_MAXCONNECTS:
-#endif
#if LIBCURL_VERSION_NUM >= 0x071e00 /* 7.30.0 */
case CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE:
case CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE:
@@ -629,7 +585,7 @@ PHP_FUNCTION(curl_multi_setopt)
ZEND_PARSE_PARAMETERS_END();
if ((mh = (php_curlm *)zend_fetch_resource(Z_RES_P(z_mh), le_curl_multi_handle_name, le_curl_multi_handle)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (!_php_curl_multi_setopt(mh, options, zvalue, return_value)) {
diff --git a/ext/curl/php_curl.h b/ext/curl/php_curl.h
index f4f722e134..ec74e96956 100644
--- a/ext/curl/php_curl.h
+++ b/ext/curl/php_curl.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/curl/share.c b/ext/curl/share.c
index 242cad09cd..0b119c59a2 100644
--- a/ext/curl/share.c
+++ b/ext/curl/share.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -38,9 +36,7 @@ PHP_FUNCTION(curl_share_init)
{
php_curlsh *sh;
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
sh = ecalloc(1, sizeof(php_curlsh));
@@ -62,7 +58,7 @@ PHP_FUNCTION(curl_share_close)
ZEND_PARSE_PARAMETERS_END();
if ((sh = (php_curlsh *)zend_fetch_resource(Z_RES_P(z_sh), le_curl_share_handle_name, le_curl_share_handle)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
zend_list_close(Z_RES_P(z_sh));
@@ -106,7 +102,7 @@ PHP_FUNCTION(curl_share_setopt)
ZEND_PARSE_PARAMETERS_END();
if ((sh = (php_curlsh *)zend_fetch_resource(Z_RES_P(zid), le_curl_share_handle_name, le_curl_share_handle)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (!_php_curl_share_setopt(sh, options, zvalue, return_value)) {
@@ -140,7 +136,7 @@ PHP_FUNCTION(curl_share_errno)
ZEND_PARSE_PARAMETERS_END();
if ((sh = (php_curlsh *)zend_fetch_resource(Z_RES_P(z_sh), le_curl_share_handle_name, le_curl_share_handle)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
RETURN_LONG(sh->err.no);
diff --git a/ext/curl/tests/bug45161.phpt b/ext/curl/tests/bug45161.phpt
index d6d722fe28..5b8fe0d46c 100644
--- a/ext/curl/tests/bug45161.phpt
+++ b/ext/curl/tests/bug45161.phpt
@@ -3,10 +3,6 @@ Bug #45161 (Reusing a curl handle leaks memory)
--SKIPIF--
<?php
include 'skipif.inc';
-$curl_version = curl_version();
-if ($curl_version['version_number'] < 0x071100) {
- exit("skip: test works only with curl >= 7.17.0");
-}
?>
--FILE--
<?php
@@ -20,23 +16,23 @@ $fp = fopen(PHP_OS_FAMILY === 'Windows' ? 'nul' : '/dev/null', 'w');
/*
$i = $start = $end = 100000.00;
for ($i = 0; $i < 100; $i++) {
- curl_setopt($ch, CURLOPT_URL, 'http://127.0.0.1:9/');
- curl_setopt($ch, CURLOPT_FILE, $fp);
- curl_exec($ch);
+ curl_setopt($ch, CURLOPT_URL, 'http://127.0.0.1:9/');
+ curl_setopt($ch, CURLOPT_FILE, $fp);
+ curl_exec($ch);
}
*/
// Start actual test
$start = memory_get_usage() + 1024;
for($i = 0; $i < 1024; $i++) {
- curl_setopt($ch, CURLOPT_URL, "{$host}/get.inc");
- curl_setopt($ch, CURLOPT_FILE, $fp);
- curl_exec($ch);
+ curl_setopt($ch, CURLOPT_URL, "{$host}/get.inc");
+ curl_setopt($ch, CURLOPT_FILE, $fp);
+ curl_exec($ch);
}
if ($start < memory_get_usage()) {
- echo 'FAIL';
+ echo 'FAIL';
} else {
- echo 'PASS';
+ echo 'PASS';
}
echo "\n";
fclose($fp);
diff --git a/ext/curl/tests/bug46711.phpt b/ext/curl/tests/bug46711.phpt
index 8656513294..c46ea5331d 100644
--- a/ext/curl/tests/bug46711.phpt
+++ b/ext/curl/tests/bug46711.phpt
@@ -11,14 +11,14 @@ if (!extension_loaded("curl")) {
$ch = curl_init();
$opt = array(
- CURLOPT_AUTOREFERER => TRUE,
- CURLOPT_BINARYTRANSFER => TRUE
+ CURLOPT_AUTOREFERER => TRUE,
+ CURLOPT_BINARYTRANSFER => TRUE
);
curl_setopt( $ch, CURLOPT_AUTOREFERER , TRUE );
foreach( $opt as $option => $value ) {
- curl_setopt( $ch, $option, $value );
+ curl_setopt( $ch, $option, $value );
}
var_dump($opt); // with this bug, $opt[58] becomes NULL
diff --git a/ext/curl/tests/bug48203_multi.phpt b/ext/curl/tests/bug48203_multi.phpt
index 55dd364203..7b3d05e713 100644
--- a/ext/curl/tests/bug48203_multi.phpt
+++ b/ext/curl/tests/bug48203_multi.phpt
@@ -8,59 +8,59 @@ include 'skipif.inc';
<?php
include 'server.inc';
function checkForClosedFilePointer($target_url, $curl_option, $description) {
- $fp = fopen(__DIR__ . '/bug48203.tmp', 'w');
+ $fp = fopen(__DIR__ . '/bug48203.tmp', 'w');
- $ch1 = curl_init();
- $ch2 = curl_init();
+ $ch1 = curl_init();
+ $ch2 = curl_init();
- $options = array(
- CURLOPT_RETURNTRANSFER => 1,
- $curl_option => $fp,
- CURLOPT_URL => $target_url,
- );
+ $options = array(
+ CURLOPT_RETURNTRANSFER => 1,
+ $curl_option => $fp,
+ CURLOPT_URL => $target_url,
+ );
- // we also need to set CURLOPT_VERBOSE to test CURLOPT_STDERR properly
- if (CURLOPT_STDERR == $curl_option) {
- $options[CURLOPT_VERBOSE] = 1;
- }
+ // we also need to set CURLOPT_VERBOSE to test CURLOPT_STDERR properly
+ if (CURLOPT_STDERR == $curl_option) {
+ $options[CURLOPT_VERBOSE] = 1;
+ }
- if (CURLOPT_INFILE == $curl_option) {
- $options[CURLOPT_UPLOAD] = 1;
- }
+ if (CURLOPT_INFILE == $curl_option) {
+ $options[CURLOPT_UPLOAD] = 1;
+ }
- curl_setopt_array($ch1, $options);
- curl_setopt_array($ch2, $options);
+ curl_setopt_array($ch1, $options);
+ curl_setopt_array($ch2, $options);
- fclose($fp); // <-- premature close of $fp caused a crash!
+ fclose($fp); // <-- premature close of $fp caused a crash!
- $mh = curl_multi_init();
+ $mh = curl_multi_init();
- curl_multi_add_handle($mh, $ch1);
- curl_multi_add_handle($mh, $ch2);
+ curl_multi_add_handle($mh, $ch1);
+ curl_multi_add_handle($mh, $ch2);
- $active = 0;
- do {
- curl_multi_exec($mh, $active);
- } while ($active > 0);
+ $active = 0;
+ do {
+ curl_multi_exec($mh, $active);
+ } while ($active > 0);
- curl_multi_remove_handle($mh, $ch1);
- curl_multi_remove_handle($mh, $ch2);
- curl_multi_close($mh);
+ curl_multi_remove_handle($mh, $ch1);
+ curl_multi_remove_handle($mh, $ch2);
+ curl_multi_close($mh);
- // Force curl to output results
- fflush(STDERR);
- fflush(STDOUT);
+ // Force curl to output results
+ fflush(STDERR);
+ fflush(STDOUT);
- echo "Ok for $description\n";
+ echo "Ok for $description\n";
}
$options_to_check = array(
- "CURLOPT_STDERR", "CURLOPT_WRITEHEADER", "CURLOPT_FILE", "CURLOPT_INFILE"
+ "CURLOPT_STDERR", "CURLOPT_WRITEHEADER", "CURLOPT_FILE", "CURLOPT_INFILE"
);
$target_url = curl_cli_server_start();
foreach($options_to_check as $option) {
- checkForClosedFilePointer($target_url, constant($option), $option);
+ checkForClosedFilePointer($target_url, constant($option), $option);
}
?>
diff --git a/ext/curl/tests/bug48207.phpt b/ext/curl/tests/bug48207.phpt
index 566b84b246..7451199156 100644
--- a/ext/curl/tests/bug48207.phpt
+++ b/ext/curl/tests/bug48207.phpt
@@ -43,6 +43,6 @@ is_file($tempfile) and @unlink($tempfile);
isset($tempname) and is_file($tempname) and @unlink($tempname);
?>
--EXPECTF--
-Warning: curl_setopt(): the provided file handle is not writable in %s on line %d
+Warning: curl_setopt(): The provided file handle is not writable in %s on line %d
Hello World!
Hello World!
diff --git a/ext/curl/tests/bug54798-unix.phpt b/ext/curl/tests/bug54798-unix.phpt
index dc5aad7525..5f07b64c6f 100644
--- a/ext/curl/tests/bug54798-unix.phpt
+++ b/ext/curl/tests/bug54798-unix.phpt
@@ -11,35 +11,35 @@ if(substr(PHP_OS, 0, 3) == 'WIN' ) {
<?php
function checkForClosedFilePointer($host, $curl_option, $description) {
- $fp = fopen(__DIR__ . '/bug54798.tmp', 'w+');
+ $fp = fopen(__DIR__ . '/bug54798.tmp', 'w+');
- $ch = curl_init();
+ $ch = curl_init();
- // we also need CURLOPT_VERBOSE to be set to test CURLOPT_STDERR properly
- if (CURLOPT_STDERR == $curl_option) {
- curl_setopt($ch, CURLOPT_VERBOSE, 1);
- }
+ // we also need CURLOPT_VERBOSE to be set to test CURLOPT_STDERR properly
+ if (CURLOPT_STDERR == $curl_option) {
+ curl_setopt($ch, CURLOPT_VERBOSE, 1);
+ }
if (CURLOPT_INFILE == $curl_option) {
curl_setopt($ch, CURLOPT_UPLOAD, 1);
}
- curl_setopt($ch, $curl_option, $fp);
+ curl_setopt($ch, $curl_option, $fp);
- curl_setopt($ch, CURLOPT_URL, $host);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+ curl_setopt($ch, CURLOPT_URL, $host);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- fclose($fp); // <-- premature close of $fp caused a crash!
+ fclose($fp); // <-- premature close of $fp caused a crash!
- curl_exec($ch);
+ curl_exec($ch);
- curl_close($ch);
+ curl_close($ch);
- echo "Ok for $description\n";
+ echo "Ok for $description\n";
}
$options_to_check = array(
- "CURLOPT_STDERR",
+ "CURLOPT_STDERR",
"CURLOPT_WRITEHEADER",
"CURLOPT_FILE",
"CURLOPT_INFILE"
@@ -48,11 +48,10 @@ $options_to_check = array(
include 'server.inc';
$host = curl_cli_server_start();
foreach($options_to_check as $option) {
- checkForClosedFilePointer($host, constant($option), $option);
+ checkForClosedFilePointer($host, constant($option), $option);
}
?>
-===DONE===
--CLEAN--
<?php @unlink(__DIR__ . '/bug54798.tmp'); ?>
--EXPECTF--
@@ -61,4 +60,3 @@ foreach($options_to_check as $option) {
%aOk for CURLOPT_WRITEHEADER
%aOk for CURLOPT_FILE
%aOk for CURLOPT_INFILE
-===DONE===
diff --git a/ext/curl/tests/bug54798.phpt b/ext/curl/tests/bug54798.phpt
index d76674318a..d2661fce8f 100644
--- a/ext/curl/tests/bug54798.phpt
+++ b/ext/curl/tests/bug54798.phpt
@@ -8,35 +8,35 @@ include 'skipif.inc';
<?php
function checkForClosedFilePointer($host, $curl_option, $description) {
- $fp = fopen(__DIR__ . '/bug54798.tmp', 'w+');
+ $fp = fopen(__DIR__ . '/bug54798.tmp', 'w+');
- $ch = curl_init();
+ $ch = curl_init();
- // we also need CURLOPT_VERBOSE to be set to test CURLOPT_STDERR properly
- if (CURLOPT_STDERR == $curl_option) {
- curl_setopt($ch, CURLOPT_VERBOSE, 1);
- }
+ // we also need CURLOPT_VERBOSE to be set to test CURLOPT_STDERR properly
+ if (CURLOPT_STDERR == $curl_option) {
+ curl_setopt($ch, CURLOPT_VERBOSE, 1);
+ }
if (CURLOPT_INFILE == $curl_option) {
curl_setopt($ch, CURLOPT_UPLOAD, 1);
}
- curl_setopt($ch, $curl_option, $fp);
+ curl_setopt($ch, $curl_option, $fp);
- curl_setopt($ch, CURLOPT_URL, $host);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+ curl_setopt($ch, CURLOPT_URL, $host);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- fclose($fp); // <-- premature close of $fp caused a crash!
+ fclose($fp); // <-- premature close of $fp caused a crash!
- curl_exec($ch);
+ curl_exec($ch);
- curl_close($ch);
+ curl_close($ch);
- echo "Ok for $description\n";
+ echo "Ok for $description\n";
}
$options_to_check = array(
- "CURLOPT_STDERR",
+ "CURLOPT_STDERR",
"CURLOPT_WRITEHEADER",
"CURLOPT_FILE",
"CURLOPT_INFILE"
@@ -45,11 +45,10 @@ $options_to_check = array(
include 'server.inc';
$host = curl_cli_server_start();
foreach($options_to_check as $option) {
- checkForClosedFilePointer($host, constant($option), $option);
+ checkForClosedFilePointer($host, constant($option), $option);
}
?>
-===DONE===
--CLEAN--
<?php @unlink(__DIR__ . '/bug54798.tmp'); ?>
--EXPECTF--
@@ -61,4 +60,3 @@ foreach($options_to_check as $option) {
Hello World!Ok for CURLOPT_FILE
%AOk for CURLOPT_INFILE
-===DONE===
diff --git a/ext/curl/tests/bug54995.phpt b/ext/curl/tests/bug54995.phpt
deleted file mode 100644
index 0250749731..0000000000
--- a/ext/curl/tests/bug54995.phpt
+++ /dev/null
@@ -1,26 +0,0 @@
---TEST--
-Bug #54995 (Missing CURLINFO_RESPONSE_CODE support)
---SKIPIF--
-<?php
-include 'skipif.inc';
-
-if (curl_version()['version_number'] > 0x070a08) {
- exit("skip: tests works a versions of curl >= 7.10.8");
-}
-?>
---FILE--
-<?php
-include 'server.inc';
-$host = curl_cli_server_start();
-$ch = curl_init();
-curl_setopt($ch, CURLOPT_URL, "{$host}/get.inc");
-curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
-
-var_dump(curl_getinfo($ch, CURLINFO_HTTP_CODE) == curl_getinfo($ch, CURLINFO_RESPONSE_CODE));
-
-curl_exec($ch);
-curl_close($ch);
-
-?>
---EXPECT--
-bool(true)
diff --git a/ext/curl/tests/bug55767.phpt b/ext/curl/tests/bug55767.phpt
index 2231c94bd4..9a42b8f3e7 100644
--- a/ext/curl/tests/bug55767.phpt
+++ b/ext/curl/tests/bug55767.phpt
@@ -32,7 +32,6 @@ include 'skipif.inc';
var_dump( $curl_content );
?>
-===DONE===
--EXPECT--
*** Testing curl sending through GET an POST ***
string(203) "array(2) {
@@ -50,4 +49,3 @@ array(3) {
string(8) "John Doe"
}
"
-===DONE===
diff --git a/ext/curl/tests/bug63363.phpt b/ext/curl/tests/bug63363.phpt
deleted file mode 100644
index 36abc5e0ae..0000000000
--- a/ext/curl/tests/bug63363.phpt
+++ /dev/null
@@ -1,34 +0,0 @@
---TEST--
-Bug #63363 (CURL silently accepts boolean value for SSL_VERIFYHOST)
---SKIPIF--
-<?php
-if (!extension_loaded("curl")) {
- exit("skip curl extension not loaded");
-}
-$curl_version = curl_version();
-if ($curl_version['version_number'] >= 0x071c01) {
- exit("skip: test valid for libcurl < 7.28.1");
-}
-?>
---FILE--
-<?php
-$ch = curl_init();
-var_dump(curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false));
-/* Case that should throw an error */
-var_dump(curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, true));
-var_dump(curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0));
-var_dump(curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1));
-var_dump(curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2));
-
-curl_close($ch);
-?>
---EXPECTF--
-bool(true)
-
-Notice: curl_setopt(): CURLOPT_SSL_VERIFYHOST with value 1 is deprecated and will be removed as of libcurl 7.28.1. It is recommended to use value 2 instead in %s on line %d
-bool(true)
-bool(true)
-
-Notice: curl_setopt(): CURLOPT_SSL_VERIFYHOST with value 1 is deprecated and will be removed as of libcurl 7.28.1. It is recommended to use value 2 instead in %s on line %d
-bool(true)
-bool(true)
diff --git a/ext/curl/tests/bug63795.phpt b/ext/curl/tests/bug63795.phpt
index 798faa68f9..6c5b6fa6f5 100644
--- a/ext/curl/tests/bug63795.phpt
+++ b/ext/curl/tests/bug63795.phpt
@@ -5,10 +5,6 @@ Bug #63795 (CURL >= 7.28.0 no longer support value 1 for CURLOPT_SSL_VERIFYHOST)
if (!extension_loaded("curl")) {
exit("skip curl extension not loaded");
}
-$curl_version = curl_version();
-if ($curl_version['version_number'] < 0x071c01) {
- exit("skip: test valid for libcurl >= 7.28.1");
-}
?>
--FILE--
<?php
diff --git a/ext/curl/tests/bug64267.phpt b/ext/curl/tests/bug64267.phpt
index 302a853c25..1b85c98e17 100644
--- a/ext/curl/tests/bug64267.phpt
+++ b/ext/curl/tests/bug64267.phpt
@@ -13,26 +13,24 @@ echo "TEST\n";
$c = curl_init("http://google.com");
$f = fopen(__FILE__,"r");
var_dump(curl_setopt_array($c, [
- CURLOPT_RETURNTRANSFER => true,
- CURLOPT_UPLOAD => true,
- CURLOPT_INFILE => $f,
- CURLOPT_INFILESIZE => filesize(__FILE__),
- CURLOPT_CONNECTTIMEOUT => 3,
- CURLOPT_TIMEOUT => 3,
+ CURLOPT_RETURNTRANSFER => true,
+ CURLOPT_UPLOAD => true,
+ CURLOPT_INFILE => $f,
+ CURLOPT_INFILESIZE => filesize(__FILE__),
+ CURLOPT_CONNECTTIMEOUT => 3,
+ CURLOPT_TIMEOUT => 3,
]));
fclose($f);
var_dump(curl_setopt_array($c, [
- CURLOPT_UPLOAD => false,
- CURLOPT_INFILE => null,
- CURLOPT_INFILESIZE => 0,
+ CURLOPT_UPLOAD => false,
+ CURLOPT_INFILE => null,
+ CURLOPT_INFILESIZE => 0,
]));
curl_exec($c);
var_dump(curl_getinfo($c, CURLINFO_RESPONSE_CODE));
?>
-===DONE===
--EXPECTF--
TEST
bool(true)
bool(true)
int(30%d)
-===DONE===
diff --git a/ext/curl/tests/bug65646_open_basedir_new.phpt b/ext/curl/tests/bug65646_open_basedir_new.phpt
index 991c4a2b8a..6957380bd8 100644
--- a/ext/curl/tests/bug65646_open_basedir_new.phpt
+++ b/ext/curl/tests/bug65646_open_basedir_new.phpt
@@ -5,7 +5,6 @@ open_basedir=.
--SKIPIF--
<?php
if (!extension_loaded('curl')) exit("skip curl extension not loaded");
-if (version_compare(curl_version()['version'], '7.19.4', '<')) exit("skip curl version is too old");
?>
--FILE--
<?php
diff --git a/ext/curl/tests/bug65646_open_basedir_old.phpt b/ext/curl/tests/bug65646_open_basedir_old.phpt
deleted file mode 100644
index cf11d21a20..0000000000
--- a/ext/curl/tests/bug65646_open_basedir_old.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-Bug #65646 (re-enable CURLOPT_FOLLOWLOCATION with open_basedir or safe_mode): open_basedir enabled; curl < 7.19.4
---INI--
-open_basedir=.
---SKIPIF--
-<?php
-if (!extension_loaded('curl')) exit("skip curl extension not loaded");
-if (version_compare(curl_version()['version'], '7.19.4', '>=')) exit("skip curl version is too new");
-?>
---FILE--
-<?php
-$ch = curl_init();
-var_dump(curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true));
-curl_close($ch);
-?>
---EXPECTF--
-Warning: curl_setopt(): CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set in %s on line %d
-bool(false)
diff --git a/ext/curl/tests/bug67643.phpt b/ext/curl/tests/bug67643.phpt
index 24cdb86a28..e3d090da3a 100644
--- a/ext/curl/tests/bug67643.phpt
+++ b/ext/curl/tests/bug67643.phpt
@@ -6,24 +6,24 @@ if (!extension_loaded('curl')) print 'skip';
?>
--FILE--
<?php
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, 'file://'. __DIR__ . DIRECTORY_SEPARATOR .'curl_testdata1.txt');
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
+ $ch = curl_init();
+ curl_setopt($ch, CURLOPT_URL, 'file://'. __DIR__ . DIRECTORY_SEPARATOR .'curl_testdata1.txt');
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
- $mh = curl_multi_init();
- curl_multi_add_handle($mh, $ch);
+ $mh = curl_multi_init();
+ curl_multi_add_handle($mh, $ch);
- $running = 0;
- do {
- curl_multi_exec($mh, $running);
- } while($running > 0);
+ $running = 0;
+ do {
+ curl_multi_exec($mh, $running);
+ } while($running > 0);
- $results = curl_multi_getcontent($ch);
+ $results = curl_multi_getcontent($ch);
- curl_multi_remove_handle($mh, $ch);
- curl_multi_close($mh);
+ curl_multi_remove_handle($mh, $ch);
+ curl_multi_close($mh);
- var_dump($results);
+ var_dump($results);
?>
--EXPECT--
CURL1
diff --git a/ext/curl/tests/bug68937.phpt b/ext/curl/tests/bug68937.phpt
index 4f2ed12e42..9f28117594 100644
--- a/ext/curl/tests/bug68937.phpt
+++ b/ext/curl/tests/bug68937.phpt
@@ -14,22 +14,22 @@ $url = "{$host}/get.inc";
$ch = curl_init($url);
curl_setopt_array($ch, array(
- CURLOPT_HEADER => false,
- CURLOPT_RETURNTRANSFER => true,
- CURLOPT_POST => true,
- CURLOPT_INFILESIZE => 1,
- CURLOPT_HTTPHEADER => array(
- 'Expect:',
- 'Content-Length: 1',
- ),
- CURLOPT_READFUNCTION => 'curl_read',
- CURLOPT_CONNECTTIMEOUT=> 1,
- CURLOPT_TIMEOUT=>1
+ CURLOPT_HEADER => false,
+ CURLOPT_RETURNTRANSFER => true,
+ CURLOPT_POST => true,
+ CURLOPT_INFILESIZE => 1,
+ CURLOPT_HTTPHEADER => array(
+ 'Expect:',
+ 'Content-Length: 1',
+ ),
+ CURLOPT_READFUNCTION => 'curl_read',
+ CURLOPT_CONNECTTIMEOUT=> 1,
+ CURLOPT_TIMEOUT=>1
));
function curl_read($ch, $fp, $len) {
- var_dump($fp);
- exit;
+ var_dump($fp);
+ exit;
}
curl_exec($ch);
diff --git a/ext/curl/tests/bug68937_2.phpt b/ext/curl/tests/bug68937_2.phpt
index 8ebbc8eaa6..1ce5b52114 100644
--- a/ext/curl/tests/bug68937_2.phpt
+++ b/ext/curl/tests/bug68937_2.phpt
@@ -13,23 +13,23 @@ $url = "{$host}/get.inc";
$ch = curl_init($url);
curl_setopt_array($ch, array(
- CURLOPT_HEADER => false,
- CURLOPT_RETURNTRANSFER => true,
- CURLOPT_POST => true,
- CURLOPT_INFILESIZE => filesize(__FILE__),
- CURLOPT_INFILE => fopen(__FILE__, 'r'),
- CURLOPT_HTTPHEADER => array(
- 'Expect:',
- 'Content-Length: 1',
- ),
- CURLOPT_READFUNCTION => 'curl_read',
- CURLOPT_CONNECTTIMEOUT => 1,
- CURLOPT_TIMEOUT => 1
+ CURLOPT_HEADER => false,
+ CURLOPT_RETURNTRANSFER => true,
+ CURLOPT_POST => true,
+ CURLOPT_INFILESIZE => filesize(__FILE__),
+ CURLOPT_INFILE => fopen(__FILE__, 'r'),
+ CURLOPT_HTTPHEADER => array(
+ 'Expect:',
+ 'Content-Length: 1',
+ ),
+ CURLOPT_READFUNCTION => 'curl_read',
+ CURLOPT_CONNECTTIMEOUT => 1,
+ CURLOPT_TIMEOUT => 1
));
function curl_read($ch, $fp, $len) {
- var_dump($fp);
- exit;
+ var_dump($fp);
+ exit;
}
curl_exec($ch);
diff --git a/ext/curl/tests/bug69316.phpt b/ext/curl/tests/bug69316.phpt
index 38ff8bb9b6..d81175c2be 100644
--- a/ext/curl/tests/bug69316.phpt
+++ b/ext/curl/tests/bug69316.phpt
@@ -29,7 +29,6 @@ Bug #69316: Use-after-free in php_curl related to CURLOPT_FILE/_INFILE/_WRITEHEA
curl_exec($ch);
curl_close($ch);
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/body.tmp');
@@ -42,4 +41,3 @@ array(1) {
}
array(0) {
}
-===DONE===
diff --git a/ext/curl/tests/bug69485.phpt b/ext/curl/tests/bug69485.phpt
index 7a62589e5e..274cdce582 100644
--- a/ext/curl/tests/bug69485.phpt
+++ b/ext/curl/tests/bug69485.phpt
@@ -6,9 +6,9 @@ Bug #69485 (Double free on zend_list_dtor)
<?php
class O {
- public $ch;
- public function dummy() {
- }
+ public $ch;
+ public function dummy() {
+ }
}
$ch = curl_init();
diff --git a/ext/curl/tests/bug71523.phpt b/ext/curl/tests/bug71523.phpt
index c7889eaca0..2d947febec 100644
--- a/ext/curl/tests/bug71523.phpt
+++ b/ext/curl/tests/bug71523.phpt
@@ -14,13 +14,13 @@ curl_setopt($base, CURLOPT_RETURNTRANSFER, true);
$mh = curl_multi_init();
for ($i = 0; $i < 2; ++$i) {
- $ch = curl_copy_handle($base);
- curl_setopt($ch, CURLOPT_HTTPHEADER, ['Foo: Bar']);
- curl_multi_add_handle($mh, $ch);
+ $ch = curl_copy_handle($base);
+ curl_setopt($ch, CURLOPT_HTTPHEADER, ['Foo: Bar']);
+ curl_multi_add_handle($mh, $ch);
}
do {
- curl_multi_exec($mh, $active);
+ curl_multi_exec($mh, $active);
} while ($active);
?>
okey
diff --git a/ext/curl/tests/bug72189.phpt b/ext/curl/tests/bug72189.phpt
index 6723c2aae6..2bd0ca3705 100644
--- a/ext/curl/tests/bug72189.phpt
+++ b/ext/curl/tests/bug72189.phpt
@@ -2,15 +2,7 @@
Request #72189 (Add missing CURL_VERSION_* constants)
--SKIPIF--
<?php
-
include 'skipif.inc';
-
-$version = curl_version();
-
-if ($version['version_number'] < 0x071306) {
- exit('skip: test works only with curl >= 7.19.6');
-}
-
?>
--FILE--
<?php
diff --git a/ext/curl/tests/bug76675.phpt b/ext/curl/tests/bug76675.phpt
index 5e60c5c47f..e59aabc7c3 100644
--- a/ext/curl/tests/bug76675.phpt
+++ b/ext/curl/tests/bug76675.phpt
@@ -19,8 +19,8 @@ $callback = function($parent, $passed) use (&$transfers) {
echo "Received ".strlen($data);
return strlen($data);
});
- $transfers++;
- return CURL_PUSH_OK;
+ $transfers++;
+ return CURL_PUSH_OK;
};
$mh = curl_multi_init();
curl_multi_setopt($mh, CURLMOPT_PIPELINING, CURLPIPE_MULTIPLEX);
diff --git a/ext/curl/tests/bug77535.phpt b/ext/curl/tests/bug77535.phpt
index b79cdb9c02..4505352ca8 100644
--- a/ext/curl/tests/bug77535.phpt
+++ b/ext/curl/tests/bug77535.phpt
@@ -41,7 +41,7 @@ class MyHttpClient
return \strlen($data);
});
curl_multi_add_handle($this->mh, $this->curl);
-
+
$stillRunning = null;
while (true) {
do {
diff --git a/ext/curl/tests/bug77711.phpt b/ext/curl/tests/bug77711.phpt
index 8ef5e48891..dec53d0acb 100644
--- a/ext/curl/tests/bug77711.phpt
+++ b/ext/curl/tests/bug77711.phpt
@@ -21,11 +21,9 @@ var_dump(curl_setopt($ch, CURLOPT_POSTFIELDS, $params));
var_dump(curl_exec($ch));
curl_close($ch);
?>
-===DONE===
--EXPECTF--
bool(true)
string(%d) "ÐБВ.txt|application/octet-stream|5"
-===DONE===
--CLEAN--
<?php
@unlink(__DIR__ . '/ÐБВ.txt');
diff --git a/ext/curl/tests/bug79033.phpt b/ext/curl/tests/bug79033.phpt
index 98a97ed7a4..454c3b2669 100644
--- a/ext/curl/tests/bug79033.phpt
+++ b/ext/curl/tests/bug79033.phpt
@@ -8,11 +8,11 @@ include 'server.inc';
$host = curl_cli_server_start();
$ch = curl_init();
curl_setopt_array($ch, [
- CURLOPT_URL => "{$host}/get.inc?test=post",
- CURLOPT_POST => true,
+ CURLOPT_URL => "{$host}/get.inc?test=post",
+ CURLOPT_POST => true,
CURLOPT_POSTFIELDS => [],
CURLINFO_HEADER_OUT => true,
- CURLOPT_RETURNTRANSFER => true,
+ CURLOPT_RETURNTRANSFER => true,
]);
var_dump(curl_exec($ch));
var_dump(curl_getinfo($ch)["request_header"]);
diff --git a/ext/curl/tests/check_win_config.phpt b/ext/curl/tests/check_win_config.phpt
index a5f116748e..2764a82f38 100644
--- a/ext/curl/tests/check_win_config.phpt
+++ b/ext/curl/tests/check_win_config.phpt
@@ -10,13 +10,13 @@ if(substr(PHP_OS, 0, 3) != 'WIN' )
?>
--FILE--
<?php
- ob_start();
- phpinfo();
- $s = ob_get_contents();
- ob_end_clean();
- preg_match('/curl\n\n(.+)\n\n/siU', $s, $m);
+ ob_start();
+ phpinfo();
+ $s = ob_get_contents();
+ ob_end_clean();
+ preg_match('/curl\n\n(.+)\n\n/siU', $s, $m);
- echo $m[1], "\n";
+ echo $m[1], "\n";
?>
DONE
diff --git a/ext/curl/tests/curl_basic_001.phpt b/ext/curl/tests/curl_basic_001.phpt
index 1d906c43ea..e288987282 100644
--- a/ext/curl/tests/curl_basic_001.phpt
+++ b/ext/curl/tests/curl_basic_001.phpt
@@ -34,9 +34,7 @@ TestFest 2009 - AFUP - Jean-Marc Fontaine <jmf@durcommefaire.net>
echo "curl_exec returned false";
}
?>
-===DONE===
--EXPECT--
*** Testing curl_exec() : basic functionality ***
string(25) "Hello World!
Hello World!"
-===DONE===
diff --git a/ext/curl/tests/curl_basic_002.phpt b/ext/curl/tests/curl_basic_002.phpt
index c067406caf..0e71c36884 100644
--- a/ext/curl/tests/curl_basic_002.phpt
+++ b/ext/curl/tests/curl_basic_002.phpt
@@ -31,9 +31,7 @@ TestFest 2009 - AFUP - Jean-Marc Fontaine <jmf@durcommefaire.net>
var_dump( $curl_content );
?>
-===DONE===
--EXPECT--
*** Testing curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); ***
string(25) "Hello World!
Hello World!"
-===DONE===
diff --git a/ext/curl/tests/curl_basic_003.phpt b/ext/curl/tests/curl_basic_003.phpt
index 57ac6063b9..d8937302ee 100644
--- a/ext/curl/tests/curl_basic_003.phpt
+++ b/ext/curl/tests/curl_basic_003.phpt
@@ -33,7 +33,6 @@ TestFest 2009 - AFUP - Jean-Marc Fontaine <jmf@durcommefaire.net>
var_dump( $curl_content );
?>
-===DONE===
--EXPECT--
*** Testing curl sending through GET an POST ***
string(208) "array(2) {
@@ -51,4 +50,3 @@ array(3) {
string(8) "John Doe"
}
"
-===DONE===
diff --git a/ext/curl/tests/curl_basic_004.phpt b/ext/curl/tests/curl_basic_004.phpt
index 27842db1b0..0eb1dbdb68 100644
--- a/ext/curl/tests/curl_basic_004.phpt
+++ b/ext/curl/tests/curl_basic_004.phpt
@@ -32,8 +32,6 @@ TestFest 2009 - AFUP - Jean-Marc Fontaine <jmf@durcommefaire.net>
var_dump( $curl_content );
?>
-===DONE===
--EXPECT--
*** Testing curl setting referer ***
string(19) "http://www.refer.er"
-===DONE===
diff --git a/ext/curl/tests/curl_basic_005.phpt b/ext/curl/tests/curl_basic_005.phpt
index 6f9a4f98e1..9d6a62f622 100644
--- a/ext/curl/tests/curl_basic_005.phpt
+++ b/ext/curl/tests/curl_basic_005.phpt
@@ -32,8 +32,6 @@ TestFest 2009 - AFUP - Jean-Marc Fontaine <jmf@durcommefaire.net>
var_dump( $curl_content );
?>
-===DONE===
--EXPECT--
*** Testing curl with user agent ***
string(9) "cURL phpt"
-===DONE===
diff --git a/ext/curl/tests/curl_basic_011.phpt b/ext/curl/tests/curl_basic_011.phpt
index e6412c36d9..2f3cc0b6c3 100644
--- a/ext/curl/tests/curl_basic_011.phpt
+++ b/ext/curl/tests/curl_basic_011.phpt
@@ -31,8 +31,6 @@ TestFest 2009 - AFUP - Xavier Gorse <xgorse@elao.com>
var_dump( $curl_content );
?>
-===DONE===
--EXPECT--
*** Testing curl with cookie ***
string(3) "bar"
-===DONE===
diff --git a/ext/curl/tests/curl_basic_012.phpt b/ext/curl/tests/curl_basic_012.phpt
index 812fab789d..68df85d051 100644
--- a/ext/curl/tests/curl_basic_012.phpt
+++ b/ext/curl/tests/curl_basic_012.phpt
@@ -31,9 +31,7 @@ TestFest 2009 - AFUP - Xavier Gorse <xgorse@elao.com>
var_dump( $curl_content );
?>
-===DONE===
--EXPECT--
*** Testing curl with HTTP/1.0 ***
string(8) "HTTP/1.0"
-===DONE===
diff --git a/ext/curl/tests/curl_basic_013.phpt b/ext/curl/tests/curl_basic_013.phpt
index 34ec249ad3..bc78116855 100644
--- a/ext/curl/tests/curl_basic_013.phpt
+++ b/ext/curl/tests/curl_basic_013.phpt
@@ -31,9 +31,7 @@ TestFest 2009 - AFUP - Xavier Gorse <xgorse@elao.com>
var_dump( $curl_content );
?>
-===DONE===
--EXPECT--
*** Testing curl with HTTP/1.1 ***
string(8) "HTTP/1.1"
-===DONE===
diff --git a/ext/curl/tests/curl_basic_014.phpt b/ext/curl/tests/curl_basic_014.phpt
index 4037970bd0..88605e648f 100644
--- a/ext/curl/tests/curl_basic_014.phpt
+++ b/ext/curl/tests/curl_basic_014.phpt
@@ -9,7 +9,5 @@ Jean-Marc Fontaine <jmf@durcommefaire.net>
$ch = curl_init();
var_dump($ch);
?>
-===DONE===
--EXPECTF--
resource(%d) of type (curl)
-===DONE===
diff --git a/ext/curl/tests/curl_basic_015.phpt b/ext/curl/tests/curl_basic_015.phpt
index 94af18e930..1d2563be32 100644
--- a/ext/curl/tests/curl_basic_015.phpt
+++ b/ext/curl/tests/curl_basic_015.phpt
@@ -10,7 +10,5 @@ Jean-Marc Fontaine <jmf@durcommefaire.net>
$ch = curl_init($url);
var_dump($url == curl_getinfo($ch, CURLINFO_EFFECTIVE_URL));
?>
-===DONE===
--EXPECT--
bool(true)
-===DONE===
diff --git a/ext/curl/tests/curl_basic_016.phpt b/ext/curl/tests/curl_basic_016.phpt
deleted file mode 100644
index d1f162b3f2..0000000000
--- a/ext/curl/tests/curl_basic_016.phpt
+++ /dev/null
@@ -1,63 +0,0 @@
---TEST--
-Test curl_getinfo() function with basic functionality
---CREDITS--
-Jean-Marc Fontaine <jmf@durcommefaire.net>
---SKIPIF--
-<?php
-if (!extension_loaded("curl")) exit("skip curl extension not loaded");
-$curl_version = curl_version();
-if ($curl_version['version_number'] > 0x071201) {
- exit("skip: tests works only on older versions of curl");
-}
-?>
---FILE--
-<?php
- $ch = curl_init();
- $info = curl_getinfo($ch);
- var_dump($info);
-?>
-===DONE===
---EXPECTF--
-array(2%d) {
- ["url"]=>
- string(0) ""
- ["content_type"]=>
- NULL
- ["http_code"]=>
- int(0)
- ["header_size"]=>
- int(0)
- ["request_size"]=>
- int(0)
- ["filetime"]=>
- int(0)
- ["ssl_verify_result"]=>
- int(0)
- ["redirect_count"]=>
- int(0)
- ["total_time"]=>
- float(0)
- ["namelookup_time"]=>
- float(0)
- ["connect_time"]=>
- float(0)
- ["pretransfer_time"]=>
- float(0)
- ["size_upload"]=>
- float(0)
- ["size_download"]=>
- float(0)
- ["speed_download"]=>
- float(0)
- ["speed_upload"]=>
- float(0)
- ["download_content_length"]=>
- float(%f)
- ["upload_content_length"]=>
- float(%f)
- ["starttransfer_time"]=>
- float(0)
- ["redirect_time"]=>
- float(0)
-}
-===DONE===
diff --git a/ext/curl/tests/curl_basic_018.phpt b/ext/curl/tests/curl_basic_018.phpt
index 114cb59919..5aa668b79f 100644
--- a/ext/curl/tests/curl_basic_018.phpt
+++ b/ext/curl/tests/curl_basic_018.phpt
@@ -63,11 +63,9 @@ TestFest 2009 - AFUP - Thomas Rabaix <thomas.rabaix@gmail.com>
var_dump( $curl_content );
?>
-===DONE===
--EXPECT--
*** Testing curl_exec() : basic functionality ***
string(75) "Hello World!
Hello World!Hello World!
Hello World!Hello World!
Hello World!"
-===DONE===
diff --git a/ext/curl/tests/curl_basic_019.phpt b/ext/curl/tests/curl_basic_019.phpt
index 6f896b51e7..93b947c915 100644
--- a/ext/curl/tests/curl_basic_019.phpt
+++ b/ext/curl/tests/curl_basic_019.phpt
@@ -18,8 +18,6 @@ Jean-Marc Fontaine <jmf@durcommefaire.net>
var_dump($url == $info);
curl_close($ch);
?>
-===DONE===
--EXPECT--
Hello World!
Hello World!bool(true)
-===DONE===
diff --git a/ext/curl/tests/curl_basic_020.phpt b/ext/curl/tests/curl_basic_020.phpt
index cf0b708d73..6c4fe8c585 100644
--- a/ext/curl/tests/curl_basic_020.phpt
+++ b/ext/curl/tests/curl_basic_020.phpt
@@ -16,8 +16,6 @@ Jean-Marc Fontaine <jmf@durcommefaire.net>
var_dump(curl_getinfo($ch, CURLINFO_HTTP_CODE));
curl_close($ch);
?>
-===DONE===
--EXPECT--
Hello World!
Hello World!int(200)
-===DONE===
diff --git a/ext/curl/tests/curl_basic_021.phpt b/ext/curl/tests/curl_basic_021.phpt
index 5166073525..93ec89bdee 100644
--- a/ext/curl/tests/curl_basic_021.phpt
+++ b/ext/curl/tests/curl_basic_021.phpt
@@ -16,7 +16,5 @@ Jean-Marc Fontaine <jmf@durcommefaire.net>
var_dump(curl_getinfo($ch, CURLINFO_CONTENT_TYPE));
curl_close($ch);
?>
-===DONE===
--EXPECT--
string(24) "text/plain;charset=utf-8"
-===DONE===
diff --git a/ext/curl/tests/curl_basic_022.phpt b/ext/curl/tests/curl_basic_022.phpt
index a01ca4f5c5..108b290436 100644
--- a/ext/curl/tests/curl_basic_022.phpt
+++ b/ext/curl/tests/curl_basic_022.phpt
@@ -1,12 +1,7 @@
--TEST--
Test curl_getinfo() function with CURLINFO_COOKIELIST parameter
--SKIPIF--
-<?php if (!extension_loaded("curl")) print "skip";
-$curl_version = curl_version();
-if ($curl_version['version_number'] < 0x070e01) {
- exit("skip: test works only with curl >= 7.14.1");
-}
-?>
+<?php if (!extension_loaded("curl")) print "skip"; ?>
--FILE--
<?php
diff --git a/ext/curl/tests/curl_basic_023.phpt b/ext/curl/tests/curl_basic_023.phpt
index 06520207c1..6bcfd72b32 100644
--- a/ext/curl/tests/curl_basic_023.phpt
+++ b/ext/curl/tests/curl_basic_023.phpt
@@ -24,8 +24,6 @@ curl_exec($ch);
var_dump(CURL_HTTP_VERSION_1_1 === curl_getinfo($ch, CURLINFO_HTTP_VERSION));
curl_close($ch);
?>
-===DONE===
--EXPECT--
bool(true)
bool(true)
-===DONE===
diff --git a/ext/curl/tests/curl_basic_024.phpt b/ext/curl/tests/curl_basic_024.phpt
index cdd4b5c209..6875d4f02a 100644
--- a/ext/curl/tests/curl_basic_024.phpt
+++ b/ext/curl/tests/curl_basic_024.phpt
@@ -24,9 +24,7 @@ var_dump(0 === curl_getinfo($ch, CURLINFO_PROXY_SSL_VERIFYRESULT));
var_dump(curl_getinfo($ch, CURLINFO_SCHEME));
curl_close($ch);
?>
-===DONE===
--EXPECT--
bool(true)
bool(true)
string(4) "HTTP"
-===DONE===
diff --git a/ext/curl/tests/curl_close_basic.phpt b/ext/curl/tests/curl_close_basic.phpt
index 9c01b02f76..5824fdddb8 100644
--- a/ext/curl/tests/curl_close_basic.phpt
+++ b/ext/curl/tests/curl_close_basic.phpt
@@ -13,7 +13,5 @@ $ch = curl_init();
curl_close($ch);
var_dump($ch);
?>
-===DONE===
--EXPECTF--
resource(%d) of type (Unknown)
-===DONE===
diff --git a/ext/curl/tests/curl_copy_handle_basic.phpt b/ext/curl/tests/curl_copy_handle_basic.phpt
index 7801fe5674..0aa58dbcf8 100644
--- a/ext/curl/tests/curl_copy_handle_basic.phpt
+++ b/ext/curl/tests/curl_copy_handle_basic.phpt
@@ -23,8 +23,6 @@ $ch2 = curl_copy_handle($ch);
var_dump(curl_getinfo($ch) === curl_getinfo($ch2));
?>
-===DONE===
--EXPECT--
*** Testing curl_copy_handle(): basic ***
bool(true)
-===DONE===
diff --git a/ext/curl/tests/curl_copy_handle_basic_001.phpt b/ext/curl/tests/curl_copy_handle_basic_001.phpt
index 3b5190d31f..fbf8087877 100644
--- a/ext/curl/tests/curl_copy_handle_basic_001.phpt
+++ b/ext/curl/tests/curl_copy_handle_basic_001.phpt
@@ -28,7 +28,6 @@ Rick Buitenman <rick@meritos.nl>
var_dump( $curl_content );
?>
-===DONE===
--EXPECT--
*** Testing curl copy handle with simple GET ***
string(106) "array(2) {
@@ -40,4 +39,3 @@ string(106) "array(2) {
array(0) {
}
"
-===DONE===
diff --git a/ext/curl/tests/curl_copy_handle_basic_002.phpt b/ext/curl/tests/curl_copy_handle_basic_002.phpt
index e8ebcce325..1c3f29f53e 100644
--- a/ext/curl/tests/curl_copy_handle_basic_002.phpt
+++ b/ext/curl/tests/curl_copy_handle_basic_002.phpt
@@ -29,7 +29,6 @@ Rick Buitenman <rick@meritos.nl>
var_dump( $curl_content );
?>
-===DONE===
--EXPECT--
*** Testing curl copy handle with simple POST ***
string(163) "array(1) {
@@ -45,4 +44,3 @@ array(3) {
string(8) "John Doe"
}
"
-===DONE===
diff --git a/ext/curl/tests/curl_copy_handle_basic_004.phpt b/ext/curl/tests/curl_copy_handle_basic_004.phpt
index c020c3088b..fe860abfbc 100644
--- a/ext/curl/tests/curl_copy_handle_basic_004.phpt
+++ b/ext/curl/tests/curl_copy_handle_basic_004.phpt
@@ -30,7 +30,6 @@ Rick Buitenman <rick@meritos.nl>
var_dump( $curl_content_copy );
?>
-===DONE===
--EXPECT--
*** Test curl_copy_handle() after exec() ***
string(106) "array(2) {
@@ -42,4 +41,3 @@ string(106) "array(2) {
array(0) {
}
"
-===DONE===
diff --git a/ext/curl/tests/curl_copy_handle_basic_005.phpt b/ext/curl/tests/curl_copy_handle_basic_005.phpt
index 68df09c21c..54f9e14a4e 100644
--- a/ext/curl/tests/curl_copy_handle_basic_005.phpt
+++ b/ext/curl/tests/curl_copy_handle_basic_005.phpt
@@ -32,7 +32,6 @@ Rick Buitenman <rick@meritos.nl>
var_dump( $curl_content_copy );
?>
-===DONE===
--EXPECT--
*** Test curl_copy_handle() after exec() with POST ***
string(163) "array(1) {
@@ -48,4 +47,3 @@ array(3) {
string(8) "John Doe"
}
"
-===DONE===
diff --git a/ext/curl/tests/curl_copy_handle_basic_006.phpt b/ext/curl/tests/curl_copy_handle_basic_006.phpt
index 5d787bdf3c..e90501466b 100644
--- a/ext/curl/tests/curl_copy_handle_basic_006.phpt
+++ b/ext/curl/tests/curl_copy_handle_basic_006.phpt
@@ -30,9 +30,7 @@ Rick Buitenman <rick@meritos.nl>
curl_close($copy);
?>
-===DONE===
--EXPECT--
*** Testing curl copy handle with User Agent ***
string(9) "cURL phpt"
string(9) "cURL phpt"
-===DONE===
diff --git a/ext/curl/tests/curl_copy_handle_basic_007.phpt b/ext/curl/tests/curl_copy_handle_basic_007.phpt
index a48d40e270..d0a0b9e8da 100644
--- a/ext/curl/tests/curl_copy_handle_basic_007.phpt
+++ b/ext/curl/tests/curl_copy_handle_basic_007.phpt
@@ -27,7 +27,6 @@ Test curl_copy_handle() with simple POST
var_dump( $curl_content );
?>
-===DONE===
--EXPECT--
*** Testing curl copy handle with simple POST using array as arguments ***
string(163) "array(1) {
@@ -43,4 +42,3 @@ array(3) {
string(8) "John Doe"
}
"
-===DONE===
diff --git a/ext/curl/tests/curl_copy_handle_variation1.phpt b/ext/curl/tests/curl_copy_handle_variation1.phpt
index 2468ab93a3..8dbb3f6987 100644
--- a/ext/curl/tests/curl_copy_handle_variation1.phpt
+++ b/ext/curl/tests/curl_copy_handle_variation1.phpt
@@ -25,8 +25,6 @@ curl_setopt($ch2, CURLOPT_URL, 'http://www.bar.com/');
var_dump(curl_getinfo($ch) === curl_getinfo($ch2));
?>
-===DONE===
--EXPECT--
*** Testing curl_copy_handle(): basic ***
bool(false)
-===DONE===
diff --git a/ext/curl/tests/curl_copy_handle_variation2.phpt b/ext/curl/tests/curl_copy_handle_variation2.phpt
index 6358975057..be036d0ca8 100644
--- a/ext/curl/tests/curl_copy_handle_variation2.phpt
+++ b/ext/curl/tests/curl_copy_handle_variation2.phpt
@@ -34,11 +34,9 @@ var_dump(curl_getinfo($ch) === curl_getinfo($ch2));
curl_setopt($ch2, CURLOPT_URL, 'http://www.bar.com/');
var_dump(curl_getinfo($ch) === curl_getinfo($ch2));
?>
-===DONE===
--EXPECT--
*** Testing curl_copy_handle(): add options after copy ***
bool(true)
bool(false)
bool(true)
bool(false)
-===DONE===
diff --git a/ext/curl/tests/curl_copy_handle_variation3.phpt b/ext/curl/tests/curl_copy_handle_variation3.phpt
index 32946bb4df..ae643f4b30 100644
--- a/ext/curl/tests/curl_copy_handle_variation3.phpt
+++ b/ext/curl/tests/curl_copy_handle_variation3.phpt
@@ -26,12 +26,10 @@ curl_close($ch1);
var_dump(curl_exec($ch2));
curl_close($ch2);
?>
-===DONE===
--EXPECTF--
bool(true)
string(%d) "ÐБВ.txt|application/octet-stream|5"
string(%d) "ÐБВ.txt|application/octet-stream|5"
-===DONE===
--CLEAN--
<?php
@unlink(__DIR__ . '/ÐБВ.txt');
diff --git a/ext/curl/tests/curl_file_deleted_before_curl_close.phpt b/ext/curl/tests/curl_file_deleted_before_curl_close.phpt
index 92eba5e8c3..3d78ce60af 100644
--- a/ext/curl/tests/curl_file_deleted_before_curl_close.phpt
+++ b/ext/curl/tests/curl_file_deleted_before_curl_close.phpt
@@ -13,7 +13,7 @@ $ch = curl_init($host);
$temp_file = __DIR__ . '/curl_file_deleted_before_curl_close.tmp';
if (file_exists($temp_file)) {
- unlink($temp_file); // file should not exist before test
+ unlink($temp_file); // file should not exist before test
}
$handle = fopen($temp_file, 'w');
diff --git a/ext/curl/tests/curl_file_upload.phpt b/ext/curl/tests/curl_file_upload.phpt
index 1626f8117c..e4a7c78251 100644
--- a/ext/curl/tests/curl_file_upload.phpt
+++ b/ext/curl/tests/curl_file_upload.phpt
@@ -7,15 +7,15 @@ CURL file uploading
function testcurl($ch, $name, $mime = '', $postname = '')
{
- if(!empty($postname)) {
- $file = new CurlFile($name, $mime, $postname);
- } else if(!empty($mime)) {
- $file = new CurlFile($name, $mime);
- } else {
- $file = new CurlFile($name);
- }
- curl_setopt($ch, CURLOPT_POSTFIELDS, array("file" => $file));
- var_dump(curl_exec($ch));
+ if(!empty($postname)) {
+ $file = new CurlFile($name, $mime, $postname);
+ } else if(!empty($mime)) {
+ $file = new CurlFile($name, $mime);
+ } else {
+ $file = new CurlFile($name);
+ }
+ curl_setopt($ch, CURLOPT_POSTFIELDS, array("file" => $file));
+ var_dump(curl_exec($ch));
}
include 'server.inc';
diff --git a/ext/curl/tests/curl_file_upload_stream.phpt b/ext/curl/tests/curl_file_upload_stream.phpt
index 949cccbc31..082130176d 100644
--- a/ext/curl/tests/curl_file_upload_stream.phpt
+++ b/ext/curl/tests/curl_file_upload_stream.phpt
@@ -21,8 +21,6 @@ var_dump(curl_setopt($ch, CURLOPT_POSTFIELDS, $params));
var_dump(curl_exec($ch));
curl_close($ch);
?>
-===DONE===
--EXPECT--
bool(true)
string(24) "i-love-php|text/plain|11"
-===DONE===
diff --git a/ext/curl/tests/curl_ftp_pasv.phpt b/ext/curl/tests/curl_ftp_pasv.phpt
index f63a710ae9..866f1a2ca6 100644
--- a/ext/curl/tests/curl_ftp_pasv.phpt
+++ b/ext/curl/tests/curl_ftp_pasv.phpt
@@ -23,15 +23,15 @@ if (false === getenv('PHP_CURL_FTP_REMOTE_PASSWD')) exit("skip PHP_CURL_FTP_REM
// curl_setopt ( $ch , CURLOPT_VERBOSE, 1 );
/* Without enabling SKIP_PASV_IP flag, the following output will be seen..
- < 227 Entering Passive Mode (10,5,80,146,100,199)
- * Trying 10.5.80.146... * connected
- * Connecting to 10.5.80.146 (10.5.80.146) port 25799
+ < 227 Entering Passive Mode (10,5,80,146,100,199)
+ * Trying 10.5.80.146... * connected
+ * Connecting to 10.5.80.146 (10.5.80.146) port 25799
*/
/* After enabling SKIP_PASV_IP flag, the following output will be seen..
- < 227 Entering Passive Mode (10,5,80,146,50,229)
- * Skips 10.5.80.146 for data connection, uses 10.5.80.146 instead
- * Trying 10.5.80.146... * connected
+ < 227 Entering Passive Mode (10,5,80,146,50,229)
+ * Skips 10.5.80.146 for data connection, uses 10.5.80.146 instead
+ * Trying 10.5.80.146... * connected
*/
curl_setopt ( $ch , CURLOPT_URL, $url );
@@ -52,7 +52,5 @@ if (false === getenv('PHP_CURL_FTP_REMOTE_PASSWD')) exit("skip PHP_CURL_FTP_REM
curl_close ( $ch );
?>
-===DONE===
--EXPECT--
bool(true)
-===DONE===
diff --git a/ext/curl/tests/curl_multi_close_basic.phpt b/ext/curl/tests/curl_multi_close_basic.phpt
index 28865bc865..a9712dcf15 100644
--- a/ext/curl/tests/curl_multi_close_basic.phpt
+++ b/ext/curl/tests/curl_multi_close_basic.phpt
@@ -13,7 +13,5 @@ $ch = curl_multi_init();
curl_multi_close($ch);
var_dump($ch);
?>
-===DONE===
--EXPECTF--
resource(%d) of type (Unknown)
-===DONE===
diff --git a/ext/curl/tests/curl_multi_close_basic001.phpt b/ext/curl/tests/curl_multi_close_basic001.phpt
index 0cabf2cbad..42deaf78be 100644
--- a/ext/curl/tests/curl_multi_close_basic001.phpt
+++ b/ext/curl/tests/curl_multi_close_basic001.phpt
@@ -1,5 +1,5 @@
--TEST--
-curl_multi_close return false when suplied resorce not valid cURL multi handle
+curl_multi_close return false when supplied resource not valid cURL multi handle
--SKIPIF--
<?php
if (!extension_loaded('curl')) print 'skip';
@@ -11,15 +11,15 @@ var_dump($cmh);
$multi_close_result = curl_multi_close($cmh);
var_dump($multi_close_result);
var_dump($cmh);
-$bad_mh_close_result = curl_multi_close($cmh);
-var_dump($bad_mh_close_result);
+try {
+ $bad_mh_close_result = curl_multi_close($cmh);
+ var_dump($bad_mh_close_result);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
-===DONE===
--EXPECTF--
resource(%d) of type (curl_multi)
NULL
resource(%d) of type (Unknown)
-
-Warning: curl_multi_close(): supplied resource is not a valid cURL Multi Handle resource in %s on line %d
-bool(false)
-===DONE===
+curl_multi_close(): supplied resource is not a valid cURL Multi Handle resource
diff --git a/ext/curl/tests/curl_multi_errno_strerror_001.phpt b/ext/curl/tests/curl_multi_errno_strerror_001.phpt
index 9842aeda33..c2c0ef1d82 100644
--- a/ext/curl/tests/curl_multi_errno_strerror_001.phpt
+++ b/ext/curl/tests/curl_multi_errno_strerror_001.phpt
@@ -5,10 +5,6 @@ curl_multi_errno and curl_multi_strerror basic test
if (!extension_loaded("curl")) {
exit("skip curl extension not loaded");
}
-$curl_version = curl_version();
-if ($curl_version['version_number'] < 0x070f04) {
- exit("skip: test works only with curl >= 7.15.4");
-}
?>
--FILE--
<?php
diff --git a/ext/curl/tests/curl_multi_getcontent_basic3.phpt b/ext/curl/tests/curl_multi_getcontent_basic3.phpt
index f67196d7e7..601aa17a2f 100644
--- a/ext/curl/tests/curl_multi_getcontent_basic3.phpt
+++ b/ext/curl/tests/curl_multi_getcontent_basic3.phpt
@@ -7,43 +7,43 @@ Rein Velt (rein@velt.org)
<?php include 'skipif.inc'; ?>
--FILE--
<?php
- //CURL_MULTI_GETCONTENT TEST
+ //CURL_MULTI_GETCONTENT TEST
- //CREATE RESOURCES
- $ch1=curl_init();
- $ch2=curl_init();
+ //CREATE RESOURCES
+ $ch1=curl_init();
+ $ch2=curl_init();
- //SET URL AND OTHER OPTIONS
+ //SET URL AND OTHER OPTIONS
include 'server.inc';
$host = curl_cli_server_start();
- curl_setopt($ch1, CURLOPT_URL, "{$host}/get.inc?test=getpost&get_param=Hello%20World");
- curl_setopt($ch2, CURLOPT_URL, "file://".__DIR__. DIRECTORY_SEPARATOR . "curl_testdata2.txt");
- curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch2, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($ch1, CURLOPT_URL, "{$host}/get.inc?test=getpost&get_param=Hello%20World");
+ curl_setopt($ch2, CURLOPT_URL, "file://".__DIR__. DIRECTORY_SEPARATOR . "curl_testdata2.txt");
+ curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($ch2, CURLOPT_RETURNTRANSFER, true);
- //CREATE MULTIPLE CURL HANDLE
- $mh=curl_multi_init();
+ //CREATE MULTIPLE CURL HANDLE
+ $mh=curl_multi_init();
- //ADD THE 2 HANDLES
- curl_multi_add_handle($mh,$ch1);
- curl_multi_add_handle($mh,$ch2);
+ //ADD THE 2 HANDLES
+ curl_multi_add_handle($mh,$ch1);
+ curl_multi_add_handle($mh,$ch2);
- //EXECUTE
- $running=0;
- do {
- curl_multi_exec($mh,$running);
- } while ($running>0);
+ //EXECUTE
+ $running=0;
+ do {
+ curl_multi_exec($mh,$running);
+ } while ($running>0);
- $results1=curl_multi_getcontent($ch1);
+ $results1=curl_multi_getcontent($ch1);
$results2=curl_multi_getcontent($ch2);
- //CLOSE
- curl_multi_remove_handle($mh,$ch1);
- curl_multi_remove_handle($mh,$ch2);
- curl_multi_close($mh);
+ //CLOSE
+ curl_multi_remove_handle($mh,$ch1);
+ curl_multi_remove_handle($mh,$ch2);
+ curl_multi_close($mh);
- echo $results1;
- echo $results2;
+ echo $results1;
+ echo $results2;
?>
--EXPECT--
diff --git a/ext/curl/tests/curl_multi_init_basic.phpt b/ext/curl/tests/curl_multi_init_basic.phpt
index 0fd865df79..452bc42837 100644
--- a/ext/curl/tests/curl_multi_init_basic.phpt
+++ b/ext/curl/tests/curl_multi_init_basic.phpt
@@ -23,9 +23,7 @@ var_dump($mh);
curl_multi_close($mh);
var_dump($mh);
?>
-===DONE===
--EXPECTF--
*** Testing curl_multi_init(void); ***
resource(%d) of type (curl_multi)
resource(%d) of type (Unknown)
-===DONE===
diff --git a/ext/curl/tests/curl_multi_segfault.phpt b/ext/curl/tests/curl_multi_segfault.phpt
index 8af4dde635..c577b04516 100644
--- a/ext/curl/tests/curl_multi_segfault.phpt
+++ b/ext/curl/tests/curl_multi_segfault.phpt
@@ -32,16 +32,16 @@ if (false === getenv('PHP_CURL_FTP_REMOTE_PASSWD')) exit("skip PHP_CURL_FTP_REM
$active = null;
do {
- $mrc = curl_multi_exec($cmh, $active);
+ $mrc = curl_multi_exec($cmh, $active);
} while ($mrc == CURLM_CALL_MULTI_PERFORM);
while ($active && $mrc == CURLM_OK) {
- if (curl_multi_select($cmh) != -1) {
- do {
- $mrc = curl_multi_exec($cmh, $active);
- } while ($mrc == CURLM_CALL_MULTI_PERFORM);
- }
+ if (curl_multi_select($cmh) != -1) {
+ do {
+ $mrc = curl_multi_exec($cmh, $active);
+ } while ($mrc == CURLM_CALL_MULTI_PERFORM);
+ }
}
var_dump(is_string(curl_multi_getcontent($ch)));
@@ -49,7 +49,5 @@ if (false === getenv('PHP_CURL_FTP_REMOTE_PASSWD')) exit("skip PHP_CURL_FTP_REM
curl_close($ch);
curl_multi_close($cmh);
?>
-===DONE===
--EXPECT--
bool(true)
-===DONE===
diff --git a/ext/curl/tests/curl_multi_select_basic1.phpt b/ext/curl/tests/curl_multi_select_basic1.phpt
index 03bd9263a2..6acfc654ef 100644
--- a/ext/curl/tests/curl_multi_select_basic1.phpt
+++ b/ext/curl/tests/curl_multi_select_basic1.phpt
@@ -21,7 +21,5 @@ echo curl_multi_select($mh)."\n";
curl_multi_close($mh);
?>
-===DONE===
--EXPECTF--
%r(0|-1)%r
-===DONE===
diff --git a/ext/curl/tests/curl_multi_setopt_basic001.phpt b/ext/curl/tests/curl_multi_setopt_basic001.phpt
index a13cf6d716..dcea2f2910 100644
--- a/ext/curl/tests/curl_multi_setopt_basic001.phpt
+++ b/ext/curl/tests/curl_multi_setopt_basic001.phpt
@@ -5,10 +5,6 @@ curl_multi_setopt basic test
if (!extension_loaded("curl")) {
exit("skip curl extension not loaded");
}
-$curl_version = curl_version();
-if ($curl_version['version_number'] < 0x071000) {
- exit("skip: test works only with curl >= 7.16.0");
-}
?>
--FILE--
<?php
diff --git a/ext/curl/tests/curl_multi_strerror_001.phpt b/ext/curl/tests/curl_multi_strerror_001.phpt
index becaebd6cc..3c2edb988d 100644
--- a/ext/curl/tests/curl_multi_strerror_001.phpt
+++ b/ext/curl/tests/curl_multi_strerror_001.phpt
@@ -5,10 +5,6 @@ curl_multi_strerror basic test
if (!extension_loaded("curl")) {
exit("skip curl extension not loaded");
}
-$curl_version = curl_version();
-if ($curl_version['version_number'] < 0x070c00) {
- exit("skip: test works only with curl >= 7.12.0");
-}
?>
--FILE--
<?php
diff --git a/ext/curl/tests/curl_reset.phpt b/ext/curl/tests/curl_reset.phpt
index 3572e69543..59ed2ed6a5 100644
--- a/ext/curl/tests/curl_reset.phpt
+++ b/ext/curl/tests/curl_reset.phpt
@@ -37,7 +37,5 @@ unlink($log_file);
?>
-===DONE===
--EXPECT--
testtest
-===DONE===
diff --git a/ext/curl/tests/curl_setopt_CURLOPT_READFUNCTION.phpt b/ext/curl/tests/curl_setopt_CURLOPT_READFUNCTION.phpt
index 32af88fb20..ff634b4a2a 100644
--- a/ext/curl/tests/curl_setopt_CURLOPT_READFUNCTION.phpt
+++ b/ext/curl/tests/curl_setopt_CURLOPT_READFUNCTION.phpt
@@ -40,7 +40,6 @@ fclose ($hReadHandle);
$sOutput = file_get_contents($sWriteFile);
var_dump($sOutput);
?>
-===DONE===
--CLEAN--
<?php
$sFileBase = __DIR__.DIRECTORY_SEPARATOR.'curl_opt_CURLOPT_READFUNCTION';
@@ -51,4 +50,3 @@ unlink($sWriteFile);
?>
--EXPECT--
string(27) "custom:contents of tempfile"
-===DONE===
diff --git a/ext/curl/tests/curl_setopt_error.phpt b/ext/curl/tests/curl_setopt_error.phpt
index ab864d4b2d..0a7db7265f 100644
--- a/ext/curl/tests/curl_setopt_error.phpt
+++ b/ext/curl/tests/curl_setopt_error.phpt
@@ -9,37 +9,17 @@ Paul Sohier
<?php
echo "*** curl_setopt() call with incorrect parameters\n";
$ch = curl_init();
-curl_setopt();
-curl_setopt(false);
-curl_setopt($ch);
-curl_setopt($ch, false);
-curl_setopt($ch, -10);
-curl_setopt($ch, '');
-curl_setopt($ch, 1, false);
+try {
+ curl_setopt($ch, '', false);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
-curl_setopt(false, false, false);
-curl_setopt($ch, '', false);
-curl_setopt($ch, 1, '');
curl_setopt($ch, -10, 0);
?>
--EXPECTF--
*** curl_setopt() call with incorrect parameters
-
-Warning: curl_setopt() expects exactly 3 parameters, 0 given in %s on line %d
-
-Warning: curl_setopt() expects exactly 3 parameters, 1 given in %s on line %d
-
-Warning: curl_setopt() expects exactly 3 parameters, 1 given in %s on line %d
-
-Warning: curl_setopt() expects exactly 3 parameters, 2 given in %s on line %d
-
-Warning: curl_setopt() expects exactly 3 parameters, 2 given in %s on line %d
-
-Warning: curl_setopt() expects exactly 3 parameters, 2 given in %s on line %d
-
-Warning: curl_setopt() expects parameter 1 to be resource, bool given in %s on line %d
-
-Warning: curl_setopt() expects parameter 2 to be int, string given in %s on line %d
+curl_setopt() expects parameter 2 to be int, string given
Warning: curl_setopt(): Invalid curl configuration option in %scurl_setopt_error.php on line %d
diff --git a/ext/curl/tests/curl_share_errno_strerror_001.phpt b/ext/curl/tests/curl_share_errno_strerror_001.phpt
index 1db23c7b92..5b47a1cdb7 100644
--- a/ext/curl/tests/curl_share_errno_strerror_001.phpt
+++ b/ext/curl/tests/curl_share_errno_strerror_001.phpt
@@ -5,10 +5,6 @@ curl_share_errno and curl_share_strerror basic test
if (!extension_loaded("curl")) {
exit("skip curl extension not loaded");
}
-$curl_version = curl_version();
-if ($curl_version['version_number'] < 0x070c00) {
- exit("skip: test works only with curl >= 7.12.0");
-}
?>
--FILE--
<?php
diff --git a/ext/curl/tests/curl_strerror_001.phpt b/ext/curl/tests/curl_strerror_001.phpt
index f103f43966..0634259896 100644
--- a/ext/curl/tests/curl_strerror_001.phpt
+++ b/ext/curl/tests/curl_strerror_001.phpt
@@ -5,10 +5,6 @@ curl_strerror basic test
if (!extension_loaded("curl")) {
exit("skip curl extension not loaded");
}
-$curl_version = curl_version();
-if ($curl_version['version_number'] < 0x070c00) {
- exit("skip: test works only with curl >= 7.12.0");
-}
?>
--FILE--
<?php
diff --git a/ext/curl/tests/curl_version_error_001.phpt b/ext/curl/tests/curl_version_error_001.phpt
index 2c56e0a928..c281cc116b 100644
--- a/ext/curl/tests/curl_version_error_001.phpt
+++ b/ext/curl/tests/curl_version_error_001.phpt
@@ -9,9 +9,7 @@ if (!extension_loaded('curl')) die('skip curl extension not available');
curl_version(CURLVERSION_NOW);
curl_version(0);
?>
-===DONE===
--EXPECTF--
-Deprecated: curl_version(): the $version parameter is deprecated in %s on line %d
+Deprecated: curl_version(): The $version parameter is deprecated in %s on line %d
Warning: curl_version(): $version argument ignored in %s on line %d
-===DONE===
diff --git a/ext/curl/tests/curl_write_callback.phpt b/ext/curl/tests/curl_write_callback.phpt
index c0b733ee44..36fcf285aa 100644
--- a/ext/curl/tests/curl_write_callback.phpt
+++ b/ext/curl/tests/curl_write_callback.phpt
@@ -12,8 +12,8 @@ Writes the value 'test' to a temporary file. Use curl to access this file, passi
function curl_callback($curl_handle, $received_data)
{
- echo $received_data;
- return strlen($received_data);
+ echo $received_data;
+ return strlen($received_data);
}
$log_file = tempnam(sys_get_temp_dir(), 'php-curl-test');
diff --git a/ext/curl/tests/curl_writeheader_callback.phpt b/ext/curl/tests/curl_writeheader_callback.phpt
index 6336e14a6d..f56adb1dc5 100644
--- a/ext/curl/tests/curl_writeheader_callback.phpt
+++ b/ext/curl/tests/curl_writeheader_callback.phpt
@@ -12,8 +12,8 @@ Hit the host and determine that the headers are sent to the callback specified f
function curl_header_callback($curl_handle, $data)
{
- if (strtolower(substr($data,0, 4)) == 'http')
- echo $data;
+ if (strtolower(substr($data,0, 4)) == 'http')
+ echo $data;
}
include 'server.inc';
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index 705057766a..e9b077ca14 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -76,345 +74,7 @@ PHPAPI time_t php_time()
#endif
}
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date, 0, 0, 1)
- ZEND_ARG_INFO(0, format)
- ZEND_ARG_INFO(0, timestamp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmdate, 0, 0, 1)
- ZEND_ARG_INFO(0, format)
- ZEND_ARG_INFO(0, timestamp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_idate, 0, 0, 1)
- ZEND_ARG_INFO(0, format)
- ZEND_ARG_INFO(0, timestamp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_strtotime, 0, 0, 1)
- ZEND_ARG_INFO(0, time)
- ZEND_ARG_INFO(0, now)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mktime, 0, 0, 0)
- ZEND_ARG_INFO(0, hour)
- ZEND_ARG_INFO(0, min)
- ZEND_ARG_INFO(0, sec)
- ZEND_ARG_INFO(0, mon)
- ZEND_ARG_INFO(0, day)
- ZEND_ARG_INFO(0, year)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmmktime, 0, 0, 0)
- ZEND_ARG_INFO(0, hour)
- ZEND_ARG_INFO(0, min)
- ZEND_ARG_INFO(0, sec)
- ZEND_ARG_INFO(0, mon)
- ZEND_ARG_INFO(0, day)
- ZEND_ARG_INFO(0, year)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_checkdate, 0)
- ZEND_ARG_INFO(0, month)
- ZEND_ARG_INFO(0, day)
- ZEND_ARG_INFO(0, year)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_strftime, 0, 0, 1)
- ZEND_ARG_INFO(0, format)
- ZEND_ARG_INFO(0, timestamp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmstrftime, 0, 0, 1)
- ZEND_ARG_INFO(0, format)
- ZEND_ARG_INFO(0, timestamp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_time, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_localtime, 0, 0, 0)
- ZEND_ARG_INFO(0, timestamp)
- ZEND_ARG_INFO(0, associative_array)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_getdate, 0, 0, 0)
- ZEND_ARG_INFO(0, timestamp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_date_default_timezone_set, 0)
- ZEND_ARG_INFO(0, timezone_identifier)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_date_default_timezone_get, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_sunrise, 0, 0, 1)
- ZEND_ARG_INFO(0, time)
- ZEND_ARG_INFO(0, format)
- ZEND_ARG_INFO(0, latitude)
- ZEND_ARG_INFO(0, longitude)
- ZEND_ARG_INFO(0, zenith)
- ZEND_ARG_INFO(0, gmt_offset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_sunset, 0, 0, 1)
- ZEND_ARG_INFO(0, time)
- ZEND_ARG_INFO(0, format)
- ZEND_ARG_INFO(0, latitude)
- ZEND_ARG_INFO(0, longitude)
- ZEND_ARG_INFO(0, zenith)
- ZEND_ARG_INFO(0, gmt_offset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_date_sun_info, 0)
- ZEND_ARG_INFO(0, time)
- ZEND_ARG_INFO(0, latitude)
- ZEND_ARG_INFO(0, longitude)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_create, 0, 0, 0)
- ZEND_ARG_INFO(0, time)
- ZEND_ARG_INFO(0, timezone)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_create_from_format, 0, 0, 2)
- ZEND_ARG_INFO(0, format)
- ZEND_ARG_INFO(0, time)
- ZEND_ARG_OBJ_INFO(0, object, DateTimeZone, 1)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_parse, 0, 0, 1)
- ZEND_ARG_INFO(0, date)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_parse_from_format, 0, 0, 2)
- ZEND_ARG_INFO(0, format)
- ZEND_ARG_INFO(0, date)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_date_get_last_errors, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_format, 0, 0, 2)
- ZEND_ARG_INFO(0, object)
- ZEND_ARG_INFO(0, format)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_format, 0, 0, 1)
- ZEND_ARG_INFO(0, format)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_modify, 0, 0, 2)
- ZEND_ARG_INFO(0, object)
- ZEND_ARG_INFO(0, modify)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_modify, 0, 0, 1)
- ZEND_ARG_INFO(0, modify)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_add, 0, 0, 2)
- ZEND_ARG_INFO(0, object)
- ZEND_ARG_INFO(0, interval)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_add, 0, 0, 1)
- ZEND_ARG_INFO(0, interval)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_sub, 0, 0, 2)
- ZEND_ARG_INFO(0, object)
- ZEND_ARG_INFO(0, interval)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_sub, 0, 0, 1)
- ZEND_ARG_INFO(0, interval)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_timezone_get, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_date_method_timezone_get, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_timezone_set, 0, 0, 2)
- ZEND_ARG_INFO(0, object)
- ZEND_ARG_INFO(0, timezone)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_timezone_set, 0, 0, 1)
- ZEND_ARG_INFO(0, timezone)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_offset_get, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_date_method_offset_get, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_diff, 0, 0, 2)
- ZEND_ARG_INFO(0, object)
- ZEND_ARG_INFO(0, object2)
- ZEND_ARG_INFO(0, absolute)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_diff, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
- ZEND_ARG_INFO(0, absolute)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_time_set, 0, 0, 3)
- ZEND_ARG_INFO(0, object)
- ZEND_ARG_INFO(0, hour)
- ZEND_ARG_INFO(0, minute)
- ZEND_ARG_INFO(0, second)
- ZEND_ARG_INFO(0, microseconds)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_time_set, 0, 0, 2)
- ZEND_ARG_INFO(0, hour)
- ZEND_ARG_INFO(0, minute)
- ZEND_ARG_INFO(0, second)
- ZEND_ARG_INFO(0, microseconds)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_date_set, 0, 0, 4)
- ZEND_ARG_INFO(0, object)
- ZEND_ARG_INFO(0, year)
- ZEND_ARG_INFO(0, month)
- ZEND_ARG_INFO(0, day)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_date_set, 0, 0, 3)
- ZEND_ARG_INFO(0, year)
- ZEND_ARG_INFO(0, month)
- ZEND_ARG_INFO(0, day)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_isodate_set, 0, 0, 3)
- ZEND_ARG_INFO(0, object)
- ZEND_ARG_INFO(0, year)
- ZEND_ARG_INFO(0, week)
- ZEND_ARG_INFO(0, day)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_isodate_set, 0, 0, 2)
- ZEND_ARG_INFO(0, year)
- ZEND_ARG_INFO(0, week)
- ZEND_ARG_INFO(0, day)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_timestamp_set, 0, 0, 2)
- ZEND_ARG_INFO(0, object)
- ZEND_ARG_INFO(0, unixtimestamp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_timestamp_set, 0, 0, 1)
- ZEND_ARG_INFO(0, unixtimestamp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_timestamp_get, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_date_method_timestamp_get, 0)
-ZEND_END_ARG_INFO()
-
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_create_from_immutable, 0, 0, 1)
- ZEND_ARG_INFO(0, DateTimeImmutable)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_create_from_mutable, 0, 0, 1)
- ZEND_ARG_INFO(0, DateTime)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_open, 0, 0, 1)
- ZEND_ARG_INFO(0, timezone)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_name_get, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_timezone_method_name_get, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_name_from_abbr, 0, 0, 1)
- ZEND_ARG_INFO(0, abbr)
- ZEND_ARG_INFO(0, gmtoffset)
- ZEND_ARG_INFO(0, isdst)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_offset_get, 0, 0, 2)
- ZEND_ARG_OBJ_INFO(0, object, DateTimeZone, 0)
- ZEND_ARG_OBJ_INFO(0, datetime, DateTimeInterface, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_method_offset_get, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_transitions_get, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
- ZEND_ARG_INFO(0, timestamp_begin)
- ZEND_ARG_INFO(0, timestamp_end)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_method_transitions_get, 0, 0, 0)
- ZEND_ARG_INFO(0, timestamp_begin)
- ZEND_ARG_INFO(0, timestamp_end)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_location_get, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_timezone_method_location_get, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_identifiers_list, 0, 0, 0)
- ZEND_ARG_INFO(0, what)
- ZEND_ARG_INFO(0, country)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_timezone_abbreviations_list, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_timezone_version_get, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_interval_create_from_date_string, 0, 0, 1)
- ZEND_ARG_INFO(0, time)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_interval_format, 0, 0, 2)
- ZEND_ARG_INFO(0, object)
- ZEND_ARG_INFO(0, format)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_date_method_interval_format, 0)
- ZEND_ARG_INFO(0, format)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_period_construct, 0, 0, 3)
- ZEND_ARG_INFO(0, start)
- ZEND_ARG_INFO(0, interval)
- ZEND_ARG_INFO(0, end)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_set_state, 0, 0, 1)
- ZEND_ARG_ARRAY_INFO(0, array, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_interval_construct, 0, 0, 1)
- ZEND_ARG_INFO(0, interval_spec)
-ZEND_END_ARG_INFO()
-/* }}} */
+#include "php_date_arginfo.h"
/* {{{ Function table */
static const zend_function_entry date_functions[] = {
@@ -433,9 +93,9 @@ static const zend_function_entry date_functions[] = {
/* Advanced Interface */
PHP_FE(date_create, arginfo_date_create)
- PHP_FE(date_create_immutable, arginfo_date_create)
+ PHP_FE(date_create_immutable, arginfo_date_create_immutable)
PHP_FE(date_create_from_format, arginfo_date_create_from_format)
- PHP_FE(date_create_immutable_from_format, arginfo_date_create_from_format)
+ PHP_FE(date_create_immutable_from_format, arginfo_date_create_immutable_from_format)
PHP_FE(date_parse, arginfo_date_parse)
PHP_FE(date_parse_from_format, arginfo_date_parse_from_format)
PHP_FE(date_get_last_errors, arginfo_date_get_last_errors)
@@ -479,91 +139,93 @@ static const zend_function_entry date_functions[] = {
};
static const zend_function_entry date_funcs_interface[] = {
- PHP_ABSTRACT_ME(DateTimeInterface, format, arginfo_date_method_format)
- PHP_ABSTRACT_ME(DateTimeInterface, getTimezone, arginfo_date_method_timezone_get)
- PHP_ABSTRACT_ME(DateTimeInterface, getOffset, arginfo_date_method_offset_get)
- PHP_ABSTRACT_ME(DateTimeInterface, getTimestamp, arginfo_date_method_timestamp_get)
- PHP_ABSTRACT_ME(DateTimeInterface, diff, arginfo_date_method_diff)
- PHP_ABSTRACT_ME(DateTimeInterface, __wakeup, NULL)
+ PHP_ABSTRACT_ME(DateTimeInterface, format, arginfo_class_DateTimeInterface_format)
+ PHP_ABSTRACT_ME(DateTimeInterface, getTimezone, arginfo_class_DateTimeInterface_getTimezone)
+ PHP_ABSTRACT_ME(DateTimeInterface, getOffset, arginfo_class_DateTimeInterface_getOffset)
+ PHP_ABSTRACT_ME(DateTimeInterface, getTimestamp, arginfo_class_DateTimeInterface_getTimestamp)
+ PHP_ABSTRACT_ME(DateTimeInterface, diff, arginfo_class_DateTimeInterface_diff)
+ PHP_ABSTRACT_ME(DateTimeInterface, __wakeup, arginfo_class_DateTimeInterface___wakeup)
PHP_FE_END
};
static const zend_function_entry date_funcs_date[] = {
- PHP_ME(DateTime, __construct, arginfo_date_create, ZEND_ACC_PUBLIC)
- PHP_ME(DateTime, __wakeup, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(DateTime, __set_state, arginfo_date_set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- PHP_ME(DateTime, createFromImmutable, arginfo_date_method_create_from_immutable, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- PHP_ME_MAPPING(createFromFormat, date_create_from_format, arginfo_date_create_from_format, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- PHP_ME_MAPPING(getLastErrors, date_get_last_errors, arginfo_date_get_last_errors, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- PHP_ME_MAPPING(format, date_format, arginfo_date_method_format, 0)
- PHP_ME_MAPPING(modify, date_modify, arginfo_date_method_modify, 0)
- PHP_ME_MAPPING(add, date_add, arginfo_date_method_add, 0)
- PHP_ME_MAPPING(sub, date_sub, arginfo_date_method_sub, 0)
- PHP_ME_MAPPING(getTimezone, date_timezone_get, arginfo_date_method_timezone_get, 0)
- PHP_ME_MAPPING(setTimezone, date_timezone_set, arginfo_date_method_timezone_set, 0)
- PHP_ME_MAPPING(getOffset, date_offset_get, arginfo_date_method_offset_get, 0)
- PHP_ME_MAPPING(setTime, date_time_set, arginfo_date_method_time_set, 0)
- PHP_ME_MAPPING(setDate, date_date_set, arginfo_date_method_date_set, 0)
- PHP_ME_MAPPING(setISODate, date_isodate_set, arginfo_date_method_isodate_set, 0)
- PHP_ME_MAPPING(setTimestamp, date_timestamp_set, arginfo_date_method_timestamp_set, 0)
- PHP_ME_MAPPING(getTimestamp, date_timestamp_get, arginfo_date_method_timestamp_get, 0)
- PHP_ME_MAPPING(diff, date_diff, arginfo_date_method_diff, 0)
+ PHP_ME(DateTime, __construct, arginfo_class_DateTime___construct, ZEND_ACC_PUBLIC)
+ PHP_ME(DateTime, __wakeup, arginfo_class_DateTimeInterface___wakeup, ZEND_ACC_PUBLIC)
+ PHP_ME(DateTime, __set_state, arginfo_class_DateTime___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME(DateTime, createFromImmutable, arginfo_class_DateTime_createFromImmutable, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME(DateTime, createFromInterface, arginfo_class_DateTime_createFromInterface, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME_MAPPING(createFromFormat, date_create_from_format, arginfo_class_DateTime_createFromFormat, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME_MAPPING(getLastErrors, date_get_last_errors, arginfo_class_DateTime_getLastErrors, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME_MAPPING(format, date_format, arginfo_class_DateTimeInterface_format, 0)
+ PHP_ME_MAPPING(modify, date_modify, arginfo_class_DateTime_modify, 0)
+ PHP_ME_MAPPING(add, date_add, arginfo_class_DateTime_add, 0)
+ PHP_ME_MAPPING(sub, date_sub, arginfo_class_DateTime_sub, 0)
+ PHP_ME_MAPPING(getTimezone, date_timezone_get, arginfo_class_DateTimeInterface_getTimezone, 0)
+ PHP_ME_MAPPING(setTimezone, date_timezone_set, arginfo_class_DateTime_setTimezone, 0)
+ PHP_ME_MAPPING(getOffset, date_offset_get, arginfo_class_DateTimeInterface_getOffset, 0)
+ PHP_ME_MAPPING(setTime, date_time_set, arginfo_class_DateTime_setTime, 0)
+ PHP_ME_MAPPING(setDate, date_date_set, arginfo_class_DateTime_setDate, 0)
+ PHP_ME_MAPPING(setISODate, date_isodate_set, arginfo_class_DateTime_setISODate, 0)
+ PHP_ME_MAPPING(setTimestamp, date_timestamp_set, arginfo_class_DateTime_setTimestamp, 0)
+ PHP_ME_MAPPING(getTimestamp, date_timestamp_get, arginfo_class_DateTimeInterface_getTimestamp, 0)
+ PHP_ME_MAPPING(diff, date_diff, arginfo_class_DateTimeInterface_diff, 0)
PHP_FE_END
};
static const zend_function_entry date_funcs_immutable[] = {
- PHP_ME(DateTimeImmutable, __construct, arginfo_date_create, ZEND_ACC_PUBLIC)
- PHP_ME(DateTime, __wakeup, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(DateTimeImmutable, __set_state, arginfo_date_set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- PHP_ME_MAPPING(createFromFormat, date_create_immutable_from_format, arginfo_date_create_from_format, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- PHP_ME_MAPPING(getLastErrors, date_get_last_errors, arginfo_date_get_last_errors, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- PHP_ME_MAPPING(format, date_format, arginfo_date_method_format, 0)
- PHP_ME_MAPPING(getTimezone, date_timezone_get, arginfo_date_method_timezone_get, 0)
- PHP_ME_MAPPING(getOffset, date_offset_get, arginfo_date_method_offset_get, 0)
- PHP_ME_MAPPING(getTimestamp, date_timestamp_get, arginfo_date_method_timestamp_get, 0)
- PHP_ME_MAPPING(diff, date_diff, arginfo_date_method_diff, 0)
- PHP_ME(DateTimeImmutable, modify, arginfo_date_method_modify, 0)
- PHP_ME(DateTimeImmutable, add, arginfo_date_method_add, 0)
- PHP_ME(DateTimeImmutable, sub, arginfo_date_method_sub, 0)
- PHP_ME(DateTimeImmutable, setTimezone, arginfo_date_method_timezone_set, 0)
- PHP_ME(DateTimeImmutable, setTime, arginfo_date_method_time_set, 0)
- PHP_ME(DateTimeImmutable, setDate, arginfo_date_method_date_set, 0)
- PHP_ME(DateTimeImmutable, setISODate, arginfo_date_method_isodate_set, 0)
- PHP_ME(DateTimeImmutable, setTimestamp, arginfo_date_method_timestamp_set, 0)
- PHP_ME(DateTimeImmutable, createFromMutable, arginfo_date_method_create_from_mutable, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME(DateTimeImmutable, __construct, arginfo_class_DateTimeImmutable___construct, ZEND_ACC_PUBLIC)
+ PHP_ME(DateTime, __wakeup, arginfo_class_DateTimeInterface___wakeup, ZEND_ACC_PUBLIC)
+ PHP_ME(DateTimeImmutable, __set_state, arginfo_class_DateTimeImmutable___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME_MAPPING(createFromFormat, date_create_immutable_from_format, arginfo_class_DateTimeImmutable_createFromFormat, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME_MAPPING(getLastErrors, date_get_last_errors, arginfo_class_DateTimeImmutable_getLastErrors, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME_MAPPING(format, date_format, arginfo_class_DateTimeInterface_format, 0)
+ PHP_ME_MAPPING(getTimezone, date_timezone_get, arginfo_class_DateTimeInterface_getTimezone, 0)
+ PHP_ME_MAPPING(getOffset, date_offset_get, arginfo_class_DateTimeInterface_getOffset, 0)
+ PHP_ME_MAPPING(getTimestamp, date_timestamp_get, arginfo_class_DateTimeInterface_getTimestamp, 0)
+ PHP_ME_MAPPING(diff, date_diff, arginfo_class_DateTimeInterface_diff, 0)
+ PHP_ME(DateTimeImmutable, modify, arginfo_class_DateTimeImmutable_modify, 0)
+ PHP_ME(DateTimeImmutable, add, arginfo_class_DateTimeImmutable_add, 0)
+ PHP_ME(DateTimeImmutable, sub, arginfo_class_DateTimeImmutable_sub, 0)
+ PHP_ME(DateTimeImmutable, setTimezone, arginfo_class_DateTimeImmutable_setTimezone, 0)
+ PHP_ME(DateTimeImmutable, setTime, arginfo_class_DateTimeImmutable_setTime, 0)
+ PHP_ME(DateTimeImmutable, setDate, arginfo_class_DateTimeImmutable_setDate, 0)
+ PHP_ME(DateTimeImmutable, setISODate, arginfo_class_DateTimeImmutable_setISODate, 0)
+ PHP_ME(DateTimeImmutable, setTimestamp, arginfo_class_DateTimeImmutable_setTimestamp, 0)
+ PHP_ME(DateTimeImmutable, createFromMutable, arginfo_class_DateTimeImmutable_createFromMutable, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME(DateTimeImmutable, createFromInterface, arginfo_class_DateTimeImmutable_createFromInterface, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
PHP_FE_END
};
static const zend_function_entry date_funcs_timezone[] = {
- PHP_ME(DateTimeZone, __construct, arginfo_timezone_open, ZEND_ACC_PUBLIC)
- PHP_ME(DateTimeZone, __wakeup, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(DateTimeZone, __set_state, arginfo_date_set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- PHP_ME_MAPPING(getName, timezone_name_get, arginfo_timezone_method_name_get, 0)
- PHP_ME_MAPPING(getOffset, timezone_offset_get, arginfo_timezone_method_offset_get, 0)
- PHP_ME_MAPPING(getTransitions, timezone_transitions_get, arginfo_timezone_method_transitions_get, 0)
- PHP_ME_MAPPING(getLocation, timezone_location_get, arginfo_timezone_method_location_get, 0)
- PHP_ME_MAPPING(listAbbreviations, timezone_abbreviations_list, arginfo_timezone_abbreviations_list, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- PHP_ME_MAPPING(listIdentifiers, timezone_identifiers_list, arginfo_timezone_identifiers_list, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME(DateTimeZone, __construct, arginfo_class_DateTimeZone___construct, ZEND_ACC_PUBLIC)
+ PHP_ME(DateTimeZone, __wakeup, arginfo_class_DateTimeZone___wakeup, ZEND_ACC_PUBLIC)
+ PHP_ME(DateTimeZone, __set_state, arginfo_class_DateTimeZone___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME_MAPPING(getName, timezone_name_get, arginfo_class_DateTimeZone_getName, 0)
+ PHP_ME_MAPPING(getOffset, timezone_offset_get, arginfo_class_DateTimeZone_getOffset, 0)
+ PHP_ME_MAPPING(getTransitions, timezone_transitions_get, arginfo_class_DateTimeZone_getTransitions, 0)
+ PHP_ME_MAPPING(getLocation, timezone_location_get, arginfo_class_DateTimeZone_getLocation, 0)
+ PHP_ME_MAPPING(listAbbreviations, timezone_abbreviations_list, arginfo_class_DateTimeZone_listAbbreviations, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME_MAPPING(listIdentifiers, timezone_identifiers_list, arginfo_class_DateTimeZone_listIdentifiers, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
PHP_FE_END
};
static const zend_function_entry date_funcs_interval[] = {
- PHP_ME(DateInterval, __construct, arginfo_date_interval_construct, ZEND_ACC_PUBLIC)
- PHP_ME(DateInterval, __wakeup, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(DateInterval, __set_state, arginfo_date_set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- PHP_ME_MAPPING(format, date_interval_format, arginfo_date_method_interval_format, 0)
- PHP_ME_MAPPING(createFromDateString, date_interval_create_from_date_string, arginfo_date_interval_create_from_date_string, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME(DateInterval, __construct, arginfo_class_DateInterval___construct, ZEND_ACC_PUBLIC)
+ PHP_ME(DateInterval, __wakeup, arginfo_class_DateInterval___wakeup, ZEND_ACC_PUBLIC)
+ PHP_ME(DateInterval, __set_state, arginfo_class_DateInterval___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME_MAPPING(format, date_interval_format, arginfo_class_DateInterval_format, 0)
+ PHP_ME_MAPPING(createFromDateString, date_interval_create_from_date_string, arginfo_class_DateInterval_createFromDateString, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
PHP_FE_END
};
static const zend_function_entry date_funcs_period[] = {
- PHP_ME(DatePeriod, __construct, arginfo_date_period_construct, ZEND_ACC_PUBLIC)
- PHP_ME(DatePeriod, __wakeup, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(DatePeriod, __set_state, arginfo_date_set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- PHP_ME(DatePeriod, getStartDate, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(DatePeriod, getEndDate, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(DatePeriod, getDateInterval, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(DatePeriod, getRecurrences, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(DatePeriod, __construct, arginfo_class_DatePeriod___construct, ZEND_ACC_PUBLIC)
+ PHP_ME(DatePeriod, __wakeup, arginfo_class_DatePeriod___wakeup, ZEND_ACC_PUBLIC)
+ PHP_ME(DatePeriod, __set_state, arginfo_class_DatePeriod___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME(DatePeriod, getStartDate, arginfo_class_DatePeriod_getStartDate, ZEND_ACC_PUBLIC)
+ PHP_ME(DatePeriod, getEndDate, arginfo_class_DatePeriod_getEndDate, ZEND_ACC_PUBLIC)
+ PHP_ME(DatePeriod, getDateInterval, arginfo_class_DatePeriod_getDateInterval, ZEND_ACC_PUBLIC)
+ PHP_ME(DatePeriod, getRecurrences, arginfo_class_DatePeriod_getRecurrences, ZEND_ACC_PUBLIC)
PHP_FE_END
};
@@ -581,11 +243,11 @@ int php_date_global_timezone_db_enabled;
#define DATE_DEFAULT_LATITUDE "31.7667"
#define DATE_DEFAULT_LONGITUDE "35.2333"
-/* on 90'35; common sunset declaration (start of sun body appear) */
-#define DATE_SUNSET_ZENITH "90.583333"
+/* on 90'50; common sunset declaration (start of sun body appear) */
+#define DATE_SUNSET_ZENITH "90.833333"
-/* on 90'35; common sunrise declaration (sun body disappeared) */
-#define DATE_SUNRISE_ZENITH "90.583333"
+/* on 90'50; common sunrise declaration (sun body disappeared) */
+#define DATE_SUNRISE_ZENITH "90.833333"
static PHP_INI_MH(OnUpdate_date_timezone);
@@ -641,8 +303,8 @@ static zend_object_handlers date_object_handlers_period;
#define DATE_CHECK_INITIALIZED(member, class_name) \
if (!(member)) { \
- php_error_docref(NULL, E_WARNING, "The " #class_name " object has not been correctly initialized by its constructor"); \
- RETURN_FALSE; \
+ zend_throw_error(NULL, "The " #class_name " object has not been correctly initialized by its constructor"); \
+ RETURN_THROWS(); \
}
static void date_object_free_storage_date(zend_object *object);
@@ -655,30 +317,30 @@ static zend_object *date_object_new_timezone(zend_class_entry *class_type);
static zend_object *date_object_new_interval(zend_class_entry *class_type);
static zend_object *date_object_new_period(zend_class_entry *class_type);
-static zend_object *date_object_clone_date(zval *this_ptr);
-static zend_object *date_object_clone_timezone(zval *this_ptr);
-static zend_object *date_object_clone_interval(zval *this_ptr);
-static zend_object *date_object_clone_period(zval *this_ptr);
+static zend_object *date_object_clone_date(zend_object *this_ptr);
+static zend_object *date_object_clone_timezone(zend_object *this_ptr);
+static zend_object *date_object_clone_interval(zend_object *this_ptr);
+static zend_object *date_object_clone_period(zend_object *this_ptr);
static int date_object_compare_date(zval *d1, zval *d2);
-static HashTable *date_object_get_gc(zval *object, zval **table, int *n);
-static HashTable *date_object_get_properties_for(zval *object, zend_prop_purpose purpose);
-static HashTable *date_object_get_gc_interval(zval *object, zval **table, int *n);
-static HashTable *date_object_get_properties_interval(zval *object);
-static HashTable *date_object_get_gc_period(zval *object, zval **table, int *n);
-static HashTable *date_object_get_properties_period(zval *object);
-static HashTable *date_object_get_properties_for_timezone(zval *object, zend_prop_purpose purpose);
-static HashTable *date_object_get_gc_timezone(zval *object, zval **table, int *n);
-static HashTable *date_object_get_debug_info_timezone(zval *object, int *is_temp);
+static HashTable *date_object_get_gc(zend_object *object, zval **table, int *n);
+static HashTable *date_object_get_properties_for(zend_object *object, zend_prop_purpose purpose);
+static HashTable *date_object_get_gc_interval(zend_object *object, zval **table, int *n);
+static HashTable *date_object_get_properties_interval(zend_object *object);
+static HashTable *date_object_get_gc_period(zend_object *object, zval **table, int *n);
+static HashTable *date_object_get_properties_period(zend_object *object);
+static HashTable *date_object_get_properties_for_timezone(zend_object *object, zend_prop_purpose purpose);
+static HashTable *date_object_get_gc_timezone(zend_object *object, zval **table, int *n);
+static HashTable *date_object_get_debug_info_timezone(zend_object *object, int *is_temp);
static void php_timezone_to_string(php_timezone_obj *tzobj, zval *zv);
static int date_interval_compare_objects(zval *o1, zval *o2);
-static zval *date_interval_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv);
-static zval *date_interval_write_property(zval *object, zval *member, zval *value, void **cache_slot);
-static zval *date_interval_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot);
-static zval *date_period_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv);
-static zval *date_period_write_property(zval *object, zval *member, zval *value, void **cache_slot);
-static zval *date_period_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot);
+static zval *date_interval_read_property(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv);
+static zval *date_interval_write_property(zend_object *object, zend_string *member, zval *value, void **cache_slot);
+static zval *date_interval_get_property_ptr_ptr(zend_object *object, zend_string *member, int type, void **cache_slot);
+static zval *date_period_read_property(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv);
+static zval *date_period_write_property(zend_object *object, zend_string *name, zval *value, void **cache_slot);
+static zval *date_period_get_property_ptr_ptr(zend_object *object, zend_string *name, int type, void **cache_slot);
/* {{{ Module struct */
zend_module_entry date_module_entry = {
@@ -1276,7 +938,7 @@ static void php_date(INTERNAL_FUNCTION_PARAMETERS, int localtime)
Z_PARAM_STR(format)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(ts)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (ZEND_NUM_ARGS() == 1) {
ts = php_time();
@@ -1436,7 +1098,7 @@ PHP_FUNCTION(idate)
Z_PARAM_STR(format)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(ts)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (ZSTR_LEN(format) != 1) {
php_error_docref(NULL, E_WARNING, "idate format is one char");
@@ -1508,7 +1170,7 @@ PHP_FUNCTION(strtotime)
Z_PARAM_STR(times)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(preset_ts)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
tzi = get_timezone_info();
@@ -1546,15 +1208,15 @@ PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
zend_long ts, adjust_seconds = 0;
int error;
- ZEND_PARSE_PARAMETERS_START(0, 6)
- Z_PARAM_OPTIONAL
+ ZEND_PARSE_PARAMETERS_START(1, 6)
Z_PARAM_LONG(hou)
+ Z_PARAM_OPTIONAL
Z_PARAM_LONG(min)
Z_PARAM_LONG(sec)
Z_PARAM_LONG(mon)
Z_PARAM_LONG(day)
Z_PARAM_LONG(yea)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
/* Initialize structure with current time */
now = timelib_time_ctor();
@@ -1568,8 +1230,6 @@ PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
}
/* Fill in the new data */
switch (ZEND_NUM_ARGS()) {
- case 7:
- /* break intentionally missing */
case 6:
if (yea >= 0 && yea < 70) {
yea += 2000;
@@ -1593,8 +1253,7 @@ PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
case 1:
now->h = hou;
break;
- default:
- php_error_docref(NULL, E_DEPRECATED, "You should be using the time() function instead");
+ EMPTY_SWITCH_DEFAULT_CASE()
}
/* Update the timestamp */
if (gmt) {
@@ -1616,7 +1275,7 @@ PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
}
/* }}} */
-/* {{{ proto int mktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]])
+/* {{{ proto int mktime(int hour [, int min [, int sec [, int mon [, int day [, int year]]]]])
Get UNIX timestamp for a date */
PHP_FUNCTION(mktime)
{
@@ -1624,7 +1283,7 @@ PHP_FUNCTION(mktime)
}
/* }}} */
-/* {{{ proto int gmmktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]])
+/* {{{ proto int gmmktime(int hour [, int min [, int sec [, int mon [, int day [, int year]]]]])
Get UNIX timestamp for a GMT date */
PHP_FUNCTION(gmmktime)
{
@@ -1642,7 +1301,7 @@ PHP_FUNCTION(checkdate)
Z_PARAM_LONG(m)
Z_PARAM_LONG(d)
Z_PARAM_LONG(y)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (y < 1 || y > 32767 || !timelib_valid_date(y, m, d)) {
RETURN_FALSE;
@@ -1670,7 +1329,7 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
Z_PARAM_STR(format)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(timestamp)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (ZSTR_LEN(format) == 0) {
RETURN_FALSE;
@@ -1767,9 +1426,7 @@ PHP_FUNCTION(gmstrftime)
Return current UNIX timestamp */
PHP_FUNCTION(time)
{
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
RETURN_LONG((zend_long)php_time());
}
@@ -1788,7 +1445,7 @@ PHP_FUNCTION(localtime)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(timestamp)
Z_PARAM_BOOL(associative)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (ZEND_NUM_ARGS() == 0) {
timestamp = (zend_long) php_time();
@@ -1839,7 +1496,7 @@ PHP_FUNCTION(getdate)
ZEND_PARSE_PARAMETERS_START(0, 1)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(timestamp)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (ZEND_NUM_ARGS() == 0) {
timestamp = (zend_long) php_time();
@@ -2047,35 +1704,21 @@ static int implement_date_interface_handler(zend_class_entry *interface, zend_cl
return SUCCESS;
} /* }}} */
-static int date_interval_has_property(zval *object, zval *member, int type, void **cache_slot) /* {{{ */
+static int date_interval_has_property(zend_object *object, zend_string *name, int type, void **cache_slot) /* {{{ */
{
php_interval_obj *obj;
- zval tmp_member;
zval rv;
zval *prop;
int retval = 0;
- if (UNEXPECTED(Z_TYPE_P(member) != IS_STRING)) {
- zend_string *str = zval_try_get_string_func(member);
- if (UNEXPECTED(!str)) {
- return 0;
- }
- ZVAL_STR(&tmp_member, str);
- member = &tmp_member;
- cache_slot = NULL;
- }
-
- obj = Z_PHPINTERVAL_P(object);
+ obj = php_interval_obj_from_obj(object);
if (!obj->initialized) {
- retval = zend_std_has_property(object, member, type, cache_slot);
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
- }
+ retval = zend_std_has_property(object, name, type, cache_slot);
return retval;
}
- prop = date_interval_read_property(object, member, BP_VAR_IS, cache_slot, &rv);
+ prop = date_interval_read_property(object, name, BP_VAR_IS, cache_slot, &rv);
if (prop != &EG(uninitialized_zval)) {
if (type == 2) {
@@ -2086,11 +1729,7 @@ static int date_interval_has_property(zval *object, zval *member, int type, void
retval = (Z_TYPE_P(prop) != IS_NULL);
}
} else {
- retval = zend_std_has_property(object, member, type, cache_slot);
- }
-
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
+ retval = zend_std_has_property(object, name, type, cache_slot);
}
return retval;
@@ -2130,7 +1769,7 @@ static void date_register_classes(void) /* {{{ */
date_object_handlers_date.offset = XtOffsetOf(php_date_obj, std);
date_object_handlers_date.free_obj = date_object_free_storage_date;
date_object_handlers_date.clone_obj = date_object_clone_date;
- date_object_handlers_date.compare_objects = date_object_compare_date;
+ date_object_handlers_date.compare = date_object_compare_date;
date_object_handlers_date.get_properties_for = date_object_get_properties_for;
date_object_handlers_date.get_gc = date_object_get_gc;
zend_class_implements(date_ce_date, 1, date_ce_interface);
@@ -2140,7 +1779,7 @@ static void date_register_classes(void) /* {{{ */
date_ce_immutable = zend_register_internal_class_ex(&ce_immutable, NULL);
memcpy(&date_object_handlers_immutable, &std_object_handlers, sizeof(zend_object_handlers));
date_object_handlers_immutable.clone_obj = date_object_clone_date;
- date_object_handlers_immutable.compare_objects = date_object_compare_date;
+ date_object_handlers_immutable.compare = date_object_compare_date;
date_object_handlers_immutable.get_properties_for = date_object_get_properties_for;
date_object_handlers_immutable.get_gc = date_object_get_gc;
zend_class_implements(date_ce_immutable, 1, date_ce_interface);
@@ -2187,7 +1826,7 @@ static void date_register_classes(void) /* {{{ */
date_object_handlers_interval.get_properties = date_object_get_properties_interval;
date_object_handlers_interval.get_property_ptr_ptr = date_interval_get_property_ptr_ptr;
date_object_handlers_interval.get_gc = date_object_get_gc_interval;
- date_object_handlers_interval.compare_objects = date_interval_compare_objects;
+ date_object_handlers_interval.compare = date_interval_compare_objects;
INIT_CLASS_ENTRY(ce_period, "DatePeriod", date_funcs_period);
ce_period.create_object = date_object_new_period;
@@ -2221,9 +1860,9 @@ static zend_object *date_object_new_date(zend_class_entry *class_type) /* {{{ */
return &intern->std;
} /* }}} */
-static zend_object *date_object_clone_date(zval *this_ptr) /* {{{ */
+static zend_object *date_object_clone_date(zend_object *this_ptr) /* {{{ */
{
- php_date_obj *old_obj = Z_PHPDATE_P(this_ptr);
+ php_date_obj *old_obj = php_date_obj_from_obj(this_ptr);
php_date_obj *new_obj = php_date_obj_from_obj(date_object_new_date(old_obj->std.ce));
zend_objects_clone_members(&new_obj->std, &old_obj->std);
@@ -2246,13 +1885,18 @@ static zend_object *date_object_clone_date(zval *this_ptr) /* {{{ */
static void date_clone_immutable(zval *object, zval *new_object) /* {{{ */
{
- ZVAL_OBJ(new_object, date_object_clone_date(object));
+ ZVAL_OBJ(new_object, date_object_clone_date(Z_OBJ_P(object)));
} /* }}} */
static int date_object_compare_date(zval *d1, zval *d2) /* {{{ */
{
- php_date_obj *o1 = Z_PHPDATE_P(d1);
- php_date_obj *o2 = Z_PHPDATE_P(d2);
+ php_date_obj *o1;
+ php_date_obj *o2;
+
+ ZEND_COMPARE_OBJECTS_FALLBACK(d1, d2);
+
+ o1 = Z_PHPDATE_P(d1);
+ o2 = Z_PHPDATE_P(d2);
if (!o1->time || !o2->time) {
php_error_docref(NULL, E_WARNING, "Trying to compare an incomplete DateTime or DateTimeImmutable object");
@@ -2268,21 +1912,21 @@ static int date_object_compare_date(zval *d1, zval *d2) /* {{{ */
return timelib_time_compare(o1->time, o2->time);
} /* }}} */
-static HashTable *date_object_get_gc(zval *object, zval **table, int *n) /* {{{ */
+static HashTable *date_object_get_gc(zend_object *object, zval **table, int *n) /* {{{ */
{
*table = NULL;
*n = 0;
return zend_std_get_properties(object);
} /* }}} */
-static HashTable *date_object_get_gc_timezone(zval *object, zval **table, int *n) /* {{{ */
+static HashTable *date_object_get_gc_timezone(zend_object *object, zval **table, int *n) /* {{{ */
{
*table = NULL;
*n = 0;
return zend_std_get_properties(object);
} /* }}} */
-static HashTable *date_object_get_properties_for(zval *object, zend_prop_purpose purpose) /* {{{ */
+static HashTable *date_object_get_properties_for(zend_object *object, zend_prop_purpose purpose) /* {{{ */
{
HashTable *props;
zval zv;
@@ -2299,7 +1943,7 @@ static HashTable *date_object_get_properties_for(zval *object, zend_prop_purpose
return zend_std_get_properties_for(object, purpose);
}
- dateobj = Z_PHPDATE_P(object);
+ dateobj = php_date_obj_from_obj(object);
props = zend_array_dup(zend_std_get_properties(object));
if (!dateobj->time) {
return props;
@@ -2351,9 +1995,9 @@ static zend_object *date_object_new_timezone(zend_class_entry *class_type) /* {{
return &intern->std;
} /* }}} */
-static zend_object *date_object_clone_timezone(zval *this_ptr) /* {{{ */
+static zend_object *date_object_clone_timezone(zend_object *this_ptr) /* {{{ */
{
- php_timezone_obj *old_obj = Z_PHPTIMEZONE_P(this_ptr);
+ php_timezone_obj *old_obj = php_timezone_obj_from_obj(this_ptr);
php_timezone_obj *new_obj = php_timezone_obj_from_obj(date_object_new_timezone(old_obj->std.ce));
zend_objects_clone_members(&new_obj->std, &old_obj->std);
@@ -2404,7 +2048,7 @@ static void php_timezone_to_string(php_timezone_obj *tzobj, zval *zv)
}
}
-static HashTable *date_object_get_properties_for_timezone(zval *object, zend_prop_purpose purpose) /* {{{ */
+static HashTable *date_object_get_properties_for_timezone(zend_object *object, zend_prop_purpose purpose) /* {{{ */
{
HashTable *props;
zval zv;
@@ -2421,7 +2065,7 @@ static HashTable *date_object_get_properties_for_timezone(zval *object, zend_pro
return zend_std_get_properties_for(object, purpose);
}
- tzobj = Z_PHPTIMEZONE_P(object);
+ tzobj = php_timezone_obj_from_obj(object);
props = zend_array_dup(zend_std_get_properties(object));
if (!tzobj->initialized) {
return props;
@@ -2436,13 +2080,13 @@ static HashTable *date_object_get_properties_for_timezone(zval *object, zend_pro
return props;
} /* }}} */
-static HashTable *date_object_get_debug_info_timezone(zval *object, int *is_temp) /* {{{ */
+static HashTable *date_object_get_debug_info_timezone(zend_object *object, int *is_temp) /* {{{ */
{
HashTable *ht, *props;
zval zv;
php_timezone_obj *tzobj;
- tzobj = Z_PHPTIMEZONE_P(object);
+ tzobj = php_timezone_obj_from_obj(object);
props = zend_std_get_properties(object);
*is_temp = 1;
@@ -2468,9 +2112,9 @@ static zend_object *date_object_new_interval(zend_class_entry *class_type) /* {{
return &intern->std;
} /* }}} */
-static zend_object *date_object_clone_interval(zval *this_ptr) /* {{{ */
+static zend_object *date_object_clone_interval(zend_object *this_ptr) /* {{{ */
{
- php_interval_obj *old_obj = Z_PHPINTERVAL_P(this_ptr);
+ php_interval_obj *old_obj = php_interval_obj_from_obj(this_ptr);
php_interval_obj *new_obj = php_interval_obj_from_obj(date_object_new_interval(old_obj->std.ce));
zend_objects_clone_members(&new_obj->std, &old_obj->std);
@@ -2482,7 +2126,7 @@ static zend_object *date_object_clone_interval(zval *this_ptr) /* {{{ */
return &new_obj->std;
} /* }}} */
-static HashTable *date_object_get_gc_interval(zval *object, zval **table, int *n) /* {{{ */
+static HashTable *date_object_get_gc_interval(zend_object *object, zval **table, int *n) /* {{{ */
{
*table = NULL;
@@ -2490,13 +2134,13 @@ static HashTable *date_object_get_gc_interval(zval *object, zval **table, int *n
return zend_std_get_properties(object);
} /* }}} */
-static HashTable *date_object_get_properties_interval(zval *object) /* {{{ */
+static HashTable *date_object_get_properties_interval(zend_object *object) /* {{{ */
{
HashTable *props;
zval zv;
php_interval_obj *intervalobj;
- intervalobj = Z_PHPINTERVAL_P(object);
+ intervalobj = php_interval_obj_from_obj(object);
props = zend_std_get_properties(object);
if (!intervalobj->initialized) {
return props;
@@ -2544,9 +2188,9 @@ static zend_object *date_object_new_period(zend_class_entry *class_type) /* {{{
return &intern->std;
} /* }}} */
-static zend_object *date_object_clone_period(zval *this_ptr) /* {{{ */
+static zend_object *date_object_clone_period(zend_object *this_ptr) /* {{{ */
{
- php_period_obj *old_obj = Z_PHPPERIOD_P(this_ptr);
+ php_period_obj *old_obj = php_period_obj_from_obj(this_ptr);
php_period_obj *new_obj = php_period_obj_from_obj(date_object_new_period(old_obj->std.ce));
zend_objects_clone_members(&new_obj->std, &old_obj->std);
@@ -2757,7 +2401,7 @@ PHP_FUNCTION(date_create)
Z_PARAM_OPTIONAL
Z_PARAM_STRING(time_str, time_str_len)
Z_PARAM_OBJECT_OF_CLASS_EX(timezone_object, date_ce_timezone, 1, 0)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_date_instantiate(date_ce_date, return_value);
if (!php_date_initialize(Z_PHPDATE_P(return_value), time_str, time_str_len, NULL, timezone_object, 0)) {
@@ -2780,7 +2424,7 @@ PHP_FUNCTION(date_create_immutable)
Z_PARAM_OPTIONAL
Z_PARAM_STRING(time_str, time_str_len)
Z_PARAM_OBJECT_OF_CLASS_EX(timezone_object, date_ce_timezone, 1, 0)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_date_instantiate(date_ce_immutable, return_value);
if (!php_date_initialize(Z_PHPDATE_P(return_value), time_str, time_str_len, NULL, timezone_object, 0)) {
@@ -2804,7 +2448,7 @@ PHP_FUNCTION(date_create_from_format)
Z_PARAM_STRING(time_str, time_str_len)
Z_PARAM_OPTIONAL
Z_PARAM_OBJECT_OF_CLASS_EX(timezone_object, date_ce_timezone, 1, 0)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_date_instantiate(date_ce_date, return_value);
if (!php_date_initialize(Z_PHPDATE_P(return_value), time_str, time_str_len, format_str, timezone_object, 0)) {
@@ -2828,7 +2472,7 @@ PHP_FUNCTION(date_create_immutable_from_format)
Z_PARAM_STRING(time_str, time_str_len)
Z_PARAM_OPTIONAL
Z_PARAM_OBJECT_OF_CLASS_EX(timezone_object, date_ce_timezone, 1, 0)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_date_instantiate(date_ce_immutable, return_value);
if (!php_date_initialize(Z_PHPDATE_P(return_value), time_str, time_str_len, format_str, timezone_object, 0)) {
@@ -2848,7 +2492,7 @@ PHP_METHOD(DateTime, __construct)
size_t time_str_len = 0;
zend_error_handling error_handling;
- ZEND_PARSE_PARAMETERS_START_EX(ZEND_PARSE_PARAMS_THROW, 0, 2)
+ ZEND_PARSE_PARAMETERS_START(0, 2)
Z_PARAM_OPTIONAL
Z_PARAM_STRING(time_str, time_str_len)
Z_PARAM_OBJECT_OF_CLASS_EX(timezone_object, date_ce_timezone, 1, 0)
@@ -2870,7 +2514,7 @@ PHP_METHOD(DateTimeImmutable, __construct)
size_t time_str_len = 0;
zend_error_handling error_handling;
- ZEND_PARSE_PARAMETERS_START_EX(ZEND_PARSE_PARAMS_THROW, 0, 2)
+ ZEND_PARSE_PARAMETERS_START(0, 2)
Z_PARAM_OPTIONAL
Z_PARAM_STRING(time_str, time_str_len)
Z_PARAM_OBJECT_OF_CLASS_EX(timezone_object, date_ce_timezone, 1, 0)
@@ -2903,6 +2547,27 @@ PHP_METHOD(DateTime, createFromImmutable)
}
/* }}} */
+/* {{{ proto DateTime::createFromInterface(DateTimeInterface object)
+ Creates new DateTime object from an existing DateTimeInterface object.
+*/
+PHP_METHOD(DateTime, createFromInterface)
+{
+ zval *datetimeinterface_object = NULL;
+ php_date_obj *new_obj = NULL;
+ php_date_obj *old_obj = NULL;
+
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_OBJECT_OF_CLASS(datetimeinterface_object, date_ce_interface)
+ ZEND_PARSE_PARAMETERS_END();
+
+ php_date_instantiate(date_ce_date, return_value);
+ old_obj = Z_PHPDATE_P(datetimeinterface_object);
+ new_obj = Z_PHPDATE_P(return_value);
+
+ new_obj->time = timelib_time_clone(old_obj->time);
+}
+/* }}} */
+
/* {{{ proto DateTimeImmutable::createFromMutable(DateTime object)
Creates new DateTimeImmutable object from an existing mutable DateTime object.
*/
@@ -2924,6 +2589,27 @@ PHP_METHOD(DateTimeImmutable, createFromMutable)
}
/* }}} */
+/* {{{ proto DateTimeImmutable::createFromInterface(DateTimeInterface object)
+ Creates new DateTimeImmutable object from an existing DateTimeInterface object.
+*/
+PHP_METHOD(DateTimeImmutable, createFromInterface)
+{
+ zval *datetimeinterface_object = NULL;
+ php_date_obj *new_obj = NULL;
+ php_date_obj *old_obj = NULL;
+
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_OBJECT_OF_CLASS(datetimeinterface_object, date_ce_interface)
+ ZEND_PARSE_PARAMETERS_END();
+
+ php_date_instantiate(date_ce_immutable, return_value);
+ old_obj = Z_PHPDATE_P(datetimeinterface_object);
+ new_obj = Z_PHPDATE_P(return_value);
+
+ new_obj->time = timelib_time_clone(old_obj->time);
+}
+/* }}} */
+
static int php_date_initialize_from_hash(php_date_obj **dateobj, HashTable *myht)
{
zval *z_date;
@@ -2983,7 +2669,7 @@ PHP_METHOD(DateTime, __set_state)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_ARRAY(array)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
myht = Z_ARRVAL_P(array);
@@ -3005,7 +2691,7 @@ PHP_METHOD(DateTimeImmutable, __set_state)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_ARRAY(array)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
myht = Z_ARRVAL_P(array);
@@ -3025,6 +2711,8 @@ PHP_METHOD(DateTime, __wakeup)
php_date_obj *dateobj;
HashTable *myht;
+ ZEND_PARSE_PARAMETERS_NONE();
+
dateobj = Z_PHPDATE_P(object);
myht = Z_OBJPROP_P(object);
@@ -3061,6 +2749,8 @@ static void zval_from_error_container(zval *z, timelib_error_container *error) /
*/
PHP_FUNCTION(date_get_last_errors)
{
+ ZEND_PARSE_PARAMETERS_NONE();
+
if (DATEG(last_errors)) {
array_init(return_value);
zval_from_error_container(return_value, DATEG(last_errors));
@@ -3155,7 +2845,7 @@ PHP_FUNCTION(date_parse)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_STR(date)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
parsed_time = timelib_strtotime(ZSTR_VAL(date), ZSTR_LEN(date), &error, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper);
php_date_do_return_parsed_time(INTERNAL_FUNCTION_PARAM_PASSTHRU, parsed_time, error);
@@ -3174,7 +2864,7 @@ PHP_FUNCTION(date_parse_from_format)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_STR(format)
Z_PARAM_STR(date)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
parsed_time = timelib_parse_from_format(ZSTR_VAL(format), ZSTR_VAL(date), ZSTR_LEN(date), &error, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper);
php_date_do_return_parsed_time(INTERNAL_FUNCTION_PARAM_PASSTHRU, parsed_time, error);
@@ -3192,7 +2882,7 @@ PHP_FUNCTION(date_format)
size_t format_len;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os", &object, date_ce_interface, &format, &format_len) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
dateobj = Z_PHPDATE_P(object);
DATE_CHECK_INITIALIZED(dateobj->time, DateTime);
@@ -3278,7 +2968,7 @@ PHP_FUNCTION(date_modify)
size_t modify_len;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os", &object, date_ce_date, &modify, &modify_len) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (!php_date_modify(object, modify, modify_len)) {
@@ -3300,7 +2990,7 @@ PHP_METHOD(DateTimeImmutable, modify)
object = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &modify, &modify_len) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
date_clone_immutable(object, &new_object);
@@ -3337,7 +3027,7 @@ PHP_FUNCTION(date_add)
zval *object, *interval;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "OO", &object, date_ce_date, &interval, date_ce_interval) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
php_date_add(object, interval, return_value);
@@ -3355,7 +3045,7 @@ PHP_METHOD(DateTimeImmutable, add)
object = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &interval, date_ce_interval) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
date_clone_immutable(object, &new_object);
@@ -3394,7 +3084,7 @@ PHP_FUNCTION(date_sub)
zval *object, *interval;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "OO", &object, date_ce_date, &interval, date_ce_interval) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
php_date_sub(object, interval, return_value);
@@ -3412,7 +3102,7 @@ PHP_METHOD(DateTimeImmutable, sub)
object = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &interval, date_ce_interval) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
date_clone_immutable(object, &new_object);
@@ -3451,7 +3141,7 @@ PHP_FUNCTION(date_timezone_get)
php_date_obj *dateobj;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &object, date_ce_interface) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
dateobj = Z_PHPDATE_P(object);
DATE_CHECK_INITIALIZED(dateobj->time, DateTime);
@@ -3498,7 +3188,7 @@ PHP_FUNCTION(date_timezone_set)
zval *timezone_object;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "OO", &object, date_ce_date, &timezone_object, date_ce_timezone) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
php_date_timezone_set(object, timezone_object, return_value);
@@ -3517,7 +3207,7 @@ PHP_METHOD(DateTimeImmutable, setTimezone)
object = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &timezone_object, date_ce_timezone) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
date_clone_immutable(object, &new_object);
@@ -3537,7 +3227,7 @@ PHP_FUNCTION(date_offset_get)
timelib_time_offset *offset;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &object, date_ce_interface) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
dateobj = Z_PHPDATE_P(object);
DATE_CHECK_INITIALIZED(dateobj->time, DateTime);
@@ -3584,7 +3274,7 @@ PHP_FUNCTION(date_time_set)
zend_long h, i, s = 0, ms = 0;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oll|ll", &object, date_ce_date, &h, &i, &s, &ms) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
php_date_time_set(object, h, i, s, ms, return_value);
@@ -3603,7 +3293,7 @@ PHP_METHOD(DateTimeImmutable, setTime)
object = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll|ll", &h, &i, &s, &ms) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
date_clone_immutable(object, &new_object);
@@ -3634,7 +3324,7 @@ PHP_FUNCTION(date_date_set)
zend_long y, m, d;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Olll", &object, date_ce_date, &y, &m, &d) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
php_date_date_set(object, y, m, d, return_value);
@@ -3653,7 +3343,7 @@ PHP_METHOD(DateTimeImmutable, setDate)
object = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lll", &y, &m, &d) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
date_clone_immutable(object, &new_object);
@@ -3688,7 +3378,7 @@ PHP_FUNCTION(date_isodate_set)
zend_long y, w, d = 1;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oll|l", &object, date_ce_date, &y, &w, &d) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
php_date_isodate_set(object, y, w, d, return_value);
@@ -3707,7 +3397,7 @@ PHP_METHOD(DateTimeImmutable, setISODate)
object = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll|l", &y, &w, &d) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
date_clone_immutable(object, &new_object);
@@ -3737,7 +3427,7 @@ PHP_FUNCTION(date_timestamp_set)
zend_long timestamp;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Ol", &object, date_ce_date, &timestamp) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
php_date_timestamp_set(object, timestamp, return_value);
@@ -3756,7 +3446,7 @@ PHP_METHOD(DateTimeImmutable, setTimestamp)
object = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &timestamp) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
date_clone_immutable(object, &new_object);
@@ -3777,7 +3467,7 @@ PHP_FUNCTION(date_timestamp_get)
int error;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &object, date_ce_interface) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
dateobj = Z_PHPDATE_P(object);
DATE_CHECK_INITIALIZED(dateobj->time, DateTime);
@@ -3803,7 +3493,7 @@ PHP_FUNCTION(date_diff)
zend_bool absolute = 0;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "OO|b", &object1, date_ce_interface, &object2, date_ce_interface, &absolute) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
dateobj1 = Z_PHPDATE_P(object1);
dateobj2 = Z_PHPDATE_P(object2);
@@ -3857,7 +3547,7 @@ PHP_FUNCTION(timezone_open)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_STR(tz)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
tzobj = Z_PHPTIMEZONE_P(php_date_instantiate(date_ce_timezone, return_value));
if (SUCCESS != timezone_initialize(tzobj, ZSTR_VAL(tz), ZSTR_LEN(tz))) {
@@ -3876,7 +3566,7 @@ PHP_METHOD(DateTimeZone, __construct)
php_timezone_obj *tzobj;
zend_error_handling error_handling;
- ZEND_PARSE_PARAMETERS_START_EX(ZEND_PARSE_PARAMS_THROW, 1, 1)
+ ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_STR(tz)
ZEND_PARSE_PARAMETERS_END();
@@ -3940,6 +3630,8 @@ PHP_METHOD(DateTimeZone, __wakeup)
php_timezone_obj *tzobj;
HashTable *myht;
+ ZEND_PARSE_PARAMETERS_NONE();
+
tzobj = Z_PHPTIMEZONE_P(object);
myht = Z_OBJPROP_P(object);
@@ -3959,7 +3651,7 @@ PHP_FUNCTION(timezone_name_get)
php_timezone_obj *tzobj;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &object, date_ce_timezone) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
tzobj = Z_PHPTIMEZONE_P(object);
DATE_CHECK_INITIALIZED(tzobj->initialized, DateTimeZone);
@@ -3982,7 +3674,7 @@ PHP_FUNCTION(timezone_name_from_abbr)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(gmtoffset)
Z_PARAM_LONG(isdst)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
tzid = timelib_timezone_id_from_abbr(ZSTR_VAL(abbr), gmtoffset, isdst);
@@ -4005,7 +3697,7 @@ PHP_FUNCTION(timezone_offset_get)
timelib_time_offset *offset;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "OO", &object, date_ce_timezone, &dateobject, date_ce_interface) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
tzobj = Z_PHPTIMEZONE_P(object);
DATE_CHECK_INITIALIZED(tzobj->initialized, DateTimeZone);
@@ -4039,7 +3731,7 @@ PHP_FUNCTION(timezone_transitions_get)
zend_long timestamp_begin = ZEND_LONG_MIN, timestamp_end = ZEND_LONG_MAX;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O|ll", &object, date_ce_timezone, &timestamp_begin, &timestamp_end) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
tzobj = Z_PHPTIMEZONE_P(object);
DATE_CHECK_INITIALIZED(tzobj->initialized, DateTimeZone);
@@ -4118,7 +3810,7 @@ PHP_FUNCTION(timezone_location_get)
php_timezone_obj *tzobj;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &object, date_ce_timezone) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
tzobj = Z_PHPTIMEZONE_P(object);
DATE_CHECK_INITIALIZED(tzobj->initialized, DateTimeZone);
@@ -4147,6 +3839,9 @@ static int date_interval_initialize(timelib_rel_time **rt, /*const*/ char *forma
if (errors->error_count > 0) {
php_error_docref(NULL, E_WARNING, "Unknown or bad format (%s)", format);
retval = FAILURE;
+ if (p) {
+ timelib_rel_time_dtor(p);
+ }
} else {
if(p) {
*rt = p;
@@ -4170,6 +3865,7 @@ static int date_interval_initialize(timelib_rel_time **rt, /*const*/ char *forma
} /* }}} */
static int date_interval_compare_objects(zval *o1, zval *o2) {
+ ZEND_COMPARE_OBJECTS_FALLBACK(o1, o2);
/* There is no well defined way to compare intervals like P1M and P30D, which may compare
* smaller, equal or greater depending on the point in time at which the interval starts. As
* such, we treat DateInterval objects are non-comparable and emit a warning. */
@@ -4178,38 +3874,24 @@ static int date_interval_compare_objects(zval *o1, zval *o2) {
}
/* {{{ date_interval_read_property */
-static zval *date_interval_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv)
+static zval *date_interval_read_property(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv)
{
php_interval_obj *obj;
zval *retval;
- zval tmp_member;
timelib_sll value = -1;
double fvalue = -1;
- if (Z_TYPE_P(member) != IS_STRING) {
- zend_string *str = zval_try_get_string_func(member);
- if (UNEXPECTED(!str)) {
- return &EG(uninitialized_zval);
- }
- ZVAL_STR(&tmp_member, str);
- member = &tmp_member;
- cache_slot = NULL;
- }
-
- obj = Z_PHPINTERVAL_P(object);
+ obj = php_interval_obj_from_obj(object);
if (!obj->initialized) {
- retval = zend_std_read_property(object, member, type, cache_slot, rv);
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
- }
+ retval = zend_std_read_property(object, name, type, cache_slot, rv);
return retval;
}
#define GET_VALUE_FROM_STRUCT(n,m) \
- if (strcmp(Z_STRVAL_P(member), m) == 0) { \
- value = obj->diff->n; \
- break; \
+ if (strcmp(ZSTR_VAL(name), m) == 0) { \
+ value = obj->diff->n; \
+ break; \
}
do {
GET_VALUE_FROM_STRUCT(y, "y");
@@ -4218,18 +3900,14 @@ static zval *date_interval_read_property(zval *object, zval *member, int type, v
GET_VALUE_FROM_STRUCT(h, "h");
GET_VALUE_FROM_STRUCT(i, "i");
GET_VALUE_FROM_STRUCT(s, "s");
- if (strcmp(Z_STRVAL_P(member), "f") == 0) {
+ if (strcmp(ZSTR_VAL(name), "f") == 0) {
fvalue = obj->diff->us / 1000000.0;
break;
}
GET_VALUE_FROM_STRUCT(invert, "invert");
GET_VALUE_FROM_STRUCT(days, "days");
/* didn't find any */
- retval = zend_std_read_property(object, member, type, cache_slot, rv);
-
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
- }
+ retval = zend_std_read_property(object, name, type, cache_slot, rv);
return retval;
} while(0);
@@ -4244,42 +3922,23 @@ static zval *date_interval_read_property(zval *object, zval *member, int type, v
ZVAL_FALSE(retval);
}
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
- }
-
return retval;
}
/* }}} */
/* {{{ date_interval_write_property */
-static zval *date_interval_write_property(zval *object, zval *member, zval *value, void **cache_slot)
+static zval *date_interval_write_property(zend_object *object, zend_string *name, zval *value, void **cache_slot)
{
php_interval_obj *obj;
- zval tmp_member;
-
- if (Z_TYPE_P(member) != IS_STRING) {
- zend_string *str = zval_try_get_string_func(member);
- if (UNEXPECTED(!str)) {
- return value;
- }
- ZVAL_STR(&tmp_member, str);
- member = &tmp_member;
- cache_slot = NULL;
- }
- obj = Z_PHPINTERVAL_P(object);
+ obj = php_interval_obj_from_obj(object);
if (!obj->initialized) {
- value = zend_std_write_property(object, member, value, cache_slot);
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
- }
- return value;
+ return zend_std_write_property(object, name, value, cache_slot);
}
-#define SET_VALUE_FROM_STRUCT(n,m) \
- if (strcmp(Z_STRVAL_P(member), m) == 0) { \
+#define SET_VALUE_FROM_STRUCT(n,m) \
+ if (strcmp(ZSTR_VAL(name), m) == 0) { \
obj->diff->n = zval_get_long(value); \
break; \
}
@@ -4291,55 +3950,37 @@ static zval *date_interval_write_property(zval *object, zval *member, zval *valu
SET_VALUE_FROM_STRUCT(h, "h");
SET_VALUE_FROM_STRUCT(i, "i");
SET_VALUE_FROM_STRUCT(s, "s");
- if (strcmp(Z_STRVAL_P(member), "f") == 0) {
+ if (strcmp(ZSTR_VAL(name), "f") == 0) {
obj->diff->us = zval_get_double(value) * 1000000;
break;
}
SET_VALUE_FROM_STRUCT(invert, "invert");
/* didn't find any */
- value = zend_std_write_property(object, member, value, cache_slot);
+ value = zend_std_write_property(object, name, value, cache_slot);
} while(0);
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
- }
-
return value;
}
/* }}} */
/* {{{ date_interval_get_property_ptr_ptr */
-static zval *date_interval_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot)
-{
- zval tmp_member, *ret;
-
- if (Z_TYPE_P(member) != IS_STRING) {
- zend_string *str = zval_try_get_string_func(member);
- if (UNEXPECTED(!str)) {
- return NULL;
- }
- ZVAL_STR(&tmp_member, str);
- member = &tmp_member;
- cache_slot = NULL;
- }
-
- if(zend_binary_strcmp("y", sizeof("y") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
- zend_binary_strcmp("m", sizeof("m") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
- zend_binary_strcmp("d", sizeof("d") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
- zend_binary_strcmp("h", sizeof("h") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
- zend_binary_strcmp("i", sizeof("i") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
- zend_binary_strcmp("s", sizeof("s") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
- zend_binary_strcmp("f", sizeof("f") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
- zend_binary_strcmp("days", sizeof("days") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
- zend_binary_strcmp("invert", sizeof("invert") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0) {
+static zval *date_interval_get_property_ptr_ptr(zend_object *object, zend_string *name, int type, void **cache_slot)
+{
+ zval *ret;
+
+ if(zend_binary_strcmp("y", sizeof("y") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0 ||
+ zend_binary_strcmp("m", sizeof("m") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0 ||
+ zend_binary_strcmp("d", sizeof("d") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0 ||
+ zend_binary_strcmp("h", sizeof("h") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0 ||
+ zend_binary_strcmp("i", sizeof("i") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0 ||
+ zend_binary_strcmp("s", sizeof("s") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0 ||
+ zend_binary_strcmp("f", sizeof("f") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0 ||
+ zend_binary_strcmp("days", sizeof("days") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0 ||
+ zend_binary_strcmp("invert", sizeof("invert") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0) {
/* Fallback to read_property. */
ret = NULL;
} else {
- ret = zend_std_get_property_ptr_ptr(object, member, type, cache_slot);
- }
-
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
+ ret = zend_std_get_property_ptr_ptr(object, name, type, cache_slot);
}
return ret;
@@ -4355,7 +3996,7 @@ PHP_METHOD(DateInterval, __construct)
timelib_rel_time *reltime;
zend_error_handling error_handling;
- ZEND_PARSE_PARAMETERS_START_EX(ZEND_PARSE_PARAMS_THROW, 1, 1)
+ ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_STR(interval_string)
ZEND_PARSE_PARAMETERS_END();
@@ -4461,7 +4102,7 @@ PHP_METHOD(DateInterval, __set_state)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_ARRAY(array)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
myht = Z_ARRVAL_P(array);
@@ -4479,6 +4120,8 @@ PHP_METHOD(DateInterval, __wakeup)
php_interval_obj *intobj;
HashTable *myht;
+ ZEND_PARSE_PARAMETERS_NONE();
+
intobj = Z_PHPINTERVAL_P(object);
myht = Z_OBJPROP_P(object);
@@ -4499,7 +4142,7 @@ PHP_FUNCTION(date_interval_create_from_date_string)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_STR(time_str)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
time = timelib_strtotime(ZSTR_VAL(time_str), ZSTR_LEN(time_str), &err, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper);
@@ -4602,7 +4245,7 @@ PHP_FUNCTION(date_interval_format)
size_t format_len;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os", &object, date_ce_interval, &format, &format_len) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
diobj = Z_PHPINTERVAL_P(object);
DATE_CHECK_INITIALIZED(diobj->initialized, DateInterval);
@@ -4624,6 +4267,9 @@ static int date_period_initialize(timelib_time **st, timelib_time **et, timelib_
if (errors->error_count > 0) {
php_error_docref(NULL, E_WARNING, "Unknown or bad format (%s)", format);
retval = FAILURE;
+ if (p) {
+ timelib_rel_time_dtor(p);
+ }
} else {
*st = b;
*et = e;
@@ -4734,13 +4380,11 @@ PHP_METHOD(DatePeriod, getStartDate)
php_period_obj *dpobj;
php_date_obj *dateobj;
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
dpobj = Z_PHPPERIOD_P(ZEND_THIS);
- php_date_instantiate(dpobj->start_ce, return_value);
+ php_date_instantiate(dpobj->start_ce, return_value);
dateobj = Z_PHPDATE_P(return_value);
dateobj->time = timelib_time_ctor();
*dateobj->time = *dpobj->start;
@@ -4761,9 +4405,7 @@ PHP_METHOD(DatePeriod, getEndDate)
php_period_obj *dpobj;
php_date_obj *dateobj;
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
dpobj = Z_PHPPERIOD_P(ZEND_THIS);
@@ -4792,9 +4434,7 @@ PHP_METHOD(DatePeriod, getDateInterval)
php_period_obj *dpobj;
php_interval_obj *diobj;
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
dpobj = Z_PHPPERIOD_P(ZEND_THIS);
@@ -4812,14 +4452,12 @@ PHP_METHOD(DatePeriod, getRecurrences)
{
php_period_obj *dpobj;
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
dpobj = Z_PHPPERIOD_P(ZEND_THIS);
if (0 == dpobj->recurrences - dpobj->include_start_date) {
- return;
+ return;
}
RETURN_LONG(dpobj->recurrences - dpobj->include_start_date);
@@ -4857,8 +4495,8 @@ PHP_FUNCTION(timezone_identifiers_list)
ZEND_PARSE_PARAMETERS_START(0, 2)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(what)
- Z_PARAM_STRING_EX(option, option_len, 1, 0)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ Z_PARAM_STRING_OR_NULL(option, option_len)
+ ZEND_PARSE_PARAMETERS_END();
/* Extra validation */
if (what == PHP_DATE_TIMEZONE_PER_COUNTRY && option_len != 2) {
@@ -4883,13 +4521,15 @@ PHP_FUNCTION(timezone_identifiers_list)
}
/* }}} */
-/* {{{ proto array timezone_version_get()
+/* {{{ proto string timezone_version_get()
Returns the Olson database version number.
*/
PHP_FUNCTION(timezone_version_get)
{
const timelib_tzdb *tzdb;
+ ZEND_PARSE_PARAMETERS_NONE();
+
tzdb = DATE_TIMEZONEDB;
RETURN_STRING(tzdb->version);
}
@@ -4903,6 +4543,8 @@ PHP_FUNCTION(timezone_abbreviations_list)
const timelib_tz_lookup_table *table, *entry;
zval element, *abbr_array_p, abbr_array;
+ ZEND_PARSE_PARAMETERS_NONE();
+
table = timelib_timezone_abbreviations_list();
array_init(return_value);
entry = table;
@@ -4939,7 +4581,7 @@ PHP_FUNCTION(date_default_timezone_set)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_STRING(zone, zone_len)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (!timelib_timezone_id_is_valid(zone, DATE_TIMEZONEDB)) {
php_error_docref(NULL, E_NOTICE, "Timezone ID '%s' is invalid", zone);
@@ -4959,9 +4601,7 @@ PHP_FUNCTION(date_default_timezone_set)
PHP_FUNCTION(date_default_timezone_get)
{
timelib_tzinfo *default_tz;
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
default_tz = get_timezone_info();
RETVAL_STRING(default_tz->name);
@@ -4990,7 +4630,7 @@ static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, int calc_su
Z_PARAM_DOUBLE(longitude)
Z_PARAM_DOUBLE(zenith)
Z_PARAM_DOUBLE(gmt_offset)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
switch (ZEND_NUM_ARGS()) {
case 1:
@@ -5009,7 +4649,7 @@ static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, int calc_su
case 6:
break;
default:
- php_error_docref(NULL, E_WARNING, "invalid format");
+ php_error_docref(NULL, E_WARNING, "Invalid format");
RETURN_FALSE;
break;
}
@@ -5094,7 +4734,7 @@ PHP_FUNCTION(date_sun_info)
Z_PARAM_LONG(time)
Z_PARAM_DOUBLE(latitude)
Z_PARAM_DOUBLE(longitude)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
/* Initialize time struct */
t = timelib_time_ctor();
@@ -5108,7 +4748,7 @@ PHP_FUNCTION(date_sun_info)
array_init(return_value);
/* Get sun up/down and transit */
- rs = timelib_astro_rise_set_altitude(t, longitude, latitude, -35.0/60, 1, &ddummy, &ddummy, &rise, &set, &transit);
+ rs = timelib_astro_rise_set_altitude(t, longitude, latitude, -50.0/60, 1, &ddummy, &ddummy, &rise, &set, &transit);
switch (rs) {
case -1: /* always below */
add_assoc_bool(return_value, "sunrise", 0);
@@ -5185,20 +4825,20 @@ PHP_FUNCTION(date_sun_info)
}
/* }}} */
-static HashTable *date_object_get_gc_period(zval *object, zval **table, int *n) /* {{{ */
+static HashTable *date_object_get_gc_period(zend_object *object, zval **table, int *n) /* {{{ */
{
*table = NULL;
*n = 0;
return zend_std_get_properties(object);
} /* }}} */
-static HashTable *date_object_get_properties_period(zval *object) /* {{{ */
+static HashTable *date_object_get_properties_period(zend_object *object) /* {{{ */
{
HashTable *props;
zval zv;
php_period_obj *period_obj;
- period_obj = Z_PHPPERIOD_P(object);
+ period_obj = php_period_obj_from_obj(object);
props = zend_std_get_properties(object);
if (!period_obj->start) {
return props;
@@ -5345,7 +4985,7 @@ PHP_METHOD(DatePeriod, __set_state)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_ARRAY(array)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
myht = Z_ARRVAL_P(array);
@@ -5365,6 +5005,8 @@ PHP_METHOD(DatePeriod, __wakeup)
php_period_obj *period_obj;
HashTable *myht;
+ ZEND_PARSE_PARAMETERS_NONE();
+
period_obj = Z_PHPPERIOD_P(object);
myht = Z_OBJPROP_P(object);
@@ -5394,50 +5036,41 @@ static int date_period_is_magic_property(zend_string *name)
/* }}} */
/* {{{ date_period_read_property */
-static zval *date_period_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv)
+static zval *date_period_read_property(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv)
{
if (type != BP_VAR_IS && type != BP_VAR_R) {
- zend_string *name = zval_get_string(member);
if (date_period_is_magic_property(name)) {
zend_throw_error(NULL, "Retrieval of DatePeriod->%s for modification is unsupported", ZSTR_VAL(name));
- zend_string_release(name);
return &EG(uninitialized_zval);
}
- zend_string_release(name);
}
- Z_OBJPROP_P(object); /* build properties hash table */
+ object->handlers->get_properties(object); /* build properties hash table */
- return zend_std_read_property(object, member, type, cache_slot, rv);
+ return zend_std_read_property(object, name, type, cache_slot, rv);
}
/* }}} */
/* {{{ date_period_write_property */
-static zval *date_period_write_property(zval *object, zval *member, zval *value, void **cache_slot)
+static zval *date_period_write_property(zend_object *object, zend_string *name, zval *value, void **cache_slot)
{
- zend_string *name = zval_get_string(member);
if (date_period_is_magic_property(name)) {
zend_throw_error(NULL, "Writing to DatePeriod->%s is unsupported", ZSTR_VAL(name));
- zend_string_release(name);
return value;
}
- zend_string_release(name);
- return zend_std_write_property(object, member, value, cache_slot);
+ return zend_std_write_property(object, name, value, cache_slot);
}
/* }}} */
/* {{{ date_period_get_property_ptr_ptr */
-static zval *date_period_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot)
+static zval *date_period_get_property_ptr_ptr(zend_object *object, zend_string *name, int type, void **cache_slot)
{
- zend_string *name = zval_get_string(member);
if (date_period_is_magic_property(name)) {
zend_throw_error(NULL, "Retrieval of DatePeriod->%s for modification is unsupported", ZSTR_VAL(name));
- zend_string_release(name);
return &EG(error_zval);
}
- zend_string_release(name);
- return zend_std_get_property_ptr_ptr(object, member, type, cache_slot);
+ return zend_std_get_property_ptr_ptr(object, name, type, cache_slot);
}
/* }}} */
diff --git a/ext/date/php_date.h b/ext/date/php_date.h
index 009be83a3f..8458b0187e 100644
--- a/ext/date/php_date.h
+++ b/ext/date/php_date.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -48,6 +46,7 @@ PHP_METHOD(DateTime, __construct);
PHP_METHOD(DateTime, __wakeup);
PHP_METHOD(DateTime, __set_state);
PHP_METHOD(DateTime, createFromImmutable);
+PHP_METHOD(DateTime, createFromInterface);
PHP_FUNCTION(date_create);
PHP_FUNCTION(date_create_immutable);
PHP_FUNCTION(date_create_from_format);
@@ -81,6 +80,7 @@ PHP_METHOD(DateTimeImmutable, setDate);
PHP_METHOD(DateTimeImmutable, setISODate);
PHP_METHOD(DateTimeImmutable, setTimestamp);
PHP_METHOD(DateTimeImmutable, createFromMutable);
+PHP_METHOD(DateTimeImmutable, createFromInterface);
PHP_METHOD(DateTimeZone, __construct);
PHP_METHOD(DateTimeZone, __wakeup);
diff --git a/ext/date/php_date.stub.php b/ext/date/php_date.stub.php
new file mode 100644
index 0000000000..e9985dd6b2
--- /dev/null
+++ b/ext/date/php_date.stub.php
@@ -0,0 +1,289 @@
+<?php
+
+/* TODO: Convert "uninitialized" into an exception. This will remove many
+ * possibilities for false return values in here. */
+
+function strtotime(string $time, int $now = UNKNOWN): int|false {}
+
+function date(string $format, int $timestamp = UNKNOWN): string {}
+
+function idate(string $format, int $timestamp = UNKNOWN): int|false {}
+
+function gmdate(string $format, int $timestamp = UNKNOWN): string {}
+
+function mktime(
+ int $hour, int $min = UNKNOWN, int $sec = UNKNOWN,
+ int $mon = UNKNOWN, int $day = UNKNOWN, int $year = UNKNOWN): int|false {}
+
+function gmmktime(
+ int $hour, int $min = UNKNOWN, int $sec = UNKNOWN,
+ int $mon = UNKNOWN, int $day = UNKNOWN, int $year = UNKNOWN): int|false {}
+
+function checkdate(int $m, int $d, int $y): bool {}
+
+function strftime(string $format, int $timestamp = UNKNOWN): string|false {}
+
+function gmstrftime(string $format, int $timestamp = UNKNOWN): string|false {}
+
+function time(): int {}
+
+function localtime(int $timestamp = UNKNOWN, bool $associative = false): array {}
+
+function getdate(int $timestamp = UNKNOWN): array {}
+
+function date_create(string $time = "now", ?DateTimeZone $timezone = null): DateTime|false {}
+
+function date_create_immutable(
+ string $time = "now", ?DateTimeZone $timezone = null): DateTimeImmutable|false {}
+
+function date_create_from_format(
+ string $format, string $time, ?DateTimeZone $timezone = null): DateTime|false {}
+
+function date_create_immutable_from_format(
+ string $format, string $time, ?DateTimeZone $timezone = null): DateTimeImmutable|false {}
+
+function date_parse(string $date): array {}
+
+function date_parse_from_format(string $format, string $date): array {}
+
+function date_get_last_errors(): array|false {}
+
+function date_format(DateTimeInterface $object, string $format): string {}
+
+function date_modify(DateTime $object, string $modify): DateTime|false {}
+
+function date_add(DateTime $object, DateInterval $interval): DateTime {}
+
+function date_sub(DateTime $object, DateInterval $interval): DateTime {}
+
+function date_timezone_get(DateTimeInterface $object): DateTimeZone|false {}
+
+function date_timezone_set(DateTimeInterface $object, DateTimeZone $timezone): DateTime {}
+
+function date_offset_get(DateTimeInterface $object): int {}
+
+function date_diff(
+ DateTimeInterface $object, DateTimeInterface $object2, bool $absolute = false): DateInterval {}
+
+function date_time_set(
+ DateTime $object, int $hour, int $minute, int $second = 0, int $microseconds = 0): DateTime {}
+
+function date_date_set(DateTime $object, int $year, int $month, int $day): DateTime {}
+
+function date_isodate_set(DateTime $object, int $year, int $week, int $day = 1): DateTime {}
+
+function date_timestamp_set(DateTime $object, int $timestamp): DateTime {}
+
+function date_timestamp_get(DateTimeInterface $object): int|false {}
+
+function timezone_open(string $timezone): DateTimeZone|false {}
+
+function timezone_name_get(DateTimeZone $object): string {}
+
+function timezone_name_from_abbr(string $abbr, int $gmtoffset = -1, int $isdst = -1): string|false {}
+
+function timezone_offset_get(DateTimeZone $object, DateTimeInterface $datetime): int {}
+
+function timezone_transitions_get(
+ DateTimeZone $object, int $timestamp_begin = PHP_INT_MIN, int $timestamp_end = PHP_INT_MAX): array|false {}
+
+function timezone_location_get(DateTimeZone $object): array|false {}
+
+function timezone_identifiers_list(int $what = DateTimeZone::ALL, ?string $country = null): array|false {}
+
+function timezone_abbreviations_list(): array {}
+
+function timezone_version_get(): string {}
+
+function date_interval_create_from_date_string(string $time): DateInterval|false {}
+
+function date_interval_format(DateInterval $object, string $format): string {}
+
+function date_default_timezone_set(string $timezone_identifier): bool {}
+
+function date_default_timezone_get(): string {}
+
+function date_sunrise(
+ int $time, int $retformat = SUNFUNCS_RET_STRING,
+ float $latitude = UNKNOWN, float $longitude = UNKNOWN, float $zenith = UNKNOWN,
+ float $gmt_offset = 0): string|int|float|false {}
+
+function date_sunset(
+ int $time, int $retformat = SUNFUNCS_RET_STRING,
+ float $latitude = UNKNOWN, float $longitude = UNKNOWN, float $zenith = UNKNOWN,
+ float $gmt_offset = 0): string|int|float|false {}
+
+function date_sun_info(int $time, float $latitude, float $longitude): array {}
+
+// NB: Adding return types to methods is a BC break!
+// For now only using @return annotations here.
+
+interface DateTimeInterface {
+ /** @return string */
+ public function format(string $format);
+
+ /** @return DateTimeZone|false */
+ public function getTimezone();
+
+ /** @return int|false */
+ public function getOffset();
+
+ /** @return int|false */
+ public function getTimestamp();
+
+ /** @return DateInterval|false */
+ public function diff(DateTimeInterface $object, bool $absolute = false);
+
+ public function __wakeup();
+}
+
+class DateTime implements DateTimeInterface {
+ public function __construct(string $time = "now", ?DateTimeZone $timezone = null);
+
+ /** @return DateTime */
+ public static function __set_state(array $array);
+
+ /** @return DateTime */
+ public static function createFromImmutable(DateTimeImmutable $object);
+
+ public static function createFromInterface(DateTimeInterface $object): DateTime;
+
+ /** @return DateTime|false */
+ public static function createFromFormat(
+ string $format, string $time, ?DateTimeZone $timezone = null);
+
+ /** @return array|false */
+ public static function getLastErrors();
+
+ /** @return DateTime|false */
+ public function modify(string $modify);
+
+ /** @return DateTime */
+ public function add(DateInterval $interval);
+
+ /** @return DateTime */
+ public function sub(DateInterval $interval);
+
+ /** @return DateTime */
+ public function setTimezone(DateTimeZone $timezone);
+
+ /** @return DateTime */
+ public function setTime(int $hour, int $minute, int $second = 0, int $microseconds = 0);
+
+ /** @return DateTime */
+ public function setDate(int $year, int $month, int $day);
+
+ /** @return DateTime */
+ public function setISODate(int $year, int $week, int $day = 1);
+
+ /** @return DateTime */
+ public function setTimestamp(int $timestamp);
+}
+
+class DateTimeImmutable implements DateTimeInterface {
+ public function __construct(string $time = "now", ?DateTimeZone $timezone = null);
+
+ /** @return DateTimeZone */
+ public static function __set_state(array $array);
+
+ /** @return DateTimeImmutable */
+ public static function createFromMutable(DateTime $object);
+
+ public static function createFromInterface(DateTimeInterface $object): DateTimeImmutable;
+
+ /** @return DateTimeImmutable|false */
+ public static function createFromFormat(
+ string $format, string $time, ?DateTimeZone $timezone = null);
+
+ /** @return array|false */
+ public static function getLastErrors();
+
+ /** @return DateTimeImmutable|false */
+ public function modify(string $modify);
+
+ /** @return DateTimeImmutable */
+ public function add(DateInterval $interval);
+
+ /** @return DateTimeImmutable */
+ public function sub(DateInterval $interval);
+
+ /** @return DateTimeImmutable */
+ public function setTimezone(DateTimeZone $timezone);
+
+ /** @return DateTimeImmutable */
+ public function setTime(int $hour, int $minute, int $second = 0, int $microseconds = 0);
+
+ /** @return DateTimeImmutable */
+ public function setDate(int $year, int $month, int $day);
+
+ /** @return DateTimeImmutable */
+ public function setISODate(int $year, int $week, int $day = 1);
+
+ /** @return DateTimeImmutable */
+ public function setTimestamp(int $timestamp);
+}
+
+class DateTimeZone {
+ public function __construct(string $timezone);
+
+ /** @return string */
+ public function getName();
+
+ /** @return int */
+ public function getOffset(DateTimeInterface $datetime);
+
+ /** @return array|false */
+ public function getTransitions(
+ int $timestamp_begin = PHP_INT_MIN, int $timestamp_end = PHP_INT_MAX);
+
+ /** @return array|false */
+ public function getLocation();
+
+ /** @return array */
+ public static function listAbbreviations();
+
+ /** @return array|false */
+ public static function listIdentifiers(int $what = DateTimeZone::ALL, ?string $country = null);
+
+ public function __wakeup();
+
+ /** @return DateTimeZone */
+ public static function __set_state(array $array);
+}
+
+class DateInterval {
+ public function __construct(string $interval_spec);
+
+ /** @return DateInterval|false */
+ public static function createFromDateString(string $time);
+
+ /** @return string */
+ public function format(string $format);
+
+ public function __wakeup();
+
+ /** @return DateInterval */
+ public static function __set_state(array $array);
+}
+
+class DatePeriod implements Traversable {
+ /* Has an overloaded signature */
+ public function __construct($start, $interval = UNKNOWN, $end = UNKNOWN);
+
+ /** @return DateTimeInterface */
+ public function getStartDate();
+
+ /** @return DateTimeInterface|null */
+ public function getEndDate();
+
+ /** @return DateInterval */
+ public function getDateInterval();
+
+ /** @return int|null */
+ public function getRecurrences();
+
+ public function __wakeup();
+
+ /** @return DatePeriod */
+ public static function __set_state(array $array);
+}
diff --git a/ext/date/php_date_arginfo.h b/ext/date/php_date_arginfo.h
new file mode 100644
index 0000000000..acf6ddd663
--- /dev/null
+++ b/ext/date/php_date_arginfo.h
@@ -0,0 +1,399 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_strtotime, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, time, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, now, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_date, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, timestamp, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_idate, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, timestamp, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_gmdate arginfo_date
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mktime, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, hour, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, min, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, sec, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, mon, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, day, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, year, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_gmmktime arginfo_mktime
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_checkdate, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, m, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, d, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, y, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_strftime, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, timestamp, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_gmstrftime arginfo_strftime
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_time, 0, 0, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_localtime, 0, 0, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, timestamp, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, associative, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_getdate, 0, 0, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, timestamp, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_date_create, 0, 0, DateTime, MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, time, IS_STRING, 0)
+ ZEND_ARG_OBJ_INFO(0, timezone, DateTimeZone, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_date_create_immutable, 0, 0, DateTimeImmutable, MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, time, IS_STRING, 0)
+ ZEND_ARG_OBJ_INFO(0, timezone, DateTimeZone, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_date_create_from_format, 0, 2, DateTime, MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, time, IS_STRING, 0)
+ ZEND_ARG_OBJ_INFO(0, timezone, DateTimeZone, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_date_create_immutable_from_format, 0, 2, DateTimeImmutable, MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, time, IS_STRING, 0)
+ ZEND_ARG_OBJ_INFO(0, timezone, DateTimeZone, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_date_parse, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, date, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_date_parse_from_format, 0, 2, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, date, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_date_get_last_errors, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_date_format, 0, 2, IS_STRING, 0)
+ ZEND_ARG_OBJ_INFO(0, object, DateTimeInterface, 0)
+ ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_date_modify, 0, 2, DateTime, MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, object, DateTime, 0)
+ ZEND_ARG_TYPE_INFO(0, modify, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_date_add, 0, 2, DateTime, 0)
+ ZEND_ARG_OBJ_INFO(0, object, DateTime, 0)
+ ZEND_ARG_OBJ_INFO(0, interval, DateInterval, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_date_sub arginfo_date_add
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_date_timezone_get, 0, 1, DateTimeZone, MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, object, DateTimeInterface, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_date_timezone_set, 0, 2, DateTime, 0)
+ ZEND_ARG_OBJ_INFO(0, object, DateTimeInterface, 0)
+ ZEND_ARG_OBJ_INFO(0, timezone, DateTimeZone, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_date_offset_get, 0, 1, IS_LONG, 0)
+ ZEND_ARG_OBJ_INFO(0, object, DateTimeInterface, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_date_diff, 0, 2, DateInterval, 0)
+ ZEND_ARG_OBJ_INFO(0, object, DateTimeInterface, 0)
+ ZEND_ARG_OBJ_INFO(0, object2, DateTimeInterface, 0)
+ ZEND_ARG_TYPE_INFO(0, absolute, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_date_time_set, 0, 3, DateTime, 0)
+ ZEND_ARG_OBJ_INFO(0, object, DateTime, 0)
+ ZEND_ARG_TYPE_INFO(0, hour, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, minute, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, second, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, microseconds, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_date_date_set, 0, 4, DateTime, 0)
+ ZEND_ARG_OBJ_INFO(0, object, DateTime, 0)
+ ZEND_ARG_TYPE_INFO(0, year, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, month, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, day, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_date_isodate_set, 0, 3, DateTime, 0)
+ ZEND_ARG_OBJ_INFO(0, object, DateTime, 0)
+ ZEND_ARG_TYPE_INFO(0, year, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, week, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, day, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_date_timestamp_set, 0, 2, DateTime, 0)
+ ZEND_ARG_OBJ_INFO(0, object, DateTime, 0)
+ ZEND_ARG_TYPE_INFO(0, timestamp, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_date_timestamp_get, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, object, DateTimeInterface, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_timezone_open, 0, 1, DateTimeZone, MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, timezone, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_timezone_name_get, 0, 1, IS_STRING, 0)
+ ZEND_ARG_OBJ_INFO(0, object, DateTimeZone, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_timezone_name_from_abbr, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, abbr, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, gmtoffset, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, isdst, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_timezone_offset_get, 0, 2, IS_LONG, 0)
+ ZEND_ARG_OBJ_INFO(0, object, DateTimeZone, 0)
+ ZEND_ARG_OBJ_INFO(0, datetime, DateTimeInterface, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_timezone_transitions_get, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, object, DateTimeZone, 0)
+ ZEND_ARG_TYPE_INFO(0, timestamp_begin, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, timestamp_end, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_timezone_location_get, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, object, DateTimeZone, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_timezone_identifiers_list, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, what, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, country, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_timezone_abbreviations_list, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_timezone_version_get, 0, 0, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_date_interval_create_from_date_string, 0, 1, DateInterval, MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, time, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_date_interval_format, 0, 2, IS_STRING, 0)
+ ZEND_ARG_OBJ_INFO(0, object, DateInterval, 0)
+ ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_date_default_timezone_set, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, timezone_identifier, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_date_default_timezone_get arginfo_timezone_version_get
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_date_sunrise, 0, 1, MAY_BE_STRING|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, time, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, retformat, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, latitude, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, longitude, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, zenith, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, gmt_offset, IS_DOUBLE, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_date_sunset arginfo_date_sunrise
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_date_sun_info, 0, 3, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, time, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, latitude, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, longitude, IS_DOUBLE, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTimeInterface_format, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTimeInterface_getTimezone, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_DateTimeInterface_getOffset arginfo_class_DateTimeInterface_getTimezone
+
+#define arginfo_class_DateTimeInterface_getTimestamp arginfo_class_DateTimeInterface_getTimezone
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTimeInterface_diff, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, object, DateTimeInterface, 0)
+ ZEND_ARG_TYPE_INFO(0, absolute, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_DateTimeInterface___wakeup arginfo_class_DateTimeInterface_getTimezone
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTime___construct, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, time, IS_STRING, 0)
+ ZEND_ARG_OBJ_INFO(0, timezone, DateTimeZone, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTime___set_state, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, array, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTime_createFromImmutable, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, object, DateTimeImmutable, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_DateTime_createFromInterface, 0, 1, DateTime, 0)
+ ZEND_ARG_OBJ_INFO(0, object, DateTimeInterface, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTime_createFromFormat, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, time, IS_STRING, 0)
+ ZEND_ARG_OBJ_INFO(0, timezone, DateTimeZone, 1)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_DateTime_getLastErrors arginfo_class_DateTimeInterface_getTimezone
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTime_modify, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, modify, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTime_add, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, interval, DateInterval, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_DateTime_sub arginfo_class_DateTime_add
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTime_setTimezone, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, timezone, DateTimeZone, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTime_setTime, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, hour, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, minute, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, second, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, microseconds, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTime_setDate, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, year, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, month, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, day, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTime_setISODate, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, year, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, week, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, day, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTime_setTimestamp, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, timestamp, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_DateTimeImmutable___construct arginfo_class_DateTime___construct
+
+#define arginfo_class_DateTimeImmutable___set_state arginfo_class_DateTime___set_state
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTimeImmutable_createFromMutable, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, object, DateTime, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_DateTimeImmutable_createFromInterface, 0, 1, DateTimeImmutable, 0)
+ ZEND_ARG_OBJ_INFO(0, object, DateTimeInterface, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_DateTimeImmutable_createFromFormat arginfo_class_DateTime_createFromFormat
+
+#define arginfo_class_DateTimeImmutable_getLastErrors arginfo_class_DateTimeInterface_getTimezone
+
+#define arginfo_class_DateTimeImmutable_modify arginfo_class_DateTime_modify
+
+#define arginfo_class_DateTimeImmutable_add arginfo_class_DateTime_add
+
+#define arginfo_class_DateTimeImmutable_sub arginfo_class_DateTime_add
+
+#define arginfo_class_DateTimeImmutable_setTimezone arginfo_class_DateTime_setTimezone
+
+#define arginfo_class_DateTimeImmutable_setTime arginfo_class_DateTime_setTime
+
+#define arginfo_class_DateTimeImmutable_setDate arginfo_class_DateTime_setDate
+
+#define arginfo_class_DateTimeImmutable_setISODate arginfo_class_DateTime_setISODate
+
+#define arginfo_class_DateTimeImmutable_setTimestamp arginfo_class_DateTime_setTimestamp
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTimeZone___construct, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, timezone, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_DateTimeZone_getName arginfo_class_DateTimeInterface_getTimezone
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTimeZone_getOffset, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, datetime, DateTimeInterface, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTimeZone_getTransitions, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, timestamp_begin, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, timestamp_end, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_DateTimeZone_getLocation arginfo_class_DateTimeInterface_getTimezone
+
+#define arginfo_class_DateTimeZone_listAbbreviations arginfo_class_DateTimeInterface_getTimezone
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTimeZone_listIdentifiers, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, what, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, country, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_DateTimeZone___wakeup arginfo_class_DateTimeInterface_getTimezone
+
+#define arginfo_class_DateTimeZone___set_state arginfo_class_DateTime___set_state
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateInterval___construct, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, interval_spec, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateInterval_createFromDateString, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, time, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_DateInterval_format arginfo_class_DateTimeInterface_format
+
+#define arginfo_class_DateInterval___wakeup arginfo_class_DateTimeInterface_getTimezone
+
+#define arginfo_class_DateInterval___set_state arginfo_class_DateTime___set_state
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DatePeriod___construct, 0, 0, 1)
+ ZEND_ARG_INFO(0, start)
+ ZEND_ARG_INFO(0, interval)
+ ZEND_ARG_INFO(0, end)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_DatePeriod_getStartDate arginfo_class_DateTimeInterface_getTimezone
+
+#define arginfo_class_DatePeriod_getEndDate arginfo_class_DateTimeInterface_getTimezone
+
+#define arginfo_class_DatePeriod_getDateInterval arginfo_class_DateTimeInterface_getTimezone
+
+#define arginfo_class_DatePeriod_getRecurrences arginfo_class_DateTimeInterface_getTimezone
+
+#define arginfo_class_DatePeriod___wakeup arginfo_class_DateTimeInterface_getTimezone
+
+#define arginfo_class_DatePeriod___set_state arginfo_class_DateTime___set_state
diff --git a/ext/date/tests/002.phpt b/ext/date/tests/002.phpt
index adbea5e231..36dc43d760 100644
--- a/ext/date/tests/002.phpt
+++ b/ext/date/tests/002.phpt
@@ -8,45 +8,45 @@ if (!@putenv("TZ=EST5") || getenv("TZ") != 'EST5') {
?>
--FILE--
<?php
- $dates = array (
- "1999-10-13",
- "Oct 13 1999",
- "2000-01-19",
- "Jan 19 2000",
- "2001-12-21",
- "Dec 21 2001",
- "2001-12-21 12:16",
- "Dec 21 2001 12:16",
- "Dec 21 12:16",
- "2001-10-22 21:19:58",
- "2001-10-22 21:19:58-02",
- "2001-10-22 21:19:58-0213",
- "2001-10-22 21:19:58+02",
- "2001-10-22 21:19:58+0213",
- "2001-10-22T21:20:58-03:40",
- "2001-10-22T211958-2",
- "20011022T211958+0213",
- "20011022T21:20+0215",
- "1997W011",
- "2004W101T05:00+0",
- );
+ $dates = array (
+ "1999-10-13",
+ "Oct 13 1999",
+ "2000-01-19",
+ "Jan 19 2000",
+ "2001-12-21",
+ "Dec 21 2001",
+ "2001-12-21 12:16",
+ "Dec 21 2001 12:16",
+ "Dec 21 12:16",
+ "2001-10-22 21:19:58",
+ "2001-10-22 21:19:58-02",
+ "2001-10-22 21:19:58-0213",
+ "2001-10-22 21:19:58+02",
+ "2001-10-22 21:19:58+0213",
+ "2001-10-22T21:20:58-03:40",
+ "2001-10-22T211958-2",
+ "20011022T211958+0213",
+ "20011022T21:20+0215",
+ "1997W011",
+ "2004W101T05:00+0",
+ );
- echo "*** GMT0\n";
- date_default_timezone_set("GMT0");
- foreach ($dates as $date) {
- echo date ("Y-m-d H:i:s\n", strtotime ($date));
- }
+ echo "*** GMT0\n";
+ date_default_timezone_set("GMT0");
+ foreach ($dates as $date) {
+ echo date ("Y-m-d H:i:s\n", strtotime ($date));
+ }
- echo "*** US/Eastern\n";
- date_default_timezone_set("US/Eastern");
- if( date("T") == "GMT" ) {
- // POSIX style
- date_default_timezone_set("EST5EDT4,M4.1.0,M10.5.0");
- }
+ echo "*** US/Eastern\n";
+ date_default_timezone_set("US/Eastern");
+ if( date("T") == "GMT" ) {
+ // POSIX style
+ date_default_timezone_set("EST5EDT4,M4.1.0,M10.5.0");
+ }
- foreach ($dates as $date) {
- echo date ("Y-m-d H:i:s\n", strtotime ($date));
- }
+ foreach ($dates as $date) {
+ echo date ("Y-m-d H:i:s\n", strtotime ($date));
+ }
?>
--EXPECTF--
*** GMT0
diff --git a/ext/date/tests/003.phpt b/ext/date/tests/003.phpt
index 501899cc5f..ae7fcce23c 100644
--- a/ext/date/tests/003.phpt
+++ b/ext/date/tests/003.phpt
@@ -5,7 +5,7 @@ date suffixes test
date_default_timezone_set('UTC');
for ($i = 0; $i < 32; $i++) {
- var_dump(date("jS", mktime(0,0,0, 1, $i, 2006)));
+ var_dump(date("jS", mktime(0,0,0, 1, $i, 2006)));
}
echo "Done\n";
diff --git a/ext/date/tests/004.phpt b/ext/date/tests/004.phpt
index 986c9c9179..23cb508458 100644
--- a/ext/date/tests/004.phpt
+++ b/ext/date/tests/004.phpt
@@ -8,19 +8,19 @@ $tz = array("UTC", "Asia/Jerusalem", "America/Chicago", "Europe/London");
$t = mktime(0, 0, 0, 6, 27, 2006);
foreach ($tz as $zone) {
- date_default_timezone_set($zone);
+ date_default_timezone_set($zone);
- var_dump(date("w", $t));
- var_dump(date("z", $t));
- var_dump(date("n", $t));
- var_dump(date("t", $t));
- var_dump(date("L", $t));
- var_dump(date("a", $t));
- var_dump(date("B", $t));
- var_dump(date("g", $t));
- var_dump(date("G", $t));
- var_dump(date("Z", $t));
- var_dump(date("U", $t));
+ var_dump(date("w", $t));
+ var_dump(date("z", $t));
+ var_dump(date("n", $t));
+ var_dump(date("t", $t));
+ var_dump(date("L", $t));
+ var_dump(date("a", $t));
+ var_dump(date("B", $t));
+ var_dump(date("g", $t));
+ var_dump(date("G", $t));
+ var_dump(date("Z", $t));
+ var_dump(date("U", $t));
}
echo "Done\n";
diff --git a/ext/date/tests/005.phpt b/ext/date/tests/005.phpt
index e1075ef248..23fff3b731 100644
--- a/ext/date/tests/005.phpt
+++ b/ext/date/tests/005.phpt
@@ -6,9 +6,6 @@ date_default_timezone_set('UTC');
$t = mktime(0,0,0, 6, 27, 2006);
-var_dump(idate());
-var_dump(idate(1,1,1));
-
var_dump(idate(1,1));
var_dump(idate(""));
var_dump(idate(0));
@@ -20,12 +17,6 @@ var_dump(idate("'"));
echo "Done\n";
?>
--EXPECTF--
-Warning: idate() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: idate() expects at most 2 parameters, 3 given in %s on line %d
-bool(false)
-
Warning: idate(): Unrecognized date format token. in %s on line %d
bool(false)
diff --git a/ext/date/tests/006.phpt b/ext/date/tests/006.phpt
index 425430a470..5171c430e2 100644
--- a/ext/date/tests/006.phpt
+++ b/ext/date/tests/006.phpt
@@ -4,7 +4,6 @@ checkdate() tests
<?php
date_default_timezone_set('UTC');
-var_dump(checkdate());
var_dump(checkdate(1,1,1));
var_dump(checkdate(2,29,2006));
@@ -18,9 +17,7 @@ var_dump(checkdate(1,1,-1));
echo "Done\n";
?>
---EXPECTF--
-Warning: checkdate() expects exactly 3 parameters, 0 given in %s on line %d
-bool(false)
+--EXPECT--
bool(true)
bool(false)
bool(false)
diff --git a/ext/date/tests/007.phpt b/ext/date/tests/007.phpt
index 141e251753..4e0b24ce75 100644
--- a/ext/date/tests/007.phpt
+++ b/ext/date/tests/007.phpt
@@ -5,7 +5,6 @@ localtime() tests
date_default_timezone_set('UTC');
$t = mktime(0,0,0, 6, 27, 2006);
-var_dump(localtime(1,1,1));
var_dump(localtime());
var_dump(localtime($t));
@@ -15,8 +14,6 @@ var_dump(localtime($t, false));
echo "Done\n";
?>
--EXPECTF--
-Warning: localtime() expects at most 2 parameters, 3 given in %s on line %d
-bool(false)
array(9) {
[0]=>
int(%d)
diff --git a/ext/date/tests/008.phpt b/ext/date/tests/008.phpt
index e67b4bd0a4..701403d1f8 100644
--- a/ext/date/tests/008.phpt
+++ b/ext/date/tests/008.phpt
@@ -5,7 +5,6 @@ getdate() tests
date_default_timezone_set('UTC');
$t = mktime(0,0,0, 6, 27, 2006);
-var_dump(getdate(1,1));
var_dump(getdate($t));
var_dump(getdate());
@@ -13,8 +12,6 @@ var_dump(getdate());
echo "Done\n";
?>
--EXPECTF--
-Warning: getdate() expects at most 1 parameter, 2 given in %s on line %d
-bool(false)
array(11) {
["seconds"]=>
int(0)
diff --git a/ext/date/tests/009.phpt b/ext/date/tests/009.phpt
index 4812d63de6..9d77a552cc 100644
--- a/ext/date/tests/009.phpt
+++ b/ext/date/tests/009.phpt
@@ -10,16 +10,12 @@ date_default_timezone_set('Asia/Jerusalem');
$t = mktime(0,0,0, 6, 27, 2006);
-var_dump(strftime());
-
var_dump(strftime(""));
var_dump(strftime("%a %A %b %B %c %C %d %D %e %g %G %h %H %I %j %m %M %n %p %r %R %S %t %T %u %U %V %W %w %x %X %y %Y %Z %z %%", $t));
var_dump(strftime("%%q %%a", $t));
var_dump(strftime("%q", $t));
var_dump(strftime("blah", $t));
-var_dump(gmstrftime());
-
var_dump(gmstrftime(""));
var_dump(gmstrftime("%a %A %b %B %c %C %d %D %e %g %G %h %H %I %j %m %M %n %p %r %R %S %t %T %u %U %V %W %w %x %X %y %Y %Z %z %%", $t));
var_dump(gmstrftime("%%q %%a", $t));
@@ -29,17 +25,12 @@ var_dump(gmstrftime("blah", $t));
echo "Done\n";
?>
--EXPECTF--
-Warning: strftime() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
bool(false)
string(%d) "Tue Tuesday Jun June Tue Jun 27 00:00:00 2006 %s
%s %"
string(5) "%q %a"
string(%d) "%s"
string(4) "blah"
-
-Warning: gmstrftime() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
bool(false)
string(%d) "Mon Monday Jun June Mon Jun 26 21:00:00 2006 %s
%s %"
diff --git a/ext/date/tests/009_win32.phpt b/ext/date/tests/009_win32.phpt
index 91c1b261ce..dcd118c97d 100644
--- a/ext/date/tests/009_win32.phpt
+++ b/ext/date/tests/009_win32.phpt
@@ -14,8 +14,6 @@ setlocale(LC_TIME, "en-us");
$t = mktime(0,0,0, 6, 27, 2006);
-var_dump(strftime());
-
var_dump(strftime(""));
var_dump(strftime("%a %A %b %B %c %d %H %I %j %m %M %p %S %U %W %w %x %X %y %Y %Z %z %%", $t));
@@ -24,8 +22,6 @@ var_dump(strftime("%%q %%a", $t));
var_dump(strftime("blah", $t));
-var_dump(gmstrftime());
-
var_dump(gmstrftime(""));
var_dump(gmstrftime("%a %A %b %B %c %d %H %I %j %m %M %p %S %U %W %w %x %X %y %Y %Z %z %%", $t));
@@ -39,15 +35,10 @@ echo "Done\n";
setlocale(LC_TIME, $loc);
?>
--EXPECTF--
-Warning: strftime() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
bool(false)
string(%d) "Tue Tuesday Jun June 6/27/2006 12:00:00 AM 27 00 12 178 06 00 AM 00 26 26 2 6/27/2006 12:00:00 AM 06 2006 %s"
string(5) "%q %a"
string(4) "blah"
-
-Warning: gmstrftime() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
bool(false)
string(%d) "Mon Monday Jun June 6/26/2006 9:00:00 PM 26 21 09 177 06 00 PM 00 26 26 1 6/26/2006 9:00:00 PM 06 2006 %s"
string(5) "%q %a"
diff --git a/ext/date/tests/011.phpt b/ext/date/tests/011.phpt
index 092a4b7758..ca9820c4ef 100644
--- a/ext/date/tests/011.phpt
+++ b/ext/date/tests/011.phpt
@@ -4,7 +4,6 @@ timezone_name_from_abbr() tests
<?php
date_default_timezone_set('UTC');
-var_dump(timezone_name_from_abbr());
var_dump(timezone_name_from_abbr("CET"));
var_dump(timezone_name_from_abbr("AXST"));
var_dump(timezone_name_from_abbr("", 3600));
@@ -12,9 +11,7 @@ var_dump(timezone_name_from_abbr("", 3600, 0));
echo "Done\n";
?>
---EXPECTF--
-Warning: timezone_name_from_abbr() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
+--EXPECT--
string(13) "Europe/Berlin"
bool(false)
bool(false)
diff --git a/ext/date/tests/012.phpt b/ext/date/tests/012.phpt
index be7e4e32af..ee8faf1c00 100644
--- a/ext/date/tests/012.phpt
+++ b/ext/date/tests/012.phpt
@@ -7,15 +7,10 @@ date_default_timezone_set('UTC');
$dto = date_create("2006-12-12");
var_dump(date_isodate_set($dto, 2006, 2, 15));
var_dump($dto->format("Y/m/d H:i:s"));
-var_dump(date_isodate_set($dto, 2006));
-var_dump($dto->format("Y/m/d H:i:s"));
var_dump(date_isodate_set($dto, 2006, 5));
var_dump($dto->format("Y/m/d H:i:s"));
var_dump(date_isodate_set($dto, 2006, 100, 15));
var_dump($dto->format("Y/m/d H:i:s"));
-var_dump(date_isodate_set($dto, 2006, 100, 15, 10));
-var_dump($dto->format("Y/m/d H:i:s"));
-
echo "Done\n";
?>
--EXPECTF--
@@ -28,10 +23,6 @@ object(DateTime)#1 (3) {
string(3) "UTC"
}
string(19) "2006/01/23 00:00:00"
-
-Warning: date_isodate_set() expects at least 3 parameters, 2 given in %s on line %d
-bool(false)
-string(19) "2006/01/23 00:00:00"
object(DateTime)#1 (3) {
["date"]=>
string(26) "2006-01-30 00:00:00.000000"
@@ -50,8 +41,4 @@ object(DateTime)#1 (3) {
string(3) "UTC"
}
string(19) "2007/12/10 00:00:00"
-
-Warning: date_isodate_set() expects at most 4 parameters, 5 given in %s on line %d
-bool(false)
-string(19) "2007/12/10 00:00:00"
Done
diff --git a/ext/date/tests/013.phpt b/ext/date/tests/013.phpt
index 266dafe06a..6010071be6 100644
--- a/ext/date/tests/013.phpt
+++ b/ext/date/tests/013.phpt
@@ -7,10 +7,6 @@ date_default_timezone_set('UTC');
$dto = date_create("2006-12-12");
var_dump($dto);
var_dump($dto->format("Y.m.d H:i:s"));
-var_dump(date_date_set());
-var_dump($dto->format("Y.m.d H:i:s"));
-var_dump(date_date_set($dto, 2006, 5));
-var_dump($dto->format("Y.m.d H:i:s"));
var_dump(date_date_set($dto, 2006, 2, 15));
var_dump($dto->format("Y.m.d H:i:s"));
var_dump(date_date_set($dto, 2006, 24, 60));
@@ -28,14 +24,6 @@ object(DateTime)#%d (3) {
string(3) "UTC"
}
string(19) "2006.12.12 00:00:00"
-
-Warning: date_date_set() expects exactly 4 parameters, 0 given in %s on line %d
-bool(false)
-string(19) "2006.12.12 00:00:00"
-
-Warning: date_date_set() expects exactly 4 parameters, 3 given in %s on line %d
-bool(false)
-string(19) "2006.12.12 00:00:00"
object(DateTime)#1 (3) {
["date"]=>
string(26) "2006-02-15 00:00:00.000000"
diff --git a/ext/date/tests/014.phpt b/ext/date/tests/014.phpt
index 2e72bdabe0..f57f3e4b1d 100644
--- a/ext/date/tests/014.phpt
+++ b/ext/date/tests/014.phpt
@@ -10,7 +10,6 @@ var_dump($dto);
$dtz = date_timezone_get($dto);
var_dump($dtz);
-var_dump(timezone_offset_get());
var_dump(timezone_offset_get($dtz, $dto));
var_dump(timezone_offset_get($dto, $dtz));
@@ -32,12 +31,9 @@ object(DateTimeZone)#%d (2) {
["timezone"]=>
string(3) "UTC"
}
-
-Warning: timezone_offset_get() expects exactly 2 parameters, 0 given in %s on line %d
-bool(false)
int(0)
-Fatal error: Uncaught TypeError: Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, instance of DateTime given in %s:%d
+Fatal error: Uncaught TypeError: timezone_offset_get() expects parameter 1 to be DateTimeZone, object given in %s:%d
Stack trace:
#0 %s(%d): timezone_offset_get(Object(DateTime), Object(DateTimeZone))
#1 {main}
diff --git a/ext/date/tests/68062.phpt b/ext/date/tests/68062.phpt
index 6b1e16ae67..1270382158 100644
--- a/ext/date/tests/68062.phpt
+++ b/ext/date/tests/68062.phpt
@@ -6,8 +6,12 @@ DateTimeZone::getOffset() accepts a DateTimeInterface object
$tz = new DateTimeZone('Europe/London');
$dt = new DateTimeImmutable('2014-09-20', $tz);
-echo $tz->getOffset($dt);
-echo $tz->getOffset(1);
---EXPECTF--
+echo $tz->getOffset($dt), "\n";
+try {
+ echo $tz->getOffset(1);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+--EXPECT--
3600
-Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, int given in %s
+DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, int given
diff --git a/ext/date/tests/DateTimeImmutable_createFromInterface.phpt b/ext/date/tests/DateTimeImmutable_createFromInterface.phpt
new file mode 100644
index 0000000000..31e3847ef7
--- /dev/null
+++ b/ext/date/tests/DateTimeImmutable_createFromInterface.phpt
@@ -0,0 +1,79 @@
+--TEST--
+Tests for DateTimeImmutable::createFromInterface
+--INI--
+date.timezone=Europe/London
+--FILE--
+<?php
+$current = "2014-03-02 16:24:08";
+
+$i = DateTimeImmutable::createFromInterface( date_create( $current ) );
+var_dump( $i );
+
+$i = DateTimeImmutable::createFromInterface( date_create_immutable( $current ) );
+var_dump( $i );
+
+$current = "2019-12-16 15:06:46 CET";
+
+$i = DateTimeImmutable::createFromInterface( date_create( $current ) );
+var_dump( $i );
+
+$i = DateTimeImmutable::createFromInterface( date_create_immutable( $current ) );
+var_dump( $i );
+
+$current = "2019-12-16 15:08:20 +0100";
+
+$i = DateTimeImmutable::createFromInterface( date_create( $current ) );
+var_dump( $i );
+
+$i = DateTimeImmutable::createFromInterface( date_create_immutable( $current ) );
+var_dump( $i );
+?>
+--EXPECTF--
+object(DateTimeImmutable)#%d (3) {
+ ["date"]=>
+ string(26) "2014-03-02 16:24:08.000000"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+object(DateTimeImmutable)#%d (3) {
+ ["date"]=>
+ string(26) "2014-03-02 16:24:08.000000"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+object(DateTimeImmutable)#%d (3) {
+ ["date"]=>
+ string(26) "2019-12-16 15:06:46.000000"
+ ["timezone_type"]=>
+ int(2)
+ ["timezone"]=>
+ string(3) "CET"
+}
+object(DateTimeImmutable)#%d (3) {
+ ["date"]=>
+ string(26) "2019-12-16 15:06:46.000000"
+ ["timezone_type"]=>
+ int(2)
+ ["timezone"]=>
+ string(3) "CET"
+}
+object(DateTimeImmutable)#%d (3) {
+ ["date"]=>
+ string(26) "2019-12-16 15:08:20.000000"
+ ["timezone_type"]=>
+ int(1)
+ ["timezone"]=>
+ string(6) "+01:00"
+}
+object(DateTimeImmutable)#%d (3) {
+ ["date"]=>
+ string(26) "2019-12-16 15:08:20.000000"
+ ["timezone_type"]=>
+ int(1)
+ ["timezone"]=>
+ string(6) "+01:00"
+}
diff --git a/ext/date/tests/DateTimeImmutable_createFromMutable.phpt b/ext/date/tests/DateTimeImmutable_createFromMutable.phpt
index ac92fb4bb4..671afc1229 100644
--- a/ext/date/tests/DateTimeImmutable_createFromMutable.phpt
+++ b/ext/date/tests/DateTimeImmutable_createFromMutable.phpt
@@ -1,5 +1,5 @@
--TEST--
-Tests for DateTimeImmutable::createFromMutable.
+Tests for DateTimeImmutable::createFromMutable
--INI--
date.timezone=Europe/London
--FILE--
@@ -9,8 +9,11 @@ $current = "2014-03-02 16:24:08";
$i = DateTimeImmutable::createFromMutable( date_create( $current ) );
var_dump( $i );
-$i = DateTimeImmutable::createFromMutable( date_create_immutable( $current ) );
-var_dump( $i );
+try {
+ DateTimeImmutable::createFromMutable( date_create_immutable( $current ) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
--EXPECTF--
object(DateTimeImmutable)#%d (3) {
@@ -21,6 +24,4 @@ object(DateTimeImmutable)#%d (3) {
["timezone"]=>
string(13) "Europe/London"
}
-
-Warning: DateTimeImmutable::createFromMutable() expects parameter 1 to be DateTime, object given in %stests%eDateTimeImmutable_createFromMutable.php on line %d
-NULL
+DateTimeImmutable::createFromMutable() expects parameter 1 to be DateTime, object given
diff --git a/ext/date/tests/DateTimeZone_clone_basic1.phpt b/ext/date/tests/DateTimeZone_clone_basic1.phpt
index 5f527202cd..3d154512f6 100644
--- a/ext/date/tests/DateTimeZone_clone_basic1.phpt
+++ b/ext/date/tests/DateTimeZone_clone_basic1.phpt
@@ -18,15 +18,14 @@ var_dump($orig);
var_dump($clone);
if ($clone != $orig) {
- echo "TEST FAILED : objects not equal\n";
+ echo "TEST FAILED : objects not equal\n";
}else if ($clone === $orig) {
- echo "TEST FAILED : objects identical\n";
+ echo "TEST FAILED : objects identical\n";
} else {
- echo "TEST PASSED : Objects equal but not indetical\n";
+ echo "TEST PASSED : Objects equal but not indetical\n";
}
?>
-===DONE===
--EXPECTF--
*** Testing clone on DateTime objects ***
object(DateTimeZone)#%d (2) {
@@ -42,4 +41,3 @@ object(DateTimeZone)#%d (2) {
string(3) "GMT"
}
TEST PASSED : Objects equal but not indetical
-===DONE===
diff --git a/ext/date/tests/DateTimeZone_clone_basic2.phpt b/ext/date/tests/DateTimeZone_clone_basic2.phpt
index 6cd07393e2..b41eeddfbd 100644
--- a/ext/date/tests/DateTimeZone_clone_basic2.phpt
+++ b/ext/date/tests/DateTimeZone_clone_basic2.phpt
@@ -1,21 +1,21 @@
--TEST--
-Testing clone on objects whoose class derived from DateTimeZone class
+Testing clone on objects whose class derived from DateTimeZone class
--FILE--
<?php
//Set the default time zone
date_default_timezone_set("Europe/London");
class DateTimeZoneExt1 extends DateTimeZone {
- public $property1 = 99;
- public $property2 = "Hello";
+ public $property1 = 99;
+ public $property2 = "Hello";
}
class DateTimeZoneExt2 extends DateTimeZoneExt1 {
- public $property3 = true;
- public $property4 = 10.5;
+ public $property3 = true;
+ public $property4 = 10.5;
}
-echo "*** Testing clone on objects whoose class derived from DateTimeZone class ***\n";
+echo "*** Testing clone on objects whose class derived from DateTimeZone class ***\n";
$d1 = new DateTimeZoneExt1("Europe/London");
var_dump($d1);
@@ -28,9 +28,8 @@ $d2_clone = clone $d2;
var_dump($d2_clone);
?>
-===DONE===
--EXPECTF--
-*** Testing clone on objects whoose class derived from DateTimeZone class ***
+*** Testing clone on objects whose class derived from DateTimeZone class ***
object(DateTimeZoneExt1)#%d (4) {
["property1"]=>
int(99)
@@ -79,4 +78,3 @@ object(DateTimeZoneExt2)#%d (6) {
["timezone"]=>
string(13) "Europe/London"
}
-===DONE===
diff --git a/ext/date/tests/DateTimeZone_clone_basic3.phpt b/ext/date/tests/DateTimeZone_clone_basic3.phpt
index c573af9571..5f85333789 100644
--- a/ext/date/tests/DateTimeZone_clone_basic3.phpt
+++ b/ext/date/tests/DateTimeZone_clone_basic3.phpt
@@ -25,7 +25,6 @@ echo "\n-- clone it --\n";
$d2_clone = clone $d1_clone;
var_dump($d2_clone);
?>
-===DONE===
--EXPECTF--
*** Testing clone on DateTime objects ***
@@ -92,4 +91,3 @@ object(DateTimeZone)#%d (6) {
["timezone"]=>
string(13) "Europe/London"
}
-===DONE===
diff --git a/ext/date/tests/DateTimeZone_clone_basic4.phpt b/ext/date/tests/DateTimeZone_clone_basic4.phpt
index 70bd7f3bb1..9f99bc5b3e 100644
--- a/ext/date/tests/DateTimeZone_clone_basic4.phpt
+++ b/ext/date/tests/DateTimeZone_clone_basic4.phpt
@@ -6,9 +6,9 @@ Test clone of DateTimeZone derived objects with __clone magic method
date_default_timezone_set("Europe/London");
class DateTimeZoneExt1 extends DateTimeZone {
- public function __clone() {
- echo "-- DateTimeExt1 __clone magic method called --\n";
- }
+ public function __clone() {
+ echo "-- DateTimeExt1 __clone magic method called --\n";
+ }
}
echo "*** Testing clone of objects derived from DateTimeZone class with __clone magic method***\n";
@@ -20,9 +20,7 @@ $d1_clone = clone $d1;
var_dump( $d1_clone->getName() );
?>
-===DONE===
--EXPECT--
*** Testing clone of objects derived from DateTimeZone class with __clone magic method***
-- DateTimeExt1 __clone magic method called --
string(16) "America/New_York"
-===DONE===
diff --git a/ext/date/tests/DateTimeZone_compare_basic1.phpt b/ext/date/tests/DateTimeZone_compare_basic1.phpt
index 790bb6cf7f..1e37178a34 100644
--- a/ext/date/tests/DateTimeZone_compare_basic1.phpt
+++ b/ext/date/tests/DateTimeZone_compare_basic1.phpt
@@ -14,8 +14,8 @@ class DateTimeZoneExt1 extends DateTimeZone {
}
class DateTimeZoneExt2 extends DateTimeZone{
- public $foo = "Hello";
- private $bar = 99;
+ public $foo = "Hello";
+ private $bar = 99;
}
class DateTimeZoneExt3 extends DateTimeZoneExt2 {
@@ -37,7 +37,6 @@ var_dump($obj2 == $obj4);
var_dump($obj3 == $obj4);
?>
-===DONE===
--EXPECT--
Simple test for DateTimeZone compare object handler
@@ -51,4 +50,3 @@ bool(false)
bool(false)
bool(false)
bool(false)
-===DONE===
diff --git a/ext/date/tests/DateTimeZone_construct_basic.phpt b/ext/date/tests/DateTimeZone_construct_basic.phpt
index 737d655b9c..c2ded65412 100644
--- a/ext/date/tests/DateTimeZone_construct_basic.phpt
+++ b/ext/date/tests/DateTimeZone_construct_basic.phpt
@@ -18,7 +18,6 @@ var_dump( new DateTimeZone("Europe/London") );
var_dump( new DateTimeZone("America/Los_Angeles") );
?>
-===DONE===
--EXPECTF--
*** Testing new DateTimeZone() : basic functionality ***
object(DateTimeZone)#%d (2) {
@@ -39,4 +38,3 @@ object(DateTimeZone)#%d (2) {
["timezone"]=>
string(19) "America/Los_Angeles"
}
-===DONE===
diff --git a/ext/date/tests/DateTimeZone_construct_error.phpt b/ext/date/tests/DateTimeZone_construct_error.phpt
index 6bde64c4a2..4ae5d2d228 100644
--- a/ext/date/tests/DateTimeZone_construct_error.phpt
+++ b/ext/date/tests/DateTimeZone_construct_error.phpt
@@ -22,10 +22,8 @@ try {
}
?>
-===DONE===
--EXPECT--
*** Testing DateTimeZone() : error conditions ***
-- Testing new DateTimeZone() with more than expected no. of arguments --
DateTimeZone::__construct() expects exactly 1 parameter, 2 given
-===DONE===
diff --git a/ext/date/tests/DateTimeZone_extends_basic1.phpt b/ext/date/tests/DateTimeZone_extends_basic1.phpt
index 462cb155d2..ace71c3ffa 100644
--- a/ext/date/tests/DateTimeZone_extends_basic1.phpt
+++ b/ext/date/tests/DateTimeZone_extends_basic1.phpt
@@ -10,10 +10,10 @@ echo "*** Testing basic DateTimeZone inheritance() ***\n";
class DateTimeZoneExt extends DateTimeZone
{
- public function __toString()
- {
- return parent::getName();
- }
+ public function __toString()
+ {
+ return parent::getName();
+ }
}
echo "\n-- Create an instance of DateTimeZoneExt --\n";
@@ -23,7 +23,6 @@ echo "\n-- Invoke __toString --\n";
echo $d . "\n";
?>
-===DONE===
--EXPECT--
*** Testing basic DateTimeZone inheritance() ***
@@ -31,4 +30,3 @@ echo $d . "\n";
-- Invoke __toString --
America/Los_Angeles
-===DONE===
diff --git a/ext/date/tests/DateTimeZone_getName_basic1.phpt b/ext/date/tests/DateTimeZone_getName_basic1.phpt
index c226aa39bb..6d320b5ae0 100644
--- a/ext/date/tests/DateTimeZone_getName_basic1.phpt
+++ b/ext/date/tests/DateTimeZone_getName_basic1.phpt
@@ -23,10 +23,8 @@ $tz3 = new DateTimeZone("America/Los_Angeles");
var_dump( $tz3->getName() );
?>
-===DONE===
--EXPECT--
*** Testing DateTimeZone::getName() : basic functionality ***
string(13) "Europe/London"
string(16) "America/New_York"
string(19) "America/Los_Angeles"
-===DONE===
diff --git a/ext/date/tests/DateTimeZone_getOffset_basic1.phpt b/ext/date/tests/DateTimeZone_getOffset_basic1.phpt
index ce1c04336e..b0617a47a4 100644
--- a/ext/date/tests/DateTimeZone_getOffset_basic1.phpt
+++ b/ext/date/tests/DateTimeZone_getOffset_basic1.phpt
@@ -24,10 +24,8 @@ $tz3 = new DateTimeZone("America/Los_Angeles");
var_dump( $tz3->getOffset($date) );
?>
-===DONE===
--EXPECTF--
*** Testing DateTimeZone::getOffset() : basic functionality ***
%rint\(0\)|int\(3600\)%r
%rint\(-18000\)|int\(-14400\)%r
%rint\(-28800\)|int\(-25200\)%r
-===DONE===
diff --git a/ext/date/tests/DateTimeZone_getTransitions_basic1.phpt b/ext/date/tests/DateTimeZone_getTransitions_basic1.phpt
index ee88321fca..7559143466 100644
--- a/ext/date/tests/DateTimeZone_getTransitions_basic1.phpt
+++ b/ext/date/tests/DateTimeZone_getTransitions_basic1.phpt
@@ -19,7 +19,7 @@ $tz = new DateTimeZone("Europe/London");
$tran = $tz->getTransitions(-306972000, -37241999);
if (!is_array($tran)) {
- echo "TEST FAILED: Expected an array\n";
+ echo "TEST FAILED: Expected an array\n";
}
echo "\n-- Total number of transitions: " . count($tran). " --\n";
@@ -28,7 +28,6 @@ echo "\n-- Format a sample entry for Spring 1963 --\n";
var_dump( $tran[6] );
?>
-===DONE===
--EXPECT--
*** Testing DateTimeZone::getTransitions() : basic functionality ***
@@ -47,4 +46,3 @@ array(5) {
["abbr"]=>
string(3) "BST"
}
-===DONE===
diff --git a/ext/date/tests/DateTimeZone_listAbbreviations_basic1.phpt b/ext/date/tests/DateTimeZone_listAbbreviations_basic1.phpt
index 0154839ae4..cb948e9df5 100644
--- a/ext/date/tests/DateTimeZone_listAbbreviations_basic1.phpt
+++ b/ext/date/tests/DateTimeZone_listAbbreviations_basic1.phpt
@@ -22,7 +22,6 @@ echo "\n-- Format a sample entry --\n";
var_dump( $abbr["acst"] );
?>
-===DONE===
--EXPECTF--
*** Testing DateTimeZone::listAbbreviations() : basic functionality ***
string(5) "array"
@@ -85,4 +84,3 @@ array(6) {
string(20) "Australia/Yancowinna"
}
}
-===DONE===
diff --git a/ext/date/tests/DateTimeZone_listIdentifiers_basic1.phpt b/ext/date/tests/DateTimeZone_listIdentifiers_basic1.phpt
index 26a0c2fca2..05ced8701e 100644
--- a/ext/date/tests/DateTimeZone_listIdentifiers_basic1.phpt
+++ b/ext/date/tests/DateTimeZone_listIdentifiers_basic1.phpt
@@ -23,7 +23,6 @@ var_dump(in_array("America/New_York", $zones));
var_dump(in_array("UTC", $zones));
?>
-===DONE===
--EXPECT--
*** Testing DateTimeZone::listIdentifiers() : basic functionality ***
Check return tpe is ARRAY
@@ -32,5 +31,4 @@ Check array contains some common timezones
bool(true)
bool(true)
bool(true)
-===DONE===
diff --git a/ext/date/tests/DateTimeZone_serialize_type_1.phpt b/ext/date/tests/DateTimeZone_serialize_type_1.phpt
index e6835f3daf..f35a133cfb 100644
--- a/ext/date/tests/DateTimeZone_serialize_type_1.phpt
+++ b/ext/date/tests/DateTimeZone_serialize_type_1.phpt
@@ -16,7 +16,6 @@ var_dump($tz2);
var_dump( $tz2->getName() );
?>
-===DONE===
--EXPECTF--
object(DateTimeZone)#%d (2) {
["timezone_type"]=>
@@ -32,4 +31,3 @@ object(DateTimeZone)#%d (2) {
string(6) "+01:00"
}
string(6) "+01:00"
-===DONE===
diff --git a/ext/date/tests/DateTimeZone_serialize_type_2.phpt b/ext/date/tests/DateTimeZone_serialize_type_2.phpt
index 92f1e70bc4..a823ee08c0 100644
--- a/ext/date/tests/DateTimeZone_serialize_type_2.phpt
+++ b/ext/date/tests/DateTimeZone_serialize_type_2.phpt
@@ -16,7 +16,6 @@ var_dump($tz2);
var_dump( $tz2->getName() );
?>
-===DONE===
--EXPECTF--
object(DateTimeZone)#%d (2) {
["timezone_type"]=>
@@ -32,4 +31,3 @@ object(DateTimeZone)#%d (2) {
string(3) "EST"
}
string(3) "EST"
-===DONE===
diff --git a/ext/date/tests/DateTimeZone_serialize_type_3.phpt b/ext/date/tests/DateTimeZone_serialize_type_3.phpt
index cffef81b6b..92ac958dc3 100644
--- a/ext/date/tests/DateTimeZone_serialize_type_3.phpt
+++ b/ext/date/tests/DateTimeZone_serialize_type_3.phpt
@@ -16,7 +16,6 @@ var_dump($tz2);
var_dump( $tz2->getName() );
?>
-===DONE===
--EXPECT--
object(DateTimeZone)#1 (2) {
["timezone_type"]=>
@@ -32,4 +31,3 @@ object(DateTimeZone)#2 (2) {
string(16) "America/New_York"
}
string(16) "America/New_York"
-===DONE===
diff --git a/ext/date/tests/DateTimeZone_verify.phpt b/ext/date/tests/DateTimeZone_verify.phpt
index 2cba7c859e..0787d11c27 100644
--- a/ext/date/tests/DateTimeZone_verify.phpt
+++ b/ext/date/tests/DateTimeZone_verify.phpt
@@ -17,7 +17,6 @@ echo "..and get names of all its class constants\n";
$constants = $class->getConstants();
var_dump($constants);
?>
-===DONE===
--EXPECTF--
*** Verify DateTimeZone class ***
Verify DateTimeZone class registered OK
@@ -122,4 +121,3 @@ array(14) {
["PER_COUNTRY"]=>
int(4096)
}
-===DONE===
diff --git a/ext/date/tests/DateTime_clone_basic1.phpt b/ext/date/tests/DateTime_clone_basic1.phpt
index 318d5c3d7f..714f9a174d 100644
--- a/ext/date/tests/DateTime_clone_basic1.phpt
+++ b/ext/date/tests/DateTime_clone_basic1.phpt
@@ -21,9 +21,7 @@ echo "Original: " . $orig->format("H:i:s") . "\n";
echo "Clone: " . $clone->format("H:i:s") . "\n";
?>
-===DONE===
--EXPECT--
*** Testing clone on DateTime objects ***
Original: 22:41:50
Clone: 14:25:41
-===DONE===
diff --git a/ext/date/tests/DateTime_clone_basic2.phpt b/ext/date/tests/DateTime_clone_basic2.phpt
index e4ca0c1cab..261879283e 100644
--- a/ext/date/tests/DateTime_clone_basic2.phpt
+++ b/ext/date/tests/DateTime_clone_basic2.phpt
@@ -1,22 +1,22 @@
--TEST--
-Test clone of objects whoose class derived from DateTime class
+Test clone of objects whose class derived from DateTime class
--FILE--
<?php
//Set the default time zone
date_default_timezone_set("Europe/London");
class DateTimeExt1 extends DateTime {
- public $property1 = 99;
- public $property2 = "Hello";
+ public $property1 = 99;
+ public $property2 = "Hello";
}
class DateTimeExt2 extends DateTimeExt1 {
- public $property3 = true;
- public $property4 = 10.5;
+ public $property3 = true;
+ public $property4 = 10.5;
}
-echo "*** Testing clone on objects whoose class derived from DateTime class ***\n";
+echo "*** Testing clone on objects whose class derived from DateTime class ***\n";
$d1 = new DateTimeExt1("2009-02-03 12:34:41 GMT");
var_dump($d1);
@@ -28,9 +28,8 @@ var_dump($d2);
$d2_clone = clone $d2;
var_dump($d2_clone);
?>
-===DONE===
--EXPECTF--
-*** Testing clone on objects whoose class derived from DateTime class ***
+*** Testing clone on objects whose class derived from DateTime class ***
object(DateTimeExt1)#%d (5) {
["property1"]=>
int(99)
@@ -87,4 +86,3 @@ object(DateTimeExt2)#%d (7) {
["timezone"]=>
string(3) "GMT"
}
-===DONE===
diff --git a/ext/date/tests/DateTime_clone_basic3.phpt b/ext/date/tests/DateTime_clone_basic3.phpt
index ebda6a8428..dd7220799d 100644
--- a/ext/date/tests/DateTime_clone_basic3.phpt
+++ b/ext/date/tests/DateTime_clone_basic3.phpt
@@ -25,7 +25,6 @@ echo "\n-- clone it --\n";
$d2_clone = clone $d1_clone;
var_dump($d2_clone);
?>
-===DONE===
--EXPECTF--
*** Testing clone on DateTime objects ***
@@ -102,4 +101,3 @@ object(DateTime)#%d (7) {
["timezone"]=>
string(3) "GMT"
}
-===DONE===
diff --git a/ext/date/tests/DateTime_clone_basic4.phpt b/ext/date/tests/DateTime_clone_basic4.phpt
index e228783a96..3633cb56e0 100644
--- a/ext/date/tests/DateTime_clone_basic4.phpt
+++ b/ext/date/tests/DateTime_clone_basic4.phpt
@@ -9,9 +9,9 @@ date_default_timezone_set("Europe/London");
date_default_timezone_set("Europe/London");
class DateTimeExt1 extends DateTime {
- public function __clone() {
- echo "-- DateTimeExt1 __clone magic method called --\n";
- }
+ public function __clone() {
+ echo "-- DateTimeExt1 __clone magic method called --\n";
+ }
}
echo "*** Testing clone of objects derived from DateTime class with __clone magic method***\n";
@@ -23,9 +23,7 @@ $d1_clone = clone $d1;
var_dump( $d1_clone->format( "m.d.y") );
?>
-===DONE===
--EXPECT--
*** Testing clone of objects derived from DateTime class with __clone magic method***
-- DateTimeExt1 __clone magic method called --
string(8) "02.03.09"
-===DONE===
diff --git a/ext/date/tests/DateTime_compare_basic1.phpt b/ext/date/tests/DateTime_compare_basic1.phpt
index 0d3f15360d..93c7b1f34e 100644
--- a/ext/date/tests/DateTime_compare_basic1.phpt
+++ b/ext/date/tests/DateTime_compare_basic1.phpt
@@ -12,8 +12,8 @@ class DateTimeExt1 extends DateTime {
}
class DateTimeExt2 extends DateTime{
- public $foo = "Hello";
- private $bar = 99;
+ public $foo = "Hello";
+ private $bar = 99;
}
class DateTimeExt3 extends DateTimeExt2 {
@@ -49,7 +49,6 @@ var_dump($obj1 == $obj2);
var_dump($obj1 == $obj3);
var_dump($obj1 == $obj4);
?>
-===DONE===
--EXPECT--
Simple test for DateTime compare object handler
@@ -74,4 +73,3 @@ bool(false)
bool(true)
bool(true)
bool(true)
-===DONE===
diff --git a/ext/date/tests/DateTime_construct_basic1.phpt b/ext/date/tests/DateTime_construct_basic1.phpt
index f2a341b053..37ed61c8d0 100644
--- a/ext/date/tests/DateTime_construct_basic1.phpt
+++ b/ext/date/tests/DateTime_construct_basic1.phpt
@@ -20,7 +20,6 @@ var_dump( new DateTime("2005-07-14 22:30:41") );
var_dump( new DateTime("2005-07-14 22:30:41 GMT") );
?>
-===DONE===
--EXPECTF--
*** Testing new DateTime() : basic functionality ***
object(DateTime)#%d (3) {
@@ -55,4 +54,3 @@ object(DateTime)#%d (3) {
["timezone"]=>
string(3) "GMT"
}
-===DONE===
diff --git a/ext/date/tests/DateTime_construct_error.phpt b/ext/date/tests/DateTime_construct_error.phpt
index 7219d2b712..00b0394ff9 100644
--- a/ext/date/tests/DateTime_construct_error.phpt
+++ b/ext/date/tests/DateTime_construct_error.phpt
@@ -23,10 +23,8 @@ try {
}
?>
-===DONE===
--EXPECT--
*** Testing date_create() : error conditions ***
-- Testing new DateTime() with more than expected no. of arguments --
DateTime::__construct() expects at most 2 parameters, 3 given
-===DONE===
diff --git a/ext/date/tests/DateTime_createFromImmutable.phpt b/ext/date/tests/DateTime_createFromImmutable.phpt
index ee7731855a..841a3d4d33 100644
--- a/ext/date/tests/DateTime_createFromImmutable.phpt
+++ b/ext/date/tests/DateTime_createFromImmutable.phpt
@@ -14,8 +14,11 @@ $m->modify('+ 1 hour');
var_dump( $i->format('Y-m-d H:i:s') === $current );
-$m = DateTime::createFromImmutable( date_create( $current ) );
-var_dump( $m );
+try {
+ DateTime::createFromImmutable( date_create( $current ) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
--EXPECTF--
object(DateTime)#%d (3) {
@@ -27,6 +30,4 @@ object(DateTime)#%d (3) {
string(13) "Europe/London"
}
bool(true)
-
-Warning: DateTime::createFromImmutable() expects parameter 1 to be DateTimeImmutable, object given in %stests%eDateTime_createFromImmutable.php on line %d
-NULL
+DateTime::createFromImmutable() expects parameter 1 to be DateTimeImmutable, object given
diff --git a/ext/date/tests/DateTime_createFromInterface.phpt b/ext/date/tests/DateTime_createFromInterface.phpt
new file mode 100644
index 0000000000..a1ad5a3784
--- /dev/null
+++ b/ext/date/tests/DateTime_createFromInterface.phpt
@@ -0,0 +1,79 @@
+--TEST--
+Tests for DateTime::createFromInterface
+--INI--
+date.timezone=Europe/London
+--FILE--
+<?php
+$current = "2014-03-02 16:24:08";
+
+$i = DateTime::createFromInterface( date_create( $current ) );
+var_dump( $i );
+
+$i = DateTime::createFromInterface( date_create_immutable( $current ) );
+var_dump( $i );
+
+$current = "2019-12-16 15:06:46 CET";
+
+$i = DateTime::createFromInterface( date_create( $current ) );
+var_dump( $i );
+
+$i = DateTime::createFromInterface( date_create_immutable( $current ) );
+var_dump( $i );
+
+$current = "2019-12-16 15:08:20 +0100";
+
+$i = DateTime::createFromInterface( date_create( $current ) );
+var_dump( $i );
+
+$i = DateTime::createFromInterface( date_create_immutable( $current ) );
+var_dump( $i );
+?>
+--EXPECTF--
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(26) "2014-03-02 16:24:08.000000"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(26) "2014-03-02 16:24:08.000000"
+ ["timezone_type"]=>
+ int(3)
+ ["timezone"]=>
+ string(13) "Europe/London"
+}
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(26) "2019-12-16 15:06:46.000000"
+ ["timezone_type"]=>
+ int(2)
+ ["timezone"]=>
+ string(3) "CET"
+}
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(26) "2019-12-16 15:06:46.000000"
+ ["timezone_type"]=>
+ int(2)
+ ["timezone"]=>
+ string(3) "CET"
+}
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(26) "2019-12-16 15:08:20.000000"
+ ["timezone_type"]=>
+ int(1)
+ ["timezone"]=>
+ string(6) "+01:00"
+}
+object(DateTime)#%d (3) {
+ ["date"]=>
+ string(26) "2019-12-16 15:08:20.000000"
+ ["timezone_type"]=>
+ int(1)
+ ["timezone"]=>
+ string(6) "+01:00"
+}
diff --git a/ext/date/tests/DateTime_extends_basic1.phpt b/ext/date/tests/DateTime_extends_basic1.phpt
index 04f4f76acc..1a4c004c89 100644
--- a/ext/date/tests/DateTime_extends_basic1.phpt
+++ b/ext/date/tests/DateTime_extends_basic1.phpt
@@ -11,12 +11,12 @@ echo "*** Testing basic DateTime inheritance() ***\n";
class DateTimeExt extends DateTime
{
- public static $format = "F j, Y, g:i:s a";
+ public static $format = "F j, Y, g:i:s a";
- public function __toString()
- {
- return parent::format(self::$format);
- }
+ public function __toString()
+ {
+ return parent::format(self::$format);
+ }
}
echo "\n-- Create an instance of DateTimeExt --\n";
@@ -33,7 +33,6 @@ echo "\n-- Invoke __toString again --\n";
echo $d . "\n";
?>
-===DONE===
--EXPECT--
*** Testing basic DateTime inheritance() ***
@@ -46,4 +45,3 @@ May 1, 1967, 10:30:41 pm
-- Invoke __toString again --
July 2, 1963, 10:45:30 am
-===DONE===
diff --git a/ext/date/tests/DateTime_extends_basic2.phpt b/ext/date/tests/DateTime_extends_basic2.phpt
index 364fd55514..03d1e03283 100644
--- a/ext/date/tests/DateTime_extends_basic2.phpt
+++ b/ext/date/tests/DateTime_extends_basic2.phpt
@@ -10,7 +10,7 @@ echo "*** Testing new DateTime() : with user space __construct magic method ***\
class DateTimeExt extends DateTime
{
- public function __construct ($date = null, DateTimeZone $dtz = null)
+ public function __construct ($date = null, DateTimeZone $dtz = null)
{
if($dtz === null)
{
@@ -24,8 +24,6 @@ $d = new DateTimeExt("1967-05-01 22:30:41");
echo $d->format("F j, Y, g:i:s a") . "\n";
?>
-===DONE===
--EXPECT--
*** Testing new DateTime() : with user space __construct magic method ***
May 1, 1967, 10:30:41 pm
-===DONE===
diff --git a/ext/date/tests/DateTime_extends_basic3.phpt b/ext/date/tests/DateTime_extends_basic3.phpt
index cc44d72640..27fc602e00 100644
--- a/ext/date/tests/DateTime_extends_basic3.phpt
+++ b/ext/date/tests/DateTime_extends_basic3.phpt
@@ -1,5 +1,5 @@
--TEST--
-Test DateTime class inheritance : with user space fromat() method
+Test DateTime class inheritance : with user space format() method
--FILE--
<?php
//Set the default time zone
@@ -9,18 +9,16 @@ echo "*** Testing new DateTime() : with user format() method ***\n";
class DateTimeExt extends DateTime
{
- public function format($format = "F j, Y, g:i:s a")
- {
- return parent::format($format);
- }
+ public function format($format = "F j, Y, g:i:s a")
+ {
+ return parent::format($format);
+ }
}
$d = new DateTimeExt("1967-05-01 22:30:41");
echo $d->format() . "\n";
?>
-===DONE===
--EXPECT--
*** Testing new DateTime() : with user format() method ***
May 1, 1967, 10:30:41 pm
-===DONE===
diff --git a/ext/date/tests/DateTime_fix_createFromFormat.phpt b/ext/date/tests/DateTime_fix_createFromFormat.phpt
index dff0a0338c..ec1ca81c2a 100644
--- a/ext/date/tests/DateTime_fix_createFromFormat.phpt
+++ b/ext/date/tests/DateTime_fix_createFromFormat.phpt
@@ -21,9 +21,7 @@ echo "Format method: " . $orig->format("D., M. j, Y g:iA") . "\n";
echo "createFromFormat method: " . $fromFormat->format("D., M. j, Y g:iA") . "\n";
?>
-===DONE===
--EXPECT--
*** Testing clone on DateTime objects ***
Format method: Thu., Nov. 29, 2012 5:00PM
createFromFormat method: Thu., Nov. 29, 2012 5:00PM
-===DONE===
diff --git a/ext/date/tests/DateTime_format_basic1.phpt b/ext/date/tests/DateTime_format_basic1.phpt
index 883f9a7a8e..a7bbd29913 100644
--- a/ext/date/tests/DateTime_format_basic1.phpt
+++ b/ext/date/tests/DateTime_format_basic1.phpt
@@ -25,7 +25,6 @@ var_dump( $date->format( 'H:m:s \m \i\s\ \m\o\n\t\h') );
var_dump( $date->format( "H:i:s") );
?>
-===DONE===
--EXPECT--
*** Testing DateTime::format() : basic functionality ***
string(23) "July 14, 2005, 10:30 pm"
@@ -37,4 +36,3 @@ string(19) "it is the 14th day."
string(28) "Thu Jul 14 22:30:41 BST 2005"
string(19) "22:07:41 m is month"
string(8) "22:30:41"
-===DONE===
diff --git a/ext/date/tests/DateTime_format_basic2.phpt b/ext/date/tests/DateTime_format_basic2.phpt
index 958b702ea4..fa5c1a24be 100644
--- a/ext/date/tests/DateTime_format_basic2.phpt
+++ b/ext/date/tests/DateTime_format_basic2.phpt
@@ -27,7 +27,6 @@ var_dump( $date->format( DateTime::RSS) ) ;
var_dump( $date->format( DateTime::W3C) ) ;
?>
-===DONE===
--EXPECT--
*** Testing date_format() : basic functionality - formatting coinstants ***
string(25) "2005-07-14T22:30:41+01:00"
@@ -41,4 +40,3 @@ string(31) "Thu, 14 Jul 2005 22:30:41 +0100"
string(25) "2005-07-14T22:30:41+01:00"
string(31) "Thu, 14 Jul 2005 22:30:41 +0100"
string(25) "2005-07-14T22:30:41+01:00"
-===DONE===
diff --git a/ext/date/tests/DateTime_getOffset_basic1.phpt b/ext/date/tests/DateTime_getOffset_basic1.phpt
index 9a2d22f4a1..f6c7d8c8aa 100644
--- a/ext/date/tests/DateTime_getOffset_basic1.phpt
+++ b/ext/date/tests/DateTime_getOffset_basic1.phpt
@@ -20,9 +20,7 @@ echo "Winter offset: " . $winter->getOffset() / 3600 . " hours\n";
echo "Summer offset: " . $summer->getOffset() / 3600 . " hours\n";
?>
-===DONE===
--EXPECT--
*** Testing DateTime::getOffset() : basic functionality ***
Winter offset: 0 hours
Summer offset: 1 hours
-===DONE===
diff --git a/ext/date/tests/DateTime_getTimeZone_basic1.phpt b/ext/date/tests/DateTime_getTimeZone_basic1.phpt
index 3c2f76c640..d29812ad1c 100644
--- a/ext/date/tests/DateTime_getTimeZone_basic1.phpt
+++ b/ext/date/tests/DateTime_getTimeZone_basic1.phpt
@@ -24,10 +24,8 @@ $object->setTimeZone($la_time);
var_dump( $object->getTimeZone()->getName() );
?>
-===DONE===
--EXPECT--
*** Testing DateTime::getTimezone() : basic functionality ***
string(13) "Europe/London"
string(16) "America/New_York"
string(19) "America/Los_Angeles"
-===DONE===
diff --git a/ext/date/tests/DateTime_modify_basic1.phpt b/ext/date/tests/DateTime_modify_basic1.phpt
index 5b0d5bd2a1..3147ca63cc 100644
--- a/ext/date/tests/DateTime_modify_basic1.phpt
+++ b/ext/date/tests/DateTime_modify_basic1.phpt
@@ -29,11 +29,9 @@ $datetime->modify("last Sunday");
echo "After modification 4: " . $datetime->format("D, d M Y") . "\n";
?>
-===DONE===
--EXPECT--
*** Testing DateTime::modify() : basic functionality ***
After modification 1: Sun, 01 Feb 2009
After modification 2: Tue, 10 Feb 2009 18:28:43
After modification 3: Thu, 12 Feb 2009
After modification 4: Sun, 08 Feb 2009
-===DONE===
diff --git a/ext/date/tests/DateTime_serialize.phpt b/ext/date/tests/DateTime_serialize.phpt
index 48b8b01cf9..8424a3e082 100644
--- a/ext/date/tests/DateTime_serialize.phpt
+++ b/ext/date/tests/DateTime_serialize.phpt
@@ -16,7 +16,6 @@ var_dump($date2);
var_dump( $date2->format( "F j, Y, g:i a") );
?>
-===DONE===
--EXPECTF--
object(DateTime)#%d (3) {
["date"]=>
@@ -36,4 +35,3 @@ object(DateTime)#%d (3) {
string(13) "Europe/London"
}
string(23) "July 14, 2005, 10:30 pm"
-===DONE===
diff --git a/ext/date/tests/DateTime_setDate_basic1.phpt b/ext/date/tests/DateTime_setDate_basic1.phpt
index e3c9c587ac..d8fe4989e7 100644
--- a/ext/date/tests/DateTime_setDate_basic1.phpt
+++ b/ext/date/tests/DateTime_setDate_basic1.phpt
@@ -22,9 +22,7 @@ $datetime->setDate(2008, 02, 01);
echo $datetime->format(DATE_RFC2822) . "\n";
?>
-===DONE===
--EXPECT--
*** Testing DateTime::setDate() : basic functionality ***
Fri, 30 Jan 2009 19:34:10 +0000
Fri, 01 Feb 2008 19:34:10 +0000
-===DONE===
diff --git a/ext/date/tests/DateTime_setISODate_basic1.phpt b/ext/date/tests/DateTime_setISODate_basic1.phpt
index bcb7f30694..d4319bc60f 100644
--- a/ext/date/tests/DateTime_setISODate_basic1.phpt
+++ b/ext/date/tests/DateTime_setISODate_basic1.phpt
@@ -29,10 +29,8 @@ $datetime->setISODate(2008, 30, 3);
echo "..same day last year was \"" . $datetime->format("D M j") . "\"\n";
?>
-===DONE===
--EXPECT--
*** Testing DateTime::setISODate() : basic functionality ***
Week 40 of 2009 is in "September"
Week 30 day 3 of 2009 is "Wed Jul 22"
..same day last year was "Wed Jul 23"
-===DONE===
diff --git a/ext/date/tests/DateTime_setTime_basic1.phpt b/ext/date/tests/DateTime_setTime_basic1.phpt
index e5505a0501..fff22c5e1a 100644
--- a/ext/date/tests/DateTime_setTime_basic1.phpt
+++ b/ext/date/tests/DateTime_setTime_basic1.phpt
@@ -34,7 +34,6 @@ $datetime->setTime(54, 25);
echo "After modification5 " . $datetime ->format(DATE_RFC2822) . "\n";
?>
-===DONE===
--EXPECT--
*** Testing DateTime::setTime() : basic functionality ***
Initial date: Sat, 31 Jan 2009 15:14:10 +0000
@@ -43,4 +42,3 @@ After modification2 Sat, 31 Jan 2009 19:05:59 +0000
After modification3 Sun, 01 Feb 2009 00:10:00 +0000
After modification4 Mon, 02 Feb 2009 23:35:47 +0000
After modification5 Wed, 04 Feb 2009 06:25:00 +0000
-===DONE===
diff --git a/ext/date/tests/DateTime_setTimezone_basic1.phpt b/ext/date/tests/DateTime_setTimezone_basic1.phpt
index 90e799e20c..88da0ef33a 100644
--- a/ext/date/tests/DateTime_setTimezone_basic1.phpt
+++ b/ext/date/tests/DateTime_setTimezone_basic1.phpt
@@ -21,9 +21,7 @@ $datetime->setTimezone($la_time);
echo "New timezone: " . date_timezone_get($datetime)->getName() . "\n";
?>
-===DONE===
--EXPECT--
*** Testing DateTime::setTimezone() : basic functionality ***
Default timezone: Europe/London
New timezone: America/Los_Angeles
-===DONE===
diff --git a/ext/date/tests/ExtendDateTime.phpt b/ext/date/tests/ExtendDateTime.phpt
index 164221709c..212d44ab82 100644
--- a/ext/date/tests/ExtendDateTime.phpt
+++ b/ext/date/tests/ExtendDateTime.phpt
@@ -9,4 +9,4 @@ class MyDateTime extends DateTime {
}
?>
--EXPECTF--
-Warning: Declaration of MyDateTime::__set_state() should be compatible with DateTime::__set_state(array $array) in %s on line %d
+Fatal error: Declaration of MyDateTime::__set_state() must be compatible with DateTime::__set_state(array $array) in %s on line %d
diff --git a/ext/date/tests/bug13142.phpt b/ext/date/tests/bug13142.phpt
index 5550d5ce9c..80d4fa82fc 100644
--- a/ext/date/tests/bug13142.phpt
+++ b/ext/date/tests/bug13142.phpt
@@ -15,7 +15,7 @@ if (!@putenv("TZ=US/Eastern") || getenv("TZ") != 'US/Eastern') {
<?php
if (date('T') == 'GMT') {
- putenv("TZ=EST5EDT4,M4.1.0,M10.5.0");
+ putenv("TZ=EST5EDT4,M4.1.0,M10.5.0");
}
echo date("r\n", strtotime("Sep 04 16:39:45 2001"));
echo date("r\n", strtotime("Sep 04 2001 16:39:45"));
diff --git a/ext/date/tests/bug20382-1.phpt b/ext/date/tests/bug20382-1.phpt
index 162852115b..8c0583767a 100644
--- a/ext/date/tests/bug20382-1.phpt
+++ b/ext/date/tests/bug20382-1.phpt
@@ -4,12 +4,12 @@ Bug #20382 [1] (strtotime ("Monday", $date) produces wrong result on DST changeo
date.timezone=Europe/Amsterdam
--FILE--
<?php
- $tStamp = mktime (17, 17, 17, 10, 27, 2004);
- echo "tStamp=". date("l Y-m-d H:i:s T", $tStamp). "\n";
+ $tStamp = mktime (17, 17, 17, 10, 27, 2004);
+ echo "tStamp=". date("l Y-m-d H:i:s T", $tStamp). "\n";
- $strtotime_timestamp = strtotime ("Monday", $tStamp);
- echo "result=". date("l Y-m-d H:i:s T", $strtotime_timestamp). "\n";
- echo "wanted=Monday 2004-11-01 00:00:00 CET\n";
+ $strtotime_timestamp = strtotime ("Monday", $tStamp);
+ echo "result=". date("l Y-m-d H:i:s T", $strtotime_timestamp). "\n";
+ echo "wanted=Monday 2004-11-01 00:00:00 CET\n";
?>
--EXPECT--
tStamp=Wednesday 2004-10-27 17:17:17 CEST
diff --git a/ext/date/tests/bug20382-2.phpt b/ext/date/tests/bug20382-2.phpt
index 2488c4729e..d963708ce3 100644
--- a/ext/date/tests/bug20382-2.phpt
+++ b/ext/date/tests/bug20382-2.phpt
@@ -4,43 +4,43 @@ Bug #20382 [2] (strtotime ("Monday", $date) produces wrong result on DST changeo
<?php
$tests = array(
- array("Europe/Andorra", 17, 17, 17, 1, 24764, 1970),
- array("Asia/Dubai", 17, 17, 17, 1, 1, 1970),
- array("Asia/Kabul", 17, 17, 17, 1, 1, 1970),
- array("America/Antigua", 17, 17, 17, 1, 1, 1970),
- array("America/Anguilla", 17, 17, 17, 1, 1, 1970),
- array("Europe/Tirane", 17, 17, 17, 1, 4849, 1970),
- array("Asia/Yerevan", 17, 17, 17, 1, 24764, 1970),
- array("America/Curacao", 17, 17, 17, 1, 1, 1970),
- array("Africa/Luanda", 17, 17, 17, 1, 1, 1970),
- array("Antarctica/McMurdo", 17, 17, 17, 1, 24743, 1970),
- array("Australia/Adelaide", 17, 17, 17, 1, 1, 1971),
- array("Australia/Darwin", 17, 17, 17, 1, 88, 1971),
- array("Australia/Perth", 17, 17, 17, 1, 1, 1971),
- array("America/Aruba", 17, 17, 17, 1, 88, 1971),
- array("Asia/Baku", 17, 17, 17, 1, 1, 1971),
- array("Europe/Sarajevo", 17, 17, 17, 1, 1, 1971),
- array("America/Barbados", 17, 17, 17, 1, 1, 1971),
- array("Asia/Dacca", 17, 17, 17, 1, 1, 1971),
- array("Europe/Brussels", 17, 17, 17, 1, 1, 1971),
- array("Africa/Ouagadougou", 17, 17, 17, 1, 88, 1971),
- array("Europe/Tirane", 17, 17, 17, 1, 4849, 1970),
- array("America/Buenos_Aires", 17, 17, 17, 1, 1734, 1970),
- array("America/Rosario", 17, 17, 17, 1, 1734, 1970),
- array("Europe/Vienna", 17, 17, 17, 1, 3743, 1970),
- array("Asia/Baku", 17, 17, 17, 1, 9490, 1970),
+ array("Europe/Andorra", 17, 17, 17, 1, 24764, 1970),
+ array("Asia/Dubai", 17, 17, 17, 1, 1, 1970),
+ array("Asia/Kabul", 17, 17, 17, 1, 1, 1970),
+ array("America/Antigua", 17, 17, 17, 1, 1, 1970),
+ array("America/Anguilla", 17, 17, 17, 1, 1, 1970),
+ array("Europe/Tirane", 17, 17, 17, 1, 4849, 1970),
+ array("Asia/Yerevan", 17, 17, 17, 1, 24764, 1970),
+ array("America/Curacao", 17, 17, 17, 1, 1, 1970),
+ array("Africa/Luanda", 17, 17, 17, 1, 1, 1970),
+ array("Antarctica/McMurdo", 17, 17, 17, 1, 24743, 1970),
+ array("Australia/Adelaide", 17, 17, 17, 1, 1, 1971),
+ array("Australia/Darwin", 17, 17, 17, 1, 88, 1971),
+ array("Australia/Perth", 17, 17, 17, 1, 1, 1971),
+ array("America/Aruba", 17, 17, 17, 1, 88, 1971),
+ array("Asia/Baku", 17, 17, 17, 1, 1, 1971),
+ array("Europe/Sarajevo", 17, 17, 17, 1, 1, 1971),
+ array("America/Barbados", 17, 17, 17, 1, 1, 1971),
+ array("Asia/Dacca", 17, 17, 17, 1, 1, 1971),
+ array("Europe/Brussels", 17, 17, 17, 1, 1, 1971),
+ array("Africa/Ouagadougou", 17, 17, 17, 1, 88, 1971),
+ array("Europe/Tirane", 17, 17, 17, 1, 4849, 1970),
+ array("America/Buenos_Aires", 17, 17, 17, 1, 1734, 1970),
+ array("America/Rosario", 17, 17, 17, 1, 1734, 1970),
+ array("Europe/Vienna", 17, 17, 17, 1, 3743, 1970),
+ array("Asia/Baku", 17, 17, 17, 1, 9490, 1970),
);
foreach ($tests as $test) {
- date_default_timezone_set($test[0]);
- print "{$test[0]}\n";
- array_shift($test);
- $timestamp = call_user_func_array('mktime', $test);
-
- print "ts = ". date("l Y-m-d H:i:s T", $timestamp). "\n";
- $strtotime_tstamp = strtotime("first monday", $timestamp);
- print "result = ".date("l Y-m-d H:i:s T", $strtotime_tstamp)."\n";
- print "wanted = Monday 00:00:00\n\n";
+ date_default_timezone_set($test[0]);
+ print "{$test[0]}\n";
+ array_shift($test);
+ $timestamp = call_user_func_array('mktime', $test);
+
+ print "ts = ". date("l Y-m-d H:i:s T", $timestamp). "\n";
+ $strtotime_tstamp = strtotime("first monday", $timestamp);
+ print "result = ".date("l Y-m-d H:i:s T", $strtotime_tstamp)."\n";
+ print "wanted = Monday 00:00:00\n\n";
}
?>
--EXPECTF--
diff --git a/ext/date/tests/bug21399.phpt b/ext/date/tests/bug21399.phpt
index a295c8bd8b..c7ad8caf4a 100644
--- a/ext/date/tests/bug21399.phpt
+++ b/ext/date/tests/bug21399.phpt
@@ -4,7 +4,7 @@ Bug #21399 (strtotime() request for "YYYYMMDDhhmmss [ZZZ]")
date.timezone=GMT
--FILE--
<?php
- echo gmdate("Y-m-d H:i:s", strtotime("20050620091407 GMT"));
+ echo gmdate("Y-m-d H:i:s", strtotime("20050620091407 GMT"));
?>
--EXPECT--
2005-06-20 09:14:07
diff --git a/ext/date/tests/bug26198.phpt b/ext/date/tests/bug26198.phpt
index c957bfcf7a..f59a628b62 100644
--- a/ext/date/tests/bug26198.phpt
+++ b/ext/date/tests/bug26198.phpt
@@ -2,9 +2,9 @@
Bug #26198 (strtotime handling of "M Y" and "Y M" format)
--FILE--
<?php
- date_default_timezone_set("GMT");
- echo gmdate("F Y (Y-m-d H:i:s T)\n", strtotime("Oct 2001"));
- echo gmdate("M Y (Y-m-d H:i:s T)\n", strtotime("2001 Oct"));
+ date_default_timezone_set("GMT");
+ echo gmdate("F Y (Y-m-d H:i:s T)\n", strtotime("Oct 2001"));
+ echo gmdate("M Y (Y-m-d H:i:s T)\n", strtotime("2001 Oct"));
?>
--EXPECT--
October 2001 (2001-10-01 00:00:00 GMT)
diff --git a/ext/date/tests/bug26317.phpt b/ext/date/tests/bug26317.phpt
index 652cc67879..38c724ed57 100644
--- a/ext/date/tests/bug26317.phpt
+++ b/ext/date/tests/bug26317.phpt
@@ -10,9 +10,9 @@ if (!@putenv("TZ=GMT0") || getenv("TZ") != 'GMT0') {
?>
--FILE--
<?php
- echo date("Y-m-d H:i:s\n", strtotime("2003-11-19 16:20:42 Z"));
- echo date("Y-m-d H:i:s\n", strtotime("2003-11-19 09:20:42 T"));
- echo date("Y-m-d H:i:s\n", strtotime("2003-11-19 19:20:42 C"));
+ echo date("Y-m-d H:i:s\n", strtotime("2003-11-19 16:20:42 Z"));
+ echo date("Y-m-d H:i:s\n", strtotime("2003-11-19 09:20:42 T"));
+ echo date("Y-m-d H:i:s\n", strtotime("2003-11-19 19:20:42 C"));
?>
--EXPECT--
2003-11-19 16:20:42
diff --git a/ext/date/tests/bug26320.phpt b/ext/date/tests/bug26320.phpt
index 48e901117c..563e39ab30 100644
--- a/ext/date/tests/bug26320.phpt
+++ b/ext/date/tests/bug26320.phpt
@@ -10,8 +10,8 @@ if (!@putenv("TZ=GMT0") || getenv("TZ") != 'GMT0') {
?>
--FILE--
<?php
- echo date("Y-m-d H:i:s\n", strtotime("2003-11-19T12:30:42"));
- echo date("Y-m-d H:i:s\n", strtotime("2003-11-19T12:30:42Z"));
+ echo date("Y-m-d H:i:s\n", strtotime("2003-11-19T12:30:42"));
+ echo date("Y-m-d H:i:s\n", strtotime("2003-11-19T12:30:42Z"));
?>
--EXPECT--
2003-11-19 12:30:42
diff --git a/ext/date/tests/bug26694.phpt b/ext/date/tests/bug26694.phpt
index 939b04c136..a82496124f 100644
--- a/ext/date/tests/bug26694.phpt
+++ b/ext/date/tests/bug26694.phpt
@@ -4,7 +4,7 @@ Bug #26694 (strtotime() request for "Sun, 21 Dec 2003 20:38:33 +0000 GMT")
date.timezone=GMT
--FILE--
<?php
- echo gmdate("Y-m-d H:i:s", strtotime("Sun, 21 Dec 2003 20:38:33 +0000 GMT"));
+ echo gmdate("Y-m-d H:i:s", strtotime("Sun, 21 Dec 2003 20:38:33 +0000 GMT"));
?>
--EXPECT--
2003-12-21 20:38:33
diff --git a/ext/date/tests/bug27780.phpt b/ext/date/tests/bug27780.phpt
index b1cfa831a2..f6f21e4185 100644
--- a/ext/date/tests/bug27780.phpt
+++ b/ext/date/tests/bug27780.phpt
@@ -8,37 +8,37 @@ if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
--FILE--
<?php
$timezones = array (
- "America/Chicago", "Europe/Amsterdam", "Asia/Jerusalem",
- "Asia/Singapore", "America/Sao_Paulo"
+ "America/Chicago", "Europe/Amsterdam", "Asia/Jerusalem",
+ "Asia/Singapore", "America/Sao_Paulo"
);
$timestrings = array (
- "2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +59 seconds",
- "2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +60 seconds",
- "2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +61 seconds",
- "2004-04-07 00:00:00 -21 days",
- "2004-04-07 00:00:00 11 days ago",
- "2004-04-07 00:00:00 -10 day +2 hours",
- "2004-04-07 00:00:00 -1 day",
- "2004-04-07 00:00:00",
- "2004-04-07 00:00:00 +1 hour",
- "2004-04-07 00:00:00 +2 hour",
- "2004-04-07 00:00:00 +1 day",
- "2004-04-07 00:00:00 1 day",
- "2004-04-07 00:00:00 +21 days",
+ "2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +59 seconds",
+ "2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +60 seconds",
+ "2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +61 seconds",
+ "2004-04-07 00:00:00 -21 days",
+ "2004-04-07 00:00:00 11 days ago",
+ "2004-04-07 00:00:00 -10 day +2 hours",
+ "2004-04-07 00:00:00 -1 day",
+ "2004-04-07 00:00:00",
+ "2004-04-07 00:00:00 +1 hour",
+ "2004-04-07 00:00:00 +2 hour",
+ "2004-04-07 00:00:00 +1 day",
+ "2004-04-07 00:00:00 1 day",
+ "2004-04-07 00:00:00 +21 days",
);
foreach ($timezones as $timezone) {
- date_default_timezone_set($timezone);
- echo $timezone, "\n";
+ date_default_timezone_set($timezone);
+ echo $timezone, "\n";
- foreach ($timestrings as $timestring) {
- $time = strtotime($timestring);
+ foreach ($timestrings as $timestring) {
+ $time = strtotime($timestring);
- echo $time, strftime(" [%Y-%m-%d %H:%M:%S %Z]", $time), " [$timestring]\n";
- }
+ echo $time, strftime(" [%Y-%m-%d %H:%M:%S %Z]", $time), " [$timestring]\n";
+ }
- echo "\n";
+ echo "\n";
}
?>
--EXPECTF--
diff --git a/ext/date/tests/bug28024.phpt b/ext/date/tests/bug28024.phpt
index b5f97bd5c9..8229f1cd7b 100644
--- a/ext/date/tests/bug28024.phpt
+++ b/ext/date/tests/bug28024.phpt
@@ -4,8 +4,8 @@ Bug #28024 (Changed behavior of strtotime())
date.timezone=Europe/Berlin
--FILE--
<?php
- echo strtotime("17:00 2004-01-01"), "\n";
- echo date("Y-m-d H:i:s T", strtotime("17:00 2004-01-01"));
+ echo strtotime("17:00 2004-01-01"), "\n";
+ echo date("Y-m-d H:i:s T", strtotime("17:00 2004-01-01"));
?>
--EXPECT--
1072972800
diff --git a/ext/date/tests/bug29150.phpt b/ext/date/tests/bug29150.phpt
index d91d68d919..15edffa898 100644
--- a/ext/date/tests/bug29150.phpt
+++ b/ext/date/tests/bug29150.phpt
@@ -4,7 +4,7 @@ Bug #29150 (Roman number format for months)
date.timezone=GMT
--FILE--
<?php
- echo gmdate("Y-m-d H:i:s", strtotime("20 VI. 2005"));
+ echo gmdate("Y-m-d H:i:s", strtotime("20 VI. 2005"));
?>
--EXPECT--
2005-06-20 00:00:00
diff --git a/ext/date/tests/bug30096.phpt b/ext/date/tests/bug30096.phpt
index 9ca45c4ffe..5d40aa3d34 100644
--- a/ext/date/tests/bug30096.phpt
+++ b/ext/date/tests/bug30096.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #30096 (gmmktime does not return the corrent time)
+Bug #30096 (gmmktime does not return the correct time)
--INI--
error_reporting=2047
--FILE--
@@ -19,18 +19,18 @@ gm_date_check(03,00,00,10,30,2005);
gm_date_check(04,00,00,10,30,2005);
function gm_date_check($hour, $minute, $second, $month, $day, $year) {
- global $ts, $tsold;
+ global $ts, $tsold;
- echo "gmmktime($hour,$minute,$second,$month,$day,$year): ";
+ echo "gmmktime($hour,$minute,$second,$month,$day,$year): ";
- $tsold = $ts;
- $ts = gmmktime($hour, $minute, $second, $month, $day, $year);
+ $tsold = $ts;
+ $ts = gmmktime($hour, $minute, $second, $month, $day, $year);
- echo $ts, " | gmdate('r', $ts):", gmdate('r', $ts);
- if ($tsold > 0) {
- echo " | Diff: " . ($ts - $tsold);
- }
- echo "\n";
+ echo $ts, " | gmdate('r', $ts):", gmdate('r', $ts);
+ if ($tsold > 0) {
+ echo " | Diff: " . ($ts - $tsold);
+ }
+ echo "\n";
}
?>
diff --git a/ext/date/tests/bug33578.phpt b/ext/date/tests/bug33578.phpt
index 4ba6df8597..6c0d4d3bd7 100644
--- a/ext/date/tests/bug33578.phpt
+++ b/ext/date/tests/bug33578.phpt
@@ -2,14 +2,14 @@
Bug #33578 (strtotime() doesn't parse "11 Oct" format")
--FILE--
<?php
- date_default_timezone_set("UTC");
- echo date('m/d/Y', strtotime('Oct 11')), "\n";
- echo date('m/d/Y', strtotime('11 Oct')), "\n";
- echo date('m/d/Y', strtotime('11 Oct 2005')), "\n";
- echo date('m/d/Y', strtotime('Oct11')), "\n";
- echo date('m/d/Y', strtotime('11Oct')), "\n";
- echo date('m/d/Y', strtotime('11Oct 2005')), "\n";
- echo date('m/d/Y', strtotime('11Oct2005')), "\n";
+ date_default_timezone_set("UTC");
+ echo date('m/d/Y', strtotime('Oct 11')), "\n";
+ echo date('m/d/Y', strtotime('11 Oct')), "\n";
+ echo date('m/d/Y', strtotime('11 Oct 2005')), "\n";
+ echo date('m/d/Y', strtotime('Oct11')), "\n";
+ echo date('m/d/Y', strtotime('11Oct')), "\n";
+ echo date('m/d/Y', strtotime('11Oct 2005')), "\n";
+ echo date('m/d/Y', strtotime('11Oct2005')), "\n";
?>
--EXPECTF--
10/11/%d
diff --git a/ext/date/tests/bug33869.phpt b/ext/date/tests/bug33869.phpt
index 6957a6b7e2..8f8e957c95 100644
--- a/ext/date/tests/bug33869.phpt
+++ b/ext/date/tests/bug33869.phpt
@@ -2,20 +2,20 @@
Bug #33869 (strtotime() doesn't parse "+1days" format)
--FILE--
<?php
- date_default_timezone_set("UTC");
- $tm = strtotime("2005-01-01 01:01:01");
- echo date(DATE_ISO8601, strtotime('+5days', $tm));
- echo "\n";
- echo date(DATE_ISO8601, strtotime('+1month', $tm));
- echo "\n";
- echo date(DATE_ISO8601, strtotime('+1year', $tm));
- echo "\n";
- echo date(DATE_ISO8601, strtotime('+5 days', $tm));
- echo "\n";
- echo date(DATE_ISO8601, strtotime('+1 month', $tm));
- echo "\n";
- echo date(DATE_ISO8601, strtotime('+1 year', $tm));
- echo "\n";
+ date_default_timezone_set("UTC");
+ $tm = strtotime("2005-01-01 01:01:01");
+ echo date(DATE_ISO8601, strtotime('+5days', $tm));
+ echo "\n";
+ echo date(DATE_ISO8601, strtotime('+1month', $tm));
+ echo "\n";
+ echo date(DATE_ISO8601, strtotime('+1year', $tm));
+ echo "\n";
+ echo date(DATE_ISO8601, strtotime('+5 days', $tm));
+ echo "\n";
+ echo date(DATE_ISO8601, strtotime('+1 month', $tm));
+ echo "\n";
+ echo date(DATE_ISO8601, strtotime('+1 year', $tm));
+ echo "\n";
?>
--EXPECT--
2005-01-06T01:01:01+0000
diff --git a/ext/date/tests/bug33957.phpt b/ext/date/tests/bug33957.phpt
index 43f14ee315..6ae97d7de8 100644
--- a/ext/date/tests/bug33957.phpt
+++ b/ext/date/tests/bug33957.phpt
@@ -5,33 +5,33 @@ Bug #33957 (gmdate('W')/date('W') sometimes returns wrong week number)
date_default_timezone_set("UTC");
for ($i = 14; $i <= 31; $i++) {
- echo "1992-12-$i ", date("W", strtotime("1992-12-$i")), "\n";
+ echo "1992-12-$i ", date("W", strtotime("1992-12-$i")), "\n";
}
for ($i = 1; $i <= 8; $i++) {
- echo "1993-01-$i ", date("W", strtotime("1993-01-$i")), "\n";
+ echo "1993-01-$i ", date("W", strtotime("1993-01-$i")), "\n";
}
echo "----\n";
echo " ";
foreach (range(1992, 2019) as $year) {
- echo "$year ";
+ echo "$year ";
}
echo "\n";
for ($i = 14; $i <= 31; $i++) {
- echo " (12-$i) ";
- foreach (range(1992, 2019) as $year) {
- echo sprintf(" %02d-", date("W", strtotime("$year-12-$i")));
- echo sprintf("%04d ", date("o", strtotime("$year-12-$i")));
- }
- echo "\n";
+ echo " (12-$i) ";
+ foreach (range(1992, 2019) as $year) {
+ echo sprintf(" %02d-", date("W", strtotime("$year-12-$i")));
+ echo sprintf("%04d ", date("o", strtotime("$year-12-$i")));
+ }
+ echo "\n";
}
for ($i = 1; $i <= 18; $i++) {
- printf("+1 (01-%02d) ", $i);
- foreach (range(1993, 2020) as $year) {
- echo sprintf(" %02d-", date("W", strtotime("$year-1-$i")));
- echo sprintf("%04d ", date("o", strtotime("$year-1-$i")));
- }
- echo "\n";
+ printf("+1 (01-%02d) ", $i);
+ foreach (range(1993, 2020) as $year) {
+ echo sprintf(" %02d-", date("W", strtotime("$year-1-$i")));
+ echo sprintf("%04d ", date("o", strtotime("$year-1-$i")));
+ }
+ echo "\n";
}
echo "----\n";
?>
diff --git a/ext/date/tests/bug34676.phpt b/ext/date/tests/bug34676.phpt
index 6f616feb40..ec2fcf9270 100644
--- a/ext/date/tests/bug34676.phpt
+++ b/ext/date/tests/bug34676.phpt
@@ -5,12 +5,12 @@ Bug #34676 (missing support for strtotime("midnight") and strtotime("noon"))
date_default_timezone_set("UTC");
$tests = array(
- 'noon', 'midnight'
+ 'noon', 'midnight'
);
foreach ($tests as $test) {
- $t = strtotime("2005-12-22 ". $test);
- printf("%-10s => %s\n", $test, date(DATE_ISO8601, $t));
+ $t = strtotime("2005-12-22 ". $test);
+ printf("%-10s => %s\n", $test, date(DATE_ISO8601, $t));
}
?>
diff --git a/ext/date/tests/bug34771.phpt b/ext/date/tests/bug34771.phpt
index a27d085a1d..d3134d1d6b 100644
--- a/ext/date/tests/bug34771.phpt
+++ b/ext/date/tests/bug34771.phpt
@@ -5,15 +5,15 @@ Bug #34771 (strtotime() fails with 1-12am/pm)
date_default_timezone_set("UTC");
$tests = array(
- '12am', '1am', '1pm',
- '12a.m.', '1a.m.', '1p.m.',
- '12:00am', '1:00am', '1:00pm',
- '12:00a.m.', '1:00a.m.', '1:00p.m.'
+ '12am', '1am', '1pm',
+ '12a.m.', '1a.m.', '1p.m.',
+ '12:00am', '1:00am', '1:00pm',
+ '12:00a.m.', '1:00a.m.', '1:00p.m.'
);
foreach ($tests as $test) {
- $t = strtotime("2005-12-22 ". $test);
- printf("%-10s => %s\n", $test, date(DATE_ISO8601, $t));
+ $t = strtotime("2005-12-22 ". $test);
+ printf("%-10s => %s\n", $test, date(DATE_ISO8601, $t));
}
?>
diff --git a/ext/date/tests/bug35425.phpt b/ext/date/tests/bug35425.phpt
index e55a4f5219..ed9f87fd58 100644
--- a/ext/date/tests/bug35425.phpt
+++ b/ext/date/tests/bug35425.phpt
@@ -7,7 +7,7 @@ date.timezone=America/Montreal
$time = mktime(1,1,1,1,1,2005);
foreach (array('B','d','h','H','i','I','L','m','s','t','U','w','W','y','Y','z','Z') as $v) {
- var_dump(idate($v, $time));
+ var_dump(idate($v, $time));
}
?>
diff --git a/ext/date/tests/bug35624.phpt b/ext/date/tests/bug35624.phpt
index 722adba823..39fe555224 100644
--- a/ext/date/tests/bug35624.phpt
+++ b/ext/date/tests/bug35624.phpt
@@ -7,9 +7,9 @@ date_default_timezone_set("UTC");
$days = array("monday","mon","tuesday","tue","wednesday","wed","thursday","thu","friday","fri","saturday","sat","sunday","sun");
foreach ($days as $day) {
- echo date("D", strtotime($day));
- echo date("D", strtotime(ucfirst($day)));
- echo "\n";
+ echo date("D", strtotime($day));
+ echo date("D", strtotime(ucfirst($day)));
+ echo "\n";
}
?>
--EXPECT--
diff --git a/ext/date/tests/bug35885.phpt b/ext/date/tests/bug35885.phpt
index b3074f7f34..974c2c2c85 100644
--- a/ext/date/tests/bug35885.phpt
+++ b/ext/date/tests/bug35885.phpt
@@ -12,8 +12,8 @@ $res = ($ts == $ts2);
var_dump($res);
if (!$res) {
- var_dump($ts);
- var_dump($ts2);
+ var_dump($ts);
+ var_dump($ts2);
}
?>
diff --git a/ext/date/tests/bug36988.phpt b/ext/date/tests/bug36988.phpt
index ab0f3a3c8a..691bb4a7e2 100644
--- a/ext/date/tests/bug36988.phpt
+++ b/ext/date/tests/bug36988.phpt
@@ -6,7 +6,11 @@ Bug #36988 (mktime freezes on long numbers)
<?php
date_default_timezone_set('GMT');
$start = microtime(true);
-$a = mktime(1, 1, 1, 1, 1, 11111111111);
+try {
+ $a = mktime(1, 1, 1, 1, 1, 11111111111);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Warning: mktime() expects parameter 6 to be int, float given in %s on line %d
+--EXPECT--
+mktime() expects parameter 6 to be int, float given
diff --git a/ext/date/tests/bug37747.phpt b/ext/date/tests/bug37747.phpt
index 465f791c41..8c3d000341 100644
--- a/ext/date/tests/bug37747.phpt
+++ b/ext/date/tests/bug37747.phpt
@@ -4,7 +4,7 @@ Bug #37747 (strtotime segfaults when given "nextyear")
<?php
date_default_timezone_set("Europe/Oslo");
var_dump(strtotime("nextyear"));
- echo "ALIVE\n";
+ echo "ALIVE\n";
?>
--EXPECT--
bool(false)
diff --git a/ext/date/tests/bug42910.phpt b/ext/date/tests/bug42910.phpt
index e741db2ebc..f93ccedeaf 100644
--- a/ext/date/tests/bug42910.phpt
+++ b/ext/date/tests/bug42910.phpt
@@ -2,18 +2,18 @@
Bug #42910 (Constructing DateTime with TimeZone Indicator invalidates DateTimeZone)
--FILE--
<?php
- date_default_timezone_set('America/Los_Angeles');
- $foo = new DateTime('2007-03-11');
- $bar = new DateTime('2007-03-11T00:00:00-0800');
+ date_default_timezone_set('America/Los_Angeles');
+ $foo = new DateTime('2007-03-11');
+ $bar = new DateTime('2007-03-11T00:00:00-0800');
- print $foo->format(DateTime::ISO8601) . ' - ' . $foo->getTimezone()->getName() . ' - ' . $foo->format('U') . "\r\n";
- print $bar->format(DateTime::ISO8601) . ' - ' . $bar->getTimezone()->getName() . ' - ' . $bar->format('U') . "\r\n";
+ print $foo->format(DateTime::ISO8601) . ' - ' . $foo->getTimezone()->getName() . ' - ' . $foo->format('U') . "\r\n";
+ print $bar->format(DateTime::ISO8601) . ' - ' . $bar->getTimezone()->getName() . ' - ' . $bar->format('U') . "\r\n";
- $foo->setDate(2007, 03, 12);
- $bar->setDate(2007, 03, 12);
+ $foo->setDate(2007, 03, 12);
+ $bar->setDate(2007, 03, 12);
- print $foo->format(DateTime::ISO8601) . ' - ' . $foo->getTimezone()->getName() . ' - ' . $foo->format('U') . "\r\n";
- print $bar->format(DateTime::ISO8601) . ' - ' . $bar->getTimezone()->getName() . ' - ' . $bar->format('U') . "\r\n";
+ print $foo->format(DateTime::ISO8601) . ' - ' . $foo->getTimezone()->getName() . ' - ' . $foo->format('U') . "\r\n";
+ print $bar->format(DateTime::ISO8601) . ' - ' . $bar->getTimezone()->getName() . ' - ' . $bar->format('U') . "\r\n";
// --------------
diff --git a/ext/date/tests/bug43808.phpt b/ext/date/tests/bug43808.phpt
index 74b2317a20..9a1c4fad1f 100644
--- a/ext/date/tests/bug43808.phpt
+++ b/ext/date/tests/bug43808.phpt
@@ -5,7 +5,7 @@ Bug #43808 (date_create never fails (even when it should))
$date = date_create('asdfasdf');
if ($date instanceof DateTime) {
- echo "this is wrong, should be bool";
+ echo "this is wrong, should be bool";
}
var_dump( $date );
diff --git a/ext/date/tests/bug44562.phpt b/ext/date/tests/bug44562.phpt
index 5610474108..b4b721168f 100644
--- a/ext/date/tests/bug44562.phpt
+++ b/ext/date/tests/bug44562.phpt
@@ -6,11 +6,11 @@ date_default_timezone_set('Europe/Oslo');
try
{
- $dp = new DatePeriod('2D');
+ $dp = new DatePeriod('2D');
}
catch ( Exception $e )
{
- echo $e->getMessage(), "\n";
+ echo $e->getMessage(), "\n";
}
$begin = new DateTime( "2008-07-20T22:44:53+0200" );
@@ -19,7 +19,7 @@ $interval = DateInterval::createFromDateString( "1 day" );
$dp = new DatePeriod( $begin, $interval, 10 );
foreach ( $dp as $d )
{
- var_dump ($d->format( DATE_ISO8601 ) );
+ var_dump ($d->format( DATE_ISO8601 ) );
}
?>
diff --git a/ext/date/tests/bug44742.phpt b/ext/date/tests/bug44742.phpt
index 48952b4e6c..e87c1acb06 100644
--- a/ext/date/tests/bug44742.phpt
+++ b/ext/date/tests/bug44742.phpt
@@ -4,22 +4,22 @@ Bug #44742 (timezone_offset_get() causes segmentation faults)
<?php
date_default_timezone_set('Europe/London');
$dates = array(
- "2008-04-11 00:00:00+0000",
- "2008-04-11 00:00:00+0200",
- "2008-04-11 00:00:00+0330",
- "2008-04-11 00:00:00-0500",
- "2008-04-11 00:00:00-1130",
- "2008-04-11 00:00:00 CEST",
- "2008-04-11 00:00:00 CET",
- "2008-04-11 00:00:00 UTC",
- "2008-04-11 00:00:00 America/New_York",
- "2008-04-11 00:00:00 Europe/Oslo",
- "2008-04-11 00:00:00 Asia/Singapore",
+ "2008-04-11 00:00:00+0000",
+ "2008-04-11 00:00:00+0200",
+ "2008-04-11 00:00:00+0330",
+ "2008-04-11 00:00:00-0500",
+ "2008-04-11 00:00:00-1130",
+ "2008-04-11 00:00:00 CEST",
+ "2008-04-11 00:00:00 CET",
+ "2008-04-11 00:00:00 UTC",
+ "2008-04-11 00:00:00 America/New_York",
+ "2008-04-11 00:00:00 Europe/Oslo",
+ "2008-04-11 00:00:00 Asia/Singapore",
);
foreach ($dates as $date)
{
- $date = date_create($date);
- var_dump(timezone_offset_get(date_timezone_get($date), $date));
+ $date = date_create($date);
+ var_dump(timezone_offset_get(date_timezone_get($date), $date));
}
?>
--EXPECT--
diff --git a/ext/date/tests/bug45543.phpt b/ext/date/tests/bug45543.phpt
index 42a97ab20c..ed785a715a 100644
--- a/ext/date/tests/bug45543.phpt
+++ b/ext/date/tests/bug45543.phpt
@@ -5,21 +5,21 @@ date.timezone=UTC
--FILE--
<?php
$test_dates = array(
- '2008-01-01 12:00:00 PDT',
- '2008-01-01 12:00:00 +02:00',
+ '2008-01-01 12:00:00 PDT',
+ '2008-01-01 12:00:00 +02:00',
);
foreach ($test_dates as $test_date)
{
- $d1 = new DateTime($test_date);
- $d2 = new DateTime('2008-01-01 12:00:00 UTC');
- echo $d1->format(DATE_ISO8601), PHP_EOL;
- echo $d2->format(DATE_ISO8601), PHP_EOL;
- $tz = $d1->getTimeZone();
- $d2->setTimeZone($tz);
- echo $d1->format(DATE_ISO8601), PHP_EOL;
- echo $d2->format(DATE_ISO8601), PHP_EOL;
- echo PHP_EOL;
+ $d1 = new DateTime($test_date);
+ $d2 = new DateTime('2008-01-01 12:00:00 UTC');
+ echo $d1->format(DATE_ISO8601), PHP_EOL;
+ echo $d2->format(DATE_ISO8601), PHP_EOL;
+ $tz = $d1->getTimeZone();
+ $d2->setTimeZone($tz);
+ echo $d1->format(DATE_ISO8601), PHP_EOL;
+ echo $d2->format(DATE_ISO8601), PHP_EOL;
+ echo PHP_EOL;
}
--EXPECT--
2008-01-01T12:00:00-0700
diff --git a/ext/date/tests/bug48476.phpt b/ext/date/tests/bug48476.phpt
index 1335025c76..139c2e17e2 100644
--- a/ext/date/tests/bug48476.phpt
+++ b/ext/date/tests/bug48476.phpt
@@ -3,29 +3,35 @@ Bug #48476 (cloning extended DateTime class without calling parent::__constr cra
--FILE--
<?php
class MyDateTime extends DateTime {
- public function __construct() { }
+ public function __construct() { }
}
class MyDateTimeZone extends DateTimeZone {
- public function __construct() { }
+ public function __construct() { }
}
$o = new MyDateTime;
-var_dump($o->format("d"));
+try {
+ var_dump($o->format("d"));
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
$x = clone $o;
-var_dump($x->format("d"));
+try {
+ var_dump($x->format("d"));
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
clone $o;
-
-var_dump(timezone_location_get(clone new MyDateTimezone));
+try {
+ var_dump(timezone_location_get(clone new MyDateTimezone));
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Warning: DateTime::format(): The DateTime object has not been correctly initialized by its constructor in %sbug48476.php on line 10
-bool(false)
-
-Warning: DateTime::format(): The DateTime object has not been correctly initialized by its constructor in %sbug48476.php on line 13
-bool(false)
-
-Warning: timezone_location_get(): The DateTimeZone object has not been correctly initialized by its constructor in %sbug48476.php on line 18
-bool(false)
+--EXPECT--
+The DateTime object has not been correctly initialized by its constructor
+The DateTime object has not been correctly initialized by its constructor
+The DateTimeZone object has not been correctly initialized by its constructor
diff --git a/ext/date/tests/bug50392.phpt b/ext/date/tests/bug50392.phpt
index 9b1002317d..64def49f66 100644
--- a/ext/date/tests/bug50392.phpt
+++ b/ext/date/tests/bug50392.phpt
@@ -7,14 +7,14 @@ date_default_timezone_set('Europe/Bratislava');
$base = '2009-03-01 18:00:00';
for ($i = 0; $i < 8; $i++) {
- $string = $base . '.' . str_repeat($i, $i);
- echo $string, "\n- ";
- $result = date_parse_from_format('Y-m-d H:i:s.u', $string);
- echo $result['fraction'] ? $result['fraction'] : 'X', "\n";
- foreach( $result['errors'] as $error ) {
- echo "- ", $error, "\n";
- }
- echo "\n";
+ $string = $base . '.' . str_repeat($i, $i);
+ echo $string, "\n- ";
+ $result = date_parse_from_format('Y-m-d H:i:s.u', $string);
+ echo $result['fraction'] ? $result['fraction'] : 'X', "\n";
+ foreach( $result['errors'] as $error ) {
+ echo "- ", $error, "\n";
+ }
+ echo "\n";
}
?>
--EXPECT--
diff --git a/ext/date/tests/bug51096.phpt b/ext/date/tests/bug51096.phpt
index 2b479a94a6..dafb60bcde 100644
--- a/ext/date/tests/bug51096.phpt
+++ b/ext/date/tests/bug51096.phpt
@@ -3,26 +3,26 @@ Bug #51096 (Test for "first day" vs "first day of")
--FILE--
<?php
$tests = array(
- 'first day',
- 'last day',
- 'next month',
- 'first day next month',
- 'last day next month',
- 'first day of next month',
- 'last day of next month'
+ 'first day',
+ 'last day',
+ 'next month',
+ 'first day next month',
+ 'last day next month',
+ 'first day of next month',
+ 'last day of next month'
);
foreach ( $tests as $test )
{
- $result = date_parse( $test );
- $rel = $result['relative'];
- echo $test, "\n- month: ", $rel['month'], '; day: ', $rel['day'],
- '; first-day-of: ', isset( $rel['first_day_of_month'] ) ? 'true' : 'false',
- '; last-day-of: ', isset( $rel['last_day_of_month'] ) ? 'true' : 'false', "\n";
- $date = new DateTime( '2010-03-06 15:21 UTC' );
- echo '- ', $date->format( DateTime::ISO8601 );
- $date->modify( $test );
- echo ' -> ', $date->format( DateTime::ISO8601 ), "\n\n";
+ $result = date_parse( $test );
+ $rel = $result['relative'];
+ echo $test, "\n- month: ", $rel['month'], '; day: ', $rel['day'],
+ '; first-day-of: ', isset( $rel['first_day_of_month'] ) ? 'true' : 'false',
+ '; last-day-of: ', isset( $rel['last_day_of_month'] ) ? 'true' : 'false', "\n";
+ $date = new DateTime( '2010-03-06 15:21 UTC' );
+ echo '- ', $date->format( DateTime::ISO8601 );
+ $date->modify( $test );
+ echo ' -> ', $date->format( DateTime::ISO8601 ), "\n\n";
}
?>
--EXPECT--
diff --git a/ext/date/tests/bug51866.phpt b/ext/date/tests/bug51866.phpt
index 9481aebe9d..1874e32706 100644
--- a/ext/date/tests/bug51866.phpt
+++ b/ext/date/tests/bug51866.phpt
@@ -5,22 +5,22 @@ Bug #51866 (Lenient parsing with parseFromFormat)
date_default_timezone_set('UTC');
$tests = array(
- array( 'Y-m-d', '2001-11-29 13:20:01' ),
- array( 'Y-m-d+', '2001-11-29 13:20:01' ),
- array( 'Y-m-d +', '2001-11-29 13:20:01' ),
- array( 'Y-m-d+', '2001-11-29' ),
- array( 'Y-m-d +', '2001-11-29' ),
- array( 'Y-m-d +', '2001-11-29 ' ),
+ array( 'Y-m-d', '2001-11-29 13:20:01' ),
+ array( 'Y-m-d+', '2001-11-29 13:20:01' ),
+ array( 'Y-m-d +', '2001-11-29 13:20:01' ),
+ array( 'Y-m-d+', '2001-11-29' ),
+ array( 'Y-m-d +', '2001-11-29' ),
+ array( 'Y-m-d +', '2001-11-29 ' ),
);
foreach( $tests as $test )
{
- list($format, $str) = $test;
- var_dump($format, $str);
- $d = DateTime::createFromFormat($format, $str);
- var_dump($d);
- var_dump(DateTime::getLastErrors());
+ list($format, $str) = $test;
+ var_dump($format, $str);
+ $d = DateTime::createFromFormat($format, $str);
+ var_dump($d);
+ var_dump(DateTime::getLastErrors());
- echo "\n\n";
+ echo "\n\n";
}
--EXPECTF--
string(5) "Y-m-d"
diff --git a/ext/date/tests/bug52062.phpt b/ext/date/tests/bug52062.phpt
index cbcccf84b9..b1f7f25d7b 100644
--- a/ext/date/tests/bug52062.phpt
+++ b/ext/date/tests/bug52062.phpt
@@ -13,7 +13,11 @@ var_dump($d->format('Y-m-d H:i:s U'));
var_dump($d->getTimestamp());
var_dump($d->format('U'));
-$d->setTimestamp(100000000000);
+try {
+ $d->setTimestamp(100000000000);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump($d->format('Y-m-d H:i:s U'));
var_dump($d->getTimestamp());
@@ -24,8 +28,7 @@ var_dump($i->format('%s'));
string(32) "5138-11-16 09:46:40 100000000000"
bool(false)
string(12) "100000000000"
-
-Warning: DateTime::setTimestamp() expects parameter 1 to be int, float given in %s on line %d
+DateTime::setTimestamp() expects parameter 1 to be int, float given
string(32) "5138-11-16 09:46:40 100000000000"
bool(false)
string(10) "1215752192"
diff --git a/ext/date/tests/bug52808.phpt b/ext/date/tests/bug52808.phpt
index 810874858f..10776923c0 100644
--- a/ext/date/tests/bug52808.phpt
+++ b/ext/date/tests/bug52808.phpt
@@ -4,22 +4,22 @@ Bug #52808 (Segfault when specifying interval as two dates)
<?php
date_default_timezone_set('Europe/Oslo');
$intervals = array(
- "2008-05-11T15:30:00Z/2007-03-01T13:00:00Z",
- "2007-05-11T15:30:00Z/2008-03-01T13:00:00Z",
- "2007-05-11T15:30:00Z 2008-03-01T13:00:00Z",
- "2007-05-11T15:30:00Z/",
- "2007-05-11T15:30:00Z",
- "2007-05-11T15:30:00Z/:00Z",
+ "2008-05-11T15:30:00Z/2007-03-01T13:00:00Z",
+ "2007-05-11T15:30:00Z/2008-03-01T13:00:00Z",
+ "2007-05-11T15:30:00Z 2008-03-01T13:00:00Z",
+ "2007-05-11T15:30:00Z/",
+ "2007-05-11T15:30:00Z",
+ "2007-05-11T15:30:00Z/:00Z",
);
foreach($intervals as $iv) {
try
{
- $di = new DateInterval($iv);
- var_dump($di);
+ $di = new DateInterval($iv);
+ var_dump($di);
}
catch ( Exception $e )
{
- echo $e->getMessage(), "\n";
+ echo $e->getMessage(), "\n";
}
}
echo "==DONE==\n";
diff --git a/ext/date/tests/bug53437.phpt b/ext/date/tests/bug53437.phpt
index cac93a2ef0..f19f073aa9 100644
--- a/ext/date/tests/bug53437.phpt
+++ b/ext/date/tests/bug53437.phpt
@@ -22,7 +22,6 @@ foreach($dpu as $dt) {
echo $dt->format('Y-m-d H:i:s')."\r\n";
}
?>
-==DONE==
--EXPECTF--
Original:
2010-01-01 00:00:00
@@ -155,4 +154,3 @@ Unserialized:
2010-01-01 00:00:00
2010-01-02 00:00:00
2010-01-03 00:00:00
-==DONE==
diff --git a/ext/date/tests/bug53437_var2.phpt b/ext/date/tests/bug53437_var2.phpt
index 51cc28943b..7a87b38421 100644
--- a/ext/date/tests/bug53437_var2.phpt
+++ b/ext/date/tests/bug53437_var2.phpt
@@ -11,7 +11,6 @@ $di1 = unserialize($s);
var_dump($di0, $di1);
?>
-==DONE==
--EXPECT--
object(DateInterval)#1 (16) {
["y"]=>
@@ -81,4 +80,3 @@ object(DateInterval)#2 (16) {
["have_special_relative"]=>
int(0)
}
-==DONE==
diff --git a/ext/date/tests/bug53437_var3.phpt b/ext/date/tests/bug53437_var3.phpt
index 6738f14be7..44e6a80c89 100644
--- a/ext/date/tests/bug53437_var3.phpt
+++ b/ext/date/tests/bug53437_var3.phpt
@@ -10,7 +10,6 @@ $di = unserialize($s);
var_dump($di);
?>
-==DONE==
--EXPECTF--
object(DateInterval)#%d (16) {
["y"]=>
@@ -46,4 +45,3 @@ object(DateInterval)#%d (16) {
["f"]=>
float(-1)
}
-==DONE==
diff --git a/ext/date/tests/bug53437_var4.phpt b/ext/date/tests/bug53437_var4.phpt
index 189c15cb1b..b53483ab7f 100644
--- a/ext/date/tests/bug53437_var4.phpt
+++ b/ext/date/tests/bug53437_var4.phpt
@@ -9,18 +9,17 @@ $dt = new DateTime('2009-10-11');
$df = $dt->diff(new DateTime('2009-10-13'));
var_dump($df,
- $df->y,
- $df->m,
- $df->d,
- $df->h,
- $df->i,
- $df->s,
- $df->f,
- $df->invert,
- $df->days);
+ $df->y,
+ $df->m,
+ $df->d,
+ $df->h,
+ $df->i,
+ $df->s,
+ $df->f,
+ $df->invert,
+ $df->days);
?>
-==DONE==
--EXPECTF--
object(DateInterval)#%d (16) {
["y"]=>
@@ -65,4 +64,3 @@ int(0)
float(0)
int(0)
int(2)
-==DONE==
diff --git a/ext/date/tests/bug53437_var5.phpt b/ext/date/tests/bug53437_var5.phpt
index 38783b1545..baffbb484a 100644
--- a/ext/date/tests/bug53437_var5.phpt
+++ b/ext/date/tests/bug53437_var5.phpt
@@ -10,7 +10,6 @@ $di = unserialize($s);
var_dump($di);
?>
-==DONE==
--EXPECTF--
object(DateInterval)#%d (16) {
["y"]=>
@@ -46,4 +45,3 @@ object(DateInterval)#%d (16) {
["f"]=>
float(-1)
}
-==DONE==
diff --git a/ext/date/tests/bug53437_var6.phpt b/ext/date/tests/bug53437_var6.phpt
index 633fcb3f38..f5ff22c4a4 100644
--- a/ext/date/tests/bug53437_var6.phpt
+++ b/ext/date/tests/bug53437_var6.phpt
@@ -10,7 +10,6 @@ $di = unserialize($s);
var_dump($di);
?>
-==DONE==
--EXPECTF--
object(DateInterval)#%d (16) {
["y"]=>
@@ -46,4 +45,3 @@ object(DateInterval)#%d (16) {
["have_special_relative"]=>
int(0)
}
-==DONE==
diff --git a/ext/date/tests/bug54283.phpt b/ext/date/tests/bug54283.phpt
index 9a8a07ce5a..65669b6b39 100644
--- a/ext/date/tests/bug54283.phpt
+++ b/ext/date/tests/bug54283.phpt
@@ -4,9 +4,9 @@ Bug #54283 (new DatePeriod(NULL) causes crash)
<?php
try {
- var_dump(new DatePeriod(NULL));
+ var_dump(new DatePeriod(NULL));
} catch (Exception $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
?>
diff --git a/ext/date/tests/bug61642.phpt b/ext/date/tests/bug61642.phpt
index 872ceb4f3e..b8130f05aa 100644
--- a/ext/date/tests/bug61642.phpt
+++ b/ext/date/tests/bug61642.phpt
@@ -12,26 +12,26 @@ $dates = array('2012-03-29', '2012-03-30', '2012-03-31', '2012-04-01', '2012-04-
$header = array();
foreach ($dates as $startdate) {
- $date = new DateTime($startdate);
+ $date = new DateTime($startdate);
- $header[] = $date->format('Y-m-d D');
+ $header[] = $date->format('Y-m-d D');
}
echo '### ', implode(' ', $header), "\n\n";
foreach ($weekdays as $days) {
- $line = array();
+ $line = array();
- printf('%+3d ', $days);
+ printf('%+3d ', $days);
- foreach ($dates as $startdate) {
- $date = new DateTime($startdate);
- $date->modify("{$days} weekdays");
+ foreach ($dates as $startdate) {
+ $date = new DateTime($startdate);
+ $date->modify("{$days} weekdays");
- $line[] = $date->format('Y-m-d D');
- }
+ $line[] = $date->format('Y-m-d D');
+ }
- echo implode(' ', $line), "\n";
+ echo implode(' ', $line), "\n";
}
?>
--EXPECT--
diff --git a/ext/date/tests/bug62500.phpt b/ext/date/tests/bug62500.phpt
index 6952332014..3afa7a561b 100644
--- a/ext/date/tests/bug62500.phpt
+++ b/ext/date/tests/bug62500.phpt
@@ -23,6 +23,6 @@ try {
NULL
int(3)
-Notice: Undefined property: Crasher::$2 in %sbug62500.php on line %d
+Warning: Undefined property: Crasher::$2 in %s on line %d
NULL
string(%s) "DateInterval::__construct(): Unknown or bad format (blah)"
diff --git a/ext/date/tests/bug63391.phpt b/ext/date/tests/bug63391.phpt
index a29d25e730..58da985e08 100644
--- a/ext/date/tests/bug63391.phpt
+++ b/ext/date/tests/bug63391.phpt
@@ -8,7 +8,7 @@ print "Date PHP\n";
print "---------- ---\n";
$dates = array('1599-12-30', '1599-12-31', '1600-01-01', '1600-01-02');
foreach ($dates as $date) {
- echo date_create($date)->format('Y-m-d D'), "\n";
+ echo date_create($date)->format('Y-m-d D'), "\n";
}
?>
--EXPECT--
diff --git a/ext/date/tests/bug63435.phpt b/ext/date/tests/bug63435.phpt
index dcec6e46e7..9dbc2fda12 100644
--- a/ext/date/tests/bug63435.phpt
+++ b/ext/date/tests/bug63435.phpt
@@ -5,11 +5,11 @@ date.timezone=UTC
--FILE--
<?php
for ($i=1 ; $i<999 ; $i++) {
- $datetime = Datetime::createFromFormat("u", sprintf("%06ld", $i));
- $res = $datetime->format("u");
- if ($res != $i) {
- echo "$i != $res\n";
- }
+ $datetime = Datetime::createFromFormat("u", sprintf("%06ld", $i));
+ $res = $datetime->format("u");
+ if ($res != $i) {
+ echo "$i != $res\n";
+ }
}
echo "Done";
--EXPECT--
diff --git a/ext/date/tests/bug63740.phpt b/ext/date/tests/bug63740.phpt
index 18c5a57d77..d0056987cd 100644
--- a/ext/date/tests/bug63740.phpt
+++ b/ext/date/tests/bug63740.phpt
@@ -3,28 +3,28 @@ Bug #63740 (strtotime seems to use both sunday and monday as start of week)
--FILE--
<?php
$dates = [
- '2015-07-04',
- '2015-07-05',
- '2015-07-06',
- '2015-07-07',
- '2015-07-08',
- '2015-07-09',
- '2015-07-10',
- '2015-07-11',
- '2015-07-12',
- '2015-07-13',
- '2015-07-14',
+ '2015-07-04',
+ '2015-07-05',
+ '2015-07-06',
+ '2015-07-07',
+ '2015-07-08',
+ '2015-07-09',
+ '2015-07-10',
+ '2015-07-11',
+ '2015-07-12',
+ '2015-07-13',
+ '2015-07-14',
];
foreach ( $dates as $date )
{
- $dt = new DateTimeImmutable( "$date 00:00 UTC" );
+ $dt = new DateTimeImmutable( "$date 00:00 UTC" );
- echo $dt->format( "D Y-m-d H:i" ), " → ";
+ echo $dt->format( "D Y-m-d H:i" ), " → ";
- $dtn = $dt->modify( "this week" );
+ $dtn = $dt->modify( "this week" );
- echo $dtn->format( "D Y-m-d H:i" ), "\n";
+ echo $dtn->format( "D Y-m-d H:i" ), "\n";
}
?>
--EXPECT--
diff --git a/ext/date/tests/bug64887.phpt b/ext/date/tests/bug64887.phpt
index dba1921eac..52c5e0fa8d 100644
--- a/ext/date/tests/bug64887.phpt
+++ b/ext/date/tests/bug64887.phpt
@@ -5,28 +5,28 @@ date.timezone=UTC
--FILE--
<?php
$tests = [
- '+1 ms',
- '-2 msec',
- '+3 msecs',
- '-4 millisecond',
- '+5 milliseconds',
+ '+1 ms',
+ '-2 msec',
+ '+3 msecs',
+ '-4 millisecond',
+ '+5 milliseconds',
- '-6 usec',
- '+7 usecs',
- '-8 microsecond',
- '+9 microseconds',
- '-10 µs',
- '+11 µsec',
- '-12 µsecs',
+ '-6 usec',
+ '+7 usecs',
+ '-8 microsecond',
+ '+9 microseconds',
+ '-10 µs',
+ '+11 µsec',
+ '-12 µsecs',
- '+8 msec -2 µsec',
+ '+8 msec -2 µsec',
];
$datetime = new DateTimeImmutable( "2016-10-07 13:25:50" );
foreach ( $tests as $test )
{
- echo $datetime->modify( $test )->format( 'Y-m-d H:i:s.u' ), "\n";
+ echo $datetime->modify( $test )->format( 'Y-m-d H:i:s.u' ), "\n";
}
?>
diff --git a/ext/date/tests/bug65184.phpt b/ext/date/tests/bug65184.phpt
index 9bb68558aa..30a24f2493 100644
--- a/ext/date/tests/bug65184.phpt
+++ b/ext/date/tests/bug65184.phpt
@@ -10,19 +10,17 @@ if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
date.timezone = UTC
--FILE--
<?php
- setlocale(LC_ALL, 'Japanese_Japan.932');
- /* timestamp has to be some wednesday */
- $s = strftime('%A', 1372884126);
+ setlocale(LC_ALL, 'Japanese_Japan.932');
+ /* timestamp has to be some wednesday */
+ $s = strftime('%A', 1372884126);
- for ($i = 0; $i < strlen($s); $i++) {
- printf("%x ", ord($s[$i]));
- }
- echo "\n";
+ for ($i = 0; $i < strlen($s); $i++) {
+ printf("%x ", ord($s[$i]));
+ }
+ echo "\n";
- echo strlen(strftime('%A')), "\n";
+ echo strlen(strftime('%A')), "\n";
?>
-===DONE===
--EXPECT--
90 85 97 6a 93 fa
6
-===DONE===
diff --git a/ext/date/tests/bug66985.phpt b/ext/date/tests/bug66985.phpt
index 37dcd3e80d..2bcf97cb37 100644
--- a/ext/date/tests/bug66985.phpt
+++ b/ext/date/tests/bug66985.phpt
@@ -3,18 +3,18 @@ Bug #66985 (Some timezones are no longer valid in PHP 5.5.10)
--FILE--
<?php
$zones = array(
- "CST6CDT", "Cuba", "Egypt", "Eire", "EST5EDT", "Factory", "GB-Eire",
- "GMT0", "Greenwich", "Hongkong", "Iceland", "Iran", "Israel", "Jamaica",
- "Japan", "Kwajalein", "Libya", "MST7MDT", "Navajo", "NZ-CHAT", "Poland",
- "Portugal", "PST8PDT", "Singapore", "Turkey", "Universal", "W-SU",
+ "CST6CDT", "Cuba", "Egypt", "Eire", "EST5EDT", "Factory", "GB-Eire",
+ "GMT0", "Greenwich", "Hongkong", "Iceland", "Iran", "Israel", "Jamaica",
+ "Japan", "Kwajalein", "Libya", "MST7MDT", "Navajo", "NZ-CHAT", "Poland",
+ "Portugal", "PST8PDT", "Singapore", "Turkey", "Universal", "W-SU",
- "UTC", "GMT", "GMT+0100", "-0230",
+ "UTC", "GMT", "GMT+0100", "-0230",
);
foreach ( $zones as $zone )
{
- $d = new DateTimeZone( $zone );
- print_r($d);
+ $d = new DateTimeZone( $zone );
+ print_r($d);
}
?>
--EXPECT--
diff --git a/ext/date/tests/bug67118.phpt b/ext/date/tests/bug67118.phpt
index 332142856e..ee1d8efc0a 100644
--- a/ext/date/tests/bug67118.phpt
+++ b/ext/date/tests/bug67118.phpt
@@ -6,22 +6,26 @@ date.timezone=Europe/Berlin
<?php
class mydt extends datetime
{
- public function __construct($time = 'now', $tz = NULL, $format = NULL)
- {
- if (!empty($tz) && !is_object($tz)) {
- $tz = new DateTimeZone($tz);
- }
- try {
- @parent::__construct($time, $tz);
- } catch (Exception $e) {
- echo "Bad date" . $this->format("Y") . "\n";
- }
- }
+ public function __construct($time = 'now', $tz = NULL, $format = NULL)
+ {
+ if (!empty($tz) && !is_object($tz)) {
+ $tz = new DateTimeZone($tz);
+ }
+ try {
+ @parent::__construct($time, $tz);
+ } catch (Exception $e) {
+ echo "Bad date" . $this->format("Y") . "\n";
+ }
+ }
};
new mydt("Funktionsansvarig rådgivning och juridik", "UTC");
?>
--EXPECTF--
-Warning: DateTime::format(): The DateTime object has not been correctly initialized by its constructor in %s on line %d
-Bad date
+Fatal error: Uncaught Error: The DateTime object has not been correctly initialized by its constructor in %s:%d
+Stack trace:
+#0 %s(%d): DateTime->format('Y')
+#1 %s(%d): mydt->__construct(%s)
+#2 {main}
+ thrown in %s on line %d
diff --git a/ext/date/tests/bug70245.phpt b/ext/date/tests/bug70245.phpt
index f754bf65a1..b480192326 100644
--- a/ext/date/tests/bug70245.phpt
+++ b/ext/date/tests/bug70245.phpt
@@ -3,8 +3,11 @@ Bug #70245 (strtotime does not emit warning when 2nd parameter is object or stri
--FILE--
<?php
$d = new DateTime('2011-01-15 00:00:00');
-var_dump(strtotime('-1 month', $d));
+try {
+ var_dump(strtotime('-1 month', $d));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
--EXPECTF--
-Warning: strtotime() expects parameter 2 to be int, object given in %sbug70245.php on line %d
-bool(false)
+strtotime() expects parameter 2 to be int, object given
diff --git a/ext/date/tests/bug72096.phpt b/ext/date/tests/bug72096.phpt
index 1a4a219287..4256102944 100644
--- a/ext/date/tests/bug72096.phpt
+++ b/ext/date/tests/bug72096.phpt
@@ -5,8 +5,8 @@ date.timezone=UTC
--FILE--
<?php
for ($unix = 1461283200; $unix <= 1461369600; $unix += 8000) {
- echo "Time:", gmdate('Y-m-d H:i:s = B', $unix), PHP_EOL;
- echo "Time:", gmdate('Y-m-d H:i:s = B', $unix - 82 * 365 * 24 * 3600), PHP_EOL;
+ echo "Time:", gmdate('Y-m-d H:i:s = B', $unix), PHP_EOL;
+ echo "Time:", gmdate('Y-m-d H:i:s = B', $unix - 82 * 365 * 24 * 3600), PHP_EOL;
}
?>
--EXPECT--
diff --git a/ext/date/tests/bug73294.phpt b/ext/date/tests/bug73294.phpt
index 493ba92dd6..af13cdaf40 100644
--- a/ext/date/tests/bug73294.phpt
+++ b/ext/date/tests/bug73294.phpt
@@ -4,17 +4,17 @@ Bug #73294: DateTime wrong when date string is negative
<?php
for ( $i = -1050; $i <= -1000; $i++ )
{
- $M = "06";
- $D = "22";
+ $M = "06";
+ $D = "22";
- $dt = new DateTime("{$i}-{$M}-{$D} 00:00:00");
- $expected = "{$i}-{$M}-{$D} 00:00:00";
- $result = $dt->format('Y-m-d H:i:s');
+ $dt = new DateTime("{$i}-{$M}-{$D} 00:00:00");
+ $expected = "{$i}-{$M}-{$D} 00:00:00";
+ $result = $dt->format('Y-m-d H:i:s');
- if ( $expected != $result )
- {
- echo "Wrong: Should have been {$expected}, was {$result}\n";
- }
+ if ( $expected != $result )
+ {
+ echo "Wrong: Should have been {$expected}, was {$result}\n";
+ }
}
?>
==DONE==
diff --git a/ext/date/tests/bug73837.phpt b/ext/date/tests/bug73837.phpt
index b14feecd93..c11aa2c56b 100644
--- a/ext/date/tests/bug73837.phpt
+++ b/ext/date/tests/bug73837.phpt
@@ -6,9 +6,9 @@ $collect = [];
for ( $i = 0; $i < 1000; $i++ )
{
- $a = new DateTime();
- $key = "s" . $a->format( "u" );
- $collect[$key] = true;
+ $a = new DateTime();
+ $key = "s" . $a->format( "u" );
+ $collect[$key] = true;
}
var_dump($n = count( $collect ));
diff --git a/ext/date/tests/bug73858.phpt b/ext/date/tests/bug73858.phpt
index 300b366749..fb41390b0f 100644
--- a/ext/date/tests/bug73858.phpt
+++ b/ext/date/tests/bug73858.phpt
@@ -45,7 +45,7 @@ var_dump($d->days); // 30 ... and should be 30
/*
[Workaround]
-This final test seems to prove that the input string is important and that the "- 1 secord" has a negative knock-on
+This final test seems to prove that the input string is important and that the "- 1 second" has a negative knock-on
effect on the results of the diff. By modifying the datetime with ->modify everything works as expected ...
it just means you have to be careful of how we work with DateTimes .
*/
diff --git a/ext/date/tests/bug74652.phpt b/ext/date/tests/bug74652.phpt
index 029464be4c..3cff8beab0 100644
--- a/ext/date/tests/bug74652.phpt
+++ b/ext/date/tests/bug74652.phpt
@@ -5,19 +5,19 @@ date.timezone=UTC
--FILE--
<?php
$formats = [
- '2017-03-25 10:52:09',
- '2017-03-25 10:52',
- '2017-03-25 10am',
- '2017-03-25',
- '2017-03',
- '2017.042',
- '2017043',
+ '2017-03-25 10:52:09',
+ '2017-03-25 10:52',
+ '2017-03-25 10am',
+ '2017-03-25',
+ '2017-03',
+ '2017.042',
+ '2017043',
];
foreach ( $formats as $format )
{
- $dt = new DateTimeImmutable( $format );
- echo $dt->format( 'Y-m-d H:i:s' ), "\n";
+ $dt = new DateTimeImmutable( $format );
+ echo $dt->format( 'Y-m-d H:i:s' ), "\n";
}
?>
--EXPECT--
diff --git a/ext/date/tests/bug74852.phpt b/ext/date/tests/bug74852.phpt
index e293bef8bf..d5fea0ad3f 100644
--- a/ext/date/tests/bug74852.phpt
+++ b/ext/date/tests/bug74852.phpt
@@ -13,5 +13,5 @@ var_dump($interval->abcde);
bool(false)
bool(false)
-Notice: Undefined property: DateInterval::$abcde in %s on line %d
+Warning: Undefined property: DateInterval::$abcde in %s on line %d
NULL
diff --git a/ext/date/tests/bug75002.phpt b/ext/date/tests/bug75002.phpt
index b10e0ebe00..5c3085f316 100644
--- a/ext/date/tests/bug75002.phpt
+++ b/ext/date/tests/bug75002.phpt
@@ -4,13 +4,13 @@ Bug #75002 Null Pointer Dereference in timelib_time_clone
<?php
class aaa extends DatePeriod {
- public function __construct() { }
+ public function __construct() { }
}
$start=new DateTime( '2012-08-01' );
foreach (new aaa($start) as $y) {
- $a=$key;
+ $a=$key;
}
?>
diff --git a/ext/date/tests/bug75232.phpt b/ext/date/tests/bug75232.phpt
index 9200f65e91..cf4f289465 100644
--- a/ext/date/tests/bug75232.phpt
+++ b/ext/date/tests/bug75232.phpt
@@ -14,7 +14,7 @@ echo $d2->date, "\n";
?>
--EXPECTF--
-Notice: Undefined property: DateTime::$date in %s on line %d
+Warning: Undefined property: DateTime::$date in %s on line %d
DateTime Object
(
@@ -23,4 +23,4 @@ DateTime Object
[timezone] => UTC
)
-Notice: Undefined property: DateTime::$date in %s on line %d
+Warning: Undefined property: DateTime::$date in %s on line %d
diff --git a/ext/date/tests/checkdate_basic1.phpt b/ext/date/tests/checkdate_basic1.phpt
index 9be78eb171..150215b7eb 100644
--- a/ext/date/tests/checkdate_basic1.phpt
+++ b/ext/date/tests/checkdate_basic1.phpt
@@ -32,7 +32,6 @@ var_dump( checkdate(7, 2, 32768) ); // >max year
var_dump( checkdate(7, 2, 0) ); // <min year
?>
-===DONE===
--EXPECT--
*** Testing checkdate() : basic functionality ***
-- The following are all valid dates --
@@ -51,4 +50,3 @@ bool(false)
bool(false)
bool(false)
bool(false)
-===DONE===
diff --git a/ext/date/tests/date-time-modify-times.phpt b/ext/date/tests/date-time-modify-times.phpt
index e355f18e06..4f26275c88 100644
--- a/ext/date/tests/date-time-modify-times.phpt
+++ b/ext/date/tests/date-time-modify-times.phpt
@@ -5,31 +5,31 @@ date.timezone=Europe/London
--FILE--
<?php
$tests = array(
- '2010-12-15 19:42:45 UTC' => array(
- 'october 23:00', // October 23rd, with a broken time
- 'back of 4pm',
- 'next week monday',
- 'next week monday 10am',
- 'tuesday noon',
- 'first monday of January 2011',
- 'first monday of January 2011 09:00',
- ),
- '2010-12-15 19:42:45' => array(
- 'october 23:00', // October 23rd, with a broken time
- 'march 28, 00:15',
- 'march 28, 01:15', // doesn't exist bcause of DST
- 'march 28, 02:15',
- ),
+ '2010-12-15 19:42:45 UTC' => array(
+ 'october 23:00', // October 23rd, with a broken time
+ 'back of 4pm',
+ 'next week monday',
+ 'next week monday 10am',
+ 'tuesday noon',
+ 'first monday of January 2011',
+ 'first monday of January 2011 09:00',
+ ),
+ '2010-12-15 19:42:45' => array(
+ 'october 23:00', // October 23rd, with a broken time
+ 'march 28, 00:15',
+ 'march 28, 01:15', // doesn't exist because of DST
+ 'march 28, 02:15',
+ ),
);
foreach ( $tests as $start => $data )
{
- foreach ( $data as $test )
- {
- echo date_create( $start )
- ->modify( $test )
- ->format( DateTime::RFC2822 ), "\n";
- }
+ foreach ( $data as $test )
+ {
+ echo date_create( $start )
+ ->modify( $test )
+ ->format( DateTime::RFC2822 ), "\n";
+ }
}
echo "\n";
?>
diff --git a/ext/date/tests/date.phpt b/ext/date/tests/date.phpt
index 12bc9f0fce..6a371ee001 100644
--- a/ext/date/tests/date.phpt
+++ b/ext/date/tests/date.phpt
@@ -6,13 +6,13 @@ $tmp = "cr";
date_default_timezone_set('UTC');
for($a = 0;$a < strlen($tmp); $a++){
- echo $tmp[$a], ': ', date($tmp[$a], 1043324459)."\n";
+ echo $tmp[$a], ': ', date($tmp[$a], 1043324459)."\n";
}
date_default_timezone_set("MET");
for($a = 0;$a < strlen($tmp); $a++){
- echo $tmp[$a], ': ', date($tmp[$a], 1043324459)."\n";
+ echo $tmp[$a], ': ', date($tmp[$a], 1043324459)."\n";
}
?>
--EXPECT--
diff --git a/ext/date/tests/date_add_basic.phpt b/ext/date/tests/date_add_basic.phpt
index edf84d61f8..fe5c7e9c19 100644
--- a/ext/date/tests/date_add_basic.phpt
+++ b/ext/date/tests/date_add_basic.phpt
@@ -17,22 +17,21 @@ echo "*** Testing date_add() : basic functionality ***\n";
$startDate = '2008-01-01 12:25';
$format = 'Y-m-d H:i:s';
$intervals = array(
- 'P3Y6M4DT12H30M5S',
- 'P0D',
- 'P2DT1M',
- 'P1Y2MT23H43M150S'
+ 'P3Y6M4DT12H30M5S',
+ 'P0D',
+ 'P2DT1M',
+ 'P1Y2MT23H43M150S'
);
$d = new DateTime($startDate);
var_dump( $d->format($format) );
foreach($intervals as $interval) {
- date_add($d, new DateInterval($interval) );
- var_dump( $d->format($format) );
+ date_add($d, new DateInterval($interval) );
+ var_dump( $d->format($format) );
}
?>
-===DONE===
--EXPECT--
*** Testing date_add() : basic functionality ***
string(19) "2008-01-01 12:25:00"
@@ -40,4 +39,3 @@ string(19) "2011-07-06 00:55:05"
string(19) "2011-07-06 00:55:05"
string(19) "2011-07-08 00:56:05"
string(19) "2012-09-09 00:41:35"
-===DONE===
diff --git a/ext/date/tests/date_basic1.phpt b/ext/date/tests/date_basic1.phpt
index 088bdce6d5..c05208e31e 100644
--- a/ext/date/tests/date_basic1.phpt
+++ b/ext/date/tests/date_basic1.phpt
@@ -25,7 +25,6 @@ var_dump( date('H:m:s \m \i\s\ \m\o\n\t\h', $timestamp) );
var_dump( date("H:i:s", $timestamp) );
?>
-===DONE===
--EXPECT--
*** Testing date() : basic functionality ***
string(27) "February 27, 2009, 10:44 am"
@@ -37,4 +36,3 @@ string(19) "it is the 27th day."
string(28) "Fri Feb 27 10:44:30 GMT 2009"
string(19) "10:02:30 m is month"
string(8) "10:44:30"
-===DONE===
diff --git a/ext/date/tests/date_create-1.phpt b/ext/date/tests/date_create-1.phpt
index 4b156de6e4..aad2f3f9e2 100644
--- a/ext/date/tests/date_create-1.phpt
+++ b/ext/date/tests/date_create-1.phpt
@@ -26,7 +26,7 @@ $d[] = date_create("2005-07-14 22:30:41 Europe/Oslo", $tz1);
$d[] = date_create("2005-07-14 22:30:41 America/Los_Angeles", $tz2);
foreach($d as $date) {
- echo $date->format(DateTime::ISO8601), "\n";
+ echo $date->format(DateTime::ISO8601), "\n";
}
?>
--EXPECT--
diff --git a/ext/date/tests/date_create-relative.phpt b/ext/date/tests/date_create-relative.phpt
index 5d2a4196e9..02861242ca 100644
--- a/ext/date/tests/date_create-relative.phpt
+++ b/ext/date/tests/date_create-relative.phpt
@@ -6,47 +6,47 @@ date_create() with large relative offsets
date_default_timezone_set('UTC');
if (!defined('PHP_INT_MIN')) {
- define('PHP_INT_MIN', intval(-PHP_INT_MAX - 1));
+ define('PHP_INT_MIN', intval(-PHP_INT_MAX - 1));
}
$base_time = '28 Feb 2008 12:00:00';
// Most offsets tested in strtotime-relative.phpt. These are tests for dates outside the 32-bit range.
$offsets = array(
- // around 10 leap year periods (4000 years) in days
- '1460000 days',
- '1460969 days',
- '1460970 days',
- '1460971 days',
- '1462970 days',
+ // around 10 leap year periods (4000 years) in days
+ '1460000 days',
+ '1460969 days',
+ '1460970 days',
+ '1460971 days',
+ '1462970 days',
- // around 1 leap year period in years
- '398 years',
- '399 years',
- '400 years',
- '401 years',
+ // around 1 leap year period in years
+ '398 years',
+ '399 years',
+ '400 years',
+ '401 years',
- // around 40000 years
- '39755 years',
- '39999 years',
- '40000 years',
- '40001 years',
- '41010 years',
+ // around 40000 years
+ '39755 years',
+ '39999 years',
+ '40000 years',
+ '40001 years',
+ '41010 years',
- // bigger than int (32-bit)
- '10000000000 seconds',
- '10000000000 minutes',
- '10000000000 hours',
- '10000000000 days',
- '10000000000 months',
- '10000000000 years',
+ // bigger than int (32-bit)
+ '10000000000 seconds',
+ '10000000000 minutes',
+ '10000000000 hours',
+ '10000000000 days',
+ '10000000000 months',
+ '10000000000 years',
);
foreach ($offsets AS $offset) {
- foreach (array('+', '-') AS $direction) {
- $dt = date_create("$base_time $direction$offset");
- echo "$direction$offset: " . date_format($dt, DATE_ISO8601) . "\n";
- }
+ foreach (array('+', '-') AS $direction) {
+ $dt = date_create("$base_time $direction$offset");
+ echo "$direction$offset: " . date_format($dt, DATE_ISO8601) . "\n";
+ }
}
?>
diff --git a/ext/date/tests/date_create_basic.phpt b/ext/date/tests/date_create_basic.phpt
index b9d1c2fa97..5c12605023 100644
--- a/ext/date/tests/date_create_basic.phpt
+++ b/ext/date/tests/date_create_basic.phpt
@@ -20,7 +20,6 @@ var_dump( date_create("2005-07-14 22:30:41") );
var_dump( date_create("2005-07-14 22:30:41 GMT") );
?>
-===DONE===
--EXPECTF--
*** Testing date_create() : basic functionality ***
object(DateTime)#%d (3) {
@@ -55,4 +54,3 @@ object(DateTime)#%d (3) {
["timezone"]=>
string(3) "GMT"
}
-===DONE===
diff --git a/ext/date/tests/date_date_set_basic1.phpt b/ext/date/tests/date_date_set_basic1.phpt
index d24815f99c..d701a22543 100644
--- a/ext/date/tests/date_date_set_basic1.phpt
+++ b/ext/date/tests/date_date_set_basic1.phpt
@@ -22,9 +22,7 @@ date_date_set($datetime, 2008, 02, 01);
echo date_format($datetime, DATE_RFC2822) . "\n";
?>
-===DONE===
--EXPECT--
*** Testing date_date_set() : basic functionality ***
Fri, 30 Jan 2009 19:34:10 +0000
Fri, 01 Feb 2008 19:34:10 +0000
-===DONE===
diff --git a/ext/date/tests/date_default_timezone_get-1.phpt b/ext/date/tests/date_default_timezone_get-1.phpt
index ba0607643b..32c066c1ca 100644
--- a/ext/date/tests/date_default_timezone_get-1.phpt
+++ b/ext/date/tests/date_default_timezone_get-1.phpt
@@ -8,9 +8,9 @@ date_default_timezone_get() function [1]
date.timezone=
--FILE--
<?php
- putenv('TZ=');
- echo date_default_timezone_get(), "\n";
- echo date('e'), "\n";
+ putenv('TZ=');
+ echo date_default_timezone_get(), "\n";
+ echo date('e'), "\n";
?>
--EXPECT--
UTC
diff --git a/ext/date/tests/date_default_timezone_get-2.phpt b/ext/date/tests/date_default_timezone_get-2.phpt
index 5c835c35f3..cf7478c90b 100644
--- a/ext/date/tests/date_default_timezone_get-2.phpt
+++ b/ext/date/tests/date_default_timezone_get-2.phpt
@@ -8,8 +8,8 @@ date_default_timezone_get() function [2]
date.timezone=
--FILE--
<?php
- putenv('TZ=');
- echo date_default_timezone_get(), "\n";
+ putenv('TZ=');
+ echo date_default_timezone_get(), "\n";
?>
--EXPECT--
UTC
diff --git a/ext/date/tests/date_default_timezone_get-3.phpt b/ext/date/tests/date_default_timezone_get-3.phpt
index ffc882e6f6..6e9818724e 100644
--- a/ext/date/tests/date_default_timezone_get-3.phpt
+++ b/ext/date/tests/date_default_timezone_get-3.phpt
@@ -4,10 +4,10 @@ date_default_timezone_get() function [3]
date.timezone=Europe/Rome
--FILE--
<?php
- echo date_default_timezone_get(), "\n";
+ echo date_default_timezone_get(), "\n";
- date_default_timezone_set("America/Chicago");
- echo date_default_timezone_get(), "\n";
+ date_default_timezone_set("America/Chicago");
+ echo date_default_timezone_get(), "\n";
?>
--EXPECT--
Europe/Rome
diff --git a/ext/date/tests/date_default_timezone_get-4.phpt b/ext/date/tests/date_default_timezone_get-4.phpt
index 6d1982bc13..f2319856d8 100644
--- a/ext/date/tests/date_default_timezone_get-4.phpt
+++ b/ext/date/tests/date_default_timezone_get-4.phpt
@@ -4,7 +4,7 @@ date_default_timezone_get() function [4]
date.timezone=Incorrect/Zone
--FILE--
<?php
- echo date_default_timezone_get(), "\n";
+ echo date_default_timezone_get(), "\n";
?>
--EXPECTF--
Warning: date_default_timezone_get(): Invalid date.timezone value 'Incorrect/Zone', we selected the timezone 'UTC' for now. in %sdate_default_timezone_get-4.php on line %d
diff --git a/ext/date/tests/date_default_timezone_set-1.phpt b/ext/date/tests/date_default_timezone_set-1.phpt
index 7e7ba7972f..54f1fa73f3 100644
--- a/ext/date/tests/date_default_timezone_set-1.phpt
+++ b/ext/date/tests/date_default_timezone_set-1.phpt
@@ -8,18 +8,18 @@ if (substr(PHP_OS, 0, 3) == 'WIN') die('skip diff TZ detection on windows.');
date.timezone=
--FILE--
<?php
- putenv("TZ=");
- $date1 = strtotime("2005-01-12 08:00:00");
- $date2 = strtotime("2005-07-12 08:00:00");
- date_default_timezone_set("America/Indiana/Knox");
- $date3 = strtotime("2005-01-12 08:00:00");
- $date4 = strtotime("2005-07-12 08:00:00");
+ putenv("TZ=");
+ $date1 = strtotime("2005-01-12 08:00:00");
+ $date2 = strtotime("2005-07-12 08:00:00");
+ date_default_timezone_set("America/Indiana/Knox");
+ $date3 = strtotime("2005-01-12 08:00:00");
+ $date4 = strtotime("2005-07-12 08:00:00");
- echo date_default_timezone_get(), "\n";
- echo date(DATE_ISO8601, $date1), "\n";
- echo date(DATE_ISO8601, $date2), "\n";
- echo date(DATE_ISO8601, $date3), "\n";
- echo date(DATE_ISO8601, $date4), "\n";
+ echo date_default_timezone_get(), "\n";
+ echo date(DATE_ISO8601, $date1), "\n";
+ echo date(DATE_ISO8601, $date2), "\n";
+ echo date(DATE_ISO8601, $date3), "\n";
+ echo date(DATE_ISO8601, $date4), "\n";
?>
--EXPECT--
America/Indiana/Knox
diff --git a/ext/date/tests/date_default_timezone_set_error.phpt b/ext/date/tests/date_default_timezone_set_error.phpt
index 15c6aa6fed..652c0e8d44 100644
--- a/ext/date/tests/date_default_timezone_set_error.phpt
+++ b/ext/date/tests/date_default_timezone_set_error.phpt
@@ -9,33 +9,14 @@ Test date_default_timezone_set() function : error variations
echo "*** Testing date_default_timezone_set() : error variations ***\n";
-echo "\n-- Testing date_default_timezone_set() function with less than expected no. of arguments --\n";
-var_dump( date_default_timezone_set() );
-
-echo "\n-- Testing date_default_timezone_set() function with more than expected no. of arguments --\n";
-$extra_arg = 10;
-var_dump( date_default_timezone_set("GMT", $extra_arg) );
-
echo "\n-- Testing date_default_timezone_set() function with invalid timezone identifier --\n";
var_dump( date_default_timezone_set("foo") );
?>
-===Done===
--EXPECTF--
*** Testing date_default_timezone_set() : error variations ***
--- Testing date_default_timezone_set() function with less than expected no. of arguments --
-
-Warning: date_default_timezone_set() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
--- Testing date_default_timezone_set() function with more than expected no. of arguments --
-
-Warning: date_default_timezone_set() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
-
-- Testing date_default_timezone_set() function with invalid timezone identifier --
Notice: date_default_timezone_set(): Timezone ID 'foo' is invalid in %s on line %d
bool(false)
-===Done===
diff --git a/ext/date/tests/date_diff.phpt b/ext/date/tests/date_diff.phpt
index e01a94e767..d5cc58271c 100644
--- a/ext/date/tests/date_diff.phpt
+++ b/ext/date/tests/date_diff.phpt
@@ -13,48 +13,48 @@ define( 'COUNT', 120 );
$d0 = new DateTime('2009-11-20');
for ( $i = 0; $i < COUNT * 12; $i++ )
{
- $d = clone $d0;
- $dates[$i] = $d->add( new DateInterval( "P{$i}D" ) );
+ $d = clone $d0;
+ $dates[$i] = $d->add( new DateInterval( "P{$i}D" ) );
}
for ( $i = 0; $i < COUNT; $i++)
{
// echo $dates[$i]->format( "Y-m-d\n" );
- for ( $j = 0; $j < COUNT * 12; $j++)
- {
- $diff = date_diff( $dates[$i], $dates[$j] );
- /*
- printf( "\t%s %s %3d %s\n",
- $dates[$i]->format( 'Y-m-d' ),
- $dates[$j]->format( 'Y-m-d' ),
- $diff->format( '%a' ),
- $diff->format( '%y-%m-%d' )
- );
- */
+ for ( $j = 0; $j < COUNT * 12; $j++)
+ {
+ $diff = date_diff( $dates[$i], $dates[$j] );
+ /*
+ printf( "\t%s %s %3d %s\n",
+ $dates[$i]->format( 'Y-m-d' ),
+ $dates[$j]->format( 'Y-m-d' ),
+ $diff->format( '%a' ),
+ $diff->format( '%y-%m-%d' )
+ );
+ */
- $current = clone $dates[$i];
- $int = new DateInterval( $diff->format( 'P%yY%mM%dD' ) );
- if ( $current > $dates[$j] )
- {
- $current->sub( $int );
- }
- else
- {
- $current->add( $int );
- }
- if ( $current != $dates[$j] )
- {
- echo "FAIL: ",
- $dates[$i]->format( 'Y-m-d' ), " + ",
- $int->format( '%y-%m-%d' ), " = ",
- $current->format( 'Y-m-d' ), " (",
- $dates[$j]->format( 'Y-m-d' ), ")\n";
- }
- else
- {
- $ok++;
- }
- }
+ $current = clone $dates[$i];
+ $int = new DateInterval( $diff->format( 'P%yY%mM%dD' ) );
+ if ( $current > $dates[$j] )
+ {
+ $current->sub( $int );
+ }
+ else
+ {
+ $current->add( $int );
+ }
+ if ( $current != $dates[$j] )
+ {
+ echo "FAIL: ",
+ $dates[$i]->format( 'Y-m-d' ), " + ",
+ $int->format( '%y-%m-%d' ), " = ",
+ $current->format( 'Y-m-d' ), " (",
+ $dates[$j]->format( 'Y-m-d' ), ")\n";
+ }
+ else
+ {
+ $ok++;
+ }
+ }
}
echo $ok, "\n";
diff --git a/ext/date/tests/date_format_basic1.phpt b/ext/date/tests/date_format_basic1.phpt
index 317386f311..42e8acd669 100644
--- a/ext/date/tests/date_format_basic1.phpt
+++ b/ext/date/tests/date_format_basic1.phpt
@@ -25,7 +25,6 @@ var_dump( date_format($date, 'H:m:s \m \i\s\ \m\o\n\t\h') );
var_dump( date_format($date, "H:i:s") );
?>
-===DONE===
--EXPECT--
*** Testing date_format() : basic functionality ***
string(23) "July 14, 2005, 10:30 pm"
@@ -37,4 +36,3 @@ string(19) "it is the 14th day."
string(28) "Thu Jul 14 22:30:41 BST 2005"
string(19) "22:07:41 m is month"
string(8) "22:30:41"
-===DONE===
diff --git a/ext/date/tests/date_interval_bad_format_leak.phpt b/ext/date/tests/date_interval_bad_format_leak.phpt
new file mode 100644
index 0000000000..d15bf57b3f
--- /dev/null
+++ b/ext/date/tests/date_interval_bad_format_leak.phpt
@@ -0,0 +1,21 @@
+--TEST--
+DateInterval with bad format should not leak period
+--FILE--
+<?php
+
+try {
+ $interval = new DateInterval('P3"D');
+} catch (Exception $e) {
+ echo $e->getMessage(), "\n";
+}
+
+try {
+ $perid = new DatePeriod('P3"D');
+} catch (Exception $e) {
+ echo $e->getMessage(), "\n";
+}
+
+?>
+--EXPECT--
+DateInterval::__construct(): Unknown or bad format (P3"D)
+DatePeriod::__construct(): Unknown or bad format (P3"D)
diff --git a/ext/date/tests/date_interval_prop_dim.phpt b/ext/date/tests/date_interval_prop_dim.phpt
index 3f9af6f472..5d33badebe 100644
--- a/ext/date/tests/date_interval_prop_dim.phpt
+++ b/ext/date/tests/date_interval_prop_dim.phpt
@@ -7,8 +7,8 @@ $z = new Z('P2Y4DT6H8M');
$i = 0;
$z->prop[1]=10;
while ($i < 1026) {
- $z->prop[$i] = $i;
- $i++;
+ $z->prop[$i] = $i;
+ $i++;
}
?>
==NOCRASH==
diff --git a/ext/date/tests/date_isodate_set_basic1.phpt b/ext/date/tests/date_isodate_set_basic1.phpt
index 80149f4325..f28c15b8b1 100644
--- a/ext/date/tests/date_isodate_set_basic1.phpt
+++ b/ext/date/tests/date_isodate_set_basic1.phpt
@@ -29,10 +29,8 @@ date_isodate_set($datetime, 2008, 30, 3);
echo "..same day last year was \"" . date_format($datetime, "D M j") . "\"\n";
?>
-===DONE===
--EXPECT--
*** Testing date_isodate_set() : basic functionality ***
Week 40 of 2009 is in "September"
Week 30 day 3 of 2009 is "Wed Jul 22"
..same day last year was "Wed Jul 23"
-===DONE===
diff --git a/ext/date/tests/date_modify_basic1.phpt b/ext/date/tests/date_modify_basic1.phpt
index 2d9d828db0..c448d6f44f 100644
--- a/ext/date/tests/date_modify_basic1.phpt
+++ b/ext/date/tests/date_modify_basic1.phpt
@@ -29,11 +29,9 @@ date_modify($datetime, "last Sunday");
echo "After modification 4: " . date_format($datetime, "D, d M Y") . "\n";
?>
-===DONE===
--EXPECT--
*** Testing date_modify() : basic functionality ***
After modification 1: Sun, 01 Feb 2009
After modification 2: Tue, 10 Feb 2009 18:28:43
After modification 3: Thu, 12 Feb 2009
After modification 4: Sun, 08 Feb 2009
-===DONE===
diff --git a/ext/date/tests/date_offset_get_basic1.phpt b/ext/date/tests/date_offset_get_basic1.phpt
index 4a92eff376..6b775a9950 100644
--- a/ext/date/tests/date_offset_get_basic1.phpt
+++ b/ext/date/tests/date_offset_get_basic1.phpt
@@ -20,9 +20,7 @@ echo "Winter offset: " . date_offset_get($winter) / 3600 . " hours\n";
echo "Summer offset: " . date_offset_get($summer) / 3600 . " hours\n";
?>
-===DONE===
--EXPECT--
*** Testing date_offset_get() : basic functionality ***
Winter offset: 0 hours
Summer offset: 1 hours
-===DONE===
diff --git a/ext/date/tests/date_parse_001.phpt b/ext/date/tests/date_parse_001.phpt
index b5c5ac0f48..0d58c1f8e9 100644
--- a/ext/date/tests/date_parse_001.phpt
+++ b/ext/date/tests/date_parse_001.phpt
@@ -12,7 +12,6 @@ Test basic date_parse()
var_dump(date_parse("03-03"));
var_dump(date_parse("0-0"));
var_dump(date_parse(""));
- var_dump(date_parse(array()));
echo "Done\n";
?>
--EXPECTF--
@@ -298,7 +297,4 @@ array(12) {
["is_localtime"]=>
bool(false)
}
-
-Warning: date_parse() expects parameter 1 to be string, array given in %sdate_parse_001.php on line %d
-bool(false)
Done
diff --git a/ext/date/tests/date_parse_basic1.phpt b/ext/date/tests/date_parse_basic1.phpt
index a0801d7064..f8af03f6d9 100644
--- a/ext/date/tests/date_parse_basic1.phpt
+++ b/ext/date/tests/date_parse_basic1.phpt
@@ -17,7 +17,6 @@ var_dump( date_parse("10:00:00.5") );
var_dump( date_parse("2009-02-27") );
?>
-===DONE===
--EXPECT--
*** Testing date_parse() : basic functionality ***
array(12) {
@@ -104,4 +103,3 @@ array(12) {
["is_localtime"]=>
bool(false)
}
-===DONE===
diff --git a/ext/date/tests/date_parse_error.phpt b/ext/date/tests/date_parse_error.phpt
index 9f444bb435..24b0094c9e 100644
--- a/ext/date/tests/date_parse_error.phpt
+++ b/ext/date/tests/date_parse_error.phpt
@@ -12,33 +12,14 @@ date_default_timezone_set("Europe/London");
echo "*** Testing date_parse() : error conditions ***\n";
-echo "\n-- Testing date_parse() function with zero arguments --\n";
-var_dump( date_parse() );
-
-echo "\n-- Testing date_parse() function with more than expected no. of arguments --\n";
-$date = "2009-02-27 10:00:00.5";
-$extra_arg = 10;
-var_dump( date_parse($date, $extra_arg) );
-
echo "\n-- Testing date_parse() function with unexpected characters in \$date argument --\n";
$invalid_date = "2OO9-02--27 10:00?00.5";
var_dump( date_parse($invalid_date) );
?>
-===DONE===
--EXPECTF--
*** Testing date_parse() : error conditions ***
--- Testing date_parse() function with zero arguments --
-
-Warning: date_parse() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
--- Testing date_parse() function with more than expected no. of arguments --
-
-Warning: date_parse() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
-
-- Testing date_parse() function with unexpected characters in $date argument --
array(13) {
["year"]=>
@@ -86,4 +67,3 @@ array(13) {
["zone_type"]=>
int(0)
}
-===DONE===
diff --git a/ext/date/tests/date_period-immutable.phpt b/ext/date/tests/date_period-immutable.phpt
index 0ec4b4a130..accc1dc0a3 100644
--- a/ext/date/tests/date_period-immutable.phpt
+++ b/ext/date/tests/date_period-immutable.phpt
@@ -10,18 +10,18 @@ $di = DateInterval::createFromDateString( 'first day of next month' );
foreach ( new DatePeriod( $db1, $di, $de ) as $dt )
{
- echo get_class( $dt ), "\n";
- echo $dt->format( "l Y-m-d\n" );
+ echo get_class( $dt ), "\n";
+ echo $dt->format( "l Y-m-d\n" );
echo $dt->modify( "3 tuesday" )->format( "l Y-m-d\n" );
- echo $dt->format( "l Y-m-d\n\n" );
+ echo $dt->format( "l Y-m-d\n\n" );
}
foreach ( new DatePeriod( $db2, $di, $de ) as $dt )
{
- echo get_class( $dt ), "\n";
- echo $dt->format( "l Y-m-d\n" );
+ echo get_class( $dt ), "\n";
+ echo $dt->format( "l Y-m-d\n" );
echo $dt->modify( "3 tuesday" )->format( "l Y-m-d\n" );
- echo $dt->format( "l Y-m-d\n\n" );
+ echo $dt->format( "l Y-m-d\n\n" );
}
?>
--EXPECT--
diff --git a/ext/date/tests/date_sub_basic.phpt b/ext/date/tests/date_sub_basic.phpt
index 7246ef6347..fc93919d52 100644
--- a/ext/date/tests/date_sub_basic.phpt
+++ b/ext/date/tests/date_sub_basic.phpt
@@ -17,22 +17,21 @@ echo "*** Testing date_sub() : basic functionality ***\n";
$startDate = '2008-01-01 12:25';
$format = 'Y-m-d H:i:s';
$intervals = array(
- 'P3Y6M4DT12H30M5S',
- 'P0D',
- 'P2DT1M',
- 'P1Y2MT23H43M150S'
+ 'P3Y6M4DT12H30M5S',
+ 'P0D',
+ 'P2DT1M',
+ 'P1Y2MT23H43M150S'
);
$d = new DateTime($startDate);
var_dump( $d->format($format) );
foreach($intervals as $interval) {
- date_sub($d, new DateInterval($interval) );
- var_dump( $d->format($format) );
+ date_sub($d, new DateInterval($interval) );
+ var_dump( $d->format($format) );
}
?>
-===DONE===
--EXPECT--
*** Testing date_sub() : basic functionality ***
string(19) "2008-01-01 12:25:00"
@@ -40,4 +39,3 @@ string(19) "2004-06-26 23:54:55"
string(19) "2004-06-26 23:54:55"
string(19) "2004-06-24 23:53:55"
string(19) "2003-04-24 00:08:25"
-===DONE===
diff --git a/ext/date/tests/date_sun_info_001.phpt b/ext/date/tests/date_sun_info_001.phpt
index c9096af46d..708d2550cc 100644
--- a/ext/date/tests/date_sun_info_001.phpt
+++ b/ext/date/tests/date_sun_info_001.phpt
@@ -10,9 +10,9 @@ echo "Done\n";
--EXPECT--
array(9) {
["sunrise"]=>
- int(1165897761)
+ int(1165897682)
["sunset"]=>
- int(1165934160)
+ int(1165934239)
["transit"]=>
int(1165915961)
["civil_twilight_begin"]=>
diff --git a/ext/date/tests/date_sun_info_002.phpt b/ext/date/tests/date_sun_info_002.phpt
index 73956cc46a..1ff58295e3 100644
--- a/ext/date/tests/date_sun_info_002.phpt
+++ b/ext/date/tests/date_sun_info_002.phpt
@@ -6,13 +6,13 @@ date_default_timezone_set('Europe/Oslo');
$sun_info = date_sun_info(strtotime("2007-04-13 08:31:15 UTC"), 59.21, 9.61);
foreach ($sun_info as $key => $elem )
{
- echo date( 'Y-m-d H:i:s T', $elem ), " ", $key, "\n";
+ echo date( 'Y-m-d H:i:s T', $elem ), " ", $key, "\n";
}
echo "Done\n";
?>
--EXPECT--
-2007-04-13 06:13:31 CEST sunrise
-2007-04-13 20:30:51 CEST sunset
+2007-04-13 06:11:26 CEST sunrise
+2007-04-13 20:32:56 CEST sunset
2007-04-13 13:22:11 CEST transit
2007-04-13 05:29:22 CEST civil_twilight_begin
2007-04-13 21:15:00 CEST civil_twilight_end
diff --git a/ext/date/tests/date_sunrise_and_sunset_basic.phpt b/ext/date/tests/date_sunrise_and_sunset_basic.phpt
index f7eb30a3ab..b707c3ccb3 100644
--- a/ext/date/tests/date_sunrise_and_sunset_basic.phpt
+++ b/ext/date/tests/date_sunrise_and_sunset_basic.phpt
@@ -18,9 +18,7 @@ echo date("D M d Y") . ', sunrise time : ' . date_sunrise(time(), SUNFUNCS_RET_S
echo date("D M d Y") . ', sunset time : ' . date_sunset(time(), SUNFUNCS_RET_STRING, 38.4, -9, 90, 1) . "\n";
?>
-===Done===
--EXPECTF--
Basic test for date_sunrise() and date_sunset()
%s %s %d %d, sunrise time : %d:%d
%s %s %d %d, sunset time : %d:%d
-===Done===
diff --git a/ext/date/tests/date_sunrise_variation7.phpt b/ext/date/tests/date_sunrise_variation7.phpt
index d31bf3aaba..9d92d1b58f 100644
--- a/ext/date/tests/date_sunrise_variation7.phpt
+++ b/ext/date/tests/date_sunrise_variation7.phpt
@@ -12,28 +12,27 @@ echo "*** Testing date_sunrise() : usage variation ***\n";
//Timezones with required data for date_sunrise
$inputs = array (
- //Timezone with Latitude, Longitude and GMT offset
- "Pacific/Samoa" => array ("Latitude" => -14.24, "Longitude" => -170.72, "GMT" => -11),
- "US/Alaska" => array ("Latitude" => 61, "Longitude" => -150 , "GMT" => -9),
- "America/Chicago" => array ("Latitude" => 41.85, "Longitude" => -87.65 , "GMT" => -5),
- "America/Montevideo" => array ("Latitude" => -34.88, "Longitude" => -56.18 , "GMT" => -3),
- "Africa/Casablanca" => array ("Latitude" => 33.65, "Longitude" => -7.58, "GMT" => 0),
- "Europe/Moscow" => array ("Latitude" => 55.75, "Longitude" => 37.58, "GMT" => 4),
- "Asia/Hong_Kong" => array ("Latitude" => 22.28, "Longitude" => 114.15 , "GMT" => 8),
- "Australia/Brisbane" => array ("Latitude" => -27.46, "Longitude" => 153.2 , "GMT" => 10),
- "Pacific/Wallis" => array ("Latitude" => -13.3, "Longitude" => -176.16, "GMT" => 12),
+ //Timezone with Latitude, Longitude and GMT offset
+ "Pacific/Samoa" => array ("Latitude" => -14.24, "Longitude" => -170.72, "GMT" => -11),
+ "US/Alaska" => array ("Latitude" => 61, "Longitude" => -150 , "GMT" => -9),
+ "America/Chicago" => array ("Latitude" => 41.85, "Longitude" => -87.65 , "GMT" => -5),
+ "America/Montevideo" => array ("Latitude" => -34.88, "Longitude" => -56.18 , "GMT" => -3),
+ "Africa/Casablanca" => array ("Latitude" => 33.65, "Longitude" => -7.58, "GMT" => 0),
+ "Europe/Moscow" => array ("Latitude" => 55.75, "Longitude" => 37.58, "GMT" => 4),
+ "Asia/Hong_Kong" => array ("Latitude" => 22.28, "Longitude" => 114.15 , "GMT" => 8),
+ "Australia/Brisbane" => array ("Latitude" => -27.46, "Longitude" => 153.2 , "GMT" => 10),
+ "Pacific/Wallis" => array ("Latitude" => -13.3, "Longitude" => -176.16, "GMT" => 12),
);
foreach($inputs as $timezone => $value) {
- date_default_timezone_set($timezone);
- $time = mktime(8, 8, 8, 8, 11, 2008);
- var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $value["Latitude"], $value["Longitude"], 90, $value["GMT"] ));
- $time = mktime(8, 8, 8, 8, 12, 2008);
- var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $value["Latitude"], $value["Longitude"], 90, $value["GMT"]) );
+ date_default_timezone_set($timezone);
+ $time = mktime(8, 8, 8, 8, 11, 2008);
+ var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $value["Latitude"], $value["Longitude"], 90, $value["GMT"] ));
+ $time = mktime(8, 8, 8, 8, 12, 2008);
+ var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $value["Latitude"], $value["Longitude"], 90, $value["GMT"]) );
}
?>
-===DONE===
--EXPECT--
*** Testing date_sunrise() : usage variation ***
string(5) "06:42"
@@ -54,4 +53,3 @@ string(5) "06:23"
string(5) "06:22"
string(5) "06:03"
string(5) "06:02"
-===DONE===
diff --git a/ext/date/tests/date_sunrise_variation8.phpt b/ext/date/tests/date_sunrise_variation8.phpt
index 8ab10bf1c0..d866e3ed7b 100644
--- a/ext/date/tests/date_sunrise_variation8.phpt
+++ b/ext/date/tests/date_sunrise_variation8.phpt
@@ -14,28 +14,27 @@ echo "*** Testing date_sunrise() : usage variation ***\n";
date_default_timezone_set("Africa/Casablanca");
$time_date = array (
- //Date at which Sun is up all day at North Pole
- "12 Aug 2008" => mktime(8, 8, 8, 8, 12, 2008),
- "13 Aug 2008" => mktime(8, 8, 8, 8, 13, 2008),
+ //Date at which Sun is up all day at North Pole
+ "12 Aug 2008" => mktime(8, 8, 8, 8, 12, 2008),
+ "13 Aug 2008" => mktime(8, 8, 8, 8, 13, 2008),
- //Date at which Sun is up all day at South Pole
- "12 Nov 2008" => mktime(8, 8, 8, 11, 12, 2008),
- "13 Nov 2008" => mktime(8, 8, 8, 11, 13, 2008),
+ //Date at which Sun is up all day at South Pole
+ "12 Nov 2008" => mktime(8, 8, 8, 11, 12, 2008),
+ "13 Nov 2008" => mktime(8, 8, 8, 11, 13, 2008),
);
//Iterate over different date and time
foreach( $time_date as $date => $time ){
- echo "\n--$date--\n";
- var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, 90, 0 ) );
- var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, 90, 0 ) );
- var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, 90, 0 ) );
- var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, -90, 0 ) );
- var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, -90, 0 ) );
- var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, -90, 0 ) );
+ echo "\n--$date--\n";
+ var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, 90, 0 ) );
+ var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, 90, 0 ) );
+ var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, 90, 0 ) );
+ var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, -90, 0 ) );
+ var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, -90, 0 ) );
+ var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, -90, 0 ) );
}
?>
-===DONE===
--EXPECT--
*** Testing date_sunrise() : usage variation ***
@@ -70,4 +69,3 @@ bool(false)
bool(false)
bool(false)
bool(false)
-===DONE===
diff --git a/ext/date/tests/date_sunrise_variation9.phpt b/ext/date/tests/date_sunrise_variation9.phpt
deleted file mode 100644
index 75794cc632..0000000000
--- a/ext/date/tests/date_sunrise_variation9.phpt
+++ /dev/null
@@ -1,61 +0,0 @@
---TEST--
-Test date_sunrise() function : usage variation - Passing high positive and negative float values to time argument.
---SKIPIF--
-<?php if (PHP_INT_SIZE != 4) echo "skip this test is for 32-bit only"; ?>
---FILE--
-<?php
-/* Prototype : mixed date_sunrise(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
- * Description: Returns time of sunrise for a given day and location
- * Source code: ext/date/php_date.c
- * Alias to functions:
- */
-
-echo "*** Testing date_sunrise() : usage variation ***\n";
-
-// GMT is zero for the timezone
-date_default_timezone_set("Asia/Calcutta");
-//Initialise the variables
-$latitude = 38.4;
-$longitude = -9;
-$zenith = 90;
-$gmt_offset = 1;
-
-echo "\n-- Testing date_sunrise() function by passing float 12.3456789000e10 value to time --\n";
-$time = 12.3456789000e10;
-var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset) );
-var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $gmt_offset) );
-var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $gmt_offset) );
-
-echo "\n-- Testing date_sunrise() function by passing float -12.3456789000e10 value to time --\n";
-$time = -12.3456789000e10;
-var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset) );
-var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $gmt_offset) );
-var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $gmt_offset) );
-
-?>
-===DONE===
---EXPECTF--
-*** Testing date_sunrise() : usage variation ***
-
--- Testing date_sunrise() function by passing float 12.3456789000e10 value to time --
-
-Warning: date_sunrise() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-
-Warning: date_sunrise() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-
-Warning: date_sunrise() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-
--- Testing date_sunrise() function by passing float -12.3456789000e10 value to time --
-
-Warning: date_sunrise() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-
-Warning: date_sunrise() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-
-Warning: date_sunrise() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/date/tests/date_sunset_variation7.phpt b/ext/date/tests/date_sunset_variation7.phpt
index cb2955702c..380e466c0d 100644
--- a/ext/date/tests/date_sunset_variation7.phpt
+++ b/ext/date/tests/date_sunset_variation7.phpt
@@ -12,28 +12,27 @@ echo "*** Testing date_sunset() : usage variation ***\n";
//Timezones with required data for date_sunrise
$inputs = array (
- //Timezone with Latitude, Longitude and GMT offset
- "Pacific/Samoa" => array ("Latitude" => -14.24, "Longitude" => -170.72, "GMT" => -11),
- "US/Alaska" => array ("Latitude" => 61, "Longitude" => -150 , "GMT" => -9),
- "America/Chicago" => array ("Latitude" => 41.85, "Longitude" => -87.65 , "GMT" => -5),
- "America/Montevideo" => array ("Latitude" => -34.88, "Longitude" => -56.18 , "GMT" => -3),
- "Africa/Casablanca" => array ("Latitude" => 33.65, "Longitude" => "-7.58", "GMT" => 0),
- "Europe/Moscow" => array ("Latitude" => 55.75, "Longitude" => 37.58, "GMT" => 4),
- "Asia/Hong_Kong" => array ("Latitude" => 22.28, "Longitude" => 114.15 , "GMT" => 8),
- "Australia/Brisbane" => array ("Latitude" => -27.46, "Longitude" => 153.2 , "GMT" => 10),
- "Pacific/Wallis" => array ("Latitude" => -13.3, "Longitude" => -176.16, "GMT" => 12),
+ //Timezone with Latitude, Longitude and GMT offset
+ "Pacific/Samoa" => array ("Latitude" => -14.24, "Longitude" => -170.72, "GMT" => -11),
+ "US/Alaska" => array ("Latitude" => 61, "Longitude" => -150 , "GMT" => -9),
+ "America/Chicago" => array ("Latitude" => 41.85, "Longitude" => -87.65 , "GMT" => -5),
+ "America/Montevideo" => array ("Latitude" => -34.88, "Longitude" => -56.18 , "GMT" => -3),
+ "Africa/Casablanca" => array ("Latitude" => 33.65, "Longitude" => "-7.58", "GMT" => 0),
+ "Europe/Moscow" => array ("Latitude" => 55.75, "Longitude" => 37.58, "GMT" => 4),
+ "Asia/Hong_Kong" => array ("Latitude" => 22.28, "Longitude" => 114.15 , "GMT" => 8),
+ "Australia/Brisbane" => array ("Latitude" => -27.46, "Longitude" => 153.2 , "GMT" => 10),
+ "Pacific/Wallis" => array ("Latitude" => -13.3, "Longitude" => -176.16, "GMT" => 12),
);
foreach($inputs as $timezone => $value) {
- echo "\n--$timezone--\n";
- date_default_timezone_set($timezone);
- $time = mktime(8, 8, 8, 8, 11, 2008);
- var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $value["Latitude"], $value["Longitude"], 90, $value["GMT"] ));
- $time = mktime(8, 8, 8, 8, 12, 2008);
- var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $value["Latitude"], $value["Longitude"], 90, $value["GMT"]) );
+ echo "\n--$timezone--\n";
+ date_default_timezone_set($timezone);
+ $time = mktime(8, 8, 8, 8, 11, 2008);
+ var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $value["Latitude"], $value["Longitude"], 90, $value["GMT"] ));
+ $time = mktime(8, 8, 8, 8, 12, 2008);
+ var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $value["Latitude"], $value["Longitude"], 90, $value["GMT"]) );
}
?>
-===DONE===
--EXPECT--
*** Testing date_sunset() : usage variation ***
@@ -72,4 +71,3 @@ string(5) "17:21"
--Pacific/Wallis--
string(5) "17:36"
string(5) "17:36"
-===DONE===
diff --git a/ext/date/tests/date_sunset_variation8.phpt b/ext/date/tests/date_sunset_variation8.phpt
index 518754bc36..a5f6794f62 100644
--- a/ext/date/tests/date_sunset_variation8.phpt
+++ b/ext/date/tests/date_sunset_variation8.phpt
@@ -14,28 +14,27 @@ echo "*** Testing date_sunset() : usage variation ***\n";
date_default_timezone_set("Africa/Casablanca");
$time_date = array (
- //Date at which Sun is up all day at North Pole
- "12 Aug 2008" => mktime(8, 8, 8, 8, 12, 2008),
- "13 Aug 2008" => mktime(8, 8, 8, 8, 13, 2008),
+ //Date at which Sun is up all day at North Pole
+ "12 Aug 2008" => mktime(8, 8, 8, 8, 12, 2008),
+ "13 Aug 2008" => mktime(8, 8, 8, 8, 13, 2008),
- //Date at which Sun is up all day at South Pole
- "12 Nov 2008" => mktime(8, 8, 8, 11, 12, 2008),
- "13 Nov 2008" => mktime(8, 8, 8, 11, 13, 2008),
+ //Date at which Sun is up all day at South Pole
+ "12 Nov 2008" => mktime(8, 8, 8, 11, 12, 2008),
+ "13 Nov 2008" => mktime(8, 8, 8, 11, 13, 2008),
);
//Iterate over different date and time
foreach( $time_date as $date => $time ){
- echo "\n--$date--\n";
- var_dump( date_sunset($time, SUNFUNCS_RET_STRING, 90, 0 ) );
- var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, 90, 0 ) );
- var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, 90, 0 ) );
- var_dump( date_sunset($time, SUNFUNCS_RET_STRING, -90, 0 ) );
- var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, -90, 0 ) );
- var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, -90, 0 ) );
+ echo "\n--$date--\n";
+ var_dump( date_sunset($time, SUNFUNCS_RET_STRING, 90, 0 ) );
+ var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, 90, 0 ) );
+ var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, 90, 0 ) );
+ var_dump( date_sunset($time, SUNFUNCS_RET_STRING, -90, 0 ) );
+ var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, -90, 0 ) );
+ var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, -90, 0 ) );
}
?>
-===DONE===
--EXPECT--
*** Testing date_sunset() : usage variation ***
@@ -70,4 +69,3 @@ bool(false)
bool(false)
bool(false)
bool(false)
-===DONE===
diff --git a/ext/date/tests/date_sunset_variation9.phpt b/ext/date/tests/date_sunset_variation9.phpt
deleted file mode 100644
index 4f897e1df0..0000000000
--- a/ext/date/tests/date_sunset_variation9.phpt
+++ /dev/null
@@ -1,61 +0,0 @@
---TEST--
-Test date_sunset() function : usage variation - Passing high positive and negative float values to time argument.
---SKIPIF--
-<?php if (PHP_INT_SIZE != 4) echo "skip this test is for 32-bit only"; ?>
---FILE--
-<?php
-/* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
- * Description: Returns time of sunset for a given day and location
- * Source code: ext/date/php_date.c
- * Alias to functions:
- */
-
-echo "*** Testing date_sunset() : usage variation ***\n";
-
-// GMT is zero for the timezone
-date_default_timezone_set("Asia/Calcutta");
-//Initialise the variables
-$latitude = 38.4;
-$longitude = -9;
-$zenith = 90;
-$gmt_offset = 1;
-
-echo "\n-- Testing date_sunset() function by passing float 12.3456789000e10 value to time --\n";
-$time = 12.3456789000e10;
-var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset) );
-var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $gmt_offset) );
-var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $gmt_offset) );
-
-echo "\n-- Testing date_sunset() function by passing float -12.3456789000e10 value to time --\n";
-$time = -12.3456789000e10;
-var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset) );
-var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $gmt_offset) );
-var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $gmt_offset) );
-
-?>
-===DONE===
---EXPECTF--
-*** Testing date_sunset() : usage variation ***
-
--- Testing date_sunset() function by passing float 12.3456789000e10 value to time --
-
-Warning: date_sunset() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-
-Warning: date_sunset() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-
-Warning: date_sunset() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-
--- Testing date_sunset() function by passing float -12.3456789000e10 value to time --
-
-Warning: date_sunset() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-
-Warning: date_sunset() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-
-Warning: date_sunset() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/date/tests/date_time_immutable.phpt b/ext/date/tests/date_time_immutable.phpt
index b4a576570e..a7e0348288 100644
--- a/ext/date/tests/date_time_immutable.phpt
+++ b/ext/date/tests/date_time_immutable.phpt
@@ -9,9 +9,9 @@ $current = "2012-12-27 16:24:08";
function dump($a, $b, $c)
{
- echo 'orig: ', $a->format('Y-m-d H:i:s e'), "\n";
- echo 'copy: ', $b->format('Y-m-d H:i:s e'), "\n";
- echo 'changed: ', $c->format('Y-m-d H:i:s e'), "\n";
+ echo 'orig: ', $a->format('Y-m-d H:i:s e'), "\n";
+ echo 'copy: ', $b->format('Y-m-d H:i:s e'), "\n";
+ echo 'changed: ', $c->format('Y-m-d H:i:s e'), "\n";
}
echo "modify():\n";
diff --git a/ext/date/tests/date_time_set_basic1.phpt b/ext/date/tests/date_time_set_basic1.phpt
index 7efdeb62af..d0b714f72f 100644
--- a/ext/date/tests/date_time_set_basic1.phpt
+++ b/ext/date/tests/date_time_set_basic1.phpt
@@ -34,7 +34,6 @@ date_time_set($datetime, 54, 25);
echo "After modification5 " . date_format($datetime, DATE_RFC2822) . "\n";
?>
-===DONE===
--EXPECT--
*** Testing date_time_set() : basic functionality ***
Initial date: Sat, 31 Jan 2009 15:14:10 +0000
@@ -43,4 +42,3 @@ After modification2 Sat, 31 Jan 2009 19:05:59 +0000
After modification3 Sun, 01 Feb 2009 00:10:00 +0000
After modification4 Mon, 02 Feb 2009 23:35:47 +0000
After modification5 Wed, 04 Feb 2009 06:25:00 +0000
-===DONE===
diff --git a/ext/date/tests/date_timezone_get_basic1.phpt b/ext/date/tests/date_timezone_get_basic1.phpt
index 9e8e92cde8..5b2fda596f 100644
--- a/ext/date/tests/date_timezone_get_basic1.phpt
+++ b/ext/date/tests/date_timezone_get_basic1.phpt
@@ -26,10 +26,8 @@ $tz = date_timezone_get($object);
var_dump( timezone_name_get($tz) );
?>
-===DONE===
--EXPECT--
*** Testing date_timezone_get() : basic functionality ***
string(13) "Europe/London"
string(16) "America/New_York"
string(19) "America/Los_Angeles"
-===DONE===
diff --git a/ext/date/tests/date_timezone_set_basic1.phpt b/ext/date/tests/date_timezone_set_basic1.phpt
index bfab43eda6..ef66ff9d3b 100644
--- a/ext/date/tests/date_timezone_set_basic1.phpt
+++ b/ext/date/tests/date_timezone_set_basic1.phpt
@@ -25,9 +25,7 @@ $tz = date_timezone_get($datetime);
echo "New timezone: " . timezone_name_get($tz) . "\n";
?>
-===DONE===
--EXPECT--
*** Testing date_timezone_set() : basic functionality ***
Default timezone: Europe/London
New timezone: America/Los_Angeles
-===DONE===
diff --git a/ext/date/tests/default-timezone-1.phpt b/ext/date/tests/default-timezone-1.phpt
index a53d370afb..6435f85c42 100644
--- a/ext/date/tests/default-timezone-1.phpt
+++ b/ext/date/tests/default-timezone-1.phpt
@@ -3,8 +3,8 @@ date.timezone setting [1]
--FILE--
<?php
date_default_timezone_set('GMT');
- putenv('TZ='); // clean TZ so that it doesn't bypass the ini option
- echo strtotime("2005-06-18 22:15:44");
+ putenv('TZ='); // clean TZ so that it doesn't bypass the ini option
+ echo strtotime("2005-06-18 22:15:44");
?>
--EXPECT--
1119132944
diff --git a/ext/date/tests/default-timezone-2.phpt b/ext/date/tests/default-timezone-2.phpt
index b414eb2af3..7223340388 100644
--- a/ext/date/tests/default-timezone-2.phpt
+++ b/ext/date/tests/default-timezone-2.phpt
@@ -3,8 +3,8 @@ date.timezone setting [2]
--FILE--
<?php
date_default_timezone_set('Europe/Oslo');
- putenv('TZ='); // clean TZ so that it doesn't bypass the ini option
- echo strtotime("2005-06-18 22:15:44");
+ putenv('TZ='); // clean TZ so that it doesn't bypass the ini option
+ echo strtotime("2005-06-18 22:15:44");
?>
--EXPECT--
1119125744
diff --git a/ext/date/tests/examine_diff.inc b/ext/date/tests/examine_diff.inc
index c3dcba9388..8c305f1d36 100644
--- a/ext/date/tests/examine_diff.inc
+++ b/ext/date/tests/examine_diff.inc
@@ -33,47 +33,47 @@ define('PHPT_DATETIME_SHOW_SUB', 4);
* @return void
*/
function examine_diff($end_date, $start_date, $expect_spec, $expect_days, $absolute = false) {
- if (is_string($start_date)) {
- $start = new DateTime($start_date);
- } else {
- $start = $start_date;
- }
- $start_date = $start->format('Y-m-d H:i:s T');
+ if (is_string($start_date)) {
+ $start = new DateTime($start_date);
+ } else {
+ $start = $start_date;
+ }
+ $start_date = $start->format('Y-m-d H:i:s T');
- if (is_string($end_date)) {
- $end = new DateTime($end_date);
- } else {
- $end = $end_date;
- }
- $end_date = $end->format('Y-m-d H:i:s T');
+ if (is_string($end_date)) {
+ $end = new DateTime($end_date);
+ } else {
+ $end = $end_date;
+ }
+ $end_date = $end->format('Y-m-d H:i:s T');
- $expect_interval = new DateInterval('P' . substr($expect_spec, 2));
- if (substr($expect_spec, 1, 1) == '-') {
- $expect_interval->invert = true;
- }
+ $expect_interval = new DateInterval('P' . substr($expect_spec, 2));
+ if (substr($expect_spec, 1, 1) == '-') {
+ $expect_interval->invert = true;
+ }
- if (PHPT_DATETIME_SHOW == PHPT_DATETIME_SHOW_DIFF) {
- $result_interval = $start->diff($end, $absolute);
- $result_spec = $result_interval->format('P%R%yY%mM%dDT%hH%iM%sS');
- echo "DIFF: $end_date - $start_date = **$result_spec**\n";
- // echo "DIFF: $end_date - $start_date = **$expect_spec**\n";
- }
- if (PHPT_DATETIME_SHOW == PHPT_DATETIME_SHOW_DAYS) {
- $result_interval = $start->diff($end, $absolute);
- $result_days = $result_interval->format('%a');
- echo "DAYS: **$result_days**\n";
- // echo "DAYS: **$expect_days**\n";
- }
- if (PHPT_DATETIME_SHOW == PHPT_DATETIME_SHOW_ADD) {
- $start->add($expect_interval);
- $result_end_date = $start->format('Y-m-d H:i:s T');
- echo "ADD: $start_date + $expect_spec = **$result_end_date**\n";
- // echo "ADD: $start_date + $expect_spec = **$end_date**\n";
- }
- if (PHPT_DATETIME_SHOW == PHPT_DATETIME_SHOW_SUB) {
- $end->sub($expect_interval);
- $result_start_date = $end->format('Y-m-d H:i:s T');
- echo "SUB: $end_date - $expect_spec = **$result_start_date**\n";
- // echo "SUB: $end_date - $expect_spec = **$start_date**\n";
- }
+ if (PHPT_DATETIME_SHOW == PHPT_DATETIME_SHOW_DIFF) {
+ $result_interval = $start->diff($end, $absolute);
+ $result_spec = $result_interval->format('P%R%yY%mM%dDT%hH%iM%sS');
+ echo "DIFF: $end_date - $start_date = **$result_spec**\n";
+ // echo "DIFF: $end_date - $start_date = **$expect_spec**\n";
+ }
+ if (PHPT_DATETIME_SHOW == PHPT_DATETIME_SHOW_DAYS) {
+ $result_interval = $start->diff($end, $absolute);
+ $result_days = $result_interval->format('%a');
+ echo "DAYS: **$result_days**\n";
+ // echo "DAYS: **$expect_days**\n";
+ }
+ if (PHPT_DATETIME_SHOW == PHPT_DATETIME_SHOW_ADD) {
+ $start->add($expect_interval);
+ $result_end_date = $start->format('Y-m-d H:i:s T');
+ echo "ADD: $start_date + $expect_spec = **$result_end_date**\n";
+ // echo "ADD: $start_date + $expect_spec = **$end_date**\n";
+ }
+ if (PHPT_DATETIME_SHOW == PHPT_DATETIME_SHOW_SUB) {
+ $end->sub($expect_interval);
+ $result_start_date = $end->format('Y-m-d H:i:s T');
+ echo "SUB: $end_date - $expect_spec = **$result_start_date**\n";
+ // echo "SUB: $end_date - $expect_spec = **$start_date**\n";
+ }
}
diff --git a/ext/date/tests/format-negative-timestamp.phpt b/ext/date/tests/format-negative-timestamp.phpt
index 5fd6a65897..d8268ddc68 100644
--- a/ext/date/tests/format-negative-timestamp.phpt
+++ b/ext/date/tests/format-negative-timestamp.phpt
@@ -9,13 +9,13 @@ $max = getrandmax();
$max_2 = $max / 2;
while($i--) {
- $new_tm = rand(1, $max);
- if ($new_tm > $max_2)
- $new_tm *= -1;
+ $new_tm = rand(1, $max);
+ if ($new_tm > $max_2)
+ $new_tm *= -1;
- if (strtotime("@$new_tm") != $new_tm) {
- echo "Error when parsing: @$new_tm\n";
- }
+ if (strtotime("@$new_tm") != $new_tm) {
+ echo "Error when parsing: @$new_tm\n";
+ }
}
echo "done!";
diff --git a/ext/date/tests/getdate_basic.phpt b/ext/date/tests/getdate_basic.phpt
index eed29c6e4b..730f409636 100644
--- a/ext/date/tests/getdate_basic.phpt
+++ b/ext/date/tests/getdate_basic.phpt
@@ -22,7 +22,6 @@ var_dump( getdate($timestamp) );
var_dump( getdate() );
?>
-===DONE===
--EXPECTF--
*** Testing getdate() : basic functionality ***
array(11) {
@@ -73,4 +72,3 @@ array(11) {
[0]=>
int(%d)
}
-===DONE===
diff --git a/ext/date/tests/getdate_variation2.phpt b/ext/date/tests/getdate_variation2.phpt
index 1e0d771afe..2081e31762 100644
--- a/ext/date/tests/getdate_variation2.phpt
+++ b/ext/date/tests/getdate_variation2.phpt
@@ -16,10 +16,10 @@ date_default_timezone_set("Asia/Calcutta");
//array of values to iterate over
$inputs = array(
- //octal values
- 'octal 05' => 05,
- 'octal 010' => 010,
- 'octal -010' => -010,
+ //octal values
+ 'octal 05' => 05,
+ 'octal 010' => 010,
+ 'octal -010' => -010,
);
// loop through each element of the array for timestamp
@@ -30,7 +30,6 @@ foreach($inputs as $key =>$value) {
};
?>
-===DONE===
--EXPECT--
*** Testing getdate() : usage variation ***
@@ -111,4 +110,3 @@ array(11) {
[0]=>
int(-8)
}
-===DONE===
diff --git a/ext/date/tests/getdate_variation3.phpt b/ext/date/tests/getdate_variation3.phpt
index 27c49a71e2..ebcc3bf23f 100644
--- a/ext/date/tests/getdate_variation3.phpt
+++ b/ext/date/tests/getdate_variation3.phpt
@@ -16,10 +16,10 @@ date_default_timezone_set("Asia/Calcutta");
//array of values to iterate over
$inputs = array(
- //octal values
- 'hexadcimal 0x5' => 0x5,
- 'hexadcimal 0xCAFE' => 0xCAFE,
- 'octal -0xCAFE' => -0xCAFE,
+ //octal values
+ 'hexadcimal 0x5' => 0x5,
+ 'hexadcimal 0xCAFE' => 0xCAFE,
+ 'octal -0xCAFE' => -0xCAFE,
);
// loop through each element of the array for timestamp
@@ -30,7 +30,6 @@ foreach($inputs as $key =>$value) {
};
?>
-===DONE===
--EXPECT--
*** Testing getdate() : usage variation ***
@@ -111,4 +110,3 @@ array(11) {
[0]=>
int(-51966)
}
-===DONE===
diff --git a/ext/date/tests/getdate_variation4.phpt b/ext/date/tests/getdate_variation4.phpt
index 49e2311c2e..48bcc1fd8d 100644
--- a/ext/date/tests/getdate_variation4.phpt
+++ b/ext/date/tests/getdate_variation4.phpt
@@ -16,11 +16,11 @@ date_default_timezone_set("Asia/Calcutta");
//array of values to iterate over
$inputs = array(
- //Year wise time stamps
- '01 Jan 1970' => 0,
- '01 Jan 1971' => 31536000,
- '01 Jan 1972' => 63072000,
- '01 Jan 1973' => 94694400,
+ //Year wise time stamps
+ '01 Jan 1970' => 0,
+ '01 Jan 1971' => 31536000,
+ '01 Jan 1972' => 63072000,
+ '01 Jan 1973' => 94694400,
);
// loop through each element of the array for timestamp
@@ -31,7 +31,6 @@ foreach($inputs as $key =>$value) {
};
?>
-===DONE===
--EXPECT--
*** Testing getdate() : usage variation ***
@@ -138,4 +137,3 @@ array(11) {
[0]=>
int(94694400)
}
-===DONE===
diff --git a/ext/date/tests/getdate_variation5.phpt b/ext/date/tests/getdate_variation5.phpt
index f9c525ab4b..8c61c5bb61 100644
--- a/ext/date/tests/getdate_variation5.phpt
+++ b/ext/date/tests/getdate_variation5.phpt
@@ -12,20 +12,20 @@ echo "*** Testing getdate() : usage variation ***\n";
//Timezones with required data for date_sunrise
$inputs = array (
- //GMT-11
- "Pacific/Samoa",
- //GMT-9
- "US/Alaska",
- //GMT-0
- "Africa/Casablanca",
- //GMT+4
- "Europe/Moscow",
- //GMT+8
- "Asia/Hong_Kong",
- //GMT+10
- "Australia/Brisbane",
- //GMT+12
- "Pacific/Wallis",
+ //GMT-11
+ "Pacific/Samoa",
+ //GMT-9
+ "US/Alaska",
+ //GMT-0
+ "Africa/Casablanca",
+ //GMT+4
+ "Europe/Moscow",
+ //GMT+8
+ "Asia/Hong_Kong",
+ //GMT+10
+ "Australia/Brisbane",
+ //GMT+12
+ "Pacific/Wallis",
);
// loop through each element of the array for timestamp
@@ -35,7 +35,6 @@ foreach($inputs as $timezone) {
var_dump( getdate(0) );
};
?>
-===DONE===
--EXPECT--
*** Testing getdate() : usage variation ***
@@ -220,4 +219,3 @@ array(11) {
[0]=>
int(0)
}
-===DONE===
diff --git a/ext/date/tests/getdate_variation6.phpt b/ext/date/tests/getdate_variation6.phpt
index a859afae1b..e5a98ac1a6 100644
--- a/ext/date/tests/getdate_variation6.phpt
+++ b/ext/date/tests/getdate_variation6.phpt
@@ -14,9 +14,9 @@ date_default_timezone_set("Asia/Calcutta");
//Timezones with required data for date_sunrise
$inputs = array (
- 'String 0' => '0',
- 'String 10.5' => "10.5",
- 'String -10.5' => '-10.5',
+ 'String 0' => '0',
+ 'String 10.5' => "10.5",
+ 'String -10.5' => '-10.5',
);
// loop through each element of the array for timestamp
@@ -25,7 +25,6 @@ foreach($inputs as $key => $value) {
var_dump( getdate($value) );
};
?>
-===DONE===
--EXPECT--
*** Testing getdate() : usage variation ***
@@ -106,4 +105,3 @@ array(11) {
[0]=>
int(-10)
}
-===DONE===
diff --git a/ext/date/tests/getdate_variation7.phpt b/ext/date/tests/getdate_variation7.phpt
deleted file mode 100644
index e24f3e6d84..0000000000
--- a/ext/date/tests/getdate_variation7.phpt
+++ /dev/null
@@ -1,37 +0,0 @@
---TEST--
-Test getdate() function : usage variation - Passing high positive and negative float values to timestamp.
---SKIPIF--
-<?php if (PHP_INT_SIZE != 4) echo "skip this test is for 32-bit only"; ?>
---FILE--
-<?php
-/* Prototype : array getdate([int timestamp])
- * Description: Get date/time information
- * Source code: ext/date/php_date.c
- * Alias to functions:
- */
-
-echo "*** Testing getdate() : usage variation ***\n";
-date_default_timezone_set("Asia/Calcutta");
-
-echo "\n-- Testing getdate() function by passing float 12.3456789000e10 value to timestamp --\n";
-$timestamp = 12.3456789000e10;
-var_dump( getdate($timestamp) );
-
-echo "\n-- Testing getdate() function by passing float -12.3456789000e10 value to timestamp --\n";
-$timestamp = -12.3456789000e10;
-var_dump( getdate($timestamp) );
-?>
-===DONE===
---EXPECTF--
-*** Testing getdate() : usage variation ***
-
--- Testing getdate() function by passing float 12.3456789000e10 value to timestamp --
-
-Warning: getdate() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-
--- Testing getdate() function by passing float -12.3456789000e10 value to timestamp --
-
-Warning: getdate() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/date/tests/gettimeofday_basic.phpt b/ext/date/tests/gettimeofday_basic.phpt
index f982130752..16314839b3 100644
--- a/ext/date/tests/gettimeofday_basic.phpt
+++ b/ext/date/tests/gettimeofday_basic.phpt
@@ -28,7 +28,6 @@ $get_as_float = false;
var_dump( gettimeofday($get_as_float) );
?>
-===DONE===
--EXPECTF--
*** Testing gettimeofday() : basic functionality ***
float(%f)
@@ -52,4 +51,3 @@ array(4) {
["dsttime"]=>
int(0)
}
-===DONE===
diff --git a/ext/date/tests/gmdate_basic.phpt b/ext/date/tests/gmdate_basic.phpt
index 3ebde84d62..118d7f656f 100644
--- a/ext/date/tests/gmdate_basic.phpt
+++ b/ext/date/tests/gmdate_basic.phpt
@@ -22,9 +22,7 @@ var_dump( gmdate($format, $timestamp) );
var_dump( gmdate($format) );
?>
-===DONE===
--EXPECTF--
*** Testing gmdate() : basic functionality ***
string(24) "2008-08-08T08:08:08+0000"
string(%d) "%s"
-===DONE===
diff --git a/ext/date/tests/gmdate_variation10.phpt b/ext/date/tests/gmdate_variation10.phpt
index fd72d5bf75..1de17d2ab1 100644
--- a/ext/date/tests/gmdate_variation10.phpt
+++ b/ext/date/tests/gmdate_variation10.phpt
@@ -39,7 +39,6 @@ var_dump( gmdate('T') );
var_dump( gmdate('T', $timestamp) );
?>
-===DONE===
--EXPECTF--
*** Testing gmdate() : usage variation ***
@@ -66,4 +65,3 @@ string(3) "GMT"
-- Testing gmdate() function with timezone offset format --
string(3) "GMT"
string(3) "GMT"
-===DONE===
diff --git a/ext/date/tests/gmdate_variation11.phpt b/ext/date/tests/gmdate_variation11.phpt
index 601864d829..cd3fda5c1d 100644
--- a/ext/date/tests/gmdate_variation11.phpt
+++ b/ext/date/tests/gmdate_variation11.phpt
@@ -27,7 +27,6 @@ var_dump( gmdate('U') );
var_dump( gmdate('U', $timestamp) );
?>
-===DONE===
--EXPECTF--
*** Testing gmdate() : usage variation ***
@@ -42,4 +41,3 @@ string(31) "Fri, 08 Aug 2008 08:08:08 +0000"
-- Testing gmdate() function with seconds since Unix Epoch format --
string(%d) "%d"
string(10) "1218182888"
-===DONE===
diff --git a/ext/date/tests/gmdate_variation12.phpt b/ext/date/tests/gmdate_variation12.phpt
index 60bb69a32a..38af31db3c 100644
--- a/ext/date/tests/gmdate_variation12.phpt
+++ b/ext/date/tests/gmdate_variation12.phpt
@@ -30,7 +30,6 @@ $timestamp = mktime(03, 14, 10, 1, 19, 2038);
var_dump( gmdate(DATE_ISO8601, $timestamp) );
?>
-===DONE===
--EXPECTREGEX--
\*\*\* Testing gmdate\(\) : usage variation \*\*\*
@@ -45,4 +44,3 @@ string\(24\) "2038-01-19T03:14:07\+0000"
-- Testing gmdate\(\) function with greater than the range of timestamp --
string\(24\) "(1970-01-01T00:00:00\+0000|2038-01-19T03:14:10\+0000)"
-===DONE===
diff --git a/ext/date/tests/gmdate_variation13.phpt b/ext/date/tests/gmdate_variation13.phpt
index 58103ec9f4..877671b926 100644
--- a/ext/date/tests/gmdate_variation13.phpt
+++ b/ext/date/tests/gmdate_variation13.phpt
@@ -17,26 +17,25 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008);
$inputs = array(
// Predefined Date constants
'DATE_ATOM Constant' => DATE_ATOM,
- 'DATE_COOKIE Constant' => DATE_COOKIE,
- 'DATE_RFC822 Constant' => DATE_RFC822,
- 'DATE_RFC850 Constant' => DATE_RFC850,
- 'DATE_RFC1036 Constant' => DATE_RFC1036,
- 'DATE_RFC1123 Constant' => DATE_RFC1123,
- 'DATE_RFC2822 Constant' => DATE_RFC2822,
- 'DATE_RFC3339 Constant' => DATE_RFC3339,
- 'DATE_RSS Constant' => DATE_RSS,
- 'DATE_W3C Constant' => DATE_W3C,
+ 'DATE_COOKIE Constant' => DATE_COOKIE,
+ 'DATE_RFC822 Constant' => DATE_RFC822,
+ 'DATE_RFC850 Constant' => DATE_RFC850,
+ 'DATE_RFC1036 Constant' => DATE_RFC1036,
+ 'DATE_RFC1123 Constant' => DATE_RFC1123,
+ 'DATE_RFC2822 Constant' => DATE_RFC2822,
+ 'DATE_RFC3339 Constant' => DATE_RFC3339,
+ 'DATE_RSS Constant' => DATE_RSS,
+ 'DATE_W3C Constant' => DATE_W3C,
);
// loop through each element of the array for format
foreach($inputs as $key =>$value) {
echo "\n--$key--\n";
- var_dump( gmdate($value, $timestamp) );
- var_dump( gmdate($value) );
+ var_dump( gmdate($value, $timestamp) );
+ var_dump( gmdate($value) );
};
?>
-===DONE===
--EXPECTF--
*** Testing gmdate() : usage variation ***
@@ -79,4 +78,3 @@ string(%d) "%s"
--DATE_W3C Constant--
string(25) "2008-08-08T08:08:08+00:00"
string(%d) "%s"
-===DONE===
diff --git a/ext/date/tests/gmdate_variation14.phpt b/ext/date/tests/gmdate_variation14.phpt
deleted file mode 100644
index 5b6c48fca5..0000000000
--- a/ext/date/tests/gmdate_variation14.phpt
+++ /dev/null
@@ -1,40 +0,0 @@
---TEST--
-Test gmdate() function : usage variation - Passing high positive and negetive float values to timestamp.
---SKIPIF--
-<?php if (PHP_INT_SIZE != 4) echo "skip this test is for 32-bit only"; ?>
---FILE--
-<?php
-/* Prototype : string gmdate(string format [, long timestamp])
- * Description: Format a GMT date/time
- * Source code: ext/date/php_date.c
- */
-
-echo "*** Testing gmdate() : usage variation ***\n";
-
-// Initialise all required variables
-date_default_timezone_set('UTC');
-$format = DATE_ISO8601;
-
-echo "\n-- Testing gmdate() function with float 12.3456789000e10 to timestamp --\n";
-$timestamp = 12.3456789000e10;
-var_dump( gmdate($format, $timestamp) );
-
-echo "\n-- Testing gmdate() function with float -12.3456789000e10 to timestamp --\n";
-$timestamp = -12.3456789000e10;
-var_dump( gmdate($format, $timestamp) );
-
-?>
-===DONE===
---EXPECTF--
-*** Testing gmdate() : usage variation ***
-
--- Testing gmdate() function with float 12.3456789000e10 to timestamp --
-
-Warning: gmdate() expects parameter 2 to be int, float given in %s on line %d
-bool(false)
-
--- Testing gmdate() function with float -12.3456789000e10 to timestamp --
-
-Warning: gmdate() expects parameter 2 to be int, float given in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/date/tests/gmdate_variation3.phpt b/ext/date/tests/gmdate_variation3.phpt
index 8e13182a64..c9ee765476 100644
--- a/ext/date/tests/gmdate_variation3.phpt
+++ b/ext/date/tests/gmdate_variation3.phpt
@@ -17,11 +17,11 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008);
//array of values to iterate over
$inputs = array(
- 'Day with leading zeros' => 'd',
- 'Day without leading zeros' => 'j',
- 'ISO representation' => 'N',
- 'Numeric representation of day' => 'w',
- 'Day of the year' => 'z'
+ 'Day with leading zeros' => 'd',
+ 'Day without leading zeros' => 'j',
+ 'ISO representation' => 'N',
+ 'Numeric representation of day' => 'w',
+ 'Day of the year' => 'z'
);
// loop through each element of the array for timestamp
@@ -33,7 +33,6 @@ foreach($inputs as $key =>$value) {
};
?>
-===DONE===
--EXPECTF--
*** Testing gmdate() : usage variation ***
@@ -56,4 +55,3 @@ string(1) "5"
--Day of the year--
string(%d) "%d"
string(3) "220"
-===DONE===
diff --git a/ext/date/tests/gmdate_variation4.phpt b/ext/date/tests/gmdate_variation4.phpt
index a23877923a..0b4a25fff4 100644
--- a/ext/date/tests/gmdate_variation4.phpt
+++ b/ext/date/tests/gmdate_variation4.phpt
@@ -27,7 +27,6 @@ var_dump( gmdate('S') );
var_dump( gmdate('S', $timestamp) );
?>
-===DONE===
--EXPECTF--
*** Testing gmdate() : usage variation ***
@@ -42,4 +41,3 @@ string(6) "Friday"
-- Testing gmdate() function with English ordinal suffix --
string(%d) "%s"
string(2) "th"
-===DONE===
diff --git a/ext/date/tests/gmdate_variation5.phpt b/ext/date/tests/gmdate_variation5.phpt
index 0127fc5876..cd8b0d581f 100644
--- a/ext/date/tests/gmdate_variation5.phpt
+++ b/ext/date/tests/gmdate_variation5.phpt
@@ -19,11 +19,9 @@ var_dump( gmdate('W') );
var_dump( gmdate('W', $timestamp) );
?>
-===DONE===
--EXPECTF--
*** Testing gmdate() : usage variation ***
-- Testing gmdate() function with ISO-8601 week number of year format --
string(%d) "%d"
string(2) "32"
-===DONE===
diff --git a/ext/date/tests/gmdate_variation6.phpt b/ext/date/tests/gmdate_variation6.phpt
index f5d8684ec7..456f85a2f2 100644
--- a/ext/date/tests/gmdate_variation6.phpt
+++ b/ext/date/tests/gmdate_variation6.phpt
@@ -35,7 +35,6 @@ var_dump( gmdate('t') );
var_dump( gmdate('t', $timestamp) );
?>
-===DONE===
--EXPECTF--
*** Testing gmdate() : usage variation ***
@@ -58,4 +57,3 @@ string(1) "8"
-- Testing gmdate() function with number of days in a month format --
string(%d) "%d"
string(2) "31"
-===DONE===
diff --git a/ext/date/tests/gmdate_variation7.phpt b/ext/date/tests/gmdate_variation7.phpt
index 1b590ad75b..8f1698d960 100644
--- a/ext/date/tests/gmdate_variation7.phpt
+++ b/ext/date/tests/gmdate_variation7.phpt
@@ -35,7 +35,6 @@ var_dump( gmdate('y') );
var_dump( gmdate('y', $timestamp) );
?>
-===DONE===
--EXPECTF--
*** Testing gmdate() : usage variation ***
@@ -57,4 +56,3 @@ string(4) "2008"
-- Testing gmdate() function with 2 digit representation year format --
string(2) "%d"
string(2) "08"
-===DONE===
diff --git a/ext/date/tests/gmdate_variation9.phpt b/ext/date/tests/gmdate_variation9.phpt
index 85c4e72042..cd43217d08 100644
--- a/ext/date/tests/gmdate_variation9.phpt
+++ b/ext/date/tests/gmdate_variation9.phpt
@@ -17,25 +17,24 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008);
$time_formats = array(
'Lowercase Ante meridiem and post meridiem' => 'a',
- 'Uppercase Ante meridiem and post meridiem' => 'a',
- 'Swatch Internet time' => 'B',
- '12-hour format without leading zeros' => 'g',
- '24-hour format without leading zeros' => 'G',
- '12-hour format with leading zeros' => 'h',
- '24-hour format with leading zeros' => 'H',
- 'Minutes with leading zeros' => 'i',
- 'Seconds with leading zeros' => 's',
- 'Milliseconds' => 'u',
+ 'Uppercase Ante meridiem and post meridiem' => 'a',
+ 'Swatch Internet time' => 'B',
+ '12-hour format without leading zeros' => 'g',
+ '24-hour format without leading zeros' => 'G',
+ '12-hour format with leading zeros' => 'h',
+ '24-hour format with leading zeros' => 'H',
+ 'Minutes with leading zeros' => 'i',
+ 'Seconds with leading zeros' => 's',
+ 'Milliseconds' => 'u',
);
foreach($time_formats as $key =>$value) {
echo "\n--$key--\n";
- var_dump( gmdate($value) );
- var_dump( gmdate($value, $timestamp) );
+ var_dump( gmdate($value) );
+ var_dump( gmdate($value, $timestamp) );
}
?>
-===DONE===
--EXPECTF--
*** Testing gmdate() : usage variation ***
@@ -78,4 +77,3 @@ string(2) "08"
--Milliseconds--
string(%d) "%d"
string(6) "000000"
-===DONE===
diff --git a/ext/date/tests/gmmktime_basic.phpt b/ext/date/tests/gmmktime_basic.phpt
index cdb44f0c62..303bd9b010 100644
--- a/ext/date/tests/gmmktime_basic.phpt
+++ b/ext/date/tests/gmmktime_basic.phpt
@@ -21,15 +21,7 @@ $year = 2008;
// Calling gmmktime() with all possible arguments
var_dump( gmmktime($hour, $min, $sec, $mon, $day, $year) );
-// Calling gmmktime() with mandatory arguments
-var_dump( gmmktime() );
-
?>
-===DONE===
--EXPECTF--
*** Testing gmmktime() : basic functionality ***
int(1218182888)
-
-Deprecated: gmmktime(): You should be using the time() function instead in %s on line %d
-int(%d)
-===DONE===
diff --git a/ext/date/tests/gmmktime_variation7.phpt b/ext/date/tests/gmmktime_variation7.phpt
index 223da1cc71..e943f7db15 100644
--- a/ext/date/tests/gmmktime_variation7.phpt
+++ b/ext/date/tests/gmmktime_variation7.phpt
@@ -33,7 +33,6 @@ echo "\n-- Testing gmmktime() function with five optional argument --\n";
var_dump( gmmktime($hour, $min, $sec, $mon, $day) );
?>
-===DONE===
--EXPECTF--
*** Testing gmmktime() : usage variation ***
@@ -51,4 +50,3 @@ int(%d)
-- Testing gmmktime() function with five optional argument --
int(%d)
-===DONE===
diff --git a/ext/date/tests/gmmktime_variation8.phpt b/ext/date/tests/gmmktime_variation8.phpt
index ab6e45e342..4bbbe6eb4e 100644
--- a/ext/date/tests/gmmktime_variation8.phpt
+++ b/ext/date/tests/gmmktime_variation8.phpt
@@ -32,7 +32,6 @@ $year = 0x7D8;
echo "\n-- Testing gmmktime() function with supplying hexa decimal values to arguments --\n";
var_dump( gmmktime($hour, $min, $sec, $mon, $day, $year) );
?>
-===DONE===
--EXPECT--
*** Testing gmmktime() : usage variation ***
@@ -41,4 +40,3 @@ int(1218182888)
-- Testing gmmktime() function with supplying hexa decimal values to arguments --
int(1218182888)
-===DONE===
diff --git a/ext/date/tests/gmmktime_variation9.phpt b/ext/date/tests/gmmktime_variation9.phpt
index 1d1750b9b5..40c4d3a39d 100644
--- a/ext/date/tests/gmmktime_variation9.phpt
+++ b/ext/date/tests/gmmktime_variation9.phpt
@@ -20,7 +20,7 @@ $year = 2008;
$inputs = array(
- 'float 123456' => 123456,
+ 'float 123456' => 123456,
'float -123456' => -123456,
'float -10.5' => -10.5,
);
@@ -28,14 +28,13 @@ $inputs = array(
// loop through each element of the array for min
foreach($inputs as $key =>$value) {
echo "\n--$key--\n";
- var_dump( gmmktime($value, $min, $sec, $mon, $day, $year) );
- var_dump( gmmktime($hour, $value, $sec, $mon, $day, $year) );
- var_dump( gmmktime($hour, $min, $value, $mon, $day, $year) );
- var_dump( gmmktime($hour, $min, $sec, $value, $day, $year) );
- var_dump( gmmktime($hour, $min, $sec, $mon, $value, $value) );
+ var_dump( gmmktime($value, $min, $sec, $mon, $day, $year) );
+ var_dump( gmmktime($hour, $value, $sec, $mon, $day, $year) );
+ var_dump( gmmktime($hour, $min, $value, $mon, $day, $year) );
+ var_dump( gmmktime($hour, $min, $sec, $value, $day, $year) );
+ var_dump( gmmktime($hour, $min, $sec, $mon, $value, $value) );
}
?>
-===DONE===
--EXPECTREGEX--
\*\*\* Testing gmmktime\(\) : usage variation \*\*\*
@@ -59,4 +58,3 @@ int\(1218181808\)
int\(1218182870\)
int\(1170922088\)
(bool|int)\((false|-62465356312)\)
-===DONE===
diff --git a/ext/date/tests/gmstrftime_basic.phpt b/ext/date/tests/gmstrftime_basic.phpt
index 1accff5127..7c83b147a2 100644
--- a/ext/date/tests/gmstrftime_basic.phpt
+++ b/ext/date/tests/gmstrftime_basic.phpt
@@ -21,9 +21,7 @@ var_dump( gmstrftime($format, $timestamp) );
var_dump( gmstrftime($format) );
?>
-===DONE===
--EXPECTF--
*** Testing gmstrftime() : basic functionality ***
string(20) "Aug 08 2008 08:08:08"
string(%d) "%s %d %d %d:%d:%d"
-===DONE===
diff --git a/ext/date/tests/gmstrftime_variation10.phpt b/ext/date/tests/gmstrftime_variation10.phpt
index 70cca370ba..b20a3ecbe7 100644
--- a/ext/date/tests/gmstrftime_variation10.phpt
+++ b/ext/date/tests/gmstrftime_variation10.phpt
@@ -23,8 +23,8 @@ date_default_timezone_set("Asia/Calcutta");
//array of values to iterate over
$inputs = array(
- 'The ISO 8601:1988 week number' => "%V",
- 'Weekday as decimal' => "%u",
+ 'The ISO 8601:1988 week number' => "%V",
+ 'Weekday as decimal' => "%u",
);
// loop through each element of the array for timestamp
@@ -36,7 +36,6 @@ foreach($inputs as $key =>$value) {
};
?>
-===DONE===
--EXPECTF--
*** Testing gmstrftime() : usage variation ***
@@ -47,4 +46,3 @@ string(2) "32"
--Weekday as decimal--
string(%d) "%d"
string(1) "5"
-===DONE===
diff --git a/ext/date/tests/gmstrftime_variation11.phpt b/ext/date/tests/gmstrftime_variation11.phpt
index f64c3ea1e2..7e7ac1c8fd 100644
--- a/ext/date/tests/gmstrftime_variation11.phpt
+++ b/ext/date/tests/gmstrftime_variation11.phpt
@@ -21,11 +21,9 @@ var_dump( gmstrftime($format) );
var_dump( gmstrftime($format, $timestamp) );
?>
-===DONE===
--EXPECTF--
*** Testing gmstrftime() : usage variation ***
-- Testing gmstrftime() function with Abbreviated month name format %h --
string(%d) "%s"
string(3) "Aug"
-===DONE===
diff --git a/ext/date/tests/gmstrftime_variation12.phpt b/ext/date/tests/gmstrftime_variation12.phpt
index 96d034b2d2..42f100a1f1 100644
--- a/ext/date/tests/gmstrftime_variation12.phpt
+++ b/ext/date/tests/gmstrftime_variation12.phpt
@@ -27,11 +27,9 @@ var_dump( gmstrftime($format) );
var_dump( gmstrftime($format, $timestamp) );
?>
-===DONE===
--EXPECTF--
*** Testing gmstrftime() : usage variation ***
-- Testing gmstrftime() function with Abbreviated month name format %h --
string(%d) "%s"
string(3) "Aug"
-===DONE===
diff --git a/ext/date/tests/gmstrftime_variation13.phpt b/ext/date/tests/gmstrftime_variation13.phpt
index 9a7a9b3c4b..a237e9dc8b 100644
--- a/ext/date/tests/gmstrftime_variation13.phpt
+++ b/ext/date/tests/gmstrftime_variation13.phpt
@@ -17,10 +17,10 @@ date_default_timezone_set("Asia/Calcutta");
//array of values to iterate over
$inputs = array(
- 'Century number' => "%C",
- 'Month Date Year' => "%D",
- 'Year with century' => "%G",
- 'Year without century' => "%g",
+ 'Century number' => "%C",
+ 'Month Date Year' => "%D",
+ 'Year with century' => "%G",
+ 'Year without century' => "%g",
);
// loop through each element of the array for timestamp
@@ -32,7 +32,6 @@ foreach($inputs as $key =>$value) {
};
?>
-===DONE===
--EXPECTF--
*** Testing gmstrftime() : usage variation ***
@@ -51,4 +50,3 @@ string(4) "2008"
--Year without century--
string(2) "%d"
string(2) "08"
-===DONE===
diff --git a/ext/date/tests/gmstrftime_variation14.phpt b/ext/date/tests/gmstrftime_variation14.phpt
index fca6829231..c53f5ea2f0 100644
--- a/ext/date/tests/gmstrftime_variation14.phpt
+++ b/ext/date/tests/gmstrftime_variation14.phpt
@@ -23,10 +23,10 @@ date_default_timezone_set("Asia/Calcutta");
//array of values to iterate over
$inputs = array(
- 'Century number' => "%C",
- 'Month Date Year' => "%D",
- 'Year with century' => "%G",
- 'Year without century' => "%g",
+ 'Century number' => "%C",
+ 'Month Date Year' => "%D",
+ 'Year with century' => "%G",
+ 'Year without century' => "%g",
);
// loop through each element of the array for timestamp
@@ -38,7 +38,6 @@ foreach($inputs as $key =>$value) {
};
?>
-===DONE===
--EXPECTF--
*** Testing gmstrftime() : usage variation ***
@@ -57,4 +56,3 @@ string(4) "2008"
--Year without century--
string(%d) "%d"
string(2) "08"
-===DONE===
diff --git a/ext/date/tests/gmstrftime_variation15.phpt b/ext/date/tests/gmstrftime_variation15.phpt
index ac91c66a9e..02907f846c 100644
--- a/ext/date/tests/gmstrftime_variation15.phpt
+++ b/ext/date/tests/gmstrftime_variation15.phpt
@@ -17,9 +17,9 @@ date_default_timezone_set("Asia/Calcutta");
//array of values to iterate over
$inputs = array(
- 'Time in a.m/p.m notation' => "%r",
- 'Time in 24 hour notation' => "%R",
- 'Current time %H:%M:%S format' => "%T",
+ 'Time in a.m/p.m notation' => "%r",
+ 'Time in 24 hour notation' => "%R",
+ 'Current time %H:%M:%S format' => "%T",
);
// loop through each element of the array for timestamp
@@ -31,7 +31,6 @@ foreach($inputs as $key =>$value) {
};
?>
-===DONE===
--EXPECTF--
*** Testing gmstrftime() : usage variation ***
@@ -46,4 +45,3 @@ string(5) "08:08"
--Current time %H:%M:%S format--
string(%d) "%d:%d:%d"
string(8) "08:08:08"
-===DONE===
diff --git a/ext/date/tests/gmstrftime_variation16.phpt b/ext/date/tests/gmstrftime_variation16.phpt
index 762c954163..74be81747a 100644
--- a/ext/date/tests/gmstrftime_variation16.phpt
+++ b/ext/date/tests/gmstrftime_variation16.phpt
@@ -23,9 +23,9 @@ date_default_timezone_set("Asia/Calcutta");
//array of values to iterate over
$inputs = array(
- 'Time in a.m/p.m notation' => "%r",
- 'Time in 24 hour notation' => "%R",
- 'Current time %H:%M:%S format' => "%T",
+ 'Time in a.m/p.m notation' => "%r",
+ 'Time in 24 hour notation' => "%R",
+ 'Current time %H:%M:%S format' => "%T",
);
// loop through each element of the array for timestamp
@@ -37,7 +37,6 @@ foreach($inputs as $key =>$value) {
};
?>
-===DONE===
--EXPECTF--
*** Testing gmstrftime() : usage variation ***
@@ -52,4 +51,3 @@ string(5) "14:08"
--Current time %H:%M:%S format--
string(%d) "%d:%d:%d"
string(8) "14:08:08"
-===DONE===
diff --git a/ext/date/tests/gmstrftime_variation17.phpt b/ext/date/tests/gmstrftime_variation17.phpt
index 9abdb76e0c..9ff60af277 100644
--- a/ext/date/tests/gmstrftime_variation17.phpt
+++ b/ext/date/tests/gmstrftime_variation17.phpt
@@ -21,11 +21,9 @@ var_dump( gmstrftime($format) );
var_dump( gmstrftime($format, $timestamp) );
?>
-===DONE===
--EXPECTF--
*** Testing gmstrftime() : usage variation ***
-- Testing gmstrftime() function with Day of the month as decimal single digit format --
string(2) "%A%d"
string(2) " 8"
-===DONE===
diff --git a/ext/date/tests/gmstrftime_variation18.phpt b/ext/date/tests/gmstrftime_variation18.phpt
index f74d82229b..74912dfa48 100644
--- a/ext/date/tests/gmstrftime_variation18.phpt
+++ b/ext/date/tests/gmstrftime_variation18.phpt
@@ -27,11 +27,9 @@ var_dump( gmstrftime($format) );
var_dump( gmstrftime($format, $timestamp) );
?>
-===DONE===
--EXPECTF--
*** Testing gmstrftime() : usage variation ***
-- Testing gmstrftime() function with Day of the month as decimal single digit format --
string(%d) "%s"
string(2) " 8"
-===DONE===
diff --git a/ext/date/tests/gmstrftime_variation19.phpt b/ext/date/tests/gmstrftime_variation19.phpt
index 983911fa48..8dc6923923 100644
--- a/ext/date/tests/gmstrftime_variation19.phpt
+++ b/ext/date/tests/gmstrftime_variation19.phpt
@@ -17,8 +17,8 @@ date_default_timezone_set("Asia/Calcutta");
//array of values to iterate over
$inputs = array(
- 'Newline character' => "%n",
- 'Tab character' => "%t"
+ 'Newline character' => "%n",
+ 'Tab character' => "%t"
);
// loop through each element of the array for timestamp
@@ -30,7 +30,6 @@ foreach($inputs as $key =>$value) {
};
?>
-===DONE===
--EXPECT--
*** Testing gmstrftime() : usage variation ***
@@ -43,4 +42,3 @@ string(1) "
--Tab character--
string(1) " "
string(1) " "
-===DONE===
diff --git a/ext/date/tests/gmstrftime_variation20.phpt b/ext/date/tests/gmstrftime_variation20.phpt
index 135520e37c..2c6ab02364 100644
--- a/ext/date/tests/gmstrftime_variation20.phpt
+++ b/ext/date/tests/gmstrftime_variation20.phpt
@@ -23,8 +23,8 @@ date_default_timezone_set("Asia/Calcutta");
//array of values to iterate over
$inputs = array(
- 'Newline character' => "%n",
- 'Tab character' => "%t"
+ 'Newline character' => "%n",
+ 'Tab character' => "%t"
);
// loop through each element of the array for timestamp
@@ -36,7 +36,6 @@ foreach($inputs as $key =>$value) {
};
?>
-===DONE===
--EXPECTREGEX--
\*\*\* Testing gmstrftime\(\) : usage variation \*\*\*
@@ -49,4 +48,3 @@ string\(1\) "
--Tab character--
string\(1\) "\s"
string\(1\) "\s"
-===DONE===
diff --git a/ext/date/tests/gmstrftime_variation21.phpt b/ext/date/tests/gmstrftime_variation21.phpt
index 8ff050fc9a..9ffbf82b24 100644
--- a/ext/date/tests/gmstrftime_variation21.phpt
+++ b/ext/date/tests/gmstrftime_variation21.phpt
@@ -18,8 +18,8 @@ date_default_timezone_set("Asia/Calcutta");
//array of values to iterate over
$inputs = array(
'Preferred date and time representation' => "%c",
- 'Preferred date representation' => "%x",
- 'Preferred time representation' => "%X",
+ 'Preferred date representation' => "%x",
+ 'Preferred time representation' => "%X",
);
// loop through each element of the array for timestamp
@@ -31,7 +31,6 @@ foreach($inputs as $key =>$value) {
};
?>
-===DONE===
--EXPECTF--
*** Testing gmstrftime() : usage variation ***
@@ -46,4 +45,3 @@ string(8) "08/08/08"
--Preferred time representation--
string(%d) "%d:%d:%d"
string(8) "08:08:08"
-===DONE===
diff --git a/ext/date/tests/gmstrftime_variation22.phpt b/ext/date/tests/gmstrftime_variation22.phpt
index 1a69726f67..e907254227 100644
--- a/ext/date/tests/gmstrftime_variation22.phpt
+++ b/ext/date/tests/gmstrftime_variation22.phpt
@@ -28,8 +28,8 @@ date_default_timezone_set("Asia/Calcutta");
//array of values to iterate over
$inputs = array(
'Preferred date and time representation' => "%c",
- 'Preferred date representation' => "%x",
- 'Preferred time representation' => "%X",
+ 'Preferred date representation' => "%x",
+ 'Preferred time representation' => "%X",
);
// loop through each element of the array for timestamp
@@ -41,7 +41,6 @@ foreach($inputs as $key =>$value) {
};
?>
-===DONE===
--EXPECT--
*** Testing gmstrftime() : usage variation ***
@@ -56,4 +55,3 @@ string(8) "08/08/08"
--Preferred time representation--
string(2) "%X"
string(8) "08:08:08"
-===DONE===
diff --git a/ext/date/tests/gmstrftime_variation3.phpt b/ext/date/tests/gmstrftime_variation3.phpt
index aebb938a77..b33e543e12 100644
--- a/ext/date/tests/gmstrftime_variation3.phpt
+++ b/ext/date/tests/gmstrftime_variation3.phpt
@@ -17,8 +17,8 @@ $timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
$inputs = array(
'Abbreviated weekday name' => "%a",
'Full weekday name' => "%A",
- 'Week number of the year' => "%U",
- 'Week number of the year in decimal number' => "%W",
+ 'Week number of the year' => "%U",
+ 'Week number of the year in decimal number' => "%W",
);
// loop through each element of the array for timestamp
@@ -30,7 +30,6 @@ foreach($inputs as $key =>$value) {
};
?>
-===DONE===
--EXPECTF--
*** Testing gmstrftime() : usage variation ***
@@ -49,4 +48,3 @@ string(2) "31"
--Week number of the year in decimal number--
string(%d) "%d"
string(2) "31"
-===DONE===
diff --git a/ext/date/tests/gmstrftime_variation4.phpt b/ext/date/tests/gmstrftime_variation4.phpt
index 3ec4e06e17..97ffb8f75f 100644
--- a/ext/date/tests/gmstrftime_variation4.phpt
+++ b/ext/date/tests/gmstrftime_variation4.phpt
@@ -17,7 +17,7 @@ $timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
$inputs = array(
'Abbreviated month name' => "%b",
'Full month name' => "%B",
- 'Month as decimal' => "%m",
+ 'Month as decimal' => "%m",
);
// loop through each element of the array for timestamp
@@ -29,7 +29,6 @@ foreach($inputs as $key =>$value) {
};
?>
-===DONE===
--EXPECTF--
*** Testing gmstrftime() : usage variation ***
@@ -44,4 +43,3 @@ string(6) "August"
--Month as decimal--
string(%d) "%d"
string(2) "08"
-===DONE===
diff --git a/ext/date/tests/gmstrftime_variation5.phpt b/ext/date/tests/gmstrftime_variation5.phpt
index c43c1e3740..ca4c9e5e64 100644
--- a/ext/date/tests/gmstrftime_variation5.phpt
+++ b/ext/date/tests/gmstrftime_variation5.phpt
@@ -18,10 +18,10 @@ date_default_timezone_set("Asia/Calcutta");
//array of values to iterate over
$inputs = array(
- 'Year as decimal number without a century' => "%y",
- 'Year as decimal number including the century' => "%Y",
- 'Time zone offset' => "%Z",
- 'Time zone offset' => "%z",
+ 'Year as decimal number without a century' => "%y",
+ 'Year as decimal number including the century' => "%Y",
+ 'Time zone offset' => "%Z",
+ 'Time zone offset' => "%z",
);
// loop through each element of the array for timestamp
@@ -33,7 +33,6 @@ foreach($inputs as $key =>$value) {
};
?>
-===DONE===
--EXPECTF--
*** Testing gmstrftime() : usage variation ***
@@ -48,4 +47,3 @@ string(4) "2008"
--Time zone offset--
string(%s) "%s"
string(%s) "%s"
-===DONE===
diff --git a/ext/date/tests/gmstrftime_variation6.phpt b/ext/date/tests/gmstrftime_variation6.phpt
index f09df7847b..a00d27af5c 100644
--- a/ext/date/tests/gmstrftime_variation6.phpt
+++ b/ext/date/tests/gmstrftime_variation6.phpt
@@ -17,11 +17,11 @@ date_default_timezone_set("Asia/Calcutta");
//array of values to iterate over
$inputs = array(
- 'Hour as decimal by 24-hour format' => "%H",
- 'Hour as decimal by 12-hour format' => "%I",
- 'Minute as decimal number' => "%M",
- 'AM/PM format for a time' => "%p",
- 'Second as decimal number' => "%S",
+ 'Hour as decimal by 24-hour format' => "%H",
+ 'Hour as decimal by 12-hour format' => "%I",
+ 'Minute as decimal number' => "%M",
+ 'AM/PM format for a time' => "%p",
+ 'Second as decimal number' => "%S",
);
// loop through each element of the array for timestamp
@@ -33,7 +33,6 @@ foreach($inputs as $key =>$value) {
};
?>
-===DONE===
--EXPECTF--
*** Testing gmstrftime() : usage variation ***
@@ -56,4 +55,3 @@ string(2) "AM"
--Second as decimal number--
string(%d) "%d"
string(2) "08"
-===DONE===
diff --git a/ext/date/tests/gmstrftime_variation7.phpt b/ext/date/tests/gmstrftime_variation7.phpt
index 4cb69e1d2f..4f2c5876f2 100644
--- a/ext/date/tests/gmstrftime_variation7.phpt
+++ b/ext/date/tests/gmstrftime_variation7.phpt
@@ -17,9 +17,9 @@ date_default_timezone_set("Asia/Calcutta");
//array of values to iterate over
$inputs = array(
- 'Day of the month as a decimal number' => "%d",
- 'Day of the year as a decimal number' => "%j",
- 'Day of the week as a decimal number' => "%w"
+ 'Day of the month as a decimal number' => "%d",
+ 'Day of the year as a decimal number' => "%j",
+ 'Day of the week as a decimal number' => "%w"
);
// loop through each element of the array for timestamp
@@ -31,7 +31,6 @@ foreach($inputs as $key =>$value) {
};
?>
-===DONE===
--EXPECTF--
*** Testing gmstrftime() : usage variation ***
@@ -46,4 +45,3 @@ string(3) "221"
--Day of the week as a decimal number--
string(%d) "%d"
string(1) "5"
-===DONE===
diff --git a/ext/date/tests/gmstrftime_variation8.phpt b/ext/date/tests/gmstrftime_variation8.phpt
index 311956586a..26ba201039 100644
--- a/ext/date/tests/gmstrftime_variation8.phpt
+++ b/ext/date/tests/gmstrftime_variation8.phpt
@@ -17,7 +17,7 @@ date_default_timezone_set("Asia/Calcutta");
//array of values to iterate over
$inputs = array(
- 'A literal % character' => "%%",
+ 'A literal % character' => "%%",
);
// loop through each element of the array for timestamp
@@ -29,11 +29,9 @@ foreach($inputs as $key =>$value) {
};
?>
-===DONE===
--EXPECT--
*** Testing gmstrftime() : usage variation ***
--A literal % character--
string(1) "%"
string(1) "%"
-===DONE===
diff --git a/ext/date/tests/gmstrftime_variation9.phpt b/ext/date/tests/gmstrftime_variation9.phpt
index 560ea2db47..a6910675dc 100644
--- a/ext/date/tests/gmstrftime_variation9.phpt
+++ b/ext/date/tests/gmstrftime_variation9.phpt
@@ -17,8 +17,8 @@ date_default_timezone_set("Asia/Calcutta");
//array of values to iterate over
$inputs = array(
- 'The ISO 8601:1988 week number' => "%V",
- 'Weekday as decimal' => "%u",
+ 'The ISO 8601:1988 week number' => "%V",
+ 'Weekday as decimal' => "%u",
);
// loop through each element of the array for timestamp
@@ -30,7 +30,6 @@ foreach($inputs as $key =>$value) {
};
?>
-===DONE===
--EXPECTF--
*** Testing gmstrftime() : usage variation ***
@@ -41,4 +40,3 @@ string(2) "32"
--Weekday as decimal--
string(1) "%d"
string(1) "5"
-===DONE===
diff --git a/ext/date/tests/idate_basic.phpt b/ext/date/tests/idate_basic.phpt
index 2306a5f64f..86aace6c4b 100644
--- a/ext/date/tests/idate_basic.phpt
+++ b/ext/date/tests/idate_basic.phpt
@@ -17,8 +17,6 @@ $format = 'Y';
date_default_timezone_set("Asia/Calcutta");
var_dump( idate($format) );
?>
-===DONE===
--EXPECTF--
*** Testing idate() : basic functionality ***
int(%d)
-===DONE===
diff --git a/ext/date/tests/idate_variation3.phpt b/ext/date/tests/idate_variation3.phpt
deleted file mode 100644
index 9b6bc567e0..0000000000
--- a/ext/date/tests/idate_variation3.phpt
+++ /dev/null
@@ -1,41 +0,0 @@
---TEST--
-Test idate() function : usage variation - Passing higher positive and negetive float values to timestamp.
---SKIPIF--
-<?php if (PHP_INT_SIZE != 4) echo "skip this test is for 32-bit only"; ?>
---FILE--
-<?php
-/* Prototype : int idate(string format [, int timestamp])
- * Description: Format a local time/date as integer
- * Source code: ext/date/php_date.c
- * Alias to functions:
- */
-
-echo "*** Testing idate() : usage variation ***\n";
-
-// Initialise function arguments not being substituted (if any)
-$format = 'Y';
-date_default_timezone_set("Asia/Calcutta");
-
-echo "\n-- Testing idate() function with float 12.3456789000e10 to timestamp --\n";
-$timestamp = 12.3456789000e10;
-var_dump( idate($format, $timestamp) );
-
-echo "\n-- Testing idate() function with float -12.3456789000e10 to timestamp --\n";
-$timestamp = -12.3456789000e10;
-var_dump( idate($format, $timestamp) );
-
-?>
-===DONE===
---EXPECTF--
-*** Testing idate() : usage variation ***
-
--- Testing idate() function with float 12.3456789000e10 to timestamp --
-
-Warning: idate() expects parameter 2 to be int, float given in %s on line %d
-bool(false)
-
--- Testing idate() function with float -12.3456789000e10 to timestamp --
-
-Warning: idate() expects parameter 2 to be int, float given in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/date/tests/idate_variation4.phpt b/ext/date/tests/idate_variation4.phpt
index 15be180790..8d928c9d56 100644
--- a/ext/date/tests/idate_variation4.phpt
+++ b/ext/date/tests/idate_variation4.phpt
@@ -16,15 +16,15 @@ date_default_timezone_set("Asia/Calcutta");
//array of values to iterate over
$inputs = array(
- 'Day of the month' => 'd',
- 'Leap Year' =>'L',
- 'Month number' => 'm',
- 'Days in the month' => 't',
- 'Day of the week' => 'w',
- 'ISO-8601 week number' => 'W',
- 'Year (1 or 2 digits)' => 'y',
- 'Year 4 digits' => 'Y',
- 'Day of the year' => 'z',
+ 'Day of the month' => 'd',
+ 'Leap Year' =>'L',
+ 'Month number' => 'm',
+ 'Days in the month' => 't',
+ 'Day of the week' => 'w',
+ 'ISO-8601 week number' => 'W',
+ 'Year (1 or 2 digits)' => 'y',
+ 'Year 4 digits' => 'Y',
+ 'Day of the year' => 'z',
);
// loop through each element of the array for timestamp
@@ -33,7 +33,6 @@ foreach($inputs as $key =>$value) {
var_dump( idate($value) );
};
?>
-===DONE===
--EXPECTF--
*** Testing idate() : usage variation ***
@@ -63,4 +62,3 @@ int(%d)
--Day of the year--
int(%d)
-===DONE===
diff --git a/ext/date/tests/idate_variation5.phpt b/ext/date/tests/idate_variation5.phpt
index 6064a9e989..246e5f38a0 100644
--- a/ext/date/tests/idate_variation5.phpt
+++ b/ext/date/tests/idate_variation5.phpt
@@ -17,13 +17,13 @@ date_default_timezone_set("Asia/Calcutta");
$inputs = array(
'Internet Time' => 'B',
- '12 hour format' => 'h',
- '24 hour format' => 'H',
- 'Minutes' => 'i',
- 'DST Activated' => 'I',
- 'Seconds' => 's',
- 'Seconds since Unix Epoch' => 'U',
- 'Time zone offset' => 'Z'
+ '12 hour format' => 'h',
+ '24 hour format' => 'H',
+ 'Minutes' => 'i',
+ 'DST Activated' => 'I',
+ 'Seconds' => 's',
+ 'Seconds since Unix Epoch' => 'U',
+ 'Time zone offset' => 'Z'
);
// loop through each element of the array for timestamp
@@ -32,7 +32,6 @@ foreach($inputs as $key =>$value) {
var_dump( idate($value) );
};
?>
-===DONE===
--EXPECTF--
*** Testing idate() : usage variation ***
@@ -59,4 +58,3 @@ int(%d)
--Time zone offset--
int(%d)
-===DONE===
diff --git a/ext/date/tests/idate_variation6.phpt b/ext/date/tests/idate_variation6.phpt
index 28afc93c52..500befb4b7 100644
--- a/ext/date/tests/idate_variation6.phpt
+++ b/ext/date/tests/idate_variation6.phpt
@@ -22,7 +22,6 @@ echo "\n-- Testing idate() function for 2 digit year having zero as starting num
$timestamp = mktime(8, 8, 8, 8, 8, 2001);
var_dump( idate($format, $timestamp) );
?>
-===DONE===
--EXPECT--
*** Testing idate() : usage variation ***
@@ -31,4 +30,3 @@ int(70)
-- Testing idate() function for 2 digit year having zero as starting number --
int(1)
-===DONE===
diff --git a/ext/date/tests/localtime_basic.phpt b/ext/date/tests/localtime_basic.phpt
index e957e53fc7..709531e4e0 100644
--- a/ext/date/tests/localtime_basic.phpt
+++ b/ext/date/tests/localtime_basic.phpt
@@ -27,7 +27,6 @@ var_dump( localtime($timestamp) );
var_dump( localtime() );
?>
-===DONE===
--EXPECTF--
*** Testing localtime() : basic functionality ***
array(9) {
@@ -90,4 +89,3 @@ array(9) {
[8]=>
int(%d)
}
-===DONE===
diff --git a/ext/date/tests/localtime_variation3.phpt b/ext/date/tests/localtime_variation3.phpt
deleted file mode 100644
index 42731dc6ce..0000000000
--- a/ext/date/tests/localtime_variation3.phpt
+++ /dev/null
@@ -1,50 +0,0 @@
---TEST--
-Test localtime() function : usage variation - Passing higher positive and negetive float values to timestamp.
---SKIPIF--
-<?php if (PHP_INT_SIZE != 4) echo "skip this test is for 32-bit only"; ?>
---FILE--
-<?php
-/* Prototype : array localtime([int timestamp [, bool associative_array]])
- * Description: Returns the results of the C system call localtime as an associative array
- * if the associative_array argument is set to 1 other wise it is a regular array
- * Source code: ext/date/php_date.c
- * Alias to functions:
- */
-
-echo "*** Testing localtime() : usage variation ***\n";
-
-date_default_timezone_set("UTC");
-// Initialise function arguments not being substituted (if any)
-$is_associative = true;
-
-echo "\n-- Testing localtime() function with 'float 12.3456789000e10' to timestamp --\n";
-$timestamp = 12.3456789000e10;
-var_dump( localtime($timestamp) );
-var_dump( localtime($timestamp, $is_associative) );
-
-echo "\n-- Testing localtime() function with 'float -12.3456789000e10' to timestamp --\n";
-$timestamp = -12.3456789000e10;
-var_dump( localtime($timestamp) );
-var_dump( localtime($timestamp, $is_associative) );
-
-?>
-===DONE===
---EXPECTF--
-*** Testing localtime() : usage variation ***
-
--- Testing localtime() function with 'float 12.3456789000e10' to timestamp --
-
-Warning: localtime() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-
-Warning: localtime() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-
--- Testing localtime() function with 'float -12.3456789000e10' to timestamp --
-
-Warning: localtime() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-
-Warning: localtime() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/date/tests/localtime_variation4.phpt b/ext/date/tests/localtime_variation4.phpt
index 99015a399e..0898547302 100644
--- a/ext/date/tests/localtime_variation4.phpt
+++ b/ext/date/tests/localtime_variation4.phpt
@@ -19,18 +19,17 @@ $is_associative = true;
$inputs = array(
'Octal 0' => 00,
- 'Octal 10' => 012,
- 'Octal -10' => -012
+ 'Octal 10' => 012,
+ 'Octal -10' => -012
);
foreach($inputs as $key =>$value) {
echo "\n--$key--\n";
- var_dump( localtime($value) );
- var_dump( localtime($value, $is_associative) );
+ var_dump( localtime($value) );
+ var_dump( localtime($value, $is_associative) );
}
?>
-===DONE===
--EXPECT--
*** Testing localtime() : usage variation ***
@@ -159,4 +158,3 @@ array(9) {
["tm_isdst"]=>
int(0)
}
-===DONE===
diff --git a/ext/date/tests/localtime_variation5.phpt b/ext/date/tests/localtime_variation5.phpt
index 172d3d4942..b7d9e1ae63 100644
--- a/ext/date/tests/localtime_variation5.phpt
+++ b/ext/date/tests/localtime_variation5.phpt
@@ -19,18 +19,17 @@ $is_associative = true;
$inputs = array(
'Hexa-decimal 0' => 0x0,
- 'Hexa-decimal 10' => 0xA,
- 'Hexa-decimal -10' => -0XA
+ 'Hexa-decimal 10' => 0xA,
+ 'Hexa-decimal -10' => -0XA
);
foreach($inputs as $key =>$value) {
echo "\n--$key--\n";
- var_dump( localtime($value) );
- var_dump( localtime($value, $is_associative) );
+ var_dump( localtime($value) );
+ var_dump( localtime($value, $is_associative) );
}
?>
-===DONE===
--EXPECT--
*** Testing localtime() : usage variation ***
@@ -159,4 +158,3 @@ array(9) {
["tm_isdst"]=>
int(0)
}
-===DONE===
diff --git a/ext/date/tests/microtime_basic.phpt b/ext/date/tests/microtime_basic.phpt
index a9045947cb..e70809b1fa 100644
--- a/ext/date/tests/microtime_basic.phpt
+++ b/ext/date/tests/microtime_basic.phpt
@@ -12,9 +12,7 @@ var_dump(microtime(true));
var_dump(microtime(false));
?>
-===DONE===
--EXPECTF--
string(%d) "%s %s"
float(%s)
string(%d) "%s %s"
-===DONE===
diff --git a/ext/date/tests/microtime_error.phpt b/ext/date/tests/microtime_error.phpt
index 699416d382..0736d3cf24 100644
--- a/ext/date/tests/microtime_error.phpt
+++ b/ext/date/tests/microtime_error.phpt
@@ -7,35 +7,26 @@ Test wrong number of arguments for microtime()
* Function is implemented in ext/standard/microtime.c
*/
-$opt_arg_0 = true;
-$extra_arg = 1;
-
-echo "\n-- Too many arguments --\n";
-var_dump(microtime($opt_arg_0, $extra_arg));
-
-
echo "\n-- Bad Arg types --\n";
$bad_args = array(null,
- 1.5,
- "hello",
- array('k'=>'v', array(0)),
- new stdClass,
- 1);
+ 1.5,
+ "hello",
+ array('k'=>'v', array(0)),
+ new stdClass,
+ 1);
foreach ($bad_args as $bad_arg) {
- echo "\n--> bad arg: ";
- var_dump($bad_arg);
- var_dump(microtime($bad_arg));
+ echo "\n--> bad arg: ";
+ var_dump($bad_arg);
+ try {
+ var_dump(microtime($bad_arg));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
}
?>
-===DONE===
--EXPECTF--
--- Too many arguments --
-
-Warning: microtime() expects at most 1 parameter, 2 given in %s on line 11
-NULL
-
-- Bad Arg types --
--> bad arg: NULL
@@ -56,16 +47,11 @@ float(%s)
int(0)
}
}
-
-Warning: microtime() expects parameter 1 to be bool, array given in %s on line 25
-NULL
+microtime() expects parameter 1 to be bool, array given
--> bad arg: object(stdClass)#%d (0) {
}
-
-Warning: microtime() expects parameter 1 to be bool, object given in %s on line 25
-NULL
+microtime() expects parameter 1 to be bool, object given
--> bad arg: int(1)
float(%s)
-===DONE===
diff --git a/ext/date/tests/mktime-3-64bit.phpt b/ext/date/tests/mktime-3-64bit.phpt
index f415cbf2d6..5d06f9393f 100644
--- a/ext/date/tests/mktime-3-64bit.phpt
+++ b/ext/date/tests/mktime-3-64bit.phpt
@@ -10,18 +10,18 @@ $tzs = array("America/Toronto", "Europe/Oslo");
$years = array(0, 69, 70, 71, 99, 100, 101, 105, 110, 1900, 1901, 1902, 1999, 2000, 2001);
foreach ($tzs as $tz) {
- echo $tz, "\n";
- date_default_timezone_set($tz);
- foreach ($years as $year) {
- printf("Y: %4d - ", $year);
- $ret = mktime(1, 1, 1, 1, 1, $year);
- if ($ret == FALSE) {
- echo "out of range\n";
- } else {
- echo date("F ".DATE_ISO8601, $ret), "\n";
- }
- }
- echo "\n";
+ echo $tz, "\n";
+ date_default_timezone_set($tz);
+ foreach ($years as $year) {
+ printf("Y: %4d - ", $year);
+ $ret = mktime(1, 1, 1, 1, 1, $year);
+ if ($ret == FALSE) {
+ echo "out of range\n";
+ } else {
+ echo date("F ".DATE_ISO8601, $ret), "\n";
+ }
+ }
+ echo "\n";
}
?>
--EXPECTF--
diff --git a/ext/date/tests/mktime-3.phpt b/ext/date/tests/mktime-3.phpt
index cc16083965..b054efd076 100644
--- a/ext/date/tests/mktime-3.phpt
+++ b/ext/date/tests/mktime-3.phpt
@@ -10,21 +10,20 @@ $tzs = array("America/Toronto", "Europe/Oslo");
$years = array(0, 69, 70, 71, 99, 100, 105, 1900, 1901, 1902, 1999, 2000, 2001);
foreach ($tzs as $tz) {
- echo $tz, "\n";
- date_default_timezone_set($tz);
- foreach ($years as $year) {
- printf("Y: %4d - ", $year);
- $ret = mktime(1, 1, 1, 1, 1, $year);
- if ($ret == FALSE) {
- echo "out of range\n";
- } else {
- echo date("F ".DATE_ISO8601, $ret), "\n";
- }
- }
- echo "\n";
+ echo $tz, "\n";
+ date_default_timezone_set($tz);
+ foreach ($years as $year) {
+ printf("Y: %4d - ", $year);
+ $ret = mktime(1, 1, 1, 1, 1, $year);
+ if ($ret == FALSE) {
+ echo "out of range\n";
+ } else {
+ echo date("F ".DATE_ISO8601, $ret), "\n";
+ }
+ }
+ echo "\n";
}
?>
-===Done===
--EXPECT--
America/Toronto
Y: 0 - January 2000-01-01T01:01:01-0500
@@ -56,4 +55,3 @@ Y: 1999 - January 1999-01-01T01:01:01+0100
Y: 2000 - January 2000-01-01T01:01:01+0100
Y: 2001 - January 2001-01-01T01:01:01+0100
-===Done===
diff --git a/ext/date/tests/mktime_basic1.phpt b/ext/date/tests/mktime_basic1.phpt
index 955c05f55c..d0965f2f83 100644
--- a/ext/date/tests/mktime_basic1.phpt
+++ b/ext/date/tests/mktime_basic1.phpt
@@ -28,7 +28,6 @@ var_dump( mktime($hour, $minute, $sec, $month, $day) );
var_dump( mktime($hour, $minute, $sec, $month, $day, $year) );
?>
-===DONE===
--EXPECTF--
*** Testing DateTime::modify() : basic functionality ***
int(%i)
@@ -37,4 +36,3 @@ int(%i)
int(%i)
int(%i)
int(%i)
-===DONE===
diff --git a/ext/date/tests/mktime_error.phpt b/ext/date/tests/mktime_error.phpt
index a24d189fb1..e40e40f38d 100644
--- a/ext/date/tests/mktime_error.phpt
+++ b/ext/date/tests/mktime_error.phpt
@@ -14,7 +14,11 @@ date_default_timezone_set("Europe/London");
echo "*** Testing mktime() : error conditions ***\n";
echo "\n-- Testing mktime() function with Zero arguments --\n";
-var_dump( mktime() );
+try {
+ var_dump( mktime() );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "\n-- Testing mktime() function with more than expected no. of arguments --\n";
$hour = 10;
@@ -24,20 +28,18 @@ $month = 7;
$day = 2;
$year = 1963;
$extra_arg = 10;
-var_dump( mktime($hour, $minute, $sec, $month, $day, $year, $extra_arg) );
+try {
+ var_dump( mktime($hour, $minute, $sec, $month, $day, $year, $extra_arg) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
-===DONE===
--EXPECTF--
*** Testing mktime() : error conditions ***
-- Testing mktime() function with Zero arguments --
-
-Deprecated: mktime(): You should be using the time() function instead in %s on line %d
-int(%d)
+mktime() expects at least 1 parameter, 0 given
-- Testing mktime() function with more than expected no. of arguments --
-
-Warning: mktime() expects at most 6 parameters, 7 given in %s on line %d
-bool(false)
-===DONE===
+mktime() expects at most 6 parameters, 7 given
diff --git a/ext/date/tests/oo_001.phpt b/ext/date/tests/oo_001.phpt
index 7cbf847c52..1d8af7f933 100644
--- a/ext/date/tests/oo_001.phpt
+++ b/ext/date/tests/oo_001.phpt
@@ -4,49 +4,53 @@ date OO interface
<?php
date_default_timezone_set('UTC');
class _d extends DateTime {
- function __construct() {
- }
+ function __construct() {
+ }
}
class _t extends DateTimeZone {
- function __construct() {
- }
+ function __construct() {
+ }
}
$d = new DateTime;
var_dump($d->format("Y-m-d H:i:s"));
-$d = new _d;
-var_dump($d->format("Y-m-d H:i:s"));
+try {
+ $d = new _d;
+ var_dump($d->format("Y-m-d H:i:s"));
+} catch (Error $e) {
+ echo $e->getMessage(),"\n";
+}
try {
- new DateTime("1am todax");
+ new DateTime("1am todax");
} catch (Exception $e) {
- echo $e->getMessage(),"\n";
+ echo $e->getMessage(),"\n";
}
$t = new DateTimeZone("UTC");
var_dump($t->getName());
-$t = new _t;
-var_dump($t->getName());
+try {
+ $t = new _t;
+ var_dump($t->getName());
+} catch (Error $e) {
+ echo $e->getMessage(),"\n";
+}
try {
- new DateTimeZone("GottaFindThisOne");
+ new DateTimeZone("GottaFindThisOne");
} catch (Exception $e) {
- echo $e->getMessage(),"\n";
+ echo $e->getMessage(),"\n";
}
echo "DONE\n";
?>
--EXPECTF--
string(19) "%d-%d-%d %d:%d:%d"
-
-Warning: DateTime::format(): The DateTime object has not been correctly initialized by its constructor in %soo_001.php on line %d
-bool(false)
+The DateTime object has not been correctly initialized by its constructor
DateTime::__construct(): Failed to parse time string (1am todax) at position 4 (t): The timezone could not be found in the database
string(3) "UTC"
-
-Warning: DateTimeZone::getName(): The DateTimeZone object has not been correctly initialized by its constructor in %soo_001.php on line %d
-bool(false)
+The DateTimeZone object has not been correctly initialized by its constructor
DateTimeZone::__construct(): Unknown or bad timezone (GottaFindThisOne)
DONE
diff --git a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type1.phpt b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type1.phpt
index c297608913..4c92f4618d 100644
--- a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type1.phpt
+++ b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type1.phpt
@@ -16,37 +16,37 @@ $interval_format = 'P%dDT%hH';
$end = new DateTime('2010-03-14 03:00:00 -0400');
$start = new DateTime('2010-03-14 01:59:59 -0500');
echo 'fd1 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n";
+ . ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n";
$end = new DateTime('2010-03-14 04:30:00 -0400');
$start = new DateTime('2010-03-13 04:30:00 -0500');
echo 'fd2 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
$end = new DateTime('2010-03-14 03:30:00 -0400');
$start = new DateTime('2010-03-13 04:30:00 -0500');
echo 'fd3 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
$end = new DateTime('2010-03-14 01:30:00 -0500');
$start = new DateTime('2010-03-13 04:30:00 -0500');
echo 'fd4 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
$end = new DateTime('2010-03-14 01:30:00 -0500');
$start = new DateTime('2010-03-13 01:30:00 -0500');
echo 'fd5 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
$end = new DateTime('2010-03-14 03:30:00 -0400');
$start = new DateTime('2010-03-13 03:30:00 -0500');
echo 'fd6 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
$end = new DateTime('2010-03-14 03:30:00 -0400');
$start = new DateTime('2010-03-13 02:30:00 -0500');
echo 'fd7 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
echo "\n";
@@ -58,37 +58,37 @@ $start = new DateTime('2010-03-14 01:59:59 -0500');
$interval_spec = 'PT1S';
$interval = new DateInterval($interval_spec);
echo 'fa1 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-03-13 04:30:00 -0500');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'fa2 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-03-13 04:30:00 -0500');
$interval_spec = 'PT22H';
$interval = new DateInterval($interval_spec);
echo 'fa3 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-03-13 04:30:00 -0500');
$interval_spec = 'PT21H';
$interval = new DateInterval($interval_spec);
echo 'fa4 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-03-13 01:30:00 -0500');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'fa5 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-03-13 02:30:00 -0500');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'fa6 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
echo "\n";
@@ -100,43 +100,43 @@ $end = new DateTime('2010-03-14 03:00:00 -0400');
$interval_spec = 'PT1S';
$interval = new DateInterval($interval_spec);
echo 'fs1 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-03-14 04:30:00 -0400');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'fs2 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-03-14 03:30:00 -0400');
$interval_spec = 'PT22H';
$interval = new DateInterval($interval_spec);
echo 'fs3 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-03-14 01:30:00 -0500');
$interval_spec = 'PT21H';
$interval = new DateInterval($interval_spec);
echo 'fs4 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-03-14 01:30:00 -0500');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'fs5 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-03-15 03:30:00 -0400');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'fs6 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-03-15 02:30:00 -0400');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'fs7 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
echo "\n";
@@ -147,42 +147,42 @@ echo "\n";
$end = new DateTime('2010-11-07 01:00:00 -0500');
$start = new DateTime('2010-11-07 01:59:59 -0400');
echo 'bd1 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n";
+ . ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n";
$end = new DateTime('2010-11-07 04:30:00 -0500');
$start = new DateTime('2010-11-06 04:30:00 -0400');
echo 'bd2 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
$end = new DateTime('2010-11-07 03:30:00 -0500');
$start = new DateTime('2010-11-06 04:30:00 -0400');
echo 'bd3 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
$end = new DateTime('2010-11-07 02:30:00 -0500');
$start = new DateTime('2010-11-06 04:30:00 -0400');
echo 'bd4 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
$end = new DateTime('2010-11-07 01:30:00 -0500');
$start = new DateTime('2010-11-06 04:30:00 -0400');
echo 'bd5 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
$end = new DateTime('2010-11-07 01:30:00 -0400');
$start = new DateTime('2010-11-06 04:30:00 -0400');
echo 'bd6 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
$end = new DateTime('2010-11-07 01:30:00 -0400');
$start = new DateTime('2010-11-06 01:30:00 -0400');
echo 'bd7 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
$end = new DateTime('2010-11-07 01:30:00 -0500');
$start = new DateTime('2010-11-06 01:30:00 -0400');
echo 'bd8 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
echo "\n";
@@ -194,67 +194,67 @@ $start = new DateTime('2010-11-07 01:59:59 -0400');
$interval_spec = 'PT1S';
$interval = new DateInterval($interval_spec);
echo 'ba1 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-11-06 04:30:00 -0400');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'ba2 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-11-06 04:30:00 -0400');
$interval_spec = 'PT24H';
$interval = new DateInterval($interval_spec);
echo 'ba3 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-11-06 04:30:00 -0400');
$interval_spec = 'PT23H';
$interval = new DateInterval($interval_spec);
echo 'ba4 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-11-06 04:30:00 -0400');
$interval_spec = 'PT22H';
$interval = new DateInterval($interval_spec);
echo 'ba5 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-11-06 04:30:00 -0400');
$interval_spec = 'PT21H';
$interval = new DateInterval($interval_spec);
echo 'ba6 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-11-06 01:30:00 -0400');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'ba7 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-11-06 01:30:00 -0400');
$interval_spec = 'P1DT1H';
$interval = new DateInterval($interval_spec);
echo 'ba8 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-11-06 04:30:00 -0400');
$interval_spec = 'PT25H';
$interval = new DateInterval($interval_spec);
echo 'ba9 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-11-06 03:30:00 -0400');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'ba10 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-11-06 02:30:00 -0400');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'ba11 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
echo "\n";
@@ -266,61 +266,61 @@ $end = new DateTime('2010-11-07 01:00:00 -0500');
$interval_spec = 'PT1S';
$interval = new DateInterval($interval_spec);
echo 'bs1 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-11-07 04:30:00 -0500');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'bs2 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-11-07 03:30:00 -0500');
$interval_spec = 'PT24H';
$interval = new DateInterval($interval_spec);
echo 'bs3 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-11-07 02:30:00 -0500');
$interval_spec = 'PT23H';
$interval = new DateInterval($interval_spec);
echo 'bs4 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-11-07 01:30:00 -0500');
$interval_spec = 'PT22H';
$interval = new DateInterval($interval_spec);
echo 'bs5 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-11-07 01:30:00 -0400');
$interval_spec = 'PT21H';
$interval = new DateInterval($interval_spec);
echo 'bs6 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-11-07 01:30:00 -0400');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'bs7 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-11-07 01:30:00 -0500');
$interval_spec = 'P1DT1H';
$interval = new DateInterval($interval_spec);
echo 'bs8 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-11-07 03:30:00 -0500');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'bs9 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-11-07 02:30:00 -0500');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'bs10 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
?>
--EXPECT--
diff --git a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type2.phpt b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type2.phpt
index 72585125ea..d969f72a00 100644
--- a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type2.phpt
+++ b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type2.phpt
@@ -16,37 +16,37 @@ $interval_format = 'P%dDT%hH';
$end = new DateTime('2010-03-14 03:00:00 EDT');
$start = new DateTime('2010-03-14 01:59:59 EST');
echo 'fd1 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n";
+ . ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n";
$end = new DateTime('2010-03-14 04:30:00 EDT');
$start = new DateTime('2010-03-13 04:30:00 EST');
echo 'fd2 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
$end = new DateTime('2010-03-14 03:30:00 EDT');
$start = new DateTime('2010-03-13 04:30:00 EST');
echo 'fd3 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
$end = new DateTime('2010-03-14 01:30:00 EST');
$start = new DateTime('2010-03-13 04:30:00 EST');
echo 'fd4 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
$end = new DateTime('2010-03-14 01:30:00 EST');
$start = new DateTime('2010-03-13 01:30:00 EST');
echo 'fd5 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
$end = new DateTime('2010-03-14 03:30:00 EDT');
$start = new DateTime('2010-03-13 03:30:00 EST');
echo 'fd6 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
$end = new DateTime('2010-03-14 03:30:00 EDT');
$start = new DateTime('2010-03-13 02:30:00 EST');
echo 'fd7 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
echo "\n";
@@ -58,37 +58,37 @@ $start = new DateTime('2010-03-14 01:59:59 EST');
$interval_spec = 'PT1S';
$interval = new DateInterval($interval_spec);
echo 'fa1 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-03-13 04:30:00 EST');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'fa2 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-03-13 04:30:00 EST');
$interval_spec = 'PT22H';
$interval = new DateInterval($interval_spec);
echo 'fa3 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-03-13 04:30:00 EST');
$interval_spec = 'PT21H';
$interval = new DateInterval($interval_spec);
echo 'fa4 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-03-13 01:30:00 EST');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'fa5 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-03-13 02:30:00 EST');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'fa6 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
echo "\n";
@@ -100,43 +100,43 @@ $end = new DateTime('2010-03-14 03:00:00 EDT');
$interval_spec = 'PT1S';
$interval = new DateInterval($interval_spec);
echo 'fs1 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-03-14 04:30:00 EDT');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'fs2 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-03-14 03:30:00 EDT');
$interval_spec = 'PT22H';
$interval = new DateInterval($interval_spec);
echo 'fs3 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-03-14 01:30:00 EST');
$interval_spec = 'PT21H';
$interval = new DateInterval($interval_spec);
echo 'fs4 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-03-14 01:30:00 EST');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'fs5 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-03-15 03:30:00 EDT');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'fs6 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-03-15 02:30:00 EDT');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'fs7 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
echo "\n";
@@ -147,42 +147,42 @@ echo "\n";
$end = new DateTime('2010-11-07 01:00:00 EST');
$start = new DateTime('2010-11-07 01:59:59 EDT');
echo 'bd1 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n";
+ . ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n";
$end = new DateTime('2010-11-07 04:30:00 EST');
$start = new DateTime('2010-11-06 04:30:00 EDT');
echo 'bd2 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
$end = new DateTime('2010-11-07 03:30:00 EST');
$start = new DateTime('2010-11-06 04:30:00 EDT');
echo 'bd3 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
$end = new DateTime('2010-11-07 02:30:00 EST');
$start = new DateTime('2010-11-06 04:30:00 EDT');
echo 'bd4 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
$end = new DateTime('2010-11-07 01:30:00 EST');
$start = new DateTime('2010-11-06 04:30:00 EDT');
echo 'bd5 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
$end = new DateTime('2010-11-07 01:30:00 EDT');
$start = new DateTime('2010-11-06 04:30:00 EDT');
echo 'bd6 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
$end = new DateTime('2010-11-07 01:30:00 EDT');
$start = new DateTime('2010-11-06 01:30:00 EDT');
echo 'bd7 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
$end = new DateTime('2010-11-07 01:30:00 EST');
$start = new DateTime('2010-11-06 01:30:00 EDT');
echo 'bd8 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
echo "\n";
@@ -194,67 +194,67 @@ $start = new DateTime('2010-11-07 01:59:59 EDT');
$interval_spec = 'PT1S';
$interval = new DateInterval($interval_spec);
echo 'ba1 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-11-06 04:30:00 EDT');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'ba2 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-11-06 04:30:00 EDT');
$interval_spec = 'PT24H';
$interval = new DateInterval($interval_spec);
echo 'ba3 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-11-06 04:30:00 EDT');
$interval_spec = 'PT23H';
$interval = new DateInterval($interval_spec);
echo 'ba4 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-11-06 04:30:00 EDT');
$interval_spec = 'PT22H';
$interval = new DateInterval($interval_spec);
echo 'ba5 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-11-06 04:30:00 EDT');
$interval_spec = 'PT21H';
$interval = new DateInterval($interval_spec);
echo 'ba6 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-11-06 01:30:00 EDT');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'ba7 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-11-06 01:30:00 EDT');
$interval_spec = 'P1DT1H';
$interval = new DateInterval($interval_spec);
echo 'ba8 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-11-06 04:30:00 EDT');
$interval_spec = 'PT25H';
$interval = new DateInterval($interval_spec);
echo 'ba9 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-11-06 03:30:00 EDT');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'ba10 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-11-06 02:30:00 EDT');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'ba11 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
echo "\n";
@@ -266,61 +266,61 @@ $end = new DateTime('2010-11-07 01:00:00 EST');
$interval_spec = 'PT1S';
$interval = new DateInterval($interval_spec);
echo 'bs1 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-11-07 04:30:00 EST');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'bs2 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-11-07 03:30:00 EST');
$interval_spec = 'PT24H';
$interval = new DateInterval($interval_spec);
echo 'bs3 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-11-07 02:30:00 EST');
$interval_spec = 'PT23H';
$interval = new DateInterval($interval_spec);
echo 'bs4 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-11-07 01:30:00 EST');
$interval_spec = 'PT22H';
$interval = new DateInterval($interval_spec);
echo 'bs5 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-11-07 01:30:00 EDT');
$interval_spec = 'PT21H';
$interval = new DateInterval($interval_spec);
echo 'bs6 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-11-07 01:30:00 EDT');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'bs7 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-11-07 01:30:00 EST');
$interval_spec = 'P1DT1H';
$interval = new DateInterval($interval_spec);
echo 'bs8 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-11-07 03:30:00 EST');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'bs9 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-11-07 02:30:00 EST');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'bs10 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
?>
--EXPECT--
diff --git a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-ba.phpt b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-ba.phpt
index fdbe96d7d0..0326b43824 100644
--- a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-ba.phpt
+++ b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-ba.phpt
@@ -17,67 +17,67 @@ $start = new DateTime('2010-11-07 01:59:59');
$interval_spec = 'PT1S';
$interval = new DateInterval($interval_spec);
echo 'ba1 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-11-06 04:30:00');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'ba2 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-11-06 04:30:00');
$interval_spec = 'PT24H';
$interval = new DateInterval($interval_spec);
echo 'ba3 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-11-06 04:30:00');
$interval_spec = 'PT23H';
$interval = new DateInterval($interval_spec);
echo 'ba4 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-11-06 04:30:00');
$interval_spec = 'PT22H';
$interval = new DateInterval($interval_spec);
echo 'ba5 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-11-06 04:30:00');
$interval_spec = 'PT21H';
$interval = new DateInterval($interval_spec);
echo 'ba6 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-11-06 01:30:00');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'ba7 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-11-06 01:30:00');
$interval_spec = 'P1DT1H';
$interval = new DateInterval($interval_spec);
echo 'ba8 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-11-06 04:30:00');
$interval_spec = 'PT25H';
$interval = new DateInterval($interval_spec);
echo 'ba9 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-11-06 03:30:00');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'ba10 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-11-06 02:30:00');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'ba11 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
echo "\n";
diff --git a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bd1.phpt b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bd1.phpt
index 8249599931..8222e75f15 100644
--- a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bd1.phpt
+++ b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bd1.phpt
@@ -16,27 +16,27 @@ $interval_format = 'P%dDT%hH';
$end = new DateTime('2010-11-07 05:30:00');
$start = new DateTime('2010-11-06 04:30:00');
echo 'bd1 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
$end = new DateTime('2010-11-07 04:30:00');
$start = new DateTime('2010-11-06 04:30:00');
echo 'bd2 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
$end = new DateTime('2010-11-07 03:30:00');
$start = new DateTime('2010-11-06 04:30:00');
echo 'bd3 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
$end = new DateTime('2010-11-07 02:30:00');
$start = new DateTime('2010-11-06 04:30:00');
echo 'bd4 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
$end = new DateTime('2010-11-07 01:30:00');
$start = new DateTime('2010-11-06 01:30:00');
echo 'bd7 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
echo "\n";
?>
diff --git a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bd2.phpt b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bd2.phpt
index fe2e79b3b9..80e3321ed6 100644
--- a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bd2.phpt
+++ b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bd2.phpt
@@ -27,25 +27,25 @@ $end = new DateTime('2010-11-07 05:30:00');
$end->setTimeZone($tz);
$start = new DateTime('2010-11-06 04:30:59');
echo 'bd0 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format('P%dDT%hH%iM%sS') . "\n";
+ . ' = ' . $start->diff($end)->format('P%dDT%hH%iM%sS') . "\n";
$end = new DateTime('2010-11-07 01:30:00 EST');
$end->setTimeZone($tz);
$start = new DateTime('2010-11-06 04:30:00');
echo 'bd5 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
$end = new DateTime('2010-11-07 01:30:00 EDT');
$end->setTimeZone($tz);
$start = new DateTime('2010-11-06 04:30:00');
echo 'bd6 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
$end = new DateTime('2010-11-07 01:30:00 EST');
$end->setTimeZone($tz);
$start = new DateTime('2010-11-06 01:30:00');
echo 'bd8 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
echo "\n";
?>
diff --git a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bs.phpt b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bs.phpt
index 138c68f3a9..d195cb2f75 100644
--- a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bs.phpt
+++ b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bs.phpt
@@ -19,64 +19,64 @@ $end->setTimeZone($tz);
$interval_spec = 'PT1S';
$interval = new DateInterval($interval_spec);
echo 'bs1 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-11-07 04:30:00');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'bs2 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-11-07 03:30:00');
$interval_spec = 'PT24H';
$interval = new DateInterval($interval_spec);
echo 'bs3 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-11-07 02:30:00');
$interval_spec = 'PT23H';
$interval = new DateInterval($interval_spec);
echo 'bs4 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-11-07 01:30:00 EST');
$end->setTimeZone($tz);
$interval_spec = 'PT22H';
$interval = new DateInterval($interval_spec);
echo 'bs5 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-11-07 01:30:00 EDT');
$end->setTimeZone($tz);
$interval_spec = 'PT21H';
$interval = new DateInterval($interval_spec);
echo 'bs6 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-11-07 01:30:00');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'bs7 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-11-07 01:30:00 EST');
$end->setTimeZone($tz);
$interval_spec = 'P1DT1H';
$interval = new DateInterval($interval_spec);
echo 'bs8 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-11-07 03:30:00');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'bs9 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-11-07 02:30:00');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'bs10 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
?>
--EXPECT--
diff --git a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fa.phpt b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fa.phpt
index 9fa493f578..df67b5a89d 100644
--- a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fa.phpt
+++ b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fa.phpt
@@ -17,37 +17,37 @@ $start = new DateTime('2010-03-14 01:59:59');
$interval_spec = 'PT1S';
$interval = new DateInterval($interval_spec);
echo 'fa1 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-03-13 04:30:00');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'fa2 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-03-13 04:30:00');
$interval_spec = 'PT22H';
$interval = new DateInterval($interval_spec);
echo 'fa3 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-03-13 04:30:00');
$interval_spec = 'PT21H';
$interval = new DateInterval($interval_spec);
echo 'fa4 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-03-13 01:30:00');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'fa5 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
$start = new DateTime('2010-03-13 02:30:00');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'fa6 ' . $start->format($date_format) . " + $interval_spec = "
- . $start->add($interval)->format($date_format) . "\n";
+ . $start->add($interval)->format($date_format) . "\n";
?>
--EXPECT--
fa1 2010-03-14 01:59:59 EST America/New_York + PT1S = 2010-03-14 03:00:00 EDT America/New_York
diff --git a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fd.phpt b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fd.phpt
index ae7060be0b..1a60f7b57b 100644
--- a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fd.phpt
+++ b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fd.phpt
@@ -16,37 +16,37 @@ $interval_format = 'P%dDT%hH';
$end = new DateTime('2010-03-14 03:00:00');
$start = new DateTime('2010-03-14 01:59:59');
echo 'fd1 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n";
+ . ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n";
$end = new DateTime('2010-03-14 04:30:00');
$start = new DateTime('2010-03-13 04:30:00');
echo 'fd2 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
$end = new DateTime('2010-03-14 03:30:00');
$start = new DateTime('2010-03-13 04:30:00');
echo 'fd3 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
$end = new DateTime('2010-03-14 01:30:00');
$start = new DateTime('2010-03-13 04:30:00');
echo 'fd4 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
$end = new DateTime('2010-03-14 01:30:00');
$start = new DateTime('2010-03-13 01:30:00');
echo 'fd5 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
$end = new DateTime('2010-03-14 03:30:00');
$start = new DateTime('2010-03-13 03:30:00');
echo 'fd6 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
$end = new DateTime('2010-03-14 03:30:00');
$start = new DateTime('2010-03-13 02:30:00');
echo 'fd7 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
- . ' = ' . $start->diff($end)->format($interval_format) . "\n";
+ . ' = ' . $start->diff($end)->format($interval_format) . "\n";
?>
--EXPECT--
fd1 2010-03-14 03:00:00 EDT America/New_York - 2010-03-14 01:59:59 EST America/New_York = PT0H0M1S
diff --git a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fs.phpt b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fs.phpt
index 72351d37e1..aa1c268704 100644
--- a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fs.phpt
+++ b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fs.phpt
@@ -19,43 +19,43 @@ $end = new DateTime('2010-03-14 03:00:00');
$interval_spec = 'PT1S';
$interval = new DateInterval($interval_spec);
echo 'fs1 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-03-14 04:30:00');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'fs2 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-03-14 03:30:00');
$interval_spec = 'PT22H';
$interval = new DateInterval($interval_spec);
echo 'fs3 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-03-14 01:30:00');
$interval_spec = 'PT21H';
$interval = new DateInterval($interval_spec);
echo 'fs4 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-03-14 01:30:00');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'fs5 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-03-15 03:30:00');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'fs6 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
$end = new DateTime('2010-03-15 02:30:00');
$interval_spec = 'P1D';
$interval = new DateInterval($interval_spec);
echo 'fs7 ' . $end->format($date_format) . " - $interval_spec = "
- . $end->sub($interval)->format($date_format) . "\n";
+ . $end->sub($interval)->format($date_format) . "\n";
?>
--EXPECT--
fs1 2010-03-14 03:00:00 EDT America/New_York - PT1S = 2010-03-14 01:59:59 EST America/New_York
diff --git a/ext/date/tests/strftime_basic.phpt b/ext/date/tests/strftime_basic.phpt
index 340ac99e22..aa05eb6115 100644
--- a/ext/date/tests/strftime_basic.phpt
+++ b/ext/date/tests/strftime_basic.phpt
@@ -22,9 +22,7 @@ var_dump( strftime($format, $timestamp) );
var_dump( strftime($format) );
?>
-===DONE===
--EXPECTF--
*** Testing strftime() : basic functionality ***
string(20) "Aug 08 2008 08:08:08"
string(%d) "%s %d %d %d:%d:%d"
-===DONE===
diff --git a/ext/date/tests/strftime_variation10.phpt b/ext/date/tests/strftime_variation10.phpt
index 0a4059ee20..108dcffc54 100644
--- a/ext/date/tests/strftime_variation10.phpt
+++ b/ext/date/tests/strftime_variation10.phpt
@@ -23,20 +23,19 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008);
//array of values to iterate over
$inputs = array(
- 'The ISO 8601:1988 week number' => "%V",
- 'Weekday as decimal' => "%u",
+ 'The ISO 8601:1988 week number' => "%V",
+ 'Weekday as decimal' => "%u",
);
// loop through each element of the array for timestamp
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( strftime($value) );
- var_dump( strftime($value, $timestamp) );
+ echo "\n--$key--\n";
+ var_dump( strftime($value) );
+ var_dump( strftime($value, $timestamp) );
}
?>
-===DONE===
--EXPECTF--
*** Testing strftime() : usage variation ***
@@ -47,4 +46,3 @@ string(2) "32"
--Weekday as decimal--
string(%d) "%d"
string(1) "5"
-===DONE===
diff --git a/ext/date/tests/strftime_variation11.phpt b/ext/date/tests/strftime_variation11.phpt
index 737f7c96de..a169dd966e 100644
--- a/ext/date/tests/strftime_variation11.phpt
+++ b/ext/date/tests/strftime_variation11.phpt
@@ -21,11 +21,9 @@ var_dump( strftime($format) );
var_dump( strftime($format, $timestamp) );
?>
-===DONE===
--EXPECTF--
*** Testing strftime() : usage variation ***
-- Testing strftime() function with Abbreviated month name format %h --
string(%d) "%s"
string(3) "Aug"
-===DONE===
diff --git a/ext/date/tests/strftime_variation12.phpt b/ext/date/tests/strftime_variation12.phpt
index 07b1b3ec1c..b8f85ff842 100644
--- a/ext/date/tests/strftime_variation12.phpt
+++ b/ext/date/tests/strftime_variation12.phpt
@@ -27,11 +27,9 @@ var_dump( strftime($format) );
var_dump( strftime($format, $timestamp) );
?>
-===DONE===
--EXPECTF--
*** Testing strftime() : usage variation ***
-- Testing strftime() function with Abbreviated month name format %h --
string(%d) "%s"
string(3) "Aug"
-===DONE===
diff --git a/ext/date/tests/strftime_variation13.phpt b/ext/date/tests/strftime_variation13.phpt
index cce13fbc3b..0ebfa5502d 100644
--- a/ext/date/tests/strftime_variation13.phpt
+++ b/ext/date/tests/strftime_variation13.phpt
@@ -17,22 +17,21 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008);
//array of values to iterate over
$inputs = array(
- 'Century number' => "%C",
- 'Month Date Year' => "%D",
- 'Year with century' => "%G",
- 'Year without century' => "%g",
+ 'Century number' => "%C",
+ 'Month Date Year' => "%D",
+ 'Year with century' => "%G",
+ 'Year without century' => "%g",
);
// loop through each element of the array for timestamp
foreach($inputs as $key =>$value) {
echo "\n--$key--\n";
- var_dump( strftime($value) );
- var_dump( strftime($value, $timestamp) );
+ var_dump( strftime($value) );
+ var_dump( strftime($value, $timestamp) );
}
?>
-===DONE===
--EXPECTF--
*** Testing strftime() : usage variation ***
@@ -51,4 +50,3 @@ string(4) "2008"
--Year without century--
string(2) "%d"
string(2) "08"
-===DONE===
diff --git a/ext/date/tests/strftime_variation14.phpt b/ext/date/tests/strftime_variation14.phpt
index 80074acff8..b209d91adf 100644
--- a/ext/date/tests/strftime_variation14.phpt
+++ b/ext/date/tests/strftime_variation14.phpt
@@ -23,22 +23,21 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008);
//array of values to iterate over
$inputs = array(
- 'Century number' => "%C",
- 'Month Date Year' => "%D",
- 'Year with century' => "%G",
- 'Year without century' => "%g",
+ 'Century number' => "%C",
+ 'Month Date Year' => "%D",
+ 'Year with century' => "%G",
+ 'Year without century' => "%g",
);
// loop through each element of the array for timestamp
foreach($inputs as $key =>$value) {
echo "\n--$key--\n";
- var_dump( strftime($value) );
- var_dump( strftime($value, $timestamp) );
+ var_dump( strftime($value) );
+ var_dump( strftime($value, $timestamp) );
}
?>
-===DONE===
--EXPECTF--
*** Testing strftime() : usage variation ***
@@ -57,4 +56,3 @@ string(4) "2008"
--Year without century--
string(%d) "%d"
string(2) "08"
-===DONE===
diff --git a/ext/date/tests/strftime_variation15.phpt b/ext/date/tests/strftime_variation15.phpt
index f6e8fedf0b..38826b6528 100644
--- a/ext/date/tests/strftime_variation15.phpt
+++ b/ext/date/tests/strftime_variation15.phpt
@@ -17,21 +17,20 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008);
//array of values to iterate over
$inputs = array(
- 'Time in a.m/p.m notation' => "%r",
- 'Time in 24 hour notation' => "%R",
- 'Current time %H:%M:%S format' => "%T",
+ 'Time in a.m/p.m notation' => "%r",
+ 'Time in 24 hour notation' => "%R",
+ 'Current time %H:%M:%S format' => "%T",
);
// loop through each element of the array for timestamp
foreach($inputs as $key =>$value) {
echo "\n--$key--\n";
- var_dump( strftime($value) );
- var_dump( strftime($value, $timestamp) );
+ var_dump( strftime($value) );
+ var_dump( strftime($value, $timestamp) );
}
?>
-===DONE===
--EXPECTF--
*** Testing strftime() : usage variation ***
@@ -46,4 +45,3 @@ string(5) "08:08"
--Current time %H:%M:%S format--
string(%d) "%d:%d:%d"
string(8) "08:08:08"
-===DONE===
diff --git a/ext/date/tests/strftime_variation16.phpt b/ext/date/tests/strftime_variation16.phpt
index b74a6fe96f..5791c12838 100644
--- a/ext/date/tests/strftime_variation16.phpt
+++ b/ext/date/tests/strftime_variation16.phpt
@@ -23,21 +23,20 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008);
//array of values to iterate over
$inputs = array(
- 'Time in a.m/p.m notation' => "%r",
- 'Time in 24 hour notation' => "%R",
- 'Current time %H:%M:%S format' => "%T",
+ 'Time in a.m/p.m notation' => "%r",
+ 'Time in 24 hour notation' => "%R",
+ 'Current time %H:%M:%S format' => "%T",
);
// loop through each element of the array for timestamp
foreach($inputs as $key =>$value) {
echo "\n--$key--\n";
- var_dump( strftime($value) );
- var_dump( strftime($value, $timestamp) );
+ var_dump( strftime($value) );
+ var_dump( strftime($value, $timestamp) );
}
?>
-===DONE===
--EXPECTF--
*** Testing strftime() : usage variation ***
@@ -52,4 +51,3 @@ string(5) "08:08"
--Current time %H:%M:%S format--
string(%d) "%d:%d:%d"
string(8) "08:08:08"
-===DONE===
diff --git a/ext/date/tests/strftime_variation17.phpt b/ext/date/tests/strftime_variation17.phpt
index 04e1cadab0..6a698d230c 100644
--- a/ext/date/tests/strftime_variation17.phpt
+++ b/ext/date/tests/strftime_variation17.phpt
@@ -20,11 +20,9 @@ $format = "%e";
var_dump( strftime($format) );
var_dump( strftime($format, $timestamp) );
?>
-===DONE===
--EXPECTF--
*** Testing strftime() : usage variation ***
-- Testing strftime() function with Day of the month as decimal single digit format --
string(%d) "%A%d"
string(2) " 8"
-===DONE===
diff --git a/ext/date/tests/strftime_variation18.phpt b/ext/date/tests/strftime_variation18.phpt
index b0f21ff010..310b7729fa 100644
--- a/ext/date/tests/strftime_variation18.phpt
+++ b/ext/date/tests/strftime_variation18.phpt
@@ -26,11 +26,9 @@ $format = "%e";
var_dump( strftime($format) );
var_dump( strftime($format, $timestamp) );
?>
-===DONE===
--EXPECTF--
*** Testing strftime() : usage variation ***
-- Testing strftime() function with Day of the month as decimal single digit format --
string(%d) "%s"
string(2) " 8"
-===DONE===
diff --git a/ext/date/tests/strftime_variation19.phpt b/ext/date/tests/strftime_variation19.phpt
index 125a47c789..852b95fbe9 100644
--- a/ext/date/tests/strftime_variation19.phpt
+++ b/ext/date/tests/strftime_variation19.phpt
@@ -17,20 +17,19 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008);
//array of values to iterate over
$inputs = array(
- 'Newline character' => "%n",
- 'Tab character' => "%t"
+ 'Newline character' => "%n",
+ 'Tab character' => "%t"
);
// loop through each element of the array for timestamp
foreach($inputs as $key =>$value) {
echo "\n--$key--\n";
- var_dump( strftime($value) );
- var_dump( strftime($value, $timestamp) );
+ var_dump( strftime($value) );
+ var_dump( strftime($value, $timestamp) );
}
?>
-===DONE===
--EXPECT--
*** Testing strftime() : usage variation ***
@@ -43,4 +42,3 @@ string(1) "
--Tab character--
string(1) " "
string(1) " "
-===DONE===
diff --git a/ext/date/tests/strftime_variation20.phpt b/ext/date/tests/strftime_variation20.phpt
index 0fb11914d4..19875760d5 100644
--- a/ext/date/tests/strftime_variation20.phpt
+++ b/ext/date/tests/strftime_variation20.phpt
@@ -23,20 +23,19 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008);
//array of values to iterate over
$inputs = array(
- 'Newline character' => "%n",
- 'Tab character' => "%t"
+ 'Newline character' => "%n",
+ 'Tab character' => "%t"
);
// loop through each element of the array for timestamp
foreach($inputs as $key =>$value) {
echo "\n--$key--\n";
- var_dump( strftime($value) );
- var_dump( strftime($value, $timestamp) );
+ var_dump( strftime($value) );
+ var_dump( strftime($value, $timestamp) );
}
?>
-===DONE===
--EXPECTREGEX--
\*\*\* Testing strftime\(\) : usage variation \*\*\*
@@ -49,4 +48,3 @@ string\(1\) "
--Tab character--
string\(1\) "\s"
string\(1\) "\s"
-===DONE===
diff --git a/ext/date/tests/strftime_variation21.phpt b/ext/date/tests/strftime_variation21.phpt
index 730716c392..164e5e304b 100644
--- a/ext/date/tests/strftime_variation21.phpt
+++ b/ext/date/tests/strftime_variation21.phpt
@@ -18,20 +18,19 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008);
//array of values to iterate over
$inputs = array(
'Preferred date and time representation' => "%c",
- 'Preferred date representation' => "%x",
- 'Preferred time representation' => "%X",
+ 'Preferred date representation' => "%x",
+ 'Preferred time representation' => "%X",
);
// loop through each element of the array for timestamp
foreach($inputs as $key =>$value) {
echo "\n--$key--\n";
- var_dump( strftime($value) );
- var_dump( strftime($value, $timestamp) );
+ var_dump( strftime($value) );
+ var_dump( strftime($value, $timestamp) );
}
?>
-===DONE===
--EXPECTF--
*** Testing strftime() : usage variation ***
@@ -46,4 +45,3 @@ string(8) "08/08/08"
--Preferred time representation--
string(%d) "%d:%d:%d"
string(8) "08:08:08"
-===DONE===
diff --git a/ext/date/tests/strftime_variation22.phpt b/ext/date/tests/strftime_variation22.phpt
index 11dcf75694..900cde2fca 100644
--- a/ext/date/tests/strftime_variation22.phpt
+++ b/ext/date/tests/strftime_variation22.phpt
@@ -28,20 +28,19 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008);
//array of values to iterate over
$inputs = array(
'Preferred date and time representation' => "%c",
- 'Preferred date representation' => "%x",
- 'Preferred time representation' => "%X",
+ 'Preferred date representation' => "%x",
+ 'Preferred time representation' => "%X",
);
// loop through each element of the array for timestamp
foreach($inputs as $key =>$value) {
echo "\n--$key--\n";
- var_dump( $value );
- var_dump( strftime($value, $timestamp) );
+ var_dump( $value );
+ var_dump( strftime($value, $timestamp) );
}
?>
-===DONE===
--EXPECT--
*** Testing strftime() : usage variation ***
@@ -56,4 +55,3 @@ string(8) "08/08/08"
--Preferred time representation--
string(2) "%X"
string(8) "08:08:08"
-===DONE===
diff --git a/ext/date/tests/strftime_variation23.phpt b/ext/date/tests/strftime_variation23.phpt
deleted file mode 100644
index 22f079702a..0000000000
--- a/ext/date/tests/strftime_variation23.phpt
+++ /dev/null
@@ -1,42 +0,0 @@
---TEST--
-Test strftime() function : usage variation - Checking large positive and negative float values to timestamp.
---SKIPIF--
-<?php if (PHP_INT_SIZE != 4) echo "skip this test is for 32-bit only"; ?>
---FILE--
-<?php
-/* Prototype : string strftime(string format [, int timestamp])
- * Description: Format a local time/date according to locale settings
- * Source code: ext/date/php_date.c
- * Alias to functions:
- */
-
-echo "*** Testing strftime() : usage variation ***\n";
-
-// Initialise function arguments not being substituted (if any)
-setlocale(LC_ALL, "en_US");
-date_default_timezone_set("UTC");
-$format = '%b %d %Y %H:%M:%S';
-
-echo "\n-- Testing strftime() function with float 12.3456789000e10 to timestamp --\n";
-$timestamp = 12.3456789000e10;
-var_dump( strftime($format, $timestamp) );
-
-echo "\n-- Testing strftime() function with float -12.3456789000e10 to timestamp --\n";
-$timestamp = -12.3456789000e10;
-var_dump( strftime($format, $timestamp) );
-
-?>
-===DONE===
---EXPECTF--
-*** Testing strftime() : usage variation ***
-
--- Testing strftime() function with float 12.3456789000e10 to timestamp --
-
-Warning: strftime() expects parameter 2 to be int, float given in %s on line %d
-bool(false)
-
--- Testing strftime() function with float -12.3456789000e10 to timestamp --
-
-Warning: strftime() expects parameter 2 to be int, float given in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/date/tests/strftime_variation3.phpt b/ext/date/tests/strftime_variation3.phpt
index 69f747ca34..90771973a9 100644
--- a/ext/date/tests/strftime_variation3.phpt
+++ b/ext/date/tests/strftime_variation3.phpt
@@ -18,8 +18,8 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008);
$inputs = array(
'Abbreviated weekday name' => "%a",
'Full weekday name' => "%A",
- 'Week number of the year' => "%U",
- 'Week number of the year in decimal number' => "%W",
+ 'Week number of the year' => "%U",
+ 'Week number of the year in decimal number' => "%W",
);
// loop through each element of the array for timestamp
@@ -30,7 +30,6 @@ foreach($inputs as $key =>$value) {
};
?>
-===DONE===
--EXPECTF--
*** Testing strftime() : usage variation ***
@@ -49,4 +48,3 @@ string(2) "31"
--Week number of the year in decimal number--
string(%d) "%d"
string(2) "31"
-===DONE===
diff --git a/ext/date/tests/strftime_variation4.phpt b/ext/date/tests/strftime_variation4.phpt
index 54df26a1c6..461da2669d 100644
--- a/ext/date/tests/strftime_variation4.phpt
+++ b/ext/date/tests/strftime_variation4.phpt
@@ -18,7 +18,7 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008);
$inputs = array(
'Abbreviated month name' => "%b",
'Full month name' => "%B",
- 'Month as decimal' => "%m",
+ 'Month as decimal' => "%m",
);
// loop through each element of the array for timestamp
@@ -30,7 +30,6 @@ foreach($inputs as $key =>$value) {
};
?>
-===DONE===
--EXPECTF--
*** Testing strftime() : usage variation ***
@@ -45,4 +44,3 @@ string(6) "August"
--Month as decimal--
string(%d) "%d"
string(2) "08"
-===DONE===
diff --git a/ext/date/tests/strftime_variation5.phpt b/ext/date/tests/strftime_variation5.phpt
index 15ad8b08ea..31cc970564 100644
--- a/ext/date/tests/strftime_variation5.phpt
+++ b/ext/date/tests/strftime_variation5.phpt
@@ -17,10 +17,10 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008);
//array of values to iterate over
$inputs = array(
- 'Year as decimal number without a century' => "%y",
- 'Year as decimal number including the century' => "%Y",
- 'Time zone offset' => "%Z",
- 'Time zone offset' => "%z",
+ 'Year as decimal number without a century' => "%y",
+ 'Year as decimal number including the century' => "%Y",
+ 'Time zone offset' => "%Z",
+ 'Time zone offset' => "%z",
);
// loop through each element of the array for timestamp
@@ -32,7 +32,6 @@ foreach($inputs as $key =>$value) {
};
?>
-===DONE===
--EXPECTF--
*** Testing strftime() : usage variation ***
@@ -47,4 +46,3 @@ string(4) "2008"
--Time zone offset--
string(%d) "%s"
string(%d) "%s"
-===DONE===
diff --git a/ext/date/tests/strftime_variation6.phpt b/ext/date/tests/strftime_variation6.phpt
index f4413c6c79..1460f70b30 100644
--- a/ext/date/tests/strftime_variation6.phpt
+++ b/ext/date/tests/strftime_variation6.phpt
@@ -18,11 +18,11 @@ $timestamp = mktime(18, 8, 8, 8, 8, 2008);
//array of values to iterate over
$inputs = array(
- 'Hour as decimal by 24-hour format' => "%H",
- 'Hour as decimal by 12-hour format' => "%I",
- 'Minute as decimal number' => "%M",
- 'AM/PM format for a time' => "%p",
- 'Second as decimal number' => "%S",
+ 'Hour as decimal by 24-hour format' => "%H",
+ 'Hour as decimal by 12-hour format' => "%I",
+ 'Minute as decimal number' => "%M",
+ 'AM/PM format for a time' => "%p",
+ 'Second as decimal number' => "%S",
);
// loop through each element of the array for timestamp
@@ -34,7 +34,6 @@ foreach($inputs as $key =>$value) {
};
?>
-===DONE===
--EXPECTF--
*** Testing strftime() : usage variation ***
@@ -57,4 +56,3 @@ string(2) "PM"
--Second as decimal number--
string(%d) "%d"
string(2) "08"
-===DONE===
diff --git a/ext/date/tests/strftime_variation7.phpt b/ext/date/tests/strftime_variation7.phpt
index 29a9406381..b8cc2de847 100644
--- a/ext/date/tests/strftime_variation7.phpt
+++ b/ext/date/tests/strftime_variation7.phpt
@@ -18,9 +18,9 @@ $timestamp = mktime(18, 8, 8, 8, 8, 2008);
//array of values to iterate over
$inputs = array(
- 'Day of the month as a decimal number' => "%d",
- 'Day of the year as a decimal number' => "%j",
- 'Day of the week as a decimal number' => "%w"
+ 'Day of the month as a decimal number' => "%d",
+ 'Day of the year as a decimal number' => "%j",
+ 'Day of the week as a decimal number' => "%w"
);
// loop through each element of the array for timestamp
@@ -32,7 +32,6 @@ foreach($inputs as $key =>$value) {
};
?>
-===DONE===
--EXPECTF--
*** Testing strftime() : usage variation ***
@@ -47,4 +46,3 @@ string(3) "221"
--Day of the week as a decimal number--
string(%d) "%d"
string(1) "5"
-===DONE===
diff --git a/ext/date/tests/strftime_variation8.phpt b/ext/date/tests/strftime_variation8.phpt
index 75b41c186a..44b37a9bb8 100644
--- a/ext/date/tests/strftime_variation8.phpt
+++ b/ext/date/tests/strftime_variation8.phpt
@@ -21,11 +21,9 @@ var_dump( strftime($format) );
var_dump( strftime($format, $timestamp) );
?>
-===DONE===
--EXPECT--
*** Testing strftime() : usage variation ***
-- Testing strftime() function with a literal % character to format --
string(1) "%"
string(1) "%"
-===DONE===
diff --git a/ext/date/tests/strftime_variation9.phpt b/ext/date/tests/strftime_variation9.phpt
index 49363ec27b..82a060b66d 100644
--- a/ext/date/tests/strftime_variation9.phpt
+++ b/ext/date/tests/strftime_variation9.phpt
@@ -17,20 +17,19 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008);
//array of values to iterate over
$inputs = array(
- 'The ISO 8601:1988 week number' => "%V",
- 'Weekday as decimal' => "%u",
+ 'The ISO 8601:1988 week number' => "%V",
+ 'Weekday as decimal' => "%u",
);
// loop through each element of the array for timestamp
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( strftime($value) );
- var_dump( strftime($value, $timestamp) );
+ echo "\n--$key--\n";
+ var_dump( strftime($value) );
+ var_dump( strftime($value, $timestamp) );
}
?>
-===DONE===
--EXPECTF--
*** Testing strftime() : usage variation ***
@@ -41,4 +40,3 @@ string(2) "32"
--Weekday as decimal--
string(1) "%d"
string(1) "5"
-===DONE===
diff --git a/ext/date/tests/strtotime-mysql-64bit.phpt b/ext/date/tests/strtotime-mysql-64bit.phpt
index 356e485949..ddf1dfff3f 100644
--- a/ext/date/tests/strtotime-mysql-64bit.phpt
+++ b/ext/date/tests/strtotime-mysql-64bit.phpt
@@ -12,13 +12,13 @@ $d[] = '20001231185859';
$d[] = '20800410101010'; // overflow..
foreach($d as $date) {
- $time = strtotime($date);
+ $time = strtotime($date);
- if (is_integer($time)) {
- var_dump(date('r', $time));
- } else {
- var_dump($time);
- }
+ if (is_integer($time)) {
+ var_dump(date('r', $time));
+ } else {
+ var_dump($time);
+ }
}
?>
--EXPECT--
diff --git a/ext/date/tests/strtotime-mysql.phpt b/ext/date/tests/strtotime-mysql.phpt
index 5b0192880b..c9502e1d3e 100644
--- a/ext/date/tests/strtotime-mysql.phpt
+++ b/ext/date/tests/strtotime-mysql.phpt
@@ -12,13 +12,13 @@ $d[] = '20001231185859';
$d[] = '20800410101010'; // overflow..
foreach($d as $date) {
- $time = strtotime($date);
+ $time = strtotime($date);
- if (is_integer($time)) {
- var_dump(date('r', $time));
- } else {
- var_dump($time);
- }
+ if (is_integer($time)) {
+ var_dump(date('r', $time));
+ } else {
+ var_dump($time);
+ }
}
?>
--EXPECT--
diff --git a/ext/date/tests/strtotime-relative.phpt b/ext/date/tests/strtotime-relative.phpt
index 293223bb2d..f5cd014a6d 100644
--- a/ext/date/tests/strtotime-relative.phpt
+++ b/ext/date/tests/strtotime-relative.phpt
@@ -8,44 +8,44 @@ date_default_timezone_set('UTC');
$base_time = 1204200000; // 28 Feb 2008 12:00:00
$offsets = array(
- // offset around a day
- '80412 seconds',
- '86399 seconds',
- '86400 seconds',
- '86401 seconds',
- '112913 seconds',
+ // offset around a day
+ '80412 seconds',
+ '86399 seconds',
+ '86400 seconds',
+ '86401 seconds',
+ '112913 seconds',
- // offset around 7 days
- '134 hours',
- '167 hours',
- '168 hours',
- '169 hours',
- '183 hours',
+ // offset around 7 days
+ '134 hours',
+ '167 hours',
+ '168 hours',
+ '169 hours',
+ '183 hours',
- // offset around 6 months
- '178 days',
- '179 days',
- '180 days',
- '183 days',
- '184 days',
+ // offset around 6 months
+ '178 days',
+ '179 days',
+ '180 days',
+ '183 days',
+ '184 days',
- // offset around 10 years
- '115 months',
- '119 months',
- '120 months',
- '121 months',
- '128 months',
+ // offset around 10 years
+ '115 months',
+ '119 months',
+ '120 months',
+ '121 months',
+ '128 months',
- // offset around 25 years (can't do much more reliably with strtotime)
- '24 years',
- '25 years',
- '26 years'
+ // offset around 25 years (can't do much more reliably with strtotime)
+ '24 years',
+ '25 years',
+ '26 years'
);
foreach ($offsets AS $offset) {
- foreach (array('+', '-') AS $direction) {
- echo "$direction$offset: " . date(DATE_ISO8601, strtotime("$direction$offset", $base_time)) . "\n";
- }
+ foreach (array('+', '-') AS $direction) {
+ echo "$direction$offset: " . date(DATE_ISO8601, strtotime("$direction$offset", $base_time)) . "\n";
+ }
}
?>
diff --git a/ext/date/tests/strtotime.phpt b/ext/date/tests/strtotime.phpt
index aef7d68dcd..f55765fa80 100644
--- a/ext/date/tests/strtotime.phpt
+++ b/ext/date/tests/strtotime.phpt
@@ -10,7 +10,7 @@ $d[] = strtotime("@1121373041");
$d[] = strtotime("@1121373041 CEST");
foreach($d as $date) {
- echo date(DATE_ISO8601, $date), "\n";
+ echo date(DATE_ISO8601, $date), "\n";
}
?>
--EXPECT--
diff --git a/ext/date/tests/strtotime2.phpt b/ext/date/tests/strtotime2.phpt
index b8b605923d..c9b83838d1 100644
--- a/ext/date/tests/strtotime2.phpt
+++ b/ext/date/tests/strtotime2.phpt
@@ -7,23 +7,23 @@ date_default_timezone_set("Europe/Oslo");
$time = time();
$constants = array(
- 'DATE_ATOM',
- 'DATE_COOKIE',
- 'DATE_ISO8601',
- 'DATE_RFC822',
- 'DATE_RFC850',
- 'DATE_RFC1036',
- 'DATE_RFC1123',
- 'DATE_RFC2822',
- 'DATE_RFC3339',
- 'DATE_RSS',
- 'DATE_W3C'
+ 'DATE_ATOM',
+ 'DATE_COOKIE',
+ 'DATE_ISO8601',
+ 'DATE_RFC822',
+ 'DATE_RFC850',
+ 'DATE_RFC1036',
+ 'DATE_RFC1123',
+ 'DATE_RFC2822',
+ 'DATE_RFC3339',
+ 'DATE_RSS',
+ 'DATE_W3C'
);
foreach ($constants as $const) {
- echo "$const:\t";
- echo ((strtotime(date(constant($const), $time)) === $time) ? "OK" : "FAIL") . "\n";
+ echo "$const:\t";
+ echo ((strtotime(date(constant($const), $time)) === $time) ? "OK" : "FAIL") . "\n";
}
?>
--EXPECT--
diff --git a/ext/date/tests/strtotime3-64bit.phpt b/ext/date/tests/strtotime3-64bit.phpt
index 52c4edd63b..c4f87c3b1a 100644
--- a/ext/date/tests/strtotime3-64bit.phpt
+++ b/ext/date/tests/strtotime3-64bit.phpt
@@ -8,39 +8,39 @@ date_default_timezone_set('Europe/Lisbon');
$time = 1150494719; // 16/June/2006
$strs = array(
- '',
- " \t\r\n000",
- 'yesterday',
- '22:49:12',
- '22:49:12 bogusTZ',
- '22.49.12.42GMT',
- '22.49.12.42bogusTZ',
- 't0222',
- 't0222 t0222',
- '022233',
- '022233 bogusTZ',
- '2-3-2004',
- '2.3.2004',
- '20060212T23:12:23UTC',
- '20060212T23:12:23 bogusTZ',
- '2006167', //pgydotd
- 'Jan-15-2006', //pgtextshort
- '2006-Jan-15', //pgtextreverse
- '10/Oct/2000:13:55:36 +0100', //clf
- '10/Oct/2000:13:55:36 +00100', //clf
- '2006',
- '1986', // year
- 'JAN',
- 'January',
+ '',
+ " \t\r\n000",
+ 'yesterday',
+ '22:49:12',
+ '22:49:12 bogusTZ',
+ '22.49.12.42GMT',
+ '22.49.12.42bogusTZ',
+ 't0222',
+ 't0222 t0222',
+ '022233',
+ '022233 bogusTZ',
+ '2-3-2004',
+ '2.3.2004',
+ '20060212T23:12:23UTC',
+ '20060212T23:12:23 bogusTZ',
+ '2006167', //pgydotd
+ 'Jan-15-2006', //pgtextshort
+ '2006-Jan-15', //pgtextreverse
+ '10/Oct/2000:13:55:36 +0100', //clf
+ '10/Oct/2000:13:55:36 +00100', //clf
+ '2006',
+ '1986', // year
+ 'JAN',
+ 'January',
);
foreach ($strs as $str) {
- $t = strtotime($str, $time);
- if (is_integer($t)) {
- var_dump(date(DATE_RFC2822, $t));
- } else {
- var_dump($t);
- }
+ $t = strtotime($str, $time);
+ if (is_integer($t)) {
+ var_dump(date(DATE_RFC2822, $t));
+ } else {
+ var_dump($t);
+ }
}
?>
diff --git a/ext/date/tests/strtotime3.phpt b/ext/date/tests/strtotime3.phpt
index 97161f9dfe..f01af27a43 100644
--- a/ext/date/tests/strtotime3.phpt
+++ b/ext/date/tests/strtotime3.phpt
@@ -8,39 +8,39 @@ date_default_timezone_set('Europe/Lisbon');
$time = 1150494719; // 16/June/2006
$strs = array(
- '',
- " \t\r\n000",
- 'yesterday',
- '22:49:12',
- '22:49:12 bogusTZ',
- '22.49.12.42GMT',
- '22.49.12.42bogusTZ',
- 't0222',
- 't0222 t0222',
- '022233',
- '022233 bogusTZ',
- '2-3-2004',
- '2.3.2004',
- '20060212T23:12:23UTC',
- '20060212T23:12:23 bogusTZ',
- '2006167', //pgydotd
- 'Jan-15-2006', //pgtextshort
- '2006-Jan-15', //pgtextreverse
- '10/Oct/2000:13:55:36 +0100', //clf
- '10/Oct/2000:13:55:36 +00100', //clf
- '2006',
- '1986', // year
- 'JAN',
- 'January',
+ '',
+ " \t\r\n000",
+ 'yesterday',
+ '22:49:12',
+ '22:49:12 bogusTZ',
+ '22.49.12.42GMT',
+ '22.49.12.42bogusTZ',
+ 't0222',
+ 't0222 t0222',
+ '022233',
+ '022233 bogusTZ',
+ '2-3-2004',
+ '2.3.2004',
+ '20060212T23:12:23UTC',
+ '20060212T23:12:23 bogusTZ',
+ '2006167', //pgydotd
+ 'Jan-15-2006', //pgtextshort
+ '2006-Jan-15', //pgtextreverse
+ '10/Oct/2000:13:55:36 +0100', //clf
+ '10/Oct/2000:13:55:36 +00100', //clf
+ '2006',
+ '1986', // year
+ 'JAN',
+ 'January',
);
foreach ($strs as $str) {
- $t = strtotime($str, $time);
- if (is_integer($t)) {
- var_dump(date(DATE_RFC2822, $t));
- } else {
- var_dump($t);
- }
+ $t = strtotime($str, $time);
+ if (is_integer($t)) {
+ var_dump(date(DATE_RFC2822, $t));
+ } else {
+ var_dump($t);
+ }
}
?>
diff --git a/ext/date/tests/strtotime_variation_scottish.phpt b/ext/date/tests/strtotime_variation_scottish.phpt
index 740583a78e..ee2ff5f098 100644
--- a/ext/date/tests/strtotime_variation_scottish.phpt
+++ b/ext/date/tests/strtotime_variation_scottish.phpt
@@ -2,11 +2,11 @@
Checking whisky time
--FILE--
<?php
- date_default_timezone_set('UTC');
- var_dump(date('H:i:s', strtotime('back of 7')));
- var_dump(date('H:i:s', strtotime('front of 7')));
- var_dump(date('H:i:s', strtotime('back of 19')));
- var_dump(date('H:i:s', strtotime('front of 19')));
+ date_default_timezone_set('UTC');
+ var_dump(date('H:i:s', strtotime('back of 7')));
+ var_dump(date('H:i:s', strtotime('front of 7')));
+ var_dump(date('H:i:s', strtotime('back of 19')));
+ var_dump(date('H:i:s', strtotime('front of 19')));
?>
--EXPECT--
string(8) "07:15:00"
diff --git a/ext/date/tests/sunfuncts.phpt b/ext/date/tests/sunfuncts.phpt
index 672b3affe2..6859aadc44 100644
--- a/ext/date/tests/sunfuncts.phpt
+++ b/ext/date/tests/sunfuncts.phpt
@@ -6,13 +6,13 @@ precision=13
<?php
date_default_timezone_set('Asia/Jerusalem');
for($a=1;$a<=12;$a++){
- echo date_sunrise(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_TIMESTAMP,31.76670,35.23330,90.83,2)." ";
- echo date_sunrise(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_STRING,31.76670,35.23330,90.83,2)." ";
- echo date_sunrise(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_DOUBLE,31.76670,35.23330,90.83,2)."\n";
+ echo date_sunrise(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_TIMESTAMP,31.76670,35.23330,90.83,2)." ";
+ echo date_sunrise(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_STRING,31.76670,35.23330,90.83,2)." ";
+ echo date_sunrise(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_DOUBLE,31.76670,35.23330,90.83,2)."\n";
- echo date_sunset(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_TIMESTAMP,31.76670,35.23330,90.83,2)." ";
- echo date_sunset(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_STRING,31.76670,35.23330,90.83,2)." ";
- echo date_sunset(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_DOUBLE,31.76670,35.23330,90.83,2)."\n";
+ echo date_sunset(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_TIMESTAMP,31.76670,35.23330,90.83,2)." ";
+ echo date_sunset(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_STRING,31.76670,35.23330,90.83,2)." ";
+ echo date_sunset(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_DOUBLE,31.76670,35.23330,90.83,2)."\n";
}
?>
--EXPECTF--
diff --git a/ext/date/tests/test-parse-from-format.phpt b/ext/date/tests/test-parse-from-format.phpt
index ee0bd68d6b..670a316859 100644
--- a/ext/date/tests/test-parse-from-format.phpt
+++ b/ext/date/tests/test-parse-from-format.phpt
@@ -4,20 +4,20 @@ date_create_from_format() and date_parse_from_format().
<?php
date_default_timezone_set('Europe/Oslo');
$formats = array( DATE_ATOM, DATE_COOKIE, DATE_ISO8601, DATE_RFC822,
- DATE_RFC850, DATE_RFC1036, DATE_RFC1123, DATE_RFC2822, DATE_RFC3339,
- DATE_RSS, DATE_W3C );
+ DATE_RFC850, DATE_RFC1036, DATE_RFC1123, DATE_RFC2822, DATE_RFC3339,
+ DATE_RSS, DATE_W3C );
foreach( $formats as $format )
{
- $date = new DateTime( "2008-07-08T22:14:12+02:00" );
- $formatted = $date->format( $format ) ;
- $date2 = date_create_from_format( $format, $formatted );
- var_dump( $format, $formatted, $date2 );
- echo "\n";
- if ( $date2 === false )
- {
- var_dump(date_parse_from_format( $format, $formatted ) );
- }
+ $date = new DateTime( "2008-07-08T22:14:12+02:00" );
+ $formatted = $date->format( $format ) ;
+ $date2 = date_create_from_format( $format, $formatted );
+ var_dump( $format, $formatted, $date2 );
+ echo "\n";
+ if ( $date2 === false )
+ {
+ var_dump(date_parse_from_format( $format, $formatted ) );
+ }
}
?>
--EXPECT--
diff --git a/ext/date/tests/time_basic.phpt b/ext/date/tests/time_basic.phpt
index 0ff2f0120c..d97b73e216 100644
--- a/ext/date/tests/time_basic.phpt
+++ b/ext/date/tests/time_basic.phpt
@@ -10,7 +10,5 @@ Test return type and value for expected input time()
var_dump(time());
?>
-===DONE===
--EXPECTF--
int(%d)
-===DONE===
diff --git a/ext/date/tests/timezone-configuration.phpt b/ext/date/tests/timezone-configuration.phpt
index b395853033..3e4340c38c 100644
--- a/ext/date/tests/timezone-configuration.phpt
+++ b/ext/date/tests/timezone-configuration.phpt
@@ -4,14 +4,14 @@ timezone configuration [1]
date.timezone=GMT
--FILE--
<?php
- date_default_timezone_set('Europe/Oslo');
- echo strtotime("2005-06-18 22:15:44"), "\n";
+ date_default_timezone_set('Europe/Oslo');
+ echo strtotime("2005-06-18 22:15:44"), "\n";
- date_default_timezone_set('Europe/London');
- echo strtotime("2005-06-18 22:15:44"), "\n";
+ date_default_timezone_set('Europe/London');
+ echo strtotime("2005-06-18 22:15:44"), "\n";
- date_default_timezone_set('Europe/Oslo');
- echo strtotime("2005-06-18 22:15:44"), "\n";
+ date_default_timezone_set('Europe/Oslo');
+ echo strtotime("2005-06-18 22:15:44"), "\n";
?>
--EXPECT--
1119125744
diff --git a/ext/date/tests/timezone_abbreviations_list_basic1.phpt b/ext/date/tests/timezone_abbreviations_list_basic1.phpt
index 5232fe215f..b3bf7c84a1 100644
--- a/ext/date/tests/timezone_abbreviations_list_basic1.phpt
+++ b/ext/date/tests/timezone_abbreviations_list_basic1.phpt
@@ -22,7 +22,6 @@ echo "\n-- Format a sample entry --\n";
var_dump( $abbr["acst"] );
?>
-===DONE===
--EXPECTF--
*** Testing timezone_abbreviations_list() : basic functionality ***
string(5) "array"
@@ -85,4 +84,3 @@ array(6) {
string(20) "Australia/Yancowinna"
}
}
-===DONE===
diff --git a/ext/date/tests/timezone_identifiers_list_basic1.phpt b/ext/date/tests/timezone_identifiers_list_basic1.phpt
index b6b0ca43b8..c537b9b4c5 100644
--- a/ext/date/tests/timezone_identifiers_list_basic1.phpt
+++ b/ext/date/tests/timezone_identifiers_list_basic1.phpt
@@ -23,7 +23,6 @@ var_dump(in_array("America/New_York", $zones));
var_dump(in_array("UTC", $zones));
?>
-===DONE===
--EXPECT--
*** Testing timezone_identifiers_list() : basic functionality ***
Check return tpe is ARRAY
@@ -32,5 +31,4 @@ Check array contains some common timezones
bool(true)
bool(true)
bool(true)
-===DONE===
diff --git a/ext/date/tests/timezone_name_from_abbr_basic1.phpt b/ext/date/tests/timezone_name_from_abbr_basic1.phpt
index b181d8fb68..51b5d9b19e 100644
--- a/ext/date/tests/timezone_name_from_abbr_basic1.phpt
+++ b/ext/date/tests/timezone_name_from_abbr_basic1.phpt
@@ -3,7 +3,7 @@ Test timezone_name_from_abbr() function : basic functionality
--FILE--
<?php
/* Prototype : string timezone_name_from_abbr ( string $abbr [, int $gmtOffset= -1 [, int $isdst= -1 ]] )
- * Description: Returns the timezone name from abbrevation
+ * Description: Returns the timezone name from abbreviation
* Source code: ext/date/php_date.c
* Alias to functions:
*/
@@ -35,7 +35,6 @@ echo "-- Tests with invalid offsets --\n";
var_dump( timezone_name_from_abbr("", 5400) ); // offset = 1.5 hrs
var_dump( timezone_name_from_abbr("", 62400) ); // offset = 24 hrs
?>
-===DONE===
--EXPECT--
*** Testing timezone_name_from_abbr() : basic functionality ***
-- Tests with special cases first - no lookup needed --
@@ -55,4 +54,3 @@ string(15) "America/Halifax"
-- Tests with invalid offsets --
bool(false)
bool(false)
-===DONE===
diff --git a/ext/date/tests/timezone_offset_get_basic1.phpt b/ext/date/tests/timezone_offset_get_basic1.phpt
index c7e197af85..e242200d7f 100644
--- a/ext/date/tests/timezone_offset_get_basic1.phpt
+++ b/ext/date/tests/timezone_offset_get_basic1.phpt
@@ -25,10 +25,8 @@ $tz = timezone_open("America/Los_Angeles");
var_dump(timezone_offset_get($tz, $date));
?>
-===DONE===
--EXPECTF--
*** Testing timezone_offset_get() : basic functionality ***
%rint\(0\)|int\(3600\)%r
%rint\(-18000\)|int\(-14400\)%r
%rint\(-28800\)|int\(-25200\)%r
-===DONE===
diff --git a/ext/date/tests/timezone_offset_get_error.phpt b/ext/date/tests/timezone_offset_get_error.phpt
index 413755ac72..69e81cb846 100644
--- a/ext/date/tests/timezone_offset_get_error.phpt
+++ b/ext/date/tests/timezone_offset_get_error.phpt
@@ -15,109 +15,67 @@ $date = date_create("GMT");
echo "*** Testing timezone_offset_get() : error conditions ***\n";
-echo "\n-- Testing timezone_offset_get() function with zero arguments --\n";
-try {
- var_dump( timezone_offset_get() );
-} catch (Error $ex) {
- var_dump($ex->getMessage());
- echo "\n";
-}
-
-echo "\n-- Testing timezone_offset_get() function with less than expected no. of arguments --\n";
-try {
- var_dump( timezone_offset_get($tz) );
-} catch (Error $ex) {
- var_dump($ex->getMessage());
- echo "\n";
-}
-
-echo "\n-- Testing timezone_offset_get() function with more than expected no. of arguments --\n";
-$extra_arg = 99;
-try {
- var_dump( timezone_offset_get($tz, $date, $extra_arg) );
-} catch (Error $ex) {
- var_dump($ex->getMessage());
- echo "\n";
-}
-
echo "\n-- Testing timezone_offset_get() function with an invalid values for \$object argument --\n";
$invalid_obj = new stdClass();
try {
- var_dump( timezone_offset_get($invalid_obj, $date) );
+ var_dump( timezone_offset_get($invalid_obj, $date) );
} catch (Error $ex) {
- var_dump($ex->getMessage());
- echo "\n";
+ var_dump($ex->getMessage());
+ echo "\n";
}
$invalid_obj = 10;
try {
- var_dump( timezone_offset_get($invalid_obj, $date) );
+ var_dump( timezone_offset_get($invalid_obj, $date) );
} catch (Error $ex) {
- var_dump($ex->getMessage());
- echo "\n";
+ var_dump($ex->getMessage());
+ echo "\n";
}
$invalid_obj = null;
try {
- var_dump( timezone_offset_get($invalid_obj, $date) );
+ var_dump( timezone_offset_get($invalid_obj, $date) );
} catch (Error $ex) {
- var_dump($ex->getMessage());
- echo "\n";
+ var_dump($ex->getMessage());
+ echo "\n";
}
echo "\n-- Testing timezone_offset_get() function with an invalid values for \$datetime argument --\n";
$invalid_obj = new stdClass();
try {
- var_dump( timezone_offset_get($tz, $invalid_obj) );
+ var_dump( timezone_offset_get($tz, $invalid_obj) );
} catch (Error $ex) {
- var_dump($ex->getMessage());
- echo "\n";
+ var_dump($ex->getMessage());
+ echo "\n";
}
$invalid_obj = 10;
try {
- var_dump( timezone_offset_get($tz, $invalid_obj) );
+ var_dump( timezone_offset_get($tz, $invalid_obj) );
} catch (Error $ex) {
- var_dump($ex->getMessage());
- echo "\n";
+ var_dump($ex->getMessage());
+ echo "\n";
}
$invalid_obj = null;
try {
- var_dump( timezone_offset_get($tz, $invalid_obj) );
+ var_dump( timezone_offset_get($tz, $invalid_obj) );
} catch (Error $ex) {
- var_dump($ex->getMessage());
- echo "\n";
+ var_dump($ex->getMessage());
+ echo "\n";
}
?>
-===DONE===
---EXPECTF--
+--EXPECT--
*** Testing timezone_offset_get() : error conditions ***
--- Testing timezone_offset_get() function with zero arguments --
-
-Warning: timezone_offset_get() expects exactly 2 parameters, 0 given in %s on line %d
-bool(false)
-
--- Testing timezone_offset_get() function with less than expected no. of arguments --
-
-Warning: timezone_offset_get() expects exactly 2 parameters, 1 given in %s on line %d
-bool(false)
-
--- Testing timezone_offset_get() function with more than expected no. of arguments --
-
-Warning: timezone_offset_get() expects exactly 2 parameters, 3 given in %s on line %d
-bool(false)
-
-- Testing timezone_offset_get() function with an invalid values for $object argument --
-string(%d) "Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, instance of stdClass given"
+string(74) "timezone_offset_get() expects parameter 1 to be DateTimeZone, object given"
-string(%d) "Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, int given"
+string(71) "timezone_offset_get() expects parameter 1 to be DateTimeZone, int given"
-string(%d) "Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, null given"
+string(72) "timezone_offset_get() expects parameter 1 to be DateTimeZone, null given"
-- Testing timezone_offset_get() function with an invalid values for $datetime argument --
-string(%d) "Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, instance of stdClass given"
+string(79) "timezone_offset_get() expects parameter 2 to be DateTimeInterface, object given"
-string(%d) "Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, int given"
+string(76) "timezone_offset_get() expects parameter 2 to be DateTimeInterface, int given"
-string(%d) "Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, null given"
+string(77) "timezone_offset_get() expects parameter 2 to be DateTimeInterface, null given"
-===DONE===
diff --git a/ext/date/tests/timezone_open_basic1.phpt b/ext/date/tests/timezone_open_basic1.phpt
index ee54b5feb4..306c8e377d 100644
--- a/ext/date/tests/timezone_open_basic1.phpt
+++ b/ext/date/tests/timezone_open_basic1.phpt
@@ -15,7 +15,6 @@ var_dump( timezone_open("Europe/London") );
var_dump( timezone_open("America/Los_Angeles") );
?>
-===DONE===
--EXPECTF--
*** Testing timezone_open() : basic functionality ***
object(DateTimeZone)#%d (2) {
@@ -36,4 +35,3 @@ object(DateTimeZone)#%d (2) {
["timezone"]=>
string(19) "America/Los_Angeles"
}
-===DONE===
diff --git a/ext/date/tests/timezone_transitions_get_basic1.phpt b/ext/date/tests/timezone_transitions_get_basic1.phpt
index 2fd44a430d..92156d77d1 100644
--- a/ext/date/tests/timezone_transitions_get_basic1.phpt
+++ b/ext/date/tests/timezone_transitions_get_basic1.phpt
@@ -28,7 +28,6 @@ echo "\n-- Format a sample entry pfor Spring 1963 --\n";
var_dump( $tran[6] );
?>
-===DONE===
--EXPECT--
*** Testing timezone_transitions_get() : basic functionality ***
@@ -50,4 +49,3 @@ array(5) {
["abbr"]=>
string(3) "BST"
}
-===DONE===
diff --git a/ext/dba/dba.c b/ext/dba/dba.c
index 952993582b..d407d2a8e7 100644
--- a/ext/dba/dba.c
+++ b/ext/dba/dba.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -50,82 +48,7 @@
#include "php_qdbm.h"
#include "php_tcadb.h"
#include "php_lmdb.h"
-
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dba_popen, 0, 0, 2)
- ZEND_ARG_INFO(0, path)
- ZEND_ARG_INFO(0, mode)
- ZEND_ARG_INFO(0, handlername)
- ZEND_ARG_VARIADIC_INFO(0, handler_parameters)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dba_open, 0, 0, 2)
- ZEND_ARG_INFO(0, path)
- ZEND_ARG_INFO(0, mode)
- ZEND_ARG_INFO(0, handlername)
- ZEND_ARG_VARIADIC_INFO(0, handler_parameters)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_dba_close, 0)
- ZEND_ARG_INFO(0, handle)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_dba_exists, 0)
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, handle)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dba_fetch, 0, 0, 2)
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, skip)
- ZEND_ARG_INFO(0, handle)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_dba_key_split, 0)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_dba_firstkey, 0)
- ZEND_ARG_INFO(0, handle)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_dba_nextkey, 0)
- ZEND_ARG_INFO(0, handle)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_dba_delete, 0)
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, handle)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_dba_insert, 0)
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, value)
- ZEND_ARG_INFO(0, handle)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_dba_replace, 0)
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, value)
- ZEND_ARG_INFO(0, handle)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_dba_optimize, 0)
- ZEND_ARG_INFO(0, handle)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_dba_sync, 0)
- ZEND_ARG_INFO(0, handle)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dba_handlers, 0, 0, 0)
- ZEND_ARG_INFO(0, full_info)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_dba_list, 0)
-ZEND_END_ARG_INFO()
-
-/* }}} */
+#include "dba_arginfo.h"
/* {{{ dba_functions[]
*/
@@ -245,7 +168,7 @@ static size_t php_dba_make_key(zval *key, char **key_str, char **key_free)
char *key_str, *key_free; \
size_t key_len; \
if (zend_parse_parameters(ac, "zr", &key, &id) == FAILURE) { \
- return; \
+ RETURN_THROWS(); \
} \
if ((key_len = php_dba_make_key(key, &key_str, &key_free)) == 0) {\
RETURN_FALSE; \
@@ -259,12 +182,12 @@ static size_t php_dba_make_key(zval *key, char **key_str, char **key_free)
switch(ac) { \
case 2: \
if (zend_parse_parameters(ac, "zr", &key, &id) == FAILURE) { \
- return; \
+ RETURN_THROWS(); \
} \
break; \
case 3: \
if (zend_parse_parameters(ac, "zlr", &key, &skip, &id) == FAILURE) { \
- return; \
+ RETURN_THROWS(); \
} \
break; \
default: \
@@ -277,13 +200,13 @@ static size_t php_dba_make_key(zval *key, char **key_str, char **key_free)
#define DBA_FETCH_RESOURCE(info, id) \
if ((info = (dba_info *)zend_fetch_resource2(Z_RES_P(id), "DBA identifier", le_db, le_pdb)) == NULL) { \
- RETURN_FALSE; \
+ RETURN_THROWS(); \
}
#define DBA_FETCH_RESOURCE_WITH_ID(info, id) \
if ((info = (dba_info *)zend_fetch_resource2(Z_RES_P(id), "DBA identifier", le_db, le_pdb)) == NULL) { \
DBA_ID_DONE; \
- RETURN_FALSE; \
+ RETURN_THROWS(); \
}
#define DBA_ID_GET2 DBA_ID_PARS; DBA_GET2; DBA_FETCH_RESOURCE_WITH_ID(info, id)
@@ -584,7 +507,7 @@ static void php_dba_update(INTERNAL_FUNCTION_PARAMETERS, int mode)
size_t key_len;
if (zend_parse_parameters(ac, "zsr", &key, &val, &val_len, &id) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((key_len = php_dba_make_key(key, &key_str, &key_free)) == 0) {
@@ -675,7 +598,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
/* Exception during string conversion */
if (EG(exception)) {
FREENOW;
- return;
+ RETURN_THROWS();
}
if (persistent) {
@@ -1041,7 +964,7 @@ PHP_FUNCTION(dba_close)
dba_info *info = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &id) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DBA_FETCH_RESOURCE(info, id);
@@ -1080,8 +1003,8 @@ PHP_FUNCTION(dba_fetch)
skip = 0;
}
} else if (!strcmp(info->hnd->name, "inifile")) {
- /* "-1" is compareable to 0 but allows a non restrictive
- * access which is fater. For example 'inifile' uses this
+ /* "-1" is comparable to 0 but allows a non restrictive
+ * access which is faster. For example 'inifile' uses this
* to allow faster access when the key was already found
* using firstkey/nextkey. However explicitly setting the
* value to 0 ensures the first value.
@@ -1125,7 +1048,7 @@ PHP_FUNCTION(dba_key_split)
}
}
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &key, &key_len) == FAILURE) {
- RETURN_BOOL(0);
+ RETURN_THROWS();
}
array_init(return_value);
if (key[0] == '[' && (name = strchr(key, ']')) != NULL) {
@@ -1148,7 +1071,7 @@ PHP_FUNCTION(dba_firstkey)
dba_info *info = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &id) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DBA_FETCH_RESOURCE(info, id);
@@ -1175,7 +1098,7 @@ PHP_FUNCTION(dba_nextkey)
dba_info *info = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &id) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DBA_FETCH_RESOURCE(info, id);
@@ -1237,7 +1160,7 @@ PHP_FUNCTION(dba_optimize)
dba_info *info = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &id) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DBA_FETCH_RESOURCE(info, id);
@@ -1260,7 +1183,7 @@ PHP_FUNCTION(dba_sync)
dba_info *info = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &id) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DBA_FETCH_RESOURCE(info, id);
@@ -1281,7 +1204,7 @@ PHP_FUNCTION(dba_handlers)
zend_bool full_info = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &full_info) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
array_init(return_value);
@@ -1308,7 +1231,7 @@ PHP_FUNCTION(dba_list)
dba_info *info;
if (zend_parse_parameters_none() == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
array_init(return_value);
diff --git a/ext/dba/dba.stub.php b/ext/dba/dba.stub.php
new file mode 100644
index 0000000000..96ce6d573a
--- /dev/null
+++ b/ext/dba/dba.stub.php
@@ -0,0 +1,59 @@
+<?php
+
+/** @return resource|false */
+function dba_popen($path, $mode, $handlername = UNKNOWN, ...$handler_parameters) {}
+
+/** @return resource|false */
+function dba_open($path, $mode, $handlername = UNKNOWN, ...$handler_parameters) {}
+
+/** @param resource $handle */
+function dba_close($handle): void {}
+
+/**
+ * @param string|array $key
+ * @param resource $handle
+ */
+function dba_exists($key, $handle): bool {}
+
+/**
+ * @param string|array $key
+ * @param int|resource $skip actually this parameter is optional, not $handle
+ * @param resource $handle
+ */
+function dba_fetch($key, $skip, $handle = UNKOWN): string|false {}
+
+function dba_key_split(string $key): array|false {}
+
+/** @param resource $handle */
+function dba_firstkey($handle): string|false {}
+
+/** @param resource $handle */
+function dba_nextkey($handle): string|false {}
+
+/**
+ * @param string|array $key
+ * @param resource $handle
+ */
+function dba_delete($key, $handle): bool {}
+
+/**
+ * @param string|array $key
+ * @param resource $handle
+ */
+function dba_insert($key, string $value, $handle): bool {}
+
+/**
+ * @param string|array $key
+ * @param resource $handle
+ */
+function dba_replace($key, string $value, $handle): bool {}
+
+/** @param resource $handle */
+function dba_optimize($handle): bool {}
+
+/** @param resource $handle */
+function dba_sync($handle): bool {}
+
+function dba_handlers(bool $full_info = false): array {}
+
+function dba_list(): array {}
diff --git a/ext/dba/dba_arginfo.h b/ext/dba/dba_arginfo.h
new file mode 100644
index 0000000000..32e925fb6a
--- /dev/null
+++ b/ext/dba/dba_arginfo.h
@@ -0,0 +1,58 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_dba_popen, 0, 0, 2)
+ ZEND_ARG_INFO(0, path)
+ ZEND_ARG_INFO(0, mode)
+ ZEND_ARG_INFO(0, handlername)
+ ZEND_ARG_VARIADIC_INFO(0, handler_parameters)
+ZEND_END_ARG_INFO()
+
+#define arginfo_dba_open arginfo_dba_popen
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_dba_close, 0, 1, IS_VOID, 0)
+ ZEND_ARG_INFO(0, handle)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_dba_exists, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, key)
+ ZEND_ARG_INFO(0, handle)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_dba_fetch, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, key)
+ ZEND_ARG_INFO(0, skip)
+ ZEND_ARG_INFO(0, handle)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_dba_key_split, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_dba_firstkey, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, handle)
+ZEND_END_ARG_INFO()
+
+#define arginfo_dba_nextkey arginfo_dba_firstkey
+
+#define arginfo_dba_delete arginfo_dba_exists
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_dba_insert, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, key)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
+ ZEND_ARG_INFO(0, handle)
+ZEND_END_ARG_INFO()
+
+#define arginfo_dba_replace arginfo_dba_insert
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_dba_optimize, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, handle)
+ZEND_END_ARG_INFO()
+
+#define arginfo_dba_sync arginfo_dba_optimize
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_dba_handlers, 0, 0, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, full_info, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_dba_list, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/dba/dba_cdb.c b/ext/dba/dba_cdb.c
index d269990c16..c20136652a 100644
--- a/ext/dba/dba_cdb.c
+++ b/ext/dba/dba_cdb.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/dba/dba_db1.c b/ext/dba/dba_db1.c
index 5d9c28dcec..70fe23e772 100644
--- a/ext/dba/dba_db1.c
+++ b/ext/dba/dba_db1.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/dba/dba_db2.c b/ext/dba/dba_db2.c
index 0fecd36c33..0ff4784fe5 100644
--- a/ext/dba/dba_db2.c
+++ b/ext/dba/dba_db2.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/dba/dba_db3.c b/ext/dba/dba_db3.c
index bc0fdacd02..a22c28f721 100644
--- a/ext/dba/dba_db3.c
+++ b/ext/dba/dba_db3.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/dba/dba_db4.c b/ext/dba/dba_db4.c
index ee296b9c4f..d2d8df3c7f 100644
--- a/ext/dba/dba_db4.c
+++ b/ext/dba/dba_db4.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/dba/dba_dbm.c b/ext/dba/dba_dbm.c
index 58a1493c51..317219be2d 100644
--- a/ext/dba/dba_dbm.c
+++ b/ext/dba/dba_dbm.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/dba/dba_flatfile.c b/ext/dba/dba_flatfile.c
index 9a4a3674f3..b9a3a4cfe9 100644
--- a/ext/dba/dba_flatfile.c
+++ b/ext/dba/dba_flatfile.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/dba/dba_gdbm.c b/ext/dba/dba_gdbm.c
index 185241421d..0f0f256ac7 100644
--- a/ext/dba/dba_gdbm.c
+++ b/ext/dba/dba_gdbm.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/dba/dba_inifile.c b/ext/dba/dba_inifile.c
index ed001654af..dd3d42290f 100644
--- a/ext/dba/dba_inifile.c
+++ b/ext/dba/dba_inifile.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/dba/dba_lmdb.c b/ext/dba/dba_lmdb.c
index ea8784bcb1..102293f631 100644
--- a/ext/dba/dba_lmdb.c
+++ b/ext/dba/dba_lmdb.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/dba/dba_ndbm.c b/ext/dba/dba_ndbm.c
index 973a91322f..0819c72d87 100644
--- a/ext/dba/dba_ndbm.c
+++ b/ext/dba/dba_ndbm.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/dba/dba_qdbm.c b/ext/dba/dba_qdbm.c
index ba68bcc4ba..91dada80ab 100644
--- a/ext/dba/dba_qdbm.c
+++ b/ext/dba/dba_qdbm.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/dba/dba_tcadb.c b/ext/dba/dba_tcadb.c
index 2df9433026..4b6d20b57f 100644
--- a/ext/dba/dba_tcadb.c
+++ b/ext/dba/dba_tcadb.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/dba/libcdb/cdb.c b/ext/dba/libcdb/cdb.c
index 841505a20a..101360d96c 100644
--- a/ext/dba/libcdb/cdb.c
+++ b/ext/dba/libcdb/cdb.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/dba/libcdb/cdb.h b/ext/dba/libcdb/cdb.h
index f02ec5040e..57b784d7c4 100644
--- a/ext/dba/libcdb/cdb.h
+++ b/ext/dba/libcdb/cdb.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/dba/libcdb/cdb_make.c b/ext/dba/libcdb/cdb_make.c
index 95b1c25181..fd1c022cb6 100644
--- a/ext/dba/libcdb/cdb_make.c
+++ b/ext/dba/libcdb/cdb_make.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/dba/libcdb/cdb_make.h b/ext/dba/libcdb/cdb_make.h
index d6cc715a04..ef7b13023a 100644
--- a/ext/dba/libcdb/cdb_make.h
+++ b/ext/dba/libcdb/cdb_make.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/dba/libcdb/uint32.c b/ext/dba/libcdb/uint32.c
index 9dd8236886..f7d96207bc 100644
--- a/ext/dba/libcdb/uint32.c
+++ b/ext/dba/libcdb/uint32.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/dba/libcdb/uint32.h b/ext/dba/libcdb/uint32.h
index 1ccc04eefb..ca8a8513f4 100644
--- a/ext/dba/libcdb/uint32.h
+++ b/ext/dba/libcdb/uint32.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/dba/libflatfile/flatfile.c b/ext/dba/libflatfile/flatfile.c
index 410f340526..bceeaff3c5 100644
--- a/ext/dba/libflatfile/flatfile.c
+++ b/ext/dba/libflatfile/flatfile.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/dba/libflatfile/flatfile.h b/ext/dba/libflatfile/flatfile.h
index 184500cec5..c161659b21 100644
--- a/ext/dba/libflatfile/flatfile.h
+++ b/ext/dba/libflatfile/flatfile.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/dba/libinifile/inifile.c b/ext/dba/libinifile/inifile.c
index 42cb3bb761..8330125dea 100644
--- a/ext/dba/libinifile/inifile.c
+++ b/ext/dba/libinifile/inifile.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/dba/libinifile/inifile.h b/ext/dba/libinifile/inifile.h
index 11ffbd834b..ec33f80ee7 100644
--- a/ext/dba/libinifile/inifile.h
+++ b/ext/dba/libinifile/inifile.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/dba/php_dba.h b/ext/dba/php_dba.h
index 221d60afa5..cd93b47bd1 100644
--- a/ext/dba/php_dba.h
+++ b/ext/dba/php_dba.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/dba/php_tcadb.h b/ext/dba/php_tcadb.h
index a8158ce57c..6cb5a52406 100644
--- a/ext/dba/php_tcadb.h
+++ b/ext/dba/php_tcadb.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/dba/tests/bug36436.phpt b/ext/dba/tests/bug36436.phpt
index fa1d6140f6..fe625b62bc 100644
--- a/ext/dba/tests/bug36436.phpt
+++ b/ext/dba/tests/bug36436.phpt
@@ -24,7 +24,6 @@ var_dump(dba_nextkey($db));
dba_close($db);
?>
-===DONE===
--CLEAN--
<?php
require(__DIR__ .'/clean.inc');
@@ -34,4 +33,3 @@ resource(%d) of type (dba persistent)
string(3) "XYZ"
string(1) "X"
string(1) "Y"
-===DONE===
diff --git a/ext/dba/tests/bug38698.phpt b/ext/dba/tests/bug38698.phpt
index 6ace7c02aa..fe4c68aa80 100644
--- a/ext/dba/tests/bug38698.phpt
+++ b/ext/dba/tests/bug38698.phpt
@@ -15,20 +15,18 @@ function isLittleEndian() {
$db_file = __DIR__ .'/129php.cdb';
if (($db_make=dba_open($db_file, "n", 'cdb_make'))!==FALSE) {
- if (isLittleEndian() === FALSE) {
+ if (isLittleEndian() === FALSE) {
dba_insert(pack('V',129), "Booo!", $db_make);
- } else{
- dba_insert(pack('i',129), "Booo!", $db_make);
- }
- dba_close($db_make);
- // write md5 checksum of generated database file
- var_dump(md5_file($db_file));
- @unlink($db_file);
+ } else{
+ dba_insert(pack('i',129), "Booo!", $db_make);
+ }
+ dba_close($db_make);
+ // write md5 checksum of generated database file
+ var_dump(md5_file($db_file));
+ @unlink($db_file);
} else {
echo "Error creating database\n";
}
?>
-===DONE===
--EXPECT--
string(32) "1f34b74bde3744265acfc21e0f30af95"
-===DONE===
diff --git a/ext/dba/tests/bug48240.phpt b/ext/dba/tests/bug48240.phpt
index 75e70da965..c735c9a07d 100644
--- a/ext/dba/tests/bug48240.phpt
+++ b/ext/dba/tests/bug48240.phpt
@@ -18,11 +18,9 @@ var_dump(dba_nextkey($db));
dba_close($db);
?>
-===DONE===
--CLEAN--
<?php
require(__DIR__ .'/clean.inc');
?>
--EXPECT--
bool(false)
-===DONE===
diff --git a/ext/dba/tests/bug62490.phpt b/ext/dba/tests/bug62490.phpt
index 41a9cdead7..3e5c1e82ca 100644
--- a/ext/dba/tests/bug62490.phpt
+++ b/ext/dba/tests/bug62490.phpt
@@ -11,10 +11,10 @@ $handler = "inifile";
include "test.inc";
$dba = dba_open($db_filename, "n", $handler)
- or die;
+ or die;
for ($i = 0; $i < 3; ++$i) {
- echo "insert $i:";
- var_dump(dba_insert("a", $i, $dba));
+ echo "insert $i:";
+ var_dump(dba_insert("a", $i, $dba));
}
echo "exists:";
@@ -27,7 +27,6 @@ echo "delete:";
var_dump(dba_delete("a", $dba));
?>
-===DONE===
--CLEAN--
<?php
include "clean.inc";
@@ -40,4 +39,3 @@ exists:bool(true)
delete:bool(true)
exists:bool(false)
delete:bool(false)
-===DONE===
diff --git a/ext/dba/tests/bug70825.phpt b/ext/dba/tests/bug70825.phpt
index ff05f01cf4..6ab16efd0f 100644
--- a/ext/dba/tests/bug70825.phpt
+++ b/ext/dba/tests/bug70825.phpt
@@ -49,7 +49,6 @@ var_dump(dba_fetch('[foo]bar', 2, $db));
dba_close($db);
unlink($filename);
?>
-==DONE==
--EXPECT--
string(2) "23"
string(2) "42"
@@ -63,7 +62,6 @@ string(4) "1337"
string(2) "23"
string(2) "42"
string(4) "1337"
-==DONE==
--CLEAN--
<?php
$filename = __DIR__ . DIRECTORY_SEPARATOR . 'bug70825.ini';
diff --git a/ext/dba/tests/bug71514.phpt b/ext/dba/tests/bug71514.phpt
index 08338f3793..8aada12e8f 100644
--- a/ext/dba/tests/bug71514.phpt
+++ b/ext/dba/tests/bug71514.phpt
@@ -17,10 +17,8 @@ var_dump(dba_fetch('foo', $db));
dba_close($db);
?>
-==DONE==
--EXPECT--
string(6) "value2"
-==DONE==
--CLEAN--
<?php
$filename = __DIR__ . DIRECTORY_SEPARATOR . 'bug71514.ini';
diff --git a/ext/dba/tests/bug72885.phpt b/ext/dba/tests/bug72885.phpt
index f8bcc7e7ab..367e54f18c 100644
--- a/ext/dba/tests/bug72885.phpt
+++ b/ext/dba/tests/bug72885.phpt
@@ -17,7 +17,6 @@ var_dump(dba_fetch('foo', $db));
dba_close($db);
?>
-===DONE===
--CLEAN--
<?php
require_once(__DIR__ .'/clean.inc');
@@ -25,4 +24,3 @@ require_once(__DIR__ .'/clean.inc');
--EXPECT--
bool(true)
string(3) "baz"
-===DONE===
diff --git a/ext/dba/tests/clean.inc b/ext/dba/tests/clean.inc
index 9f6d539a19..83c867de64 100644
--- a/ext/dba/tests/clean.inc
+++ b/ext/dba/tests/clean.inc
@@ -1,6 +1,6 @@
<?php
$db_filename = dirname(__FILE__) .'/test0.dbm'; // see test.inc
- @unlink($db_filename);
- @unlink($db_filename.'.lck');
- @unlink($db_filename.'-lock');
+ @unlink($db_filename);
+ @unlink($db_filename.'.lck');
+ @unlink($db_filename.'-lock');
?>
diff --git a/ext/dba/tests/dba001.phpt b/ext/dba/tests/dba001.phpt
index 836d03da74..79ebb2d237 100644
--- a/ext/dba/tests/dba001.phpt
+++ b/ext/dba/tests/dba001.phpt
@@ -7,13 +7,13 @@ DBA File Creation Test
?>
--FILE--
<?php
- require_once(__DIR__ .'/test.inc');
- echo "database handler: $handler\n";
- if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
- echo "database file created\n";
- dba_close($db_file);
- } else {
- echo "$db_file does not exist\n";
+ require_once(__DIR__ .'/test.inc');
+ echo "database handler: $handler\n";
+ if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
+ echo "database file created\n";
+ dba_close($db_file);
+ } else {
+ echo "$db_file does not exist\n";
}
?>
--CLEAN--
diff --git a/ext/dba/tests/dba002.phpt b/ext/dba/tests/dba002.phpt
index 73b2d42df9..c0432c4599 100644
--- a/ext/dba/tests/dba002.phpt
+++ b/ext/dba/tests/dba002.phpt
@@ -7,15 +7,15 @@ DBA Insert/Fetch Test
?>
--FILE--
<?php
- require_once(__DIR__ .'/test.inc');
- echo "database handler: $handler\n";
- if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
- dba_insert("key1", "This is a test insert", $db_file);
- echo dba_fetch("key1", $db_file);
- dba_close($db_file);
- } else {
- echo "Error creating database\n";
- }
+ require_once(__DIR__ .'/test.inc');
+ echo "database handler: $handler\n";
+ if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
+ dba_insert("key1", "This is a test insert", $db_file);
+ echo dba_fetch("key1", $db_file);
+ dba_close($db_file);
+ } else {
+ echo "Error creating database\n";
+ }
?>
--CLEAN--
<?php
diff --git a/ext/dba/tests/dba003.phpt b/ext/dba/tests/dba003.phpt
index af73282c9f..55d4ce9fe0 100644
--- a/ext/dba/tests/dba003.phpt
+++ b/ext/dba/tests/dba003.phpt
@@ -7,17 +7,17 @@ DBA Insert/Replace/Fetch Test
?>
--FILE--
<?php
- require_once(__DIR__ .'/test.inc');
- echo "database handler: $handler\n";
- if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
- dba_insert("key1", "This is a test insert", $db_file);
- dba_replace("key1", "This is the replacement text", $db_file);
- $a = dba_fetch("key1", $db_file);
- dba_close($db_file);
- echo $a;
- } else {
- echo "Error creating database\n";
- }
+ require_once(__DIR__ .'/test.inc');
+ echo "database handler: $handler\n";
+ if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
+ dba_insert("key1", "This is a test insert", $db_file);
+ dba_replace("key1", "This is the replacement text", $db_file);
+ $a = dba_fetch("key1", $db_file);
+ dba_close($db_file);
+ echo $a;
+ } else {
+ echo "Error creating database\n";
+ }
?>
--CLEAN--
<?php
diff --git a/ext/dba/tests/dba004.phpt b/ext/dba/tests/dba004.phpt
index c197d761d4..3846ccfd29 100644
--- a/ext/dba/tests/dba004.phpt
+++ b/ext/dba/tests/dba004.phpt
@@ -7,21 +7,21 @@ DBA Multiple Insert/Fetch Test
?>
--FILE--
<?php
- require_once(__DIR__ .'/test.inc');
- echo "database handler: $handler\n";
- if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
- dba_insert("key1", "Content String 1", $db_file);
- dba_insert("key2", "Content String 2", $db_file);
- dba_insert("key3", "Third Content String", $db_file);
- dba_insert("key4", "Another Content String", $db_file);
- dba_insert("key5", "The last content string", $db_file);
- $a = dba_fetch("key4", $db_file);
- $b = dba_fetch("key2", $db_file);
- dba_close($db_file);
- echo "$a $b";
- } else {
- echo "Error creating database\n";
- }
+ require_once(__DIR__ .'/test.inc');
+ echo "database handler: $handler\n";
+ if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
+ dba_insert("key1", "Content String 1", $db_file);
+ dba_insert("key2", "Content String 2", $db_file);
+ dba_insert("key3", "Third Content String", $db_file);
+ dba_insert("key4", "Another Content String", $db_file);
+ dba_insert("key5", "The last content string", $db_file);
+ $a = dba_fetch("key4", $db_file);
+ $b = dba_fetch("key2", $db_file);
+ dba_close($db_file);
+ echo "$a $b";
+ } else {
+ echo "Error creating database\n";
+ }
?>
--CLEAN--
<?php
diff --git a/ext/dba/tests/dba005.phpt b/ext/dba/tests/dba005.phpt
index 5173283755..0f5767988d 100644
--- a/ext/dba/tests/dba005.phpt
+++ b/ext/dba/tests/dba005.phpt
@@ -7,28 +7,28 @@ DBA FirstKey/NextKey Loop Test With 5 Items
?>
--FILE--
<?php
- require_once(__DIR__ .'/test.inc');
- echo "database handler: $handler\n";
- if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
- dba_insert("key1", "Content String 1", $db_file);
- dba_insert("key2", "Content String 2", $db_file);
- dba_insert("key3", "Third Content String", $db_file);
- dba_insert("key4", "Another Content String", $db_file);
- dba_insert("key5", "The last content string", $db_file);
- $a = dba_firstkey($db_file);
- $i=0;
- while($a) {
- $a = dba_nextkey($db_file);
- $i++;
- }
- echo $i;
- for ($i=1; $i<6; $i++) {
- echo dba_exists("key$i", $db_file) ? "Y" : "N";
- }
- dba_close($db_file);
- } else {
- echo "Error creating database\n";
- }
+ require_once(__DIR__ .'/test.inc');
+ echo "database handler: $handler\n";
+ if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
+ dba_insert("key1", "Content String 1", $db_file);
+ dba_insert("key2", "Content String 2", $db_file);
+ dba_insert("key3", "Third Content String", $db_file);
+ dba_insert("key4", "Another Content String", $db_file);
+ dba_insert("key5", "The last content string", $db_file);
+ $a = dba_firstkey($db_file);
+ $i=0;
+ while($a) {
+ $a = dba_nextkey($db_file);
+ $i++;
+ }
+ echo $i;
+ for ($i=1; $i<6; $i++) {
+ echo dba_exists("key$i", $db_file) ? "Y" : "N";
+ }
+ dba_close($db_file);
+ } else {
+ echo "Error creating database\n";
+ }
?>
--CLEAN--
<?php
diff --git a/ext/dba/tests/dba006.phpt b/ext/dba/tests/dba006.phpt
index 84814f2bcf..1264ccf899 100644
--- a/ext/dba/tests/dba006.phpt
+++ b/ext/dba/tests/dba006.phpt
@@ -7,30 +7,30 @@ DBA FirstKey/NextKey with 2 deletes
?>
--FILE--
<?php
- require_once(__DIR__ .'/test.inc');
- echo "database handler: $handler\n";
- if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
- dba_insert("key1", "Content String 1", $db_file);
- dba_insert("key2", "Content String 2", $db_file);
- dba_insert("key3", "Third Content String", $db_file);
- dba_insert("key4", "Another Content String", $db_file);
- dba_insert("key5", "The last content string", $db_file);
- dba_delete("key3", $db_file);
- dba_delete("key1", $db_file);
- $a = dba_firstkey($db_file);
- $i=0;
- while($a) {
- $a = dba_nextkey($db_file);
- $i++;
- }
- echo $i;
- for ($i=1; $i<6; $i++) {
- echo dba_exists("key$i", $db_file) ? "Y" : "N";
- }
- dba_close($db_file);
- } else {
- echo "Error creating database\n";
- }
+ require_once(__DIR__ .'/test.inc');
+ echo "database handler: $handler\n";
+ if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
+ dba_insert("key1", "Content String 1", $db_file);
+ dba_insert("key2", "Content String 2", $db_file);
+ dba_insert("key3", "Third Content String", $db_file);
+ dba_insert("key4", "Another Content String", $db_file);
+ dba_insert("key5", "The last content string", $db_file);
+ dba_delete("key3", $db_file);
+ dba_delete("key1", $db_file);
+ $a = dba_firstkey($db_file);
+ $i=0;
+ while($a) {
+ $a = dba_nextkey($db_file);
+ $i++;
+ }
+ echo $i;
+ for ($i=1; $i<6; $i++) {
+ echo dba_exists("key$i", $db_file) ? "Y" : "N";
+ }
+ dba_close($db_file);
+ } else {
+ echo "Error creating database\n";
+ }
?>
--CLEAN--
<?php
diff --git a/ext/dba/tests/dba007.phpt b/ext/dba/tests/dba007.phpt
index 7c8e2b0bd4..bb71ad273e 100644
--- a/ext/dba/tests/dba007.phpt
+++ b/ext/dba/tests/dba007.phpt
@@ -8,30 +8,30 @@ DBA Multiple File Creation Test
?>
--FILE--
<?php
- require_once(__DIR__ .'/test.inc');
- echo "database handler: $handler\n";
- $db_file1 = $db_filename1 = __DIR__.'/test1.dbm';
- $db_file2 = $db_filename2 = __DIR__.'/test2.dbm';
- if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
- echo "database file created\n";
- } else {
- echo "$db_file does not exist\n";
+ require_once(__DIR__ .'/test.inc');
+ echo "database handler: $handler\n";
+ $db_file1 = $db_filename1 = __DIR__.'/test1.dbm';
+ $db_file2 = $db_filename2 = __DIR__.'/test2.dbm';
+ if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
+ echo "database file created\n";
+ } else {
+ echo "$db_file does not exist\n";
}
- if (($db_file1=dba_open($db_file1, "n", $handler))!==FALSE) {
- echo "database file created\n";
- } else {
- echo "$db_file does not exist\n";
+ if (($db_file1=dba_open($db_file1, "n", $handler))!==FALSE) {
+ echo "database file created\n";
+ } else {
+ echo "$db_file does not exist\n";
}
- if (($db_file2=dba_open($db_file2, "n", $handler))!==FALSE) {
- echo "database file created\n";
- } else {
- echo "$db_file does not exist\n";
+ if (($db_file2=dba_open($db_file2, "n", $handler))!==FALSE) {
+ echo "database file created\n";
+ } else {
+ echo "$db_file does not exist\n";
}
- var_dump(dba_list());
- dba_close($db_file);
+ var_dump(dba_list());
+ dba_close($db_file);
- @unlink($db_filename1);
- @unlink($db_filename2);
+ @unlink($db_filename1);
+ @unlink($db_filename2);
?>
--CLEAN--
<?php
diff --git a/ext/dba/tests/dba009.phpt b/ext/dba/tests/dba009.phpt
index d1d612243b..4ca9b0ed96 100644
--- a/ext/dba/tests/dba009.phpt
+++ b/ext/dba/tests/dba009.phpt
@@ -7,22 +7,22 @@ DBA dba_popen Test
?>
--FILE--
<?php
- require_once(__DIR__ .'/test.inc');
- echo "database handler: $handler\n";
- if (($db=dba_popen($db_file, "n", $handler))!==FALSE) {
- echo "Opened\n";
- dba_insert("a", "Inserted", $db);
- echo dba_fetch("a", $db)."\n";
- dba_close($db);
- echo "Closed\n";
- } else {
- echo "Error creating database\n";
- }
- if (($db=dba_popen($db_file, "n", $handler))!==FALSE) {
- echo "Opened\n";
- dba_insert("a", "Inserted", $db);
- echo dba_fetch("a", $db)."\n";
- }
+ require_once(__DIR__ .'/test.inc');
+ echo "database handler: $handler\n";
+ if (($db=dba_popen($db_file, "n", $handler))!==FALSE) {
+ echo "Opened\n";
+ dba_insert("a", "Inserted", $db);
+ echo dba_fetch("a", $db)."\n";
+ dba_close($db);
+ echo "Closed\n";
+ } else {
+ echo "Error creating database\n";
+ }
+ if (($db=dba_popen($db_file, "n", $handler))!==FALSE) {
+ echo "Opened\n";
+ dba_insert("a", "Inserted", $db);
+ echo dba_fetch("a", $db)."\n";
+ }
?>
--CLEAN--
<?php
diff --git a/ext/dba/tests/dba011.phpt b/ext/dba/tests/dba011.phpt
index 087233667c..1a4742c618 100644
--- a/ext/dba/tests/dba011.phpt
+++ b/ext/dba/tests/dba011.phpt
@@ -9,7 +9,6 @@ die("info $HND handler used");
<?php
require_once(__DIR__ .'/test.inc');
echo "database handler: $handler\n";
-var_dump(dba_open($db_file));
var_dump(dba_open($db_file, 'n'));
var_dump(dba_open($db_file, 'n', 'bogus'));
var_dump(dba_open($db_file, 'q', $handler));
@@ -22,9 +21,6 @@ require(__DIR__ .'/clean.inc');
?>
--EXPECTF--
database handler: flatfile
-
-Warning: Wrong parameter count for dba_open() in %sdba011.php on line %d
-NULL
resource(%d) of type (dba)
Warning: dba_open(%stest0.dbm,n): No such handler: bogus in %sdba011.php on line %d
diff --git a/ext/dba/tests/dba015.phpt b/ext/dba/tests/dba015.phpt
index 7d268cbe20..42a448dde9 100644
--- a/ext/dba/tests/dba015.phpt
+++ b/ext/dba/tests/dba015.phpt
@@ -48,7 +48,6 @@ echo dba_fetch("key1", $db_file1), "\n";
echo dba_fetch("key2", $db_file1), "\n";
?>
-===DONE===
--CLEAN--
<?php
require(__DIR__ .'/clean.inc');
@@ -71,4 +70,3 @@ resource(%d) of type (Unknown)
Test 6 - query after closing 2nd resource
This is a test insert 1
This is a test insert 2
-===DONE===
diff --git a/ext/dba/tests/dba016.phpt b/ext/dba/tests/dba016.phpt
index 60bf4da4bf..5d2a35990c 100644
--- a/ext/dba/tests/dba016.phpt
+++ b/ext/dba/tests/dba016.phpt
@@ -15,7 +15,6 @@ echo "database handler: $handler\n";
$db_file1 = dba_popen($db_filename, 'n-t', 'flatfile');
?>
-===DONE===
--CLEAN--
<?php
require(__DIR__ .'/clean.inc');
@@ -24,4 +23,3 @@ $db_file1 = dba_popen($db_filename, 'n-t', 'flatfile');
database handler: flatfile
Warning: dba_popen(%stest0.dbm,n-t): You cannot combine modifiers - (no lock) and t (test lock) in %sdba016.php on line %d
-===DONE===
diff --git a/ext/dba/tests/dba_cdb.phpt b/ext/dba/tests/dba_cdb.phpt
index 87e9992179..956483f5f3 100644
--- a/ext/dba/tests/dba_cdb.phpt
+++ b/ext/dba/tests/dba_cdb.phpt
@@ -8,11 +8,10 @@ DBA CDB handler test
?>
--FILE--
<?php
- $handler = 'cdb';
- require_once(__DIR__ .'/test.inc');
- require_once(__DIR__ .'/dba_handler.inc');
+ $handler = 'cdb';
+ require_once(__DIR__ .'/test.inc');
+ require_once(__DIR__ .'/dba_handler.inc');
?>
-===DONE===
--CLEAN--
<?php
require(__DIR__ .'/clean.inc');
@@ -48,4 +47,3 @@ array(5) {
["key5"]=>
string(23) "The last content string"
}
-===DONE===
diff --git a/ext/dba/tests/dba_cdb_001.phpt b/ext/dba/tests/dba_cdb_001.phpt
index 82a1c0b585..3e72d54dab 100644
--- a/ext/dba/tests/dba_cdb_001.phpt
+++ b/ext/dba/tests/dba_cdb_001.phpt
@@ -61,7 +61,6 @@ else {
}
?>
-===DONE===
--CLEAN--
<?php
require(__DIR__ .'/clean.inc');
@@ -86,4 +85,3 @@ Test 3
Warning: dba_open(%stest0.dbm,w): Driver initialization failed for handler: cdb: Update operations are not supported in %sdba_cdb_001.php on line %d
Failed to open DB
-===DONE===
diff --git a/ext/dba/tests/dba_cdb_make.phpt b/ext/dba/tests/dba_cdb_make.phpt
index 33fcd6ea47..21969db074 100644
--- a/ext/dba/tests/dba_cdb_make.phpt
+++ b/ext/dba/tests/dba_cdb_make.phpt
@@ -8,27 +8,27 @@ DBA CDB_MAKE handler test
?>
--FILE--
<?php
- $handler = 'cdb_make';
- require_once(__DIR__ .'/test.inc');
- echo "database handler: $handler\n";
- // print md5 checksum of test.cdb which is generated by cdb_make program
- var_dump(md5_file(__DIR__.'/test.cdb'));
- if (($db_make=dba_open($db_file, "n", $handler))!==FALSE) {
- dba_insert("1", "1", $db_make);
- dba_insert("2", "2", $db_make);
- dba_insert("1", "3", $db_make);
- dba_insert("2", "1", $db_make);
- dba_insert("3", "3", $db_make);
- dba_insert("1", "2", $db_make);
- dba_insert("4", "4", $db_make);
+ $handler = 'cdb_make';
+ require_once(__DIR__ .'/test.inc');
+ echo "database handler: $handler\n";
+ // print md5 checksum of test.cdb which is generated by cdb_make program
+ var_dump(md5_file(__DIR__.'/test.cdb'));
+ if (($db_make=dba_open($db_file, "n", $handler))!==FALSE) {
+ dba_insert("1", "1", $db_make);
+ dba_insert("2", "2", $db_make);
+ dba_insert("1", "3", $db_make);
+ dba_insert("2", "1", $db_make);
+ dba_insert("3", "3", $db_make);
+ dba_insert("1", "2", $db_make);
+ dba_insert("4", "4", $db_make);
// dba_replace cdb_make doesn't know replace
- dba_close($db_make);
- // write md5 checksum of generated database file
- var_dump(md5_file($db_file));
- // no need to test created database: this is done by dba_cdb_read.phpt
- } else {
- echo "Error creating database\n";
- }
+ dba_close($db_make);
+ // write md5 checksum of generated database file
+ var_dump(md5_file($db_file));
+ // no need to test created database: this is done by dba_cdb_read.phpt
+ } else {
+ echo "Error creating database\n";
+ }
?>
--CLEAN--
<?php
diff --git a/ext/dba/tests/dba_cdb_read.phpt b/ext/dba/tests/dba_cdb_read.phpt
index 91ca6e9853..39fc85e454 100644
--- a/ext/dba/tests/dba_cdb_read.phpt
+++ b/ext/dba/tests/dba_cdb_read.phpt
@@ -7,53 +7,53 @@ DBA CDB handler test (read only)
?>
--FILE--
<?php
- echo "database handler: cdb\n";
- $handler = 'cdb';
- $db_file = __DIR__.'/test.cdb';
- if (($db_file=dba_open($db_file, "r", $handler))!==FALSE) {
- // read key sequence
- $a = dba_firstkey($db_file);
- $count= 0;
- $keys = $a;
- while($a) {
- $a = dba_nextkey($db_file);
- $keys .= $a;
- $count++;
- }
- // display number of entries and key existence
- echo $count;
- for ($i=1; $i<8; $i++) {
- echo dba_exists($i, $db_file) ? "Y" : "N";
- }
- echo "\n=";
- echo dba_fetch(1, $db_file);
- echo dba_fetch(2, $db_file);
- echo dba_fetch(3, $db_file);
- echo dba_fetch(4, $db_file);
- echo "\n#";
- echo dba_fetch(1, $db_file);
- echo dba_fetch(1, $db_file);
- echo dba_fetch(2, $db_file);
- echo dba_fetch(2, $db_file);
- echo "\n?".$keys;
- // with skip = 0 dba_fetch must fetch the first result
- echo "\n#";
- $skip = array();
- for ($i=0; $i < strlen($keys); $i++) {
- $key = substr($keys, $i, 1);
- $skip[$key] = 0;
- echo dba_fetch($key, $db_file);
- }
- echo "\n=";
- for ($i=0; $i < strlen($keys); $i++) {
- $key = substr($keys, $i, 1);
- echo dba_fetch($key, $skip[$key], $db_file);
- $skip[$key]++;
- }
- dba_close($db_file);
- } else {
- echo "Error creating database\n";
- }
+ echo "database handler: cdb\n";
+ $handler = 'cdb';
+ $db_file = __DIR__.'/test.cdb';
+ if (($db_file=dba_open($db_file, "r", $handler))!==FALSE) {
+ // read key sequence
+ $a = dba_firstkey($db_file);
+ $count= 0;
+ $keys = $a;
+ while($a) {
+ $a = dba_nextkey($db_file);
+ $keys .= $a;
+ $count++;
+ }
+ // display number of entries and key existence
+ echo $count;
+ for ($i=1; $i<8; $i++) {
+ echo dba_exists($i, $db_file) ? "Y" : "N";
+ }
+ echo "\n=";
+ echo dba_fetch(1, $db_file);
+ echo dba_fetch(2, $db_file);
+ echo dba_fetch(3, $db_file);
+ echo dba_fetch(4, $db_file);
+ echo "\n#";
+ echo dba_fetch(1, $db_file);
+ echo dba_fetch(1, $db_file);
+ echo dba_fetch(2, $db_file);
+ echo dba_fetch(2, $db_file);
+ echo "\n?".$keys;
+ // with skip = 0 dba_fetch must fetch the first result
+ echo "\n#";
+ $skip = array();
+ for ($i=0; $i < strlen($keys); $i++) {
+ $key = substr($keys, $i, 1);
+ $skip[$key] = 0;
+ echo dba_fetch($key, $db_file);
+ }
+ echo "\n=";
+ for ($i=0; $i < strlen($keys); $i++) {
+ $key = substr($keys, $i, 1);
+ echo dba_fetch($key, $skip[$key], $db_file);
+ $skip[$key]++;
+ }
+ dba_close($db_file);
+ } else {
+ echo "Error creating database\n";
+ }
?>
--EXPECT--
database handler: cdb
diff --git a/ext/dba/tests/dba_db1.phpt b/ext/dba/tests/dba_db1.phpt
index c378aaf3c2..26711c9d5e 100644
--- a/ext/dba/tests/dba_db1.phpt
+++ b/ext/dba/tests/dba_db1.phpt
@@ -7,11 +7,10 @@ DBA DB1 handler test
?>
--FILE--
<?php
- $handler = 'db1';
- require_once __DIR__ .'/test.inc';
- require_once __DIR__ .'/dba_handler.inc';
+ $handler = 'db1';
+ require_once __DIR__ .'/test.inc';
+ require_once __DIR__ .'/dba_handler.inc';
?>
-===DONE===
--EXPECT--
database handler: db1
3NYNYY
@@ -47,4 +46,3 @@ array(3) {
["key5"]=>
string(23) "The last content string"
}
-===DONE===
diff --git a/ext/dba/tests/dba_db2.phpt b/ext/dba/tests/dba_db2.phpt
index 8662189cbd..013813062a 100644
--- a/ext/dba/tests/dba_db2.phpt
+++ b/ext/dba/tests/dba_db2.phpt
@@ -7,11 +7,10 @@ DBA DB2 handler test
?>
--FILE--
<?php
- $handler = 'db2';
- require_once __DIR__ .'/test.inc';
- require_once __DIR__ .'/dba_handler.inc';
+ $handler = 'db2';
+ require_once __DIR__ .'/test.inc';
+ require_once __DIR__ .'/dba_handler.inc';
?>
-===DONE===
--EXPECT--
database handler: db2
3NYNYY
@@ -47,4 +46,3 @@ array(3) {
["key5"]=>
string(23) "The last content string"
}
-===DONE===
diff --git a/ext/dba/tests/dba_db3.phpt b/ext/dba/tests/dba_db3.phpt
index 670680cb8a..f3c2061414 100644
--- a/ext/dba/tests/dba_db3.phpt
+++ b/ext/dba/tests/dba_db3.phpt
@@ -7,11 +7,10 @@ DBA DB3 handler test
?>
--FILE--
<?php
- $handler = 'db3';
- require_once __DIR__ .'/test.inc';
- require_once __DIR__ .'/dba_handler.inc';
+ $handler = 'db3';
+ require_once __DIR__ .'/test.inc';
+ require_once __DIR__ .'/dba_handler.inc';
?>
-===DONE===
--EXPECT--
database handler: db3
3NYNYY
@@ -47,4 +46,3 @@ array(3) {
["key5"]=>
string(23) "The last content string"
}
-===DONE===
diff --git a/ext/dba/tests/dba_db4_000.phpt b/ext/dba/tests/dba_db4_000.phpt
index afeedff47c..4453e06284 100644
--- a/ext/dba/tests/dba_db4_000.phpt
+++ b/ext/dba/tests/dba_db4_000.phpt
@@ -11,7 +11,6 @@ $handler = 'db4';
require_once(__DIR__ .'/test.inc');
require_once(__DIR__ .'/dba_handler.inc');
?>
-===DONE===
--CLEAN--
<?php
require(__DIR__ .'/clean.inc');
@@ -51,4 +50,3 @@ array(3) {
["key5"]=>
string(23) "The last content string"
}
-===DONE===
diff --git a/ext/dba/tests/dba_db4_018.phpt b/ext/dba/tests/dba_db4_018.phpt
index e4b4cfcf27..e69d60489d 100644
--- a/ext/dba/tests/dba_db4_018.phpt
+++ b/ext/dba/tests/dba_db4_018.phpt
@@ -48,7 +48,6 @@ echo dba_fetch("key1", $db_file1), "\n";
echo dba_fetch("key2", $db_file1), "\n";
?>
-===DONE===
--CLEAN--
<?php
require(__DIR__ .'/clean.inc');
@@ -73,4 +72,3 @@ resource(%d) of type (Unknown)
Test 6 - query after closing 2nd resource
This is a test insert 1
This is a test insert 2
-===DONE===
diff --git a/ext/dba/tests/dba_db4_optimize.phpt b/ext/dba/tests/dba_db4_optimize.phpt
index 8a039b7152..1b09f94326 100644
--- a/ext/dba/tests/dba_db4_optimize.phpt
+++ b/ext/dba/tests/dba_db4_optimize.phpt
@@ -25,8 +25,6 @@ if (($db_file=dba_open($db_filename, "n", $handler))!==FALSE) {
}
?>
-===DONE===
-<?php exit(0); ?>
--CLEAN--
<?php
require(__DIR__ .'/clean.inc');
@@ -35,4 +33,3 @@ require(__DIR__ .'/clean.inc');
database handler: db4
YY
bool(true)
-===DONE===
diff --git a/ext/dba/tests/dba_db4_sync.phpt b/ext/dba/tests/dba_db4_sync.phpt
index e659333907..4bee99b67d 100644
--- a/ext/dba/tests/dba_db4_sync.phpt
+++ b/ext/dba/tests/dba_db4_sync.phpt
@@ -25,8 +25,6 @@ if (($db_file=dba_open($db_filename, "n", $handler))!==FALSE) {
}
?>
-===DONE===
-<?php exit(0); ?>
--CLEAN--
<?php
require(__DIR__ .'/clean.inc');
@@ -35,4 +33,3 @@ require(__DIR__ .'/clean.inc');
database handler: db4
YY
bool(true)
-===DONE===
diff --git a/ext/dba/tests/dba_dbm.phpt b/ext/dba/tests/dba_dbm.phpt
index 39f0a99fae..47bbae28c0 100644
--- a/ext/dba/tests/dba_dbm.phpt
+++ b/ext/dba/tests/dba_dbm.phpt
@@ -7,11 +7,10 @@ DBA DBM handler test
?>
--FILE--
<?php
- $handler = 'dbm';
- require_once __DIR__ .'/test.inc';
- require_once __DIR__ .'/dba_handler.inc';
+ $handler = 'dbm';
+ require_once __DIR__ .'/test.inc';
+ require_once __DIR__ .'/dba_handler.inc';
?>
-===DONE===
--CLEAN--
<?php
require(__DIR__ .'/clean.inc');
@@ -51,4 +50,3 @@ array(3) {
["key5"]=>
string(23) "The last content string"
}
-===DONE===
diff --git a/ext/dba/tests/dba_flatfile.phpt b/ext/dba/tests/dba_flatfile.phpt
index 4fcaafe32d..41bd0f891d 100644
--- a/ext/dba/tests/dba_flatfile.phpt
+++ b/ext/dba/tests/dba_flatfile.phpt
@@ -7,11 +7,10 @@ DBA FlatFile handler test
?>
--FILE--
<?php
- $handler = 'flatfile';
- require_once(__DIR__ .'/test.inc');
- require_once(__DIR__ .'/dba_handler.inc');
+ $handler = 'flatfile';
+ require_once(__DIR__ .'/test.inc');
+ require_once(__DIR__ .'/dba_handler.inc');
?>
-===DONE===
--CLEAN--
<?php
require(__DIR__ .'/clean.inc');
@@ -51,4 +50,3 @@ array(3) {
["key5"]=>
string(23) "The last content string"
}
-===DONE===
diff --git a/ext/dba/tests/dba_gdbm.phpt b/ext/dba/tests/dba_gdbm.phpt
index 8ca2adfe04..ae4216d7fd 100644
--- a/ext/dba/tests/dba_gdbm.phpt
+++ b/ext/dba/tests/dba_gdbm.phpt
@@ -7,14 +7,13 @@ DBA GDBM handler test
?>
--FILE--
<?php
- $handler = 'gdbm';
- require_once __DIR__ .'/test.inc';
- $lock_flag = ''; // lock in library
- require_once __DIR__ .'/dba_handler.inc';
+ $handler = 'gdbm';
+ require_once __DIR__ .'/test.inc';
+ $lock_flag = ''; // lock in library
+ require_once __DIR__ .'/dba_handler.inc';
- // Read during write is system dependent. Important is that there is no deadlock
+ // Read during write is system dependent. Important is that there is no deadlock
?>
-===DONE===
--EXPECTF--
database handler: gdbm
3NYNYY
@@ -33,4 +32,3 @@ array(3) {
["key5"]=>
string(23) "The last content string"
}
-===DONE===
diff --git a/ext/dba/tests/dba_handler.inc b/ext/dba/tests/dba_handler.inc
index 51f27050ca..9b9d030c39 100644
--- a/ext/dba/tests/dba_handler.inc
+++ b/ext/dba/tests/dba_handler.inc
@@ -3,96 +3,96 @@
echo "database handler: $handler\n";
do {
- if (($db_file = dba_open($db_filename, 'n'.$lock_flag, $handler))!==FALSE) {
- dba_insert("key1", "Content String 1", $db_file);
- dba_insert("key2", "Content String 2", $db_file);
- dba_insert("key3", "Third Content String", $db_file);
- dba_insert("key4", "Another Content String", $db_file);
- dba_insert("key5", "The last content string", $db_file);
- if ($handler != 'cdb') {
- dba_delete("key3", $db_file);
- dba_delete("key1", $db_file);
- } else {
- dba_close($db_file);
- if (($db_file = dba_open($db_filename, 'r'.$lock_flag, $handler))===FALSE) {
- echo "Error reopening database\n";
- }
- }
- $a = dba_firstkey($db_file);
- $i=0;
- while($a) {
- $a = dba_nextkey($db_file);
- $i++;
- }
- echo $i;
- for ($i=1; $i<6; $i++) {
- echo dba_exists("key$i", $db_file) ? "Y" : "N";
- }
- echo "\n";
- echo dba_fetch("key2", $db_file)."\n";
- if ($handler != 'cdb') {
- dba_replace("key2", "Content 2 replaced", $db_file);
- echo dba_fetch("key2", $db_file)."\n";
- }
- dba_close($db_file);
- } else {
- echo "Error creating database\n";
- }
- if ($handler != 'cdb') {
- $db_writer = dba_open($db_filename, 'c'.$lock_flag, $handler);
- if (($dba_reader = @dba_open($db_filename, 'r'.$lock_flag.'t', $handler))===false) {
- echo "Read during write: not allowed\n";
- } else {
- echo "Read during write: allowed\n";
- }
- if ($db_writer!==FALSE) {
- if (dba_insert("key number 6", "The 6th value", $db_writer)) {
- echo '"key number 6" written' . "\n";
- } else {
- echo 'Failed to write "key number 6"' . "\n";
- }
- if (dba_insert("key number 6", "The 6th value inserted again would be an error", $db_writer)) {
- echo '"key number 6" written 2nd time' . "\n";
- } else {
- echo 'Failed to write "key number 6" 2nd time' . "\n";
- }
- dba_replace("key2", "Content 2 replaced 2nd time", $db_writer);
- dba_delete("key4", $db_writer);
- echo dba_fetch("key2", $db_writer)."\n";
- echo dba_fetch("key number 6", $db_writer)."\n";
- dba_close($db_writer); // when the writer is open at least db3 would fail because of buffered io.
- } else {
- die("Error reopening database\n");
- }
- }
- if (($db_file = dba_open($db_filename, 'r'.$lock_flag, $handler))!==FALSE) {
- $key = dba_firstkey($db_file);
- $res = array();
- while($key) {
- $res[$key] = dba_fetch($key, $db_file);
- $key = dba_nextkey($db_file);
- }
- ksort($res);
- var_dump($res);
- dba_close($db_file);
- } else {
- echo "Error reading database\n";
- }
- if (!empty($dba_reader)) {
- dba_close($dba_reader);
- }
- if (($db_file = dba_popen($db_filename, 'r'.($lock_flag==''?'':'-'), $handler))!==FALSE) {
- if ($handler == 'dbm' || $handler == "tcadb") {
- dba_close($db_file);
- }
- }
+ if (($db_file = dba_open($db_filename, 'n'.$lock_flag, $handler))!==FALSE) {
+ dba_insert("key1", "Content String 1", $db_file);
+ dba_insert("key2", "Content String 2", $db_file);
+ dba_insert("key3", "Third Content String", $db_file);
+ dba_insert("key4", "Another Content String", $db_file);
+ dba_insert("key5", "The last content string", $db_file);
+ if ($handler != 'cdb') {
+ dba_delete("key3", $db_file);
+ dba_delete("key1", $db_file);
+ } else {
+ dba_close($db_file);
+ if (($db_file = dba_open($db_filename, 'r'.$lock_flag, $handler))===FALSE) {
+ echo "Error reopening database\n";
+ }
+ }
+ $a = dba_firstkey($db_file);
+ $i=0;
+ while($a) {
+ $a = dba_nextkey($db_file);
+ $i++;
+ }
+ echo $i;
+ for ($i=1; $i<6; $i++) {
+ echo dba_exists("key$i", $db_file) ? "Y" : "N";
+ }
+ echo "\n";
+ echo dba_fetch("key2", $db_file)."\n";
+ if ($handler != 'cdb') {
+ dba_replace("key2", "Content 2 replaced", $db_file);
+ echo dba_fetch("key2", $db_file)."\n";
+ }
+ dba_close($db_file);
+ } else {
+ echo "Error creating database\n";
+ }
+ if ($handler != 'cdb') {
+ $db_writer = dba_open($db_filename, 'c'.$lock_flag, $handler);
+ if (($dba_reader = @dba_open($db_filename, 'r'.$lock_flag.'t', $handler))===false) {
+ echo "Read during write: not allowed\n";
+ } else {
+ echo "Read during write: allowed\n";
+ }
+ if ($db_writer!==FALSE) {
+ if (dba_insert("key number 6", "The 6th value", $db_writer)) {
+ echo '"key number 6" written' . "\n";
+ } else {
+ echo 'Failed to write "key number 6"' . "\n";
+ }
+ if (dba_insert("key number 6", "The 6th value inserted again would be an error", $db_writer)) {
+ echo '"key number 6" written 2nd time' . "\n";
+ } else {
+ echo 'Failed to write "key number 6" 2nd time' . "\n";
+ }
+ dba_replace("key2", "Content 2 replaced 2nd time", $db_writer);
+ dba_delete("key4", $db_writer);
+ echo dba_fetch("key2", $db_writer)."\n";
+ echo dba_fetch("key number 6", $db_writer)."\n";
+ dba_close($db_writer); // when the writer is open at least db3 would fail because of buffered io.
+ } else {
+ die("Error reopening database\n");
+ }
+ }
+ if (($db_file = dba_open($db_filename, 'r'.$lock_flag, $handler))!==FALSE) {
+ $key = dba_firstkey($db_file);
+ $res = array();
+ while($key) {
+ $res[$key] = dba_fetch($key, $db_file);
+ $key = dba_nextkey($db_file);
+ }
+ ksort($res);
+ var_dump($res);
+ dba_close($db_file);
+ } else {
+ echo "Error reading database\n";
+ }
+ if (!empty($dba_reader)) {
+ dba_close($dba_reader);
+ }
+ if (($db_file = dba_popen($db_filename, 'r'.($lock_flag==''?'':'-'), $handler))!==FALSE) {
+ if ($handler == 'dbm' || $handler == "tcadb") {
+ dba_close($db_file);
+ }
+ }
- if ($lock_flag == '') {
- break;
- } else {
- echo "--NO-LOCK--\n";
- $lock_flag = '';
- }
+ if ($lock_flag == '') {
+ break;
+ } else {
+ echo "--NO-LOCK--\n";
+ $lock_flag = '';
+ }
} while(1);
?>
diff --git a/ext/dba/tests/dba_handlers.phpt b/ext/dba/tests/dba_handlers.phpt
index a6f104f16a..f3c299ce2a 100644
--- a/ext/dba/tests/dba_handlers.phpt
+++ b/ext/dba/tests/dba_handlers.phpt
@@ -35,13 +35,9 @@ check(dba_handlers(null));
echo "Test 3\n";
-check(dba_handlers(1, 2));
-
-echo "Test 4\n";
-
check(dba_handlers(0));
-echo "Test 5 - full info\n";
+echo "Test 4 - full info\n";
$h = dba_handlers(1);
foreach ($h as $key => $val) {
if ($key === "flatfile") {
@@ -61,9 +57,6 @@ Success: flatfile enabled
Test 2
Success: flatfile enabled
Test 3
-
-Warning: dba_handlers() expects at most 1 parameter, 2 given in %sdba_handlers.php on line %d
-Test 4
Success: flatfile enabled
-Test 5 - full info
+Test 4 - full info
Success: flatfile enabled
diff --git a/ext/dba/tests/dba_inifile.phpt b/ext/dba/tests/dba_inifile.phpt
index c21413f1ac..e9bc185bf4 100644
--- a/ext/dba/tests/dba_inifile.phpt
+++ b/ext/dba/tests/dba_inifile.phpt
@@ -7,11 +7,10 @@ DBA INIFILE handler test
?>
--FILE--
<?php
- $handler = 'inifile';
- require_once __DIR__ .'/test.inc';
- require_once __DIR__ .'/dba_handler.inc';
+ $handler = 'inifile';
+ require_once __DIR__ .'/test.inc';
+ require_once __DIR__ .'/dba_handler.inc';
?>
-===DONE===
--CLEAN--
<?php
require(__DIR__ .'/clean.inc');
@@ -51,4 +50,3 @@ array(3) {
["key5"]=>
string(23) "The last content string"
}
-===DONE===
diff --git a/ext/dba/tests/dba_lmdb.phpt b/ext/dba/tests/dba_lmdb.phpt
index 3ca8bfeb07..a97244bf36 100644
--- a/ext/dba/tests/dba_lmdb.phpt
+++ b/ext/dba/tests/dba_lmdb.phpt
@@ -7,12 +7,11 @@ DBA LMDB handler test
?>
--FILE--
<?php
- $handler = 'lmdb';
- require_once __DIR__ .'/test.inc';
- $lock_flag = ''; // lock in library
- require_once __DIR__ .'/dba_handler.inc';
+ $handler = 'lmdb';
+ require_once __DIR__ .'/test.inc';
+ $lock_flag = ''; // lock in library
+ require_once __DIR__ .'/dba_handler.inc';
?>
-===DONE===
--CLEAN--
<?php
require_once __DIR__ .'/clean.inc';
@@ -35,4 +34,3 @@ array(3) {
["key5"]=>
string(23) "The last content string"
}
-===DONE===
diff --git a/ext/dba/tests/dba_ndbm.phpt b/ext/dba/tests/dba_ndbm.phpt
index 616bcb2c6b..74f316e190 100644
--- a/ext/dba/tests/dba_ndbm.phpt
+++ b/ext/dba/tests/dba_ndbm.phpt
@@ -7,11 +7,10 @@ DBA NDBM handler test
?>
--FILE--
<?php
- $handler = 'ndbm';
- require_once __DIR__ .'/test.inc';
- require_once __DIR__ .'/dba_handler.inc';
+ $handler = 'ndbm';
+ require_once __DIR__ .'/test.inc';
+ require_once __DIR__ .'/dba_handler.inc';
?>
-===DONE===
--EXPECT--
database handler: ndbm
3NYNYY
@@ -47,4 +46,3 @@ array(3) {
["key5"]=>
string(23) "The last content string"
}
-===DONE===
diff --git a/ext/dba/tests/dba_optimize.phpt b/ext/dba/tests/dba_optimize.phpt
index db258f5ff7..fb54531e5a 100644
--- a/ext/dba/tests/dba_optimize.phpt
+++ b/ext/dba/tests/dba_optimize.phpt
@@ -23,8 +23,6 @@ if (($db_file=dba_open($db_filename, "n", $handler))!==FALSE) {
echo dba_exists("key$i", $db_file) ? "Y" : "N";
}
echo "\n";
- var_dump(dba_optimize());
- var_dump(dba_optimize(""));
var_dump(dba_optimize($db_file));
dba_close($db_file);
} else {
@@ -32,8 +30,6 @@ if (($db_file=dba_open($db_filename, "n", $handler))!==FALSE) {
}
?>
-===DONE===
-<?php exit(0); ?>
--CLEAN--
<?php
require(__DIR__ .'/clean.inc');
@@ -41,11 +37,4 @@ if (($db_file=dba_open($db_filename, "n", $handler))!==FALSE) {
--EXPECTF--
database handler: flatfile
2YY
-
-Warning: dba_optimize() expects exactly 1 parameter, 0 given in %sdba_optimize.php on line %d
-NULL
-
-Warning: dba_optimize() expects parameter 1 to be resource, string given in %sdba_optimize.php on line %d
-NULL
bool(true)
-===DONE===
diff --git a/ext/dba/tests/dba_qdbm.phpt b/ext/dba/tests/dba_qdbm.phpt
index 4f2a097c38..efe34653b3 100644
--- a/ext/dba/tests/dba_qdbm.phpt
+++ b/ext/dba/tests/dba_qdbm.phpt
@@ -7,12 +7,11 @@ DBA QDBM handler test
?>
--FILE--
<?php
- $handler = 'qdbm';
- require_once __DIR__ .'/test.inc';
- $lock_flag = ''; // lock in library
- require_once __DIR__ .'/dba_handler.inc';
+ $handler = 'qdbm';
+ require_once __DIR__ .'/test.inc';
+ $lock_flag = ''; // lock in library
+ require_once __DIR__ .'/dba_handler.inc';
?>
-===DONE===
--CLEAN--
<?php
require(__DIR__ .'/clean.inc');
@@ -35,4 +34,3 @@ array(3) {
["key5"]=>
string(23) "The last content string"
}
-===DONE===
diff --git a/ext/dba/tests/dba_split.phpt b/ext/dba/tests/dba_split.phpt
index 37a2157666..c320163ec0 100644
--- a/ext/dba/tests/dba_split.phpt
+++ b/ext/dba/tests/dba_split.phpt
@@ -7,7 +7,6 @@ DBA Split Test
?>
--FILE--
<?php
-var_dump(dba_key_split("key1", "name"));
var_dump(dba_key_split(1));
var_dump(dba_key_split(null));
var_dump(dba_key_split(""));
@@ -20,11 +19,7 @@ var_dump(dba_key_split("[key1]name1[key2]name2"));
var_dump(dba_key_split("[key1]name1"));
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
-Warning: Wrong parameter count for dba_key_split() in %sdba_split.php on line %d
-NULL
array(2) {
[0]=>
string(0) ""
@@ -80,4 +75,3 @@ array(2) {
[1]=>
string(5) "name1"
}
-===DONE===
diff --git a/ext/dba/tests/dba_sync.phpt b/ext/dba/tests/dba_sync.phpt
index 7210469cd5..8ca7606626 100644
--- a/ext/dba/tests/dba_sync.phpt
+++ b/ext/dba/tests/dba_sync.phpt
@@ -23,8 +23,6 @@ if (($db_file=dba_open($db_filename, "n", $handler))!==FALSE) {
echo dba_exists("key$i", $db_file) ? "Y" : "N";
}
echo "\n";
- var_dump(dba_sync());
- var_dump(dba_sync(""));
var_dump(dba_sync($db_file));
dba_close($db_file);
} else {
@@ -32,8 +30,6 @@ if (($db_file=dba_open($db_filename, "n", $handler))!==FALSE) {
}
?>
-===DONE===
-<?php exit(0); ?>
--CLEAN--
<?php
require(__DIR__ .'/clean.inc');
@@ -41,11 +37,4 @@ if (($db_file=dba_open($db_filename, "n", $handler))!==FALSE) {
--EXPECTF--
database handler: flatfile
2YY
-
-Warning: dba_sync() expects exactly 1 parameter, 0 given in %sdba_sync.php on line %d
-NULL
-
-Warning: dba_sync() expects parameter 1 to be resource, string given in %sdba_sync.php on line %d
-NULL
bool(true)
-===DONE===
diff --git a/ext/dba/tests/dba_tcadb.phpt b/ext/dba/tests/dba_tcadb.phpt
index 04246a29f3..0d7c32f06c 100644
--- a/ext/dba/tests/dba_tcadb.phpt
+++ b/ext/dba/tests/dba_tcadb.phpt
@@ -11,9 +11,8 @@ DBA TCADB handler test
$db_filename = $db_file = __DIR__ .'/test0.tch';
@unlink($db_filename);
@unlink($db_filename.'.lck');
- require_once __DIR__ .'/dba_handler.inc';
+ require_once __DIR__ .'/dba_handler.inc';
?>
-===DONE===
--CLEAN--
<?php
$db_filename = $db_file = __DIR__ .'/test0.tch';
@@ -55,4 +54,3 @@ array(3) {
["key5"]=>
string(23) "The last content string"
}
-===DONE===
diff --git a/ext/dba/tests/skipif.inc b/ext/dba/tests/skipif.inc
index e75000fafd..b0530ca64f 100644
--- a/ext/dba/tests/skipif.inc
+++ b/ext/dba/tests/skipif.inc
@@ -1,23 +1,23 @@
<?php
- if (!extension_loaded('dba')) die('skip dba extension not available');
- if (!function_exists('dba_handlers')) die ('skip dba_handlers() not available');
- if (!sizeof(dba_handlers())) die('skip no handlers installed');
- if (!isset($handler)) {
- $handlers = dba_handlers();
- if (in_array('flatfile', $handlers)) {
- $handler = 'flatfile';
- } else {
- $handlers = array_diff($handlers, array('cdb', 'cdb_make')); /* these can only read OR write */
- if (count($handlers)==0) {
- die('skip no handler available that can be used for the test');
- }
- $handler = array_shift($handlers);
- }
- } else {
- if (!in_array($handler, dba_handlers())) {
- $HND = strtoupper($handler);
- die("skip $HND handler not available");
- }
- }
- $HND = strtoupper($handler);
+ if (!extension_loaded('dba')) die('skip dba extension not available');
+ if (!function_exists('dba_handlers')) die ('skip dba_handlers() not available');
+ if (!sizeof(dba_handlers())) die('skip no handlers installed');
+ if (!isset($handler)) {
+ $handlers = dba_handlers();
+ if (in_array('flatfile', $handlers)) {
+ $handler = 'flatfile';
+ } else {
+ $handlers = array_diff($handlers, array('cdb', 'cdb_make')); /* these can only read OR write */
+ if (count($handlers)==0) {
+ die('skip no handler available that can be used for the test');
+ }
+ $handler = array_shift($handlers);
+ }
+ } else {
+ if (!in_array($handler, dba_handlers())) {
+ $HND = strtoupper($handler);
+ die("skip $HND handler not available");
+ }
+ }
+ $HND = strtoupper($handler);
?>
diff --git a/ext/dba/tests/test.inc b/ext/dba/tests/test.inc
index 7c4e207b82..458c4399e9 100644
--- a/ext/dba/tests/test.inc
+++ b/ext/dba/tests/test.inc
@@ -1,7 +1,7 @@
<?php
- require_once dirname(__FILE__) .'/skipif.inc';
- $lock_flag = 'l';
- $db_filename = $db_file = dirname(__FILE__) .'/test0.dbm';
- @unlink($db_filename);
- @unlink($db_filename.'.lck');
+ require_once dirname(__FILE__) .'/skipif.inc';
+ $lock_flag = 'l';
+ $db_filename = $db_file = dirname(__FILE__) .'/test0.dbm';
+ @unlink($db_filename);
+ @unlink($db_filename.'.lck');
?>
diff --git a/ext/dom/attr.c b/ext/dom/attr.c
index 9326e145bf..1f24869f0d 100644
--- a/ext/dom/attr.c
+++ b/ext/dom/attr.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -26,16 +24,7 @@
#if HAVE_LIBXML && HAVE_DOM
#include "php_dom.h"
-
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_attr_is_id, 0, 0, 0)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_attr_construct, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO();
-/* }}} */
+#include "dom_arginfo.h"
/*
* class DOMAttr extends DOMNode
@@ -45,8 +34,8 @@ ZEND_END_ARG_INFO();
*/
const zend_function_entry php_dom_attr_class_functions[] = {
- PHP_FALIAS(isId, dom_attr_is_id, arginfo_dom_attr_is_id)
- PHP_ME(domattr, __construct, arginfo_dom_attr_construct, ZEND_ACC_PUBLIC)
+ PHP_ME(domattr, isId, arginfo_class_DOMAttr_isId, ZEND_ACC_PUBLIC)
+ PHP_ME(domattr, __construct, arginfo_class_DOMAttr___construct, ZEND_ACC_PUBLIC)
PHP_FE_END
};
@@ -59,8 +48,8 @@ PHP_METHOD(domattr, __construct)
char *name, *value = NULL;
size_t name_len, value_len, name_valid;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "s|s", &name, &name_len, &value, &value_len) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", &name, &name_len, &value, &value_len) == FAILURE) {
+ RETURN_THROWS();
}
intern = Z_DOMOBJ_P(ZEND_THIS);
@@ -220,11 +209,11 @@ int dom_attr_schema_type_info_read(dom_object *obj, zval *retval)
/* }}} */
-/* {{{ proto bool dom_attr_is_id()
+/* {{{ proto bool domattr::isId()
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Attr-isId
Since: DOM Level 3
*/
-PHP_FUNCTION(dom_attr_is_id)
+PHP_METHOD(domattr, isId)
{
zval *id;
dom_object *intern;
@@ -232,7 +221,7 @@ PHP_FUNCTION(dom_attr_is_id)
id = ZEND_THIS;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(attrp, id, xmlAttrPtr, intern);
diff --git a/ext/dom/cdatasection.c b/ext/dom/cdatasection.c
index 4d34e58a61..ee660feda0 100644
--- a/ext/dom/cdatasection.c
+++ b/ext/dom/cdatasection.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -24,13 +22,7 @@
#include "php.h"
#if HAVE_LIBXML && HAVE_DOM
#include "php_dom.h"
-
-
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_cdatasection_construct, 0, 0, 1)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO();
-/* }}} */
+#include "dom_arginfo.h"
/*
* class DOMCdataSection extends DOMText
@@ -40,7 +32,7 @@ ZEND_END_ARG_INFO();
*/
const zend_function_entry php_dom_cdatasection_class_functions[] = {
- PHP_ME(domcdatasection, __construct, arginfo_dom_cdatasection_construct, ZEND_ACC_PUBLIC)
+ PHP_ME(domcdatasection, __construct, arginfo_class_DOMCdataSection___construct, ZEND_ACC_PUBLIC)
PHP_FE_END
};
@@ -52,15 +44,15 @@ PHP_METHOD(domcdatasection, __construct)
char *value = NULL;
size_t value_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "s", &value, &value_len) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &value, &value_len) == FAILURE) {
+ RETURN_THROWS();
}
nodep = xmlNewCDataBlock(NULL, (xmlChar *) value, value_len);
if (!nodep) {
php_dom_throw_error(INVALID_STATE_ERR, 1);
- RETURN_FALSE;
+ return;
}
intern = Z_DOMOBJ_P(ZEND_THIS);
diff --git a/ext/dom/characterdata.c b/ext/dom/characterdata.c
index b0ac50f44e..b3e91e769c 100644
--- a/ext/dom/characterdata.c
+++ b/ext/dom/characterdata.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -24,34 +22,7 @@
#include "php.h"
#if HAVE_LIBXML && HAVE_DOM
#include "php_dom.h"
-
-
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_characterdata_substring_data, 0, 0, 2)
- ZEND_ARG_INFO(0, offset)
- ZEND_ARG_INFO(0, count)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_characterdata_append_data, 0, 0, 1)
- ZEND_ARG_INFO(0, arg)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_characterdata_insert_data, 0, 0, 2)
- ZEND_ARG_INFO(0, offset)
- ZEND_ARG_INFO(0, arg)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_characterdata_delete_data, 0, 0, 2)
- ZEND_ARG_INFO(0, offset)
- ZEND_ARG_INFO(0, count)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_characterdata_replace_data, 0, 0, 3)
- ZEND_ARG_INFO(0, offset)
- ZEND_ARG_INFO(0, count)
- ZEND_ARG_INFO(0, arg)
-ZEND_END_ARG_INFO();
-/* }}} */
+#include "dom_arginfo.h"
/*
* class DOMCharacterData extends DOMNode
@@ -61,11 +32,11 @@ ZEND_END_ARG_INFO();
*/
const zend_function_entry php_dom_characterdata_class_functions[] = {
- PHP_FALIAS(substringData, dom_characterdata_substring_data, arginfo_dom_characterdata_substring_data)
- PHP_FALIAS(appendData, dom_characterdata_append_data, arginfo_dom_characterdata_append_data)
- PHP_FALIAS(insertData, dom_characterdata_insert_data, arginfo_dom_characterdata_insert_data)
- PHP_FALIAS(deleteData, dom_characterdata_delete_data, arginfo_dom_characterdata_delete_data)
- PHP_FALIAS(replaceData, dom_characterdata_replace_data, arginfo_dom_characterdata_replace_data)
+ PHP_ME(domcharacterdata, substringData, arginfo_class_DOMCharacterData_substringData, ZEND_ACC_PUBLIC)
+ PHP_ME(domcharacterdata, appendData, arginfo_class_DOMCharacterData_appendData, ZEND_ACC_PUBLIC)
+ PHP_ME(domcharacterdata, insertData, arginfo_class_DOMCharacterData_insertData, ZEND_ACC_PUBLIC)
+ PHP_ME(domcharacterdata, deleteData, arginfo_class_DOMCharacterData_deleteData, ZEND_ACC_PUBLIC)
+ PHP_ME(domcharacterdata, replaceData, arginfo_class_DOMCharacterData_replaceData, ZEND_ACC_PUBLIC)
PHP_FE_END
};
@@ -151,7 +122,7 @@ int dom_characterdata_length_read(dom_object *obj, zval *retval)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-6531BCCF
Since:
*/
-PHP_FUNCTION(dom_characterdata_substring_data)
+PHP_METHOD(domcharacterdata, substringData)
{
zval *id;
xmlChar *cur;
@@ -163,7 +134,7 @@ PHP_FUNCTION(dom_characterdata_substring_data)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll", &offset, &count) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(node, id, xmlNodePtr, intern);
@@ -201,7 +172,7 @@ PHP_FUNCTION(dom_characterdata_substring_data)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-32791A2F
Since:
*/
-PHP_FUNCTION(dom_characterdata_append_data)
+PHP_METHOD(domcharacterdata, appendData)
{
zval *id;
xmlNode *nodep;
@@ -211,7 +182,7 @@ PHP_FUNCTION(dom_characterdata_append_data)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &arg, &arg_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
@@ -224,7 +195,7 @@ PHP_FUNCTION(dom_characterdata_append_data)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-3EDB695F
Since:
*/
-PHP_FUNCTION(dom_characterdata_insert_data)
+PHP_METHOD(domcharacterdata, insertData)
{
zval *id;
xmlChar *cur, *first, *second;
@@ -237,7 +208,7 @@ PHP_FUNCTION(dom_characterdata_insert_data)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &offset, &arg, &arg_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(node, id, xmlNodePtr, intern);
@@ -274,7 +245,7 @@ PHP_FUNCTION(dom_characterdata_insert_data)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-7C603781
Since:
*/
-PHP_FUNCTION(dom_characterdata_delete_data)
+PHP_METHOD(domcharacterdata, deleteData)
{
zval *id;
xmlChar *cur, *substring, *second;
@@ -285,7 +256,7 @@ PHP_FUNCTION(dom_characterdata_delete_data)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll", &offset, &count) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(node, id, xmlNodePtr, intern);
@@ -330,7 +301,7 @@ PHP_FUNCTION(dom_characterdata_delete_data)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-E5CBA7FB
Since:
*/
-PHP_FUNCTION(dom_characterdata_replace_data)
+PHP_METHOD(domcharacterdata, replaceData)
{
zval *id;
xmlChar *cur, *substring, *second = NULL;
@@ -343,7 +314,7 @@ PHP_FUNCTION(dom_characterdata_replace_data)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lls", &offset, &count, &arg, &arg_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(node, id, xmlNodePtr, intern);
diff --git a/ext/dom/comment.c b/ext/dom/comment.c
index 9cbec9f173..370b8c4a9f 100644
--- a/ext/dom/comment.c
+++ b/ext/dom/comment.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -24,13 +22,7 @@
#include "php.h"
#if HAVE_LIBXML && HAVE_DOM
#include "php_dom.h"
-
-
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_comment_construct, 0, 0, 0)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO();
-/* }}} */
+#include "dom_arginfo.h"
/*
* class DOMComment extends DOMCharacterData
@@ -40,7 +32,7 @@ ZEND_END_ARG_INFO();
*/
const zend_function_entry php_dom_comment_class_functions[] = {
- PHP_ME(domcomment, __construct, arginfo_dom_comment_construct, ZEND_ACC_PUBLIC)
+ PHP_ME(domcomment, __construct, arginfo_class_DOMComment___construct, ZEND_ACC_PUBLIC)
PHP_FE_END
};
@@ -52,15 +44,15 @@ PHP_METHOD(domcomment, __construct)
char *value = NULL;
size_t value_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "|s", &value, &value_len) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &value, &value_len) == FAILURE) {
+ RETURN_THROWS();
}
nodep = xmlNewComment((xmlChar *) value);
if (!nodep) {
php_dom_throw_error(INVALID_STATE_ERR, 1);
- RETURN_FALSE;
+ return;
}
intern = Z_DOMOBJ_P(ZEND_THIS);
diff --git a/ext/dom/config.m4 b/ext/dom/config.m4
index 1a7f81ef8d..de3b54da4c 100644
--- a/ext/dom/config.m4
+++ b/ext/dom/config.m4
@@ -12,16 +12,16 @@ if test "$PHP_DOM" != "no"; then
PHP_SETUP_LIBXML(DOM_SHARED_LIBADD, [
AC_DEFINE(HAVE_DOM,1,[ ])
- PHP_NEW_EXTENSION(dom, [php_dom.c attr.c document.c domerrorhandler.c \
- domstringlist.c domexception.c namelist.c \
+ PHP_NEW_EXTENSION(dom, [php_dom.c attr.c document.c \
+ domexception.c \
processinginstruction.c cdatasection.c \
documentfragment.c domimplementation.c \
- element.c node.c string_extend.c characterdata.c \
- documenttype.c domimplementationlist.c entity.c \
- nodelist.c text.c comment.c domconfiguration.c \
- domimplementationsource.c entityreference.c \
+ element.c node.c characterdata.c \
+ documenttype.c entity.c \
+ nodelist.c text.c comment.c \
+ entityreference.c \
notation.c xpath.c dom_iterators.c \
- typeinfo.c domerror.c domlocator.c namednodemap.c userdatahandler.c],
+ namednodemap.c],
$ext_shared)
PHP_SUBST(DOM_SHARED_LIBADD)
PHP_INSTALL_HEADERS([ext/dom/xml_common.h])
diff --git a/ext/dom/config.w32 b/ext/dom/config.w32
index 1ac3c614a5..cd5f5a6cb8 100644
--- a/ext/dom/config.w32
+++ b/ext/dom/config.w32
@@ -7,14 +7,14 @@ if (PHP_DOM == "yes") {
ADD_EXTENSION_DEP('dom', 'libxml') &&
CHECK_HEADER_ADD_INCLUDE("libxml/parser.h", "CFLAGS_DOM", PHP_PHP_BUILD + "\\include\\libxml2")
) {
- EXTENSION("dom", "php_dom.c attr.c document.c domerrorhandler.c \
- domstringlist.c domexception.c namelist.c processinginstruction.c \
+ EXTENSION("dom", "php_dom.c attr.c document.c \
+ domexception.c processinginstruction.c \
cdatasection.c documentfragment.c domimplementation.c element.c \
- node.c string_extend.c characterdata.c documenttype.c \
- domimplementationlist.c entity.c nodelist.c text.c comment.c \
- domconfiguration.c domimplementationsource.c entityreference.c \
- notation.c xpath.c dom_iterators.c typeinfo.c domerror.c \
- domlocator.c namednodemap.c userdatahandler.c");
+ node.c characterdata.c documenttype.c \
+ entity.c nodelist.c text.c comment.c \
+ entityreference.c \
+ notation.c xpath.c dom_iterators.c \
+ namednodemap.c");
AC_DEFINE("HAVE_DOM", 1, "DOM support");
diff --git a/ext/dom/document.c b/ext/dom/document.c
index b10bed72dd..5b227f9393 100644
--- a/ext/dom/document.c
+++ b/ext/dom/document.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -24,6 +22,7 @@
#include "php.h"
#if HAVE_LIBXML && HAVE_DOM
#include "php_dom.h"
+#include "dom_arginfo.h"
#include <libxml/SAX.h>
#ifdef LIBXML_SCHEMAS_ENABLED
#include <libxml/relaxng.h>
@@ -39,152 +38,6 @@ struct _idsIterator {
#define DOM_LOAD_STRING 0
#define DOM_LOAD_FILE 1
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_create_element, 0, 0, 1)
- ZEND_ARG_INFO(0, tagName)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_create_document_fragment, 0, 0, 0)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_create_text_node, 0, 0, 1)
- ZEND_ARG_INFO(0, data)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_create_comment, 0, 0, 1)
- ZEND_ARG_INFO(0, data)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_create_cdatasection, 0, 0, 1)
- ZEND_ARG_INFO(0, data)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_create_processing_instruction, 0, 0, 1)
- ZEND_ARG_INFO(0, target)
- ZEND_ARG_INFO(0, data)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_create_attribute, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_create_entity_reference, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_get_elements_by_tag_name, 0, 0, 1)
- ZEND_ARG_INFO(0, tagName)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_import_node, 0, 0, 1)
- ZEND_ARG_OBJ_INFO(0, importedNode, DOMNode, 0)
- ZEND_ARG_INFO(0, deep)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_create_element_ns, 0, 0, 2)
- ZEND_ARG_INFO(0, namespaceURI)
- ZEND_ARG_INFO(0, qualifiedName)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_create_attribute_ns, 0, 0, 2)
- ZEND_ARG_INFO(0, namespaceURI)
- ZEND_ARG_INFO(0, qualifiedName)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_get_elements_by_tag_name_ns, 0, 0, 2)
- ZEND_ARG_INFO(0, namespaceURI)
- ZEND_ARG_INFO(0, localName)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_get_element_by_id, 0, 0, 1)
- ZEND_ARG_INFO(0, elementId)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_adopt_node, 0, 0, 1)
- ZEND_ARG_OBJ_INFO(0, source, DOMNode, 0)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_normalize_document, 0, 0, 0)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_rename_node, 0, 0, 3)
- ZEND_ARG_OBJ_INFO(0, node, DOMNode, 0)
- ZEND_ARG_INFO(0, namespaceURI)
- ZEND_ARG_INFO(0, qualifiedName)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_load, 0, 0, 1)
- ZEND_ARG_INFO(0, source)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_save, 0, 0, 1)
- ZEND_ARG_INFO(0, file)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_loadxml, 0, 0, 1)
- ZEND_ARG_INFO(0, source)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_savexml, 0, 0, 0)
- ZEND_ARG_OBJ_INFO(0, node, DOMNode, 1)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_construct, 0, 0, 0)
- ZEND_ARG_INFO(0, version)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_validate, 0, 0, 0)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_xinclude, 0, 0, 0)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_loadhtml, 0, 0, 1)
- ZEND_ARG_INFO(0, source)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_loadhtmlfile, 0, 0, 1)
- ZEND_ARG_INFO(0, source)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_savehtml, 0, 0, 0)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_savehtmlfile, 0, 0, 1)
- ZEND_ARG_INFO(0, file)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_schema_validate_file, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_schema_validate_xml, 0, 0, 1)
- ZEND_ARG_INFO(0, source)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_relaxNG_validate_file, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_relaxNG_validate_xml, 0, 0, 1)
- ZEND_ARG_INFO(0, source)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_registernodeclass, 0, 0, 2)
- ZEND_ARG_INFO(0, baseClass)
- ZEND_ARG_INFO(0, extendedClass)
-ZEND_END_ARG_INFO();
-/* }}} */
-
/*
* class DOMDocument extends DOMNode
*
@@ -193,43 +46,42 @@ ZEND_END_ARG_INFO();
*/
const zend_function_entry php_dom_document_class_functions[] = { /* {{{ */
- PHP_FALIAS(createElement, dom_document_create_element, arginfo_dom_document_create_element)
- PHP_FALIAS(createDocumentFragment, dom_document_create_document_fragment, arginfo_dom_document_create_document_fragment)
- PHP_FALIAS(createTextNode, dom_document_create_text_node, arginfo_dom_document_create_text_node)
- PHP_FALIAS(createComment, dom_document_create_comment, arginfo_dom_document_create_comment)
- PHP_FALIAS(createCDATASection, dom_document_create_cdatasection, arginfo_dom_document_create_cdatasection)
- PHP_FALIAS(createProcessingInstruction, dom_document_create_processing_instruction, arginfo_dom_document_create_processing_instruction)
- PHP_FALIAS(createAttribute, dom_document_create_attribute, arginfo_dom_document_create_attribute)
- PHP_FALIAS(createEntityReference, dom_document_create_entity_reference, arginfo_dom_document_create_entity_reference)
- PHP_FALIAS(getElementsByTagName, dom_document_get_elements_by_tag_name, arginfo_dom_document_get_elements_by_tag_name)
- PHP_FALIAS(importNode, dom_document_import_node, arginfo_dom_document_import_node)
- PHP_FALIAS(createElementNS, dom_document_create_element_ns, arginfo_dom_document_create_element_ns)
- PHP_FALIAS(createAttributeNS, dom_document_create_attribute_ns, arginfo_dom_document_create_attribute_ns)
- PHP_FALIAS(getElementsByTagNameNS, dom_document_get_elements_by_tag_name_ns, arginfo_dom_document_get_elements_by_tag_name_ns)
- PHP_FALIAS(getElementById, dom_document_get_element_by_id, arginfo_dom_document_get_element_by_id)
- PHP_FALIAS(adoptNode, dom_document_adopt_node, arginfo_dom_document_adopt_node)
- PHP_FALIAS(normalizeDocument, dom_document_normalize_document, arginfo_dom_document_normalize_document)
- PHP_FALIAS(renameNode, dom_document_rename_node, arginfo_dom_document_rename_node)
- PHP_ME(domdocument, load, arginfo_dom_document_load, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC)
- PHP_FALIAS(save, dom_document_save, arginfo_dom_document_save)
- PHP_ME(domdocument, loadXML, arginfo_dom_document_loadxml, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC)
- PHP_FALIAS(saveXML, dom_document_savexml, arginfo_dom_document_savexml)
- PHP_ME(domdocument, __construct, arginfo_dom_document_construct, ZEND_ACC_PUBLIC)
- PHP_FALIAS(validate, dom_document_validate, arginfo_dom_document_validate)
- PHP_FALIAS(xinclude, dom_document_xinclude, arginfo_dom_document_xinclude)
+ PHP_ME(domdocument, createElement, arginfo_class_DOMDocument_createElement, ZEND_ACC_PUBLIC)
+ PHP_ME(domdocument, createDocumentFragment, arginfo_class_DOMDocument_createDocumentFragment, ZEND_ACC_PUBLIC)
+ PHP_ME(domdocument, createTextNode, arginfo_class_DOMDocument_createTextNode, ZEND_ACC_PUBLIC)
+ PHP_ME(domdocument, createComment, arginfo_class_DOMDocument_createComment, ZEND_ACC_PUBLIC)
+ PHP_ME(domdocument, createCDATASection, arginfo_class_DOMDocument_createCDATASection, ZEND_ACC_PUBLIC)
+ PHP_ME(domdocument, createProcessingInstruction, arginfo_class_DOMDocument_createProcessingInstruction, ZEND_ACC_PUBLIC)
+ PHP_ME(domdocument, createAttribute, arginfo_class_DOMDocument_createAttribute, ZEND_ACC_PUBLIC)
+ PHP_ME(domdocument, createEntityReference, arginfo_class_DOMDocument_createEntityReference, ZEND_ACC_PUBLIC)
+ PHP_ME(domdocument, getElementsByTagName, arginfo_class_DOMDocument_getElementsByTagName, ZEND_ACC_PUBLIC)
+ PHP_ME(domdocument, importNode, arginfo_class_DOMDocument_importNode, ZEND_ACC_PUBLIC)
+ PHP_ME(domdocument, createElementNS, arginfo_class_DOMDocument_createElementNS, ZEND_ACC_PUBLIC)
+ PHP_ME(domdocument, createAttributeNS, arginfo_class_DOMDocument_createAttributeNS, ZEND_ACC_PUBLIC)
+ PHP_ME(domdocument, getElementsByTagNameNS, arginfo_class_DOMDocument_getElementsByTagNameNS, ZEND_ACC_PUBLIC)
+ PHP_ME(domdocument, getElementById, arginfo_class_DOMDocument_getElementById, ZEND_ACC_PUBLIC)
+ PHP_ME(domdocument, adoptNode, arginfo_class_DOMDocument_adoptNode, ZEND_ACC_PUBLIC)
+ PHP_ME(domdocument, normalizeDocument, arginfo_class_DOMDocument_normalizeDocument, ZEND_ACC_PUBLIC)
+ PHP_ME(domdocument, load, arginfo_class_DOMDocument_load, ZEND_ACC_PUBLIC)
+ PHP_ME(domdocument, save, arginfo_class_DOMDocument_save, ZEND_ACC_PUBLIC)
+ PHP_ME(domdocument, loadXML, arginfo_class_DOMDocument_loadXML, ZEND_ACC_PUBLIC)
+ PHP_ME(domdocument, saveXML, arginfo_class_DOMDocument_saveXML, ZEND_ACC_PUBLIC)
+ PHP_ME(domdocument, __construct, arginfo_class_DOMDocument___construct, ZEND_ACC_PUBLIC)
+ PHP_ME(domdocument, validate, arginfo_class_DOMDocument_validate, ZEND_ACC_PUBLIC)
+ PHP_ME(domdocument, xinclude, arginfo_class_DOMDocument_xinclude, ZEND_ACC_PUBLIC)
#if defined(LIBXML_HTML_ENABLED)
- PHP_ME(domdocument, loadHTML, arginfo_dom_document_loadhtml, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC)
- PHP_ME(domdocument, loadHTMLFile, arginfo_dom_document_loadhtmlfile, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC)
- PHP_FALIAS(saveHTML, dom_document_save_html, arginfo_dom_document_savehtml)
- PHP_FALIAS(saveHTMLFile, dom_document_save_html_file, arginfo_dom_document_savehtmlfile)
+ PHP_ME(domdocument, loadHTML, arginfo_class_DOMDocument_loadHTML, ZEND_ACC_PUBLIC)
+ PHP_ME(domdocument, loadHTMLFile, arginfo_class_DOMDocument_loadHTMLFile, ZEND_ACC_PUBLIC)
+ PHP_ME(domdocument, saveHTML, arginfo_class_DOMDocument_saveHTML, ZEND_ACC_PUBLIC)
+ PHP_ME(domdocument, saveHTMLFile, arginfo_class_DOMDocument_saveHTMLFile, ZEND_ACC_PUBLIC)
#endif /* defined(LIBXML_HTML_ENABLED) */
#if defined(LIBXML_SCHEMAS_ENABLED)
- PHP_FALIAS(schemaValidate, dom_document_schema_validate_file, arginfo_dom_document_schema_validate_file)
- PHP_FALIAS(schemaValidateSource, dom_document_schema_validate_xml, arginfo_dom_document_schema_validate_xml)
- PHP_FALIAS(relaxNGValidate, dom_document_relaxNG_validate_file, arginfo_dom_document_relaxNG_validate_file)
- PHP_FALIAS(relaxNGValidateSource, dom_document_relaxNG_validate_xml, arginfo_dom_document_relaxNG_validate_xml)
+ PHP_ME(domdocument, schemaValidate, arginfo_class_DOMDocument_schemaValidate, ZEND_ACC_PUBLIC)
+ PHP_ME(domdocument, schemaValidateSource, arginfo_class_DOMDocument_schemaValidateSource, ZEND_ACC_PUBLIC)
+ PHP_ME(domdocument, relaxNGValidate, arginfo_class_DOMDocument_relaxNGValidate, ZEND_ACC_PUBLIC)
+ PHP_ME(domdocument, relaxNGValidateSource, arginfo_class_DOMDocument_relaxNGValidateSource, ZEND_ACC_PUBLIC)
#endif
- PHP_ME(domdocument, registerNodeClass, arginfo_dom_document_registernodeclass, ZEND_ACC_PUBLIC)
+ PHP_ME(domdocument, registerNodeClass, arginfo_class_DOMDocument_registerNodeClass, ZEND_ACC_PUBLIC)
PHP_FE_END
};
/* }}} */
@@ -699,7 +551,7 @@ int dom_document_config_read(dom_object *obj, zval *retval)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-2141741547
Since:
*/
-PHP_FUNCTION(dom_document_create_element)
+PHP_METHOD(domdocument, createElement)
{
zval *id;
xmlNode *node;
@@ -711,7 +563,7 @@ PHP_FUNCTION(dom_document_create_element)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", &name, &name_len, &value, &value_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(docp, id, xmlDocPtr, intern);
@@ -734,7 +586,7 @@ PHP_FUNCTION(dom_document_create_element)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-35CB04B5
Since:
*/
-PHP_FUNCTION(dom_document_create_document_fragment)
+PHP_METHOD(domdocument, createDocumentFragment)
{
zval *id;
xmlNode *node;
@@ -744,7 +596,7 @@ PHP_FUNCTION(dom_document_create_document_fragment)
id = ZEND_THIS;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(docp, id, xmlDocPtr, intern);
@@ -762,7 +614,7 @@ PHP_FUNCTION(dom_document_create_document_fragment)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1975348127
Since:
*/
-PHP_FUNCTION(dom_document_create_text_node)
+PHP_METHOD(domdocument, createTextNode)
{
zval *id;
xmlNode *node;
@@ -774,7 +626,7 @@ PHP_FUNCTION(dom_document_create_text_node)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &value, &value_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(docp, id, xmlDocPtr, intern);
@@ -792,7 +644,7 @@ PHP_FUNCTION(dom_document_create_text_node)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1334481328
Since:
*/
-PHP_FUNCTION(dom_document_create_comment)
+PHP_METHOD(domdocument, createComment)
{
zval *id;
xmlNode *node;
@@ -804,7 +656,7 @@ PHP_FUNCTION(dom_document_create_comment)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &value, &value_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(docp, id, xmlDocPtr, intern);
@@ -822,7 +674,7 @@ PHP_FUNCTION(dom_document_create_comment)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-D26C0AF8
Since:
*/
-PHP_FUNCTION(dom_document_create_cdatasection)
+PHP_METHOD(domdocument, createCDATASection)
{
zval *id;
xmlNode *node;
@@ -834,7 +686,7 @@ PHP_FUNCTION(dom_document_create_cdatasection)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &value, &value_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(docp, id, xmlDocPtr, intern);
@@ -852,7 +704,7 @@ PHP_FUNCTION(dom_document_create_cdatasection)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-135944439
Since:
*/
-PHP_FUNCTION(dom_document_create_processing_instruction)
+PHP_METHOD(domdocument, createProcessingInstruction)
{
zval *id;
xmlNode *node;
@@ -864,7 +716,7 @@ PHP_FUNCTION(dom_document_create_processing_instruction)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", &name, &name_len, &value, &value_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(docp, id, xmlDocPtr, intern);
@@ -889,7 +741,7 @@ PHP_FUNCTION(dom_document_create_processing_instruction)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1084891198
Since:
*/
-PHP_FUNCTION(dom_document_create_attribute)
+PHP_METHOD(domdocument, createAttribute)
{
zval *id;
xmlAttrPtr node;
@@ -901,7 +753,7 @@ PHP_FUNCTION(dom_document_create_attribute)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(docp, id, xmlDocPtr, intern);
@@ -925,7 +777,7 @@ PHP_FUNCTION(dom_document_create_attribute)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-392B75AE
Since:
*/
-PHP_FUNCTION(dom_document_create_entity_reference)
+PHP_METHOD(domdocument, createEntityReference)
{
zval *id;
xmlNode *node;
@@ -937,7 +789,7 @@ PHP_FUNCTION(dom_document_create_entity_reference)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(docp, id, xmlDocPtr, intern);
@@ -960,7 +812,7 @@ PHP_FUNCTION(dom_document_create_entity_reference)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-A6C9094
Since:
*/
-PHP_FUNCTION(dom_document_get_elements_by_tag_name)
+PHP_METHOD(domdocument, getElementsByTagName)
{
zval *id;
xmlDocPtr docp;
@@ -971,7 +823,7 @@ PHP_FUNCTION(dom_document_get_elements_by_tag_name)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(docp, id, xmlDocPtr, intern);
@@ -987,7 +839,7 @@ PHP_FUNCTION(dom_document_get_elements_by_tag_name)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Core-Document-importNode
Since: DOM Level 2
*/
-PHP_FUNCTION(dom_document_import_node)
+PHP_METHOD(domdocument, importNode)
{
zval *id, *node;
xmlDocPtr docp;
@@ -998,7 +850,7 @@ PHP_FUNCTION(dom_document_import_node)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O|b", &node, dom_node_class_entry, &recursive) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(docp, id, xmlDocPtr, intern);
@@ -1043,7 +895,7 @@ PHP_FUNCTION(dom_document_import_node)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-DocCrElNS
Since: DOM Level 2
*/
-PHP_FUNCTION(dom_document_create_element_ns)
+PHP_METHOD(domdocument, createElementNS)
{
zval *id;
xmlDocPtr docp;
@@ -1058,7 +910,7 @@ PHP_FUNCTION(dom_document_create_element_ns)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s!s|s", &uri, &uri_len, &name, &name_len, &value, &value_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(docp, id, xmlDocPtr, intern);
@@ -1108,7 +960,7 @@ PHP_FUNCTION(dom_document_create_element_ns)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-DocCrAttrNS
Since: DOM Level 2
*/
-PHP_FUNCTION(dom_document_create_attribute_ns)
+PHP_METHOD(domdocument, createAttributeNS)
{
zval *id;
xmlDocPtr docp;
@@ -1123,7 +975,7 @@ PHP_FUNCTION(dom_document_create_attribute_ns)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s!s", &uri, &uri_len, &name, &name_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(docp, id, xmlDocPtr, intern);
@@ -1175,7 +1027,7 @@ PHP_FUNCTION(dom_document_create_attribute_ns)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-getElBTNNS
Since: DOM Level 2
*/
-PHP_FUNCTION(dom_document_get_elements_by_tag_name_ns)
+PHP_METHOD(domdocument, getElementsByTagNameNS)
{
zval *id;
xmlDocPtr docp;
@@ -1186,7 +1038,7 @@ PHP_FUNCTION(dom_document_get_elements_by_tag_name_ns)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &uri, &uri_len, &name, &name_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(docp, id, xmlDocPtr, intern);
@@ -1203,7 +1055,7 @@ PHP_FUNCTION(dom_document_get_elements_by_tag_name_ns)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-getElBId
Since: DOM Level 2
*/
-PHP_FUNCTION(dom_document_get_element_by_id)
+PHP_METHOD(domdocument, getElementById)
{
zval *id;
xmlDocPtr docp;
@@ -1215,7 +1067,7 @@ PHP_FUNCTION(dom_document_get_element_by_id)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &idname, &idname_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(docp, id, xmlDocPtr, intern);
@@ -1235,9 +1087,15 @@ PHP_FUNCTION(dom_document_get_element_by_id)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-adoptNode
Since: DOM Level 3
*/
-PHP_FUNCTION(dom_document_adopt_node)
+PHP_METHOD(domdocument, adoptNode)
{
- DOM_NOT_IMPLEMENTED();
+ zval *nodep = NULL;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &nodep, dom_node_class_entry) == FAILURE) {
+ RETURN_THROWS();
+ }
+
+ DOM_NOT_IMPLEMENTED();
}
/* }}} end dom_document_adopt_node */
@@ -1245,7 +1103,7 @@ PHP_FUNCTION(dom_document_adopt_node)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-normalizeDocument
Since: DOM Level 3
*/
-PHP_FUNCTION(dom_document_normalize_document)
+PHP_METHOD(domdocument, normalizeDocument)
{
zval *id;
xmlDocPtr docp;
@@ -1253,7 +1111,7 @@ PHP_FUNCTION(dom_document_normalize_document)
id = ZEND_THIS;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(docp, id, xmlDocPtr, intern);
@@ -1262,16 +1120,6 @@ PHP_FUNCTION(dom_document_normalize_document)
}
/* }}} end dom_document_normalize_document */
-/* {{{ proto DOMNode dom_document_rename_node(node n, string namespaceURI, string qualifiedName)
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-renameNode
-Since: DOM Level 3
-*/
-PHP_FUNCTION(dom_document_rename_node)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_document_rename_node */
-
/* {{{ proto DOMDocument::__construct([string version], [string encoding]); */
PHP_METHOD(domdocument, __construct)
{
@@ -1281,15 +1129,15 @@ PHP_METHOD(domdocument, __construct)
size_t encoding_len = 0, version_len = 0;
int refcount;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "|ss", &version, &version_len, &encoding, &encoding_len) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|ss", &version, &version_len, &encoding, &encoding_len) == FAILURE) {
+ RETURN_THROWS();
}
docp = xmlNewDoc((xmlChar *) version);
if (!docp) {
php_dom_throw_error(INVALID_STATE_ERR, 1);
- RETURN_FALSE;
+ return;
}
if (encoding_len > 0) {
@@ -1506,7 +1354,7 @@ static void dom_parse_document(INTERNAL_FUNCTION_PARAMETERS, int mode) {
}
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &source, &source_len, &options) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!source_len) {
@@ -1580,7 +1428,7 @@ PHP_METHOD(domdocument, loadXML)
/* {{{ proto int dom_document_save(string file)
Convenience method to save to file
*/
-PHP_FUNCTION(dom_document_save)
+PHP_METHOD(domdocument, save)
{
zval *id;
xmlDoc *docp;
@@ -1593,7 +1441,7 @@ PHP_FUNCTION(dom_document_save)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|l", &file, &file_len, &options) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (file_len == 0) {
@@ -1626,7 +1474,7 @@ PHP_FUNCTION(dom_document_save)
URL: http://www.w3.org/TR/DOM-Level-3-LS/load-save.html#LS-DocumentLS-saveXML
Since: DOM Level 3
*/
-PHP_FUNCTION(dom_document_savexml)
+PHP_METHOD(domdocument, saveXML)
{
zval *id, *nodep = NULL;
xmlDoc *docp;
@@ -1640,7 +1488,7 @@ PHP_FUNCTION(dom_document_savexml)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|O!l", &nodep, dom_node_class_entry, &options) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(docp, id, xmlDocPtr, intern);
@@ -1737,7 +1585,7 @@ static void php_dom_remove_xinclude_nodes(xmlNodePtr cur) /* {{{ */
/* {{{ proto int dom_document_xinclude([int options])
Substitutues xincludes in a DomDocument */
-PHP_FUNCTION(dom_document_xinclude)
+PHP_METHOD(domdocument, xinclude)
{
zval *id;
xmlDoc *docp;
@@ -1748,7 +1596,7 @@ PHP_FUNCTION(dom_document_xinclude)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (ZEND_LONG_EXCEEDS_INT(flags)) {
@@ -1784,7 +1632,7 @@ PHP_FUNCTION(dom_document_xinclude)
/* {{{ proto bool dom_document_validate()
Since: DOM extended
*/
-PHP_FUNCTION(dom_document_validate)
+PHP_METHOD(domdocument, validate)
{
zval *id;
xmlDoc *docp;
@@ -1793,7 +1641,7 @@ PHP_FUNCTION(dom_document_validate)
id = ZEND_THIS;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(docp, id, xmlDocPtr, intern);
@@ -1833,7 +1681,7 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &source, &source_len, &flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (source_len == 0) {
@@ -1882,7 +1730,7 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type
if (!vptr) {
xmlSchemaFree(sptr);
zend_throw_error(NULL, "Invalid Schema Validation Context");
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (flags & XML_SCHEMA_VAL_VC_I_CREATE) {
@@ -1904,14 +1752,14 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type
/* }}} */
/* {{{ proto bool dom_document_schema_validate_file(string filename, int flags); */
-PHP_FUNCTION(dom_document_schema_validate_file)
+PHP_METHOD(domdocument, schemaValidate)
{
_dom_document_schema_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, DOM_LOAD_FILE);
}
/* }}} end dom_document_schema_validate_file */
/* {{{ proto bool dom_document_schema_validate(string source, int flags); */
-PHP_FUNCTION(dom_document_schema_validate_xml)
+PHP_METHOD(domdocument, schemaValidateSource)
{
_dom_document_schema_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, DOM_LOAD_STRING);
}
@@ -1932,7 +1780,7 @@ static void _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAMETERS, int typ
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &source, &source_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (source_len == 0) {
@@ -1981,7 +1829,7 @@ static void _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAMETERS, int typ
if (!vptr) {
xmlRelaxNGFree(sptr);
zend_throw_error(NULL, "Invalid RelaxNG Validation Context");
- RETURN_FALSE;
+ RETURN_THROWS();
}
xmlRelaxNGSetValidErrors(vptr, php_libxml_error_handler, php_libxml_error_handler, vptr);
@@ -1998,14 +1846,14 @@ static void _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAMETERS, int typ
/* }}} */
/* {{{ proto bool dom_document_relaxNG_validate_file(string filename); */
-PHP_FUNCTION(dom_document_relaxNG_validate_file)
+PHP_METHOD(domdocument, relaxNGValidate)
{
_dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, DOM_LOAD_FILE);
}
/* }}} end dom_document_relaxNG_validate_file */
/* {{{ proto bool dom_document_relaxNG_validate_xml(string source); */
-PHP_FUNCTION(dom_document_relaxNG_validate_xml)
+PHP_METHOD(domdocument, relaxNGValidateSource)
{
_dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, DOM_LOAD_STRING);
}
@@ -2030,7 +1878,7 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
id = getThis();
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &source, &source_len, &options) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!source_len) {
@@ -2130,7 +1978,7 @@ PHP_METHOD(domdocument, loadHTML)
/* {{{ proto int dom_document_save_html_file(string file)
Convenience method to save to file as html
*/
-PHP_FUNCTION(dom_document_save_html_file)
+PHP_METHOD(domdocument, saveHTMLFile)
{
zval *id;
xmlDoc *docp;
@@ -2143,7 +1991,7 @@ PHP_FUNCTION(dom_document_save_html_file)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &file, &file_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (file_len == 0) {
@@ -2170,7 +2018,7 @@ PHP_FUNCTION(dom_document_save_html_file)
/* {{{ proto string dom_document_save_html()
Convenience method to output as html
*/
-PHP_FUNCTION(dom_document_save_html)
+PHP_METHOD(domdocument, saveHTML)
{
zval *id, *nodep = NULL;
xmlDoc *docp;
@@ -2186,7 +2034,7 @@ PHP_FUNCTION(dom_document_save_html)
if (zend_parse_parameters(ZEND_NUM_ARGS(),
"|O!", &nodep, dom_node_class_entry)
== FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(docp, id, xmlDocPtr, intern);
@@ -2267,7 +2115,7 @@ PHP_METHOD(domdocument, registerNodeClass)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "CC!", &basece, &ce) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (ce == NULL || instanceof_function(ce, basece)) {
@@ -2277,7 +2125,6 @@ PHP_METHOD(domdocument, registerNodeClass)
}
zend_throw_error(NULL, "Class %s is not derived from %s.", ZSTR_VAL(ce->name), ZSTR_VAL(basece->name));
- RETURN_FALSE;
}
/* }}} */
diff --git a/ext/dom/documentfragment.c b/ext/dom/documentfragment.c
index 9b222586ac..d0f44a7d8f 100644
--- a/ext/dom/documentfragment.c
+++ b/ext/dom/documentfragment.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -24,15 +22,7 @@
#include "php.h"
#if HAVE_LIBXML && HAVE_DOM
#include "php_dom.h"
-
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_documentfragement_construct, 0, 0, 0)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_documentfragement_appendXML, 0, 0, 1)
- ZEND_ARG_INFO(0, data)
-ZEND_END_ARG_INFO();
-/* }}} */
+#include "dom_arginfo.h"
/*
* class DOMDocumentFragment extends DOMNode
@@ -42,8 +32,8 @@ ZEND_END_ARG_INFO();
*/
const zend_function_entry php_dom_documentfragment_class_functions[] = {
- PHP_ME(domdocumentfragment, __construct, arginfo_dom_documentfragement_construct, ZEND_ACC_PUBLIC)
- PHP_ME(domdocumentfragment, appendXML, arginfo_dom_documentfragement_appendXML, ZEND_ACC_PUBLIC)
+ PHP_ME(domdocumentfragment, __construct, arginfo_class_DOMDocumentFragment___construct, ZEND_ACC_PUBLIC)
+ PHP_ME(domdocumentfragment, appendXML, arginfo_class_DOMDocumentFragment_appendXML, ZEND_ACC_PUBLIC)
PHP_FE_END
};
@@ -53,15 +43,15 @@ PHP_METHOD(domdocumentfragment, __construct)
xmlNodePtr nodep = NULL, oldnode = NULL;
dom_object *intern;
- if (zend_parse_parameters_none_throw() == FAILURE) {
- return;
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
}
nodep = xmlNewDocFragment(NULL);
if (!nodep) {
php_dom_throw_error(INVALID_STATE_ERR, 1);
- RETURN_FALSE;
+ return;
}
intern = Z_DOMOBJ_P(ZEND_THIS);
@@ -120,7 +110,7 @@ PHP_METHOD(domdocumentfragment, appendXML) {
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &data, &data_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
diff --git a/ext/dom/documenttype.c b/ext/dom/documenttype.c
index dd8a647167..ea9e7eba05 100644
--- a/ext/dom/documenttype.c
+++ b/ext/dom/documenttype.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/dom/dom.stub.php b/ext/dom/dom.stub.php
new file mode 100644
index 0000000000..d88fb7f4c4
--- /dev/null
+++ b/ext/dom/dom.stub.php
@@ -0,0 +1,331 @@
+<?php
+
+class DOMNode {
+ /** @return DOMNode|false */
+ public function appendChild(DOMNode $newChild) {}
+
+ /** @return string|false */
+ public function C14N(bool $exclusive = false, bool $with_comments = false, ?array $xpath = null, ?array $ns_prefixes = null) {}
+
+ /** @return int|false */
+ public function C14NFile(string $uri, bool $exclusive = false, bool $with_comments = false, ?array $xpath = null, ?array $ns_prefixes = null) {}
+
+ /** @return DOMNode|false */
+ public function cloneNode(bool $recursive = false) {}
+
+ /** @return int */
+ public function getLineNo() {}
+
+ /** @return ?string */
+ public function getNodePath() {}
+
+ /** @return bool */
+ public function hasAttributes() {}
+
+ /** @return bool */
+ public function hasChildNodes() {}
+
+ /** @return DOMNode|false */
+ public function insertBefore(DOMNode $newChild, ?DOMNode $refChild = null) {}
+
+ /** @return bool */
+ public function isDefaultNamespace(string $namespaceURI) {}
+
+ /** @return bool */
+ public function isSameNode(DOMNode $other) {}
+
+ /** @return bool */
+ public function isSupported(string $feature, string $version) {}
+
+ /** @return ?string */
+ public function lookupNamespaceUri(?string $prefix) {}
+
+ /** @return ?string */
+ public function lookupPrefix(string $namespaceURI) {}
+
+ /** @return void */
+ public function normalize() {}
+
+ /** @return DOMNode|false */
+ public function removeChild(DOMNode $oldChild) {}
+
+ /** @return DOMNode|false */
+ public function replaceChild(DOMNode $newChild, DOMNode $oldChild) {}
+}
+
+class DOMAttr {
+ public function __construct(string $name, string $value = "") {}
+ /** @return bool */
+ public function isId() {}
+}
+
+class DOMCdataSection {
+ public function __construct(string $value) {}
+}
+
+class DOMCharacterData {
+ /** @return bool */
+ public function appendData(string $data) {}
+
+ /** @return string|false */
+ public function substringData(int $offset, int $count) {}
+
+ /** @return bool */
+ public function insertData(int $offset, string $data) {}
+
+ /** @return bool */
+ public function deleteData(int $offset, int $count) {}
+
+ /** @return bool */
+ public function replaceData(int $offset, int $count, string $data) {}
+}
+
+class DOMComment {
+ public function __construct(string $value = "") {}
+}
+
+class DOMDocument {
+ public function __construct(string $version = "1.0", string $encoding = UNKNOWN) {}
+
+ /** @return DOMAttr|false */
+ public function createAttribute(string $name) {}
+
+ /** @return DOMAttr|false */
+ public function createAttributeNS(?string $namespaceURI, string $qualifiedName) {}
+
+ /** @return DOMCdataSection|false */
+ public function createCDATASection(string $data) {}
+
+ /** @return DOMComment|false */
+ public function createComment(string $data) {}
+
+ /** @return DOMDocumentFragment|false */
+ public function createDocumentFragment() {}
+
+ /** @return DOMElement|false */
+ public function createElement(string $tagName, string $value = "") {}
+
+ /** @return DOMElement|false */
+ public function createElementNS(?string $namespaceURI, string $qualifiedName, string $value = "") {}
+
+ /** @return DOMEntityReference|false */
+ public function createEntityReference(string $name) {}
+
+ /** @return DOMProcessingInstruction|false */
+ public function createProcessingInstruction(string $target, string $data = "") {}
+
+ /** @return DOMText|false */
+ public function createTextNode(string $data) {}
+
+ /** @return ?DOMElement */
+ public function getElementById(string $elementId) {}
+
+ /** @return DOMNodeList */
+ public function getElementsByTagName(string $tagName) {}
+
+ /** @return DOMNodeList */
+ public function getElementsByTagNameNS(string $namespaceURI, string $localName) {}
+
+ /** @return DOMNode|false */
+ public function importNode(DOMNode $importedNode, bool $deep = false) {}
+
+ /** @return DOMDocument|bool */
+ public function load(string $filename, int $options = 0) {}
+
+ /** @return DOMDocument|bool */
+ public function loadXML(string $source, int $options = 0) {}
+
+ /** @return void */
+ public function normalizeDocument() {}
+
+ /** @return bool */
+ public function registerNodeClass(string $baseclass, ?string $extendedclass) {}
+
+ /** @return int|false */
+ public function save(string $filename, int $options = 0) {}
+
+#if defined(LIBXML_HTML_ENABLED)
+ /** @return DOMDocument|bool */
+ public function loadHTML(string $source, int $options = 0) {}
+
+ /** @return DOMDocument|bool */
+ public function loadHTMLFile(string $filename, int $options = 0) {}
+
+ /** @return string|false */
+ public function saveHTML(?DOMNode $node = null) {}
+
+ /** @return int|false */
+ public function saveHTMLFile(string $filename) {}
+#endif
+
+ /** @return string|false */
+ public function saveXML(?DOMNode $node = null, int $options = 0) {}
+
+#if defined(LIBXML_SCHEMAS_ENABLED)
+ /** @return bool */
+ public function schemaValidate(string $filename, int $flags = 0) {}
+
+ /** @return bool */
+ public function schemaValidateSource(string $source, int $flags = 0) {}
+
+ /** @return bool */
+ public function relaxNGValidate(string $filename) {}
+
+ /** @return bool */
+ public function relaxNGValidateSource(string $source) {}
+#endif
+
+ /** @return bool */
+ public function validate() {}
+
+ /** @return int|false */
+ public function xinclude(int $options = 0) {}
+
+ /** @return DOMNode|false */
+ public function adoptNode(DOMNode $source) {}
+}
+
+class DOMDocumentFragment {
+ public function __construct() {}
+
+ /** @return bool */
+ public function appendXML(string $data) {}
+}
+
+class DOMElement {
+ public function __construct(string $name, ?string $value = null, string $uri = "") {}
+
+ /** @return string */
+ public function getAttribute(string $name) {}
+
+ /** @return string */
+ public function getAttributeNS(?string $namespaceURI, string $localName) {}
+
+ /** @return DOMAttr|DOMNamespaceNode|false */
+ public function getAttributeNode(string $name) {}
+
+ /** @return DOMAttr|DOMNamespaceNode|null */
+ public function getAttributeNodeNS(?string $namespaceURI, string $localName) {}
+
+ /** @return DOMNodeList */
+ public function getElementsByTagName(string $name) {}
+
+ /** @return DOMNodeList */
+ public function getElementsByTagNameNS(string $namespaceURI, string $localName) {}
+
+ /** @return bool */
+ public function hasAttribute(string $name) {}
+
+ /** @return bool */
+ public function hasAttributeNS(?string $namespaceURI, string $localName) {}
+
+ /** @return bool */
+ public function removeAttribute(string $name) {}
+
+ /** @return DOMAttr|false */
+ public function removeAttributeNS(?string $namespaceURI, string $localName) {}
+
+ /** @return DOMAttr|false */
+ public function removeAttributeNode(string $name) {}
+
+ /** @return DOMAttr|bool */
+ public function setAttribute(string $name, string $value) {}
+
+ /** @return null|false */
+ public function setAttributeNS(?string $namespaceURI, string $localName, string $value) {}
+
+ /** @return DOMAttr|null|false */
+ public function setAttributeNode(DOMAttr $attr) {}
+
+ /** @return DOMAttr|null|false */
+ public function setAttributeNodeNS(DOMAttr $attr) {}
+
+ /** @return void */
+ public function setIdAttribute(string $name, bool $isId) {}
+
+ /** @return void */
+ public function setIdAttributeNS(string $namespaceURI, string $localName, bool $isId) {}
+
+ /** @return void */
+ public function setIdAttributeNode(DOMAttr $attr, bool $isId) {}
+}
+
+class DOMEntityReference {
+ public function __construct(string $name) {}
+}
+
+class DOMImplementation {
+ public function getFeature(string $feature, string $version) {}
+
+ /** @return bool */
+ public function hasFeature(string $feature, string $version) {}
+
+ /** @return DOMDocumentType|false */
+ public function createDocumentType(
+ string $qualifiedName, string $publicId = "", string $systemId = "") {}
+
+ /** @return DOMDocument|false */
+ public function createDocument(string $namespaceURI = "", string $qualifiedName = "", DOMDocumentType $doctype = UNKNOWN) {}
+}
+
+class DOMNamedNodeMap {
+ /** @return ?DOMNode */
+ public function getNamedItem(string $name) {}
+
+ /** @return ?DOMNode */
+ public function getNamedItemNS(?string $namespaceURI, string $localName) {}
+
+ /** @return ?DOMNode */
+ public function item(int $index) {}
+
+ /** @return int|false */
+ public function count() {}
+}
+
+class DOMNodeList {
+ /** @return int|false */
+ public function count() {}
+
+ /** @return ?DOMNode */
+ public function item(int $index) {}
+}
+
+class DOMProcessingInstruction {
+ public function __construct(string $name, string $value = "") {}
+}
+
+class DOMText {
+ public function __construct(string $value = "") {}
+
+ /** @return bool */
+ public function isWhitespaceInElementContent() {}
+
+ /** @return bool */
+ public function isElementContentWhitespace() {}
+
+ /** @return DOMText|false */
+ public function splitText(int $offset) {}
+}
+
+#if defined(LIBXML_XPATH_ENABLED)
+class DOMXPath {
+ public function __construct(DOMDocument $doc, bool $registerNodeNS = true) {}
+
+ /** @return mixed */
+ public function evaluate(string $expr, ?DOMNode $context = null, bool $registerNodeNS = true) {}
+
+ /** @return mixed */
+ public function query(string $expr, ?DOMNode $context = null, bool $registerNodeNS = true) {}
+
+ /** @return bool */
+ public function registerNamespace(string $prefix, string $namespaceURI) {}
+
+ /** @param string|array $restrict */
+ public function registerPhpFunctions($restrict = null) {}
+}
+#endif
+
+class DOMDocumentType {
+}
+
+function dom_import_simplexml(object $node): ?DOMElement {}
diff --git a/ext/dom/dom_arginfo.h b/ext/dom/dom_arginfo.h
new file mode 100644
index 0000000000..eda6659f9e
--- /dev/null
+++ b/ext/dom/dom_arginfo.h
@@ -0,0 +1,397 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMNode_appendChild, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, newChild, DOMNode, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMNode_C14N, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, exclusive, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, with_comments, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, xpath, IS_ARRAY, 1)
+ ZEND_ARG_TYPE_INFO(0, ns_prefixes, IS_ARRAY, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMNode_C14NFile, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, uri, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, exclusive, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, with_comments, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, xpath, IS_ARRAY, 1)
+ ZEND_ARG_TYPE_INFO(0, ns_prefixes, IS_ARRAY, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMNode_cloneNode, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, recursive, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMNode_getLineNo, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_DOMNode_getNodePath arginfo_class_DOMNode_getLineNo
+
+#define arginfo_class_DOMNode_hasAttributes arginfo_class_DOMNode_getLineNo
+
+#define arginfo_class_DOMNode_hasChildNodes arginfo_class_DOMNode_getLineNo
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMNode_insertBefore, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, newChild, DOMNode, 0)
+ ZEND_ARG_OBJ_INFO(0, refChild, DOMNode, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMNode_isDefaultNamespace, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, namespaceURI, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMNode_isSameNode, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, other, DOMNode, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMNode_isSupported, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, feature, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, version, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMNode_lookupNamespaceUri, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, prefix, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_DOMNode_lookupPrefix arginfo_class_DOMNode_isDefaultNamespace
+
+#define arginfo_class_DOMNode_normalize arginfo_class_DOMNode_getLineNo
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMNode_removeChild, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, oldChild, DOMNode, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMNode_replaceChild, 0, 0, 2)
+ ZEND_ARG_OBJ_INFO(0, newChild, DOMNode, 0)
+ ZEND_ARG_OBJ_INFO(0, oldChild, DOMNode, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMAttr___construct, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_DOMAttr_isId arginfo_class_DOMNode_getLineNo
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMCdataSection___construct, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMCharacterData_appendData, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMCharacterData_substringData, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, count, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMCharacterData_insertData, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_DOMCharacterData_deleteData arginfo_class_DOMCharacterData_substringData
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMCharacterData_replaceData, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, count, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMComment___construct, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMDocument___construct, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, version, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMDocument_createAttribute, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMDocument_createAttributeNS, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, namespaceURI, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, qualifiedName, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_DOMDocument_createCDATASection arginfo_class_DOMCharacterData_appendData
+
+#define arginfo_class_DOMDocument_createComment arginfo_class_DOMCharacterData_appendData
+
+#define arginfo_class_DOMDocument_createDocumentFragment arginfo_class_DOMNode_getLineNo
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMDocument_createElement, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, tagName, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMDocument_createElementNS, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, namespaceURI, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, qualifiedName, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_DOMDocument_createEntityReference arginfo_class_DOMDocument_createAttribute
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMDocument_createProcessingInstruction, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, target, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_DOMDocument_createTextNode arginfo_class_DOMCharacterData_appendData
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMDocument_getElementById, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, elementId, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMDocument_getElementsByTagName, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, tagName, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMDocument_getElementsByTagNameNS, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, namespaceURI, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, localName, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMDocument_importNode, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, importedNode, DOMNode, 0)
+ ZEND_ARG_TYPE_INFO(0, deep, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMDocument_load, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMDocument_loadXML, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, source, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_DOMDocument_normalizeDocument arginfo_class_DOMNode_getLineNo
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMDocument_registerNodeClass, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, baseclass, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, extendedclass, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_DOMDocument_save arginfo_class_DOMDocument_load
+
+#if defined(LIBXML_HTML_ENABLED)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMDocument_loadHTML, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, source, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(LIBXML_HTML_ENABLED)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMDocument_loadHTMLFile, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(LIBXML_HTML_ENABLED)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMDocument_saveHTML, 0, 0, 0)
+ ZEND_ARG_OBJ_INFO(0, node, DOMNode, 1)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(LIBXML_HTML_ENABLED)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMDocument_saveHTMLFile, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMDocument_saveXML, 0, 0, 0)
+ ZEND_ARG_OBJ_INFO(0, node, DOMNode, 1)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(LIBXML_SCHEMAS_ENABLED)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMDocument_schemaValidate, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(LIBXML_SCHEMAS_ENABLED)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMDocument_schemaValidateSource, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, source, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(LIBXML_SCHEMAS_ENABLED)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMDocument_relaxNGValidate, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(LIBXML_SCHEMAS_ENABLED)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMDocument_relaxNGValidateSource, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, source, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#define arginfo_class_DOMDocument_validate arginfo_class_DOMNode_getLineNo
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMDocument_xinclude, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMDocument_adoptNode, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, source, DOMNode, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_DOMDocumentFragment___construct arginfo_class_DOMNode_getLineNo
+
+#define arginfo_class_DOMDocumentFragment_appendXML arginfo_class_DOMCharacterData_appendData
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMElement___construct, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, uri, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_DOMElement_getAttribute arginfo_class_DOMDocument_createAttribute
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMElement_getAttributeNS, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, namespaceURI, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, localName, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_DOMElement_getAttributeNode arginfo_class_DOMDocument_createAttribute
+
+#define arginfo_class_DOMElement_getAttributeNodeNS arginfo_class_DOMElement_getAttributeNS
+
+#define arginfo_class_DOMElement_getElementsByTagName arginfo_class_DOMDocument_createAttribute
+
+#define arginfo_class_DOMElement_getElementsByTagNameNS arginfo_class_DOMDocument_getElementsByTagNameNS
+
+#define arginfo_class_DOMElement_hasAttribute arginfo_class_DOMDocument_createAttribute
+
+#define arginfo_class_DOMElement_hasAttributeNS arginfo_class_DOMElement_getAttributeNS
+
+#define arginfo_class_DOMElement_removeAttribute arginfo_class_DOMDocument_createAttribute
+
+#define arginfo_class_DOMElement_removeAttributeNS arginfo_class_DOMElement_getAttributeNS
+
+#define arginfo_class_DOMElement_removeAttributeNode arginfo_class_DOMDocument_createAttribute
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMElement_setAttribute, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMElement_setAttributeNS, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, namespaceURI, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, localName, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMElement_setAttributeNode, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, attr, DOMAttr, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_DOMElement_setAttributeNodeNS arginfo_class_DOMElement_setAttributeNode
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMElement_setIdAttribute, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, isId, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMElement_setIdAttributeNS, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, namespaceURI, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, localName, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, isId, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMElement_setIdAttributeNode, 0, 0, 2)
+ ZEND_ARG_OBJ_INFO(0, attr, DOMAttr, 0)
+ ZEND_ARG_TYPE_INFO(0, isId, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_DOMEntityReference___construct arginfo_class_DOMDocument_createAttribute
+
+#define arginfo_class_DOMImplementation_getFeature arginfo_class_DOMNode_isSupported
+
+#define arginfo_class_DOMImplementation_hasFeature arginfo_class_DOMNode_isSupported
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMImplementation_createDocumentType, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, qualifiedName, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, publicId, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, systemId, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMImplementation_createDocument, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, namespaceURI, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, qualifiedName, IS_STRING, 0)
+ ZEND_ARG_OBJ_INFO(0, doctype, DOMDocumentType, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_DOMNamedNodeMap_getNamedItem arginfo_class_DOMDocument_createAttribute
+
+#define arginfo_class_DOMNamedNodeMap_getNamedItemNS arginfo_class_DOMElement_getAttributeNS
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMNamedNodeMap_item, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_DOMNamedNodeMap_count arginfo_class_DOMNode_getLineNo
+
+#define arginfo_class_DOMNodeList_count arginfo_class_DOMNode_getLineNo
+
+#define arginfo_class_DOMNodeList_item arginfo_class_DOMNamedNodeMap_item
+
+#define arginfo_class_DOMProcessingInstruction___construct arginfo_class_DOMAttr___construct
+
+#define arginfo_class_DOMText___construct arginfo_class_DOMComment___construct
+
+#define arginfo_class_DOMText_isWhitespaceInElementContent arginfo_class_DOMNode_getLineNo
+
+#define arginfo_class_DOMText_isElementContentWhitespace arginfo_class_DOMNode_getLineNo
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMText_splitText, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(LIBXML_XPATH_ENABLED)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMXPath___construct, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, doc, DOMDocument, 0)
+ ZEND_ARG_TYPE_INFO(0, registerNodeNS, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(LIBXML_XPATH_ENABLED)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMXPath_evaluate, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, expr, IS_STRING, 0)
+ ZEND_ARG_OBJ_INFO(0, context, DOMNode, 1)
+ ZEND_ARG_TYPE_INFO(0, registerNodeNS, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(LIBXML_XPATH_ENABLED)
+#define arginfo_class_DOMXPath_query arginfo_class_DOMXPath_evaluate
+#endif
+
+#if defined(LIBXML_XPATH_ENABLED)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMXPath_registerNamespace, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, prefix, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, namespaceURI, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(LIBXML_XPATH_ENABLED)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMXPath_registerPhpFunctions, 0, 0, 0)
+ ZEND_ARG_INFO(0, restrict)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_dom_import_simplexml, 0, 1, DOMElement, 1)
+ ZEND_ARG_TYPE_INFO(0, node, IS_OBJECT, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/dom/dom_ce.h b/ext/dom/dom_ce.h
index a8b9c9227c..4fea77b8e2 100644
--- a/ext/dom/dom_ce.h
+++ b/ext/dom/dom_ce.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -22,10 +20,6 @@
extern PHP_DOM_EXPORT zend_class_entry *dom_node_class_entry;
extern PHP_DOM_EXPORT zend_class_entry *dom_domexception_class_entry;
-extern PHP_DOM_EXPORT zend_class_entry *dom_domstringlist_class_entry;
-extern PHP_DOM_EXPORT zend_class_entry *dom_namelist_class_entry;
-extern PHP_DOM_EXPORT zend_class_entry *dom_domimplementationlist_class_entry;
-extern PHP_DOM_EXPORT zend_class_entry *dom_domimplementationsource_class_entry;
extern PHP_DOM_EXPORT zend_class_entry *dom_domimplementation_class_entry;
extern PHP_DOM_EXPORT zend_class_entry *dom_documentfragment_class_entry;
extern PHP_DOM_EXPORT zend_class_entry *dom_document_class_entry;
@@ -36,19 +30,12 @@ extern PHP_DOM_EXPORT zend_class_entry *dom_attr_class_entry;
extern PHP_DOM_EXPORT zend_class_entry *dom_element_class_entry;
extern PHP_DOM_EXPORT zend_class_entry *dom_text_class_entry;
extern PHP_DOM_EXPORT zend_class_entry *dom_comment_class_entry;
-extern PHP_DOM_EXPORT zend_class_entry *dom_typeinfo_class_entry;
-extern PHP_DOM_EXPORT zend_class_entry *dom_userdatahandler_class_entry;
-extern PHP_DOM_EXPORT zend_class_entry *dom_domerror_class_entry;
-extern PHP_DOM_EXPORT zend_class_entry *dom_domerrorhandler_class_entry;
-extern PHP_DOM_EXPORT zend_class_entry *dom_domlocator_class_entry;
-extern PHP_DOM_EXPORT zend_class_entry *dom_domconfiguration_class_entry;
extern PHP_DOM_EXPORT zend_class_entry *dom_cdatasection_class_entry;
extern PHP_DOM_EXPORT zend_class_entry *dom_documenttype_class_entry;
extern PHP_DOM_EXPORT zend_class_entry *dom_notation_class_entry;
extern PHP_DOM_EXPORT zend_class_entry *dom_entity_class_entry;
extern PHP_DOM_EXPORT zend_class_entry *dom_entityreference_class_entry;
extern PHP_DOM_EXPORT zend_class_entry *dom_processinginstruction_class_entry;
-extern PHP_DOM_EXPORT zend_class_entry *dom_string_extend_class_entry;
#if defined(LIBXML_XPATH_ENABLED)
extern PHP_DOM_EXPORT zend_class_entry *dom_xpath_class_entry;
#endif
diff --git a/ext/dom/dom_fe.h b/ext/dom/dom_fe.h
index b8c1ff2266..ce8e1e4ade 100644
--- a/ext/dom/dom_fe.h
+++ b/ext/dom/dom_fe.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -21,10 +19,6 @@
#define DOM_FE_H
extern const zend_function_entry php_dom_domexception_class_functions[];
-extern const zend_function_entry php_dom_domstringlist_class_functions[];
-extern const zend_function_entry php_dom_namelist_class_functions[];
-extern const zend_function_entry php_dom_domimplementationlist_class_functions[];
-extern const zend_function_entry php_dom_domimplementationsource_class_functions[];
extern const zend_function_entry php_dom_domimplementation_class_functions[];
extern const zend_function_entry php_dom_documentfragment_class_functions[];
extern const zend_function_entry php_dom_document_class_functions[];
@@ -36,19 +30,12 @@ extern const zend_function_entry php_dom_attr_class_functions[];
extern const zend_function_entry php_dom_element_class_functions[];
extern const zend_function_entry php_dom_text_class_functions[];
extern const zend_function_entry php_dom_comment_class_functions[];
-extern const zend_function_entry php_dom_typeinfo_class_functions[];
-extern const zend_function_entry php_dom_userdatahandler_class_functions[];
-extern const zend_function_entry php_dom_domerror_class_functions[];
-extern const zend_function_entry php_dom_domerrorhandler_class_functions[];
-extern const zend_function_entry php_dom_domlocator_class_functions[];
-extern const zend_function_entry php_dom_domconfiguration_class_functions[];
extern const zend_function_entry php_dom_cdatasection_class_functions[];
extern const zend_function_entry php_dom_documenttype_class_functions[];
extern const zend_function_entry php_dom_notation_class_functions[];
extern const zend_function_entry php_dom_entity_class_functions[];
extern const zend_function_entry php_dom_entityreference_class_functions[];
extern const zend_function_entry php_dom_processinginstruction_class_functions[];
-extern const zend_function_entry php_dom_string_extend_class_functions[];
extern const zend_function_entry php_dom_xpath_class_functions[];
/* domexception errors */
@@ -79,20 +66,6 @@ typedef enum {
VALIDATION_ERR = 16
} dom_exception_code;
-/* domstringlist methods */
-PHP_FUNCTION(dom_domstringlist_item);
-
-/* domnamelist methods */
-PHP_FUNCTION(dom_namelist_get_name);
-PHP_FUNCTION(dom_namelist_get_namespace_uri);
-
-/* domimplementationlist methods */
-PHP_FUNCTION(dom_domimplementationlist_item);
-
-/* domimplementationsource methods */
-PHP_FUNCTION(dom_domimplementationsource_get_domimplementation);
-PHP_FUNCTION(dom_domimplementationsource_get_domimplementations);
-
/* domimplementation methods */
PHP_METHOD(domimplementation, hasFeature);
PHP_METHOD(domimplementation, createDocumentType);
@@ -104,143 +77,116 @@ PHP_METHOD(domdocumentfragment, __construct);
PHP_METHOD(domdocumentfragment, appendXML);
/* domdocument methods */
-PHP_FUNCTION(dom_document_create_element);
-PHP_FUNCTION(dom_document_create_document_fragment);
-PHP_FUNCTION(dom_document_create_text_node);
-PHP_FUNCTION(dom_document_create_comment);
-PHP_FUNCTION(dom_document_create_cdatasection);
-PHP_FUNCTION(dom_document_create_processing_instruction);
-PHP_FUNCTION(dom_document_create_attribute);
-PHP_FUNCTION(dom_document_create_entity_reference);
-PHP_FUNCTION(dom_document_get_elements_by_tag_name);
-PHP_FUNCTION(dom_document_import_node);
-PHP_FUNCTION(dom_document_create_element_ns);
-PHP_FUNCTION(dom_document_create_attribute_ns);
-PHP_FUNCTION(dom_document_get_elements_by_tag_name_ns);
-PHP_FUNCTION(dom_document_get_element_by_id);
-PHP_FUNCTION(dom_document_adopt_node);
-PHP_FUNCTION(dom_document_normalize_document);
-PHP_FUNCTION(dom_document_rename_node);
+PHP_METHOD(domdocument, createElement);
+PHP_METHOD(domdocument, createDocumentFragment);
+PHP_METHOD(domdocument, createTextNode);
+PHP_METHOD(domdocument, createComment);
+PHP_METHOD(domdocument, createCDATASection);
+PHP_METHOD(domdocument, createProcessingInstruction);
+PHP_METHOD(domdocument, createAttribute);
+PHP_METHOD(domdocument, createEntityReference);
+PHP_METHOD(domdocument, getElementsByTagName);
+PHP_METHOD(domdocument, importNode);
+PHP_METHOD(domdocument, createElementNS);
+PHP_METHOD(domdocument, createAttributeNS);
+PHP_METHOD(domdocument, getElementsByTagNameNS);
+PHP_METHOD(domdocument, getElementById);
+PHP_METHOD(domdocument, adoptNode);
+PHP_METHOD(domdocument, normalizeDocument);
PHP_METHOD(domdocument, __construct);
- /* convienience methods */
+ /* convenience methods */
PHP_METHOD(domdocument, load);
-PHP_FUNCTION(dom_document_save);
+PHP_METHOD(domdocument, save);
PHP_METHOD(domdocument, loadXML);
-PHP_FUNCTION(dom_document_savexml);
-PHP_FUNCTION(dom_document_validate);
-PHP_FUNCTION(dom_document_xinclude);
+PHP_METHOD(domdocument, saveXML);
+PHP_METHOD(domdocument, validate);
+PHP_METHOD(domdocument, xinclude);
PHP_METHOD(domdocument, registerNodeClass);
#if defined(LIBXML_HTML_ENABLED)
PHP_METHOD(domdocument, loadHTML);
PHP_METHOD(domdocument, loadHTMLFile);
-PHP_FUNCTION(dom_document_save_html);
-PHP_FUNCTION(dom_document_save_html_file);
+PHP_METHOD(domdocument, saveHTML);
+PHP_METHOD(domdocument, saveHTMLFile);
#endif /* defined(LIBXML_HTML_ENABLED) */
#if defined(LIBXML_SCHEMAS_ENABLED)
-PHP_FUNCTION(dom_document_schema_validate_file);
-PHP_FUNCTION(dom_document_schema_validate_xml);
-PHP_FUNCTION(dom_document_relaxNG_validate_file);
-PHP_FUNCTION(dom_document_relaxNG_validate_xml);
+PHP_METHOD(domdocument, schemaValidate);
+PHP_METHOD(domdocument, schemaValidateSource);
+PHP_METHOD(domdocument, relaxNGValidate);
+PHP_METHOD(domdocument, relaxNGValidateSource);
#endif
/* domnode methods */
-PHP_FUNCTION(dom_node_insert_before);
-PHP_FUNCTION(dom_node_replace_child);
-PHP_FUNCTION(dom_node_remove_child);
-PHP_FUNCTION(dom_node_append_child);
-PHP_FUNCTION(dom_node_has_child_nodes);
-PHP_FUNCTION(dom_node_clone_node);
-PHP_FUNCTION(dom_node_normalize);
-PHP_FUNCTION(dom_node_is_supported);
-PHP_FUNCTION(dom_node_has_attributes);
-PHP_FUNCTION(dom_node_compare_document_position);
-PHP_FUNCTION(dom_node_is_same_node);
-PHP_FUNCTION(dom_node_lookup_prefix);
-PHP_FUNCTION(dom_node_is_default_namespace);
-PHP_FUNCTION(dom_node_lookup_namespace_uri);
-PHP_FUNCTION(dom_node_is_equal_node);
-PHP_FUNCTION(dom_node_get_feature);
-PHP_FUNCTION(dom_node_set_user_data);
-PHP_FUNCTION(dom_node_get_user_data);
+PHP_METHOD(domnode, insertBefore);
+PHP_METHOD(domnode, replaceChild);
+PHP_METHOD(domnode, removeChild);
+PHP_METHOD(domnode, appendChild);
+PHP_METHOD(domnode, hasChildNodes);
+PHP_METHOD(domnode, cloneNode);
+PHP_METHOD(domnode, normalize);
+PHP_METHOD(domnode, isSupported);
+PHP_METHOD(domnode, hasAttributes);
+PHP_METHOD(domnode, isSameNode);
+PHP_METHOD(domnode, lookupPrefix);
+PHP_METHOD(domnode, isDefaultNamespace);
+PHP_METHOD(domnode, lookupNamespaceURI);
PHP_METHOD(domnode, C14N);
PHP_METHOD(domnode, C14NFile);
PHP_METHOD(domnode, getNodePath);
PHP_METHOD(domnode, getLineNo);
/* domnodelist methods */
-PHP_FUNCTION(dom_nodelist_item);
-PHP_FUNCTION(dom_nodelist_count);
+PHP_METHOD(domnodelist, item);
+PHP_METHOD(domnodelist, count);
/* domnamednodemap methods */
-PHP_FUNCTION(dom_namednodemap_get_named_item);
-PHP_FUNCTION(dom_namednodemap_set_named_item);
-PHP_FUNCTION(dom_namednodemap_remove_named_item);
-PHP_FUNCTION(dom_namednodemap_item);
-PHP_FUNCTION(dom_namednodemap_get_named_item_ns);
-PHP_FUNCTION(dom_namednodemap_set_named_item_ns);
-PHP_FUNCTION(dom_namednodemap_remove_named_item_ns);
-PHP_FUNCTION(dom_namednodemap_count);
+PHP_METHOD(domnamednodemap, getNamedItem);
+PHP_METHOD(domnamednodemap, item);
+PHP_METHOD(domnamednodemap, getNamedItemNS);
+PHP_METHOD(domnamednodemap, count);
/* domcharacterdata methods */
-PHP_FUNCTION(dom_characterdata_substring_data);
-PHP_FUNCTION(dom_characterdata_append_data);
-PHP_FUNCTION(dom_characterdata_insert_data);
-PHP_FUNCTION(dom_characterdata_delete_data);
-PHP_FUNCTION(dom_characterdata_replace_data);
+PHP_METHOD(domcharacterdata, substringData);
+PHP_METHOD(domcharacterdata, appendData);
+PHP_METHOD(domcharacterdata, insertData);
+PHP_METHOD(domcharacterdata, deleteData);
+PHP_METHOD(domcharacterdata, replaceData);
/* domattr methods */
-PHP_FUNCTION(dom_attr_is_id);
+PHP_METHOD(domattr, isId);
PHP_METHOD(domattr, __construct);
/* domelement methods */
-PHP_FUNCTION(dom_element_get_attribute);
-PHP_FUNCTION(dom_element_set_attribute);
-PHP_FUNCTION(dom_element_remove_attribute);
-PHP_FUNCTION(dom_element_get_attribute_node);
-PHP_FUNCTION(dom_element_set_attribute_node);
-PHP_FUNCTION(dom_element_remove_attribute_node);
-PHP_FUNCTION(dom_element_get_elements_by_tag_name);
-PHP_FUNCTION(dom_element_get_attribute_ns);
-PHP_FUNCTION(dom_element_set_attribute_ns);
-PHP_FUNCTION(dom_element_remove_attribute_ns);
-PHP_FUNCTION(dom_element_get_attribute_node_ns);
-PHP_FUNCTION(dom_element_set_attribute_node_ns);
-PHP_FUNCTION(dom_element_get_elements_by_tag_name_ns);
-PHP_FUNCTION(dom_element_has_attribute);
-PHP_FUNCTION(dom_element_has_attribute_ns);
-PHP_FUNCTION(dom_element_set_id_attribute);
-PHP_FUNCTION(dom_element_set_id_attribute_ns);
-PHP_FUNCTION(dom_element_set_id_attribute_node);
+PHP_METHOD(domelement, getAttribute);
+PHP_METHOD(domelement, setAttribute);
+PHP_METHOD(domelement, removeAttribute);
+PHP_METHOD(domelement, getAttributeNode);
+PHP_METHOD(domelement, setAttributeNode);
+PHP_METHOD(domelement, removeAttributeNode);
+PHP_METHOD(domelement, getElementsByTagName);
+PHP_METHOD(domelement, getAttributeNS);
+PHP_METHOD(domelement, setAttributeNS);
+PHP_METHOD(domelement, removeAttributeNS);
+PHP_METHOD(domelement, getAttributeNodeNS);
+PHP_METHOD(domelement, setAttributeNodeNS);
+PHP_METHOD(domelement, getElementsByTagNameNS);
+PHP_METHOD(domelement, hasAttribute);
+PHP_METHOD(domelement, hasAttributeNS);
+PHP_METHOD(domelement, setIdAttribute);
+PHP_METHOD(domelement, setIdAttributeNS);
+PHP_METHOD(domelement, setIdAttributeNode);
PHP_METHOD(domelement, __construct);
/* domtext methods */
-PHP_FUNCTION(dom_text_split_text);
-PHP_FUNCTION(dom_text_is_whitespace_in_element_content);
-PHP_FUNCTION(dom_text_replace_whole_text);
+PHP_METHOD(domtext, splitText);
+PHP_METHOD(domtext, isWhitespaceInElementContent);
+PHP_METHOD(domtext, replaceWholeText);
PHP_METHOD(domtext, __construct);
/* domcomment methods */
PHP_METHOD(domcomment, __construct);
-/* domtypeinfo methods */
-
-/* domuserdatahandler methods */
-PHP_FUNCTION(dom_userdatahandler_handle);
-
-/* domdomerror methods */
-
-/* domerrorhandler methods */
-PHP_FUNCTION(dom_domerrorhandler_handle_error);
-
-/* domlocator methods */
-
-/* domconfiguration methods */
-PHP_FUNCTION(dom_domconfiguration_set_parameter);
-PHP_FUNCTION(dom_domconfiguration_get_parameter);
-PHP_FUNCTION(dom_domconfiguration_can_set_parameter);
-
/* domcdatasection methods */
PHP_METHOD(domcdatasection, __construct);
@@ -256,17 +202,13 @@ PHP_METHOD(domentityreference, __construct);
/* domprocessinginstruction methods */
PHP_METHOD(domprocessinginstruction, __construct);
-/* string_extend methods */
-PHP_FUNCTION(dom_string_extend_find_offset16);
-PHP_FUNCTION(dom_string_extend_find_offset32);
-
#if defined(LIBXML_XPATH_ENABLED)
/* xpath methods */
PHP_METHOD(domxpath, __construct);
-PHP_FUNCTION(dom_xpath_register_ns);
-PHP_FUNCTION(dom_xpath_query);
-PHP_FUNCTION(dom_xpath_evaluate);
-PHP_FUNCTION(dom_xpath_register_php_functions);
+PHP_METHOD(domxpath, registerNamespace);
+PHP_METHOD(domxpath, query);
+PHP_METHOD(domxpath, evaluate);
+PHP_METHOD(domxpath, registerPhpFunctions);
#endif
#endif /* DOM_FE_H */
diff --git a/ext/dom/dom_iterators.c b/ext/dom/dom_iterators.c
index 7483235c0f..6a89861107 100644
--- a/ext/dom/dom_iterators.c
+++ b/ext/dom/dom_iterators.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/dom/dom_properties.h b/ext/dom/dom_properties.h
index 73d404429e..793e18c363 100644
--- a/ext/dom/dom_properties.h
+++ b/ext/dom/dom_properties.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -71,27 +69,6 @@ int dom_documenttype_public_id_read(dom_object *obj, zval *retval);
int dom_documenttype_system_id_read(dom_object *obj, zval *retval);
int dom_documenttype_internal_subset_read(dom_object *obj, zval *retval);
-/* domerror properties */
-int dom_domerror_severity_read(dom_object *obj, zval *retval);
-int dom_domerror_message_read(dom_object *obj, zval *retval);
-int dom_domerror_type_read(dom_object *obj, zval *retval);
-int dom_domerror_related_exception_read(dom_object *obj, zval *retval);
-int dom_domerror_related_data_read(dom_object *obj, zval *retval);
-int dom_domerror_location_read(dom_object *obj, zval *retval);
-
-/* domimplementationlist properties */
-int dom_domimplementationlist_length_read(dom_object *obj, zval *retval);
-
-/* domlocator properties */
-int dom_domlocator_line_number_read(dom_object *obj, zval *retval);
-int dom_domlocator_column_number_read(dom_object *obj, zval *retval);
-int dom_domlocator_offset_read(dom_object *obj, zval *retval);
-int dom_domlocator_related_node_read(dom_object *obj, zval *retval);
-int dom_domlocator_uri_read(dom_object *obj, zval *retval);
-
-/* domstringlist properties */
-int dom_domstringlist_length_read(dom_object *obj, zval *retval);
-
/* element properties */
int dom_element_tag_name_read(dom_object *obj, zval *retval);
int dom_element_schema_type_info_read(dom_object *obj, zval *retval);
@@ -110,9 +87,6 @@ int dom_entity_version_write(dom_object *obj, zval *newval);
/* namednodemap properties */
int dom_namednodemap_length_read(dom_object *obj, zval *retval);
-/* namelist properties */
-int dom_namelist_length_read(dom_object *obj, zval *retval);
-
/* node properties */
int dom_node_node_name_read(dom_object *obj, zval *retval);
int dom_node_node_value_read(dom_object *obj, zval *retval);
@@ -151,13 +125,11 @@ int dom_processinginstruction_data_write(dom_object *obj, zval *newval);
/* text properties */
int dom_text_whole_text_read(dom_object *obj, zval *retval);
-/* typeinfo properties */
-int dom_typeinfo_type_name_read(dom_object *obj, zval *retval);
-int dom_typeinfo_type_namespace_read(dom_object *obj, zval *retval);
-
#if defined(LIBXML_XPATH_ENABLED)
/* xpath properties */
int dom_xpath_document_read(dom_object *obj, zval *retval);
+int dom_xpath_register_node_ns_read(dom_object *obj, zval *retval);
+int dom_xpath_register_node_ns_write(dom_object *obj, zval *newval);
#endif
#endif /* DOM_PROPERTIERS_H */
diff --git a/ext/dom/domconfiguration.c b/ext/dom/domconfiguration.c
deleted file mode 100644
index b1d8ef452a..0000000000
--- a/ext/dom/domconfiguration.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
- | Copyright (c) The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Christian Stocker <chregu@php.net> |
- | Rob Richards <rrichards@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#if HAVE_LIBXML && HAVE_DOM
-#include "php_dom.h"
-
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_configuration_set_parameter, 0, 0, 2)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_configuration_get_parameter, 0, 0, 0)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_configuration_can_set_parameter, 0, 0, 0)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO();
-/* }}} */
-
-/*
-* class domdomconfiguration
-*
-* URL: https://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMConfiguration
-* Since: DOM Level 3
-*/
-
-const zend_function_entry php_dom_domconfiguration_class_functions[] = {
- PHP_FALIAS(setParameter, dom_domconfiguration_set_parameter, arginfo_dom_configuration_set_parameter)
- PHP_FALIAS(getParameter, dom_domconfiguration_get_parameter, arginfo_dom_configuration_get_parameter)
- PHP_FALIAS(canSetParameter, dom_domconfiguration_can_set_parameter, arginfo_dom_configuration_can_set_parameter)
- PHP_FE_END
-};
-
-/* {{{ attribute protos, not implemented yet */
-
-/* {{{ proto dom_void dom_domconfiguration_set_parameter(string name, domuserdata value);
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMConfiguration-property
-Since:
-*/
-PHP_FUNCTION(dom_domconfiguration_set_parameter)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_domconfiguration_set_parameter */
-
-/* {{{ proto domdomuserdata dom_domconfiguration_get_parameter(string name);
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMConfiguration-getParameter
-Since:
-*/
-PHP_FUNCTION(dom_domconfiguration_get_parameter)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_domconfiguration_get_parameter */
-
-/* {{{ proto bool dom_domconfiguration_can_set_parameter(string name, domuserdata value);
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMConfiguration-canSetParameter
-Since:
-*/
-PHP_FUNCTION(dom_domconfiguration_can_set_parameter)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_domconfiguration_can_set_parameter */
-
-/* }}} */
-
-#endif
diff --git a/ext/dom/domerror.c b/ext/dom/domerror.c
deleted file mode 100644
index 1932d51408..0000000000
--- a/ext/dom/domerror.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
- | Copyright (c) The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Christian Stocker <chregu@php.net> |
- | Rob Richards <rrichards@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#if HAVE_LIBXML && HAVE_DOM
-#include "php_dom.h"
-
-
-/*
-* class domerror
-*
-* URL: https://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ERROR-Interfaces-DOMError
-* Since: DOM Level 3
-*/
-
-const zend_function_entry php_dom_domerror_class_functions[] = {
- PHP_FE_END
-};
-
-/* {{{ attribute protos, not implemented yet */
-
-/* {{{ severity unsigned short
-readonly=yes
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ERROR-DOMError-severity
-Since:
-*/
-int dom_domerror_severity_read(dom_object *obj, zval *retval)
-{
- ZVAL_STRING(retval, "TEST");
- return SUCCESS;
-}
-
-/* }}} */
-
-/* {{{ message string
-readonly=yes
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ERROR-DOMError-message
-Since:
-*/
-int dom_domerror_message_read(dom_object *obj, zval *retval)
-{
- ZVAL_STRING(retval, "TEST");
- return SUCCESS;
-}
-
-/* }}} */
-
-/* {{{ type string
-readonly=yes
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ERROR-DOMError-type
-Since:
-*/
-int dom_domerror_type_read(dom_object *obj, zval *retval)
-{
- ZVAL_STRING(retval, "TEST");
- return SUCCESS;
-}
-
-/* }}} */
-
-/* {{{ relatedException object
-readonly=yes
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ERROR-DOMError-relatedException
-Since:
-*/
-int dom_domerror_related_exception_read(dom_object *obj, zval *retval)
-{
- ZVAL_STRING(retval, "TEST");
- return SUCCESS;
-}
-
-/* }}} */
-
-/* {{{ relatedData domobject
-readonly=yes
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ERROR-DOMError-relatedData
-Since:
-*/
-int dom_domerror_related_data_read(dom_object *obj, zval *retval)
-{
- ZVAL_STRING(retval, "TEST");
- return SUCCESS;
-}
-
-/* }}} */
-
-/* {{{ location domlocator
-readonly=yes
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ERROR-DOMError-location
-Since:
-*/
-int dom_domerror_location_read(dom_object *obj, zval *retval)
-{
- ZVAL_STRING(retval, "TEST");
- return SUCCESS;
-}
-
-/* }}} */
-
-/* }}} */
-
-#endif
diff --git a/ext/dom/domerrorhandler.c b/ext/dom/domerrorhandler.c
deleted file mode 100644
index 344cb77c4f..0000000000
--- a/ext/dom/domerrorhandler.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
- | Copyright (c) The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Christian Stocker <chregu@php.net> |
- | Rob Richards <rrichards@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#if HAVE_LIBXML && HAVE_DOM
-#include "php_dom.h"
-
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_domerrorhandler_handle_error, 0, 0, 1)
- ZEND_ARG_OBJ_INFO(0, error, DOMDomError, 0)
-ZEND_END_ARG_INFO();
-/* }}} */
-
-/*
-* class domerrorhandler
-*
-* URL: https://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ERROR-Interfaces-DOMErrorHandler
-* Since: DOM Level 3
-*/
-
-const zend_function_entry php_dom_domerrorhandler_class_functions[] = {
- PHP_FALIAS(handleError, dom_domerrorhandler_handle_error, arginfo_dom_domerrorhandler_handle_error)
- PHP_FE_END
-};
-
-/* {{{ attribute protos, not implemented yet */
-
-/* {{{ proto dom_boolean dom_domerrorhandler_handle_error(domerror error);
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-ERRORS-DOMErrorHandler-handleError
-Since:
-*/
-PHP_FUNCTION(dom_domerrorhandler_handle_error)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_domerrorhandler_handle_error */
-
-/* }}} */
-
-#endif
diff --git a/ext/dom/domexception.c b/ext/dom/domexception.c
index 922d01c95e..e398a8003b 100644
--- a/ext/dom/domexception.c
+++ b/ext/dom/domexception.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/dom/domimplementation.c b/ext/dom/domimplementation.c
index 05e99af39b..97d1f98b92 100644
--- a/ext/dom/domimplementation.c
+++ b/ext/dom/domimplementation.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -24,28 +22,7 @@
#include "php.h"
#if HAVE_LIBXML && HAVE_DOM
#include "php_dom.h"
-
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_implementation_get_feature, 0, 0, 2)
- ZEND_ARG_INFO(0, feature)
- ZEND_ARG_INFO(0, version)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_implementation_has_feature, 0, 0, 0)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_implementation_create_documenttype, 0, 0, 3)
- ZEND_ARG_INFO(0, qualifiedName)
- ZEND_ARG_INFO(0, publicId)
- ZEND_ARG_INFO(0, systemId)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_implementation_create_document, 0, 0, 2)
- ZEND_ARG_INFO(0, namespaceURI)
- ZEND_ARG_INFO(0, qualifiedName)
- ZEND_ARG_OBJ_INFO(0, docType, DOMDocumentType, 0)
-ZEND_END_ARG_INFO();
-/* }}} */
+#include "dom_arginfo.h"
/*
* class DOMImplementation
@@ -55,10 +32,10 @@ ZEND_END_ARG_INFO();
*/
const zend_function_entry php_dom_domimplementation_class_functions[] = {
- PHP_ME(domimplementation, getFeature, arginfo_dom_implementation_get_feature, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC)
- PHP_ME(domimplementation, hasFeature, arginfo_dom_implementation_has_feature, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC)
- PHP_ME(domimplementation, createDocumentType, arginfo_dom_implementation_create_documenttype, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC)
- PHP_ME(domimplementation, createDocument, arginfo_dom_implementation_create_document, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC)
+ PHP_ME(domimplementation, getFeature, arginfo_class_DOMImplementation_getFeature, ZEND_ACC_PUBLIC)
+ PHP_ME(domimplementation, hasFeature, arginfo_class_DOMImplementation_hasFeature, ZEND_ACC_PUBLIC)
+ PHP_ME(domimplementation, createDocumentType, arginfo_class_DOMImplementation_createDocumentType, ZEND_ACC_PUBLIC)
+ PHP_ME(domimplementation, createDocument, arginfo_class_DOMImplementation_createDocument, ZEND_ACC_PUBLIC)
PHP_FE_END
};
@@ -72,7 +49,7 @@ PHP_METHOD(domimplementation, hasFeature)
char *feature, *version;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &feature, &feature_len, &version, &version_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (dom_has_feature(feature, version)) {
@@ -96,8 +73,8 @@ PHP_METHOD(domimplementation, createDocumentType)
xmlChar *pch1 = NULL, *pch2 = NULL, *localname = NULL;
xmlURIPtr uri;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|sss", &name, &name_len, &publicid, &publicid_len, &systemid, &systemid_len) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|ss", &name, &name_len, &publicid, &publicid_len, &systemid, &systemid_len) == FAILURE) {
+ RETURN_THROWS();
}
if (name_len == 0) {
@@ -162,8 +139,8 @@ PHP_METHOD(domimplementation, createDocument)
char *prefix = NULL, *localname = NULL;
dom_object *doctobj;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|ssO", &uri, &uri_len, &name, &name_len, &node, dom_documenttype_class_entry) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|ssO!", &uri, &uri_len, &name, &name_len, &node, dom_documenttype_class_entry) == FAILURE) {
+ RETURN_THROWS();
}
if (node != NULL) {
@@ -256,7 +233,14 @@ Since: DOM Level 3
*/
PHP_METHOD(domimplementation, getFeature)
{
- DOM_NOT_IMPLEMENTED();
+ size_t feature_len, version_len;
+ char *feature, *version;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &feature, &feature_len, &version, &version_len) == FAILURE) {
+ RETURN_THROWS();
+ }
+
+ DOM_NOT_IMPLEMENTED();
}
/* }}} end dom_domimplementation_get_feature */
diff --git a/ext/dom/domimplementationlist.c b/ext/dom/domimplementationlist.c
deleted file mode 100644
index 9b248d4a02..0000000000
--- a/ext/dom/domimplementationlist.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
- | Copyright (c) The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Christian Stocker <chregu@php.net> |
- | Rob Richards <rrichards@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#if HAVE_LIBXML && HAVE_DOM
-#include "php_dom.h"
-
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_implementationlist_item, 0, 0, 1)
- ZEND_ARG_INFO(0, index)
-ZEND_END_ARG_INFO();
-/* }}} */
-
-/*
-* class domimplementationlist
-*
-* URL: https://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMImplementationList
-* Since: DOM Level 3
-*/
-
-const zend_function_entry php_dom_domimplementationlist_class_functions[] = {
- PHP_FALIAS(item, dom_domimplementationlist_item, arginfo_dom_implementationlist_item)
- PHP_FE_END
-};
-
-/* {{{ attribute protos, not implemented yet */
-
-/* {{{ length unsigned long
-readonly=yes
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMImplementationList-length
-Since:
-*/
-int dom_domimplementationlist_length_read(dom_object *obj, zval *retval)
-{
- ZVAL_STRING(retval, "TEST");
- return SUCCESS;
-}
-
-/* }}} */
-
-/* {{{ proto domdomimplementation dom_domimplementationlist_item(int index);
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMImplementationList-item
-Since:
-*/
-PHP_FUNCTION(dom_domimplementationlist_item)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_domimplementationlist_item */
-
-/* }}} */
-
-#endif
diff --git a/ext/dom/domimplementationsource.c b/ext/dom/domimplementationsource.c
deleted file mode 100644
index 7f3f8b9dfc..0000000000
--- a/ext/dom/domimplementationsource.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
- | Copyright (c) The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Christian Stocker <chregu@php.net> |
- | Rob Richards <rrichards@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#if HAVE_LIBXML && HAVE_DOM
-#include "php_dom.h"
-
-
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_implementationsource_getdomimplementation, 0, 0, 1)
- ZEND_ARG_INFO(0, features)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_implementationsource_getdomimplementations, 0, 0, 1)
- ZEND_ARG_INFO(0, features)
-ZEND_END_ARG_INFO();
-/* }}} */
-
-/*
-* class domimplementationsource
-*
-* URL: https://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMImplementationSource
-* Since: DOM Level 3
-*/
-
-const zend_function_entry php_dom_domimplementationsource_class_functions[] = {
- PHP_FALIAS(getDomimplementation, dom_domimplementationsource_get_domimplementation, arginfo_dom_implementationsource_getdomimplementation)
- PHP_FALIAS(getDomimplementations, dom_domimplementationsource_get_domimplementations, arginfo_dom_implementationsource_getdomimplementations)
- PHP_FE_END
-};
-
-/* {{{ attribute protos, not implemented yet */
-
-/* {{{ proto domdomimplementation dom_domimplementationsource_get_domimplementation(string features);
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-getDOMImpl
-Since:
-*/
-PHP_FUNCTION(dom_domimplementationsource_get_domimplementation)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_domimplementationsource_get_domimplementation */
-
-/* {{{ proto domimplementationlist dom_domimplementationsource_get_domimplementations(string features);
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-getDOMImpls
-Since:
-*/
-PHP_FUNCTION(dom_domimplementationsource_get_domimplementations)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_domimplementationsource_get_domimplementations */
-
-/* }}} */
-
-#endif
diff --git a/ext/dom/domlocator.c b/ext/dom/domlocator.c
deleted file mode 100644
index 7ad0ff8866..0000000000
--- a/ext/dom/domlocator.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
- | Copyright (c) The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Christian Stocker <chregu@php.net> |
- | Rob Richards <rrichards@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#if HAVE_LIBXML && HAVE_DOM
-#include "php_dom.h"
-
-
-/*
-* class domlocator
-*
-* URL: https://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Interfaces-DOMLocator
-* Since: DOM Level 3
-*/
-
-const zend_function_entry php_dom_domlocator_class_functions[] = {
- PHP_FE_END
-};
-
-/* {{{ attribute protos, not implemented yet */
-
-/* {{{ line_number long
-readonly=yes
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMLocator-line-number
-Since:
-*/
-int dom_domlocator_line_number_read(dom_object *obj, zval *retval)
-{
- ZVAL_STRING(retval, "TEST");
- return SUCCESS;
-}
-
-/* }}} */
-
-/* {{{ column_number long
-readonly=yes
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMLocator-column-number
-Since:
-*/
-int dom_domlocator_column_number_read(dom_object *obj, zval *retval)
-{
- ZVAL_STRING(retval, "TEST");
- return SUCCESS;
-}
-
-/* }}} */
-
-/* {{{ offset long
-readonly=yes
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMLocator-offset
-Since:
-*/
-int dom_domlocator_offset_read(dom_object *obj, zval *retval)
-{
- ZVAL_STRING(retval, "TEST");
- return SUCCESS;
-}
-
-/* }}} */
-
-/* {{{ related_node node
-readonly=yes
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMLocator-node
-Since:
-*/
-int dom_domlocator_related_node_read(dom_object *obj, zval *retval)
-{
- ZVAL_STRING(retval, "TEST");
- return SUCCESS;
-}
-
-/* }}} */
-
-/* {{{ uri string
-readonly=yes
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMLocator-uri
-Since:
-*/
-int dom_domlocator_uri_read(dom_object *obj, zval *retval)
-{
- ZVAL_STRING(retval, "TEST");
- return SUCCESS;
-}
-
-/* }}} */
-
-/* }}} */
-
-#endif
diff --git a/ext/dom/domstringlist.c b/ext/dom/domstringlist.c
deleted file mode 100644
index 224b924c1a..0000000000
--- a/ext/dom/domstringlist.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
- | Copyright (c) The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Christian Stocker <chregu@php.net> |
- | Rob Richards <rrichards@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#if HAVE_LIBXML && HAVE_DOM
-#include "php_dom.h"
-
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_stringlist_item, 0, 0, 1)
- ZEND_ARG_INFO(0, index)
-ZEND_END_ARG_INFO();
-/* }}} */
-
-/*
-* class domstringlist
-*
-* URL: https://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMStringList
-* Since: DOM Level 3
-*/
-
-const zend_function_entry php_dom_domstringlist_class_functions[] = {
- PHP_FALIAS(item, dom_domstringlist_item, arginfo_dom_stringlist_item)
- PHP_FE_END
-};
-
-/* {{{ attribute protos, not implemented yet */
-
-/* {{{ length unsigned long
-readonly=yes
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMStringList-length
-Since:
-*/
-int dom_domstringlist_length_read(dom_object *obj, zval *retval)
-{
- ZVAL_STRING(retval, "TEST");
- return SUCCESS;
-}
-
-/* }}} */
-
-/* {{{ proto domstring dom_domstringlist_item(int index);
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#DOMStringList-item
-Since:
-*/
-PHP_FUNCTION(dom_domstringlist_item)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_domstringlist_item */
-
-/* }}} */
-
-#endif
diff --git a/ext/dom/element.c b/ext/dom/element.c
index 51aba0e155..a84ae0bd93 100644
--- a/ext/dom/element.c
+++ b/ext/dom/element.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -24,98 +22,7 @@
#include "php.h"
#if HAVE_LIBXML && HAVE_DOM
#include "php_dom.h"
-
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_get_attribute, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_set_attribute, 0, 0, 2)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_remove_attribute, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_get_attribute_node, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_set_attribute_node, 0, 0, 1)
- ZEND_ARG_OBJ_INFO(0, newAttr, DOMAttr, 0)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_remove_attribute_node, 0, 0, 1)
- ZEND_ARG_OBJ_INFO(0, oldAttr, DOMAttr, 0)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_get_elements_by_tag_name, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_get_attribute_ns, 0, 0, 2)
- ZEND_ARG_INFO(0, namespaceURI)
- ZEND_ARG_INFO(0, localName)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_set_attribute_ns, 0, 0, 3)
- ZEND_ARG_INFO(0, namespaceURI)
- ZEND_ARG_INFO(0, qualifiedName)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_remove_attribute_ns, 0, 0, 2)
- ZEND_ARG_INFO(0, namespaceURI)
- ZEND_ARG_INFO(0, localName)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_get_attribute_node_ns, 0, 0, 2)
- ZEND_ARG_INFO(0, namespaceURI)
- ZEND_ARG_INFO(0, localName)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_set_attribute_node_ns, 0, 0, 1)
- ZEND_ARG_OBJ_INFO(0, newAttr, DOMAttr, 0)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_get_elements_by_tag_name_ns, 0, 0, 2)
- ZEND_ARG_INFO(0, namespaceURI)
- ZEND_ARG_INFO(0, localName)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_has_attribute, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_has_attribute_ns, 0, 0, 2)
- ZEND_ARG_INFO(0, namespaceURI)
- ZEND_ARG_INFO(0, localName)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_set_id_attribute, 0, 0, 2)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, isId)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_set_id_attribute_ns, 0, 0, 3)
- ZEND_ARG_INFO(0, namespaceURI)
- ZEND_ARG_INFO(0, localName)
- ZEND_ARG_INFO(0, isId)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_set_id_attribute_node, 0, 0, 2)
- ZEND_ARG_OBJ_INFO(0, attr, DOMAttr, 0)
- ZEND_ARG_INFO(0, isId)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_element_construct, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, value)
- ZEND_ARG_INFO(0, uri)
-ZEND_END_ARG_INFO();
-/* }}} */
+#include "dom_arginfo.h"
/*
* class DOMElement extends DOMNode
@@ -125,25 +32,25 @@ ZEND_END_ARG_INFO();
*/
const zend_function_entry php_dom_element_class_functions[] = { /* {{{ */
- PHP_FALIAS(getAttribute, dom_element_get_attribute, arginfo_dom_element_get_attribute)
- PHP_FALIAS(setAttribute, dom_element_set_attribute, arginfo_dom_element_set_attribute)
- PHP_FALIAS(removeAttribute, dom_element_remove_attribute, arginfo_dom_element_remove_attribute)
- PHP_FALIAS(getAttributeNode, dom_element_get_attribute_node, arginfo_dom_element_get_attribute_node)
- PHP_FALIAS(setAttributeNode, dom_element_set_attribute_node, arginfo_dom_element_set_attribute_node)
- PHP_FALIAS(removeAttributeNode, dom_element_remove_attribute_node, arginfo_dom_element_remove_attribute_node)
- PHP_FALIAS(getElementsByTagName, dom_element_get_elements_by_tag_name, arginfo_dom_element_get_elements_by_tag_name)
- PHP_FALIAS(getAttributeNS, dom_element_get_attribute_ns, arginfo_dom_element_get_attribute_ns)
- PHP_FALIAS(setAttributeNS, dom_element_set_attribute_ns, arginfo_dom_element_set_attribute_ns)
- PHP_FALIAS(removeAttributeNS, dom_element_remove_attribute_ns, arginfo_dom_element_remove_attribute_ns)
- PHP_FALIAS(getAttributeNodeNS, dom_element_get_attribute_node_ns, arginfo_dom_element_get_attribute_node_ns)
- PHP_FALIAS(setAttributeNodeNS, dom_element_set_attribute_node_ns, arginfo_dom_element_set_attribute_node_ns)
- PHP_FALIAS(getElementsByTagNameNS, dom_element_get_elements_by_tag_name_ns, arginfo_dom_element_get_elements_by_tag_name_ns)
- PHP_FALIAS(hasAttribute, dom_element_has_attribute, arginfo_dom_element_has_attribute)
- PHP_FALIAS(hasAttributeNS, dom_element_has_attribute_ns, arginfo_dom_element_has_attribute_ns)
- PHP_FALIAS(setIdAttribute, dom_element_set_id_attribute, arginfo_dom_element_set_id_attribute)
- PHP_FALIAS(setIdAttributeNS, dom_element_set_id_attribute_ns, arginfo_dom_element_set_id_attribute_ns)
- PHP_FALIAS(setIdAttributeNode, dom_element_set_id_attribute_node, arginfo_dom_element_set_id_attribute_node)
- PHP_ME(domelement, __construct, arginfo_dom_element_construct, ZEND_ACC_PUBLIC)
+ PHP_ME(domelement, getAttribute, arginfo_class_DOMElement_getAttribute, ZEND_ACC_PUBLIC)
+ PHP_ME(domelement, setAttribute, arginfo_class_DOMElement_setAttribute, ZEND_ACC_PUBLIC)
+ PHP_ME(domelement, removeAttribute, arginfo_class_DOMElement_removeAttribute, ZEND_ACC_PUBLIC)
+ PHP_ME(domelement, getAttributeNode, arginfo_class_DOMElement_getAttributeNode, ZEND_ACC_PUBLIC)
+ PHP_ME(domelement, setAttributeNode, arginfo_class_DOMElement_setAttributeNode, ZEND_ACC_PUBLIC)
+ PHP_ME(domelement, removeAttributeNode, arginfo_class_DOMElement_removeAttributeNode, ZEND_ACC_PUBLIC)
+ PHP_ME(domelement, getElementsByTagName, arginfo_class_DOMElement_getElementsByTagName, ZEND_ACC_PUBLIC)
+ PHP_ME(domelement, getAttributeNS, arginfo_class_DOMElement_getAttributeNS, ZEND_ACC_PUBLIC)
+ PHP_ME(domelement, setAttributeNS, arginfo_class_DOMElement_setAttributeNS, ZEND_ACC_PUBLIC)
+ PHP_ME(domelement, removeAttributeNS, arginfo_class_DOMElement_removeAttributeNS, ZEND_ACC_PUBLIC)
+ PHP_ME(domelement, getAttributeNodeNS, arginfo_class_DOMElement_getAttributeNodeNS, ZEND_ACC_PUBLIC)
+ PHP_ME(domelement, setAttributeNodeNS, arginfo_class_DOMElement_setAttributeNodeNS, ZEND_ACC_PUBLIC)
+ PHP_ME(domelement, getElementsByTagNameNS, arginfo_class_DOMElement_getElementsByTagNameNS, ZEND_ACC_PUBLIC)
+ PHP_ME(domelement, hasAttribute, arginfo_class_DOMElement_hasAttribute, ZEND_ACC_PUBLIC)
+ PHP_ME(domelement, hasAttributeNS, arginfo_class_DOMElement_hasAttributeNS, ZEND_ACC_PUBLIC)
+ PHP_ME(domelement, setIdAttribute, arginfo_class_DOMElement_setIdAttribute, ZEND_ACC_PUBLIC)
+ PHP_ME(domelement, setIdAttributeNS, arginfo_class_DOMElement_setIdAttributeNS, ZEND_ACC_PUBLIC)
+ PHP_ME(domelement, setIdAttributeNode, arginfo_class_DOMElement_setIdAttributeNode, ZEND_ACC_PUBLIC)
+ PHP_ME(domelement, __construct, arginfo_class_DOMElement___construct, ZEND_ACC_PUBLIC)
PHP_FE_END
};
/* }}} */
@@ -160,14 +67,14 @@ PHP_METHOD(domelement, __construct)
int name_valid;
xmlNsPtr nsptr = NULL;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "s|s!s", &name, &name_len, &value, &value_len, &uri, &uri_len) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s!s", &name, &name_len, &value, &value_len, &uri, &uri_len) == FAILURE) {
+ RETURN_THROWS();
}
name_valid = xmlValidateName((xmlChar *) name, 0);
if (name_valid != 0) {
php_dom_throw_error(INVALID_CHARACTER_ERR, 1);
- RETURN_FALSE;
+ return;
}
/* Namespace logic is separate and only when uri passed in to insure no BC breakage */
@@ -189,7 +96,7 @@ PHP_METHOD(domelement, __construct)
xmlFreeNode(nodep);
}
php_dom_throw_error(errorcode, 1);
- RETURN_FALSE;
+ return;
}
} else {
/* If you don't pass a namespace uri, then you can't set a prefix */
@@ -198,14 +105,14 @@ PHP_METHOD(domelement, __construct)
xmlFree(localname);
xmlFree(prefix);
php_dom_throw_error(NAMESPACE_ERR, 1);
- RETURN_FALSE;
+ return;
}
nodep = xmlNewNode(NULL, (xmlChar *) name);
}
if (!nodep) {
php_dom_throw_error(INVALID_STATE_ERR, 1);
- RETURN_FALSE;
+ return;
}
if (value_len > 0) {
@@ -315,7 +222,7 @@ static xmlNodePtr dom_get_dom1_attribute(xmlNodePtr elem, xmlChar *name) /* {{{
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-666EE0F9
Since:
*/
-PHP_FUNCTION(dom_element_get_attribute)
+PHP_METHOD(domelement, getAttribute)
{
zval *id;
xmlNode *nodep;
@@ -327,7 +234,7 @@ PHP_FUNCTION(dom_element_get_attribute)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
@@ -359,7 +266,7 @@ PHP_FUNCTION(dom_element_get_attribute)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-F68F082
Since:
*/
-PHP_FUNCTION(dom_element_set_attribute)
+PHP_METHOD(domelement, setAttribute)
{
zval *id;
xmlNode *nodep;
@@ -371,7 +278,7 @@ PHP_FUNCTION(dom_element_set_attribute)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &name, &name_len, &value, &value_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (name_len == 0) {
@@ -427,7 +334,7 @@ PHP_FUNCTION(dom_element_set_attribute)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-6D6AC0F9
Since:
*/
-PHP_FUNCTION(dom_element_remove_attribute)
+PHP_METHOD(domelement, removeAttribute)
{
zval *id;
xmlNodePtr nodep, attrp;
@@ -437,7 +344,7 @@ PHP_FUNCTION(dom_element_remove_attribute)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
@@ -476,7 +383,7 @@ PHP_FUNCTION(dom_element_remove_attribute)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-217A91B8
Since:
*/
-PHP_FUNCTION(dom_element_get_attribute_node)
+PHP_METHOD(domelement, getAttributeNode)
{
zval *id;
xmlNodePtr nodep, attrp;
@@ -487,7 +394,7 @@ PHP_FUNCTION(dom_element_get_attribute_node)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
@@ -524,7 +431,7 @@ PHP_FUNCTION(dom_element_get_attribute_node)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-887236154
Since:
*/
-PHP_FUNCTION(dom_element_set_attribute_node)
+PHP_METHOD(domelement, setAttributeNode)
{
zval *id, *node;
xmlNode *nodep;
@@ -534,7 +441,7 @@ PHP_FUNCTION(dom_element_set_attribute_node)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &node, dom_attr_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
@@ -591,7 +498,7 @@ PHP_FUNCTION(dom_element_set_attribute_node)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-D589198
Since:
*/
-PHP_FUNCTION(dom_element_remove_attribute_node)
+PHP_METHOD(domelement, removeAttributeNode)
{
zval *id, *node;
xmlNode *nodep;
@@ -601,7 +508,7 @@ PHP_FUNCTION(dom_element_remove_attribute_node)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &node, dom_attr_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
@@ -629,7 +536,7 @@ PHP_FUNCTION(dom_element_remove_attribute_node)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1938918D
Since:
*/
-PHP_FUNCTION(dom_element_get_elements_by_tag_name)
+PHP_METHOD(domelement, getElementsByTagName)
{
zval *id;
xmlNodePtr elemp;
@@ -640,7 +547,7 @@ PHP_FUNCTION(dom_element_get_elements_by_tag_name)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(elemp, id, xmlNodePtr, intern);
@@ -656,7 +563,7 @@ PHP_FUNCTION(dom_element_get_elements_by_tag_name)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElGetAttrNS
Since: DOM Level 2
*/
-PHP_FUNCTION(dom_element_get_attribute_ns)
+PHP_METHOD(domelement, getAttributeNS)
{
zval *id;
xmlNodePtr elemp;
@@ -668,7 +575,7 @@ PHP_FUNCTION(dom_element_get_attribute_ns)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s!s", &uri, &uri_len, &name, &name_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(elemp, id, xmlNodePtr, intern);
@@ -737,7 +644,7 @@ static xmlNsPtr _dom_new_reconNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns) /*
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElSetAttrNS
Since: DOM Level 2
*/
-PHP_FUNCTION(dom_element_set_attribute_ns)
+PHP_METHOD(domelement, setAttributeNS)
{
zval *id;
xmlNodePtr elemp, nodep = NULL;
@@ -751,7 +658,7 @@ PHP_FUNCTION(dom_element_set_attribute_ns)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s!ss", &uri, &uri_len, &name, &name_len, &value, &value_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (name_len == 0) {
@@ -866,7 +773,7 @@ PHP_FUNCTION(dom_element_set_attribute_ns)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElRemAtNS
Since: DOM Level 2
*/
-PHP_FUNCTION(dom_element_remove_attribute_ns)
+PHP_METHOD(domelement, removeAttributeNS)
{
zval *id;
xmlNode *nodep;
@@ -878,7 +785,7 @@ PHP_FUNCTION(dom_element_remove_attribute_ns)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s!s", &uri, &uri_len, &name, &name_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
@@ -924,7 +831,7 @@ PHP_FUNCTION(dom_element_remove_attribute_ns)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElGetAtNodeNS
Since: DOM Level 2
*/
-PHP_FUNCTION(dom_element_get_attribute_node_ns)
+PHP_METHOD(domelement, getAttributeNodeNS)
{
zval *id;
xmlNodePtr elemp, fakeAttrp;
@@ -936,7 +843,7 @@ PHP_FUNCTION(dom_element_get_attribute_node_ns)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s!s", &uri, &uri_len, &name, &name_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(elemp, id, xmlNodePtr, intern);
@@ -980,7 +887,7 @@ PHP_FUNCTION(dom_element_get_attribute_node_ns)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElSetAtNodeNS
Since: DOM Level 2
*/
-PHP_FUNCTION(dom_element_set_attribute_node_ns)
+PHP_METHOD(domelement, setAttributeNodeNS)
{
zval *id, *node;
xmlNode *nodep;
@@ -991,7 +898,7 @@ PHP_FUNCTION(dom_element_set_attribute_node_ns)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &node, dom_attr_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
@@ -1054,7 +961,7 @@ PHP_FUNCTION(dom_element_set_attribute_node_ns)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-A6C90942
Since: DOM Level 2
*/
-PHP_FUNCTION(dom_element_get_elements_by_tag_name_ns)
+PHP_METHOD(domelement, getElementsByTagNameNS)
{
zval *id;
xmlNodePtr elemp;
@@ -1065,7 +972,7 @@ PHP_FUNCTION(dom_element_get_elements_by_tag_name_ns)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &uri, &uri_len, &name, &name_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(elemp, id, xmlNodePtr, intern);
@@ -1083,7 +990,7 @@ PHP_FUNCTION(dom_element_get_elements_by_tag_name_ns)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElHasAttr
Since: DOM Level 2
*/
-PHP_FUNCTION(dom_element_has_attribute)
+PHP_METHOD(domelement, hasAttribute)
{
zval *id;
xmlNode *nodep;
@@ -1094,7 +1001,7 @@ PHP_FUNCTION(dom_element_has_attribute)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
@@ -1112,7 +1019,7 @@ PHP_FUNCTION(dom_element_has_attribute)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElHasAttrNS
Since: DOM Level 2
*/
-PHP_FUNCTION(dom_element_has_attribute_ns)
+PHP_METHOD(domelement, hasAttributeNS)
{
zval *id;
xmlNodePtr elemp;
@@ -1124,7 +1031,7 @@ PHP_FUNCTION(dom_element_has_attribute_ns)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s!s", &uri, &uri_len, &name, &name_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(elemp, id, xmlNodePtr, intern);
@@ -1170,7 +1077,7 @@ static void php_set_attribute_id(xmlAttrPtr attrp, zend_bool is_id) /* {{{ */
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElSetIdAttr
Since: DOM Level 3
*/
-PHP_FUNCTION(dom_element_set_id_attribute)
+PHP_METHOD(domelement, setIdAttribute)
{
zval *id;
xmlNode *nodep;
@@ -1182,7 +1089,7 @@ PHP_FUNCTION(dom_element_set_id_attribute)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sb", &name, &name_len, &is_id) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
@@ -1207,7 +1114,7 @@ PHP_FUNCTION(dom_element_set_id_attribute)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElSetIdAttrNS
Since: DOM Level 3
*/
-PHP_FUNCTION(dom_element_set_id_attribute_ns)
+PHP_METHOD(domelement, setIdAttributeNS)
{
zval *id;
xmlNodePtr elemp;
@@ -1219,7 +1126,7 @@ PHP_FUNCTION(dom_element_set_id_attribute_ns)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ssb", &uri, &uri_len, &name, &name_len, &is_id) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(elemp, id, xmlNodePtr, intern);
@@ -1244,7 +1151,7 @@ PHP_FUNCTION(dom_element_set_id_attribute_ns)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-ElSetIdAttrNode
Since: DOM Level 3
*/
-PHP_FUNCTION(dom_element_set_id_attribute_node)
+PHP_METHOD(domelement, setIdAttributeNode)
{
zval *id, *node;
xmlNode *nodep;
@@ -1254,7 +1161,7 @@ PHP_FUNCTION(dom_element_set_id_attribute_node)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ob", &node, dom_attr_class_entry, &is_id) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
diff --git a/ext/dom/entity.c b/ext/dom/entity.c
index b41255066a..6b01cb3fb2 100644
--- a/ext/dom/entity.c
+++ b/ext/dom/entity.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/dom/entityreference.c b/ext/dom/entityreference.c
index f7c0c2a711..ac5258ff2f 100644
--- a/ext/dom/entityreference.c
+++ b/ext/dom/entityreference.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -24,12 +22,7 @@
#include "php.h"
#if HAVE_LIBXML && HAVE_DOM
#include "php_dom.h"
-
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_entityreference_construct, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO();
-/* }}} */
+#include "dom_arginfo.h"
/*
* class DOMEntityReference extends DOMNode
@@ -39,7 +32,7 @@ ZEND_END_ARG_INFO();
*/
const zend_function_entry php_dom_entityreference_class_functions[] = {
- PHP_ME(domentityreference, __construct, arginfo_dom_entityreference_construct, ZEND_ACC_PUBLIC)
+ PHP_ME(domentityreference, __construct, arginfo_class_DOMEntityReference___construct, ZEND_ACC_PUBLIC)
PHP_FE_END
};
@@ -52,8 +45,8 @@ PHP_METHOD(domentityreference, __construct)
char *name;
size_t name_len, name_valid;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) {
+ RETURN_THROWS();
}
name_valid = xmlValidateName((xmlChar *) name, 0);
diff --git a/ext/dom/namednodemap.c b/ext/dom/namednodemap.c
index 4b8df2734f..33048fd09b 100644
--- a/ext/dom/namednodemap.c
+++ b/ext/dom/namednodemap.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -24,41 +22,7 @@
#include "php.h"
#if HAVE_LIBXML && HAVE_DOM
#include "php_dom.h"
-
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_namednodemap_get_named_item, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_namednodemap_set_named_item, 0, 0, 1)
- ZEND_ARG_OBJ_INFO(0, arg, DOMNode, 0)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_namednodemap_remove_named_item, 0, 0, 0)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_namednodemap_item, 0, 0, 0)
- ZEND_ARG_INFO(0, index)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_namednodemap_get_named_item_ns, 0, 0, 0)
- ZEND_ARG_INFO(0, namespaceURI)
- ZEND_ARG_INFO(0, localName)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_namednodemap_set_named_item_ns, 0, 0, 0)
- ZEND_ARG_OBJ_INFO(0, arg, DOMNode, 0)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_namednodemap_remove_named_item_ns, 0, 0, 0)
- ZEND_ARG_INFO(0, namespaceURI)
- ZEND_ARG_INFO(0, localName)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_namednodemap_count, 0, 0, 0)
-ZEND_END_ARG_INFO();
-/* }}} */
+#include "dom_arginfo.h"
/*
* class DOMNamedNodeMap
@@ -68,14 +32,10 @@ ZEND_END_ARG_INFO();
*/
const zend_function_entry php_dom_namednodemap_class_functions[] = { /* {{{ */
- PHP_FALIAS(getNamedItem, dom_namednodemap_get_named_item, arginfo_dom_namednodemap_get_named_item)
- PHP_FALIAS(setNamedItem, dom_namednodemap_set_named_item, arginfo_dom_namednodemap_set_named_item)
- PHP_FALIAS(removeNamedItem, dom_namednodemap_remove_named_item, arginfo_dom_namednodemap_remove_named_item)
- PHP_FALIAS(item, dom_namednodemap_item, arginfo_dom_namednodemap_item)
- PHP_FALIAS(getNamedItemNS, dom_namednodemap_get_named_item_ns, arginfo_dom_namednodemap_get_named_item_ns)
- PHP_FALIAS(setNamedItemNS, dom_namednodemap_set_named_item_ns, arginfo_dom_namednodemap_set_named_item_ns)
- PHP_FALIAS(removeNamedItemNS, dom_namednodemap_remove_named_item_ns, arginfo_dom_namednodemap_remove_named_item_ns)
- PHP_FALIAS(count, dom_namednodemap_count, arginfo_dom_namednodemap_count)
+ PHP_ME(domnamednodemap, getNamedItem, arginfo_class_DOMNamedNodeMap_getNamedItem, ZEND_ACC_PUBLIC)
+ PHP_ME(domnamednodemap, item, arginfo_class_DOMNamedNodeMap_item, ZEND_ACC_PUBLIC)
+ PHP_ME(domnamednodemap, getNamedItemNS, arginfo_class_DOMNamedNodeMap_getNamedItemNS, ZEND_ACC_PUBLIC)
+ PHP_ME(domnamednodemap, count, arginfo_class_DOMNamedNodeMap_count, ZEND_ACC_PUBLIC)
PHP_FE_END
};
/* }}} */
@@ -125,7 +85,7 @@ int dom_namednodemap_length_read(dom_object *obj, zval *retval)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1074577549
Since:
*/
-PHP_FUNCTION(dom_namednodemap_get_named_item)
+PHP_METHOD(domnamednodemap, getNamedItem)
{
zval *id;
int ret;
@@ -140,7 +100,7 @@ PHP_FUNCTION(dom_namednodemap_get_named_item)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &named, &namedlen) == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern = Z_DOMOBJ_P(id);
@@ -177,31 +137,11 @@ PHP_FUNCTION(dom_namednodemap_get_named_item)
}
/* }}} end dom_namednodemap_get_named_item */
-/* {{{ proto DOMNode dom_namednodemap_set_named_item(DOMNode arg);
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1025163788
-Since:
-*/
-PHP_FUNCTION(dom_namednodemap_set_named_item)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_namednodemap_set_named_item */
-
-/* {{{ proto DOMNode dom_namednodemap_remove_named_item(string name);
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-D58B193
-Since:
-*/
-PHP_FUNCTION(dom_namednodemap_remove_named_item)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_namednodemap_remove_named_item */
-
/* {{{ proto DOMNode dom_namednodemap_item(int index);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-349467F9
Since:
*/
-PHP_FUNCTION(dom_namednodemap_item)
+PHP_METHOD(domnamednodemap, item)
{
zval *id;
zend_long index;
@@ -215,7 +155,7 @@ PHP_FUNCTION(dom_namednodemap_item)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &index) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (index >= 0) {
if (ZEND_LONG_INT_OVFL(index)) {
@@ -265,7 +205,7 @@ PHP_FUNCTION(dom_namednodemap_item)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-getNamedItemNS
Since: DOM Level 2
*/
-PHP_FUNCTION(dom_namednodemap_get_named_item_ns)
+PHP_METHOD(domnamednodemap, getNamedItemNS)
{
zval *id;
int ret;
@@ -280,7 +220,7 @@ PHP_FUNCTION(dom_namednodemap_get_named_item_ns)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s!s", &uri, &urilen, &named, &namedlen) == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern = Z_DOMOBJ_P(id);
@@ -317,36 +257,16 @@ PHP_FUNCTION(dom_namednodemap_get_named_item_ns)
}
/* }}} end dom_namednodemap_get_named_item_ns */
-/* {{{ proto DOMNode dom_namednodemap_set_named_item_ns(DOMNode arg);
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-setNamedItemNS
-Since: DOM Level 2
-*/
-PHP_FUNCTION(dom_namednodemap_set_named_item_ns)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_namednodemap_set_named_item_ns */
-
-/* {{{ proto DOMNode dom_namednodemap_remove_named_item_ns(string namespaceURI, string localName);
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-removeNamedItemNS
-Since: DOM Level 2
-*/
-PHP_FUNCTION(dom_namednodemap_remove_named_item_ns)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_namednodemap_remove_named_item_ns */
-
/* {{{ proto int|bool dom_namednodemap_count();
*/
-PHP_FUNCTION(dom_namednodemap_count)
+PHP_METHOD(domnamednodemap, count)
{
zval *id;
dom_object *intern;
id = ZEND_THIS;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern = Z_DOMOBJ_P(id);
diff --git a/ext/dom/namelist.c b/ext/dom/namelist.c
deleted file mode 100644
index a235536bb5..0000000000
--- a/ext/dom/namelist.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
- | Copyright (c) The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Christian Stocker <chregu@php.net> |
- | Rob Richards <rrichards@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#if HAVE_LIBXML && HAVE_DOM
-#include "php_dom.h"
-
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_namelist_get_name, 0, 0, 1)
- ZEND_ARG_INFO(0, index)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_namelist_get_namespace_uri, 0, 0, 1)
- ZEND_ARG_INFO(0, index)
-ZEND_END_ARG_INFO();
-/* }}} */
-
-/*
-* class DOMNameList
-*
-* URL: https://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#NameList
-* Since: DOM Level 3
-*/
-
-const zend_function_entry php_dom_namelist_class_functions[] = {
- PHP_FALIAS(getName, dom_namelist_get_name, arginfo_dom_namelist_get_name)
- PHP_FALIAS(getNamespaceURI, dom_namelist_get_namespace_uri, arginfo_dom_namelist_get_namespace_uri)
- PHP_FE_END
-};
-
-/* {{{ length int
-readonly=yes
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#NameList-length
-Since:
-*/
-int dom_namelist_length_read(dom_object *obj, zval *retval)
-{
- ZVAL_STRING(retval, "TEST");
- return SUCCESS;
-}
-
-/* }}} */
-
-/* {{{ proto string dom_namelist_get_name(int index);
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#NameList-getName
-Since:
-*/
-PHP_FUNCTION(dom_namelist_get_name)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_namelist_get_name */
-
-/* {{{ proto string dom_namelist_get_namespace_uri(int index);
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#NameList-getNamespaceURI
-Since:
-*/
-PHP_FUNCTION(dom_namelist_get_namespace_uri)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_namelist_get_namespace_uri */
-
-#endif
diff --git a/ext/dom/node.c b/ext/dom/node.c
index 609d1a6116..4caf85c36f 100644
--- a/ext/dom/node.c
+++ b/ext/dom/node.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -24,104 +22,7 @@
#include "php.h"
#if HAVE_LIBXML && HAVE_DOM
#include "php_dom.h"
-
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_insert_before, 0, 0, 1)
- ZEND_ARG_OBJ_INFO(0, newChild, DOMNode, 0)
- ZEND_ARG_OBJ_INFO(0, refChild, DOMNode, 1)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_replace_child, 0, 0, 2)
- ZEND_ARG_OBJ_INFO(0, newChild, DOMNode, 0)
- ZEND_ARG_OBJ_INFO(0, oldChild, DOMNode, 0)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_remove_child, 0, 0, 1)
- ZEND_ARG_OBJ_INFO(0, oldChild, DOMNode, 0)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_append_child, 0, 0, 1)
- ZEND_ARG_OBJ_INFO(0, newChild, DOMNode, 0)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_has_child_nodes, 0, 0, 0)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_clone_node, 0, 0, 0)
- ZEND_ARG_INFO(0, deep)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_normalize, 0, 0, 0)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_is_supported, 0, 0, 2)
- ZEND_ARG_INFO(0, feature)
- ZEND_ARG_INFO(0, version)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_has_attributes, 0, 0, 0)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_compare_document_position, 0, 0, 1)
- ZEND_ARG_OBJ_INFO(0, other, DOMNode, 0)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_is_same_node, 0, 0, 1)
- ZEND_ARG_OBJ_INFO(0, other, DOMNode, 0)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_lookup_prefix, 0, 0, 1)
- ZEND_ARG_INFO(0, namespaceURI)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_is_default_namespace, 0, 0, 1)
- ZEND_ARG_INFO(0, namespaceURI)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_lookup_namespace_uri, 0, 0, 1)
- ZEND_ARG_INFO(0, prefix)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_is_equal_node, 0, 0, 1)
- ZEND_ARG_OBJ_INFO(0, arg, DOMNode, 0)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_get_feature, 0, 0, 2)
- ZEND_ARG_INFO(0, feature)
- ZEND_ARG_INFO(0, version)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_set_user_data, 0, 0, 3)
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, handler)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_get_user_data, 0, 0, 1)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_getNodePath, 0, 0, 0)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_getLineNo, 0, 0, 0)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_C14N, 0, 0, 0)
- ZEND_ARG_INFO(0, exclusive)
- ZEND_ARG_INFO(0, with_comments)
- ZEND_ARG_ARRAY_INFO(0, xpath, 1)
- ZEND_ARG_ARRAY_INFO(0, ns_prefixes, 1)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_node_C14NFile, 0, 0, 1)
- ZEND_ARG_INFO(0, uri)
- ZEND_ARG_INFO(0, exclusive)
- ZEND_ARG_INFO(0, with_comments)
- ZEND_ARG_ARRAY_INFO(0, xpath, 1)
- ZEND_ARG_ARRAY_INFO(0, ns_prefixes, 1)
-ZEND_END_ARG_INFO();
-/* }}} */
+#include "dom_arginfo.h"
/*
* class DOMNode
@@ -131,28 +32,23 @@ ZEND_END_ARG_INFO();
*/
const zend_function_entry php_dom_node_class_functions[] = { /* {{{ */
- PHP_FALIAS(insertBefore, dom_node_insert_before, arginfo_dom_node_insert_before)
- PHP_FALIAS(replaceChild, dom_node_replace_child, arginfo_dom_node_replace_child)
- PHP_FALIAS(removeChild, dom_node_remove_child, arginfo_dom_node_remove_child)
- PHP_FALIAS(appendChild, dom_node_append_child, arginfo_dom_node_append_child)
- PHP_FALIAS(hasChildNodes, dom_node_has_child_nodes, arginfo_dom_node_has_child_nodes)
- PHP_FALIAS(cloneNode, dom_node_clone_node, arginfo_dom_node_clone_node)
- PHP_FALIAS(normalize, dom_node_normalize, arginfo_dom_node_normalize)
- PHP_FALIAS(isSupported, dom_node_is_supported, arginfo_dom_node_is_supported)
- PHP_FALIAS(hasAttributes, dom_node_has_attributes, arginfo_dom_node_has_attributes)
- PHP_FALIAS(compareDocumentPosition, dom_node_compare_document_position, arginfo_dom_node_compare_document_position)
- PHP_FALIAS(isSameNode, dom_node_is_same_node, arginfo_dom_node_is_same_node)
- PHP_FALIAS(lookupPrefix, dom_node_lookup_prefix, arginfo_dom_node_lookup_prefix)
- PHP_FALIAS(isDefaultNamespace, dom_node_is_default_namespace, arginfo_dom_node_is_default_namespace)
- PHP_FALIAS(lookupNamespaceUri, dom_node_lookup_namespace_uri, arginfo_dom_node_lookup_namespace_uri)
- PHP_FALIAS(isEqualNode, dom_node_is_equal_node, arginfo_dom_node_is_equal_node)
- PHP_FALIAS(getFeature, dom_node_get_feature, arginfo_dom_node_get_feature)
- PHP_FALIAS(setUserData, dom_node_set_user_data, arginfo_dom_node_set_user_data)
- PHP_FALIAS(getUserData, dom_node_get_user_data, arginfo_dom_node_get_user_data)
- PHP_ME(domnode, getNodePath, arginfo_dom_node_getNodePath, ZEND_ACC_PUBLIC)
- PHP_ME(domnode, getLineNo, arginfo_dom_node_getLineNo, ZEND_ACC_PUBLIC)
- PHP_ME(domnode, C14N, arginfo_dom_node_C14N, ZEND_ACC_PUBLIC)
- PHP_ME(domnode, C14NFile, arginfo_dom_node_C14NFile, ZEND_ACC_PUBLIC)
+ PHP_ME(domnode, insertBefore, arginfo_class_DOMNode_insertBefore, ZEND_ACC_PUBLIC)
+ PHP_ME(domnode, replaceChild, arginfo_class_DOMNode_replaceChild, ZEND_ACC_PUBLIC)
+ PHP_ME(domnode, removeChild, arginfo_class_DOMNode_removeChild, ZEND_ACC_PUBLIC)
+ PHP_ME(domnode, appendChild, arginfo_class_DOMNode_appendChild, ZEND_ACC_PUBLIC)
+ PHP_ME(domnode, hasChildNodes, arginfo_class_DOMNode_hasChildNodes, ZEND_ACC_PUBLIC)
+ PHP_ME(domnode, cloneNode, arginfo_class_DOMNode_cloneNode, ZEND_ACC_PUBLIC)
+ PHP_ME(domnode, normalize, arginfo_class_DOMNode_normalize, ZEND_ACC_PUBLIC)
+ PHP_ME(domnode, isSupported, arginfo_class_DOMNode_isSupported, ZEND_ACC_PUBLIC)
+ PHP_ME(domnode, hasAttributes, arginfo_class_DOMNode_hasAttributes, ZEND_ACC_PUBLIC)
+ PHP_ME(domnode, isSameNode, arginfo_class_DOMNode_isSameNode, ZEND_ACC_PUBLIC)
+ PHP_ME(domnode, lookupPrefix, arginfo_class_DOMNode_lookupPrefix, ZEND_ACC_PUBLIC)
+ PHP_ME(domnode, isDefaultNamespace, arginfo_class_DOMNode_isDefaultNamespace, ZEND_ACC_PUBLIC)
+ PHP_ME(domnode, lookupNamespaceURI, arginfo_class_DOMNode_lookupNamespaceUri, ZEND_ACC_PUBLIC)
+ PHP_ME(domnode, getNodePath, arginfo_class_DOMNode_getNodePath, ZEND_ACC_PUBLIC)
+ PHP_ME(domnode, getLineNo, arginfo_class_DOMNode_getLineNo, ZEND_ACC_PUBLIC)
+ PHP_ME(domnode, C14N, arginfo_class_DOMNode_C14N, ZEND_ACC_PUBLIC)
+ PHP_ME(domnode, C14NFile, arginfo_class_DOMNode_C14NFile, ZEND_ACC_PUBLIC)
PHP_FE_END
};
/* }}} */
@@ -933,7 +829,7 @@ static xmlNodePtr _php_dom_insert_fragment(xmlNodePtr nodep, xmlNodePtr prevsib,
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-952280727
Since:
*/
-PHP_FUNCTION(dom_node_insert_before)
+PHP_METHOD(domnode, insertBefore)
{
zval *id, *node, *ref = NULL;
xmlNodePtr child, new_child, parentp, refp;
@@ -942,7 +838,7 @@ PHP_FUNCTION(dom_node_insert_before)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O|O!", &node, dom_node_class_entry, &ref, dom_node_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(parentp, id, xmlNodePtr, intern);
@@ -1095,7 +991,7 @@ PHP_FUNCTION(dom_node_insert_before)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-785887307
Since:
*/
-PHP_FUNCTION(dom_node_replace_child)
+PHP_METHOD(domnode, replaceChild)
{
zval *id, *newnode, *oldnode;
xmlNodePtr children, newchild, oldchild, nodep;
@@ -1106,7 +1002,7 @@ PHP_FUNCTION(dom_node_replace_child)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "OO", &newnode, dom_node_class_entry, &oldnode, dom_node_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
@@ -1184,7 +1080,7 @@ PHP_FUNCTION(dom_node_replace_child)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1734834066
Since:
*/
-PHP_FUNCTION(dom_node_remove_child)
+PHP_METHOD(domnode, removeChild)
{
zval *id, *node;
xmlNodePtr children, child, nodep;
@@ -1193,7 +1089,7 @@ PHP_FUNCTION(dom_node_remove_child)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &node, dom_node_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
@@ -1228,7 +1124,7 @@ PHP_FUNCTION(dom_node_remove_child)
}
php_dom_throw_error(NOT_FOUND_ERR, stricterror);
- RETURN_FALSE
+ RETURN_FALSE;
}
/* }}} end dom_node_remove_child */
@@ -1236,7 +1132,7 @@ PHP_FUNCTION(dom_node_remove_child)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-184E7107
Since:
*/
-PHP_FUNCTION(dom_node_append_child)
+PHP_METHOD(domnode, appendChild)
{
zval *id, *node;
xmlNodePtr child, nodep, new_child = NULL;
@@ -1245,7 +1141,7 @@ PHP_FUNCTION(dom_node_append_child)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &node, dom_node_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
@@ -1338,7 +1234,7 @@ PHP_FUNCTION(dom_node_append_child)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-810594187
Since:
*/
-PHP_FUNCTION(dom_node_has_child_nodes)
+PHP_METHOD(domnode, hasChildNodes)
{
zval *id;
xmlNode *nodep;
@@ -1346,7 +1242,7 @@ PHP_FUNCTION(dom_node_has_child_nodes)
id = ZEND_THIS;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
@@ -1367,7 +1263,7 @@ PHP_FUNCTION(dom_node_has_child_nodes)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-3A0ED0A4
Since:
*/
-PHP_FUNCTION(dom_node_clone_node)
+PHP_METHOD(domnode, cloneNode)
{
zval *id;
xmlNode *n, *node;
@@ -1377,7 +1273,7 @@ PHP_FUNCTION(dom_node_clone_node)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &recursive) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(n, id, xmlNodePtr, intern);
@@ -1429,7 +1325,7 @@ PHP_FUNCTION(dom_node_clone_node)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-normalize
Since:
*/
-PHP_FUNCTION(dom_node_normalize)
+PHP_METHOD(domnode, normalize)
{
zval *id;
xmlNode *nodep;
@@ -1437,7 +1333,7 @@ PHP_FUNCTION(dom_node_normalize)
id = ZEND_THIS;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
@@ -1451,13 +1347,13 @@ PHP_FUNCTION(dom_node_normalize)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Level-2-Core-Node-supports
Since: DOM Level 2
*/
-PHP_FUNCTION(dom_node_is_supported)
+PHP_METHOD(domnode, isSupported)
{
size_t feature_len, version_len;
char *feature, *version;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &feature, &feature_len, &version, &version_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (dom_has_feature(feature, version)) {
@@ -1472,7 +1368,7 @@ PHP_FUNCTION(dom_node_is_supported)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-NodeHasAttrs
Since: DOM Level 2
*/
-PHP_FUNCTION(dom_node_has_attributes)
+PHP_METHOD(domnode, hasAttributes)
{
zval *id;
xmlNode *nodep;
@@ -1480,7 +1376,7 @@ PHP_FUNCTION(dom_node_has_attributes)
id = ZEND_THIS;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
@@ -1496,21 +1392,11 @@ PHP_FUNCTION(dom_node_has_attributes)
}
/* }}} end dom_node_has_attributes */
-/* {{{ proto short dom_node_compare_document_position(DomNode other);
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-compareDocumentPosition
-Since: DOM Level 3
-*/
-PHP_FUNCTION(dom_node_compare_document_position)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_node_compare_document_position */
-
/* {{{ proto bool dom_node_is_same_node(DomNode other);
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-isSameNode
Since: DOM Level 3
*/
-PHP_FUNCTION(dom_node_is_same_node)
+PHP_METHOD(domnode, isSameNode)
{
zval *id, *node;
xmlNodePtr nodeotherp, nodep;
@@ -1518,7 +1404,7 @@ PHP_FUNCTION(dom_node_is_same_node)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &node, dom_node_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
@@ -1537,7 +1423,7 @@ PHP_FUNCTION(dom_node_is_same_node)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-lookupNamespacePrefix
Since: DOM Level 3
*/
-PHP_FUNCTION(dom_node_lookup_prefix)
+PHP_METHOD(domnode, lookupPrefix)
{
zval *id;
xmlNodePtr nodep, lookupp = NULL;
@@ -1548,7 +1434,7 @@ PHP_FUNCTION(dom_node_lookup_prefix)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &uri, &uri_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
@@ -1589,7 +1475,7 @@ PHP_FUNCTION(dom_node_lookup_prefix)
URL: http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-isDefaultNamespace
Since: DOM Level 3
*/
-PHP_FUNCTION(dom_node_is_default_namespace)
+PHP_METHOD(domnode, isDefaultNamespace)
{
zval *id;
xmlNodePtr nodep;
@@ -1600,7 +1486,7 @@ PHP_FUNCTION(dom_node_is_default_namespace)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &uri, &uri_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
@@ -1623,7 +1509,7 @@ PHP_FUNCTION(dom_node_is_default_namespace)
URL: http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-lookupNamespaceURI
Since: DOM Level 3
*/
-PHP_FUNCTION(dom_node_lookup_namespace_uri)
+PHP_METHOD(domnode, lookupNamespaceURI)
{
zval *id;
xmlNodePtr nodep;
@@ -1634,7 +1520,7 @@ PHP_FUNCTION(dom_node_lookup_namespace_uri)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s!", &prefix, &prefix_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
@@ -1654,46 +1540,6 @@ PHP_FUNCTION(dom_node_lookup_namespace_uri)
}
/* }}} end dom_node_lookup_namespace_uri */
-/* {{{ proto bool dom_node_is_equal_node(DomNode arg);
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-isEqualNode
-Since: DOM Level 3
-*/
-PHP_FUNCTION(dom_node_is_equal_node)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_node_is_equal_node */
-
-/* {{{ proto DomNode dom_node_get_feature(string feature, string version);
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-getFeature
-Since: DOM Level 3
-*/
-PHP_FUNCTION(dom_node_get_feature)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_node_get_feature */
-
-/* {{{ proto mixed dom_node_set_user_data(string key, mixed data, userdatahandler handler);
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-setUserData
-Since: DOM Level 3
-*/
-PHP_FUNCTION(dom_node_set_user_data)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_node_set_user_data */
-
-/* {{{ proto mixed dom_node_get_user_data(string key);
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Node3-getUserData
-Since: DOM Level 3
-*/
-PHP_FUNCTION(dom_node_get_user_data)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_node_get_user_data */
-
static void dom_canonicalization(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
{
zval *id;
@@ -1716,13 +1562,13 @@ static void dom_canonicalization(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{
if (zend_parse_parameters(ZEND_NUM_ARGS(),
"|bba!a!", &exclusive, &with_comments,
&xpath_array, &ns_prefixes) == FAILURE) {
- return;
+ RETURN_THROWS();
}
} else {
if (zend_parse_parameters(ZEND_NUM_ARGS(),
"s|bba!a!", &file, &file_len, &exclusive,
&with_comments, &xpath_array, &ns_prefixes) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
@@ -1885,7 +1731,7 @@ PHP_METHOD(domnode, C14NFile)
}
/* }}} */
-/* {{{ proto int DOMNode::getNodePath()
+/* {{{ proto string|null DOMNode::getNodePath()
Gets an xpath for a node */
PHP_METHOD(domnode, getNodePath)
{
@@ -1894,6 +1740,10 @@ PHP_METHOD(domnode, getNodePath)
dom_object *intern;
char *value;
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
DOM_GET_THIS_OBJ(nodep, id, xmlNodePtr, intern);
value = (char *) xmlGetNodePath(nodep);
@@ -1915,7 +1765,7 @@ PHP_METHOD(domnode, getLineNo)
dom_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_THIS_OBJ(nodep, id, xmlNodePtr, intern);
diff --git a/ext/dom/nodelist.c b/ext/dom/nodelist.c
index 84c4a9eb73..21addd2d18 100644
--- a/ext/dom/nodelist.c
+++ b/ext/dom/nodelist.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -24,18 +22,7 @@
#include "php.h"
#if HAVE_LIBXML && HAVE_DOM
#include "php_dom.h"
-
-
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_nodelist_item, 0, 0, 1)
- ZEND_ARG_INFO(0, index)
-ZEND_END_ARG_INFO();
-/* }}} */
-
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_nodelist_count, 0, 0, 0)
-ZEND_END_ARG_INFO();
-/* }}} */
+#include "dom_arginfo.h"
/*
* class DOMNodeList
@@ -45,8 +32,8 @@ ZEND_END_ARG_INFO();
*/
const zend_function_entry php_dom_nodelist_class_functions[] = {
- PHP_FALIAS(item, dom_nodelist_item, arginfo_dom_nodelist_item)
- PHP_FALIAS(count, dom_nodelist_count, arginfo_dom_nodelist_count)
+ PHP_ME(domnodelist, item, arginfo_class_DOMNodeList_item, ZEND_ACC_PUBLIC)
+ PHP_ME(domnodelist, count, arginfo_class_DOMNodeList_count, ZEND_ACC_PUBLIC)
PHP_FE_END
};
@@ -104,14 +91,14 @@ int dom_nodelist_length_read(dom_object *obj, zval *retval)
/* {{{ proto int|bool dom_nodelist_count();
*/
-PHP_FUNCTION(dom_nodelist_count)
+PHP_METHOD(domnodelist, count)
{
zval *id;
dom_object *intern;
id = ZEND_THIS;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern = Z_DOMOBJ_P(id);
@@ -127,7 +114,7 @@ PHP_FUNCTION(dom_nodelist_count)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-844377136
Since:
*/
-PHP_FUNCTION(dom_nodelist_item)
+PHP_METHOD(domnodelist, item)
{
zval *id;
zend_long index;
@@ -141,7 +128,7 @@ PHP_FUNCTION(dom_nodelist_item)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &index) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (index >= 0) {
diff --git a/ext/dom/notation.c b/ext/dom/notation.c
index 2fc3a84fec..2256b359d8 100644
--- a/ext/dom/notation.c
+++ b/ext/dom/notation.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c
index 726b74b934..4098a554de 100644
--- a/ext/dom/php_dom.c
+++ b/ext/dom/php_dom.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -26,6 +24,7 @@
#if HAVE_LIBXML && HAVE_DOM
#include "ext/standard/php_rand.h"
#include "php_dom.h"
+#include "dom_arginfo.h"
#include "dom_properties.h"
#include "zend_interfaces.h"
@@ -36,10 +35,6 @@
/* {{{ class entries */
PHP_DOM_EXPORT zend_class_entry *dom_node_class_entry;
PHP_DOM_EXPORT zend_class_entry *dom_domexception_class_entry;
-PHP_DOM_EXPORT zend_class_entry *dom_domstringlist_class_entry;
-PHP_DOM_EXPORT zend_class_entry *dom_namelist_class_entry;
-PHP_DOM_EXPORT zend_class_entry *dom_domimplementationlist_class_entry;
-PHP_DOM_EXPORT zend_class_entry *dom_domimplementationsource_class_entry;
PHP_DOM_EXPORT zend_class_entry *dom_domimplementation_class_entry;
PHP_DOM_EXPORT zend_class_entry *dom_documentfragment_class_entry;
PHP_DOM_EXPORT zend_class_entry *dom_document_class_entry;
@@ -50,19 +45,12 @@ PHP_DOM_EXPORT zend_class_entry *dom_attr_class_entry;
PHP_DOM_EXPORT zend_class_entry *dom_element_class_entry;
PHP_DOM_EXPORT zend_class_entry *dom_text_class_entry;
PHP_DOM_EXPORT zend_class_entry *dom_comment_class_entry;
-PHP_DOM_EXPORT zend_class_entry *dom_typeinfo_class_entry;
-PHP_DOM_EXPORT zend_class_entry *dom_userdatahandler_class_entry;
-PHP_DOM_EXPORT zend_class_entry *dom_domerror_class_entry;
-PHP_DOM_EXPORT zend_class_entry *dom_domerrorhandler_class_entry;
-PHP_DOM_EXPORT zend_class_entry *dom_domlocator_class_entry;
-PHP_DOM_EXPORT zend_class_entry *dom_domconfiguration_class_entry;
PHP_DOM_EXPORT zend_class_entry *dom_cdatasection_class_entry;
PHP_DOM_EXPORT zend_class_entry *dom_documenttype_class_entry;
PHP_DOM_EXPORT zend_class_entry *dom_notation_class_entry;
PHP_DOM_EXPORT zend_class_entry *dom_entity_class_entry;
PHP_DOM_EXPORT zend_class_entry *dom_entityreference_class_entry;
PHP_DOM_EXPORT zend_class_entry *dom_processinginstruction_class_entry;
-PHP_DOM_EXPORT zend_class_entry *dom_string_extend_class_entry;
#if defined(LIBXML_XPATH_ENABLED)
PHP_DOM_EXPORT zend_class_entry *dom_xpath_class_entry;
#endif
@@ -77,9 +65,6 @@ zend_object_handlers dom_xpath_object_handlers;
static HashTable classes;
/* {{{ prop handler tables */
-static HashTable dom_domstringlist_prop_handlers;
-static HashTable dom_namelist_prop_handlers;
-static HashTable dom_domimplementationlist_prop_handlers;
static HashTable dom_document_prop_handlers;
static HashTable dom_node_prop_handlers;
static HashTable dom_nodelist_prop_handlers;
@@ -88,9 +73,6 @@ static HashTable dom_characterdata_prop_handlers;
static HashTable dom_attr_prop_handlers;
static HashTable dom_element_prop_handlers;
static HashTable dom_text_prop_handlers;
-static HashTable dom_typeinfo_prop_handlers;
-static HashTable dom_domerror_prop_handlers;
-static HashTable dom_domlocator_prop_handlers;
static HashTable dom_documenttype_prop_handlers;
static HashTable dom_notation_prop_handlers;
static HashTable dom_entity_prop_handlers;
@@ -310,31 +292,27 @@ static void dom_register_prop_handler(HashTable *prop_handler, char *name, size_
}
/* }}} */
-static zval *dom_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) /* {{{ */
+static zval *dom_get_property_ptr_ptr(zend_object *object, zend_string *name, int type, void **cache_slot) /* {{{ */
{
- dom_object *obj = Z_DOMOBJ_P(object);
- zend_string *member_str = zval_get_string(member);
+ dom_object *obj = php_dom_obj_from_obj(object);
zval *retval = NULL;
- if (!obj->prop_handler || !zend_hash_exists(obj->prop_handler, member_str)) {
- retval = zend_std_get_property_ptr_ptr(object, member, type, cache_slot);
+ if (!obj->prop_handler || !zend_hash_exists(obj->prop_handler, name)) {
+ retval = zend_std_get_property_ptr_ptr(object, name, type, cache_slot);
}
-
- zend_string_release_ex(member_str, 0);
return retval;
}
/* }}} */
/* {{{ dom_read_property */
-zval *dom_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv)
+zval *dom_read_property(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv)
{
- dom_object *obj = Z_DOMOBJ_P(object);
- zend_string *member_str = zval_get_string(member);
+ dom_object *obj = php_dom_obj_from_obj(object);
zval *retval;
dom_prop_handler *hnd = NULL;
if (obj->prop_handler != NULL) {
- hnd = zend_hash_find_ptr(obj->prop_handler, member_str);
+ hnd = zend_hash_find_ptr(obj->prop_handler, name);
} else if (instanceof_function(obj->std.ce, dom_node_class_entry)) {
php_error(E_WARNING, "Couldn't fetch %s. Node no longer exists", ZSTR_VAL(obj->std.ce->name));
}
@@ -347,46 +325,41 @@ zval *dom_read_property(zval *object, zval *member, int type, void **cache_slot,
retval = &EG(uninitialized_zval);
}
} else {
- retval = zend_std_read_property(object, member, type, cache_slot, rv);
+ retval = zend_std_read_property(object, name, type, cache_slot, rv);
}
- zend_string_release_ex(member_str, 0);
return retval;
}
/* }}} */
/* {{{ dom_write_property */
-zval *dom_write_property(zval *object, zval *member, zval *value, void **cache_slot)
+zval *dom_write_property(zend_object *object, zend_string *name, zval *value, void **cache_slot)
{
- dom_object *obj = Z_DOMOBJ_P(object);
- zend_string *member_str = zval_get_string(member);
+ dom_object *obj = php_dom_obj_from_obj(object);
dom_prop_handler *hnd = NULL;
if (obj->prop_handler != NULL) {
- hnd = zend_hash_find_ptr(obj->prop_handler, member_str);
+ hnd = zend_hash_find_ptr(obj->prop_handler, name);
}
if (hnd) {
hnd->write_func(obj, value);
} else {
- value = zend_std_write_property(object, member, value, cache_slot);
+ value = zend_std_write_property(object, name, value, cache_slot);
}
- zend_string_release_ex(member_str, 0);
-
return value;
}
/* }}} */
/* {{{ dom_property_exists */
-static int dom_property_exists(zval *object, zval *member, int check_empty, void **cache_slot)
+static int dom_property_exists(zend_object *object, zend_string *name, int check_empty, void **cache_slot)
{
- dom_object *obj = Z_DOMOBJ_P(object);
- zend_string *member_str = zval_get_string(member);
+ dom_object *obj = php_dom_obj_from_obj(object);
dom_prop_handler *hnd = NULL;
int retval = 0;
if (obj->prop_handler != NULL) {
- hnd = zend_hash_find_ptr(obj->prop_handler, member_str);
+ hnd = zend_hash_find_ptr(obj->prop_handler, name);
}
if (hnd) {
zval tmp;
@@ -402,17 +375,16 @@ static int dom_property_exists(zval *object, zval *member, int check_empty, void
zval_ptr_dtor(&tmp);
}
} else {
- retval = zend_std_has_property(object, member, check_empty, cache_slot);
+ retval = zend_std_has_property(object, name, check_empty, cache_slot);
}
- zend_string_release_ex(member_str, 0);
return retval;
}
/* }}} */
-static HashTable* dom_get_debug_info_helper(zval *object, int *is_temp) /* {{{ */
+static HashTable* dom_get_debug_info_helper(zend_object *object, int *is_temp) /* {{{ */
{
- dom_object *obj = Z_DOMOBJ_P(object);
+ dom_object *obj = php_dom_obj_from_obj(object);
HashTable *debug_info,
*prop_handlers = obj->prop_handler,
*std_props;
@@ -453,7 +425,7 @@ static HashTable* dom_get_debug_info_helper(zval *object, int *is_temp) /* {{{ *
}
/* }}} */
-static HashTable* dom_get_debug_info(zval *object, int *is_temp) /* {{{ */
+static HashTable* dom_get_debug_info(zend_object *object, int *is_temp) /* {{{ */
{
return dom_get_debug_info_helper(object, is_temp);
}
@@ -483,7 +455,7 @@ PHP_FUNCTION(dom_import_simplexml)
int ret;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &node) == FAILURE) {
- return;
+ RETURN_THROWS();
}
nodeobj = (php_libxml_node_object *) ((char *) Z_OBJ_P(node) - Z_OBJ_HT_P(node)->offset);
@@ -500,9 +472,9 @@ PHP_FUNCTION(dom_import_simplexml)
static dom_object* dom_objects_set_class(zend_class_entry *class_type);
-static zend_object *dom_objects_store_clone_obj(zval *zobject) /* {{{ */
+static zend_object *dom_objects_store_clone_obj(zend_object *zobject) /* {{{ */
{
- dom_object *intern = Z_DOMOBJ_P(zobject);
+ dom_object *intern = php_dom_obj_from_obj(zobject);
dom_object *clone = dom_objects_set_class(intern->std.ce);
clone->std.handlers = dom_get_obj_handlers();
@@ -545,12 +517,6 @@ static void dom_dtor_prop_handler(zval *zv) /* {{{ */
free(Z_PTR_P(zv));
}
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_import_simplexml, 0, 0, 1)
- ZEND_ARG_INFO(0, node)
-ZEND_END_ARG_INFO()
-/* }}} */
-
static const zend_function_entry dom_functions[] = {
PHP_FE(dom_import_simplexml, arginfo_dom_import_simplexml)
PHP_FE_END
@@ -583,7 +549,9 @@ ZEND_GET_MODULE(dom)
void dom_objects_free_storage(zend_object *object);
void dom_nnodemap_objects_free_storage(zend_object *object);
-static zend_object *dom_objects_store_clone_obj(zval *zobject);
+static zval *dom_nodelist_read_dimension(zend_object *object, zval *offset, int type, zval *rv);
+static int dom_nodelist_has_dimension(zend_object *object, zval *member, int check_empty);
+static zend_object *dom_objects_store_clone_obj(zend_object *zobject);
static void dom_nnodemap_object_dtor(zend_object *object);
#if defined(LIBXML_XPATH_ENABLED)
void dom_xpath_objects_free_storage(zend_object *object);
@@ -617,25 +585,6 @@ PHP_MINIT_FUNCTION(dom)
dom_domexception_class_entry->ce_flags |= ZEND_ACC_FINAL;
zend_declare_property_long(dom_domexception_class_entry, "code", sizeof("code")-1, 0, ZEND_ACC_PUBLIC);
- REGISTER_DOM_CLASS(ce, "DOMStringList", NULL, php_dom_domstringlist_class_functions, dom_domstringlist_class_entry);
-
- zend_hash_init(&dom_domstringlist_prop_handlers, 0, NULL, dom_dtor_prop_handler, 1);
- dom_register_prop_handler(&dom_domstringlist_prop_handlers, "length", sizeof("length")-1, dom_domstringlist_length_read, NULL);
- zend_hash_add_ptr(&classes, ce.name, &dom_domstringlist_prop_handlers);
-
- REGISTER_DOM_CLASS(ce, "DOMNameList", NULL, php_dom_namelist_class_functions, dom_namelist_class_entry);
-
- zend_hash_init(&dom_namelist_prop_handlers, 0, NULL, dom_dtor_prop_handler, 1);
- dom_register_prop_handler(&dom_namelist_prop_handlers, "length", sizeof("length")-1, dom_namelist_length_read, NULL);
- zend_hash_add_ptr(&classes, ce.name, &dom_namelist_prop_handlers);
-
- REGISTER_DOM_CLASS(ce, "DOMImplementationList", NULL, php_dom_domimplementationlist_class_functions, dom_domimplementationlist_class_entry);
-
- zend_hash_init(&dom_domimplementationlist_prop_handlers, 0, NULL, dom_dtor_prop_handler, 1);
- dom_register_prop_handler(&dom_domimplementationlist_prop_handlers, "length", sizeof("length")-1, dom_domimplementationlist_length_read, NULL);
- zend_hash_add_ptr(&classes, ce.name, &dom_domimplementationlist_prop_handlers);
-
- REGISTER_DOM_CLASS(ce, "DOMImplementationSource", NULL, php_dom_domimplementationsource_class_functions, dom_domimplementationsource_class_entry);
REGISTER_DOM_CLASS(ce, "DOMImplementation", NULL, php_dom_domimplementation_class_functions, dom_domimplementation_class_entry);
REGISTER_DOM_CLASS(ce, "DOMNode", NULL, php_dom_node_class_functions, dom_node_class_entry);
@@ -757,37 +706,6 @@ PHP_MINIT_FUNCTION(dom)
REGISTER_DOM_CLASS(ce, "DOMComment", dom_characterdata_class_entry, php_dom_comment_class_functions, dom_comment_class_entry);
zend_hash_add_ptr(&classes, ce.name, &dom_characterdata_prop_handlers);
- REGISTER_DOM_CLASS(ce, "DOMTypeinfo", NULL, php_dom_typeinfo_class_functions, dom_typeinfo_class_entry);
-
- zend_hash_init(&dom_typeinfo_prop_handlers, 0, NULL, dom_dtor_prop_handler, 1);
- dom_register_prop_handler(&dom_typeinfo_prop_handlers, "typeName", sizeof("typeName")-1, dom_typeinfo_type_name_read, NULL);
- dom_register_prop_handler(&dom_typeinfo_prop_handlers, "typeNamespace", sizeof("typeNamespace")-1, dom_typeinfo_type_namespace_read, NULL);
- zend_hash_add_ptr(&classes, ce.name, &dom_typeinfo_prop_handlers);
-
- REGISTER_DOM_CLASS(ce, "DOMUserDataHandler", NULL, php_dom_userdatahandler_class_functions, dom_userdatahandler_class_entry);
- REGISTER_DOM_CLASS(ce, "DOMDomError", NULL, php_dom_domerror_class_functions, dom_domerror_class_entry);
-
- zend_hash_init(&dom_domerror_prop_handlers, 0, NULL, dom_dtor_prop_handler, 1);
- dom_register_prop_handler(&dom_domerror_prop_handlers, "severity", sizeof("severity")-1, dom_domerror_severity_read, NULL);
- dom_register_prop_handler(&dom_domerror_prop_handlers, "message", sizeof("message")-1, dom_domerror_message_read, NULL);
- dom_register_prop_handler(&dom_domerror_prop_handlers, "type", sizeof("type")-1, dom_domerror_type_read, NULL);
- dom_register_prop_handler(&dom_domerror_prop_handlers, "relatedException", sizeof("relatedException")-1, dom_domerror_related_exception_read, NULL);
- dom_register_prop_handler(&dom_domerror_prop_handlers, "related_data", sizeof("related_data")-1, dom_domerror_related_data_read, NULL);
- dom_register_prop_handler(&dom_domerror_prop_handlers, "location", sizeof("location")-1, dom_domerror_location_read, NULL);
- zend_hash_add_ptr(&classes, ce.name, &dom_domerror_prop_handlers);
-
- REGISTER_DOM_CLASS(ce, "DOMErrorHandler", NULL, php_dom_domerrorhandler_class_functions, dom_domerrorhandler_class_entry);
- REGISTER_DOM_CLASS(ce, "DOMLocator", NULL, php_dom_domlocator_class_functions, dom_domlocator_class_entry);
-
- zend_hash_init(&dom_domlocator_prop_handlers, 0, NULL, dom_dtor_prop_handler, 1);
- dom_register_prop_handler(&dom_domlocator_prop_handlers, "lineNumber", sizeof("lineNumber")-1, dom_domlocator_line_number_read, NULL);
- dom_register_prop_handler(&dom_domlocator_prop_handlers, "columnNumber", sizeof("columnNumber")-1, dom_domlocator_column_number_read, NULL);
- dom_register_prop_handler(&dom_domlocator_prop_handlers, "offset", sizeof("offset")-1, dom_domlocator_offset_read, NULL);
- dom_register_prop_handler(&dom_domlocator_prop_handlers, "relatedNode", sizeof("relatedNode")-1, dom_domlocator_related_node_read, NULL);
- dom_register_prop_handler(&dom_domlocator_prop_handlers, "uri", sizeof("uri")-1, dom_domlocator_uri_read, NULL);
- zend_hash_add_ptr(&classes, ce.name, &dom_domlocator_prop_handlers);
-
- REGISTER_DOM_CLASS(ce, "DOMConfiguration", NULL, php_dom_domconfiguration_class_functions, dom_domconfiguration_class_entry);
REGISTER_DOM_CLASS(ce, "DOMCdataSection", dom_text_class_entry, php_dom_cdatasection_class_functions, dom_cdatasection_class_entry);
zend_hash_add_ptr(&classes, ce.name, &dom_text_prop_handlers);
@@ -834,8 +752,6 @@ PHP_MINIT_FUNCTION(dom)
zend_hash_merge(&dom_processinginstruction_prop_handlers, &dom_node_prop_handlers, dom_copy_prop_handler, 0);
zend_hash_add_ptr(&classes, ce.name, &dom_processinginstruction_prop_handlers);
- REGISTER_DOM_CLASS(ce, "DOMStringExtend", NULL, php_dom_string_extend_class_functions, dom_string_extend_class_entry);
-
#if defined(LIBXML_XPATH_ENABLED)
memcpy(&dom_xpath_object_handlers, &dom_object_handlers, sizeof(zend_object_handlers));
dom_xpath_object_handlers.offset = XtOffsetOf(dom_xpath_object, dom) + XtOffsetOf(dom_object, std);
@@ -847,6 +763,7 @@ PHP_MINIT_FUNCTION(dom)
zend_hash_init(&dom_xpath_prop_handlers, 0, NULL, dom_dtor_prop_handler, 1);
dom_register_prop_handler(&dom_xpath_prop_handlers, "document", sizeof("document")-1, dom_xpath_document_read, NULL);
+ dom_register_prop_handler(&dom_xpath_prop_handlers, "registerNodeNamespaces", sizeof("registerNodeNamespaces")-1, dom_xpath_register_node_ns_read, dom_xpath_register_node_ns_write);
zend_hash_add_ptr(&classes, ce.name, &dom_xpath_prop_handlers);
#endif
@@ -933,9 +850,6 @@ PHP_MINFO_FUNCTION(dom)
PHP_MSHUTDOWN_FUNCTION(dom) /* {{{ */
{
- zend_hash_destroy(&dom_domstringlist_prop_handlers);
- zend_hash_destroy(&dom_namelist_prop_handlers);
- zend_hash_destroy(&dom_domimplementationlist_prop_handlers);
zend_hash_destroy(&dom_document_prop_handlers);
zend_hash_destroy(&dom_node_prop_handlers);
zend_hash_destroy(&dom_namespace_node_prop_handlers);
@@ -945,9 +859,6 @@ PHP_MSHUTDOWN_FUNCTION(dom) /* {{{ */
zend_hash_destroy(&dom_attr_prop_handlers);
zend_hash_destroy(&dom_element_prop_handlers);
zend_hash_destroy(&dom_text_prop_handlers);
- zend_hash_destroy(&dom_typeinfo_prop_handlers);
- zend_hash_destroy(&dom_domerror_prop_handlers);
- zend_hash_destroy(&dom_domlocator_prop_handlers);
zend_hash_destroy(&dom_documenttype_prop_handlers);
zend_hash_destroy(&dom_notation_prop_handlers);
zend_hash_destroy(&dom_entity_prop_handlers);
@@ -1102,6 +1013,7 @@ zend_object *dom_xpath_objects_new(zend_class_entry *class_type)
dom_xpath_object *intern = zend_object_alloc(sizeof(dom_xpath_object), class_type);
intern->registered_phpfunctions = zend_new_array(0);
+ intern->register_node_ns = 1;
intern->dom.prop_handler = &dom_xpath_prop_handlers;
intern->dom.std.handlers = &dom_xpath_object_handlers;
@@ -1530,22 +1442,23 @@ xmlNsPtr dom_get_nsdecl(xmlNode *node, xmlChar *localName) {
}
/* }}} end dom_get_nsdecl */
-zval *dom_nodelist_read_dimension(zval *object, zval *offset, int type, zval *rv) /* {{{ */
+static zval *dom_nodelist_read_dimension(zend_object *object, zval *offset, int type, zval *rv) /* {{{ */
{
zval offset_copy;
if (!offset) {
+ zend_throw_error(NULL, "Cannot access node list without offset");
return NULL;
}
ZVAL_LONG(&offset_copy, zval_get_long(offset));
- zend_call_method_with_1_params(object, Z_OBJCE_P(object), NULL, "item", rv, &offset_copy);
+ zend_call_method_with_1_params(object, object->ce, NULL, "item", rv, &offset_copy);
return rv;
} /* }}} end dom_nodelist_read_dimension */
-int dom_nodelist_has_dimension(zval *object, zval *member, int check_empty)
+static int dom_nodelist_has_dimension(zend_object *object, zval *member, int check_empty)
{
zend_long offset = zval_get_long(member);
zval rv;
@@ -1553,8 +1466,11 @@ int dom_nodelist_has_dimension(zval *object, zval *member, int check_empty)
if (offset < 0) {
return 0;
} else {
- zval *length = zend_read_property(Z_OBJCE_P(object), object, "length", sizeof("length") - 1, 0, &rv);
+ zval obj;
+ zval *length;
+ ZVAL_OBJ(&obj, object);
+ length = zend_read_property(object->ce, &obj, "length", sizeof("length") - 1, 0, &rv);
return length && offset < Z_LVAL_P(length);
}
} /* }}} end dom_nodelist_has_dimension */
diff --git a/ext/dom/php_dom.h b/ext/dom/php_dom.h
index ce377b5ce7..da4d2ad01b 100644
--- a/ext/dom/php_dom.h
+++ b/ext/dom/php_dom.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -67,6 +65,7 @@ extern zend_module_entry dom_module_entry;
typedef struct _dom_xpath_object {
int registerPhpFunctions;
+ int register_node_ns;
HashTable *registered_phpfunctions;
HashTable *node_list;
dom_object dom;
@@ -125,8 +124,6 @@ xmlNode *php_dom_libxml_hash_iter(xmlHashTable *ht, int index);
xmlNode *php_dom_libxml_notation_iter(xmlHashTable *ht, int index);
zend_object_iterator *php_dom_get_iterator(zend_class_entry *ce, zval *object, int by_ref);
void dom_set_doc_classmap(php_libxml_ref_obj *document, zend_class_entry *basece, zend_class_entry *ce);
-zval *dom_nodelist_read_dimension(zval *object, zval *offset, int type, zval *rv);
-int dom_nodelist_has_dimension(zval *object, zval *member, int check_empty);
#define REGISTER_DOM_CLASS(ce, name, parent_ce, funcs, entry) \
INIT_CLASS_ENTRY(ce, name, funcs); \
@@ -143,7 +140,7 @@ entry = zend_register_internal_class_ex(&ce, parent_ce);
#define DOM_NO_ARGS() \
if (zend_parse_parameters_none() == FAILURE) { \
- return; \
+ RETURN_THROWS(); \
}
#define DOM_NOT_IMPLEMENTED() \
diff --git a/ext/dom/processinginstruction.c b/ext/dom/processinginstruction.c
index 8cd2848c51..8e250f1301 100644
--- a/ext/dom/processinginstruction.c
+++ b/ext/dom/processinginstruction.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -24,14 +22,7 @@
#include "php.h"
#if HAVE_LIBXML && HAVE_DOM
#include "php_dom.h"
-
-
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_processinginstruction_construct, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO();
-/* }}} */
+#include "dom_arginfo.h"
/*
* class DOMProcessingInstruction extends DOMNode
@@ -41,7 +32,7 @@ ZEND_END_ARG_INFO();
*/
const zend_function_entry php_dom_processinginstruction_class_functions[] = {
- PHP_ME(domprocessinginstruction, __construct, arginfo_dom_processinginstruction_construct, ZEND_ACC_PUBLIC)
+ PHP_ME(domprocessinginstruction, __construct, arginfo_class_DOMProcessingInstruction___construct, ZEND_ACC_PUBLIC)
PHP_FE_END
};
@@ -54,8 +45,8 @@ PHP_METHOD(domprocessinginstruction, __construct)
size_t name_len, value_len;
int name_valid;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "s|s", &name, &name_len, &value, &value_len) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", &name, &name_len, &value, &value_len) == FAILURE) {
+ RETURN_THROWS();
}
name_valid = xmlValidateName((xmlChar *) name, 0);
diff --git a/ext/dom/string_extend.c b/ext/dom/string_extend.c
deleted file mode 100644
index ecc29b0dd6..0000000000
--- a/ext/dom/string_extend.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
- | Copyright (c) The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Christian Stocker <chregu@php.net> |
- | Rob Richards <rrichards@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#if HAVE_LIBXML && HAVE_DOM
-#include "php_dom.h"
-
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_string_extend_find_offset16, 0, 0, 1)
- ZEND_ARG_INFO(0, offset32)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_string_extend_find_offset32, 0, 0, 1)
- ZEND_ARG_INFO(0, offset16)
-ZEND_END_ARG_INFO();
-/* }}} */
-
-/*
-* class domstringextend
-*
-* URL: https://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#i18n-methods-StringExtend
-* Since:
-*/
-
-const zend_function_entry php_dom_string_extend_class_functions[] = {
- PHP_FALIAS(findOffset16, dom_string_extend_find_offset16, arginfo_dom_string_extend_find_offset16)
- PHP_FALIAS(findOffset32, dom_string_extend_find_offset32, arginfo_dom_string_extend_find_offset32)
- PHP_FE_END
-};
-
-/* {{{ attribute protos, not implemented yet */
-
-/* {{{ proto int dom_string_extend_find_offset16(int offset32);
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#i18n-methods-StringExtend-findOffset16
-Since:
-*/
-PHP_FUNCTION(dom_string_extend_find_offset16)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_string_extend_find_offset16 */
-
-/* {{{ proto int dom_string_extend_find_offset32(int offset16);
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#i18n-methods-StringExtend-findOffset32
-Since:
-*/
-PHP_FUNCTION(dom_string_extend_find_offset32)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_string_extend_find_offset32 */
-
-/* }}} */
-
-#endif
diff --git a/ext/dom/tests/DOMAttr_ownerElement_error_001.phpt b/ext/dom/tests/DOMAttr_ownerElement_error_001.phpt
index a7766541d5..e57c3da913 100644
--- a/ext/dom/tests/DOMAttr_ownerElement_error_001.phpt
+++ b/ext/dom/tests/DOMAttr_ownerElement_error_001.phpt
@@ -19,5 +19,5 @@ var_dump($attr->ownerElement);
--EXPECTF--
Warning: Couldn't fetch DOMAttr. Node no longer exists in %s on line %d
-Notice: Undefined property: DOMAttr::$ownerElement in %s on line %d
+Warning: Undefined property: DOMAttr::$ownerElement in %s on line %d
NULL
diff --git a/ext/dom/tests/DOMCDATASection_construct_error_001.phpt b/ext/dom/tests/DOMCDATASection_construct_error_001.phpt
index 2154016142..ab7149cd87 100644
--- a/ext/dom/tests/DOMCDATASection_construct_error_001.phpt
+++ b/ext/dom/tests/DOMCDATASection_construct_error_001.phpt
@@ -7,11 +7,11 @@ Nic Rosental nicrosental@gmail.com
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
- try {
- $section = new DOMCDataSection();
- } catch (TypeError $e) {
- echo $e->getMessage();
- }
+ try {
+ $section = new DOMCDataSection();
+ } catch (TypeError $e) {
+ echo $e->getMessage();
+ }
?>
--EXPECT--
DOMCdataSection::__construct() expects exactly 1 parameter, 0 given
diff --git a/ext/dom/tests/DOMCharacterData_length_error_001.phpt b/ext/dom/tests/DOMCharacterData_length_error_001.phpt
index dd38ae2c36..34d5273be4 100644
--- a/ext/dom/tests/DOMCharacterData_length_error_001.phpt
+++ b/ext/dom/tests/DOMCharacterData_length_error_001.phpt
@@ -10,7 +10,5 @@ Jason Bouffard <jbouffard1@yahoo.com>
$character_data = new DOMCharacterData();
print $character_data->length;
?>
-===DONE===
--EXPECTF--
Warning: main(): Invalid State Error in %s
-===DONE===
diff --git a/ext/dom/tests/DOMComment_replaceData_error1.phpt b/ext/dom/tests/DOMComment_replaceData_error1.phpt
index 16ea993e34..331f482bdd 100644
--- a/ext/dom/tests/DOMComment_replaceData_error1.phpt
+++ b/ext/dom/tests/DOMComment_replaceData_error1.phpt
@@ -15,10 +15,10 @@ try {
$comment->replaceData(-1,4,'-inserted');
} catch (DOMException $e ) {
if ($e->getMessage() == 'Index Size Error'){
- echo "Throws DOMException for -ve offest\n";
+ echo "Throws DOMException for -ve offset\n";
}
}
?>
--EXPECT--
-Throws DOMException for -ve offest
+Throws DOMException for -ve offset
diff --git a/ext/dom/tests/DOMComment_replaceData_error2.phpt b/ext/dom/tests/DOMComment_replaceData_error2.phpt
index fbf59d76dc..69407ba1c0 100644
--- a/ext/dom/tests/DOMComment_replaceData_error2.phpt
+++ b/ext/dom/tests/DOMComment_replaceData_error2.phpt
@@ -15,10 +15,10 @@ try {
$comment->replaceData(999,4,'-inserted');
} catch (DOMException $e ) {
if ($e->getMessage() == 'Index Size Error'){
- echo "Throws DOMException for offest too large\n";
+ echo "Throws DOMException for offset too large\n";
}
}
?>
--EXPECT--
-Throws DOMException for offest too large
+Throws DOMException for offset too large
diff --git a/ext/dom/tests/DOMDocument_adoptNode.phpt b/ext/dom/tests/DOMDocument_adoptNode.phpt
new file mode 100644
index 0000000000..5fc8e79d9d
--- /dev/null
+++ b/ext/dom/tests/DOMDocument_adoptNode.phpt
@@ -0,0 +1,16 @@
+--TEST--
+DOMDocument::adoptNode not implemented
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+?>
+--FILE--
+<?php
+
+$dom = new DOMDocument();
+$dom->loadXML("<root />");
+
+$dom->adoptNode($dom->documentElement);
+?>
+--EXPECTF--
+Warning: DOMDocument::adoptNode(): Not yet implemented in %s
diff --git a/ext/dom/tests/DOMDocument_createAttribute_error.phpt b/ext/dom/tests/DOMDocument_createAttribute_error.phpt
index da2a967c3a..b9b310827d 100644
--- a/ext/dom/tests/DOMDocument_createAttribute_error.phpt
+++ b/ext/dom/tests/DOMDocument_createAttribute_error.phpt
@@ -1,5 +1,5 @@
--TEST--
-Test DOMDocument::createAttribute() for expected expection thrown when wrong parameter passed
+Test DOMDocument::createAttribute() for expected exception thrown when wrong parameter passed
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
@@ -7,19 +7,19 @@ Test DOMDocument::createAttribute() for expected expection thrown when wrong par
$dom = new DOMDocument();
try {
- $attr = $dom->createAttribute(0);
+ $attr = $dom->createAttribute(0);
}
catch(DOMException $e) {
- $code = $e->getCode();
- if(DOM_INVALID_CHARACTER_ERR === $code) {
- echo "PASS";
- }
- else {
- echo 'Wrong exception code';
- }
+ $code = $e->getCode();
+ if(DOM_INVALID_CHARACTER_ERR === $code) {
+ echo "PASS";
+ }
+ else {
+ echo 'Wrong exception code';
+ }
}
catch(Exception $e) {
- echo 'Wrong exception thrown';
+ echo 'Wrong exception thrown';
}
?>
diff --git a/ext/dom/tests/DOMDocument_relaxNGValidateSource_basic.phpt b/ext/dom/tests/DOMDocument_relaxNGValidateSource_basic.phpt
index fa777f8ce5..93d0a13c77 100644
--- a/ext/dom/tests/DOMDocument_relaxNGValidateSource_basic.phpt
+++ b/ext/dom/tests/DOMDocument_relaxNGValidateSource_basic.phpt
@@ -10,22 +10,22 @@ require_once('skipif.inc');
<?php
$rng = <<< RNG
<?xml version="1.0" encoding="UTF-8"?>
-<grammar ns="" xmlns="http://relaxng.org/ns/structure/1.0"
- datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
- <start>
- <element name="apple">
- <element name="pear">
- <data type="NCName"/>
- </element>
- </element>
- </start>
+<grammar ns="" xmlns="http://relaxng.org/ns/structure/1.0"
+ datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
+ <start>
+ <element name="apple">
+ <element name="pear">
+ <data type="NCName"/>
+ </element>
+ </element>
+ </start>
</grammar>
RNG;
$good_xml = <<< GOOD_XML
<?xml version="1.0"?>
-<apple>
- <pear>Pear</pear>
+<apple>
+ <pear>Pear</pear>
</apple>
GOOD_XML;
diff --git a/ext/dom/tests/DOMDocument_relaxNGValidateSource_error1.phpt b/ext/dom/tests/DOMDocument_relaxNGValidateSource_error1.phpt
index a277a30a2d..91b76344af 100644
--- a/ext/dom/tests/DOMDocument_relaxNGValidateSource_error1.phpt
+++ b/ext/dom/tests/DOMDocument_relaxNGValidateSource_error1.phpt
@@ -10,23 +10,23 @@ require_once('skipif.inc');
<?php
$rng = <<< RNG
<?xml version="1.0" encoding="UTF-8"?>
-<grammar ns="" xmlns="http://relaxng.org/ns/structure/1.0"
- datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
- <start>
- <element name="apple">
- <element name="pear">
- <data type="NCName"/>
- </element>
- </element>
- </start>
+<grammar ns="" xmlns="http://relaxng.org/ns/structure/1.0"
+ datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
+ <start>
+ <element name="apple">
+ <element name="pear">
+ <data type="NCName"/>
+ </element>
+ </element>
+ </start>
</grammar>
RNG;
$bad_xml = <<< BAD_XML
<?xml version="1.0"?>
-<apple>
- <pear>Pear</pear>
- <pear>Pear</pear>
+<apple>
+ <pear>Pear</pear>
+ <pear>Pear</pear>
</apple>
BAD_XML;
diff --git a/ext/dom/tests/DOMDocument_relaxNGValidateSource_error2.phpt b/ext/dom/tests/DOMDocument_relaxNGValidateSource_error2.phpt
index b11dc63f7e..658bc7ffca 100644
--- a/ext/dom/tests/DOMDocument_relaxNGValidateSource_error2.phpt
+++ b/ext/dom/tests/DOMDocument_relaxNGValidateSource_error2.phpt
@@ -10,10 +10,10 @@ require_once('skipif.inc');
<?php
$rng = <<< RNG
<?xml version="1.0" encoding="UTF-8"?>
-<grammar ns="" xmlns="http://relaxng.org/ns/structure/1.0"
+<grammar ns="" xmlns="http://relaxng.org/ns/structure/1.0"
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<start>
- <element name="apple">
+ <element name="apple">
</element>
</start>
</grammar>
@@ -21,7 +21,7 @@ RNG;
$xml = <<< XML
<?xml version="1.0"?>
-<apple>
+<apple>
<pear>Pear</pear>
</apple>
XML;
diff --git a/ext/dom/tests/DOMDocument_relaxNGValidate_basic.phpt b/ext/dom/tests/DOMDocument_relaxNGValidate_basic.phpt
index e4b784e376..80645f5c74 100644
--- a/ext/dom/tests/DOMDocument_relaxNGValidate_basic.phpt
+++ b/ext/dom/tests/DOMDocument_relaxNGValidate_basic.phpt
@@ -11,8 +11,8 @@ require_once('skipif.inc');
$rng = __DIR__.'/DOMDocument_relaxNGValidate_basic.rng';
$xml = <<< XML
<?xml version="1.0"?>
-<apple>
- <pear>Pear</pear>
+<apple>
+ <pear>Pear</pear>
</apple>
XML;
$doc = new DOMDocument();
diff --git a/ext/dom/tests/DOMDocument_relaxNGValidate_error1.phpt b/ext/dom/tests/DOMDocument_relaxNGValidate_error1.phpt
index ab6befa3b1..cbdab1cbd5 100644
--- a/ext/dom/tests/DOMDocument_relaxNGValidate_error1.phpt
+++ b/ext/dom/tests/DOMDocument_relaxNGValidate_error1.phpt
@@ -11,9 +11,9 @@ require_once('skipif.inc');
$rng = __DIR__.'/DOMDocument_relaxNGValidate_basic.rng';
$xml = <<< XML
<?xml version="1.0"?>
-<apple>
- <pear>Pear</pear>
- <pear>Pear</pear>
+<apple>
+ <pear>Pear</pear>
+ <pear>Pear</pear>
</apple>
XML;
$doc = new DOMDocument();
diff --git a/ext/dom/tests/DOMDocument_relaxNGValidate_error2.phpt b/ext/dom/tests/DOMDocument_relaxNGValidate_error2.phpt
index cdd6e64194..3aa6a3b318 100644
--- a/ext/dom/tests/DOMDocument_relaxNGValidate_error2.phpt
+++ b/ext/dom/tests/DOMDocument_relaxNGValidate_error2.phpt
@@ -11,9 +11,9 @@ require_once('skipif.inc');
$rng = __DIR__.'/foo.rng';
$xml = <<< XML
<?xml version="1.0"?>
-<apple>
- <pear>Pear</pear>
- <pear>Pear</pear>
+<apple>
+ <pear>Pear</pear>
+ <pear>Pear</pear>
</apple>
XML;
$doc = new DOMDocument();
diff --git a/ext/dom/tests/DOMDocument_savexml_basic.phpt b/ext/dom/tests/DOMDocument_savexml_basic.phpt
index f08fc4e582..e7f47e952c 100644
--- a/ext/dom/tests/DOMDocument_savexml_basic.phpt
+++ b/ext/dom/tests/DOMDocument_savexml_basic.phpt
@@ -13,12 +13,12 @@ require_once('skipif.inc');
$xml = <<< EOXML
<?xml version="1.0" encoding="utf-8"?>
<courses>
- <!-- Hello World! -->
- <aNode>
- <childNode>
- <childlessNode />
- </childNode>
- </aNode>
+ <!-- Hello World! -->
+ <aNode>
+ <childNode>
+ <childlessNode />
+ </childNode>
+ </aNode>
</courses>
EOXML;
@@ -34,5 +34,5 @@ var_dump($result == $dom->saveXML());
unlink($filename);
--EXPECT--
-int(151)
+int(181)
bool(true)
diff --git a/ext/dom/tests/DOMDocument_strictErrorChecking_variation.phpt b/ext/dom/tests/DOMDocument_strictErrorChecking_variation.phpt
index 3d99e0eb70..47f5579200 100644
--- a/ext/dom/tests/DOMDocument_strictErrorChecking_variation.phpt
+++ b/ext/dom/tests/DOMDocument_strictErrorChecking_variation.phpt
@@ -18,12 +18,12 @@ var_dump($doc->strictErrorChecking);
echo "Should throw DOMException when strictErrorChecking is on\n";
try {
- $attr = $doc->createAttribute(0);
+ $attr = $doc->createAttribute(0);
} catch (DOMException $e) {
- echo "GOOD. DOMException thrown\n";
- echo $e->getMessage() ."\n";
+ echo "GOOD. DOMException thrown\n";
+ echo $e->getMessage() ."\n";
} catch (Exception $e) {
- echo "OOPS. Other exception thrown\n";
+ echo "OOPS. Other exception thrown\n";
}
@@ -35,12 +35,12 @@ var_dump($doc->strictErrorChecking);
echo "Should raise PHP error because strictErrorChecking is off\n";
try {
- $attr = $doc->createAttribute(0);
+ $attr = $doc->createAttribute(0);
} catch (DOMException $e) {
- echo "OOPS. DOMException thrown\n";
- echo $e->getMessage() ."\n";
+ echo "OOPS. DOMException thrown\n";
+ echo $e->getMessage() ."\n";
} catch (Exception $e) {
- echo "OOPS. Other exception thrown\n";
+ echo "OOPS. Other exception thrown\n";
}
?>
diff --git a/ext/dom/tests/DOMImplementation_createDocumentType_basic.phpt b/ext/dom/tests/DOMImplementation_createDocumentType_basic.phpt
index 06ae48e93d..400bcce6c3 100644
--- a/ext/dom/tests/DOMImplementation_createDocumentType_basic.phpt
+++ b/ext/dom/tests/DOMImplementation_createDocumentType_basic.phpt
@@ -8,11 +8,24 @@ include('skipif.inc');
<?php
$imp = new DOMImplementation();
$doctype = $imp->createDocumentType("html",
- "-//W3C//DTD XHTML 1.0 Strict//EN",
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd");
+ "-//W3C//DTD XHTML 1.0 Strict//EN",
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd");
$doc = $imp->createDocument(null, 'html', $doctype);
echo $doc->saveHTML();
+
+$doctype = $imp->createDocumentType("html");
+$doc = $imp->createDocument(null, 'html', $doctype);
+echo $doc->saveHTML();
+
+$doctype = $imp->createDocumentType("html", "", "");
+$doc = $imp->createDocument(null, 'html', $doctype);
+echo $doc->saveHTML();
+
?>
--EXPECT--
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html></html>
+<!DOCTYPE html>
+<html></html>
+<!DOCTYPE html>
+<html></html>
diff --git a/ext/dom/tests/DOMNode_cloneNode_basic.phpt b/ext/dom/tests/DOMNode_cloneNode_basic.phpt
index 538ba968f4..9fec109a74 100644
--- a/ext/dom/tests/DOMNode_cloneNode_basic.phpt
+++ b/ext/dom/tests/DOMNode_cloneNode_basic.phpt
@@ -12,25 +12,25 @@ Simon Hughes <odbc3@hotmail.com>
$xml = <<< EOXML
<?xml version="1.0" encoding="ISO-8859-1"?>
<courses>
- <course title="one">
- <notes>
- <note>c1n1</note>
- <note>c1n2</note>
- </notes>
- </course>
- <course title="two">
- <notes>
- <note>c2n1</note>
- <note>c2n2</note>
- </notes>
- </course>
+ <course title="one">
+ <notes>
+ <note>c1n1</note>
+ <note>c1n2</note>
+ </notes>
+ </course>
+ <course title="two">
+ <notes>
+ <note>c2n1</note>
+ <note>c2n2</note>
+ </notes>
+ </course>
</courses>
EOXML;
function dumpcourse($current) {
- $title = ($current->nodeType != XML_TEXT_NODE && $current->hasAttribute('title')) ? $current->getAttribute('title'):"no title";
- echo "Course: $title:";echo(get_class($current)), "\n";
- echo "~";var_dump($current->textContent);
+ $title = ($current->nodeType != XML_TEXT_NODE && $current->hasAttribute('title')) ? $current->getAttribute('title'):"no title";
+ echo "Course: $title:";echo(get_class($current)), "\n";
+ echo "~";var_dump($current->textContent);
}
$dom = new DOMDocument();
@@ -41,10 +41,10 @@ $root = $dom->documentElement;
$children = $root->childNodes;
$len = $children->length;
for ($index = $children->length - 1; $index >=0; $index--) {
- $current = $children->item($index);
- if ($current->nodeType == XML_TEXT_NODE) {
- $noderemoved = $root->removeChild($current);
- }
+ $current = $children->item($index);
+ if ($current->nodeType == XML_TEXT_NODE) {
+ $noderemoved = $root->removeChild($current);
+ }
}
echo "Start cloneNode test\n";
@@ -68,38 +68,38 @@ $root->appendChild($cloned_first_course_false);
$children = $root->childNodes;
for ($index = 0; $index < $children->length; $index++) {
- echo "node $index\n";
- dumpcourse($children->item($index));
+ echo "node $index\n";
+ dumpcourse($children->item($index));
}
--EXPECT--
Start cloneNode test
node 0
Course: new title3:DOMElement
-~string(24) "
-
- c1n1
- c1n2
-
- "
+~string(57) "
+
+ c1n1
+ c1n2
+
+ "
node 1
Course: two:DOMElement
-~string(24) "
-
- c2n1
- c2n2
-
- "
+~string(57) "
+
+ c2n1
+ c2n2
+
+ "
node 2
Course: new title default:DOMElement
~string(0) ""
node 3
Course: new title true:DOMElement
-~string(24) "
-
- c1n1
- c1n2
-
- "
+~string(57) "
+
+ c1n1
+ c1n2
+
+ "
node 4
Course: new title false:DOMElement
~string(0) ""
diff --git a/ext/dom/tests/DOMNode_getLineNo_basic.phpt b/ext/dom/tests/DOMNode_getLineNo_basic.phpt
index 655b751355..79d3c5a700 100644
--- a/ext/dom/tests/DOMNode_getLineNo_basic.phpt
+++ b/ext/dom/tests/DOMNode_getLineNo_basic.phpt
@@ -11,7 +11,7 @@ $doc = new DOMDocument();
$doc->load($file);
$nodes = $doc->getElementsByTagName('title');
foreach($nodes as $node) {
- var_dump($node->getLineNo());
+ var_dump($node->getLineNo());
}
?>
--EXPECT--
diff --git a/ext/dom/tests/DOMNode_getNodePath_basic.phpt b/ext/dom/tests/DOMNode_getNodePath_basic.phpt
index c490e0941f..9e791939ae 100644
--- a/ext/dom/tests/DOMNode_getNodePath_basic.phpt
+++ b/ext/dom/tests/DOMNode_getNodePath_basic.phpt
@@ -11,7 +11,7 @@ $doc = new DOMDocument();
$doc->load($file);
$nodes = $doc->getElementsByTagName('title');
foreach($nodes as $node) {
- var_dump($node->getNodePath());
+ var_dump($node->getNodePath());
}
?>
--EXPECT--
diff --git a/ext/dom/tests/DOMNode_hasChildNodes_basic.phpt b/ext/dom/tests/DOMNode_hasChildNodes_basic.phpt
index cccfff9a65..b4da4a48aa 100644
--- a/ext/dom/tests/DOMNode_hasChildNodes_basic.phpt
+++ b/ext/dom/tests/DOMNode_hasChildNodes_basic.phpt
@@ -8,7 +8,7 @@ include('skipif.inc');
<?php
/* Create an XML document
- * with strcuture
+ * with structure
* <book>
* <title>This is the title</title>
* </book>
diff --git a/ext/dom/tests/DOMNode_insertBefore_error1.phpt b/ext/dom/tests/DOMNode_insertBefore_error1.phpt
index 72c1a5ba5c..4ce2ecb843 100644
--- a/ext/dom/tests/DOMNode_insertBefore_error1.phpt
+++ b/ext/dom/tests/DOMNode_insertBefore_error1.phpt
@@ -14,9 +14,9 @@ $node_in_doc1 = $doc1->createElement("foo");
$node_in_doc2 = $doc2->createElement("bar");
try {
- $node_in_doc2->insertBefore($node_in_doc1);
+ $node_in_doc2->insertBefore($node_in_doc1);
} catch(DOMException $e) {
- echo $e->getMessage();
+ echo $e->getMessage();
}
?>
diff --git a/ext/dom/tests/DOMNode_insertBefore_error2.phpt b/ext/dom/tests/DOMNode_insertBefore_error2.phpt
index e951cd237a..39d461096f 100644
--- a/ext/dom/tests/DOMNode_insertBefore_error2.phpt
+++ b/ext/dom/tests/DOMNode_insertBefore_error2.phpt
@@ -30,7 +30,7 @@ $ref_node = $dom->getElementsByTagName("book")->item(1);
try {
$parent_node->insertBefore($new_node, $ref_node);
} catch(DOMException $e) {
- echo $e->getMessage();
+ echo $e->getMessage();
}
?>
diff --git a/ext/dom/tests/DOMNode_insertBefore_error3.phpt b/ext/dom/tests/DOMNode_insertBefore_error3.phpt
index 6e5137798c..bf323a2d48 100644
--- a/ext/dom/tests/DOMNode_insertBefore_error3.phpt
+++ b/ext/dom/tests/DOMNode_insertBefore_error3.phpt
@@ -31,7 +31,7 @@ assert(!is_null($ref_node));
try {
$parent_node->insertBefore($new_node, $ref_node);
} catch(DOMException $e) {
- echo $e->getMessage();
+ echo $e->getMessage();
}
?>
diff --git a/ext/dom/tests/DOMNode_insertBefore_error4.phpt b/ext/dom/tests/DOMNode_insertBefore_error4.phpt
index 84fbcd82dd..4b20a6d804 100644
--- a/ext/dom/tests/DOMNode_insertBefore_error4.phpt
+++ b/ext/dom/tests/DOMNode_insertBefore_error4.phpt
@@ -30,7 +30,7 @@ $ref_node = $dom->createElement('newnode2');
try {
$parent_node->insertBefore($new_node, $ref_node);
} catch(DOMException $e) {
- echo $e->getMessage();
+ echo $e->getMessage();
}
?>
diff --git a/ext/dom/tests/DOMNode_insertBefore_error5.phpt b/ext/dom/tests/DOMNode_insertBefore_error5.phpt
index e9dac3a459..e50dffcb44 100644
--- a/ext/dom/tests/DOMNode_insertBefore_error5.phpt
+++ b/ext/dom/tests/DOMNode_insertBefore_error5.phpt
@@ -32,7 +32,7 @@ $dom->saveXML();
try {
$parent_node->insertBefore($new_node, $ref_node);
} catch(DOMException $e) {
- echo $e->getMessage();
+ echo $e->getMessage();
}
?>
diff --git a/ext/dom/tests/DOMNode_insertBefore_error6.phpt b/ext/dom/tests/DOMNode_insertBefore_error6.phpt
index 6027d44140..bc026f5ccb 100644
--- a/ext/dom/tests/DOMNode_insertBefore_error6.phpt
+++ b/ext/dom/tests/DOMNode_insertBefore_error6.phpt
@@ -27,7 +27,7 @@ assert($new_node !== false);
try {
$parent_node->insertBefore($new_node, $ref_node);
} catch(DOMException $e) {
- echo $e->getMessage();
+ echo $e->getMessage();
}
?>
diff --git a/ext/dom/tests/DOMNode_issamenode_basic.phpt b/ext/dom/tests/DOMNode_issamenode_basic.phpt
index 21feda8a7e..6dff0977b3 100644
--- a/ext/dom/tests/DOMNode_issamenode_basic.phpt
+++ b/ext/dom/tests/DOMNode_issamenode_basic.phpt
@@ -18,20 +18,18 @@ if(!$dom) {
$node = $dom->documentElement;
if($node->isSameNode($node))
- echo "EXPECTING SAME NODE, PASSED\n" ;
+ echo "EXPECTING SAME NODE, PASSED\n" ;
else
- echo "EXPECTING SAME NODE, FAILED\n" ;
+ echo "EXPECTING SAME NODE, FAILED\n" ;
$nodelist=$dom->getElementsByTagName('tbody') ;
if($nodelist->item(0)->isSameNode($node))
- echo "EXPECTING NOT SAME NODE, FAILED\n" ;
+ echo "EXPECTING NOT SAME NODE, FAILED\n" ;
else
- echo "EXPECTING NOT SAME NODE, PASSED\n" ;
+ echo "EXPECTING NOT SAME NODE, PASSED\n" ;
?>
-===DONE===
--EXPECT--
EXPECTING SAME NODE, PASSED
EXPECTING NOT SAME NODE, PASSED
-===DONE===
diff --git a/ext/dom/tests/DOMNode_removeChild_basic.phpt b/ext/dom/tests/DOMNode_removeChild_basic.phpt
index a4b3917d29..e9c3e13a81 100644
--- a/ext/dom/tests/DOMNode_removeChild_basic.phpt
+++ b/ext/dom/tests/DOMNode_removeChild_basic.phpt
@@ -12,25 +12,25 @@ Simon Hughes <odbc3@hotmail.com>
$xml = <<< EOXML
<?xml version="1.0" encoding="ISO-8859-1"?>
<courses>
- <course title="one">
- <notes>
- <note>c1n1</note>
- <note>c1n2</note>
- </notes>
- </course>
- <course title="two">
- <notes>
- <note>c2n1</note>
- <note>c2n2</note>
- </notes>
- </course>
+ <course title="one">
+ <notes>
+ <note>c1n1</note>
+ <note>c1n2</note>
+ </notes>
+ </course>
+ <course title="two">
+ <notes>
+ <note>c2n1</note>
+ <note>c2n2</note>
+ </notes>
+ </course>
</courses>
EOXML;
function dumpcourse($current) {
- $title = ($current->nodeType != XML_TEXT_NODE && $current->hasAttribute('title')) ? $current->getAttribute('title'):"no title";
- echo "Course: $title:";echo get_class($current), "\n";
- echo "~";var_dump($current->textContent);
+ $title = ($current->nodeType != XML_TEXT_NODE && $current->hasAttribute('title')) ? $current->getAttribute('title'):"no title";
+ echo "Course: $title:";echo get_class($current), "\n";
+ echo "~";var_dump($current->textContent);
}
$dom = new DOMDocument();
@@ -41,20 +41,20 @@ $children = $root->childNodes;
$len = $children->length;
echo "original has $len nodes\n";
for ($index = $children->length - 1; $index >=0; $index--) {
- echo "node $index\n";
- $current = $children->item($index);
- dumpcourse($current);
- if ($current->nodeType == XML_TEXT_NODE) {
- $noderemoved = $root->removeChild($current);
- }
+ echo "node $index\n";
+ $current = $children->item($index);
+ dumpcourse($current);
+ if ($current->nodeType == XML_TEXT_NODE) {
+ $noderemoved = $root->removeChild($current);
+ }
}
$children = $root->childNodes;
$len = $children->length;
echo "after text removed it now has $len nodes\n";
for ($index = 0; $index < $children->length; $index++) {
- echo "node $index\n";
- $current = $children->item($index);
- dumpcourse($current);
+ echo "node $index\n";
+ $current = $children->item($index);
+ dumpcourse($current);
}
--EXPECT--
original has 5 nodes
@@ -64,42 +64,42 @@ Course: no title:DOMText
"
node 3
Course: two:DOMElement
-~string(24) "
-
- c2n1
- c2n2
-
- "
+~string(57) "
+
+ c2n1
+ c2n2
+
+ "
node 2
Course: no title:DOMText
-~string(2) "
- "
+~string(5) "
+ "
node 1
Course: one:DOMElement
-~string(24) "
-
- c1n1
- c1n2
-
- "
+~string(57) "
+
+ c1n1
+ c1n2
+
+ "
node 0
Course: no title:DOMText
-~string(2) "
- "
+~string(5) "
+ "
after text removed it now has 2 nodes
node 0
Course: one:DOMElement
-~string(24) "
-
- c1n1
- c1n2
-
- "
+~string(57) "
+
+ c1n1
+ c1n2
+
+ "
node 1
Course: two:DOMElement
-~string(24) "
-
- c2n1
- c2n2
-
- "
+~string(57) "
+
+ c2n1
+ c2n2
+
+ "
diff --git a/ext/dom/tests/DOMText_appendData_basic.phpt b/ext/dom/tests/DOMText_appendData_basic.phpt
index 1472a955ea..bf8e666bbd 100644
--- a/ext/dom/tests/DOMText_appendData_basic.phpt
+++ b/ext/dom/tests/DOMText_appendData_basic.phpt
@@ -28,7 +28,6 @@ echo "Text Content: " . $textnode->data . "\n";
echo "\n" . $document->saveXML();
?>
-===DONE===
--EXPECT--
Text Length (one append): 4
Text Length (two appends): 8
@@ -36,5 +35,4 @@ Text Content: data><&"
<?xml version="1.0"?>
<root><text>data&gt;&lt;&amp;"</text></root>
-===DONE===
diff --git a/ext/dom/tests/bug28817.phpt b/ext/dom/tests/bug28817.phpt
index 50d81b1aa7..6d1d12a538 100644
--- a/ext/dom/tests/bug28817.phpt
+++ b/ext/dom/tests/bug28817.phpt
@@ -6,18 +6,18 @@ Bug #28817 (properties in extended class)
<?php
class z extends domDocument{
- /** variable can have name */
- public $p_array;
- public $p_variable;
+ /** variable can have name */
+ public $p_array;
+ public $p_variable;
- function __construct(){
- $this->p_array[] = 'bonus';
- $this->p_array[] = 'vir';
- $this->p_array[] = 'semper';
- $this->p_array[] = 'tiro';
+ function __construct(){
+ $this->p_array[] = 'bonus';
+ $this->p_array[] = 'vir';
+ $this->p_array[] = 'semper';
+ $this->p_array[] = 'tiro';
- $this->p_variable = 'Cessante causa cessat effectus';
- }
+ $this->p_variable = 'Cessante causa cessat effectus';
+ }
}
$z=new z();
diff --git a/ext/dom/tests/bug34276.phpt b/ext/dom/tests/bug34276.phpt
index 6959d90a92..54c832033d 100644
--- a/ext/dom/tests/bug34276.phpt
+++ b/ext/dom/tests/bug34276.phpt
@@ -11,10 +11,10 @@ $xml = <<<HERE
HERE;
function dump($elems) {
- foreach ($elems as $elem) {
- var_dump($elem->nodeName);
- dump($elem->childNodes);
- }
+ foreach ($elems as $elem) {
+ var_dump($elem->nodeName);
+ dump($elem->childNodes);
+ }
}
$dom = new DOMDocument();
diff --git a/ext/dom/tests/bug36756.phpt b/ext/dom/tests/bug36756.phpt
index 4e47b86e4b..ccf9ba5049 100644
--- a/ext/dom/tests/bug36756.phpt
+++ b/ext/dom/tests/bug36756.phpt
@@ -31,5 +31,5 @@ child
Warning: Couldn't fetch DOMElement. Node no longer exists in %sbug36756.php on line %d
-Notice: Undefined property: DOMElement::$nodeType in %sbug36756.php on line %d
+Warning: Undefined property: DOMElement::$nodeType in %s on line %d
nodeType:
diff --git a/ext/dom/tests/bug38474.phpt b/ext/dom/tests/bug38474.phpt
index 9c694c432e..6e30d0988d 100644
--- a/ext/dom/tests/bug38474.phpt
+++ b/ext/dom/tests/bug38474.phpt
@@ -9,7 +9,7 @@ if (version_compare(LIBXML_DOTTED_VERSION, "2.6.20", "<")) {
?>
--FILE--
<?php
-$xml = '<node xmlns:pre="http://foo.com/tr/pre"
+$xml = '<node xmlns:pre="http://foo.com/tr/pre"
xmlns:post="http://foo.com/tr/post"
pre:type="bar" type="foo" ><sub /></node>';
$dom = new DomDocument();
diff --git a/ext/dom/tests/bug42082.phpt b/ext/dom/tests/bug42082.phpt
index 498d8f0346..6c3bf410a0 100644
--- a/ext/dom/tests/bug42082.phpt
+++ b/ext/dom/tests/bug42082.phpt
@@ -16,7 +16,6 @@ $doc->loadXML("<element></element>");
var_dump($doc->firstChild->nodeValue, empty($doc->firstChild->nodeValue), isset($doc->firstChild->nodeValue));
var_dump(empty($doc->nodeType), empty($doc->firstChild->nodeType))
?>
-===DONE===
--EXPECT--
DOMNodeList
int(0)
@@ -27,4 +26,3 @@ bool(true)
bool(true)
bool(false)
bool(false)
-===DONE===
diff --git a/ext/dom/tests/bug47430.phpt b/ext/dom/tests/bug47430.phpt
index efce132a2e..7be332ecc1 100644
--- a/ext/dom/tests/bug47430.phpt
+++ b/ext/dom/tests/bug47430.phpt
@@ -11,7 +11,11 @@ $dom->loadXML($xml);
$elements = $dom->getElementsByTagName('i');
foreach ($elements as $i) {
- $i->previousSibling->nodeValue = '';
+ try {
+ $i->previousSibling->nodeValue = '';
+ } catch (Error $e) {
+ echo $e->getMessage(), "\n";
+ }
}
$arr = array();
@@ -20,10 +24,9 @@ $arr[0] = 'Value';
print_r($arr);
?>
---EXPECTF--
-Warning: Creating default object from empty value in %s on line %d
-
-Warning: Creating default object from empty value in %s on line %d
+--EXPECT--
+Attempt to assign property 'nodeValue' of non-object
+Attempt to assign property 'nodeValue' of non-object
Array
(
[0] => Value
diff --git a/ext/dom/tests/bug54601.phpt b/ext/dom/tests/bug54601.phpt
index 7e7ddec16e..c828ea09e0 100644
--- a/ext/dom/tests/bug54601.phpt
+++ b/ext/dom/tests/bug54601.phpt
@@ -20,10 +20,7 @@ $doc->removeChild($n);
echo get_class($n), "\n";
print $doc->saveXML();
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
DOMDocumentType
<?xml version="1.0" encoding="utf-8"?>
<set><foo>footext</foo><bar>bartext</bar></set>
-===DONE===
diff --git a/ext/dom/tests/bug55700.phpt b/ext/dom/tests/bug55700.phpt
new file mode 100644
index 0000000000..9e00beb53e
--- /dev/null
+++ b/ext/dom/tests/bug55700.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Bug #55700 (XPath namespace prefix conflict, global registerNodeNS flag)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$doc = new DOMDocument();
+$doc->loadXML('<prefix:root xmlns:prefix="urn:a" />');
+
+$xp = new DOMXPath($doc, true);
+$xp->registerNamespace('prefix', 'urn:b');
+
+echo($xp->query('//prefix:root')->length . "\n");
+
+$xp = new DOMXPath($doc, false);
+$xp->registerNamespace('prefix', 'urn:b');
+
+echo($xp->query('//prefix:root')->length . "\n");
+
+var_dump($xp->registerNodeNamespaces);
+$xp->registerNodeNamespaces = true;
+
+var_dump($xp->registerNodeNamespaces);
+
+echo($xp->query('//prefix:root')->length . "\n");
+
+var_dump($xp);
+?>
+--EXPECT--
+1
+0
+bool(false)
+bool(true)
+1
+object(DOMXPath)#4 (2) {
+ ["document"]=>
+ string(22) "(object value omitted)"
+ ["registerNodeNamespaces"]=>
+ bool(true)
+}
diff --git a/ext/dom/tests/bug65196.phpt b/ext/dom/tests/bug65196.phpt
index c77f97222f..bb70a665bb 100644
--- a/ext/dom/tests/bug65196.phpt
+++ b/ext/dom/tests/bug65196.phpt
@@ -19,8 +19,6 @@ $frag2->appendChild($dom->createElement('div'));
$frag2->appendChild($dom->createElement('div'));
var_dump($dom->saveHTML($frag2));
?>
-===DONE===
--EXPECT--
string(0) ""
string(46) "<div><span></span></div><div></div><div></div>"
-===DONE===
diff --git a/ext/dom/tests/bug67081.phpt b/ext/dom/tests/bug67081.phpt
index faf7f42b2c..b541df1b41 100644
--- a/ext/dom/tests/bug67081.phpt
+++ b/ext/dom/tests/bug67081.phpt
@@ -6,27 +6,26 @@ require_once('skipif.inc');
?>
--FILE--
<?php
- $domDocument = new DOMDocument();
- $domDocument->substituteEntities = true;
- $domDocument->load(__DIR__ . DIRECTORY_SEPARATOR . "bug67081_0.xml");
- var_dump($domDocument->doctype->internalSubset);
+ $domDocument = new DOMDocument();
+ $domDocument->substituteEntities = true;
+ $domDocument->load(__DIR__ . DIRECTORY_SEPARATOR . "bug67081_0.xml");
+ var_dump($domDocument->doctype->internalSubset);
- $domDocument = new DOMDocument();
- $domDocument->substituteEntities = true;
- $domDocument->load(__DIR__ . DIRECTORY_SEPARATOR . "bug67081_1.xml");
- var_dump($domDocument->doctype->internalSubset);
+ $domDocument = new DOMDocument();
+ $domDocument->substituteEntities = true;
+ $domDocument->load(__DIR__ . DIRECTORY_SEPARATOR . "bug67081_1.xml");
+ var_dump($domDocument->doctype->internalSubset);
- $domDocument = new DOMDocument();
- $domDocument->substituteEntities = true;
- $domDocument->load(__DIR__ . DIRECTORY_SEPARATOR . "bug67081_2.xml");
- var_dump($domDocument->doctype->internalSubset);
+ $domDocument = new DOMDocument();
+ $domDocument->substituteEntities = true;
+ $domDocument->load(__DIR__ . DIRECTORY_SEPARATOR . "bug67081_2.xml");
+ var_dump($domDocument->doctype->internalSubset);
- $domDocument = new DOMDocument();
- $domDocument->substituteEntities = true;
- $domDocument->load(__DIR__ . DIRECTORY_SEPARATOR . "dom.xml");
- var_dump($domDocument->doctype->internalSubset);
+ $domDocument = new DOMDocument();
+ $domDocument->substituteEntities = true;
+ $domDocument->load(__DIR__ . DIRECTORY_SEPARATOR . "dom.xml");
+ var_dump($domDocument->doctype->internalSubset);
?>
-===DONE===
--EXPECT--
string(19) "<!ELEMENT a EMPTY>
"
@@ -44,4 +43,3 @@ string(277) "<!ENTITY % incent SYSTEM "dom.ent">
<!ELEMENT root (foo)+>
<!ATTLIST th title CDATA #IMPLIED>
"
-===DONE===
diff --git a/ext/dom/tests/bug67949.phpt b/ext/dom/tests/bug67949.phpt
index dd27352e6c..c49f0e4e0e 100644
--- a/ext/dom/tests/bug67949.phpt
+++ b/ext/dom/tests/bug67949.phpt
@@ -42,7 +42,11 @@ var_dump(isset($nodes[$offset]), $nodes[$offset]->textContent);
var_dump($offset);
echo "testing read_dimension with null offset\n";
-var_dump($nodes[][] = 1);
+try {
+ var_dump($nodes[][] = 1);
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
echo "testing attribute access\n";
$anchor = $doc->getElementsByTagName('a')[0];
@@ -58,7 +62,7 @@ bool(false)
testing property access
string(4) "data"
-Notice: Trying to get property 'textContent' of non-object in %s on line %d
+Warning: Trying to get property 'textContent' of non-object in %s on line %d
NULL
testing offset not a long
array(1) {
@@ -66,7 +70,7 @@ array(1) {
string(4) "test"
}
-Notice: Trying to get property 'textContent' of non-object in %s on line %d
+Warning: Trying to get property 'textContent' of non-object in %s on line %d
bool(false)
NULL
array(1) {
@@ -82,7 +86,7 @@ bool(true)
string(4) "data"
string(4) "test"
testing read_dimension with null offset
-NULL
+Cannot access node list without offset
testing attribute access
string(4) "href"
==DONE==
diff --git a/ext/dom/tests/bug69373.phpt b/ext/dom/tests/bug69373.phpt
index ce4510082e..4cb929d1ca 100644
--- a/ext/dom/tests/bug69373.phpt
+++ b/ext/dom/tests/bug69373.phpt
@@ -6,10 +6,10 @@ Bug #69373 References to deleted XPath query results
<?php
$doc = new DOMDocument();
for( $i=0; $i<20; $i++ ) {
- $doc->loadXML("<parent><child /><child /></parent>");
- $xpath = new DOMXpath($doc);
- $all = $xpath->query('//*');
- $doc->firstChild->nodeValue = '';
+ $doc->loadXML("<parent><child /><child /></parent>");
+ $xpath = new DOMXpath($doc);
+ $all = $xpath->query('//*');
+ $doc->firstChild->nodeValue = '';
}
echo 'DONE', PHP_EOL;
?>
diff --git a/ext/dom/tests/bug69846.phpt b/ext/dom/tests/bug69846.phpt
index fcca4c06d6..8e0243e24d 100644
--- a/ext/dom/tests/bug69846.phpt
+++ b/ext/dom/tests/bug69846.phpt
@@ -28,7 +28,6 @@ foreach ($dataNodes AS $node) {
}
?>
-===DONE===
--EXPECTF--
int(3)
object(DOMText)#%d (19) {
@@ -165,4 +164,3 @@ object(DOMText)#%d (19) {
string(1) "
"
}
-===DONE===
diff --git a/ext/dom/tests/bug70558.phpt b/ext/dom/tests/bug70558.phpt
index c2d53d893d..9ad8fa0596 100644
--- a/ext/dom/tests/bug70558.phpt
+++ b/ext/dom/tests/bug70558.phpt
@@ -7,9 +7,9 @@ Bug #70558 ("Couldn't fetch" error in DOMDocument::registerNodeClass())
class X extends \DOMDocument {
- public function __clone() {
- var_dump($this->registerNodeClass('DOMDocument', 'X'));
- }
+ public function __clone() {
+ var_dump($this->registerNodeClass('DOMDocument', 'X'));
+ }
}
$dom = clone (new X());
diff --git a/ext/dom/tests/bug74416.phpt b/ext/dom/tests/bug74416.phpt
index c96a927c2e..f6da96656a 100644
--- a/ext/dom/tests/bug74416.phpt
+++ b/ext/dom/tests/bug74416.phpt
@@ -12,9 +12,7 @@ foreach ($rm->getParameters() as $param) {
printf("Parameter #%d %s OPTIONAL\n", $param->getPosition(), $param->isOptional() ? "IS" : "IS NOT");
}
?>
-===DONE===
--EXPECT--
1
0
Parameter #0 IS OPTIONAL
-===DONE===
diff --git a/ext/dom/tests/bug75451.phpt b/ext/dom/tests/bug75451.phpt
index dae7cde98b..a34915bb17 100644
--- a/ext/dom/tests/bug75451.phpt
+++ b/ext/dom/tests/bug75451.phpt
@@ -10,7 +10,7 @@ $dom = new DOMDocument();
$dom->loadXML('<root><child/></root>');
$xpath = new DOMXpath($dom);
foreach($xpath->query('/root/noexist') as $child) {
- var_dump($child);
+ var_dump($child);
}
?>
okey
diff --git a/ext/dom/tests/bug78025.phpt b/ext/dom/tests/bug78025.phpt
index 0a12d9f42f..4c9d481f2c 100644
--- a/ext/dom/tests/bug78025.phpt
+++ b/ext/dom/tests/bug78025.phpt
@@ -11,8 +11,6 @@ $dom = new DOMDocument;
$dom->loadHTML($htm);
var_dump($dom->doctype->name);
?>
-===DONE===
--EXPECTF--
Warning: DOMDocument::loadHTML(): htmlParseDocTypeDecl : no DOCTYPE name ! in Entity, line: 1 in %s on line %d
string(0) ""
-===DONE===
diff --git a/ext/dom/tests/dom001.phpt b/ext/dom/tests/dom001.phpt
index 910a18c628..caac79d5a3 100644
--- a/ext/dom/tests/dom001.phpt
+++ b/ext/dom/tests/dom001.phpt
@@ -113,8 +113,7 @@ Node Content: Title
Node Name: #text
Node Type: 3
Num Children: 0
-Node Content:
-
+Node Content:
Node Name: para
Node Type: 1
@@ -123,15 +122,13 @@ Num Children: 7
Node Name: #text
Node Type: 3
Num Children: 0
-Node Content:
-
+Node Content:
--------- last
Node Name: #text
Node Type: 3
Num Children: 0
-Node Content:
-
+Node Content:
--------- parent
Node Name: chapter
@@ -147,8 +144,7 @@ Node Content: Title
Node Name: #text
Node Type: 3
Num Children: 0
-Node Content:
-
+Node Content:
Node Name: para
Node Type: 1
@@ -157,8 +153,7 @@ Num Children: 7
Node Name: #text
Node Type: 3
Num Children: 0
-Node Content:
-
+Node Content:
--------- creating a new attribute
picture.gif
@@ -236,8 +231,7 @@ Node Content: Title
Node Name: #text
Node Type: 3
Num Children: 0
-Node Content:
-
+Node Content:
Node Name: para
Node Type: 1
@@ -246,8 +240,7 @@ Num Children: 7
Node Name: #text
Node Type: 3
Num Children: 0
-Node Content:
-
+Node Content:
<?xml version="1.0" standalone="yes"?>
<!DOCTYPE chapter SYSTEM "/share/sgml/Norman_Walsh/db3xml10/db3xml10.dtd" [
diff --git a/ext/dom/tests/dom002.phpt b/ext/dom/tests/dom002.phpt
index 3343a1774e..044e5eab1c 100644
--- a/ext/dom/tests/dom002.phpt
+++ b/ext/dom/tests/dom002.phpt
@@ -16,10 +16,10 @@ $xml = <<<HERE
HERE;
function dump($elems) {
- foreach ($elems as $elem) {
- var_dump($elem->nodeName);
- dump($elem->childNodes);
- }
+ foreach ($elems as $elem) {
+ var_dump($elem->nodeName);
+ dump($elem->childNodes);
+ }
}
$dom = new DOMDocument();
diff --git a/ext/dom/tests/dom003.phpt b/ext/dom/tests/dom003.phpt
index 05d23cd792..20db09d40e 100644
--- a/ext/dom/tests/dom003.phpt
+++ b/ext/dom/tests/dom003.phpt
@@ -12,11 +12,11 @@ print "--- Catch exception with try/catch\n";
try {
$rootNode->appendChild($rootNode);
} catch (domexception $e) {
- ob_start();
+ ob_start();
var_dump($e);
- $contents = ob_get_contents();
- ob_end_clean();
- echo preg_replace('/object\(DOMElement\).+\{.*?\}/s', 'DOMElement', $contents);
+ $contents = ob_get_contents();
+ ob_end_clean();
+ echo preg_replace('/object\(DOMElement\).+\{.*?\}/s', 'DOMElement', $contents);
}
print "--- Don't catch exception with try/catch\n";
$rootNode->appendChild($rootNode);
diff --git a/ext/dom/tests/dom007.phpt b/ext/dom/tests/dom007.phpt
index b0062e8e4a..2ed232a3c0 100644
--- a/ext/dom/tests/dom007.phpt
+++ b/ext/dom/tests/dom007.phpt
@@ -47,11 +47,11 @@ $length = $nots->length;
echo "Length: ".$length."\n";
foreach ($nots AS $key=>$node) {
- echo "Key $key: ".$node->nodeName." (".$node->systemId.") (".$node->publicId.")\n";
+ echo "Key $key: ".$node->nodeName." (".$node->systemId.") (".$node->publicId.")\n";
}
print "\n";
for($x=0; $x < $length; $x++) {
- echo "Index $x: ".$nots->item($x)->nodeName." (".$nots->item($x)->systemId.") (".$nots->item($x)->publicId.")\n";
+ echo "Index $x: ".$nots->item($x)->nodeName." (".$nots->item($x)->systemId.") (".$nots->item($x)->publicId.")\n";
}
echo "\n";
@@ -66,21 +66,21 @@ echo "Length: ".$length."\n";
$xkeys = array();
foreach ($ents AS $key=>$node) {
- $xkeys[] = "Key: $key Name: ".$node->nodeName."\n";
+ $xkeys[] = "Key: $key Name: ".$node->nodeName."\n";
}
sort($xkeys); // fix inconsistent output ordering (bug #61810)
foreach ($xkeys as $key => $node) {
- echo $node;
+ echo $node;
}
echo "\n";
$xkeys = array();
for($x=0; $x < $length; $x++) {
- $xkeys[] = "Index: ".$ents->item($x)->nodeName."\n";
+ $xkeys[] = "Index: ".$ents->item($x)->nodeName."\n";
}
sort($xkeys); // fix inconsistent output ordering (bug #61810)
foreach ($xkeys as $key => $node) {
- echo $node;
+ echo $node;
}
echo "\n";
diff --git a/ext/dom/tests/dom_comment_basic.phpt b/ext/dom/tests/dom_comment_basic.phpt
index e9d0f89bf8..4533fcc6e2 100644
--- a/ext/dom/tests/dom_comment_basic.phpt
+++ b/ext/dom/tests/dom_comment_basic.phpt
@@ -10,7 +10,7 @@ require_once('skipif.inc');
$xml = <<< EOXML
<?xml version="1.0" encoding="ISO-8859-1"?>
<courses>
- <!-- Hello World! -->
+ <!-- Hello World! -->
</courses>
EOXML;
@@ -21,17 +21,17 @@ var_dump($root->hasChildNodes());
$children = $root->childNodes;
for ($index = 0; $index < $children->length; $index++) {
- echo "--- child $index ---\n";
- $current = $children->item($index);
- echo get_class($current), "\n";
- var_dump($current->textContent);
+ echo "--- child $index ---\n";
+ $current = $children->item($index);
+ echo get_class($current), "\n";
+ var_dump($current->textContent);
}
--EXPECT--
bool(true)
--- child 0 ---
DOMText
-string(2) "
- "
+string(5) "
+ "
--- child 1 ---
DOMComment
string(14) " Hello World! "
diff --git a/ext/dom/tests/dom_comment_variation.phpt b/ext/dom/tests/dom_comment_variation.phpt
index 8982f34abe..713c6a73cb 100644
--- a/ext/dom/tests/dom_comment_variation.phpt
+++ b/ext/dom/tests/dom_comment_variation.phpt
@@ -18,10 +18,10 @@ var_dump($root->hasChildNodes());
$children = $root->childNodes;
for ($index = 0; $index < $children->length; $index++) {
- echo "--- child $index ---\n";
- $current = $children->item($index);
- echo get_class($current), "\n";
- var_dump($current->textContent);
+ echo "--- child $index ---\n";
+ $current = $children->item($index);
+ echo get_class($current), "\n";
+ var_dump($current->textContent);
}
--EXPECT--
bool(true)
diff --git a/ext/dom/tests/dom_set_attr_node.phpt b/ext/dom/tests/dom_set_attr_node.phpt
index 677dfa5e70..6160cd48f2 100644
--- a/ext/dom/tests/dom_set_attr_node.phpt
+++ b/ext/dom/tests/dom_set_attr_node.phpt
@@ -24,13 +24,13 @@ $dom2 = new DOMDocument();
$dom2->loadXML($xml2);
$root2 = $dom2->documentElement;
try {
- $root2->setAttributeNode($attr);
+ $root2->setAttributeNode($attr);
} catch (domexception $e) {
ob_start();
- var_dump($e);
- $contents = ob_get_contents();
- ob_end_clean();
- echo preg_replace('/object\(DOMAttr\).+\{.*?\}/s', 'DOMAttr', $contents);
+ var_dump($e);
+ $contents = ob_get_contents();
+ ob_end_clean();
+ echo preg_replace('/object\(DOMAttr\).+\{.*?\}/s', 'DOMAttr', $contents);
}
?>
diff --git a/ext/dom/tests/dom_test.inc b/ext/dom/tests/dom_test.inc
index 86b426f8f3..93264ea2aa 100644
--- a/ext/dom/tests/dom_test.inc
+++ b/ext/dom/tests/dom_test.inc
@@ -31,7 +31,11 @@ function print_node($node)
}
print "\nNum Children: " . $child_count;
if($child_count <= 1){
- print "\nNode Content: " . $node->nodeValue;
+ if (strlen(trim($node->nodeValue))) {
+ print "\nNode Content: " . $node->nodeValue;
+ } else {
+ print "\nNode Content:";
+ }
}
print "\n\n";
}
diff --git a/ext/dom/tests/dom_xinclude.phpt b/ext/dom/tests/dom_xinclude.phpt
index a698895c60..2f4bbf3e1a 100644
--- a/ext/dom/tests/dom_xinclude.phpt
+++ b/ext/dom/tests/dom_xinclude.phpt
@@ -12,7 +12,7 @@ $dom = new domdocument;
$data = file_get_contents(__DIR__."/xinclude.xml");
$reldir = str_replace(getcwd(),".",__DIR__);
if (DIRECTORY_SEPARATOR == '\\') {
- $reldir = str_replace('\\',"/", $reldir);
+ $reldir = str_replace('\\',"/", $reldir);
}
$data = str_replace('compress.zlib://ext/dom/tests/','compress.zlib://'.$reldir."/", $data);
@@ -21,7 +21,7 @@ $dom->loadXML($data);
$dom->xinclude();
print $dom->saveXML()."\n";
foreach ($dom->documentElement->childNodes as $node) {
- print $node->nodeName."\n";
+ print $node->nodeName."\n";
}
?>
--EXPECTF--
diff --git a/ext/dom/tests/domdocument_createentityreference_001.phpt b/ext/dom/tests/domdocument_createentityreference_001.phpt
index 481b47225b..b168ad9093 100644
--- a/ext/dom/tests/domdocument_createentityreference_001.phpt
+++ b/ext/dom/tests/domdocument_createentityreference_001.phpt
@@ -6,13 +6,11 @@ Clint Priest @ PhpTek09
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
- $objDoc = new DomDocument();
+ $objDoc = new DomDocument();
- $objRef = $objDoc->createEntityReference('Test');
- echo $objRef->nodeName . "\n";
+ $objRef = $objDoc->createEntityReference('Test');
+ echo $objRef->nodeName . "\n";
?>
-===DONE===
--EXPECT--
Test
-===DONE===
diff --git a/ext/dom/tests/domelement.phpt b/ext/dom/tests/domelement.phpt
index 43a6e98603..2b669f29c8 100644
--- a/ext/dom/tests/domelement.phpt
+++ b/ext/dom/tests/domelement.phpt
@@ -67,9 +67,9 @@ $node->setAttribute('idatt', 'n1');
$node->setIdAttribute('idatt', TRUE);
for ($x = 0; $x < $mylen; $x++) {
- $current = $myelements->item($x);
- $current->setAttributeNS('urn::dummyns', 'newns:idatt', 'n'.($x+2))."\n";
- $current->setIdAttributeNS('urn::dummyns', 'idatt', TRUE);
+ $current = $myelements->item($x);
+ $current->setAttributeNS('urn::dummyns', 'newns:idatt', 'n'.($x+2))."\n";
+ $current->setIdAttributeNS('urn::dummyns', 'idatt', TRUE);
}
echo 'Element Name: '.(($elem = $dom->getElementByID('n1'))?$elem->localName:'Not Found')."\n";
@@ -79,8 +79,8 @@ echo 'Element Name: '.(($elem = $dom->getElementByID('n1'))?$elem->localName:'No
echo 'Element Name: '.(($elem = $dom->getElementByID('n3'))?$elem->nodeName:'Not Found')."\n";
for ($x = 0; $x < $mylen; $x++) {
- $node = $myelements->item($x);
- $node->setIdAttributeNS('urn::dummyns', 'idatt', FALSE);
+ $node = $myelements->item($x);
+ $node->setIdAttributeNS('urn::dummyns', 'idatt', FALSE);
}
echo 'Element Name: '.(($elem = $dom->getElementByID('n3'))?$elem->nodeName:'Not Found')."\n";
?>
diff --git a/ext/dom/tests/domobject_debug_handler.phpt b/ext/dom/tests/domobject_debug_handler.phpt
index 57d4a66ebb..d2834e815c 100644
--- a/ext/dom/tests/domobject_debug_handler.phpt
+++ b/ext/dom/tests/domobject_debug_handler.phpt
@@ -6,7 +6,7 @@ Objects of DOM extension: debug info object handler.
<?php
$xml = <<<XML
<foo>
- <bar>foobar</bar>
+ <bar>foobar</bar>
</foo>
XML;
$d = new domdocument;
@@ -55,6 +55,6 @@ DOMDocument Object
[localName] =>
[baseURI] => %s
[textContent] =>
- foobar
+ foobar
)
diff --git a/ext/dom/tests/domxpath.phpt b/ext/dom/tests/domxpath.phpt
index da91142ef5..f67b2584aa 100644
--- a/ext/dom/tests/domxpath.phpt
+++ b/ext/dom/tests/domxpath.phpt
@@ -7,17 +7,17 @@ DOMXPath Tests
require_once("dom_test.inc");
function MyAverage($nodelist) {
- $count = 0;
- $val = 0;
- foreach ($nodelist AS $node) {
- $count++;
- $val += $node->textContent;
- }
- if ($val > 0) {
- return $val/$count;
- } else {
- return 0;
- }
+ $count = 0;
+ $val = 0;
+ foreach ($nodelist AS $node) {
+ $count++;
+ $val += $node->textContent;
+ }
+ if ($val > 0) {
+ return $val/$count;
+ } else {
+ return 0;
+ }
}
$dom = new DOMDocument;
@@ -31,7 +31,7 @@ $xpath->registerNamespace("php", "http://php.net/xpath");
$xpath->registerNamespace("def", "urn::default");
$nodelist = $xpath->query("//def:child");
if ($node = $nodelist->item(0)) {
- print $node->textContent."\n";
+ print $node->textContent."\n";
}
$count = $xpath->evaluate("count(//def:child)");
diff --git a/ext/dom/text.c b/ext/dom/text.c
index 168d06d8f4..a20097a36e 100644
--- a/ext/dom/text.c
+++ b/ext/dom/text.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -25,23 +23,7 @@
#if HAVE_LIBXML && HAVE_DOM
#include "php_dom.h"
#include "dom_ce.h"
-
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_text_split_text, 0, 0, 1)
- ZEND_ARG_INFO(0, offset)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_text_is_whitespace_in_element_content, 0, 0, 0)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_text_replace_whole_text, 0, 0, 1)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_text_construct, 0, 0, 0)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO();
-/* }}} */
+#include "dom_arginfo.h"
/*
* class DOMText extends DOMCharacterData
@@ -51,11 +33,10 @@ ZEND_END_ARG_INFO();
*/
const zend_function_entry php_dom_text_class_functions[] = {
- PHP_FALIAS(splitText, dom_text_split_text, arginfo_dom_text_split_text)
- PHP_FALIAS(isWhitespaceInElementContent, dom_text_is_whitespace_in_element_content, arginfo_dom_text_is_whitespace_in_element_content)
- PHP_FALIAS(isElementContentWhitespace, dom_text_is_whitespace_in_element_content, arginfo_dom_text_is_whitespace_in_element_content)
- PHP_FALIAS(replaceWholeText, dom_text_replace_whole_text, arginfo_dom_text_replace_whole_text)
- PHP_ME(domtext, __construct, arginfo_dom_text_construct, ZEND_ACC_PUBLIC)
+ PHP_ME(domtext, splitText, arginfo_class_DOMText_splitText, ZEND_ACC_PUBLIC)
+ PHP_ME(domtext, isWhitespaceInElementContent, arginfo_class_DOMText_isWhitespaceInElementContent, ZEND_ACC_PUBLIC)
+ PHP_MALIAS(domtext, isElementContentWhitespace, isWhitespaceInElementContent, arginfo_class_DOMText_isElementContentWhitespace, ZEND_ACC_PUBLIC)
+ PHP_ME(domtext, __construct, arginfo_class_DOMText___construct, ZEND_ACC_PUBLIC)
PHP_FE_END
};
@@ -67,8 +48,8 @@ PHP_METHOD(domtext, __construct)
char *value = NULL;
size_t value_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "|s", &value, &value_len) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &value, &value_len) == FAILURE) {
+ RETURN_THROWS();
}
nodep = xmlNewText((xmlChar *) value);
@@ -133,7 +114,7 @@ int dom_text_whole_text_read(dom_object *obj, zval *retval)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-38853C1D
Since:
*/
-PHP_FUNCTION(dom_text_split_text)
+PHP_METHOD(domtext, splitText)
{
zval *id;
xmlChar *cur;
@@ -147,7 +128,7 @@ PHP_FUNCTION(dom_text_split_text)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &offset) == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(node, id, xmlNodePtr, intern);
@@ -195,7 +176,7 @@ PHP_FUNCTION(dom_text_split_text)
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Text3-isWhitespaceInElementContent
Since: DOM Level 3
*/
-PHP_FUNCTION(dom_text_is_whitespace_in_element_content)
+PHP_METHOD(domtext, isWhitespaceInElementContent)
{
zval *id;
xmlNodePtr node;
@@ -203,7 +184,7 @@ PHP_FUNCTION(dom_text_is_whitespace_in_element_content)
id = ZEND_THIS;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
DOM_GET_OBJ(node, id, xmlNodePtr, intern);
@@ -215,14 +196,4 @@ PHP_FUNCTION(dom_text_is_whitespace_in_element_content)
}
/* }}} end dom_text_is_whitespace_in_element_content */
-/* {{{ proto DOMText dom_text_replace_whole_text(string content)
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Text3-replaceWholeText
-Since: DOM Level 3
-*/
-PHP_FUNCTION(dom_text_replace_whole_text)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_text_replace_whole_text */
-
#endif
diff --git a/ext/dom/typeinfo.c b/ext/dom/typeinfo.c
deleted file mode 100644
index 2d918c2007..0000000000
--- a/ext/dom/typeinfo.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
- | Copyright (c) The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Christian Stocker <chregu@php.net> |
- | Rob Richards <rrichards@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#if HAVE_LIBXML && HAVE_DOM
-#include "php_dom.h"
-
-
-/*
-* class domtypeinfo
-*
-* URL: https://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#TypeInfo
-* Since: DOM Level 3
-*/
-
-const zend_function_entry php_dom_typeinfo_class_functions[] = {
- PHP_FE_END
-};
-
-/* {{{ attribute protos, not implemented yet */
-
-/* {{{ type_name string
-readonly=yes
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#TypeInfo-typeName
-Since:
-*/
-int dom_typeinfo_type_name_read(dom_object *obj, zval *retval)
-{
- ZVAL_NULL(retval);
- return SUCCESS;
-}
-
-/* }}} */
-
-/* {{{ type_namespace string
-readonly=yes
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#TypeInfo-typeNamespace
-Since:
-*/
-int dom_typeinfo_type_namespace_read(dom_object *obj, zval *retval)
-{
- ZVAL_NULL(retval);
- return SUCCESS;
-}
-
-/* }}} */
-
-/* }}} */
-
-#endif
diff --git a/ext/dom/userdatahandler.c b/ext/dom/userdatahandler.c
deleted file mode 100644
index 6695d65c15..0000000000
--- a/ext/dom/userdatahandler.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
- | Copyright (c) The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Christian Stocker <chregu@php.net> |
- | Rob Richards <rrichards@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#if HAVE_LIBXML && HAVE_DOM
-#include "php_dom.h"
-
-
-/*
-* class domuserdatahandler
-*
-* URL: https://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#UserDataHandler
-* Since: DOM Level 3
-*/
-
-const zend_function_entry php_dom_userdatahandler_class_functions[] = {
- PHP_FALIAS(handle, dom_userdatahandler_handle, NULL)
- PHP_FE_END
-};
-
-/* {{{ attribute protos, not implemented yet */
-
-/* {{{ proto dom_void dom_userdatahandler_handle(short operation, string key, domobject data, node src, node dst);
-URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#ID-handleUserDataEvent
-Since:
-*/
-PHP_FUNCTION(dom_userdatahandler_handle)
-{
- DOM_NOT_IMPLEMENTED();
-}
-/* }}} end dom_userdatahandler_handle */
-
-/* }}} */
-
-#endif
diff --git a/ext/dom/xml_common.h b/ext/dom/xml_common.h
index 6f51fecace..d239b85b63 100644
--- a/ext/dom/xml_common.h
+++ b/ext/dom/xml_common.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/dom/xpath.c b/ext/dom/xpath.c
index 69fdcb947f..63b0326596 100644
--- a/ext/dom/xpath.c
+++ b/ext/dom/xpath.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -24,6 +22,7 @@
#include "php.h"
#if HAVE_LIBXML && HAVE_DOM
#include "php_dom.h"
+#include "dom_arginfo.h"
#define PHP_DOM_XPATH_QUERY 0
#define PHP_DOM_XPATH_EVALUATE 1
@@ -34,38 +33,12 @@
#if defined(LIBXML_XPATH_ENABLED)
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_xpath_construct, 0, 0, 1)
- ZEND_ARG_OBJ_INFO(0, doc, DOMDocument, 0)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_xpath_register_ns, 0, 0, 2)
- ZEND_ARG_INFO(0, prefix)
- ZEND_ARG_INFO(0, uri)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_xpath_query, 0, 0, 1)
- ZEND_ARG_INFO(0, expr)
- ZEND_ARG_OBJ_INFO(0, context, DOMNode, 1)
- ZEND_ARG_INFO(0, registerNodeNS)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_xpath_evaluate, 0, 0, 1)
- ZEND_ARG_INFO(0, expr)
- ZEND_ARG_OBJ_INFO(0, context, DOMNode, 1)
- ZEND_ARG_INFO(0, registerNodeNS)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_xpath_register_php_functions, 0, 0, 0)
-ZEND_END_ARG_INFO();
-/* }}} */
-
const zend_function_entry php_dom_xpath_class_functions[] = {
- PHP_ME(domxpath, __construct, arginfo_dom_xpath_construct, ZEND_ACC_PUBLIC)
- PHP_FALIAS(registerNamespace, dom_xpath_register_ns, arginfo_dom_xpath_register_ns)
- PHP_FALIAS(query, dom_xpath_query, arginfo_dom_xpath_query)
- PHP_FALIAS(evaluate, dom_xpath_evaluate, arginfo_dom_xpath_evaluate)
- PHP_FALIAS(registerPhpFunctions, dom_xpath_register_php_functions, arginfo_dom_xpath_register_php_functions)
+ PHP_ME(domxpath, __construct, arginfo_class_DOMXPath___construct, ZEND_ACC_PUBLIC)
+ PHP_ME(domxpath, registerNamespace, arginfo_class_DOMXPath_registerNamespace, ZEND_ACC_PUBLIC)
+ PHP_ME(domxpath, query, arginfo_class_DOMXPath_query, ZEND_ACC_PUBLIC)
+ PHP_ME(domxpath, evaluate, arginfo_class_DOMXPath_evaluate, ZEND_ACC_PUBLIC)
+ PHP_ME(domxpath, registerPhpFunctions, arginfo_class_DOMXPath_registerPhpFunctions, ZEND_ACC_PUBLIC)
PHP_FE_END
};
@@ -251,13 +224,14 @@ static void dom_xpath_ext_function_object_php(xmlXPathParserContextPtr ctxt, int
PHP_METHOD(domxpath, __construct)
{
zval *doc;
+ zend_bool register_node_ns = 1;
xmlDocPtr docp = NULL;
dom_object *docobj;
dom_xpath_object *intern;
xmlXPathContextPtr ctx, oldctx;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "O", &doc, dom_document_class_entry) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O|b", &doc, dom_document_class_entry, &register_node_ns) == FAILURE) {
+ RETURN_THROWS();
}
DOM_GET_OBJ(docp, doc, xmlDocPtr, docobj);
@@ -286,6 +260,7 @@ PHP_METHOD(domxpath, __construct)
intern->dom.ptr = ctx;
ctx->userData = (void *)intern;
intern->dom.document = docobj->document;
+ intern->register_node_ns = register_node_ns;
php_libxml_increment_doc_ref((php_libxml_node_object *) &intern->dom, docp);
}
}
@@ -306,8 +281,28 @@ int dom_xpath_document_read(dom_object *obj, zval *retval)
}
/* }}} */
+/* {{{ registerNodeNamespaces bool*/
+static inline dom_xpath_object *php_xpath_obj_from_dom_obj(dom_object *obj) {
+ return (dom_xpath_object*)((char*)(obj) - XtOffsetOf(dom_xpath_object, dom));
+}
+
+int dom_xpath_register_node_ns_read(dom_object *obj, zval *retval)
+{
+ ZVAL_BOOL(retval, php_xpath_obj_from_dom_obj(obj)->register_node_ns);
+
+ return SUCCESS;
+}
+
+int dom_xpath_register_node_ns_write(dom_object *obj, zval *newval)
+{
+ php_xpath_obj_from_dom_obj(obj)->register_node_ns = zend_is_true(newval);
+
+ return SUCCESS;
+}
+/* }}} */
+
/* {{{ proto bool dom_xpath_register_ns(string prefix, string uri) */
-PHP_FUNCTION(dom_xpath_register_ns)
+PHP_METHOD(domxpath, registerNamespace)
{
zval *id;
xmlXPathContextPtr ctxp;
@@ -317,7 +312,7 @@ PHP_FUNCTION(dom_xpath_register_ns)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &prefix, &prefix_len, &ns_uri, &ns_uri_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern = Z_XPATHOBJ_P(id);
@@ -329,7 +324,7 @@ PHP_FUNCTION(dom_xpath_register_ns)
}
if (xmlXPathRegisterNs(ctxp, prefix, ns_uri) != 0) {
- RETURN_FALSE
+ RETURN_FALSE;
}
RETURN_TRUE;
}
@@ -356,15 +351,16 @@ static void php_xpath_eval(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */
char *expr;
xmlDoc *docp = NULL;
xmlNsPtr *ns = NULL;
- zend_bool register_node_ns = 1;
+ zend_bool register_node_ns;
id = ZEND_THIS;
+ intern = Z_XPATHOBJ_P(id);
+ register_node_ns = intern->register_node_ns;
+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|O!b", &expr, &expr_len, &context, dom_node_class_entry, &register_node_ns) == FAILURE) {
- return;
+ RETURN_THROWS();
}
- intern = Z_XPATHOBJ_P(id);
-
ctxp = (xmlXPathContextPtr) intern->dom.ptr;
if (ctxp == NULL) {
php_error_docref(NULL, E_WARNING, "Invalid XPath Context");
@@ -491,21 +487,21 @@ static void php_xpath_eval(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */
/* }}} */
/* {{{ proto DOMNodeList dom_xpath_query(string expr [,DOMNode context [, bool registerNodeNS]]) */
-PHP_FUNCTION(dom_xpath_query)
+PHP_METHOD(domxpath, query)
{
php_xpath_eval(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_DOM_XPATH_QUERY);
}
/* }}} end dom_xpath_query */
/* {{{ proto mixed dom_xpath_evaluate(string expr [,DOMNode context [, bool registerNodeNS]]) */
-PHP_FUNCTION(dom_xpath_evaluate)
+PHP_METHOD(domxpath, evaluate)
{
php_xpath_eval(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_DOM_XPATH_EVALUATE);
}
/* }}} end dom_xpath_evaluate */
/* {{{ proto void dom_xpath_register_php_functions() */
-PHP_FUNCTION(dom_xpath_register_php_functions)
+PHP_METHOD(domxpath, registerPhpFunctions)
{
zval *id;
dom_xpath_object *intern;
diff --git a/ext/enchant/enchant.c b/ext/enchant/enchant.c
index 1bbbe2e453..9d12c9341f 100644
--- a/ext/enchant/enchant.c
+++ b/ext/enchant/enchant.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
@@ -26,6 +24,7 @@
#include "ext/standard/info.h"
#include <enchant.h>
#include "php_enchant.h"
+#include "enchant_arginfo.h"
typedef EnchantBroker * EnchantBrokerPtr;
typedef struct _broker_struct enchant_broker;
@@ -59,63 +58,6 @@ static int le_enchant_dict;
#define PHP_ENCHANT_MYSPELL 1
#define PHP_ENCHANT_ISPELL 2
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO(arginfo_enchant_broker_init, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_enchant_broker_free, 0, 0, 1)
- ZEND_ARG_INFO(0, broker)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_enchant_broker_set_dict_path, 0, 0, 3)
- ZEND_ARG_INFO(0, broker)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_enchant_broker_get_dict_path, 0, 0, 2)
- ZEND_ARG_INFO(0, broker)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_enchant_broker_request_dict, 0, 0, 2)
- ZEND_ARG_INFO(0, broker)
- ZEND_ARG_INFO(0, tag)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_enchant_broker_request_pwl_dict, 0, 0, 2)
- ZEND_ARG_INFO(0, broker)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_enchant_broker_free_dict, 0, 0, 1)
- ZEND_ARG_INFO(0, dict)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_enchant_broker_set_ordering, 0, 0, 3)
- ZEND_ARG_INFO(0, broker)
- ZEND_ARG_INFO(0, tag)
- ZEND_ARG_INFO(0, ordering)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_enchant_dict_quick_check, 0, 0, 2)
- ZEND_ARG_INFO(0, dict)
- ZEND_ARG_INFO(0, word)
- ZEND_ARG_INFO(1, suggestions)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_enchant_dict_check, 0, 0, 2)
- ZEND_ARG_INFO(0, dict)
- ZEND_ARG_INFO(0, word)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_enchant_dict_store_replacement, 0, 0, 3)
- ZEND_ARG_INFO(0, dict)
- ZEND_ARG_INFO(0, mis)
- ZEND_ARG_INFO(0, cor)
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ enchant_functions[]
*
* Every user visible function must have an entry in enchant_functions[].
@@ -123,24 +65,24 @@ ZEND_END_ARG_INFO()
static const zend_function_entry enchant_functions[] = {
PHP_FE(enchant_broker_init, arginfo_enchant_broker_init)
PHP_FE(enchant_broker_free, arginfo_enchant_broker_free)
- PHP_FE(enchant_broker_get_error, arginfo_enchant_broker_free)
+ PHP_FE(enchant_broker_get_error, arginfo_enchant_broker_get_error)
PHP_FE(enchant_broker_set_dict_path, arginfo_enchant_broker_set_dict_path)
PHP_FE(enchant_broker_get_dict_path, arginfo_enchant_broker_get_dict_path)
- PHP_FE(enchant_broker_list_dicts, arginfo_enchant_broker_free)
+ PHP_FE(enchant_broker_list_dicts, arginfo_enchant_broker_list_dicts)
PHP_FE(enchant_broker_request_dict, arginfo_enchant_broker_request_dict)
PHP_FE(enchant_broker_request_pwl_dict, arginfo_enchant_broker_request_pwl_dict)
PHP_FE(enchant_broker_free_dict, arginfo_enchant_broker_free_dict)
- PHP_FE(enchant_broker_dict_exists, arginfo_enchant_broker_request_dict)
+ PHP_FE(enchant_broker_dict_exists, arginfo_enchant_broker_dict_exists)
PHP_FE(enchant_broker_set_ordering, arginfo_enchant_broker_set_ordering)
- PHP_FE(enchant_broker_describe, arginfo_enchant_broker_free)
+ PHP_FE(enchant_broker_describe, arginfo_enchant_broker_describe)
PHP_FE(enchant_dict_check, arginfo_enchant_dict_check)
- PHP_FE(enchant_dict_suggest, arginfo_enchant_dict_check)
- PHP_FE(enchant_dict_add_to_personal, arginfo_enchant_dict_check)
- PHP_FE(enchant_dict_add_to_session, arginfo_enchant_dict_check)
- PHP_FE(enchant_dict_is_in_session, arginfo_enchant_dict_check)
+ PHP_FE(enchant_dict_suggest, arginfo_enchant_dict_suggest)
+ PHP_FE(enchant_dict_add_to_personal, arginfo_enchant_dict_add_to_personal)
+ PHP_FE(enchant_dict_add_to_session, arginfo_enchant_dict_add_to_session)
+ PHP_FE(enchant_dict_is_in_session, arginfo_enchant_dict_is_in_session)
PHP_FE(enchant_dict_store_replacement, arginfo_enchant_dict_store_replacement)
- PHP_FE(enchant_dict_get_error, arginfo_enchant_broker_free_dict)
- PHP_FE(enchant_dict_describe, arginfo_enchant_broker_free_dict)
+ PHP_FE(enchant_dict_get_error, arginfo_enchant_dict_get_error)
+ PHP_FE(enchant_dict_describe, arginfo_enchant_dict_describe)
PHP_FE(enchant_dict_quick_check, arginfo_enchant_dict_quick_check)
PHP_FE_END
};
@@ -351,7 +293,7 @@ PHP_FUNCTION(enchant_broker_init)
EnchantBroker *pbroker;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
pbroker = enchant_broker_init();
@@ -370,14 +312,14 @@ PHP_FUNCTION(enchant_broker_init)
/* }}} */
/* {{{ proto bool enchant_broker_free(resource broker)
- Destroys the broker object and its dictionnaries */
+ Destroys the broker object and its dictionaries */
PHP_FUNCTION(enchant_broker_free)
{
zval *broker;
enchant_broker *pbroker;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &broker) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
PHP_ENCHANT_GET_BROKER;
@@ -395,7 +337,7 @@ PHP_FUNCTION(enchant_broker_get_error)
char *msg;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &broker) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
PHP_ENCHANT_GET_BROKER;
@@ -420,7 +362,7 @@ PHP_FUNCTION(enchant_broker_set_dict_path)
size_t value_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rls", &broker, &dict_type, &value, &value_len) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (!value_len) {
@@ -459,7 +401,7 @@ PHP_FUNCTION(enchant_broker_get_dict_path)
char *value;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &broker, &dict_type) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
PHP_ENCHANT_GET_BROKER;
@@ -514,7 +456,7 @@ PHP_FUNCTION(enchant_broker_list_dicts)
enchant_broker *pbroker;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &broker) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
PHP_ENCHANT_GET_BROKER;
@@ -537,7 +479,7 @@ PHP_FUNCTION(enchant_broker_request_dict)
int pos;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &broker, &tag, &taglen) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
PHP_ENCHANT_GET_BROKER;
@@ -585,7 +527,7 @@ PHP_FUNCTION(enchant_broker_request_pwl_dict)
int pos;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rp", &broker, &pwl, &pwllen) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (php_check_open_basedir(pwl)) {
@@ -627,7 +569,7 @@ PHP_FUNCTION(enchant_broker_free_dict)
enchant_dict *pdict;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &dict) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
PHP_ENCHANT_GET_DICT;
@@ -647,7 +589,7 @@ PHP_FUNCTION(enchant_broker_dict_exists)
enchant_broker * pbroker;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &broker, &tag, &taglen) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
PHP_ENCHANT_GET_BROKER;
@@ -673,7 +615,7 @@ PHP_FUNCTION(enchant_broker_set_ordering)
enchant_broker * pbroker;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rss", &broker, &ptag, &ptaglen, &pordering, &porderinglen) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
PHP_ENCHANT_GET_BROKER;
@@ -692,7 +634,7 @@ PHP_FUNCTION(enchant_broker_describe)
enchant_broker * pbroker;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &broker) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
PHP_ENCHANT_GET_BROKER;
@@ -712,13 +654,13 @@ PHP_FUNCTION(enchant_dict_quick_check)
enchant_dict *pdict;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|z", &dict, &word, &wordlen, &sugg) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (sugg) {
sugg = zend_try_array_init(sugg);
if (!sugg) {
- return;
+ RETURN_THROWS();
}
}
@@ -760,7 +702,7 @@ PHP_FUNCTION(enchant_dict_check)
enchant_dict *pdict;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &dict, &word, &wordlen) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
PHP_ENCHANT_GET_DICT;
@@ -782,7 +724,7 @@ PHP_FUNCTION(enchant_dict_suggest)
size_t n_sugg_st;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &dict, &word, &wordlen) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
PHP_ENCHANT_GET_DICT;
@@ -812,7 +754,7 @@ PHP_FUNCTION(enchant_dict_add_to_personal)
enchant_dict *pdict;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &dict, &word, &wordlen) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
PHP_ENCHANT_GET_DICT;
@@ -831,7 +773,7 @@ PHP_FUNCTION(enchant_dict_add_to_session)
enchant_dict *pdict;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &dict, &word, &wordlen) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
PHP_ENCHANT_GET_DICT;
@@ -850,7 +792,7 @@ PHP_FUNCTION(enchant_dict_is_in_session)
enchant_dict *pdict;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &dict, &word, &wordlen) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
PHP_ENCHANT_GET_DICT;
@@ -873,7 +815,7 @@ PHP_FUNCTION(enchant_dict_store_replacement)
enchant_dict *pdict;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rss", &dict, &mis, &mislen, &cor, &corlen) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
PHP_ENCHANT_GET_DICT;
@@ -891,7 +833,7 @@ PHP_FUNCTION(enchant_dict_get_error)
char *msg;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &dict) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
PHP_ENCHANT_GET_DICT;
@@ -913,7 +855,7 @@ PHP_FUNCTION(enchant_dict_describe)
enchant_dict *pdict;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &dict) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
PHP_ENCHANT_GET_DICT;
diff --git a/ext/enchant/enchant.stub.php b/ext/enchant/enchant.stub.php
new file mode 100644
index 0000000000..22533b9b82
--- /dev/null
+++ b/ext/enchant/enchant.stub.php
@@ -0,0 +1,73 @@
+<?php
+
+/** @return resource|false */
+function enchant_broker_init() {}
+
+/** @param resource $broker */
+function enchant_broker_free($broker): bool {}
+
+/**
+* @param resource $broker
+* @return string|false
+*/
+function enchant_broker_get_error($broker) {}
+
+/** @param resource $broker */
+function enchant_broker_set_dict_path($broker, int $name, string $value): bool {}
+
+/** @param resource $broker */
+function enchant_broker_get_dict_path($broker, int $name): string|false {}
+
+/** @param resource $broker */
+function enchant_broker_list_dicts($broker): array {}
+
+/**
+ * @param resource $broker
+ * @return resource|false
+ */
+function enchant_broker_request_dict($broker, string $tag) {}
+
+/**
+ * @param resource $broker
+ * @return resource|false
+ */
+function enchant_broker_request_pwl_dict($broker, string $filename) {}
+
+/** @param resource $dict */
+function enchant_broker_free_dict($dict): bool {}
+
+/** @param resource $broker */
+function enchant_broker_dict_exists($broker, string $tag): bool {}
+
+/** @param resource $broker */
+function enchant_broker_set_ordering($broker, string $tag, string $ordering): bool {}
+
+/** @param resource $broker */
+function enchant_broker_describe($broker): array {}
+
+/** @param resource $dict */
+function enchant_dict_quick_check($dict, string $word, &$suggestions = UNKNOWN): bool {}
+
+/** @param resource $dict */
+function enchant_dict_check($dict, string $word): bool {}
+
+/** @param resource $dict */
+function enchant_dict_suggest($dict, string $word): ?array {}
+
+/** @param resource $dict */
+function enchant_dict_add_to_personal($dict, string $word): void {}
+
+/** @param resource $dict */
+function enchant_dict_add_to_session($dict, string $word): void {}
+
+/** @param resource $dict */
+function enchant_dict_is_in_session($dict, string $word): bool {}
+
+/** @param resource $dict */
+function enchant_dict_store_replacement($dict, string $mis, string $cor): void {}
+
+/** @param resource $dict */
+function enchant_dict_get_error($dict): string|false {}
+
+/** @param resource $dict */
+function enchant_dict_describe($dict): array {}
diff --git a/ext/enchant/enchant_arginfo.h b/ext/enchant/enchant_arginfo.h
new file mode 100644
index 0000000000..dae661d197
--- /dev/null
+++ b/ext/enchant/enchant_arginfo.h
@@ -0,0 +1,93 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_enchant_broker_init, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_enchant_broker_free, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, broker)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_enchant_broker_get_error, 0, 0, 1)
+ ZEND_ARG_INFO(0, broker)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_enchant_broker_set_dict_path, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, broker)
+ ZEND_ARG_TYPE_INFO(0, name, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_enchant_broker_get_dict_path, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, broker)
+ ZEND_ARG_TYPE_INFO(0, name, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_enchant_broker_list_dicts, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_INFO(0, broker)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_enchant_broker_request_dict, 0, 0, 2)
+ ZEND_ARG_INFO(0, broker)
+ ZEND_ARG_TYPE_INFO(0, tag, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_enchant_broker_request_pwl_dict, 0, 0, 2)
+ ZEND_ARG_INFO(0, broker)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_enchant_broker_free_dict, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, dict)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_enchant_broker_dict_exists, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, broker)
+ ZEND_ARG_TYPE_INFO(0, tag, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_enchant_broker_set_ordering, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, broker)
+ ZEND_ARG_TYPE_INFO(0, tag, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, ordering, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_enchant_broker_describe arginfo_enchant_broker_list_dicts
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_enchant_dict_quick_check, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, dict)
+ ZEND_ARG_TYPE_INFO(0, word, IS_STRING, 0)
+ ZEND_ARG_INFO(1, suggestions)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_enchant_dict_check, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, dict)
+ ZEND_ARG_TYPE_INFO(0, word, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_enchant_dict_suggest, 0, 2, IS_ARRAY, 1)
+ ZEND_ARG_INFO(0, dict)
+ ZEND_ARG_TYPE_INFO(0, word, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_enchant_dict_add_to_personal, 0, 2, IS_VOID, 0)
+ ZEND_ARG_INFO(0, dict)
+ ZEND_ARG_TYPE_INFO(0, word, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_enchant_dict_add_to_session arginfo_enchant_dict_add_to_personal
+
+#define arginfo_enchant_dict_is_in_session arginfo_enchant_dict_check
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_enchant_dict_store_replacement, 0, 3, IS_VOID, 0)
+ ZEND_ARG_INFO(0, dict)
+ ZEND_ARG_TYPE_INFO(0, mis, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, cor, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_enchant_dict_get_error, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, dict)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_enchant_dict_describe, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_INFO(0, dict)
+ZEND_END_ARG_INFO()
diff --git a/ext/enchant/php_enchant.h b/ext/enchant/php_enchant.h
index 9ba21094a8..02578b4596 100644
--- a/ext/enchant/php_enchant.h
+++ b/ext/enchant/php_enchant.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
diff --git a/ext/enchant/tests/broker_describe.phpt b/ext/enchant/tests/broker_describe.phpt
index a25a77bd8e..11adb1397d 100644
--- a/ext/enchant/tests/broker_describe.phpt
+++ b/ext/enchant/tests/broker_describe.phpt
@@ -36,13 +36,13 @@ if($broker) {
if (is_array($provider)) {
echo("OK\n");
- if ((isset($provider[$counter]['name']) && isset($provider[$counter]['desc']) && isset($provider[$counter]['file']))) {
- echo("OK\n");
+ if ((isset($provider[$counter]['name']) && isset($provider[$counter]['desc']) && isset($provider[$counter]['file']))) {
+ echo("OK\n");
- } else {
- echo("failed, broker describe\n");
+ } else {
+ echo("failed, broker describe\n");
- }
+ }
} else {
echo "failed, brocker describe array \n";
}
diff --git a/ext/enchant/tests/broker_dict_exists.phpt b/ext/enchant/tests/broker_dict_exists.phpt
index 4ea4fd610e..3033c10e57 100644
--- a/ext/enchant/tests/broker_dict_exists.phpt
+++ b/ext/enchant/tests/broker_dict_exists.phpt
@@ -6,7 +6,7 @@ marcosptf - <marcosptf@yahoo.com.br>
<?php
if(!extension_loaded('enchant')) die('skip, enchant not loader');
if (!is_resource(enchant_broker_init())) {die("skip, resource dont load\n");}
-if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, dont has dictionary install in this machine! \n");}
+if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, no dictionary installed on this machine! \n");}
?>
--FILE--
<?php
diff --git a/ext/enchant/tests/broker_free_02.phpt b/ext/enchant/tests/broker_free_02.phpt
index 75ce5cb8ac..1b31c1fc37 100644
--- a/ext/enchant/tests/broker_free_02.phpt
+++ b/ext/enchant/tests/broker_free_02.phpt
@@ -6,7 +6,7 @@ marcosptf - <marcosptf@yahoo.com.br>
<?php
if(!extension_loaded('enchant')) die('skip, enchant not loader');
if(!is_resource(enchant_broker_init())) {die("skip, resource dont load\n");}
-if(!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, dont has dictionary install in this machine! \n");}
+if(!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, no dictionary installed on this machine! \n");}
?>
--FILE--
<?php
diff --git a/ext/enchant/tests/broker_free_dict.phpt b/ext/enchant/tests/broker_free_dict.phpt
index 0e18ae7cc6..f8523e5cf7 100644
--- a/ext/enchant/tests/broker_free_dict.phpt
+++ b/ext/enchant/tests/broker_free_dict.phpt
@@ -6,7 +6,7 @@ marcosptf - <marcosptf@yahoo.com.br>
<?php
if(!extension_loaded('enchant')) die('skip, enchant not loader');
if(!is_resource(enchant_broker_init())) {die("skip, resource dont load\n");}
-if(!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, dont has dictionary install in this machine! \n");}
+if(!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, no dictionary installed on this machine! \n");}
?>
--FILE--
<?php
diff --git a/ext/enchant/tests/broker_request_dict.phpt b/ext/enchant/tests/broker_request_dict.phpt
index 3cf952f869..2aa27c52b7 100644
--- a/ext/enchant/tests/broker_request_dict.phpt
+++ b/ext/enchant/tests/broker_request_dict.phpt
@@ -6,7 +6,7 @@ marcosptf - <marcosptf@yahoo.com.br>
<?php
if(!extension_loaded('enchant')) die('skip, enchant not loader');
if (!is_resource(enchant_broker_init())) {die("skip, resource dont load\n");}
-if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, dont has dictionary install in this machine! \n");}
+if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, no dictionary installed on this machine! \n");}
?>
--FILE--
<?php
diff --git a/ext/enchant/tests/broker_request_dict_01.phpt b/ext/enchant/tests/broker_request_dict_01.phpt
index 49deeaaf30..2c2905c959 100644
--- a/ext/enchant/tests/broker_request_dict_01.phpt
+++ b/ext/enchant/tests/broker_request_dict_01.phpt
@@ -6,7 +6,7 @@ marcosptf - <marcosptf@yahoo.com.br>
<?php
if(!extension_loaded('enchant')) die('skip, enchant not loader');
if (!is_resource(enchant_broker_init())) {die("skip, resource dont load\n");}
-if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, dont has dictionary install in this machine! \n");}
+if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, no dictionary installed on this machine! \n");}
?>
--FILE--
<?php
diff --git a/ext/enchant/tests/broker_set_ordering.phpt b/ext/enchant/tests/broker_set_ordering.phpt
index c3cb2072c9..56ed30bab8 100644
--- a/ext/enchant/tests/broker_set_ordering.phpt
+++ b/ext/enchant/tests/broker_set_ordering.phpt
@@ -6,7 +6,7 @@ marcosptf - <marcosptf@yahoo.com.br>
<?php
if(!extension_loaded('enchant')) die('skip, enchant not loader');
if (!is_resource(enchant_broker_init())) {die("skip, resource dont load\n");}
-if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, dont has dictionary install in this machine! \n");}
+if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, no dictionary installed on this machine! \n");}
?>
--FILE--
<?php
diff --git a/ext/enchant/tests/bug13181.phpt b/ext/enchant/tests/bug13181.phpt
index 742e0c79fe..881318cb33 100644
--- a/ext/enchant/tests/bug13181.phpt
+++ b/ext/enchant/tests/bug13181.phpt
@@ -26,8 +26,8 @@ enchant_broker_free($broker);
<?php
function get_dictionnary() {
$rBroker = enchant_broker_init();
- $t = enchant_broker_request_dict($rBroker, 'en');
- var_dump($t);
+ $t = enchant_broker_request_dict($rBroker, 'en');
+ var_dump($t);
return $t;
}
$rDict = get_dictionnary();
@@ -36,7 +36,7 @@ enchant_dict_suggest($rDict, "soong");
function get_broker() {
$t = enchant_broker_init();
- var_dump($t);
+ var_dump($t);
return $t;
}
@@ -44,8 +44,8 @@ $rbroker = get_broker();
var_dump($rbroker);
function get_dict($broker) {
- $t = enchant_broker_request_dict($broker, 'en');
- var_dump($t);
+ $t = enchant_broker_request_dict($broker, 'en');
+ var_dump($t);
return $t;
}
$rDict = get_dict($rbroker);
diff --git a/ext/enchant/tests/dict_add_to_personal.phpt b/ext/enchant/tests/dict_add_to_personal.phpt
index e711a25f45..522ae8a2d1 100644
--- a/ext/enchant/tests/dict_add_to_personal.phpt
+++ b/ext/enchant/tests/dict_add_to_personal.phpt
@@ -6,7 +6,7 @@ marcosptf - <marcosptf@yahoo.com.br>
<?php
if(!extension_loaded('enchant')) die('skip, enchant not loader');
if (!is_resource(enchant_broker_init())) {die("skip, resource dont load\n");}
-if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, dont has dictionary install in this machine! \n");}
+if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, no dictionary installed on this machine! \n");}
?>
--FILE--
<?php
@@ -30,7 +30,7 @@ if (is_resource($broker)) {
}
} else {
- echo("broker request dict failed\n");
+ echo("broker request dict failed\n");
}
diff --git a/ext/enchant/tests/dict_add_to_session.phpt b/ext/enchant/tests/dict_add_to_session.phpt
index 441d2dde74..49c4769fb5 100644
--- a/ext/enchant/tests/dict_add_to_session.phpt
+++ b/ext/enchant/tests/dict_add_to_session.phpt
@@ -6,7 +6,7 @@ marcosptf - <marcosptf@yahoo.com.br>
<?php
if(!extension_loaded('enchant')) die('skip, enchant not loader');
if (!is_resource(enchant_broker_init())) {die("skip, resource dont load\n");}
-if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, dont has dictionary install in this machine! \n");}
+if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, no dictionary installed on this machine! \n");}
?>
--FILE--
<?php
diff --git a/ext/enchant/tests/dict_check.phpt b/ext/enchant/tests/dict_check.phpt
index eb4198c4cf..b48ed47584 100644
--- a/ext/enchant/tests/dict_check.phpt
+++ b/ext/enchant/tests/dict_check.phpt
@@ -6,7 +6,7 @@ marcosptf - <marcosptf@yahoo.com.br>
<?php
if(!extension_loaded('enchant')) die('skip, enchant not loader');
if (!is_resource(enchant_broker_init())) {die("skip, resource dont load\n");}
-if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, dont has dictionary install in this machine! \n");}
+if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, no dictionary installed on this machine! \n");}
?>
--FILE--
<?php
@@ -30,7 +30,7 @@ if (is_resource($broker)) {
}
} else {
- echo("broker request dict failed\n");
+ echo("broker request dict failed\n");
}
diff --git a/ext/enchant/tests/dict_describe.phpt b/ext/enchant/tests/dict_describe.phpt
index 18cdbfe379..d63cfae178 100644
--- a/ext/enchant/tests/dict_describe.phpt
+++ b/ext/enchant/tests/dict_describe.phpt
@@ -6,7 +6,7 @@ marcosptf - <marcosptf@yahoo.com.br>
<?php
if(!extension_loaded('enchant')) die('skip, enchant not loader');
if (!is_resource(enchant_broker_init())) {die("skip, resource dont load\n");}
-if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, dont has dictionary install in this machine! \n");}
+if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, no dictionary installed on this machine! \n");}
?>
--FILE--
<?php
diff --git a/ext/enchant/tests/dict_get_error.phpt b/ext/enchant/tests/dict_get_error.phpt
index 271214a786..340dcdd89a 100644
--- a/ext/enchant/tests/dict_get_error.phpt
+++ b/ext/enchant/tests/dict_get_error.phpt
@@ -6,7 +6,7 @@ marcosptf - <marcosptf@yahoo.com.br>
<?php
if(!extension_loaded('enchant')) die('skip, enchant not loader');
if (!is_resource(enchant_broker_init())) {die("skip, resource dont load\n");}
-if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, dont has dictionary install in this machine! \n");}
+if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, no dictionary installed on this machine! \n");}
?>
--FILE--
<?php
diff --git a/ext/enchant/tests/dict_is_in_session.phpt b/ext/enchant/tests/dict_is_in_session.phpt
index 4e670d5512..12771e552e 100644
--- a/ext/enchant/tests/dict_is_in_session.phpt
+++ b/ext/enchant/tests/dict_is_in_session.phpt
@@ -6,7 +6,7 @@ marcosptf - <marcosptf@yahoo.com.br>
<?php
if(!extension_loaded('enchant')) die('skip, enchant not loader');
if (!is_resource(enchant_broker_init())) {die("skip, resource dont load\n");}
-if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, dont has dictionary install in this machine! \n");}
+if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, no dictionary installed on this machine! \n");}
?>
--FILE--
<?php
diff --git a/ext/enchant/tests/dict_quick_check.phpt b/ext/enchant/tests/dict_quick_check.phpt
index 15eb2aec38..a7196b659d 100644
--- a/ext/enchant/tests/dict_quick_check.phpt
+++ b/ext/enchant/tests/dict_quick_check.phpt
@@ -6,7 +6,7 @@ marcosptf - <marcosptf@yahoo.com.br>
<?php
if(!extension_loaded('enchant')) die('skip, enchant not loader');
if (!is_resource(enchant_broker_init())) {die("skip, resource dont load\n");}
-if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, dont has dictionary install in this machine! \n");}
+if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, no dictionary installed on this machine! \n");}
$tag = 'en_US';
$r = enchant_broker_init();
diff --git a/ext/enchant/tests/dict_quick_check_01.phpt b/ext/enchant/tests/dict_quick_check_01.phpt
index a4dd818111..b4f9b72342 100644
--- a/ext/enchant/tests/dict_quick_check_01.phpt
+++ b/ext/enchant/tests/dict_quick_check_01.phpt
@@ -6,7 +6,7 @@ marcosptf - <marcosptf@yahoo.com.br>
<?php
if(!extension_loaded('enchant')) die('skip, enchant not loader');
if (!is_resource(enchant_broker_init())) {die("skip, resource dont load\n");}
-if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, dont has dictionary install in this machine! \n");}
+if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, no dictionary installed on this machine! \n");}
?>
--FILE--
<?php
diff --git a/ext/enchant/tests/dict_store_replacement.phpt b/ext/enchant/tests/dict_store_replacement.phpt
index 8ecd7b06a0..eb01dcbc57 100644
--- a/ext/enchant/tests/dict_store_replacement.phpt
+++ b/ext/enchant/tests/dict_store_replacement.phpt
@@ -6,7 +6,7 @@ marcosptf - <marcosptf@yahoo.com.br>
<?php
if(!extension_loaded('enchant')) die('skip, enchant not loader');
if (!is_resource(enchant_broker_init())) {die("skip, resource dont load\n");}
-if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, dont has dictionary install in this machine! \n");}
+if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, no dictionary installed on this machine! \n");}
?>
--FILE--
<?php
diff --git a/ext/enchant/tests/dict_suggest.phpt b/ext/enchant/tests/dict_suggest.phpt
index 85aa823579..6854eeb65b 100644
--- a/ext/enchant/tests/dict_suggest.phpt
+++ b/ext/enchant/tests/dict_suggest.phpt
@@ -6,7 +6,7 @@ marcosptf - <marcosptf@yahoo.com.br>
<?php
if(!extension_loaded('enchant')) die('skip, enchant not loader');
if (!is_resource(enchant_broker_init())) {die("skip, resource dont load\n");}
-if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, dont has dictionary install in this machine! \n");}
+if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, no dictionary installed on this machine! \n");}
?>
--FILE--
<?php
@@ -19,7 +19,7 @@ if (is_resource($broker)) {
$requestDict = enchant_broker_request_dict($broker, $dicts[0]['lang_tag']);
if ($requestDict) {
- echo("OK\n");
+ echo("OK\n");
$dictSuggest = enchant_dict_suggest($requestDict,$sugs);
if (is_array($dictSuggest)) {
@@ -29,7 +29,7 @@ if (is_resource($broker)) {
}
} else {
- echo("broker request dict failed\n");
+ echo("broker request dict failed\n");
}
diff --git a/ext/enchant/tests/enchant_broker_set_dict_path.phpt b/ext/enchant/tests/enchant_broker_set_dict_path.phpt
index db35288a42..9c21a86336 100644
--- a/ext/enchant/tests/enchant_broker_set_dict_path.phpt
+++ b/ext/enchant/tests/enchant_broker_set_dict_path.phpt
@@ -7,7 +7,7 @@ marcosptf - <marcosptf@yahoo.com.br>
<?php
if(!extension_loaded('enchant')) die('skip, enchant not loader');
if (!is_resource(enchant_broker_init())) {die("skip, resource dont load\n");}
-if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, dont has dictionary install in this machine! \n");}
+if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, no dictionary installed on this machine! \n");}
?>
--FILE--
<?php
diff --git a/ext/exif/exif.c b/ext/exif/exif.c
index 7bdf2acf1e..a8aa9e46f0 100644
--- a/ext/exif/exif.c
+++ b/ext/exif/exif.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -42,6 +40,7 @@
#endif
#include "php_exif.h"
+#include "exif_arginfo.h"
#include <math.h>
#include "php_ini.h"
#include "ext/standard/php_string.h"
@@ -66,36 +65,10 @@ typedef unsigned char uchar;
#define MAX_IFD_NESTING_LEVEL 150
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO(arginfo_exif_tagname, 0)
- ZEND_ARG_INFO(0, index)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_exif_read_data, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, sections_needed)
- ZEND_ARG_INFO(0, sub_arrays)
- ZEND_ARG_INFO(0, read_thumbnail)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_exif_thumbnail, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(1, width)
- ZEND_ARG_INFO(1, height)
- ZEND_ARG_INFO(1, imagetype)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_exif_imagetype, 0)
- ZEND_ARG_INFO(0, imagefile)
-ZEND_END_ARG_INFO()
-
-/* }}} */
-
/* {{{ exif_functions[]
*/
static const zend_function_entry exif_functions[] = {
PHP_FE(exif_read_data, arginfo_exif_read_data)
- PHP_DEP_FALIAS(read_exif_data, exif_read_data, arginfo_exif_read_data)
PHP_FE(exif_tagname, arginfo_exif_tagname)
PHP_FE(exif_thumbnail, arginfo_exif_thumbnail)
PHP_FE(exif_imagetype, arginfo_exif_imagetype)
@@ -362,7 +335,7 @@ static char *exif_get_tagformat(int format)
#define TAG_GPS_AREA_INFORMATION 0x001C
#define TAG_GPS_DATE_STAMP 0x001D
#define TAG_GPS_DIFFERENTIAL 0x001E
-#define TAG_TIFF_COMMENT 0x00FE /* SHOUDLNT HAPPEN */
+#define TAG_TIFF_COMMENT 0x00FE /* SHOULDN'T HAPPEN */
#define TAG_NEW_SUBFILE 0x00FE /* New version of subfile tag */
#define TAG_SUBFILE_TYPE 0x00FF /* Old version of subfile tag */
#define TAG_IMAGEWIDTH 0x0100
@@ -1313,9 +1286,6 @@ typedef enum mn_byte_order_t {
typedef enum mn_offset_mode_t {
MN_OFFSET_NORMAL,
MN_OFFSET_MAKER
-#ifdef KALLE_0
- , MN_OFFSET_GUESS
-#endif
} mn_offset_mode_t;
typedef struct {
@@ -1808,6 +1778,7 @@ typedef struct {
typedef struct {
int count;
+ int alloc_count;
image_info_data *list;
} image_info_list;
/* }}} */
@@ -1928,6 +1899,7 @@ typedef struct {
typedef struct {
int count;
+ int alloc_count;
file_section *list;
} file_section_list;
@@ -2052,11 +2024,14 @@ typedef struct {
*/
static int exif_file_sections_add(image_info_type *ImageInfo, int type, size_t size, uchar *data)
{
- file_section *tmp;
- int count = ImageInfo->file.count;
+ int count = ImageInfo->file.count;
+ if (count == ImageInfo->file.alloc_count) {
+ int new_alloc_count = ImageInfo->file.alloc_count ? ImageInfo->file.alloc_count * 2 : 1;
+ ImageInfo->file.list = safe_erealloc(
+ ImageInfo->file.list, new_alloc_count, sizeof(file_section), 0);
+ ImageInfo->file.alloc_count = new_alloc_count;
+ }
- tmp = safe_erealloc(ImageInfo->file.list, (count+1), sizeof(file_section), 0);
- ImageInfo->file.list = tmp;
ImageInfo->file.list[count].type = 0xFFFF;
ImageInfo->file.list[count].data = NULL;
ImageInfo->file.list[count].size = 0;
@@ -2112,6 +2087,16 @@ static int exif_file_sections_free(image_info_type *ImageInfo)
}
/* }}} */
+static image_info_data *exif_alloc_image_info_data(image_info_list *info_list) {
+ if (info_list->count == info_list->alloc_count) {
+ int new_alloc_count = info_list->alloc_count ? info_list->alloc_count * 2 : 1;
+ info_list->list = safe_erealloc(
+ info_list->list, new_alloc_count, sizeof(image_info_data), 0);
+ info_list->alloc_count = new_alloc_count;
+ }
+ return &info_list->list[info_list->count++];
+}
+
/* {{{ exif_iif_add_value
Add a value to image_info
*/
@@ -2121,16 +2106,12 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, c
void *vptr, *vptr_end;
image_info_value *info_value;
image_info_data *info_data;
- image_info_data *list;
if (length < 0) {
return;
}
- list = safe_erealloc(image_info->info_list[section_index].list, (image_info->info_list[section_index].count+1), sizeof(image_info_data), 0);
- image_info->info_list[section_index].list = list;
-
- info_data = &image_info->info_list[section_index].list[image_info->info_list[section_index].count];
+ info_data = exif_alloc_image_info_data(&image_info->info_list[section_index]);
memset(info_data, 0, sizeof(image_info_data));
info_data->tag = tag;
info_data->format = format;
@@ -2253,7 +2234,6 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, c
}
}
image_info->sections_found |= 1<<section_index;
- image_info->info_list[section_index].count++;
}
/* }}} */
@@ -2271,20 +2251,13 @@ static void exif_iif_add_tag(image_info_type *image_info, int section_index, cha
*/
static void exif_iif_add_int(image_info_type *image_info, int section_index, char *name, int value)
{
- image_info_data *info_data;
- image_info_data *list;
-
- list = safe_erealloc(image_info->info_list[section_index].list, (image_info->info_list[section_index].count+1), sizeof(image_info_data), 0);
- image_info->info_list[section_index].list = list;
-
- info_data = &image_info->info_list[section_index].list[image_info->info_list[section_index].count];
+ image_info_data *info_data = exif_alloc_image_info_data(&image_info->info_list[section_index]);
info_data->tag = TAG_NONE;
info_data->format = TAG_FMT_SLONG;
info_data->length = 1;
info_data->name = estrdup(name);
info_data->value.i = value;
image_info->sections_found |= 1<<section_index;
- image_info->info_list[section_index].count++;
}
/* }}} */
@@ -2293,20 +2266,15 @@ static void exif_iif_add_int(image_info_type *image_info, int section_index, cha
*/
static void exif_iif_add_str(image_info_type *image_info, int section_index, char *name, char *value)
{
- image_info_data *info_data;
- image_info_data *list;
-
if (value) {
- list = safe_erealloc(image_info->info_list[section_index].list, (image_info->info_list[section_index].count+1), sizeof(image_info_data), 0);
- image_info->info_list[section_index].list = list;
- info_data = &image_info->info_list[section_index].list[image_info->info_list[section_index].count];
+ image_info_data *info_data =
+ exif_alloc_image_info_data(&image_info->info_list[section_index]);
info_data->tag = TAG_NONE;
info_data->format = TAG_FMT_STRING;
info_data->length = 1;
info_data->name = estrdup(name);
info_data->value.s = estrdup(value);
image_info->sections_found |= 1<<section_index;
- image_info->info_list[section_index].count++;
}
}
/* }}} */
@@ -2334,13 +2302,9 @@ static void exif_iif_add_fmt(image_info_type *image_info, int section_index, cha
*/
static void exif_iif_add_buffer(image_info_type *image_info, int section_index, char *name, int length, char *value)
{
- image_info_data *info_data;
- image_info_data *list;
-
if (value) {
- list = safe_erealloc(image_info->info_list[section_index].list, (image_info->info_list[section_index].count+1), sizeof(image_info_data), 0);
- image_info->info_list[section_index].list = list;
- info_data = &image_info->info_list[section_index].list[image_info->info_list[section_index].count];
+ image_info_data *info_data =
+ exif_alloc_image_info_data(&image_info->info_list[section_index]);
info_data->tag = TAG_NONE;
info_data->format = TAG_FMT_UNDEFINED;
info_data->length = length;
@@ -2349,7 +2313,6 @@ static void exif_iif_add_buffer(image_info_type *image_info, int section_index,
memcpy(info_data->value.s, value, length);
info_data->value.s[length] = 0;
image_info->sections_found |= 1<<section_index;
- image_info->info_list[section_index].count++;
}
}
/* }}} */
@@ -2412,9 +2375,6 @@ static void add_assoc_image_info(zval *value, int sub_array, image_info_type *im
image_info_data *info_data;
zval tmpi, array;
-#ifdef EXIF_DEBUG
-/* php_error_docref(NULL, E_NOTICE, "Adding %d infos from section %s", image_info->info_list[section_index].count, exif_get_sectionname(section_index));*/
-#endif
if (image_info->info_list[section_index].count) {
if (sub_array) {
array_init(&tmpi);
@@ -2432,9 +2392,7 @@ static void add_assoc_image_info(zval *value, int sub_array, image_info_type *im
snprintf(uname, sizeof(uname), "%d", unknown++);
name = uname;
}
-#ifdef EXIF_DEBUG
-/* php_error_docref(NULL, E_NOTICE, "Adding infos: tag(0x%04X,%12s,L=0x%04X): %s", info_tag, exif_get_tagname_debug(info_tag, exif_get_tag_table(section_index)), info_data->length, info_data->format==TAG_FMT_STRING?(info_value&&info_value->s?info_value->s:"<no data>"):exif_get_tagformat(info_data->format));*/
-#endif
+
if (info_data->length==0) {
add_assoc_null(&tmpi, name);
} else {
@@ -2468,8 +2426,6 @@ static void add_assoc_image_info(zval *value, int sub_array, image_info_type *im
case TAG_FMT_URATIONAL:
case TAG_FMT_SRATIONAL:
- /*case TAG_FMT_BYTE:
- case TAG_FMT_SBYTE:*/
case TAG_FMT_USHORT:
case TAG_FMT_SSHORT:
case TAG_FMT_SINGLE:
@@ -2659,28 +2615,11 @@ static void exif_process_COM (image_info_type *image_info, char *value, size_t l
* Process a SOFn marker. This is useful for the image dimensions */
static void exif_process_SOFn (uchar *Data, int marker, jpeg_sof_info *result)
{
-/* 0xFF SOSn SectLen(2) Bits(1) Height(2) Width(2) Channels(1) 3*Channels (1) */
+ /* 0xFF SOSn SectLen(2) Bits(1) Height(2) Width(2) Channels(1) 3*Channels (1) */
result->bits_per_sample = Data[2];
result->height = php_jpg_get16(Data+3);
result->width = php_jpg_get16(Data+5);
result->num_components = Data[7];
-
-/* switch (marker) {
- case M_SOF0: process = "Baseline"; break;
- case M_SOF1: process = "Extended sequential"; break;
- case M_SOF2: process = "Progressive"; break;
- case M_SOF3: process = "Lossless"; break;
- case M_SOF5: process = "Differential sequential"; break;
- case M_SOF6: process = "Differential progressive"; break;
- case M_SOF7: process = "Differential lossless"; break;
- case M_SOF9: process = "Extended sequential, arithmetic coding"; break;
- case M_SOF10: process = "Progressive, arithmetic coding"; break;
- case M_SOF11: process = "Lossless, arithmetic coding"; break;
- case M_SOF13: process = "Differential sequential, arithmetic coding"; break;
- case M_SOF14: process = "Differential progressive, arithmetic coding"; break;
- case M_SOF15: process = "Differential lossless, arithmetic coding"; break;
- default: process = "Unknown"; break;
- }*/
}
/* }}} */
@@ -2750,7 +2689,7 @@ PHP_FUNCTION(exif_tagname)
char *szTemp;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &tag) == FAILURE) {
- return;
+ RETURN_THROWS();
}
szTemp = exif_get_tagname(tag, tag_table_IFD);
@@ -3063,7 +3002,7 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
szValuePtr = szValuePtr+8;
ByteCount -= 8;
} else if (!memcmp(szValuePtr, "JIS\0\0\0\0\0", 8)) {
- /* JIS should be tanslated to MB or we leave it to the user - leave it to the user */
+ /* JIS should be translated to MB or we leave it to the user - leave it to the user */
*pszEncoding = estrdup((const char*)szValuePtr);
szValuePtr = szValuePtr+8;
ByteCount -= 8;
@@ -3129,9 +3068,6 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
size_t i;
int de, section_index = SECTION_MAKERNOTE;
int NumDirEntries, old_motorola_intel;
-#ifdef KALLE_0
- int offset_diff;
-#endif
const maker_note_type *maker_note;
char *dir_start;
int data_len;
@@ -3147,7 +3083,6 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
maker_note = maker_note_array+i;
- /*exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "check (%s)", maker_note->make?maker_note->make:"");*/
if (maker_note->make && (!ImageInfo->make || strcmp(maker_note->make, ImageInfo->make)))
continue;
if (maker_note->id_string && value_len >= maker_note->id_string_len
@@ -3190,25 +3125,6 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
offset_base = value_ptr;
data_len = value_len;
break;
-#ifdef KALLE_0
- case MN_OFFSET_GUESS:
- if (maker_note->offset + 10 + 4 >= value_len) {
- /* Can not read dir_start+10 since it's beyond value end */
- exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "IFD data too short: 0x%04X", value_len);
- return FALSE;
- }
- offset_diff = 2 + NumDirEntries*12 + 4 - php_ifd_get32u(dir_start+10, ImageInfo->motorola_intel);
-#ifdef EXIF_DEBUG
- exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Using automatic offset correction: 0x%04X", ((int)dir_start-(int)offset_base+maker_note->offset+displacement) + offset_diff);
-#endif
- if (offset_diff < 0 || offset_diff >= value_len ) {
- exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "IFD data bad offset: 0x%04X length 0x%04X", offset_diff, value_len);
- return FALSE;
- }
- offset_base = value_ptr + offset_diff;
- data_len = value_len - offset_diff;
- break;
-#endif
default:
case MN_OFFSET_NORMAL:
data_len = value_len;
@@ -3278,7 +3194,6 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
/* (-1) catches illegal zero case as unsigned underflows to positive large. */
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Process tag(x%04X=%s): Illegal format code 0x%04X, suppose BYTE", tag, exif_get_tagname_debug(tag, tag_table), format);
format = TAG_FMT_BYTE;
- /*return TRUE;*/
}
byte_count_signed = (int64_t)components * php_tiff_bytes_per_format[format];
@@ -4046,7 +3961,6 @@ static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offse
return FALSE;
}
php_stream_read(ImageInfo->infile, (char*)(ImageInfo->file.list[sn].data+2), dir_size-2);
- /*exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Dump: %s", exif_char_dump(ImageInfo->file.list[sn].data, dir_size, 0));*/
next_offset = php_ifd_get32u(ImageInfo->file.list[sn].data + dir_size - 4, ImageInfo->motorola_intel);
#ifdef EXIF_DEBUG
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Read from TIFF done, next offset x%04X", next_offset);
@@ -4385,7 +4299,6 @@ static int exif_read_from_impl(image_info_type *ImageInfo, php_stream *stream, i
/* Store file date/time. */
ImageInfo->FileDateTime = st.st_mtime;
ImageInfo->FileSize = st.st_size;
- /*exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Opened stream is file: %d", ImageInfo->FileSize);*/
}
} else {
if (!ImageInfo->FileSize) {
@@ -4478,7 +4391,7 @@ PHP_FUNCTION(exif_read_data)
ZEND_PARSE_PARAMETERS_START(1, 4)
Z_PARAM_ZVAL(stream)
Z_PARAM_OPTIONAL
- Z_PARAM_STR(z_sections_needed)
+ Z_PARAM_STR_EX(z_sections_needed, 1, 0)
Z_PARAM_BOOL(sub_arrays)
Z_PARAM_BOOL(read_thumbnail)
ZEND_PARSE_PARAMETERS_END();
@@ -4521,7 +4434,7 @@ PHP_FUNCTION(exif_read_data)
ret = exif_read_from_stream(&ImageInfo, p_stream, read_thumbnail, read_all);
} else {
if (!try_convert_to_string(stream)) {
- return;
+ RETURN_THROWS();
}
if (!Z_STRLEN_P(stream)) {
@@ -4694,7 +4607,7 @@ PHP_FUNCTION(exif_thumbnail)
ret = exif_read_from_stream(&ImageInfo, p_stream, 1, 0);
} else {
if (!try_convert_to_string(stream)) {
- return;
+ RETURN_THROWS();
}
if (!Z_STRLEN_P(stream)) {
@@ -4759,7 +4672,7 @@ PHP_FUNCTION(exif_imagetype)
int itype = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &imagefile, &imagefile_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
stream = php_stream_open_wrapper(imagefile, "rb", IGNORE_PATH|REPORT_ERRORS, NULL);
@@ -4768,7 +4681,7 @@ PHP_FUNCTION(exif_imagetype)
RETURN_FALSE;
}
- itype = php_getimagetype(stream, NULL);
+ itype = php_getimagetype(stream, imagefile, NULL);
php_stream_close(stream);
diff --git a/ext/exif/exif.stub.php b/ext/exif/exif.stub.php
new file mode 100644
index 0000000000..3fe2e72f66
--- /dev/null
+++ b/ext/exif/exif.stub.php
@@ -0,0 +1,9 @@
+<?php
+
+function exif_tagname(int $index): string|false {}
+
+function exif_read_data($filename, ?string $sections_needed = null, bool $sub_arrays = false, bool $read_thumbnail = false): array|false {}
+
+function exif_thumbnail($filename, &$width = null, &$height = null, &$imagetype = null): string|false {}
+
+function exif_imagetype(string $filename): int|false {}
diff --git a/ext/exif/exif_arginfo.h b/ext/exif/exif_arginfo.h
new file mode 100644
index 0000000000..2551e5e987
--- /dev/null
+++ b/ext/exif/exif_arginfo.h
@@ -0,0 +1,23 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_exif_tagname, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_exif_read_data, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, filename)
+ ZEND_ARG_TYPE_INFO(0, sections_needed, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, sub_arrays, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, read_thumbnail, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_exif_thumbnail, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, filename)
+ ZEND_ARG_INFO(1, width)
+ ZEND_ARG_INFO(1, height)
+ ZEND_ARG_INFO(1, imagetype)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_exif_imagetype, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/exif/php_exif.h b/ext/exif/php_exif.h
index 03f4abca84..8cbf70fef3 100644
--- a/ext/exif/php_exif.h
+++ b/ext/exif/php_exif.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/exif/tests/bug34704-mb.phpt b/ext/exif/tests/bug34704-mb.phpt
index 4ca5d6af6b..3087a0f1ba 100644
--- a/ext/exif/tests/bug34704-mb.phpt
+++ b/ext/exif/tests/bug34704-mb.phpt
@@ -10,7 +10,6 @@ zlib.output_compression=0
$infile = __DIR__.'/bug34704ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.jpg';
var_dump(exif_read_data($infile));
?>
-===DONE===
--EXPECTF--
array(7) {
["FileName"]=>
@@ -39,4 +38,3 @@ array(7) {
int(0)
}
}
-===DONE===
diff --git a/ext/exif/tests/bug34704.phpt b/ext/exif/tests/bug34704.phpt
index 9925840d5a..373d5ae81b 100644
--- a/ext/exif/tests/bug34704.phpt
+++ b/ext/exif/tests/bug34704.phpt
@@ -10,7 +10,6 @@ zlib.output_compression=0
$infile = __DIR__.'/bug34704.jpg';
var_dump(exif_read_data($infile));
?>
-===DONE===
--EXPECTF--
array(7) {
["FileName"]=>
@@ -39,4 +38,3 @@ array(7) {
int(0)
}
}
-===DONE===
diff --git a/ext/exif/tests/bug50660/bug50660.phpt b/ext/exif/tests/bug50660/bug50660.phpt
index 4b502a0a29..f15f79e7e6 100644
--- a/ext/exif/tests/bug50660/bug50660.phpt
+++ b/ext/exif/tests/bug50660/bug50660.phpt
@@ -12,8 +12,6 @@ var_dump(exif_read_data($infile) !== false);
$infile = __DIR__.'/bug50660-2.jpg';
var_dump(exif_read_data($infile) !== false);
?>
-===DONE===
--EXPECT--
bool(true)
bool(true)
-===DONE===
diff --git a/ext/exif/tests/bug60150.phpt b/ext/exif/tests/bug60150.phpt
index cfe86fb363..5f45828db7 100644
--- a/ext/exif/tests/bug60150.phpt
+++ b/ext/exif/tests/bug60150.phpt
@@ -10,7 +10,6 @@ zlib.output_compression=0
$infile = __DIR__.'/bug60150.jpg';
var_dump(exif_read_data($infile));
?>
-===DONE===
--EXPECTF--
Warning: exif_read_data(bug60150.jpg): Process tag(x9003=DateTimeOriginal): Illegal pointer offset(%s) in %s on line %d
@@ -18,4 +17,3 @@ Warning: exif_read_data(bug60150.jpg): Error reading from file: got=x%x(=%d) !=
Warning: exif_read_data(bug60150.jpg): Invalid JPEG file in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/exif/tests/bug64739.phpt b/ext/exif/tests/bug64739.phpt
index de97e0db3c..b423e6501e 100644
--- a/ext/exif/tests/bug64739.phpt
+++ b/ext/exif/tests/bug64739.phpt
@@ -12,8 +12,8 @@ echo "Test\n";
$headers1 = exif_read_data(__DIR__ . '/bug64739.jpg');
if ($headers1 === false) {
- echo 'Error, failed to read exif data';
- exit;
+ echo 'Error, failed to read exif data';
+ exit;
}
var_dump($headers1['Title'][0] === '?');
@@ -24,8 +24,8 @@ ini_set('exif.decode_unicode_motorola', 'UCS-2LE');
$headers2 = exif_read_data(__DIR__ . '/bug64739.jpg');
if ($headers2 === false) {
- echo 'Error, failed to read exif data';
- exit;
+ echo 'Error, failed to read exif data';
+ exit;
}
var_dump($headers2['Title']);
diff --git a/ext/exif/tests/bug68547.phpt b/ext/exif/tests/bug68547.phpt
index b1ae86964f..0fb9e06cce 100644
--- a/ext/exif/tests/bug68547.phpt
+++ b/ext/exif/tests/bug68547.phpt
@@ -6,7 +6,6 @@ Bug #68547 (Exif Header component value check error)
<?php
var_dump(exif_read_data(__DIR__ . DIRECTORY_SEPARATOR . 'bug68547.jpg'));
?>
-===DONE===
--EXPECTF--
array(12) {
["FileName"]=>
@@ -48,4 +47,3 @@ Line4"
["Title"]=>
string(8) "Title..."
}
-===DONE===
diff --git a/ext/exif/tests/bug72627.phpt b/ext/exif/tests/bug72627.phpt
index bb6a1fae99..ad363d8dd6 100644
--- a/ext/exif/tests/bug72627.phpt
+++ b/ext/exif/tests/bug72627.phpt
@@ -4,8 +4,8 @@ Bug #72627 (Memory Leakage In exif_process_IFD_in_TIFF)
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
--FILE--
<?php
- $exif = exif_read_data(__DIR__ . '/bug72627.tiff',0,0,true);
- var_dump($exif);
+ $exif = exif_read_data(__DIR__ . '/bug72627.tiff',0,0,true);
+ var_dump($exif);
?>
--EXPECTF--
Warning: exif_read_data(%s): Thumbnail goes IFD boundary or end of file reached in %sbug72627.php on line %d
diff --git a/ext/exif/tests/bug72735/bug72682.phpt b/ext/exif/tests/bug72735/bug72682.phpt
index 42a80b2eea..cc3faaa101 100644
--- a/ext/exif/tests/bug72735/bug72682.phpt
+++ b/ext/exif/tests/bug72735/bug72682.phpt
@@ -5,10 +5,10 @@ Bug #72735 MakerNote regression
--FILE--
<?php
foreach (['nokia.jpg', 'samsung.jpg', 'panasonic.jpg'] as $picture) {
- echo $picture . ': ';
+ echo $picture . ': ';
- $info = exif_read_data(__DIR__ . DIRECTORY_SEPARATOR . $picture);
- var_dump($info['MakerNote']);
+ $info = exif_read_data(__DIR__ . DIRECTORY_SEPARATOR . $picture);
+ var_dump($info['MakerNote']);
}
?>
--EXPECT--
diff --git a/ext/exif/tests/bug72735/bug72735.phpt b/ext/exif/tests/bug72735/bug72735.phpt
index 082f3e6153..1efd4ba457 100644
--- a/ext/exif/tests/bug72735/bug72735.phpt
+++ b/ext/exif/tests/bug72735/bug72735.phpt
@@ -5,17 +5,17 @@ Bug #72735 (Samsung picture thumb not read (zero size))
--FILE--
<?php
foreach (['nokia.jpg', 'samsung.jpg', 'panasonic.jpg'] as $picture) {
- echo $picture . ': ';
+ echo $picture . ': ';
- $len = strlen(exif_thumbnail(__DIR__ . DIRECTORY_SEPARATOR . $picture));
+ $len = strlen(exif_thumbnail(__DIR__ . DIRECTORY_SEPARATOR . $picture));
- if (!$len) {
- echo 'Error, no length returned', PHP_EOL;
+ if (!$len) {
+ echo 'Error, no length returned', PHP_EOL;
- continue;
- }
+ continue;
+ }
- echo 'int(' . $len . ')', PHP_EOL;
+ echo 'int(' . $len . ')', PHP_EOL;
}
?>
--EXPECT--
diff --git a/ext/exif/tests/bug72819/bug72819.phpt b/ext/exif/tests/bug72819/bug72819.phpt
index 0813c8a5eb..42982990bd 100644
--- a/ext/exif/tests/bug72819/bug72819.phpt
+++ b/ext/exif/tests/bug72819/bug72819.phpt
@@ -10,7 +10,5 @@ zlib.output_compression=0
$infile = __DIR__.'/bug72819.jpg';
var_dump(strlen(exif_thumbnail($infile)));
?>
-===DONE===
--EXPECT--
int(5448)
-===DONE===
diff --git a/ext/exif/tests/bug73115/bug73115.phpt b/ext/exif/tests/bug73115/bug73115.phpt
index 86c99a63d0..b9fb3e9521 100644
--- a/ext/exif/tests/bug73115/bug73115.phpt
+++ b/ext/exif/tests/bug73115/bug73115.phpt
@@ -10,7 +10,5 @@ zlib.output_compression=0
$infile = __DIR__.'/bug73115.jpg';
var_dump(count(exif_read_data($infile)));
?>
-===DONE===
--EXPECT--
int(80)
-===DONE===
diff --git a/ext/exif/tests/bug73737.phpt b/ext/exif/tests/bug73737.phpt
index a37b3c9583..a46020f468 100644
--- a/ext/exif/tests/bug73737.phpt
+++ b/ext/exif/tests/bug73737.phpt
@@ -4,8 +4,8 @@ Bug #73737 (Crash when parsing a tag format)
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
--FILE--
<?php
- $exif = exif_thumbnail(__DIR__ . '/bug73737.tiff');
- var_dump($exif);
+ $exif = exif_thumbnail(__DIR__ . '/bug73737.tiff');
+ var_dump($exif);
?>
--EXPECTF--
Warning: exif_thumbnail(bug73737.tiff): Process tag(x0100=ImageWidth): Cannot be empty in %s on line %d
diff --git a/ext/exif/tests/bug74428/bug74428.phpt b/ext/exif/tests/bug74428/bug74428.phpt
index 881e6987c4..967a1ac4ce 100644
--- a/ext/exif/tests/bug74428/bug74428.phpt
+++ b/ext/exif/tests/bug74428/bug74428.phpt
@@ -10,7 +10,6 @@ zlib.output_compression=0
$infile = __DIR__.'/bug74428.jpg';
var_dump(exif_read_data($infile));
?>
-===DONE===
--EXPECTF--
array(11) {
["FileName"]=>
@@ -47,4 +46,3 @@ array(11) {
["ExifImageLength"]=>
int(28)
}
-===DONE===
diff --git a/ext/exif/tests/bug76409.phpt b/ext/exif/tests/bug76409.phpt
index b409a2bec4..c7d3c1ad2d 100644
--- a/ext/exif/tests/bug76409.phpt
+++ b/ext/exif/tests/bug76409.phpt
@@ -8,7 +8,5 @@ if (!extension_loaded('exif')) die('skip exif extension not available');
<?php
exif_read_data('.');
?>
-===DONE===
--EXPECTF--
Warning: exif_read_data(): %s in %s on line %d
-===DONE===
diff --git a/ext/exif/tests/bug76423.phpt b/ext/exif/tests/bug76423.phpt
index f917074410..8e2bf45753 100644
--- a/ext/exif/tests/bug76423.phpt
+++ b/ext/exif/tests/bug76423.phpt
@@ -8,11 +8,9 @@ if (!extension_loaded('exif')) die('skip exif extension not available');
<?php
exif_read_data(__DIR__ . '/bug76423.jpg', 0, true, true);
?>
-===DONE===
--EXPECTF--
Warning: exif_read_data(%s.jpg): Thumbnail goes IFD boundary or end of file reached in %s on line %d
Warning: exif_read_data(%s.jpg): File structure corrupted in %s on line %d
Warning: exif_read_data(%s.jpg): Invalid JPEG file in %s on line %d
-===DONE===
diff --git a/ext/exif/tests/bug77184/bug77184.phpt b/ext/exif/tests/bug77184/bug77184.phpt
index 54ecedf927..c75224efdc 100644
--- a/ext/exif/tests/bug77184/bug77184.phpt
+++ b/ext/exif/tests/bug77184/bug77184.phpt
@@ -12,8 +12,6 @@ $tags = exif_read_data($infile);
echo $tags['GPSLatitude'][2], PHP_EOL;
echo $tags['GPSLongitude'][2], PHP_EOL;
?>
-===DONE===
--EXPECT--
156691934/70000000
2672193571/70000000
-===DONE===
diff --git a/ext/exif/tests/exif_encoding_crash.phpt b/ext/exif/tests/exif_encoding_crash.phpt
index a1222b1582..8fda8e5668 100644
--- a/ext/exif/tests/exif_encoding_crash.phpt
+++ b/ext/exif/tests/exif_encoding_crash.phpt
@@ -8,7 +8,5 @@ $infile = __DIR__.'/exif_encoding_crash.jpg';
$exif_data = exif_read_data($infile);
echo "*** no core dump ***\n";
?>
-===DONE===
--EXPECT--
*** no core dump ***
-===DONE===
diff --git a/ext/exif/tests/exif_imagetype_basic-mb.phpt b/ext/exif/tests/exif_imagetype_basic-mb.phpt
index 11a5274615..b4b17657a5 100644
--- a/ext/exif/tests/exif_imagetype_basic-mb.phpt
+++ b/ext/exif/tests/exif_imagetype_basic-mb.phpt
@@ -16,8 +16,6 @@ echo "*** Testing exif_imagetype() : basic functionality ***\n";
var_dump(exif_imagetype(__DIR__.'/test2ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.jpg'));
?>
-===Done===
--EXPECT--
*** Testing exif_imagetype() : basic functionality ***
int(2)
-===Done===
diff --git a/ext/exif/tests/exif_imagetype_basic.phpt b/ext/exif/tests/exif_imagetype_basic.phpt
index dbb0c8a7a9..0b1b09fd4d 100644
--- a/ext/exif/tests/exif_imagetype_basic.phpt
+++ b/ext/exif/tests/exif_imagetype_basic.phpt
@@ -16,8 +16,6 @@ echo "*** Testing exif_imagetype() : basic functionality ***\n";
var_dump(exif_imagetype(__DIR__.'/test2.jpg'));
?>
-===Done===
--EXPECT--
*** Testing exif_imagetype() : basic functionality ***
int(2)
-===Done===
diff --git a/ext/exif/tests/exif_imagetype_error.phpt b/ext/exif/tests/exif_imagetype_error.phpt
index 80538a0f68..8ad1511e16 100644
--- a/ext/exif/tests/exif_imagetype_error.phpt
+++ b/ext/exif/tests/exif_imagetype_error.phpt
@@ -12,34 +12,15 @@ Test exif_imagetype() function : error conditions
echo "*** Testing exif_imagetype() : error conditions ***\n";
-echo "\n-- Testing exif_imagetype() function with no arguments --\n";
-var_dump( exif_imagetype() );
-
-echo "\n-- Testing exif_imagetype() function with more than expected no. of arguments --\n";
-$extra_arg = 10;
-var_dump( exif_imagetype(__DIR__.'/test2.jpg', $extra_arg) );
-
echo "\n-- Testing exif_imagetype() function with an unknown file --\n";
var_dump( exif_imagetype(__DIR__.'/foo.jpg') );
?>
-===Done===
--EXPECTF--
*** Testing exif_imagetype() : error conditions ***
--- Testing exif_imagetype() function with no arguments --
-
-Warning: exif_imagetype() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
--- Testing exif_imagetype() function with more than expected no. of arguments --
-
-Warning: exif_imagetype() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-- Testing exif_imagetype() function with an unknown file --
-Warning: exif_imagetype(%s/foo.jpg): failed to open stream: No such file or directory in %s on line %d
+Warning: exif_imagetype(%s/foo.jpg): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-===Done===
diff --git a/ext/exif/tests/exif_read_data_0.phpt b/ext/exif/tests/exif_read_data_0.phpt
index 5421a14d2e..172bac5efd 100644
--- a/ext/exif/tests/exif_read_data_0.phpt
+++ b/ext/exif/tests/exif_read_data_0.phpt
@@ -7,7 +7,5 @@ Test exif_read_data on unavailable file
$infile = __DIR__.'/bug73115.JPG';
exif_read_data($infile);
?>
-===DONE===
--EXPECTF--
Warning: exif_read_data(): Unable to open file in %sexif_read_data_0.php on line %d
-===DONE===
diff --git a/ext/exif/tests/exif_read_exif_data_basic-mb.phpt b/ext/exif/tests/exif_read_exif_data_basic-mb.phpt
deleted file mode 100644
index 70e9ab0401..0000000000
--- a/ext/exif/tests/exif_read_exif_data_basic-mb.phpt
+++ /dev/null
@@ -1,64 +0,0 @@
---TEST--
-Check for read_exif_data default behaviour
---SKIPIF--
-<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
---INI--
-output_handler=
-zlib.output_compression=0
---FILE--
-<?php
-
-/* Prototype : array read_exif_data ( string $filename [, string $sections [, bool $arrays [, bool $thumbnail ]]] )
- * Description: Alias of exif_read_data()
- * Source code: ext/exif/exif.c
-*/
-echo "*** Testing read_exif_data() : basic functionality ***\n";
-
-print_r(read_exif_data(__DIR__.'/test2ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.jpg'));
-?>
-===Done===
---EXPECTF--
-*** Testing read_exif_data() : basic functionality ***
-
-Deprecated: Function read_exif_data() is deprecated in %sexif_read_exif_data_basic-mb.php on line 9
-Array
-(
- [FileName] => test2ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.jpg
- [FileDateTime] => %d
- [FileSize] => 1240
- [FileType] => 2
- [MimeType] => image/jpeg
- [SectionsFound] => ANY_TAG, IFD0, THUMBNAIL, COMMENT
- [COMPUTED] => Array
- (
- [html] => width="1" height="1"
- [Height] => 1
- [Width] => 1
- [IsColor] => 1
- [ByteOrderMotorola] => 1
- [UserComment] => Exif test image.
- [UserCommentEncoding] => ASCII
- [Copyright] => Photo (c) M.Boerger, Edited by M.Boerger.
- [Copyright.Photographer] => Photo (c) M.Boerger
- [Copyright.Editor] => Edited by M.Boerger.
- [Thumbnail.FileType] => 2
- [Thumbnail.MimeType] => image/jpeg
- )
-
- [Copyright] => Photo (c) M.Boerger
- [UserComment] => ASCII
- [THUMBNAIL] => Array
- (
- [JPEGInterchangeFormat] => 134
- [JPEGInterchangeFormatLength] => 523
- )
-
- [COMMENT] => Array
- (
- [0] => Comment #1.
- [1] => Comment #2.
- [2] => Comment #3end
- )
-
-)
-===Done===
diff --git a/ext/exif/tests/exif_read_exif_data_basic.phpt b/ext/exif/tests/exif_read_exif_data_basic.phpt
deleted file mode 100644
index 254cd1a164..0000000000
--- a/ext/exif/tests/exif_read_exif_data_basic.phpt
+++ /dev/null
@@ -1,64 +0,0 @@
---TEST--
-Check for read_exif_data default behaviour
---SKIPIF--
-<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
---INI--
-output_handler=
-zlib.output_compression=0
---FILE--
-<?php
-
-/* Prototype : array read_exif_data ( string $filename [, string $sections [, bool $arrays [, bool $thumbnail ]]] )
- * Description: Alias of exif_read_data()
- * Source code: ext/exif/exif.c
-*/
-echo "*** Testing read_exif_data() : basic functionality ***\n";
-
-print_r(read_exif_data(__DIR__.'/test2.jpg'));
-?>
-===Done===
---EXPECTF--
-*** Testing read_exif_data() : basic functionality ***
-
-Deprecated: Function read_exif_data() is deprecated in %sexif_read_exif_data_basic.php on line 9
-Array
-(
- [FileName] => test2.jpg
- [FileDateTime] => %d
- [FileSize] => 1240
- [FileType] => 2
- [MimeType] => image/jpeg
- [SectionsFound] => ANY_TAG, IFD0, THUMBNAIL, COMMENT
- [COMPUTED] => Array
- (
- [html] => width="1" height="1"
- [Height] => 1
- [Width] => 1
- [IsColor] => 1
- [ByteOrderMotorola] => 1
- [UserComment] => Exif test image.
- [UserCommentEncoding] => ASCII
- [Copyright] => Photo (c) M.Boerger, Edited by M.Boerger.
- [Copyright.Photographer] => Photo (c) M.Boerger
- [Copyright.Editor] => Edited by M.Boerger.
- [Thumbnail.FileType] => 2
- [Thumbnail.MimeType] => image/jpeg
- )
-
- [Copyright] => Photo (c) M.Boerger
- [UserComment] => ASCII
- [THUMBNAIL] => Array
- (
- [JPEGInterchangeFormat] => 134
- [JPEGInterchangeFormatLength] => 523
- )
-
- [COMMENT] => Array
- (
- [0] => Comment #1.
- [1] => Comment #2.
- [2] => Comment #3end
- )
-
-)
-===Done===
diff --git a/ext/exif/tests/exif_tagname_basic.phpt b/ext/exif/tests/exif_tagname_basic.phpt
index 82bd06ebab..5706f0fd8f 100644
--- a/ext/exif/tests/exif_tagname_basic.phpt
+++ b/ext/exif/tests/exif_tagname_basic.phpt
@@ -20,10 +20,8 @@ var_dump(exif_tagname(0x10F));
var_dump(exif_tagname(0x110));
?>
-===Done===
--EXPECT--
*** Testing exif_tagname() : basic functionality ***
string(16) "ImageDescription"
string(4) "Make"
string(5) "Model"
-===Done===
diff --git a/ext/exif/tests/sony.phpt b/ext/exif/tests/sony.phpt
index 8c2bf7c58c..0111a82e1f 100644
--- a/ext/exif/tests/sony.phpt
+++ b/ext/exif/tests/sony.phpt
@@ -7,14 +7,14 @@ Sony test
$data = exif_read_data(__DIR__ . DIRECTORY_SEPARATOR . 'sony.jpg');
if (!$data) {
- exit('Error: Unable to parse EXIF data');
+ exit('Error: Unable to parse EXIF data');
}
// Perhaps we should just test for SonyModelID since it seems to be
// the most specific tag name that should be found in any Sony generated
// picture
foreach (['SonyModelID', 'Panorama', 'AntiBlur'] as $sony_tag) {
- printf('%s was %sfound' . PHP_EOL, $sony_tag, (!isset($data[$sony_tag]) ? 'NOT ' : ''));
+ printf('%s was %sfound' . PHP_EOL, $sony_tag, (!isset($data[$sony_tag]) ? 'NOT ' : ''));
}
?>
--EXPECT--
diff --git a/ext/ext_skel.php b/ext/ext_skel.php
index ee274d10c3..5c6835940f 100755
--- a/ext/ext_skel.php
+++ b/ext/ext_skel.php
@@ -2,8 +2,6 @@
<?php
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -146,7 +144,7 @@ function print_success() {
printf('%1$sSuccess. The extension is now ready to be compiled. To do so, use the%s', PHP_EOL);
printf('following steps:%1$s%1$s', PHP_EOL);
- printf('cd /path/to/php-src/%s%s', $options['ext'], PHP_EOL);
+ printf('cd /path/to/php-src/ext/%s%s', $options['ext'], PHP_EOL);
printf('phpize%s', PHP_EOL);
printf('%sconfigure%s', $file_prefix, PHP_EOL);
printf('%smake%2$s%2$s', $make_prefix, PHP_EOL);
@@ -264,8 +262,6 @@ function process_source_tags($file, $short_name) {
$header = <<<"HEADER"
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -334,6 +330,7 @@ function copy_sources() {
$files = [
'skeleton.c' => $options['ext'] . '.c',
+ 'skeleton.stub.php' => $options['ext'] . '.stub.php',
'php_skeleton.h' => 'php_' . $options['ext'] . '.h'
];
diff --git a/ext/ffi/ffi.c b/ext/ffi/ffi.c
index f43ba2adc8..482d7c1a61 100644
--- a/ext/ffi/ffi.c
+++ b/ext/ffi/ffi.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -28,6 +26,7 @@
#include "zend_interfaces.h"
#include "zend_closures.h"
#include "main/SAPI.h"
+#include "ffi_arginfo.h"
#include <ffi.h>
@@ -975,9 +974,9 @@ static void *zend_ffi_create_callback(zend_ffi_type *type, zval *value) /* {{{ *
/* }}} */
#endif
-static zval *zend_ffi_cdata_get(zval *object, zval *member, int read_type, void **cache_slot, zval *rv) /* {{{ */
+static zval *zend_ffi_cdata_get(zend_object *obj, zend_string *member, int read_type, void **cache_slot, zval *rv) /* {{{ */
{
- zend_ffi_cdata *cdata = (zend_ffi_cdata*)Z_OBJ_P(object);
+ zend_ffi_cdata *cdata = (zend_ffi_cdata*)obj;
zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type);
#if 0
@@ -987,8 +986,7 @@ static zval *zend_ffi_cdata_get(zval *object, zval *member, int read_type, void
}
#endif
- if (UNEXPECTED(Z_TYPE_P(member) != IS_STRING)
- || UNEXPECTED(!zend_string_equals_literal(Z_STR_P(member), "cdata"))) {
+ if (UNEXPECTED(!zend_string_equals_literal(member, "cdata"))) {
zend_throw_error(zend_ffi_exception_ce, "only 'cdata' property may be read");
return &EG(uninitialized_zval);;
}
@@ -998,9 +996,9 @@ static zval *zend_ffi_cdata_get(zval *object, zval *member, int read_type, void
}
/* }}} */
-static zval *zend_ffi_cdata_set(zval *object, zval *member, zval *value, void **cache_slot) /* {{{ */
+static zval *zend_ffi_cdata_set(zend_object *obj, zend_string *member, zval *value, void **cache_slot) /* {{{ */
{
- zend_ffi_cdata *cdata = (zend_ffi_cdata*)Z_OBJ_P(object);
+ zend_ffi_cdata *cdata = (zend_ffi_cdata*)obj;
zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type);
#if 0
@@ -1010,9 +1008,8 @@ static zval *zend_ffi_cdata_set(zval *object, zval *member, zval *value, void **
}
#endif
- if (UNEXPECTED(Z_TYPE_P(member) != IS_STRING)
- || UNEXPECTED(!zend_string_equals_literal(Z_STR_P(member), "cdata"))) {
- zend_throw_error(zend_ffi_exception_ce, "only 'cdata' property may be set");
+ if (UNEXPECTED(!zend_string_equals_literal(member, "cdata"))) {
+ zend_throw_error(zend_ffi_exception_ce, "Only 'cdata' property may be set");
return &EG(uninitialized_zval);;
}
@@ -1022,10 +1019,10 @@ static zval *zend_ffi_cdata_set(zval *object, zval *member, zval *value, void **
}
/* }}} */
-static int zend_ffi_cdata_cast_object(zval *readobj, zval *writeobj, int type) /* {{{ */
+static int zend_ffi_cdata_cast_object(zend_object *readobj, zval *writeobj, int type) /* {{{ */
{
if (type == IS_STRING) {
- zend_ffi_cdata *cdata = (zend_ffi_cdata*)Z_OBJ_P(readobj);
+ zend_ffi_cdata *cdata = (zend_ffi_cdata*)readobj;
zend_ffi_type *ctype = ZEND_FFI_TYPE(cdata->type);
void *ptr = cdata->ptr;
zend_ffi_type_kind kind = ctype->kind;
@@ -1096,9 +1093,9 @@ again:
}
/* }}} */
-static zval *zend_ffi_cdata_read_field(zval *object, zval *member, int read_type, void **cache_slot, zval *rv) /* {{{ */
+static zval *zend_ffi_cdata_read_field(zend_object *obj, zend_string *field_name, int read_type, void **cache_slot, zval *rv) /* {{{ */
{
- zend_ffi_cdata *cdata = (zend_ffi_cdata*)Z_OBJ_P(object);
+ zend_ffi_cdata *cdata = (zend_ffi_cdata*)obj;
zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type);
void *ptr = cdata->ptr;
zend_ffi_field *field;
@@ -1106,28 +1103,22 @@ static zval *zend_ffi_cdata_read_field(zval *object, zval *member, int read_type
if (cache_slot && *cache_slot == type) {
field = *(cache_slot + 1);
} else {
- zend_string *tmp_field_name;
- zend_string *field_name = zval_get_tmp_string(member, &tmp_field_name);
-
if (UNEXPECTED(type->kind != ZEND_FFI_TYPE_STRUCT)) {
if (type->kind == ZEND_FFI_TYPE_POINTER) {
/* transparently dereference the pointer */
if (UNEXPECTED(!ptr)) {
zend_throw_error(zend_ffi_exception_ce, "NULL pointer dereference");
- zend_tmp_string_release(tmp_field_name);
return &EG(uninitialized_zval);
}
ptr = (void*)(*(char**)ptr);
if (UNEXPECTED(!ptr)) {
zend_throw_error(zend_ffi_exception_ce, "NULL pointer dereference");
- zend_tmp_string_release(tmp_field_name);
return &EG(uninitialized_zval);
}
type = ZEND_FFI_TYPE(type->pointer.type);
}
if (UNEXPECTED(type->kind != ZEND_FFI_TYPE_STRUCT)) {
zend_throw_error(zend_ffi_exception_ce, "Attempt to read field '%s' of non C struct/union", ZSTR_VAL(field_name));
- zend_tmp_string_release(tmp_field_name);
return &EG(uninitialized_zval);
}
}
@@ -1135,12 +1126,9 @@ static zval *zend_ffi_cdata_read_field(zval *object, zval *member, int read_type
field = zend_hash_find_ptr(&type->record.fields, field_name);
if (UNEXPECTED(!field)) {
zend_throw_error(zend_ffi_exception_ce, "Attempt to read undefined field '%s' of C struct/union", ZSTR_VAL(field_name));
- zend_tmp_string_release(tmp_field_name);
return &EG(uninitialized_zval);
}
- zend_tmp_string_release(tmp_field_name);
-
if (cache_slot) {
*cache_slot = type;
*(cache_slot + 1) = field;
@@ -1174,9 +1162,9 @@ static zval *zend_ffi_cdata_read_field(zval *object, zval *member, int read_type
}
/* }}} */
-static zval *zend_ffi_cdata_write_field(zval *object, zval *member, zval *value, void **cache_slot) /* {{{ */
+static zval *zend_ffi_cdata_write_field(zend_object *obj, zend_string *field_name, zval *value, void **cache_slot) /* {{{ */
{
- zend_ffi_cdata *cdata = (zend_ffi_cdata*)Z_OBJ_P(object);
+ zend_ffi_cdata *cdata = (zend_ffi_cdata*)obj;
zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type);
void *ptr = cdata->ptr;
zend_ffi_field *field;
@@ -1184,28 +1172,22 @@ static zval *zend_ffi_cdata_write_field(zval *object, zval *member, zval *value,
if (cache_slot && *cache_slot == type) {
field = *(cache_slot + 1);
} else {
- zend_string *tmp_field_name;
- zend_string *field_name = zval_get_tmp_string(member, &tmp_field_name);
-
if (UNEXPECTED(type->kind != ZEND_FFI_TYPE_STRUCT)) {
if (type->kind == ZEND_FFI_TYPE_POINTER) {
/* transparently dereference the pointer */
if (UNEXPECTED(!ptr)) {
zend_throw_error(zend_ffi_exception_ce, "NULL pointer dereference");
- zend_tmp_string_release(tmp_field_name);
return value;
}
ptr = (void*)(*(char**)ptr);
if (UNEXPECTED(!ptr)) {
zend_throw_error(zend_ffi_exception_ce, "NULL pointer dereference");
- zend_tmp_string_release(tmp_field_name);
return value;
}
type = ZEND_FFI_TYPE(type->pointer.type);
}
if (UNEXPECTED(type->kind != ZEND_FFI_TYPE_STRUCT)) {
zend_throw_error(zend_ffi_exception_ce, "Attempt to assign field '%s' of non C struct/union", ZSTR_VAL(field_name));
- zend_tmp_string_release(tmp_field_name);
return value;
}
}
@@ -1213,12 +1195,9 @@ static zval *zend_ffi_cdata_write_field(zval *object, zval *member, zval *value,
field = zend_hash_find_ptr(&type->record.fields, field_name);
if (UNEXPECTED(!field)) {
zend_throw_error(zend_ffi_exception_ce, "Attempt to assign undefined field '%s' of C struct/union", ZSTR_VAL(field_name));
- zend_tmp_string_release(tmp_field_name);
return value;
}
- zend_tmp_string_release(tmp_field_name);
-
if (cache_slot) {
*cache_slot = type;
*(cache_slot + 1) = field;
@@ -1236,10 +1215,7 @@ static zval *zend_ffi_cdata_write_field(zval *object, zval *member, zval *value,
zend_throw_error(zend_ffi_exception_ce, "Attempt to assign read-only location");
return value;
} else if (UNEXPECTED(field->is_const)) {
- zend_string *tmp_field_name;
- zend_string *field_name = zval_get_tmp_string(member, &tmp_field_name);
zend_throw_error(zend_ffi_exception_ce, "Attempt to assign read-only field '%s'", ZSTR_VAL(field_name));
- zend_tmp_string_release(tmp_field_name);
return value;
}
@@ -1253,9 +1229,9 @@ static zval *zend_ffi_cdata_write_field(zval *object, zval *member, zval *value,
}
/* }}} */
-static zval *zend_ffi_cdata_read_dim(zval *object, zval *offset, int read_type, zval *rv) /* {{{ */
+static zval *zend_ffi_cdata_read_dim(zend_object *obj, zval *offset, int read_type, zval *rv) /* {{{ */
{
- zend_ffi_cdata *cdata = (zend_ffi_cdata*)Z_OBJ_P(object);
+ zend_ffi_cdata *cdata = (zend_ffi_cdata*)obj;
zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type);
zend_long dim = zval_get_long(offset);
zend_ffi_type *dim_type;
@@ -1311,9 +1287,9 @@ static zval *zend_ffi_cdata_read_dim(zval *object, zval *offset, int read_type,
}
/* }}} */
-static void zend_ffi_cdata_write_dim(zval *object, zval *offset, zval *value) /* {{{ */
+static void zend_ffi_cdata_write_dim(zend_object *obj, zval *offset, zval *value) /* {{{ */
{
- zend_ffi_cdata *cdata = (zend_ffi_cdata*)Z_OBJ_P(object);
+ zend_ffi_cdata *cdata = (zend_ffi_cdata*)obj;
zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type);
zend_long dim;
void *ptr;
@@ -1666,9 +1642,9 @@ static int zend_ffi_cdata_compare_objects(zval *o1, zval *o2) /* {{{ */
}
/* }}} */
-static int zend_ffi_cdata_count_elements(zval *object, zend_long *count) /* {{{ */
+static int zend_ffi_cdata_count_elements(zend_object *obj, zend_long *count) /* {{{ */
{
- zend_ffi_cdata *cdata = (zend_ffi_cdata*)Z_OBJ_P(object);
+ zend_ffi_cdata *cdata = (zend_ffi_cdata*)obj;
zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type);
if (type->kind != ZEND_FFI_TYPE_ARRAY) {
@@ -1919,9 +1895,9 @@ static zend_object_iterator *zend_ffi_cdata_get_iterator(zend_class_entry *ce, z
}
/* }}} */
-static HashTable *zend_ffi_cdata_get_debug_info(zval *object, int *is_temp) /* {{{ */
+static HashTable *zend_ffi_cdata_get_debug_info(zend_object *obj, int *is_temp) /* {{{ */
{
- zend_ffi_cdata *cdata = (zend_ffi_cdata*)Z_OBJ_P(object);
+ zend_ffi_cdata *cdata = (zend_ffi_cdata*)obj;
zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type);
void *ptr = cdata->ptr;
HashTable *ht = NULL;
@@ -2018,23 +1994,29 @@ static HashTable *zend_ffi_cdata_get_debug_info(zval *object, int *is_temp) /* {
}
/* }}} */
-static int zend_ffi_cdata_get_closure(zval *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr) /* {{{ */
+static int zend_ffi_cdata_get_closure(zend_object *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr, zend_bool check_only) /* {{{ */
{
- zend_ffi_cdata *cdata = (zend_ffi_cdata*)Z_OBJ_P(obj);
+ zend_ffi_cdata *cdata = (zend_ffi_cdata*)obj;
zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type);
zend_function *func;
if (type->kind != ZEND_FFI_TYPE_POINTER) {
- zend_throw_error(zend_ffi_exception_ce, "Attempt to call non C function pointer");
+ if (!check_only) {
+ zend_throw_error(zend_ffi_exception_ce, "Attempt to call non C function pointer");
+ }
return FAILURE;
}
type = ZEND_FFI_TYPE(type->pointer.type);
if (type->kind != ZEND_FFI_TYPE_FUNC) {
- zend_throw_error(zend_ffi_exception_ce, "Attempt to call non C function pointer");
+ if (!check_only) {
+ zend_throw_error(zend_ffi_exception_ce, "Attempt to call non C function pointer");
+ }
return FAILURE;
}
if (!cdata->ptr) {
- zend_throw_error(zend_ffi_exception_ce, "NULL pointer dereference");
+ if (!check_only) {
+ zend_throw_error(zend_ffi_exception_ce, "NULL pointer dereference");
+ }
return FAILURE;
}
@@ -2150,7 +2132,7 @@ static int zend_ffi_ctype_compare_objects(zval *o1, zval *o2) /* {{{ */
}
/* }}} */
-static HashTable *zend_ffi_ctype_get_debug_info(zval *object, int *is_temp) /* {{{ */
+static HashTable *zend_ffi_ctype_get_debug_info(zend_object *obj, int *is_temp) /* {{{ */
{
return NULL;
}
@@ -2326,9 +2308,9 @@ static void zend_ffi_cdata_free_obj(zend_object *object) /* {{{ */
}
/* }}} */
-static zend_object *zend_ffi_cdata_clone_obj(zval *zobject) /* {{{ */
+static zend_object *zend_ffi_cdata_clone_obj(zend_object *obj) /* {{{ */
{
- zend_ffi_cdata *old_cdata = (zend_ffi_cdata*)Z_OBJ_P(zobject);
+ zend_ffi_cdata *old_cdata = (zend_ffi_cdata*)obj;
zend_ffi_type *type = ZEND_FFI_TYPE(old_cdata->type);
zend_ffi_cdata *new_cdata;
@@ -2345,11 +2327,9 @@ static zend_object *zend_ffi_cdata_clone_obj(zval *zobject) /* {{{ */
}
/* }}} */
-static zval *zend_ffi_read_var(zval *object, zval *member, int read_type, void **cache_slot, zval *rv) /* {{{ */
+static zval *zend_ffi_read_var(zend_object *obj, zend_string *var_name, int read_type, void **cache_slot, zval *rv) /* {{{ */
{
- zend_ffi *ffi = (zend_ffi*)Z_OBJ_P(object);
- zend_string *tmp_var_name;
- zend_string *var_name = zval_get_tmp_string(member, &tmp_var_name);
+ zend_ffi *ffi = (zend_ffi*)obj;
zend_ffi_symbol *sym = NULL;
if (ffi->symbols) {
@@ -2360,12 +2340,9 @@ static zval *zend_ffi_read_var(zval *object, zval *member, int read_type, void *
}
if (!sym) {
zend_throw_error(zend_ffi_exception_ce, "Attempt to read undefined C variable '%s'", ZSTR_VAL(var_name));
- zend_tmp_string_release(tmp_var_name);
return &EG(uninitialized_zval);
}
- zend_tmp_string_release(tmp_var_name);
-
if (sym->kind == ZEND_FFI_SYM_VAR) {
zend_ffi_cdata_to_zval(NULL, sym->addr, ZEND_FFI_TYPE(sym->type), read_type, rv, (zend_ffi_flags)sym->is_const, 0);
} else {
@@ -2376,11 +2353,9 @@ static zval *zend_ffi_read_var(zval *object, zval *member, int read_type, void *
}
/* }}} */
-static zval *zend_ffi_write_var(zval *object, zval *member, zval *value, void **cache_slot) /* {{{ */
+static zval *zend_ffi_write_var(zend_object *obj, zend_string *var_name, zval *value, void **cache_slot) /* {{{ */
{
- zend_ffi *ffi = (zend_ffi*)Z_OBJ_P(object);
- zend_string *tmp_var_name;
- zend_string *var_name = zval_get_tmp_string(member, &tmp_var_name);
+ zend_ffi *ffi = (zend_ffi*)obj;
zend_ffi_symbol *sym = NULL;
if (ffi->symbols) {
@@ -2391,12 +2366,9 @@ static zval *zend_ffi_write_var(zval *object, zval *member, zval *value, void **
}
if (!sym) {
zend_throw_error(zend_ffi_exception_ce, "Attempt to assign undefined C variable '%s'", ZSTR_VAL(var_name));
- zend_tmp_string_release(tmp_var_name);
return value;
}
- zend_tmp_string_release(tmp_var_name);
-
if (sym->is_const) {
zend_throw_error(zend_ffi_exception_ce, "Attempt to assign read-only C variable '%s'", ZSTR_VAL(var_name));
return value;
@@ -2827,7 +2799,7 @@ static zend_always_inline int zend_ffi_validate_api_restriction(zend_execute_dat
#define ZEND_FFI_VALIDATE_API_RESTRICTION() do { \
if (UNEXPECTED(!zend_ffi_validate_api_restriction(execute_data))) { \
- return; \
+ RETURN_THROWS(); \
} \
} while (0)
@@ -2850,7 +2822,7 @@ ZEND_METHOD(FFI, cdef) /* {{{ */
handle = DL_LOAD(ZSTR_VAL(lib));
if (!handle) {
zend_throw_error(zend_ffi_exception_ce, "Failed loading '%s'", ZSTR_VAL(lib));
- return;
+ RETURN_THROWS();
}
#ifdef RTLD_DEFAULT
} else if (1) {
@@ -3376,7 +3348,7 @@ ZEND_METHOD(FFI, load) /* {{{ */
if (CG(compiler_options) & ZEND_COMPILE_PRELOAD_IN_CHILD) {
zend_throw_error(zend_ffi_exception_ce, "FFI::load() doesn't work in conjunction with \"opcache.preload_user\". Use \"ffi.preload\" instead.");
- return;
+ RETURN_THROWS();
}
ffi = zend_ffi_load(ZSTR_VAL(fn), (CG(compiler_options) & ZEND_COMPILE_PRELOAD) != 0);
@@ -3404,7 +3376,7 @@ ZEND_METHOD(FFI, scope) /* {{{ */
if (!scope) {
zend_throw_error(zend_ffi_exception_ce, "Failed loading scope '%s'", ZSTR_VAL(scope_name));
- return;
+ RETURN_THROWS();
}
ffi = (zend_ffi*)zend_ffi_new(zend_ffi_ce);
@@ -3465,11 +3437,11 @@ static int zend_ffi_validate_incomplete_type(zend_ffi_type *type, zend_bool allo
ZEND_HASH_FOREACH_STR_KEY_PTR(FFI_G(tags), key, tag) {
if (ZEND_FFI_TYPE(tag->type) == type) {
if (type->kind == ZEND_FFI_TYPE_ENUM) {
- zend_ffi_throw_parser_error("incomplete 'enum %s' at line %d", ZSTR_VAL(key), FFI_G(line));
+ zend_ffi_throw_parser_error("Incomplete 'enum %s' at line %d", ZSTR_VAL(key), FFI_G(line));
} else if (type->attr & ZEND_FFI_ATTR_UNION) {
- zend_ffi_throw_parser_error("incomplete 'union %s' at line %d", ZSTR_VAL(key), FFI_G(line));
+ zend_ffi_throw_parser_error("Incomplete 'union %s' at line %d", ZSTR_VAL(key), FFI_G(line));
} else {
- zend_ffi_throw_parser_error("incomplete 'struct %s' at line %d", ZSTR_VAL(key), FFI_G(line));
+ zend_ffi_throw_parser_error("Incomplete 'struct %s' at line %d", ZSTR_VAL(key), FFI_G(line));
}
return FAILURE;
}
@@ -3481,12 +3453,12 @@ static int zend_ffi_validate_incomplete_type(zend_ffi_type *type, zend_bool allo
ZEND_HASH_FOREACH_STR_KEY_PTR(FFI_G(symbols), key, sym) {
if (type == ZEND_FFI_TYPE(sym->type)) {
- zend_ffi_throw_parser_error("incomplete C type '%s' at line %d", ZSTR_VAL(key), FFI_G(line));
+ zend_ffi_throw_parser_error("Incomplete C type '%s' at line %d", ZSTR_VAL(key), FFI_G(line));
return FAILURE;
}
} ZEND_HASH_FOREACH_END();
}
- zend_ffi_throw_parser_error("incomplete type at line %d", FFI_G(line));
+ zend_ffi_throw_parser_error("Incomplete type at line %d", FFI_G(line));
return FAILURE;
} else if (!allow_incomplete_array && type->attr & ZEND_FFI_ATTR_INCOMPLETE_ARRAY) {
zend_ffi_throw_parser_error("'[]' not allowed at line %d", FFI_G(line));
@@ -3718,7 +3690,7 @@ ZEND_METHOD(FFI, free) /* {{{ */
if (ZEND_FFI_TYPE(cdata->type)->kind == ZEND_FFI_TYPE_POINTER) {
if (!cdata->ptr) {
zend_throw_error(zend_ffi_exception_ce, "NULL pointer dereference");
- return;
+ RETURN_THROWS();
}
if (cdata->ptr != (void*)&cdata->ptr_holder) {
pefree(*(void**)cdata->ptr, cdata->flags & ZEND_FFI_FLAG_PERSISTENT);
@@ -3888,7 +3860,7 @@ ZEND_METHOD(FFI, cast) /* {{{ */
} else if (type->size > old_type->size) {
zend_object_release(&cdata->std);
zend_throw_error(zend_ffi_exception_ce, "attempt to cast to larger type");
- return;
+ RETURN_THROWS();
} else if (ptr != &old_cdata->ptr_holder) {
cdata->ptr = ptr;
} else {
@@ -4031,17 +4003,17 @@ ZEND_METHOD(FFI, arrayType) /* {{{ */
type = ZEND_FFI_TYPE(ctype->type);
if (type->kind == ZEND_FFI_TYPE_FUNC) {
- zend_throw_error(zend_ffi_exception_ce, "array of functions is not allowed");
- return;
+ zend_throw_error(zend_ffi_exception_ce, "Array of functions is not allowed");
+ RETURN_THROWS();
} else if (type->kind == ZEND_FFI_TYPE_ARRAY && (type->attr & ZEND_FFI_ATTR_INCOMPLETE_ARRAY)) {
- zend_throw_error(zend_ffi_exception_ce, "only the leftmost array can be undimensioned");
- return;
+ zend_throw_error(zend_ffi_exception_ce, "Only the leftmost array can be undimensioned");
+ RETURN_THROWS();
} else if (type->kind == ZEND_FFI_TYPE_VOID) {
- zend_throw_error(zend_ffi_exception_ce, "array of 'void' is not allowed");
- return;
+ zend_throw_error(zend_ffi_exception_ce, "Array of 'void' is not allowed");
+ RETURN_THROWS();
} else if (type->attr & ZEND_FFI_ATTR_INCOMPLETE_TAG) {
- zend_throw_error(zend_ffi_exception_ce, "array of incomplete type is not allowed");
- return;
+ zend_throw_error(zend_ffi_exception_ce, "Array of incomplete type is not allowed");
+ RETURN_THROWS();
}
if (ZEND_FFI_TYPE_IS_OWNED(ctype->type)) {
@@ -4063,11 +4035,11 @@ ZEND_METHOD(FFI, arrayType) /* {{{ */
if (n < 0) {
zend_throw_error(zend_ffi_exception_ce, "negative array index");
zend_ffi_type_dtor(type);
- return;
+ RETURN_THROWS();
} else if (ZEND_FFI_TYPE(type)->kind == ZEND_FFI_TYPE_ARRAY && (ZEND_FFI_TYPE(type)->attr & ZEND_FFI_ATTR_INCOMPLETE_ARRAY)) {
zend_throw_error(zend_ffi_exception_ce, "only the leftmost array can be undimensioned");
zend_ffi_type_dtor(type);
- return;
+ RETURN_THROWS();
}
new_type = emalloc(sizeof(zend_ffi_type));
@@ -4217,8 +4189,8 @@ ZEND_METHOD(FFI, memcpy) /* {{{ */
} else {
ptr1 = cdata1->ptr;
if (type1->kind != ZEND_FFI_TYPE_POINTER && size > type1->size) {
- zend_throw_error(zend_ffi_exception_ce, "attempt to write over data boundary");
- return;
+ zend_throw_error(zend_ffi_exception_ce, "Attempt to write over data boundary");
+ RETURN_THROWS();
}
}
@@ -4226,8 +4198,8 @@ ZEND_METHOD(FFI, memcpy) /* {{{ */
if (Z_TYPE_P(zv2) == IS_STRING) {
ptr2 = Z_STRVAL_P(zv2);
if (size > Z_STRLEN_P(zv2)) {
- zend_throw_error(zend_ffi_exception_ce, "attempt to read over string boundary");
- return;
+ zend_throw_error(zend_ffi_exception_ce, "Attempt to read over string boundary");
+ RETURN_THROWS();
}
} else if (Z_TYPE_P(zv2) == IS_OBJECT && Z_OBJCE_P(zv2) == zend_ffi_cdata_ce) {
cdata2 = (zend_ffi_cdata*)Z_OBJ_P(zv2);
@@ -4237,8 +4209,8 @@ ZEND_METHOD(FFI, memcpy) /* {{{ */
} else {
ptr2 = cdata2->ptr;
if (type2->kind != ZEND_FFI_TYPE_POINTER && size > type2->size) {
- zend_throw_error(zend_ffi_exception_ce, "attempt to read over data boundary");
- return;
+ zend_throw_error(zend_ffi_exception_ce, "Attempt to read over data boundary");
+ RETURN_THROWS();
}
}
} else {
@@ -4271,7 +4243,7 @@ ZEND_METHOD(FFI, memcmp) /* {{{ */
ptr1 = Z_STRVAL_P(zv1);
if (size > Z_STRLEN_P(zv1)) {
zend_throw_error(zend_ffi_exception_ce, "attempt to read over string boundary");
- return;
+ RETURN_THROWS();
}
} else if (Z_TYPE_P(zv1) == IS_OBJECT && Z_OBJCE_P(zv1) == zend_ffi_cdata_ce) {
cdata1 = (zend_ffi_cdata*)Z_OBJ_P(zv1);
@@ -4282,7 +4254,7 @@ ZEND_METHOD(FFI, memcmp) /* {{{ */
ptr1 = cdata1->ptr;
if (type1->kind != ZEND_FFI_TYPE_POINTER && size > type1->size) {
zend_throw_error(zend_ffi_exception_ce, "attempt to read over data boundary");
- return;
+ RETURN_THROWS();
}
}
} else {
@@ -4294,8 +4266,8 @@ ZEND_METHOD(FFI, memcmp) /* {{{ */
if (Z_TYPE_P(zv2) == IS_STRING) {
ptr2 = Z_STRVAL_P(zv2);
if (size > Z_STRLEN_P(zv2)) {
- zend_throw_error(zend_ffi_exception_ce, "attempt to read over string boundary");
- return;
+ zend_throw_error(zend_ffi_exception_ce, "Attempt to read over string boundary");
+ RETURN_THROWS();
}
} else if (Z_TYPE_P(zv2) == IS_OBJECT && Z_OBJCE_P(zv2) == zend_ffi_cdata_ce) {
cdata2 = (zend_ffi_cdata*)Z_OBJ_P(zv2);
@@ -4305,8 +4277,8 @@ ZEND_METHOD(FFI, memcmp) /* {{{ */
} else {
ptr2 = cdata2->ptr;
if (type2->kind != ZEND_FFI_TYPE_POINTER && size > type2->size) {
- zend_throw_error(zend_ffi_exception_ce, "attempt to read over data boundary");
- return;
+ zend_throw_error(zend_ffi_exception_ce, "Attempt to read over data boundary");
+ RETURN_THROWS();
}
}
} else {
@@ -4348,7 +4320,7 @@ ZEND_METHOD(FFI, memset) /* {{{ */
ptr = cdata->ptr;
if (type->kind != ZEND_FFI_TYPE_POINTER && size > type->size) {
zend_throw_error(zend_ffi_exception_ce, "attempt to write over data boundary");
- return;
+ RETURN_THROWS();
}
}
@@ -4380,7 +4352,7 @@ ZEND_METHOD(FFI, string) /* {{{ */
ptr = cdata->ptr;
if (type->kind != ZEND_FFI_TYPE_POINTER && size > type->size) {
zend_throw_error(zend_ffi_exception_ce, "attempt to read over data boundary");
- return;
+ RETURN_THROWS();
}
}
RETURN_STRINGL((char*)ptr, size);
@@ -4391,7 +4363,7 @@ ZEND_METHOD(FFI, string) /* {{{ */
ptr = cdata->ptr;
} else {
zend_throw_error(zend_ffi_exception_ce, "FFI\\Cdata is not a C string");
- return;
+ RETURN_THROWS();
}
RETURN_STRING((char*)ptr);
}
@@ -4420,111 +4392,31 @@ ZEND_METHOD(FFI, isNull) /* {{{ */
if (type->kind != ZEND_FFI_TYPE_POINTER){
zend_throw_error(zend_ffi_exception_ce, "FFI\\Cdata is not a pointer");
- return;
+ RETURN_THROWS();
}
RETURN_BOOL(*(void**)cdata->ptr == NULL);
}
/* }}} */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_func_cdef, 0, 0, 0)
- ZEND_ARG_INFO(0, code)
- ZEND_ARG_INFO(0, lib)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_func_load, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_func_scope, 0, 0, 1)
- ZEND_ARG_INFO(0, scope_name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_func_new, 0, 0, 1)
- ZEND_ARG_INFO(0, type)
- ZEND_ARG_INFO(0, owned)
- ZEND_ARG_INFO(0, persistent)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_func_free, 0, 0, 1)
- ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, ptr)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_func_cast, 0, 0, 2)
- ZEND_ARG_INFO(0, type)
- ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, ptr)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_func_type, 0, 0, 1)
- ZEND_ARG_INFO(0, type)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_func_typeof, 0, 0, 1)
- ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, ptr)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_func_array, 0, 0, 2)
- ZEND_ARG_INFO(0, type)
- ZEND_ARG_INFO(0, dims)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_func_addr, 0, 0, 1)
- ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, ptr)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_func_sizeof, 0, 0, 1)
- ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, ptr)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_func_alignof, 0, 0, 1)
- ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, ptr)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_func_memcpy, 0, 0, 3)
- ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, dst)
- ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, src)
- ZEND_ARG_INFO(0, size)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_func_memcmp, 0, 0, 3)
- ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, ptr1)
- ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, ptr2)
- ZEND_ARG_INFO(0, size)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_func_memset, 0, 0, 3)
- ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, ptr)
- ZEND_ARG_INFO(0, ch)
- ZEND_ARG_INFO(0, size)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_func_string, 0, 0, 1)
- ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, ptr)
- ZEND_ARG_INFO(0, size)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_func_isnull, 0, 0, 1)
- ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, ptr)
-ZEND_END_ARG_INFO()
-
static const zend_function_entry zend_ffi_functions[] = {
- ZEND_ME(FFI, cdef, arginfo_func_cdef, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- ZEND_ME(FFI, load, arginfo_func_load, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- ZEND_ME(FFI, scope, arginfo_func_scope, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- ZEND_ME(FFI, new, arginfo_func_new, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- ZEND_ME(FFI, free, arginfo_func_free, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- ZEND_ME(FFI, cast, arginfo_func_cast, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- ZEND_ME(FFI, type, arginfo_func_type, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- ZEND_ME(FFI, typeof, arginfo_func_typeof, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- ZEND_ME(FFI, arrayType, arginfo_func_array, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- ZEND_ME(FFI, addr, arginfo_func_addr, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- ZEND_ME(FFI, sizeof, arginfo_func_sizeof, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- ZEND_ME(FFI, alignof, arginfo_func_alignof, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- ZEND_ME(FFI, memcpy, arginfo_func_memcpy, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- ZEND_ME(FFI, memcmp, arginfo_func_memcmp, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- ZEND_ME(FFI, memset, arginfo_func_memset, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- ZEND_ME(FFI, string, arginfo_func_string, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- ZEND_ME(FFI, isNull, arginfo_func_isnull, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_ME(FFI, cdef, arginfo_class_FFI_cdef, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_ME(FFI, load, arginfo_class_FFI_load, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_ME(FFI, scope, arginfo_class_FFI_scope, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_ME(FFI, new, arginfo_class_FFI_new, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_ME(FFI, free, arginfo_class_FFI_free, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_ME(FFI, cast, arginfo_class_FFI_cast, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_ME(FFI, type, arginfo_class_FFI_type, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_ME(FFI, typeof, arginfo_class_FFI_typeof, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_ME(FFI, arrayType, arginfo_class_FFI_arrayType, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_ME(FFI, addr, arginfo_class_FFI_addr, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_ME(FFI, sizeof, arginfo_class_FFI_sizeof, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_ME(FFI, alignof, arginfo_class_FFI_alignof, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_ME(FFI, memcpy, arginfo_class_FFI_memcpy, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_ME(FFI, memcmp, arginfo_class_FFI_memcmp, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_ME(FFI, memset, arginfo_class_FFI_memset, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_ME(FFI, string, arginfo_class_FFI_string, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_ME(FFI, isNull, arginfo_class_FFI_isNull, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
ZEND_FE_END
};
@@ -4650,33 +4542,29 @@ static ZEND_COLD zend_never_inline void zend_bad_array_access(zend_class_entry *
}
/* }}} */
-static ZEND_COLD zval *zend_fake_read_dimension(zval *object, zval *offset, int type, zval *rv) /* {{{ */
+static ZEND_COLD zval *zend_fake_read_dimension(zend_object *obj, zval *offset, int type, zval *rv) /* {{{ */
{
- zend_class_entry *ce = Z_OBJCE_P(object);
- zend_bad_array_access(ce);
+ zend_bad_array_access(obj->ce);
return NULL;
}
/* }}} */
-static ZEND_COLD void zend_fake_write_dimension(zval *object, zval *offset, zval *value) /* {{{ */
+static ZEND_COLD void zend_fake_write_dimension(zend_object *obj, zval *offset, zval *value) /* {{{ */
{
- zend_class_entry *ce = Z_OBJCE_P(object);
- zend_bad_array_access(ce);
+ zend_bad_array_access(obj->ce);
}
/* }}} */
-static ZEND_COLD int zend_fake_has_dimension(zval *object, zval *offset, int check_empty) /* {{{ */
+static ZEND_COLD int zend_fake_has_dimension(zend_object *obj, zval *offset, int check_empty) /* {{{ */
{
- zend_class_entry *ce = Z_OBJCE_P(object);
- zend_bad_array_access(ce);
+ zend_bad_array_access(obj->ce);
return 0;
}
/* }}} */
-static ZEND_COLD void zend_fake_unset_dimension(zval *object, zval *offset) /* {{{ */
+static ZEND_COLD void zend_fake_unset_dimension(zend_object *obj, zval *offset) /* {{{ */
{
- zend_class_entry *ce = Z_OBJCE_P(object);
- zend_bad_array_access(ce);
+ zend_bad_array_access(obj->ce);
}
/* }}} */
@@ -4686,38 +4574,34 @@ static ZEND_COLD zend_never_inline void zend_bad_property_access(zend_class_entr
}
/* }}} */
-static ZEND_COLD zval *zend_fake_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) /* {{{ */
+static ZEND_COLD zval *zend_fake_read_property(zend_object *obj, zend_string *member, int type, void **cache_slot, zval *rv) /* {{{ */
{
- zend_class_entry *ce = Z_OBJCE_P(object);
- zend_bad_property_access(ce);
+ zend_bad_property_access(obj->ce);
return &EG(uninitialized_zval);
}
/* }}} */
-static ZEND_COLD zval *zend_fake_write_property(zval *object, zval *member, zval *value, void **cache_slot) /* {{{ */
+static ZEND_COLD zval *zend_fake_write_property(zend_object *obj, zend_string *member, zval *value, void **cache_slot) /* {{{ */
{
- zend_class_entry *ce = Z_OBJCE_P(object);
- zend_bad_array_access(ce);
+ zend_bad_array_access(obj->ce);
return value;
}
/* }}} */
-static ZEND_COLD int zend_fake_has_property(zval *object, zval *member, int has_set_exists, void **cache_slot) /* {{{ */
+static ZEND_COLD int zend_fake_has_property(zend_object *obj, zend_string *member, int has_set_exists, void **cache_slot) /* {{{ */
{
- zend_class_entry *ce = Z_OBJCE_P(object);
- zend_bad_array_access(ce);
+ zend_bad_array_access(obj->ce);
return 0;
}
/* }}} */
-static ZEND_COLD void zend_fake_unset_property(zval *object, zval *member, void **cache_slot) /* {{{ */
+static ZEND_COLD void zend_fake_unset_property(zend_object *obj, zend_string *member, void **cache_slot) /* {{{ */
{
- zend_class_entry *ce = Z_OBJCE_P(object);
- zend_bad_array_access(ce);
+ zend_bad_array_access(obj->ce);
}
/* }}} */
-static zval *zend_fake_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) /* {{{ */
+static zval *zend_fake_get_property_ptr_ptr(zend_object *obj, zend_string *member, int type, void **cache_slot) /* {{{ */
{
return NULL;
}
@@ -4731,13 +4615,13 @@ static ZEND_COLD zend_function *zend_fake_get_method(zend_object **obj_ptr, zend
}
/* }}} */
-static HashTable *zend_fake_get_properties(zval *object) /* {{{ */
+static HashTable *zend_fake_get_properties(zend_object *obj) /* {{{ */
{
return (HashTable*)&zend_empty_array;
}
/* }}} */
-static HashTable *zend_fake_get_gc(zval *object, zval **table, int *n) /* {{{ */
+static HashTable *zend_fake_get_gc(zend_object *ob, zval **table, int *n) /* {{{ */
{
*table = NULL;
*n = 0;
@@ -4751,74 +4635,67 @@ static ZEND_COLD zend_never_inline void zend_ffi_use_after_free(void) /* {{{ */
}
/* }}} */
-static zend_object *zend_ffi_free_clone_obj(zval *zobject) /* {{{ */
+static zend_object *zend_ffi_free_clone_obj(zend_object *obj) /* {{{ */
{
zend_ffi_use_after_free();
return NULL;
}
/* }}} */
-static ZEND_COLD zval *zend_ffi_free_read_dimension(zval *object, zval *offset, int type, zval *rv) /* {{{ */
+static ZEND_COLD zval *zend_ffi_free_read_dimension(zend_object *obj, zval *offset, int type, zval *rv) /* {{{ */
{
zend_ffi_use_after_free();
return NULL;
}
/* }}} */
-static ZEND_COLD void zend_ffi_free_write_dimension(zval *object, zval *offset, zval *value) /* {{{ */
+static ZEND_COLD void zend_ffi_free_write_dimension(zend_object *obj, zval *offset, zval *value) /* {{{ */
{
zend_ffi_use_after_free();
}
/* }}} */
-static ZEND_COLD int zend_ffi_free_has_dimension(zval *object, zval *offset, int check_empty) /* {{{ */
+static ZEND_COLD int zend_ffi_free_has_dimension(zend_object *obj, zval *offset, int check_empty) /* {{{ */
{
zend_ffi_use_after_free();
return 0;
}
/* }}} */
-static ZEND_COLD void zend_ffi_free_unset_dimension(zval *object, zval *offset) /* {{{ */
+static ZEND_COLD void zend_ffi_free_unset_dimension(zend_object *obj, zval *offset) /* {{{ */
{
zend_ffi_use_after_free();
}
/* }}} */
-static ZEND_COLD zval *zend_ffi_free_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) /* {{{ */
+static ZEND_COLD zval *zend_ffi_free_read_property(zend_object *obj, zend_string *member, int type, void **cache_slot, zval *rv) /* {{{ */
{
zend_ffi_use_after_free();
return &EG(uninitialized_zval);
}
/* }}} */
-static ZEND_COLD zval *zend_ffi_free_write_property(zval *object, zval *member, zval *value, void **cache_slot) /* {{{ */
+static ZEND_COLD zval *zend_ffi_free_write_property(zend_object *obj, zend_string *member, zval *value, void **cache_slot) /* {{{ */
{
zend_ffi_use_after_free();
return value;
}
/* }}} */
-static ZEND_COLD int zend_ffi_free_has_property(zval *object, zval *member, int has_set_exists, void **cache_slot) /* {{{ */
+static ZEND_COLD int zend_ffi_free_has_property(zend_object *obj, zend_string *member, int has_set_exists, void **cache_slot) /* {{{ */
{
zend_ffi_use_after_free();
return 0;
}
/* }}} */
-static ZEND_COLD void zend_ffi_free_unset_property(zval *object, zval *member, void **cache_slot) /* {{{ */
-{
- zend_ffi_use_after_free();
-}
-/* }}} */
-
-static zval* zend_ffi_free_get(zval *object, zval *rv) /* {{{ */
+static ZEND_COLD void zend_ffi_free_unset_property(zend_object *obj, zend_string *member, void **cache_slot) /* {{{ */
{
zend_ffi_use_after_free();
- return NULL;
}
/* }}} */
-static HashTable *zend_ffi_free_get_debug_info(zval *object, int *is_temp) /* {{{ */
+static HashTable *zend_ffi_free_get_debug_info(zend_object *obj, int *is_temp) /* {{{ */
{
zend_ffi_use_after_free();
return NULL;
@@ -5003,7 +4880,7 @@ ZEND_MINIT_FUNCTION(ffi)
zend_ffi_handlers.has_dimension = zend_fake_has_dimension;
zend_ffi_handlers.unset_dimension = zend_fake_unset_dimension;
zend_ffi_handlers.get_method = zend_ffi_get_func;
- zend_ffi_handlers.compare_objects = NULL;
+ zend_ffi_handlers.compare = NULL;
zend_ffi_handlers.cast_object = NULL;
zend_ffi_handlers.get_debug_info = NULL;
zend_ffi_handlers.get_closure = NULL;
@@ -5034,7 +4911,7 @@ ZEND_MINIT_FUNCTION(ffi)
zend_ffi_cdata_handlers.get_method = zend_fake_get_method;
zend_ffi_cdata_handlers.get_class_name = zend_ffi_cdata_get_class_name;
zend_ffi_cdata_handlers.do_operation = zend_ffi_cdata_do_operation;
- zend_ffi_cdata_handlers.compare_objects = zend_ffi_cdata_compare_objects;
+ zend_ffi_cdata_handlers.compare = zend_ffi_cdata_compare_objects;
zend_ffi_cdata_handlers.cast_object = zend_ffi_cdata_cast_object;
zend_ffi_cdata_handlers.count_elements = zend_ffi_cdata_count_elements;
zend_ffi_cdata_handlers.get_debug_info = zend_ffi_cdata_get_debug_info;
@@ -5057,7 +4934,7 @@ ZEND_MINIT_FUNCTION(ffi)
zend_ffi_cdata_value_handlers.unset_dimension = zend_fake_unset_dimension;
zend_ffi_cdata_value_handlers.get_method = zend_fake_get_method;
zend_ffi_cdata_value_handlers.get_class_name = zend_ffi_cdata_get_class_name;
- zend_ffi_cdata_value_handlers.compare_objects = zend_ffi_cdata_compare_objects;
+ zend_ffi_cdata_value_handlers.compare = zend_ffi_cdata_compare_objects;
zend_ffi_cdata_value_handlers.cast_object = zend_ffi_cdata_cast_object;
zend_ffi_cdata_value_handlers.count_elements = NULL;
zend_ffi_cdata_value_handlers.get_debug_info = zend_ffi_cdata_get_debug_info;
@@ -5074,14 +4951,13 @@ ZEND_MINIT_FUNCTION(ffi)
zend_ffi_cdata_free_handlers.read_dimension = zend_ffi_free_read_dimension;
zend_ffi_cdata_free_handlers.write_dimension = zend_ffi_free_write_dimension;
zend_ffi_cdata_free_handlers.get_property_ptr_ptr = zend_fake_get_property_ptr_ptr;
- zend_ffi_cdata_free_handlers.get = zend_ffi_free_get;
zend_ffi_cdata_free_handlers.has_property = zend_ffi_free_has_property;
zend_ffi_cdata_free_handlers.unset_property = zend_ffi_free_unset_property;
zend_ffi_cdata_free_handlers.has_dimension = zend_ffi_free_has_dimension;
zend_ffi_cdata_free_handlers.unset_dimension = zend_ffi_free_unset_dimension;
zend_ffi_cdata_free_handlers.get_method = zend_fake_get_method;
zend_ffi_cdata_free_handlers.get_class_name = zend_ffi_cdata_get_class_name;
- zend_ffi_cdata_free_handlers.compare_objects = zend_ffi_cdata_compare_objects;
+ zend_ffi_cdata_free_handlers.compare = zend_ffi_cdata_compare_objects;
zend_ffi_cdata_free_handlers.cast_object = NULL;
zend_ffi_cdata_free_handlers.count_elements = NULL;
zend_ffi_cdata_free_handlers.get_debug_info = zend_ffi_free_get_debug_info;
@@ -5111,7 +4987,7 @@ ZEND_MINIT_FUNCTION(ffi)
zend_ffi_ctype_handlers.unset_dimension = zend_fake_unset_dimension;
zend_ffi_ctype_handlers.get_method = zend_fake_get_method;
zend_ffi_ctype_handlers.get_class_name = zend_ffi_ctype_get_class_name;
- zend_ffi_ctype_handlers.compare_objects = zend_ffi_ctype_compare_objects;
+ zend_ffi_ctype_handlers.compare = zend_ffi_ctype_compare_objects;
zend_ffi_ctype_handlers.cast_object = NULL;
zend_ffi_ctype_handlers.count_elements = NULL;
zend_ffi_ctype_handlers.get_debug_info = zend_ffi_ctype_get_debug_info;
@@ -5636,7 +5512,7 @@ static int zend_ffi_validate_prev_field_type(zend_ffi_type *struct_type) /* {{{
break;
} ZEND_HASH_FOREACH_END();
if (ZEND_FFI_TYPE(field->type)->attr & ZEND_FFI_ATTR_INCOMPLETE_ARRAY) {
- zend_ffi_throw_parser_error("flexible array member not at end of struct at line %d", FFI_G(line));
+ zend_ffi_throw_parser_error("Flexible array member not at end of struct at line %d", FFI_G(line));
return FAILURE;
}
}
@@ -5647,13 +5523,13 @@ static int zend_ffi_validate_prev_field_type(zend_ffi_type *struct_type) /* {{{
static int zend_ffi_validate_field_type(zend_ffi_type *type, zend_ffi_type *struct_type) /* {{{ */
{
if (type == struct_type) {
- zend_ffi_throw_parser_error("struct/union can't contain an instance of itself at line %d", FFI_G(line));
+ zend_ffi_throw_parser_error("Struct/union can't contain an instance of itself at line %d", FFI_G(line));
return FAILURE;
} else if (zend_ffi_validate_var_type(type, 1) != SUCCESS) {
return FAILURE;
} else if (struct_type->attr & ZEND_FFI_ATTR_UNION) {
if (type->attr & ZEND_FFI_ATTR_INCOMPLETE_ARRAY) {
- zend_ffi_throw_parser_error("flexible array member in union at line %d", FFI_G(line));
+ zend_ffi_throw_parser_error("Flexible array member in union at line %d", FFI_G(line));
return FAILURE;
}
}
@@ -5913,10 +5789,10 @@ void zend_ffi_make_pointer_type(zend_ffi_dcl *dcl) /* {{{ */
static int zend_ffi_validate_array_element_type(zend_ffi_type *type) /* {{{ */
{
if (type->kind == ZEND_FFI_TYPE_FUNC) {
- zend_ffi_throw_parser_error("array of functions is not allowed at line %d", FFI_G(line));
+ zend_ffi_throw_parser_error("Array of functions is not allowed at line %d", FFI_G(line));
return FAILURE;
} else if (type->kind == ZEND_FFI_TYPE_ARRAY && (type->attr & ZEND_FFI_ATTR_INCOMPLETE_ARRAY)) {
- zend_ffi_throw_parser_error("only the leftmost array can be undimensioned at line %d", FFI_G(line));
+ zend_ffi_throw_parser_error("Only the leftmost array can be undimensioned at line %d", FFI_G(line));
return FAILURE;
}
return zend_ffi_validate_type(type, 0, 1);
@@ -5973,10 +5849,10 @@ void zend_ffi_make_array_type(zend_ffi_dcl *dcl, zend_ffi_val *len) /* {{{ */
static int zend_ffi_validate_func_ret_type(zend_ffi_type *type) /* {{{ */
{
if (type->kind == ZEND_FFI_TYPE_FUNC) {
- zend_ffi_throw_parser_error("function returning function is not allowed at line %d", FFI_G(line));
+ zend_ffi_throw_parser_error("Function returning function is not allowed at line %d", FFI_G(line));
return FAILURE;
} else if (type->kind == ZEND_FFI_TYPE_ARRAY) {
- zend_ffi_throw_parser_error("function returning array is not allowed at line %d", FFI_G(line));
+ zend_ffi_throw_parser_error("Function returning array is not allowed at line %d", FFI_G(line));
return FAILURE;
}
return zend_ffi_validate_incomplete_type(type, 1, 0);
@@ -6110,7 +5986,7 @@ void zend_ffi_make_func_type(zend_ffi_dcl *dcl, HashTable *args, zend_ffi_dcl *n
}
type->func.args = NULL;
_zend_ffi_type_dtor(type);
- zend_ffi_parser_error("unsupported calling convention line %d", FFI_G(line));
+ zend_ffi_parser_error("Unsupported calling convention line %d", FFI_G(line));
break;
}
type->func.args = args;
diff --git a/ext/ffi/ffi.g b/ext/ffi/ffi.g
index 68c002df84..4d7c003906 100644
--- a/ext/ffi/ffi.g
+++ b/ext/ffi/ffi.g
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -32,8 +30,6 @@ php llk.php ffi.g
%{
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/ffi/ffi.stub.php b/ext/ffi/ffi.stub.php
new file mode 100644
index 0000000000..ff73d2e124
--- /dev/null
+++ b/ext/ffi/ffi.stub.php
@@ -0,0 +1,96 @@
+<?php
+
+class FFI
+{
+ /** @return ?FFI */
+ static function cdef(string $code = UNKNOWN, string $lib = UNKNOWN) {}
+
+ /** @return ?FFI */
+ static function load(string $filename) {}
+
+ /** @return ?FFI */
+ static function scope(string $scope_name) {}
+
+ /**
+ * @param FFI\CType|string $type
+ * @return ?FFI\CData
+ */
+ static function new($type, bool $owned = true, bool $persistent = false) {}
+
+ /**
+ * @prefer-ref $ptr
+ * @return void
+ */
+ static function free(FFI\CData $ptr) {}
+
+ /**
+ * @param FFI\CType|string $type
+ * @prefer-ref $ptr
+ * @return ?FFI\CData
+ */
+ static function cast($type, $ptr) {}
+
+ /** @return ?FFI\CType */
+ static function type(string $type) {}
+
+ /**
+ * @prefer-ref $ptr
+ * @return FFI\CType
+ */
+ static function typeof(FFI\CData $ptr) {}
+
+ /** @return ?FFI\CType */
+ static function arrayType(FFI\CType $type, array $dims) {}
+
+ /**
+ * @prefer-ref $ptr
+ * @return FFI\CData
+ */
+ static function addr(FFI\CData $ptr) {}
+
+ /**
+ * @prefer-ref $ptr
+ * @return ?int
+ */
+ static function sizeof(object $ptr) {}
+
+ /**
+ * @prefer-ref $ptr
+ * @return ?int
+ */
+ static function alignof(object $ptr) {}
+
+ /**
+ * @prefer-ref $dst
+ * @prefer-ref $src
+ * @param string|FFI\CData $dst
+ * @return void
+ */
+ static function memcpy(FFI\CData $dst, $src, int $size) {}
+
+ /**
+ * @prefer-ref $ptr1
+ * @param string|FFI\CData $ptr1
+ * @prefer-ref $ptr2
+ * @param string|FFI\CData $ptr2
+ * @return ?int
+ */
+ static function memcmp($ptr1, $ptr2, int $size) {}
+
+ /**
+ * @prefer-ref $ptr
+ * @return void
+ */
+ static function memset(FFI\CData $ptr, int $ch, int $size) {}
+
+ /**
+ * @prefer-ref $ptr
+ * @return ?string
+ */
+ static function string(FFI\CData $ptr, int $size = UNKNOWN) {}
+
+ /**
+ * @prefer-ref $ptr
+ */
+ static function isNull(FFI\CData $ptr) {}
+}
diff --git a/ext/ffi/ffi_arginfo.h b/ext/ffi/ffi_arginfo.h
new file mode 100644
index 0000000000..48fc90c2cd
--- /dev/null
+++ b/ext/ffi/ffi_arginfo.h
@@ -0,0 +1,73 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_FFI_cdef, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, code, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, lib, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_FFI_load, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_FFI_scope, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, scope_name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_FFI_new, 0, 0, 1)
+ ZEND_ARG_INFO(0, type)
+ ZEND_ARG_TYPE_INFO(0, owned, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, persistent, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_FFI_free, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(ZEND_SEND_PREFER_REF, ptr, FFI\\CData, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_FFI_cast, 0, 0, 2)
+ ZEND_ARG_INFO(0, type)
+ ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, ptr)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_FFI_type, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, type, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_FFI_typeof arginfo_class_FFI_free
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_FFI_arrayType, 0, 0, 2)
+ ZEND_ARG_OBJ_INFO(0, type, FFI\\CType, 0)
+ ZEND_ARG_TYPE_INFO(0, dims, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_FFI_addr arginfo_class_FFI_free
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_FFI_sizeof, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(ZEND_SEND_PREFER_REF, ptr, IS_OBJECT, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_FFI_alignof arginfo_class_FFI_sizeof
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_FFI_memcpy, 0, 0, 3)
+ ZEND_ARG_OBJ_INFO(ZEND_SEND_PREFER_REF, dst, FFI\\CData, 0)
+ ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, src)
+ ZEND_ARG_TYPE_INFO(0, size, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_FFI_memcmp, 0, 0, 3)
+ ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, ptr1)
+ ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, ptr2)
+ ZEND_ARG_TYPE_INFO(0, size, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_FFI_memset, 0, 0, 3)
+ ZEND_ARG_OBJ_INFO(ZEND_SEND_PREFER_REF, ptr, FFI\\CData, 0)
+ ZEND_ARG_TYPE_INFO(0, ch, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, size, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_FFI_string, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(ZEND_SEND_PREFER_REF, ptr, FFI\\CData, 0)
+ ZEND_ARG_TYPE_INFO(0, size, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_FFI_isNull arginfo_class_FFI_free
diff --git a/ext/ffi/ffi_parser.c b/ext/ffi/ffi_parser.c
index efb0cf96ca..03d05eb6d9 100644
--- a/ext/ffi/ffi_parser.c
+++ b/ext/ffi/ffi_parser.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/ffi/php_ffi.h b/ext/ffi/php_ffi.h
index 913d63ecd0..fc6120de79 100644
--- a/ext/ffi/php_ffi.h
+++ b/ext/ffi/php_ffi.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/ffi/tests/002.phpt b/ext/ffi/tests/002.phpt
index 62cb9182c4..353f36139c 100644
--- a/ext/ffi/tests/002.phpt
+++ b/ext/ffi/tests/002.phpt
@@ -14,117 +14,117 @@ echo " ok\n";
echo "Various declarations\n";
$ffi = FFI::cdef(<<<EOF
- /* allowed storage classes */
- typedef int type1;
+ /* allowed storage classes */
+ typedef int type1;
// extern int var2;
- static int var3;
- auto int var4;
- register int var5;
+ static int var3;
+ auto int var4;
+ register int var5;
- /* allowed types */
- typedef void type6;
- typedef char type7; /* sint8_t or uint8_t */
- typedef signed char type8; /* sint8_t */
- typedef unsigned char type9; /* uint8_t */
- typedef short type10; /* sint16_t */
- typedef signed short type11; /* sint16_t */
- typedef short int type12; /* sint16_t */
- typedef signed short int type13; /* sint16_t */
- typedef unsigned short type14; /* uint16_t */
- typedef unsigned short int type15; /* uint16_t */
- typedef int type16; /* sint32_t */
- typedef signed type17; /* sint32_t */
- typedef signed int type18; /* sint32_t */
- typedef unsigned type19; /* uint32_t */
- typedef unsigned int type20; /* uint32_t */
- typedef long type21; /* sint32_t or sint64_t */
- typedef signed long type22; /* sint32_t or sint64_t */
- typedef long int type23; /* sint32_t or sint64_t */
- typedef signed long int type24; /* sint32_t or sint64_t */
- typedef unsigned long type25; /* uint32_t or uint64_t */
- typedef unsigned long int type25_2; /* uint32_t or uint64_t */
- typedef long long type26; /* sint64_t */
- typedef signed long long type27; /* sint64_t */
- typedef long long int type28; /* sint64_t */
- typedef signed long long int type29; /* sint64_t */
- typedef unsigned long long type30; /* uint64_t */
- typedef unsigned long long int type31; /* uint64_t */
- typedef float type32;
- typedef double type33;
- typedef long double type34;
- typedef _Bool type35;
+ /* allowed types */
+ typedef void type6;
+ typedef char type7; /* sint8_t or uint8_t */
+ typedef signed char type8; /* sint8_t */
+ typedef unsigned char type9; /* uint8_t */
+ typedef short type10; /* sint16_t */
+ typedef signed short type11; /* sint16_t */
+ typedef short int type12; /* sint16_t */
+ typedef signed short int type13; /* sint16_t */
+ typedef unsigned short type14; /* uint16_t */
+ typedef unsigned short int type15; /* uint16_t */
+ typedef int type16; /* sint32_t */
+ typedef signed type17; /* sint32_t */
+ typedef signed int type18; /* sint32_t */
+ typedef unsigned type19; /* uint32_t */
+ typedef unsigned int type20; /* uint32_t */
+ typedef long type21; /* sint32_t or sint64_t */
+ typedef signed long type22; /* sint32_t or sint64_t */
+ typedef long int type23; /* sint32_t or sint64_t */
+ typedef signed long int type24; /* sint32_t or sint64_t */
+ typedef unsigned long type25; /* uint32_t or uint64_t */
+ typedef unsigned long int type25_2; /* uint32_t or uint64_t */
+ typedef long long type26; /* sint64_t */
+ typedef signed long long type27; /* sint64_t */
+ typedef long long int type28; /* sint64_t */
+ typedef signed long long int type29; /* sint64_t */
+ typedef unsigned long long type30; /* uint64_t */
+ typedef unsigned long long int type31; /* uint64_t */
+ typedef float type32;
+ typedef double type33;
+ typedef long double type34;
+ typedef _Bool type35;
// typedef float _Complex type36;
// typedef double _Complex type36_2;
// typedef long double _Complex type36_3;
- /* struct and union */
- struct tag1;
- union tag2;
- typedef struct tag1 {int x; int y;} type37;
- typedef union tag2 {int x; int y;} type38;
- typedef struct {int x, y; int z;} type39;
- typedef struct {unsigned int x:8, y:8;} type40;
- typedef struct {unsigned int x:8, :8, y:8;} type41;
+ /* struct and union */
+ struct tag1;
+ union tag2;
+ typedef struct tag1 {int x; int y;} type37;
+ typedef union tag2 {int x; int y;} type38;
+ typedef struct {int x, y; int z;} type39;
+ typedef struct {unsigned int x:8, y:8;} type40;
+ typedef struct {unsigned int x:8, :8, y:8;} type41;
- /* enum */
- enum tag3;
- typedef enum tag3 {A,B,C} type42;
- typedef enum {D,E=10,F,} type43;
+ /* enum */
+ enum tag3;
+ typedef enum tag3 {A,B,C} type42;
+ typedef enum {D,E=10,F,} type43;
- /* type qualifiers */
- typedef void* type46;
- typedef const void* type47;
- typedef restrict void* type48;
- typedef volatile void* type49;
- typedef _Atomic void* type50;
- typedef const volatile void* type51;
+ /* type qualifiers */
+ typedef void* type46;
+ typedef const void* type47;
+ typedef restrict void* type48;
+ typedef volatile void* type49;
+ typedef _Atomic void* type50;
+ typedef const volatile void* type51;
- /* function specifiers */
- static void f1();
- static inline void f2();
- static _Noreturn void f3();
+ /* function specifiers */
+ static void f1();
+ static inline void f2();
+ static _Noreturn void f3();
- /* align specifier */
- typedef double _Alignas(char) type52;
- typedef double _Alignas(1) type53;
+ /* align specifier */
+ typedef double _Alignas(char) type52;
+ typedef double _Alignas(1) type53;
- /* pointers */
- typedef void * type54;
- typedef void ** type55;
- typedef const void * const volatile * const type56;
+ /* pointers */
+ typedef void * type54;
+ typedef void ** type55;
+ typedef const void * const volatile * const type56;
- /* arrays */
- typedef char type57[];
- typedef char type58[const];
- typedef char type59[const volatile];
- typedef char type60[10];
- typedef char type61[const 10];
- typedef char type62[static 10];
- typedef char type63[static const volatile 10];
- typedef char type64[const volatile static 10];
- typedef char type65[];
- typedef char type66[const volatile];
- typedef char type67[10][10];
+ /* arrays */
+ typedef char type57[];
+ typedef char type58[const];
+ typedef char type59[const volatile];
+ typedef char type60[10];
+ typedef char type61[const 10];
+ typedef char type62[static 10];
+ typedef char type63[static const volatile 10];
+ typedef char type64[const volatile static 10];
+ typedef char type65[];
+ typedef char type66[const volatile];
+ typedef char type67[10][10];
- /* functions */
- static void f4();
- static void f5(void);
- static void f6(int x);
- static void f7(int x, int y);
- static void f8(int x, int y, ...);
- static void f9(int, int);
- static void f9(int, int, ...);
- static void f10(...);
- static void f11(const char *name);
- static void f12(const char *);
- static void f13(const int a[5]);
- static void f14(const int[5]);
+ /* functions */
+ static void f4();
+ static void f5(void);
+ static void f6(int x);
+ static void f7(int x, int y);
+ static void f8(int x, int y, ...);
+ static void f9(int, int);
+ static void f9(int, int, ...);
+ static void f10(...);
+ static void f11(const char *name);
+ static void f12(const char *);
+ static void f13(const int a[5]);
+ static void f14(const int[5]);
- /* nested */
- typedef int *type69[4];
- typedef int (*type70)[4];
- typedef int (*type71[3])(int *x, int *y);
- typedef int (*type72(int (*)(long), int))(int, ...);
+ /* nested */
+ typedef int *type69[4];
+ typedef int (*type70)[4];
+ typedef int (*type71[3])(int *x, int *y);
+ typedef int (*type72(int (*)(long), int))(int, ...);
EOF
);
echo " ok\n";
diff --git a/ext/ffi/tests/003.phpt b/ext/ffi/tests/003.phpt
index d52e235644..efe88b31f3 100644
--- a/ext/ffi/tests/003.phpt
+++ b/ext/ffi/tests/003.phpt
@@ -30,14 +30,14 @@ var_dump($ffi->new("struct _b"));
var_dump($ffi->new("c"));
var_dump($ffi->new("d"));
try {
- var_dump($ffi->new("struct _e"));
+ var_dump($ffi->new("struct _e"));
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- var_dump($ffi->new("f"));
+ var_dump($ffi->new("f"));
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
echo "ok\n";
?>
@@ -58,6 +58,6 @@ object(FFI\CData:struct _d)#%d (1) {
["x"]=>
int(0)
}
-FFI\ParserException: incomplete 'struct _e' at line 1
-FFI\ParserException: incomplete 'struct _f' at line 1
+FFI\ParserException: Incomplete 'struct _e' at line 1
+FFI\ParserException: Incomplete 'struct _f' at line 1
ok
diff --git a/ext/ffi/tests/004.phpt b/ext/ffi/tests/004.phpt
index e914b604ac..f5ad02098c 100644
--- a/ext/ffi/tests/004.phpt
+++ b/ext/ffi/tests/004.phpt
@@ -25,10 +25,10 @@ enum _f;
typedef enum _f f;
enum _g {
- _c1,
- _c2,
- _c3 = 1,
- _c4,
+ _c1,
+ _c2,
+ _c3 = 1,
+ _c4,
};
EOF
);
@@ -40,14 +40,14 @@ var_dump($ffi->new("int[_c2]"));
var_dump($ffi->new("int[_c3]"));
var_dump($ffi->new("int[_c4]"));
try {
- var_dump($ffi->new("enum _e"));
+ var_dump($ffi->new("enum _e"));
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- var_dump($ffi->new("f"));
+ var_dump($ffi->new("f"));
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
echo "ok\n";
?>
@@ -82,6 +82,6 @@ object(FFI\CData:int32_t[2])#%d (2) {
[1]=>
int(0)
}
-FFI\ParserException: incomplete 'enum _e' at line 1
-FFI\ParserException: incomplete 'enum _f' at line 1
+FFI\ParserException: Incomplete 'enum _e' at line 1
+FFI\ParserException: Incomplete 'enum _f' at line 1
ok
diff --git a/ext/ffi/tests/008.phpt b/ext/ffi/tests/008.phpt
index fa3991abee..602468d1e5 100644
--- a/ext/ffi/tests/008.phpt
+++ b/ext/ffi/tests/008.phpt
@@ -11,22 +11,22 @@ $a[1] = 10;
$a[2] = 20;
var_dump(count($a));
foreach ($a as $key => $val) {
- echo "$key => $val\n";
+ echo "$key => $val\n";
}
$a = FFI::new("struct {int x,y;}");
try {
- var_dump(count($a));
+ var_dump(count($a));
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- foreach ($a as $key => $val) {
- echo "$key => $val\n";
- }
+ foreach ($a as $key => $val) {
+ echo "$key => $val\n";
+ }
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
?>
--EXPECT--
diff --git a/ext/ffi/tests/012.phpt b/ext/ffi/tests/012.phpt
index 35686191e1..6623bf7368 100644
--- a/ext/ffi/tests/012.phpt
+++ b/ext/ffi/tests/012.phpt
@@ -7,9 +7,9 @@ ffi.enable=1
--FILE--
<?php
try {
- var_dump(serialize(FFI::new("int[2]")));
+ var_dump(serialize(FFI::new("int[2]")));
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
?>
--EXPECT--
diff --git a/ext/ffi/tests/013.phpt b/ext/ffi/tests/013.phpt
index 3e4c4d6fca..cfc1e85eb0 100644
--- a/ext/ffi/tests/013.phpt
+++ b/ext/ffi/tests/013.phpt
@@ -12,45 +12,45 @@ var_dump(count($a[0]));
var_dump(count($a[0][0]));
try {
- var_dump(FFI::new("void"));
+ var_dump(FFI::new("void"));
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- var_dump(FFI::new("void[1]"));
+ var_dump(FFI::new("void[1]"));
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- FFI::cdef("static int foo(int)[5];");
- echo "ok\n";
+ FFI::cdef("static int foo(int)[5];");
+ echo "ok\n";
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- FFI::cdef("static int foo[5](int);");
- echo "ok\n";
+ FFI::cdef("static int foo[5](int);");
+ echo "ok\n";
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- FFI::cdef("static int foo(int)(int);");
- echo "ok\n";
+ FFI::cdef("static int foo(int)(int);");
+ echo "ok\n";
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- FFI::cdef("typedef int foo[2][];");
- echo "ok\n";
+ FFI::cdef("typedef int foo[2][];");
+ echo "ok\n";
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- FFI::cdef("typedef int foo[][2];");
- echo "ok\n";
+ FFI::cdef("typedef int foo[][2];");
+ echo "ok\n";
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
?>
--EXPECT--
@@ -59,8 +59,8 @@ int(2)
int(3)
FFI\ParserException: 'void' type is not allowed at line 1
FFI\ParserException: 'void' type is not allowed at line 1
-FFI\ParserException: function returning array is not allowed at line 1
-FFI\ParserException: array of functions is not allowed at line 1
-FFI\ParserException: function returning function is not allowed at line 1
-FFI\ParserException: only the leftmost array can be undimensioned at line 1
+FFI\ParserException: Function returning array is not allowed at line 1
+FFI\ParserException: Array of functions is not allowed at line 1
+FFI\ParserException: Function returning function is not allowed at line 1
+FFI\ParserException: Only the leftmost array can be undimensioned at line 1
ok
diff --git a/ext/ffi/tests/015.phpt b/ext/ffi/tests/015.phpt
index 524ac95030..7b710c1dc0 100644
--- a/ext/ffi/tests/015.phpt
+++ b/ext/ffi/tests/015.phpt
@@ -7,59 +7,59 @@ ffi.enable=1
--FILE--
<?php
try {
- FFI::cdef("struct DIR; static struct DIR dir;");
- echo "ok\n";
+ FFI::cdef("struct DIR; static struct DIR dir;");
+ echo "ok\n";
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- FFI::cdef("struct DIR; static struct DIR *ptr;");
- echo "ok\n";
+ FFI::cdef("struct DIR; static struct DIR *ptr;");
+ echo "ok\n";
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- FFI::cdef("struct DIR; typedef struct DIR DIR; static DIR dir;");
- echo "ok\n";
+ FFI::cdef("struct DIR; typedef struct DIR DIR; static DIR dir;");
+ echo "ok\n";
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- FFI::cdef("struct DIR; typedef struct DIR DIR; static DIR *ptr;");
- echo "ok\n";
+ FFI::cdef("struct DIR; typedef struct DIR DIR; static DIR *ptr;");
+ echo "ok\n";
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- FFI::cdef("struct DIR; static struct DIR foo();");
- echo "ok\n";
+ FFI::cdef("struct DIR; static struct DIR foo();");
+ echo "ok\n";
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- FFI::cdef("struct DIR; static struct DIR* foo();");
- echo "ok\n";
+ FFI::cdef("struct DIR; static struct DIR* foo();");
+ echo "ok\n";
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- FFI::cdef("struct DIR; static void foo(struct DIR);");
- echo "ok\n";
+ FFI::cdef("struct DIR; static void foo(struct DIR);");
+ echo "ok\n";
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- FFI::cdef("struct DIR; static void foo(struct DIR*);");
- echo "ok\n";
+ FFI::cdef("struct DIR; static void foo(struct DIR*);");
+ echo "ok\n";
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
?>
ok
--EXPECT--
-FFI\ParserException: incomplete 'struct DIR' at line 1
+FFI\ParserException: Incomplete 'struct DIR' at line 1
ok
-FFI\ParserException: incomplete 'struct DIR' at line 1
+FFI\ParserException: Incomplete 'struct DIR' at line 1
ok
ok
ok
diff --git a/ext/ffi/tests/016.phpt b/ext/ffi/tests/016.phpt
index 857780b80c..2ca8363fbd 100644
--- a/ext/ffi/tests/016.phpt
+++ b/ext/ffi/tests/016.phpt
@@ -7,27 +7,27 @@ ffi.enable=1
--FILE--
<?php
try {
- FFI::cdef("struct X {void x();};");
- echo "ok\n";
+ FFI::cdef("struct X {void x();};");
+ echo "ok\n";
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- FFI::cdef("struct X {struct X x;};");
- echo "ok\n";
+ FFI::cdef("struct X {struct X x;};");
+ echo "ok\n";
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- FFI::cdef("struct X {struct X *ptr;};");
- echo "ok\n";
+ FFI::cdef("struct X {struct X *ptr;};");
+ echo "ok\n";
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
?>
ok
--EXPECT--
FFI\ParserException: 'function' type is not allowed at line 1
-FFI\ParserException: struct/union can't contain an instance of itself at line 1
+FFI\ParserException: Struct/union can't contain an instance of itself at line 1
ok
ok
diff --git a/ext/ffi/tests/017.phpt b/ext/ffi/tests/017.phpt
index 718b078bc7..02b917ff2b 100644
--- a/ext/ffi/tests/017.phpt
+++ b/ext/ffi/tests/017.phpt
@@ -7,25 +7,25 @@ ffi.enable=1
--FILE--
<?php
try {
- var_dump(FFI::new("struct X {void x();}"));
+ var_dump(FFI::new("struct X {void x();}"));
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- var_dump(FFI::new("struct X {struct X x;}"));
+ var_dump(FFI::new("struct X {struct X x;}"));
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- var_dump(FFI::new("struct X {struct X *ptr;}"));
+ var_dump(FFI::new("struct X {struct X *ptr;}"));
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
?>
ok
--EXPECTF--
FFI\ParserException: 'function' type is not allowed at line 1
-FFI\ParserException: struct/union can't contain an instance of itself at line 1
+FFI\ParserException: Struct/union can't contain an instance of itself at line 1
object(FFI\CData:struct X)#%d (1) {
["ptr"]=>
NULL
diff --git a/ext/ffi/tests/018.phpt b/ext/ffi/tests/018.phpt
index 9e7c124384..f48367bc71 100644
--- a/ext/ffi/tests/018.phpt
+++ b/ext/ffi/tests/018.phpt
@@ -7,20 +7,20 @@ ffi.enable=1
--FILE--
<?php
try {
- FFI::cdef("struct X {struct X x[2];};");
- echo "ok\n";
+ FFI::cdef("struct X {struct X x[2];};");
+ echo "ok\n";
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- FFI::cdef("struct X {struct X *ptr[2];};");
- echo "ok\n";
+ FFI::cdef("struct X {struct X *ptr[2];};");
+ echo "ok\n";
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
?>
ok
--EXPECT--
-FFI\ParserException: incomplete 'struct X' at line 1
+FFI\ParserException: Incomplete 'struct X' at line 1
ok
ok
diff --git a/ext/ffi/tests/019.phpt b/ext/ffi/tests/019.phpt
index 792db2ef56..80dcfa0ff9 100644
--- a/ext/ffi/tests/019.phpt
+++ b/ext/ffi/tests/019.phpt
@@ -7,16 +7,16 @@ ffi.enable=1
--FILE--
<?php
try {
- FFI::cdef("static int foo(int[]);");
- echo "ok\n";
+ FFI::cdef("static int foo(int[]);");
+ echo "ok\n";
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- FFI::cdef("static int foo(int bar(int));");
- echo "ok\n";
+ FFI::cdef("static int foo(int bar(int));");
+ echo "ok\n";
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
?>
ok
diff --git a/ext/ffi/tests/020.phpt b/ext/ffi/tests/020.phpt
index 15660250cc..7aca9425a8 100644
--- a/ext/ffi/tests/020.phpt
+++ b/ext/ffi/tests/020.phpt
@@ -7,56 +7,56 @@ ffi.enable=1
--FILE--
<?php
try {
- $p = FFI::new("struct {int x; const int y;}");
- $p->x = 1;
- $p->y = 1;
- echo "ok\n";
+ $p = FFI::new("struct {int x; const int y;}");
+ $p->x = 1;
+ $p->y = 1;
+ echo "ok\n";
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- $p = FFI::new("struct {const int x; int y;}");
- $p->y = 1;
- $p->x = 1;
- echo "ok\n";
+ $p = FFI::new("struct {const int x; int y;}");
+ $p->y = 1;
+ $p->x = 1;
+ echo "ok\n";
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- $p = FFI::new("const struct {int x; int y;}");
- $p->x = 1;
- echo "ok\n";
+ $p = FFI::new("const struct {int x; int y;}");
+ $p->x = 1;
+ echo "ok\n";
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- $p = FFI::new("const int[10]");
- $p[1] = 1;
- echo "ok\n";
+ $p = FFI::new("const int[10]");
+ $p[1] = 1;
+ echo "ok\n";
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- $p = FFI::new("const int * [1]");
- $p[0] = null;
- echo "ok\n";
+ $p = FFI::new("const int * [1]");
+ $p[0] = null;
+ echo "ok\n";
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- $p = FFI::new("int * const [1]");
- $p[0] = null;
- echo "ok\n";
+ $p = FFI::new("int * const [1]");
+ $p[0] = null;
+ echo "ok\n";
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- $f = FFI::cdef("typedef int * const t[1];");
- $p = $f->new("t");
- $p[0] = null;
- echo "ok\n";
+ $f = FFI::cdef("typedef int * const t[1];");
+ $p = $f->new("t");
+ $p[0] = null;
+ echo "ok\n";
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
?>
ok
diff --git a/ext/ffi/tests/021.phpt b/ext/ffi/tests/021.phpt
index c76a1daf75..d02836c5f4 100644
--- a/ext/ffi/tests/021.phpt
+++ b/ext/ffi/tests/021.phpt
@@ -7,9 +7,9 @@ ffi.enable=1
--FILE--
<?php
function test($size, $type) {
- if (FFI::sizeof(FFI::new($type)) !== $size) {
- echo "FAIL: sizeof($type) != $size\n";
- }
+ if (FFI::sizeof(FFI::new($type)) !== $size) {
+ echo "FAIL: sizeof($type) != $size\n";
+ }
}
test(4, "enum {a1, b1}");
diff --git a/ext/ffi/tests/022.phpt b/ext/ffi/tests/022.phpt
index a1c009dce8..9e5bb915e1 100644
--- a/ext/ffi/tests/022.phpt
+++ b/ext/ffi/tests/022.phpt
@@ -7,15 +7,15 @@ ffi.enable=1
--FILE--
<?php
function test_size($size, $type) {
- if (FFI::sizeof(FFI::new($type)) !== $size) {
- echo "FAIL: sizeof($type) != $size\n";
- }
+ if (FFI::sizeof(FFI::new($type)) !== $size) {
+ echo "FAIL: sizeof($type) != $size\n";
+ }
}
function test_align($align, $type) {
- if (FFI::alignof(FFI::new($type)) !== $align) {
- echo "FAIL: alignof($type) != $align\n";
- }
+ if (FFI::alignof(FFI::new($type)) !== $align) {
+ echo "FAIL: alignof($type) != $align\n";
+ }
}
test_size(8, "struct {uint32_t a; uint32_t b;}");
@@ -61,8 +61,8 @@ test_size(32, "struct {char a; uint32_t b __attribute__((aligned(16)));}");
test_align(16, "struct {char a; uint32_t b __attribute__((aligned(16)));}");
if (substr(PHP_OS, 0, 3) != 'WIN') {
- test_size(32, "struct {char a; uint32_t b __attribute__((aligned));}");
- test_align(16, "struct {char a; uint32_t b __attribute__((aligned));}");
+ test_size(32, "struct {char a; uint32_t b __attribute__((aligned));}");
+ test_align(16, "struct {char a; uint32_t b __attribute__((aligned));}");
}
test_size(16, "struct __declspec(align(16)) {char a; uint32_t b;}");
diff --git a/ext/ffi/tests/023.phpt b/ext/ffi/tests/023.phpt
index 3703620390..4e895d9931 100644
--- a/ext/ffi/tests/023.phpt
+++ b/ext/ffi/tests/023.phpt
@@ -6,9 +6,9 @@ FFI 023: GCC struct extensions
ffi.enable=1
--FILE--
<?php
- var_dump(FFI::sizeof(FFI::new("struct {}")));
- var_dump(FFI::sizeof(FFI::new("struct {int a}")));
- var_dump(FFI::sizeof(FFI::new("struct {int a; int b}")));
+ var_dump(FFI::sizeof(FFI::new("struct {}")));
+ var_dump(FFI::sizeof(FFI::new("struct {int a}")));
+ var_dump(FFI::sizeof(FFI::new("struct {int a; int b}")));
?>
ok
--EXPECT--
diff --git a/ext/ffi/tests/024.phpt b/ext/ffi/tests/024.phpt
index 95867b4e45..f1286e49ac 100644
--- a/ext/ffi/tests/024.phpt
+++ b/ext/ffi/tests/024.phpt
@@ -6,26 +6,26 @@ FFI 024: anonymous struct/union
ffi.enable=1
--FILE--
<?php
- $p = FFI::new("
- struct {
- int a;
- struct {
- int b;
- int c;
- };
- union {
- int d;
- uint32_t e;
- };
- int f;
- }");
- var_dump(FFI::sizeof($p));
- $p->a = 1;
- $p->b = 2;
- $p->c = 3;
- $p->d = 4;
- $p->f = 5;
- var_dump($p);
+ $p = FFI::new("
+ struct {
+ int a;
+ struct {
+ int b;
+ int c;
+ };
+ union {
+ int d;
+ uint32_t e;
+ };
+ int f;
+ }");
+ var_dump(FFI::sizeof($p));
+ $p->a = 1;
+ $p->b = 2;
+ $p->c = 3;
+ $p->d = 4;
+ $p->f = 5;
+ var_dump($p);
?>
--EXPECTF--
int(20)
diff --git a/ext/ffi/tests/025.phpt b/ext/ffi/tests/025.phpt
index d1182c4854..0abef88db8 100644
--- a/ext/ffi/tests/025.phpt
+++ b/ext/ffi/tests/025.phpt
@@ -6,21 +6,21 @@ FFI 025: direct work with primitive types
ffi.enable=1
--FILE--
<?php
- $x = FFI::new("int");
- $x->cdata = 5;
- var_dump($x);
- $x->cdata += 2;
- var_dump($x);
- echo "$x\n\n";
- unset($x);
+ $x = FFI::new("int");
+ $x->cdata = 5;
+ var_dump($x);
+ $x->cdata += 2;
+ var_dump($x);
+ echo "$x\n\n";
+ unset($x);
- $x = FFI::new("char");
- $x->cdata = 'a';
- var_dump($x);
- $x->cdata++;
- var_dump($x);
- echo "$x\n\n";
- unset($x);
+ $x = FFI::new("char");
+ $x->cdata = 'a';
+ var_dump($x);
+ $x->cdata++;
+ var_dump($x);
+ echo "$x\n\n";
+ unset($x);
?>
--EXPECTF--
object(FFI\CData:int32_t)#%d (1) {
diff --git a/ext/ffi/tests/026.phpt b/ext/ffi/tests/026.phpt
index 5e4356041f..1c5081c188 100644
--- a/ext/ffi/tests/026.phpt
+++ b/ext/ffi/tests/026.phpt
@@ -11,7 +11,7 @@ $a[1] = 10;
$a[2] = 20;
var_dump($a);
foreach ($a as &$val) {
- $val->cdata += 5;
+ $val->cdata += 5;
}
var_dump($a);
?>
diff --git a/ext/ffi/tests/027.phpt b/ext/ffi/tests/027.phpt
index 14c51f77e4..aa4afe970a 100644
--- a/ext/ffi/tests/027.phpt
+++ b/ext/ffi/tests/027.phpt
@@ -7,73 +7,73 @@ ffi.enable=1
--FILE--
<?php
try {
- $p = FFI::new("int[*]");
- echo "ok\n";
+ $p = FFI::new("int[*]");
+ echo "ok\n";
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- FFI::cdef("static int (*foo)[*];");
- echo "ok\n";
+ FFI::cdef("static int (*foo)[*];");
+ echo "ok\n";
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- FFI::cdef("typedef int foo[*];");
- echo "ok\n";
+ FFI::cdef("typedef int foo[*];");
+ echo "ok\n";
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- FFI::cdef("static void foo(int[*][*]);");
- echo "ok\n";
+ FFI::cdef("static void foo(int[*][*]);");
+ echo "ok\n";
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- var_dump(FFI::sizeof(FFI::new("int[0]")));
+ var_dump(FFI::sizeof(FFI::new("int[0]")));
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- var_dump(FFI::sizeof(FFI::new("int[]")));
+ var_dump(FFI::sizeof(FFI::new("int[]")));
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- var_dump(FFI::sizeof(FFI::cast("int[]", FFI::new("int[2]"))));
+ var_dump(FFI::sizeof(FFI::cast("int[]", FFI::new("int[2]"))));
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- FFI::cdef("struct _x {int a; int b[];};");
- echo "ok\n";
+ FFI::cdef("struct _x {int a; int b[];};");
+ echo "ok\n";
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- $f = FFI::cdef("typedef int(*foo)[];");
- echo "ok\n";
+ $f = FFI::cdef("typedef int(*foo)[];");
+ echo "ok\n";
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- $f = FFI::cdef("typedef int foo[][2];");
- echo "ok\n";
+ $f = FFI::cdef("typedef int foo[][2];");
+ echo "ok\n";
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- $f = FFI::cdef("typedef int foo[];");
- echo "ok\n";
+ $f = FFI::cdef("typedef int foo[];");
+ echo "ok\n";
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- $f = FFI::cdef("static int foo(int[]);");
- echo "ok\n";
+ $f = FFI::cdef("static int foo(int[]);");
+ echo "ok\n";
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
?>
--EXPECT--
diff --git a/ext/ffi/tests/028.phpt b/ext/ffi/tests/028.phpt
index ee69d70f68..5d1be7c8dc 100644
--- a/ext/ffi/tests/028.phpt
+++ b/ext/ffi/tests/028.phpt
@@ -7,46 +7,46 @@ ffi.enable=1
--FILE--
<?php
try {
- FFI::cdef("struct _x {int a; int b[0];};");
- echo "ok\n";
+ FFI::cdef("struct _x {int a; int b[0];};");
+ echo "ok\n";
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- FFI::cdef("struct _x {int a; int b[];};");
- echo "ok\n";
+ FFI::cdef("struct _x {int a; int b[];};");
+ echo "ok\n";
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- FFI::cdef("struct _x {int a[0]; int b;};");
- echo "ok\n";
+ FFI::cdef("struct _x {int a[0]; int b;};");
+ echo "ok\n";
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- FFI::cdef("struct _x {int a[]; int b;};");
- echo "ok\n";
+ FFI::cdef("struct _x {int a[]; int b;};");
+ echo "ok\n";
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- FFI::cdef("struct _x { struct {int a; int b[];}; int c;};");
- echo "ok\n";
+ FFI::cdef("struct _x { struct {int a; int b[];}; int c;};");
+ echo "ok\n";
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- FFI::cdef("union _x {int a; int b[];};");
- echo "ok\n";
+ FFI::cdef("union _x {int a; int b[];};");
+ echo "ok\n";
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
?>
--EXPECT--
ok
ok
ok
-FFI\ParserException: flexible array member not at end of struct at line 1
-FFI\ParserException: flexible array member not at end of struct at line 1
-FFI\ParserException: flexible array member in union at line 1
+FFI\ParserException: Flexible array member not at end of struct at line 1
+FFI\ParserException: Flexible array member not at end of struct at line 1
+FFI\ParserException: Flexible array member in union at line 1
diff --git a/ext/ffi/tests/029.phpt b/ext/ffi/tests/029.phpt
index bda59788fb..0951809306 100644
--- a/ext/ffi/tests/029.phpt
+++ b/ext/ffi/tests/029.phpt
@@ -7,8 +7,8 @@ ffi.enable=1
--FILE--
<?php
$ffi = FFI::cdef("
- typedef char t1;
- typedef char _Alignas(int) t2;
+ typedef char t1;
+ typedef char _Alignas(int) t2;
");
var_dump(FFI::sizeof($ffi->new("struct {char a; t1 b;}")));
var_dump(FFI::sizeof($ffi->new("struct {char a; t2 b;}")));
diff --git a/ext/ffi/tests/031.phpt b/ext/ffi/tests/031.phpt
index 3298df4961..c97368a89a 100644
--- a/ext/ffi/tests/031.phpt
+++ b/ext/ffi/tests/031.phpt
@@ -7,14 +7,14 @@ ffi.enable=1
--FILE--
<?php
function test_size($expected_size, $type) {
- try {
- $size = FFI::sizeof(FFI::new($type));
- if ($size !== $expected_size) {
- echo "FAIL: sizeof($type) != $expected_size ($size)\n";
- }
- } catch (Throwable $e) {
- echo $type . "=>" . get_class($e) . ": " . $e->getMessage()."\n";
- }
+ try {
+ $size = FFI::sizeof(FFI::new($type));
+ if ($size !== $expected_size) {
+ echo "FAIL: sizeof($type) != $expected_size ($size)\n";
+ }
+ } catch (Throwable $e) {
+ echo $type . "=>" . get_class($e) . ": " . $e->getMessage()."\n";
+ }
}
test_size( 4, "struct {int a:2; int b:2;}");
diff --git a/ext/ffi/tests/032.phpt b/ext/ffi/tests/032.phpt
index d785d037de..ade848188c 100644
--- a/ext/ffi/tests/032.phpt
+++ b/ext/ffi/tests/032.phpt
@@ -7,20 +7,20 @@ ffi.enable=1
--FILE--
<?php
$p = FFI::new("
- union {
- struct __attribute__((packed)) {
- int a:2;
- unsigned long long b:64;
- int c:3;
- unsigned int d:3;
- } s;
- uint8_t i[9];
+ union {
+ struct __attribute__((packed)) {
+ int a:2;
+ unsigned long long b:64;
+ int c:3;
+ unsigned int d:3;
+ } s;
+ uint8_t i[9];
}");
var_dump(FFI::sizeof($p));
for ($i = -5; $i < 9; $i++) {
- $p->s->c = $i;
- $p->s->d = $i;
- echo "$i => 3-bit int {$p->s->c}, 3-bit uint {$p->s->d}\n";
+ $p->s->c = $i;
+ $p->s->d = $i;
+ echo "$i => 3-bit int {$p->s->c}, 3-bit uint {$p->s->d}\n";
}
$p->s->a = 0;
$p->s->c = 0;
@@ -28,7 +28,7 @@ $p->s->d = 0;
$p->s->b = 0x7fffffff;
echo "0x";
for ($i = 9; $i > 0;) {
- printf("%02x", $p->i[--$i]);
+ printf("%02x", $p->i[--$i]);
}
echo "\n";
?>
diff --git a/ext/ffi/tests/035.phpt b/ext/ffi/tests/035.phpt
index fc42f16e88..ed98839c6e 100644
--- a/ext/ffi/tests/035.phpt
+++ b/ext/ffi/tests/035.phpt
@@ -11,9 +11,9 @@ var_dump($p);
FFI::free($p);
try {
- var_dump($p);
+ var_dump($p);
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
?>
--EXPECTF--
diff --git a/ext/ffi/tests/036.phpt b/ext/ffi/tests/036.phpt
index 5c4e0600b8..1e989285ff 100644
--- a/ext/ffi/tests/036.phpt
+++ b/ext/ffi/tests/036.phpt
@@ -9,12 +9,12 @@ ffi.enable=1
$type = FFI::type("int*");
function foo($ptr) {
- global $type;
- //$buf = FFI::new("int*[1]"); /* this loses type and crash */
- $buf = FFI::new(FFI::arrayType($type, [1]));
- $buf[0] = $ptr;
- //...
- return $buf[0];
+ global $type;
+ //$buf = FFI::new("int*[1]"); /* this loses type and crash */
+ $buf = FFI::new(FFI::arrayType($type, [1]));
+ $buf[0] = $ptr;
+ //...
+ return $buf[0];
}
$int = FFI::new("int");
diff --git a/ext/ffi/tests/037.phpt b/ext/ffi/tests/037.phpt
index 0b67e4a4da..d8f0a88afa 100644
--- a/ext/ffi/tests/037.phpt
+++ b/ext/ffi/tests/037.phpt
@@ -7,10 +7,10 @@ ffi.enable=1
--FILE--
<?php
function foo($ptr) {
- $buf = FFI::new("int*[1]");
- $buf[0] = $ptr;
- //...
- return $buf[0];
+ $buf = FFI::new("int*[1]");
+ $buf[0] = $ptr;
+ //...
+ return $buf[0];
}
$int = FFI::new("int");
diff --git a/ext/ffi/tests/038.phpt b/ext/ffi/tests/038.phpt
index 89070f31c2..270746a03e 100644
--- a/ext/ffi/tests/038.phpt
+++ b/ext/ffi/tests/038.phpt
@@ -8,7 +8,7 @@ ffi.enable=1
<?php
$a = FFI::new("int[10]");
for ($i = 0; $i < 10; $i++) {
- $a[$i] = $i;
+ $a[$i] = $i;
}
$p = FFI::cast("int*", $a);
var_dump($p[0]);
diff --git a/ext/ffi/tests/039.phpt b/ext/ffi/tests/039.phpt
index 92309d4928..d015a38b95 100644
--- a/ext/ffi/tests/039.phpt
+++ b/ext/ffi/tests/039.phpt
@@ -8,7 +8,7 @@ ffi.enable=1
<?php
$a = FFI::new("int[10]");
for ($i = 0; $i < 10; $i++) {
- $a[$i] = $i;
+ $a[$i] = $i;
}
$p = $a + 0;
var_dump($p[0]);
diff --git a/ext/ffi/tests/041.phpt b/ext/ffi/tests/041.phpt
index 4cb2694dbb..d12a774b21 100644
--- a/ext/ffi/tests/041.phpt
+++ b/ext/ffi/tests/041.phpt
@@ -7,12 +7,12 @@ ffi.enable=1
--FILE--
<?php
function test_new_ownership($str, $transfer) {
- if ($transfer) {
- return FFI::new(FFI::type($str));
- } else {
- $type = FFI::type($str);
- return FFI::new($type);
- }
+ if ($transfer) {
+ return FFI::new(FFI::type($str));
+ } else {
+ $type = FFI::type($str);
+ return FFI::new($type);
+ }
}
var_dump(test_new_ownership("int", 1));
var_dump(test_new_ownership("int[2]", 1));
@@ -20,12 +20,12 @@ var_dump(test_new_ownership("int", 0));
var_dump(test_new_ownership("int[2]", 0));
function test_type_ownership($str, $transfer) {
- if ($transfer) {
- return FFI::typeof(FFI::new($str));
- } else {
- $data = FFI::new($str);
- return FFI::typeof($data);
- }
+ if ($transfer) {
+ return FFI::typeof(FFI::new($str));
+ } else {
+ $data = FFI::new($str);
+ return FFI::typeof($data);
+ }
}
var_dump(test_type_ownership("int", 1));
var_dump(test_type_ownership("int[2]", 1));
@@ -33,12 +33,12 @@ var_dump(test_type_ownership("int", 0));
var_dump(test_type_ownership("int[2]", 0));
function test_cast_ownership($str, $transfer) {
- if ($transfer) {
- return FFI::cast(FFI::type($str), FFI::new($str));
- } else {
- $type = FFI::type($str);
- return FFI::cast($type, FFI::new($str));
- }
+ if ($transfer) {
+ return FFI::cast(FFI::type($str), FFI::new($str));
+ } else {
+ $type = FFI::type($str);
+ return FFI::cast($type, FFI::new($str));
+ }
}
var_dump(test_cast_ownership("int", 1));
var_dump(test_cast_ownership("int[2]", 1));
@@ -46,12 +46,12 @@ var_dump(test_cast_ownership("int", 0));
var_dump(test_cast_ownership("int[2]", 0));
function test_array_ownership($str, $transfer) {
- if ($transfer) {
- return FFI::arrayType(FFI::type($str), [2]);
- } else {
- $type = FFI::type($str);
- return FFI::arrayType($type, [2]);
- }
+ if ($transfer) {
+ return FFI::arrayType(FFI::type($str), [2]);
+ } else {
+ $type = FFI::type($str);
+ return FFI::arrayType($type, [2]);
+ }
}
var_dump(test_array_ownership("int", 1));
var_dump(test_array_ownership("int[2]", 1));
diff --git a/ext/ffi/tests/045.phpt b/ext/ffi/tests/045.phpt
index 7118df9eb7..eb7f3b95f6 100644
--- a/ext/ffi/tests/045.phpt
+++ b/ext/ffi/tests/045.phpt
@@ -10,20 +10,18 @@ var_dump(FFI::isNull(FFI::new("int*")));
$i = FFI::new("int");
var_dump(FFI::isNull(FFI::addr($i)));
try {
- var_dump(FFI::isNull(null));
+ var_dump(FFI::isNull(null));
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
try {
- var_dump(FFI::isNull(FFI::new("int[0]")));
+ var_dump(FFI::isNull(FFI::new("int[0]")));
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage()."\n";
+ echo get_class($e) . ": " . $e->getMessage()."\n";
}
?>
--EXPECTF--
bool(true)
bool(false)
-
-Warning: FFI::isNull() expects parameter 1 to be FFI\CData, null given in %s045.php on line %d
-NULL
+TypeError: FFI::isNull() expects parameter 1 to be FFI\CData, null given
FFI\Exception: FFI\Cdata is not a pointer
diff --git a/ext/ffi/tests/100.phpt b/ext/ffi/tests/100.phpt
index 63fae8c215..27b6d0be08 100644
--- a/ext/ffi/tests/100.phpt
+++ b/ext/ffi/tests/100.phpt
@@ -15,19 +15,19 @@ ffi.enable=1
<?php
// Check if target supports "fastcall" calling convention
try {
- FFI::cdef("extern size_t __attribute__((fastcall)) (*zend_printf)(const char *format);");
- $fastcall = "__attribute__((fastcall)) ";
+ FFI::cdef("extern size_t __attribute__((fastcall)) (*zend_printf)(const char *format);");
+ $fastcall = "__attribute__((fastcall)) ";
} catch (Throwable $e) {
- $fastcall = "";
+ $fastcall = "";
}
$zend = FFI::cdef("
- const char *get_zend_version(void);
- //char *get_zend_version(void);
- extern size_t (*zend_printf)(const char *format, ...);
+ const char *get_zend_version(void);
+ //char *get_zend_version(void);
+ extern size_t (*zend_printf)(const char *format, ...);
- unsigned long $fastcall zend_hash_func(const char *str, size_t len);
+ unsigned long $fastcall zend_hash_func(const char *str, size_t len);
- void $fastcall zend_str_tolower(char *str, size_t length);
+ void $fastcall zend_str_tolower(char *str, size_t length);
");
var_dump(trim(explode("\n",$zend->get_zend_version())[0]));
diff --git a/ext/ffi/tests/200.phpt b/ext/ffi/tests/200.phpt
index dda77a03a0..69d0aafd04 100644
--- a/ext/ffi/tests/200.phpt
+++ b/ext/ffi/tests/200.phpt
@@ -11,22 +11,23 @@ try {
?>
--INI--
ffi.enable=1
+opcache.jit=0
--FILE--
<?php
$zend = FFI::cdef("
- typedef int (*zend_write_func_t)(const char *str, size_t str_length);
- extern zend_write_func_t zend_write;
+ typedef int (*zend_write_func_t)(const char *str, size_t str_length);
+ extern zend_write_func_t zend_write;
");
echo "Hello World!\n";
$orig_zend_write = clone $zend->zend_write;
$zend->zend_write = function($str, $len) {
- global $orig_zend_write;
- $orig_zend_write("{\n\t", 3);
- $ret = $orig_zend_write($str, $len);
- $orig_zend_write("}\n", 2);
- return $ret;
+ global $orig_zend_write;
+ $orig_zend_write("{\n\t", 3);
+ $ret = $orig_zend_write($str, $len);
+ $orig_zend_write("}\n", 2);
+ return $ret;
};
echo "Hello World!\n";
$zend->zend_write = $orig_zend_write;
diff --git a/ext/ffi/tests/301-win32.phpt b/ext/ffi/tests/301-win32.phpt
index 1d0d27ffa6..82737e2e0e 100644
--- a/ext/ffi/tests/301-win32.phpt
+++ b/ext/ffi/tests/301-win32.phpt
@@ -9,10 +9,10 @@ ffi.enable=1
<?php
$fn = __DIR__ . "/300-win32.h";
$cont = str_replace(
- "PHP_DLL_NAME",
- "php" . PHP_MAJOR_VERSION . (PHP_ZTS ? "ts" : "") . (PHP_DEBUG ? "_debug" : "") . ".dll",
- file_get_contents("$fn.in")
- );
+ "PHP_DLL_NAME",
+ "php" . PHP_MAJOR_VERSION . (PHP_ZTS ? "ts" : "") . (PHP_DEBUG ? "_debug" : "") . ".dll",
+ file_get_contents("$fn.in")
+ );
file_put_contents($fn, $cont);
$ffi = FFI::load($fn);
diff --git a/ext/ffi/tests/bug77706.phpt b/ext/ffi/tests/bug77706.phpt
index fca6208fe9..87ef584d51 100644
--- a/ext/ffi/tests/bug77706.phpt
+++ b/ext/ffi/tests/bug77706.phpt
@@ -30,27 +30,27 @@ int fprintf(FILE *, const char *, ...);
$ffi = FFI::cdef($header, 'libc.so.6');
try {
- $ffi->time();
+ $ffi->time();
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage() . "\n";
+ echo get_class($e) . ": " . $e->getMessage() . "\n";
}
try {
- $ffi->time(null, null);
+ $ffi->time(null, null);
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage() . "\n";
+ echo get_class($e) . ": " . $e->getMessage() . "\n";
}
try {
- $ffi->fprintf($ffi->stdout);
+ $ffi->fprintf($ffi->stdout);
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage() . "\n";
+ echo get_class($e) . ": " . $e->getMessage() . "\n";
}
try {
- $ffi->fprintf($ffi->stdout, 123, "Hello %s\n", "World");
+ $ffi->fprintf($ffi->stdout, 123, "Hello %s\n", "World");
} catch (Throwable $e) {
- echo get_class($e) . ": " . $e->getMessage() . "\n";
+ echo get_class($e) . ": " . $e->getMessage() . "\n";
}
?>
--EXPECT--
diff --git a/ext/ffi/tests/bug78270_1.phpt b/ext/ffi/tests/bug78270_1.phpt
index 203e8c330a..c918393bd9 100644
--- a/ext/ffi/tests/bug78270_1.phpt
+++ b/ext/ffi/tests/bug78270_1.phpt
@@ -10,7 +10,7 @@ phpinfo(INFO_GENERAL);
$info = ob_get_clean();
if (preg_match('/Compiler => .*clang.*/', $info)) die("skip not for clang");
-$dll = 'php7' . (PHP_ZTS ? 'ts' : '') . (PHP_DEBUG ? '_debug' : '') . '.dll';
+$dll = 'php8' . (PHP_ZTS ? 'ts' : '') . (PHP_DEBUG ? '_debug' : '') . '.dll';
try {
FFI::cdef(<<<EOC
__vectorcall int zend_atoi(const char *str, size_t str_len);
@@ -21,7 +21,7 @@ try {
?>
--FILE--
<?php
-$dll = 'php7' . (PHP_ZTS ? 'ts' : '') . (PHP_DEBUG ? '_debug' : '') . '.dll';
+$dll = 'php8' . (PHP_ZTS ? 'ts' : '') . (PHP_DEBUG ? '_debug' : '') . '.dll';
$ffi = FFI::cdef(<<<EOC
__vectorcall int zend_atoi(const char *str, size_t str_len);
EOC, $dll);
diff --git a/ext/ffi/tests/bug78270_2.phpt b/ext/ffi/tests/bug78270_2.phpt
index 60ba27853e..a7cce3fc1e 100644
--- a/ext/ffi/tests/bug78270_2.phpt
+++ b/ext/ffi/tests/bug78270_2.phpt
@@ -5,7 +5,7 @@ FR #78270 (Usage of __vectorcall convention with FFI)
require_once('skipif.inc');
if (substr(PHP_OS, 0, 3) != 'WIN') die("skip this test is for Windows platforms only");
-$dll = 'php7' . (PHP_ZTS ? 'ts' : '') . (PHP_DEBUG ? '_debug' : '') . '.dll';
+$dll = 'php8' . (PHP_ZTS ? 'ts' : '') . (PHP_DEBUG ? '_debug' : '') . '.dll';
try {
FFI::cdef(<<<EOC
__vectorcall int zend_atoi(const char *str, size_t str_len);
diff --git a/ext/ffi/tests/bug78714.phpt b/ext/ffi/tests/bug78714.phpt
index 1acac06ffe..a73b37cae1 100644
--- a/ext/ffi/tests/bug78714.phpt
+++ b/ext/ffi/tests/bug78714.phpt
@@ -10,7 +10,7 @@ $def = 'char * __cdecl get_zend_version(void);';
if (substr(PHP_OS, 0, 3) != 'WIN') {
$ffi = FFI::cdef($def);
} else {
- $dll = 'php7' . (PHP_ZTS ? 'ts' : '') . (PHP_DEBUG ? '_debug' : '') . '.dll';
+ $dll = 'php8' . (PHP_ZTS ? 'ts' : '') . (PHP_DEBUG ? '_debug' : '') . '.dll';
$ffi = FFI::cdef($def, $dll);
}
echo substr(FFI::string($ffi->get_zend_version()), 0, 4) . "\n";
diff --git a/ext/ffi/tests/bug79096.phpt b/ext/ffi/tests/bug79096.phpt
index c495efc92e..d8d89f05bc 100644
--- a/ext/ffi/tests/bug79096.phpt
+++ b/ext/ffi/tests/bug79096.phpt
@@ -9,8 +9,8 @@ if (!extension_loaded('zend-test')) die('skip zend-test extension not available'
<?php
$header = <<<HEADER
struct bug79096 {
- uint64_t a;
- uint64_t b;
+ uint64_t a;
+ uint64_t b;
};
struct bug79096 bug79096(void);
diff --git a/ext/ffi/tests/list.phpt b/ext/ffi/tests/list.phpt
index a7696fa091..0cfe4cb7b3 100644
--- a/ext/ffi/tests/list.phpt
+++ b/ext/ffi/tests/list.phpt
@@ -7,78 +7,78 @@ ffi.enable=1
--FILE--
<?php
class DList {
- private static $ffi = null;
- private $root;
+ private static $ffi = null;
+ private $root;
- function __construct() {
- if (is_null(self::$ffi)) {
- self::$ffi =
- FFI::cdef("
- typedef struct _dlist dlist;
- struct _dlist {
- int data;
- dlist *prev;
- dlist *next;
- };
- ");
- }
- $node = FFI::addr(self::$ffi->new("dlist", false));
- $node->data = 0;
- $node->next = $node;
- $node->prev = $node;
- $this->root = $node;
- }
+ function __construct() {
+ if (is_null(self::$ffi)) {
+ self::$ffi =
+ FFI::cdef("
+ typedef struct _dlist dlist;
+ struct _dlist {
+ int data;
+ dlist *prev;
+ dlist *next;
+ };
+ ");
+ }
+ $node = FFI::addr(self::$ffi->new("dlist", false));
+ $node->data = 0;
+ $node->next = $node;
+ $node->prev = $node;
+ $this->root = $node;
+ }
- function __destruct() {
- $root = $this->root;
- $node = $root->next;
- while ($node != $root) {
- $prev = $node;
- $node = $node->next;
- FFI::free($prev);
- }
- FFI::free($root);
- }
+ function __destruct() {
+ $root = $this->root;
+ $node = $root->next;
+ while ($node != $root) {
+ $prev = $node;
+ $node = $node->next;
+ FFI::free($prev);
+ }
+ FFI::free($root);
+ }
- function add(int $data) {
- $node = FFI::addr(self::$ffi->new("dlist", false));
- $node->data = $data;
- $node->next = $this->root;
- $node->prev = $this->root->prev;
- $this->root->prev->next = $node;
- $this->root->prev = $node;
- }
+ function add(int $data) {
+ $node = FFI::addr(self::$ffi->new("dlist", false));
+ $node->data = $data;
+ $node->next = $this->root;
+ $node->prev = $this->root->prev;
+ $this->root->prev->next = $node;
+ $this->root->prev = $node;
+ }
- function del(int $data) {
- $root = $this->root;
- $node = $root->next;
- while ($node != $root) {
- if ($node->data == $data) {
- $node->prev->next = $node->next;
- $node->next->prev = $node->prev;
- FFI::free($node);
- break;
- }
- $node = $node->next;
- }
- }
+ function del(int $data) {
+ $root = $this->root;
+ $node = $root->next;
+ while ($node != $root) {
+ if ($node->data == $data) {
+ $node->prev->next = $node->next;
+ $node->next->prev = $node->prev;
+ FFI::free($node);
+ break;
+ }
+ $node = $node->next;
+ }
+ }
- function print() {
- echo "[";
- $first = true;
- $root = $this->root;
- $node = $root->next;
- while ($node != $root) {
- if (!$first) {
- echo ", ";
- } else {
- $first = false;
- }
- echo $node->data;
- $node = $node->next;
- }
- echo "]\n";
- }
+ function print() {
+ echo "[";
+ $first = true;
+ $root = $this->root;
+ $node = $root->next;
+ while ($node != $root) {
+ if (!$first) {
+ echo ", ";
+ } else {
+ $first = false;
+ }
+ echo $node->data;
+ $node = $node->next;
+ }
+ echo "]\n";
+ }
}
$dlist = new Dlist;
diff --git a/ext/ffi/tests/preload.inc b/ext/ffi/tests/preload.inc
index b1358de697..529d27c83c 100644
--- a/ext/ffi/tests/preload.inc
+++ b/ext/ffi/tests/preload.inc
@@ -1,14 +1,14 @@
<?php
if (substr(PHP_OS, 0, 3) == 'WIN') {
- $fn = __DIR__ . "/300-win32.h";
- $cont = str_replace(
- "PHP_DLL_NAME",
- "php" . PHP_MAJOR_VERSION . (PHP_ZTS ? "ts" : "") . (PHP_DEBUG ? "_debug" : "") . ".dll",
- file_get_contents("$fn.in")
- );
- file_put_contents($fn, $cont);
- $ffi = FFI::load($fn);
- /* Test should cleanup this. */
+ $fn = __DIR__ . "/300-win32.h";
+ $cont = str_replace(
+ "PHP_DLL_NAME",
+ "php" . PHP_MAJOR_VERSION . (PHP_ZTS ? "ts" : "") . (PHP_DEBUG ? "_debug" : "") . ".dll",
+ file_get_contents("$fn.in")
+ );
+ file_put_contents($fn, $cont);
+ $ffi = FFI::load($fn);
+ /* Test should cleanup this. */
} else {
- FFI::load(__DIR__ . "/300.h");
+ FFI::load(__DIR__ . "/300.h");
}
diff --git a/ext/fileinfo/fileinfo.c b/ext/fileinfo/fileinfo.c
index 8bb76b5657..258f8055e9 100644
--- a/ext/fileinfo/fileinfo.c
+++ b/ext/fileinfo/fileinfo.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
@@ -34,6 +32,7 @@
#include "ext/standard/info.h"
#include "ext/standard/file.h" /* needed for context stuff */
#include "php_fileinfo.h"
+#include "fileinfo_arginfo.h"
#include "fopen_wrappers.h" /* needed for is_url */
#include "Zend/zend_exceptions.h"
@@ -108,63 +107,13 @@ PHP_FILEINFO_API zend_object *finfo_objects_new(zend_class_entry *class_type)
}
/* }}} */
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_finfo_open, 0, 0, 0)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, arg)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_finfo_close, 0, 0, 1)
- ZEND_ARG_INFO(0, finfo)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_finfo_set_flags, 0, 0, 2)
- ZEND_ARG_INFO(0, finfo)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_finfo_method_set_flags, 0, 0, 1)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_finfo_file, 0, 0, 2)
- ZEND_ARG_INFO(0, finfo)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, context)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_finfo_method_file, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, context)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_finfo_buffer, 0, 0, 2)
- ZEND_ARG_INFO(0, finfo)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, context)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_finfo_method_buffer, 0, 0, 1)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, context)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mime_content_type, 0, 0, 1)
- ZEND_ARG_INFO(0, string)
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ finfo_class_functions
*/
static const zend_function_entry finfo_class_functions[] = {
- ZEND_ME_MAPPING(finfo, finfo_open, arginfo_finfo_open, ZEND_ACC_PUBLIC)
- ZEND_ME_MAPPING(set_flags, finfo_set_flags,arginfo_finfo_method_set_flags, ZEND_ACC_PUBLIC)
- ZEND_ME_MAPPING(file, finfo_file, arginfo_finfo_method_file, ZEND_ACC_PUBLIC)
- ZEND_ME_MAPPING(buffer, finfo_buffer, arginfo_finfo_method_buffer, ZEND_ACC_PUBLIC)
+ ZEND_ME_MAPPING(__construct, finfo_open, arginfo_class_finfo___construct, ZEND_ACC_PUBLIC)
+ ZEND_ME_MAPPING(set_flags, finfo_set_flags,arginfo_class_finfo_set_flags, ZEND_ACC_PUBLIC)
+ ZEND_ME_MAPPING(file, finfo_file, arginfo_class_finfo_file, ZEND_ACC_PUBLIC)
+ ZEND_ME_MAPPING(buffer, finfo_buffer, arginfo_class_finfo_buffer, ZEND_ACC_PUBLIC)
PHP_FE_END
};
/* }}} */
@@ -292,10 +241,9 @@ PHP_FUNCTION(finfo_open)
FILEINFO_DECLARE_INIT_OBJECT(object)
char resolved_path[MAXPATHLEN];
zend_error_handling zeh;
- int flags = object ? ZEND_PARSE_PARAMS_THROW : 0;
- if (zend_parse_parameters_ex(flags, ZEND_NUM_ARGS(), "|lp", &options, &file, &file_len) == FAILURE) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|lp", &options, &file, &file_len) == FAILURE) {
+ RETURN_THROWS();
}
if (object) {
@@ -382,11 +330,11 @@ PHP_FUNCTION(finfo_close)
zval *zfinfo;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zfinfo) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ((finfo = (php_fileinfo *)zend_fetch_resource(Z_RES_P(zfinfo), "file_info", le_fileinfo)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
zend_list_close(Z_RES_P(zfinfo));
@@ -406,15 +354,15 @@ PHP_FUNCTION(finfo_set_flags)
if (object) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &options) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
FILEINFO_FROM_OBJECT(finfo, object);
} else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &zfinfo, &options) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ((finfo = (php_fileinfo *)zend_fetch_resource(Z_RES_P(zfinfo), "file_info", le_fileinfo)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
}
@@ -446,7 +394,7 @@ static void _php_finfo_get_type(INTERNAL_FUNCTION_PARAMETERS, int mode, int mime
/* mime_content_type(..) emulation */
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &what) == FAILURE) {
- return;
+ RETURN_THROWS();
}
switch (Z_TYPE_P(what)) {
@@ -471,17 +419,17 @@ static void _php_finfo_get_type(INTERNAL_FUNCTION_PARAMETERS, int mode, int mime
goto common;
}
} else if (object) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|lr", &buffer, &buffer_len, &options, &zcontext) == FAILURE) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|lr!", &buffer, &buffer_len, &options, &zcontext) == FAILURE) {
+ RETURN_THROWS();
}
FILEINFO_FROM_OBJECT(finfo, object);
magic = finfo->magic;
} else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|lr", &zfinfo, &buffer, &buffer_len, &options, &zcontext) == FAILURE) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|lr!", &zfinfo, &buffer, &buffer_len, &options, &zcontext) == FAILURE) {
+ RETURN_THROWS();
}
if ((finfo = (php_fileinfo *)zend_fetch_resource(Z_RES_P(zfinfo), "file_info", le_fileinfo)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
magic = finfo->magic;
}
diff --git a/ext/fileinfo/fileinfo.stub.php b/ext/fileinfo/fileinfo.stub.php
new file mode 100644
index 0000000000..f19b3163a7
--- /dev/null
+++ b/ext/fileinfo/fileinfo.stub.php
@@ -0,0 +1,51 @@
+<?php
+
+class finfo
+{
+ function __construct(int $options = FILEINFO_NONE, string $arg = "") {}
+
+ /**
+ * @param ?resource $context
+ * @return string|false
+ */
+ function file(string $file_name, int $options = FILEINFO_NONE, $context = null) {}
+
+ /**
+ * @param ?resource $context
+ * @return string|false
+ */
+ function buffer(string $string, int $options = FILEINFO_NONE, $context = null) {}
+
+ /** @return bool */
+ function set_flags(int $options) {}
+}
+
+/** @return resource|false */
+function finfo_open(int $options = FILEINFO_NONE, string $arg = "") {}
+
+/**
+ * @param resource $finfo
+ */
+function finfo_close($finfo): bool {}
+
+/**
+ * @param resource $finfo
+ */
+function finfo_set_flags($finfo, int $options): bool {}
+
+/**
+ * @param resource $finfo
+ * @param ?resource $context
+ */
+function finfo_file($finfo, string $file_name, int $options = FILEINFO_NONE, $context = null): string|false {}
+
+/**
+ * @param resource $finfo
+ * @param ?resource $context
+ */
+function finfo_buffer($finfo, string $string, int $options = FILEINFO_NONE, $context = null): string|false {}
+
+/**
+ * @param resource|string $filename
+ */
+function mime_content_type($filename): string|false {}
diff --git a/ext/fileinfo/fileinfo_arginfo.h b/ext/fileinfo/fileinfo_arginfo.h
new file mode 100644
index 0000000000..8f0f356bb0
--- /dev/null
+++ b/ext/fileinfo/fileinfo_arginfo.h
@@ -0,0 +1,51 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_finfo___construct, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, arg, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_finfo_file, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, file_name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ ZEND_ARG_INFO(0, context)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_finfo_buffer, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ ZEND_ARG_INFO(0, context)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_finfo_set_flags, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_finfo_open arginfo_class_finfo___construct
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_finfo_close, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, finfo)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_finfo_set_flags, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, finfo)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_finfo_file, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, finfo)
+ ZEND_ARG_TYPE_INFO(0, file_name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ ZEND_ARG_INFO(0, context)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_finfo_buffer, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, finfo)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ ZEND_ARG_INFO(0, context)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mime_content_type, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, filename)
+ZEND_END_ARG_INFO()
diff --git a/ext/fileinfo/php_fileinfo.h b/ext/fileinfo/php_fileinfo.h
index ac43b21050..c4f12abf5f 100644
--- a/ext/fileinfo/php_fileinfo.h
+++ b/ext/fileinfo/php_fileinfo.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
diff --git a/ext/fileinfo/tests/bug57547.phpt b/ext/fileinfo/tests/bug57547.phpt
index 512d4c030a..184ea6e018 100644
--- a/ext/fileinfo/tests/bug57547.phpt
+++ b/ext/fileinfo/tests/bug57547.phpt
@@ -10,18 +10,16 @@ if (!class_exists('finfo'))
$filenames = array("..", __FILE__);
foreach ($filenames as $filename) {
- $finfo = new finfo(FILEINFO_MIME);
- var_dump($finfo->file($filename));
+ $finfo = new finfo(FILEINFO_MIME);
+ var_dump($finfo->file($filename));
- $finfo2 = new finfo();
- var_dump($finfo2->file($filename, FILEINFO_MIME));
+ $finfo2 = new finfo();
+ var_dump($finfo2->file($filename, FILEINFO_MIME));
}
?>
-===DONE===
--EXPECT--
string(9) "directory"
string(9) "directory"
string(28) "text/x-php; charset=us-ascii"
string(28) "text/x-php; charset=us-ascii"
-===DONE===
diff --git a/ext/fileinfo/tests/bug61173.phpt b/ext/fileinfo/tests/bug61173.phpt
index 9fbf48b2ec..6487e15bbb 100644
--- a/ext/fileinfo/tests/bug61173.phpt
+++ b/ext/fileinfo/tests/bug61173.phpt
@@ -14,4 +14,4 @@ try {
echo $e->getMessage(), "\n";
}
--EXPECT--
-finfo::finfo() expects at most 2 parameters, 3 given
+finfo::__construct() expects at most 2 parameters, 3 given
diff --git a/ext/fileinfo/tests/bug61964-mb.phpt b/ext/fileinfo/tests/bug61964-mb.phpt
index 8432a8314e..0713ac2eb6 100644
--- a/ext/fileinfo/tests/bug61964-mb.phpt
+++ b/ext/fileinfo/tests/bug61964-mb.phpt
@@ -43,7 +43,6 @@ unlink($magic_file_copy);
unlink($magic_file_copy2);
rmdir($dir);
?>
-===DONE===
--EXPECTF--
bool(false)%A
resource(%d) of type (file_info)
@@ -61,4 +60,3 @@ Notice: finfo_open(): Warning: offset `b' invalid in %sbug61964-mb.php on line %
Warning: finfo_open(): Failed to load magic database at '%sbug61964-mb'. in %sbug61964-mb.php on line %d
DONE: testing dir with files
-===DONE===
diff --git a/ext/fileinfo/tests/bug61964.phpt b/ext/fileinfo/tests/bug61964.phpt
index b2eb6e2f16..4d891e9731 100644
--- a/ext/fileinfo/tests/bug61964.phpt
+++ b/ext/fileinfo/tests/bug61964.phpt
@@ -43,7 +43,6 @@ unlink($magic_file_copy);
unlink($magic_file_copy2);
rmdir($dir);
?>
-===DONE===
--EXPECTF--
bool(false)%A
resource(%d) of type (file_info)
@@ -61,4 +60,3 @@ Notice: finfo_open(): Warning: offset `b' invalid in %sbug61964.php on line %d
Warning: finfo_open(): Failed to load magic database at '%sbug61964'. in %sbug61964.php on line %d
DONE: testing dir with files
-===DONE===
diff --git a/ext/fileinfo/tests/bug67516.phpt b/ext/fileinfo/tests/bug67516.phpt
index d077d2dcbc..6f4147fb0e 100644
--- a/ext/fileinfo/tests/bug67516.phpt
+++ b/ext/fileinfo/tests/bug67516.phpt
@@ -11,8 +11,6 @@ $f = new finfo;
var_dump($f->file(__DIR__ . "/bug67516.gif", FILEINFO_MIME_TYPE));
var_dump($f->file(__DIR__ . "/bug67516.gif", FILEINFO_MIME));
?>
-===DONE===
--EXPECT--
string(9) "image/gif"
string(25) "image/gif; charset=binary"
-===DONE===
diff --git a/ext/fileinfo/tests/bug67647-mb.phpt b/ext/fileinfo/tests/bug67647-mb.phpt
index 310b9f2fad..c5ce8f9dc1 100644
--- a/ext/fileinfo/tests/bug67647-mb.phpt
+++ b/ext/fileinfo/tests/bug67647-mb.phpt
@@ -17,9 +17,9 @@ $f_base = "67647ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.mov";
$f = __DIR__ . DIRECTORY_SEPARATOR . $f_base;
/* Streams mb path support is tested a lot elsewhere. Copy the existing file
- therefore, avoid duplication in the repo. */
+ therefore, avoid duplication in the repo. */
if (!copy($src, $f) || empty(glob($f))) {
- die("failed to copy '$src' to '$f'");
+ die("failed to copy '$src' to '$f'");
}
$fi = new finfo(FILEINFO_MIME_TYPE);
diff --git a/ext/fileinfo/tests/bug68731.phpt b/ext/fileinfo/tests/bug68731.phpt
index 43083c9eec..c15b83c951 100644
--- a/ext/fileinfo/tests/bug68731.phpt
+++ b/ext/fileinfo/tests/bug68731.phpt
@@ -6,9 +6,9 @@ if (!class_exists('finfo'))
die('skip no fileinfo extension');
--FILE--
<?php
- $buffer = file_get_contents(__DIR__ . '/68731.gif');
- $finfo = finfo_open(FILEINFO_MIME_TYPE);
- echo finfo_buffer($finfo, $buffer);
+ $buffer = file_get_contents(__DIR__ . '/68731.gif');
+ $finfo = finfo_open(FILEINFO_MIME_TYPE);
+ echo finfo_buffer($finfo, $buffer);
?>
--EXPECT--
image/gif
diff --git a/ext/fileinfo/tests/bug68735.phpt b/ext/fileinfo/tests/bug68735.phpt
index d43ceca40b..2197b2196e 100644
--- a/ext/fileinfo/tests/bug68735.phpt
+++ b/ext/fileinfo/tests/bug68735.phpt
@@ -4,13 +4,11 @@ Bug #68735 fileinfo out-of-bounds memory access
<?php require_once(__DIR__ . '/skipif.inc'); ?>
--FILE--
<?php
- $test_file = __DIR__ . DIRECTORY_SEPARATOR . "bug68735.jpg";
- $f = new finfo;
+ $test_file = __DIR__ . DIRECTORY_SEPARATOR . "bug68735.jpg";
+ $f = new finfo;
- var_dump($f->file($test_file));
+ var_dump($f->file($test_file));
?>
-===DONE===
--EXPECTF--
string(%d) "JPEG image data, JFIF standard 1.01, resolution (DPI), density 180x52, segment length 16, comment: "%S""
-===DONE===
diff --git a/ext/fileinfo/tests/bug68996.phpt b/ext/fileinfo/tests/bug68996.phpt
index a489e3c0de..83f2765408 100644
--- a/ext/fileinfo/tests/bug68996.phpt
+++ b/ext/fileinfo/tests/bug68996.phpt
@@ -15,8 +15,8 @@ finfo_open(FILEINFO_MIME_TYPE, "\xfc\x63");
?>
--EXPECTF--
<br />
-<b>Warning</b>: : failed to open stream: No such file or directory in <b>%sbug68996.php</b> on line <b>%d</b><br />
+<b>Warning</b>: : Failed to open stream: No such file or directory in <b>%sbug68996.php</b> on line <b>%d</b><br />
<br />
-<b>Warning</b>: : failed to open stream: No such file or directory in <b>%sbug68996.php</b> on line <b>%d</b><br />
+<b>Warning</b>: : Failed to open stream: No such file or directory in <b>%sbug68996.php</b> on line <b>%d</b><br />
<br />
<b>Warning</b>: finfo_open(): Failed to load magic database at '%s�c'. in <b>%sbug68996.php</b> on line <b>%d</b><br />
diff --git a/ext/fileinfo/tests/bug69107.phpt b/ext/fileinfo/tests/bug69107.phpt
index 9a7b26b5d1..28a040318e 100644
--- a/ext/fileinfo/tests/bug69107.phpt
+++ b/ext/fileinfo/tests/bug69107.phpt
@@ -13,10 +13,8 @@ var_dump($finfo->buffer("<?php class A{}"));
var_dump($finfo->buffer("<?php\tclass A{}"));
var_dump($finfo->buffer("<?php\n\rclass A{}"));
?>
-===DONE===
--EXPECT--
string(10) "text/x-php"
string(10) "text/x-php"
string(10) "text/x-php"
string(10) "text/x-php"
-===DONE===
diff --git a/ext/fileinfo/tests/bug71527-mb.phpt b/ext/fileinfo/tests/bug71527-mb.phpt
index e04c708849..272cdba702 100644
--- a/ext/fileinfo/tests/bug71527-mb.phpt
+++ b/ext/fileinfo/tests/bug71527-mb.phpt
@@ -8,12 +8,9 @@ if (!class_exists('finfo'))
USE_ZEND_ALLOC=0
--FILE--
<?php
- $finfo = finfo_open(FILEINFO_NONE, __DIR__ . DIRECTORY_SEPARATOR . "bug71527ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.magic");
- $info = finfo_file($finfo, __FILE__);
- var_dump($info);
+ $finfo = finfo_open(FILEINFO_NONE, __DIR__ . DIRECTORY_SEPARATOR . "bug71527ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.magic");
+ var_dump($finfo);
?>
--EXPECTF--
Warning: finfo_open(): Failed to load magic database at '%sbug71527ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.magic'. in %sbug71527-mb.php on line %d
-
-Warning: finfo_file() expects parameter 1 to be resource, bool given in %sbug71527-mb.php on line %d
bool(false)
diff --git a/ext/fileinfo/tests/bug71527.phpt b/ext/fileinfo/tests/bug71527.phpt
index 4fa2b30755..e6289b73fd 100644
--- a/ext/fileinfo/tests/bug71527.phpt
+++ b/ext/fileinfo/tests/bug71527.phpt
@@ -8,12 +8,9 @@ if (!class_exists('finfo'))
USE_ZEND_ALLOC=0
--FILE--
<?php
- $finfo = finfo_open(FILEINFO_NONE, __DIR__ . DIRECTORY_SEPARATOR . "bug71527.magic");
- $info = finfo_file($finfo, __FILE__);
- var_dump($info);
+ $finfo = finfo_open(FILEINFO_NONE, __DIR__ . DIRECTORY_SEPARATOR . "bug71527.magic");
+ var_dump($finfo);
?>
--EXPECTF--
Warning: finfo_open(): Failed to load magic database at '%sbug71527.magic'. in %sbug71527.php on line %d
-
-Warning: finfo_file() expects parameter 1 to be resource, bool given in %sbug71527.php on line %d
bool(false)
diff --git a/ext/fileinfo/tests/cve-2014-3538-mb.phpt b/ext/fileinfo/tests/cve-2014-3538-mb.phpt
index cc9084dc79..626c757144 100644
--- a/ext/fileinfo/tests/cve-2014-3538-mb.phpt
+++ b/ext/fileinfo/tests/cve-2014-3538-mb.phpt
@@ -21,9 +21,9 @@ var_dump(finfo_file($fi, $fd));
$t = microtime(true) - $t;
finfo_close($fi);
if ($t < 3) {
- echo "Ok\n";
+ echo "Ok\n";
} else {
- printf("Failed, time=%.2f\n", $t);
+ printf("Failed, time=%.2f\n", $t);
}
?>
diff --git a/ext/fileinfo/tests/cve-2014-3538-nojit.phpt b/ext/fileinfo/tests/cve-2014-3538-nojit.phpt
index 0072ab2047..02b314cbb1 100644
--- a/ext/fileinfo/tests/cve-2014-3538-nojit.phpt
+++ b/ext/fileinfo/tests/cve-2014-3538-nojit.phpt
@@ -25,9 +25,9 @@ var_dump(finfo_file($fi, $fd));
$t = microtime(true) - $t;
finfo_close($fi);
if ($t < 1) {
- echo "Ok\n";
+ echo "Ok\n";
} else {
- printf("Failed, time=%.2f\n", $t);
+ printf("Failed, time=%.2f\n", $t);
}
?>
diff --git a/ext/fileinfo/tests/cve-2014-3538.phpt b/ext/fileinfo/tests/cve-2014-3538.phpt
index 718457442a..a523861186 100644
--- a/ext/fileinfo/tests/cve-2014-3538.phpt
+++ b/ext/fileinfo/tests/cve-2014-3538.phpt
@@ -21,9 +21,9 @@ var_dump(finfo_file($fi, $fd));
$t = microtime(true) - $t;
finfo_close($fi);
if ($t < 1) {
- echo "Ok\n";
+ echo "Ok\n";
} else {
- printf("Failed, time=%.2f\n", $t);
+ printf("Failed, time=%.2f\n", $t);
}
?>
diff --git a/ext/fileinfo/tests/finfo_buffer_basic-mb.phpt b/ext/fileinfo/tests/finfo_buffer_basic-mb.phpt
index ca9c10cb66..1c9f0d1de2 100644
--- a/ext/fileinfo/tests/finfo_buffer_basic-mb.phpt
+++ b/ext/fileinfo/tests/finfo_buffer_basic-mb.phpt
@@ -5,7 +5,7 @@ Test finfo_buffer() function : basic functionality
--FILE--
<?php
/* Prototype : string finfo_buffer(resource finfo, char *string [, int options [, resource context]])
- * Description: Return infromation about a string buffer.
+ * Description: Return information about a string buffer.
* Source code: ext/fileinfo/fileinfo.c
* Alias to functions:
*/
@@ -13,31 +13,30 @@ Test finfo_buffer() function : basic functionality
$magicFile = __DIR__ . DIRECTORY_SEPARATOR . 'magicç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™';
$options = array(
- FILEINFO_NONE,
- FILEINFO_MIME,
+ FILEINFO_NONE,
+ FILEINFO_MIME,
);
$buffers = array(
- "Regular string here",
- "\177ELF",
- "\000\000\0001\000\000\0000\000\000\0000\000\000\0002\000\000\0000\000\000\0000\000\000\0003",
- "\x55\x7A\x6E\x61",
- "id=ImageMagick",
- "RIFFüîò^BAVI LISTv",
+ "Regular string here",
+ "\177ELF",
+ "\000\000\0001\000\000\0000\000\000\0000\000\000\0002\000\000\0000\000\000\0000\000\000\0003",
+ "\x55\x7A\x6E\x61",
+ "id=ImageMagick",
+ "RIFFüîò^BAVI LISTv",
);
echo "*** Testing finfo_buffer() : basic functionality ***\n";
foreach( $options as $option ) {
- $finfo = finfo_open( $option, $magicFile );
- foreach( $buffers as $string ) {
- var_dump( finfo_buffer( $finfo, $string, $option ) );
- }
- finfo_close( $finfo );
+ $finfo = finfo_open( $option, $magicFile );
+ foreach( $buffers as $string ) {
+ var_dump( finfo_buffer( $finfo, $string, $option ) );
+ }
+ finfo_close( $finfo );
}
?>
-===DONE===
--EXPECT--
*** Testing finfo_buffer() : basic functionality ***
string(36) "ASCII text, with no line terminators"
@@ -52,4 +51,3 @@ string(40) "application/octet-stream; charset=binary"
string(28) "text/plain; charset=us-ascii"
string(28) "text/plain; charset=us-ascii"
string(25) "text/plain; charset=utf-8"
-===DONE===
diff --git a/ext/fileinfo/tests/finfo_buffer_basic.phpt b/ext/fileinfo/tests/finfo_buffer_basic.phpt
index 07ee1b311e..d69d153f0d 100644
--- a/ext/fileinfo/tests/finfo_buffer_basic.phpt
+++ b/ext/fileinfo/tests/finfo_buffer_basic.phpt
@@ -5,7 +5,7 @@ Test finfo_buffer() function : basic functionality
--FILE--
<?php
/* Prototype : string finfo_buffer(resource finfo, char *string [, int options [, resource context]])
- * Description: Return infromation about a string buffer.
+ * Description: Return information about a string buffer.
* Source code: ext/fileinfo/fileinfo.c
* Alias to functions:
*/
@@ -13,31 +13,30 @@ Test finfo_buffer() function : basic functionality
$magicFile = __DIR__ . DIRECTORY_SEPARATOR . 'magic';
$options = array(
- FILEINFO_NONE,
- FILEINFO_MIME,
+ FILEINFO_NONE,
+ FILEINFO_MIME,
);
$buffers = array(
- "Regular string here",
- "\177ELF",
- "\000\000\0001\000\000\0000\000\000\0000\000\000\0002\000\000\0000\000\000\0000\000\000\0003",
- "\x55\x7A\x6E\x61",
- "id=ImageMagick",
- "RIFFüîò^BAVI LISTv",
+ "Regular string here",
+ "\177ELF",
+ "\000\000\0001\000\000\0000\000\000\0000\000\000\0002\000\000\0000\000\000\0000\000\000\0003",
+ "\x55\x7A\x6E\x61",
+ "id=ImageMagick",
+ "RIFFüîò^BAVI LISTv",
);
echo "*** Testing finfo_buffer() : basic functionality ***\n";
foreach( $options as $option ) {
- $finfo = finfo_open( $option, $magicFile );
- foreach( $buffers as $string ) {
- var_dump( finfo_buffer( $finfo, $string, $option ) );
- }
- finfo_close( $finfo );
+ $finfo = finfo_open( $option, $magicFile );
+ foreach( $buffers as $string ) {
+ var_dump( finfo_buffer( $finfo, $string, $option ) );
+ }
+ finfo_close( $finfo );
}
?>
-===DONE===
--EXPECT--
*** Testing finfo_buffer() : basic functionality ***
string(36) "ASCII text, with no line terminators"
@@ -52,4 +51,3 @@ string(40) "application/octet-stream; charset=binary"
string(28) "text/plain; charset=us-ascii"
string(28) "text/plain; charset=us-ascii"
string(25) "text/plain; charset=utf-8"
-===DONE===
diff --git a/ext/fileinfo/tests/finfo_buffer_variation1-mb.phpt b/ext/fileinfo/tests/finfo_buffer_variation1-mb.phpt
index 2637b15aee..8f26d80b92 100644
--- a/ext/fileinfo/tests/finfo_buffer_variation1-mb.phpt
+++ b/ext/fileinfo/tests/finfo_buffer_variation1-mb.phpt
@@ -5,7 +5,7 @@ Test finfo_buffer() function : basic functionality
--FILE--
<?php
/* Prototype : string finfo_buffer(resource finfo, char *string [, int options [, resource context]])
- * Description: Return infromation about a string buffer.
+ * Description: Return information about a string buffer.
* Source code: ext/fileinfo/fileinfo.c
* Alias to functions:
*/
@@ -13,30 +13,29 @@ Test finfo_buffer() function : basic functionality
$magicFile = __DIR__ . DIRECTORY_SEPARATOR . 'magicç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™';
$options = array(
- FILEINFO_NONE,
- FILEINFO_MIME,
+ FILEINFO_NONE,
+ FILEINFO_MIME,
);
$buffers = array(
- "Regular string here",
- "\177ELF",
- "\000\000\0001\000\000\0000\000\000\0000\000\000\0002\000\000\0000\000\000\0000\000\000\0003",
- "\x55\x7A\x6E\x61",
- "id=ImageMagick",
- "RIFFüîò^BAVI LISTv",
+ "Regular string here",
+ "\177ELF",
+ "\000\000\0001\000\000\0000\000\000\0000\000\000\0002\000\000\0000\000\000\0000\000\000\0003",
+ "\x55\x7A\x6E\x61",
+ "id=ImageMagick",
+ "RIFFüîò^BAVI LISTv",
);
echo "*** Testing finfo_buffer() : variation functionality with oo interface ***\n";
foreach( $options as $option ) {
- $finfo = new finfo( $option, $magicFile );
- foreach( $buffers as $string ) {
- var_dump( $finfo->buffer( $string, $option ) );
- }
+ $finfo = new finfo( $option, $magicFile );
+ foreach( $buffers as $string ) {
+ var_dump( $finfo->buffer( $string, $option ) );
+ }
}
?>
-===DONE===
--EXPECT--
*** Testing finfo_buffer() : variation functionality with oo interface ***
string(36) "ASCII text, with no line terminators"
@@ -51,4 +50,3 @@ string(40) "application/octet-stream; charset=binary"
string(28) "text/plain; charset=us-ascii"
string(28) "text/plain; charset=us-ascii"
string(25) "text/plain; charset=utf-8"
-===DONE===
diff --git a/ext/fileinfo/tests/finfo_buffer_variation1.phpt b/ext/fileinfo/tests/finfo_buffer_variation1.phpt
index a42c41d975..fafaaa9376 100644
--- a/ext/fileinfo/tests/finfo_buffer_variation1.phpt
+++ b/ext/fileinfo/tests/finfo_buffer_variation1.phpt
@@ -5,7 +5,7 @@ Test finfo_buffer() function : basic functionality
--FILE--
<?php
/* Prototype : string finfo_buffer(resource finfo, char *string [, int options [, resource context]])
- * Description: Return infromation about a string buffer.
+ * Description: Return information about a string buffer.
* Source code: ext/fileinfo/fileinfo.c
* Alias to functions:
*/
@@ -13,30 +13,29 @@ Test finfo_buffer() function : basic functionality
$magicFile = __DIR__ . DIRECTORY_SEPARATOR . 'magic';
$options = array(
- FILEINFO_NONE,
- FILEINFO_MIME,
+ FILEINFO_NONE,
+ FILEINFO_MIME,
);
$buffers = array(
- "Regular string here",
- "\177ELF",
- "\000\000\0001\000\000\0000\000\000\0000\000\000\0002\000\000\0000\000\000\0000\000\000\0003",
- "\x55\x7A\x6E\x61",
- "id=ImageMagick",
- "RIFFüîò^BAVI LISTv",
+ "Regular string here",
+ "\177ELF",
+ "\000\000\0001\000\000\0000\000\000\0000\000\000\0002\000\000\0000\000\000\0000\000\000\0003",
+ "\x55\x7A\x6E\x61",
+ "id=ImageMagick",
+ "RIFFüîò^BAVI LISTv",
);
echo "*** Testing finfo_buffer() : variation functionality with oo interface ***\n";
foreach( $options as $option ) {
- $finfo = new finfo( $option, $magicFile );
- foreach( $buffers as $string ) {
- var_dump( $finfo->buffer( $string, $option ) );
- }
+ $finfo = new finfo( $option, $magicFile );
+ foreach( $buffers as $string ) {
+ var_dump( $finfo->buffer( $string, $option ) );
+ }
}
?>
-===DONE===
--EXPECT--
*** Testing finfo_buffer() : variation functionality with oo interface ***
string(36) "ASCII text, with no line terminators"
@@ -51,4 +50,3 @@ string(40) "application/octet-stream; charset=binary"
string(28) "text/plain; charset=us-ascii"
string(28) "text/plain; charset=us-ascii"
string(25) "text/plain; charset=utf-8"
-===DONE===
diff --git a/ext/fileinfo/tests/finfo_close_basic.phpt b/ext/fileinfo/tests/finfo_close_basic.phpt
index 33d508a7c3..5798e5c947 100644
--- a/ext/fileinfo/tests/finfo_close_basic.phpt
+++ b/ext/fileinfo/tests/finfo_close_basic.phpt
@@ -25,11 +25,9 @@ var_dump( $finfo );
unset( $finfo );
?>
-===DONE===
--EXPECTF--
*** Testing finfo_close() : basic functionality ***
resource(%d) of type (file_info)
bool(true)
object(finfo)#%d (%d) {
}
-===DONE===
diff --git a/ext/fileinfo/tests/finfo_close_error.phpt b/ext/fileinfo/tests/finfo_close_error.phpt
index 7d865ea4fb..9f7ce8f0d8 100644
--- a/ext/fileinfo/tests/finfo_close_error.phpt
+++ b/ext/fileinfo/tests/finfo_close_error.phpt
@@ -12,36 +12,17 @@ Test finfo_close() function : error conditions
echo "*** Testing finfo_close() : error conditions ***\n";
-$magicFile = __DIR__ . DIRECTORY_SEPARATOR . 'magic';
-$finfo = finfo_open( FILEINFO_MIME, $magicFile );
-$fp = fopen( __FILE__, 'r' );
-
-echo "\n-- Testing finfo_close() function with Zero arguments --\n";
-var_dump( finfo_close() );
-
-echo "\n-- Testing finfo_close() function with more than expected no. of arguments --\n";
-var_dump( finfo_close( $finfo, '10') );
-
echo "\n-- Testing finfo_close() function with wrong resource type --\n";
-var_dump( finfo_close( $fp ) );
+$fp = fopen( __FILE__, 'r' );
+try {
+ var_dump( finfo_close( $fp ) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
-===DONE===
---EXPECTF--
+--EXPECT--
*** Testing finfo_close() : error conditions ***
--- Testing finfo_close() function with Zero arguments --
-
-Warning: finfo_close() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
--- Testing finfo_close() function with more than expected no. of arguments --
-
-Warning: finfo_close() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
-
-- Testing finfo_close() function with wrong resource type --
-
-Warning: finfo_close(): supplied resource is not a valid file_info resource in %s on line %d
-bool(false)
-===DONE===
+finfo_close(): supplied resource is not a valid file_info resource
diff --git a/ext/fileinfo/tests/finfo_extension_flag.phpt b/ext/fileinfo/tests/finfo_extension_flag.phpt
index 8841fc005d..5c4079b97a 100644
--- a/ext/fileinfo/tests/finfo_extension_flag.phpt
+++ b/ext/fileinfo/tests/finfo_extension_flag.phpt
@@ -11,7 +11,5 @@ $f = new finfo;
var_dump($f->file(__DIR__ . "/resources/test.jpg", FILEINFO_EXTENSION));
?>
-===DONE===
--EXPECT--
string(17) "jpeg/jpg/jpe/jfif"
-===DONE===
diff --git a/ext/fileinfo/tests/finfo_file_001.phpt b/ext/fileinfo/tests/finfo_file_001.phpt
index 4650ff1c16..3d01c8e881 100644
--- a/ext/fileinfo/tests/finfo_file_001.phpt
+++ b/ext/fileinfo/tests/finfo_file_001.phpt
@@ -24,5 +24,5 @@ Warning: finfo_file(): Empty filename or path in %s on line %d
bool(false)
string(9) "directory"
-Warning: finfo_file(&): failed to open stream: No such file or directory in %s on line %d
+Warning: finfo_file(&): Failed to open stream: No such file or directory in %s on line %d
bool(false)
diff --git a/ext/fileinfo/tests/finfo_file_002.phpt b/ext/fileinfo/tests/finfo_file_002.phpt
index aa870cdfab..4d5348e346 100644
--- a/ext/fileinfo/tests/finfo_file_002.phpt
+++ b/ext/fileinfo/tests/finfo_file_002.phpt
@@ -9,9 +9,9 @@ $fp = finfo_open(FILEINFO_MIME_TYPE);
$results = array();
foreach (glob(__DIR__ . "/resources/*") as $filename) {
- if (is_file($filename)) {
- $results["$filename"] = finfo_file($fp, $filename);
- }
+ if (is_file($filename)) {
+ $results["$filename"] = finfo_file($fp, $filename);
+ }
}
ksort($results);
diff --git a/ext/fileinfo/tests/finfo_file_basic.phpt b/ext/fileinfo/tests/finfo_file_basic.phpt
index e65d70ec89..bd781be776 100644
--- a/ext/fileinfo/tests/finfo_file_basic.phpt
+++ b/ext/fileinfo/tests/finfo_file_basic.phpt
@@ -22,7 +22,6 @@ var_dump( finfo_file( $finfo, $magicFile ) );
var_dump( finfo_file( $finfo, $magicFile.chr(0).$magicFile) );
?>
-===DONE===
--EXPECTF--
*** Testing finfo_file() : basic functionality ***
string(28) "text/x-php; charset=us-ascii"
@@ -31,4 +30,3 @@ string(32) "text/plain; charset=unknown-8bit"
Warning: finfo_file(): Invalid path in %s%efinfo_file_basic.php on line %d
bool(false)
-===DONE===
diff --git a/ext/fileinfo/tests/finfo_file_regex.phpt b/ext/fileinfo/tests/finfo_file_regex.phpt
index f39bf073f3..4ce5550b4e 100644
--- a/ext/fileinfo/tests/finfo_file_regex.phpt
+++ b/ext/fileinfo/tests/finfo_file_regex.phpt
@@ -21,9 +21,7 @@ var_dump( finfo_file( $finfo, $file ) );
var_dump( finfo_file( $finfo, $file, FILEINFO_CONTINUE ) );
?>
-===DONE===
--EXPECTF--
*** Testing finfo_file() : regex rules ***
string(28) "text/plain; charset=us-ascii"
string(%d) "awk%sscript, ASCII text%A"
-===DONE===
diff --git a/ext/fileinfo/tests/finfo_open_001.phpt b/ext/fileinfo/tests/finfo_open_001.phpt
index 6089776aa1..af06278fae 100644
--- a/ext/fileinfo/tests/finfo_open_001.phpt
+++ b/ext/fileinfo/tests/finfo_open_001.phpt
@@ -5,7 +5,12 @@ finfo_open(): Testing magic_file names
--FILE--
<?php
-var_dump(finfo_open(FILEINFO_MIME, "\0"));
+try {
+ var_dump(finfo_open(FILEINFO_MIME, "\0"));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+
var_dump(finfo_open(FILEINFO_MIME, NULL));
var_dump(finfo_open(FILEINFO_MIME, ''));
var_dump(finfo_open(FILEINFO_MIME, 123));
@@ -14,28 +19,27 @@ var_dump(finfo_open(FILEINFO_MIME, '/foo/bar/inexistent'));
?>
--EXPECTF--
-Warning: finfo_open() expects parameter 2 to be a valid path, string given in %s on line %d
-bool(false)
+finfo_open() expects parameter 2 to be a valid path, string given
resource(%d) of type (file_info)
resource(%d) of type (file_info)
-Warning: finfo_open(%s123): failed to open stream: No such file or directory in %s on line %d
+Warning: finfo_open(%s123): Failed to open stream: No such file or directory in %s on line %d
-Warning: finfo_open(%s123): failed to open stream: No such file or directory in %s on line %d
+Warning: finfo_open(%s123): Failed to open stream: No such file or directory in %s on line %d
Warning: finfo_open(): Failed to load magic database at '%s123'. in %s on line %d
bool(false)
-Warning: finfo_open(%s1): failed to open stream: No such file or directory in %s on line %d
+Warning: finfo_open(%s1): Failed to open stream: No such file or directory in %s on line %d
-Warning: finfo_open(%s1): failed to open stream: No such file or directory in %s on line %d
+Warning: finfo_open(%s1): Failed to open stream: No such file or directory in %s on line %d
Warning: finfo_open(): Failed to load magic database at '%s1'. in %s on line %d
bool(false)
-Warning: finfo_open(%sinexistent): failed to open stream: No such file or directory in %s on line %d
+Warning: finfo_open(%sinexistent): Failed to open stream: No such file or directory in %s on line %d
-Warning: finfo_open(%sinexistent): failed to open stream: No such file or directory in %s on line %d
+Warning: finfo_open(%sinexistent): Failed to open stream: No such file or directory in %s on line %d
Warning: finfo_open(): Failed to load magic database at '%sinexistent'. in %s on line %d
bool(false)
diff --git a/ext/fileinfo/tests/finfo_open_002.phpt b/ext/fileinfo/tests/finfo_open_002.phpt
index e39d462147..35cf98c34d 100644
--- a/ext/fileinfo/tests/finfo_open_002.phpt
+++ b/ext/fileinfo/tests/finfo_open_002.phpt
@@ -6,7 +6,7 @@ FileInfo - Calling the constructor twice
<?php
$x = new finfo;
-$x->finfo();
+$x->__construct();
echo "done!\n";
diff --git a/ext/fileinfo/tests/finfo_open_basic.phpt b/ext/fileinfo/tests/finfo_open_basic.phpt
index 748f45d4c4..5fb254b274 100644
--- a/ext/fileinfo/tests/finfo_open_basic.phpt
+++ b/ext/fileinfo/tests/finfo_open_basic.phpt
@@ -24,12 +24,11 @@ var_dump( finfo_open( FILEINFO_CONTINUE, $magicFile ) );
var_dump( finfo_open( FILEINFO_PRESERVE_ATIME, $magicFile ) );
var_dump( finfo_open( FILEINFO_RAW, $magicFile ) );
-// OO inteface to finfo
+// OO interface to finfo
var_dump( new finfo( FILEINFO_MIME, $magicFile ) );
var_dump( new finfo() );
?>
-===DONE===
--EXPECTF--
*** Testing finfo_open() : basic functionality ***
resource(%d) of type (file_info)
@@ -43,4 +42,3 @@ object(finfo)#%d (%d) {
}
object(finfo)#%d (%d) {
}
-===DONE===
diff --git a/ext/fileinfo/tests/finfo_open_error.phpt b/ext/fileinfo/tests/finfo_open_error.phpt
index b4fc57c18c..deb35bb95f 100644
--- a/ext/fileinfo/tests/finfo_open_error.phpt
+++ b/ext/fileinfo/tests/finfo_open_error.phpt
@@ -15,10 +15,13 @@ $magicFile = __DIR__ . DIRECTORY_SEPARATOR . 'magic';
echo "*** Testing finfo_open() : error functionality ***\n";
var_dump( finfo_open( FILEINFO_MIME, 'foobarfile' ) );
-var_dump( finfo_open( array(), $magicFile ) );
-var_dump( finfo_open( FILEINFO_MIME, $magicFile, 'extraArg' ) );
var_dump( finfo_open( PHP_INT_MAX - 1, $magicFile ) );
-var_dump( finfo_open( 'foobar' ) );
+
+try {
+ var_dump( finfo_open( 'foobar' ) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
try {
var_dump( new finfo('foobar') );
@@ -27,27 +30,17 @@ try {
}
?>
-===DONE===
--EXPECTF--
*** Testing finfo_open() : error functionality ***
-Warning: finfo_open(%sfoobarfile): failed to open stream: No such file or directory in %sfinfo_open_error.php on line 12
+Warning: finfo_open(%sfoobarfile): Failed to open stream: No such file or directory in %sfinfo_open_error.php on line %d
-Warning: finfo_open(%sfoobarfile): failed to open stream: No such file or directory in %sfinfo_open_error.php on line 12
+Warning: finfo_open(%sfoobarfile): Failed to open stream: No such file or directory in %sfinfo_open_error.php on line %d
-Warning: finfo_open(): Failed to load magic database at '%sfoobarfile'. in %sfinfo_open_error.php on line 12
+Warning: finfo_open(): Failed to load magic database at '%sfoobarfile'. in %sfinfo_open_error.php on line %d
bool(false)
-Warning: finfo_open() expects parameter 1 to be int, array given in %sfinfo_open_error.php on line 13
-bool(false)
-
-Warning: finfo_open() expects at most 2 parameters, 3 given in %sfinfo_open_error.php on line 14
-bool(false)
-
-Notice: finfo_open(): Warning: using regular magic file `%smagic' in %sfinfo_open_error.php on line 15
+Notice: finfo_open(): Warning: using regular magic file `%smagic' in %sfinfo_open_error.php on line %d
resource(6) of type (file_info)
-
-Warning: finfo_open() expects parameter 1 to be int, string given in %sfinfo_open_error.php on line 16
-bool(false)
-finfo::finfo() expects parameter 1 to be int, string given
-===DONE===
+finfo_open() expects parameter 1 to be int, string given
+finfo::__construct() expects parameter 1 to be int, string given
diff --git a/ext/fileinfo/tests/finfo_open_variation1.phpt b/ext/fileinfo/tests/finfo_open_variation1.phpt
index d788e50b9e..2635610199 100644
--- a/ext/fileinfo/tests/finfo_open_variation1.phpt
+++ b/ext/fileinfo/tests/finfo_open_variation1.phpt
@@ -20,9 +20,7 @@ var_dump( finfo_open( FILEINFO_MIME | FILEINFO_SYMLINK, $magicFile ) );
var_dump( finfo_open( FILEINFO_DEVICES | FILEINFO_RAW, $magicFile ) );
?>
-===DONE===
--EXPECTF--
*** Testing finfo_open() : variations in opening ***
resource(%d) of type (file_info)
resource(%d) of type (file_info)
-===DONE===
diff --git a/ext/fileinfo/tests/finfo_phpinfo_basic.phpt b/ext/fileinfo/tests/finfo_phpinfo_basic.phpt
index 14746a8f04..5eea4efba7 100644
--- a/ext/fileinfo/tests/finfo_phpinfo_basic.phpt
+++ b/ext/fileinfo/tests/finfo_phpinfo_basic.phpt
@@ -14,8 +14,6 @@ $output = ob_get_clean();
var_dump(preg_match("/fileinfo support => enabled/", $output));
?>
-===DONE===
--EXPECT--
*** Testing finfo extension : loading info phpinfo() ***
int(1)
-===DONE===
diff --git a/ext/fileinfo/tests/finfo_set_flags_basic-mb.phpt b/ext/fileinfo/tests/finfo_set_flags_basic-mb.phpt
index 412fe5b7f3..50a1559f58 100644
--- a/ext/fileinfo/tests/finfo_set_flags_basic-mb.phpt
+++ b/ext/fileinfo/tests/finfo_set_flags_basic-mb.phpt
@@ -17,26 +17,16 @@ echo "*** Testing finfo_set_flags() : basic functionality ***\n";
var_dump( finfo_set_flags( $finfo, FILEINFO_NONE ) );
var_dump( finfo_set_flags( $finfo, FILEINFO_SYMLINK ) );
-var_dump( finfo_set_flags() );
finfo_close( $finfo );
// OO way
$finfo = new finfo( FILEINFO_NONE, $magicFile );
var_dump( $finfo->set_flags( FILEINFO_MIME ) );
-var_dump( $finfo->set_flags() );
?>
-===DONE===
--EXPECTF--
*** Testing finfo_set_flags() : basic functionality ***
bool(true)
bool(true)
-
-Warning: finfo_set_flags() expects exactly 2 parameters, 0 given in %s on line %d
-bool(false)
bool(true)
-
-Warning: finfo::set_flags() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/fileinfo/tests/finfo_set_flags_basic.phpt b/ext/fileinfo/tests/finfo_set_flags_basic.phpt
index cd7f16c67e..95f2648f51 100644
--- a/ext/fileinfo/tests/finfo_set_flags_basic.phpt
+++ b/ext/fileinfo/tests/finfo_set_flags_basic.phpt
@@ -17,26 +17,16 @@ echo "*** Testing finfo_set_flags() : basic functionality ***\n";
var_dump( finfo_set_flags( $finfo, FILEINFO_NONE ) );
var_dump( finfo_set_flags( $finfo, FILEINFO_SYMLINK ) );
-var_dump( finfo_set_flags() );
finfo_close( $finfo );
// OO way
$finfo = new finfo( FILEINFO_NONE, $magicFile );
var_dump( $finfo->set_flags( FILEINFO_MIME ) );
-var_dump( $finfo->set_flags() );
?>
-===DONE===
--EXPECTF--
*** Testing finfo_set_flags() : basic functionality ***
bool(true)
bool(true)
-
-Warning: finfo_set_flags() expects exactly 2 parameters, 0 given in %s on line %d
-bool(false)
bool(true)
-
-Warning: finfo::set_flags() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/fileinfo/tests/magic b/ext/fileinfo/tests/magic
index c53d0fdd8d..cb9b03c099 100644
--- a/ext/fileinfo/tests/magic
+++ b/ext/fileinfo/tests/magic
@@ -10475,7 +10475,7 @@
# updated by Joerg Jenderek at Oct 2008
# variables according to grub-0.97/stage1/stage1.S or
# https://www.gnu.org/software/grub/manual/grub.html#Embedded-data
-# usual values are marked with comments to get only informations of strange GRUB loaders
+# usual values are marked with comments to get only information of strange GRUB loaders
>342 search/60 \0Geom\0
#>0 ulelong x %x=0x009048EB , 0x2a9048EB 0
>>0x41 ubyte <2
@@ -11280,7 +11280,7 @@
# In the second sector (+0x200) are variables according to grub-0.97/stage2/asm.S or
# grub-1.94/kern/i386/pc/startup.S
# https://www.gnu.org/software/grub/manual/grub.html#Embedded-data
-# usual values are marked with comments to get only informations of strange GRUB loaders
+# usual values are marked with comments to get only information of strange GRUB loaders
0x200 uleshort 0x70EA
# found only version 3.{1,2}
>0x206 ubeshort >0x0300
@@ -11342,7 +11342,7 @@
0 ulelong&0x804000E9 0x000000E9
!:strength +60
# mtools-3.9.8/msdos.h
-# usual values are marked with comments to get only informations of strange FAT systems
+# usual values are marked with comments to get only information of strange FAT systems
# valid sectorsize must be a power of 2 from 32 to 32768
>11 uleshort&0x001f 0
>>11 uleshort <32769
diff --git a/ext/fileinfo/tests/magicç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™ b/ext/fileinfo/tests/magicç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™
index c53d0fdd8d..7ccafe869f 100644
--- a/ext/fileinfo/tests/magicç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™
+++ b/ext/fileinfo/tests/magicç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™
@@ -10475,7 +10475,7 @@
# updated by Joerg Jenderek at Oct 2008
# variables according to grub-0.97/stage1/stage1.S or
# https://www.gnu.org/software/grub/manual/grub.html#Embedded-data
-# usual values are marked with comments to get only informations of strange GRUB loaders
+# usual values are marked with comments to get only information of strange GRUB loaders
>342 search/60 \0Geom\0
#>0 ulelong x %x=0x009048EB , 0x2a9048EB 0
>>0x41 ubyte <2
diff --git a/ext/fileinfo/tests/mime_content_type_001.phpt b/ext/fileinfo/tests/mime_content_type_001.phpt
index 8d18cb43ac..472d3e84f8 100644
--- a/ext/fileinfo/tests/mime_content_type_001.phpt
+++ b/ext/fileinfo/tests/mime_content_type_001.phpt
@@ -23,7 +23,7 @@ Warning: mime_content_type(): Can only process string or stream arguments in %s
Warning: mime_content_type(): Can only process string or stream arguments in %s on line %d
-Warning: mime_content_type(foo/inexistent): failed to open stream: No such file or directory in %s on line %d
+Warning: mime_content_type(foo/inexistent): Failed to open stream: No such file or directory in %s on line %d
Warning: mime_content_type(): Empty filename or path in %s on line %d
diff --git a/ext/fileinfo/tests/skipif.inc b/ext/fileinfo/tests/skipif.inc
index 97b2546809..3a0642a7b3 100644
--- a/ext/fileinfo/tests/skipif.inc
+++ b/ext/fileinfo/tests/skipif.inc
@@ -1,7 +1,7 @@
<?php
if (!extension_loaded('fileinfo')) {
- die("skip fileinfo extension not loaded");
+ die("skip fileinfo extension not loaded");
}
?>
diff --git a/ext/filter/callback_filter.c b/ext/filter/callback_filter.c
index 5de24d18e1..d9ad4bdf24 100644
--- a/ext/filter/callback_filter.c
+++ b/ext/filter/callback_filter.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/filter/filter.c b/ext/filter/filter.c
index e615edf084..996308a418 100644
--- a/ext/filter/filter.c
+++ b/ext/filter/filter.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -28,6 +26,7 @@
ZEND_DECLARE_MODULE_GLOBALS(filter)
#include "filter_private.h"
+#include "filter_arginfo.h"
typedef struct filter_list_entry {
const char *name;
@@ -38,7 +37,7 @@ typedef struct filter_list_entry {
/* {{{ filter_list */
static const filter_list_entry filter_list[] = {
{ "int", FILTER_VALIDATE_INT, php_filter_int },
- { "boolean", FILTER_VALIDATE_BOOLEAN, php_filter_boolean },
+ { "boolean", FILTER_VALIDATE_BOOL, php_filter_boolean },
{ "float", FILTER_VALIDATE_FLOAT, php_filter_float },
{ "validate_regexp", FILTER_VALIDATE_REGEXP, php_filter_validate_regexp },
@@ -58,7 +57,6 @@ static const filter_list_entry filter_list[] = {
{ "url", FILTER_SANITIZE_URL, php_filter_url },
{ "number_int", FILTER_SANITIZE_NUMBER_INT, php_filter_number_int },
{ "number_float", FILTER_SANITIZE_NUMBER_FLOAT, php_filter_number_float },
- { "magic_quotes", FILTER_SANITIZE_MAGIC_QUOTES, php_filter_magic_quotes },
{ "add_slashes", FILTER_SANITIZE_ADD_SLASHES, php_filter_add_slashes },
{ "callback", FILTER_CALLBACK, php_filter_callback },
@@ -80,45 +78,6 @@ static const filter_list_entry filter_list[] = {
static unsigned int php_sapi_filter(int arg, char *var, char **val, size_t val_len, size_t *new_val_len);
static unsigned int php_sapi_filter_init(void);
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_filter_input, 0, 0, 2)
- ZEND_ARG_INFO(0, type)
- ZEND_ARG_INFO(0, variable_name)
- ZEND_ARG_INFO(0, filter)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_filter_var, 0, 0, 1)
- ZEND_ARG_INFO(0, variable)
- ZEND_ARG_INFO(0, filter)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_filter_input_array, 0, 0, 1)
- ZEND_ARG_INFO(0, type)
- ZEND_ARG_INFO(0, definition)
- ZEND_ARG_INFO(0, add_empty)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_filter_var_array, 0, 0, 1)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, definition)
- ZEND_ARG_INFO(0, add_empty)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_filter_list, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_filter_has_var, 0, 0, 2)
- ZEND_ARG_INFO(0, type)
- ZEND_ARG_INFO(0, variable_name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_filter_id, 0, 0, 1)
- ZEND_ARG_INFO(0, filtername)
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ filter_functions[]
*/
static const zend_function_entry filter_functions[] = {
@@ -222,8 +181,6 @@ PHP_MINIT_FUNCTION(filter)
REGISTER_LONG_CONSTANT("INPUT_COOKIE", PARSE_COOKIE, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("INPUT_ENV", PARSE_ENV, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("INPUT_SERVER", PARSE_SERVER, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("INPUT_SESSION", PARSE_SESSION, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("INPUT_REQUEST", PARSE_REQUEST, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FILTER_FLAG_NONE", FILTER_FLAG_NONE, CONST_CS | CONST_PERSISTENT);
@@ -233,7 +190,8 @@ PHP_MINIT_FUNCTION(filter)
REGISTER_LONG_CONSTANT("FILTER_NULL_ON_FAILURE", FILTER_NULL_ON_FAILURE, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FILTER_VALIDATE_INT", FILTER_VALIDATE_INT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILTER_VALIDATE_BOOLEAN", FILTER_VALIDATE_BOOLEAN, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILTER_VALIDATE_BOOLEAN", FILTER_VALIDATE_BOOL, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("FILTER_VALIDATE_BOOL", FILTER_VALIDATE_BOOL, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FILTER_VALIDATE_FLOAT", FILTER_VALIDATE_FLOAT, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FILTER_VALIDATE_REGEXP", FILTER_VALIDATE_REGEXP, CONST_CS | CONST_PERSISTENT);
@@ -255,7 +213,6 @@ PHP_MINIT_FUNCTION(filter)
REGISTER_LONG_CONSTANT("FILTER_SANITIZE_URL", FILTER_SANITIZE_URL, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FILTER_SANITIZE_NUMBER_INT", FILTER_SANITIZE_NUMBER_INT, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FILTER_SANITIZE_NUMBER_FLOAT", FILTER_SANITIZE_NUMBER_FLOAT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILTER_SANITIZE_MAGIC_QUOTES", FILTER_SANITIZE_MAGIC_QUOTES, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FILTER_SANITIZE_ADD_SLASHES", FILTER_SANITIZE_ADD_SLASHES, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FILTER_CALLBACK", FILTER_CALLBACK, CONST_CS | CONST_PERSISTENT);
@@ -276,8 +233,6 @@ PHP_MINIT_FUNCTION(filter)
REGISTER_LONG_CONSTANT("FILTER_FLAG_ALLOW_THOUSAND", FILTER_FLAG_ALLOW_THOUSAND, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FILTER_FLAG_ALLOW_SCIENTIFIC", FILTER_FLAG_ALLOW_SCIENTIFIC, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILTER_FLAG_SCHEME_REQUIRED", FILTER_FLAG_SCHEME_REQUIRED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("FILTER_FLAG_HOST_REQUIRED", FILTER_FLAG_HOST_REQUIRED, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FILTER_FLAG_PATH_REQUIRED", FILTER_FLAG_PATH_REQUIRED, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("FILTER_FLAG_QUERY_REQUIRED", FILTER_FLAG_QUERY_REQUIRED, CONST_CS | CONST_PERSISTENT);
@@ -551,13 +506,8 @@ static zval *php_filter_get_storage(zend_long arg)/* {{{ */
}
array_ptr = !Z_ISUNDEF(IF_G(env_array)) ? &IF_G(env_array) : &PG(http_globals)[TRACK_VARS_ENV];
break;
- case PARSE_SESSION:
- /* FIXME: Implement session source */
- php_error_docref(NULL, E_WARNING, "INPUT_SESSION is not yet implemented");
- break;
- case PARSE_REQUEST:
- /* FIXME: Implement request source */
- php_error_docref(NULL, E_WARNING, "INPUT_REQUEST is not yet implemented");
+ default:
+ php_error_docref(NULL, E_WARNING, "Unknown source");
break;
}
@@ -580,7 +530,7 @@ PHP_FUNCTION(filter_has_var)
zval *array_ptr = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lS", &arg, &var) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
array_ptr = php_filter_get_storage(arg);
@@ -724,7 +674,7 @@ PHP_FUNCTION(filter_input)
zend_string *var;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lS|lz", &fetch_from, &var, &filter, &filter_args) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!PHP_FILTER_ID_EXISTS(filter)) {
@@ -778,7 +728,7 @@ PHP_FUNCTION(filter_var)
zval *filter_args = NULL, *data;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|lz", &data, &filter, &filter_args) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!PHP_FILTER_ID_EXISTS(filter)) {
@@ -801,7 +751,7 @@ PHP_FUNCTION(filter_input_array)
zend_bool add_empty = 1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|zb", &fetch_from, &op, &add_empty) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (op && (Z_TYPE_P(op) != IS_ARRAY) && !(Z_TYPE_P(op) == IS_LONG && PHP_FILTER_ID_EXISTS(Z_LVAL_P(op)))) {
@@ -846,7 +796,7 @@ PHP_FUNCTION(filter_var_array)
zend_bool add_empty = 1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "a|zb", &array_input, &op, &add_empty) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (op && (Z_TYPE_P(op) != IS_ARRAY) && !(Z_TYPE_P(op) == IS_LONG && PHP_FILTER_ID_EXISTS(Z_LVAL_P(op)))) {
@@ -864,7 +814,7 @@ PHP_FUNCTION(filter_list)
int i, size = sizeof(filter_list) / sizeof(filter_list_entry);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
array_init(return_value);
@@ -884,7 +834,7 @@ PHP_FUNCTION(filter_id)
char *filter;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &filter, &filter_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
for (i = 0; i < size; ++i) {
diff --git a/ext/filter/filter.stub.php b/ext/filter/filter.stub.php
new file mode 100644
index 0000000000..31a7f2c3e6
--- /dev/null
+++ b/ext/filter/filter.stub.php
@@ -0,0 +1,32 @@
+<?php
+
+function filter_has_var(int $type, string $variable_name): bool {}
+
+/**
+ * @param mixed $options
+ * @return mixed
+ */
+function filter_input(int $type, string $variable_name, int $filter = FILTER_DEFAULT, $options = NULL) {}
+
+/**
+ * @param mixed $variable
+ * @param mixed $options
+ * @return mixed
+ */
+function filter_var($variable, int $filter = FILTER_DEFAULT, $options = NULL) {}
+
+/**
+ * @param mixed $options
+ * @return mixed
+ */
+function filter_input_array(int $type, $options = NULL, bool $add_empty = true) {}
+
+/**
+ * @param mixed $options
+ * @return mixed
+ */
+function filter_var_array(array $data, $options = NULL, bool $add_empty = true) {}
+
+function filter_list(): array {}
+
+function filter_id(string $filtername): int|false {}
diff --git a/ext/filter/filter_arginfo.h b/ext/filter/filter_arginfo.h
new file mode 100644
index 0000000000..0c2f590dce
--- /dev/null
+++ b/ext/filter/filter_arginfo.h
@@ -0,0 +1,38 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_filter_has_var, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, variable_name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_filter_input, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, variable_name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, filter, IS_LONG, 0)
+ ZEND_ARG_INFO(0, options)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_filter_var, 0, 0, 1)
+ ZEND_ARG_INFO(0, variable)
+ ZEND_ARG_TYPE_INFO(0, filter, IS_LONG, 0)
+ ZEND_ARG_INFO(0, options)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_filter_input_array, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+ ZEND_ARG_INFO(0, options)
+ ZEND_ARG_TYPE_INFO(0, add_empty, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_filter_var_array, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0)
+ ZEND_ARG_INFO(0, options)
+ ZEND_ARG_TYPE_INFO(0, add_empty, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_filter_list, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_filter_id, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, filtername, IS_STRING, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/filter/filter_private.h b/ext/filter/filter_private.h
index a604908707..f8a02a4907 100644
--- a/ext/filter/filter_private.h
+++ b/ext/filter/filter_private.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -58,7 +56,7 @@
#define FILTER_FLAG_EMAIL_UNICODE 0x100000
#define FILTER_VALIDATE_INT 0x0101
-#define FILTER_VALIDATE_BOOLEAN 0x0102
+#define FILTER_VALIDATE_BOOL 0x0102
#define FILTER_VALIDATE_FLOAT 0x0103
#define FILTER_VALIDATE_REGEXP 0x0110
@@ -81,7 +79,6 @@
#define FILTER_SANITIZE_URL 0x0206
#define FILTER_SANITIZE_NUMBER_INT 0x0207
#define FILTER_SANITIZE_NUMBER_FLOAT 0x0208
-#define FILTER_SANITIZE_MAGIC_QUOTES 0x0209
#define FILTER_SANITIZE_FULL_SPECIAL_CHARS 0x020a
#define FILTER_SANITIZE_ADD_SLASHES 0x020b
#define FILTER_SANITIZE_LAST 0x020b
diff --git a/ext/filter/logical_filters.c b/ext/filter/logical_filters.c
index f32a8b18ce..79a0e9d9ab 100644
--- a/ext/filter/logical_filters.c
+++ b/ext/filter/logical_filters.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -362,7 +360,7 @@ void php_filter_float(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
if (decimal_set) {
if (decimal_len != 1) {
- php_error_docref(NULL, E_WARNING, "decimal separator must be one char");
+ php_error_docref(NULL, E_WARNING, "Decimal separator must be one char");
RETURN_VALIDATION_FAILED
} else {
dec_sep = *decimal;
@@ -373,7 +371,7 @@ void php_filter_float(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
if (thousand_set) {
if (thousand_len < 1) {
- php_error_docref(NULL, E_WARNING, "thousand separator must be at least one char");
+ php_error_docref(NULL, E_WARNING, "Thousand separator must be at least one char");
RETURN_VALIDATION_FAILED
} else {
tsd_sep = thousand;
@@ -560,11 +558,6 @@ void php_filter_validate_url(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
php_url *url;
size_t old_len = Z_STRLEN_P(value);
- if (flags & (FILTER_FLAG_SCHEME_REQUIRED | FILTER_FLAG_HOST_REQUIRED)) {
- php_error_docref(NULL, E_DEPRECATED,
- "explicit use of FILTER_FLAG_SCHEME_REQUIRED and FILTER_FLAG_HOST_REQUIRED is deprecated");
- }
-
php_filter_url(value, flags, option_array, charset);
if (Z_TYPE_P(value) != IS_STRING || old_len != Z_STRLEN_P(value)) {
diff --git a/ext/filter/php_filter.h b/ext/filter/php_filter.h
index 24b177d275..2a923ab953 100644
--- a/ext/filter/php_filter.h
+++ b/ext/filter/php_filter.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -92,7 +90,6 @@ void php_filter_url(PHP_INPUT_FILTER_PARAM_DECL);
void php_filter_number_int(PHP_INPUT_FILTER_PARAM_DECL);
void php_filter_number_float(PHP_INPUT_FILTER_PARAM_DECL);
void php_filter_add_slashes(PHP_INPUT_FILTER_PARAM_DECL);
-void php_filter_magic_quotes(PHP_INPUT_FILTER_PARAM_DECL);
void php_filter_callback(PHP_INPUT_FILTER_PARAM_DECL);
diff --git a/ext/filter/sanitizing_filters.c b/ext/filter/sanitizing_filters.c
index 5b4fb4432c..25b2f39fde 100644
--- a/ext/filter/sanitizing_filters.c
+++ b/ext/filter/sanitizing_filters.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -74,17 +72,7 @@ static void php_filter_encode_url(zval *value, const unsigned char* chars, const
while (s < e) {
tmp[*s++] = '\0';
}
-/* XXX: This is not needed since these chars in the allowed list never include the high/low/null value
- if (encode_nul) {
- tmp[0] = 1;
- }
- if (high) {
- memset(tmp + 127, 1, sizeof(tmp) - 127);
- }
- if (low) {
- memset(tmp, 1, 32);
- }
-*/
+
str = zend_string_safe_alloc(Z_STRLEN_P(value), 3, 0, 0);
p = (unsigned char *) ZSTR_VAL(str);
s = (unsigned char *) Z_STRVAL_P(value);
@@ -206,7 +194,7 @@ void php_filter_string(PHP_INPUT_FILTER_PARAM_DECL)
php_filter_encode_html(value, enc);
/* strip tags, implicitly also removes \0 chars */
- new_len = php_strip_tags_ex(Z_STRVAL_P(value), Z_STRLEN_P(value), NULL, NULL, 0, 1);
+ new_len = php_strip_tags_ex(Z_STRVAL_P(value), Z_STRLEN_P(value), NULL, 0, 1);
Z_STRLEN_P(value) = new_len;
if (new_len == 0) {
@@ -375,17 +363,3 @@ void php_filter_add_slashes(PHP_INPUT_FILTER_PARAM_DECL)
ZVAL_STR(value, buf);
}
/* }}} */
-
-/* {{{ php_filter_magic_quotes */
-void php_filter_magic_quotes(PHP_INPUT_FILTER_PARAM_DECL)
-{
- zend_string *buf;
- php_error_docref(NULL, E_DEPRECATED,
- "FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES instead");
-
- buf = php_addslashes(Z_STR_P(value));
-
- zval_ptr_dtor(value);
- ZVAL_STR(value, buf);
-}
-/* }}} */
diff --git a/ext/filter/tests/007.phpt b/ext/filter/tests/007.phpt
index 87f9a77a12..dc966b8cc9 100644
--- a/ext/filter/tests/007.phpt
+++ b/ext/filter/tests/007.phpt
@@ -14,20 +14,12 @@ var_dump(filter_has_var(INPUT_GET, "abc"));
var_dump(filter_has_var(INPUT_GET, "nonex"));
var_dump(filter_has_var(INPUT_GET, " "));
var_dump(filter_has_var(INPUT_GET, ""));
-var_dump(filter_has_var(INPUT_GET, array()));
var_dump(filter_has_var(INPUT_POST, "b"));
var_dump(filter_has_var(INPUT_POST, "bbc"));
var_dump(filter_has_var(INPUT_POST, "nonex"));
var_dump(filter_has_var(INPUT_POST, " "));
var_dump(filter_has_var(INPUT_POST, ""));
-var_dump(filter_has_var(INPUT_POST, array()));
-
-var_dump(filter_has_var(-1, ""));
-var_dump(filter_has_var("", ""));
-var_dump(filter_has_var(array(), array()));
-var_dump(filter_has_var(array(), ""));
-var_dump(filter_has_var("", array()));
echo "Done\n";
?>
@@ -37,28 +29,9 @@ bool(true)
bool(false)
bool(false)
bool(false)
-
-Warning: filter_has_var() expects parameter 2 to be string, array given in %s007.php on line %d
-bool(false)
bool(true)
bool(true)
bool(false)
bool(false)
bool(false)
-
-Warning: filter_has_var() expects parameter 2 to be string, array given in %s007.php on line %d
-bool(false)
-bool(false)
-
-Warning: filter_has_var() expects parameter 1 to be int, string given in %s007.php on line %d
-bool(false)
-
-Warning: filter_has_var() expects parameter 1 to be int, array given in %s007.php on line %d
-bool(false)
-
-Warning: filter_has_var() expects parameter 1 to be int, array given in %s007.php on line %d
-bool(false)
-
-Warning: filter_has_var() expects parameter 1 to be int, string given in %s007.php on line %d
-bool(false)
Done
diff --git a/ext/filter/tests/008.phpt b/ext/filter/tests/008.phpt
index a3cb7172ff..75e0968c62 100644
--- a/ext/filter/tests/008.phpt
+++ b/ext/filter/tests/008.phpt
@@ -6,12 +6,11 @@ filter_list()
<?php
var_dump(filter_list());
-var_dump(filter_list(array()));
echo "Done\n";
?>
--EXPECTF--
-array(22) {
+array(21) {
[0]=>
string(3) "int"
[1]=>
@@ -51,13 +50,8 @@ array(22) {
[18]=>
string(12) "number_float"
[19]=>
- string(12) "magic_quotes"
- [20]=>
string(11) "add_slashes"
- [21]=>
+ [20]=>
string(8) "callback"
}
-
-Warning: filter_list() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
Done
diff --git a/ext/filter/tests/009.phpt b/ext/filter/tests/009.phpt
index 5c38e5603a..f456dc6dc1 100644
--- a/ext/filter/tests/009.phpt
+++ b/ext/filter/tests/009.phpt
@@ -10,23 +10,15 @@ var_dump(filter_id("string"));
var_dump(filter_id("url"));
var_dump(filter_id("int"));
var_dump(filter_id("none"));
-var_dump(filter_id(array()));
var_dump(filter_id(-1));
-var_dump(filter_id(0,0,0));
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
int(513)
int(513)
int(518)
int(257)
bool(false)
-
-Warning: filter_id() expects parameter 1 to be string, array given in %s on line %d
-NULL
bool(false)
-
-Warning: filter_id() expects exactly 1 parameter, 3 given in %s on line %d
-NULL
Done
diff --git a/ext/filter/tests/010.phpt b/ext/filter/tests/010.phpt
index 3e71d331bd..14f8db01af 100644
--- a/ext/filter/tests/010.phpt
+++ b/ext/filter/tests/010.phpt
@@ -9,7 +9,6 @@ precision=14
var_dump(filter_var(array(1,"1","", "-23234", "text", "asdf234asdfgs", array()), FILTER_VALIDATE_INT, FILTER_REQUIRE_ARRAY));
var_dump(filter_var(array(1.2,"1.7","", "-23234.123", "text", "asdf234.2asdfgs", array()), FILTER_VALIDATE_FLOAT, FILTER_REQUIRE_ARRAY));
-var_dump(filter_var(1, array()));
var_dump(filter_var(1, FILTER_SANITIZE_STRING, 1));
var_dump(filter_var(1, FILTER_SANITIZE_STRING, 0));
var_dump(filter_var(1, FILTER_SANITIZE_STRING, array()));
@@ -53,9 +52,6 @@ array(7) {
array(0) {
}
}
-
-Warning: filter_var() expects parameter 2 to be int, array given in %s on line %d
-NULL
string(1) "1"
string(1) "1"
string(1) "1"
diff --git a/ext/filter/tests/011.phpt b/ext/filter/tests/011.phpt
index b5075d1821..1b2a2ec357 100644
--- a/ext/filter/tests/011.phpt
+++ b/ext/filter/tests/011.phpt
@@ -20,12 +20,6 @@ var_dump(filter_input(INPUT_POST, "d", FILTER_VALIDATE_FLOAT));
var_dump(filter_input(INPUT_POST, "c", FILTER_SANITIZE_SPECIAL_CHARS));
var_dump(filter_input(INPUT_POST, "d", FILTER_VALIDATE_INT));
-var_dump(filter_var(new stdClass, "d"));
-
-var_dump(filter_input(INPUT_POST, "c", "", ""));
-var_dump(filter_var("", "", "", "", ""));
-var_dump(filter_var(0, 0, 0, 0, 0));
-
echo "Done\n";
?>
--EXPECTF--
@@ -39,16 +33,4 @@ string(6) "string"
float(12345.7)
string(29) "&#60;p&#62;string&#60;/p&#62;"
bool(false)
-
-Warning: filter_var() expects parameter 2 to be int, string given in %s011.php on line %d
-NULL
-
-Warning: filter_input() expects parameter 3 to be int, string given in %s011.php on line %d
-NULL
-
-Warning: filter_var() expects at most 3 parameters, 5 given in %s011.php on line %d
-NULL
-
-Warning: filter_var() expects at most 3 parameters, 5 given in %s011.php on line %d
-NULL
Done
diff --git a/ext/filter/tests/014.phpt b/ext/filter/tests/014.phpt
index 6b34a19b77..e79fcb0178 100644
--- a/ext/filter/tests/014.phpt
+++ b/ext/filter/tests/014.phpt
@@ -7,9 +7,9 @@ filter_var() and FILTER_VALIDATE_BOOLEAN
class test {
- function __toString() {
- return "blah";
- }
+ function __toString() {
+ return "blah";
+ }
}
$t = new test;
diff --git a/ext/filter/tests/015.phpt b/ext/filter/tests/015.phpt
index f9c190a0d0..07a1874560 100644
--- a/ext/filter/tests/015.phpt
+++ b/ext/filter/tests/015.phpt
@@ -50,7 +50,7 @@ array(),
"http://example.com:65537",
);
foreach ($values as $value) {
- var_dump(filter_var($value, FILTER_VALIDATE_URL));
+ var_dump(filter_var($value, FILTER_VALIDATE_URL));
}
diff --git a/ext/filter/tests/016.phpt b/ext/filter/tests/016.phpt
index c614903f63..a5a5816459 100644
--- a/ext/filter/tests/016.phpt
+++ b/ext/filter/tests/016.phpt
@@ -22,7 +22,7 @@ $values = Array(
'foo@bar.-'
);
foreach ($values as $value) {
- var_dump(filter_var($value, FILTER_VALIDATE_EMAIL));
+ var_dump(filter_var($value, FILTER_VALIDATE_EMAIL));
}
echo "Done\n";
diff --git a/ext/filter/tests/020.phpt b/ext/filter/tests/020.phpt
deleted file mode 100644
index 5c2ec5bfb2..0000000000
--- a/ext/filter/tests/020.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-filter_var() and FILTER_SANITIZE_MAGIC_QUOTES
---SKIPIF--
-<?php if (!extension_loaded("filter")) die("skip"); ?>
---FILE--
-<?php
-
-var_dump(filter_var("test'asd'asd'' asd\'\"asdfasdf", FILTER_SANITIZE_MAGIC_QUOTES));
-var_dump(filter_var("'", FILTER_SANITIZE_MAGIC_QUOTES));
-var_dump(filter_var("", FILTER_SANITIZE_MAGIC_QUOTES));
-var_dump(filter_var(-1, FILTER_SANITIZE_MAGIC_QUOTES));
-
-echo "Done\n";
-?>
---EXPECTF--
-Deprecated: filter_var(): FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES instead in %s on line %d
-string(36) "test\'asd\'asd\'\' asd\\\'\"asdfasdf"
-
-Deprecated: filter_var(): FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES instead in %s on line %d
-string(2) "\'"
-
-Deprecated: filter_var(): FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES instead in %s on line %d
-string(0) ""
-
-Deprecated: filter_var(): FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES instead in %s on line %d
-string(2) "-1"
-Done
diff --git a/ext/filter/tests/022.phpt b/ext/filter/tests/022.phpt
index 91aca3e632..9621e9a8ab 100644
--- a/ext/filter/tests/022.phpt
+++ b/ext/filter/tests/022.phpt
@@ -7,7 +7,7 @@ filter_var() and FILTER_SANITIZE_EMAIL
var_dump(filter_var("a@b.c", FILTER_SANITIZE_EMAIL));
var_dump(filter_var("a[!@#$%^&*()@a@#$%^&*(.com@#$%^&*(", FILTER_SANITIZE_EMAIL));
-var_dump(filter_var("white space here \ \ \" som more", FILTER_SANITIZE_EMAIL));
+var_dump(filter_var("white space here \ \ \" some more", FILTER_SANITIZE_EMAIL));
var_dump(filter_var("", FILTER_SANITIZE_EMAIL));
var_dump(filter_var("123456789000000", FILTER_SANITIZE_EMAIL));
@@ -16,7 +16,7 @@ echo "Done\n";
--EXPECT--
string(5) "a@b.c"
string(30) "a[!@#$%^&*@a@#$%^&*.com@#$%^&*"
-string(21) "whitespaceheresommore"
+string(22) "whitespaceheresomemore"
string(0) ""
string(15) "123456789000000"
Done
diff --git a/ext/filter/tests/029.phpt b/ext/filter/tests/029.phpt
index 14b516c35a..2c5d64cbb2 100644
--- a/ext/filter/tests/029.phpt
+++ b/ext/filter/tests/029.phpt
@@ -7,7 +7,7 @@ filter_var() and FILTER_CALLBACK
/* Simple callback function */
function test($var) {
- return strtoupper($var);
+ return strtoupper($var);
}
var_dump(filter_var("data", FILTER_CALLBACK, array("options"=>"test")));
@@ -19,9 +19,9 @@ var_dump(filter_var("qwe", FILTER_CALLBACK));
/* Simple class method callback */
class test_class {
- static function test ($var) {
- return strtolower($var);
- }
+ static function test ($var) {
+ return strtolower($var);
+ }
}
var_dump(filter_var("dAtA", FILTER_CALLBACK, array("options"=>array("test_class", "test"))));
@@ -38,7 +38,7 @@ var_dump(filter_var("", FILTER_CALLBACK, array("options"=>"test1")));
/* attempting to change data by reference */
function test2(&$var) {
- $var = 1;
+ $var = 1;
}
var_dump(filter_var("data", FILTER_CALLBACK, array("options"=>"test2")));
@@ -47,7 +47,7 @@ var_dump(filter_var("", FILTER_CALLBACK, array("options"=>"test2")));
/* unsetting data */
function test3(&$var) {
- unset($var);
+ unset($var);
}
var_dump(filter_var("data", FILTER_CALLBACK, array("options"=>"test3")));
@@ -56,21 +56,21 @@ var_dump(filter_var("", FILTER_CALLBACK, array("options"=>"test3")));
/* unset data and return value */
function test4(&$var) {
- unset($var);
- return 1;
+ unset($var);
+ return 1;
}
var_dump(filter_var("data", FILTER_CALLBACK, array("options"=>"test4")));
/* thrown exception in the callback */
function test5(&$var) {
- throw new Exception("test");
+ throw new Exception("test");
}
try {
- var_dump(filter_var("data", FILTER_CALLBACK, array("options"=>"test5")));
+ var_dump(filter_var("data", FILTER_CALLBACK, array("options"=>"test5")));
} catch (Exception $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
echo "Done\n";
diff --git a/ext/filter/tests/030.phpt b/ext/filter/tests/030.phpt
index c8e7d4b6ef..405a73335a 100644
--- a/ext/filter/tests/030.phpt
+++ b/ext/filter/tests/030.phpt
@@ -5,23 +5,23 @@ filter_var() and IPv6
--FILE--
<?php
$ipv6_test = array(
- "::127.0.0.1" => true,
- "FF01::101:127.0.1" => false,
- "FF01:0:0:0:101:127.0.1.1" => false,
- "FF01:0:0:0:237:101:127.0.1.1" => true,
- "FF01::101" => true,
- "A1080::8:800:200C:417A" => false,
- "1080::8:Z00:200C:417A" => false,
- "FF01::101::1" => false,
- "1080::8:800:200C:417A" => true,
- "1080:0:0:0:8:800:200C:417A" => true,
- "2001:ec8:1:1:1:1:1:1" => true,
- "ffff::FFFF:129.144.52.38" => true,
- "::ffff:1.2.3.4" => true,
- "0:0:0:0:0:FFFF:129.144.52.38" => true,
- "0:0:0:0:0:0:13.1.68.3" => true,
+ "::127.0.0.1" => true,
+ "FF01::101:127.0.1" => false,
+ "FF01:0:0:0:101:127.0.1.1" => false,
+ "FF01:0:0:0:237:101:127.0.1.1" => true,
+ "FF01::101" => true,
+ "A1080::8:800:200C:417A" => false,
+ "1080::8:Z00:200C:417A" => false,
+ "FF01::101::1" => false,
+ "1080::8:800:200C:417A" => true,
+ "1080:0:0:0:8:800:200C:417A" => true,
+ "2001:ec8:1:1:1:1:1:1" => true,
+ "ffff::FFFF:129.144.52.38" => true,
+ "::ffff:1.2.3.4" => true,
+ "0:0:0:0:0:FFFF:129.144.52.38" => true,
+ "0:0:0:0:0:0:13.1.68.3" => true,
"0:0:0:0:0:0:0:13.1.68.3" => false,
- "::13.1.68.3" => true,
+ "::13.1.68.3" => true,
"::FFFF:129.144.52.38" => true,
"1:2:3:4:5:6::129.144.52.38" => false,
@@ -50,12 +50,12 @@ $ipv6_test = array(
'0:0:0::255.255.255.255' => true,
);
foreach ($ipv6_test as $ip => $exp) {
- $out = filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6);
- $out = $out !== false;
- if ($exp != $out) {
- echo "$ip failed (expected ", $exp?"true":"false", ", got ",
+ $out = filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6);
+ $out = $out !== false;
+ if ($exp != $out) {
+ echo "$ip failed (expected ", $exp?"true":"false", ", got ",
$out?"true":"false", ")\n";
- }
+ }
}
echo "Ok\n";
diff --git a/ext/filter/tests/031.phpt b/ext/filter/tests/031.phpt
index 23691fbbba..2968decafc 100644
--- a/ext/filter/tests/031.phpt
+++ b/ext/filter/tests/031.phpt
@@ -19,8 +19,8 @@ $floats = array(
);
foreach ($floats as $float) {
- $out = filter_var($float, FILTER_VALIDATE_FLOAT);
- var_dump($out);
+ $out = filter_var($float, FILTER_VALIDATE_FLOAT);
+ var_dump($out);
}
$floats = array(
@@ -33,8 +33,8 @@ $floats = array(
echo "\ncustom decimal:\n";
foreach ($floats as $float => $dec) {
- $out = filter_var($float, FILTER_VALIDATE_FLOAT, array("options"=>array('decimal' => $dec)));
- var_dump($out);
+ $out = filter_var($float, FILTER_VALIDATE_FLOAT, array("options"=>array('decimal' => $dec)));
+ var_dump($out);
}
?>
@@ -53,6 +53,6 @@ bool(false)
float(1.234)
float(1.234)
-Warning: filter_var(): decimal separator must be one char in %s on line %d
+Warning: filter_var(): Decimal separator must be one char in %s on line %d
bool(false)
bool(false)
diff --git a/ext/filter/tests/033.phpt b/ext/filter/tests/033.phpt
index 83ae4a3c19..0791a74de9 100644
--- a/ext/filter/tests/033.phpt
+++ b/ext/filter/tests/033.phpt
@@ -29,26 +29,5 @@ email PHP 1 foo@bar.com httpa.b.c 1.2.3.4 123 12
url PHP 1 foo@bar.com http://a.b.c 1.2.3.4 123 123abc<>() O'Henry aa:bb:cc:dd:ee:ff
number_int 1 1234 123 123
number_float 1 1234 123 123
-
-Deprecated: filter_var(): FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES instead in %s on line %d
-
-Deprecated: filter_var(): FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES instead in %s on line %d
-
-Deprecated: filter_var(): FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES instead in %s on line %d
-
-Deprecated: filter_var(): FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES instead in %s on line %d
-
-Deprecated: filter_var(): FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES instead in %s on line %d
-
-Deprecated: filter_var(): FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES instead in %s on line %d
-
-Deprecated: filter_var(): FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES instead in %s on line %d
-
-Deprecated: filter_var(): FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES instead in %s on line %d
-
-Deprecated: filter_var(): FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES instead in %s on line %d
-
-Deprecated: filter_var(): FILTER_SANITIZE_MAGIC_QUOTES is deprecated, use FILTER_SANITIZE_ADD_SLASHES instead in %s on line %d
-magic_quotes PHP 1 foo@bar.com http://a.b.c 1.2.3.4 123 123abc<>() O\'Henry í•˜í¼ aa:bb:cc:dd:ee:ff
add_slashes PHP 1 foo@bar.com http://a.b.c 1.2.3.4 123 123abc<>() O\'Henry í•˜í¼ aa:bb:cc:dd:ee:ff
callback PHP 1 FOO@BAR.COM HTTP://A.B.C 1.2.3.4 123 123ABC<>() O'HENRY í•˜í¼ AA:BB:CC:DD:EE:FF
diff --git a/ext/filter/tests/033_run.inc b/ext/filter/tests/033_run.inc
index 30a7a82a01..75ce127868 100644
--- a/ext/filter/tests/033_run.inc
+++ b/ext/filter/tests/033_run.inc
@@ -6,35 +6,35 @@ function test($data) {
}
$data = array(
- "PHP",
- "1",
- "foo@bar.com",
- "http://a.b.c",
- "1.2.3.4",
- "123",
- "123abc<>()",
- "O'Henry",
- "하í¼",
- "aa:bb:cc:dd:ee:ff",
+ "PHP",
+ "1",
+ "foo@bar.com",
+ "http://a.b.c",
+ "1.2.3.4",
+ "123",
+ "123abc<>()",
+ "O'Henry",
+ "하í¼",
+ "aa:bb:cc:dd:ee:ff",
);
foreach(filter_list() as $filter) {
- if($filter=="validate_regexp") {
- foreach($data as $k=>$d) $result[$k] = filter_var($d,filter_id($filter),array("options"=>array("regexp"=>'/^O.*/')));
- } else {
- foreach($data as $k=>$d) $result[$k] = filter_var($d,filter_id($filter),array("options"=>"test"));
- }
- printf("%-20s",$filter);
- printf("%-5s",$result[0]);
- printf("%-3s",$result[1]);
- printf("%-15s",$result[2]);
- printf("%-20s",$result[3]);
- printf("%-10s",$result[4]);
- printf("%-5s",$result[5]);
- printf("%-20s",$result[6]);
- printf("%-15s",$result[7]);
- printf("%-10s",$result[8]);
- printf("%-10s\n",$result[9]);
+ if($filter=="validate_regexp") {
+ foreach($data as $k=>$d) $result[$k] = filter_var($d,filter_id($filter),array("options"=>array("regexp"=>'/^O.*/')));
+ } else {
+ foreach($data as $k=>$d) $result[$k] = filter_var($d,filter_id($filter),array("options"=>"test"));
+ }
+ printf("%-20s",$filter);
+ printf("%-5s",$result[0]);
+ printf("%-3s",$result[1]);
+ printf("%-15s",$result[2]);
+ printf("%-20s",$result[3]);
+ printf("%-10s",$result[4]);
+ printf("%-5s",$result[5]);
+ printf("%-20s",$result[6]);
+ printf("%-15s",$result[7]);
+ printf("%-10s",$result[8]);
+ printf("%-10s\n",$result[9]);
}
?>
diff --git a/ext/filter/tests/034.phpt b/ext/filter/tests/034.phpt
index 759420af41..ae0a18ee66 100644
--- a/ext/filter/tests/034.phpt
+++ b/ext/filter/tests/034.phpt
@@ -23,7 +23,7 @@ $booleans = array(
foreach($booleans as $val=>$exp) {
$res =filter_var($val, FILTER_VALIDATE_BOOLEAN);
- if ($res !== $exp) {
+ if ($res !== $exp) {
echo "$val failed,'$exp' expect, '$res' received.\n";
}
}
diff --git a/ext/filter/tests/037.phpt b/ext/filter/tests/037.phpt
index e9f02afca4..431d3a7243 100644
--- a/ext/filter/tests/037.phpt
+++ b/ext/filter/tests/037.phpt
@@ -7,7 +7,7 @@ a=1&b=2
--FILE--
<?php
function myfunc($val) {
- return $val . '_callback';
+ return $val . '_callback';
}
echo filter_input(INPUT_GET, 'a', FILTER_CALLBACK, array("options"=>'myfunc'));
echo "\n";
@@ -19,13 +19,13 @@ echo filter_var($data, FILTER_CALLBACK, array("options"=>'myfunc'));
echo "\n";
$res = filter_input_array(INPUT_GET, array(
- 'a' => array(
- 'filter' => FILTER_CALLBACK,
- 'options' => 'myfunc'
- ),
- 'b' => FILTER_VALIDATE_INT
- )
- );
+ 'a' => array(
+ 'filter' => FILTER_CALLBACK,
+ 'options' => 'myfunc'
+ ),
+ 'b' => FILTER_VALIDATE_INT
+ )
+ );
var_dump($res);
?>
diff --git a/ext/filter/tests/039.phpt b/ext/filter/tests/039.phpt
index 501414deee..bdd090ae86 100644
--- a/ext/filter/tests/039.phpt
+++ b/ext/filter/tests/039.phpt
@@ -6,7 +6,6 @@ filter_var_array() and different arguments
<?php
echo "-- (1)\n";
-var_dump(filter_var_array(NULL));
var_dump(filter_var_array(array()));
var_dump(filter_var_array(array(1,"blah"=>"hoho")));
var_dump(filter_var_array(array(), -1));
@@ -51,9 +50,6 @@ echo "Done\n";
?>
--EXPECTF--
-- (1)
-
-Warning: filter_var_array() expects parameter 1 to be array, null given in %s on line %d
-NULL
array(0) {
}
array(2) {
diff --git a/ext/filter/tests/040.phpt b/ext/filter/tests/040.phpt
index d77b33135e..f6de3eb84c 100644
--- a/ext/filter/tests/040.phpt
+++ b/ext/filter/tests/040.phpt
@@ -9,9 +9,7 @@ ap[]=1&bp=test&cp=
--FILE--
<?php
-var_dump(filter_has_var());
var_dump(filter_has_var(INPUT_GET,""));
-var_dump(filter_has_var(INPUT_GET,array()));
var_dump(filter_has_var(INPUT_POST, "ap"));
var_dump(filter_has_var(INPUT_POST, "cp"));
var_dump(filter_has_var(INPUT_GET, "a"));
@@ -20,16 +18,10 @@ var_dump(filter_has_var(INPUT_GET, "abc"));
var_dump(filter_has_var(INPUT_GET, "cc"));
var_dump(filter_has_var(-1, "cc"));
var_dump(filter_has_var(0, "cc"));
-var_dump(filter_has_var("", "cc"));
echo "Done\n";
?>
--EXPECTF--
-Warning: filter_has_var() expects exactly 2 parameters, 0 given in %s on line %d
-bool(false)
-bool(false)
-
-Warning: filter_has_var() expects parameter 2 to be string, array given in %s on line %d
bool(false)
bool(true)
bool(true)
@@ -37,9 +29,8 @@ bool(true)
bool(true)
bool(false)
bool(false)
-bool(false)
-bool(false)
-Warning: filter_has_var() expects parameter 1 to be int, string given in %s on line %d
+Warning: filter_has_var(): Unknown source in %s on line %d
+bool(false)
bool(false)
Done
diff --git a/ext/filter/tests/043.phpt b/ext/filter/tests/043.phpt
index b889e35476..3d1e8ae140 100644
--- a/ext/filter/tests/043.phpt
+++ b/ext/filter/tests/043.phpt
@@ -7,7 +7,7 @@ Character encoding test
$flags = FILTER_FLAG_ENCODE_AMP|FILTER_FLAG_ENCODE_LOW|FILTER_FLAG_ENCODE_HIGH;
for ($i = 0; $i < 256; $i++) {
- var_dump(filter_var(chr($i), FILTER_SANITIZE_STRING, array("flags" => $flags)));
+ var_dump(filter_var(chr($i), FILTER_SANITIZE_STRING, array("flags" => $flags)));
}
?>
--EXPECT--
diff --git a/ext/filter/tests/044.phpt b/ext/filter/tests/044.phpt
index c456d473bb..95a2f3312b 100644
--- a/ext/filter/tests/044.phpt
+++ b/ext/filter/tests/044.phpt
@@ -7,7 +7,7 @@ precision=14
--FILE--
<?php
$vals = array(
-"
+"
",
" ",
" 123",
@@ -15,7 +15,7 @@ $vals = array(
);
foreach ($vals as $var) {
- var_dump(filter_var($var, FILTER_VALIDATE_FLOAT));
+ var_dump(filter_var($var, FILTER_VALIDATE_FLOAT));
}
?>
--EXPECT--
diff --git a/ext/filter/tests/046.phpt b/ext/filter/tests/046.phpt
index bc454420ad..dc67255a7d 100644
--- a/ext/filter/tests/046.phpt
+++ b/ext/filter/tests/046.phpt
@@ -7,25 +7,25 @@ Integer overflow
$max = sprintf("%d", PHP_INT_MAX);
switch($max) {
case "2147483647": /* 32-bit systems */
- $min = "-2147483648";
- $overflow = "2147483648";
- $underflow = "-2147483649";
- break;
+ $min = "-2147483648";
+ $overflow = "2147483648";
+ $underflow = "-2147483649";
+ break;
case "9223372036854775807": /* 64-bit systems */
- $min = "-9223372036854775808";
- $overflow = "9223372036854775808";
- $underflow = "-9223372036854775809";
- break;
+ $min = "-9223372036854775808";
+ $overflow = "9223372036854775808";
+ $underflow = "-9223372036854775809";
+ break;
default:
- die("failed: unknown value for PHP_MAX_INT");
- break;
+ die("failed: unknown value for PHP_MAX_INT");
+ break;
}
function test_validation($val, $msg) {
- $f = filter_var($val, FILTER_VALIDATE_INT);
- echo "$msg filtered: "; var_dump($f); // filtered value (or false)
- echo "$msg is_long: "; var_dump(is_long($f)); // test validation
- echo "$msg equal: "; var_dump($val == $f); // test equality of result
+ $f = filter_var($val, FILTER_VALIDATE_INT);
+ echo "$msg filtered: "; var_dump($f); // filtered value (or false)
+ echo "$msg is_long: "; var_dump(is_long($f)); // test validation
+ echo "$msg equal: "; var_dump($val == $f); // test equality of result
}
// PHP_INT_MAX
diff --git a/ext/filter/tests/047.phpt b/ext/filter/tests/047.phpt
index cc41eabd3d..d5566ce14d 100644
--- a/ext/filter/tests/047.phpt
+++ b/ext/filter/tests/047.phpt
@@ -5,16 +5,16 @@ Octal integer overflow
--FILE--
<?php
function octal_inc($s) {
- $len = strlen($s);
- while ($len > 0) {
- $len--;
- if ($s[$len] != '7') {
- $s[$len] = $s[$len] + 1;
- return $s;
- }
- $s[$len] = '0';
- }
- return '1'.$s;
+ $len = strlen($s);
+ while ($len > 0) {
+ $len--;
+ if ($s[$len] != '7') {
+ $s[$len] = $s[$len] + 1;
+ return $s;
+ }
+ $s[$len] = '0';
+ }
+ return '1'.$s;
}
diff --git a/ext/filter/tests/048.phpt b/ext/filter/tests/048.phpt
index 92ab6908c7..6edea3fd9e 100644
--- a/ext/filter/tests/048.phpt
+++ b/ext/filter/tests/048.phpt
@@ -5,20 +5,20 @@ Hex integer overflow
--FILE--
<?php
function hex_inc($s) {
- $len = strlen($s);
- while ($len > 0) {
- $len--;
- if ($s[$len] != 'f') {
- if ($s[$len] == '9') {
- $s[$len] = 'a';
- } else {
- $s[$len] = $s[$len] + 1;
- }
- return $s;
- }
- $s[$len] = '0';
- }
- return '1'.$s;
+ $len = strlen($s);
+ while ($len > 0) {
+ $len--;
+ if ($s[$len] != 'f') {
+ if ($s[$len] == '9') {
+ $s[$len] = 'a';
+ } else {
+ $s[$len] = $s[$len] + 1;
+ }
+ return $s;
+ }
+ $s[$len] = '0';
+ }
+ return '1'.$s;
}
diff --git a/ext/filter/tests/049.phpt b/ext/filter/tests/049.phpt
index 5a9977b8ff..0d8f0bc8c2 100644
--- a/ext/filter/tests/049.phpt
+++ b/ext/filter/tests/049.phpt
@@ -5,27 +5,27 @@ filter_var() and doubles with thousend separators
--FILE--
<?php
$test = array(
- '0' => 0.0,
- '12345678900.1234567165' => 12345678900.1234567165,
- '1,234,567,890.1234567165' => 1234567890.1234567165,
- '-1,234,567,890.1234567165' => -1234567890.1234567165,
- '1234,567,890.1234567165' => false,
- '1,234,567,89.1234567165' => false,
- '1,234,567,8900.1234567165' => false,
- '1.234.567.890.1234567165' => false,
- '1,234,567,8900.123,456' => false,
+ '0' => 0.0,
+ '12345678900.1234567165' => 12345678900.1234567165,
+ '1,234,567,890.1234567165' => 1234567890.1234567165,
+ '-1,234,567,890.1234567165' => -1234567890.1234567165,
+ '1234,567,890.1234567165' => false,
+ '1,234,567,89.1234567165' => false,
+ '1,234,567,8900.1234567165' => false,
+ '1.234.567.890.1234567165' => false,
+ '1,234,567,8900.123,456' => false,
);
foreach ($test as $src => $dst) {
- $out = filter_var($src, FILTER_VALIDATE_FLOAT, array("flags"=>FILTER_FLAG_ALLOW_THOUSAND));
- if ($dst !== $out) {
- if ($out === false) {
- echo "$src -> false != $dst\n";
- } elseif ($dst === false) {
- echo "$src -> $out != false\n";
- } else {
- echo "$src -> $out != $dst\n";
- }
- }
+ $out = filter_var($src, FILTER_VALIDATE_FLOAT, array("flags"=>FILTER_FLAG_ALLOW_THOUSAND));
+ if ($dst !== $out) {
+ if ($out === false) {
+ echo "$src -> false != $dst\n";
+ } elseif ($dst === false) {
+ echo "$src -> $out != false\n";
+ } else {
+ echo "$src -> $out != $dst\n";
+ }
+ }
}
echo "Ok\n";
diff --git a/ext/filter/tests/050.phpt b/ext/filter/tests/050.phpt
index 69a269f11f..b23d0a466e 100644
--- a/ext/filter/tests/050.phpt
+++ b/ext/filter/tests/050.phpt
@@ -5,22 +5,22 @@ filter_var() and double overflow/underflow
--FILE--
<?php
$test = array(
- '1e+308' => 1e+308,
- '1e+309' => false,
- '1e-323' => 1e-323,
- '1e-324' => false,
+ '1e+308' => 1e+308,
+ '1e+309' => false,
+ '1e-323' => 1e-323,
+ '1e-324' => false,
);
foreach ($test as $src => $dst) {
- $out = filter_var($src, FILTER_VALIDATE_FLOAT);
- if ($dst !== $out) {
- if ($out === false) {
- echo "$src -> false != $dst\n";
- } elseif ($dst === false) {
- echo "$src -> $out != false\n";
- } else {
- echo "$src -> $out != $dst\n";
- }
- }
+ $out = filter_var($src, FILTER_VALIDATE_FLOAT);
+ if ($dst !== $out) {
+ if ($out === false) {
+ echo "$src -> false != $dst\n";
+ } elseif ($dst === false) {
+ echo "$src -> $out != false\n";
+ } else {
+ echo "$src -> $out != $dst\n";
+ }
+ }
}
echo "Ok\n";
diff --git a/ext/filter/tests/054.phpt b/ext/filter/tests/054.phpt
index c8a5dad755..2b6f3000da 100644
--- a/ext/filter/tests/054.phpt
+++ b/ext/filter/tests/054.phpt
@@ -8,8 +8,8 @@ filter_var_array() - using the add_empty option
$data = array('foo' => 123);
var_dump(
- filter_var_array($data, array('foo' => array('filter' => FILTER_DEFAULT), 'bar' => array('filter' => FILTER_DEFAULT)), false),
- filter_var_array($data, array('foo' => array('filter' => FILTER_DEFAULT), 'bar' => array('filter' => FILTER_DEFAULT)))
+ filter_var_array($data, array('foo' => array('filter' => FILTER_DEFAULT), 'bar' => array('filter' => FILTER_DEFAULT)), false),
+ filter_var_array($data, array('foo' => array('filter' => FILTER_DEFAULT), 'bar' => array('filter' => FILTER_DEFAULT)))
);
?>
diff --git a/ext/filter/tests/055.phpt b/ext/filter/tests/055.phpt
index 28f94fe408..896dda8338 100644
--- a/ext/filter/tests/055.phpt
+++ b/ext/filter/tests/055.phpt
@@ -5,23 +5,23 @@ filter_var() and FILTER_VALIDATE_MAC
--FILE--
<?php
$values = Array(
- array("01-23-45-67-89-ab", null),
- array("01-23-45-67-89-ab", array("options" => array("separator" => "-"))),
- array("01-23-45-67-89-ab", array("options" => array("separator" => "."))),
- array("01-23-45-67-89-ab", array("options" => array("separator" => ":"))),
- array("01-23-45-67-89-AB", null),
- array("01-23-45-67-89-aB", null),
- array("01:23:45:67:89:ab", null),
- array("01:23:45:67:89:AB", null),
- array("01:23:45:67:89:aB", null),
- array("01:23:45-67:89:aB", null),
- array("xx:23:45:67:89:aB", null),
- array("0123.4567.89ab", null),
- array("01-23-45-67-89-ab", array("options" => array("separator" => "--"))),
- array("01-23-45-67-89-ab", array("options" => array("separator" => ""))),
+ array("01-23-45-67-89-ab", null),
+ array("01-23-45-67-89-ab", array("options" => array("separator" => "-"))),
+ array("01-23-45-67-89-ab", array("options" => array("separator" => "."))),
+ array("01-23-45-67-89-ab", array("options" => array("separator" => ":"))),
+ array("01-23-45-67-89-AB", null),
+ array("01-23-45-67-89-aB", null),
+ array("01:23:45:67:89:ab", null),
+ array("01:23:45:67:89:AB", null),
+ array("01:23:45:67:89:aB", null),
+ array("01:23:45-67:89:aB", null),
+ array("xx:23:45:67:89:aB", null),
+ array("0123.4567.89ab", null),
+ array("01-23-45-67-89-ab", array("options" => array("separator" => "--"))),
+ array("01-23-45-67-89-ab", array("options" => array("separator" => ""))),
);
foreach ($values as $value) {
- var_dump(filter_var($value[0], FILTER_VALIDATE_MAC, $value[1]));
+ var_dump(filter_var($value[0], FILTER_VALIDATE_MAC, $value[1]));
}
echo "Done\n";
diff --git a/ext/filter/tests/056.phpt b/ext/filter/tests/056.phpt
index e3a4570ea7..b3ba455a4d 100644
--- a/ext/filter/tests/056.phpt
+++ b/ext/filter/tests/056.phpt
@@ -25,7 +25,7 @@ array(),
'\r\n',
);
foreach ($values as $value) {
- var_dump(filter_var($value, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME));
+ var_dump(filter_var($value, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME));
}
var_dump(filter_var('_example.com', FILTER_VALIDATE_DOMAIN));
diff --git a/ext/filter/tests/058.phpt b/ext/filter/tests/058.phpt
index f3fa483ed9..ee7965c271 100644
--- a/ext/filter/tests/058.phpt
+++ b/ext/filter/tests/058.phpt
@@ -28,7 +28,7 @@ $values = Array(
'DžǼ੧ఘⅧ⒇৪@example.com',
);
foreach ($values as $value) {
- var_dump(filter_var($value, FILTER_VALIDATE_EMAIL, FILTER_FLAG_EMAIL_UNICODE));
+ var_dump(filter_var($value, FILTER_VALIDATE_EMAIL, FILTER_FLAG_EMAIL_UNICODE));
}
echo "Done\n";
?>
diff --git a/ext/filter/tests/061.phpt b/ext/filter/tests/061.phpt
new file mode 100644
index 0000000000..77e1f5fe17
--- /dev/null
+++ b/ext/filter/tests/061.phpt
@@ -0,0 +1,70 @@
+--TEST--
+filter_var() and FILTER_VALIDATE_BOOL
+--SKIPIF--
+<?php if (!extension_loaded("filter")) die("skip"); ?>
+--FILE--
+<?php
+
+class test {
+
+ function __toString() {
+ return "blah";
+ }
+}
+
+$t = new test;
+
+var_dump(filter_var("no", FILTER_VALIDATE_BOOL));
+var_dump(filter_var(NULL, FILTER_VALIDATE_BOOL));
+var_dump(filter_var($t, FILTER_VALIDATE_BOOL));
+var_dump(filter_var(array(1,2,3,0,array("", "123")), FILTER_VALIDATE_BOOL, FILTER_REQUIRE_ARRAY));
+var_dump(filter_var("yes", FILTER_VALIDATE_BOOL));
+var_dump(filter_var("true", FILTER_VALIDATE_BOOL));
+var_dump(filter_var("false", FILTER_VALIDATE_BOOL));
+var_dump(filter_var("off", FILTER_VALIDATE_BOOL));
+var_dump(filter_var("on", FILTER_VALIDATE_BOOL));
+var_dump(filter_var("0", FILTER_VALIDATE_BOOL));
+var_dump(filter_var("1", FILTER_VALIDATE_BOOL));
+var_dump(filter_var("NONE", FILTER_VALIDATE_BOOL));
+var_dump(filter_var("", FILTER_VALIDATE_BOOL));
+var_dump(filter_var(-1, FILTER_VALIDATE_BOOL));
+var_dump(filter_var("000000", FILTER_VALIDATE_BOOL));
+var_dump(filter_var("111111", FILTER_VALIDATE_BOOL));
+
+
+echo "Done\n";
+?>
+--EXPECT--
+bool(false)
+bool(false)
+bool(false)
+array(5) {
+ [0]=>
+ bool(true)
+ [1]=>
+ bool(false)
+ [2]=>
+ bool(false)
+ [3]=>
+ bool(false)
+ [4]=>
+ array(2) {
+ [0]=>
+ bool(false)
+ [1]=>
+ bool(false)
+ }
+}
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+Done
diff --git a/ext/filter/tests/PMOPB45.phpt b/ext/filter/tests/PMOPB45.phpt
index a403b3c6e7..477e653e48 100644
--- a/ext/filter/tests/PMOPB45.phpt
+++ b/ext/filter/tests/PMOPB45.phpt
@@ -4,8 +4,8 @@ PMOPB-45-2007:PHP ext/filter Email Validation Vulnerability
<?php if (!extension_loaded("filter")) die("skip"); ?>
--FILE--
<?php
- $var = "test@example.com\n";
- var_dump(filter_var($var, FILTER_VALIDATE_EMAIL));
+ $var = "test@example.com\n";
+ var_dump(filter_var($var, FILTER_VALIDATE_EMAIL));
?>
--EXPECT--
bool(false)
diff --git a/ext/filter/tests/bug49510.phpt b/ext/filter/tests/bug49510.phpt
index 340c1ccd6b..907e633db9 100644
--- a/ext/filter/tests/bug49510.phpt
+++ b/ext/filter/tests/bug49510.phpt
@@ -20,7 +20,6 @@ var_dump(filter_var("yes", FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE));
var_dump(filter_var("invalid", FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE));
?>
-==DONE==
--EXPECT--
bool(false)
bool(false)
@@ -35,4 +34,3 @@ bool(true)
bool(true)
bool(true)
NULL
-==DONE==
diff --git a/ext/filter/tests/bug51368.phpt b/ext/filter/tests/bug51368.phpt
index 7ecb720a1e..38ae03ca95 100644
--- a/ext/filter/tests/bug51368.phpt
+++ b/ext/filter/tests/bug51368.phpt
@@ -14,11 +14,9 @@ var_dump(
$options = ['flags' => FILTER_FLAG_ALLOW_THOUSAND, 'options' => ['thousand' => '']];
var_dump(filter_var('12345', FILTER_VALIDATE_FLOAT, $options));
?>
-===DONE===
--EXPECTF--
float(1000)
float(1234.567)
-Warning: filter_var(): thousand separator must be at least one char in %s on line %d
+Warning: filter_var(): Thousand separator must be at least one char in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/filter/tests/bug52209.phpt b/ext/filter/tests/bug52209.phpt
index 3035784147..255197c798 100644
--- a/ext/filter/tests/bug52209.phpt
+++ b/ext/filter/tests/bug52209.phpt
@@ -13,7 +13,7 @@ if (empty($_ENV['PWD'])) die('skip PWD is empty');
variables_order=GPCSE
--FILE--
<?php
- var_dump(filter_input(INPUT_ENV, 'PWD'));
+ var_dump(filter_input(INPUT_ENV, 'PWD'));
?>
--EXPECTF--
string(%d) "%s"
diff --git a/ext/filter/tests/bug53037.phpt b/ext/filter/tests/bug53037.phpt
index 82ecc7a75e..053786f9cd 100644
--- a/ext/filter/tests/bug53037.phpt
+++ b/ext/filter/tests/bug53037.phpt
@@ -5,7 +5,7 @@ Bug #53037 (FILTER_FLAG_EMPTY_STRING_NULL is not implemented)
--FILE--
<?php
var_dump(
- filter_var("", FILTER_DEFAULT),
+ filter_var("", FILTER_DEFAULT),
filter_var("", FILTER_DEFAULT, array('flags' => FILTER_FLAG_EMPTY_STRING_NULL))
);
?>
diff --git a/ext/filter/tests/bug73054.phpt b/ext/filter/tests/bug73054.phpt
index 77a1a88b33..4dba4f0813 100644
--- a/ext/filter/tests/bug73054.phpt
+++ b/ext/filter/tests/bug73054.phpt
@@ -16,8 +16,6 @@ var_dump(
])
);
?>
-===DONE===
--EXPECT--
int(2)
int(2)
-===DONE===
diff --git a/ext/filter/tests/bug7715.phpt b/ext/filter/tests/bug7715.phpt
index 2f7766587d..0bb412c90a 100644
--- a/ext/filter/tests/bug7715.phpt
+++ b/ext/filter/tests/bug7715.phpt
@@ -7,18 +7,18 @@ precision=14
--FILE--
<?php
$data = array(
- '.23',
- '-42',
- '+42',
- '.4',
- '-.4',
- '1000000000000',
- '-1000000000000',
- '02.324'
+ '.23',
+ '-42',
+ '+42',
+ '.4',
+ '-.4',
+ '1000000000000',
+ '-1000000000000',
+ '02.324'
);
foreach ($data as $val) {
- $res = filter_var($val, FILTER_VALIDATE_FLOAT);
- var_dump($res);
+ $res = filter_var($val, FILTER_VALIDATE_FLOAT);
+ var_dump($res);
}
echo "\n";
?>
diff --git a/ext/filter/tests/bug7733.phpt b/ext/filter/tests/bug7733.phpt
index 11fce11232..62421b3b90 100644
--- a/ext/filter/tests/bug7733.phpt
+++ b/ext/filter/tests/bug7733.phpt
@@ -5,12 +5,12 @@ filter_var() Float exponential weird result
--FILE--
<?php
$data = array(
- 'E2',
- '10E',
- '2E-',
- 'E-2',
- '+E2'
- );
+ 'E2',
+ '10E',
+ '2E-',
+ 'E-2',
+ '+E2'
+ );
$out = filter_var($data, FILTER_VALIDATE_FLOAT, FILTER_REQUIRE_ARRAY);
var_dump($out);
?>
diff --git a/ext/filter/tests/callback_closure.phpt b/ext/filter/tests/callback_closure.phpt
index 0ece4ab285..2c18abefde 100644
--- a/ext/filter/tests/callback_closure.phpt
+++ b/ext/filter/tests/callback_closure.phpt
@@ -5,7 +5,7 @@ callback function is a closure
--FILE--
<?php
$callback = function ($var) {
- return $var;
+ return $var;
};
$var = "test";
var_dump(filter_var($var, FILTER_CALLBACK, array('options'=> $callback)));
diff --git a/ext/filter/tests/callback_non_modified_var.phpt b/ext/filter/tests/callback_non_modified_var.phpt
index e546fcc89d..22dc8b36de 100644
--- a/ext/filter/tests/callback_non_modified_var.phpt
+++ b/ext/filter/tests/callback_non_modified_var.phpt
@@ -5,7 +5,7 @@ callback function returns non modified value
--FILE--
<?php
function callback($var) {
- return $var;
+ return $var;
}
$var = "test";
var_dump(filter_var($var, FILTER_CALLBACK, array('options'=>'callback')));
diff --git a/ext/filter/tests/deprecated.phpt b/ext/filter/tests/deprecated.phpt
deleted file mode 100644
index a7771056ef..0000000000
--- a/ext/filter/tests/deprecated.phpt
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-FILTER_FLAG_SCHEME_REQUIRED and FILTER_FLAG_HOST_REQUIRED are deprecated
---SKIPIF--
-<?php
-if (!extension_loaded('filter')) die('skip filter extension not available');
-?>
---FILE--
-<?php
-var_dump(filter_var('//example.com/', FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED));
-var_dump(filter_var('http://', FILTER_VALIDATE_URL, FILTER_FLAG_HOST_REQUIRED));
-?>
-===DONE===
---EXPECTF--
-Deprecated: filter_var(): explicit use of FILTER_FLAG_SCHEME_REQUIRED and FILTER_FLAG_HOST_REQUIRED is deprecated in %s
-bool(false)
-
-Deprecated: filter_var(): explicit use of FILTER_FLAG_SCHEME_REQUIRED and FILTER_FLAG_HOST_REQUIRED is deprecated in %s
-bool(false)
-===DONE===
diff --git a/ext/filter/tests/filter_ipv4_rfc6890.phpt b/ext/filter/tests/filter_ipv4_rfc6890.phpt
index a55bb36c30..a8edb048f6 100644
--- a/ext/filter/tests/filter_ipv4_rfc6890.phpt
+++ b/ext/filter/tests/filter_ipv4_rfc6890.phpt
@@ -20,10 +20,10 @@ $privateRanges['172.16.0.0/12'] = array('172.16.0.0', '172.31.0.0');
$privateRanges['192.168.0.0/16'] = array('192.168.0.0', '192.168.255.255');
foreach ($privateRanges as $key => $range) {
- list($min, $max) = $range;
- var_dump($key);
- var_dump(filter_var($min, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE));
- var_dump(filter_var($max, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE));
+ list($min, $max) = $range;
+ var_dump($key);
+ var_dump(filter_var($min, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE));
+ var_dump(filter_var($max, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE));
}
$reservedRanges = array();
@@ -74,10 +74,10 @@ $reservedRanges['203.0.113.0/24'] = array('203.0.113.0', '203.0.113.255');
$reservedRanges['240.0.0.0/4'] = array('224.0.0.0', '255.255.255.255');
foreach ($reservedRanges as $key => $range) {
- list($min, $max) = $range;
- var_dump($key);
- var_dump(filter_var($min, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_RES_RANGE));
- var_dump(filter_var($max, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_RES_RANGE));
+ list($min, $max) = $range;
+ var_dump($key);
+ var_dump(filter_var($min, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_RES_RANGE));
+ var_dump(filter_var($max, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_RES_RANGE));
}
?>
diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c
index e5355b1bd4..71dc7f6691 100644
--- a/ext/ftp/ftp.c
+++ b/ext/ftp/ftp.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -274,7 +272,7 @@ ftp_login(ftpbuf_t *ftp, const char *user, const size_t user_len, const char *pa
ctx = SSL_CTX_new(SSLv23_client_method());
if (ctx == NULL) {
- php_error_docref(NULL, E_WARNING, "failed to create the SSL context");
+ php_error_docref(NULL, E_WARNING, "Failed to create the SSL context");
return 0;
}
@@ -290,7 +288,7 @@ ftp_login(ftpbuf_t *ftp, const char *user, const size_t user_len, const char *pa
SSL_CTX_free(ctx);
if (ftp->ssl_handle == NULL) {
- php_error_docref(NULL, E_WARNING, "failed to create the SSL handle");
+ php_error_docref(NULL, E_WARNING, "Failed to create the SSL handle");
return 0;
}
diff --git a/ext/ftp/ftp.h b/ext/ftp/ftp.h
index 2b1338d81d..27c39b5486 100644
--- a/ext/ftp/ftp.h
+++ b/ext/ftp/ftp.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/ftp/ftp.stub.php b/ext/ftp/ftp.stub.php
new file mode 100644
index 0000000000..e01603a99c
--- /dev/null
+++ b/ext/ftp/ftp.stub.php
@@ -0,0 +1,120 @@
+<?php
+
+/** @return resource|false */
+function ftp_connect(string $host, int $port = 21, int $timeout = 90) {}
+
+#ifdef HAVE_FTP_SSL
+/** @return resource|false */
+function ftp_ssl_connect(string $host, int $port = 21, int $timeout = 90) {}
+#endif
+
+/** @param resource $ftp */
+function ftp_login($ftp, string $username, string $password): bool {}
+
+/** @param resource $ftp */
+function ftp_pwd($ftp): string|false {}
+
+/** @param resource $ftp */
+function ftp_cdup($ftp): bool {}
+
+/** @param resource $ftp */
+function ftp_chdir($ftp, string $directory): bool {}
+
+/** @param resource $ftp */
+function ftp_exec($ftp, string $command): bool {}
+
+/** @param resource $ftp */
+function ftp_raw($ftp, string $command): array {}
+
+/** @param resource $ftp */
+function ftp_mkdir($ftp, string $directory): string|false {}
+
+/** @param resource $ftp */
+function ftp_rmdir($ftp, string $directory): bool {}
+
+/** @param resource $ftp */
+function ftp_chmod($ftp, int $mode, string $filename): int|false {}
+
+/** @param resource $ftp */
+function ftp_alloc($ftp, int $size, &$response = UNKNOWN): bool {}
+
+/** @param resource $ftp */
+function ftp_nlist($ftp, string $directory): array|false {}
+
+/** @param resource $ftp */
+function ftp_rawlist($ftp, string $directory, bool $recurse = false): array|false {}
+
+/** @param resource $ftp */
+function ftp_mlsd($ftp, string $directory): array|false {}
+
+/** @param resource $ftp */
+function ftp_systype($ftp): string|false {}
+
+/**
+ * @param resource $ftp
+ * @param resource $fp
+ */
+function ftp_fget($ftp, $fp, string $remote_file, int $mode = FTP_BINARY, int $resumepos = 0): bool {}
+
+/**
+ * @param resource $ftp
+ * @param resource $fp
+ */
+function ftp_nb_fget($ftp, $fp, string $remote_file, int $mode = FTP_BINARY, int $resumpos = 0): int|false {}
+
+/** @param resource $ftp */
+function ftp_pasv($ftp, bool $pasv): bool {}
+
+/** @param resource $ftp */
+function ftp_get($ftp, string $local_file, string $remote_file, int $mode = FTP_BINARY, int $resumepos = 0): bool {}
+
+/** @param resource $ftp */
+function ftp_nb_get($ftp, string $local_file, string $remote_file, int $mode = FTP_BINARY, int $resume_pos = 0): int {}
+
+/** @param resource $ftp */
+function ftp_nb_continue($ftp): int {}
+
+/**
+ * @param resource $ftp
+ * @param resource $fp
+ */
+function ftp_fput($ftp, string $remote_file, $fp, int $mode = FTP_BINARY, int $startpos = 0): bool {}
+
+/**
+ * @param resource $ftp
+ * @param resource $fp
+ */
+function ftp_nb_fput($ftp, string $remote_file, $fp, $mode = FTP_BINARY, $startpos = 0): int|false {}
+
+/** @param resource $ftp */
+function ftp_put($ftp, string $remote_file, string $local_file, int $mode = FTP_BINARY, int $startpos = 0): bool {}
+
+/** @param resource $ftp */
+function ftp_append($ftp, string $remove_file, string $local_file, int $mode = FTP_BINARY): bool {}
+
+/** @param resource $ftp */
+function ftp_nb_put($ftp, string $remote_file, string $local_file, int $mode = FTP_BINARY, int $startpos = 0): int|false {}
+
+/** @param resource $ftp */
+function ftp_size($ftp, string $filename): int {}
+
+/** @param resource $ftp */
+function ftp_mdtm($ftp, string $filename): int {}
+
+/** @param resource $ftp */
+function ftp_rename($ftp, string $src, string $dest): bool {}
+
+/** @param resource $ftp */
+function ftp_delete($ftp, string $file): bool {}
+
+/** @param resource $ftp */
+function ftp_site($ftp, string $cmd): bool {}
+
+/** @param resource $ftp */
+function ftp_close($ftp): bool {}
+
+/** @param resource $ftp */
+function ftp_set_option($ftp, int $option, $value): bool {}
+
+/** @param resource $ftp */
+function ftp_get_option($ftp, int $option): int|bool {}
diff --git a/ext/ftp/ftp_arginfo.h b/ext/ftp/ftp_arginfo.h
new file mode 100644
index 0000000000..69a3cd01e9
--- /dev/null
+++ b/ext/ftp/ftp_arginfo.h
@@ -0,0 +1,194 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_connect, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, host, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, port, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, timeout, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_FTP_SSL)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_ssl_connect, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, host, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, port, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, timeout, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_login, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, username, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ftp_pwd, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, ftp)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_cdup, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, ftp)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_chdir, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, directory, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_exec, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, command, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_raw, 0, 2, IS_ARRAY, 0)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, command, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ftp_mkdir, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, directory, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_ftp_rmdir arginfo_ftp_chdir
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ftp_chmod, 0, 3, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_alloc, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, size, IS_LONG, 0)
+ ZEND_ARG_INFO(1, response)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ftp_nlist, 0, 2, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, directory, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ftp_rawlist, 0, 2, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, directory, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, recurse, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_ftp_mlsd arginfo_ftp_nlist
+
+#define arginfo_ftp_systype arginfo_ftp_pwd
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_fget, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_INFO(0, fp)
+ ZEND_ARG_TYPE_INFO(0, remote_file, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, resumepos, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ftp_nb_fget, 0, 3, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_INFO(0, fp)
+ ZEND_ARG_TYPE_INFO(0, remote_file, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, resumpos, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_pasv, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, pasv, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_get, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, local_file, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, remote_file, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, resumepos, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_nb_get, 0, 3, IS_LONG, 0)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, local_file, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, remote_file, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, resume_pos, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_nb_continue, 0, 1, IS_LONG, 0)
+ ZEND_ARG_INFO(0, ftp)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_fput, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, remote_file, IS_STRING, 0)
+ ZEND_ARG_INFO(0, fp)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, startpos, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ftp_nb_fput, 0, 3, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, remote_file, IS_STRING, 0)
+ ZEND_ARG_INFO(0, fp)
+ ZEND_ARG_INFO(0, mode)
+ ZEND_ARG_INFO(0, startpos)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_put, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, remote_file, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, local_file, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, startpos, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_append, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, remove_file, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, local_file, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ftp_nb_put, 0, 3, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, remote_file, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, local_file, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, startpos, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_size, 0, 2, IS_LONG, 0)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_ftp_mdtm arginfo_ftp_size
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_rename, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, src, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, dest, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_delete, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, file, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_site, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, cmd, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_ftp_close arginfo_ftp_cdup
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_set_option, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ftp_get_option, 0, 2, MAY_BE_LONG|MAY_BE_BOOL)
+ ZEND_ARG_INFO(0, ftp)
+ ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/ftp/php_ftp.c b/ext/ftp/php_ftp.c
index e3b425ef0f..d196230a62 100644
--- a/ext/ftp/php_ftp.c
+++ b/ext/ftp/php_ftp.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -34,219 +32,11 @@
#include "php_ftp.h"
#include "ftp.h"
+#include "ftp_arginfo.h"
static int le_ftpbuf;
#define le_ftpbuf_name "FTP Buffer"
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_connect, 0, 0, 1)
- ZEND_ARG_INFO(0, host)
- ZEND_ARG_INFO(0, port)
- ZEND_ARG_INFO(0, timeout)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_FTP_SSL
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_ssl_connect, 0, 0, 1)
- ZEND_ARG_INFO(0, host)
- ZEND_ARG_INFO(0, port)
- ZEND_ARG_INFO(0, timeout)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftp_login, 0)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, username)
- ZEND_ARG_INFO(0, password)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftp_pwd, 0)
- ZEND_ARG_INFO(0, ftp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftp_cdup, 0)
- ZEND_ARG_INFO(0, ftp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftp_chdir, 0)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, directory)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftp_exec, 0)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, command)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftp_raw, 0)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, command)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftp_mkdir, 0)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, directory)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftp_rmdir, 0)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, directory)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftp_chmod, 0)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, mode)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_alloc, 0, 0, 2)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, size)
- ZEND_ARG_INFO(1, response)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftp_nlist, 0)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, directory)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_rawlist, 0, 0, 2)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, directory)
- ZEND_ARG_INFO(0, recursive)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftp_mlsd, 0)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, directory)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftp_systype, 0)
- ZEND_ARG_INFO(0, ftp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_fget, 0, 0, 3)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, fp)
- ZEND_ARG_INFO(0, remote_file)
- ZEND_ARG_INFO(0, mode)
- ZEND_ARG_INFO(0, resumepos)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_nb_fget, 0, 0, 3)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, fp)
- ZEND_ARG_INFO(0, remote_file)
- ZEND_ARG_INFO(0, mode)
- ZEND_ARG_INFO(0, resumepos)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_pasv, 0, 0, 2)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, pasv)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_get, 0, 0, 3)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, local_file)
- ZEND_ARG_INFO(0, remote_file)
- ZEND_ARG_INFO(0, mode)
- ZEND_ARG_INFO(0, resume_pos)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_nb_get, 0, 0, 3)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, local_file)
- ZEND_ARG_INFO(0, remote_file)
- ZEND_ARG_INFO(0, mode)
- ZEND_ARG_INFO(0, resume_pos)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftp_nb_continue, 0)
- ZEND_ARG_INFO(0, ftp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_fput, 0, 0, 3)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, remote_file)
- ZEND_ARG_INFO(0, fp)
- ZEND_ARG_INFO(0, mode)
- ZEND_ARG_INFO(0, startpos)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_nb_fput, 0, 0, 3)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, remote_file)
- ZEND_ARG_INFO(0, fp)
- ZEND_ARG_INFO(0, mode)
- ZEND_ARG_INFO(0, startpos)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_put, 0, 0, 3)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, remote_file)
- ZEND_ARG_INFO(0, local_file)
- ZEND_ARG_INFO(0, mode)
- ZEND_ARG_INFO(0, startpos)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_append, 0, 0, 3)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, remote_file)
- ZEND_ARG_INFO(0, local_file)
- ZEND_ARG_INFO(0, mode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ftp_nb_put, 0, 0, 3)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, remote_file)
- ZEND_ARG_INFO(0, local_file)
- ZEND_ARG_INFO(0, mode)
- ZEND_ARG_INFO(0, startpos)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftp_size, 0)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftp_mdtm, 0)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftp_rename, 0)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, src)
- ZEND_ARG_INFO(0, dest)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftp_delete, 0)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, file)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftp_site, 0)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, cmd)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftp_close, 0)
- ZEND_ARG_INFO(0, ftp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftp_set_option, 0)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, option)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftp_get_option, 0)
- ZEND_ARG_INFO(0, ftp)
- ZEND_ARG_INFO(0, option)
-ZEND_END_ARG_INFO()
-
-/* }}} */
-
static const zend_function_entry php_ftp_functions[] = {
PHP_FE(ftp_connect, arginfo_ftp_connect)
#ifdef HAVE_FTP_SSL
@@ -375,7 +165,7 @@ PHP_FUNCTION(ftp_connect)
zend_long timeout_sec = FTP_DEFAULT_TIMEOUT;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|ll", &host, &host_len, &port, &timeout_sec) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (timeout_sec <= 0) {
@@ -412,7 +202,7 @@ PHP_FUNCTION(ftp_ssl_connect)
zend_long timeout_sec = FTP_DEFAULT_TIMEOUT;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|ll", &host, &host_len, &port, &timeout_sec) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (timeout_sec <= 0) {
@@ -446,11 +236,11 @@ PHP_FUNCTION(ftp_login)
size_t user_len, pass_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rss", &z_ftp, &user, &user_len, &pass, &pass_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* log in */
@@ -472,11 +262,11 @@ PHP_FUNCTION(ftp_pwd)
const char *pwd;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &z_ftp) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (!(pwd = ftp_pwd(ftp))) {
@@ -496,11 +286,11 @@ PHP_FUNCTION(ftp_cdup)
ftpbuf_t *ftp;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &z_ftp) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (!ftp_cdup(ftp)) {
@@ -522,11 +312,11 @@ PHP_FUNCTION(ftp_chdir)
size_t dir_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &z_ftp, &dir, &dir_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* change directories */
@@ -549,11 +339,11 @@ PHP_FUNCTION(ftp_exec)
size_t cmd_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &z_ftp, &cmd, &cmd_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* execute serverside command */
@@ -576,11 +366,11 @@ PHP_FUNCTION(ftp_raw)
size_t cmd_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &z_ftp, &cmd, &cmd_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* execute arbitrary ftp command */
@@ -599,11 +389,11 @@ PHP_FUNCTION(ftp_mkdir)
size_t dir_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &z_ftp, &dir, &dir_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* create directory */
@@ -626,11 +416,11 @@ PHP_FUNCTION(ftp_rmdir)
size_t dir_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &z_ftp, &dir, &dir_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* remove directorie */
@@ -654,11 +444,11 @@ PHP_FUNCTION(ftp_chmod)
zend_long mode;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlp", &z_ftp, &mode, &filename, &filename_len) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (!ftp_chmod(ftp, mode, filename, filename_len)) {
@@ -680,11 +470,11 @@ PHP_FUNCTION(ftp_alloc)
zend_string *response = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl|z", &z_ftp, &size, &zresponse) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
ret = ftp_alloc(ftp, size, zresponse ? &response : NULL);
@@ -711,11 +501,11 @@ PHP_FUNCTION(ftp_nlist)
size_t dir_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rp", &z_ftp, &dir, &dir_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* get list of files */
@@ -742,11 +532,11 @@ PHP_FUNCTION(ftp_rawlist)
zend_bool recursive = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|b", &z_ftp, &dir, &dir_len, &recursive) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* get raw directory listing */
@@ -773,11 +563,11 @@ PHP_FUNCTION(ftp_mlsd)
zval entry;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &z_ftp, &dir, &dir_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* get raw directory listing */
@@ -808,11 +598,11 @@ PHP_FUNCTION(ftp_systype)
const char *syst;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &z_ftp) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (NULL == (syst = ftp_syst(ftp))) {
@@ -837,11 +627,11 @@ PHP_FUNCTION(ftp_fget)
zend_long mode=FTPTYPE_IMAGE, resumepos=0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rrs|ll", &z_ftp, &z_file, &file, &file_len, &mode, &resumepos) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
php_stream_from_res(stream, Z_RES_P(z_file));
XTYPE(xtype, mode);
@@ -883,11 +673,11 @@ PHP_FUNCTION(ftp_nb_fget)
zend_long mode=FTPTYPE_IMAGE, resumepos=0, ret;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rrs|ll", &z_ftp, &z_file, &file, &file_len, &mode, &resumepos) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
php_stream_from_res(stream, Z_RES_P(z_file));
XTYPE(xtype, mode);
@@ -929,11 +719,11 @@ PHP_FUNCTION(ftp_pasv)
zend_bool pasv;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rb", &z_ftp, &pasv) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (!ftp_pasv(ftp, pasv ? 1 : 0)) {
@@ -957,11 +747,11 @@ PHP_FUNCTION(ftp_get)
zend_long mode=FTPTYPE_IMAGE, resumepos=0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rpp|ll", &z_ftp, &local, &local_len, &remote, &remote_len, &mode, &resumepos) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
XTYPE(xtype, mode);
@@ -1023,11 +813,11 @@ PHP_FUNCTION(ftp_nb_get)
zend_long mode=FTPTYPE_IMAGE, resumepos=0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rss|ll", &z_ftp, &local, &local_len, &remote, &remote_len, &mode, &resumepos) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
XTYPE(xtype, mode);
@@ -1091,15 +881,15 @@ PHP_FUNCTION(ftp_nb_continue)
zend_long ret;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &z_ftp) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (!ftp->nb) {
- php_error_docref(NULL, E_WARNING, "no nbronous transfer to continue.");
+ php_error_docref(NULL, E_WARNING, "No nbronous transfer to continue.");
RETURN_LONG(PHP_FTP_FAILED);
}
@@ -1135,11 +925,11 @@ PHP_FUNCTION(ftp_fput)
char *remote;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsr|ll", &z_ftp, &remote, &remote_len, &z_file, &mode, &startpos) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
php_stream_from_zval(stream, z_file);
XTYPE(xtype, mode);
@@ -1185,11 +975,11 @@ PHP_FUNCTION(ftp_nb_fput)
char *remote;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsr|ll", &z_ftp, &remote, &remote_len, &z_file, &mode, &startpos) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
php_stream_from_res(stream, Z_RES_P(z_file));
XTYPE(xtype, mode);
@@ -1239,11 +1029,11 @@ PHP_FUNCTION(ftp_put)
php_stream *instream;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rpp|ll", &z_ftp, &remote, &remote_len, &local, &local_len, &mode, &startpos) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
XTYPE(xtype, mode);
@@ -1293,11 +1083,11 @@ PHP_FUNCTION(ftp_append)
php_stream *instream;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rpp|l", &z_ftp, &remote, &remote_len, &local, &local_len, &mode) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
XTYPE(xtype, mode);
@@ -1329,11 +1119,11 @@ PHP_FUNCTION(ftp_nb_put)
php_stream *instream;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rpp|ll", &z_ftp, &remote, &remote_len, &local, &local_len, &mode, &startpos) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
XTYPE(xtype, mode);
@@ -1388,11 +1178,11 @@ PHP_FUNCTION(ftp_size)
size_t file_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rp", &z_ftp, &file, &file_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* get file size */
@@ -1410,11 +1200,11 @@ PHP_FUNCTION(ftp_mdtm)
size_t file_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rp", &z_ftp, &file, &file_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* get file mod time */
@@ -1432,11 +1222,11 @@ PHP_FUNCTION(ftp_rename)
size_t src_len, dest_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rss", &z_ftp, &src, &src_len, &dest, &dest_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* rename the file */
@@ -1459,11 +1249,11 @@ PHP_FUNCTION(ftp_delete)
size_t file_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &z_ftp, &file, &file_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* delete the file */
@@ -1486,11 +1276,11 @@ PHP_FUNCTION(ftp_site)
size_t cmd_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &z_ftp, &cmd, &cmd_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* send the site command */
@@ -1511,11 +1301,11 @@ PHP_FUNCTION(ftp_close)
ftpbuf_t *ftp;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &z_ftp) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
ftp_quit(ftp);
@@ -1533,11 +1323,11 @@ PHP_FUNCTION(ftp_set_option)
ftpbuf_t *ftp;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlz", &z_ftp, &option, &z_value) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
switch (option) {
@@ -1589,11 +1379,11 @@ PHP_FUNCTION(ftp_get_option)
ftpbuf_t *ftp;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &z_ftp, &option) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((ftp = (ftpbuf_t *)zend_fetch_resource(Z_RES_P(z_ftp), le_ftpbuf_name, le_ftpbuf)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
switch (option) {
diff --git a/ext/ftp/php_ftp.h b/ext/ftp/php_ftp.h
index f3033df8fe..0d85f64880 100644
--- a/ext/ftp/php_ftp.h
+++ b/ext/ftp/php_ftp.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/ftp/tests/004.phpt b/ext/ftp/tests/004.phpt
index 3fcf272e3b..b95c12c518 100644
--- a/ext/ftp/tests/004.phpt
+++ b/ext/ftp/tests/004.phpt
@@ -8,68 +8,22 @@ require 'skipif.inc';
<?php
require 'server.inc';
+// Negative timeout
+var_dump(ftp_connect('127.0.0.1', 0, -3));
+
$ftp = ftp_connect('127.0.0.1', $port);
if (!$ftp) die("Couldn't connect to the server");
var_dump(ftp_login($ftp, 'user', 'pass'));
-
-var_dump(ftp_systype($ftp));
-
-/* some bogus usage */
-var_dump(ftp_alloc($ftp, array()));
-var_dump(ftp_cdup($ftp, 0));
-var_dump(ftp_chdir($ftp, array()));
-var_dump(ftp_chmod($ftp, 0666));
-var_dump(ftp_close());
-var_dump(ftp_connect('sfjkfjaksfjkasjf'));
-var_dump(ftp_delete($ftp, array()));
-var_dump(ftp_exec($ftp, array()));
-
-var_dump(ftp_systype($ftp, 0));
-var_dump(ftp_pwd($ftp, array()));
-
-var_dump(ftp_login($ftp));
var_dump(ftp_login($ftp, 'user', 'bogus'));
var_dump(ftp_quit($ftp));
?>
--EXPECTF--
-bool(true)
-string(4) "UNIX"
-
-Warning: ftp_alloc() expects parameter 2 to be int, array given in %s004.php on line 12
-bool(false)
-
-Warning: ftp_cdup() expects exactly 1 parameter, 2 given in %s004.php on line 13
-NULL
-
-Warning: ftp_chdir() expects parameter 2 to be string, array given in %s004.php on line 14
-NULL
-
-Warning: ftp_chmod() expects exactly 3 parameters, 2 given in %s on line %d
+Warning: ftp_connect(): Timeout has to be greater than 0 in %s on line %d
bool(false)
+bool(true)
-Warning: ftp_close() expects exactly 1 parameter, 0 given in %s004.php on line 16
-NULL
-
-Warning: ftp_connect(): php_network_getaddresses: getaddrinfo failed: %s in %s004.php on line 17
-bool(false)
-
-Warning: ftp_delete() expects parameter 2 to be string, array given in %s004.php on line 18
-NULL
-
-Warning: ftp_exec() expects parameter 2 to be string, array given in %s004.php on line 19
-NULL
-
-Warning: ftp_systype() expects exactly 1 parameter, 2 given in %s004.php on line 21
-NULL
-
-Warning: ftp_pwd() expects exactly 1 parameter, 2 given in %s004.php on line 22
-NULL
-
-Warning: ftp_login() expects exactly 3 parameters, 1 given in %s004.php on line 24
-NULL
-
-Warning: ftp_login(): Not logged in. in %s004.php on line 25
+Warning: ftp_login(): Not logged in. in %s on line %d
bool(false)
bool(true)
diff --git a/ext/ftp/tests/005.phpt b/ext/ftp/tests/005.phpt
index bbc11e87ae..4b46321e26 100644
--- a/ext/ftp/tests/005.phpt
+++ b/ext/ftp/tests/005.phpt
@@ -66,7 +66,7 @@ int(-1)
Warning: ftp_mkdir(): Command not implemented (7). in %s005.php on line 20
bool(false)
-Warning: ftp_nb_continue(): no nbronous transfer to continue. in %s005.php on line 21
+Warning: ftp_nb_continue(): No nbronous transfer to continue. in %s005.php on line 21
int(0)
Warning: ftp_nb_fget(): Mode must be FTP_ASCII or FTP_BINARY in %s005.php on line 22
diff --git a/ext/ftp/tests/006.phpt b/ext/ftp/tests/006.phpt
deleted file mode 100644
index ff0d258917..0000000000
--- a/ext/ftp/tests/006.phpt
+++ /dev/null
@@ -1,108 +0,0 @@
---TEST--
-FTP with bogus parameters
---SKIPIF--
-<?php
-require 'skipif.inc';
-?>
---FILE--
-<?php
-$ftp=null;
-
-var_dump(ftp_connect(array()));
-var_dump(ftp_connect('127.0.0.1', 0, -3));
-var_dump(ftp_raw($ftp));
-var_dump(ftp_mkdir($ftp));
-var_dump(ftp_rmdir($ftp));
-var_dump(ftp_nlist($ftp));
-var_dump(ftp_rawlist($ftp));
-var_dump(ftp_fget($ftp));
-var_dump(ftp_nb_fget($ftp));
-var_dump(ftp_nb_get($ftp));
-var_dump(ftp_pasv($ftp));
-var_dump(ftp_nb_continue());
-var_dump(ftp_fput());
-var_dump(ftp_nb_fput($ftp));
-var_dump(ftp_put($ftp));
-var_dump(ftp_nb_put($ftp));
-var_dump(ftp_size($ftp));
-var_dump(ftp_mdtm($ftp));
-var_dump(ftp_rename($ftp));
-var_dump(ftp_site($ftp));
-var_dump(ftp_set_option($ftp));
-var_dump(ftp_get_option($ftp));
-var_dump(ftp_mlsd($ftp));
-var_dump(ftp_append($ftp));
-
-?>
---EXPECTF--
-Warning: ftp_connect() expects parameter 1 to be string, array given in %s006.php on line 4
-NULL
-
-Warning: ftp_connect(): Timeout has to be greater than 0 in %s006.php on line 5
-bool(false)
-
-Warning: ftp_raw() expects exactly 2 parameters, 1 given in %s006.php on line 6
-NULL
-
-Warning: ftp_mkdir() expects exactly 2 parameters, 1 given in %s006.php on line 7
-NULL
-
-Warning: ftp_rmdir() expects exactly 2 parameters, 1 given in %s006.php on line 8
-NULL
-
-Warning: ftp_nlist() expects exactly 2 parameters, 1 given in %s006.php on line 9
-NULL
-
-Warning: ftp_rawlist() expects at least 2 parameters, 1 given in %s006.php on line 10
-NULL
-
-Warning: ftp_fget() expects at least 3 parameters, 1 given in %s006.php on line 11
-NULL
-
-Warning: ftp_nb_fget() expects at least 3 parameters, 1 given in %s006.php on line 12
-NULL
-
-Warning: ftp_nb_get() expects at least 3 parameters, 1 given in %s006.php on line 13
-NULL
-
-Warning: ftp_pasv() expects exactly 2 parameters, 1 given in %s006.php on line 14
-NULL
-
-Warning: ftp_nb_continue() expects exactly 1 parameter, 0 given in %s006.php on line 15
-NULL
-
-Warning: ftp_fput() expects at least 3 parameters, 0 given in %s006.php on line 16
-NULL
-
-Warning: ftp_nb_fput() expects at least 3 parameters, 1 given in %s006.php on line 17
-NULL
-
-Warning: ftp_put() expects at least 3 parameters, 1 given in %s006.php on line 18
-NULL
-
-Warning: ftp_nb_put() expects at least 3 parameters, 1 given in %s006.php on line 19
-NULL
-
-Warning: ftp_size() expects exactly 2 parameters, 1 given in %s006.php on line 20
-NULL
-
-Warning: ftp_mdtm() expects exactly 2 parameters, 1 given in %s006.php on line 21
-NULL
-
-Warning: ftp_rename() expects exactly 3 parameters, 1 given in %s006.php on line 22
-NULL
-
-Warning: ftp_site() expects exactly 2 parameters, 1 given in %s006.php on line 23
-NULL
-
-Warning: ftp_set_option() expects exactly 3 parameters, 1 given in %s006.php on line 24
-NULL
-
-Warning: ftp_get_option() expects exactly 2 parameters, 1 given in %s006.php on line 25
-NULL
-
-Warning: ftp_mlsd() expects exactly 2 parameters, 1 given in %s006.php on line 26
-NULL
-
-Warning: ftp_append() expects at least 3 parameters, 1 given in %s006.php on line 27
-NULL
diff --git a/ext/ftp/tests/007.phpt b/ext/ftp/tests/007.phpt
index eebe8cf1e3..0520b37293 100644
--- a/ext/ftp/tests/007.phpt
+++ b/ext/ftp/tests/007.phpt
@@ -11,138 +11,205 @@ require 'skipif.inc';
<?php
$ftp = tmpfile();
-var_dump(ftp_login($ftp, 'user', 'pass'));
-var_dump(ftp_pwd($ftp));
-var_dump(ftp_cdup($ftp));
-var_dump(ftp_chdir($ftp, '~'));
-var_dump(ftp_exec($ftp, 'x'));
-var_dump(ftp_raw($ftp, 'x'));
-var_dump(ftp_mkdir($ftp, '/'));
-var_dump(ftp_rmdir($ftp, '/'));
-var_dump(ftp_chmod($ftp, 7777, '/'));
-var_dump(ftp_alloc($ftp, 7777));
-var_dump(ftp_nlist($ftp, '/'));
-var_dump(ftp_rawlist($ftp, '~'));
-var_dump(ftp_mlsd($ftp, '~'));
-var_dump(ftp_systype($ftp));
-var_dump(ftp_fget($ftp, $ftp, 'remote', 7777));
-var_dump(ftp_nb_fget($ftp, $ftp, 'remote', 7777));
-var_dump(ftp_pasv($ftp, false));
-var_dump(ftp_get($ftp, 'local', 'remote', 7777));
-var_dump(ftp_nb_get($ftp, 'local', 'remote', 7777));
-var_dump(ftp_nb_continue($ftp));
-var_dump(ftp_fput($ftp, 'remote', $ftp, 9999));
-var_dump(ftp_nb_fput($ftp, 'remote', $ftp, 9999));
-var_dump(ftp_put($ftp, 'remote', 'local', 9999));
-var_dump(ftp_append($ftp, 'remote', 'local', 9999));
-var_dump(ftp_nb_put($ftp, 'remote', 'local', 9999));
-var_dump(ftp_size($ftp, '~'));
-var_dump(ftp_mdtm($ftp, '~'));
-var_dump(ftp_rename($ftp, 'old', 'new'));
-var_dump(ftp_delete($ftp, 'gone'));
-var_dump(ftp_site($ftp, 'localhost'));
-var_dump(ftp_close($ftp));
-var_dump(ftp_set_option($ftp, 1, 2));
-var_dump(ftp_get_option($ftp, 1));
+try {
+ var_dump(ftp_login($ftp, 'user', 'pass'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_pwd($ftp));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_cdup($ftp));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_chdir($ftp, '~'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_exec($ftp, 'x'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_raw($ftp, 'x'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_mkdir($ftp, '/'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_rmdir($ftp, '/'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_chmod($ftp, 7777, '/'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_alloc($ftp, 7777));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_nlist($ftp, '/'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_rawlist($ftp, '~'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_mlsd($ftp, '~'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_systype($ftp));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_fget($ftp, $ftp, 'remote', 7777));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_nb_fget($ftp, $ftp, 'remote', 7777));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_pasv($ftp, false));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_get($ftp, 'local', 'remote', 7777));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_nb_get($ftp, 'local', 'remote', 7777));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_nb_continue($ftp));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_fput($ftp, 'remote', $ftp, 9999));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_nb_fput($ftp, 'remote', $ftp, 9999));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_put($ftp, 'remote', 'local', 9999));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_append($ftp, 'remote', 'local', 9999));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_nb_put($ftp, 'remote', 'local', 9999));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_size($ftp, '~'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_mdtm($ftp, '~'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_rename($ftp, 'old', 'new'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_delete($ftp, 'gone'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_site($ftp, 'localhost'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_close($ftp));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_set_option($ftp, 1, 2));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(ftp_get_option($ftp, 1));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
fclose($ftp);
?>
---EXPECTF--
-Warning: ftp_login(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_pwd(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_cdup(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_chdir(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_exec(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_raw(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_mkdir(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_rmdir(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_chmod(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_alloc(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_nlist(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_rawlist(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_mlsd(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_systype(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_fget(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_nb_fget(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_pasv(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_get(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_nb_get(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_nb_continue(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_fput(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_nb_fput(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_put(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_append(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_nb_put(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_size(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_mdtm(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_rename(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_delete(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_site(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_close(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_set_option(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
-
-Warning: ftp_get_option(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d
-bool(false)
+--EXPECT--
+ftp_login(): supplied resource is not a valid FTP Buffer resource
+ftp_pwd(): supplied resource is not a valid FTP Buffer resource
+ftp_cdup(): supplied resource is not a valid FTP Buffer resource
+ftp_chdir(): supplied resource is not a valid FTP Buffer resource
+ftp_exec(): supplied resource is not a valid FTP Buffer resource
+ftp_raw(): supplied resource is not a valid FTP Buffer resource
+ftp_mkdir(): supplied resource is not a valid FTP Buffer resource
+ftp_rmdir(): supplied resource is not a valid FTP Buffer resource
+ftp_chmod(): supplied resource is not a valid FTP Buffer resource
+ftp_alloc(): supplied resource is not a valid FTP Buffer resource
+ftp_nlist(): supplied resource is not a valid FTP Buffer resource
+ftp_rawlist(): supplied resource is not a valid FTP Buffer resource
+ftp_mlsd(): supplied resource is not a valid FTP Buffer resource
+ftp_systype(): supplied resource is not a valid FTP Buffer resource
+ftp_fget(): supplied resource is not a valid FTP Buffer resource
+ftp_nb_fget(): supplied resource is not a valid FTP Buffer resource
+ftp_pasv(): supplied resource is not a valid FTP Buffer resource
+ftp_get(): supplied resource is not a valid FTP Buffer resource
+ftp_nb_get(): supplied resource is not a valid FTP Buffer resource
+ftp_nb_continue(): supplied resource is not a valid FTP Buffer resource
+ftp_fput(): supplied resource is not a valid FTP Buffer resource
+ftp_nb_fput(): supplied resource is not a valid FTP Buffer resource
+ftp_put(): supplied resource is not a valid FTP Buffer resource
+ftp_append(): supplied resource is not a valid FTP Buffer resource
+ftp_nb_put(): supplied resource is not a valid FTP Buffer resource
+ftp_size(): supplied resource is not a valid FTP Buffer resource
+ftp_mdtm(): supplied resource is not a valid FTP Buffer resource
+ftp_rename(): supplied resource is not a valid FTP Buffer resource
+ftp_delete(): supplied resource is not a valid FTP Buffer resource
+ftp_site(): supplied resource is not a valid FTP Buffer resource
+ftp_close(): supplied resource is not a valid FTP Buffer resource
+ftp_set_option(): supplied resource is not a valid FTP Buffer resource
+ftp_get_option(): supplied resource is not a valid FTP Buffer resource
diff --git a/ext/ftp/tests/ftp_fget_basic.phpt b/ext/ftp/tests/ftp_fget_basic.phpt
index 336594e316..62092f897d 100644
--- a/ext/ftp/tests/ftp_fget_basic.phpt
+++ b/ext/ftp/tests/ftp_fget_basic.phpt
@@ -21,10 +21,10 @@ var_dump(ftp_fget($ftp, $fp ,'a story.txt', FTP_ASCII));
fseek($fp, 0);
echo fgets($fp);
-$postition = ftell($fp);
+$position = ftell($fp);
//test binary data transfer
var_dump(ftp_fget($ftp, $fp, 'binary data.bin', FTP_BINARY));
-fseek($fp, $postition);
+fseek($fp, $position);
var_dump(urlencode(fgets($fp)));
//test non-existent file request
diff --git a/ext/ftp/tests/ftp_get_basic.phpt b/ext/ftp/tests/ftp_get_basic.phpt
index 2c5f6f58a6..c52ea56218 100644
--- a/ext/ftp/tests/ftp_get_basic.phpt
+++ b/ext/ftp/tests/ftp_get_basic.phpt
@@ -29,9 +29,6 @@ unlink($tmpfname);
//test non-existent file request
ftp_get($ftp, $tmpfname ,'a warning.txt', FTP_ASCII);
-
-//test invalid ftp_get params
-var_dump(ftp_get('foo', 'bar', 'baz'));
?>
--EXPECTF--
bool(true)
@@ -41,6 +38,3 @@ bool(true)
string(21) "BINARYFoo%00Bar%0D%0A"
Warning: ftp_get(): a warning: No such file or directory in %sftp_get_basic.php on line %d
-
-Warning: ftp_get() expects parameter 1 to be resource, string given in %s on line %d
-NULL
diff --git a/ext/ftp/tests/ftp_set_option_errors.phpt b/ext/ftp/tests/ftp_set_option_errors.phpt
index 1ad8a072c9..ad91be56e8 100644
--- a/ext/ftp/tests/ftp_set_option_errors.phpt
+++ b/ext/ftp/tests/ftp_set_option_errors.phpt
@@ -1,5 +1,5 @@
--TEST--
-Testing ftp_set_option erros while setting up
+Testing ftp_set_option errors while setting up
--CREDITS--
Gabriel Caruso (carusogabriel34@gmail.com)
--SKIPIF--
diff --git a/ext/ftp/tests/ftp_ssl_connect_error.phpt b/ext/ftp/tests/ftp_ssl_connect_error.phpt
index b0ece5d63b..13c8f9e9c0 100644
--- a/ext/ftp/tests/ftp_ssl_connect_error.phpt
+++ b/ext/ftp/tests/ftp_ssl_connect_error.phpt
@@ -12,14 +12,6 @@ echo "*** Testing ftp_ssl_connect() function : error conditions ***\n";
echo "\n-- Testing ftp_ssl_connect() function on failure --\n";
var_dump(ftp_ssl_connect('totes.invalid'));
-echo "\n-- Testing ftp_ssl_connect() function invalid argument type --\n";
-ftp_ssl_connect([]);
-ftp_ssl_connect('totes.invalid', []);
-ftp_ssl_connect('totes.invalid', 21, []);
-
-echo "\n-- Testing ftp_ssl_connect() function with more than expected no. of arguments --\n";
-ftp_ssl_connect('totes.invalid', 21, 1, []);
-
echo "\n-- Testing ftp_ssl_connect() function timeout warning for value 0 --\n";
ftp_ssl_connect('totes.invalid', 21, 0);
@@ -32,18 +24,6 @@ echo "===DONE===\n";
Warning: ftp_ssl_connect(): php_network_getaddresses: getaddrinfo failed: %s in %s on line %d
bool(false)
--- Testing ftp_ssl_connect() function invalid argument type --
-
-Warning: ftp_ssl_connect() expects parameter 1 to be string, array given in %s on line %d
-
-Warning: ftp_ssl_connect() expects parameter 2 to be int, array given in %s on line %d
-
-Warning: ftp_ssl_connect() expects parameter 3 to be int, array given in %s on line %d
-
--- Testing ftp_ssl_connect() function with more than expected no. of arguments --
-
-Warning: ftp_ssl_connect() expects at most 3 parameters, 4 given in %s on line %d
-
-- Testing ftp_ssl_connect() function timeout warning for value 0 --
Warning: ftp_ssl_connect(): Timeout has to be greater than 0 in %s on line %d
diff --git a/ext/ftp/tests/server.inc b/ext/ftp/tests/server.inc
index ed21843f43..38599391d6 100644
--- a/ext/ftp/tests/server.inc
+++ b/ext/ftp/tests/server.inc
@@ -5,551 +5,551 @@ $errno = 0;
$context = stream_context_create(array('ssl' => array('local_cert' => dirname(__FILE__).'/cert.pem')));
for ($i=0; $i<10 && !$socket; ++$i) {
- $port = rand(50000, 65535);
+ $port = rand(50000, 65535);
- $socket = @stream_socket_server("tcp://127.0.0.1:$port", $errno, $errstr, STREAM_SERVER_BIND|STREAM_SERVER_LISTEN, $context);
+ $socket = @stream_socket_server("tcp://127.0.0.1:$port", $errno, $errstr, STREAM_SERVER_BIND|STREAM_SERVER_LISTEN, $context);
}
//set anther random port that is not the same as $port
do{
- $pasv_port = rand(50000, 65535);
+ $pasv_port = rand(50000, 65535);
}while($pasv_port == $port);
if (!$socket) {
- echo "$errstr ($errno)\n";
- die("could not start/bind the ftp server\n");
+ echo "$errstr ($errno)\n";
+ die("could not start/bind the ftp server\n");
}
$pid = pcntl_fork();
function pasv_listen($action){
- global $pasv_port, $tmp_file;
- $tmp_file = 'nm2.php';
- $pid = pcntl_fork();
- if($pid === 0){
- $soc = stream_socket_server("tcp://127.0.0.1:$pasv_port");
- $fs = stream_socket_accept($soc, 3);
- switch ($action) {
- case 'fget':
- case 'get':
- //listen for 3 seconds 3 seconds
- fputs($fs, "I am passive.\r\n");
- break;
- case 'put':
- file_put_contents($tmp_file, stream_get_contents($fs));
- break;
- case 'list':
- fputs($fs, "drwxr-x--- 3 owner group 4096 Jul 12 12:16 .\r\n");
- fputs($fs, "drwxr-x--- 3 owner group 4096 Jul 12 12:16 ..\r\n");
- fputs($fs, "drwxr-x--- 3 owner group 4096 Jul 12 12:16 public_ftp\r\n");
- break;
- case 'list_null':
- fputs($fs, "\r\n");
- break;
- }
- fclose($fs);
- exit;
- }
+ global $pasv_port, $tmp_file;
+ $tmp_file = 'nm2.php';
+ $pid = pcntl_fork();
+ if($pid === 0){
+ $soc = stream_socket_server("tcp://127.0.0.1:$pasv_port");
+ $fs = stream_socket_accept($soc, 3);
+ switch ($action) {
+ case 'fget':
+ case 'get':
+ //listen for 3 seconds 3 seconds
+ fputs($fs, "I am passive.\r\n");
+ break;
+ case 'put':
+ file_put_contents($tmp_file, stream_get_contents($fs));
+ break;
+ case 'list':
+ fputs($fs, "drwxr-x--- 3 owner group 4096 Jul 12 12:16 .\r\n");
+ fputs($fs, "drwxr-x--- 3 owner group 4096 Jul 12 12:16 ..\r\n");
+ fputs($fs, "drwxr-x--- 3 owner group 4096 Jul 12 12:16 public_ftp\r\n");
+ break;
+ case 'list_null':
+ fputs($fs, "\r\n");
+ break;
+ }
+ fclose($fs);
+ exit;
+ }
}
if ($pid) {
- function dump_and_exit($buf)
- {
- var_dump($buf);
- fclose($GLOBALS['s']);
- exit;
- }
-
- function anonymous()
- {
- return $GLOBALS['user'] === 'anonymous';
- }
-
- /* quick&dirty realpath() like function */
- function change_dir($dir)
- {
- global $cwd;
-
- if ($dir[0] == '/') {
- $cwd = $dir;
- return;
- }
-
- $cwd = "$cwd/$dir";
-
- do {
- $old = $cwd;
- $cwd = preg_replace('@/?[^/]+/\.\.@', '', $cwd);
- } while ($old != $cwd);
-
- $cwd = strtr($cwd, array('//' => '/'));
- if (!$cwd) $cwd = '/';
- }
-
- $s = stream_socket_accept($socket);
-
- if (!$s) die("Error accepting a new connection\n");
-
- fputs($s, "220----- PHP FTP server 0.3 -----\r\n220 Service ready\r\n");
- $buf = fread($s, 2048);
-
-
- function user_auth($buf) {
- global $user, $s, $ssl, $bug37799;
-
- if (!empty($ssl)) {
- if ($buf !== "AUTH TLS\r\n") {
- fputs($s, "500 Syntax error, command unrecognized.\r\n");
- dump_and_exit($buf);
- }
-
- if (empty($bug37799)) {
- fputs($s, "234 auth type accepted\r\n");
- } else {
- fputs($s, "666 dummy\r\n");
- fputs($s, "666 bogus msg\r\n");
- exit;
- }
-
- if (!stream_socket_enable_crypto($s, true, STREAM_CRYPTO_METHOD_SSLv23_SERVER)) {
- die("SSLv23 handshake failed.\n");
- }
-
- if (!preg_match('/^PBSZ \d+\r\n$/', $buf = fread($s, 2048))) {
- fputs($s, "501 bogus data\r\n");
- dump_and_exit($buf);
- }
-
- fputs($s, "200 OK\r\n");
- $buf = fread($s, 2048);
-
- if ($buf !== "PROT P\r\n") {
- fputs($s, "504 Wrong protection.\r\n");
- dump_and_exit($buf);
- }
-
- fputs($s, "200 OK\r\n");
-
- $buf = fread($s, 2048);
- }
-
- if ($buf == "AUTH TLS\r\n") {
- fputs($s, "500 not supported.\r\n");
- return ;
- } else if (!preg_match('/^USER (\w+)\r\n$/', $buf, $m)) {
- fputs($s, "500 Syntax error, command unrecognized.\r\n");
- dump_and_exit($buf);
- }
- $user = $m[1];
- if ($user !== 'user' && $user !== 'anonymous') {
- fputs($s, "530 Not logged in.\r\n");
- fclose($s);
- exit;
- }
-
- if (anonymous()) {
- fputs($s, "230 Anonymous user logged in\r\n");
-
- } else {
- fputs($s, "331 User name ok, need password\r\n");
-
- if (!preg_match('/^PASS (\w+)\r\n$/', $buf = fread($s, 100), $m)) {
- fputs($s, "500 Syntax error, command unrecognized.\r\n");
- dump_and_exit($buf);
- }
-
- $pass = $m[1];
- if ($pass === 'pass') {
- fputs($s, "230 User logged in\r\n");
- } else {
- fputs($s, "530 Not logged in.\r\n");
- fclose($s);
- exit;
- }
- }
- }
-
- user_auth($buf);
-
- $cwd = '/';
- $num_bogus_cmds = 0;
-
- while($buf = fread($s, 4098)) {
- if (!empty($bogus)) {
- fputs($s, "502 Command not implemented (".$num_bogus_cmds++.").\r\n");
-
- } else if ($buf === "HELP\r\n") {
- fputs($s, "214-There is help available for the following commands:\r\n");
- fputs($s, " USER\r\n");
- fputs($s, " HELP\r\n");
- fputs($s, "214 end of list\r\n");
-
- } elseif ($buf === "HELP HELP\r\n") {
- fputs($s, "214 Syntax: HELP [<SP> <string>] <CRLF>\r\n");
-
- } elseif ($buf === "PWD\r\n") {
- fputs($s, "257 \"$cwd\" is current directory.\r\n");
-
- } elseif ($buf === "CDUP\r\n") {
- change_dir('..');
- fputs($s, "250 CDUP command successful.\r\n");
-
- } elseif ($buf === "SYST\r\n") {
- if (isset($bug27809)) {
- fputs($s, "215 OS/400 is the remote operating system. The TCP/IP version is \"V5R2M0\"\r\n");
- } else {
- fputs($s, "215 UNIX Type: L8.\r\n");
- }
-
- } elseif ($buf === "TYPE A\r\n") {
- $ascii = true;
- fputs($s, "200 OK\r\n");
-
- } elseif ($buf === "AUTH SSL\r\n") {
- $ascii = true;
- fputs($s, "500 not supported\r\n");
-
- } elseif ($buf === "TYPE I\r\n") {
- $ascii = false;
- fputs($s, "200 OK\r\n");
-
- } elseif ($buf === "QUIT\r\n") {
- break;
-
- } elseif (preg_match("~^PORT (\d+),(\d+),(\d+),(\d+),(\d+),(\d+)\r\n$~", $buf, $m)) {
- $host = "$m[1].$m[2].$m[3].$m[4]";
- $port = ((int)$m[5] << 8) + (int)$m[6];
- fputs($s, "200 OK.\r\n");
-
- } elseif (preg_match("~^STOR ([\w/.-]+)\r\n$~", $buf, $m)) {
- fputs($s, "150 File status okay; about to open data connection\r\n");
-
- if(empty($pasv))
- {
- if (!$fs = stream_socket_client("tcp://$host:$port")) {
- fputs($s, "425 Can't open data connection\r\n");
- continue;
- }
-
- $data = stream_get_contents($fs);
- $orig = file_get_contents(dirname(__FILE__).'/'.$m[1]);
-
-
- if (isset($ascii) && !$ascii && $orig === $data) {
- fputs($s, "226 Closing data Connection.\r\n");
-
- } elseif ((!empty($ascii) || isset($bug39583)) && $data === strtr($orig, array("\r\n" => "\n", "\r" => "\n", "\n" => "\r\n"))) {
- fputs($s, "226 Closing data Connection.\r\n");
-
- } else {
- var_dump($data);
- var_dump($orig);
- fputs($s, "552 Requested file action aborted.\r\n");
- }
- fclose($fs);
- }else{
- $data = file_get_contents('nm2.php');
- $orig = file_get_contents(dirname(__FILE__).'/'.$m[1]);
- if ( $orig === $data) {
- fputs($s, "226 Closing data Connection.\r\n");
-
- } else {
- var_dump($data);
- var_dump($orig);
- fputs($s, "552 Requested file action aborted.\r\n");
- }
- }
-
- } elseif (preg_match("~^APPE ([\w/.-]+)\r\n$~", $buf, $m)) {
- fputs($s, "150 File status okay; about to open data connection\r\n");
-
- if(empty($pasv))
- {
- if (!$fs = stream_socket_client("tcp://$host:$port")) {
- fputs($s, "425 Can't open data connection\r\n");
- continue;
- }
-
- $data = stream_get_contents($fs);
- file_put_contents(__DIR__.'/'.$m[1], $data, FILE_APPEND);
- fputs($s, "226 Closing data Connection.\r\n");
- fclose($fs);
- }else{
- $data = stream_get_contents($fs);
- file_put_contents(__DIR__.'/'.$m[1], $data, FILE_APPEND);
- fputs($s, "226 Closing data Connection.\r\n");
- fclose($fs);
- }
-
- }elseif (preg_match("~^CWD ([A-Za-z./]+)\r\n$~", $buf, $m)) {
- if (isset($bug77680)) {
- fputs($s, "550 Directory change to $m[1] failed: file does not exist\r\n");
- var_dump($buf);
- } else {
- change_dir($m[1]);
- fputs($s, "250 CWD command successful.\r\n");
- }
-
- } elseif (preg_match("~^NLST(?: ([A-Za-z./]+))?\r\n$~", $buf, $m)) {
-
- if (isset($m[1]) && (($m[1] === 'bogusdir') || ($m[1] === '/bogusdir'))) {
- fputs($s, "250 $m[1]: No such file or directory\r\n");
- continue;
- }
-
- // there are some servers that don't open the ftp-data socket if there's nothing to send
- if (isset($bug39458) && isset($m[1]) && $m[1] === 'emptydir') {
- fputs($s, "226 Transfer complete.\r\n");
- continue;
- }
-
- if (empty($pasv)) {
- fputs($s, "150 File status okay; about to open data connection\r\n");
- if (!$fs = stream_socket_client("tcp://$host:$port")) {
- fputs($s, "425 Can't open data connection\r\n");
- continue;
- }
- } else {
- fputs($s, "125 Data connection already open; transfer starting.\r\n");
- $fs=$pasvs;
- }
-
-
- if ((!empty($ssl)) && (!stream_socket_enable_crypto($pasvs, true, STREAM_CRYPTO_METHOD_SSLv23_SERVER))) {
- die("SSLv23 handshake failed.\n");
- }
-
- if (empty($m[1]) || $m[1] !== 'emptydir') {
- fputs($fs, "file1\r\nfile1\r\nfile\nb0rk\r\n");
- }
-
- fputs($s, "226 Closing data Connection.\r\n");
- fclose($fs);
-
- } elseif (preg_match("~^MKD ([A-Za-z./]+)\r\n$~", $buf, $m)) {
- if (isset($bug7216)) {
- fputs($s, "257 OK.\r\n");
- } else {
- if (isset($bug77680)) {
- var_dump($buf);
- }
- fputs($s, "257 \"/path/to/ftproot$cwd$m[1]\" created.\r\n");
- }
-
- } elseif (preg_match('/^USER /', $buf)) {
- user_auth($buf);
-
- } elseif (preg_match('/^MDTM ([\w\h]+)/', $buf, $matches)) {
- switch ($matches [1]){
- case "A":
- fputs($s, "213 19980615100045.014\r\n");
- break;
- case "B":
- fputs($s, "213 19980615100045.014\r\n");
- break;
- case "C":
- fputs($s, "213 19980705132316\r\n");
- break;
- case "19990929043300 File6":
- fputs($s, "213 19991005213102\r\n");
- break;
- default :
- fputs($s, "550 No file named \"{$matches [1]}\"\r\n");
- break;
- }
- }elseif (preg_match('/^RETR ([\/]*[\w\h]+)/', $buf, $matches)) {
- if(!empty($pasv)){
- ;
- }
- else if (!$fs = stream_socket_client("tcp://$host:$port")) {
- fputs($s, "425 Can't open data connection\r\n");
- continue;
- }
-
- switch($matches[1]){
-
- case "pasv":
- fputs($s, "150 File status okay; about to open data connection.\r\n");
- //the data connection is handled in another forked process
- // called from outside this while loop
- fputs($s, "226 Closing data Connection.\r\n");
- break;
- case "a story":
- fputs($s, "150 File status okay; about to open data connection.\r\n");
- fputs($fs, "For sale: baby shoes, never worn.\r\n");
- fputs($s, "226 Closing data Connection.\r\n");
- break;
- case "binary data":
- fputs($s, "150 File status okay; about to open data connection.\r\n");
- $transfer_type = $ascii? 'ASCII' : 'BINARY' ;
- fputs($fs, $transfer_type."Foo\0Bar\r\n");
- fputs($s, "226 Closing data Connection.\r\n");
- break;
- case "fget":
- fputs($s, "150 File status okay; about to open data connection.\r\n");
- $transfer_type = $ascii? 'ASCII' : 'BINARY' ;
- fputs($fs, $transfer_type."FooBar\r\n");
- fputs($s, "226 Closing data Connection.\r\n");
- break;
- case "fgetresume":
- fputs($s, "150 File status okay; about to open data connection.\r\n");
- $transfer_type = $ascii? 'ASCII' : 'BINARY' ;
- fputs($fs, "Bar\r\n");
- fputs($s, "226 Closing data Connection.\r\n");
- break;
- case "fget_large":
- fputs($s, "150 File status okay; about to open data connection.\r\n");
- $transfer_type = $ascii? 'ASCII' : 'BINARY' ;
- if ($GLOBALS['rest_pos'] == '5368709119') {
- fputs($fs, "X");
- } else {
- fputs($fs, "Y");
- }
- fputs($s, "226 Closing data Connection.\r\n");
- break;
- case "mediumfile":
- fputs($s, "150 File status okay; about to open data connection.\r\n");
- for($i = 0; $i < 150; $i++){
- fputs($fs, "This is line $i of the test data.\n");
- }
- fputs($s, "226 Closing data Connection.\r\n");
- break;
- case "/bug73457":
- fputs($s, "150 File status okay; about to open data connection.\r\n");
- break;
-
- default:
- fputs($s, "550 {$matches[1]}: No such file or directory \r\n");
- break;
- }
- if(isset($fs))
- fclose($fs);
-
-
- }elseif (preg_match('/^PASV/', $buf, $matches)) {
- $pasv=true;
- $host = "127.0.0.1";
- $i=0;
-
- if (empty($bug73457)) {
- do {
- if (!empty($ssl)) {
- $soc = @stream_socket_server("tcp://127.0.0.1:$pasv_port", $errno, $errstr, STREAM_SERVER_BIND|STREAM_SERVER_LISTEN, $context);
- } else {
- $soc = @stream_socket_server("tcp://127.0.0.1:$pasv_port");
- }
- /* Could bind port, Try another port */
- if (!$soc) {
- $pasv_port = rand(50000, 65535);
- }
- $i++;
- } while ($i<10 && !$soc);
-
- if (!$soc) {
- echo "$errstr ($errno)\n";
- die("could not bind passive port\n");
- }
- } else {
- $pasv_port=1234;
- }
-
- $p2 = $pasv_port % ((int) 1 << 8);
- $p1 = ($pasv_port-$p2)/((int) 1 << 8);
- fputs($s, "227 Entering Passive Mode. (127,0,0,1,{$p1},{$p2})\r\n");
+ function dump_and_exit($buf)
+ {
+ var_dump($buf);
+ fclose($GLOBALS['s']);
+ exit;
+ }
+
+ function anonymous()
+ {
+ return $GLOBALS['user'] === 'anonymous';
+ }
+
+ /* quick&dirty realpath() like function */
+ function change_dir($dir)
+ {
+ global $cwd;
+
+ if ($dir[0] == '/') {
+ $cwd = $dir;
+ return;
+ }
+
+ $cwd = "$cwd/$dir";
+
+ do {
+ $old = $cwd;
+ $cwd = preg_replace('@/?[^/]+/\.\.@', '', $cwd);
+ } while ($old != $cwd);
+
+ $cwd = strtr($cwd, array('//' => '/'));
+ if (!$cwd) $cwd = '/';
+ }
+
+ $s = stream_socket_accept($socket);
+
+ if (!$s) die("Error accepting a new connection\n");
+
+ fputs($s, "220----- PHP FTP server 0.3 -----\r\n220 Service ready\r\n");
+ $buf = fread($s, 2048);
+
+
+ function user_auth($buf) {
+ global $user, $s, $ssl, $bug37799;
+
+ if (!empty($ssl)) {
+ if ($buf !== "AUTH TLS\r\n") {
+ fputs($s, "500 Syntax error, command unrecognized.\r\n");
+ dump_and_exit($buf);
+ }
+
+ if (empty($bug37799)) {
+ fputs($s, "234 auth type accepted\r\n");
+ } else {
+ fputs($s, "666 dummy\r\n");
+ fputs($s, "666 bogus msg\r\n");
+ exit;
+ }
+
+ if (!stream_socket_enable_crypto($s, true, STREAM_CRYPTO_METHOD_SSLv23_SERVER)) {
+ die("SSLv23 handshake failed.\n");
+ }
+
+ if (!preg_match('/^PBSZ \d+\r\n$/', $buf = fread($s, 2048))) {
+ fputs($s, "501 bogus data\r\n");
+ dump_and_exit($buf);
+ }
+
+ fputs($s, "200 OK\r\n");
+ $buf = fread($s, 2048);
+
+ if ($buf !== "PROT P\r\n") {
+ fputs($s, "504 Wrong protection.\r\n");
+ dump_and_exit($buf);
+ }
+
+ fputs($s, "200 OK\r\n");
+
+ $buf = fread($s, 2048);
+ }
+
+ if ($buf == "AUTH TLS\r\n") {
+ fputs($s, "500 not supported.\r\n");
+ return ;
+ } else if (!preg_match('/^USER (\w+)\r\n$/', $buf, $m)) {
+ fputs($s, "500 Syntax error, command unrecognized.\r\n");
+ dump_and_exit($buf);
+ }
+ $user = $m[1];
+ if ($user !== 'user' && $user !== 'anonymous') {
+ fputs($s, "530 Not logged in.\r\n");
+ fclose($s);
+ exit;
+ }
+
+ if (anonymous()) {
+ fputs($s, "230 Anonymous user logged in\r\n");
+
+ } else {
+ fputs($s, "331 User name ok, need password\r\n");
+
+ if (!preg_match('/^PASS (\w+)\r\n$/', $buf = fread($s, 100), $m)) {
+ fputs($s, "500 Syntax error, command unrecognized.\r\n");
+ dump_and_exit($buf);
+ }
+
+ $pass = $m[1];
+ if ($pass === 'pass') {
+ fputs($s, "230 User logged in\r\n");
+ } else {
+ fputs($s, "530 Not logged in.\r\n");
+ fclose($s);
+ exit;
+ }
+ }
+ }
+
+ user_auth($buf);
+
+ $cwd = '/';
+ $num_bogus_cmds = 0;
+
+ while($buf = fread($s, 4098)) {
+ if (!empty($bogus)) {
+ fputs($s, "502 Command not implemented (".$num_bogus_cmds++.").\r\n");
+
+ } else if ($buf === "HELP\r\n") {
+ fputs($s, "214-There is help available for the following commands:\r\n");
+ fputs($s, " USER\r\n");
+ fputs($s, " HELP\r\n");
+ fputs($s, "214 end of list\r\n");
+
+ } elseif ($buf === "HELP HELP\r\n") {
+ fputs($s, "214 Syntax: HELP [<SP> <string>] <CRLF>\r\n");
+
+ } elseif ($buf === "PWD\r\n") {
+ fputs($s, "257 \"$cwd\" is current directory.\r\n");
+
+ } elseif ($buf === "CDUP\r\n") {
+ change_dir('..');
+ fputs($s, "250 CDUP command successful.\r\n");
+
+ } elseif ($buf === "SYST\r\n") {
+ if (isset($bug27809)) {
+ fputs($s, "215 OS/400 is the remote operating system. The TCP/IP version is \"V5R2M0\"\r\n");
+ } else {
+ fputs($s, "215 UNIX Type: L8.\r\n");
+ }
+
+ } elseif ($buf === "TYPE A\r\n") {
+ $ascii = true;
+ fputs($s, "200 OK\r\n");
+
+ } elseif ($buf === "AUTH SSL\r\n") {
+ $ascii = true;
+ fputs($s, "500 not supported\r\n");
+
+ } elseif ($buf === "TYPE I\r\n") {
+ $ascii = false;
+ fputs($s, "200 OK\r\n");
+
+ } elseif ($buf === "QUIT\r\n") {
+ break;
+
+ } elseif (preg_match("~^PORT (\d+),(\d+),(\d+),(\d+),(\d+),(\d+)\r\n$~", $buf, $m)) {
+ $host = "$m[1].$m[2].$m[3].$m[4]";
+ $port = ((int)$m[5] << 8) + (int)$m[6];
+ fputs($s, "200 OK.\r\n");
+
+ } elseif (preg_match("~^STOR ([\w/.-]+)\r\n$~", $buf, $m)) {
+ fputs($s, "150 File status okay; about to open data connection\r\n");
+
+ if(empty($pasv))
+ {
+ if (!$fs = stream_socket_client("tcp://$host:$port")) {
+ fputs($s, "425 Can't open data connection\r\n");
+ continue;
+ }
+
+ $data = stream_get_contents($fs);
+ $orig = file_get_contents(dirname(__FILE__).'/'.$m[1]);
+
+
+ if (isset($ascii) && !$ascii && $orig === $data) {
+ fputs($s, "226 Closing data Connection.\r\n");
+
+ } elseif ((!empty($ascii) || isset($bug39583)) && $data === strtr($orig, array("\r\n" => "\n", "\r" => "\n", "\n" => "\r\n"))) {
+ fputs($s, "226 Closing data Connection.\r\n");
+
+ } else {
+ var_dump($data);
+ var_dump($orig);
+ fputs($s, "552 Requested file action aborted.\r\n");
+ }
+ fclose($fs);
+ }else{
+ $data = file_get_contents('nm2.php');
+ $orig = file_get_contents(dirname(__FILE__).'/'.$m[1]);
+ if ( $orig === $data) {
+ fputs($s, "226 Closing data Connection.\r\n");
+
+ } else {
+ var_dump($data);
+ var_dump($orig);
+ fputs($s, "552 Requested file action aborted.\r\n");
+ }
+ }
+
+ } elseif (preg_match("~^APPE ([\w/.-]+)\r\n$~", $buf, $m)) {
+ fputs($s, "150 File status okay; about to open data connection\r\n");
+
+ if(empty($pasv))
+ {
+ if (!$fs = stream_socket_client("tcp://$host:$port")) {
+ fputs($s, "425 Can't open data connection\r\n");
+ continue;
+ }
+
+ $data = stream_get_contents($fs);
+ file_put_contents(__DIR__.'/'.$m[1], $data, FILE_APPEND);
+ fputs($s, "226 Closing data Connection.\r\n");
+ fclose($fs);
+ }else{
+ $data = stream_get_contents($fs);
+ file_put_contents(__DIR__.'/'.$m[1], $data, FILE_APPEND);
+ fputs($s, "226 Closing data Connection.\r\n");
+ fclose($fs);
+ }
+
+ }elseif (preg_match("~^CWD ([A-Za-z./]+)\r\n$~", $buf, $m)) {
+ if (isset($bug77680)) {
+ fputs($s, "550 Directory change to $m[1] failed: file does not exist\r\n");
+ var_dump($buf);
+ } else {
+ change_dir($m[1]);
+ fputs($s, "250 CWD command successful.\r\n");
+ }
+
+ } elseif (preg_match("~^NLST(?: ([A-Za-z./]+))?\r\n$~", $buf, $m)) {
+
+ if (isset($m[1]) && (($m[1] === 'bogusdir') || ($m[1] === '/bogusdir'))) {
+ fputs($s, "250 $m[1]: No such file or directory\r\n");
+ continue;
+ }
+
+ // there are some servers that don't open the ftp-data socket if there's nothing to send
+ if (isset($bug39458) && isset($m[1]) && $m[1] === 'emptydir') {
+ fputs($s, "226 Transfer complete.\r\n");
+ continue;
+ }
+
+ if (empty($pasv)) {
+ fputs($s, "150 File status okay; about to open data connection\r\n");
+ if (!$fs = stream_socket_client("tcp://$host:$port")) {
+ fputs($s, "425 Can't open data connection\r\n");
+ continue;
+ }
+ } else {
+ fputs($s, "125 Data connection already open; transfer starting.\r\n");
+ $fs=$pasvs;
+ }
+
+
+ if ((!empty($ssl)) && (!stream_socket_enable_crypto($pasvs, true, STREAM_CRYPTO_METHOD_SSLv23_SERVER))) {
+ die("SSLv23 handshake failed.\n");
+ }
+
+ if (empty($m[1]) || $m[1] !== 'emptydir') {
+ fputs($fs, "file1\r\nfile1\r\nfile\nb0rk\r\n");
+ }
+
+ fputs($s, "226 Closing data Connection.\r\n");
+ fclose($fs);
+
+ } elseif (preg_match("~^MKD ([A-Za-z./]+)\r\n$~", $buf, $m)) {
+ if (isset($bug7216)) {
+ fputs($s, "257 OK.\r\n");
+ } else {
+ if (isset($bug77680)) {
+ var_dump($buf);
+ }
+ fputs($s, "257 \"/path/to/ftproot$cwd$m[1]\" created.\r\n");
+ }
+
+ } elseif (preg_match('/^USER /', $buf)) {
+ user_auth($buf);
+
+ } elseif (preg_match('/^MDTM ([\w\h]+)/', $buf, $matches)) {
+ switch ($matches [1]){
+ case "A":
+ fputs($s, "213 19980615100045.014\r\n");
+ break;
+ case "B":
+ fputs($s, "213 19980615100045.014\r\n");
+ break;
+ case "C":
+ fputs($s, "213 19980705132316\r\n");
+ break;
+ case "19990929043300 File6":
+ fputs($s, "213 19991005213102\r\n");
+ break;
+ default :
+ fputs($s, "550 No file named \"{$matches [1]}\"\r\n");
+ break;
+ }
+ }elseif (preg_match('/^RETR ([\/]*[\w\h]+)/', $buf, $matches)) {
+ if(!empty($pasv)){
+ ;
+ }
+ else if (!$fs = stream_socket_client("tcp://$host:$port")) {
+ fputs($s, "425 Can't open data connection\r\n");
+ continue;
+ }
+
+ switch($matches[1]){
+
+ case "pasv":
+ fputs($s, "150 File status okay; about to open data connection.\r\n");
+ //the data connection is handled in another forked process
+ // called from outside this while loop
+ fputs($s, "226 Closing data Connection.\r\n");
+ break;
+ case "a story":
+ fputs($s, "150 File status okay; about to open data connection.\r\n");
+ fputs($fs, "For sale: baby shoes, never worn.\r\n");
+ fputs($s, "226 Closing data Connection.\r\n");
+ break;
+ case "binary data":
+ fputs($s, "150 File status okay; about to open data connection.\r\n");
+ $transfer_type = $ascii? 'ASCII' : 'BINARY' ;
+ fputs($fs, $transfer_type."Foo\0Bar\r\n");
+ fputs($s, "226 Closing data Connection.\r\n");
+ break;
+ case "fget":
+ fputs($s, "150 File status okay; about to open data connection.\r\n");
+ $transfer_type = $ascii? 'ASCII' : 'BINARY' ;
+ fputs($fs, $transfer_type."FooBar\r\n");
+ fputs($s, "226 Closing data Connection.\r\n");
+ break;
+ case "fgetresume":
+ fputs($s, "150 File status okay; about to open data connection.\r\n");
+ $transfer_type = $ascii? 'ASCII' : 'BINARY' ;
+ fputs($fs, "Bar\r\n");
+ fputs($s, "226 Closing data Connection.\r\n");
+ break;
+ case "fget_large":
+ fputs($s, "150 File status okay; about to open data connection.\r\n");
+ $transfer_type = $ascii? 'ASCII' : 'BINARY' ;
+ if ($GLOBALS['rest_pos'] == '5368709119') {
+ fputs($fs, "X");
+ } else {
+ fputs($fs, "Y");
+ }
+ fputs($s, "226 Closing data Connection.\r\n");
+ break;
+ case "mediumfile":
+ fputs($s, "150 File status okay; about to open data connection.\r\n");
+ for($i = 0; $i < 150; $i++){
+ fputs($fs, "This is line $i of the test data.\n");
+ }
+ fputs($s, "226 Closing data Connection.\r\n");
+ break;
+ case "/bug73457":
+ fputs($s, "150 File status okay; about to open data connection.\r\n");
+ break;
+
+ default:
+ fputs($s, "550 {$matches[1]}: No such file or directory \r\n");
+ break;
+ }
+ if(isset($fs))
+ fclose($fs);
+
+
+ }elseif (preg_match('/^PASV/', $buf, $matches)) {
+ $pasv=true;
+ $host = "127.0.0.1";
+ $i=0;
+
+ if (empty($bug73457)) {
+ do {
+ if (!empty($ssl)) {
+ $soc = @stream_socket_server("tcp://127.0.0.1:$pasv_port", $errno, $errstr, STREAM_SERVER_BIND|STREAM_SERVER_LISTEN, $context);
+ } else {
+ $soc = @stream_socket_server("tcp://127.0.0.1:$pasv_port");
+ }
+ /* Could bind port, Try another port */
+ if (!$soc) {
+ $pasv_port = rand(50000, 65535);
+ }
+ $i++;
+ } while ($i<10 && !$soc);
+
+ if (!$soc) {
+ echo "$errstr ($errno)\n";
+ die("could not bind passive port\n");
+ }
+ } else {
+ $pasv_port=1234;
+ }
+
+ $p2 = $pasv_port % ((int) 1 << 8);
+ $p1 = ($pasv_port-$p2)/((int) 1 << 8);
+ fputs($s, "227 Entering Passive Mode. (127,0,0,1,{$p1},{$p2})\r\n");
if (empty($bug73457)) {
$pasvs = stream_socket_accept($soc,10);
}
- } elseif (preg_match('/^EPSV/', $buf, $matches)) {
- fputs($s, "550 Extended passsive mode not supported.\r\n");
- } elseif (preg_match('/^SITE EXEC/', $buf, $matches)) {
- fputs($s, "200 OK\r\n");
-
- } elseif (preg_match('/^RMD/', $buf, $matches)) {
- fputs($s, "250 OK\r\n");
-
- } elseif (preg_match('/^SITE CHMOD/', $buf, $matches)) {
- fputs($s, "200 OK\r\n");
-
- } elseif (preg_match('/^DELE ([\w\h]+)/', $buf, $matches)) {
- if (isset($matches[1]) && in_array($matches[1], ['file1', "file\nb0rk"])){
- fputs($s, "250 Delete successful\r\n");
- } else {
- fputs($s, "550 No such file or directory\r\n");
- }
- } elseif (preg_match('/^ALLO (\d+)/', $buf, $matches)) {
- fputs($s, "200 " . $matches[1] . " bytes allocated\r\n");
-
- }elseif (preg_match('/^LIST www\//', $buf, $matches)) {
- fputs($s, "226 Transfer complete\r\n");
-
- }elseif (preg_match('/^LIST no_exists\//', $buf, $matches)) {
- fputs($s, "425 Error establishing connection\r\n");
-
- }elseif (preg_match('/^REST (\d+)/', $buf, $matches)) {
- $GLOBALS['rest_pos'] = $matches[1];
- fputs($s, "350 OK\r\n");
- }elseif (preg_match('/^SIZE largefile/', $buf)) {
- fputs($s, "213 5368709120\r\n");
- }elseif (preg_match('/^RNFR existing_file/', $buf, $matches)) {
- fputs($s, "350 File or directory exists, ready for destination name\r\n");
- }elseif (preg_match('/^RNFR nonexisting_file/', $buf, $matches)) {
- fputs($s, "550 No such file or directory\r\n");
- }elseif (preg_match('/^RNTO nonexisting_file/', $buf, $matches)) {
- fputs($s, "250 Rename successful\r\n");
- }elseif (preg_match('/^MLSD no_exists\//', $buf, $matches)) {
- fputs($s, "425 Error establishing connection\r\n");
- }elseif (preg_match("~^MLSD(?: ([A-Za-z./]+))?\r\n$~", $buf, $m)) {
-
- if(isset($m[1]) && (($m[1] === 'bogusdir') || ($m[1] === '/bogusdir'))) {
- fputs($s, "250 $m[1]: No such file or directory\r\n");
- continue;
- }
-
- // there are some servers that don't open the ftp-data socket if there's nothing to send
- if(isset($bug39458) && isset($m[1]) && $m[1] === 'emptydir') {
- fputs($s, "226 Transfer complete.\r\n");
- continue;
- }
-
- if(empty($pasv)) {
- fputs($s, "150 File status okay; about to open data connection\r\n");
- if(!$fs = stream_socket_client("tcp://$host:$port")) {
- fputs($s, "425 Can't open data connection\r\n");
- continue;
- }
- } else {
- fputs($s, "125 Data connection already open; transfer starting.\r\n");
- $fs = $pasvs;
- }
-
- if((!empty($ssl)) && (!stream_socket_enable_crypto($pasvs, TRUE, STREAM_CRYPTO_METHOD_SSLv23_SERVER))) {
- die("SSLv23 handshake failed.\n");
- }
-
- if(empty($m[1]) || $m[1] !== 'emptydir') {
- fputs($fs, "modify=20170127230002;perm=flcdmpe;type=cdir;unique=811U4340002;UNIX.group=33;UNIX.mode=0755;UNIX.owner=33; .\r\n");
- fputs($fs, "modify=20170127230002;perm=flcdmpe;type=pdir;unique=811U4340002;UNIX.group=33;UNIX.mode=0755;UNIX.owner=33; ..\r\n");
- fputs($fs, "modify=20170126121225;perm=adfrw;size=4729;type=file;unique=811U4340CB9;UNIX.group=33;UNIX.mode=0644;UNIX.owner=33; foobar\r\n");
- fputs($fs, "fact=val=ue;empty=; path;name\r\n");
- fputs($fs, "no_space\r\n");
- fputs($fs, "no_semi pathname\r\n");
- fputs($fs, "no_eq; pathname\r\n");
- }
-
- fputs($s, "226 Closing data Connection.\r\n");
- fclose($fs);
- }elseif (preg_match('/^SIZE \/bug73457/', $buf)) {
- fputs($s, "213 10\r\n");
- }elseif (preg_match("/^SITE/", $buf)) {
- fputs($s, "500 Syntax error, command unrecognized.\r\n");
- }else {
- dump_and_exit($buf);
- }
- }
- fclose($s);
- exit;
+ } elseif (preg_match('/^EPSV/', $buf, $matches)) {
+ fputs($s, "550 Extended passsive mode not supported.\r\n");
+ } elseif (preg_match('/^SITE EXEC/', $buf, $matches)) {
+ fputs($s, "200 OK\r\n");
+
+ } elseif (preg_match('/^RMD/', $buf, $matches)) {
+ fputs($s, "250 OK\r\n");
+
+ } elseif (preg_match('/^SITE CHMOD/', $buf, $matches)) {
+ fputs($s, "200 OK\r\n");
+
+ } elseif (preg_match('/^DELE ([\w\h]+)/', $buf, $matches)) {
+ if (isset($matches[1]) && in_array($matches[1], ['file1', "file\nb0rk"])){
+ fputs($s, "250 Delete successful\r\n");
+ } else {
+ fputs($s, "550 No such file or directory\r\n");
+ }
+ } elseif (preg_match('/^ALLO (\d+)/', $buf, $matches)) {
+ fputs($s, "200 " . $matches[1] . " bytes allocated\r\n");
+
+ }elseif (preg_match('/^LIST www\//', $buf, $matches)) {
+ fputs($s, "226 Transfer complete\r\n");
+
+ }elseif (preg_match('/^LIST no_exists\//', $buf, $matches)) {
+ fputs($s, "425 Error establishing connection\r\n");
+
+ }elseif (preg_match('/^REST (\d+)/', $buf, $matches)) {
+ $GLOBALS['rest_pos'] = $matches[1];
+ fputs($s, "350 OK\r\n");
+ }elseif (preg_match('/^SIZE largefile/', $buf)) {
+ fputs($s, "213 5368709120\r\n");
+ }elseif (preg_match('/^RNFR existing_file/', $buf, $matches)) {
+ fputs($s, "350 File or directory exists, ready for destination name\r\n");
+ }elseif (preg_match('/^RNFR nonexisting_file/', $buf, $matches)) {
+ fputs($s, "550 No such file or directory\r\n");
+ }elseif (preg_match('/^RNTO nonexisting_file/', $buf, $matches)) {
+ fputs($s, "250 Rename successful\r\n");
+ }elseif (preg_match('/^MLSD no_exists\//', $buf, $matches)) {
+ fputs($s, "425 Error establishing connection\r\n");
+ }elseif (preg_match("~^MLSD(?: ([A-Za-z./]+))?\r\n$~", $buf, $m)) {
+
+ if(isset($m[1]) && (($m[1] === 'bogusdir') || ($m[1] === '/bogusdir'))) {
+ fputs($s, "250 $m[1]: No such file or directory\r\n");
+ continue;
+ }
+
+ // there are some servers that don't open the ftp-data socket if there's nothing to send
+ if(isset($bug39458) && isset($m[1]) && $m[1] === 'emptydir') {
+ fputs($s, "226 Transfer complete.\r\n");
+ continue;
+ }
+
+ if(empty($pasv)) {
+ fputs($s, "150 File status okay; about to open data connection\r\n");
+ if(!$fs = stream_socket_client("tcp://$host:$port")) {
+ fputs($s, "425 Can't open data connection\r\n");
+ continue;
+ }
+ } else {
+ fputs($s, "125 Data connection already open; transfer starting.\r\n");
+ $fs = $pasvs;
+ }
+
+ if((!empty($ssl)) && (!stream_socket_enable_crypto($pasvs, TRUE, STREAM_CRYPTO_METHOD_SSLv23_SERVER))) {
+ die("SSLv23 handshake failed.\n");
+ }
+
+ if(empty($m[1]) || $m[1] !== 'emptydir') {
+ fputs($fs, "modify=20170127230002;perm=flcdmpe;type=cdir;unique=811U4340002;UNIX.group=33;UNIX.mode=0755;UNIX.owner=33; .\r\n");
+ fputs($fs, "modify=20170127230002;perm=flcdmpe;type=pdir;unique=811U4340002;UNIX.group=33;UNIX.mode=0755;UNIX.owner=33; ..\r\n");
+ fputs($fs, "modify=20170126121225;perm=adfrw;size=4729;type=file;unique=811U4340CB9;UNIX.group=33;UNIX.mode=0644;UNIX.owner=33; foobar\r\n");
+ fputs($fs, "fact=val=ue;empty=; path;name\r\n");
+ fputs($fs, "no_space\r\n");
+ fputs($fs, "no_semi pathname\r\n");
+ fputs($fs, "no_eq; pathname\r\n");
+ }
+
+ fputs($s, "226 Closing data Connection.\r\n");
+ fclose($fs);
+ }elseif (preg_match('/^SIZE \/bug73457/', $buf)) {
+ fputs($s, "213 10\r\n");
+ }elseif (preg_match("/^SITE/", $buf)) {
+ fputs($s, "500 Syntax error, command unrecognized.\r\n");
+ }else {
+ dump_and_exit($buf);
+ }
+ }
+ fclose($s);
+ exit;
}
fclose($socket);
diff --git a/ext/gd/CREDITS b/ext/gd/CREDITS
index 2393a9f8fc..b9ca3bdaac 100644
--- a/ext/gd/CREDITS
+++ b/ext/gd/CREDITS
@@ -1,2 +1,2 @@
GD imaging
-Rasmus Lerdorf, Stig Bakken, Jim Winstead, Jouni Ahto, Ilia Alshanetsky, Pierre-Alain Joye, Marcus Boerger
+Rasmus Lerdorf, Stig Bakken, Jim Winstead, Jouni Ahto, Ilia Alshanetsky, Pierre-Alain Joye, Marcus Boerger, Mark Randall
diff --git a/ext/gd/config.m4 b/ext/gd/config.m4
index 194687208d..2839077037 100644
--- a/ext/gd/config.m4
+++ b/ext/gd/config.m4
@@ -120,14 +120,15 @@ AC_DEFUN([PHP_GD_JISX0208],[
])
AC_DEFUN([PHP_GD_CHECK_VERSION],[
- PHP_CHECK_LIBRARY(gd, gdImageCreateFromPng, [AC_DEFINE(HAVE_GD_PNG, 1, [ ])], [], [ $GD_SHARED_LIBADD ])
- PHP_CHECK_LIBRARY(gd, gdImageCreateFromWebp, [AC_DEFINE(HAVE_GD_WEBP, 1, [ ])], [], [ $GD_SHARED_LIBADD ])
- PHP_CHECK_LIBRARY(gd, gdImageCreateFromJpeg, [AC_DEFINE(HAVE_GD_JPG, 1, [ ])], [], [ $GD_SHARED_LIBADD ])
- PHP_CHECK_LIBRARY(gd, gdImageCreateFromXpm, [AC_DEFINE(HAVE_GD_XPM, 1, [ ])], [], [ $GD_SHARED_LIBADD ])
- PHP_CHECK_LIBRARY(gd, gdImageCreateFromBmp, [AC_DEFINE(HAVE_GD_BMP, 1, [ ])], [], [ $GD_SHARED_LIBADD ])
- PHP_CHECK_LIBRARY(gd, gdImageCreateFromTga, [AC_DEFINE(HAVE_GD_TGA, 1, [ ])], [], [ $GD_SHARED_LIBADD ])
- PHP_CHECK_LIBRARY(gd, gdImageStringFT, [AC_DEFINE(HAVE_GD_FREETYPE, 1, [ ])], [], [ $GD_SHARED_LIBADD ])
- PHP_CHECK_LIBRARY(gd, gdVersionString, [AC_DEFINE(HAVE_GD_LIBVERSION, 1, [ ])], [], [ $GD_SHARED_LIBADD ])
+ PHP_CHECK_LIBRARY(gd, gdImageCreateFromPng, [AC_DEFINE(HAVE_GD_PNG, 1, [ ])], [], [ $GD_SHARED_LIBADD ])
+ PHP_CHECK_LIBRARY(gd, gdImageCreateFromWebp, [AC_DEFINE(HAVE_GD_WEBP, 1, [ ])], [], [ $GD_SHARED_LIBADD ])
+ PHP_CHECK_LIBRARY(gd, gdImageCreateFromJpeg, [AC_DEFINE(HAVE_GD_JPG, 1, [ ])], [], [ $GD_SHARED_LIBADD ])
+ PHP_CHECK_LIBRARY(gd, gdImageCreateFromXpm, [AC_DEFINE(HAVE_GD_XPM, 1, [ ])], [], [ $GD_SHARED_LIBADD ])
+ PHP_CHECK_LIBRARY(gd, gdImageCreateFromBmp, [AC_DEFINE(HAVE_GD_BMP, 1, [ ])], [], [ $GD_SHARED_LIBADD ])
+ PHP_CHECK_LIBRARY(gd, gdImageCreateFromTga, [AC_DEFINE(HAVE_GD_TGA, 1, [ ])], [], [ $GD_SHARED_LIBADD ])
+ PHP_CHECK_LIBRARY(gd, gdImageStringFT, [AC_DEFINE(HAVE_GD_FREETYPE, 1, [ ])], [], [ $GD_SHARED_LIBADD ])
+ PHP_CHECK_LIBRARY(gd, gdVersionString, [AC_DEFINE(HAVE_GD_LIBVERSION, 1, [ ])], [], [ $GD_SHARED_LIBADD ])
+ PHP_CHECK_LIBRARY(gd, gdImageGetInterpolationMethod, [AC_DEFINE(HAVE_GD_GET_INTERPOLATION, 1, [ ])], [], [ $GD_SHARED_LIBADD ])
])
dnl
diff --git a/ext/gd/config.w32 b/ext/gd/config.w32
index 6695976d0e..8fe44def2b 100644
--- a/ext/gd/config.w32
+++ b/ext/gd/config.w32
@@ -72,6 +72,7 @@ if (PHP_GD != "no") {
/D HAVE_LIBPNG \
/D HAVE_XPM \
/D HAVE_COLORCLOSESTHWB \
+/D HAVE_GD_GET_INTERPOLATION \
/D USE_GD_IOCTX \
/D MSWIN32 \
");
diff --git a/ext/gd/gd.c b/ext/gd/gd.c
index 3480699a70..1775ae4627 100644
--- a/ext/gd/gd.c
+++ b/ext/gd/gd.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -35,7 +33,8 @@
#include "php_gd.h"
#include "ext/standard/info.h"
#include "php_open_temporary_file.h"
-
+#include "zend_object_handlers.h"
+#include "zend_interfaces.h"
#ifdef HAVE_SYS_WAIT_H
# include <sys/wait.h>
@@ -55,10 +54,10 @@
# include <X11/xpm.h>
#endif
-# include "gd_compat.h"
+#include "gd_compat.h"
-static int le_gd, le_gd_font;
+static int le_gd_font;
#include <gd.h>
#include <gd_errors.h>
@@ -85,7 +84,7 @@ static int le_gd, le_gd_font;
static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int, int);
#endif
-#include "gd_ctx.c"
+#include "gd_arginfo.h"
/* as it is not really public, duplicate declaration here to avoid
pointless warnings */
@@ -128,739 +127,116 @@ static void php_image_filter_pixelate(INTERNAL_FUNCTION_PARAMETERS);
static void php_image_filter_scatter(INTERNAL_FUNCTION_PARAMETERS);
/* End Section filters declarations */
-static gdImagePtr _php_image_create_from_string (zval *Data, char *tn, gdImagePtr (*ioctx_func_p)());
+static gdImagePtr _php_image_create_from_string(zend_string *Data, char *tn, gdImagePtr (*ioctx_func_p)());
static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, gdImagePtr (*func_p)(), gdImagePtr (*ioctx_func_p)());
static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, void (*func_p)());
static int _php_image_type(char data[12]);
-static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type);
-
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO(arginfo_gd_info, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imageloadfont, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagesetstyle, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, styles) /* ARRAY_INFO(0, styles, 0) */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecreatetruecolor, 0)
- ZEND_ARG_INFO(0, x_size)
- ZEND_ARG_INFO(0, y_size)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imageistruecolor, 0)
- ZEND_ARG_INFO(0, im)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagetruecolortopalette, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, ditherFlag)
- ZEND_ARG_INFO(0, colorsWanted)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagepalettetotruecolor, 0)
- ZEND_ARG_INFO(0, im)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecolormatch, 0)
- ZEND_ARG_INFO(0, im1)
- ZEND_ARG_INFO(0, im2)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagesetthickness, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, thickness)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagefilledellipse, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, cx)
- ZEND_ARG_INFO(0, cy)
- ZEND_ARG_INFO(0, w)
- ZEND_ARG_INFO(0, h)
- ZEND_ARG_INFO(0, color)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagefilledarc, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, cx)
- ZEND_ARG_INFO(0, cy)
- ZEND_ARG_INFO(0, w)
- ZEND_ARG_INFO(0, h)
- ZEND_ARG_INFO(0, s)
- ZEND_ARG_INFO(0, e)
- ZEND_ARG_INFO(0, col)
- ZEND_ARG_INFO(0, style)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagealphablending, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, blend)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagesavealpha, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, save)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagelayereffect, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, effect)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecolorallocatealpha, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, red)
- ZEND_ARG_INFO(0, green)
- ZEND_ARG_INFO(0, blue)
- ZEND_ARG_INFO(0, alpha)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecolorresolvealpha, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, red)
- ZEND_ARG_INFO(0, green)
- ZEND_ARG_INFO(0, blue)
- ZEND_ARG_INFO(0, alpha)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecolorclosestalpha, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, red)
- ZEND_ARG_INFO(0, green)
- ZEND_ARG_INFO(0, blue)
- ZEND_ARG_INFO(0, alpha)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecolorexactalpha, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, red)
- ZEND_ARG_INFO(0, green)
- ZEND_ARG_INFO(0, blue)
- ZEND_ARG_INFO(0, alpha)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecopyresampled, 0)
- ZEND_ARG_INFO(0, dst_im)
- ZEND_ARG_INFO(0, src_im)
- ZEND_ARG_INFO(0, dst_x)
- ZEND_ARG_INFO(0, dst_y)
- ZEND_ARG_INFO(0, src_x)
- ZEND_ARG_INFO(0, src_y)
- ZEND_ARG_INFO(0, dst_w)
- ZEND_ARG_INFO(0, dst_h)
- ZEND_ARG_INFO(0, src_w)
- ZEND_ARG_INFO(0, src_h)
-ZEND_END_ARG_INFO()
-
-#ifdef PHP_WIN32
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imagegrabwindow, 0, 0, 1)
- ZEND_ARG_INFO(0, handle)
- ZEND_ARG_INFO(0, client_area)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagegrabscreen, 0)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imagerotate, 0, 0, 3)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, angle)
- ZEND_ARG_INFO(0, bgdcolor)
- ZEND_ARG_INFO(0, ignoretransparent)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagesettile, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, tile)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagesetbrush, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, brush)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecreate, 0)
- ZEND_ARG_INFO(0, x_size)
- ZEND_ARG_INFO(0, y_size)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagetypes, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecreatefromstring, 0)
- ZEND_ARG_INFO(0, image)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecreatefromgif, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_GD_JPG
-ZEND_BEGIN_ARG_INFO(arginfo_imagecreatefromjpeg, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-#endif
-
-#ifdef HAVE_GD_PNG
-ZEND_BEGIN_ARG_INFO(arginfo_imagecreatefrompng, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-#endif
-#ifdef HAVE_GD_WEBP
-ZEND_BEGIN_ARG_INFO(arginfo_imagecreatefromwebp, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecreatefromxbm, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-#if defined(HAVE_GD_XPM)
-ZEND_BEGIN_ARG_INFO(arginfo_imagecreatefromxpm, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-#endif
+/* output streaming (formerly gd_ctx.c) */
+static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, void (*func_p)());
-ZEND_BEGIN_ARG_INFO(arginfo_imagecreatefromwbmp, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
+/*********************************************************
+ *
+ * GD Object Representation
+ *
+ ********************************************************/
-ZEND_BEGIN_ARG_INFO(arginfo_imagecreatefromgd, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
+zend_class_entry *gd_image_ce;
-ZEND_BEGIN_ARG_INFO(arginfo_imagecreatefromgd2, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
+typedef struct _gd_ext_image_object {
+ gdImagePtr image;
+ zend_object std;
+} php_gd_image_object;
-ZEND_BEGIN_ARG_INFO(arginfo_imagecreatefromgd2part, 0)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, srcX)
- ZEND_ARG_INFO(0, srcY)
- ZEND_ARG_INFO(0, width)
- ZEND_ARG_INFO(0, height)
-ZEND_END_ARG_INFO()
+static zend_object_handlers php_gd_image_object_handlers;
-#if defined(HAVE_GD_BMP)
-ZEND_BEGIN_ARG_INFO(arginfo_imagecreatefrombmp, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-#endif
-
-#if defined(HAVE_GD_TGA)
-ZEND_BEGIN_ARG_INFO(arginfo_imagecreatefromtga, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-#endif
+static const zend_function_entry gd_image_object_methods[] = {
+ PHP_FE_END
+};
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imagexbm, 0, 0, 2)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, foreground)
-ZEND_END_ARG_INFO()
+static zend_function *php_gd_image_object_get_constructor(zend_object *object)
+{
+ zend_throw_error(NULL, "You cannot initialize a GdImage object except through helper functions");
+ return NULL;
+}
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imagegif, 0, 0, 1)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, to)
-ZEND_END_ARG_INFO()
+/**
+ * Returns the underlying php_gd_image_object from a zend_object
+ */
-#ifdef HAVE_GD_PNG
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imagepng, 0, 0, 1)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, to)
- ZEND_ARG_INFO(0, quality)
- ZEND_ARG_INFO(0, filters)
-ZEND_END_ARG_INFO()
-#endif
+static zend_always_inline php_gd_image_object* php_gd_exgdimage_from_zobj_p(zend_object* obj)
+{
+ return (php_gd_image_object *) ((char *) (obj) - XtOffsetOf(php_gd_image_object, std));
+}
-#ifdef HAVE_GD_WEBP
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imagewebp, 0, 0, 1)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, to)
- ZEND_ARG_INFO(0, quality)
-ZEND_END_ARG_INFO()
-#endif
+/**
+ * Converts an extension GdImage instance contained within a zval into the gdImagePtr
+ * for use with library APIs
+ */
+static zend_always_inline gdImagePtr php_gd_libgdimageptr_from_zval_p(zval* zp)
+{
+ return php_gd_exgdimage_from_zobj_p(Z_OBJ_P(zp))->image;
+}
-#ifdef HAVE_GD_JPG
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imagejpeg, 0, 0, 1)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, to)
- ZEND_ARG_INFO(0, quality)
-ZEND_END_ARG_INFO()
-#endif
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imagewbmp, 0, 0, 1)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, to)
- ZEND_ARG_INFO(0, foreground)
-ZEND_END_ARG_INFO()
+zend_object *php_gd_image_object_create(zend_class_entry *class_type)
+{
+ size_t block_len = sizeof(php_gd_image_object) + zend_object_properties_size(class_type);
+ php_gd_image_object *intern = emalloc(block_len);
+ memset(intern, 0, block_len);
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imagegd, 0, 0, 1)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, to)
-ZEND_END_ARG_INFO()
+ zend_object_std_init(&intern->std, class_type);
+ object_properties_init(&intern->std, class_type);
+ intern->std.handlers = &php_gd_image_object_handlers;
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imagegd2, 0, 0, 1)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, to)
- ZEND_ARG_INFO(0, chunk_size)
- ZEND_ARG_INFO(0, type)
-ZEND_END_ARG_INFO()
+ return &intern->std;
+};
-#if defined(HAVE_GD_BMP)
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imagebmp, 0, 0, 1)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, to)
- ZEND_ARG_INFO(0, compressed)
-ZEND_END_ARG_INFO()
-#endif
+static void php_gd_image_object_free(zend_object *intern)
+{
+ php_gd_image_object *img_obj_ptr = php_gd_exgdimage_from_zobj_p(intern);
+ gdImageDestroy(img_obj_ptr->image);
+ img_obj_ptr->image = NULL;
-ZEND_BEGIN_ARG_INFO(arginfo_imagedestroy, 0)
- ZEND_ARG_INFO(0, im)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecolorallocate, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, red)
- ZEND_ARG_INFO(0, green)
- ZEND_ARG_INFO(0, blue)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagepalettecopy, 0)
- ZEND_ARG_INFO(0, dst)
- ZEND_ARG_INFO(0, src)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecolorat, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, x)
- ZEND_ARG_INFO(0, y)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecolorclosest, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, red)
- ZEND_ARG_INFO(0, green)
- ZEND_ARG_INFO(0, blue)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecolorclosesthwb, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, red)
- ZEND_ARG_INFO(0, green)
- ZEND_ARG_INFO(0, blue)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecolordeallocate, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, index)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecolorresolve, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, red)
- ZEND_ARG_INFO(0, green)
- ZEND_ARG_INFO(0, blue)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecolorexact, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, red)
- ZEND_ARG_INFO(0, green)
- ZEND_ARG_INFO(0, blue)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imagecolorset, 0, 0, 5)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, color)
- ZEND_ARG_INFO(0, red)
- ZEND_ARG_INFO(0, green)
- ZEND_ARG_INFO(0, blue)
- ZEND_ARG_INFO(0, alpha)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecolorsforindex, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, index)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagegammacorrect, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, inputgamma)
- ZEND_ARG_INFO(0, outputgamma)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagesetpixel, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, x)
- ZEND_ARG_INFO(0, y)
- ZEND_ARG_INFO(0, col)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imageline, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, x1)
- ZEND_ARG_INFO(0, y1)
- ZEND_ARG_INFO(0, x2)
- ZEND_ARG_INFO(0, y2)
- ZEND_ARG_INFO(0, col)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagedashedline, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, x1)
- ZEND_ARG_INFO(0, y1)
- ZEND_ARG_INFO(0, x2)
- ZEND_ARG_INFO(0, y2)
- ZEND_ARG_INFO(0, col)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagerectangle, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, x1)
- ZEND_ARG_INFO(0, y1)
- ZEND_ARG_INFO(0, x2)
- ZEND_ARG_INFO(0, y2)
- ZEND_ARG_INFO(0, col)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagefilledrectangle, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, x1)
- ZEND_ARG_INFO(0, y1)
- ZEND_ARG_INFO(0, x2)
- ZEND_ARG_INFO(0, y2)
- ZEND_ARG_INFO(0, col)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagearc, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, cx)
- ZEND_ARG_INFO(0, cy)
- ZEND_ARG_INFO(0, w)
- ZEND_ARG_INFO(0, h)
- ZEND_ARG_INFO(0, s)
- ZEND_ARG_INFO(0, e)
- ZEND_ARG_INFO(0, col)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imageellipse, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, cx)
- ZEND_ARG_INFO(0, cy)
- ZEND_ARG_INFO(0, w)
- ZEND_ARG_INFO(0, h)
- ZEND_ARG_INFO(0, color)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagefilltoborder, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, x)
- ZEND_ARG_INFO(0, y)
- ZEND_ARG_INFO(0, border)
- ZEND_ARG_INFO(0, col)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagefill, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, x)
- ZEND_ARG_INFO(0, y)
- ZEND_ARG_INFO(0, col)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecolorstotal, 0)
- ZEND_ARG_INFO(0, im)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imagecolortransparent, 0, 0, 1)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, col)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imageinterlace, 0, 0, 1)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, interlace)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagepolygon, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, points) /* ARRAY_INFO(0, points, 0) */
- ZEND_ARG_INFO(0, num_pos)
- ZEND_ARG_INFO(0, col)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imageopenpolygon, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, points) /* ARRAY_INFO(0, points, 0) */
- ZEND_ARG_INFO(0, num_pos)
- ZEND_ARG_INFO(0, col)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagefilledpolygon, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, points) /* ARRAY_INFO(0, points, 0) */
- ZEND_ARG_INFO(0, num_pos)
- ZEND_ARG_INFO(0, col)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagefontwidth, 0)
- ZEND_ARG_INFO(0, font)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagefontheight, 0)
- ZEND_ARG_INFO(0, font)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagechar, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, font)
- ZEND_ARG_INFO(0, x)
- ZEND_ARG_INFO(0, y)
- ZEND_ARG_INFO(0, c)
- ZEND_ARG_INFO(0, col)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecharup, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, font)
- ZEND_ARG_INFO(0, x)
- ZEND_ARG_INFO(0, y)
- ZEND_ARG_INFO(0, c)
- ZEND_ARG_INFO(0, col)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagestring, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, font)
- ZEND_ARG_INFO(0, x)
- ZEND_ARG_INFO(0, y)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, col)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagestringup, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, font)
- ZEND_ARG_INFO(0, x)
- ZEND_ARG_INFO(0, y)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, col)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecopy, 0)
- ZEND_ARG_INFO(0, dst_im)
- ZEND_ARG_INFO(0, src_im)
- ZEND_ARG_INFO(0, dst_x)
- ZEND_ARG_INFO(0, dst_y)
- ZEND_ARG_INFO(0, src_x)
- ZEND_ARG_INFO(0, src_y)
- ZEND_ARG_INFO(0, src_w)
- ZEND_ARG_INFO(0, src_h)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecopymerge, 0)
- ZEND_ARG_INFO(0, dst_im)
- ZEND_ARG_INFO(0, src_im)
- ZEND_ARG_INFO(0, dst_x)
- ZEND_ARG_INFO(0, dst_y)
- ZEND_ARG_INFO(0, src_x)
- ZEND_ARG_INFO(0, src_y)
- ZEND_ARG_INFO(0, src_w)
- ZEND_ARG_INFO(0, src_h)
- ZEND_ARG_INFO(0, pct)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecopymergegray, 0)
- ZEND_ARG_INFO(0, dst_im)
- ZEND_ARG_INFO(0, src_im)
- ZEND_ARG_INFO(0, dst_x)
- ZEND_ARG_INFO(0, dst_y)
- ZEND_ARG_INFO(0, src_x)
- ZEND_ARG_INFO(0, src_y)
- ZEND_ARG_INFO(0, src_w)
- ZEND_ARG_INFO(0, src_h)
- ZEND_ARG_INFO(0, pct)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecopyresized, 0)
- ZEND_ARG_INFO(0, dst_im)
- ZEND_ARG_INFO(0, src_im)
- ZEND_ARG_INFO(0, dst_x)
- ZEND_ARG_INFO(0, dst_y)
- ZEND_ARG_INFO(0, src_x)
- ZEND_ARG_INFO(0, src_y)
- ZEND_ARG_INFO(0, dst_w)
- ZEND_ARG_INFO(0, dst_h)
- ZEND_ARG_INFO(0, src_w)
- ZEND_ARG_INFO(0, src_h)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagesx, 0)
- ZEND_ARG_INFO(0, im)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagesy, 0)
- ZEND_ARG_INFO(0, im)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagesetclip, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, x1)
- ZEND_ARG_INFO(0, y1)
- ZEND_ARG_INFO(0, x2)
- ZEND_ARG_INFO(0, y2)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagegetclip, 0)
- ZEND_ARG_INFO(0, im)
-ZEND_END_ARG_INFO()
+ zend_object_std_dtor(intern);
+};
-#ifdef HAVE_GD_FREETYPE
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imageftbbox, 0, 0, 4)
- ZEND_ARG_INFO(0, size)
- ZEND_ARG_INFO(0, angle)
- ZEND_ARG_INFO(0, font_file)
- ZEND_ARG_INFO(0, text)
- ZEND_ARG_INFO(0, extrainfo) /* ARRAY_INFO(0, extrainfo, 0) */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imagefttext, 0, 0, 8)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, size)
- ZEND_ARG_INFO(0, angle)
- ZEND_ARG_INFO(0, x)
- ZEND_ARG_INFO(0, y)
- ZEND_ARG_INFO(0, col)
- ZEND_ARG_INFO(0, font_file)
- ZEND_ARG_INFO(0, text)
- ZEND_ARG_INFO(0, extrainfo) /* ARRAY_INFO(0, extrainfo, 0) */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagettfbbox, 0)
- ZEND_ARG_INFO(0, size)
- ZEND_ARG_INFO(0, angle)
- ZEND_ARG_INFO(0, font_file)
- ZEND_ARG_INFO(0, text)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagettftext, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, size)
- ZEND_ARG_INFO(0, angle)
- ZEND_ARG_INFO(0, x)
- ZEND_ARG_INFO(0, y)
- ZEND_ARG_INFO(0, col)
- ZEND_ARG_INFO(0, font_file)
- ZEND_ARG_INFO(0, text)
-ZEND_END_ARG_INFO()
-#endif
+/**
+ * Creates a new GdImage object wrapping the gdImagePtr and attaches it
+ * to the zval (usually return_value).
+ *
+ * This function must only be called once per valid gdImagePtr
+ */
+void php_gd_assign_libgdimageptr_as_extgdimage(zval *val, gdImagePtr image)
+{
+ object_init_ex(val, gd_image_ce);
+ php_gd_exgdimage_from_zobj_p(Z_OBJ_P(val))->image = image;
+}
-ZEND_BEGIN_ARG_INFO_EX(arginfo_image2wbmp, 0, 0, 1)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, foreground)
-ZEND_END_ARG_INFO()
-
-#if defined(HAVE_GD_JPG)
-ZEND_BEGIN_ARG_INFO(arginfo_jpeg2wbmp, 0)
- ZEND_ARG_INFO(0, f_org)
- ZEND_ARG_INFO(0, f_dest)
- ZEND_ARG_INFO(0, d_height)
- ZEND_ARG_INFO(0, d_width)
- ZEND_ARG_INFO(0, d_threshold)
-ZEND_END_ARG_INFO()
-#endif
+static void php_gd_object_minit_helper()
+{
+ zend_class_entry ce;
+ INIT_CLASS_ENTRY(ce, "GdImage", gd_image_object_methods);
+ gd_image_ce = zend_register_internal_class(&ce);
+ gd_image_ce->ce_flags |= ZEND_ACC_FINAL;
+ gd_image_ce->create_object = php_gd_image_object_create;
+ gd_image_ce->serialize = zend_class_serialize_deny;
+ gd_image_ce->unserialize = zend_class_unserialize_deny;
-#if defined(HAVE_GD_PNG)
-ZEND_BEGIN_ARG_INFO(arginfo_png2wbmp, 0)
- ZEND_ARG_INFO(0, f_org)
- ZEND_ARG_INFO(0, f_dest)
- ZEND_ARG_INFO(0, d_height)
- ZEND_ARG_INFO(0, d_width)
- ZEND_ARG_INFO(0, d_threshold)
-ZEND_END_ARG_INFO()
-#endif
+ /* setting up the object handlers for the GdImage class */
+ memcpy(&php_gd_image_object_handlers, &std_object_handlers, sizeof(zend_object_handlers));
+ php_gd_image_object_handlers.clone_obj = NULL;
+ php_gd_image_object_handlers.free_obj = php_gd_image_object_free;
+ php_gd_image_object_handlers.get_constructor = php_gd_image_object_get_constructor;
+ php_gd_image_object_handlers.offset = XtOffsetOf(php_gd_image_object, std);
+}
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imagefilter, 0, 0, 2)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, filtertype)
- ZEND_ARG_INFO(0, arg1)
- ZEND_ARG_INFO(0, arg2)
- ZEND_ARG_INFO(0, arg3)
- ZEND_ARG_INFO(0, arg4)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imageconvolution, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, matrix3x3) /* ARRAY_INFO(0, matrix3x3, 0) */
- ZEND_ARG_INFO(0, div)
- ZEND_ARG_INFO(0, offset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imageflip, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, mode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imageantialias, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, on)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imagecrop, 0)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, rect)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imagecropauto, 0, 0, 1)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, mode)
- ZEND_ARG_INFO(0, threshold)
- ZEND_ARG_INFO(0, color)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imagescale, 0, 0, 2)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, new_width)
- ZEND_ARG_INFO(0, new_height)
- ZEND_ARG_INFO(0, mode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imageaffine, 0, 0, 2)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, affine)
- ZEND_ARG_INFO(0, clip)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imageaffinematrixget, 0, 0, 1)
- ZEND_ARG_INFO(0, type)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imageaffinematrixconcat, 0)
- ZEND_ARG_INFO(0, m1)
- ZEND_ARG_INFO(0, m2)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imagesetinterpolation, 0, 0, 1)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, method)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imageresolution, 0, 0, 1)
- ZEND_ARG_INFO(0, im)
- ZEND_ARG_INFO(0, res_x)
- ZEND_ARG_INFO(0, res_y)
-ZEND_END_ARG_INFO()
-/* }}} */
+/*********************************************************
+ *
+ * Extension Implementation
+ *
+ ********************************************************/
/* {{{ gd_functions[]
*/
@@ -908,7 +284,7 @@ static const zend_function_entry gd_functions[] = {
PHP_FE(imagegrabscreen, arginfo_imagegrabscreen)
#endif
- PHP_FE(imagerotate, arginfo_imagerotate)
+ PHP_FE(imagerotate, arginfo_imagerotate)
PHP_FE(imageflip, arginfo_imageflip)
PHP_FE(imageantialias, arginfo_imageantialias)
@@ -918,7 +294,8 @@ static const zend_function_entry gd_functions[] = {
PHP_FE(imageaffine, arginfo_imageaffine)
PHP_FE(imageaffinematrixconcat, arginfo_imageaffinematrixconcat)
PHP_FE(imageaffinematrixget, arginfo_imageaffinematrixget)
- PHP_FE(imagesetinterpolation, arginfo_imagesetinterpolation)
+ PHP_FE(imagegetinterpolation, arginfo_imagegetinterpolation)
+ PHP_FE(imagesetinterpolation, arginfo_imagesetinterpolation)
PHP_FE(imagesettile, arginfo_imagesettile)
PHP_FE(imagesetbrush, arginfo_imagesetbrush)
PHP_FE(imagesetstyle, arginfo_imagesetstyle)
@@ -957,7 +334,7 @@ static const zend_function_entry gd_functions[] = {
#ifdef HAVE_GD_JPG
PHP_FE(imagejpeg, arginfo_imagejpeg)
#endif
- PHP_FE(imagewbmp, arginfo_imagewbmp)
+ PHP_FE(imagewbmp, arginfo_imagewbmp)
PHP_FE(imagegd, arginfo_imagegd)
PHP_FE(imagegd2, arginfo_imagegd2)
#ifdef HAVE_GD_BMP
@@ -996,20 +373,13 @@ static const zend_function_entry gd_functions[] = {
PHP_FE(imagetypes, arginfo_imagetypes)
-#if defined(HAVE_GD_JPG)
- PHP_DEP_FE(jpeg2wbmp, arginfo_jpeg2wbmp)
-#endif
-#if defined(HAVE_GD_PNG)
- PHP_DEP_FE(png2wbmp, arginfo_png2wbmp)
-#endif
- PHP_DEP_FE(image2wbmp, arginfo_image2wbmp)
PHP_FE(imagelayereffect, arginfo_imagelayereffect)
- PHP_FE(imagexbm, arginfo_imagexbm)
+ PHP_FE(imagexbm, arginfo_imagexbm)
PHP_FE(imagecolormatch, arginfo_imagecolormatch)
/* gd filters */
- PHP_FE(imagefilter, arginfo_imagefilter)
+ PHP_FE(imagefilter, arginfo_imagefilter)
PHP_FE(imageconvolution, arginfo_imageconvolution)
PHP_FE(imageresolution, arginfo_imageresolution)
@@ -1041,14 +411,6 @@ PHP_INI_BEGIN()
PHP_INI_END()
/* }}} */
-/* {{{ php_free_gd_image
- */
-static void php_free_gd_image(zend_resource *rsrc)
-{
- gdImageDestroy((gdImagePtr) rsrc->ptr);
-}
-/* }}} */
-
/* {{{ php_free_gd_font
*/
static void php_free_gd_font(zend_resource *rsrc)
@@ -1067,7 +429,6 @@ static void php_free_gd_font(zend_resource *rsrc)
*/
void php_gd_error_method(int type, const char *format, va_list args)
{
-
switch (type) {
#ifndef PHP_WIN32
case GD_DEBUG:
@@ -1090,8 +451,8 @@ void php_gd_error_method(int type, const char *format, va_list args)
*/
PHP_MINIT_FUNCTION(gd)
{
- le_gd = zend_register_list_destructors_ex(php_free_gd_image, NULL, "gd", module_number);
le_gd_font = zend_register_list_destructors_ex(php_free_gd_font, NULL, "gd font", module_number);
+ php_gd_object_minit_helper();
#if defined(HAVE_GD_FREETYPE) && defined(HAVE_GD_BUNDLED)
gdFontCacheMutexSetup();
@@ -1124,7 +485,7 @@ PHP_MINIT_FUNCTION(gd)
REGISTER_LONG_CONSTANT("IMG_ARC_NOFILL", gdNoFill, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("IMG_ARC_EDGED", gdEdged, CONST_CS | CONST_PERSISTENT);
- /* GD2 image format types */
+ /* GD2 image format types */
REGISTER_LONG_CONSTANT("IMG_GD2_RAW", GD2_FMT_RAW, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("IMG_GD2_COMPRESSED", GD2_FMT_COMPRESSED, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("IMG_FLIP_HORIZONTAL", GD_FLIP_HORINZONTAL, CONST_CS | CONST_PERSISTENT);
@@ -1346,7 +707,7 @@ PHP_MINFO_FUNCTION(gd)
PHP_FUNCTION(gd_info)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
array_init(return_value);
@@ -1401,13 +762,6 @@ PHP_FUNCTION(gd_info)
}
/* }}} */
-/* Need this for cpdf. See also comment in file.c php3i_get_le_fp() */
-PHP_GD_API int phpi_get_le_gd(void)
-{
- return le_gd;
-}
-/* }}} */
-
#define FLIPWORD(a) (((a & 0xff000000) >> 24) | ((a & 0x00ff0000) >> 8) | ((a & 0x0000ff00) << 8) | ((a & 0x000000ff) << 24))
/* {{{ proto int imageloadfont(string filename)
@@ -1422,7 +776,7 @@ PHP_FUNCTION(imageloadfont)
php_stream *stream;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "P", &file) == FAILURE) {
- return;
+ RETURN_THROWS();
}
stream = php_stream_open_wrapper(ZSTR_VAL(file), "rb", IGNORE_PATH | IGNORE_URL_WIN | REPORT_ERRORS, NULL);
@@ -1522,21 +876,19 @@ PHP_FUNCTION(imagesetstyle)
gdImagePtr im;
int *stylearr;
int index = 0;
- uint32_t num_styles;
+ uint32_t num_styles;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ra", &IM, &styles) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Oa", &IM, gd_image_ce, &styles) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
- num_styles = zend_hash_num_elements(Z_ARRVAL_P(styles));
- if (num_styles == 0) {
- php_error_docref(NULL, E_WARNING, "styles array must not be empty");
- RETURN_FALSE;
- }
+ num_styles = zend_hash_num_elements(Z_ARRVAL_P(styles));
+ if (num_styles == 0) {
+ zend_value_error("Styles array must not be empty");
+ RETURN_THROWS();
+ }
/* copy the style values in the stylearr */
stylearr = safe_emalloc(sizeof(int), num_styles, 0);
@@ -1561,12 +913,17 @@ PHP_FUNCTION(imagecreatetruecolor)
gdImagePtr im;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll", &x_size, &y_size) == FAILURE) {
- return;
+ RETURN_THROWS();
}
- if (x_size <= 0 || y_size <= 0 || x_size >= INT_MAX || y_size >= INT_MAX) {
- php_error_docref(NULL, E_WARNING, "Invalid image dimensions");
- RETURN_FALSE;
+ if (x_size <= 0 || x_size >= INT_MAX) {
+ zend_value_error("Invalid width (x_size)");
+ RETURN_THROWS();
+ }
+
+ if (y_size <= 0 || y_size >= INT_MAX) {
+ zend_value_error("Invalid height (y_size)");
+ RETURN_THROWS();
}
im = gdImageCreateTrueColor(x_size, y_size);
@@ -1575,7 +932,7 @@ PHP_FUNCTION(imagecreatetruecolor)
RETURN_FALSE;
}
- RETURN_RES(zend_register_resource(im, le_gd));
+ php_gd_assign_libgdimageptr_as_extgdimage(return_value, im);
}
/* }}} */
@@ -1586,13 +943,11 @@ PHP_FUNCTION(imageistruecolor)
zval *IM;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &IM) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &IM, gd_image_ce) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
RETURN_BOOL(im->trueColor);
}
@@ -1607,18 +962,17 @@ PHP_FUNCTION(imagetruecolortopalette)
zend_long ncolors;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rbl", &IM, &dither, &ncolors) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Obl", &IM, gd_image_ce, &dither, &ncolors) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
if (ncolors <= 0 || ZEND_LONG_INT_OVFL(ncolors)) {
- php_error_docref(NULL, E_WARNING, "Number of colors has to be greater than zero and no more than %d", INT_MAX);
- RETURN_FALSE;
+ zend_value_error("Number of colors has to be greater than zero and no more than %d", INT_MAX);
+ RETURN_THROWS();
}
+
if (gdImageTrueColorToPalette(im, dither, (int)ncolors)) {
RETURN_TRUE;
} else {
@@ -1635,13 +989,11 @@ PHP_FUNCTION(imagepalettetotruecolor)
zval *IM;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &IM) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &IM, gd_image_ce) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
if (gdImagePaletteToTrueColor(im) == 0) {
RETURN_FALSE;
@@ -1659,16 +1011,12 @@ PHP_FUNCTION(imagecolormatch)
gdImagePtr im1, im2;
int result;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rr", &IM1, &IM2) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "OO", &IM1, gd_image_ce, &IM2, gd_image_ce) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im1 = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM1), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
- if ((im2 = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM2), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im1 = php_gd_libgdimageptr_from_zval_p(IM1);
+ im2 = php_gd_libgdimageptr_from_zval_p(IM2);
result = gdImageColorMatch(im1, im2);
switch (result) {
@@ -1702,13 +1050,11 @@ PHP_FUNCTION(imagesetthickness)
zend_long thick;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &IM, &thick) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ol", &IM, gd_image_ce, &thick) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
gdImageSetThickness(im, thick);
@@ -1724,16 +1070,13 @@ PHP_FUNCTION(imagefilledellipse)
zend_long cx, cy, w, h, color;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlllll", &IM, &cx, &cy, &w, &h, &color) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Olllll", &IM, gd_image_ce, &cx, &cy, &w, &h, &color) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
gdImageFilledEllipse(im, cx, cy, w, h, color);
-
RETURN_TRUE;
}
/* }}} */
@@ -1747,13 +1090,11 @@ PHP_FUNCTION(imagefilledarc)
gdImagePtr im;
int e, st;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rllllllll", &IM, &cx, &cy, &w, &h, &ST, &E, &col, &style) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ollllllll", &IM, gd_image_ce, &cx, &cy, &w, &h, &ST, &E, &col, &style) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
e = E;
if (e < 0) {
@@ -1779,13 +1120,11 @@ PHP_FUNCTION(imagealphablending)
zend_bool blend;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rb", &IM, &blend) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ob", &IM, gd_image_ce, &blend) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
gdImageAlphaBlending(im, blend);
@@ -1801,13 +1140,11 @@ PHP_FUNCTION(imagesavealpha)
zend_bool save;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rb", &IM, &save) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ob", &IM, gd_image_ce, &save) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
gdImageSaveAlpha(im, save);
@@ -1823,13 +1160,11 @@ PHP_FUNCTION(imagelayereffect)
zend_long effect;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &IM, &effect) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ol", &IM, gd_image_ce, &effect) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
gdImageAlphaBlending(im, effect);
@@ -1839,8 +1174,8 @@ PHP_FUNCTION(imagelayereffect)
#define CHECK_RGBA_RANGE(component, name) \
if (component < 0 || component > gd##name##Max) { \
- php_error_docref(NULL, E_WARNING, #name " component is out of range"); \
- RETURN_FALSE; \
+ zend_value_error(#name " component is out of range, must be between 0 and %d (inclusive)", gd##name##Max); \
+ RETURN_THROWS(); \
}
/* {{{ proto int imagecolorallocatealpha(resource im, int red, int green, int blue, int alpha)
@@ -1852,13 +1187,11 @@ PHP_FUNCTION(imagecolorallocatealpha)
gdImagePtr im;
int ct = (-1);
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rllll", &IM, &red, &green, &blue, &alpha) == FAILURE) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ollll", &IM, gd_image_ce, &red, &green, &blue, &alpha) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
CHECK_RGBA_RANGE(red, Red);
CHECK_RGBA_RANGE(green, Green);
@@ -1881,13 +1214,11 @@ PHP_FUNCTION(imagecolorresolvealpha)
zend_long red, green, blue, alpha;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rllll", &IM, &red, &green, &blue, &alpha) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ollll", &IM, gd_image_ce, &red, &green, &blue, &alpha) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
CHECK_RGBA_RANGE(red, Red);
CHECK_RGBA_RANGE(green, Green);
@@ -1906,13 +1237,11 @@ PHP_FUNCTION(imagecolorclosestalpha)
zend_long red, green, blue, alpha;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rllll", &IM, &red, &green, &blue, &alpha) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ollll", &IM, gd_image_ce, &red, &green, &blue, &alpha) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
CHECK_RGBA_RANGE(red, Red);
CHECK_RGBA_RANGE(green, Green);
@@ -1931,13 +1260,11 @@ PHP_FUNCTION(imagecolorexactalpha)
zend_long red, green, blue, alpha;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rllll", &IM, &red, &green, &blue, &alpha) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ollll", &IM, gd_image_ce, &red, &green, &blue, &alpha) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
CHECK_RGBA_RANGE(red, Red);
CHECK_RGBA_RANGE(green, Green);
@@ -1957,17 +1284,12 @@ PHP_FUNCTION(imagecopyresampled)
gdImagePtr im_dst, im_src;
int srcH, srcW, dstH, dstW, srcY, srcX, dstY, dstX;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rrllllllll", &DIM, &SIM, &DX, &DY, &SX, &SY, &DW, &DH, &SW, &SH) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "OOllllllll", &DIM, gd_image_ce, &SIM, gd_image_ce, &DX, &DY, &SX, &SY, &DW, &DH, &SW, &SH) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im_dst = (gdImagePtr)zend_fetch_resource(Z_RES_P(DIM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
-
- if ((im_src = (gdImagePtr)zend_fetch_resource(Z_RES_P(SIM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im_src = php_gd_libgdimageptr_from_zval_p(SIM);
+ im_dst = php_gd_libgdimageptr_from_zval_p(DIM);
srcX = SX;
srcY = SY;
@@ -2001,7 +1323,7 @@ PHP_FUNCTION(imagegrabwindow)
gdImagePtr im = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l", &lwindow_handle, &client_area) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
window = (HWND) lwindow_handle;
@@ -2049,9 +1371,9 @@ PHP_FUNCTION(imagegrabwindow)
if (!im) {
RETURN_FALSE;
- } else {
- RETURN_RES(zend_register_resource(im, le_gd));
}
+
+ php_gd_assign_libgdimageptr_as_extgdimage(return_value, im);
}
/* }}} */
@@ -2070,7 +1392,7 @@ PHP_FUNCTION(imagegrabscreen)
hdc = GetDC(0);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!hdc) {
@@ -2106,9 +1428,9 @@ PHP_FUNCTION(imagegrabscreen)
if (!im) {
RETURN_FALSE;
- } else {
- RETURN_RES(zend_register_resource(im, le_gd));
}
+
+ php_gd_assign_libgdimageptr_as_extgdimage(return_value, im);
}
/* }}} */
#endif /* PHP_WIN32 */
@@ -2123,21 +1445,18 @@ PHP_FUNCTION(imagerotate)
zend_long color;
zend_long ignoretransparent = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rdl|l", &SIM, &degrees, &color, &ignoretransparent) == FAILURE) {
- RETURN_FALSE;
- }
-
- if ((im_src = (gdImagePtr)zend_fetch_resource(Z_RES_P(SIM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Odl|l", &SIM, gd_image_ce, &degrees, &color, &ignoretransparent) == FAILURE) {
+ RETURN_THROWS();
}
+ im_src = php_gd_libgdimageptr_from_zval_p(SIM);
im_dst = gdImageRotateInterpolated(im_src, (const float)degrees, color);
- if (im_dst != NULL) {
- RETURN_RES(zend_register_resource(im_dst, le_gd));
- } else {
+ if (im_dst == NULL) {
RETURN_FALSE;
}
+
+ php_gd_assign_libgdimageptr_as_extgdimage(return_value, im_dst);
}
/* }}} */
@@ -2148,17 +1467,12 @@ PHP_FUNCTION(imagesettile)
zval *IM, *TILE;
gdImagePtr im, tile;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rr", &IM, &TILE) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "OO", &IM, gd_image_ce, &TILE, gd_image_ce) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
-
- if ((tile = (gdImagePtr)zend_fetch_resource(Z_RES_P(TILE), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
+ tile = php_gd_libgdimageptr_from_zval_p(TILE);
gdImageSetTile(im, tile);
@@ -2173,17 +1487,12 @@ PHP_FUNCTION(imagesetbrush)
zval *IM, *TILE;
gdImagePtr im, tile;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rr", &IM, &TILE) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "OO", &IM, gd_image_ce, &TILE, gd_image_ce) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
-
- if ((tile = (gdImagePtr)zend_fetch_resource(Z_RES_P(TILE), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
+ tile = php_gd_libgdimageptr_from_zval_p(TILE);
gdImageSetBrush(im, tile);
@@ -2199,12 +1508,17 @@ PHP_FUNCTION(imagecreate)
gdImagePtr im;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll", &x_size, &y_size) == FAILURE) {
- return;
+ RETURN_THROWS();
}
- if (x_size <= 0 || y_size <= 0 || x_size >= INT_MAX || y_size >= INT_MAX) {
- php_error_docref(NULL, E_WARNING, "Invalid image dimensions");
- RETURN_FALSE;
+ if (x_size <= 0 || x_size >= INT_MAX) {
+ zend_value_error("Invalid width (x_size)");
+ RETURN_THROWS();
+ }
+
+ if (y_size <= 0 || y_size >= INT_MAX) {
+ zend_value_error("Invalid height (y_size)");
+ RETURN_THROWS();
}
im = gdImageCreate(x_size, y_size);
@@ -2213,7 +1527,7 @@ PHP_FUNCTION(imagecreate)
RETURN_FALSE;
}
- RETURN_RES(zend_register_resource(im, le_gd));
+ php_gd_assign_libgdimageptr_as_extgdimage(return_value, im);
}
/* }}} */
@@ -2244,7 +1558,7 @@ PHP_FUNCTION(imagetypes)
#endif
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_LONG(ret);
@@ -2313,12 +1627,12 @@ static int _php_image_type (char data[12])
/* {{{ _php_image_create_from_string
*/
-gdImagePtr _php_image_create_from_string(zval *data, char *tn, gdImagePtr (*ioctx_func_p)())
+gdImagePtr _php_image_create_from_string(zend_string *data, char *tn, gdImagePtr (*ioctx_func_p)())
{
gdImagePtr im;
gdIOCtx *io_ctx;
- io_ctx = gdNewDynamicCtxEx(Z_STRLEN_P(data), Z_STRVAL_P(data), 0);
+ io_ctx = gdNewDynamicCtxEx(ZSTR_LEN(data), ZSTR_VAL(data), 0);
if (!io_ctx) {
return NULL;
@@ -2341,25 +1655,21 @@ gdImagePtr _php_image_create_from_string(zval *data, char *tn, gdImagePtr (*ioct
Create a new image from the image stream in the string */
PHP_FUNCTION(imagecreatefromstring)
{
- zval *data;
+ zend_string *data;
gdImagePtr im;
int imtype;
char sig[12];
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &data) == FAILURE) {
- return;
- }
-
- if (!try_convert_to_string(data)) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &data) == FAILURE) {
+ RETURN_THROWS();
}
- if (Z_STRLEN_P(data) < sizeof(sig)) {
+ if (ZSTR_LEN(data) < sizeof(sig)) {
php_error_docref(NULL, E_WARNING, "Empty string or invalid image");
RETURN_FALSE;
}
- memcpy(sig, Z_STRVAL_P(data), sizeof(sig));
+ memcpy(sig, ZSTR_VAL(data), sizeof(sig));
imtype = _php_image_type(sig);
@@ -2417,7 +1727,7 @@ PHP_FUNCTION(imagecreatefromstring)
RETURN_FALSE;
}
- RETURN_RES(zend_register_resource(im, le_gd));
+ php_gd_assign_libgdimageptr_as_extgdimage(return_value, im);
}
/* }}} */
@@ -2437,15 +1747,22 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type,
if (image_type == PHP_GDIMG_TYPE_GD2PART) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "pllll", &file, &file_len, &srcx, &srcy, &width, &height) == FAILURE) {
- return;
+ RETURN_THROWS();
}
- if (width < 1 || height < 1) {
- php_error_docref(NULL, E_WARNING, "Zero width or height not allowed");
- RETURN_FALSE;
+
+ if (width < 1) {
+ zend_value_error("Width must be at least 1");
+ RETURN_THROWS();
+ }
+
+ if (height < 1) {
+ zend_value_error("Height must be at least 1");
+ RETURN_THROWS();
}
+
} else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &file, &file_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
@@ -2527,8 +1844,8 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type,
/* register_im: */
if (im) {
- RETVAL_RES(zend_register_resource(im, le_gd));
php_stream_close(stream);
+ php_gd_assign_libgdimageptr_as_extgdimage(return_value, im);
return;
}
@@ -2662,16 +1979,13 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char
int argc = ZEND_NUM_ARGS();
int q = -1, t = 1;
- /* The quality parameter for Wbmp stands for the foreground when called from image2wbmp() */
/* The quality parameter for gd2 stands for chunk size */
- if (zend_parse_parameters(argc, "r|pll", &imgind, &file, &file_len, &quality, &type) == FAILURE) {
- return;
+ if (zend_parse_parameters(argc, "O|pll", &imgind, gd_image_ce, &file, &file_len, &quality, &type) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(imgind), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(imgind);
if (argc > 1) {
fn = file;
@@ -2693,15 +2007,6 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char
}
switch (image_type) {
- case PHP_GDIMG_CONVERT_WBM:
- if (q == -1) {
- q = 0;
- } else if (q < 0 || q > 255) {
- php_error_docref(NULL, E_WARNING, "Invalid threshold value '%d'. It must be between 0 and 255", q);
- q = 0;
- }
- gdImageWBMP(im, q, fp);
- break;
case PHP_GDIMG_TYPE_GD:
(*func_p)(im, fp);
break;
@@ -2729,15 +2034,6 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char
}
switch (image_type) {
- case PHP_GDIMG_CONVERT_WBM:
- if (q == -1) {
- q = 0;
- } else if (q < 0 || q > 255) {
- php_error_docref(NULL, E_WARNING, "Invalid threshold value '%d'. It must be between 0 and 255", q);
- q = 0;
- }
- gdImageWBMP(im, q, tmp);
- break;
case PHP_GDIMG_TYPE_GD:
(*func_p)(im, tmp);
break;
@@ -2848,22 +2144,16 @@ PHP_FUNCTION(imagebmp)
#endif
/* {{{ proto bool imagedestroy(resource im)
- Destroy an image */
+ Destroy an image - No effect as of PHP 8.0 */
PHP_FUNCTION(imagedestroy)
{
+ /* This function used to free the resource, as resources are no longer used, it does nothing */
zval *IM;
- gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &IM) == FAILURE) {
- return;
- }
-
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &IM, gd_image_ce) == FAILURE) {
+ RETURN_THROWS();
}
- zend_list_close(Z_RES_P(IM));
-
RETURN_TRUE;
}
/* }}} */
@@ -2877,13 +2167,11 @@ PHP_FUNCTION(imagecolorallocate)
gdImagePtr im;
int ct = (-1);
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlll", &IM, &red, &green, &blue) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Olll", &IM, gd_image_ce, &red, &green, &blue) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
CHECK_RGBA_RANGE(red, Red);
CHECK_RGBA_RANGE(green, Green);
@@ -2904,17 +2192,12 @@ PHP_FUNCTION(imagepalettecopy)
zval *dstim, *srcim;
gdImagePtr dst, src;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rr", &dstim, &srcim) == FAILURE) {
- return;
- }
-
- if ((dst = (gdImagePtr)zend_fetch_resource(Z_RES_P(dstim), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "OO", &dstim, gd_image_ce, &srcim, gd_image_ce) == FAILURE) {
+ RETURN_THROWS();
}
- if ((src = (gdImagePtr)zend_fetch_resource(Z_RES_P(srcim), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ src = php_gd_libgdimageptr_from_zval_p(srcim);
+ dst = php_gd_libgdimageptr_from_zval_p(dstim);
gdImagePaletteCopy(dst, src);
}
@@ -2929,14 +2212,12 @@ PHP_FUNCTION(imagecolorat)
gdImagePtr im;
ZEND_PARSE_PARAMETERS_START(3, 3)
- Z_PARAM_RESOURCE(IM)
+ Z_PARAM_OBJECT_OF_CLASS(IM, gd_image_ce)
Z_PARAM_LONG(x)
Z_PARAM_LONG(y)
ZEND_PARSE_PARAMETERS_END();
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
if (gdImageTrueColor(im)) {
if (im->tpixels && gdImageBoundsSafe(im, x, y)) {
@@ -2964,13 +2245,11 @@ PHP_FUNCTION(imagecolorclosest)
zend_long red, green, blue;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlll", &IM, &red, &green, &blue) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Olll", &IM, gd_image_ce, &red, &green, &blue) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
CHECK_RGBA_RANGE(red, Red);
CHECK_RGBA_RANGE(green, Green);
@@ -2988,13 +2267,11 @@ PHP_FUNCTION(imagecolorclosesthwb)
zend_long red, green, blue;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlll", &IM, &red, &green, &blue) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Olll", &IM, gd_image_ce, &red, &green, &blue) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
CHECK_RGBA_RANGE(red, Red);
CHECK_RGBA_RANGE(green, Green);
@@ -3013,13 +2290,11 @@ PHP_FUNCTION(imagecolordeallocate)
int col;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &IM, &index) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ol", &IM, gd_image_ce, &index) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
/* We can return right away for a truecolor image as deallocating colours is meaningless here */
if (gdImageTrueColor(im)) {
@@ -3032,8 +2307,8 @@ PHP_FUNCTION(imagecolordeallocate)
gdImageColorDeallocate(im, col);
RETURN_TRUE;
} else {
- php_error_docref(NULL, E_WARNING, "Color index %d out of range", col);
- RETURN_FALSE;
+ zend_value_error("Color index %d out of range", col);
+ RETURN_THROWS();
}
}
/* }}} */
@@ -3046,13 +2321,11 @@ PHP_FUNCTION(imagecolorresolve)
zend_long red, green, blue;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlll", &IM, &red, &green, &blue) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Olll", &IM, gd_image_ce, &red, &green, &blue) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
CHECK_RGBA_RANGE(red, Red);
CHECK_RGBA_RANGE(green, Green);
@@ -3070,13 +2343,11 @@ PHP_FUNCTION(imagecolorexact)
zend_long red, green, blue;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlll", &IM, &red, &green, &blue) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Olll", &IM, gd_image_ce, &red, &green, &blue) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
CHECK_RGBA_RANGE(red, Red);
CHECK_RGBA_RANGE(green, Green);
@@ -3095,13 +2366,11 @@ PHP_FUNCTION(imagecolorset)
int col;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rllll|l", &IM, &color, &red, &green, &blue, &alpha) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ollll|l", &IM, gd_image_ce, &color, &red, &green, &blue, &alpha) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
CHECK_RGBA_RANGE(red, Red);
CHECK_RGBA_RANGE(green, Green);
@@ -3130,13 +2399,11 @@ PHP_FUNCTION(imagecolorsforindex)
int col;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &IM, &index) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ol", &IM, gd_image_ce, &index) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
col = index;
@@ -3163,20 +2430,18 @@ PHP_FUNCTION(imagegammacorrect)
int i;
double input, output, gamma;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rdd", &IM, &input, &output) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Odd", &IM, gd_image_ce, &input, &output) == FAILURE) {
+ RETURN_THROWS();
}
if ( input <= 0.0 || output <= 0.0 ) {
- php_error_docref(NULL, E_WARNING, "Gamma values should be positive");
- RETURN_FALSE;
+ zend_value_error("Gamma values must be positive");
+ RETURN_THROWS();
}
gamma = input / output;
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
if (gdImageTrueColor(im)) {
int x, y, c;
@@ -3216,15 +2481,13 @@ PHP_FUNCTION(imagesetpixel)
gdImagePtr im;
ZEND_PARSE_PARAMETERS_START(4, 4)
- Z_PARAM_RESOURCE(IM)
+ Z_PARAM_OBJECT_OF_CLASS(IM, gd_image_ce)
Z_PARAM_LONG(x)
Z_PARAM_LONG(y)
Z_PARAM_LONG(col)
ZEND_PARSE_PARAMETERS_END();
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
gdImageSetPixel(im, x, y, col);
RETURN_TRUE;
@@ -3239,13 +2502,11 @@ PHP_FUNCTION(imageline)
zend_long x1, y1, x2, y2, col;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlllll", &IM, &x1, &y1, &x2, &y2, &col) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Olllll", &IM, gd_image_ce, &x1, &y1, &x2, &y2, &col) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
if (im->AA) {
gdImageSetAntiAliased(im, col);
@@ -3264,13 +2525,11 @@ PHP_FUNCTION(imagedashedline)
zend_long x1, y1, x2, y2, col;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlllll", &IM, &x1, &y1, &x2, &y2, &col) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Olllll", &IM, gd_image_ce, &x1, &y1, &x2, &y2, &col) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
gdImageDashedLine(im, x1, y1, x2, y2, col);
RETURN_TRUE;
@@ -3285,13 +2544,11 @@ PHP_FUNCTION(imagerectangle)
zend_long x1, y1, x2, y2, col;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlllll", &IM, &x1, &y1, &x2, &y2, &col) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Olllll", &IM, gd_image_ce, &x1, &y1, &x2, &y2, &col) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
gdImageRectangle(im, x1, y1, x2, y2, col);
RETURN_TRUE;
@@ -3306,13 +2563,11 @@ PHP_FUNCTION(imagefilledrectangle)
zend_long x1, y1, x2, y2, col;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlllll", &IM, &x1, &y1, &x2, &y2, &col) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Olllll", &IM, gd_image_ce, &x1, &y1, &x2, &y2, &col) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
gdImageFilledRectangle(im, x1, y1, x2, y2, col);
RETURN_TRUE;
}
@@ -3327,13 +2582,11 @@ PHP_FUNCTION(imagearc)
gdImagePtr im;
int e, st;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlllllll", &IM, &cx, &cy, &w, &h, &ST, &E, &col) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Olllllll", &IM, gd_image_ce, &cx, &cy, &w, &h, &ST, &E, &col) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
e = E;
if (e < 0) {
@@ -3358,13 +2611,11 @@ PHP_FUNCTION(imageellipse)
zend_long cx, cy, w, h, color;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlllll", &IM, &cx, &cy, &w, &h, &color) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Olllll", &IM, gd_image_ce, &cx, &cy, &w, &h, &color) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
gdImageEllipse(im, cx, cy, w, h, color);
RETURN_TRUE;
@@ -3379,13 +2630,11 @@ PHP_FUNCTION(imagefilltoborder)
zend_long x, y, border, col;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rllll", &IM, &x, &y, &border, &col) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ollll", &IM, gd_image_ce, &x, &y, &border, &col) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
gdImageFillToBorder(im, x, y, border, col);
RETURN_TRUE;
@@ -3400,13 +2649,11 @@ PHP_FUNCTION(imagefill)
zend_long x, y, col;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlll", &IM, &x, &y, &col) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Olll", &IM, gd_image_ce, &x, &y, &col) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
gdImageFill(im, x, y, col);
RETURN_TRUE;
@@ -3420,13 +2667,11 @@ PHP_FUNCTION(imagecolorstotal)
zval *IM;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &IM) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &IM, gd_image_ce) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
RETURN_LONG(gdImageColorsTotal(im));
}
@@ -3441,13 +2686,11 @@ PHP_FUNCTION(imagecolortransparent)
gdImagePtr im;
int argc = ZEND_NUM_ARGS();
- if (zend_parse_parameters(argc, "r|l", &IM, &COL) == FAILURE) {
- return;
+ if (zend_parse_parameters(argc, "O|l", &IM, gd_image_ce, &COL) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
if (argc > 1) {
gdImageColorTransparent(im, COL);
@@ -3466,13 +2709,11 @@ PHP_FUNCTION(imageinterlace)
zend_long INT = 0;
gdImagePtr im;
- if (zend_parse_parameters(argc, "r|l", &IM, &INT) == FAILURE) {
- return;
+ if (zend_parse_parameters(argc, "O|l", &IM, gd_image_ce, &INT) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
if (argc > 1) {
gdImageInterlace(im, INT);
@@ -3496,29 +2737,33 @@ static void php_imagepolygon(INTERNAL_FUNCTION_PARAMETERS, int filled)
gdPointPtr points;
int npoints, col, nelem, i;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rall", &IM, &POINTS, &NPOINTS, &COL) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Oal|l", &IM, gd_image_ce, &POINTS, &NPOINTS, &COL) == FAILURE) {
+ RETURN_THROWS();
}
-
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
+ if (ZEND_NUM_ARGS() == 3) {
+ COL = NPOINTS;
+ NPOINTS = zend_hash_num_elements(Z_ARRVAL_P(POINTS));
+ if (NPOINTS % 2 != 0) {
+ zend_value_error("Points array must have an even number of elements");
+ RETURN_THROWS();
+ }
+ NPOINTS /= 2;
}
+ im = php_gd_libgdimageptr_from_zval_p(IM);
+
npoints = NPOINTS;
col = COL;
nelem = zend_hash_num_elements(Z_ARRVAL_P(POINTS));
- if (nelem < 6) {
- php_error_docref(NULL, E_WARNING, "You must have at least 3 points in your array");
- RETURN_FALSE;
- }
- if (npoints <= 0) {
- php_error_docref(NULL, E_WARNING, "You must give a positive number of points");
- RETURN_FALSE;
+ if (npoints < 3) {
+ zend_value_error("Polygon must have at least 3 points");
+ RETURN_THROWS();
}
+
if (nelem < npoints * 2) {
- php_error_docref(NULL, E_WARNING, "Trying to use %d points in array with only %d points", npoints, nelem/2);
- RETURN_FALSE;
+ zend_value_error("Trying to use %d points in array with only %d points", npoints, nelem/2);
+ RETURN_THROWS();
}
points = (gdPointPtr) safe_emalloc(npoints, sizeof(gdPoint), 0);
@@ -3628,7 +2873,7 @@ static void php_imagefontsize(INTERNAL_FUNCTION_PARAMETERS, int arg)
gdFontPtr font;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &SIZE) == FAILURE) {
- return;
+ RETURN_THROWS();
}
font = php_find_gd_font(SIZE);
@@ -3695,13 +2940,11 @@ static void php_imagechar(INTERNAL_FUNCTION_PARAMETERS, int mode)
unsigned char *str = NULL;
gdFontPtr font;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlllsl", &IM, &SIZE, &X, &Y, &C, &C_len, &COL) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Olllsl", &IM, gd_image_ce, &SIZE, &X, &Y, &C, &C_len, &COL) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
col = COL;
@@ -3788,17 +3031,12 @@ PHP_FUNCTION(imagecopy)
gdImagePtr im_dst, im_src;
int srcH, srcW, srcY, srcX, dstY, dstX;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rrllllll", &DIM, &SIM, &DX, &DY, &SX, &SY, &SW, &SH) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "OOllllll", &DIM, gd_image_ce, &SIM, gd_image_ce, &DX, &DY, &SX, &SY, &SW, &SH) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im_dst = (gdImagePtr)zend_fetch_resource(Z_RES_P(DIM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
-
- if ((im_src = (gdImagePtr)zend_fetch_resource(Z_RES_P(SIM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im_dst = php_gd_libgdimageptr_from_zval_p(DIM);
+ im_src = php_gd_libgdimageptr_from_zval_p(SIM);
srcX = SX;
srcY = SY;
@@ -3821,17 +3059,12 @@ PHP_FUNCTION(imagecopymerge)
gdImagePtr im_dst, im_src;
int srcH, srcW, srcY, srcX, dstY, dstX, pct;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rrlllllll", &DIM, &SIM, &DX, &DY, &SX, &SY, &SW, &SH, &PCT) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "OOlllllll", &DIM, gd_image_ce, &SIM, gd_image_ce, &DX, &DY, &SX, &SY, &SW, &SH, &PCT) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im_dst = (gdImagePtr)zend_fetch_resource(Z_RES_P(DIM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
-
- if ((im_src = (gdImagePtr)zend_fetch_resource(Z_RES_P(SIM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im_src = php_gd_libgdimageptr_from_zval_p(SIM);
+ im_dst = php_gd_libgdimageptr_from_zval_p(DIM);
srcX = SX;
srcY = SY;
@@ -3855,17 +3088,12 @@ PHP_FUNCTION(imagecopymergegray)
gdImagePtr im_dst, im_src;
int srcH, srcW, srcY, srcX, dstY, dstX, pct;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rrlllllll", &DIM, &SIM, &DX, &DY, &SX, &SY, &SW, &SH, &PCT) == FAILURE) {
- return;
- }
-
- if ((im_dst = (gdImagePtr)zend_fetch_resource(Z_RES_P(DIM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "OOlllllll", &DIM, gd_image_ce, &SIM, gd_image_ce, &DX, &DY, &SX, &SY, &SW, &SH, &PCT) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im_src = (gdImagePtr)zend_fetch_resource(Z_RES_P(SIM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im_src = php_gd_libgdimageptr_from_zval_p(SIM);
+ im_dst = php_gd_libgdimageptr_from_zval_p(DIM);
srcX = SX;
srcY = SY;
@@ -3889,17 +3117,12 @@ PHP_FUNCTION(imagecopyresized)
gdImagePtr im_dst, im_src;
int srcH, srcW, dstH, dstW, srcY, srcX, dstY, dstX;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rrllllllll", &DIM, &SIM, &DX, &DY, &SX, &SY, &DW, &DH, &SW, &SH) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "OOllllllll", &DIM, gd_image_ce, &SIM, gd_image_ce, &DX, &DY, &SX, &SY, &DW, &DH, &SW, &SH) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im_dst = (gdImagePtr)zend_fetch_resource(Z_RES_P(DIM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
-
- if ((im_src = (gdImagePtr)zend_fetch_resource(Z_RES_P(SIM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im_src = php_gd_libgdimageptr_from_zval_p(SIM);
+ im_dst = php_gd_libgdimageptr_from_zval_p(DIM);
srcX = SX;
srcY = SY;
@@ -3911,8 +3134,8 @@ PHP_FUNCTION(imagecopyresized)
dstW = DW;
if (dstW <= 0 || dstH <= 0 || srcW <= 0 || srcH <= 0) {
- php_error_docref(NULL, E_WARNING, "Invalid image dimensions");
- RETURN_FALSE;
+ zend_value_error("Invalid image dimensions");
+ RETURN_THROWS();
}
gdImageCopyResized(im_dst, im_src, dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH);
@@ -3927,13 +3150,11 @@ PHP_FUNCTION(imagesx)
zval *IM;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &IM) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &IM, gd_image_ce) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
RETURN_LONG(gdImageSX(im));
}
@@ -3946,13 +3167,11 @@ PHP_FUNCTION(imagesy)
zval *IM;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &IM) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &IM, gd_image_ce) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
RETURN_LONG(gdImageSY(im));
}
@@ -3966,13 +3185,11 @@ PHP_FUNCTION(imagesetclip)
gdImagePtr im;
zend_long x1, y1, x2, y2;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rllll", &im_zval, &x1, &y1, &x2, &y2) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ollll", &im_zval, gd_image_ce, &x1, &y1, &x2, &y2) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(im_zval), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(im_zval);
gdImageSetClip(im, x1, y1, x2, y2);
RETURN_TRUE;
@@ -3987,13 +3204,11 @@ PHP_FUNCTION(imagegetclip)
gdImagePtr im;
int x1, y1, x2, y2;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &im_zval) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &im_zval, gd_image_ce) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(im_zval), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(im_zval);
gdImageGetClip(im, &x1, &y1, &x2, &y2);
@@ -4060,17 +3275,15 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int
if (argc < 4 || argc > ((extended) ? 5 : 4)) {
ZEND_WRONG_PARAM_COUNT();
} else if (zend_parse_parameters(argc, "ddss|a", &ptsize, &angle, &fontname, &fontname_len, &str, &str_len, &EXT) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
} else {
if (argc < 8 || argc > ((extended) ? 9 : 8)) {
ZEND_WRONG_PARAM_COUNT();
- } else if (zend_parse_parameters(argc, "rddlllss|a", &IM, &ptsize, &angle, &x, &y, &col, &fontname, &fontname_len, &str, &str_len, &EXT) == FAILURE) {
- RETURN_FALSE;
- }
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
+ } else if (zend_parse_parameters(argc, "Oddlllss|a", &IM, gd_image_ce, &ptsize, &angle, &x, &y, &col, &fontname, &fontname_len, &str, &str_len, &EXT) == FAILURE) {
+ RETURN_THROWS();
}
+ im = php_gd_libgdimageptr_from_zval_p(IM);
}
/* convert angle to radians */
@@ -4125,234 +3338,14 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int
/* }}} */
#endif /* HAVE_GD_FREETYPE */
-/* {{{ proto bool image2wbmp(resource im [, string filename [, int foreground]])
- Output WBMP image to browser or file */
-PHP_FUNCTION(image2wbmp)
-{
- _php_image_output(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_CONVERT_WBM, "WBMP", NULL);
-}
-/* }}} */
-
-#if defined(HAVE_GD_JPG)
-/* {{{ proto bool jpeg2wbmp(string f_org, string f_dest, int d_height, int d_width, int threshold)
- Convert JPEG image to WBMP image */
-PHP_FUNCTION(jpeg2wbmp)
-{
- _php_image_convert(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_JPG);
-}
-/* }}} */
-#endif
-
-#if defined(HAVE_GD_PNG)
-/* {{{ proto bool png2wbmp(string f_org, string f_dest, int d_height, int d_width, int threshold)
- Convert PNG image to WBMP image */
-PHP_FUNCTION(png2wbmp)
-{
- _php_image_convert(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_PNG);
-}
-/* }}} */
-#endif
-
-/* {{{ _php_image_convert
- * _php_image_convert converts jpeg/png images to wbmp and resizes them as needed */
-static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type )
-{
- char *f_org, *f_dest;
- size_t f_org_len, f_dest_len;
- zend_long height, width, threshold;
- gdImagePtr im_org, im_dest, im_tmp;
- char *fn_org = NULL;
- char *fn_dest = NULL;
- FILE *org, *dest;
- int dest_height = -1;
- int dest_width = -1;
- int org_height, org_width;
- int white, black;
- int color, color_org, median;
- int int_threshold;
- int x, y;
- float x_ratio, y_ratio;
-#ifdef HAVE_GD_JPG
- zend_long ignore_warning;
-#endif
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "pplll", &f_org, &f_org_len, &f_dest, &f_dest_len, &height, &width, &threshold) == FAILURE) {
- return;
- }
-
- fn_org = f_org;
- fn_dest = f_dest;
- dest_height = height;
- dest_width = width;
- int_threshold = threshold;
-
- /* Check threshold value */
- if (int_threshold < 0 || int_threshold > 8) {
- php_error_docref(NULL, E_WARNING, "Invalid threshold value '%d'", int_threshold);
- RETURN_FALSE;
- }
-
- /* Check origin file */
- PHP_GD_CHECK_OPEN_BASEDIR(fn_org, "Invalid origin filename");
-
- /* Check destination file */
- PHP_GD_CHECK_OPEN_BASEDIR(fn_dest, "Invalid destination filename");
-
- /* Open origin file */
- org = VCWD_FOPEN(fn_org, "rb");
- if (!org) {
- php_error_docref(NULL, E_WARNING, "Unable to open '%s' for reading", fn_org);
- RETURN_FALSE;
- }
-
- /* Open destination file */
- dest = VCWD_FOPEN(fn_dest, "wb");
- if (!dest) {
- php_error_docref(NULL, E_WARNING, "Unable to open '%s' for writing", fn_dest);
- fclose(org);
- RETURN_FALSE;
- }
-
- switch (image_type) {
-
-#ifdef HAVE_GD_JPG
- case PHP_GDIMG_TYPE_JPG:
- ignore_warning = INI_INT("gd.jpeg_ignore_warning");
- im_org = gdImageCreateFromJpegEx(org, ignore_warning);
- if (im_org == NULL) {
- php_error_docref(NULL, E_WARNING, "Unable to open '%s' Not a valid JPEG file", fn_dest);
- fclose(org);
- fclose(dest);
- RETURN_FALSE;
- }
- break;
-#endif /* HAVE_GD_JPG */
-
-#ifdef HAVE_GD_PNG
- case PHP_GDIMG_TYPE_PNG:
- im_org = gdImageCreateFromPng(org);
- if (im_org == NULL) {
- php_error_docref(NULL, E_WARNING, "Unable to open '%s' Not a valid PNG file", fn_dest);
- fclose(org);
- fclose(dest);
- RETURN_FALSE;
- }
- break;
-#endif /* HAVE_GD_PNG */
-
- default:
- php_error_docref(NULL, E_WARNING, "Format not supported");
- fclose(org);
- fclose(dest);
- RETURN_FALSE;
- break;
- }
-
- fclose(org);
-
- org_width = gdImageSX (im_org);
- org_height = gdImageSY (im_org);
-
- x_ratio = (float) org_width / (float) dest_width;
- y_ratio = (float) org_height / (float) dest_height;
-
- if (x_ratio > 1 && y_ratio > 1) {
- if (y_ratio > x_ratio) {
- x_ratio = y_ratio;
- } else {
- y_ratio = x_ratio;
- }
- dest_width = (int) (org_width / x_ratio);
- dest_height = (int) (org_height / y_ratio);
- } else {
- x_ratio = (float) dest_width / (float) org_width;
- y_ratio = (float) dest_height / (float) org_height;
-
- if (y_ratio < x_ratio) {
- x_ratio = y_ratio;
- } else {
- y_ratio = x_ratio;
- }
- dest_width = (int) (org_width * x_ratio);
- dest_height = (int) (org_height * y_ratio);
- }
-
- im_tmp = gdImageCreate (dest_width, dest_height);
- if (im_tmp == NULL ) {
- php_error_docref(NULL, E_WARNING, "Unable to allocate temporary buffer");
- fclose(dest);
- gdImageDestroy(im_org);
- RETURN_FALSE;
- }
-
- gdImageCopyResized (im_tmp, im_org, 0, 0, 0, 0, dest_width, dest_height, org_width, org_height);
-
- gdImageDestroy(im_org);
-
- im_dest = gdImageCreate(dest_width, dest_height);
- if (im_dest == NULL) {
- php_error_docref(NULL, E_WARNING, "Unable to allocate destination buffer");
- fclose(dest);
- gdImageDestroy(im_tmp);
- RETURN_FALSE;
- }
-
- white = gdImageColorAllocate(im_dest, 255, 255, 255);
- if (white == -1) {
- php_error_docref(NULL, E_WARNING, "Unable to allocate the colors for the destination buffer");
- fclose(dest);
- gdImageDestroy(im_tmp);
- gdImageDestroy(im_dest);
- RETURN_FALSE;
- }
-
- black = gdImageColorAllocate(im_dest, 0, 0, 0);
- if (black == -1) {
- php_error_docref(NULL, E_WARNING, "Unable to allocate the colors for the destination buffer");
- fclose(dest);
- gdImageDestroy(im_tmp);
- gdImageDestroy(im_dest);
- RETURN_FALSE;
- }
-
- int_threshold = int_threshold * 32;
-
- for (y = 0; y < dest_height; y++) {
- for (x = 0; x < dest_width; x++) {
- color_org = gdImageGetPixel (im_tmp, x, y);
- median = (im_tmp->red[color_org] + im_tmp->green[color_org] + im_tmp->blue[color_org]) / 3;
- if (median < int_threshold) {
- color = black;
- } else {
- color = white;
- }
- gdImageSetPixel (im_dest, x, y, color);
- }
- }
-
- gdImageDestroy (im_tmp );
-
- gdImageWBMP(im_dest, black , dest);
-
- fflush(dest);
- fclose(dest);
-
- gdImageDestroy(im_dest);
-
- RETURN_TRUE;
-}
-/* }}} */
-
/* Section Filters */
#define PHP_GD_SINGLE_RES \
zval *SIM; \
gdImagePtr im_src; \
- if (zend_parse_parameters(1, "r", &SIM) == FAILURE) { \
- RETURN_FALSE; \
+ if (zend_parse_parameters(1, "O", &SIM, gd_image_ce) == FAILURE) { \
+ RETURN_THROWS(); \
} \
- if ((im_src = (gdImagePtr)zend_fetch_resource(Z_RES_P(SIM), "Image", le_gd)) == NULL) { \
- RETURN_FALSE; \
- }
+ im_src = php_gd_libgdimageptr_from_zval_p(SIM);
static void php_image_filter_negate(INTERNAL_FUNCTION_PARAMETERS)
{
@@ -4382,13 +3375,11 @@ static void php_image_filter_brightness(INTERNAL_FUNCTION_PARAMETERS)
gdImagePtr im_src;
zend_long brightness, tmp;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "zll", &SIM, &tmp, &brightness) == FAILURE) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Oll", &SIM, gd_image_ce, &tmp, &brightness) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im_src = (gdImagePtr)zend_fetch_resource(Z_RES_P(SIM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im_src = php_gd_libgdimageptr_from_zval_p(SIM);
if (gdImageBrightness(im_src, (int)brightness) == 1) {
RETURN_TRUE;
@@ -4403,13 +3394,11 @@ static void php_image_filter_contrast(INTERNAL_FUNCTION_PARAMETERS)
gdImagePtr im_src;
zend_long contrast, tmp;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rll", &SIM, &tmp, &contrast) == FAILURE) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Oll", &SIM, gd_image_ce, &tmp, &contrast) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im_src = (gdImagePtr)zend_fetch_resource(Z_RES_P(SIM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im_src = php_gd_libgdimageptr_from_zval_p(SIM);
if (gdImageContrast(im_src, (int)contrast) == 1) {
RETURN_TRUE;
@@ -4425,13 +3414,11 @@ static void php_image_filter_colorize(INTERNAL_FUNCTION_PARAMETERS)
zend_long r,g,b,tmp;
zend_long a = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rllll|l", &SIM, &tmp, &r, &g, &b, &a) == FAILURE) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ollll|l", &SIM, gd_image_ce, &tmp, &r, &g, &b, &a) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im_src = (gdImagePtr)zend_fetch_resource(Z_RES_P(SIM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im_src = php_gd_libgdimageptr_from_zval_p(SIM);
if (gdImageColor(im_src, (int) r, (int) g, (int) b, (int) a) == 1) {
RETURN_TRUE;
@@ -4502,13 +3489,11 @@ static void php_image_filter_smooth(INTERNAL_FUNCTION_PARAMETERS)
gdImagePtr im_src;
double weight;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rld", &SIM, &tmp, &weight) == FAILURE) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Old", &SIM, gd_image_ce, &tmp, &weight) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im_src = (gdImagePtr)zend_fetch_resource(Z_RES_P(SIM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im_src = php_gd_libgdimageptr_from_zval_p(SIM);
if (gdImageSmooth(im_src, (float)weight)==1) {
RETURN_TRUE;
@@ -4524,13 +3509,11 @@ static void php_image_filter_pixelate(INTERNAL_FUNCTION_PARAMETERS)
zend_long tmp, blocksize;
zend_bool mode = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rll|b", &IM, &tmp, &blocksize, &mode) == FAILURE) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Oll|b", &IM, gd_image_ce, &tmp, &blocksize, &mode) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
if (gdImagePixelate(im, (int) blocksize, (const unsigned int) mode)) {
RETURN_TRUE;
@@ -4547,13 +3530,11 @@ static void php_image_filter_scatter(INTERNAL_FUNCTION_PARAMETERS)
zend_long tmp;
zend_long scatter_sub, scatter_plus;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlll|a", &IM, &tmp, &scatter_sub, &scatter_plus, &hash_colors) == FAILURE) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Olll|a", &IM, gd_image_ce, &tmp, &scatter_sub, &scatter_plus, &hash_colors) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
if (hash_colors) {
uint32_t i = 0;
@@ -4575,7 +3556,7 @@ static void php_image_filter_scatter(INTERNAL_FUNCTION_PARAMETERS)
efree(colors);
} else {
- RETURN_BOOL(gdImageScatter(im, (int) scatter_sub, (int) scatter_plus))
+ RETURN_BOOL(gdImageScatter(im, (int) scatter_sub, (int) scatter_plus));
}
}
@@ -4606,8 +3587,8 @@ PHP_FUNCTION(imagefilter)
if (ZEND_NUM_ARGS() < 2 || ZEND_NUM_ARGS() > IMAGE_FILTER_MAX_ARGS) {
WRONG_PARAM_COUNT;
- } else if (zend_parse_parameters(2, "rl", &tmp, &filtertype) == FAILURE) {
- return;
+ } else if (zend_parse_parameters(2, "Ol", &tmp, gd_image_ce, &filtertype) == FAILURE) {
+ RETURN_THROWS();
}
if (filtertype >= 0 && filtertype <= IMAGE_FILTER_MAX) {
@@ -4627,33 +3608,31 @@ PHP_FUNCTION(imageconvolution)
int nelem, i, j, res;
float matrix[3][3] = {{0,0,0}, {0,0,0}, {0,0,0}};
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "radd", &SIM, &hash_matrix, &div, &offset) == FAILURE) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Oadd", &SIM, gd_image_ce, &hash_matrix, &div, &offset) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im_src = (gdImagePtr)zend_fetch_resource(Z_RES_P(SIM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im_src = php_gd_libgdimageptr_from_zval_p(SIM);
nelem = zend_hash_num_elements(Z_ARRVAL_P(hash_matrix));
if (nelem != 3) {
- php_error_docref(NULL, E_WARNING, "You must have 3x3 array");
- RETURN_FALSE;
+ zend_value_error("Convolution matrix must be a 3x3 array");
+ RETURN_THROWS();
}
for (i=0; i<3; i++) {
if ((var = zend_hash_index_find(Z_ARRVAL_P(hash_matrix), (i))) != NULL && Z_TYPE_P(var) == IS_ARRAY) {
if (zend_hash_num_elements(Z_ARRVAL_P(var)) != 3 ) {
- php_error_docref(NULL, E_WARNING, "You must have 3x3 array");
- RETURN_FALSE;
+ zend_value_error("Convolution matrix must be a 3x3 array, matrix[%d] only has %d elements", i, zend_hash_num_elements(Z_ARRVAL_P(var)));
+ RETURN_THROWS();
}
for (j=0; j<3; j++) {
if ((var2 = zend_hash_index_find(Z_ARRVAL_P(var), j)) != NULL) {
matrix[i][j] = (float) zval_get_double(var2);
} else {
- php_error_docref(NULL, E_WARNING, "You must have a 3x3 matrix");
- RETURN_FALSE;
+ zend_value_error("Convolution matrix must be a 3x3 array, matrix[%d][%d] cannot be found (missing integer key)", i, j);
+ RETURN_THROWS();
}
}
}
@@ -4677,13 +3656,11 @@ PHP_FUNCTION(imageflip)
zend_long mode;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &IM, &mode) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ol", &IM, gd_image_ce, &mode) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
switch (mode) {
case GD_FLIP_VERTICAL:
@@ -4699,8 +3676,8 @@ PHP_FUNCTION(imageflip)
break;
default:
- php_error_docref(NULL, E_WARNING, "Unknown flip mode");
- RETURN_FALSE;
+ zend_value_error("Unknown flip mode");
+ RETURN_THROWS();
}
RETURN_TRUE;
@@ -4715,14 +3692,11 @@ PHP_FUNCTION(imageantialias)
zend_bool alias;
gdImagePtr im;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rb", &IM, &alias) == FAILURE) {
- return;
- }
-
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ob", &IM, gd_image_ce, &alias) == FAILURE) {
+ RETURN_THROWS();
}
+ im = php_gd_libgdimageptr_from_zval_p(IM);
if (im->trueColor) {
im->AA = alias;
}
@@ -4742,49 +3716,47 @@ PHP_FUNCTION(imagecrop)
zval *z_rect;
zval *tmp;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ra", &IM, &z_rect) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Oa", &IM, gd_image_ce, &z_rect) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(z_rect), "x", sizeof("x") -1)) != NULL) {
rect.x = zval_get_long(tmp);
} else {
- php_error_docref(NULL, E_WARNING, "Missing x position");
- RETURN_FALSE;
+ zend_value_error("Cropping rectangle is missing x position");
+ RETURN_THROWS();
}
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(z_rect), "y", sizeof("y") - 1)) != NULL) {
rect.y = zval_get_long(tmp);
} else {
- php_error_docref(NULL, E_WARNING, "Missing y position");
- RETURN_FALSE;
+ zend_value_error("Cropping rectangle is missing y position");
+ RETURN_THROWS();
}
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(z_rect), "width", sizeof("width") - 1)) != NULL) {
rect.width = zval_get_long(tmp);
} else {
- php_error_docref(NULL, E_WARNING, "Missing width");
- RETURN_FALSE;
+ zend_value_error("Cropping rectangle is missing width");
+ RETURN_THROWS();
}
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(z_rect), "height", sizeof("height") - 1)) != NULL) {
rect.height = zval_get_long(tmp);
} else {
- php_error_docref(NULL, E_WARNING, "Missing height");
- RETURN_FALSE;
+ zend_value_error("Cropping rectangle is missing height");
+ RETURN_THROWS();
}
im_crop = gdImageCrop(im, &rect);
if (im_crop == NULL) {
RETURN_FALSE;
- } else {
- RETURN_RES(zend_register_resource(im_crop, le_gd));
}
+
+ php_gd_assign_libgdimageptr_as_extgdimage(return_value, im_crop);
}
/* }}} */
@@ -4799,19 +3771,13 @@ PHP_FUNCTION(imagecropauto)
gdImagePtr im;
gdImagePtr im_crop;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|ldl", &IM, &mode, &threshold, &color) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O|ldl", &IM, gd_image_ce, &mode, &threshold, &color) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
switch (mode) {
- case -1:
- php_error_docref(NULL, E_DEPRECATED, "Crop mode -1 is deprecated. Use IMG_CROP_DEFAULT instead.");
- mode = GD_CROP_DEFAULT;
- /* FALLTHRU */
case GD_CROP_DEFAULT:
case GD_CROP_TRANSPARENT:
case GD_CROP_BLACK:
@@ -4822,21 +3788,22 @@ PHP_FUNCTION(imagecropauto)
case GD_CROP_THRESHOLD:
if (color < 0 || (!gdImageTrueColor(im) && color >= gdImageColorsTotal(im))) {
- php_error_docref(NULL, E_WARNING, "Color argument missing with threshold mode");
- RETURN_FALSE;
+ zend_value_error("Color argument missing with threshold mode");
+ RETURN_THROWS();
}
im_crop = gdImageCropThreshold(im, color, (float) threshold);
break;
default:
- php_error_docref(NULL, E_WARNING, "Unknown crop mode");
- RETURN_FALSE;
+ zend_value_error("Unknown crop mode");
+ RETURN_THROWS();
}
+
if (im_crop == NULL) {
RETURN_FALSE;
- } else {
- RETURN_RES(zend_register_resource(im_crop, le_gd));
}
+
+ php_gd_assign_libgdimageptr_as_extgdimage(return_value, im_crop);
}
/* }}} */
@@ -4851,14 +3818,12 @@ PHP_FUNCTION(imagescale)
zend_long tmp_w, tmp_h=-1, tmp_m = GD_BILINEAR_FIXED;
gdInterpolationMethod method, old_method;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl|ll", &IM, &tmp_w, &tmp_h, &tmp_m) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ol|ll", &IM, gd_image_ce, &tmp_w, &tmp_h, &tmp_m) == FAILURE) {
+ RETURN_THROWS();
}
method = tmp_m;
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
if (tmp_h < 0 || tmp_w < 0) {
/* preserve ratio */
@@ -4891,9 +3856,9 @@ PHP_FUNCTION(imagescale)
if (im_scaled == NULL) {
RETURN_FALSE;
- } else {
- RETURN_RES(zend_register_resource(im_scaled, le_gd));
}
+
+ php_gd_assign_libgdimageptr_as_extgdimage(return_value, im_scaled);
}
/* }}} */
@@ -4913,17 +3878,15 @@ PHP_FUNCTION(imageaffine)
int i, nelems;
zval *zval_affine_elem = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ra|a", &IM, &z_affine, &z_rect) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Oa|a", &IM, gd_image_ce, &z_affine, &z_rect) == FAILURE) {
+ RETURN_THROWS();
}
- if ((src = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ src = php_gd_libgdimageptr_from_zval_p(IM);
if ((nelems = zend_hash_num_elements(Z_ARRVAL_P(z_affine))) != 6) {
- php_error_docref(NULL, E_WARNING, "Affine array must have six elements");
- RETURN_FALSE;
+ zend_value_error("Affine array must have six elements");
+ RETURN_THROWS();
}
for (i = 0; i < nelems; i++) {
@@ -4939,8 +3902,8 @@ PHP_FUNCTION(imageaffine)
affine[i] = zval_get_double(zval_affine_elem);
break;
default:
- php_error_docref(NULL, E_WARNING, "Invalid type for element %i", i);
- RETURN_FALSE;
+ zend_type_error("Invalid type for element %i", i);
+ RETURN_THROWS();
}
}
}
@@ -4949,37 +3912,31 @@ PHP_FUNCTION(imageaffine)
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(z_rect), "x", sizeof("x") - 1)) != NULL) {
rect.x = zval_get_long(tmp);
} else {
- php_error_docref(NULL, E_WARNING, "Missing x position");
- RETURN_FALSE;
+ zend_value_error("Clip array is missing x position");
+ RETURN_THROWS();
}
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(z_rect), "y", sizeof("y") - 1)) != NULL) {
rect.y = zval_get_long(tmp);
} else {
- php_error_docref(NULL, E_WARNING, "Missing y position");
- RETURN_FALSE;
+ zend_value_error("Clip array is missing y position");
+ RETURN_THROWS();
}
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(z_rect), "width", sizeof("width") - 1)) != NULL) {
rect.width = zval_get_long(tmp);
} else {
- php_error_docref(NULL, E_WARNING, "Missing width");
- RETURN_FALSE;
+ zend_value_error("Clip array is missing width");
+ RETURN_THROWS();
}
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(z_rect), "height", sizeof("height") - 1)) != NULL) {
rect.height = zval_get_long(tmp);
} else {
- php_error_docref(NULL, E_WARNING, "Missing height");
- RETURN_FALSE;
+ zend_value_error("Clip array is missing height");
+ RETURN_THROWS();
}
pRect = &rect;
- } else {
- rect.x = -1;
- rect.y = -1;
- rect.width = gdImageSX(src);
- rect.height = gdImageSY(src);
- pRect = NULL;
}
if (gdTransformAffineGetImage(&dst, src, pRect, affine) != GD_TRUE) {
@@ -4988,9 +3945,9 @@ PHP_FUNCTION(imageaffine)
if (dst == NULL) {
RETURN_FALSE;
- } else {
- RETURN_RES(zend_register_resource(dst, le_gd));
}
+
+ php_gd_assign_libgdimageptr_as_extgdimage(return_value, dst);
}
/* }}} */
@@ -5005,7 +3962,7 @@ PHP_FUNCTION(imageaffinematrixget)
int res = GD_FALSE, i;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|z", &type, &options) == FAILURE) {
- return;
+ RETURN_THROWS();
}
switch((gdAffineStandardMatrix)type) {
@@ -5013,21 +3970,22 @@ PHP_FUNCTION(imageaffinematrixget)
case GD_AFFINE_SCALE: {
double x, y;
if (!options || Z_TYPE_P(options) != IS_ARRAY) {
- php_error_docref(NULL, E_WARNING, "Array expected as options");
- RETURN_FALSE;
+ zend_type_error("Array expected as options when using translate or scale");
+ RETURN_THROWS();
}
+
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(options), "x", sizeof("x") - 1)) != NULL) {
x = zval_get_double(tmp);
} else {
- php_error_docref(NULL, E_WARNING, "Missing x position");
- RETURN_FALSE;
+ zend_value_error("Options array is missing x position");
+ RETURN_THROWS();
}
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(options), "y", sizeof("y") - 1)) != NULL) {
y = zval_get_double(tmp);
} else {
- php_error_docref(NULL, E_WARNING, "Missing y position");
- RETURN_FALSE;
+ zend_value_error("Options array is missing y position");
+ RETURN_THROWS();
}
if (type == GD_AFFINE_TRANSLATE) {
@@ -5044,8 +4002,8 @@ PHP_FUNCTION(imageaffinematrixget)
double angle;
if (!options) {
- php_error_docref(NULL, E_WARNING, "Number is expected as option");
- RETURN_FALSE;
+ zend_type_error("Number is expected as option when using rotate or shear");
+ RETURN_THROWS();
}
angle = zval_get_double(options);
@@ -5061,8 +4019,8 @@ PHP_FUNCTION(imageaffinematrixget)
}
default:
- php_error_docref(NULL, E_WARNING, "Invalid type for element " ZEND_LONG_FMT, type);
- RETURN_FALSE;
+ zend_value_error("Invalid type for element " ZEND_LONG_FMT, type);
+ RETURN_THROWS();
}
if (res == GD_FALSE) {
@@ -5089,12 +4047,12 @@ PHP_FUNCTION(imageaffinematrixconcat)
int i, nelems;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "aa", &z_m1, &z_m2) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (((nelems = zend_hash_num_elements(Z_ARRVAL_P(z_m1))) != 6) || (nelems = zend_hash_num_elements(Z_ARRVAL_P(z_m2))) != 6) {
- php_error_docref(NULL, E_WARNING, "Affine arrays must have six elements");
- RETURN_FALSE;
+ zend_value_error("Affine arrays must have six elements");
+ RETURN_THROWS();
}
for (i = 0; i < 6; i++) {
@@ -5110,10 +4068,11 @@ PHP_FUNCTION(imageaffinematrixconcat)
m1[i] = zval_get_double(tmp);
break;
default:
- php_error_docref(NULL, E_WARNING, "Invalid type for element %i", i);
- RETURN_FALSE;
+ zend_type_error("Matrix 1 contains invalid type for element %i", i);
+ RETURN_THROWS();
}
}
+
if ((tmp = zend_hash_index_find(Z_ARRVAL_P(z_m2), i)) != NULL) {
switch (Z_TYPE_P(tmp)) {
case IS_LONG:
@@ -5126,8 +4085,8 @@ PHP_FUNCTION(imageaffinematrixconcat)
m2[i] = zval_get_double(tmp);
break;
default:
- php_error_docref(NULL, E_WARNING, "Invalid type for element %i", i);
- RETURN_FALSE;
+ zend_type_error("Matrix 2 contains invalid type for element %i", i);
+ RETURN_THROWS();
}
}
}
@@ -5142,6 +4101,26 @@ PHP_FUNCTION(imageaffinematrixconcat)
}
} /* }}} */
+/* {{{ proto resource imagegetinterpolation(resource im)
+ Get the default interpolation method. */
+PHP_FUNCTION(imagegetinterpolation)
+{
+ zval *IM;
+ gdImagePtr im;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &IM, gd_image_ce) == FAILURE) {
+ RETURN_THROWS();
+ }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
+
+#ifdef HAVE_GD_GET_INTERPOLATION
+ RETURN_LONG(gdImageGetInterpolationMethod(im));
+#else
+ RETURN_LONG(im->interpolation_id);
+#endif
+}
+/* }}} */
+
/* {{{ proto resource imagesetinterpolation(resource im [, int method]])
Set the default interpolation method, passing -1 or 0 sets it to the libgd default (bilinear). */
PHP_FUNCTION(imagesetinterpolation)
@@ -5150,13 +4129,11 @@ PHP_FUNCTION(imagesetinterpolation)
gdImagePtr im;
zend_long method = GD_BILINEAR_FIXED;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|l", &IM, &method) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O|l", &IM, gd_image_ce, &method) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
if (method == -1) {
method = GD_BILINEAR_FIXED;
@@ -5173,13 +4150,11 @@ PHP_FUNCTION(imageresolution)
gdImagePtr im;
zend_long res_x = GD_RESOLUTION, res_y = GD_RESOLUTION;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|ll", &IM, &res_x, &res_y) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O|ll", &IM, gd_image_ce, &res_x, &res_y) == FAILURE) {
+ RETURN_THROWS();
}
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
- RETURN_FALSE;
- }
+ im = php_gd_libgdimageptr_from_zval_p(IM);
switch (ZEND_NUM_ARGS()) {
case 3:
@@ -5195,3 +4170,208 @@ PHP_FUNCTION(imageresolution)
}
}
/* }}} */
+
+
+/*********************************************************
+ *
+ * Stream Handling
+ * Formerly contained within ext/gd/gd_ctx.c and included
+ * at the the top of this file
+ *
+ ********************************************************/
+
+#define CTX_PUTC(c,ctx) ctx->putC(ctx, c)
+
+static void _php_image_output_putc(struct gdIOCtx *ctx, int c) /* {{{ */
+{
+ /* without the following downcast, the write will fail
+ * (i.e., will write a zero byte) for all
+ * big endian architectures:
+ */
+ unsigned char ch = (unsigned char) c;
+ php_write(&ch, 1);
+} /* }}} */
+
+static int _php_image_output_putbuf(struct gdIOCtx *ctx, const void* buf, int l) /* {{{ */
+{
+ return php_write((void *)buf, l);
+} /* }}} */
+
+static void _php_image_output_ctxfree(struct gdIOCtx *ctx) /* {{{ */
+{
+ if(ctx) {
+ efree(ctx);
+ }
+} /* }}} */
+
+static void _php_image_stream_putc(struct gdIOCtx *ctx, int c) /* {{{ */ {
+ char ch = (char) c;
+ php_stream * stream = (php_stream *)ctx->data;
+ php_stream_write(stream, &ch, 1);
+} /* }}} */
+
+static int _php_image_stream_putbuf(struct gdIOCtx *ctx, const void* buf, int l) /* {{{ */
+{
+ php_stream * stream = (php_stream *)ctx->data;
+ return php_stream_write(stream, (void *)buf, l);
+} /* }}} */
+
+static void _php_image_stream_ctxfree(struct gdIOCtx *ctx) /* {{{ */
+{
+ if(ctx->data) {
+ ctx->data = NULL;
+ }
+ if(ctx) {
+ efree(ctx);
+ }
+} /* }}} */
+
+static void _php_image_stream_ctxfreeandclose(struct gdIOCtx *ctx) /* {{{ */
+{
+
+ if(ctx->data) {
+ php_stream_close((php_stream *) ctx->data);
+ ctx->data = NULL;
+ }
+ if(ctx) {
+ efree(ctx);
+ }
+} /* }}} */
+
+/* {{{ _php_image_output_ctx */
+static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, void (*func_p)())
+{
+ zval *imgind;
+ char *file = NULL;
+ size_t file_len = 0;
+ zend_long quality, basefilter;
+ zend_bool compressed = 1;
+ gdImagePtr im;
+ int argc = ZEND_NUM_ARGS();
+ int q = -1, i;
+ int f = -1;
+ gdIOCtx *ctx = NULL;
+ zval *to_zval = NULL;
+ php_stream *stream;
+ int close_stream = 1;
+
+ /* The third (quality) parameter for Wbmp and Xbm stands for the foreground color index when called
+ * from imagey<type>().
+ */
+ switch (image_type) {
+ case PHP_GDIMG_TYPE_XBM:
+ if (zend_parse_parameters(argc, "Op!|ll", &imgind, gd_image_ce, &file, &file_len, &quality, &basefilter) == FAILURE) {
+ RETURN_THROWS();
+ }
+ break;
+ case PHP_GDIMG_TYPE_BMP:
+ if (zend_parse_parameters(argc, "O|z!b", &imgind, gd_image_ce, &to_zval, &compressed) == FAILURE) {
+ RETURN_THROWS();
+ }
+ break;
+ default:
+ /* PHP_GDIMG_TYPE_GIF
+ * PHP_GDIMG_TYPE_PNG
+ * PHP_GDIMG_TYPE_JPG
+ * PHP_GDIMG_TYPE_WBM
+ * PHP_GDIMG_TYPE_WEBP
+ * */
+ if (zend_parse_parameters(argc, "O|z!ll", &imgind, gd_image_ce, &to_zval, &quality, &basefilter) == FAILURE) {
+ RETURN_THROWS();
+ }
+ }
+
+ im = php_gd_libgdimageptr_from_zval_p(imgind);
+
+ if (image_type != PHP_GDIMG_TYPE_BMP && argc >= 3) {
+ q = quality; /* or colorindex for foreground of BW images (defaults to black) */
+ if (argc == 4) {
+ f = basefilter;
+ }
+ }
+
+ if (argc > 1 && to_zval != NULL) {
+ if (Z_TYPE_P(to_zval) == IS_RESOURCE) {
+ php_stream_from_zval_no_verify(stream, to_zval);
+ if (stream == NULL) {
+ RETURN_FALSE;
+ }
+ close_stream = 0;
+ } else if (Z_TYPE_P(to_zval) == IS_STRING) {
+ if (CHECK_ZVAL_NULL_PATH(to_zval)) {
+ zend_type_error("Invalid 2nd parameter, filename must not contain null bytes");
+ RETURN_THROWS();
+ }
+
+ stream = php_stream_open_wrapper(Z_STRVAL_P(to_zval), "wb", REPORT_ERRORS|IGNORE_PATH|IGNORE_URL_WIN, NULL);
+ if (stream == NULL) {
+ RETURN_FALSE;
+ }
+ } else {
+ php_error_docref(NULL, E_WARNING, "Invalid 2nd parameter, it must a filename or a stream");
+ RETURN_FALSE;
+ }
+ } else if (argc > 1 && file != NULL) {
+ stream = php_stream_open_wrapper(file, "wb", REPORT_ERRORS|IGNORE_PATH|IGNORE_URL_WIN, NULL);
+ if (stream == NULL) {
+ RETURN_FALSE;
+ }
+ } else {
+ ctx = ecalloc(1, sizeof(gdIOCtx));
+ ctx->putC = _php_image_output_putc;
+ ctx->putBuf = _php_image_output_putbuf;
+ ctx->gd_free = _php_image_output_ctxfree;
+ }
+
+ if (!ctx) {
+ ctx = ecalloc(1, sizeof(gdIOCtx));
+ ctx->putC = _php_image_stream_putc;
+ ctx->putBuf = _php_image_stream_putbuf;
+ if (close_stream) {
+ ctx->gd_free = _php_image_stream_ctxfreeandclose;
+ } else {
+ ctx->gd_free = _php_image_stream_ctxfree;
+ }
+ ctx->data = (void *)stream;
+ }
+
+ switch(image_type) {
+ case PHP_GDIMG_TYPE_JPG:
+ (*func_p)(im, ctx, q);
+ break;
+ case PHP_GDIMG_TYPE_WEBP:
+ if (q == -1) {
+ q = 80;
+ }
+ (*func_p)(im, ctx, q);
+ break;
+ case PHP_GDIMG_TYPE_PNG:
+ (*func_p)(im, ctx, q, f);
+ break;
+ case PHP_GDIMG_TYPE_XBM:
+ case PHP_GDIMG_TYPE_WBM:
+ if (argc < 3) {
+ for(i=0; i < gdImageColorsTotal(im); i++) {
+ if(!gdImageRed(im, i) && !gdImageGreen(im, i) && !gdImageBlue(im, i)) break;
+ }
+ q = i;
+ }
+ if (image_type == PHP_GDIMG_TYPE_XBM) {
+ (*func_p)(im, file ? file : "", q, ctx);
+ } else {
+ (*func_p)(im, q, ctx);
+ }
+ break;
+ case PHP_GDIMG_TYPE_BMP:
+ (*func_p)(im, ctx, (int) compressed);
+ break;
+ default:
+ (*func_p)(im, ctx);
+ break;
+ }
+
+ ctx->gd_free(ctx);
+
+ RETURN_TRUE;
+}
+/* }}} */
diff --git a/ext/gd/gd.stub.php b/ext/gd/gd.stub.php
new file mode 100644
index 0000000000..5138e2596a
--- /dev/null
+++ b/ext/gd/gd.stub.php
@@ -0,0 +1,239 @@
+<?php
+
+function gd_info(): array {}
+
+function imageloadfont(string $filename): int|false {}
+
+function imagesetstyle($im, array $styles): bool {}
+
+function imagecreatetruecolor(int $x_size, int $y_size): GdImage|false {}
+
+function imageistruecolor(GdImage $im): bool {}
+
+function imagetruecolortopalette(GdImage $im, bool $ditherFlag, int $colorWanted): bool {}
+
+function imagepalettetotruecolor(GdImage $im): bool {}
+
+function imagecolormatch($im1, $im2): bool {}
+
+function imagesetthickness(GdImage $im, int $thickness): bool {}
+
+function imagefilledellipse(GdImage $im, int $cx, int $cy, int $w, int $h, int $color): bool {}
+
+function imagefilledarc(GdImage $im, int $cx, int $cy, int $w, int $h, int $s, int $e, int $col, int $style): bool {}
+
+function imagealphablending(GdImage $im, bool $blend): bool {}
+
+function imagesavealpha(GdImage $im, bool $save): bool {}
+
+function imagelayereffect(GdImage $im, int $effect): bool {}
+
+function imagecolorallocatealpha(GdImage $im, int $red, int $green, int $blue, int $alpha): int|false {}
+
+function imagecolorresolvealpha(GdImage $im, int $red, int $green, int $blue, int $alpha): int|false {}
+
+function imagecolorclosestalpha(GdImage $im, int $red, int $green, int $blue, int $alpha): int|false {}
+
+function imagecolorexactalpha(GdImage $im, int $red, int $green, int $blue, int $alpha): int|false {}
+
+function imagecopyresampled(GdImage $dst_im, GdImage $src_im, int $dst_x, int $dst_y, int $src_x, int $src_y, int $dst_w, int $dst_h, int $src_w, int $src_h): bool {}
+
+#ifdef PHP_WIN32
+
+function imagegrabwindow(int $handle, int $client_area = 0): GdImage|false {}
+
+function imagegrabscreen(): GdImage|false {}
+
+#endif
+
+function imagerotate(GdImage $im, float $angle, int $bgdcolor, int $ignoretransparent = 0): GdImage|false {}
+
+function imagesettile(GdImage $im, $tile): bool {}
+
+function imagesetbrush(GdImage $im, $brush): bool {}
+
+function imagecreate(int $x_size, int $y_size): GdImage|false {}
+
+function imagetypes(): int {}
+
+function imagecreatefromstring(string $image): GdImage|false {}
+
+function imagecreatefromgif(string $filename): GdImage|false {}
+
+#ifdef HAVE_GD_JPG
+function imagecreatefromjpeg(string $filename): GdImage|false {}
+#endif
+
+#ifdef HAVE_GD_PNG
+function imagecreatefrompng(string $filename): GdImage|false {}
+#endif
+
+#ifdef HAVE_GD_WEBP
+function imagecreatefromwebp(string $filename): GdImage|false {}
+#endif
+
+function imagecreatefromxbm(string $filename): GdImage|false {}
+
+#ifdef HAVE_GD_XPM
+function imagecreatefromxpm(string $filename): GdImage|false {}
+#endif
+
+function imagecreatefromwbmp(string $filename): GdImage|false {}
+
+function imagecreatefromgd(string $filename): GdImage|false {}
+
+function imagecreatefromgd2(string $filename): GdImage|false {}
+
+function imagecreatefromgd2part(string $filename, int $srcX, int $srcY, int $width, int $height): GdImage|false {}
+
+#ifdef HAVE_GD_BMP
+function imagecreatefrombmp(string $filename): GdImage|false {}
+#endif
+
+#ifdef HAVE_GD_TGA
+function imagecreatefromtga(string $filename): GdImage|false {}
+#endif
+
+function imagexbm(GdImage $im, ?string $filename, int $foreground = UNKNOWN): bool {}
+
+function imagegif(GdImage $im, $to = NULL): bool {}
+
+#ifdef HAVE_GD_PNG
+function imagepng(GdImage $im, $to = NULL, int $quality = UNKNOWN, int $filters = UNKNOWN): bool {}
+#endif
+
+#ifdef HAVE_GD_WEBP
+function imagewebp(GdImage $im, $to = NULL, int $quality = UNKNOWN): bool {}
+#endif
+
+#ifdef HAVE_GD_JPG
+function imagejpeg(GdImage $im, $to = NULL, int $quality = UNKNOWN): bool {}
+#endif
+
+function imagewbmp(GdImage $im, $to = NULL, int $foreground = UNKNOWN): bool {}
+
+function imagegd(GdImage $im, $to = UNKNOWN): bool {}
+
+function imagegd2(GdImage $im, $to = UNKNOWN, int $chunk_size = UNKNOWN, int $type = UNKNOWN): bool {}
+
+#ifdef HAVE_GD_BMP
+function imagebmp(GdImage $im, $to = NULL, int $compressed = 1): bool {}
+#endif
+
+function imagedestroy(GdImage $im): bool {}
+
+function imagecolorallocate(GdImage $im, int $red, int $green, int $blue): int|false {}
+
+function imagepalettecopy(GdImage $dst, GdImage $src): void {}
+
+function imagecolorat(GdImage $im, int $x, int $y): int|false {}
+
+function imagecolorclosest(GdImage $im, int $red, int $green, int $blue): int|false {}
+
+function imagecolorclosesthwb(GdImage $im, int $red, int $green, int $blue): int|false {}
+
+function imagecolordeallocate(GdImage $im, int $index): bool {}
+
+function imagecolorresolve(GdImage $im, int $red, int $green, int $blue): int|false {}
+
+function imagecolorexact(GdImage $im, int $red, int $green, int $blue): int|false {}
+
+function imagecolorset(GdImage $im, int $color, int $red, int $green, int $blue, int $alpha = 0): ?bool {}
+
+function imagecolorsforindex(GdImage $im, int $index): array|false {}
+
+function imagegammacorrect(GdImage $im, float $inputgamma, float $outputgamma): bool {}
+
+function imagesetpixel(GdImage $im, int $x, int $y, int $col): bool {}
+
+function imageline(GdImage $im, int $x1, int $y1, int $x2, int $y2, int $col): bool {}
+
+function imagedashedline(GdImage $im, int $x1, int $y1, int $x2, int $y2, int $col): bool {}
+
+function imagerectangle(GdImage $im, int $x1, int $y1, int $x2, int $y2, int $col): bool {}
+
+function imagefilledrectangle(GdImage $im, int $x1, int $y1, int $x2, int $y2, int $col): bool {}
+
+function imagearc(GdImage $im, int $cx, int $cy, int $w, int $h, int $s, int $e, int $col): bool {}
+
+function imageellipse(GdImage $im, int $cx, int $cy, int $w, int $h, int $color): bool {}
+
+function imagefilltoborder(GdImage $im, int $x, int $y, int $border, int $col): bool {}
+
+function imagefill(GdImage $im, int $x, int $y, int $col): bool {}
+
+function imagecolorstotal(GdImage $im): int {}
+
+function imagecolortransparent(GdImage $im, int $col = UNKNOWN): ?int {}
+
+function imageinterlace(GdImage $im, int $interlace = UNKNOWN): ?int {}
+
+function imagepolygon(GdImage $im, array $points, int $num_points_or_col, int $col = UNKNOWN): bool {}
+
+function imageopenpolygon(GdImage $im, array $points, int $num_points_or_col, int $col = UNKNOWN): bool {}
+
+function imagefilledpolygon(GdImage $im, array $points, int $num_points_or_col, int $col = UNKNOWN): bool {}
+
+function imagefontwidth(int $font): int {}
+
+function imagefontheight(int $font): int {}
+
+function imagechar(GdImage $im, int $font, int $x, int $y, string $c, int $col): bool {}
+
+function imagecharup(GdImage $im, int $font, int $x, int $y, string $c, int $col): bool {}
+
+function imagestring(GdImage $im, int $font, int $x, int $y, string $str, int $col): bool {}
+
+function imagestringup(GdImage $im, int $font, int $x, int $y, string $str, int $col): bool {}
+
+function imagecopy(GdImage $dst_im, GdImage $src_im, int $dst_x, int $dst_y, int $src_x, int $src_y, int $src_w, int $src_h): bool {}
+
+function imagecopymerge(GdImage $dst_im, GdImage $src_im, int $dst_x, int $dst_y, int $src_x, int $src_y, int $src_w, int $src_h, int $pct): bool {}
+
+function imagecopymergegray(GdImage $dst_im, GdImage $src_im, int $dst_x, int $dst_y, int $src_x, int $src_y, int $src_w, int $src_h, int $pct): bool {}
+
+function imagecopyresized(GdImage $dst_im, GdImage $src_im, int $dst_x, int $dst_y, int $src_x, int $src_y, int $dst_w, int $dst_h, int $src_w, int $src_h): bool {}
+
+function imagesx(GdImage $im): int {}
+
+function imagesy(GdImage $im): int {}
+
+function imagesetclip(GdImage $im, int $x1, int $x2, int $y1, int $y2): bool {}
+
+function imagegetclip(GdImage $im): array {}
+
+#ifdef HAVE_GD_FREETYPE
+function imageftbbox(float $size, float $angle, string $font_file, string $text, array $extrainfo = UNKNOWN): array|false {}
+
+function imagefttext(GdImage $im, float $size, float $angle, int $x, int $y, int $col, string $font_file, string $text, array $extrainfo = UNKNOWN): array|false {}
+
+function imagettfbbox(float $size, float $angle, string $font_file, string $text): array|false {}
+
+function imagettftext(GdImage $im, float $size, float $angle, int $x, int $y, int $col, string $font_file, string $text) {}
+#endif
+
+function imagefilter(GdImage $im, int $filtertype, $arg1 = UNKNOWN, $arg2 = UNKNOWN, $arg3 = UNKNOWN, $arg4 = UNKNOWN): bool {}
+
+function imageconvolution(GdImage $im, array $matrix3x3, float $div, float $offset): bool {}
+
+function imageflip(GdImage $im, int $mode): bool {}
+
+function imageantialias(GdImage $im, bool $on): bool {}
+
+function imagecrop(GdImage $im, array $rect): GdImage|false {}
+
+function imagecropauto(GdImage $im, int $mode = IMG_CROP_DEFAULT, float $threshold = 0.5, int $color = -1): GdImage|false {}
+
+function imagescale(GdImage $im, int $new_width, int $new_height = UNKNOWN, int $mode = IMG_BILINEAR_FIXED): GdImage|false {}
+
+function imageaffine(GdImage $im, array $affine, array $clip = UNKNOWN): GdImage|false {}
+
+function imageaffinematrixget(int $type, $options = UNKNOWN): array|false {}
+
+function imageaffinematrixconcat(array $m1, array $m2): array|false {}
+
+function imagegetinterpolation(GdImage $im): int {}
+
+function imagesetinterpolation(GdImage $im, int $method = IMG_BILENEAR_FIXED): bool {}
+
+function imageresolution(GdImage $im, int $res_x = UNKNOWN, int $res_y = UNKNOWN): array|bool {}
diff --git a/ext/gd/gd_arginfo.h b/ext/gd/gd_arginfo.h
new file mode 100644
index 0000000000..0d8554864d
--- /dev/null
+++ b/ext/gd/gd_arginfo.h
@@ -0,0 +1,570 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_gd_info, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_imageloadfont, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagesetstyle, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, im)
+ ZEND_ARG_TYPE_INFO(0, styles, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_imagecreatetruecolor, 0, 2, GdImage, MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, x_size, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, y_size, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imageistruecolor, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagetruecolortopalette, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, ditherFlag, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, colorWanted, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imagepalettetotruecolor arginfo_imageistruecolor
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagecolormatch, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, im1)
+ ZEND_ARG_INFO(0, im2)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagesetthickness, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, thickness, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagefilledellipse, 0, 6, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, cx, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, cy, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, w, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, h, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, color, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagefilledarc, 0, 9, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, cx, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, cy, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, w, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, h, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, s, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, e, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, col, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, style, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagealphablending, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, blend, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagesavealpha, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, save, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagelayereffect, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, effect, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_imagecolorallocatealpha, 0, 5, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, red, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, green, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, blue, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, alpha, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imagecolorresolvealpha arginfo_imagecolorallocatealpha
+
+#define arginfo_imagecolorclosestalpha arginfo_imagecolorallocatealpha
+
+#define arginfo_imagecolorexactalpha arginfo_imagecolorallocatealpha
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagecopyresampled, 0, 10, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, dst_im, GdImage, 0)
+ ZEND_ARG_OBJ_INFO(0, src_im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, dst_x, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, dst_y, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, src_x, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, src_y, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, dst_w, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, dst_h, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, src_w, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, src_h, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(PHP_WIN32)
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_imagegrabwindow, 0, 1, GdImage, MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, handle, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, client_area, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(PHP_WIN32)
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_imagegrabscreen, 0, 0, GdImage, MAY_BE_FALSE)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_imagerotate, 0, 3, GdImage, MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, angle, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, bgdcolor, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, ignoretransparent, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagesettile, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_INFO(0, tile)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagesetbrush, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_INFO(0, brush)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imagecreate arginfo_imagecreatetruecolor
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagetypes, 0, 0, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_imagecreatefromstring, 0, 1, GdImage, MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, image, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_imagecreatefromgif, 0, 1, GdImage, MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_GD_JPG)
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_imagecreatefromjpeg, 0, 1, GdImage, MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_GD_PNG)
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_imagecreatefrompng, 0, 1, GdImage, MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_GD_WEBP)
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_imagecreatefromwebp, 0, 1, GdImage, MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#define arginfo_imagecreatefromxbm arginfo_imagecreatefromgif
+
+#if defined(HAVE_GD_XPM)
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_imagecreatefromxpm, 0, 1, GdImage, MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#define arginfo_imagecreatefromwbmp arginfo_imagecreatefromgif
+
+#define arginfo_imagecreatefromgd arginfo_imagecreatefromgif
+
+#define arginfo_imagecreatefromgd2 arginfo_imagecreatefromgif
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_imagecreatefromgd2part, 0, 5, GdImage, MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, srcX, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, srcY, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, width, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, height, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_GD_BMP)
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_imagecreatefrombmp, 0, 1, GdImage, MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_GD_TGA)
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_imagecreatefromtga, 0, 1, GdImage, MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagexbm, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, foreground, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagegif, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_INFO(0, to)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_GD_PNG)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagepng, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_INFO(0, to)
+ ZEND_ARG_TYPE_INFO(0, quality, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, filters, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_GD_WEBP)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagewebp, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_INFO(0, to)
+ ZEND_ARG_TYPE_INFO(0, quality, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_GD_JPG)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagejpeg, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_INFO(0, to)
+ ZEND_ARG_TYPE_INFO(0, quality, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagewbmp, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_INFO(0, to)
+ ZEND_ARG_TYPE_INFO(0, foreground, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imagegd arginfo_imagegif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagegd2, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_INFO(0, to)
+ ZEND_ARG_TYPE_INFO(0, chunk_size, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_GD_BMP)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagebmp, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_INFO(0, to)
+ ZEND_ARG_TYPE_INFO(0, compressed, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#define arginfo_imagedestroy arginfo_imageistruecolor
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_imagecolorallocate, 0, 4, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, red, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, green, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, blue, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagepalettecopy, 0, 2, IS_VOID, 0)
+ ZEND_ARG_OBJ_INFO(0, dst, GdImage, 0)
+ ZEND_ARG_OBJ_INFO(0, src, GdImage, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_imagecolorat, 0, 3, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, x, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, y, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imagecolorclosest arginfo_imagecolorallocate
+
+#define arginfo_imagecolorclosesthwb arginfo_imagecolorallocate
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagecolordeallocate, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imagecolorresolve arginfo_imagecolorallocate
+
+#define arginfo_imagecolorexact arginfo_imagecolorallocate
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagecolorset, 0, 5, _IS_BOOL, 1)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, color, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, red, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, green, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, blue, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, alpha, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_imagecolorsforindex, 0, 2, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagegammacorrect, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, inputgamma, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, outputgamma, IS_DOUBLE, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagesetpixel, 0, 4, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, x, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, y, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, col, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imageline, 0, 6, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, x1, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, y1, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, x2, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, y2, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, col, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imagedashedline arginfo_imageline
+
+#define arginfo_imagerectangle arginfo_imageline
+
+#define arginfo_imagefilledrectangle arginfo_imageline
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagearc, 0, 8, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, cx, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, cy, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, w, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, h, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, s, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, e, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, col, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imageellipse arginfo_imagefilledellipse
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagefilltoborder, 0, 5, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, x, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, y, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, border, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, col, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imagefill arginfo_imagesetpixel
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagecolorstotal, 0, 1, IS_LONG, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagecolortransparent, 0, 1, IS_LONG, 1)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, col, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imageinterlace, 0, 1, IS_LONG, 1)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, interlace, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagepolygon, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, points, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, num_points_or_col, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, col, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imageopenpolygon arginfo_imagepolygon
+
+#define arginfo_imagefilledpolygon arginfo_imagepolygon
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagefontwidth, 0, 1, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, font, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imagefontheight arginfo_imagefontwidth
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagechar, 0, 6, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, font, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, x, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, y, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, c, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, col, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imagecharup arginfo_imagechar
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagestring, 0, 6, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, font, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, x, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, y, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, col, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imagestringup arginfo_imagestring
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagecopy, 0, 8, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, dst_im, GdImage, 0)
+ ZEND_ARG_OBJ_INFO(0, src_im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, dst_x, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, dst_y, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, src_x, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, src_y, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, src_w, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, src_h, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagecopymerge, 0, 9, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, dst_im, GdImage, 0)
+ ZEND_ARG_OBJ_INFO(0, src_im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, dst_x, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, dst_y, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, src_x, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, src_y, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, src_w, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, src_h, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, pct, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imagecopymergegray arginfo_imagecopymerge
+
+#define arginfo_imagecopyresized arginfo_imagecopyresampled
+
+#define arginfo_imagesx arginfo_imagecolorstotal
+
+#define arginfo_imagesy arginfo_imagecolorstotal
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagesetclip, 0, 5, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, x1, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, x2, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, y1, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, y2, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagegetclip, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_GD_FREETYPE)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_imageftbbox, 0, 4, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, size, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, angle, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, font_file, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, text, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, extrainfo, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_GD_FREETYPE)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_imagefttext, 0, 8, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, size, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, angle, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, x, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, y, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, col, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, font_file, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, text, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, extrainfo, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_GD_FREETYPE)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_imagettfbbox, 0, 4, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, size, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, angle, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, font_file, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, text, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_GD_FREETYPE)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imagettftext, 0, 0, 8)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, size, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, angle, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, x, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, y, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, col, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, font_file, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, text, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagefilter, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, filtertype, IS_LONG, 0)
+ ZEND_ARG_INFO(0, arg1)
+ ZEND_ARG_INFO(0, arg2)
+ ZEND_ARG_INFO(0, arg3)
+ ZEND_ARG_INFO(0, arg4)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imageconvolution, 0, 4, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, matrix3x3, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, div, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, offset, IS_DOUBLE, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imageflip, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imageantialias, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, on, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_imagecrop, 0, 2, GdImage, MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, rect, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_imagecropauto, 0, 1, GdImage, MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, threshold, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, color, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_imagescale, 0, 2, GdImage, MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, new_width, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, new_height, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_imageaffine, 0, 2, GdImage, MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, affine, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, clip, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_imageaffinematrixget, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+ ZEND_ARG_INFO(0, options)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_imageaffinematrixconcat, 0, 2, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, m1, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, m2, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imagegetinterpolation arginfo_imagecolorstotal
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagesetinterpolation, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, method, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_imageresolution, 0, 1, MAY_BE_ARRAY|MAY_BE_BOOL)
+ ZEND_ARG_OBJ_INFO(0, im, GdImage, 0)
+ ZEND_ARG_TYPE_INFO(0, res_x, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, res_y, IS_LONG, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/gd/gd_compat.c b/ext/gd/gd_compat.c
index 448275b168..51692c47a4 100644
--- a/ext/gd/gd_compat.c
+++ b/ext/gd/gd_compat.c
@@ -11,11 +11,11 @@ int overflow2(int a, int b)
{
if(a <= 0 || b <= 0) {
- php_error_docref(NULL, E_WARNING, "one parameter to a memory allocation multiplication is negative or zero, failing operation gracefully\n");
+ php_error_docref(NULL, E_WARNING, "One parameter to a memory allocation multiplication is negative or zero, failing operation gracefully\n");
return 1;
}
if(a > INT_MAX / b) {
- php_error_docref(NULL, E_WARNING, "product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully\n");
+ php_error_docref(NULL, E_WARNING, "Product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully\n");
return 1;
}
return 0;
diff --git a/ext/gd/gd_ctx.c b/ext/gd/gd_ctx.c
deleted file mode 100644
index 03700ebca8..0000000000
--- a/ext/gd/gd_ctx.c
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
- | Copyright (c) The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Stanislav Malyshev <stas@php.net> |
- +----------------------------------------------------------------------+
- */
-
-#include "php_gd.h"
-
-#define CTX_PUTC(c,ctx) ctx->putC(ctx, c)
-
-static void _php_image_output_putc(struct gdIOCtx *ctx, int c) /* {{{ */
-{
- /* without the following downcast, the write will fail
- * (i.e., will write a zero byte) for all
- * big endian architectures:
- */
- unsigned char ch = (unsigned char) c;
- php_write(&ch, 1);
-} /* }}} */
-
-static int _php_image_output_putbuf(struct gdIOCtx *ctx, const void* buf, int l) /* {{{ */
-{
- return php_write((void *)buf, l);
-} /* }}} */
-
-static void _php_image_output_ctxfree(struct gdIOCtx *ctx) /* {{{ */
-{
- if(ctx) {
- efree(ctx);
- }
-} /* }}} */
-
-static void _php_image_stream_putc(struct gdIOCtx *ctx, int c) /* {{{ */ {
- char ch = (char) c;
- php_stream * stream = (php_stream *)ctx->data;
- php_stream_write(stream, &ch, 1);
-} /* }}} */
-
-static int _php_image_stream_putbuf(struct gdIOCtx *ctx, const void* buf, int l) /* {{{ */
-{
- php_stream * stream = (php_stream *)ctx->data;
- return php_stream_write(stream, (void *)buf, l);
-} /* }}} */
-
-static void _php_image_stream_ctxfree(struct gdIOCtx *ctx) /* {{{ */
-{
- if(ctx->data) {
- ctx->data = NULL;
- }
- if(ctx) {
- efree(ctx);
- }
-} /* }}} */
-
-static void _php_image_stream_ctxfreeandclose(struct gdIOCtx *ctx) /* {{{ */
-{
-
- if(ctx->data) {
- php_stream_close((php_stream *) ctx->data);
- ctx->data = NULL;
- }
- if(ctx) {
- efree(ctx);
- }
-} /* }}} */
-
-/* {{{ _php_image_output_ctx */
-static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, void (*func_p)())
-{
- zval *imgind;
- char *file = NULL;
- size_t file_len = 0;
- zend_long quality, basefilter;
- zend_bool compressed = 1;
- gdImagePtr im;
- int argc = ZEND_NUM_ARGS();
- int q = -1, i;
- int f = -1;
- gdIOCtx *ctx = NULL;
- zval *to_zval = NULL;
- php_stream *stream;
- int close_stream = 1;
-
- /* The third (quality) parameter for Wbmp and Xbm stands for the foreground color index when called
- * from image<type>().
- */
- switch (image_type) {
- case PHP_GDIMG_TYPE_XBM:
- if (zend_parse_parameters(argc, "rp!|ll", &imgind, &file, &file_len, &quality, &basefilter) == FAILURE) {
- return;
- }
- break;
- case PHP_GDIMG_TYPE_BMP:
- if (zend_parse_parameters(argc, "r|z!b", &imgind, &to_zval, &compressed) == FAILURE) {
- return;
- }
- break;
- default:
- /* PHP_GDIMG_TYPE_GIF
- * PHP_GDIMG_TYPE_PNG
- * PHP_GDIMG_TYPE_JPG
- * PHP_GDIMG_TYPE_WBM
- * PHP_GDIMG_TYPE_WEBP
- * */
- if (zend_parse_parameters(argc, "r|z!ll", &imgind, &to_zval, &quality, &basefilter) == FAILURE) {
- return;
- }
- }
-
- if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(imgind), "Image", phpi_get_le_gd())) == NULL) {
- RETURN_FALSE;
- }
-
- if (image_type != PHP_GDIMG_TYPE_BMP && argc >= 3) {
- q = quality; /* or colorindex for foreground of BW images (defaults to black) */
- if (argc == 4) {
- f = basefilter;
- }
- }
-
- if (argc > 1 && to_zval != NULL) {
- if (Z_TYPE_P(to_zval) == IS_RESOURCE) {
- php_stream_from_zval_no_verify(stream, to_zval);
- if (stream == NULL) {
- RETURN_FALSE;
- }
- close_stream = 0;
- } else if (Z_TYPE_P(to_zval) == IS_STRING) {
- if (CHECK_ZVAL_NULL_PATH(to_zval)) {
- php_error_docref(NULL, E_WARNING, "Invalid 2nd parameter, filename must not contain null bytes");
- RETURN_FALSE;
- }
-
- stream = php_stream_open_wrapper(Z_STRVAL_P(to_zval), "wb", REPORT_ERRORS|IGNORE_PATH|IGNORE_URL_WIN, NULL);
- if (stream == NULL) {
- RETURN_FALSE;
- }
- } else {
- php_error_docref(NULL, E_WARNING, "Invalid 2nd parameter, it must a filename or a stream");
- RETURN_FALSE;
- }
- } else if (argc > 1 && file != NULL) {
- stream = php_stream_open_wrapper(file, "wb", REPORT_ERRORS|IGNORE_PATH|IGNORE_URL_WIN, NULL);
- if (stream == NULL) {
- RETURN_FALSE;
- }
- } else {
- ctx = ecalloc(1, sizeof(gdIOCtx));
- ctx->putC = _php_image_output_putc;
- ctx->putBuf = _php_image_output_putbuf;
- ctx->gd_free = _php_image_output_ctxfree;
- }
-
- if (!ctx) {
- ctx = ecalloc(1, sizeof(gdIOCtx));
- ctx->putC = _php_image_stream_putc;
- ctx->putBuf = _php_image_stream_putbuf;
- if (close_stream) {
- ctx->gd_free = _php_image_stream_ctxfreeandclose;
- } else {
- ctx->gd_free = _php_image_stream_ctxfree;
- }
- ctx->data = (void *)stream;
- }
-
- switch(image_type) {
- case PHP_GDIMG_TYPE_JPG:
- (*func_p)(im, ctx, q);
- break;
- case PHP_GDIMG_TYPE_WEBP:
- if (q == -1) {
- q = 80;
- }
- (*func_p)(im, ctx, q);
- break;
- case PHP_GDIMG_TYPE_PNG:
- (*func_p)(im, ctx, q, f);
- break;
- case PHP_GDIMG_TYPE_XBM:
- case PHP_GDIMG_TYPE_WBM:
- if (argc < 3) {
- for(i=0; i < gdImageColorsTotal(im); i++) {
- if(!gdImageRed(im, i) && !gdImageGreen(im, i) && !gdImageBlue(im, i)) break;
- }
- q = i;
- }
- if (image_type == PHP_GDIMG_TYPE_XBM) {
- (*func_p)(im, file ? file : "", q, ctx);
- } else {
- (*func_p)(im, q, ctx);
- }
- break;
- case PHP_GDIMG_TYPE_BMP:
- (*func_p)(im, ctx, (int) compressed);
- break;
- default:
- (*func_p)(im, ctx);
- break;
- }
-
- ctx->gd_free(ctx);
-
- RETURN_TRUE;
-}
-/* }}} */
diff --git a/ext/gd/libgd/gd.h b/ext/gd/libgd/gd.h
index 461024f0f7..cddd6c1f7a 100644
--- a/ext/gd/libgd/gd.h
+++ b/ext/gd/libgd/gd.h
@@ -902,7 +902,7 @@ int gdTransformAffineBoundingBox(gdRectPtr src, const double affine[6], gdRectPt
#define GD_CMP_IMAGE 1 /* Actual image IS different */
-#define GD_CMP_NUM_COLORS 2 /* Number of Colours in pallette differ */
+#define GD_CMP_NUM_COLORS 2 /* Number of Colours in palette differ */
#define GD_CMP_COLOR 4 /* Image colours differ */
#define GD_CMP_SIZE_X 8 /* Image width differs */
#define GD_CMP_SIZE_Y 16 /* Image heights differ */
diff --git a/ext/gd/libgd/gd_gd.c b/ext/gd/libgd/gd_gd.c
index 81a957d414..d5fe16a9af 100644
--- a/ext/gd/libgd/gd_gd.c
+++ b/ext/gd/libgd/gd_gd.c
@@ -59,7 +59,7 @@ int _gdGetColors (gdIOCtx * in, gdImagePtr im, int gd2xFlag)
}
}
- GD2_DBG(printf("Pallette had %d colours (T=%d)\n", im->colorsTotal, im->transparent));
+ GD2_DBG(printf("Palette had %d colours (T=%d)\n", im->colorsTotal, im->transparent));
if (im->trueColor) {
return TRUE;
diff --git a/ext/gd/libgd/gd_interpolation.c b/ext/gd/libgd/gd_interpolation.c
index 698e407fbf..651c92467a 100644
--- a/ext/gd/libgd/gd_interpolation.c
+++ b/ext/gd/libgd/gd_interpolation.c
@@ -1771,8 +1771,8 @@ gdImagePtr gdImageRotateBilinear(gdImagePtr src, const float degrees, const int
const gdFixed f_j = gd_itofx((int)j - (int)new_width/2);
const gdFixed f_m = gd_mulfx(f_j,f_sin) + gd_mulfx(f_i,f_cos) + f_0_5 + f_H;
const gdFixed f_n = gd_mulfx(f_j,f_cos) - gd_mulfx(f_i,f_sin) + f_0_5 + f_W;
- const unsigned int m = gd_fxtoi(f_m);
- const unsigned int n = gd_fxtoi(f_n);
+ const int m = gd_fxtoi(f_m);
+ const int n = gd_fxtoi(f_n);
if ((m >= 0) && (m < src_h - 1) && (n >= 0) && (n < src_w - 1)) {
const gdFixed f_f = f_m - gd_itofx(m);
@@ -2302,7 +2302,6 @@ int gdTransformAffineCopy(gdImagePtr dst,
int backup_clipx1, backup_clipy1, backup_clipx2, backup_clipy2;
register int x, y, src_offset_x, src_offset_y;
double inv[6];
- int *dst_p;
gdPointF pt, src_pt;
gdRect bbox;
int end_x, end_y;
@@ -2365,11 +2364,18 @@ int gdTransformAffineCopy(gdImagePtr dst,
}
} else {
for (y = 0; y <= end_y; y++) {
+ unsigned char *dst_p = NULL;
+ int *tdst_p = NULL;
+
pt.y = y + 0.5 + bbox.y;
if ((dst_y + y) < 0 || ((dst_y + y) > gdImageSY(dst) -1)) {
continue;
}
- dst_p = dst->tpixels[dst_y + y] + dst_x;
+ if (dst->trueColor) {
+ tdst_p = dst->tpixels[dst_y + y] + dst_x;
+ } else {
+ dst_p = dst->pixels[dst_y + y] + dst_x;
+ }
for (x = 0; x <= end_x; x++) {
pt.x = x + 0.5 + bbox.x;
@@ -2378,7 +2384,11 @@ int gdTransformAffineCopy(gdImagePtr dst,
if ((dst_x + x) < 0 || (dst_x + x) > (gdImageSX(dst) - 1)) {
break;
}
- *(dst_p++) = getPixelInterpolated(src, src_offset_x + src_pt.x, src_offset_y + src_pt.y, -1);
+ if (dst->trueColor) {
+ *(tdst_p++) = getPixelInterpolated(src, src_offset_x + src_pt.x, src_offset_y + src_pt.y, -1);
+ } else {
+ *(dst_p++) = getPixelInterpolated(src, src_offset_x + src_pt.x, src_offset_y + src_pt.y, -1);
+ }
}
}
}
@@ -2524,6 +2534,29 @@ int gdImageSetInterpolationMethod(gdImagePtr im, gdInterpolationMethod id)
return 1;
}
+/**
+ * Function: gdImageGetInterpolationMethod
+ *
+ * Get the current interpolation method
+ *
+ * This is here so that the value can be read via a language or VM with an FFI
+ * but no (portable) way to extract the value from the struct.
+ *
+ * Parameters:
+ * im - The image.
+ *
+ * Returns:
+ * The current interpolation method.
+ *
+ * See also:
+ * - <gdInterpolationMethod>
+ * - <gdImageSetInterpolationMethod>
+ */
+gdInterpolationMethod gdImageGetInterpolationMethod(gdImagePtr im)
+{
+ return im->interpolation_id;
+}
+
#ifdef _MSC_VER
# pragma optimize("", on)
#endif
diff --git a/ext/gd/libgd/gd_matrix.c b/ext/gd/libgd/gd_matrix.c
index d2dfbd2d16..ec40674833 100644
--- a/ext/gd/libgd/gd_matrix.c
+++ b/ext/gd/libgd/gd_matrix.c
@@ -29,8 +29,6 @@ int gdAffineApplyToPointF (gdPointFPtr dst, const gdPointFPtr src,
{
double x = src->x;
double y = src->y;
- x = src->x;
- y = src->y;
dst->x = x * affine[0] + y * affine[2] + affine[4];
dst->y = x * affine[1] + y * affine[3] + affine[5];
return GD_TRUE;
diff --git a/ext/gd/libgd/gd_security.c b/ext/gd/libgd/gd_security.c
index 2a7d4a032a..438a564ff1 100644
--- a/ext/gd/libgd/gd_security.c
+++ b/ext/gd/libgd/gd_security.c
@@ -21,11 +21,11 @@
int overflow2(int a, int b)
{
if(a <= 0 || b <= 0) {
- gd_error("one parameter to a memory allocation multiplication is negative or zero, failing operation gracefully\n");
+ gd_error("One parameter to a memory allocation multiplication is negative or zero, failing operation gracefully\n");
return 1;
}
if(a > INT_MAX / b) {
- gd_error("product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully\n");
+ gd_error("Product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully\n");
return 1;
}
return 0;
diff --git a/ext/gd/libgd/gd_tga.c b/ext/gd/libgd/gd_tga.c
index 67e77f7b98..125a698f24 100644
--- a/ext/gd/libgd/gd_tga.c
+++ b/ext/gd/libgd/gd_tga.c
@@ -141,7 +141,7 @@ gdImagePtr gdImageCreateFromTgaCtx(gdIOCtx* ctx)
* Reads the header block from a binary TGA file populating the referenced TGA structure.
* \param ctx Pointer to TGA binary file
* \param tga Pointer to TGA structure
- * \return int 1 on sucess, -1 on failure
+ * \return int 1 on success, -1 on failure
*/
int read_header_tga(gdIOCtx *ctx, oTga *tga)
{
@@ -149,7 +149,7 @@ int read_header_tga(gdIOCtx *ctx, oTga *tga)
unsigned char header[18];
if (gdGetBuf(header, sizeof(header), ctx) < 18) {
- gd_error("fail to read header");
+ gd_error("Fail to read header");
return -1;
}
@@ -201,7 +201,7 @@ int read_header_tga(gdIOCtx *ctx, oTga *tga)
* Reads the image data block from a binary TGA file populating the referenced TGA structure.
* \param ctx Pointer to TGA binary file
* \param tga Pointer to TGA structure
- * \return int 0 on sucess, -1 on failure
+ * \return int 0 on success, -1 on failure
*/
int read_image_tga( gdIOCtx *ctx, oTga *tga )
{
diff --git a/ext/gd/libgd/gd_xbm.c b/ext/gd/libgd/gd_xbm.c
index dae2e62152..0be7c2352b 100644
--- a/ext/gd/libgd/gd_xbm.c
+++ b/ext/gd/libgd/gd_xbm.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -137,7 +135,7 @@ gdImagePtr gdImageCreateFromXbm(FILE * fd)
h[3] = ch;
}
if (sscanf(h, "%x", &b) != 1) {
- gd_error("invalid XBM");
+ gd_error("Invalid XBM");
gdImageDestroy(im);
return 0;
}
diff --git a/ext/gd/libgd/gdtest.c b/ext/gd/libgd/gdtest.c
index 24b7503864..ba036b83d9 100644
--- a/ext/gd/libgd/gdtest.c
+++ b/ext/gd/libgd/gdtest.c
@@ -384,7 +384,7 @@ CompareImages (char *msg, gdImagePtr im1, gdImagePtr im2)
if (cmpRes & GD_CMP_NUM_COLORS)
{
- printf ("-%s: INFO number of pallette entries differ %d Vs. %d\n", msg,
+ printf ("-%s: INFO number of palette entries differ %d Vs. %d\n", msg,
im1->colorsTotal, im2->colorsTotal);
}
diff --git a/ext/gd/php_gd.h b/ext/gd/php_gd.h
index 4f5116335b..d429530479 100644
--- a/ext/gd/php_gd.h
+++ b/ext/gd/php_gd.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -35,7 +33,6 @@
#define PHP_GDIMG_TYPE_WBM 4
#define PHP_GDIMG_TYPE_XBM 5
#define PHP_GDIMG_TYPE_XPM 6
-#define PHP_GDIMG_CONVERT_WBM 7
#define PHP_GDIMG_TYPE_GD 8
#define PHP_GDIMG_TYPE_GD2 9
#define PHP_GDIMG_TYPE_GD2PART 10
@@ -137,6 +134,7 @@ PHP_FUNCTION(imagescale);
PHP_FUNCTION(imageaffine);
PHP_FUNCTION(imageaffinematrixget);
PHP_FUNCTION(imageaffinematrixconcat);
+PHP_FUNCTION(imagegetinterpolation);
PHP_FUNCTION(imagesetinterpolation);
PHP_FUNCTION(imagesetthickness);
@@ -202,10 +200,6 @@ PHP_FUNCTION(imagedashedline);
PHP_FUNCTION(imagettfbbox);
PHP_FUNCTION(imagettftext);
-PHP_FUNCTION(jpeg2wbmp);
-PHP_FUNCTION(png2wbmp);
-PHP_FUNCTION(image2wbmp);
-
PHP_FUNCTION(imagecolormatch);
PHP_FUNCTION(imagelayereffect);
diff --git a/ext/gd/tests/001-mb.phpt b/ext/gd/tests/001-mb.phpt
index 8ee2e9a415..c34c232d0a 100644
--- a/ext/gd/tests/001-mb.phpt
+++ b/ext/gd/tests/001-mb.phpt
@@ -17,7 +17,7 @@ var_dump(imagecreatefrompng($file));
echo "Done\n";
?>
--EXPECTF--
-Warning: imagecreatefrompng(%s001ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.test): failed to open stream: No such file or directory in %s on line %d
+Warning: imagecreatefrompng(%s001ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.test): Failed to open stream: No such file or directory in %s on line %d
bool(false)
Warning: imagecreatefrompng(): '%s001ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.test' is not a valid PNG file in %s on line %d
diff --git a/ext/gd/tests/001.phpt b/ext/gd/tests/001.phpt
index b820ac1cc0..75dbcc0d47 100644
--- a/ext/gd/tests/001.phpt
+++ b/ext/gd/tests/001.phpt
@@ -17,7 +17,7 @@ var_dump(imagecreatefrompng($file));
echo "Done\n";
?>
--EXPECTF--
-Warning: imagecreatefrompng(%s001.test): failed to open stream: No such file or directory in %s on line %d
+Warning: imagecreatefrompng(%s001.test): Failed to open stream: No such file or directory in %s on line %d
bool(false)
Warning: imagecreatefrompng(): '%s001.test' is not a valid PNG file in %s on line %d
diff --git a/ext/gd/tests/bug22544-mb.phpt b/ext/gd/tests/bug22544-mb.phpt
index 0847214dc3..ae347edd70 100644
--- a/ext/gd/tests/bug22544-mb.phpt
+++ b/ext/gd/tests/bug22544-mb.phpt
@@ -8,13 +8,13 @@ Bug #22544 (TrueColor transparency in PNG images).
?>
--FILE--
<?php
- $image = imageCreateTruecolor(640, 100);
- $transparent = imageColorAllocate($image, 0, 0, 0);
- $red = imageColorAllocate($image, 255, 50, 50);
- imageColorTransparent($image, $transparent);
- imageFilledRectangle($image, 0, 0, 640-1, 100-1, $transparent);
- include_once __DIR__ . '/func.inc';
- test_image_equals_file(__DIR__ . '/bug22544ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.png', $image);
+ $image = imageCreateTruecolor(640, 100);
+ $transparent = imageColorAllocate($image, 0, 0, 0);
+ $red = imageColorAllocate($image, 255, 50, 50);
+ imageColorTransparent($image, $transparent);
+ imageFilledRectangle($image, 0, 0, 640-1, 100-1, $transparent);
+ include_once __DIR__ . '/func.inc';
+ test_image_equals_file(__DIR__ . '/bug22544ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.png', $image);
?>
--EXPECT--
The images are equal.
diff --git a/ext/gd/tests/bug22544.phpt b/ext/gd/tests/bug22544.phpt
index 3d4335d461..c7b1e91966 100644
--- a/ext/gd/tests/bug22544.phpt
+++ b/ext/gd/tests/bug22544.phpt
@@ -8,13 +8,13 @@ Bug #22544 (TrueColor transparency in PNG images).
?>
--FILE--
<?php
- $image = imageCreateTruecolor(640, 100);
- $transparent = imageColorAllocate($image, 0, 0, 0);
- $red = imageColorAllocate($image, 255, 50, 50);
- imageColorTransparent($image, $transparent);
- imageFilledRectangle($image, 0, 0, 640-1, 100-1, $transparent);
- include_once __DIR__ . '/func.inc';
- test_image_equals_file(__DIR__ . '/bug22544.png', $image);
+ $image = imageCreateTruecolor(640, 100);
+ $transparent = imageColorAllocate($image, 0, 0, 0);
+ $red = imageColorAllocate($image, 255, 50, 50);
+ imageColorTransparent($image, $transparent);
+ imageFilledRectangle($image, 0, 0, 640-1, 100-1, $transparent);
+ include_once __DIR__ . '/func.inc';
+ test_image_equals_file(__DIR__ . '/bug22544.png', $image);
?>
--EXPECT--
The images are equal.
diff --git a/ext/gd/tests/bug24155.phpt b/ext/gd/tests/bug24155.phpt
index 43d34b7177..ff4f40fdec 100644
--- a/ext/gd/tests/bug24155.phpt
+++ b/ext/gd/tests/bug24155.phpt
@@ -9,22 +9,22 @@ Bug #24155 (gdImageRotate270 rotation problem).
?>
--FILE--
<?php
- $dest = dirname(realpath(__FILE__)) . '/bug24155.png';
- @unlink($dest);
+ $dest = dirname(realpath(__FILE__)) . '/bug24155.png';
+ @unlink($dest);
- $im = imagecreatetruecolor(30, 50);
- imagefill($im, 0, 0, (16777215 - 255));
- $im = imagerotate($im, 270, 255);
- imagepng($im, $dest);
+ $im = imagecreatetruecolor(30, 50);
+ imagefill($im, 0, 0, (16777215 - 255));
+ $im = imagerotate($im, 270, 255);
+ imagepng($im, $dest);
- $im2 = imagecreatefrompng($dest);
+ $im2 = imagecreatefrompng($dest);
- // Uniform fill + n x 90degrees rotation , the color value does not change
- $col = imagecolorat($im2, 20, 20);
- // 16777215 - 255 = 16776960
- echo "$col\n";
+ // Uniform fill + n x 90degrees rotation , the color value does not change
+ $col = imagecolorat($im2, 20, 20);
+ // 16777215 - 255 = 16776960
+ echo "$col\n";
- @unlink($dest);
+ @unlink($dest);
?>
--EXPECT--
16776960
diff --git a/ext/gd/tests/bug24594.phpt b/ext/gd/tests/bug24594.phpt
index f4006497c6..138258cbbc 100644
--- a/ext/gd/tests/bug24594.phpt
+++ b/ext/gd/tests/bug24594.phpt
@@ -8,74 +8,74 @@ Bug #24594 (Filling an area using tiles).
?>
--FILE--
<?php
- $tile = imagecreate(36,36);
- $base = imagecreate(150,150);
- $white = imagecolorallocate($tile,255,255,255);
- $black = imagecolorallocate($tile,0,0,0);
- $white = imagecolorallocate($base,255,255,255);
- $black = imagecolorallocate($base,0,0,0);
+ $tile = imagecreate(36,36);
+ $base = imagecreate(150,150);
+ $white = imagecolorallocate($tile,255,255,255);
+ $black = imagecolorallocate($tile,0,0,0);
+ $white = imagecolorallocate($base,255,255,255);
+ $black = imagecolorallocate($base,0,0,0);
- /* create the dots pattern */
- for ($x=0;$x<36;$x+=2) {
- for ($y=0;$y<36;$y+=2) {
- imagesetpixel($tile,$x,$y,$black);
- }
- }
+ /* create the dots pattern */
+ for ($x=0;$x<36;$x+=2) {
+ for ($y=0;$y<36;$y+=2) {
+ imagesetpixel($tile,$x,$y,$black);
+ }
+ }
- imagesettile($base,$tile);
- imagerectangle($base, 9,9,139,139,$black);
- imageline($base, 9,9,139,139,$black);
- imagefill($base,11,12,IMG_COLOR_TILED);
+ imagesettile($base,$tile);
+ imagerectangle($base, 9,9,139,139,$black);
+ imageline($base, 9,9,139,139,$black);
+ imagefill($base,11,12,IMG_COLOR_TILED);
- $res = imagecolorat($base,0,10)==$black?'1':'0';
- $res .= imagecolorat($base,0,20)==$black?'1':'0';
- $res .= imagecolorat($base,0,30)==$black?'1':'0';
- $res .= imagecolorat($base,0,40)==$black?'1':'0';
- $res .= imagecolorat($base,0,50)==$black?'1':'0';
- $res .= imagecolorat($base,0,60)==$black?'1':'0';
+ $res = imagecolorat($base,0,10)==$black?'1':'0';
+ $res .= imagecolorat($base,0,20)==$black?'1':'0';
+ $res .= imagecolorat($base,0,30)==$black?'1':'0';
+ $res .= imagecolorat($base,0,40)==$black?'1':'0';
+ $res .= imagecolorat($base,0,50)==$black?'1':'0';
+ $res .= imagecolorat($base,0,60)==$black?'1':'0';
- $res .= imagecolorat($base,11,12)==$white?'1':'0';
- $res .= imagecolorat($base,12,13)==$white?'1':'0';
- $res .= imagecolorat($base,13,14)==$white?'1':'0';
- $res .= imagecolorat($base,14,15)==$white?'1':'0';
- $res .= imagecolorat($base,15,16)==$white?'1':'0';
- $res .= imagecolorat($base,16,17)==$white?'1':'0';
+ $res .= imagecolorat($base,11,12)==$white?'1':'0';
+ $res .= imagecolorat($base,12,13)==$white?'1':'0';
+ $res .= imagecolorat($base,13,14)==$white?'1':'0';
+ $res .= imagecolorat($base,14,15)==$white?'1':'0';
+ $res .= imagecolorat($base,15,16)==$white?'1':'0';
+ $res .= imagecolorat($base,16,17)==$white?'1':'0';
- $res .= imagecolorat($base,10,12)==$black?'1':'0';
- $res .= imagecolorat($base,11,13)==$black?'1':'0';
- $res .= imagecolorat($base,12,14)==$black?'1':'0';
- $res .= imagecolorat($base,13,15)==$black?'1':'0';
- $res .= imagecolorat($base,14,16)==$black?'1':'0';
- $res .= imagecolorat($base,15,17)==$black?'1':'0';
- echo "$res\n";
+ $res .= imagecolorat($base,10,12)==$black?'1':'0';
+ $res .= imagecolorat($base,11,13)==$black?'1':'0';
+ $res .= imagecolorat($base,12,14)==$black?'1':'0';
+ $res .= imagecolorat($base,13,15)==$black?'1':'0';
+ $res .= imagecolorat($base,14,16)==$black?'1':'0';
+ $res .= imagecolorat($base,15,17)==$black?'1':'0';
+ echo "$res\n";
- imagefilledrectangle($base,0,0,149,149,$white);
- imagerectangle($base, 9,9,139,139,$black);
- imageline($base, 9,9,139,139,$black);
- imagefill($base,0,0,IMG_COLOR_TILED);
+ imagefilledrectangle($base,0,0,149,149,$white);
+ imagerectangle($base, 9,9,139,139,$black);
+ imageline($base, 9,9,139,139,$black);
+ imagefill($base,0,0,IMG_COLOR_TILED);
- $res = imagecolorat($base,0,10)==$black?'1':'0';
- $res .= imagecolorat($base,0,20)==$black?'1':'0';
- $res .= imagecolorat($base,0,30)==$black?'1':'0';
- $res .= imagecolorat($base,0,40)==$black?'1':'0';
- $res .= imagecolorat($base,0,50)==$black?'1':'0';
- $res .= imagecolorat($base,0,60)==$black?'1':'0';
+ $res = imagecolorat($base,0,10)==$black?'1':'0';
+ $res .= imagecolorat($base,0,20)==$black?'1':'0';
+ $res .= imagecolorat($base,0,30)==$black?'1':'0';
+ $res .= imagecolorat($base,0,40)==$black?'1':'0';
+ $res .= imagecolorat($base,0,50)==$black?'1':'0';
+ $res .= imagecolorat($base,0,60)==$black?'1':'0';
- $res .= imagecolorat($base,11,12)==$white?'1':'0';
- $res .= imagecolorat($base,12,13)==$white?'1':'0';
- $res .= imagecolorat($base,13,14)==$white?'1':'0';
- $res .= imagecolorat($base,14,15)==$white?'1':'0';
- $res .= imagecolorat($base,15,16)==$white?'1':'0';
- $res .= imagecolorat($base,16,17)==$white?'1':'0';
+ $res .= imagecolorat($base,11,12)==$white?'1':'0';
+ $res .= imagecolorat($base,12,13)==$white?'1':'0';
+ $res .= imagecolorat($base,13,14)==$white?'1':'0';
+ $res .= imagecolorat($base,14,15)==$white?'1':'0';
+ $res .= imagecolorat($base,15,16)==$white?'1':'0';
+ $res .= imagecolorat($base,16,17)==$white?'1':'0';
- $res .= imagecolorat($base,0,16)==$black?'1':'0';
- $res .= imagecolorat($base,2,42)==$black?'1':'0';
- $res .= imagecolorat($base,4,44)==$black?'1':'0';
- $res .= imagecolorat($base,146,146)==$black?'1':'0';
- $res .= imagecolorat($base,148,146)==$black?'1':'0';
- $res .= imagecolorat($base,0,0)==$black?'1':'0';
+ $res .= imagecolorat($base,0,16)==$black?'1':'0';
+ $res .= imagecolorat($base,2,42)==$black?'1':'0';
+ $res .= imagecolorat($base,4,44)==$black?'1':'0';
+ $res .= imagecolorat($base,146,146)==$black?'1':'0';
+ $res .= imagecolorat($base,148,146)==$black?'1':'0';
+ $res .= imagecolorat($base,0,0)==$black?'1':'0';
- echo "$res\n";
+ echo "$res\n";
?>
--EXPECT--
000000111111101010
diff --git a/ext/gd/tests/bug38212-mb.phpt b/ext/gd/tests/bug38212-mb.phpt
index a7a3d65f13..d69d604e5d 100644
--- a/ext/gd/tests/bug38212-mb.phpt
+++ b/ext/gd/tests/bug38212-mb.phpt
@@ -6,12 +6,20 @@ Bug #38212 (Seg Fault on invalid imagecreatefromgd2part() parameters)
?>
--FILE--
<?php
+require __DIR__ . '/func.inc';
+
$file = __DIR__ . '/bug38212ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.gd2';
$im1 = imagecreatetruecolor(10,100);
imagefill($im1, 0,0, 0xffffff);
imagegd2($im1, $file);
-$im = imagecreatefromgd2part($file, 0,0, -25,10);
+
+trycatch_dump(
+ fn() => imagecreatefromgd2part($file, 0,0, -25, 10),
+ fn() => imagecreatefromgd2part($file, 0,0, 10, -25)
+);
+
unlink($file);
?>
---EXPECTF--
-Warning: imagecreatefromgd2part(): Zero width or height not allowed in %s on line %d
+--EXPECT--
+!! [ValueError] Width must be at least 1
+!! [ValueError] Height must be at least 1
diff --git a/ext/gd/tests/bug38212.phpt b/ext/gd/tests/bug38212.phpt
index 039c6f971b..8645989e09 100644
--- a/ext/gd/tests/bug38212.phpt
+++ b/ext/gd/tests/bug38212.phpt
@@ -6,12 +6,20 @@ Bug #38212 (Seg Fault on invalid imagecreatefromgd2part() parameters)
?>
--FILE--
<?php
+require __DIR__ . '/func.inc';
+
$file = __DIR__ . '/bug38212.gd2';
$im1 = imagecreatetruecolor(10,100);
imagefill($im1, 0,0, 0xffffff);
imagegd2($im1, $file);
-$im = imagecreatefromgd2part($file, 0,0, -25,10);
+
+trycatch_dump(
+ fn() => imagecreatefromgd2part($file, 0,0, -25, 10),
+ fn() => imagecreatefromgd2part($file, 0,0, 10, -25)
+);
+
unlink($file);
?>
---EXPECTF--
-Warning: imagecreatefromgd2part(): Zero width or height not allowed in %s on line %d
+--EXPECT--
+!! [ValueError] Width must be at least 1
+!! [ValueError] Height must be at least 1
diff --git a/ext/gd/tests/bug39286-mb.phpt b/ext/gd/tests/bug39286-mb.phpt
deleted file mode 100644
index 87390cb489..0000000000
--- a/ext/gd/tests/bug39286-mb.phpt
+++ /dev/null
@@ -1,12 +0,0 @@
---TEST--
-Bug #39508 (imagefill crashes with small images 3 pixels or less)
---SKIPIF--
-<?php
- if (!extension_loaded('gd')) die("skip gd extension not available\n");
-?>
---FILE--
-<?php
-$img =imagecreatefromgd2part("fooç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.png",0, 100, 0, 100);
-?>
---EXPECTF--
-Warning: imagecreatefromgd2part(): Zero width or height not allowed in %s on line %d
diff --git a/ext/gd/tests/bug39286.phpt b/ext/gd/tests/bug39286.phpt
deleted file mode 100644
index 4fe4769a7b..0000000000
--- a/ext/gd/tests/bug39286.phpt
+++ /dev/null
@@ -1,12 +0,0 @@
---TEST--
-Bug #39508 (imagefill crashes with small images 3 pixels or less)
---SKIPIF--
-<?php
- if (!extension_loaded('gd')) die("skip gd extension not available\n");
-?>
---FILE--
-<?php
-$img =imagecreatefromgd2part("foo.png",0, 100, 0, 100);
-?>
---EXPECTF--
-Warning: imagecreatefromgd2part(): Zero width or height not allowed in %s on line %d
diff --git a/ext/gd/tests/bug41442.phpt b/ext/gd/tests/bug41442.phpt
index 5c590deb77..351734931a 100644
--- a/ext/gd/tests/bug41442.phpt
+++ b/ext/gd/tests/bug41442.phpt
@@ -31,7 +31,9 @@ var_dump(imagecreatefromstring($str2));
echo "Done\n";
?>
---EXPECTF--
-resource(%d) of type (gd)
-resource(%d) of type (gd)
+--EXPECT--
+object(GdImage)#2 (0) {
+}
+object(GdImage)#2 (0) {
+}
Done
diff --git a/ext/gd/tests/bug42434.phpt b/ext/gd/tests/bug42434.phpt
index 8f5205d936..3db42a228e 100644
--- a/ext/gd/tests/bug42434.phpt
+++ b/ext/gd/tests/bug42434.phpt
@@ -15,9 +15,9 @@ imageantialias($im, true);
imageline($im, 0, 0, 10, 0, 0x000000);
if (imagecolorat($im, 9, 0) == 0x000000) {
- echo 'DONE';
+ echo 'DONE';
} else {
- echo 'Bugged';
+ echo 'Bugged';
}
imagedestroy($im);
diff --git a/ext/gd/tests/bug43073.phpt b/ext/gd/tests/bug43073.phpt
index a8027338ef..74641496de 100644
--- a/ext/gd/tests/bug43073.phpt
+++ b/ext/gd/tests/bug43073.phpt
@@ -8,22 +8,22 @@ Bug #43073 (TrueType bounding box is wrong for angle<>0)
--FILE--
<?php
$exp = [
- [501,400, 611,400, 611,376, 501,376],
- [492,361, 595,319, 586,296, 483,338],
- [470,329, 549,251, 531,233, 453,312],
- [439,307, 481,204, 458,195, 416,297],
- [400,299, 400,189, 376,189, 376,299],
- [361,307, 319,204, 296,213, 338,316],
- [329,329, 251,250, 233,267, 311,346],
- [307,360, 204,318, 195,341, 297,383],
- [299,400, 189,400, 189,424, 299,424],
- [307,438, 204,480, 213,503, 316,461],
- [329,470, 250,548, 267,566, 346,488],
- [360,492, 318,595, 341,604, 383,502],
- [400,501, 400,611, 424,611, 424,501],
- [438,492, 480,595, 503,586, 461,483],
- [470,470, 548,549, 566,532, 488,453],
- [492,439, 595,481, 604,458, 502,416]
+ [501,400, 611,400, 611,376, 501,376],
+ [492,361, 595,319, 586,296, 483,338],
+ [470,329, 549,251, 531,233, 453,312],
+ [439,307, 481,204, 458,195, 416,297],
+ [400,299, 400,189, 376,189, 376,299],
+ [361,307, 319,204, 296,213, 338,316],
+ [329,329, 251,250, 233,267, 311,346],
+ [307,360, 204,318, 195,341, 297,383],
+ [299,400, 189,400, 189,424, 299,424],
+ [307,438, 204,480, 213,503, 316,461],
+ [329,470, 250,548, 267,566, 346,488],
+ [360,492, 318,595, 341,604, 383,502],
+ [400,501, 400,611, 424,611, 424,501],
+ [438,492, 480,595, 503,586, 461,483],
+ [470,470, 548,549, 566,532, 488,453],
+ [492,439, 595,481, 604,458, 502,416]
];
$cwd = __DIR__;
$font = "$cwd/Tuffy.ttf";
@@ -38,14 +38,14 @@ $cos_t = cos(deg2rad($delta_t));
$sin_t = sin(deg2rad($delta_t));
for ($angle = 0.0, $i = 0; $angle < 360.0; $angle += $delta_t, $i++) {
$bbox = imagettftext($g, 24, $angle, 400+$x, 400+$y, $black, $font, 'ABCDEF');
- imagepolygon($g, $bbox, 4, $red);
+ imagepolygon($g, $bbox, $red);
printf("%2d: ", $i);
for ($j = 0; $j < 8; $j++) {
- if ($bbox[$j] >= $exp[$i][$j] - 1 && $bbox[$j] <= $exp[$i][$j] + 1) {
- echo '.';
- } else {
- echo "(expected $exp[$i][$j], got $bbox[$j])";
- }
+ if ($bbox[$j] >= $exp[$i][$j] - 1 && $bbox[$j] <= $exp[$i][$j] + 1) {
+ echo '.';
+ } else {
+ echo "(expected $exp[$i][$j], got $bbox[$j])";
+ }
}
echo "\n";
$temp = $cos_t * $x + $sin_t * $y;
diff --git a/ext/gd/tests/bug43475.phpt b/ext/gd/tests/bug43475.phpt
index f0302d45ef..9264299181 100644
--- a/ext/gd/tests/bug43475.phpt
+++ b/ext/gd/tests/bug43475.phpt
@@ -13,22 +13,22 @@ require_once __DIR__ . '/similarity.inc';
function setStyleAndThickness($im, $color, $thickness)
{
- $style = array();
- $i = 0;
- while ($i < 16 * $thickness) {
- $style[$i++] = $color;
- }
- while ($i < 20 * $thickness) {
- $style[$i++] = IMG_COLOR_TRANSPARENT;
- }
- while ($i < 28 * $thickness) {
- $style[$i++] = $color;
- }
- while ($i < 32 * $thickness) {
- $style[$i++] = IMG_COLOR_TRANSPARENT;
- }
- imagesetstyle($im, $style);
- imagesetthickness($im, $thickness);
+ $style = array();
+ $i = 0;
+ while ($i < 16 * $thickness) {
+ $style[$i++] = $color;
+ }
+ while ($i < 20 * $thickness) {
+ $style[$i++] = IMG_COLOR_TRANSPARENT;
+ }
+ while ($i < 28 * $thickness) {
+ $style[$i++] = $color;
+ }
+ while ($i < 32 * $thickness) {
+ $style[$i++] = IMG_COLOR_TRANSPARENT;
+ }
+ imagesetstyle($im, $style);
+ imagesetthickness($im, $thickness);
}
$im = imagecreate(800, 800);
diff --git a/ext/gd/tests/bug44849.phpt b/ext/gd/tests/bug44849.phpt
index 368a08a242..22e8a65ec4 100644
--- a/ext/gd/tests/bug44849.phpt
+++ b/ext/gd/tests/bug44849.phpt
@@ -6,7 +6,7 @@ Bug #44849 (imagecolorclosesthwb is not available on Windows)
?>
--FILE--
<?php
- var_dump(function_exists('imagecolorclosesthwb'));
+ var_dump(function_exists('imagecolorclosesthwb'));
?>
--EXPECT--
bool(true)
diff --git a/ext/gd/tests/bug47946.phpt b/ext/gd/tests/bug47946.phpt
index c329094863..8c262eaabd 100644
--- a/ext/gd/tests/bug47946.phpt
+++ b/ext/gd/tests/bug47946.phpt
@@ -43,7 +43,5 @@ makeFilter($im, $edgeMatrix);
require_once __DIR__ . '/func.inc';
test_image_equals_file(__DIR__ . '/bug47946_exp.png', $im);
?>
-===DONE===
--EXPECT--
The images are equal.
-===DONE===
diff --git a/ext/gd/tests/bug49600.phpt b/ext/gd/tests/bug49600.phpt
index 25fae3ca37..79830be71f 100644
--- a/ext/gd/tests/bug49600.phpt
+++ b/ext/gd/tests/bug49600.phpt
@@ -15,7 +15,7 @@ $color = imagecolorallocate($image, 255, 255, 255);
foreach (array("E", "I", "P", "g", "i", "q") as $c)
{
$x = imagettftext($image, 32, 0, 0, 0, $color, $font, $c);
- $y = imagettfbbox(32, 0, "$cwd/Tuffy.ttf", $c);
+ $y = imagettfbbox(32, 0, "$cwd/Tuffy.ttf", $c);
if ( abs($x[0] - $y[0]) > 1
|| abs($x[2] - $y[2]) > 1
|| abs($x[4] - $y[4]) > 1
diff --git a/ext/gd/tests/bug50194.phpt b/ext/gd/tests/bug50194.phpt
index 0ccab83063..2815ee1609 100644
--- a/ext/gd/tests/bug50194.phpt
+++ b/ext/gd/tests/bug50194.phpt
@@ -32,7 +32,5 @@ if (isset($matches[1]) && $matches[1] > 2000) {
imagedestroy($im);
?>
-===DONE===
--EXPECT--
The images are similar.
-===DONE===
diff --git a/ext/gd/tests/bug52070.phpt b/ext/gd/tests/bug52070.phpt
index d44a527479..4ff97c909c 100644
--- a/ext/gd/tests/bug52070.phpt
+++ b/ext/gd/tests/bug52070.phpt
@@ -19,7 +19,5 @@ imagedashedline($im, 800, 400, 800, 800, $color);
include_once __DIR__ . '/func.inc';
test_image_equals_file(__DIR__ . '/bug52070.png', $im);
?>
-===DONE===
--EXPECT--
The images are equal.
-===DONE===
diff --git a/ext/gd/tests/bug53504.phpt b/ext/gd/tests/bug53504.phpt
index 3b2ce4c7eb..11e7a8af57 100644
--- a/ext/gd/tests/bug53504.phpt
+++ b/ext/gd/tests/bug53504.phpt
@@ -51,16 +51,16 @@ $tests = [
foreach ($tests as $testnum => $test) {
$bbox = imageftbbox($test['fontSize'], $test['angle'], $font, $test['text']);
- printf('%2d: ', $testnum);
- for ($i = 0; $i < 8; $i++) {
- $exp = $test['exp'][$i];
- if ($bbox[$i] >= $exp - 2 && $bbox[$i] <= $exp + 2) {
- echo '.';
- } else {
- echo "(expected $exp, got $bbox[$i])";
- }
- }
- echo "\n";
+ printf('%2d: ', $testnum);
+ for ($i = 0; $i < 8; $i++) {
+ $exp = $test['exp'][$i];
+ if ($bbox[$i] >= $exp - 2 && $bbox[$i] <= $exp + 2) {
+ echo '.';
+ } else {
+ echo "(expected $exp, got $bbox[$i])";
+ }
+ }
+ echo "\n";
$bboxDrawn = imagefttext($g, $test['fontSize'], $test['angle'],
$test['x'], $test['y'], $black, $font, $test['text']);
@@ -72,7 +72,7 @@ foreach ($tests as $testnum => $test) {
}
// draw bounding box:
- imagepolygon($g, $bboxDrawn, 4, $red);
+ imagepolygon($g, $bboxDrawn, $red);
// draw baseline:
$width = sqrt(pow($bboxDrawn[2] - $bboxDrawn[0], 2) + pow($bboxDrawn[3] - $bboxDrawn[1], 2));
diff --git a/ext/gd/tests/bug55005.phpt b/ext/gd/tests/bug55005.phpt
new file mode 100644
index 0000000000..38fb25db07
--- /dev/null
+++ b/ext/gd/tests/bug55005.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #55005 (imagepolygon num_points requirement)
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) die('skip gd extension not available');
+?>
+--FILE--
+<?php
+require_once __DIR__ . '/func.inc';
+
+$g = imagecreate(300, 300);
+$bgnd = imagecolorallocate($g, 255, 255, 255);
+$fgnd = imagecolorallocate($g, 0, 0, 0);
+trycatch_dump(
+ fn () => imagefilledpolygon($g, array(100,10, 100,100, 180,100), 2, $fgnd),
+ fn () => imagepolygon($g, array(200,10, 200,100, 280,100), 2, $fgnd)
+);
+?>
+--EXPECTF--
+!! [ValueError] Polygon must have at least 3 points
+!! [ValueError] Polygon must have at least 3 points
diff --git a/ext/gd/tests/bug64641.phpt b/ext/gd/tests/bug64641.phpt
index 713daaf85e..4eb2e28730 100644
--- a/ext/gd/tests/bug64641.phpt
+++ b/ext/gd/tests/bug64641.phpt
@@ -14,24 +14,24 @@ require_once __DIR__ . '/similarity.inc';
$im = imagecreatetruecolor(640, 480);
$points = array(
- 100, 100,
- 100, 200,
- 100, 300
+ 100, 100,
+ 100, 200,
+ 100, 300
);
-imagefilledpolygon($im, $points, 3, 0xFFFF00);
+imagefilledpolygon($im, $points, 0xFFFF00);
$points = array(
- 300, 200,
- 400, 200,
- 500, 200
+ 300, 200,
+ 400, 200,
+ 500, 200
);
-imagefilledpolygon($im, $points, 3, 0xFFFF00);
+imagefilledpolygon($im, $points, 0xFFFF00);
$ex = imagecreatefrompng(__DIR__ . '/bug64641.png');
if (($diss = calc_image_dissimilarity($ex, $im)) < 1e-5) {
- echo "IDENTICAL";
+ echo "IDENTICAL";
} else {
- echo "DISSIMILARITY: $diss";
+ echo "DISSIMILARITY: $diss";
}
imagedestroy($ex);
diff --git a/ext/gd/tests/bug65148.phpt b/ext/gd/tests/bug65148.phpt
index 9effae9714..1ce5480dd6 100644
--- a/ext/gd/tests/bug65148.phpt
+++ b/ext/gd/tests/bug65148.phpt
@@ -45,7 +45,6 @@ foreach ($interpolations as $name => $interpolation) {
imagedestroy($img);
print_r($results);
?>
-===DONE===
--EXPECT--
Array
(
@@ -176,4 +175,3 @@ Array
)
)
-===DONE===
diff --git a/ext/gd/tests/bug66005.phpt b/ext/gd/tests/bug66005.phpt
index 307b06855c..9d63524570 100644
--- a/ext/gd/tests/bug66005.phpt
+++ b/ext/gd/tests/bug66005.phpt
@@ -28,7 +28,5 @@ imagecopy($dest, $png_full, 100, 0, 0, 0, 50, 50);
include_once __DIR__ . '/func.inc';
test_image_equals_file(__DIR__ . '/bug66005.png', $dest);
?>
-==DONE==
--EXPECT--
The images are equal.
-==DONE==
diff --git a/ext/gd/tests/bug66356.phpt b/ext/gd/tests/bug66356.phpt
index 7dbfb1b40e..a255997ca0 100644
--- a/ext/gd/tests/bug66356.phpt
+++ b/ext/gd/tests/bug66356.phpt
@@ -28,8 +28,10 @@ var_dump(imagecrop($img, array("x" => 0x7fffff00, "y" => 0, "width" => 10, "heig
var_dump(imagecrop($img, array("x" => 0, "y" => 0, "width" => 65535, "height" => 65535)));
?>
--EXPECTF--
-resource(%d) of type (gd)
-resource(%d) of type (gd)
+object(GdImage)#2 (0) {
+}
+object(GdImage)#2 (0) {
+}
Array
(
[x] => a
@@ -38,12 +40,14 @@ Array
[height] => 10
)
-Warning: imagecrop(): one parameter to a memory allocation multiplication is negative or zero, failing operation gracefully
- in %sbug66356.php on line %d
+Warning: imagecrop(): One parameter to a memory allocation multiplication is negative or zero, failing operation gracefully
+ in %s on line %d
bool(false)
-resource(%d) of type (gd)
-resource(%d) of type (gd)
+object(GdImage)#2 (0) {
+}
+object(GdImage)#2 (0) {
+}
-Warning: imagecrop(): product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
- in %sbug66356.php on line %d
+Warning: imagecrop(): Product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
+ in %s on line %d
bool(false)
diff --git a/ext/gd/tests/bug67248.phpt b/ext/gd/tests/bug67248.phpt
index 5cae5f8c98..c5b54354f1 100644
--- a/ext/gd/tests/bug67248.phpt
+++ b/ext/gd/tests/bug67248.phpt
@@ -7,21 +7,19 @@ Bug #67248 (imageaffinematrixget missing check of parameters)
?>
--FILE--
<?php
+require __DIR__ . '/func.inc';
+
for($i=0;$i<7;$i++) {
- imageaffinematrixget($i);
+ trycatch_dump(
+ fn() => imageaffinematrixget($i)
+ );
}
?>
---EXPECTF--
-Warning: imageaffinematrixget(): Array expected as options in %s on line %d
-
-Warning: imageaffinematrixget(): Array expected as options in %s on line %d
-
-Warning: imageaffinematrixget(): Number is expected as option in %s on line %d
-
-Warning: imageaffinematrixget(): Number is expected as option in %s on line %d
-
-Warning: imageaffinematrixget(): Number is expected as option in %s on line %d
-
-Warning: imageaffinematrixget(): Invalid type for element 5 in %s on line %d
-
-Warning: imageaffinematrixget(): Invalid type for element 6 in %s on line %d
+--EXPECT--
+!! [TypeError] Array expected as options when using translate or scale
+!! [TypeError] Array expected as options when using translate or scale
+!! [TypeError] Number is expected as option when using rotate or shear
+!! [TypeError] Number is expected as option when using rotate or shear
+!! [TypeError] Number is expected as option when using rotate or shear
+!! [ValueError] Invalid type for element 5
+!! [ValueError] Invalid type for element 6
diff --git a/ext/gd/tests/bug67325.phpt b/ext/gd/tests/bug67325.phpt
index 8290946c0f..fe369ee949 100644
--- a/ext/gd/tests/bug67325.phpt
+++ b/ext/gd/tests/bug67325.phpt
@@ -26,7 +26,5 @@ var_dump($white);
imagedestroy($im);
?>
-===DONE===
--EXPECT--
int(0)
-===DONE===
diff --git a/ext/gd/tests/bug70976.phpt b/ext/gd/tests/bug70976.phpt
index b4f5c9b78b..cd10a8ffc0 100644
--- a/ext/gd/tests/bug70976.phpt
+++ b/ext/gd/tests/bug70976.phpt
@@ -10,4 +10,5 @@ $img = imagerotate(imagecreate(10,10),45,0x7ffffff9);
var_dump($img);
?>
--EXPECT--
-resource(5) of type (gd)
+object(GdImage)#2 (0) {
+}
diff --git a/ext/gd/tests/bug72339.phpt b/ext/gd/tests/bug72339.phpt
index d63ce67c55..bd8054cced 100644
--- a/ext/gd/tests/bug72339.phpt
+++ b/ext/gd/tests/bug72339.phpt
@@ -26,13 +26,13 @@ fclose($fh);
$im = imagecreatefromgd2($fname);
if ($im) {
- imagedestroy($im);
+ imagedestroy($im);
}
unlink($fname);
?>
--EXPECTF--
-Warning: imagecreatefromgd2(): product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
+Warning: imagecreatefromgd2(): Product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
in %sbug72339.php on line %d
Warning: imagecreatefromgd2(): '%sbug72339.gd' is not a valid GD2 file in %sbug72339.php on line %d
diff --git a/ext/gd/tests/bug72482_2.phpt b/ext/gd/tests/bug72482_2.phpt
index a8a08faa53..f9f5833274 100644
--- a/ext/gd/tests/bug72482_2.phpt
+++ b/ext/gd/tests/bug72482_2.phpt
@@ -15,7 +15,5 @@ imageline($im, 0, 0, 10, 10, imagecolorallocate($im, 0, 0, 0));
test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'bug72482_2.png', $im);
?>
-===DONE===
--EXPECT--
The images are equal.
-===DONE===
diff --git a/ext/gd/tests/bug72494.phpt b/ext/gd/tests/bug72494.phpt
index 4cca9aec8e..b01a19179a 100644
--- a/ext/gd/tests/bug72494.phpt
+++ b/ext/gd/tests/bug72494.phpt
@@ -6,10 +6,14 @@ if (!extension_loaded('gd')) die('skip gd extension not available');
?>
--FILE--
<?php
+require __DIR__ . '/func.inc';
+
$im = imagecreate(10,10);
-imagecropauto($im, IMG_CROP_THRESHOLD, 0, 1337);
+
+trycatch_dump(
+ fn() => imagecropauto($im, IMG_CROP_THRESHOLD, 0, 1337)
+);
+
?>
-===DONE===
---EXPECTF--
-Warning: imagecropauto(): Color argument missing with threshold mode in %s on line %d
-===DONE===
+--EXPECT--
+!! [ValueError] Color argument missing with threshold mode
diff --git a/ext/gd/tests/bug72697.phpt b/ext/gd/tests/bug72697.phpt
index 97bd3bdf88..2c293d14be 100644
--- a/ext/gd/tests/bug72697.phpt
+++ b/ext/gd/tests/bug72697.phpt
@@ -8,10 +8,16 @@ if (PHP_INT_MAX !== 9223372036854775807) die("skip for 64-bit long systems only"
--FILE--
<?php
+require __DIR__ . '/func.inc';
+
$img=imagecreatetruecolor(10, 10);
-imagetruecolortopalette($img, false, PHP_INT_MAX / 8);
+
+trycatch_dump(
+ fn() => imagetruecolortopalette($img, false, PHP_INT_MAX / 8)
+);
+
?>
DONE
---EXPECTF--
-Warning: imagetruecolortopalette(): Number of colors has to be greater than zero and no more than 2147483647 in %sbug72697.php on line %d
+--EXPECT--
+!! [ValueError] Number of colors has to be greater than zero and no more than 2147483647
DONE
diff --git a/ext/gd/tests/bug72709.phpt b/ext/gd/tests/bug72709.phpt
index 1c5b1f4ae0..a5b0463f62 100644
--- a/ext/gd/tests/bug72709.phpt
+++ b/ext/gd/tests/bug72709.phpt
@@ -7,12 +7,18 @@ if (!extension_loaded('gd')) die('skip ext/gd not available');
--FILE--
<?php
$im = imagecreatetruecolor(1, 1);
-var_dump(imagesetstyle($im, array()));
+
+try {
+ var_dump(imagesetstyle($im, array()));
+}
+catch (\Error $ex) {
+ echo $ex->getMessage() . "\n";
+}
+
imagesetpixel($im, 0, 0, IMG_COLOR_STYLED);
imagedestroy($im);
?>
====DONE====
---EXPECTF--
-Warning: imagesetstyle(): styles array must not be empty in %s%ebug72709.php on line %d
-bool(false)
+--EXPECT--
+Styles array must not be empty
====DONE====
diff --git a/ext/gd/tests/bug72730.phpt b/ext/gd/tests/bug72730.phpt
index 403354d1e2..09b6657add 100644
--- a/ext/gd/tests/bug72730.phpt
+++ b/ext/gd/tests/bug72730.phpt
@@ -6,10 +6,15 @@ if (!function_exists("imagecreatetruecolor")) die("skip");
?>
--FILE--
<?php
+
+require __DIR__ . '/func.inc';
+
$img = imagecreatetruecolor(1, 1);
-imagegammacorrect($img, -1, 1337);
+
+trycatch_dump(
+ fn() => imagegammacorrect($img, -1, 1337)
+);
+
?>
-DONE
---EXPECTF--
-Warning: imagegammacorrect(): Gamma values should be positive in %sbug72730.php on line %d
-DONE
+--EXPECT--
+!! [ValueError] Gamma values must be positive
diff --git a/ext/gd/tests/bug72913.phpt b/ext/gd/tests/bug72913.phpt
index 3ab068a134..3ec0766982 100644
--- a/ext/gd/tests/bug72913.phpt
+++ b/ext/gd/tests/bug72913.phpt
@@ -22,7 +22,5 @@ imagecopy($dst, $src, 0,0, 0,0, 50,50);
include_once __DIR__ . '/func.inc';
test_image_equals_file(__DIR__ . '/bug72913.png', $dst);
?>
-==DONE==
--EXPECT--
The images are equal.
-==DONE==
diff --git a/ext/gd/tests/bug73155.phpt b/ext/gd/tests/bug73155.phpt
index dc1791e565..96ba12a469 100644
--- a/ext/gd/tests/bug73155.phpt
+++ b/ext/gd/tests/bug73155.phpt
@@ -19,10 +19,8 @@ printf("x chunk count: %d\n", $header['x_count']);
printf("y chunk count: %d\n", $header['y_count']);
printf("file size: %d\n", strlen($buffer));
?>
-===DONE===
--EXPECT--
chunk size: 64
x chunk count: 1
y chunk count: 1
file size: 5145
-===DONE===
diff --git a/ext/gd/tests/bug73157.phpt b/ext/gd/tests/bug73157.phpt
index b03e91ec9d..f0f19fdf23 100644
--- a/ext/gd/tests/bug73157.phpt
+++ b/ext/gd/tests/bug73157.phpt
@@ -16,7 +16,5 @@ $buffer = ob_get_clean();
$header = unpack('@10/nchunk_size', $buffer);
printf("chunk size: %d\n", $header['chunk_size']);
?>
-===DONE===
--EXPECT--
chunk size: 256
-===DONE===
diff --git a/ext/gd/tests/bug73159.phpt b/ext/gd/tests/bug73159.phpt
index 4889ffb6fd..ae11f3012b 100644
--- a/ext/gd/tests/bug73159.phpt
+++ b/ext/gd/tests/bug73159.phpt
@@ -15,7 +15,5 @@ $buffer = ob_get_clean();
$header = unpack('@12/nformat', $buffer);
printf("format: %d\n", $header['format']);
?>
-===DONE===
--EXPECT--
format: 4
-===DONE===
diff --git a/ext/gd/tests/bug73161.phpt b/ext/gd/tests/bug73161.phpt
index 42ad718606..bc386dc9c2 100644
--- a/ext/gd/tests/bug73161.phpt
+++ b/ext/gd/tests/bug73161.phpt
@@ -11,8 +11,6 @@ if (!extension_loaded('gd')) die('skip gd extension not available');
$im = imagecreatefromgd2(__DIR__ . DIRECTORY_SEPARATOR . 'bug73161.gd2');
var_dump($im);
?>
-===DONE===
--EXPECTF--
Warning: imagecreatefromgd2(): '%s' is not a valid GD2 file in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/gd/tests/bug73213.phpt b/ext/gd/tests/bug73213.phpt
index 86c4078fd9..3c8f33079b 100644
--- a/ext/gd/tests/bug73213.phpt
+++ b/ext/gd/tests/bug73213.phpt
@@ -16,7 +16,5 @@ imageline($im, 0,0, 32767,0, $black);
test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'bug73213.png', $im);
?>
-===DONE===
--EXPECT--
The images are equal.
-===DONE===
diff --git a/ext/gd/tests/bug73272.phpt b/ext/gd/tests/bug73272.phpt
index ccee8d6e67..33d7b4155e 100644
--- a/ext/gd/tests/bug73272.phpt
+++ b/ext/gd/tests/bug73272.phpt
@@ -18,7 +18,5 @@ $dst = imagerotate($src, 60, 0xFFFFFF);
test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'bug73272.png', $dst);
?>
-===DONE===
--EXPECT--
The images are equal.
-===DONE===
diff --git a/ext/gd/tests/bug73279.phpt b/ext/gd/tests/bug73279.phpt
index aba91f0d3a..886b61c55b 100644
--- a/ext/gd/tests/bug73279.phpt
+++ b/ext/gd/tests/bug73279.phpt
@@ -14,7 +14,5 @@ imagecolorallocate($src, 255, 255, 255);
$dst = imagescale($src, 200, 200, IMG_BILINEAR_FIXED);
printf("color: %x\n", imagecolorat($dst, 99, 99));
?>
-===DONE===
--EXPECT--
color: ffffff
-===DONE===
diff --git a/ext/gd/tests/bug73279_old.phpt b/ext/gd/tests/bug73279_old.phpt
index 810b15201f..1db9861b0c 100644
--- a/ext/gd/tests/bug73279_old.phpt
+++ b/ext/gd/tests/bug73279_old.phpt
@@ -14,9 +14,7 @@ imagecolorallocate($src, 255, 255, 255);
$dst = imagescale($src, 200, 200, IMG_BILINEAR_FIXED);
printf("color: %x\n", imagecolorat($dst, 99, 99));
?>
-===DONE===
--XFAIL--
Bug #330 has not yet been fixed
--EXPECT--
color: ffffff
-===DONE===
diff --git a/ext/gd/tests/bug73281.phpt b/ext/gd/tests/bug73281.phpt
index 162ee1b33a..81bb2d2d28 100644
--- a/ext/gd/tests/bug73281.phpt
+++ b/ext/gd/tests/bug73281.phpt
@@ -29,7 +29,6 @@ foreach ($coordinates as $coordinate) {
printf("%3d, %3d: %x\n", $x, $y, imagecolorat($dst, $x, $y));
}
?>
-===DONE===
--EXPECT--
truecolor source
0, 0: ffffff
@@ -42,4 +41,3 @@ palette source
0, 199: ffffff
199, 199: ffffff
199, 0: ffffff
-===DONE===
diff --git a/ext/gd/tests/bug73291.phpt b/ext/gd/tests/bug73291.phpt
index ffa2fe7e4c..a3fd5b3c10 100644
--- a/ext/gd/tests/bug73291.phpt
+++ b/ext/gd/tests/bug73291.phpt
@@ -26,10 +26,8 @@ foreach ([0.1, 0.5, 1.0, 10.0] as $threshold) {
}
?>
-===DONE===
--EXPECT--
size: 247*247
size: 237*237
size: 229*229
size: 175*175
-===DONE===
diff --git a/ext/gd/tests/bug73549.phpt b/ext/gd/tests/bug73549.phpt
index e0cc6cf42e..8194d43e72 100644
--- a/ext/gd/tests/bug73549.phpt
+++ b/ext/gd/tests/bug73549.phpt
@@ -11,11 +11,9 @@ $im = imagecreatetruecolor(8, 8);
var_dump(imagepng($im, $stream));
var_dump($stream);
?>
-===DONE===
--EXPECTF--
bool(true)
resource(%d) of type (stream)
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . DIRECTORY_SEPARATOR . 'bug73549.png');
diff --git a/ext/gd/tests/bug73614.phpt b/ext/gd/tests/bug73614.phpt
index f94881e2f3..dc0ccc10d9 100644
--- a/ext/gd/tests/bug73614.phpt
+++ b/ext/gd/tests/bug73614.phpt
@@ -21,7 +21,5 @@ imagefilledarc($image, 250, 250, 500, 250, 91, 360 , $red, IMG_ARC_PIE);
test_image_equals_file(__DIR__ . '/bug73614.png', $image);
?>
-===DONE===
--EXPECT--
The images are equal.
-===DONE===
diff --git a/ext/gd/tests/bug73868.phpt b/ext/gd/tests/bug73868.phpt
index 135be7917b..fd9537c4a0 100644
--- a/ext/gd/tests/bug73868.phpt
+++ b/ext/gd/tests/bug73868.phpt
@@ -8,11 +8,9 @@ if (!extension_loaded('gd')) die('skip gd extension not available');
<?php
var_dump(imagecreatefromgd2(__DIR__ . DIRECTORY_SEPARATOR . 'bug73868.gd2'));
?>
-===DONE===
--EXPECTF--
Warning: imagecreatefromgd2(): gd2: EOF while reading
in %s on line %d
Warning: imagecreatefromgd2(): '%s' is not a valid GD2 file in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/gd/tests/bug73869.phpt b/ext/gd/tests/bug73869.phpt
index 16b2edc7a1..69c7e1b543 100644
--- a/ext/gd/tests/bug73869.phpt
+++ b/ext/gd/tests/bug73869.phpt
@@ -9,11 +9,9 @@ if (!extension_loaded('gd')) die('skip gd extension not available');
var_dump(imagecreatefromgd2(__DIR__ . DIRECTORY_SEPARATOR . 'bug73869a.gd2'));
var_dump(imagecreatefromgd2(__DIR__ . DIRECTORY_SEPARATOR . 'bug73869b.gd2'));
?>
-===DONE===
--EXPECTF--
Warning: imagecreatefromgd2(): '%s' is not a valid GD2 file in %s on line %d
bool(false)
Warning: imagecreatefromgd2(): '%s' is not a valid GD2 file in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/gd/tests/bug73957.phpt b/ext/gd/tests/bug73957.phpt
index 370956f032..0ab715b178 100644
--- a/ext/gd/tests/bug73957.phpt
+++ b/ext/gd/tests/bug73957.phpt
@@ -14,7 +14,5 @@ if ($im) { // which is not supposed to happen
var_dump(imagesx($im));
}
?>
-===DONE===
--EXPECT--
bool(false)
-===DONE===
diff --git a/ext/gd/tests/bug73968.phpt b/ext/gd/tests/bug73968.phpt
index 2211840f58..c1101c61bf 100644
--- a/ext/gd/tests/bug73968.phpt
+++ b/ext/gd/tests/bug73968.phpt
@@ -9,7 +9,6 @@ if (!extension_loaded('gd')) die('skip gd extension not available');
$im = imagecreatefromxbm(__DIR__ . DIRECTORY_SEPARATOR . 'bug73968.xbm');
var_dump($im);
?>
-===DONE===
---EXPECTF--
-resource(%d) of type (gd)
-===DONE===
+--EXPECT--
+object(GdImage)#1 (0) {
+}
diff --git a/ext/gd/tests/bug74435.phpt b/ext/gd/tests/bug74435.phpt
index 9d11eb3839..78f2103247 100644
--- a/ext/gd/tests/bug74435.phpt
+++ b/ext/gd/tests/bug74435.phpt
@@ -21,7 +21,6 @@ for ($i = 0; $i < $width; $i += 16) {
}
}
?>
-===DONE===
---EXPECTF--
-resource(%d) of type (gd)
-===DONE===
+--EXPECT--
+object(GdImage)#1 (0) {
+}
diff --git a/ext/gd/tests/bug75111.phpt b/ext/gd/tests/bug75111.phpt
index 3950799730..4ec22c4a3a 100644
--- a/ext/gd/tests/bug75111.phpt
+++ b/ext/gd/tests/bug75111.phpt
@@ -16,10 +16,8 @@ $str .= hex2bin("01001800000000000000000000000000000000000000000000000000");
var_dump(imagecreatefromstring($str));
?>
-===DONE===
--EXPECTF--
Warning: imagecreatefromstring(): Passed data is not in 'BMP' format in %s on line %d
Warning: imagecreatefromstring(): Couldn't create GD Image Stream out of Data in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/gd/tests/bug75124.phpt b/ext/gd/tests/bug75124.phpt
index 513d452147..47c313fa84 100644
--- a/ext/gd/tests/bug75124.phpt
+++ b/ext/gd/tests/bug75124.phpt
@@ -25,7 +25,5 @@ for ($i = 0, $width = imagesx($im); $i < $width; $i ++) {
}
}
?>
-===DONE===
--EXPECT--
bool(true)
-===DONE===
diff --git a/ext/gd/tests/bug75437.phpt b/ext/gd/tests/bug75437.phpt
index 1dbbae6478..7da6d2f236 100644
--- a/ext/gd/tests/bug75437.phpt
+++ b/ext/gd/tests/bug75437.phpt
@@ -12,8 +12,6 @@ $rf = new ReflectionFunction('imagewebp');
var_dump($rf->getNumberOfParameters());
var_dump($rf->getNumberOfRequiredParameters());
?>
-===DONE===
--EXPECT--
int(3)
int(1)
-===DONE===
diff --git a/ext/gd/tests/bug75571.phpt b/ext/gd/tests/bug75571.phpt
index 5bd26b84ec..10b459d421 100644
--- a/ext/gd/tests/bug75571.phpt
+++ b/ext/gd/tests/bug75571.phpt
@@ -8,8 +8,6 @@ if (!extension_loaded('gd')) die('skip gd extension not available');
<?php
var_dump(imagecreatefromgif(__DIR__ . '/bug75571.gif'));
?>
-===DONE===
--EXPECTF--
Warning: imagecreatefromgif(): '%s' is not a valid GIF file in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/gd/tests/bug77195.phpt b/ext/gd/tests/bug77195.phpt
index 5aa1f51b02..f90035b741 100644
--- a/ext/gd/tests/bug77195.phpt
+++ b/ext/gd/tests/bug77195.phpt
@@ -11,9 +11,7 @@ $filename = __DIR__ . '/bug77195.jpg';
@imagecreatefromjpeg($filename);
imagecreatefromjpeg($filename);
?>
-===DONE===
--EXPECTF--
Warning: imagecreatefromjpeg(): gd-jpeg: JPEG library reports unrecoverable error: JPEG datastream contains no image in %s on line %d
Warning: imagecreatefromjpeg(): '%s' is not a valid JPEG file in %s on line %d
-===DONE===
diff --git a/ext/gd/tests/bug77200.phpt b/ext/gd/tests/bug77200.phpt
index 99d8efb550..b673760671 100644
--- a/ext/gd/tests/bug77200.phpt
+++ b/ext/gd/tests/bug77200.phpt
@@ -30,8 +30,6 @@ $cropped = imagecropauto($orig, IMG_CROP_SIDES);
var_dump(imagesx($cropped));
?>
-===DONE===
--EXPECT--
int(4)
int(4)
-===DONE===
diff --git a/ext/gd/tests/bug77269.phpt b/ext/gd/tests/bug77269.phpt
index c89f674b8a..2bd5758e1a 100644
--- a/ext/gd/tests/bug77269.phpt
+++ b/ext/gd/tests/bug77269.phpt
@@ -10,12 +10,9 @@ memory_limit=2G
--FILE--
<?php
$im = imagecreate(2**28, 1);
-if(is_resource($im)) {
- imagescale($im, 1, 1, IMG_TRIANGLE);
-}
+imagescale($im, 1, 1, IMG_TRIANGLE);
+
?>
-===DONE===
--EXPECTF--
-Warning: imagescale():%S product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
+Warning: imagescale():%S Product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
in %s on line %d
-===DONE===
diff --git a/ext/gd/tests/bug77272.phpt b/ext/gd/tests/bug77272.phpt
index d3bfa24aaa..678333f06c 100644
--- a/ext/gd/tests/bug77272.phpt
+++ b/ext/gd/tests/bug77272.phpt
@@ -13,9 +13,7 @@ if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
$img = imagecreate(2**28, 1);
var_dump(imagescale($img, 1, 1, IMG_TRIANGLE));
?>
-===DONE===
--EXPECTF--
-Warning: imagescale():%S product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
+Warning: imagescale():%S Product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/gd/tests/bug77391.phpt b/ext/gd/tests/bug77391.phpt
index aa76c1470e..fbfa8a8026 100644
--- a/ext/gd/tests/bug77391.phpt
+++ b/ext/gd/tests/bug77391.phpt
@@ -9,7 +9,6 @@ if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.5', '<=')) die('skip upstrea
<?php
var_dump(imagecreatefrombmp(__DIR__ . '/bug77391.bmp'));
?>
-===DONE===
---EXPECTF--
-resource(%d) of type (gd)
-===DONE===
+--EXPECT--
+object(GdImage)#1 (0) {
+}
diff --git a/ext/gd/tests/bug77479.phpt b/ext/gd/tests/bug77479.phpt
index 063f5d4f8a..e57da56439 100644
--- a/ext/gd/tests/bug77479.phpt
+++ b/ext/gd/tests/bug77479.phpt
@@ -13,13 +13,11 @@ $im = imagecreate(40000, 20000);
imagecolorallocate($im, 0, 0, 0);
imagewbmp($im, __DIR__ . '/77479.wbmp');
?>
-===DONE===
--EXPECTF--
-Warning: imagewbmp():%S product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
+Warning: imagewbmp():%S Product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
in %s on line %d
Warning: imagewbmp(): Could not create WBMP in %s on line %d
-===DONE===
--CLEAN--
<?php
@unlink(__DIR__ . '/77479.wbmp');
diff --git a/ext/gd/tests/bug77700.phpt b/ext/gd/tests/bug77700.phpt
index 07b7ffbbba..27b93cf0d0 100644
--- a/ext/gd/tests/bug77700.phpt
+++ b/ext/gd/tests/bug77700.phpt
@@ -14,10 +14,8 @@ imagegif($im, __DIR__ . 'bug77700.gif');
$im = imagecreatefromgif(__DIR__ . 'bug77700.gif');
var_dump(imageinterlace($im));
?>
-===DONE===
--EXPECT--
int(1)
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . 'bug77700.gif');
diff --git a/ext/gd/tests/bug77943.phpt b/ext/gd/tests/bug77943.phpt
index 1009b3e4b3..5a64eb85b4 100644
--- a/ext/gd/tests/bug77943.phpt
+++ b/ext/gd/tests/bug77943.phpt
@@ -23,7 +23,5 @@ imageline($im, 10, 0, $width, $height-10, $blue);
test_image_equals_file(__DIR__ . '/bug77943.png', $im);
?>
-===DONE===
--EXPECT--
The images are equal.
-===DONE===
diff --git a/ext/gd/tests/bug77973.phpt b/ext/gd/tests/bug77973.phpt
index 2545dbe128..c9400987e0 100644
--- a/ext/gd/tests/bug77973.phpt
+++ b/ext/gd/tests/bug77973.phpt
@@ -13,13 +13,11 @@ file_put_contents($filepath, $contents);
$im = imagecreatefromxbm($filepath);
var_dump($im);
?>
-===DONE===
--EXPECTF--
-Warning: imagecreatefromxbm(): invalid XBM in %s on line %d
+Warning: imagecreatefromxbm(): Invalid XBM in %s on line %d
Warning: imagecreatefromxbm(): '%s' is not a valid XBM file in %s on line %d
bool(false)
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/bug77973.xbm');
diff --git a/ext/gd/tests/bug79068.phpt b/ext/gd/tests/bug79068.phpt
index 391424b119..835b0b3670 100644
--- a/ext/gd/tests/bug79068.phpt
+++ b/ext/gd/tests/bug79068.phpt
@@ -6,16 +6,12 @@ if (!extension_loaded('gd')) die('skip gd extension not available');
?>
--FILE--
<?php
-require_once __DIR__ . '/func.inc';
-
$src = imagecreatetruecolor(100, 100);
imagefilledrectangle($src, 0, 0, 99, 99, 0xffffff);
imageline($src, 10, 10, 90, 90, 0x000000);
imagesetinterpolation($src, IMG_BSPLINE);
imageaffine($src, [1, 1, 1, 1, 1, 1]);
-$dst = imagerotate($src, 80, 0xffffff);
-
-test_image_equals_file(__DIR__ . '/bug79068.png', $dst);
+var_dump(imagegetinterpolation($src) === IMG_BSPLINE);
?>
--EXPECT--
-The images are equal.
+bool(true)
diff --git a/ext/gd/tests/bug79068.png b/ext/gd/tests/bug79068.png
deleted file mode 100644
index 805edc1c56..0000000000
--- a/ext/gd/tests/bug79068.png
+++ /dev/null
Binary files differ
diff --git a/ext/gd/tests/colorat.phpt b/ext/gd/tests/colorat.phpt
index e8c1a5fb46..9be5d431da 100644
--- a/ext/gd/tests/colorat.phpt
+++ b/ext/gd/tests/colorat.phpt
@@ -30,9 +30,9 @@ echo 'test colorat palette: ';
$c = imagecolorsforindex($im, imagecolorat($im, 3,3));
$failed = false;
foreach ($c as $v) {
- if ($v != 0) {
- $failed = true;
- }
+ if ($v != 0) {
+ $failed = true;
+ }
}
echo !$failed ? 'ok' : 'failed';
echo "\n";
diff --git a/ext/gd/tests/colorclosest.phpt b/ext/gd/tests/colorclosest.phpt
index 7ade09478e..3f588fbd59 100644
--- a/ext/gd/tests/colorclosest.phpt
+++ b/ext/gd/tests/colorclosest.phpt
@@ -31,11 +31,11 @@ print_r(imagecolorsforindex($im, $c));
$im = imagecreate(5,5);
for ($i=0; $i<256; $i++) {
- if ($i == 246) {
- imagecolorallocate($im, $i,10,10);
- } else {
- imagecolorallocate($im, $i,0,0);
- }
+ if ($i == 246) {
+ imagecolorallocate($im, $i,10,10);
+ } else {
+ imagecolorallocate($im, $i,0,0);
+ }
}
$c = imagecolorclosest($im, 255,10,10);
print_r(imagecolorsforindex($im, $c));
@@ -65,11 +65,11 @@ print_r(imagecolorsforindex($im, $c));
$im = imagecreate(5,5);
for ($i=0; $i<256; $i++) {
- if ($i == 246) {
- imagecolorallocatealpha($im, $i,10,10,1);
- } else {
- imagecolorallocatealpha($im, $i,0,0,100);
- }
+ if ($i == 246) {
+ imagecolorallocatealpha($im, $i,10,10,1);
+ } else {
+ imagecolorallocatealpha($im, $i,0,0,100);
+ }
}
$c = imagecolorclosestalpha($im, 255,10,10,1);
print_r(imagecolorsforindex($im, $c));
diff --git a/ext/gd/tests/colorresolve.phpt b/ext/gd/tests/colorresolve.phpt
index 0a939bd85f..6df57ef75d 100644
--- a/ext/gd/tests/colorresolve.phpt
+++ b/ext/gd/tests/colorresolve.phpt
@@ -25,11 +25,11 @@ print_r(imagecolorsforindex($im, $c));
$im = imagecreate(5,5);
for ($i=0; $i<256; $i++) {
- if ($i == 246) {
- imagecolorresolve($im, $i,10,10);
- } else {
- imagecolorresolve($im, $i,0,0);
- }
+ if ($i == 246) {
+ imagecolorresolve($im, $i,10,10);
+ } else {
+ imagecolorresolve($im, $i,0,0);
+ }
}
$c = imagecolorresolve($im, 255,10,10);
print_r(imagecolorsforindex($im, $c));
@@ -55,11 +55,11 @@ print_r(imagecolorsforindex($im, $c));
$im = imagecreate(5,5);
for ($i=0; $i<256; $i++) {
- if ($i == 246) {
- imagecolorresolvealpha($im, $i,10,10,1);
- } else {
- imagecolorresolvealpha($im, $i,0,0,100);
- }
+ if ($i == 246) {
+ imagecolorresolvealpha($im, $i,10,10,1);
+ } else {
+ imagecolorresolvealpha($im, $i,0,0,100);
+ }
}
$c = imagecolorresolvealpha($im, 255,10,10,0);
print_r(imagecolorsforindex($im, $c));
diff --git a/ext/gd/tests/copy.phpt b/ext/gd/tests/copy.phpt
index 28bb3ed173..046567e3ef 100644
--- a/ext/gd/tests/copy.phpt
+++ b/ext/gd/tests/copy.phpt
@@ -21,7 +21,7 @@ $p2 = imagecolorat($dst_tc, 0,0) == 0x0000ff;
$p3 = imagecolorat($dst_tc, 4,4) == 0x00ff00;
if ($p1 && $p2 && $p3) {
- echo "TC/TC: ok\n";
+ echo "TC/TC: ok\n";
}
imagedestroy($src_tc); imagedestroy($dst_tc);
@@ -46,7 +46,7 @@ $p2 = $c2['red'] == 0x00 && $c2['blue']==0xff && $c2['green']==0x00;
$p3 = $c3['red'] == 0x00 && $c3['blue']==0x00 && $c3['green']==0xff;
if ($p1 && $p2 && $p3) {
- echo "TC/P: ok\n";
+ echo "TC/P: ok\n";
}
imagedestroy($src_tc); imagedestroy($dst_tc);
@@ -76,7 +76,7 @@ $p3 = $c3['red'] == 0x00 && $c3['blue']==0x00 && $c3['green']==0xff;
if ($p1 && $p2 && $p3) {
- echo "P/P: ok\n";
+ echo "P/P: ok\n";
}
@@ -99,7 +99,7 @@ $p2 = imagecolorat($dst_tc, 0,0) == 0x0000ff;
$p3 = imagecolorat($dst_tc, 4,4) == 0x00ff00;
if ($p1 && $p2 && $p3) {
- echo "P/TC: ok\n";
+ echo "P/TC: ok\n";
}
?>
--EXPECT--
diff --git a/ext/gd/tests/copypalette.phpt b/ext/gd/tests/copypalette.phpt
index 3e29b42a43..747011e69a 100644
--- a/ext/gd/tests/copypalette.phpt
+++ b/ext/gd/tests/copypalette.phpt
@@ -9,18 +9,18 @@ imagepalettecopy
$failed = false;
$im = imagecreate(1,1);
for ($i=0; $i<256; $i++) {
- imagecolorallocate($im, $i, $i, $i);
+ imagecolorallocate($im, $i, $i, $i);
}
$im2 = imagecreate(1,1);
imagepalettecopy($im2, $im);
for ($i=0; $i<256; $i++) {
- $c = imagecolorsforindex($im2, $i);
- if ($c['red']!=$i || $c['green']!=$i || $c['blue']!=$i) {
- $failed = true;
- break;
- }
+ $c = imagecolorsforindex($im2, $i);
+ if ($c['red']!=$i || $c['green']!=$i || $c['blue']!=$i) {
+ $failed = true;
+ break;
+ }
}
echo "copy palette 255 colors: ";
echo $failed ? 'failed' : 'ok';
@@ -33,7 +33,7 @@ imagecolorallocatealpha($im, 0,0,0,100);
imagepalettecopy($im2, $im);
$c = imagecolorsforindex($im2, 0);
if ($c['red']!=0 || $c['green']!=0 || $c['blue']!=0 || $c['alpha']!=100) {
- $failed = true;
+ $failed = true;
}
echo 'copy palette 1 color and alpha: ';
echo $failed ? 'failed' : 'ok';
diff --git a/ext/gd/tests/copyresized.phpt b/ext/gd/tests/copyresized.phpt
index df4996332d..2af9cc9682 100644
--- a/ext/gd/tests/copyresized.phpt
+++ b/ext/gd/tests/copyresized.phpt
@@ -8,32 +8,32 @@ imagecopyresized
<?php
function get_hexcolor($im, $c) {
- if (imageistruecolor($im)) {
- return $c;
- }
- $colors = imagecolorsforindex($im, $c);
- return ($colors['red'] << 16) + ($colors['green'] << 8) + ($colors['blue']);
+ if (imageistruecolor($im)) {
+ return $c;
+ }
+ $colors = imagecolorsforindex($im, $c);
+ return ($colors['red'] << 16) + ($colors['green'] << 8) + ($colors['blue']);
}
function check_doublesize($dst) {
- $im = imagecreatetruecolor(38,38);
- imagefill($im,0,0, 0xffffff);
- imagefilledrectangle($im, 0,0,9,9, 0xff0000);
- imagefilledrectangle($im, 0,28,9,37, 0xff0000);
- imagefilledrectangle($im, 28,0,37,9, 0xff0000);
- imagefilledrectangle($im, 28,28,37,37, 0xff0000);
- imagefilledrectangle($im, 14,14,23,23, 0xff0000);
+ $im = imagecreatetruecolor(38,38);
+ imagefill($im,0,0, 0xffffff);
+ imagefilledrectangle($im, 0,0,9,9, 0xff0000);
+ imagefilledrectangle($im, 0,28,9,37, 0xff0000);
+ imagefilledrectangle($im, 28,0,37,9, 0xff0000);
+ imagefilledrectangle($im, 28,28,37,37, 0xff0000);
+ imagefilledrectangle($im, 14,14,23,23, 0xff0000);
- for ($x = 0; $x < 38; $x++) {
- for ($y = 0; $y < 38; $y++) {
- $p1 = imagecolorat($im, $x, $y);
- $p2 = imagecolorat($dst, $x, $y);
- if (get_hexcolor($im, $p1) != get_hexcolor($dst, $p2)) {
- return false;
- }
- }
- }
- return true;
+ for ($x = 0; $x < 38; $x++) {
+ for ($y = 0; $y < 38; $y++) {
+ $p1 = imagecolorat($im, $x, $y);
+ $p2 = imagecolorat($dst, $x, $y);
+ if (get_hexcolor($im, $p1) != get_hexcolor($dst, $p2)) {
+ return false;
+ }
+ }
+ }
+ return true;
}
$src_tc = imagecreatetruecolor(19,19);
diff --git a/ext/gd/tests/createfromstring.phpt b/ext/gd/tests/createfromstring.phpt
index 6a4b1a7e11..5d14708a2e 100644
--- a/ext/gd/tests/createfromstring.phpt
+++ b/ext/gd/tests/createfromstring.phpt
@@ -18,9 +18,9 @@ $im_string = file_get_contents(__DIR__ . '/tc.png');
$im = imagecreatefromstring($im_string);
echo 'createfromstring truecolor png: ';
if (imagecolorat($im, 3,3) != 0x0) {
- echo 'failed';
+ echo 'failed';
} else {
- echo 'ok';
+ echo 'ok';
}
echo "\n";
unlink($dir . '/tc.png');
@@ -42,9 +42,9 @@ echo'createfromstring palette png: ';
$c = imagecolorsforindex($im, imagecolorat($im, 3,3));
$failed = false;
if ($c['red'] != 255 || $c['green'] != 0 || $c['blue'] != 0) {
- echo 'failed';
+ echo 'failed';
} else {
- echo 'ok';
+ echo 'ok';
}
echo "\n";
unlink($dir . '/p.png');
diff --git a/ext/gd/tests/createfromwbmp2.phpt b/ext/gd/tests/createfromwbmp2.phpt
index e083b74c19..f75d02613d 100644
--- a/ext/gd/tests/createfromwbmp2.phpt
+++ b/ext/gd/tests/createfromwbmp2.phpt
@@ -10,7 +10,7 @@ imagecreatefromwbmp with invalid wbmp
$filename = __DIR__ . '/_tmp.wbmp';
$fp = fopen($filename,"wb");
if (!$fp) {
- exit("Failed to create <$filename>");
+ exit("Failed to create <$filename>");
}
//write header
@@ -34,7 +34,7 @@ fputs($fp, chr($c), 1);
/*write some data to cause overflow*/
for ($i=0; $i<10000; $i++) {
- fwrite($fp, chr($c), 1);
+ fwrite($fp, chr($c), 1);
}
fclose($fp);
@@ -42,7 +42,7 @@ $im = imagecreatefromwbmp($filename);
unlink($filename);
?>
--EXPECTF--
-Warning: imagecreatefromwbmp(): product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
+Warning: imagecreatefromwbmp(): Product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
in %s on line %d
Warning: imagecreatefromwbmp(): '%s' is not a valid WBMP file in %s on line %d
diff --git a/ext/gd/tests/createfromwbmp2_extern.phpt b/ext/gd/tests/createfromwbmp2_extern.phpt
index ed739461c4..ad7a130c18 100644
--- a/ext/gd/tests/createfromwbmp2_extern.phpt
+++ b/ext/gd/tests/createfromwbmp2_extern.phpt
@@ -10,7 +10,7 @@ imagecreatefromwbmp with invalid wbmp
$filename = __DIR__ . '/_tmp.wbmp';
$fp = fopen($filename,"wb");
if (!$fp) {
- exit("Failed to create <$filename>");
+ exit("Failed to create <$filename>");
}
//write header
@@ -34,7 +34,7 @@ fputs($fp, chr($c), 1);
/*write some data to cause overflow*/
for ($i=0; $i<10000; $i++) {
- fwrite($fp, chr($c), 1);
+ fwrite($fp, chr($c), 1);
}
fclose($fp);
@@ -42,6 +42,6 @@ $im = imagecreatefromwbmp($filename);
unlink($filename);
?>
--EXPECTF--
-gd warning: product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
+gd warning: Product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
Warning: imagecreatefromwbmp(): '%s_tmp.wbmp' is not a valid WBMP file in %s on line %d
diff --git a/ext/gd/tests/dashedlines.phpt b/ext/gd/tests/dashedlines.phpt
index b6d4892c88..bcf17174cc 100644
--- a/ext/gd/tests/dashedlines.phpt
+++ b/ext/gd/tests/dashedlines.phpt
@@ -26,7 +26,7 @@ $p5 = imagecolorat($im, 5,5) == $b;
if ($p1 && $p2 && $p3 && $p4 && $p5) {
- echo "Horizontal: ok\n";
+ echo "Horizontal: ok\n";
}
imagedestroy($im);
@@ -46,7 +46,7 @@ $p5 = imagecolorat($im, 2,4) == $r;
$p6 = imagecolorat($im, 2,5) == $b;
if ($p1 && $p2 && $p3 && $p4 && $p5 && $p6) {
- echo "Vertical: ok\n";
+ echo "Vertical: ok\n";
}
imagedestroy($im);
@@ -66,7 +66,7 @@ $p5 = imagecolorat($im, 4,4) == $r;
$p6 = imagecolorat($im, 5,5) == $b;
if ($p1 && $p2 && $p3 && $p4 && $p5 && $p6) {
- echo "Diagonal: ok\n";
+ echo "Diagonal: ok\n";
}
imagedestroy($im);
diff --git a/ext/gd/tests/func.inc b/ext/gd/tests/func.inc
index 34d9c47155..5273f99830 100644
--- a/ext/gd/tests/func.inc
+++ b/ext/gd/tests/func.inc
@@ -2,61 +2,61 @@
function get_gd_version()
{
- return GD_VERSION;
+ return GD_VERSION;
}
function get_php_info()
{
- ob_start();
- phpinfo();
- $info = ob_get_contents();
- ob_end_clean();
+ ob_start();
+ phpinfo();
+ $info = ob_get_contents();
+ ob_end_clean();
- return $info;
+ return $info;
}
function get_freetype_version()
{
- $version = 0;
+ $version = 0;
- if (preg_match(',FreeType Version => (\d+\.\d+\.\d+),s', get_php_info(), $match)) {
- $version = $match[1];
- }
+ if (preg_match(',FreeType Version => (\d+\.\d+\.\d+),s', get_php_info(), $match)) {
+ $version = $match[1];
+ }
- return $version;
+ return $version;
}
function get_libjpeg_version()
{
- $version = 0;
+ $version = 0;
- if (preg_match(',libJPEG Version => ([a-z0-9]+),s', get_php_info(), $match)) {
- $version = $match[1];
- }
+ if (preg_match(',libJPEG Version => ([a-z0-9]+),s', get_php_info(), $match)) {
+ $version = $match[1];
+ }
- return $version;
+ return $version;
}
function get_libpng_version()
{
- $version = 0;
+ $version = 0;
- if (preg_match(',libPNG Version => (\d+\.\d+\.\d+),s', get_php_info(), $match)) {
- $version = $match[1];
- }
+ if (preg_match(',libPNG Version => (\d+\.\d+\.\d+),s', get_php_info(), $match)) {
+ $version = $match[1];
+ }
- return $version;
+ return $version;
}
function get_libxpm_version()
{
- $version = 0;
+ $version = 0;
- if (preg_match(',libXpm Version => (\d+),s', get_php_info(), $match)) {
- $version = $match[1];
- }
+ if (preg_match(',libXpm Version => (\d+),s', get_php_info(), $match)) {
+ $version = $match[1];
+ }
- return $version;
+ return $version;
}
/**
@@ -77,39 +77,39 @@ function get_libxpm_version()
*/
function test_image_equals_file($filename, $actual)
{
- if (!file_exists($filename)) {
- echo "The expected image does not exist.\n";
- save_actual_image($actual);
- return;
- }
- $actual = test_to_truecolor($actual);
- $expected = imagecreatefrompng($filename);
- $expected = test_to_truecolor($expected);
- $exp_x = imagesx($expected);
- $exp_y = imagesy($expected);
- $act_x = imagesx($actual);
- $act_y = imagesy($actual);
- if ($exp_x != $act_x || $exp_y != $act_y) {
- echo "The image size differs: expected {$exp_x}x{$exp_y}, got {$act_x}x{$act_y}.\n";
- save_actual_image($actual);
- return;
- }
- $pixels_changed = 0;
- for ($y = 0; $y < $exp_y; $y++) {
- for ($x = 0; $x < $exp_x; $x ++) {
- $exp_c = imagecolorat($expected, $x, $y);
- $act_c = imagecolorat($actual, $x, $y);
- if ($exp_c != $act_c) {
- $pixels_changed++;
- }
- }
- }
- if (!$pixels_changed) {
- echo "The images are equal.\n";
- } else {
- echo "The images differ in {$pixels_changed} pixels.\n";
- save_actual_image($actual);
- }
+ if (!file_exists($filename)) {
+ echo "The expected image does not exist.\n";
+ save_actual_image($actual);
+ return;
+ }
+ $actual = test_to_truecolor($actual);
+ $expected = imagecreatefrompng($filename);
+ $expected = test_to_truecolor($expected);
+ $exp_x = imagesx($expected);
+ $exp_y = imagesy($expected);
+ $act_x = imagesx($actual);
+ $act_y = imagesy($actual);
+ if ($exp_x != $act_x || $exp_y != $act_y) {
+ echo "The image size differs: expected {$exp_x}x{$exp_y}, got {$act_x}x{$act_y}.\n";
+ save_actual_image($actual);
+ return;
+ }
+ $pixels_changed = 0;
+ for ($y = 0; $y < $exp_y; $y++) {
+ for ($x = 0; $x < $exp_x; $x ++) {
+ $exp_c = imagecolorat($expected, $x, $y);
+ $act_c = imagecolorat($actual, $x, $y);
+ if ($exp_c != $act_c) {
+ $pixels_changed++;
+ }
+ }
+ }
+ if (!$pixels_changed) {
+ echo "The images are equal.\n";
+ } else {
+ echo "The images differ in {$pixels_changed} pixels.\n";
+ save_actual_image($actual);
+ }
}
/**
@@ -120,15 +120,15 @@ function test_image_equals_file($filename, $actual)
*/
function test_to_truecolor($image)
{
- if (imageistruecolor($image)) {
- return $image;
- } else {
- $width = imagesx($image);
- $height = imagesy($image);
- $result = imagecreatetruecolor($width, $height);
- imagecopy($result, $image, 0,0, 0,0, $width, $height);
- return $result;
- }
+ if (imageistruecolor($image)) {
+ return $image;
+ } else {
+ $width = imagesx($image);
+ $height = imagesy($image);
+ $result = imagecreatetruecolor($width, $height);
+ imagecopy($result, $image, 0,0, 0,0, $width, $height);
+ return $result;
+ }
}
/**
@@ -142,7 +142,25 @@ function test_to_truecolor($image)
*/
function save_actual_image($image)
{
- $pathinfo = pathinfo($_SERVER['SCRIPT_FILENAME']);
- $filename = "{$pathinfo['dirname']}/{$pathinfo['filename']}.out.png";
- imagepng($image, $filename);
+ $pathinfo = pathinfo($_SERVER['SCRIPT_FILENAME']);
+ $filename = "{$pathinfo['dirname']}/{$pathinfo['filename']}.out.png";
+ imagepng($image, $filename);
}
+
+/**
+ * Replicates write errors to the output log, but by catching
+ * and formatting exceptions instead so they have a consistent
+ * output
+ */
+
+function trycatch_dump(...$tests) {
+ foreach ($tests as $test) {
+ try {
+ var_dump($test());
+ }
+ catch (\Error $e) {
+ echo '!! [' . get_class($e) . '] ' . $e->getMessage() . "\n";
+ }
+ }
+}
+
diff --git a/ext/gd/tests/gd_info_basic.phpt b/ext/gd/tests/gd_info_basic.phpt
index b027462a41..99102168f1 100644
--- a/ext/gd/tests/gd_info_basic.phpt
+++ b/ext/gd/tests/gd_info_basic.phpt
@@ -14,11 +14,11 @@ gd_info()
* Source code: ext/standard/image.c
* Alias to functions:
*/
- echo "basic test of gd_info() function\n";
+ echo "basic test of gd_info() function\n";
- var_dump(gd_info());
+ var_dump(gd_info());
- echo "\nDone\n";
+ echo "\nDone\n";
?>
--EXPECTF--
basic test of gd_info() function
diff --git a/ext/gd/tests/gd_info_variation1.phpt b/ext/gd/tests/gd_info_variation1.phpt
index efad42588a..1ffd014335 100644
--- a/ext/gd/tests/gd_info_variation1.phpt
+++ b/ext/gd/tests/gd_info_variation1.phpt
@@ -20,7 +20,6 @@ echo "*** Testing gd_info() : variation ***\n";
var_dump(gd_info());
?>
-===DONE===
--EXPECTF--
*** Testing gd_info() : variation ***
array(%d) {
@@ -49,4 +48,3 @@ array(%d) {
["JIS-mapped Japanese Font Support"]=>
bool(%s)
}
-===DONE===
diff --git a/ext/gd/tests/gdimage_prevent_cloning.phpt b/ext/gd/tests/gdimage_prevent_cloning.phpt
new file mode 100644
index 0000000000..0f5c198e88
--- /dev/null
+++ b/ext/gd/tests/gdimage_prevent_cloning.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Checks that GdImage instances cannot be cloned
+--SKIPIF--
+<?php
+if(!extension_loaded('gd')) {
+ die('skip gd extension is not loaded');
+}
+?>
+--FILE--
+<?php
+
+ $img_src = imagecreatetruecolor(32, 32);
+ $img_dst = clone $img_src;
+
+?>
+--EXPECTF--
+Fatal error: Uncaught Error: Trying to clone an uncloneable object of class GdImage in %s:%d
+Stack trace:
+#0 {main}
+ thrown in %s on line %d
diff --git a/ext/gd/tests/gdimage_prevent_serialization.phpt b/ext/gd/tests/gdimage_prevent_serialization.phpt
new file mode 100644
index 0000000000..e1e33127d1
--- /dev/null
+++ b/ext/gd/tests/gdimage_prevent_serialization.phpt
@@ -0,0 +1,21 @@
+--TEST--
+GdImage instances must not be serialized
+--SKIPIF--
+<?php
+if(!extension_loaded('gd')) {
+ die('skip gd extension is not loaded');
+}
+?>
+--FILE--
+<?php
+
+ $img_src = imagecreatetruecolor(32, 32);
+ var_dump(serialize($img_src));
+
+?>
+--EXPECTF--
+Fatal error: Uncaught Exception: Serialization of 'GdImage' is not allowed in %s:%d
+Stack trace:
+#0 %s(%d): serialize(Object(GdImage))
+#1 {main}
+ thrown in %s on line %d
diff --git a/ext/gd/tests/gif.phpt b/ext/gd/tests/gif.phpt
index 39ade092c2..8315fb0dbc 100644
--- a/ext/gd/tests/gif.phpt
+++ b/ext/gd/tests/gif.phpt
@@ -13,34 +13,34 @@ gif in/out
<?php
function check_box($r,$g,$b, $error=0) {
- $cwd = __DIR__;
- $im2 = imagecreatefromgif($cwd . '/test_gif.gif');
-
- $c = imagecolorsforindex($im2, imagecolorat($im2, 8,8));
-
- if ($error>0) {
- $r_min = $r - $error; $r_max = $r + $error;
- $g_min = $g - $error; $g_max = $g + $error;
- $b_min = $b - $error; $b_max = $b + $error;
-
- if (
- ($c['red'] >= $r_min || $c['red'] <= $r_max)
- &&
- ($c['green'] >= $g_min || $c['green'] <= $g_max)
- &&
- ($c['blue'] >= $b_min || $c['blue'] <= $b_max)
- ) {
- return true;
- } else {
- return false;
- }
- } else {
- if ($c['red']==$r && $c['green']==$g && $c['blue']==$b) {
- return true;
- } else {
- return false;
- }
- }
+ $cwd = __DIR__;
+ $im2 = imagecreatefromgif($cwd . '/test_gif.gif');
+
+ $c = imagecolorsforindex($im2, imagecolorat($im2, 8,8));
+
+ if ($error>0) {
+ $r_min = $r - $error; $r_max = $r + $error;
+ $g_min = $g - $error; $g_max = $g + $error;
+ $b_min = $b - $error; $b_max = $b + $error;
+
+ if (
+ ($c['red'] >= $r_min || $c['red'] <= $r_max)
+ &&
+ ($c['green'] >= $g_min || $c['green'] <= $g_max)
+ &&
+ ($c['blue'] >= $b_min || $c['blue'] <= $b_max)
+ ) {
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+ if ($c['red']==$r && $c['green']==$g && $c['blue']==$b) {
+ return true;
+ } else {
+ return false;
+ }
+ }
}
$cwd = __DIR__;
@@ -49,76 +49,76 @@ $c = imagecolorallocate($im, 255,255,255);
imagefilledrectangle($im, 5,5, 10,10, $c);
imagegif($im, $cwd . '/test_gif.gif');
if (check_box(255,255,255)) {
- echo "<4 cols: ok\n";
+ echo "<4 cols: ok\n";
}
$im = imagecreate(10,10);
for ($i=0; $i<7; $i++) {
- $c = imagecolorallocate($im, $i,$i,$i);
+ $c = imagecolorallocate($im, $i,$i,$i);
}
imagefilledrectangle($im, 5,5, 10,10, $c);
imagegif($im, $cwd . '/test_gif.gif');
$i--;
if (check_box($i,$i,$i)) {
- echo "<8 cols: ok\n";
+ echo "<8 cols: ok\n";
}
$im = imagecreate(10,10);
for ($i=0; $i<15; $i++) {
- $c = imagecolorallocate($im, $i,$i,$i);
+ $c = imagecolorallocate($im, $i,$i,$i);
}
imagefilledrectangle($im, 5,5, 10,10, $c);
imagegif($im, $cwd . '/test_gif.gif');
$i--;
if (check_box($i,$i,$i)) {
- echo "<16 cols: ok\n";
+ echo "<16 cols: ok\n";
}
$im = imagecreate(10,10);
for ($i=0; $i<31; $i++) {
- $c = imagecolorallocate($im, $i,$i,$i);
+ $c = imagecolorallocate($im, $i,$i,$i);
}
imagefilledrectangle($im, 5,5, 10,10, $c);
imagegif($im, $cwd . '/test_gif.gif');
$i--;
if (check_box($i,$i,$i)) {
- echo "<32 cols: ok\n";
+ echo "<32 cols: ok\n";
}
$im = imagecreate(10,10);
for ($i=0; $i<63; $i++) {
- $c = imagecolorallocate($im, $i,$i,$i);
+ $c = imagecolorallocate($im, $i,$i,$i);
}
imagefilledrectangle($im, 5,5, 10,10, $c);
imagegif($im, $cwd . '/test_gif.gif');
$i--;
if (check_box($i,$i,$i)) {
- echo "<64 cols: ok\n";
+ echo "<64 cols: ok\n";
}
$im = imagecreate(10,10);
for ($i=0; $i<127; $i++) {
- $c = imagecolorallocate($im, $i,$i,$i);
+ $c = imagecolorallocate($im, $i,$i,$i);
}
imagefilledrectangle($im, 5,5, 10,10, $c);
imagegif($im, $cwd . '/test_gif.gif');
$i--;
if (check_box($i,$i,$i)) {
- echo "<128 cols: ok\n";
+ echo "<128 cols: ok\n";
}
$im = imagecreate(10,10);
for ($i=0; $i<255; $i++) {
- $c = imagecolorallocate($im, $i,$i,$i);
+ $c = imagecolorallocate($im, $i,$i,$i);
}
imagefilledrectangle($im, 5,5, 10,10, $c);
imagegif($im, $cwd . '/test_gif.gif');
$i--;
if (check_box($i,$i,$i)) {
- echo "<256 cols: ok\n";
+ echo "<256 cols: ok\n";
}
@@ -128,7 +128,7 @@ imagegif($im, $cwd . '/test_gif.gif');
imagegif($im, $cwd . '/test_gif_2.gif');
if (check_box(255,255,255, 10)) {
- echo ">256 cols: ok\n";
+ echo ">256 cols: ok\n";
}
@unlink($cwd . "/test_gif.gif");
diff --git a/ext/gd/tests/gif2gd.phpt b/ext/gd/tests/gif2gd.phpt
index 3fe9397fb6..a741cadb26 100644
--- a/ext/gd/tests/gif2gd.phpt
+++ b/ext/gd/tests/gif2gd.phpt
@@ -12,18 +12,18 @@ gif --> gd1/gd2 conversion test
?>
--FILE--
<?php
- $cwd = __DIR__;
+ $cwd = __DIR__;
- echo "GIF to GD1 conversion: ";
- echo imagegd(imagecreatefromgif($cwd . "/conv_test.gif"), $cwd . "/test_gif.gd1") ? 'ok' : 'failed';
- echo "\n";
+ echo "GIF to GD1 conversion: ";
+ echo imagegd(imagecreatefromgif($cwd . "/conv_test.gif"), $cwd . "/test_gif.gd1") ? 'ok' : 'failed';
+ echo "\n";
- echo "GIF to GD2 conversion: ";
- echo imagegd2(imagecreatefromgif($cwd . "/conv_test.gif"), $cwd . "/test_gif.gd2") ? 'ok' : 'failed';
- echo "\n";
+ echo "GIF to GD2 conversion: ";
+ echo imagegd2(imagecreatefromgif($cwd . "/conv_test.gif"), $cwd . "/test_gif.gd2") ? 'ok' : 'failed';
+ echo "\n";
- @unlink($cwd . "/test_gif.gd1");
- @unlink($cwd . "/test_gif.gd2");
+ @unlink($cwd . "/test_gif.gd1");
+ @unlink($cwd . "/test_gif.gd2");
?>
--EXPECT--
GIF to GD1 conversion: ok
diff --git a/ext/gd/tests/gif2jpg.phpt b/ext/gd/tests/gif2jpg.phpt
index 38d8963271..b0ce474886 100644
--- a/ext/gd/tests/gif2jpg.phpt
+++ b/ext/gd/tests/gif2jpg.phpt
@@ -15,13 +15,13 @@ gif --> jpeg conversion test
?>
--FILE--
<?php
- $cwd = __DIR__;
+ $cwd = __DIR__;
- echo "GIF to JPEG conversion: ";
- echo imagejpeg(imagecreatefromgif($cwd . "/conv_test.gif"), $cwd . "/test_gif.jpeg") ? 'ok' : 'failed';
- echo "\n";
+ echo "GIF to JPEG conversion: ";
+ echo imagejpeg(imagecreatefromgif($cwd . "/conv_test.gif"), $cwd . "/test_gif.jpeg") ? 'ok' : 'failed';
+ echo "\n";
- @unlink($cwd . "/test_gif.jpeg");
+ @unlink($cwd . "/test_gif.jpeg");
?>
--EXPECT--
GIF to JPEG conversion: ok
diff --git a/ext/gd/tests/gif2png.phpt b/ext/gd/tests/gif2png.phpt
index 27aac9cdd8..295a80944c 100644
--- a/ext/gd/tests/gif2png.phpt
+++ b/ext/gd/tests/gif2png.phpt
@@ -15,13 +15,13 @@ gif --> png conversion test
?>
--FILE--
<?php
- $cwd = __DIR__;
+ $cwd = __DIR__;
- echo "GIF to PNG conversion: ";
- echo imagepng(imagecreatefromgif($cwd . "/conv_test.gif"), $cwd . "/test_gif.png") ? 'ok' : 'failed';
- echo "\n";
+ echo "GIF to PNG conversion: ";
+ echo imagepng(imagecreatefromgif($cwd . "/conv_test.gif"), $cwd . "/test_gif.png") ? 'ok' : 'failed';
+ echo "\n";
- @unlink($cwd . "/test_gif.png");
+ @unlink($cwd . "/test_gif.png");
?>
--EXPECT--
GIF to PNG conversion: ok
diff --git a/ext/gd/tests/image2wbmp_error.phpt b/ext/gd/tests/image2wbmp_error.phpt
deleted file mode 100644
index 8d8d836ef7..0000000000
--- a/ext/gd/tests/image2wbmp_error.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-image2wbmp() is deprecated
---SKIPIF--
-<?php
-if (!extension_loaded('gd')) die('skip gd extension not available');
-?>
---FILE--
-<?php
-$im = imagecreate(10, 10);
-imagecolorallocate($im, 0, 0, 0);
-image2wbmp($im, __DIR__ . '/image2wbmp_error.wbmp');
-?>
-===DONE===
---CLEAN--
-<?php
-unlink(__DIR__ . '/image2wbmp_error.wbmp');
-?>
---EXPECTF--
-Deprecated: Function image2wbmp() is deprecated in %s on line %d
-===DONE===
diff --git a/ext/gd/tests/imageantialias_error1.phpt b/ext/gd/tests/imageantialias_error1.phpt
deleted file mode 100644
index 8a9d5315a6..0000000000
--- a/ext/gd/tests/imageantialias_error1.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-Testing wrong parameter resource in imageantialias() of GD library
---CREDITS--
-Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-$image = tmpfile();
-
-var_dump(imageantialias($image, true));
-?>
---EXPECTF--
-Warning: imageantialias(): supplied resource is not a valid Image resource in %s on line %d
-bool(false)
diff --git a/ext/gd/tests/imageantialias_error2.phpt b/ext/gd/tests/imageantialias_error2.phpt
index 7971e90cae..2b17b78258 100644
--- a/ext/gd/tests/imageantialias_error2.phpt
+++ b/ext/gd/tests/imageantialias_error2.phpt
@@ -11,7 +11,7 @@ if (!extension_loaded("gd")) die("skip GD not present");
<?php
/*
-It seems the second argument passing is not being correclty checked.
+It seems the second argument passing is not being correctly checked.
This test is failing due to this wrogn check
*/
diff --git a/ext/gd/tests/imagebmp_nullbyte_injection.phpt b/ext/gd/tests/imagebmp_nullbyte_injection.phpt
index 0b6d1843d3..00d0a7168c 100644
--- a/ext/gd/tests/imagebmp_nullbyte_injection.phpt
+++ b/ext/gd/tests/imagebmp_nullbyte_injection.phpt
@@ -8,10 +8,11 @@ if (!gd_info()['BMP Support']) die('skip BMP support not available');
--FILE--
<?php
$image = imagecreate(1,1);// 1px image
-var_dump(imagebmp($image, "./foo\0bar"));
+try {
+ imagebmp($image, "./foo\0bar");
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
-===DONE===
---EXPECTF--
-Warning: imagebmp(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
-bool(false)
-===DONE===
+--EXPECT--
+Invalid 2nd parameter, filename must not contain null bytes
diff --git a/ext/gd/tests/imagechar_error2.phpt b/ext/gd/tests/imagechar_error2.phpt
deleted file mode 100644
index 1666788ead..0000000000
--- a/ext/gd/tests/imagechar_error2.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-Testing error on non-image resource parameter 1 of imagechar() of GD library
---CREDITS--
-Rafael Dohms <rdohms [at] gmail [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
- if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-
-$result = imagechar(tmpfile(), 1, 5, 5, 'C', 1);
-
-?>
---EXPECTF--
-Warning: imagechar(): supplied resource is not a valid Image resource in %s on line %d
diff --git a/ext/gd/tests/imagecharup_error2.phpt b/ext/gd/tests/imagecharup_error2.phpt
deleted file mode 100644
index e2db7bb558..0000000000
--- a/ext/gd/tests/imagecharup_error2.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-Testing error on non-image resource parameter 1 of imagecharup() of GD library
---CREDITS--
-Rafael Dohms <rdohms [at] gmail [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
- if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-
-$result = imagecharup(tmpfile(), 1, 5, 5, 'C', 1);
-
-?>
---EXPECTF--
-Warning: imagecharup(): supplied resource is not a valid Image resource in %s on line %d
diff --git a/ext/gd/tests/imagecolorallocate_basic.phpt b/ext/gd/tests/imagecolorallocate_basic.phpt
index e0e9adf852..64ce2203a0 100644
--- a/ext/gd/tests/imagecolorallocate_basic.phpt
+++ b/ext/gd/tests/imagecolorallocate_basic.phpt
@@ -25,11 +25,9 @@ var_dump( imagecolorallocate($im, 0, 255, 0) );
var_dump( imagecolorallocate($im, 0, 0, 255) );
var_dump( imagecolorallocate($im, 255, 255, 255) );
?>
-===DONE===
--EXPECT--
*** Testing imagecolorallocate() : basic functionality ***
int(16711680)
int(65280)
int(255)
int(16777215)
-===DONE===
diff --git a/ext/gd/tests/imagecolorallocate_variation5.phpt b/ext/gd/tests/imagecolorallocate_variation5.phpt
index ac3e4bb20e..1451af5a83 100644
--- a/ext/gd/tests/imagecolorallocate_variation5.phpt
+++ b/ext/gd/tests/imagecolorallocate_variation5.phpt
@@ -11,6 +11,8 @@ if(!function_exists('imagecreatetruecolor')) {
?>
--FILE--
<?php
+require __DIR__ . '/func.inc';
+
/* Prototype : int imagecolorallocate(resource im, int red, int green, int blue)
* Description: Allocate a color for an image
* Source code: ext/gd/gd.c
@@ -38,14 +40,16 @@ $values = array(
// loop through each element of the array for blue
foreach($values as $key => $value) {
- echo "\n--$key--\n";
- var_dump( imagecolorallocate($im, $value, $green, $blue) );
- var_dump( imagecolorallocate($im, $red, $value, $blue) );
- var_dump( imagecolorallocate($im, $red, $green, $value) );
+ echo "\n--$key--\n";
+
+ trycatch_dump(
+ fn() => imagecolorallocate($im, $value, $green, $blue),
+ fn() => imagecolorallocate($im, $red, $value, $blue),
+ fn() => imagecolorallocate($im, $red, $green, $value)
+ );
};
?>
-===DONE===
---EXPECTF--
+--EXPECT--
*** Testing imagecolorallocate() : usage variations ***
--Octal 000--
@@ -59,15 +63,9 @@ int(657930)
int(657930)
--Octal -012--
-
-Warning: imagecolorallocate(): Red component is out of range in %s on line %d
-bool(false)
-
-Warning: imagecolorallocate(): Green component is out of range in %s on line %d
-bool(false)
-
-Warning: imagecolorallocate(): Blue component is out of range in %s on line %d
-bool(false)
+!! [ValueError] Red component is out of range, must be between 0 and 255 (inclusive)
+!! [ValueError] Green component is out of range, must be between 0 and 255 (inclusive)
+!! [ValueError] Blue component is out of range, must be between 0 and 255 (inclusive)
--Octal 0377--
int(16714250)
@@ -85,18 +83,11 @@ int(657930)
int(657930)
--Hexa-decimal -0xA--
-
-Warning: imagecolorallocate(): Red component is out of range in %s on line %d
-bool(false)
-
-Warning: imagecolorallocate(): Green component is out of range in %s on line %d
-bool(false)
-
-Warning: imagecolorallocate(): Blue component is out of range in %s on line %d
-bool(false)
+!! [ValueError] Red component is out of range, must be between 0 and 255 (inclusive)
+!! [ValueError] Green component is out of range, must be between 0 and 255 (inclusive)
+!! [ValueError] Blue component is out of range, must be between 0 and 255 (inclusive)
--Hexa-decimal 0xFF--
int(16714250)
int(720650)
int(658175)
-===DONE===
diff --git a/ext/gd/tests/imagecolorallocate_variation6.phpt b/ext/gd/tests/imagecolorallocate_variation6.phpt
index a3649be71f..6af26801b8 100644
--- a/ext/gd/tests/imagecolorallocate_variation6.phpt
+++ b/ext/gd/tests/imagecolorallocate_variation6.phpt
@@ -11,6 +11,8 @@ if(!function_exists('imagecreatetruecolor')) {
?>
--FILE--
<?php
+require __DIR__ . '/func.inc';
+
/* Prototype : int imagecolorallocate(resource im, int red, int green, int blue)
* Description: Allocate a color for an image
* Source code: ext/gd/gd.c
@@ -34,75 +36,40 @@ foreach($values as $key => $value) {
//Need to be created every time to get expected return value
$im_palette = imagecreate(200, 200);
$im_true_color = imagecreatetruecolor(200, 200);
- var_dump( imagecolorallocate($im_palette, $value, 0, 0) );
- var_dump( imagecolorallocate($im_true_color, $value, 0, 0) );
- var_dump( imagecolorallocate($im_palette, 0, $value, 0) );
- var_dump( imagecolorallocate($im_true_color, 0, $value, 0) );
- var_dump( imagecolorallocate($im_palette, 0, 0, $value) );
- var_dump( imagecolorallocate($im_true_color, 0, 0, $value) );
+
+ trycatch_dump(
+ fn() => imagecolorallocate($im_palette, $value, 0, 0),
+ fn() => imagecolorallocate($im_true_color, $value, 0, 0),
+ fn() => imagecolorallocate($im_palette, 0, $value, 0),
+ fn() => imagecolorallocate($im_true_color, 0, $value, 0),
+ fn() => imagecolorallocate($im_palette, 0, 0, $value),
+ fn() => imagecolorallocate($im_true_color, 0, 0, $value)
+ );
};
?>
-===DONE===
---EXPECTF--
+--EXPECT--
*** Testing imagecolorallocate() : usage variations ***
--Decimal 256--
-
-Warning: imagecolorallocate(): Red component is out of range in %s on line %d
-bool(false)
-
-Warning: imagecolorallocate(): Red component is out of range in %s on line %d
-bool(false)
-
-Warning: imagecolorallocate(): Green component is out of range in %s on line %d
-bool(false)
-
-Warning: imagecolorallocate(): Green component is out of range in %s on line %d
-bool(false)
-
-Warning: imagecolorallocate(): Blue component is out of range in %s on line %d
-bool(false)
-
-Warning: imagecolorallocate(): Blue component is out of range in %s on line %d
-bool(false)
+!! [ValueError] Red component is out of range, must be between 0 and 255 (inclusive)
+!! [ValueError] Red component is out of range, must be between 0 and 255 (inclusive)
+!! [ValueError] Green component is out of range, must be between 0 and 255 (inclusive)
+!! [ValueError] Green component is out of range, must be between 0 and 255 (inclusive)
+!! [ValueError] Blue component is out of range, must be between 0 and 255 (inclusive)
+!! [ValueError] Blue component is out of range, must be between 0 and 255 (inclusive)
--Octal 0400--
-
-Warning: imagecolorallocate(): Red component is out of range in %s on line %d
-bool(false)
-
-Warning: imagecolorallocate(): Red component is out of range in %s on line %d
-bool(false)
-
-Warning: imagecolorallocate(): Green component is out of range in %s on line %d
-bool(false)
-
-Warning: imagecolorallocate(): Green component is out of range in %s on line %d
-bool(false)
-
-Warning: imagecolorallocate(): Blue component is out of range in %s on line %d
-bool(false)
-
-Warning: imagecolorallocate(): Blue component is out of range in %s on line %d
-bool(false)
+!! [ValueError] Red component is out of range, must be between 0 and 255 (inclusive)
+!! [ValueError] Red component is out of range, must be between 0 and 255 (inclusive)
+!! [ValueError] Green component is out of range, must be between 0 and 255 (inclusive)
+!! [ValueError] Green component is out of range, must be between 0 and 255 (inclusive)
+!! [ValueError] Blue component is out of range, must be between 0 and 255 (inclusive)
+!! [ValueError] Blue component is out of range, must be between 0 and 255 (inclusive)
--Hexa-decimal 0x100--
-
-Warning: imagecolorallocate(): Red component is out of range in %s on line %d
-bool(false)
-
-Warning: imagecolorallocate(): Red component is out of range in %s on line %d
-bool(false)
-
-Warning: imagecolorallocate(): Green component is out of range in %s on line %d
-bool(false)
-
-Warning: imagecolorallocate(): Green component is out of range in %s on line %d
-bool(false)
-
-Warning: imagecolorallocate(): Blue component is out of range in %s on line %d
-bool(false)
-
-Warning: imagecolorallocate(): Blue component is out of range in %s on line %d
-bool(false)
-===DONE===
+!! [ValueError] Red component is out of range, must be between 0 and 255 (inclusive)
+!! [ValueError] Red component is out of range, must be between 0 and 255 (inclusive)
+!! [ValueError] Green component is out of range, must be between 0 and 255 (inclusive)
+!! [ValueError] Green component is out of range, must be between 0 and 255 (inclusive)
+!! [ValueError] Blue component is out of range, must be between 0 and 255 (inclusive)
+!! [ValueError] Blue component is out of range, must be between 0 and 255 (inclusive)
diff --git a/ext/gd/tests/imagecolorallocatealpha_error1.phpt b/ext/gd/tests/imagecolorallocatealpha_error1.phpt
deleted file mode 100644
index 793c02d106..0000000000
--- a/ext/gd/tests/imagecolorallocatealpha_error1.phpt
+++ /dev/null
@@ -1,25 +0,0 @@
---TEST--
-Testing imagecolorallocatealpha(): Wrong types for parameter 1
---CREDITS--
-Rafael Dohms <rdohms [at] gmail [dot] com>
---SKIPIF--
-<?php
- if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-$resource = tmpfile();
-
-imagecolorallocatealpha($resource, 255, 255, 255, 50);
-imagecolorallocatealpha('string', 255, 255, 255, 50);
-imagecolorallocatealpha(array(), 255, 255, 255, 50);
-imagecolorallocatealpha(null, 255, 255, 255, 50);
-?>
---EXPECTF--
-Warning: imagecolorallocatealpha(): supplied resource is not a valid Image resource in %s on line %d
-
-Warning: imagecolorallocatealpha() expects parameter 1 to be resource, %s given in %s on line %d
-
-Warning: imagecolorallocatealpha() expects parameter 1 to be resource, array given in %s on line %d
-
-Warning: imagecolorallocatealpha() expects parameter 1 to be resource, null given in %s on line %d
diff --git a/ext/gd/tests/imagecolordeallocate_error1.phpt b/ext/gd/tests/imagecolordeallocate_error1.phpt
deleted file mode 100644
index 82460139b6..0000000000
--- a/ext/gd/tests/imagecolordeallocate_error1.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-Testing imagecolordeallocate() of GD library with invalid resource type
---CREDITS--
-Rafael Dohms <rdohms [at] gmail [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
- if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-
-$image = imagecreatetruecolor(180, 30);
-$white = imagecolorallocate($image, 255, 255, 255);
-
-$resource = tmpfile();
-
-$result = imagecolordeallocate($resource, $white);
-
-?>
---EXPECTF--
-Warning: imagecolordeallocate(): supplied resource is not a valid Image resource in %s on line %d
diff --git a/ext/gd/tests/imagecolordeallocate_error3.phpt b/ext/gd/tests/imagecolordeallocate_error3.phpt
index e9be1ea66a..e0748c44ba 100644
--- a/ext/gd/tests/imagecolordeallocate_error3.phpt
+++ b/ext/gd/tests/imagecolordeallocate_error3.phpt
@@ -1,5 +1,5 @@
--TEST--
-Testing imagecolordeallocate() of GD library with Out of range intergers (Above)
+Testing imagecolordeallocate() of GD library with Out of range integers (Above)
--CREDITS--
Rafael Dohms <rdohms [at] gmail [dot] com>
#testfest PHPSP on 2009-06-20
@@ -9,14 +9,17 @@ Rafael Dohms <rdohms [at] gmail [dot] com>
?>
--FILE--
<?php
+require_once __DIR__ . '/func.inc';
+
$image = imagecreate(180, 30);
$white = imagecolorallocate($image, 255, 255, 255);
$totalColors = imagecolorstotal($image);
-$result = imagecolordeallocate($image, $totalColors + 100);
-var_dump($result);
+trycatch_dump(
+ fn() => imagecolordeallocate($image, $totalColors + 100)
+);
+
?>
---EXPECTF--
-Warning: imagecolordeallocate(): Color index 101 out of range in %s on line %d
-bool(false)
+--EXPECT--
+!! [ValueError] Color index 101 out of range
diff --git a/ext/gd/tests/imagecolordeallocate_error4.phpt b/ext/gd/tests/imagecolordeallocate_error4.phpt
index 22fc2fa3ef..e35c529879 100644
--- a/ext/gd/tests/imagecolordeallocate_error4.phpt
+++ b/ext/gd/tests/imagecolordeallocate_error4.phpt
@@ -1,5 +1,5 @@
--TEST--
-Testing imagecolordeallocate() of GD library with Out of range intergers (Below)
+Testing imagecolordeallocate() of GD library with Out of range integers (Below)
--CREDITS--
Rafael Dohms <rdohms [at] gmail [dot] com>
#testfest PHPSP on 2009-06-20
@@ -9,14 +9,17 @@ Rafael Dohms <rdohms [at] gmail [dot] com>
?>
--FILE--
<?php
+
+require_once __DIR__ . '/func.inc';
$image = imagecreate(180, 30);
$white = imagecolorallocate($image, 255, 255, 255);
$totalColors = imagecolorstotal($image);
-$result = imagecolordeallocate($image, -1.0);
-var_dump($result);
+trycatch_dump(
+ fn() => imagecolordeallocate($image, -1.0)
+);
+
?>
---EXPECTF--
-Warning: imagecolordeallocate(): Color index -1 out of range in %s on line %d
-bool(false)
+--EXPECT--
+!! [ValueError] Color index -1 out of range
diff --git a/ext/gd/tests/imagecolorset_basic.phpt b/ext/gd/tests/imagecolorset_basic.phpt
index f051a2202f..ef7f361ad5 100644
--- a/ext/gd/tests/imagecolorset_basic.phpt
+++ b/ext/gd/tests/imagecolorset_basic.phpt
@@ -20,7 +20,7 @@ imagecolorallocate($im, 255, 0, 0);
// Get the color index for the background
$bg = imagecolorat($im, 0, 0);
-// Set the backgrund to be blue
+// Set the background to be blue
imagecolorset($im, $bg, 0, 0, 255);
include_once __DIR__ . '/func.inc';
diff --git a/ext/gd/tests/imagecolorstotal_basic.phpt b/ext/gd/tests/imagecolorstotal_basic.phpt
index 22eb022fc2..0cdc10bcdd 100644
--- a/ext/gd/tests/imagecolorstotal_basic.phpt
+++ b/ext/gd/tests/imagecolorstotal_basic.phpt
@@ -29,8 +29,6 @@ echo 'Total colors in image: ' . imagecolorstotal($im);
imagedestroy($im);
?>
-===DONE===
--EXPECT--
*** Testing imagecolorstotal() : basic functionality ***
Total colors in image: 128
-===DONE===
diff --git a/ext/gd/tests/imagecolorstotal_error.phpt b/ext/gd/tests/imagecolorstotal_error.phpt
deleted file mode 100644
index 59999423ca..0000000000
--- a/ext/gd/tests/imagecolorstotal_error.phpt
+++ /dev/null
@@ -1,54 +0,0 @@
---TEST--
-Test imagecolorstotal() function : error conditions - Pass incorrect number of arguments
---SKIPIF--
-<?php
-if(!extension_loaded('gd')) {
- die('skip gd extension is not loaded');
-}
-if(!function_exists('imagecolorstotal')) {
- die('skip imagecolorstotal function is not available');
-}
-?>
---FILE--
-<?php
-/* Prototype : int imagecolorstotal ( resource $image )
- * Description: Find out the number of colors in an image's palette
- * Source code: ext/gd/gd.c
- */
-
-echo "*** Testing imagecolorstotal() : error conditions ***\n";
-
-// Get a resource
-$im = fopen(__FILE__, 'r');
-
-echo "\n-- Testing imagecolorstotal() function with Zero arguments --\n";
-var_dump( imagecolorstotal() );
-
-echo "\n-- Testing imagecolorstotal() function with more than expected no. of arguments --\n";
-$extra_arg = false;
-var_dump( imagecolorstotal($im, $extra_arg) );
-
-echo "\n-- Testing imagecolorstotal() function with a invalid resource\n";
-var_dump( imagecolorstotal($im) );
-
-fclose($im);
-?>
-===DONE===
---EXPECTF--
-*** Testing imagecolorstotal() : error conditions ***
-
--- Testing imagecolorstotal() function with Zero arguments --
-
-Warning: imagecolorstotal() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
--- Testing imagecolorstotal() function with more than expected no. of arguments --
-
-Warning: imagecolorstotal() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
--- Testing imagecolorstotal() function with a invalid resource
-
-Warning: imagecolorstotal(): supplied resource is not a valid Image resource in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/gd/tests/imagecolourstotal_basic.phpt b/ext/gd/tests/imagecolourstotal_basic.phpt
index 58405c5c19..e67794b604 100644
--- a/ext/gd/tests/imagecolourstotal_basic.phpt
+++ b/ext/gd/tests/imagecolourstotal_basic.phpt
@@ -39,7 +39,6 @@ var_dump( imagecolorstotal( $img ) );
imagedestroy( $img );
?>
-===DONE===
--EXPECT--
*** Testing imagecolorstotal() : basic functionality ***
int(0)
@@ -47,4 +46,3 @@ int(1)
int(3)
int(0)
int(0)
-===DONE===
diff --git a/ext/gd/tests/imageconvolution_error2.phpt b/ext/gd/tests/imageconvolution_error2.phpt
index 217e3e1547..d26851c26c 100644
--- a/ext/gd/tests/imageconvolution_error2.phpt
+++ b/ext/gd/tests/imageconvolution_error2.phpt
@@ -9,6 +9,8 @@ if (!extension_loaded("gd")) die("skip GD not present");
?>
--FILE--
<?php
+require __DIR__ . '/func.inc';
+
$image = imagecreatetruecolor(180, 30);
// Writes the text and apply a gaussian blur on the image
@@ -19,8 +21,10 @@ $gaussian = array(
array(2.0, 4.0, 2.0)
);
-var_dump(imageconvolution($image, $gaussian, 16, 0));
+trycatch_dump(
+ fn() => imageconvolution($image, $gaussian, 16, 0)
+);
+
?>
---EXPECTF--
-Warning: imageconvolution(): You must have 3x3 array in %s on line %d
-bool(false)
+--EXPECT--
+!! [ValueError] Convolution matrix must be a 3x3 array
diff --git a/ext/gd/tests/imageconvolution_error3.phpt b/ext/gd/tests/imageconvolution_error3.phpt
index 5f1ddc95be..8974fdbda0 100644
--- a/ext/gd/tests/imageconvolution_error3.phpt
+++ b/ext/gd/tests/imageconvolution_error3.phpt
@@ -9,6 +9,8 @@ if (!extension_loaded("gd")) die("skip GD not present");
?>
--FILE--
<?php
+require __DIR__ . '/func.inc';
+
$image = imagecreatetruecolor(180, 30);
// Writes the text and apply a gaussian blur on the image
@@ -20,8 +22,18 @@ $gaussian = array(
array(1.0, 2.0)
);
-var_dump(imageconvolution($image, $gaussian, 16, 0));
+$gaussian_bad_key = array(
+ array(1.0, 2.0, 1.0),
+ array(2.0, 4.0, 2.0),
+ array(1.0, 2.0, 'x' => 1.0)
+);
+
+trycatch_dump(
+ fn() => imageconvolution($image, $gaussian, 16, 0),
+ fn() => imageconvolution($image, $gaussian_bad_key, 16, 0)
+);
+
?>
---EXPECTF--
-Warning: imageconvolution(): You must have 3x3 array in %s on line %d
-bool(false)
+--EXPECT--
+!! [ValueError] Convolution matrix must be a 3x3 array, matrix[2] only has 2 elements
+!! [ValueError] Convolution matrix must be a 3x3 array, matrix[2][2] cannot be found (missing integer key)
diff --git a/ext/gd/tests/imagecreate_error.phpt b/ext/gd/tests/imagecreate_error.phpt
new file mode 100644
index 0000000000..9fd8679c13
--- /dev/null
+++ b/ext/gd/tests/imagecreate_error.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Testing imagecreate(): error on out of bound parameters
+--SKIPIF--
+<?php
+ if (!extension_loaded("gd")) die("skip GD not present");
+ if (!function_exists("imagecreate")) die("skip GD Version not compatible");
+?>
+--FILE--
+<?php
+
+require __DIR__ . '/func.inc';
+
+trycatch_dump(
+ fn() => imagecreate(-1, 30),
+ fn() => imagecreate(30, -1)
+);
+
+?>
+--EXPECT--
+!! [ValueError] Invalid width (x_size)
+!! [ValueError] Invalid height (y_size)
diff --git a/ext/gd/tests/imagecreatefrombmp_basic.phpt b/ext/gd/tests/imagecreatefrombmp_basic.phpt
index 96c90700b8..9cf6bd2ca3 100644
--- a/ext/gd/tests/imagecreatefrombmp_basic.phpt
+++ b/ext/gd/tests/imagecreatefrombmp_basic.phpt
@@ -13,7 +13,5 @@ $im = imagecreatefrombmp(__DIR__ . '/imagecreatefrombmp_basic.bmp');
include_once __DIR__ . '/func.inc';
test_image_equals_file(__DIR__ . '/imagecreatefrombmp_basic.png', $im);
?>
-===DONE===
--EXPECT--
The images are equal.
-===DONE===
diff --git a/ext/gd/tests/imagecreatefromstring_bmp.phpt b/ext/gd/tests/imagecreatefromstring_bmp.phpt
index a0c8b3e57e..14d7aabede 100644
--- a/ext/gd/tests/imagecreatefromstring_bmp.phpt
+++ b/ext/gd/tests/imagecreatefromstring_bmp.phpt
@@ -22,7 +22,5 @@ $im = imagecreatefromstring($bmp);
include_once __DIR__ . '/func.inc';
test_image_equals_file(__DIR__ . '/imagecreatefromstring_bmp.png', $im);
?>
-===DONE===
--EXPECT--
The images are equal.
-===DONE===
diff --git a/ext/gd/tests/imagecreatefromstring_gif.phpt b/ext/gd/tests/imagecreatefromstring_gif.phpt
index c913f4ed13..66f91c1aff 100644
--- a/ext/gd/tests/imagecreatefromstring_gif.phpt
+++ b/ext/gd/tests/imagecreatefromstring_gif.phpt
@@ -13,8 +13,6 @@ var_dump(imagesx($im));
var_dump(imagesy($im));
?>
-===DONE===
--EXPECT--
int(10)
int(10)
-===DONE===
diff --git a/ext/gd/tests/imagecreatefromstring_png.phpt b/ext/gd/tests/imagecreatefromstring_png.phpt
index efb8cc3622..b76f1a181a 100644
--- a/ext/gd/tests/imagecreatefromstring_png.phpt
+++ b/ext/gd/tests/imagecreatefromstring_png.phpt
@@ -13,8 +13,6 @@ var_dump(imagesx($im));
var_dump(imagesy($im));
?>
-===DONE===
--EXPECT--
int(10)
int(10)
-===DONE===
diff --git a/ext/gd/tests/imagecreatefromstring_webp.phpt b/ext/gd/tests/imagecreatefromstring_webp.phpt
index fbae919ab4..e60be0499a 100644
--- a/ext/gd/tests/imagecreatefromstring_webp.phpt
+++ b/ext/gd/tests/imagecreatefromstring_webp.phpt
@@ -13,8 +13,6 @@ var_dump(imagesx($im));
var_dump(imagesy($im));
?>
-===DONE===
--EXPECT--
int(10)
int(10)
-===DONE===
diff --git a/ext/gd/tests/imagecreatetruecolor_error2.phpt b/ext/gd/tests/imagecreatetruecolor_error2.phpt
index 3ab4cf1e1f..e2784b1530 100644
--- a/ext/gd/tests/imagecreatetruecolor_error2.phpt
+++ b/ext/gd/tests/imagecreatetruecolor_error2.phpt
@@ -9,16 +9,15 @@ Rafael Dohms <rdohms [at] gmail [dot] com>
?>
--FILE--
<?php
-$image = imagecreatetruecolor(-1, 30);
-$image = imagecreatetruecolor(30, -1);
-$image = imagecreatetruecolor(999999999999999999999999999, 30);
-$image = imagecreatetruecolor(30, 999999999999999999999999999);
-?>
---EXPECTF--
-Warning: imagecreatetruecolor(): Invalid image dimensions in %s on line %d
-Warning: imagecreatetruecolor(): Invalid image dimensions in %s on line %d
+require __DIR__ . '/func.inc';
-Warning: imagecreatetruecolor() expects parameter 1 to be int, float given in %s on line %d
+trycatch_dump(
+ fn() => imagecreatetruecolor(-1, 30),
+ fn() => imagecreatetruecolor(30, -1)
+);
-Warning: imagecreatetruecolor() expects parameter 2 to be int, float given in %s on line %d
+?>
+--EXPECT--
+!! [ValueError] Invalid width (x_size)
+!! [ValueError] Invalid height (y_size)
diff --git a/ext/gd/tests/imageellipse_error7.phpt b/ext/gd/tests/imageellipse_error7.phpt
deleted file mode 100644
index 0b4c1f549d..0000000000
--- a/ext/gd/tests/imageellipse_error7.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-Testing wrong param passing imageellipse() of GD library
---CREDITS--
-Ivan Rosolen <contato [at] ivanrosolen [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-
-// Create a resource
-$image = tmpfile();
-
-// try to draw a white ellipse
-imageellipse($image, 200, 150, 300, 200, 16777215);
-?>
---EXPECTF--
-Warning: imageellipse(): supplied resource is not a valid Image resource in %s on line %d
diff --git a/ext/gd/tests/imagefilledpolygon_basic.phpt b/ext/gd/tests/imagefilledpolygon_basic.phpt
index 0f5f9cf335..0bede9e6f9 100644
--- a/ext/gd/tests/imagefilledpolygon_basic.phpt
+++ b/ext/gd/tests/imagefilledpolygon_basic.phpt
@@ -36,7 +36,7 @@ $bg = imagecolorallocate($image, 0, 0, 0);
$col_poly = imagecolorallocate($image, 0, 255, 0);
// draw the polygon
-imagefilledpolygon($image, $points, count($points)/2, $col_poly);
+imagefilledpolygon($image, $points, $col_poly);
// output the picture to a file
imagepng($image, $dest);
diff --git a/ext/gd/tests/imagefilledpolygon_negative.phpt b/ext/gd/tests/imagefilledpolygon_negative.phpt
deleted file mode 100644
index a572a195f5..0000000000
--- a/ext/gd/tests/imagefilledpolygon_negative.phpt
+++ /dev/null
@@ -1,15 +0,0 @@
---TEST--
-imagefilledpolygon() with a negative num of points
---SKIPIF--
-<?php
- if (!function_exists('imagefilledpolygon')) die('skip imagefilledpolygon() not available');
-?>
---FILE--
-<?php
-$im = imagecreate(100, 100);
-$black = imagecolorallocate($im, 0, 0, 0);
-if (imagefilledpolygon($im, array(0, 0, 0, 0, 0, 0), -1, $black)) echo "should be false";
-imagedestroy($im);
-?>
---EXPECTF--
-Warning: imagefilledpolygon(): You must give a positive number of points in %s on line %d
diff --git a/ext/gd/tests/imagefilltoborder_error6.phpt b/ext/gd/tests/imagefilltoborder_error6.phpt
deleted file mode 100644
index 421c5932ee..0000000000
--- a/ext/gd/tests/imagefilltoborder_error6.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-Testing wrong param passing imagefilltoborder() of GD library
---CREDITS--
-Ivan Rosolen <contato [at] ivanrosolen [dot] com>
-#testfest PHPSP on 2009-06-30
---SKIPIF--
-<?php
-if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-// Create a image
-$image = imagecreatetruecolor( 100, 100 );
-
-// Draw a rectangle
-imagefilledrectangle( $image, 0, 0, 100, 100, imagecolorallocate( $image, 255, 255, 255 ) );
-
-// Draw an ellipse to fill with a black border
-imageellipse( $image, 50, 50, 50, 50, imagecolorallocate( $image, 0, 0, 0 ) );
-
-// Try to fill border
-$image_foo = tmpfile();
-imagefilltoborder( $image_foo, 50, 50, imagecolorallocate( $image, 0, 0, 0 ), imagecolorallocate( $image, 255, 0, 0 ) );
-
-?>
---EXPECTF--
-Warning: imagefilltoborder(): supplied resource is not a valid Image resource in %s on line %d
diff --git a/ext/gd/tests/imagefilter.phpt b/ext/gd/tests/imagefilter.phpt
index a46cc1476e..f040c5cac4 100644
--- a/ext/gd/tests/imagefilter.phpt
+++ b/ext/gd/tests/imagefilter.phpt
@@ -10,88 +10,88 @@ imagefilter() function test
--FILE--
<?php
$no_arg_filters = array(
- "IMG_FILTER_NEGATE",
- "IMG_FILTER_GRAYSCALE",
- "IMG_FILTER_EDGEDETECT",
- "IMG_FILTER_GAUSSIAN_BLUR",
- "IMG_FILTER_SELECTIVE_BLUR",
- "IMG_FILTER_EMBOSS",
- "IMG_FILTER_MEAN_REMOVAL"
+ "IMG_FILTER_NEGATE",
+ "IMG_FILTER_GRAYSCALE",
+ "IMG_FILTER_EDGEDETECT",
+ "IMG_FILTER_GAUSSIAN_BLUR",
+ "IMG_FILTER_SELECTIVE_BLUR",
+ "IMG_FILTER_EMBOSS",
+ "IMG_FILTER_MEAN_REMOVAL"
);
$SAVE_DIR = __DIR__;
$SOURCE_IMG = $SAVE_DIR . "/test.png";
- foreach ($no_arg_filters as $filt) {
- $im = imagecreatefrompng($SOURCE_IMG);
- if (imagefilter($im, constant($filt))) {
- imagepng($im, $SAVE_DIR."/".$filt. ".png");
- echo "$filt success\n";
- @unlink($SAVE_DIR."/".$filt. ".png");
- } else {
- echo "$filt failed\n";
- }
- }
+ foreach ($no_arg_filters as $filt) {
+ $im = imagecreatefrompng($SOURCE_IMG);
+ if (imagefilter($im, constant($filt))) {
+ imagepng($im, $SAVE_DIR."/".$filt. ".png");
+ echo "$filt success\n";
+ @unlink($SAVE_DIR."/".$filt. ".png");
+ } else {
+ echo "$filt failed\n";
+ }
+ }
- $im = imagecreatefrompng($SOURCE_IMG);
+ $im = imagecreatefrompng($SOURCE_IMG);
- if (imagefilter($im, IMG_FILTER_SMOOTH, -1924.124)) {
- imagepng($im, $SAVE_DIR . "/IMG_FILTER_SMOOTH.png");
- echo "IMG_FILTER_SMOOTH success\n";
- @unlink($SAVE_DIR . "/IMG_FILTER_SMOOTH.png");
- } else {
- echo "IMG_FILTER_SMOOTH failed\n";
- }
+ if (imagefilter($im, IMG_FILTER_SMOOTH, -1924.124)) {
+ imagepng($im, $SAVE_DIR . "/IMG_FILTER_SMOOTH.png");
+ echo "IMG_FILTER_SMOOTH success\n";
+ @unlink($SAVE_DIR . "/IMG_FILTER_SMOOTH.png");
+ } else {
+ echo "IMG_FILTER_SMOOTH failed\n";
+ }
- $im = imagecreatefrompng($SOURCE_IMG);
+ $im = imagecreatefrompng($SOURCE_IMG);
- if (imagefilter($im, IMG_FILTER_COLORIZE, -127.12, -127.98, 127)) {
- imagepng($im, $SAVE_DIR . "/IMG_FILTER_COLORIZE.png");
- echo "IMG_FILTER_COLORIZE success\n";
- unlink($SAVE_DIR . "/IMG_FILTER_COLORIZE.png");
- } else {
- echo "IMG_FILTER_COLORIZE failed\n";
- }
+ if (imagefilter($im, IMG_FILTER_COLORIZE, -127.12, -127.98, 127)) {
+ imagepng($im, $SAVE_DIR . "/IMG_FILTER_COLORIZE.png");
+ echo "IMG_FILTER_COLORIZE success\n";
+ unlink($SAVE_DIR . "/IMG_FILTER_COLORIZE.png");
+ } else {
+ echo "IMG_FILTER_COLORIZE failed\n";
+ }
- $im = imagecreatefrompng($SOURCE_IMG);
+ $im = imagecreatefrompng($SOURCE_IMG);
- if (imagefilter($im, IMG_FILTER_CONTRAST, -90)) {
- imagepng($im, $SAVE_DIR . "/IMG_FILTER_CONTRAST.png");
- echo "IMG_FILTER_CONTRAST success\n";
- unlink($SAVE_DIR . "/IMG_FILTER_CONTRAST.png");
- } else {
- echo "IMG_FILTER_CONTRAST failed\n";
- }
+ if (imagefilter($im, IMG_FILTER_CONTRAST, -90)) {
+ imagepng($im, $SAVE_DIR . "/IMG_FILTER_CONTRAST.png");
+ echo "IMG_FILTER_CONTRAST success\n";
+ unlink($SAVE_DIR . "/IMG_FILTER_CONTRAST.png");
+ } else {
+ echo "IMG_FILTER_CONTRAST failed\n";
+ }
- $im = imagecreatefrompng($SOURCE_IMG);
+ $im = imagecreatefrompng($SOURCE_IMG);
- if (imagefilter($im, IMG_FILTER_BRIGHTNESS, 98)) {
- imagepng($im, $SAVE_DIR . "/IMG_FILTER_BRIGHTNESS.png");
- echo "IMG_FILTER_BRIGHTNESS success\n";
- unlink($SAVE_DIR . "/IMG_FILTER_BRIGHTNESS.png");
- } else {
- echo "IMG_FILTER_BRIGHTNESS failed\n";
- }
+ if (imagefilter($im, IMG_FILTER_BRIGHTNESS, 98)) {
+ imagepng($im, $SAVE_DIR . "/IMG_FILTER_BRIGHTNESS.png");
+ echo "IMG_FILTER_BRIGHTNESS success\n";
+ unlink($SAVE_DIR . "/IMG_FILTER_BRIGHTNESS.png");
+ } else {
+ echo "IMG_FILTER_BRIGHTNESS failed\n";
+ }
- $im = imagecreatefrompng($SOURCE_IMG);
+ $im = imagecreatefrompng($SOURCE_IMG);
- if (imagefilter($im, IMG_FILTER_PIXELATE, 5, true)) {
- imagepng($im, $SAVE_DIR . "/IMG_FILTER_PIXELATE.png");
- echo "IMG_FILTER_PIXELATE success\n";
- unlink($SAVE_DIR . "/IMG_FILTER_PIXELATE.png");
- } else {
- echo "IMG_FILTER_PIXELATE failed\n";
- }
+ if (imagefilter($im, IMG_FILTER_PIXELATE, 5, true)) {
+ imagepng($im, $SAVE_DIR . "/IMG_FILTER_PIXELATE.png");
+ echo "IMG_FILTER_PIXELATE success\n";
+ unlink($SAVE_DIR . "/IMG_FILTER_PIXELATE.png");
+ } else {
+ echo "IMG_FILTER_PIXELATE failed\n";
+ }
- $im = imagecreatefrompng($SOURCE_IMG);
+ $im = imagecreatefrompng($SOURCE_IMG);
- if (imagefilter($im, IMG_FILTER_SCATTER, 3, 5)) {
- imagepng($im, $SAVE_DIR . "/IMG_FILTER_SCATTER.png");
- echo "IMG_FILTER_SCATTER success\n";
- unlink($SAVE_DIR . "/IMG_FILTER_SCATTER.png");
- } else {
- echo "IMG_FILTER_SCATTER failed\n";
- }
+ if (imagefilter($im, IMG_FILTER_SCATTER, 3, 5)) {
+ imagepng($im, $SAVE_DIR . "/IMG_FILTER_SCATTER.png");
+ echo "IMG_FILTER_SCATTER success\n";
+ unlink($SAVE_DIR . "/IMG_FILTER_SCATTER.png");
+ } else {
+ echo "IMG_FILTER_SCATTER failed\n";
+ }
?>
--EXPECT--
IMG_FILTER_NEGATE success
diff --git a/ext/gd/tests/imagefilter_error1.phpt b/ext/gd/tests/imagefilter_error1.phpt
index 41637994b4..407944d899 100644
--- a/ext/gd/tests/imagefilter_error1.phpt
+++ b/ext/gd/tests/imagefilter_error1.phpt
@@ -11,8 +11,11 @@ if (!extension_loaded("gd")) die("skip GD not present");
<?php
$image = imagecreatetruecolor(180, 30);
-var_dump(imagefilter($image));
+try {
+ var_dump(imagefilter($image));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Warning: Wrong parameter count for imagefilter() in %s on line %d
-NULL
+--EXPECT--
+Wrong parameter count for imagefilter()
diff --git a/ext/gd/tests/imagefilter_error10.phpt b/ext/gd/tests/imagefilter_error10.phpt
deleted file mode 100644
index 0cea9aa3c1..0000000000
--- a/ext/gd/tests/imagefilter_error10.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-Testing wrong parameter resource of EMBOSS in imagefilter() of GD library
---CREDITS--
-Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-$image = tmpfile();
-
-var_dump(imagefilter($image, IMG_FILTER_EMBOSS));
-?>
---EXPECTF--
-Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
-bool(false)
diff --git a/ext/gd/tests/imagefilter_error11.phpt b/ext/gd/tests/imagefilter_error11.phpt
deleted file mode 100644
index 2f162045b8..0000000000
--- a/ext/gd/tests/imagefilter_error11.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-Testing wrong parameter resource passing of EDGEDETECT in imagefilter() of GD library
---CREDITS--
-Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-$image = tmpfile();
-
-var_dump(imagefilter($image, IMG_FILTER_EDGEDETECT));
-?>
---EXPECTF--
-Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
-bool(false)
diff --git a/ext/gd/tests/imagefilter_error12.phpt b/ext/gd/tests/imagefilter_error12.phpt
deleted file mode 100644
index 29664518a0..0000000000
--- a/ext/gd/tests/imagefilter_error12.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-Testing wrong parameter resource of COLORIZE in imagefilter() of GD library
---CREDITS--
-Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-$image = tmpfile();
-
-var_dump(imagefilter($image, IMG_FILTER_COLORIZE, 255, 255, 255));
-?>
---EXPECTF--
-Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
-bool(false)
diff --git a/ext/gd/tests/imagefilter_error15.phpt b/ext/gd/tests/imagefilter_error15.phpt
deleted file mode 100644
index 9c76bf24ab..0000000000
--- a/ext/gd/tests/imagefilter_error15.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-Testing wrong parameter resource of CONTRAST in imagefilter() of GD library
---CREDITS--
-Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-$image = tmpfile();
-
-var_dump(imagefilter($image, IMG_FILTER_CONTRAST, 2));
-?>
---EXPECTF--
-Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
-bool(false)
diff --git a/ext/gd/tests/imagefilter_error17.phpt b/ext/gd/tests/imagefilter_error17.phpt
deleted file mode 100644
index 9a3ba39439..0000000000
--- a/ext/gd/tests/imagefilter_error17.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-Testing wrong parameter resource of GRAYSCALE in imagefilter() of GD library
---CREDITS--
-Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-$image = tmpfile();
-
-var_dump(imagefilter($image, IMG_FILTER_GRAYSCALE));
-?>
---EXPECTF--
-Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
-bool(false)
diff --git a/ext/gd/tests/imagefilter_error18.phpt b/ext/gd/tests/imagefilter_error18.phpt
deleted file mode 100644
index d96d02426f..0000000000
--- a/ext/gd/tests/imagefilter_error18.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-Testing wrong parameter resource of NEGATE in imagefilter() of GD library
---CREDITS--
-Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-$image = tmpfile();
-
-var_dump(imagefilter($image, IMG_FILTER_NEGATE));
-?>
---EXPECTF--
-Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
-bool(false)
diff --git a/ext/gd/tests/imagefilter_error20.phpt b/ext/gd/tests/imagefilter_error20.phpt
deleted file mode 100644
index f1a330dbed..0000000000
--- a/ext/gd/tests/imagefilter_error20.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-Testing wrong parameter resource of BRIGHTNESS in imagefilter() of GD library
---CREDITS--
-Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-$image = tmpfile();
-
-var_dump(imagefilter($image, IMG_FILTER_BRIGHTNESS, 1));
-?>
---EXPECTF--
-Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
-bool(false)
diff --git a/ext/gd/tests/imagefilter_error4.phpt b/ext/gd/tests/imagefilter_error4.phpt
deleted file mode 100644
index f60ce11b42..0000000000
--- a/ext/gd/tests/imagefilter_error4.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-Testing wrong parameter resource of PIXELATE in imagefilter() of GD library
---CREDITS--
-Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-$image = tmpfile();
-
-var_dump(imagefilter($image, IMG_FILTER_PIXELATE, 3));
-?>
---EXPECTF--
-Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
-bool(false)
diff --git a/ext/gd/tests/imagefilter_error6.phpt b/ext/gd/tests/imagefilter_error6.phpt
deleted file mode 100644
index 1ace03cba3..0000000000
--- a/ext/gd/tests/imagefilter_error6.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-Testing wrong parameter resource of SMOOTH in imagefilter() of GD library
---CREDITS--
-Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-$image = tmpfile();
-
-var_dump(imagefilter($image, IMG_FILTER_SMOOTH, 3.0));
-?>
---EXPECTF--
-Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
-bool(false)
diff --git a/ext/gd/tests/imagefilter_error7.phpt b/ext/gd/tests/imagefilter_error7.phpt
deleted file mode 100644
index 4e095801e8..0000000000
--- a/ext/gd/tests/imagefilter_error7.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-Testing wrong parameter resource of MEAN_REMOVAL in imagefilter() of GD library
---CREDITS--
-Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-$image = tmpfile();
-
-var_dump(imagefilter($image, IMG_FILTER_MEAN_REMOVAL));
-?>
---EXPECTF--
-Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
-bool(false)
diff --git a/ext/gd/tests/imagefilter_error8.phpt b/ext/gd/tests/imagefilter_error8.phpt
deleted file mode 100644
index 5086e6421d..0000000000
--- a/ext/gd/tests/imagefilter_error8.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-Testing wrong parameter resource of SELECTIVE_BLUR in imagefilter() of GD library
---CREDITS--
-Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-$image = tmpfile();
-
-var_dump(imagefilter($image, IMG_FILTER_SELECTIVE_BLUR));
-?>
---EXPECTF--
-Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
-bool(false)
diff --git a/ext/gd/tests/imagefilter_error9.phpt b/ext/gd/tests/imagefilter_error9.phpt
deleted file mode 100644
index 268a65f0f7..0000000000
--- a/ext/gd/tests/imagefilter_error9.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-Testing wrong parameter resource of GAUSSIAN_BLUR in imagefilter() of GD library
---CREDITS--
-Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-$image = tmpfile();
-
-var_dump(imagefilter($image, IMG_FILTER_GAUSSIAN_BLUR));
-?>
---EXPECTF--
-Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d
-bool(false)
diff --git a/ext/gd/tests/imagefttext.phpt b/ext/gd/tests/imagefttext.phpt
index 85bca4d545..d140af858e 100644
--- a/ext/gd/tests/imagefttext.phpt
+++ b/ext/gd/tests/imagefttext.phpt
@@ -11,41 +11,41 @@ imagefttext() function test
?>
--FILE--
<?php
- $cwd = __DIR__;
- $fontfile_8859 = "$cwd/test8859.ttf";
+ $cwd = __DIR__;
+ $fontfile_8859 = "$cwd/test8859.ttf";
- function testrun($im, $fontfile) {
- $sx = imagesx($im);
- $sy = imagesy($im);
+ function testrun($im, $fontfile) {
+ $sx = imagesx($im);
+ $sy = imagesy($im);
- $colour_w = imagecolorallocate($im, 255, 255, 255);
- $colour_b = imagecolorallocate($im, 0, 0, 0);
+ $colour_w = imagecolorallocate($im, 255, 255, 255);
+ $colour_b = imagecolorallocate($im, 0, 0, 0);
- imagefilledrectangle($im, 0, 0, $sx - 1, $sy - 1, $colour_b);
- imagefttext($im, $sy * 0.75, 0, 0, $sy - 1, $colour_w, $fontfile, "A", array());
+ imagefilledrectangle($im, 0, 0, $sx - 1, $sy - 1, $colour_b);
+ imagefttext($im, $sy * 0.75, 0, 0, $sy - 1, $colour_w, $fontfile, "A", array());
- $cnt = 0;
- for ($y = 0; $y < $sy; ++$y) {
- for ($x = 0; $x < $sx; ++$x) {
- if (imagecolorat($im, $x, $y) == $colour_b) {
- ++$cnt;
- }
- }
- }
+ $cnt = 0;
+ for ($y = 0; $y < $sy; ++$y) {
+ for ($x = 0; $x < $sx; ++$x) {
+ if (imagecolorat($im, $x, $y) == $colour_b) {
+ ++$cnt;
+ }
+ }
+ }
- // imagecolordeallocate($im, $colour_w);
- // imagecolordeallocate($im, $colour_b);
+ // imagecolordeallocate($im, $colour_w);
+ // imagecolordeallocate($im, $colour_b);
- return ($cnt < ($sx * $sy));
- }
+ return ($cnt < ($sx * $sy));
+ }
- $im = imagecreate(256, 256);
- var_dump(testrun($im, $fontfile_8859));
- imagedestroy($im);
+ $im = imagecreate(256, 256);
+ var_dump(testrun($im, $fontfile_8859));
+ imagedestroy($im);
- $im = imagecreatetruecolor(256, 256);
- var_dump(testrun($im, $fontfile_8859));
- imagedestroy($im);
+ $im = imagecreatetruecolor(256, 256);
+ var_dump(testrun($im, $fontfile_8859));
+ imagedestroy($im);
?>
--EXPECT--
bool(true)
diff --git a/ext/gd/tests/imagegammacorrect_error2.phpt b/ext/gd/tests/imagegammacorrect_error2.phpt
deleted file mode 100644
index fd6d136ae8..0000000000
--- a/ext/gd/tests/imagegammacorrect_error2.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-Testing error with non-Image resource paramenter of imagegammacorrect() of GD library,
---CREDITS--
-Rafael Dohms <rdohms [at] gmail [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
- if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-$image = tmpfile();
-$gamma = imagegammacorrect($image, 1, 5);
-
-?>
---EXPECTF--
-Warning: imagegammacorrect(): supplied resource is not a valid Image resource in %s on line %d
diff --git a/ext/gd/tests/imagegammacorrect_variation2.phpt b/ext/gd/tests/imagegammacorrect_variation2.phpt
index 6a66147ce9..908be81d42 100644
--- a/ext/gd/tests/imagegammacorrect_variation2.phpt
+++ b/ext/gd/tests/imagegammacorrect_variation2.phpt
@@ -61,7 +61,6 @@ function cell_color($im, $x, $y)
}
}
?>
-===DONE===
--EXPECT--
palette gamma (1, 2): The images are equal.
truecolor gamma (1, 2): The images are equal.
@@ -69,4 +68,3 @@ palette gamma (1, 1): The images are equal.
truecolor gamma (1, 1): The images are equal.
palette gamma (2, 1): The images are equal.
truecolor gamma (2, 1): The images are equal.
-===DONE===
diff --git a/ext/gd/tests/imagegd2_nullbyte_injection.phpt b/ext/gd/tests/imagegd2_nullbyte_injection.phpt
index 2fc3050421..30394cc1a5 100644
--- a/ext/gd/tests/imagegd2_nullbyte_injection.phpt
+++ b/ext/gd/tests/imagegd2_nullbyte_injection.phpt
@@ -7,8 +7,11 @@ Testing null byte injection in imagegd2
--FILE--
<?php
$image = imagecreate(1,1);// 1px image
-var_dump(imagegd2($image, "./foo\0bar"));
+try {
+ imagegd($image, "./foo\0bar");
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Warning: imagegd2() expects parameter 2 to be a valid path, string given in %s on line %d
-NULL
+--EXPECT--
+imagegd() expects parameter 2 to be a valid path, string given
diff --git a/ext/gd/tests/imagegd_nullbyte_injection.phpt b/ext/gd/tests/imagegd_nullbyte_injection.phpt
index f5479a0050..f53d9b5dac 100644
--- a/ext/gd/tests/imagegd_nullbyte_injection.phpt
+++ b/ext/gd/tests/imagegd_nullbyte_injection.phpt
@@ -7,8 +7,11 @@ Testing null byte injection in imagegd
--FILE--
<?php
$image = imagecreate(1,1);// 1px image
-var_dump(imagegd($image, "./foo\0bar"));
+try {
+ imagegd($image, "./foo\0bar");
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Warning: imagegd() expects parameter 2 to be a valid path, string given in %s on line %d
-NULL
+--EXPECT--
+imagegd() expects parameter 2 to be a valid path, string given
diff --git a/ext/gd/tests/imagegd_truecolor.phpt b/ext/gd/tests/imagegd_truecolor.phpt
index 6787ad3029..5c03f6994b 100644
--- a/ext/gd/tests/imagegd_truecolor.phpt
+++ b/ext/gd/tests/imagegd_truecolor.phpt
@@ -25,10 +25,8 @@ printf("size: %d\n", strlen($buffer));
test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'imagegd_truecolor.png', $im);
?>
-===DONE===
--EXPECT--
signature: 65534
truecolor: 1
size: 411
The images are equal.
-===DONE===
diff --git a/ext/gd/tests/imagegif_nullbyte_injection.phpt b/ext/gd/tests/imagegif_nullbyte_injection.phpt
index c5acdd489e..4518ecad27 100644
--- a/ext/gd/tests/imagegif_nullbyte_injection.phpt
+++ b/ext/gd/tests/imagegif_nullbyte_injection.phpt
@@ -4,15 +4,14 @@ Testing null byte injection in imagegif
<?php
if(!extension_loaded('gd')){ die('skip gd extension not available'); }
?>
---CLEAN--
-$tempdir = sprintf("%s/%s", sys_get_temp_dir(), preg_replace("~\.php$~", null, __FILE__));
-foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
-rmdir($tempdir);
--FILE--
<?php
$image = imagecreate(1,1);// 1px image
-var_dump(imagegif($image, "./foo\0bar"));
+try {
+ imagegif($image, "./foo\0bar");
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Warning: imagegif(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
-bool(false)
+--EXPECT--
+Invalid 2nd parameter, filename must not contain null bytes
diff --git a/ext/gd/tests/imageinterlace_error2.phpt b/ext/gd/tests/imageinterlace_error2.phpt
deleted file mode 100644
index e20f3ae901..0000000000
--- a/ext/gd/tests/imageinterlace_error2.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-Testing resource that is not a image to imageinterlace() of GD library
---CREDITS--
-Edgar Ferreira da Silva <contato [at] edgarfs [dot] com [dot] br>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-$image = fopen('php://stdin', 'r');
-var_dump(imageinterlace($image));
-?>
---EXPECTF--
-Warning: imageinterlace(): supplied resource is not a valid Image resource in %s on line %d
-bool(false)
diff --git a/ext/gd/tests/imageinterpolation_basic.phpt b/ext/gd/tests/imageinterpolation_basic.phpt
new file mode 100644
index 0000000000..4f01f9b0f2
--- /dev/null
+++ b/ext/gd/tests/imageinterpolation_basic.phpt
@@ -0,0 +1,59 @@
+--TEST--
+imagegetinterpolation() and imagesetinterpolation() basic test
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) die('skip gd extension not available');
+?>
+--FILE--
+<?php
+$methods = array(
+ IMG_BELL,
+ IMG_BESSEL,
+ IMG_BILINEAR_FIXED,
+ IMG_BICUBIC,
+ IMG_BICUBIC_FIXED,
+ IMG_BLACKMAN,
+ IMG_BOX,
+ IMG_BSPLINE,
+ IMG_CATMULLROM,
+ IMG_GAUSSIAN,
+ IMG_GENERALIZED_CUBIC,
+ IMG_HERMITE,
+ IMG_HAMMING,
+ IMG_HANNING,
+ IMG_MITCHELL,
+ IMG_NEAREST_NEIGHBOUR,
+ IMG_POWER,
+ IMG_QUADRATIC,
+ IMG_SINC,
+ IMG_TRIANGLE,
+ IMG_WEIGHTED4,
+);
+$im = imagecreate(8, 8);
+foreach ($methods as $method) {
+ imagesetinterpolation($im, $method);
+ var_dump(imagegetinterpolation($im) === $method);
+}
+?>
+--EXPECT--
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
diff --git a/ext/gd/tests/imageistruecolor_error1.phpt b/ext/gd/tests/imageistruecolor_error1.phpt
deleted file mode 100644
index ab0a9fe653..0000000000
--- a/ext/gd/tests/imageistruecolor_error1.phpt
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-Testing imageistruecolor(): wrong parameters
---CREDITS--
-Rafael Dohms <rdohms [at] gmail [dot] com>
---SKIPIF--
-<?php
- if (!extension_loaded("gd")) die("skip GD not present");
- if (!function_exists("imagecreatetruecolor")) die("skip GD Version not compatible");
-?>
---FILE--
-<?php
-$image = imagecreatetruecolor(180, 30);
-$resource = tmpfile();
-
-imageistruecolor('string');
-imageistruecolor($resource);
-imageistruecolor(array());
-?>
---EXPECTF--
-Warning: imageistruecolor() expects parameter 1 to be resource, string given in %s on line %d
-
-Warning: imageistruecolor(): supplied resource is not a valid Image resource in %s on line %d
-
-Warning: imageistruecolor() expects parameter 1 to be resource, array given in %s on line %d
diff --git a/ext/gd/tests/imagejpeg_nullbyte_injection.phpt b/ext/gd/tests/imagejpeg_nullbyte_injection.phpt
index 29cb537c3a..1a7f6da03c 100644
--- a/ext/gd/tests/imagejpeg_nullbyte_injection.phpt
+++ b/ext/gd/tests/imagejpeg_nullbyte_injection.phpt
@@ -8,15 +8,14 @@ if (!isset($support['JPEG Support']) || $support['JPEG Support'] === false) {
print 'skip jpeg support not available';
}
?>
---CLEAN--
-$tempdir = sprintf("%s/%s", sys_get_temp_dir(), preg_replace("~\.php$~", null, __FILE__));
-foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
-rmdir($tempdir);
--FILE--
<?php
$image = imagecreate(1,1);// 1px image
-var_dump(imagejpeg($image, "./foo\0bar"));
+try {
+ imagejpeg($image, "./foo\0bar");
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Warning: imagejpeg(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
-bool(false)
+--EXPECT--
+Invalid 2nd parameter, filename must not contain null bytes
diff --git a/ext/gd/tests/imagelayereffect_error3.phpt b/ext/gd/tests/imagelayereffect_error3.phpt
deleted file mode 100644
index 63d1e0e951..0000000000
--- a/ext/gd/tests/imagelayereffect_error3.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-Testing imagelayereffect() with invalid resource of GD library
---CREDITS--
-Rafael Dohms <rdohms [at] gmail [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
- if (!extension_loaded("gd")) die("skip GD not present");
- if (!GD_BUNDLED) die('skip function only available in bundled, external GD detected');
-?>
---FILE--
-<?php
-$resource = tmpfile();
-$layer = imagelayereffect($resource, IMG_EFFECT_REPLACE);
-?>
---EXPECTF--
-Warning: imagelayereffect(): supplied resource is not a valid Image resource in %s on line %d
diff --git a/ext/gd/tests/imageloadfont_error2.phpt b/ext/gd/tests/imageloadfont_error2.phpt
index 262009f2cf..a4ad10839b 100644
--- a/ext/gd/tests/imageloadfont_error2.phpt
+++ b/ext/gd/tests/imageloadfont_error2.phpt
@@ -11,5 +11,5 @@ Austin Drouare <austin.drouare [at] gmail [dot] com> #testfest #tek11
var_dump( imageloadfont('\src\invalidfile.font') );
?>
--EXPECTF--
-Warning: imageloadfont(\src\invalidfile.font): failed to open stream: No such file or directory in %s on line %d
+Warning: imageloadfont(\src\invalidfile.font): Failed to open stream: No such file or directory in %s on line %d
bool(false)
diff --git a/ext/gd/tests/imageloadfont_invalid.phpt b/ext/gd/tests/imageloadfont_invalid.phpt
index ed9d9e3a30..0ef49da2a5 100644
--- a/ext/gd/tests/imageloadfont_invalid.phpt
+++ b/ext/gd/tests/imageloadfont_invalid.phpt
@@ -19,7 +19,7 @@ imagestring($image, $font, 0, 0, "Hello", $black);
unlink($filename);
?>
--EXPECTF--
-Warning: imageloadfont(): product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
+Warning: imageloadfont(): Product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
in %simageloadfont_invalid.php on line %d
Warning: imageloadfont(): Error reading font, invalid font header in %simageloadfont_invalid.php on line %d
diff --git a/ext/gd/tests/imageopenpolygon_basic.phpt b/ext/gd/tests/imageopenpolygon_basic.phpt
index 0109cf015e..d25dc99c16 100644
--- a/ext/gd/tests/imageopenpolygon_basic.phpt
+++ b/ext/gd/tests/imageopenpolygon_basic.phpt
@@ -16,14 +16,12 @@ $green = imagecolorallocate($im, 0, 128, 0);
$blue = imagecolorallocate($im, 0, 0, 255);
imagefilledrectangle($im, 0,0, 99,99, $white);
-imageopenpolygon($im, [10,10, 49,89, 89,10], 3, $black);
-imageopenpolygon($im, [10,89, 35,10, 60,89, 85,10], 4, $red);
-imageopenpolygon($im, [10,49, 30,89, 50,10, 70,89, 90,10], 5, $green);
-imageopenpolygon($im, [10,50, 25,10, 40,89, 55,10, 80,89, 90,50], 6, $blue);
+imageopenpolygon($im, [10,10, 49,89, 89,10], $black);
+imageopenpolygon($im, [10,89, 35,10, 60,89, 85,10], $red);
+imageopenpolygon($im, [10,49, 30,89, 50,10, 70,89, 90,10], $green);
+imageopenpolygon($im, [10,50, 25,10, 40,89, 55,10, 80,89, 90,50], $blue);
test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'imageopenpolygon.png', $im);
?>
-===DONE===
--EXPECT--
The images are equal.
-===DONE===
diff --git a/ext/gd/tests/imagepalettetotruecolor_basic.phpt b/ext/gd/tests/imagepalettetotruecolor_basic.phpt
index 63a2b51e77..4c4a261b92 100644
--- a/ext/gd/tests/imagepalettetotruecolor_basic.phpt
+++ b/ext/gd/tests/imagepalettetotruecolor_basic.phpt
@@ -1,5 +1,5 @@
--TEST--
-does the imagepalettetotruecollor function realy converts the image palette?
+does the imagepalettetotruecollor function really converts the image palette?
--CREDITS--
Carlos André Ferrari <caferrari [at] gmail [dot] com>
--SKIPIF--
@@ -9,7 +9,7 @@ Carlos André Ferrari <caferrari [at] gmail [dot] com>
--FILE--
<?php
$im = imagecreate(100, 100);
-var_dump(is_resource($im));
+var_dump($im instanceof GdImage);
var_dump(imageistruecolor($im));
var_dump(imagepalettetotruecolor($im));
var_dump(imageistruecolor($im));
diff --git a/ext/gd/tests/imagepalettetotruecolor_error3.phpt b/ext/gd/tests/imagepalettetotruecolor_error3.phpt
deleted file mode 100644
index 42a7e71773..0000000000
--- a/ext/gd/tests/imagepalettetotruecolor_error3.phpt
+++ /dev/null
@@ -1,15 +0,0 @@
---TEST--
-imagepalettetotruecollor must return an error if not an image resource is given
---CREDITS--
-Carlos André Ferrari <caferrari [at] gmail [dot] com>
---SKIPIF--
-<?php
- if (!extension_loaded('gd')) die("skip gd extension not available.");
-?>
---FILE--
-<?php
-$im = fopen('php://memory', 'w');
-imagepalettetotruecolor($im);
-?>
---EXPECTF--
-Warning: imagepalettetotruecolor(): supplied resource is not a valid Image resource in %s on line %d
diff --git a/ext/gd/tests/imagepng_nullbyte_injection.phpt b/ext/gd/tests/imagepng_nullbyte_injection.phpt
index 271d4d5bd3..86d614ab60 100644
--- a/ext/gd/tests/imagepng_nullbyte_injection.phpt
+++ b/ext/gd/tests/imagepng_nullbyte_injection.phpt
@@ -8,15 +8,14 @@ if (!isset($support['PNG Support']) || $support['PNG Support'] === false) {
print 'skip png support not available';
}
?>
---CLEAN--
-$tempdir = sprintf("%s/%s", sys_get_temp_dir(), preg_replace("~\.php$~", null, __FILE__));
-foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
-rmdir($tempdir);
--FILE--
<?php
$image = imagecreate(1,1);// 1px image
-var_dump(imagepng($image, "./foo\0bar"));
+try {
+ imagepng($image, "./foo\0bar");
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
--EXPECTF--
-Warning: imagepng(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
-bool(false)
+Invalid 2nd parameter, filename must not contain null bytes
diff --git a/ext/gd/tests/imagepolygon_aa.phpt b/ext/gd/tests/imagepolygon_aa.phpt
index 9725bdabe8..97d607d9c4 100644
--- a/ext/gd/tests/imagepolygon_aa.phpt
+++ b/ext/gd/tests/imagepolygon_aa.phpt
@@ -14,11 +14,9 @@ $black = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0,0, 99,99, $white);
imageantialias($im, true);
-imagepolygon($im, [10,10, 49,89, 89,49], 3, $black);
+imagepolygon($im, [10,10, 49,89, 89,49], $black);
test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'imagepolygon_aa.png', $im);
?>
-===DONE===
--EXPECT--
The images are equal.
-===DONE===
diff --git a/ext/gd/tests/imagepolygon_basic.phpt b/ext/gd/tests/imagepolygon_basic.phpt
index 5dfecfbf19..4880f3ebe7 100644
--- a/ext/gd/tests/imagepolygon_basic.phpt
+++ b/ext/gd/tests/imagepolygon_basic.phpt
@@ -33,7 +33,6 @@ imagepolygon($image, array (
100, 200,
300, 200
),
- 3,
$col_poly);
// output the picture to a file
diff --git a/ext/gd/tests/imagepolygon_negative.phpt b/ext/gd/tests/imagepolygon_negative.phpt
deleted file mode 100644
index d122a3bbaa..0000000000
--- a/ext/gd/tests/imagepolygon_negative.phpt
+++ /dev/null
@@ -1,15 +0,0 @@
---TEST--
-imagepolygon() with a negative num of points
---SKIPIF--
-<?php
- if (!function_exists('imagepolygon')) die('skip imagepolygon() not available');
-?>
---FILE--
-<?php
-$im = imagecreate(100, 100);
-$black = imagecolorallocate($im, 0, 0, 0);
-if (imagepolygon($im, array(0, 0, 0, 0, 0, 0), -1, $black)) echo "should be false";
-imagedestroy($im);
-?>
---EXPECTF--
-Warning: imagepolygon(): You must give a positive number of points in %s on line %d
diff --git a/ext/gd/tests/imagerectangle_error2.phpt b/ext/gd/tests/imagerectangle_error2.phpt
deleted file mode 100644
index 4e2e665bda..0000000000
--- a/ext/gd/tests/imagerectangle_error2.phpt
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-Testing wrong param passing imagerectangle() of GD library
---CREDITS--
-Ivan Rosolen <contato [at] ivanrosolen [dot] com>
-#testfest PHPSP on 2009-06-30
---SKIPIF--
-<?php
-if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' );
-?>
---FILE--
-<?php
-// Create a resource
-$image = tmpfile();
-
-// Draw a rectangle
-imagerectangle( $image, 0, 0, 50, 50, 2 );
-?>
---EXPECTF--
-Warning: imagerectangle(): supplied resource is not a valid Image resource in %s on line %d
diff --git a/ext/gd/tests/imageresolution_jpeg.phpt b/ext/gd/tests/imageresolution_jpeg.phpt
index a659e2682a..73b76c1f9d 100644
--- a/ext/gd/tests/imageresolution_jpeg.phpt
+++ b/ext/gd/tests/imageresolution_jpeg.phpt
@@ -22,7 +22,6 @@ imagejpeg($exp, $filename);
$act = imagecreatefromjpeg($filename);
var_dump(imageresolution($act));
?>
-===DONE===
--EXPECT--
array(2) {
[0]=>
@@ -36,7 +35,6 @@ array(2) {
[1]=>
int(299)
}
-===DONE===
--CLEAN--
<?php
@unlink(__DIR__ . DIRECTORY_SEPARATOR . 'imageresolution_jpeg.jpeg');
diff --git a/ext/gd/tests/imageresolution_png.phpt b/ext/gd/tests/imageresolution_png.phpt
index 5bb835b4e8..5ff3d8ae9e 100644
--- a/ext/gd/tests/imageresolution_png.phpt
+++ b/ext/gd/tests/imageresolution_png.phpt
@@ -21,7 +21,6 @@ imagepng($exp, $filename);
$act = imagecreatefrompng($filename);
var_dump(imageresolution($act));
?>
-===DONE===
--EXPECT--
array(2) {
[0]=>
@@ -35,7 +34,6 @@ array(2) {
[1]=>
int(299)
}
-===DONE===
--CLEAN--
<?php
@unlink(__DIR__ . DIRECTORY_SEPARATOR . 'imageresolution_png.png');
diff --git a/ext/gd/tests/imagesetthickness_error1.phpt b/ext/gd/tests/imagesetthickness_error1.phpt
deleted file mode 100644
index f54270afbc..0000000000
--- a/ext/gd/tests/imagesetthickness_error1.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-Testing imagetruecolortopalette(): wrong types for first parameter
---CREDITS--
-Rafael Dohms <rdohms [at] gmail [dot] com>
---SKIPIF--
-<?php
- if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-$resource = tmpfile();
-
-imagesetthickness('string', 5);
-imagesetthickness(array(), 5);
-imagesetthickness($resource, 5);
-?>
---EXPECTF--
-Warning: imagesetthickness() expects parameter 1 to be resource, %s given in %s on line %d
-
-Warning: imagesetthickness() expects parameter 1 to be resource, array given in %s on line %d
-
-Warning: imagesetthickness(): supplied resource is not a valid Image resource in %s on line %d
diff --git a/ext/gd/tests/imagestring_error2.phpt b/ext/gd/tests/imagestring_error2.phpt
deleted file mode 100644
index e4b22651c6..0000000000
--- a/ext/gd/tests/imagestring_error2.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-Testing error on non-image resource parameter 1 of imagestring() of GD library
---CREDITS--
-Rafael Dohms <rdohms [at] gmail [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
- if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-
-$result = imagestring(tmpfile(), 1, 5, 5, 'String', 1);
-
-?>
---EXPECTF--
-Warning: imagestring(): supplied resource is not a valid Image resource in %s on line %d
diff --git a/ext/gd/tests/imagestringup_error2.phpt b/ext/gd/tests/imagestringup_error2.phpt
deleted file mode 100644
index 871dd54fde..0000000000
--- a/ext/gd/tests/imagestringup_error2.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-Testing error on non-image resource parameter 1 of imagestringup() of GD library
---CREDITS--
-Rafael Dohms <rdohms [at] gmail [dot] com>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
- if (!extension_loaded("gd")) die("skip GD not present");
-?>
---FILE--
-<?php
-
-$result = imagestringup(tmpfile(), 1, 5, 5, 'String', 1);
-
-?>
---EXPECTF--
-Warning: imagestringup(): supplied resource is not a valid Image resource in %s on line %d
diff --git a/ext/gd/tests/imagetruecolortopalette_error1.phpt b/ext/gd/tests/imagetruecolortopalette_error1.phpt
deleted file mode 100644
index 3418449c01..0000000000
--- a/ext/gd/tests/imagetruecolortopalette_error1.phpt
+++ /dev/null
@@ -1,26 +0,0 @@
---TEST--
-Testing imagetruecolortopalette(): wrong parameters for parameter 1
---CREDITS--
-Rafael Dohms <rdohms [at] gmail [dot] com>
---SKIPIF--
-<?php
- if (!extension_loaded("gd")) die("skip GD not present");
- if (!function_exists("imagecreatetruecolor")) die("skip GD Version not compatible");
-?>
---FILE--
-<?php
-$resource = tmpfile();
-
-imagetruecolortopalette($resource, true, 2);
-imagetruecolortopalette('string', true, 2);
-imagetruecolortopalette(array(), true, 2);
-imagetruecolortopalette(null, true, 2);
-?>
---EXPECTF--
-Warning: imagetruecolortopalette(): supplied resource is not a valid Image resource in %s on line %d
-
-Warning: imagetruecolortopalette() expects parameter 1 to be resource, %s given in %s on line %d
-
-Warning: imagetruecolortopalette() expects parameter 1 to be resource, array given in %s on line %d
-
-Warning: imagetruecolortopalette() expects parameter 1 to be resource, null given in %s on line %d
diff --git a/ext/gd/tests/imagetruecolortopalette_error3.phpt b/ext/gd/tests/imagetruecolortopalette_error3.phpt
index d89bbcb31b..40dc306116 100644
--- a/ext/gd/tests/imagetruecolortopalette_error3.phpt
+++ b/ext/gd/tests/imagetruecolortopalette_error3.phpt
@@ -9,20 +9,14 @@ Rafael Dohms <rdohms [at] gmail [dot] com>
?>
--FILE--
<?php
+require __DIR__ . '/func.inc';
+
$image = imagecreatetruecolor(50, 50);
-$resource = tmpfile();
-imagetruecolortopalette($image, true, 'string');
-imagetruecolortopalette($image, true, $resource);
-imagetruecolortopalette($image, true, array());
-imagetruecolortopalette($image, true, null);
+trycatch_dump(
+ fn() => imagetruecolortopalette($image, true, null)
+);
?>
---EXPECTF--
-Warning: imagetruecolortopalette() expects parameter 3 to be int, string given in %s on line %d
-
-Warning: imagetruecolortopalette() expects parameter 3 to be int, resource given in %s on line %d
-
-Warning: imagetruecolortopalette() expects parameter 3 to be int, array given in %s on line %d
-
-Warning: imagetruecolortopalette(): Number of colors has to be greater than zero and no more than %d in %s on line %d
+--EXPECT--
+!! [ValueError] Number of colors has to be greater than zero and no more than 2147483647
diff --git a/ext/gd/tests/imagetruecolortopalette_error4.phpt b/ext/gd/tests/imagetruecolortopalette_error4.phpt
index 2db042e89f..055fc657b2 100644
--- a/ext/gd/tests/imagetruecolortopalette_error4.phpt
+++ b/ext/gd/tests/imagetruecolortopalette_error4.phpt
@@ -9,13 +9,16 @@ Rafael Dohms <rdohms [at] gmail [dot] com>
?>
--FILE--
<?php
+require __DIR__ . '/func.inc';
+
$image = imagecreatetruecolor(50, 50);
-imagetruecolortopalette($image, true, 0);
-imagetruecolortopalette($image, true, -1);
+trycatch_dump(
+ fn() => imagetruecolortopalette($image, true, 0),
+ fn() => imagetruecolortopalette($image, true, -1)
+);
?>
---EXPECTF--
-Warning: imagetruecolortopalette(): Number of colors has to be greater than zero and no more than %d in %s line %d
-
-Warning: imagetruecolortopalette(): Number of colors has to be greater than zero and no more than %d in %s line %d
+--EXPECT--
+!! [ValueError] Number of colors has to be greater than zero and no more than 2147483647
+!! [ValueError] Number of colors has to be greater than zero and no more than 2147483647
diff --git a/ext/gd/tests/imagewbmp-mb.phpt b/ext/gd/tests/imagewbmp-mb.phpt
index fefbb066c7..664f42c4e3 100644
--- a/ext/gd/tests/imagewbmp-mb.phpt
+++ b/ext/gd/tests/imagewbmp-mb.phpt
@@ -18,9 +18,9 @@ echo 'test create wbmp: ';
$c = imagecolorsforindex($im2, imagecolorat($im2, 3,3));
$failed = false;
foreach ($c as $v) {
- if ($v != 0) {
- $failed = true;
- }
+ if ($v != 0) {
+ $failed = true;
+ }
}
echo !$failed ? 'ok' : 'failed';
echo "\n";
diff --git a/ext/gd/tests/imagewbmp.phpt b/ext/gd/tests/imagewbmp.phpt
index 27491bb42e..ee5dd5c6e2 100644
--- a/ext/gd/tests/imagewbmp.phpt
+++ b/ext/gd/tests/imagewbmp.phpt
@@ -18,9 +18,9 @@ echo 'test create wbmp: ';
$c = imagecolorsforindex($im2, imagecolorat($im2, 3,3));
$failed = false;
foreach ($c as $v) {
- if ($v != 0) {
- $failed = true;
- }
+ if ($v != 0) {
+ $failed = true;
+ }
}
echo !$failed ? 'ok' : 'failed';
echo "\n";
diff --git a/ext/gd/tests/imagewbmp_nullbyte_injection.phpt b/ext/gd/tests/imagewbmp_nullbyte_injection.phpt
index fc5d238f41..cce38a63df 100644
--- a/ext/gd/tests/imagewbmp_nullbyte_injection.phpt
+++ b/ext/gd/tests/imagewbmp_nullbyte_injection.phpt
@@ -8,15 +8,14 @@ if (!isset($support['WBMP Support']) || $support['WBMP Support'] === false) {
print 'skip wbmp support not available';
}
?>
---CLEAN--
-$tempdir = sprintf("%s/%s", sys_get_temp_dir(), preg_replace("~\.php$~", null, __FILE__));
-foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
-rmdir($tempdir);
--FILE--
<?php
$image = imagecreate(1,1);// 1px image
-var_dump(imagewbmp($image, "./foo\0bar"));
+try {
+ imagewbmp($image, "./foo\0bar");
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Warning: imagewbmp(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
-bool(false)
+--EXPECT--
+Invalid 2nd parameter, filename must not contain null bytes
diff --git a/ext/gd/tests/imagewebp_nullbyte_injection.phpt b/ext/gd/tests/imagewebp_nullbyte_injection.phpt
index d778d0a379..82e45aca02 100644
--- a/ext/gd/tests/imagewebp_nullbyte_injection.phpt
+++ b/ext/gd/tests/imagewebp_nullbyte_injection.phpt
@@ -8,15 +8,14 @@ if (!isset($support['WebP Support']) || $support['WebP Support'] === false) {
print 'skip webp support not available';
}
?>
---CLEAN--
-$tempdir = sprintf("%s/%s", sys_get_temp_dir(), preg_replace("~\.php$~", null, __FILE__));
-foreach (glob($tempdir . "/test*") as $file ) { unlink($file); }
-rmdir($tempdir);
--FILE--
<?php
$image = imagecreate(1,1);// 1px image
-var_dump(imagewebp($image, "./foo\0bar"));
+try {
+ imagewebp($image, "./foo\0bar");
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Warning: imagewebp(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
-bool(false)
+--EXPECT--
+Invalid 2nd parameter, filename must not contain null bytes
diff --git a/ext/gd/tests/imagexbm_nullbyte_injection.phpt b/ext/gd/tests/imagexbm_nullbyte_injection.phpt
index b485315064..a24aa3c007 100644
--- a/ext/gd/tests/imagexbm_nullbyte_injection.phpt
+++ b/ext/gd/tests/imagexbm_nullbyte_injection.phpt
@@ -7,10 +7,11 @@ if(!extension_loaded('gd')) die('skip gd extension not available');
--FILE--
<?php
$image = imagecreate(1,1);// 1px image
-var_dump(imagexbm($image, "./foo\0bar"));
+try {
+ imagexbm($image, "./foo\0bar");
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
-===DONE===
--EXPECTF--
-Warning: imagexbm() expects parameter 2 to be a valid path, string given in %s on line %d
-NULL
-===DONE===
+imagexbm() expects parameter 2 to be a valid path, string given
diff --git a/ext/gd/tests/jpeg2png.phpt b/ext/gd/tests/jpeg2png.phpt
index 8d14b33e3a..dfcd1ef1a2 100644
--- a/ext/gd/tests/jpeg2png.phpt
+++ b/ext/gd/tests/jpeg2png.phpt
@@ -15,28 +15,28 @@ jpeg <--> png conversion test
?>
--FILE--
<?php
- $cwd = __DIR__;
+ $cwd = __DIR__;
- echo "PNG to JPEG conversion: ";
- echo imagejpeg(imagecreatefrompng($cwd . "/conv_test.png"), $cwd . "/test_jpeg.jpeg") ? 'ok' : 'failed';
- echo "\n";
+ echo "PNG to JPEG conversion: ";
+ echo imagejpeg(imagecreatefrompng($cwd . "/conv_test.png"), $cwd . "/test_jpeg.jpeg") ? 'ok' : 'failed';
+ echo "\n";
- echo "Generated JPEG to PNG conversion: ";
- echo imagepng(imagecreatefromjpeg($cwd . "/test_jpeg.jpeg"), $cwd . "/test_jpng.png") ? 'ok' : 'failed';
- echo "\n";
+ echo "Generated JPEG to PNG conversion: ";
+ echo imagepng(imagecreatefromjpeg($cwd . "/test_jpeg.jpeg"), $cwd . "/test_jpng.png") ? 'ok' : 'failed';
+ echo "\n";
- echo "JPEG to PNG conversion: ";
- echo imagepng(imagecreatefromjpeg($cwd . "/conv_test.jpg"), $cwd . "/test_png.png") ? 'ok' : 'failed';
- echo "\n";
+ echo "JPEG to PNG conversion: ";
+ echo imagepng(imagecreatefromjpeg($cwd . "/conv_test.jpg"), $cwd . "/test_png.png") ? 'ok' : 'failed';
+ echo "\n";
- echo "Generated PNG to JPEG conversion: ";
- echo imagejpeg(imagecreatefrompng($cwd . "/test_png.png"), $cwd . "/test_pjpeg.jpeg") ? 'ok' : 'failed';
- echo "\n";
+ echo "Generated PNG to JPEG conversion: ";
+ echo imagejpeg(imagecreatefrompng($cwd . "/test_png.png"), $cwd . "/test_pjpeg.jpeg") ? 'ok' : 'failed';
+ echo "\n";
- @unlink($cwd . "/test_jpeg.jpeg");
- @unlink($cwd . "/test_jpng.png");
- @unlink($cwd . "/test_png.png");
- @unlink($cwd . "/test_pjpeg.jpeg");
+ @unlink($cwd . "/test_jpeg.jpeg");
+ @unlink($cwd . "/test_jpng.png");
+ @unlink($cwd . "/test_png.png");
+ @unlink($cwd . "/test_pjpeg.jpeg");
?>
--EXPECT--
PNG to JPEG conversion: ok
diff --git a/ext/gd/tests/jpeg2wbmp_error1.phpt b/ext/gd/tests/jpeg2wbmp_error1.phpt
deleted file mode 100644
index e8e0a7cf2e..0000000000
--- a/ext/gd/tests/jpeg2wbmp_error1.phpt
+++ /dev/null
@@ -1,46 +0,0 @@
---TEST--
-Test jpeg2wbmp() function : wrong threshold value param
---CREDITS--
-Levi Fukumori <levi [at] fukumori [dot] com [dot] br>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if(!extension_loaded('gd')) {
- die('skip gd extension is not loaded');
-}
-if(!function_exists('jpeg2wbmp')) {
- die('skip jpeg2wbmp function is not available');
-}
-?>
---FILE--
-<?php
-// Create a blank image and add some text
-$im = imagecreatetruecolor(120, 20);
-$text_color = imagecolorallocate($im, 255, 255, 255);
-imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color);
-
-$file = __DIR__ .'/simpletext.jpg';
-$file2 = __DIR__ .'/simpletext.wbmp';
-
-// Save the image as 'simpletext.jpg'
-imagejpeg($im, $file);
-
-// Free up memory
-imagedestroy($im);
-
-jpeg2wbmp($file, $file2, 20, 120, 9);
-jpeg2wbmp($file, $file2, 20, 120, -1);
-?>
---EXPECTF--
-Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d
-
-Warning: jpeg2wbmp(): Invalid threshold value '9' in %s on line %d
-
-Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d
-
-Warning: jpeg2wbmp(): Invalid threshold value '-1' in %s on line %d
---CLEAN--
-<?php
-unlink(__DIR__ .'/simpletext.jpg');
-unlink(__DIR__ .'/simpletext.wbmp');
-?>
diff --git a/ext/gd/tests/jpeg2wbmp_error2-mb.phpt b/ext/gd/tests/jpeg2wbmp_error2-mb.phpt
deleted file mode 100644
index 6c4019a935..0000000000
--- a/ext/gd/tests/jpeg2wbmp_error2-mb.phpt
+++ /dev/null
@@ -1,37 +0,0 @@
---TEST--
-Test jpeg2wbmp() function : wrong origin filename param
---CREDITS--
-Levi Fukumori <levi [at] fukumori [dot] com [dot] br>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if(!extension_loaded('gd')) {
- die('skip gd extension is not loaded');
-}
-if(!function_exists('jpeg2wbmp')) {
- die('skip jpeg2wbmp function is not available');
-}
-?>
---FILE--
-<?php
-$file = __DIR__ .'/simpletextç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.wbmp';
-jpeg2wbmp('', $file, 20, 120, 8);
-jpeg2wbmp(null, $file, 20, 120, 8);
-jpeg2wbmp(false, $file, 20, 120, 8);
-?>
---EXPECTF--
-Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d
-
-Warning: jpeg2wbmp(): Unable to open '' for reading in %s on line %d
-
-Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d
-
-Warning: jpeg2wbmp(): Unable to open '' for reading in %s on line %d
-
-Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d
-
-Warning: jpeg2wbmp(): Unable to open '' for reading in %s on line %d
---CLEAN--
-<?php
-unlink(__DIR__ .'/simpletextç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.wbmp');
-?>
diff --git a/ext/gd/tests/jpeg2wbmp_error2.phpt b/ext/gd/tests/jpeg2wbmp_error2.phpt
deleted file mode 100644
index 7ddc151d78..0000000000
--- a/ext/gd/tests/jpeg2wbmp_error2.phpt
+++ /dev/null
@@ -1,37 +0,0 @@
---TEST--
-Test jpeg2wbmp() function : wrong origin filename param
---CREDITS--
-Levi Fukumori <levi [at] fukumori [dot] com [dot] br>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if(!extension_loaded('gd')) {
- die('skip gd extension is not loaded');
-}
-if(!function_exists('jpeg2wbmp')) {
- die('skip jpeg2wbmp function is not available');
-}
-?>
---FILE--
-<?php
-$file = __DIR__ .'/simpletext.wbmp';
-jpeg2wbmp('', $file, 20, 120, 8);
-jpeg2wbmp(null, $file, 20, 120, 8);
-jpeg2wbmp(false, $file, 20, 120, 8);
-?>
---EXPECTF--
-Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d
-
-Warning: jpeg2wbmp(): Unable to open '' for reading in %s on line %d
-
-Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d
-
-Warning: jpeg2wbmp(): Unable to open '' for reading in %s on line %d
-
-Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d
-
-Warning: jpeg2wbmp(): Unable to open '' for reading in %s on line %d
---CLEAN--
-<?php
-unlink(__DIR__ .'/simpletext.wbmp');
-?>
diff --git a/ext/gd/tests/jpeg2wbmp_error3.phpt b/ext/gd/tests/jpeg2wbmp_error3.phpt
deleted file mode 100644
index 1d4c82b06e..0000000000
--- a/ext/gd/tests/jpeg2wbmp_error3.phpt
+++ /dev/null
@@ -1,49 +0,0 @@
---TEST--
-Test jpeg2wbmp() function : wrong destination filename param
---CREDITS--
-Levi Fukumori <levi [at] fukumori [dot] com [dot] br>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if(!extension_loaded('gd')) {
- die('skip gd extension is not loaded');
-}
-if(!function_exists('jpeg2wbmp')) {
- die('skip jpeg2wbmp function is not available');
-}
-?>
---FILE--
-<?php
-// Create a blank image and add some text
-$im = imagecreatetruecolor(120, 20);
-$text_color = imagecolorallocate($im, 255, 255, 255);
-imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color);
-
-$file = __DIR__ .'/simpletext.jpg';
-
-// Save the image as 'simpletext.jpg'
-imagejpeg($im, $file);
-
-// Free up memory
-imagedestroy($im);
-
-jpeg2wbmp($file, '', 20, 120, 8);
-jpeg2wbmp($file, null, 20, 120, 8);
-jpeg2wbmp($file, false, 20, 120, 8);
-?>
---EXPECTF--
-Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d
-
-Warning: jpeg2wbmp(): Unable to open '' for writing in %s on line %d
-
-Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d
-
-Warning: jpeg2wbmp(): Unable to open '' for writing in %s on line %d
-
-Deprecated: Function jpeg2wbmp() is deprecated in %s on line %d
-
-Warning: jpeg2wbmp(): Unable to open '' for writing in %s on line %d
---CLEAN--
-<?php
-unlink(__DIR__ .'/simpletext.jpg');
-?>
diff --git a/ext/gd/tests/jpg2gd-mb.phpt b/ext/gd/tests/jpg2gd-mb.phpt
index b7c0b98ab4..8cf4ffd283 100644
--- a/ext/gd/tests/jpg2gd-mb.phpt
+++ b/ext/gd/tests/jpg2gd-mb.phpt
@@ -12,28 +12,28 @@ jpeg <--> gd1/gd2 conversion test
?>
--FILE--
<?php
- $cwd = __DIR__;
+ $cwd = __DIR__;
- echo "JPEG to GD1 conversion: ";
- echo imagegd(imagecreatefromjpeg($cwd . "/conv_testç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.jpg"), $cwd . "/testç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.gd1") ? 'ok' : 'failed';
- echo "\n";
+ echo "JPEG to GD1 conversion: ";
+ echo imagegd(imagecreatefromjpeg($cwd . "/conv_testç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.jpg"), $cwd . "/testç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.gd1") ? 'ok' : 'failed';
+ echo "\n";
- echo "JPEG to GD2 conversion: ";
- echo imagegd2(imagecreatefromjpeg($cwd . "/conv_testç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.jpg"), $cwd . "/testç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.gd2") ? 'ok' : 'failed';
- echo "\n";
+ echo "JPEG to GD2 conversion: ";
+ echo imagegd2(imagecreatefromjpeg($cwd . "/conv_testç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.jpg"), $cwd . "/testç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.gd2") ? 'ok' : 'failed';
+ echo "\n";
- echo "GD1 to JPEG conversion: ";
- echo imagejpeg(imagecreatefromgd($cwd . "/testç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.gd1"), $cwd . "/test_gd1.jpeg") ? 'ok' : 'failed';
- echo "\n";
+ echo "GD1 to JPEG conversion: ";
+ echo imagejpeg(imagecreatefromgd($cwd . "/testç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.gd1"), $cwd . "/test_gd1.jpeg") ? 'ok' : 'failed';
+ echo "\n";
- echo "GD2 to JPEG conversion: ";
- echo imagejpeg(imagecreatefromgd2($cwd . "/testç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.gd2"), $cwd . "/test_gd2.jpeg") ? 'ok' : 'failed';
- echo "\n";
+ echo "GD2 to JPEG conversion: ";
+ echo imagejpeg(imagecreatefromgd2($cwd . "/testç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.gd2"), $cwd . "/test_gd2.jpeg") ? 'ok' : 'failed';
+ echo "\n";
- @unlink($cwd . "/testç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.gd1");
- @unlink($cwd . "/testç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.gd2");
- @unlink($cwd . "/test_gd1.jpeg");
- @unlink($cwd . "/test_gd2.jpeg");
+ @unlink($cwd . "/testç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.gd1");
+ @unlink($cwd . "/testç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.gd2");
+ @unlink($cwd . "/test_gd1.jpeg");
+ @unlink($cwd . "/test_gd2.jpeg");
?>
--EXPECT--
JPEG to GD1 conversion: ok
diff --git a/ext/gd/tests/jpg2gd.phpt b/ext/gd/tests/jpg2gd.phpt
index 6ec714ef27..da671e01ac 100644
--- a/ext/gd/tests/jpg2gd.phpt
+++ b/ext/gd/tests/jpg2gd.phpt
@@ -12,28 +12,28 @@ jpeg <--> gd1/gd2 conversion test
?>
--FILE--
<?php
- $cwd = __DIR__;
+ $cwd = __DIR__;
- echo "JPEG to GD1 conversion: ";
- echo imagegd(imagecreatefromjpeg($cwd . "/conv_test.jpg"), $cwd . "/test_jpeg.gd1") ? 'ok' : 'failed';
- echo "\n";
+ echo "JPEG to GD1 conversion: ";
+ echo imagegd(imagecreatefromjpeg($cwd . "/conv_test.jpg"), $cwd . "/test_jpeg.gd1") ? 'ok' : 'failed';
+ echo "\n";
- echo "JPEG to GD2 conversion: ";
- echo imagegd2(imagecreatefromjpeg($cwd . "/conv_test.jpg"), $cwd . "/test_jpeg.gd2") ? 'ok' : 'failed';
- echo "\n";
+ echo "JPEG to GD2 conversion: ";
+ echo imagegd2(imagecreatefromjpeg($cwd . "/conv_test.jpg"), $cwd . "/test_jpeg.gd2") ? 'ok' : 'failed';
+ echo "\n";
- echo "GD1 to JPEG conversion: ";
- echo imagejpeg(imagecreatefromgd($cwd . "/test_jpeg.gd1"), $cwd . "/test_gd1.jpeg") ? 'ok' : 'failed';
- echo "\n";
+ echo "GD1 to JPEG conversion: ";
+ echo imagejpeg(imagecreatefromgd($cwd . "/test_jpeg.gd1"), $cwd . "/test_gd1.jpeg") ? 'ok' : 'failed';
+ echo "\n";
- echo "GD2 to JPEG conversion: ";
- echo imagejpeg(imagecreatefromgd2($cwd . "/test_jpeg.gd2"), $cwd . "/test_gd2.jpeg") ? 'ok' : 'failed';
- echo "\n";
+ echo "GD2 to JPEG conversion: ";
+ echo imagejpeg(imagecreatefromgd2($cwd . "/test_jpeg.gd2"), $cwd . "/test_gd2.jpeg") ? 'ok' : 'failed';
+ echo "\n";
- @unlink($cwd . "/test_jpeg.gd1");
- @unlink($cwd . "/test_jpeg.gd2");
- @unlink($cwd . "/test_gd1.jpeg");
- @unlink($cwd . "/test_gd2.jpeg");
+ @unlink($cwd . "/test_jpeg.gd1");
+ @unlink($cwd . "/test_jpeg.gd2");
+ @unlink($cwd . "/test_gd1.jpeg");
+ @unlink($cwd . "/test_gd2.jpeg");
?>
--EXPECT--
JPEG to GD1 conversion: ok
diff --git a/ext/gd/tests/libgd00100.phpt b/ext/gd/tests/libgd00100.phpt
index a0ad74a5f5..c6fa6dd30e 100644
--- a/ext/gd/tests/libgd00100.phpt
+++ b/ext/gd/tests/libgd00100.phpt
@@ -33,7 +33,7 @@ $points = array(
$x+$d, ($top+$bot)/2,
$x, $bot
);
-imagefilledpolygon($im, $points, 5, $yellow);
+imagefilledpolygon($im, $points, $yellow);
// left-facing M not on baseline
$top = 40;
@@ -47,7 +47,7 @@ $points = array(
$left, $bot,
($left+$right)/2, ($top+$bot)/2
);
-imagefilledpolygon($im, $points, 5, $purple);
+imagefilledpolygon($im, $points, $purple);
// left-facing M on baseline
$top = 240;
@@ -61,7 +61,7 @@ $points = array(
$left, $bot,
($left+$right)/2, ($top+$bot)/2
);
-imagefilledpolygon($im, $points, 5, $magenta);
+imagefilledpolygon($im, $points, $magenta);
// left-facing M on ceiling
$top = -15;
@@ -75,23 +75,23 @@ $points = array(
$left, $bot,
($left+$right)/2, ($top+$bot)/2
);
-imagefilledpolygon($im, $points, 5, $blue);
+imagefilledpolygon($im, $points, $blue);
$d = 30;
$x = 150;
$y = 150;
$diamond = array($x-$d, $y, $x, $y+$d, $x+$d, $y, $x, $y-$d);
-imagefilledpolygon($im, $diamond, 4, $green);
+imagefilledpolygon($im, $diamond, $green);
$x = 180;
$y = 225;
$diamond = array($x-$d, $y, $x, $y+$d, $x+$d, $y, $x, $y-$d);
-imagefilledpolygon($im, $diamond, 4, $red);
+imagefilledpolygon($im, $diamond, $red);
$x = 225;
$y = 255;
$diamond = array($x-$d, $y, $x, $y+$d, $x+$d, $y, $x, $y-$d);
-imagefilledpolygon($im, $diamond, 4, $cyan);
+imagefilledpolygon($im, $diamond, $cyan);
// M (bridge) not touching bottom boundary
$top = 100;
@@ -104,7 +104,7 @@ $points = array(
$x+$d, ($top+$bot)/2,
$x, $bot
);
-imagefilledpolygon($im, $points, 5, $black);
+imagefilledpolygon($im, $points, $black);
include_once __DIR__ . '/func.inc';
test_image_equals_file(__DIR__ . '/libgd00100.png', $im);
diff --git a/ext/gd/tests/libgd00101.phpt b/ext/gd/tests/libgd00101.phpt
index dbb1886171..7e1e4b5872 100644
--- a/ext/gd/tests/libgd00101.phpt
+++ b/ext/gd/tests/libgd00101.phpt
@@ -11,7 +11,7 @@ $im = imagecreatefromgd(__DIR__ . '/libgd00101.gd');
var_dump($im);
?>
--EXPECTF--
-Warning: imagecreatefromgd(): product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
+Warning: imagecreatefromgd(): Product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
in %slibgd00101.php on line %d
Warning: imagecreatefromgd(): '%slibgd00101.gd' is not a valid GD file in %slibgd00101.php on line %d
diff --git a/ext/gd/tests/libgd00106.phpt b/ext/gd/tests/libgd00106.phpt
index 65e4692ea3..d651b0bb1f 100644
--- a/ext/gd/tests/libgd00106.phpt
+++ b/ext/gd/tests/libgd00106.phpt
@@ -13,9 +13,9 @@ $c2 = imagecolorat($im, 1,2);
$c3 = imagecolorat($im, 2,1);
$c4 = imagecolorat($im, 2,2);
if ($c1 == 0xFFFFFF && $c2 == 0 && $c3 == 0 && $c4 == 0) {
- echo "Ok";
+ echo "Ok";
} else {
- echo "failed";
+ echo "failed";
}
?>
--EXPECT--
diff --git a/ext/gd/tests/libgd00191.phpt b/ext/gd/tests/libgd00191.phpt
index 6e3ffd51b1..983b93e180 100644
--- a/ext/gd/tests/libgd00191.phpt
+++ b/ext/gd/tests/libgd00191.phpt
@@ -14,9 +14,9 @@ imagefilledellipse($im, 30, 50, 20, 20, imagecolorallocate($im, 0, 0, 0));
$index = imagecolorat($im, 12, 28);
$arr = imagecolorsforindex($im, $index);
if ($arr['red'] == 255 && $arr['green'] == 255 && $arr['blue'] == 255) {
- echo "Ok";
+ echo "Ok";
} else {
- echo "failed";
+ echo "failed";
}
?>
--EXPECT--
diff --git a/ext/gd/tests/lines.phpt b/ext/gd/tests/lines.phpt
index dda8497222..34e8304dcd 100644
--- a/ext/gd/tests/lines.phpt
+++ b/ext/gd/tests/lines.phpt
@@ -9,10 +9,6 @@ imageline no AA
$im = imagecreatetruecolor(6,6);
imagefill($im, 0,0, 0xffffff);
-// Wrong argument count
-imageline($im, 0,0, 5,5);
-
-
// Horizontal line
imageline($im, 0,5, 5,5, 0x00ff00);
@@ -20,10 +16,10 @@ $p1 = imagecolorat($im, 0,5)==0x00ff00;
$p2 = imagecolorat($im, 5,5)==0x00ff00;
$p3 = true;
for ($x=1; $x<5; $x++) {
- $p3 = $p3 && (imagecolorat($im, $x,5)==0x00ff00);
+ $p3 = $p3 && (imagecolorat($im, $x,5)==0x00ff00);
}
if ($p1 && $p2 && $p3) {
- echo "Horizontal: ok\n";
+ echo "Horizontal: ok\n";
}
$im = imagecreatetruecolor(6,6);
@@ -34,11 +30,11 @@ $p1 = imagecolorat($im, 0,0)==0x00ff00;
$p2 = imagecolorat($im, 0,5)==0x00ff00;
$p3 = true;
for ($y=1; $y<5; $y++) {
- $p3 = $p3 && (imagecolorat($im, 0,$y)==0x00ff00);
+ $p3 = $p3 && (imagecolorat($im, 0,$y)==0x00ff00);
}
if ($p1 && $p2 && $p3) {
- echo "Vertical: ok\n";
+ echo "Vertical: ok\n";
}
@@ -54,12 +50,12 @@ $x=1;
$p3 = true;
for ($y=1; $y<5; $y++) {
- $p3 = $p3 && (imagecolorat($im, $x,$y)==0x00ff00);
- $x++;
+ $p3 = $p3 && (imagecolorat($im, $x,$y)==0x00ff00);
+ $x++;
}
if ($p1 && $p2 && $p3) {
- echo "Diagonal: ok\n";
+ echo "Diagonal: ok\n";
}
// Outside
@@ -68,12 +64,12 @@ imagefill($im, 0,0, 0xffffff);
imageline($im, 12, 12, 23,23, 0x00ff00);
$p3 = true;
for ($x=0; $x<6; $x++) {
- for ($y=0; $y<6; $y++) {
- $p3 = $p3 && (imagecolorat($im, $x,$y)!=0x00ff00);
- }
+ for ($y=0; $y<6; $y++) {
+ $p3 = $p3 && (imagecolorat($im, $x,$y)!=0x00ff00);
+ }
}
if ($p3) {
- echo "Outside 1: ok\n";
+ echo "Outside 1: ok\n";
}
$im = imagecreatetruecolor(6,6);
@@ -81,12 +77,12 @@ imagefill($im, 0,0, 0xffffff);
imageline($im, -12, -12, -23,-23, 0x00ff00);
$p3 = true;
for ($x=0; $x<6; $x++) {
- for ($y=0; $y<6; $y++) {
- $p3 = $p3 && (imagecolorat($im, $x,$y)!=0x00ff00);
- }
+ for ($y=0; $y<6; $y++) {
+ $p3 = $p3 && (imagecolorat($im, $x,$y)!=0x00ff00);
+ }
}
if ($p3) {
- echo "Outside 2: ok\n";
+ echo "Outside 2: ok\n";
}
$im = imagecreatetruecolor(6,6);
@@ -94,18 +90,17 @@ imagefill($im, 0,0, 0xffffff);
imageline($im, -1, -1, 4,4, 0x00ff00);
$p3 = true;
for ($x=0; $x<5; $x++) {
- for ($y=0; $y<5; $y++) {
- $p3 = $p3 && (imagecolorat($im, $x,$y)==0x00ff00);
- }
+ for ($y=0; $y<5; $y++) {
+ $p3 = $p3 && (imagecolorat($im, $x,$y)==0x00ff00);
+ }
}
if ($p3) {
- echo "Outside 2: ok\n";
+ echo "Outside 2: ok\n";
}
?>
--EXPECTF--
-Warning: imageline() expects exactly 6 parameters, 5 given in %s on line %d
Horizontal: ok
Vertical: ok
Diagonal: ok
diff --git a/ext/gd/tests/png2gd.phpt b/ext/gd/tests/png2gd.phpt
index ea70298292..850cdd0be2 100644
--- a/ext/gd/tests/png2gd.phpt
+++ b/ext/gd/tests/png2gd.phpt
@@ -12,28 +12,28 @@ png <--> gd1/gd2 conversion test
?>
--FILE--
<?php
- $cwd = __DIR__;
+ $cwd = __DIR__;
- echo "PNG to GD1 conversion: ";
- echo imagegd(imagecreatefrompng($cwd . "/conv_test.png"), $cwd . "/test_png.gd1") ? 'ok' : 'failed';
- echo "\n";
+ echo "PNG to GD1 conversion: ";
+ echo imagegd(imagecreatefrompng($cwd . "/conv_test.png"), $cwd . "/test_png.gd1") ? 'ok' : 'failed';
+ echo "\n";
- echo "PNG to GD2 conversion: ";
- echo imagegd2(imagecreatefrompng($cwd . "/conv_test.png"), $cwd . "/test_png.gd2") ? 'ok' : 'failed';
- echo "\n";
+ echo "PNG to GD2 conversion: ";
+ echo imagegd2(imagecreatefrompng($cwd . "/conv_test.png"), $cwd . "/test_png.gd2") ? 'ok' : 'failed';
+ echo "\n";
- echo "GD1 to PNG conversion: ";
- echo imagepng(imagecreatefromgd($cwd . "/test_png.gd1"), $cwd . "/test_gd1.png") ? 'ok' : 'failed';
- echo "\n";
+ echo "GD1 to PNG conversion: ";
+ echo imagepng(imagecreatefromgd($cwd . "/test_png.gd1"), $cwd . "/test_gd1.png") ? 'ok' : 'failed';
+ echo "\n";
- echo "GD2 to PNG conversion: ";
- echo imagepng(imagecreatefromgd2($cwd . "/test_png.gd2"), $cwd . "/test_gd2.png") ? 'ok' : 'failed';
- echo "\n";
+ echo "GD2 to PNG conversion: ";
+ echo imagepng(imagecreatefromgd2($cwd . "/test_png.gd2"), $cwd . "/test_gd2.png") ? 'ok' : 'failed';
+ echo "\n";
- @unlink($cwd . "/test_png.gd1");
- @unlink($cwd . "/test_png.gd2");
- @unlink($cwd . "/test_gd1.png");
- @unlink($cwd . "/test_gd2.png");
+ @unlink($cwd . "/test_png.gd1");
+ @unlink($cwd . "/test_png.gd2");
+ @unlink($cwd . "/test_gd1.png");
+ @unlink($cwd . "/test_gd2.png");
?>
--EXPECT--
PNG to GD1 conversion: ok
diff --git a/ext/gd/tests/png2wbmp_error1-mb.phpt b/ext/gd/tests/png2wbmp_error1-mb.phpt
deleted file mode 100644
index ac0753fb6c..0000000000
--- a/ext/gd/tests/png2wbmp_error1-mb.phpt
+++ /dev/null
@@ -1,46 +0,0 @@
---TEST--
-Test png2wbmp() function : wrong threshold value param
---CREDITS--
-Levi Fukumori <levi [at] fukumori [dot] com [dot] br>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if(!extension_loaded('gd')) {
- die('skip gd extension is not loaded');
-}
-if(!function_exists('png2wbmp')) {
- die('skip png2wbmp function is not available');
-}
-?>
---FILE--
-<?php
-// Create a blank image and add some text
-$im = imagecreatetruecolor(120, 20);
-$text_color = imagecolorallocate($im, 255, 255, 255);
-imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color);
-
-$file = __DIR__ .'/simpletextç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.png';
-$file2 = __DIR__ .'/simpletextç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.wbmp';
-
-// Save the image as 'simpletext.png'
-imagepng($im, $file);
-
-// Free up memory
-imagedestroy($im);
-
-png2wbmp($file, $file2, 20, 120, 9);
-png2wbmp($file, $file2, 20, 120, -1);
-?>
---EXPECTF--
-Deprecated: Function png2wbmp() is deprecated in %s on line %d
-
-Warning: png2wbmp(): Invalid threshold value '9' in %s on line %d
-
-Deprecated: Function png2wbmp() is deprecated in %s on line %d
-
-Warning: png2wbmp(): Invalid threshold value '-1' in %s on line %d
---CLEAN--
-<?php
-unlink(__DIR__ .'/simpletextç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.png');
-unlink(__DIR__ .'/simpletextç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.wbmp');
-?>
diff --git a/ext/gd/tests/png2wbmp_error1.phpt b/ext/gd/tests/png2wbmp_error1.phpt
deleted file mode 100644
index 5805dfa7a0..0000000000
--- a/ext/gd/tests/png2wbmp_error1.phpt
+++ /dev/null
@@ -1,46 +0,0 @@
---TEST--
-Test png2wbmp() function : wrong threshold value param
---CREDITS--
-Levi Fukumori <levi [at] fukumori [dot] com [dot] br>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if(!extension_loaded('gd')) {
- die('skip gd extension is not loaded');
-}
-if(!function_exists('png2wbmp')) {
- die('skip png2wbmp function is not available');
-}
-?>
---FILE--
-<?php
-// Create a blank image and add some text
-$im = imagecreatetruecolor(120, 20);
-$text_color = imagecolorallocate($im, 255, 255, 255);
-imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color);
-
-$file = __DIR__ .'/simpletext.png';
-$file2 = __DIR__ .'/simpletext.wbmp';
-
-// Save the image as 'simpletext.png'
-imagepng($im, $file);
-
-// Free up memory
-imagedestroy($im);
-
-png2wbmp($file, $file2, 20, 120, 9);
-png2wbmp($file, $file2, 20, 120, -1);
-?>
---EXPECTF--
-Deprecated: Function png2wbmp() is deprecated in %s on line %d
-
-Warning: png2wbmp(): Invalid threshold value '9' in %s on line %d
-
-Deprecated: Function png2wbmp() is deprecated in %s on line %d
-
-Warning: png2wbmp(): Invalid threshold value '-1' in %s on line %d
---CLEAN--
-<?php
-unlink(__DIR__ .'/simpletext.png');
-unlink(__DIR__ .'/simpletext.wbmp');
-?>
diff --git a/ext/gd/tests/png2wbmp_error2.phpt b/ext/gd/tests/png2wbmp_error2.phpt
deleted file mode 100644
index 3bfff05891..0000000000
--- a/ext/gd/tests/png2wbmp_error2.phpt
+++ /dev/null
@@ -1,37 +0,0 @@
---TEST--
-Test png2wbmp() function : wrong origin filename param
---CREDITS--
-Levi Fukumori <levi [at] fukumori [dot] com [dot] br>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if(!extension_loaded('gd')) {
- die('skip gd extension is not loaded');
-}
-if(!function_exists('png2wbmp')) {
- die('skip png2wbmp function is not available');
-}
-?>
---FILE--
-<?php
-$file = __DIR__ .'/simpletext.wbmp';
-png2wbmp('', $file, 20, 120, 8);
-png2wbmp(null, $file, 20, 120, 8);
-png2wbmp(false, $file, 20, 120, 8);
-?>
---EXPECTF--
-Deprecated: Function png2wbmp() is deprecated in %s on line %d
-
-Warning: png2wbmp(): Unable to open '' for reading in %s on line %d
-
-Deprecated: Function png2wbmp() is deprecated in %s on line %d
-
-Warning: png2wbmp(): Unable to open '' for reading in %s on line %d
-
-Deprecated: Function png2wbmp() is deprecated in %s on line %d
-
-Warning: png2wbmp(): Unable to open '' for reading in %s on line %d
---CLEAN--
-<?php
-unlink(__DIR__ .'/simpletext.wbmp');
-?>
diff --git a/ext/gd/tests/png2wbmp_error3.phpt b/ext/gd/tests/png2wbmp_error3.phpt
deleted file mode 100644
index 8bf0aa25bb..0000000000
--- a/ext/gd/tests/png2wbmp_error3.phpt
+++ /dev/null
@@ -1,49 +0,0 @@
---TEST--
-Test png2wbmp() function : wrong destination filename param
---CREDITS--
-Levi Fukumori <levi [at] fukumori [dot] com [dot] br>
-#testfest PHPSP on 2009-06-20
---SKIPIF--
-<?php
-if(!extension_loaded('gd')) {
- die('skip gd extension is not loaded');
-}
-if(!function_exists('png2wbmp')) {
- die('skip png2wbmp function is not available');
-}
-?>
---FILE--
-<?php
-// Create a blank image and add some text
-$im = imagecreatetruecolor(120, 20);
-$text_color = imagecolorallocate($im, 255, 255, 255);
-imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color);
-
-$file = __DIR__ .'/simpletext.png';
-
-// Save the image as 'simpletext.png'
-imagepng($im, $file);
-
-// Free up memory
-imagedestroy($im);
-
-png2wbmp($file, '', 20, 120, 8);
-png2wbmp($file, null, 20, 120, 8);
-png2wbmp($file, false, 20, 120, 8);
-?>
---EXPECTF--
-Deprecated: Function png2wbmp() is deprecated in %s on line %d
-
-Warning: png2wbmp(): Unable to open '' for writing in %s on line %d
-
-Deprecated: Function png2wbmp() is deprecated in %s on line %d
-
-Warning: png2wbmp(): Unable to open '' for writing in %s on line %d
-
-Deprecated: Function png2wbmp() is deprecated in %s on line %d
-
-Warning: png2wbmp(): Unable to open '' for writing in %s on line %d
---CLEAN--
-<?php
-unlink(__DIR__ .'/simpletext.png');
-?>
diff --git a/ext/gd/tests/pngcomp.phpt b/ext/gd/tests/pngcomp.phpt
index aa663a6dd2..f9065ea82a 100644
--- a/ext/gd/tests/pngcomp.phpt
+++ b/ext/gd/tests/pngcomp.phpt
@@ -12,9 +12,9 @@ png compression test
?>
--FILE--
<?php
- $cwd = __DIR__;
+ $cwd = __DIR__;
- echo "PNG compression test: ";
+ echo "PNG compression test: ";
$im = imagecreatetruecolor(20,20);
imagefilledrectangle($im, 5,5, 10,10, 0xffffff);
@@ -26,7 +26,7 @@ png compression test
echo "ok\n";
}
- @unlink($cwd . "/test_pngcomp.png");
+ @unlink($cwd . "/test_pngcomp.png");
?>
--EXPECT--
PNG compression test: ok
diff --git a/ext/gd/tests/test_image_equals_file_palette.phpt b/ext/gd/tests/test_image_equals_file_palette.phpt
index 0cfea7f415..51192a6ecd 100644
--- a/ext/gd/tests/test_image_equals_file_palette.phpt
+++ b/ext/gd/tests/test_image_equals_file_palette.phpt
@@ -31,11 +31,9 @@ imagefilledrectangle($im, 3,3, 7,7, $red);
test_image_equals_file($filename, $im);
?>
-===DONE===
--EXPECT--
The images differ in 25 pixels.
The images are equal.
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . DIRECTORY_SEPARATOR . 'test_image_equals_file_palette.png');
diff --git a/ext/gd/tests/types.phpt b/ext/gd/tests/types.phpt
index 246e3ba7d2..7510ba17c6 100644
--- a/ext/gd/tests/types.phpt
+++ b/ext/gd/tests/types.phpt
@@ -9,23 +9,23 @@ imagetypes
$flags = imagetypes();
if ($flags&0x1 && !function_exists("imagegif")) {
- echo "gif failed\n";
+ echo "gif failed\n";
}
if ($flags&0x2 && !function_exists("imagejpeg")) {
- echo "jpeg failed\n";
+ echo "jpeg failed\n";
}
if ($flags&0x4 && !function_exists("imagepng")) {
- echo "png failed\n";
+ echo "png failed\n";
}
if ($flags&0x8 && !function_exists("imagewbmp")) {
- echo "wbmp failed\n";
+ echo "wbmp failed\n";
}
if ($flags&16 && !function_exists("imagecreatefromxpm")) {
- echo "xom failed\n";
+ echo "xom failed\n";
}
echo "ok\n";
?>
diff --git a/ext/gd/tests/xbm2png.phpt b/ext/gd/tests/xbm2png.phpt
index 8dcd07bc4a..9b1b4013c8 100644
--- a/ext/gd/tests/xbm2png.phpt
+++ b/ext/gd/tests/xbm2png.phpt
@@ -14,13 +14,13 @@ xbm --> png conversion test
?>
--FILE--
<?php
- $cwd = __DIR__;
+ $cwd = __DIR__;
- echo "XBM to PNG conversion: ";
- echo imagepng(imagecreatefromxbm($cwd . "/conv_test.xbm"), $cwd . "/test_xbm.png") ? 'ok' : 'failed';
- echo "\n";
+ echo "XBM to PNG conversion: ";
+ echo imagepng(imagecreatefromxbm($cwd . "/conv_test.xbm"), $cwd . "/test_xbm.png") ? 'ok' : 'failed';
+ echo "\n";
- @unlink($cwd . "/test_xbm.png");
+ @unlink($cwd . "/test_xbm.png");
?>
--EXPECT--
XBM to PNG conversion: ok
diff --git a/ext/gd/tests/xpm2gd.phpt b/ext/gd/tests/xpm2gd.phpt
index f48dcb2b3b..dba9f03ec8 100644
--- a/ext/gd/tests/xpm2gd.phpt
+++ b/ext/gd/tests/xpm2gd.phpt
@@ -12,18 +12,18 @@ xpm --> gd1/gd2 conversion test
?>
--FILE--
<?php
- $cwd = __DIR__;
+ $cwd = __DIR__;
- echo "XPM to GD1 conversion: ";
- echo imagegd(imagecreatefromxpm($cwd . "/conv_test.xpm"), $cwd . "/test_xpm.gd1") ? 'ok' : 'failed';
- echo "\n";
+ echo "XPM to GD1 conversion: ";
+ echo imagegd(imagecreatefromxpm($cwd . "/conv_test.xpm"), $cwd . "/test_xpm.gd1") ? 'ok' : 'failed';
+ echo "\n";
- echo "XPM to GD2 conversion: ";
- echo imagegd2(imagecreatefromxpm($cwd . "/conv_test.xpm"), $cwd . "/test_xpm.gd2") ? 'ok' : 'failed';
- echo "\n";
+ echo "XPM to GD2 conversion: ";
+ echo imagegd2(imagecreatefromxpm($cwd . "/conv_test.xpm"), $cwd . "/test_xpm.gd2") ? 'ok' : 'failed';
+ echo "\n";
- @unlink($cwd . "/test_xpm.gd1");
- @unlink($cwd . "/test_xpm.gd2");
+ @unlink($cwd . "/test_xpm.gd1");
+ @unlink($cwd . "/test_xpm.gd2");
?>
--EXPECT--
XPM to GD1 conversion: ok
diff --git a/ext/gd/tests/xpm2jpg.phpt b/ext/gd/tests/xpm2jpg.phpt
index 92cab3e5fa..6491b85646 100644
--- a/ext/gd/tests/xpm2jpg.phpt
+++ b/ext/gd/tests/xpm2jpg.phpt
@@ -15,13 +15,13 @@ xpm --> jpeg conversion test
?>
--FILE--
<?php
- $cwd = __DIR__;
+ $cwd = __DIR__;
- echo "XPM to JPEG conversion: ";
- echo imagejpeg(imagecreatefromxpm($cwd . "/conv_test.xpm"), $cwd . "/test_xpm.jpeg") ? 'ok' : 'failed';
- echo "\n";
+ echo "XPM to JPEG conversion: ";
+ echo imagejpeg(imagecreatefromxpm($cwd . "/conv_test.xpm"), $cwd . "/test_xpm.jpeg") ? 'ok' : 'failed';
+ echo "\n";
- @unlink($cwd . "/test_xpm.jpeg");
+ @unlink($cwd . "/test_xpm.jpeg");
?>
--EXPECT--
XPM to JPEG conversion: ok
diff --git a/ext/gd/tests/xpm2png.phpt b/ext/gd/tests/xpm2png.phpt
index e473cfb31c..602fc72a7c 100644
--- a/ext/gd/tests/xpm2png.phpt
+++ b/ext/gd/tests/xpm2png.phpt
@@ -15,13 +15,13 @@ xpm --> png conversion test
?>
--FILE--
<?php
- $cwd = __DIR__;
+ $cwd = __DIR__;
- echo "XPM to PNG conversion: ";
- echo imagepng(imagecreatefromxpm($cwd . "/conv_test.xpm"), $cwd . "/test_xpm.png") ? 'ok' : 'failed';
- echo "\n";
+ echo "XPM to PNG conversion: ";
+ echo imagepng(imagecreatefromxpm($cwd . "/conv_test.xpm"), $cwd . "/test_xpm.png") ? 'ok' : 'failed';
+ echo "\n";
- @unlink($cwd . "/test_xpm.png");
+ @unlink($cwd . "/test_xpm.png");
?>
--EXPECT--
XPM to PNG conversion: ok
diff --git a/ext/gettext/gettext.c b/ext/gettext/gettext.c
index 003787f5c0..ab796630f4 100644
--- a/ext/gettext/gettext.c
+++ b/ext/gettext/gettext.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -27,66 +25,7 @@
#include <stdio.h>
#include "ext/standard/info.h"
#include "php_gettext.h"
-
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO(arginfo_textdomain, 0)
- ZEND_ARG_INFO(0, domain)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_gettext, 0)
- ZEND_ARG_INFO(0, msgid)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_dgettext, 0)
- ZEND_ARG_INFO(0, domain_name)
- ZEND_ARG_INFO(0, msgid)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_dcgettext, 0)
- ZEND_ARG_INFO(0, domain_name)
- ZEND_ARG_INFO(0, msgid)
- ZEND_ARG_INFO(0, category)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_bindtextdomain, 0)
- ZEND_ARG_INFO(0, domain_name)
- ZEND_ARG_INFO(0, dir)
-ZEND_END_ARG_INFO()
-
-#if HAVE_NGETTEXT
-ZEND_BEGIN_ARG_INFO(arginfo_ngettext, 0)
- ZEND_ARG_INFO(0, msgid1)
- ZEND_ARG_INFO(0, msgid2)
- ZEND_ARG_INFO(0, count)
-ZEND_END_ARG_INFO()
-#endif
-
-#if HAVE_DNGETTEXT
-ZEND_BEGIN_ARG_INFO(arginfo_dngettext, 0)
- ZEND_ARG_INFO(0, domain)
- ZEND_ARG_INFO(0, msgid1)
- ZEND_ARG_INFO(0, msgid2)
- ZEND_ARG_INFO(0, count)
-ZEND_END_ARG_INFO()
-#endif
-
-#if HAVE_DCNGETTEXT
-ZEND_BEGIN_ARG_INFO(arginfo_dcngettext, 0)
- ZEND_ARG_INFO(0, domain)
- ZEND_ARG_INFO(0, msgid1)
- ZEND_ARG_INFO(0, msgid2)
- ZEND_ARG_INFO(0, count)
- ZEND_ARG_INFO(0, category)
-ZEND_END_ARG_INFO()
-#endif
-
-#if HAVE_BIND_TEXTDOMAIN_CODESET
-ZEND_BEGIN_ARG_INFO(arginfo_bind_textdomain_codeset, 0)
- ZEND_ARG_INFO(0, domain)
- ZEND_ARG_INFO(0, codeset)
-ZEND_END_ARG_INFO()
-#endif
-/* }}} */
+#include "gettext_arginfo.h"
/* {{{ php_gettext_functions[]
*/
@@ -138,7 +77,7 @@ ZEND_GET_MODULE(php_gettext)
#define PHP_GETTEXT_DOMAIN_LENGTH_CHECK(domain_len) \
if (UNEXPECTED(domain_len > PHP_GETTEXT_MAX_DOMAIN_LENGTH)) { \
- php_error_docref(NULL, E_WARNING, "domain passed too long"); \
+ php_error_docref(NULL, E_WARNING, "Domain passed too long"); \
RETURN_FALSE; \
}
@@ -163,7 +102,7 @@ PHP_NAMED_FUNCTION(zif_textdomain)
size_t domain_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s!", &domain, &domain_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
PHP_GETTEXT_DOMAIN_LENGTH_CHECK(domain_len)
@@ -210,7 +149,7 @@ PHP_NAMED_FUNCTION(zif_dgettext)
zend_string *domain, *msgid;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS", &domain, &msgid) == FAILURE) {
- return;
+ RETURN_THROWS();
}
PHP_GETTEXT_DOMAIN_LENGTH_CHECK(ZSTR_LEN(domain))
@@ -235,7 +174,7 @@ PHP_NAMED_FUNCTION(zif_dcgettext)
zend_long category;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "SSl", &domain, &msgid, &category) == FAILURE) {
- return;
+ RETURN_THROWS();
}
PHP_GETTEXT_DOMAIN_LENGTH_CHECK(ZSTR_LEN(domain))
@@ -260,7 +199,7 @@ PHP_NAMED_FUNCTION(zif_bindtextdomain)
char *retval, dir_name[MAXPATHLEN];
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &domain, &domain_len, &dir, &dir_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
PHP_GETTEXT_DOMAIN_LENGTH_CHECK(domain_len)
@@ -294,7 +233,7 @@ PHP_NAMED_FUNCTION(zif_ngettext)
zend_long count;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ssl", &msgid1, &msgid1_len, &msgid2, &msgid2_len, &count) == FAILURE) {
- return;
+ RETURN_THROWS();
}
PHP_GETTEXT_LENGTH_CHECK("msgid1", msgid1_len)
@@ -319,7 +258,7 @@ PHP_NAMED_FUNCTION(zif_dngettext)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sssl", &domain, &domain_len,
&msgid1, &msgid1_len, &msgid2, &msgid2_len, &count) == FAILURE) {
- return;
+ RETURN_THROWS();
}
PHP_GETTEXT_DOMAIN_LENGTH_CHECK(domain_len)
@@ -347,7 +286,7 @@ PHP_NAMED_FUNCTION(zif_dcngettext)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sssll", &domain, &domain_len,
&msgid1, &msgid1_len, &msgid2, &msgid2_len, &count, &category) == FAILURE) {
- return;
+ RETURN_THROWS();
}
PHP_GETTEXT_DOMAIN_LENGTH_CHECK(domain_len)
@@ -372,7 +311,7 @@ PHP_NAMED_FUNCTION(zif_bind_textdomain_codeset)
size_t domain_len, codeset_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &domain, &domain_len, &codeset, &codeset_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
PHP_GETTEXT_DOMAIN_LENGTH_CHECK(domain_len)
diff --git a/ext/gettext/gettext.stub.php b/ext/gettext/gettext.stub.php
new file mode 100644
index 0000000000..16315f0033
--- /dev/null
+++ b/ext/gettext/gettext.stub.php
@@ -0,0 +1,27 @@
+<?php
+
+function textdomain(?string $domain): string|false {}
+
+function gettext(string $msgid): string|false {}
+
+function dgettext(string $domain_name, string $msgid): string|false {}
+
+function dcgettext(string $domain_name, string $msgid, int $category): string|false {}
+
+function bindtextdomain(string $domain_name, string $dir): string|false {}
+
+#if HAVE_NGETTEXT
+function ngettext(string $msgid1, string $msgid2, int $n): string|false {}
+#endif
+
+#if HAVE_DNGETTEXT
+function dngettext(string $domain, string $msgid1, string $msgid2, int $count): string|false {}
+#endif
+
+#if HAVE_DCNGETTEXT
+function dcngettext(string $domain, string $msgid1, string $msgid2, int $count, int $category): string|false {}
+#endif
+
+#if HAVE_BIND_TEXTDOMAIN_CODESET
+function bind_textdomain_codeset(string $domain, string $codeset): string|false {}
+#endif
diff --git a/ext/gettext/gettext_arginfo.h b/ext/gettext/gettext_arginfo.h
new file mode 100644
index 0000000000..d3c4374b4a
--- /dev/null
+++ b/ext/gettext/gettext_arginfo.h
@@ -0,0 +1,59 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_textdomain, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, domain, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_gettext, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, msgid, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_dgettext, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, domain_name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, msgid, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_dcgettext, 0, 3, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, domain_name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, msgid, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, category, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_bindtextdomain, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, domain_name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, dir, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#if HAVE_NGETTEXT
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ngettext, 0, 3, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, msgid1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, msgid2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, n, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if HAVE_DNGETTEXT
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_dngettext, 0, 4, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, domain, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, msgid1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, msgid2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, count, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if HAVE_DCNGETTEXT
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_dcngettext, 0, 5, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, domain, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, msgid1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, msgid2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, count, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, category, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if HAVE_BIND_TEXTDOMAIN_CODESET
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_bind_textdomain_codeset, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, domain, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, codeset, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
diff --git a/ext/gettext/php_gettext.h b/ext/gettext/php_gettext.h
index 2f07554596..e008a61b8c 100644
--- a/ext/gettext/php_gettext.h
+++ b/ext/gettext/php_gettext.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/gettext/tests/44938.phpt b/ext/gettext/tests/44938.phpt
index f92f7c1dea..a5b32c6bf2 100644
--- a/ext/gettext/tests/44938.phpt
+++ b/ext/gettext/tests/44938.phpt
@@ -35,12 +35,11 @@ var_dump(dgettext($domain, $overflown));
var_dump(textdomain($overflown));
?>
-==DONE==
--EXPECTF--
-Warning: bindtextdomain(): domain passed too long in %s on line %d
+Warning: bindtextdomain(): Domain passed too long in %s on line %d
bool(false)
-Warning: dngettext(): domain passed too long in %s on line %d
+Warning: dngettext(): Domain passed too long in %s on line %d
bool(false)
Warning: dngettext(): msgid1 passed too long in %s on line %d
@@ -58,13 +57,13 @@ bool(false)
Warning: ngettext(): msgid2 passed too long in %s on line %d
bool(false)
-Warning: dcgettext(): domain passed too long in %s on line %d
+Warning: dcgettext(): Domain passed too long in %s on line %d
bool(false)
Warning: dcgettext(): msgid passed too long in %s on line %d
bool(false)
-Warning: dcngettext(): domain passed too long in %s on line %d
+Warning: dcngettext(): Domain passed too long in %s on line %d
bool(false)
Warning: dcngettext(): msgid1 passed too long in %s on line %d
@@ -73,12 +72,11 @@ bool(false)
Warning: dcngettext(): msgid2 passed too long in %s on line %d
bool(false)
-Warning: dgettext(): domain passed too long in %s on line %d
+Warning: dgettext(): Domain passed too long in %s on line %d
bool(false)
Warning: dgettext(): msgid passed too long in %s on line %d
bool(false)
-Warning: textdomain(): domain passed too long in %s on line %d
+Warning: textdomain(): Domain passed too long in %s on line %d
bool(false)
-==DONE==
diff --git a/ext/gettext/tests/bug66267.phpt b/ext/gettext/tests/bug66267.phpt
index e5a2041109..749f4cd1a2 100644
--- a/ext/gettext/tests/bug66267.phpt
+++ b/ext/gettext/tests/bug66267.phpt
@@ -27,21 +27,20 @@ $domain = 'domain';
$loc = ["de_DE", "fr_FR", "en_US"];
foreach ($loc as $l) {
- putenv("LC_ALL=$l");
- setlocale(LC_ALL, $l);
+ putenv("LC_ALL=$l");
+ setlocale(LC_ALL, $l);
- $path = realpath(__DIR__ . DIRECTORY_SEPARATOR . "66265");
- bindtextdomain($domain, $path);
- bind_textdomain_codeset($domain, "UTF-8");
- textdomain($domain);
+ $path = realpath(__DIR__ . DIRECTORY_SEPARATOR . "66265");
+ bindtextdomain($domain, $path);
+ bind_textdomain_codeset($domain, "UTF-8");
+ textdomain($domain);
- echo 'LC_ALL=', getenv('LC_ALL'), "\n";
- echo 'hello=', _('hello'), "\n";
- echo "\n";
+ echo 'LC_ALL=', getenv('LC_ALL'), "\n";
+ echo 'hello=', _('hello'), "\n";
+ echo "\n";
}
?>
-==DONE==
--EXPECT--
LC_ALL=de_DE
hello=hallo
@@ -52,4 +51,3 @@ hello=salut
LC_ALL=en_US
hello=hello
-==DONE==
diff --git a/ext/gettext/tests/bug73730.phpt b/ext/gettext/tests/bug73730.phpt
index df6d7b0f11..6fd63b885d 100644
--- a/ext/gettext/tests/bug73730.phpt
+++ b/ext/gettext/tests/bug73730.phpt
@@ -10,7 +10,5 @@ declare(strict_types=1);
var_dump(textdomain(null));
?>
-===DONE===
--EXPECT--
string(8) "messages"
-===DONE===
diff --git a/ext/gettext/tests/dcngettext.phpt b/ext/gettext/tests/dcngettext.phpt
index 4bf493507b..f004febcb6 100644
--- a/ext/gettext/tests/dcngettext.phpt
+++ b/ext/gettext/tests/dcngettext.phpt
@@ -8,7 +8,6 @@ if (!function_exists("dcngettext")) die("skip dcngettext() doesn't exist");
--FILE--
<?php
-var_dump(dcngettext(1,1,1,1));
var_dump(dcngettext(1,1,1,1,1));
var_dump(dcngettext("test","test","test",1,1));
var_dump(dcngettext("test","test","test",0,0));
@@ -18,9 +17,7 @@ var_dump(dcngettext("","","",0,0));
echo "Done\n";
?>
---EXPECTF--
-Warning: dcngettext() expects exactly 5 parameters, 4 given in %s on line %d
-bool(false)
+--EXPECT--
string(1) "1"
string(4) "test"
string(4) "test"
diff --git a/ext/gettext/tests/gettext_bind_textdomain_codeset-retval.phpt b/ext/gettext/tests/gettext_bind_textdomain_codeset-retval.phpt
index 822e412d83..498568294a 100644
--- a/ext/gettext/tests/gettext_bind_textdomain_codeset-retval.phpt
+++ b/ext/gettext/tests/gettext_bind_textdomain_codeset-retval.phpt
@@ -8,10 +8,10 @@ test if bind_textdomain_codeset() returns correct value
?>
--FILE--
<?php
- var_dump(bind_textdomain_codeset(false,false));
- var_dump(bind_textdomain_codeset('messages', "UTF-8"));
+ var_dump(bind_textdomain_codeset(false,false));
+ var_dump(bind_textdomain_codeset('messages', "UTF-8"));
- echo "Done\n";
+ echo "Done\n";
?>
--EXPECT--
bool(false)
diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c
index c2ac6d0a1e..b0682c11f2 100644
--- a/ext/gmp/gmp.c
+++ b/ext/gmp/gmp.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -30,110 +28,13 @@
#include "zend_exceptions.h"
#include <gmp.h>
+#include "gmp_arginfo.h"
/* Needed for gmp_random() */
#include "ext/standard/php_rand.h"
#include "ext/standard/php_lcg.h"
#define GMP_ABS(x) ((x) >= 0 ? (x) : -(x))
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_init, 0, 0, 1)
- ZEND_ARG_INFO(0, number)
- ZEND_ARG_INFO(0, base)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_import, 0, 0, 1)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, word_size)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_export, 0, 0, 1)
- ZEND_ARG_INFO(0, gmpnumber)
- ZEND_ARG_INFO(0, word_size)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_intval, 0, 0, 1)
- ZEND_ARG_INFO(0, gmpnumber)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_strval, 0, 0, 1)
- ZEND_ARG_INFO(0, gmpnumber)
- ZEND_ARG_INFO(0, base)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_unary, 0, 0, 1)
- ZEND_ARG_INFO(0, a)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_binary, 0, 0, 2)
- ZEND_ARG_INFO(0, a)
- ZEND_ARG_INFO(0, b)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_div, 0, 0, 2)
- ZEND_ARG_INFO(0, a)
- ZEND_ARG_INFO(0, b)
- ZEND_ARG_INFO(0, round)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_pow, 0, 0, 2)
- ZEND_ARG_INFO(0, base)
- ZEND_ARG_INFO(0, exp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_powm, 0, 0, 3)
- ZEND_ARG_INFO(0, base)
- ZEND_ARG_INFO(0, exp)
- ZEND_ARG_INFO(0, mod)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_root, 0, 0, 2)
- ZEND_ARG_INFO(0, a)
- ZEND_ARG_INFO(0, nth)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_prob_prime, 0, 0, 1)
- ZEND_ARG_INFO(0, a)
- ZEND_ARG_INFO(0, reps)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_random, 0, 0, 0)
- ZEND_ARG_INFO(0, limiter)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_random_seed, 0, 0, 1)
- ZEND_ARG_INFO(0, seed)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_random_bits, 0, 0, 1)
- ZEND_ARG_INFO(0, bits)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_random_range, 0, 0, 2)
- ZEND_ARG_INFO(0, min)
- ZEND_ARG_INFO(0, max)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_setbit, 0, 0, 2)
- ZEND_ARG_INFO(0, a)
- ZEND_ARG_INFO(0, index)
- ZEND_ARG_INFO(0, set_clear)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_bit, 0, 0, 2)
- ZEND_ARG_INFO(0, a)
- ZEND_ARG_INFO(0, index)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gmp_scan, 0, 0, 2)
- ZEND_ARG_INFO(0, a)
- ZEND_ARG_INFO(0, start)
-ZEND_END_ARG_INFO()
-
-/* }}} */
-
ZEND_DECLARE_MODULE_GLOBALS(gmp)
static ZEND_GINIT_FUNCTION(gmp);
@@ -145,53 +46,52 @@ static const zend_function_entry gmp_functions[] = {
ZEND_FE(gmp_export, arginfo_gmp_export)
ZEND_FE(gmp_intval, arginfo_gmp_intval)
ZEND_FE(gmp_strval, arginfo_gmp_strval)
- ZEND_FE(gmp_add, arginfo_gmp_binary)
- ZEND_FE(gmp_sub, arginfo_gmp_binary)
- ZEND_FE(gmp_mul, arginfo_gmp_binary)
- ZEND_FE(gmp_div_qr, arginfo_gmp_div)
- ZEND_FE(gmp_div_q, arginfo_gmp_div)
- ZEND_FE(gmp_div_r, arginfo_gmp_div)
+ ZEND_FE(gmp_add, arginfo_gmp_add)
+ ZEND_FE(gmp_sub, arginfo_gmp_sub)
+ ZEND_FE(gmp_mul, arginfo_gmp_mul)
+ ZEND_FE(gmp_div_qr, arginfo_gmp_div_qr)
+ ZEND_FE(gmp_div_q, arginfo_gmp_div_q)
+ ZEND_FE(gmp_div_r, arginfo_gmp_div_r)
ZEND_FALIAS(gmp_div, gmp_div_q, arginfo_gmp_div)
- ZEND_FE(gmp_mod, arginfo_gmp_binary)
- ZEND_FE(gmp_divexact, arginfo_gmp_binary)
- ZEND_FE(gmp_neg, arginfo_gmp_unary)
- ZEND_FE(gmp_abs, arginfo_gmp_unary)
- ZEND_FE(gmp_fact, arginfo_gmp_unary)
- ZEND_FE(gmp_sqrt, arginfo_gmp_unary)
- ZEND_FE(gmp_sqrtrem, arginfo_gmp_unary)
+ ZEND_FE(gmp_mod, arginfo_gmp_mod)
+ ZEND_FE(gmp_divexact, arginfo_gmp_divexact)
+ ZEND_FE(gmp_neg, arginfo_gmp_neg)
+ ZEND_FE(gmp_abs, arginfo_gmp_abs)
+ ZEND_FE(gmp_fact, arginfo_gmp_fact)
+ ZEND_FE(gmp_sqrt, arginfo_gmp_sqrt)
+ ZEND_FE(gmp_sqrtrem, arginfo_gmp_sqrtrem)
ZEND_FE(gmp_root, arginfo_gmp_root)
- ZEND_FE(gmp_rootrem, arginfo_gmp_root)
+ ZEND_FE(gmp_rootrem, arginfo_gmp_rootrem)
ZEND_FE(gmp_pow, arginfo_gmp_pow)
ZEND_FE(gmp_powm, arginfo_gmp_powm)
- ZEND_FE(gmp_perfect_square, arginfo_gmp_unary)
- ZEND_FE(gmp_perfect_power, arginfo_gmp_unary)
+ ZEND_FE(gmp_perfect_square, arginfo_gmp_perfect_square)
+ ZEND_FE(gmp_perfect_power, arginfo_gmp_perfect_power)
ZEND_FE(gmp_prob_prime, arginfo_gmp_prob_prime)
- ZEND_FE(gmp_gcd, arginfo_gmp_binary)
- ZEND_FE(gmp_gcdext, arginfo_gmp_binary)
- ZEND_FE(gmp_lcm, arginfo_gmp_binary)
- ZEND_FE(gmp_invert, arginfo_gmp_binary)
- ZEND_FE(gmp_jacobi, arginfo_gmp_binary)
- ZEND_FE(gmp_legendre, arginfo_gmp_binary)
- ZEND_FE(gmp_kronecker, arginfo_gmp_binary)
- ZEND_FE(gmp_cmp, arginfo_gmp_binary)
- ZEND_FE(gmp_sign, arginfo_gmp_unary)
- ZEND_DEP_FE(gmp_random, arginfo_gmp_random)
+ ZEND_FE(gmp_gcd, arginfo_gmp_gcd)
+ ZEND_FE(gmp_gcdext, arginfo_gmp_gcdext)
+ ZEND_FE(gmp_lcm, arginfo_gmp_lcm)
+ ZEND_FE(gmp_invert, arginfo_gmp_invert)
+ ZEND_FE(gmp_jacobi, arginfo_gmp_jacobi)
+ ZEND_FE(gmp_legendre, arginfo_gmp_legendre)
+ ZEND_FE(gmp_kronecker, arginfo_gmp_kronecker)
+ ZEND_FE(gmp_cmp, arginfo_gmp_cmp)
+ ZEND_FE(gmp_sign, arginfo_gmp_sign)
ZEND_FE(gmp_random_seed, arginfo_gmp_random_seed)
ZEND_FE(gmp_random_bits, arginfo_gmp_random_bits)
ZEND_FE(gmp_random_range, arginfo_gmp_random_range)
- ZEND_FE(gmp_and, arginfo_gmp_binary)
- ZEND_FE(gmp_or, arginfo_gmp_binary)
- ZEND_FE(gmp_com, arginfo_gmp_unary)
- ZEND_FE(gmp_xor, arginfo_gmp_binary)
+ ZEND_FE(gmp_and, arginfo_gmp_and)
+ ZEND_FE(gmp_or, arginfo_gmp_or)
+ ZEND_FE(gmp_com, arginfo_gmp_com)
+ ZEND_FE(gmp_xor, arginfo_gmp_xor)
ZEND_FE(gmp_setbit, arginfo_gmp_setbit)
- ZEND_FE(gmp_clrbit, arginfo_gmp_bit)
- ZEND_FE(gmp_testbit, arginfo_gmp_bit)
- ZEND_FE(gmp_scan0, arginfo_gmp_scan)
- ZEND_FE(gmp_scan1, arginfo_gmp_scan)
- ZEND_FE(gmp_popcount, arginfo_gmp_unary)
- ZEND_FE(gmp_hamdist, arginfo_gmp_binary)
- ZEND_FE(gmp_nextprime, arginfo_gmp_unary)
- ZEND_FE(gmp_binomial, arginfo_gmp_binary)
+ ZEND_FE(gmp_clrbit, arginfo_gmp_clrbit)
+ ZEND_FE(gmp_testbit, arginfo_gmp_testbit)
+ ZEND_FE(gmp_scan0, arginfo_gmp_scan0)
+ ZEND_FE(gmp_scan1, arginfo_gmp_scan1)
+ ZEND_FE(gmp_popcount, arginfo_gmp_popcount)
+ ZEND_FE(gmp_hamdist, arginfo_gmp_hamdist)
+ ZEND_FE(gmp_nextprime, arginfo_gmp_nextprime)
+ ZEND_FE(gmp_binomial, arginfo_gmp_binomial)
PHP_FE_END
};
/* }}} */
@@ -408,24 +308,24 @@ static inline void gmp_create(zval *target, mpz_ptr *gmpnum_target) /* {{{ */
}
/* }}} */
-static int gmp_cast_object(zval *readobj, zval *writeobj, int type) /* {{{ */
+static int gmp_cast_object(zend_object *readobj, zval *writeobj, int type) /* {{{ */
{
mpz_ptr gmpnum;
switch (type) {
case IS_STRING:
- gmpnum = GET_GMP_FROM_ZVAL(readobj);
+ gmpnum = GET_GMP_OBJECT_FROM_OBJ(readobj)->num;
gmp_strval(writeobj, gmpnum, 10);
return SUCCESS;
case IS_LONG:
- gmpnum = GET_GMP_FROM_ZVAL(readobj);
+ gmpnum = GET_GMP_OBJECT_FROM_OBJ(readobj)->num;
ZVAL_LONG(writeobj, mpz_get_si(gmpnum));
return SUCCESS;
case IS_DOUBLE:
- gmpnum = GET_GMP_FROM_ZVAL(readobj);
+ gmpnum = GET_GMP_OBJECT_FROM_OBJ(readobj)->num;
ZVAL_DOUBLE(writeobj, mpz_get_d(gmpnum));
return SUCCESS;
case _IS_NUMBER:
- gmpnum = GET_GMP_FROM_ZVAL(readobj);
+ gmpnum = GET_GMP_OBJECT_FROM_OBJ(readobj)->num;
if (mpz_fits_slong_p(gmpnum)) {
ZVAL_LONG(writeobj, mpz_get_si(gmpnum));
} else {
@@ -438,10 +338,10 @@ static int gmp_cast_object(zval *readobj, zval *writeobj, int type) /* {{{ */
}
/* }}} */
-static HashTable *gmp_get_debug_info(zval *obj, int *is_temp) /* {{{ */
+static HashTable *gmp_get_debug_info(zend_object *obj, int *is_temp) /* {{{ */
{
HashTable *ht, *props = zend_std_get_properties(obj);
- mpz_ptr gmpnum = GET_GMP_FROM_ZVAL(obj);
+ mpz_ptr gmpnum = GET_GMP_OBJECT_FROM_OBJ(obj)->num;
zval zv;
*is_temp = 1;
@@ -454,10 +354,10 @@ static HashTable *gmp_get_debug_info(zval *obj, int *is_temp) /* {{{ */
}
/* }}} */
-static zend_object *gmp_clone_obj(zval *obj) /* {{{ */
+static zend_object *gmp_clone_obj(zend_object *obj) /* {{{ */
{
- gmp_object *old_object = GET_GMP_OBJECT_FROM_ZVAL(obj);
- gmp_object *new_object = GET_GMP_OBJECT_FROM_OBJ(gmp_create_object(Z_OBJCE_P(obj)));
+ gmp_object *old_object = GET_GMP_OBJECT_FROM_OBJ(obj);
+ gmp_object *new_object = GET_GMP_OBJECT_FROM_OBJ(gmp_create_object(obj->ce));
zend_objects_clone_members( &new_object->std, &old_object->std);
@@ -555,13 +455,15 @@ static int gmp_do_operation(zend_uchar opcode, zval *result, zval *op1, zval *op
}
/* }}} */
-static int gmp_compare(zval *result, zval *op1, zval *op2) /* {{{ */
+static int gmp_compare(zval *op1, zval *op2) /* {{{ */
{
- gmp_cmp(result, op1, op2);
- if (Z_TYPE_P(result) == IS_FALSE) {
- ZVAL_LONG(result, 1);
+ zval result;
+
+ gmp_cmp(&result, op1, op2);
+ if (Z_TYPE(result) == IS_FALSE) {
+ return 1;
}
- return SUCCESS;
+ return Z_LVAL(result);
}
/* }}} */
@@ -578,7 +480,7 @@ static int gmp_serialize(zval *object, unsigned char **buffer, size_t *buf_len,
php_var_serialize(&buf, &zv, &serialize_data);
zval_ptr_dtor_str(&zv);
- ZVAL_ARR(&zv, zend_std_get_properties(object));
+ ZVAL_ARR(&zv, zend_std_get_properties(Z_OBJ_P(object)));
php_var_serialize(&buf, &zv, &serialize_data);
PHP_VAR_SERIALIZE_DESTROY(serialize_data);
@@ -597,14 +499,12 @@ static int gmp_unserialize(zval *object, zend_class_entry *ce, const unsigned ch
zval *zv;
int retval = FAILURE;
php_unserialize_data_t unserialize_data;
- zval object_copy;
+ zend_object *zobj;
PHP_VAR_UNSERIALIZE_INIT(unserialize_data);
gmp_create(object, &gmpnum);
- /* The "object" variable may be modified during the execution of this unserialize handler
- * (it may turn into a reference). Keep the original object around for further operations. */
- ZVAL_OBJ(&object_copy, Z_OBJ_P(object));
+ zobj = Z_OBJ_P(object);
p = buf;
max = buf + buf_len;
@@ -628,7 +528,7 @@ static int gmp_unserialize(zval *object, zend_class_entry *ce, const unsigned ch
if (zend_hash_num_elements(Z_ARRVAL_P(zv)) != 0) {
zend_hash_copy(
- zend_std_get_properties(&object_copy), Z_ARRVAL_P(zv),
+ zend_std_get_properties(zobj), Z_ARRVAL_P(zv),
(copy_ctor_func_t) zval_add_ref
);
}
@@ -926,7 +826,7 @@ static inline void _gmp_binary_ui_op(INTERNAL_FUNCTION_PARAMETERS, gmp_binary_op
zval *a_arg, *b_arg;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &a_arg, &b_arg) == FAILURE){
- return;
+ RETURN_THROWS();
}
gmp_zval_binary_ui_op(return_value, a_arg, b_arg, gmp_op, gmp_ui_op, check_b_zero);
@@ -969,7 +869,7 @@ static inline void _gmp_unary_op(INTERNAL_FUNCTION_PARAMETERS, gmp_unary_op_t gm
zval *a_arg;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &a_arg) == FAILURE){
- return;
+ RETURN_THROWS();
}
gmp_zval_unary_op(return_value, a_arg, gmp_op);
@@ -985,7 +885,7 @@ static inline void _gmp_unary_opl(INTERNAL_FUNCTION_PARAMETERS, gmp_unary_opl_t
gmp_temp_t temp_a;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &a_arg) == FAILURE){
- return;
+ RETURN_THROWS();
}
FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a);
@@ -1003,7 +903,7 @@ static inline void _gmp_binary_opl(INTERNAL_FUNCTION_PARAMETERS, gmp_binary_opl_
gmp_temp_t temp_a, temp_b;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &a_arg, &b_arg) == FAILURE){
- return;
+ RETURN_THROWS();
}
FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a);
@@ -1025,7 +925,7 @@ ZEND_FUNCTION(gmp_init)
zend_long base = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|l", &number_arg, &base) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (base && (base < 2 || base > GMP_MAX_BASE)) {
@@ -1095,7 +995,7 @@ ZEND_FUNCTION(gmp_import)
mpz_ptr gmpnumber;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|ll", &data, &data_len, &size, &options) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (gmp_import_export_validate(size, options, &order, &endian) == FAILURE) {
@@ -1126,7 +1026,7 @@ ZEND_FUNCTION(gmp_export)
gmp_temp_t temp_a;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|ll", &gmpnumber_arg, &size, &options) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (gmp_import_export_validate(size, options, &order, &endian) == FAILURE) {
@@ -1159,7 +1059,7 @@ ZEND_FUNCTION(gmp_intval)
zval *gmpnumber_arg;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &gmpnumber_arg) == FAILURE){
- return;
+ RETURN_THROWS();
}
if (IS_GMP(gmpnumber_arg)) {
@@ -1180,7 +1080,7 @@ ZEND_FUNCTION(gmp_strval)
gmp_temp_t temp_a;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|l", &gmpnumber_arg, &base) == FAILURE) {
- return;
+ RETURN_THROWS();
}
/* Although the maximum base in general in GMP is 62, mpz_get_str()
@@ -1230,7 +1130,7 @@ ZEND_FUNCTION(gmp_div_qr)
zend_long round = GMP_ROUND_ZERO;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz|l", &a_arg, &b_arg, &round) == FAILURE) {
- return;
+ RETURN_THROWS();
}
switch (round) {
@@ -1258,7 +1158,7 @@ ZEND_FUNCTION(gmp_div_r)
zend_long round = GMP_ROUND_ZERO;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz|l", &a_arg, &b_arg, &round) == FAILURE) {
- return;
+ RETURN_THROWS();
}
switch (round) {
@@ -1286,7 +1186,7 @@ ZEND_FUNCTION(gmp_div_q)
zend_long round = GMP_ROUND_ZERO;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz|l", &a_arg, &b_arg, &round) == FAILURE) {
- return;
+ RETURN_THROWS();
}
switch (round) {
@@ -1346,7 +1246,7 @@ ZEND_FUNCTION(gmp_fact)
zval *a_arg;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &a_arg) == FAILURE){
- return;
+ RETURN_THROWS();
}
if (IS_GMP(a_arg)) {
@@ -1384,7 +1284,7 @@ ZEND_FUNCTION(gmp_binomial)
mpz_ptr gmpnum_result;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zl", &n_arg, &k) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (k < 0) {
@@ -1415,7 +1315,7 @@ ZEND_FUNCTION(gmp_pow)
zend_long exp;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zl", &base_arg, &exp) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (exp < 0) {
@@ -1446,7 +1346,7 @@ ZEND_FUNCTION(gmp_powm)
gmp_temp_t temp_base, temp_exp, temp_mod;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zzz", &base_arg, &exp_arg, &mod_arg) == FAILURE){
- return;
+ RETURN_THROWS();
}
FETCH_GMP_ZVAL(gmpnum_base, base_arg, temp_base);
@@ -1495,7 +1395,7 @@ ZEND_FUNCTION(gmp_sqrt)
gmp_temp_t temp_a;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &a_arg) == FAILURE){
- return;
+ RETURN_THROWS();
}
FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a);
@@ -1522,7 +1422,7 @@ ZEND_FUNCTION(gmp_sqrtrem)
zval result1, result2;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &a_arg) == FAILURE){
- return;
+ RETURN_THROWS();
}
FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a);
@@ -1555,7 +1455,7 @@ ZEND_FUNCTION(gmp_root)
gmp_temp_t temp_a;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zl", &a_arg, &nth) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (nth <= 0) {
@@ -1588,7 +1488,7 @@ ZEND_FUNCTION(gmp_rootrem)
zval result1, result2;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zl", &a_arg, &nth) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (nth <= 0) {
@@ -1634,7 +1534,7 @@ ZEND_FUNCTION(gmp_perfect_square)
gmp_temp_t temp_a;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &a_arg) == FAILURE){
- return;
+ RETURN_THROWS();
}
FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a);
@@ -1653,7 +1553,7 @@ ZEND_FUNCTION(gmp_perfect_power)
gmp_temp_t temp_a;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &a_arg) == FAILURE){
- return;
+ RETURN_THROWS();
}
FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a);
@@ -1673,7 +1573,7 @@ ZEND_FUNCTION(gmp_prob_prime)
gmp_temp_t temp_a;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|l", &gmpnumber_arg, &reps) == FAILURE) {
- return;
+ RETURN_THROWS();
}
FETCH_GMP_ZVAL(gmpnum_a, gmpnumber_arg, temp_a);
@@ -1709,7 +1609,7 @@ ZEND_FUNCTION(gmp_gcdext)
zval result_g, result_s, result_t;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &a_arg, &b_arg) == FAILURE){
- return;
+ RETURN_THROWS();
}
FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a);
@@ -1740,7 +1640,7 @@ ZEND_FUNCTION(gmp_invert)
int res;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &a_arg, &b_arg) == FAILURE){
- return;
+ RETURN_THROWS();
}
FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a);
@@ -1784,7 +1684,7 @@ ZEND_FUNCTION(gmp_kronecker)
int result;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &a_arg, &b_arg) == FAILURE){
- return;
+ RETURN_THROWS();
}
if (Z_TYPE_P(a_arg) == IS_LONG && Z_TYPE_P(b_arg) != IS_LONG) {
@@ -1824,7 +1724,7 @@ ZEND_FUNCTION(gmp_cmp)
zval *a_arg, *b_arg;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &a_arg, &b_arg) == FAILURE){
- return;
+ RETURN_THROWS();
}
gmp_cmp(return_value, a_arg, b_arg);
@@ -1841,7 +1741,7 @@ ZEND_FUNCTION(gmp_sign)
gmp_temp_t temp_a;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &a_arg) == FAILURE){
- return;
+ RETURN_THROWS();
}
FETCH_GMP_ZVAL(gmpnum_a, a_arg, temp_a);
@@ -1863,28 +1763,6 @@ static void gmp_init_random(void)
}
}
-/* {{{ proto GMP gmp_random([int limiter])
- Gets random number */
-ZEND_FUNCTION(gmp_random)
-{
- zend_long limiter = 20;
- mpz_ptr gmpnum_result;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &limiter) == FAILURE) {
- return;
- }
-
- INIT_GMP_RETVAL(gmpnum_result);
- gmp_init_random();
-
-#ifdef GMP_LIMB_BITS
- mpz_urandomb(gmpnum_result, GMPG(rand_state), GMP_ABS (limiter) * GMP_LIMB_BITS);
-#else
- mpz_urandomb(gmpnum_result, GMPG(rand_state), GMP_ABS (limiter) * __GMP_BITS_PER_MP_LIMB);
-#endif
-}
-/* }}} */
-
/* {{{ proto GMP gmp_random_seed(mixed seed)
Seed the RNG */
ZEND_FUNCTION(gmp_random_seed)
@@ -1893,7 +1771,7 @@ ZEND_FUNCTION(gmp_random_seed)
gmp_temp_t temp_a;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &seed) == FAILURE) {
- return;
+ RETURN_THROWS();
}
gmp_init_random();
@@ -1921,7 +1799,7 @@ ZEND_FUNCTION(gmp_random_bits)
mpz_ptr gmpnum_result;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &bits) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (bits <= 0) {
@@ -1946,7 +1824,7 @@ ZEND_FUNCTION(gmp_random_range)
gmp_temp_t temp_a, temp_b;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &min_arg, &max_arg) == FAILURE) {
- return;
+ RETURN_THROWS();
}
gmp_init_random();
@@ -2054,7 +1932,7 @@ ZEND_FUNCTION(gmp_setbit)
mpz_ptr gmpnum_a;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ol|b", &a_arg, gmp_ce, &index, &set) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (index < 0) {
@@ -2085,7 +1963,7 @@ ZEND_FUNCTION(gmp_clrbit)
mpz_ptr gmpnum_a;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ol", &a_arg, gmp_ce, &index) == FAILURE){
- return;
+ RETURN_THROWS();
}
if (index < 0) {
@@ -2108,7 +1986,7 @@ ZEND_FUNCTION(gmp_testbit)
gmp_temp_t temp_a;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zl", &a_arg, &index) == FAILURE){
- return;
+ RETURN_THROWS();
}
if (index < 0) {
@@ -2148,7 +2026,7 @@ ZEND_FUNCTION(gmp_scan0)
zend_long start;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zl", &a_arg, &start) == FAILURE){
- return;
+ RETURN_THROWS();
}
if (start < 0) {
@@ -2173,7 +2051,7 @@ ZEND_FUNCTION(gmp_scan1)
zend_long start;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zl", &a_arg, &start) == FAILURE){
- return;
+ RETURN_THROWS();
}
if (start < 0) {
diff --git a/ext/gmp/gmp.stub.php b/ext/gmp/gmp.stub.php
new file mode 100644
index 0000000000..7f576ca0c1
--- /dev/null
+++ b/ext/gmp/gmp.stub.php
@@ -0,0 +1,220 @@
+<?php
+
+/** @param int|bool|string $number */
+function gmp_init($number, int $base = 0): GMP|false {}
+
+function gmp_import(string $data, int $word_size = 1, int $options = GMP_MSW_FIRST | GMP_NATIVE_ENDIAN): GMP|false {}
+
+/** @param GMP|int|bool|string $gmpnumber */
+function gmp_export($gmpnumber, int $word_size = 1, int $options = GMP_MSW_FIRST | GMP_NATIVE_ENDIAN): string|false {}
+
+/** @param GMP|int|bool|string $gmpnumber */
+function gmp_intval($gmpnumber): int {}
+
+/** @param GMP|int|bool|string $gmpnumber */
+function gmp_strval($gmpnumber, int $base = 10): string|false {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @param GMP|int|bool|string $b
+ */
+function gmp_add($a, $b): GMP|false {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @param GMP|int|bool|string $b
+ */
+function gmp_sub($a, $b): GMP|false {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @param GMP|int|bool|string $b
+ */
+function gmp_mul($a, $b): GMP|false {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @param GMP|int|bool|string $b
+ */
+function gmp_div_qr($a, $b, int $round = GMP_ROUND_ZERO): array|false {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @param GMP|int|bool|string $b
+ */
+function gmp_div_q($a, $b, int $round = GMP_ROUND_ZERO): GMP|false {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @param GMP|int|bool|string $b
+ */
+function gmp_div_r($a, $b, int $round = GMP_ROUND_ZERO): GMP|false {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @param GMP|int|bool|string $b
+ */
+function gmp_div($a, $b, int $round = GMP_ROUND_ZERO): GMP|false {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @param GMP|int|bool|string $b
+ */
+function gmp_mod($a, $b): GMP|false {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @param GMP|int|bool|string $b
+ */
+function gmp_divexact($a, $b): GMP|false {}
+
+/** @param GMP|int|bool|string $a */
+function gmp_neg($a): GMP|false {}
+
+/** @param GMP|int|bool|string $a */
+function gmp_abs($a): GMP|false {}
+
+/** @param GMP|int $a */
+function gmp_fact($a): GMP|false {}
+
+/** @param GMP|int|bool|string $a */
+function gmp_sqrt($a): GMP|false {}
+
+/** @param GMP|int|bool|string $a */
+function gmp_sqrtrem($a): array|false {}
+
+/** @param GMP|int|bool|string $a **/
+function gmp_root($a, int $nth): GMP|false {}
+
+/** @param GMP|int|bool|string $a **/
+function gmp_rootrem($a, int $nth): array|false {}
+
+/** @param GMP|int|bool|string $base **/
+function gmp_pow($base, int $exp): GMP|false {}
+
+/**
+ * @param GMP|int|bool|string $base
+ * @param GMP|int|bool|string $exp
+ * @param GMP|int|bool|string $mod
+ **/
+function gmp_powm($base, $exp, $mod): GMP|false {}
+
+/** @param GMP|int|bool|string $a **/
+function gmp_perfect_square($a): bool {}
+
+/** @param GMP|int|bool|string $a **/
+function gmp_perfect_power($a): bool {}
+
+/** @param GMP|int|bool|string $a */
+function gmp_prob_prime($a, int $reps = 10): int|false {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @param GMP|int|bool|string $b
+ */
+function gmp_gcd($a, $b): GMP|false {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @param GMP|int|bool|string $b
+ */
+function gmp_gcdext($a, $b): array|false {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @param GMP|int|bool|string $b
+ */
+function gmp_lcm($a, $b): GMP|false {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @param GMP|int|bool|string $b
+ */
+function gmp_invert($a, $b): GMP|false {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @param GMP|int|bool|string $b
+ */
+function gmp_jacobi($a, $b): int|false {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @param GMP|int|bool|string $b
+ */
+function gmp_legendre($a, $b): int|false {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @param GMP|int|bool|string $b
+ */
+function gmp_kronecker($a, $b): int|false {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @param GMP|int|bool|string $b
+ */
+function gmp_cmp($a, $b): int|false {}
+
+/** @param GMP|int|bool|string $a */
+function gmp_sign($a): int|false {}
+
+/** @param GMP|int|bool|string $seed */
+function gmp_random_seed($seed): ?bool {}
+
+function gmp_random_bits(int $bits): GMP|false {}
+
+/**
+ * @param GMP|int|bool|string $min
+ * @param GMP|int|bool|string $max
+ **/
+function gmp_random_range($min, $max): GMP|false {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @param GMP|int|bool|string $b
+ */
+function gmp_and($a, $b): GMP|false {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @param GMP|int|bool|string $b
+ */
+function gmp_or($a, $b): GMP|false {}
+
+/** @param GMP|int|bool|string $a */
+function gmp_com($a): GMP|false {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @param GMP|int|bool|string $b
+ */
+function gmp_xor($a, $b): GMP|false {}
+
+function gmp_setbit(GMP $a, int $index, bool $set_clear = true): ?bool {}
+
+function gmp_clrbit(GMP $a, int $index): ?bool {}
+
+/** @param GMP|int|bool|string $a */
+function gmp_testbit($a, int $index): bool {}
+
+/** @param GMP|int|bool|string $a */
+function gmp_scan0($a, int $start): int|false {}
+
+/** @param GMP|int|bool|string $a */
+function gmp_scan1($a, int $start): int|false {}
+
+/** @param GMP|int|bool|string $a */
+function gmp_popcount($a): int|false {}
+
+/**
+ * @param GMP|int|bool|string $a
+ * @param GMP|int|bool|string $b
+ */
+function gmp_hamdist($a, $b): int|false {}
+
+/** @param GMP|int|bool|string $a */
+function gmp_nextprime($a): GMP|false {}
+
+/** @param GMP|int|bool|string $a */
+function gmp_binomial($a, int $b): GMP|false {}
diff --git a/ext/gmp/gmp_arginfo.h b/ext/gmp/gmp_arginfo.h
new file mode 100644
index 0000000000..714bd046e2
--- /dev/null
+++ b/ext/gmp/gmp_arginfo.h
@@ -0,0 +1,183 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_gmp_init, 0, 1, GMP, MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, number)
+ ZEND_ARG_TYPE_INFO(0, base, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_gmp_import, 0, 1, GMP, MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, word_size, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_gmp_export, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, gmpnumber)
+ ZEND_ARG_TYPE_INFO(0, word_size, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_gmp_intval, 0, 1, IS_LONG, 0)
+ ZEND_ARG_INFO(0, gmpnumber)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_gmp_strval, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, gmpnumber)
+ ZEND_ARG_TYPE_INFO(0, base, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_gmp_add, 0, 2, GMP, MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, a)
+ ZEND_ARG_INFO(0, b)
+ZEND_END_ARG_INFO()
+
+#define arginfo_gmp_sub arginfo_gmp_add
+
+#define arginfo_gmp_mul arginfo_gmp_add
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_gmp_div_qr, 0, 2, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, a)
+ ZEND_ARG_INFO(0, b)
+ ZEND_ARG_TYPE_INFO(0, round, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_gmp_div_q, 0, 2, GMP, MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, a)
+ ZEND_ARG_INFO(0, b)
+ ZEND_ARG_TYPE_INFO(0, round, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_gmp_div_r arginfo_gmp_div_q
+
+#define arginfo_gmp_div arginfo_gmp_div_q
+
+#define arginfo_gmp_mod arginfo_gmp_add
+
+#define arginfo_gmp_divexact arginfo_gmp_add
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_gmp_neg, 0, 1, GMP, MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, a)
+ZEND_END_ARG_INFO()
+
+#define arginfo_gmp_abs arginfo_gmp_neg
+
+#define arginfo_gmp_fact arginfo_gmp_neg
+
+#define arginfo_gmp_sqrt arginfo_gmp_neg
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_gmp_sqrtrem, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, a)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_gmp_root, 0, 2, GMP, MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, a)
+ ZEND_ARG_TYPE_INFO(0, nth, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_gmp_rootrem, 0, 2, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, a)
+ ZEND_ARG_TYPE_INFO(0, nth, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_gmp_pow, 0, 2, GMP, MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, base)
+ ZEND_ARG_TYPE_INFO(0, exp, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_gmp_powm, 0, 3, GMP, MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, base)
+ ZEND_ARG_INFO(0, exp)
+ ZEND_ARG_INFO(0, mod)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_gmp_perfect_square, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, a)
+ZEND_END_ARG_INFO()
+
+#define arginfo_gmp_perfect_power arginfo_gmp_perfect_square
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_gmp_prob_prime, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, a)
+ ZEND_ARG_TYPE_INFO(0, reps, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_gmp_gcd arginfo_gmp_add
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_gmp_gcdext, 0, 2, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, a)
+ ZEND_ARG_INFO(0, b)
+ZEND_END_ARG_INFO()
+
+#define arginfo_gmp_lcm arginfo_gmp_add
+
+#define arginfo_gmp_invert arginfo_gmp_add
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_gmp_jacobi, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, a)
+ ZEND_ARG_INFO(0, b)
+ZEND_END_ARG_INFO()
+
+#define arginfo_gmp_legendre arginfo_gmp_jacobi
+
+#define arginfo_gmp_kronecker arginfo_gmp_jacobi
+
+#define arginfo_gmp_cmp arginfo_gmp_jacobi
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_gmp_sign, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, a)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_gmp_random_seed, 0, 1, _IS_BOOL, 1)
+ ZEND_ARG_INFO(0, seed)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_gmp_random_bits, 0, 1, GMP, MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, bits, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_gmp_random_range, 0, 2, GMP, MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, min)
+ ZEND_ARG_INFO(0, max)
+ZEND_END_ARG_INFO()
+
+#define arginfo_gmp_and arginfo_gmp_add
+
+#define arginfo_gmp_or arginfo_gmp_add
+
+#define arginfo_gmp_com arginfo_gmp_neg
+
+#define arginfo_gmp_xor arginfo_gmp_add
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_gmp_setbit, 0, 2, _IS_BOOL, 1)
+ ZEND_ARG_OBJ_INFO(0, a, GMP, 0)
+ ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, set_clear, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_gmp_clrbit, 0, 2, _IS_BOOL, 1)
+ ZEND_ARG_OBJ_INFO(0, a, GMP, 0)
+ ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_gmp_testbit, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, a)
+ ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_gmp_scan0, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, a)
+ ZEND_ARG_TYPE_INFO(0, start, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_gmp_scan1 arginfo_gmp_scan0
+
+#define arginfo_gmp_popcount arginfo_gmp_sign
+
+#define arginfo_gmp_hamdist arginfo_gmp_jacobi
+
+#define arginfo_gmp_nextprime arginfo_gmp_neg
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_gmp_binomial, 0, 2, GMP, MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, a)
+ ZEND_ARG_TYPE_INFO(0, b, IS_LONG, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/gmp/php_gmp.h b/ext/gmp/php_gmp.h
index 6994814b06..5f2456e989 100644
--- a/ext/gmp/php_gmp.h
+++ b/ext/gmp/php_gmp.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/gmp/tests/003.phpt b/ext/gmp/tests/003.phpt
index 5179b73a1b..49b69c7d3a 100644
--- a/ext/gmp/tests/003.phpt
+++ b/ext/gmp/tests/003.phpt
@@ -20,7 +20,7 @@ Check for number base recognition
$test[] = gmp_init("1234");
$test[] = gmp_init("1234", 10);
- /* Hexidecimal */
+ /* Hexadecimal */
$test[] = gmp_init("0x4d2");
$test[] = gmp_init("0x4d2", 16);
$test[] = gmp_init("4d2");
diff --git a/ext/gmp/tests/bug52906.phpt b/ext/gmp/tests/bug52906.phpt
index e00080d7ab..7172ec3b4e 100644
--- a/ext/gmp/tests/bug52906.phpt
+++ b/ext/gmp/tests/bug52906.phpt
@@ -6,21 +6,21 @@ Bug #52906 gmp_mod returns negative result when non-negative is expected
<?php
$vals = array(
- array(7, 3),
- array(2, 7),
- array(12, 7),
- array(-2, 7),
- array(-12, 7),
- array(2, -7),
- array(12, -7),
- array(-2, -7),
- array(-12, -7),
+ array(7, 3),
+ array(2, 7),
+ array(12, 7),
+ array(-2, 7),
+ array(-12, 7),
+ array(2, -7),
+ array(12, -7),
+ array(-2, -7),
+ array(-12, -7),
);
foreach($vals as $data) {
- echo "{$data[0]}%{$data[1]}=".gmp_strval(gmp_mod($data[0], $data[1]));
- echo "\n";
- echo "{$data[0]}%{$data[1]}=".gmp_strval(gmp_mod(gmp_init($data[0]), gmp_init($data[1])));
- echo "\n";
+ echo "{$data[0]}%{$data[1]}=".gmp_strval(gmp_mod($data[0], $data[1]));
+ echo "\n";
+ echo "{$data[0]}%{$data[1]}=".gmp_strval(gmp_mod(gmp_init($data[0]), gmp_init($data[1])));
+ echo "\n";
}
echo "Done\n";
?>
diff --git a/ext/gmp/tests/bug70284.phpt b/ext/gmp/tests/bug70284.phpt
index 49df5d0359..7dd2e37512 100644
--- a/ext/gmp/tests/bug70284.phpt
+++ b/ext/gmp/tests/bug70284.phpt
@@ -18,7 +18,7 @@ $fakezval .= "\x00";
$fakezval .= "\x00\x00";
for ($i = 0; $i < 5; $i++) {
- $v[$i] = $fakezval.$i;
+ $v[$i] = $fakezval.$i;
}
var_dump($data);
@@ -26,11 +26,11 @@ var_dump($data);
function ptr2str($ptr)
{
$out = '';
- for ($i = 0; $i < 8; $i++) {
- $out .= chr($ptr & 0xff);
- $ptr >>= 8;
- }
- return $out;
+ for ($i = 0; $i < 8; $i++) {
+ $out .= chr($ptr & 0xff);
+ $ptr >>= 8;
+ }
+ return $out;
}
?>
--EXPECTF--
diff --git a/ext/gmp/tests/gmp_abs.phpt b/ext/gmp/tests/gmp_abs.phpt
index 811ab3d5ee..236acc4684 100644
--- a/ext/gmp/tests/gmp_abs.phpt
+++ b/ext/gmp/tests/gmp_abs.phpt
@@ -15,8 +15,6 @@ var_dump(gmp_strval(gmp_abs("0000")));
var_dump(gmp_strval(gmp_abs("09876543")));
var_dump(gmp_strval(gmp_abs("-099987654")));
-var_dump(gmp_abs());
-var_dump(gmp_abs(1,2));
var_dump(gmp_abs(array()));
echo "Done\n";
@@ -39,12 +37,6 @@ string(1) "0"
Warning: gmp_abs(): Unable to convert variable to GMP - string is not an integer in %s on line %d
string(1) "0"
-Warning: gmp_abs() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: gmp_abs() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
Warning: gmp_abs(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
Done
diff --git a/ext/gmp/tests/gmp_and.phpt b/ext/gmp/tests/gmp_and.phpt
index 2fb27c3e70..b582a6b480 100644
--- a/ext/gmp/tests/gmp_and.phpt
+++ b/ext/gmp/tests/gmp_and.phpt
@@ -17,8 +17,6 @@ var_dump(gmp_strval(gmp_and($n, "34332")));
$n1 = gmp_init("987657878765436543456");
var_dump(gmp_strval(gmp_and($n, $n1)));
-var_dump(gmp_and($n, $n1, 1));
-var_dump(gmp_and(1));
var_dump(gmp_and(array(), 1));
var_dump(gmp_and(1, array()));
var_dump(gmp_and(array(), array()));
@@ -37,12 +35,6 @@ string(1) "0"
string(4) "1536"
string(15) "424703623692768"
-Warning: gmp_and() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-Warning: gmp_and() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
Warning: gmp_and(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
diff --git a/ext/gmp/tests/gmp_clrbit.phpt b/ext/gmp/tests/gmp_clrbit.phpt
index 0aab89dd37..255b9947b9 100644
--- a/ext/gmp/tests/gmp_clrbit.phpt
+++ b/ext/gmp/tests/gmp_clrbit.phpt
@@ -28,10 +28,11 @@ gmp_clrbit($n, 20);
var_dump(gmp_strval($n));
$n = array();
-gmp_clrbit($n, 3);
-gmp_clrbit($n, 3, 1);
-gmp_clrbit($n);
-gmp_clrbit();
+try {
+ gmp_clrbit($n, 3);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done\n";
?>
@@ -46,12 +47,5 @@ Warning: gmp_clrbit(): Index must be greater than or equal to zero in %s on line
string(7) "1000000"
string(7) "1000000"
string(30) "238462734628347239571822592658"
-
-Warning: gmp_clrbit() expects parameter 1 to be GMP, array given in %s on line %d
-
-Warning: gmp_clrbit() expects exactly 2 parameters, 3 given in %s on line %d
-
-Warning: gmp_clrbit() expects exactly 2 parameters, 1 given in %s on line %d
-
-Warning: gmp_clrbit() expects exactly 2 parameters, 0 given in %s on line %d
+gmp_clrbit() expects parameter 1 to be GMP, array given
Done
diff --git a/ext/gmp/tests/gmp_cmp.phpt b/ext/gmp/tests/gmp_cmp.phpt
index 2e48d3b83b..4748e7db87 100644
--- a/ext/gmp/tests/gmp_cmp.phpt
+++ b/ext/gmp/tests/gmp_cmp.phpt
@@ -17,10 +17,7 @@ var_dump(gmp_cmp(0,$n) < 0);
$n1 = gmp_init("827278512385463739");
var_dump(gmp_cmp($n1,$n));
-var_dump(gmp_cmp($n1,$n,1));
var_dump(gmp_cmp(array(),array()));
-var_dump(gmp_cmp(array()));
-var_dump(gmp_cmp());
echo "Done\n";
?>
@@ -34,15 +31,6 @@ int(-1)
bool(true)
int(0)
-Warning: gmp_cmp() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
Warning: gmp_cmp(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
-
-Warning: gmp_cmp() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: gmp_cmp() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
Done
diff --git a/ext/gmp/tests/gmp_com.phpt b/ext/gmp/tests/gmp_com.phpt
index ae6ec59200..97299dd064 100644
--- a/ext/gmp/tests/gmp_com.phpt
+++ b/ext/gmp/tests/gmp_com.phpt
@@ -19,7 +19,6 @@ $n = gmp_init("98765463337");
var_dump(gmp_strval(gmp_com($n)));
var_dump(gmp_strval(gmp_com(array())));
-var_dump(gmp_strval(gmp_com()));
echo "Done\n";
?>
@@ -38,9 +37,4 @@ string(12) "-98765463338"
Warning: gmp_com(): Unable to convert variable to GMP - wrong type in %s on line %d
string(1) "0"
-
-Warning: gmp_com() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: gmp_strval(): Unable to convert variable to GMP - wrong type in %s on line %d
-bool(false)
Done
diff --git a/ext/gmp/tests/gmp_div_q.phpt b/ext/gmp/tests/gmp_div_q.phpt
index afc64c3547..9fd94efdac 100644
--- a/ext/gmp/tests/gmp_div_q.phpt
+++ b/ext/gmp/tests/gmp_div_q.phpt
@@ -5,9 +5,6 @@ gmp_div_q() tests
--FILE--
<?php
-var_dump(gmp_div_q());
-var_dump(gmp_div_q(""));
-
var_dump(gmp_div_q(0,1));
var_dump(gmp_div_q(1,0));
var_dump(gmp_div_q(12653,23482734));
@@ -27,11 +24,6 @@ var_dump(gmp_div_q(array(), array()));
echo "Done\n";
?>
--EXPECTF--
-Warning: gmp_div_q() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: gmp_div_q() expects at least 2 parameters, 1 given in %s on line %d
-NULL
object(GMP)#%d (1) {
["num"]=>
string(1) "0"
diff --git a/ext/gmp/tests/gmp_div_qr.phpt b/ext/gmp/tests/gmp_div_qr.phpt
index 936fbc6ef1..373beb5701 100644
--- a/ext/gmp/tests/gmp_div_qr.phpt
+++ b/ext/gmp/tests/gmp_div_qr.phpt
@@ -5,9 +5,6 @@ gmp_div_qr() tests
--FILE--
<?php
-var_dump(gmp_div_qr());
-var_dump(gmp_div_qr(""));
-
var_dump(gmp_div_qr(0,1));
var_dump(gmp_div_qr(1,0));
var_dump(gmp_div_qr(gmp_init(1), gmp_init(0)));
@@ -29,11 +26,6 @@ var_dump(gmp_div_qr(array(), array()));
echo "Done\n";
?>
--EXPECTF--
-Warning: gmp_div_qr() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: gmp_div_qr() expects at least 2 parameters, 1 given in %s on line %d
-NULL
array(2) {
[0]=>
object(GMP)#%d (1) {
diff --git a/ext/gmp/tests/gmp_div_r.phpt b/ext/gmp/tests/gmp_div_r.phpt
index bab243e465..2b19ed1f48 100644
--- a/ext/gmp/tests/gmp_div_r.phpt
+++ b/ext/gmp/tests/gmp_div_r.phpt
@@ -5,9 +5,6 @@ gmp_div_r() tests
--FILE--
<?php
-var_dump(gmp_div_r());
-var_dump(gmp_div_r(""));
-
var_dump($r = gmp_div_r(0,1));
var_dump($r = gmp_div_r(1,0));
var_dump($r = gmp_div_r(12653,23482734));
@@ -27,11 +24,6 @@ var_dump(gmp_div_r(array(), array()));
echo "Done\n";
?>
--EXPECTF--
-Warning: gmp_div_r() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: gmp_div_r() expects at least 2 parameters, 1 given in %s on line %d
-NULL
object(GMP)#%d (1) {
["num"]=>
string(1) "0"
diff --git a/ext/gmp/tests/gmp_divexact.phpt b/ext/gmp/tests/gmp_divexact.phpt
index 53f0c677ab..c6183cb734 100644
--- a/ext/gmp/tests/gmp_divexact.phpt
+++ b/ext/gmp/tests/gmp_divexact.phpt
@@ -10,9 +10,6 @@ if (!defined('GMP_VERSION') || version_compare("4.2.1", GMP_VERSION, ">=")) {
--FILE--
<?php
-var_dump(gmp_divexact(1, 1, 1));
-var_dump(gmp_divexact());
-
$r = gmp_divexact("233", "23345555555555555555555555");
var_dump(gmp_strval($r));
@@ -39,11 +36,6 @@ var_dump(gmp_strval($r));
echo "Done\n";
?>
--EXPECTF--
-Warning: gmp_divexact() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-Warning: gmp_divexact() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
string(1) "0"
Warning: gmp_divexact(): Zero operand not allowed in %s on line %d
diff --git a/ext/gmp/tests/gmp_export.phpt b/ext/gmp/tests/gmp_export.phpt
index 52449ecf0a..bbc26d086c 100644
--- a/ext/gmp/tests/gmp_export.phpt
+++ b/ext/gmp/tests/gmp_export.phpt
@@ -50,9 +50,6 @@ foreach ($export as $k => $test) {
var_dump($passed);
-// Invalid arguments (zpp failure)
-var_dump(gmp_export());
-
// Invalid word sizes
var_dump(gmp_export(123, -1));
var_dump(gmp_export(123, 0));
@@ -63,9 +60,6 @@ var_dump(gmp_export(123, 1, GMP_BIG_ENDIAN | GMP_LITTLE_ENDIAN));
--EXPECTF--
bool(true)
-Warning: gmp_export() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
Warning: gmp_export(): Word size must be positive, -1 given in %s on line %d
bool(false)
diff --git a/ext/gmp/tests/gmp_fact.phpt b/ext/gmp/tests/gmp_fact.phpt
index 032f735435..d861fae40e 100644
--- a/ext/gmp/tests/gmp_fact.phpt
+++ b/ext/gmp/tests/gmp_fact.phpt
@@ -21,8 +21,6 @@ var_dump(gmp_strval(gmp_fact($n)));
$n = gmp_init(-10);
var_dump(gmp_strval(gmp_fact($n)));
-var_dump(gmp_fact());
-var_dump(gmp_fact(1,1));
var_dump(gmp_fact(array()));
var_dump(gmp_strval(gmp_fact(array())));
@@ -50,12 +48,6 @@ string(9) "479001600"
Warning: gmp_fact(): Number has to be greater than or equal to 0 in %s on line %d
string(1) "0"
-Warning: gmp_fact() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: gmp_fact() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
Warning: gmp_fact(): Number has to be an integer in %s on line %d
object(GMP)#%d (1) {
["num"]=>
diff --git a/ext/gmp/tests/gmp_gcd.phpt b/ext/gmp/tests/gmp_gcd.phpt
index cf4eac9e92..4e130a1fd9 100644
--- a/ext/gmp/tests/gmp_gcd.phpt
+++ b/ext/gmp/tests/gmp_gcd.phpt
@@ -21,13 +21,10 @@ $n = gmp_init("8127346234");
var_dump(gmp_strval(gmp_gcd($n,$n)));
$n = gmp_init("8127346234");
var_dump(gmp_strval(gmp_gcd($n,0)));
-var_dump(gmp_gcd($n,$n,1));
-var_dump(gmp_gcd($n,array(),1));
-var_dump(gmp_gcd(array(),$n,1));
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
string(1) "3"
string(5) "12387"
string(3) "224"
@@ -39,13 +36,4 @@ string(1) "2"
string(1) "1"
string(10) "8127346234"
string(10) "8127346234"
-
-Warning: gmp_gcd() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-Warning: gmp_gcd() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-Warning: gmp_gcd() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
Done
diff --git a/ext/gmp/tests/gmp_gcdext.phpt b/ext/gmp/tests/gmp_gcdext.phpt
index 4adecf25d2..9a923fcd4e 100644
--- a/ext/gmp/tests/gmp_gcdext.phpt
+++ b/ext/gmp/tests/gmp_gcdext.phpt
@@ -10,30 +10,27 @@ $n = gmp_init("34293864345");
$n1 = gmp_init("23434293864345");
$a = array(
- array(123,45),
- array(4341,9734),
- array(23487,333),
- array(-234234,-123123),
- array(-100,-2234),
- array(345,"34587345"),
- array(345,"0"),
- array("345556456",345873),
- array("34545345556456","323432445873"),
- array($n, $n1),
- );
+ array(123,45),
+ array(4341,9734),
+ array(23487,333),
+ array(-234234,-123123),
+ array(-100,-2234),
+ array(345,"34587345"),
+ array(345,"0"),
+ array("345556456",345873),
+ array("34545345556456","323432445873"),
+ array($n, $n1),
+ );
foreach ($a as $val) {
- $r = gmp_gcdext($val[0],$val[1]);
- $check = gmp_add(gmp_mul($val[0],$r['s']), gmp_mul($val[1],$r['t']));
- var_dump(gmp_strval($r['g']));
- var_dump(gmp_strval($check));
+ $r = gmp_gcdext($val[0],$val[1]);
+ $check = gmp_add(gmp_mul($val[0],$r['s']), gmp_mul($val[1],$r['t']));
+ var_dump(gmp_strval($r['g']));
+ var_dump(gmp_strval($check));
}
var_dump(gmp_gcdext($val[0],array()));
var_dump(gmp_gcdext(array(),array()));
-var_dump(gmp_gcdext(array(),array(),1));
-var_dump(gmp_gcdext(array()));
-var_dump(gmp_gcdext());
echo "Done\n";
?>
@@ -64,13 +61,4 @@ bool(false)
Warning: gmp_gcdext(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
-
-Warning: gmp_gcdext() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-Warning: gmp_gcdext() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: gmp_gcdext() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
Done
diff --git a/ext/gmp/tests/gmp_hamdist.phpt b/ext/gmp/tests/gmp_hamdist.phpt
index 60ef89f84d..7057c5f32a 100644
--- a/ext/gmp/tests/gmp_hamdist.phpt
+++ b/ext/gmp/tests/gmp_hamdist.phpt
@@ -16,11 +16,9 @@ var_dump(gmp_hamdist($n, "8333765434567897654333334567"));
var_dump(gmp_hamdist($n, $n));
var_dump(gmp_hamdist($n, $n1));
-var_dump(gmp_hamdist($n, $n1, 1));
var_dump(gmp_hamdist($n, array()));
var_dump(gmp_hamdist(array(), $n));
var_dump(gmp_hamdist(array(), array()));
-var_dump(gmp_hamdist());
echo "Done\n";
?>
@@ -33,9 +31,6 @@ int(43)
int(0)
int(26)
-Warning: gmp_hamdist() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
Warning: gmp_hamdist(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
@@ -44,7 +39,4 @@ bool(false)
Warning: gmp_hamdist(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
-
-Warning: gmp_hamdist() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
Done
diff --git a/ext/gmp/tests/gmp_import.phpt b/ext/gmp/tests/gmp_import.phpt
index a9e9314483..b3c4e0154a 100644
--- a/ext/gmp/tests/gmp_import.phpt
+++ b/ext/gmp/tests/gmp_import.phpt
@@ -47,9 +47,6 @@ foreach ($import as $k => $test) {
var_dump($passed);
-// Invalid arguments (zpp failure)
-var_dump(gmp_import());
-
// Invalid word sizes
var_dump(gmp_import('a', -1));
var_dump(gmp_import('a', 0));
@@ -65,9 +62,6 @@ var_dump(gmp_import('a', 1, GMP_BIG_ENDIAN | GMP_LITTLE_ENDIAN));
--EXPECTF--
bool(true)
-Warning: gmp_import() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
Warning: gmp_import(): Word size must be positive, -1 given in %s on line %d
bool(false)
diff --git a/ext/gmp/tests/gmp_init.phpt b/ext/gmp/tests/gmp_init.phpt
index a35f12345c..7da7c8e55e 100644
--- a/ext/gmp/tests/gmp_init.phpt
+++ b/ext/gmp/tests/gmp_init.phpt
@@ -7,9 +7,6 @@ gmp_init() basic tests
var_dump(gmp_init("98765678"));
var_dump(gmp_strval(gmp_init("98765678")));
-var_dump(gmp_strval(gmp_init()));
-var_dump(gmp_init());
-var_dump(gmp_init(1,2,3,4));
var_dump(gmp_init(1,-1));
var_dump(gmp_init("",36));
var_dump(gmp_init("foo",3));
@@ -24,17 +21,6 @@ object(GMP)#%d (1) {
}
string(8) "98765678"
-Warning: gmp_init() expects at least 1 parameter, 0 given in %s on line %d
-
-Warning: gmp_strval(): Unable to convert variable to GMP - wrong type in %s on line %d
-bool(false)
-
-Warning: gmp_init() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: gmp_init() expects at most 2 parameters, 4 given in %s on line %d
-NULL
-
Warning: gmp_init(): Bad base for conversion: -1 (should be between 2 and %d) in %s on line %d
bool(false)
diff --git a/ext/gmp/tests/gmp_intval.phpt b/ext/gmp/tests/gmp_intval.phpt
index f30b391573..019ab3d070 100644
--- a/ext/gmp/tests/gmp_intval.phpt
+++ b/ext/gmp/tests/gmp_intval.phpt
@@ -5,7 +5,6 @@ gmp_intval() tests
--FILE--
<?php
-var_dump(gmp_intval(1,1));
var_dump(gmp_intval(""));
var_dump(gmp_intval(1.0001));
var_dump(gmp_intval("1.0001"));
@@ -25,8 +24,6 @@ var_dump(gmp_intval($g));
echo "Done\n";
?>
--EXPECTF--
-Warning: gmp_intval() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
int(0)
int(1)
int(1)
diff --git a/ext/gmp/tests/gmp_invert.phpt b/ext/gmp/tests/gmp_invert.phpt
index 8c1d7c577c..40793afd53 100644
--- a/ext/gmp/tests/gmp_invert.phpt
+++ b/ext/gmp/tests/gmp_invert.phpt
@@ -19,8 +19,6 @@ $n1 = gmp_init("3498273496234234523451");
var_dump(gmp_strval(gmp_invert($n, $n1)));
var_dump(gmp_strval(gmp_invert($n1, $n)));
-var_dump(gmp_invert($n1, $n, 10));
-var_dump(gmp_invert($n1));
var_dump(gmp_invert(array(), 1));
var_dump(gmp_invert(1, array()));
var_dump(gmp_invert(array(), array()));
@@ -38,12 +36,6 @@ string(1) "0"
string(22) "3498273496234234523441"
string(1) "1"
-Warning: gmp_invert() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-Warning: gmp_invert() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
Warning: gmp_invert(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
diff --git a/ext/gmp/tests/gmp_jacobi.phpt b/ext/gmp/tests/gmp_jacobi.phpt
index da92b87401..adf3f6a0b2 100644
--- a/ext/gmp/tests/gmp_jacobi.phpt
+++ b/ext/gmp/tests/gmp_jacobi.phpt
@@ -6,7 +6,7 @@ gmp_jacobi() basic tests
<?php
for ($i = -1; $i < 10; $i++) {
- var_dump(gmp_strval(gmp_jacobi(($i*$i)-1, 3)));
+ var_dump(gmp_strval(gmp_jacobi(($i*$i)-1, 3)));
}
var_dump(gmp_strval(gmp_jacobi(7, 23)));
@@ -24,10 +24,6 @@ var_dump(gmp_jacobi(3, array()));
var_dump(gmp_jacobi(array(), 3));
var_dump(gmp_jacobi(array(), array()));
-var_dump(gmp_jacobi(array(), array(), 1));
-var_dump(gmp_jacobi(array()));
-var_dump(gmp_jacobi());
-
echo "Done\n";
?>
--EXPECTF--
@@ -57,13 +53,4 @@ bool(false)
Warning: gmp_jacobi(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
-
-Warning: gmp_jacobi() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-Warning: gmp_jacobi() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: gmp_jacobi() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
Done
diff --git a/ext/gmp/tests/gmp_legendre.phpt b/ext/gmp/tests/gmp_legendre.phpt
index 71191e133d..ac51ad3da4 100644
--- a/ext/gmp/tests/gmp_legendre.phpt
+++ b/ext/gmp/tests/gmp_legendre.phpt
@@ -6,7 +6,7 @@ gmp_legendre() basic tests
<?php
for ($i = -1; $i < 10; $i++) {
- var_dump(gmp_strval(gmp_legendre(($i*$i)-1, 3)));
+ var_dump(gmp_strval(gmp_legendre(($i*$i)-1, 3)));
}
var_dump(gmp_strval(gmp_legendre(7, 23)));
@@ -24,10 +24,6 @@ var_dump(gmp_legendre(3, array()));
var_dump(gmp_legendre(array(), 3));
var_dump(gmp_legendre(array(), array()));
-var_dump(gmp_legendre(array(), array(), 1));
-var_dump(gmp_legendre(array()));
-var_dump(gmp_legendre());
-
echo "Done\n";
?>
--EXPECTF--
@@ -57,13 +53,4 @@ bool(false)
Warning: gmp_legendre(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
-
-Warning: gmp_legendre() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-Warning: gmp_legendre() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: gmp_legendre() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
Done
diff --git a/ext/gmp/tests/gmp_mod.phpt b/ext/gmp/tests/gmp_mod.phpt
index 4f216965c9..135c2ca11c 100644
--- a/ext/gmp/tests/gmp_mod.phpt
+++ b/ext/gmp/tests/gmp_mod.phpt
@@ -5,8 +5,6 @@ gmp_mod tests()
--FILE--
<?php
-var_dump(gmp_mod());
-var_dump(gmp_mod(""));
var_dump(gmp_mod("",""));
var_dump(gmp_mod(0,1));
var_dump(gmp_mod(0,-1));
@@ -22,12 +20,6 @@ var_dump(gmp_mod($a, $b));
echo "Done\n";
?>
--EXPECTF--
-Warning: gmp_mod() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: gmp_mod() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
Warning: gmp_mod(): Unable to convert variable to GMP - string is not an integer in %s on line %d
bool(false)
object(GMP)#%d (1) {
diff --git a/ext/gmp/tests/gmp_neg.phpt b/ext/gmp/tests/gmp_neg.phpt
index c457fa6574..777de69105 100644
--- a/ext/gmp/tests/gmp_neg.phpt
+++ b/ext/gmp/tests/gmp_neg.phpt
@@ -17,8 +17,6 @@ var_dump(gmp_intval(gmp_neg($n)));
$n = gmp_init("12345678901234567890");
var_dump(gmp_strval(gmp_neg($n)));
-var_dump(gmp_neg(1,1));
-var_dump(gmp_neg());
var_dump(gmp_neg(array()));
echo "Done\n";
@@ -35,12 +33,6 @@ int(0)
int(0)
string(21) "-12345678901234567890"
-Warning: gmp_neg() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: gmp_neg() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
Warning: gmp_neg(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
Done
diff --git a/ext/gmp/tests/gmp_or.phpt b/ext/gmp/tests/gmp_or.phpt
index ef486df8e9..affd6ae5b8 100644
--- a/ext/gmp/tests/gmp_or.phpt
+++ b/ext/gmp/tests/gmp_or.phpt
@@ -17,8 +17,6 @@ var_dump(gmp_strval(gmp_or($n, "34332")));
$n1 = gmp_init("987657878765436543456");
var_dump(gmp_strval(gmp_or($n, $n1)));
-var_dump(gmp_or($n, $n1, 1));
-var_dump(gmp_or(1));
var_dump(gmp_or(array(), 1));
var_dump(gmp_or(1, array()));
var_dump(gmp_or(array(), array()));
@@ -37,12 +35,6 @@ string(1) "0"
string(15) "987657876576252"
string(21) "987658441719689394144"
-Warning: gmp_or() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-Warning: gmp_or() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
Warning: gmp_or(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
diff --git a/ext/gmp/tests/gmp_perfect_square.phpt b/ext/gmp/tests/gmp_perfect_square.phpt
index 0f519c7b79..b477910378 100644
--- a/ext/gmp/tests/gmp_perfect_square.phpt
+++ b/ext/gmp/tests/gmp_perfect_square.phpt
@@ -21,7 +21,6 @@ var_dump(gmp_perfect_square($n));
$n = gmp_init(-5);
var_dump(gmp_perfect_square($n));
-var_dump(gmp_perfect_square());
var_dump(gmp_perfect_square(array()));
echo "Done\n";
@@ -39,9 +38,6 @@ bool(false)
bool(true)
bool(false)
-Warning: gmp_perfect_square() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
Warning: gmp_perfect_square(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
Done
diff --git a/ext/gmp/tests/gmp_popcount.phpt b/ext/gmp/tests/gmp_popcount.phpt
index 26a7b5af8d..76dc2a89c0 100644
--- a/ext/gmp/tests/gmp_popcount.phpt
+++ b/ext/gmp/tests/gmp_popcount.phpt
@@ -13,7 +13,6 @@ var_dump(gmp_popcount("-23476123423433"));
$n = gmp_init("9876546789222");
var_dump(gmp_popcount($n));
var_dump(gmp_popcount(array()));
-var_dump(gmp_popcount());
echo "Done\n";
?>
@@ -27,7 +26,4 @@ int(20)
Warning: gmp_popcount(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
-
-Warning: gmp_popcount() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
Done
diff --git a/ext/gmp/tests/gmp_pow.phpt b/ext/gmp/tests/gmp_pow.phpt
index 5424d410a0..e9525867e1 100644
--- a/ext/gmp/tests/gmp_pow.phpt
+++ b/ext/gmp/tests/gmp_pow.phpt
@@ -21,11 +21,11 @@ var_dump(gmp_strval(gmp_pow($n,10)));
$n = gmp_init("-20");
var_dump(gmp_strval(gmp_pow($n,10)));
-var_dump(gmp_pow(2,10,1));
-var_dump(gmp_pow(2));
-var_dump(gmp_pow());
-var_dump(gmp_pow(array(), array()));
-var_dump(gmp_pow(2,array()));
+try {
+ var_dump(gmp_pow(2,array()));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump(gmp_pow(array(),10));
echo "Done\n";
@@ -47,21 +47,7 @@ Warning: gmp_pow(): Negative exponent not supported in %s on line %d
string(1) "0"
string(14) "10240000000000"
string(14) "10240000000000"
-
-Warning: gmp_pow() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-Warning: gmp_pow() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: gmp_pow() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: gmp_pow() expects parameter 2 to be int, array given in %s on line %d
-NULL
-
-Warning: gmp_pow() expects parameter 2 to be int, array given in %s on line %d
-NULL
+gmp_pow() expects parameter 2 to be int, array given
Warning: gmp_pow(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
diff --git a/ext/gmp/tests/gmp_pown.phpt b/ext/gmp/tests/gmp_pown.phpt
index b732aa331f..9a5b5deb11 100644
--- a/ext/gmp/tests/gmp_pown.phpt
+++ b/ext/gmp/tests/gmp_pown.phpt
@@ -26,9 +26,6 @@ var_dump(gmp_powm(array(),$e,$m));
var_dump(gmp_powm($n,array(),$m));
var_dump(gmp_powm($n,$e,array()));
var_dump(gmp_powm(array(),array(),array()));
-var_dump(gmp_powm(array(),array()));
-var_dump(gmp_powm(array()));
-var_dump(gmp_powm());
$n = gmp_init("-5");
var_dump(gmp_powm(10, $n, 10));
@@ -67,15 +64,6 @@ bool(false)
Warning: gmp_powm(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
-Warning: gmp_powm() expects exactly 3 parameters, 2 given in %s on line %d
-NULL
-
-Warning: gmp_powm() expects exactly 3 parameters, 1 given in %s on line %d
-NULL
-
-Warning: gmp_powm() expects exactly 3 parameters, 0 given in %s on line %d
-NULL
-
Warning: gmp_powm(): Second parameter cannot be less than 0 in %s on line %d
bool(false)
object(GMP)#%d (1) {
diff --git a/ext/gmp/tests/gmp_prob_prime.phpt b/ext/gmp/tests/gmp_prob_prime.phpt
index 99735bd7c0..3b05a0215f 100644
--- a/ext/gmp/tests/gmp_prob_prime.phpt
+++ b/ext/gmp/tests/gmp_prob_prime.phpt
@@ -18,9 +18,9 @@ var_dump(gmp_prob_prime(-31));
var_dump(gmp_prob_prime("172368715471481723"));
for ($i = -1; $i < 12; $i++) {
- var_dump(gmp_prob_prime((773*$i)-($i*7)-1, $i));
- $n = gmp_init("23476812735411");
- var_dump(gmp_prob_prime(gmp_add($n, $i-1), $i));
+ var_dump(gmp_prob_prime((773*$i)-($i*7)-1, $i));
+ $n = gmp_init("23476812735411");
+ var_dump(gmp_prob_prime(gmp_add($n, $i-1), $i));
}
$n = gmp_init("19481923");
@@ -28,7 +28,6 @@ var_dump(gmp_prob_prime($n));
$n = gmp_init(0);
var_dump(gmp_prob_prime($n));
-var_dump(gmp_prob_prime());
var_dump(gmp_prob_prime(array()));
echo "Done\n";
@@ -73,9 +72,6 @@ int(0)
int(0)
int(0)
-Warning: gmp_prob_prime() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
Warning: gmp_prob_prime(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
Done
diff --git a/ext/gmp/tests/gmp_random.phpt b/ext/gmp/tests/gmp_random.phpt
deleted file mode 100644
index ab2b11b3f7..0000000000
--- a/ext/gmp/tests/gmp_random.phpt
+++ /dev/null
@@ -1,60 +0,0 @@
---TEST--
-gmp_random() basic tests
---SKIPIF--
-<?php if (!extension_loaded("gmp")) print "skip"; ?>
---FILE--
-<?php
-
-var_dump(gmp_strval(gmp_random()));
-var_dump(gmp_strval(gmp_random(-1)));
-var_dump(gmp_strval(gmp_random(0)));
-var_dump(gmp_strval(gmp_random(10)));
-var_dump(gmp_strval(gmp_random("-10")));
-var_dump(gmp_strval(gmp_random(-10)));
-
-var_dump(gmp_random(array()));
-var_dump(gmp_random(array(),1));
-var_dump(gmp_random(""));
-var_dump(gmp_random("test"));
-
-echo "Done\n";
-?>
---EXPECTF--
-Deprecated: Function gmp_random() is deprecated in %s on line %d
-string(%d) "%d"
-
-Deprecated: Function gmp_random() is deprecated in %s on line %d
-string(%d) "%d"
-
-Deprecated: Function gmp_random() is deprecated in %s on line %d
-string(1) "%d"
-
-Deprecated: Function gmp_random() is deprecated in %s on line %d
-string(%d) "%d"
-
-Deprecated: Function gmp_random() is deprecated in %s on line %d
-string(%d) "%d"
-
-Deprecated: Function gmp_random() is deprecated in %s on line %d
-string(%d) "%d"
-
-Deprecated: Function gmp_random() is deprecated in %s on line %d
-
-Warning: gmp_random() expects parameter 1 to be int, array given in %s on line %d
-NULL
-
-Deprecated: Function gmp_random() is deprecated in %s on line %d
-
-Warning: gmp_random() expects at most 1 parameter, 2 given in %s on line %d
-NULL
-
-Deprecated: Function gmp_random() is deprecated in %s on line %d
-
-Warning: gmp_random() expects parameter 1 to be int, string given in %s on line %d
-NULL
-
-Deprecated: Function gmp_random() is deprecated in %s on line %d
-
-Warning: gmp_random() expects parameter 1 to be int, string given in %s on line %d
-NULL
-Done
diff --git a/ext/gmp/tests/gmp_random_bits.phpt b/ext/gmp/tests/gmp_random_bits.phpt
index b4aa5d7b73..1d6df72831 100644
--- a/ext/gmp/tests/gmp_random_bits.phpt
+++ b/ext/gmp/tests/gmp_random_bits.phpt
@@ -5,7 +5,6 @@ gmp_random_bits() basic tests
--FILE--
<?php
-var_dump(gmp_random_bits());
var_dump(gmp_random_bits(0));
var_dump(gmp_random_bits(-1));
@@ -17,26 +16,23 @@ gmp_random_bits(1024);
$start = microtime(true);
$limit = (2 ** 30) - 1;
while (1) {
- for ($i = 0; $i < 5000; $i++) {
- $result = gmp_random_bits(30);
- if ($result < 0 || $result > $limit) {
- print "RANGE VIOLATION\n";
- var_dump($result);
- break 2;
- }
- }
+ for ($i = 0; $i < 5000; $i++) {
+ $result = gmp_random_bits(30);
+ if ($result < 0 || $result > $limit) {
+ print "RANGE VIOLATION\n";
+ var_dump($result);
+ break 2;
+ }
+ }
- if (microtime(true) - $start > 0.5) {
- break;
- }
+ if (microtime(true) - $start > 0.5) {
+ break;
+ }
}
echo "Done\n";
?>
--EXPECTF--
-Warning: gmp_random_bits() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
Warning: gmp_random_bits(): The number of bits must be positive in %s on line %d
bool(false)
diff --git a/ext/gmp/tests/gmp_random_range.phpt b/ext/gmp/tests/gmp_random_range.phpt
index 654ffbefb3..7ff6c546b4 100644
--- a/ext/gmp/tests/gmp_random_range.phpt
+++ b/ext/gmp/tests/gmp_random_range.phpt
@@ -9,8 +9,6 @@ $minusTen = gmp_init(-10);
$plusTen = gmp_init(10);
$zero = gmp_init(0);
-var_dump(gmp_random_range());
-var_dump(gmp_random_range(10));
var_dump(gmp_random_range(10, -10));
var_dump(gmp_random_range($plusTen, $minusTen));
@@ -33,43 +31,37 @@ gmp_random_range($minusTen, $plusTen);
// 0.5 seconds to make sure the numbers stay in range
$start = microtime(true);
while (1) {
- for ($i = 0; $i < 5000; $i++) {
- $result = gmp_random_range(0, 1000);
- if ($result < 0 || $result > 1000) {
- print "RANGE VIOLATION 1\n";
- var_dump($result);
- break 2;
- }
+ for ($i = 0; $i < 5000; $i++) {
+ $result = gmp_random_range(0, 1000);
+ if ($result < 0 || $result > 1000) {
+ print "RANGE VIOLATION 1\n";
+ var_dump($result);
+ break 2;
+ }
- $result = gmp_random_range(-1000, 0);
- if ($result < -1000 || $result > 0) {
- print "RANGE VIOLATION 2\n";
- var_dump($result);
- break 2;
- }
+ $result = gmp_random_range(-1000, 0);
+ if ($result < -1000 || $result > 0) {
+ print "RANGE VIOLATION 2\n";
+ var_dump($result);
+ break 2;
+ }
- $result = gmp_random_range(-500, 500);
- if ($result < -500 || $result > 500) {
- print "RANGE VIOLATION 3\n";
- var_dump($result);
- break 2;
- }
- }
+ $result = gmp_random_range(-500, 500);
+ if ($result < -500 || $result > 500) {
+ print "RANGE VIOLATION 3\n";
+ var_dump($result);
+ break 2;
+ }
+ }
- if (microtime(true) - $start > 0.5) {
- break;
- }
+ if (microtime(true) - $start > 0.5) {
+ break;
+ }
}
echo "Done\n";
?>
--EXPECTF--
-Warning: gmp_random_range() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: gmp_random_range() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
Warning: gmp_random_range(): The minimum value must be less than the maximum value in %s on line %d
bool(false)
diff --git a/ext/gmp/tests/gmp_random_seed-32bit.phpt b/ext/gmp/tests/gmp_random_seed-32bit.phpt
deleted file mode 100644
index 95d8dd50f9..0000000000
--- a/ext/gmp/tests/gmp_random_seed-32bit.phpt
+++ /dev/null
@@ -1,232 +0,0 @@
---TEST--
-gmp_random_seed() basic tests
---SKIPIF--
-<?php if (!extension_loaded("gmp")) print "skip"; ?>
-<?php if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); ?>
---INI--
-error_reporting=E_ALL&~E_DEPRECATED
---FILE--
-<?php
-
-// zero int
-var_dump(gmp_random_seed(0));
-
-var_dump(gmp_strval(gmp_random()));
-var_dump(gmp_strval(gmp_random(1)));
-var_dump(gmp_strval(gmp_random(10)));
-
-var_dump(gmp_strval(gmp_random_bits(10)));
-var_dump(gmp_strval(gmp_random_bits(100)));
-var_dump(gmp_strval(gmp_random_bits(1000)));
-
-var_dump(gmp_strval(gmp_random_range(0, 10000)));
-var_dump(gmp_strval(gmp_random_range(-10000, 10000)));
-var_dump(gmp_strval(gmp_random_range(-10000, 0)));
-
-
-// zero gmp
-var_dump(gmp_random_seed(gmp_init(0)));
-
-var_dump(gmp_strval(gmp_random()));
-var_dump(gmp_strval(gmp_random(1)));
-var_dump(gmp_strval(gmp_random(10)));
-
-var_dump(gmp_strval(gmp_random_bits(10)));
-var_dump(gmp_strval(gmp_random_bits(100)));
-var_dump(gmp_strval(gmp_random_bits(1000)));
-
-var_dump(gmp_strval(gmp_random_range(0, 10000)));
-var_dump(gmp_strval(gmp_random_range(-10000, 10000)));
-var_dump(gmp_strval(gmp_random_range(-10000, 0)));
-
-
-// negative int
-var_dump(gmp_random_seed(-100));
-
-var_dump(gmp_strval(gmp_random()));
-var_dump(gmp_strval(gmp_random(1)));
-var_dump(gmp_strval(gmp_random(10)));
-
-var_dump(gmp_strval(gmp_random_bits(10)));
-var_dump(gmp_strval(gmp_random_bits(100)));
-var_dump(gmp_strval(gmp_random_bits(1000)));
-
-var_dump(gmp_strval(gmp_random_range(0, 10000)));
-var_dump(gmp_strval(gmp_random_range(-10000, 10000)));
-var_dump(gmp_strval(gmp_random_range(-10000, 0)));
-
-
-// negative gmp
-var_dump(gmp_random_seed(gmp_init(-100)));
-
-var_dump(gmp_strval(gmp_random()));
-var_dump(gmp_strval(gmp_random(1)));
-var_dump(gmp_strval(gmp_random(10)));
-
-var_dump(gmp_strval(gmp_random_bits(10)));
-var_dump(gmp_strval(gmp_random_bits(100)));
-var_dump(gmp_strval(gmp_random_bits(1000)));
-
-var_dump(gmp_strval(gmp_random_range(0, 10000)));
-var_dump(gmp_strval(gmp_random_range(-10000, 10000)));
-var_dump(gmp_strval(gmp_random_range(-10000, 0)));
-
-
-// positive int
-var_dump(gmp_random_seed(100));
-
-var_dump(gmp_strval(gmp_random()));
-var_dump(gmp_strval(gmp_random(1)));
-var_dump(gmp_strval(gmp_random(10)));
-
-var_dump(gmp_strval(gmp_random_bits(10)));
-var_dump(gmp_strval(gmp_random_bits(100)));
-var_dump(gmp_strval(gmp_random_bits(1000)));
-
-var_dump(gmp_strval(gmp_random_range(0, 10000)));
-var_dump(gmp_strval(gmp_random_range(-10000, 10000)));
-var_dump(gmp_strval(gmp_random_range(-10000, 0)));
-
-
-// positive gmp
-var_dump(gmp_random_seed(100));
-
-var_dump(gmp_strval(gmp_random()));
-var_dump(gmp_strval(gmp_random(1)));
-var_dump(gmp_strval(gmp_random(10)));
-
-var_dump(gmp_strval(gmp_random_bits(10)));
-var_dump(gmp_strval(gmp_random_bits(100)));
-var_dump(gmp_strval(gmp_random_bits(1000)));
-
-var_dump(gmp_strval(gmp_random_range(0, 10000)));
-var_dump(gmp_strval(gmp_random_range(-10000, 10000)));
-var_dump(gmp_strval(gmp_random_range(-10000, 0)));
-
-
-$seed = gmp_init(1);
-$seed <<= 512;
-
-// large negative gmp
-var_dump(gmp_random_seed($seed * -1));
-
-var_dump(gmp_strval(gmp_random()));
-var_dump(gmp_strval(gmp_random(1)));
-var_dump(gmp_strval(gmp_random(10)));
-
-var_dump(gmp_strval(gmp_random_bits(10)));
-var_dump(gmp_strval(gmp_random_bits(100)));
-var_dump(gmp_strval(gmp_random_bits(1000)));
-
-var_dump(gmp_strval(gmp_random_range(0, 10000)));
-var_dump(gmp_strval(gmp_random_range(-10000, 10000)));
-var_dump(gmp_strval(gmp_random_range(-10000, 0)));
-
-
-// large positive gmp
-var_dump(gmp_random_seed($seed));
-
-var_dump(gmp_strval(gmp_random()));
-var_dump(gmp_strval(gmp_random(1)));
-var_dump(gmp_strval(gmp_random(10)));
-
-var_dump(gmp_strval(gmp_random_bits(10)));
-var_dump(gmp_strval(gmp_random_bits(100)));
-var_dump(gmp_strval(gmp_random_bits(1000)));
-
-var_dump(gmp_strval(gmp_random_range(0, 10000)));
-var_dump(gmp_strval(gmp_random_range(-10000, 10000)));
-var_dump(gmp_strval(gmp_random_range(-10000, 0)));
-
-
-// standard non conversion error
-var_dump(gmp_random_seed('not a number'));
-
-
-echo "Done\n";
-?>
---EXPECTF--
-NULL
-string(193) "2000022451473107283132031190545479155678097978829612864726689673263990484954900429188146529905019042225609517482723730948135765344007937183893986134210303199345433818579954244943136664096571499"
-string(10) "3792281639"
-string(97) "1281406676617847191505318987040099388645126071814252743902229506206669580396236451813261179688680"
-string(2) "86"
-string(30) "539590049119295715487546581833"
-string(301) "1421393257467327495225454368915273750356127352353055226245692071178379257048985726109650766437957017507708821700349355658110489309871463201057688894986035545794429493563972043777521547094922637182497036750765553664196591958728194711096442220858890056073974348364544481270013556644174056049511198143353"
-string(4) "8971"
-string(4) "7838"
-string(5) "-7823"
-NULL
-string(193) "2000022451473107283132031190545479155678097978829612864726689673263990484954900429188146529905019042225609517482723730948135765344007937183893986134210303199345433818579954244943136664096571499"
-string(10) "3792281639"
-string(97) "1281406676617847191505318987040099388645126071814252743902229506206669580396236451813261179688680"
-string(2) "86"
-string(30) "539590049119295715487546581833"
-string(301) "1421393257467327495225454368915273750356127352353055226245692071178379257048985726109650766437957017507708821700349355658110489309871463201057688894986035545794429493563972043777521547094922637182497036750765553664196591958728194711096442220858890056073974348364544481270013556644174056049511198143353"
-string(4) "8971"
-string(4) "7838"
-string(5) "-7823"
-NULL
-string(193) "2481908463276861025880840116973116041137167231715512003123396619946362384184452775649311777755189162364804428739438733886421190841599393284032499618736594054572838636962845446571583771860379424"
-string(9) "513032517"
-string(97) "1269389652350468424962405917839748437534426606829298977422985976022226588797299164880342257267822"
-string(3) "111"
-string(31) "1007352579363975542750518386428"
-string(301) "5972672173406546932378461222050826195392618168845902231231085819967980051373112173617569638344495916340820360974139193579303652817960325137050189614326029375858951250371622253667077551034119958866481056760107123567590230789917209543206262943739654964107980961862387602012190907147667678648223791029527"
-string(4) "2362"
-string(5) "-9377"
-string(5) "-8435"
-NULL
-string(193) "2481908463276861025880840116973116041137167231715512003123396619946362384184452775649311777755189162364804428739438733886421190841599393284032499618736594054572838636962845446571583771860379424"
-string(9) "513032517"
-string(97) "1269389652350468424962405917839748437534426606829298977422985976022226588797299164880342257267822"
-string(3) "111"
-string(31) "1007352579363975542750518386428"
-string(301) "5972672173406546932378461222050826195392618168845902231231085819967980051373112173617569638344495916340820360974139193579303652817960325137050189614326029375858951250371622253667077551034119958866481056760107123567590230789917209543206262943739654964107980961862387602012190907147667678648223791029527"
-string(4) "2362"
-string(5) "-9377"
-string(5) "-8435"
-NULL
-string(193) "2481908463276861025880840116973116041137167231715512003123396619946362384184452775649311777755189162364804428739438733886421190841599393284032499618736594054572838636962845446571583771860379424"
-string(9) "513032517"
-string(97) "1269389652350468424962405917839748437534426606829298977422985976022226588797299164880342257267822"
-string(3) "111"
-string(31) "1007352579363975542750518386428"
-string(301) "5972672173406546932378461222050826195392618168845902231231085819967980051373112173617569638344495916340820360974139193579303652817960325137050189614326029375858951250371622253667077551034119958866481056760107123567590230789917209543206262943739654964107980961862387602012190907147667678648223791029527"
-string(4) "2362"
-string(5) "-9377"
-string(5) "-8435"
-NULL
-string(193) "2481908463276861025880840116973116041137167231715512003123396619946362384184452775649311777755189162364804428739438733886421190841599393284032499618736594054572838636962845446571583771860379424"
-string(9) "513032517"
-string(97) "1269389652350468424962405917839748437534426606829298977422985976022226588797299164880342257267822"
-string(3) "111"
-string(31) "1007352579363975542750518386428"
-string(301) "5972672173406546932378461222050826195392618168845902231231085819967980051373112173617569638344495916340820360974139193579303652817960325137050189614326029375858951250371622253667077551034119958866481056760107123567590230789917209543206262943739654964107980961862387602012190907147667678648223791029527"
-string(4) "2362"
-string(5) "-9377"
-string(5) "-8435"
-NULL
-string(193) "4314861641594785951065006537821497084129700255567731661104366342587560122488351847486220156468888511744226746306538524023190734733433083354034308520246964938498767672539252131810891590624763642"
-string(10) "3301287097"
-string(97) "1532710025135934106005683287301200805525218110207399702226596673360222079570223526337866801028045"
-string(3) "317"
-string(30) "949682013136255600092941702271"
-string(302) "10419061168407861659407303769436775291881708415032871985692089124472434944956010985892897595466043265819000974537553172663152640727594826474137173310039809413311432062725623183603946900548710858191078057179743726366436832870919212340219523613153893742764101120396858424887711932475871305848021245801132"
-string(4) "2417"
-string(5) "-7975"
-string(4) "-378"
-NULL
-string(193) "4314861641594785951065006537821497084129700255567731661104366342587560122488351847486220156468888511744226746306538524023190734733433083354034308520246964938498767672539252131810891590624763642"
-string(10) "3301287097"
-string(97) "1532710025135934106005683287301200805525218110207399702226596673360222079570223526337866801028045"
-string(3) "317"
-string(30) "949682013136255600092941702271"
-string(302) "10419061168407861659407303769436775291881708415032871985692089124472434944956010985892897595466043265819000974537553172663152640727594826474137173310039809413311432062725623183603946900548710858191078057179743726366436832870919212340219523613153893742764101120396858424887711932475871305848021245801132"
-string(4) "2417"
-string(5) "-7975"
-string(4) "-378"
-
-Warning: gmp_random_seed(): Unable to convert variable to GMP - string is not an integer in %s on line %d
-bool(false)
-Done
diff --git a/ext/gmp/tests/gmp_random_seed.phpt b/ext/gmp/tests/gmp_random_seed.phpt
index e143a5153e..80f49ee32c 100644
--- a/ext/gmp/tests/gmp_random_seed.phpt
+++ b/ext/gmp/tests/gmp_random_seed.phpt
@@ -3,18 +3,12 @@ gmp_random_seed() basic tests
--SKIPIF--
<?php if (!extension_loaded("gmp")) print "skip"; ?>
<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?>
---INI--
-error_reporting=E_ALL&~E_DEPRECATED
--FILE--
<?php
// zero int
var_dump(gmp_random_seed(0));
-var_dump(gmp_strval(gmp_random()));
-var_dump(gmp_strval(gmp_random(1)));
-var_dump(gmp_strval(gmp_random(10)));
-
var_dump(gmp_strval(gmp_random_bits(10)));
var_dump(gmp_strval(gmp_random_bits(100)));
var_dump(gmp_strval(gmp_random_bits(1000)));
@@ -27,10 +21,6 @@ var_dump(gmp_strval(gmp_random_range(-10000, 0)));
// zero gmp
var_dump(gmp_random_seed(gmp_init(0)));
-var_dump(gmp_strval(gmp_random()));
-var_dump(gmp_strval(gmp_random(1)));
-var_dump(gmp_strval(gmp_random(10)));
-
var_dump(gmp_strval(gmp_random_bits(10)));
var_dump(gmp_strval(gmp_random_bits(100)));
var_dump(gmp_strval(gmp_random_bits(1000)));
@@ -43,10 +33,6 @@ var_dump(gmp_strval(gmp_random_range(-10000, 0)));
// negative int
var_dump(gmp_random_seed(-100));
-var_dump(gmp_strval(gmp_random()));
-var_dump(gmp_strval(gmp_random(1)));
-var_dump(gmp_strval(gmp_random(10)));
-
var_dump(gmp_strval(gmp_random_bits(10)));
var_dump(gmp_strval(gmp_random_bits(100)));
var_dump(gmp_strval(gmp_random_bits(1000)));
@@ -59,10 +45,6 @@ var_dump(gmp_strval(gmp_random_range(-10000, 0)));
// negative gmp
var_dump(gmp_random_seed(gmp_init(-100)));
-var_dump(gmp_strval(gmp_random()));
-var_dump(gmp_strval(gmp_random(1)));
-var_dump(gmp_strval(gmp_random(10)));
-
var_dump(gmp_strval(gmp_random_bits(10)));
var_dump(gmp_strval(gmp_random_bits(100)));
var_dump(gmp_strval(gmp_random_bits(1000)));
@@ -75,10 +57,6 @@ var_dump(gmp_strval(gmp_random_range(-10000, 0)));
// positive int
var_dump(gmp_random_seed(100));
-var_dump(gmp_strval(gmp_random()));
-var_dump(gmp_strval(gmp_random(1)));
-var_dump(gmp_strval(gmp_random(10)));
-
var_dump(gmp_strval(gmp_random_bits(10)));
var_dump(gmp_strval(gmp_random_bits(100)));
var_dump(gmp_strval(gmp_random_bits(1000)));
@@ -91,10 +69,6 @@ var_dump(gmp_strval(gmp_random_range(-10000, 0)));
// positive gmp
var_dump(gmp_random_seed(100));
-var_dump(gmp_strval(gmp_random()));
-var_dump(gmp_strval(gmp_random(1)));
-var_dump(gmp_strval(gmp_random(10)));
-
var_dump(gmp_strval(gmp_random_bits(10)));
var_dump(gmp_strval(gmp_random_bits(100)));
var_dump(gmp_strval(gmp_random_bits(1000)));
@@ -110,10 +84,6 @@ $seed <<= 512;
// large negative gmp
var_dump(gmp_random_seed($seed * -1));
-var_dump(gmp_strval(gmp_random()));
-var_dump(gmp_strval(gmp_random(1)));
-var_dump(gmp_strval(gmp_random(10)));
-
var_dump(gmp_strval(gmp_random_bits(10)));
var_dump(gmp_strval(gmp_random_bits(100)));
var_dump(gmp_strval(gmp_random_bits(1000)));
@@ -126,10 +96,6 @@ var_dump(gmp_strval(gmp_random_range(-10000, 0)));
// large positive gmp
var_dump(gmp_random_seed($seed));
-var_dump(gmp_strval(gmp_random()));
-var_dump(gmp_strval(gmp_random(1)));
-var_dump(gmp_strval(gmp_random(10)));
-
var_dump(gmp_strval(gmp_random_bits(10)));
var_dump(gmp_strval(gmp_random_bits(100)));
var_dump(gmp_strval(gmp_random_bits(1000)));
@@ -147,85 +113,61 @@ echo "Done\n";
?>
--EXPECTF--
NULL
-string(386) "16100871751340485642888774479422205950971474538471317276388238970713821926852258806210387669237144400278914671533438653274777493140545293541785377162348524402063489947660558889561219968642920852870483050552936324125257259316643328803697665037881088889859735075814746314563786538493931260996669892959501637800179548654075887300734264333417283208357503038004080669367070111848040502362219"
-string(18) "255344473360201232"
-string(192) "566276705882089203328999735915155615747289398229935944715725865523491463654289449864817867794422824157675456435165973986660058784111212531276312901205233176071526587181942240113004108328736022"
-string(3) "766"
-string(31) "1251852006013618829761115383588"
-string(301) "2904442664575028522451529381233481137998826790384445089758175726247096826023839957531211794198483328480161675791738894500687706952157332727908305084432443942315866545175274665372161864357698401817740956147940095302549920711069038378541222669595494627580205085300332122174778540693048337420608925104417"
-string(4) "5969"
-string(5) "-4126"
-string(4) "-926"
+string(3) "107"
+string(30) "576055025228722307492589900056"
+string(301) "5075491613651149525976453192895895253653438900772590630831858908690082668789318258254821002217677675804439098856210618572534955562143303188483908287009522532300439665975877709754914215718998849272363858786685187951932478210775857465448084868199807983919191214972626993925394176279001074206804955195464"
+string(4) "4098"
+string(3) "866"
+string(5) "-4602"
NULL
-string(386) "16100871751340485642888774479422205950971474538471317276388238970713821926852258806210387669237144400278914671533438653274777493140545293541785377162348524402063489947660558889561219968642920852870483050552936324125257259316643328803697665037881088889859735075814746314563786538493931260996669892959501637800179548654075887300734264333417283208357503038004080669367070111848040502362219"
-string(18) "255344473360201232"
-string(192) "566276705882089203328999735915155615747289398229935944715725865523491463654289449864817867794422824157675456435165973986660058784111212531276312901205233176071526587181942240113004108328736022"
-string(3) "766"
-string(31) "1251852006013618829761115383588"
-string(301) "2904442664575028522451529381233481137998826790384445089758175726247096826023839957531211794198483328480161675791738894500687706952157332727908305084432443942315866545175274665372161864357698401817740956147940095302549920711069038378541222669595494627580205085300332122174778540693048337420608925104417"
-string(4) "5969"
-string(5) "-4126"
-string(4) "-926"
+string(3) "107"
+string(30) "576055025228722307492589900056"
+string(301) "5075491613651149525976453192895895253653438900772590630831858908690082668789318258254821002217677675804439098856210618572534955562143303188483908287009522532300439665975877709754914215718998849272363858786685187951932478210775857465448084868199807983919191214972626993925394176279001074206804955195464"
+string(4) "4098"
+string(3) "866"
+string(5) "-4602"
NULL
-string(386) "13477111096113160882601567427091178332669645276785709413953468738199940626922635042144840457533224221336117027441609364710893482124071124759231943384805378201041406842697962243732316555316214869988749798708139879922380266366387589101775891621221881149417841139463207495993669582399783202126977651864760442797681787747348653884279195479310922110107643437514016795836672871442926389274400"
-string(20) "15370156633245019617"
-string(192) "294354325919119835375781661354719128667828860233586416953977190644006896604022494655398295674227944872858213051595447565156112646032890737200590095517623075051828676500990477704073251304424133"
-string(3) "683"
-string(31) "1105092118036828878542238774672"
-string(301) "2700084798786584694260166508009114488318099110808331607090845844712329387915039325877090587052399841255219556028410036280510827424748532204766771994624650610348058361519239518625728955462297681525123214377383395734875500143425080808436274385326255154393544373636015993206705180032889399161843788895374"
-string(4) "7268"
-string(5) "-3518"
-string(5) "-8432"
+string(3) "800"
+string(30) "136797365759249926716355081555"
+string(300) "983682312243221532860194306859606025979259367996304596374614332718375645173854152266611727577102182844028492473112400528817154210713755887896949560718745264129216953815968005630126359941634684721501777057142617647654380585317016323758806063124938232519551123440573348326061244006512869165793958775168"
+string(4) "1029"
+string(4) "7093"
+string(5) "-9074"
NULL
-string(386) "13477111096113160882601567427091178332669645276785709413953468738199940626922635042144840457533224221336117027441609364710893482124071124759231943384805378201041406842697962243732316555316214869988749798708139879922380266366387589101775891621221881149417841139463207495993669582399783202126977651864760442797681787747348653884279195479310922110107643437514016795836672871442926389274400"
-string(20) "15370156633245019617"
-string(192) "294354325919119835375781661354719128667828860233586416953977190644006896604022494655398295674227944872858213051595447565156112646032890737200590095517623075051828676500990477704073251304424133"
-string(3) "683"
-string(31) "1105092118036828878542238774672"
-string(301) "2700084798786584694260166508009114488318099110808331607090845844712329387915039325877090587052399841255219556028410036280510827424748532204766771994624650610348058361519239518625728955462297681525123214377383395734875500143425080808436274385326255154393544373636015993206705180032889399161843788895374"
-string(4) "7268"
-string(5) "-3518"
-string(5) "-8432"
+string(3) "800"
+string(30) "136797365759249926716355081555"
+string(300) "983682312243221532860194306859606025979259367996304596374614332718375645173854152266611727577102182844028492473112400528817154210713755887896949560718745264129216953815968005630126359941634684721501777057142617647654380585317016323758806063124938232519551123440573348326061244006512869165793958775168"
+string(4) "1029"
+string(4) "7093"
+string(5) "-9074"
NULL
-string(386) "13477111096113160882601567427091178332669645276785709413953468738199940626922635042144840457533224221336117027441609364710893482124071124759231943384805378201041406842697962243732316555316214869988749798708139879922380266366387589101775891621221881149417841139463207495993669582399783202126977651864760442797681787747348653884279195479310922110107643437514016795836672871442926389274400"
-string(20) "15370156633245019617"
-string(192) "294354325919119835375781661354719128667828860233586416953977190644006896604022494655398295674227944872858213051595447565156112646032890737200590095517623075051828676500990477704073251304424133"
-string(3) "683"
-string(31) "1105092118036828878542238774672"
-string(301) "2700084798786584694260166508009114488318099110808331607090845844712329387915039325877090587052399841255219556028410036280510827424748532204766771994624650610348058361519239518625728955462297681525123214377383395734875500143425080808436274385326255154393544373636015993206705180032889399161843788895374"
-string(4) "7268"
-string(5) "-3518"
-string(5) "-8432"
+string(3) "800"
+string(30) "136797365759249926716355081555"
+string(300) "983682312243221532860194306859606025979259367996304596374614332718375645173854152266611727577102182844028492473112400528817154210713755887896949560718745264129216953815968005630126359941634684721501777057142617647654380585317016323758806063124938232519551123440573348326061244006512869165793958775168"
+string(4) "1029"
+string(4) "7093"
+string(5) "-9074"
NULL
-string(386) "13477111096113160882601567427091178332669645276785709413953468738199940626922635042144840457533224221336117027441609364710893482124071124759231943384805378201041406842697962243732316555316214869988749798708139879922380266366387589101775891621221881149417841139463207495993669582399783202126977651864760442797681787747348653884279195479310922110107643437514016795836672871442926389274400"
-string(20) "15370156633245019617"
-string(192) "294354325919119835375781661354719128667828860233586416953977190644006896604022494655398295674227944872858213051595447565156112646032890737200590095517623075051828676500990477704073251304424133"
-string(3) "683"
-string(31) "1105092118036828878542238774672"
-string(301) "2700084798786584694260166508009114488318099110808331607090845844712329387915039325877090587052399841255219556028410036280510827424748532204766771994624650610348058361519239518625728955462297681525123214377383395734875500143425080808436274385326255154393544373636015993206705180032889399161843788895374"
-string(4) "7268"
-string(5) "-3518"
-string(5) "-8432"
+string(3) "800"
+string(30) "136797365759249926716355081555"
+string(300) "983682312243221532860194306859606025979259367996304596374614332718375645173854152266611727577102182844028492473112400528817154210713755887896949560718745264129216953815968005630126359941634684721501777057142617647654380585317016323758806063124938232519551123440573348326061244006512869165793958775168"
+string(4) "1029"
+string(4) "7093"
+string(5) "-9074"
NULL
-string(386) "17517289823903393220742578279919954815229524740463730368402128237511862318453381595675765692750750649609755422480004471234960388086555321894591036872550129477305413674775698107868844953599169316550102271816620108199930104365341610775602960735862041722613145476720452800951958891882288668416542937408952006310656170195090436314902430700708511047189929836145291647101130135292078875631354"
-string(19) "1662391866670215057"
-string(193) "1951928859951518261564127834731454911658112769477733872890285741065126442731035642243573666695893929882207432512593006044657806021743917753379619843420559355572830613932424235592411658293328273"
-string(3) "888"
-string(30) "136524289584478309125073026188"
-string(301) "4487372666528061674404740793683112894444118579769413902123304803304884162086348577960502430419080687314731489440882833272125181594897832730214825704339272207090970657364333461383490282984012738008555512699878911293400686609929745464733074891420787002129849587668122219953473716759349853748437799165176"
-string(4) "8559"
-string(4) "9426"
-string(5) "-2932"
+string(3) "762"
+string(30) "822340340897453415684831711085"
+string(301) "7240560133683902061389868703829443708354917824328579773726122219756981024103097560162756171513655189995985599958252688592185764428631571614485572869738344560301294144844739876478557439580966605216861285841689262517286639329902832431755450003123084728943981078635297917573398492558065003906539489023830"
+string(4) "9636"
+string(5) "-9848"
+string(5) "-9648"
NULL
-string(386) "17517289823903393220742578279919954815229524740463730368402128237511862318453381595675765692750750649609755422480004471234960388086555321894591036872550129477305413674775698107868844953599169316550102271816620108199930104365341610775602960735862041722613145476720452800951958891882288668416542937408952006310656170195090436314902430700708511047189929836145291647101130135292078875631354"
-string(19) "1662391866670215057"
-string(193) "1951928859951518261564127834731454911658112769477733872890285741065126442731035642243573666695893929882207432512593006044657806021743917753379619843420559355572830613932424235592411658293328273"
-string(3) "888"
-string(30) "136524289584478309125073026188"
-string(301) "4487372666528061674404740793683112894444118579769413902123304803304884162086348577960502430419080687314731489440882833272125181594897832730214825704339272207090970657364333461383490282984012738008555512699878911293400686609929745464733074891420787002129849587668122219953473716759349853748437799165176"
-string(4) "8559"
-string(4) "9426"
-string(5) "-2932"
+string(3) "762"
+string(30) "822340340897453415684831711085"
+string(301) "7240560133683902061389868703829443708354917824328579773726122219756981024103097560162756171513655189995985599958252688592185764428631571614485572869738344560301294144844739876478557439580966605216861285841689262517286639329902832431755450003123084728943981078635297917573398492558065003906539489023830"
+string(4) "9636"
+string(5) "-9848"
+string(5) "-9648"
Warning: gmp_random_seed(): Unable to convert variable to GMP - string is not an integer in %s on line %d
bool(false)
diff --git a/ext/gmp/tests/gmp_remroot.phpt b/ext/gmp/tests/gmp_remroot.phpt
index acd8f84925..1316d7651c 100644
--- a/ext/gmp/tests/gmp_remroot.phpt
+++ b/ext/gmp/tests/gmp_remroot.phpt
@@ -5,8 +5,6 @@ gmp_rootrem() basic tests
--FILE--
<?php
-var_dump(gmp_rootrem());
-
var_dump(gmp_rootrem(1000, 3));
var_dump(gmp_rootrem(100, 3));
var_dump(gmp_rootrem(-100, 3));
@@ -21,8 +19,6 @@ var_dump(gmp_rootrem(100, -3));
?>
--EXPECTF--
-Warning: gmp_rootrem() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
array(2) {
[0]=>
object(GMP)#%d (1) {
diff --git a/ext/gmp/tests/gmp_root.phpt b/ext/gmp/tests/gmp_root.phpt
index 654e2ffeb6..47c1fcc608 100644
--- a/ext/gmp/tests/gmp_root.phpt
+++ b/ext/gmp/tests/gmp_root.phpt
@@ -5,8 +5,6 @@ gmp_root() basic tests
--FILE--
<?php
-var_dump(gmp_root());
-
var_dump(gmp_root(1000, 3));
var_dump(gmp_root(100, 3));
var_dump(gmp_root(-100, 3));
@@ -21,8 +19,6 @@ var_dump(gmp_root(100, -3));
?>
--EXPECTF--
-Warning: gmp_root() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
object(GMP)#%d (1) {
["num"]=>
string(2) "10"
diff --git a/ext/gmp/tests/gmp_scan0.phpt b/ext/gmp/tests/gmp_scan0.phpt
index fb70cf8b25..c06f91f7dd 100644
--- a/ext/gmp/tests/gmp_scan0.phpt
+++ b/ext/gmp/tests/gmp_scan0.phpt
@@ -15,8 +15,6 @@ $n = gmp_init("24234527465274");
var_dump(gmp_scan0($n, 10));
var_dump(gmp_scan0(array(), 200));
-var_dump(gmp_scan0(array()));
-var_dump(gmp_scan0());
echo "Done\n";
?>
@@ -31,10 +29,4 @@ int(13)
Warning: gmp_scan0(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
-
-Warning: gmp_scan0() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: gmp_scan0() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
Done
diff --git a/ext/gmp/tests/gmp_scan1.phpt b/ext/gmp/tests/gmp_scan1.phpt
index a89a9195b0..43a2fdfa1b 100644
--- a/ext/gmp/tests/gmp_scan1.phpt
+++ b/ext/gmp/tests/gmp_scan1.phpt
@@ -15,8 +15,6 @@ $n = gmp_init("24234527465274");
var_dump(gmp_scan1($n, 10));
var_dump(gmp_scan1(array(), 200));
-var_dump(gmp_scan1(array()));
-var_dump(gmp_scan1());
echo "Done\n";
?>
@@ -31,10 +29,4 @@ int(10)
Warning: gmp_scan1(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
-
-Warning: gmp_scan1() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: gmp_scan1() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
Done
diff --git a/ext/gmp/tests/gmp_setbit.phpt b/ext/gmp/tests/gmp_setbit.phpt
index 2eac23db0e..15270eaf7b 100644
--- a/ext/gmp/tests/gmp_setbit.phpt
+++ b/ext/gmp/tests/gmp_setbit.phpt
@@ -32,12 +32,17 @@ gmp_setbit($n, 3);
var_dump(gmp_strval($n));
$b = "";
-gmp_setbit($b, 23);
-gmp_setbit($b);
-gmp_setbit($b, 23,1,1);
-gmp_setbit($b,array());
+try {
+ gmp_setbit($b, 23);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
$a = array();
-gmp_setbit($a,array());
+try {
+ gmp_setbit($a, array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done\n";
?>
@@ -52,14 +57,6 @@ string(1) "7"
string(12) "100008388608"
string(12) "100000000000"
string(12) "100000000008"
-
-Warning: gmp_setbit() expects parameter 1 to be GMP, string given in %s on line %d
-
-Warning: gmp_setbit() expects at least 2 parameters, 1 given in %s on line %d
-
-Warning: gmp_setbit() expects at most 3 parameters, 4 given in %s on line %d
-
-Warning: gmp_setbit() expects parameter 1 to be GMP, string given in %s on line %d
-
-Warning: gmp_setbit() expects parameter 1 to be GMP, array given in %s on line %d
+gmp_setbit() expects parameter 1 to be GMP, string given
+gmp_setbit() expects parameter 1 to be GMP, array given
Done
diff --git a/ext/gmp/tests/gmp_setbit_long.phpt b/ext/gmp/tests/gmp_setbit_long.phpt
index ce4e427132..d7f56767d8 100644
--- a/ext/gmp/tests/gmp_setbit_long.phpt
+++ b/ext/gmp/tests/gmp_setbit_long.phpt
@@ -25,7 +25,7 @@ gmp_setbit() with large index
$n = gmp_init("227200");
for($a = 1<<30; $a > 0 && $a < 0x8000000000; $a <<= 2) {
- $i = $a - 1;
+ $i = $a - 1;
printf("%X\n", $i);
gmp_setbit($n, $i, 1);
}
diff --git a/ext/gmp/tests/gmp_sign.phpt b/ext/gmp/tests/gmp_sign.phpt
index 7ac03013d4..ac01845395 100644
--- a/ext/gmp/tests/gmp_sign.phpt
+++ b/ext/gmp/tests/gmp_sign.phpt
@@ -13,9 +13,7 @@ var_dump(gmp_sign("-34535345345"));
var_dump(gmp_sign("+34534573457345"));
$n = gmp_init("098909878976786545");
var_dump(gmp_sign($n));
-var_dump(gmp_sign($n, $n));
var_dump(gmp_sign(array()));
-var_dump(gmp_sign());
echo "Done\n";
?>
@@ -32,12 +30,6 @@ bool(false)
Warning: gmp_init(): Unable to convert variable to GMP - string is not an integer in %s on line %d
int(0)
-Warning: gmp_sign() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
Warning: gmp_sign(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
-
-Warning: gmp_sign() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
Done
diff --git a/ext/gmp/tests/gmp_sqrt.phpt b/ext/gmp/tests/gmp_sqrt.phpt
index e824de3706..03c460b79a 100644
--- a/ext/gmp/tests/gmp_sqrt.phpt
+++ b/ext/gmp/tests/gmp_sqrt.phpt
@@ -18,8 +18,6 @@ var_dump(gmp_strval(gmp_sqrt($n)));
$n = gmp_init(777);
var_dump(gmp_strval(gmp_sqrt($n)));
-var_dump(gmp_sqrt($n, 1));
-var_dump(gmp_sqrt());
var_dump(gmp_sqrt(array()));
echo "Done\n";
@@ -39,12 +37,6 @@ Warning: gmp_sqrt(): Number has to be greater than or equal to 0 in %s on line %
string(1) "0"
string(2) "27"
-Warning: gmp_sqrt() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: gmp_sqrt() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
Warning: gmp_sqrt(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
Done
diff --git a/ext/gmp/tests/gmp_sqrtrem.phpt b/ext/gmp/tests/gmp_sqrtrem.phpt
index 595a1dc45a..c19969158e 100644
--- a/ext/gmp/tests/gmp_sqrtrem.phpt
+++ b/ext/gmp/tests/gmp_sqrtrem.phpt
@@ -51,7 +51,6 @@ var_dump(gmp_strval($r[0]));
var_dump(gmp_strval($r[1]));
var_dump(gmp_sqrtrem(array()));
-var_dump(gmp_sqrtrem());
echo "Done\n";
?>
@@ -82,7 +81,4 @@ string(1) "1"
Warning: gmp_sqrtrem(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
-
-Warning: gmp_sqrtrem() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
Done
diff --git a/ext/gmp/tests/gmp_strval.phpt b/ext/gmp/tests/gmp_strval.phpt
index cfa7335667..b349d31699 100644
--- a/ext/gmp/tests/gmp_strval.phpt
+++ b/ext/gmp/tests/gmp_strval.phpt
@@ -5,11 +5,8 @@ gmp_strval() tests
--FILE--
<?php
-var_dump(gmp_strval());
var_dump(gmp_strval(""));
-var_dump(gmp_strval("", ""));
var_dump(gmp_strval("", -1));
-var_dump(gmp_strval(-1, ""));
$fp = fopen(__FILE__, "r");
var_dump(gmp_strval($fp));
@@ -26,29 +23,18 @@ var_dump(gmp_strval($g, -1));
var_dump(gmp_strval($g, 100000));
var_dump(gmp_strval($g, 10));
-var_dump(gmp_strval(array(1,2), array(1,2)));
-var_dump(gmp_strval(new stdclass, new stdclass));
var_dump(gmp_strval(array(1,2)));
var_dump(gmp_strval(new stdclass));
echo "Done\n";
?>
--EXPECTF--
-Warning: gmp_strval() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
Warning: gmp_strval(): Unable to convert variable to GMP - string is not an integer in %s on line %d
bool(false)
-Warning: gmp_strval() expects parameter 2 to be int, string given in %s on line %d
-NULL
-
Warning: gmp_strval(): Bad base for conversion: -1 (should be between 2 and %d or -2 and -%d) in %s on line %d
bool(false)
-Warning: gmp_strval() expects parameter 2 to be int, string given in %s on line %d
-NULL
-
Warning: gmp_strval(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
string(7) "9765456"
@@ -68,12 +54,6 @@ Warning: gmp_strval(): Bad base for conversion: 100000 (should be between 2 and
bool(false)
string(8) "-3373333"
-Warning: gmp_strval() expects parameter 2 to be int, array given in %s on line %d
-NULL
-
-Warning: gmp_strval() expects parameter 2 to be int, object given in %s on line %d
-NULL
-
Warning: gmp_strval(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
diff --git a/ext/gmp/tests/gmp_sub.phpt b/ext/gmp/tests/gmp_sub.phpt
index fabc0c0ebb..b8dce49774 100644
--- a/ext/gmp/tests/gmp_sub.phpt
+++ b/ext/gmp/tests/gmp_sub.phpt
@@ -5,10 +5,7 @@ gmp_sub() tests
--FILE--
<?php
-var_dump(gmp_sub());
-var_dump(gmp_sub(""));
var_dump(gmp_sub("", ""));
-var_dump(gmp_sub("", "", ""));
var_dump(gmp_sub(array(), array()));
var_dump($g = gmp_sub(10000, 10001));
@@ -23,18 +20,9 @@ var_dump(gmp_strval($g));
echo "Done\n";
?>
--EXPECTF--
-Warning: gmp_sub() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: gmp_sub() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
Warning: gmp_sub(): Unable to convert variable to GMP - string is not an integer in %s on line %d
bool(false)
-Warning: gmp_sub() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
Warning: gmp_sub(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
object(GMP)#%d (1) {
diff --git a/ext/gmp/tests/gmp_testbit.phpt b/ext/gmp/tests/gmp_testbit.phpt
index bdabe3d841..f18af5d44d 100644
--- a/ext/gmp/tests/gmp_testbit.phpt
+++ b/ext/gmp/tests/gmp_testbit.phpt
@@ -5,8 +5,6 @@ gmp_testbit() basic tests
--FILE--
<?php
-var_dump(gmp_testbit());
-
$n = gmp_init(0);
var_dump(gmp_testbit($n, -10));
var_dump(gmp_testbit($n, 0));
@@ -40,9 +38,6 @@ var_dump(gmp_strval($n));
echo "Done\n";
?>
--EXPECTF--
-Warning: gmp_testbit() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
Warning: gmp_testbit(): Index must be greater than or equal to zero in %s on line %d
bool(false)
bool(false)
diff --git a/ext/gmp/tests/gmp_xor.phpt b/ext/gmp/tests/gmp_xor.phpt
index 9bf31f02f4..cc508907aa 100644
--- a/ext/gmp/tests/gmp_xor.phpt
+++ b/ext/gmp/tests/gmp_xor.phpt
@@ -17,8 +17,6 @@ var_dump(gmp_strval(gmp_xor($n, "34332")));
$n1 = gmp_init("987657878765436543456");
var_dump(gmp_strval(gmp_xor($n, $n1)));
-var_dump(gmp_xor($n, $n1, 1));
-var_dump(gmp_xor(1));
var_dump(gmp_xor(array(), 1));
var_dump(gmp_xor(1, array()));
var_dump(gmp_xor(array(), array()));
@@ -37,12 +35,6 @@ string(1) "0"
string(15) "987657876574716"
string(21) "987658017016065701376"
-Warning: gmp_xor() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-Warning: gmp_xor() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
Warning: gmp_xor(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
diff --git a/ext/hash/config.m4 b/ext/hash/config.m4
index 03c4d83968..d84e89cc6b 100644
--- a/ext/hash/config.m4
+++ b/ext/hash/config.m4
@@ -11,9 +11,6 @@ if test "$PHP_MHASH" != "no"; then
AC_DEFINE(PHP_MHASH_BC, 1, [ ])
fi
-dnl Defined for BC.
-AC_DEFINE(HAVE_HASH_EXT,1,[Have HASH Extension])
-
if test $ac_cv_c_bigendian_php = yes; then
EXT_HASH_SHA3_SOURCES="hash_sha3.c"
AC_DEFINE(HAVE_SLOW_HASH3, 1, [Define is hash3 algo is available])
diff --git a/ext/hash/config.w32 b/ext/hash/config.w32
index 3ed785bfda..5d6be6b922 100644
--- a/ext/hash/config.w32
+++ b/ext/hash/config.w32
@@ -6,9 +6,6 @@ if (PHP_MHASH != 'no') {
AC_DEFINE('PHP_MHASH_BC', 1);
}
-// Defined for BC.
-AC_DEFINE('HAVE_HASH_EXT', 1);
-
PHP_HASH = 'yes';
EXTENSION('hash', 'hash.c hash_md.c hash_sha.c hash_ripemd.c hash_haval.c ' +
diff --git a/ext/hash/hash.c b/ext/hash/hash.c
index 856ae0e11b..e4b28c0e6b 100644
--- a/ext/hash/hash.c
+++ b/ext/hash/hash.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -29,6 +27,8 @@
#include "zend_interfaces.h"
#include "zend_exceptions.h"
+#include "hash_arginfo.h"
+
HashTable php_hash_hashtable;
zend_class_entry *php_hashcontext_ce;
static zend_object_handlers php_hashcontext_handlers;
@@ -83,11 +83,11 @@ static struct mhash_bc_entry mhash_to_hash[MHASH_NUM_ALGOS] = {
/* Hash Registry Access */
-PHP_HASH_API const php_hash_ops *php_hash_fetch_ops(const char *algo, size_t algo_len) /* {{{ */
+PHP_HASH_API const php_hash_ops *php_hash_fetch_ops(zend_string *algo) /* {{{ */
{
- char *lower = zend_str_tolower_dup(algo, algo_len);
- php_hash_ops *ops = zend_hash_str_find_ptr(&php_hash_hashtable, lower, algo_len);
- efree(lower);
+ zend_string *lower = zend_string_tolower(algo);
+ php_hash_ops *ops = zend_hash_find_ptr(&php_hash_hashtable, lower);
+ zend_string_release(lower);
return ops;
}
@@ -115,21 +115,24 @@ PHP_HASH_API int php_hash_copy(const void *ops, void *orig_context, void *dest_c
static void php_hash_do_hash(INTERNAL_FUNCTION_PARAMETERS, int isfilename, zend_bool raw_output_default) /* {{{ */
{
- zend_string *digest;
- char *algo, *data;
- size_t algo_len, data_len;
+ zend_string *digest, *algo;
+ char *data;
+ size_t data_len;
zend_bool raw_output = raw_output_default;
const php_hash_ops *ops;
void *context;
php_stream *stream = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|b", &algo, &algo_len, &data, &data_len, &raw_output) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 3)
+ Z_PARAM_STR(algo)
+ Z_PARAM_STRING(data, data_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_BOOL(raw_output)
+ ZEND_PARSE_PARAMETERS_END();
- ops = php_hash_fetch_ops(algo, algo_len);
+ ops = php_hash_fetch_ops(algo);
if (!ops) {
- php_error_docref(NULL, E_WARNING, "Unknown hashing algorithm: %s", algo);
+ php_error_docref(NULL, E_WARNING, "Unknown hashing algorithm: %s", ZSTR_VAL(algo));
RETURN_FALSE;
}
if (isfilename) {
@@ -236,34 +239,34 @@ static inline void php_hash_hmac_round(unsigned char *final, const php_hash_ops
static void php_hash_do_hash_hmac(INTERNAL_FUNCTION_PARAMETERS, int isfilename, zend_bool raw_output_default) /* {{{ */
{
- zend_string *digest;
- char *algo, *data, *key;
+ zend_string *digest, *algo;
+ char *data, *key;
unsigned char *K;
- size_t algo_len, data_len, key_len;
+ size_t data_len, key_len;
zend_bool raw_output = raw_output_default;
const php_hash_ops *ops;
void *context;
php_stream *stream = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "sss|b", &algo, &algo_len, &data, &data_len,
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sss|b", &algo, &data, &data_len,
&key, &key_len, &raw_output) == FAILURE) {
- return;
+ RETURN_THROWS();
}
- ops = php_hash_fetch_ops(algo, algo_len);
+ ops = php_hash_fetch_ops(algo);
if (!ops) {
- php_error_docref(NULL, E_WARNING, "Unknown hashing algorithm: %s", algo);
- RETURN_FALSE;
+ zend_throw_error(NULL, "Unknown hashing algorithm: %s", ZSTR_VAL(algo));
+ RETURN_THROWS();
}
else if (!ops->is_crypto) {
- php_error_docref(NULL, E_WARNING, "Non-cryptographic hashing algorithm: %s", algo);
- RETURN_FALSE;
+ zend_throw_error(NULL, "Non-cryptographic hashing algorithm: %s", ZSTR_VAL(algo));
+ RETURN_THROWS();
}
if (isfilename) {
if (CHECK_NULL_PATH(data, data_len)) {
- php_error_docref(NULL, E_WARNING, "Invalid path");
- RETURN_FALSE;
+ zend_throw_error(NULL, "Invalid path");
+ RETURN_THROWS();
}
stream = php_stream_open_wrapper_ex(data, "rb", REPORT_ERRORS, NULL, FG(default_context));
if (!stream) {
@@ -353,24 +356,24 @@ PHP_FUNCTION(hash_init)
php_hashcontext_object *hash;
if (zend_parse_parameters(argc, "S|lS", &algo, &options, &key) == FAILURE) {
- RETURN_NULL();
+ RETURN_THROWS();
}
- ops = php_hash_fetch_ops(ZSTR_VAL(algo), ZSTR_LEN(algo));
+ ops = php_hash_fetch_ops(algo);
if (!ops) {
- php_error_docref(NULL, E_WARNING, "Unknown hashing algorithm: %s", ZSTR_VAL(algo));
- RETURN_FALSE;
+ zend_throw_error(NULL, "Unknown hashing algorithm: %s", ZSTR_VAL(algo));
+ RETURN_THROWS();
}
if (options & PHP_HASH_HMAC) {
if (!ops->is_crypto) {
- php_error_docref(NULL, E_WARNING, "HMAC requested with a non-cryptographic hashing algorithm: %s", ZSTR_VAL(algo));
- RETURN_FALSE;
+ zend_throw_error(NULL, "HMAC requested with a non-cryptographic hashing algorithm: %s", ZSTR_VAL(algo));
+ RETURN_THROWS();
}
if (!key || (ZSTR_LEN(key) == 0)) {
/* Note: a zero length key is no key at all */
- php_error_docref(NULL, E_WARNING, "HMAC requested without a key");
- RETURN_FALSE;
+ zend_throw_error(NULL, "HMAC requested without a key");
+ RETURN_THROWS();
}
}
@@ -414,8 +417,8 @@ PHP_FUNCTION(hash_init)
#define PHP_HASHCONTEXT_VERIFY(func, hash) { \
if (!hash->context) { \
- php_error(E_WARNING, "%s(): supplied resource is not a valid Hash Context resource", func); \
- RETURN_NULL(); \
+ zend_throw_error(NULL, "%s(): supplied resource is not a valid Hash Context resource", func); \
+ RETURN_THROWS(); \
} \
}
@@ -428,7 +431,7 @@ PHP_FUNCTION(hash_update)
zend_string *data;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "OS", &zhash, php_hashcontext_ce, &data) == FAILURE) {
- return;
+ RETURN_THROWS();
}
hash = php_hashcontext_from_object(Z_OBJ_P(zhash));
@@ -449,7 +452,7 @@ PHP_FUNCTION(hash_update_stream)
zend_long length = -1, didread = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Or|l", &zhash, php_hashcontext_ce, &zstream, &length) == FAILURE) {
- return;
+ RETURN_THROWS();
}
hash = php_hashcontext_from_object(Z_OBJ_P(zhash));
@@ -490,7 +493,7 @@ PHP_FUNCTION(hash_update_file)
ssize_t n;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "OP|r", &zhash, php_hashcontext_ce, &filename, &zcontext) == FAILURE) {
- return;
+ RETURN_THROWS();
}
hash = php_hashcontext_from_object(Z_OBJ_P(zhash));
@@ -523,7 +526,7 @@ PHP_FUNCTION(hash_final)
size_t digest_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O|b", &zhash, php_hashcontext_ce, &raw_output) == FAILURE) {
- return;
+ RETURN_THROWS();
}
hash = php_hashcontext_from_object(Z_OBJ_P(zhash));
@@ -541,7 +544,7 @@ PHP_FUNCTION(hash_final)
hash->key[i] ^= 0x6A;
}
- /* Feed this result into the outter hash */
+ /* Feed this result into the outer hash */
hash->ops->hash_init(hash->context);
hash->ops->hash_update(hash->context, hash->key, hash->ops->block_size);
hash->ops->hash_update(hash->context, (unsigned char *) ZSTR_VAL(digest), hash->ops->digest_size);
@@ -578,14 +581,16 @@ PHP_FUNCTION(hash_copy)
zval *zhash;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &zhash, php_hashcontext_ce) == FAILURE) {
- return;
+ RETURN_THROWS();
}
- RETVAL_OBJ(Z_OBJ_HANDLER_P(zhash, clone_obj)(zhash));
+ RETVAL_OBJ(Z_OBJ_HANDLER_P(zhash, clone_obj)(Z_OBJ_P(zhash)));
if (php_hashcontext_from_object(Z_OBJ_P(return_value))->context == NULL) {
zval_ptr_dtor(return_value);
- RETURN_FALSE;
+
+ zend_throw_error(NULL, "Cannot copy hash");
+ RETURN_THROWS();
}
}
/* }}} */
@@ -596,6 +601,10 @@ PHP_FUNCTION(hash_algos)
{
zend_string *str;
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
array_init(return_value);
ZEND_HASH_FOREACH_STR_KEY(&php_hash_hashtable, str) {
add_next_index_str(return_value, zend_string_copy(str));
@@ -610,6 +619,10 @@ PHP_FUNCTION(hash_hmac_algos)
zend_string *str;
const php_hash_ops *ops;
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
array_init(return_value);
ZEND_HASH_FOREACH_STR_KEY_PTR(&php_hash_hashtable, str, ops) {
if (ops->is_crypto) {
@@ -632,33 +645,33 @@ PHP_FUNCTION(hash_hkdf)
void *context;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS|lSS", &algo, &ikm, &length, &info, &salt) == FAILURE) {
- return;
+ RETURN_THROWS();
}
- ops = php_hash_fetch_ops(ZSTR_VAL(algo), ZSTR_LEN(algo));
+ ops = php_hash_fetch_ops(algo);
if (!ops) {
- php_error_docref(NULL, E_WARNING, "Unknown hashing algorithm: %s", ZSTR_VAL(algo));
- RETURN_FALSE;
+ zend_throw_error(NULL, "Unknown hashing algorithm: %s", ZSTR_VAL(algo));
+ RETURN_THROWS();
}
if (!ops->is_crypto) {
- php_error_docref(NULL, E_WARNING, "Non-cryptographic hashing algorithm: %s", ZSTR_VAL(algo));
- RETURN_FALSE;
+ zend_throw_error(NULL, "Non-cryptographic hashing algorithm: %s", ZSTR_VAL(algo));
+ RETURN_THROWS();
}
if (ZSTR_LEN(ikm) == 0) {
- php_error_docref(NULL, E_WARNING, "Input keying material cannot be empty");
- RETURN_FALSE;
+ zend_throw_error(NULL, "Input keying material cannot be empty");
+ RETURN_THROWS();
}
if (length < 0) {
- php_error_docref(NULL, E_WARNING, "Length must be greater than or equal to 0: " ZEND_LONG_FMT, length);
- RETURN_FALSE;
+ zend_throw_error(NULL, "Length must be greater than or equal to 0: " ZEND_LONG_FMT, length);
+ RETURN_THROWS();
} else if (length == 0) {
length = ops->digest_size;
} else if (length > (zend_long) (ops->digest_size * 255)) {
- php_error_docref(NULL, E_WARNING, "Length must be less than or equal to %zd: " ZEND_LONG_FMT, ops->digest_size * 255, length);
- RETURN_FALSE;
+ zend_throw_error(NULL, "Length must be less than or equal to %zd: " ZEND_LONG_FMT, ops->digest_size * 255, length);
+ RETURN_THROWS();
}
context = emalloc(ops->context_size);
@@ -722,42 +735,42 @@ Generate a PBKDF2 hash of the given password and salt
Returns lowercase hexits by default */
PHP_FUNCTION(hash_pbkdf2)
{
- zend_string *returnval;
- char *algo, *salt, *pass = NULL;
+ zend_string *returnval, *algo;
+ char *salt, *pass = NULL;
unsigned char *computed_salt, *digest, *temp, *result, *K1, *K2 = NULL;
zend_long loops, i, j, iterations, digest_length = 0, length = 0;
- size_t algo_len, pass_len, salt_len = 0;
+ size_t pass_len, salt_len = 0;
zend_bool raw_output = 0;
const php_hash_ops *ops;
void *context;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "sssl|lb", &algo, &algo_len, &pass, &pass_len, &salt, &salt_len, &iterations, &length, &raw_output) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sssl|lb", &algo, &pass, &pass_len, &salt, &salt_len, &iterations, &length, &raw_output) == FAILURE) {
+ RETURN_THROWS();
}
- ops = php_hash_fetch_ops(algo, algo_len);
+ ops = php_hash_fetch_ops(algo);
if (!ops) {
- php_error_docref(NULL, E_WARNING, "Unknown hashing algorithm: %s", algo);
- RETURN_FALSE;
+ zend_throw_error(NULL, "Unknown hashing algorithm: %s", ZSTR_VAL(algo));
+ RETURN_THROWS();
}
else if (!ops->is_crypto) {
- php_error_docref(NULL, E_WARNING, "Non-cryptographic hashing algorithm: %s", algo);
- RETURN_FALSE;
+ zend_throw_error(NULL, "Non-cryptographic hashing algorithm: %s", ZSTR_VAL(algo));
+ RETURN_THROWS();
}
if (iterations <= 0) {
- php_error_docref(NULL, E_WARNING, "Iterations must be a positive integer: " ZEND_LONG_FMT, iterations);
- RETURN_FALSE;
+ zend_throw_error(NULL, "Iterations must be a positive integer: " ZEND_LONG_FMT, iterations);
+ RETURN_THROWS();
}
if (length < 0) {
- php_error_docref(NULL, E_WARNING, "Length must be greater than or equal to 0: " ZEND_LONG_FMT, length);
- RETURN_FALSE;
+ zend_throw_error(NULL, "Length must be greater than or equal to 0: " ZEND_LONG_FMT, length);
+ RETURN_THROWS();
}
if (salt_len > INT_MAX - 4) {
- php_error_docref(NULL, E_WARNING, "Supplied salt is too long, max of INT_MAX - 4 bytes: %zd supplied", salt_len);
- RETURN_FALSE;
+ zend_throw_error(NULL, "Supplied salt is too long, max of INT_MAX - 4 bytes: %zd supplied", salt_len);
+ RETURN_THROWS();
}
context = emalloc(ops->context_size);
@@ -857,18 +870,18 @@ PHP_FUNCTION(hash_equals)
size_t j;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &known_zval, &user_zval) == FAILURE) {
- return;
+ RETURN_THROWS();
}
/* We only allow comparing string to prevent unexpected results. */
if (Z_TYPE_P(known_zval) != IS_STRING) {
- php_error_docref(NULL, E_WARNING, "Expected known_string to be a string, %s given", zend_zval_type_name(known_zval));
- RETURN_FALSE;
+ zend_type_error("Expected known_string to be a string, %s given", zend_zval_type_name(known_zval));
+ RETURN_THROWS();
}
if (Z_TYPE_P(user_zval) != IS_STRING) {
- php_error_docref(NULL, E_WARNING, "Expected user_string to be a string, %s given", zend_zval_type_name(user_zval));
- RETURN_FALSE;
+ zend_type_error("Expected user_string to be a string, %s given", zend_zval_type_name(user_zval));
+ RETURN_THROWS();
}
if (Z_STRLEN_P(known_zval) != Z_STRLEN_P(user_zval)) {
@@ -957,7 +970,7 @@ PHP_FUNCTION(mhash)
zend_long algorithm;
if (zend_parse_parameters(1, "z", &z_algorithm) == FAILURE) {
- return;
+ RETURN_THROWS();
}
algorithm = zval_get_long(z_algorithm);
@@ -987,7 +1000,7 @@ PHP_FUNCTION(mhash_get_hash_name)
zend_long algorithm;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &algorithm) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (algorithm >= 0 && algorithm < MHASH_NUM_ALGOS) {
@@ -1005,7 +1018,7 @@ PHP_FUNCTION(mhash_get_hash_name)
PHP_FUNCTION(mhash_count)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_LONG(MHASH_NUM_ALGOS - 1);
}
@@ -1018,14 +1031,14 @@ PHP_FUNCTION(mhash_get_block_size)
zend_long algorithm;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &algorithm) == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETVAL_FALSE;
if (algorithm >= 0 && algorithm < MHASH_NUM_ALGOS) {
struct mhash_bc_entry algorithm_lookup = mhash_to_hash[algorithm];
if (algorithm_lookup.mhash_name) {
- const php_hash_ops *ops = php_hash_fetch_ops(algorithm_lookup.hash_name, strlen(algorithm_lookup.hash_name));
+ const php_hash_ops *ops = zend_hash_str_find_ptr(&php_hash_hashtable, algorithm_lookup.hash_name, strlen(algorithm_lookup.hash_name));
if (ops) {
RETVAL_LONG(ops->digest_size);
}
@@ -1047,12 +1060,12 @@ PHP_FUNCTION(mhash_keygen_s2k)
char padded_salt[SALT_SIZE];
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lssl", &algorithm, &password, &password_len, &salt, &salt_len, &l_bytes) == FAILURE) {
- return;
+ RETURN_THROWS();
}
bytes = (int)l_bytes;
if (bytes <= 0){
- php_error_docref(NULL, E_WARNING, "the byte parameter must be greater than 0");
+ php_error_docref(NULL, E_WARNING, "The byte parameter must be greater than 0");
RETURN_FALSE;
}
@@ -1068,7 +1081,7 @@ PHP_FUNCTION(mhash_keygen_s2k)
if (algorithm >= 0 && algorithm < MHASH_NUM_ALGOS) {
struct mhash_bc_entry algorithm_lookup = mhash_to_hash[algorithm];
if (algorithm_lookup.mhash_name) {
- const php_hash_ops *ops = php_hash_fetch_ops(algorithm_lookup.hash_name, strlen(algorithm_lookup.hash_name));
+ const php_hash_ops *ops = zend_hash_str_find_ptr(&php_hash_hashtable, algorithm_lookup.hash_name, strlen(algorithm_lookup.hash_name));
if (ops) {
unsigned char null = '\0';
void *context;
@@ -1149,12 +1162,12 @@ static void php_hashcontext_dtor(zend_object *obj) {
/* }}} */
/* {{{ php_hashcontext_clone */
-static zend_object *php_hashcontext_clone(zval *pzv) {
- php_hashcontext_object *oldobj = php_hashcontext_from_object(Z_OBJ_P(pzv));
- zend_object *znew = php_hashcontext_create(Z_OBJCE_P(pzv));
+static zend_object *php_hashcontext_clone(zend_object *zobj) {
+ php_hashcontext_object *oldobj = php_hashcontext_from_object(zobj);
+ zend_object *znew = php_hashcontext_create(zobj->ce);
php_hashcontext_object *newobj = php_hashcontext_from_object(znew);
- zend_objects_clone_members(znew, Z_OBJ_P(pzv));
+ zend_objects_clone_members(znew, zobj);
newobj->ops = oldobj->ops;
newobj->options = oldobj->options;
@@ -1302,143 +1315,6 @@ PHP_MINFO_FUNCTION(hash)
}
/* }}} */
-/* {{{ arginfo */
-#ifdef PHP_HASH_MD5_NOT_IN_CORE
-ZEND_BEGIN_ARG_INFO_EX(arginfo_hash_md5, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, raw_output)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_hash_md5_file, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, raw_output)
-ZEND_END_ARG_INFO()
-#endif
-
-#ifdef PHP_HASH_SHA1_NOT_IN_CORE
-ZEND_BEGIN_ARG_INFO_EX(arginfo_hash_sha1, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, raw_output)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_hash_sha1_file, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, raw_output)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_hash, 0, 0, 2)
- ZEND_ARG_INFO(0, algo)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, raw_output)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_hash_file, 0, 0, 2)
- ZEND_ARG_INFO(0, algo)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, raw_output)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_hash_hmac, 0, 0, 3)
- ZEND_ARG_INFO(0, algo)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, raw_output)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_hash_hmac_file, 0, 0, 3)
- ZEND_ARG_INFO(0, algo)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, raw_output)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_hash_init, 0, 0, 1)
- ZEND_ARG_INFO(0, algo)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_hash_update, 0)
- ZEND_ARG_INFO(0, context)
- ZEND_ARG_INFO(0, data)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_hash_update_stream, 0, 0, 2)
- ZEND_ARG_INFO(0, context)
- ZEND_ARG_INFO(0, handle)
- ZEND_ARG_INFO(0, length)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_hash_update_file, 0, 0, 2)
- ZEND_ARG_INFO(0, context)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, stream_context)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_hash_final, 0, 0, 1)
- ZEND_ARG_INFO(0, context)
- ZEND_ARG_INFO(0, raw_output)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_hash_copy, 0)
- ZEND_ARG_INFO(0, context)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_hash_algos, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_hash_pbkdf2, 0, 0, 4)
- ZEND_ARG_INFO(0, algo)
- ZEND_ARG_INFO(0, password)
- ZEND_ARG_INFO(0, salt)
- ZEND_ARG_INFO(0, iterations)
- ZEND_ARG_INFO(0, length)
- ZEND_ARG_INFO(0, raw_output)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_hash_equals, 0)
- ZEND_ARG_INFO(0, known_string)
- ZEND_ARG_INFO(0, user_string)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_hash_hkdf, 0, 0, 2)
- ZEND_ARG_INFO(0, ikm)
- ZEND_ARG_INFO(0, algo)
- ZEND_ARG_INFO(0, length)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, salt)
-ZEND_END_ARG_INFO()
-
-/* BC Land */
-#ifdef PHP_MHASH_BC
-ZEND_BEGIN_ARG_INFO(arginfo_mhash_get_block_size, 0)
- ZEND_ARG_INFO(0, hash)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_mhash_get_hash_name, 0)
- ZEND_ARG_INFO(0, hash)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_mhash_keygen_s2k, 0)
- ZEND_ARG_INFO(0, hash)
- ZEND_ARG_INFO(0, input_password)
- ZEND_ARG_INFO(0, salt)
- ZEND_ARG_INFO(0, bytes)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_mhash_count, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mhash, 0, 0, 2)
- ZEND_ARG_INFO(0, hash)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO()
-#endif
-
-/* }}} */
-
/* {{{ hash_functions[]
*/
static const zend_function_entry hash_functions[] = {
@@ -1456,22 +1332,11 @@ static const zend_function_entry hash_functions[] = {
PHP_FE(hash_copy, arginfo_hash_copy)
PHP_FE(hash_algos, arginfo_hash_algos)
- PHP_FE(hash_hmac_algos, arginfo_hash_algos)
+ PHP_FE(hash_hmac_algos, arginfo_hash_hmac_algos)
PHP_FE(hash_pbkdf2, arginfo_hash_pbkdf2)
PHP_FE(hash_equals, arginfo_hash_equals)
PHP_FE(hash_hkdf, arginfo_hash_hkdf)
- /* BC Land */
-#ifdef PHP_HASH_MD5_NOT_IN_CORE
- PHP_NAMED_FE(md5, php_if_md5, arginfo_hash_md5)
- PHP_NAMED_FE(md5_file, php_if_md5_file, arginfo_hash_md5_file)
-#endif /* PHP_HASH_MD5_NOT_IN_CORE */
-
-#ifdef PHP_HASH_SHA1_NOT_IN_CORE
- PHP_NAMED_FE(sha1, php_if_sha1, arginfo_hash_sha1)
- PHP_NAMED_FE(sha1_file, php_if_sha1_file, arginfo_hash_sha1_file)
-#endif /* PHP_HASH_SHA1_NOT_IN_CORE */
-
#ifdef PHP_MHASH_BC
PHP_FE(mhash_keygen_s2k, arginfo_mhash_keygen_s2k)
PHP_FE(mhash_get_block_size, arginfo_mhash_get_block_size)
diff --git a/ext/hash/hash.stub.php b/ext/hash/hash.stub.php
new file mode 100644
index 0000000000..f17084db1d
--- /dev/null
+++ b/ext/hash/hash.stub.php
@@ -0,0 +1,53 @@
+<?php
+
+function hash(string $algo, string $data, bool $raw_output = false): string|false {}
+
+function hash_file(string $algo, string $filename, bool $raw_output = false): string|false {}
+
+function hash_hmac(string $algo, string $data, string $key, bool $raw_output = false): string|false {}
+
+function hash_hmac_file(string $algo, string $data, string $key, bool $raw_output = false): string|false {}
+
+function hash_init(string $algo, int $options = 0, string $key = UNKNOWN): HashContext {}
+
+function hash_update(HashContext $context, string $data): bool {}
+
+/** @param resource $handle */
+function hash_update_stream(HashContext $context, $handle, int $length = -1): int {}
+
+/** @param resource $stream_context */
+function hash_update_file(HashContext $context, string $filename, $stream_context = UNKNOWN): bool {}
+
+function hash_final(HashContext $context, bool $raw_output = false): string {}
+
+function hash_copy(HashContext $context): HashContext {}
+
+function hash_algos(): array {}
+
+function hash_hmac_algos(): array {}
+
+function hash_pbkdf2(string $algo, string $password, string $salt, int $iterations, int $length = 0, bool $raw_output = false): string {}
+
+/**
+ * @param $known_string no type juggling is performed
+ * @param $user_string no type juggling is performed
+ */
+function hash_equals(string $known_string, string $user_string): bool {}
+
+function hash_hkdf(string $algo, string $ikm, int $length = 0, string $info = '', string $salt = ''): string {}
+
+#ifdef PHP_MHASH_BC
+function mhash_get_block_size(int $hash): int|false {}
+
+function mhash_get_hash_name(int $hash): string|false {}
+
+function mhash_keygen_s2k(int $hash, string $input_password, string $salt, int $bytes): string|false {}
+
+function mhash_count(): int {}
+
+function mhash(int $hash, string $data, string $key = UNKNOWN): string|false {}
+#endif
+
+class HashContext {
+ private function __construct() {}
+}
diff --git a/ext/hash/hash_adler32.c b/ext/hash/hash_adler32.c
index 12bc44e446..8d2d2fcb93 100644
--- a/ext/hash/hash_adler32.c
+++ b/ext/hash/hash_adler32.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/hash/hash_arginfo.h b/ext/hash/hash_arginfo.h
new file mode 100644
index 0000000000..27083f35bd
--- /dev/null
+++ b/ext/hash/hash_arginfo.h
@@ -0,0 +1,118 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_hash, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, raw_output, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_hash_file, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, raw_output, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_hash_hmac, 0, 3, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, raw_output, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_hash_hmac_file arginfo_hash_hmac
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_hash_init, 0, 1, HashContext, 0)
+ ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash_update, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, context, HashContext, 0)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash_update_stream, 0, 2, IS_LONG, 0)
+ ZEND_ARG_OBJ_INFO(0, context, HashContext, 0)
+ ZEND_ARG_INFO(0, handle)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash_update_file, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, context, HashContext, 0)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_INFO(0, stream_context)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash_final, 0, 1, IS_STRING, 0)
+ ZEND_ARG_OBJ_INFO(0, context, HashContext, 0)
+ ZEND_ARG_TYPE_INFO(0, raw_output, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_hash_copy, 0, 1, HashContext, 0)
+ ZEND_ARG_OBJ_INFO(0, context, HashContext, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash_algos, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_hash_hmac_algos arginfo_hash_algos
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash_pbkdf2, 0, 4, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, salt, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, iterations, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, raw_output, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash_equals, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, known_string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, user_string, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash_hkdf, 0, 2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, ikm, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, info, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, salt, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(PHP_MHASH_BC)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mhash_get_block_size, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, hash, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(PHP_MHASH_BC)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mhash_get_hash_name, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, hash, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(PHP_MHASH_BC)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mhash_keygen_s2k, 0, 4, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, hash, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, input_password, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, salt, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, bytes, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(PHP_MHASH_BC)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mhash_count, 0, 0, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(PHP_MHASH_BC)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mhash, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, hash, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_HashContext___construct, 0, 0, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/hash/hash_crc32.c b/ext/hash/hash_crc32.c
index 95f3600dca..52c67717ff 100644
--- a/ext/hash/hash_crc32.c
+++ b/ext/hash/hash_crc32.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/hash/hash_fnv.c b/ext/hash/hash_fnv.c
index 0ebe867b49..976c53b527 100644
--- a/ext/hash/hash_fnv.c
+++ b/ext/hash/hash_fnv.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/hash/hash_gost.c b/ext/hash/hash_gost.c
index ded6d1c6a7..a9e689de16 100644
--- a/ext/hash/hash_gost.c
+++ b/ext/hash/hash_gost.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -291,8 +289,7 @@ PHP_HASH_API void PHP_GOSTFinal(unsigned char digest[32], PHP_GOST_CTX *context)
GostTransform(context, context->buffer);
}
- l[0] = context->count[0];
- l[1] = context->count[1];
+ memcpy(l, context->count, sizeof(context->count));
Gost(context, l);
memcpy(l, &context->state[8], sizeof(l));
Gost(context, l);
diff --git a/ext/hash/hash_haval.c b/ext/hash/hash_haval.c
index af2991e667..92e48669ae 100644
--- a/ext/hash/hash_haval.c
+++ b/ext/hash/hash_haval.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/hash/hash_joaat.c b/ext/hash/hash_joaat.c
index fe04ed9cf2..d6311e81de 100644
--- a/ext/hash/hash_joaat.c
+++ b/ext/hash/hash_joaat.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/hash/hash_md.c b/ext/hash/hash_md.c
index 497c7d9d8d..e5cbb49b01 100644
--- a/ext/hash/hash_md.c
+++ b/ext/hash/hash_md.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -92,355 +90,6 @@ static void Decode(uint32_t *output, const unsigned char *input, unsigned int le
}
/* }}} */
-#ifdef PHP_HASH_MD5_NOT_IN_CORE
-
-/* MD5 */
-
-PHP_HASH_API void make_digest(char *md5str, unsigned char *digest)
-{
- php_hash_bin2hex(md5str, digest, 16);
- md5str[32] = '\0';
-}
-
-/* {{{ proto string md5(string str, [ bool raw_output])
- Calculate the md5 hash of a string */
-PHP_NAMED_FUNCTION(php_if_md5)
-{
- char *arg;
- size_t arg_len;
- zend_bool raw_output = 0;
- PHP_MD5_CTX context;
- unsigned char digest[16];
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|b", &arg, &arg_len, &raw_output) == FAILURE) {
- return;
- }
-
- PHP_MD5Init(&context);
- PHP_MD5Update(&context, arg, arg_len);
- PHP_MD5Final(digest, &context);
- if (raw_output) {
- RETURN_STRINGL(digest, 16);
- } else {
- RETVAL_NEW_STR(zend_string_alloc(32, 0));
- make_digest(Z_STRVAL_P(return_value), digest);
- }
-
-}
-/* }}} */
-
-/* {{{ proto string md5_file(string filename [, bool raw_output])
- Calculate the md5 hash of given filename */
-PHP_NAMED_FUNCTION(php_if_md5_file)
-{
- char *arg;
- size_t arg_len;
- zend_bool raw_output = 0;
- unsigned char buf[1024];
- unsigned char digest[16];
- PHP_MD5_CTX context;
- int n;
- php_stream *stream;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|b", &arg, &arg_len, &raw_output) == FAILURE) {
- return;
- }
-
- stream = php_stream_open_wrapper(arg, "rb", REPORT_ERRORS, NULL);
- if (!stream) {
- RETURN_FALSE;
- }
-
- PHP_MD5Init(&context);
-
- while ((n = php_stream_read(stream, buf, sizeof(buf))) > 0) {
- PHP_MD5Update(&context, buf, n);
- }
-
- PHP_MD5Final(digest, &context);
-
- php_stream_close(stream);
-
- if (n<0) {
- RETURN_FALSE;
- }
-
- if (raw_output) {
- RETURN_STRINGL(digest, 16);
- } else {
- RETVAL_NEW_STR(zend_string_alloc(32, 0));
- make_digest(Z_STRVAL_P(return_value), digest);
- }
-}
-/* }}} */
-
-/*
- * The remaining code is the reference MD5 code (md5c.c) from rfc1321
- */
-/* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm
- */
-
-/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
- rights reserved.
-
- License to copy and use this software is granted provided that it
- is identified as the "RSA Data Security, Inc. MD5 Message-Digest
- Algorithm" in all material mentioning or referencing this software
- or this function.
-
- License is also granted to make and use derivative works provided
- that such works are identified as "derived from the RSA Data
- Security, Inc. MD5 Message-Digest Algorithm" in all material
- mentioning or referencing the derived work.
-
- RSA Data Security, Inc. makes no representations concerning either
- the merchantability of this software or the suitability of this
- software for any particular purpose. It is provided "as is"
- without express or implied warranty of any kind.
-
- These notices must be retained in any copies of any part of this
- documentation and/or software.
- */
-
-/* Constants for MD5Transform routine.
- */
-
-#define S11 7
-#define S12 12
-#define S13 17
-#define S14 22
-#define S21 5
-#define S22 9
-#define S23 14
-#define S24 20
-#define S31 4
-#define S32 11
-#define S33 16
-#define S34 23
-#define S41 6
-#define S42 10
-#define S43 15
-#define S44 21
-
-static void MD5Transform(uint32_t[4], const unsigned char[64]);
-
-/* F, G, H and I are basic MD5 functions.
- */
-#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
-#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
-#define H(x, y, z) ((x) ^ (y) ^ (z))
-#define I(x, y, z) ((y) ^ ((x) | (~z)))
-
-/* ROTATE_LEFT rotates x left n bits.
- */
-#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
-
-/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
- Rotation is separate from addition to prevent recomputation.
- */
-#define FF(a, b, c, d, x, s, ac) { \
- (a) += F ((b), (c), (d)) + (x) + (uint32_t)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-#define GG(a, b, c, d, x, s, ac) { \
- (a) += G ((b), (c), (d)) + (x) + (uint32_t)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-#define HH(a, b, c, d, x, s, ac) { \
- (a) += H ((b), (c), (d)) + (x) + (uint32_t)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-#define II(a, b, c, d, x, s, ac) { \
- (a) += I ((b), (c), (d)) + (x) + (uint32_t)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-
-/* {{{ PHP_MD5Init
- * MD5 initialization. Begins an MD5 operation, writing a new context.
- */
-PHP_HASH_API void PHP_MD5Init(PHP_MD5_CTX * context)
-{
- context->count[0] = context->count[1] = 0;
- /* Load magic initialization constants.
- */
- context->state[0] = 0x67452301;
- context->state[1] = 0xefcdab89;
- context->state[2] = 0x98badcfe;
- context->state[3] = 0x10325476;
-}
-/* }}} */
-
-/* {{{ PHP_MD5Update
- MD5 block update operation. Continues an MD5 message-digest
- operation, processing another message block, and updating the
- context.
- */
-PHP_HASH_API void PHP_MD5Update(PHP_MD5_CTX * context, const unsigned char *input,
- size_t inputLen)
-{
- unsigned int i, index, partLen;
-
- /* Compute number of bytes mod 64 */
- index = (unsigned int) ((context->count[0] >> 3) & 0x3F);
-
- /* Update number of bits */
- if ((context->count[0] += ((uint32_t) inputLen << 3))
- < ((uint32_t) inputLen << 3))
- context->count[1]++;
- context->count[1] += ((uint32_t) inputLen >> 29);
-
- partLen = 64 - index;
-
- /* Transform as many times as possible.
- */
- if (inputLen >= partLen) {
- memcpy
- ((unsigned char*) & context->buffer[index], (unsigned char*) input, partLen);
- MD5Transform(context->state, context->buffer);
-
- for (i = partLen; i + 63 < inputLen; i += 64)
- MD5Transform(context->state, &input[i]);
-
- index = 0;
- } else
- i = 0;
-
- /* Buffer remaining input */
- memcpy
- ((unsigned char*) & context->buffer[index], (unsigned char*) & input[i],
- inputLen - i);
-}
-/* }}} */
-
-/* {{{ PHP_MD5Final
- MD5 finalization. Ends an MD5 message-digest operation, writing the
- the message digest and zeroizing the context.
- */
-PHP_HASH_API void PHP_MD5Final(unsigned char digest[16], PHP_MD5_CTX * context)
-{
- unsigned char bits[8];
- unsigned int index, padLen;
-
- /* Save number of bits */
- Encode(bits, context->count, 8);
-
- /* Pad out to 56 mod 64.
- */
- index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
- padLen = (index < 56) ? (56 - index) : (120 - index);
- PHP_MD5Update(context, PADDING, padLen);
-
- /* Append length (before padding) */
- PHP_MD5Update(context, bits, 8);
-
- /* Store state in digest */
- Encode(digest, context->state, 16);
-
- /* Zeroize sensitive information.
- */
- ZEND_SECURE_ZERO((unsigned char*) context, sizeof(*context));
-}
-/* }}} */
-
-/* {{{ MD5Transform
- * MD5 basic transformation. Transforms state based on block.
- */
-static void MD5Transform(state, block)
-uint32_t state[4];
-const unsigned char block[64];
-{
- uint32_t a = state[0], b = state[1], c = state[2], d = state[3], x[16];
-
- Decode(x, block, 64);
-
- /* Round 1 */
- FF(a, b, c, d, x[0], S11, 0xd76aa478); /* 1 */
- FF(d, a, b, c, x[1], S12, 0xe8c7b756); /* 2 */
- FF(c, d, a, b, x[2], S13, 0x242070db); /* 3 */
- FF(b, c, d, a, x[3], S14, 0xc1bdceee); /* 4 */
- FF(a, b, c, d, x[4], S11, 0xf57c0faf); /* 5 */
- FF(d, a, b, c, x[5], S12, 0x4787c62a); /* 6 */
- FF(c, d, a, b, x[6], S13, 0xa8304613); /* 7 */
- FF(b, c, d, a, x[7], S14, 0xfd469501); /* 8 */
- FF(a, b, c, d, x[8], S11, 0x698098d8); /* 9 */
- FF(d, a, b, c, x[9], S12, 0x8b44f7af); /* 10 */
- FF(c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */
- FF(b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */
- FF(a, b, c, d, x[12], S11, 0x6b901122); /* 13 */
- FF(d, a, b, c, x[13], S12, 0xfd987193); /* 14 */
- FF(c, d, a, b, x[14], S13, 0xa679438e); /* 15 */
- FF(b, c, d, a, x[15], S14, 0x49b40821); /* 16 */
-
- /* Round 2 */
- GG(a, b, c, d, x[1], S21, 0xf61e2562); /* 17 */
- GG(d, a, b, c, x[6], S22, 0xc040b340); /* 18 */
- GG(c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */
- GG(b, c, d, a, x[0], S24, 0xe9b6c7aa); /* 20 */
- GG(a, b, c, d, x[5], S21, 0xd62f105d); /* 21 */
- GG(d, a, b, c, x[10], S22, 0x2441453); /* 22 */
- GG(c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */
- GG(b, c, d, a, x[4], S24, 0xe7d3fbc8); /* 24 */
- GG(a, b, c, d, x[9], S21, 0x21e1cde6); /* 25 */
- GG(d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */
- GG(c, d, a, b, x[3], S23, 0xf4d50d87); /* 27 */
- GG(b, c, d, a, x[8], S24, 0x455a14ed); /* 28 */
- GG(a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */
- GG(d, a, b, c, x[2], S22, 0xfcefa3f8); /* 30 */
- GG(c, d, a, b, x[7], S23, 0x676f02d9); /* 31 */
- GG(b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */
-
- /* Round 3 */
- HH(a, b, c, d, x[5], S31, 0xfffa3942); /* 33 */
- HH(d, a, b, c, x[8], S32, 0x8771f681); /* 34 */
- HH(c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */
- HH(b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */
- HH(a, b, c, d, x[1], S31, 0xa4beea44); /* 37 */
- HH(d, a, b, c, x[4], S32, 0x4bdecfa9); /* 38 */
- HH(c, d, a, b, x[7], S33, 0xf6bb4b60); /* 39 */
- HH(b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */
- HH(a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */
- HH(d, a, b, c, x[0], S32, 0xeaa127fa); /* 42 */
- HH(c, d, a, b, x[3], S33, 0xd4ef3085); /* 43 */
- HH(b, c, d, a, x[6], S34, 0x4881d05); /* 44 */
- HH(a, b, c, d, x[9], S31, 0xd9d4d039); /* 45 */
- HH(d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */
- HH(c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */
- HH(b, c, d, a, x[2], S34, 0xc4ac5665); /* 48 */
-
- /* Round 4 */
- II(a, b, c, d, x[0], S41, 0xf4292244); /* 49 */
- II(d, a, b, c, x[7], S42, 0x432aff97); /* 50 */
- II(c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */
- II(b, c, d, a, x[5], S44, 0xfc93a039); /* 52 */
- II(a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */
- II(d, a, b, c, x[3], S42, 0x8f0ccc92); /* 54 */
- II(c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */
- II(b, c, d, a, x[1], S44, 0x85845dd1); /* 56 */
- II(a, b, c, d, x[8], S41, 0x6fa87e4f); /* 57 */
- II(d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */
- II(c, d, a, b, x[6], S43, 0xa3014314); /* 59 */
- II(b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */
- II(a, b, c, d, x[4], S41, 0xf7537e82); /* 61 */
- II(d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */
- II(c, d, a, b, x[2], S43, 0x2ad7d2bb); /* 63 */
- II(b, c, d, a, x[9], S44, 0xeb86d391); /* 64 */
-
- state[0] += a;
- state[1] += b;
- state[2] += c;
- state[3] += d;
-
- /* Zeroize sensitive information. */
- ZEND_SECURE_ZERO((unsigned char*) x, sizeof(x));
-}
-/* }}} */
-
-#endif /* PHP_HASH_MD5_NOT_IN_CORE */
-
/* MD4 */
#define MD4_F(x,y,z) ((z) ^ ((x) & ((y) ^ (z))))
diff --git a/ext/hash/hash_ripemd.c b/ext/hash/hash_ripemd.c
index 083e6a9955..84a29f6486 100644
--- a/ext/hash/hash_ripemd.c
+++ b/ext/hash/hash_ripemd.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/hash/hash_sha.c b/ext/hash/hash_sha.c
index 4e0e1c1797..30ab0d22ad 100644
--- a/ext/hash/hash_sha.c
+++ b/ext/hash/hash_sha.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -75,333 +73,6 @@ const php_hash_ops php_hash_sha1_ops = {
1
};
-#ifdef PHP_HASH_SHA1_NOT_IN_CORE
-
-PHP_HASH_API void make_sha1_digest(char *sha1str, unsigned char *digest)
-{
- php_hash_bin2hex(sha1str, digest, 20);
- sha1str[40] = '\0';
-}
-
-/* {{{ proto string sha1(string str [, bool raw_output])
- Calculate the sha1 hash of a string */
-PHP_FUNCTION(sha1)
-{
- char *arg;
- size_t arg_len;
- zend_bool raw_output = 0;
- PHP_SHA1_CTX context;
- unsigned char digest[20];
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|b", &arg, &arg_len, &raw_output) == FAILURE) {
- return;
- }
-
- PHP_SHA1Init(&context);
- PHP_SHA1Update(&context, arg, arg_len);
- PHP_SHA1Final(digest, &context);
- if (raw_output) {
- RETURN_STRINGL(digest, 20);
- } else {
- RETVAL_NEW_STR(zend_string_alloc(40, 0));
- make_sha1_digest(Z_STRVAL_P(return_value), digest);
- }
-
-}
-
-/* }}} */
-
-/* {{{ proto string sha1_file(string filename [, bool raw_output])
- Calculate the sha1 hash of given filename */
-PHP_FUNCTION(sha1_file)
-{
- char *arg;
- size_t arg_len;
- zend_bool raw_output = 0;
- unsigned char buf[1024];
- unsigned char digest[20];
- PHP_SHA1_CTX context;
- int n;
- php_stream *stream;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|b", &arg, &arg_len, &raw_output) == FAILURE) {
- return;
- }
-
- stream = php_stream_open_wrapper(arg, "rb", REPORT_ERRORS, NULL);
- if (!stream) {
- RETURN_FALSE;
- }
-
- PHP_SHA1Init(&context);
-
- while ((n = php_stream_read(stream, buf, sizeof(buf))) > 0) {
- PHP_SHA1Update(&context, buf, n);
- }
-
- PHP_SHA1Final(digest, &context);
-
- php_stream_close(stream);
-
- if (n<0) {
- RETURN_FALSE;
- }
-
- if (raw_output) {
- RETURN_STRINGL(digest, 20);
- } else {
- RETVAL_NEW_STR(zend_string_alloc(40, 0));
- make_sha1_digest(Z_STRVAL_P(return_value), digest);
- }
-}
-/* }}} */
-
-/* F, G, H and I are basic SHA1 functions.
- */
-#define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z))))
-#define G(x, y, z) ((x) ^ (y) ^ (z))
-#define H(x, y, z) (((x) & (y)) | ((z) & ((x) | (y))))
-#define I(x, y, z) ((x) ^ (y) ^ (z))
-
-/* ROTATE_LEFT rotates x left n bits.
- */
-#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
-
-/* W[i]
- */
-#define W(i) ( tmp=x[(i-3)&15]^x[(i-8)&15]^x[(i-14)&15]^x[i&15], \
- (x[i&15]=ROTATE_LEFT(tmp, 1)) )
-
-/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
- */
-#define FF(a, b, c, d, e, w) { \
- (e) += F ((b), (c), (d)) + (w) + (uint32_t)(0x5A827999); \
- (e) += ROTATE_LEFT ((a), 5); \
- (b) = ROTATE_LEFT((b), 30); \
- }
-#define GG(a, b, c, d, e, w) { \
- (e) += G ((b), (c), (d)) + (w) + (uint32_t)(0x6ED9EBA1); \
- (e) += ROTATE_LEFT ((a), 5); \
- (b) = ROTATE_LEFT((b), 30); \
- }
-#define HH(a, b, c, d, e, w) { \
- (e) += H ((b), (c), (d)) + (w) + (uint32_t)(0x8F1BBCDC); \
- (e) += ROTATE_LEFT ((a), 5); \
- (b) = ROTATE_LEFT((b), 30); \
- }
-#define II(a, b, c, d, e, w) { \
- (e) += I ((b), (c), (d)) + (w) + (uint32_t)(0xCA62C1D6); \
- (e) += ROTATE_LEFT ((a), 5); \
- (b) = ROTATE_LEFT((b), 30); \
- }
-
-
-/* {{{ PHP_SHA1Init
- * SHA1 initialization. Begins an SHA1 operation, writing a new context.
- */
-PHP_HASH_API void PHP_SHA1Init(PHP_SHA1_CTX * context)
-{
- context->count[0] = context->count[1] = 0;
- /* Load magic initialization constants.
- */
- context->state[0] = 0x67452301;
- context->state[1] = 0xefcdab89;
- context->state[2] = 0x98badcfe;
- context->state[3] = 0x10325476;
- context->state[4] = 0xc3d2e1f0;
-}
-/* }}} */
-
-/* {{{ SHA1Transform
- * SHA1 basic transformation. Transforms state based on block.
- */
-static void SHA1Transform(uint32_t state[5], const unsigned char block[64])
-{
- uint32_t a = state[0], b = state[1], c = state[2];
- uint32_t d = state[3], e = state[4], x[16], tmp;
-
- SHADecode32(x, block, 64);
-
- /* Round 1 */
- FF(a, b, c, d, e, x[0]); /* 1 */
- FF(e, a, b, c, d, x[1]); /* 2 */
- FF(d, e, a, b, c, x[2]); /* 3 */
- FF(c, d, e, a, b, x[3]); /* 4 */
- FF(b, c, d, e, a, x[4]); /* 5 */
- FF(a, b, c, d, e, x[5]); /* 6 */
- FF(e, a, b, c, d, x[6]); /* 7 */
- FF(d, e, a, b, c, x[7]); /* 8 */
- FF(c, d, e, a, b, x[8]); /* 9 */
- FF(b, c, d, e, a, x[9]); /* 10 */
- FF(a, b, c, d, e, x[10]); /* 11 */
- FF(e, a, b, c, d, x[11]); /* 12 */
- FF(d, e, a, b, c, x[12]); /* 13 */
- FF(c, d, e, a, b, x[13]); /* 14 */
- FF(b, c, d, e, a, x[14]); /* 15 */
- FF(a, b, c, d, e, x[15]); /* 16 */
- FF(e, a, b, c, d, W(16)); /* 17 */
- FF(d, e, a, b, c, W(17)); /* 18 */
- FF(c, d, e, a, b, W(18)); /* 19 */
- FF(b, c, d, e, a, W(19)); /* 20 */
-
- /* Round 2 */
- GG(a, b, c, d, e, W(20)); /* 21 */
- GG(e, a, b, c, d, W(21)); /* 22 */
- GG(d, e, a, b, c, W(22)); /* 23 */
- GG(c, d, e, a, b, W(23)); /* 24 */
- GG(b, c, d, e, a, W(24)); /* 25 */
- GG(a, b, c, d, e, W(25)); /* 26 */
- GG(e, a, b, c, d, W(26)); /* 27 */
- GG(d, e, a, b, c, W(27)); /* 28 */
- GG(c, d, e, a, b, W(28)); /* 29 */
- GG(b, c, d, e, a, W(29)); /* 30 */
- GG(a, b, c, d, e, W(30)); /* 31 */
- GG(e, a, b, c, d, W(31)); /* 32 */
- GG(d, e, a, b, c, W(32)); /* 33 */
- GG(c, d, e, a, b, W(33)); /* 34 */
- GG(b, c, d, e, a, W(34)); /* 35 */
- GG(a, b, c, d, e, W(35)); /* 36 */
- GG(e, a, b, c, d, W(36)); /* 37 */
- GG(d, e, a, b, c, W(37)); /* 38 */
- GG(c, d, e, a, b, W(38)); /* 39 */
- GG(b, c, d, e, a, W(39)); /* 40 */
-
- /* Round 3 */
- HH(a, b, c, d, e, W(40)); /* 41 */
- HH(e, a, b, c, d, W(41)); /* 42 */
- HH(d, e, a, b, c, W(42)); /* 43 */
- HH(c, d, e, a, b, W(43)); /* 44 */
- HH(b, c, d, e, a, W(44)); /* 45 */
- HH(a, b, c, d, e, W(45)); /* 46 */
- HH(e, a, b, c, d, W(46)); /* 47 */
- HH(d, e, a, b, c, W(47)); /* 48 */
- HH(c, d, e, a, b, W(48)); /* 49 */
- HH(b, c, d, e, a, W(49)); /* 50 */
- HH(a, b, c, d, e, W(50)); /* 51 */
- HH(e, a, b, c, d, W(51)); /* 52 */
- HH(d, e, a, b, c, W(52)); /* 53 */
- HH(c, d, e, a, b, W(53)); /* 54 */
- HH(b, c, d, e, a, W(54)); /* 55 */
- HH(a, b, c, d, e, W(55)); /* 56 */
- HH(e, a, b, c, d, W(56)); /* 57 */
- HH(d, e, a, b, c, W(57)); /* 58 */
- HH(c, d, e, a, b, W(58)); /* 59 */
- HH(b, c, d, e, a, W(59)); /* 60 */
-
- /* Round 4 */
- II(a, b, c, d, e, W(60)); /* 61 */
- II(e, a, b, c, d, W(61)); /* 62 */
- II(d, e, a, b, c, W(62)); /* 63 */
- II(c, d, e, a, b, W(63)); /* 64 */
- II(b, c, d, e, a, W(64)); /* 65 */
- II(a, b, c, d, e, W(65)); /* 66 */
- II(e, a, b, c, d, W(66)); /* 67 */
- II(d, e, a, b, c, W(67)); /* 68 */
- II(c, d, e, a, b, W(68)); /* 69 */
- II(b, c, d, e, a, W(69)); /* 70 */
- II(a, b, c, d, e, W(70)); /* 71 */
- II(e, a, b, c, d, W(71)); /* 72 */
- II(d, e, a, b, c, W(72)); /* 73 */
- II(c, d, e, a, b, W(73)); /* 74 */
- II(b, c, d, e, a, W(74)); /* 75 */
- II(a, b, c, d, e, W(75)); /* 76 */
- II(e, a, b, c, d, W(76)); /* 77 */
- II(d, e, a, b, c, W(77)); /* 78 */
- II(c, d, e, a, b, W(78)); /* 79 */
- II(b, c, d, e, a, W(79)); /* 80 */
-
- state[0] += a;
- state[1] += b;
- state[2] += c;
- state[3] += d;
- state[4] += e;
-
- /* Zeroize sensitive information. */
- ZEND_SECURE_ZERO((unsigned char*) x, sizeof(x));
-}
-/* }}} */
-
-/* {{{ PHP_SHA1Update
- SHA1 block update operation. Continues an SHA1 message-digest
- operation, processing another message block, and updating the
- context.
- */
-PHP_HASH_API void PHP_SHA1Update(PHP_SHA1_CTX * context, const unsigned char *input,
- size_t inputLen)
-{
- unsigned int i, index, partLen;
-
- /* Compute number of bytes mod 64 */
- index = (unsigned int) ((context->count[0] >> 3) & 0x3F);
-
- /* Update number of bits */
- if ((context->count[0] += ((uint32_t) inputLen << 3))
- < ((uint32_t) inputLen << 3))
- context->count[1]++;
- context->count[1] += ((uint32_t) inputLen >> 29);
-
- partLen = 64 - index;
-
- /* Transform as many times as possible.
- */
- if (inputLen >= partLen) {
- memcpy
- ((unsigned char*) & context->buffer[index], (unsigned char*) input, partLen);
- SHA1Transform(context->state, context->buffer);
-
- for (i = partLen; i + 63 < inputLen; i += 64)
- SHA1Transform(context->state, &input[i]);
-
- index = 0;
- } else
- i = 0;
-
- /* Buffer remaining input */
- memcpy
- ((unsigned char*) & context->buffer[index], (unsigned char*) & input[i],
- inputLen - i);
-}
-/* }}} */
-
-/* {{{ PHP_SHA1Final
- SHA1 finalization. Ends an SHA1 message-digest operation, writing the
- the message digest and zeroizing the context.
- */
-PHP_HASH_API void PHP_SHA1Final(unsigned char digest[20], PHP_SHA1_CTX * context)
-{
- unsigned char bits[8];
- unsigned int index, padLen;
-
- /* Save number of bits */
- bits[7] = context->count[0] & 0xFF;
- bits[6] = (context->count[0] >> 8) & 0xFF;
- bits[5] = (context->count[0] >> 16) & 0xFF;
- bits[4] = (context->count[0] >> 24) & 0xFF;
- bits[3] = context->count[1] & 0xFF;
- bits[2] = (context->count[1] >> 8) & 0xFF;
- bits[1] = (context->count[1] >> 16) & 0xFF;
- bits[0] = (context->count[1] >> 24) & 0xFF;
-
- /* Pad out to 56 mod 64.
- */
- index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
- padLen = (index < 56) ? (56 - index) : (120 - index);
- PHP_SHA1Update(context, PADDING, padLen);
-
- /* Append length (before padding) */
- PHP_SHA1Update(context, bits, 8);
-
- /* Store state in digest */
- SHAEncode32(digest, context->state, 20);
-
- /* Zeroize sensitive information.
- */
- ZEND_SECURE_ZERO((unsigned char*) context, sizeof(*context));
-}
-/* }}} */
-
-#endif /* PHP_HASH_SHA1_NOT_IN_CORE */
-
/* sha224/sha256 */
const php_hash_ops php_hash_sha256_ops = {
diff --git a/ext/hash/hash_sha3.c b/ext/hash/hash_sha3.c
index 77cec630d8..85be0e85c9 100644
--- a/ext/hash/hash_sha3.c
+++ b/ext/hash/hash_sha3.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/hash/hash_snefru.c b/ext/hash/hash_snefru.c
index 867556acc5..fae767f2fe 100644
--- a/ext/hash/hash_snefru.c
+++ b/ext/hash/hash_snefru.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/hash/hash_tiger.c b/ext/hash/hash_tiger.c
index 4d126f0d8f..399e95af0e 100644
--- a/ext/hash/hash_tiger.c
+++ b/ext/hash/hash_tiger.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/hash/hash_whirlpool.c b/ext/hash/hash_whirlpool.c
index 3bd9bd13da..5be7f80eea 100644
--- a/ext/hash/hash_whirlpool.c
+++ b/ext/hash/hash_whirlpool.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/hash/php_hash.h b/ext/hash/php_hash.h
index 8e919e2a6f..f7cdaac305 100644
--- a/ext/hash/php_hash.h
+++ b/ext/hash/php_hash.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -144,7 +142,7 @@ PHP_FUNCTION(hash_pbkdf2);
PHP_FUNCTION(hash_equals);
extern PHP_HASH_API zend_class_entry *php_hashcontext_ce;
-PHP_HASH_API const php_hash_ops *php_hash_fetch_ops(const char *algo, size_t algo_len);
+PHP_HASH_API const php_hash_ops *php_hash_fetch_ops(zend_string *algo);
PHP_HASH_API void php_hash_register_algo(const char *algo, const php_hash_ops *ops);
PHP_HASH_API int php_hash_copy(const void *ops, void *orig_context, void *dest_context);
diff --git a/ext/hash/php_hash_adler32.h b/ext/hash/php_hash_adler32.h
index 63f32ab536..184091c971 100644
--- a/ext/hash/php_hash_adler32.h
+++ b/ext/hash/php_hash_adler32.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/hash/php_hash_crc32.h b/ext/hash/php_hash_crc32.h
index 6308b005e3..346011e417 100644
--- a/ext/hash/php_hash_crc32.h
+++ b/ext/hash/php_hash_crc32.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/hash/php_hash_crc32_tables.h b/ext/hash/php_hash_crc32_tables.h
index 8e2feccc01..6b342c83da 100644
--- a/ext/hash/php_hash_crc32_tables.h
+++ b/ext/hash/php_hash_crc32_tables.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/hash/php_hash_fnv.h b/ext/hash/php_hash_fnv.h
index f00a469423..1cb8c78d29 100644
--- a/ext/hash/php_hash_fnv.h
+++ b/ext/hash/php_hash_fnv.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/hash/php_hash_gost.h b/ext/hash/php_hash_gost.h
index 3837eeb263..987eb655cb 100644
--- a/ext/hash/php_hash_gost.h
+++ b/ext/hash/php_hash_gost.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -24,7 +22,7 @@
/* GOST context */
typedef struct {
uint32_t state[16];
- size_t count[2];
+ uint32_t count[2];
unsigned char length;
unsigned char buffer[32];
const uint32_t (*tables)[4][256];
diff --git a/ext/hash/php_hash_haval.h b/ext/hash/php_hash_haval.h
index 1188b79cc3..1033fd59dc 100644
--- a/ext/hash/php_hash_haval.h
+++ b/ext/hash/php_hash_haval.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/hash/php_hash_joaat.h b/ext/hash/php_hash_joaat.h
index b9e7e7a7ee..ede108f1bb 100644
--- a/ext/hash/php_hash_joaat.h
+++ b/ext/hash/php_hash_joaat.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/hash/php_hash_md.h b/ext/hash/php_hash_md.h
index 0073488c14..aed999261e 100644
--- a/ext/hash/php_hash_md.h
+++ b/ext/hash/php_hash_md.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -20,58 +18,8 @@
#ifndef PHP_HASH_MD_H
#define PHP_HASH_MD_H
-/* When SHA is removed from Core,
- the ext/standard/sha1.c file can be removed
- and the ext/standard/sha1.h file can be reduced to:
- #define PHP_HASH_SHA1_NOT_IN_CORE
- #include "ext/hash/php_hash_sha.h"
- Don't forget to remove md5() and md5_file() entries from basic_functions.c
- */
-
#include "ext/standard/md5.h"
-#ifdef PHP_HASH_MD5_NOT_IN_CORE
-/* MD5.H - header file for MD5C.C
- */
-
-/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
- rights reserved.
-
- License to copy and use this software is granted provided that it
- is identified as the "RSA Data Security, Inc. MD5 Message-Digest
- Algorithm" in all material mentioning or referencing this software
- or this function.
-
- License is also granted to make and use derivative works provided
- that such works are identified as "derived from the RSA Data
- Security, Inc. MD5 Message-Digest Algorithm" in all material
- mentioning or referencing the derived work.
-
- RSA Data Security, Inc. makes no representations concerning either
- the merchantability of this software or the suitability of this
- software for any particular purpose. It is provided "as is"
- without express or implied warranty of any kind.
-
- These notices must be retained in any copies of any part of this
- documentation and/or software.
- */
-
-/* MD5 context. */
-typedef struct {
- uint32_t state[4]; /* state (ABCD) */
- uint32_t count[2]; /* number of bits, modulo 2^64 (lsb first) */
- unsigned char buffer[64]; /* input buffer */
-} PHP_MD5_CTX;
-
-PHP_HASH_API void make_digest(char *md5str, unsigned char *digest);
-PHP_HASH_API void PHP_MD5Init(PHP_MD5_CTX *);
-PHP_HASH_API void PHP_MD5Update(PHP_MD5_CTX *, const unsigned char *, size_t);
-PHP_HASH_API void PHP_MD5Final(unsigned char[16], PHP_MD5_CTX *);
-
-PHP_NAMED_FUNCTION(php_if_md5);
-PHP_NAMED_FUNCTION(php_if_md5_file);
-#endif /* PHP_HASH_MD5_NOT_IN_CORE */
-
/* MD4 context */
typedef struct {
uint32_t state[4];
diff --git a/ext/hash/php_hash_ripemd.h b/ext/hash/php_hash_ripemd.h
index e8f1678166..131dd0ad8f 100644
--- a/ext/hash/php_hash_ripemd.h
+++ b/ext/hash/php_hash_ripemd.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/hash/php_hash_sha.h b/ext/hash/php_hash_sha.h
index 4903f8d8b2..95471e7398 100644
--- a/ext/hash/php_hash_sha.h
+++ b/ext/hash/php_hash_sha.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -20,34 +18,9 @@
#ifndef PHP_HASH_SHA_H
#define PHP_HASH_SHA_H
-/* When SHA is removed from Core,
- the ext/standard/sha1.c file can be removed
- and the ext/standard/sha1.h file can be reduced to:
- #define PHP_HASH_SHA1_NOT_IN_CORE
- #include "ext/hash/php_hash_sha.h"
- Don't forget to remove sha1() and sha1_file() from basic_functions.c
- */
#include "ext/standard/sha1.h"
#include "ext/standard/basic_functions.h"
-#ifdef PHP_HASH_SHA1_NOT_IN_CORE
-
-/* SHA1 context. */
-typedef struct {
- uint32_t state[5]; /* state (ABCD) */
- uint32_t count[2]; /* number of bits, modulo 2^64 */
- unsigned char buffer[64]; /* input buffer */
-} PHP_SHA1_CTX;
-
-PHP_HASH_API void PHP_SHA1Init(PHP_SHA1_CTX *);
-PHP_HASH_API void PHP_SHA1Update(PHP_SHA1_CTX *, const unsigned char *, size_t);
-PHP_HASH_API void PHP_SHA1Final(unsigned char[20], PHP_SHA1_CTX *);
-
-PHP_FUNCTION(sha1);
-PHP_FUNCTION(sha1_file);
-
-#endif /* PHP_HASH_SHA1_NOT_IN_CORE */
-
/* SHA224 context. */
typedef struct {
uint32_t state[8]; /* state */
diff --git a/ext/hash/php_hash_sha3.h b/ext/hash/php_hash_sha3.h
index 0608f4005e..256da7bda6 100644
--- a/ext/hash/php_hash_sha3.h
+++ b/ext/hash/php_hash_sha3.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/hash/php_hash_snefru.h b/ext/hash/php_hash_snefru.h
index 2040fbfc94..25ba1183e3 100644
--- a/ext/hash/php_hash_snefru.h
+++ b/ext/hash/php_hash_snefru.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/hash/php_hash_snefru_tables.h b/ext/hash/php_hash_snefru_tables.h
index 20d385443d..bed4befae3 100644
--- a/ext/hash/php_hash_snefru_tables.h
+++ b/ext/hash/php_hash_snefru_tables.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/hash/php_hash_tiger.h b/ext/hash/php_hash_tiger.h
index b80e4e3254..4476639040 100644
--- a/ext/hash/php_hash_tiger.h
+++ b/ext/hash/php_hash_tiger.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/hash/php_hash_tiger_tables.h b/ext/hash/php_hash_tiger_tables.h
index 3dbdc0a4c6..d5e94badc7 100644
--- a/ext/hash/php_hash_tiger_tables.h
+++ b/ext/hash/php_hash_tiger_tables.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/hash/php_hash_whirlpool.h b/ext/hash/php_hash_whirlpool.h
index 3a2e98cff2..f96da414a5 100644
--- a/ext/hash/php_hash_whirlpool.h
+++ b/ext/hash/php_hash_whirlpool.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/hash/php_hash_whirlpool_tables.h b/ext/hash/php_hash_whirlpool_tables.h
index 2127ccca59..a42d20a8b6 100644
--- a/ext/hash/php_hash_whirlpool_tables.h
+++ b/ext/hash/php_hash_whirlpool_tables.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/hash/tests/fnv132.phpt b/ext/hash/tests/fnv132.phpt
index 914ce46f35..37618819bd 100644
--- a/ext/hash/tests/fnv132.phpt
+++ b/ext/hash/tests/fnv132.phpt
@@ -4,192 +4,192 @@ Hash: FNV132 algorithm
<?php
function R10($t) {
- return str_repeat($t, 10);
+ return str_repeat($t, 10);
}
function R500($t) {
- return str_repeat($t, 500);
+ return str_repeat($t, 500);
}
$tests = array(
- array( "", "811c9dc5" ),
- array( "a", "050c5d7e" ),
- array( "b", "050c5d7d" ),
- array( "c", "050c5d7c" ),
- array( "d", "050c5d7b" ),
- array( "e", "050c5d7a" ),
- array( "f", "050c5d79" ),
- array( "fo", "6b772514" ),
- array( "foo", "408f5e13" ),
- array( "foob", "b4b1178b" ),
- array( "fooba", "fdc80fb0" ),
- array( "foobar", "31f0b262" ),
- array( "\0", "050c5d1f" ),
- array( "a\0", "70772d5a" ),
- array( "b\0", "6f772bc7" ),
- array( "c\0", "6e772a34" ),
- array( "d\0", "6d7728a1" ),
- array( "e\0", "6c77270e" ),
- array( "f\0", "6b77257b" ),
- array( "fo\0", "408f5e7c" ),
- array( "foo\0", "b4b117e9" ),
- array( "foob\0", "fdc80fd1" ),
- array( "fooba\0", "31f0b210" ),
- array( "foobar\0", "ffe8d046" ),
- array( "ch", "6e772a5c" ),
- array( "cho", "4197aebb" ),
- array( "chon", "fcc8100f" ),
- array( "chong", "fdf147fa" ),
- array( "chongo", "bcd44ee1" ),
- array( "chongo ", "23382c13" ),
- array( "chongo w", "846d619e" ),
- array( "chongo wa", "1630abdb" ),
- array( "chongo was", "c99e89b2" ),
- array( "chongo was ", "1692c316" ),
- array( "chongo was h", "9f091bca" ),
- array( "chongo was he", "2556be9b" ),
- array( "chongo was her", "628e0e73" ),
- array( "chongo was here", "98a0bf6c" ),
- array( "chongo was here!", "b10d5725" ),
- array( "chongo was here!\n", "dd002f35" ),
- array( "ch\0", "4197aed4" ),
- array( "cho\0", "fcc81061" ),
- array( "chon\0", "fdf1479d" ),
- array( "chong\0", "bcd44e8e" ),
- array( "chongo\0", "23382c33" ),
- array( "chongo \0", "846d61e9" ),
- array( "chongo w\0", "1630abba" ),
- array( "chongo wa\0", "c99e89c1" ),
- array( "chongo was\0", "1692c336" ),
- array( "chongo was \0", "9f091ba2" ),
- array( "chongo was h\0", "2556befe" ),
- array( "chongo was he\0", "628e0e01" ),
- array( "chongo was her\0", "98a0bf09" ),
- array( "chongo was here\0", "b10d5704" ),
- array( "chongo was here!\0", "dd002f3f" ),
- array( "chongo was here!\n\0", "1c4a506f" ),
- array( "cu", "6e772a41" ),
- array( "cur", "26978421" ),
- array( "curd", "e184ff97" ),
- array( "curds", "9b5e5ac6" ),
- array( "curds ", "5b88e592" ),
- array( "curds a", "aa8164b7" ),
- array( "curds an", "20b18c7b" ),
- array( "curds and", "f28025c5" ),
- array( "curds and ", "84bb753f" ),
- array( "curds and w", "3219925a" ),
- array( "curds and wh", "384163c6" ),
- array( "curds and whe", "54f010d7" ),
- array( "curds and whey", "8cea820c" ),
- array( "curds and whey\n", "e12ab8ee" ),
- array( "cu\0", "26978453" ),
- array( "cur\0", "e184fff3" ),
- array( "curd\0", "9b5e5ab5" ),
- array( "curds\0", "5b88e5b2" ),
- array( "curds \0", "aa8164d6" ),
- array( "curds a\0", "20b18c15" ),
- array( "curds an\0", "f28025a1" ),
- array( "curds and\0", "84bb751f" ),
- array( "curds and \0", "3219922d" ),
- array( "curds and w\0", "384163ae" ),
- array( "curds and wh\0", "54f010b2" ),
- array( "curds and whe\0", "8cea8275" ),
- array( "curds and whey\0", "e12ab8e4" ),
- array( "curds and whey\n\0", "64411eaa" ),
- array( "line 1\nline 2\nline 3", "31ae8f83" ),
- array( "chongo <Landon Curt Noll> /\\../\\", "995fa9c4" ),
- array( "chongo <Landon Curt Noll> /\\../\\\0", "35983f8c" ),
- array( "chongo (Landon Curt Noll) /\\../\\", "5036a251" ),
- array( "chongo (Landon Curt Noll) /\\../\\\0", "97018583" ),
- array( "http://antwrp.gsfc.nasa.gov/apod/astropix.html", "b4448d60" ),
- array( "http://en.wikipedia.org/wiki/Fowler_Noll_Vo_hash", "025dfe59" ),
- array( "http://epod.usra.edu/", "c5eab3af" ),
- array( "http://exoplanet.eu/", "7d21ba1e" ),
- array( "http://hvo.wr.usgs.gov/cam3/", "7704cddb" ),
- array( "http://hvo.wr.usgs.gov/cams/HMcam/", "d0071bfe" ),
- array( "http://hvo.wr.usgs.gov/kilauea/update/deformation.html", "0ff3774c" ),
- array( "http://hvo.wr.usgs.gov/kilauea/update/images.html", "b0fea0ea" ),
- array( "http://hvo.wr.usgs.gov/kilauea/update/maps.html", "58177303" ),
- array( "http://hvo.wr.usgs.gov/volcanowatch/current_issue.html", "4f599cda" ),
- array( "http://neo.jpl.nasa.gov/risk/", "3e590a47" ),
- array( "http://norvig.com/21-days.html", "965595f8" ),
- array( "http://primes.utm.edu/curios/home.php", "c37f178d" ),
- array( "http://slashdot.org/", "9711dd26" ),
- array( "http://tux.wr.usgs.gov/Maps/155.25-19.5.html", "23c99b7f" ),
- array( "http://volcano.wr.usgs.gov/kilaueastatus.php", "6e568b17" ),
- array( "http://www.avo.alaska.edu/activity/Redoubt.php", "43f0245b" ),
- array( "http://www.dilbert.com/fast/", "bcb7a001" ),
- array( "http://www.fourmilab.ch/gravitation/orbits/", "12e6dffe" ),
- array( "http://www.fpoa.net/", "0792f2d6" ),
- array( "http://www.ioccc.org/index.html", "b966936b" ),
- array( "http://www.isthe.com/cgi-bin/number.cgi", "46439ac5" ),
- array( "http://www.isthe.com/chongo/bio.html", "728d49af" ),
- array( "http://www.isthe.com/chongo/index.html", "d33745c9" ),
- array( "http://www.isthe.com/chongo/src/calc/lucas-calc", "bc382a57" ),
- array( "http://www.isthe.com/chongo/tech/astro/venus2004.html", "4bda1d31" ),
- array( "http://www.isthe.com/chongo/tech/astro/vita.html", "ce35ccae" ),
- array( "http://www.isthe.com/chongo/tech/comp/c/expert.html", "3b6eed94" ),
- array( "http://www.isthe.com/chongo/tech/comp/calc/index.html", "445c9c58" ),
- array( "http://www.isthe.com/chongo/tech/comp/fnv/index.html", "3db8bf9d" ),
- array( "http://www.isthe.com/chongo/tech/math/number/howhigh.html", "2dee116d" ),
- array( "http://www.isthe.com/chongo/tech/math/number/number.html", "c18738da" ),
- array( "http://www.isthe.com/chongo/tech/math/prime/mersenne.html", "5b156176" ),
- array( "http://www.isthe.com/chongo/tech/math/prime/mersenne.html#largest", "2aa7d593" ),
- array( "http://www.lavarnd.org/cgi-bin/corpspeak.cgi", "b2409658" ),
- array( "http://www.lavarnd.org/cgi-bin/haiku.cgi", "e1489528" ),
- array( "http://www.lavarnd.org/cgi-bin/rand-none.cgi", "fe1ee07e" ),
- array( "http://www.lavarnd.org/cgi-bin/randdist.cgi", "e8842315" ),
- array( "http://www.lavarnd.org/index.html", "3a6a63a2" ),
- array( "http://www.lavarnd.org/what/nist-test.html", "06d2c18c" ),
- array( "http://www.macosxhints.com/", "f8ef7225" ),
- array( "http://www.mellis.com/", "843d3300" ),
- array( "http://www.nature.nps.gov/air/webcams/parks/havoso2alert/havoalert.cfm", "bb24f7ae" ),
- array( "http://www.nature.nps.gov/air/webcams/parks/havoso2alert/timelines_24.cfm", "878c0ec9" ),
- array( "http://www.paulnoll.com/", "b557810f" ),
- array( "http://www.pepysdiary.com/", "57423246" ),
- array( "http://www.sciencenews.org/index/home/activity/view", "87f7505e" ),
- array( "http://www.skyandtelescope.com/", "bb809f20" ),
- array( "http://www.sput.nl/~rob/sirius.html", "8932abb5" ),
- array( "http://www.systemexperts.com/", "0a9b3aa0" ),
- array( "http://www.tq-international.com/phpBB3/index.php", "b8682a24" ),
- array( "http://www.travelquesttours.com/index.htm", "a7ac1c56" ),
- array( "http://www.wunderground.com/global/stations/89606.html", "11409252" ),
- array( R10("21701"), "a987f517" ),
- array( R10("M21701"), "f309e7ed" ),
- array( R10("2^21701-1"), "c9e8f417" ),
- array( R10("\x54\xc5"), "7f447bdd" ),
- array( R10("\xc5\x54"), "b929adc5" ),
- array( R10("23209"), "57022879" ),
- array( R10("M23209"), "dcfd2c49" ),
- array( R10("2^23209-1"), "6edafff5" ),
- array( R10("\x5a\xa9"), "f04fb1f1" ),
- array( R10("\xa9\x5a"), "fb7de8b9" ),
- array( R10("391581216093"), "c5f1d7e9" ),
- array( R10("391581*2^216093-1"), "32c1f439" ),
- array( R10("\x05\xf9\x9d\x03\x4c\x81"), "7fd3eb7d" ),
- array( R10("FEDCBA9876543210"), "81597da5" ),
- array( R10("\xfe\xdc\xba\x98\x76\x54\x32\x10"), "05eb7a25" ),
- array( R10("EFCDAB8967452301"), "9c0fa1b5" ),
- array( R10("\xef\xcd\xab\x89\x67\x45\x23\x01"), "53ccb1c5" ),
- array( R10("0123456789ABCDEF"), "fabece15" ),
- array( R10("\x01\x23\x45\x67\x89\xab\xcd\xef"), "4ad745a5" ),
- array( R10("1032547698BADCFE"), "e5bdc495" ),
- array( R10("\x10\x32\x54\x76\x98\xba\xdc\xfe"), "23b3c0a5" ),
- array( R500("\x00"), "fa823dd5" ),
- array( R500("\x07"), "0c6c58b9" ),
- array( R500("~"), "e2dbccd5" ),
- array( R500("\x7f"), "db7f50f9" ),
+ array( "", "811c9dc5" ),
+ array( "a", "050c5d7e" ),
+ array( "b", "050c5d7d" ),
+ array( "c", "050c5d7c" ),
+ array( "d", "050c5d7b" ),
+ array( "e", "050c5d7a" ),
+ array( "f", "050c5d79" ),
+ array( "fo", "6b772514" ),
+ array( "foo", "408f5e13" ),
+ array( "foob", "b4b1178b" ),
+ array( "fooba", "fdc80fb0" ),
+ array( "foobar", "31f0b262" ),
+ array( "\0", "050c5d1f" ),
+ array( "a\0", "70772d5a" ),
+ array( "b\0", "6f772bc7" ),
+ array( "c\0", "6e772a34" ),
+ array( "d\0", "6d7728a1" ),
+ array( "e\0", "6c77270e" ),
+ array( "f\0", "6b77257b" ),
+ array( "fo\0", "408f5e7c" ),
+ array( "foo\0", "b4b117e9" ),
+ array( "foob\0", "fdc80fd1" ),
+ array( "fooba\0", "31f0b210" ),
+ array( "foobar\0", "ffe8d046" ),
+ array( "ch", "6e772a5c" ),
+ array( "cho", "4197aebb" ),
+ array( "chon", "fcc8100f" ),
+ array( "chong", "fdf147fa" ),
+ array( "chongo", "bcd44ee1" ),
+ array( "chongo ", "23382c13" ),
+ array( "chongo w", "846d619e" ),
+ array( "chongo wa", "1630abdb" ),
+ array( "chongo was", "c99e89b2" ),
+ array( "chongo was ", "1692c316" ),
+ array( "chongo was h", "9f091bca" ),
+ array( "chongo was he", "2556be9b" ),
+ array( "chongo was her", "628e0e73" ),
+ array( "chongo was here", "98a0bf6c" ),
+ array( "chongo was here!", "b10d5725" ),
+ array( "chongo was here!\n", "dd002f35" ),
+ array( "ch\0", "4197aed4" ),
+ array( "cho\0", "fcc81061" ),
+ array( "chon\0", "fdf1479d" ),
+ array( "chong\0", "bcd44e8e" ),
+ array( "chongo\0", "23382c33" ),
+ array( "chongo \0", "846d61e9" ),
+ array( "chongo w\0", "1630abba" ),
+ array( "chongo wa\0", "c99e89c1" ),
+ array( "chongo was\0", "1692c336" ),
+ array( "chongo was \0", "9f091ba2" ),
+ array( "chongo was h\0", "2556befe" ),
+ array( "chongo was he\0", "628e0e01" ),
+ array( "chongo was her\0", "98a0bf09" ),
+ array( "chongo was here\0", "b10d5704" ),
+ array( "chongo was here!\0", "dd002f3f" ),
+ array( "chongo was here!\n\0", "1c4a506f" ),
+ array( "cu", "6e772a41" ),
+ array( "cur", "26978421" ),
+ array( "curd", "e184ff97" ),
+ array( "curds", "9b5e5ac6" ),
+ array( "curds ", "5b88e592" ),
+ array( "curds a", "aa8164b7" ),
+ array( "curds an", "20b18c7b" ),
+ array( "curds and", "f28025c5" ),
+ array( "curds and ", "84bb753f" ),
+ array( "curds and w", "3219925a" ),
+ array( "curds and wh", "384163c6" ),
+ array( "curds and whe", "54f010d7" ),
+ array( "curds and whey", "8cea820c" ),
+ array( "curds and whey\n", "e12ab8ee" ),
+ array( "cu\0", "26978453" ),
+ array( "cur\0", "e184fff3" ),
+ array( "curd\0", "9b5e5ab5" ),
+ array( "curds\0", "5b88e5b2" ),
+ array( "curds \0", "aa8164d6" ),
+ array( "curds a\0", "20b18c15" ),
+ array( "curds an\0", "f28025a1" ),
+ array( "curds and\0", "84bb751f" ),
+ array( "curds and \0", "3219922d" ),
+ array( "curds and w\0", "384163ae" ),
+ array( "curds and wh\0", "54f010b2" ),
+ array( "curds and whe\0", "8cea8275" ),
+ array( "curds and whey\0", "e12ab8e4" ),
+ array( "curds and whey\n\0", "64411eaa" ),
+ array( "line 1\nline 2\nline 3", "31ae8f83" ),
+ array( "chongo <Landon Curt Noll> /\\../\\", "995fa9c4" ),
+ array( "chongo <Landon Curt Noll> /\\../\\\0", "35983f8c" ),
+ array( "chongo (Landon Curt Noll) /\\../\\", "5036a251" ),
+ array( "chongo (Landon Curt Noll) /\\../\\\0", "97018583" ),
+ array( "http://antwrp.gsfc.nasa.gov/apod/astropix.html", "b4448d60" ),
+ array( "http://en.wikipedia.org/wiki/Fowler_Noll_Vo_hash", "025dfe59" ),
+ array( "http://epod.usra.edu/", "c5eab3af" ),
+ array( "http://exoplanet.eu/", "7d21ba1e" ),
+ array( "http://hvo.wr.usgs.gov/cam3/", "7704cddb" ),
+ array( "http://hvo.wr.usgs.gov/cams/HMcam/", "d0071bfe" ),
+ array( "http://hvo.wr.usgs.gov/kilauea/update/deformation.html", "0ff3774c" ),
+ array( "http://hvo.wr.usgs.gov/kilauea/update/images.html", "b0fea0ea" ),
+ array( "http://hvo.wr.usgs.gov/kilauea/update/maps.html", "58177303" ),
+ array( "http://hvo.wr.usgs.gov/volcanowatch/current_issue.html", "4f599cda" ),
+ array( "http://neo.jpl.nasa.gov/risk/", "3e590a47" ),
+ array( "http://norvig.com/21-days.html", "965595f8" ),
+ array( "http://primes.utm.edu/curios/home.php", "c37f178d" ),
+ array( "http://slashdot.org/", "9711dd26" ),
+ array( "http://tux.wr.usgs.gov/Maps/155.25-19.5.html", "23c99b7f" ),
+ array( "http://volcano.wr.usgs.gov/kilaueastatus.php", "6e568b17" ),
+ array( "http://www.avo.alaska.edu/activity/Redoubt.php", "43f0245b" ),
+ array( "http://www.dilbert.com/fast/", "bcb7a001" ),
+ array( "http://www.fourmilab.ch/gravitation/orbits/", "12e6dffe" ),
+ array( "http://www.fpoa.net/", "0792f2d6" ),
+ array( "http://www.ioccc.org/index.html", "b966936b" ),
+ array( "http://www.isthe.com/cgi-bin/number.cgi", "46439ac5" ),
+ array( "http://www.isthe.com/chongo/bio.html", "728d49af" ),
+ array( "http://www.isthe.com/chongo/index.html", "d33745c9" ),
+ array( "http://www.isthe.com/chongo/src/calc/lucas-calc", "bc382a57" ),
+ array( "http://www.isthe.com/chongo/tech/astro/venus2004.html", "4bda1d31" ),
+ array( "http://www.isthe.com/chongo/tech/astro/vita.html", "ce35ccae" ),
+ array( "http://www.isthe.com/chongo/tech/comp/c/expert.html", "3b6eed94" ),
+ array( "http://www.isthe.com/chongo/tech/comp/calc/index.html", "445c9c58" ),
+ array( "http://www.isthe.com/chongo/tech/comp/fnv/index.html", "3db8bf9d" ),
+ array( "http://www.isthe.com/chongo/tech/math/number/howhigh.html", "2dee116d" ),
+ array( "http://www.isthe.com/chongo/tech/math/number/number.html", "c18738da" ),
+ array( "http://www.isthe.com/chongo/tech/math/prime/mersenne.html", "5b156176" ),
+ array( "http://www.isthe.com/chongo/tech/math/prime/mersenne.html#largest", "2aa7d593" ),
+ array( "http://www.lavarnd.org/cgi-bin/corpspeak.cgi", "b2409658" ),
+ array( "http://www.lavarnd.org/cgi-bin/haiku.cgi", "e1489528" ),
+ array( "http://www.lavarnd.org/cgi-bin/rand-none.cgi", "fe1ee07e" ),
+ array( "http://www.lavarnd.org/cgi-bin/randdist.cgi", "e8842315" ),
+ array( "http://www.lavarnd.org/index.html", "3a6a63a2" ),
+ array( "http://www.lavarnd.org/what/nist-test.html", "06d2c18c" ),
+ array( "http://www.macosxhints.com/", "f8ef7225" ),
+ array( "http://www.mellis.com/", "843d3300" ),
+ array( "http://www.nature.nps.gov/air/webcams/parks/havoso2alert/havoalert.cfm", "bb24f7ae" ),
+ array( "http://www.nature.nps.gov/air/webcams/parks/havoso2alert/timelines_24.cfm", "878c0ec9" ),
+ array( "http://www.paulnoll.com/", "b557810f" ),
+ array( "http://www.pepysdiary.com/", "57423246" ),
+ array( "http://www.sciencenews.org/index/home/activity/view", "87f7505e" ),
+ array( "http://www.skyandtelescope.com/", "bb809f20" ),
+ array( "http://www.sput.nl/~rob/sirius.html", "8932abb5" ),
+ array( "http://www.systemexperts.com/", "0a9b3aa0" ),
+ array( "http://www.tq-international.com/phpBB3/index.php", "b8682a24" ),
+ array( "http://www.travelquesttours.com/index.htm", "a7ac1c56" ),
+ array( "http://www.wunderground.com/global/stations/89606.html", "11409252" ),
+ array( R10("21701"), "a987f517" ),
+ array( R10("M21701"), "f309e7ed" ),
+ array( R10("2^21701-1"), "c9e8f417" ),
+ array( R10("\x54\xc5"), "7f447bdd" ),
+ array( R10("\xc5\x54"), "b929adc5" ),
+ array( R10("23209"), "57022879" ),
+ array( R10("M23209"), "dcfd2c49" ),
+ array( R10("2^23209-1"), "6edafff5" ),
+ array( R10("\x5a\xa9"), "f04fb1f1" ),
+ array( R10("\xa9\x5a"), "fb7de8b9" ),
+ array( R10("391581216093"), "c5f1d7e9" ),
+ array( R10("391581*2^216093-1"), "32c1f439" ),
+ array( R10("\x05\xf9\x9d\x03\x4c\x81"), "7fd3eb7d" ),
+ array( R10("FEDCBA9876543210"), "81597da5" ),
+ array( R10("\xfe\xdc\xba\x98\x76\x54\x32\x10"), "05eb7a25" ),
+ array( R10("EFCDAB8967452301"), "9c0fa1b5" ),
+ array( R10("\xef\xcd\xab\x89\x67\x45\x23\x01"), "53ccb1c5" ),
+ array( R10("0123456789ABCDEF"), "fabece15" ),
+ array( R10("\x01\x23\x45\x67\x89\xab\xcd\xef"), "4ad745a5" ),
+ array( R10("1032547698BADCFE"), "e5bdc495" ),
+ array( R10("\x10\x32\x54\x76\x98\xba\xdc\xfe"), "23b3c0a5" ),
+ array( R500("\x00"), "fa823dd5" ),
+ array( R500("\x07"), "0c6c58b9" ),
+ array( R500("~"), "e2dbccd5" ),
+ array( R500("\x7f"), "db7f50f9" ),
);
$i = 0;
$pass = true;
foreach($tests as $test) {
- $result = hash('fnv132', $test[0]);
- if ($result != $test[1]) {
- echo "Iteration " . $i . " failed - expected '" . $test[1] . "', got '" . $result . "' for '" . $test[1] . "'\n";
+ $result = hash('fnv132', $test[0]);
+ if ($result != $test[1]) {
+ echo "Iteration " . $i . " failed - expected '" . $test[1] . "', got '" . $result . "' for '" . $test[1] . "'\n";
$pass = false;
- }
- $i++;
+ }
+ $i++;
}
if($pass) {
diff --git a/ext/hash/tests/fnv164.phpt b/ext/hash/tests/fnv164.phpt
index 8ff7304a7b..9795524a69 100644
--- a/ext/hash/tests/fnv164.phpt
+++ b/ext/hash/tests/fnv164.phpt
@@ -4,192 +4,192 @@ Hash: FNV164 algorithm
<?php
function R10($t) {
- return str_repeat($t, 10);
+ return str_repeat($t, 10);
}
function R500($t) {
- return str_repeat($t, 500);
+ return str_repeat($t, 500);
}
$tests = array(
- array( "", "cbf29ce484222325" ),
- array( "a", "af63bd4c8601b7be" ),
- array( "b", "af63bd4c8601b7bd" ),
- array( "c", "af63bd4c8601b7bc" ),
- array( "d", "af63bd4c8601b7bb" ),
- array( "e", "af63bd4c8601b7ba" ),
- array( "f", "af63bd4c8601b7b9" ),
- array( "fo", "08326207b4eb2f34" ),
- array( "foo", "d8cbc7186ba13533" ),
- array( "foob", "0378817ee2ed65cb" ),
- array( "fooba", "d329d59b9963f790" ),
- array( "foobar", "340d8765a4dda9c2" ),
- array( "\0", "af63bd4c8601b7df" ),
- array( "a\0", "08326707b4eb37da" ),
- array( "b\0", "08326607b4eb3627" ),
- array( "c\0", "08326507b4eb3474" ),
- array( "d\0", "08326407b4eb32c1" ),
- array( "e\0", "08326307b4eb310e" ),
- array( "f\0", "08326207b4eb2f5b" ),
- array( "fo\0", "d8cbc7186ba1355c" ),
- array( "foo\0", "0378817ee2ed65a9" ),
- array( "foob\0", "d329d59b9963f7f1" ),
- array( "fooba\0", "340d8765a4dda9b0" ),
- array( "foobar\0", "50a6d3b724a774a6" ),
- array( "ch", "08326507b4eb341c" ),
- array( "cho", "d8d5c8186ba98bfb" ),
- array( "chon", "1ccefc7ef118dbef" ),
- array( "chong", "0c92fab3ad3db77a" ),
- array( "chongo", "9b77794f5fdec421" ),
- array( "chongo ", "0ac742dfe7874433" ),
- array( "chongo w", "d7dad5766ad8e2de" ),
- array( "chongo wa", "a1bb96378e897f5b" ),
- array( "chongo was", "5b3f9b6733a367d2" ),
- array( "chongo was ", "b07ce25cbea969f6" ),
- array( "chongo was h", "8d9e9997f9df0d6a" ),
- array( "chongo was he", "838c673d9603cb7b" ),
- array( "chongo was her", "8b5ee8a5e872c273" ),
- array( "chongo was here", "4507c4e9fb00690c" ),
- array( "chongo was here!", "4c9ca59581b27f45" ),
- array( "chongo was here!\n", "e0aca20b624e4235" ),
- array( "ch\0", "d8d5c8186ba98b94" ),
- array( "cho\0", "1ccefc7ef118db81" ),
- array( "chon\0", "0c92fab3ad3db71d" ),
- array( "chong\0", "9b77794f5fdec44e" ),
- array( "chongo\0", "0ac742dfe7874413" ),
- array( "chongo \0", "d7dad5766ad8e2a9" ),
- array( "chongo w\0", "a1bb96378e897f3a" ),
- array( "chongo wa\0", "5b3f9b6733a367a1" ),
- array( "chongo was\0", "b07ce25cbea969d6" ),
- array( "chongo was \0", "8d9e9997f9df0d02" ),
- array( "chongo was h\0", "838c673d9603cb1e" ),
- array( "chongo was he\0", "8b5ee8a5e872c201" ),
- array( "chongo was her\0", "4507c4e9fb006969" ),
- array( "chongo was here\0", "4c9ca59581b27f64" ),
- array( "chongo was here!\0", "e0aca20b624e423f" ),
- array( "chongo was here!\n\0", "13998e580afa800f" ),
- array( "cu", "08326507b4eb3401" ),
- array( "cur", "d8d5ad186ba95dc1" ),
- array( "curd", "1c72e17ef0ca4e97" ),
- array( "curds", "2183c1b327c38ae6" ),
- array( "curds ", "b66d096c914504f2" ),
- array( "curds a", "404bf57ad8476757" ),
- array( "curds an", "887976bd815498bb" ),
- array( "curds and", "3afd7f02c2bf85a5" ),
- array( "curds and ", "fc4476b0eb70177f" ),
- array( "curds and w", "186d2da00f77ecba" ),
- array( "curds and wh", "f97140fa48c74066" ),
- array( "curds and whe", "a2b1cf49aa926d37" ),
- array( "curds and whey", "0690712cd6cf940c" ),
- array( "curds and whey\n", "f7045b3102b8906e" ),
- array( "cu\0", "d8d5ad186ba95db3" ),
- array( "cur\0", "1c72e17ef0ca4ef3" ),
- array( "curd\0", "2183c1b327c38a95" ),
- array( "curds\0", "b66d096c914504d2" ),
- array( "curds \0", "404bf57ad8476736" ),
- array( "curds a\0", "887976bd815498d5" ),
- array( "curds an\0", "3afd7f02c2bf85c1" ),
- array( "curds and\0", "fc4476b0eb70175f" ),
- array( "curds and \0", "186d2da00f77eccd" ),
- array( "curds and w\0", "f97140fa48c7400e" ),
- array( "curds and wh\0", "a2b1cf49aa926d52" ),
- array( "curds and whe\0", "0690712cd6cf9475" ),
- array( "curds and whey\0", "f7045b3102b89064" ),
- array( "curds and whey\n\0", "74f762479f9d6aea" ),
- array( "line 1\nline 2\nline 3", "a64e5f36c9e2b0e3" ),
- array( "chongo <Landon Curt Noll> /\\../\\", "8fd0680da3088a04" ),
- array( "chongo <Landon Curt Noll> /\\../\\\0", "67aad32c078284cc" ),
- array( "chongo (Landon Curt Noll) /\\../\\", "b37d55d81c57b331" ),
- array( "chongo (Landon Curt Noll) /\\../\\\0", "55ac0f3829057c43" ),
- array( "http://antwrp.gsfc.nasa.gov/apod/astropix.html", "cb27f4b8e1b6cc20" ),
- array( "http://en.wikipedia.org/wiki/Fowler_Noll_Vo_hash", "26caf88bcbef2d19" ),
- array( "http://epod.usra.edu/", "8e6e063b97e61b8f" ),
- array( "http://exoplanet.eu/", "b42750f7f3b7c37e" ),
- array( "http://hvo.wr.usgs.gov/cam3/", "f3c6ba64cf7ca99b" ),
- array( "http://hvo.wr.usgs.gov/cams/HMcam/", "ebfb69b427ea80fe" ),
- array( "http://hvo.wr.usgs.gov/kilauea/update/deformation.html", "39b50c3ed970f46c" ),
- array( "http://hvo.wr.usgs.gov/kilauea/update/images.html", "5b9b177aa3eb3e8a" ),
- array( "http://hvo.wr.usgs.gov/kilauea/update/maps.html", "6510063ecf4ec903" ),
- array( "http://hvo.wr.usgs.gov/volcanowatch/current_issue.html", "2b3bbd2c00797c7a" ),
- array( "http://neo.jpl.nasa.gov/risk/", "f1d6204ff5cb4aa7" ),
- array( "http://norvig.com/21-days.html", "4836e27ccf099f38" ),
- array( "http://primes.utm.edu/curios/home.php", "82efbb0dd073b44d" ),
- array( "http://slashdot.org/", "4a80c282ffd7d4c6" ),
- array( "http://tux.wr.usgs.gov/Maps/155.25-19.5.html", "305d1a9c9ee43bdf" ),
- array( "http://volcano.wr.usgs.gov/kilaueastatus.php", "15c366948ffc6997" ),
- array( "http://www.avo.alaska.edu/activity/Redoubt.php", "80153ae218916e7b" ),
- array( "http://www.dilbert.com/fast/", "fa23e2bdf9e2a9e1" ),
- array( "http://www.fourmilab.ch/gravitation/orbits/", "d47e8d8a2333c6de" ),
- array( "http://www.fpoa.net/", "7e128095f688b056" ),
- array( "http://www.ioccc.org/index.html", "2f5356890efcedab" ),
- array( "http://www.isthe.com/cgi-bin/number.cgi", "95c2b383014f55c5" ),
- array( "http://www.isthe.com/chongo/bio.html", "4727a5339ce6070f" ),
- array( "http://www.isthe.com/chongo/index.html", "b0555ecd575108e9" ),
- array( "http://www.isthe.com/chongo/src/calc/lucas-calc", "48d785770bb4af37" ),
- array( "http://www.isthe.com/chongo/tech/astro/venus2004.html", "09d4701c12af02b1" ),
- array( "http://www.isthe.com/chongo/tech/astro/vita.html", "79f031e78f3cf62e" ),
- array( "http://www.isthe.com/chongo/tech/comp/c/expert.html", "52a1ee85db1b5a94" ),
- array( "http://www.isthe.com/chongo/tech/comp/calc/index.html", "6bd95b2eb37fa6b8" ),
- array( "http://www.isthe.com/chongo/tech/comp/fnv/index.html", "74971b7077aef85d" ),
- array( "http://www.isthe.com/chongo/tech/math/number/howhigh.html", "b4e4fae2ffcc1aad" ),
- array( "http://www.isthe.com/chongo/tech/math/number/number.html", "2bd48bd898b8f63a" ),
- array( "http://www.isthe.com/chongo/tech/math/prime/mersenne.html", "e9966ac1556257f6" ),
- array( "http://www.isthe.com/chongo/tech/math/prime/mersenne.html#largest", "92a3d1cd078ba293" ),
- array( "http://www.lavarnd.org/cgi-bin/corpspeak.cgi", "f81175a482e20ab8" ),
- array( "http://www.lavarnd.org/cgi-bin/haiku.cgi", "5bbb3de722e73048" ),
- array( "http://www.lavarnd.org/cgi-bin/rand-none.cgi", "6b4f363492b9f2be" ),
- array( "http://www.lavarnd.org/cgi-bin/randdist.cgi", "c2d559df73d59875" ),
- array( "http://www.lavarnd.org/index.html", "f75f62284bc7a8c2" ),
- array( "http://www.lavarnd.org/what/nist-test.html", "da8dd8e116a9f1cc" ),
- array( "http://www.macosxhints.com/", "bdc1e6ab76057885" ),
- array( "http://www.mellis.com/", "fec6a4238a1224a0" ),
- array( "http://www.nature.nps.gov/air/webcams/parks/havoso2alert/havoalert.cfm", "c03f40f3223e290e" ),
- array( "http://www.nature.nps.gov/air/webcams/parks/havoso2alert/timelines_24.cfm", "1ed21673466ffda9" ),
- array( "http://www.paulnoll.com/", "df70f906bb0dd2af" ),
- array( "http://www.pepysdiary.com/", "f3dcda369f2af666" ),
- array( "http://www.sciencenews.org/index/home/activity/view", "9ebb11573cdcebde" ),
- array( "http://www.skyandtelescope.com/", "81c72d9077fedca0" ),
- array( "http://www.sput.nl/~rob/sirius.html", "0ec074a31be5fb15" ),
- array( "http://www.systemexperts.com/", "2a8b3280b6c48f20" ),
- array( "http://www.tq-international.com/phpBB3/index.php", "fd31777513309344" ),
- array( "http://www.travelquesttours.com/index.htm", "194534a86ad006b6" ),
- array( "http://www.wunderground.com/global/stations/89606.html", "3be6fdf46e0cfe12" ),
- array( R10("21701"), "017cc137a07eb057" ),
- array( R10("M21701"), "9428fc6e7d26b54d" ),
- array( R10("2^21701-1"), "9aaa2e3603ef8ad7" ),
- array( R10("\x54\xc5"), "82c6d3f3a0ccdf7d" ),
- array( R10("\xc5\x54"), "c86eeea00cf09b65" ),
- array( R10("23209"), "705f8189dbb58299" ),
- array( R10("M23209"), "415a7f554391ca69" ),
- array( R10("2^23209-1"), "cfe3d49fa2bdc555" ),
- array( R10("\x5a\xa9"), "f0f9c56039b25191" ),
- array( R10("\xa9\x5a"), "7075cb6abd1d32d9" ),
- array( R10("391581216093"), "43c94e2c8b277509" ),
- array( R10("391581*2^216093-1"), "3cbfd4e4ea670359" ),
- array( R10("\x05\xf9\x9d\x03\x4c\x81"), "c05887810f4d019d" ),
- array( R10("FEDCBA9876543210"), "14468ff93ac22dc5" ),
- array( R10("\xfe\xdc\xba\x98\x76\x54\x32\x10"), "ebed699589d99c05" ),
- array( R10("EFCDAB8967452301"), "6d99f6df321ca5d5" ),
- array( R10("\xef\xcd\xab\x89\x67\x45\x23\x01"), "0cd410d08c36d625" ),
- array( R10("0123456789ABCDEF"), "ef1b2a2c86831d35" ),
- array( R10("\x01\x23\x45\x67\x89\xab\xcd\xef"), "3b349c4d69ee5f05" ),
- array( R10("1032547698BADCFE"), "55248ce88f45f035" ),
- array( R10("\x10\x32\x54\x76\x98\xba\xdc\xfe"), "aa69ca6a18a4c885" ),
- array( R500("\x00"), "1fe3fce62bd816b5" ),
- array( R500("\x07"), "0289a488a8df69d9" ),
- array( R500("~"), "15e96e1613df98b5" ),
- array( R500("\x7f"), "e6be57375ad89b99" ),
+ array( "", "cbf29ce484222325" ),
+ array( "a", "af63bd4c8601b7be" ),
+ array( "b", "af63bd4c8601b7bd" ),
+ array( "c", "af63bd4c8601b7bc" ),
+ array( "d", "af63bd4c8601b7bb" ),
+ array( "e", "af63bd4c8601b7ba" ),
+ array( "f", "af63bd4c8601b7b9" ),
+ array( "fo", "08326207b4eb2f34" ),
+ array( "foo", "d8cbc7186ba13533" ),
+ array( "foob", "0378817ee2ed65cb" ),
+ array( "fooba", "d329d59b9963f790" ),
+ array( "foobar", "340d8765a4dda9c2" ),
+ array( "\0", "af63bd4c8601b7df" ),
+ array( "a\0", "08326707b4eb37da" ),
+ array( "b\0", "08326607b4eb3627" ),
+ array( "c\0", "08326507b4eb3474" ),
+ array( "d\0", "08326407b4eb32c1" ),
+ array( "e\0", "08326307b4eb310e" ),
+ array( "f\0", "08326207b4eb2f5b" ),
+ array( "fo\0", "d8cbc7186ba1355c" ),
+ array( "foo\0", "0378817ee2ed65a9" ),
+ array( "foob\0", "d329d59b9963f7f1" ),
+ array( "fooba\0", "340d8765a4dda9b0" ),
+ array( "foobar\0", "50a6d3b724a774a6" ),
+ array( "ch", "08326507b4eb341c" ),
+ array( "cho", "d8d5c8186ba98bfb" ),
+ array( "chon", "1ccefc7ef118dbef" ),
+ array( "chong", "0c92fab3ad3db77a" ),
+ array( "chongo", "9b77794f5fdec421" ),
+ array( "chongo ", "0ac742dfe7874433" ),
+ array( "chongo w", "d7dad5766ad8e2de" ),
+ array( "chongo wa", "a1bb96378e897f5b" ),
+ array( "chongo was", "5b3f9b6733a367d2" ),
+ array( "chongo was ", "b07ce25cbea969f6" ),
+ array( "chongo was h", "8d9e9997f9df0d6a" ),
+ array( "chongo was he", "838c673d9603cb7b" ),
+ array( "chongo was her", "8b5ee8a5e872c273" ),
+ array( "chongo was here", "4507c4e9fb00690c" ),
+ array( "chongo was here!", "4c9ca59581b27f45" ),
+ array( "chongo was here!\n", "e0aca20b624e4235" ),
+ array( "ch\0", "d8d5c8186ba98b94" ),
+ array( "cho\0", "1ccefc7ef118db81" ),
+ array( "chon\0", "0c92fab3ad3db71d" ),
+ array( "chong\0", "9b77794f5fdec44e" ),
+ array( "chongo\0", "0ac742dfe7874413" ),
+ array( "chongo \0", "d7dad5766ad8e2a9" ),
+ array( "chongo w\0", "a1bb96378e897f3a" ),
+ array( "chongo wa\0", "5b3f9b6733a367a1" ),
+ array( "chongo was\0", "b07ce25cbea969d6" ),
+ array( "chongo was \0", "8d9e9997f9df0d02" ),
+ array( "chongo was h\0", "838c673d9603cb1e" ),
+ array( "chongo was he\0", "8b5ee8a5e872c201" ),
+ array( "chongo was her\0", "4507c4e9fb006969" ),
+ array( "chongo was here\0", "4c9ca59581b27f64" ),
+ array( "chongo was here!\0", "e0aca20b624e423f" ),
+ array( "chongo was here!\n\0", "13998e580afa800f" ),
+ array( "cu", "08326507b4eb3401" ),
+ array( "cur", "d8d5ad186ba95dc1" ),
+ array( "curd", "1c72e17ef0ca4e97" ),
+ array( "curds", "2183c1b327c38ae6" ),
+ array( "curds ", "b66d096c914504f2" ),
+ array( "curds a", "404bf57ad8476757" ),
+ array( "curds an", "887976bd815498bb" ),
+ array( "curds and", "3afd7f02c2bf85a5" ),
+ array( "curds and ", "fc4476b0eb70177f" ),
+ array( "curds and w", "186d2da00f77ecba" ),
+ array( "curds and wh", "f97140fa48c74066" ),
+ array( "curds and whe", "a2b1cf49aa926d37" ),
+ array( "curds and whey", "0690712cd6cf940c" ),
+ array( "curds and whey\n", "f7045b3102b8906e" ),
+ array( "cu\0", "d8d5ad186ba95db3" ),
+ array( "cur\0", "1c72e17ef0ca4ef3" ),
+ array( "curd\0", "2183c1b327c38a95" ),
+ array( "curds\0", "b66d096c914504d2" ),
+ array( "curds \0", "404bf57ad8476736" ),
+ array( "curds a\0", "887976bd815498d5" ),
+ array( "curds an\0", "3afd7f02c2bf85c1" ),
+ array( "curds and\0", "fc4476b0eb70175f" ),
+ array( "curds and \0", "186d2da00f77eccd" ),
+ array( "curds and w\0", "f97140fa48c7400e" ),
+ array( "curds and wh\0", "a2b1cf49aa926d52" ),
+ array( "curds and whe\0", "0690712cd6cf9475" ),
+ array( "curds and whey\0", "f7045b3102b89064" ),
+ array( "curds and whey\n\0", "74f762479f9d6aea" ),
+ array( "line 1\nline 2\nline 3", "a64e5f36c9e2b0e3" ),
+ array( "chongo <Landon Curt Noll> /\\../\\", "8fd0680da3088a04" ),
+ array( "chongo <Landon Curt Noll> /\\../\\\0", "67aad32c078284cc" ),
+ array( "chongo (Landon Curt Noll) /\\../\\", "b37d55d81c57b331" ),
+ array( "chongo (Landon Curt Noll) /\\../\\\0", "55ac0f3829057c43" ),
+ array( "http://antwrp.gsfc.nasa.gov/apod/astropix.html", "cb27f4b8e1b6cc20" ),
+ array( "http://en.wikipedia.org/wiki/Fowler_Noll_Vo_hash", "26caf88bcbef2d19" ),
+ array( "http://epod.usra.edu/", "8e6e063b97e61b8f" ),
+ array( "http://exoplanet.eu/", "b42750f7f3b7c37e" ),
+ array( "http://hvo.wr.usgs.gov/cam3/", "f3c6ba64cf7ca99b" ),
+ array( "http://hvo.wr.usgs.gov/cams/HMcam/", "ebfb69b427ea80fe" ),
+ array( "http://hvo.wr.usgs.gov/kilauea/update/deformation.html", "39b50c3ed970f46c" ),
+ array( "http://hvo.wr.usgs.gov/kilauea/update/images.html", "5b9b177aa3eb3e8a" ),
+ array( "http://hvo.wr.usgs.gov/kilauea/update/maps.html", "6510063ecf4ec903" ),
+ array( "http://hvo.wr.usgs.gov/volcanowatch/current_issue.html", "2b3bbd2c00797c7a" ),
+ array( "http://neo.jpl.nasa.gov/risk/", "f1d6204ff5cb4aa7" ),
+ array( "http://norvig.com/21-days.html", "4836e27ccf099f38" ),
+ array( "http://primes.utm.edu/curios/home.php", "82efbb0dd073b44d" ),
+ array( "http://slashdot.org/", "4a80c282ffd7d4c6" ),
+ array( "http://tux.wr.usgs.gov/Maps/155.25-19.5.html", "305d1a9c9ee43bdf" ),
+ array( "http://volcano.wr.usgs.gov/kilaueastatus.php", "15c366948ffc6997" ),
+ array( "http://www.avo.alaska.edu/activity/Redoubt.php", "80153ae218916e7b" ),
+ array( "http://www.dilbert.com/fast/", "fa23e2bdf9e2a9e1" ),
+ array( "http://www.fourmilab.ch/gravitation/orbits/", "d47e8d8a2333c6de" ),
+ array( "http://www.fpoa.net/", "7e128095f688b056" ),
+ array( "http://www.ioccc.org/index.html", "2f5356890efcedab" ),
+ array( "http://www.isthe.com/cgi-bin/number.cgi", "95c2b383014f55c5" ),
+ array( "http://www.isthe.com/chongo/bio.html", "4727a5339ce6070f" ),
+ array( "http://www.isthe.com/chongo/index.html", "b0555ecd575108e9" ),
+ array( "http://www.isthe.com/chongo/src/calc/lucas-calc", "48d785770bb4af37" ),
+ array( "http://www.isthe.com/chongo/tech/astro/venus2004.html", "09d4701c12af02b1" ),
+ array( "http://www.isthe.com/chongo/tech/astro/vita.html", "79f031e78f3cf62e" ),
+ array( "http://www.isthe.com/chongo/tech/comp/c/expert.html", "52a1ee85db1b5a94" ),
+ array( "http://www.isthe.com/chongo/tech/comp/calc/index.html", "6bd95b2eb37fa6b8" ),
+ array( "http://www.isthe.com/chongo/tech/comp/fnv/index.html", "74971b7077aef85d" ),
+ array( "http://www.isthe.com/chongo/tech/math/number/howhigh.html", "b4e4fae2ffcc1aad" ),
+ array( "http://www.isthe.com/chongo/tech/math/number/number.html", "2bd48bd898b8f63a" ),
+ array( "http://www.isthe.com/chongo/tech/math/prime/mersenne.html", "e9966ac1556257f6" ),
+ array( "http://www.isthe.com/chongo/tech/math/prime/mersenne.html#largest", "92a3d1cd078ba293" ),
+ array( "http://www.lavarnd.org/cgi-bin/corpspeak.cgi", "f81175a482e20ab8" ),
+ array( "http://www.lavarnd.org/cgi-bin/haiku.cgi", "5bbb3de722e73048" ),
+ array( "http://www.lavarnd.org/cgi-bin/rand-none.cgi", "6b4f363492b9f2be" ),
+ array( "http://www.lavarnd.org/cgi-bin/randdist.cgi", "c2d559df73d59875" ),
+ array( "http://www.lavarnd.org/index.html", "f75f62284bc7a8c2" ),
+ array( "http://www.lavarnd.org/what/nist-test.html", "da8dd8e116a9f1cc" ),
+ array( "http://www.macosxhints.com/", "bdc1e6ab76057885" ),
+ array( "http://www.mellis.com/", "fec6a4238a1224a0" ),
+ array( "http://www.nature.nps.gov/air/webcams/parks/havoso2alert/havoalert.cfm", "c03f40f3223e290e" ),
+ array( "http://www.nature.nps.gov/air/webcams/parks/havoso2alert/timelines_24.cfm", "1ed21673466ffda9" ),
+ array( "http://www.paulnoll.com/", "df70f906bb0dd2af" ),
+ array( "http://www.pepysdiary.com/", "f3dcda369f2af666" ),
+ array( "http://www.sciencenews.org/index/home/activity/view", "9ebb11573cdcebde" ),
+ array( "http://www.skyandtelescope.com/", "81c72d9077fedca0" ),
+ array( "http://www.sput.nl/~rob/sirius.html", "0ec074a31be5fb15" ),
+ array( "http://www.systemexperts.com/", "2a8b3280b6c48f20" ),
+ array( "http://www.tq-international.com/phpBB3/index.php", "fd31777513309344" ),
+ array( "http://www.travelquesttours.com/index.htm", "194534a86ad006b6" ),
+ array( "http://www.wunderground.com/global/stations/89606.html", "3be6fdf46e0cfe12" ),
+ array( R10("21701"), "017cc137a07eb057" ),
+ array( R10("M21701"), "9428fc6e7d26b54d" ),
+ array( R10("2^21701-1"), "9aaa2e3603ef8ad7" ),
+ array( R10("\x54\xc5"), "82c6d3f3a0ccdf7d" ),
+ array( R10("\xc5\x54"), "c86eeea00cf09b65" ),
+ array( R10("23209"), "705f8189dbb58299" ),
+ array( R10("M23209"), "415a7f554391ca69" ),
+ array( R10("2^23209-1"), "cfe3d49fa2bdc555" ),
+ array( R10("\x5a\xa9"), "f0f9c56039b25191" ),
+ array( R10("\xa9\x5a"), "7075cb6abd1d32d9" ),
+ array( R10("391581216093"), "43c94e2c8b277509" ),
+ array( R10("391581*2^216093-1"), "3cbfd4e4ea670359" ),
+ array( R10("\x05\xf9\x9d\x03\x4c\x81"), "c05887810f4d019d" ),
+ array( R10("FEDCBA9876543210"), "14468ff93ac22dc5" ),
+ array( R10("\xfe\xdc\xba\x98\x76\x54\x32\x10"), "ebed699589d99c05" ),
+ array( R10("EFCDAB8967452301"), "6d99f6df321ca5d5" ),
+ array( R10("\xef\xcd\xab\x89\x67\x45\x23\x01"), "0cd410d08c36d625" ),
+ array( R10("0123456789ABCDEF"), "ef1b2a2c86831d35" ),
+ array( R10("\x01\x23\x45\x67\x89\xab\xcd\xef"), "3b349c4d69ee5f05" ),
+ array( R10("1032547698BADCFE"), "55248ce88f45f035" ),
+ array( R10("\x10\x32\x54\x76\x98\xba\xdc\xfe"), "aa69ca6a18a4c885" ),
+ array( R500("\x00"), "1fe3fce62bd816b5" ),
+ array( R500("\x07"), "0289a488a8df69d9" ),
+ array( R500("~"), "15e96e1613df98b5" ),
+ array( R500("\x7f"), "e6be57375ad89b99" ),
);
$i = 0;
$pass = true;
foreach($tests as $test) {
- $result = hash('fnv164', $test[0]);
- if ($result != $test[1]) {
- echo "Iteration " . $i . " failed - expected '" . $test[1] . "', got '" . $result . "' for '" . $test[1] . "'\n";
+ $result = hash('fnv164', $test[0]);
+ if ($result != $test[1]) {
+ echo "Iteration " . $i . " failed - expected '" . $test[1] . "', got '" . $result . "' for '" . $test[1] . "'\n";
$pass = false;
- }
- $i++;
+ }
+ $i++;
}
if($pass) {
diff --git a/ext/hash/tests/fnv1a32.phpt b/ext/hash/tests/fnv1a32.phpt
index d2e01f7998..af12a2de37 100644
--- a/ext/hash/tests/fnv1a32.phpt
+++ b/ext/hash/tests/fnv1a32.phpt
@@ -4,321 +4,321 @@ Hash: FNV1a32 algorithm
<?php
$tests = array(
- array( 'l', 'e90c310b' ),
- array( 'b', 'e70c2de5' ),
- array( 'a', 'e40c292c' ),
- array( 'd', 'e10c2473' ),
- array( 'Z', 'df0c214d' ),
- array( '0K', '66eddeec' ),
- array( 'cp', '47297986' ),
- array( 'UY', '6bf399cb' ),
- array( 'RS', '6e04e612' ),
- array( '+`', '47dc64fe' ),
- array( 'Q: ', '1c02a1d6' ),
- array( ' Mu', 'c5c8a3f9' ),
- array( 'jS0', '1819afae' ),
- array( 'cRZ', 'd9f699ae' ),
- array( ' "]', 'ee32d84e' ),
- array( 'Bo@$', '1544a53a' ),
- array( 'U{5"', '08f0b60a' ),
- array( '`&W;', '300ba78d' ),
- array( 'Y+F;', '12d960fe' ),
- array( '\\a<]', '7596c231' ),
- array( '/2HcC', '4ee26872' ),
- array( '-7}-:', '5e0b1ab7' ),
- array( '[O*|T', 'c259a137' ),
- array( '_yib[', '6cc9d49b' ),
- array( 'p:vKE', 'becd7e8f' ),
- array( '>g# $a', 'ae428052' ),
- array( '07*tZ8', 'ed8d23f4' ),
- array( ',YEF5u', 'faf2b057' ),
- array( 'Q3K2.6', '44f076e4' ),
- array( 'ti(0aT', '29d6e513' ),
- array( 'U <Y!A;', 'ebcefc16' ),
- array( '2XF\'4^3', '11bad723' ),
- array( 'm%Z${-8', '2ef77eeb' ),
- array( 'G@F^60g', 'a0044fc5' ),
- array( 'Fq<|rYV', '00fb2e21' ),
- array( 't{r\'U9.i', '0d526094' ),
- array( 'xBX}}]y,', '58e08903' ),
- array( 'uBL<"bMi', '6b4adbd4' ),
- array( '*@\'\'3a^)', 'e9588a44' ),
- array( ']Q03k?|d', '5a837058' ),
- array( 'aVb`4]l* ', '8e9bed4b' ),
- array( '9G#|tl\'6s', '7301283c' ),
- array( '/JUmS4@cG', 'd708df29' ),
- array( '-$Eqf{UG1', '406526e0' ),
- array( '44<5Nd8LZ', '56f2092a' ),
- array( '&Tpyc;PRnd', 'e1b9c4be' ),
- array( 'sS-!WRs>OJ', '9fee418c' ),
- array( 'fa^z}tJc-v', '42d4d075' ),
- array( '>3K/./J_b9', 'd9e15b05' ),
- array( 'EVmRXE&LdV', '1ccbc7ba' ),
- array( 'wK9WG7LqzYi', 'fc482f42' ),
- array( '9m5I|Es\\(."', '43fc2be7' ),
- array( '^{U8B\\d(4\\T', 'af371347' ),
- array( 'M4{eana<X{*', '0073ed9f' ),
- array( 'mE\'39d<Gg{D', '7755ffb9' ),
- array( '=4fzyn/WC\\l@', '3085c332' ),
- array( 'BN0$jh uWE}k', 'c95b95dc' ),
- array( '_b((J$Lh94c3', 'c7f99999' ),
- array( '$rjGPWhr&xwq', '0b9873cd' ),
- array( 'bxg;?e(~H0\'s', 'cee0652d' ),
- array( '5T\\OhAbl4M5e&', '21278985' ),
- array( '~Y-xQ~[JfwiL ', '97dae25b' ),
- array( 'iu1qiGFGv/hZ|', '045498c1' ),
- array( '})2c/1=<*o;f;', 'ce6b0a18' ),
- array( '"_&O_oEqa09(W', '31218352' ),
- array( '18@k5>tG"$Y@@d', 'e67f32fc' ),
- array( '1\\LL_,R/kCU]%e', '563251e6' ),
- array( 'w.=)F]t\\|i% n^', '10a0ae81' ),
- array( 'A0DRlp~L|Q\\it2', '2f5d78ca' ),
- array( 'Gzw@)6IPt?-q*3', '228eab51' ),
- array( 'rxq4*6fw(eE%8"n', '843e8340' ),
- array( '.57).W3D"d9Ar,K', '9cc1aba3' ),
- array( '&~Ex3O0yH8_m=xo', 'c1a72c91' ),
- array( '-\'&D14{EX}*r@}~', 'f0b627fc' ),
- array( 'k$}2}1b.,+Flyde', '2255bec4' ),
- array( 'iqmp6~%3D]2OPRNO', '95cb7153' ),
- array( '?RNRQ`5_lA\'Y;k@&', '98f1390e' ),
- array( '^.vu.{)SZ<#+nQ[/', '2f89dc6c' ),
- array( '%+aVkw7Y9>3U+T\\j', '15c1ec76' ),
- array( 'bS`pPjD+\'H7vzs\'!', 'b732fff0' ),
- array( '~hWkaoE{.YQ:..%qb', 'a53c7189' ),
- array( 'eb3Q(?XQWPLKWMKA&', '3bf2f0e8' ),
- array( '7#u]~%7Q?E_D7C+zW', 'f5038551' ),
- array( '\\$w5UOf#{>PH_W`cN', 'c3b89ba6' ),
- array( '>bSU4rzt839C.p 2h', '00cf8218' ),
- array( '5h9|k6;=^{t?`C]Cv4', '855c27e9' ),
- array( 'Xj0N#CgFRYFeC\\N]Z;', 'caae0fcf' ),
- array( 'suXRrNrTrPwjeQUu!Y', 'e2ac5b6c' ),
- array( ':i lDGSg%#E_>:VwlJ', '0648058a' ),
- array( 'F_~91w$vIZmK4(55tY', '11c2fffb' ),
- array( '\\HBbLhBj#ybpD*PCCb;', 'b32cc782' ),
- array( 'HZe#H27PGLF"*oEl<.0', '86a137c7' ),
- array( '\'1*j"NtSr87/aqtd;\'|', 'f40113e8' ),
- array( 'kOI3RT#wB?&RF8]2;,\'', '0096ffab' ),
- array( 'n @\'/"y$g5,d"\\/5/c9', '8b7ec669' ),
- array( '\'&X.Y F72aD:QDZYS]SX', '26b51c68' ),
- array( 'Eid*lB9#Q}<Y%tg_u/v(', '9ff0e9b3' ),
- array( 'p<BC`}|5[Qm!;S,(uE,H', '50d88cac' ),
- array( 'DH"J>i*4y"<j>_/ ],59', '9354bdac' ),
- array( '^#:yWG#Mm/u2Xx\\vcg+]', '4debf08a' ),
- array( 'iHI)(X)ee> DB;?zbCIPS', '312f5ce8' ),
- array( '@c,9A$|)/[sX%|`]&GDEG', '8793f867' ),
- array( 'ihc)cFL-w!M[-g|1d\'A@z', '57a03ef9' ),
- array( 'yFw[%~#IDK3.0=qVj OkN', 'a435237b' ),
- array( '+x6)+{0M=+Hc$$h#(3HTF', 'f7f3fb17' ),
- array( 'VdcI<OIk;xv5/!A+1nI<7-', 'c0276bde' ),
- array( '@<vDD*lxQC^6mze8g!1_6@', '2a8386fd' ),
- array( '`WLqGu/^$Oz{s@&a:W&xms', 'c5454bef' ),
- array( 'tS,\\U==l^}E+pl" L\'PG#E', '7163befc' ),
- array( 'h)\'#a-|P"q%.OZLmG+kl7\\', '262417f4' ),
- array( 'Z9]\'@.ODT8N[<0i9ak,fz\\B', '30233bfa' ),
- array( 'GJjR6Xis3$R:Eaii6#9q?I\\', 'b1d4e934' ),
- array( 'Y+IerDB5kl ?$X*xk/L\'T.q', '20d3742c' ),
- array( '?DtX75#sn/=U"ax7Nf8nkpx', '61619334' ),
- array( 'd])1d]?W}dLW{b[oRj.)lo"', '366d01d0' ),
- array( '%?h=.T/(:m1LRol*nQWGM;#>', '6ec48f20' ),
- array( 'mmLv[=ya\\b k8/tS|\' Pwl[f', '9fb5d98f' ),
- array( '?4/lO2,>!X5]u/?Sr@@,O5_M', 'b476c549' ),
- array( '=_~5M[|lo,Z?>f]@?s}6$>iw', '621bbc86' ),
- array( '^+$/@c]^C\\sp9p^)|9I<!(\\A', '3ea36c5d' ),
- array( '{[W!yBxXM|hm`FL$$Au=2UF0o', '0f54780f' ),
- array( 'pMpx*2tfjv`-o:Zl#IMIuRN8I', 'c19ab462' ),
- array( 'kK 3[o$)a|4trz_i\\lZvGGzpu', '1cd34af1' ),
- array( 'DgHr r_Krr(cw2EuF:iByS~f.', '0d60d437' ),
- array( 'v/Vq L7gu+hhj5\\^=@WPfMw"7', '9d0ca535' ),
- array( ':{k:cz2sQ$s~<\\tGF^3[<ry]JJ', '92579a4a' ),
- array( 'DwCF0^C|y(w,{J1pJMM?ut~)Q<', 'ed50fb22' ),
- array( '|KyGv>@;eQy)Ns1F -q1}<_L\\U', 'c5960f99' ),
- array( 'B\\_sx\\@r%71FRvwM!FA3lA@_S?', '51be9eb7' ),
- array( '{4lXj05K$.)D".\\3T0+L]-r @`', 'e8525ded' ),
- array( 'Aa@u"=+nvu -A$;JI>X&R.7^[uk', '0510b06f' ),
- array( 'Nu,08nQ.pn9`e0`rQd/{.MU5 cL', '43c2c9c8' ),
- array( '^?BKn8X~QGP_8@yx&*Zy[@)XOV.', '39874c53' ),
- array( 'dWr273Ub"n;"@bS!{szuz&Ptbp~', 'c81fe453' ),
- array( '<@VJ&.>8ERn)U]DW~(, $!{y|"K', 'dc0d68d2' ),
- array( 'qe<p"]GMcVk||>k&sJKLITYIYZET', '90be4d50' ),
- array( 'WH J.=;0zc]_;J\\8hI?]sk+=@dfy', '5e1e1340' ),
- array( '?-OwUOBcm^tiCRI^}\'wfP7ED#PaC', 'f03345c0' ),
- array( '5I>UWmM->pq,Pgus:?S9FK!wbF<e', '94060b65' ),
- array( 'w~*-IHc!72/U$!bThYH$x|=@H>9+', '547a6b68' ),
- array( 'eUq]U{k~EP!]b04f2v;{Qd!Ka?l+^', 'e777322d' ),
- array( '&6D[)#2&n1L?2*#C?iU7&RhkS4Nr!', '4a78ebdf' ),
- array( 'YR\'ovcyyu i\'L*:W-^vw5.}gvj<+9', 'f83d06fa' ),
- array( '0-rb4cZw]Um^?u+J1bWpZO&hNn`:,', '7f314445' ),
- array( 'lS<yG /+Z(i0vHPmTz~8Rpr#w\\Rf>', '831a8450' ),
- array( 'lr+A0&h05sk=^{4\'M#\\H"t{sh kESS', '0c39d6ad' ),
- array( 'cAFobWuKh,@TJ Q_(~bdHeYEYCEEhx', '12b2879c' ),
- array( 'xM;@=}x4JaAk7kkhLsh/Y2t4WOW}uA', '81c3b55c' ),
- array( 'von21-1*B[lcH$P4m|)V-bi#wARO?I', '0d5d6b27' ),
- array( 'p79`JKn[V18Cu`GGu5D lQbVTZx(+8', '0fd3c926' ),
- array( 'Q{Pk]z7LWn^o2UQZ|HpAH]s,5If/QrG', '0f36a996' ),
- array( '$oxoMs(zLvY=*/nd,8UN`4ClJlTY>G"', '80b38386' ),
- array( 'C7z4do<_<4:Y?JI$WaZ\'BoJ0;7dtV,w', '9874d3b3' ),
- array( 'yDr.*cKj `%Z P$%(f`/*PY:kq~aH,Y', 'ab5089b4' ),
- array( 'BQMQ[1|F1]Lk]|pc&WD5buo|ab|D+*}', '5d600f5e' ),
- array( 'N[K 7\\|^n[+[9(L}.%BDg85ezwc?$m>R', '1966e89b' ),
- array( 'JjRaGPA7,LrFU?EcEg).!?t{7X<;F[mp', '908106a1' ),
- array( 'FASnrt& BxGw9l\\_TemV%bR=<oXbKGTr', '824f8688' ),
- array( 'i)a\\~g]Aa%9{qu[G\\J}b.Q JBY.m"c`k', '195cad65' ),
- array( 'lCIk,\'.m-Gj >GH{qF^!x_L;9Z*;?k(,', '36f68af8' ),
- array( '/Qx;Y\'*gOtgn<0j/WI1Q)]lC9w_Xcges:', '885fad78' ),
- array( '^0tf:\\60E%MVp].:n_DMMgfEH?*0%}Kd.', '7f86cff2' ),
- array( '@LI}cZCi)yZg)tVi:%8#k^K,h\\2g(vvIC', '3dd2e16e' ),
- array( '@G\'{jp&eLmoBEY\\Jq_6Q,B:hT#pLy:p;a', '03b92168' ),
- array( 'x8Mj>47,$YQ^6{Qv2##U>l+A]W<xIW[Bo', '7b4dcec0' ),
- array( '*-.>D:C~l"6hS-{W1Qu}]8\\6TU_,2#|<0+', 'b86f1510' ),
- array( '[UF~U3"k|Vyx.+K$*)<f@p= }O#zl4\'HjM', '93a09a8c' ),
- array( 'H@aJ,^!&W02$4<-Q#MCANApR=]fD\'RqPrT', '2d094101' ),
- array( '{~3|&k.8oCU}tXL9y{[kNxJ6=Rh0#[e~[x', '72d5e000' ),
- array( '|ae+zUNPTD*!]%|:pL3<bQnKbr(HqcBnF(', 'f4f08743' ),
- array( 'zA]Jr3n|4M"2gs^{0AM m0ruYeZ{U!$PCbz', 'ef1f608e' ),
- array( '6uj4+87=!,{|=>J=,[1#6v]2L^7}#yx:pdN', '800e955f' ),
- array( '{}f:~r7{0UGNa$_e:WCM$#d"&_{AQ`pN^Wh', 'fa87c111' ),
- array( '^K [\\U$+8)k~CCBqGEWJL7Fnh(_7g7!Fc!"', 'f0d49ddf' ),
- array( '@W\'Kp08oT[3F$Y}N\'6uu ~U8fm9-Q;0qs8>', 'bbc8b16a' ),
- array( 'eHVU|2iD7CCfJY]@Y\\vqCd,Q6Gb);zG!D}WB', 'b4c1dc4c' ),
- array( '1BfIe+01dmR?JI2n.>@Ef#N#~u%Dt\\f\' NPe', '7c98ca04' ),
- array( 'Y`w?NJ_ysqh#1)Hw-w{-m!Qc^9j^g;EB{=bK', '79ccb205' ),
- array( 'gBF\\5/_F9)?G!;Un=\'S{A>[)Y!LV>/#\'QIcg', 'ba719e14' ),
- array( 'YC.rLN;Mjp=(xp%:0`DjbpB! E(Rol:I0I=]', 'ce2a6b64' ),
- array( 'xY,cJIlC;r]KT"77sY9t~BGo/b:@-X}&2*j\\T', '87e2ae2a' ),
- array( 'X!pK_=!bT8V.RL.ts}$W8DdqCk$NVa$0ct\\C2', '380f7299' ),
- array( ']\'gv^uI+%> #CW<h=.,)3[`t_pXTM|g,$O#cF', 'eeb01e49' ),
- array( 'LnKkoO/Hkwez%o.`Q$@C\\upZ]}_.!CTM3!:#P', '9f74a4c3' ),
- array( 'IK=B29G"G(SKIv)?hc}gC,hga7zbQ~4zKR>]k', '4b7036db' ),
- array( 'e`4n5`9-iXvNV^rcGZE_V)1U>-!pL_]2@q"UR;', '2ef7953e' ),
- array( 'b=sYlK9_/`;TAr^SH|aJm.+K@K>C"p^d/S?{~X', '58f87a0f' ),
- array( '\\/:wc\\jC04@q_. jZA7xd9jD}zw>vwwS\'3Lko8', '924bf023' ),
- array( '/ MOr.^rx9503yI~>Hy7gp/_E6rr#c,2cYbWhA', 'd2c773bf' ),
- array( 'Ja[`ro[=nzeh2MZB.!Y"t\\e!oJ[R"DtM\'P.yAi', '59761485' ),
- array( '70d}ywLU:ZVs]LQCMAn*sqOh@V:NQ[9il~hgw5=', '1616e5d5' ),
- array( '2pt\'NAXroybznTJXt"rDTO^>=^(%V=Bi/8q^ZJR', '2b93c8c6' ),
- array( 'JE5E5jpm_r`%G1cfNBnSy-vd=0V{j!N5Gc[\\NMJ', '22863e0e' ),
- array( '/@,4h=xPl<@@7N8{kHRg3T7I{z&YJS%Zt2o^Oi/', 'ce54d2ce' ),
- array( '<&O]=~v9j?lRSAi}>e%w1X}lN0\\-`G=}Mm[klS&', '925e90a6' ),
- array( 'Wsr+G4tFS[KLm%JZTZ8a<_ :.mvyZJ!3>s>f)3-]', 'b47ebcb9' ),
- array( 'oY*]^T830PuL1uf?d^9?);RG0q.9&<vuu"STVlhg', '76d4ed18' ),
- array( '>_5OV|n;[)ZdE.-U <n\'Xf|NhQ$@?m)]M>.$;}?w', '2fb33679' ),
- array( '(z]M*j#+\'r2_Z0/Da3e!"n_O.mTJltBto CzkF&r', '569492ba' ),
- array( ':9SuIb:+v!-xplI~[}JHrm>cna^Z)eND~":IeUT]', 'b9cb09fa' ),
- array( 'WbVHP!H- rVratWPW7+a}Y&|\\AFBw{!O_Ww0YA>Y5', '26b7c332' ),
- array( 'tMvi&HB=S$;.+9jL`.D]/t=gmNB/l{EbI<MOdom9t', '7de5c876' ),
- array( '*G C3L$BqbRf ;UO]d=Z+ %GMU-=CF2Mn3q#`vFRY', '627567d3' ),
- array( 'y:Z6o*sUHO`HT)u*74N]G|MZnQ;exn@r*z*z&}QNN', 'b1579567' ),
- array( '3v#<m.S#]2KZ`\'J3C1,2Q =M*8S)i"W|y[:hinlH"', '948a6c9e' ),
- array( '9#b@Nvc`$v3$4`/L4977q42MO{8>i`@#d$C4z\'t~~(', 'fa5a6693' ),
- array( '$3h4_}Mw6?-Im\\E&z/g<2M@Va<^W<]_@pITQH#J^BW', '5db013f4' ),
- array( '(14N80^ LqNmH0+\'hGeIhWr>*<AT{d,$u@S.Q2/~$]', '57cd1795' ),
- array( 'mMnxUWA;!*stH}2iR.O_3E!fTRycQ}B?K18"iZ=kd1', '08722fa3' ),
- array( '`.0sxb"HC6nD}Cvw\'HvJgC[!EE[c1AtrO&fIiiq- `', 'c89edaa7' ),
- array( 'Q~%Hv-qmWZ23\\WY9;kZ1^+8FT"1G/2)`1.*)<{vsW*(', '702aaaa4' ),
- array( '4aaM}M(0-4HTiJe1Zw;<*JF3fC+Zz5c/wE]vsf("zQV', '197ef095' ),
- array( 'd|=vW63s@];SD^_ Ztcjm*He~/m!+?Xp<vgs-{hMY$"', '1ed13f33' ),
- array( '}cb~>Xb)FmR,laznl:H^V?FKLC4z|9}{|`z<:^F`Lxm', 'c04f1349' ),
- array( ':[h*I#R(ZrO\'?r<;oU:lS{ho6G6vt0e/kN:6Rl>._m5', '48c23cac' ),
- array( ' aQ<R(V?[R(LhPb`EsGU`vovJ]5X>$n?eA[9I3X&faRP', 'a53ac530' ),
- array( '262W+Y.kP}b{[wTz|D:bev{0*U7p7iBJ!T#,.1w_/Z[k', '05d91499' ),
- array( 'S1gPU"4<x1M$gdu N8JPlM]{^U[n18[eIC7 FL<@^iDF', '12db23fd' ),
- array( 'N:G}SqO@@-< cxnt1K[[or[6@wV~b{F17m0j__,!mI!Q', '2b2e3dde' ),
- array( 'BpGT<#0-vkC7dz6Gv\\Y.Kjx+K&-9O.jq 2G<6WJ-DmE*', 'f4c74b67' ),
- array( 'h\\R_:-newhqCn~]>-I1.[XKr1u!UcF`M#3-=@|#9et]Tt', 'bd458351' ),
- array( ';r#d$1A]\\4nR6E6\\&d_:q}Zn"tUwR*lm}oS#!u`^+P1Au', 'f8e9f1d5' ),
- array( 'H}|-^7 ]ro_gEW;PD*N5]Q7S3u^c\' YP~W^^n^<bO{KuS', '8e947b43' ),
- array( 'fFxpu.OGE$[;c?CdytcQSCA2_$b[PX08~)*t8Y=]^yyB9', 'a34f6609' ),
- array( '>(33lef0\'yo,\\L]6\\u6e ,}ZI\\9CW\\]udq)QWpb_jRlH~', 'e9d8fa86' ),
- array( 'J^[@tB@!A{K~5oVqNLW@V*xGlY3@F[@q;|21?S3aO_`eP8', '104537ea' ),
- array( 'X~e0@<;:d)swI;Ti-pg@"(s6iDuK*GcbFIsgf/"K9vCb2x', '7c5f8020' ),
- array( 'M?i5_l=T#(xyT$A9fhb[QJkSu%K:h]46}}L^kj3os-iH1,', 'ab2ee1ee' ),
- array( 'axuETGoA{fFG"0&6G$4sb!_upS#[{5h^.^$c\'t%#[LK]\\Q', '8520630b' ),
- array( 't$U)x8*X/{,3W)H@hW m;\'bA+?mV}K(rP^|Iw("\'$/;\\9d', '5ec32f02' ),
- array( '|"<|oX%Sz0rifq5oeeNb0Fk2NpBiM[OK^lINFN#A^u+FhA7', 'b5b5f4e5' ),
- array( 'N(e18-}K[nmF<Jvg)c1X*`[L@RWg;y~i"e{:rzeOiTv&~mn', '14562c12' ),
- array( ')R!b\\a?)"qai.[ix]OuxCp^rZ4ja3XP=+R h4?r72T"@1k9', '01b11a54' ),
- array( 'n</g_!GS[[>=own-#B.lVM_n`5p!F];5zJ}ZLF.("MFrE6!', '8f9e0173' ),
- array( 'IX/60]v~>,p@RO[hJ\'f%S.4[1a#$\'9%Qr5g#r_#1ktQ>D.(', 'f4e44d2d' ),
- array( 'n5oth}*E/kH4sb:FVO.ZBn]TZR\'yv5"fJq\\4ofZ S#4HfNn>', '51b1ae3d' ),
- array( '}}xAlVvH*}B"4Eh_7Fs(.N(aR=+:lyXkxQ.f)%/3#R57w~v/', '0d3e9950' ),
- array( 'Ek7S;@6m^A)L<a864G|=L,QP^fgVf_f,L~`g?vV~9_KVBdlW', '8c43dabf' ),
- array( '-itYuG*U/r-uSs# rch3[?2t ^KBD8yQ#o,y86OG*\\=]QA^D', '4d86d9cd' ),
- array( '%GXafjWgJ$*o=%B@uN:.ejUoGsMy5,>;Tv|<bT$.X.~u4A7*', '38b099cc' ),
- array( 'pQ9V<oFdct^y"}5Vu3rYhvgB&g8;)PFy"_Q?Ow%3md.pbDHYW', '859042fe' ),
- array( ';3A3{c:c|UmM{gP\\:o,3t@!ZNq=s:vKV+lj\'P&kM[Y{XBL6\\<', '88b478a3' ),
- array( 'Bo2cql2d+& #RW/@B6qH#@%\\<^ ht]&8N9{@\'/%36%6h\\F* \\', '4b1d0513' ),
- array( '{I`<N>Y.>C$|J<Kc8kkHq~^w6GT\\RU:N~{kN:E\\YiaV4}"x7n', 'f1ce1247' ),
- array( 'e_`d>Y{f/Y9dsgdpT3+zpddR<yP?rh.XHo>fI;NXtg>iP#Z%6', '3e4eb24d' ),
- array( 'e \'KeZg_,\'St6-=\'K%QfS+\\;IFkL!qcgrk3XF{9R$lG;yeBFjs', '69476a97' ),
- array( '.? j[I2Hv4:Z{-F0fm, A0mhLhOn0:c>Zc*6.=^%Qy`M(\']nuj', '9097fe8e' ),
- array( 'n7{]!HFP7Vk{uF`!]n>=to7U>?]{.Sg}kc\\l,#>DZ*@QQ"R/qq', 'cbee4ea9' ),
- array( 'Mfbd<!$z}3Oe2;In(UrFyMQ; $=R40Eav(F4)K/(^^mpz8`#mS', 'f19251c8' ),
- array( 'Jh!|%"!CT6SzwK#?_-jo5JO#<J<|N*PysRwyTy=*0q%(=)G}63', '8f27bdfb' ),
- array( 'nK]?Oyikv9vH4k{,eQ&$[6va>5jf3"y#NWB~R-kJGcr[Oog6Am;', '9cb72621' ),
- array( '}%3`DHK+\\N&_|^#|10h[WLO4|?{4ajP_pc@5-lAi<GJ:\'M78^!t', 'e0686fbc' ),
- array( '7NEKLdHaG32($vI:$7[nS$9n+f&DF(9]V^*#DRdlfwtko>&tUbc', 'e4bd2dd7' ),
- array( '*f|xrd 8,(Qi^1sbVGHC.@9y1W &.cj9Kh2>M2VZ:)Dy;9\\r`%6', '5efb3af6' ),
- array( 'oFOiW(j^7NIPy2b9`uo;1y`+6zh)\\n@L5p6mx!L0OvaJ)Dci;T&', '05e74ead' ),
- array( 'LNfXdaAn>0/jF "5y#b+SYl}b2bMM7Sze:SK|u:<&J(MJ*bD.EOb', '17cbb538' ),
- array( ' <abND0|\\dwC Kn|A*:HTCv NZD] t@!1#c`Ht]%YVHY"8WDBrlw', '4eca862a' ),
- array( '6dwd?=B@2cADf%&0zd5U;]/=ugb9[P2q5*WTHzt[_6!G<\'W8klm\'', '296c9ed7' ),
- array( 'J}EAe)ZBYl4nwlDAh9|HP}om&H&q5sy`q@#XI]z$K0rD}7efQc0#', 'bc868018' ),
- array( 'a!pgIwZ^lU@^uC8@"3DND8rCPY*#=:\' <xhepDE]ye=p*U1,iVZ/', '09251477' ),
- array( 'oNRA(\\DFwKF4D/z6S@sN\'1?1gQ=R)xaxG4:Pq_vj+= PMzf";[QCm', 'e8f565aa' ),
- array( 'pTUCr(LkiF4~`eq@\\\\Lz\\|IXdLt@}8.nld2_l_LW&aWfHI(&&U!cS', '40202a4d' ),
- array( 'K<8w2YvJhe8Mxx;YFs_)KGQtPW{&Y`Z%}r}0Mt[6[scUm~/4rn=?7', '9d3dfab7' ),
- array( 'o5gG1n!rI\'p=&!jz]!VRe-@d<TX,rwCb-,+?z-2D4$a;&M6cNm65z', '092e633d' ),
- array( 'Vy8,SD LhcZtnyo|-421vM8Dc{sR3)Ni$fvX,w%t[_iKZYHhnZzf(', 'db49c4e2' ),
- array( '3,l/ @B*n-/U%gb|lWYMA&){Orj+mQ4!]!1^BTi1bxgh`JfN"@|DG&', '0c69cbb2' ),
- array( '@vx+"g]7i<9z{[Pel4^U|? cn#%kGLqgDksGSR^=ow9kSjQA~0v{Pv', '8aafa096' ),
- array( '_?zd,B2~+Vj ~?S]]CVv/+aaL`qD]C<=c7#oZ5oelZflz:KX^"Pn.3', '2da2dfea' ),
- array( 'PZtC Rf<oKSs</),uvf\\cbw/<W2lF@ v{u:{H"88Ml-i{6ur.]OqAH', '6aa6fe03' ),
- array( '"] 4JFTK>PAXMi[e#*S0sPGjCUIsHk=JI=^td4A#eb\\3M8yQBMb7~+', '50438792' ),
- array( '#CaM8*9UUbs5XXIy[/]8B+P=]sjA+jL./.\\G9u|oYp%2JO,&_i?"up?', '5a10e446' ),
- array( 'Td+upvB~&Q\\NkRL[->`?h1Lop7/s- 4ad@XU7zU>M2l9e9trWV3Ag_1', 'b41de8a2' ),
- array( 'Xw@L&@ah&"A\\9<3WjEE$,_y 8P3Y9sjrk,@rM"[S$|1>:Du%j<*v{$v', '3d1d96c3' ),
- array( '4T+nn~Yake"^4$;g)8xGR>>X)Zb Wfwk<#Z+#5mo{oO0tjx}#rEV1c/', '021cf019' ),
- array( ':?r;vZ3cv7?#:Tq+QaZaWE[UHN{ ``0{ #7v]KZUbyX}OJ)!-ccd*?;', 'a52533a0' ),
- array( 'Sn8SOxcLxfcpE0KzsFTqu~{w-`[rj{/>jGr;@Vg:>L+c]W_Q}4Dt4@lA', 'eacea244' ),
- array( '"I5lED,1k~M-V6GtcRYA*9s)N8}bYk%[6;I\\_UnLU<Z,R""7U\\X_vMiE', '8dc7eb87' ),
- array( 'eg)?T/{kKEH+{7XRT3^(6a?k>xK6F6\\-~eLSuI@AnhMk!\'>V:}_P_~<~', '7481744d' ),
- array( 'xh5@~qM}XzRODrq4\\? ^F>6a<u3|uO{n9209%]8^Yk.}_ 3=@3{gR2In', '4da520dc' ),
- array( ')\\l~-hmG{}`"\\y`7eo6FpIc1\\_x/rC~{ k{.UjURi7TF16]w&s>w>"*z', 'c6ec7195' ),
- array( 'b#+VG+SGvOUM:, $CTKUj*Nq~mi=os9SwD+?O_gG0>tJKtOnJ{E6&s(&a', '6976d3a8' ),
- array( 'rCRg\\\'`"2!Qriy#(nNTd~C/ziE"]N(@AKr))zj+.k]!UW$^FR3,QW;MA`', '57543a3a' ),
- array( 'O /X@Q%4[.0F:>2w?hPDGvwZ$J3?wT!HT0!ub&+>4;dOZwGy`w?)o7dsa', '5e4ad807' ),
- array( 'w4ZM5##F%x)+%G@A-o{%8vf06p!NUu1N*k{?o~etxn }7A?D1;JI32ZI#', 'c01f194b' ),
- array( '\\wXR)(]u$|e#cZ|SZzj{;/.WZXjl45op-ID7Q"-U rYcMV7)R#&n35Fmm', '4e92f8a5' ),
- array( '2Z"GJsUt8lF;z|;mV <.8F`;MPNbw<Q*vTRBH)7au]|q[9_29|ARC#mpS<', 'cf4d6b34' ),
- array( 'TKY&VQZ)t$2,e)jczF|[Y7Xzi|~WnRtC~OIU"%_v)r#n{nRw6PTph.lR+k', '7a8a94c5' ),
- array( '+y?!>>PgsSmSJvFNfC=:<TjqES 3\',~2\'>4E\\e.Q9{&crL2YpPs.%_ K4 ', '11032641' ),
- array( '_;-^N4}bZ[Hh-ae3EX`X3R)(`/h`[|a;9nzg$xK^UsHcV.w{gXUz,^$lnm', '9298d67e' ),
- array( 'MKj/f%~bl#\\9b2-+vc:n`"H6}Tu#Aepo1\\ xa~[O#8hfKvrBZ-2</ZS.0I', '0654c0b0' ),
- array( '1Q/"BA^B:ABvpE0Y-[Q ~--1I=l|L|G]OW`qy?44`V,R|<-*w^*wk8)5Vu3', '2f477f17' ),
- array( '#r[aB4B5.bIBD Nv}j$(cb3[OLee$\\x\'PUhsi,)wnR;3Si*QU/Z:rmvB;\\(', 'cf7e00ca' ),
- array( '?9"GiW1^B=g:,:U@n@J@vZ{1Mi(o&exE zljS~Iu<11ILgi;(5\\~oX1=C:.', '2b97bb55' ),
- array( 'I \'n #\\jW[4NxF_BrH-.PBjP2CaPf|_1|f!}j^iC:}q4DRW7zdFL\'1|:U_k', '8923a6db' ),
- array( '=\\KNZ2OY}/CAIA3^ff6~azF.#W,>.l*LIU{%gL^f["(&D<d,${,evRtz+"9', 'aa215ef1' ),
- array( '9nCe9xb>a/}Ij QpEnUQrQ]YI0OE<Q^U@#<Y|~x^.v(xvZj=J@n=rMw<^Gaz', '87741385' ),
- array( 'xAQ:DnsBnl"}c*w[ebx1#hNu7G3unuqh7D#\\3w~"d" I,w&rZ $^iSU!{hwj', 'cccba4fc' ),
- array( '_jTw/XTBPTE5VF_c?eWzf\\YP1/Q-xJxY5MQD&\'gV\\-l4TMxs4Pnz.HL?X}LR', '5d4564df' ),
- array( 'HF,^s]#zdjRBx@VMnOA# 0~/YKN3J{esBrR7QV36BeY;\'0iu_+y`<yovF>*q', '3bec6d86' ),
- array( ':pe]c9t5o(L2n&Nv68lvDgW`bGX)fbz"Sa_8zTNk]z}L"LC8e10*ygk\\0Dfv', 'fef9aa77' ),
+ array( 'l', 'e90c310b' ),
+ array( 'b', 'e70c2de5' ),
+ array( 'a', 'e40c292c' ),
+ array( 'd', 'e10c2473' ),
+ array( 'Z', 'df0c214d' ),
+ array( '0K', '66eddeec' ),
+ array( 'cp', '47297986' ),
+ array( 'UY', '6bf399cb' ),
+ array( 'RS', '6e04e612' ),
+ array( '+`', '47dc64fe' ),
+ array( 'Q: ', '1c02a1d6' ),
+ array( ' Mu', 'c5c8a3f9' ),
+ array( 'jS0', '1819afae' ),
+ array( 'cRZ', 'd9f699ae' ),
+ array( ' "]', 'ee32d84e' ),
+ array( 'Bo@$', '1544a53a' ),
+ array( 'U{5"', '08f0b60a' ),
+ array( '`&W;', '300ba78d' ),
+ array( 'Y+F;', '12d960fe' ),
+ array( '\\a<]', '7596c231' ),
+ array( '/2HcC', '4ee26872' ),
+ array( '-7}-:', '5e0b1ab7' ),
+ array( '[O*|T', 'c259a137' ),
+ array( '_yib[', '6cc9d49b' ),
+ array( 'p:vKE', 'becd7e8f' ),
+ array( '>g# $a', 'ae428052' ),
+ array( '07*tZ8', 'ed8d23f4' ),
+ array( ',YEF5u', 'faf2b057' ),
+ array( 'Q3K2.6', '44f076e4' ),
+ array( 'ti(0aT', '29d6e513' ),
+ array( 'U <Y!A;', 'ebcefc16' ),
+ array( '2XF\'4^3', '11bad723' ),
+ array( 'm%Z${-8', '2ef77eeb' ),
+ array( 'G@F^60g', 'a0044fc5' ),
+ array( 'Fq<|rYV', '00fb2e21' ),
+ array( 't{r\'U9.i', '0d526094' ),
+ array( 'xBX}}]y,', '58e08903' ),
+ array( 'uBL<"bMi', '6b4adbd4' ),
+ array( '*@\'\'3a^)', 'e9588a44' ),
+ array( ']Q03k?|d', '5a837058' ),
+ array( 'aVb`4]l* ', '8e9bed4b' ),
+ array( '9G#|tl\'6s', '7301283c' ),
+ array( '/JUmS4@cG', 'd708df29' ),
+ array( '-$Eqf{UG1', '406526e0' ),
+ array( '44<5Nd8LZ', '56f2092a' ),
+ array( '&Tpyc;PRnd', 'e1b9c4be' ),
+ array( 'sS-!WRs>OJ', '9fee418c' ),
+ array( 'fa^z}tJc-v', '42d4d075' ),
+ array( '>3K/./J_b9', 'd9e15b05' ),
+ array( 'EVmRXE&LdV', '1ccbc7ba' ),
+ array( 'wK9WG7LqzYi', 'fc482f42' ),
+ array( '9m5I|Es\\(."', '43fc2be7' ),
+ array( '^{U8B\\d(4\\T', 'af371347' ),
+ array( 'M4{eana<X{*', '0073ed9f' ),
+ array( 'mE\'39d<Gg{D', '7755ffb9' ),
+ array( '=4fzyn/WC\\l@', '3085c332' ),
+ array( 'BN0$jh uWE}k', 'c95b95dc' ),
+ array( '_b((J$Lh94c3', 'c7f99999' ),
+ array( '$rjGPWhr&xwq', '0b9873cd' ),
+ array( 'bxg;?e(~H0\'s', 'cee0652d' ),
+ array( '5T\\OhAbl4M5e&', '21278985' ),
+ array( '~Y-xQ~[JfwiL ', '97dae25b' ),
+ array( 'iu1qiGFGv/hZ|', '045498c1' ),
+ array( '})2c/1=<*o;f;', 'ce6b0a18' ),
+ array( '"_&O_oEqa09(W', '31218352' ),
+ array( '18@k5>tG"$Y@@d', 'e67f32fc' ),
+ array( '1\\LL_,R/kCU]%e', '563251e6' ),
+ array( 'w.=)F]t\\|i% n^', '10a0ae81' ),
+ array( 'A0DRlp~L|Q\\it2', '2f5d78ca' ),
+ array( 'Gzw@)6IPt?-q*3', '228eab51' ),
+ array( 'rxq4*6fw(eE%8"n', '843e8340' ),
+ array( '.57).W3D"d9Ar,K', '9cc1aba3' ),
+ array( '&~Ex3O0yH8_m=xo', 'c1a72c91' ),
+ array( '-\'&D14{EX}*r@}~', 'f0b627fc' ),
+ array( 'k$}2}1b.,+Flyde', '2255bec4' ),
+ array( 'iqmp6~%3D]2OPRNO', '95cb7153' ),
+ array( '?RNRQ`5_lA\'Y;k@&', '98f1390e' ),
+ array( '^.vu.{)SZ<#+nQ[/', '2f89dc6c' ),
+ array( '%+aVkw7Y9>3U+T\\j', '15c1ec76' ),
+ array( 'bS`pPjD+\'H7vzs\'!', 'b732fff0' ),
+ array( '~hWkaoE{.YQ:..%qb', 'a53c7189' ),
+ array( 'eb3Q(?XQWPLKWMKA&', '3bf2f0e8' ),
+ array( '7#u]~%7Q?E_D7C+zW', 'f5038551' ),
+ array( '\\$w5UOf#{>PH_W`cN', 'c3b89ba6' ),
+ array( '>bSU4rzt839C.p 2h', '00cf8218' ),
+ array( '5h9|k6;=^{t?`C]Cv4', '855c27e9' ),
+ array( 'Xj0N#CgFRYFeC\\N]Z;', 'caae0fcf' ),
+ array( 'suXRrNrTrPwjeQUu!Y', 'e2ac5b6c' ),
+ array( ':i lDGSg%#E_>:VwlJ', '0648058a' ),
+ array( 'F_~91w$vIZmK4(55tY', '11c2fffb' ),
+ array( '\\HBbLhBj#ybpD*PCCb;', 'b32cc782' ),
+ array( 'HZe#H27PGLF"*oEl<.0', '86a137c7' ),
+ array( '\'1*j"NtSr87/aqtd;\'|', 'f40113e8' ),
+ array( 'kOI3RT#wB?&RF8]2;,\'', '0096ffab' ),
+ array( 'n @\'/"y$g5,d"\\/5/c9', '8b7ec669' ),
+ array( '\'&X.Y F72aD:QDZYS]SX', '26b51c68' ),
+ array( 'Eid*lB9#Q}<Y%tg_u/v(', '9ff0e9b3' ),
+ array( 'p<BC`}|5[Qm!;S,(uE,H', '50d88cac' ),
+ array( 'DH"J>i*4y"<j>_/ ],59', '9354bdac' ),
+ array( '^#:yWG#Mm/u2Xx\\vcg+]', '4debf08a' ),
+ array( 'iHI)(X)ee> DB;?zbCIPS', '312f5ce8' ),
+ array( '@c,9A$|)/[sX%|`]&GDEG', '8793f867' ),
+ array( 'ihc)cFL-w!M[-g|1d\'A@z', '57a03ef9' ),
+ array( 'yFw[%~#IDK3.0=qVj OkN', 'a435237b' ),
+ array( '+x6)+{0M=+Hc$$h#(3HTF', 'f7f3fb17' ),
+ array( 'VdcI<OIk;xv5/!A+1nI<7-', 'c0276bde' ),
+ array( '@<vDD*lxQC^6mze8g!1_6@', '2a8386fd' ),
+ array( '`WLqGu/^$Oz{s@&a:W&xms', 'c5454bef' ),
+ array( 'tS,\\U==l^}E+pl" L\'PG#E', '7163befc' ),
+ array( 'h)\'#a-|P"q%.OZLmG+kl7\\', '262417f4' ),
+ array( 'Z9]\'@.ODT8N[<0i9ak,fz\\B', '30233bfa' ),
+ array( 'GJjR6Xis3$R:Eaii6#9q?I\\', 'b1d4e934' ),
+ array( 'Y+IerDB5kl ?$X*xk/L\'T.q', '20d3742c' ),
+ array( '?DtX75#sn/=U"ax7Nf8nkpx', '61619334' ),
+ array( 'd])1d]?W}dLW{b[oRj.)lo"', '366d01d0' ),
+ array( '%?h=.T/(:m1LRol*nQWGM;#>', '6ec48f20' ),
+ array( 'mmLv[=ya\\b k8/tS|\' Pwl[f', '9fb5d98f' ),
+ array( '?4/lO2,>!X5]u/?Sr@@,O5_M', 'b476c549' ),
+ array( '=_~5M[|lo,Z?>f]@?s}6$>iw', '621bbc86' ),
+ array( '^+$/@c]^C\\sp9p^)|9I<!(\\A', '3ea36c5d' ),
+ array( '{[W!yBxXM|hm`FL$$Au=2UF0o', '0f54780f' ),
+ array( 'pMpx*2tfjv`-o:Zl#IMIuRN8I', 'c19ab462' ),
+ array( 'kK 3[o$)a|4trz_i\\lZvGGzpu', '1cd34af1' ),
+ array( 'DgHr r_Krr(cw2EuF:iByS~f.', '0d60d437' ),
+ array( 'v/Vq L7gu+hhj5\\^=@WPfMw"7', '9d0ca535' ),
+ array( ':{k:cz2sQ$s~<\\tGF^3[<ry]JJ', '92579a4a' ),
+ array( 'DwCF0^C|y(w,{J1pJMM?ut~)Q<', 'ed50fb22' ),
+ array( '|KyGv>@;eQy)Ns1F -q1}<_L\\U', 'c5960f99' ),
+ array( 'B\\_sx\\@r%71FRvwM!FA3lA@_S?', '51be9eb7' ),
+ array( '{4lXj05K$.)D".\\3T0+L]-r @`', 'e8525ded' ),
+ array( 'Aa@u"=+nvu -A$;JI>X&R.7^[uk', '0510b06f' ),
+ array( 'Nu,08nQ.pn9`e0`rQd/{.MU5 cL', '43c2c9c8' ),
+ array( '^?BKn8X~QGP_8@yx&*Zy[@)XOV.', '39874c53' ),
+ array( 'dWr273Ub"n;"@bS!{szuz&Ptbp~', 'c81fe453' ),
+ array( '<@VJ&.>8ERn)U]DW~(, $!{y|"K', 'dc0d68d2' ),
+ array( 'qe<p"]GMcVk||>k&sJKLITYIYZET', '90be4d50' ),
+ array( 'WH J.=;0zc]_;J\\8hI?]sk+=@dfy', '5e1e1340' ),
+ array( '?-OwUOBcm^tiCRI^}\'wfP7ED#PaC', 'f03345c0' ),
+ array( '5I>UWmM->pq,Pgus:?S9FK!wbF<e', '94060b65' ),
+ array( 'w~*-IHc!72/U$!bThYH$x|=@H>9+', '547a6b68' ),
+ array( 'eUq]U{k~EP!]b04f2v;{Qd!Ka?l+^', 'e777322d' ),
+ array( '&6D[)#2&n1L?2*#C?iU7&RhkS4Nr!', '4a78ebdf' ),
+ array( 'YR\'ovcyyu i\'L*:W-^vw5.}gvj<+9', 'f83d06fa' ),
+ array( '0-rb4cZw]Um^?u+J1bWpZO&hNn`:,', '7f314445' ),
+ array( 'lS<yG /+Z(i0vHPmTz~8Rpr#w\\Rf>', '831a8450' ),
+ array( 'lr+A0&h05sk=^{4\'M#\\H"t{sh kESS', '0c39d6ad' ),
+ array( 'cAFobWuKh,@TJ Q_(~bdHeYEYCEEhx', '12b2879c' ),
+ array( 'xM;@=}x4JaAk7kkhLsh/Y2t4WOW}uA', '81c3b55c' ),
+ array( 'von21-1*B[lcH$P4m|)V-bi#wARO?I', '0d5d6b27' ),
+ array( 'p79`JKn[V18Cu`GGu5D lQbVTZx(+8', '0fd3c926' ),
+ array( 'Q{Pk]z7LWn^o2UQZ|HpAH]s,5If/QrG', '0f36a996' ),
+ array( '$oxoMs(zLvY=*/nd,8UN`4ClJlTY>G"', '80b38386' ),
+ array( 'C7z4do<_<4:Y?JI$WaZ\'BoJ0;7dtV,w', '9874d3b3' ),
+ array( 'yDr.*cKj `%Z P$%(f`/*PY:kq~aH,Y', 'ab5089b4' ),
+ array( 'BQMQ[1|F1]Lk]|pc&WD5buo|ab|D+*}', '5d600f5e' ),
+ array( 'N[K 7\\|^n[+[9(L}.%BDg85ezwc?$m>R', '1966e89b' ),
+ array( 'JjRaGPA7,LrFU?EcEg).!?t{7X<;F[mp', '908106a1' ),
+ array( 'FASnrt& BxGw9l\\_TemV%bR=<oXbKGTr', '824f8688' ),
+ array( 'i)a\\~g]Aa%9{qu[G\\J}b.Q JBY.m"c`k', '195cad65' ),
+ array( 'lCIk,\'.m-Gj >GH{qF^!x_L;9Z*;?k(,', '36f68af8' ),
+ array( '/Qx;Y\'*gOtgn<0j/WI1Q)]lC9w_Xcges:', '885fad78' ),
+ array( '^0tf:\\60E%MVp].:n_DMMgfEH?*0%}Kd.', '7f86cff2' ),
+ array( '@LI}cZCi)yZg)tVi:%8#k^K,h\\2g(vvIC', '3dd2e16e' ),
+ array( '@G\'{jp&eLmoBEY\\Jq_6Q,B:hT#pLy:p;a', '03b92168' ),
+ array( 'x8Mj>47,$YQ^6{Qv2##U>l+A]W<xIW[Bo', '7b4dcec0' ),
+ array( '*-.>D:C~l"6hS-{W1Qu}]8\\6TU_,2#|<0+', 'b86f1510' ),
+ array( '[UF~U3"k|Vyx.+K$*)<f@p= }O#zl4\'HjM', '93a09a8c' ),
+ array( 'H@aJ,^!&W02$4<-Q#MCANApR=]fD\'RqPrT', '2d094101' ),
+ array( '{~3|&k.8oCU}tXL9y{[kNxJ6=Rh0#[e~[x', '72d5e000' ),
+ array( '|ae+zUNPTD*!]%|:pL3<bQnKbr(HqcBnF(', 'f4f08743' ),
+ array( 'zA]Jr3n|4M"2gs^{0AM m0ruYeZ{U!$PCbz', 'ef1f608e' ),
+ array( '6uj4+87=!,{|=>J=,[1#6v]2L^7}#yx:pdN', '800e955f' ),
+ array( '{}f:~r7{0UGNa$_e:WCM$#d"&_{AQ`pN^Wh', 'fa87c111' ),
+ array( '^K [\\U$+8)k~CCBqGEWJL7Fnh(_7g7!Fc!"', 'f0d49ddf' ),
+ array( '@W\'Kp08oT[3F$Y}N\'6uu ~U8fm9-Q;0qs8>', 'bbc8b16a' ),
+ array( 'eHVU|2iD7CCfJY]@Y\\vqCd,Q6Gb);zG!D}WB', 'b4c1dc4c' ),
+ array( '1BfIe+01dmR?JI2n.>@Ef#N#~u%Dt\\f\' NPe', '7c98ca04' ),
+ array( 'Y`w?NJ_ysqh#1)Hw-w{-m!Qc^9j^g;EB{=bK', '79ccb205' ),
+ array( 'gBF\\5/_F9)?G!;Un=\'S{A>[)Y!LV>/#\'QIcg', 'ba719e14' ),
+ array( 'YC.rLN;Mjp=(xp%:0`DjbpB! E(Rol:I0I=]', 'ce2a6b64' ),
+ array( 'xY,cJIlC;r]KT"77sY9t~BGo/b:@-X}&2*j\\T', '87e2ae2a' ),
+ array( 'X!pK_=!bT8V.RL.ts}$W8DdqCk$NVa$0ct\\C2', '380f7299' ),
+ array( ']\'gv^uI+%> #CW<h=.,)3[`t_pXTM|g,$O#cF', 'eeb01e49' ),
+ array( 'LnKkoO/Hkwez%o.`Q$@C\\upZ]}_.!CTM3!:#P', '9f74a4c3' ),
+ array( 'IK=B29G"G(SKIv)?hc}gC,hga7zbQ~4zKR>]k', '4b7036db' ),
+ array( 'e`4n5`9-iXvNV^rcGZE_V)1U>-!pL_]2@q"UR;', '2ef7953e' ),
+ array( 'b=sYlK9_/`;TAr^SH|aJm.+K@K>C"p^d/S?{~X', '58f87a0f' ),
+ array( '\\/:wc\\jC04@q_. jZA7xd9jD}zw>vwwS\'3Lko8', '924bf023' ),
+ array( '/ MOr.^rx9503yI~>Hy7gp/_E6rr#c,2cYbWhA', 'd2c773bf' ),
+ array( 'Ja[`ro[=nzeh2MZB.!Y"t\\e!oJ[R"DtM\'P.yAi', '59761485' ),
+ array( '70d}ywLU:ZVs]LQCMAn*sqOh@V:NQ[9il~hgw5=', '1616e5d5' ),
+ array( '2pt\'NAXroybznTJXt"rDTO^>=^(%V=Bi/8q^ZJR', '2b93c8c6' ),
+ array( 'JE5E5jpm_r`%G1cfNBnSy-vd=0V{j!N5Gc[\\NMJ', '22863e0e' ),
+ array( '/@,4h=xPl<@@7N8{kHRg3T7I{z&YJS%Zt2o^Oi/', 'ce54d2ce' ),
+ array( '<&O]=~v9j?lRSAi}>e%w1X}lN0\\-`G=}Mm[klS&', '925e90a6' ),
+ array( 'Wsr+G4tFS[KLm%JZTZ8a<_ :.mvyZJ!3>s>f)3-]', 'b47ebcb9' ),
+ array( 'oY*]^T830PuL1uf?d^9?);RG0q.9&<vuu"STVlhg', '76d4ed18' ),
+ array( '>_5OV|n;[)ZdE.-U <n\'Xf|NhQ$@?m)]M>.$;}?w', '2fb33679' ),
+ array( '(z]M*j#+\'r2_Z0/Da3e!"n_O.mTJltBto CzkF&r', '569492ba' ),
+ array( ':9SuIb:+v!-xplI~[}JHrm>cna^Z)eND~":IeUT]', 'b9cb09fa' ),
+ array( 'WbVHP!H- rVratWPW7+a}Y&|\\AFBw{!O_Ww0YA>Y5', '26b7c332' ),
+ array( 'tMvi&HB=S$;.+9jL`.D]/t=gmNB/l{EbI<MOdom9t', '7de5c876' ),
+ array( '*G C3L$BqbRf ;UO]d=Z+ %GMU-=CF2Mn3q#`vFRY', '627567d3' ),
+ array( 'y:Z6o*sUHO`HT)u*74N]G|MZnQ;exn@r*z*z&}QNN', 'b1579567' ),
+ array( '3v#<m.S#]2KZ`\'J3C1,2Q =M*8S)i"W|y[:hinlH"', '948a6c9e' ),
+ array( '9#b@Nvc`$v3$4`/L4977q42MO{8>i`@#d$C4z\'t~~(', 'fa5a6693' ),
+ array( '$3h4_}Mw6?-Im\\E&z/g<2M@Va<^W<]_@pITQH#J^BW', '5db013f4' ),
+ array( '(14N80^ LqNmH0+\'hGeIhWr>*<AT{d,$u@S.Q2/~$]', '57cd1795' ),
+ array( 'mMnxUWA;!*stH}2iR.O_3E!fTRycQ}B?K18"iZ=kd1', '08722fa3' ),
+ array( '`.0sxb"HC6nD}Cvw\'HvJgC[!EE[c1AtrO&fIiiq- `', 'c89edaa7' ),
+ array( 'Q~%Hv-qmWZ23\\WY9;kZ1^+8FT"1G/2)`1.*)<{vsW*(', '702aaaa4' ),
+ array( '4aaM}M(0-4HTiJe1Zw;<*JF3fC+Zz5c/wE]vsf("zQV', '197ef095' ),
+ array( 'd|=vW63s@];SD^_ Ztcjm*He~/m!+?Xp<vgs-{hMY$"', '1ed13f33' ),
+ array( '}cb~>Xb)FmR,laznl:H^V?FKLC4z|9}{|`z<:^F`Lxm', 'c04f1349' ),
+ array( ':[h*I#R(ZrO\'?r<;oU:lS{ho6G6vt0e/kN:6Rl>._m5', '48c23cac' ),
+ array( ' aQ<R(V?[R(LhPb`EsGU`vovJ]5X>$n?eA[9I3X&faRP', 'a53ac530' ),
+ array( '262W+Y.kP}b{[wTz|D:bev{0*U7p7iBJ!T#,.1w_/Z[k', '05d91499' ),
+ array( 'S1gPU"4<x1M$gdu N8JPlM]{^U[n18[eIC7 FL<@^iDF', '12db23fd' ),
+ array( 'N:G}SqO@@-< cxnt1K[[or[6@wV~b{F17m0j__,!mI!Q', '2b2e3dde' ),
+ array( 'BpGT<#0-vkC7dz6Gv\\Y.Kjx+K&-9O.jq 2G<6WJ-DmE*', 'f4c74b67' ),
+ array( 'h\\R_:-newhqCn~]>-I1.[XKr1u!UcF`M#3-=@|#9et]Tt', 'bd458351' ),
+ array( ';r#d$1A]\\4nR6E6\\&d_:q}Zn"tUwR*lm}oS#!u`^+P1Au', 'f8e9f1d5' ),
+ array( 'H}|-^7 ]ro_gEW;PD*N5]Q7S3u^c\' YP~W^^n^<bO{KuS', '8e947b43' ),
+ array( 'fFxpu.OGE$[;c?CdytcQSCA2_$b[PX08~)*t8Y=]^yyB9', 'a34f6609' ),
+ array( '>(33lef0\'yo,\\L]6\\u6e ,}ZI\\9CW\\]udq)QWpb_jRlH~', 'e9d8fa86' ),
+ array( 'J^[@tB@!A{K~5oVqNLW@V*xGlY3@F[@q;|21?S3aO_`eP8', '104537ea' ),
+ array( 'X~e0@<;:d)swI;Ti-pg@"(s6iDuK*GcbFIsgf/"K9vCb2x', '7c5f8020' ),
+ array( 'M?i5_l=T#(xyT$A9fhb[QJkSu%K:h]46}}L^kj3os-iH1,', 'ab2ee1ee' ),
+ array( 'axuETGoA{fFG"0&6G$4sb!_upS#[{5h^.^$c\'t%#[LK]\\Q', '8520630b' ),
+ array( 't$U)x8*X/{,3W)H@hW m;\'bA+?mV}K(rP^|Iw("\'$/;\\9d', '5ec32f02' ),
+ array( '|"<|oX%Sz0rifq5oeeNb0Fk2NpBiM[OK^lINFN#A^u+FhA7', 'b5b5f4e5' ),
+ array( 'N(e18-}K[nmF<Jvg)c1X*`[L@RWg;y~i"e{:rzeOiTv&~mn', '14562c12' ),
+ array( ')R!b\\a?)"qai.[ix]OuxCp^rZ4ja3XP=+R h4?r72T"@1k9', '01b11a54' ),
+ array( 'n</g_!GS[[>=own-#B.lVM_n`5p!F];5zJ}ZLF.("MFrE6!', '8f9e0173' ),
+ array( 'IX/60]v~>,p@RO[hJ\'f%S.4[1a#$\'9%Qr5g#r_#1ktQ>D.(', 'f4e44d2d' ),
+ array( 'n5oth}*E/kH4sb:FVO.ZBn]TZR\'yv5"fJq\\4ofZ S#4HfNn>', '51b1ae3d' ),
+ array( '}}xAlVvH*}B"4Eh_7Fs(.N(aR=+:lyXkxQ.f)%/3#R57w~v/', '0d3e9950' ),
+ array( 'Ek7S;@6m^A)L<a864G|=L,QP^fgVf_f,L~`g?vV~9_KVBdlW', '8c43dabf' ),
+ array( '-itYuG*U/r-uSs# rch3[?2t ^KBD8yQ#o,y86OG*\\=]QA^D', '4d86d9cd' ),
+ array( '%GXafjWgJ$*o=%B@uN:.ejUoGsMy5,>;Tv|<bT$.X.~u4A7*', '38b099cc' ),
+ array( 'pQ9V<oFdct^y"}5Vu3rYhvgB&g8;)PFy"_Q?Ow%3md.pbDHYW', '859042fe' ),
+ array( ';3A3{c:c|UmM{gP\\:o,3t@!ZNq=s:vKV+lj\'P&kM[Y{XBL6\\<', '88b478a3' ),
+ array( 'Bo2cql2d+& #RW/@B6qH#@%\\<^ ht]&8N9{@\'/%36%6h\\F* \\', '4b1d0513' ),
+ array( '{I`<N>Y.>C$|J<Kc8kkHq~^w6GT\\RU:N~{kN:E\\YiaV4}"x7n', 'f1ce1247' ),
+ array( 'e_`d>Y{f/Y9dsgdpT3+zpddR<yP?rh.XHo>fI;NXtg>iP#Z%6', '3e4eb24d' ),
+ array( 'e \'KeZg_,\'St6-=\'K%QfS+\\;IFkL!qcgrk3XF{9R$lG;yeBFjs', '69476a97' ),
+ array( '.? j[I2Hv4:Z{-F0fm, A0mhLhOn0:c>Zc*6.=^%Qy`M(\']nuj', '9097fe8e' ),
+ array( 'n7{]!HFP7Vk{uF`!]n>=to7U>?]{.Sg}kc\\l,#>DZ*@QQ"R/qq', 'cbee4ea9' ),
+ array( 'Mfbd<!$z}3Oe2;In(UrFyMQ; $=R40Eav(F4)K/(^^mpz8`#mS', 'f19251c8' ),
+ array( 'Jh!|%"!CT6SzwK#?_-jo5JO#<J<|N*PysRwyTy=*0q%(=)G}63', '8f27bdfb' ),
+ array( 'nK]?Oyikv9vH4k{,eQ&$[6va>5jf3"y#NWB~R-kJGcr[Oog6Am;', '9cb72621' ),
+ array( '}%3`DHK+\\N&_|^#|10h[WLO4|?{4ajP_pc@5-lAi<GJ:\'M78^!t', 'e0686fbc' ),
+ array( '7NEKLdHaG32($vI:$7[nS$9n+f&DF(9]V^*#DRdlfwtko>&tUbc', 'e4bd2dd7' ),
+ array( '*f|xrd 8,(Qi^1sbVGHC.@9y1W &.cj9Kh2>M2VZ:)Dy;9\\r`%6', '5efb3af6' ),
+ array( 'oFOiW(j^7NIPy2b9`uo;1y`+6zh)\\n@L5p6mx!L0OvaJ)Dci;T&', '05e74ead' ),
+ array( 'LNfXdaAn>0/jF "5y#b+SYl}b2bMM7Sze:SK|u:<&J(MJ*bD.EOb', '17cbb538' ),
+ array( ' <abND0|\\dwC Kn|A*:HTCv NZD] t@!1#c`Ht]%YVHY"8WDBrlw', '4eca862a' ),
+ array( '6dwd?=B@2cADf%&0zd5U;]/=ugb9[P2q5*WTHzt[_6!G<\'W8klm\'', '296c9ed7' ),
+ array( 'J}EAe)ZBYl4nwlDAh9|HP}om&H&q5sy`q@#XI]z$K0rD}7efQc0#', 'bc868018' ),
+ array( 'a!pgIwZ^lU@^uC8@"3DND8rCPY*#=:\' <xhepDE]ye=p*U1,iVZ/', '09251477' ),
+ array( 'oNRA(\\DFwKF4D/z6S@sN\'1?1gQ=R)xaxG4:Pq_vj+= PMzf";[QCm', 'e8f565aa' ),
+ array( 'pTUCr(LkiF4~`eq@\\\\Lz\\|IXdLt@}8.nld2_l_LW&aWfHI(&&U!cS', '40202a4d' ),
+ array( 'K<8w2YvJhe8Mxx;YFs_)KGQtPW{&Y`Z%}r}0Mt[6[scUm~/4rn=?7', '9d3dfab7' ),
+ array( 'o5gG1n!rI\'p=&!jz]!VRe-@d<TX,rwCb-,+?z-2D4$a;&M6cNm65z', '092e633d' ),
+ array( 'Vy8,SD LhcZtnyo|-421vM8Dc{sR3)Ni$fvX,w%t[_iKZYHhnZzf(', 'db49c4e2' ),
+ array( '3,l/ @B*n-/U%gb|lWYMA&){Orj+mQ4!]!1^BTi1bxgh`JfN"@|DG&', '0c69cbb2' ),
+ array( '@vx+"g]7i<9z{[Pel4^U|? cn#%kGLqgDksGSR^=ow9kSjQA~0v{Pv', '8aafa096' ),
+ array( '_?zd,B2~+Vj ~?S]]CVv/+aaL`qD]C<=c7#oZ5oelZflz:KX^"Pn.3', '2da2dfea' ),
+ array( 'PZtC Rf<oKSs</),uvf\\cbw/<W2lF@ v{u:{H"88Ml-i{6ur.]OqAH', '6aa6fe03' ),
+ array( '"] 4JFTK>PAXMi[e#*S0sPGjCUIsHk=JI=^td4A#eb\\3M8yQBMb7~+', '50438792' ),
+ array( '#CaM8*9UUbs5XXIy[/]8B+P=]sjA+jL./.\\G9u|oYp%2JO,&_i?"up?', '5a10e446' ),
+ array( 'Td+upvB~&Q\\NkRL[->`?h1Lop7/s- 4ad@XU7zU>M2l9e9trWV3Ag_1', 'b41de8a2' ),
+ array( 'Xw@L&@ah&"A\\9<3WjEE$,_y 8P3Y9sjrk,@rM"[S$|1>:Du%j<*v{$v', '3d1d96c3' ),
+ array( '4T+nn~Yake"^4$;g)8xGR>>X)Zb Wfwk<#Z+#5mo{oO0tjx}#rEV1c/', '021cf019' ),
+ array( ':?r;vZ3cv7?#:Tq+QaZaWE[UHN{ ``0{ #7v]KZUbyX}OJ)!-ccd*?;', 'a52533a0' ),
+ array( 'Sn8SOxcLxfcpE0KzsFTqu~{w-`[rj{/>jGr;@Vg:>L+c]W_Q}4Dt4@lA', 'eacea244' ),
+ array( '"I5lED,1k~M-V6GtcRYA*9s)N8}bYk%[6;I\\_UnLU<Z,R""7U\\X_vMiE', '8dc7eb87' ),
+ array( 'eg)?T/{kKEH+{7XRT3^(6a?k>xK6F6\\-~eLSuI@AnhMk!\'>V:}_P_~<~', '7481744d' ),
+ array( 'xh5@~qM}XzRODrq4\\? ^F>6a<u3|uO{n9209%]8^Yk.}_ 3=@3{gR2In', '4da520dc' ),
+ array( ')\\l~-hmG{}`"\\y`7eo6FpIc1\\_x/rC~{ k{.UjURi7TF16]w&s>w>"*z', 'c6ec7195' ),
+ array( 'b#+VG+SGvOUM:, $CTKUj*Nq~mi=os9SwD+?O_gG0>tJKtOnJ{E6&s(&a', '6976d3a8' ),
+ array( 'rCRg\\\'`"2!Qriy#(nNTd~C/ziE"]N(@AKr))zj+.k]!UW$^FR3,QW;MA`', '57543a3a' ),
+ array( 'O /X@Q%4[.0F:>2w?hPDGvwZ$J3?wT!HT0!ub&+>4;dOZwGy`w?)o7dsa', '5e4ad807' ),
+ array( 'w4ZM5##F%x)+%G@A-o{%8vf06p!NUu1N*k{?o~etxn }7A?D1;JI32ZI#', 'c01f194b' ),
+ array( '\\wXR)(]u$|e#cZ|SZzj{;/.WZXjl45op-ID7Q"-U rYcMV7)R#&n35Fmm', '4e92f8a5' ),
+ array( '2Z"GJsUt8lF;z|;mV <.8F`;MPNbw<Q*vTRBH)7au]|q[9_29|ARC#mpS<', 'cf4d6b34' ),
+ array( 'TKY&VQZ)t$2,e)jczF|[Y7Xzi|~WnRtC~OIU"%_v)r#n{nRw6PTph.lR+k', '7a8a94c5' ),
+ array( '+y?!>>PgsSmSJvFNfC=:<TjqES 3\',~2\'>4E\\e.Q9{&crL2YpPs.%_ K4 ', '11032641' ),
+ array( '_;-^N4}bZ[Hh-ae3EX`X3R)(`/h`[|a;9nzg$xK^UsHcV.w{gXUz,^$lnm', '9298d67e' ),
+ array( 'MKj/f%~bl#\\9b2-+vc:n`"H6}Tu#Aepo1\\ xa~[O#8hfKvrBZ-2</ZS.0I', '0654c0b0' ),
+ array( '1Q/"BA^B:ABvpE0Y-[Q ~--1I=l|L|G]OW`qy?44`V,R|<-*w^*wk8)5Vu3', '2f477f17' ),
+ array( '#r[aB4B5.bIBD Nv}j$(cb3[OLee$\\x\'PUhsi,)wnR;3Si*QU/Z:rmvB;\\(', 'cf7e00ca' ),
+ array( '?9"GiW1^B=g:,:U@n@J@vZ{1Mi(o&exE zljS~Iu<11ILgi;(5\\~oX1=C:.', '2b97bb55' ),
+ array( 'I \'n #\\jW[4NxF_BrH-.PBjP2CaPf|_1|f!}j^iC:}q4DRW7zdFL\'1|:U_k', '8923a6db' ),
+ array( '=\\KNZ2OY}/CAIA3^ff6~azF.#W,>.l*LIU{%gL^f["(&D<d,${,evRtz+"9', 'aa215ef1' ),
+ array( '9nCe9xb>a/}Ij QpEnUQrQ]YI0OE<Q^U@#<Y|~x^.v(xvZj=J@n=rMw<^Gaz', '87741385' ),
+ array( 'xAQ:DnsBnl"}c*w[ebx1#hNu7G3unuqh7D#\\3w~"d" I,w&rZ $^iSU!{hwj', 'cccba4fc' ),
+ array( '_jTw/XTBPTE5VF_c?eWzf\\YP1/Q-xJxY5MQD&\'gV\\-l4TMxs4Pnz.HL?X}LR', '5d4564df' ),
+ array( 'HF,^s]#zdjRBx@VMnOA# 0~/YKN3J{esBrR7QV36BeY;\'0iu_+y`<yovF>*q', '3bec6d86' ),
+ array( ':pe]c9t5o(L2n&Nv68lvDgW`bGX)fbz"Sa_8zTNk]z}L"LC8e10*ygk\\0Dfv', 'fef9aa77' ),
);
$i = 0;
$pass = true;
foreach($tests as $test) {
- $result = hash('fnv1a32', $test[0]);
- if ($result != $test[1]) {
- echo "Iteration " . $i . " failed - expected '" . $test[1] . "', got '" . $result . "' for '" . $test[1] . "'\n";
- $pass = false;
- }
- $i++;
+ $result = hash('fnv1a32', $test[0]);
+ if ($result != $test[1]) {
+ echo "Iteration " . $i . " failed - expected '" . $test[1] . "', got '" . $result . "' for '" . $test[1] . "'\n";
+ $pass = false;
+ }
+ $i++;
}
if($pass) {
- echo "PASS";
+ echo "PASS";
}
?>
--EXPECT--
diff --git a/ext/hash/tests/fnv1a64.phpt b/ext/hash/tests/fnv1a64.phpt
index 870c6ced0c..1393fc1b80 100644
--- a/ext/hash/tests/fnv1a64.phpt
+++ b/ext/hash/tests/fnv1a64.phpt
@@ -4,321 +4,321 @@ Hash: FNV1a64 algorithm
<?php
$tests = array(
- array( '9', 'af63b44c8601a894' ),
- array( 'w', 'af63ea4c86020456' ),
- array( 'v', 'af63eb4c86020609' ),
- array( 'Q', 'af640c4c86023e1c' ),
- array( 'd', 'af63d94c8601e773' ),
- array( '"e', '07cc2f07b4942580' ),
- array( 'pl', '08d53c07b5755019' ),
- array( '@L', '090c3c07b5a49289' ),
- array( '"N', '07cc5a07b4946e91' ),
- array( '&O', '07bf3907b489ac22' ),
- array( 'KE:', '50d8ad19d18c8505' ),
- array( '",u', 'd511f317d88f429a' ),
- array( 'RX7', 'a0549119ff001600' ),
- array( '/<i', 'eea15a17e6ea5bbd' ),
- array( 'Otx', '2ffdc919bf72be52' ),
- array( 'w/qn', '9c6e50f771dcafd0' ),
- array( 'aVqG', '4f1788838c1bcf9e' ),
- array( 'G^hs', '33551d7dbbea0209' ),
- array( 'a7z1', '4389ab82f4d6a7d0' ),
- array( 'c@Lf', 'c14b5591800f1338' ),
- array( 'MB:&Y', 'beb09d1ee59646d5' ),
- array( 'ICDy9', '4f05ddd19c2c2285' ),
- array( '>qH0a', '370b9a8e5a2329eb' ),
- array( '*fSR/', 'f78a85007841cb19' ),
- array( '3;$tS', '94b935103cc08938' ),
- array( ' \'7AS}', 'd81e3aef0fde6ad8' ),
- array( 'ou9vPc', '549f05284ed347f7' ),
- array( ':u]S4O', '31b0206c95a52e7d' ),
- array( '{D2\',e', '3a68240ea9539e62' ),
- array( 'Y;yt@n', 'afdae733c98065a2' ),
- array( 'IAu`bI_', 'c311eb3e8f9f51c4' ),
- array( 'R@xIq]d', '3fa1984555c55e46' ),
- array( 'g;8{k5@', '9e9c5e80cdc3d58e' ),
- array( '}<Ldvh^', 'e5be53f31a393f34' ),
- array( 'k*N6KDw', '558fdadc82fbb9d4' ),
- array( '/nWb0Q-"', '84fcc8959c773b75' ),
- array( '/qiK+e7@', 'd177962e1def962a' ),
- array( '\'5]SzT=Z', 'befb197ea3aac960' ),
- array( 'AH)WsNO$', '63dcf1c6c88d5426' ),
- array( '=(fNZsPj', '806bfb067d62da41' ),
- array( 'f:6q!M3(c', '5125f3e296d40b42' ),
- array( 'p\\^Fz:gCC', 'b9ffcd384d90ba98' ),
- array( '@7qp<0x#^', '1da17e378a5f0686' ),
- array( 'Tw/?^JUQL', '85f6d1938d45b818' ),
- array( '#dTfU2F|-', 'b66e4e092e385394' ),
- array( '`dP%&hvv%(', '84523fb38ca2975d' ),
- array( 'p)fE!vd`B;', '9c94c2a34d9f95c3' ),
- array( '2n>vD&MVMJ', '1f4fd77c72b6004b' ),
- array( 'd//546~,-$', '159ef268adc718d9' ),
- array( '4~.{E/s*p6', '31a60e2db942bc67' ),
- array( 'F#&dyJkG!:q', '33b8c68aed55c285' ),
- array( 'eI"{^9zjG ', 'b42c013a2028584a' ),
- array( 'F/|k>pv/(=3', '671c9537b41d76fe' ),
- array( '.#-XoUZ*HAT', '84e0630a952577f4' ),
- array( 'K>4d:~-: SI', '57deb72cc24c6bad' ),
- array( '|@hn8xvV,%Y:', '157fda2502fe1297' ),
- array( '^Jp:T9\\*ez>K', 'f784c17d1a2d1bd2' ),
- array( '5>XP>-z<Mc,f', '6084bce050682a8b' ),
- array( ']#=j)w&hBv#w', '7a2da4d0b1c01e1e' ),
- array( '1_"vZ@Bp_{A}', 'e1e8fb095e4709fd' ),
- array( ')<;W!G>^K\\JTT', 'dd737d6771e9cd69' ),
- array( 'P>vGAoX"qP]3s', '0375e65060074988' ),
- array( 'Nrooqy-.Q.Upm', '135d77993c647f43' ),
- array( '"M8W"huy18ij:', 'aedeb2565e1c29f7' ),
- array( '\\;wo0Gb!8UzEc', '59ae633a0b17a945' ),
- array( 'LS:=B<kZtmDjhU', '2b2e674d9a46a36c' ),
- array( '$S@>0\\7 l^cmw:', 'f21c8cb206540a2e' ),
- array( 'h=}6q8T4U@nJ/3', 'b258eae8a4671c77' ),
- array( '6wi:L*Y\\gp]UPB', 'bff5f2c9ed84bce5' ),
- array( 'CH\\-fZDXsxlJ9\\', '298d4e05d5a47c45' ),
- array( 'uIp,BZFne!KMr*#', '8641dfc04c9fb552' ),
- array( 'CLGl)USdy-Yry$-', '3ab1497c481f22ab' ),
- array( 'WyVH\'y#NhhO57B?', '8dea1d032c597f60' ),
- array( ';fkbSt8(Z264&09', '4b875649e7cfa1a9' ),
- array( '4g3k1:e4iN}9c6[', 'd33acc8fe01b77fd' ),
- array( '$QBo4veM @`6UgGn', 'c4b17749dca1aa6a' ),
- array( '{0#gA>MV(|TAaj}e', '067ae9cfff2cd6ea' ),
- array( '=AVR8< 9]aO3Iw#E', '02bad50d48a8e564' ),
- array( '(&-JD[!LYVm<Bl#_', 'ec868a84ae92c032' ),
- array( '.Y2Gv3`Tt1h>)kd2', '9f7776edcdaf2937' ),
- array( 'qq]6N_c)7REY?H:M"', '1899eee357e747b4' ),
- array( 'Mtx`VNVg7uq#Z%uMc', '8eb7e5a4bb9fb739' ),
- array( '-{Cp%ZCK5ctO2v}\'p', '58ebf399369565ce' ),
- array( '^^@6GW,9[f?Q4#^1G', '76ab1ea61d68a738' ),
- array( 'P7#tb9XWhjOgrAGQa', '29294a2d4b758119' ),
- array( ']x9i3uPSGeW\'v~W.#L', '508d3356f8ec886b' ),
- array( 'p<&I&pxmd:57{r06\\D', '4660b5543de2afdc' ),
- array( ',.wTsO[jO4xSajog4u', '6d85fca5fba07683' ),
- array( 'Y.c?HyVElg\\J,hY%>N', '01e82905c1f66c8f' ),
- array( 'Uy:&/4Yq~IZ4@5B%Tk', 'a05cc808b297050e' ),
- array( '~+1lrm8 Wr&uA[p[a!o', '22783c7a8fbe4826' ),
- array( '<roeM$\'bG,73+CDx731', 'e00ac9dc3812b301' ),
- array( '7j$>aFyS#\\TsxGc_uhf', 'a8cfc6804bc24e1d' ),
- array( 'X0rpD~5iwL|*dh/#KU|', '17b538fc3a531c98' ),
- array( '~YZSMS{14qzzK,n=PmR', '47a7dd2be021ae55' ),
- array( ':f 8pd!!hMWeL1A!^u|p', '4c9d34c81b647804' ),
- array( '*ol&<xtZIb-dJ.|<r~=[', '7d8483384e8a46c8' ),
- array( 'LuBx\'dzfZwXehEk%>`_h', '25484f299d38dc95' ),
- array( 'DmMn{K+oKILw?oqGTl/0', '8ecc9d0f58ead225' ),
- array( 'eguN-bTLC55h$cX!0cq[', 'b3e4439d186da97b' ),
- array( '.?TN/Fvd4&uznlJ{O~Is5', '983efebee9945885' ),
- array( '_\\9C5;Sy-0)LdW[,NAAU7', 'c01a00203768a32c' ),
- array( '<D%fATfjH{K&6n;QC6^T?', 'ef488311549372ed' ),
- array( '+9wgEG*g}B$BGjd{QPEN{', '2c57de61c289de00' ),
- array( 'Kdkg6/~uc>"}7jD^t,\\80', 'f83a6970b348b383' ),
- array( ' _{e\\N6#|2Nb~7y/6orUrq', '26006911a7c5d137' ),
- array( 'l]6LRC)jS*KPo)~&,{9Z^9', 'd848d0547a41bac1' ),
- array( 'rXH)I;^<.KyExMh"9=-em|', 'ad7ca21d760bab1f' ),
- array( 'nl$zh>UHWH" RL<1hJ]coV', '87be1c6aab3568a9' ),
- array( '2XYKuf1cd Qhz;\'Qc^zf^M', 'fcb5e375b267b232' ),
- array( '3z_|F>`6usoP?e8QJ|R{fM7', 'd6cd721ef468a686' ),
- array( 'm {Mzc-Iv(*tOIVe@JVpj=*', '5ea4e77a701e1fd9' ),
- array( '<g\'ndm=|\\=y*9]7cU@nJp9"', '256fbcae5dc6e749' ),
- array( 'VYL.K7KUT4]DyLav*~p49OL', '55e66fa9c0b7f691' ),
- array( '}%mlP^&R6` D,8pbl%A1~ms', '1d260b7fec06fa81' ),
- array( 'vwsg--8Z,=Ixn) A?`BdlZVP', '1ac9ffbeaf2ceff1' ),
- array( 'H[qZ[_NRXC;fQSA]qjV`sW#4', 'fcd1a44f1f9644d7' ),
- array( '8Ey&!PVJ-H%i)T=bwXII-j( ', '20541ecba873cbbb' ),
- array( 'V^`K6d`O+ZU,,,W:U\\$_2BB+', '817f942d64cdf041' ),
- array( 'zlU)W])/=j[SP<$[wYh%f@@=', '8a852332f2c99373' ),
- array( '}E|0g@<b-qleOuumaQA2nFnf ', 'f817c2a8dc3cac28' ),
- array( 'Wlgw-%uR#\':DC}R5j8ea/SDau', 'be35effdcebfb5bc' ),
- array( 'VP<E8=}%%u2+le/s S8}&Ni?4', '31a4b812c4ec4d45' ),
- array( 'LOhp1_Ga|my;k~Ab2LOw\\Cx1[', '21bc5ceca29e51b8' ),
- array( 'w7*aW?/() 9hHzf6u"#uCe(p5', 'de09593ecddfbfad' ),
- array( '!MYz^5rv@UO`dWidpS-l:Db=GY', 'ba497ffae361581a' ),
- array( 'a-bRCc!|_`3RWS)(5n`~TRSa?n', '7d6da8683f44e043' ),
- array( '\'#,O]m\\@A!%B}d$18\\eAdz0Ezd', '964a554b2ea62312' ),
- array( 'xOG9>O<K~y:\\;\\]@ [%$l=`S_E', 'a6d30ae05805da81' ),
- array( 'OokJUez}~9M;eL6!)Q]fq]Bwa0', '52a0a33924a1e495' ),
- array( '5Bdth4eU_;;Z9:tgVZ4m[=@:%3w', '4e3d8a502aad23d1' ),
- array( 'H+YYA|>7fR|<39XmSsb;K>P9ymY', 'a30084c8ebfe7959' ),
- array( '5sl-<xgv:d5RLhOh{iBi=6MYak*', 'e4a386d2c4782f99' ),
- array( '{fxU{lC**=q!XW7+$ Zm|E0gcG5', '19e6ce2e2493a78b' ),
- array( '=*"H&iA\\f/!p:>b<v;S"?T].Q#?', '226c52cdff2324cb' ),
- array( ':ffP%pSMw=oT$ Uu:sYVkt+m5_KC', '08df2d276c9a057a' ),
- array( '2OcL7J}<<Qj4nZisZ?iu4DL 9WmO', 'f02866cab6af3d35' ),
- array( '8:sJjWw"#u>@H)T7d>,@^v6r;crU', 'ef8377919e2a1bad' ),
- array( '<a&T|y gRxiUo)v83LPwk\\9JTO>o', '99a9a1a21c2ee2ec' ),
- array( '31FOsL%pG%Yz}CQnMH\'`tWY`5r+i', '887cd200603d7a11' ),
- array( 'BJZV["&PN+Bv1{q0@C~mk\'Oa_*Bt|', 'faad097477f65bd7' ),
- array( 'N_@x:wU=}&l*Ic<EVLfyLUfS&H30k', '26a5acae427f26a8' ),
- array( '(.:hN4$FiAEp.P:ql`I:GCf|+:$TM', 'bfe197dd01c4279a' ),
- array( '4@VB[@qoD8Ze^Ks/ff|G07oT}m`9q', '60dffddf1fd785eb' ),
- array( '5g&V>I2_;#$T]j3*^CqF@:WX*-Vxm', '05994a3217bb26d8' ),
- array( 'oj#WqZv;lWVp[,OF?Y&cLM%f%]q24j', '151f45373d53bd27' ),
- array( '!%U$]H_UcL-;>iGm0gH7KtdP\\i.N|C', '0b91af28a642cac4' ),
- array( '9}Io#(8b]|0k8NU`=fIe}t[bF8MUfJ', 'fd58c24dc342b56c' ),
- array( 'y ICoML(0+%Av>pM .4Is2?OufhC<O', '199280a86e05b101' ),
- array( 'n6O8Z?f\'Hw2N9*m*Wn9k9.~Y^t@G9]', '732c4bf03e824fe5' ),
- array( 'v(tFAPf(W0 j^:uMDM<^:Vl90K/PrH/', 'ad49c5c4b29581d8' ),
- array( 'jQ$1rTx{-*{xi7n7\\=T;X+(r;T"lHK{', '74f8023eb53a4c87' ),
- array( '3|!EpV?lcIi]3!LK]j xC,"6HW85 d2', '45f93db9ecbd61e2' ),
- array( '4a4YSjy@NC+,V,Y#jE#dh/f~W?8m?}!', '628239fa1e9fbf4c' ),
- array( 'T_5/3 )TOL_\\$l7\'W\\+<E;$ErC^ac\\b', 'c4d6aab371c199b4' ),
- array( '8=xGQyP&I}f&"S>*+z6GAQLfDoF\'S#jk', '97ef2b6a27cfe08b' ),
- array( '@c3q]dx(b_/e3Mp?H\'gjX4Q}$w%X{pE<', '8a65a0d9c497dca7' ),
- array( 'TY/3>(;"hJg{wY<A`$,:8^8=W>vS/<pd', '7d99f135b9dd392a' ),
- array( 'u w4)46r^~nWX,x:0%TIdmg<,^o<z`"p', 'a3296f83b9d4178e' ),
- array( 'az%k/<^m<NEtZ?0kDd5*R|F_[6|Ww~HZ', '6971ed23982e966c' ),
- array( 'yNG)j&w\'U>|1]-|#r3-E0S&lj$Db#m>}<', 'b3fb4982abc0e4c0' ),
- array( 'e(\'l!/C?-T|:Q -d.SuaZcM^)1bvOa36i', '031098cfb4e50d1f' ),
- array( ';$jKG+X{(sN)"48U+z1oHoxYSo*5$@ ?D', 'd2ee11dc187ad41e' ),
- array( 'kjlvDi 89*:MBpY="IfrB@G3J\\7k\\W1HB', 'fee80db84822febc' ),
- array( '}@gh@ "K:Pm,*,.Tr"w4I+_\'CKcz]->\\N', '849ddd5ac8830991' ),
- array( '&En&G;Aw*M#6\\W*_O?)[~0~Kty)#9eQ?+A', '58f765bdd716e1c2' ),
- array( 'FS\\hLf6O}s\')SWH]3Hn3sc.|gGc:go[/C9', '1ef7be10e1e94525' ),
- array( 'wo!/@ #H)W R54z$GnhVlP}QkfAGueamVc', 'fb192bd95f5f88b2' ),
- array( '|vc!?mX?@mT<r|+\\Sx.RJy9lB/R$})h{ L', '3f2604691e2ced49' ),
- array( '|?;U_[D4x81%te}#8I}Q6@ahE_q.[r[Y3v', 'cb8807aabe087372' ),
- array( '/rST(Ll:Qb Pf8yej0&LyL-lZi_6Cs.Sga(', '4c6bc9be092660cd' ),
- array( 'o/u+aY,2@D-&0>-\\8Yj&5TeLxZZLB=T3MK>', '9207d0b883378aaa' ),
- array( '/%JBFoOM n[]\'5H-K}swvORCqpx%>EDNKnp', '34c18ad3e2030b27' ),
- array( 'q_A@_0{>82gF]e:V]j*!\\zza:@&hkuZ^U{ ', 'ff47e63839babc22' ),
- array( '6,|UD/=jm$&DapOcNJ^0e 7Nl.*Ld&Lz3IP', '8fc04f6e48534104' ),
- array( 'WYnCGrJlT<<8jgw{Mx4|eB\'2\'._#A)SybC>+', '444cf38629f9f5e6' ),
- array( '6hxk&5$p}|lKu!I\\DQoK_ON!X#{<G:H]#AI*', '93be8d30fbf2a711' ),
- array( 'WNzUKh"BjL~/}o[]?+_x.[6Vu^4y ^$X- .Y', '0457576f79c1af9f' ),
- array( 'h1{T]{c[k?:+Ky%ZV;1MzEHz$MT1Mbk7sgkR', '60d5a7492fab7ad1' ),
- array( 'dP.PpH\\<Cbvz}(HxNqtS?Iem-Q%":qT~CcP4', '0005d93c99685bc1' ),
- array( '-.QPpIKoRth!f^U\');t7ly9\'ln\'0RWE_ew1VA', 'e13bf2cdf312dd7b' ),
- array( ']FsR0u:oKAxg61U1J\\~9d0l<UL#N]Zo;"dn3[', '53d2c531034cdde3' ),
- array( '*#\'K|ob.EsY#rsg$`%Y.((lcx(e]wx9"|ANy1', 'e16aa67d2eb4115b' ),
- array( '1)V%bYxVB}8GWFP`34Z<z95tS7qtek\'wt^}X9', '5511e58643ea102a' ),
- array( 'w/[uH$NnU0#jj?e$TZWlLMS9UK/4IgNAw+7@0', 'c03ee6776b09be84' ),
- array( 'e0eu3PaS7f)r?v?lJYCvhXAP\'bI3ziCaz)X.Z:', '6e63e154ba982b2f' ),
- array( 'bq!kd@c%.._R&H+Gy3+CG&.jh)tA8P[zC]g)~K', 'd191830ad78ef4b4' ),
- array( '..Zn``7l(2 3VG:e3#o)D(Y!$|_k&^85lr$MT<', '7aa3d56eb663566f' ),
- array( ':]O;p&c,lv0\\ UdZVhW6U^umtbax066KsefelK', 'ea574dd4514d7c68' ),
- array( 'qYB#6CX{~0dVF;6=)+ j%1"<\\u"D[ooNI3Q`W+', '58f171ded41e0193' ),
- array( '\\V;B.b^D gP SV1VrnLu4)f$W18*qo5OGPrU3Qz', '11baf93d39928abd' ),
- array( '4:L4n#FEv5rmJ{TOTeg^XXt( EzVYLRmg #V$I{', '0ac0c936f7521a28' ),
- array( 'z_nh*k>Y@$B~\\zte{:`St.\'cu\'fL+1I\'q9p{%/V', '1a0c38f41c1826e8' ),
- array( 'E4yEpu:WqU8FJGM/=Uvja(4hyMYvSiNx}H>o?YH', '75024234e0476c05' ),
- array( '2/`XZ(\'jF\\a1?iF(dtb\\HM+BLTa<t;d\'KF_\'Ogq', 'bdcaffa418ba3eda' ),
- array( 'vES(d>Om#EP`n}l1JBsg70M>[t~bDfU;-)DqGt_K', 'bda836f33c0092dc' ),
- array( ':1-)0y;Z</CS?pq{eq^+Y4Gf>lYfa:2|K?&\\:B7V', '16e6a228513a03c4' ),
- array( 'QZ+qL}m3oM?Ibf1!Tjh6&z4R;;/V]F-0"8#O6pc\'', 'd272ca04df7d0554' ),
- array( '?#P"jb$?MlVThj\'%&6[d]it`#w19itA)wr,bU1##', 'c1b2b80d012bdf50' ),
- array( '}ZXgE_lLvI1T3\'67 GQi<rs5e!x;2|?1Wwx}WfJN', 'bdd12a4f05766cfe' ),
- array( '1\\$Ed;\\dc.O !D6fE/#X,Bic:carJ-B\\jG"Ob^4Fl', '9667031dfb5a16c7' ),
- array( 'dGm)^UOmX(zzq_6VB)"PK^;s`jV? },dFzn%Q>s*G', '166ff835024396df' ),
- array( 'n&:O=pqGrBsQ^g2J>RJ=_0c[ i->]8eL?!|\\qo$e3', 'bd73d9e41ae5c6d8' ),
- array( 'w7q_J<~|g=]w!9wjF7I^}v}~s[pc_VvXnh9:&87mV', '81bed0679537a583' ),
- array( 'ueW/^CUul5tc4sXoe<P=4*,}CF$\\^q3TXjd8/;.|P', '823ceb765e67c7a8' ),
- array( '#aew:U]W\'{k1(iTOm1/`Dd:0JR@ea>6e {]:R<qZ8^', '3d7194b6e03cc23b' ),
- array( 'kAHAq7S"wxf3*1eJvGh.-h+j$^(v9@U&b~GT7zV0s>', '01e47424ff38f337' ),
- array( 'C}P)IHP3V]|bI!BQx[rOaUO*+f&bvz!:yQDCzuVRTT', '55e116dfbdeaffb3' ),
- array( '5}VWPO4D vzO!&7(h.#jI|=nA8dxj9M 8$XhTm.Td)', '5ccd76496410ea5e' ),
- array( '%f0<nxKrcup!d2:J,%cZ&{^^e4Lsi2}nx.,h\'X[kOM', '99b5ca1d7ad80276' ),
- array( 'm5`(_l.DG4@\'s\';A{%SytM("60[r|+@jA!s"n"F77g>', '42c09c31678d6f41' ),
- array( '+nZLj`!dUNmXe}4Yz@zfb|[dk^+#urB!a|NM^P25 !m', '7c2bc1c66d9f0223' ),
- array( 'e~#?zD:a\'8=l${w(qkKsNIC{(s/=t0,Z0/z+T6l\\N+I', '8b024f00082671f5' ),
- array( 'S\'B\\y/(n]Q3ZY(jv|{$W,3S8hi&E91ol92I3BR# $6[', 'f90f149aea3b4fff' ),
- array( ']?FU<BZtOmHgW3m}M m:9!dMC7QD<h y(GPDj+:;yc#', '216ea9a72de9aadc' ),
- array( 'RwqPEr>`,@EZc],)yt*t|QFB<R\\WMA[ 9NQ^Ao?N1e)u', '9a53a5fdb4a3fea9' ),
- array( 'C5~>*)4([ZJw-(P[I-[b\\-A}}aM/GV&kl%+w/? jyJc(', '7a9e26e4aeb98fc9' ),
- array( 'R5c|B@_~N"}McK\\,#cxpi%hxDhd?3HHf^,c!MD!{F I+', '4f0136432df156d5' ),
- array( 'L\'8Oj1@U6)N[r4z\'\\Cm;PR=}v?z>?EIkLa;8s\\m+f=fZ', 'c2587023e1d5b660' ),
- array( 'Qaa/&PKV#iTz)P9Huc4CFP\\:-KEth,O;n1JtavKe`!ai', '50683e95eabc367d' ),
- array( 'R{2H_Fl\'vIA%tgy^tJyd\\EY><&%}(fgZby#CApJ8:l>0U', 'f16422882c0082cc' ),
- array( '9nJci0@/i_LoeJxL2S0-WTNH gbl&rC?bn$L~E[h%)YkS', 'b8c4873ffdaf0fac' ),
- array( 'R8f\'Is^}C\'}+jk2^/QA}Vm|{If"SAm\'t\'m{PbZO&bN2M:', '948738b38e532172' ),
- array( 'D,JvNIM<GJf.L:P:AEB0Ars|Cy_q-.-Q;XHi"v&IAmXn(', 'afd0b1e73ddced08' ),
- array( ')*JNL[p@OmcJNVW]d*y=Sc?JjhlYB\\aKf-z4hkT9Z9d*p', '1dfd3ac789532668' ),
- array( '=gUGarzF3F2|4k?qNjX[fmERC_.\\D8Nb!$*cw&*+M=(b*G', 'c7ce7d6de622765c' ),
- array( 'TX3.5y{[M?<[|`sKDtPNXHUcT#"\\e,%;e9I{4FWaes>cU2', 'f0fa521206e1c67b' ),
- array( '0y(aIa*~F_#H<iUB%;\\N7punS[cq@:%Q4-3]o=]7|`_:J5', 'a38fb64baf6368b4' ),
- array( ']PQ: h,uX_R=QrWWDkdWJUu(lsiM/5cme5)e~5\\Wu/uH#M', '885465855ee39187' ),
- array( ' G:e d;vm)kWWzm;hSPr:P)v)~\'~G*LHQf.RLJI:S5r,1`', 'de1bd4eebc876571' ),
- array( 'Gz5xmPIvGRvNQ>Y~f+fu^4@)Ot>B!P$HK:B:jk13?(bqG<p', '5fce9e2beab28428' ),
- array( '/HX%\'lF0<;O_< ceL~(fitx}4"`&I|wYFP_M=&^YA.:^/}E', 'babb5873a7b954a2' ),
- array( '[}MCgC<eW>G^hEVCk\'#:E)y K):+89Pt7~8 BTfzs.Y\\T0 ', 'a4dcad2a3d27a8c5' ),
- array( '@8#[^-U_Y^ydw45lL5%LXZ3SNB.,v?,8X0t7>Jvw*q\\"\'rn', '5fce337a1b15535d' ),
- array( 'S)t aO46}VD*Nd7g=H\\Uf\'M^2?;4F/$y8xzzH/1GfVR5;j}', 'd650a004f4a4a934' ),
- array( 'X3Z.yb[Xt{t*C$.>=\'98PHJx0!KF<6DuI~%Dba|X^rb"wp@5', '26f61f52e18a413f' ),
- array( 'xYNI#xB4ynZ7& .P 3tbtr;Te}V^nwshRC2V<Uj7DFOKF]{F', '955141b7150fa2c1' ),
- array( 'pp)fcE;JCr)3j}{=A/s^d^v*%FUL$QrtC|\\(BwRfk\\yVZvs|', '26761cf7ed795ba8' ),
- array( '\'h\\kGSvMzLy~~ltBiQJ-J}s6Znl6ea4lJqYrFPAA};@})5@s', '7e915de5eb615078' ),
- array( 'fk"2juHFd6\\Jxq8Ddr7+CYLBul@ #atjMv|8lF^Q]<|V/6zs', '7313e5cd61f71972' ),
- array( ')3~MmKoc91c<rX\'AO%Z<K9n)Vl`f#\\Z,oZY^\'JB@[&]O_ep/j', 'b8b744c7e5836f88' ),
- array( 'KL7e;A=)"$,^^9O9s.A>QazW@J7&<Gqgs*N0Kk:NoF.O_^iSl', '71567bade5dcc22e' ),
- array( '+r?lnv.:/4VW\'?L1m]]Yw,I>;x~ycSgnG\'\\6~jP/ \'f\'G395q', 'b52ab992b89a25eb' ),
- array( 'wni%9(@3(:v["e#*B:)-j8-r 5:4OO&G?oLXxll!(c]*Ja4l{', '05178f3f6d1bd723' ),
- array( '>zgV)ZW?tknEq6dbb>[P+]Xo<c:}x(z7$bn-=FL33;Y&R>h6]', '2d02887219c5f7ba' ),
- array( 'Efi$@Y@$s?||:4!}$/<J[O]w)cKHMa&rIpwiJ8n?Xk<s!>q%M.', '7402cada54c164fc' ),
- array( 'P*^."grN1A085Z)-DSF3s~ 0r!Nd\'{sW&Rf);ZWL{hd2Cn?hBf', '7d506df1306b7bd3' ),
- array( '|6e|GY~v?\'s3^zeE%"!\\N|F40j#OSE7Q\\|N%VN{vUo*5jpZor\\', '2f6a27e5596405bc' ),
- array( 'MBYtVj_Y:4 Qe]O5b\'d_};O)P;y,,mhZ0COf.0AIEB{, KBcS\'', '584088c026129ecb' ),
- array( 'CRCr[s/V ;EivU-F=;W_e|"a*".LeaT*5w|pk-HlImW@Ddga!?', '52d26109c3976242' ),
- array( 'Bf=DIGGWt.:I8OA6@.ChzmWR.{8v^:7!!TEJ|m#q{=;5l]K.kow', '0664b26c38a5d953' ),
- array( 'g]O;lKSc*mz+oPQ;N@>A<[]RI;}W\'mOnL *9K^}VLxb=J4XyTw;', '614bf3c3f15ec6d4' ),
- array( 'qTxD}4CV;2\'+^\'5xStv*Apl_<"96W1QIeKnd`3;|EC(%J>~~3u)', '75c7984cbfee5c09' ),
- array( 'Ugv5$xN;P`mzF9j,y}HvDk I7>H6Q??((6=-0lH`M7\\tPG!KFIC', '08249b54b4e80e4a' ),
- array( 'j6C5Mb^d5~%=\'<[5LH].vtkkF3mrZ86FNZ[|=;bR:gpB$LWQu6`', 'd86b2b1dc38a51fe' ),
- array( 'l,LYR_GF;_\\a/8=-VYo*sXz7\\Hn/>%o+1<ed|-+8mhy}!8+Wq{ae', 'de82683d6c863f8e' ),
- array( 'T]}2&lADr2P$N6iKDud3^^1`w=9i:{PoYN"`;D%/VV4&m}R3s7FS', '1585883d76b8ad21' ),
- array( 'vX4nvNX1J)"%X$etIk$!C8\'27YE+pl_hFtW=C0On:QtrV[g Hk!k', '0fcab3a55bc257eb' ),
- array( '%)}<bDHT1(=W|uuA&F1@x&4Oa{P*hRvm[u*?;RtM[3&Y){z0C-Q<', 'f8b622573f260ed6' ),
- array( '3ekub=!Kox9LnDl+waXSu^.~[*/~7`<JG(A*EBU6;ob+4O6-2oa(', '9cfe1752ba2120c5' ),
- array( 'Oo(+y8+1yG\\AP}KvA"-\\qph\'A 5Tov]@geKa}Wsw Q:PPfHqhVO[H', 'bbfbf47f5e41f626' ),
- array( '9ci9x?*o|JXbv:aN/ZO`u!2\\I$E T"Hme3(^R2OO\\(3TCu$SQS4GT', '0fd77de0e48a299e' ),
- array( 'G$}LJ~!LHo2[wq/*A^gJr<niAB;tWbJ~fIK1HL]p<pM5b\\?%<(P0E', 'ff59a87c858ded0c' ),
- array( '?yfa5[9w&8_Pdqx2OjOA8d$u%*2-ZBSy<:[RvuK}/+Ns|G&M3VnL;', 'c15664e583440709' ),
- array( 'sB@}TNXw"R5=/g4%424?`)=)/j<fZh"N,CLar&YtXo3gXGmlY#,:,', 'ed2cece5fae7e40a' ),
- array( 'JD;6`"pJ%@VIm9<sr2McE6<l$)G\'6b3`\'OvgRh3X)j"v$>kwP9[vOw', 'af6317fd2ec74937' ),
- array( 'cS!+[7nnxu?o^qXqJb\\LZakFY=_54/.xc/%?Gs/@iN1H@j;kNw9)Z%', '176ecfc36ff0fb5e' ),
- array( 'O4B0JW@XP$hUC1IRR4"d\\BOw/~pH(KMX`ph,H)ex-OOQ`x%4.\'xkJI', '2e7bda1a61ef9b56' ),
- array( 'cYHU#Q"P*bBroj|Uc+%4]f-c{<jt(6?lphBs:DEE(g9wR6N7ASK ;Y', '3d2b93b2479f85fc' ),
- array( 'c7vO-~eMkW7.LRSqw\\Z1U.H$EjXqjtLN,C}:Bcg/<~>hQq[JO6[%D$', '62a5e1665612c6c0' ),
- array( '*jnc]YX*)eN\' qjh!(g?p:2LdacAf)Fqt6URp.]yt-!t~l] tF@faR4', '547b12c39bb0fdf3' ),
- array( 'G4wh{"0mvFCI7R(1G53=4 {5tBV\\%)pL>h6:jF)blM,% 57HJJe_Jau', 'c22639e2811d6816' ),
- array( '@%L|*VnWtWm0C49\'"f4\'fI>0tiuU4XKU]xShOB@Ez.U?CnFFUZM=%lM', '37b9a926337766d3' ),
- array( 'yVDOk|{BZtuDE9dj4s@S80z^fV-%[zRUQw&>t"`PwWt=pZ)%NJYgZUF', 'cc6ba46fb041513c' ),
- array( 'B,TGgOz>"rD@gG"9?Y/]JigP92+!m`H0m|XUMStOF9o/`qH!KX^vBFG', 'a4c997dd620f2ff9' ),
- array( '\\YS^H4(Y"&2XSeM#,gs<HeeJ2>**aQR>+&|S;%-=,?v_&Db2-VNV=4!P', 'a07bd8ec425f5a4f' ),
- array( 'S+[5\\.Sh4Q=PWKnckeCq+\'%8^Tn|hpM={)RY8\'CMX`}1,luxR:j^Aov!', '84b7e4acb0c0a79a' ),
- array( 'Df}.WLKTV~/o&R=^3;p@)f9[!%;Cu2E:yCIRpu\'Ht68ziVZ|qL>z3WW5', 'e0f646c8b28fd049' ),
- array( ']rYS&~n!C8S5/[]%rv!\\M[Z@)x<<QtR/h,bo+QpNjEcz!B s:!Qg],)f', '05032e744464292c' ),
- array( '&E$W:Vf$cJsn{d>g+#b,Fb!`dSIB_R*ex/=4e%8JO,9LqX4|\\v*#Z+d?', 'd416e24b2f0208f8' ),
- array( '^.b?`m&Z|DncI(.y4HG\'"[%^S/b/;GOzU3:7!Ar~eac0iq*~;Q\'=.,|b;', '3927892869e71809' ),
- array( '_qW(AR^UmvV/iVtL:&7-06Hb>fqJdTfEG>Miq,?_#vomMe:hkQu|h?_\'\'', '6642fa162be3f787' ),
- array( 'RQk\'91OW^9IkX*oOz]}`xfLJ]I3}*;%]mpd\'"5^aN)M(4>X/{Vpu>=@|g', 'bc2d4f3aa4d38015' ),
- array( 'Tzro P]q6esKDVzN%#cC[r@3c6R"WOj,K]|K/[=EA2qfil5npy3LlT_Qj', 'f8e6d9128469532b' ),
- array( '2SCb?P.|MZ-*xSK,E3u3He$BxQ0N1b9D6]\'U.6S[p`fi52uZElnnRs2LE', '7277ce5e05c03037' ),
- array( 'CzW&5{=r$s!;H],*Dv?Wmz}Zim-] Z$DU[KjXh]\\\\_w&>%0b{O;iJ9E5\'S', 'f52c0085314b0fd8' ),
- array( 'r(.wMcSxN,a-i?maF,gVnd&+NQDtfLHZUVR#:&|i3_v| e_FqG|`,$k[U1', '69e03fdc5e6ef8b3' ),
- array( 'P=^xx4PK8jR6TeuLcu2C<%j9ew>RStd%2D}+YNWr:+)oq~=UtPx1UdK<\\i', 'ad82f3fd37f369cc' ),
- array( 'o0^U5qy4|ScUF~`OnRN-)D]"V3g"PDl@ULuk>o <DdrjcS;S\'j`1/>3eR{', 'a0a8ea76841101cb' ),
- array( 'h#@VDv#;bB,c_PHR<-\'W`/BA@R`T83P"7pX\\h\\wK~$/_TX2qe:IGIlhi?I', 'cc3c875a245445bb' ),
- array( '>X]n[t`4QIqJuqN%Q$^cuD}@kH.U2M Q\']@bS"w&KiPA[~G.$&rzKq<8:Jn', '36b37774404085a2' ),
- array( 'Mxn~ M?c!B[\'mFX0#XX1\\_%W,vtD2?4_8#^9P}|RAYZ0!3@$ky6HY<!f3u,', '6953f8802999c26d' ),
- array( 'E6@%NDdhtceH%@#5A6VF"P]K+yMq.D}TZ?Z*c?rX#Y"(z%==;sc>EBjP=9C', 'a93c088a44fbfc35' ),
- array( 'L]B!9a\\DE{8~ r!)m\'G+C;oaa3M3QfV}Ex _[\\%"Y>!Z1#c *+,MG|0)0^<', '4c23bc673f998d50' ),
- array( 'bEs`kmaLI?RKxpMT"P8#[D/)k,:u=x2!?&a,tDX>c+j]|82~iK"Eo2O\\?iR', '68fc83d0d7fbfe26' ),
- array( '\\ce]$k@0aei Iuk\'r$:qnet4V(d3GOf%3Lb79$Gzi2{4(g<zkWm[>cotkU)3', '1154a4047a591047' ),
- array( '%o88={PV!xQk+M 35=/"t}]3aN(M$2a)"zB?vrvxkHdwvd,-#<0w:n+{=4JB', '4241c775b22008a8' ),
- array( 'F-LI(oi b`xO*]H"CT0Fp@>,/J)M^Sp&a>Oi.:iq{bB\'@j)d@9+2ZJ>itG8T', 'd8a203d84a6e0ad0' ),
- array( '{)[]G+GVF2HBtjI6USzvm\')HRG2HnK|kTXI|dqS,${Nygx0>M,5;4>cffv/V', '71228d8490cbb004' ),
- array( 'B-BwfkuK]IXbF\'\\/!mMNybi/"NuhE&@g3b`yOVF.! pH(MW);&X6iCEkq<U7', 'f772a9177eddfcf8' ),
+ array( '9', 'af63b44c8601a894' ),
+ array( 'w', 'af63ea4c86020456' ),
+ array( 'v', 'af63eb4c86020609' ),
+ array( 'Q', 'af640c4c86023e1c' ),
+ array( 'd', 'af63d94c8601e773' ),
+ array( '"e', '07cc2f07b4942580' ),
+ array( 'pl', '08d53c07b5755019' ),
+ array( '@L', '090c3c07b5a49289' ),
+ array( '"N', '07cc5a07b4946e91' ),
+ array( '&O', '07bf3907b489ac22' ),
+ array( 'KE:', '50d8ad19d18c8505' ),
+ array( '",u', 'd511f317d88f429a' ),
+ array( 'RX7', 'a0549119ff001600' ),
+ array( '/<i', 'eea15a17e6ea5bbd' ),
+ array( 'Otx', '2ffdc919bf72be52' ),
+ array( 'w/qn', '9c6e50f771dcafd0' ),
+ array( 'aVqG', '4f1788838c1bcf9e' ),
+ array( 'G^hs', '33551d7dbbea0209' ),
+ array( 'a7z1', '4389ab82f4d6a7d0' ),
+ array( 'c@Lf', 'c14b5591800f1338' ),
+ array( 'MB:&Y', 'beb09d1ee59646d5' ),
+ array( 'ICDy9', '4f05ddd19c2c2285' ),
+ array( '>qH0a', '370b9a8e5a2329eb' ),
+ array( '*fSR/', 'f78a85007841cb19' ),
+ array( '3;$tS', '94b935103cc08938' ),
+ array( ' \'7AS}', 'd81e3aef0fde6ad8' ),
+ array( 'ou9vPc', '549f05284ed347f7' ),
+ array( ':u]S4O', '31b0206c95a52e7d' ),
+ array( '{D2\',e', '3a68240ea9539e62' ),
+ array( 'Y;yt@n', 'afdae733c98065a2' ),
+ array( 'IAu`bI_', 'c311eb3e8f9f51c4' ),
+ array( 'R@xIq]d', '3fa1984555c55e46' ),
+ array( 'g;8{k5@', '9e9c5e80cdc3d58e' ),
+ array( '}<Ldvh^', 'e5be53f31a393f34' ),
+ array( 'k*N6KDw', '558fdadc82fbb9d4' ),
+ array( '/nWb0Q-"', '84fcc8959c773b75' ),
+ array( '/qiK+e7@', 'd177962e1def962a' ),
+ array( '\'5]SzT=Z', 'befb197ea3aac960' ),
+ array( 'AH)WsNO$', '63dcf1c6c88d5426' ),
+ array( '=(fNZsPj', '806bfb067d62da41' ),
+ array( 'f:6q!M3(c', '5125f3e296d40b42' ),
+ array( 'p\\^Fz:gCC', 'b9ffcd384d90ba98' ),
+ array( '@7qp<0x#^', '1da17e378a5f0686' ),
+ array( 'Tw/?^JUQL', '85f6d1938d45b818' ),
+ array( '#dTfU2F|-', 'b66e4e092e385394' ),
+ array( '`dP%&hvv%(', '84523fb38ca2975d' ),
+ array( 'p)fE!vd`B;', '9c94c2a34d9f95c3' ),
+ array( '2n>vD&MVMJ', '1f4fd77c72b6004b' ),
+ array( 'd//546~,-$', '159ef268adc718d9' ),
+ array( '4~.{E/s*p6', '31a60e2db942bc67' ),
+ array( 'F#&dyJkG!:q', '33b8c68aed55c285' ),
+ array( 'eI"{^9zjG ', 'b42c013a2028584a' ),
+ array( 'F/|k>pv/(=3', '671c9537b41d76fe' ),
+ array( '.#-XoUZ*HAT', '84e0630a952577f4' ),
+ array( 'K>4d:~-: SI', '57deb72cc24c6bad' ),
+ array( '|@hn8xvV,%Y:', '157fda2502fe1297' ),
+ array( '^Jp:T9\\*ez>K', 'f784c17d1a2d1bd2' ),
+ array( '5>XP>-z<Mc,f', '6084bce050682a8b' ),
+ array( ']#=j)w&hBv#w', '7a2da4d0b1c01e1e' ),
+ array( '1_"vZ@Bp_{A}', 'e1e8fb095e4709fd' ),
+ array( ')<;W!G>^K\\JTT', 'dd737d6771e9cd69' ),
+ array( 'P>vGAoX"qP]3s', '0375e65060074988' ),
+ array( 'Nrooqy-.Q.Upm', '135d77993c647f43' ),
+ array( '"M8W"huy18ij:', 'aedeb2565e1c29f7' ),
+ array( '\\;wo0Gb!8UzEc', '59ae633a0b17a945' ),
+ array( 'LS:=B<kZtmDjhU', '2b2e674d9a46a36c' ),
+ array( '$S@>0\\7 l^cmw:', 'f21c8cb206540a2e' ),
+ array( 'h=}6q8T4U@nJ/3', 'b258eae8a4671c77' ),
+ array( '6wi:L*Y\\gp]UPB', 'bff5f2c9ed84bce5' ),
+ array( 'CH\\-fZDXsxlJ9\\', '298d4e05d5a47c45' ),
+ array( 'uIp,BZFne!KMr*#', '8641dfc04c9fb552' ),
+ array( 'CLGl)USdy-Yry$-', '3ab1497c481f22ab' ),
+ array( 'WyVH\'y#NhhO57B?', '8dea1d032c597f60' ),
+ array( ';fkbSt8(Z264&09', '4b875649e7cfa1a9' ),
+ array( '4g3k1:e4iN}9c6[', 'd33acc8fe01b77fd' ),
+ array( '$QBo4veM @`6UgGn', 'c4b17749dca1aa6a' ),
+ array( '{0#gA>MV(|TAaj}e', '067ae9cfff2cd6ea' ),
+ array( '=AVR8< 9]aO3Iw#E', '02bad50d48a8e564' ),
+ array( '(&-JD[!LYVm<Bl#_', 'ec868a84ae92c032' ),
+ array( '.Y2Gv3`Tt1h>)kd2', '9f7776edcdaf2937' ),
+ array( 'qq]6N_c)7REY?H:M"', '1899eee357e747b4' ),
+ array( 'Mtx`VNVg7uq#Z%uMc', '8eb7e5a4bb9fb739' ),
+ array( '-{Cp%ZCK5ctO2v}\'p', '58ebf399369565ce' ),
+ array( '^^@6GW,9[f?Q4#^1G', '76ab1ea61d68a738' ),
+ array( 'P7#tb9XWhjOgrAGQa', '29294a2d4b758119' ),
+ array( ']x9i3uPSGeW\'v~W.#L', '508d3356f8ec886b' ),
+ array( 'p<&I&pxmd:57{r06\\D', '4660b5543de2afdc' ),
+ array( ',.wTsO[jO4xSajog4u', '6d85fca5fba07683' ),
+ array( 'Y.c?HyVElg\\J,hY%>N', '01e82905c1f66c8f' ),
+ array( 'Uy:&/4Yq~IZ4@5B%Tk', 'a05cc808b297050e' ),
+ array( '~+1lrm8 Wr&uA[p[a!o', '22783c7a8fbe4826' ),
+ array( '<roeM$\'bG,73+CDx731', 'e00ac9dc3812b301' ),
+ array( '7j$>aFyS#\\TsxGc_uhf', 'a8cfc6804bc24e1d' ),
+ array( 'X0rpD~5iwL|*dh/#KU|', '17b538fc3a531c98' ),
+ array( '~YZSMS{14qzzK,n=PmR', '47a7dd2be021ae55' ),
+ array( ':f 8pd!!hMWeL1A!^u|p', '4c9d34c81b647804' ),
+ array( '*ol&<xtZIb-dJ.|<r~=[', '7d8483384e8a46c8' ),
+ array( 'LuBx\'dzfZwXehEk%>`_h', '25484f299d38dc95' ),
+ array( 'DmMn{K+oKILw?oqGTl/0', '8ecc9d0f58ead225' ),
+ array( 'eguN-bTLC55h$cX!0cq[', 'b3e4439d186da97b' ),
+ array( '.?TN/Fvd4&uznlJ{O~Is5', '983efebee9945885' ),
+ array( '_\\9C5;Sy-0)LdW[,NAAU7', 'c01a00203768a32c' ),
+ array( '<D%fATfjH{K&6n;QC6^T?', 'ef488311549372ed' ),
+ array( '+9wgEG*g}B$BGjd{QPEN{', '2c57de61c289de00' ),
+ array( 'Kdkg6/~uc>"}7jD^t,\\80', 'f83a6970b348b383' ),
+ array( ' _{e\\N6#|2Nb~7y/6orUrq', '26006911a7c5d137' ),
+ array( 'l]6LRC)jS*KPo)~&,{9Z^9', 'd848d0547a41bac1' ),
+ array( 'rXH)I;^<.KyExMh"9=-em|', 'ad7ca21d760bab1f' ),
+ array( 'nl$zh>UHWH" RL<1hJ]coV', '87be1c6aab3568a9' ),
+ array( '2XYKuf1cd Qhz;\'Qc^zf^M', 'fcb5e375b267b232' ),
+ array( '3z_|F>`6usoP?e8QJ|R{fM7', 'd6cd721ef468a686' ),
+ array( 'm {Mzc-Iv(*tOIVe@JVpj=*', '5ea4e77a701e1fd9' ),
+ array( '<g\'ndm=|\\=y*9]7cU@nJp9"', '256fbcae5dc6e749' ),
+ array( 'VYL.K7KUT4]DyLav*~p49OL', '55e66fa9c0b7f691' ),
+ array( '}%mlP^&R6` D,8pbl%A1~ms', '1d260b7fec06fa81' ),
+ array( 'vwsg--8Z,=Ixn) A?`BdlZVP', '1ac9ffbeaf2ceff1' ),
+ array( 'H[qZ[_NRXC;fQSA]qjV`sW#4', 'fcd1a44f1f9644d7' ),
+ array( '8Ey&!PVJ-H%i)T=bwXII-j( ', '20541ecba873cbbb' ),
+ array( 'V^`K6d`O+ZU,,,W:U\\$_2BB+', '817f942d64cdf041' ),
+ array( 'zlU)W])/=j[SP<$[wYh%f@@=', '8a852332f2c99373' ),
+ array( '}E|0g@<b-qleOuumaQA2nFnf ', 'f817c2a8dc3cac28' ),
+ array( 'Wlgw-%uR#\':DC}R5j8ea/SDau', 'be35effdcebfb5bc' ),
+ array( 'VP<E8=}%%u2+le/s S8}&Ni?4', '31a4b812c4ec4d45' ),
+ array( 'LOhp1_Ga|my;k~Ab2LOw\\Cx1[', '21bc5ceca29e51b8' ),
+ array( 'w7*aW?/() 9hHzf6u"#uCe(p5', 'de09593ecddfbfad' ),
+ array( '!MYz^5rv@UO`dWidpS-l:Db=GY', 'ba497ffae361581a' ),
+ array( 'a-bRCc!|_`3RWS)(5n`~TRSa?n', '7d6da8683f44e043' ),
+ array( '\'#,O]m\\@A!%B}d$18\\eAdz0Ezd', '964a554b2ea62312' ),
+ array( 'xOG9>O<K~y:\\;\\]@ [%$l=`S_E', 'a6d30ae05805da81' ),
+ array( 'OokJUez}~9M;eL6!)Q]fq]Bwa0', '52a0a33924a1e495' ),
+ array( '5Bdth4eU_;;Z9:tgVZ4m[=@:%3w', '4e3d8a502aad23d1' ),
+ array( 'H+YYA|>7fR|<39XmSsb;K>P9ymY', 'a30084c8ebfe7959' ),
+ array( '5sl-<xgv:d5RLhOh{iBi=6MYak*', 'e4a386d2c4782f99' ),
+ array( '{fxU{lC**=q!XW7+$ Zm|E0gcG5', '19e6ce2e2493a78b' ),
+ array( '=*"H&iA\\f/!p:>b<v;S"?T].Q#?', '226c52cdff2324cb' ),
+ array( ':ffP%pSMw=oT$ Uu:sYVkt+m5_KC', '08df2d276c9a057a' ),
+ array( '2OcL7J}<<Qj4nZisZ?iu4DL 9WmO', 'f02866cab6af3d35' ),
+ array( '8:sJjWw"#u>@H)T7d>,@^v6r;crU', 'ef8377919e2a1bad' ),
+ array( '<a&T|y gRxiUo)v83LPwk\\9JTO>o', '99a9a1a21c2ee2ec' ),
+ array( '31FOsL%pG%Yz}CQnMH\'`tWY`5r+i', '887cd200603d7a11' ),
+ array( 'BJZV["&PN+Bv1{q0@C~mk\'Oa_*Bt|', 'faad097477f65bd7' ),
+ array( 'N_@x:wU=}&l*Ic<EVLfyLUfS&H30k', '26a5acae427f26a8' ),
+ array( '(.:hN4$FiAEp.P:ql`I:GCf|+:$TM', 'bfe197dd01c4279a' ),
+ array( '4@VB[@qoD8Ze^Ks/ff|G07oT}m`9q', '60dffddf1fd785eb' ),
+ array( '5g&V>I2_;#$T]j3*^CqF@:WX*-Vxm', '05994a3217bb26d8' ),
+ array( 'oj#WqZv;lWVp[,OF?Y&cLM%f%]q24j', '151f45373d53bd27' ),
+ array( '!%U$]H_UcL-;>iGm0gH7KtdP\\i.N|C', '0b91af28a642cac4' ),
+ array( '9}Io#(8b]|0k8NU`=fIe}t[bF8MUfJ', 'fd58c24dc342b56c' ),
+ array( 'y ICoML(0+%Av>pM .4Is2?OufhC<O', '199280a86e05b101' ),
+ array( 'n6O8Z?f\'Hw2N9*m*Wn9k9.~Y^t@G9]', '732c4bf03e824fe5' ),
+ array( 'v(tFAPf(W0 j^:uMDM<^:Vl90K/PrH/', 'ad49c5c4b29581d8' ),
+ array( 'jQ$1rTx{-*{xi7n7\\=T;X+(r;T"lHK{', '74f8023eb53a4c87' ),
+ array( '3|!EpV?lcIi]3!LK]j xC,"6HW85 d2', '45f93db9ecbd61e2' ),
+ array( '4a4YSjy@NC+,V,Y#jE#dh/f~W?8m?}!', '628239fa1e9fbf4c' ),
+ array( 'T_5/3 )TOL_\\$l7\'W\\+<E;$ErC^ac\\b', 'c4d6aab371c199b4' ),
+ array( '8=xGQyP&I}f&"S>*+z6GAQLfDoF\'S#jk', '97ef2b6a27cfe08b' ),
+ array( '@c3q]dx(b_/e3Mp?H\'gjX4Q}$w%X{pE<', '8a65a0d9c497dca7' ),
+ array( 'TY/3>(;"hJg{wY<A`$,:8^8=W>vS/<pd', '7d99f135b9dd392a' ),
+ array( 'u w4)46r^~nWX,x:0%TIdmg<,^o<z`"p', 'a3296f83b9d4178e' ),
+ array( 'az%k/<^m<NEtZ?0kDd5*R|F_[6|Ww~HZ', '6971ed23982e966c' ),
+ array( 'yNG)j&w\'U>|1]-|#r3-E0S&lj$Db#m>}<', 'b3fb4982abc0e4c0' ),
+ array( 'e(\'l!/C?-T|:Q -d.SuaZcM^)1bvOa36i', '031098cfb4e50d1f' ),
+ array( ';$jKG+X{(sN)"48U+z1oHoxYSo*5$@ ?D', 'd2ee11dc187ad41e' ),
+ array( 'kjlvDi 89*:MBpY="IfrB@G3J\\7k\\W1HB', 'fee80db84822febc' ),
+ array( '}@gh@ "K:Pm,*,.Tr"w4I+_\'CKcz]->\\N', '849ddd5ac8830991' ),
+ array( '&En&G;Aw*M#6\\W*_O?)[~0~Kty)#9eQ?+A', '58f765bdd716e1c2' ),
+ array( 'FS\\hLf6O}s\')SWH]3Hn3sc.|gGc:go[/C9', '1ef7be10e1e94525' ),
+ array( 'wo!/@ #H)W R54z$GnhVlP}QkfAGueamVc', 'fb192bd95f5f88b2' ),
+ array( '|vc!?mX?@mT<r|+\\Sx.RJy9lB/R$})h{ L', '3f2604691e2ced49' ),
+ array( '|?;U_[D4x81%te}#8I}Q6@ahE_q.[r[Y3v', 'cb8807aabe087372' ),
+ array( '/rST(Ll:Qb Pf8yej0&LyL-lZi_6Cs.Sga(', '4c6bc9be092660cd' ),
+ array( 'o/u+aY,2@D-&0>-\\8Yj&5TeLxZZLB=T3MK>', '9207d0b883378aaa' ),
+ array( '/%JBFoOM n[]\'5H-K}swvORCqpx%>EDNKnp', '34c18ad3e2030b27' ),
+ array( 'q_A@_0{>82gF]e:V]j*!\\zza:@&hkuZ^U{ ', 'ff47e63839babc22' ),
+ array( '6,|UD/=jm$&DapOcNJ^0e 7Nl.*Ld&Lz3IP', '8fc04f6e48534104' ),
+ array( 'WYnCGrJlT<<8jgw{Mx4|eB\'2\'._#A)SybC>+', '444cf38629f9f5e6' ),
+ array( '6hxk&5$p}|lKu!I\\DQoK_ON!X#{<G:H]#AI*', '93be8d30fbf2a711' ),
+ array( 'WNzUKh"BjL~/}o[]?+_x.[6Vu^4y ^$X- .Y', '0457576f79c1af9f' ),
+ array( 'h1{T]{c[k?:+Ky%ZV;1MzEHz$MT1Mbk7sgkR', '60d5a7492fab7ad1' ),
+ array( 'dP.PpH\\<Cbvz}(HxNqtS?Iem-Q%":qT~CcP4', '0005d93c99685bc1' ),
+ array( '-.QPpIKoRth!f^U\');t7ly9\'ln\'0RWE_ew1VA', 'e13bf2cdf312dd7b' ),
+ array( ']FsR0u:oKAxg61U1J\\~9d0l<UL#N]Zo;"dn3[', '53d2c531034cdde3' ),
+ array( '*#\'K|ob.EsY#rsg$`%Y.((lcx(e]wx9"|ANy1', 'e16aa67d2eb4115b' ),
+ array( '1)V%bYxVB}8GWFP`34Z<z95tS7qtek\'wt^}X9', '5511e58643ea102a' ),
+ array( 'w/[uH$NnU0#jj?e$TZWlLMS9UK/4IgNAw+7@0', 'c03ee6776b09be84' ),
+ array( 'e0eu3PaS7f)r?v?lJYCvhXAP\'bI3ziCaz)X.Z:', '6e63e154ba982b2f' ),
+ array( 'bq!kd@c%.._R&H+Gy3+CG&.jh)tA8P[zC]g)~K', 'd191830ad78ef4b4' ),
+ array( '..Zn``7l(2 3VG:e3#o)D(Y!$|_k&^85lr$MT<', '7aa3d56eb663566f' ),
+ array( ':]O;p&c,lv0\\ UdZVhW6U^umtbax066KsefelK', 'ea574dd4514d7c68' ),
+ array( 'qYB#6CX{~0dVF;6=)+ j%1"<\\u"D[ooNI3Q`W+', '58f171ded41e0193' ),
+ array( '\\V;B.b^D gP SV1VrnLu4)f$W18*qo5OGPrU3Qz', '11baf93d39928abd' ),
+ array( '4:L4n#FEv5rmJ{TOTeg^XXt( EzVYLRmg #V$I{', '0ac0c936f7521a28' ),
+ array( 'z_nh*k>Y@$B~\\zte{:`St.\'cu\'fL+1I\'q9p{%/V', '1a0c38f41c1826e8' ),
+ array( 'E4yEpu:WqU8FJGM/=Uvja(4hyMYvSiNx}H>o?YH', '75024234e0476c05' ),
+ array( '2/`XZ(\'jF\\a1?iF(dtb\\HM+BLTa<t;d\'KF_\'Ogq', 'bdcaffa418ba3eda' ),
+ array( 'vES(d>Om#EP`n}l1JBsg70M>[t~bDfU;-)DqGt_K', 'bda836f33c0092dc' ),
+ array( ':1-)0y;Z</CS?pq{eq^+Y4Gf>lYfa:2|K?&\\:B7V', '16e6a228513a03c4' ),
+ array( 'QZ+qL}m3oM?Ibf1!Tjh6&z4R;;/V]F-0"8#O6pc\'', 'd272ca04df7d0554' ),
+ array( '?#P"jb$?MlVThj\'%&6[d]it`#w19itA)wr,bU1##', 'c1b2b80d012bdf50' ),
+ array( '}ZXgE_lLvI1T3\'67 GQi<rs5e!x;2|?1Wwx}WfJN', 'bdd12a4f05766cfe' ),
+ array( '1\\$Ed;\\dc.O !D6fE/#X,Bic:carJ-B\\jG"Ob^4Fl', '9667031dfb5a16c7' ),
+ array( 'dGm)^UOmX(zzq_6VB)"PK^;s`jV? },dFzn%Q>s*G', '166ff835024396df' ),
+ array( 'n&:O=pqGrBsQ^g2J>RJ=_0c[ i->]8eL?!|\\qo$e3', 'bd73d9e41ae5c6d8' ),
+ array( 'w7q_J<~|g=]w!9wjF7I^}v}~s[pc_VvXnh9:&87mV', '81bed0679537a583' ),
+ array( 'ueW/^CUul5tc4sXoe<P=4*,}CF$\\^q3TXjd8/;.|P', '823ceb765e67c7a8' ),
+ array( '#aew:U]W\'{k1(iTOm1/`Dd:0JR@ea>6e {]:R<qZ8^', '3d7194b6e03cc23b' ),
+ array( 'kAHAq7S"wxf3*1eJvGh.-h+j$^(v9@U&b~GT7zV0s>', '01e47424ff38f337' ),
+ array( 'C}P)IHP3V]|bI!BQx[rOaUO*+f&bvz!:yQDCzuVRTT', '55e116dfbdeaffb3' ),
+ array( '5}VWPO4D vzO!&7(h.#jI|=nA8dxj9M 8$XhTm.Td)', '5ccd76496410ea5e' ),
+ array( '%f0<nxKrcup!d2:J,%cZ&{^^e4Lsi2}nx.,h\'X[kOM', '99b5ca1d7ad80276' ),
+ array( 'm5`(_l.DG4@\'s\';A{%SytM("60[r|+@jA!s"n"F77g>', '42c09c31678d6f41' ),
+ array( '+nZLj`!dUNmXe}4Yz@zfb|[dk^+#urB!a|NM^P25 !m', '7c2bc1c66d9f0223' ),
+ array( 'e~#?zD:a\'8=l${w(qkKsNIC{(s/=t0,Z0/z+T6l\\N+I', '8b024f00082671f5' ),
+ array( 'S\'B\\y/(n]Q3ZY(jv|{$W,3S8hi&E91ol92I3BR# $6[', 'f90f149aea3b4fff' ),
+ array( ']?FU<BZtOmHgW3m}M m:9!dMC7QD<h y(GPDj+:;yc#', '216ea9a72de9aadc' ),
+ array( 'RwqPEr>`,@EZc],)yt*t|QFB<R\\WMA[ 9NQ^Ao?N1e)u', '9a53a5fdb4a3fea9' ),
+ array( 'C5~>*)4([ZJw-(P[I-[b\\-A}}aM/GV&kl%+w/? jyJc(', '7a9e26e4aeb98fc9' ),
+ array( 'R5c|B@_~N"}McK\\,#cxpi%hxDhd?3HHf^,c!MD!{F I+', '4f0136432df156d5' ),
+ array( 'L\'8Oj1@U6)N[r4z\'\\Cm;PR=}v?z>?EIkLa;8s\\m+f=fZ', 'c2587023e1d5b660' ),
+ array( 'Qaa/&PKV#iTz)P9Huc4CFP\\:-KEth,O;n1JtavKe`!ai', '50683e95eabc367d' ),
+ array( 'R{2H_Fl\'vIA%tgy^tJyd\\EY><&%}(fgZby#CApJ8:l>0U', 'f16422882c0082cc' ),
+ array( '9nJci0@/i_LoeJxL2S0-WTNH gbl&rC?bn$L~E[h%)YkS', 'b8c4873ffdaf0fac' ),
+ array( 'R8f\'Is^}C\'}+jk2^/QA}Vm|{If"SAm\'t\'m{PbZO&bN2M:', '948738b38e532172' ),
+ array( 'D,JvNIM<GJf.L:P:AEB0Ars|Cy_q-.-Q;XHi"v&IAmXn(', 'afd0b1e73ddced08' ),
+ array( ')*JNL[p@OmcJNVW]d*y=Sc?JjhlYB\\aKf-z4hkT9Z9d*p', '1dfd3ac789532668' ),
+ array( '=gUGarzF3F2|4k?qNjX[fmERC_.\\D8Nb!$*cw&*+M=(b*G', 'c7ce7d6de622765c' ),
+ array( 'TX3.5y{[M?<[|`sKDtPNXHUcT#"\\e,%;e9I{4FWaes>cU2', 'f0fa521206e1c67b' ),
+ array( '0y(aIa*~F_#H<iUB%;\\N7punS[cq@:%Q4-3]o=]7|`_:J5', 'a38fb64baf6368b4' ),
+ array( ']PQ: h,uX_R=QrWWDkdWJUu(lsiM/5cme5)e~5\\Wu/uH#M', '885465855ee39187' ),
+ array( ' G:e d;vm)kWWzm;hSPr:P)v)~\'~G*LHQf.RLJI:S5r,1`', 'de1bd4eebc876571' ),
+ array( 'Gz5xmPIvGRvNQ>Y~f+fu^4@)Ot>B!P$HK:B:jk13?(bqG<p', '5fce9e2beab28428' ),
+ array( '/HX%\'lF0<;O_< ceL~(fitx}4"`&I|wYFP_M=&^YA.:^/}E', 'babb5873a7b954a2' ),
+ array( '[}MCgC<eW>G^hEVCk\'#:E)y K):+89Pt7~8 BTfzs.Y\\T0 ', 'a4dcad2a3d27a8c5' ),
+ array( '@8#[^-U_Y^ydw45lL5%LXZ3SNB.,v?,8X0t7>Jvw*q\\"\'rn', '5fce337a1b15535d' ),
+ array( 'S)t aO46}VD*Nd7g=H\\Uf\'M^2?;4F/$y8xzzH/1GfVR5;j}', 'd650a004f4a4a934' ),
+ array( 'X3Z.yb[Xt{t*C$.>=\'98PHJx0!KF<6DuI~%Dba|X^rb"wp@5', '26f61f52e18a413f' ),
+ array( 'xYNI#xB4ynZ7& .P 3tbtr;Te}V^nwshRC2V<Uj7DFOKF]{F', '955141b7150fa2c1' ),
+ array( 'pp)fcE;JCr)3j}{=A/s^d^v*%FUL$QrtC|\\(BwRfk\\yVZvs|', '26761cf7ed795ba8' ),
+ array( '\'h\\kGSvMzLy~~ltBiQJ-J}s6Znl6ea4lJqYrFPAA};@})5@s', '7e915de5eb615078' ),
+ array( 'fk"2juHFd6\\Jxq8Ddr7+CYLBul@ #atjMv|8lF^Q]<|V/6zs', '7313e5cd61f71972' ),
+ array( ')3~MmKoc91c<rX\'AO%Z<K9n)Vl`f#\\Z,oZY^\'JB@[&]O_ep/j', 'b8b744c7e5836f88' ),
+ array( 'KL7e;A=)"$,^^9O9s.A>QazW@J7&<Gqgs*N0Kk:NoF.O_^iSl', '71567bade5dcc22e' ),
+ array( '+r?lnv.:/4VW\'?L1m]]Yw,I>;x~ycSgnG\'\\6~jP/ \'f\'G395q', 'b52ab992b89a25eb' ),
+ array( 'wni%9(@3(:v["e#*B:)-j8-r 5:4OO&G?oLXxll!(c]*Ja4l{', '05178f3f6d1bd723' ),
+ array( '>zgV)ZW?tknEq6dbb>[P+]Xo<c:}x(z7$bn-=FL33;Y&R>h6]', '2d02887219c5f7ba' ),
+ array( 'Efi$@Y@$s?||:4!}$/<J[O]w)cKHMa&rIpwiJ8n?Xk<s!>q%M.', '7402cada54c164fc' ),
+ array( 'P*^."grN1A085Z)-DSF3s~ 0r!Nd\'{sW&Rf);ZWL{hd2Cn?hBf', '7d506df1306b7bd3' ),
+ array( '|6e|GY~v?\'s3^zeE%"!\\N|F40j#OSE7Q\\|N%VN{vUo*5jpZor\\', '2f6a27e5596405bc' ),
+ array( 'MBYtVj_Y:4 Qe]O5b\'d_};O)P;y,,mhZ0COf.0AIEB{, KBcS\'', '584088c026129ecb' ),
+ array( 'CRCr[s/V ;EivU-F=;W_e|"a*".LeaT*5w|pk-HlImW@Ddga!?', '52d26109c3976242' ),
+ array( 'Bf=DIGGWt.:I8OA6@.ChzmWR.{8v^:7!!TEJ|m#q{=;5l]K.kow', '0664b26c38a5d953' ),
+ array( 'g]O;lKSc*mz+oPQ;N@>A<[]RI;}W\'mOnL *9K^}VLxb=J4XyTw;', '614bf3c3f15ec6d4' ),
+ array( 'qTxD}4CV;2\'+^\'5xStv*Apl_<"96W1QIeKnd`3;|EC(%J>~~3u)', '75c7984cbfee5c09' ),
+ array( 'Ugv5$xN;P`mzF9j,y}HvDk I7>H6Q??((6=-0lH`M7\\tPG!KFIC', '08249b54b4e80e4a' ),
+ array( 'j6C5Mb^d5~%=\'<[5LH].vtkkF3mrZ86FNZ[|=;bR:gpB$LWQu6`', 'd86b2b1dc38a51fe' ),
+ array( 'l,LYR_GF;_\\a/8=-VYo*sXz7\\Hn/>%o+1<ed|-+8mhy}!8+Wq{ae', 'de82683d6c863f8e' ),
+ array( 'T]}2&lADr2P$N6iKDud3^^1`w=9i:{PoYN"`;D%/VV4&m}R3s7FS', '1585883d76b8ad21' ),
+ array( 'vX4nvNX1J)"%X$etIk$!C8\'27YE+pl_hFtW=C0On:QtrV[g Hk!k', '0fcab3a55bc257eb' ),
+ array( '%)}<bDHT1(=W|uuA&F1@x&4Oa{P*hRvm[u*?;RtM[3&Y){z0C-Q<', 'f8b622573f260ed6' ),
+ array( '3ekub=!Kox9LnDl+waXSu^.~[*/~7`<JG(A*EBU6;ob+4O6-2oa(', '9cfe1752ba2120c5' ),
+ array( 'Oo(+y8+1yG\\AP}KvA"-\\qph\'A 5Tov]@geKa}Wsw Q:PPfHqhVO[H', 'bbfbf47f5e41f626' ),
+ array( '9ci9x?*o|JXbv:aN/ZO`u!2\\I$E T"Hme3(^R2OO\\(3TCu$SQS4GT', '0fd77de0e48a299e' ),
+ array( 'G$}LJ~!LHo2[wq/*A^gJr<niAB;tWbJ~fIK1HL]p<pM5b\\?%<(P0E', 'ff59a87c858ded0c' ),
+ array( '?yfa5[9w&8_Pdqx2OjOA8d$u%*2-ZBSy<:[RvuK}/+Ns|G&M3VnL;', 'c15664e583440709' ),
+ array( 'sB@}TNXw"R5=/g4%424?`)=)/j<fZh"N,CLar&YtXo3gXGmlY#,:,', 'ed2cece5fae7e40a' ),
+ array( 'JD;6`"pJ%@VIm9<sr2McE6<l$)G\'6b3`\'OvgRh3X)j"v$>kwP9[vOw', 'af6317fd2ec74937' ),
+ array( 'cS!+[7nnxu?o^qXqJb\\LZakFY=_54/.xc/%?Gs/@iN1H@j;kNw9)Z%', '176ecfc36ff0fb5e' ),
+ array( 'O4B0JW@XP$hUC1IRR4"d\\BOw/~pH(KMX`ph,H)ex-OOQ`x%4.\'xkJI', '2e7bda1a61ef9b56' ),
+ array( 'cYHU#Q"P*bBroj|Uc+%4]f-c{<jt(6?lphBs:DEE(g9wR6N7ASK ;Y', '3d2b93b2479f85fc' ),
+ array( 'c7vO-~eMkW7.LRSqw\\Z1U.H$EjXqjtLN,C}:Bcg/<~>hQq[JO6[%D$', '62a5e1665612c6c0' ),
+ array( '*jnc]YX*)eN\' qjh!(g?p:2LdacAf)Fqt6URp.]yt-!t~l] tF@faR4', '547b12c39bb0fdf3' ),
+ array( 'G4wh{"0mvFCI7R(1G53=4 {5tBV\\%)pL>h6:jF)blM,% 57HJJe_Jau', 'c22639e2811d6816' ),
+ array( '@%L|*VnWtWm0C49\'"f4\'fI>0tiuU4XKU]xShOB@Ez.U?CnFFUZM=%lM', '37b9a926337766d3' ),
+ array( 'yVDOk|{BZtuDE9dj4s@S80z^fV-%[zRUQw&>t"`PwWt=pZ)%NJYgZUF', 'cc6ba46fb041513c' ),
+ array( 'B,TGgOz>"rD@gG"9?Y/]JigP92+!m`H0m|XUMStOF9o/`qH!KX^vBFG', 'a4c997dd620f2ff9' ),
+ array( '\\YS^H4(Y"&2XSeM#,gs<HeeJ2>**aQR>+&|S;%-=,?v_&Db2-VNV=4!P', 'a07bd8ec425f5a4f' ),
+ array( 'S+[5\\.Sh4Q=PWKnckeCq+\'%8^Tn|hpM={)RY8\'CMX`}1,luxR:j^Aov!', '84b7e4acb0c0a79a' ),
+ array( 'Df}.WLKTV~/o&R=^3;p@)f9[!%;Cu2E:yCIRpu\'Ht68ziVZ|qL>z3WW5', 'e0f646c8b28fd049' ),
+ array( ']rYS&~n!C8S5/[]%rv!\\M[Z@)x<<QtR/h,bo+QpNjEcz!B s:!Qg],)f', '05032e744464292c' ),
+ array( '&E$W:Vf$cJsn{d>g+#b,Fb!`dSIB_R*ex/=4e%8JO,9LqX4|\\v*#Z+d?', 'd416e24b2f0208f8' ),
+ array( '^.b?`m&Z|DncI(.y4HG\'"[%^S/b/;GOzU3:7!Ar~eac0iq*~;Q\'=.,|b;', '3927892869e71809' ),
+ array( '_qW(AR^UmvV/iVtL:&7-06Hb>fqJdTfEG>Miq,?_#vomMe:hkQu|h?_\'\'', '6642fa162be3f787' ),
+ array( 'RQk\'91OW^9IkX*oOz]}`xfLJ]I3}*;%]mpd\'"5^aN)M(4>X/{Vpu>=@|g', 'bc2d4f3aa4d38015' ),
+ array( 'Tzro P]q6esKDVzN%#cC[r@3c6R"WOj,K]|K/[=EA2qfil5npy3LlT_Qj', 'f8e6d9128469532b' ),
+ array( '2SCb?P.|MZ-*xSK,E3u3He$BxQ0N1b9D6]\'U.6S[p`fi52uZElnnRs2LE', '7277ce5e05c03037' ),
+ array( 'CzW&5{=r$s!;H],*Dv?Wmz}Zim-] Z$DU[KjXh]\\\\_w&>%0b{O;iJ9E5\'S', 'f52c0085314b0fd8' ),
+ array( 'r(.wMcSxN,a-i?maF,gVnd&+NQDtfLHZUVR#:&|i3_v| e_FqG|`,$k[U1', '69e03fdc5e6ef8b3' ),
+ array( 'P=^xx4PK8jR6TeuLcu2C<%j9ew>RStd%2D}+YNWr:+)oq~=UtPx1UdK<\\i', 'ad82f3fd37f369cc' ),
+ array( 'o0^U5qy4|ScUF~`OnRN-)D]"V3g"PDl@ULuk>o <DdrjcS;S\'j`1/>3eR{', 'a0a8ea76841101cb' ),
+ array( 'h#@VDv#;bB,c_PHR<-\'W`/BA@R`T83P"7pX\\h\\wK~$/_TX2qe:IGIlhi?I', 'cc3c875a245445bb' ),
+ array( '>X]n[t`4QIqJuqN%Q$^cuD}@kH.U2M Q\']@bS"w&KiPA[~G.$&rzKq<8:Jn', '36b37774404085a2' ),
+ array( 'Mxn~ M?c!B[\'mFX0#XX1\\_%W,vtD2?4_8#^9P}|RAYZ0!3@$ky6HY<!f3u,', '6953f8802999c26d' ),
+ array( 'E6@%NDdhtceH%@#5A6VF"P]K+yMq.D}TZ?Z*c?rX#Y"(z%==;sc>EBjP=9C', 'a93c088a44fbfc35' ),
+ array( 'L]B!9a\\DE{8~ r!)m\'G+C;oaa3M3QfV}Ex _[\\%"Y>!Z1#c *+,MG|0)0^<', '4c23bc673f998d50' ),
+ array( 'bEs`kmaLI?RKxpMT"P8#[D/)k,:u=x2!?&a,tDX>c+j]|82~iK"Eo2O\\?iR', '68fc83d0d7fbfe26' ),
+ array( '\\ce]$k@0aei Iuk\'r$:qnet4V(d3GOf%3Lb79$Gzi2{4(g<zkWm[>cotkU)3', '1154a4047a591047' ),
+ array( '%o88={PV!xQk+M 35=/"t}]3aN(M$2a)"zB?vrvxkHdwvd,-#<0w:n+{=4JB', '4241c775b22008a8' ),
+ array( 'F-LI(oi b`xO*]H"CT0Fp@>,/J)M^Sp&a>Oi.:iq{bB\'@j)d@9+2ZJ>itG8T', 'd8a203d84a6e0ad0' ),
+ array( '{)[]G+GVF2HBtjI6USzvm\')HRG2HnK|kTXI|dqS,${Nygx0>M,5;4>cffv/V', '71228d8490cbb004' ),
+ array( 'B-BwfkuK]IXbF\'\\/!mMNybi/"NuhE&@g3b`yOVF.! pH(MW);&X6iCEkq<U7', 'f772a9177eddfcf8' ),
);
$i = 0;
$pass = true;
foreach($tests as $test) {
- $result = hash('fnv1a64', $test[0]);
- if ($result != $test[1]) {
- echo "Iteration " . $i . " failed - expected '" . $test[1] . "', got '" . $result . "' for '" . $test[1] . "'\n";
- $pass = false;
- }
- $i++;
+ $result = hash('fnv1a64', $test[0]);
+ if ($result != $test[1]) {
+ echo "Iteration " . $i . " failed - expected '" . $test[1] . "', got '" . $result . "' for '" . $test[1] . "'\n";
+ $pass = false;
+ }
+ $i++;
}
if($pass) {
- echo "PASS";
+ echo "PASS";
}
?>
--EXPECT--
diff --git a/ext/hash/tests/hash-clone.phpt b/ext/hash/tests/hash-clone.phpt
index d5d4205354..0ef0df4449 100644
--- a/ext/hash/tests/hash-clone.phpt
+++ b/ext/hash/tests/hash-clone.phpt
@@ -6,24 +6,24 @@ Hash: hash_copy() via clone
$algos = hash_algos();
foreach ($algos as $algo) {
- var_dump($algo);
- $orig = hash_init($algo);
- hash_update($orig, "I can't remember anything");
- $copy = clone $orig;
- var_dump(hash_final($orig));
+ var_dump($algo);
+ $orig = hash_init($algo);
+ hash_update($orig, "I can't remember anything");
+ $copy = clone $orig;
+ var_dump(hash_final($orig));
- var_dump(hash_final($copy));
+ var_dump(hash_final($copy));
}
foreach ($algos as $algo) {
- var_dump($algo);
- $orig = hash_init($algo);
- hash_update($orig, "I can't remember anything");
- $copy = clone $orig;
- var_dump(hash_final($orig));
+ var_dump($algo);
+ $orig = hash_init($algo);
+ hash_update($orig, "I can't remember anything");
+ $copy = clone $orig;
+ var_dump(hash_final($orig));
- hash_update($copy, "Can’t tell if this is true or dream");
- var_dump(hash_final($copy));
+ hash_update($copy, "Can’t tell if this is true or dream");
+ var_dump(hash_final($copy));
}
echo "Done\n";
diff --git a/ext/hash/tests/hash_algos.phpt b/ext/hash/tests/hash_algos.phpt
index 87efdc9213..ebcbcf2793 100644
--- a/ext/hash/tests/hash_algos.phpt
+++ b/ext/hash/tests/hash_algos.phpt
@@ -13,7 +13,6 @@ echo "*** Testing hash_algos() : basic functionality ***\n";
var_dump(hash_algos());
?>
-===Done===
--EXPECTF--
*** Testing hash_algos() : basic functionality ***
array(53) {
@@ -124,4 +123,3 @@ array(53) {
[%d]=>
string(10) "haval256,5"
}
-===Done===
diff --git a/ext/hash/tests/hash_copy_001.phpt b/ext/hash/tests/hash_copy_001.phpt
index 8cd620e26d..27993b61b0 100644
--- a/ext/hash/tests/hash_copy_001.phpt
+++ b/ext/hash/tests/hash_copy_001.phpt
@@ -6,24 +6,24 @@ Hash: hash_copy() basic tests
$algos = hash_algos();
foreach ($algos as $algo) {
- var_dump($algo);
- $orig = hash_init($algo);
- hash_update($orig, "I can't remember anything");
- $copy = hash_copy($orig);
- var_dump(hash_final($orig));
+ var_dump($algo);
+ $orig = hash_init($algo);
+ hash_update($orig, "I can't remember anything");
+ $copy = hash_copy($orig);
+ var_dump(hash_final($orig));
- var_dump(hash_final($copy));
+ var_dump(hash_final($copy));
}
foreach ($algos as $algo) {
- var_dump($algo);
- $orig = hash_init($algo);
- hash_update($orig, "I can't remember anything");
- $copy = hash_copy($orig);
- var_dump(hash_final($orig));
+ var_dump($algo);
+ $orig = hash_init($algo);
+ hash_update($orig, "I can't remember anything");
+ $copy = hash_copy($orig);
+ var_dump(hash_final($orig));
- hash_update($copy, "Can’t tell if this is true or dream");
- var_dump(hash_final($copy));
+ hash_update($copy, "Can’t tell if this is true or dream");
+ var_dump(hash_final($copy));
}
echo "Done\n";
diff --git a/ext/hash/tests/hash_equals.phpt b/ext/hash/tests/hash_equals.phpt
index 0c8ab42f93..1716d3be66 100644
--- a/ext/hash/tests/hash_equals.phpt
+++ b/ext/hash/tests/hash_equals.phpt
@@ -2,21 +2,36 @@
Hash: hash_equals() test
--FILE--
<?php
-var_dump(hash_equals("same", "same"));
-var_dump(hash_equals("not1same", "not2same"));
-var_dump(hash_equals("short", "longer"));
-var_dump(hash_equals("longer", "short"));
-var_dump(hash_equals("", "notempty"));
-var_dump(hash_equals("notempty", ""));
-var_dump(hash_equals("", ""));
-var_dump(hash_equals(123, "NaN"));
-var_dump(hash_equals("NaN", 123));
-var_dump(hash_equals(123, 123));
-var_dump(hash_equals(null, ""));
-var_dump(hash_equals(null, 123));
-var_dump(hash_equals(null, null));
+
+function trycatch_dump(...$tests) {
+ foreach ($tests as $test) {
+ try {
+ var_dump($test());
+ }
+ catch (\Error $e) {
+ echo '[' . get_class($e) . '] ' . $e->getMessage() . "\n";
+ }
+ }
+}
+
+trycatch_dump(
+ fn() => hash_equals("same", "same"),
+ fn() => hash_equals("not1same", "not2same"),
+ fn() => hash_equals("short", "longer"),
+ fn() => hash_equals("longer", "short"),
+ fn() => hash_equals("", "notempty"),
+ fn() => hash_equals("notempty", ""),
+ fn() => hash_equals("", ""),
+ fn() => hash_equals(123, "NaN"),
+ fn() => hash_equals("NaN", 123),
+ fn() => hash_equals(123, 123),
+ fn() => hash_equals(null, ""),
+ fn() => hash_equals(null, 123),
+ fn() => hash_equals(null, null),
+);
+
?>
---EXPECTF--
+--EXPECT--
bool(true)
bool(false)
bool(false)
@@ -24,21 +39,9 @@ bool(false)
bool(false)
bool(false)
bool(true)
-
-Warning: hash_equals(): Expected known_string to be a string, int given in %s on line %d
-bool(false)
-
-Warning: hash_equals(): Expected user_string to be a string, int given in %s on line %d
-bool(false)
-
-Warning: hash_equals(): Expected known_string to be a string, int given in %s on line %d
-bool(false)
-
-Warning: hash_equals(): Expected known_string to be a string, null given in %s on line %d
-bool(false)
-
-Warning: hash_equals(): Expected known_string to be a string, null given in %s on line %d
-bool(false)
-
-Warning: hash_equals(): Expected known_string to be a string, null given in %s on line %d
-bool(false)
+[TypeError] Expected known_string to be a string, int given
+[TypeError] Expected user_string to be a string, int given
+[TypeError] Expected known_string to be a string, int given
+[TypeError] Expected known_string to be a string, null given
+[TypeError] Expected known_string to be a string, null given
+[TypeError] Expected known_string to be a string, null given
diff --git a/ext/hash/tests/hash_error.phpt b/ext/hash/tests/hash_error.phpt
index e760819e69..8a54831c1a 100644
--- a/ext/hash/tests/hash_error.phpt
+++ b/ext/hash/tests/hash_error.phpt
@@ -10,37 +10,14 @@ Hash: hash() function : error conditions
*/
echo "*** Testing hash() : error conditions ***\n";
-echo "\n-- Testing hash() function with less than expected no. of arguments --\n";
-var_dump(hash());
-var_dump(hash('adler32'));
-
-echo "\n-- Testing hash() function with more than expected no. of arguments --\n";
-$extra_arg= 10;
-var_dump(hash('adler32', '', false, $extra_arg));
-
echo "\n-- Testing hash() function with invalid hash algorithm --\n";
var_dump(hash('foo', ''));
?>
-===Done===
--EXPECTF--
*** Testing hash() : error conditions ***
--- Testing hash() function with less than expected no. of arguments --
-
-Warning: hash() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: hash() expects at least 2 parameters, 1 given in %s on line %d
-NULL
-
--- Testing hash() function with more than expected no. of arguments --
-
-Warning: hash() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-
-- Testing hash() function with invalid hash algorithm --
Warning: hash(): Unknown hashing algorithm: foo in %s on line %d
bool(false)
-===Done===
diff --git a/ext/hash/tests/hash_file_basic.phpt b/ext/hash/tests/hash_file_basic.phpt
index 283cc37527..77a110594e 100644
--- a/ext/hash/tests/hash_file_basic.phpt
+++ b/ext/hash/tests/hash_file_basic.phpt
@@ -24,7 +24,6 @@ var_dump( hash_file( 'sha512', $filename ) );
var_dump( base64_encode( hash_file( 'md5', $filename, true ) ) );
?>
-===DONE===
--CLEAN--
<?php
@@ -39,4 +38,3 @@ string(40) "c0854fb9fb03c41cce3802cb0d220529e6eef94e"
string(64) "68b1282b91de2c054c36629cb8dd447f12f096d3e3c587978dc2248444633483"
string(128) "0a8c150176c2ba391d7f1670ef4955cd99d3c3ec8cf06198cec30d436f2ac0c9b64229b5a54bdbd5563160503ce992a74be528761da9d0c48b7c74627302eb25"
string(24) "XG/73UDZVWtzoh5jw+DpBA=="
-===DONE===
diff --git a/ext/hash/tests/hash_file_basic1.phpt b/ext/hash/tests/hash_file_basic1.phpt
index 0c4197e393..df55cd4837 100644
--- a/ext/hash/tests/hash_file_basic1.phpt
+++ b/ext/hash/tests/hash_file_basic1.phpt
@@ -14,7 +14,7 @@ echo "*** Testing hash_file() : basic functionality ***\n";
$file = __DIR__ . "hash_file.txt";
/* Creating a temporary file file */
if (($fp = fopen( $file, "w+")) == FALSE) {
- echo "Cannot create file ($file)";
+ echo "Cannot create file ($file)";
exit;
}
@@ -56,7 +56,6 @@ echo "sha256(raw): " . bin2hex(hash_file('sha256', $file, TRUE)). "\n";
unlink($file);
?>
-===Done===
--EXPECT--
*** Testing hash_file() : basic functionality ***
adler32: ff87222e
@@ -80,4 +79,3 @@ whirlpool: 4248b149e000477269a4a5f1a84d97cfc3d0199b7aaf505913e6f010a6f83276029d1
adler32(raw): ff87222e
md5(raw): 704bf818448f5bbb94061332d2c889aa
sha256(raw): a0f5702fa5d3670b80033d668e8732b70550392abb53841355447f8bb0f72245
-===Done===
diff --git a/ext/hash/tests/hash_file_error.phpt b/ext/hash/tests/hash_file_error.phpt
index a634070de5..eecd2638da 100644
--- a/ext/hash/tests/hash_file_error.phpt
+++ b/ext/hash/tests/hash_file_error.phpt
@@ -24,15 +24,7 @@ var_dump( hash_file( 'foobar', $filename ) );
echo "\n-- Testing hash_file() function with a non-existent file --\n";
var_dump( hash_file( 'md5', 'nonexistent.txt' ) );
-echo "\n-- Testing hash_file() function with less than expected no. of arguments --\n";
-var_dump( hash_file( 'md5' ) );
-
-echo "\n-- Testing hash_file() function with more than expected no. of arguments --\n";
-$extra_arg = 10;
-var_dump( hash_file( 'md5', $filename, false, $extra_arg ) );
-
?>
-===DONE===
--CLEAN--
<?php
@@ -50,16 +42,5 @@ bool(false)
-- Testing hash_file() function with a non-existent file --
-Warning: hash_file(%s): failed to open stream: No such file or directory in %s on line %d
+Warning: hash_file(%s): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-
--- Testing hash_file() function with less than expected no. of arguments --
-
-Warning: hash_file() expects at least 2 parameters, 1 given in %s on line %d
-NULL
-
--- Testing hash_file() function with more than expected no. of arguments --
-
-Warning: hash_file() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-===DONE===
diff --git a/ext/hash/tests/hash_hkdf_edges.phpt b/ext/hash/tests/hash_hkdf_edges.phpt
index 82acdbab04..4a69c7c134 100644
--- a/ext/hash/tests/hash_hkdf_edges.phpt
+++ b/ext/hash/tests/hash_hkdf_edges.phpt
@@ -16,7 +16,13 @@ echo 'Length < digestSize: ', bin2hex(hash_hkdf('md5', $ikm, 7)), "\n";
echo 'Length % digestSize != 0: ', bin2hex(hash_hkdf('md5', $ikm, 17)), "\n";
echo 'Algo name case-sensitivity: ', (bin2hex(hash_hkdf('Md5', $ikm, 7)) === '98b16391063ece' ? 'true' : 'false'), "\n";
echo "Non-crypto algo name case-sensitivity:\n";
-var_dump(hash_hkdf('jOaAt', $ikm));
+
+try {
+ var_dump(hash_hkdf('jOaAt', $ikm));
+}
+catch (\Error $e) {
+ echo '[Error] ' . $e->getMessage() . "\n";
+}
?>
--EXPECTF--
@@ -25,6 +31,4 @@ Length < digestSize: 98b16391063ece
Length % digestSize != 0: 98b16391063ecee006a3ca8ee5776b1e5f
Algo name case-sensitivity: true
Non-crypto algo name case-sensitivity:
-
-Warning: hash_hkdf(): Non-cryptographic hashing algorithm: jOaAt in %s on line %d
-bool(false)
+[Error] Non-cryptographic hashing algorithm: jOaAt
diff --git a/ext/hash/tests/hash_hkdf_error.phpt b/ext/hash/tests/hash_hkdf_error.phpt
index b833054e80..411d0637ab 100644
--- a/ext/hash/tests/hash_hkdf_error.phpt
+++ b/ext/hash/tests/hash_hkdf_error.phpt
@@ -3,96 +3,69 @@ Hash: hash_hkdf() function: error conditions
--FILE--
<?php
+error_reporting(E_ALL);
+
/* Prototype : string hkdf ( string $algo , string $ikm [, int $length , string $info = '' , string $salt = '' ] )
* Description: HMAC-based Key Derivation Function
* Source code: ext/hash/hash.c
*/
+function trycatch_dump(...$tests) {
+ foreach ($tests as $test) {
+ try {
+ var_dump($test());
+ }
+ catch (\Error $e) {
+ echo '[' . get_class($e) . '] ' . $e->getMessage() . "\n";
+ }
+ }
+}
+
$ikm = 'input key material';
echo "*** Testing hash_hkdf(): error conditions ***\n";
-echo "\n-- Testing hash_hkdf() function with less than expected no. of arguments --\n";
-var_dump(hash_hkdf());
-var_dump(hash_hkdf('sha1'));
-
-echo "\n-- Testing hash_hkdf() function with more than expected no. of arguments --\n";
-var_dump(hash_hkdf('sha1', $ikm, 20, '', '', 'extra parameter'));
-
echo "\n-- Testing hash_hkdf() function with invalid hash algorithm --\n";
-var_dump(hash_hkdf('foo', $ikm));
+trycatch_dump(
+ fn() => hash_hkdf('foo', $ikm)
+);
echo "\n-- Testing hash_hkdf() function with non-cryptographic hash algorithm --\n";
-var_dump(hash_hkdf('adler32', $ikm));
-var_dump(hash_hkdf('crc32', $ikm));
-var_dump(hash_hkdf('crc32b', $ikm));
-var_dump(hash_hkdf('fnv132', $ikm));
-var_dump(hash_hkdf('fnv1a32', $ikm));
-var_dump(hash_hkdf('fnv164', $ikm));
-var_dump(hash_hkdf('fnv1a64', $ikm));
-var_dump(hash_hkdf('joaat', $ikm));
+trycatch_dump(
+ fn() => hash_hkdf('adler32', $ikm),
+ fn() => hash_hkdf('crc32', $ikm),
+ fn() => hash_hkdf('crc32b', $ikm),
+ fn() => hash_hkdf('fnv132', $ikm),
+ fn() => hash_hkdf('fnv1a32', $ikm),
+ fn() => hash_hkdf('fnv164', $ikm),
+ fn() => hash_hkdf('fnv1a64', $ikm),
+ fn() => hash_hkdf('joaat', $ikm)
+);
echo "\n-- Testing hash_hkdf() function with invalid parameters --\n";
-var_dump(hash_hkdf('sha1', ''));
-var_dump(hash_hkdf('sha1', $ikm, -1));
-var_dump(hash_hkdf('sha1', $ikm, 20 * 255 + 1)); // Length can't be more than 255 times the hash digest size
+trycatch_dump(
+ fn() => hash_hkdf('sha1', ''),
+ fn() => hash_hkdf('sha1', $ikm, -1),
+ fn() => hash_hkdf('sha1', $ikm, 20 * 255 + 1) // Length can't be more than 255 times the hash digest size
+)
?>
-===Done===
---EXPECTF--
+--EXPECT--
*** Testing hash_hkdf(): error conditions ***
--- Testing hash_hkdf() function with less than expected no. of arguments --
-
-Warning: hash_hkdf() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: hash_hkdf() expects at least 2 parameters, 1 given in %s on line %d
-NULL
-
--- Testing hash_hkdf() function with more than expected no. of arguments --
-
-Warning: hash_hkdf() expects at most 5 parameters, 6 given in %s on line %d
-NULL
-
-- Testing hash_hkdf() function with invalid hash algorithm --
-
-Warning: hash_hkdf(): Unknown hashing algorithm: foo in %s on line %d
-bool(false)
+[Error] Unknown hashing algorithm: foo
-- Testing hash_hkdf() function with non-cryptographic hash algorithm --
-
-Warning: hash_hkdf(): Non-cryptographic hashing algorithm: adler32 in %s on line %d
-bool(false)
-
-Warning: hash_hkdf(): Non-cryptographic hashing algorithm: crc32 in %s on line %d
-bool(false)
-
-Warning: hash_hkdf(): Non-cryptographic hashing algorithm: crc32b in %s on line %d
-bool(false)
-
-Warning: hash_hkdf(): Non-cryptographic hashing algorithm: fnv132 in %s on line %d
-bool(false)
-
-Warning: hash_hkdf(): Non-cryptographic hashing algorithm: fnv1a32 in %s on line %d
-bool(false)
-
-Warning: hash_hkdf(): Non-cryptographic hashing algorithm: fnv164 in %s on line %d
-bool(false)
-
-Warning: hash_hkdf(): Non-cryptographic hashing algorithm: fnv1a64 in %s on line %d
-bool(false)
-
-Warning: hash_hkdf(): Non-cryptographic hashing algorithm: joaat in %s on line %d
-bool(false)
+[Error] Non-cryptographic hashing algorithm: adler32
+[Error] Non-cryptographic hashing algorithm: crc32
+[Error] Non-cryptographic hashing algorithm: crc32b
+[Error] Non-cryptographic hashing algorithm: fnv132
+[Error] Non-cryptographic hashing algorithm: fnv1a32
+[Error] Non-cryptographic hashing algorithm: fnv164
+[Error] Non-cryptographic hashing algorithm: fnv1a64
+[Error] Non-cryptographic hashing algorithm: joaat
-- Testing hash_hkdf() function with invalid parameters --
-
-Warning: hash_hkdf(): Input keying material cannot be empty in %s on line %d
-bool(false)
-
-Warning: hash_hkdf(): Length must be greater than or equal to 0: -1 in %s on line %d
-bool(false)
-
-Warning: hash_hkdf(): Length must be less than or equal to 5100: 5101 in %s on line %d
-bool(false)
-===Done===
+[Error] Input keying material cannot be empty
+[Error] Length must be greater than or equal to 0: -1
+[Error] Length must be less than or equal to 5100: 5101
diff --git a/ext/hash/tests/hash_hkdf_rfc5869.phpt b/ext/hash/tests/hash_hkdf_rfc5869.phpt
index 5652bff5ef..63c65f0a7d 100644
--- a/ext/hash/tests/hash_hkdf_rfc5869.phpt
+++ b/ext/hash/tests/hash_hkdf_rfc5869.phpt
@@ -10,62 +10,61 @@ Hash: hash_hkdf() function: RFC 5869 test vectors
echo "*** Testing hash_hkdf(): RFC 5869 test vectors ***\n";
echo "Test case 1 (SHA-256): ",
- bin2hex(hash_hkdf(
- 'sha256',
- "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
- 42,
- "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9",
- "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c"
- )), "\n";
+ bin2hex(hash_hkdf(
+ 'sha256',
+ "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
+ 42,
+ "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9",
+ "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c"
+ )), "\n";
echo "Test case 2 (SHA-256 with longer inputs/outputs): ",
- bin2hex(hash_hkdf(
- 'sha256',
- "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f",
- 82,
- "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
- "\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
- )), "\n";
+ bin2hex(hash_hkdf(
+ 'sha256',
+ "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f",
+ 82,
+ "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
+ "\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
+ )), "\n";
echo "Test case 3 (SHA-256 with zero-length salt, info): ",
- bin2hex(hash_hkdf(
- 'sha256',
- "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
- 42,
- '',
- ''
- )), "\n";
+ bin2hex(hash_hkdf(
+ 'sha256',
+ "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
+ 42,
+ '',
+ ''
+ )), "\n";
echo "Test case 4 (SHA-1): ",
- bin2hex(hash_hkdf(
- 'sha1',
- "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
- 42,
- "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9",
- "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c"
- )), "\n";
+ bin2hex(hash_hkdf(
+ 'sha1',
+ "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
+ 42,
+ "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9",
+ "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c"
+ )), "\n";
echo "Test case 5 (SHA-1 with longer inputs/outputs): ",
- bin2hex(hash_hkdf(
- 'sha1',
- "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f",
- 82,
- "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
- "\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
- )), "\n";
+ bin2hex(hash_hkdf(
+ 'sha1',
+ "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f",
+ 82,
+ "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
+ "\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
+ )), "\n";
echo "Test case 6 (SHA-1 with zero-length salt, info): ",
- bin2hex(hash_hkdf(
- 'sha1',
- "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
- 42,
- '',
- ''
- )), "\n";
+ bin2hex(hash_hkdf(
+ 'sha1',
+ "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
+ 42,
+ '',
+ ''
+ )), "\n";
echo "Test case 7 (SHA-1 with zero-length info, salt not provided): ",
- bin2hex(hash_hkdf(
- 'sha1',
- "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c",
- 42,
- ''
- )), "\n";
+ bin2hex(hash_hkdf(
+ 'sha1',
+ "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c",
+ 42,
+ ''
+ )), "\n";
?>
-===Done===
--EXPECT--
*** Testing hash_hkdf(): RFC 5869 test vectors ***
Test case 1 (SHA-256): 3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c5bf34007208d5b887185865
@@ -75,4 +74,3 @@ Test case 4 (SHA-1): 085a01ea1b10f36933068b56efa5ad81a4f14b822f5b091568a9cdd4f15
Test case 5 (SHA-1 with longer inputs/outputs): 0bd770a74d1160f7c9f12cd5912a06ebff6adcae899d92191fe4305673ba2ffe8fa3f1a4e5ad79f3f334b3b202b2173c486ea37ce3d397ed034c7f9dfeb15c5e927336d0441f4c4300e2cff0d0900b52d3b4
Test case 6 (SHA-1 with zero-length salt, info): 0ac1af7002b3d761d1e55298da9d0506b9ae52057220a306e07b6b87e8df21d0ea00033de03984d34918
Test case 7 (SHA-1 with zero-length info, salt not provided): 2c91117204d745f3500d636a62f64f0ab3bae548aa53d423b0d1f27ebba6f5e5673a081d70cce7acfc48
-===Done===
diff --git a/ext/hash/tests/hash_hmac_basic.phpt b/ext/hash/tests/hash_hmac_basic.phpt
index 1ad27e1cb2..1cc98ae1d4 100644
--- a/ext/hash/tests/hash_hmac_basic.phpt
+++ b/ext/hash/tests/hash_hmac_basic.phpt
@@ -34,7 +34,6 @@ echo "md5(raw): " . bin2hex(hash_hmac('md5', $content, $key, TRUE)) . "\n";
echo "sha256(raw): " . bin2hex(hash_hmac('sha256', $content, $key, TRUE)) . "\n";
?>
-===Done===
--EXPECT--
*** Testing hash_hmac() : basic functionality ***
gost: a4a3c80bdf3f8665bf07376a34dc9c1b11af7c813f4928f62e39f0c0dc564dad
@@ -55,4 +54,3 @@ tiger192,3: 00a0f884f15a9e5549ed0e40ca0190522d369027e16d5b59
whirlpool: 4a0f1582b21b7aff59bfba7f9c29131c69741b2ce80acdc7d314040f3b768cf5a17e30b74cceb86fbc6b34b1692e0addd5bfd7cfc043d40c0621f1b97e26fa49
md5(raw): 2a632783e2812cf23de100d7d6a463ae
sha256(raw): 49bde3496b9510a17d0edd8a4b0ac70148e32a1d51e881ec76faa96534125838
-===Done===
diff --git a/ext/hash/tests/hash_hmac_error.phpt b/ext/hash/tests/hash_hmac_error.phpt
index 89d29b8df8..3b14243fb2 100644
--- a/ext/hash/tests/hash_hmac_error.phpt
+++ b/ext/hash/tests/hash_hmac_error.phpt
@@ -12,49 +12,28 @@ echo "*** Testing hash_hmac() : error conditions ***\n";
$data = "This is a sample string used to test the hash_hmac function with various hashing algorithms";
$key = 'secret';
-echo "\n-- Testing hash_hmac() function with less than expected no. of arguments --\n";
-var_dump(hash_hmac());
-var_dump(hash_hmac('md5'));
-var_dump(hash_hmac('md5', $data));
-
-echo "\n-- Testing hash_hmac() function with more than expected no. of arguments --\n";
-$extra_arg = 10;
-var_dump(hash_hmac('md5', $data, $key, TRUE, $extra_arg));
-
echo "\n-- Testing hash_hmac() function with invalid hash algorithm --\n";
-var_dump(hash_hmac('foo', $data, $key));
+try {
+ var_dump(hash_hmac('foo', $data, $key));
+}
+catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
echo "\n-- Testing hash_hmac() function with non-cryptographic hash algorithm --\n";
-var_dump(hash_hmac('crc32', $data, $key));
+try {
+ var_dump(hash_hmac('crc32', $data, $key));
+}
+catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
?>
-===Done===
---EXPECTF--
+--EXPECT--
*** Testing hash_hmac() : error conditions ***
--- Testing hash_hmac() function with less than expected no. of arguments --
-
-Warning: hash_hmac() expects at least 3 parameters, 0 given in %s on line %d
-NULL
-
-Warning: hash_hmac() expects at least 3 parameters, 1 given in %s on line %d
-NULL
-
-Warning: hash_hmac() expects at least 3 parameters, 2 given in %s on line %d
-NULL
-
--- Testing hash_hmac() function with more than expected no. of arguments --
-
-Warning: hash_hmac() expects at most 4 parameters, 5 given in %s on line %d
-NULL
-
-- Testing hash_hmac() function with invalid hash algorithm --
-
-Warning: hash_hmac(): Unknown hashing algorithm: foo in %s on line %d
-bool(false)
+Unknown hashing algorithm: foo
-- Testing hash_hmac() function with non-cryptographic hash algorithm --
-
-Warning: hash_hmac(): Non-cryptographic hashing algorithm: crc32 in %s on line %d
-bool(false)
-===Done===
+Non-cryptographic hashing algorithm: crc32
diff --git a/ext/hash/tests/hash_hmac_file_basic.phpt b/ext/hash/tests/hash_hmac_file_basic.phpt
index 6e4b4da078..4569c46c35 100644
--- a/ext/hash/tests/hash_hmac_file_basic.phpt
+++ b/ext/hash/tests/hash_hmac_file_basic.phpt
@@ -15,7 +15,7 @@ echo "*** Testing hash_hmac_file() : basic functionality ***\n";
$file = __DIR__ . "hash_hmac_file.txt";
/* Creating a temporary file file */
if (($fp = fopen( $file, "w+")) == FALSE) {
- echo "Cannot create file ($file)";
+ echo "Cannot create file ($file)";
exit;
}
@@ -54,15 +54,9 @@ echo "whirlpool: " . hash_hmac_file('whirlpool', $file, $key) . "\n";
echo "md5(raw): " . bin2hex(hash_hmac_file('md5', $file, $key, TRUE)). "\n";
echo "sha256(raw): " . bin2hex(hash_hmac_file('sha256', $file, $key, TRUE)). "\n";
-echo "Error cases:\n";
-hash_hmac_file();
-hash_hmac_file('foo', $file);
-hash_hmac_file('foo', $file, $key, TRUE, 10);
-
unlink($file);
?>
-===Done===
--EXPECTF--
*** Testing hash_hmac_file() : basic functionality ***
gost: 94c39a40d5db852a8dc3d24e37eebf2d53e3d711457c59cd02b614f792a9d918
@@ -83,11 +77,3 @@ tiger192,3: ca89badf843ba68e3fae5832635aa848a72a4bc11676edd4
whirlpool: 37a0fbb90547690d5e5e11c046f6654ffdb7bab15e16d9d79c7d85765cc4bdcbfd9df8db7a3ce9558f3f244fead00ca29cf05297f75596555195a0683f15d69f
md5(raw): 8bddf39dd1c566c27acc7fa85ec36acf
sha256(raw): 9135286ca4c84dec711e4b831f6cd39e672e5ff93d011321274eb76733cc1e40
-Error cases:
-
-Warning: hash_hmac_file() expects at least 3 parameters, 0 given in %s on line %d
-
-Warning: hash_hmac_file() expects at least 3 parameters, 2 given in %s on line %d
-
-Warning: hash_hmac_file() expects at most 4 parameters, 5 given in %s on line %d
-===Done===
diff --git a/ext/hash/tests/hash_hmac_file_error.phpt b/ext/hash/tests/hash_hmac_file_error.phpt
index a3718ebb85..f23d335699 100644
--- a/ext/hash/tests/hash_hmac_file_error.phpt
+++ b/ext/hash/tests/hash_hmac_file_error.phpt
@@ -14,53 +14,39 @@ echo "*** Testing hash() : error conditions ***\n";
$file = __DIR__ . "hash_file.txt";
$key = 'secret';
-echo "\n-- Testing hash_hmac_file() function with less than expected no. of arguments --\n";
-var_dump(hash_hmac_file());
-var_dump(hash_hmac_file('crc32'));
-var_dump(hash_hmac_file('crc32', $file));
-
-echo "\n-- Testing hash_hmac_file() function with more than expected no. of arguments --\n";
-$extra_arg = 10;
-hash_hmac_file('crc32', $file, $key, TRUE, $extra_arg);
-
echo "\n-- Testing hash_hmac_file() function with invalid hash algorithm --\n";
-hash_hmac_file('foo', $file, $key, TRUE);
+try {
+ var_dump(hash_hmac_file('foo', $file, $key, TRUE));
+}
+catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
echo "\n-- Testing hash_hmac_file() function with non-cryptographic hash algorithm --\n";
-hash_hmac_file('crc32', $file, $key, TRUE);
+try {
+ var_dump(hash_hmac_file('crc32', $file, $key, TRUE));
+}
+catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
echo "\n-- Testing hash_hmac_file() function with bad path --\n";
-hash_hmac_file('md5', $file.chr(0).$file, $key, TRUE);
+try {
+ var_dump(hash_hmac_file('md5', $file.chr(0).$file, $key, TRUE));
+}
+catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
?>
-===Done===
---EXPECTF--
+--EXPECT--
*** Testing hash() : error conditions ***
--- Testing hash_hmac_file() function with less than expected no. of arguments --
-
-Warning: hash_hmac_file() expects at least 3 parameters, 0 given in %s on line %d
-NULL
-
-Warning: hash_hmac_file() expects at least 3 parameters, 1 given in %s on line %d
-NULL
-
-Warning: hash_hmac_file() expects at least 3 parameters, 2 given in %s on line %d
-NULL
-
--- Testing hash_hmac_file() function with more than expected no. of arguments --
-
-Warning: hash_hmac_file() expects at most 4 parameters, 5 given in %s on line %d
-
-- Testing hash_hmac_file() function with invalid hash algorithm --
-
-Warning: hash_hmac_file(): Unknown hashing algorithm: foo in %s on line %d
+Unknown hashing algorithm: foo
-- Testing hash_hmac_file() function with non-cryptographic hash algorithm --
-
-Warning: hash_hmac_file(): Non-cryptographic hashing algorithm: crc32 in %s on line %d
+Non-cryptographic hashing algorithm: crc32
-- Testing hash_hmac_file() function with bad path --
-
-Warning: hash_hmac_file(): Invalid path in %s on line %d
-===Done===
+Invalid path
diff --git a/ext/hash/tests/hash_init_error.phpt b/ext/hash/tests/hash_init_error.phpt
index e941aabca5..f9d0362dd2 100644
--- a/ext/hash/tests/hash_init_error.phpt
+++ b/ext/hash/tests/hash_init_error.phpt
@@ -4,37 +4,48 @@ Hash: hash_init() function - errors test
<?php
echo "*** Testing hash_init(): error conditions ***\n";
-echo "-- Testing hash_init() function with no parameters --\n";
-var_dump(hash_init());
+echo "\n-- Testing hash_init() function with unknown algorithms --\n";
+try {
+ var_dump(hash_init('dummy'));
+}
+catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+
+echo "\n-- Testing hash_init() function with HASH_HMAC and non-cryptographic algorithms --\n";
+try {
+ var_dump(hash_init('crc32', HASH_HMAC));
+}
+catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+
+echo "\n-- Testing hash_init() function with HASH_HMAC and no key --\n";
+try {
+ var_dump(hash_init('md5', HASH_HMAC));
+}
+catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+
+try {
+ var_dump(hash_init('md5', HASH_HMAC, null));
+}
+catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
-echo "-- Testing hash_init() function with unknown algorithms --\n";
-var_dump(hash_init('dummy'));
-echo "-- Testing hash_init() function with HASH_HMAC and non-cryptographic algorithms --\n";
-var_dump(hash_init('crc32', HASH_HMAC));
-
-echo "-- Testing hash_init() function with HASH_HMAC and no key --\n";
-var_dump(hash_init('md5', HASH_HMAC));
-var_dump(hash_init('md5', HASH_HMAC, null));
?>
---EXPECTF--
+--EXPECT--
*** Testing hash_init(): error conditions ***
--- Testing hash_init() function with no parameters --
-Warning: hash_init() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-- Testing hash_init() function with unknown algorithms --
+Unknown hashing algorithm: dummy
-Warning: hash_init(): Unknown hashing algorithm: dummy in %s on line %d
-bool(false)
-- Testing hash_init() function with HASH_HMAC and non-cryptographic algorithms --
+HMAC requested with a non-cryptographic hashing algorithm: crc32
-Warning: hash_init(): HMAC requested with a non-cryptographic hashing algorithm: crc32 in %s on line %d
-bool(false)
-- Testing hash_init() function with HASH_HMAC and no key --
-
-Warning: hash_init(): HMAC requested without a key %s on line %d
-bool(false)
-
-Warning: hash_init(): HMAC requested without a key %s on line %d
-bool(false)
+HMAC requested without a key
+HMAC requested without a key
diff --git a/ext/hash/tests/hash_pbkdf2_basic.phpt b/ext/hash/tests/hash_pbkdf2_basic.phpt
index 71187a0fdd..0ba500a327 100644
--- a/ext/hash/tests/hash_pbkdf2_basic.phpt
+++ b/ext/hash/tests/hash_pbkdf2_basic.phpt
@@ -23,7 +23,6 @@ echo "sha256(rounds): " . hash_pbkdf2('sha256', 'passwordPASSWORDpassword', 'sal
echo "sha256(rounds)(raw): " . bin2hex(hash_pbkdf2('sha256', 'passwordPASSWORDpassword', 'saltSALTsaltSALTsaltSALTsaltSALTsalt', 4096, 40, TRUE))."\n";
?>
-===Done===
--EXPECT--
*** Testing hash_pbkdf2() : basic functionality ***
sha1: 0c60c80f961f0e71f3a9
@@ -36,4 +35,3 @@ sha256(no length): 120fb6cffcf8b32c43e7225256c4f837a86548c92ccc35480805987cb70be
sha256(raw): 120fb6cffcf8b32c43e7225256c4f837a86548c9
sha256(rounds): 348c89dbcbd32b2f32d814b8116e84cf2b17347e
sha256(rounds)(raw): 348c89dbcbd32b2f32d814b8116e84cf2b17347ebc1800181c4e2a1fb8dd53e1c635518c7dac47e9
-===Done===
diff --git a/ext/hash/tests/hash_pbkdf2_error.phpt b/ext/hash/tests/hash_pbkdf2_error.phpt
index c0a76e17b4..795dea1ce3 100644
--- a/ext/hash/tests/hash_pbkdf2_error.phpt
+++ b/ext/hash/tests/hash_pbkdf2_error.phpt
@@ -12,72 +12,59 @@ echo "*** Testing hash_pbkdf2() : error conditions ***\n";
$password = 'password';
$salt = 'salt';
-echo "\n-- Testing hash_pbkdf2() function with less than expected no. of arguments --\n";
-var_dump(hash_pbkdf2());
-var_dump(hash_pbkdf2('md5'));
-var_dump(hash_pbkdf2('md5', $password));
-var_dump(hash_pbkdf2('md5', $password, $salt));
-
-echo "\n-- Testing hash_pbkdf2() function with more than expected no. of arguments --\n";
-var_dump(hash_pbkdf2('md5', $password, $salt, 10, 10, true, 'extra arg'));
-
echo "\n-- Testing hash_pbkdf2() function with invalid hash algorithm --\n";
-var_dump(hash_pbkdf2('foo', $password, $salt, 1));
+try {
+ var_dump(hash_pbkdf2('foo', $password, $salt, 1));
+}
+catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+
echo "\n-- Testing hash_pbkdf2() function with non-cryptographic hash algorithm --\n";
-var_dump(hash_pbkdf2('crc32', $password, $salt, 1));
+try {
+ var_dump(hash_pbkdf2('crc32', $password, $salt, 1));
+}
+catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
echo "\n-- Testing hash_pbkdf2() function with invalid iterations --\n";
-var_dump(hash_pbkdf2('md5', $password, $salt, 0));
-var_dump(hash_pbkdf2('md5', $password, $salt, -1));
+try {
+ var_dump(hash_pbkdf2('md5', $password, $salt, 0));
+}
+catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+
+try {
+ var_dump(hash_pbkdf2('md5', $password, $salt, -1));
+}
+catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
echo "\n-- Testing hash_pbkdf2() function with invalid length --\n";
-var_dump(hash_pbkdf2('md5', $password, $salt, 1, -1));
+try {
+ var_dump(hash_pbkdf2('md5', $password, $salt, 1, -1));
+}
+catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
?>
-===Done===
---EXPECTF--
+--EXPECT--
*** Testing hash_pbkdf2() : error conditions ***
--- Testing hash_pbkdf2() function with less than expected no. of arguments --
-
-Warning: hash_pbkdf2() expects at least 4 parameters, 0 given in %s on line %d
-NULL
-
-Warning: hash_pbkdf2() expects at least 4 parameters, 1 given in %s on line %d
-NULL
-
-Warning: hash_pbkdf2() expects at least 4 parameters, 2 given in %s on line %d
-NULL
-
-Warning: hash_pbkdf2() expects at least 4 parameters, 3 given in %s on line %d
-NULL
-
--- Testing hash_pbkdf2() function with more than expected no. of arguments --
-
-Warning: hash_pbkdf2() expects at most 6 parameters, 7 given in %s on line %d
-NULL
-
-- Testing hash_pbkdf2() function with invalid hash algorithm --
-
-Warning: hash_pbkdf2(): Unknown hashing algorithm: foo in %s on line %d
-bool(false)
+Unknown hashing algorithm: foo
-- Testing hash_pbkdf2() function with non-cryptographic hash algorithm --
-
-Warning: hash_pbkdf2(): Non-cryptographic hashing algorithm: crc32 in %s on line %d
-bool(false)
+Non-cryptographic hashing algorithm: crc32
-- Testing hash_pbkdf2() function with invalid iterations --
-
-Warning: hash_pbkdf2(): Iterations must be a positive integer: 0 in %s on line %d
-bool(false)
-
-Warning: hash_pbkdf2(): Iterations must be a positive integer: -1 in %s on line %d
-bool(false)
+Iterations must be a positive integer: 0
+Iterations must be a positive integer: -1
-- Testing hash_pbkdf2() function with invalid length --
-
-Warning: hash_pbkdf2(): Length must be greater than or equal to 0: -1 in %s on line %d
-bool(false)
-===Done===
+Length must be greater than or equal to 0: -1
diff --git a/ext/hash/tests/haval.phpt b/ext/hash/tests/haval.phpt
index b01abdb8ef..514fc7c97b 100644
--- a/ext/hash/tests/haval.phpt
+++ b/ext/hash/tests/haval.phpt
@@ -4,24 +4,24 @@ Hash: haval algorithm (multi-vector, multi-pass, multi-width)
<?php
echo "Empty String\n";
for($pass=3; $pass<=5; $pass++)
- for($bits=128; $bits <= 256; $bits += 32) {
- $algo = sprintf('haval%d,%d',$bits,$pass);
- echo $algo . ': ' . hash($algo,'') . "\n";
- }
+ for($bits=128; $bits <= 256; $bits += 32) {
+ $algo = sprintf('haval%d,%d',$bits,$pass);
+ echo $algo . ': ' . hash($algo,'') . "\n";
+ }
echo "\"abc\"\n";
for($pass=3; $pass<=5; $pass++)
- for($bits=128; $bits <= 256; $bits += 32) {
- $algo = sprintf('haval%d,%d',$bits,$pass);
- echo $algo . ': ' . hash($algo,'abc') . "\n";
- }
+ for($bits=128; $bits <= 256; $bits += 32) {
+ $algo = sprintf('haval%d,%d',$bits,$pass);
+ echo $algo . ': ' . hash($algo,'abc') . "\n";
+ }
echo "\"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ0123456789\"\n";
for($pass=3; $pass<=5; $pass++)
- for($bits=128; $bits <= 256; $bits += 32) {
- $algo = sprintf('haval%d,%d',$bits,$pass);
- echo $algo . ': ' . hash($algo,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ0123456789') . "\n";
- }
+ for($bits=128; $bits <= 256; $bits += 32) {
+ $algo = sprintf('haval%d,%d',$bits,$pass);
+ echo $algo . ': ' . hash($algo,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ0123456789') . "\n";
+ }
--EXPECT--
Empty String
haval128,3: c68f39913f901f3ddf44c707357a7d70
diff --git a/ext/hash/tests/joaat.phpt b/ext/hash/tests/joaat.phpt
index 819b598851..b066b37bb1 100644
--- a/ext/hash/tests/joaat.phpt
+++ b/ext/hash/tests/joaat.phpt
@@ -3,25 +3,25 @@ Hash: Jenkins's one-at-a-time
--FILE--
<?php
$tests = array(
- array("hello world", "3e4a5a57"),
- array("", 0),
- array("", "000000"),
- array("a", "ca2e9442"),
- array("aa", "7081738e"),
+ array("hello world", "3e4a5a57"),
+ array("", 0),
+ array("", "000000"),
+ array("a", "ca2e9442"),
+ array("aa", "7081738e"),
);
$i = 0;
$pass = true;
foreach ($tests as $test) {
- ++$i;
+ ++$i;
- $result = hash("joaat", $test[0]);
- if ($result != $test[1]) {
- echo "Iteration " . $i . " failed - expected '" . $test[1] . "', got '" . $result . "' for '" . $test[1] . "'\n";
+ $result = hash("joaat", $test[0]);
+ if ($result != $test[1]) {
+ echo "Iteration " . $i . " failed - expected '" . $test[1] . "', got '" . $result . "' for '" . $test[1] . "'\n";
- $pass = false;
- }
+ $pass = false;
+ }
}
if($pass) {
diff --git a/ext/hash/tests/mhash_001.phpt b/ext/hash/tests/mhash_001.phpt
index 71d6d20df6..b61bab6494 100644
--- a/ext/hash/tests/mhash_001.phpt
+++ b/ext/hash/tests/mhash_001.phpt
@@ -22,16 +22,16 @@ $supported_hash_al = array(
$data = "This is the test of the mhash extension...";
foreach ($supported_hash_al as $hash=>$wanted) {
- $result = mhash(constant($hash), $data);
- if (bin2hex($result)==$wanted) {
- echo "$hash\nok\n";
- } else {
- echo "$hash: ";
- var_dump($wanted);
- echo "$hash: ";
- var_dump(bin2hex($result));
- }
- echo "\n";
+ $result = mhash(constant($hash), $data);
+ if (bin2hex($result)==$wanted) {
+ echo "$hash\nok\n";
+ } else {
+ echo "$hash: ";
+ var_dump($wanted);
+ echo "$hash: ";
+ var_dump(bin2hex($result));
+ }
+ echo "\n";
}
?>
--EXPECT--
diff --git a/ext/hash/tests/mhash_002.phpt b/ext/hash/tests/mhash_002.phpt
index 2318470919..fdf886a71e 100644
--- a/ext/hash/tests/mhash_002.phpt
+++ b/ext/hash/tests/mhash_002.phpt
@@ -29,16 +29,16 @@ $hc = mhash_count() + 1;
$known_hash_al = array();
for ($i=0; $i < $hc; $i++) {
- $known_hash_al[mhash_get_hash_name($i)] = $i;
+ $known_hash_al[mhash_get_hash_name($i)] = $i;
}
foreach ($supported_hash_al as $name => $len) {
- if (array_key_exists($name, $known_hash_al)) {
- $len = mhash_get_block_size($known_hash_al[$name]);
- echo "$name = $len\n";
- } else {
- echo "$name ? $len\n";
- }
+ if (array_key_exists($name, $known_hash_al)) {
+ $len = mhash_get_block_size($known_hash_al[$name]);
+ echo "$name = $len\n";
+ } else {
+ echo "$name ? $len\n";
+ }
}
?>
--EXPECTREGEX--
diff --git a/ext/hash/tests/mhash_003.phpt b/ext/hash/tests/mhash_003.phpt
index a4d43eb8d5..99436b9ece 100644
--- a/ext/hash/tests/mhash_003.phpt
+++ b/ext/hash/tests/mhash_003.phpt
@@ -20,18 +20,18 @@ $supported_hash_al = array(
);
foreach ($supported_hash_al as $hash=>$wanted) {
- $passwd = str_repeat($hash, 10);
- $salt = str_repeat($hash, 2);
- $result = mhash_keygen_s2k(constant($hash), $passwd, $salt, 100);
- if (!strcmp(bin2hex($result), $wanted)) {
- echo "$hash\nok\n";
- } else {
- echo "$hash: ";
- var_dump($wanted);
- echo "$hash: ";
- var_dump(bin2hex($result));
- }
- echo "\n";
+ $passwd = str_repeat($hash, 10);
+ $salt = str_repeat($hash, 2);
+ $result = mhash_keygen_s2k(constant($hash), $passwd, $salt, 100);
+ if (!strcmp(bin2hex($result), $wanted)) {
+ echo "$hash\nok\n";
+ } else {
+ echo "$hash: ";
+ var_dump($wanted);
+ echo "$hash: ";
+ var_dump(bin2hex($result));
+ }
+ echo "\n";
}
?>
--EXPECT--
diff --git a/ext/hash/tests/reuse.phpt b/ext/hash/tests/reuse.phpt
index cd1419fd55..78df4b41af 100644
--- a/ext/hash/tests/reuse.phpt
+++ b/ext/hash/tests/reuse.phpt
@@ -5,6 +5,12 @@ Hash: Attempt to reuse a closed hash context
$h = hash_init('md5');
hash_final($h);
-hash_update($h, 'foo');
---EXPECTF--
-Warning: hash_update(): supplied resource is not a valid Hash Context resource in %s%eext%ehash%etests%ereuse.php on line %d
+try {
+ hash_update($h, 'foo');
+}
+catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+
+--EXPECT--
+hash_update(): supplied resource is not a valid Hash Context resource
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
index d4244b19f4..36fdcf6198 100644
--- a/ext/iconv/iconv.c
+++ b/ext/iconv/iconv.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -53,71 +51,11 @@
#include "zend_smart_str.h"
#include "ext/standard/base64.h"
#include "ext/standard/quot_print.h"
+#include "iconv_arginfo.h"
#define _php_iconv_memequal(a, b, c) \
(memcmp(a, b, c) == 0)
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_iconv_strlen, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, charset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_iconv_substr, 0, 0, 2)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, offset)
- ZEND_ARG_INFO(0, length)
- ZEND_ARG_INFO(0, charset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_iconv_strpos, 0, 0, 2)
- ZEND_ARG_INFO(0, haystack)
- ZEND_ARG_INFO(0, needle)
- ZEND_ARG_INFO(0, offset)
- ZEND_ARG_INFO(0, charset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_iconv_strrpos, 0, 0, 2)
- ZEND_ARG_INFO(0, haystack)
- ZEND_ARG_INFO(0, needle)
- ZEND_ARG_INFO(0, charset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_iconv_mime_encode, 0, 0, 2)
- ZEND_ARG_INFO(0, field_name)
- ZEND_ARG_INFO(0, field_value)
- ZEND_ARG_INFO(0, preference) /* ZEND_ARG_ARRAY_INFO(0, preference, 1) */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_iconv_mime_decode, 0, 0, 1)
- ZEND_ARG_INFO(0, encoded_string)
- ZEND_ARG_INFO(0, mode)
- ZEND_ARG_INFO(0, charset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_iconv_mime_decode_headers, 0, 0, 1)
- ZEND_ARG_INFO(0, headers)
- ZEND_ARG_INFO(0, mode)
- ZEND_ARG_INFO(0, charset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_iconv, 0)
- ZEND_ARG_INFO(0, in_charset)
- ZEND_ARG_INFO(0, out_charset)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_iconv_set_encoding, 0)
- ZEND_ARG_INFO(0, type)
- ZEND_ARG_INFO(0, charset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_iconv_get_encoding, 0, 0, 0)
- ZEND_ARG_INFO(0, type)
-ZEND_END_ARG_INFO()
-
-/* }}} */
-
/* {{{ iconv_functions[]
*/
static const zend_function_entry iconv_functions[] = {
@@ -2064,7 +2002,7 @@ PHP_FUNCTION(iconv_strlen)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|s",
&str, &charset, &charset_len) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (charset_len >= ICONV_CSNMAXLEN) {
@@ -2090,15 +2028,16 @@ PHP_FUNCTION(iconv_substr)
size_t charset_len = 0;
zend_string *str;
zend_long offset, length = 0;
+ zend_bool len_is_null = 1;
php_iconv_err_t err;
smart_str retval = {0};
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sl|ls",
- &str, &offset, &length,
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sl|l!s",
+ &str, &offset, &length, &len_is_null,
&charset, &charset_len) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (charset_len >= ICONV_CSNMAXLEN) {
@@ -2106,14 +2045,14 @@ PHP_FUNCTION(iconv_substr)
RETURN_FALSE;
}
- if (ZEND_NUM_ARGS() < 3) {
+ if (len_is_null) {
length = ZSTR_LEN(str);
}
err = _php_iconv_substr(&retval, ZSTR_VAL(str), ZSTR_LEN(str), offset, length, charset);
_php_iconv_show_error(err, GENERIC_SUPERSET_NAME, charset);
- if (err == PHP_ICONV_ERR_SUCCESS && ZSTR_LEN(str) >= 0 && retval.s != NULL) {
+ if (err == PHP_ICONV_ERR_SUCCESS && retval.s != NULL) {
RETURN_NEW_STR(retval.s);
}
smart_str_free(&retval);
@@ -2138,7 +2077,7 @@ PHP_FUNCTION(iconv_strpos)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS|ls",
&haystk, &ndl,
&offset, &charset, &charset_len) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (charset_len >= ICONV_CSNMAXLEN) {
@@ -2192,7 +2131,7 @@ PHP_FUNCTION(iconv_strrpos)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS|s",
&haystk, &ndl,
&charset, &charset_len) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (ZSTR_LEN(ndl) < 1) {
@@ -2237,7 +2176,7 @@ PHP_FUNCTION(iconv_mime_encode)
&field_name, &field_value,
&pref) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (pref != NULL) {
@@ -2335,7 +2274,7 @@ PHP_FUNCTION(iconv_mime_decode)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|ls",
&encoded_str, &mode, &charset, &charset_len) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (charset_len >= ICONV_CSNMAXLEN) {
@@ -2375,7 +2314,7 @@ PHP_FUNCTION(iconv_mime_decode_headers)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|ls",
&encoded_str, &mode, &charset, &charset_len) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (charset_len >= ICONV_CSNMAXLEN) {
@@ -2468,8 +2407,9 @@ PHP_NAMED_FUNCTION(php_if_iconv)
zend_string *out_buffer;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ssS",
- &in_charset, &in_charset_len, &out_charset, &out_charset_len, &in_buffer) == FAILURE)
- return;
+ &in_charset, &in_charset_len, &out_charset, &out_charset_len, &in_buffer) == FAILURE) {
+ RETURN_THROWS();
+ }
if (in_charset_len >= ICONV_CSNMAXLEN || out_charset_len >= ICONV_CSNMAXLEN) {
php_error_docref(NULL, E_WARNING, "Charset parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN);
@@ -2498,8 +2438,9 @@ PHP_FUNCTION(iconv_set_encoding)
size_t type_len, retval;
zend_string *name;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "sS", &type, &type_len, &charset) == FAILURE)
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sS", &type, &type_len, &charset) == FAILURE) {
+ RETURN_THROWS();
+ }
if (ZSTR_LEN(charset) >= ICONV_CSNMAXLEN) {
php_error_docref(NULL, E_WARNING, "Charset parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN);
@@ -2534,8 +2475,9 @@ PHP_FUNCTION(iconv_get_encoding)
char *type = "all";
size_t type_len = sizeof("all")-1;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &type, &type_len) == FAILURE)
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &type, &type_len) == FAILURE) {
+ RETURN_THROWS();
+ }
if (!strcasecmp("all", type)) {
array_init(return_value);
diff --git a/ext/iconv/iconv.stub.php b/ext/iconv/iconv.stub.php
new file mode 100644
index 0000000000..cd9bab3ad0
--- /dev/null
+++ b/ext/iconv/iconv.stub.php
@@ -0,0 +1,21 @@
+<?php
+
+function iconv_strlen(string $str, string $charset = UNKNOWN): int|false {}
+
+function iconv_substr(string $str, int $offset, ?int $length = null, string $charset = UNKNOWN): string|false {}
+
+function iconv_strpos(string $haystack, string $needle, int $offset = 0, string $charset = UNKNOWN): int|false {}
+
+function iconv_strrpos(string $haystack, string $needle, string $charset = UNKNOWN): int|false {}
+
+function iconv_mime_encode(string $field_name, string $field_value, array $preference = []): string|false {}
+
+function iconv_mime_decode(string $encoded_string, int $mode = 0, string $charset = UNKNOWN): string|false {}
+
+function iconv_mime_decode_headers(string $headers, int $mode = 0, string $charset = UNKNOWN): array|false {}
+
+function iconv(string $in_charset, string $out_charset, string $str): string|false {}
+
+function iconv_set_encoding(string $type, string $charset): bool {}
+
+function iconv_get_encoding(string $type = 'all'): array|string|false {}
diff --git a/ext/iconv/iconv_arginfo.h b/ext/iconv/iconv_arginfo.h
new file mode 100644
index 0000000000..51f11cf794
--- /dev/null
+++ b/ext/iconv/iconv_arginfo.h
@@ -0,0 +1,59 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_iconv_strlen, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, charset, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_iconv_substr, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 1)
+ ZEND_ARG_TYPE_INFO(0, charset, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_iconv_strpos, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, haystack, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, needle, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, charset, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_iconv_strrpos, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, haystack, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, needle, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, charset, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_iconv_mime_encode, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, field_name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, field_value, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, preference, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_iconv_mime_decode, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, encoded_string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, charset, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_iconv_mime_decode_headers, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, headers, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, charset, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_iconv, 0, 3, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, in_charset, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, out_charset, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_iconv_set_encoding, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, type, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, charset, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_iconv_get_encoding, 0, 0, MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, type, IS_STRING, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/iconv/php_iconv.h b/ext/iconv/php_iconv.h
index 980d84c945..23cfdb09e9 100644
--- a/ext/iconv/php_iconv.h
+++ b/ext/iconv/php_iconv.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/iconv/tests/bug37773.phpt b/ext/iconv/tests/bug37773.phpt
index f9a1d3470e..e2fb6a55e6 100644
--- a/ext/iconv/tests/bug37773.phpt
+++ b/ext/iconv/tests/bug37773.phpt
@@ -12,7 +12,7 @@ if ($test === false) {
?>
--FILE--
<?php
- var_dump(iconv_substr('x', 0, 1, 'UTF-8'));
+ var_dump(iconv_substr('x', 0, 1, 'UTF-8'));
?>
--EXPECT--
string(1) "x"
diff --git a/ext/iconv/tests/bug53891.phpt b/ext/iconv/tests/bug53891.phpt
index 342b48e3a2..aa359ef386 100644
--- a/ext/iconv/tests/bug53891.phpt
+++ b/ext/iconv/tests/bug53891.phpt
@@ -15,7 +15,5 @@ $preferences = array(
);
var_dump(iconv_mime_encode('subject', "d obeybiubrsfqllpdtpge…", $preferences));
?>
-===DONE===
--EXPECT--
string(54) "subject: =?utf-8?Q?d=20obeybiubrsfqllpdtpge=E2=80=A6?="
-===DONE===
diff --git a/ext/iconv/tests/bug55146.phpt b/ext/iconv/tests/bug55146.phpt
index b3c2015314..2583ac7578 100644
--- a/ext/iconv/tests/bug55146.phpt
+++ b/ext/iconv/tests/bug55146.phpt
@@ -19,7 +19,6 @@ X-Header-Two: XtLePq6GTMn8G68F0
HEADERS;
var_dump(iconv_mime_decode_headers($headers, ICONV_MIME_DECODE_STRICT));
?>
-===DONE===
--EXPECT--
array(2) {
["X-Header-One"]=>
@@ -33,4 +32,3 @@ array(2) {
["X-Header-Two"]=>
string(17) "XtLePq6GTMn8G68F0"
}
-===DONE===
diff --git a/ext/iconv/tests/bug60494.phpt b/ext/iconv/tests/bug60494.phpt
index 5c658af56b..d303823388 100644
--- a/ext/iconv/tests/bug60494.phpt
+++ b/ext/iconv/tests/bug60494.phpt
@@ -10,7 +10,6 @@ var_dump(iconv_mime_decode('ä'));
var_dump(iconv_mime_decode('ö'));
var_dump(iconv_mime_decode('ß'));
?>
-===DONE===
--EXPECTF--
Notice: iconv_mime_decode(): Detected an illegal character in input string in %s on line %d
bool(false)
@@ -20,4 +19,3 @@ bool(false)
Notice: iconv_mime_decode(): Detected an illegal character in input string in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/iconv/tests/bug63839.phpt b/ext/iconv/tests/bug63839.phpt
index 22f601ee59..e137a0cb4b 100644
--- a/ext/iconv/tests/bug63839.phpt
+++ b/ext/iconv/tests/bug63839.phpt
@@ -13,7 +13,7 @@ Date: Sat, 22 Dec 2012
Message-ID: <006f01cde00e$d9f79da0$8de6d8e0>
MIME-Version: 1.0
Content-Type: multipart/alternative;
- boundary="----=_NextPart_000_0070_01CDE03C.F3AFD9A0"
+ boundary="----=_NextPart_000_0070_01CDE03C.F3AFD9A0"
X-Mailer: Microsoft Office Outlook 12.0
Thread-Index: Ac3gDtcH2huHjzYcQVmFJPPoWjJogA==
Content-Language: en-us
@@ -22,7 +22,6 @@ Content-Language: en-us
var_dump(iconv_mime_decode_headers($headers, ICONV_MIME_DECODE_CONTINUE_ON_ERROR));
var_dump(iconv_mime_decode_headers($headers, ICONV_MIME_DECODE_STRICT));
?>
-===DONE===
--EXPECT--
array(10) {
["From"]=>
@@ -68,4 +67,3 @@ array(10) {
["Content-Language"]=>
string(5) "en-us"
}
-===DONE===
diff --git a/ext/iconv/tests/bug66828.phpt b/ext/iconv/tests/bug66828.phpt
index 9914b41b14..1d6f47dc75 100644
--- a/ext/iconv/tests/bug66828.phpt
+++ b/ext/iconv/tests/bug66828.phpt
@@ -15,7 +15,5 @@ $preferences = array(
);
var_dump(iconv_mime_encode("Subject", "Test Test Test Test Test Test Test Test", $preferences));
?>
-===DONE===
--EXPECT--
string(74) "Subject: =?UTF-8?Q?Test=20Test=20Test=20Test=20Test=20Test=20Test=20Test?="
-===DONE===
diff --git a/ext/iconv/tests/bug68180.phpt b/ext/iconv/tests/bug68180.phpt
index 3442629235..a6d64f22ce 100644
--- a/ext/iconv/tests/bug68180.phpt
+++ b/ext/iconv/tests/bug68180.phpt
@@ -10,7 +10,5 @@ $original = "=?UTF-8?Q?=E3=80=8E=E3=80=90=E5=A4=96=E8=B3=87=E7=B3=BB=E6=88=A6=E7
$decoded = iconv_mime_decode($original, ICONV_MIME_DECODE_STRICT, 'utf-8');
var_dump($decoded);
?>
-===DONE===
--EXPECT--
string(183) "『ã€å¤–資系戦略コンサルãŒé›†çµã€‘トップコンサルタントã¨è©±ã›ã‚‹ã‚³ãƒ³ã‚µãƒ«æ¥­ç•Œç ”究セミナーã€ã¸ã®ã‚¨ãƒ³ãƒˆãƒªãƒ¼ã‚ã‚ŠãŒã¨ã†ã”ã–ã„ã¾ã—ãŸã€‚"
-===DONE===
diff --git a/ext/iconv/tests/bug76249.phpt b/ext/iconv/tests/bug76249.phpt
index 25bbf2a41f..9d8a0f3e9f 100644
--- a/ext/iconv/tests/bug76249.phpt
+++ b/ext/iconv/tests/bug76249.phpt
@@ -8,7 +8,7 @@ $fh = fopen('php://memory', 'rw');
fwrite($fh, "abc");
rewind($fh);
if (false === @stream_filter_append($fh, 'convert.iconv.ucs-2/utf8//IGNORE', STREAM_FILTER_READ, [])) {
- stream_filter_append($fh, 'convert.iconv.ucs-2/utf-8//IGNORE', STREAM_FILTER_READ, []);
+ stream_filter_append($fh, 'convert.iconv.ucs-2/utf-8//IGNORE', STREAM_FILTER_READ, []);
}
var_dump(stream_get_contents($fh));
?>
diff --git a/ext/iconv/tests/bug77147.phpt b/ext/iconv/tests/bug77147.phpt
index 839f8972e3..4f091d3ede 100644
--- a/ext/iconv/tests/bug77147.phpt
+++ b/ext/iconv/tests/bug77147.phpt
@@ -12,10 +12,8 @@ EOF;
$headers = iconv_mime_decode_headers($string, ICONV_MIME_DECODE_CONTINUE_ON_ERROR);
var_dump($headers);
?>
-===DONE===
--EXPECT--
array(1) {
["Feedback-ID"]=>
string(86) "014a93e3-1f5e-4df6-b347-6b59f0f746b8:b5891053-55d1-45bc-a0b5-47a7a9b59687:email:epslh1"
}
-===DONE===
diff --git a/ext/iconv/tests/eucjp2iso2022jp.phpt b/ext/iconv/tests/eucjp2iso2022jp.phpt
index 6700ac9197..aacdc238c6 100644
--- a/ext/iconv/tests/eucjp2iso2022jp.phpt
+++ b/ext/iconv/tests/eucjp2iso2022jp.phpt
@@ -9,11 +9,11 @@ error_reporting=2039
/* charset=EUC-JP */
function hexdump($str) {
- $len = strlen($str);
- for ($i = 0; $i < $len; ++$i) {
- printf("%02x", ord($str{$i}));
- }
- print "\n";
+ $len = strlen($str);
+ for ($i = 0; $i < $len; ++$i) {
+ printf("%02x", ord($str{$i}));
+ }
+ print "\n";
}
$str = str_repeat("ÆüËܸì¥Æ¥­¥¹¥È¤È English text", 30);
diff --git a/ext/iconv/tests/iconv003.phpt b/ext/iconv/tests/iconv003.phpt
index 690c1569f9..94ed39f3f6 100644
--- a/ext/iconv/tests/iconv003.phpt
+++ b/ext/iconv/tests/iconv003.phpt
@@ -5,9 +5,9 @@ iconv() test 3
--FILE--
<?php
for ($i = 0; $i < 3; ++$i) {
- if (@iconv('blah', 'blah', 'blah') != '') {
- die("failed\n");
- }
+ if (@iconv('blah', 'blah', 'blah') != '') {
+ die("failed\n");
+ }
}
echo "success\n";
?>
diff --git a/ext/iconv/tests/iconv_default_charset.phpt b/ext/iconv/tests/iconv_default_charset.phpt
index 4b44c1266e..e0874820b2 100644
--- a/ext/iconv/tests/iconv_default_charset.phpt
+++ b/ext/iconv/tests/iconv_default_charset.phpt
@@ -20,34 +20,34 @@ echo "*** Testing default_charset handling ***\n";
echo "--- Get php.ini values ---\n";
var_dump(ini_get('default_charset'),
- ini_get('internal_encoding'),
- ini_get('input_encoding'),
- ini_get('output_encoding'),
- ini_get('iconv.internal_encoding'),
- ini_get('iconv.input_encoding'),
- ini_get('iconv.output_encoding'));
+ ini_get('internal_encoding'),
+ ini_get('input_encoding'),
+ ini_get('output_encoding'),
+ ini_get('iconv.internal_encoding'),
+ ini_get('iconv.input_encoding'),
+ ini_get('iconv.output_encoding'));
echo "\n--- Altering encodings ---\n";
var_dump(ini_set('default_charset', 'ISO-8859-1'));
echo "\n--- results of alterations ---\n";
var_dump(ini_get('default_charset'),
- ini_get('internal_encoding'),
- ini_get('input_encoding'),
- ini_get('output_encoding'),
- ini_get('iconv.internal_encoding'),
- ini_get('iconv.input_encoding'),
- ini_get('iconv.output_encoding'));
+ ini_get('internal_encoding'),
+ ini_get('input_encoding'),
+ ini_get('output_encoding'),
+ ini_get('iconv.internal_encoding'),
+ ini_get('iconv.input_encoding'),
+ ini_get('iconv.output_encoding'));
/*
echo "\n--- Altering encodings ---\n";
var_dump(ini_set('default_charset', 'ISO-8859-1'),
- ini_set('internal_encoding'),
- ini_set('input_encoding'),
- ini_set('output_encoding'),
- ini_set('iconv.internal_encoding'),
- ini_set('iconv.input_encoding'),
- ini_set('iconv.output_encoding'));
+ ini_set('internal_encoding'),
+ ini_set('input_encoding'),
+ ini_set('output_encoding'),
+ ini_set('iconv.internal_encoding'),
+ ini_set('iconv.input_encoding'),
+ ini_set('iconv.output_encoding'));
*/
echo "Done";
diff --git a/ext/iconv/tests/iconv_mime_decode.phpt b/ext/iconv/tests/iconv_mime_decode.phpt
index c5b76f3ce9..35144b5707 100644
--- a/ext/iconv/tests/iconv_mime_decode.phpt
+++ b/ext/iconv/tests/iconv_mime_decode.phpt
@@ -6,41 +6,41 @@ iconv_mime_decode()
iconv.internal_charset=iso-8859-1
--FILE--
<?php
-function my_error_handler($errno, $errmsg, $filename, $linenum, $vars)
+function my_error_handler($errno, $errmsg, $filename, $linenum)
{
- echo "$errno: $errmsg\n";
+ echo "$errno: $errmsg\n";
}
set_error_handler('my_error_handler');
function do_single_test($header)
{
- global $mode;
+ global $mode;
- $result = iconv_mime_decode($header, $mode, "UTF-8");
- printf("(%d) \"%s\"\n", iconv_strlen($result, "UTF-8"), $result);
+ $result = iconv_mime_decode($header, $mode, "UTF-8");
+ printf("(%d) \"%s\"\n", iconv_strlen($result, "UTF-8"), $result);
}
function do_regression_test()
{
- do_single_test(<<< HERE
+ do_single_test(<<< HERE
Subject: =?ISO-8859-1?Q?Pr=FCfung?=
- =?ISO-8859-1*de_DE?Q?Pr=FCfung?=\t
- =?ISO-8859-2?Q?k=F9=D4=F1=D3let?=
+ =?ISO-8859-1*de_DE?Q?Pr=FCfung?=\t
+ =?ISO-8859-2?Q?k=F9=D4=F1=D3let?=
HERE
);
- do_single_test(<<< HERE
+ do_single_test(<<< HERE
Subject: =?ISO-8859-1?Q?Pr=FCfung?= =?ISO-8859-1*de_DE?Q?=20Pr=FCfung?= \t =?ISO-8859-2?Q?k=F9=D4=F1=D3let?=
HERE
);
- do_single_test(<<< HERE
+ do_single_test(<<< HERE
Subject: =?ISO-8859-1?Q?Pr=FCfung?==?ISO-8859-1*de_DE?Q?Pr=FCfung?==?ISO-8859-2?Q?k=F9=D4=F1=D3let?=
HERE
);
- do_single_test(<<< HERE
+ do_single_test(<<< HERE
Subject: =?ISO-8859-1?Q?Pr=FCfung?= =?ISO-8859-1*de_DE?Q?Pr=FCfung?? =?ISO-8859-2?X?k=F9=D4=F1=D3let?=
HERE
);
- do_single_test(<<< HERE
+ do_single_test(<<< HERE
From: =?ISO-2022-JP?B?GyRCJTUbKEI=?=
=?ISO-2022-JP?B?GyRCJXMlVxsoQg==?=
=?ISO-2022-JP?B?GyRCJWtKOBsoQg==?=
diff --git a/ext/iconv/tests/iconv_mime_decode_headers.phpt b/ext/iconv/tests/iconv_mime_decode_headers.phpt
index 6a16009ca3..0c418e559d 100644
--- a/ext/iconv/tests/iconv_mime_decode_headers.phpt
+++ b/ext/iconv/tests/iconv_mime_decode_headers.phpt
@@ -8,7 +8,7 @@ iconv.internal_charset=iso-8859-1
<?php
$headers = <<<HERE
Return-Path: <internals-return-5651-***=***.example.com@lists.php.net>
-Received: from pb1.pair.com (pb1.pair.com [16.92.131.4]) by ***.example.com
+Received: from pb1.pair.com (pb1.pair.com [16.92.131.4]) by ***.example.com
(8.12.10/8.12.10/1970-09-30) with SMTP id hALLmpea023899 for
<***@***.example.com>; Sat, 22 Jan 1970 06:48:51 +0900 (JST)
(envelope-from
@@ -25,7 +25,7 @@ Delivered-To: ezmlm-scan-internals@lists.php.net
Delivered-To: ezmlm-internals@lists.php.net
Date: Thu, 1 Jan 1970 00:00:00 -0000 (GMT)
From: *** *** *** <***@***.example.com>
-X-X-Sender: ***@***.example.com
+X-X-Sender: ***@***.example.com
To: internals@lists.php.net
Message-Id: <Pine.LNX.4.58.************@***.example.com>
MIME-Version: 1.0
diff --git a/ext/iconv/tests/iconv_mime_encode.phpt b/ext/iconv/tests/iconv_mime_encode.phpt
index bd090e4d50..6f4ba1c7a9 100644
--- a/ext/iconv/tests/iconv_mime_encode.phpt
+++ b/ext/iconv/tests/iconv_mime_encode.phpt
@@ -6,29 +6,29 @@ iconv_mime_encode()
iconv.internal_charset=iso-8859-1
--FILE--
<?php
-function my_error_handler($errno, $errmsg, $filename, $linenum, $vars)
+function my_error_handler($errno, $errmsg, $filename, $linenum)
{
- echo "$errno: $errmsg\n";
+ echo "$errno: $errmsg\n";
}
set_error_handler('my_error_handler');
$preference = array(
- "scheme" => "B",
- "output-charset" => "ISO-2022-JP",
- "input-charset" => "EUC-JP",
- "line-break-chars" => "\n"
+ "scheme" => "B",
+ "output-charset" => "ISO-2022-JP",
+ "input-charset" => "EUC-JP",
+ "line-break-chars" => "\n"
);
for ($line_len= 0; $line_len < 80; ++$line_len) {
- print "-------- line length=$line_len\n";
- $preference["line-length"] = $line_len;
- $result = iconv_mime_encode("From", "¥µ¥ó¥×¥ëʸ»úÎó¥µ¥ó¥×¥ëʸ»úÎóÆüËܸì¥Æ¥­¥¹¥È", $preference);
- var_dump($result);
- if ($result !== false) {
+ print "-------- line length=$line_len\n";
+ $preference["line-length"] = $line_len;
+ $result = iconv_mime_encode("From", "¥µ¥ó¥×¥ëʸ»úÎó¥µ¥ó¥×¥ëʸ»úÎóÆüËܸì¥Æ¥­¥¹¥È", $preference);
+ var_dump($result);
+ if ($result !== false) {
$max = max(array_map("strlen", explode("\n", $result)));
- print "-------- ";
- var_dump(($max <= $line_len));
- } else {
- print "-------- \n";
- }
+ print "-------- ";
+ var_dump(($max <= $line_len));
+ } else {
+ print "-------- \n";
+ }
}
?>
--EXPECTF--
diff --git a/ext/iconv/tests/iconv_stream_filter_delimiter.phpt b/ext/iconv/tests/iconv_stream_filter_delimiter.phpt
index 968cfcb606..e08ceeb69f 100644
--- a/ext/iconv/tests/iconv_stream_filter_delimiter.phpt
+++ b/ext/iconv/tests/iconv_stream_filter_delimiter.phpt
@@ -44,7 +44,7 @@ string(20) "a4b3a4f3a4cba4c1a4cf"
string(10) "69636f6e76"
string(2) "0a"
-Warning: stream_filter_append(): unable to create or locate filter "convert.iconv.ISO-2022-JP\0EUC-JP" in %siconv_stream_filter_delimiter.php on line %d
+Warning: stream_filter_append(): Unable to create or locate filter "convert.iconv.ISO-2022-JP\0EUC-JP" in %siconv_stream_filter_delimiter.php on line %d
string(20) "1b244224332473244b24"
string(10) "41244f1b28"
string(2) "42"
diff --git a/ext/iconv/tests/iconv_strlen.phpt b/ext/iconv/tests/iconv_strlen.phpt
index 2c815f4f31..7984798f57 100644
--- a/ext/iconv/tests/iconv_strlen.phpt
+++ b/ext/iconv/tests/iconv_strlen.phpt
@@ -5,8 +5,8 @@ iconv_strlen()
--FILE--
<?php
function foo($str, $charset) {
- var_dump(strlen($str));
- var_dump(iconv_strlen($str, $charset));
+ var_dump(strlen($str));
+ var_dump(iconv_strlen($str, $charset));
}
foo("abc", "ASCII");
diff --git a/ext/iconv/tests/iconv_strlen_basic.phpt b/ext/iconv/tests/iconv_strlen_basic.phpt
index 7e1bec9e73..c81dbd3e60 100644
--- a/ext/iconv/tests/iconv_strlen_basic.phpt
+++ b/ext/iconv/tests/iconv_strlen_basic.phpt
@@ -28,7 +28,6 @@ var_dump(iconv_strlen($string_ascii));
echo "\n-- Multibyte String --\n";
var_dump(iconv_strlen($string_mb, 'UTF-8'));
?>
-===DONE===
--EXPECT--
*** Testing iconv_strlen() : basic functionality***
@@ -37,4 +36,3 @@ int(7)
-- Multibyte String --
int(21)
-===DONE===
diff --git a/ext/iconv/tests/iconv_strlen_error2.phpt b/ext/iconv/tests/iconv_strlen_error2.phpt
index 973efecb35..efcca8b79c 100644
--- a/ext/iconv/tests/iconv_strlen_error2.phpt
+++ b/ext/iconv/tests/iconv_strlen_error2.phpt
@@ -25,10 +25,8 @@ $encoding = 'unknown-encoding';
var_dump(iconv_strlen($string, $encoding));
?>
-===DONE===
--EXPECTF--
*** Testing iconv_strlen() : error ***
Notice: iconv_strlen(): Wrong charset, conversion from `unknown-encoding' to `UCS-4LE' is not allowed in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/iconv/tests/iconv_strpos.phpt b/ext/iconv/tests/iconv_strpos.phpt
index 28e3fe2320..860ecfc471 100644
--- a/ext/iconv/tests/iconv_strpos.phpt
+++ b/ext/iconv/tests/iconv_strpos.phpt
@@ -6,22 +6,21 @@ iconv_strpos()
iconv.internal_charset=ISO-8859-1
--FILE--
<?php
-function my_error_handler($errno, $errmsg, $filename, $linenum, $vars)
-{
- echo "$errno: $errmsg\n";
-}
-set_error_handler('my_error_handler');
function foo($haystk, $needle, $offset, $to_charset = false, $from_charset = false)
{
- if ($from_charset !== false) {
- $haystk = iconv($from_charset, $to_charset, $haystk);
- }
- var_dump(strpos($haystk, $needle, $offset));
- if ($to_charset !== false) {
- var_dump(iconv_strpos($haystk, $needle, $offset, $to_charset));
- } else {
- var_dump(iconv_strpos($haystk, $needle, $offset));
- }
+ if ($from_charset !== false) {
+ $haystk = iconv($from_charset, $to_charset, $haystk);
+ }
+ try {
+ var_dump(strpos($haystk, $needle, $offset));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+ if ($to_charset !== false) {
+ var_dump(iconv_strpos($haystk, $needle, $offset, $to_charset));
+ } else {
+ var_dump(iconv_strpos($haystk, $needle, $offset));
+ }
}
foo("abecdbcdabef", "bcd", -1);
foo("abecdbcdabef", "bcd", -7);
@@ -42,8 +41,7 @@ bool(false)
bool(false)
int(5)
int(5)
-2: %s
-bool(false)
+Offset not contained in string
bool(false)
int(7)
int(7)
diff --git a/ext/iconv/tests/iconv_strpos_variation5.phpt b/ext/iconv/tests/iconv_strpos_variation5.phpt
index 1daedd146d..f89307b03a 100644
--- a/ext/iconv/tests/iconv_strpos_variation5.phpt
+++ b/ext/iconv/tests/iconv_strpos_variation5.phpt
@@ -35,11 +35,11 @@ $needle_mb = base64_decode('44CC');
* 60 is larger than *BYTE* count for $string_mb
*/
for ($i = -30; $i <= 60; $i += 10) {
- echo "\n**-- Offset is: $i --**\n";
- echo "-- ASCII String --\n";
- var_dump(iconv_strpos($string_ascii, $needle_ascii, $i));
- echo "--Multibyte String --\n";
- var_dump(iconv_strpos($string_mb, $needle_mb, $i, 'UTF-8'));
+ echo "\n**-- Offset is: $i --**\n";
+ echo "-- ASCII String --\n";
+ var_dump(iconv_strpos($string_ascii, $needle_ascii, $i));
+ echo "--Multibyte String --\n";
+ var_dump(iconv_strpos($string_mb, $needle_mb, $i, 'UTF-8'));
}
echo "Done";
diff --git a/ext/iconv/tests/iconv_strrpos.phpt b/ext/iconv/tests/iconv_strrpos.phpt
index ee977f2c31..1e5b5fb960 100644
--- a/ext/iconv/tests/iconv_strrpos.phpt
+++ b/ext/iconv/tests/iconv_strrpos.phpt
@@ -6,31 +6,31 @@ iconv_strrpos()
iconv.internal_charset=ISO-8859-1
--FILE--
<?php
-function my_error_handler($errno, $errmsg, $filename, $linenum, $vars)
+function my_error_handler($errno, $errmsg, $filename, $linenum)
{
- echo "$errno: $errmsg\n";
+ echo "$errno: $errmsg\n";
}
set_error_handler('my_error_handler');
function foo($haystk, $needle, $to_charset = false, $from_charset = false)
{
- if ($from_charset !== false) {
- $haystk = iconv($from_charset, $to_charset, $haystk);
- }
- if ($to_charset !== false) {
- var_dump(iconv_strlen($haystk, $to_charset));
- var_dump(iconv_strrpos($haystk, $needle, $to_charset));
- } else {
- var_dump(iconv_strlen($haystk));
- var_dump(iconv_strrpos($haystk, $needle));
- }
+ if ($from_charset !== false) {
+ $haystk = iconv($from_charset, $to_charset, $haystk);
+ }
+ if ($to_charset !== false) {
+ var_dump(iconv_strlen($haystk, $to_charset));
+ var_dump(iconv_strrpos($haystk, $needle, $to_charset));
+ } else {
+ var_dump(iconv_strlen($haystk));
+ var_dump(iconv_strrpos($haystk, $needle));
+ }
}
foo("abecdbcdabcdef", "bcd");
foo(str_repeat("abcab", 60)."abcdb".str_repeat("adabc", 60), "abcd");
foo(str_repeat("¤¢¤¤¤¦¤¨¤ª", 30)."¤¤¤¦¤ª¤¨¤¢".str_repeat("¤¢¤¤¤¨¤ª¤¦", 30), "¤¦¤ª", "EUC-JP");
for ($i = 0; $i <=6; ++$i) {
- $str = str_repeat("¤¢¤¤¤¦¤¨¤ª", 60).str_repeat('$', $i).str_repeat("¤¢¤¤¤¨¤ª¤¦", 60);
- foo($str, '$', "ISO-2022-JP", "EUC-JP");
+ $str = str_repeat("¤¢¤¤¤¦¤¨¤ª", 60).str_repeat('$', $i).str_repeat("¤¢¤¤¤¨¤ª¤¦", 60);
+ foo($str, '$', "ISO-2022-JP", "EUC-JP");
}
var_dump(iconv_strrpos("string", ""));
diff --git a/ext/iconv/tests/iconv_substr.phpt b/ext/iconv/tests/iconv_substr.phpt
index 6ca545b2ea..1d029520a4 100644
--- a/ext/iconv/tests/iconv_substr.phpt
+++ b/ext/iconv/tests/iconv_substr.phpt
@@ -7,26 +7,26 @@ iconv.internal_charset=ISO-8859-1
--FILE--
<?php
function hexdump($str) {
- $len = strlen($str);
- for ($i = 0; $i < $len; ++$i) {
- printf("%02x", ord($str[$i]));
- }
- print "\n";
+ $len = strlen($str);
+ for ($i = 0; $i < $len; ++$i) {
+ printf("%02x", ord($str[$i]));
+ }
+ print "\n";
}
function foo($str, $offset, $len, $charset) {
- hexdump(substr($str, $offset, $len));
- hexdump(iconv_substr($str, $offset, $len, $charset));
+ hexdump(substr($str, $offset, $len));
+ hexdump(iconv_substr($str, $offset, $len, $charset));
}
function bar($str, $offset, $len = false) {
- if (is_bool($len)) {
- var_dump(substr($str, $offset));
- var_dump(iconv_substr($str, $offset));
- } else {
- var_dump(substr($str, $offset, $len));
- var_dump(iconv_substr($str, $offset, $len));
- }
+ if (is_bool($len)) {
+ var_dump(substr($str, $offset));
+ var_dump(iconv_substr($str, $offset));
+ } else {
+ var_dump(substr($str, $offset, $len));
+ var_dump(iconv_substr($str, $offset, $len));
+ }
}
foo("abcdefghijklmnopqrstuvwxyz", 5, 7, "ASCII");
@@ -34,6 +34,7 @@ foo("¤¢¤¤¤¦¤¨¤ª¤«¤­¤¯¤±¤³¤µ¤·¤¹", 5, 7, "EUC-JP");
bar("This is a test", 100000);
bar("This is a test", 0, 100000);
bar("This is a test", -3);
+bar("This is a test", -3, null);
bar("This is a test", 0, -9);
bar("This is a test", 0, -100000);
bar("This is a test", -9, -100000);
@@ -50,6 +51,8 @@ string(14) "This is a test"
string(14) "This is a test"
string(3) "est"
string(3) "est"
+string(3) "est"
+string(3) "est"
string(5) "This "
string(5) "This "
bool(false)
diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c
index b5f12f6eee..d539f6fbcf 100644
--- a/ext/imap/php_imap.c
+++ b/ext/imap/php_imap.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -46,6 +44,7 @@
#undef ERROR
#endif
#include "php_imap.h"
+#include "php_imap_arginfo.h"
#include <time.h>
#include <stdio.h>
@@ -97,373 +96,6 @@ void *fs_get(size_t size);
ZEND_DECLARE_MODULE_GLOBALS(imap)
static PHP_GINIT_FUNCTION(imap);
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_open, 0, 0, 3)
- ZEND_ARG_INFO(0, mailbox)
- ZEND_ARG_INFO(0, user)
- ZEND_ARG_INFO(0, password)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, n_retries)
- ZEND_ARG_INFO(0, params)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_reopen, 0, 0, 2)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, mailbox)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, n_retries)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_append, 0, 0, 3)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, folder)
- ZEND_ARG_INFO(0, message)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, date)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_num_msg, 0, 0, 1)
- ZEND_ARG_INFO(0, stream_id)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_ping, 0, 0, 1)
- ZEND_ARG_INFO(0, stream_id)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_num_recent, 0, 0, 1)
- ZEND_ARG_INFO(0, stream_id)
-ZEND_END_ARG_INFO()
-
-#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_get_quota, 0, 0, 2)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, qroot)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_get_quotaroot, 0, 0, 2)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, mbox)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_set_quota, 0, 0, 3)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, qroot)
- ZEND_ARG_INFO(0, mailbox_size)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_setacl, 0, 0, 4)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, mailbox)
- ZEND_ARG_INFO(0, id)
- ZEND_ARG_INFO(0, rights)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_getacl, 0, 0, 2)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, mailbox)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_expunge, 0, 0, 1)
- ZEND_ARG_INFO(0, stream_id)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_gc, 0, 0, 1)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_close, 0, 0, 1)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_headers, 0, 0, 1)
- ZEND_ARG_INFO(0, stream_id)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_body, 0, 0, 2)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, msg_no)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_mail_copy, 0, 0, 3)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, msglist)
- ZEND_ARG_INFO(0, mailbox)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_mail_move, 0, 0, 3)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, sequence)
- ZEND_ARG_INFO(0, mailbox)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_createmailbox, 0, 0, 2)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, mailbox)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_renamemailbox, 0, 0, 3)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, old_name)
- ZEND_ARG_INFO(0, new_name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_deletemailbox, 0, 0, 2)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, mailbox)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_list, 0, 0, 3)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, ref)
- ZEND_ARG_INFO(0, pattern)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_getmailboxes, 0, 0, 3)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, ref)
- ZEND_ARG_INFO(0, pattern)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_listscan, 0, 0, 4)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, ref)
- ZEND_ARG_INFO(0, pattern)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_check, 0, 0, 1)
- ZEND_ARG_INFO(0, stream_id)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_delete, 0, 0, 2)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, msg_no)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_undelete, 0, 0, 2)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, msg_no)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_headerinfo, 0, 0, 2)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, msg_no)
- ZEND_ARG_INFO(0, from_length)
- ZEND_ARG_INFO(0, subject_length)
- ZEND_ARG_INFO(0, default_host)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_rfc822_parse_headers, 0, 0, 1)
- ZEND_ARG_INFO(0, headers)
- ZEND_ARG_INFO(0, default_host)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_lsub, 0, 0, 3)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, ref)
- ZEND_ARG_INFO(0, pattern)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_getsubscribed, 0, 0, 3)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, ref)
- ZEND_ARG_INFO(0, pattern)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_subscribe, 0, 0, 2)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, mailbox)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_unsubscribe, 0, 0, 2)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, mailbox)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_fetchstructure, 0, 0, 2)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, msg_no)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_fetchbody, 0, 0, 3)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, msg_no)
- ZEND_ARG_INFO(0, section)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_savebody, 0, 0, 3)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, file)
- ZEND_ARG_INFO(0, msg_no)
- ZEND_ARG_INFO(0, section)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_base64, 0, 0, 1)
- ZEND_ARG_INFO(0, text)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_qprint, 0, 0, 1)
- ZEND_ARG_INFO(0, text)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_8bit, 0, 0, 1)
- ZEND_ARG_INFO(0, text)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_binary, 0, 0, 1)
- ZEND_ARG_INFO(0, text)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_mailboxmsginfo, 0, 0, 1)
- ZEND_ARG_INFO(0, stream_id)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_rfc822_write_address, 0, 0, 3)
- ZEND_ARG_INFO(0, mailbox)
- ZEND_ARG_INFO(0, host)
- ZEND_ARG_INFO(0, personal)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_rfc822_parse_adrlist, 0, 0, 2)
- ZEND_ARG_INFO(0, address_string)
- ZEND_ARG_INFO(0, default_host)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_utf8, 0, 0, 1)
- ZEND_ARG_INFO(0, mime_encoded_text)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_utf7_decode, 0, 0, 1)
- ZEND_ARG_INFO(0, buf)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_utf7_encode, 0, 0, 1)
- ZEND_ARG_INFO(0, buf)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_IMAP_MUTF7
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_utf8_to_mutf7, 0, 0, 1)
- ZEND_ARG_INFO(0, in)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_mutf7_to_utf8, 0, 0, 1)
- ZEND_ARG_INFO(0, in)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_setflag_full, 0, 0, 3)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, sequence)
- ZEND_ARG_INFO(0, flag)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_clearflag_full, 0, 0, 3)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, sequence)
- ZEND_ARG_INFO(0, flag)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_sort, 0, 0, 3)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, criteria)
- ZEND_ARG_INFO(0, reverse)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, search_criteria)
- ZEND_ARG_INFO(0, charset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_fetchheader, 0, 0, 2)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, msg_no)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_uid, 0, 0, 2)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, msg_no)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_msgno, 0, 0, 2)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, unique_msg_id)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_status, 0, 0, 3)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, mailbox)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_bodystruct, 0, 0, 3)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, msg_no)
- ZEND_ARG_INFO(0, section)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_fetch_overview, 0, 0, 2)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, sequence)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_mail_compose, 0, 0, 2)
- ZEND_ARG_INFO(0, envelope)
- ZEND_ARG_INFO(0, body)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_mail, 0, 0, 3)
- ZEND_ARG_INFO(0, to)
- ZEND_ARG_INFO(0, subject)
- ZEND_ARG_INFO(0, message)
- ZEND_ARG_INFO(0, additional_headers)
- ZEND_ARG_INFO(0, cc)
- ZEND_ARG_INFO(0, bcc)
- ZEND_ARG_INFO(0, rpath)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_search, 0, 0, 2)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, criteria)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, charset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imap_alerts, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imap_errors, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_imap_last_error, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_mime_header_decode, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_thread, 0, 0, 1)
- ZEND_ARG_INFO(0, stream_id)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_timeout, 0, 0, 1)
- ZEND_ARG_INFO(0, timeout_type)
- ZEND_ARG_INFO(0, timeout)
-ZEND_END_ARG_INFO()
-/* }}} */
/* {{{ imap_functions[]
*/
@@ -481,7 +113,7 @@ static const zend_function_entry imap_functions[] = {
PHP_FE(imap_body, arginfo_imap_body)
PHP_FE(imap_bodystruct, arginfo_imap_bodystruct)
PHP_FE(imap_fetchbody, arginfo_imap_fetchbody)
- PHP_FE(imap_fetchmime, arginfo_imap_fetchbody)
+ PHP_FE(imap_fetchmime, arginfo_imap_fetchmime)
PHP_FE(imap_savebody, arginfo_imap_savebody)
PHP_FE(imap_fetchheader, arginfo_imap_fetchheader)
PHP_FE(imap_fetchstructure, arginfo_imap_fetchstructure)
@@ -539,13 +171,13 @@ static const zend_function_entry imap_functions[] = {
#endif
PHP_FE(imap_mail, arginfo_imap_mail)
+ PHP_FE(imap_getsubscribed, arginfo_imap_getsubscribed)
+ PHP_FE(imap_getmailboxes, arginfo_imap_getmailboxes)
PHP_FALIAS(imap_header, imap_headerinfo, arginfo_imap_headerinfo)
PHP_FALIAS(imap_listmailbox, imap_list, arginfo_imap_list)
- PHP_FALIAS(imap_getmailboxes, imap_list_full, arginfo_imap_getmailboxes)
PHP_FALIAS(imap_scanmailbox, imap_listscan, arginfo_imap_listscan)
PHP_FALIAS(imap_listsubscribed, imap_lsub, arginfo_imap_lsub)
- PHP_FALIAS(imap_getsubscribed, imap_lsub_full, arginfo_imap_getsubscribed)
PHP_FALIAS(imap_fetchtext, imap_body, arginfo_imap_body)
PHP_FALIAS(imap_scan, imap_listscan, arginfo_imap_listscan)
PHP_FALIAS(imap_create, imap_createmailbox, arginfo_imap_createmailbox)
@@ -1176,7 +808,7 @@ static void php_imap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
if (zend_parse_parameters(argc, "PSS|lla", &mailbox, &user,
&passwd, &flags, &retries, &params) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (argc >= 4) {
@@ -1294,11 +926,11 @@ PHP_FUNCTION(imap_reopen)
long cl_flags=NIL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rS|ll", &streamind, &mailbox, &options, &retries) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (options) {
@@ -1339,7 +971,7 @@ PHP_FUNCTION(imap_append)
STRING st;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rSS|SS", &streamind, &folder, &message, &flags, &internal_date) == FAILURE) {
- return;
+ RETURN_THROWS();
}
@@ -1360,13 +992,13 @@ PHP_FUNCTION(imap_append)
0, Z_L(0), Z_L(0));
if (!Z_LVAL_P(return_value)) {
- php_error_docref(NULL, E_WARNING, "internal date not correctly formatted");
+ php_error_docref(NULL, E_WARNING, "Internal date not correctly formatted");
internal_date = NULL;
}
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
INIT (&st, mail_string, (void *) ZSTR_VAL(message), ZSTR_LEN(message));
@@ -1387,11 +1019,11 @@ PHP_FUNCTION(imap_num_msg)
pils *imap_le_struct;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &streamind) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
RETURN_LONG(imap_le_struct->imap_stream->nmsgs);
@@ -1406,11 +1038,11 @@ PHP_FUNCTION(imap_ping)
pils *imap_le_struct;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &streamind) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
RETURN_BOOL(mail_ping(imap_le_struct->imap_stream));
@@ -1425,11 +1057,11 @@ PHP_FUNCTION(imap_num_recent)
pils *imap_le_struct;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &streamind) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
RETURN_LONG(imap_le_struct->imap_stream->recent);
@@ -1446,11 +1078,11 @@ PHP_FUNCTION(imap_get_quota)
pils *imap_le_struct;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rS", &streamind, &qroot) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
array_init(return_value);
@@ -1459,7 +1091,7 @@ PHP_FUNCTION(imap_get_quota)
/* set the callback for the GET_QUOTA function */
mail_parameters(NIL, SET_QUOTA, (void *) mail_getquota);
if (!imap_getquota(imap_le_struct->imap_stream, ZSTR_VAL(qroot))) {
- php_error_docref(NULL, E_WARNING, "c-client imap_getquota failed");
+ php_error_docref(NULL, E_WARNING, "C-client imap_getquota failed");
zend_array_destroy(Z_ARR_P(return_value));
RETURN_FALSE;
}
@@ -1475,11 +1107,11 @@ PHP_FUNCTION(imap_get_quotaroot)
pils *imap_le_struct;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rS", &streamind, &mbox) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
array_init(return_value);
@@ -1488,7 +1120,7 @@ PHP_FUNCTION(imap_get_quotaroot)
/* set the callback for the GET_QUOTAROOT function */
mail_parameters(NIL, SET_QUOTA, (void *) mail_getquota);
if (!imap_getquotaroot(imap_le_struct->imap_stream, ZSTR_VAL(mbox))) {
- php_error_docref(NULL, E_WARNING, "c-client imap_getquotaroot failed");
+ php_error_docref(NULL, E_WARNING, "C-client imap_getquotaroot failed");
zend_array_destroy(Z_ARR_P(return_value));
RETURN_FALSE;
}
@@ -1506,11 +1138,11 @@ PHP_FUNCTION(imap_set_quota)
STRINGLIST limits;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rSl", &streamind, &qroot, &mailbox_size) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
limits.text.data = (unsigned char*)"STORAGE";
@@ -1530,11 +1162,11 @@ PHP_FUNCTION(imap_setacl)
pils *imap_le_struct;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rSSS", &streamind, &mailbox, &id, &rights) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
RETURN_BOOL(imap_setacl(imap_le_struct->imap_stream, ZSTR_VAL(mailbox), ZSTR_VAL(id), ZSTR_VAL(rights)));
@@ -1550,11 +1182,11 @@ PHP_FUNCTION(imap_getacl)
pils *imap_le_struct;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rS", &streamind, &mailbox) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* initializing the special array for the return values */
@@ -1583,11 +1215,11 @@ PHP_FUNCTION(imap_expunge)
pils *imap_le_struct;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &streamind) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
mail_expunge (imap_le_struct->imap_stream);
@@ -1605,16 +1237,16 @@ PHP_FUNCTION(imap_gc)
zend_long flags;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &streamind, &flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (flags && ((flags & ~(GC_TEXTS | GC_ELT | GC_ENV)) != 0)) {
- php_error_docref(NULL, E_WARNING, "invalid value for the flags parameter");
+ php_error_docref(NULL, E_WARNING, "Invalid value for the flags parameter");
RETURN_FALSE;
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
mail_gc(imap_le_struct->imap_stream, flags);
@@ -1633,11 +1265,11 @@ PHP_FUNCTION(imap_close)
int argc = ZEND_NUM_ARGS();
if (zend_parse_parameters(argc, "r|l", &streamind, &options) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (argc == 2) {
@@ -1645,7 +1277,7 @@ PHP_FUNCTION(imap_close)
/* Check that flags is exactly equal to PHP_EXPUNGE or zero */
if (flags && ((flags & ~PHP_EXPUNGE) != 0)) {
- php_error_docref(NULL, E_WARNING, "invalid value for the flags parameter");
+ php_error_docref(NULL, E_WARNING, "Invalid value for the flags parameter");
RETURN_FALSE;
}
@@ -1675,11 +1307,11 @@ PHP_FUNCTION(imap_headers)
char tmp[MAILTMPLEN];
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &streamind) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* Initialize return array */
@@ -1727,16 +1359,16 @@ PHP_FUNCTION(imap_body)
unsigned long body_len = 0;
if (zend_parse_parameters(argc, "rl|l", &streamind, &msgno, &flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (flags && ((flags & ~(FT_UID|FT_PEEK|FT_INTERNAL)) != 0)) {
- php_error_docref(NULL, E_WARNING, "invalid value for the options parameter");
+ php_error_docref(NULL, E_WARNING, "Invalid value for the options parameter");
RETURN_FALSE;
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ((argc == 3) && (flags & FT_UID)) {
@@ -1772,11 +1404,11 @@ PHP_FUNCTION(imap_mail_copy)
pils *imap_le_struct;
if (zend_parse_parameters(argc, "rSS|l", &streamind, &seq, &folder, &options) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (mail_copy_full(imap_le_struct->imap_stream, ZSTR_VAL(seq), ZSTR_VAL(folder), (argc == 4 ? options : NIL)) == T) {
@@ -1798,11 +1430,11 @@ PHP_FUNCTION(imap_mail_move)
int argc = ZEND_NUM_ARGS();
if (zend_parse_parameters(argc, "rSS|l", &streamind, &seq, &folder, &options) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (mail_copy_full(imap_le_struct->imap_stream, ZSTR_VAL(seq), ZSTR_VAL(folder), (argc == 4 ? (options | CP_MOVE) : CP_MOVE)) == T) {
@@ -1822,11 +1454,11 @@ PHP_FUNCTION(imap_createmailbox)
pils *imap_le_struct;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rS", &streamind, &folder) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (mail_create(imap_le_struct->imap_stream, ZSTR_VAL(folder)) == T) {
@@ -1846,11 +1478,11 @@ PHP_FUNCTION(imap_renamemailbox)
pils *imap_le_struct;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rSS", &streamind, &old_mailbox, &new_mailbox) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (mail_rename(imap_le_struct->imap_stream, ZSTR_VAL(old_mailbox), ZSTR_VAL(new_mailbox)) == T) {
@@ -1870,11 +1502,11 @@ PHP_FUNCTION(imap_deletemailbox)
pils *imap_le_struct;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rS", &streamind, &folder) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (mail_delete(imap_le_struct->imap_stream, ZSTR_VAL(folder)) == T) {
@@ -1895,11 +1527,11 @@ PHP_FUNCTION(imap_list)
STRINGLIST *cur=NIL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rSS", &streamind, &ref, &pat) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* set flag for normal, old mailbox list */
@@ -1926,7 +1558,7 @@ PHP_FUNCTION(imap_list)
/* {{{ proto array imap_getmailboxes(resource stream_id, string ref, string pattern)
Reads the list of mailboxes and returns a full array of objects containing name, attributes, and delimiter */
/* Author: CJH */
-PHP_FUNCTION(imap_list_full)
+PHP_FUNCTION(imap_getmailboxes)
{
zval *streamind, mboxob;
zend_string *ref, *pat;
@@ -1935,11 +1567,11 @@ PHP_FUNCTION(imap_list_full)
char *delim=NIL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rSS", &streamind, &ref, &pat) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* set flag for new, improved array of objects mailbox list */
@@ -1984,11 +1616,11 @@ PHP_FUNCTION(imap_listscan)
STRINGLIST *cur=NIL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rSSS", &streamind, &ref, &pat, &content) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
IMAPG(imap_folders) = NIL;
@@ -2018,11 +1650,11 @@ PHP_FUNCTION(imap_check)
char date[100];
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &streamind) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (mail_ping (imap_le_struct->imap_stream) == NIL) {
@@ -2053,15 +1685,15 @@ PHP_FUNCTION(imap_delete)
int argc = ZEND_NUM_ARGS();
if (zend_parse_parameters(argc, "rz|l", &streamind, &sequence, &flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (!try_convert_to_string(sequence)) {
- return;
+ RETURN_THROWS();
}
mail_setflag_full(imap_le_struct->imap_stream, Z_STRVAL_P(sequence), "\\DELETED", (argc == 3 ? flags : NIL));
@@ -2079,15 +1711,15 @@ PHP_FUNCTION(imap_undelete)
int argc = ZEND_NUM_ARGS();
if (zend_parse_parameters(argc, "rz|l", &streamind, &sequence, &flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (!try_convert_to_string(sequence)) {
- return;
+ RETURN_THROWS();
}
mail_clearflag_full(imap_le_struct->imap_stream, Z_STRVAL_P(sequence), "\\DELETED", (argc == 3 ? flags : NIL));
@@ -2109,11 +1741,11 @@ PHP_FUNCTION(imap_headerinfo)
char dummy[2000], fulladdress[MAILTMPLEN + 1];
if (zend_parse_parameters(argc, "rl|llS", &streamind, &msgno, &fromlength, &subjectlength, &defaulthost) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (argc >= 3) {
@@ -2189,7 +1821,7 @@ PHP_FUNCTION(imap_rfc822_parse_headers)
int argc = ZEND_NUM_ARGS();
if (zend_parse_parameters(argc, "S|S", &headers, &defaulthost) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (argc == 2) {
@@ -2216,11 +1848,11 @@ PHP_FUNCTION(imap_lsub)
STRINGLIST *cur=NIL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rSS", &streamind, &ref, &pat) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* set flag for normal, old mailbox list */
@@ -2246,7 +1878,7 @@ PHP_FUNCTION(imap_lsub)
/* {{{ proto array imap_getsubscribed(resource stream_id, string ref, string pattern)
Return a list of subscribed mailboxes, in the same format as imap_getmailboxes() */
/* Author: CJH */
-PHP_FUNCTION(imap_lsub_full)
+PHP_FUNCTION(imap_getsubscribed)
{
zval *streamind, mboxob;
zend_string *ref, *pat;
@@ -2255,11 +1887,11 @@ PHP_FUNCTION(imap_lsub_full)
char *delim=NIL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rSS", &streamind, &ref, &pat) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* set flag for new, improved array of objects list */
@@ -2303,11 +1935,11 @@ PHP_FUNCTION(imap_subscribe)
pils *imap_le_struct;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rS", &streamind, &folder) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (mail_subscribe(imap_le_struct->imap_stream, ZSTR_VAL(folder)) == T) {
@@ -2327,11 +1959,11 @@ PHP_FUNCTION(imap_unsubscribe)
pils *imap_le_struct;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rS", &streamind, &folder) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (mail_unsubscribe(imap_le_struct->imap_stream, ZSTR_VAL(folder)) == T) {
@@ -2353,16 +1985,16 @@ PHP_FUNCTION(imap_fetchstructure)
int msgindex, argc = ZEND_NUM_ARGS();
if (zend_parse_parameters(argc, "rl|l", &streamind, &msgno, &flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (flags && ((flags & ~FT_UID) != 0)) {
- php_error_docref(NULL, E_WARNING, "invalid value for the options parameter");
+ php_error_docref(NULL, E_WARNING, "Invalid value for the options parameter");
RETURN_FALSE;
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (msgno < 1) {
@@ -2405,16 +2037,16 @@ PHP_FUNCTION(imap_fetchbody)
int argc = ZEND_NUM_ARGS();
if (zend_parse_parameters(argc, "rlS|l", &streamind, &msgno, &sec, &flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (flags && ((flags & ~(FT_UID|FT_PEEK|FT_INTERNAL)) != 0)) {
- php_error_docref(NULL, E_WARNING, "invalid value for the options parameter");
+ php_error_docref(NULL, E_WARNING, "Invalid value for the options parameter");
RETURN_FALSE;
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (argc < 4 || !(flags & FT_UID)) {
@@ -2447,16 +2079,16 @@ PHP_FUNCTION(imap_fetchmime)
int argc = ZEND_NUM_ARGS();
if (zend_parse_parameters(argc, "rlS|l", &streamind, &msgno, &sec, &flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (flags && ((flags & ~(FT_UID|FT_PEEK|FT_INTERNAL)) != 0)) {
- php_error_docref(NULL, E_WARNING, "invalid value for the options parameter");
+ php_error_docref(NULL, E_WARNING, "Invalid value for the options parameter");
RETURN_FALSE;
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (argc < 4 || !(flags & FT_UID)) {
@@ -2487,11 +2119,11 @@ PHP_FUNCTION(imap_savebody)
zend_long msgno, flags = 0;
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "rzl|Sl", &stream, &out, &msgno, &section, &flags)) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ((imap_ptr = (pils *)zend_fetch_resource(Z_RES_P(stream), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (!imap_ptr) {
@@ -2508,7 +2140,7 @@ PHP_FUNCTION(imap_savebody)
default:
if (!try_convert_to_string(out)) {
- return;
+ RETURN_THROWS();
}
writer = php_stream_open_wrapper(Z_STRVAL_P(out), "wb", REPORT_ERRORS, NULL);
break;
@@ -2541,7 +2173,7 @@ PHP_FUNCTION(imap_base64)
unsigned long newlength;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &text) == FAILURE) {
- return;
+ RETURN_THROWS();
}
decode = (char *) rfc822_base64((unsigned char *) ZSTR_VAL(text), ZSTR_LEN(text), &newlength);
@@ -2564,7 +2196,7 @@ PHP_FUNCTION(imap_qprint)
unsigned long newlength;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &text) == FAILURE) {
- return;
+ RETURN_THROWS();
}
decode = (char *) rfc822_qprint((unsigned char *) ZSTR_VAL(text), ZSTR_LEN(text), &newlength);
@@ -2587,7 +2219,7 @@ PHP_FUNCTION(imap_8bit)
unsigned long newlength;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &text) == FAILURE) {
- return;
+ RETURN_THROWS();
}
decode = (char *) rfc822_8bit((unsigned char *) ZSTR_VAL(text), ZSTR_LEN(text), &newlength);
@@ -2610,7 +2242,7 @@ PHP_FUNCTION(imap_binary)
unsigned long newlength;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &text) == FAILURE) {
- return;
+ RETURN_THROWS();
}
decode = (char*)rfc822_binary(ZSTR_VAL(text), ZSTR_LEN(text), &newlength);
@@ -2635,11 +2267,11 @@ PHP_FUNCTION(imap_mailboxmsginfo)
zend_ulong unreadmsg = 0, deletedmsg = 0, msize = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &streamind) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* Initialize return object */
@@ -2679,7 +2311,7 @@ PHP_FUNCTION(imap_rfc822_write_address)
zend_string *string;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "SSS", &mailbox, &host, &personal) == FAILURE) {
- return;
+ RETURN_THROWS();
}
addr=mail_newaddr();
@@ -2720,7 +2352,7 @@ PHP_FUNCTION(imap_rfc822_parse_adrlist)
ENVELOPE *env;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS", &str, &defaulthost) == FAILURE) {
- return;
+ RETURN_THROWS();
}
env = mail_newenvelope();
@@ -2763,7 +2395,7 @@ PHP_FUNCTION(imap_utf8)
SIZEDTEXT src, dest;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &str) == FAILURE) {
- return;
+ RETURN_THROWS();
}
src.data = NULL;
@@ -2827,7 +2459,7 @@ PHP_FUNCTION(imap_utf7_decode)
} state;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &arg) == FAILURE) {
- return;
+ RETURN_THROWS();
}
in = (const unsigned char *) ZSTR_VAL(arg);
@@ -2966,7 +2598,7 @@ PHP_FUNCTION(imap_utf7_encode)
} state;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &arg) == FAILURE) {
- return;
+ RETURN_THROWS();
}
in = (const unsigned char *) ZSTR_VAL(arg);
@@ -3070,7 +2702,7 @@ static void php_imap_mutf7(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
unsigned char *out;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &in) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (ZSTR_LEN(in) < 1) {
@@ -3118,11 +2750,11 @@ PHP_FUNCTION(imap_setflag_full)
pils *imap_le_struct;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rSS|l", &streamind, &sequence, &flag, &flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
mail_setflag_full(imap_le_struct->imap_stream, ZSTR_VAL(sequence), ZSTR_VAL(flag), (flags ? flags : NIL));
@@ -3141,11 +2773,11 @@ PHP_FUNCTION(imap_clearflag_full)
int argc = ZEND_NUM_ARGS();
if (zend_parse_parameters(argc, "rSS|l", &streamind, &sequence, &flag, &flags) ==FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
mail_clearflag_full(imap_le_struct->imap_stream, ZSTR_VAL(sequence), ZSTR_VAL(flag), (argc == 4 ? flags : NIL));
@@ -3168,11 +2800,11 @@ PHP_FUNCTION(imap_sort)
int argc = ZEND_NUM_ARGS();
if (zend_parse_parameters(argc, "rll|lSS", &streamind, &pgm, &rev, &flags, &criteria, &charset) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (pgm > SORTSIZE) {
@@ -3224,16 +2856,16 @@ PHP_FUNCTION(imap_fetchheader)
int msgindex, argc = ZEND_NUM_ARGS();
if (zend_parse_parameters(argc, "rl|l", &streamind, &msgno, &flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (flags && ((flags & ~(FT_UID|FT_INTERNAL|FT_PREFETCHTEXT)) != 0)) {
- php_error_docref(NULL, E_WARNING, "invalid value for the options parameter");
+ php_error_docref(NULL, E_WARNING, "Invalid value for the options parameter");
RETURN_FALSE;
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ((argc == 3) && (flags & FT_UID)) {
@@ -3261,11 +2893,11 @@ PHP_FUNCTION(imap_uid)
int msgindex;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &streamind, &msgno) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
msgindex = msgno;
@@ -3287,11 +2919,11 @@ PHP_FUNCTION(imap_msgno)
pils *imap_le_struct;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &streamind, &msgno) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
RETURN_LONG(mail_msgno(imap_le_struct->imap_stream, msgno));
@@ -3308,11 +2940,11 @@ PHP_FUNCTION(imap_status)
pils *imap_le_struct;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rSl", &streamind, &mbx, &flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
object_init(return_value);
@@ -3353,11 +2985,11 @@ PHP_FUNCTION(imap_bodystruct)
BODY *body;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlS", &streamind, &msg, &section) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (!msg || msg < 1 || (unsigned) msg > imap_le_struct->imap_stream->nmsgs) {
@@ -3466,16 +3098,16 @@ PHP_FUNCTION(imap_fetch_overview)
int argc = ZEND_NUM_ARGS();
if (zend_parse_parameters(argc, "rS|l", &streamind, &sequence, &flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (flags && ((flags & ~FT_UID) != 0)) {
- php_error_docref(NULL, E_WARNING, "invalid value for the options parameter");
+ php_error_docref(NULL, E_WARNING, "Invalid value for the options parameter");
RETURN_FALSE;
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
array_init(return_value);
@@ -3556,7 +3188,7 @@ PHP_FUNCTION(imap_mail_compose)
int first;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "aa", &envelope, &body) == FAILURE) {
- return;
+ RETURN_THROWS();
}
#define PHP_RFC822_PARSE_ADRLIST(target, value) \
@@ -3828,7 +3460,7 @@ PHP_FUNCTION(imap_mail_compose)
}
if (bod && bod->type == TYPEMULTIPART && (!bod->nested.part || !bod->nested.part->next)) {
- php_error_docref(NULL, E_WARNING, "cannot generate multipart e-mail without components.");
+ php_error_docref(NULL, E_WARNING, "Cannot generate multipart e-mail without components.");
RETVAL_FALSE;
goto done;
}
@@ -4106,7 +3738,7 @@ PHP_FUNCTION(imap_mail)
if (zend_parse_parameters(argc, "SSS|SSSS", &to, &subject, &message,
&headers, &cc, &bcc, &rpath) == FAILURE) {
- return;
+ RETURN_THROWS();
}
/* To: */
@@ -4150,11 +3782,11 @@ PHP_FUNCTION(imap_search)
SEARCHPGM *pgm = NIL;
if (zend_parse_parameters(argc, "rS|lS", &streamind, &criteria, &flags, &charset) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
search_criteria = estrndup(ZSTR_VAL(criteria), ZSTR_LEN(criteria));
@@ -4193,7 +3825,7 @@ PHP_FUNCTION(imap_alerts)
STRINGLIST *cur=NIL;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (IMAPG(imap_alertstack) == NIL) {
@@ -4220,7 +3852,7 @@ PHP_FUNCTION(imap_errors)
ERRORLIST *cur=NIL;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (IMAPG(imap_errorstack) == NIL) {
@@ -4247,7 +3879,7 @@ PHP_FUNCTION(imap_last_error)
ERRORLIST *cur=NIL;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (IMAPG(imap_errorstack) == NIL) {
@@ -4276,7 +3908,7 @@ PHP_FUNCTION(imap_mime_header_decode)
unsigned long newlength;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &str) == FAILURE) {
- return;
+ RETURN_THROWS();
}
array_init(return_value);
@@ -4753,11 +4385,11 @@ PHP_FUNCTION(imap_thread)
SEARCHPGM *pgm = NIL;
if (zend_parse_parameters(argc, "r|l", &streamind, &flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((imap_le_struct = (pils *)zend_fetch_resource(Z_RES_P(streamind), "imap", le_imap)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
pgm = mail_criteria(criteria);
@@ -4788,7 +4420,7 @@ PHP_FUNCTION(imap_timeout)
int timeout_type;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l", &ttype, &timeout) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (timeout == -1) {
diff --git a/ext/imap/php_imap.h b/ext/imap/php_imap.h
index c23799976c..2019998942 100644
--- a/ext/imap/php_imap.h
+++ b/ext/imap/php_imap.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -163,10 +161,10 @@ PHP_FUNCTION(imap_fetchtext);
PHP_FUNCTION(imap_uid);
PHP_FUNCTION(imap_msgno);
PHP_FUNCTION(imap_list);
-PHP_FUNCTION(imap_list_full);
+PHP_FUNCTION(imap_getmailboxes);
PHP_FUNCTION(imap_listscan);
PHP_FUNCTION(imap_lsub);
-PHP_FUNCTION(imap_lsub_full);
+PHP_FUNCTION(imap_getsubscribed);
PHP_FUNCTION(imap_create);
PHP_FUNCTION(imap_rename);
PHP_FUNCTION(imap_status);
diff --git a/ext/imap/php_imap.stub.php b/ext/imap/php_imap.stub.php
new file mode 100644
index 0000000000..06d19318f5
--- /dev/null
+++ b/ext/imap/php_imap.stub.php
@@ -0,0 +1,240 @@
+<?php
+
+/**
+ * @return resource|false
+ */
+function imap_open(string $mailbox, string $user, string $password, int $options = 0, int $n_retries = 0, array $params = UNKNOWN) {}
+
+/**
+ * @param resource $stream_id
+ */
+function imap_reopen($stream_id, string $mailbox, int $options = 0, int $n_retries = 0): bool {}
+
+/**
+ * @param resource $stream_id
+ */
+function imap_close($stream_id, int $options = 0): bool {}
+
+/** @param resource $stream_id */
+function imap_num_msg($stream_id): int|false {}
+
+/** @param resource $stream_id */
+function imap_num_recent($stream_id): int|false {}
+
+/** @param resource $stream_id */
+function imap_headers($stream_id): array|false {}
+
+/** @param resource $stream_id */
+function imap_headerinfo($stream_id, int $msg_no, int $from_length = 0, int $subject_length = 0, string $default_host = UNKNOWN): stdClass|false {}
+
+function imap_rfc822_parse_headers(string $headers, string $default_host = 'UNKNOWN'): \stdClass {}
+
+function imap_rfc822_write_address(string $mailbox, string $host, string $personal): string|false {}
+
+function imap_rfc822_parse_adrlist(string $address_string, string $default_host): array {}
+
+/** @param resource $stream_id */
+function imap_body($stream_id, int $msg_no, int $options = 0): string|false {}
+
+/**
+ * @param resource $stream_id
+ * @return \stdClass|false
+ */
+function imap_bodystruct($stream_id, int $msg_no, string $section) {}
+
+/** @param resource $stream_id */
+function imap_fetchbody($stream_id, int $msg_no, string $section, int $options = 0): string|false {}
+
+/** @param resource $stream_id */
+function imap_fetchmime($stream_id, int $msg_no, string $section, int $options = 0): string|false {}
+
+/**
+ * @param resource $stream_id
+ * @todo: should $file be `resource|string`? it looks like it tries to accept anything?
+ */
+function imap_savebody($stream_id, $file, int $msg_no, string $section = '', int $options = 0): bool {}
+
+/** @param resource $stream_id */
+function imap_fetchheader($stream_id, int $msg_no, int $options = 0): string|false {}
+
+/** @param resource $stream_id */
+function imap_fetchstructure($stream_id, int $msg_no, int $options = 0): stdClass|false {}
+
+/**
+ * @param resource $stream_id
+ */
+function imap_gc($stream_id, int $flags): bool {}
+
+/**
+ * @param resource $stream_id
+ */
+function imap_expunge($stream_id): bool {}
+
+/**
+ * @param resource $stream_id
+ */
+function imap_delete($stream_id, string $msg_no, int $options = 0): bool {}
+
+/**
+ * @param resource $stream_id
+ */
+function imap_undelete($stream_id, string $msg_no, int $options = 0): bool {}
+
+/** @param resource $stream_id */
+function imap_check($stream_id): stdClass|false {}
+
+/** @param resource $stream_id */
+function imap_listscan($stream_id, string $ref, string $pattern, string $content): array|false {}
+
+/**
+ * @param resource $stream_id
+ */
+function imap_mail_copy($stream_id, string $msglist, string $mailbox, int $options = 0): bool {}
+
+/**
+ * @param resource $stream_id
+ */
+function imap_mail_move($stream_id, string $sequence, string $mailbox, int $options = 0): bool {}
+
+function imap_mail_compose(array $envelope, array $body): string|false {}
+
+/**
+ * @param resource $stream_id
+ */
+function imap_createmailbox($stream_id, string $mailbox): bool {}
+
+/**
+ * @param resource $stream_id
+ */
+function imap_renamemailbox($stream_id, string $old_name, string $new_name): bool {}
+
+/**
+ * @param resource $stream_id
+ */
+function imap_deletemailbox($stream_id, string $mailbox): bool {}
+
+/**
+ * @param resource $stream_id
+ */
+function imap_subscribe($stream_id, string $mailbox): bool {}
+
+/**
+ * @param resource $stream_id
+ */
+function imap_unsubscribe($stream_id, string $mailbox): bool {}
+
+/**
+ * @param resource $stream_id
+ */
+function imap_append($stream_id, string $folder, string $message, string $options = UNKNOWN, string $internal_date = UNKNOWN): bool {}
+
+/**
+ * @param resource $stream_id
+ */
+function imap_ping($stream_id): bool {}
+
+function imap_base64(string $text): string|false {}
+
+function imap_qprint(string $text): string|false {}
+
+function imap_8bit(string $text): string|false {}
+
+function imap_binary(string $text): string|false {}
+
+
+function imap_utf8(string $mime_encoded_text): string {}
+
+/**
+ * @param resource $stream_id
+ * @return \stdClass|false
+ */
+function imap_status($stream_id, string $mailbox, int $options) {}
+
+/**
+ * @param resource $stream_id
+ */
+function imap_mailboxmsginfo($stream_id): \stdClass {}
+
+/**
+ * @param resource $stream_id
+ */
+function imap_setflag_full($stream_id, string $sequence, string $flag, int $options = 0): bool {}
+
+/**
+ * @param resource $stream_id
+ */
+function imap_clearflag_full($stream_id, string $sequence, string $flag, int $options = 0): bool {}
+
+/** @param resource $stream_id */
+function imap_sort($stream_id, int $criteria, int $reverse, int $options = 0, string $search_criteria = UNKNOWN, string $charset = UNKNOWN): array|false {}
+
+
+/** @param resource $stream_id */
+function imap_uid($stream_id, int $msg_no): int|false {}
+
+/** @param resource $stream_id */
+function imap_msgno($stream_id, int $unique_msg_id): int|false {}
+
+/** @param resource $stream_id */
+function imap_list($stream_id, string $ref, string $pattern): array|false {}
+
+/** @param resource $stream_id */
+function imap_lsub($stream_id, string $ref, string $pattern): array|false {}
+
+/** @param resource $stream_id */
+function imap_getsubscribed($stream_id, string $ref, string $pattern): array|false {}
+
+/** @param resource $stream_id */
+function imap_getmailboxes($stream_id, string $ref, string $pattern): array|false {}
+
+/** @param resource $stream_id */
+function imap_fetch_overview($stream_id, string $sequence, int $options = 0): array|false {}
+
+function imap_alerts(): array|false {}
+
+function imap_errors(): array|false {}
+
+function imap_last_error(): string|false {}
+
+/** @param resource $stream_id */
+function imap_search($stream_id, string $criteria, int $options = \SE_FREE, string $charset = ''): array|false {}
+
+function imap_utf7_decode(string $buf): string|false {}
+
+function imap_utf7_encode(string $buf): string {}
+
+#ifdef HAVE_IMAP_MUTF7
+function imap_utf8_to_mutf7(string $in): string|false {}
+
+function imap_mutf7_to_utf8(string $in): string|false {}
+#endif
+
+function imap_mime_header_decode(string $str): array|false {}
+
+/** @param resource $stream_id */
+function imap_thread($stream_id, int $options = \SE_FREE): array|false {}
+
+function imap_timeout(int $timeout_type, int $timeout = -1): int|bool {}
+
+#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
+/** @param resource $stream_id */
+function imap_get_quota($stream_id, string $qroot): array|false {}
+
+/** @param resource $stream_id */
+function imap_get_quotaroot($stream_id, string $mbox): array|false {}
+
+/**
+ * @param resource $stream_id
+ */
+function imap_set_quota($stream_id, string $qroot, int $mailbox_size): bool {}
+
+/**
+ * @param resource $stream_id
+ */
+function imap_setacl($stream_id, string $mailbox, string $id, string $rights): bool {}
+
+/** @param resource $stream_id */
+function imap_getacl($stream_id, string $mailbox): array|false {}
+#endif
+
+function imap_mail(string $to, string $subject, string $message, string $additional_headers = UNKNOWN, string $cc = UNKNOWN, string $bcc = UNKNOWN, string $rpath = UNKNOWN): bool {}
diff --git a/ext/imap/php_imap_arginfo.h b/ext/imap/php_imap_arginfo.h
new file mode 100644
index 0000000000..74fb1f7afb
--- /dev/null
+++ b/ext/imap/php_imap_arginfo.h
@@ -0,0 +1,332 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_open, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, mailbox, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, user, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, n_retries, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, params, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imap_reopen, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, mailbox, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, n_retries, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imap_close, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_imap_num_msg, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, stream_id)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imap_num_recent arginfo_imap_num_msg
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_imap_headers, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, stream_id)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_imap_headerinfo, 0, 2, stdClass, MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, msg_no, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, from_length, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, subject_length, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, default_host, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_imap_rfc822_parse_headers, 0, 1, stdClass, 0)
+ ZEND_ARG_TYPE_INFO(0, headers, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, default_host, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_imap_rfc822_write_address, 0, 3, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, mailbox, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, host, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, personal, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imap_rfc822_parse_adrlist, 0, 2, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, address_string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, default_host, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_imap_body, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, msg_no, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_bodystruct, 0, 0, 3)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, msg_no, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, section, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_imap_fetchbody, 0, 3, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, msg_no, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, section, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imap_fetchmime arginfo_imap_fetchbody
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imap_savebody, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_INFO(0, file)
+ ZEND_ARG_TYPE_INFO(0, msg_no, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, section, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imap_fetchheader arginfo_imap_body
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_imap_fetchstructure, 0, 2, stdClass, MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, msg_no, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imap_gc, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imap_expunge, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, stream_id)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imap_delete, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, msg_no, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imap_undelete arginfo_imap_delete
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_imap_check, 0, 1, stdClass, MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, stream_id)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_imap_listscan, 0, 4, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, ref, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, content, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imap_mail_copy, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, msglist, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mailbox, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imap_mail_move, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, sequence, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mailbox, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_imap_mail_compose, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, envelope, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, body, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imap_createmailbox, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, mailbox, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imap_renamemailbox, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, old_name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, new_name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imap_deletemailbox arginfo_imap_createmailbox
+
+#define arginfo_imap_subscribe arginfo_imap_createmailbox
+
+#define arginfo_imap_unsubscribe arginfo_imap_createmailbox
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imap_append, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, folder, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, message, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, internal_date, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imap_ping arginfo_imap_expunge
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_imap_base64, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, text, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imap_qprint arginfo_imap_base64
+
+#define arginfo_imap_8bit arginfo_imap_base64
+
+#define arginfo_imap_binary arginfo_imap_base64
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imap_utf8, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mime_encoded_text, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_status, 0, 0, 3)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, mailbox, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_imap_mailboxmsginfo, 0, 1, stdClass, 0)
+ ZEND_ARG_INFO(0, stream_id)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imap_setflag_full, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, sequence, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, flag, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imap_clearflag_full arginfo_imap_setflag_full
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_imap_sort, 0, 3, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, criteria, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, reverse, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, search_criteria, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, charset, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_imap_uid, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, msg_no, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_imap_msgno, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, unique_msg_id, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_imap_list, 0, 3, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, ref, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imap_lsub arginfo_imap_list
+
+#define arginfo_imap_getsubscribed arginfo_imap_list
+
+#define arginfo_imap_getmailboxes arginfo_imap_list
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_imap_fetch_overview, 0, 2, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, sequence, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_imap_alerts, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE)
+ZEND_END_ARG_INFO()
+
+#define arginfo_imap_errors arginfo_imap_alerts
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_imap_last_error, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_imap_search, 0, 2, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, criteria, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, charset, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_imap_utf7_decode, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, buf, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imap_utf7_encode, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, buf, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_IMAP_MUTF7)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_imap_utf8_to_mutf7, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, in, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_IMAP_MUTF7)
+#define arginfo_imap_mutf7_to_utf8 arginfo_imap_utf8_to_mutf7
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_imap_mime_header_decode, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_imap_thread, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_imap_timeout, 0, 1, MAY_BE_LONG|MAY_BE_BOOL)
+ ZEND_ARG_TYPE_INFO(0, timeout_type, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, timeout, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_imap_get_quota, 0, 2, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, qroot, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_imap_get_quotaroot, 0, 2, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, mbox, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imap_set_quota, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, qroot, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mailbox_size, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imap_setacl, 0, 4, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, mailbox, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, id, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, rights, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_imap_getacl, 0, 2, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, stream_id)
+ ZEND_ARG_TYPE_INFO(0, mailbox, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imap_mail, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, to, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, subject, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, message, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, additional_headers, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, cc, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, bcc, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, rpath, IS_STRING, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/imap/tests/bug35669.phpt b/ext/imap/tests/bug35669.phpt
index 1f8ca5d7c3..fc7a135bce 100644
--- a/ext/imap/tests/bug35669.phpt
+++ b/ext/imap/tests/bug35669.phpt
@@ -8,7 +8,7 @@ Bug #35669 (imap_mail_compose() crashes with multipart-multiboundary-email)
?>
--FILE--
<?php
- $envelope["from"] = 'Santa <somewhere@northpole.gov>';
+ $envelope["from"] = 'Santa <somewhere@northpole.gov>';
$envelope["to"] = 'The bad smurf <bad@smurf.com>';
$envelope['date'] = 'Wed, 04 Jan 2006 19:24:43 -0500';
diff --git a/ext/imap/tests/bug44098.phpt b/ext/imap/tests/bug44098.phpt
index c424f05f54..2a0f5cef44 100644
--- a/ext/imap/tests/bug44098.phpt
+++ b/ext/imap/tests/bug44098.phpt
@@ -11,9 +11,9 @@ Bug #44098 (imap_utf8() returns only capital letters)
$exp = 'Luzon®14 dot CoM';
$res = imap_utf8('=?iso-8859-1?b?THV6b26uMTQ=?= dot CoM');
if ($res != $exp) {
- echo "failed: got <$res>, expected <exp>\n";
+ echo "failed: got <$res>, expected <exp>\n";
} else {
- echo "ok";
+ echo "ok";
}
?>
--EXPECT--
diff --git a/ext/imap/tests/bug63126.phpt b/ext/imap/tests/bug63126.phpt
index 94c618730c..8eea34cf1d 100644
--- a/ext/imap/tests/bug63126.phpt
+++ b/ext/imap/tests/bug63126.phpt
@@ -6,7 +6,7 @@ extension_loaded('imap') or die('skip imap extension not available in this build
require_once(__DIR__.'/imap_include.inc');
-$in = imap_open($default_mailbox, $username, $password, OP_HALFOPEN, 1);
+$in = @imap_open($default_mailbox, $username, $password, OP_HALFOPEN, 1);
if (!$in) {
die("skip could not connect to mailbox $default_mailbox");
}
diff --git a/ext/imap/tests/bug75774.phpt b/ext/imap/tests/bug75774.phpt
index ba08ab0439..42f5a842c3 100644
--- a/ext/imap/tests/bug75774.phpt
+++ b/ext/imap/tests/bug75774.phpt
@@ -10,15 +10,17 @@ extension_loaded('imap') or die('skip imap extension not available in this build
$fn = __DIR__ . DIRECTORY_SEPARATOR . "foo75774";
$var1=fopen($fn, "w");
-imap_append($var1, "", "", "", "");
+try {
+ imap_append($var1, "", "", "", "");
+} catch (Throwable $e) {
+ echo "\nException: " . $e->getMessage() . "\n";
+}
fclose($var1);
unlink($fn);
?>
-==DONE==
--EXPECTF--
-Warning: imap_append(): internal date not correctly formatted in %s on line %d
+Warning: imap_append(): Internal date not correctly formatted in %s on line %d
-Warning: imap_append(): supplied resource is not a valid imap resource in %s on line %d
-==DONE==
+Exception: imap_append(): Supplied resource is not a valid imap resource
diff --git a/ext/imap/tests/bug77020.phpt b/ext/imap/tests/bug77020.phpt
index 8a65232eec..582b132ad8 100644
--- a/ext/imap/tests/bug77020.phpt
+++ b/ext/imap/tests/bug77020.phpt
@@ -8,8 +8,6 @@ if (!extension_loaded('imap')) die('skip imap extension not available');
<?php
imap_mail('1', 1, NULL);
?>
-===DONE===
--EXPECTF--
Warning: imap_mail(): No message string in mail command in %s on line %d
-%s
-===DONE===
+%A
diff --git a/ext/imap/tests/clean.inc b/ext/imap/tests/clean.inc
index 4f381bf893..8bc566ba32 100644
--- a/ext/imap/tests/clean.inc
+++ b/ext/imap/tests/clean.inc
@@ -6,19 +6,19 @@ $imap_stream = imap_open($default_mailbox, $username, $password);
// delete all msgs in default mailbox, i.e INBOX
$check = imap_check($imap_stream);
for ($i = 1; $i <= $check->Nmsgs; $i++) {
- imap_delete($imap_stream, $i);
+ imap_delete($imap_stream, $i);
}
$mailboxes = imap_getmailboxes($imap_stream, $server, '*');
foreach($mailboxes as $value) {
- // Only delete mailboxes with our prefix
- if (preg_match('/\{.*?\}INBOX\.(.+)/', $value->name, $match) == 1) {
- if (strlen($match[1]) >= strlen($mailbox_prefix)
- && substr_compare($match[1], $mailbox_prefix, 0, strlen($mailbox_prefix)) == 0) {
- imap_deletemailbox($imap_stream, $value->name);
- }
- }
+ // Only delete mailboxes with our prefix
+ if (preg_match('/\{.*?\}INBOX\.(.+)/', $value->name, $match) == 1) {
+ if (strlen($match[1]) >= strlen($mailbox_prefix)
+ && substr_compare($match[1], $mailbox_prefix, 0, strlen($mailbox_prefix)) == 0) {
+ imap_deletemailbox($imap_stream, $value->name);
+ }
+ }
}
imap_close($imap_stream, CL_EXPUNGE);
diff --git a/ext/imap/tests/imap_8bit_basic.phpt b/ext/imap/tests/imap_8bit_basic.phpt
index 799889bb3d..6e81e31d3e 100644
--- a/ext/imap/tests/imap_8bit_basic.phpt
+++ b/ext/imap/tests/imap_8bit_basic.phpt
@@ -21,7 +21,6 @@ var_dump(imap_8bit("String with tab at end \t"));
var_dump(imap_8bit("\x00\x01\x02\x03\x04\xfe\xff\x0a\x0d"));
?>
-===Done===
--EXPECT--
*** Testing imap_8bit() : basic functionality ***
string(28) "String with CRLF at end=20
@@ -30,4 +29,3 @@ string(25) "String with space at end "
string(33) "String with tabs =09=09 in middle"
string(26) "String with tab at end =09"
string(27) "=00=01=02=03=04=FE=FF=0A=0D"
-===Done===
diff --git a/ext/imap/tests/imap_alerts_error.phpt b/ext/imap/tests/imap_alerts_error.phpt
index 546d193c8f..620d6d1e80 100644
--- a/ext/imap/tests/imap_alerts_error.phpt
+++ b/ext/imap/tests/imap_alerts_error.phpt
@@ -20,7 +20,6 @@ $extra_arg = 10;
var_dump( imap_alerts($extra_arg) );
?>
-===DONE===
--EXPECTF--
*** Testing imap_alerts() : error conditions ***
@@ -28,4 +27,3 @@ var_dump( imap_alerts($extra_arg) );
Warning: imap_alerts() expects exactly 0 parameters, 1 given in %s on line %d
NULL
-===DONE===
diff --git a/ext/imap/tests/imap_append_basic.phpt b/ext/imap/tests/imap_append_basic.phpt
index 500d3afb69..807c30c869 100644
--- a/ext/imap/tests/imap_append_basic.phpt
+++ b/ext/imap/tests/imap_append_basic.phpt
@@ -18,7 +18,7 @@ require_once(__DIR__.'/imap_include.inc');
echo "Create a new mailbox for test\n";
$imap_stream = setup_test_mailbox("", 0);
if (!is_resource($imap_stream)) {
- exit("TEST FAILED: Unable to create test mailbox\n");
+ exit("TEST FAILED: Unable to create test mailbox\n");
}
$mb_details = imap_mailboxmsginfo($imap_stream);
@@ -47,7 +47,6 @@ var_dump(imap_headers($imap_stream));
imap_close($imap_stream);
?>
-===Done===
--CLEAN--
<?php
require_once('clean.inc');
@@ -68,4 +67,3 @@ array(2) {
[1]=>
string(%d) "%w%s 2)%s webmaster@something. Another test (%d chars)"
}
-===Done===
diff --git a/ext/imap/tests/imap_base64_basic.phpt b/ext/imap/tests/imap_base64_basic.phpt
index 3557e9f87e..e5063f2c1c 100644
--- a/ext/imap/tests/imap_base64_basic.phpt
+++ b/ext/imap/tests/imap_base64_basic.phpt
@@ -16,32 +16,30 @@ echo "*** Testing imap_base64() : basic functionality ***\n";
$str = 'This is an example string to be base 64 encoded';
$base64 = base64_encode($str);
if (imap_base64($base64) == $str) {
- echo "TEST PASSED\n";
+ echo "TEST PASSED\n";
} else {
- echo "TEST FAILED";
+ echo "TEST FAILED";
}
$str = '!£$%^&*()_+-={][];;@~#?/>.<,';
$base64 = base64_encode($str);
if (imap_base64($base64) == $str) {
- echo "TEST PASSED\n";
+ echo "TEST PASSED\n";
} else {
- echo "TEST FAILED";
+ echo "TEST FAILED";
}
$hex = 'x00\x01\x02\x03\x04\x05\x06\xFA\xFB\xFC\xFD\xFE\xFF';
$base64 = base64_encode($hex);
if (imap_base64($base64) == $hex) {
- echo "TEST PASSED\n";
+ echo "TEST PASSED\n";
} else {
- echo "TEST FAILED";
+ echo "TEST FAILED";
}
?>
-===Done===
--EXPECT--
*** Testing imap_base64() : basic functionality ***
TEST PASSED
TEST PASSED
TEST PASSED
-===Done===
diff --git a/ext/imap/tests/imap_binary_basic.phpt b/ext/imap/tests/imap_binary_basic.phpt
index 04f85386bc..8809e46d94 100644
--- a/ext/imap/tests/imap_binary_basic.phpt
+++ b/ext/imap/tests/imap_binary_basic.phpt
@@ -34,7 +34,6 @@ $base64 = imap_binary($hex);
var_dump(bin2hex($base64));
?>
-===Done===
--EXPECTF--
*** Testing imap_binary() : basic functionality ***
Encode as short string
@@ -45,4 +44,3 @@ Encode a string with special characters
string(60) "5879737450587464573130374f30422b497a3876506934384c413d3d0d0a"
Encode some hexadecimal data
string(144) "65444177584867774d5678344d444a636544417a584867774e4678344d445663654441325848684751567834526b4a6365455a4458486847524678340d0a526b566365455a470d0a"
-===Done===
diff --git a/ext/imap/tests/imap_body.phpt b/ext/imap/tests/imap_body.phpt
index a9b3bcd6e5..a4e8069d04 100644
--- a/ext/imap/tests/imap_body.phpt
+++ b/ext/imap/tests/imap_body.phpt
@@ -17,7 +17,7 @@ imap_body('');
imap_body(false);
require_once(__DIR__.'/imap_include.inc');
$stream_id = imap_open($default_mailbox, $username, $password) or
- die("Cannot connect to mailbox $default_mailbox: " . imap_last_error());
+ die("Cannot connect to mailbox $default_mailbox: " . imap_last_error());
imap_body($stream_id);
imap_body($stream_id,-1);
imap_body($stream_id,1,-1);
@@ -42,7 +42,7 @@ Warning: imap_body() expects at least 2 parameters, 1 given in %s on line %d
Warning: imap_body(): Bad message number in %s on line %d
-Warning: imap_body(): invalid value for the options parameter in %s on line %d
+Warning: imap_body(): Invalid value for the options parameter in %s on line %d
Warning: imap_body(): Bad message number in %s on line %d
bool(false)
diff --git a/ext/imap/tests/imap_body_basic.phpt b/ext/imap/tests/imap_body_basic.phpt
index bc9f789c6a..ecc1da3ec6 100644
--- a/ext/imap/tests/imap_body_basic.phpt
+++ b/ext/imap/tests/imap_body_basic.phpt
@@ -18,7 +18,7 @@ require_once(__DIR__.'/imap_include.inc');
echo "Create a new mailbox for test\n";
$imap_stream = setup_test_mailbox("", 1);
if (!is_resource($imap_stream)) {
- exit("TEST FAILED: Unable to create test mailbox\n");
+ exit("TEST FAILED: Unable to create test mailbox\n");
}
$check = imap_check($imap_stream);
@@ -32,7 +32,6 @@ var_dump(imap_body($imap_stream, 1, FT_UID));
imap_close($imap_stream);
?>
-===Done===
--CLEAN--
<?php
require_once('clean.inc');
@@ -45,4 +44,3 @@ Create a temporary mailbox and add 1 msgs
Msg Count in new mailbox: 1
string(%d) "1: this is a test message, please ignore%a"
string(%d) "1: this is a test message, please ignore%a"
-===Done===
diff --git a/ext/imap/tests/imap_bodystruct_basic.phpt b/ext/imap/tests/imap_bodystruct_basic.phpt
index 07b552de96..9504f9acab 100644
--- a/ext/imap/tests/imap_bodystruct_basic.phpt
+++ b/ext/imap/tests/imap_bodystruct_basic.phpt
@@ -17,7 +17,7 @@ require_once(__DIR__.'/imap_include.inc');
echo "Create a new mailbox for test and add a multipart msgs\n";
$imap_stream = setup_test_mailbox("", 1, $mailbox, "multipart");
if (!is_resource($imap_stream)) {
- exit("TEST FAILED: Unable to create test mailbox\n");
+ exit("TEST FAILED: Unable to create test mailbox\n");
}
echo "\nGet and validate structure of body part 1\n";
@@ -68,7 +68,6 @@ function isValid($param)
return $result;
}
?>
-===Done===
--CLEAN--
<?php
require_once('clean.inc');
@@ -90,4 +89,3 @@ parameters is an array
Try to get part 4!
bool(false)
-===Done===
diff --git a/ext/imap/tests/imap_clearflag_full_basic.phpt b/ext/imap/tests/imap_clearflag_full_basic.phpt
index 017ca1b71e..3afc105d5a 100644
--- a/ext/imap/tests/imap_clearflag_full_basic.phpt
+++ b/ext/imap/tests/imap_clearflag_full_basic.phpt
@@ -18,7 +18,7 @@ require_once(__DIR__.'/imap_include.inc');
echo "Create a new mailbox for test\n";
$imap_stream = setup_test_mailbox("", 10);
if (!is_resource($imap_stream)) {
- exit("TEST FAILED: Unable to create test mailbox\n");
+ exit("TEST FAILED: Unable to create test mailbox\n");
}
$check = imap_check($imap_stream);
@@ -47,7 +47,6 @@ var_dump(imap_search($imap_stream, "DELETED"));
imap_close($imap_stream);
?>
-===Done===
--CLEAN--
<?php
require_once('clean.inc');
@@ -124,4 +123,3 @@ array(3) {
int(10)
}
bool(false)
-===Done===
diff --git a/ext/imap/tests/imap_close_basic.phpt b/ext/imap/tests/imap_close_basic.phpt
index 4a3f5d683f..9e275aa4d0 100644
--- a/ext/imap/tests/imap_close_basic.phpt
+++ b/ext/imap/tests/imap_close_basic.phpt
@@ -22,7 +22,7 @@ $options = CL_EXPUNGE;
// mark messages in inbox for deletion
for ($i = 1; $i < 4; $i++) {
- imap_delete($stream_id, $i);
+ imap_delete($stream_id, $i);
}
// Calling imap_close() with all possible arguments
@@ -37,7 +37,6 @@ echo "There are now " . imap_num_msg($stream_id) . " msgs in mailbox '$mailbox'\
echo "\n-- Call to imap_close() with mandatory arguments --\n";
var_dump( imap_close($stream_id) );
?>
-===DONE===
--CLEAN--
<?php
require_once(__DIR__.'/clean.inc');
@@ -53,4 +52,3 @@ There are now 0 msgs in mailbox '%sINBOX.phpttest'
-- Call to imap_close() with mandatory arguments --
bool(true)
-===DONE===
diff --git a/ext/imap/tests/imap_close_error.phpt b/ext/imap/tests/imap_close_error.phpt
index 8bb43e6a3b..ae370c7ef0 100644
--- a/ext/imap/tests/imap_close_error.phpt
+++ b/ext/imap/tests/imap_close_error.phpt
@@ -29,7 +29,6 @@ $options = CL_EXPUNGE;
$extra_arg = 10;
var_dump( imap_close($stream_id, $options, $extra_arg) );
?>
-===DONE===
--EXPECTF--
*** Testing imap_close() : error conditions ***
@@ -42,4 +41,3 @@ NULL
Warning: imap_close() expects at most 2 parameters, 3 given in %s on line %d
NULL
-===DONE===
diff --git a/ext/imap/tests/imap_close_variation3.phpt b/ext/imap/tests/imap_close_variation3.phpt
deleted file mode 100644
index d282ba1dfd..0000000000
--- a/ext/imap/tests/imap_close_variation3.phpt
+++ /dev/null
@@ -1,47 +0,0 @@
---TEST--
-Test imap_close() function : usage variations - different streams
---SKIPIF--
-<?php
-extension_loaded('imap') or die('skip imap extension not available in this build');
-?>
---FILE--
-<?php
-/* Prototype : bool imap_close(resource $stream_id [, int $options])
- * Description: Close an IMAP stream
- * Source code: ext/imap/php_imap.c
- */
-
-/*
- * Pass different stream types to imap_close() to test whether it can close them
- */
-
-echo "*** Testing imap_close() : usage variations ***\n";
-
-echo "\n-- File Resource opened with fopen() --\n";
-var_dump($file_handle = fopen(__FILE__, 'r'));
-var_dump(imap_close($file_handle));
-var_dump($file_handle);
-
-echo "\n-- Directory Resource opened with opendir() --\n";
-var_dump($dir_handle = opendir(__DIR__));
-var_dump(imap_close($dir_handle));
-var_dump($dir_handle);
-?>
-===DONE===
---EXPECTF--
-*** Testing imap_close() : usage variations ***
-
--- File Resource opened with fopen() --
-resource(%d) of type (stream)
-
-Warning: imap_close(): supplied resource is not a valid imap resource in %s on line %d
-bool(false)
-resource(%d) of type (stream)
-
--- Directory Resource opened with opendir() --
-resource(%d) of type (stream)
-
-Warning: imap_close(): supplied resource is not a valid imap resource in %s on line %d
-bool(false)
-resource(%d) of type (stream)
-===DONE===
diff --git a/ext/imap/tests/imap_close_variation4.phpt b/ext/imap/tests/imap_close_variation4.phpt
index d71113ca85..28a37ebb11 100644
--- a/ext/imap/tests/imap_close_variation4.phpt
+++ b/ext/imap/tests/imap_close_variation4.phpt
@@ -28,37 +28,36 @@ $stream_id = setup_test_mailbox('', 3, $mailbox); // set up temp mailbox with 3
$iterator = 1;
foreach($inputs as $input) {
- // mark added messages for deletion
- for ($i = 1; $i < 4; $i++) {
- imap_delete($stream_id, $i);
- }
- echo "\n-- Iteration $iterator --\n";
- var_dump( $check = imap_close($stream_id, $input) );
-
- // check that imap_close was successful, if not call imap_close and explicitly set CL_EXPUNGE
- if(false === $check) {
- imap_close($stream_id, CL_EXPUNGE);
- } else {
- // if imap_close was successful test whether CL_EXPUNGE was set by doing a message count
- $imap_stream = imap_open($mailbox, $username, $password);
- $num_msg = imap_num_msg($imap_stream);
- if ($num_msg != 0) {
- echo "CL_EXPUNGE was not set, $num_msg msgs in mailbox\n";
- } else {
- echo "CL_EXPUNGE was set\n";
- }
- // call imap_close with CL_EXPUNGE explicitly set in case mailbox not empty
- imap_close($imap_stream, CL_EXPUNGE);
- }
- $iterator++;
-
- // get $stream_id for next iteration
- $stream_id = imap_open($mailbox, $username, $password);
- populate_mailbox($stream_id, $mailbox, 3);
+ // mark added messages for deletion
+ for ($i = 1; $i < 4; $i++) {
+ imap_delete($stream_id, $i);
+ }
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( $check = imap_close($stream_id, $input) );
+
+ // check that imap_close was successful, if not call imap_close and explicitly set CL_EXPUNGE
+ if(false === $check) {
+ imap_close($stream_id, CL_EXPUNGE);
+ } else {
+ // if imap_close was successful test whether CL_EXPUNGE was set by doing a message count
+ $imap_stream = imap_open($mailbox, $username, $password);
+ $num_msg = imap_num_msg($imap_stream);
+ if ($num_msg != 0) {
+ echo "CL_EXPUNGE was not set, $num_msg msgs in mailbox\n";
+ } else {
+ echo "CL_EXPUNGE was set\n";
+ }
+ // call imap_close with CL_EXPUNGE explicitly set in case mailbox not empty
+ imap_close($imap_stream, CL_EXPUNGE);
+ }
+ $iterator++;
+
+ // get $stream_id for next iteration
+ $stream_id = imap_open($mailbox, $username, $password);
+ populate_mailbox($stream_id, $mailbox, 3);
};
?>
-===DONE===
--CLEAN--
<?php
require_once(__DIR__.'/clean.inc');
@@ -78,16 +77,15 @@ CL_EXPUNGE was set
-- Iteration 3 --
-Warning: imap_close(): invalid value for the flags parameter in %s on line %d
+Warning: imap_close(): Invalid value for the flags parameter in %s on line %d
bool(false)
-- Iteration 4 --
-Warning: imap_close(): invalid value for the flags parameter in %s on line %d
+Warning: imap_close(): Invalid value for the flags parameter in %s on line %d
bool(false)
-- Iteration 5 --
-Warning: imap_close(): invalid value for the flags parameter in %s on line %d
+Warning: imap_close(): Invalid value for the flags parameter in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/imap/tests/imap_createmailbox_basic.phpt b/ext/imap/tests/imap_createmailbox_basic.phpt
index 9d3cb83058..b522e80dfb 100644
--- a/ext/imap/tests/imap_createmailbox_basic.phpt
+++ b/ext/imap/tests/imap_createmailbox_basic.phpt
@@ -16,7 +16,7 @@ echo "*** Testing imap_createmailbox() : basic functionality ***\n";
require_once(__DIR__.'/imap_include.inc');
$imap_stream = imap_open($default_mailbox, $username, $password) or
- die("Cannot connect to mailbox $default_mailbox: " . imap_last_error());
+ die("Cannot connect to mailbox $default_mailbox: " . imap_last_error());
$newname = "phpnewbox";
@@ -25,8 +25,8 @@ echo "Newname will be '$newname'\n";
$newbox = imap_utf7_encode($server.$newname);
if (imap_createmailbox($imap_stream, $newbox)) {
- echo "Add a couple of msgs to '$newname' mailbox\n";
- populate_mailbox($imap_stream, $newbox, 2);
+ echo "Add a couple of msgs to '$newname' mailbox\n";
+ populate_mailbox($imap_stream, $newbox, 2);
$status = imap_status($imap_stream, $newbox, SA_ALL);
if ($status) {
@@ -54,7 +54,6 @@ if (imap_createmailbox($imap_stream, $newbox)) {
imap_close($imap_stream);
?>
-===Done===
--EXPECTF--
*** Testing imap_createmailbox() : basic functionality ***
Newname will be 'phpnewbox'
@@ -66,4 +65,3 @@ Unseen: 2
UIDnext: %d
UIDvalidity: %d
Mailbox 'phpnewbox' removed to restore initial state
-===Done===
diff --git a/ext/imap/tests/imap_errors_basic.phpt b/ext/imap/tests/imap_errors_basic.phpt
index 0a42e95e1f..cfd8379bec 100644
--- a/ext/imap/tests/imap_errors_basic.phpt
+++ b/ext/imap/tests/imap_errors_basic.phpt
@@ -27,7 +27,6 @@ $mbox = imap_open($default_mailbox, $username, $password, OP_READONLY, 1);
echo "List any errors\n";
var_dump(imap_errors());
?>
-===Done===
--EXPECTF--
*** Testing imap_errors() : basic functionality ***
Issue open with invalid password with normal default number of retries, i.e 3
@@ -52,4 +51,3 @@ array(%d) {
[0]=>
string(%d) "%a
}
-===Done===
diff --git a/ext/imap/tests/imap_fetch_overview_basic.phpt b/ext/imap/tests/imap_fetch_overview_basic.phpt
index 03aa9ae0a5..236a1a0ced 100644
--- a/ext/imap/tests/imap_fetch_overview_basic.phpt
+++ b/ext/imap/tests/imap_fetch_overview_basic.phpt
@@ -44,7 +44,6 @@ displayOverviewFields($a[1]);
imap_close($stream_id);
?>
-===DONE===
--CLEAN--
<?php
require_once(__DIR__.'/clean.inc');
@@ -93,4 +92,3 @@ deleted is 0
seen is 0
draft is 0
udate is OK
-===DONE===
diff --git a/ext/imap/tests/imap_fetch_overview_error.phpt b/ext/imap/tests/imap_fetch_overview_error.phpt
index 629535b0bf..3bba1a2426 100644
--- a/ext/imap/tests/imap_fetch_overview_error.phpt
+++ b/ext/imap/tests/imap_fetch_overview_error.phpt
@@ -32,7 +32,6 @@ var_dump( imap_fetch_overview($stream_id, $msg_no, $options, $extra_arg) );
echo "\n-- Testing imap_fetch_overview() function with less than expected no. of arguments --\n";
var_dump( imap_fetch_overview($stream_id) );
?>
-===DONE===
--CLEAN--
<?php
require_once(__DIR__.'/clean.inc');
@@ -51,4 +50,3 @@ NULL
Warning: imap_fetch_overview() expects at least 2 parameters, 1 given in %s on line %d
NULL
-===DONE===
diff --git a/ext/imap/tests/imap_fetch_overview_variation3.phpt b/ext/imap/tests/imap_fetch_overview_variation3.phpt
index 3c52c73d90..9e99dc2a0f 100644
--- a/ext/imap/tests/imap_fetch_overview_variation3.phpt
+++ b/ext/imap/tests/imap_fetch_overview_variation3.phpt
@@ -38,17 +38,16 @@ $options = array ('1',
$iterator = 1;
imap_check($stream_id);
foreach($options as $option) {
- echo "\nTesting with option value:";
- var_dump($option);
- $overview = imap_fetch_overview($stream_id, $msg_uid, $option);
- if ($overview) {
+ echo "\nTesting with option value:";
+ var_dump($option);
+ $overview = imap_fetch_overview($stream_id, $msg_uid, $option);
+ if ($overview) {
echo "imap_fetch_overview() returns an object\n";
}
- $iterator++;
+ $iterator++;
}
?>
-===DONE===
--CLEAN--
<?php
require_once(__DIR__.'/clean.inc');
@@ -72,9 +71,8 @@ imap_fetch_overview() returns an object
Testing with option value:int(%d)
-Warning: imap_fetch_overview(): invalid value for the options parameter in %s on line %d
+Warning: imap_fetch_overview(): Invalid value for the options parameter in %s on line %d
Testing with option value:int(-%d)
-Warning: imap_fetch_overview(): invalid value for the options parameter in %s on line %d
-===DONE===
+Warning: imap_fetch_overview(): Invalid value for the options parameter in %s on line %d
diff --git a/ext/imap/tests/imap_fetch_overview_variation4.phpt b/ext/imap/tests/imap_fetch_overview_variation4.phpt
deleted file mode 100644
index 2aa89b75b6..0000000000
--- a/ext/imap/tests/imap_fetch_overview_variation4.phpt
+++ /dev/null
@@ -1,46 +0,0 @@
---TEST--
-Test imap_fetch_overview() function : usage variations - different resources as $stream_id
---SKIPIF--
-<?php
-extension_loaded('imap') or die('skip imap extension not available in this build');
-?>
---FILE--
-<?php
-/* Prototype : array imap_fetch_overview(resource $stream_id, int $msg_no [, int $options])
- * Description: Read an overview of the information in the headers
- * of the given message sequence
- * Source code: ext/imap/php_imap.c
- */
-
-/*
- * Pass different resource types to imap_fetch_overview() to test behaviour
- */
-
-echo "*** Testing imap_fetch_overview() : usage variations ***\n";
-
-echo "\n-- File Resource opened with fopen() --\n";
-var_dump($file_pointer = fopen(__FILE__, 'r+'));
-var_dump(imap_fetch_overview($file_pointer, 1));
-fclose($file_pointer);
-
-echo "\n-- Directory Resource opened with opendir() --\n";
-var_dump($dir_handle = opendir(__DIR__));
-var_dump(imap_fetch_overview($dir_handle, 1));
-closedir($dir_handle);
-?>
-===DONE===
---EXPECTF--
-*** Testing imap_fetch_overview() : usage variations ***
-
--- File Resource opened with fopen() --
-resource(%d) of type (stream)
-
-Warning: imap_fetch_overview(): supplied resource is not a valid imap resource in %s on line %d
-bool(false)
-
--- Directory Resource opened with opendir() --
-resource(%d) of type (stream)
-
-Warning: imap_fetch_overview(): supplied resource is not a valid imap resource in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/imap/tests/imap_fetch_overview_variation5.phpt b/ext/imap/tests/imap_fetch_overview_variation5.phpt
index c052b39384..e06d3f5ef2 100644
--- a/ext/imap/tests/imap_fetch_overview_variation5.phpt
+++ b/ext/imap/tests/imap_fetch_overview_variation5.phpt
@@ -27,22 +27,21 @@ $sequences = array (0, 4, '4', // out of range
'1:3'); // pass uid without setting FT_UID option
foreach($sequences as $msg_no) {
- echo "\n-- \$msg_no is $msg_no --\n";
+ echo "\n-- \$msg_no is $msg_no --\n";
$overview = imap_fetch_overview($stream_id, $msg_no);
- if (!$overview) {
- echo imap_last_error() . "\n";
+ if (!$overview) {
+ echo imap_last_error() . "\n";
} else {
- foreach($overview as $ov) {
- echo "\n";
- displayOverviewFields($ov);
- }
+ foreach($overview as $ov) {
+ echo "\n";
+ displayOverviewFields($ov);
+ }
}
}
// clear error stack
imap_errors();
?>
-===DONE===
--CLEAN--
<?php
require_once(__DIR__.'/clean.inc');
@@ -135,4 +134,3 @@ deleted is 0
seen is 0
draft is 0
udate is OK
-===DONE===
diff --git a/ext/imap/tests/imap_fetch_overview_variation6.phpt b/ext/imap/tests/imap_fetch_overview_variation6.phpt
index d284f9bf94..90bff01cea 100644
--- a/ext/imap/tests/imap_fetch_overview_variation6.phpt
+++ b/ext/imap/tests/imap_fetch_overview_variation6.phpt
@@ -40,52 +40,51 @@ displayOverviewFields($a[0]);
* @param string $mailbox
*/
function create_multipart_message($imap_stream, $mailbox) {
- global $users, $domain;
- $envelope["from"]= "foo@anywhere.com";
- $envelope["to"] = "$users[0]@$domain";
- $envelope["subject"] = "Test msg 1";
-
- $part1["type"] = TYPEMULTIPART;
- $part1["subtype"] = "mixed";
-
- $part2["type"] = TYPETEXT;
- $part2["subtype"] = "plain";
- $part2["description"] = "imap_mail_compose() function";
- $part2["contents.data"] = "message 1:xxxxxxxxxxxxxxxxxxxxxxxxxx";
-
- $part3["type"] = TYPETEXT;
- $part3["subtype"] = "plain";
- $part3["description"] = "Example";
- $part3["contents.data"] = "message 2:yyyyyyyyyyyyyyyyyyyyyyyyyy";
-
- $file_handle = fopen(__FILE__, 'r+');
- $file_size = 1;
-
- $part4["type"] = TYPEAPPLICATION;
- $part4["encoding"] = ENCBASE64;
- $part4["subtype"] = "octet-stream";
- $part4["description"] = 'Test';
- $part4['disposition.type'] = 'attachment';
- $part4['disposition'] = array ('filename' => 'Test');
- $part4['type.parameters'] = array('name' => 'Test');
- $part4["contents.data"] = base64_encode(fread($file_handle, 1));
-
- $body[1] = $part1;
- $body[2] = $part2;
- $body[3] = $part3;
- $body[4] = $part4;
-
- $msg = imap_mail_compose($envelope, $body);
-
- if (imap_append($imap_stream, $mailbox, $msg) === false) {
- echo imap_last_error() . "\n";
- echo "TEST FAILED : could not append new message to mailbox '$mailbox'\n";
- exit;
- }
+ global $users, $domain;
+ $envelope["from"]= "foo@anywhere.com";
+ $envelope["to"] = "$users[0]@$domain";
+ $envelope["subject"] = "Test msg 1";
+
+ $part1["type"] = TYPEMULTIPART;
+ $part1["subtype"] = "mixed";
+
+ $part2["type"] = TYPETEXT;
+ $part2["subtype"] = "plain";
+ $part2["description"] = "imap_mail_compose() function";
+ $part2["contents.data"] = "message 1:xxxxxxxxxxxxxxxxxxxxxxxxxx";
+
+ $part3["type"] = TYPETEXT;
+ $part3["subtype"] = "plain";
+ $part3["description"] = "Example";
+ $part3["contents.data"] = "message 2:yyyyyyyyyyyyyyyyyyyyyyyyyy";
+
+ $file_handle = fopen(__FILE__, 'r+');
+ $file_size = 1;
+
+ $part4["type"] = TYPEAPPLICATION;
+ $part4["encoding"] = ENCBASE64;
+ $part4["subtype"] = "octet-stream";
+ $part4["description"] = 'Test';
+ $part4['disposition.type'] = 'attachment';
+ $part4['disposition'] = array ('filename' => 'Test');
+ $part4['type.parameters'] = array('name' => 'Test');
+ $part4["contents.data"] = base64_encode(fread($file_handle, 1));
+
+ $body[1] = $part1;
+ $body[2] = $part2;
+ $body[3] = $part3;
+ $body[4] = $part4;
+
+ $msg = imap_mail_compose($envelope, $body);
+
+ if (imap_append($imap_stream, $mailbox, $msg) === false) {
+ echo imap_last_error() . "\n";
+ echo "TEST FAILED : could not append new message to mailbox '$mailbox'\n";
+ exit;
+ }
}
?>
-===DONE===
--CLEAN--
<?php
require_once(__DIR__.'/clean.inc');
@@ -106,4 +105,3 @@ deleted is 0
seen is 0
draft is 0
udate is OK
-===DONE===
diff --git a/ext/imap/tests/imap_fetchbody_basic.phpt b/ext/imap/tests/imap_fetchbody_basic.phpt
index 66fa345535..597b3b71b6 100644
--- a/ext/imap/tests/imap_fetchbody_basic.phpt
+++ b/ext/imap/tests/imap_fetchbody_basic.phpt
@@ -27,26 +27,26 @@ $options = array ('FT_UID' => FT_UID, 'FT_PEEK' => FT_PEEK, 'FT_INTERNAL' => FT_
// Calling imap_fetchbody() with all possible arguments
echo "\n-- All possible arguments --\n";
foreach ($options as $key => $option) {
- echo "-- Option is $key --\n";
- switch ($key) {
+ echo "-- Option is $key --\n";
+ switch ($key) {
- case 'FT_UID';
- $msg_uid = imap_uid($stream_id, $msg_no);
- var_dump( imap_fetchbody($stream_id, $msg_uid, $section, $option) );
- break;
+ case 'FT_UID';
+ $msg_uid = imap_uid($stream_id, $msg_no);
+ var_dump( imap_fetchbody($stream_id, $msg_uid, $section, $option) );
+ break;
- case 'FT_PEEK';
- var_dump( imap_fetchbody($stream_id, $msg_no, $section, $option) );
- $overview = imap_fetch_overview($stream_id, 1);
- echo "Seen Flag: ";
- var_dump( $overview[0]->seen );
- break;
+ case 'FT_PEEK';
+ var_dump( imap_fetchbody($stream_id, $msg_no, $section, $option) );
+ $overview = imap_fetch_overview($stream_id, 1);
+ echo "Seen Flag: ";
+ var_dump( $overview[0]->seen );
+ break;
- case 'FT_INTERNAL';
- var_dump( imap_fetchbody($stream_id, $msg_no, $section, $option) );
- break;
+ case 'FT_INTERNAL';
+ var_dump( imap_fetchbody($stream_id, $msg_no, $section, $option) );
+ break;
- }
+ }
}
// Calling imap_fetchbody() with mandatory arguments
@@ -56,7 +56,6 @@ $overview = imap_fetch_overview($stream_id, 1);
echo "Seen Flag: ";
var_dump( $overview[0]->seen );
?>
-===DONE===
--CLEAN--
<?php
require_once(__DIR__.'/clean.inc');
@@ -78,4 +77,3 @@ string(36) "message 2:yyyyyyyyyyyyyyyyyyyyyyyyyy"
-- Mandatory arguments --
string(36) "message 2:yyyyyyyyyyyyyyyyyyyyyyyyyy"
Seen Flag: int(%d)
-===DONE===
diff --git a/ext/imap/tests/imap_fetchbody_error.phpt b/ext/imap/tests/imap_fetchbody_error.phpt
index c45371a813..89b54bf739 100644
--- a/ext/imap/tests/imap_fetchbody_error.phpt
+++ b/ext/imap/tests/imap_fetchbody_error.phpt
@@ -35,7 +35,6 @@ echo "\n-- Testing imap_fetchbody() function with less than expected no. of argu
var_dump( imap_fetchbody($stream_id, $msg_no) );
?>
-===DONE===
--CLEAN--
<?php
require_once(__DIR__.'/clean.inc');
@@ -54,4 +53,3 @@ NULL
Warning: imap_fetchbody() expects at least 3 parameters, 2 given in %s on line %d
NULL
-===DONE===
diff --git a/ext/imap/tests/imap_fetchbody_variation4.phpt b/ext/imap/tests/imap_fetchbody_variation4.phpt
index 3259ed9321..b4b8afa92d 100644
--- a/ext/imap/tests/imap_fetchbody_variation4.phpt
+++ b/ext/imap/tests/imap_fetchbody_variation4.phpt
@@ -35,17 +35,16 @@ $options = array ('1', true,
$iterator = 1;
imap_check($stream_id);
foreach($options as $option) {
- echo "\n-- Iteration $iterator --\n";
- if(is_string(imap_fetchbody($stream_id, $msg_uid, $section, $option))) {
- echo "FT_UID valid\n";
- } else {
+ echo "\n-- Iteration $iterator --\n";
+ if(is_string(imap_fetchbody($stream_id, $msg_uid, $section, $option))) {
+ echo "FT_UID valid\n";
+ } else {
echo "FT_UID not valid\n";
}
- $iterator++;
+ $iterator++;
}
?>
-===DONE===
--CLEAN--
<?php
require_once(__DIR__.'/clean.inc');
@@ -69,11 +68,10 @@ FT_UID valid
-- Iteration 5 --
-Warning: imap_fetchbody(): invalid value for the options parameter in %s on line %d
+Warning: imap_fetchbody(): Invalid value for the options parameter in %s on line %d
FT_UID not valid
-- Iteration 6 --
-Warning: imap_fetchbody(): invalid value for the options parameter in %s on line %d
+Warning: imap_fetchbody(): Invalid value for the options parameter in %s on line %d
FT_UID not valid
-===DONE===
diff --git a/ext/imap/tests/imap_fetchbody_variation5.phpt b/ext/imap/tests/imap_fetchbody_variation5.phpt
deleted file mode 100644
index fa32d0e995..0000000000
--- a/ext/imap/tests/imap_fetchbody_variation5.phpt
+++ /dev/null
@@ -1,46 +0,0 @@
---TEST--
-Test imap_fetchbody() function : usage variation - different resources as $stream_id arg
---SKIPIF--
-<?php
-extension_loaded('imap') or die('skip imap extension not available in this build');
-?>
---FILE--
-<?php
-/* Prototype : string imap_fetchbody(resource $stream_id, int $msg_no, string $section
- * [, int options])
- * Description: Get a specific body section
- * Source code: ext/imap/php_imap.c
- */
-
-/*
- * Pass different resource types to imap_fetchbody() to test behaviour
- */
-
-echo "*** Testing imap_fetchbody() : usage variations ***\n";
-
-echo "\n-- File Resource opened with fopen() --\n";
-var_dump($file_pointer = fopen(__FILE__, 'r+'));
-var_dump(imap_fetchbody($file_pointer, 1));
-fclose($file_pointer);
-
-echo "\n-- Directory Resource opened with opendir() --\n";
-var_dump($dir_handle = opendir(__DIR__));
-var_dump(imap_fetchbody($dir_handle, 1));
-closedir($dir_handle);
-?>
-===DONE===
---EXPECTF--
-*** Testing imap_fetchbody() : usage variations ***
-
--- File Resource opened with fopen() --
-resource(5) of type (stream)
-
-Warning: imap_fetchbody() expects at least 3 parameters, 2 given in %s on line %d
-NULL
-
--- Directory Resource opened with opendir() --
-resource(6) of type (stream)
-
-Warning: imap_fetchbody() expects at least 3 parameters, 2 given in %s on line %d
-NULL
-===DONE===
diff --git a/ext/imap/tests/imap_fetchbody_variation6.phpt b/ext/imap/tests/imap_fetchbody_variation6.phpt
index 18f7d3a40d..2090bf3792 100644
--- a/ext/imap/tests/imap_fetchbody_variation6.phpt
+++ b/ext/imap/tests/imap_fetchbody_variation6.phpt
@@ -29,14 +29,13 @@ $sequences = array (0, 4, // out of range
);
foreach($sequences as $msg_no) {
- echo "\n-- \$msg_no is $msg_no --\n";
- var_dump($overview = imap_fetchbody($stream_id, $msg_no, $section));
- if (!$overview) {
- echo imap_last_error() . "\n";
- }
+ echo "\n-- \$msg_no is $msg_no --\n";
+ var_dump($overview = imap_fetchbody($stream_id, $msg_no, $section));
+ if (!$overview) {
+ echo imap_last_error() . "\n";
+ }
}
?>
-===DONE===
--CLEAN--
<?php
require_once(__DIR__.'/clean.inc');
@@ -67,4 +66,3 @@ string(%d) "1: this is a test message, please ignore%a"
Notice: A non well formed numeric value encountered in %s on line %d
string(%d) "1: this is a test message, please ignore%a"
-===DONE===
diff --git a/ext/imap/tests/imap_fetchheader_basic.phpt b/ext/imap/tests/imap_fetchheader_basic.phpt
index 4ffa34c09e..7da2a1b78c 100644
--- a/ext/imap/tests/imap_fetchheader_basic.phpt
+++ b/ext/imap/tests/imap_fetchheader_basic.phpt
@@ -23,20 +23,19 @@ $options = array('FT_UID' => FT_UID, 'FT_INTERNAL' => FT_INTERNAL,
// Calling imap_fetchheader() with all possible arguments
echo "\n-- All possible arguments --\n";
foreach ($options as $key => $option) {
- echo "-- Option is $key --\n";
- if ($key == 'FT_UID') {
- $msg_uid = imap_uid($stream_id, $msg_no);
- var_dump(imap_fetchheader($stream_id, $msg_uid, $option));
- } else {
- var_dump(imap_fetchheader($stream_id, $msg_no, $option));
- }
+ echo "-- Option is $key --\n";
+ if ($key == 'FT_UID') {
+ $msg_uid = imap_uid($stream_id, $msg_no);
+ var_dump(imap_fetchheader($stream_id, $msg_uid, $option));
+ } else {
+ var_dump(imap_fetchheader($stream_id, $msg_no, $option));
+ }
}
// Calling imap_fetchheader() with mandatory arguments
echo "\n-- Mandatory arguments --\n";
var_dump( imap_fetchheader($stream_id, $msg_no) );
?>
-===DONE===
--CLEAN--
<?php
require_once(__DIR__.'/clean.inc');
@@ -80,4 +79,3 @@ MIME-Version: 1.0
Content-Type: %s; %s
"
-===DONE===
diff --git a/ext/imap/tests/imap_fetchheader_error.phpt b/ext/imap/tests/imap_fetchheader_error.phpt
index 82a47b64f1..b1d9921831 100644
--- a/ext/imap/tests/imap_fetchheader_error.phpt
+++ b/ext/imap/tests/imap_fetchheader_error.phpt
@@ -33,7 +33,6 @@ var_dump( imap_fetchheader($stream_id) );
imap_close($stream_id);
?>
-===DONE===
--EXPECTF--
*** Testing imap_fetchheader() : error conditions ***
@@ -46,4 +45,3 @@ NULL
Warning: imap_fetchheader() expects at least 2 parameters, 1 given in %s on line %d
NULL
-===DONE===
diff --git a/ext/imap/tests/imap_fetchheader_variation3.phpt b/ext/imap/tests/imap_fetchheader_variation3.phpt
index 8230fdcf3e..3430409fcb 100644
--- a/ext/imap/tests/imap_fetchheader_variation3.phpt
+++ b/ext/imap/tests/imap_fetchheader_variation3.phpt
@@ -34,16 +34,15 @@ $options = array ('1', true,
$iterator = 1;
imap_check($stream_id);
foreach($options as $option) {
- echo "\n-- Iteration $iterator --\n";
- if(is_string(imap_fetchheader($stream_id, $msg_uid, $option))) {
- echo "FT_UID valid\n";
- } else {
+ echo "\n-- Iteration $iterator --\n";
+ if(is_string(imap_fetchheader($stream_id, $msg_uid, $option))) {
+ echo "FT_UID valid\n";
+ } else {
echo "FT_UID not valid\n";
}
- $iterator++;
+ $iterator++;
}
?>
-===DONE===
--CLEAN--
<?php
require_once(__DIR__.'/clean.inc');
@@ -67,11 +66,10 @@ FT_UID valid
-- Iteration 5 --
-Warning: imap_fetchheader(): invalid value for the options parameter in %s on line %d
+Warning: imap_fetchheader(): Invalid value for the options parameter in %s on line %d
FT_UID not valid
-- Iteration 6 --
-Warning: imap_fetchheader(): invalid value for the options parameter in %s on line %d
+Warning: imap_fetchheader(): Invalid value for the options parameter in %s on line %d
FT_UID not valid
-===DONE===
diff --git a/ext/imap/tests/imap_fetchheader_variation4.phpt b/ext/imap/tests/imap_fetchheader_variation4.phpt
deleted file mode 100644
index 05322f1527..0000000000
--- a/ext/imap/tests/imap_fetchheader_variation4.phpt
+++ /dev/null
@@ -1,45 +0,0 @@
---TEST--
-Test imap_fetchheader() function : usage variations - diff resource types as $stream_id
---SKIPIF--
-<?php
-extension_loaded('imap') or die('skip imap extension not available in this build');
-?>
---FILE--
-<?php
-/* Prototype : string imap_fetchheader(resource $stream_id, int $msg_no [, int $options])
- * Description: Get the full unfiltered header for a message
- * Source code: ext/imap/php_imap.c
- */
-
-/*
- * Pass different types of resources to imap_fetchheader() to test behaviour
- */
-
-echo "*** Testing imap_fetchheader() : usage variations ***\n";
-
-echo "\n-- File Resource opened with fopen() --\n";
-var_dump($file_pointer = fopen(__FILE__, 'r+'));
-var_dump(imap_fetchheader($file_pointer, 1));
-fclose($file_pointer);
-
-echo "\n-- Directory Resource opened with opendir() --\n";
-var_dump($dir_handle = opendir(__DIR__));
-var_dump(imap_fetchheader($dir_handle, 1));
-closedir($dir_handle);
-?>
-===DONE===
---EXPECTF--
-*** Testing imap_fetchheader() : usage variations ***
-
--- File Resource opened with fopen() --
-resource(%d) of type (stream)
-
-Warning: imap_fetchheader(): supplied resource is not a valid imap resource in %s on line %d
-bool(false)
-
--- Directory Resource opened with opendir() --
-resource(%d) of type (stream)
-
-Warning: imap_fetchheader(): supplied resource is not a valid imap resource in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/imap/tests/imap_fetchheader_variation5.phpt b/ext/imap/tests/imap_fetchheader_variation5.phpt
index 8773621b09..548aac8935 100644
--- a/ext/imap/tests/imap_fetchheader_variation5.phpt
+++ b/ext/imap/tests/imap_fetchheader_variation5.phpt
@@ -27,17 +27,16 @@ $sequences = array (0, 4, // out of range
);
foreach($sequences as $msg_no) {
- echo "\n-- \$msg_no is $msg_no --\n";
- var_dump($overview = imap_fetchheader($stream_id, $msg_no));
- if (!$overview) {
- echo imap_last_error() . "\n";
- }
+ echo "\n-- \$msg_no is $msg_no --\n";
+ var_dump($overview = imap_fetchheader($stream_id, $msg_no));
+ if (!$overview) {
+ echo imap_last_error() . "\n";
+ }
}
// clear error stack
imap_errors();
?>
-===DONE===
--CLEAN--
<?php
require_once(__DIR__.'/clean.inc');
@@ -80,4 +79,3 @@ MIME-Version: 1.0
Content-Type: MULTIPART/mixed; BOUNDARY="%s"
"
-===DONE===
diff --git a/ext/imap/tests/imap_fetchstructure_basic.phpt b/ext/imap/tests/imap_fetchstructure_basic.phpt
index 5d83a27427..0ff266a390 100644
--- a/ext/imap/tests/imap_fetchstructure_basic.phpt
+++ b/ext/imap/tests/imap_fetchstructure_basic.phpt
@@ -28,7 +28,7 @@ $fields = array('type','encoding','ifsubtype','subtype',
'ifdescription','lines','bytes','parameters');
foreach ($fields as $key) {
- var_dump(isset($z->$key));
+ var_dump(isset($z->$key));
}
var_dump($z->type);
var_dump($z->encoding);
diff --git a/ext/imap/tests/imap_gc_error.phpt b/ext/imap/tests/imap_gc_error.phpt
index e9b2222778..9606c1ae2d 100644
--- a/ext/imap/tests/imap_gc_error.phpt
+++ b/ext/imap/tests/imap_gc_error.phpt
@@ -18,18 +18,18 @@ imap_gc(false, false);
require_once(__DIR__.'/imap_include.inc');
$stream_id = imap_open($default_mailbox, $username, $password) or
- die("Cannot connect to mailbox $default_mailbox: " . imap_last_error());
+ die("Cannot connect to mailbox $default_mailbox: " . imap_last_error());
imap_gc($stream_id, -1);
?>
--EXPECTF--
Checking with no parameters
-Warning: imap_gc() expects exactly 2 parameters, 0 given in %s on line %d
+Warning: imap_gc() Expects exactly 2 parameters, 0 given in %s on line %d
Checking with incorrect parameter type
-Warning: imap_gc() expects parameter 1 to be resource, string given in %s on line %d
+Warning: imap_gc() Expects parameter 1 to be resource, string given in %s on line %d
-Warning: imap_gc() expects parameter 1 to be resource, bool given in %s on line %d
+Warning: imap_gc() Expects parameter 1 to be resource, bool given in %s on line %d
-Warning: imap_gc(): invalid value for the flags parameter in %s on line %d
+Warning: imap_gc(): Invalid value for the flags parameter in %s on line %d
diff --git a/ext/imap/tests/imap_getsubscribed_basic.phpt b/ext/imap/tests/imap_getsubscribed_basic.phpt
index 666203a8c2..8995eadd05 100644
--- a/ext/imap/tests/imap_getsubscribed_basic.phpt
+++ b/ext/imap/tests/imap_getsubscribed_basic.phpt
@@ -17,7 +17,7 @@ imap_getsubscribed(false);
require_once(__DIR__.'/imap_include.inc');
$stream_id = imap_open($default_mailbox, $username, $password) or
- die("Cannot connect to mailbox $default_mailbox: " . imap_last_error());
+ die("Cannot connect to mailbox $default_mailbox: " . imap_last_error());
imap_getsubscribed($stream_id);
imap_getsubscribed($stream_id,$default_mailbox);
diff --git a/ext/imap/tests/imap_headerinfo_basic.phpt b/ext/imap/tests/imap_headerinfo_basic.phpt
index c13e62f8bf..056a46523c 100644
--- a/ext/imap/tests/imap_headerinfo_basic.phpt
+++ b/ext/imap/tests/imap_headerinfo_basic.phpt
@@ -16,14 +16,14 @@ $z = imap_headerinfo($stream_id, 1);
$fields = array ('toaddress','to','fromaddress','from',
'reply_toaddress','reply_to',
- 'senderaddress', 'sender',
+ 'senderaddress', 'sender',
'subject','Subject',
- 'Recent','Unseen','Flagged','Answered','Deleted','Draft',
- 'Msgno','MailDate','Size','udate');
+ 'Recent','Unseen','Flagged','Answered','Deleted','Draft',
+ 'Msgno','MailDate','Size','udate');
echo "Check general fields\n";
foreach ($fields as $key) {
- var_dump(isset($z->$key));
+ var_dump(isset($z->$key));
}
echo "Check type\n";
@@ -35,44 +35,44 @@ var_dump($z->subject);
var_dump($z->Subject);
if ($z->Recent == 'R' || $z->Recent == 'N' || $z->Recent == ' ') {
- echo "Recent: OK";
+ echo "Recent: OK";
} else {
- echo "Recent: error: ".$z->Recent;
+ echo "Recent: error: ".$z->Recent;
}
echo "\n";
if ($z->Unseen == 'U' || $z->Unseen == ' ') {
- echo "Unseen: OK";
+ echo "Unseen: OK";
} else {
- echo "Unseen: error: ".$z->Unseen;
+ echo "Unseen: error: ".$z->Unseen;
}
echo "\n";
if ($z->Flagged == 'F' || $z->Flagged == ' ') {
- echo "Flagged: OK";
+ echo "Flagged: OK";
} else {
- echo "Flagged: error: ".$z->Flagged;
+ echo "Flagged: error: ".$z->Flagged;
}
echo "\n";
if ($z->Answered == 'A' || $z->Answered == ' ') {
- echo "Answered: OK";
+ echo "Answered: OK";
} else {
- echo "Answered: error";
+ echo "Answered: error";
}
echo "\n";
if ($z->Deleted == 'D' || $z->Deleted == ' ') {
- echo "Deleted: OK";
+ echo "Deleted: OK";
} else {
- echo "Deleted: error";
+ echo "Deleted: error";
}
echo "\n";
if ($z->Draft == 'X' || $z->Draft == ' ') {
- echo "Draft: OK";
+ echo "Draft: OK";
} else {
- echo "Draft: error";
+ echo "Draft: error";
}
echo "\n";
diff --git a/ext/imap/tests/imap_headerinfo_error.phpt b/ext/imap/tests/imap_headerinfo_error.phpt
index 8d67b70130..3f3c593d06 100644
--- a/ext/imap/tests/imap_headerinfo_error.phpt
+++ b/ext/imap/tests/imap_headerinfo_error.phpt
@@ -17,7 +17,7 @@ imap_headerinfo(false);
require_once(__DIR__.'/imap_include.inc');
$stream_id = imap_open($default_mailbox, $username, $password) or
- die("Cannot connect to mailbox $default_mailbox: " . imap_last_error());
+ die("Cannot connect to mailbox $default_mailbox: " . imap_last_error());
imap_headerinfo($stream_id);
diff --git a/ext/imap/tests/imap_include.inc b/ext/imap/tests/imap_include.inc
index 369a560a5f..7de634075a 100644
--- a/ext/imap/tests/imap_include.inc
+++ b/ext/imap/tests/imap_include.inc
@@ -64,32 +64,32 @@ function displayOverviewFields($resp, $fields=null) {
* @return IMAP stream to new mailbox on success; FALSE on failure
*/
function setup_test_mailbox($mailbox_suffix, $message_count, &$new_mailbox = null, $msg_type = "simple"){
- global $server, $default_mailbox, $username, $password;
+ global $server, $default_mailbox, $username, $password;
- // open a stream to default mailbox
- $imap_stream = imap_open($default_mailbox, $username, $password);
+ // open a stream to default mailbox
+ $imap_stream = imap_open($default_mailbox, $username, $password);
- if ($imap_stream === false) {
- echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n";
- return false;
- }
+ if ($imap_stream === false) {
+ echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n";
+ return false;
+ }
- echo "Create a temporary mailbox and add " . $message_count . " msgs\n";
- $new_mailbox = create_mailbox($imap_stream, $mailbox_suffix, $message_count, $msg_type);
- if ($new_mailbox === false) {
- echo "Cant create a temporary mailbox: " . imap_last_error(). "\n";
- return false;
- }
+ echo "Create a temporary mailbox and add " . $message_count . " msgs\n";
+ $new_mailbox = create_mailbox($imap_stream, $mailbox_suffix, $message_count, $msg_type);
+ if ($new_mailbox === false) {
+ echo "Can't create a temporary mailbox: " . imap_last_error(). "\n";
+ return false;
+ }
- echo ".. mailbox '$new_mailbox' created\n";
+ echo ".. mailbox '$new_mailbox' created\n";
- // reopen stream to new mailbox
- if (imap_reopen($imap_stream, $new_mailbox) === false) {
- echo "cant re-open '$new_mailbox' mailbox: " . imap_last_error() . "\n";
- return false;
- }
+ // reopen stream to new mailbox
+ if (imap_reopen($imap_stream, $new_mailbox) === false) {
+ echo "can't re-open '$new_mailbox' mailbox: " . imap_last_error() . "\n";
+ return false;
+ }
- return $imap_stream;
+ return $imap_stream;
}
/**
@@ -99,30 +99,30 @@ function setup_test_mailbox($mailbox_suffix, $message_count, &$new_mailbox = nul
* @param string $mailbox
*/
function create_mailbox($imap_stream, $mailbox_suffix, $message_count, $msg_type= "simple"){
- global $default_mailbox, $mailbox_prefix;
- $mailbox = $default_mailbox . "." . $mailbox_prefix . $mailbox_suffix;
-
- $mailboxes = imap_getmailboxes($imap_stream, $mailbox, '*');
-
- // check mailbox does not already exist
- if ($mailboxes) {
- foreach($mailboxes as $value) {
- if ($value->name == $mailbox) {
- exit ("TEST FAILED : Mailbox '$mailbox' already exists\n");
- }
- }
- }
-
- if (imap_createmailbox($imap_stream, $mailbox) === false) {
- return false;
- }
-
- // Add number of test msgs requested
- if ($message_count > 0) {
- populate_mailbox($imap_stream, $mailbox, $message_count, $msg_type);
- }
-
- return $mailbox;
+ global $default_mailbox, $mailbox_prefix;
+ $mailbox = $default_mailbox . "." . $mailbox_prefix . $mailbox_suffix;
+
+ $mailboxes = imap_getmailboxes($imap_stream, $mailbox, '*');
+
+ // check mailbox does not already exist
+ if ($mailboxes) {
+ foreach($mailboxes as $value) {
+ if ($value->name == $mailbox) {
+ exit ("TEST FAILED : Mailbox '$mailbox' already exists\n");
+ }
+ }
+ }
+
+ if (imap_createmailbox($imap_stream, $mailbox) === false) {
+ return false;
+ }
+
+ // Add number of test msgs requested
+ if ($message_count > 0) {
+ populate_mailbox($imap_stream, $mailbox, $message_count, $msg_type);
+ }
+
+ return $mailbox;
}
/**
@@ -133,48 +133,48 @@ function create_mailbox($imap_stream, $mailbox_suffix, $message_count, $msg_type
*/
function populate_mailbox($imap_stream, $mailbox, $message_count, $msg_type = "simple"){
- global $users, $domain;
-
- for($i = 1; $i <= $message_count; $i++) {
- if ($msg_type == "simple") {
- $msg = "From: foo@anywhere.com\r\n"
- . "To: $users[0]@$domain\r\n"
- . "Subject: test$i\r\n"
- . "\r\n"
- . "$i: this is a test message, please ignore\r\n";
- } else {
- $envelope["from"]= "foo@anywhere.com";
- $envelope["to"] = "$users[0]@$domain";
- $envelope["subject"] = "Test msg $i";
-
- $part1["type"] = TYPEMULTIPART;
- $part1["subtype"] = "mixed";
-
- $part2["type"] = TYPETEXT;
- $part2["subtype"] = "plain";
- $part2["description"] = "imap_mail_compose() function";
- $part2["contents.data"] = "message 1:xxxxxxxxxxxxxxxxxxxxxxxxxx";
-
- $part3["type"] = TYPETEXT;
- $part3["subtype"] = "plain";
- $part3["description"] = "Example";
- $part3["contents.data"] = "message 2:yyyyyyyyyyyyyyyyyyyyyyyyyy";
-
- $part4["type"] = TYPETEXT;
- $part4["subtype"] = "plain";
- $part4["description"] = "Return Values";
- $part4["contents.data"] = "message 3:zzzzzzzzzzzzzzzzzzzzzzzzzz";
-
- $body[1] = $part1;
- $body[2] = $part2;
- $body[3] = $part3;
- $body[4] = $part4;
-
- $msg = imap_mail_compose($envelope, $body);
- }
-
- imap_append($imap_stream, $mailbox, $msg);
- }
+ global $users, $domain;
+
+ for($i = 1; $i <= $message_count; $i++) {
+ if ($msg_type == "simple") {
+ $msg = "From: foo@anywhere.com\r\n"
+ . "To: $users[0]@$domain\r\n"
+ . "Subject: test$i\r\n"
+ . "\r\n"
+ . "$i: this is a test message, please ignore\r\n";
+ } else {
+ $envelope["from"]= "foo@anywhere.com";
+ $envelope["to"] = "$users[0]@$domain";
+ $envelope["subject"] = "Test msg $i";
+
+ $part1["type"] = TYPEMULTIPART;
+ $part1["subtype"] = "mixed";
+
+ $part2["type"] = TYPETEXT;
+ $part2["subtype"] = "plain";
+ $part2["description"] = "imap_mail_compose() function";
+ $part2["contents.data"] = "message 1:xxxxxxxxxxxxxxxxxxxxxxxxxx";
+
+ $part3["type"] = TYPETEXT;
+ $part3["subtype"] = "plain";
+ $part3["description"] = "Example";
+ $part3["contents.data"] = "message 2:yyyyyyyyyyyyyyyyyyyyyyyyyy";
+
+ $part4["type"] = TYPETEXT;
+ $part4["subtype"] = "plain";
+ $part4["description"] = "Return Values";
+ $part4["contents.data"] = "message 3:zzzzzzzzzzzzzzzzzzzzzzzzzz";
+
+ $body[1] = $part1;
+ $body[2] = $part2;
+ $body[3] = $part3;
+ $body[4] = $part4;
+
+ $msg = imap_mail_compose($envelope, $body);
+ }
+
+ imap_append($imap_stream, $mailbox, $msg);
+ }
}
/**
@@ -185,12 +185,12 @@ function populate_mailbox($imap_stream, $mailbox, $message_count, $msg_type = "s
*/
function get_mailbox_name($mailbox){
- if (preg_match('/\{.*?\}(.*)/', $mailbox, $match) != 1) {
- echo "Unrecpognized mailbox name\n";
- return false;
- }
+ if (preg_match('/\{.*?\}(.*)/', $mailbox, $match) != 1) {
+ echo "Unrecpognized mailbox name\n";
+ return false;
+ }
- return $match[1];
+ return $match[1];
}
?>
diff --git a/ext/imap/tests/imap_list_basic.phpt b/ext/imap/tests/imap_list_basic.phpt
index 21f8a63894..77df74af2b 100644
--- a/ext/imap/tests/imap_list_basic.phpt
+++ b/ext/imap/tests/imap_list_basic.phpt
@@ -17,7 +17,7 @@ imap_list(false);
require_once(__DIR__.'/imap_include.inc');
$stream_id = imap_open($default_mailbox, $username, $password) or
- die("Cannot connect to mailbox $default_mailbox: " . imap_last_error());
+ die("Cannot connect to mailbox $default_mailbox: " . imap_last_error());
imap_list($stream_id);
imap_list($stream_id,$default_mailbox);
diff --git a/ext/imap/tests/imap_lsub_basic.phpt b/ext/imap/tests/imap_lsub_basic.phpt
index 638479ca80..591a023ed8 100644
--- a/ext/imap/tests/imap_lsub_basic.phpt
+++ b/ext/imap/tests/imap_lsub_basic.phpt
@@ -17,7 +17,7 @@ imap_lsub(false);
require_once(__DIR__.'/imap_include.inc');
$stream_id = imap_open($default_mailbox, $username, $password) or
- die("Cannot connect to mailbox $default_mailbox: " . imap_last_error());
+ die("Cannot connect to mailbox $default_mailbox: " . imap_last_error());
imap_lsub($stream_id);
imap_lsub($stream_id,$default_mailbox);
diff --git a/ext/imap/tests/imap_mail_copy.phpt b/ext/imap/tests/imap_mail_copy.phpt
index 12a85a1804..c82a003a59 100644
--- a/ext/imap/tests/imap_mail_copy.phpt
+++ b/ext/imap/tests/imap_mail_copy.phpt
@@ -23,7 +23,7 @@ require_once(__DIR__.'/imap_include.inc');
echo "Test with IMAP server\n";
$stream_id = imap_open($default_mailbox, $username, $password) or
- die("Cannot connect to mailbox $default_mailbox: " . imap_last_error());
+ die("Cannot connect to mailbox $default_mailbox: " . imap_last_error());
var_dump(imap_mail_copy($stream_id));
var_dump(imap_mail_copy($stream_id,-1));
@@ -31,7 +31,6 @@ var_dump(imap_mail_copy($stream_id, ''));
imap_close($stream_id);
?>
-===Done===
--EXPECTF--
Checking with no parameters
@@ -51,4 +50,3 @@ NULL
Warning: imap_mail_copy() expects at least 3 parameters, 2 given in %s on line %d
NULL
-===Done===
diff --git a/ext/imap/tests/imap_mail_copy_basic.phpt b/ext/imap/tests/imap_mail_copy_basic.phpt
index a05951e8f6..335b4218e6 100644
--- a/ext/imap/tests/imap_mail_copy_basic.phpt
+++ b/ext/imap/tests/imap_mail_copy_basic.phpt
@@ -21,7 +21,7 @@ require_once(__DIR__.'/imap_include.inc');
echo "Create a new mailbox for test\n";
$imap_stream = setup_test_mailbox("", 1);
if (!is_resource($imap_stream)) {
- exit("TEST FAILED: Unable to create test mailbox\n");
+ exit("TEST FAILED: Unable to create test mailbox\n");
}
$check = imap_check($imap_stream);
@@ -31,7 +31,6 @@ var_dump(imap_mail_copy($imap_stream, '1', 'INBOX.'.$mailbox_prefix));
imap_close($imap_stream);
?>
-===Done===
--CLEAN--
<?php
require_once('clean.inc');
@@ -43,4 +42,3 @@ Create a temporary mailbox and add 1 msgs
.. mailbox '%s' created
Msg Count in new mailbox: 1
bool(true)
-===Done===
diff --git a/ext/imap/tests/imap_mail_move.phpt b/ext/imap/tests/imap_mail_move.phpt
index 122960b78c..d6d874b80d 100644
--- a/ext/imap/tests/imap_mail_move.phpt
+++ b/ext/imap/tests/imap_mail_move.phpt
@@ -23,7 +23,7 @@ require_once(__DIR__.'/imap_include.inc');
echo "Test with IMAP server\n";
$stream_id = imap_open($default_mailbox, $username, $password) or
- die("Cannot connect to mailbox $default_mailbox: " . imap_last_error());
+ die("Cannot connect to mailbox $default_mailbox: " . imap_last_error());
var_dump(imap_mail_move($stream_id));
var_dump(imap_mail_move($stream_id,-1));
@@ -31,7 +31,6 @@ var_dump(imap_mail_move($stream_id, ''));
imap_close($stream_id);
?>
-===Done===
--EXPECTF--
Checking with no parameters
@@ -51,4 +50,3 @@ NULL
Warning: imap_mail_move() expects at least 3 parameters, 2 given in %s on line %d
NULL
-===Done===
diff --git a/ext/imap/tests/imap_mail_move_basic.phpt b/ext/imap/tests/imap_mail_move_basic.phpt
index 380d288d9b..555d6e7a18 100644
--- a/ext/imap/tests/imap_mail_move_basic.phpt
+++ b/ext/imap/tests/imap_mail_move_basic.phpt
@@ -21,7 +21,7 @@ require_once(__DIR__.'/imap_include.inc');
echo "Create a new mailbox for test\n";
$imap_stream = setup_test_mailbox("", 1);
if (!is_resource($imap_stream)) {
- exit("TEST FAILED: Unable to create test mailbox\n");
+ exit("TEST FAILED: Unable to create test mailbox\n");
}
$check = imap_check($imap_stream);
@@ -31,7 +31,6 @@ var_dump(imap_mail_move($imap_stream, '1', 'INBOX.'.$mailbox_prefix));
imap_close($imap_stream);
?>
-===Done===
--CLEAN--
<?php
require_once('clean.inc');
@@ -43,4 +42,3 @@ Create a temporary mailbox and add 1 msgs
.. mailbox '%s' created
Msg Count in new mailbox: 1
bool(true)
-===Done===
diff --git a/ext/imap/tests/imap_mutf7_to_utf8.phpt b/ext/imap/tests/imap_mutf7_to_utf8.phpt
index e2c745ecd0..d8bda0c6a9 100644
--- a/ext/imap/tests/imap_mutf7_to_utf8.phpt
+++ b/ext/imap/tests/imap_mutf7_to_utf8.phpt
@@ -8,7 +8,6 @@ imap_mutf7_to_utf8
var_dump(imap_mutf7_to_utf8(""));
var_dump(imap_mutf7_to_utf8(1));
-var_dump(imap_mutf7_to_utf8(array(1,2)));
var_dump(imap_mutf7_to_utf8("t&AOQ-st"));
echo "Done\n";
@@ -16,8 +15,5 @@ echo "Done\n";
--EXPECTF--
string(0) ""
string(1) "1"
-
-Warning: imap_mutf7_to_utf8() expects parameter 1 to be string, array given in %s on line %d
-NULL
string(5) "täst"
Done
diff --git a/ext/imap/tests/imap_renamemailbox_basic.phpt b/ext/imap/tests/imap_renamemailbox_basic.phpt
index 91f99d13e3..ee5ccb2be7 100644
--- a/ext/imap/tests/imap_renamemailbox_basic.phpt
+++ b/ext/imap/tests/imap_renamemailbox_basic.phpt
@@ -21,7 +21,7 @@ require_once(__DIR__.'/imap_include.inc');
$stream_id = setup_test_mailbox('', 1);
if (!is_resource($stream_id)) {
- exit("TEST FAILED: Unable to create test mailbox\n");
+ exit("TEST FAILED: Unable to create test mailbox\n");
}
$newbox = $default_mailbox . "." . $mailbox_prefix;
diff --git a/ext/imap/tests/imap_rfc822_parse_headers_basic.phpt b/ext/imap/tests/imap_rfc822_parse_headers_basic.phpt
index 36fcc7f077..87dc4aaf05 100644
--- a/ext/imap/tests/imap_rfc822_parse_headers_basic.phpt
+++ b/ext/imap/tests/imap_rfc822_parse_headers_basic.phpt
@@ -16,14 +16,14 @@ $z = imap_headerinfo($stream_id, 1);
$fields = array ('toaddress','to','fromaddress','from',
'reply_toaddress','reply_to',
- 'senderaddress', 'sender',
+ 'senderaddress', 'sender',
'subject','Subject',
- 'MailDate','Size','udate');
+ 'MailDate','Size','udate');
echo "Check general fields\n";
foreach ($fields as $key) {
- var_dump(isset($z->$key));
+ var_dump(isset($z->$key));
}
echo "Check type\n";
@@ -35,44 +35,44 @@ var_dump($z->subject);
var_dump($z->Subject);
if ($z->Recent == 'R' || $z->Recent == 'N' || $z->Recent == ' ') {
- echo "Recent: OK";
+ echo "Recent: OK";
} else {
- echo "Recent: error";
+ echo "Recent: error";
}
echo "\n";
if ($z->Unseen == 'U' || $z->Unseen == ' ') {
- echo "Unseen: OK";
+ echo "Unseen: OK";
} else {
- echo "Unseen: error";
+ echo "Unseen: error";
}
echo "\n";
if ($z->Flagged == 'F' || $z->Flagged == ' ') {
- echo "Flagged: OK";
+ echo "Flagged: OK";
} else {
- echo "Flagged: error";
+ echo "Flagged: error";
}
echo "\n";
if ($z->Answered == 'A' || $z->Answered == ' ') {
- echo "Answered: OK";
+ echo "Answered: OK";
} else {
- echo "Answered: error";
+ echo "Answered: error";
}
echo "\n";
if ($z->Deleted == 'D' || $z->Deleted == ' ') {
- echo "Deleted: OK";
+ echo "Deleted: OK";
} else {
- echo "Deleted: error";
+ echo "Deleted: error";
}
echo "\n";
if ($z->Draft == 'X' || $z->Draft == ' ') {
- echo "Draft: OK";
+ echo "Draft: OK";
} else {
- echo "Draft: error";
+ echo "Draft: error";
}
echo "\n";
diff --git a/ext/imap/tests/imap_undelete_error.phpt b/ext/imap/tests/imap_undelete_error.phpt
index 0eae8033eb..972c8140c6 100644
--- a/ext/imap/tests/imap_undelete_error.phpt
+++ b/ext/imap/tests/imap_undelete_error.phpt
@@ -17,7 +17,7 @@ imap_undelete(false);
require_once(__DIR__.'/imap_include.inc');
$stream_id = imap_open($default_mailbox, $username, $password) or
- die("Cannot connect to mailbox $default_mailbox: " . imap_last_error());
+ die("Cannot connect to mailbox $default_mailbox: " . imap_last_error());
imap_undelete($stream_id);
diff --git a/ext/imap/tests/imap_utf8.phpt b/ext/imap/tests/imap_utf8.phpt
index a8901555d5..a82c3721c3 100644
--- a/ext/imap/tests/imap_utf8.phpt
+++ b/ext/imap/tests/imap_utf8.phpt
@@ -7,7 +7,6 @@ imap_utf8() tests
var_dump(imap_utf8(""));
var_dump(imap_utf8(1));
-var_dump(imap_utf8(array(1,2)));
var_dump(imap_utf8("test"));
echo "Done\n";
@@ -15,8 +14,5 @@ echo "Done\n";
--EXPECTF--
string(0) ""
string(1) "1"
-
-Warning: imap_utf8() expects parameter 1 to be string, array given in %s on line %d
-NULL
string(4) "%s"
Done
diff --git a/ext/imap/tests/imap_utf8_to_mutf7_basic.phpt b/ext/imap/tests/imap_utf8_to_mutf7_basic.phpt
index bea268a457..6046dc1c5f 100644
--- a/ext/imap/tests/imap_utf8_to_mutf7_basic.phpt
+++ b/ext/imap/tests/imap_utf8_to_mutf7_basic.phpt
@@ -8,7 +8,6 @@ imap_utf8_to_mutf7
var_dump(imap_utf8_to_mutf7(""));
var_dump(imap_utf8_to_mutf7(1));
-var_dump(imap_utf8_to_mutf7(array(1,2)));
var_dump(imap_utf8_to_mutf7("täst"));
echo "Done\n";
@@ -16,8 +15,5 @@ echo "Done\n";
--EXPECTF--
string(0) ""
string(1) "1"
-
-Warning: imap_utf8_to_mutf7() expects parameter 1 to be string, array given in %s on line %d
-NULL
string(8) "t&AOQ-st"
Done
diff --git a/ext/imap/tests/skipif.inc b/ext/imap/tests/skipif.inc
index 12b1408634..2820bff5c6 100644
--- a/ext/imap/tests/skipif.inc
+++ b/ext/imap/tests/skipif.inc
@@ -10,7 +10,7 @@ $retries = 0; // don't retry connect on failure
$mbox = @imap_open($mailbox, $username, $password, $options, $retries);
if (!$mbox) {
- die("skip could not connect to mailbox $mailbox");
+ die("skip could not connect to mailbox $mailbox");
}
imap_close($mbox);
?>
diff --git a/ext/intl/ERROR_CONVENTIONS.md b/ext/intl/ERROR_CONVENTIONS.md
index 863b9f1b8d..af2450c818 100644
--- a/ext/intl/ERROR_CONVENTIONS.md
+++ b/ext/intl/ERROR_CONVENTIONS.md
@@ -114,7 +114,7 @@ U_CFUNC PHP_FUNCTION(breakiter_set_text)
&text, &text_len) == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"breakiter_set_text: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* ... */
diff --git a/ext/intl/breakiterator/breakiterator_class.cpp b/ext/intl/breakiterator/breakiterator_class.cpp
index 0d64efece4..608702ac2b 100644
--- a/ext/intl/breakiterator/breakiterator_class.cpp
+++ b/ext/intl/breakiterator/breakiterator_class.cpp
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -84,6 +82,11 @@ static int BreakIterator_compare_objects(zval *object1,
BreakIterator_object *bio1,
*bio2;
+ ZEND_COMPARE_OBJECTS_FALLBACK(object1, object2);
+ if (Z_TYPE_P(object1) != Z_TYPE_P(object2)) {
+ return 1; /* object and non-object */
+ }
+
bio1 = Z_INTL_BREAKITERATOR_P(object1);
bio2 = Z_INTL_BREAKITERATOR_P(object2);
@@ -96,16 +99,16 @@ static int BreakIterator_compare_objects(zval *object1,
/* }}} */
/* {{{ clone handler for BreakIterator */
-static zend_object *BreakIterator_clone_obj(zval *object)
+static zend_object *BreakIterator_clone_obj(zend_object *object)
{
BreakIterator_object *bio_orig,
*bio_new;
zend_object *ret_val;
- bio_orig = Z_INTL_BREAKITERATOR_P(object);
+ bio_orig = php_intl_breakiterator_fetch_object(object);
intl_errors_reset(INTL_DATA_ERROR_P(bio_orig));
- ret_val = BreakIterator_ce_ptr->create_object(Z_OBJCE_P(object));
+ ret_val = BreakIterator_ce_ptr->create_object(object->ce);
bio_new = php_intl_breakiterator_fetch_object(ret_val);
zend_objects_clone_members(&bio_new->zo, &bio_orig->zo);
@@ -136,7 +139,7 @@ static zend_object *BreakIterator_clone_obj(zval *object)
/* }}} */
/* {{{ get_debug_info handler for BreakIterator */
-static HashTable *BreakIterator_get_debug_info(zval *object, int *is_temp)
+static HashTable *BreakIterator_get_debug_info(zend_object *object, int *is_temp)
{
zval val;
HashTable *debug_info;
@@ -147,7 +150,7 @@ static HashTable *BreakIterator_get_debug_info(zval *object, int *is_temp)
debug_info = zend_new_array(8);
- bio = Z_INTL_BREAKITERATOR_P(object);
+ bio = php_intl_breakiterator_fetch_object(object);
biter = bio->biter;
if (biter == NULL) {
@@ -320,7 +323,7 @@ U_CFUNC void breakiterator_register_BreakIterator_class(void)
memcpy(&BreakIterator_handlers, &std_object_handlers,
sizeof BreakIterator_handlers);
BreakIterator_handlers.offset = XtOffsetOf(BreakIterator_object, zo);
- BreakIterator_handlers.compare_objects = BreakIterator_compare_objects;
+ BreakIterator_handlers.compare = BreakIterator_compare_objects;
BreakIterator_handlers.clone_obj = BreakIterator_clone_obj;
BreakIterator_handlers.get_debug_info = BreakIterator_get_debug_info;
BreakIterator_handlers.free_obj = BreakIterator_objects_free;
diff --git a/ext/intl/breakiterator/breakiterator_class.h b/ext/intl/breakiterator/breakiterator_class.h
index a856b7c7e0..ae5eeab821 100644
--- a/ext/intl/breakiterator/breakiterator_class.h
+++ b/ext/intl/breakiterator/breakiterator_class.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -60,8 +58,8 @@ static inline BreakIterator_object *php_intl_breakiterator_fetch_object(zend_obj
BREAKITER_METHOD_FETCH_OBJECT_NO_CHECK; \
if (bio->biter == NULL) \
{ \
- intl_errors_set(&bio->err, U_ILLEGAL_ARGUMENT_ERROR, "Found unconstructed BreakIterator", 0); \
- RETURN_FALSE; \
+ zend_throw_error(NULL, "Found unconstructed BreakIterator"); \
+ RETURN_THROWS(); \
}
void breakiterator_object_create(zval *object, BreakIterator *break_iter, int brand_new);
diff --git a/ext/intl/breakiterator/breakiterator_iterators.cpp b/ext/intl/breakiterator/breakiterator_iterators.cpp
index 1635be5601..cd3ef42281 100644
--- a/ext/intl/breakiterator/breakiterator_iterators.cpp
+++ b/ext/intl/breakiterator/breakiterator_iterators.cpp
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -278,9 +276,7 @@ U_CFUNC PHP_METHOD(IntlPartsIterator, getBreakIterator)
INTLITERATOR_METHOD_INIT_VARS;
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "IntlPartsIterator::getBreakIterator: bad arguments", 0);
- return;
+ RETURN_THROWS();
}
INTLITERATOR_METHOD_FETCH_OBJECT;
diff --git a/ext/intl/breakiterator/breakiterator_iterators.h b/ext/intl/breakiterator/breakiterator_iterators.h
index 71a1e35025..0f02fb11ce 100644
--- a/ext/intl/breakiterator/breakiterator_iterators.h
+++ b/ext/intl/breakiterator/breakiterator_iterators.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/breakiterator/breakiterator_methods.cpp b/ext/intl/breakiterator/breakiterator_methods.cpp
index 6d6211db73..3f2dded5ef 100644
--- a/ext/intl/breakiterator/breakiterator_methods.cpp
+++ b/ext/intl/breakiterator/breakiterator_methods.cpp
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -55,10 +53,7 @@ static void _breakiter_factory(const char *func_name,
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!",
&locale_str, &dummy) == FAILURE) {
- spprintf(&msg, 0, "%s: bad arguments", func_name);
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, msg, 1);
- efree(msg);
- RETURN_NULL();
+ RETURN_THROWS();
}
if (locale_str == NULL) {
@@ -118,9 +113,7 @@ U_CFUNC PHP_FUNCTION(breakiter_create_code_point_instance)
intl_error_reset(NULL);
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "breakiter_create_code_point_instance: bad arguments", 0);
- RETURN_NULL();
+ RETURN_THROWS();
}
CodePointBreakIterator *cpbi = new CodePointBreakIterator();
@@ -133,9 +126,7 @@ U_CFUNC PHP_FUNCTION(breakiter_get_text)
object = ZEND_THIS;
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "breakiter_get_text: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
BREAKITER_METHOD_FETCH_OBJECT;
@@ -155,9 +146,7 @@ U_CFUNC PHP_FUNCTION(breakiter_set_text)
object = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &text) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "breakiter_set_text: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
BREAKITER_METHOD_FETCH_OBJECT;
@@ -189,10 +178,7 @@ static void _breakiter_no_args_ret_int32(
object = ZEND_THIS;
if (zend_parse_parameters_none() == FAILURE) {
- spprintf(&msg, 0, "%s: bad arguments", func_name);
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, msg, 1);
- efree(msg);
- RETURN_FALSE;
+ RETURN_THROWS();
}
BREAKITER_METHOD_FETCH_OBJECT;
@@ -213,10 +199,7 @@ static void _breakiter_int32_ret_int32(
object = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &arg) == FAILURE) {
- spprintf(&msg, 0, "%s: bad arguments", func_name);
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, msg, 1);
- efree(msg);
- RETURN_FALSE;
+ RETURN_THROWS();
}
BREAKITER_METHOD_FETCH_OBJECT;
@@ -290,9 +273,7 @@ U_CFUNC PHP_FUNCTION(breakiter_current)
object = ZEND_THIS;
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "breakiter_current: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
BREAKITER_METHOD_FETCH_OBJECT;
@@ -324,9 +305,7 @@ U_CFUNC PHP_FUNCTION(breakiter_is_boundary)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l",
&offset) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "breakiter_is_boundary: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (offset < INT32_MIN || offset > INT32_MAX) {
@@ -350,9 +329,7 @@ U_CFUNC PHP_FUNCTION(breakiter_get_locale)
object = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &locale_type) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "breakiter_get_locale: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (locale_type != ULOC_ACTUAL_LOCALE && locale_type != ULOC_VALID_LOCALE) {
@@ -378,9 +355,7 @@ U_CFUNC PHP_FUNCTION(breakiter_get_parts_iterator)
object = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &key_type) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "breakiter_get_parts_iterator: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (key_type != PARTS_ITERATOR_KEY_SEQUENTIAL
@@ -403,9 +378,7 @@ U_CFUNC PHP_FUNCTION(breakiter_get_error_code)
object = ZEND_THIS;
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "breakiter_get_error_code: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* Fetch the object (without resetting its last error code ). */
@@ -423,9 +396,7 @@ U_CFUNC PHP_FUNCTION(breakiter_get_error_message)
object = ZEND_THIS;
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "breakiter_get_error_message: bad arguments", 0 );
- RETURN_FALSE;
+ RETURN_THROWS();
}
diff --git a/ext/intl/breakiterator/breakiterator_methods.h b/ext/intl/breakiterator/breakiterator_methods.h
index cffe767c55..2aef459441 100644
--- a/ext/intl/breakiterator/breakiterator_methods.h
+++ b/ext/intl/breakiterator/breakiterator_methods.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/breakiterator/codepointiterator_internal.cpp b/ext/intl/breakiterator/codepointiterator_internal.cpp
index bf44678efc..082c02d8b2 100644
--- a/ext/intl/breakiterator/codepointiterator_internal.cpp
+++ b/ext/intl/breakiterator/codepointiterator_internal.cpp
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/breakiterator/codepointiterator_internal.h b/ext/intl/breakiterator/codepointiterator_internal.h
index 7ecf12deb5..58666502a1 100644
--- a/ext/intl/breakiterator/codepointiterator_internal.h
+++ b/ext/intl/breakiterator/codepointiterator_internal.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/breakiterator/codepointiterator_methods.cpp b/ext/intl/breakiterator/codepointiterator_methods.cpp
index f1dd0960e6..12df794925 100644
--- a/ext/intl/breakiterator/codepointiterator_methods.cpp
+++ b/ext/intl/breakiterator/codepointiterator_methods.cpp
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -33,9 +31,7 @@ U_CFUNC PHP_FUNCTION(cpbi_get_last_code_point)
object = ZEND_THIS;
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "cpbi_get_last_code_point: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
BREAKITER_METHOD_FETCH_OBJECT;
diff --git a/ext/intl/breakiterator/codepointiterator_methods.h b/ext/intl/breakiterator/codepointiterator_methods.h
index 92f255d704..867326cada 100644
--- a/ext/intl/breakiterator/codepointiterator_methods.h
+++ b/ext/intl/breakiterator/codepointiterator_methods.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp
index 5529d06718..04031733d9 100644
--- a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp
+++ b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -41,11 +39,9 @@ static void _php_intlrbbi_constructor_body(INTERNAL_FUNCTION_PARAMETERS)
UErrorCode status = U_ZERO_ERROR;
intl_error_reset(NULL);
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "s|b",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|b",
&rules, &rules_len, &compiled) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "rbbi_create_instance: bad arguments", 0);
- return;
+ RETURN_THROWS();
}
// instantiation of ICU object
@@ -105,9 +101,7 @@ U_CFUNC PHP_FUNCTION(rbbi_get_rules)
object = ZEND_THIS;
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "rbbi_get_rules: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
BREAKITER_METHOD_FETCH_OBJECT;
@@ -132,9 +126,7 @@ U_CFUNC PHP_FUNCTION(rbbi_get_rule_status)
object = ZEND_THIS;
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "rbbi_get_rule_status: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
BREAKITER_METHOD_FETCH_OBJECT;
@@ -148,9 +140,7 @@ U_CFUNC PHP_FUNCTION(rbbi_get_rule_status_vec)
object = ZEND_THIS;
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "rbbi_get_rule_status_vec: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
BREAKITER_METHOD_FETCH_OBJECT;
@@ -188,9 +178,7 @@ U_CFUNC PHP_FUNCTION(rbbi_get_binary_rules)
object = ZEND_THIS;
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "rbbi_get_binary_rules: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
BREAKITER_METHOD_FETCH_OBJECT;
diff --git a/ext/intl/breakiterator/rulebasedbreakiterator_methods.h b/ext/intl/breakiterator/rulebasedbreakiterator_methods.h
index 3a9209c479..88528f928e 100644
--- a/ext/intl/breakiterator/rulebasedbreakiterator_methods.h
+++ b/ext/intl/breakiterator/rulebasedbreakiterator_methods.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/calendar/calendar.stub.php b/ext/intl/calendar/calendar.stub.php
new file mode 100644
index 0000000000..267035e268
--- /dev/null
+++ b/ext/intl/calendar/calendar.stub.php
@@ -0,0 +1,278 @@
+<?php
+
+class IntlCalendar
+{
+ private function __construct() {}
+
+ /**
+ * @param IntlTimeZone|DateTimeZone|string|null $timeZone
+ * @return IntlCalendar|null
+ */
+ public static function createInstance($timeZone = null, ?string $locale = null) {}
+
+ /** @return bool */
+ public function equals(IntlCalendar $calendar) {}
+
+ /** @return int|false */
+ public function fieldDifference(float $when, int $field) {}
+
+ /** @return bool */
+ public function add(int $field, int $amount) {}
+
+ /** @return bool */
+ public function after(IntlCalendar $calendar) {}
+
+ /** @return bool */
+ public function before(IntlCalendar $calendar) {}
+
+ /** @return bool */
+ public function clear(?int $field = null) {}
+
+ /**
+ * @param DateTime|string $dateTime
+ * @return IntlCalendar|null
+ */
+ public static function fromDateTime($dateTime, ?string $locale = null) {}
+
+ /** @return int|false */
+ public function get(int $field) {}
+
+ /** @return int|false */
+ public function getActualMaximum(int $field) {}
+
+ /** @return int|false */
+ public function getActualMinimum(int $field) {}
+
+ /** @return array */
+ public static function getAvailableLocales() {}
+
+ /** @return int|false */
+ public function getDayOfWeekType(int $dayOfWeek) {}
+
+ /** @return int|false */
+ public function getErrorCode() {}
+
+ /** @return string|false */
+ public function getErrorMessage() {}
+
+ /** @return int|false */
+ public function getFirstDayOfWeek() {}
+
+ /** @return int|false */
+ public function getGreatestMinimum(int $field) {}
+
+ /** @return IntlIterator|false */
+ public static function getKeywordValuesForLocale(string $key, string $locale, bool $commonlyUsed) {}
+
+ /** @return int|false */
+ public function getLeastMaximum(int $field) {}
+
+ /** @return string|false */
+ public function getLocale(int $localeType) {}
+
+ /** @return int|false */
+ public function getMaximum(int $field) {}
+
+ /** @return int|false */
+ public function getMinimalDaysInFirstWeek() {}
+
+ /** @return bool */
+ public function setMinimalDaysInFirstWeek(int $numberOfDays) {}
+
+ /** @return int|false */
+ public function getMinimum(int $field) {}
+
+ /** @return float */
+ public static function getNow() {}
+
+ /** @return int */
+ public function getRepeatedWallTimeOption() {}
+
+ /** @return int */
+ public function getSkippedWallTimeOption() {}
+
+ /** @return float|false */
+ public function getTime() {}
+
+ /** @return IntlTimeZone|false */
+ public function getTimeZone() {}
+
+ /** @return string */
+ public function getType() {}
+
+ /** @return int|false */
+ public function getWeekendTransition(int $dayOfWeek) {}
+
+ /** @return bool */
+ public function inDaylightTime() {}
+
+ /** @return bool */
+ public function isEquivalentTo(IntlCalendar $calendar) {}
+
+ /** @return bool */
+ public function isLenient() {}
+
+ /** @return bool */
+ public function isWeekend(?float $date = null) {}
+
+ /**
+ * @param int|bool $amountOrUpOrDown
+ * @return bool
+ */
+ public function roll(int $field, $amountOrUpOrDown) {}
+
+ /** @return bool */
+ public function isSet(int $field) {}
+
+ /** @return bool */
+ public function set(int $year, int $month, int $dayOfMonth = UNKNOWN, $hour = UNKNOWN, int $minute = UNKNOWN, int $second = UNKNOWN) {}
+
+ /** @return bool */
+ public function setFirstDayOfWeek(int $dayOfWeek) {}
+
+ /** @return bool */
+ public function setLenient(bool $isLenient) {}
+
+ /** @return bool */
+ public function setRepeatedWallTimeOption(int $wallTimeOption) {}
+
+ /** @return bool */
+ public function setSkippedWallTimeOption(int $wallTimeOption) {}
+
+ /** @return bool */
+ public function setTime(float $date) {}
+
+ /**
+ * @param IntlTimeZone|DateTimeZone|string|null $timeZone
+ * @return bool
+ */
+ public function setTimeZone($timeZone) {}
+
+ /** @return DateTime|false */
+ public function toDateTime() {}
+}
+
+class IntlGregorianCalendar extends IntlCalendar
+{
+ public function __construct() {}
+
+ /**
+ * @param IntlTimeZone|DateTimeZone|string|null $timeZone
+ * @return IntlGregorianCalendar|null
+ */
+ public static function createInstance($timeZone = null, ?string $locale = null) {}
+
+ /** @return bool */
+ public function setGregorianChange(float $change) {}
+
+ /** @return float|false */
+ public function getGregorianChange() {}
+
+ /** @return bool */
+ public function isLeapYear(int $year) {}
+}
+
+/** @param IntlTimeZone|DateTimeZone|string|null $timeZone */
+function intlcal_create_instance($timeZone = null, ?string $locale = null): IntlCalendar|null {}
+
+function intlcal_get_keyword_values_for_locale(string $key, string $locale, bool $commonlyUsed): IntlIterator|false {}
+
+function intlcal_get_now(): float {}
+
+function intlcal_get_available_locales(): array {}
+
+function intlcal_get(IntlCalendar $calendar, int $field): int|false {}
+
+function intlcal_get_time(IntlCalendar $calendar): float|false {}
+
+function intlcal_set_time(IntlCalendar $calendar, float $date): bool {}
+
+function intlcal_add(IntlCalendar $calendar, int $field, int $amount): bool {}
+
+/** @param IntlTimeZone|DateTimeZone|string|null $timeZone */
+function intlcal_set_time_zone(IntlCalendar $calendar, $timeZone): bool {}
+
+function intlcal_after(IntlCalendar $calendarObject, IntlCalendar $calendar): bool {}
+
+function intlcal_before(IntlCalendar $calendarObject, IntlCalendar $calendar): bool {}
+
+function intlcal_set(IntlCalendar $calendar, int $year, int $month, int $dayOfMonth = UNKNOWN, $hour = UNKNOWN, int $minute = UNKNOWN, int $second = UNKNOWN): bool {}
+
+/** @param int|bool $amountOrUpOrDown */
+function intlcal_roll(IntlCalendar $calendar, int $field, $amountOrUpOrDown): bool {}
+
+function intlcal_clear(IntlCalendar $calendar, ?int $field = null): bool {}
+
+function intlcal_field_difference(IntlCalendar $calendar, float $when, int $field): int|false {}
+
+function intlcal_get_actual_maximum(IntlCalendar $calendar, int $field): int|false {}
+
+function intlcal_get_actual_minimum(IntlCalendar $calendar, int $field): int|false {}
+
+function intlcal_get_day_of_week_type(IntlCalendar $calendar, int $dayOfWeek): int|false {}
+
+function intlcal_get_first_day_of_week(IntlCalendar $calendar): int|false {}
+
+function intlcal_greatest_minimum(IntlCalendar $calendar, int $field): int|false {}
+
+function intlcal_get_least_maximum(IntlCalendar $calendar, int $field): int|false {}
+
+function intlcal_get_greatest_minimum(IntlCalendar $calendar, int $field): int|false {}
+
+function intlcal_get_locale(IntlCalendar $calendar, int $localeType): string|false {}
+
+function intlcal_get_maximum(IntlCalendar $calendar, int $field): int|false {}
+
+function intlcal_get_minimal_days_in_first_week(IntlCalendar $calendar): int|false {}
+
+function intlcal_set_minimal_days_in_first_week(IntlCalendar $calendar, int $numberOfDays): bool {}
+
+function intlcal_get_minimum(IntlCalendar $calendar, int $field): int|false {}
+
+function intlcal_get_time_zone(IntlCalendar $calendar): IntlTimeZone|false {}
+
+function intlcal_get_type(IntlCalendar $calendar): string {}
+
+function intlcal_get_weekend_transition(IntlCalendar $calendar, int $dayOfWeek): int|false {}
+
+function intlcal_in_daylight_time(IntlCalendar $calendar): bool {}
+
+function intlcal_is_lenient(IntlCalendar $calendar): bool {}
+
+function intlcal_is_set(IntlCalendar $calendar, int $field): bool {}
+
+function intlcal_is_equivalent_to(IntlCalendar $calendarObject, IntlCalendar $calendar): bool {}
+
+function intlcal_is_weekend(IntlCalendar $calendar, ?float $date = null): bool {}
+
+function intlcal_set_first_day_of_week(IntlCalendar $calendar, int $dayOfWeek): bool {}
+
+function intlcal_set_lenient(IntlCalendar $calendar, bool $isLenient): bool {}
+
+function intlcal_get_repeated_wall_time_option(IntlCalendar $calendar): int {}
+
+function intlcal_equals(IntlCalendar $calendarObject, IntlCalendar $calendar): bool {}
+
+function intlcal_get_skipped_wall_time_option(IntlCalendar $calendar): int {}
+
+function intlcal_set_repeated_wall_time_option(IntlCalendar $calendar, int $wallTimeOption): bool {}
+
+function intlcal_set_skipped_wall_time_option(IntlCalendar $calendar, int $wallTimeOption): bool {}
+
+/** @param DateTime|string $dateTime */
+function intlcal_from_date_time($dateTime, ?string $locale = null): ?IntlCalendar {}
+
+function intlcal_to_date_time(IntlCalendar $calendar): DateTime|false {}
+
+function intlcal_get_error_code(IntlCalendar $calendar): int|false {}
+
+function intlcal_get_error_message(IntlCalendar $calendar): string|false {}
+
+/** @param IntlTimeZone|DateTimeZone|string|null $timeZone */
+function intlgregcal_create_instance($timeZone = null, ?string $locale = null): ?IntlGregorianCalendar {}
+
+function intlgregcal_set_gregorian_change(IntlGregorianCalendar $calendar, float $change): bool {}
+
+function intlgregcal_get_gregorian_change(IntlGregorianCalendar $calendar): float|false {}
+
+function intlgregcal_is_leap_year(IntlGregorianCalendar $calendar, int $year): bool {}
diff --git a/ext/intl/calendar/calendar_arginfo.h b/ext/intl/calendar/calendar_arginfo.h
new file mode 100644
index 0000000000..efe89030ec
--- /dev/null
+++ b/ext/intl/calendar/calendar_arginfo.h
@@ -0,0 +1,354 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlCalendar___construct, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlCalendar_createInstance, 0, 0, 0)
+ ZEND_ARG_INFO(0, timeZone)
+ ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlCalendar_equals, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, calendar, IntlCalendar, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlCalendar_fieldDifference, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, when, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, field, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlCalendar_add, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, field, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, amount, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_IntlCalendar_after arginfo_class_IntlCalendar_equals
+
+#define arginfo_class_IntlCalendar_before arginfo_class_IntlCalendar_equals
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlCalendar_clear, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, field, IS_LONG, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlCalendar_fromDateTime, 0, 0, 1)
+ ZEND_ARG_INFO(0, dateTime)
+ ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlCalendar_get, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, field, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_IntlCalendar_getActualMaximum arginfo_class_IntlCalendar_get
+
+#define arginfo_class_IntlCalendar_getActualMinimum arginfo_class_IntlCalendar_get
+
+#define arginfo_class_IntlCalendar_getAvailableLocales arginfo_class_IntlCalendar___construct
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlCalendar_getDayOfWeekType, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, dayOfWeek, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_IntlCalendar_getErrorCode arginfo_class_IntlCalendar___construct
+
+#define arginfo_class_IntlCalendar_getErrorMessage arginfo_class_IntlCalendar___construct
+
+#define arginfo_class_IntlCalendar_getFirstDayOfWeek arginfo_class_IntlCalendar___construct
+
+#define arginfo_class_IntlCalendar_getGreatestMinimum arginfo_class_IntlCalendar_get
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlCalendar_getKeywordValuesForLocale, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, commonlyUsed, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_IntlCalendar_getLeastMaximum arginfo_class_IntlCalendar_get
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlCalendar_getLocale, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, localeType, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_IntlCalendar_getMaximum arginfo_class_IntlCalendar_get
+
+#define arginfo_class_IntlCalendar_getMinimalDaysInFirstWeek arginfo_class_IntlCalendar___construct
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlCalendar_setMinimalDaysInFirstWeek, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, numberOfDays, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_IntlCalendar_getMinimum arginfo_class_IntlCalendar_get
+
+#define arginfo_class_IntlCalendar_getNow arginfo_class_IntlCalendar___construct
+
+#define arginfo_class_IntlCalendar_getRepeatedWallTimeOption arginfo_class_IntlCalendar___construct
+
+#define arginfo_class_IntlCalendar_getSkippedWallTimeOption arginfo_class_IntlCalendar___construct
+
+#define arginfo_class_IntlCalendar_getTime arginfo_class_IntlCalendar___construct
+
+#define arginfo_class_IntlCalendar_getTimeZone arginfo_class_IntlCalendar___construct
+
+#define arginfo_class_IntlCalendar_getType arginfo_class_IntlCalendar___construct
+
+#define arginfo_class_IntlCalendar_getWeekendTransition arginfo_class_IntlCalendar_getDayOfWeekType
+
+#define arginfo_class_IntlCalendar_inDaylightTime arginfo_class_IntlCalendar___construct
+
+#define arginfo_class_IntlCalendar_isEquivalentTo arginfo_class_IntlCalendar_equals
+
+#define arginfo_class_IntlCalendar_isLenient arginfo_class_IntlCalendar___construct
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlCalendar_isWeekend, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, date, IS_DOUBLE, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlCalendar_roll, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, field, IS_LONG, 0)
+ ZEND_ARG_INFO(0, amountOrUpOrDown)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_IntlCalendar_isSet arginfo_class_IntlCalendar_get
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlCalendar_set, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, year, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, month, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, dayOfMonth, IS_LONG, 0)
+ ZEND_ARG_INFO(0, hour)
+ ZEND_ARG_TYPE_INFO(0, minute, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, second, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_IntlCalendar_setFirstDayOfWeek arginfo_class_IntlCalendar_getDayOfWeekType
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlCalendar_setLenient, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, isLenient, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlCalendar_setRepeatedWallTimeOption, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, wallTimeOption, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_IntlCalendar_setSkippedWallTimeOption arginfo_class_IntlCalendar_setRepeatedWallTimeOption
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlCalendar_setTime, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, date, IS_DOUBLE, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlCalendar_setTimeZone, 0, 0, 1)
+ ZEND_ARG_INFO(0, timeZone)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_IntlCalendar_toDateTime arginfo_class_IntlCalendar___construct
+
+#define arginfo_class_IntlGregorianCalendar___construct arginfo_class_IntlCalendar___construct
+
+#define arginfo_class_IntlGregorianCalendar_createInstance arginfo_class_IntlCalendar_createInstance
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlGregorianCalendar_setGregorianChange, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, change, IS_DOUBLE, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_IntlGregorianCalendar_getGregorianChange arginfo_class_IntlCalendar___construct
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlGregorianCalendar_isLeapYear, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, year, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_intlcal_create_instance, 0, 0, IntlCalendar, 1)
+ ZEND_ARG_INFO(0, timeZone)
+ ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_intlcal_get_keyword_values_for_locale, 0, 3, IntlIterator, MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, commonlyUsed, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_intlcal_get_now, 0, 0, IS_DOUBLE, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_intlcal_get_available_locales, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_intlcal_get, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, calendar, IntlCalendar, 0)
+ ZEND_ARG_TYPE_INFO(0, field, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_intlcal_get_time, 0, 1, MAY_BE_DOUBLE|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, calendar, IntlCalendar, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_intlcal_set_time, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, calendar, IntlCalendar, 0)
+ ZEND_ARG_TYPE_INFO(0, date, IS_DOUBLE, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_intlcal_add, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, calendar, IntlCalendar, 0)
+ ZEND_ARG_TYPE_INFO(0, field, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, amount, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_intlcal_set_time_zone, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, calendar, IntlCalendar, 0)
+ ZEND_ARG_INFO(0, timeZone)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_intlcal_after, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, calendarObject, IntlCalendar, 0)
+ ZEND_ARG_OBJ_INFO(0, calendar, IntlCalendar, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_intlcal_before arginfo_intlcal_after
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_intlcal_set, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, calendar, IntlCalendar, 0)
+ ZEND_ARG_TYPE_INFO(0, year, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, month, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, dayOfMonth, IS_LONG, 0)
+ ZEND_ARG_INFO(0, hour)
+ ZEND_ARG_TYPE_INFO(0, minute, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, second, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_intlcal_roll, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, calendar, IntlCalendar, 0)
+ ZEND_ARG_TYPE_INFO(0, field, IS_LONG, 0)
+ ZEND_ARG_INFO(0, amountOrUpOrDown)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_intlcal_clear, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, calendar, IntlCalendar, 0)
+ ZEND_ARG_TYPE_INFO(0, field, IS_LONG, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_intlcal_field_difference, 0, 3, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, calendar, IntlCalendar, 0)
+ ZEND_ARG_TYPE_INFO(0, when, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, field, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_intlcal_get_actual_maximum arginfo_intlcal_get
+
+#define arginfo_intlcal_get_actual_minimum arginfo_intlcal_get
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_intlcal_get_day_of_week_type, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, calendar, IntlCalendar, 0)
+ ZEND_ARG_TYPE_INFO(0, dayOfWeek, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_intlcal_get_first_day_of_week, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, calendar, IntlCalendar, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_intlcal_greatest_minimum arginfo_intlcal_get
+
+#define arginfo_intlcal_get_least_maximum arginfo_intlcal_get
+
+#define arginfo_intlcal_get_greatest_minimum arginfo_intlcal_get
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_intlcal_get_locale, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, calendar, IntlCalendar, 0)
+ ZEND_ARG_TYPE_INFO(0, localeType, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_intlcal_get_maximum arginfo_intlcal_get
+
+#define arginfo_intlcal_get_minimal_days_in_first_week arginfo_intlcal_get_first_day_of_week
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_intlcal_set_minimal_days_in_first_week, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, calendar, IntlCalendar, 0)
+ ZEND_ARG_TYPE_INFO(0, numberOfDays, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_intlcal_get_minimum arginfo_intlcal_get
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_intlcal_get_time_zone, 0, 1, IntlTimeZone, MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, calendar, IntlCalendar, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_intlcal_get_type, 0, 1, IS_STRING, 0)
+ ZEND_ARG_OBJ_INFO(0, calendar, IntlCalendar, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_intlcal_get_weekend_transition arginfo_intlcal_get_day_of_week_type
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_intlcal_in_daylight_time, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, calendar, IntlCalendar, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_intlcal_is_lenient arginfo_intlcal_in_daylight_time
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_intlcal_is_set, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, calendar, IntlCalendar, 0)
+ ZEND_ARG_TYPE_INFO(0, field, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_intlcal_is_equivalent_to arginfo_intlcal_after
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_intlcal_is_weekend, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, calendar, IntlCalendar, 0)
+ ZEND_ARG_TYPE_INFO(0, date, IS_DOUBLE, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_intlcal_set_first_day_of_week, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, calendar, IntlCalendar, 0)
+ ZEND_ARG_TYPE_INFO(0, dayOfWeek, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_intlcal_set_lenient, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, calendar, IntlCalendar, 0)
+ ZEND_ARG_TYPE_INFO(0, isLenient, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_intlcal_get_repeated_wall_time_option, 0, 1, IS_LONG, 0)
+ ZEND_ARG_OBJ_INFO(0, calendar, IntlCalendar, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_intlcal_equals arginfo_intlcal_after
+
+#define arginfo_intlcal_get_skipped_wall_time_option arginfo_intlcal_get_repeated_wall_time_option
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_intlcal_set_repeated_wall_time_option, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, calendar, IntlCalendar, 0)
+ ZEND_ARG_TYPE_INFO(0, wallTimeOption, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_intlcal_set_skipped_wall_time_option arginfo_intlcal_set_repeated_wall_time_option
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_intlcal_from_date_time, 0, 1, IntlCalendar, 1)
+ ZEND_ARG_INFO(0, dateTime)
+ ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_intlcal_to_date_time, 0, 1, DateTime, MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, calendar, IntlCalendar, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_intlcal_get_error_code arginfo_intlcal_get_first_day_of_week
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_intlcal_get_error_message, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, calendar, IntlCalendar, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_intlgregcal_create_instance, 0, 0, IntlGregorianCalendar, 1)
+ ZEND_ARG_INFO(0, timeZone)
+ ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_intlgregcal_set_gregorian_change, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, calendar, IntlGregorianCalendar, 0)
+ ZEND_ARG_TYPE_INFO(0, change, IS_DOUBLE, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_intlgregcal_get_gregorian_change, 0, 1, MAY_BE_DOUBLE|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, calendar, IntlGregorianCalendar, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_intlgregcal_is_leap_year, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, calendar, IntlGregorianCalendar, 0)
+ ZEND_ARG_TYPE_INFO(0, year, IS_LONG, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/intl/calendar/calendar_class.cpp b/ext/intl/calendar/calendar_class.cpp
index 29eb9eef44..62cf907c49 100644
--- a/ext/intl/calendar/calendar_class.cpp
+++ b/ext/intl/calendar/calendar_class.cpp
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -29,6 +27,7 @@ extern "C" {
#define USE_CALENDAR_POINTER 1
#include "calendar_class.h"
#include "calendar_methods.h"
+#include "calendar_arginfo.h"
#include "gregoriancalendar_methods.h"
#include <zend_exceptions.h>
#include <assert.h>
@@ -78,17 +77,17 @@ U_CFUNC void calendar_object_construct(zval *object,
}
/* {{{ clone handler for Calendar */
-static zend_object *Calendar_clone_obj(zval *object)
+static zend_object *Calendar_clone_obj(zend_object *object)
{
Calendar_object *co_orig,
*co_new;
zend_object *ret_val;
intl_error_reset(NULL);
- co_orig = Z_INTL_CALENDAR_P(object);
+ co_orig = php_intl_calendar_fetch_object(object);
intl_error_reset(INTL_DATA_ERROR_P(co_orig));
- ret_val = Calendar_ce_ptr->create_object(Z_OBJCE_P(object));
+ ret_val = Calendar_ce_ptr->create_object(object->ce);
co_new = php_intl_calendar_fetch_object(ret_val);
zend_objects_clone_members(&co_new->zo, &co_orig->zo);
@@ -147,7 +146,7 @@ static const struct {
};
/* {{{ get_debug_info handler for Calendar */
-static HashTable *Calendar_get_debug_info(zval *object, int *is_temp)
+static HashTable *Calendar_get_debug_info(zend_object *object, int *is_temp)
{
zval zv,
zfields;
@@ -159,7 +158,7 @@ static HashTable *Calendar_get_debug_info(zval *object, int *is_temp)
debug_info = zend_new_array(8);
- co = Z_INTL_CALENDAR_P(object);
+ co = php_intl_calendar_fetch_object(object);
cal = co->ucal;
if (cal == NULL) {
@@ -179,7 +178,7 @@ static HashTable *Calendar_get_debug_info(zval *object, int *is_temp)
HashTable *debug_info_tz;
timezone_object_construct(&cal->getTimeZone(), &ztz , 0);
- debug_info_tz = Z_OBJ_HANDLER(ztz, get_debug_info)(&ztz, &is_tmp);
+ debug_info_tz = Z_OBJ_HANDLER(ztz, get_debug_info)(Z_OBJ(ztz), &is_tmp);
assert(is_tmp == 1);
array_init(&ztz_debug);
@@ -266,161 +265,58 @@ static zend_object *Calendar_object_create(zend_class_entry *ce)
}
/* }}} */
-/* {{{ Calendar methods arguments info */
-
-ZEND_BEGIN_ARG_INFO_EX(ainfo_cal_void, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ainfo_cal_field, 0, 0, 1)
- ZEND_ARG_INFO(0, field)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ainfo_cal_dow, 0, 0, 1)
- ZEND_ARG_INFO(0, dayOfWeek)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ainfo_cal_other_cal, 0, 0, 1)
- ZEND_ARG_OBJ_INFO(0, calendar, IntlCalendar, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ainfo_cal_date, 0, 0, 1)
- ZEND_ARG_INFO(0, date)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ainfo_cal_date_optional, 0, 0, 0)
- ZEND_ARG_INFO(0, date)
-ZEND_END_ARG_INFO()
-
-
-ZEND_BEGIN_ARG_INFO_EX(ainfo_cal_createInstance, 0, 0, 0)
- ZEND_ARG_INFO(0, timeZone)
- ZEND_ARG_INFO(0, locale)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ainfo_cal_get_keyword_values_for_locale, 0, 0, 3)
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, locale)
- ZEND_ARG_INFO(0, commonlyUsed)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ainfo_cal_add, 0, 0, 2)
- ZEND_ARG_INFO(0, field)
- ZEND_ARG_INFO(0, amount)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ainfo_cal_setTimeZone, 0, 0, 1)
- ZEND_ARG_INFO(0, timeZone)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ainfo_cal_set, 0, 0, 2)
- ZEND_ARG_INFO(0, fieldOrYear)
- ZEND_ARG_INFO(0, valueOrMonth)
- ZEND_ARG_INFO(0, dayOfMonth)
- ZEND_ARG_INFO(0, hour)
- ZEND_ARG_INFO(0, minute)
- ZEND_ARG_INFO(0, second)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ainfo_cal_roll, 0, 0, 2)
- ZEND_ARG_INFO(0, field)
- ZEND_ARG_INFO(0, amountOrUpOrDown)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ainfo_cal_clear, 0, 0, 0)
- ZEND_ARG_INFO(0, field)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ainfo_cal_field_difference, 0, 0, 2)
- ZEND_ARG_INFO(0, when)
- ZEND_ARG_INFO(0, field)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ainfo_cal_get_locale, 0, 0, 1)
- ZEND_ARG_INFO(0, localeType)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ainfo_cal_setLenient, 0, 0, 1)
- ZEND_ARG_INFO(0, isLenient)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ainfo_cal_set_minimal_days_in_first_week, 0, 0, 1)
- ZEND_ARG_INFO(0, numberOfDays)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ainfo_cal_from_date_time, 0, 0, 1)
- ZEND_ARG_INFO(0, dateTime)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ainfo_cal_wall_time_option, 0, 0, 1)
- ZEND_ARG_INFO(0, wallTimeOption)
-ZEND_END_ARG_INFO()
-
-/* Gregorian Calendar */
-ZEND_BEGIN_ARG_INFO_EX(ainfo_gregcal___construct, 0, 0, 0)
- ZEND_ARG_INFO(0, timeZoneOrYear)
- ZEND_ARG_INFO(0, localeOrMonth)
- ZEND_ARG_INFO(0, dayOfMonth)
- ZEND_ARG_INFO(0, hour)
- ZEND_ARG_INFO(0, minute)
- ZEND_ARG_INFO(0, second)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ainfo_gregcal_isLeapYear, 0, 0, 1)
- ZEND_ARG_INFO(0, year)
-ZEND_END_ARG_INFO()
-
-/* }}} */
-
/* {{{ Calendar_class_functions
* Every 'IntlCalendar' class method has an entry in this table
*/
static const zend_function_entry Calendar_class_functions[] = {
- PHP_ME(IntlCalendar, __construct, ainfo_cal_void, ZEND_ACC_PRIVATE)
- PHP_ME_MAPPING(createInstance, intlcal_create_instance, ainfo_cal_createInstance, ZEND_ACC_STATIC | ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(getKeywordValuesForLocale, intlcal_get_keyword_values_for_locale, ainfo_cal_get_keyword_values_for_locale, ZEND_ACC_STATIC | ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(getNow, intlcal_get_now, ainfo_cal_void, ZEND_ACC_STATIC | ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(getAvailableLocales, intlcal_get_available_locales, ainfo_cal_void, ZEND_ACC_STATIC | ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(get, intlcal_get, ainfo_cal_field, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(getTime, intlcal_get_time, ainfo_cal_void, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(setTime, intlcal_set_time, ainfo_cal_date, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(add, intlcal_add, ainfo_cal_add, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(setTimeZone, intlcal_set_time_zone, ainfo_cal_setTimeZone, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(after, intlcal_after, ainfo_cal_other_cal, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(before, intlcal_before, ainfo_cal_other_cal, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(set, intlcal_set, ainfo_cal_set, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(roll, intlcal_roll, ainfo_cal_roll, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(clear, intlcal_clear, ainfo_cal_clear, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(fieldDifference, intlcal_field_difference, ainfo_cal_field_difference, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(getActualMaximum, intlcal_get_actual_maximum, ainfo_cal_field, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(getActualMinimum, intlcal_get_actual_minimum, ainfo_cal_field, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(getDayOfWeekType, intlcal_get_day_of_week_type, ainfo_cal_dow, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(getFirstDayOfWeek, intlcal_get_first_day_of_week, ainfo_cal_void, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(getGreatestMinimum, intlcal_get_greatest_minimum, ainfo_cal_field, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(getLeastMaximum, intlcal_get_least_maximum, ainfo_cal_field, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(getLocale, intlcal_get_locale, ainfo_cal_get_locale, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(getMaximum, intlcal_get_maximum, ainfo_cal_field, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(getMinimalDaysInFirstWeek, intlcal_get_minimal_days_in_first_week, ainfo_cal_void, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(getMinimum, intlcal_get_minimum, ainfo_cal_field, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(getTimeZone, intlcal_get_time_zone, ainfo_cal_void, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(getType, intlcal_get_type, ainfo_cal_void, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(getWeekendTransition,intlcal_get_weekend_transition, ainfo_cal_dow, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(inDaylightTime, intlcal_in_daylight_time, ainfo_cal_void, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(isEquivalentTo, intlcal_is_equivalent_to, ainfo_cal_other_cal, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(isLenient, intlcal_is_lenient, ainfo_cal_void, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(isSet, intlcal_is_set, ainfo_cal_field, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(isWeekend, intlcal_is_weekend, ainfo_cal_date_optional, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(setFirstDayOfWeek, intlcal_set_first_day_of_week, ainfo_cal_dow, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(setLenient, intlcal_set_lenient, ainfo_cal_setLenient, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(setMinimalDaysInFirstWeek,intlcal_set_minimal_days_in_first_week,ainfo_cal_set_minimal_days_in_first_week,ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(equals, intlcal_equals, ainfo_cal_other_cal, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(getRepeatedWallTimeOption,intlcal_get_repeated_wall_time_option,ainfo_cal_void, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(getSkippedWallTimeOption,intlcal_get_skipped_wall_time_option,ainfo_cal_void, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(setRepeatedWallTimeOption,intlcal_set_repeated_wall_time_option,ainfo_cal_wall_time_option,ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(setSkippedWallTimeOption,intlcal_set_skipped_wall_time_option,ainfo_cal_wall_time_option,ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(fromDateTime, intlcal_from_date_time, ainfo_cal_from_date_time, ZEND_ACC_STATIC | ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(toDateTime, intlcal_to_date_time, ainfo_cal_void, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(getErrorCode, intlcal_get_error_code, ainfo_cal_void, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(getErrorMessage, intlcal_get_error_message, ainfo_cal_void, ZEND_ACC_PUBLIC)
+ PHP_ME(IntlCalendar, __construct, arginfo_class_IntlCalendar___construct, ZEND_ACC_PRIVATE)
+ PHP_ME_MAPPING(createInstance, intlcal_create_instance, arginfo_class_IntlCalendar_createInstance, ZEND_ACC_STATIC | ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(getKeywordValuesForLocale, intlcal_get_keyword_values_for_locale, arginfo_class_IntlCalendar_getKeywordValuesForLocale, ZEND_ACC_STATIC | ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(getNow, intlcal_get_now, arginfo_class_IntlCalendar_getNow, ZEND_ACC_STATIC | ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(getAvailableLocales, intlcal_get_available_locales, arginfo_class_IntlCalendar_getAvailableLocales, ZEND_ACC_STATIC | ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(get, intlcal_get, arginfo_class_IntlCalendar_get, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(getTime, intlcal_get_time, arginfo_class_IntlCalendar_getTime, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(setTime, intlcal_set_time, arginfo_class_IntlCalendar_setTime, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(add, intlcal_add, arginfo_class_IntlCalendar_add, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(setTimeZone, intlcal_set_time_zone, arginfo_class_IntlCalendar_setTimeZone, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(after, intlcal_after, arginfo_class_IntlCalendar_after, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(before, intlcal_before, arginfo_class_IntlCalendar_before, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(set, intlcal_set, arginfo_class_IntlCalendar_set, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(roll, intlcal_roll, arginfo_class_IntlCalendar_roll, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(clear, intlcal_clear, arginfo_class_IntlCalendar_clear, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(fieldDifference, intlcal_field_difference, arginfo_class_IntlCalendar_fieldDifference, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(getActualMaximum, intlcal_get_actual_maximum, arginfo_class_IntlCalendar_getActualMaximum, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(getActualMinimum, intlcal_get_actual_minimum, arginfo_class_IntlCalendar_getActualMinimum, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(getDayOfWeekType, intlcal_get_day_of_week_type, arginfo_class_IntlCalendar_getDayOfWeekType, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(getFirstDayOfWeek, intlcal_get_first_day_of_week, arginfo_class_IntlCalendar_getFirstDayOfWeek, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(getGreatestMinimum, intlcal_get_greatest_minimum, arginfo_class_IntlCalendar_getGreatestMinimum, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(getLeastMaximum, intlcal_get_least_maximum, arginfo_class_IntlCalendar_getLeastMaximum, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(getLocale, intlcal_get_locale, arginfo_class_IntlCalendar_getLocale, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(getMaximum, intlcal_get_maximum, arginfo_class_IntlCalendar_getMaximum, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(getMinimalDaysInFirstWeek, intlcal_get_minimal_days_in_first_week, arginfo_class_IntlCalendar_getMinimalDaysInFirstWeek, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(getMinimum, intlcal_get_minimum, arginfo_class_IntlCalendar_getMinimum, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(getTimeZone, intlcal_get_time_zone, arginfo_class_IntlCalendar_getTimeZone, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(getType, intlcal_get_type, arginfo_class_IntlCalendar_getType, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(getWeekendTransition,intlcal_get_weekend_transition, arginfo_class_IntlCalendar_getWeekendTransition, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(inDaylightTime, intlcal_in_daylight_time, arginfo_class_IntlCalendar_inDaylightTime, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(isEquivalentTo, intlcal_is_equivalent_to, arginfo_class_IntlCalendar_isEquivalentTo, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(isLenient, intlcal_is_lenient, arginfo_class_IntlCalendar_isLenient, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(isSet, intlcal_is_set, arginfo_class_IntlCalendar_isSet, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(isWeekend, intlcal_is_weekend, arginfo_class_IntlCalendar_isWeekend, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(setFirstDayOfWeek, intlcal_set_first_day_of_week, arginfo_class_IntlCalendar_setFirstDayOfWeek, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(setLenient, intlcal_set_lenient, arginfo_class_IntlCalendar_setLenient, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(setMinimalDaysInFirstWeek,intlcal_set_minimal_days_in_first_week, arginfo_class_IntlCalendar_setMinimalDaysInFirstWeek, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(equals, intlcal_equals, arginfo_class_IntlCalendar_equals, ZEND_ACC_PUBLIC)
+
+ PHP_ME_MAPPING(getRepeatedWallTimeOption, intlcal_get_repeated_wall_time_option, arginfo_class_IntlCalendar_getRepeatedWallTimeOption, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(getSkippedWallTimeOption, intlcal_get_skipped_wall_time_option, arginfo_class_IntlCalendar_getSkippedWallTimeOption, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(setRepeatedWallTimeOption, intlcal_set_repeated_wall_time_option, arginfo_class_IntlCalendar_setRepeatedWallTimeOption, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(setSkippedWallTimeOption, intlcal_set_skipped_wall_time_option, arginfo_class_IntlCalendar_setSkippedWallTimeOption, ZEND_ACC_PUBLIC)
+
+ PHP_ME_MAPPING(fromDateTime, intlcal_from_date_time, arginfo_class_IntlCalendar_fromDateTime, ZEND_ACC_STATIC | ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(toDateTime, intlcal_to_date_time, arginfo_class_IntlCalendar_toDateTime, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(getErrorCode, intlcal_get_error_code, arginfo_class_IntlCalendar_getErrorCode, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(getErrorMessage, intlcal_get_error_message, arginfo_class_IntlCalendar_getErrorMessage, ZEND_ACC_PUBLIC)
PHP_FE_END
};
/* }}} */
@@ -428,10 +324,10 @@ static const zend_function_entry Calendar_class_functions[] = {
/* {{{ GregorianCalendar_class_functions
*/
static const zend_function_entry GregorianCalendar_class_functions[] = {
- PHP_ME(IntlGregorianCalendar, __construct, ainfo_gregcal___construct, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(setGregorianChange, intlgregcal_set_gregorian_change, ainfo_cal_date, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(getGregorianChange, intlgregcal_get_gregorian_change, ainfo_cal_void, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(isLeapYear, intlgregcal_is_leap_year, ainfo_gregcal_isLeapYear, ZEND_ACC_PUBLIC)
+ PHP_ME(IntlGregorianCalendar, __construct, arginfo_class_IntlGregorianCalendar___construct, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(setGregorianChange, intlgregcal_set_gregorian_change, arginfo_class_IntlGregorianCalendar_setGregorianChange, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(getGregorianChange, intlgregcal_get_gregorian_change, arginfo_class_IntlGregorianCalendar_getGregorianChange, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(isLeapYear, intlgregcal_is_leap_year, arginfo_class_IntlGregorianCalendar_isLeapYear, ZEND_ACC_PUBLIC)
PHP_FE_END
};
/* }}} */
diff --git a/ext/intl/calendar/calendar_class.h b/ext/intl/calendar/calendar_class.h
index 33cd7bc8e3..a4d5236307 100644
--- a/ext/intl/calendar/calendar_class.h
+++ b/ext/intl/calendar/calendar_class.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -57,8 +55,8 @@ static inline Calendar_object *php_intl_calendar_fetch_object(zend_object *obj)
CALENDAR_METHOD_FETCH_OBJECT_NO_CHECK; \
if (co->ucal == NULL) \
{ \
- intl_errors_set(&co->err, U_ILLEGAL_ARGUMENT_ERROR, "Found unconstructed IntlCalendar", 0); \
- RETURN_FALSE; \
+ zend_throw_error(NULL, "Found unconstructed IntlCalendar"); \
+ RETURN_THROWS(); \
}
void calendar_object_create(zval *object, Calendar *calendar);
diff --git a/ext/intl/calendar/calendar_methods.cpp b/ext/intl/calendar/calendar_methods.cpp
index a85f557af6..473e459d13 100644
--- a/ext/intl/calendar/calendar_methods.cpp
+++ b/ext/intl/calendar/calendar_methods.cpp
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -63,9 +61,7 @@ U_CFUNC PHP_FUNCTION(intlcal_create_instance)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|zs!",
&zv_timezone, &locale_str, &dummy) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_create_calendar: bad arguments", 0);
- RETURN_NULL();
+ RETURN_THROWS();
}
timeZone = timezone_process_timezone_argument(zv_timezone, NULL,
@@ -154,9 +150,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_keyword_values_for_locale)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ssb",
&key, &key_len, &locale, &locale_len, &commonly_used) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_get_keyword_values_for_locale: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
//does not work; see ICU bug 9194
@@ -190,9 +184,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_now)
intl_error_reset(NULL);
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_get_now: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
RETURN_DOUBLE((double)Calendar::getNow());
@@ -203,9 +195,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_available_locales)
intl_error_reset(NULL);
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_get_available_locales: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
int32_t count;
@@ -228,10 +218,7 @@ static void _php_intlcal_field_uec_ret_in32t_method(
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"Ol", &object, Calendar_ce_ptr, &field) == FAILURE) {
- spprintf(&message, 0, "%s: bad arguments", method_name);
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, message, 1);
- efree(message);
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (field < 0 || field >= UCAL_FIELD_COUNT) {
@@ -262,9 +249,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_time)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O",
&object, Calendar_ce_ptr) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_get_time: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
CALENDAR_METHOD_FETCH_OBJECT;
@@ -283,9 +268,7 @@ U_CFUNC PHP_FUNCTION(intlcal_set_time)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Od",
&object, Calendar_ce_ptr, &time_arg) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_set_time: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
CALENDAR_METHOD_FETCH_OBJECT;
@@ -304,9 +287,7 @@ U_CFUNC PHP_FUNCTION(intlcal_add)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"Oll", &object, Calendar_ce_ptr, &field, &amount) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_add: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (field < 0 || field >= UCAL_FIELD_COUNT) {
@@ -336,9 +317,7 @@ U_CFUNC PHP_FUNCTION(intlcal_set_time_zone)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"Oz!", &object, Calendar_ce_ptr, &zv_timezone) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_set_time_zone: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
CALENDAR_METHOD_FETCH_OBJECT;
@@ -370,9 +349,7 @@ static void _php_intlcal_before_after(
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"OO", &object, Calendar_ce_ptr, &when_object, Calendar_ce_ptr)
== FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_before/after: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
CALENDAR_METHOD_FETCH_OBJECT;
@@ -402,41 +379,23 @@ U_CFUNC PHP_FUNCTION(intlcal_before)
U_CFUNC PHP_FUNCTION(intlcal_set)
{
- zend_long arg1, arg2, arg3, arg4, arg5, arg6;
- zval args_a[7] = {0},
- *args = args_a;
- int i;
- int variant; /* number of args of the set() overload */
+ zend_long args[6];
+
CALENDAR_METHOD_INIT_VARS;
object = getThis();
- /* must come before zpp because zpp would convert the args in the stack to 0 */
- if (ZEND_NUM_ARGS() > (object ? 6 : 7) ||
- zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_set: too many arguments", 0);
- RETURN_FALSE;
- }
- if (!object) {
- args++;
- }
- variant = ZEND_NUM_ARGS() - (object ? 0 : 1);
- while (variant > 2 && Z_TYPE(args[variant - 1]) == IS_NULL) {
- variant--;
- }
+ int arg_num = ZEND_NUM_ARGS() - (object ? 0 : 1);
- if (variant == 4 ||
- zend_parse_method_parameters(ZEND_NUM_ARGS(), object,
- "Oll|llll", &object, Calendar_ce_ptr, &arg1, &arg2, &arg3, &arg4,
- &arg5, &arg6) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_set: bad arguments", 0);
- RETURN_FALSE;
+ if (zend_parse_method_parameters(
+ ZEND_NUM_ARGS(), object, "Oll|llll",
+ &object, Calendar_ce_ptr, &args[0], &args[1], &args[2], &args[3], &args[4], &args[5]) == FAILURE
+ ) {
+ RETURN_THROWS();
}
- for (i = 0; i < variant; i++) {
- if (Z_LVAL(args[i]) < INT32_MIN || Z_LVAL(args[i]) > INT32_MAX) {
+ for (int i = 0; i < arg_num; i++) {
+ if (args[i] < INT32_MIN || args[i] > INT32_MAX) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"intlcal_set: at least one of the arguments has an absolute "
"value that is too large", 0);
@@ -444,22 +403,23 @@ U_CFUNC PHP_FUNCTION(intlcal_set)
}
}
- if (variant == 2 && (arg1 < 0 || arg1 >= UCAL_FIELD_COUNT)) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_set: invalid field", 0);
- RETURN_FALSE;
- }
-
CALENDAR_METHOD_FETCH_OBJECT;
- if (variant == 2) {
- co->ucal->set((UCalendarDateFields)arg1, (int32_t)arg2);
- } else if (variant == 3) {
- co->ucal->set((int32_t)arg1, (int32_t)arg2, (int32_t)arg3);
- } else if (variant == 5) {
- co->ucal->set((int32_t)arg1, (int32_t)arg2, (int32_t)arg3, (int32_t)arg4, (int32_t)arg5);
- } else if (variant == 6) {
- co->ucal->set((int32_t)arg1, (int32_t)arg2, (int32_t)arg3, (int32_t)arg4, (int32_t)arg5, (int32_t)arg6);
+ if (arg_num == 2) {
+ if (args[0] < 0 || args[0] >= UCAL_FIELD_COUNT) {
+ intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_set: invalid field", 0);
+ RETURN_FALSE;
+ }
+ co->ucal->set((UCalendarDateFields)args[0], (int32_t)args[1]);
+ } else if (arg_num == 3) {
+ co->ucal->set((int32_t)args[0], (int32_t)args[1], (int32_t)args[2]);
+ } else if (arg_num == 4) {
+ zend_argument_count_error("No variant with 4 arguments");
+ RETURN_THROWS();
+ } else if (arg_num == 5) {
+ co->ucal->set((int32_t)args[0], (int32_t)args[1], (int32_t)args[2], (int32_t)args[3], (int32_t)args[4]);
+ } else {
+ co->ucal->set((int32_t)args[0], (int32_t)args[1], (int32_t)args[2], (int32_t)args[3], (int32_t)args[4], (int32_t)args[5]);
}
RETURN_TRUE;
@@ -489,16 +449,12 @@ U_CFUNC PHP_FUNCTION(intlcal_roll)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), object,
"Olb", &object, Calendar_ce_ptr, &field, &bool_variant_val)
== FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_roll: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
bool_variant_val = Z_TYPE(args[1]) == IS_TRUE? 1 : 0;
} else if (zend_parse_method_parameters(ZEND_NUM_ARGS(), object,
"Oll", &object, Calendar_ce_ptr, &field, &value) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_roll: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (field < 0 || field >= UCAL_FIELD_COUNT) {
@@ -535,9 +491,7 @@ U_CFUNC PHP_FUNCTION(intlcal_clear)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(),
getThis(), "O|l!", &object, Calendar_ce_ptr, &field, &field_is_null) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_clear: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
CALENDAR_METHOD_FETCH_OBJECT;
@@ -565,9 +519,7 @@ U_CFUNC PHP_FUNCTION(intlcal_field_difference)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"Odl", &object, Calendar_ce_ptr, &when, &field) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_field_difference: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (field < 0 || field >= UCAL_FIELD_COUNT) {
@@ -605,9 +557,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_day_of_week_type)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"Ol", &object, Calendar_ce_ptr, &dow) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_get_day_of_week_type: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (dow < UCAL_SUNDAY || dow > UCAL_SATURDAY) {
@@ -632,9 +582,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_first_day_of_week)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"O", &object, Calendar_ce_ptr) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_get_first_day_of_week: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
CALENDAR_METHOD_FETCH_OBJECT;
@@ -657,10 +605,7 @@ static void _php_intlcal_field_ret_in32t_method(
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"Ol", &object, Calendar_ce_ptr, &field) == FAILURE) {
- spprintf(&message, 0, "%s: bad arguments", method_name);
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, message, 1);
- efree(message);
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (field < 0 || field >= UCAL_FIELD_COUNT) {
@@ -697,9 +642,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_locale)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"Ol", &object, Calendar_ce_ptr, &locale_type) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_get_locale: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (locale_type != ULOC_ACTUAL_LOCALE && locale_type != ULOC_VALID_LOCALE) {
@@ -730,9 +673,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_minimal_days_in_first_week)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"O", &object, Calendar_ce_ptr) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_get_minimal_days_in_first_week: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
CALENDAR_METHOD_FETCH_OBJECT;
@@ -756,9 +697,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_time_zone)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"O", &object, Calendar_ce_ptr) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_get_time_zone: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
CALENDAR_METHOD_FETCH_OBJECT;
@@ -779,9 +718,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_type)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"O", &object, Calendar_ce_ptr) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_get_type: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
CALENDAR_METHOD_FETCH_OBJECT;
@@ -796,9 +733,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_weekend_transition)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"Ol", &object, Calendar_ce_ptr, &dow) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_get_weekend_transition: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (dow < UCAL_SUNDAY || dow > UCAL_SATURDAY) {
@@ -823,9 +758,7 @@ U_CFUNC PHP_FUNCTION(intlcal_in_daylight_time)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"O", &object, Calendar_ce_ptr) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_in_daylight_time: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
CALENDAR_METHOD_FETCH_OBJECT;
@@ -846,9 +779,7 @@ U_CFUNC PHP_FUNCTION(intlcal_is_equivalent_to)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"OO", &object, Calendar_ce_ptr, &other_object, Calendar_ce_ptr)
== FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_is_equivalent_to: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
other_co = Z_INTL_CALENDAR_P(other_object);
@@ -869,9 +800,7 @@ U_CFUNC PHP_FUNCTION(intlcal_is_lenient)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"O", &object, Calendar_ce_ptr) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_is_lenient: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
CALENDAR_METHOD_FETCH_OBJECT;
@@ -886,9 +815,7 @@ U_CFUNC PHP_FUNCTION(intlcal_is_set)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"Ol", &object, Calendar_ce_ptr, &field) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_is_set: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (field < 0 || field >= UCAL_FIELD_COUNT) {
@@ -910,9 +837,7 @@ U_CFUNC PHP_FUNCTION(intlcal_is_weekend)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"O|d!", &object, Calendar_ce_ptr, &date, &date_is_null) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_is_weekend: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
CALENDAR_METHOD_FETCH_OBJECT;
@@ -935,9 +860,7 @@ U_CFUNC PHP_FUNCTION(intlcal_set_first_day_of_week)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"Ol", &object, Calendar_ce_ptr, &dow) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_set_first_day_of_week: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (dow < UCAL_SUNDAY || dow > UCAL_SATURDAY) {
@@ -960,9 +883,7 @@ U_CFUNC PHP_FUNCTION(intlcal_set_lenient)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"Ob", &object, Calendar_ce_ptr, &is_lenient) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_set_lenient: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
CALENDAR_METHOD_FETCH_OBJECT;
@@ -979,9 +900,7 @@ U_CFUNC PHP_FUNCTION(intlcal_set_minimal_days_in_first_week)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"Ol", &object, Calendar_ce_ptr, &num_days) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_set_minimal_days_in_first_week: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (num_days < 1 || num_days > 7) {
@@ -1007,9 +926,7 @@ U_CFUNC PHP_FUNCTION(intlcal_equals)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"OO", &object, Calendar_ce_ptr, &other_object, Calendar_ce_ptr)
== FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_equals: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
CALENDAR_METHOD_FETCH_OBJECT;
@@ -1032,9 +949,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_repeated_wall_time_option)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"O", &object, Calendar_ce_ptr) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_get_repeated_wall_time_option: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
CALENDAR_METHOD_FETCH_OBJECT;
@@ -1048,9 +963,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_skipped_wall_time_option)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"O", &object, Calendar_ce_ptr) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_get_skipped_wall_time_option: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
CALENDAR_METHOD_FETCH_OBJECT;
@@ -1065,9 +978,7 @@ U_CFUNC PHP_FUNCTION(intlcal_set_repeated_wall_time_option)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"Ol", &object, Calendar_ce_ptr, &option) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_set_repeated_wall_time_option: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (option != UCAL_WALLTIME_FIRST && option != UCAL_WALLTIME_LAST) {
@@ -1090,9 +1001,7 @@ U_CFUNC PHP_FUNCTION(intlcal_set_skipped_wall_time_option)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"Ol", &object, Calendar_ce_ptr, &option) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_set_skipped_wall_time_option: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (option != UCAL_WALLTIME_FIRST && option != UCAL_WALLTIME_LAST
@@ -1125,15 +1034,13 @@ U_CFUNC PHP_FUNCTION(intlcal_from_date_time)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|s!",
&zv_arg, &locale_str, &locale_str_len) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_from_date_time: bad arguments", 0);
- RETURN_NULL();
+ RETURN_THROWS();
}
if (!(Z_TYPE_P(zv_arg) == IS_OBJECT && instanceof_function(
Z_OBJCE_P(zv_arg), php_date_get_date_ce()))) {
object_init_ex(&zv_tmp, php_date_get_date_ce());
- zend_call_method_with_1_params(&zv_tmp, NULL, &Z_OBJCE(zv_tmp)->constructor, "__construct", NULL, zv_arg);
+ zend_call_method_with_1_params(Z_OBJ(zv_tmp), NULL, &Z_OBJCE(zv_tmp)->constructor, "__construct", NULL, zv_arg);
zv_datetime = &zv_tmp;
if (EG(exception)) {
zend_object_store_ctor_failed(Z_OBJ(zv_tmp));
@@ -1151,7 +1058,7 @@ U_CFUNC PHP_FUNCTION(intlcal_from_date_time)
goto error;
}
- zend_call_method_with_0_params(zv_datetime, php_date_get_date_ce(), NULL, "gettimestamp", &zv_timestamp);
+ zend_call_method_with_0_params(Z_OBJ_P(zv_datetime), php_date_get_date_ce(), NULL, "gettimestamp", &zv_timestamp);
if (Z_TYPE(zv_timestamp) != IS_LONG) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"intlcal_from_date_time: bad DateTime; call to "
@@ -1206,9 +1113,7 @@ U_CFUNC PHP_FUNCTION(intlcal_to_date_time)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O",
&object, Calendar_ce_ptr) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_to_date_time: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
CALENDAR_METHOD_FETCH_OBJECT;
@@ -1249,7 +1154,7 @@ U_CFUNC PHP_FUNCTION(intlcal_to_date_time)
/* Finally, instantiate object and call constructor */
object_init_ex(return_value, php_date_get_date_ce());
- zend_call_method_with_2_params(return_value, NULL, &Z_OBJCE_P(return_value)->constructor, "__construct", NULL, &ts_zval, timezone_zval);
+ zend_call_method_with_2_params(Z_OBJ_P(return_value), NULL, &Z_OBJCE_P(return_value)->constructor, "__construct", NULL, &ts_zval, timezone_zval);
if (EG(exception)) {
intl_errors_set(CALENDAR_ERROR_P(co), U_ILLEGAL_ARGUMENT_ERROR,
"intlcal_to_date_time: DateTime constructor has thrown exception",
@@ -1264,7 +1169,7 @@ U_CFUNC PHP_FUNCTION(intlcal_to_date_time)
zval_ptr_dtor(&ts_zval);
/* due to bug #40743, we have to set the time zone again */
- zend_call_method_with_1_params(return_value, NULL, NULL, "settimezone",
+ zend_call_method_with_1_params(Z_OBJ_P(return_value), NULL, NULL, "settimezone",
&retval, timezone_zval);
if (Z_ISUNDEF(retval) || Z_TYPE(retval) == IS_FALSE) {
intl_errors_set(CALENDAR_ERROR_P(co), U_ILLEGAL_ARGUMENT_ERROR,
@@ -1286,9 +1191,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_error_code)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O",
&object, Calendar_ce_ptr) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_get_error_code: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* Fetch the object (without resetting its last error code ). */
@@ -1306,9 +1209,7 @@ U_CFUNC PHP_FUNCTION(intlcal_get_error_message)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O",
&object, Calendar_ce_ptr) == FAILURE) {
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlcal_get_error_message: bad arguments", 0 );
- RETURN_FALSE;
+ RETURN_THROWS();
}
diff --git a/ext/intl/calendar/calendar_methods.h b/ext/intl/calendar/calendar_methods.h
index 838917cac3..c9c8387d23 100644
--- a/ext/intl/calendar/calendar_methods.h
+++ b/ext/intl/calendar/calendar_methods.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/calendar/gregoriancalendar_methods.cpp b/ext/intl/calendar/gregoriancalendar_methods.cpp
index d96fffda6f..3a4d75965a 100644
--- a/ext/intl/calendar/gregoriancalendar_methods.cpp
+++ b/ext/intl/calendar/gregoriancalendar_methods.cpp
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -56,57 +54,34 @@ static void _php_intlgregcal_constructor_body(
zend_long largs[6];
UErrorCode status = U_ZERO_ERROR;
int variant;
- int zpp_flags = is_constructor ? ZEND_PARSE_PARAMS_THROW : 0;
intl_error_reset(NULL);
// parameter number validation / variant determination
if (ZEND_NUM_ARGS() > 6 ||
zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlgregcal_create_instance: too many arguments", 0);
- if (!is_constructor) {
- zval_ptr_dtor(return_value);
- RETVAL_NULL();
- }
- return;
+ zend_argument_count_error("Too many arguments");
+ RETURN_THROWS();
}
+
for (variant = ZEND_NUM_ARGS();
variant > 0 && Z_TYPE(args[variant - 1]) == IS_NULL;
variant--) {}
if (variant == 4) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlgregcal_create_instance: no variant with 4 arguments "
- "(excluding trailing NULLs)", 0);
- if (!is_constructor) {
- zval_ptr_dtor(return_value);
- RETVAL_NULL();
- }
- return;
+ zend_argument_count_error("No variant with 4 arguments (excluding trailing NULLs)");
+ RETURN_THROWS();
}
// argument parsing
if (variant <= 2) {
- if (zend_parse_parameters_ex(zpp_flags, MIN(ZEND_NUM_ARGS(), 2),
+ if (zend_parse_parameters(MIN(ZEND_NUM_ARGS(), 2),
"|z!s!", &tz_object, &locale, &locale_len) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlgregcal_create_instance: bad arguments", 0);
- if (!is_constructor) {
- zval_ptr_dtor(return_value);
- RETVAL_NULL();
- }
- return;
+ RETURN_THROWS();
}
}
- if (variant > 2 && zend_parse_parameters_ex(zpp_flags, ZEND_NUM_ARGS(),
+ if (variant > 2 && zend_parse_parameters(ZEND_NUM_ARGS(),
"lll|lll", &largs[0], &largs[1], &largs[2], &largs[3], &largs[4],
&largs[5]) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlgregcal_create_instance: bad arguments", 0);
- if (!is_constructor) {
- zval_ptr_dtor(return_value);
- RETVAL_NULL();
- }
- return;
+ RETURN_THROWS();
}
// instantion of ICU object
@@ -232,9 +207,7 @@ U_CFUNC PHP_FUNCTION(intlgregcal_set_gregorian_change)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"Od", &object, GregorianCalendar_ce_ptr, &date) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlgregcal_set_gregorian_change: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
CALENDAR_METHOD_FETCH_OBJECT;
@@ -252,9 +225,7 @@ U_CFUNC PHP_FUNCTION(intlgregcal_get_gregorian_change)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"O", &object, GregorianCalendar_ce_ptr) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlgregcal_get_gregorian_change: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
CALENDAR_METHOD_FETCH_OBJECT;
@@ -269,9 +240,7 @@ U_CFUNC PHP_FUNCTION(intlgregcal_is_leap_year)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"Ol", &object, GregorianCalendar_ce_ptr, &year) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intlgregcal_is_leap_year: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (year < INT32_MIN || year > INT32_MAX) {
diff --git a/ext/intl/calendar/gregoriancalendar_methods.h b/ext/intl/calendar/gregoriancalendar_methods.h
index 659566427c..a5351f986f 100644
--- a/ext/intl/calendar/gregoriancalendar_methods.h
+++ b/ext/intl/calendar/gregoriancalendar_methods.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/collator/collator.c b/ext/intl/collator/collator.c
index f450091df7..0f73ee8e05 100644
--- a/ext/intl/collator/collator.c
+++ b/ext/intl/collator/collator.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/collator/collator.h b/ext/intl/collator/collator.h
index 65b30ee9b0..78a974496b 100644
--- a/ext/intl/collator/collator.h
+++ b/ext/intl/collator/collator.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/collator/collator.stub.php b/ext/intl/collator/collator.stub.php
new file mode 100644
index 0000000000..a7ade53b2a
--- /dev/null
+++ b/ext/intl/collator/collator.stub.php
@@ -0,0 +1,71 @@
+<?php
+
+class Collator
+{
+ public function __construct(string $locale) {}
+
+ /** @return Collator|null */
+ public static function create(string $locale) {}
+
+ /** @return int|false */
+ public function compare(string $str1, string $str2) {}
+
+ /** @return bool */
+ public function sort(array &$arr, $sort_flag = Collator::SORT_REGULAR) {}
+
+ /** @return bool */
+ public function sortWithSortKeys(array &$arr) {}
+
+ /** @return bool */
+ public function asort(array &$arr, int $sort_flag = Collator::SORT_REGULAR) {}
+
+ /** @return int|false */
+ public function getAttribute(int $attr) {}
+
+ /** @return bool */
+ public function setAttribute(int $attr, int $val) {}
+
+ /** @return int */
+ public function getStrength() {}
+
+ /** @return bool */
+ public function setStrength(int $strength) {}
+
+ /** @return string|false */
+ public function getLocale(int $type) {}
+
+ /** @return int|false */
+ public function getErrorCode() {}
+
+ /** @return string|false */
+ public function getErrorMessage() {}
+
+ /** @return string|false */
+ public function getSortKey(string $str) {}
+}
+
+function collator_create(string $locale): ?Collator {}
+
+function collator_compare(Collator $object, string $str1, string $str2): int|false {}
+
+function collator_get_attribute(Collator $object, int $attr): int|false {}
+
+function collator_set_attribute(Collator $object, int $attr, int $val): bool {}
+
+function collator_get_strength(Collator $object): int {}
+
+function collator_set_strength(Collator $object, int $strength): bool {}
+
+function collator_sort(Collator $object, array &$arr, int $sort_flag = Collator::SORT_REGULAR): bool {}
+
+function collator_sort_with_sort_keys(Collator $object, array &$arr): bool {}
+
+function collator_asort(Collator $object, array &$arr, int $sort_flag = Collator::SORT_REGULAR): bool {}
+
+function collator_get_locale(Collator $object, int $type): string|false {}
+
+function collator_get_error_code(Collator $object): int|false {}
+
+function collator_get_error_message(Collator $object): string|false {}
+
+function collator_get_sort_key(Collator $object, string $str): string|false {}
diff --git a/ext/intl/collator/collator_arginfo.h b/ext/intl/collator/collator_arginfo.h
new file mode 100644
index 0000000000..ba1a18a254
--- /dev/null
+++ b/ext/intl/collator/collator_arginfo.h
@@ -0,0 +1,115 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Collator___construct, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_Collator_create arginfo_class_Collator___construct
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Collator_compare, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, str1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, str2, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Collator_sort, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(1, arr, IS_ARRAY, 0)
+ ZEND_ARG_INFO(0, sort_flag)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Collator_sortWithSortKeys, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(1, arr, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Collator_asort, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(1, arr, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, sort_flag, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Collator_getAttribute, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, attr, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Collator_setAttribute, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, attr, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, val, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Collator_getStrength, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Collator_setStrength, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, strength, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Collator_getLocale, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_Collator_getErrorCode arginfo_class_Collator_getStrength
+
+#define arginfo_class_Collator_getErrorMessage arginfo_class_Collator_getStrength
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Collator_getSortKey, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_collator_create, 0, 1, Collator, 1)
+ ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_collator_compare, 0, 3, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, object, Collator, 0)
+ ZEND_ARG_TYPE_INFO(0, str1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, str2, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_collator_get_attribute, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, object, Collator, 0)
+ ZEND_ARG_TYPE_INFO(0, attr, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_collator_set_attribute, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, object, Collator, 0)
+ ZEND_ARG_TYPE_INFO(0, attr, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, val, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_collator_get_strength, 0, 1, IS_LONG, 0)
+ ZEND_ARG_OBJ_INFO(0, object, Collator, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_collator_set_strength, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, object, Collator, 0)
+ ZEND_ARG_TYPE_INFO(0, strength, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_collator_sort, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, object, Collator, 0)
+ ZEND_ARG_TYPE_INFO(1, arr, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, sort_flag, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_collator_sort_with_sort_keys, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, object, Collator, 0)
+ ZEND_ARG_TYPE_INFO(1, arr, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_collator_asort arginfo_collator_sort
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_collator_get_locale, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, object, Collator, 0)
+ ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_collator_get_error_code, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, object, Collator, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_collator_get_error_message, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, object, Collator, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_collator_get_sort_key, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, object, Collator, 0)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/intl/collator/collator_attr.c b/ext/intl/collator/collator_attr.c
index 5170d4c720..144a9dc171 100644
--- a/ext/intl/collator/collator_attr.c
+++ b/ext/intl/collator/collator_attr.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -41,10 +39,7 @@ PHP_FUNCTION( collator_get_attribute )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Ol",
&object, Collator_ce_ptr, &attribute ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "collator_get_attribute: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* Fetch the object. */
@@ -72,10 +67,7 @@ PHP_FUNCTION( collator_set_attribute )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Oll",
&object, Collator_ce_ptr, &attribute, &value ) == FAILURE)
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "collator_set_attribute: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* Fetch the object. */
@@ -102,10 +94,7 @@ PHP_FUNCTION( collator_get_strength )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O",
&object, Collator_ce_ptr ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "collator_get_strength: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* Fetch the object. */
@@ -131,10 +120,7 @@ PHP_FUNCTION( collator_set_strength )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Ol",
&object, Collator_ce_ptr, &strength ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "collator_set_strength: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* Fetch the object. */
diff --git a/ext/intl/collator/collator_attr.h b/ext/intl/collator/collator_attr.h
index aefdd15f9f..682e618b9f 100644
--- a/ext/intl/collator/collator_attr.h
+++ b/ext/intl/collator/collator_attr.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/collator/collator_class.c b/ext/intl/collator/collator_class.c
index 64ad9823e2..2641706114 100644
--- a/ext/intl/collator/collator_class.c
+++ b/ext/intl/collator/collator_class.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -24,6 +22,7 @@
#include "collator_locale.h"
#include "collator_create.h"
#include "collator_error.h"
+#include "collator_arginfo.h"
#include "intl_error.h"
#include <unicode/ucol.h>
@@ -64,53 +63,25 @@ zend_object *Collator_object_create(zend_class_entry *ce )
* 'Collator' class registration structures & functions
*/
-/* {{{ Collator methods arguments info */
-/* NOTE: modifying 'collator_XX_args' do not forget to
- modify approptiate 'collator_XX_args' for
- the procedural API.
-*/
-ZEND_BEGIN_ARG_INFO_EX( collator_0_args, 0, 0, 0 )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( collator_1_arg, 0, 0, 1 )
- ZEND_ARG_INFO( 0, arg1 )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( collator_2_args, 0, 0, 2 )
- ZEND_ARG_INFO( 0, arg1 )
- ZEND_ARG_INFO( 0, arg2 )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( collator_sort_args, 0, 0, 1 )
- ZEND_ARG_ARRAY_INFO( 1, arr, 0 )
- ZEND_ARG_INFO( 0, flags )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( collator_sort_with_sort_keys_args, 0, 0, 1 )
- ZEND_ARG_ARRAY_INFO( 1, arr, 0 )
-ZEND_END_ARG_INFO()
-
-/* }}} */
-
/* {{{ Collator_class_functions
* Every 'Collator' class method has an entry in this table
*/
static const zend_function_entry Collator_class_functions[] = {
- PHP_ME( Collator, __construct, collator_1_arg, ZEND_ACC_PUBLIC )
- ZEND_FENTRY( create, ZEND_FN( collator_create ), collator_1_arg, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
- PHP_NAMED_FE( compare, ZEND_FN( collator_compare ), collator_2_args )
- PHP_NAMED_FE( sort, ZEND_FN( collator_sort ), collator_sort_args )
- PHP_NAMED_FE( sortWithSortKeys, ZEND_FN( collator_sort_with_sort_keys ), collator_sort_with_sort_keys_args )
- PHP_NAMED_FE( asort, ZEND_FN( collator_asort ), collator_sort_args )
- PHP_NAMED_FE( getAttribute, ZEND_FN( collator_get_attribute ), collator_1_arg )
- PHP_NAMED_FE( setAttribute, ZEND_FN( collator_set_attribute ), collator_2_args )
- PHP_NAMED_FE( getStrength, ZEND_FN( collator_get_strength ), collator_0_args )
- PHP_NAMED_FE( setStrength, ZEND_FN( collator_set_strength ), collator_1_arg )
- PHP_NAMED_FE( getLocale, ZEND_FN( collator_get_locale ), collator_1_arg )
- PHP_NAMED_FE( getErrorCode, ZEND_FN( collator_get_error_code ), collator_0_args )
- PHP_NAMED_FE( getErrorMessage, ZEND_FN( collator_get_error_message ), collator_0_args )
- PHP_NAMED_FE( getSortKey, ZEND_FN( collator_get_sort_key ), collator_1_arg )
+ PHP_ME( Collator, __construct, arginfo_class_Collator___construct, ZEND_ACC_PUBLIC )
+ ZEND_FENTRY( create, ZEND_FN( collator_create ), arginfo_class_Collator_create, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
+ PHP_NAMED_FE( compare, ZEND_FN( collator_compare ), arginfo_class_Collator_compare )
+ PHP_NAMED_FE( sort, ZEND_FN( collator_sort ), arginfo_class_Collator_sort )
+ PHP_NAMED_FE( sortWithSortKeys, ZEND_FN( collator_sort_with_sort_keys ), arginfo_class_Collator_sortWithSortKeys )
+ PHP_NAMED_FE( asort, ZEND_FN( collator_asort ), arginfo_class_Collator_asort )
+ PHP_NAMED_FE( getAttribute, ZEND_FN( collator_get_attribute ), arginfo_class_Collator_getAttribute )
+ PHP_NAMED_FE( setAttribute, ZEND_FN( collator_set_attribute ), arginfo_class_Collator_setAttribute )
+ PHP_NAMED_FE( getStrength, ZEND_FN( collator_get_strength ), arginfo_class_Collator_getStrength )
+ PHP_NAMED_FE( setStrength, ZEND_FN( collator_set_strength ), arginfo_class_Collator_setStrength )
+ PHP_NAMED_FE( getLocale, ZEND_FN( collator_get_locale ), arginfo_class_Collator_getLocale )
+ PHP_NAMED_FE( getErrorCode, ZEND_FN( collator_get_error_code ), arginfo_class_Collator_getErrorCode )
+ PHP_NAMED_FE( getErrorMessage, ZEND_FN( collator_get_error_message ), arginfo_class_Collator_getErrorMessage )
+ PHP_NAMED_FE( getSortKey, ZEND_FN( collator_get_sort_key ), arginfo_class_Collator_getSortKey )
PHP_FE_END
};
/* }}} */
diff --git a/ext/intl/collator/collator_class.h b/ext/intl/collator/collator_class.h
index 4ee8aba749..060a899b7a 100644
--- a/ext/intl/collator/collator_class.h
+++ b/ext/intl/collator/collator_class.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/collator/collator_compare.c b/ext/intl/collator/collator_compare.c
index c95d144f1a..f4afc75786 100644
--- a/ext/intl/collator/collator_compare.c
+++ b/ext/intl/collator/collator_compare.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -49,10 +47,7 @@ PHP_FUNCTION( collator_compare )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Oss",
&object, Collator_ce_ptr, &str1, &str1_len, &str2, &str2_len ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "collator_compare: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* Fetch the object. */
@@ -64,7 +59,7 @@ PHP_FUNCTION( collator_compare )
"Object not initialized", 0 );
zend_throw_error(NULL, "Object not initialized");
- RETURN_FALSE;
+ RETURN_THROWS();
}
/*
diff --git a/ext/intl/collator/collator_compare.h b/ext/intl/collator/collator_compare.h
index cca9ca29b1..aa58d88ab9 100644
--- a/ext/intl/collator/collator_compare.h
+++ b/ext/intl/collator/collator_compare.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/collator/collator_convert.c b/ext/intl/collator/collator_convert.c
index 2f0a80468e..e19bb719f6 100644
--- a/ext/intl/collator/collator_convert.c
+++ b/ext/intl/collator/collator_convert.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -226,33 +224,11 @@ zval* collator_convert_object_to_string( zval* obj, zval *rv )
}
/* Try object's handlers. */
- if( Z_OBJ_HT_P(obj)->get )
- {
- zstr = Z_OBJ_HT_P(obj)->get( obj, rv );
-
- switch( Z_TYPE_P( zstr ) )
- {
- case IS_OBJECT:
- {
- /* Bail out. */
- zval_ptr_dtor( zstr );
- COLLATOR_CONVERT_RETURN_FAILED( obj );
- } break;
-
- case IS_STRING:
- break;
-
- default:
- {
- convert_to_string( zstr );
- } break;
- }
- }
- else if( Z_OBJ_HT_P(obj)->cast_object )
+ if( Z_OBJ_HT_P(obj)->cast_object )
{
zstr = rv;
- if( Z_OBJ_HT_P(obj)->cast_object( obj, zstr, IS_STRING ) == FAILURE )
+ if( Z_OBJ_HT_P(obj)->cast_object( Z_OBJ_P(obj), zstr, IS_STRING ) == FAILURE )
{
/* cast_object failed => bail out. */
zval_ptr_dtor( zstr );
diff --git a/ext/intl/collator/collator_convert.h b/ext/intl/collator/collator_convert.h
index 4cfc8b56ce..7b973a0a30 100644
--- a/ext/intl/collator/collator_convert.h
+++ b/ext/intl/collator/collator_convert.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/collator/collator_create.c b/ext/intl/collator/collator_create.c
index cb2ff183e2..051bb99cb8 100644
--- a/ext/intl/collator/collator_create.c
+++ b/ext/intl/collator/collator_create.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -25,22 +23,19 @@
#include "intl_data.h"
/* {{{ */
-static int collator_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_constructor)
+static int collator_ctor(INTERNAL_FUNCTION_PARAMETERS)
{
const char* locale;
size_t locale_len = 0;
zval* object;
Collator_object* co;
- int zpp_flags = is_constructor ? ZEND_PARSE_PARAMS_THROW : 0;
intl_error_reset( NULL );
object = return_value;
/* Parse parameters. */
- if( zend_parse_parameters_ex( zpp_flags, ZEND_NUM_ARGS(), "s",
+ if( zend_parse_parameters( ZEND_NUM_ARGS(), "s",
&locale, &locale_len ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "collator_create: unable to parse input params", 0 );
return FAILURE;
}
@@ -64,7 +59,7 @@ static int collator_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_constructor)
PHP_FUNCTION( collator_create )
{
object_init_ex( return_value, Collator_ce_ptr );
- if (collator_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0) == FAILURE) {
+ if (collator_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU) == FAILURE) {
zval_ptr_dtor(return_value);
RETURN_NULL();
}
@@ -80,7 +75,7 @@ PHP_METHOD( Collator, __construct )
zend_replace_error_handling(EH_THROW, IntlException_ce_ptr, &error_handling);
return_value = ZEND_THIS;
- if (collator_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1) == FAILURE) {
+ if (collator_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU) == FAILURE) {
if (!EG(exception)) {
zend_throw_exception(IntlException_ce_ptr, "Constructor failed", 0);
}
diff --git a/ext/intl/collator/collator_create.h b/ext/intl/collator/collator_create.h
index b5e9489e3d..7f70fe9e4b 100644
--- a/ext/intl/collator/collator_create.h
+++ b/ext/intl/collator/collator_create.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/collator/collator_error.c b/ext/intl/collator/collator_error.c
index b485cf14f1..679c4557b4 100644
--- a/ext/intl/collator/collator_error.c
+++ b/ext/intl/collator/collator_error.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -36,10 +34,7 @@ PHP_FUNCTION( collator_get_error_code )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O",
&object, Collator_ce_ptr ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "collator_get_error_code: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* Fetch the object (without resetting its last error code). */
@@ -67,10 +62,7 @@ PHP_FUNCTION( collator_get_error_message )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O",
&object, Collator_ce_ptr ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "collator_get_error_message: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* Fetch the object (without resetting its last error code). */
diff --git a/ext/intl/collator/collator_error.h b/ext/intl/collator/collator_error.h
index 3c8c10a043..912d8f9d35 100644
--- a/ext/intl/collator/collator_error.h
+++ b/ext/intl/collator/collator_error.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/collator/collator_is_numeric.c b/ext/intl/collator/collator_is_numeric.c
index a561897a16..b71e658e57 100644
--- a/ext/intl/collator/collator_is_numeric.c
+++ b/ext/intl/collator/collator_is_numeric.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/collator/collator_is_numeric.h b/ext/intl/collator/collator_is_numeric.h
index f6337aaacc..34b84e9990 100644
--- a/ext/intl/collator/collator_is_numeric.h
+++ b/ext/intl/collator/collator_is_numeric.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/collator/collator_locale.c b/ext/intl/collator/collator_locale.c
index 2a379bc977..dcf3a4917e 100644
--- a/ext/intl/collator/collator_locale.c
+++ b/ext/intl/collator/collator_locale.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -42,10 +40,7 @@ PHP_FUNCTION( collator_get_locale )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Ol",
&object, Collator_ce_ptr, &type ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "collator_get_locale: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* Fetch the object. */
@@ -57,7 +52,7 @@ PHP_FUNCTION( collator_get_locale )
"Object not initialized", 0 );
zend_throw_error(NULL, "Object not initialized");
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* Get locale by specified type. */
diff --git a/ext/intl/collator/collator_locale.h b/ext/intl/collator/collator_locale.h
index b2f837b49a..505e2f17fd 100644
--- a/ext/intl/collator/collator_locale.h
+++ b/ext/intl/collator/collator_locale.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/collator/collator_sort.c b/ext/intl/collator/collator_sort.c
index d1e832aecc..cc3e6b6236 100644
--- a/ext/intl/collator/collator_sort.c
+++ b/ext/intl/collator/collator_sort.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -303,10 +301,7 @@ static void collator_sort_internal( int renumber, INTERNAL_FUNCTION_PARAMETERS )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Oa/|l",
&object, Collator_ce_ptr, &array, &sort_flags ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "collator_sort_internal: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* Fetch the object. */
@@ -397,10 +392,7 @@ PHP_FUNCTION( collator_sort_with_sort_keys )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Oa",
&object, Collator_ce_ptr, &array ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "collator_sort_with_sort_keys: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* Fetch the object. */
@@ -412,7 +404,7 @@ PHP_FUNCTION( collator_sort_with_sort_keys )
"Object not initialized", 0 );
zend_throw_error(NULL, "Object not initialized");
- RETURN_FALSE;
+ RETURN_THROWS();
}
/*
@@ -563,10 +555,7 @@ PHP_FUNCTION( collator_get_sort_key )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Os",
&object, Collator_ce_ptr, &str, &str_len ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "collator_get_sort_key: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* Fetch the object. */
@@ -578,7 +567,7 @@ PHP_FUNCTION( collator_get_sort_key )
"Object not initialized", 0 );
zend_throw_error(NULL, "Object not initialized");
- RETURN_FALSE;
+ RETURN_THROWS();
}
/*
diff --git a/ext/intl/collator/collator_sort.h b/ext/intl/collator/collator_sort.h
index ffaf86e664..5d1d1050d9 100644
--- a/ext/intl/collator/collator_sort.h
+++ b/ext/intl/collator/collator_sort.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/common/common.stub.php b/ext/intl/common/common.stub.php
new file mode 100644
index 0000000000..61a977f660
--- /dev/null
+++ b/ext/intl/common/common.stub.php
@@ -0,0 +1,22 @@
+<?php
+
+class IntlIterator implements Iterator
+{
+ public function current() {}
+
+ public function key() {}
+
+ public function next() {}
+
+ public function rewind() {}
+
+ public function valid() {}
+}
+
+function intl_get_error_code(): int {}
+
+function intl_get_error_message(): string {}
+
+function intl_is_failure(int $error_code): bool {}
+
+function intl_error_name(int $error_code): string {}
diff --git a/ext/intl/common/common_arginfo.h b/ext/intl/common/common_arginfo.h
new file mode 100644
index 0000000000..6d1b836354
--- /dev/null
+++ b/ext/intl/common/common_arginfo.h
@@ -0,0 +1,26 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlIterator_current, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_IntlIterator_key arginfo_class_IntlIterator_current
+
+#define arginfo_class_IntlIterator_next arginfo_class_IntlIterator_current
+
+#define arginfo_class_IntlIterator_rewind arginfo_class_IntlIterator_current
+
+#define arginfo_class_IntlIterator_valid arginfo_class_IntlIterator_current
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_intl_get_error_code, 0, 0, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_intl_get_error_message, 0, 0, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_intl_is_failure, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, error_code, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_intl_error_name, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, error_code, IS_LONG, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/intl/common/common_date.cpp b/ext/intl/common/common_date.cpp
index b3e8a30f68..d4767dc63b 100644
--- a/ext/intl/common/common_date.cpp
+++ b/ext/intl/common/common_date.cpp
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/common/common_date.h b/ext/intl/common/common_date.h
index acb8e68e9a..bb245e36f1 100644
--- a/ext/intl/common/common_date.h
+++ b/ext/intl/common/common_date.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/common/common_enum.cpp b/ext/intl/common/common_enum.cpp
index adc7034d36..446ffad82e 100644
--- a/ext/intl/common/common_enum.cpp
+++ b/ext/intl/common/common_enum.cpp
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -24,6 +22,7 @@
#include <stdio.h>
#include "common_enum.h"
+#include "common_arginfo.h"
extern "C" {
#include <zend_interfaces.h>
@@ -211,9 +210,7 @@ static PHP_METHOD(IntlIterator, current)
INTLITERATOR_METHOD_INIT_VARS;
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "IntlIterator::current: bad arguments", 0);
- return;
+ RETURN_THROWS();
}
INTLITERATOR_METHOD_FETCH_OBJECT;
@@ -228,9 +225,7 @@ static PHP_METHOD(IntlIterator, key)
INTLITERATOR_METHOD_INIT_VARS;
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "IntlIterator::key: bad arguments", 0);
- return;
+ RETURN_THROWS();
}
INTLITERATOR_METHOD_FETCH_OBJECT;
@@ -247,9 +242,7 @@ static PHP_METHOD(IntlIterator, next)
INTLITERATOR_METHOD_INIT_VARS;
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "IntlIterator::next: bad arguments", 0);
- return;
+ RETURN_THROWS();
}
INTLITERATOR_METHOD_FETCH_OBJECT;
@@ -264,9 +257,7 @@ static PHP_METHOD(IntlIterator, rewind)
INTLITERATOR_METHOD_INIT_VARS;
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "IntlIterator::rewind: bad arguments", 0);
- return;
+ RETURN_THROWS();
}
INTLITERATOR_METHOD_FETCH_OBJECT;
@@ -283,24 +274,19 @@ static PHP_METHOD(IntlIterator, valid)
INTLITERATOR_METHOD_INIT_VARS;
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "IntlIterator::valid: bad arguments", 0);
- return;
+ RETURN_THROWS();
}
INTLITERATOR_METHOD_FETCH_OBJECT;
RETURN_BOOL(ii->iterator->funcs->valid(ii->iterator) == SUCCESS);
}
-ZEND_BEGIN_ARG_INFO_EX(ainfo_se_void, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
static const zend_function_entry IntlIterator_class_functions[] = {
- PHP_ME(IntlIterator, current, ainfo_se_void, ZEND_ACC_PUBLIC)
- PHP_ME(IntlIterator, key, ainfo_se_void, ZEND_ACC_PUBLIC)
- PHP_ME(IntlIterator, next, ainfo_se_void, ZEND_ACC_PUBLIC)
- PHP_ME(IntlIterator, rewind, ainfo_se_void, ZEND_ACC_PUBLIC)
- PHP_ME(IntlIterator, valid, ainfo_se_void, ZEND_ACC_PUBLIC)
+ PHP_ME(IntlIterator, current, arginfo_class_IntlIterator_current, ZEND_ACC_PUBLIC)
+ PHP_ME(IntlIterator, key, arginfo_class_IntlIterator_key, ZEND_ACC_PUBLIC)
+ PHP_ME(IntlIterator, next, arginfo_class_IntlIterator_next, ZEND_ACC_PUBLIC)
+ PHP_ME(IntlIterator, rewind, arginfo_class_IntlIterator_rewind, ZEND_ACC_PUBLIC)
+ PHP_ME(IntlIterator, valid, arginfo_class_IntlIterator_valid, ZEND_ACC_PUBLIC)
PHP_FE_END
};
diff --git a/ext/intl/common/common_enum.h b/ext/intl/common/common_enum.h
index 5b57e5cf18..1f97575947 100644
--- a/ext/intl/common/common_enum.h
+++ b/ext/intl/common/common_enum.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -43,8 +41,8 @@ extern "C" {
object = ZEND_THIS; \
INTLITERATOR_METHOD_FETCH_OBJECT_NO_CHECK; \
if (ii->iterator == NULL) { \
- intl_errors_set(&ii->err, U_ILLEGAL_ARGUMENT_ERROR, "Found unconstructed IntlIterator", 0); \
- RETURN_FALSE; \
+ zend_throw_error(NULL, "Found unconstructed IntlIterator"); \
+ RETURN_THROWS(); \
}
typedef struct {
diff --git a/ext/intl/common/common_error.c b/ext/intl/common/common_error.c
index a4a4e56b0a..af239d6e2c 100644
--- a/ext/intl/common/common_error.c
+++ b/ext/intl/common/common_error.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -28,6 +26,10 @@
*/
PHP_FUNCTION( intl_get_error_code )
{
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
RETURN_LONG( intl_error_get_code( NULL ) );
}
/* }}} */
@@ -37,6 +39,10 @@ PHP_FUNCTION( intl_get_error_code )
*/
PHP_FUNCTION( intl_get_error_message )
{
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
RETURN_STR(intl_error_get_message( NULL ));
}
/* }}} */
@@ -54,10 +60,7 @@ PHP_FUNCTION( intl_is_failure )
if( zend_parse_parameters( ZEND_NUM_ARGS(), "l",
&err_code ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intl_is_failure: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
RETURN_BOOL( U_FAILURE( err_code ) );
@@ -76,10 +79,7 @@ PHP_FUNCTION( intl_error_name )
if( zend_parse_parameters( ZEND_NUM_ARGS(), "l",
&err_code ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intl_error_name: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
RETURN_STRING( (char*)u_errorName( err_code ) );
diff --git a/ext/intl/common/common_error.h b/ext/intl/common/common_error.h
index 46a26793ee..48a42d41e5 100644
--- a/ext/intl/common/common_error.h
+++ b/ext/intl/common/common_error.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/converter/converter.c b/ext/intl/converter/converter.c
index 8c9377ecae..a8d0dcbb65 100644
--- a/ext/intl/converter/converter.c
+++ b/ext/intl/converter/converter.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -122,7 +120,7 @@ static PHP_METHOD(UConverter, toUCallback) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lzzz",
&reason, &source, &codeUnits, &error) == FAILURE) {
- return;
+ RETURN_THROWS();
}
php_converter_default_callback(return_value, ZEND_THIS, reason, error);
@@ -144,7 +142,7 @@ static PHP_METHOD(UConverter, fromUCallback) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lzzz",
&reason, &source, &codePoint, &error) == FAILURE) {
- return;
+ RETURN_THROWS();
}
php_converter_default_callback(return_value, ZEND_THIS, reason, error);
@@ -429,7 +427,7 @@ static void php_converter_do_set_encoding(UConverter **pcnv, INTERNAL_FUNCTION_P
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &enc, &enc_len) == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "Bad arguments, "
"expected one string argument", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
intl_errors_reset(&objval->error);
@@ -459,7 +457,7 @@ static void php_converter_do_get_encoding(php_converter_object *objval, UConvert
if (zend_parse_parameters_none() == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "Expected no arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
intl_errors_reset(&objval->error);
@@ -500,7 +498,7 @@ static void php_converter_do_get_type(php_converter_object *objval, UConverter *
if (zend_parse_parameters_none() == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "Expected no arguments", 0);
- RETURN_FALSE;
+ return;
}
intl_errors_reset(&objval->error);
@@ -571,7 +569,7 @@ static PHP_METHOD(UConverter, __construct) {
intl_error_reset(NULL);
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "|s!s!", &dest, &dest_len, &src, &src_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!s!", &dest, &dest_len, &src, &src_len) == FAILURE) {
return;
}
@@ -594,9 +592,7 @@ static PHP_METHOD(UConverter, setSubstChars) {
int ret = 1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &chars, &chars_len) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "UConverter::setSubstChars(): bad arguments", 0);
- RETURN_FALSE;
+ return;
}
intl_errors_reset(&objval->error);
@@ -641,7 +637,7 @@ static PHP_METHOD(UConverter, getSubstChars) {
if (zend_parse_parameters_none() == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"UConverter::getSubstChars(): expected no arguments", 0);
- RETURN_FALSE;
+ return;
}
intl_errors_reset(&objval->error);
@@ -729,9 +725,7 @@ static PHP_METHOD(UConverter, reasonText) {
zend_long reason;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &reason) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "UConverter::reasonText(): bad arguments", 0);
- RETURN_FALSE;
+ return;
}
intl_error_reset(NULL);
@@ -764,9 +758,7 @@ static PHP_METHOD(UConverter, convert) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|b",
&str, &str_len, &reverse) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "UConverter::convert(): bad arguments", 0);
- RETURN_FALSE;
+ return;
}
intl_errors_reset(&objval->error);
@@ -798,9 +790,7 @@ static PHP_METHOD(UConverter, transcode) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sss|a!",
&str, &str_len, &dest, &dest_len, &src, &src_len, &options) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "UConverter::transcode(): bad arguments", 0);
- RETURN_FALSE;
+ return;
}
intl_error_reset(NULL);
@@ -857,7 +847,7 @@ static PHP_METHOD(UConverter, getErrorCode) {
if (zend_parse_parameters_none() == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"UConverter::getErrorCode(): expected no arguments", 0);
- RETURN_FALSE;
+ return;
}
RETURN_LONG(intl_error_get_code(&(objval->error)));
@@ -874,7 +864,7 @@ static PHP_METHOD(UConverter, getErrorMessage) {
if (zend_parse_parameters_none() == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"UConverter::getErrorMessage(): expected no arguments", 0);
- RETURN_FALSE;
+ return;
}
if (message) {
@@ -895,7 +885,7 @@ static PHP_METHOD(UConverter, getAvailable) {
if (zend_parse_parameters_none() == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"UConverter::getErrorMessage(): expected no arguments", 0);
- RETURN_FALSE;
+ return;
}
intl_error_reset(NULL);
@@ -918,9 +908,7 @@ static PHP_METHOD(UConverter, getAliases) {
uint16_t i, count;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "UConverter::getAliases(): bad arguments", 0);
- RETURN_FALSE;
+ return;
}
intl_error_reset(NULL);
@@ -955,7 +943,7 @@ static PHP_METHOD(UConverter, getStandards) {
if (zend_parse_parameters_none() == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"UConverter::getStandards(): expected no arguments", 0);
- RETURN_FALSE;
+ return;
}
intl_error_reset(NULL);
@@ -1050,9 +1038,9 @@ static zend_object *php_converter_create_object(zend_class_entry *ce) {
return retval;
}
-static zend_object *php_converter_clone_object(zval *object) {
- php_converter_object *objval, *oldobj = Z_INTL_CONVERTER_P(object);
- zend_object *retval = php_converter_object_ctor(Z_OBJCE_P(object), &objval);
+static zend_object *php_converter_clone_object(zend_object *object) {
+ php_converter_object *objval, *oldobj = php_converter_fetch_object(object);
+ zend_object *retval = php_converter_object_ctor(object->ce, &objval);
UErrorCode error = U_ZERO_ERROR;
intl_errors_reset(&oldobj->error);
diff --git a/ext/intl/converter/converter.h b/ext/intl/converter/converter.h
index 520c7c6c86..5dc0b2773b 100644
--- a/ext/intl/converter/converter.h
+++ b/ext/intl/converter/converter.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/dateformat/dateformat.c b/ext/intl/dateformat/dateformat.c
index b1821ce0d3..10d9dde96e 100644
--- a/ext/intl/dateformat/dateformat.c
+++ b/ext/intl/dateformat/dateformat.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -46,6 +44,10 @@ void dateformat_register_constants( INIT_FUNC_ARGS )
DATEFORMATTER_EXPOSE_CLASS_CONST( MEDIUM );
DATEFORMATTER_EXPOSE_CLASS_CONST( SHORT );
DATEFORMATTER_EXPOSE_CLASS_CONST( NONE );
+ DATEFORMATTER_EXPOSE_CUSTOM_CLASS_CONST( "RELATIVE_FULL", UDAT_FULL_RELATIVE );
+ DATEFORMATTER_EXPOSE_CUSTOM_CLASS_CONST( "RELATIVE_LONG", UDAT_LONG_RELATIVE );
+ DATEFORMATTER_EXPOSE_CUSTOM_CLASS_CONST( "RELATIVE_MEDIUM", UDAT_MEDIUM_RELATIVE );
+ DATEFORMATTER_EXPOSE_CUSTOM_CLASS_CONST( "RELATIVE_SHORT", UDAT_SHORT_RELATIVE );
/*
DATEFORMATTER_EXPOSE_CUSTOM_CLASS_CONST( "GREGORIAN", DATEF_GREGORIAN );
@@ -77,9 +79,7 @@ PHP_FUNCTION( datefmt_get_error_code )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O",
&object, IntlDateFormatter_ce_ptr ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "datefmt_get_error_code: unable to parse input params", 0 );
- RETURN_FALSE;
+ RETURN_THROWS();
}
dfo = Z_INTL_DATEFORMATTER_P( object );
@@ -103,10 +103,7 @@ PHP_FUNCTION( datefmt_get_error_message )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O",
&object, IntlDateFormatter_ce_ptr ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "datefmt_get_error_message: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
dfo = Z_INTL_DATEFORMATTER_P( object );
diff --git a/ext/intl/dateformat/dateformat.h b/ext/intl/dateformat/dateformat.h
index 6139b67951..ebeeaa5963 100644
--- a/ext/intl/dateformat/dateformat.h
+++ b/ext/intl/dateformat/dateformat.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/dateformat/dateformat.stub.php b/ext/intl/dateformat/dateformat.stub.php
new file mode 100644
index 0000000000..adf8f463f8
--- /dev/null
+++ b/ext/intl/dateformat/dateformat.stub.php
@@ -0,0 +1,138 @@
+<?php
+
+class IntlDateFormatter
+{
+ /**
+ * @param IntlTimeZone|DateTimeZone|string|null $timezone
+ * @param IntlCalendar|int|null $calendar
+ */
+ public function __construct(?string $locale, int $datetype, int $timetype, $timezone = null, $calendar = null, string $pattern = "") {}
+
+ /**
+ * @param IntlTimeZone|DateTimeZone|string|null $timezone
+ * @param IntlCalendar|int|null $calendar
+ * @return IntlDateFormatter|null
+ */
+ public static function create(?string $locale, int $datetype, int $timetype, $timezone = null, $calendar = null, string $pattern = "") {}
+
+ /** @return int|false */
+ public function getDateType() {}
+
+ /** @return int|false */
+ public function getTimeType() {}
+
+ /** @return int|false */
+ public function getCalendar() {}
+
+ /**
+ * @param IntlCalendar|int|null $which
+ * @return bool
+ */
+ public function setCalendar($which) {}
+
+ /** @return string|false */
+ public function getTimeZoneId() {}
+
+ /** @return IntlCalendar|null|false */
+ public function getCalendarObject() {}
+
+ /** @return IntlTimeZone|false */
+ public function getTimeZone() {}
+
+ /**
+ * @param IntlTimeZone|DateTimeZone|string|null $zone
+ * @return ?bool
+ */
+ public function setTimeZone($zone) {}
+
+ /** @return bool */
+ public function setPattern(string $pattern) {}
+
+ /** @return string|false */
+ public function getPattern() {}
+
+ /** @return string|false */
+ public function getLocale(int $which = UNKNOWN) {}
+
+ /** @return void */
+ public function setLenient(bool $lenient) {}
+
+ /** @return bool */
+ public function isLenient() {}
+
+ /**
+ * @param array|int $value
+ * @return string|false
+ */
+ public function format($value) {}
+
+ /**
+ * @param IntlCalendar|DateTime $object
+ * @param array|int|string|null $format
+ * @return string|false
+ */
+ public static function formatObject($object, $format = null, ?string $locale = null) {}
+
+ /** @return int|float|false */
+ public function parse(string $value, &$position = null) {}
+
+ /** @return array|false */
+ public function localtime(string $value, &$position = null) {}
+
+ /** @return int */
+ public function getErrorCode() {}
+
+ /** @return string */
+ public function getErrorMessage() {}
+}
+
+/**
+ * @param IntlTimeZone|DateTimeZone|string|null $timezone
+ * @param IntlCalendar|int|null $calendar
+ */
+function datefmt_create(?string $locale, int $datetype, int $timetype, $timezone = null, $calendar = null, string $pattern = ""): ?IntlDateFormatter {}
+
+function datefmt_get_datetype(IntlDateFormatter $df): int|false {}
+
+function datefmt_get_timetype(IntlDateFormatter $df): int|false {}
+
+function datefmt_get_calendar(IntlDateFormatter $df): int|false {}
+
+/** @param IntlCalendar|int|null $which */
+function datefmt_set_calendar(IntlDateFormatter $df, $which): bool {}
+
+function datefmt_get_timezone_id(IntlDateFormatter $df): string|false {}
+
+function datefmt_get_calendar_object(IntlDateFormatter $df): IntlCalendar|false|null {}
+
+function datefmt_get_timezone(IntlDateFormatter $df): IntlTimeZone|false {}
+
+/** @param IntlTimeZone|DateTimeZone|string|null $zone */
+function datefmt_set_timezone(IntlDateFormatter $df, $zone): ?bool {}
+
+function datefmt_set_pattern(IntlDateFormatter $df, string $pattern): bool {}
+
+function datefmt_get_pattern(IntlDateFormatter $df): string|false {}
+
+function datefmt_get_locale(IntlDateFormatter $df, int $which = UNKNOWN): string|false {}
+
+function datefmt_set_lenient(IntlDateFormatter $df, bool $lenient): void {}
+
+function datefmt_is_lenient(IntlDateFormatter $df): bool {}
+
+/** @param mixed $value */
+function datefmt_format(IntlDateFormatter $df, $value): string|false {}
+
+/**
+ * @param IntlCalendar|DateTimeInterface $object
+ * @param array|int|string|null $format
+ */
+function datefmt_format_object($object, $format = null, ?string $locale = null): string|false {}
+
+function datefmt_parse(IntlDateFormatter $df, string $value, &$position = null): int|float|false {}
+
+function datefmt_localtime(IntlDateFormatter $df, string $value, &$position = null): array|false {}
+
+function datefmt_get_error_code(IntlDateFormatter $df): int {}
+
+function datefmt_get_error_message(IntlDateFormatter $df): string {}
diff --git a/ext/intl/dateformat/dateformat_arginfo.h b/ext/intl/dateformat/dateformat_arginfo.h
new file mode 100644
index 0000000000..6d86c9cde8
--- /dev/null
+++ b/ext/intl/dateformat/dateformat_arginfo.h
@@ -0,0 +1,161 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlDateFormatter___construct, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, datetype, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, timetype, IS_LONG, 0)
+ ZEND_ARG_INFO(0, timezone)
+ ZEND_ARG_INFO(0, calendar)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_IntlDateFormatter_create arginfo_class_IntlDateFormatter___construct
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlDateFormatter_getDateType, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_IntlDateFormatter_getTimeType arginfo_class_IntlDateFormatter_getDateType
+
+#define arginfo_class_IntlDateFormatter_getCalendar arginfo_class_IntlDateFormatter_getDateType
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlDateFormatter_setCalendar, 0, 0, 1)
+ ZEND_ARG_INFO(0, which)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_IntlDateFormatter_getTimeZoneId arginfo_class_IntlDateFormatter_getDateType
+
+#define arginfo_class_IntlDateFormatter_getCalendarObject arginfo_class_IntlDateFormatter_getDateType
+
+#define arginfo_class_IntlDateFormatter_getTimeZone arginfo_class_IntlDateFormatter_getDateType
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlDateFormatter_setTimeZone, 0, 0, 1)
+ ZEND_ARG_INFO(0, zone)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlDateFormatter_setPattern, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_IntlDateFormatter_getPattern arginfo_class_IntlDateFormatter_getDateType
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlDateFormatter_getLocale, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, which, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlDateFormatter_setLenient, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, lenient, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_IntlDateFormatter_isLenient arginfo_class_IntlDateFormatter_getDateType
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlDateFormatter_format, 0, 0, 1)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlDateFormatter_formatObject, 0, 0, 1)
+ ZEND_ARG_INFO(0, object)
+ ZEND_ARG_INFO(0, format)
+ ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlDateFormatter_parse, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
+ ZEND_ARG_INFO(1, position)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_IntlDateFormatter_localtime arginfo_class_IntlDateFormatter_parse
+
+#define arginfo_class_IntlDateFormatter_getErrorCode arginfo_class_IntlDateFormatter_getDateType
+
+#define arginfo_class_IntlDateFormatter_getErrorMessage arginfo_class_IntlDateFormatter_getDateType
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_datefmt_create, 0, 3, IntlDateFormatter, 1)
+ ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, datetype, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, timetype, IS_LONG, 0)
+ ZEND_ARG_INFO(0, timezone)
+ ZEND_ARG_INFO(0, calendar)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_datefmt_get_datetype, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_datefmt_get_timetype arginfo_datefmt_get_datetype
+
+#define arginfo_datefmt_get_calendar arginfo_datefmt_get_datetype
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_datefmt_set_calendar, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
+ ZEND_ARG_INFO(0, which)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_datefmt_get_timezone_id, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_datefmt_get_calendar_object, 0, 1, IntlCalendar, MAY_BE_FALSE|MAY_BE_NULL)
+ ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_datefmt_get_timezone, 0, 1, IntlTimeZone, MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_datefmt_set_timezone, 0, 2, _IS_BOOL, 1)
+ ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
+ ZEND_ARG_INFO(0, zone)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_datefmt_set_pattern, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_datefmt_get_pattern arginfo_datefmt_get_timezone_id
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_datefmt_get_locale, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
+ ZEND_ARG_TYPE_INFO(0, which, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_datefmt_set_lenient, 0, 2, IS_VOID, 0)
+ ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
+ ZEND_ARG_TYPE_INFO(0, lenient, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_datefmt_is_lenient, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_datefmt_format, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_datefmt_format_object, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, object)
+ ZEND_ARG_INFO(0, format)
+ ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_datefmt_parse, 0, 2, MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
+ ZEND_ARG_INFO(1, position)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_datefmt_localtime, 0, 2, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
+ ZEND_ARG_INFO(1, position)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_datefmt_get_error_code, 0, 1, IS_LONG, 0)
+ ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_datefmt_get_error_message, 0, 1, IS_STRING, 0)
+ ZEND_ARG_OBJ_INFO(0, df, IntlDateFormatter, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/intl/dateformat/dateformat_attr.c b/ext/intl/dateformat/dateformat_attr.c
index d44b3d1789..6145983d58 100644
--- a/ext/intl/dateformat/dateformat_attr.c
+++ b/ext/intl/dateformat/dateformat_attr.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -38,9 +36,7 @@ PHP_FUNCTION( datefmt_get_datetype )
/* Parse parameters. */
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O", &object, IntlDateFormatter_ce_ptr ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "datefmt_get_datetype: unable to parse input params", 0 );
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* Fetch the object. */
@@ -64,9 +60,7 @@ PHP_FUNCTION( datefmt_get_timetype )
/* Parse parameters. */
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O", &object, IntlDateFormatter_ce_ptr ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "datefmt_get_timetype: unable to parse input params", 0 );
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* Fetch the object. */
@@ -95,9 +89,7 @@ PHP_FUNCTION( datefmt_get_pattern )
/* Parse parameters. */
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O", &object, IntlDateFormatter_ce_ptr ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "datefmt_get_pattern: unable to parse input params", 0 );
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* Fetch the object. */
@@ -140,9 +132,7 @@ PHP_FUNCTION( datefmt_set_pattern )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Os",
&object, IntlDateFormatter_ce_ptr, &value, &value_len ) == FAILURE )
{
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "datefmt_set_pattern: unable to parse input params", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
DATE_FORMAT_METHOD_FETCH_OBJECT;
@@ -178,10 +168,8 @@ PHP_FUNCTION( datefmt_get_locale )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O|l",
&object, IntlDateFormatter_ce_ptr,&loc_type) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "datefmt_get_locale: unable to parse input params", 0 );
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* Fetch the object. */
@@ -207,10 +195,8 @@ PHP_FUNCTION( datefmt_is_lenient )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O",
&object, IntlDateFormatter_ce_ptr ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "datefmt_is_lenient: unable to parse input params", 0 );
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* Fetch the object. */
@@ -220,9 +206,9 @@ PHP_FUNCTION( datefmt_is_lenient )
}
/* }}} */
-/* {{{ proto string IntlDateFormatter::setLenient()
+/* {{{ proto void IntlDateFormatter::setLenient()
* Set formatter lenient. }}} */
-/* {{{ proto string datefmt_setLenient(IntlDateFormatter $mf)
+/* {{{ proto void datefmt_setLenient(IntlDateFormatter $mf)
* Set formatter lenient.
*/
PHP_FUNCTION( datefmt_set_lenient )
@@ -235,9 +221,7 @@ PHP_FUNCTION( datefmt_set_lenient )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Ob",
&object, IntlDateFormatter_ce_ptr,&isLenient ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "datefmt_set_lenient: unable to parse input params", 0 );
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* Fetch the object. */
diff --git a/ext/intl/dateformat/dateformat_attr.h b/ext/intl/dateformat/dateformat_attr.h
index e7013a9e2a..321c1d607a 100644
--- a/ext/intl/dateformat/dateformat_attr.h
+++ b/ext/intl/dateformat/dateformat_attr.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/dateformat/dateformat_attrcpp.cpp b/ext/intl/dateformat/dateformat_attrcpp.cpp
index fec8eb1a67..c37c451565 100644
--- a/ext/intl/dateformat/dateformat_attrcpp.cpp
+++ b/ext/intl/dateformat/dateformat_attrcpp.cpp
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -49,9 +47,7 @@ U_CFUNC PHP_FUNCTION(datefmt_get_timezone_id)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O",
&object, IntlDateFormatter_ce_ptr ) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_get_timezone_"
- "id: unable to parse input params", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
DATE_FORMAT_METHOD_FETCH_OBJECT;
@@ -75,9 +71,7 @@ U_CFUNC PHP_FUNCTION(datefmt_get_timezone)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O",
&object, IntlDateFormatter_ce_ptr ) == FAILURE) {
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "datefmt_get_timezone: unable to parse input params", 0 );
- RETURN_FALSE;
+ RETURN_THROWS();
}
DATE_FORMAT_METHOD_FETCH_OBJECT;
@@ -105,9 +99,7 @@ U_CFUNC PHP_FUNCTION(datefmt_set_timezone)
if ( zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"Oz", &object, IntlDateFormatter_ce_ptr, &timezone_zv) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_set_timezone: "
- "unable to parse input params", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
DATE_FORMAT_METHOD_FETCH_OBJECT;
@@ -132,9 +124,7 @@ U_CFUNC PHP_FUNCTION(datefmt_get_calendar)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O",
&object, IntlDateFormatter_ce_ptr ) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "datefmt_get_calendar: unable to parse input params", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
DATE_FORMAT_METHOD_FETCH_OBJECT;
@@ -159,10 +149,7 @@ U_CFUNC PHP_FUNCTION(datefmt_get_calendar_object)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O",
&object, IntlDateFormatter_ce_ptr ) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "datefmt_get_calendar_object: unable to parse input params",
- 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
DATE_FORMAT_METHOD_FETCH_OBJECT;
@@ -196,9 +183,7 @@ U_CFUNC PHP_FUNCTION(datefmt_set_calendar)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oz",
&object, IntlDateFormatter_ce_ptr, &calendar_zv) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "datefmt_set_calendar: unable to parse input params", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
DATE_FORMAT_METHOD_FETCH_OBJECT;
diff --git a/ext/intl/dateformat/dateformat_attrcpp.h b/ext/intl/dateformat/dateformat_attrcpp.h
index ab69914540..e2f9ffe9b2 100644
--- a/ext/intl/dateformat/dateformat_attrcpp.h
+++ b/ext/intl/dateformat/dateformat_attrcpp.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/dateformat/dateformat_class.c b/ext/intl/dateformat/dateformat_class.c
index b923f70508..58331053db 100644
--- a/ext/intl/dateformat/dateformat_class.c
+++ b/ext/intl/dateformat/dateformat_class.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -24,6 +22,7 @@
#include "dateformat.h"
#include "dateformat_attr.h"
#include "dateformat_attrcpp.h"
+#include "dateformat_arginfo.h"
#include <zend_exceptions.h>
@@ -77,14 +76,14 @@ zend_object *IntlDateFormatter_object_create(zend_class_entry *ce)
/* }}} */
/* {{{ IntlDateFormatter_object_clone */
-zend_object *IntlDateFormatter_object_clone(zval *object)
+zend_object *IntlDateFormatter_object_clone(zend_object *object)
{
IntlDateFormatter_object *dfo, *new_dfo;
zend_object *new_obj;
- DATE_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK;
+ dfo = php_intl_dateformatter_fetch_object(object);
- new_obj = IntlDateFormatter_ce_ptr->create_object(Z_OBJCE_P(object));
+ new_obj = IntlDateFormatter_ce_ptr->create_object(object->ce);
new_dfo = php_intl_dateformatter_fetch_object(new_obj);
/* clone standard parts */
zend_objects_clone_members(&new_dfo->zo, &dfo->zo);
@@ -108,77 +107,31 @@ zend_object *IntlDateFormatter_object_clone(zval *object)
* 'IntlDateFormatter' class registration structures & functions
*/
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(datefmt_parse_args, 0, 0, 1)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(1, position)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_intldateformatter_format, 0, 0, 0)
- ZEND_ARG_INFO(0, args)
- ZEND_ARG_INFO(0, array)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_intldateformatter_format_object, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
- ZEND_ARG_INFO(0, format)
- ZEND_ARG_INFO(0, locale)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_intldateformatter_getdatetype, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_intldateformatter_settimezoneid, 0, 0, 1)
- ZEND_ARG_INFO(0, zone)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_intldateformatter_setpattern, 0, 0, 1)
- ZEND_ARG_INFO(0, pattern)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_intldateformatter_setlenient, 0, 0, 1)
- ZEND_ARG_INFO(0, lenient)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_intldateformatter_setcalendar, 0, 0, 1)
- ZEND_ARG_INFO(0, which)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_intldateformatter___construct, 0, 0, 3)
- ZEND_ARG_INFO(0, locale)
- ZEND_ARG_INFO(0, datetype)
- ZEND_ARG_INFO(0, timetype)
- ZEND_ARG_INFO(0, timezone)
- ZEND_ARG_INFO(0, calendar)
- ZEND_ARG_INFO(0, pattern)
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ IntlDateFormatter_class_functions
* Every 'IntlDateFormatter' class method has an entry in this table
*/
static const zend_function_entry IntlDateFormatter_class_functions[] = {
- PHP_ME( IntlDateFormatter, __construct, arginfo_intldateformatter___construct, ZEND_ACC_PUBLIC )
- ZEND_FENTRY( create, ZEND_FN( datefmt_create ), arginfo_intldateformatter___construct, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
- PHP_NAMED_FE( getDateType, ZEND_FN( datefmt_get_datetype ), arginfo_intldateformatter_getdatetype )
- PHP_NAMED_FE( getTimeType, ZEND_FN( datefmt_get_timetype ), arginfo_intldateformatter_getdatetype )
- PHP_NAMED_FE( getCalendar, ZEND_FN( datefmt_get_calendar ), arginfo_intldateformatter_getdatetype )
- PHP_NAMED_FE( getCalendarObject, ZEND_FN( datefmt_get_calendar_object ), arginfo_intldateformatter_getdatetype )
- PHP_NAMED_FE( setCalendar, ZEND_FN( datefmt_set_calendar ), arginfo_intldateformatter_setcalendar )
- PHP_NAMED_FE( getTimeZoneId, ZEND_FN( datefmt_get_timezone_id ), arginfo_intldateformatter_getdatetype )
- PHP_NAMED_FE( getTimeZone, ZEND_FN( datefmt_get_timezone ), arginfo_intldateformatter_getdatetype )
- PHP_NAMED_FE( setTimeZone, ZEND_FN( datefmt_set_timezone ), arginfo_intldateformatter_settimezoneid )
- PHP_NAMED_FE( setPattern, ZEND_FN( datefmt_set_pattern ), arginfo_intldateformatter_setpattern )
- PHP_NAMED_FE( getPattern, ZEND_FN( datefmt_get_pattern ), arginfo_intldateformatter_getdatetype )
- PHP_NAMED_FE( getLocale, ZEND_FN( datefmt_get_locale ), arginfo_intldateformatter_getdatetype )
- PHP_NAMED_FE( setLenient, ZEND_FN( datefmt_set_lenient ), arginfo_intldateformatter_setlenient )
- PHP_NAMED_FE( isLenient, ZEND_FN( datefmt_is_lenient ), arginfo_intldateformatter_getdatetype )
- PHP_NAMED_FE( format, ZEND_FN( datefmt_format ), arginfo_intldateformatter_format )
- PHP_ME_MAPPING( formatObject, datefmt_format_object, arginfo_intldateformatter_format_object, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- PHP_NAMED_FE( parse, ZEND_FN( datefmt_parse), datefmt_parse_args )
- PHP_NAMED_FE( localtime, ZEND_FN( datefmt_localtime ), datefmt_parse_args )
- PHP_NAMED_FE( getErrorCode, ZEND_FN( datefmt_get_error_code ), arginfo_intldateformatter_getdatetype )
- PHP_NAMED_FE( getErrorMessage, ZEND_FN( datefmt_get_error_message ), arginfo_intldateformatter_getdatetype )
+ PHP_ME( IntlDateFormatter, __construct, arginfo_class_IntlDateFormatter___construct, ZEND_ACC_PUBLIC )
+ ZEND_FENTRY( create, ZEND_FN( datefmt_create ), arginfo_class_IntlDateFormatter_create, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
+ PHP_NAMED_FE( getDateType, ZEND_FN( datefmt_get_datetype ), arginfo_class_IntlDateFormatter_getDateType )
+ PHP_NAMED_FE( getTimeType, ZEND_FN( datefmt_get_timetype ), arginfo_class_IntlDateFormatter_getTimeType )
+ PHP_NAMED_FE( getCalendar, ZEND_FN( datefmt_get_calendar ), arginfo_class_IntlDateFormatter_getCalendar )
+ PHP_NAMED_FE( getCalendarObject, ZEND_FN( datefmt_get_calendar_object ), arginfo_class_IntlDateFormatter_getCalendarObject )
+ PHP_NAMED_FE( setCalendar, ZEND_FN( datefmt_set_calendar ), arginfo_class_IntlDateFormatter_setCalendar )
+ PHP_NAMED_FE( getTimeZoneId, ZEND_FN( datefmt_get_timezone_id ), arginfo_class_IntlDateFormatter_getTimeZoneId )
+ PHP_NAMED_FE( getTimeZone, ZEND_FN( datefmt_get_timezone ), arginfo_class_IntlDateFormatter_getTimeZone )
+ PHP_NAMED_FE( setTimeZone, ZEND_FN( datefmt_set_timezone ), arginfo_class_IntlDateFormatter_setTimeZone )
+ PHP_NAMED_FE( setPattern, ZEND_FN( datefmt_set_pattern ), arginfo_class_IntlDateFormatter_setPattern )
+ PHP_NAMED_FE( getPattern, ZEND_FN( datefmt_get_pattern ), arginfo_class_IntlDateFormatter_getPattern )
+ PHP_NAMED_FE( getLocale, ZEND_FN( datefmt_get_locale ), arginfo_class_IntlDateFormatter_getLocale )
+ PHP_NAMED_FE( setLenient, ZEND_FN( datefmt_set_lenient ), arginfo_class_IntlDateFormatter_setLenient )
+ PHP_NAMED_FE( isLenient, ZEND_FN( datefmt_is_lenient ), arginfo_class_IntlDateFormatter_isLenient )
+ PHP_NAMED_FE( format, ZEND_FN( datefmt_format ), arginfo_class_IntlDateFormatter_format )
+ PHP_ME_MAPPING( formatObject, datefmt_format_object, arginfo_class_IntlDateFormatter_formatObject, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_NAMED_FE( parse, ZEND_FN( datefmt_parse), arginfo_class_IntlDateFormatter_parse )
+ PHP_NAMED_FE( localtime, ZEND_FN( datefmt_localtime ), arginfo_class_IntlDateFormatter_localtime )
+ PHP_NAMED_FE( getErrorCode, ZEND_FN( datefmt_get_error_code ), arginfo_class_IntlDateFormatter_getErrorCode )
+ PHP_NAMED_FE( getErrorMessage, ZEND_FN( datefmt_get_error_message ), arginfo_class_IntlDateFormatter_getErrorMessage )
PHP_FE_END
};
/* }}} */
diff --git a/ext/intl/dateformat/dateformat_class.h b/ext/intl/dateformat/dateformat_class.h
index e96a20b5ee..dc060dbe84 100644
--- a/ext/intl/dateformat/dateformat_class.h
+++ b/ext/intl/dateformat/dateformat_class.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -48,8 +46,8 @@ extern zend_class_entry *IntlDateFormatter_ce_ptr;
DATE_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK; \
if (dfo->datef_data.udatf == NULL) \
{ \
- intl_errors_set(&dfo->datef_data.error, U_ILLEGAL_ARGUMENT_ERROR, "Found unconstructed IntlDateFormatter", 0); \
- RETURN_FALSE; \
+ zend_throw_error(NULL, "Found unconstructed IntlDateFormatter"); \
+ RETURN_THROWS(); \
}
#define DATE_FORMAT_OBJECT(dfo) (dfo)->datef_data.udatf
diff --git a/ext/intl/dateformat/dateformat_create.cpp b/ext/intl/dateformat/dateformat_create.cpp
index 8c2b72a2da..eddc248d09 100644
--- a/ext/intl/dateformat/dateformat_create.cpp
+++ b/ext/intl/dateformat/dateformat_create.cpp
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -45,7 +43,7 @@ extern "C" {
UDAT_PATTERN == (i))
/* {{{ */
-static int datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_constructor)
+static int datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
{
zval *object;
const char *locale_str;
@@ -65,16 +63,13 @@ static int datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_constructor)
UChar* svalue = NULL; /* UTF-16 pattern_str */
int32_t slength = 0;
IntlDateFormatter_object* dfo;
- int zpp_flags = is_constructor ? ZEND_PARSE_PARAMS_THROW : 0;
intl_error_reset(NULL);
object = return_value;
/* Parse parameters. */
- if (zend_parse_parameters_ex(zpp_flags, ZEND_NUM_ARGS(), "s!ll|zzs",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s!ll|zzs",
&locale_str, &locale_len, &date_type, &time_type, &timezone_zv,
&calendar_zv, &pattern_str, &pattern_str_len) == FAILURE) {
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_create: "
- "unable to parse input parameters", 0);
return FAILURE;
}
@@ -192,7 +187,7 @@ error:
U_CFUNC PHP_FUNCTION( datefmt_create )
{
object_init_ex( return_value, IntlDateFormatter_ce_ptr );
- if (datefmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0) == FAILURE) {
+ if (datefmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU) == FAILURE) {
zval_ptr_dtor(return_value);
RETURN_NULL();
}
@@ -210,7 +205,7 @@ U_CFUNC PHP_METHOD( IntlDateFormatter, __construct )
/* return_value param is being changed, therefore we will always return
* NULL here */
return_value = ZEND_THIS;
- if (datefmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1) == FAILURE) {
+ if (datefmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU) == FAILURE) {
if (!EG(exception)) {
zend_string *err = intl_error_get_message(NULL);
zend_throw_exception(IntlException_ce_ptr, ZSTR_VAL(err), intl_error_get_code(NULL));
diff --git a/ext/intl/dateformat/dateformat_create.h b/ext/intl/dateformat/dateformat_create.h
index c6e2d0feb8..3bf357b702 100644
--- a/ext/intl/dateformat/dateformat_create.h
+++ b/ext/intl/dateformat/dateformat_create.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/dateformat/dateformat_data.c b/ext/intl/dateformat/dateformat_data.c
index 04d37aa7ac..f7e9596ce1 100644
--- a/ext/intl/dateformat/dateformat_data.c
+++ b/ext/intl/dateformat/dateformat_data.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/dateformat/dateformat_data.h b/ext/intl/dateformat/dateformat_data.h
index ed61c75594..eb57fbae5a 100644
--- a/ext/intl/dateformat/dateformat_data.h
+++ b/ext/intl/dateformat/dateformat_data.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/dateformat/dateformat_format.c b/ext/intl/dateformat/dateformat_format.c
index 5e51796cad..3c70089b7a 100644
--- a/ext/intl/dateformat/dateformat_format.c
+++ b/ext/intl/dateformat/dateformat_format.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -163,7 +161,7 @@ PHP_FUNCTION(datefmt_format)
&object, IntlDateFormatter_ce_ptr, &zarg) == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_format: unable "
"to parse input params", 0 );
- RETURN_FALSE;
+ RETURN_THROWS();
}
DATE_FORMAT_METHOD_FETCH_OBJECT;
diff --git a/ext/intl/dateformat/dateformat_format.h b/ext/intl/dateformat/dateformat_format.h
index 02b773f991..b8bd248d23 100644
--- a/ext/intl/dateformat/dateformat_format.h
+++ b/ext/intl/dateformat/dateformat_format.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/dateformat/dateformat_format_object.cpp b/ext/intl/dateformat/dateformat_format_object.cpp
index 90e148bca0..9723006b15 100644
--- a/ext/intl/dateformat/dateformat_format_object.cpp
+++ b/ext/intl/dateformat/dateformat_format_object.cpp
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -81,7 +79,7 @@ U_CFUNC PHP_FUNCTION(datefmt_format_object)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "o|zs!",
&object, &format, &locale_str, &locale_len) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (!locale_str) {
@@ -143,7 +141,7 @@ U_CFUNC PHP_FUNCTION(datefmt_format_object)
dateStyle = timeStyle = (DateFormat::EStyle)Z_LVAL_P(format);
} else {
if (!try_convert_to_string(format)) {
- return;
+ RETURN_THROWS();
}
if (Z_STRLEN_P(format) == 0) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
diff --git a/ext/intl/dateformat/dateformat_format_object.h b/ext/intl/dateformat/dateformat_format_object.h
index f92296cd59..a4c9c42589 100644
--- a/ext/intl/dateformat/dateformat_format_object.h
+++ b/ext/intl/dateformat/dateformat_format_object.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/dateformat/dateformat_helpers.cpp b/ext/intl/dateformat/dateformat_helpers.cpp
index 7e070ea464..69332e931c 100644
--- a/ext/intl/dateformat/dateformat_helpers.cpp
+++ b/ext/intl/dateformat/dateformat_helpers.cpp
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -53,7 +51,7 @@ int datefmt_process_calendar_arg(zval* calendar_zv,
zend_long v = Z_LVAL_P(calendar_zv);
if (v != (zend_long)UCAL_TRADITIONAL && v != (zend_long)UCAL_GREGORIAN) {
- spprintf(&msg, 0, "%s: invalid value for calendar type; it must be "
+ spprintf(&msg, 0, "%s: Invalid value for calendar type; it must be "
"one of IntlDateFormatter::TRADITIONAL (locale's default "
"calendar) or IntlDateFormatter::GREGORIAN. "
"Alternatively, it can be an IntlCalendar object",
@@ -71,8 +69,7 @@ int datefmt_process_calendar_arg(zval* calendar_zv,
cal_int_type = Z_LVAL_P(calendar_zv);
} else if (Z_TYPE_P(calendar_zv) == IS_OBJECT &&
- instanceof_function_ex(Z_OBJCE_P(calendar_zv),
- Calendar_ce_ptr, 0)) {
+ instanceof_function(Z_OBJCE_P(calendar_zv), Calendar_ce_ptr)) {
cal = calendar_fetch_native_calendar(calendar_zv);
if (cal == NULL) {
diff --git a/ext/intl/dateformat/dateformat_helpers.h b/ext/intl/dateformat/dateformat_helpers.h
index 7489effc18..0c88977015 100644
--- a/ext/intl/dateformat/dateformat_helpers.h
+++ b/ext/intl/dateformat/dateformat_helpers.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/dateformat/dateformat_parse.c b/ext/intl/dateformat/dateformat_parse.c
index af96095242..c6fc4fa9ca 100644
--- a/ext/intl/dateformat/dateformat_parse.c
+++ b/ext/intl/dateformat/dateformat_parse.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -137,8 +135,7 @@ PHP_FUNCTION(datefmt_parse)
/* Parse parameters. */
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Os|z!",
&object, IntlDateFormatter_ce_ptr, &text_to_parse, &text_len, &z_parse_pos ) == FAILURE ){
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_parse: unable to parse input params", 0 );
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* Fetch the object. */
@@ -182,8 +179,7 @@ PHP_FUNCTION(datefmt_localtime)
/* Parse parameters. */
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Os|z!",
&object, IntlDateFormatter_ce_ptr, &text_to_parse, &text_len, &z_parse_pos ) == FAILURE ){
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_parse_to_localtime: unable to parse input params", 0 );
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* Fetch the object. */
diff --git a/ext/intl/dateformat/dateformat_parse.h b/ext/intl/dateformat/dateformat_parse.h
index 694dbf8d90..e9184864f0 100644
--- a/ext/intl/dateformat/dateformat_parse.h
+++ b/ext/intl/dateformat/dateformat_parse.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/formatter/formatter.c b/ext/intl/formatter/formatter.c
index 98e8e4677a..2c70f10fab 100644
--- a/ext/intl/formatter/formatter.c
+++ b/ext/intl/formatter/formatter.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/formatter/formatter.h b/ext/intl/formatter/formatter.h
index 47ec473aae..054f1d5859 100644
--- a/ext/intl/formatter/formatter.h
+++ b/ext/intl/formatter/formatter.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/formatter/formatter.stub.php b/ext/intl/formatter/formatter.stub.php
new file mode 100644
index 0000000000..8d976f79e2
--- /dev/null
+++ b/ext/intl/formatter/formatter.stub.php
@@ -0,0 +1,90 @@
+<?php
+
+class NumberFormatter
+{
+ public function __construct(string $locale, int $style, string $pattern = "") {}
+
+ /** @return NumberFormatter|null */
+ public static function create(string $locale, int $style, string $pattern = "") {}
+
+ /** @return string|false */
+ public function format($value, int $type = NumberFormatter::TYPE_DEFAULT) {}
+
+ /** @return int|float|false */
+ public function parse(string $value, int $type = NumberFormatter::TYPE_DOUBLE, &$position = null) {}
+
+ /** @return string|false */
+ public function formatCurrency(float $value, string $currency) {}
+
+ /** @return float|false */
+ public function parseCurrency(string $value, &$currency, &$position = null) {}
+
+ /**
+ * @param int|float $value
+ * @return bool
+ */
+ public function setAttribute(int $attr, $value) {}
+
+ /** @return int|float|false */
+ public function getAttribute(int $attr) {}
+
+ /** @return bool */
+ public function setTextAttribute(int $attr, string $value) {}
+
+ /** @return string|false */
+ public function getTextAttribute(int $attr) {}
+
+ /** @return bool */
+ public function setSymbol(int $attr, string $value) {}
+
+ /** @return string|false */
+ public function getSymbol(int $attr) {}
+
+ /** @return bool */
+ public function setPattern(string $pattern) {}
+
+ /** @return string|false */
+ public function getPattern() {}
+
+ /** @return string|false */
+ public function getLocale(int $type = ULOC_ACTUAL_LOCALE) {}
+
+ /** @return int */
+ public function getErrorCode() {}
+
+ /** @return string */
+ public function getErrorMessage() {}
+}
+
+function numfmt_create(string $locale, int $style, string $pattern = ""): ?NumberFormatter {}
+
+function numfmt_format(NumberFormatter $fmt, $value, int $type = NumberFormatter::TYPE_DEFAULT): string|false {}
+
+function numfmt_parse(NumberFormatter $fmt, string $value, int $type = NumberFormatter::TYPE_DOUBLE, &$position = null): int|float|false {}
+
+function numfmt_format_currency(NumberFormatter $fmt, float $value, string $currency): string|false {}
+
+function numfmt_parse_currency(NumberFormatter $fmt, string $value, &$currency, &$position = null): float|false {}
+
+/** @param int|float $value */
+function numfmt_set_attribute(NumberFormatter $fmt, int $attr, $value): bool {}
+
+function numfmt_get_attribute(NumberFormatter $fmt, int $attr): int|double|false {}
+
+function numfmt_set_text_attribute(NumberFormatter $fmt, int $attr, string $value): bool {}
+
+function numfmt_get_text_attribute(NumberFormatter $fmt, int $attr): string|false {}
+
+function numfmt_set_symbol(NumberFormatter $fmt, int $attr, string $value): bool {}
+
+function numfmt_get_symbol(NumberFormatter $fmt, int $attr): string|false {}
+
+function numfmt_set_pattern(NumberFormatter $fmt, string $pattern): bool {}
+
+function numfmt_get_pattern(NumberFormatter $fmt): string|false {}
+
+function numfmt_get_locale(NumberFormatter $fmt, int $type = ULOC_ACTUAL_LOCALE): string|false {}
+
+function numfmt_get_error_code(NumberFormatter $fmt): int {}
+
+function numfmt_get_error_message(NumberFormatter $fmt): string {}
diff --git a/ext/intl/formatter/formatter_arginfo.h b/ext/intl/formatter/formatter_arginfo.h
new file mode 100644
index 0000000000..313d0dd714
--- /dev/null
+++ b/ext/intl/formatter/formatter_arginfo.h
@@ -0,0 +1,146 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_NumberFormatter___construct, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, style, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_NumberFormatter_create arginfo_class_NumberFormatter___construct
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_NumberFormatter_format, 0, 0, 1)
+ ZEND_ARG_INFO(0, value)
+ ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_NumberFormatter_parse, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+ ZEND_ARG_INFO(1, position)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_NumberFormatter_formatCurrency, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, value, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, currency, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_NumberFormatter_parseCurrency, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
+ ZEND_ARG_INFO(1, currency)
+ ZEND_ARG_INFO(1, position)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_NumberFormatter_setAttribute, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, attr, IS_LONG, 0)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_NumberFormatter_getAttribute, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, attr, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_NumberFormatter_setTextAttribute, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, attr, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_NumberFormatter_getTextAttribute arginfo_class_NumberFormatter_getAttribute
+
+#define arginfo_class_NumberFormatter_setSymbol arginfo_class_NumberFormatter_setTextAttribute
+
+#define arginfo_class_NumberFormatter_getSymbol arginfo_class_NumberFormatter_getAttribute
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_NumberFormatter_setPattern, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_NumberFormatter_getPattern, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_NumberFormatter_getLocale, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_NumberFormatter_getErrorCode arginfo_class_NumberFormatter_getPattern
+
+#define arginfo_class_NumberFormatter_getErrorMessage arginfo_class_NumberFormatter_getPattern
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_numfmt_create, 0, 2, NumberFormatter, 1)
+ ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, style, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_numfmt_format, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, fmt, NumberFormatter, 0)
+ ZEND_ARG_INFO(0, value)
+ ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_numfmt_parse, 0, 2, MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, fmt, NumberFormatter, 0)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+ ZEND_ARG_INFO(1, position)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_numfmt_format_currency, 0, 3, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, fmt, NumberFormatter, 0)
+ ZEND_ARG_TYPE_INFO(0, value, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, currency, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_numfmt_parse_currency, 0, 3, MAY_BE_DOUBLE|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, fmt, NumberFormatter, 0)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
+ ZEND_ARG_INFO(1, currency)
+ ZEND_ARG_INFO(1, position)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_numfmt_set_attribute, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, fmt, NumberFormatter, 0)
+ ZEND_ARG_TYPE_INFO(0, attr, IS_LONG, 0)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_numfmt_get_attribute, 0, 2, double, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, fmt, NumberFormatter, 0)
+ ZEND_ARG_TYPE_INFO(0, attr, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_numfmt_set_text_attribute, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, fmt, NumberFormatter, 0)
+ ZEND_ARG_TYPE_INFO(0, attr, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_numfmt_get_text_attribute, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, fmt, NumberFormatter, 0)
+ ZEND_ARG_TYPE_INFO(0, attr, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_numfmt_set_symbol arginfo_numfmt_set_text_attribute
+
+#define arginfo_numfmt_get_symbol arginfo_numfmt_get_text_attribute
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_numfmt_set_pattern, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, fmt, NumberFormatter, 0)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_numfmt_get_pattern, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, fmt, NumberFormatter, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_numfmt_get_locale, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, fmt, NumberFormatter, 0)
+ ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_numfmt_get_error_code, 0, 1, IS_LONG, 0)
+ ZEND_ARG_OBJ_INFO(0, fmt, NumberFormatter, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_numfmt_get_error_message, 0, 1, IS_STRING, 0)
+ ZEND_ARG_OBJ_INFO(0, fmt, NumberFormatter, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/intl/formatter/formatter_attr.c b/ext/intl/formatter/formatter_attr.c
index b04c33eaad..49b11c62ba 100644
--- a/ext/intl/formatter/formatter_attr.c
+++ b/ext/intl/formatter/formatter_attr.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -39,10 +37,7 @@ PHP_FUNCTION( numfmt_get_attribute )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Ol",
&object, NumberFormatter_ce_ptr, &attribute ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "numfmt_get_attribute: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* Fetch the object. */
@@ -112,10 +107,7 @@ PHP_FUNCTION( numfmt_get_text_attribute )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Ol",
&object, NumberFormatter_ce_ptr, &attribute ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "numfmt_get_text_attribute: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* Fetch the object. */
@@ -153,10 +145,7 @@ PHP_FUNCTION( numfmt_set_attribute )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Olz",
&object, NumberFormatter_ce_ptr, &attribute, &value ) == FAILURE)
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "numfmt_set_attribute: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* Fetch the object. */
@@ -216,10 +205,7 @@ PHP_FUNCTION( numfmt_set_text_attribute )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Ols",
&object, NumberFormatter_ce_ptr, &attribute, &value, &len ) == FAILURE)
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "numfmt_set_text_attribute: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* Fetch the object. */
@@ -257,10 +243,7 @@ PHP_FUNCTION( numfmt_get_symbol )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Ol",
&object, NumberFormatter_ce_ptr, &symbol ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "numfmt_get_symbol: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
if(symbol >= UNUM_FORMAT_SYMBOL_COUNT || symbol < 0) {
@@ -306,10 +289,7 @@ PHP_FUNCTION( numfmt_set_symbol )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Ols",
&object, NumberFormatter_ce_ptr, &symbol, &value, &value_len ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "numfmt_set_symbol: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (symbol >= UNUM_FORMAT_SYMBOL_COUNT || symbol < 0) {
@@ -351,10 +331,7 @@ PHP_FUNCTION( numfmt_get_pattern )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O",
&object, NumberFormatter_ce_ptr ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "numfmt_get_pattern: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* Fetch the object. */
@@ -394,10 +371,7 @@ PHP_FUNCTION( numfmt_set_pattern )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Os",
&object, NumberFormatter_ce_ptr, &value, &value_len ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "numfmt_set_pattern: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
FORMATTER_METHOD_FETCH_OBJECT;
@@ -432,10 +406,7 @@ PHP_FUNCTION( numfmt_get_locale )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O|l",
&object, NumberFormatter_ce_ptr, &type ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "numfmt_get_locale: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* Fetch the object. */
diff --git a/ext/intl/formatter/formatter_attr.h b/ext/intl/formatter/formatter_attr.h
index fd8b5b0b5c..5451aa0e9a 100644
--- a/ext/intl/formatter/formatter_attr.h
+++ b/ext/intl/formatter/formatter_attr.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/formatter/formatter_class.c b/ext/intl/formatter/formatter_class.c
index ad39f39392..ee4e74c835 100644
--- a/ext/intl/formatter/formatter_class.c
+++ b/ext/intl/formatter/formatter_class.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -23,8 +21,10 @@
#include "formatter_parse.h"
#include "formatter_main.h"
#include "formatter_attr.h"
+#include "formatter_arginfo.h"
#include <zend_exceptions.h>
+#include "Zend/zend_interfaces.h"
zend_class_entry *NumberFormatter_ce_ptr = NULL;
static zend_object_handlers NumberFormatter_handlers;
@@ -61,13 +61,13 @@ zend_object *NumberFormatter_object_create(zend_class_entry *ce)
/* }}} */
/* {{{ NumberFormatter_object_clone */
-zend_object *NumberFormatter_object_clone(zval *object)
+zend_object *NumberFormatter_object_clone(zend_object *object)
{
NumberFormatter_object *nfo, *new_nfo;
zend_object *new_obj;
- FORMATTER_METHOD_FETCH_OBJECT_NO_CHECK;
- new_obj = NumberFormatter_ce_ptr->create_object(Z_OBJCE_P(object));
+ nfo = php_intl_number_format_fetch_object(object);
+ new_obj = NumberFormatter_ce_ptr->create_object(object->ce);
new_nfo = php_intl_number_format_fetch_object(new_obj);
/* clone standard parts */
zend_objects_clone_members(&new_nfo->zo, &nfo->zo);
@@ -92,82 +92,27 @@ zend_object *NumberFormatter_object_clone(zval *object)
* 'NumberFormatter' class registration structures & functions
*/
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(number_parse_arginfo, 0, 0, 1)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, type)
- ZEND_ARG_INFO(1, position)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(number_parse_currency_arginfo, 0, 0, 2)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(1, currency)
- ZEND_ARG_INFO(1, position)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_numberformatter_getattribute, 0, 0, 1)
- ZEND_ARG_INFO(0, attr)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_numberformatter_setattribute, 0, 0, 2)
- ZEND_ARG_INFO(0, attr)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_numberformatter_setsymbol, 0, 0, 2)
- ZEND_ARG_INFO(0, attr)
- ZEND_ARG_INFO(0, symbol)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_numberformatter_getpattern, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_numberformatter_setpattern, 0, 0, 1)
- ZEND_ARG_INFO(0, pattern)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_numberformatter_getlocale, 0, 0, 0)
- ZEND_ARG_INFO(0, type)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_numberformatter___construct, 0, 0, 2)
- ZEND_ARG_INFO(0, locale)
- ZEND_ARG_INFO(0, style)
- ZEND_ARG_INFO(0, pattern)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_numberformatter_formatcurrency, 0, 0, 2)
- ZEND_ARG_INFO(0, num)
- ZEND_ARG_INFO(0, currency)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_numberformatter_format, 0, 0, 1)
- ZEND_ARG_INFO(0, num)
- ZEND_ARG_INFO(0, type)
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ NumberFormatter_class_functions
* Every 'NumberFormatter' class method has an entry in this table
*/
static const zend_function_entry NumberFormatter_class_functions[] = {
- PHP_ME( NumberFormatter, __construct, arginfo_numberformatter___construct, ZEND_ACC_PUBLIC )
- ZEND_FENTRY( create, ZEND_FN( numfmt_create ), arginfo_numberformatter___construct, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
- PHP_NAMED_FE( format, ZEND_FN( numfmt_format ), arginfo_numberformatter_format )
- PHP_NAMED_FE( parse, ZEND_FN( numfmt_parse ), number_parse_arginfo )
- PHP_NAMED_FE( formatCurrency, ZEND_FN( numfmt_format_currency ), arginfo_numberformatter_formatcurrency )
- PHP_NAMED_FE( parseCurrency, ZEND_FN( numfmt_parse_currency ), number_parse_currency_arginfo )
- PHP_NAMED_FE( setAttribute, ZEND_FN( numfmt_set_attribute ), arginfo_numberformatter_setattribute )
- PHP_NAMED_FE( getAttribute, ZEND_FN( numfmt_get_attribute ), arginfo_numberformatter_getattribute )
- PHP_NAMED_FE( setTextAttribute, ZEND_FN( numfmt_set_text_attribute ), arginfo_numberformatter_setattribute )
- PHP_NAMED_FE( getTextAttribute, ZEND_FN( numfmt_get_text_attribute ), arginfo_numberformatter_getattribute )
- PHP_NAMED_FE( setSymbol, ZEND_FN( numfmt_set_symbol ), arginfo_numberformatter_setsymbol )
- PHP_NAMED_FE( getSymbol, ZEND_FN( numfmt_get_symbol ), arginfo_numberformatter_getattribute )
- PHP_NAMED_FE( setPattern, ZEND_FN( numfmt_set_pattern ), arginfo_numberformatter_setpattern )
- PHP_NAMED_FE( getPattern, ZEND_FN( numfmt_get_pattern ), arginfo_numberformatter_getpattern )
- PHP_NAMED_FE( getLocale, ZEND_FN( numfmt_get_locale ), arginfo_numberformatter_getlocale )
- PHP_NAMED_FE( getErrorCode, ZEND_FN( numfmt_get_error_code ), arginfo_numberformatter_getpattern )
- PHP_NAMED_FE( getErrorMessage, ZEND_FN( numfmt_get_error_message ), arginfo_numberformatter_getpattern )
+ PHP_ME( NumberFormatter, __construct, arginfo_class_NumberFormatter___construct, ZEND_ACC_PUBLIC )
+ ZEND_FENTRY( create, ZEND_FN( numfmt_create ), arginfo_class_NumberFormatter_create, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
+ PHP_NAMED_FE( format, ZEND_FN( numfmt_format ), arginfo_class_NumberFormatter_format )
+ PHP_NAMED_FE( parse, ZEND_FN( numfmt_parse ), arginfo_class_NumberFormatter_parse )
+ PHP_NAMED_FE( formatCurrency, ZEND_FN( numfmt_format_currency ), arginfo_class_NumberFormatter_formatCurrency )
+ PHP_NAMED_FE( parseCurrency, ZEND_FN( numfmt_parse_currency ), arginfo_class_NumberFormatter_parseCurrency )
+ PHP_NAMED_FE( setAttribute, ZEND_FN( numfmt_set_attribute ), arginfo_class_NumberFormatter_setAttribute )
+ PHP_NAMED_FE( getAttribute, ZEND_FN( numfmt_get_attribute ), arginfo_class_NumberFormatter_getAttribute )
+ PHP_NAMED_FE( setTextAttribute, ZEND_FN( numfmt_set_text_attribute ), arginfo_class_NumberFormatter_setTextAttribute )
+ PHP_NAMED_FE( getTextAttribute, ZEND_FN( numfmt_get_text_attribute ), arginfo_class_NumberFormatter_getTextAttribute )
+ PHP_NAMED_FE( setSymbol, ZEND_FN( numfmt_set_symbol ), arginfo_class_NumberFormatter_setSymbol )
+ PHP_NAMED_FE( getSymbol, ZEND_FN( numfmt_get_symbol ), arginfo_class_NumberFormatter_getSymbol )
+ PHP_NAMED_FE( setPattern, ZEND_FN( numfmt_set_pattern ), arginfo_class_NumberFormatter_setPattern )
+ PHP_NAMED_FE( getPattern, ZEND_FN( numfmt_get_pattern ), arginfo_class_NumberFormatter_getPattern )
+ PHP_NAMED_FE( getLocale, ZEND_FN( numfmt_get_locale ), arginfo_class_NumberFormatter_getLocale )
+ PHP_NAMED_FE( getErrorCode, ZEND_FN( numfmt_get_error_code ), arginfo_class_NumberFormatter_getErrorCode )
+ PHP_NAMED_FE( getErrorMessage, ZEND_FN( numfmt_get_error_message ), arginfo_class_NumberFormatter_getErrorMessage )
PHP_FE_END
};
/* }}} */
@@ -183,6 +128,8 @@ void formatter_register_class( void )
INIT_CLASS_ENTRY( ce, "NumberFormatter", NumberFormatter_class_functions );
ce.create_object = NumberFormatter_object_create;
NumberFormatter_ce_ptr = zend_register_internal_class( &ce );
+ NumberFormatter_ce_ptr->serialize = zend_class_serialize_deny;
+ NumberFormatter_ce_ptr->unserialize = zend_class_unserialize_deny;
memcpy(&NumberFormatter_handlers, &std_object_handlers,
sizeof(NumberFormatter_handlers));
diff --git a/ext/intl/formatter/formatter_class.h b/ext/intl/formatter/formatter_class.h
index 1d6fa817c9..b221a96ee4 100644
--- a/ext/intl/formatter/formatter_class.h
+++ b/ext/intl/formatter/formatter_class.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -46,9 +44,8 @@ extern zend_class_entry *NumberFormatter_ce_ptr;
FORMATTER_METHOD_FETCH_OBJECT_NO_CHECK; \
if (FORMATTER_OBJECT(nfo) == NULL) \
{ \
- intl_errors_set(&nfo->nf_data.error, U_ILLEGAL_ARGUMENT_ERROR, \
- "Found unconstructed NumberFormatter", 0); \
- RETURN_FALSE; \
+ zend_throw_error(NULL, "Found unconstructed NumberFormatter"); \
+ RETURN_THROWS(); \
}
diff --git a/ext/intl/formatter/formatter_data.c b/ext/intl/formatter/formatter_data.c
index fec5320988..165b2c19b3 100644
--- a/ext/intl/formatter/formatter_data.c
+++ b/ext/intl/formatter/formatter_data.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/formatter/formatter_data.h b/ext/intl/formatter/formatter_data.h
index 8d1bfd12cd..e8c0591fd2 100644
--- a/ext/intl/formatter/formatter_data.h
+++ b/ext/intl/formatter/formatter_data.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/formatter/formatter_format.c b/ext/intl/formatter/formatter_format.c
index 0b0c9029e6..8c6a567eb2 100644
--- a/ext/intl/formatter/formatter_format.c
+++ b/ext/intl/formatter/formatter_format.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -44,10 +42,7 @@ PHP_FUNCTION( numfmt_format )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Oz|l",
&object, NumberFormatter_ce_ptr, &number, &type ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "numfmt_format: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* Fetch the object. */
@@ -150,10 +145,7 @@ PHP_FUNCTION( numfmt_format_currency )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Ods",
&object, NumberFormatter_ce_ptr, &number, &currency, &currency_len ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "numfmt_format_currency: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* Fetch the object. */
diff --git a/ext/intl/formatter/formatter_format.h b/ext/intl/formatter/formatter_format.h
index c4d6bfb101..d6c0364962 100644
--- a/ext/intl/formatter/formatter_format.h
+++ b/ext/intl/formatter/formatter_format.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/formatter/formatter_main.c b/ext/intl/formatter/formatter_main.c
index a4671c093a..be5e6afdda 100644
--- a/ext/intl/formatter/formatter_main.c
+++ b/ext/intl/formatter/formatter_main.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -25,7 +23,7 @@
#include "intl_convert.h"
/* {{{ */
-static int numfmt_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_constructor)
+static int numfmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
{
const char* locale;
char* pattern = NULL;
@@ -33,15 +31,12 @@ static int numfmt_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_constructor)
zend_long style;
UChar* spattern = NULL;
int32_t spattern_len = 0;
- int zpp_flags = is_constructor ? ZEND_PARSE_PARAMS_THROW : 0;
FORMATTER_METHOD_INIT_VARS;
/* Parse parameters. */
- if( zend_parse_parameters_ex( zpp_flags, ZEND_NUM_ARGS(), "sl|s",
+ if( zend_parse_parameters( ZEND_NUM_ARGS(), "sl|s",
&locale, &locale_len, &style, &pattern, &pattern_len ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "numfmt_create: unable to parse input parameters", 0 );
return FAILURE;
}
@@ -79,7 +74,7 @@ static int numfmt_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_constructor)
PHP_FUNCTION( numfmt_create )
{
object_init_ex( return_value, NumberFormatter_ce_ptr );
- if (numfmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0) == FAILURE) {
+ if (numfmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU) == FAILURE) {
zval_ptr_dtor(return_value);
RETURN_NULL();
}
@@ -95,7 +90,7 @@ PHP_METHOD( NumberFormatter, __construct )
zend_replace_error_handling(EH_THROW, IntlException_ce_ptr, &error_handling);
return_value = ZEND_THIS;
- if (numfmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1) == FAILURE) {
+ if (numfmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU) == FAILURE) {
if (!EG(exception)) {
zend_throw_exception(IntlException_ce_ptr, "Constructor failed", 0);
}
@@ -117,10 +112,7 @@ PHP_FUNCTION( numfmt_get_error_code )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O",
&object, NumberFormatter_ce_ptr ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "numfmt_get_error_code: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
nfo = Z_INTL_NUMBERFORMATTER_P(object);
@@ -144,10 +136,7 @@ PHP_FUNCTION( numfmt_get_error_message )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O",
&object, NumberFormatter_ce_ptr ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "numfmt_get_error_message: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
nfo = Z_INTL_NUMBERFORMATTER_P(object);
diff --git a/ext/intl/formatter/formatter_main.h b/ext/intl/formatter/formatter_main.h
index 66cf5c1b6b..f932e3cc71 100644
--- a/ext/intl/formatter/formatter_main.h
+++ b/ext/intl/formatter/formatter_main.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/formatter/formatter_parse.c b/ext/intl/formatter/formatter_parse.c
index ed338dd7d1..1278c014d5 100644
--- a/ext/intl/formatter/formatter_parse.c
+++ b/ext/intl/formatter/formatter_parse.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -54,10 +52,7 @@ PHP_FUNCTION( numfmt_parse )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Os|lz!",
&object, NumberFormatter_ce_ptr, &str, &str_len, &type, &zposition ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "number_parse: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
if(zposition) {
@@ -139,10 +134,7 @@ PHP_FUNCTION( numfmt_parse_currency )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Osz/|z!",
&object, NumberFormatter_ce_ptr, &str, &str_len, &zcurrency, &zposition ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "number_parse_currency: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* Fetch the object. */
diff --git a/ext/intl/formatter/formatter_parse.h b/ext/intl/formatter/formatter_parse.h
index 7a3098fcb2..039669d7fa 100644
--- a/ext/intl/formatter/formatter_parse.h
+++ b/ext/intl/formatter/formatter_parse.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/grapheme/grapheme.h b/ext/intl/grapheme/grapheme.h
index 871e660639..62aa1ec1b2 100644
--- a/ext/intl/grapheme/grapheme.h
+++ b/ext/intl/grapheme/grapheme.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/grapheme/grapheme.stub.php b/ext/intl/grapheme/grapheme.stub.php
new file mode 100644
index 0000000000..669b590437
--- /dev/null
+++ b/ext/intl/grapheme/grapheme.stub.php
@@ -0,0 +1,19 @@
+<?php
+
+function grapheme_strlen(string $input): int|false|null {}
+
+function grapheme_strpos(string $haystack, string $needle, int $offset = 0): int|false {}
+
+function grapheme_stripos(string $haystack, string $needle, int $offset = 0): int|false {}
+
+function grapheme_strrpos(string $haystack, string $needle, int $offset = 0): int|false {}
+
+function grapheme_strripos(string $haystack, string $needle, int $offset = 0): int|false {}
+
+function grapheme_substr(string $string, int $start, ?int $length = 0): string|false {}
+
+function grapheme_strstr(string $haystack, string $needle, bool $before_needle = false): string|false {}
+
+function grapheme_stristr(string $haystack, string $needle, bool $before_needle = false): string|false {}
+
+function grapheme_extract(string $haystack, int $size, int $extract_type = GRAPHEME_EXTR_COUNT, int $start = 0, &$next = null): string|false {}
diff --git a/ext/intl/grapheme/grapheme_arginfo.h b/ext/intl/grapheme/grapheme_arginfo.h
new file mode 100644
index 0000000000..1dc2e95199
--- /dev/null
+++ b/ext/intl/grapheme/grapheme_arginfo.h
@@ -0,0 +1,39 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_grapheme_strlen, 0, 1, MAY_BE_LONG|MAY_BE_FALSE|MAY_BE_NULL)
+ ZEND_ARG_TYPE_INFO(0, input, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_grapheme_strpos, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, haystack, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, needle, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_grapheme_stripos arginfo_grapheme_strpos
+
+#define arginfo_grapheme_strrpos arginfo_grapheme_strpos
+
+#define arginfo_grapheme_strripos arginfo_grapheme_strpos
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_grapheme_substr, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, start, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_grapheme_strstr, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, haystack, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, needle, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, before_needle, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_grapheme_stristr arginfo_grapheme_strstr
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_grapheme_extract, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, haystack, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, size, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, extract_type, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, start, IS_LONG, 0)
+ ZEND_ARG_INFO(1, next)
+ZEND_END_ARG_INFO()
diff --git a/ext/intl/grapheme/grapheme_string.c b/ext/intl/grapheme/grapheme_string.c
index 6e5fc4ffb4..4aa7d3d42e 100644
--- a/ext/intl/grapheme/grapheme_string.c
+++ b/ext/intl/grapheme/grapheme_string.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -63,9 +61,7 @@ PHP_FUNCTION(grapheme_strlen)
UErrorCode status;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &string, &string_len) == FAILURE) {
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "grapheme_strlen: unable to parse input param", 0 );
- RETURN_FALSE;
+ RETURN_THROWS();
}
ret_len = grapheme_ascii_check((unsigned char *)string, string_len);
@@ -116,9 +112,7 @@ PHP_FUNCTION(grapheme_strpos)
zend_long ret_pos;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|l", &haystack, &haystack_len, &needle, &needle_len, &loffset) == FAILURE) {
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "grapheme_strpos: unable to parse input param", 0 );
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ( OUTSIDE_STRING(loffset, haystack_len) ) {
@@ -179,9 +173,7 @@ PHP_FUNCTION(grapheme_stripos)
int is_ascii;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|l", &haystack, &haystack_len, &needle, &needle_len, &loffset) == FAILURE) {
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "grapheme_stripos: unable to parse input param", 0 );
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ( OUTSIDE_STRING(loffset, haystack_len) ) {
@@ -248,9 +240,7 @@ PHP_FUNCTION(grapheme_strrpos)
int is_ascii;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|l", &haystack, &haystack_len, &needle, &needle_len, &loffset) == FAILURE) {
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "grapheme_strrpos: unable to parse input param", 0 );
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ( OUTSIDE_STRING(loffset, haystack_len) ) {
@@ -311,9 +301,7 @@ PHP_FUNCTION(grapheme_strripos)
int is_ascii;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|l", &haystack, &haystack_len, &needle, &needle_len, &loffset) == FAILURE) {
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "grapheme_strrpos: unable to parse input param", 0 );
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ( OUTSIDE_STRING(loffset, haystack_len) ) {
@@ -391,9 +379,7 @@ PHP_FUNCTION(grapheme_substr)
zend_bool no_length = 1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl|l!", &str, &str_len, &lstart, &length, &no_length) == FAILURE) {
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "grapheme_substr: unable to parse input param", 0 );
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ( OUTSIDE_STRING(lstart, str_len)) {
@@ -598,11 +584,7 @@ static void strstr_common_handler(INTERNAL_FUNCTION_PARAMETERS, int f_ignore_cas
zend_bool part = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|b", &haystack, &haystack_len, &needle, &needle_len, &part) == FAILURE) {
-
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "grapheme_strstr: unable to parse input param", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (needle_len == 0) {
@@ -789,9 +771,7 @@ PHP_FUNCTION(grapheme_extract)
zval *next = NULL; /* return offset of next part of the string */
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl|llz", &str, &str_len, &size, &extract_type, &lstart, &next) == FAILURE) {
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "grapheme_extract: unable to parse input param", 0 );
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (lstart < 0) {
diff --git a/ext/intl/grapheme/grapheme_util.c b/ext/intl/grapheme/grapheme_util.c
index 5bc23be209..71d6074999 100644
--- a/ext/intl/grapheme/grapheme_util.c
+++ b/ext/intl/grapheme/grapheme_util.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/grapheme/grapheme_util.h b/ext/intl/grapheme/grapheme_util.h
index 5b942d030e..508b7355f0 100644
--- a/ext/intl/grapheme/grapheme_util.h
+++ b/ext/intl/grapheme/grapheme_util.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/idn/idn.c b/ext/intl/idn/idn.c
index 89aade4dc3..4ea012a055 100644
--- a/ext/intl/idn/idn.c
+++ b/ext/intl/idn/idn.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -33,8 +31,7 @@
/* }}} */
enum {
- INTL_IDN_VARIANT_2003 = 0,
- INTL_IDN_VARIANT_UTS46
+ INTL_IDN_VARIANT_UTS46 = 1
};
/* {{{ grapheme_register_constants
@@ -73,7 +70,6 @@ void idn_register_constants( INIT_FUNC_ARGS )
REGISTER_LONG_CONSTANT("IDNA_NONTRANSITIONAL_TO_UNICODE", UIDNA_NONTRANSITIONAL_TO_UNICODE, CONST_CS | CONST_PERSISTENT);
/* VARIANTS */
- REGISTER_LONG_CONSTANT("INTL_IDNA_VARIANT_2003", INTL_IDN_VARIANT_2003, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("INTL_IDNA_VARIANT_UTS46", INTL_IDN_VARIANT_UTS46, CONST_CS | CONST_PERSISTENT);
/* PINFO ERROR CODES */
@@ -176,92 +172,22 @@ static void php_intl_idn_to_46(INTERNAL_FUNCTION_PARAMETERS,
uidna_close(uts46);
}
-static void php_intl_idn_to(INTERNAL_FUNCTION_PARAMETERS,
- const zend_string *domain, uint32_t option, int mode)
-{
- UChar* ustring = NULL;
- int ustring_len = 0;
- UErrorCode status;
- zend_string *u8str;
-
- /* convert the string to UTF-16. */
- status = U_ZERO_ERROR;
- intl_convert_utf8_to_utf16(&ustring, &ustring_len, ZSTR_VAL(domain), ZSTR_LEN(domain), &status);
-
- if (U_FAILURE(status)) {
- intl_error_set_code(NULL, status);
-
- /* Set error messages. */
- intl_error_set_custom_msg( NULL, "Error converting input string to UTF-16", 0 );
- if (ustring) {
- efree(ustring);
- }
- RETURN_FALSE;
- } else {
- UParseError parse_error;
- UChar converted[MAXPATHLEN];
- int32_t converted_ret_len;
-
- status = U_ZERO_ERROR;
-#if defined(__clang__)
-# pragma clang diagnostic push
-# pragma clang diagnostic ignored "-Wdeprecated-declarations"
-#elif ZEND_GCC_VERSION >= 4008
-# pragma GCC diagnostic push
-# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
- if (mode == INTL_IDN_TO_ASCII) {
- converted_ret_len = uidna_IDNToASCII(ustring, ustring_len, converted, MAXPATHLEN, (int32_t)option, &parse_error, &status);
- } else {
- converted_ret_len = uidna_IDNToUnicode(ustring, ustring_len, converted, MAXPATHLEN, (int32_t)option, &parse_error, &status);
- }
-#if defined(__clang__)
-# pragma clang diagnostic pop
-#elif ZEND_GCC_VERSION >= 4008
-# pragma GCC diagnostic pop
-#endif
- efree(ustring);
-
- if (U_FAILURE(status)) {
- intl_error_set( NULL, status, "idn_to_ascii: cannot convert to ASCII", 0 );
- RETURN_FALSE;
- }
-
- status = U_ZERO_ERROR;
- u8str = intl_convert_utf16_to_utf8(converted, converted_ret_len, &status);
-
- if (!u8str) {
- /* Set global error code. */
- intl_error_set_code(NULL, status);
-
- /* Set error messages. */
- intl_error_set_custom_msg( NULL, "Error converting output string to UTF-8", 0 );
- RETURN_FALSE;
- }
- }
-
- /* return the allocated string, not a duplicate */
- RETVAL_NEW_STR(u8str);
-}
-
static void php_intl_idn_handoff(INTERNAL_FUNCTION_PARAMETERS, int mode)
{
zend_string *domain;
zend_long option = 0,
- variant = INTL_IDN_VARIANT_UTS46;
+ variant = INTL_IDN_VARIANT_UTS46;
zval *idna_info = NULL;
intl_error_reset(NULL);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|llz",
&domain, &option, &variant, &idna_info) == FAILURE) {
- php_intl_bad_args("bad arguments");
- RETURN_NULL(); /* don't set FALSE because that's not the way it was before... */
+ RETURN_THROWS();
}
- if (variant != INTL_IDN_VARIANT_2003 && variant != INTL_IDN_VARIANT_UTS46) {
- php_intl_bad_args("invalid variant, must be one of {"
- "INTL_IDNA_VARIANT_2003, INTL_IDNA_VARIANT_UTS46}");
+ if (variant != INTL_IDN_VARIANT_UTS46) {
+ php_intl_bad_args("invalid variant, must be INTL_IDNA_VARIANT_UTS46");
RETURN_FALSE;
}
@@ -275,29 +201,14 @@ static void php_intl_idn_handoff(INTERNAL_FUNCTION_PARAMETERS, int mode)
}
/* don't check options; it wasn't checked before */
- if (variant == INTL_IDN_VARIANT_2003) {
- php_error_docref(NULL, E_DEPRECATED, "INTL_IDNA_VARIANT_2003 is deprecated");
- }
-
if (idna_info != NULL) {
- if (variant == INTL_IDN_VARIANT_2003) {
- php_error_docref(NULL, E_NOTICE,
- "4 arguments were provided, but INTL_IDNA_VARIANT_2003 only "
- "takes 3 - extra argument ignored");
- } else {
- idna_info = zend_try_array_init(idna_info);
- if (!idna_info) {
- return;
- }
+ idna_info = zend_try_array_init(idna_info);
+ if (!idna_info) {
+ RETURN_THROWS();
}
}
- if (variant == INTL_IDN_VARIANT_2003) {
- php_intl_idn_to(INTERNAL_FUNCTION_PARAM_PASSTHRU, domain, (uint32_t)option, mode);
- }
- else {
- php_intl_idn_to_46(INTERNAL_FUNCTION_PARAM_PASSTHRU, domain, (uint32_t)option, mode, idna_info);
- }
+ php_intl_idn_to_46(INTERNAL_FUNCTION_PARAM_PASSTHRU, domain, (uint32_t)option, mode, idna_info);
}
/* {{{ proto string idn_to_ascii(string domain[, int options[, int variant[, array &idna_info]]])
diff --git a/ext/intl/idn/idn.h b/ext/intl/idn/idn.h
index e8d1b53a33..801af9ee73 100644
--- a/ext/intl/idn/idn.h
+++ b/ext/intl/idn/idn.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/intl/idn/idn.stub.php b/ext/intl/idn/idn.stub.php
new file mode 100644
index 0000000000..7407b60a20
--- /dev/null
+++ b/ext/intl/idn/idn.stub.php
@@ -0,0 +1,5 @@
+<?php
+
+function idn_to_ascii(string $domain, int $options = 0, int $variant = INTL_IDNA_VARIANT_UTS46, &$idna_info = null): string|false {}
+
+function idn_to_utf8(string $domain, int $options = 0, int $variant = INTL_IDNA_VARIANT_UTS46, &$idna_info = null): string|false {}
diff --git a/ext/intl/idn/idn_arginfo.h b/ext/intl/idn/idn_arginfo.h
new file mode 100644
index 0000000000..7e107f4f9c
--- /dev/null
+++ b/ext/intl/idn/idn_arginfo.h
@@ -0,0 +1,10 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_idn_to_ascii, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, domain, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, variant, IS_LONG, 0)
+ ZEND_ARG_INFO(1, idna_info)
+ZEND_END_ARG_INFO()
+
+#define arginfo_idn_to_utf8 arginfo_idn_to_ascii
diff --git a/ext/intl/intl_common.h b/ext/intl/intl_common.h
index 954d2bdd7f..5c087d5088 100644
--- a/ext/intl/intl_common.h
+++ b/ext/intl/intl_common.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/intl_convert.c b/ext/intl/intl_convert.c
index e24f2370c2..911493a242 100644
--- a/ext/intl/intl_convert.c
+++ b/ext/intl/intl_convert.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/intl_convert.h b/ext/intl/intl_convert.h
index 3c6308a352..d6980133cf 100644
--- a/ext/intl/intl_convert.h
+++ b/ext/intl/intl_convert.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/intl_convertcpp.cpp b/ext/intl/intl_convertcpp.cpp
index 79f5c8cb6c..a9a855ae3f 100644
--- a/ext/intl/intl_convertcpp.cpp
+++ b/ext/intl/intl_convertcpp.cpp
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/intl_convertcpp.h b/ext/intl/intl_convertcpp.h
index 4fad9ed052..33ccaa3575 100644
--- a/ext/intl/intl_convertcpp.h
+++ b/ext/intl/intl_convertcpp.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/intl_cppshims.h b/ext/intl/intl_cppshims.h
index e2db488d93..34d1172a2c 100644
--- a/ext/intl/intl_cppshims.h
+++ b/ext/intl/intl_cppshims.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/intl_data.h b/ext/intl/intl_data.h
index 898a174a22..29a053ab20 100644
--- a/ext/intl/intl_data.h
+++ b/ext/intl/intl_data.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/intl_error.c b/ext/intl/intl_error.c
index bdab00cf27..42486aa04b 100644
--- a/ext/intl/intl_error.c
+++ b/ext/intl/intl_error.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/intl_error.h b/ext/intl/intl_error.h
index 11ac469a7d..927e5cdfd2 100644
--- a/ext/intl/intl_error.h
+++ b/ext/intl/intl_error.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/locale/locale.c b/ext/intl/locale/locale.c
index fa796e3574..6bef6a2b30 100644
--- a/ext/intl/locale/locale.c
+++ b/ext/intl/locale/locale.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/locale/locale.h b/ext/intl/locale/locale.h
index 4ebda99887..adf6a450dc 100644
--- a/ext/intl/locale/locale.h
+++ b/ext/intl/locale/locale.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/locale/locale.stub.php b/ext/intl/locale/locale.stub.php
new file mode 100644
index 0000000000..8ad1c83b83
--- /dev/null
+++ b/ext/intl/locale/locale.stub.php
@@ -0,0 +1,94 @@
+<?php
+
+class Locale
+{
+ /** @return string */
+ public static function getDefault() {}
+
+ /** @return bool */
+ public static function setDefault(string $locale) {}
+
+ /** @return ?string */
+ public static function getPrimaryLanguage(string $locale) {}
+
+ /** @return ?string */
+ public static function getScript(string $locale) {}
+
+ /** @return ?string */
+ public static function getRegion(string $locale) {}
+
+ /** @return array|false|null */
+ public static function getKeywords(string $locale) {}
+
+ /** @return string|false */
+ public static function getDisplayScript(string $locale, ?string $in_locale = null) {}
+
+ /** @return string|false */
+ public static function getDisplayRegion(string $locale, ?string $in_locale = null) {}
+
+ /** @return string|false */
+ public static function getDisplayName(string $locale, ?string $in_locale = null) {}
+
+ /** @return string|false */
+ public static function getDisplayLanguage(string $locale, ?string $in_locale = null) {}
+
+ /** @return string|false */
+ public static function getDisplayVariant(string $locale, ?string $in_locale = null) {}
+
+ /** @return string|false */
+ public static function composeLocale(array $subtags) {}
+
+ /** @return ?array */
+ public static function parseLocale(string $locale) {}
+
+ /** @return ?array */
+ public static function getAllVariants(string $locale) {}
+
+ /** @return ?bool */
+ public static function filterMatches(string $langtag, string $locale, bool $canonicalize = false) {}
+
+ /** @return ?string */
+ public static function lookup(array $langtag, string $locale, bool $canonicalize = false, ?string $def = null) {}
+
+ /** @return ?string */
+ public static function canonicalize(string $locale) {}
+
+ /** @return string|false */
+ public static function acceptFromHttp(string $header) {}
+}
+
+function locale_get_default(): string {}
+
+function locale_set_default(string $name): bool {}
+
+function locale_get_primary_language(string $locale): ?string {}
+
+function locale_get_script(string $locale): ?string {}
+
+function locale_get_region(string $locale): ?string {}
+
+function locale_get_keywords(string $locale): array|false|null {}
+
+function locale_get_display_script(string $locale, ?string $in_locale = null): string|false {}
+
+function locale_get_display_region(string $locale, ?string $in_locale = null): string|false {}
+
+function locale_get_display_name(string $locale, ?string $in_locale = null): string|false {}
+
+function locale_get_display_language(string $locale, ?string $in_locale = null): string|false {}
+
+function locale_get_display_variant(string $locale, ?string $in_locale = null): string|false {}
+
+function locale_compose(array $subtags): string|false {}
+
+function locale_parse(string $locale): ?array {}
+
+function locale_get_all_variants(string $locale): ?array {}
+
+function locale_filter_matches(string $langtag, string $locale, bool $canonicalize = false): ?bool {}
+
+function locale_canonicalize(string $locale): ?string {}
+
+function locale_lookup(array $langtag, string $locale, bool $canonicalize = false, ?string $def = null): ?string {}
+
+function locale_accept_from_http(string $header): string|false {}
diff --git a/ext/intl/locale/locale_arginfo.h b/ext/intl/locale/locale_arginfo.h
new file mode 100644
index 0000000000..367d3f7ac8
--- /dev/null
+++ b/ext/intl/locale/locale_arginfo.h
@@ -0,0 +1,117 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Locale_getDefault, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Locale_setDefault, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_Locale_getPrimaryLanguage arginfo_class_Locale_setDefault
+
+#define arginfo_class_Locale_getScript arginfo_class_Locale_setDefault
+
+#define arginfo_class_Locale_getRegion arginfo_class_Locale_setDefault
+
+#define arginfo_class_Locale_getKeywords arginfo_class_Locale_setDefault
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Locale_getDisplayScript, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, in_locale, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_Locale_getDisplayRegion arginfo_class_Locale_getDisplayScript
+
+#define arginfo_class_Locale_getDisplayName arginfo_class_Locale_getDisplayScript
+
+#define arginfo_class_Locale_getDisplayLanguage arginfo_class_Locale_getDisplayScript
+
+#define arginfo_class_Locale_getDisplayVariant arginfo_class_Locale_getDisplayScript
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Locale_composeLocale, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, subtags, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_Locale_parseLocale arginfo_class_Locale_setDefault
+
+#define arginfo_class_Locale_getAllVariants arginfo_class_Locale_setDefault
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Locale_filterMatches, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, langtag, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, canonicalize, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Locale_lookup, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, langtag, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, canonicalize, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, def, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_Locale_canonicalize arginfo_class_Locale_setDefault
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Locale_acceptFromHttp, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, header, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_locale_get_default, 0, 0, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_locale_set_default, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_locale_get_primary_language, 0, 1, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_locale_get_script arginfo_locale_get_primary_language
+
+#define arginfo_locale_get_region arginfo_locale_get_primary_language
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_locale_get_keywords, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE|MAY_BE_NULL)
+ ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_locale_get_display_script, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, in_locale, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+#define arginfo_locale_get_display_region arginfo_locale_get_display_script
+
+#define arginfo_locale_get_display_name arginfo_locale_get_display_script
+
+#define arginfo_locale_get_display_language arginfo_locale_get_display_script
+
+#define arginfo_locale_get_display_variant arginfo_locale_get_display_script
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_locale_compose, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, subtags, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_locale_parse, 0, 1, IS_ARRAY, 1)
+ ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_locale_get_all_variants arginfo_locale_parse
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_locale_filter_matches, 0, 2, _IS_BOOL, 1)
+ ZEND_ARG_TYPE_INFO(0, langtag, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, canonicalize, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_locale_canonicalize arginfo_locale_get_primary_language
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_locale_lookup, 0, 2, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, langtag, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, canonicalize, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, def, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_locale_accept_from_http, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, header, IS_STRING, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/intl/locale/locale_class.c b/ext/intl/locale/locale_class.c
index eb797c505d..e7cd250308 100644
--- a/ext/intl/locale/locale_class.c
+++ b/ext/intl/locale/locale_class.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -20,6 +18,7 @@
#include "locale_class.h"
#include "locale_methods.h"
#include "locale.h"
+#include "locale_arginfo.h"
zend_class_entry *Locale_ce_ptr = NULL;
@@ -27,70 +26,29 @@ zend_class_entry *Locale_ce_ptr = NULL;
* 'Locale' class registration structures & functions
*/
-/* {{{ Locale methods arguments info */
-/*
- * NOTE: when modifying 'locale_XX_args' do not forget to modify
- * approptiate 'locale_XX_args' for the procedural API!
- */
-
-ZEND_BEGIN_ARG_INFO_EX( locale_0_args, 0, 0, 0 )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( locale_arg_locale, 0, 0, 1 )
- ZEND_ARG_INFO( 0, locale )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( locale_accept_from_http_args, 0, 0, 1 )
- ZEND_ARG_INFO( 0, header )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( locale_compose_args, 0, 0, 1 )
- ZEND_ARG_INFO( 0, subtags )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( locale_2_args, 0, 0, 1 )
- ZEND_ARG_INFO( 0, locale )
- ZEND_ARG_INFO( 0, in_locale )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( locale_filter_matches_args, 0, 0, 2 )
- ZEND_ARG_INFO( 0, langtag )
- ZEND_ARG_INFO( 0, locale )
- ZEND_ARG_INFO( 0, canonicalize )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( locale_lookup_args, 0, 0, 2 )
- ZEND_ARG_INFO( 0, langtag )
- ZEND_ARG_INFO( 0, locale )
- ZEND_ARG_INFO( 0, canonicalize )
- ZEND_ARG_INFO( 0, default )
-ZEND_END_ARG_INFO()
-
-/* }}} */
-
/* {{{ Locale_class_functions
* Every 'Locale' class method has an entry in this table
*/
static const zend_function_entry Locale_class_functions[] = {
- ZEND_FENTRY( getDefault, zif_locale_get_default , locale_0_args , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
- ZEND_FENTRY( setDefault, zif_locale_set_default , locale_arg_locale , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
- ZEND_FENTRY( getPrimaryLanguage, ZEND_FN( locale_get_primary_language ), locale_arg_locale , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
- ZEND_FENTRY( getScript, ZEND_FN( locale_get_script ), locale_arg_locale , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
- ZEND_FENTRY( getRegion, ZEND_FN( locale_get_region ), locale_arg_locale , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
- ZEND_FENTRY( getKeywords, ZEND_FN( locale_get_keywords ), locale_arg_locale , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
- ZEND_FENTRY( getDisplayScript, ZEND_FN( locale_get_display_script ), locale_2_args , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
- ZEND_FENTRY( getDisplayRegion, ZEND_FN( locale_get_display_region ), locale_2_args , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
- ZEND_FENTRY( getDisplayName, ZEND_FN( locale_get_display_name ), locale_2_args , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
- ZEND_FENTRY( getDisplayLanguage, ZEND_FN( locale_get_display_language ), locale_2_args , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
- ZEND_FENTRY( getDisplayVariant, ZEND_FN( locale_get_display_variant ), locale_2_args , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
- ZEND_FENTRY( composeLocale, ZEND_FN( locale_compose ), locale_compose_args , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
- ZEND_FENTRY( parseLocale, ZEND_FN( locale_parse ), locale_arg_locale , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
- ZEND_FENTRY( getAllVariants, ZEND_FN( locale_get_all_variants ), locale_arg_locale , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
- ZEND_FENTRY( filterMatches, ZEND_FN( locale_filter_matches ), locale_filter_matches_args, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
- ZEND_FENTRY( lookup, ZEND_FN( locale_lookup ), locale_lookup_args, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
- ZEND_FENTRY( canonicalize, ZEND_FN( locale_canonicalize ), locale_arg_locale , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
- ZEND_FENTRY( acceptFromHttp, ZEND_FN( locale_accept_from_http ), locale_accept_from_http_args , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
+ ZEND_FENTRY( getDefault, zif_locale_get_default , arginfo_class_Locale_getDefault , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
+ ZEND_FENTRY( setDefault, zif_locale_set_default , arginfo_class_Locale_setDefault , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
+ ZEND_FENTRY( getPrimaryLanguage, ZEND_FN( locale_get_primary_language ), arginfo_class_Locale_getPrimaryLanguage , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
+ ZEND_FENTRY( getScript, ZEND_FN( locale_get_script ), arginfo_class_Locale_getScript , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
+ ZEND_FENTRY( getRegion, ZEND_FN( locale_get_region ), arginfo_class_Locale_getRegion , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
+ ZEND_FENTRY( getKeywords, ZEND_FN( locale_get_keywords ), arginfo_class_Locale_getKeywords , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
+ ZEND_FENTRY( getDisplayScript, ZEND_FN( locale_get_display_script ), arginfo_class_Locale_getDisplayScript , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
+ ZEND_FENTRY( getDisplayRegion, ZEND_FN( locale_get_display_region ), arginfo_class_Locale_getDisplayRegion , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
+ ZEND_FENTRY( getDisplayName, ZEND_FN( locale_get_display_name ), arginfo_class_Locale_getDisplayName , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
+ ZEND_FENTRY( getDisplayLanguage, ZEND_FN( locale_get_display_language ), arginfo_class_Locale_getDisplayLanguage , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
+ ZEND_FENTRY( getDisplayVariant, ZEND_FN( locale_get_display_variant ), arginfo_class_Locale_getDisplayVariant , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
+ ZEND_FENTRY( composeLocale, ZEND_FN( locale_compose ), arginfo_class_Locale_composeLocale , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
+ ZEND_FENTRY( parseLocale, ZEND_FN( locale_parse ), arginfo_class_Locale_parseLocale , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
+ ZEND_FENTRY( getAllVariants, ZEND_FN( locale_get_all_variants ), arginfo_class_Locale_getAllVariants , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
+ ZEND_FENTRY( filterMatches, ZEND_FN( locale_filter_matches ), arginfo_class_Locale_filterMatches, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
+ ZEND_FENTRY( lookup, ZEND_FN( locale_lookup ), arginfo_class_Locale_lookup, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
+ ZEND_FENTRY( canonicalize, ZEND_FN( locale_canonicalize ), arginfo_class_Locale_canonicalize , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
+ ZEND_FENTRY( acceptFromHttp, ZEND_FN( locale_accept_from_http ), arginfo_class_Locale_acceptFromHttp , ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
PHP_FE_END
};
/* }}} */
diff --git a/ext/intl/locale/locale_class.h b/ext/intl/locale/locale_class.h
index e8e244209a..a566ae4619 100644
--- a/ext/intl/locale/locale_class.h
+++ b/ext/intl/locale/locale_class.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/locale/locale_methods.c b/ext/intl/locale/locale_methods.c
index 50838de7ed..0db2e70bde 100644
--- a/ext/intl/locale/locale_methods.c
+++ b/ext/intl/locale/locale_methods.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -209,6 +207,10 @@ static zend_off_t getSingletonPos(const char* str)
Get default locale */
PHP_NAMED_FUNCTION(zif_locale_get_default)
{
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
RETURN_STRING( intl_locale_get_default( ) );
}
@@ -227,10 +229,7 @@ PHP_NAMED_FUNCTION(zif_locale_set_default)
if(zend_parse_parameters( ZEND_NUM_ARGS(), "S", &locale_name) == FAILURE)
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "locale_set_default: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (ZSTR_LEN(locale_name) == 0) {
@@ -397,11 +396,7 @@ static void get_icu_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAMETERS)
if(zend_parse_parameters( ZEND_NUM_ARGS(), "s",
&loc_name ,&loc_name_len ) == FAILURE) {
- spprintf(&msg , 0, "locale_get_%s : unable to parse input params", tag_name );
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, msg , 1 );
- efree(msg);
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
if(loc_name_len == 0) {
@@ -502,14 +497,11 @@ static void get_icu_disp_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAME
intl_error_reset( NULL );
- if(zend_parse_parameters( ZEND_NUM_ARGS(), "s|s",
+ if(zend_parse_parameters( ZEND_NUM_ARGS(), "s|s!",
&loc_name, &loc_name_len ,
&disp_loc_name ,&disp_loc_name_len ) == FAILURE)
{
- spprintf(&msg , 0, "locale_get_display_%s : unable to parse input params", tag_name );
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, msg , 1 );
- efree(msg);
- RETURN_FALSE;
+ RETURN_THROWS();
}
if(loc_name_len > ULOC_FULLNAME_CAPACITY) {
@@ -698,10 +690,7 @@ PHP_FUNCTION( locale_get_keywords )
if(zend_parse_parameters( ZEND_NUM_ARGS(), "s",
&loc_name, &loc_name_len ) == FAILURE)
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "locale_get_keywords: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
INTL_CHECK_LOCALE_LEN(strlen(loc_name));
@@ -920,9 +909,7 @@ PHP_FUNCTION(locale_compose)
if(zend_parse_parameters( ZEND_NUM_ARGS(), "a",
&arr) == FAILURE)
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "locale_compose: unable to parse input params", 0 );
- RETURN_FALSE;
+ RETURN_THROWS();
}
hash_arr = Z_ARRVAL_P( arr );
@@ -1108,10 +1095,7 @@ PHP_FUNCTION(locale_parse)
if(zend_parse_parameters( ZEND_NUM_ARGS(), "s",
&loc_name, &loc_name_len ) == FAILURE)
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "locale_parse: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
INTL_CHECK_LOCALE_LEN(strlen(loc_name));
@@ -1158,10 +1142,7 @@ PHP_FUNCTION(locale_get_all_variants)
if(zend_parse_parameters( ZEND_NUM_ARGS(), "s",
&loc_name, &loc_name_len ) == FAILURE)
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "locale_parse: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
if(loc_name_len == 0) {
@@ -1264,10 +1245,7 @@ PHP_FUNCTION(locale_filter_matches)
&lang_tag, &lang_tag_len , &loc_range , &loc_range_len ,
&boolCanonical) == FAILURE)
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "locale_filter_matches: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
if(loc_range_len == 0) {
@@ -1540,8 +1518,7 @@ PHP_FUNCTION(locale_lookup)
if(zend_parse_parameters( ZEND_NUM_ARGS(), "as|bS!", &arr, &loc_range, &loc_range_len,
&boolCanonical, &fallback_loc_str) == FAILURE) {
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "locale_lookup: unable to parse input params", 0 );
- RETURN_FALSE;
+ RETURN_THROWS();
}
if(loc_range_len == 0) {
@@ -1576,11 +1553,11 @@ PHP_FUNCTION(locale_lookup)
/* }}} */
/* {{{ proto string Locale::acceptFromHttp(string $http_accept)
-* Tries to find out best available locale based on HTTP �Accept-Language� header
+* Tries to find out best available locale based on HTTP "Accept-Language" header
*/
/* }}} */
/* {{{ proto string locale_accept_from_http(string $http_accept)
-* Tries to find out best available locale based on HTTP �Accept-Language� header
+* Tries to find out best available locale based on HTTP "Accept-Language" header
*/
PHP_FUNCTION(locale_accept_from_http)
{
@@ -1594,9 +1571,7 @@ PHP_FUNCTION(locale_accept_from_http)
if(zend_parse_parameters( ZEND_NUM_ARGS(), "s", &http_accept, &http_accept_len) == FAILURE)
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "locale_accept_from_http: unable to parse input parameters", 0 );
- RETURN_FALSE;
+ RETURN_THROWS();
}
if(http_accept_len > ULOC_FULLNAME_CAPACITY) {
/* check each fragment, if any bigger than capacity, can't do it due to bug #72533 */
diff --git a/ext/intl/locale/locale_methods.h b/ext/intl/locale/locale_methods.h
index 9609c92f4e..3de431e3cd 100644
--- a/ext/intl/locale/locale_methods.h
+++ b/ext/intl/locale/locale_methods.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/msgformat/msgformat.c b/ext/intl/msgformat/msgformat.c
index 2439b5855a..8e8ca8d0c8 100644
--- a/ext/intl/msgformat/msgformat.c
+++ b/ext/intl/msgformat/msgformat.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -27,7 +25,7 @@
#include "intl_convert.h"
/* {{{ */
-static int msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_constructor)
+static int msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
{
const char* locale;
char* pattern;
@@ -36,16 +34,13 @@ static int msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_constructor)
int spattern_len = 0;
zval* object;
MessageFormatter_object* mfo;
- int zpp_flags = is_constructor ? ZEND_PARSE_PARAMS_THROW : 0;
intl_error_reset( NULL );
object = return_value;
/* Parse parameters. */
- if( zend_parse_parameters_ex( zpp_flags, ZEND_NUM_ARGS(), "ss",
+ if( zend_parse_parameters( ZEND_NUM_ARGS(), "ss",
&locale, &locale_len, &pattern, &pattern_len ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "msgfmt_create: unable to parse input parameters", 0 );
return FAILURE;
}
@@ -98,7 +93,7 @@ static int msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_constructor)
PHP_FUNCTION( msgfmt_create )
{
object_init_ex( return_value, MessageFormatter_ce_ptr );
- if (msgfmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0) == FAILURE) {
+ if (msgfmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU) == FAILURE) {
zval_ptr_dtor(return_value);
RETURN_NULL();
}
@@ -114,7 +109,7 @@ PHP_METHOD( MessageFormatter, __construct )
zend_replace_error_handling(EH_THROW, IntlException_ce_ptr, &error_handling);
return_value = ZEND_THIS;
- if (msgfmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1) == FAILURE) {
+ if (msgfmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU) == FAILURE) {
if (!EG(exception)) {
zend_throw_exception(IntlException_ce_ptr, "Constructor failed", 0);
}
@@ -137,10 +132,7 @@ PHP_FUNCTION( msgfmt_get_error_code )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O",
&object, MessageFormatter_ce_ptr ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "msgfmt_get_error_code: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
mfo = Z_INTL_MESSAGEFORMATTER_P( object );
@@ -165,10 +157,7 @@ PHP_FUNCTION( msgfmt_get_error_message )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O",
&object, MessageFormatter_ce_ptr ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "msgfmt_get_error_message: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
mfo = Z_INTL_MESSAGEFORMATTER_P( object );
diff --git a/ext/intl/msgformat/msgformat.h b/ext/intl/msgformat/msgformat.h
index a0b2c89644..e4a55ffa5e 100644
--- a/ext/intl/msgformat/msgformat.h
+++ b/ext/intl/msgformat/msgformat.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/msgformat/msgformat.stub.php b/ext/intl/msgformat/msgformat.stub.php
new file mode 100644
index 0000000000..65d9b5ef1e
--- /dev/null
+++ b/ext/intl/msgformat/msgformat.stub.php
@@ -0,0 +1,56 @@
+<?php
+
+class MessageFormatter
+{
+ public function __construct(string $locale, string $pattern) {}
+
+ /** @return MessageFormatter|null */
+ public static function create(string $locale, string $pattern) {}
+
+ /** @return string|false */
+ public function format(array $args) {}
+
+ /** @return string|false */
+ public static function formatMessage(string $locale, string $pattern, array $args) {}
+
+ /** @return array|false */
+ public function parse(string $value) {}
+
+ /** @return array|false */
+ public static function parseMessage(string $locale, string $pattern, string $source) {}
+
+ /** @return bool */
+ public function setPattern(string $pattern) {}
+
+ /** @return string|false */
+ public function getPattern() {}
+
+ /** @return string */
+ public function getLocale() {}
+
+ /** @return int */
+ public function getErrorCode() {}
+
+ /** @return string */
+ public function getErrorMessage() {}
+}
+
+function msgfmt_create(string $locale, string $pattern): ?MessageFormatter {}
+
+function msgfmt_format(MessageFormatter $fmt, array $args): string|false {}
+
+function msgfmt_format_message(string $locale, string $pattern, array $args): string|false {}
+
+function msgfmt_parse(MessageFormatter $fmt, string $value): array|false {}
+
+function msgfmt_parse_message(string $locale, string $pattern, string $source): array|false {}
+
+function msgfmt_set_pattern(MessageFormatter $fmt, string $pattern): bool {}
+
+function msgfmt_get_pattern(MessageFormatter $fmt): string|false {}
+
+function msgfmt_get_locale(MessageFormatter $fmt): string {}
+
+function msgfmt_get_error_code(MessageFormatter $fmt): int {}
+
+function msgfmt_get_error_message(MessageFormatter $fmt): string {}
diff --git a/ext/intl/msgformat/msgformat_arginfo.h b/ext/intl/msgformat/msgformat_arginfo.h
new file mode 100644
index 0000000000..e03dbffc73
--- /dev/null
+++ b/ext/intl/msgformat/msgformat_arginfo.h
@@ -0,0 +1,87 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MessageFormatter___construct, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_MessageFormatter_create arginfo_class_MessageFormatter___construct
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MessageFormatter_format, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, args, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MessageFormatter_formatMessage, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, args, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MessageFormatter_parse, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MessageFormatter_parseMessage, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, source, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MessageFormatter_setPattern, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MessageFormatter_getPattern, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_MessageFormatter_getLocale arginfo_class_MessageFormatter_getPattern
+
+#define arginfo_class_MessageFormatter_getErrorCode arginfo_class_MessageFormatter_getPattern
+
+#define arginfo_class_MessageFormatter_getErrorMessage arginfo_class_MessageFormatter_getPattern
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_msgfmt_create, 0, 2, MessageFormatter, 1)
+ ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_msgfmt_format, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, fmt, MessageFormatter, 0)
+ ZEND_ARG_TYPE_INFO(0, args, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_msgfmt_format_message, 0, 3, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, args, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_msgfmt_parse, 0, 2, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, fmt, MessageFormatter, 0)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_msgfmt_parse_message, 0, 3, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, source, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_msgfmt_set_pattern, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, fmt, MessageFormatter, 0)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_msgfmt_get_pattern, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, fmt, MessageFormatter, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_msgfmt_get_locale, 0, 1, IS_STRING, 0)
+ ZEND_ARG_OBJ_INFO(0, fmt, MessageFormatter, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_msgfmt_get_error_code, 0, 1, IS_LONG, 0)
+ ZEND_ARG_OBJ_INFO(0, fmt, MessageFormatter, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_msgfmt_get_error_message arginfo_msgfmt_get_locale
diff --git a/ext/intl/msgformat/msgformat_attr.c b/ext/intl/msgformat/msgformat_attr.c
index 51d9df049f..02e220de54 100644
--- a/ext/intl/msgformat/msgformat_attr.c
+++ b/ext/intl/msgformat/msgformat_attr.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -38,9 +36,7 @@ PHP_FUNCTION( msgfmt_get_pattern )
/* Parse parameters. */
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O", &object, MessageFormatter_ce_ptr ) == FAILURE )
{
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "msgfmt_get_pattern: unable to parse input params", 0 );
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* Fetch the object. */
@@ -71,9 +67,7 @@ PHP_FUNCTION( msgfmt_set_pattern )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Os",
&object, MessageFormatter_ce_ptr, &value, &value_len ) == FAILURE )
{
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "msgfmt_set_pattern: unable to parse input params", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
MSG_FORMAT_METHOD_FETCH_OBJECT;
@@ -127,10 +121,7 @@ PHP_FUNCTION( msgfmt_get_locale )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O",
&object, MessageFormatter_ce_ptr ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "msgfmt_get_locale: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* Fetch the object. */
diff --git a/ext/intl/msgformat/msgformat_attr.h b/ext/intl/msgformat/msgformat_attr.h
index 891f44c073..0d5371a9cd 100644
--- a/ext/intl/msgformat/msgformat_attr.h
+++ b/ext/intl/msgformat/msgformat_attr.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/msgformat/msgformat_class.c b/ext/intl/msgformat/msgformat_class.c
index a6d5b593a6..2adbcbbfac 100644
--- a/ext/intl/msgformat/msgformat_class.c
+++ b/ext/intl/msgformat/msgformat_class.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -23,6 +21,7 @@
#include "msgformat_parse.h"
#include "msgformat.h"
#include "msgformat_attr.h"
+#include "msgformat_arginfo.h"
#include <zend_exceptions.h>
@@ -61,13 +60,13 @@ zend_object *MessageFormatter_object_create(zend_class_entry *ce)
/* }}} */
/* {{{ MessageFormatter_object_clone */
-zend_object *MessageFormatter_object_clone(zval *object)
+zend_object *MessageFormatter_object_clone(zend_object *object)
{
MessageFormatter_object *mfo, *new_mfo;
zend_object *new_obj;
- MSG_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK;
- new_obj = MessageFormatter_ce_ptr->create_object(Z_OBJCE_P(object));
+ mfo = php_intl_messageformatter_fetch_object(object);
+ new_obj = MessageFormatter_ce_ptr->create_object(object->ce);
new_mfo = php_intl_messageformatter_fetch_object(new_obj);
/* clone standard parts */
zend_objects_clone_members(&new_mfo->zo, &mfo->zo);
@@ -93,49 +92,21 @@ zend_object *MessageFormatter_object_clone(zval *object)
* 'MessageFormatter' class registration structures & functions
*/
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_messageformatter___construct, 0, 0, 2)
- ZEND_ARG_INFO(0, locale)
- ZEND_ARG_INFO(0, pattern)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_messageformatter_geterrormessage, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_messageformatter_formatmessage, 0, 0, 3)
- ZEND_ARG_INFO(0, locale)
- ZEND_ARG_INFO(0, pattern)
- ZEND_ARG_INFO(0, args)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_messageformatter_format, 0, 0, 1)
- ZEND_ARG_INFO(0, args)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_messageformatter_setpattern, 0, 0, 1)
- ZEND_ARG_INFO(0, pattern)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_messageformatter_parse, 0, 0, 1)
- ZEND_ARG_INFO(0, source)
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ MessageFormatter_class_functions
* Every 'MessageFormatter' class method has an entry in this table
*/
static const zend_function_entry MessageFormatter_class_functions[] = {
- PHP_ME( MessageFormatter, __construct, arginfo_messageformatter___construct, ZEND_ACC_PUBLIC )
- ZEND_FENTRY( create, ZEND_FN( msgfmt_create ), arginfo_messageformatter___construct, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
- PHP_NAMED_FE( format, ZEND_FN( msgfmt_format ), arginfo_messageformatter_format )
- ZEND_FENTRY( formatMessage, ZEND_FN( msgfmt_format_message ), arginfo_messageformatter_formatmessage, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
- PHP_NAMED_FE( parse, ZEND_FN( msgfmt_parse ), arginfo_messageformatter_parse )
- ZEND_FENTRY( parseMessage, ZEND_FN( msgfmt_parse_message ), arginfo_messageformatter_formatmessage, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
- PHP_NAMED_FE( setPattern, ZEND_FN( msgfmt_set_pattern ), arginfo_messageformatter_setpattern )
- PHP_NAMED_FE( getPattern, ZEND_FN( msgfmt_get_pattern ), arginfo_messageformatter_geterrormessage )
- PHP_NAMED_FE( getLocale, ZEND_FN( msgfmt_get_locale ), arginfo_messageformatter_geterrormessage )
- PHP_NAMED_FE( getErrorCode, ZEND_FN( msgfmt_get_error_code ), arginfo_messageformatter_geterrormessage )
- PHP_NAMED_FE( getErrorMessage, ZEND_FN( msgfmt_get_error_message ), arginfo_messageformatter_geterrormessage )
+ PHP_ME( MessageFormatter, __construct, arginfo_class_MessageFormatter___construct, ZEND_ACC_PUBLIC )
+ ZEND_FENTRY( create, ZEND_FN( msgfmt_create ), arginfo_class_MessageFormatter_create, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
+ PHP_NAMED_FE( format, ZEND_FN( msgfmt_format ), arginfo_class_MessageFormatter_format )
+ ZEND_FENTRY( formatMessage, ZEND_FN( msgfmt_format_message ), arginfo_class_MessageFormatter_formatMessage, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
+ PHP_NAMED_FE( parse, ZEND_FN( msgfmt_parse ), arginfo_class_MessageFormatter_parse )
+ ZEND_FENTRY( parseMessage, ZEND_FN( msgfmt_parse_message ), arginfo_class_MessageFormatter_parseMessage, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
+ PHP_NAMED_FE( setPattern, ZEND_FN( msgfmt_set_pattern ), arginfo_class_MessageFormatter_setPattern )
+ PHP_NAMED_FE( getPattern, ZEND_FN( msgfmt_get_pattern ), arginfo_class_MessageFormatter_getPattern )
+ PHP_NAMED_FE( getLocale, ZEND_FN( msgfmt_get_locale ), arginfo_class_MessageFormatter_getLocale )
+ PHP_NAMED_FE( getErrorCode, ZEND_FN( msgfmt_get_error_code ), arginfo_class_MessageFormatter_getErrorCode )
+ PHP_NAMED_FE( getErrorMessage, ZEND_FN( msgfmt_get_error_message ), arginfo_class_MessageFormatter_getErrorMessage )
PHP_FE_END
};
/* }}} */
diff --git a/ext/intl/msgformat/msgformat_class.h b/ext/intl/msgformat/msgformat_class.h
index 51025f0671..2e0eda9d7e 100644
--- a/ext/intl/msgformat/msgformat_class.h
+++ b/ext/intl/msgformat/msgformat_class.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -48,9 +46,8 @@ extern zend_class_entry *MessageFormatter_ce_ptr;
#define MSG_FORMAT_METHOD_FETCH_OBJECT \
MSG_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK; \
if (MSG_FORMAT_OBJECT(mfo) == NULL) { \
- intl_errors_set(&mfo->mf_data.error, U_ILLEGAL_ARGUMENT_ERROR, \
- "Found unconstructed MessageFormatter", 0); \
- RETURN_FALSE; \
+ zend_throw_error(NULL, "Found unconstructed MessageFormatter"); \
+ RETURN_THROWS(); \
}
#define MSG_FORMAT_OBJECT(mfo) (mfo)->mf_data.umsgf
diff --git a/ext/intl/msgformat/msgformat_data.c b/ext/intl/msgformat/msgformat_data.c
index 03dc232f67..6c0b62a6b5 100644
--- a/ext/intl/msgformat/msgformat_data.c
+++ b/ext/intl/msgformat/msgformat_data.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/msgformat/msgformat_data.h b/ext/intl/msgformat/msgformat_data.h
index a4226664ae..e4e04bf203 100644
--- a/ext/intl/msgformat/msgformat_data.h
+++ b/ext/intl/msgformat/msgformat_data.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/msgformat/msgformat_format.c b/ext/intl/msgformat/msgformat_format.c
index a11c167a4b..56a3a11782 100644
--- a/ext/intl/msgformat/msgformat_format.c
+++ b/ext/intl/msgformat/msgformat_format.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -65,10 +63,7 @@ PHP_FUNCTION( msgfmt_format )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Oa",
&object, MessageFormatter_ce_ptr, &args ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "msgfmt_format: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* Fetch the object. */
@@ -99,10 +94,7 @@ PHP_FUNCTION( msgfmt_format_message )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "ssa",
&slocale, &slocale_len, &pattern, &pattern_len, &args ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "msgfmt_format_message: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
INTL_CHECK_LOCALE_LEN(slocale_len);
diff --git a/ext/intl/msgformat/msgformat_format.h b/ext/intl/msgformat/msgformat_format.h
index 12b0e4a283..9694d57f8d 100644
--- a/ext/intl/msgformat/msgformat_format.h
+++ b/ext/intl/msgformat/msgformat_format.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/msgformat/msgformat_helpers.cpp b/ext/intl/msgformat/msgformat_helpers.cpp
index 11ff2f3388..3644e393d3 100644
--- a/ext/intl/msgformat/msgformat_helpers.cpp
+++ b/ext/intl/msgformat/msgformat_helpers.cpp
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/msgformat/msgformat_helpers.h b/ext/intl/msgformat/msgformat_helpers.h
index df05259574..bb316f1148 100644
--- a/ext/intl/msgformat/msgformat_helpers.h
+++ b/ext/intl/msgformat/msgformat_helpers.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/msgformat/msgformat_parse.c b/ext/intl/msgformat/msgformat_parse.c
index c517288bff..006d9d8999 100644
--- a/ext/intl/msgformat/msgformat_parse.c
+++ b/ext/intl/msgformat/msgformat_parse.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -69,10 +67,7 @@ PHP_FUNCTION( msgfmt_parse )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "Os",
&object, MessageFormatter_ce_ptr, &source, &source_len ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "msgfmt_parse: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* Fetch the object. */
@@ -84,7 +79,7 @@ PHP_FUNCTION( msgfmt_parse )
/* {{{ proto array MessageFormatter::formatMessage( string $locale, string $pattern, string $source )
* Parse a message. }}} */
-/* {{{ proto array numfmt_parse_message( string $locale, string $pattern, string $source )
+/* {{{ proto array msgfmt_parse_message( string $locale, string $pattern, string $source )
* Parse a message.
*/
PHP_FUNCTION( msgfmt_parse_message )
@@ -104,10 +99,7 @@ PHP_FUNCTION( msgfmt_parse_message )
if( zend_parse_parameters( ZEND_NUM_ARGS(), "sss",
&slocale, &slocale_len, &pattern, &pattern_len, &source, &src_len ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "msgfmt_parse_message: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
INTL_CHECK_LOCALE_LEN(slocale_len);
diff --git a/ext/intl/msgformat/msgformat_parse.h b/ext/intl/msgformat/msgformat_parse.h
index 4a86403a48..8fe1b7beac 100644
--- a/ext/intl/msgformat/msgformat_parse.h
+++ b/ext/intl/msgformat/msgformat_parse.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/normalizer/normalizer.c b/ext/intl/normalizer/normalizer.c
index e05c45875b..104f270e43 100644
--- a/ext/intl/normalizer/normalizer.c
+++ b/ext/intl/normalizer/normalizer.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -42,7 +40,6 @@ void normalizer_register_constants( INIT_FUNC_ARGS )
#define NORMALIZER_EXPOSE_CUSTOM_CLASS_CONST(name, value) zend_declare_class_constant_long( Normalizer_ce_ptr, ZEND_STRS( name ) - 1, value );
/* Normalization form constants */
- NORMALIZER_EXPOSE_CLASS_CONST( NONE );
NORMALIZER_EXPOSE_CLASS_CONST( FORM_D );
NORMALIZER_EXPOSE_CLASS_CONST( NFD );
NORMALIZER_EXPOSE_CLASS_CONST( FORM_KD );
diff --git a/ext/intl/normalizer/normalizer.h b/ext/intl/normalizer/normalizer.h
index 57f0466782..b0cb116f8f 100644
--- a/ext/intl/normalizer/normalizer.h
+++ b/ext/intl/normalizer/normalizer.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -22,7 +20,6 @@
#if U_ICU_VERSION_MAJOR_NUM < 56
#include <unicode/unorm.h>
-#define NORMALIZER_NONE UNORM_NONE
#define NORMALIZER_FORM_D UNORM_NFD
#define NORMALIZER_NFD UNORM_NFD
#define NORMALIZER_FORM_KD UNORM_NFKD
@@ -35,7 +32,6 @@
#else
#include <unicode/unorm2.h>
-#define NORMALIZER_NONE 0x2
#define NORMALIZER_FORM_D 0x4
#define NORMALIZER_NFD NORMALIZER_FORM_D
#define NORMALIZER_FORM_KD 0x8
diff --git a/ext/intl/normalizer/normalizer.stub.php b/ext/intl/normalizer/normalizer.stub.php
new file mode 100644
index 0000000000..f0d55738f6
--- /dev/null
+++ b/ext/intl/normalizer/normalizer.stub.php
@@ -0,0 +1,23 @@
+<?php
+
+class Normalizer
+{
+ /** @return string|false */
+ public static function normalize(string $input, int $form = Normalizer::FORM_C) {}
+
+ /** @return bool */
+ public static function isNormalized(string $input, int $form = Normalizer::FORM_C) {}
+
+#if U_ICU_VERSION_MAJOR_NUM >= 56
+ /** @return string|null */
+ public static function getRawDecomposition(string $input, int $form = Normalizer::FORM_C) {}
+#endif
+}
+
+function normalizer_normalize(string $input, int $form = Normalizer::FORM_C): string|false {}
+
+function normalizer_is_normalized(string $input, int $form = Normalizer::FORM_C): bool {}
+
+#if U_ICU_VERSION_MAJOR_NUM >= 56
+function normalizer_get_raw_decomposition(string $input, int $form = Normalizer::FORM_C): ?string {}
+#endif
diff --git a/ext/intl/normalizer/normalizer_arginfo.h b/ext/intl/normalizer/normalizer_arginfo.h
new file mode 100644
index 0000000000..858b2fe12d
--- /dev/null
+++ b/ext/intl/normalizer/normalizer_arginfo.h
@@ -0,0 +1,32 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Normalizer_normalize, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, input, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, form, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_Normalizer_isNormalized arginfo_class_Normalizer_normalize
+
+#if U_ICU_VERSION_MAJOR_NUM >= 56
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Normalizer_getRawDecomposition, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, input, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, form, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_normalizer_normalize, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, input, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, form, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_normalizer_is_normalized, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, input, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, form, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#if U_ICU_VERSION_MAJOR_NUM >= 56
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_normalizer_get_raw_decomposition, 0, 1, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, input, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, form, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
diff --git a/ext/intl/normalizer/normalizer_class.c b/ext/intl/normalizer/normalizer_class.c
index 4e46b2e279..0b6033893c 100644
--- a/ext/intl/normalizer/normalizer_class.c
+++ b/ext/intl/normalizer/normalizer_class.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -17,6 +15,7 @@
#include "normalizer_class.h"
#include "php_intl.h"
#include "normalizer_normalize.h"
+#include "normalizer_arginfo.h"
#include "intl_error.h"
#include <unicode/unorm.h>
@@ -27,30 +26,15 @@ zend_class_entry *Normalizer_ce_ptr = NULL;
* 'Normalizer' class registration structures & functions
*/
-/* {{{ Normalizer methods arguments info */
-
-ZEND_BEGIN_ARG_INFO_EX( normalizer_args, 0, 0, 1 )
- ZEND_ARG_INFO( 0, input )
- ZEND_ARG_INFO( 0, form )
-ZEND_END_ARG_INFO()
-
-#if U_ICU_VERSION_MAJOR_NUM >= 56
-ZEND_BEGIN_ARG_INFO_EX( decomposition_args, 0, 0, 1 )
- ZEND_ARG_INFO( 0, input )
-ZEND_END_ARG_INFO();
-#endif
-
-/* }}} */
-
/* {{{ Normalizer_class_functions
* Every 'Normalizer' class method has an entry in this table
*/
static const zend_function_entry Normalizer_class_functions[] = {
- ZEND_FENTRY( normalize, ZEND_FN( normalizer_normalize ), normalizer_args, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
- ZEND_FENTRY( isNormalized, ZEND_FN( normalizer_is_normalized ), normalizer_args, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
+ ZEND_FENTRY( normalize, ZEND_FN( normalizer_normalize ), arginfo_class_Normalizer_normalize, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
+ ZEND_FENTRY( isNormalized, ZEND_FN( normalizer_is_normalized ), arginfo_class_Normalizer_isNormalized, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
#if U_ICU_VERSION_MAJOR_NUM >= 56
- ZEND_FENTRY( getRawDecomposition, ZEND_FN( normalizer_get_raw_decomposition ), decomposition_args, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
+ ZEND_FENTRY( getRawDecomposition, ZEND_FN( normalizer_get_raw_decomposition ), arginfo_class_Normalizer_getRawDecomposition, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
#endif
PHP_FE_END
};
diff --git a/ext/intl/normalizer/normalizer_class.h b/ext/intl/normalizer/normalizer_class.h
index de5a168a45..881aa80656 100644
--- a/ext/intl/normalizer/normalizer_class.h
+++ b/ext/intl/normalizer/normalizer_class.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/normalizer/normalizer_normalize.c b/ext/intl/normalizer/normalizer_normalize.c
index f8336d0101..5a768730f6 100644
--- a/ext/intl/normalizer/normalizer_normalize.c
+++ b/ext/intl/normalizer/normalizer_normalize.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -59,26 +57,8 @@ static const UNormalizer2 *intl_get_normalizer(zend_long form, UErrorCode *err)
static int32_t intl_normalize(zend_long form, const UChar *src, int32_t src_len, UChar *dst, int32_t dst_len, UErrorCode *err)
{/*{{{*/
- const UNormalizer2 *norm;
-
- /* Mimic the behavior of ICU < 56. */
- if (UNEXPECTED(NORMALIZER_NONE == form)) {
- /* FIXME This is a noop which should be removed somewhen after PHP 7.3.*/
- zend_error(E_DEPRECATED, "Normalizer::NONE is obsolete with ICU 56 and above and will be removed in later PHP versions");
-
- if (dst_len >= src_len) {
- memmove(dst, src, sizeof(UChar) * src_len);
- dst[src_len] = '\0';
- *err = U_ZERO_ERROR;
- return src_len;
- }
-
- *err = U_BUFFER_OVERFLOW_ERROR;
- return -1;
- }
-
- norm = intl_get_normalizer(form, err);
- if(U_FAILURE(*err)) {
+ const UNormalizer2 *norm = intl_get_normalizer(form, err);
+ if (U_FAILURE(*err)) {
return -1;
}
@@ -127,17 +107,12 @@ PHP_FUNCTION( normalizer_normalize )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "s|l",
&input, &input_len, &form ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "normalizer_normalize: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
expansion_factor = 1;
switch(form) {
- case NORMALIZER_NONE:
- break;
case NORMALIZER_FORM_D:
expansion_factor = 3;
break;
@@ -269,15 +244,10 @@ PHP_FUNCTION( normalizer_is_normalized )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "s|l",
&input, &input_len, &form) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "normalizer_is_normalized: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
switch(form) {
- /* case NORMALIZER_NONE: not allowed - doesn't make sense */
-
case NORMALIZER_FORM_D:
case NORMALIZER_FORM_KD:
case NORMALIZER_FORM_C:
@@ -361,7 +331,7 @@ PHP_FUNCTION( normalizer_get_raw_decomposition )
intl_error_reset(NULL);
if ((zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &input, &input_length, &form) == FAILURE)) {
- return;
+ RETURN_THROWS();
}
norm = intl_get_normalizer(form, &status);
diff --git a/ext/intl/normalizer/normalizer_normalize.h b/ext/intl/normalizer/normalizer_normalize.h
index 2ed957758a..9c15f348ce 100644
--- a/ext/intl/normalizer/normalizer_normalize.h
+++ b/ext/intl/normalizer/normalizer_normalize.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/php_intl.c b/ext/intl/php_intl.c
index b244a29842..dd655e0e03 100644
--- a/ext/intl/php_intl.c
+++ b/ext/intl/php_intl.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -33,6 +31,7 @@
#include "collator/collator_locale.h"
#include "collator/collator_create.h"
#include "collator/collator_error.h"
+#include "collator/collator_arginfo.h"
#include "converter/converter.h"
@@ -42,8 +41,10 @@
#include "formatter/formatter_format.h"
#include "formatter/formatter_main.h"
#include "formatter/formatter_parse.h"
+#include "formatter/formatter_arginfo.h"
#include "grapheme/grapheme.h"
+#include "grapheme/grapheme_arginfo.h"
#include "msgformat/msgformat.h"
#include "msgformat/msgformat_class.h"
@@ -54,10 +55,12 @@
#include "normalizer/normalizer.h"
#include "normalizer/normalizer_class.h"
#include "normalizer/normalizer_normalize.h"
+#include "normalizer/normalizer_arginfo.h"
#include "locale/locale.h"
#include "locale/locale_class.h"
#include "locale/locale_methods.h"
+#include "locale/locale_arginfo.h"
#include "dateformat/dateformat.h"
#include "dateformat/dateformat_class.h"
@@ -67,24 +70,30 @@
#include "dateformat/dateformat_format_object.h"
#include "dateformat/dateformat_parse.h"
#include "dateformat/dateformat_data.h"
+#include "dateformat/dateformat_arginfo.h"
#include "resourcebundle/resourcebundle_class.h"
+#include "resourcebundle/resourcebundle_arginfo.h"
#include "transliterator/transliterator.h"
#include "transliterator/transliterator_class.h"
#include "transliterator/transliterator_methods.h"
+#include "transliterator/transliterator_arginfo.h"
#include "timezone/timezone_class.h"
#include "timezone/timezone_methods.h"
+#include "timezone/timezone_arginfo.h"
#include "calendar/calendar_class.h"
#include "calendar/calendar_methods.h"
#include "calendar/gregoriancalendar_methods.h"
+#include "calendar/calendar_arginfo.h"
#include "breakiterator/breakiterator_class.h"
#include "breakiterator/breakiterator_iterators.h"
#include "idn/idn.h"
+#include "idn/idn_arginfo.h"
#include "uchar/uchar.h"
# include "spoofchecker/spoofchecker_class.h"
@@ -93,8 +102,10 @@
# include "spoofchecker/spoofchecker_main.h"
#include "msgformat/msgformat.h"
+#include "msgformat/msgformat_arginfo.h"
#include "common/common_error.h"
#include "common/common_enum.h"
+#include "common/common_arginfo.h"
#include <unicode/uloc.h>
#include <unicode/uclean.h>
@@ -122,507 +133,6 @@ const char *intl_locale_get_default( void )
return INTL_G(default_locale);
}
-/* {{{ Arguments info */
-ZEND_BEGIN_ARG_INFO_EX(collator_static_0_args, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(collator_static_1_arg, 0, 0, 1)
- ZEND_ARG_INFO(0, arg1)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(collator_0_args, 0, 0, 1)
- ZEND_ARG_OBJ_INFO(0, object, Collator, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(collator_1_arg, 0, 0, 2)
- ZEND_ARG_OBJ_INFO(0, object, Collator, 0)
- ZEND_ARG_INFO(0, arg1)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(collator_2_args, 0, 0, 3)
- ZEND_ARG_OBJ_INFO(0, object, Collator, 0)
- ZEND_ARG_INFO(0, arg1)
- ZEND_ARG_INFO(0, arg2)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(collator_sort_args, 0, 0, 2)
- ZEND_ARG_OBJ_INFO(0, object, Collator, 0)
- ZEND_ARG_ARRAY_INFO(1, arr, 0)
- ZEND_ARG_INFO(0, sort_flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(collator_sort_with_sort_keys_args, 0, 0, 2)
- ZEND_ARG_OBJ_INFO(0, coll, Collator, 0)
- ZEND_ARG_ARRAY_INFO(1, arr, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(numfmt_parse_arginfo, 0, 0, 2)
- ZEND_ARG_INFO(0, formatter)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, type)
- ZEND_ARG_INFO(1, position)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(numfmt_parse_currency_arginfo, 0, 0, 3)
- ZEND_ARG_INFO(0, formatter)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(1, currency)
- ZEND_ARG_INFO(1, position)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( locale_get_loc_in_loc_args, 0, ZEND_RETURN_VALUE, 1 )
- ZEND_ARG_INFO(0, locale)
- ZEND_ARG_INFO(0, in_locale)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( locale_filter_matches_args, 0, ZEND_RETURN_VALUE, 2 )
- ZEND_ARG_INFO(0, langtag)
- ZEND_ARG_INFO(0, locale)
- ZEND_ARG_INFO(0, canonicalize)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( locale_lookup_args, 0, ZEND_RETURN_VALUE, 2 )
- ZEND_ARG_INFO(0, langtag)
- ZEND_ARG_INFO(0, locale)
- ZEND_ARG_INFO(0, canonicalize)
- ZEND_ARG_INFO(0, def)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(locale_0_args, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(locale_1_arg, 0, 0, 1)
- ZEND_ARG_INFO(0, arg1)
-ZEND_END_ARG_INFO()
-
-#define intl_0_args collator_static_0_args
-#define intl_1_arg collator_static_1_arg
-
-ZEND_BEGIN_ARG_INFO_EX(normalizer_args, 0, 0, 1)
- ZEND_ARG_INFO(0, input)
- ZEND_ARG_INFO(0, form)
-ZEND_END_ARG_INFO()
-
-#if U_ICU_VERSION_MAJOR_NUM >= 56
-ZEND_BEGIN_ARG_INFO_EX(decomposition_args, 0, 0, 1)
- ZEND_ARG_INFO(0, input)
-ZEND_END_ARG_INFO();
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(grapheme_1_arg, 0, 0, 1)
- ZEND_ARG_INFO(0, string)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(grapheme_search_args, 0, 0, 2)
- ZEND_ARG_INFO(0, haystack)
- ZEND_ARG_INFO(0, needle)
- ZEND_ARG_INFO(0, offset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(grapheme_substr_args, 0, 0, 2)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, start)
- ZEND_ARG_INFO(0, length)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(grapheme_strstr_args, 0, 0, 2)
- ZEND_ARG_INFO(0, haystack)
- ZEND_ARG_INFO(0, needle)
- ZEND_ARG_INFO(0, before_needle)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(grapheme_extract_args, 0, 0, 2)
- ZEND_ARG_INFO(0, arg1)
- ZEND_ARG_INFO(0, arg2)
- ZEND_ARG_INFO(0, arg3)
- ZEND_ARG_INFO(0, arg4)
- ZEND_ARG_INFO(1, arg5) /* 1 = pass by reference */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(datefmt_parse_args, 0, 0, 2)
- ZEND_ARG_INFO(0, formatter)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(1, position)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_create, 0, 0, 2)
- ZEND_ARG_INFO(0, locale)
- ZEND_ARG_INFO(0, style)
- ZEND_ARG_INFO(0, pattern)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_get_error_code, 0, 0, 1)
- ZEND_ARG_INFO(0, nf)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_format, 0, 0, 2)
- ZEND_ARG_INFO(0, nf)
- ZEND_ARG_INFO(0, num)
- ZEND_ARG_INFO(0, type)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_format_currency, 0, 0, 3)
- ZEND_ARG_INFO(0, nf)
- ZEND_ARG_INFO(0, num)
- ZEND_ARG_INFO(0, currency)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_get_attribute, 0, 0, 2)
- ZEND_ARG_INFO(0, nf)
- ZEND_ARG_INFO(0, attr)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_set_attribute, 0, 0, 3)
- ZEND_ARG_INFO(0, nf)
- ZEND_ARG_INFO(0, attr)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_set_symbol, 0, 0, 3)
- ZEND_ARG_INFO(0, nf)
- ZEND_ARG_INFO(0, attr)
- ZEND_ARG_INFO(0, symbol)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_set_pattern, 0, 0, 2)
- ZEND_ARG_INFO(0, nf)
- ZEND_ARG_INFO(0, pattern)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_get_locale, 0, 0, 1)
- ZEND_ARG_INFO(0, nf)
- ZEND_ARG_INFO(0, type)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_msgfmt_create, 0, 0, 2)
- ZEND_ARG_INFO(0, locale)
- ZEND_ARG_INFO(0, pattern)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_msgfmt_get_error_code, 0, 0, 1)
- ZEND_ARG_INFO(0, nf)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_msgfmt_get_error_message, 0, 0, 1)
- ZEND_ARG_INFO(0, coll)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_msgfmt_format, 0, 0, 2)
- ZEND_ARG_INFO(0, nf)
- ZEND_ARG_INFO(0, args)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_msgfmt_format_message, 0, 0, 3)
- ZEND_ARG_INFO(0, locale)
- ZEND_ARG_INFO(0, pattern)
- ZEND_ARG_INFO(0, args)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_msgfmt_parse, 0, 0, 2)
- ZEND_ARG_INFO(0, nf)
- ZEND_ARG_INFO(0, source)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_numfmt_parse_message, 0, 0, 3)
- ZEND_ARG_INFO(0, locale)
- ZEND_ARG_INFO(0, pattern)
- ZEND_ARG_INFO(0, source)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_msgfmt_set_pattern, 0, 0, 2)
- ZEND_ARG_INFO(0, mf)
- ZEND_ARG_INFO(0, pattern)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_msgfmt_get_locale, 0, 0, 1)
- ZEND_ARG_INFO(0, mf)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_set_pattern, 0, 0, 2)
- ZEND_ARG_INFO(0, mf)
- ZEND_ARG_INFO(0, pattern)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_set_timezone, 0, 0, 2)
- ZEND_ARG_INFO(0, mf)
- ZEND_ARG_INFO(0, timezone)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_set_calendar, 0, 0, 2)
- ZEND_ARG_INFO(0, mf)
- ZEND_ARG_INFO(0, calendar)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_format, 0, 0, 0)
- ZEND_ARG_INFO(0, args)
- ZEND_ARG_INFO(0, array)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_format_object, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
- ZEND_ARG_INFO(0, format)
- ZEND_ARG_INFO(0, locale)
-ZEND_END_ARG_INFO()
-
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_datefmt_create, 0, 0, 3)
- ZEND_ARG_INFO(0, locale)
- ZEND_ARG_INFO(0, date_type)
- ZEND_ARG_INFO(0, time_type)
- ZEND_ARG_INFO(0, timezone_str)
- ZEND_ARG_INFO(0, calendar)
- ZEND_ARG_INFO(0, pattern)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_idn_to_ascii, 0, 0, 1)
- ZEND_ARG_INFO(0, domain)
- ZEND_ARG_INFO(0, option)
- ZEND_ARG_INFO(0, variant)
- ZEND_ARG_INFO(1, idn_info)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( arginfo_resourcebundle_create_proc, 0, 0, 2 )
- ZEND_ARG_INFO( 0, locale )
- ZEND_ARG_INFO( 0, bundlename )
- ZEND_ARG_INFO( 0, fallback )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( arginfo_resourcebundle_get_proc, 0, 0, 2 )
- ZEND_ARG_INFO( 0, bundle )
- ZEND_ARG_INFO( 0, index )
- ZEND_ARG_INFO( 0, fallback )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( arginfo_resourcebundle_count_proc, 0, 0, 1 )
- ZEND_ARG_INFO( 0, bundle )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( arginfo_resourcebundle_locales_proc, 0, 0, 1 )
- ZEND_ARG_INFO( 0, bundlename )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( arginfo_resourcebundle_get_error_code_proc, 0, 0, 1 )
- ZEND_ARG_INFO( 0, bundle )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( arginfo_resourcebundle_get_error_message_proc, 0, 0, 1 )
- ZEND_ARG_INFO( 0, bundle )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( arginfo_transliterator_void, 0, 0, 0 )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( arginfo_transliterator_create, 0, 0, 1 )
- ZEND_ARG_INFO( 0, id )
- ZEND_ARG_INFO( 0, direction )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( arginfo_transliterator_create_from_rules, 0, 0, 1 )
- ZEND_ARG_INFO( 0, rules )
- ZEND_ARG_INFO( 0, direction )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( arginfo_transliterator_create_inverse, 0, 0, 1 )
- ZEND_ARG_OBJ_INFO( 0, orig_trans, Transliterator, 0 )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( arginfo_transliterator_transliterate, 0, 0, 2 )
- ZEND_ARG_INFO( 0, trans )
- ZEND_ARG_INFO( 0, subject )
- ZEND_ARG_INFO( 0, start )
- ZEND_ARG_INFO( 0, end )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( arginfo_transliterator_error, 0, 0, 1 )
- ZEND_ARG_OBJ_INFO( 0, trans, Transliterator, 0 )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( arginfo_tz_idarg_static, 0, 0, 1 )
- ZEND_ARG_INFO( 0, zoneId )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( arginfo_tz_from_date_time_zone, 0, 0, 1 )
- ZEND_ARG_OBJ_INFO( 0, dateTimeZone, DateTimeZone, 0 )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( arginfo_tz_create_enumeration, 0, 0, 0 )
- ZEND_ARG_INFO( 0, countryOrRawOffset )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( arginfo_tz_create_time_zone_id_enumeration, 0, 0, 1 )
- ZEND_ARG_INFO( 0, zoneType )
- ZEND_ARG_INFO( 0, region )
- ZEND_ARG_INFO( 0, rawOffset )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( arginfo_tz_get_canonical_id, 0, 0, 1 )
- ZEND_ARG_INFO( 0, zoneId )
- ZEND_ARG_INFO( 1, isSystemID )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( arginfo_tz_get_equivalent_id, 0, 0, 2 )
- ZEND_ARG_INFO( 0, zoneId )
- ZEND_ARG_INFO( 0, index )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( arginfo_tz_get_offset, 0, 0, 5 )
- ZEND_ARG_OBJ_INFO( 0, timeZone, IntlTimeZone, 0 )
- ZEND_ARG_INFO( 0, date )
- ZEND_ARG_INFO( 0, local )
- ZEND_ARG_INFO( 1, rawOffset )
- ZEND_ARG_INFO( 1, dstOffset )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( arginfo_tz_has_same_rules, 0, 0, 1 )
- ZEND_ARG_OBJ_INFO( 0, timeZone, IntlTimeZone, 0 )
- ZEND_ARG_OBJ_INFO( 0, otherTimeZone, IntlTimeZone, 0 )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( arginfo_tz_get_display_name, 0, 0, 1 )
- ZEND_ARG_OBJ_INFO( 0, timeZone, IntlTimeZone, 0 )
- ZEND_ARG_INFO( 0, isDaylight )
- ZEND_ARG_INFO( 0, style )
- ZEND_ARG_INFO( 0, locale )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( arginfo_tz_only_tz, 0, 0, 1 )
- ZEND_ARG_OBJ_INFO( 0, timeZone, IntlTimeZone, 0 )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( arginfo_tz_void, 0, 0, 0 )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_create_instance, 0, 0, 0 )
- ZEND_ARG_INFO( 0, timeZone )
- ZEND_ARG_INFO( 0, locale )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_only_cal, 0, 0, 1 )
- ZEND_ARG_OBJ_INFO( 0, calendar, IntlCalendar, 0 )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_void, 0, 0, 0 )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_field, 0, 0, 2 )
- ZEND_ARG_OBJ_INFO( 0, calendar, IntlCalendar, 0 )
- ZEND_ARG_INFO( 0, field )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_dow, 0, 0, 2 )
- ZEND_ARG_OBJ_INFO( 0, calendar, IntlCalendar, 0 )
- ZEND_ARG_INFO( 0, dayOfWeek )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_other_cal, 0, 0, 2 )
- ZEND_ARG_OBJ_INFO( 0, calendar, IntlCalendar, 0 )
- ZEND_ARG_OBJ_INFO( 0, otherCalendar, IntlCalendar, 0 )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_date, 0, 0, 2 )
- ZEND_ARG_OBJ_INFO( 0, calendar, IntlCalendar, 0 )
- ZEND_ARG_INFO( 0, date )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_date_optional, 0, 0, 1 )
- ZEND_ARG_OBJ_INFO( 0, calendar, IntlCalendar, 0 )
- ZEND_ARG_INFO( 0, date )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_get_keyword_values_for_locale, 0, 0, 3)
- ZEND_ARG_INFO( 0, key )
- ZEND_ARG_INFO( 0, locale )
- ZEND_ARG_INFO( 0, commonlyUsed )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_add, 0, 0, 3 )
- ZEND_ARG_OBJ_INFO( 0, calendar, IntlCalendar, 0 )
- ZEND_ARG_INFO( 0, field )
- ZEND_ARG_INFO( 0, amount )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_set_time_zone, 0, 0, 2 )
- ZEND_ARG_OBJ_INFO( 0, calendar, IntlCalendar, 0 )
- ZEND_ARG_INFO( 0, timeZone )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_set, 0, 0, 3 )
- ZEND_ARG_OBJ_INFO( 0, calendar, IntlCalendar, 0 )
- ZEND_ARG_INFO( 0, fieldOrYear )
- ZEND_ARG_INFO( 0, valueOrMonth )
- ZEND_ARG_INFO( 0, dayOfMonth )
- ZEND_ARG_INFO( 0, hour )
- ZEND_ARG_INFO( 0, minute )
- ZEND_ARG_INFO( 0, second )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_roll, 0, 0, 2 )
- ZEND_ARG_OBJ_INFO( 0, calendar, IntlCalendar, 0 )
- ZEND_ARG_INFO( 0, field )
- ZEND_ARG_INFO( 0, amountOrUpOrDown )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_clear, 0, 0, 1 )
- ZEND_ARG_OBJ_INFO( 0, calendar, IntlCalendar, 0 )
- ZEND_ARG_INFO( 0, field )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_field_difference, 0, 0, 3 )
- ZEND_ARG_OBJ_INFO( 0, calendar, IntlCalendar, 0 )
- ZEND_ARG_INFO( 0, when )
- ZEND_ARG_INFO( 0, field )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_get_locale, 0, 0, 2 )
- ZEND_ARG_OBJ_INFO( 0, calendar, IntlCalendar, 0 )
- ZEND_ARG_INFO( 0, localeType )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_set_lenient, 0, 0, 2 )
- ZEND_ARG_OBJ_INFO( 0, calendar, IntlCalendar, 0 )
- ZEND_ARG_INFO( 0, isLenient )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_set_minimal_days_in_first_week, 0, 0, 2 )
- ZEND_ARG_OBJ_INFO( 0, calendar, IntlCalendar, 0 )
- ZEND_ARG_INFO( 0, numberOfDays )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ainfo_cal_from_date_time, 0, 0, 1)
- ZEND_ARG_INFO(0, dateTime)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( ainfo_cal_wall_time_option, 0, 0, 2 )
- ZEND_ARG_OBJ_INFO( 0, calendar, IntlCalendar, 0 )
- ZEND_ARG_INFO( 0, wallTimeOption )
-ZEND_END_ARG_INFO()
-
-/* Gregorian Calendar */
-ZEND_BEGIN_ARG_INFO_EX( ainfo_gregcal_create_instance, 0, 0, 0 )
- ZEND_ARG_INFO(0, timeZoneOrYear)
- ZEND_ARG_INFO(0, localeOrMonth)
- ZEND_ARG_INFO(0, dayOfMonth)
- ZEND_ARG_INFO(0, hour)
- ZEND_ARG_INFO(0, minute)
- ZEND_ARG_INFO(0, second)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( ainfo_gregcal_is_leap_year, 0, 0, 2 )
- ZEND_ARG_OBJ_INFO( 0, calendar, IntlGregorianCalendar, 0 )
- ZEND_ARG_INFO( 0, year )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( ainfo_gregcal_only_gregcal, 0, 0, 1 )
- ZEND_ARG_OBJ_INFO( 0, calendar, IntlGregorianCalendar, 0 )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( ainfo_gregcal_set_gregorian_change, 0, 0, 2 )
- ZEND_ARG_OBJ_INFO( 0, calendar, IntlGregorianCalendar, 0 )
- ZEND_ARG_INFO( 0, date )
-ZEND_END_ARG_INFO()
-
-/* }}} */
-
/* {{{ intl_functions
*
* Every user visible function must have an entry in intl_functions[].
@@ -630,71 +140,71 @@ ZEND_END_ARG_INFO()
static const zend_function_entry intl_functions[] = {
/* collator functions */
- PHP_FE( collator_create, collator_static_1_arg )
- PHP_FE( collator_compare, collator_2_args )
- PHP_FE( collator_get_attribute, collator_1_arg )
- PHP_FE( collator_set_attribute, collator_2_args )
- PHP_FE( collator_get_strength, collator_0_args )
- PHP_FE( collator_set_strength, collator_1_arg )
- PHP_FE( collator_sort, collator_sort_args )
- PHP_FE( collator_sort_with_sort_keys, collator_sort_with_sort_keys_args )
- PHP_FE( collator_asort, collator_sort_args )
- PHP_FE( collator_get_locale, collator_1_arg )
- PHP_FE( collator_get_error_code, collator_0_args )
- PHP_FE( collator_get_error_message, collator_0_args )
- PHP_FE( collator_get_sort_key, collator_1_arg )
+ PHP_FE( collator_create, arginfo_collator_create )
+ PHP_FE( collator_compare, arginfo_collator_compare )
+ PHP_FE( collator_get_attribute, arginfo_collator_get_attribute )
+ PHP_FE( collator_set_attribute, arginfo_collator_set_attribute )
+ PHP_FE( collator_get_strength, arginfo_collator_get_strength )
+ PHP_FE( collator_set_strength, arginfo_collator_set_strength )
+ PHP_FE( collator_sort, arginfo_collator_sort )
+ PHP_FE( collator_sort_with_sort_keys, arginfo_collator_sort_with_sort_keys )
+ PHP_FE( collator_asort, arginfo_collator_asort )
+ PHP_FE( collator_get_locale, arginfo_collator_get_locale )
+ PHP_FE( collator_get_error_code, arginfo_collator_get_error_code )
+ PHP_FE( collator_get_error_message, arginfo_collator_get_error_message )
+ PHP_FE( collator_get_sort_key, arginfo_collator_get_sort_key )
/* formatter functions */
PHP_FE( numfmt_create, arginfo_numfmt_create )
PHP_FE( numfmt_format, arginfo_numfmt_format )
- PHP_FE( numfmt_parse, numfmt_parse_arginfo )
+ PHP_FE( numfmt_parse, arginfo_numfmt_parse )
PHP_FE( numfmt_format_currency, arginfo_numfmt_format_currency )
- PHP_FE( numfmt_parse_currency, numfmt_parse_currency_arginfo )
+ PHP_FE( numfmt_parse_currency, arginfo_numfmt_parse_currency )
PHP_FE( numfmt_set_attribute, arginfo_numfmt_set_attribute )
PHP_FE( numfmt_get_attribute, arginfo_numfmt_get_attribute )
- PHP_FE( numfmt_set_text_attribute, arginfo_numfmt_set_attribute )
- PHP_FE( numfmt_get_text_attribute, arginfo_numfmt_get_attribute )
+ PHP_FE( numfmt_set_text_attribute, arginfo_numfmt_set_text_attribute )
+ PHP_FE( numfmt_get_text_attribute, arginfo_numfmt_get_text_attribute )
PHP_FE( numfmt_set_symbol, arginfo_numfmt_set_symbol )
- PHP_FE( numfmt_get_symbol, arginfo_numfmt_get_attribute )
+ PHP_FE( numfmt_get_symbol, arginfo_numfmt_get_symbol )
PHP_FE( numfmt_set_pattern, arginfo_numfmt_set_pattern )
- PHP_FE( numfmt_get_pattern, arginfo_numfmt_get_error_code )
+ PHP_FE( numfmt_get_pattern, arginfo_numfmt_get_pattern )
PHP_FE( numfmt_get_locale, arginfo_numfmt_get_locale )
PHP_FE( numfmt_get_error_code, arginfo_numfmt_get_error_code )
- PHP_FE( numfmt_get_error_message, arginfo_numfmt_get_error_code )
+ PHP_FE( numfmt_get_error_message, arginfo_numfmt_get_error_message )
/* normalizer functions */
- PHP_FE( normalizer_normalize, normalizer_args )
- PHP_FE( normalizer_is_normalized, normalizer_args )
+ PHP_FE( normalizer_normalize, arginfo_normalizer_normalize )
+ PHP_FE( normalizer_is_normalized, arginfo_normalizer_is_normalized )
#if U_ICU_VERSION_MAJOR_NUM >= 56
- PHP_FE( normalizer_get_raw_decomposition, decomposition_args )
+ PHP_FE( normalizer_get_raw_decomposition, arginfo_normalizer_get_raw_decomposition )
#endif
/* Locale functions */
- PHP_NAMED_FE( locale_get_default, zif_locale_get_default, locale_0_args )
- PHP_NAMED_FE( locale_set_default, zif_locale_set_default, locale_1_arg )
- PHP_FE( locale_get_primary_language, locale_1_arg )
- PHP_FE( locale_get_script, locale_1_arg )
- PHP_FE( locale_get_region, locale_1_arg )
- PHP_FE( locale_get_keywords, locale_1_arg )
- PHP_FE( locale_get_display_script, locale_get_loc_in_loc_args )
- PHP_FE( locale_get_display_region, locale_get_loc_in_loc_args )
- PHP_FE( locale_get_display_name, locale_get_loc_in_loc_args )
- PHP_FE( locale_get_display_language, locale_get_loc_in_loc_args)
- PHP_FE( locale_get_display_variant, locale_get_loc_in_loc_args )
- PHP_FE( locale_compose, locale_1_arg )
- PHP_FE( locale_parse, locale_1_arg )
- PHP_FE( locale_get_all_variants, locale_1_arg )
- PHP_FE( locale_filter_matches, locale_filter_matches_args )
- PHP_FE( locale_canonicalize, locale_1_arg )
- PHP_FE( locale_lookup, locale_lookup_args )
- PHP_FE( locale_accept_from_http, locale_1_arg )
+ PHP_NAMED_FE( locale_get_default, zif_locale_get_default, arginfo_locale_get_default )
+ PHP_NAMED_FE( locale_set_default, zif_locale_set_default, arginfo_locale_set_default )
+ PHP_FE( locale_get_primary_language, arginfo_locale_get_primary_language )
+ PHP_FE( locale_get_script, arginfo_locale_get_script )
+ PHP_FE( locale_get_region, arginfo_locale_get_region )
+ PHP_FE( locale_get_keywords, arginfo_locale_get_keywords )
+ PHP_FE( locale_get_display_script, arginfo_locale_get_display_script )
+ PHP_FE( locale_get_display_region, arginfo_locale_get_display_region )
+ PHP_FE( locale_get_display_name, arginfo_locale_get_display_name )
+ PHP_FE( locale_get_display_language, arginfo_locale_get_display_language)
+ PHP_FE( locale_get_display_variant, arginfo_locale_get_display_variant )
+ PHP_FE( locale_compose, arginfo_locale_compose )
+ PHP_FE( locale_parse, arginfo_locale_parse )
+ PHP_FE( locale_get_all_variants, arginfo_locale_get_all_variants )
+ PHP_FE( locale_filter_matches, arginfo_locale_filter_matches )
+ PHP_FE( locale_canonicalize, arginfo_locale_canonicalize )
+ PHP_FE( locale_lookup, arginfo_locale_lookup )
+ PHP_FE( locale_accept_from_http, arginfo_locale_accept_from_http )
/* MessageFormatter functions */
PHP_FE( msgfmt_create, arginfo_msgfmt_create )
PHP_FE( msgfmt_format, arginfo_msgfmt_format )
PHP_FE( msgfmt_format_message, arginfo_msgfmt_format_message )
PHP_FE( msgfmt_parse, arginfo_msgfmt_parse )
- PHP_FE( msgfmt_parse_message, arginfo_numfmt_parse_message )
+ PHP_FE( msgfmt_parse_message, arginfo_msgfmt_parse_message )
PHP_FE( msgfmt_set_pattern, arginfo_msgfmt_set_pattern )
PHP_FE( msgfmt_get_pattern, arginfo_msgfmt_get_locale )
PHP_FE( msgfmt_get_locale, arginfo_msgfmt_get_locale )
@@ -703,138 +213,138 @@ static const zend_function_entry intl_functions[] = {
/* IntlDateFormatter functions */
PHP_FE( datefmt_create, arginfo_datefmt_create )
- PHP_FE( datefmt_get_datetype, arginfo_msgfmt_get_locale )
- PHP_FE( datefmt_get_timetype, arginfo_msgfmt_get_locale )
- PHP_FE( datefmt_get_calendar, arginfo_msgfmt_get_locale )
- PHP_FE( datefmt_get_calendar_object, arginfo_msgfmt_get_locale )
+ PHP_FE( datefmt_get_datetype, arginfo_datefmt_get_datetype )
+ PHP_FE( datefmt_get_timetype, arginfo_datefmt_get_timetype )
+ PHP_FE( datefmt_get_calendar, arginfo_datefmt_get_calendar )
+ PHP_FE( datefmt_get_calendar_object, arginfo_datefmt_get_calendar_object )
PHP_FE( datefmt_set_calendar, arginfo_datefmt_set_calendar )
- PHP_FE( datefmt_get_locale, arginfo_msgfmt_get_locale )
- PHP_FE( datefmt_get_timezone_id, arginfo_msgfmt_get_locale )
- PHP_FE( datefmt_get_timezone, arginfo_msgfmt_get_locale )
+ PHP_FE( datefmt_get_locale, arginfo_datefmt_get_locale )
+ PHP_FE( datefmt_get_timezone_id, arginfo_datefmt_get_timezone_id )
+ PHP_FE( datefmt_get_timezone, arginfo_datefmt_get_timezone )
PHP_FE( datefmt_set_timezone, arginfo_datefmt_set_timezone )
- PHP_FE( datefmt_get_pattern, arginfo_msgfmt_get_locale )
+ PHP_FE( datefmt_get_pattern, arginfo_datefmt_get_pattern )
PHP_FE( datefmt_set_pattern, arginfo_datefmt_set_pattern )
- PHP_FE( datefmt_is_lenient, arginfo_msgfmt_get_locale )
- PHP_FE( datefmt_set_lenient, arginfo_msgfmt_get_locale )
+ PHP_FE( datefmt_is_lenient, arginfo_datefmt_is_lenient )
+ PHP_FE( datefmt_set_lenient, arginfo_datefmt_set_lenient )
PHP_FE( datefmt_format, arginfo_datefmt_format )
PHP_FE( datefmt_format_object, arginfo_datefmt_format_object )
- PHP_FE( datefmt_parse, datefmt_parse_args )
- PHP_FE( datefmt_localtime , datefmt_parse_args )
- PHP_FE( datefmt_get_error_code, arginfo_msgfmt_get_error_code )
- PHP_FE( datefmt_get_error_message, arginfo_msgfmt_get_error_message )
+ PHP_FE( datefmt_parse, arginfo_datefmt_parse )
+ PHP_FE( datefmt_localtime , arginfo_datefmt_localtime )
+ PHP_FE( datefmt_get_error_code, arginfo_datefmt_get_error_code )
+ PHP_FE( datefmt_get_error_message, arginfo_datefmt_get_error_message )
/* grapheme functions */
- PHP_FE( grapheme_strlen, grapheme_1_arg )
- PHP_FE( grapheme_strpos, grapheme_search_args )
- PHP_FE( grapheme_stripos, grapheme_search_args )
- PHP_FE( grapheme_strrpos, grapheme_search_args )
- PHP_FE( grapheme_strripos, grapheme_search_args )
- PHP_FE( grapheme_substr, grapheme_substr_args )
- PHP_FE( grapheme_strstr, grapheme_strstr_args )
- PHP_FE( grapheme_stristr, grapheme_strstr_args )
- PHP_FE( grapheme_extract, grapheme_extract_args )
+ PHP_FE( grapheme_strlen, arginfo_grapheme_strlen )
+ PHP_FE( grapheme_strpos, arginfo_grapheme_strpos )
+ PHP_FE( grapheme_stripos, arginfo_grapheme_stripos )
+ PHP_FE( grapheme_strrpos, arginfo_grapheme_strrpos )
+ PHP_FE( grapheme_strripos, arginfo_grapheme_strripos )
+ PHP_FE( grapheme_substr, arginfo_grapheme_substr )
+ PHP_FE( grapheme_strstr, arginfo_grapheme_strstr )
+ PHP_FE( grapheme_stristr, arginfo_grapheme_stristr )
+ PHP_FE( grapheme_extract, arginfo_grapheme_extract )
/* IDN functions */
PHP_FE( idn_to_ascii, arginfo_idn_to_ascii)
- PHP_FE( idn_to_utf8, arginfo_idn_to_ascii)
+ PHP_FE( idn_to_utf8, arginfo_idn_to_utf8)
/* ResourceBundle functions */
- PHP_FE( resourcebundle_create, arginfo_resourcebundle_create_proc )
- PHP_FE( resourcebundle_get, arginfo_resourcebundle_get_proc )
- PHP_FE( resourcebundle_count, arginfo_resourcebundle_count_proc )
- PHP_FE( resourcebundle_locales, arginfo_resourcebundle_locales_proc )
- PHP_FE( resourcebundle_get_error_code, arginfo_resourcebundle_get_error_code_proc )
- PHP_FE( resourcebundle_get_error_message, arginfo_resourcebundle_get_error_message_proc )
+ PHP_FE( resourcebundle_create, arginfo_resourcebundle_create )
+ PHP_FE( resourcebundle_get, arginfo_resourcebundle_get )
+ PHP_FE( resourcebundle_count, arginfo_resourcebundle_count )
+ PHP_FE( resourcebundle_locales, arginfo_resourcebundle_locales )
+ PHP_FE( resourcebundle_get_error_code, arginfo_resourcebundle_get_error_code )
+ PHP_FE( resourcebundle_get_error_message, arginfo_resourcebundle_get_error_message )
/* Transliterator functions */
PHP_FE( transliterator_create, arginfo_transliterator_create )
PHP_FE( transliterator_create_from_rules, arginfo_transliterator_create_from_rules )
- PHP_FE( transliterator_list_ids, arginfo_transliterator_void )
+ PHP_FE( transliterator_list_ids, arginfo_transliterator_list_ids )
PHP_FE( transliterator_create_inverse, arginfo_transliterator_create_inverse)
PHP_FE( transliterator_transliterate, arginfo_transliterator_transliterate )
- PHP_FE( transliterator_get_error_code, arginfo_transliterator_error )
- PHP_FE( transliterator_get_error_message, arginfo_transliterator_error )
+ PHP_FE( transliterator_get_error_code, arginfo_transliterator_get_error_code )
+ PHP_FE( transliterator_get_error_message, arginfo_transliterator_get_error_message )
/* TimeZone functions */
- PHP_FE( intltz_create_time_zone, arginfo_tz_idarg_static )
- PHP_FE( intltz_from_date_time_zone, arginfo_tz_from_date_time_zone )
- PHP_FE( intltz_create_default, arginfo_tz_void )
- PHP_FE( intltz_get_id, arginfo_tz_only_tz )
- PHP_FE( intltz_get_gmt, arginfo_tz_void )
- PHP_FE( intltz_get_unknown, arginfo_tz_void )
- PHP_FE( intltz_create_enumeration, arginfo_tz_create_enumeration )
- PHP_FE( intltz_count_equivalent_ids, arginfo_tz_idarg_static )
- PHP_FE( intltz_create_time_zone_id_enumeration, arginfo_tz_create_time_zone_id_enumeration )
- PHP_FE( intltz_get_canonical_id, arginfo_tz_get_canonical_id )
- PHP_FE( intltz_get_region, arginfo_tz_idarg_static )
- PHP_FE( intltz_get_tz_data_version, arginfo_tz_void )
- PHP_FE( intltz_get_equivalent_id, arginfo_tz_get_equivalent_id )
- PHP_FE( intltz_use_daylight_time, arginfo_tz_only_tz )
- PHP_FE( intltz_get_offset, arginfo_tz_get_offset )
- PHP_FE( intltz_get_raw_offset, arginfo_tz_only_tz )
- PHP_FE( intltz_has_same_rules, arginfo_tz_has_same_rules )
- PHP_FE( intltz_get_display_name, arginfo_tz_get_display_name )
- PHP_FE( intltz_get_dst_savings, arginfo_tz_only_tz )
- PHP_FE( intltz_to_date_time_zone, arginfo_tz_only_tz )
- PHP_FE( intltz_get_error_code, arginfo_tz_only_tz )
- PHP_FE( intltz_get_error_message, arginfo_tz_only_tz )
-
- PHP_FE( intlcal_create_instance, ainfo_cal_create_instance )
- PHP_FE( intlcal_get_keyword_values_for_locale, ainfo_cal_get_keyword_values_for_locale )
- PHP_FE( intlcal_get_now, ainfo_cal_void )
- PHP_FE( intlcal_get_available_locales, ainfo_cal_void )
- PHP_FE( intlcal_get, ainfo_cal_field )
- PHP_FE( intlcal_get_time, ainfo_cal_only_cal )
- PHP_FE( intlcal_set_time, ainfo_cal_date )
- PHP_FE( intlcal_add, ainfo_cal_add )
- PHP_FE( intlcal_set_time_zone, ainfo_cal_set_time_zone )
- PHP_FE( intlcal_after, ainfo_cal_other_cal )
- PHP_FE( intlcal_before, ainfo_cal_other_cal )
- PHP_FE( intlcal_set, ainfo_cal_set )
- PHP_FE( intlcal_roll, ainfo_cal_roll )
- PHP_FE( intlcal_clear, ainfo_cal_clear )
- PHP_FE( intlcal_field_difference, ainfo_cal_field_difference )
- PHP_FE( intlcal_get_actual_maximum, ainfo_cal_field )
- PHP_FE( intlcal_get_actual_minimum, ainfo_cal_field )
- PHP_FE( intlcal_get_day_of_week_type, ainfo_cal_dow )
- PHP_FE( intlcal_get_first_day_of_week, ainfo_cal_only_cal )
- PHP_FE( intlcal_get_greatest_minimum, ainfo_cal_field )
- PHP_FE( intlcal_get_least_maximum, ainfo_cal_field )
- PHP_FE( intlcal_get_locale, ainfo_cal_get_locale )
- PHP_FE( intlcal_get_maximum, ainfo_cal_field )
- PHP_FE( intlcal_get_minimal_days_in_first_week, ainfo_cal_only_cal )
- PHP_FE( intlcal_get_minimum, ainfo_cal_field )
- PHP_FE( intlcal_get_time_zone, ainfo_cal_only_cal )
- PHP_FE( intlcal_get_type, ainfo_cal_only_cal )
- PHP_FE( intlcal_get_weekend_transition, ainfo_cal_dow )
- PHP_FE( intlcal_in_daylight_time, ainfo_cal_only_cal )
- PHP_FE( intlcal_is_equivalent_to, ainfo_cal_other_cal )
- PHP_FE( intlcal_is_lenient, ainfo_cal_only_cal )
- PHP_FE( intlcal_is_set, ainfo_cal_field )
- PHP_FE( intlcal_is_weekend, ainfo_cal_date_optional )
- PHP_FE( intlcal_set_first_day_of_week, ainfo_cal_dow )
- PHP_FE( intlcal_set_lenient, ainfo_cal_set_lenient )
- PHP_FE( intlcal_set_minimal_days_in_first_week, ainfo_cal_set_minimal_days_in_first_week )
- PHP_FE( intlcal_equals, ainfo_cal_other_cal )
- PHP_FE( intlcal_from_date_time, ainfo_cal_from_date_time )
- PHP_FE( intlcal_to_date_time, ainfo_cal_only_cal )
- PHP_FE( intlcal_get_repeated_wall_time_option, ainfo_cal_only_cal )
- PHP_FE( intlcal_get_skipped_wall_time_option, ainfo_cal_only_cal )
- PHP_FE( intlcal_set_repeated_wall_time_option, ainfo_cal_wall_time_option )
- PHP_FE( intlcal_set_skipped_wall_time_option, ainfo_cal_wall_time_option )
- PHP_FE( intlcal_get_error_code, ainfo_cal_only_cal )
- PHP_FE( intlcal_get_error_message, ainfo_cal_only_cal )
-
- PHP_FE( intlgregcal_create_instance, ainfo_gregcal_create_instance )
- PHP_FE( intlgregcal_set_gregorian_change, ainfo_gregcal_set_gregorian_change )
- PHP_FE( intlgregcal_get_gregorian_change, ainfo_gregcal_only_gregcal )
- PHP_FE( intlgregcal_is_leap_year, ainfo_gregcal_is_leap_year )
+ PHP_FE( intltz_create_time_zone, arginfo_intltz_create_time_zone )
+ PHP_FE( intltz_from_date_time_zone, arginfo_intltz_from_date_time_zone )
+ PHP_FE( intltz_create_default, arginfo_intltz_create_default )
+ PHP_FE( intltz_get_id, arginfo_intltz_get_id )
+ PHP_FE( intltz_get_gmt, arginfo_intltz_get_gmt )
+ PHP_FE( intltz_get_unknown, arginfo_intltz_get_unknown )
+ PHP_FE( intltz_create_enumeration, arginfo_intltz_create_enumeration )
+ PHP_FE( intltz_count_equivalent_ids, arginfo_intltz_count_equivalent_ids )
+ PHP_FE( intltz_create_time_zone_id_enumeration, arginfo_intltz_create_time_zone_id_enumeration )
+ PHP_FE( intltz_get_canonical_id, arginfo_intltz_get_canonical_id )
+ PHP_FE( intltz_get_region, arginfo_intltz_get_region )
+ PHP_FE( intltz_get_tz_data_version, arginfo_intltz_get_tz_data_version )
+ PHP_FE( intltz_get_equivalent_id, arginfo_intltz_get_equivalent_id )
+ PHP_FE( intltz_use_daylight_time, arginfo_intltz_use_daylight_time )
+ PHP_FE( intltz_get_offset, arginfo_intltz_get_offset )
+ PHP_FE( intltz_get_raw_offset, arginfo_intltz_get_raw_offset )
+ PHP_FE( intltz_has_same_rules, arginfo_intltz_has_same_rules )
+ PHP_FE( intltz_get_display_name, arginfo_intltz_get_display_name )
+ PHP_FE( intltz_get_dst_savings, arginfo_intltz_get_dst_savings )
+ PHP_FE( intltz_to_date_time_zone, arginfo_intltz_to_date_time_zone )
+ PHP_FE( intltz_get_error_code, arginfo_intltz_get_error_code )
+ PHP_FE( intltz_get_error_message, arginfo_intltz_get_error_message )
+
+ PHP_FE( intlcal_create_instance, arginfo_intlcal_create_instance )
+ PHP_FE( intlcal_get_keyword_values_for_locale, arginfo_intlcal_get_keyword_values_for_locale )
+ PHP_FE( intlcal_get_now, arginfo_intlcal_get_now )
+ PHP_FE( intlcal_get_available_locales, arginfo_intlcal_get_available_locales )
+ PHP_FE( intlcal_get, arginfo_intlcal_get )
+ PHP_FE( intlcal_get_time, arginfo_intlcal_get_time )
+ PHP_FE( intlcal_set_time, arginfo_intlcal_set_time )
+ PHP_FE( intlcal_add, arginfo_intlcal_add )
+ PHP_FE( intlcal_set_time_zone, arginfo_intlcal_set_time_zone )
+ PHP_FE( intlcal_after, arginfo_intlcal_after )
+ PHP_FE( intlcal_before, arginfo_intlcal_before )
+ PHP_FE( intlcal_set, arginfo_intlcal_set )
+ PHP_FE( intlcal_roll, arginfo_intlcal_roll )
+ PHP_FE( intlcal_clear, arginfo_intlcal_clear )
+ PHP_FE( intlcal_field_difference, arginfo_intlcal_field_difference )
+ PHP_FE( intlcal_get_actual_maximum, arginfo_intlcal_get_actual_maximum )
+ PHP_FE( intlcal_get_actual_minimum, arginfo_intlcal_get_actual_minimum )
+ PHP_FE( intlcal_get_day_of_week_type, arginfo_intlcal_get_day_of_week_type )
+ PHP_FE( intlcal_get_first_day_of_week, arginfo_intlcal_get_first_day_of_week )
+ PHP_FE( intlcal_get_greatest_minimum, arginfo_intlcal_get_greatest_minimum )
+ PHP_FE( intlcal_get_least_maximum, arginfo_intlcal_get_least_maximum )
+ PHP_FE( intlcal_get_locale, arginfo_intlcal_get_locale )
+ PHP_FE( intlcal_get_maximum, arginfo_intlcal_get_maximum )
+ PHP_FE( intlcal_get_minimal_days_in_first_week, arginfo_intlcal_get_minimal_days_in_first_week )
+ PHP_FE( intlcal_get_minimum, arginfo_intlcal_get_minimum )
+ PHP_FE( intlcal_get_time_zone, arginfo_intlcal_get_time_zone )
+ PHP_FE( intlcal_get_type, arginfo_intlcal_get_type )
+ PHP_FE( intlcal_get_weekend_transition, arginfo_intlcal_get_weekend_transition )
+ PHP_FE( intlcal_in_daylight_time, arginfo_intlcal_in_daylight_time )
+ PHP_FE( intlcal_is_equivalent_to, arginfo_intlcal_is_equivalent_to )
+ PHP_FE( intlcal_is_lenient, arginfo_intlcal_is_lenient )
+ PHP_FE( intlcal_is_set, arginfo_intlcal_is_set )
+ PHP_FE( intlcal_is_weekend, arginfo_intlcal_is_weekend )
+ PHP_FE( intlcal_set_first_day_of_week, arginfo_intlcal_set_first_day_of_week )
+ PHP_FE( intlcal_set_lenient, arginfo_intlcal_set_lenient )
+ PHP_FE( intlcal_set_minimal_days_in_first_week, arginfo_intlcal_set_minimal_days_in_first_week )
+ PHP_FE( intlcal_equals, arginfo_intlcal_equals )
+ PHP_FE( intlcal_from_date_time, arginfo_intlcal_from_date_time )
+ PHP_FE( intlcal_to_date_time, arginfo_intlcal_to_date_time )
+ PHP_FE( intlcal_get_repeated_wall_time_option, arginfo_intlcal_get_repeated_wall_time_option )
+ PHP_FE( intlcal_get_skipped_wall_time_option, arginfo_intlcal_get_skipped_wall_time_option )
+ PHP_FE( intlcal_set_repeated_wall_time_option, arginfo_intlcal_set_repeated_wall_time_option )
+ PHP_FE( intlcal_set_skipped_wall_time_option, arginfo_intlcal_set_skipped_wall_time_option )
+ PHP_FE( intlcal_get_error_code, arginfo_intlcal_get_error_code )
+ PHP_FE( intlcal_get_error_message, arginfo_intlcal_get_error_message )
+
+ PHP_FE( intlgregcal_create_instance, arginfo_intlgregcal_create_instance )
+ PHP_FE( intlgregcal_set_gregorian_change, arginfo_intlgregcal_set_gregorian_change )
+ PHP_FE( intlgregcal_get_gregorian_change, arginfo_intlgregcal_get_gregorian_change )
+ PHP_FE( intlgregcal_is_leap_year, arginfo_intlgregcal_is_leap_year )
/* common functions */
- PHP_FE( intl_get_error_code, intl_0_args )
- PHP_FE( intl_get_error_message, intl_0_args )
- PHP_FE( intl_is_failure, intl_1_arg )
- PHP_FE( intl_error_name, intl_1_arg )
+ PHP_FE( intl_get_error_code, arginfo_intl_get_error_code )
+ PHP_FE( intl_get_error_message, arginfo_intl_get_error_message )
+ PHP_FE( intl_is_failure, arginfo_intl_is_failure )
+ PHP_FE( intl_error_name, arginfo_intl_error_name )
PHP_FE_END
};
diff --git a/ext/intl/php_intl.h b/ext/intl/php_intl.h
index 6b910d76c8..506797a36d 100644
--- a/ext/intl/php_intl.h
+++ b/ext/intl/php_intl.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/resourcebundle/resourcebundle.c b/ext/intl/resourcebundle/resourcebundle.c
index 5c3bc1742e..445910829c 100644
--- a/ext/intl/resourcebundle/resourcebundle.c
+++ b/ext/intl/resourcebundle/resourcebundle.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/resourcebundle/resourcebundle.h b/ext/intl/resourcebundle/resourcebundle.h
index 46a6ad5766..c48e7c79b7 100644
--- a/ext/intl/resourcebundle/resourcebundle.h
+++ b/ext/intl/resourcebundle/resourcebundle.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/resourcebundle/resourcebundle.stub.php b/ext/intl/resourcebundle/resourcebundle.stub.php
new file mode 100644
index 0000000000..14f10fea4b
--- /dev/null
+++ b/ext/intl/resourcebundle/resourcebundle.stub.php
@@ -0,0 +1,43 @@
+<?php
+
+class ResourceBundle implements Traversable
+{
+ public function __construct(?string $locale, ?string $bundlename, bool $fallback = true) {}
+
+ /** @return ResourceBundle|null */
+ public static function create(?string $locale, ?string $bundlename, bool $fallback = true) {}
+
+ /**
+ * @param string|int $index
+ * @return mixed
+ */
+ public function get($index, bool $fallback = true) {}
+
+ /** @return int */
+ public function count() {}
+
+ /** @return array|false */
+ public static function getLocales(string $bundlename) {}
+
+ /** @return int */
+ public function getErrorCode() {}
+
+ /** @return string */
+ public function getErrorMessage() {}
+}
+
+function resourcebundle_create(?string $locale, ?string $bundlename, bool $fallback = true): ?ResourceBundle {}
+
+/**
+ * @param string|int $index
+ * @return mixed
+ */
+function resourcebundle_get(ResourceBundle $bundle, $index) {}
+
+function resourcebundle_count(ResourceBundle $bundle): int {}
+
+function resourcebundle_locales(string $bundlename): array|false {}
+
+function resourcebundle_get_error_code(ResourceBundle $bundle): int {}
+
+function resourcebundle_get_error_message(ResourceBundle $bundle): string {}
diff --git a/ext/intl/resourcebundle/resourcebundle_arginfo.h b/ext/intl/resourcebundle/resourcebundle_arginfo.h
new file mode 100644
index 0000000000..855b8b548c
--- /dev/null
+++ b/ext/intl/resourcebundle/resourcebundle_arginfo.h
@@ -0,0 +1,50 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ResourceBundle___construct, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, bundlename, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, fallback, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ResourceBundle_create arginfo_class_ResourceBundle___construct
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ResourceBundle_get, 0, 0, 1)
+ ZEND_ARG_INFO(0, index)
+ ZEND_ARG_TYPE_INFO(0, fallback, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ResourceBundle_count, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ResourceBundle_getLocales, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, bundlename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ResourceBundle_getErrorCode arginfo_class_ResourceBundle_count
+
+#define arginfo_class_ResourceBundle_getErrorMessage arginfo_class_ResourceBundle_count
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_resourcebundle_create, 0, 2, ResourceBundle, 1)
+ ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, bundlename, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, fallback, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_resourcebundle_get, 0, 0, 2)
+ ZEND_ARG_OBJ_INFO(0, bundle, ResourceBundle, 0)
+ ZEND_ARG_INFO(0, index)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_resourcebundle_count, 0, 1, IS_LONG, 0)
+ ZEND_ARG_OBJ_INFO(0, bundle, ResourceBundle, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_resourcebundle_locales, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, bundlename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_resourcebundle_get_error_code arginfo_resourcebundle_count
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_resourcebundle_get_error_message, 0, 1, IS_STRING, 0)
+ ZEND_ARG_OBJ_INFO(0, bundle, ResourceBundle, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/intl/resourcebundle/resourcebundle_class.c b/ext/intl/resourcebundle/resourcebundle_class.c
index 0f63109eca..3e38d6f9f0 100644
--- a/ext/intl/resourcebundle/resourcebundle_class.c
+++ b/ext/intl/resourcebundle/resourcebundle_class.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -30,6 +28,7 @@
#include "resourcebundle/resourcebundle.h"
#include "resourcebundle/resourcebundle_iterator.h"
#include "resourcebundle/resourcebundle_class.h"
+#include "resourcebundle/resourcebundle_arginfo.h"
zend_class_entry *ResourceBundle_ce_ptr = NULL;
@@ -75,25 +74,22 @@ static zend_object *ResourceBundle_object_create( zend_class_entry *ce )
/* }}} */
/* {{{ ResourceBundle_ctor */
-static int resourcebundle_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_constructor)
+static int resourcebundle_ctor(INTERNAL_FUNCTION_PARAMETERS)
{
const char *bundlename;
size_t bundlename_len = 0;
const char *locale;
size_t locale_len = 0;
zend_bool fallback = 1;
- int zpp_flags = is_constructor ? ZEND_PARSE_PARAMS_THROW : 0;
zval *object = return_value;
ResourceBundle_object *rb = Z_INTL_RESOURCEBUNDLE_P( object );
intl_error_reset( NULL );
- if( zend_parse_parameters_ex( zpp_flags, ZEND_NUM_ARGS(), "s!s!|b",
+ if( zend_parse_parameters( ZEND_NUM_ARGS(), "s!s!|b",
&locale, &locale_len, &bundlename, &bundlename_len, &fallback ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "resourcebundle_ctor: unable to parse input parameters", 0 );
return FAILURE;
}
@@ -136,14 +132,6 @@ static int resourcebundle_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_constr
}
/* }}} */
-/* {{{ arginfo_resourcebundle__construct */
-ZEND_BEGIN_ARG_INFO_EX( arginfo_resourcebundle___construct, 0, 0, 2 )
- ZEND_ARG_INFO( 0, locale )
- ZEND_ARG_INFO( 0, bundlename )
- ZEND_ARG_INFO( 0, fallback )
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ proto ResourceBundle::__construct( string $locale [, string $bundlename [, bool $fallback = true ]] )
* ResourceBundle object constructor
*/
@@ -153,7 +141,7 @@ PHP_METHOD( ResourceBundle, __construct )
zend_replace_error_handling(EH_THROW, IntlException_ce_ptr, &error_handling);
return_value = ZEND_THIS;
- if (resourcebundle_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1) == FAILURE) {
+ if (resourcebundle_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU) == FAILURE) {
if (!EG(exception)) {
zend_throw_exception(IntlException_ce_ptr, "Constructor failed", 0);
}
@@ -168,7 +156,7 @@ proto ResourceBundle resourcebundle_create( string $locale [, string $bundlename
PHP_FUNCTION( resourcebundle_create )
{
object_init_ex( return_value, ResourceBundle_ce_ptr );
- if (resourcebundle_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0) == FAILURE) {
+ if (resourcebundle_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU) == FAILURE) {
zval_ptr_dtor(return_value);
RETURN_NULL();
}
@@ -176,7 +164,7 @@ PHP_FUNCTION( resourcebundle_create )
/* }}} */
/* {{{ resourcebundle_array_fetch */
-static void resourcebundle_array_fetch(zval *object, zval *offset, zval *return_value, int fallback)
+static void resourcebundle_array_fetch(zend_object *object, zval *offset, zval *return_value, int fallback)
{
int32_t meindex = 0;
char * mekey = NULL;
@@ -185,7 +173,7 @@ static void resourcebundle_array_fetch(zval *object, zval *offset, zval *return_
ResourceBundle_object *rb;
intl_error_reset( NULL );
- RESOURCEBUNDLE_METHOD_FETCH_OBJECT;
+ rb = php_intl_resourcebundle_fetch_object(object);
if(Z_TYPE_P(offset) == IS_LONG) {
is_numeric = 1;
@@ -230,7 +218,7 @@ static void resourcebundle_array_fetch(zval *object, zval *offset, zval *return_
/* }}} */
/* {{{ resourcebundle_array_get */
-zval *resourcebundle_array_get(zval *object, zval *offset, int type, zval *rv)
+zval *resourcebundle_array_get(zend_object *object, zval *offset, int type, zval *rv)
{
if(offset == NULL) {
php_error( E_ERROR, "Cannot apply [] to ResourceBundle object" );
@@ -241,13 +229,6 @@ zval *resourcebundle_array_get(zval *object, zval *offset, int type, zval *rv)
}
/* }}} */
-/* {{{ arginfo_resourcebundle_get */
-ZEND_BEGIN_ARG_INFO_EX( arginfo_resourcebundle_get, 0, 0, 1 )
- ZEND_ARG_INFO( 0, index )
- ZEND_ARG_INFO( 0, fallback )
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ proto mixed ResourceBundle::get( int|string $resindex [, bool $fallback = true ] )
* proto mixed resourcebundle_get( ResourceBundle $rb, int|string $resindex [, bool $fallback = true ] )
* Get resource identified by numerical index or key name.
@@ -259,20 +240,17 @@ PHP_FUNCTION( resourcebundle_get )
zval * object;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oz|b", &object, ResourceBundle_ce_ptr, &offset, &fallback ) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "resourcebundle_get: unable to parse input params", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
- resourcebundle_array_fetch(object, offset, return_value, fallback);
+ resourcebundle_array_fetch(Z_OBJ_P(object), offset, return_value, fallback);
}
/* }}} */
/* {{{ resourcebundle_array_count */
-int resourcebundle_array_count(zval *object, zend_long *count)
+int resourcebundle_array_count(zend_object *object, zend_long *count)
{
- ResourceBundle_object *rb;
- RESOURCEBUNDLE_METHOD_FETCH_OBJECT_NO_CHECK;
+ ResourceBundle_object *rb = php_intl_resourcebundle_fetch_object(object);
if (rb->me == NULL) {
intl_errors_set(&rb->error, U_ILLEGAL_ARGUMENT_ERROR,
@@ -286,11 +264,6 @@ int resourcebundle_array_count(zval *object, zend_long *count)
}
/* }}} */
-/* {{{ arginfo_resourcebundle_count */
-ZEND_BEGIN_ARG_INFO_EX( arginfo_resourcebundle_count, 0, 0, 0 )
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ proto int ResourceBundle::count()
* proto int resourcebundle_count( ResourceBundle $bundle )
* Get resources count
@@ -301,9 +274,7 @@ PHP_FUNCTION( resourcebundle_count )
RESOURCEBUNDLE_METHOD_INIT_VARS;
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O", &object, ResourceBundle_ce_ptr ) == FAILURE ) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "resourcebundle_count: unable to parse input params", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
RESOURCEBUNDLE_METHOD_FETCH_OBJECT;
@@ -312,12 +283,6 @@ PHP_FUNCTION( resourcebundle_count )
RETURN_LONG( len );
}
-/* {{{ arginfo_resourcebundle_getlocales */
-ZEND_BEGIN_ARG_INFO_EX( arginfo_resourcebundle_getlocales, 0, 0, 1 )
- ZEND_ARG_INFO( 0, bundlename )
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ proto array ResourceBundle::getLocales( string $bundlename )
* proto array resourcebundle_locales( string $bundlename )
* Get available locales from ResourceBundle name
@@ -335,9 +300,7 @@ PHP_FUNCTION( resourcebundle_locales )
if( zend_parse_parameters(ZEND_NUM_ARGS(), "s", &bundlename, &bundlename_len ) == FAILURE )
{
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "resourcebundle_locales: unable to parse input params", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (bundlename_len >= MAXPATHLEN) {
@@ -364,11 +327,6 @@ PHP_FUNCTION( resourcebundle_locales )
}
/* }}} */
-/* {{{ arginfo_resourcebundle_get_error_code */
-ZEND_BEGIN_ARG_INFO_EX( arginfo_resourcebundle_get_error_code, 0, 0, 0 )
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ proto string ResourceBundle::getErrorCode( )
* proto string resourcebundle_get_error_code( ResourceBundle $bundle )
* Get text description for ResourceBundle's last error code.
@@ -380,9 +338,7 @@ PHP_FUNCTION( resourcebundle_get_error_code )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O",
&object, ResourceBundle_ce_ptr ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "resourcebundle_get_error_code: unable to parse input params", 0 );
- RETURN_FALSE;
+ RETURN_THROWS();
}
rb = Z_INTL_RESOURCEBUNDLE_P( object );
@@ -391,11 +347,6 @@ PHP_FUNCTION( resourcebundle_get_error_code )
}
/* }}} */
-/* {{{ arginfo_resourcebundle_get_error_message */
-ZEND_BEGIN_ARG_INFO_EX( arginfo_resourcebundle_get_error_message, 0, 0, 0 )
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ proto string ResourceBundle::getErrorMessage( )
* proto string resourcebundle_get_error_message( ResourceBundle $bundle )
* Get text description for ResourceBundle's last error.
@@ -408,9 +359,7 @@ PHP_FUNCTION( resourcebundle_get_error_message )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O",
&object, ResourceBundle_ce_ptr ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "resourcebundle_get_error_message: unable to parse input params", 0 );
- RETURN_FALSE;
+ RETURN_THROWS();
}
rb = Z_INTL_RESOURCEBUNDLE_P( object );
@@ -423,13 +372,13 @@ PHP_FUNCTION( resourcebundle_get_error_message )
* Every 'ResourceBundle' class method has an entry in this table
*/
static const zend_function_entry ResourceBundle_class_functions[] = {
- PHP_ME( ResourceBundle, __construct, arginfo_resourcebundle___construct, ZEND_ACC_PUBLIC )
- ZEND_NAMED_ME( create, ZEND_FN( resourcebundle_create ), arginfo_resourcebundle___construct, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
- ZEND_NAMED_ME( get, ZEND_FN(resourcebundle_get), arginfo_resourcebundle_get, ZEND_ACC_PUBLIC )
- ZEND_NAMED_ME( count, ZEND_FN(resourcebundle_count), arginfo_resourcebundle_count, ZEND_ACC_PUBLIC )
- ZEND_NAMED_ME( getLocales, ZEND_FN(resourcebundle_locales), arginfo_resourcebundle_getlocales, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC )
- ZEND_NAMED_ME( getErrorCode, ZEND_FN(resourcebundle_get_error_code), arginfo_resourcebundle_get_error_code, ZEND_ACC_PUBLIC )
- ZEND_NAMED_ME( getErrorMessage, ZEND_FN(resourcebundle_get_error_message), arginfo_resourcebundle_get_error_message, ZEND_ACC_PUBLIC )
+ PHP_ME( ResourceBundle, __construct, arginfo_class_ResourceBundle___construct, ZEND_ACC_PUBLIC )
+ ZEND_NAMED_ME( create, ZEND_FN( resourcebundle_create ), arginfo_class_ResourceBundle_create, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC )
+ ZEND_NAMED_ME( get, ZEND_FN(resourcebundle_get), arginfo_class_ResourceBundle_get, ZEND_ACC_PUBLIC )
+ ZEND_NAMED_ME( count, ZEND_FN(resourcebundle_count), arginfo_class_ResourceBundle_count, ZEND_ACC_PUBLIC )
+ ZEND_NAMED_ME( getLocales, ZEND_FN(resourcebundle_locales), arginfo_class_ResourceBundle_getLocales, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC )
+ ZEND_NAMED_ME( getErrorCode, ZEND_FN(resourcebundle_get_error_code), arginfo_class_ResourceBundle_getErrorCode, ZEND_ACC_PUBLIC )
+ ZEND_NAMED_ME( getErrorMessage, ZEND_FN(resourcebundle_get_error_message), arginfo_class_ResourceBundle_getErrorMessage, ZEND_ACC_PUBLIC )
PHP_FE_END
};
/* }}} */
diff --git a/ext/intl/resourcebundle/resourcebundle_class.h b/ext/intl/resourcebundle/resourcebundle_class.h
index 0ac3635ba8..e7e264d66e 100644
--- a/ext/intl/resourcebundle/resourcebundle_class.h
+++ b/ext/intl/resourcebundle/resourcebundle_class.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -40,14 +38,12 @@ static inline ResourceBundle_object *php_intl_resourcebundle_fetch_object(zend_o
#define RESOURCEBUNDLE_METHOD_INIT_VARS INTL_METHOD_INIT_VARS(ResourceBundle, rb)
#define RESOURCEBUNDLE_METHOD_FETCH_OBJECT_NO_CHECK INTL_METHOD_FETCH_OBJECT(INTL_RESOURCEBUNDLE, rb)
#define RESOURCEBUNDLE_METHOD_FETCH_OBJECT \
- INTL_METHOD_FETCH_OBJECT(INTL_RESOURCEBUNDLE, rb); \
+ INTL_METHOD_FETCH_OBJECT(INTL_RESOURCEBUNDLE, rb); \
if (RESOURCEBUNDLE_OBJECT(rb) == NULL) { \
- intl_errors_set(&rb->error, U_ILLEGAL_ARGUMENT_ERROR, \
- "Found unconstructed ResourceBundle", 0); \
- RETURN_FALSE; \
+ zend_throw_error(NULL, "Found unconstructed ResourceBundle"); \
+ RETURN_THROWS(); \
}
-
#define RESOURCEBUNDLE_OBJECT(rb) (rb)->me
void resourcebundle_register_class( void );
diff --git a/ext/intl/resourcebundle/resourcebundle_iterator.c b/ext/intl/resourcebundle/resourcebundle_iterator.c
index 8bb66a157f..ab10daf82d 100644
--- a/ext/intl/resourcebundle/resourcebundle_iterator.c
+++ b/ext/intl/resourcebundle/resourcebundle_iterator.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/resourcebundle/resourcebundle_iterator.h b/ext/intl/resourcebundle/resourcebundle_iterator.h
index 01213ac76e..fa2e24d848 100644
--- a/ext/intl/resourcebundle/resourcebundle_iterator.h
+++ b/ext/intl/resourcebundle/resourcebundle_iterator.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/spoofchecker/spoofchecker.c b/ext/intl/spoofchecker/spoofchecker.c
index 607576a2bf..8791384b4d 100644
--- a/ext/intl/spoofchecker/spoofchecker.c
+++ b/ext/intl/spoofchecker/spoofchecker.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/spoofchecker/spoofchecker.h b/ext/intl/spoofchecker/spoofchecker.h
index 1cbdd7ea65..884c6715c5 100644
--- a/ext/intl/spoofchecker/spoofchecker.h
+++ b/ext/intl/spoofchecker/spoofchecker.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/spoofchecker/spoofchecker.stub.php b/ext/intl/spoofchecker/spoofchecker.stub.php
new file mode 100644
index 0000000000..28c333cf69
--- /dev/null
+++ b/ext/intl/spoofchecker/spoofchecker.stub.php
@@ -0,0 +1,23 @@
+<?php
+
+class Spoofchecker
+{
+ public function __construct() {}
+
+ /** @return bool */
+ public function isSuspicious(string $text, &$error = null) {}
+
+ /** @return bool */
+ public function areConfusable(string $s1, string $s2, &$error = null) {}
+
+ /** @return void */
+ public function setAllowedLocales(string $locale_list) {}
+
+ /** @return void */
+ public function setChecks(int $checks) {}
+
+#if U_ICU_VERSION_MAJOR_NUM >= 58
+ /** @return void */
+ public function setRestrictionLevel(int $level) {}
+#endif
+}
diff --git a/ext/intl/spoofchecker/spoofchecker_arginfo.h b/ext/intl/spoofchecker/spoofchecker_arginfo.h
new file mode 100644
index 0000000000..8572460fd3
--- /dev/null
+++ b/ext/intl/spoofchecker/spoofchecker_arginfo.h
@@ -0,0 +1,29 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Spoofchecker___construct, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Spoofchecker_isSuspicious, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, text, IS_STRING, 0)
+ ZEND_ARG_INFO(1, error)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Spoofchecker_areConfusable, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, s1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, s2, IS_STRING, 0)
+ ZEND_ARG_INFO(1, error)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Spoofchecker_setAllowedLocales, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, locale_list, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Spoofchecker_setChecks, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, checks, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#if U_ICU_VERSION_MAJOR_NUM >= 58
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Spoofchecker_setRestrictionLevel, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, level, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
diff --git a/ext/intl/spoofchecker/spoofchecker_class.c b/ext/intl/spoofchecker/spoofchecker_class.c
index d8bca44dba..e6fdcefa08 100644
--- a/ext/intl/spoofchecker/spoofchecker_class.c
+++ b/ext/intl/spoofchecker/spoofchecker_class.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -17,6 +15,7 @@
#include "spoofchecker_class.h"
#include "spoofchecker_main.h"
#include "spoofchecker_create.h"
+#include "spoofchecker_arginfo.h"
#include "php_intl.h"
#include "intl_error.h"
@@ -60,63 +59,32 @@ zend_object *Spoofchecker_object_create(zend_class_entry *ce)
* 'Spoofchecker' class registration structures & functions
*/
-/* {{{ Spoofchecker methods arguments info */
-ZEND_BEGIN_ARG_INFO_EX(spoofchecker_0_args, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(spoofchecker_set_checks, 0, 0, 1)
- ZEND_ARG_INFO(0, checks)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(spoofchecker_set_allowed_locales, 0, 0, 1)
- ZEND_ARG_INFO(0, locale_list)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(spoofchecker_is_suspicous, 0, 0, 1)
- ZEND_ARG_INFO(0, text)
- ZEND_ARG_INFO(1, error)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(spoofchecker_are_confusable, 0, 0, 2)
- ZEND_ARG_INFO(0, s1)
- ZEND_ARG_INFO(0, s2)
- ZEND_ARG_INFO(1, error)
-ZEND_END_ARG_INFO()
-
-#if U_ICU_VERSION_MAJOR_NUM >= 58
-ZEND_BEGIN_ARG_INFO_EX(spoofchecker_set_restriction_level, 0, 0, 1)
- ZEND_ARG_INFO(0, level)
-ZEND_END_ARG_INFO()
-#endif
-
-/* }}} */
-
/* {{{ Spoofchecker_class_functions
* Every 'Spoofchecker' class method has an entry in this table
*/
static const zend_function_entry Spoofchecker_class_functions[] = {
- PHP_ME(Spoofchecker, __construct, spoofchecker_0_args, ZEND_ACC_PUBLIC)
- PHP_ME(Spoofchecker, isSuspicious, spoofchecker_is_suspicous, ZEND_ACC_PUBLIC)
- PHP_ME(Spoofchecker, areConfusable, spoofchecker_are_confusable, ZEND_ACC_PUBLIC)
- PHP_ME(Spoofchecker, setAllowedLocales, spoofchecker_set_allowed_locales, ZEND_ACC_PUBLIC)
- PHP_ME(Spoofchecker, setChecks, spoofchecker_set_checks, ZEND_ACC_PUBLIC)
+ PHP_ME(Spoofchecker, __construct, arginfo_class_Spoofchecker___construct, ZEND_ACC_PUBLIC)
+ PHP_ME(Spoofchecker, isSuspicious, arginfo_class_Spoofchecker_isSuspicious, ZEND_ACC_PUBLIC)
+ PHP_ME(Spoofchecker, areConfusable, arginfo_class_Spoofchecker_areConfusable, ZEND_ACC_PUBLIC)
+ PHP_ME(Spoofchecker, setAllowedLocales, arginfo_class_Spoofchecker_setAllowedLocales, ZEND_ACC_PUBLIC)
+ PHP_ME(Spoofchecker, setChecks, arginfo_class_Spoofchecker_setChecks, ZEND_ACC_PUBLIC)
#if U_ICU_VERSION_MAJOR_NUM >= 58
- PHP_ME(Spoofchecker, setRestrictionLevel, spoofchecker_set_restriction_level, ZEND_ACC_PUBLIC)
+ PHP_ME(Spoofchecker, setRestrictionLevel, arginfo_class_Spoofchecker_setRestrictionLevel, ZEND_ACC_PUBLIC)
#endif
PHP_FE_END
};
/* }}} */
-static zend_object *spoofchecker_clone_obj(zval *object) /* {{{ */
+static zend_object *spoofchecker_clone_obj(zend_object *object) /* {{{ */
{
zend_object *new_obj_val;
Spoofchecker_object *sfo, *new_sfo;
- sfo = Z_INTL_SPOOFCHECKER_P(object);
+ sfo = php_intl_spoofchecker_fetch_object(object);
intl_error_reset(SPOOFCHECKER_ERROR_P(sfo));
- new_obj_val = Spoofchecker_ce_ptr->create_object(Z_OBJCE_P(object));
+ new_obj_val = Spoofchecker_ce_ptr->create_object(object->ce);
new_sfo = php_intl_spoofchecker_fetch_object(new_obj_val);
/* clone standard parts */
zend_objects_clone_members(&new_sfo->zo, &sfo->zo);
diff --git a/ext/intl/spoofchecker/spoofchecker_class.h b/ext/intl/spoofchecker/spoofchecker_class.h
index ba4cc497a1..12593e35be 100644
--- a/ext/intl/spoofchecker/spoofchecker_class.h
+++ b/ext/intl/spoofchecker/spoofchecker_class.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -65,9 +63,8 @@ extern zend_class_entry *Spoofchecker_ce_ptr;
#define SPOOFCHECKER_METHOD_FETCH_OBJECT \
SPOOFCHECKER_METHOD_FETCH_OBJECT_NO_CHECK; \
if (co->uspoof == NULL) { \
- intl_errors_set(&co->err, U_ILLEGAL_ARGUMENT_ERROR, \
- "Found unconstructed Spoofchecker", 0); \
- RETURN_FALSE; \
+ zend_throw_error(NULL, "Found unconstructed Spoofchecker"); \
+ RETURN_THROWS(); \
}
// Macro to check return value of a ucol_* function call.
diff --git a/ext/intl/spoofchecker/spoofchecker_create.c b/ext/intl/spoofchecker/spoofchecker_create.c
index 999b6af147..6c4143a580 100644
--- a/ext/intl/spoofchecker/spoofchecker_create.c
+++ b/ext/intl/spoofchecker/spoofchecker_create.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -34,8 +32,8 @@ PHP_METHOD(Spoofchecker, __construct)
zend_error_handling error_handling;
SPOOFCHECKER_METHOD_INIT_VARS;
- if (zend_parse_parameters_none_throw() == FAILURE) {
- return;
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
}
zend_replace_error_handling(EH_THROW, IntlException_ce_ptr, &error_handling);
diff --git a/ext/intl/spoofchecker/spoofchecker_create.h b/ext/intl/spoofchecker/spoofchecker_create.h
index 405c1bda12..4b573cbf07 100644
--- a/ext/intl/spoofchecker/spoofchecker_create.h
+++ b/ext/intl/spoofchecker/spoofchecker_create.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/spoofchecker/spoofchecker_main.c b/ext/intl/spoofchecker/spoofchecker_main.c
index 072ed24b7e..42108ecf01 100644
--- a/ext/intl/spoofchecker/spoofchecker_main.c
+++ b/ext/intl/spoofchecker/spoofchecker_main.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -33,7 +31,7 @@ PHP_METHOD(Spoofchecker, isSuspicious)
SPOOFCHECKER_METHOD_INIT_VARS;
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "s|z", &text, &text_len, &error_code)) {
- return;
+ RETURN_THROWS();
}
SPOOFCHECKER_METHOD_FETCH_OBJECT;
@@ -66,7 +64,7 @@ PHP_METHOD(Spoofchecker, areConfusable)
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "ss|z", &s1, &s1_len,
&s2, &s2_len, &error_code)) {
- return;
+ RETURN_THROWS();
}
SPOOFCHECKER_METHOD_FETCH_OBJECT;
@@ -98,7 +96,7 @@ PHP_METHOD(Spoofchecker, setAllowedLocales)
SPOOFCHECKER_METHOD_INIT_VARS;
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "s", &locales, &locales_len)) {
- return;
+ RETURN_THROWS();
}
SPOOFCHECKER_METHOD_FETCH_OBJECT;
@@ -121,7 +119,7 @@ PHP_METHOD(Spoofchecker, setChecks)
SPOOFCHECKER_METHOD_INIT_VARS;
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "l", &checks)) {
- return;
+ RETURN_THROWS();
}
SPOOFCHECKER_METHOD_FETCH_OBJECT;
@@ -144,7 +142,7 @@ PHP_METHOD(Spoofchecker, setRestrictionLevel)
SPOOFCHECKER_METHOD_INIT_VARS;
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "l", &level)) {
- return;
+ RETURN_THROWS();
}
SPOOFCHECKER_METHOD_FETCH_OBJECT;
diff --git a/ext/intl/spoofchecker/spoofchecker_main.h b/ext/intl/spoofchecker/spoofchecker_main.h
index 227f0e8481..a7774c24ad 100644
--- a/ext/intl/spoofchecker/spoofchecker_main.h
+++ b/ext/intl/spoofchecker/spoofchecker_main.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/tests/badargs.phpt b/ext/intl/tests/badargs.phpt
index c3d7a331c2..3cc04dbf64 100644
--- a/ext/intl/tests/badargs.phpt
+++ b/ext/intl/tests/badargs.phpt
@@ -14,13 +14,13 @@ foreach($funcs as $func) {
continue;
}
- try {
- $res = $func($arg);
- } catch (Exception $e) {
- continue;
- } catch (Error $e) {
- continue;
- }
+ try {
+ $res = $func($arg);
+ } catch (Exception $e) {
+ continue;
+ } catch (Error $e) {
+ continue;
+ }
if($res != false) {
echo "$func: ";
var_dump($res);
diff --git a/ext/intl/tests/breakiter___construct_error.phpt b/ext/intl/tests/breakiter___construct_error.phpt
index 595c6b283a..8b36b4a7cf 100644
--- a/ext/intl/tests/breakiter___construct_error.phpt
+++ b/ext/intl/tests/breakiter___construct_error.phpt
@@ -7,34 +7,34 @@ IntlRuleBasedBreakIterator::__construct(): arg errors
ini_set("intl.error_level", E_WARNING);
function print_exception($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";
}
//missing ; at the end:
try {
- var_dump(new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+'));
+ var_dump(new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+'));
} catch (IntlException $e) {
- print_exception($e);
+ print_exception($e);
}
try {
- var_dump(new IntlRuleBasedBreakIterator());
+ var_dump(new IntlRuleBasedBreakIterator());
} catch (TypeError $e) {
- print_exception($e);
+ print_exception($e);
}
try {
- var_dump(new IntlRuleBasedBreakIterator(1,2,3));
+ var_dump(new IntlRuleBasedBreakIterator(1,2,3));
} catch (TypeError $e) {
- print_exception($e);
+ print_exception($e);
}
try {
- var_dump(new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+;', array()));
+ var_dump(new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+;', array()));
} catch (TypeError $e) {
- print_exception($e);
+ print_exception($e);
}
try {
- var_dump(new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+;', true));
+ var_dump(new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+;', true));
} catch (IntlException $e) {
- print_exception($e);
+ print_exception($e);
}
--EXPECTF--
Exception: IntlRuleBasedBreakIterator::__construct(): rbbi_create_instance: unable to create RuleBasedBreakIterator from rules (parse error on line 1, offset 31) in %s on line %d
diff --git a/ext/intl/tests/breakiter_createCodePointInstance_basic.phpt b/ext/intl/tests/breakiter_createCodePointInstance_basic.phpt
index a43e82760c..bf07edf3be 100644
--- a/ext/intl/tests/breakiter_createCodePointInstance_basic.phpt
+++ b/ext/intl/tests/breakiter_createCodePointInstance_basic.phpt
@@ -18,7 +18,6 @@ $codepoint_it->setText($text);
print_r(iterator_to_array($codepoint_it));
?>
-==DONE==
--EXPECT--
string(26) "IntlCodePointBreakIterator"
Array
@@ -40,4 +39,3 @@ Array
[14] => 42
[15] => 45
)
-==DONE==
diff --git a/ext/intl/tests/breakiter_createCodePointInstance_error.phpt b/ext/intl/tests/breakiter_createCodePointInstance_error.phpt
deleted file mode 100644
index 13adc53b03..0000000000
--- a/ext/intl/tests/breakiter_createCodePointInstance_error.phpt
+++ /dev/null
@@ -1,16 +0,0 @@
---TEST--
-IntlBreakIterator::createCodePointInstance(): bad arguments
---SKIPIF--
-<?php
-if (!extension_loaded('intl'))
- die('skip intl extension not enabled');
---FILE--
-<?php
-ini_set("intl.error_level", E_WARNING);
-
-var_dump(IntlBreakIterator::createCodePointInstance(array()));
---EXPECTF--
-Warning: IntlBreakIterator::createCodePointInstance() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlBreakIterator::createCodePointInstance(): breakiter_create_code_point_instance: bad arguments in %s on line %d
-NULL
diff --git a/ext/intl/tests/breakiter_current_basic.phpt b/ext/intl/tests/breakiter_current_basic.phpt
index 1f3e679f47..6715d08f55 100644
--- a/ext/intl/tests/breakiter_current_basic.phpt
+++ b/ext/intl/tests/breakiter_current_basic.phpt
@@ -18,11 +18,9 @@ var_dump($bi->current());
var_dump($bi->next());
var_dump($bi->current());
?>
-==DONE==
--EXPECT--
int(0)
int(0)
int(0)
int(3)
int(3)
-==DONE==
diff --git a/ext/intl/tests/breakiter_factories_basic.phpt b/ext/intl/tests/breakiter_factories_basic.phpt
index 4d05792c0e..ac7b17505d 100644
--- a/ext/intl/tests/breakiter_factories_basic.phpt
+++ b/ext/intl/tests/breakiter_factories_basic.phpt
@@ -10,17 +10,17 @@ ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "ja");
$m = array('createWordInstance', 'createLineInstance', 'createCharacterInstance',
- 'createSentenceInstance', 'createTitleInstance');
+ 'createSentenceInstance', 'createTitleInstance');
$t = 'Frase 1... Frase 2';
foreach ($m as $method) {
- echo "===== $method =====\n";
- $o1 = IntlBreakIterator::$method('ja');
- $o2 = IntlBreakIterator::$method(NULL);
- $o3 = IntlBreakIterator::$method();
- var_dump($o1 == $o2 && $o2 == $o3);
- echo "\n";
+ echo "===== $method =====\n";
+ $o1 = IntlBreakIterator::$method('ja');
+ $o2 = IntlBreakIterator::$method(NULL);
+ $o3 = IntlBreakIterator::$method();
+ var_dump($o1 == $o2 && $o2 == $o3);
+ echo "\n";
}
--EXPECT--
===== createWordInstance =====
diff --git a/ext/intl/tests/breakiter_factories_error.phpt b/ext/intl/tests/breakiter_factories_error.phpt
deleted file mode 100644
index 4f3a912a15..0000000000
--- a/ext/intl/tests/breakiter_factories_error.phpt
+++ /dev/null
@@ -1,40 +0,0 @@
---TEST--
-IntlBreakIterator factory methods: argument errors
---SKIPIF--
-<?php
-if (!extension_loaded('intl'))
- die('skip intl extension not enabled');
---FILE--
-<?php
-ini_set("intl.error_level", E_WARNING);
-
-var_dump(IntlBreakIterator::createWordInstance(array()));
-var_dump(IntlBreakIterator::createSentenceInstance(NULL, 2));
-var_dump(IntlBreakIterator::createCharacterInstance(NULL, 2));
-var_dump(IntlBreakIterator::createTitleInstance(NULL, 2));
-var_dump(IntlBreakIterator::createLineInstance(NULL, 2));
---EXPECTF--
-Warning: IntlBreakIterator::createWordInstance() expects parameter 1 to be string, array given in %s on line %d
-
-Warning: IntlBreakIterator::createWordInstance(): breakiter_create_word_instance: bad arguments in %s on line %d
-NULL
-
-Warning: IntlBreakIterator::createSentenceInstance() expects at most 1 parameter, 2 given in %s on line %d
-
-Warning: IntlBreakIterator::createSentenceInstance(): breakiter_create_sentence_instance: bad arguments in %s on line %d
-NULL
-
-Warning: IntlBreakIterator::createCharacterInstance() expects at most 1 parameter, 2 given in %s on line %d
-
-Warning: IntlBreakIterator::createCharacterInstance(): breakiter_create_character_instance: bad arguments in %s on line %d
-NULL
-
-Warning: IntlBreakIterator::createTitleInstance() expects at most 1 parameter, 2 given in %s on line %d
-
-Warning: IntlBreakIterator::createTitleInstance(): breakiter_create_title_instance: bad arguments in %s on line %d
-NULL
-
-Warning: IntlBreakIterator::createLineInstance() expects at most 1 parameter, 2 given in %s on line %d
-
-Warning: IntlBreakIterator::createLineInstance(): breakiter_create_line_instance: bad arguments in %s on line %d
-NULL
diff --git a/ext/intl/tests/breakiter_first_last_previous_current_error.phpt b/ext/intl/tests/breakiter_first_last_previous_current_error.phpt
deleted file mode 100644
index da37ffea78..0000000000
--- a/ext/intl/tests/breakiter_first_last_previous_current_error.phpt
+++ /dev/null
@@ -1,37 +0,0 @@
---TEST--
-IntlBreakIterator::first()/last()/previous()/current(): arg errors
---SKIPIF--
-<?php
-if (!extension_loaded('intl'))
- die('skip intl extension not enabled');
---FILE--
-<?php
-ini_set("intl.error_level", E_WARNING);
-
-$bi = new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+;');
-$bi->setText("\x80sdfé\x90d888 dfsa9");
-
-var_dump($bi->first(1));
-var_dump($bi->last(1));
-var_dump($bi->previous(1));
-var_dump($bi->current(1));
---EXPECTF--
-Warning: IntlBreakIterator::first() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlBreakIterator::first(): breakiter_first: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlBreakIterator::last() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlBreakIterator::last(): breakiter_last: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlBreakIterator::previous() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlBreakIterator::previous(): breakiter_previous: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlBreakIterator::current() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlBreakIterator::current(): breakiter_current: bad arguments in %s on line %d
-bool(false)
diff --git a/ext/intl/tests/breakiter_following_basic.phpt b/ext/intl/tests/breakiter_following_basic.phpt
index c139a2c3b4..4b56f03c39 100644
--- a/ext/intl/tests/breakiter_following_basic.phpt
+++ b/ext/intl/tests/breakiter_following_basic.phpt
@@ -16,9 +16,7 @@ var_dump($bi->following(5));
var_dump($bi->following(50));
var_dump($bi->following(-1));
?>
-==DONE==
--EXPECT--
int(7)
int(-1)
int(0)
-==DONE==
diff --git a/ext/intl/tests/breakiter_following_preceding_isBoundary_error.phpt b/ext/intl/tests/breakiter_following_preceding_isBoundary_error.phpt
deleted file mode 100644
index 56ed60ffcf..0000000000
--- a/ext/intl/tests/breakiter_following_preceding_isBoundary_error.phpt
+++ /dev/null
@@ -1,49 +0,0 @@
---TEST--
-IntlBreakIterator::following()/preceding()/isBoundary(): arg errors
---SKIPIF--
-<?php
-if (!extension_loaded('intl'))
- die('skip intl extension not enabled');
---FILE--
-<?php
-ini_set("intl.error_level", E_WARNING);
-
-$bi = new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+;');
-$bi->setText("\x80sdfé\x90d888 dfsa9");
-
-var_dump($bi->following(1, 2));
-var_dump($bi->following(array()));
-var_dump($bi->preceding(1, 2));
-var_dump($bi->preceding(array()));
-var_dump($bi->isBoundary(1, 2));
-var_dump($bi->isBoundary(array()));
---EXPECTF--
-Warning: IntlBreakIterator::following() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlBreakIterator::following(): breakiter_following: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlBreakIterator::following() expects parameter 1 to be int, array given in %s on line %d
-
-Warning: IntlBreakIterator::following(): breakiter_following: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlBreakIterator::preceding() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlBreakIterator::preceding(): breakiter_preceding: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlBreakIterator::preceding() expects parameter 1 to be int, array given in %s on line %d
-
-Warning: IntlBreakIterator::preceding(): breakiter_preceding: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlBreakIterator::isBoundary() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlBreakIterator::isBoundary(): breakiter_is_boundary: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlBreakIterator::isBoundary() expects parameter 1 to be int, array given in %s on line %d
-
-Warning: IntlBreakIterator::isBoundary(): breakiter_is_boundary: bad arguments in %s on line %d
-bool(false)
diff --git a/ext/intl/tests/breakiter_getLocale_basic.phpt b/ext/intl/tests/breakiter_getLocale_basic.phpt
index 2f5f586f16..a661453ff2 100644
--- a/ext/intl/tests/breakiter_getLocale_basic.phpt
+++ b/ext/intl/tests/breakiter_getLocale_basic.phpt
@@ -13,8 +13,6 @@ $bi = IntlBreakIterator::createSentenceInstance('pt');
var_dump($bi->getLocale(0));
var_dump($bi->getLocale(1));
?>
-==DONE==
--EXPECT--
string(4) "root"
string(4) "root"
-==DONE==
diff --git a/ext/intl/tests/breakiter_getLocale_basic2.phpt b/ext/intl/tests/breakiter_getLocale_basic2.phpt
index 55c2af3ef1..ea09abe9c0 100644
--- a/ext/intl/tests/breakiter_getLocale_basic2.phpt
+++ b/ext/intl/tests/breakiter_getLocale_basic2.phpt
@@ -14,8 +14,6 @@ $bi = IntlBreakIterator::createSentenceInstance('pt');
var_dump($bi->getLocale(0));
var_dump($bi->getLocale(1));
?>
-==DONE==
--EXPECT--
string(4) "root"
string(2) "pt"
-==DONE==
diff --git a/ext/intl/tests/breakiter_getLocale_basic3.phpt b/ext/intl/tests/breakiter_getLocale_basic3.phpt
index c4b02a9f26..c49bbc39cb 100644
--- a/ext/intl/tests/breakiter_getLocale_basic3.phpt
+++ b/ext/intl/tests/breakiter_getLocale_basic3.phpt
@@ -13,8 +13,6 @@ $bi = IntlBreakIterator::createSentenceInstance('pt');
var_dump($bi->getLocale(0));
var_dump($bi->getLocale(1));
?>
-==DONE==
--EXPECT--
string(0) ""
string(2) "pt"
-==DONE==
diff --git a/ext/intl/tests/breakiter_getLocale_error.phpt b/ext/intl/tests/breakiter_getLocale_error.phpt
deleted file mode 100644
index f318743948..0000000000
--- a/ext/intl/tests/breakiter_getLocale_error.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-IntlBreakIterator::getLocale(): arg errors
---SKIPIF--
-<?php
-if (!extension_loaded('intl'))
- die('skip intl extension not enabled');
---FILE--
-<?php
-ini_set("intl.error_level", E_WARNING);
-
-$bi = new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+;');
-$bi->setText("\x80sdfé\x90d888 dfsa9");
-
-var_dump($bi->getLocale(1, 2));
-var_dump($bi->getLocale(array()));
-var_dump($bi->getLocale());
---EXPECTF--
-Warning: IntlBreakIterator::getLocale() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlBreakIterator::getLocale(): breakiter_get_locale: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlBreakIterator::getLocale() expects parameter 1 to be int, array given in %s on line %d
-
-Warning: IntlBreakIterator::getLocale(): breakiter_get_locale: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlBreakIterator::getLocale() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlBreakIterator::getLocale(): breakiter_get_locale: bad arguments in %s on line %d
-bool(false)
diff --git a/ext/intl/tests/breakiter_getPartsIterator_basic.phpt b/ext/intl/tests/breakiter_getPartsIterator_basic.phpt
index bbd6a7e07b..c3210906c7 100644
--- a/ext/intl/tests/breakiter_getPartsIterator_basic.phpt
+++ b/ext/intl/tests/breakiter_getPartsIterator_basic.phpt
@@ -22,7 +22,6 @@ var_dump(get_class($pi->getBreakIterator()));
print_r(iterator_to_array($pi));
var_dump($pi->getRuleStatus());
?>
-==DONE==
--EXPECT--
string(17) "IntlPartsIterator"
Array
@@ -36,4 +35,3 @@ Array
[2] => bar
)
int(0)
-==DONE==
diff --git a/ext/intl/tests/breakiter_getPartsIterator_basic2.phpt b/ext/intl/tests/breakiter_getPartsIterator_basic2.phpt
index 2f96fa9aed..834da13ece 100644
--- a/ext/intl/tests/breakiter_getPartsIterator_basic2.phpt
+++ b/ext/intl/tests/breakiter_getPartsIterator_basic2.phpt
@@ -22,7 +22,6 @@ var_dump(get_class($pi->getBreakIterator()));
print_r(iterator_to_array($pi));
var_dump($pi->getRuleStatus());
?>
-==DONE==
--EXPECTF--
string(17) "IntlPartsIterator"
Array
@@ -36,4 +35,3 @@ Array
[2] => bar
)
int(%d)
-==DONE==
diff --git a/ext/intl/tests/breakiter_getPartsIterator_error.phpt b/ext/intl/tests/breakiter_getPartsIterator_error.phpt
index b756540578..b2931a000d 100644
--- a/ext/intl/tests/breakiter_getPartsIterator_error.phpt
+++ b/ext/intl/tests/breakiter_getPartsIterator_error.phpt
@@ -10,23 +10,9 @@ ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "pt_PT");
$it = IntlBreakIterator::createWordInstance(NULL);
-var_dump($it->getPartsIterator(array()));
-var_dump($it->getPartsIterator(1, 2));
var_dump($it->getPartsIterator(-1));
?>
-==DONE==
--EXPECTF--
-Warning: IntlBreakIterator::getPartsIterator() expects parameter 1 to be int, array given in %s on line %d
-
-Warning: IntlBreakIterator::getPartsIterator(): breakiter_get_parts_iterator: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlBreakIterator::getPartsIterator() expects at most 1 parameter, 2 given in %s on line %d
-
-Warning: IntlBreakIterator::getPartsIterator(): breakiter_get_parts_iterator: bad arguments in %s on line %d
-bool(false)
-
Warning: IntlBreakIterator::getPartsIterator(): breakiter_get_parts_iterator: bad key type in %s on line %d
bool(false)
-==DONE==
diff --git a/ext/intl/tests/breakiter_getPartsIterator_var1.phpt b/ext/intl/tests/breakiter_getPartsIterator_var1.phpt
index 7bbd27ea45..3ad2c73a99 100644
--- a/ext/intl/tests/breakiter_getPartsIterator_var1.phpt
+++ b/ext/intl/tests/breakiter_getPartsIterator_var1.phpt
@@ -19,7 +19,6 @@ var_dump(iterator_to_array($it->getPartsIterator(IntlPartsIterator::KEY_LEFT)));
var_dump(iterator_to_array($it->getPartsIterator(IntlPartsIterator::KEY_RIGHT)));
?>
-==DONE==
--EXPECT--
array(5) {
[0]=>
@@ -57,4 +56,3 @@ array(5) {
[12]=>
string(3) "tao"
}
-==DONE==
diff --git a/ext/intl/tests/breakiter_getText_error.phpt b/ext/intl/tests/breakiter_getText_error.phpt
deleted file mode 100644
index d66b4bb69f..0000000000
--- a/ext/intl/tests/breakiter_getText_error.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-IntlBreakIterator::getText(): arg errors
---SKIPIF--
-<?php
-if (!extension_loaded('intl'))
- die('skip intl extension not enabled');
---FILE--
-<?php
-ini_set("intl.error_level", E_WARNING);
-
-$bi = new IntlRuleBasedBreakIterator('[\p{Letter}]+;');
-var_dump($bi->getText(array()));
---EXPECTF--
-Warning: IntlBreakIterator::getText() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlBreakIterator::getText(): breakiter_get_text: bad arguments in %s on line %d
-bool(false)
diff --git a/ext/intl/tests/breakiter_isBoundary_basic.phpt b/ext/intl/tests/breakiter_isBoundary_basic.phpt
index f0920dca8c..598d1f9d01 100644
--- a/ext/intl/tests/breakiter_isBoundary_basic.phpt
+++ b/ext/intl/tests/breakiter_isBoundary_basic.phpt
@@ -18,11 +18,9 @@ var_dump($bi->isBoundary(-1));
var_dump($bi->isBoundary(1));
var_dump($bi->isBoundary(50));
?>
-==DONE==
--EXPECT--
bool(true)
bool(true)
bool(false)
bool(false)
bool(false)
-==DONE==
diff --git a/ext/intl/tests/breakiter_next_basic.phpt b/ext/intl/tests/breakiter_next_basic.phpt
index 4deb4144e3..fa40eed4bd 100644
--- a/ext/intl/tests/breakiter_next_basic.phpt
+++ b/ext/intl/tests/breakiter_next_basic.phpt
@@ -19,7 +19,6 @@ var_dump($bi->next(-1));
var_dump($bi->next(0));
var_dump($bi->next(NULL));
?>
-==DONE==
--EXPECT--
int(0)
int(3)
@@ -27,4 +26,3 @@ int(7)
int(4)
int(4)
int(7)
-==DONE==
diff --git a/ext/intl/tests/breakiter_next_error.phpt b/ext/intl/tests/breakiter_next_error.phpt
deleted file mode 100644
index eb4664308c..0000000000
--- a/ext/intl/tests/breakiter_next_error.phpt
+++ /dev/null
@@ -1,25 +0,0 @@
---TEST--
-IntlBreakIterator::next(): arg errors
---SKIPIF--
-<?php
-if (!extension_loaded('intl'))
- die('skip intl extension not enabled');
---FILE--
-<?php
-ini_set("intl.error_level", E_WARNING);
-
-$bi = new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+;');
-$bi->setText("\x80sdfé\x90d888 dfsa9");
-
-var_dump($bi->next(1, 2));
-var_dump($bi->next(array()));
---EXPECTF--
-Warning: IntlBreakIterator::next() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlBreakIterator::next(): breakiter_next: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlBreakIterator::next() expects parameter 1 to be int, array given in %s on line %d
-
-Warning: IntlBreakIterator::next(): breakiter_next: bad arguments in %s on line %d
-bool(false)
diff --git a/ext/intl/tests/breakiter_preceding_basic.phpt b/ext/intl/tests/breakiter_preceding_basic.phpt
index 9cba9b0831..31feb5efb2 100644
--- a/ext/intl/tests/breakiter_preceding_basic.phpt
+++ b/ext/intl/tests/breakiter_preceding_basic.phpt
@@ -18,9 +18,7 @@ var_dump($bi->preceding(5));
var_dump($bi->preceding(50));
var_dump($bi->preceding(-1));
?>
-==DONE==
--EXPECT--
int(4)
int(21)
int(0)
-==DONE==
diff --git a/ext/intl/tests/breakiter_preceding_basic2.phpt b/ext/intl/tests/breakiter_preceding_basic2.phpt
index e6f4f70387..8c1ee625e4 100644
--- a/ext/intl/tests/breakiter_preceding_basic2.phpt
+++ b/ext/intl/tests/breakiter_preceding_basic2.phpt
@@ -17,9 +17,7 @@ var_dump($bi->preceding(5));
var_dump($bi->preceding(50));
var_dump($bi->preceding(-1));
?>
-==DONE==
--EXPECTF--
int(4)
int(21)
int(%i)
-==DONE==
diff --git a/ext/intl/tests/breakiter_previous_basic.phpt b/ext/intl/tests/breakiter_previous_basic.phpt
index c844ffcb6c..b30399365a 100644
--- a/ext/intl/tests/breakiter_previous_basic.phpt
+++ b/ext/intl/tests/breakiter_previous_basic.phpt
@@ -15,8 +15,6 @@ $bi->setText('foo bar trans');
var_dump($bi->last());
var_dump($bi->previous());
?>
-==DONE==
--EXPECT--
int(13)
int(8)
-==DONE==
diff --git a/ext/intl/tests/breakiter_setText_error.phpt b/ext/intl/tests/breakiter_setText_error.phpt
deleted file mode 100644
index c94a8433f1..0000000000
--- a/ext/intl/tests/breakiter_setText_error.phpt
+++ /dev/null
@@ -1,42 +0,0 @@
---TEST--
-IntlBreakIterator::setText(): arg errors
---SKIPIF--
-<?php
-if (!extension_loaded('intl'))
- die('skip intl extension not enabled');
---FILE--
-<?php
-ini_set("intl.error_level", E_WARNING);
-
-$bi = new IntlRuleBasedBreakIterator('[\p{Letter}]+;');
-var_dump($bi->setText());
-var_dump($bi->setText(array()));
-var_dump($bi->setText(1,2));
-
-class A {
-function __destruct() { var_dump('destructed'); throw new Exception('e'); }
-function __tostring() { return 'foo'; }
-}
-
-try {
-var_dump($bi->setText(new A));
-} catch (Exception $e) {
-var_dump($e->getMessage());
-}
---EXPECTF--
-Warning: IntlBreakIterator::setText() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlBreakIterator::setText(): breakiter_set_text: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlBreakIterator::setText() expects parameter 1 to be string, array given in %s on line %d
-
-Warning: IntlBreakIterator::setText(): breakiter_set_text: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlBreakIterator::setText() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlBreakIterator::setText(): breakiter_set_text: bad arguments in %s on line %d
-bool(false)
-string(10) "destructed"
-string(1) "e"
diff --git a/ext/intl/tests/bug12887.phpt b/ext/intl/tests/bug12887.phpt
index e2fc194944..36d8e2f320 100644
--- a/ext/intl/tests/bug12887.phpt
+++ b/ext/intl/tests/bug12887.phpt
@@ -7,13 +7,13 @@ locale_get_keywords() bug #12887
function ut_main()
{
- $res_str = '';
- $keywords_arr = ut_loc_get_keywords( 'de_DE@currency=EUR;collation=PHONEBOOK;sort=PHONEBOOK' );
- if ($keywords_arr) {
- foreach( $keywords_arr as $key => $value){
- $res_str .= "$key = $value\n";
- }
- }
+ $res_str = '';
+ $keywords_arr = ut_loc_get_keywords( 'de_DE@currency=EUR;collation=PHONEBOOK;sort=PHONEBOOK' );
+ if ($keywords_arr) {
+ foreach( $keywords_arr as $key => $value){
+ $res_str .= "$key = $value\n";
+ }
+ }
$res_str .= "\n";
return $res_str;
diff --git a/ext/intl/tests/bug14562.phpt b/ext/intl/tests/bug14562.phpt
index 7cf927f7e7..ec9a046b75 100644
--- a/ext/intl/tests/bug14562.phpt
+++ b/ext/intl/tests/bug14562.phpt
@@ -7,17 +7,17 @@ Bug #14562 NumberFormatter breaks when locale changes
function ut_main()
{
- $res_str = "";
- $de_locale="de_DE.UTF-8";
- $fmt = new NumberFormatter("de", NumberFormatter::DECIMAL );
- $numeric = $fmt->parse("1234,56");
- $res_str .= "$numeric\n";
- setlocale(LC_ALL, $de_locale);
- $fmt = new NumberFormatter("de", NumberFormatter::DECIMAL );
- $numeric = $fmt->parse("1234,56");
- setlocale(LC_ALL, "C"); // reset for printing
- $res_str .= "$numeric\n";
- return $res_str;
+ $res_str = "";
+ $de_locale="de_DE.UTF-8";
+ $fmt = new NumberFormatter("de", NumberFormatter::DECIMAL );
+ $numeric = $fmt->parse("1234,56");
+ $res_str .= "$numeric\n";
+ setlocale(LC_ALL, $de_locale);
+ $fmt = new NumberFormatter("de", NumberFormatter::DECIMAL );
+ $numeric = $fmt->parse("1234,56");
+ setlocale(LC_ALL, "C"); // reset for printing
+ $res_str .= "$numeric\n";
+ return $res_str;
}
include_once( 'ut_common.inc' );
diff --git a/ext/intl/tests/bug53512.phpt b/ext/intl/tests/bug53512.phpt
index 872e5987be..af2dda8f69 100644
--- a/ext/intl/tests/bug53512.phpt
+++ b/ext/intl/tests/bug53512.phpt
@@ -10,9 +10,9 @@ if (PHP_INT_SIZE != 8) die('skip 64-bit only');
$badvals = array(4294901761, 2147483648, -2147483648, -1);
foreach ($badvals as $val) {
- $x = numfmt_create("en", NumberFormatter::PATTERN_DECIMAL);
- var_dump(numfmt_set_symbol($x, $val, ""));
- var_dump(intl_get_error_message());
+ $x = numfmt_create("en", NumberFormatter::PATTERN_DECIMAL);
+ var_dump(numfmt_set_symbol($x, $val, ""));
+ var_dump(intl_get_error_message());
}
?>
diff --git a/ext/intl/tests/bug53735.phpt b/ext/intl/tests/bug53735.phpt
index 5fc14e978c..1deebb2276 100644
--- a/ext/intl/tests/bug53735.phpt
+++ b/ext/intl/tests/bug53735.phpt
@@ -22,11 +22,9 @@ $f = new NumberFormatter('hu_HU', NumberFormatter::PERCENT, '#,##0%');
var_dump($f->format(0.26));
?>
-==DONE==
--EXPECTF--
string(%d) "5,50 kr%A"
string(%d) "5,50 kr%A"
string(%d) "5,00 kr%A"
string(5) "23,25"
string(3) "26%"
-==DONE==
diff --git a/ext/intl/tests/bug58756_MessageFormatter.phpt b/ext/intl/tests/bug58756_MessageFormatter.phpt
index 18566b666c..01673b8c48 100644
--- a/ext/intl/tests/bug58756_MessageFormatter.phpt
+++ b/ext/intl/tests/bug58756_MessageFormatter.phpt
@@ -26,12 +26,10 @@ echo "msgf: " . $msgf->format(array($time)) . "\n";
'{1, select, date {{0,date,full}} other {{0,time,h:m:s a V}}}');
echo "msgf2: ", $msgf->format(array($time, 'date')), " ",
- $msgf->format(array($time, 'time')), "\n";
+ $msgf->format(array($time, 'time')), "\n";
*/
?>
-==DONE==
--EXPECT--
date: Tuesday, July 7, 2009 8:41:13 PM EDT
msgf: Tuesday, July 7, 2009 8:41:13 PM EDT
-==DONE==
diff --git a/ext/intl/tests/bug58756_MessageFormatter_variant2.phpt b/ext/intl/tests/bug58756_MessageFormatter_variant2.phpt
index 4fcfdbc08c..790033c95b 100644
--- a/ext/intl/tests/bug58756_MessageFormatter_variant2.phpt
+++ b/ext/intl/tests/bug58756_MessageFormatter_variant2.phpt
@@ -26,12 +26,10 @@ echo "msgf: " . $msgf->format(array($time)) . "\n";
'{1, select, date {{0,date,full}} other {{0,time,h:m:s a V}}}');
echo "msgf2: ", $msgf->format(array($time, 'date')), " ",
- $msgf->format(array($time, 'time')), "\n";
+ $msgf->format(array($time, 'time')), "\n";
*/
?>
-==DONE==
--EXPECT--
date: Tuesday, July 7, 2009 8:41:13 PM EDT
msgf: Tuesday, July 7, 2009 8:41:13 PM usnyc
-==DONE==
diff --git a/ext/intl/tests/bug60192-compare.phpt b/ext/intl/tests/bug60192-compare.phpt
index 096b57558f..bd5faa11ed 100644
--- a/ext/intl/tests/bug60192-compare.phpt
+++ b/ext/intl/tests/bug60192-compare.phpt
@@ -7,9 +7,9 @@ Bug #60192 (SegFault when Collator not constructed properly)
--FILE--
<?php
class Collator2 extends Collator{
- public function __construct() {
- // omitting parent::__construct($someLocale);
- }
+ public function __construct() {
+ // omitting parent::__construct($someLocale);
+ }
}
$c = new Collator2();
diff --git a/ext/intl/tests/bug60192-getlocale.phpt b/ext/intl/tests/bug60192-getlocale.phpt
index ef5ce3fc04..526632192e 100644
--- a/ext/intl/tests/bug60192-getlocale.phpt
+++ b/ext/intl/tests/bug60192-getlocale.phpt
@@ -8,9 +8,9 @@ Bug #60192 (SegFault when Collator not constructed properly)
<?php
class Collator2 extends Collator{
- public function __construct() {
- // omitting parent::__construct($someLocale);
- }
+ public function __construct() {
+ // omitting parent::__construct($someLocale);
+ }
}
$c = new Collator2();
diff --git a/ext/intl/tests/bug60192-getsortkey.phpt b/ext/intl/tests/bug60192-getsortkey.phpt
index 21cc279eee..96df981cf5 100644
--- a/ext/intl/tests/bug60192-getsortkey.phpt
+++ b/ext/intl/tests/bug60192-getsortkey.phpt
@@ -8,9 +8,9 @@ Bug #60192 (SegFault when Collator not constructed properly)
<?php
class Collator2 extends Collator{
- public function __construct() {
- // omitting parent::__construct($someLocale);
- }
+ public function __construct() {
+ // omitting parent::__construct($someLocale);
+ }
}
$c = new Collator2();
diff --git a/ext/intl/tests/bug60192-sort.phpt b/ext/intl/tests/bug60192-sort.phpt
index 530d5eecba..27899fdd4f 100644
--- a/ext/intl/tests/bug60192-sort.phpt
+++ b/ext/intl/tests/bug60192-sort.phpt
@@ -8,9 +8,9 @@ Bug #60192 (SegFault when Collator not constructed properly)
<?php
class Collator2 extends Collator{
- public function __construct() {
- // omitting parent::__construct($someLocale);
- }
+ public function __construct() {
+ // omitting parent::__construct($someLocale);
+ }
}
$c = new Collator2();
diff --git a/ext/intl/tests/bug60192-sortwithsortkeys.phpt b/ext/intl/tests/bug60192-sortwithsortkeys.phpt
index 9ee58123c8..7f22c003c3 100644
--- a/ext/intl/tests/bug60192-sortwithsortkeys.phpt
+++ b/ext/intl/tests/bug60192-sortwithsortkeys.phpt
@@ -8,9 +8,9 @@ Bug #60192 (SegFault when Collator not constructed properly)
<?php
class Collator2 extends Collator{
- public function __construct() {
- // omitting parent::__construct($someLocale);
- }
+ public function __construct() {
+ // omitting parent::__construct($someLocale);
+ }
}
$c = new Collator2();
diff --git a/ext/intl/tests/bug62017.phpt b/ext/intl/tests/bug62017.phpt
index 2f3c816f99..f2fa15a81d 100644
--- a/ext/intl/tests/bug62017.phpt
+++ b/ext/intl/tests/bug62017.phpt
@@ -8,14 +8,14 @@ if (!extension_loaded('intl'))
<?php
ini_set('intl.error_level', E_WARNING);
var_dump(
- datefmt_create('', IntlDateFormatter::NONE, IntlDateFormatter::NONE, "\xFF",
- IntlDateFormatter::GREGORIAN, 'a'));
+ datefmt_create('', IntlDateFormatter::NONE, IntlDateFormatter::NONE, "\xFF",
+ IntlDateFormatter::GREGORIAN, 'a'));
try {
- var_dump(
- new IntlDateFormatter('', IntlDateFormatter::NONE, IntlDateFormatter::NONE, "Europe/Lisbon",
- IntlDateFormatter::GREGORIAN, "\x80"));
+ var_dump(
+ new IntlDateFormatter('', IntlDateFormatter::NONE, IntlDateFormatter::NONE, "Europe/Lisbon",
+ IntlDateFormatter::GREGORIAN, "\x80"));
} catch (IntlException $e) {
- echo PHP_EOL."Exception: " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine() . PHP_EOL;
+ echo PHP_EOL."Exception: " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine() . PHP_EOL;
}
--EXPECTF--
Warning: datefmt_create(): datefmt_create: Time zone identifier given is not a valid UTF-8 string in %s on line %d
diff --git a/ext/intl/tests/bug62915-2.phpt b/ext/intl/tests/bug62915-2.phpt
index 8dc3bd1512..a10b476ab4 100644
--- a/ext/intl/tests/bug62915-2.phpt
+++ b/ext/intl/tests/bug62915-2.phpt
@@ -9,24 +9,24 @@ if (!class_exists('Spoofchecker'))
--FILE--
<?php
class A extends IntlDateFormatter {
- static $ARGS = array("en_US" ,IntlDateFormatter::FULL, IntlDateFormatter::FULL,
- 'America/Los_Angeles', IntlDateFormatter::GREGORIAN);
+ static $ARGS = array("en_US" ,IntlDateFormatter::FULL, IntlDateFormatter::FULL,
+ 'America/Los_Angeles', IntlDateFormatter::GREGORIAN);
}
class B extends NumberFormatter {
- static $ARGS = array('de_DE', NumberFormatter::DECIMAL);
+ static $ARGS = array('de_DE', NumberFormatter::DECIMAL);
}
class C extends MessageFormatter {
- static $ARGS = array("en_US", "foo");
+ static $ARGS = array("en_US", "foo");
}
class D extends Spoofchecker {
- static $ARGS = array();
+ static $ARGS = array();
}
foreach (range('A', 'D') as $subclass) {
- $rc = new ReflectionClass($subclass);
- $obj = $rc->newInstanceArgs($subclass::$ARGS);
- $clone = clone $obj;
- var_dump(get_class($clone));
+ $rc = new ReflectionClass($subclass);
+ $obj = $rc->newInstanceArgs($subclass::$ARGS);
+ $clone = clone $obj;
+ var_dump(get_class($clone));
}
--EXPECT--
string(1) "A"
diff --git a/ext/intl/tests/bug62915.phpt b/ext/intl/tests/bug62915.phpt
index 2277cde9d5..45d2dea5e9 100644
--- a/ext/intl/tests/bug62915.phpt
+++ b/ext/intl/tests/bug62915.phpt
@@ -8,17 +8,17 @@ if (!extension_loaded('intl'))
<?php
class foo extends IntlTimeZone {
- public $foo = 'test';
+ public $foo = 'test';
- public function __construct() { }
+ public function __construct() { }
}
$x = new foo;
try {
- $z = clone $x;
+ $z = clone $x;
} catch (Exception $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
--EXPECT--
string(39) "Cannot clone unconstructed IntlTimeZone"
diff --git a/ext/intl/tests/bug65732.phpt b/ext/intl/tests/bug65732.phpt
index b49f884ee4..4bbdb0f4c1 100644
--- a/ext/intl/tests/bug65732.phpt
+++ b/ext/intl/tests/bug65732.phpt
@@ -10,10 +10,8 @@ var_dump(grapheme_strlen("\r\n"));
var_dump(grapheme_substr(implode("\r\n", ['abc', 'def', 'ghi']), 5));
var_dump(grapheme_strrpos("a\r\nb", 'b'));
?>
-==DONE==
--EXPECT--
int(1)
string(7) "ef
ghi"
int(2)
-==DONE==
diff --git a/ext/intl/tests/bug69374.phpt b/ext/intl/tests/bug69374.phpt
index ee7c49547e..612bf936df 100644
--- a/ext/intl/tests/bug69374.phpt
+++ b/ext/intl/tests/bug69374.phpt
@@ -14,8 +14,6 @@ $date->setTime($millitimestamp);
echo IntlDateFormatter::formatObject($date, $pattern1, 'vi_VN'), "\n";
echo IntlDateFormatter::formatObject ($date, $pattern2, 'ko_KR'), "\n";
?>
-==DONE==
--EXPECT--
tháng 04, 2015
2015ë…„ 4ì›”
-==DONE==
diff --git a/ext/intl/tests/bug69398.phpt b/ext/intl/tests/bug69398.phpt
index 3c95eeeaac..dc7dec94aa 100644
--- a/ext/intl/tests/bug69398.phpt
+++ b/ext/intl/tests/bug69398.phpt
@@ -12,8 +12,6 @@ $date->setTime($millitimestamp);
echo IntlDateFormatter::formatObject($date, array(IntlDateFormatter::SHORT, IntlDateFormatter::NONE), 'vi_VN'), "\n";
echo IntlDateFormatter::formatObject ($date, array(IntlDateFormatter::SHORT, IntlDateFormatter::NONE), 'ko_KR'), "\n";
?>
-==DONE==
--EXPECT--
04/04/2015
15. 4. 4.
-==DONE==
diff --git a/ext/intl/tests/bug71020.phpt b/ext/intl/tests/bug71020.phpt
index 9f9b8eede3..582275967f 100644
--- a/ext/intl/tests/bug71020.phpt
+++ b/ext/intl/tests/bug71020.phpt
@@ -7,7 +7,7 @@ Bug #71020 (Use after free in Collator::sortWithSortKeys)
$var_3=new Collator("Whatever");
for($x=0;$x<0xbb;$x++)
- $myarray[substr(md5(microtime()),rand(0,26),9) . strval($x)]= substr(md5(microtime()),rand(0,26),9) . strval($x);
+ $myarray[substr(md5(microtime()),rand(0,26),9) . strval($x)]= substr(md5(microtime()),rand(0,26),9) . strval($x);
$var_3->sortWithSortKeys($myarray);
?>
okey
diff --git a/ext/intl/tests/bug72533.phpt b/ext/intl/tests/bug72533.phpt
index 1faf08c287..bf48c83c70 100644
--- a/ext/intl/tests/bug72533.phpt
+++ b/ext/intl/tests/bug72533.phpt
@@ -9,15 +9,15 @@ function ut_main()
{
$ret = var_export(ut_loc_accept_http(str_repeat('x', 256)), true);
$ret .= "\n";
- if(intl_is_failure(intl_get_error_code())) {
- $ret .= var_export(intl_get_error_message(), true);
- }
+ if(intl_is_failure(intl_get_error_code())) {
+ $ret .= var_export(intl_get_error_message(), true);
+ }
$ret .= "\n";
$ret .= var_export(ut_loc_accept_http(str_repeat('en,', 256)), true);
$ret .= "\n";
- if(intl_is_failure(intl_get_error_code())) {
- $ret .= var_export(intl_get_error_message(), true);
- }
+ if(intl_is_failure(intl_get_error_code())) {
+ $ret .= var_export(intl_get_error_message(), true);
+ }
return $ret;
}
diff --git a/ext/intl/tests/bug72639.phpt b/ext/intl/tests/bug72639.phpt
index 2c94dcc06f..ca9b219715 100644
--- a/ext/intl/tests/bug72639.phpt
+++ b/ext/intl/tests/bug72639.phpt
@@ -6,7 +6,7 @@ Bug #72639 (Segfault when instantiating class that extends IntlCalendar and adds
<?php
class A extends IntlCalendar {
public function __construct() {}
- private $a;
+ private $a;
}
var_dump(new A());
?>
diff --git a/ext/intl/tests/bug74063.phpt b/ext/intl/tests/bug74063.phpt
new file mode 100644
index 0000000000..126c4cc523
--- /dev/null
+++ b/ext/intl/tests/bug74063.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Bug #74063 (NumberFormatter fails after retrieval from session)
+--SKIPIF--
+<?php
+if (!extension_loaded('intl')) die('skip intl extension not available');
+?>
+--FILE--
+<?php
+$formatter = new NumberFormatter("en_GB", NumberFormatter::CURRENCY);
+try {
+ serialize($formatter);
+} catch (Exception $ex) {
+ echo $ex->getMessage(), PHP_EOL;
+}
+?>
+--EXPECT--
+Serialization of 'NumberFormatter' is not allowed
diff --git a/ext/intl/tests/bug74433.phpt b/ext/intl/tests/bug74433.phpt
index 7919c87540..44f7807b24 100644
--- a/ext/intl/tests/bug74433.phpt
+++ b/ext/intl/tests/bug74433.phpt
@@ -11,10 +11,8 @@ $rm = new ReflectionMethod(Normalizer::class, 'normalize');
var_dump($rm->getNumberOfParameters());
var_dump($rm->getNumberOfRequiredParameters());
?>
-===DONE===
--EXPECT--
int(2)
int(1)
int(2)
int(1)
-===DONE===
diff --git a/ext/intl/tests/bug74468.phpt b/ext/intl/tests/bug74468.phpt
index 63d469efb4..62814d28a7 100644
--- a/ext/intl/tests/bug74468.phpt
+++ b/ext/intl/tests/bug74468.phpt
@@ -13,10 +13,8 @@ $rf = new ReflectionFunction('collator_sort_with_sort_keys');
var_dump($rf->getNumberOfParameters());
var_dump($rf->getNumberOfRequiredParameters());
?>
-===DONE===
--EXPECT--
int(1)
int(1)
int(2)
int(2)
-===DONE===
diff --git a/ext/intl/tests/bug74484_MessageFormatter.phpt b/ext/intl/tests/bug74484_MessageFormatter.phpt
index b48de33525..da2fe6acda 100644
--- a/ext/intl/tests/bug74484_MessageFormatter.phpt
+++ b/ext/intl/tests/bug74484_MessageFormatter.phpt
@@ -27,7 +27,5 @@ $vars = array(
var_dump(MessageFormatter::formatMessage('en_US', $text, $vars));
?>
-==DONE==
--EXPECT--
string(26) "1 2 3 4 5 6 7 8 9 10 11 12"
-==DONE==
diff --git a/ext/intl/tests/bug74705.phpt b/ext/intl/tests/bug74705.phpt
index 63a85845a0..c911ee3e0d 100644
--- a/ext/intl/tests/bug74705.phpt
+++ b/ext/intl/tests/bug74705.phpt
@@ -12,10 +12,8 @@ $rf = new ReflectionFunction('collator_get_sort_key');
var_dump($rf->getNumberOfParameters());
var_dump($rf->getNumberOfRequiredParameters());
?>
-===DONE===
--EXPECT--
int(1)
int(1)
int(2)
int(2)
-===DONE===
diff --git a/ext/intl/tests/bug75090.phpt b/ext/intl/tests/bug75090.phpt
index ff5e0bd584..5936e34bc8 100644
--- a/ext/intl/tests/bug75090.phpt
+++ b/ext/intl/tests/bug75090.phpt
@@ -15,8 +15,6 @@ var_dump(
count($intlGregorianCalendarRef->getConstants()) === count($intlCalendarRef->getConstants())
);
?>
-===DONE===
--EXPECT--
bool(true)
bool(true)
-===DONE===
diff --git a/ext/intl/tests/bug75193.phpt b/ext/intl/tests/bug75193.phpt
index d6c32dbe26..731d83908b 100644
--- a/ext/intl/tests/bug75193.phpt
+++ b/ext/intl/tests/bug75193.phpt
@@ -8,7 +8,5 @@ $a = new \Collator('en_US');
$b = [new stdclass, new stdclass];
var_dump($a->sort($b));
?>
-===DONE===
--EXPECT--
bool(true)
-===DONE===
diff --git a/ext/intl/tests/bug75318.phpt b/ext/intl/tests/bug75318.phpt
index 1328851f9e..aa46cd2d40 100644
--- a/ext/intl/tests/bug75318.phpt
+++ b/ext/intl/tests/bug75318.phpt
@@ -9,7 +9,5 @@ if (!extension_loaded('intl')) die('skip intl extension is not available');
$rm = new ReflectionMethod('UConverter', 'getAliases');
var_dump($rm->getNumberOfRequiredParameters());
?>
-===DONE===
--EXPECT--
int(1)
-===DONE===
diff --git a/ext/intl/tests/bug76556.phpt b/ext/intl/tests/bug76556.phpt
index 9e4e1ed973..962467701e 100644
--- a/ext/intl/tests/bug76556.phpt
+++ b/ext/intl/tests/bug76556.phpt
@@ -10,7 +10,6 @@ $it = IntlBreakIterator::createCharacterInstance();
$it->setText('foo');
var_dump($it);
?>
-===DONE===
--EXPECTF--
object(IntlRuleBasedBreakIterator)#%d (3) {
["valid"]=>
@@ -20,4 +19,3 @@ object(IntlRuleBasedBreakIterator)#%d (3) {
["type"]=>
string(%d) "%SRuleBasedBreakIterator%S"
}
-===DONE===
diff --git a/ext/intl/tests/calendar_add_basic.phpt b/ext/intl/tests/calendar_add_basic.phpt
index b0e44d5895..3e8ed55579 100644
--- a/ext/intl/tests/calendar_add_basic.phpt
+++ b/ext/intl/tests/calendar_add_basic.phpt
@@ -22,12 +22,10 @@ $intlcal->add(IntlCalendar::FIELD_MINUTE, 6);
intlcal_add($intlcal, IntlCalendar::FIELD_SECOND, 7);
var_dump(
- (float)$time2*1000,
- $intlcal->getTime());
+ (float)$time2*1000,
+ $intlcal->getTime());
?>
-==DONE==
--EXPECT--
float(1330578367000)
-float(1330578367000)
-==DONE== \ No newline at end of file
+float(1330578367000) \ No newline at end of file
diff --git a/ext/intl/tests/calendar_add_error.phpt b/ext/intl/tests/calendar_add_error.phpt
index 017551821d..f0fd43558e 100644
--- a/ext/intl/tests/calendar_add_error.phpt
+++ b/ext/intl/tests/calendar_add_error.phpt
@@ -10,34 +10,9 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-
-var_dump($c->add(1, 2, 3));
-var_dump($c->add(-1, 2));
-var_dump($c->add(1));
-
-var_dump(intlcal_add($c, 1, 2, 3));
var_dump(intlcal_add(1, 2, 3));
--EXPECTF--
-Warning: IntlCalendar::add() expects exactly 2 parameters, 3 given in %s on line %d
-
-Warning: IntlCalendar::add(): intlcal_add: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::add(): intlcal_add: invalid field in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::add() expects exactly 2 parameters, 1 given in %s on line %d
-
-Warning: IntlCalendar::add(): intlcal_add: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlcal_add() expects exactly 3 parameters, 4 given in %s on line %d
-
-Warning: intlcal_add(): intlcal_add: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_add() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_add() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_add(1, 2, 3)
#1 {main}
diff --git a/ext/intl/tests/calendar_before_after_error.phpt b/ext/intl/tests/calendar_before_after_error.phpt
index 279e3d816e..66fb62f224 100644
--- a/ext/intl/tests/calendar_before_after_error.phpt
+++ b/ext/intl/tests/calendar_before_after_error.phpt
@@ -18,68 +18,61 @@ echo "error: $errno, $errstr\n";
set_error_handler('eh');
try {
- var_dump($c->after());
+ var_dump($c->after());
} catch (Error $ex) {
- echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
+ echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
- var_dump($c->before());
+ var_dump($c->before());
} catch (Error $ex) {
- echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
+ echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
- var_dump($c->after(1));
+ var_dump($c->after(1));
} catch (Error $ex) {
- echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
+ echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
- var_dump($c->before(1));
+ var_dump($c->before(1));
} catch (Error $ex) {
- echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
+ echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try{
- var_dump($c->after($c, 1));
+ var_dump($c->after($c, 1));
} catch (Error $ex) {
- echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
+ echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
- var_dump($c->before($c, 1));
+ var_dump($c->before($c, 1));
} catch (Error $ex) {
- echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
+ echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
- var_dump(intlcal_after($c));
+ var_dump(intlcal_after($c));
} catch (Error $ex) {
- echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
+ echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
- var_dump(intlcal_before($c));
+ var_dump(intlcal_before($c));
} catch (Error $ex) {
- echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
+ echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
--EXPECT--
-error: 2, IntlCalendar::after() expects exactly 1 parameter, 0 given
-error: 2, IntlCalendar::after(): intlcal_before/after: bad arguments
-bool(false)
-error: 2, IntlCalendar::before() expects exactly 1 parameter, 0 given
-error: 2, IntlCalendar::before(): intlcal_before/after: bad arguments
-bool(false)
-error: 0, Argument 1 passed to IntlCalendar::after() must be an instance of IntlCalendar, int given
+error: 0, IntlCalendar::after() expects exactly 1 parameter, 0 given
-error: 0, Argument 1 passed to IntlCalendar::before() must be an instance of IntlCalendar, int given
+error: 0, IntlCalendar::before() expects exactly 1 parameter, 0 given
-error: 2, IntlCalendar::after() expects exactly 1 parameter, 2 given
-error: 2, IntlCalendar::after(): intlcal_before/after: bad arguments
-bool(false)
-error: 2, IntlCalendar::before() expects exactly 1 parameter, 2 given
-error: 2, IntlCalendar::before(): intlcal_before/after: bad arguments
-bool(false)
-error: 2, intlcal_after() expects exactly 2 parameters, 1 given
-error: 2, intlcal_after(): intlcal_before/after: bad arguments
-bool(false)
-error: 2, intlcal_before() expects exactly 2 parameters, 1 given
-error: 2, intlcal_before(): intlcal_before/after: bad arguments
-bool(false)
+error: 0, IntlCalendar::after() expects parameter 1 to be IntlCalendar, int given
+
+error: 0, IntlCalendar::before() expects parameter 1 to be IntlCalendar, int given
+
+error: 0, IntlCalendar::after() expects exactly 1 parameter, 2 given
+
+error: 0, IntlCalendar::before() expects exactly 1 parameter, 2 given
+
+error: 0, intlcal_after() expects exactly 2 parameters, 1 given
+
+error: 0, intlcal_before() expects exactly 2 parameters, 1 given
diff --git a/ext/intl/tests/calendar_clear_basic.phpt b/ext/intl/tests/calendar_clear_basic.phpt
index f7e4371d92..1c4b40f424 100644
--- a/ext/intl/tests/calendar_clear_basic.phpt
+++ b/ext/intl/tests/calendar_clear_basic.phpt
@@ -12,13 +12,13 @@ ini_set("intl.default_locale", "nl");
$intlcal = IntlCalendar::createInstance('UTC');
var_dump($intlcal->clear());
var_dump(
- $intlcal->get(IntlCalendar::FIELD_YEAR),
- $intlcal->get(IntlCalendar::FIELD_MONTH),
- $intlcal->get(IntlCalendar::FIELD_DAY_OF_MONTH),
- $intlcal->get(IntlCalendar::FIELD_HOUR),
- $intlcal->get(IntlCalendar::FIELD_MINUTE),
- $intlcal->get(IntlCalendar::FIELD_SECOND),
- $intlcal->get(IntlCalendar::FIELD_MILLISECOND)
+ $intlcal->get(IntlCalendar::FIELD_YEAR),
+ $intlcal->get(IntlCalendar::FIELD_MONTH),
+ $intlcal->get(IntlCalendar::FIELD_DAY_OF_MONTH),
+ $intlcal->get(IntlCalendar::FIELD_HOUR),
+ $intlcal->get(IntlCalendar::FIELD_MINUTE),
+ $intlcal->get(IntlCalendar::FIELD_SECOND),
+ $intlcal->get(IntlCalendar::FIELD_MILLISECOND)
);
$intlcal2 = IntlCalendar::createInstance('Europe/Amsterdam');
@@ -26,7 +26,6 @@ intlcal_clear($intlcal2, null);
var_dump($intlcal2->getTime());
?>
-==DONE==
--EXPECT--
bool(true)
int(1970)
@@ -36,5 +35,4 @@ int(0)
int(0)
int(0)
int(0)
-float(-3600000)
-==DONE== \ No newline at end of file
+float(-3600000) \ No newline at end of file
diff --git a/ext/intl/tests/calendar_clear_error.phpt b/ext/intl/tests/calendar_clear_error.phpt
index bffa103eac..7fec27399e 100644
--- a/ext/intl/tests/calendar_clear_error.phpt
+++ b/ext/intl/tests/calendar_clear_error.phpt
@@ -12,24 +12,18 @@ ini_set("intl.error_level", E_WARNING);
$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-var_dump($c->clear(1, 2));
var_dump($c->clear(-1));
var_dump(intlcal_clear($c, -1));
var_dump(intlcal_clear(1, 2));
--EXPECTF--
-Warning: IntlCalendar::clear() expects at most 1 parameter, 2 given in %s on line %d
-
-Warning: IntlCalendar::clear(): intlcal_clear: bad arguments in %s on line %d
-bool(false)
-
Warning: IntlCalendar::clear(): intlcal_clear: invalid field in %s on line %d
bool(false)
Warning: intlcal_clear(): intlcal_clear: invalid field in %s on line %d
bool(false)
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_clear() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_clear() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_clear(1, 2)
#1 {main}
diff --git a/ext/intl/tests/calendar_clear_variation1.phpt b/ext/intl/tests/calendar_clear_variation1.phpt
index 6adbcaa353..6bc97b6c71 100644
--- a/ext/intl/tests/calendar_clear_variation1.phpt
+++ b/ext/intl/tests/calendar_clear_variation1.phpt
@@ -19,15 +19,13 @@ var_dump($intlcal->clear(IntlCalendar::FIELD_MONTH));
var_dump($intlcal->isSet(IntlCalendar::FIELD_MONTH));
//print_R($intlcal);
var_dump(
- $intlcal->getTime(),
- strtotime('2012-01-29 05:06:07 +0000') * 1000.
+ $intlcal->getTime(),
+ strtotime('2012-01-29 05:06:07 +0000') * 1000.
);
?>
-==DONE==
--EXPECT--
bool(true)
bool(true)
bool(false)
float(1327813567000)
-float(1327813567000)
-==DONE== \ No newline at end of file
+float(1327813567000) \ No newline at end of file
diff --git a/ext/intl/tests/calendar_createInstance_basic.phpt b/ext/intl/tests/calendar_createInstance_basic.phpt
index 00a68e620b..1dcb8f892f 100644
--- a/ext/intl/tests/calendar_createInstance_basic.phpt
+++ b/ext/intl/tests/calendar_createInstance_basic.phpt
@@ -24,7 +24,6 @@ $time = time();
var_dump(abs($timeMillis - $time * 1000) < 2000);
?>
-==DONE==
--EXPECTF--
IntlTimeZone Object
(
@@ -36,4 +35,3 @@ IntlTimeZone Object
nl
gregorian
bool(true)
-==DONE==
diff --git a/ext/intl/tests/calendar_createInstance_error.phpt b/ext/intl/tests/calendar_createInstance_error.phpt
index 5cb9fa1c63..516cc9260e 100644
--- a/ext/intl/tests/calendar_createInstance_error.phpt
+++ b/ext/intl/tests/calendar_createInstance_error.phpt
@@ -12,25 +12,7 @@ class X extends IntlTimeZone {
function __construct() {}
}
-var_dump(IntlCalendar::createInstance(1, 2, 3));
-var_dump(intlcal_create_instance(1, 2, 3));
var_dump(intlcal_create_instance(new X, NULL));
-var_dump(intlcal_create_instance(NULL, array()));
--EXPECTF--
-Warning: IntlCalendar::createInstance() expects at most 2 parameters, 3 given in %s on line %d
-
-Warning: IntlCalendar::createInstance(): intlcal_create_calendar: bad arguments in %s on line %d
-NULL
-
-Warning: intlcal_create_instance() expects at most 2 parameters, 3 given in %s on line %d
-
-Warning: intlcal_create_instance(): intlcal_create_calendar: bad arguments in %s on line %d
-NULL
-
Warning: intlcal_create_instance(): intlcal_create_instance: passed IntlTimeZone is not properly constructed in %s on line %d
NULL
-
-Warning: intlcal_create_instance() expects parameter 2 to be string, array given in %s on line %d
-
-Warning: intlcal_create_instance(): intlcal_create_calendar: bad arguments in %s on line %d
-NULL
diff --git a/ext/intl/tests/calendar_createInstance_variation1.phpt b/ext/intl/tests/calendar_createInstance_variation1.phpt
index 74ec910587..3bd0084c78 100644
--- a/ext/intl/tests/calendar_createInstance_variation1.phpt
+++ b/ext/intl/tests/calendar_createInstance_variation1.phpt
@@ -37,7 +37,6 @@ print_R($cal->getLocale(Locale::ACTUAL_LOCALE));
echo "\n";
?>
-==DONE==
--EXPECTF--
IntlTimeZone Object
(
@@ -79,4 +78,3 @@ IntlTimeZone Object
[currentOffset] => %d
)
pt
-==DONE==
diff --git a/ext/intl/tests/calendar_equals_before_after_basic.phpt b/ext/intl/tests/calendar_equals_before_after_basic.phpt
index 50543ad0b4..49604a47d6 100644
--- a/ext/intl/tests/calendar_equals_before_after_basic.phpt
+++ b/ext/intl/tests/calendar_equals_before_after_basic.phpt
@@ -33,7 +33,6 @@ var_dump("3 before 2", intlcal_before($intlcal3, $intlcal2));
var_dump("3 after 2", intlcal_after($intlcal3, $intlcal2));
?>
-==DONE==
--EXPECT--
string(8) "japanese"
string(6) "1 eq 1"
@@ -55,5 +54,4 @@ bool(false)
string(10) "3 before 2"
bool(false)
string(9) "3 after 2"
-bool(true)
-==DONE== \ No newline at end of file
+bool(true) \ No newline at end of file
diff --git a/ext/intl/tests/calendar_equals_error.phpt b/ext/intl/tests/calendar_equals_error.phpt
index 4c585a6018..04896458b2 100644
--- a/ext/intl/tests/calendar_equals_error.phpt
+++ b/ext/intl/tests/calendar_equals_error.phpt
@@ -18,40 +18,39 @@ echo "error: $errno, $errstr\n";
set_error_handler('eh');
try {
- var_dump($c->equals());
+ var_dump($c->equals());
} catch (Error $ex) {
- echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
+ echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
- var_dump($c->equals(new stdclass));
+ var_dump($c->equals(new stdclass));
} catch (Error $ex) {
- echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
+ echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
- var_dump($c->equals(1, 2));
+ var_dump($c->equals(1, 2));
} catch (Error $ex) {
- echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
+ echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
- var_dump(intlcal_equals($c, array()));
+ var_dump(intlcal_equals($c, array()));
} catch (Error $ex) {
- echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
+ echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
- var_dump(intlcal_equals(1, $c));
+ var_dump(intlcal_equals(1, $c));
} catch (Error $ex) {
- echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
+ echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
--EXPECT--
-error: 2, IntlCalendar::equals() expects exactly 1 parameter, 0 given
-error: 2, IntlCalendar::equals(): intlcal_equals: bad arguments
-bool(false)
-error: 0, Argument 1 passed to IntlCalendar::equals() must be an instance of IntlCalendar, instance of stdClass given
+error: 0, IntlCalendar::equals() expects exactly 1 parameter, 0 given
-error: 0, Argument 1 passed to IntlCalendar::equals() must be an instance of IntlCalendar, int given
+error: 0, IntlCalendar::equals() expects parameter 1 to be IntlCalendar, object given
-error: 0, Argument 2 passed to intlcal_equals() must be an instance of IntlCalendar, array given
+error: 0, IntlCalendar::equals() expects exactly 1 parameter, 2 given
-error: 0, Argument 1 passed to intlcal_equals() must be an instance of IntlCalendar, int given
+error: 0, intlcal_equals() expects parameter 2 to be IntlCalendar, array given
+
+error: 0, intlcal_equals() expects parameter 1 to be IntlCalendar, int given
diff --git a/ext/intl/tests/calendar_fieldDifference_basic.phpt b/ext/intl/tests/calendar_fieldDifference_basic.phpt
index 0287e259c1..918f279fb1 100644
--- a/ext/intl/tests/calendar_fieldDifference_basic.phpt
+++ b/ext/intl/tests/calendar_fieldDifference_basic.phpt
@@ -14,22 +14,20 @@ ini_set("intl.default_locale", "nl");
$intlcal = IntlCalendar::createInstance('UTC');
$intlcal->setTime(strtotime('2012-02-29 05:06:07 +0000') * 1000);
var_dump(
- $intlcal->fieldDifference(
- strtotime('2012-02-29 06:06:08 +0000') * 1000,
- IntlCalendar::FIELD_SECOND),
- $intlcal->get(IntlCalendar::FIELD_HOUR_OF_DAY));
+ $intlcal->fieldDifference(
+ strtotime('2012-02-29 06:06:08 +0000') * 1000,
+ IntlCalendar::FIELD_SECOND),
+ $intlcal->get(IntlCalendar::FIELD_HOUR_OF_DAY));
$intlcal->setTime(strtotime('2012-02-29 05:06:07 +0000') * 1000);
var_dump(
- intlcal_field_difference(
- $intlcal,
- strtotime('2012-02-29 06:07:08 +0000') * 1000,
- IntlCalendar::FIELD_MINUTE));
+ intlcal_field_difference(
+ $intlcal,
+ strtotime('2012-02-29 06:07:08 +0000') * 1000,
+ IntlCalendar::FIELD_MINUTE));
?>
-==DONE==
--EXPECT--
int(3601)
int(6)
-int(61)
-==DONE== \ No newline at end of file
+int(61) \ No newline at end of file
diff --git a/ext/intl/tests/calendar_fieldDifference_error.phpt b/ext/intl/tests/calendar_fieldDifference_error.phpt
index 4f3fc351cb..1957dbbc2d 100644
--- a/ext/intl/tests/calendar_fieldDifference_error.phpt
+++ b/ext/intl/tests/calendar_fieldDifference_error.phpt
@@ -12,32 +12,27 @@ ini_set("intl.error_level", E_WARNING);
$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-var_dump($c->fieldDifference($c, 2, 3));
+try {
+ var_dump($c->fieldDifference($c, 2, 3));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump($c->fieldDifference(INF, 2));
-var_dump($c->fieldDifference(1));
-var_dump(intlcal_field_difference($c, 0, 1, 2));
+try {
+ var_dump(intlcal_field_difference($c, 0, 1, 2));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump(intlcal_field_difference(1, 0, 1));
--EXPECTF--
-Warning: IntlCalendar::fieldDifference() expects exactly 2 parameters, 3 given in %s on line %d
-
-Warning: IntlCalendar::fieldDifference(): intlcal_field_difference: bad arguments in %s on line %d
-bool(false)
+IntlCalendar::fieldDifference() expects exactly 2 parameters, 3 given
Warning: IntlCalendar::fieldDifference(): intlcal_field_difference: Call to ICU method has failed in %s on line %d
bool(false)
+intlcal_field_difference() expects exactly 3 parameters, 4 given
-Warning: IntlCalendar::fieldDifference() expects exactly 2 parameters, 1 given in %s on line %d
-
-Warning: IntlCalendar::fieldDifference(): intlcal_field_difference: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlcal_field_difference() expects exactly 3 parameters, 4 given in %s on line %d
-
-Warning: intlcal_field_difference(): intlcal_field_difference: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_field_difference() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_field_difference() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_field_difference(1, 0, 1)
#1 {main}
diff --git a/ext/intl/tests/calendar_fromDateTime_basic.phpt b/ext/intl/tests/calendar_fromDateTime_basic.phpt
index 0c7e471454..dcbd4e1c61 100644
--- a/ext/intl/tests/calendar_fromDateTime_basic.phpt
+++ b/ext/intl/tests/calendar_fromDateTime_basic.phpt
@@ -12,28 +12,28 @@ date_default_timezone_set('Europe/Lisbon');
$cal = IntlCalendar::fromDateTime('2012-01-01 00:00:00 Europe/Rome');
var_dump(
- $cal->getTime(),
- strtotime('2012-01-01 00:00:00 Europe/Rome') * 1000.,
- $cal->getTimeZone()->getID(),
- $cal->getLocale(1)
+ $cal->getTime(),
+ strtotime('2012-01-01 00:00:00 Europe/Rome') * 1000.,
+ $cal->getTimeZone()->getID(),
+ $cal->getLocale(1)
);
echo "\n";
$cal = IntlCalendar::fromDateTime(new DateTime('2012-01-01 00:00:00 PST'), "pt_PT");
var_dump(
- $cal->getTime(),
- strtotime('2012-01-01 00:00:00 PST') * 1000.,
- $cal->getTimeZone()->getID(),
- $cal->getLocale(1)
+ $cal->getTime(),
+ strtotime('2012-01-01 00:00:00 PST') * 1000.,
+ $cal->getTimeZone()->getID(),
+ $cal->getLocale(1)
);
echo "\n";
$cal = intlcal_from_date_time(new DateTime('2012-01-01 00:00:00 +03:40'));
var_dump(
- $cal->getTime(),
- strtotime('2012-01-01 00:00:00 +03:40') * 1000.,
- $cal->getTimeZone()->getID()
+ $cal->getTime(),
+ strtotime('2012-01-01 00:00:00 +03:40') * 1000.,
+ $cal->getTimeZone()->getID()
);
--EXPECTF--
float(1325372400000)
diff --git a/ext/intl/tests/calendar_fromDateTime_error.phpt b/ext/intl/tests/calendar_fromDateTime_error.phpt
index 1074159687..6fbaeb57f8 100644
--- a/ext/intl/tests/calendar_fromDateTime_error.phpt
+++ b/ext/intl/tests/calendar_fromDateTime_error.phpt
@@ -10,13 +10,10 @@ ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "nl");
date_default_timezone_set('Europe/Lisbon');
-var_dump(IntlCalendar::fromDateTime());
-var_dump(IntlCalendar::fromDateTime(0,1,2));
-
try {
-IntlCalendar::fromDateTime("foobar");
+ IntlCalendar::fromDateTime("foobar");
} catch (Exception $e) {
- echo "threw exception, OK";
+ echo "threw exception, OK";
}
class A extends DateTime {
function __construct() {}
@@ -29,18 +26,7 @@ var_dump(IntlCalendar::fromDateTime($date));
$date = new DateTime('2012-01-01 00:00:00 WEST');
var_dump(IntlCalendar::fromDateTime($date));
-
-var_dump(intlcal_from_date_time());
--EXPECTF--
-Warning: IntlCalendar::fromDateTime() expects at least 1 parameter, 0 given in %s on line %d
-
-Warning: IntlCalendar::fromDateTime(): intlcal_from_date_time: bad arguments in %s on line %d
-NULL
-
-Warning: IntlCalendar::fromDateTime() expects at most 2 parameters, 3 given in %s on line %d
-
-Warning: IntlCalendar::fromDateTime(): intlcal_from_date_time: bad arguments in %s on line %d
-NULL
threw exception, OK
Warning: IntlCalendar::fromDateTime(): intlcal_from_date_time: DateTime object is unconstructed in %s on line %d
NULL
@@ -50,8 +36,3 @@ NULL
Warning: IntlCalendar::fromDateTime(): intlcal_from_date_time: time zone id 'WEST' extracted from ext/date DateTimeZone not recognized in %s on line %d
NULL
-
-Warning: intlcal_from_date_time() expects at least 1 parameter, 0 given in %s on line %d
-
-Warning: intlcal_from_date_time(): intlcal_from_date_time: bad arguments in %s on line %d
-NULL
diff --git a/ext/intl/tests/calendar_getAvailableLocales_basic.phpt b/ext/intl/tests/calendar_getAvailableLocales_basic.phpt
index 5d5b79c020..a5071545e2 100644
--- a/ext/intl/tests/calendar_getAvailableLocales_basic.phpt
+++ b/ext/intl/tests/calendar_getAvailableLocales_basic.phpt
@@ -16,8 +16,6 @@ $locales = intlcal_get_available_locales();
var_dump(in_array('pt', $locales));
?>
-==DONE==
--EXPECT--
bool(true)
-bool(true)
-==DONE== \ No newline at end of file
+bool(true) \ No newline at end of file
diff --git a/ext/intl/tests/calendar_getAvailableLocales_error.phpt b/ext/intl/tests/calendar_getAvailableLocales_error.phpt
deleted file mode 100644
index 3aee500fea..0000000000
--- a/ext/intl/tests/calendar_getAvailableLocales_error.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-IntlCalendar::getAvailableLocales(): bad arguments
---SKIPIF--
-<?php
-if (!extension_loaded('intl'))
- die('skip intl extension not enabled');
---FILE--
-<?php
-ini_set("intl.error_level", E_WARNING);
-
-var_dump(intlcal_get_available_locales(1));
-var_dump(IntlCalendar::getAvailableLocales(2));
---EXPECTF--
-Warning: intlcal_get_available_locales() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: intlcal_get_available_locales(): intlcal_get_available_locales: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::getAvailableLocales() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlCalendar::getAvailableLocales(): intlcal_get_available_locales: bad arguments in %s on line %d
-bool(false)
diff --git a/ext/intl/tests/calendar_getDayOfWeekType_basic.phpt b/ext/intl/tests/calendar_getDayOfWeekType_basic.phpt
index 527c0ff140..c525dca988 100644
--- a/ext/intl/tests/calendar_getDayOfWeekType_basic.phpt
+++ b/ext/intl/tests/calendar_getDayOfWeekType_basic.phpt
@@ -16,19 +16,17 @@ ini_set("intl.default_locale", "nl");
$intlcal = IntlCalendar::createInstance('UTC');
$intlcal->setTime(strtotime('2012-02-29 00:00:00 +0000') * 1000);
var_dump(
- intlcal_get_day_of_week_type($intlcal, IntlCalendar::DOW_SUNDAY),
- $intlcal->getDayOfWeekType(IntlCalendar::DOW_MONDAY),
- $intlcal->getDayOfWeekType(IntlCalendar::DOW_TUESDAY),
- $intlcal->getDayOfWeekType(IntlCalendar::DOW_FRIDAY),
- $intlcal->getDayOfWeekType(IntlCalendar::DOW_SATURDAY)
+ intlcal_get_day_of_week_type($intlcal, IntlCalendar::DOW_SUNDAY),
+ $intlcal->getDayOfWeekType(IntlCalendar::DOW_MONDAY),
+ $intlcal->getDayOfWeekType(IntlCalendar::DOW_TUESDAY),
+ $intlcal->getDayOfWeekType(IntlCalendar::DOW_FRIDAY),
+ $intlcal->getDayOfWeekType(IntlCalendar::DOW_SATURDAY)
);
?>
-==DONE==
--EXPECT--
int(3)
int(0)
int(0)
int(0)
int(1)
-==DONE==
diff --git a/ext/intl/tests/calendar_getDayOfWeekType_basic2.phpt b/ext/intl/tests/calendar_getDayOfWeekType_basic2.phpt
index 9bf9967080..982eaf4251 100644
--- a/ext/intl/tests/calendar_getDayOfWeekType_basic2.phpt
+++ b/ext/intl/tests/calendar_getDayOfWeekType_basic2.phpt
@@ -16,19 +16,17 @@ ini_set("intl.default_locale", "nl");
$intlcal = IntlCalendar::createInstance('UTC');
$intlcal->setTime(strtotime('2012-02-29 00:00:00 +0000') * 1000);
var_dump(
- intlcal_get_day_of_week_type($intlcal, IntlCalendar::DOW_SUNDAY),
- $intlcal->getDayOfWeekType(IntlCalendar::DOW_MONDAY),
- $intlcal->getDayOfWeekType(IntlCalendar::DOW_TUESDAY),
- $intlcal->getDayOfWeekType(IntlCalendar::DOW_FRIDAY),
- $intlcal->getDayOfWeekType(IntlCalendar::DOW_SATURDAY)
+ intlcal_get_day_of_week_type($intlcal, IntlCalendar::DOW_SUNDAY),
+ $intlcal->getDayOfWeekType(IntlCalendar::DOW_MONDAY),
+ $intlcal->getDayOfWeekType(IntlCalendar::DOW_TUESDAY),
+ $intlcal->getDayOfWeekType(IntlCalendar::DOW_FRIDAY),
+ $intlcal->getDayOfWeekType(IntlCalendar::DOW_SATURDAY)
);
?>
-==DONE==
--EXPECT--
int(1)
int(0)
int(0)
int(0)
int(1)
-==DONE==
diff --git a/ext/intl/tests/calendar_getDayOfWeekType_error.phpt b/ext/intl/tests/calendar_getDayOfWeekType_error.phpt
index 46fe17d9cd..c138be8196 100644
--- a/ext/intl/tests/calendar_getDayOfWeekType_error.phpt
+++ b/ext/intl/tests/calendar_getDayOfWeekType_error.phpt
@@ -12,32 +12,14 @@ ini_set("intl.error_level", E_WARNING);
$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-var_dump($c->getDayOfWeekType(1, 2));
var_dump($c->getDayOfWeekType(0));
-var_dump($c->getDayOfWeekType());
-var_dump(intlcal_get_day_of_week_type($c, "foo"));
var_dump(intlcal_get_day_of_week_type(1, 1));
--EXPECTF--
-Warning: IntlCalendar::getDayOfWeekType() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlCalendar::getDayOfWeekType(): intlcal_get_day_of_week_type: bad arguments in %s on line %d
-bool(false)
-
Warning: IntlCalendar::getDayOfWeekType(): intlcal_get_day_of_week_type: invalid day of week in %s on line %d
bool(false)
-Warning: IntlCalendar::getDayOfWeekType() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlCalendar::getDayOfWeekType(): intlcal_get_day_of_week_type: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlcal_get_day_of_week_type() expects parameter 2 to be int, string given in %s on line %d
-
-Warning: intlcal_get_day_of_week_type(): intlcal_get_day_of_week_type: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_get_day_of_week_type() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_get_day_of_week_type() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_get_day_of_week_type(1, 1)
#1 {main}
diff --git a/ext/intl/tests/calendar_getErrorCode_error.phpt b/ext/intl/tests/calendar_getErrorCode_error.phpt
index fd999fbbbf..9dafc0ed94 100644
--- a/ext/intl/tests/calendar_getErrorCode_error.phpt
+++ b/ext/intl/tests/calendar_getErrorCode_error.phpt
@@ -10,18 +10,9 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-
-var_dump($c->getErrorCode(array()));
-
var_dump(intlcal_get_error_code(null));
--EXPECTF--
-Warning: IntlCalendar::getErrorCode() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlCalendar::getErrorCode(): intlcal_get_error_code: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_get_error_code() must be an instance of IntlCalendar, null given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_get_error_code() expects parameter 1 to be IntlCalendar, null given in %s:%d
Stack trace:
#0 %s(%d): intlcal_get_error_code(NULL)
#1 {main}
diff --git a/ext/intl/tests/calendar_getErrorCode_getErrorMessage_basic.phpt b/ext/intl/tests/calendar_getErrorCode_getErrorMessage_basic.phpt
index 71c053492f..2bd97330ed 100644
--- a/ext/intl/tests/calendar_getErrorCode_getErrorMessage_basic.phpt
+++ b/ext/intl/tests/calendar_getErrorCode_getErrorMessage_basic.phpt
@@ -13,22 +13,21 @@ ini_set("intl.default_locale", "nl");
$intlcal = new IntlGregorianCalendar(2012, 1, 29);
var_dump(
- $intlcal->getErrorCode(),
- intlcal_get_error_code($intlcal),
- $intlcal->getErrorMessage(),
- intlcal_get_error_message($intlcal)
+ $intlcal->getErrorCode(),
+ intlcal_get_error_code($intlcal),
+ $intlcal->getErrorMessage(),
+ intlcal_get_error_message($intlcal)
);
$intlcal->add(IntlCalendar::FIELD_SECOND, 2147483647);
$intlcal->fieldDifference(-PHP_INT_MAX, IntlCalendar::FIELD_SECOND);
var_dump(
- $intlcal->getErrorCode(),
- intlcal_get_error_code($intlcal),
- $intlcal->getErrorMessage(),
- intlcal_get_error_message($intlcal)
+ $intlcal->getErrorCode(),
+ intlcal_get_error_code($intlcal),
+ $intlcal->getErrorMessage(),
+ intlcal_get_error_message($intlcal)
);
?>
-==DONE==
--EXPECTF--
int(0)
int(0)
@@ -40,4 +39,3 @@ int(1)
int(1)
string(81) "intlcal_field_difference: Call to ICU method has failed: U_ILLEGAL_ARGUMENT_ERROR"
string(81) "intlcal_field_difference: Call to ICU method has failed: U_ILLEGAL_ARGUMENT_ERROR"
-==DONE==
diff --git a/ext/intl/tests/calendar_getErrorMessage_error.phpt b/ext/intl/tests/calendar_getErrorMessage_error.phpt
index cc52449d94..abdfef45b6 100644
--- a/ext/intl/tests/calendar_getErrorMessage_error.phpt
+++ b/ext/intl/tests/calendar_getErrorMessage_error.phpt
@@ -10,18 +10,9 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-
-var_dump($c->getErrorMessage(array()));
-
var_dump(intlcal_get_error_message(null));
--EXPECTF--
-Warning: IntlCalendar::getErrorMessage() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlCalendar::getErrorMessage(): intlcal_get_error_message: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_get_error_message() must be an instance of IntlCalendar, null given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_get_error_message() expects parameter 1 to be IntlCalendar, null given in %s:%d
Stack trace:
#0 %s(%d): intlcal_get_error_message(NULL)
#1 {main}
diff --git a/ext/intl/tests/calendar_getFirstDayOfWeek_basic.phpt b/ext/intl/tests/calendar_getFirstDayOfWeek_basic.phpt
index 82a0bc85cc..3858b8a937 100644
--- a/ext/intl/tests/calendar_getFirstDayOfWeek_basic.phpt
+++ b/ext/intl/tests/calendar_getFirstDayOfWeek_basic.phpt
@@ -13,8 +13,6 @@ $intlcal = IntlCalendar::createInstance('UTC');
var_dump($intlcal->getFirstDayOfWeek());
var_dump(intlcal_get_first_day_of_week($intlcal));
?>
-==DONE==
--EXPECT--
int(2)
-int(2)
-==DONE== \ No newline at end of file
+int(2) \ No newline at end of file
diff --git a/ext/intl/tests/calendar_getFirstDayOfWeek_error.phpt b/ext/intl/tests/calendar_getFirstDayOfWeek_error.phpt
index ca2dc4a9f2..f91e81dd69 100644
--- a/ext/intl/tests/calendar_getFirstDayOfWeek_error.phpt
+++ b/ext/intl/tests/calendar_getFirstDayOfWeek_error.phpt
@@ -10,24 +10,9 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-
-var_dump($c->getFirstDayOfWeek(1));
-
-var_dump(intlcal_get_first_day_of_week($c, 1));
var_dump(intlcal_get_first_day_of_week(1));
--EXPECTF--
-Warning: IntlCalendar::getFirstDayOfWeek() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlCalendar::getFirstDayOfWeek(): intlcal_get_first_day_of_week: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlcal_get_first_day_of_week() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: intlcal_get_first_day_of_week(): intlcal_get_first_day_of_week: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_get_first_day_of_week() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_get_first_day_of_week() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_get_first_day_of_week(1)
#1 {main}
diff --git a/ext/intl/tests/calendar_getKeywordValuesForLocale_basic.phpt b/ext/intl/tests/calendar_getKeywordValuesForLocale_basic.phpt
index e44185b433..fbfe8515b9 100644
--- a/ext/intl/tests/calendar_getKeywordValuesForLocale_basic.phpt
+++ b/ext/intl/tests/calendar_getKeywordValuesForLocale_basic.phpt
@@ -22,7 +22,6 @@ var_dump(count($var) > 8);
var_dump(in_array('japanese', $var));
?>
-==DONE==
--EXPECT--
Array
(
@@ -31,4 +30,3 @@ Array
bool(true)
bool(true)
-==DONE==
diff --git a/ext/intl/tests/calendar_getKeywordValuesForLocale_error.phpt b/ext/intl/tests/calendar_getKeywordValuesForLocale_error.phpt
deleted file mode 100644
index 717c435be7..0000000000
--- a/ext/intl/tests/calendar_getKeywordValuesForLocale_error.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-IntlCalendar::getKeywordValuesForLocale(): bad arguments
---SKIPIF--
-<?php
-if (!extension_loaded('intl'))
- die('skip intl extension not enabled');
---FILE--
-<?php
-ini_set("intl.error_level", E_WARNING);
-
-var_dump(intlcal_get_keyword_values_for_locale(1, 2));
-var_dump(IntlCalendar::getKeywordValuesForLocale(1, 2, array()));
---EXPECTF--
-Warning: intlcal_get_keyword_values_for_locale() expects exactly 3 parameters, 2 given in %s on line %d
-
-Warning: intlcal_get_keyword_values_for_locale(): intlcal_get_keyword_values_for_locale: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::getKeywordValuesForLocale() expects parameter 3 to be bool, array given in %s on line %d
-
-Warning: IntlCalendar::getKeywordValuesForLocale(): intlcal_get_keyword_values_for_locale: bad arguments in %s on line %d
-bool(false)
diff --git a/ext/intl/tests/calendar_getLocale_basic.phpt b/ext/intl/tests/calendar_getLocale_basic.phpt
index 1692c2d20b..92b61d35d5 100644
--- a/ext/intl/tests/calendar_getLocale_basic.phpt
+++ b/ext/intl/tests/calendar_getLocale_basic.phpt
@@ -13,8 +13,6 @@ $intlcal = IntlCalendar::createInstance('UTC');
var_dump($intlcal->getLocale(Locale::ACTUAL_LOCALE));
var_dump(intlcal_get_locale($intlcal, Locale::VALID_LOCALE));
?>
-==DONE==
--EXPECT--
string(2) "nl"
string(5) "nl_NL"
-==DONE==
diff --git a/ext/intl/tests/calendar_getLocale_error.phpt b/ext/intl/tests/calendar_getLocale_error.phpt
index 008e1b756e..90102a53f6 100644
--- a/ext/intl/tests/calendar_getLocale_error.phpt
+++ b/ext/intl/tests/calendar_getLocale_error.phpt
@@ -10,34 +10,9 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-
-var_dump($c->getLocale());
-var_dump($c->getLocale(2));
-var_dump($c->getLocale(2, 3));
-
-var_dump(intlcal_get_locale($c));
var_dump(intlcal_get_locale(1));
--EXPECTF--
-Warning: IntlCalendar::getLocale() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlCalendar::getLocale(): intlcal_get_locale: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::getLocale(): intlcal_get_locale: invalid locale type in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::getLocale() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlCalendar::getLocale(): intlcal_get_locale: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlcal_get_locale() expects exactly 2 parameters, 1 given in %s on line %d
-
-Warning: intlcal_get_locale(): intlcal_get_locale: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_get_locale() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught ArgumentCountError: intlcal_get_locale() expects exactly 2 parameters, 1 given in %s:%d
Stack trace:
#0 %s(%d): intlcal_get_locale(1)
#1 {main}
diff --git a/ext/intl/tests/calendar_getMinimalDaysInFirstWeek_basic.phpt b/ext/intl/tests/calendar_getMinimalDaysInFirstWeek_basic.phpt
index 6082830a8b..2206c6e0be 100644
--- a/ext/intl/tests/calendar_getMinimalDaysInFirstWeek_basic.phpt
+++ b/ext/intl/tests/calendar_getMinimalDaysInFirstWeek_basic.phpt
@@ -13,8 +13,6 @@ $intlcal = IntlCalendar::createInstance('UTC');
var_dump($intlcal->getMinimalDaysInFirstWeek());
var_dump(intlcal_get_minimal_days_in_first_week($intlcal));
?>
-==DONE==
--EXPECT--
int(4)
int(4)
-==DONE==
diff --git a/ext/intl/tests/calendar_getMinimalDaysInFirstWeek_error.phpt b/ext/intl/tests/calendar_getMinimalDaysInFirstWeek_error.phpt
index a1190e5ce0..64e7530d9c 100644
--- a/ext/intl/tests/calendar_getMinimalDaysInFirstWeek_error.phpt
+++ b/ext/intl/tests/calendar_getMinimalDaysInFirstWeek_error.phpt
@@ -10,24 +10,9 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-
-var_dump($c->getMinimalDaysInFirstWeek(1));
-
-var_dump(intlcal_get_minimal_days_in_first_week($c, 1));
var_dump(intlcal_get_minimal_days_in_first_week(1));
--EXPECTF--
-Warning: IntlCalendar::getMinimalDaysInFirstWeek() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlCalendar::getMinimalDaysInFirstWeek(): intlcal_get_minimal_days_in_first_week: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlcal_get_minimal_days_in_first_week() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: intlcal_get_minimal_days_in_first_week(): intlcal_get_minimal_days_in_first_week: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_get_minimal_days_in_first_week() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_get_minimal_days_in_first_week() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_get_minimal_days_in_first_week(1)
#1 {main}
diff --git a/ext/intl/tests/calendar_getNow_basic.phpt b/ext/intl/tests/calendar_getNow_basic.phpt
index 3f1c2488b3..bc103420c4 100644
--- a/ext/intl/tests/calendar_getNow_basic.phpt
+++ b/ext/intl/tests/calendar_getNow_basic.phpt
@@ -16,8 +16,6 @@ var_dump(abs($now - $proc_now) < 500);
var_dump(abs($time * 1000 - $proc_now) < 2000);
?>
-==DONE==
--EXPECT--
bool(true)
bool(true)
-==DONE==
diff --git a/ext/intl/tests/calendar_getNow_error.phpt b/ext/intl/tests/calendar_getNow_error.phpt
deleted file mode 100644
index 712e210851..0000000000
--- a/ext/intl/tests/calendar_getNow_error.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-IntlCalendar::getNow(): bad arguments
---SKIPIF--
-<?php
-if (!extension_loaded('intl'))
- die('skip intl extension not enabled');
---FILE--
-<?php
-ini_set("intl.error_level", E_WARNING);
-
-var_dump(intlcal_get_now(1));
-var_dump(IntlCalendar::getNow(2));
---EXPECTF--
-Warning: intlcal_get_now() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: intlcal_get_now(): intlcal_get_now: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::getNow() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlCalendar::getNow(): intlcal_get_now: bad arguments in %s on line %d
-bool(false)
diff --git a/ext/intl/tests/calendar_getSkipped_RepeatedWallTimeOption_error.phpt b/ext/intl/tests/calendar_getSkipped_RepeatedWallTimeOption_error.phpt
index 06aa679c5a..1e2b3f85db 100644
--- a/ext/intl/tests/calendar_getSkipped_RepeatedWallTimeOption_error.phpt
+++ b/ext/intl/tests/calendar_getSkipped_RepeatedWallTimeOption_error.phpt
@@ -10,37 +10,9 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-
-var_dump($c->getSkippedWallTimeOption(1));
-var_dump($c->getRepeatedWallTimeOption(1));
-
-var_dump(intlcal_get_skipped_wall_time_option($c, 1));
-var_dump(intlcal_get_repeated_wall_time_option($c, 1));
-
var_dump(intlcal_get_skipped_wall_time_option(1));
--EXPECTF--
-Warning: IntlCalendar::getSkippedWallTimeOption() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlCalendar::getSkippedWallTimeOption(): intlcal_get_skipped_wall_time_option: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::getRepeatedWallTimeOption() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlCalendar::getRepeatedWallTimeOption(): intlcal_get_repeated_wall_time_option: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlcal_get_skipped_wall_time_option() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: intlcal_get_skipped_wall_time_option(): intlcal_get_skipped_wall_time_option: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlcal_get_repeated_wall_time_option() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: intlcal_get_repeated_wall_time_option(): intlcal_get_repeated_wall_time_option: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_get_skipped_wall_time_option() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_get_skipped_wall_time_option() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_get_skipped_wall_time_option(1)
#1 {main}
diff --git a/ext/intl/tests/calendar_getTimeZone_basic.phpt b/ext/intl/tests/calendar_getTimeZone_basic.phpt
index 612796be0b..acd3effb20 100644
--- a/ext/intl/tests/calendar_getTimeZone_basic.phpt
+++ b/ext/intl/tests/calendar_getTimeZone_basic.phpt
@@ -13,7 +13,6 @@ $intlcal = IntlCalendar::createInstance('GMT+00:01');
print_r($intlcal->getTimeZone());
print_r(intlcal_get_time_zone($intlcal));
?>
-==DONE==
--EXPECT--
IntlTimeZone Object
(
@@ -29,4 +28,3 @@ IntlTimeZone Object
[rawOffset] => 60000
[currentOffset] => 60000
)
-==DONE==
diff --git a/ext/intl/tests/calendar_getTimeZone_error.phpt b/ext/intl/tests/calendar_getTimeZone_error.phpt
index ea7e85db4c..683d1e66ee 100644
--- a/ext/intl/tests/calendar_getTimeZone_error.phpt
+++ b/ext/intl/tests/calendar_getTimeZone_error.phpt
@@ -10,24 +10,9 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-
-var_dump($c->getTimeZone(1));
-
-var_dump(intlcal_get_time_zone($c, 1));
var_dump(intlcal_get_time_zone(1));
--EXPECTF--
-Warning: IntlCalendar::getTimeZone() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlCalendar::getTimeZone(): intlcal_get_time_zone: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlcal_get_time_zone() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: intlcal_get_time_zone(): intlcal_get_time_zone: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_get_time_zone() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_get_time_zone() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_get_time_zone(1)
#1 {main}
diff --git a/ext/intl/tests/calendar_getTime_basic.phpt b/ext/intl/tests/calendar_getTime_basic.phpt
index 659c71c961..b644bc0737 100644
--- a/ext/intl/tests/calendar_getTime_basic.phpt
+++ b/ext/intl/tests/calendar_getTime_basic.phpt
@@ -22,8 +22,6 @@ $time = strtotime('2012-02-29 00:00:00 +0000');
var_dump((float)$time*1000, $intlcal->getTime());
?>
-==DONE==
--EXPECT--
float(1330473600000)
-float(1330473600000)
-==DONE== \ No newline at end of file
+float(1330473600000) \ No newline at end of file
diff --git a/ext/intl/tests/calendar_getTime_error.phpt b/ext/intl/tests/calendar_getTime_error.phpt
index 61eaea97dc..ca0924ee97 100644
--- a/ext/intl/tests/calendar_getTime_error.phpt
+++ b/ext/intl/tests/calendar_getTime_error.phpt
@@ -10,24 +10,9 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-
-var_dump($c->getTime(1));
-
-var_dump(intlcal_get_time($c, 1));
var_dump(intlcal_get_time(1));
--EXPECTF--
-Warning: IntlCalendar::getTime() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlCalendar::getTime(): intlcal_get_time: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlcal_get_time() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: intlcal_get_time(): intlcal_get_time: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_get_time() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_get_time() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_get_time(1)
#1 {main}
diff --git a/ext/intl/tests/calendar_getType_basic.phpt b/ext/intl/tests/calendar_getType_basic.phpt
index ba32dd0526..495caa390e 100644
--- a/ext/intl/tests/calendar_getType_basic.phpt
+++ b/ext/intl/tests/calendar_getType_basic.phpt
@@ -16,8 +16,6 @@ VAR_DUMP($intlcal->getType());
$intlcal = IntlCalendar::createInstance(null, "nl_NL@calendar=hebrew");
VAR_DUMP(intlcal_get_type($intlcal));
?>
-==DONE==
--EXPECT--
string(9) "gregorian"
-string(6) "hebrew"
-==DONE== \ No newline at end of file
+string(6) "hebrew" \ No newline at end of file
diff --git a/ext/intl/tests/calendar_getType_error.phpt b/ext/intl/tests/calendar_getType_error.phpt
index c124151893..1c0e92b07f 100644
--- a/ext/intl/tests/calendar_getType_error.phpt
+++ b/ext/intl/tests/calendar_getType_error.phpt
@@ -10,24 +10,9 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-
-var_dump($c->getType(1));
-
-var_dump(intlcal_get_type($c, 1));
var_dump(intlcal_get_type(1));
--EXPECTF--
-Warning: IntlCalendar::getType() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlCalendar::getType(): intlcal_get_type: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlcal_get_type() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: intlcal_get_type(): intlcal_get_type: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_get_type() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_get_type() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_get_type(1)
#1 {main}
diff --git a/ext/intl/tests/calendar_getWeekendTransition_basic.phpt b/ext/intl/tests/calendar_getWeekendTransition_basic.phpt
index 3afbdd4ba3..616f40b526 100644
--- a/ext/intl/tests/calendar_getWeekendTransition_basic.phpt
+++ b/ext/intl/tests/calendar_getWeekendTransition_basic.phpt
@@ -15,8 +15,6 @@ $intlcal = IntlCalendar::createInstance();
var_dump($intlcal->getWeekendTransition(IntlCalendar::DOW_SUNDAY));
var_dump(intlcal_get_weekend_transition($intlcal, IntlCalendar::DOW_SUNDAY));
?>
-==DONE==
--EXPECT--
int(86400000)
int(86400000)
-==DONE==
diff --git a/ext/intl/tests/calendar_getWeekendTransition_error.phpt b/ext/intl/tests/calendar_getWeekendTransition_error.phpt
index d61c9d5a25..12bfbaa5fb 100644
--- a/ext/intl/tests/calendar_getWeekendTransition_error.phpt
+++ b/ext/intl/tests/calendar_getWeekendTransition_error.phpt
@@ -11,33 +11,14 @@ if (!extension_loaded('intl'))
ini_set("intl.error_level", E_WARNING);
$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-
-var_dump($c->getWeekendTransition());
-var_dump($c->getWeekendTransition(1, 2));
var_dump($c->getWeekendTransition(0));
-var_dump(intlcal_get_weekend_transition($c));
var_dump(intlcal_get_weekend_transition(1, 1));
--EXPECTF--
-Warning: IntlCalendar::getWeekendTransition() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlCalendar::getWeekendTransition(): intlcal_get_weekend_transition: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::getWeekendTransition() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlCalendar::getWeekendTransition(): intlcal_get_weekend_transition: bad arguments in %s on line %d
-bool(false)
-
Warning: IntlCalendar::getWeekendTransition(): intlcal_get_weekend_transition: invalid day of week in %s on line %d
bool(false)
-Warning: intlcal_get_weekend_transition() expects exactly 2 parameters, 1 given in %s on line %d
-
-Warning: intlcal_get_weekend_transition(): intlcal_get_weekend_transition: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_get_weekend_transition() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_get_weekend_transition() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_get_weekend_transition(1, 1)
#1 {main}
diff --git a/ext/intl/tests/calendar_getXMaximum_basic.phpt b/ext/intl/tests/calendar_getXMaximum_basic.phpt
index 2e6d1a3fa9..82e77b8c8e 100644
--- a/ext/intl/tests/calendar_getXMaximum_basic.phpt
+++ b/ext/intl/tests/calendar_getXMaximum_basic.phpt
@@ -14,21 +14,19 @@ ini_set("intl.default_locale", "nl");
$intlcal = IntlCalendar::createInstance('UTC');
$intlcal->setTime(strtotime('2012-02-29 05:06:07 +0000') * 1000);
var_dump(
- $intlcal->getLeastMaximum(IntlCalendar::FIELD_DAY_OF_MONTH),
- intlcal_get_least_maximum($intlcal, IntlCalendar::FIELD_DAY_OF_MONTH),
- $intlcal->getActualMaximum(IntlCalendar::FIELD_DAY_OF_MONTH),
- intlcal_get_actual_maximum($intlcal, IntlCalendar::FIELD_DAY_OF_MONTH),
- $intlcal->getMaximum(IntlCalendar::FIELD_DAY_OF_MONTH),
- intlcal_get_maximum($intlcal, IntlCalendar::FIELD_DAY_OF_MONTH)
+ $intlcal->getLeastMaximum(IntlCalendar::FIELD_DAY_OF_MONTH),
+ intlcal_get_least_maximum($intlcal, IntlCalendar::FIELD_DAY_OF_MONTH),
+ $intlcal->getActualMaximum(IntlCalendar::FIELD_DAY_OF_MONTH),
+ intlcal_get_actual_maximum($intlcal, IntlCalendar::FIELD_DAY_OF_MONTH),
+ $intlcal->getMaximum(IntlCalendar::FIELD_DAY_OF_MONTH),
+ intlcal_get_maximum($intlcal, IntlCalendar::FIELD_DAY_OF_MONTH)
);
?>
-==DONE==
--EXPECT--
int(28)
int(28)
int(29)
int(29)
int(31)
-int(31)
-==DONE== \ No newline at end of file
+int(31) \ No newline at end of file
diff --git a/ext/intl/tests/calendar_getXMinimum_basic.phpt b/ext/intl/tests/calendar_getXMinimum_basic.phpt
index ff0518d882..a1f52b361d 100644
--- a/ext/intl/tests/calendar_getXMinimum_basic.phpt
+++ b/ext/intl/tests/calendar_getXMinimum_basic.phpt
@@ -14,21 +14,19 @@ ini_set("intl.default_locale", "nl");
$intlcal = IntlCalendar::createInstance('UTC');
$intlcal->setTime(strtotime('2012-02-29 05:06:07 +0000') * 1000);
var_dump(
- $intlcal->getGreatestMinimum(IntlCalendar::FIELD_DAY_OF_MONTH),
- intlcal_get_greatest_minimum($intlcal, IntlCalendar::FIELD_DAY_OF_MONTH),
- $intlcal->getActualMinimum(IntlCalendar::FIELD_DAY_OF_MONTH),
- intlcal_get_actual_minimum($intlcal, IntlCalendar::FIELD_DAY_OF_MONTH),
- $intlcal->getMinimum(IntlCalendar::FIELD_DAY_OF_MONTH),
- intlcal_get_minimum($intlcal, IntlCalendar::FIELD_DAY_OF_MONTH)
+ $intlcal->getGreatestMinimum(IntlCalendar::FIELD_DAY_OF_MONTH),
+ intlcal_get_greatest_minimum($intlcal, IntlCalendar::FIELD_DAY_OF_MONTH),
+ $intlcal->getActualMinimum(IntlCalendar::FIELD_DAY_OF_MONTH),
+ intlcal_get_actual_minimum($intlcal, IntlCalendar::FIELD_DAY_OF_MONTH),
+ $intlcal->getMinimum(IntlCalendar::FIELD_DAY_OF_MONTH),
+ intlcal_get_minimum($intlcal, IntlCalendar::FIELD_DAY_OF_MONTH)
);
?>
-==DONE==
--EXPECT--
int(1)
int(1)
int(1)
int(1)
int(1)
-int(1)
-==DONE== \ No newline at end of file
+int(1) \ No newline at end of file
diff --git a/ext/intl/tests/calendar_get_Least_Greatest_Minimum_Maximum_error.phpt b/ext/intl/tests/calendar_get_Least_Greatest_Minimum_Maximum_error.phpt
index 6c6f67f953..211636cd63 100644
--- a/ext/intl/tests/calendar_get_Least_Greatest_Minimum_Maximum_error.phpt
+++ b/ext/intl/tests/calendar_get_Least_Greatest_Minimum_Maximum_error.phpt
@@ -12,11 +12,6 @@ ini_set("intl.error_level", E_WARNING);
$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-var_dump($c->getLeastMaximum());
-var_dump($c->getMaximum());
-var_dump($c->getGreatestMinimum());
-var_dump($c->getMinimum());
-
var_dump($c->getLeastMaximum(-1));
var_dump($c->getMaximum(-1));
var_dump($c->getGreatestMinimum(-1));
@@ -33,46 +28,26 @@ echo "error: $errno, $errstr\n";
set_error_handler('eh');
try {
- var_dump(intlcal_get_least_maximum(1, 1));
+ var_dump(intlcal_get_least_maximum(1, 1));
} catch (Error $ex) {
- echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
+ echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
- var_dump(intlcal_get_maximum(1, 1));
+ var_dump(intlcal_get_maximum(1, 1));
} catch (Error $ex) {
- echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
+ echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
- var_dump(intlcal_get_greatest_minimum(1, -1));
+ var_dump(intlcal_get_greatest_minimum(1, -1));
} catch (Error $ex) {
- echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
+ echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
- var_dump(intlcal_get_minimum(1, -1));
+ var_dump(intlcal_get_minimum(1, -1));
} catch (Error $ex) {
- echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
+ echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
--EXPECTF--
-Warning: IntlCalendar::getLeastMaximum() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlCalendar::getLeastMaximum(): intlcal_get_least_maximum: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::getMaximum() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlCalendar::getMaximum(): intlcal_get_maximum: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::getGreatestMinimum() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlCalendar::getGreatestMinimum(): intlcal_get_greatest_minimum: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::getMinimum() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlCalendar::getMinimum(): intlcal_get_minimum: bad arguments in %s on line %d
-bool(false)
-
Warning: IntlCalendar::getLeastMaximum(): intlcal_get_least_maximum: invalid field in %s on line %d
bool(false)
@@ -96,10 +71,10 @@ bool(false)
Warning: intlcal_get_minimum(): intlcal_get_minimum: invalid field in %s on line %d
bool(false)
-error: 0, Argument 1 passed to intlcal_get_least_maximum() must be an instance of IntlCalendar, int given
+error: 0, intlcal_get_least_maximum() expects parameter 1 to be IntlCalendar, int given
-error: 0, Argument 1 passed to intlcal_get_maximum() must be an instance of IntlCalendar, int given
+error: 0, intlcal_get_maximum() expects parameter 1 to be IntlCalendar, int given
-error: 0, Argument 1 passed to intlcal_get_greatest_minimum() must be an instance of IntlCalendar, int given
+error: 0, intlcal_get_greatest_minimum() expects parameter 1 to be IntlCalendar, int given
-error: 0, Argument 1 passed to intlcal_get_minimum() must be an instance of IntlCalendar, int given
+error: 0, intlcal_get_minimum() expects parameter 1 to be IntlCalendar, int given
diff --git a/ext/intl/tests/calendar_get_basic.phpt b/ext/intl/tests/calendar_get_basic.phpt
index c617639610..dc008ce959 100644
--- a/ext/intl/tests/calendar_get_basic.phpt
+++ b/ext/intl/tests/calendar_get_basic.phpt
@@ -16,8 +16,6 @@ var_dump($intlcal->get(IntlCalendar::FIELD_DAY_OF_MONTH));
var_dump(intlcal_get($intlcal, IntlCalendar::FIELD_DAY_OF_MONTH));
?>
-==DONE==
--EXPECT--
int(4)
-int(4)
-==DONE== \ No newline at end of file
+int(4) \ No newline at end of file
diff --git a/ext/intl/tests/calendar_get_getActualMaximum_Minumum_error.phpt b/ext/intl/tests/calendar_get_getActualMaximum_Minumum_error.phpt
index d7d20ed6cd..3853d612a3 100644
--- a/ext/intl/tests/calendar_get_getActualMaximum_Minumum_error.phpt
+++ b/ext/intl/tests/calendar_get_getActualMaximum_Minumum_error.phpt
@@ -12,37 +12,12 @@ ini_set("intl.error_level", E_WARNING);
$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-var_dump($c->get());
-var_dump($c->getActualMaximum());
-var_dump($c->getActualMinimum());
-
var_dump($c->get(-1));
var_dump($c->getActualMaximum(-1));
var_dump($c->getActualMinimum(-1));
-var_dump($c->get("s"));
-var_dump($c->getActualMaximum("s"));
-var_dump($c->getActualMinimum("s"));
-
-var_dump($c->get(1, 2));
-var_dump($c->getActualMaximum(1, 2));
-var_dump($c->getActualMinimum(1, 2));
+?>
--EXPECTF--
-Warning: IntlCalendar::get() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlCalendar::get(): intlcal_get: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::getActualMaximum() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlCalendar::getActualMaximum(): intlcal_get_actual_maximum: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::getActualMinimum() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlCalendar::getActualMinimum(): intlcal_get_actual_minimum: bad arguments in %s on line %d
-bool(false)
-
Warning: IntlCalendar::get(): intlcal_get: invalid field in %s on line %d
bool(false)
@@ -51,33 +26,3 @@ bool(false)
Warning: IntlCalendar::getActualMinimum(): intlcal_get_actual_minimum: invalid field in %s on line %d
bool(false)
-
-Warning: IntlCalendar::get() expects parameter 1 to be int, string given in %s on line %d
-
-Warning: IntlCalendar::get(): intlcal_get: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::getActualMaximum() expects parameter 1 to be int, string given in %s on line %d
-
-Warning: IntlCalendar::getActualMaximum(): intlcal_get_actual_maximum: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::getActualMinimum() expects parameter 1 to be int, string given in %s on line %d
-
-Warning: IntlCalendar::getActualMinimum(): intlcal_get_actual_minimum: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::get() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlCalendar::get(): intlcal_get: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::getActualMaximum() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlCalendar::getActualMaximum(): intlcal_get_actual_maximum: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::getActualMinimum() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlCalendar::getActualMinimum(): intlcal_get_actual_minimum: bad arguments in %s on line %d
-bool(false)
diff --git a/ext/intl/tests/calendar_get_getActualMaximum_Minumum_error2.phpt b/ext/intl/tests/calendar_get_getActualMaximum_Minumum_error2.phpt
index 37e3816fef..5921d0c0d3 100644
--- a/ext/intl/tests/calendar_get_getActualMaximum_Minumum_error2.phpt
+++ b/ext/intl/tests/calendar_get_getActualMaximum_Minumum_error2.phpt
@@ -18,95 +18,89 @@ echo "error: $errno, $errstr\n";
set_error_handler('eh');
try {
- var_dump(intlcal_get($c));
+ var_dump(intlcal_get($c));
} catch (Error $ex) {
- echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
+ echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
- var_dump(intlcal_get_actual_maximum($c));
+ var_dump(intlcal_get_actual_maximum($c));
} catch (Error $ex) {
- echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
+ echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
- var_dump(intlcal_get_actual_minimum($c));
+ var_dump(intlcal_get_actual_minimum($c));
} catch (Error $ex) {
- echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
+ echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
- var_dump(intlcal_get($c, -1));
+ var_dump(intlcal_get($c, -1));
} catch (Error $ex) {
- echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
+ echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
- var_dump(intlcal_get_actual_maximum($c, -1));
+ var_dump(intlcal_get_actual_maximum($c, -1));
} catch (Error $ex) {
- echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
+ echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
- var_dump(intlcal_get_actual_minimum($c, -1));
+ var_dump(intlcal_get_actual_minimum($c, -1));
} catch (Error $ex) {
- echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
+ echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
- var_dump(intlcal_get($c, "s"));
+ var_dump(intlcal_get($c, "s"));
} catch (Error $ex) {
- echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
+ echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
- var_dump(intlcal_get_actual_maximum($c, "s"));
+ var_dump(intlcal_get_actual_maximum($c, "s"));
} catch (Error $ex) {
- echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
+ echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
- var_dump(intlcal_get_actual_minimum($c, "s"));
+ var_dump(intlcal_get_actual_minimum($c, "s"));
} catch (Error $ex) {
- echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
+ echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
- var_dump(intlcal_get(1));
+ var_dump(intlcal_get(1));
} catch (Error $ex) {
- echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
+ echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
- var_dump(intlcal_get_actual_maximum(1));
+ var_dump(intlcal_get_actual_maximum(1));
} catch (Error $ex) {
- echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
+ echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
- var_dump(intlcal_get_actual_minimum(1));
+ var_dump(intlcal_get_actual_minimum(1));
} catch (Error $ex) {
- echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
+ echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
--EXPECT--
-error: 2, intlcal_get() expects exactly 2 parameters, 1 given
-error: 2, intlcal_get(): intlcal_get: bad arguments
-bool(false)
-error: 2, intlcal_get_actual_maximum() expects exactly 2 parameters, 1 given
-error: 2, intlcal_get_actual_maximum(): intlcal_get_actual_maximum: bad arguments
-bool(false)
-error: 2, intlcal_get_actual_minimum() expects exactly 2 parameters, 1 given
-error: 2, intlcal_get_actual_minimum(): intlcal_get_actual_minimum: bad arguments
-bool(false)
+error: 0, intlcal_get() expects exactly 2 parameters, 1 given
+
+error: 0, intlcal_get_actual_maximum() expects exactly 2 parameters, 1 given
+
+error: 0, intlcal_get_actual_minimum() expects exactly 2 parameters, 1 given
+
error: 2, intlcal_get(): intlcal_get: invalid field
bool(false)
error: 2, intlcal_get_actual_maximum(): intlcal_get_actual_maximum: invalid field
bool(false)
error: 2, intlcal_get_actual_minimum(): intlcal_get_actual_minimum: invalid field
bool(false)
-error: 2, intlcal_get() expects parameter 2 to be int, string given
-error: 2, intlcal_get(): intlcal_get: bad arguments
-bool(false)
-error: 2, intlcal_get_actual_maximum() expects parameter 2 to be int, string given
-error: 2, intlcal_get_actual_maximum(): intlcal_get_actual_maximum: bad arguments
-bool(false)
-error: 2, intlcal_get_actual_minimum() expects parameter 2 to be int, string given
-error: 2, intlcal_get_actual_minimum(): intlcal_get_actual_minimum: bad arguments
-bool(false)
-error: 0, Argument 1 passed to intlcal_get() must be an instance of IntlCalendar, int given
+error: 0, intlcal_get() expects parameter 2 to be int, string given
+
+error: 0, intlcal_get_actual_maximum() expects parameter 2 to be int, string given
+
+error: 0, intlcal_get_actual_minimum() expects parameter 2 to be int, string given
+
+error: 0, intlcal_get() expects exactly 2 parameters, 1 given
-error: 0, Argument 1 passed to intlcal_get_actual_maximum() must be an instance of IntlCalendar, int given
+error: 0, intlcal_get_actual_maximum() expects exactly 2 parameters, 1 given
-error: 0, Argument 1 passed to intlcal_get_actual_minimum() must be an instance of IntlCalendar, int given
+error: 0, intlcal_get_actual_minimum() expects exactly 2 parameters, 1 given
diff --git a/ext/intl/tests/calendar_get_setRepeatedWallTimeOption_basic.phpt b/ext/intl/tests/calendar_get_setRepeatedWallTimeOption_basic.phpt
index 59ad43647c..83e6b84645 100644
--- a/ext/intl/tests/calendar_get_setRepeatedWallTimeOption_basic.phpt
+++ b/ext/intl/tests/calendar_get_setRepeatedWallTimeOption_basic.phpt
@@ -18,8 +18,8 @@ var_dump($intlcal->getRepeatedWallTimeOption());
$intlcal->set(IntlCalendar::FIELD_HOUR_OF_DAY, 2);
$intlcal->set(IntlCalendar::FIELD_MINUTE, 30);
var_dump(
- strtotime('2012-10-28 02:30:00 +0100'),
- (int)($intlcal->getTime() /1000)
+ strtotime('2012-10-28 02:30:00 +0100'),
+ (int)($intlcal->getTime() /1000)
);
var_dump(intlcal_set_repeated_wall_time_option($intlcal, IntlCalendar::WALLTIME_FIRST));
@@ -27,12 +27,11 @@ var_dump(intlcal_get_repeated_wall_time_option($intlcal));
$intlcal->set(IntlCalendar::FIELD_HOUR_OF_DAY, 2);
$intlcal->set(IntlCalendar::FIELD_MINUTE, 30);
var_dump(
- strtotime('2012-10-28 02:30:00 +0200'),
- (int)($intlcal->getTime() /1000)
+ strtotime('2012-10-28 02:30:00 +0200'),
+ (int)($intlcal->getTime() /1000)
);
?>
-==DONE==
--EXPECT--
bool(true)
int(0)
@@ -42,4 +41,3 @@ bool(true)
int(1)
int(1351384200)
int(1351384200)
-==DONE==
diff --git a/ext/intl/tests/calendar_get_setSkippedWallTimeOption_basic.phpt b/ext/intl/tests/calendar_get_setSkippedWallTimeOption_basic.phpt
index 94f540abb1..2f96aaf96d 100644
--- a/ext/intl/tests/calendar_get_setSkippedWallTimeOption_basic.phpt
+++ b/ext/intl/tests/calendar_get_setSkippedWallTimeOption_basic.phpt
@@ -18,8 +18,8 @@ $intlcal->set(IntlCalendar::FIELD_HOUR_OF_DAY, 2);
$intlcal->set(IntlCalendar::FIELD_MINUTE, 30);
echo "Should be 3h30\n";
var_dump(
- $intlcal->get(IntlCalendar::FIELD_HOUR_OF_DAY),
- $intlcal->get(IntlCalendar::FIELD_MINUTE)
+ $intlcal->get(IntlCalendar::FIELD_HOUR_OF_DAY),
+ $intlcal->get(IntlCalendar::FIELD_MINUTE)
);
var_dump($intlcal->setSkippedWallTimeOption(IntlCalendar::WALLTIME_FIRST));
@@ -28,8 +28,8 @@ $intlcal->set(IntlCalendar::FIELD_HOUR_OF_DAY, 2);
$intlcal->set(IntlCalendar::FIELD_MINUTE, 30);
echo "Should be 1h30\n";
var_dump(
- $intlcal->get(IntlCalendar::FIELD_HOUR_OF_DAY),
- $intlcal->get(IntlCalendar::FIELD_MINUTE)
+ $intlcal->get(IntlCalendar::FIELD_HOUR_OF_DAY),
+ $intlcal->get(IntlCalendar::FIELD_MINUTE)
);
var_dump(intlcal_set_skipped_wall_time_option($intlcal, IntlCalendar::WALLTIME_NEXT_VALID));
@@ -38,13 +38,12 @@ $intlcal->set(IntlCalendar::FIELD_HOUR_OF_DAY, 2);
$intlcal->set(IntlCalendar::FIELD_MINUTE, 30);
echo "Should be 3h00\n";
var_dump(
- $intlcal->get(IntlCalendar::FIELD_HOUR_OF_DAY),
- $intlcal->get(IntlCalendar::FIELD_MINUTE)
+ $intlcal->get(IntlCalendar::FIELD_HOUR_OF_DAY),
+ $intlcal->get(IntlCalendar::FIELD_MINUTE)
);
?>
-==DONE==
--EXPECT--
int(0)
Should be 3h30
@@ -60,4 +59,3 @@ int(2)
Should be 3h00
int(3)
int(0)
-==DONE==
diff --git a/ext/intl/tests/calendar_inDaylightTime_basic.phpt b/ext/intl/tests/calendar_inDaylightTime_basic.phpt
index dff8ef50d3..6bbf833be7 100644
--- a/ext/intl/tests/calendar_inDaylightTime_basic.phpt
+++ b/ext/intl/tests/calendar_inDaylightTime_basic.phpt
@@ -17,8 +17,6 @@ var_dump($intlcal->inDaylightTime());
$intlcal->setTime(strtotime('2012-04-01') * 1000);
var_dump(intlcal_in_daylight_time($intlcal));
?>
-==DONE==
--EXPECT--
bool(false)
-bool(true)
-==DONE== \ No newline at end of file
+bool(true) \ No newline at end of file
diff --git a/ext/intl/tests/calendar_inDaylightTime_error.phpt b/ext/intl/tests/calendar_inDaylightTime_error.phpt
index 6644f477ea..4eab7b2fe4 100644
--- a/ext/intl/tests/calendar_inDaylightTime_error.phpt
+++ b/ext/intl/tests/calendar_inDaylightTime_error.phpt
@@ -10,24 +10,9 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-
-var_dump($c->inDaylightTime(1));
-
-var_dump(intlcal_in_daylight_time($c, 1));
var_dump(intlcal_in_daylight_time(1));
--EXPECTF--
-Warning: IntlCalendar::inDaylightTime() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlCalendar::inDaylightTime(): intlcal_in_daylight_time: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlcal_in_daylight_time() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: intlcal_in_daylight_time(): intlcal_in_daylight_time: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_in_daylight_time() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_in_daylight_time() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_in_daylight_time(1)
#1 {main}
diff --git a/ext/intl/tests/calendar_isEquivalentTo_basic.phpt b/ext/intl/tests/calendar_isEquivalentTo_basic.phpt
index f71fd8ad5b..5e78c0b92c 100644
--- a/ext/intl/tests/calendar_isEquivalentTo_basic.phpt
+++ b/ext/intl/tests/calendar_isEquivalentTo_basic.phpt
@@ -16,18 +16,17 @@ $intlcal4 = IntlCalendar::createInstance('Europe/Amsterdam');
$intlcal4->roll(IntlCalendar::FIELD_MONTH, true);
var_dump(
- "1 - 1",
- $intlcal1->isEquivalentTo($intlcal1),
- "1 - 2",
- $intlcal1->isEquivalentTo($intlcal2),
- "1 - 3",
- $intlcal1->isEquivalentTo($intlcal3),
- "1 - 4",
- $intlcal1->isEquivalentTo($intlcal4)
+ "1 - 1",
+ $intlcal1->isEquivalentTo($intlcal1),
+ "1 - 2",
+ $intlcal1->isEquivalentTo($intlcal2),
+ "1 - 3",
+ $intlcal1->isEquivalentTo($intlcal3),
+ "1 - 4",
+ $intlcal1->isEquivalentTo($intlcal4)
);
?>
-==DONE==
--EXPECT--
string(5) "1 - 1"
bool(true)
@@ -36,5 +35,4 @@ bool(false)
string(5) "1 - 3"
bool(false)
string(5) "1 - 4"
-bool(true)
-==DONE== \ No newline at end of file
+bool(true) \ No newline at end of file
diff --git a/ext/intl/tests/calendar_isEquivalentTo_error.phpt b/ext/intl/tests/calendar_isEquivalentTo_error.phpt
index c7e30fd645..ce1536f920 100644
--- a/ext/intl/tests/calendar_isEquivalentTo_error.phpt
+++ b/ext/intl/tests/calendar_isEquivalentTo_error.phpt
@@ -18,47 +18,45 @@ echo "error: $errno, $errstr\n";
set_error_handler('eh');
try {
- var_dump($c->isEquivalentTo(0));
+ var_dump($c->isEquivalentTo(0));
} catch (Error $ex) {
- echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
+ echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
- var_dump($c->isEquivalentTo($c, 1));
+ var_dump($c->isEquivalentTo($c, 1));
} catch (Error $ex) {
- echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
+ echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
- var_dump($c->isEquivalentTo(1));
+ var_dump($c->isEquivalentTo(1));
} catch (Error $ex) {
- echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
+ echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
- var_dump(intlcal_is_equivalent_to($c));
+ var_dump(intlcal_is_equivalent_to($c));
} catch (Error $ex) {
- echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
+ echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
- var_dump(intlcal_is_equivalent_to($c, 1));
+ var_dump(intlcal_is_equivalent_to($c, 1));
} catch (Error $ex) {
- echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
+ echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
- var_dump(intlcal_is_equivalent_to(1, $c));
+ var_dump(intlcal_is_equivalent_to(1, $c));
} catch (Error $ex) {
- echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
+ echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
--EXPECT--
-error: 0, Argument 1 passed to IntlCalendar::isEquivalentTo() must be an instance of IntlCalendar, int given
+error: 0, IntlCalendar::isEquivalentTo() expects parameter 1 to be IntlCalendar, int given
-error: 2, IntlCalendar::isEquivalentTo() expects exactly 1 parameter, 2 given
-error: 2, IntlCalendar::isEquivalentTo(): intlcal_is_equivalent_to: bad arguments
-bool(false)
-error: 0, Argument 1 passed to IntlCalendar::isEquivalentTo() must be an instance of IntlCalendar, int given
+error: 0, IntlCalendar::isEquivalentTo() expects exactly 1 parameter, 2 given
-error: 2, intlcal_is_equivalent_to() expects exactly 2 parameters, 1 given
-error: 2, intlcal_is_equivalent_to(): intlcal_is_equivalent_to: bad arguments
-bool(false)
-error: 0, Argument 2 passed to intlcal_is_equivalent_to() must be an instance of IntlCalendar, int given
+error: 0, IntlCalendar::isEquivalentTo() expects parameter 1 to be IntlCalendar, int given
-error: 0, Argument 1 passed to intlcal_is_equivalent_to() must be an instance of IntlCalendar, int given
+error: 0, intlcal_is_equivalent_to() expects exactly 2 parameters, 1 given
+
+error: 0, intlcal_is_equivalent_to() expects parameter 2 to be IntlCalendar, int given
+
+error: 0, intlcal_is_equivalent_to() expects parameter 1 to be IntlCalendar, int given
diff --git a/ext/intl/tests/calendar_isLenient_error.phpt b/ext/intl/tests/calendar_isLenient_error.phpt
index 263d82bb37..4edbf70e55 100644
--- a/ext/intl/tests/calendar_isLenient_error.phpt
+++ b/ext/intl/tests/calendar_isLenient_error.phpt
@@ -10,24 +10,9 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-
-var_dump($c->isLenient(1));
-
-var_dump(intlcal_is_lenient($c, 1));
var_dump(intlcal_is_lenient(1));
--EXPECTF--
-Warning: IntlCalendar::isLenient() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlCalendar::isLenient(): intlcal_is_lenient: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlcal_is_lenient() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: intlcal_is_lenient(): intlcal_is_lenient: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_is_lenient() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_is_lenient() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_is_lenient(1)
#1 {main}
diff --git a/ext/intl/tests/calendar_isSet_basic.phpt b/ext/intl/tests/calendar_isSet_basic.phpt
index 8ef01448d5..39f0026e63 100644
--- a/ext/intl/tests/calendar_isSet_basic.phpt
+++ b/ext/intl/tests/calendar_isSet_basic.phpt
@@ -16,9 +16,7 @@ var_dump($intlcal->isSet(IntlCalendar::FIELD_MINUTE));
$intlcal->set(IntlCalendar::FIELD_MINUTE, 0);
var_dump(intlcal_is_set($intlcal, IntlCalendar::FIELD_MINUTE));
?>
-==DONE==
--EXPECT--
bool(true)
bool(false)
-bool(true)
-==DONE== \ No newline at end of file
+bool(true) \ No newline at end of file
diff --git a/ext/intl/tests/calendar_isSet_error.phpt b/ext/intl/tests/calendar_isSet_error.phpt
index 7e5b2beaa6..169fb2dd43 100644
--- a/ext/intl/tests/calendar_isSet_error.phpt
+++ b/ext/intl/tests/calendar_isSet_error.phpt
@@ -12,32 +12,14 @@ ini_set("intl.error_level", E_WARNING);
$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-var_dump($c->isSet());
-var_dump($c->isSet(1, 2));
var_dump($c->isSet(-1));
-var_dump(intlcal_is_set($c));
var_dump(intlcal_is_set(1, 2));
--EXPECTF--
-Warning: IntlCalendar::isSet() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlCalendar::isSet(): intlcal_is_set: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::isSet() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlCalendar::isSet(): intlcal_is_set: bad arguments in %s on line %d
-bool(false)
-
Warning: IntlCalendar::isSet(): intlcal_is_set: invalid field in %s on line %d
bool(false)
-Warning: intlcal_is_set() expects exactly 2 parameters, 1 given in %s on line %d
-
-Warning: intlcal_is_set(): intlcal_is_set: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_is_set() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_is_set() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_is_set(1, 2)
#1 {main}
diff --git a/ext/intl/tests/calendar_isWeekend_basic.phpt b/ext/intl/tests/calendar_isWeekend_basic.phpt
index ba9bbefb2c..943bd9a29a 100644
--- a/ext/intl/tests/calendar_isWeekend_basic.phpt
+++ b/ext/intl/tests/calendar_isWeekend_basic.phpt
@@ -16,9 +16,7 @@ var_dump($intlcal->isWeekend(strtotime('2012-02-29 12:00:00 +0000') * 1000));
var_dump(intlcal_is_weekend($intlcal, strtotime('2012-02-29 12:00:00 +0000') * 1000));
var_dump($intlcal->isWeekend(strtotime('2012-03-11 12:00:00 +0000') * 1000));
?>
-==DONE==
--EXPECT--
bool(false)
bool(false)
bool(true)
-==DONE==
diff --git a/ext/intl/tests/calendar_isWeekend_error.phpt b/ext/intl/tests/calendar_isWeekend_error.phpt
index c1f8180fa3..0ed3e507b0 100644
--- a/ext/intl/tests/calendar_isWeekend_error.phpt
+++ b/ext/intl/tests/calendar_isWeekend_error.phpt
@@ -10,30 +10,9 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-
-var_dump($c->isWeekend(1, 2));
-var_dump($c->isWeekend("jhhk"));
-
-var_dump(intlcal_is_weekend($c, "jj"));
var_dump(intlcal_is_weekend(1));
--EXPECTF--
-Warning: IntlCalendar::isWeekend() expects at most 1 parameter, 2 given in %s on line %d
-
-Warning: IntlCalendar::isWeekend(): intlcal_is_weekend: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::isWeekend() expects parameter 1 to be float, string given in %s on line %d
-
-Warning: IntlCalendar::isWeekend(): intlcal_is_weekend: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlcal_is_weekend() expects parameter 2 to be float, string given in %s on line %d
-
-Warning: intlcal_is_weekend(): intlcal_is_weekend: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_is_weekend() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_is_weekend() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_is_weekend(1)
#1 {main}
diff --git a/ext/intl/tests/calendar_is_set_lenient_basic.phpt b/ext/intl/tests/calendar_is_set_lenient_basic.phpt
index 64f537f9bc..b7e2be4293 100644
--- a/ext/intl/tests/calendar_is_set_lenient_basic.phpt
+++ b/ext/intl/tests/calendar_is_set_lenient_basic.phpt
@@ -17,12 +17,10 @@ var_dump($intlcal1->isLenient());
var_dump(intlcal_set_lenient($intlcal1, true));
var_dump($intlcal1->isLenient());
?>
-==DONE==
--EXPECT--
bool(true)
bool(true)
bool(true)
bool(false)
bool(true)
-bool(true)
-==DONE== \ No newline at end of file
+bool(true) \ No newline at end of file
diff --git a/ext/intl/tests/calendar_roll_basic.phpt b/ext/intl/tests/calendar_roll_basic.phpt
index 971c36217b..14db357c00 100644
--- a/ext/intl/tests/calendar_roll_basic.phpt
+++ b/ext/intl/tests/calendar_roll_basic.phpt
@@ -23,12 +23,10 @@ var_dump($intlcal->get(IntlCalendar::FIELD_DAY_OF_MONTH)); //1
?>
-==DONE==
--EXPECT--
bool(true)
int(1)
int(1)
bool(true)
int(1)
-int(1)
-==DONE== \ No newline at end of file
+int(1) \ No newline at end of file
diff --git a/ext/intl/tests/calendar_roll_error.phpt b/ext/intl/tests/calendar_roll_error.phpt
index 27160ee8ca..b627e83617 100644
--- a/ext/intl/tests/calendar_roll_error.phpt
+++ b/ext/intl/tests/calendar_roll_error.phpt
@@ -12,28 +12,14 @@ ini_set("intl.error_level", E_WARNING);
$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-var_dump($c->roll(1, 2, 3));
var_dump($c->roll(-1, 2));
-var_dump($c->roll(1));
-var_dump(intlcal_roll($c, 1, 2, 3));
var_dump(intlcal_roll(1, 2, 3));
--EXPECTF--
-Warning: IntlCalendar::roll(): intlcal_set: too many arguments in %s on line %d
-bool(false)
-
Warning: IntlCalendar::roll(): intlcal_roll: invalid field in %s on line %d
bool(false)
-Warning: IntlCalendar::roll() expects exactly 2 parameters, 1 given in %s on line %d
-
-Warning: IntlCalendar::roll(): intlcal_roll: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlcal_roll(): intlcal_set: too many arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_roll() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_roll() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_roll(1, 2, 3)
#1 {main}
diff --git a/ext/intl/tests/calendar_roll_variation1.phpt b/ext/intl/tests/calendar_roll_variation1.phpt
index 9fb8d75e5a..54f584d3eb 100644
--- a/ext/intl/tests/calendar_roll_variation1.phpt
+++ b/ext/intl/tests/calendar_roll_variation1.phpt
@@ -21,12 +21,10 @@ var_dump($intlcal->get(IntlCalendar::FIELD_MONTH)); //1 (Feb)
var_dump($intlcal->get(IntlCalendar::FIELD_DAY_OF_MONTH)); //28
?>
-==DONE==
--EXPECT--
bool(true)
int(1)
int(29)
bool(true)
int(1)
-int(28)
-==DONE== \ No newline at end of file
+int(28) \ No newline at end of file
diff --git a/ext/intl/tests/calendar_setFirstDayOfWeek_basic.phpt b/ext/intl/tests/calendar_setFirstDayOfWeek_basic.phpt
index 79b38104e4..5ca4afc918 100644
--- a/ext/intl/tests/calendar_setFirstDayOfWeek_basic.phpt
+++ b/ext/intl/tests/calendar_setFirstDayOfWeek_basic.phpt
@@ -11,18 +11,16 @@ ini_set("intl.default_locale", "nl");
$intlcal = IntlCalendar::createInstance('UTC');
var_dump(
- IntlCalendar::DOW_TUESDAY,
- $intlcal->setFirstDayOfWeek(IntlCalendar::DOW_TUESDAY),
- $intlcal->getFirstDayOfWeek(),
- intlcal_set_first_day_of_week($intlcal, IntlCalendar::DOW_WEDNESDAY),
- $intlcal->getFirstDayOfWeek()
+ IntlCalendar::DOW_TUESDAY,
+ $intlcal->setFirstDayOfWeek(IntlCalendar::DOW_TUESDAY),
+ $intlcal->getFirstDayOfWeek(),
+ intlcal_set_first_day_of_week($intlcal, IntlCalendar::DOW_WEDNESDAY),
+ $intlcal->getFirstDayOfWeek()
);
?>
-==DONE==
--EXPECT--
int(3)
bool(true)
int(3)
bool(true)
-int(4)
-==DONE== \ No newline at end of file
+int(4) \ No newline at end of file
diff --git a/ext/intl/tests/calendar_setFirstDayOfWeek_error.phpt b/ext/intl/tests/calendar_setFirstDayOfWeek_error.phpt
index a22c3b2842..bb4e01ca00 100644
--- a/ext/intl/tests/calendar_setFirstDayOfWeek_error.phpt
+++ b/ext/intl/tests/calendar_setFirstDayOfWeek_error.phpt
@@ -12,30 +12,18 @@ ini_set("intl.error_level", E_WARNING);
$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-var_dump($c->setFirstDayOfWeek());
-var_dump($c->setFirstDayOfWeek(1, 2));
var_dump($c->setFirstDayOfWeek(0));
var_dump(intlcal_set_first_day_of_week($c, 0));
var_dump(intlcal_set_first_day_of_week(1, 2));
--EXPECTF--
-Warning: IntlCalendar::setFirstDayOfWeek() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlCalendar::setFirstDayOfWeek(): intlcal_set_first_day_of_week: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::setFirstDayOfWeek() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlCalendar::setFirstDayOfWeek(): intlcal_set_first_day_of_week: bad arguments in %s on line %d
-bool(false)
-
Warning: IntlCalendar::setFirstDayOfWeek(): intlcal_set_first_day_of_week: invalid day of week in %s on line %d
bool(false)
Warning: intlcal_set_first_day_of_week(): intlcal_set_first_day_of_week: invalid day of week in %s on line %d
bool(false)
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_set_first_day_of_week() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_set_first_day_of_week() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_set_first_day_of_week(1, 2)
#1 {main}
diff --git a/ext/intl/tests/calendar_setLenient_error.phpt b/ext/intl/tests/calendar_setLenient_error.phpt
index b2a6f25d5d..896b2e430a 100644
--- a/ext/intl/tests/calendar_setLenient_error.phpt
+++ b/ext/intl/tests/calendar_setLenient_error.phpt
@@ -10,36 +10,9 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-
-var_dump($c->setLenient());
-var_dump($c->setLenient(array()));
-var_dump($c->setLenient(1, 2));
-
-var_dump(intlcal_set_lenient($c, array()));
var_dump(intlcal_set_lenient(1, false));
--EXPECTF--
-Warning: IntlCalendar::setLenient() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlCalendar::setLenient(): intlcal_set_lenient: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::setLenient() expects parameter 1 to be bool, array given in %s on line %d
-
-Warning: IntlCalendar::setLenient(): intlcal_set_lenient: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::setLenient() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlCalendar::setLenient(): intlcal_set_lenient: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlcal_set_lenient() expects parameter 2 to be bool, array given in %s on line %d
-
-Warning: intlcal_set_lenient(): intlcal_set_lenient: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_set_lenient() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_set_lenient() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_set_lenient(1, false)
#1 {main}
diff --git a/ext/intl/tests/calendar_setMinimalDaysInFirstWeek_basic.phpt b/ext/intl/tests/calendar_setMinimalDaysInFirstWeek_basic.phpt
index ac437f962b..e256608531 100644
--- a/ext/intl/tests/calendar_setMinimalDaysInFirstWeek_basic.phpt
+++ b/ext/intl/tests/calendar_setMinimalDaysInFirstWeek_basic.phpt
@@ -11,16 +11,14 @@ ini_set("intl.default_locale", "nl");
$intlcal = IntlCalendar::createInstance('UTC');
var_dump(
- $intlcal->setMinimalDaysInFirstWeek(6),
- $intlcal->getMinimalDaysInFirstWeek(),
- intlcal_set_minimal_days_in_first_week($intlcal, 5),
- $intlcal->getMinimalDaysInFirstWeek()
+ $intlcal->setMinimalDaysInFirstWeek(6),
+ $intlcal->getMinimalDaysInFirstWeek(),
+ intlcal_set_minimal_days_in_first_week($intlcal, 5),
+ $intlcal->getMinimalDaysInFirstWeek()
);
?>
-==DONE==
--EXPECT--
bool(true)
int(6)
bool(true)
int(5)
-==DONE==
diff --git a/ext/intl/tests/calendar_setMinimalDaysInFirstWeek_error.phpt b/ext/intl/tests/calendar_setMinimalDaysInFirstWeek_error.phpt
index 48d18bf28d..9bf3cb17dc 100644
--- a/ext/intl/tests/calendar_setMinimalDaysInFirstWeek_error.phpt
+++ b/ext/intl/tests/calendar_setMinimalDaysInFirstWeek_error.phpt
@@ -12,30 +12,18 @@ ini_set("intl.error_level", E_WARNING);
$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-var_dump($c->setMinimalDaysInFirstWeek());
-var_dump($c->setMinimalDaysInFirstWeek(1, 2));
var_dump($c->setMinimalDaysInFirstWeek(0));
var_dump(intlcal_set_minimal_days_in_first_week($c, 0));
var_dump(intlcal_set_minimal_days_in_first_week(1, 2));
--EXPECTF--
-Warning: IntlCalendar::setMinimalDaysInFirstWeek() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlCalendar::setMinimalDaysInFirstWeek(): intlcal_set_minimal_days_in_first_week: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::setMinimalDaysInFirstWeek() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlCalendar::setMinimalDaysInFirstWeek(): intlcal_set_minimal_days_in_first_week: bad arguments in %s on line %d
-bool(false)
-
Warning: IntlCalendar::setMinimalDaysInFirstWeek(): intlcal_set_minimal_days_in_first_week: invalid number of days; must be between 1 and 7 in %s on line %d
bool(false)
Warning: intlcal_set_minimal_days_in_first_week(): intlcal_set_minimal_days_in_first_week: invalid number of days; must be between 1 and 7 in %s on line %d
bool(false)
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_set_minimal_days_in_first_week() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_set_minimal_days_in_first_week() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_set_minimal_days_in_first_week(1, 2)
#1 {main}
diff --git a/ext/intl/tests/calendar_setSkipped_RepeatedWallTimeOption_error.phpt b/ext/intl/tests/calendar_setSkipped_RepeatedWallTimeOption_error.phpt
index 776cb8b825..079517b290 100644
--- a/ext/intl/tests/calendar_setSkipped_RepeatedWallTimeOption_error.phpt
+++ b/ext/intl/tests/calendar_setSkipped_RepeatedWallTimeOption_error.phpt
@@ -12,70 +12,18 @@ ini_set("intl.error_level", E_WARNING);
$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-var_dump($c->setSkippedWallTimeOption());
-var_dump($c->setRepeatedWallTimeOption());
-
-var_dump($c->setSkippedWallTimeOption(1, 2));
-var_dump($c->setRepeatedWallTimeOption(1, 2));
-
-var_dump($c->setSkippedWallTimeOption(array()));
-var_dump($c->setRepeatedWallTimeOption(array()));
-
var_dump($c->setSkippedWallTimeOption(3));
var_dump($c->setRepeatedWallTimeOption(2));
-var_dump(intlcal_set_skipped_wall_time_option($c));
-var_dump(intlcal_set_repeated_wall_time_option($c));
-
var_dump(intlcal_set_repeated_wall_time_option(1, 1));
--EXPECTF--
-Warning: IntlCalendar::setSkippedWallTimeOption() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlCalendar::setSkippedWallTimeOption(): intlcal_set_skipped_wall_time_option: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::setRepeatedWallTimeOption() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlCalendar::setRepeatedWallTimeOption(): intlcal_set_repeated_wall_time_option: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::setSkippedWallTimeOption() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlCalendar::setSkippedWallTimeOption(): intlcal_set_skipped_wall_time_option: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::setRepeatedWallTimeOption() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlCalendar::setRepeatedWallTimeOption(): intlcal_set_repeated_wall_time_option: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::setSkippedWallTimeOption() expects parameter 1 to be int, array given in %s on line %d
-
-Warning: IntlCalendar::setSkippedWallTimeOption(): intlcal_set_skipped_wall_time_option: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::setRepeatedWallTimeOption() expects parameter 1 to be int, array given in %s on line %d
-
-Warning: IntlCalendar::setRepeatedWallTimeOption(): intlcal_set_repeated_wall_time_option: bad arguments in %s on line %d
-bool(false)
-
Warning: IntlCalendar::setSkippedWallTimeOption(): intlcal_set_skipped_wall_time_option: invalid option in %s on line %d
bool(false)
Warning: IntlCalendar::setRepeatedWallTimeOption(): intlcal_set_repeated_wall_time_option: invalid option in %s on line %d
bool(false)
-Warning: intlcal_set_skipped_wall_time_option() expects exactly 2 parameters, 1 given in %s on line %d
-
-Warning: intlcal_set_skipped_wall_time_option(): intlcal_set_skipped_wall_time_option: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlcal_set_repeated_wall_time_option() expects exactly 2 parameters, 1 given in %s on line %d
-
-Warning: intlcal_set_repeated_wall_time_option(): intlcal_set_repeated_wall_time_option: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_set_repeated_wall_time_option() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_set_repeated_wall_time_option() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_set_repeated_wall_time_option(1, 1)
#1 {main}
diff --git a/ext/intl/tests/calendar_setTimeZone_basic.phpt b/ext/intl/tests/calendar_setTimeZone_basic.phpt
index 006df2b468..7e52589b81 100644
--- a/ext/intl/tests/calendar_setTimeZone_basic.phpt
+++ b/ext/intl/tests/calendar_setTimeZone_basic.phpt
@@ -20,13 +20,12 @@ echo "\n";
var_dump($intlcal->get(IntlCalendar::FIELD_ZONE_OFFSET));
intlcal_set_time_zone($intlcal,
- IntlTimeZone::createTimeZone('GMT+05:30'));
+ IntlTimeZone::createTimeZone('GMT+05:30'));
print_r($intlcal->getTimeZone()->getID());
echo "\n";
var_dump($intlcal->get(IntlCalendar::FIELD_ZONE_OFFSET));
?>
-==DONE==
--EXPECT--
Europe/Amsterdam
int(3600000)
@@ -34,4 +33,3 @@ GMT
int(0)
GMT+05:30
int(19800000)
-==DONE==
diff --git a/ext/intl/tests/calendar_setTimeZone_error.phpt b/ext/intl/tests/calendar_setTimeZone_error.phpt
index dee773d377..c44208d1ce 100644
--- a/ext/intl/tests/calendar_setTimeZone_error.phpt
+++ b/ext/intl/tests/calendar_setTimeZone_error.phpt
@@ -20,34 +20,31 @@ echo "error: $errno, $errstr\n";
set_error_handler('eh');
try {
- var_dump($c->setTimeZone($gmt, 2));
+ var_dump($c->setTimeZone($gmt, 2));
} catch (Error $ex) {
- echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
+ echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try {
- var_dump($c->setTimeZone());
+ var_dump($c->setTimeZone());
} catch (Error $ex) {
- echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
+ echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try{
- var_dump(intlcal_set_time_zone($c, 1, 2));
+ var_dump(intlcal_set_time_zone($c, 1, 2));
} catch (Error $ex) {
- echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
+ echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
try{
- var_dump(intlcal_set_time_zone(1, $gmt));
+ var_dump(intlcal_set_time_zone(1, $gmt));
} catch (Error $ex) {
- echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
+ echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n";
}
--EXPECT--
-error: 2, IntlCalendar::setTimeZone() expects exactly 1 parameter, 2 given
-error: 2, IntlCalendar::setTimeZone(): intlcal_set_time_zone: bad arguments
-bool(false)
-error: 2, IntlCalendar::setTimeZone() expects exactly 1 parameter, 0 given
-error: 2, IntlCalendar::setTimeZone(): intlcal_set_time_zone: bad arguments
-bool(false)
-error: 2, intlcal_set_time_zone() expects exactly 2 parameters, 3 given
-error: 2, intlcal_set_time_zone(): intlcal_set_time_zone: bad arguments
-bool(false)
-error: 0, Argument 1 passed to intlcal_set_time_zone() must be an instance of IntlCalendar, int given
+error: 0, IntlCalendar::setTimeZone() expects exactly 1 parameter, 2 given
+
+error: 0, IntlCalendar::setTimeZone() expects exactly 1 parameter, 0 given
+
+error: 0, intlcal_set_time_zone() expects exactly 2 parameters, 3 given
+
+error: 0, intlcal_set_time_zone() expects parameter 1 to be IntlCalendar, int given
diff --git a/ext/intl/tests/calendar_setTimeZone_variation1.phpt b/ext/intl/tests/calendar_setTimeZone_variation1.phpt
index b1cbb74edf..3c3dd3bdd8 100644
--- a/ext/intl/tests/calendar_setTimeZone_variation1.phpt
+++ b/ext/intl/tests/calendar_setTimeZone_variation1.phpt
@@ -21,10 +21,8 @@ echo "\n";
var_dump($intlcal->get(IntlCalendar::FIELD_ZONE_OFFSET));
?>
-==DONE==
--EXPECT--
Europe/Amsterdam
int(3600000)
Europe/Amsterdam
-int(3600000)
-==DONE== \ No newline at end of file
+int(3600000) \ No newline at end of file
diff --git a/ext/intl/tests/calendar_setTime_basic.phpt b/ext/intl/tests/calendar_setTime_basic.phpt
index c4d57be4b9..075ecaabb5 100644
--- a/ext/intl/tests/calendar_setTime_basic.phpt
+++ b/ext/intl/tests/calendar_setTime_basic.phpt
@@ -17,17 +17,15 @@ $intlcal = IntlCalendar::createInstance('UTC');
$intlcal->setTime($time * 1000);
var_dump(
- (float)$time*1000,
- $intlcal->getTime());
+ (float)$time*1000,
+ $intlcal->getTime());
$intlcal = IntlCalendar::createInstance('UTC');
intlcal_set_time($intlcal,$time * 1000);
var_dump(intlcal_get_time($intlcal));
?>
-==DONE==
--EXPECT--
float(1330473600000)
float(1330473600000)
-float(1330473600000)
-==DONE== \ No newline at end of file
+float(1330473600000) \ No newline at end of file
diff --git a/ext/intl/tests/calendar_setTime_error.phpt b/ext/intl/tests/calendar_setTime_error.phpt
index d3fa46c591..0fb906bc2f 100644
--- a/ext/intl/tests/calendar_setTime_error.phpt
+++ b/ext/intl/tests/calendar_setTime_error.phpt
@@ -10,30 +10,9 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-
-var_dump($c->setTime(1, 2));
-var_dump($c->setTime("jjj"));
-
-var_dump(intlcal_set_time($c, 1, 2));
var_dump(intlcal_set_time(1));
--EXPECTF--
-Warning: IntlCalendar::setTime() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlCalendar::setTime(): intlcal_set_time: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::setTime() expects parameter 1 to be float, string given in %s on line %d
-
-Warning: IntlCalendar::setTime(): intlcal_set_time: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlcal_set_time() expects exactly 2 parameters, 3 given in %s on line %d
-
-Warning: intlcal_set_time(): intlcal_set_time: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_set_time() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught ArgumentCountError: intlcal_set_time() expects exactly 2 parameters, 1 given in %s:%d
Stack trace:
#0 %s(%d): intlcal_set_time(1)
#1 {main}
diff --git a/ext/intl/tests/calendar_set_basic.phpt b/ext/intl/tests/calendar_set_basic.phpt
index 8eccb32da6..93378a7b3f 100644
--- a/ext/intl/tests/calendar_set_basic.phpt
+++ b/ext/intl/tests/calendar_set_basic.phpt
@@ -18,10 +18,8 @@ var_dump(intlcal_set($intlcal, IntlCalendar::FIELD_DAY_OF_MONTH, 3));
var_dump($intlcal->get(IntlCalendar::FIELD_DAY_OF_MONTH));
?>
-==DONE==
--EXPECT--
bool(true)
int(2)
bool(true)
-int(3)
-==DONE== \ No newline at end of file
+int(3) \ No newline at end of file
diff --git a/ext/intl/tests/calendar_set_error.phpt b/ext/intl/tests/calendar_set_error.phpt
index 5827ad41ec..77623147f5 100644
--- a/ext/intl/tests/calendar_set_error.phpt
+++ b/ext/intl/tests/calendar_set_error.phpt
@@ -12,24 +12,25 @@ ini_set("intl.error_level", E_WARNING);
$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-var_dump($c->set(1));
-var_dump($c->set(1, 2, 3, 4));
-var_dump($c->set(1, 2, 3, 4, 5, 6, 7));
+try {
+ $c->set(1, 2, 3, 4, 5, 6, 7);
+} catch (ArgumentCountError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+try {
+ $c->set(1, 2, 3, 4);
+} catch (ArgumentCountError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
var_dump($c->set(-1, 2));
var_dump(intlcal_set($c, -1, 2));
var_dump(intlcal_set(1, 2, 3));
--EXPECTF--
-Warning: IntlCalendar::set() expects at least 2 parameters, 1 given in %s on line %d
-
-Warning: IntlCalendar::set(): intlcal_set: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::set(): intlcal_set: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlCalendar::set(): intlcal_set: too many arguments in %s on line %d
-bool(false)
+IntlCalendar::set() expects at most 6 parameters, 7 given
+No variant with 4 arguments
Warning: IntlCalendar::set(): intlcal_set: invalid field in %s on line %d
bool(false)
@@ -37,7 +38,7 @@ bool(false)
Warning: intlcal_set(): intlcal_set: invalid field in %s on line %d
bool(false)
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_set() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_set() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_set(1, 2, 3)
#1 {main}
diff --git a/ext/intl/tests/calendar_set_variation1.phpt b/ext/intl/tests/calendar_set_variation1.phpt
index 20dfa53eb6..6a78cf213c 100644
--- a/ext/intl/tests/calendar_set_variation1.phpt
+++ b/ext/intl/tests/calendar_set_variation1.phpt
@@ -15,19 +15,18 @@ $intlcal = IntlCalendar::createInstance('UTC');
$intlcal->clear();
var_dump($intlcal->set(2012, 1, 29));
var_dump($intlcal->getTime(),
- strtotime('2012-02-29 00:00:00 +0000') * 1000.);
+ strtotime('2012-02-29 00:00:00 +0000') * 1000.);
//two minutes to midnight!
var_dump($intlcal->set(2012, 1, 29, 23, 58));
var_dump($intlcal->getTime(),
- strtotime('2012-02-29 23:58:00 +0000') * 1000.);
+ strtotime('2012-02-29 23:58:00 +0000') * 1000.);
var_dump($intlcal->set(2012, 1, 29, 23, 58, 31));
var_dump($intlcal->getTime(),
- strtotime('2012-02-29 23:58:31 +0000') * 1000.);
+ strtotime('2012-02-29 23:58:31 +0000') * 1000.);
?>
-==DONE==
--EXPECT--
bool(true)
float(1330473600000)
@@ -37,5 +36,4 @@ float(1330559880000)
float(1330559880000)
bool(true)
float(1330559911000)
-float(1330559911000)
-==DONE== \ No newline at end of file
+float(1330559911000) \ No newline at end of file
diff --git a/ext/intl/tests/calendar_toDateTime_basic.phpt b/ext/intl/tests/calendar_toDateTime_basic.phpt
index b7ffd31321..ad9b7c9eb6 100644
--- a/ext/intl/tests/calendar_toDateTime_basic.phpt
+++ b/ext/intl/tests/calendar_toDateTime_basic.phpt
@@ -16,8 +16,6 @@ $dt = $cal->toDateTime();
var_dump($dt->format("c"), $dt->getTimeZone()->getName());
?>
-==DONE==
--EXPECT--
string(25) "2012-05-17T17:35:36+01:00"
string(13) "Europe/Lisbon"
-==DONE==
diff --git a/ext/intl/tests/calendar_toDateTime_error.phpt b/ext/intl/tests/calendar_toDateTime_error.phpt
index 584bd28f65..ef799db610 100644
--- a/ext/intl/tests/calendar_toDateTime_error.phpt
+++ b/ext/intl/tests/calendar_toDateTime_error.phpt
@@ -9,11 +9,6 @@ if (!extension_loaded('intl'))
ini_set("intl.error_level", E_WARNING);
ini_set('date.timezone', 'Europe/Lisbon');
-$cal = new IntlGregorianCalendar();
-var_dump($cal->toDateTime(3));
-
-var_dump(intlcal_to_date_time($cal, 3));
-
$cal = new IntlGregorianCalendar("Etc/Unknown");
try {
var_dump($cal->toDateTime());
@@ -23,20 +18,10 @@ var_dump("exception: {$e->getMessage()}");
var_dump(intlcal_to_date_time(3));
--EXPECTF--
-Warning: IntlCalendar::toDateTime() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlCalendar::toDateTime(): intlcal_to_date_time: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlcal_to_date_time() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: intlcal_to_date_time(): intlcal_to_date_time: bad arguments in %s on line %d
-bool(false)
-
Warning: IntlCalendar::toDateTime(): intlcal_to_date_time: DateTimeZone constructor threw exception in %s on line %d
string(77) "exception: DateTimeZone::__construct(): Unknown or bad timezone (Etc/Unknown)"
-Fatal error: Uncaught TypeError: Argument 1 passed to intlcal_to_date_time() must be an instance of IntlCalendar, int given in %s:%d
+Fatal error: Uncaught TypeError: intlcal_to_date_time() expects parameter 1 to be IntlCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlcal_to_date_time(3)
#1 {main}
diff --git a/ext/intl/tests/collator_asort.phpt b/ext/intl/tests/collator_asort.phpt
index 0b3d0ee795..7f0af95079 100644
--- a/ext/intl/tests/collator_asort.phpt
+++ b/ext/intl/tests/collator_asort.phpt
@@ -31,7 +31,7 @@ function sort_arrays( $locale, $test_arrays, $sort_flag = Collator::SORT_REGULAR
$res_dump = "\n" . dump( $test_array ) .
"\n Result: " . dump( $res_val );
- // Preppend test signature to output string
+ // Preppend test signature to output string
$md5 = md5( $res_dump );
global $test_num;
diff --git a/ext/intl/tests/collator_asort_variant2.phpt b/ext/intl/tests/collator_asort_variant2.phpt
index 08725095b5..a5a16e5aeb 100644
--- a/ext/intl/tests/collator_asort_variant2.phpt
+++ b/ext/intl/tests/collator_asort_variant2.phpt
@@ -31,7 +31,7 @@ function sort_arrays( $locale, $test_arrays, $sort_flag = Collator::SORT_REGULAR
$res_dump = "\n" . dump( $test_array ) .
"\n Result: " . dump( $res_val );
- // Preppend test signature to output string
+ // Preppend test signature to output string
$md5 = md5( $res_dump );
global $test_num;
diff --git a/ext/intl/tests/collator_create2.phpt b/ext/intl/tests/collator_create2.phpt
index 292e3cebb5..27f0381992 100644
--- a/ext/intl/tests/collator_create2.phpt
+++ b/ext/intl/tests/collator_create2.phpt
@@ -22,7 +22,7 @@ function ut_main()
'',
'root',
'uk@currency=EURO',
- '12345678911131517192123252729313335373941434547495153575961636567697173757779818385878991939597991234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799'
+ '12345678911131517192123252729313335373941434547495153575961636567697173757779818385878991939597991234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799'
);
foreach( $locales as $locale )
diff --git a/ext/intl/tests/collator_create3.phpt b/ext/intl/tests/collator_create3.phpt
index 8d9308aca1..1060c72326 100644
--- a/ext/intl/tests/collator_create3.phpt
+++ b/ext/intl/tests/collator_create3.phpt
@@ -23,7 +23,7 @@ function ut_main()
'',
'root',
'uk@currency=EURO',
- '12345678911131517192123252729313335373941434547495153575961636567697173757779818385878991939597991234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799'
+ '12345678911131517192123252729313335373941434547495153575961636567697173757779818385878991939597991234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799'
);
foreach( $locales as $locale )
diff --git a/ext/intl/tests/collator_create4.phpt b/ext/intl/tests/collator_create4.phpt
index 509a89913b..dafeaf4e87 100644
--- a/ext/intl/tests/collator_create4.phpt
+++ b/ext/intl/tests/collator_create4.phpt
@@ -22,7 +22,7 @@ function ut_main()
'',
'root',
'uk@currency=EURO',
- '12345678911131517192123252729313335373941434547495153575961636567697173757779818385878991939597991234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799'
+ '12345678911131517192123252729313335373941434547495153575961636567697173757779818385878991939597991234567891113151719212325272931333537394143454749515357596163656769717375777981838587899193959799'
);
foreach( $locales as $locale )
diff --git a/ext/intl/tests/collator_get_sort_key.phpt b/ext/intl/tests/collator_get_sort_key.phpt
index 62cc3a7b11..b7cd8bb5ec 100644
--- a/ext/intl/tests/collator_get_sort_key.phpt
+++ b/ext/intl/tests/collator_get_sort_key.phpt
@@ -16,11 +16,11 @@ function sort_arrays( $locale, $data )
$coll = ut_coll_create( $locale );
- foreach($data as $value) {
- $res_val = ut_coll_get_sort_key( $coll, $value );
- $res_str .= "source: ".$value."\n".
- "key: ".bin2hex($res_val)."\n";
- }
+ foreach($data as $value) {
+ $res_val = ut_coll_get_sort_key( $coll, $value );
+ $res_str .= "source: ".$value."\n".
+ "key: ".bin2hex($res_val)."\n";
+ }
return $res_str;
}
@@ -32,9 +32,9 @@ function ut_main()
// Regular strings keys
$test_params = array(
- 'abc', 'abd', 'aaa',
- 'аа', 'а', 'z',
- '', null , '3',
+ 'abc', 'abd', 'aaa',
+ 'аа', 'а', 'z',
+ '', null , '3',
'y' , 'i' , 'k'
);
@@ -42,7 +42,7 @@ function ut_main()
// Sort a non-ASCII array using ru_RU locale.
$test_params = array(
- 'абг', 'абв', 'жжж', 'ÑÑŽÑ'
+ 'абг', 'абв', 'жжж', 'ÑÑŽÑ'
);
$res_str .= sort_arrays( 'ru_RU', $test_params );
diff --git a/ext/intl/tests/collator_get_sort_key_variant2.phpt b/ext/intl/tests/collator_get_sort_key_variant2.phpt
index 3c526fbc3c..ab3fc64e32 100644
--- a/ext/intl/tests/collator_get_sort_key_variant2.phpt
+++ b/ext/intl/tests/collator_get_sort_key_variant2.phpt
@@ -16,11 +16,11 @@ function sort_arrays( $locale, $data )
$coll = ut_coll_create( $locale );
- foreach($data as $value) {
- $res_val = ut_coll_get_sort_key( $coll, $value );
- $res_str .= "source: ".$value."\n".
- "key: ".bin2hex($res_val)."\n";
- }
+ foreach($data as $value) {
+ $res_val = ut_coll_get_sort_key( $coll, $value );
+ $res_str .= "source: ".$value."\n".
+ "key: ".bin2hex($res_val)."\n";
+ }
return $res_str;
}
@@ -32,9 +32,9 @@ function ut_main()
// Regular strings keys
$test_params = array(
- 'abc', 'abd', 'aaa',
- 'аа', 'а', 'z',
- '', null , '3',
+ 'abc', 'abd', 'aaa',
+ 'аа', 'а', 'z',
+ '', null , '3',
'y' , 'i' , 'k'
);
@@ -42,7 +42,7 @@ function ut_main()
// Sort a non-ASCII array using ru_RU locale.
$test_params = array(
- 'абг', 'абв', 'жжж', 'ÑÑŽÑ'
+ 'абг', 'абв', 'жжж', 'ÑÑŽÑ'
);
$res_str .= sort_arrays( 'ru_RU', $test_params );
diff --git a/ext/intl/tests/collator_get_sort_key_variant3.phpt b/ext/intl/tests/collator_get_sort_key_variant3.phpt
index f4cb88e3e7..9e84ad4168 100644
--- a/ext/intl/tests/collator_get_sort_key_variant3.phpt
+++ b/ext/intl/tests/collator_get_sort_key_variant3.phpt
@@ -16,11 +16,11 @@ function sort_arrays( $locale, $data )
$coll = ut_coll_create( $locale );
- foreach($data as $value) {
- $res_val = ut_coll_get_sort_key( $coll, $value );
- $res_str .= "source: ".$value."\n".
- "key: ".bin2hex($res_val)."\n";
- }
+ foreach($data as $value) {
+ $res_val = ut_coll_get_sort_key( $coll, $value );
+ $res_str .= "source: ".$value."\n".
+ "key: ".bin2hex($res_val)."\n";
+ }
return $res_str;
}
@@ -32,9 +32,9 @@ function ut_main()
// Regular strings keys
$test_params = array(
- 'abc', 'abd', 'aaa',
- 'аа', 'а', 'z',
- '', null , '3',
+ 'abc', 'abd', 'aaa',
+ 'аа', 'а', 'z',
+ '', null , '3',
'y' , 'i' , 'k'
);
@@ -42,7 +42,7 @@ function ut_main()
// Sort a non-ASCII array using ru_RU locale.
$test_params = array(
- 'абг', 'абв', 'жжж', 'ÑÑŽÑ'
+ 'абг', 'абв', 'жжж', 'ÑÑŽÑ'
);
$res_str .= sort_arrays( 'ru_RU', $test_params );
diff --git a/ext/intl/tests/collator_get_sort_key_variant4.phpt b/ext/intl/tests/collator_get_sort_key_variant4.phpt
index bd7af6a284..078a385d5c 100644
--- a/ext/intl/tests/collator_get_sort_key_variant4.phpt
+++ b/ext/intl/tests/collator_get_sort_key_variant4.phpt
@@ -16,11 +16,11 @@ function sort_arrays( $locale, $data )
$coll = ut_coll_create( $locale );
- foreach($data as $value) {
- $res_val = ut_coll_get_sort_key( $coll, $value );
- $res_str .= "source: ".$value."\n".
- "key: ".bin2hex($res_val)."\n";
- }
+ foreach($data as $value) {
+ $res_val = ut_coll_get_sort_key( $coll, $value );
+ $res_str .= "source: ".$value."\n".
+ "key: ".bin2hex($res_val)."\n";
+ }
return $res_str;
}
@@ -32,9 +32,9 @@ function ut_main()
// Regular strings keys
$test_params = array(
- 'abc', 'abd', 'aaa',
- 'аа', 'а', 'z',
- '', null , '3',
+ 'abc', 'abd', 'aaa',
+ 'аа', 'а', 'z',
+ '', null , '3',
'y' , 'i' , 'k'
);
@@ -42,7 +42,7 @@ function ut_main()
// Sort a non-ASCII array using ru_RU locale.
$test_params = array(
- 'абг', 'абв', 'жжж', 'ÑÑŽÑ'
+ 'абг', 'абв', 'жжж', 'ÑÑŽÑ'
);
$res_str .= sort_arrays( 'ru_RU', $test_params );
diff --git a/ext/intl/tests/collator_get_sort_key_variant5.phpt b/ext/intl/tests/collator_get_sort_key_variant5.phpt
index c7717389b7..38d96cf2d8 100644
--- a/ext/intl/tests/collator_get_sort_key_variant5.phpt
+++ b/ext/intl/tests/collator_get_sort_key_variant5.phpt
@@ -16,11 +16,11 @@ function sort_arrays( $locale, $data )
$coll = ut_coll_create( $locale );
- foreach($data as $value) {
- $res_val = ut_coll_get_sort_key( $coll, $value );
- $res_str .= "source: ".$value."\n".
- "key: ".bin2hex($res_val)."\n";
- }
+ foreach($data as $value) {
+ $res_val = ut_coll_get_sort_key( $coll, $value );
+ $res_str .= "source: ".$value."\n".
+ "key: ".bin2hex($res_val)."\n";
+ }
return $res_str;
}
@@ -32,9 +32,9 @@ function ut_main()
// Regular strings keys
$test_params = array(
- 'abc', 'abd', 'aaa',
- 'аа', 'а', 'z',
- '', null , '3',
+ 'abc', 'abd', 'aaa',
+ 'аа', 'а', 'z',
+ '', null , '3',
'y' , 'i' , 'k'
);
@@ -42,7 +42,7 @@ function ut_main()
// Sort a non-ASCII array using ru_RU locale.
$test_params = array(
- 'абг', 'абв', 'жжж', 'ÑÑŽÑ'
+ 'абг', 'абв', 'жжж', 'ÑÑŽÑ'
);
$res_str .= sort_arrays( 'ru_RU', $test_params );
diff --git a/ext/intl/tests/collator_get_sort_key_variant6.phpt b/ext/intl/tests/collator_get_sort_key_variant6.phpt
index 78c74f546a..54e7486816 100644
--- a/ext/intl/tests/collator_get_sort_key_variant6.phpt
+++ b/ext/intl/tests/collator_get_sort_key_variant6.phpt
@@ -16,11 +16,11 @@ function sort_arrays( $locale, $data )
$coll = ut_coll_create( $locale );
- foreach($data as $value) {
- $res_val = ut_coll_get_sort_key( $coll, $value );
- $res_str .= "source: ".$value."\n".
- "key: ".bin2hex($res_val)."\n";
- }
+ foreach($data as $value) {
+ $res_val = ut_coll_get_sort_key( $coll, $value );
+ $res_str .= "source: ".$value."\n".
+ "key: ".bin2hex($res_val)."\n";
+ }
return $res_str;
}
@@ -32,9 +32,9 @@ function ut_main()
// Regular strings keys
$test_params = array(
- 'abc', 'abd', 'aaa',
- 'аа', 'а', 'z',
- '', null , '3',
+ 'abc', 'abd', 'aaa',
+ 'аа', 'а', 'z',
+ '', null , '3',
'y' , 'i' , 'k'
);
@@ -42,7 +42,7 @@ function ut_main()
// Sort a non-ASCII array using ru_RU locale.
$test_params = array(
- 'абг', 'абв', 'жжж', 'ÑÑŽÑ'
+ 'абг', 'абв', 'жжж', 'ÑÑŽÑ'
);
$res_str .= sort_arrays( 'ru_RU', $test_params );
diff --git a/ext/intl/tests/collator_get_sort_key_variant7.phpt b/ext/intl/tests/collator_get_sort_key_variant7.phpt
index e009d0e663..8ac0154d4f 100644
--- a/ext/intl/tests/collator_get_sort_key_variant7.phpt
+++ b/ext/intl/tests/collator_get_sort_key_variant7.phpt
@@ -15,11 +15,11 @@ function sort_arrays( $locale, $data )
$coll = ut_coll_create( $locale );
- foreach($data as $value) {
- $res_val = ut_coll_get_sort_key( $coll, $value );
- $res_str .= "source: ".$value."\n".
- "key: ".bin2hex($res_val)."\n";
- }
+ foreach($data as $value) {
+ $res_val = ut_coll_get_sort_key( $coll, $value );
+ $res_str .= "source: ".$value."\n".
+ "key: ".bin2hex($res_val)."\n";
+ }
return $res_str;
}
@@ -31,9 +31,9 @@ function ut_main()
// Regular strings keys
$test_params = array(
- 'abc', 'abd', 'aaa',
- 'аа', 'а', 'z',
- '', null , '3',
+ 'abc', 'abd', 'aaa',
+ 'аа', 'а', 'z',
+ '', null , '3',
'y' , 'i' , 'k'
);
@@ -41,7 +41,7 @@ function ut_main()
// Sort a non-ASCII array using ru_RU locale.
$test_params = array(
- 'абг', 'абв', 'жжж', 'ÑÑŽÑ'
+ 'абг', 'абв', 'жжж', 'ÑÑŽÑ'
);
$res_str .= sort_arrays( 'ru_RU', $test_params );
diff --git a/ext/intl/tests/collator_sort.phpt b/ext/intl/tests/collator_sort.phpt
index 4f7a12352a..1c4cb78cc8 100644
--- a/ext/intl/tests/collator_sort.phpt
+++ b/ext/intl/tests/collator_sort.phpt
@@ -32,7 +32,7 @@ function sort_arrays( $locale, $arrays, $sort_flag = Collator::SORT_REGULAR )
$res_dump = "\n" . dump( $array ) .
"\n Result: " . dump( $res_val );
- // Preppend test signature to output string
+ // Preppend test signature to output string
$md5 = md5( $res_dump );
global $test_num;
diff --git a/ext/intl/tests/collator_sort_variant2.phpt b/ext/intl/tests/collator_sort_variant2.phpt
index abb302eda6..3838c881ad 100644
--- a/ext/intl/tests/collator_sort_variant2.phpt
+++ b/ext/intl/tests/collator_sort_variant2.phpt
@@ -32,7 +32,7 @@ function sort_arrays( $locale, $arrays, $sort_flag = Collator::SORT_REGULAR )
$res_dump = "\n" . dump( $array ) .
"\n Result: " . dump( $res_val );
- // Preppend test signature to output string
+ // Preppend test signature to output string
$md5 = md5( $res_dump );
global $test_num;
diff --git a/ext/intl/tests/cpbi_clone_equality.phpt b/ext/intl/tests/cpbi_clone_equality.phpt
index c62b452747..66cd96bbb9 100644
--- a/ext/intl/tests/cpbi_clone_equality.phpt
+++ b/ext/intl/tests/cpbi_clone_equality.phpt
@@ -25,9 +25,7 @@ $it_clone->setText($text2);
var_dump($it == $it_clone);
?>
-==DONE==
--EXPECT--
bool(true)
bool(false)
bool(true)
-==DONE==
diff --git a/ext/intl/tests/cpbi_getLastCodePoint_basic.phpt b/ext/intl/tests/cpbi_getLastCodePoint_basic.phpt
index 74a07a6292..a1c33cf230 100644
--- a/ext/intl/tests/cpbi_getLastCodePoint_basic.phpt
+++ b/ext/intl/tests/cpbi_getLastCodePoint_basic.phpt
@@ -20,30 +20,29 @@ var_dump($codepoint_it->getLastCodePoint());
//before the last read codepoint is moving backwards
$p = $codepoint_it->first();
while ($p != IntlBreakIterator::DONE) {
- $c = $codepoint_it->getLastCodePoint();
- if ($c > 0)
- var_dump(sprintf('U+%04X', $codepoint_it->getLastCodePoint()));
- else
- var_dump($c);
- //it's a post-increment operation as to the codepoint, i.e., it gives the codepoint
- //starting at the initial position and only then moves the pointer forward
- $p = $codepoint_it->next();
+ $c = $codepoint_it->getLastCodePoint();
+ if ($c > 0)
+ var_dump(sprintf('U+%04X', $codepoint_it->getLastCodePoint()));
+ else
+ var_dump($c);
+ //it's a post-increment operation as to the codepoint, i.e., it gives the codepoint
+ //starting at the initial position and only then moves the pointer forward
+ $p = $codepoint_it->next();
}
echo "Now backwards\n";
$p = $codepoint_it->last();
while ($p != IntlBreakIterator::DONE) {
- $c = $codepoint_it->getLastCodePoint();
- if ($c > 0)
- var_dump(sprintf('U+%04X', $codepoint_it->getLastCodePoint()));
- else
- var_dump($c);
- $p = $codepoint_it->previous();
+ $c = $codepoint_it->getLastCodePoint();
+ if ($c > 0)
+ var_dump(sprintf('U+%04X', $codepoint_it->getLastCodePoint()));
+ else
+ var_dump($c);
+ $p = $codepoint_it->previous();
}
?>
-==DONE==
--EXPECT--
int(-1)
int(-1)
@@ -79,4 +78,3 @@ string(6) "U+0E2D"
string(6) "U+0E27"
string(6) "U+0E31"
string(6) "U+0E15"
-==DONE==
diff --git a/ext/intl/tests/cpbi_getLastCodePoint_error.phpt b/ext/intl/tests/cpbi_getLastCodePoint_error.phpt
deleted file mode 100644
index 505a076ca3..0000000000
--- a/ext/intl/tests/cpbi_getLastCodePoint_error.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-IntlBreakIterator::getLastCodePoint(): bad args
---SKIPIF--
-<?php
-if (!extension_loaded('intl'))
- die('skip intl extension not enabled');
---FILE--
-<?php
-ini_set("intl.error_level", E_WARNING);
-
-$it = IntlBreakIterator::createCodePointInstance();
-var_dump($it->getLastCodePoint(array()));
---EXPECTF--
-Warning: IntlCodePointBreakIterator::getLastCodePoint() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlCodePointBreakIterator::getLastCodePoint(): cpbi_get_last_code_point: bad arguments in %s on line %d
-bool(false)
diff --git a/ext/intl/tests/cpbi_parts_iterator.phpt b/ext/intl/tests/cpbi_parts_iterator.phpt
index 4754c12371..329c88c8b9 100644
--- a/ext/intl/tests/cpbi_parts_iterator.phpt
+++ b/ext/intl/tests/cpbi_parts_iterator.phpt
@@ -15,12 +15,11 @@ $it = IntlBreakIterator::createCodePointInstance()->getPartsIterator();
$it->getBreakIterator()->setText($text);
foreach ($it as $k => $v) {
- echo "$k. $v (" . sprintf("U+%04X", $it->getBreakIterator()->getLastCodePoint()) .
- ") at {$it->getBreakIterator()->current()}\r\n";
+ echo "$k. $v (" . sprintf("U+%04X", $it->getBreakIterator()->getLastCodePoint()) .
+ ") at {$it->getBreakIterator()->current()}\r\n";
}
?>
-==DONE==
--EXPECT--
0. ต (U+0E15) at 3
1. ั (U+0E31) at 6
@@ -37,4 +36,3 @@ foreach ($it as $k => $v) {
12. ว (U+0E27) at 39
13. า (U+0E32) at 42
14. ม (U+0E21) at 45
-==DONE==
diff --git a/ext/intl/tests/dateformat___construct_bad_tz_cal.phpt b/ext/intl/tests/dateformat___construct_bad_tz_cal.phpt
index 255a1f484d..086bc01340 100644
--- a/ext/intl/tests/dateformat___construct_bad_tz_cal.phpt
+++ b/ext/intl/tests/dateformat___construct_bad_tz_cal.phpt
@@ -11,30 +11,28 @@ ini_set("intl.default_locale", "pt_PT");
ini_set("date.timezone", 'Atlantic/Azores');
function print_exception($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(new IntlDateFormatter(NULL, 0, 0, 'bad timezone'));
+ var_dump(new IntlDateFormatter(NULL, 0, 0, 'bad timezone'));
} catch (IntlException $e) {
- print_exception($e);
+ print_exception($e);
}
try {
- var_dump(new IntlDateFormatter(NULL, 0, 0, NULL, 3));
+ var_dump(new IntlDateFormatter(NULL, 0, 0, NULL, 3));
} catch (IntlException $e) {
- print_exception($e);
+ print_exception($e);
}
try {
- var_dump(new IntlDateFormatter(NULL, 0, 0, NULL, new stdclass));
+ var_dump(new IntlDateFormatter(NULL, 0, 0, NULL, new stdclass));
} catch (IntlException $e) {
- print_exception($e);
+ print_exception($e);
}
?>
-==DONE==
--EXPECTF--
-Exception: IntlDateFormatter::__construct(): datefmt_create: no such time zone: 'bad timezone' in %s on line %d
+Exception: IntlDateFormatter::__construct(): datefmt_create: No such time zone: 'bad timezone' in %s on line %d
-Exception: IntlDateFormatter::__construct(): datefmt_create: invalid value for calendar type; it must be one of IntlDateFormatter::TRADITIONAL (locale's default calendar) or IntlDateFormatter::GREGORIAN. Alternatively, it can be an IntlCalendar object in %s on line %d
+Exception: IntlDateFormatter::__construct(): datefmt_create: Invalid value for calendar type; it must be one of IntlDateFormatter::TRADITIONAL (locale's default calendar) or IntlDateFormatter::GREGORIAN. Alternatively, it can be an IntlCalendar object in %s on line %d
Exception: IntlDateFormatter::__construct(): datefmt_create: Invalid calendar argument; should be an integer or an IntlCalendar instance in %s on line %d
-==DONE==
diff --git a/ext/intl/tests/dateformat_bug65683.phpt b/ext/intl/tests/dateformat_bug65683.phpt
index d18cb4c3da..4d6cac9afa 100644
--- a/ext/intl/tests/dateformat_bug65683.phpt
+++ b/ext/intl/tests/dateformat_bug65683.phpt
@@ -10,7 +10,5 @@ $formatter = new IntlDateFormatter('en-US', IntlDateFormatter::FULL, IntlDateFor
var_dump($formatter->format(new DateTimeImmutable('2017-03-27 00:00:00 UTC'))) . "\n";
?>
-==DONE==
--EXPECTF--
string(%s) "Monday, March %d, 2017"
-==DONE==
diff --git a/ext/intl/tests/dateformat_bug71516.phpt b/ext/intl/tests/dateformat_bug71516.phpt
index 88ba9bf840..437e51d8cc 100644
--- a/ext/intl/tests/dateformat_bug71516.phpt
+++ b/ext/intl/tests/dateformat_bug71516.phpt
@@ -17,9 +17,7 @@ echo "Formatter with pattern: " . $badFormatter->getLocale() . PHP_EOL;
echo "Formatter with pattern set later: " . $badFormatter2->getLocale() . PHP_EOL;
?>
-==DONE==
--EXPECT--
Formatter without pattern: ru
Formatter with pattern: ru
Formatter with pattern set later: ru
-==DONE==
diff --git a/ext/intl/tests/dateformat_calendars.phpt b/ext/intl/tests/dateformat_calendars.phpt
index 275dba1c30..1483f61058 100644
--- a/ext/intl/tests/dateformat_calendars.phpt
+++ b/ext/intl/tests/dateformat_calendars.phpt
@@ -11,29 +11,29 @@ if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
ini_set("intl.error_level", E_WARNING);
$fmt1 = new IntlDateFormatter('en_US',
- IntlDateFormatter::FULL,
- IntlDateFormatter::FULL,
- 'GMT+05:12',
- IntlDateFormatter::TRADITIONAL);
+ IntlDateFormatter::FULL,
+ IntlDateFormatter::FULL,
+ 'GMT+05:12',
+ IntlDateFormatter::TRADITIONAL);
$fmt2 = new IntlDateFormatter('en_US',
- IntlDateFormatter::FULL,
- IntlDateFormatter::FULL,
- 'GMT+05:12',
- IntlDateFormatter::GREGORIAN);
+ IntlDateFormatter::FULL,
+ IntlDateFormatter::FULL,
+ 'GMT+05:12',
+ IntlDateFormatter::GREGORIAN);
$fmt3 = new IntlDateFormatter('en_US@calendar=hebrew',
- IntlDateFormatter::FULL,
- IntlDateFormatter::FULL,
- 'GMT+05:12',
- IntlDateFormatter::TRADITIONAL);
+ IntlDateFormatter::FULL,
+ IntlDateFormatter::FULL,
+ 'GMT+05:12',
+ IntlDateFormatter::TRADITIONAL);
var_dump($fmt1->format(strtotime('2012-01-01 00:00:00 +0000')));
var_dump($fmt2->format(strtotime('2012-01-01 00:00:00 +0000')));
var_dump($fmt3->format(strtotime('2012-01-01 00:00:00 +0000')));
new IntlDateFormatter('en_US@calendar=hebrew',
- IntlDateFormatter::FULL,
- IntlDateFormatter::FULL,
- 'GMT+05:12',
- -1);
+ IntlDateFormatter::FULL,
+ IntlDateFormatter::FULL,
+ 'GMT+05:12',
+ -1);
?>
==DONE==
--EXPECTF--
@@ -41,7 +41,7 @@ string(44) "Sunday, January 1, 2012 5:12:00 AM GMT+05:12"
string(44) "Sunday, January 1, 2012 5:12:00 AM GMT+05:12"
string(42) "Sunday, Tevet 6, 5772 5:12:00 AM GMT+05:12"
-Fatal error: Uncaught IntlException: IntlDateFormatter::__construct(): datefmt_create: invalid value for calendar type; it must be one of IntlDateFormatter::TRADITIONAL (locale's default calendar) or IntlDateFormatter::GREGORIAN. Alternatively, it can be an IntlCalendar object in %sdateformat_calendars.php:%d
+Fatal error: Uncaught IntlException: IntlDateFormatter::__construct(): datefmt_create: Invalid value for calendar type; it must be one of IntlDateFormatter::TRADITIONAL (locale's default calendar) or IntlDateFormatter::GREGORIAN. Alternatively, it can be an IntlCalendar object in %sdateformat_calendars.php:%d
Stack trace:
#0 %sdateformat_calendars.php(%d): IntlDateFormatter->__construct('en_US@calendar=...', 0, 0, 'GMT+05:12', -1)
#1 {main}
diff --git a/ext/intl/tests/dateformat_calendars_variant2.phpt b/ext/intl/tests/dateformat_calendars_variant2.phpt
index fe4493aa7f..895d39094a 100644
--- a/ext/intl/tests/dateformat_calendars_variant2.phpt
+++ b/ext/intl/tests/dateformat_calendars_variant2.phpt
@@ -12,29 +12,29 @@ if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
ini_set("intl.error_level", E_WARNING);
$fmt1 = new IntlDateFormatter('en_US',
- IntlDateFormatter::FULL,
- IntlDateFormatter::FULL,
- 'GMT+05:12',
- IntlDateFormatter::TRADITIONAL);
+ IntlDateFormatter::FULL,
+ IntlDateFormatter::FULL,
+ 'GMT+05:12',
+ IntlDateFormatter::TRADITIONAL);
$fmt2 = new IntlDateFormatter('en_US',
- IntlDateFormatter::FULL,
- IntlDateFormatter::FULL,
- 'GMT+05:12',
- IntlDateFormatter::GREGORIAN);
+ IntlDateFormatter::FULL,
+ IntlDateFormatter::FULL,
+ 'GMT+05:12',
+ IntlDateFormatter::GREGORIAN);
$fmt3 = new IntlDateFormatter('en_US@calendar=hebrew',
- IntlDateFormatter::FULL,
- IntlDateFormatter::FULL,
- 'GMT+05:12',
- IntlDateFormatter::TRADITIONAL);
+ IntlDateFormatter::FULL,
+ IntlDateFormatter::FULL,
+ 'GMT+05:12',
+ IntlDateFormatter::TRADITIONAL);
var_dump($fmt1->format(strtotime('2012-01-01 00:00:00 +0000')));
var_dump($fmt2->format(strtotime('2012-01-01 00:00:00 +0000')));
var_dump($fmt3->format(strtotime('2012-01-01 00:00:00 +0000')));
new IntlDateFormatter('en_US@calendar=hebrew',
- IntlDateFormatter::FULL,
- IntlDateFormatter::FULL,
- 'GMT+05:12',
- -1);
+ IntlDateFormatter::FULL,
+ IntlDateFormatter::FULL,
+ 'GMT+05:12',
+ -1);
?>
==DONE==
--EXPECTF--
@@ -42,7 +42,7 @@ string(47) "Sunday, January 1, 2012 at 5:12:00 AM GMT+05:12"
string(47) "Sunday, January 1, 2012 at 5:12:00 AM GMT+05:12"
string(48) "Sunday, Tevet 6, 5772 AM at 5:12:00 AM GMT+05:12"
-Fatal error: Uncaught IntlException: IntlDateFormatter::__construct(): datefmt_create: invalid value for calendar type; it must be one of IntlDateFormatter::TRADITIONAL (locale's default calendar) or IntlDateFormatter::GREGORIAN. Alternatively, it can be an IntlCalendar object in %sdateformat_calendars_variant2.php:27
+Fatal error: Uncaught IntlException: IntlDateFormatter::__construct(): datefmt_create: Invalid value for calendar type; it must be one of IntlDateFormatter::TRADITIONAL (locale's default calendar) or IntlDateFormatter::GREGORIAN. Alternatively, it can be an IntlCalendar object in %sdateformat_calendars_variant2.php:27
Stack trace:
#0 %sdateformat_calendars_variant2.php(27): IntlDateFormatter->__construct('en_US@calendar=...', 0, 0, 'GMT+05:12', -1)
#1 {main}
diff --git a/ext/intl/tests/dateformat_calendars_variant3.phpt b/ext/intl/tests/dateformat_calendars_variant3.phpt
index d5bdac7fcd..99e153e290 100644
--- a/ext/intl/tests/dateformat_calendars_variant3.phpt
+++ b/ext/intl/tests/dateformat_calendars_variant3.phpt
@@ -11,29 +11,29 @@ if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
ini_set("intl.error_level", E_WARNING);
$fmt1 = new IntlDateFormatter('en_US',
- IntlDateFormatter::FULL,
- IntlDateFormatter::FULL,
- 'GMT+05:12',
- IntlDateFormatter::TRADITIONAL);
+ IntlDateFormatter::FULL,
+ IntlDateFormatter::FULL,
+ 'GMT+05:12',
+ IntlDateFormatter::TRADITIONAL);
$fmt2 = new IntlDateFormatter('en_US',
- IntlDateFormatter::FULL,
- IntlDateFormatter::FULL,
- 'GMT+05:12',
- IntlDateFormatter::GREGORIAN);
+ IntlDateFormatter::FULL,
+ IntlDateFormatter::FULL,
+ 'GMT+05:12',
+ IntlDateFormatter::GREGORIAN);
$fmt3 = new IntlDateFormatter('en_US@calendar=hebrew',
- IntlDateFormatter::FULL,
- IntlDateFormatter::FULL,
- 'GMT+05:12',
- IntlDateFormatter::TRADITIONAL);
+ IntlDateFormatter::FULL,
+ IntlDateFormatter::FULL,
+ 'GMT+05:12',
+ IntlDateFormatter::TRADITIONAL);
var_dump($fmt1->format(strtotime('2012-01-01 00:00:00 +0000')));
var_dump($fmt2->format(strtotime('2012-01-01 00:00:00 +0000')));
var_dump($fmt3->format(strtotime('2012-01-01 00:00:00 +0000')));
new IntlDateFormatter('en_US@calendar=hebrew',
- IntlDateFormatter::FULL,
- IntlDateFormatter::FULL,
- 'GMT+05:12',
- -1);
+ IntlDateFormatter::FULL,
+ IntlDateFormatter::FULL,
+ 'GMT+05:12',
+ -1);
?>
==DONE==
--EXPECTF--
@@ -41,7 +41,7 @@ string(47) "Sunday, January 1, 2012 at 5:12:00 AM GMT+05:12"
string(47) "Sunday, January 1, 2012 at 5:12:00 AM GMT+05:12"
string(44) "Sunday, 6 Tevet 5772 at 5:12:00 AM GMT+05:12"
-Fatal error: Uncaught IntlException: IntlDateFormatter::__construct(): datefmt_create: invalid value for calendar type; it must be one of IntlDateFormatter::TRADITIONAL (locale's default calendar) or IntlDateFormatter::GREGORIAN. Alternatively, it can be an IntlCalendar object in %sdateformat_calendars_variant3.php:27
+Fatal error: Uncaught IntlException: IntlDateFormatter::__construct(): datefmt_create: Invalid value for calendar type; it must be one of IntlDateFormatter::TRADITIONAL (locale's default calendar) or IntlDateFormatter::GREGORIAN. Alternatively, it can be an IntlCalendar object in %sdateformat_calendars_variant3.php:27
Stack trace:
#0 %sdateformat_calendars_variant3.php(%d): IntlDateFormatter->__construct('en_US@calendar=...', 0, 0, 'GMT+05:12', -1)
#1 {main}
diff --git a/ext/intl/tests/dateformat_clone_bad_obj.phpt b/ext/intl/tests/dateformat_clone_bad_obj.phpt
index f9791004f3..3425a1b0f8 100644
--- a/ext/intl/tests/dateformat_clone_bad_obj.phpt
+++ b/ext/intl/tests/dateformat_clone_bad_obj.phpt
@@ -6,14 +6,14 @@ Cloning unconstructed IntlDateFormatter
<?php
class A extends IntlDateFormatter {
- function __construct() {}
+ function __construct() {}
}
$a = new A;
try {
- $b = clone $a;
+ $b = clone $a;
} catch (Exception $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
--EXPECTF--
string(%s) "Cannot clone unconstructed IntlDateFormatter"
diff --git a/ext/intl/tests/dateformat_create_cal_arg.phpt b/ext/intl/tests/dateformat_create_cal_arg.phpt
index 182ac9a3a0..be7ae38cab 100644
--- a/ext/intl/tests/dateformat_create_cal_arg.phpt
+++ b/ext/intl/tests/dateformat_create_cal_arg.phpt
@@ -41,7 +41,6 @@ $df = new IntlDateFormatter('es_ES', 0, 0, 'UTC', 0);
echo $df->format($ts), "\n";
?>
-==DONE==
--EXPECTF--
domingo%S 1 de enero de 2012 00:00:00 GMT
domingo%S 8 de Safar de 1433 00:00:00 GMT
@@ -50,4 +49,3 @@ sábado%S 31 de diciembre de 2011 d.C. 23:00:00 Hora %Sde las Azores
sábado%S 7 de Safar de 1433 AH 23:00:00 Hora %Sde las Azores
domingo%S 8 de Safar de 1433 AH 00:00:00 GMT
domingo%S 1 de enero de 2012 00:00:00 GMT
-==DONE==
diff --git a/ext/intl/tests/dateformat_create_cal_arg_variant2.phpt b/ext/intl/tests/dateformat_create_cal_arg_variant2.phpt
index 77ec53047b..df6dc9014d 100644
--- a/ext/intl/tests/dateformat_create_cal_arg_variant2.phpt
+++ b/ext/intl/tests/dateformat_create_cal_arg_variant2.phpt
@@ -41,7 +41,6 @@ $df = new IntlDateFormatter('es_ES', 0, 0, 'UTC', 0);
echo $df->format($ts), "\n";
?>
-==DONE==
--EXPECTF--
domingo%S 1 de enero de 2012 00:00:00 GMT
domingo%S 8 de Safar de 1433 00:00:00 GMT
@@ -50,4 +49,3 @@ sábado%S 31 de diciembre de 2011 d.C. 23:00:00 Hora %Sde las Azores
sábado%S 7 de Safar de 1433 AH 23:00:00 Hora %Sde las Azores
domingo%S 8 de Safar de 1433 AH 00:00:00 GMT
domingo%S 1 de enero de 2012 00:00:00 GMT
-==DONE==
diff --git a/ext/intl/tests/dateformat_create_cal_arg_variant3.phpt b/ext/intl/tests/dateformat_create_cal_arg_variant3.phpt
index 1beff145de..4b7f80b25d 100644
--- a/ext/intl/tests/dateformat_create_cal_arg_variant3.phpt
+++ b/ext/intl/tests/dateformat_create_cal_arg_variant3.phpt
@@ -42,7 +42,6 @@ $df = new IntlDateFormatter('es_ES', 0, 0, 'UTC', 0);
echo $df->format($ts), "\n";
?>
-==DONE==
--EXPECTF--
domingo%S 1 de enero de 2012, 0:00:00 (GMT)
domingo%S 8 de Safar de 1433, 0:00:00 (GMT)
@@ -51,4 +50,3 @@ sábado%S 31 de diciembre de 2011 d. C., 23:00:00 (Hora estándar %Sde las Azore
sábado%S 7 de Safar de 1433 AH, 23:00:00 (Hora estándar %Sde las Azores)
domingo%S 8 de Safar de 1433 AH, 0:00:00 (GMT)
domingo%S 1 de enero de 2012, 0:00:00 (GMT)
-==DONE==
diff --git a/ext/intl/tests/dateformat_create_cal_arg_variant4.phpt b/ext/intl/tests/dateformat_create_cal_arg_variant4.phpt
index 861ee51965..a60d77363b 100644
--- a/ext/intl/tests/dateformat_create_cal_arg_variant4.phpt
+++ b/ext/intl/tests/dateformat_create_cal_arg_variant4.phpt
@@ -42,7 +42,6 @@ $df = new IntlDateFormatter('es_ES', 0, 0, 'UTC', 0);
echo $df->format($ts), "\n";
?>
-==DONE==
--EXPECTF--
domingo%S 1 de enero de 2012, 0:00:00 (GMT)
domingo%S 8 de Safar de 1433, 0:00:00 (GMT)
@@ -51,4 +50,3 @@ sábado, 31 de diciembre de 2011 d. C., 23:00:00 (hora estándar de las Azores)
sábado, 7 de Safar de 1433 AH, 23:00:00 (hora estándar de las Azores)
domingo%S 8 de Safar de 1433 AH, 0:00:00 (GMT)
domingo%S 1 de enero de 2012, 0:00:00 (GMT)
-==DONE==
diff --git a/ext/intl/tests/dateformat_create_cal_arg_variant5.phpt b/ext/intl/tests/dateformat_create_cal_arg_variant5.phpt
index 8e94d42867..372a3178a1 100644
--- a/ext/intl/tests/dateformat_create_cal_arg_variant5.phpt
+++ b/ext/intl/tests/dateformat_create_cal_arg_variant5.phpt
@@ -41,7 +41,6 @@ $df = new IntlDateFormatter('es_ES', 0, 0, 'UTC', 0);
echo $df->format($ts), "\n";
?>
-==DONE==
--EXPECTF--
domingo%S 1 de enero de 2012, 0:00:00 (%siempo %sniversal %sordinado)
domingo%S 8 de %safar de 1433, 0:00:00 (%siempo %sniversal %sordinado)
@@ -50,4 +49,3 @@ sábado, 31 de diciembre de 2011 d. C., 23:00:00 (hora estándar de las Azores)
sábado, 7 de %safar de 1433 AH, 23:00:00 (hora estándar de las Azores)
domingo%S 8 de %safar de 1433 AH, 0:00:00 (%siempo %sniversal %sordinado)
domingo%S 1 de enero de 2012, 0:00:00 (%siempo %sniversal %sordinado)
-==DONE==
diff --git a/ext/intl/tests/dateformat_format.phpt b/ext/intl/tests/dateformat_format.phpt
index 5b121558a0..9cdb69b848 100644
--- a/ext/intl/tests/dateformat_format.phpt
+++ b/ext/intl/tests/dateformat_format.phpt
@@ -15,13 +15,13 @@ datefmt_format_code()
function ut_main()
{
- $timezone = 'GMT-10:00';
+ $timezone = 'GMT-10:00';
- $locale_arr = array (
- 'en_US'
- );
+ $locale_arr = array (
+ 'en_US'
+ );
- $datetype_arr = array (
+ $datetype_arr = array (
IntlDateFormatter::FULL,
IntlDateFormatter::LONG,
IntlDateFormatter::MEDIUM,
@@ -32,34 +32,34 @@ function ut_main()
$res_str = '';
- $time_arr = array (
- 0,
- -1200000,
- 1200000,
- 2200000000.0,
- -2200000000.0,
- 90099999,
- 3600,
- -3600
- );
-
- $localtime_arr1 = array (
- 'tm_sec' => 24 ,
- 'tm_min' => 3,
- 'tm_hour' => 19,
- 'tm_mday' => 3,
- 'tm_mon' => 3,
- 'tm_year' => 105,
- );
- $localtime_arr2 = array (
- 'tm_sec' => 21,
- 'tm_min' => 5,
- 'tm_hour' => 7,
- 'tm_mday' => 13,
- 'tm_mon' => 4,
- 'tm_year' => 205,
- );
- $localtime_arr3 = array (
+ $time_arr = array (
+ 0,
+ -1200000,
+ 1200000,
+ 2200000000.0,
+ -2200000000.0,
+ 90099999,
+ 3600,
+ -3600
+ );
+
+ $localtime_arr1 = array (
+ 'tm_sec' => 24 ,
+ 'tm_min' => 3,
+ 'tm_hour' => 19,
+ 'tm_mday' => 3,
+ 'tm_mon' => 3,
+ 'tm_year' => 105,
+ );
+ $localtime_arr2 = array (
+ 'tm_sec' => 21,
+ 'tm_min' => 5,
+ 'tm_hour' => 7,
+ 'tm_mday' => 13,
+ 'tm_mon' => 4,
+ 'tm_year' => 205,
+ );
+ $localtime_arr3 = array (
'tm_sec' => 11,
'tm_min' => 13,
'tm_hour' => 0,
@@ -68,80 +68,80 @@ function ut_main()
'tm_year' => -5
);
- $localtime_arr = array (
- $localtime_arr1,
- $localtime_arr2,
- $localtime_arr3
- );
-
- $d1 = new DateTime("2010-01-01 01:02:03", new DateTimeZone("UTC"));
- $d2 = new DateTime("2000-12-31 03:04:05", new DateTimeZone("UTC"));
- $d2->setTimezone(new DateTimeZone("PDT"));
- $dates = array(
- $d1,
- $d2,
- new StdClass(),
- );
-
- //Test format with input as a timestamp : integer
- foreach( $time_arr as $timestamp_entry){
- $res_str .= "\n------------\n";
- $res_str .= "\nInput timestamp is : $timestamp_entry";
- $res_str .= "\n------------\n";
- foreach( $locale_arr as $locale_entry ){
- foreach( $datetype_arr as $datetype_entry )
- {
- $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry ";
- $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN);
- $formatted = ut_datefmt_format( $fmt , $timestamp_entry);
- $res_str .= "\nFormatted timestamp is : $formatted";
- }
- }
- }
-
- //Test format with input as a localtime :array
- foreach( $localtime_arr as $localtime_entry){
- $res_str .= "\n------------\n";
- $res_str .= "\nInput localtime is : ";
- foreach( $localtime_entry as $key => $value){
+ $localtime_arr = array (
+ $localtime_arr1,
+ $localtime_arr2,
+ $localtime_arr3
+ );
+
+ $d1 = new DateTime("2010-01-01 01:02:03", new DateTimeZone("UTC"));
+ $d2 = new DateTime("2000-12-31 03:04:05", new DateTimeZone("UTC"));
+ $d2->setTimezone(new DateTimeZone("PDT"));
+ $dates = array(
+ $d1,
+ $d2,
+ new StdClass(),
+ );
+
+ //Test format with input as a timestamp : integer
+ foreach( $time_arr as $timestamp_entry){
+ $res_str .= "\n------------\n";
+ $res_str .= "\nInput timestamp is : $timestamp_entry";
+ $res_str .= "\n------------\n";
+ foreach( $locale_arr as $locale_entry ){
+ foreach( $datetype_arr as $datetype_entry )
+ {
+ $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry ";
+ $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN);
+ $formatted = ut_datefmt_format( $fmt , $timestamp_entry);
+ $res_str .= "\nFormatted timestamp is : $formatted";
+ }
+ }
+ }
+
+ //Test format with input as a localtime :array
+ foreach( $localtime_arr as $localtime_entry){
+ $res_str .= "\n------------\n";
+ $res_str .= "\nInput localtime is : ";
+ foreach( $localtime_entry as $key => $value){
$res_str .= "$key : '$value' , ";
- }
-
- $res_str .= "\n------------\n";
- foreach( $locale_arr as $locale_entry ){
- foreach( $datetype_arr as $datetype_entry )
- {
- $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry ";
- $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN );
- $formatted1 = ut_datefmt_format( $fmt , $localtime_entry);
- if( intl_get_error_code() == U_ZERO_ERROR){
- $res_str .= "\nFormatted localtime_array is : $formatted1";
- }else{
- $res_str .= "\nError while formatting as: '".intl_get_error_message()."'";
- }
- }
- }
- }
-
- foreach($dates as $date_entry) {
- foreach( $locale_arr as $locale_entry ){
- foreach( $datetype_arr as $datetype_entry ) {
- $res_str .= "\n------------";
- $res_str .= "\nDate is: ".var_export($date_entry, true);
- $res_str .= "\n------------";
-
- $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN );
- $formatted1 = ut_datefmt_format( $fmt , $date_entry);
- if( intl_get_error_code() == U_ZERO_ERROR){
- $res_str .= "\nFormatted DateTime is : $formatted1";
- }else{
- $res_str .= "\nError while formatting as: '".intl_get_error_message()."'";
- }
- }
- }
- }
-
- return $res_str;
+ }
+
+ $res_str .= "\n------------\n";
+ foreach( $locale_arr as $locale_entry ){
+ foreach( $datetype_arr as $datetype_entry )
+ {
+ $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry ";
+ $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN );
+ $formatted1 = ut_datefmt_format( $fmt , $localtime_entry);
+ if( intl_get_error_code() == U_ZERO_ERROR){
+ $res_str .= "\nFormatted localtime_array is : $formatted1";
+ }else{
+ $res_str .= "\nError while formatting as: '".intl_get_error_message()."'";
+ }
+ }
+ }
+ }
+
+ foreach($dates as $date_entry) {
+ foreach( $locale_arr as $locale_entry ){
+ foreach( $datetype_arr as $datetype_entry ) {
+ $res_str .= "\n------------";
+ $res_str .= "\nDate is: ".var_export($date_entry, true);
+ $res_str .= "\n------------";
+
+ $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN );
+ $formatted1 = ut_datefmt_format( $fmt , $date_entry);
+ if( intl_get_error_code() == U_ZERO_ERROR){
+ $res_str .= "\nFormatted DateTime is : $formatted1";
+ }else{
+ $res_str .= "\nError while formatting as: '".intl_get_error_message()."'";
+ }
+ }
+ }
+ }
+
+ return $res_str;
}
diff --git a/ext/intl/tests/dateformat_formatObject_calendar.phpt b/ext/intl/tests/dateformat_formatObject_calendar.phpt
index 11f0fe0137..7d0b96ff7a 100644
--- a/ext/intl/tests/dateformat_formatObject_calendar.phpt
+++ b/ext/intl/tests/dateformat_formatObject_calendar.phpt
@@ -26,7 +26,6 @@ echo IntlDateFormatter::formatObject($cal), "\n";
echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL, "en-US"), "\n";
?>
-==DONE==
--EXPECTF--
01/01/2012 00:00:00
Domingo, 1 de Janeiro de 2012 0:00:00 Hora %Sda Europa Ocidental
@@ -36,4 +35,3 @@ Sun 2012-01-1 00,00,00.000 Portugal Time (Lisbon)
Domingo, 1 de Janeiro de 2012 5:00:00 GMT+03:00
06/02/1433 00:00:00
Sunday, Safar 6, 1433 12:00:00 AM Western European %STime
-==DONE==
diff --git a/ext/intl/tests/dateformat_formatObject_calendar_variant2.phpt b/ext/intl/tests/dateformat_formatObject_calendar_variant2.phpt
index 7d308df6b0..88a7133753 100644
--- a/ext/intl/tests/dateformat_formatObject_calendar_variant2.phpt
+++ b/ext/intl/tests/dateformat_formatObject_calendar_variant2.phpt
@@ -26,7 +26,6 @@ echo IntlDateFormatter::formatObject($cal), "\n";
echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL, "en-US"), "\n";
?>
-==DONE==
--EXPECTF--
01/01/2012, 00:00:00
Domingo, 1 de Janeiro de 2012 às 00:00:00 Hora %Sda Europa Ocidental
@@ -36,4 +35,3 @@ Sun 2012-01-1 00,00,00.000 Portugal Time
Domingo, 1 de Janeiro de 2012 às 05:00:00 GMT+03:00
06/02/1433, 00:00:00
Sunday, Safar 6, 1433 at 12:00:00 AM Western European Standard Time
-==DONE==
diff --git a/ext/intl/tests/dateformat_formatObject_calendar_variant3.phpt b/ext/intl/tests/dateformat_formatObject_calendar_variant3.phpt
index 33d2c8bfbf..ea24386a89 100644
--- a/ext/intl/tests/dateformat_formatObject_calendar_variant3.phpt
+++ b/ext/intl/tests/dateformat_formatObject_calendar_variant3.phpt
@@ -27,7 +27,6 @@ echo IntlDateFormatter::formatObject($cal), "\n";
echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL, "en-US"), "\n";
?>
-==DONE==
--EXPECTF--
01/01/2012, 00:00:00
domingo, 1 de Janeiro de 2012 às 00:00:00 Hora Padrão %Sda Europa Ocidental
@@ -37,4 +36,3 @@ Sun 2012-01-1 00,00,00.000 Portugal Time
domingo, 1 de Janeiro de 2012 às 05:00:00 GMT+03:00
06/02/1433, 00:00:00
Sunday, Safar 6, 1433 at 12:00:00 AM Western European Standard Time
-==DONE==
diff --git a/ext/intl/tests/dateformat_formatObject_calendar_variant4.phpt b/ext/intl/tests/dateformat_formatObject_calendar_variant4.phpt
index 141ea9c806..3637f9c80e 100644
--- a/ext/intl/tests/dateformat_formatObject_calendar_variant4.phpt
+++ b/ext/intl/tests/dateformat_formatObject_calendar_variant4.phpt
@@ -27,7 +27,6 @@ echo IntlDateFormatter::formatObject($cal), "\n";
echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL, "en-US"), "\n";
?>
-==DONE==
--EXPECTF--
01/01/2012, 00:00:00
domingo, 1 de janeiro de 2012 às 00:00:00 Hora Padrão %Sda Europa Ocidental
@@ -37,4 +36,3 @@ Sun 2012-01-1 00,00,00.000 Portugal Time
domingo, 1 de janeiro de 2012 às 05:00:00 GMT+03:00
06/02/1433, 00:00:00
Sunday, Safar 6, 1433 at 12:00:00 AM Western European Standard Time
-==DONE==
diff --git a/ext/intl/tests/dateformat_formatObject_calendar_variant5.phpt b/ext/intl/tests/dateformat_formatObject_calendar_variant5.phpt
index c8fd0535d8..a6757105f9 100644
--- a/ext/intl/tests/dateformat_formatObject_calendar_variant5.phpt
+++ b/ext/intl/tests/dateformat_formatObject_calendar_variant5.phpt
@@ -26,7 +26,6 @@ echo IntlDateFormatter::formatObject($cal), "\n";
echo IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL, "en-US"), "\n";
?>
-==DONE==
--EXPECTF--
01/01/2012, 00:00:00
domingo, 1 de janeiro de 2012 às 00:00:00 Hora padrão %Sda Europa Ocidental
@@ -36,4 +35,3 @@ Sun 2012-01-1 00,00,00.000 Portugal Time
domingo, 1 de janeiro de 2012 às 05:00:00 GMT+03:00
06/02/1433, 00:00:00
Sunday, Safar 6, 1433 at 12:00:00 AM Western European Standard Time
-==DONE==
diff --git a/ext/intl/tests/dateformat_formatObject_datetime.phpt b/ext/intl/tests/dateformat_formatObject_datetime.phpt
index 279a132478..25048e18f8 100644
--- a/ext/intl/tests/dateformat_formatObject_datetime.phpt
+++ b/ext/intl/tests/dateformat_formatObject_datetime.phpt
@@ -21,7 +21,6 @@ $dt = new DateTime('2012-01-01 05:00:00+03:00');
echo IntlDateFormatter::formatObject($dt, IntlDateFormatter::FULL), "\n";
?>
-==DONE==
--EXPECTF--
01/01/2012 00:00:00
Domingo, 1 de Janeiro de 2012 0:00:00 Hora %Sda Europa Ocidental
@@ -29,4 +28,3 @@ Jan 1, 2012 12:00:00 AM
1/1/12 12:00:00 AM Western European %STime
Sun 2012-01-1 00,00,00.000 Portugal Time (Lisbon)
Domingo, 1 de Janeiro de 2012 5:00:00 GMT+03:00
-==DONE==
diff --git a/ext/intl/tests/dateformat_formatObject_datetime_variant2.phpt b/ext/intl/tests/dateformat_formatObject_datetime_variant2.phpt
index 67aee94947..3ff695e752 100644
--- a/ext/intl/tests/dateformat_formatObject_datetime_variant2.phpt
+++ b/ext/intl/tests/dateformat_formatObject_datetime_variant2.phpt
@@ -21,7 +21,6 @@ $dt = new DateTime('2012-01-01 05:00:00+03:00');
echo IntlDateFormatter::formatObject($dt, IntlDateFormatter::FULL), "\n";
?>
-==DONE==
--EXPECTF--
01/01/2012, 00:00:00
Domingo, 1 de Janeiro de 2012 às 00:00:00 Hora %Sda Europa Ocidental
@@ -29,4 +28,3 @@ Jan 1, 2012, 12:00:00 AM
1/1/12, 12:00:00 AM Western European Standard %STime
Sun 2012-01-1 00,00,00.000 Portugal Time
Domingo, 1 de Janeiro de 2012 às 05:00:00 GMT+03:00
-==DONE==
diff --git a/ext/intl/tests/dateformat_formatObject_datetime_variant3.phpt b/ext/intl/tests/dateformat_formatObject_datetime_variant3.phpt
index 7ddacfa25a..a64efad8ae 100644
--- a/ext/intl/tests/dateformat_formatObject_datetime_variant3.phpt
+++ b/ext/intl/tests/dateformat_formatObject_datetime_variant3.phpt
@@ -22,7 +22,6 @@ $dt = new DateTime('2012-01-01 05:00:00+03:00');
echo IntlDateFormatter::formatObject($dt, IntlDateFormatter::FULL), "\n";
?>
-==DONE==
--EXPECTF--
01/01/2012, 00:00:00
domingo, 1 de Janeiro de 2012 às 00:00:00 Hora Padrão %Sda Europa Ocidental
@@ -30,4 +29,3 @@ Jan 1, 2012, 12:00:00 AM
1/1/12, 12:00:00 AM Western European Standard %STime
Sun 2012-01-1 00,00,00.000 Portugal Time
domingo, 1 de Janeiro de 2012 às 05:00:00 GMT+03:00
-==DONE==
diff --git a/ext/intl/tests/dateformat_formatObject_datetime_variant4.phpt b/ext/intl/tests/dateformat_formatObject_datetime_variant4.phpt
index 3c233eeb95..10089f7464 100644
--- a/ext/intl/tests/dateformat_formatObject_datetime_variant4.phpt
+++ b/ext/intl/tests/dateformat_formatObject_datetime_variant4.phpt
@@ -22,7 +22,6 @@ $dt = new DateTime('2012-01-01 05:00:00+03:00');
echo IntlDateFormatter::formatObject($dt, IntlDateFormatter::FULL), "\n";
?>
-==DONE==
--EXPECTF--
01/01/2012, 00:00:00
domingo, 1 de janeiro de 2012 às 00:00:00 Hora Padrão %Sda Europa Ocidental
@@ -30,4 +29,3 @@ Jan 1, 2012, 12:00:00 AM
1/1/12, 12:00:00 AM Western European Standard %STime
Sun 2012-01-1 00,00,00.000 Portugal Time
domingo, 1 de janeiro de 2012 às 05:00:00 GMT+03:00
-==DONE==
diff --git a/ext/intl/tests/dateformat_formatObject_datetime_variant5.phpt b/ext/intl/tests/dateformat_formatObject_datetime_variant5.phpt
index d3b671f324..c037869541 100644
--- a/ext/intl/tests/dateformat_formatObject_datetime_variant5.phpt
+++ b/ext/intl/tests/dateformat_formatObject_datetime_variant5.phpt
@@ -21,7 +21,6 @@ $dt = new DateTime('2012-01-01 05:00:00+03:00');
echo IntlDateFormatter::formatObject($dt, IntlDateFormatter::FULL), "\n";
?>
-==DONE==
--EXPECTF--
01/01/2012, 00:00:00
domingo, 1 de janeiro de 2012 às 00:00:00 Hora padrão %Sda Europa Ocidental
@@ -29,4 +28,3 @@ Jan 1, 2012, 12:00:00 AM
1/1/12, 12:00:00 AM Western European Standard %STime
Sun 2012-01-1 00,00,00.000 Portugal Time
domingo, 1 de janeiro de 2012 às 05:00:00 GMT+03:00
-==DONE==
diff --git a/ext/intl/tests/dateformat_formatObject_error.phpt b/ext/intl/tests/dateformat_formatObject_error.phpt
index bfcc951b73..69788fb96e 100644
--- a/ext/intl/tests/dateformat_formatObject_error.phpt
+++ b/ext/intl/tests/dateformat_formatObject_error.phpt
@@ -10,14 +10,16 @@ ini_set("intl.error_level", E_WARNING);
ini_set("intl.default_locale", "pt_PT");
ini_set("date.timezone", "Europe/Lisbon");
-var_dump(IntlDateFormatter::formatObject());
-var_dump(IntlDateFormatter::formatObject(1));
var_dump(IntlDateFormatter::formatObject(new stdclass));
class A extends IntlCalendar {function __construct(){}}
var_dump(IntlDateFormatter::formatObject(new A));
class B extends DateTime {function __construct(){}}
-var_dump(IntlDateFormatter::formatObject(new B));
+try {
+ var_dump(IntlDateFormatter::formatObject(new B));
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
$cal = IntlCalendar::createInstance();
var_dump(IntlDateFormatter::formatObject($cal, -2));
@@ -26,27 +28,17 @@ var_dump(IntlDateFormatter::formatObject($cal, array(1,2,3)));
var_dump(IntlDateFormatter::formatObject($cal, array(array(), 1)));
var_dump(IntlDateFormatter::formatObject($cal, array(1, -2)));
var_dump(IntlDateFormatter::formatObject($cal, ""));
-var_dump(IntlDateFormatter::formatObject($cal, "YYYY", array()));
?>
-==DONE==
--EXPECTF--
-Warning: IntlDateFormatter::formatObject() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: IntlDateFormatter::formatObject() expects parameter 1 to be object, int given in %s on line %d
-bool(false)
-
Warning: IntlDateFormatter::formatObject(): datefmt_format_object: the passed object must be an instance of either IntlCalendar or DateTime in %s on line %d
bool(false)
Warning: IntlDateFormatter::formatObject(): datefmt_format_object: bad IntlCalendar instance: not initialized properly in %s on line %d
bool(false)
-Warning: DateTime::getTimestamp(): The DateTime object has not been correctly initialized by its constructor in %s on line %d
-
Warning: IntlDateFormatter::formatObject(): datefmt_format_object: error calling ::getTimeStamp() on the object in %s on line %d
-bool(false)
+The DateTime object has not been correctly initialized by its constructor
Warning: IntlDateFormatter::formatObject(): datefmt_format_object: the date/time format type is invalid in %s on line %d
bool(false)
@@ -65,7 +57,3 @@ bool(false)
Warning: IntlDateFormatter::formatObject(): datefmt_format_object: the format is empty in %s on line %d
bool(false)
-
-Warning: IntlDateFormatter::formatObject() expects parameter 3 to be string, array given in %s on line %d
-bool(false)
-==DONE==
diff --git a/ext/intl/tests/dateformat_format_parse.phpt b/ext/intl/tests/dateformat_format_parse.phpt
index 68f54eb7e7..ac7c5f8df9 100644
--- a/ext/intl/tests/dateformat_format_parse.phpt
+++ b/ext/intl/tests/dateformat_format_parse.phpt
@@ -13,13 +13,13 @@ datefmt_format_code() and datefmt_parse_code()
function ut_main()
{
- $timezone = 'GMT+05:00';
+ $timezone = 'GMT+05:00';
- $locale_arr = array (
- 'en_US'
- );
+ $locale_arr = array (
+ 'en_US'
+ );
- $datetype_arr = array (
+ $datetype_arr = array (
IntlDateFormatter::FULL,
IntlDateFormatter::LONG,
IntlDateFormatter::MEDIUM
@@ -28,34 +28,34 @@ function ut_main()
$res_str = '';
- $time_arr = array (
- 0,
- -1200000,
- 1200000,
- 2200000000,
- -2200000000,
- 90099999,
- 3600,
- -3600
- );
-
- $localtime_arr1 = array (
- 'tm_sec' => 24 ,
- 'tm_min' => 3,
- 'tm_hour' => 19,
- 'tm_mday' => 3,
- 'tm_mon' => 3,
- 'tm_year' => 105,
- );
- $localtime_arr2 = array (
- 'tm_sec' => 21,
- 'tm_min' => 5,
- 'tm_hour' => 7,
- 'tm_mday' => 13,
- 'tm_mon' => 7,
- 'tm_year' => 205,
- );
- $localtime_arr3 = array (
+ $time_arr = array (
+ 0,
+ -1200000,
+ 1200000,
+ 2200000000,
+ -2200000000,
+ 90099999,
+ 3600,
+ -3600
+ );
+
+ $localtime_arr1 = array (
+ 'tm_sec' => 24 ,
+ 'tm_min' => 3,
+ 'tm_hour' => 19,
+ 'tm_mday' => 3,
+ 'tm_mon' => 3,
+ 'tm_year' => 105,
+ );
+ $localtime_arr2 = array (
+ 'tm_sec' => 21,
+ 'tm_min' => 5,
+ 'tm_hour' => 7,
+ 'tm_mday' => 13,
+ 'tm_mon' => 7,
+ 'tm_year' => 205,
+ );
+ $localtime_arr3 = array (
'tm_sec' => 11,
'tm_min' => 13,
'tm_hour' => 0,
@@ -64,72 +64,72 @@ function ut_main()
'tm_year' => -5
);
- $localtime_arr = array (
- $localtime_arr1,
- $localtime_arr2,
- $localtime_arr3
- );
-
- //Test format and parse with a timestamp : long
- foreach( $time_arr as $timestamp_entry){
- $res_str .= "\n------------\n";
- $res_str .= "\nInput timestamp is : $timestamp_entry";
- $res_str .= "\n------------\n";
- foreach( $locale_arr as $locale_entry ){
- foreach( $datetype_arr as $datetype_entry ) {
- $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry ";
- $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry,$timezone);
- $formatted = ut_datefmt_format( $fmt , $timestamp_entry);
- $res_str .= "\nFormatted timestamp is : $formatted";
- $parsed = ut_datefmt_parse( $fmt , $formatted);
- if( intl_get_error_code() == U_ZERO_ERROR){
- $res_str .= "\nParsed timestamp is : $parsed";
- }else{
- $res_str .= "\nError while parsing as: '".intl_get_error_message()."'";
- }
- }
- }
- }
-
- //Test format and parse with a localtime :array
- foreach( $localtime_arr as $localtime_entry){
- $res_str .= "\n------------\n";
- $res_str .= "\nInput localtime is : ";
- foreach( $localtime_entry as $key => $value){
+ $localtime_arr = array (
+ $localtime_arr1,
+ $localtime_arr2,
+ $localtime_arr3
+ );
+
+ //Test format and parse with a timestamp : long
+ foreach( $time_arr as $timestamp_entry){
+ $res_str .= "\n------------\n";
+ $res_str .= "\nInput timestamp is : $timestamp_entry";
+ $res_str .= "\n------------\n";
+ foreach( $locale_arr as $locale_entry ){
+ foreach( $datetype_arr as $datetype_entry ) {
+ $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry ";
+ $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry,$timezone);
+ $formatted = ut_datefmt_format( $fmt , $timestamp_entry);
+ $res_str .= "\nFormatted timestamp is : $formatted";
+ $parsed = ut_datefmt_parse( $fmt , $formatted);
+ if( intl_get_error_code() == U_ZERO_ERROR){
+ $res_str .= "\nParsed timestamp is : $parsed";
+ }else{
+ $res_str .= "\nError while parsing as: '".intl_get_error_message()."'";
+ }
+ }
+ }
+ }
+
+ //Test format and parse with a localtime :array
+ foreach( $localtime_arr as $localtime_entry){
+ $res_str .= "\n------------\n";
+ $res_str .= "\nInput localtime is : ";
+ foreach( $localtime_entry as $key => $value){
$res_str .= "$key : '$value' , ";
- }
-
- $res_str .= "\n------------\n";
- foreach( $locale_arr as $locale_entry ){
- foreach( $datetype_arr as $datetype_entry ) {
- $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry ";
- $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry,$timezone);
- $formatted1 = ut_datefmt_format( $fmt , $localtime_entry);
- if( intl_get_error_code() == U_ZERO_ERROR){
- $res_str .= "\nFormatted localtime_array is : $formatted1";
- }else{
- $res_str .= "\nError while formatting as: '".intl_get_error_message()."'";
- }
- //Parsing
- $parsed_arr = ut_datefmt_localtime( $fmt, $formatted1 );
-
- if( $parsed_arr){
- $res_str .= "\nParsed array is: ";
- foreach( $parsed_arr as $key => $value){
- $res_str .= "$key : '$value' , ";
- }
- }
+ }
+
+ $res_str .= "\n------------\n";
+ foreach( $locale_arr as $locale_entry ){
+ foreach( $datetype_arr as $datetype_entry ) {
+ $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry ";
+ $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry,$timezone);
+ $formatted1 = ut_datefmt_format( $fmt , $localtime_entry);
+ if( intl_get_error_code() == U_ZERO_ERROR){
+ $res_str .= "\nFormatted localtime_array is : $formatted1";
+ }else{
+ $res_str .= "\nError while formatting as: '".intl_get_error_message()."'";
+ }
+ //Parsing
+ $parsed_arr = ut_datefmt_localtime( $fmt, $formatted1 );
+
+ if( $parsed_arr){
+ $res_str .= "\nParsed array is: ";
+ foreach( $parsed_arr as $key => $value){
+ $res_str .= "$key : '$value' , ";
+ }
+ }
/*
- else{
- //$res_str .= "No values found from LocaleTime parsing.";
- $res_str .= "\tError : '".intl_get_error_message()."'";
- }
+ else{
+ //$res_str .= "No values found from LocaleTime parsing.";
+ $res_str .= "\tError : '".intl_get_error_message()."'";
+ }
*/
- }
- }
- }
+ }
+ }
+ }
- return $res_str;
+ return $res_str;
}
diff --git a/ext/intl/tests/dateformat_format_parse_version2.phpt b/ext/intl/tests/dateformat_format_parse_version2.phpt
index f672cd6d22..1820e52e91 100644
--- a/ext/intl/tests/dateformat_format_parse_version2.phpt
+++ b/ext/intl/tests/dateformat_format_parse_version2.phpt
@@ -13,13 +13,13 @@ datefmt_format_code() and datefmt_parse_code()
function ut_main()
{
- $timezone = 'GMT+05:00';
+ $timezone = 'GMT+05:00';
- $locale_arr = array (
- 'en_US'
- );
+ $locale_arr = array (
+ 'en_US'
+ );
- $datetype_arr = array (
+ $datetype_arr = array (
IntlDateFormatter::FULL,
IntlDateFormatter::LONG,
IntlDateFormatter::MEDIUM
@@ -28,34 +28,34 @@ function ut_main()
$res_str = '';
- $time_arr = array (
- 0,
- -1200000,
- 1200000,
- 2200000000,
- -2200000000,
- 90099999,
- 3600,
- -3600
- );
-
- $localtime_arr1 = array (
- 'tm_sec' => 24 ,
- 'tm_min' => 3,
- 'tm_hour' => 19,
- 'tm_mday' => 3,
- 'tm_mon' => 3,
- 'tm_year' => 105,
- );
- $localtime_arr2 = array (
- 'tm_sec' => 21,
- 'tm_min' => 5,
- 'tm_hour' => 7,
- 'tm_mday' => 13,
- 'tm_mon' => 7,
- 'tm_year' => 205,
- );
- $localtime_arr3 = array (
+ $time_arr = array (
+ 0,
+ -1200000,
+ 1200000,
+ 2200000000,
+ -2200000000,
+ 90099999,
+ 3600,
+ -3600
+ );
+
+ $localtime_arr1 = array (
+ 'tm_sec' => 24 ,
+ 'tm_min' => 3,
+ 'tm_hour' => 19,
+ 'tm_mday' => 3,
+ 'tm_mon' => 3,
+ 'tm_year' => 105,
+ );
+ $localtime_arr2 = array (
+ 'tm_sec' => 21,
+ 'tm_min' => 5,
+ 'tm_hour' => 7,
+ 'tm_mday' => 13,
+ 'tm_mon' => 7,
+ 'tm_year' => 205,
+ );
+ $localtime_arr3 = array (
'tm_sec' => 11,
'tm_min' => 13,
'tm_hour' => 0,
@@ -64,72 +64,72 @@ function ut_main()
'tm_year' => -5
);
- $localtime_arr = array (
- $localtime_arr1,
- $localtime_arr2,
- $localtime_arr3
- );
-
- //Test format and parse with a timestamp : long
- foreach( $time_arr as $timestamp_entry){
- $res_str .= "\n------------\n";
- $res_str .= "\nInput timestamp is : $timestamp_entry";
- $res_str .= "\n------------\n";
- foreach( $locale_arr as $locale_entry ){
- foreach( $datetype_arr as $datetype_entry ) {
- $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry ";
- $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry,$timezone);
- $formatted = ut_datefmt_format( $fmt , $timestamp_entry);
- $res_str .= "\nFormatted timestamp is : $formatted";
- $parsed = ut_datefmt_parse( $fmt , $formatted);
- if( intl_get_error_code() == U_ZERO_ERROR){
- $res_str .= "\nParsed timestamp is : $parsed";
- }else{
- $res_str .= "\nError while parsing as: '".intl_get_error_message()."'";
- }
- }
- }
- }
-
- //Test format and parse with a localtime :array
- foreach( $localtime_arr as $localtime_entry){
- $res_str .= "\n------------\n";
- $res_str .= "\nInput localtime is : ";
- foreach( $localtime_entry as $key => $value){
+ $localtime_arr = array (
+ $localtime_arr1,
+ $localtime_arr2,
+ $localtime_arr3
+ );
+
+ //Test format and parse with a timestamp : long
+ foreach( $time_arr as $timestamp_entry){
+ $res_str .= "\n------------\n";
+ $res_str .= "\nInput timestamp is : $timestamp_entry";
+ $res_str .= "\n------------\n";
+ foreach( $locale_arr as $locale_entry ){
+ foreach( $datetype_arr as $datetype_entry ) {
+ $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry ";
+ $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry,$timezone);
+ $formatted = ut_datefmt_format( $fmt , $timestamp_entry);
+ $res_str .= "\nFormatted timestamp is : $formatted";
+ $parsed = ut_datefmt_parse( $fmt , $formatted);
+ if( intl_get_error_code() == U_ZERO_ERROR){
+ $res_str .= "\nParsed timestamp is : $parsed";
+ }else{
+ $res_str .= "\nError while parsing as: '".intl_get_error_message()."'";
+ }
+ }
+ }
+ }
+
+ //Test format and parse with a localtime :array
+ foreach( $localtime_arr as $localtime_entry){
+ $res_str .= "\n------------\n";
+ $res_str .= "\nInput localtime is : ";
+ foreach( $localtime_entry as $key => $value){
$res_str .= "$key : '$value' , ";
- }
-
- $res_str .= "\n------------\n";
- foreach( $locale_arr as $locale_entry ){
- foreach( $datetype_arr as $datetype_entry ) {
- $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry ";
- $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry,$timezone);
- $formatted1 = ut_datefmt_format( $fmt , $localtime_entry);
- if( intl_get_error_code() == U_ZERO_ERROR){
- $res_str .= "\nFormatted localtime_array is : $formatted1";
- }else{
- $res_str .= "\nError while formatting as: '".intl_get_error_message()."'";
- }
- //Parsing
- $parsed_arr = ut_datefmt_localtime( $fmt, $formatted1 );
-
- if( $parsed_arr){
- $res_str .= "\nParsed array is: ";
- foreach( $parsed_arr as $key => $value){
- $res_str .= "$key : '$value' , ";
- }
- }
+ }
+
+ $res_str .= "\n------------\n";
+ foreach( $locale_arr as $locale_entry ){
+ foreach( $datetype_arr as $datetype_entry ) {
+ $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry ";
+ $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry,$timezone);
+ $formatted1 = ut_datefmt_format( $fmt , $localtime_entry);
+ if( intl_get_error_code() == U_ZERO_ERROR){
+ $res_str .= "\nFormatted localtime_array is : $formatted1";
+ }else{
+ $res_str .= "\nError while formatting as: '".intl_get_error_message()."'";
+ }
+ //Parsing
+ $parsed_arr = ut_datefmt_localtime( $fmt, $formatted1 );
+
+ if( $parsed_arr){
+ $res_str .= "\nParsed array is: ";
+ foreach( $parsed_arr as $key => $value){
+ $res_str .= "$key : '$value' , ";
+ }
+ }
/*
- else{
- //$res_str .= "No values found from LocaleTime parsing.";
- $res_str .= "\tError : '".intl_get_error_message()."'";
- }
+ else{
+ //$res_str .= "No values found from LocaleTime parsing.";
+ $res_str .= "\tError : '".intl_get_error_message()."'";
+ }
*/
- }
- }
- }
+ }
+ }
+ }
- return $res_str;
+ return $res_str;
}
diff --git a/ext/intl/tests/dateformat_format_relative.phpt b/ext/intl/tests/dateformat_format_relative.phpt
new file mode 100644
index 0000000000..f8e28220e5
--- /dev/null
+++ b/ext/intl/tests/dateformat_format_relative.phpt
@@ -0,0 +1,72 @@
+--TEST--
+datefmt_format_code() with relative formats
+--SKIPIF--
+<?php if (!extension_loaded("intl")) print "skip"; ?>
+--FILE--
+<?php
+
+printFormat(IntlDateFormatter::RELATIVE_FULL, IntlDateFormatter::NONE, getYesterday());
+printFormat(IntlDateFormatter::RELATIVE_LONG, IntlDateFormatter::NONE, getYesterday());
+printFormat(IntlDateFormatter::RELATIVE_MEDIUM, IntlDateFormatter::NONE, getYesterday());
+printFormat(IntlDateFormatter::RELATIVE_SHORT, IntlDateFormatter::NONE, getYesterday());
+
+printFormat(IntlDateFormatter::RELATIVE_FULL, IntlDateFormatter::NONE, getToday());
+printFormat(IntlDateFormatter::RELATIVE_LONG, IntlDateFormatter::NONE, getToday());
+printFormat(IntlDateFormatter::RELATIVE_MEDIUM, IntlDateFormatter::NONE, getToday());
+printFormat(IntlDateFormatter::RELATIVE_SHORT, IntlDateFormatter::NONE, getToday());
+
+printFormat(IntlDateFormatter::RELATIVE_FULL, IntlDateFormatter::NONE, getTomorrow());
+printFormat(IntlDateFormatter::RELATIVE_LONG, IntlDateFormatter::NONE, getTomorrow());
+printFormat(IntlDateFormatter::RELATIVE_MEDIUM, IntlDateFormatter::NONE, getTomorrow());
+printFormat(IntlDateFormatter::RELATIVE_SHORT, IntlDateFormatter::NONE, getTomorrow());
+
+printFormat(IntlDateFormatter::RELATIVE_FULL, IntlDateFormatter::NONE, getDayInPast());
+printFormat(IntlDateFormatter::RELATIVE_LONG, IntlDateFormatter::NONE, getDayInPast());
+printFormat(IntlDateFormatter::RELATIVE_MEDIUM, IntlDateFormatter::NONE, getDayInPast());
+printFormat(IntlDateFormatter::RELATIVE_SHORT, IntlDateFormatter::NONE, getDayInPast());
+
+function printFormat(int $dateFormat, int $timeFormat, DateTimeImmutable $time) {
+ $formatter = new IntlDateFormatter(
+ "en_US",
+ $dateFormat,
+ $timeFormat,
+ "America/Los_Angeles",
+ IntlDateFormatter::GREGORIAN
+ );
+
+ echo $formatter->format($time) . "\n";
+}
+
+function getToday(): DateTimeImmutable {
+ return new DateTimeImmutable();
+}
+
+function getYesterday(): DateTimeImmutable {
+ return new DateTimeImmutable("-1 day");
+}
+
+function getTomorrow(): DateTimeImmutable {
+ return new DateTimeImmutable("+1 day");
+}
+
+function getDayInPast(): DateTimeImmutable {
+ return new DateTimeImmutable("2020-01-20 20:20:20", new DateTimeZone("UTC"));
+}
+
+--EXPECT--
+yesterday
+yesterday
+yesterday
+yesterday
+today
+today
+today
+today
+tomorrow
+tomorrow
+tomorrow
+tomorrow
+Monday, January 20, 2020
+January 20, 2020
+Jan 20, 2020
+1/20/20
diff --git a/ext/intl/tests/dateformat_format_variant2.phpt b/ext/intl/tests/dateformat_format_variant2.phpt
index d61b20b03a..b02cfcd9e6 100644
--- a/ext/intl/tests/dateformat_format_variant2.phpt
+++ b/ext/intl/tests/dateformat_format_variant2.phpt
@@ -15,13 +15,13 @@ datefmt_format_code()
function ut_main()
{
- $timezone = 'GMT-10:00';
+ $timezone = 'GMT-10:00';
- $locale_arr = array (
- 'en_US'
- );
+ $locale_arr = array (
+ 'en_US'
+ );
- $datetype_arr = array (
+ $datetype_arr = array (
IntlDateFormatter::FULL,
IntlDateFormatter::LONG,
IntlDateFormatter::MEDIUM,
@@ -32,34 +32,34 @@ function ut_main()
$res_str = '';
- $time_arr = array (
- 0,
- -1200000,
- 1200000,
- 2200000000.0,
- -2200000000.0,
- 90099999,
- 3600,
- -3600
- );
-
- $localtime_arr1 = array (
- 'tm_sec' => 24 ,
- 'tm_min' => 3,
- 'tm_hour' => 19,
- 'tm_mday' => 3,
- 'tm_mon' => 3,
- 'tm_year' => 105,
- );
- $localtime_arr2 = array (
- 'tm_sec' => 21,
- 'tm_min' => 5,
- 'tm_hour' => 7,
- 'tm_mday' => 13,
- 'tm_mon' => 4,
- 'tm_year' => 205,
- );
- $localtime_arr3 = array (
+ $time_arr = array (
+ 0,
+ -1200000,
+ 1200000,
+ 2200000000.0,
+ -2200000000.0,
+ 90099999,
+ 3600,
+ -3600
+ );
+
+ $localtime_arr1 = array (
+ 'tm_sec' => 24 ,
+ 'tm_min' => 3,
+ 'tm_hour' => 19,
+ 'tm_mday' => 3,
+ 'tm_mon' => 3,
+ 'tm_year' => 105,
+ );
+ $localtime_arr2 = array (
+ 'tm_sec' => 21,
+ 'tm_min' => 5,
+ 'tm_hour' => 7,
+ 'tm_mday' => 13,
+ 'tm_mon' => 4,
+ 'tm_year' => 205,
+ );
+ $localtime_arr3 = array (
'tm_sec' => 11,
'tm_min' => 13,
'tm_hour' => 0,
@@ -68,80 +68,80 @@ function ut_main()
'tm_year' => -5
);
- $localtime_arr = array (
- $localtime_arr1,
- $localtime_arr2,
- $localtime_arr3
- );
-
- $d1 = new DateTime("2010-01-01 01:02:03", new DateTimeZone("UTC"));
- $d2 = new DateTime("2000-12-31 03:04:05", new DateTimeZone("UTC"));
- $d2->setTimezone(new DateTimeZone("PDT"));
- $dates = array(
- $d1,
- $d2,
- new StdClass(),
- );
-
- //Test format with input as a timestamp : integer
- foreach( $time_arr as $timestamp_entry){
- $res_str .= "\n------------\n";
- $res_str .= "\nInput timestamp is : $timestamp_entry";
- $res_str .= "\n------------\n";
- foreach( $locale_arr as $locale_entry ){
- foreach( $datetype_arr as $datetype_entry )
- {
- $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry ";
- $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN);
- $formatted = ut_datefmt_format( $fmt , $timestamp_entry);
- $res_str .= "\nFormatted timestamp is : $formatted";
- }
- }
- }
-
- //Test format with input as a localtime :array
- foreach( $localtime_arr as $localtime_entry){
- $res_str .= "\n------------\n";
- $res_str .= "\nInput localtime is : ";
- foreach( $localtime_entry as $key => $value){
+ $localtime_arr = array (
+ $localtime_arr1,
+ $localtime_arr2,
+ $localtime_arr3
+ );
+
+ $d1 = new DateTime("2010-01-01 01:02:03", new DateTimeZone("UTC"));
+ $d2 = new DateTime("2000-12-31 03:04:05", new DateTimeZone("UTC"));
+ $d2->setTimezone(new DateTimeZone("PDT"));
+ $dates = array(
+ $d1,
+ $d2,
+ new StdClass(),
+ );
+
+ //Test format with input as a timestamp : integer
+ foreach( $time_arr as $timestamp_entry){
+ $res_str .= "\n------------\n";
+ $res_str .= "\nInput timestamp is : $timestamp_entry";
+ $res_str .= "\n------------\n";
+ foreach( $locale_arr as $locale_entry ){
+ foreach( $datetype_arr as $datetype_entry )
+ {
+ $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry ";
+ $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN);
+ $formatted = ut_datefmt_format( $fmt , $timestamp_entry);
+ $res_str .= "\nFormatted timestamp is : $formatted";
+ }
+ }
+ }
+
+ //Test format with input as a localtime :array
+ foreach( $localtime_arr as $localtime_entry){
+ $res_str .= "\n------------\n";
+ $res_str .= "\nInput localtime is : ";
+ foreach( $localtime_entry as $key => $value){
$res_str .= "$key : '$value' , ";
- }
-
- $res_str .= "\n------------\n";
- foreach( $locale_arr as $locale_entry ){
- foreach( $datetype_arr as $datetype_entry )
- {
- $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry ";
- $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN );
- $formatted1 = ut_datefmt_format( $fmt , $localtime_entry);
- if( intl_get_error_code() == U_ZERO_ERROR){
- $res_str .= "\nFormatted localtime_array is : $formatted1";
- }else{
- $res_str .= "\nError while formatting as: '".intl_get_error_message()."'";
- }
- }
- }
- }
-
- foreach($dates as $date_entry) {
- foreach( $locale_arr as $locale_entry ){
- foreach( $datetype_arr as $datetype_entry ) {
- $res_str .= "\n------------";
- $res_str .= "\nDate is: ".var_export($date_entry, true);
- $res_str .= "\n------------";
-
- $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN );
- $formatted1 = ut_datefmt_format( $fmt , $date_entry);
- if( intl_get_error_code() == U_ZERO_ERROR){
- $res_str .= "\nFormatted DateTime is : $formatted1";
- }else{
- $res_str .= "\nError while formatting as: '".intl_get_error_message()."'";
- }
- }
- }
- }
-
- return $res_str;
+ }
+
+ $res_str .= "\n------------\n";
+ foreach( $locale_arr as $locale_entry ){
+ foreach( $datetype_arr as $datetype_entry )
+ {
+ $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry ";
+ $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN );
+ $formatted1 = ut_datefmt_format( $fmt , $localtime_entry);
+ if( intl_get_error_code() == U_ZERO_ERROR){
+ $res_str .= "\nFormatted localtime_array is : $formatted1";
+ }else{
+ $res_str .= "\nError while formatting as: '".intl_get_error_message()."'";
+ }
+ }
+ }
+ }
+
+ foreach($dates as $date_entry) {
+ foreach( $locale_arr as $locale_entry ){
+ foreach( $datetype_arr as $datetype_entry ) {
+ $res_str .= "\n------------";
+ $res_str .= "\nDate is: ".var_export($date_entry, true);
+ $res_str .= "\n------------";
+
+ $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN );
+ $formatted1 = ut_datefmt_format( $fmt , $date_entry);
+ if( intl_get_error_code() == U_ZERO_ERROR){
+ $res_str .= "\nFormatted DateTime is : $formatted1";
+ }else{
+ $res_str .= "\nError while formatting as: '".intl_get_error_message()."'";
+ }
+ }
+ }
+ }
+
+ return $res_str;
}
diff --git a/ext/intl/tests/dateformat_format_variant3.phpt b/ext/intl/tests/dateformat_format_variant3.phpt
index e2f9ec81b0..52705a3f03 100644
--- a/ext/intl/tests/dateformat_format_variant3.phpt
+++ b/ext/intl/tests/dateformat_format_variant3.phpt
@@ -15,13 +15,13 @@ datefmt_format_code()
function ut_main()
{
- $timezone = 'GMT-10:00';
+ $timezone = 'GMT-10:00';
- $locale_arr = array (
- 'en_US'
- );
+ $locale_arr = array (
+ 'en_US'
+ );
- $datetype_arr = array (
+ $datetype_arr = array (
IntlDateFormatter::FULL,
IntlDateFormatter::LONG,
IntlDateFormatter::MEDIUM,
@@ -32,34 +32,34 @@ function ut_main()
$res_str = '';
- $time_arr = array (
- 0,
- -1200000,
- 1200000,
- 2200000000.0,
- -2200000000.0,
- 90099999,
- 3600,
- -3600
- );
-
- $localtime_arr1 = array (
- 'tm_sec' => 24 ,
- 'tm_min' => 3,
- 'tm_hour' => 19,
- 'tm_mday' => 3,
- 'tm_mon' => 3,
- 'tm_year' => 105,
- );
- $localtime_arr2 = array (
- 'tm_sec' => 21,
- 'tm_min' => 5,
- 'tm_hour' => 7,
- 'tm_mday' => 13,
- 'tm_mon' => 4,
- 'tm_year' => 205,
- );
- $localtime_arr3 = array (
+ $time_arr = array (
+ 0,
+ -1200000,
+ 1200000,
+ 2200000000.0,
+ -2200000000.0,
+ 90099999,
+ 3600,
+ -3600
+ );
+
+ $localtime_arr1 = array (
+ 'tm_sec' => 24 ,
+ 'tm_min' => 3,
+ 'tm_hour' => 19,
+ 'tm_mday' => 3,
+ 'tm_mon' => 3,
+ 'tm_year' => 105,
+ );
+ $localtime_arr2 = array (
+ 'tm_sec' => 21,
+ 'tm_min' => 5,
+ 'tm_hour' => 7,
+ 'tm_mday' => 13,
+ 'tm_mon' => 4,
+ 'tm_year' => 205,
+ );
+ $localtime_arr3 = array (
'tm_sec' => 11,
'tm_min' => 13,
'tm_hour' => 0,
@@ -68,80 +68,80 @@ function ut_main()
'tm_year' => -5
);
- $localtime_arr = array (
- $localtime_arr1,
- $localtime_arr2,
- $localtime_arr3
- );
-
- $d1 = new DateTime("2010-01-01 01:02:03", new DateTimeZone("UTC"));
- $d2 = new DateTime("2000-12-31 03:04:05", new DateTimeZone("UTC"));
- $d2->setTimezone(new DateTimeZone("PDT"));
- $dates = array(
- $d1,
- $d2,
- new StdClass(),
- );
-
- //Test format with input as a timestamp : integer
- foreach( $time_arr as $timestamp_entry){
- $res_str .= "\n------------\n";
- $res_str .= "\nInput timestamp is : $timestamp_entry";
- $res_str .= "\n------------\n";
- foreach( $locale_arr as $locale_entry ){
- foreach( $datetype_arr as $datetype_entry )
- {
- $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry ";
- $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN);
- $formatted = ut_datefmt_format( $fmt , $timestamp_entry);
- $res_str .= "\nFormatted timestamp is : $formatted";
- }
- }
- }
-
- //Test format with input as a localtime :array
- foreach( $localtime_arr as $localtime_entry){
- $res_str .= "\n------------\n";
- $res_str .= "\nInput localtime is : ";
- foreach( $localtime_entry as $key => $value){
+ $localtime_arr = array (
+ $localtime_arr1,
+ $localtime_arr2,
+ $localtime_arr3
+ );
+
+ $d1 = new DateTime("2010-01-01 01:02:03", new DateTimeZone("UTC"));
+ $d2 = new DateTime("2000-12-31 03:04:05", new DateTimeZone("UTC"));
+ $d2->setTimezone(new DateTimeZone("PDT"));
+ $dates = array(
+ $d1,
+ $d2,
+ new StdClass(),
+ );
+
+ //Test format with input as a timestamp : integer
+ foreach( $time_arr as $timestamp_entry){
+ $res_str .= "\n------------\n";
+ $res_str .= "\nInput timestamp is : $timestamp_entry";
+ $res_str .= "\n------------\n";
+ foreach( $locale_arr as $locale_entry ){
+ foreach( $datetype_arr as $datetype_entry )
+ {
+ $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry ";
+ $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN);
+ $formatted = ut_datefmt_format( $fmt , $timestamp_entry);
+ $res_str .= "\nFormatted timestamp is : $formatted";
+ }
+ }
+ }
+
+ //Test format with input as a localtime :array
+ foreach( $localtime_arr as $localtime_entry){
+ $res_str .= "\n------------\n";
+ $res_str .= "\nInput localtime is : ";
+ foreach( $localtime_entry as $key => $value){
$res_str .= "$key : '$value' , ";
- }
-
- $res_str .= "\n------------\n";
- foreach( $locale_arr as $locale_entry ){
- foreach( $datetype_arr as $datetype_entry )
- {
- $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry ";
- $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN );
- $formatted1 = ut_datefmt_format( $fmt , $localtime_entry);
- if( intl_get_error_code() == U_ZERO_ERROR){
- $res_str .= "\nFormatted localtime_array is : $formatted1";
- }else{
- $res_str .= "\nError while formatting as: '".intl_get_error_message()."'";
- }
- }
- }
- }
-
- foreach($dates as $date_entry) {
- foreach( $locale_arr as $locale_entry ){
- foreach( $datetype_arr as $datetype_entry ) {
- $res_str .= "\n------------";
- $res_str .= "\nDate is: ".var_export($date_entry, true);
- $res_str .= "\n------------";
-
- $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN );
- $formatted1 = ut_datefmt_format( $fmt , $date_entry);
- if( intl_get_error_code() == U_ZERO_ERROR){
- $res_str .= "\nFormatted DateTime is : $formatted1";
- }else{
- $res_str .= "\nError while formatting as: '".intl_get_error_message()."'";
- }
- }
- }
- }
-
- return $res_str;
+ }
+
+ $res_str .= "\n------------\n";
+ foreach( $locale_arr as $locale_entry ){
+ foreach( $datetype_arr as $datetype_entry )
+ {
+ $res_str .= "\nIntlDateFormatter locale= $locale_entry ,datetype = $datetype_entry ,timetype =$datetype_entry ";
+ $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN );
+ $formatted1 = ut_datefmt_format( $fmt , $localtime_entry);
+ if( intl_get_error_code() == U_ZERO_ERROR){
+ $res_str .= "\nFormatted localtime_array is : $formatted1";
+ }else{
+ $res_str .= "\nError while formatting as: '".intl_get_error_message()."'";
+ }
+ }
+ }
+ }
+
+ foreach($dates as $date_entry) {
+ foreach( $locale_arr as $locale_entry ){
+ foreach( $datetype_arr as $datetype_entry ) {
+ $res_str .= "\n------------";
+ $res_str .= "\nDate is: ".var_export($date_entry, true);
+ $res_str .= "\n------------";
+
+ $fmt = ut_datefmt_create( $locale_entry , $datetype_entry ,$datetype_entry, $timezone, IntlDateFormatter::GREGORIAN );
+ $formatted1 = ut_datefmt_format( $fmt , $date_entry);
+ if( intl_get_error_code() == U_ZERO_ERROR){
+ $res_str .= "\nFormatted DateTime is : $formatted1";
+ }else{
+ $res_str .= "\nError while formatting as: '".intl_get_error_message()."'";
+ }
+ }
+ }
+ }
+
+ return $res_str;
}
diff --git a/ext/intl/tests/dateformat_getCalendarObject_error.phpt b/ext/intl/tests/dateformat_getCalendarObject_error.phpt
deleted file mode 100644
index d5a7833ded..0000000000
--- a/ext/intl/tests/dateformat_getCalendarObject_error.phpt
+++ /dev/null
@@ -1,42 +0,0 @@
---TEST--
-IntlDateFormatter::getCalendarObject(): bad args
---SKIPIF--
-<?php
-if (!extension_loaded('intl'))
- die('skip intl extension not enabled');
---FILE--
-<?php
-ini_set("intl.error_level", E_WARNING);
-ini_set("intl.default_locale", "pt_PT");
-ini_set("date.timezone", 'Atlantic/Azores');
-
-$df = new IntlDateFormatter(NULL, 0, 0);
-
-var_dump($df->getCalendarObject(9));
-var_dump(datefmt_get_calendar_object($df, 9));
-var_dump(datefmt_get_calendar_object($df, 9));
-var_dump(datefmt_get_calendar_object(new stdclass));
-
-?>
-==DONE==
---EXPECTF--
-Warning: IntlDateFormatter::getCalendarObject() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlDateFormatter::getCalendarObject(): datefmt_get_calendar_object: unable to parse input params in %s on line %d
-bool(false)
-
-Warning: datefmt_get_calendar_object() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: datefmt_get_calendar_object(): datefmt_get_calendar_object: unable to parse input params in %s on line %d
-bool(false)
-
-Warning: datefmt_get_calendar_object() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: datefmt_get_calendar_object(): datefmt_get_calendar_object: unable to parse input params in %s on line %d
-bool(false)
-
-Warning: datefmt_get_calendar_object() expects parameter 1 to be IntlDateFormatter, object given in %s on line %d
-
-Warning: datefmt_get_calendar_object(): datefmt_get_calendar_object: unable to parse input params in %s on line %d
-bool(false)
-==DONE==
diff --git a/ext/intl/tests/dateformat_getTimeZone_error.phpt b/ext/intl/tests/dateformat_getTimeZone_error.phpt
deleted file mode 100644
index d2ab92d86a..0000000000
--- a/ext/intl/tests/dateformat_getTimeZone_error.phpt
+++ /dev/null
@@ -1,42 +0,0 @@
---TEST--
-IntlDateFormatter::getTimeZone(): bad args
---SKIPIF--
-<?php
-if (!extension_loaded('intl'))
- die('skip intl extension not enabled');
---FILE--
-<?php
-ini_set("intl.error_level", E_WARNING);
-ini_set("intl.default_locale", "pt_PT");
-ini_set("date.timezone", 'Atlantic/Azores');
-
-$df = new IntlDateFormatter(NULL, 0, 0);
-
-var_dump($df->getTimeZone(9));
-var_dump(datefmt_get_timezone($df, 9));
-var_dump(datefmt_get_timezone($df, 9));
-var_dump(datefmt_get_timezone(new stdclass));
-
-?>
-==DONE==
---EXPECTF--
-Warning: IntlDateFormatter::getTimeZone() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlDateFormatter::getTimeZone(): datefmt_get_timezone: unable to parse input params in %s on line %d
-bool(false)
-
-Warning: datefmt_get_timezone() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: datefmt_get_timezone(): datefmt_get_timezone: unable to parse input params in %s on line %d
-bool(false)
-
-Warning: datefmt_get_timezone() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: datefmt_get_timezone(): datefmt_get_timezone: unable to parse input params in %s on line %d
-bool(false)
-
-Warning: datefmt_get_timezone() expects parameter 1 to be IntlDateFormatter, object given in %s on line %d
-
-Warning: datefmt_get_timezone(): datefmt_get_timezone: unable to parse input params in %s on line %d
-bool(false)
-==DONE==
diff --git a/ext/intl/tests/dateformat_get_datetype.phpt b/ext/intl/tests/dateformat_get_datetype.phpt
index ec03bb68f4..27c9188d10 100644
--- a/ext/intl/tests/dateformat_get_datetype.phpt
+++ b/ext/intl/tests/dateformat_get_datetype.phpt
@@ -12,26 +12,26 @@ datefmt_get_datetype_code()
function ut_main()
{
- $datetype_arr = array (
- IntlDateFormatter::FULL,
- IntlDateFormatter::LONG,
- IntlDateFormatter::MEDIUM,
- IntlDateFormatter::SHORT,
- IntlDateFormatter::NONE
- );
-
- $res_str = '';
-
- foreach( $datetype_arr as $datetype_entry )
- {
- $res_str .= "\nCreating IntlDateFormatter with date_type = $datetype_entry";
- $fmt = ut_datefmt_create( "de-DE", $datetype_entry , IntlDateFormatter::SHORT,'America/Los_Angeles', IntlDateFormatter::GREGORIAN );
- $date_type = ut_datefmt_get_datetype( $fmt);
- $res_str .= "\nAfter call to get_datetype : datetype= $date_type";
- $res_str .= "\n";
- }
-
- return $res_str;
+ $datetype_arr = array (
+ IntlDateFormatter::FULL,
+ IntlDateFormatter::LONG,
+ IntlDateFormatter::MEDIUM,
+ IntlDateFormatter::SHORT,
+ IntlDateFormatter::NONE
+ );
+
+ $res_str = '';
+
+ foreach( $datetype_arr as $datetype_entry )
+ {
+ $res_str .= "\nCreating IntlDateFormatter with date_type = $datetype_entry";
+ $fmt = ut_datefmt_create( "de-DE", $datetype_entry , IntlDateFormatter::SHORT,'America/Los_Angeles', IntlDateFormatter::GREGORIAN );
+ $date_type = ut_datefmt_get_datetype( $fmt);
+ $res_str .= "\nAfter call to get_datetype : datetype= $date_type";
+ $res_str .= "\n";
+ }
+
+ return $res_str;
}
diff --git a/ext/intl/tests/dateformat_get_locale.phpt b/ext/intl/tests/dateformat_get_locale.phpt
index aa7a0a46c3..c5b6f8c300 100644
--- a/ext/intl/tests/dateformat_get_locale.phpt
+++ b/ext/intl/tests/dateformat_get_locale.phpt
@@ -1,5 +1,5 @@
--TEST--
-datefmt_get_locale_code()
+datefmt_get_locale()
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) die('skip');
if (PHP_INT_SIZE != 8) die('skip 64-bit only');
@@ -14,31 +14,31 @@ if (PHP_INT_SIZE != 8) die('skip 64-bit only');
function ut_main()
{
- $locale_arr = array (
- 'de-DE',
- 'sl-IT-nedis',
- 'en_UK',
- 'hi'
- );
-
- $res_str = '';
-
- foreach( $locale_arr as $locale_entry )
- {
- $res_str .= "\nCreating IntlDateFormatter with locale = $locale_entry";
- $fmt = ut_datefmt_create( $locale_entry , IntlDateFormatter::SHORT,IntlDateFormatter::SHORT,'America/Los_Angeles', IntlDateFormatter::GREGORIAN );
- $locale = ut_datefmt_get_locale( $fmt , 1);
- $res_str .= "\nAfter call to get_locale : locale= $locale";
- $res_str .= "\n";
- }
- $badvals = array(100, -1, 4294901761);
- foreach($badvals as $badval) {
- if(ut_datefmt_get_locale($fmt, $badval)) {
- $res_str .= "datefmt_get_locale should return false for bad argument $badval\n";
- }
- }
-
- return $res_str;
+ $locale_arr = array (
+ 'de-DE',
+ 'sl-IT-nedis',
+ 'en_UK',
+ 'hi'
+ );
+
+ $res_str = '';
+
+ foreach( $locale_arr as $locale_entry )
+ {
+ $res_str .= "\nCreating IntlDateFormatter with locale = $locale_entry";
+ $fmt = ut_datefmt_create( $locale_entry , IntlDateFormatter::SHORT,IntlDateFormatter::SHORT,'America/Los_Angeles', IntlDateFormatter::GREGORIAN );
+ $locale = ut_datefmt_get_locale( $fmt , 1);
+ $res_str .= "\nAfter call to get_locale : locale= $locale";
+ $res_str .= "\n";
+ }
+ $badvals = array(100, -1, 4294901761);
+ foreach($badvals as $badval) {
+ if(ut_datefmt_get_locale($fmt, $badval)) {
+ $res_str .= "datefmt_get_locale should return false for bad argument $badval\n";
+ }
+ }
+
+ return $res_str;
}
diff --git a/ext/intl/tests/dateformat_get_set_calendar.phpt b/ext/intl/tests/dateformat_get_set_calendar.phpt
index 73a26d0166..4b150c579f 100644
--- a/ext/intl/tests/dateformat_get_set_calendar.phpt
+++ b/ext/intl/tests/dateformat_get_set_calendar.phpt
@@ -35,7 +35,6 @@ $df->setCalendar($cal);
d($df);
?>
-==DONE==
--EXPECT--
dimanche 1 janvier 2012 ap. J.-C. 03:00:00 UTC+03:00
int(1)
@@ -52,4 +51,3 @@ bool(false)
string(9) "gregorian"
string(3) "UTC"
-==DONE==
diff --git a/ext/intl/tests/dateformat_get_set_calendar_variant2.phpt b/ext/intl/tests/dateformat_get_set_calendar_variant2.phpt
index 9e8d76c1bb..496754e741 100644
--- a/ext/intl/tests/dateformat_get_set_calendar_variant2.phpt
+++ b/ext/intl/tests/dateformat_get_set_calendar_variant2.phpt
@@ -35,7 +35,6 @@ $df->setCalendar($cal);
d($df);
?>
-==DONE==
--EXPECT--
dimanche 1 janvier 2012 ap. J.-C. 03:00:00 UTC+03:00
int(1)
@@ -52,4 +51,3 @@ bool(false)
string(9) "gregorian"
string(3) "UTC"
-==DONE==
diff --git a/ext/intl/tests/dateformat_get_set_calendar_variant3.phpt b/ext/intl/tests/dateformat_get_set_calendar_variant3.phpt
index 97f2911cfe..dc6f75ec04 100644
--- a/ext/intl/tests/dateformat_get_set_calendar_variant3.phpt
+++ b/ext/intl/tests/dateformat_get_set_calendar_variant3.phpt
@@ -36,7 +36,6 @@ $df->setCalendar($cal);
d($df);
?>
-==DONE==
--EXPECT--
dimanche 1 janvier 2012 ap. J.-C. à 03:00:00 UTC+03:00
int(1)
@@ -53,4 +52,3 @@ bool(false)
string(9) "gregorian"
string(3) "UTC"
-==DONE==
diff --git a/ext/intl/tests/dateformat_get_set_calendar_variant4.phpt b/ext/intl/tests/dateformat_get_set_calendar_variant4.phpt
index 1d9ab7ecf5..43ec99e61f 100644
--- a/ext/intl/tests/dateformat_get_set_calendar_variant4.phpt
+++ b/ext/intl/tests/dateformat_get_set_calendar_variant4.phpt
@@ -36,7 +36,6 @@ $df->setCalendar($cal);
d($df);
?>
-==DONE==
--EXPECT--
dimanche 1 janvier 2012 ap. J.-C. à 03:00:00 heure de Kaliningrad
int(1)
@@ -53,4 +52,3 @@ bool(false)
string(9) "gregorian"
string(3) "UTC"
-==DONE==
diff --git a/ext/intl/tests/dateformat_get_set_calendar_variant5.phpt b/ext/intl/tests/dateformat_get_set_calendar_variant5.phpt
index 43e9a8516b..57e5b80ea7 100644
--- a/ext/intl/tests/dateformat_get_set_calendar_variant5.phpt
+++ b/ext/intl/tests/dateformat_get_set_calendar_variant5.phpt
@@ -35,7 +35,6 @@ $df->setCalendar($cal);
d($df);
?>
-==DONE==
--EXPECT--
dimanche 1 janvier 2012 ap. J.-C. à 03:00:00 heure de Kaliningrad
int(1)
@@ -52,4 +51,3 @@ bool(false)
string(9) "gregorian"
string(3) "UTC"
-==DONE==
diff --git a/ext/intl/tests/dateformat_get_set_pattern2.phpt b/ext/intl/tests/dateformat_get_set_pattern2.phpt
index b741906ad6..11a5899883 100644
--- a/ext/intl/tests/dateformat_get_set_pattern2.phpt
+++ b/ext/intl/tests/dateformat_get_set_pattern2.phpt
@@ -14,7 +14,7 @@ function ut_main()
{
$pattern_arr = array (
'DD-MM-YYYY hh:mm:ss',
- 'yyyy-DDD.hh:mm:ss z',
+ 'yyyy-DDD.hh:mm:ss z',
"yyyy/MM/dd",
"yyyyMMdd"
);
@@ -27,8 +27,8 @@ function ut_main()
$fmt = ut_datefmt_create( "en-US", IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'America/New_York', IntlDateFormatter::GREGORIAN , $start_pattern );
$pattern = ut_datefmt_get_pattern( $fmt);
$res_str .= "\nAfter call to get_pattern : pattern= $pattern";
- $formatted = ut_datefmt_format($fmt,0);
- $res_str .= "\nResult of formatting timestamp=0 is : \n$formatted";
+ $formatted = ut_datefmt_format($fmt,0);
+ $res_str .= "\nResult of formatting timestamp=0 is : \n$formatted";
foreach( $pattern_arr as $pattern_entry )
@@ -38,7 +38,7 @@ function ut_main()
ut_datefmt_set_pattern( $fmt , $pattern_entry );
$pattern = ut_datefmt_get_pattern( $fmt);
$res_str .= "\nAfter call to get_pattern : pattern= $pattern";
- $formatted = ut_datefmt_format($fmt,0);
+ $formatted = ut_datefmt_format($fmt,0);
$res_str .= "\nResult of formatting timestamp=0 with the new pattern is : \n$formatted";
$res_str .= "\n";
diff --git a/ext/intl/tests/dateformat_get_set_timezone.phpt b/ext/intl/tests/dateformat_get_set_timezone.phpt
index 7973aee2e7..a621f64a85 100644
--- a/ext/intl/tests/dateformat_get_set_timezone.phpt
+++ b/ext/intl/tests/dateformat_get_set_timezone.phpt
@@ -37,7 +37,6 @@ $df->setTimeZone(new DateTimeZone('Europe/Amsterdam'));
d($df);
?>
-==DONE==
--EXPECTF--
Domingo, 1 de Janeiro de 2012 3:00:00 GMT+03:00
string(12) "Europe/Minsk"
@@ -59,4 +58,3 @@ Domingo, 1 de Janeiro de 2012 1:00:00 Hor%s %Sda Europa Central
string(16) "Europe/Amsterdam"
string(16) "Europe/Amsterdam"
-==DONE==
diff --git a/ext/intl/tests/dateformat_get_set_timezone_variant2.phpt b/ext/intl/tests/dateformat_get_set_timezone_variant2.phpt
index f19f0ffd5b..f87734db63 100644
--- a/ext/intl/tests/dateformat_get_set_timezone_variant2.phpt
+++ b/ext/intl/tests/dateformat_get_set_timezone_variant2.phpt
@@ -37,7 +37,6 @@ $df->setTimeZone(new DateTimeZone('Europe/Amsterdam'));
d($df);
?>
-==DONE==
--EXPECTF--
Domingo, 1 de Janeiro de 2012 às 03:00:00 GMT+03:00
string(12) "Europe/Minsk"
@@ -59,4 +58,3 @@ Domingo, 1 de Janeiro de 2012 às 01:00:00 Hor%s %Sda Europa Central
string(16) "Europe/Amsterdam"
string(16) "Europe/Amsterdam"
-==DONE==
diff --git a/ext/intl/tests/dateformat_get_set_timezone_variant3.phpt b/ext/intl/tests/dateformat_get_set_timezone_variant3.phpt
index a06bbc1eaa..6de2ddb101 100644
--- a/ext/intl/tests/dateformat_get_set_timezone_variant3.phpt
+++ b/ext/intl/tests/dateformat_get_set_timezone_variant3.phpt
@@ -38,7 +38,6 @@ $df->setTimeZone(new DateTimeZone('Europe/Amsterdam'));
d($df);
?>
-==DONE==
--EXPECTF--
domingo, 1 de Janeiro de 2012 às 03:00:00 GMT+03:00
string(12) "Europe/Minsk"
@@ -60,4 +59,3 @@ domingo, 1 de Janeiro de 2012 às 01:00:00 Hor%s Padrão %Sda Europa Central
string(16) "Europe/Amsterdam"
string(16) "Europe/Amsterdam"
-==DONE==
diff --git a/ext/intl/tests/dateformat_get_set_timezone_variant4.phpt b/ext/intl/tests/dateformat_get_set_timezone_variant4.phpt
index 8a563d8a90..3d6dd8fb57 100644
--- a/ext/intl/tests/dateformat_get_set_timezone_variant4.phpt
+++ b/ext/intl/tests/dateformat_get_set_timezone_variant4.phpt
@@ -38,7 +38,6 @@ $df->setTimeZone(new DateTimeZone('Europe/Amsterdam'));
d($df);
?>
-==DONE==
--EXPECTF--
domingo, 1 de janeiro de 2012 às 03:00:00 Hor%s do Extremo Leste da Europa
string(12) "Europe/Minsk"
@@ -60,4 +59,3 @@ domingo, 1 de janeiro de 2012 às 01:00:00 Hor%s Padrão %Sda Europa Central
string(16) "Europe/Amsterdam"
string(16) "Europe/Amsterdam"
-==DONE==
diff --git a/ext/intl/tests/dateformat_get_set_timezone_variant5.phpt b/ext/intl/tests/dateformat_get_set_timezone_variant5.phpt
index 1487751bd6..1b63a82b26 100644
--- a/ext/intl/tests/dateformat_get_set_timezone_variant5.phpt
+++ b/ext/intl/tests/dateformat_get_set_timezone_variant5.phpt
@@ -37,7 +37,6 @@ $df->setTimeZone(new DateTimeZone('Europe/Amsterdam'));
d($df);
?>
-==DONE==
--EXPECTF--
domingo, 1 de janeiro de 2012 às 03:00:00 Hor%s do Extremo Leste da Europa
string(12) "Europe/Minsk"
@@ -59,4 +58,3 @@ domingo, 1 de janeiro de 2012 às 01:00:00 Hor%s padrão %Sda Europa Central
string(16) "Europe/Amsterdam"
string(16) "Europe/Amsterdam"
-==DONE==
diff --git a/ext/intl/tests/dateformat_get_timetype.phpt b/ext/intl/tests/dateformat_get_timetype.phpt
index cca3c6f96a..59a8f5e112 100644
--- a/ext/intl/tests/dateformat_get_timetype.phpt
+++ b/ext/intl/tests/dateformat_get_timetype.phpt
@@ -12,26 +12,26 @@ datefmt_get_timetype_code()
function ut_main()
{
- $timetype_arr = array (
- IntlDateFormatter::FULL,
- IntlDateFormatter::LONG,
- IntlDateFormatter::MEDIUM,
- IntlDateFormatter::SHORT,
- IntlDateFormatter::NONE
- );
-
- $res_str = '';
-
- foreach( $timetype_arr as $timetype_entry )
- {
- $res_str .= "\nCreating IntlDateFormatter with time_type = $timetype_entry";
- $fmt = ut_datefmt_create( "de-DE", IntlDateFormatter::SHORT, $timetype_entry ,'America/Los_Angeles', IntlDateFormatter::GREGORIAN );
- $time_type = ut_datefmt_get_timetype( $fmt);
- $res_str .= "\nAfter call to get_timetype : timetype= $time_type";
- $res_str .= "\n";
- }
-
- return $res_str;
+ $timetype_arr = array (
+ IntlDateFormatter::FULL,
+ IntlDateFormatter::LONG,
+ IntlDateFormatter::MEDIUM,
+ IntlDateFormatter::SHORT,
+ IntlDateFormatter::NONE
+ );
+
+ $res_str = '';
+
+ foreach( $timetype_arr as $timetype_entry )
+ {
+ $res_str .= "\nCreating IntlDateFormatter with time_type = $timetype_entry";
+ $fmt = ut_datefmt_create( "de-DE", IntlDateFormatter::SHORT, $timetype_entry ,'America/Los_Angeles', IntlDateFormatter::GREGORIAN );
+ $time_type = ut_datefmt_get_timetype( $fmt);
+ $res_str .= "\nAfter call to get_timetype : timetype= $time_type";
+ $res_str .= "\n";
+ }
+
+ return $res_str;
}
diff --git a/ext/intl/tests/dateformat_get_timezone_id.phpt b/ext/intl/tests/dateformat_get_timezone_id.phpt
index f529614f21..2df0ba40b1 100644
--- a/ext/intl/tests/dateformat_get_timezone_id.phpt
+++ b/ext/intl/tests/dateformat_get_timezone_id.phpt
@@ -15,24 +15,24 @@ intl.error_level=E_WARNING
function ut_main()
{
- $timezone_id_arr = array (
- 'America/New_York',
- 'US/Pacific',
- 'US/Central'
- );
-
- $res_str = '';
-
- foreach( $timezone_id_arr as $timezone_id_entry )
- {
- $res_str .= "\nCreating IntlDateFormatter with timezone_id = $timezone_id_entry";
- $fmt = ut_datefmt_create( "de-DE", IntlDateFormatter::SHORT, IntlDateFormatter::SHORT, $timezone_id_entry , IntlDateFormatter::GREGORIAN );
- $timezone_id = ut_datefmt_get_timezone_id( $fmt);
- $res_str .= "\nAfter call to get_timezone_id : timezone_id= $timezone_id";
- $res_str .= "\n";
- }
-
- return $res_str;
+ $timezone_id_arr = array (
+ 'America/New_York',
+ 'US/Pacific',
+ 'US/Central'
+ );
+
+ $res_str = '';
+
+ foreach( $timezone_id_arr as $timezone_id_entry )
+ {
+ $res_str .= "\nCreating IntlDateFormatter with timezone_id = $timezone_id_entry";
+ $fmt = ut_datefmt_create( "de-DE", IntlDateFormatter::SHORT, IntlDateFormatter::SHORT, $timezone_id_entry , IntlDateFormatter::GREGORIAN );
+ $timezone_id = ut_datefmt_get_timezone_id( $fmt);
+ $res_str .= "\nAfter call to get_timezone_id : timezone_id= $timezone_id";
+ $res_str .= "\n";
+ }
+
+ return $res_str;
}
diff --git a/ext/intl/tests/dateformat_is_set_lenient.phpt b/ext/intl/tests/dateformat_is_set_lenient.phpt
index b78396b77f..4725ff8cb6 100644
--- a/ext/intl/tests/dateformat_is_set_lenient.phpt
+++ b/ext/intl/tests/dateformat_is_set_lenient.phpt
@@ -15,54 +15,54 @@ function ut_main()
$res_str = '';
- //Create
+ //Create
$fmt = ut_datefmt_create( "en-US", IntlDateFormatter::SHORT, IntlDateFormatter::SHORT , 'America/New_York', IntlDateFormatter::GREGORIAN );
$res_str .= "\nIntlDateFormatter Created.\n";
$resLenient1 = ut_datefmt_is_lenient( $fmt);
$res_str .= "After call to get_lenient : lenient= ";
- if( $resLenient1){
- $res_str .= "TRUE\n";
- }else{
- $res_str .= "FALSE\n";
- }
+ if( $resLenient1){
+ $res_str .= "TRUE\n";
+ }else{
+ $res_str .= "FALSE\n";
+ }
- //Set and test
+ //Set and test
$res_str .= "--------------------\n";
$isLenient = TRUE;
- $res_str .= "Setting IntlDateFormatter with lenient = ";
- if( $isLenient){
- $res_str .= "TRUE\n";
- }else{
- $res_str .= "FALSE\n";
- }
- ut_datefmt_set_lenient( $fmt , $isLenient );
- $resLenient = ut_datefmt_is_lenient( $fmt);
- $res_str .= "After call to is_lenient : lenient= ";
- if( $resLenient){
- $res_str .= "TRUE\n";
- }else{
- $res_str .= "FALSE\n";
- }
+ $res_str .= "Setting IntlDateFormatter with lenient = ";
+ if( $isLenient){
+ $res_str .= "TRUE\n";
+ }else{
+ $res_str .= "FALSE\n";
+ }
+ ut_datefmt_set_lenient( $fmt , $isLenient );
+ $resLenient = ut_datefmt_is_lenient( $fmt);
+ $res_str .= "After call to is_lenient : lenient= ";
+ if( $resLenient){
+ $res_str .= "TRUE\n";
+ }else{
+ $res_str .= "FALSE\n";
+ }
- //Set and test
+ //Set and test
$res_str .= "--------------------\n";
$isLenient = FALSE;
- $res_str .= "Setting IntlDateFormatter with lenient =";
- if( $isLenient){
- $res_str .= "TRUE\n";
- }else{
- $res_str .= "FALSE\n";
- }
- ut_datefmt_set_lenient( $fmt , $isLenient);
- $resLenient = ut_datefmt_is_lenient( $fmt);
- $res_str .= "After call to is_lenient : lenient= ";
- if( $resLenient){
- $res_str .= "TRUE\n";
- }else{
- $res_str .= "FALSE\n";
- }
+ $res_str .= "Setting IntlDateFormatter with lenient =";
+ if( $isLenient){
+ $res_str .= "TRUE\n";
+ }else{
+ $res_str .= "FALSE\n";
+ }
+ ut_datefmt_set_lenient( $fmt , $isLenient);
+ $resLenient = ut_datefmt_is_lenient( $fmt);
+ $res_str .= "After call to is_lenient : lenient= ";
+ if( $resLenient){
+ $res_str .= "TRUE\n";
+ }else{
+ $res_str .= "FALSE\n";
+ }
$res_str .= "--------------------\n";
diff --git a/ext/intl/tests/dateformat_setTimeZone_error.phpt b/ext/intl/tests/dateformat_setTimeZone_error.phpt
index b58d159088..72e78af5f3 100644
--- a/ext/intl/tests/dateformat_setTimeZone_error.phpt
+++ b/ext/intl/tests/dateformat_setTimeZone_error.phpt
@@ -12,41 +12,15 @@ ini_set("date.timezone", 'Atlantic/Azores');
$df = new IntlDateFormatter(NULL, 0, 0);
-var_dump($df->setTimeZone());
-var_dump(datefmt_set_timezone());
var_dump($df->setTimeZone(array()));
-var_dump($df->setTimeZone(1, 2));
var_dump($df->setTimeZone('non existing timezone'));
-var_dump(datefmt_set_timezone(new stdclass, 'UTC'));
?>
-==DONE==
--EXPECTF--
-Warning: IntlDateFormatter::setTimeZone() expects exactly 1 parameter, 0 given in %s on line %d
+Warning: Array to string conversion in %s on line %d
-Warning: IntlDateFormatter::setTimeZone(): datefmt_set_timezone: unable to parse input params in %s on line %d
+Warning: IntlDateFormatter::setTimeZone(): datefmt_set_timezone: No such time zone: 'Array' in %s on line %d
bool(false)
-Warning: datefmt_set_timezone() expects exactly 2 parameters, 0 given in %s on line %d
-
-Warning: datefmt_set_timezone(): datefmt_set_timezone: unable to parse input params in %s on line %d
-bool(false)
-
-Notice: Array to string conversion in %s on line %d
-
-Warning: IntlDateFormatter::setTimeZone(): datefmt_set_timezone: no such time zone: 'Array' in %s on line %d
-bool(false)
-
-Warning: IntlDateFormatter::setTimeZone() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlDateFormatter::setTimeZone(): datefmt_set_timezone: unable to parse input params in %s on line %d
-bool(false)
-
-Warning: IntlDateFormatter::setTimeZone(): datefmt_set_timezone: no such time zone: 'non existing timezone' in %s on line %d
-bool(false)
-
-Warning: datefmt_set_timezone() expects parameter 1 to be IntlDateFormatter, object given in %s on line %d
-
-Warning: datefmt_set_timezone(): datefmt_set_timezone: unable to parse input params in %s on line %d
+Warning: IntlDateFormatter::setTimeZone(): datefmt_set_timezone: No such time zone: 'non existing timezone' in %s on line %d
bool(false)
-==DONE==
diff --git a/ext/intl/tests/dateformat_set_timezone_id2.phpt b/ext/intl/tests/dateformat_set_timezone_id2.phpt
index 3d22f7d03d..b1fc00b875 100644
--- a/ext/intl/tests/dateformat_set_timezone_id2.phpt
+++ b/ext/intl/tests/dateformat_set_timezone_id2.phpt
@@ -9,7 +9,6 @@ date.timezone=Atlantic/Azores
<?php
ini_set("intl.error_level", E_WARNING);
-ini_set("error_reporting", ~E_DEPRECATED);
/*
* Test for the datefmt_set_timezone_id function
@@ -18,37 +17,37 @@ ini_set("error_reporting", ~E_DEPRECATED);
function ut_main()
{
- $timezone_id_arr = array (
- 'America/New_York',
- 'America/Los_Angeles',
- 'America/Chicago',
- 'CN'
- );
- $timestamp_entry = 0;
+ $timezone_id_arr = array (
+ 'America/New_York',
+ 'America/Los_Angeles',
+ 'America/Chicago',
+ 'CN'
+ );
+ $timestamp_entry = 0;
- $res_str = '';
+ $res_str = '';
- $fmt = ut_datefmt_create( "en_US", IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'US/Pacific' , IntlDateFormatter::GREGORIAN );
- $timezone_id = ut_datefmt_get_timezone_id( $fmt );
- $res_str .= "\nAfter creation of the dateformatter : timezone_id= $timezone_id\n";
+ $fmt = ut_datefmt_create( "en_US", IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'US/Pacific' , IntlDateFormatter::GREGORIAN );
+ $timezone_id = ut_datefmt_get_timezone_id( $fmt );
+ $res_str .= "\nAfter creation of the dateformatter : timezone_id= $timezone_id\n";
- foreach( $timezone_id_arr as $timezone_id_entry )
- {
+ foreach( $timezone_id_arr as $timezone_id_entry )
+ {
- $res_str .= "-----------";
- $res_str .= "\nTrying to set timezone_id= $timezone_id_entry";
- ut_datefmt_set_timezone_id( $fmt , $timezone_id_entry );
- $timezone_id = ut_datefmt_get_timezone_id( $fmt );
- $res_str .= "\nAfter call to set_timezone_id : timezone_id= $timezone_id";
- $formatted = ut_datefmt_format( $fmt, 0);
- $res_str .= "\nFormatting timestamp=0 resulted in $formatted";
- $formatted = ut_datefmt_format( $fmt, 3600);
- $res_str .= "\nFormatting timestamp=3600 resulted in $formatted";
- $res_str .= "\n";
+ $res_str .= "-----------";
+ $res_str .= "\nTrying to set timezone_id= $timezone_id_entry";
+ ut_datefmt_set_timezone_id( $fmt , $timezone_id_entry );
+ $timezone_id = ut_datefmt_get_timezone_id( $fmt );
+ $res_str .= "\nAfter call to set_timezone_id : timezone_id= $timezone_id";
+ $formatted = ut_datefmt_format( $fmt, 0);
+ $res_str .= "\nFormatting timestamp=0 resulted in $formatted";
+ $formatted = ut_datefmt_format( $fmt, 3600);
+ $res_str .= "\nFormatting timestamp=3600 resulted in $formatted";
+ $res_str .= "\n";
- }
+ }
- return $res_str;
+ return $res_str;
}
@@ -58,9 +57,9 @@ include_once( 'ut_common.inc' );
ut_run();
?>
--EXPECTF--
-Warning: IntlDateFormatter::setTimeZone(): datefmt_set_timezone: no such time zone: 'CN' in %s on line %d
+Warning: IntlDateFormatter::setTimeZone(): datefmt_set_timezone: No such time zone: 'CN' in %s on line %d
-Warning: datefmt_set_timezone(): datefmt_set_timezone: no such time zone: 'CN' in %s on line %d
+Warning: datefmt_set_timezone(): datefmt_set_timezone: No such time zone: 'CN' in %s on line %d
After creation of the dateformatter : timezone_id= US/Pacific
-----------
diff --git a/ext/intl/tests/dateformat_set_timezone_id3.phpt b/ext/intl/tests/dateformat_set_timezone_id3.phpt
index e25b9bfd7e..4eb963e186 100644
--- a/ext/intl/tests/dateformat_set_timezone_id3.phpt
+++ b/ext/intl/tests/dateformat_set_timezone_id3.phpt
@@ -9,7 +9,6 @@ date.timezone=Atlantic/Azores
<?php
ini_set("intl.error_level", E_WARNING);
-ini_set("error_reporting", ~E_DEPRECATED);
/*
* Test for the datefmt_set_timezone_id function
@@ -18,37 +17,37 @@ ini_set("error_reporting", ~E_DEPRECATED);
function ut_main()
{
- $timezone_id_arr = array (
- 'America/New_York',
- 'America/Los_Angeles',
- 'America/Chicago',
- 'CN'
- );
- $timestamp_entry = 0;
+ $timezone_id_arr = array (
+ 'America/New_York',
+ 'America/Los_Angeles',
+ 'America/Chicago',
+ 'CN'
+ );
+ $timestamp_entry = 0;
- $res_str = '';
+ $res_str = '';
- $fmt = ut_datefmt_create( "en_US", IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'US/Pacific' , IntlDateFormatter::GREGORIAN );
- $timezone_id = ut_datefmt_get_timezone_id( $fmt );
- $res_str .= "\nAfter creation of the dateformatter : timezone_id= $timezone_id\n";
+ $fmt = ut_datefmt_create( "en_US", IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'US/Pacific' , IntlDateFormatter::GREGORIAN );
+ $timezone_id = ut_datefmt_get_timezone_id( $fmt );
+ $res_str .= "\nAfter creation of the dateformatter : timezone_id= $timezone_id\n";
- foreach( $timezone_id_arr as $timezone_id_entry )
- {
+ foreach( $timezone_id_arr as $timezone_id_entry )
+ {
- $res_str .= "-----------";
- $res_str .= "\nTrying to set timezone_id= $timezone_id_entry";
- ut_datefmt_set_timezone_id( $fmt , $timezone_id_entry );
- $timezone_id = ut_datefmt_get_timezone_id( $fmt );
- $res_str .= "\nAfter call to set_timezone_id : timezone_id= $timezone_id";
- $formatted = ut_datefmt_format( $fmt, 0);
- $res_str .= "\nFormatting timestamp=0 resulted in $formatted";
- $formatted = ut_datefmt_format( $fmt, 3600);
- $res_str .= "\nFormatting timestamp=3600 resulted in $formatted";
- $res_str .= "\n";
+ $res_str .= "-----------";
+ $res_str .= "\nTrying to set timezone_id= $timezone_id_entry";
+ ut_datefmt_set_timezone_id( $fmt , $timezone_id_entry );
+ $timezone_id = ut_datefmt_get_timezone_id( $fmt );
+ $res_str .= "\nAfter call to set_timezone_id : timezone_id= $timezone_id";
+ $formatted = ut_datefmt_format( $fmt, 0);
+ $res_str .= "\nFormatting timestamp=0 resulted in $formatted";
+ $formatted = ut_datefmt_format( $fmt, 3600);
+ $res_str .= "\nFormatting timestamp=3600 resulted in $formatted";
+ $res_str .= "\n";
- }
+ }
- return $res_str;
+ return $res_str;
}
@@ -58,9 +57,9 @@ include_once( 'ut_common.inc' );
ut_run();
?>
--EXPECTF--
-Warning: IntlDateFormatter::setTimeZone(): datefmt_set_timezone: no such time zone: 'CN' in %sut_common.inc on line %d
+Warning: IntlDateFormatter::setTimeZone(): datefmt_set_timezone: No such time zone: 'CN' in %sut_common.inc on line %d
-Warning: datefmt_set_timezone(): datefmt_set_timezone: no such time zone: 'CN' in %sut_common.inc on line %d
+Warning: datefmt_set_timezone(): datefmt_set_timezone: No such time zone: 'CN' in %sut_common.inc on line %d
After creation of the dateformatter : timezone_id= US/Pacific
-----------
diff --git a/ext/intl/tests/formatter_clone.phpt b/ext/intl/tests/formatter_clone.phpt
index d474eb2b70..4ca2d44dc9 100644
--- a/ext/intl/tests/formatter_clone.phpt
+++ b/ext/intl/tests/formatter_clone.phpt
@@ -17,7 +17,7 @@ $fmt_clone = clone $fmt;
$res = $fmt->setPattern("0.0" );
if( $res === false )
- $res_str .= ut_nfmt_get_error_message( $fmt ) . " (" . ut_nfmt_get_error_code( $fmt ) . ")\n";
+ $res_str .= ut_nfmt_get_error_message( $fmt ) . " (" . ut_nfmt_get_error_code( $fmt ) . ")\n";
$res_str .= "Formatted number: " . ut_nfmt_format( $fmt, $test_value ) . "\n";
$res_str .= "Formatted(clone) number: " . ut_nfmt_format( $fmt_clone, $test_value ) . "\n";
diff --git a/ext/intl/tests/formatter_clone_bad_obj.phpt b/ext/intl/tests/formatter_clone_bad_obj.phpt
index 53a715e6a7..d27024cb39 100644
--- a/ext/intl/tests/formatter_clone_bad_obj.phpt
+++ b/ext/intl/tests/formatter_clone_bad_obj.phpt
@@ -6,14 +6,14 @@ Cloning unconstructed numfmt
<?php
class A extends NumberFormatter {
- function __construct() {}
+ function __construct() {}
}
$a = new A;
try {
- $b = clone $a;
+ $b = clone $a;
} catch (Exception $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
--EXPECT--
string(42) "Cannot clone unconstructed NumberFormatter"
diff --git a/ext/intl/tests/formatter_fail.phpt b/ext/intl/tests/formatter_fail.phpt
index 9cfc6f5054..4bce9184cc 100644
--- a/ext/intl/tests/formatter_fail.phpt
+++ b/ext/intl/tests/formatter_fail.phpt
@@ -6,95 +6,115 @@ numfmt creation failures
<?php
function err($fmt) {
- if(!$fmt) {
- echo var_export(intl_get_error_message(), true)."\n";
- }
+ if(!$fmt) {
+ echo var_export(intl_get_error_message(), true)."\n";
+ }
}
function print_exception($e) {
- echo "\n" . get_class($e) . ": " . $e->getMessage()
+ echo "\n" . get_class($e) . ": " . $e->getMessage()
. " in " . $e->getFile() . " on line " . $e->getLine() . "\n";
}
function crt($t, $l, $s) {
- switch(true) {
- case $t == "O":
- try {
- return new NumberFormatter($l, $s);
- } catch (Throwable $e) {
- print_exception($e);
- return null;
- }
- break;
- case $t == "C":
- return NumberFormatter::create($l, $s);
- break;
- case $t == "P":
- return numfmt_create($l, $s);
- break;
- }
+ switch(true) {
+ case $t == "O":
+ try {
+ return new NumberFormatter($l, $s);
+ } catch (Throwable $e) {
+ print_exception($e);
+ return null;
+ }
+ break;
+ case $t == "C":
+ try {
+ return NumberFormatter::create($l, $s);
+ } catch (Throwable $e) {
+ print_exception($e);
+ return null;
+ }
+ break;
+ case $t == "P":
+ try {
+ return numfmt_create($l, $s);
+ } catch (Throwable $e) {
+ print_exception($e);
+ return null;
+ }
+ break;
+ }
}
$args = array(
- array(null, null),
- array("whatever", 1234567),
- array(array(), array()),
- array("en", -1),
- array("en_US", NumberFormatter::PATTERN_RULEBASED),
+ array(null, null),
+ array("whatever", 1234567),
+ array(array(), array()),
+ array("en", -1),
+ array("en_US", NumberFormatter::PATTERN_RULEBASED),
);
try {
- $fmt = new NumberFormatter();
+ $fmt = new NumberFormatter();
} catch (TypeError $e) {
- print_exception($e);
- $fmt = null;
+ print_exception($e);
+ $fmt = null;
}
err($fmt);
-$fmt = numfmt_create();
+try {
+ $fmt = numfmt_create();
+} catch (TypeError $e) {
+ print_exception($e);
+ $fmt = null;
+}
err($fmt);
-$fmt = NumberFormatter::create();
+try {
+ $fmt = NumberFormatter::create();
+} catch (TypeError $e) {
+ print_exception($e);
+ $fmt = null;
+}
err($fmt);
foreach($args as $arg) {
- $fmt = crt("O", $arg[0], $arg[1]);
- err($fmt);
- $fmt = crt("C", $arg[0], $arg[1]);
- err($fmt);
- $fmt = crt("P", $arg[0], $arg[1]);
- err($fmt);
+ $fmt = crt("O", $arg[0], $arg[1]);
+ err($fmt);
+ $fmt = crt("C", $arg[0], $arg[1]);
+ err($fmt);
+ $fmt = crt("P", $arg[0], $arg[1]);
+ err($fmt);
}
?>
--EXPECTF--
ArgumentCountError: NumberFormatter::__construct() expects at least 2 parameters, 0 given in %s on line %d
-'numfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
+'U_ZERO_ERROR'
-Warning: numfmt_create() expects at least 2 parameters, 0 given in %s on line %d
-'numfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
+ArgumentCountError: numfmt_create() expects at least 2 parameters, 0 given in %s on line %d
+'U_ZERO_ERROR'
-Warning: NumberFormatter::create() expects at least 2 parameters, 0 given in %s on line %d
-'numfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
+ArgumentCountError: NumberFormatter::create() expects at least 2 parameters, 0 given in %s on line %d
+'U_ZERO_ERROR'
-IntlException: Constructor failed in %sformatter_fail.php on line %d
+IntlException: Constructor failed in %s on line %d
'numfmt_create: number formatter creation failed: U_UNSUPPORTED_ERROR'
'numfmt_create: number formatter creation failed: U_UNSUPPORTED_ERROR'
'numfmt_create: number formatter creation failed: U_UNSUPPORTED_ERROR'
TypeError: NumberFormatter::__construct() expects parameter 1 to be string, array given in %s on line %d
-'numfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
+'U_ZERO_ERROR'
-Warning: NumberFormatter::create() expects parameter 1 to be string, array given in %s on line %d
-'numfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
+TypeError: NumberFormatter::create() expects parameter 1 to be string, array given in %s on line %d
+'U_ZERO_ERROR'
-Warning: numfmt_create() expects parameter 1 to be string, array given in %s on line %d
-'numfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
+TypeError: numfmt_create() expects parameter 1 to be string, array given in %s on line %d
+'U_ZERO_ERROR'
-IntlException: Constructor failed in %sformatter_fail.php on line %d
+IntlException: Constructor failed in %s on line %d
'numfmt_create: number formatter creation failed: U_UNSUPPORTED_ERROR'
'numfmt_create: number formatter creation failed: U_UNSUPPORTED_ERROR'
'numfmt_create: number formatter creation failed: U_UNSUPPORTED_ERROR'
-IntlException: Constructor failed in %sformatter_fail.php on line %d
+IntlException: Constructor failed in %s on line %d
'numfmt_create: number formatter creation failed: U_MEMORY_ALLOCATION_ERROR'
'numfmt_create: number formatter creation failed: U_MEMORY_ALLOCATION_ERROR'
'numfmt_create: number formatter creation failed: U_MEMORY_ALLOCATION_ERROR'
diff --git a/ext/intl/tests/formatter_format2.phpt b/ext/intl/tests/formatter_format2.phpt
index 26ef060ea0..d6e06cb57c 100644
--- a/ext/intl/tests/formatter_format2.phpt
+++ b/ext/intl/tests/formatter_format2.phpt
@@ -52,10 +52,10 @@ function ut_main()
{
$fmt = ut_nfmt_create( $locale, $style, $pattern );
- if(!$fmt) {
- $str_res .= "Bad formatter!\n";
- continue;
- }
+ if(!$fmt) {
+ $str_res .= "Bad formatter!\n";
+ continue;
+ }
$str_res .= dump( isset($integer[$style])?ut_nfmt_format( $fmt, $number, NumberFormatter::TYPE_INT32):ut_nfmt_format( $fmt, $number ) ) . "\n";
}
}
diff --git a/ext/intl/tests/formatter_format3.phpt b/ext/intl/tests/formatter_format3.phpt
index b9d6eb5c3d..19512acc41 100644
--- a/ext/intl/tests/formatter_format3.phpt
+++ b/ext/intl/tests/formatter_format3.phpt
@@ -53,10 +53,10 @@ function ut_main()
{
$fmt = ut_nfmt_create( $locale, $style, $pattern );
- if(!$fmt) {
- $str_res .= "Bad formatter!\n";
- continue;
- }
+ if(!$fmt) {
+ $str_res .= "Bad formatter!\n";
+ continue;
+ }
$str_res .= dump( isset($integer[$style])?ut_nfmt_format( $fmt, $number, NumberFormatter::TYPE_INT32):ut_nfmt_format( $fmt, $number ) ) . "\n";
}
}
diff --git a/ext/intl/tests/formatter_format4.phpt b/ext/intl/tests/formatter_format4.phpt
index 96dd7be53e..0cc086b31e 100644
--- a/ext/intl/tests/formatter_format4.phpt
+++ b/ext/intl/tests/formatter_format4.phpt
@@ -53,10 +53,10 @@ function ut_main()
{
$fmt = ut_nfmt_create( $locale, $style, $pattern );
- if(!$fmt) {
- $str_res .= "Bad formatter!\n";
- continue;
- }
+ if(!$fmt) {
+ $str_res .= "Bad formatter!\n";
+ continue;
+ }
$str_res .= dump( isset($integer[$style])?ut_nfmt_format( $fmt, $number, NumberFormatter::TYPE_INT32):ut_nfmt_format( $fmt, $number ) ) . "\n";
}
}
diff --git a/ext/intl/tests/formatter_format5.phpt b/ext/intl/tests/formatter_format5.phpt
index 0bc4a6679b..8399af1129 100644
--- a/ext/intl/tests/formatter_format5.phpt
+++ b/ext/intl/tests/formatter_format5.phpt
@@ -53,10 +53,10 @@ function ut_main()
{
$fmt = ut_nfmt_create( $locale, $style, $pattern );
- if(!$fmt) {
- $str_res .= "Bad formatter!\n";
- continue;
- }
+ if(!$fmt) {
+ $str_res .= "Bad formatter!\n";
+ continue;
+ }
$str_res .= dump( isset($integer[$style])?ut_nfmt_format( $fmt, $number, NumberFormatter::TYPE_INT32):ut_nfmt_format( $fmt, $number ) ) . "\n";
}
}
diff --git a/ext/intl/tests/formatter_format6.phpt b/ext/intl/tests/formatter_format6.phpt
index 70703785c1..6244a7f290 100644
--- a/ext/intl/tests/formatter_format6.phpt
+++ b/ext/intl/tests/formatter_format6.phpt
@@ -53,10 +53,10 @@ function ut_main()
{
$fmt = ut_nfmt_create( $locale, $style, $pattern );
- if(!$fmt) {
- $str_res .= "Bad formatter!\n";
- continue;
- }
+ if(!$fmt) {
+ $str_res .= "Bad formatter!\n";
+ continue;
+ }
$str_res .= dump( isset($integer[$style])?ut_nfmt_format( $fmt, $number, NumberFormatter::TYPE_INT32):ut_nfmt_format( $fmt, $number ) ) . "\n";
}
}
diff --git a/ext/intl/tests/formatter_format7.phpt b/ext/intl/tests/formatter_format7.phpt
index 13d58bdd51..453a16e2b5 100644
--- a/ext/intl/tests/formatter_format7.phpt
+++ b/ext/intl/tests/formatter_format7.phpt
@@ -53,10 +53,10 @@ function ut_main()
{
$fmt = ut_nfmt_create( $locale, $style, $pattern );
- if(!$fmt) {
- $str_res .= "Bad formatter!\n";
- continue;
- }
+ if(!$fmt) {
+ $str_res .= "Bad formatter!\n";
+ continue;
+ }
$str_res .= dump( isset($integer[$style])?ut_nfmt_format( $fmt, $number, NumberFormatter::TYPE_INT32):ut_nfmt_format( $fmt, $number ) ) . "\n";
}
}
diff --git a/ext/intl/tests/formatter_format8.phpt b/ext/intl/tests/formatter_format8.phpt
index 3aad6bced1..dcf8d8bca9 100644
--- a/ext/intl/tests/formatter_format8.phpt
+++ b/ext/intl/tests/formatter_format8.phpt
@@ -52,10 +52,10 @@ function ut_main()
{
$fmt = ut_nfmt_create( $locale, $style, $pattern );
- if(!$fmt) {
- $str_res .= "Bad formatter!\n";
- continue;
- }
+ if(!$fmt) {
+ $str_res .= "Bad formatter!\n";
+ continue;
+ }
$str_res .= dump( isset($integer[$style])?ut_nfmt_format( $fmt, $number, NumberFormatter::TYPE_INT32):ut_nfmt_format( $fmt, $number ) ) . "\n";
}
}
diff --git a/ext/intl/tests/formatter_get_set_pattern.phpt b/ext/intl/tests/formatter_get_set_pattern.phpt
index 66d6837d75..441a8ecb15 100644
--- a/ext/intl/tests/formatter_get_set_pattern.phpt
+++ b/ext/intl/tests/formatter_get_set_pattern.phpt
@@ -33,8 +33,8 @@ function ut_main()
$res_str .= "New pattern: '" . ut_nfmt_get_pattern( $fmt ) . "'\n";
$res_str .= "Formatted number: " . ut_nfmt_format( $fmt, $test_value ) . "\n";
- ut_nfmt_set_pattern($fmt, str_repeat('@', 200));
- $res_str .= "New pattern: '" . ut_nfmt_get_pattern( $fmt ) . "'\n";
+ ut_nfmt_set_pattern($fmt, str_repeat('@', 200));
+ $res_str .= "New pattern: '" . ut_nfmt_get_pattern( $fmt ) . "'\n";
$res_str .= "Formatted number: " . ut_nfmt_format( $fmt, $test_value ) . "\n";
return $res_str;
diff --git a/ext/intl/tests/formatter_get_set_pattern2.phpt b/ext/intl/tests/formatter_get_set_pattern2.phpt
index b1d1ad0c48..f15c3bf75c 100644
--- a/ext/intl/tests/formatter_get_set_pattern2.phpt
+++ b/ext/intl/tests/formatter_get_set_pattern2.phpt
@@ -33,8 +33,8 @@ function ut_main()
$res_str .= "New pattern: '" . ut_nfmt_get_pattern( $fmt ) . "'\n";
$res_str .= "Formatted number: " . ut_nfmt_format( $fmt, $test_value ) . "\n";
- ut_nfmt_set_pattern($fmt, str_repeat('@', 200));
- $res_str .= "New pattern: '" . ut_nfmt_get_pattern( $fmt ) . "'\n";
+ ut_nfmt_set_pattern($fmt, str_repeat('@', 200));
+ $res_str .= "New pattern: '" . ut_nfmt_get_pattern( $fmt ) . "'\n";
$res_str .= "Formatted number: " . ut_nfmt_format( $fmt, $test_value ) . "\n";
return $res_str;
diff --git a/ext/intl/tests/formatter_get_set_symbol2.phpt b/ext/intl/tests/formatter_get_set_symbol2.phpt
index 201a4f6872..f4435c278a 100644
--- a/ext/intl/tests/formatter_get_set_symbol2.phpt
+++ b/ext/intl/tests/formatter_get_set_symbol2.phpt
@@ -13,7 +13,7 @@ numfmt_get/set_symbol() icu >= 4.8
function ut_main()
{
- $longstr = str_repeat("blah", 10);
+ $longstr = str_repeat("blah", 10);
$symbols = array(
'DECIMAL_SEPARATOR_SYMBOL' => array( NumberFormatter::DECIMAL_SEPARATOR_SYMBOL, '_._', 12345.123456, NumberFormatter::DECIMAL ),
'GROUPING_SEPARATOR_SYMBOL' => array( NumberFormatter::GROUPING_SEPARATOR_SYMBOL, '_,_', 12345.123456, NumberFormatter::DECIMAL ),
@@ -33,8 +33,8 @@ function ut_main()
'NAN_SYMBOL' => array( NumberFormatter::NAN_SYMBOL, '_N_', 12345.123456, NumberFormatter::DECIMAL ),
'SIGNIFICANT_DIGIT_SYMBOL' => array( NumberFormatter::SIGNIFICANT_DIGIT_SYMBOL, '_SD_', 12345.123456, NumberFormatter::DECIMAL ),
'MONETARY_GROUPING_SEPARATOR_SYMBOL' => array( NumberFormatter::MONETARY_GROUPING_SEPARATOR_SYMBOL, '_MG_', 12345.123456, NumberFormatter::CURRENCY ),
- 'MONETARY_GROUPING_SEPARATOR_SYMBOL-2' => array( NumberFormatter::MONETARY_GROUPING_SEPARATOR_SYMBOL, "&nbsp;", 12345.123456, NumberFormatter::CURRENCY ),
- 'MONETARY_GROUPING_SEPARATOR_SYMBOL-3' => array( NumberFormatter::MONETARY_GROUPING_SEPARATOR_SYMBOL, $longstr, 12345.123456, NumberFormatter::CURRENCY ),
+ 'MONETARY_GROUPING_SEPARATOR_SYMBOL-2' => array( NumberFormatter::MONETARY_GROUPING_SEPARATOR_SYMBOL, "&nbsp;", 12345.123456, NumberFormatter::CURRENCY ),
+ 'MONETARY_GROUPING_SEPARATOR_SYMBOL-3' => array( NumberFormatter::MONETARY_GROUPING_SEPARATOR_SYMBOL, $longstr, 12345.123456, NumberFormatter::CURRENCY ),
);
$res_str = '';
@@ -76,9 +76,9 @@ function ut_main()
}
$badvals = array(2147483648, -2147483648, -1, 4294901761);
foreach($badvals as $badval) {
- if(ut_nfmt_get_symbol( $fmt, 2147483648 )) {
- $res_str .= "Bad value $badval should return false!\n";
- }
+ if(ut_nfmt_get_symbol( $fmt, 2147483648 )) {
+ $res_str .= "Bad value $badval should return false!\n";
+ }
}
return $res_str;
}
diff --git a/ext/intl/tests/formatter_get_set_text_attribute.phpt b/ext/intl/tests/formatter_get_set_text_attribute.phpt
index dea3c2d36f..b3ae867b24 100644
--- a/ext/intl/tests/formatter_get_set_text_attribute.phpt
+++ b/ext/intl/tests/formatter_get_set_text_attribute.phpt
@@ -14,14 +14,14 @@ numfmt_get/set_text_attribute() ICU < 56.1
function ut_main()
{
// Array with data for testing
- $long_str = str_repeat('blah', 100);
+ $long_str = str_repeat('blah', 100);
$attributes = array(
'POSITIVE_PREFIX' => array( NumberFormatter::POSITIVE_PREFIX, '_+_', 12345.1234 ),
'POSITIVE_SUFFIX' => array( NumberFormatter::POSITIVE_SUFFIX, '_+_', 12345.1234 ),
'NEGATIVE_PREFIX' => array( NumberFormatter::NEGATIVE_PREFIX, '_-_', -12345.1234 ),
'NEGATIVE_SUFFIX' => array( NumberFormatter::NEGATIVE_SUFFIX, '_-_', -12345.1234 ),
'PADDING_CHARACTER' => array( NumberFormatter::PADDING_CHARACTER, '^', 12345.1234 ),
- 'POSITIVE_PREFIX-2' => array( NumberFormatter::POSITIVE_PREFIX, $long_str, 12345.1234 ),
+ 'POSITIVE_PREFIX-2' => array( NumberFormatter::POSITIVE_PREFIX, $long_str, 12345.1234 ),
// 'CURRENCY_CODE' => array( NumberFormatter::CURRENCY_CODE, '_C_', 12345.1234 )
// 'DEFAULT_RULESET' => array( NumberFormatter::DEFAULT_RULESET, '_DR_', 12345.1234 ),
// 'PUBLIC_RULESETS' => array( NumberFormatter::PUBLIC_RULESETS, '_PR_', 12345.1234 )
diff --git a/ext/intl/tests/formatter_get_set_text_attribute_var2.phpt b/ext/intl/tests/formatter_get_set_text_attribute_var2.phpt
index 260e33a350..3819de6dde 100644
--- a/ext/intl/tests/formatter_get_set_text_attribute_var2.phpt
+++ b/ext/intl/tests/formatter_get_set_text_attribute_var2.phpt
@@ -14,14 +14,14 @@ numfmt_get/set_text_attribute() ICU >= 56.1
function ut_main()
{
// Array with data for testing
- $long_str = str_repeat('blah', 100);
+ $long_str = str_repeat('blah', 100);
$attributes = array(
'POSITIVE_PREFIX' => array( NumberFormatter::POSITIVE_PREFIX, '_+_', 12345.1234 ),
'POSITIVE_SUFFIX' => array( NumberFormatter::POSITIVE_SUFFIX, '_+_', 12345.1234 ),
'NEGATIVE_PREFIX' => array( NumberFormatter::NEGATIVE_PREFIX, '_-_', -12345.1234 ),
'NEGATIVE_SUFFIX' => array( NumberFormatter::NEGATIVE_SUFFIX, '_-_', -12345.1234 ),
'PADDING_CHARACTER' => array( NumberFormatter::PADDING_CHARACTER, '^', 12345.1234 ),
- 'POSITIVE_PREFIX-2' => array( NumberFormatter::POSITIVE_PREFIX, $long_str, 12345.1234 ),
+ 'POSITIVE_PREFIX-2' => array( NumberFormatter::POSITIVE_PREFIX, $long_str, 12345.1234 ),
// 'CURRENCY_CODE' => array( NumberFormatter::CURRENCY_CODE, '_C_', 12345.1234 )
// 'DEFAULT_RULESET' => array( NumberFormatter::DEFAULT_RULESET, '_DR_', 12345.1234 ),
// 'PUBLIC_RULESETS' => array( NumberFormatter::PUBLIC_RULESETS, '_PR_', 12345.1234 )
diff --git a/ext/intl/tests/grapheme.phpt b/ext/intl/tests/grapheme.phpt
index 9e14d9cc14..be82abf718 100644
--- a/ext/intl/tests/grapheme.phpt
+++ b/ext/intl/tests/grapheme.phpt
@@ -12,772 +12,772 @@ grapheme()
function ut_main()
{
- $res_str = '';
-
- $char_a_diaeresis = "\xC3\xA4"; // 'LATIN SMALL LETTER A WITH DIAERESIS' (U+00E4)
- $char_a_ring = "\xC3\xA5"; // 'LATIN SMALL LETTER A WITH RING ABOVE' (U+00E5)
- $char_o_diaeresis = "\xC3\xB6"; // 'LATIN SMALL LETTER O WITH DIAERESIS' (U+00F6)
- $char_O_diaeresis = "\xC3\x96"; // 'LATIN CAPITAL LETTER O WITH DIAERESIS' (U+00D6)
-
- $char_angstrom_sign = "\xE2\x84\xAB"; // 'ANGSTROM SIGN' (U+212B)
- $char_A_ring = "\xC3\x85"; // 'LATIN CAPITAL LETTER A WITH RING ABOVE' (U+00C5)
-
- $char_ohm_sign = "\xE2\x84\xA6"; // 'OHM SIGN' (U+2126)
- $char_omega = "\xCE\xA9"; // 'GREEK CAPITAL LETTER OMEGA' (U+03A9)
-
- $char_combining_ring_above = "\xCC\x8A"; // 'COMBINING RING ABOVE' (U+030A)
-
- $char_fi_ligature = "\xEF\xAC\x81"; // 'LATIN SMALL LIGATURE FI' (U+FB01)
-
- $char_long_s_dot = "\xE1\xBA\x9B"; // 'LATIN SMALL LETTER LONG S WITH DOT ABOVE' (U+1E9B)
-
- // the word 'hindi' using Devanagari characters:
- $hindi = "\xe0\xa4\xb9\xe0\xa4\xbf\xe0\xa4\xa8\xe0\xa5\x8d\xe0\xa4\xa6\xe0\xa5\x80";
-
- $char_a_ring_nfd = "a\xCC\x8A";
- $char_A_ring_nfd = "A\xCC\x8A";
- $char_o_diaeresis_nfd = "o\xCC\x88";
- $char_O_diaeresis_nfd = "O\xCC\x88";
- $char_diaeresis = "\xCC\x88";
-
- //=====================================================================================
- $res_str .= "\n" . 'function grapheme_strlen($string) {}' . "\n\n";
-
-
- $res_str .= "\"hindi\" in devanagari strlen " . grapheme_strlen($hindi) . "\n";
- $res_str .= "\"ab\" + \"hindi\" + \"cde\" strlen " . grapheme_strlen('ab' . $hindi . 'cde') . "\n";
- $res_str .= "\"\" strlen " . grapheme_strlen("") . "\n";
- $res_str .= "char_a_ring_nfd strlen " . grapheme_strlen($char_a_ring_nfd) . "\n";
- $res_str .= "char_a_ring_nfd + \"bc\" strlen " . grapheme_strlen($char_a_ring_nfd . 'bc') . "\n";
- $res_str .= "\"abc\" strlen " . grapheme_strlen('abc') . "\n";
-
-
- //=====================================================================================
- $res_str .= "\n" . 'function grapheme_strpos($haystack, $needle, $offset = 0) {}' . "\n\n";
-
- $tests = array(
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 5 ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ),
- array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2 ),
- array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 1 ),
- array( "abc", $char_a_ring_nfd, "false" ),
- array( $char_a_ring_nfd . "bc", "a", "false" ),
- array( "abc", "d", "false" ),
- array( "abc", "c", 2 ),
- array( "abc", "b", 1 ),
- array( "abc", "a", 0 ),
- array( "abc", "a", 0, 0 ),
- array( "abc", "a", 1, "false" ),
- array( "abc", "a", -1, "false" ),
- array( "ababc", "a", 1, 2 ),
- array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 2, 6 ),
- array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", -1, 6 ),
- array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", -5, 6 ),
- array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ),
- array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, -4, 3 ),
-
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "op", 5 ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "opq", 5 ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ),
- array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 2 ),
- array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 1 ),
- array( "abc", $char_a_ring_nfd . "bc", "false" ),
- array( $char_a_ring_nfd . "bc", "abcdefg", "false" ),
- array( "abc", "defghijklmnopq", "false" ),
- array( "abc", "ab", 0 ),
- array( "abc", "bc", 1 ),
- array( "abc", "abc", 0 ),
- array( "abc", "abcd", "false" ),
- array( "abc", "ab", 0, 0 ),
- array( "abc", "abc", 0, 0 ),
- array( "abc", "abc", 1, "false" ),
- array( "ababc", "ab", 1, 2 ),
- array( "ababc", "abc", 1, 2 ),
- array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_a_ring_nfd . "bc", "o" . $char_a_ring_nfd . "bc", 2, 6 ),
- array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_a_ring_nfd . "bc", "o" . $char_a_ring_nfd . "bc", -8, 6 ),
- array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "bc" . $char_a_ring_nfd, 2, 3 ),
- );
-
- foreach( $tests as $test ) {
- $arg1 = urlencode($test[1]);
- $arg0 = urlencode($test[0]);
- $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strpos";
- if ( 3 == count( $test ) ) {
- $result = grapheme_strpos($test[0], $test[1]);
- }
- else {
- $res_str .= " from $test[2]";
- $result = grapheme_strpos($test[0], $test[1], $test[2]);
- }
- $res_str .= " = ";
- if ( $result === false ) {
- $res_str .= 'false';
- }
- else {
- $res_str .= $result;
- }
- $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n";
- }
-
- //=====================================================================================
- $res_str .= "\n" . 'function grapheme_stripos($haystack, $needle, $offset = 0) {}' . "\n\n";
-
- $tests = array(
- array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 2, 6 ),
- array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Oo", "o", -6, 6 ),
- array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 5 ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "O", "false" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, $char_o_diaeresis_nfd, -1, 4 ),
- array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd, 2 ),
- array( "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 1 ),
- array( "Abc", $char_a_ring_nfd, "false" ),
- array( $char_a_ring_nfd . "bc", "A", "false" ),
- array( "abc", "D", "false" ),
- array( "abC", "c", 2 ),
- array( "abc", "B", 1 ),
- array( "Abc", "a", 0 ),
- array( "abc", "A", 0, 0 ),
- array( "Abc", "a", 1, "false" ),
- array( "ababc", "A", 1, 2 ),
-
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "oP", 5 ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "opQ", 5 ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bC" . $char_o_diaeresis_nfd, $char_O_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ),
- array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "Bc", $char_A_ring_nfd . "bc", 2 ),
- array( "a" . $char_a_ring_nfd . "BC", $char_a_ring_nfd . "bc", 1 ),
- array( "abc", $char_a_ring_nfd . "BC", "false" ),
- array( $char_a_ring_nfd . "BC", "aBCdefg", "false" ),
- array( "aBC", "Defghijklmnopq", "false" ),
- array( "abC", "Ab", 0 ),
- array( "aBC", "bc", 1 ),
- array( "abC", "Abc", 0 ),
- array( "abC", "aBcd", "false" ),
- array( "ABc", "ab", 0, 0 ),
- array( "aBc", "abC", 0, 0 ),
- array( "abc", "aBc", 1, "false" ),
- array( "ABabc", "AB", 1, 2 ),
- array( "ABabc", "AB", -4, 2 ),
- array( "abaBc", "aBc", 1, 2 ),
- array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_A_ring_nfd . "bC", "O" . $char_a_ring_nfd . "bC", 2, 6 ),
- array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bC" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "Bc" . $char_a_ring_nfd, 2, 3 ),
- );
-
- foreach( $tests as $test ) {
- $arg1 = urlencode($test[1]);
- $arg0 = urlencode($test[0]);
- $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_stripos";
- if ( 3 == count( $test ) ) {
- $result = grapheme_stripos($test[0], $test[1]);
- }
- else {
- $res_str .= " from $test[2]";
- $result = grapheme_stripos($test[0], $test[1], $test[2]);
- }
- $res_str .= " = ";
- if ( $result === false ) {
- $res_str .= 'false';
- }
- else {
- $res_str .= $result;
- }
- $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n";
- }
-
-
- //=====================================================================================
- $res_str .= "\n" . 'function grapheme_strrpos($haystack, $needle, $offset = 0) {}' . "\n\n";
-
-
- $tests = array(
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 5 ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ),
- array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2 ),
- array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 1 ),
- array( "abc", $char_a_ring_nfd, "false" ),
- array( $char_a_ring_nfd . "bc", "a", "false" ),
- array( "abc", "d", "false" ),
- array( "abc", "c", 2 ),
- array( "abc", "b", 1 ),
- array( "abc", "a", 0 ),
- array( "abc", "a", 0, 0 ),
- array( "abc", "a", 1, "false" ),
- array( "ababc", "a", 1, 2 ),
- array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 2, 6 ),
- array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ),
-
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "op", 5 ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "opq", 5 ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ),
- array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 2 ),
- array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 1 ),
- array( "abc", $char_a_ring_nfd . "bc", "false" ),
- array( $char_a_ring_nfd . "bc", "abcdefg", "false" ),
- array( "abc", "defghijklmnopq", "false" ),
- array( "abc", "ab", 0 ),
- array( "abc", "bc", 1 ),
- array( "abc", "abc", 0 ),
- array( "abc", "abcd", "false" ),
- array( "abc", "ab", 0, 0 ),
- array( "abc", "abc", 0, 0 ),
- array( "abc", "abc", 1, "false" ),
- array( "ababc", "ab", 1, 2 ),
- array( "ababc", "abc", 1, 2 ),
- array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_a_ring_nfd . "bc", "o" . $char_a_ring_nfd . "bc", 2, 6 ),
- array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "bc" . $char_a_ring_nfd, 2, 3 ),
- );
-
- foreach( $tests as $test ) {
- $arg1 = urlencode($test[1]);
- $arg0 = urlencode($test[0]);
- $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strrpos";
- if ( 3 == count( $test ) ) {
- $result = grapheme_strrpos($test[0], $test[1]);
- }
- else {
- $res_str .= " from $test[2]";
- $result = grapheme_strrpos($test[0], $test[1], $test[2]);
- }
- $res_str .= " = ";
- if ( $result === false ) {
- $res_str .= 'false';
- }
- else {
- $res_str .= $result;
- }
- $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n";
- }
-
-
- //=====================================================================================
- $res_str .= "\n" . 'function grapheme_strripos($haystack, $needle, $offset = 0) {}' . "\n\n";
-
- $tests = array(
- array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 2, 6 ),
- array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 5 ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "O", "false" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ),
- array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd, 2 ),
- array( "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 1 ),
- array( "Abc", $char_a_ring_nfd, "false" ),
- array( $char_a_ring_nfd . "bc", "A", "false" ),
- array( "abc", "D", "false" ),
- array( "abC", "c", 2 ),
- array( "abc", "B", 1 ),
- array( "Abc", "a", 0 ),
- array( "abc", "A", 0, 0 ),
- array( "Abc", "a", 1, "false" ),
- array( "ababc", "A", 1, 2 ),
-
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "oP", 5 ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "opQ", 5 ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bC" . $char_o_diaeresis_nfd, $char_O_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ),
- array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "Bc", $char_A_ring_nfd . "bc", 2 ),
- array( "a" . $char_a_ring_nfd . "BC", $char_a_ring_nfd . "bc", 1 ),
- array( "abc", $char_a_ring_nfd . "BC", "false" ),
- array( $char_a_ring_nfd . "BC", "aBCdefg", "false" ),
- array( "aBC", "Defghijklmnopq", "false" ),
- array( "abC", "Ab", 0 ),
- array( "aBC", "bc", 1 ),
- array( "abC", "Abc", 0 ),
- array( "abC", "aBcd", "false" ),
- array( "ABc", "ab", 0, 0 ),
- array( "aBc", "abC", 0, 0 ),
- array( "abc", "aBc", 1, "false" ),
- array( "ABabc", "AB", 1, 2 ),
- array( "abaBc", "aBc", 1, 2 ),
- array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_A_ring_nfd . "bC", "O" . $char_a_ring_nfd . "bC", 2, 6 ),
- array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bC" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "Bc" . $char_a_ring_nfd, 2, 3 ),
- );
-
- foreach( $tests as $test ) {
- $arg1 = urlencode($test[1]);
- $arg0 = urlencode($test[0]);
- $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strripos";
- if ( 3 == count( $test ) ) {
- $result = grapheme_strripos($test[0], $test[1]);
- }
- else {
- $res_str .= " from $test[2]";
- $result = grapheme_strripos($test[0], $test[1], $test[2]);
- }
- $res_str .= " = ";
- if ( $result === false ) {
- $res_str .= 'false';
- }
- else {
- $res_str .= $result;
- }
- $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n";
- }
-
-
- //=====================================================================================
- $res_str .= "\n" . 'function grapheme_substr($string, $start, $length = -1) {}' . "\n\n";
-
- $tests = array(
-
- array( "abc", 3, "false" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, 5, "false" ),
- array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", 2, $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ),
- array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bc", 2, "a" . $char_A_ring_nfd . "bc" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", 5, "O" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, 5, "false" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, 4, $char_O_diaeresis_nfd ),
- array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", 2, $char_a_ring_nfd . "bc" ),
- array( "a" . $char_A_ring_nfd . "bc", 1, $char_A_ring_nfd . "bc" ),
- array( "Abc", -5, "false" ),
- array( $char_a_ring_nfd . "bc", 3, "false" ),
- array( "abc", 4, "false" ),
- array( "abC", 2, "C" ),
- array( "abc", 1, "bc" ),
- array( "Abc", 1, 1, "b" ),
- array( "abc", 0, 2, "ab" ),
- array( "Abc", -4, 1, "false" ),
- array( "ababc", 1, 2, "ba" ),
- array( "ababc", 0, 10, "ababc" ),
-
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, 10 , "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, "Opq" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -1, "Op" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -2, "O" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -3, "" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -4, "false" ),
-
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -1, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Op" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -2, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -3, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -4, "a" . $char_a_ring_nfd . "bc" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -5, "a" . $char_a_ring_nfd . "b" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -6, "a" . $char_a_ring_nfd ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -7, "a" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -8, "" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -9, "false" ),
-
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -7, $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -6, "bc" . $char_o_diaeresis_nfd . "Opq" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -5, "c" . $char_o_diaeresis_nfd . "Opq" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -4, $char_o_diaeresis_nfd . "Opq" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -3, "Opq" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -2, "pq" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -1, "q" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -999, "false" ),
-
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 8, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 7, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Op" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 6, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 5, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 4, "a" . $char_a_ring_nfd . "bc" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 3, "a" . $char_a_ring_nfd . "b" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 2, "a" . $char_a_ring_nfd ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 1, "a" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 0, "" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -999, "false" ),
-
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -1, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Op" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -2, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -3, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -4, "a" . $char_a_ring_nfd . "bc" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -5, "a" . $char_a_ring_nfd . "b" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -6, "a" . $char_a_ring_nfd ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -7, "a" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -8, "" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -9, "false" ),
-
- );
-
- foreach( $tests as $test ) {
- $arg0 = urlencode($test[0]);
- $res_str .= "substring of \"$arg0\" from \"$test[1]\" - grapheme_substr";
- if ( 3 == count( $test ) ) {
- $result = grapheme_substr($test[0], $test[1]);
- }
- else {
- $res_str .= " with length $test[2]";
- $result = grapheme_substr($test[0], $test[1], $test[2]);
- }
- $res_str .= " = ";
- if ( $result === false ) {
- $res_str .= 'false';
- }
- else {
- $res_str .= urlencode($result);
- }
- $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n";
- }
-
-
- //=====================================================================================
- $res_str .= "\n" . 'function grapheme_strstr($haystack, $needle, $before_needle = FALSE) {}' . "\n\n";
-
- $tests = array(
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", "o" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd, $char_o_diaeresis_nfd ),
- array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, $char_a_ring_nfd . "bc"),
- array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, $char_a_ring_nfd . "bc"),
- array( "abc", $char_a_ring_nfd, "false" ),
- array( $char_a_ring_nfd . "bc", "a", "false" ),
- array( "abc", "d", "false" ),
- array( "abc", "c", "c" ),
- array( "abc", "b", "bc" ),
- array( "abc", "a", "abc" ),
- array( "abc", "ab", "abc" ),
- array( "abc", "abc", "abc" ),
- array( "abc", "bc", "bc" ),
- array( "abc", "a", FALSE, "abc" ),
- array( "abc", "a", TRUE, "" ),
- array( "abc", "b", TRUE, "a" ),
- array( "abc", "c", TRUE, "ab" ),
- array( "ababc", "bab", TRUE, "a" ),
- array( "ababc", "abc", TRUE, "ab" ),
- array( "ababc", "abc", FALSE, "abc" ),
-
- array( "ab" . $char_a_ring_nfd . "c", "d", "false" ),
- array( "bc" . $char_a_ring_nfd . "a", "a", "a" ),
- array( "a" . $char_a_ring_nfd . "bc", "b", "bc" ),
- array( $char_a_ring_nfd . "bc", "a", "false" ),
- array( $char_a_ring_nfd . "abc", "ab", "abc" ),
- array( "abc" . $char_a_ring_nfd, "abc", "abc" . $char_a_ring_nfd),
- array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc" ),
- array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, FALSE, $char_a_ring_nfd . "bc"),
- array( "a" . $char_a_ring_nfd . "bc", "a", TRUE, "" ),
- array( $char_a_ring_nfd . "abc", "b", TRUE, $char_a_ring_nfd . "a" ),
- array( "ab" . $char_a_ring_nfd . "c", "c", TRUE, "ab" . $char_a_ring_nfd ),
- array( "aba" . $char_a_ring_nfd . "bc", "ba" . $char_a_ring_nfd . "b", TRUE, "a" ),
- array( "ababc" . $char_a_ring_nfd, "abc" . $char_a_ring_nfd, TRUE, "ab" ),
- array( "abab" . $char_a_ring_nfd . "c", "ab" . $char_a_ring_nfd . "c", FALSE, "ab" . $char_a_ring_nfd . "c" ),
-
- );
-
- foreach( $tests as $test ) {
- $arg1 = urlencode($test[1]);
- $arg0 = urlencode($test[0]);
- $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strstr";
- if ( 3 == count( $test ) ) {
- $result = grapheme_strstr($test[0], $test[1]);
- }
- else {
- $res_str .= " before flag is " . ( $test[2] ? "TRUE" : "FALSE" );
- $result = grapheme_strstr($test[0], $test[1], $test[2]);
- }
- $res_str .= " = ";
- if ( $result === false ) {
- $res_str .= 'false';
- }
- else {
- $res_str .= urlencode($result);
- }
- $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n";
- }
-
-
- //=====================================================================================
- $res_str .= "\n" . 'function grapheme_stristr($haystack, $needle, $before_needle = FALSE) {}' . "\n\n";
-
- $tests = array(
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_O_diaeresis_nfd, $char_o_diaeresis_nfd ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", "O" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ),
- array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, $char_a_ring_nfd . "bc"),
- array( "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd, $char_a_ring_nfd . "bc"),
- array( "abc", $char_a_ring_nfd, "false" ),
- array( $char_a_ring_nfd . "bc", "A", "false" ),
- array( "abc", "d", "false" ),
- array( "abc", "C", "c" ),
- array( "aBc", "b", "Bc" ),
- array( "abc", "A", "abc" ),
- array( "abC", "ab", "abC" ),
- array( "abc", "aBc", "abc" ),
- array( "abC", "bc", "bC" ),
- array( "abc", "A", FALSE, "abc" ),
- array( "abc", "a", TRUE, "" ),
- array( "aBc", "b", TRUE, "a" ),
- array( "abc", "C", TRUE, "ab" ),
- array( "aBabc", "bab", TRUE, "a" ),
- array( "ababc", "aBc", TRUE, "ab" ),
- array( "ababc", "abC", FALSE, "abc" ),
-
- array( "ab" . $char_a_ring_nfd . "c", "d", "false" ),
- array( "bc" . $char_a_ring_nfd . "A", "a", "A" ),
- array( "a" . $char_a_ring_nfd . "bc", "B", "bc" ),
- array( $char_A_ring_nfd . "bc", "a", "false" ),
- array( $char_a_ring_nfd . "abc", "Ab", "abc" ),
- array( "abc" . $char_A_ring_nfd, "abc", "abc" . $char_A_ring_nfd),
- array( "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd . "bc", $char_a_ring_nfd . "bc" ),
- array( "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, FALSE, $char_A_ring_nfd . "bc" ),
- array( "a" . $char_a_ring_nfd . "bc", "A", TRUE, "" ),
- array( $char_a_ring_nfd . "aBc", "b", TRUE, $char_a_ring_nfd . "a" ),
- array( "ab" . $char_a_ring_nfd . "c", "C", TRUE, "ab" . $char_a_ring_nfd ),
- array( "aba" . $char_A_ring_nfd . "bc", "ba" . $char_a_ring_nfd . "b", TRUE, "a" ),
- array( "ababc" . $char_a_ring_nfd, "aBc" . $char_A_ring_nfd, TRUE, "ab" ),
- array( "abAB" . $char_A_ring_nfd . "c", "ab" . $char_a_ring_nfd . "c", FALSE, "AB" . $char_A_ring_nfd . "c" ),
-
- );
-
- foreach( $tests as $test ) {
- $arg1 = urlencode($test[1]);
- $arg0 = urlencode($test[0]);
- $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_stristr";
- if ( 3 == count( $test ) ) {
- $result = grapheme_stristr($test[0], $test[1]);
- }
- else {
- $res_str .= " before flag is " . ( $test[2] ? "TRUE" : "FALSE" );
- $result = grapheme_stristr($test[0], $test[1], $test[2]);
- }
- $res_str .= " = ";
- if ( $result === false ) {
- $res_str .= 'false';
- }
- else {
- $res_str .= urlencode($result);
- }
- $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n";
- }
-
-
- //=====================================================================================
- $res_str .= "\n" . 'function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_COUNT, $start = 0[, $next])' . "\n\n";
-
- $tests = array(
- // haystack, count, [[offset], [next]], result
- array( "abc", 3, "abc" ),
- array( "abc", 2, "ab" ),
- array( "abc", 1, "a" ),
- array( "abc", 0, "" ),
- array( "abc", 1, 0, "a" ),
- array( "abc", 1, 1, "b" ),
- array( "abc", 1, 2, "c" ),
- array( "abc", 0, 2, "" ),
-
- array( "abc", 3, 0, 3, "abc" ),
- array( "abc", 2, 0, 2, "ab" ),
- array( "abc", 1, 0, 1, "a" ),
- array( "abc", 0, 0, 0, "" ),
- array( "abc", 1, 0, 1, "a" ),
- array( "abc", 1, 1, 2, "b" ),
- array( "abc", 1, 2, 3, "c" ),
- array( "abc", 1, -2, 2, "b" ),
- array( "abc", 0, 2, 2, "" ),
+ $res_str = '';
+
+ $char_a_diaeresis = "\xC3\xA4"; // 'LATIN SMALL LETTER A WITH DIAERESIS' (U+00E4)
+ $char_a_ring = "\xC3\xA5"; // 'LATIN SMALL LETTER A WITH RING ABOVE' (U+00E5)
+ $char_o_diaeresis = "\xC3\xB6"; // 'LATIN SMALL LETTER O WITH DIAERESIS' (U+00F6)
+ $char_O_diaeresis = "\xC3\x96"; // 'LATIN CAPITAL LETTER O WITH DIAERESIS' (U+00D6)
+
+ $char_angstrom_sign = "\xE2\x84\xAB"; // 'ANGSTROM SIGN' (U+212B)
+ $char_A_ring = "\xC3\x85"; // 'LATIN CAPITAL LETTER A WITH RING ABOVE' (U+00C5)
+
+ $char_ohm_sign = "\xE2\x84\xA6"; // 'OHM SIGN' (U+2126)
+ $char_omega = "\xCE\xA9"; // 'GREEK CAPITAL LETTER OMEGA' (U+03A9)
+
+ $char_combining_ring_above = "\xCC\x8A"; // 'COMBINING RING ABOVE' (U+030A)
+
+ $char_fi_ligature = "\xEF\xAC\x81"; // 'LATIN SMALL LIGATURE FI' (U+FB01)
+
+ $char_long_s_dot = "\xE1\xBA\x9B"; // 'LATIN SMALL LETTER LONG S WITH DOT ABOVE' (U+1E9B)
+
+ // the word 'hindi' using Devanagari characters:
+ $hindi = "\xe0\xa4\xb9\xe0\xa4\xbf\xe0\xa4\xa8\xe0\xa5\x8d\xe0\xa4\xa6\xe0\xa5\x80";
+
+ $char_a_ring_nfd = "a\xCC\x8A";
+ $char_A_ring_nfd = "A\xCC\x8A";
+ $char_o_diaeresis_nfd = "o\xCC\x88";
+ $char_O_diaeresis_nfd = "O\xCC\x88";
+ $char_diaeresis = "\xCC\x88";
+
+ //=====================================================================================
+ $res_str .= "\n" . 'function grapheme_strlen($string) {}' . "\n\n";
+
+
+ $res_str .= "\"hindi\" in devanagari strlen " . grapheme_strlen($hindi) . "\n";
+ $res_str .= "\"ab\" + \"hindi\" + \"cde\" strlen " . grapheme_strlen('ab' . $hindi . 'cde') . "\n";
+ $res_str .= "\"\" strlen " . grapheme_strlen("") . "\n";
+ $res_str .= "char_a_ring_nfd strlen " . grapheme_strlen($char_a_ring_nfd) . "\n";
+ $res_str .= "char_a_ring_nfd + \"bc\" strlen " . grapheme_strlen($char_a_ring_nfd . 'bc') . "\n";
+ $res_str .= "\"abc\" strlen " . grapheme_strlen('abc') . "\n";
+
+
+ //=====================================================================================
+ $res_str .= "\n" . 'function grapheme_strpos($haystack, $needle, $offset = 0) {}' . "\n\n";
+
+ $tests = array(
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 5 ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ),
+ array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2 ),
+ array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 1 ),
+ array( "abc", $char_a_ring_nfd, "false" ),
+ array( $char_a_ring_nfd . "bc", "a", "false" ),
+ array( "abc", "d", "false" ),
+ array( "abc", "c", 2 ),
+ array( "abc", "b", 1 ),
+ array( "abc", "a", 0 ),
+ array( "abc", "a", 0, 0 ),
+ array( "abc", "a", 1, "false" ),
+ array( "abc", "a", -1, "false" ),
+ array( "ababc", "a", 1, 2 ),
+ array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 2, 6 ),
+ array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", -1, 6 ),
+ array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", -5, 6 ),
+ array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ),
+ array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, -4, 3 ),
+
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "op", 5 ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "opq", 5 ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ),
+ array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 2 ),
+ array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 1 ),
+ array( "abc", $char_a_ring_nfd . "bc", "false" ),
+ array( $char_a_ring_nfd . "bc", "abcdefg", "false" ),
+ array( "abc", "defghijklmnopq", "false" ),
+ array( "abc", "ab", 0 ),
+ array( "abc", "bc", 1 ),
+ array( "abc", "abc", 0 ),
+ array( "abc", "abcd", "false" ),
+ array( "abc", "ab", 0, 0 ),
+ array( "abc", "abc", 0, 0 ),
+ array( "abc", "abc", 1, "false" ),
+ array( "ababc", "ab", 1, 2 ),
+ array( "ababc", "abc", 1, 2 ),
+ array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_a_ring_nfd . "bc", "o" . $char_a_ring_nfd . "bc", 2, 6 ),
+ array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_a_ring_nfd . "bc", "o" . $char_a_ring_nfd . "bc", -8, 6 ),
+ array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "bc" . $char_a_ring_nfd, 2, 3 ),
+ );
+
+ foreach( $tests as $test ) {
+ $arg1 = urlencode($test[1]);
+ $arg0 = urlencode($test[0]);
+ $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strpos";
+ if ( 3 == count( $test ) ) {
+ $result = grapheme_strpos($test[0], $test[1]);
+ }
+ else {
+ $res_str .= " from $test[2]";
+ $result = grapheme_strpos($test[0], $test[1], $test[2]);
+ }
+ $res_str .= " = ";
+ if ( $result === false ) {
+ $res_str .= 'false';
+ }
+ else {
+ $res_str .= $result;
+ }
+ $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n";
+ }
+
+ //=====================================================================================
+ $res_str .= "\n" . 'function grapheme_stripos($haystack, $needle, $offset = 0) {}' . "\n\n";
+
+ $tests = array(
+ array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 2, 6 ),
+ array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Oo", "o", -6, 6 ),
+ array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 5 ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "O", "false" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, $char_o_diaeresis_nfd, -1, 4 ),
+ array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd, 2 ),
+ array( "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 1 ),
+ array( "Abc", $char_a_ring_nfd, "false" ),
+ array( $char_a_ring_nfd . "bc", "A", "false" ),
+ array( "abc", "D", "false" ),
+ array( "abC", "c", 2 ),
+ array( "abc", "B", 1 ),
+ array( "Abc", "a", 0 ),
+ array( "abc", "A", 0, 0 ),
+ array( "Abc", "a", 1, "false" ),
+ array( "ababc", "A", 1, 2 ),
+
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "oP", 5 ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "opQ", 5 ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bC" . $char_o_diaeresis_nfd, $char_O_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ),
+ array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "Bc", $char_A_ring_nfd . "bc", 2 ),
+ array( "a" . $char_a_ring_nfd . "BC", $char_a_ring_nfd . "bc", 1 ),
+ array( "abc", $char_a_ring_nfd . "BC", "false" ),
+ array( $char_a_ring_nfd . "BC", "aBCdefg", "false" ),
+ array( "aBC", "Defghijklmnopq", "false" ),
+ array( "abC", "Ab", 0 ),
+ array( "aBC", "bc", 1 ),
+ array( "abC", "Abc", 0 ),
+ array( "abC", "aBcd", "false" ),
+ array( "ABc", "ab", 0, 0 ),
+ array( "aBc", "abC", 0, 0 ),
+ array( "abc", "aBc", 1, "false" ),
+ array( "ABabc", "AB", 1, 2 ),
+ array( "ABabc", "AB", -4, 2 ),
+ array( "abaBc", "aBc", 1, 2 ),
+ array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_A_ring_nfd . "bC", "O" . $char_a_ring_nfd . "bC", 2, 6 ),
+ array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bC" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "Bc" . $char_a_ring_nfd, 2, 3 ),
+ );
+
+ foreach( $tests as $test ) {
+ $arg1 = urlencode($test[1]);
+ $arg0 = urlencode($test[0]);
+ $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_stripos";
+ if ( 3 == count( $test ) ) {
+ $result = grapheme_stripos($test[0], $test[1]);
+ }
+ else {
+ $res_str .= " from $test[2]";
+ $result = grapheme_stripos($test[0], $test[1], $test[2]);
+ }
+ $res_str .= " = ";
+ if ( $result === false ) {
+ $res_str .= 'false';
+ }
+ else {
+ $res_str .= $result;
+ }
+ $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n";
+ }
+
+
+ //=====================================================================================
+ $res_str .= "\n" . 'function grapheme_strrpos($haystack, $needle, $offset = 0) {}' . "\n\n";
+
+
+ $tests = array(
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 5 ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ),
+ array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2 ),
+ array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 1 ),
+ array( "abc", $char_a_ring_nfd, "false" ),
+ array( $char_a_ring_nfd . "bc", "a", "false" ),
+ array( "abc", "d", "false" ),
+ array( "abc", "c", 2 ),
+ array( "abc", "b", 1 ),
+ array( "abc", "a", 0 ),
+ array( "abc", "a", 0, 0 ),
+ array( "abc", "a", 1, "false" ),
+ array( "ababc", "a", 1, 2 ),
+ array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 2, 6 ),
+ array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ),
+
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "op", 5 ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "opq", 5 ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ),
+ array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 2 ),
+ array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 1 ),
+ array( "abc", $char_a_ring_nfd . "bc", "false" ),
+ array( $char_a_ring_nfd . "bc", "abcdefg", "false" ),
+ array( "abc", "defghijklmnopq", "false" ),
+ array( "abc", "ab", 0 ),
+ array( "abc", "bc", 1 ),
+ array( "abc", "abc", 0 ),
+ array( "abc", "abcd", "false" ),
+ array( "abc", "ab", 0, 0 ),
+ array( "abc", "abc", 0, 0 ),
+ array( "abc", "abc", 1, "false" ),
+ array( "ababc", "ab", 1, 2 ),
+ array( "ababc", "abc", 1, 2 ),
+ array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_a_ring_nfd . "bc", "o" . $char_a_ring_nfd . "bc", 2, 6 ),
+ array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "bc" . $char_a_ring_nfd, 2, 3 ),
+ );
+
+ foreach( $tests as $test ) {
+ $arg1 = urlencode($test[1]);
+ $arg0 = urlencode($test[0]);
+ $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strrpos";
+ if ( 3 == count( $test ) ) {
+ $result = grapheme_strrpos($test[0], $test[1]);
+ }
+ else {
+ $res_str .= " from $test[2]";
+ $result = grapheme_strrpos($test[0], $test[1], $test[2]);
+ }
+ $res_str .= " = ";
+ if ( $result === false ) {
+ $res_str .= 'false';
+ }
+ else {
+ $res_str .= $result;
+ }
+ $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n";
+ }
+
+
+ //=====================================================================================
+ $res_str .= "\n" . 'function grapheme_strripos($haystack, $needle, $offset = 0) {}' . "\n\n";
+
+ $tests = array(
+ array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 2, 6 ),
+ array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 5 ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "O", "false" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ),
+ array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd, 2 ),
+ array( "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 1 ),
+ array( "Abc", $char_a_ring_nfd, "false" ),
+ array( $char_a_ring_nfd . "bc", "A", "false" ),
+ array( "abc", "D", "false" ),
+ array( "abC", "c", 2 ),
+ array( "abc", "B", 1 ),
+ array( "Abc", "a", 0 ),
+ array( "abc", "A", 0, 0 ),
+ array( "Abc", "a", 1, "false" ),
+ array( "ababc", "A", 1, 2 ),
+
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "oP", 5 ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "opQ", 5 ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bC" . $char_o_diaeresis_nfd, $char_O_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ),
+ array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "Bc", $char_A_ring_nfd . "bc", 2 ),
+ array( "a" . $char_a_ring_nfd . "BC", $char_a_ring_nfd . "bc", 1 ),
+ array( "abc", $char_a_ring_nfd . "BC", "false" ),
+ array( $char_a_ring_nfd . "BC", "aBCdefg", "false" ),
+ array( "aBC", "Defghijklmnopq", "false" ),
+ array( "abC", "Ab", 0 ),
+ array( "aBC", "bc", 1 ),
+ array( "abC", "Abc", 0 ),
+ array( "abC", "aBcd", "false" ),
+ array( "ABc", "ab", 0, 0 ),
+ array( "aBc", "abC", 0, 0 ),
+ array( "abc", "aBc", 1, "false" ),
+ array( "ABabc", "AB", 1, 2 ),
+ array( "abaBc", "aBc", 1, 2 ),
+ array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_A_ring_nfd . "bC", "O" . $char_a_ring_nfd . "bC", 2, 6 ),
+ array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bC" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "Bc" . $char_a_ring_nfd, 2, 3 ),
+ );
+
+ foreach( $tests as $test ) {
+ $arg1 = urlencode($test[1]);
+ $arg0 = urlencode($test[0]);
+ $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strripos";
+ if ( 3 == count( $test ) ) {
+ $result = grapheme_strripos($test[0], $test[1]);
+ }
+ else {
+ $res_str .= " from $test[2]";
+ $result = grapheme_strripos($test[0], $test[1], $test[2]);
+ }
+ $res_str .= " = ";
+ if ( $result === false ) {
+ $res_str .= 'false';
+ }
+ else {
+ $res_str .= $result;
+ }
+ $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n";
+ }
+
+
+ //=====================================================================================
+ $res_str .= "\n" . 'function grapheme_substr($string, $start, $length = -1) {}' . "\n\n";
+
+ $tests = array(
+
+ array( "abc", 3, "false" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, 5, "false" ),
+ array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", 2, $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ),
+ array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bc", 2, "a" . $char_A_ring_nfd . "bc" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", 5, "O" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, 5, "false" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, 4, $char_O_diaeresis_nfd ),
+ array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", 2, $char_a_ring_nfd . "bc" ),
+ array( "a" . $char_A_ring_nfd . "bc", 1, $char_A_ring_nfd . "bc" ),
+ array( "Abc", -5, "false" ),
+ array( $char_a_ring_nfd . "bc", 3, "false" ),
+ array( "abc", 4, "false" ),
+ array( "abC", 2, "C" ),
+ array( "abc", 1, "bc" ),
+ array( "Abc", 1, 1, "b" ),
+ array( "abc", 0, 2, "ab" ),
+ array( "Abc", -4, 1, "false" ),
+ array( "ababc", 1, 2, "ba" ),
+ array( "ababc", 0, 10, "ababc" ),
+
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, 10 , "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, "Opq" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -1, "Op" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -2, "O" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -3, "" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -4, "false" ),
+
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -1, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Op" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -2, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -3, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -4, "a" . $char_a_ring_nfd . "bc" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -5, "a" . $char_a_ring_nfd . "b" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -6, "a" . $char_a_ring_nfd ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -7, "a" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -8, "" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -9, "false" ),
+
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -7, $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -6, "bc" . $char_o_diaeresis_nfd . "Opq" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -5, "c" . $char_o_diaeresis_nfd . "Opq" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -4, $char_o_diaeresis_nfd . "Opq" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -3, "Opq" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -2, "pq" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -1, "q" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -999, "false" ),
+
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 8, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 7, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Op" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 6, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 5, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 4, "a" . $char_a_ring_nfd . "bc" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 3, "a" . $char_a_ring_nfd . "b" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 2, "a" . $char_a_ring_nfd ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 1, "a" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 0, "" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -999, "false" ),
+
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -1, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Op" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -2, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -3, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -4, "a" . $char_a_ring_nfd . "bc" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -5, "a" . $char_a_ring_nfd . "b" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -6, "a" . $char_a_ring_nfd ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -7, "a" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -8, "" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -9, "false" ),
+
+ );
+
+ foreach( $tests as $test ) {
+ $arg0 = urlencode($test[0]);
+ $res_str .= "substring of \"$arg0\" from \"$test[1]\" - grapheme_substr";
+ if ( 3 == count( $test ) ) {
+ $result = grapheme_substr($test[0], $test[1]);
+ }
+ else {
+ $res_str .= " with length $test[2]";
+ $result = grapheme_substr($test[0], $test[1], $test[2]);
+ }
+ $res_str .= " = ";
+ if ( $result === false ) {
+ $res_str .= 'false';
+ }
+ else {
+ $res_str .= urlencode($result);
+ }
+ $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n";
+ }
+
+
+ //=====================================================================================
+ $res_str .= "\n" . 'function grapheme_strstr($haystack, $needle, $before_needle = FALSE) {}' . "\n\n";
+
+ $tests = array(
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", "o" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd, $char_o_diaeresis_nfd ),
+ array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, $char_a_ring_nfd . "bc"),
+ array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, $char_a_ring_nfd . "bc"),
+ array( "abc", $char_a_ring_nfd, "false" ),
+ array( $char_a_ring_nfd . "bc", "a", "false" ),
+ array( "abc", "d", "false" ),
+ array( "abc", "c", "c" ),
+ array( "abc", "b", "bc" ),
+ array( "abc", "a", "abc" ),
+ array( "abc", "ab", "abc" ),
+ array( "abc", "abc", "abc" ),
+ array( "abc", "bc", "bc" ),
+ array( "abc", "a", FALSE, "abc" ),
+ array( "abc", "a", TRUE, "" ),
+ array( "abc", "b", TRUE, "a" ),
+ array( "abc", "c", TRUE, "ab" ),
+ array( "ababc", "bab", TRUE, "a" ),
+ array( "ababc", "abc", TRUE, "ab" ),
+ array( "ababc", "abc", FALSE, "abc" ),
+
+ array( "ab" . $char_a_ring_nfd . "c", "d", "false" ),
+ array( "bc" . $char_a_ring_nfd . "a", "a", "a" ),
+ array( "a" . $char_a_ring_nfd . "bc", "b", "bc" ),
+ array( $char_a_ring_nfd . "bc", "a", "false" ),
+ array( $char_a_ring_nfd . "abc", "ab", "abc" ),
+ array( "abc" . $char_a_ring_nfd, "abc", "abc" . $char_a_ring_nfd),
+ array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc" ),
+ array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, FALSE, $char_a_ring_nfd . "bc"),
+ array( "a" . $char_a_ring_nfd . "bc", "a", TRUE, "" ),
+ array( $char_a_ring_nfd . "abc", "b", TRUE, $char_a_ring_nfd . "a" ),
+ array( "ab" . $char_a_ring_nfd . "c", "c", TRUE, "ab" . $char_a_ring_nfd ),
+ array( "aba" . $char_a_ring_nfd . "bc", "ba" . $char_a_ring_nfd . "b", TRUE, "a" ),
+ array( "ababc" . $char_a_ring_nfd, "abc" . $char_a_ring_nfd, TRUE, "ab" ),
+ array( "abab" . $char_a_ring_nfd . "c", "ab" . $char_a_ring_nfd . "c", FALSE, "ab" . $char_a_ring_nfd . "c" ),
+
+ );
+
+ foreach( $tests as $test ) {
+ $arg1 = urlencode($test[1]);
+ $arg0 = urlencode($test[0]);
+ $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strstr";
+ if ( 3 == count( $test ) ) {
+ $result = grapheme_strstr($test[0], $test[1]);
+ }
+ else {
+ $res_str .= " before flag is " . ( $test[2] ? "TRUE" : "FALSE" );
+ $result = grapheme_strstr($test[0], $test[1], $test[2]);
+ }
+ $res_str .= " = ";
+ if ( $result === false ) {
+ $res_str .= 'false';
+ }
+ else {
+ $res_str .= urlencode($result);
+ }
+ $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n";
+ }
+
+
+ //=====================================================================================
+ $res_str .= "\n" . 'function grapheme_stristr($haystack, $needle, $before_needle = FALSE) {}' . "\n\n";
+
+ $tests = array(
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_O_diaeresis_nfd, $char_o_diaeresis_nfd ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", "O" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ),
+ array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, $char_a_ring_nfd . "bc"),
+ array( "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd, $char_a_ring_nfd . "bc"),
+ array( "abc", $char_a_ring_nfd, "false" ),
+ array( $char_a_ring_nfd . "bc", "A", "false" ),
+ array( "abc", "d", "false" ),
+ array( "abc", "C", "c" ),
+ array( "aBc", "b", "Bc" ),
+ array( "abc", "A", "abc" ),
+ array( "abC", "ab", "abC" ),
+ array( "abc", "aBc", "abc" ),
+ array( "abC", "bc", "bC" ),
+ array( "abc", "A", FALSE, "abc" ),
+ array( "abc", "a", TRUE, "" ),
+ array( "aBc", "b", TRUE, "a" ),
+ array( "abc", "C", TRUE, "ab" ),
+ array( "aBabc", "bab", TRUE, "a" ),
+ array( "ababc", "aBc", TRUE, "ab" ),
+ array( "ababc", "abC", FALSE, "abc" ),
+
+ array( "ab" . $char_a_ring_nfd . "c", "d", "false" ),
+ array( "bc" . $char_a_ring_nfd . "A", "a", "A" ),
+ array( "a" . $char_a_ring_nfd . "bc", "B", "bc" ),
+ array( $char_A_ring_nfd . "bc", "a", "false" ),
+ array( $char_a_ring_nfd . "abc", "Ab", "abc" ),
+ array( "abc" . $char_A_ring_nfd, "abc", "abc" . $char_A_ring_nfd),
+ array( "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd . "bc", $char_a_ring_nfd . "bc" ),
+ array( "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, FALSE, $char_A_ring_nfd . "bc" ),
+ array( "a" . $char_a_ring_nfd . "bc", "A", TRUE, "" ),
+ array( $char_a_ring_nfd . "aBc", "b", TRUE, $char_a_ring_nfd . "a" ),
+ array( "ab" . $char_a_ring_nfd . "c", "C", TRUE, "ab" . $char_a_ring_nfd ),
+ array( "aba" . $char_A_ring_nfd . "bc", "ba" . $char_a_ring_nfd . "b", TRUE, "a" ),
+ array( "ababc" . $char_a_ring_nfd, "aBc" . $char_A_ring_nfd, TRUE, "ab" ),
+ array( "abAB" . $char_A_ring_nfd . "c", "ab" . $char_a_ring_nfd . "c", FALSE, "AB" . $char_A_ring_nfd . "c" ),
+
+ );
+
+ foreach( $tests as $test ) {
+ $arg1 = urlencode($test[1]);
+ $arg0 = urlencode($test[0]);
+ $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_stristr";
+ if ( 3 == count( $test ) ) {
+ $result = grapheme_stristr($test[0], $test[1]);
+ }
+ else {
+ $res_str .= " before flag is " . ( $test[2] ? "TRUE" : "FALSE" );
+ $result = grapheme_stristr($test[0], $test[1], $test[2]);
+ }
+ $res_str .= " = ";
+ if ( $result === false ) {
+ $res_str .= 'false';
+ }
+ else {
+ $res_str .= urlencode($result);
+ }
+ $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n";
+ }
+
+
+ //=====================================================================================
+ $res_str .= "\n" . 'function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_COUNT, $start = 0[, $next])' . "\n\n";
+
+ $tests = array(
+ // haystack, count, [[offset], [next]], result
+ array( "abc", 3, "abc" ),
+ array( "abc", 2, "ab" ),
+ array( "abc", 1, "a" ),
+ array( "abc", 0, "" ),
+ array( "abc", 1, 0, "a" ),
+ array( "abc", 1, 1, "b" ),
+ array( "abc", 1, 2, "c" ),
+ array( "abc", 0, 2, "" ),
+
+ array( "abc", 3, 0, 3, "abc" ),
+ array( "abc", 2, 0, 2, "ab" ),
+ array( "abc", 1, 0, 1, "a" ),
+ array( "abc", 0, 0, 0, "" ),
+ array( "abc", 1, 0, 1, "a" ),
+ array( "abc", 1, 1, 2, "b" ),
+ array( "abc", 1, 2, 3, "c" ),
+ array( "abc", 1, -2, 2, "b" ),
+ array( "abc", 0, 2, 2, "" ),
array( "http://news.bbc.co.uk/2/hi/middle_east/7831588.stm", 48, 48 , 50 , "tm" ),
- array( $char_a_ring_nfd . "bc", 3, $char_a_ring_nfd . "bc" ),
- array( $char_a_ring_nfd . "bc", 2, $char_a_ring_nfd . "b" ),
- array( $char_a_ring_nfd . "bc", 1, $char_a_ring_nfd . "" ),
- array( $char_a_ring_nfd . "bc", 3, 0, 5, $char_a_ring_nfd . "bc" ),
- array( $char_a_ring_nfd . "bc", 2, 0, 4, $char_a_ring_nfd . "b" ),
- array( $char_a_ring_nfd . "bc", 1, 0, 3, $char_a_ring_nfd . "" ),
- array( $char_a_ring_nfd . "bcde", 2, 3, 5, "bc" ),
- array( $char_a_ring_nfd . "bcde", 2, -4, 5, "bc" ),
- array( $char_a_ring_nfd . "bcde", 2, 4, 6, "cd" ),
- array( $char_a_ring_nfd . "bcde", 2, -7, 4, $char_a_ring_nfd . "b" ),
- array( $char_a_ring_nfd . "bcde" . $char_a_ring_nfd . "f", 4, 5, 11, "de" . $char_a_ring_nfd . "f" ),
- array( $char_a_ring_nfd . "bcde" . $char_a_ring_nfd . "f", 4, -6, 11, "de" . $char_a_ring_nfd . "f" ),
-
- array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ),
- array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, $char_a_ring_nfd . $char_o_diaeresis_nfd ),
- array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 1, $char_a_ring_nfd . "" ),
-
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 0, $char_o_diaeresis_nfd),
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 2, $char_o_diaeresis_nfd),
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 3, $char_o_diaeresis_nfd),
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 4, $char_diaeresis),
-
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 0, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd),
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 2, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd),
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 3, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd),
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 4, $char_diaeresis . $char_o_diaeresis_nfd),
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 7, $char_diaeresis . $char_o_diaeresis_nfd),
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 8, $char_o_diaeresis_nfd),
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 10, $char_diaeresis),
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 11, "false"),
-
- );
-
- $next = -1;
- foreach( $tests as $test ) {
- $arg0 = urlencode($test[0]);
- $res_str .= "extract from \"$arg0\" \"$test[1]\" graphemes - grapheme_extract";
- if ( 3 == count( $test ) ) {
- $result = grapheme_extract($test[0], $test[1]);
- }
- elseif ( 4 == count ( $test ) ) {
- $res_str .= " starting at byte position $test[2]";
- $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_COUNT, $test[2]);
- }
- else {
- $res_str .= " starting at byte position $test[2] with \$next";
- $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_COUNT, $test[2], $next);
- }
- $res_str .= " = ";
- if ( $result === false ) {
- $res_str .= 'false';
- }
- else {
- $res_str .= urlencode($result);
- }
- $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]);
- if ( 5 == count ( $test ) ) {
- $res_str .= " \$next=$next == $test[3] ";
- if ( $next != $test[3] ) {
- $res_str .= "***FAILED***";
- }
- }
- $res_str .= "\n";
- }
-
-
- //=====================================================================================
- $res_str .= "\n" . 'function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_MAXBYTES, $start = 0)' . "\n\n";
-
- $tests = array(
- array( "abc", 3, "abc" ),
- array( "abc", 2, "ab" ),
- array( "abc", 1, "a" ),
- array( "abc", 0, "" ),
- array( $char_a_ring_nfd . "bc", 5, $char_a_ring_nfd . "bc" ),
- array( $char_a_ring_nfd . "bc", 4, $char_a_ring_nfd . "b" ),
- array( $char_a_ring_nfd . "bc", 1, "" ),
- array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 9, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ),
- array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 10, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ),
- array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 11, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ),
- array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, $char_a_ring_nfd . $char_o_diaeresis_nfd ),
- array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 3, $char_a_ring_nfd . "" ),
- array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 4, $char_a_ring_nfd . "" ),
- array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 5, $char_a_ring_nfd . "" ),
- array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 6, $char_a_ring_nfd . $char_o_diaeresis_nfd ),
- array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 7, $char_a_ring_nfd . $char_o_diaeresis_nfd . "c" ),
-
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 0, $char_o_diaeresis_nfd),
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 2, $char_o_diaeresis_nfd),
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 3, $char_o_diaeresis_nfd),
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 4, $char_diaeresis),
-
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, 0, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd),
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, 2, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd),
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, 3, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd),
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 5, 4, $char_diaeresis . $char_o_diaeresis_nfd),
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 5, 7, $char_diaeresis . $char_o_diaeresis_nfd),
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 8, $char_o_diaeresis_nfd),
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 10, $char_diaeresis),
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 11, "false"),
-
- );
-
- foreach( $tests as $test ) {
- $arg0 = urlencode($test[0]);
- $res_str .= "extract from \"$arg0\" \"$test[1]\" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES";
- if ( 3 == count( $test ) ) {
- $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXBYTES);
- }
- else {
- $res_str .= " starting at byte position $test[2]";
- $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXBYTES, $test[2]);
- }
- $res_str .= " = ";
- if ( $result === false ) {
- $res_str .= 'false';
- }
- else {
- $res_str .= urlencode($result);
- }
- $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n";
- }
-
-
- //=====================================================================================
- $res_str .= "\n" . 'function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_MAXCHARS, $start = 0)' . "\n\n";
-
- $tests = array(
- array( "abc", 3, "abc" ),
- array( "abc", 2, "ab" ),
- array( "abc", 1, "a" ),
- array( "abc", 0, "" ),
- array( "abc" . $char_o_diaeresis_nfd, 0, "" ),
- array( "abc" . $char_o_diaeresis_nfd, 1, "a" ),
- array( "abc" . $char_o_diaeresis_nfd, 2, "ab" ),
- array( "abc" . $char_o_diaeresis_nfd, 3, "abc" ),
- array( "abc" . $char_o_diaeresis_nfd, 4, "abc" ),
- array( "abc" . $char_o_diaeresis_nfd, 5, "abc" . $char_o_diaeresis_nfd),
- array( "abc" . $char_o_diaeresis_nfd, 6, "abc" . $char_o_diaeresis_nfd),
- array( $char_o_diaeresis_nfd . "abc", 0, "" ),
- array( $char_o_diaeresis_nfd . "abc", 1, "" ),
- array( $char_o_diaeresis_nfd . "abc", 2, $char_o_diaeresis_nfd ),
- array( $char_o_diaeresis_nfd . "abc", 3, $char_o_diaeresis_nfd . "a" ),
- array( $char_o_diaeresis_nfd . "abc", 4, $char_o_diaeresis_nfd . "ab" ),
- array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 5, $char_o_diaeresis_nfd . "abc" ),
- array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 6, $char_o_diaeresis_nfd . "abc" ),
- array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 7, $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd ),
- array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "x" ),
-
- array( "abc", 3, 0, "abc" ),
- array( "abc", 2, 1, "bc" ),
- array( "abc", 1, 2, "c" ),
- array( "abc", 0, 3, "false" ),
- array( "abc", 1, 3, "false" ),
- array( "abc", 1, 999, "false" ),
- array( $char_o_diaeresis_nfd . "abc", 1, 6, "false" ),
- array( $char_o_diaeresis_nfd . "abc", 1, 999, "false" ),
- array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 0, $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "x" ),
- array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 1, $char_diaeresis . "abc" . $char_a_ring_nfd . "xy" ),
- array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 2, "abc" . $char_a_ring_nfd . "xyz" ),
- array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 3, "abc" . $char_a_ring_nfd . "xyz" ),
- array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 4, "bc" . $char_a_ring_nfd . "xyz" ),
- array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 5, "c" . $char_a_ring_nfd . "xyz" ),
- array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 6, $char_a_ring_nfd . "xyz" ),
-
- );
-
- foreach( $tests as $test ) {
- $arg0 = urlencode($test[0]);
- $res_str .= "extract from \"$arg0\" \"$test[1]\" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS";
- if ( 3 == count( $test ) ) {
- $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXCHARS);
- }
- else {
- $res_str .= " starting at byte position $test[2]";
- $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXCHARS, $test[2]);
- }
- $res_str .= " = ";
- if ( $result === false ) {
- $res_str .= 'false';
- }
- else {
- $res_str .= urlencode($result);
- }
- $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n";
- }
-
-
- //=====================================================================================
-
- return $res_str;
+ array( $char_a_ring_nfd . "bc", 3, $char_a_ring_nfd . "bc" ),
+ array( $char_a_ring_nfd . "bc", 2, $char_a_ring_nfd . "b" ),
+ array( $char_a_ring_nfd . "bc", 1, $char_a_ring_nfd . "" ),
+ array( $char_a_ring_nfd . "bc", 3, 0, 5, $char_a_ring_nfd . "bc" ),
+ array( $char_a_ring_nfd . "bc", 2, 0, 4, $char_a_ring_nfd . "b" ),
+ array( $char_a_ring_nfd . "bc", 1, 0, 3, $char_a_ring_nfd . "" ),
+ array( $char_a_ring_nfd . "bcde", 2, 3, 5, "bc" ),
+ array( $char_a_ring_nfd . "bcde", 2, -4, 5, "bc" ),
+ array( $char_a_ring_nfd . "bcde", 2, 4, 6, "cd" ),
+ array( $char_a_ring_nfd . "bcde", 2, -7, 4, $char_a_ring_nfd . "b" ),
+ array( $char_a_ring_nfd . "bcde" . $char_a_ring_nfd . "f", 4, 5, 11, "de" . $char_a_ring_nfd . "f" ),
+ array( $char_a_ring_nfd . "bcde" . $char_a_ring_nfd . "f", 4, -6, 11, "de" . $char_a_ring_nfd . "f" ),
+
+ array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ),
+ array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, $char_a_ring_nfd . $char_o_diaeresis_nfd ),
+ array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 1, $char_a_ring_nfd . "" ),
+
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 0, $char_o_diaeresis_nfd),
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 2, $char_o_diaeresis_nfd),
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 3, $char_o_diaeresis_nfd),
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 4, $char_diaeresis),
+
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 0, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd),
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 2, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd),
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 3, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd),
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 4, $char_diaeresis . $char_o_diaeresis_nfd),
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 7, $char_diaeresis . $char_o_diaeresis_nfd),
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 8, $char_o_diaeresis_nfd),
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 10, $char_diaeresis),
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 11, "false"),
+
+ );
+
+ $next = -1;
+ foreach( $tests as $test ) {
+ $arg0 = urlencode($test[0]);
+ $res_str .= "extract from \"$arg0\" \"$test[1]\" graphemes - grapheme_extract";
+ if ( 3 == count( $test ) ) {
+ $result = grapheme_extract($test[0], $test[1]);
+ }
+ elseif ( 4 == count ( $test ) ) {
+ $res_str .= " starting at byte position $test[2]";
+ $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_COUNT, $test[2]);
+ }
+ else {
+ $res_str .= " starting at byte position $test[2] with \$next";
+ $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_COUNT, $test[2], $next);
+ }
+ $res_str .= " = ";
+ if ( $result === false ) {
+ $res_str .= 'false';
+ }
+ else {
+ $res_str .= urlencode($result);
+ }
+ $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]);
+ if ( 5 == count ( $test ) ) {
+ $res_str .= " \$next=$next == $test[3] ";
+ if ( $next != $test[3] ) {
+ $res_str .= "***FAILED***";
+ }
+ }
+ $res_str .= "\n";
+ }
+
+
+ //=====================================================================================
+ $res_str .= "\n" . 'function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_MAXBYTES, $start = 0)' . "\n\n";
+
+ $tests = array(
+ array( "abc", 3, "abc" ),
+ array( "abc", 2, "ab" ),
+ array( "abc", 1, "a" ),
+ array( "abc", 0, "" ),
+ array( $char_a_ring_nfd . "bc", 5, $char_a_ring_nfd . "bc" ),
+ array( $char_a_ring_nfd . "bc", 4, $char_a_ring_nfd . "b" ),
+ array( $char_a_ring_nfd . "bc", 1, "" ),
+ array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 9, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ),
+ array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 10, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ),
+ array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 11, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ),
+ array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, $char_a_ring_nfd . $char_o_diaeresis_nfd ),
+ array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 3, $char_a_ring_nfd . "" ),
+ array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 4, $char_a_ring_nfd . "" ),
+ array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 5, $char_a_ring_nfd . "" ),
+ array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 6, $char_a_ring_nfd . $char_o_diaeresis_nfd ),
+ array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 7, $char_a_ring_nfd . $char_o_diaeresis_nfd . "c" ),
+
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 0, $char_o_diaeresis_nfd),
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 2, $char_o_diaeresis_nfd),
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 3, $char_o_diaeresis_nfd),
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 4, $char_diaeresis),
+
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, 0, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd),
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, 2, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd),
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, 3, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd),
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 5, 4, $char_diaeresis . $char_o_diaeresis_nfd),
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 5, 7, $char_diaeresis . $char_o_diaeresis_nfd),
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 8, $char_o_diaeresis_nfd),
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 10, $char_diaeresis),
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 11, "false"),
+
+ );
+
+ foreach( $tests as $test ) {
+ $arg0 = urlencode($test[0]);
+ $res_str .= "extract from \"$arg0\" \"$test[1]\" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES";
+ if ( 3 == count( $test ) ) {
+ $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXBYTES);
+ }
+ else {
+ $res_str .= " starting at byte position $test[2]";
+ $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXBYTES, $test[2]);
+ }
+ $res_str .= " = ";
+ if ( $result === false ) {
+ $res_str .= 'false';
+ }
+ else {
+ $res_str .= urlencode($result);
+ }
+ $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n";
+ }
+
+
+ //=====================================================================================
+ $res_str .= "\n" . 'function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_MAXCHARS, $start = 0)' . "\n\n";
+
+ $tests = array(
+ array( "abc", 3, "abc" ),
+ array( "abc", 2, "ab" ),
+ array( "abc", 1, "a" ),
+ array( "abc", 0, "" ),
+ array( "abc" . $char_o_diaeresis_nfd, 0, "" ),
+ array( "abc" . $char_o_diaeresis_nfd, 1, "a" ),
+ array( "abc" . $char_o_diaeresis_nfd, 2, "ab" ),
+ array( "abc" . $char_o_diaeresis_nfd, 3, "abc" ),
+ array( "abc" . $char_o_diaeresis_nfd, 4, "abc" ),
+ array( "abc" . $char_o_diaeresis_nfd, 5, "abc" . $char_o_diaeresis_nfd),
+ array( "abc" . $char_o_diaeresis_nfd, 6, "abc" . $char_o_diaeresis_nfd),
+ array( $char_o_diaeresis_nfd . "abc", 0, "" ),
+ array( $char_o_diaeresis_nfd . "abc", 1, "" ),
+ array( $char_o_diaeresis_nfd . "abc", 2, $char_o_diaeresis_nfd ),
+ array( $char_o_diaeresis_nfd . "abc", 3, $char_o_diaeresis_nfd . "a" ),
+ array( $char_o_diaeresis_nfd . "abc", 4, $char_o_diaeresis_nfd . "ab" ),
+ array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 5, $char_o_diaeresis_nfd . "abc" ),
+ array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 6, $char_o_diaeresis_nfd . "abc" ),
+ array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 7, $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd ),
+ array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "x" ),
+
+ array( "abc", 3, 0, "abc" ),
+ array( "abc", 2, 1, "bc" ),
+ array( "abc", 1, 2, "c" ),
+ array( "abc", 0, 3, "false" ),
+ array( "abc", 1, 3, "false" ),
+ array( "abc", 1, 999, "false" ),
+ array( $char_o_diaeresis_nfd . "abc", 1, 6, "false" ),
+ array( $char_o_diaeresis_nfd . "abc", 1, 999, "false" ),
+ array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 0, $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "x" ),
+ array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 1, $char_diaeresis . "abc" . $char_a_ring_nfd . "xy" ),
+ array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 2, "abc" . $char_a_ring_nfd . "xyz" ),
+ array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 3, "abc" . $char_a_ring_nfd . "xyz" ),
+ array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 4, "bc" . $char_a_ring_nfd . "xyz" ),
+ array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 5, "c" . $char_a_ring_nfd . "xyz" ),
+ array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 6, $char_a_ring_nfd . "xyz" ),
+
+ );
+
+ foreach( $tests as $test ) {
+ $arg0 = urlencode($test[0]);
+ $res_str .= "extract from \"$arg0\" \"$test[1]\" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS";
+ if ( 3 == count( $test ) ) {
+ $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXCHARS);
+ }
+ else {
+ $res_str .= " starting at byte position $test[2]";
+ $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXCHARS, $test[2]);
+ }
+ $res_str .= " = ";
+ if ( $result === false ) {
+ $res_str .= 'false';
+ }
+ else {
+ $res_str .= urlencode($result);
+ }
+ $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n";
+ }
+
+
+ //=====================================================================================
+
+ return $res_str;
}
echo ut_main();
function check_result($result, $expected) {
- if ( $result === false ) {
- $result = 'false';
- }
+ if ( $result === false ) {
+ $result = 'false';
+ }
- if ( strcmp($result, $expected) != 0 ) {
- return " **FAILED** ";
- }
+ if ( strcmp($result, $expected) != 0 ) {
+ return " **FAILED** ";
+ }
- return "";
+ return "";
}
?>
diff --git a/ext/intl/tests/grapheme2.phpt b/ext/intl/tests/grapheme2.phpt
index e17b53b094..4595b78128 100644
--- a/ext/intl/tests/grapheme2.phpt
+++ b/ext/intl/tests/grapheme2.phpt
@@ -12,772 +12,772 @@ grapheme()
function ut_main()
{
- $res_str = '';
-
- $char_a_diaeresis = "\xC3\xA4"; // 'LATIN SMALL LETTER A WITH DIAERESIS' (U+00E4)
- $char_a_ring = "\xC3\xA5"; // 'LATIN SMALL LETTER A WITH RING ABOVE' (U+00E5)
- $char_o_diaeresis = "\xC3\xB6"; // 'LATIN SMALL LETTER O WITH DIAERESIS' (U+00F6)
- $char_O_diaeresis = "\xC3\x96"; // 'LATIN CAPITAL LETTER O WITH DIAERESIS' (U+00D6)
-
- $char_angstrom_sign = "\xE2\x84\xAB"; // 'ANGSTROM SIGN' (U+212B)
- $char_A_ring = "\xC3\x85"; // 'LATIN CAPITAL LETTER A WITH RING ABOVE' (U+00C5)
-
- $char_ohm_sign = "\xE2\x84\xA6"; // 'OHM SIGN' (U+2126)
- $char_omega = "\xCE\xA9"; // 'GREEK CAPITAL LETTER OMEGA' (U+03A9)
-
- $char_combining_ring_above = "\xCC\x8A"; // 'COMBINING RING ABOVE' (U+030A)
-
- $char_fi_ligature = "\xEF\xAC\x81"; // 'LATIN SMALL LIGATURE FI' (U+FB01)
-
- $char_long_s_dot = "\xE1\xBA\x9B"; // 'LATIN SMALL LETTER LONG S WITH DOT ABOVE' (U+1E9B)
-
- // the word 'hindi' using Devanagari characters:
- $hindi = "\xe0\xa4\xb9\xe0\xa4\xbf\xe0\xa4\xa8\xe0\xa5\x8d\xe0\xa4\xa6\xe0\xa5\x80";
-
- $char_a_ring_nfd = "a\xCC\x8A";
- $char_A_ring_nfd = "A\xCC\x8A";
- $char_o_diaeresis_nfd = "o\xCC\x88";
- $char_O_diaeresis_nfd = "O\xCC\x88";
- $char_diaeresis = "\xCC\x88";
-
- //=====================================================================================
- $res_str .= "\n" . 'function grapheme_strlen($string) {}' . "\n\n";
-
-
- $res_str .= "\"hindi\" in devanagari strlen " . grapheme_strlen($hindi) . "\n";
- $res_str .= "\"ab\" + \"hindi\" + \"cde\" strlen " . grapheme_strlen('ab' . $hindi . 'cde') . "\n";
- $res_str .= "\"\" strlen " . grapheme_strlen("") . "\n";
- $res_str .= "char_a_ring_nfd strlen " . grapheme_strlen($char_a_ring_nfd) . "\n";
- $res_str .= "char_a_ring_nfd + \"bc\" strlen " . grapheme_strlen($char_a_ring_nfd . 'bc') . "\n";
- $res_str .= "\"abc\" strlen " . grapheme_strlen('abc') . "\n";
-
-
- //=====================================================================================
- $res_str .= "\n" . 'function grapheme_strpos($haystack, $needle, $offset = 0) {}' . "\n\n";
-
- $tests = array(
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 5 ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ),
- array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2 ),
- array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 1 ),
- array( "abc", $char_a_ring_nfd, "false" ),
- array( $char_a_ring_nfd . "bc", "a", "false" ),
- array( "abc", "d", "false" ),
- array( "abc", "c", 2 ),
- array( "abc", "b", 1 ),
- array( "abc", "a", 0 ),
- array( "abc", "a", 0, 0 ),
- array( "abc", "a", 1, "false" ),
- array( "abc", "a", -1, "false" ),
- array( "ababc", "a", 1, 2 ),
- array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 2, 6 ),
- array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", -1, 6 ),
- array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", -5, 6 ),
- array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ),
- array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, -4, 3 ),
-
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "op", 5 ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "opq", 5 ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ),
- array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 2 ),
- array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 1 ),
- array( "abc", $char_a_ring_nfd . "bc", "false" ),
- array( $char_a_ring_nfd . "bc", "abcdefg", "false" ),
- array( "abc", "defghijklmnopq", "false" ),
- array( "abc", "ab", 0 ),
- array( "abc", "bc", 1 ),
- array( "abc", "abc", 0 ),
- array( "abc", "abcd", "false" ),
- array( "abc", "ab", 0, 0 ),
- array( "abc", "abc", 0, 0 ),
- array( "abc", "abc", 1, "false" ),
- array( "ababc", "ab", 1, 2 ),
- array( "ababc", "abc", 1, 2 ),
- array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_a_ring_nfd . "bc", "o" . $char_a_ring_nfd . "bc", 2, 6 ),
- array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_a_ring_nfd . "bc", "o" . $char_a_ring_nfd . "bc", -8, 6 ),
- array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "bc" . $char_a_ring_nfd, 2, 3 ),
- );
-
- foreach( $tests as $test ) {
- $arg1 = urlencode($test[1]);
- $arg0 = urlencode($test[0]);
- $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strpos";
- if ( 3 == count( $test ) ) {
- $result = grapheme_strpos($test[0], $test[1]);
- }
- else {
- $res_str .= " from $test[2]";
- $result = grapheme_strpos($test[0], $test[1], $test[2]);
- }
- $res_str .= " = ";
- if ( $result === false ) {
- $res_str .= 'false';
- }
- else {
- $res_str .= $result;
- }
- $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n";
- }
-
- //=====================================================================================
- $res_str .= "\n" . 'function grapheme_stripos($haystack, $needle, $offset = 0) {}' . "\n\n";
-
- $tests = array(
- array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 2, 6 ),
- array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Oo", "o", -6, 6 ),
- array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 5 ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "O", "false" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, $char_o_diaeresis_nfd, -1, 4 ),
- array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd, 2 ),
- array( "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 1 ),
- array( "Abc", $char_a_ring_nfd, "false" ),
- array( $char_a_ring_nfd . "bc", "A", "false" ),
- array( "abc", "D", "false" ),
- array( "abC", "c", 2 ),
- array( "abc", "B", 1 ),
- array( "Abc", "a", 0 ),
- array( "abc", "A", 0, 0 ),
- array( "Abc", "a", 1, "false" ),
- array( "ababc", "A", 1, 2 ),
-
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "oP", 5 ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "opQ", 5 ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bC" . $char_o_diaeresis_nfd, $char_O_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ),
- array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "Bc", $char_A_ring_nfd . "bc", 2 ),
- array( "a" . $char_a_ring_nfd . "BC", $char_a_ring_nfd . "bc", 1 ),
- array( "abc", $char_a_ring_nfd . "BC", "false" ),
- array( $char_a_ring_nfd . "BC", "aBCdefg", "false" ),
- array( "aBC", "Defghijklmnopq", "false" ),
- array( "abC", "Ab", 0 ),
- array( "aBC", "bc", 1 ),
- array( "abC", "Abc", 0 ),
- array( "abC", "aBcd", "false" ),
- array( "ABc", "ab", 0, 0 ),
- array( "aBc", "abC", 0, 0 ),
- array( "abc", "aBc", 1, "false" ),
- array( "ABabc", "AB", 1, 2 ),
- array( "ABabc", "AB", -4, 2 ),
- array( "abaBc", "aBc", 1, 2 ),
- array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_A_ring_nfd . "bC", "O" . $char_a_ring_nfd . "bC", 2, 6 ),
- array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bC" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "Bc" . $char_a_ring_nfd, 2, 3 ),
- );
-
- foreach( $tests as $test ) {
- $arg1 = urlencode($test[1]);
- $arg0 = urlencode($test[0]);
- $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_stripos";
- if ( 3 == count( $test ) ) {
- $result = grapheme_stripos($test[0], $test[1]);
- }
- else {
- $res_str .= " from $test[2]";
- $result = grapheme_stripos($test[0], $test[1], $test[2]);
- }
- $res_str .= " = ";
- if ( $result === false ) {
- $res_str .= 'false';
- }
- else {
- $res_str .= $result;
- }
- $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n";
- }
-
-
- //=====================================================================================
- $res_str .= "\n" . 'function grapheme_strrpos($haystack, $needle, $offset = 0) {}' . "\n\n";
-
-
- $tests = array(
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 5 ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ),
- array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2 ),
- array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 1 ),
- array( "abc", $char_a_ring_nfd, "false" ),
- array( $char_a_ring_nfd . "bc", "a", "false" ),
- array( "abc", "d", "false" ),
- array( "abc", "c", 2 ),
- array( "abc", "b", 1 ),
- array( "abc", "a", 0 ),
- array( "abc", "a", 0, 0 ),
- array( "abc", "a", 1, "false" ),
- array( "ababc", "a", 1, 2 ),
- array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 2, 6 ),
- array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ),
-
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "op", 5 ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "opq", 5 ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ),
- array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 2 ),
- array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 1 ),
- array( "abc", $char_a_ring_nfd . "bc", "false" ),
- array( $char_a_ring_nfd . "bc", "abcdefg", "false" ),
- array( "abc", "defghijklmnopq", "false" ),
- array( "abc", "ab", 0 ),
- array( "abc", "bc", 1 ),
- array( "abc", "abc", 0 ),
- array( "abc", "abcd", "false" ),
- array( "abc", "ab", 0, 0 ),
- array( "abc", "abc", 0, 0 ),
- array( "abc", "abc", 1, "false" ),
- array( "ababc", "ab", 1, 2 ),
- array( "ababc", "abc", 1, 2 ),
- array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_a_ring_nfd . "bc", "o" . $char_a_ring_nfd . "bc", 2, 6 ),
- array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "bc" . $char_a_ring_nfd, 2, 3 ),
- );
-
- foreach( $tests as $test ) {
- $arg1 = urlencode($test[1]);
- $arg0 = urlencode($test[0]);
- $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strrpos";
- if ( 3 == count( $test ) ) {
- $result = grapheme_strrpos($test[0], $test[1]);
- }
- else {
- $res_str .= " from $test[2]";
- $result = grapheme_strrpos($test[0], $test[1], $test[2]);
- }
- $res_str .= " = ";
- if ( $result === false ) {
- $res_str .= 'false';
- }
- else {
- $res_str .= $result;
- }
- $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n";
- }
-
-
- //=====================================================================================
- $res_str .= "\n" . 'function grapheme_strripos($haystack, $needle, $offset = 0) {}' . "\n\n";
-
- $tests = array(
- array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 2, 6 ),
- array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 5 ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "O", "false" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ),
- array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd, 2 ),
- array( "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 1 ),
- array( "Abc", $char_a_ring_nfd, "false" ),
- array( $char_a_ring_nfd . "bc", "A", "false" ),
- array( "abc", "D", "false" ),
- array( "abC", "c", 2 ),
- array( "abc", "B", 1 ),
- array( "Abc", "a", 0 ),
- array( "abc", "A", 0, 0 ),
- array( "Abc", "a", 1, "false" ),
- array( "ababc", "A", 1, 2 ),
-
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "oP", 5 ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "opQ", 5 ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bC" . $char_o_diaeresis_nfd, $char_O_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ),
- array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "Bc", $char_A_ring_nfd . "bc", 2 ),
- array( "a" . $char_a_ring_nfd . "BC", $char_a_ring_nfd . "bc", 1 ),
- array( "abc", $char_a_ring_nfd . "BC", "false" ),
- array( $char_a_ring_nfd . "BC", "aBCdefg", "false" ),
- array( "aBC", "Defghijklmnopq", "false" ),
- array( "abC", "Ab", 0 ),
- array( "aBC", "bc", 1 ),
- array( "abC", "Abc", 0 ),
- array( "abC", "aBcd", "false" ),
- array( "ABc", "ab", 0, 0 ),
- array( "aBc", "abC", 0, 0 ),
- array( "abc", "aBc", 1, "false" ),
- array( "ABabc", "AB", 1, 2 ),
- array( "abaBc", "aBc", 1, 2 ),
- array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_A_ring_nfd . "bC", "O" . $char_a_ring_nfd . "bC", 2, 6 ),
- array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bC" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "Bc" . $char_a_ring_nfd, 2, 3 ),
- );
-
- foreach( $tests as $test ) {
- $arg1 = urlencode($test[1]);
- $arg0 = urlencode($test[0]);
- $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strripos";
- if ( 3 == count( $test ) ) {
- $result = grapheme_strripos($test[0], $test[1]);
- }
- else {
- $res_str .= " from $test[2]";
- $result = grapheme_strripos($test[0], $test[1], $test[2]);
- }
- $res_str .= " = ";
- if ( $result === false ) {
- $res_str .= 'false';
- }
- else {
- $res_str .= $result;
- }
- $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n";
- }
-
-
- //=====================================================================================
- $res_str .= "\n" . 'function grapheme_substr($string, $start, $length = -1) {}' . "\n\n";
-
- $tests = array(
-
- array( "abc", 3, "false" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, 5, "false" ),
- array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", 2, $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ),
- array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bc", 2, "a" . $char_A_ring_nfd . "bc" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", 5, "O" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, 5, "false" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, 4, $char_O_diaeresis_nfd ),
- array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", 2, $char_a_ring_nfd . "bc" ),
- array( "a" . $char_A_ring_nfd . "bc", 1, $char_A_ring_nfd . "bc" ),
- array( "Abc", -5, "false" ),
- array( $char_a_ring_nfd . "bc", 3, "false" ),
- array( "abc", 4, "false" ),
- array( "abC", 2, "C" ),
- array( "abc", 1, "bc" ),
- array( "Abc", 1, 1, "b" ),
- array( "abc", 0, 2, "ab" ),
- array( "Abc", -4, 1, "false" ),
- array( "ababc", 1, 2, "ba" ),
- array( "ababc", 0, 10, "ababc" ),
-
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, 10 , "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, "Opq" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -1, "Op" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -2, "O" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -3, "" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -4, "false" ),
-
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -1, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Op" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -2, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -3, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -4, "a" . $char_a_ring_nfd . "bc" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -5, "a" . $char_a_ring_nfd . "b" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -6, "a" . $char_a_ring_nfd ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -7, "a" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -8, "" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -9, "false" ),
-
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -7, $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -6, "bc" . $char_o_diaeresis_nfd . "Opq" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -5, "c" . $char_o_diaeresis_nfd . "Opq" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -4, $char_o_diaeresis_nfd . "Opq" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -3, "Opq" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -2, "pq" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -1, "q" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -999, "false" ),
-
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 8, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 7, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Op" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 6, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 5, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 4, "a" . $char_a_ring_nfd . "bc" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 3, "a" . $char_a_ring_nfd . "b" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 2, "a" . $char_a_ring_nfd ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 1, "a" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 0, "" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -999, "false" ),
-
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -1, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Op" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -2, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -3, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -4, "a" . $char_a_ring_nfd . "bc" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -5, "a" . $char_a_ring_nfd . "b" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -6, "a" . $char_a_ring_nfd ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -7, "a" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -8, "" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -9, "false" ),
-
- );
-
- foreach( $tests as $test ) {
- $arg0 = urlencode($test[0]);
- $res_str .= "substring of \"$arg0\" from \"$test[1]\" - grapheme_substr";
- if ( 3 == count( $test ) ) {
- $result = grapheme_substr($test[0], $test[1]);
- }
- else {
- $res_str .= " with length $test[2]";
- $result = grapheme_substr($test[0], $test[1], $test[2]);
- }
- $res_str .= " = ";
- if ( $result === false ) {
- $res_str .= 'false';
- }
- else {
- $res_str .= urlencode($result);
- }
- $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n";
- }
-
-
- //=====================================================================================
- $res_str .= "\n" . 'function grapheme_strstr($haystack, $needle, $before_needle = FALSE) {}' . "\n\n";
-
- $tests = array(
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", "o" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd, $char_o_diaeresis_nfd ),
- array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, $char_a_ring_nfd . "bc"),
- array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, $char_a_ring_nfd . "bc"),
- array( "abc", $char_a_ring_nfd, "false" ),
- array( $char_a_ring_nfd . "bc", "a", "false" ),
- array( "abc", "d", "false" ),
- array( "abc", "c", "c" ),
- array( "abc", "b", "bc" ),
- array( "abc", "a", "abc" ),
- array( "abc", "ab", "abc" ),
- array( "abc", "abc", "abc" ),
- array( "abc", "bc", "bc" ),
- array( "abc", "a", FALSE, "abc" ),
- array( "abc", "a", TRUE, "" ),
- array( "abc", "b", TRUE, "a" ),
- array( "abc", "c", TRUE, "ab" ),
- array( "ababc", "bab", TRUE, "a" ),
- array( "ababc", "abc", TRUE, "ab" ),
- array( "ababc", "abc", FALSE, "abc" ),
-
- array( "ab" . $char_a_ring_nfd . "c", "d", "false" ),
- array( "bc" . $char_a_ring_nfd . "a", "a", "a" ),
- array( "a" . $char_a_ring_nfd . "bc", "b", "bc" ),
- array( $char_a_ring_nfd . "bc", "a", "false" ),
- array( $char_a_ring_nfd . "abc", "ab", "abc" ),
- array( "abc" . $char_a_ring_nfd, "abc", "abc" . $char_a_ring_nfd),
- array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc" ),
- array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, FALSE, $char_a_ring_nfd . "bc"),
- array( "a" . $char_a_ring_nfd . "bc", "a", TRUE, "" ),
- array( $char_a_ring_nfd . "abc", "b", TRUE, $char_a_ring_nfd . "a" ),
- array( "ab" . $char_a_ring_nfd . "c", "c", TRUE, "ab" . $char_a_ring_nfd ),
- array( "aba" . $char_a_ring_nfd . "bc", "ba" . $char_a_ring_nfd . "b", TRUE, "a" ),
- array( "ababc" . $char_a_ring_nfd, "abc" . $char_a_ring_nfd, TRUE, "ab" ),
- array( "abab" . $char_a_ring_nfd . "c", "ab" . $char_a_ring_nfd . "c", FALSE, "ab" . $char_a_ring_nfd . "c" ),
-
- );
-
- foreach( $tests as $test ) {
- $arg1 = urlencode($test[1]);
- $arg0 = urlencode($test[0]);
- $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strstr";
- if ( 3 == count( $test ) ) {
- $result = grapheme_strstr($test[0], $test[1]);
- }
- else {
- $res_str .= " before flag is " . ( $test[2] ? "TRUE" : "FALSE" );
- $result = grapheme_strstr($test[0], $test[1], $test[2]);
- }
- $res_str .= " = ";
- if ( $result === false ) {
- $res_str .= 'false';
- }
- else {
- $res_str .= urlencode($result);
- }
- $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n";
- }
-
-
- //=====================================================================================
- $res_str .= "\n" . 'function grapheme_stristr($haystack, $needle, $before_needle = FALSE) {}' . "\n\n";
-
- $tests = array(
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_O_diaeresis_nfd, $char_o_diaeresis_nfd ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", "O" ),
- array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ),
- array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, $char_a_ring_nfd . "bc"),
- array( "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd, $char_a_ring_nfd . "bc"),
- array( "abc", $char_a_ring_nfd, "false" ),
- array( $char_a_ring_nfd . "bc", "A", "false" ),
- array( "abc", "d", "false" ),
- array( "abc", "C", "c" ),
- array( "aBc", "b", "Bc" ),
- array( "abc", "A", "abc" ),
- array( "abC", "ab", "abC" ),
- array( "abc", "aBc", "abc" ),
- array( "abC", "bc", "bC" ),
- array( "abc", "A", FALSE, "abc" ),
- array( "abc", "a", TRUE, "" ),
- array( "aBc", "b", TRUE, "a" ),
- array( "abc", "C", TRUE, "ab" ),
- array( "aBabc", "bab", TRUE, "a" ),
- array( "ababc", "aBc", TRUE, "ab" ),
- array( "ababc", "abC", FALSE, "abc" ),
-
- array( "ab" . $char_a_ring_nfd . "c", "d", "false" ),
- array( "bc" . $char_a_ring_nfd . "A", "a", "A" ),
- array( "a" . $char_a_ring_nfd . "bc", "B", "bc" ),
- array( $char_A_ring_nfd . "bc", "a", "false" ),
- array( $char_a_ring_nfd . "abc", "Ab", "abc" ),
- array( "abc" . $char_A_ring_nfd, "abc", "abc" . $char_A_ring_nfd),
- array( "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd . "bc", $char_a_ring_nfd . "bc" ),
- array( "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, FALSE, $char_A_ring_nfd . "bc" ),
- array( "a" . $char_a_ring_nfd . "bc", "A", TRUE, "" ),
- array( $char_a_ring_nfd . "aBc", "b", TRUE, $char_a_ring_nfd . "a" ),
- array( "ab" . $char_a_ring_nfd . "c", "C", TRUE, "ab" . $char_a_ring_nfd ),
- array( "aba" . $char_A_ring_nfd . "bc", "ba" . $char_a_ring_nfd . "b", TRUE, "a" ),
- array( "ababc" . $char_a_ring_nfd, "aBc" . $char_A_ring_nfd, TRUE, "ab" ),
- array( "abAB" . $char_A_ring_nfd . "c", "ab" . $char_a_ring_nfd . "c", FALSE, "AB" . $char_A_ring_nfd . "c" ),
-
- );
-
- foreach( $tests as $test ) {
- $arg1 = urlencode($test[1]);
- $arg0 = urlencode($test[0]);
- $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_stristr";
- if ( 3 == count( $test ) ) {
- $result = grapheme_stristr($test[0], $test[1]);
- }
- else {
- $res_str .= " before flag is " . ( $test[2] ? "TRUE" : "FALSE" );
- $result = grapheme_stristr($test[0], $test[1], $test[2]);
- }
- $res_str .= " = ";
- if ( $result === false ) {
- $res_str .= 'false';
- }
- else {
- $res_str .= urlencode($result);
- }
- $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n";
- }
-
-
- //=====================================================================================
- $res_str .= "\n" . 'function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_COUNT, $start = 0[, $next])' . "\n\n";
-
- $tests = array(
- // haystack, count, [[offset], [next]], result
- array( "abc", 3, "abc" ),
- array( "abc", 2, "ab" ),
- array( "abc", 1, "a" ),
- array( "abc", 0, "" ),
- array( "abc", 1, 0, "a" ),
- array( "abc", 1, 1, "b" ),
- array( "abc", 1, 2, "c" ),
- array( "abc", 0, 2, "" ),
-
- array( "abc", 3, 0, 3, "abc" ),
- array( "abc", 2, 0, 2, "ab" ),
- array( "abc", 1, 0, 1, "a" ),
- array( "abc", 0, 0, 0, "" ),
- array( "abc", 1, 0, 1, "a" ),
- array( "abc", 1, 1, 2, "b" ),
- array( "abc", 1, 2, 3, "c" ),
- array( "abc", 1, -2, 2, "b" ),
- array( "abc", 0, 2, 2, "" ),
+ $res_str = '';
+
+ $char_a_diaeresis = "\xC3\xA4"; // 'LATIN SMALL LETTER A WITH DIAERESIS' (U+00E4)
+ $char_a_ring = "\xC3\xA5"; // 'LATIN SMALL LETTER A WITH RING ABOVE' (U+00E5)
+ $char_o_diaeresis = "\xC3\xB6"; // 'LATIN SMALL LETTER O WITH DIAERESIS' (U+00F6)
+ $char_O_diaeresis = "\xC3\x96"; // 'LATIN CAPITAL LETTER O WITH DIAERESIS' (U+00D6)
+
+ $char_angstrom_sign = "\xE2\x84\xAB"; // 'ANGSTROM SIGN' (U+212B)
+ $char_A_ring = "\xC3\x85"; // 'LATIN CAPITAL LETTER A WITH RING ABOVE' (U+00C5)
+
+ $char_ohm_sign = "\xE2\x84\xA6"; // 'OHM SIGN' (U+2126)
+ $char_omega = "\xCE\xA9"; // 'GREEK CAPITAL LETTER OMEGA' (U+03A9)
+
+ $char_combining_ring_above = "\xCC\x8A"; // 'COMBINING RING ABOVE' (U+030A)
+
+ $char_fi_ligature = "\xEF\xAC\x81"; // 'LATIN SMALL LIGATURE FI' (U+FB01)
+
+ $char_long_s_dot = "\xE1\xBA\x9B"; // 'LATIN SMALL LETTER LONG S WITH DOT ABOVE' (U+1E9B)
+
+ // the word 'hindi' using Devanagari characters:
+ $hindi = "\xe0\xa4\xb9\xe0\xa4\xbf\xe0\xa4\xa8\xe0\xa5\x8d\xe0\xa4\xa6\xe0\xa5\x80";
+
+ $char_a_ring_nfd = "a\xCC\x8A";
+ $char_A_ring_nfd = "A\xCC\x8A";
+ $char_o_diaeresis_nfd = "o\xCC\x88";
+ $char_O_diaeresis_nfd = "O\xCC\x88";
+ $char_diaeresis = "\xCC\x88";
+
+ //=====================================================================================
+ $res_str .= "\n" . 'function grapheme_strlen($string) {}' . "\n\n";
+
+
+ $res_str .= "\"hindi\" in devanagari strlen " . grapheme_strlen($hindi) . "\n";
+ $res_str .= "\"ab\" + \"hindi\" + \"cde\" strlen " . grapheme_strlen('ab' . $hindi . 'cde') . "\n";
+ $res_str .= "\"\" strlen " . grapheme_strlen("") . "\n";
+ $res_str .= "char_a_ring_nfd strlen " . grapheme_strlen($char_a_ring_nfd) . "\n";
+ $res_str .= "char_a_ring_nfd + \"bc\" strlen " . grapheme_strlen($char_a_ring_nfd . 'bc') . "\n";
+ $res_str .= "\"abc\" strlen " . grapheme_strlen('abc') . "\n";
+
+
+ //=====================================================================================
+ $res_str .= "\n" . 'function grapheme_strpos($haystack, $needle, $offset = 0) {}' . "\n\n";
+
+ $tests = array(
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 5 ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ),
+ array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2 ),
+ array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 1 ),
+ array( "abc", $char_a_ring_nfd, "false" ),
+ array( $char_a_ring_nfd . "bc", "a", "false" ),
+ array( "abc", "d", "false" ),
+ array( "abc", "c", 2 ),
+ array( "abc", "b", 1 ),
+ array( "abc", "a", 0 ),
+ array( "abc", "a", 0, 0 ),
+ array( "abc", "a", 1, "false" ),
+ array( "abc", "a", -1, "false" ),
+ array( "ababc", "a", 1, 2 ),
+ array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 2, 6 ),
+ array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", -1, 6 ),
+ array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", -5, 6 ),
+ array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ),
+ array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, -4, 3 ),
+
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "op", 5 ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "opq", 5 ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ),
+ array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 2 ),
+ array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 1 ),
+ array( "abc", $char_a_ring_nfd . "bc", "false" ),
+ array( $char_a_ring_nfd . "bc", "abcdefg", "false" ),
+ array( "abc", "defghijklmnopq", "false" ),
+ array( "abc", "ab", 0 ),
+ array( "abc", "bc", 1 ),
+ array( "abc", "abc", 0 ),
+ array( "abc", "abcd", "false" ),
+ array( "abc", "ab", 0, 0 ),
+ array( "abc", "abc", 0, 0 ),
+ array( "abc", "abc", 1, "false" ),
+ array( "ababc", "ab", 1, 2 ),
+ array( "ababc", "abc", 1, 2 ),
+ array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_a_ring_nfd . "bc", "o" . $char_a_ring_nfd . "bc", 2, 6 ),
+ array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_a_ring_nfd . "bc", "o" . $char_a_ring_nfd . "bc", -8, 6 ),
+ array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "bc" . $char_a_ring_nfd, 2, 3 ),
+ );
+
+ foreach( $tests as $test ) {
+ $arg1 = urlencode($test[1]);
+ $arg0 = urlencode($test[0]);
+ $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strpos";
+ if ( 3 == count( $test ) ) {
+ $result = grapheme_strpos($test[0], $test[1]);
+ }
+ else {
+ $res_str .= " from $test[2]";
+ $result = grapheme_strpos($test[0], $test[1], $test[2]);
+ }
+ $res_str .= " = ";
+ if ( $result === false ) {
+ $res_str .= 'false';
+ }
+ else {
+ $res_str .= $result;
+ }
+ $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n";
+ }
+
+ //=====================================================================================
+ $res_str .= "\n" . 'function grapheme_stripos($haystack, $needle, $offset = 0) {}' . "\n\n";
+
+ $tests = array(
+ array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 2, 6 ),
+ array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Oo", "o", -6, 6 ),
+ array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 5 ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "O", "false" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, $char_o_diaeresis_nfd, -1, 4 ),
+ array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd, 2 ),
+ array( "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 1 ),
+ array( "Abc", $char_a_ring_nfd, "false" ),
+ array( $char_a_ring_nfd . "bc", "A", "false" ),
+ array( "abc", "D", "false" ),
+ array( "abC", "c", 2 ),
+ array( "abc", "B", 1 ),
+ array( "Abc", "a", 0 ),
+ array( "abc", "A", 0, 0 ),
+ array( "Abc", "a", 1, "false" ),
+ array( "ababc", "A", 1, 2 ),
+
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "oP", 5 ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "opQ", 5 ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bC" . $char_o_diaeresis_nfd, $char_O_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ),
+ array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "Bc", $char_A_ring_nfd . "bc", 2 ),
+ array( "a" . $char_a_ring_nfd . "BC", $char_a_ring_nfd . "bc", 1 ),
+ array( "abc", $char_a_ring_nfd . "BC", "false" ),
+ array( $char_a_ring_nfd . "BC", "aBCdefg", "false" ),
+ array( "aBC", "Defghijklmnopq", "false" ),
+ array( "abC", "Ab", 0 ),
+ array( "aBC", "bc", 1 ),
+ array( "abC", "Abc", 0 ),
+ array( "abC", "aBcd", "false" ),
+ array( "ABc", "ab", 0, 0 ),
+ array( "aBc", "abC", 0, 0 ),
+ array( "abc", "aBc", 1, "false" ),
+ array( "ABabc", "AB", 1, 2 ),
+ array( "ABabc", "AB", -4, 2 ),
+ array( "abaBc", "aBc", 1, 2 ),
+ array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_A_ring_nfd . "bC", "O" . $char_a_ring_nfd . "bC", 2, 6 ),
+ array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bC" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "Bc" . $char_a_ring_nfd, 2, 3 ),
+ );
+
+ foreach( $tests as $test ) {
+ $arg1 = urlencode($test[1]);
+ $arg0 = urlencode($test[0]);
+ $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_stripos";
+ if ( 3 == count( $test ) ) {
+ $result = grapheme_stripos($test[0], $test[1]);
+ }
+ else {
+ $res_str .= " from $test[2]";
+ $result = grapheme_stripos($test[0], $test[1], $test[2]);
+ }
+ $res_str .= " = ";
+ if ( $result === false ) {
+ $res_str .= 'false';
+ }
+ else {
+ $res_str .= $result;
+ }
+ $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n";
+ }
+
+
+ //=====================================================================================
+ $res_str .= "\n" . 'function grapheme_strrpos($haystack, $needle, $offset = 0) {}' . "\n\n";
+
+
+ $tests = array(
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 5 ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ),
+ array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2 ),
+ array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 1 ),
+ array( "abc", $char_a_ring_nfd, "false" ),
+ array( $char_a_ring_nfd . "bc", "a", "false" ),
+ array( "abc", "d", "false" ),
+ array( "abc", "c", 2 ),
+ array( "abc", "b", 1 ),
+ array( "abc", "a", 0 ),
+ array( "abc", "a", 0, 0 ),
+ array( "abc", "a", 1, "false" ),
+ array( "ababc", "a", 1, 2 ),
+ array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", 2, 6 ),
+ array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ),
+
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "op", 5 ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "opq", "opq", 5 ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ),
+ array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 2 ),
+ array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", 1 ),
+ array( "abc", $char_a_ring_nfd . "bc", "false" ),
+ array( $char_a_ring_nfd . "bc", "abcdefg", "false" ),
+ array( "abc", "defghijklmnopq", "false" ),
+ array( "abc", "ab", 0 ),
+ array( "abc", "bc", 1 ),
+ array( "abc", "abc", 0 ),
+ array( "abc", "abcd", "false" ),
+ array( "abc", "ab", 0, 0 ),
+ array( "abc", "abc", 0, 0 ),
+ array( "abc", "abc", 1, "false" ),
+ array( "ababc", "ab", 1, 2 ),
+ array( "ababc", "abc", 1, 2 ),
+ array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_a_ring_nfd . "bc", "o" . $char_a_ring_nfd . "bc", 2, 6 ),
+ array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_a_ring_nfd . "bc" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "bc" . $char_a_ring_nfd, 2, 3 ),
+ );
+
+ foreach( $tests as $test ) {
+ $arg1 = urlencode($test[1]);
+ $arg0 = urlencode($test[0]);
+ $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strrpos";
+ if ( 3 == count( $test ) ) {
+ $result = grapheme_strrpos($test[0], $test[1]);
+ }
+ else {
+ $res_str .= " from $test[2]";
+ $result = grapheme_strrpos($test[0], $test[1], $test[2]);
+ }
+ $res_str .= " = ";
+ if ( $result === false ) {
+ $res_str .= 'false';
+ }
+ else {
+ $res_str .= $result;
+ }
+ $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n";
+ }
+
+
+ //=====================================================================================
+ $res_str .= "\n" . 'function grapheme_strripos($haystack, $needle, $offset = 0) {}' . "\n\n";
+
+ $tests = array(
+ array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 2, 6 ),
+ array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 2, 3 ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", 5 ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "O", "false" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, $char_o_diaeresis_nfd, 4 ),
+ array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd, 2 ),
+ array( "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, 1 ),
+ array( "Abc", $char_a_ring_nfd, "false" ),
+ array( $char_a_ring_nfd . "bc", "A", "false" ),
+ array( "abc", "D", "false" ),
+ array( "abC", "c", 2 ),
+ array( "abc", "B", 1 ),
+ array( "Abc", "a", 0 ),
+ array( "abc", "A", 0, 0 ),
+ array( "Abc", "a", 1, "false" ),
+ array( "ababc", "A", 1, 2 ),
+
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "oP", 5 ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", "opQ", 5 ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "abc", "false" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "bC" . $char_o_diaeresis_nfd, $char_O_diaeresis_nfd . "bc" . $char_o_diaeresis_nfd, 4 ),
+ array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "Bc", $char_A_ring_nfd . "bc", 2 ),
+ array( "a" . $char_a_ring_nfd . "BC", $char_a_ring_nfd . "bc", 1 ),
+ array( "abc", $char_a_ring_nfd . "BC", "false" ),
+ array( $char_a_ring_nfd . "BC", "aBCdefg", "false" ),
+ array( "aBC", "Defghijklmnopq", "false" ),
+ array( "abC", "Ab", 0 ),
+ array( "aBC", "bc", 1 ),
+ array( "abC", "Abc", 0 ),
+ array( "abC", "aBcd", "false" ),
+ array( "ABc", "ab", 0, 0 ),
+ array( "aBc", "abC", 0, 0 ),
+ array( "abc", "aBc", 1, "false" ),
+ array( "ABabc", "AB", 1, 2 ),
+ array( "abaBc", "aBc", 1, 2 ),
+ array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o" . $char_A_ring_nfd . "bC", "O" . $char_a_ring_nfd . "bC", 2, 6 ),
+ array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bC" . $char_a_ring_nfd . "def", $char_a_ring_nfd . "Bc" . $char_a_ring_nfd, 2, 3 ),
+ );
+
+ foreach( $tests as $test ) {
+ $arg1 = urlencode($test[1]);
+ $arg0 = urlencode($test[0]);
+ $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strripos";
+ if ( 3 == count( $test ) ) {
+ $result = grapheme_strripos($test[0], $test[1]);
+ }
+ else {
+ $res_str .= " from $test[2]";
+ $result = grapheme_strripos($test[0], $test[1], $test[2]);
+ }
+ $res_str .= " = ";
+ if ( $result === false ) {
+ $res_str .= 'false';
+ }
+ else {
+ $res_str .= $result;
+ }
+ $res_str .= " == " . $test[count($test)-1] . check_result($result, $test[count($test)-1]) . "\n";
+ }
+
+
+ //=====================================================================================
+ $res_str .= "\n" . 'function grapheme_substr($string, $start, $length = -1) {}' . "\n\n";
+
+ $tests = array(
+
+ array( "abc", 3, "false" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, 5, "false" ),
+ array( "ao" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", 2, $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ),
+ array( $char_o_diaeresis_nfd . $char_a_ring_nfd . "a" . $char_A_ring_nfd . "bc", 2, "a" . $char_A_ring_nfd . "bc" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", 5, "O" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, 5, "false" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_O_diaeresis_nfd, 4, $char_O_diaeresis_nfd ),
+ array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", 2, $char_a_ring_nfd . "bc" ),
+ array( "a" . $char_A_ring_nfd . "bc", 1, $char_A_ring_nfd . "bc" ),
+ array( "Abc", -5, "false" ),
+ array( $char_a_ring_nfd . "bc", 3, "false" ),
+ array( "abc", 4, "false" ),
+ array( "abC", 2, "C" ),
+ array( "abc", 1, "bc" ),
+ array( "Abc", 1, 1, "b" ),
+ array( "abc", 0, 2, "ab" ),
+ array( "Abc", -4, 1, "false" ),
+ array( "ababc", 1, 2, "ba" ),
+ array( "ababc", 0, 10, "ababc" ),
+
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, 10 , "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, "Opq" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -1, "Op" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -2, "O" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -3, "" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 5, -4, "false" ),
+
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -1, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Op" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -2, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -3, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -4, "a" . $char_a_ring_nfd . "bc" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -5, "a" . $char_a_ring_nfd . "b" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -6, "a" . $char_a_ring_nfd ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -7, "a" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -8, "" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", 0, -9, "false" ),
+
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -7, $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -6, "bc" . $char_o_diaeresis_nfd . "Opq" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -5, "c" . $char_o_diaeresis_nfd . "Opq" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -4, $char_o_diaeresis_nfd . "Opq" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -3, "Opq" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -2, "pq" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -1, "q" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -999, "false" ),
+
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 8, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 7, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Op" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 6, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 5, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 4, "a" . $char_a_ring_nfd . "bc" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 3, "a" . $char_a_ring_nfd . "b" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 2, "a" . $char_a_ring_nfd ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 1, "a" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, 0, "" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -999, "false" ),
+
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -1, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Op" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -2, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -3, "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -4, "a" . $char_a_ring_nfd . "bc" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -5, "a" . $char_a_ring_nfd . "b" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -6, "a" . $char_a_ring_nfd ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -7, "a" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -8, "" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "Opq", -8, -9, "false" ),
+
+ );
+
+ foreach( $tests as $test ) {
+ $arg0 = urlencode($test[0]);
+ $res_str .= "substring of \"$arg0\" from \"$test[1]\" - grapheme_substr";
+ if ( 3 == count( $test ) ) {
+ $result = grapheme_substr($test[0], $test[1]);
+ }
+ else {
+ $res_str .= " with length $test[2]";
+ $result = grapheme_substr($test[0], $test[1], $test[2]);
+ }
+ $res_str .= " = ";
+ if ( $result === false ) {
+ $res_str .= 'false';
+ }
+ else {
+ $res_str .= urlencode($result);
+ }
+ $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n";
+ }
+
+
+ //=====================================================================================
+ $res_str .= "\n" . 'function grapheme_strstr($haystack, $needle, $before_needle = FALSE) {}' . "\n\n";
+
+ $tests = array(
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "o", "o", "o" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_o_diaeresis_nfd, $char_o_diaeresis_nfd ),
+ array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, $char_a_ring_nfd . "bc"),
+ array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, $char_a_ring_nfd . "bc"),
+ array( "abc", $char_a_ring_nfd, "false" ),
+ array( $char_a_ring_nfd . "bc", "a", "false" ),
+ array( "abc", "d", "false" ),
+ array( "abc", "c", "c" ),
+ array( "abc", "b", "bc" ),
+ array( "abc", "a", "abc" ),
+ array( "abc", "ab", "abc" ),
+ array( "abc", "abc", "abc" ),
+ array( "abc", "bc", "bc" ),
+ array( "abc", "a", FALSE, "abc" ),
+ array( "abc", "a", TRUE, "" ),
+ array( "abc", "b", TRUE, "a" ),
+ array( "abc", "c", TRUE, "ab" ),
+ array( "ababc", "bab", TRUE, "a" ),
+ array( "ababc", "abc", TRUE, "ab" ),
+ array( "ababc", "abc", FALSE, "abc" ),
+
+ array( "ab" . $char_a_ring_nfd . "c", "d", "false" ),
+ array( "bc" . $char_a_ring_nfd . "a", "a", "a" ),
+ array( "a" . $char_a_ring_nfd . "bc", "b", "bc" ),
+ array( $char_a_ring_nfd . "bc", "a", "false" ),
+ array( $char_a_ring_nfd . "abc", "ab", "abc" ),
+ array( "abc" . $char_a_ring_nfd, "abc", "abc" . $char_a_ring_nfd),
+ array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc", $char_a_ring_nfd . "bc" ),
+ array( "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, FALSE, $char_a_ring_nfd . "bc"),
+ array( "a" . $char_a_ring_nfd . "bc", "a", TRUE, "" ),
+ array( $char_a_ring_nfd . "abc", "b", TRUE, $char_a_ring_nfd . "a" ),
+ array( "ab" . $char_a_ring_nfd . "c", "c", TRUE, "ab" . $char_a_ring_nfd ),
+ array( "aba" . $char_a_ring_nfd . "bc", "ba" . $char_a_ring_nfd . "b", TRUE, "a" ),
+ array( "ababc" . $char_a_ring_nfd, "abc" . $char_a_ring_nfd, TRUE, "ab" ),
+ array( "abab" . $char_a_ring_nfd . "c", "ab" . $char_a_ring_nfd . "c", FALSE, "ab" . $char_a_ring_nfd . "c" ),
+
+ );
+
+ foreach( $tests as $test ) {
+ $arg1 = urlencode($test[1]);
+ $arg0 = urlencode($test[0]);
+ $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_strstr";
+ if ( 3 == count( $test ) ) {
+ $result = grapheme_strstr($test[0], $test[1]);
+ }
+ else {
+ $res_str .= " before flag is " . ( $test[2] ? "TRUE" : "FALSE" );
+ $result = grapheme_strstr($test[0], $test[1], $test[2]);
+ }
+ $res_str .= " = ";
+ if ( $result === false ) {
+ $res_str .= 'false';
+ }
+ else {
+ $res_str .= urlencode($result);
+ }
+ $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n";
+ }
+
+
+ //=====================================================================================
+ $res_str .= "\n" . 'function grapheme_stristr($haystack, $needle, $before_needle = FALSE) {}' . "\n\n";
+
+ $tests = array(
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, $char_O_diaeresis_nfd, $char_o_diaeresis_nfd ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd . "O", "o", "O" ),
+ array( "a" . $char_a_ring_nfd . "bc" . $char_o_diaeresis_nfd, "o", "false" ),
+ array( $char_o_diaeresis_nfd . "a" . $char_a_ring_nfd . "bc", $char_a_ring_nfd, $char_a_ring_nfd . "bc"),
+ array( "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd, $char_a_ring_nfd . "bc"),
+ array( "abc", $char_a_ring_nfd, "false" ),
+ array( $char_a_ring_nfd . "bc", "A", "false" ),
+ array( "abc", "d", "false" ),
+ array( "abc", "C", "c" ),
+ array( "aBc", "b", "Bc" ),
+ array( "abc", "A", "abc" ),
+ array( "abC", "ab", "abC" ),
+ array( "abc", "aBc", "abc" ),
+ array( "abC", "bc", "bC" ),
+ array( "abc", "A", FALSE, "abc" ),
+ array( "abc", "a", TRUE, "" ),
+ array( "aBc", "b", TRUE, "a" ),
+ array( "abc", "C", TRUE, "ab" ),
+ array( "aBabc", "bab", TRUE, "a" ),
+ array( "ababc", "aBc", TRUE, "ab" ),
+ array( "ababc", "abC", FALSE, "abc" ),
+
+ array( "ab" . $char_a_ring_nfd . "c", "d", "false" ),
+ array( "bc" . $char_a_ring_nfd . "A", "a", "A" ),
+ array( "a" . $char_a_ring_nfd . "bc", "B", "bc" ),
+ array( $char_A_ring_nfd . "bc", "a", "false" ),
+ array( $char_a_ring_nfd . "abc", "Ab", "abc" ),
+ array( "abc" . $char_A_ring_nfd, "abc", "abc" . $char_A_ring_nfd),
+ array( "a" . $char_a_ring_nfd . "bc", $char_A_ring_nfd . "bc", $char_a_ring_nfd . "bc" ),
+ array( "a" . $char_A_ring_nfd . "bc", $char_a_ring_nfd, FALSE, $char_A_ring_nfd . "bc" ),
+ array( "a" . $char_a_ring_nfd . "bc", "A", TRUE, "" ),
+ array( $char_a_ring_nfd . "aBc", "b", TRUE, $char_a_ring_nfd . "a" ),
+ array( "ab" . $char_a_ring_nfd . "c", "C", TRUE, "ab" . $char_a_ring_nfd ),
+ array( "aba" . $char_A_ring_nfd . "bc", "ba" . $char_a_ring_nfd . "b", TRUE, "a" ),
+ array( "ababc" . $char_a_ring_nfd, "aBc" . $char_A_ring_nfd, TRUE, "ab" ),
+ array( "abAB" . $char_A_ring_nfd . "c", "ab" . $char_a_ring_nfd . "c", FALSE, "AB" . $char_A_ring_nfd . "c" ),
+
+ );
+
+ foreach( $tests as $test ) {
+ $arg1 = urlencode($test[1]);
+ $arg0 = urlencode($test[0]);
+ $res_str .= "find \"$arg1\" in \"$arg0\" - grapheme_stristr";
+ if ( 3 == count( $test ) ) {
+ $result = grapheme_stristr($test[0], $test[1]);
+ }
+ else {
+ $res_str .= " before flag is " . ( $test[2] ? "TRUE" : "FALSE" );
+ $result = grapheme_stristr($test[0], $test[1], $test[2]);
+ }
+ $res_str .= " = ";
+ if ( $result === false ) {
+ $res_str .= 'false';
+ }
+ else {
+ $res_str .= urlencode($result);
+ }
+ $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n";
+ }
+
+
+ //=====================================================================================
+ $res_str .= "\n" . 'function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_COUNT, $start = 0[, $next])' . "\n\n";
+
+ $tests = array(
+ // haystack, count, [[offset], [next]], result
+ array( "abc", 3, "abc" ),
+ array( "abc", 2, "ab" ),
+ array( "abc", 1, "a" ),
+ array( "abc", 0, "" ),
+ array( "abc", 1, 0, "a" ),
+ array( "abc", 1, 1, "b" ),
+ array( "abc", 1, 2, "c" ),
+ array( "abc", 0, 2, "" ),
+
+ array( "abc", 3, 0, 3, "abc" ),
+ array( "abc", 2, 0, 2, "ab" ),
+ array( "abc", 1, 0, 1, "a" ),
+ array( "abc", 0, 0, 0, "" ),
+ array( "abc", 1, 0, 1, "a" ),
+ array( "abc", 1, 1, 2, "b" ),
+ array( "abc", 1, 2, 3, "c" ),
+ array( "abc", 1, -2, 2, "b" ),
+ array( "abc", 0, 2, 2, "" ),
array( "http://news.bbc.co.uk/2/hi/middle_east/7831588.stm", 48, 48 , 50 , "tm" ),
- array( $char_a_ring_nfd . "bc", 3, $char_a_ring_nfd . "bc" ),
- array( $char_a_ring_nfd . "bc", 2, $char_a_ring_nfd . "b" ),
- array( $char_a_ring_nfd . "bc", 1, $char_a_ring_nfd . "" ),
- array( $char_a_ring_nfd . "bc", 3, 0, 5, $char_a_ring_nfd . "bc" ),
- array( $char_a_ring_nfd . "bc", 2, 0, 4, $char_a_ring_nfd . "b" ),
- array( $char_a_ring_nfd . "bc", 1, 0, 3, $char_a_ring_nfd . "" ),
- array( $char_a_ring_nfd . "bcde", 2, 3, 5, "bc" ),
- array( $char_a_ring_nfd . "bcde", 2, -4, 5, "bc" ),
- array( $char_a_ring_nfd . "bcde", 2, 4, 6, "cd" ),
- array( $char_a_ring_nfd . "bcde", 2, -7, 4, $char_a_ring_nfd . "b" ),
- array( $char_a_ring_nfd . "bcde" . $char_a_ring_nfd . "f", 4, 5, 11, "de" . $char_a_ring_nfd . "f" ),
- array( $char_a_ring_nfd . "bcde" . $char_a_ring_nfd . "f", 4, -6, 11, "de" . $char_a_ring_nfd . "f" ),
-
- array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ),
- array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, $char_a_ring_nfd . $char_o_diaeresis_nfd ),
- array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 1, $char_a_ring_nfd . "" ),
-
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 0, $char_o_diaeresis_nfd),
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 2, $char_o_diaeresis_nfd),
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 3, $char_o_diaeresis_nfd),
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 4, $char_diaeresis),
-
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 0, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd),
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 2, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd),
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 3, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd),
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 4, $char_diaeresis . $char_o_diaeresis_nfd),
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 7, $char_diaeresis . $char_o_diaeresis_nfd),
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 8, $char_o_diaeresis_nfd),
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 10, $char_diaeresis),
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 11, "false"),
-
- );
-
- $next = -1;
- foreach( $tests as $test ) {
- $arg0 = urlencode($test[0]);
- $res_str .= "extract from \"$arg0\" \"$test[1]\" graphemes - grapheme_extract";
- if ( 3 == count( $test ) ) {
- $result = grapheme_extract($test[0], $test[1]);
- }
- elseif ( 4 == count ( $test ) ) {
- $res_str .= " starting at byte position $test[2]";
- $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_COUNT, $test[2]);
- }
- else {
- $res_str .= " starting at byte position $test[2] with \$next";
- $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_COUNT, $test[2], $next);
- }
- $res_str .= " = ";
- if ( $result === false ) {
- $res_str .= 'false';
- }
- else {
- $res_str .= urlencode($result);
- }
- $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]);
- if ( 5 == count ( $test ) ) {
- $res_str .= " \$next=$next == $test[3] ";
- if ( $next != $test[3] ) {
- $res_str .= "***FAILED***";
- }
- }
- $res_str .= "\n";
- }
-
-
- //=====================================================================================
- $res_str .= "\n" . 'function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_MAXBYTES, $start = 0)' . "\n\n";
-
- $tests = array(
- array( "abc", 3, "abc" ),
- array( "abc", 2, "ab" ),
- array( "abc", 1, "a" ),
- array( "abc", 0, "" ),
- array( $char_a_ring_nfd . "bc", 5, $char_a_ring_nfd . "bc" ),
- array( $char_a_ring_nfd . "bc", 4, $char_a_ring_nfd . "b" ),
- array( $char_a_ring_nfd . "bc", 1, "" ),
- array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 9, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ),
- array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 10, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ),
- array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 11, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ),
- array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, $char_a_ring_nfd . $char_o_diaeresis_nfd ),
- array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 3, $char_a_ring_nfd . "" ),
- array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 4, $char_a_ring_nfd . "" ),
- array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 5, $char_a_ring_nfd . "" ),
- array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 6, $char_a_ring_nfd . $char_o_diaeresis_nfd ),
- array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 7, $char_a_ring_nfd . $char_o_diaeresis_nfd . "c" ),
-
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 0, $char_o_diaeresis_nfd),
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 2, $char_o_diaeresis_nfd),
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 3, $char_o_diaeresis_nfd),
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 4, $char_diaeresis),
-
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, 0, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd),
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, 2, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd),
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, 3, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd),
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 5, 4, $char_diaeresis . $char_o_diaeresis_nfd),
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 5, 7, $char_diaeresis . $char_o_diaeresis_nfd),
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 8, $char_o_diaeresis_nfd),
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 10, $char_diaeresis),
- array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 11, "false"),
-
- );
-
- foreach( $tests as $test ) {
- $arg0 = urlencode($test[0]);
- $res_str .= "extract from \"$arg0\" \"$test[1]\" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES";
- if ( 3 == count( $test ) ) {
- $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXBYTES);
- }
- else {
- $res_str .= " starting at byte position $test[2]";
- $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXBYTES, $test[2]);
- }
- $res_str .= " = ";
- if ( $result === false ) {
- $res_str .= 'false';
- }
- else {
- $res_str .= urlencode($result);
- }
- $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n";
- }
-
-
- //=====================================================================================
- $res_str .= "\n" . 'function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_MAXCHARS, $start = 0)' . "\n\n";
-
- $tests = array(
- array( "abc", 3, "abc" ),
- array( "abc", 2, "ab" ),
- array( "abc", 1, "a" ),
- array( "abc", 0, "" ),
- array( "abc" . $char_o_diaeresis_nfd, 0, "" ),
- array( "abc" . $char_o_diaeresis_nfd, 1, "a" ),
- array( "abc" . $char_o_diaeresis_nfd, 2, "ab" ),
- array( "abc" . $char_o_diaeresis_nfd, 3, "abc" ),
- array( "abc" . $char_o_diaeresis_nfd, 4, "abc" ),
- array( "abc" . $char_o_diaeresis_nfd, 5, "abc" . $char_o_diaeresis_nfd),
- array( "abc" . $char_o_diaeresis_nfd, 6, "abc" . $char_o_diaeresis_nfd),
- array( $char_o_diaeresis_nfd . "abc", 0, "" ),
- array( $char_o_diaeresis_nfd . "abc", 1, "" ),
- array( $char_o_diaeresis_nfd . "abc", 2, $char_o_diaeresis_nfd ),
- array( $char_o_diaeresis_nfd . "abc", 3, $char_o_diaeresis_nfd . "a" ),
- array( $char_o_diaeresis_nfd . "abc", 4, $char_o_diaeresis_nfd . "ab" ),
- array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 5, $char_o_diaeresis_nfd . "abc" ),
- array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 6, $char_o_diaeresis_nfd . "abc" ),
- array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 7, $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd ),
- array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "x" ),
-
- array( "abc", 3, 0, "abc" ),
- array( "abc", 2, 1, "bc" ),
- array( "abc", 1, 2, "c" ),
- array( "abc", 0, 3, "false" ),
- array( "abc", 1, 3, "false" ),
- array( "abc", 1, 999, "false" ),
- array( $char_o_diaeresis_nfd . "abc", 1, 6, "false" ),
- array( $char_o_diaeresis_nfd . "abc", 1, 999, "false" ),
- array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 0, $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "x" ),
- array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 1, $char_diaeresis . "abc" . $char_a_ring_nfd . "xy" ),
- array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 2, "abc" . $char_a_ring_nfd . "xyz" ),
- array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 3, "abc" . $char_a_ring_nfd . "xyz" ),
- array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 4, "bc" . $char_a_ring_nfd . "xyz" ),
- array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 5, "c" . $char_a_ring_nfd . "xyz" ),
- array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 6, $char_a_ring_nfd . "xyz" ),
-
- );
-
- foreach( $tests as $test ) {
- $arg0 = urlencode($test[0]);
- $res_str .= "extract from \"$arg0\" \"$test[1]\" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS";
- if ( 3 == count( $test ) ) {
- $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXCHARS);
- }
- else {
- $res_str .= " starting at byte position $test[2]";
- $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXCHARS, $test[2]);
- }
- $res_str .= " = ";
- if ( $result === false ) {
- $res_str .= 'false';
- }
- else {
- $res_str .= urlencode($result);
- }
- $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n";
- }
-
-
- //=====================================================================================
-
- return $res_str;
+ array( $char_a_ring_nfd . "bc", 3, $char_a_ring_nfd . "bc" ),
+ array( $char_a_ring_nfd . "bc", 2, $char_a_ring_nfd . "b" ),
+ array( $char_a_ring_nfd . "bc", 1, $char_a_ring_nfd . "" ),
+ array( $char_a_ring_nfd . "bc", 3, 0, 5, $char_a_ring_nfd . "bc" ),
+ array( $char_a_ring_nfd . "bc", 2, 0, 4, $char_a_ring_nfd . "b" ),
+ array( $char_a_ring_nfd . "bc", 1, 0, 3, $char_a_ring_nfd . "" ),
+ array( $char_a_ring_nfd . "bcde", 2, 3, 5, "bc" ),
+ array( $char_a_ring_nfd . "bcde", 2, -4, 5, "bc" ),
+ array( $char_a_ring_nfd . "bcde", 2, 4, 6, "cd" ),
+ array( $char_a_ring_nfd . "bcde", 2, -7, 4, $char_a_ring_nfd . "b" ),
+ array( $char_a_ring_nfd . "bcde" . $char_a_ring_nfd . "f", 4, 5, 11, "de" . $char_a_ring_nfd . "f" ),
+ array( $char_a_ring_nfd . "bcde" . $char_a_ring_nfd . "f", 4, -6, 11, "de" . $char_a_ring_nfd . "f" ),
+
+ array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ),
+ array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, $char_a_ring_nfd . $char_o_diaeresis_nfd ),
+ array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 1, $char_a_ring_nfd . "" ),
+
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 0, $char_o_diaeresis_nfd),
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 2, $char_o_diaeresis_nfd),
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 3, $char_o_diaeresis_nfd),
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 1, 4, $char_diaeresis),
+
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 0, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd),
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 2, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd),
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 3, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd),
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 4, $char_diaeresis . $char_o_diaeresis_nfd),
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 7, $char_diaeresis . $char_o_diaeresis_nfd),
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 8, $char_o_diaeresis_nfd),
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 10, $char_diaeresis),
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 11, "false"),
+
+ );
+
+ $next = -1;
+ foreach( $tests as $test ) {
+ $arg0 = urlencode($test[0]);
+ $res_str .= "extract from \"$arg0\" \"$test[1]\" graphemes - grapheme_extract";
+ if ( 3 == count( $test ) ) {
+ $result = grapheme_extract($test[0], $test[1]);
+ }
+ elseif ( 4 == count ( $test ) ) {
+ $res_str .= " starting at byte position $test[2]";
+ $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_COUNT, $test[2]);
+ }
+ else {
+ $res_str .= " starting at byte position $test[2] with \$next";
+ $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_COUNT, $test[2], $next);
+ }
+ $res_str .= " = ";
+ if ( $result === false ) {
+ $res_str .= 'false';
+ }
+ else {
+ $res_str .= urlencode($result);
+ }
+ $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]);
+ if ( 5 == count ( $test ) ) {
+ $res_str .= " \$next=$next == $test[3] ";
+ if ( $next != $test[3] ) {
+ $res_str .= "***FAILED***";
+ }
+ }
+ $res_str .= "\n";
+ }
+
+
+ //=====================================================================================
+ $res_str .= "\n" . 'function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_MAXBYTES, $start = 0)' . "\n\n";
+
+ $tests = array(
+ array( "abc", 3, "abc" ),
+ array( "abc", 2, "ab" ),
+ array( "abc", 1, "a" ),
+ array( "abc", 0, "" ),
+ array( $char_a_ring_nfd . "bc", 5, $char_a_ring_nfd . "bc" ),
+ array( $char_a_ring_nfd . "bc", 4, $char_a_ring_nfd . "b" ),
+ array( $char_a_ring_nfd . "bc", 1, "" ),
+ array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 9, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ),
+ array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 10, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ),
+ array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 11, $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd ),
+ array( $char_a_ring_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, $char_a_ring_nfd . $char_o_diaeresis_nfd ),
+ array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 3, $char_a_ring_nfd . "" ),
+ array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 4, $char_a_ring_nfd . "" ),
+ array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 5, $char_a_ring_nfd . "" ),
+ array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 6, $char_a_ring_nfd . $char_o_diaeresis_nfd ),
+ array( $char_a_ring_nfd . $char_o_diaeresis_nfd . "c", 7, $char_a_ring_nfd . $char_o_diaeresis_nfd . "c" ),
+
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 0, $char_o_diaeresis_nfd),
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 2, $char_o_diaeresis_nfd),
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 3, $char_o_diaeresis_nfd),
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 4, $char_diaeresis),
+
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, 0, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd),
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, 2, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd),
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 6, 3, $char_o_diaeresis_nfd . $char_o_diaeresis_nfd),
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 5, 4, $char_diaeresis . $char_o_diaeresis_nfd),
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 5, 7, $char_diaeresis . $char_o_diaeresis_nfd),
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 3, 8, $char_o_diaeresis_nfd),
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 10, $char_diaeresis),
+ array( $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd . $char_o_diaeresis_nfd, 2, 11, "false"),
+
+ );
+
+ foreach( $tests as $test ) {
+ $arg0 = urlencode($test[0]);
+ $res_str .= "extract from \"$arg0\" \"$test[1]\" graphemes - grapheme_extract GRAPHEME_EXTR_MAXBYTES";
+ if ( 3 == count( $test ) ) {
+ $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXBYTES);
+ }
+ else {
+ $res_str .= " starting at byte position $test[2]";
+ $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXBYTES, $test[2]);
+ }
+ $res_str .= " = ";
+ if ( $result === false ) {
+ $res_str .= 'false';
+ }
+ else {
+ $res_str .= urlencode($result);
+ }
+ $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n";
+ }
+
+
+ //=====================================================================================
+ $res_str .= "\n" . 'function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_MAXCHARS, $start = 0)' . "\n\n";
+
+ $tests = array(
+ array( "abc", 3, "abc" ),
+ array( "abc", 2, "ab" ),
+ array( "abc", 1, "a" ),
+ array( "abc", 0, "" ),
+ array( "abc" . $char_o_diaeresis_nfd, 0, "" ),
+ array( "abc" . $char_o_diaeresis_nfd, 1, "a" ),
+ array( "abc" . $char_o_diaeresis_nfd, 2, "ab" ),
+ array( "abc" . $char_o_diaeresis_nfd, 3, "abc" ),
+ array( "abc" . $char_o_diaeresis_nfd, 4, "abc" ),
+ array( "abc" . $char_o_diaeresis_nfd, 5, "abc" . $char_o_diaeresis_nfd),
+ array( "abc" . $char_o_diaeresis_nfd, 6, "abc" . $char_o_diaeresis_nfd),
+ array( $char_o_diaeresis_nfd . "abc", 0, "" ),
+ array( $char_o_diaeresis_nfd . "abc", 1, "" ),
+ array( $char_o_diaeresis_nfd . "abc", 2, $char_o_diaeresis_nfd ),
+ array( $char_o_diaeresis_nfd . "abc", 3, $char_o_diaeresis_nfd . "a" ),
+ array( $char_o_diaeresis_nfd . "abc", 4, $char_o_diaeresis_nfd . "ab" ),
+ array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 5, $char_o_diaeresis_nfd . "abc" ),
+ array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 6, $char_o_diaeresis_nfd . "abc" ),
+ array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 7, $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd ),
+ array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "x" ),
+
+ array( "abc", 3, 0, "abc" ),
+ array( "abc", 2, 1, "bc" ),
+ array( "abc", 1, 2, "c" ),
+ array( "abc", 0, 3, "false" ),
+ array( "abc", 1, 3, "false" ),
+ array( "abc", 1, 999, "false" ),
+ array( $char_o_diaeresis_nfd . "abc", 1, 6, "false" ),
+ array( $char_o_diaeresis_nfd . "abc", 1, 999, "false" ),
+ array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 0, $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "x" ),
+ array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 1, $char_diaeresis . "abc" . $char_a_ring_nfd . "xy" ),
+ array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 2, "abc" . $char_a_ring_nfd . "xyz" ),
+ array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 3, "abc" . $char_a_ring_nfd . "xyz" ),
+ array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 4, "bc" . $char_a_ring_nfd . "xyz" ),
+ array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 5, "c" . $char_a_ring_nfd . "xyz" ),
+ array( $char_o_diaeresis_nfd . "abc" . $char_a_ring_nfd . "xyz", 8, 6, $char_a_ring_nfd . "xyz" ),
+
+ );
+
+ foreach( $tests as $test ) {
+ $arg0 = urlencode($test[0]);
+ $res_str .= "extract from \"$arg0\" \"$test[1]\" graphemes - grapheme_extract GRAPHEME_EXTR_MAXCHARS";
+ if ( 3 == count( $test ) ) {
+ $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXCHARS);
+ }
+ else {
+ $res_str .= " starting at byte position $test[2]";
+ $result = grapheme_extract($test[0], $test[1], GRAPHEME_EXTR_MAXCHARS, $test[2]);
+ }
+ $res_str .= " = ";
+ if ( $result === false ) {
+ $res_str .= 'false';
+ }
+ else {
+ $res_str .= urlencode($result);
+ }
+ $res_str .= " == " . urlencode($test[count($test)-1]) . check_result($result, $test[count($test)-1]) . "\n";
+ }
+
+
+ //=====================================================================================
+
+ return $res_str;
}
echo ut_main();
function check_result($result, $expected) {
- if ( $result === false ) {
- $result = 'false';
- }
+ if ( $result === false ) {
+ $result = 'false';
+ }
- if ( strcmp($result, $expected) != 0 ) {
- return " **FAILED** ";
- }
+ if ( strcmp($result, $expected) != 0 ) {
+ return " **FAILED** ";
+ }
- return "";
+ return "";
}
?>
diff --git a/ext/intl/tests/gregoriancalendar___construct_basic.phpt b/ext/intl/tests/gregoriancalendar___construct_basic.phpt
index bb059c2edd..dc8eedc435 100644
--- a/ext/intl/tests/gregoriancalendar___construct_basic.phpt
+++ b/ext/intl/tests/gregoriancalendar___construct_basic.phpt
@@ -33,7 +33,6 @@ var_dump($intlcal->getLocale(1));
var_dump($intlcal->getType());
?>
-==DONE==
--EXPECT--
string(16) "Europe/Amsterdam"
string(5) "nl_NL"
@@ -46,4 +45,3 @@ string(5) "pt_PT"
string(12) "Europe/Paris"
string(5) "fr_CA"
string(9) "gregorian"
-==DONE==
diff --git a/ext/intl/tests/gregoriancalendar___construct_error.phpt b/ext/intl/tests/gregoriancalendar___construct_error.phpt
index bef69db877..41bfc49398 100644
--- a/ext/intl/tests/gregoriancalendar___construct_error.phpt
+++ b/ext/intl/tests/gregoriancalendar___construct_error.phpt
@@ -8,33 +8,34 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-function print_exception($e) {
- echo "\nException: " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine() . "\n";
+try {
+ var_dump(intlgregcal_create_instance(1,2,3,4,5,6,7));
+} catch (ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(intlgregcal_create_instance(1,2,3,4,5,6,7,8));
+} catch (ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(intlgregcal_create_instance(1,2,3,4));
+} catch (ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
}
-
-var_dump(intlgregcal_create_instance(1,2,3,4,5,6,7));
-var_dump(intlgregcal_create_instance(1,2,3,4,5,6,7,8));
-var_dump(intlgregcal_create_instance(1,2,3,4));
try {
- var_dump(new IntlGregorianCalendar(1,2,NULL,4));
-} catch (IntlException $e) {
- print_exception($e);
+ var_dump(new IntlGregorianCalendar(1,2,NULL,4));
+} catch (ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
}
try {
- var_dump(new IntlGregorianCalendar(1,2,3,4,NULL,array()));
+ var_dump(new IntlGregorianCalendar(1,2,3,4,NULL,array()));
} catch (TypeError $e) {
- print_exception($e);
+ echo $e->getMessage(), "\n";
}
---EXPECTF--
-Warning: intlgregcal_create_instance(): intlgregcal_create_instance: too many arguments in %s on line %d
-NULL
-
-Warning: intlgregcal_create_instance(): intlgregcal_create_instance: too many arguments in %s on line %d
-NULL
-
-Warning: intlgregcal_create_instance(): intlgregcal_create_instance: no variant with 4 arguments (excluding trailing NULLs) in %s on line %d
-NULL
-
-Exception: IntlGregorianCalendar::__construct(): intlgregcal_create_instance: no variant with 4 arguments (excluding trailing NULLs) in %s on line %d
-
-Exception: IntlGregorianCalendar::__construct() expects parameter 6 to be int, array given in %s on line %d
+--EXPECT--
+Too many arguments
+Too many arguments
+No variant with 4 arguments (excluding trailing NULLs)
+No variant with 4 arguments (excluding trailing NULLs)
+IntlGregorianCalendar::__construct() expects parameter 6 to be int, array given
diff --git a/ext/intl/tests/gregoriancalendar___construct_variant1.phpt b/ext/intl/tests/gregoriancalendar___construct_variant1.phpt
index 63266b792e..86274c34bf 100644
--- a/ext/intl/tests/gregoriancalendar___construct_variant1.phpt
+++ b/ext/intl/tests/gregoriancalendar___construct_variant1.phpt
@@ -19,7 +19,6 @@ var_dump($intlcal->getTime(), (float)strtotime('2012-02-29 16:07:08') * 1000);
var_dump($intlcal->getType());
?>
-==DONE==
--EXPECT--
string(16) "Europe/Amsterdam"
float(1330527600000)
@@ -27,4 +26,3 @@ float(1330527600000)
float(1330528028000)
float(1330528028000)
string(9) "gregorian"
-==DONE==
diff --git a/ext/intl/tests/gregoriancalendar_getGregorianChange_error.phpt b/ext/intl/tests/gregoriancalendar_getGregorianChange_error.phpt
index a1cfb593d7..37a0315c45 100644
--- a/ext/intl/tests/gregoriancalendar_getGregorianChange_error.phpt
+++ b/ext/intl/tests/gregoriancalendar_getGregorianChange_error.phpt
@@ -10,23 +10,11 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-var_dump($c->getGregorianChange(1));
-
-var_dump(intlgregcal_get_gregorian_change($c, 1));
var_dump(intlgregcal_get_gregorian_change(1));
---EXPECTF--
-Warning: IntlGregorianCalendar::getGregorianChange() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlGregorianCalendar::getGregorianChange(): intlgregcal_get_gregorian_change: bad arguments in %s on line %d
-bool(false)
-Warning: intlgregcal_get_gregorian_change() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: intlgregcal_get_gregorian_change(): intlgregcal_get_gregorian_change: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlgregcal_get_gregorian_change() must be an instance of IntlGregorianCalendar, int given in %s:%d
+?>
+--EXPECTF--
+Fatal error: Uncaught TypeError: intlgregcal_get_gregorian_change() expects parameter 1 to be IntlGregorianCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlgregcal_get_gregorian_change(1)
#1 {main}
diff --git a/ext/intl/tests/gregoriancalendar_get_setGregorianChange_basic.phpt b/ext/intl/tests/gregoriancalendar_get_setGregorianChange_basic.phpt
index b08ad7981f..98c11e41b1 100644
--- a/ext/intl/tests/gregoriancalendar_get_setGregorianChange_basic.phpt
+++ b/ext/intl/tests/gregoriancalendar_get_setGregorianChange_basic.phpt
@@ -22,11 +22,9 @@ var_dump(intlgregcal_set_gregorian_change($intlcal, 1));
var_dump($intlcal->getGregorianChange());
?>
-==DONE==
--EXPECT--
float(-12219292800000)
bool(true)
float(0)
bool(true)
-float(1)
-==DONE== \ No newline at end of file
+float(1) \ No newline at end of file
diff --git a/ext/intl/tests/gregoriancalendar_isLeapYear_basic.phpt b/ext/intl/tests/gregoriancalendar_isLeapYear_basic.phpt
index b37452fcba..31c8024786 100644
--- a/ext/intl/tests/gregoriancalendar_isLeapYear_basic.phpt
+++ b/ext/intl/tests/gregoriancalendar_isLeapYear_basic.phpt
@@ -19,10 +19,8 @@ var_dump($intlcal->isLeapYear(1900));
var_dump(intlgregcal_is_leap_year($intlcal, 2012));
var_dump(intlgregcal_is_leap_year($intlcal, 1900));
?>
-==DONE==
--EXPECT--
bool(true)
bool(false)
bool(true)
-bool(false)
-==DONE== \ No newline at end of file
+bool(false) \ No newline at end of file
diff --git a/ext/intl/tests/gregoriancalendar_isLeapYear_error.phpt b/ext/intl/tests/gregoriancalendar_isLeapYear_error.phpt
index 9da5aaf418..9b7c3e0be8 100644
--- a/ext/intl/tests/gregoriancalendar_isLeapYear_error.phpt
+++ b/ext/intl/tests/gregoriancalendar_isLeapYear_error.phpt
@@ -10,41 +10,11 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-var_dump($c->isLeapYear(2000, 2011));
-var_dump($c->isLeapYear());
-var_dump($c->isLeapYear("fgdf"));
-
-var_dump(intlgregcal_is_leap_year($c, 1, 2));
-var_dump(intlgregcal_is_leap_year($c));
var_dump(intlgregcal_is_leap_year(1, 2));
---EXPECTF--
-Warning: IntlGregorianCalendar::isLeapYear() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlGregorianCalendar::isLeapYear(): intlgregcal_is_leap_year: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlGregorianCalendar::isLeapYear() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlGregorianCalendar::isLeapYear(): intlgregcal_is_leap_year: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlGregorianCalendar::isLeapYear() expects parameter 1 to be int, string given in %s on line %d
-Warning: IntlGregorianCalendar::isLeapYear(): intlgregcal_is_leap_year: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlgregcal_is_leap_year() expects exactly 2 parameters, 3 given in %s on line %d
-
-Warning: intlgregcal_is_leap_year(): intlgregcal_is_leap_year: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlgregcal_is_leap_year() expects exactly 2 parameters, 1 given in %s on line %d
-
-Warning: intlgregcal_is_leap_year(): intlgregcal_is_leap_year: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlgregcal_is_leap_year() must be an instance of IntlGregorianCalendar, int given in %s:%d
+?>
+--EXPECTF--
+Fatal error: Uncaught TypeError: intlgregcal_is_leap_year() expects parameter 1 to be IntlGregorianCalendar, int given in %s:%d
Stack trace:
#0 %s(%d): intlgregcal_is_leap_year(1, 2)
#1 {main}
diff --git a/ext/intl/tests/gregoriancalendar_setGregorianChange_error.phpt b/ext/intl/tests/gregoriancalendar_setGregorianChange_error.phpt
deleted file mode 100644
index 0dd27802b5..0000000000
--- a/ext/intl/tests/gregoriancalendar_setGregorianChange_error.phpt
+++ /dev/null
@@ -1,45 +0,0 @@
---TEST--
-IntlGregorianCalendar::setGregorianChange(): bad arguments
---INI--
-date.timezone=Atlantic/Azores
---SKIPIF--
-<?php
-if (!extension_loaded('intl'))
- die('skip intl extension not enabled');
---FILE--
-<?php
-ini_set("intl.error_level", E_WARNING);
-
-$c = new IntlGregorianCalendar();
-var_dump($c->setGregorianChange());
-var_dump($c->setGregorianChange(1, 2));
-var_dump($c->setGregorianChange("sdfds"));
-
-var_dump(intlgregcal_set_gregorian_change($c));
-var_dump(intlgregcal_set_gregorian_change(1, 4.));
---EXPECTF--
-Warning: IntlGregorianCalendar::setGregorianChange() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlGregorianCalendar::setGregorianChange(): intlgregcal_set_gregorian_change: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlGregorianCalendar::setGregorianChange() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlGregorianCalendar::setGregorianChange(): intlgregcal_set_gregorian_change: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlGregorianCalendar::setGregorianChange() expects parameter 1 to be float, string given in %s on line %d
-
-Warning: IntlGregorianCalendar::setGregorianChange(): intlgregcal_set_gregorian_change: bad arguments in %s on line %d
-bool(false)
-
-Warning: intlgregcal_set_gregorian_change() expects exactly 2 parameters, 1 given in %s on line %d
-
-Warning: intlgregcal_set_gregorian_change(): intlgregcal_set_gregorian_change: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intlgregcal_set_gregorian_change() must be an instance of IntlGregorianCalendar, int given in %s:%d
-Stack trace:
-#0 %s(%d): intlgregcal_set_gregorian_change(1, 4)
-#1 {main}
- thrown in %s on line %d
diff --git a/ext/intl/tests/idn_uts46_basic.phpt b/ext/intl/tests/idn_uts46_basic.phpt
index 881e8311c9..5178c08d6c 100644
--- a/ext/intl/tests/idn_uts46_basic.phpt
+++ b/ext/intl/tests/idn_uts46_basic.phpt
@@ -13,14 +13,14 @@ $asciiNonTrans = "www.xn--fuball-cta.com";
echo "all ok, no details:", "\n";
var_dump(idn_to_ascii($utf8dn,
- IDNA_NONTRANSITIONAL_TO_ASCII, INTL_IDNA_VARIANT_UTS46));
+ IDNA_NONTRANSITIONAL_TO_ASCII, INTL_IDNA_VARIANT_UTS46));
echo "all ok, no details, transitional:", "\n";
var_dump(idn_to_ascii($utf8dn, 0, INTL_IDNA_VARIANT_UTS46));
echo "all ok, with details:", "\n";
var_dump(idn_to_ascii($utf8dn, IDNA_NONTRANSITIONAL_TO_ASCII,
- INTL_IDNA_VARIANT_UTS46, $info));
+ INTL_IDNA_VARIANT_UTS46, $info));
var_dump($info);
echo "reverse, ok, with details:", "\n";
diff --git a/ext/intl/tests/idn_uts46_errors.phpt b/ext/intl/tests/idn_uts46_errors.phpt
index 6a99bde649..35aa1cb073 100644
--- a/ext/intl/tests/idn_uts46_errors.phpt
+++ b/ext/intl/tests/idn_uts46_errors.phpt
@@ -11,61 +11,39 @@ IDN UTS #46 API error tests
ini_set("intl.error_level", E_WARNING);
echo "=> PHP level errors", "\n";
-echo "bad args:", "\n";
-var_dump(idn_to_ascii("", 0, array()));
-var_dump(idn_to_ascii("", 0, INTL_IDNA_VARIANT_UTS46, $foo, null));
-
echo "bad variant:", "\n";
var_dump(idn_to_ascii("", 0, INTL_IDNA_VARIANT_UTS46 + 10));
echo "empty domain:", "\n";
var_dump(idn_to_ascii("", 0, INTL_IDNA_VARIANT_UTS46));
-echo "fourth arg for 2003 variant (only notice raised):", "\n";
-var_dump(idn_to_ascii("foo.com", 0, INTL_IDNA_VARIANT_2003, $foo));
-
echo "with error, but no details arg:", "\n";
var_dump(idn_to_ascii("www.fußball.com-", 0, INTL_IDNA_VARIANT_UTS46));
echo "with error, with details arg:", "\n";
var_dump(idn_to_ascii("www.fußball.com-", IDNA_NONTRANSITIONAL_TO_ASCII,
- INTL_IDNA_VARIANT_UTS46, $foo));
+ INTL_IDNA_VARIANT_UTS46, $foo));
var_dump($foo);
echo "with error, with details arg, contextj:", "\n";
var_dump(idn_to_ascii(
- html_entity_decode("www.a&#x200D;b.com", 0, "UTF-8"),
- IDNA_NONTRANSITIONAL_TO_ASCII | IDNA_CHECK_CONTEXTJ,
- INTL_IDNA_VARIANT_UTS46, $foo));
+ html_entity_decode("www.a&#x200D;b.com", 0, "UTF-8"),
+ IDNA_NONTRANSITIONAL_TO_ASCII | IDNA_CHECK_CONTEXTJ,
+ INTL_IDNA_VARIANT_UTS46, $foo));
var_dump($foo);
var_dump($foo["errors"]==IDNA_ERROR_CONTEXTJ);
+
+?>
--EXPECTF--
=> PHP level errors
-bad args:
-
-Warning: idn_to_ascii() expects parameter 3 to be int, array given in %s on line %d
-
-Warning: idn_to_ascii(): idn_to_ascii: bad arguments in %s on line %d
-NULL
-
-Warning: idn_to_ascii() expects at most 4 parameters, 5 given in %s on line %d
-
-Warning: idn_to_ascii(): idn_to_ascii: bad arguments in %s on line %d
-NULL
bad variant:
-Warning: idn_to_ascii(): idn_to_ascii: invalid variant, must be one of {INTL_IDNA_VARIANT_2003, INTL_IDNA_VARIANT_UTS46} in %s on line %d
+Warning: idn_to_ascii(): idn_to_ascii: invalid variant, must be INTL_IDNA_VARIANT_UTS46 in %s on line %d
bool(false)
empty domain:
Warning: idn_to_ascii(): idn_to_ascii: empty domain name in %s on line %d
bool(false)
-fourth arg for 2003 variant (only notice raised):
-
-Deprecated: idn_to_ascii(): INTL_IDNA_VARIANT_2003 is deprecated in %s on line %d
-
-Notice: idn_to_ascii(): 4 arguments were provided, but INTL_IDNA_VARIANT_2003 only takes 3 - extra argument ignored in %s on line %d
-string(7) "foo.com"
with error, but no details arg:
bool(false)
with error, with details arg:
diff --git a/ext/intl/tests/ini_use_exceptions_basic.phpt b/ext/intl/tests/ini_use_exceptions_basic.phpt
index 36ccbcb8a0..8945c130eb 100644
--- a/ext/intl/tests/ini_use_exceptions_basic.phpt
+++ b/ext/intl/tests/ini_use_exceptions_basic.phpt
@@ -7,9 +7,9 @@ intl.use_exceptions INI setting
ini_set("intl.use_exceptions", true);
$t = transliterator_create('any-hex');
try {
- var_dump($t->transliterate('a', 3));
+ var_dump($t->transliterate('a', 3));
} catch (IntlException $intlE) {
- var_dump($intlE->getMessage());
+ var_dump($intlE->getMessage());
}
ini_set("intl.use_exceptions", false);
ini_set("intl.error_level", E_NOTICE);
diff --git a/ext/intl/tests/intl_get_error_code.phpt b/ext/intl/tests/intl_get_error_code.phpt
index 6cd361ba71..797aee4fb7 100644
--- a/ext/intl/tests/intl_get_error_code.phpt
+++ b/ext/intl/tests/intl_get_error_code.phpt
@@ -11,7 +11,7 @@ intl_get_error_code()
// Suppress warning messages.
error_reporting( E_ERROR );
-if( collator_get_locale() !== false )
+if( collator_get_locale(new Collator('en_US'), -1) !== false )
echo "failed\n";
else
{
diff --git a/ext/intl/tests/intl_get_error_message.phpt b/ext/intl/tests/intl_get_error_message.phpt
index f81b5c03d5..e03fb80658 100644
--- a/ext/intl/tests/intl_get_error_message.phpt
+++ b/ext/intl/tests/intl_get_error_message.phpt
@@ -11,11 +11,11 @@ intl_get_error_message()
// Suppress warning messages.
error_reporting( E_ERROR );
-if( collator_get_locale() !== false )
+if( collator_get_locale(new Collator('en_US'), -1) !== false )
echo "failed\n";
else
printf( "%s\n", intl_get_error_message() );
?>
--EXPECT--
-collator_get_locale: unable to parse input params: U_ILLEGAL_ARGUMENT_ERROR
+Error getting locale by type: U_ILLEGAL_ARGUMENT_ERROR
diff --git a/ext/intl/tests/locale/bug74993.phpt b/ext/intl/tests/locale/bug74993.phpt
index 85d97ec78e..d8d8b9fada 100644
--- a/ext/intl/tests/locale/bug74993.phpt
+++ b/ext/intl/tests/locale/bug74993.phpt
@@ -22,52 +22,59 @@ foreach ($funcs as $func) {
Function [ <internal:intl> function locale_get_display_language ] {
- Parameters [2] {
- Parameter #0 [ <required> $locale ]
- Parameter #1 [ <optional> $in_locale ]
+ Parameter #0 [ <required> string $locale ]
+ Parameter #1 [ <optional> ?string $in_locale ]
}
+ - Return [ string|false ]
}
Function [ <internal:intl> function locale_get_display_name ] {
- Parameters [2] {
- Parameter #0 [ <required> $locale ]
- Parameter #1 [ <optional> $in_locale ]
+ Parameter #0 [ <required> string $locale ]
+ Parameter #1 [ <optional> ?string $in_locale ]
}
+ - Return [ string|false ]
}
Function [ <internal:intl> function locale_get_display_region ] {
- Parameters [2] {
- Parameter #0 [ <required> $locale ]
- Parameter #1 [ <optional> $in_locale ]
+ Parameter #0 [ <required> string $locale ]
+ Parameter #1 [ <optional> ?string $in_locale ]
}
+ - Return [ string|false ]
}
Function [ <internal:intl> function locale_get_display_script ] {
- Parameters [2] {
- Parameter #0 [ <required> $locale ]
- Parameter #1 [ <optional> $in_locale ]
+ Parameter #0 [ <required> string $locale ]
+ Parameter #1 [ <optional> ?string $in_locale ]
}
+ - Return [ string|false ]
}
Function [ <internal:intl> function locale_get_display_variant ] {
- Parameters [2] {
- Parameter #0 [ <required> $locale ]
- Parameter #1 [ <optional> $in_locale ]
+ Parameter #0 [ <required> string $locale ]
+ Parameter #1 [ <optional> ?string $in_locale ]
}
+ - Return [ string|false ]
}
Function [ <internal:intl> function locale_filter_matches ] {
- Parameters [3] {
- Parameter #0 [ <required> $langtag ]
- Parameter #1 [ <required> $locale ]
- Parameter #2 [ <optional> $canonicalize ]
+ Parameter #0 [ <required> string $langtag ]
+ Parameter #1 [ <required> string $locale ]
+ Parameter #2 [ <optional> bool $canonicalize ]
}
+ - Return [ ?bool ]
}
Function [ <internal:intl> function locale_lookup ] {
- Parameters [4] {
- Parameter #0 [ <required> $langtag ]
- Parameter #1 [ <required> $locale ]
- Parameter #2 [ <optional> $canonicalize ]
- Parameter #3 [ <optional> $def ]
+ Parameter #0 [ <required> array $langtag ]
+ Parameter #1 [ <required> string $locale ]
+ Parameter #2 [ <optional> bool $canonicalize ]
+ Parameter #3 [ <optional> ?string $def ]
}
+ - Return [ ?string ]
}
diff --git a/ext/intl/tests/locale_accept.phpt b/ext/intl/tests/locale_accept.phpt
index a2834d8ade..ad1f64e708 100644
--- a/ext/intl/tests/locale_accept.phpt
+++ b/ext/intl/tests/locale_accept.phpt
@@ -12,20 +12,19 @@ locale_accept_from_http
function ut_main()
{
- $res_str = "";
- $http_acc = array(
- 'en-us,en;q=0.5',
- 'da, en-gb;q=0.8, en;q=0.7',
- 'zh, en-us;q=0.8, en;q=0.7',
- 'xx, fr-FR;q=0.3, de-DE;q=0.5',
- 'none',
- array()
- );
+ $res_str = "";
+ $http_acc = array(
+ 'en-us,en;q=0.5',
+ 'da, en-gb;q=0.8, en;q=0.7',
+ 'zh, en-us;q=0.8, en;q=0.7',
+ 'xx, fr-FR;q=0.3, de-DE;q=0.5',
+ 'none',
+ );
foreach($http_acc as $http) {
- $res = ut_loc_accept_http($http);
- $res_str .= @"Accepting $http: $res\n";
- }
+ $res = ut_loc_accept_http($http);
+ $res_str .= @"Accepting $http: $res\n";
+ }
return $res_str;
}
@@ -34,13 +33,9 @@ include_once( 'ut_common.inc' );
ut_run();
?>
---EXPECTF--
-Warning: Locale::acceptFromHttp() expects parameter 1 to be string, array given in %s on line %d
-
-Warning: locale_accept_from_http() expects parameter 1 to be string, array given in %s on line %d
+--EXPECT--
Accepting en-us,en;q=0.5: en_US
Accepting da, en-gb;q=0.8, en;q=0.7: da
Accepting zh, en-us;q=0.8, en;q=0.7: zh
Accepting xx, fr-FR;q=0.3, de-DE;q=0.5: de_DE
Accepting none:
-Accepting Array:
diff --git a/ext/intl/tests/locale_bug66289.phpt b/ext/intl/tests/locale_bug66289.phpt
index 6afd821b5a..94c3398970 100644
--- a/ext/intl/tests/locale_bug66289.phpt
+++ b/ext/intl/tests/locale_bug66289.phpt
@@ -18,10 +18,8 @@ $availableLocales = array(Locale::getDefault());
var_dump(locale_lookup($availableLocales, false, true));
?>
-==DONE==
--EXPECT--
string(5) "fr_fr"
string(5) "en_us"
string(5) "fr_fr"
string(5) "de_de"
-==DONE==
diff --git a/ext/intl/tests/locale_bug72658.phpt b/ext/intl/tests/locale_bug72658.phpt
index 877f0b25f4..6ac8048406 100644
--- a/ext/intl/tests/locale_bug72658.phpt
+++ b/ext/intl/tests/locale_bug72658.phpt
@@ -6,13 +6,11 @@ Bug #72658 Locale::lookup() / locale_lookup() hangs if no match found
<?php
var_dump(
- Locale::lookup(['en-Latn-US', 'sl', 'sl-IT'], 'en-US', true, 'de-DE'),
- Locale::lookup(['en-Latn-US', 'sl', 'sl-IT'], 'en-US', false, 'de-DE')
+ Locale::lookup(['en-Latn-US', 'sl', 'sl-IT'], 'en-US', true, 'de-DE'),
+ Locale::lookup(['en-Latn-US', 'sl', 'sl-IT'], 'en-US', false, 'de-DE')
);
?>
-==DONE==
--EXPECT--
string(5) "de-DE"
string(5) "de-DE"
-==DONE==
diff --git a/ext/intl/tests/locale_bug74439.phpt b/ext/intl/tests/locale_bug74439.phpt
index 24407ada82..de85db3121 100644
--- a/ext/intl/tests/locale_bug74439.phpt
+++ b/ext/intl/tests/locale_bug74439.phpt
@@ -31,7 +31,6 @@ foreach ($methods as $method) {
printf("%s: %d, %d\n", $method, $rm->getNumberOfParameters(), $rm->getNumberOfRequiredParameters());
}
?>
-===DONE===
--EXPECT--
getDefault: 0, 0
acceptFromHttp: 1, 1
@@ -51,4 +50,3 @@ getDisplayScript: 2, 1
getDisplayVariant: 2, 1
filterMatches: 3, 2
lookup: 4, 2
-===DONE===
diff --git a/ext/intl/tests/locale_compose_locale.phpt b/ext/intl/tests/locale_compose_locale.phpt
index 5eef05b3e6..e09e104c85 100644
--- a/ext/intl/tests/locale_compose_locale.phpt
+++ b/ext/intl/tests/locale_compose_locale.phpt
@@ -12,120 +12,120 @@ locale_compose_locale()
function ut_main()
{
- $loc_parts_arr1 = array(
- Locale::LANG_TAG =>'sl' ,
- Locale::SCRIPT_TAG =>'Latn' ,
- Locale::REGION_TAG =>'IT'
- );
- $loc_parts_arr2 = array(
- Locale::LANG_TAG =>'de' ,
- Locale::REGION_TAG =>'DE'
- );
- $loc_parts_arr3 = array(
- Locale::LANG_TAG =>'hi'
- );
- $loc_parts_arr4 = array(
- Locale::LANG_TAG =>'zh' ,
- Locale::SCRIPT_TAG =>'Hans' ,
- Locale::REGION_TAG =>'CN'
- );
- $loc_parts_arr5 = array(
- Locale::LANG_TAG =>'es' ,
- Locale::SCRIPT_TAG =>'Hans' ,
- Locale::REGION_TAG =>'CN'
- );
- $loc_parts_arr6 = array(
- Locale::LANG_TAG =>'en' ,
- Locale::SCRIPT_TAG =>'Hans' ,
- Locale::REGION_TAG =>'CN',
- Locale::VARIANT_TAG.'14' =>'rozaj' ,
- 'variant1'=>'nedis'
- );
- $loc_parts_arr7 = array(
- Locale::LANG_TAG =>'en' ,
- Locale::SCRIPT_TAG =>'Hans' ,
- Locale::REGION_TAG =>'CN',
- 'variant14'=>'rozaj' ,
- 'variant1'=>'nedis' ,
- 'extlang0'=>'lng' ,
- 'extlang1'=>'ing'
- );
- $loc_parts_arr8 = array(
- Locale::LANG_TAG =>'en' ,
- Locale::SCRIPT_TAG =>'Hans' ,
- Locale::REGION_TAG =>'CN',
- 'variant14'=>'rozaj' ,
- 'variant1'=>'nedis' ,
- 'extlang0'=>'lng' ,
- 'extlang1'=>'ing',
- 'private7'=>'prv1' ,
- 'private9'=>'prv2'
- );
- $loc_parts_arr9 = array(
- Locale::REGION_TAG =>'DE'
- );
- $loc_parts_arr10 = array(
- Locale::LANG_TAG => 45,
- Locale::REGION_TAG => false,
- Locale::SCRIPT_TAG => 15
- );
- $loc_parts_arr11 = array(
- Locale::LANG_TAG =>'de' ,
- Locale::REGION_TAG =>'DE',
- 'private0' => 13,
- 'variant1' => array(),
- 'extlang2' => false
- );
+ $loc_parts_arr1 = array(
+ Locale::LANG_TAG =>'sl' ,
+ Locale::SCRIPT_TAG =>'Latn' ,
+ Locale::REGION_TAG =>'IT'
+ );
+ $loc_parts_arr2 = array(
+ Locale::LANG_TAG =>'de' ,
+ Locale::REGION_TAG =>'DE'
+ );
+ $loc_parts_arr3 = array(
+ Locale::LANG_TAG =>'hi'
+ );
+ $loc_parts_arr4 = array(
+ Locale::LANG_TAG =>'zh' ,
+ Locale::SCRIPT_TAG =>'Hans' ,
+ Locale::REGION_TAG =>'CN'
+ );
+ $loc_parts_arr5 = array(
+ Locale::LANG_TAG =>'es' ,
+ Locale::SCRIPT_TAG =>'Hans' ,
+ Locale::REGION_TAG =>'CN'
+ );
+ $loc_parts_arr6 = array(
+ Locale::LANG_TAG =>'en' ,
+ Locale::SCRIPT_TAG =>'Hans' ,
+ Locale::REGION_TAG =>'CN',
+ Locale::VARIANT_TAG.'14' =>'rozaj' ,
+ 'variant1'=>'nedis'
+ );
+ $loc_parts_arr7 = array(
+ Locale::LANG_TAG =>'en' ,
+ Locale::SCRIPT_TAG =>'Hans' ,
+ Locale::REGION_TAG =>'CN',
+ 'variant14'=>'rozaj' ,
+ 'variant1'=>'nedis' ,
+ 'extlang0'=>'lng' ,
+ 'extlang1'=>'ing'
+ );
+ $loc_parts_arr8 = array(
+ Locale::LANG_TAG =>'en' ,
+ Locale::SCRIPT_TAG =>'Hans' ,
+ Locale::REGION_TAG =>'CN',
+ 'variant14'=>'rozaj' ,
+ 'variant1'=>'nedis' ,
+ 'extlang0'=>'lng' ,
+ 'extlang1'=>'ing',
+ 'private7'=>'prv1' ,
+ 'private9'=>'prv2'
+ );
+ $loc_parts_arr9 = array(
+ Locale::REGION_TAG =>'DE'
+ );
+ $loc_parts_arr10 = array(
+ Locale::LANG_TAG => 45,
+ Locale::REGION_TAG => false,
+ Locale::SCRIPT_TAG => 15
+ );
+ $loc_parts_arr11 = array(
+ Locale::LANG_TAG =>'de' ,
+ Locale::REGION_TAG =>'DE',
+ 'private0' => 13,
+ 'variant1' => array(),
+ 'extlang2' => false
+ );
$loc_parts_arr12 = array(
Locale::LANG_TAG =>'en' ,
Locale::SCRIPT_TAG =>'Hans' ,
Locale::REGION_TAG =>'CN',
Locale::VARIANT_TAG => array('nedis', 'rozaj'),
- Locale::PRIVATE_TAG => array('prv1', 'prv2'),
- Locale::EXTLANG_TAG => array('lng', 'ing')
+ Locale::PRIVATE_TAG => array('prv1', 'prv2'),
+ Locale::EXTLANG_TAG => array('lng', 'ing')
);
- $loc_parts_arr = array(
- 'loc1' => $loc_parts_arr1 ,
- 'loc2' => $loc_parts_arr2 ,
- 'loc3' => $loc_parts_arr3 ,
- 'loc4' => $loc_parts_arr4 ,
- 'loc5' => $loc_parts_arr5 ,
- 'loc6' => $loc_parts_arr6 ,
- 'loc7' => $loc_parts_arr7 ,
- 'loc8' => $loc_parts_arr8 ,
- 'loc9' => $loc_parts_arr9 ,
- 'loc10' => $loc_parts_arr10 ,
- 'loc11' => $loc_parts_arr11 ,
- 'loc12' => $loc_parts_arr12
- );
+ $loc_parts_arr = array(
+ 'loc1' => $loc_parts_arr1 ,
+ 'loc2' => $loc_parts_arr2 ,
+ 'loc3' => $loc_parts_arr3 ,
+ 'loc4' => $loc_parts_arr4 ,
+ 'loc5' => $loc_parts_arr5 ,
+ 'loc6' => $loc_parts_arr6 ,
+ 'loc7' => $loc_parts_arr7 ,
+ 'loc8' => $loc_parts_arr8 ,
+ 'loc9' => $loc_parts_arr9 ,
+ 'loc10' => $loc_parts_arr10 ,
+ 'loc11' => $loc_parts_arr11 ,
+ 'loc12' => $loc_parts_arr12
+ );
error_reporting( E_ERROR );
$cnt = 0;
$res_str = '';
- foreach($loc_parts_arr as $key => $value ){
- $res_str .= "\n------------";
- $res_str .= "\nInput Array name is : loc".(++$cnt) ;
+ foreach($loc_parts_arr as $key => $value ){
+ $res_str .= "\n------------";
+ $res_str .= "\nInput Array name is : loc".(++$cnt) ;
/*
- foreach($value as $valKey => $valValue ){
- $res_str .= $valKey ."->".$valValue." " ;
- }
+ foreach($value as $valKey => $valValue ){
+ $res_str .= $valKey ."->".$valValue." " ;
+ }
*/
- $locale = ut_loc_locale_compose( $value);
- $res_str .= "\n\nComposed Locale: ";
- if( $locale){
- $res_str .= "$locale";
- }else{
- $res_str .= "No values found from Locale compose due to the following error:\n";
- $res_str .= intl_get_error_message() ;
- }
- }
-
- $res_str .= "\n------------";
- $res_str .= "\n";
+ $locale = ut_loc_locale_compose( $value);
+ $res_str .= "\n\nComposed Locale: ";
+ if( $locale){
+ $res_str .= "$locale";
+ }else{
+ $res_str .= "No values found from Locale compose due to the following error:\n";
+ $res_str .= intl_get_error_message() ;
+ }
+ }
+
+ $res_str .= "\n------------";
+ $res_str .= "\n";
return $res_str;
}
diff --git a/ext/intl/tests/locale_filter_matches2.phpt b/ext/intl/tests/locale_filter_matches2.phpt
index e75079deb3..82e16dafce 100644
--- a/ext/intl/tests/locale_filter_matches2.phpt
+++ b/ext/intl/tests/locale_filter_matches2.phpt
@@ -13,60 +13,60 @@ locale_filter_matches.phpt() icu >= 4.8 && icu < 50.1.2
function ut_main()
{
- $loc_ranges = array(
- 'de-de',
- 'sl_IT',
- 'sl_IT_Nedis',
- 'jbo',
- 'art-lojban',
- 'sl_IT'
- );
+ $loc_ranges = array(
+ 'de-de',
+ 'sl_IT',
+ 'sl_IT_Nedis',
+ 'jbo',
+ 'art-lojban',
+ 'sl_IT'
+ );
- $lang_tags = array(
- 'de-DEVA',
- 'de-DE-1996',
- 'de-DE',
- 'zh_Hans',
- 'de-CH-1996',
- 'sl_IT',
- 'sl_IT_nedis-a-kirti-x-xyz',
- 'sl_IT_rozaj',
- 'sl_IT_NEDIS_ROJAZ_1901',
- 'i-enochian',
- 'sgn-CH-de',
- 'art-lojban',
- 'i-lux',
- 'art-lojban',
- 'jbo',
- 'en_sl_IT'
- );
+ $lang_tags = array(
+ 'de-DEVA',
+ 'de-DE-1996',
+ 'de-DE',
+ 'zh_Hans',
+ 'de-CH-1996',
+ 'sl_IT',
+ 'sl_IT_nedis-a-kirti-x-xyz',
+ 'sl_IT_rozaj',
+ 'sl_IT_NEDIS_ROJAZ_1901',
+ 'i-enochian',
+ 'sgn-CH-de',
+ 'art-lojban',
+ 'i-lux',
+ 'art-lojban',
+ 'jbo',
+ 'en_sl_IT'
+ );
$res_str = '';
$isCanonical = false;
- foreach($loc_ranges as $loc_range){
- foreach($lang_tags as $lang_tag){
- $res_str .="--------------\n";
- $result= ut_loc_locale_filter_matches( $lang_tag , $loc_range , $isCanonical);
- $res_str .= "loc_range:$loc_range matches lang_tag $lang_tag ? ";
- if( $result){
- $res_str .= "YES\n";
- }else{
- $res_str .= "NO\n";
- }
+ foreach($loc_ranges as $loc_range){
+ foreach($lang_tags as $lang_tag){
+ $res_str .="--------------\n";
+ $result= ut_loc_locale_filter_matches( $lang_tag , $loc_range , $isCanonical);
+ $res_str .= "loc_range:$loc_range matches lang_tag $lang_tag ? ";
+ if( $result){
+ $res_str .= "YES\n";
+ }else{
+ $res_str .= "NO\n";
+ }
//canonicalized version
- $result= ut_loc_locale_filter_matches( $lang_tag , $loc_range , !($isCanonical));
- $can_loc_range = ut_loc_canonicalize($loc_range);
- $can_lang_tag = ut_loc_canonicalize($lang_tag);
- $res_str .= "loc_range:$can_loc_range canonically matches lang_tag $can_lang_tag ? ";
- if( $result){
- $res_str .= "YES\n";
- }else{
- $res_str .= "NO\n";
- }
- }
- }
+ $result= ut_loc_locale_filter_matches( $lang_tag , $loc_range , !($isCanonical));
+ $can_loc_range = ut_loc_canonicalize($loc_range);
+ $can_lang_tag = ut_loc_canonicalize($lang_tag);
+ $res_str .= "loc_range:$can_loc_range canonically matches lang_tag $can_lang_tag ? ";
+ if( $result){
+ $res_str .= "YES\n";
+ }else{
+ $res_str .= "NO\n";
+ }
+ }
+ }
- $res_str .= "\n";
+ $res_str .= "\n";
return $res_str;
}
diff --git a/ext/intl/tests/locale_filter_matches3.phpt b/ext/intl/tests/locale_filter_matches3.phpt
index 2816ba5e12..703ba78154 100644
--- a/ext/intl/tests/locale_filter_matches3.phpt
+++ b/ext/intl/tests/locale_filter_matches3.phpt
@@ -13,60 +13,60 @@ locale_filter_matches.phpt() ICU >= 51.2
function ut_main()
{
- $loc_ranges = array(
- 'de-de',
- 'sl_IT',
- 'sl_IT_Nedis',
- 'jbo',
- 'art-lojban',
- 'sl_IT'
- );
+ $loc_ranges = array(
+ 'de-de',
+ 'sl_IT',
+ 'sl_IT_Nedis',
+ 'jbo',
+ 'art-lojban',
+ 'sl_IT'
+ );
- $lang_tags = array(
- 'de-DEVA',
- 'de-DE-1996',
- 'de-DE',
- 'zh_Hans',
- 'de-CH-1996',
- 'sl_IT',
- 'sl_IT_nedis-a-kirti-x-xyz',
- 'sl_IT_rozaj',
- 'sl_IT_NEDIS_ROJAZ_1901',
- 'i-enochian',
- 'sgn-CH-de',
- 'art-lojban',
- 'i-lux',
- 'art-lojban',
- 'jbo',
- 'en_sl_IT'
- );
+ $lang_tags = array(
+ 'de-DEVA',
+ 'de-DE-1996',
+ 'de-DE',
+ 'zh_Hans',
+ 'de-CH-1996',
+ 'sl_IT',
+ 'sl_IT_nedis-a-kirti-x-xyz',
+ 'sl_IT_rozaj',
+ 'sl_IT_NEDIS_ROJAZ_1901',
+ 'i-enochian',
+ 'sgn-CH-de',
+ 'art-lojban',
+ 'i-lux',
+ 'art-lojban',
+ 'jbo',
+ 'en_sl_IT'
+ );
$res_str = '';
$isCanonical = false;
- foreach($loc_ranges as $loc_range){
- foreach($lang_tags as $lang_tag){
- $res_str .="--------------\n";
- $result= ut_loc_locale_filter_matches( $lang_tag , $loc_range , $isCanonical);
- $res_str .= "loc_range:$loc_range matches lang_tag $lang_tag ? ";
- if( $result){
- $res_str .= "YES\n";
- }else{
- $res_str .= "NO\n";
- }
+ foreach($loc_ranges as $loc_range){
+ foreach($lang_tags as $lang_tag){
+ $res_str .="--------------\n";
+ $result= ut_loc_locale_filter_matches( $lang_tag , $loc_range , $isCanonical);
+ $res_str .= "loc_range:$loc_range matches lang_tag $lang_tag ? ";
+ if( $result){
+ $res_str .= "YES\n";
+ }else{
+ $res_str .= "NO\n";
+ }
//canonicalized version
- $result= ut_loc_locale_filter_matches( $lang_tag , $loc_range , !($isCanonical));
- $can_loc_range = ut_loc_canonicalize($loc_range);
- $can_lang_tag = ut_loc_canonicalize($lang_tag);
- $res_str .= "loc_range:$can_loc_range canonically matches lang_tag $can_lang_tag ? ";
- if( $result){
- $res_str .= "YES\n";
- }else{
- $res_str .= "NO\n";
- }
- }
- }
+ $result= ut_loc_locale_filter_matches( $lang_tag , $loc_range , !($isCanonical));
+ $can_loc_range = ut_loc_canonicalize($loc_range);
+ $can_lang_tag = ut_loc_canonicalize($lang_tag);
+ $res_str .= "loc_range:$can_loc_range canonically matches lang_tag $can_lang_tag ? ";
+ if( $result){
+ $res_str .= "YES\n";
+ }else{
+ $res_str .= "NO\n";
+ }
+ }
+ }
- $res_str .= "\n";
+ $res_str .= "\n";
return $res_str;
}
diff --git a/ext/intl/tests/locale_get_all_variants.phpt b/ext/intl/tests/locale_get_all_variants.phpt
index 8f2bcbfa39..7807e2b09a 100644
--- a/ext/intl/tests/locale_get_all_variants.phpt
+++ b/ext/intl/tests/locale_get_all_variants.phpt
@@ -12,34 +12,34 @@ locale_get_all_variants.phpt()
function ut_main()
{
- $locales = array(
- 'sl_IT_nedis_KIRTI',
- 'sl_IT_nedis-a-kirti-x-xyz',
- 'sl_IT_rozaj',
- 'sl_IT_NEDIS_ROJAZ_1901',
- 'i-enochian',
- 'zh-hakka',
- 'zh-wuu',
- 'i-tay',
- 'sgn-BE-nl',
- 'sgn-CH-de',
- 'sl_IT_rozaj@currency=EUR'
- );
+ $locales = array(
+ 'sl_IT_nedis_KIRTI',
+ 'sl_IT_nedis-a-kirti-x-xyz',
+ 'sl_IT_rozaj',
+ 'sl_IT_NEDIS_ROJAZ_1901',
+ 'i-enochian',
+ 'zh-hakka',
+ 'zh-wuu',
+ 'i-tay',
+ 'sgn-BE-nl',
+ 'sgn-CH-de',
+ 'sl_IT_rozaj@currency=EUR'
+ );
$res_str = '';
- foreach($locales as $locale){
- $variants_arr = ut_loc_locale_get_all_variants( $locale);
- $res_str .= "$locale : variants ";
- if( $variants_arr){
- foreach($variants_arr as $variant){
- $res_str .= "'$variant',";
- }
- }else{
- $res_str .= "--none";
- }
- $res_str .= "\n";
- }
+ foreach($locales as $locale){
+ $variants_arr = ut_loc_locale_get_all_variants( $locale);
+ $res_str .= "$locale : variants ";
+ if( $variants_arr){
+ foreach($variants_arr as $variant){
+ $res_str .= "'$variant',";
+ }
+ }else{
+ $res_str .= "--none";
+ }
+ $res_str .= "\n";
+ }
- $res_str .= "\n";
+ $res_str .= "\n";
return $res_str;
}
diff --git a/ext/intl/tests/locale_get_display_language.phpt b/ext/intl/tests/locale_get_display_language.phpt
index 2df91ba71d..e441b2efc6 100644
--- a/ext/intl/tests/locale_get_display_language.phpt
+++ b/ext/intl/tests/locale_get_display_language.phpt
@@ -14,7 +14,7 @@ function ut_main()
{
$res_str='';
- $disp_locales=array('en','fr','de');
+ $disp_locales=array('en','fr','de');
$locales = array(
'uk-ua_CALIFORNIA@currency=;currency=GRN',
@@ -72,15 +72,15 @@ function ut_main()
$res_str = '';
- foreach( $locales as $locale )
+ foreach( $locales as $locale )
{
- $res_str .= "locale='$locale'\n";
- foreach( $disp_locales as $disp_locale )
- {
- $scr = ut_loc_get_display_language( $locale ,$disp_locale );
- $res_str .= "disp_locale=$disp_locale : display_language=$scr";
- $res_str .= "\n";
- }
+ $res_str .= "locale='$locale'\n";
+ foreach( $disp_locales as $disp_locale )
+ {
+ $scr = ut_loc_get_display_language( $locale ,$disp_locale );
+ $res_str .= "disp_locale=$disp_locale : display_language=$scr";
+ $res_str .= "\n";
+ }
$res_str .= "-----------------\n";
}
diff --git a/ext/intl/tests/locale_get_display_name2.phpt b/ext/intl/tests/locale_get_display_name2.phpt
index 313e89b3c0..1d16dd023b 100644
--- a/ext/intl/tests/locale_get_display_name2.phpt
+++ b/ext/intl/tests/locale_get_display_name2.phpt
@@ -15,7 +15,7 @@ function ut_main()
{
$res_str='';
- $disp_locales=array('en','fr','de');
+ $disp_locales=array('en','fr','de');
$locales = array(
'sl_IT_nedis_KIRTI',
@@ -83,16 +83,16 @@ function ut_main()
$res_str = '';
- foreach( $locales as $locale )
+ foreach( $locales as $locale )
{
- $res_str .= "locale='$locale'\n";
- foreach( $disp_locales as $disp_locale )
- {
- $scr = ut_loc_get_display_name( $locale ,$disp_locale );
- $scr = str_replace(array('(', ')'), '#', $scr);
- $res_str .= "disp_locale=$disp_locale : display_name=$scr";
- $res_str .= "\n";
- }
+ $res_str .= "locale='$locale'\n";
+ foreach( $disp_locales as $disp_locale )
+ {
+ $scr = ut_loc_get_display_name( $locale ,$disp_locale );
+ $scr = str_replace(array('(', ')'), '#', $scr);
+ $res_str .= "disp_locale=$disp_locale : display_name=$scr";
+ $res_str .= "\n";
+ }
$res_str .= "-----------------\n";
}
diff --git a/ext/intl/tests/locale_get_display_name3.phpt b/ext/intl/tests/locale_get_display_name3.phpt
index 2052a6d456..d0c2307288 100644
--- a/ext/intl/tests/locale_get_display_name3.phpt
+++ b/ext/intl/tests/locale_get_display_name3.phpt
@@ -15,7 +15,7 @@ function ut_main()
{
$res_str='';
- $disp_locales=array('en','fr','de');
+ $disp_locales=array('en','fr','de');
$locales = array(
'sl_IT_nedis_KIRTI',
@@ -83,16 +83,16 @@ function ut_main()
$res_str = '';
- foreach( $locales as $locale )
+ foreach( $locales as $locale )
{
- $res_str .= "locale='$locale'\n";
- foreach( $disp_locales as $disp_locale )
- {
- $scr = ut_loc_get_display_name( $locale ,$disp_locale );
- $scr = str_replace(array('(', ')'), '#', $scr);
- $res_str .= "disp_locale=$disp_locale : display_name=$scr";
- $res_str .= "\n";
- }
+ $res_str .= "locale='$locale'\n";
+ foreach( $disp_locales as $disp_locale )
+ {
+ $scr = ut_loc_get_display_name( $locale ,$disp_locale );
+ $scr = str_replace(array('(', ')'), '#', $scr);
+ $res_str .= "disp_locale=$disp_locale : display_name=$scr";
+ $res_str .= "\n";
+ }
$res_str .= "-----------------\n";
}
diff --git a/ext/intl/tests/locale_get_display_name4.phpt b/ext/intl/tests/locale_get_display_name4.phpt
index a0b40a4114..e431b25151 100644
--- a/ext/intl/tests/locale_get_display_name4.phpt
+++ b/ext/intl/tests/locale_get_display_name4.phpt
@@ -16,7 +16,7 @@ function ut_main()
{
$res_str='';
- $disp_locales=array('en','fr','de');
+ $disp_locales=array('en','fr','de');
$locales = array(
'sl_IT_nedis_KIRTI',
@@ -84,16 +84,16 @@ function ut_main()
$res_str = '';
- foreach( $locales as $locale )
+ foreach( $locales as $locale )
{
- $res_str .= "locale='$locale'\n";
- foreach( $disp_locales as $disp_locale )
- {
- $scr = ut_loc_get_display_name( $locale ,$disp_locale );
- $scr = str_replace(array('(', ')'), '#', $scr);
- $res_str .= "disp_locale=$disp_locale : display_name=$scr";
- $res_str .= "\n";
- }
+ $res_str .= "locale='$locale'\n";
+ foreach( $disp_locales as $disp_locale )
+ {
+ $scr = ut_loc_get_display_name( $locale ,$disp_locale );
+ $scr = str_replace(array('(', ')'), '#', $scr);
+ $res_str .= "disp_locale=$disp_locale : display_name=$scr";
+ $res_str .= "\n";
+ }
$res_str .= "-----------------\n";
}
diff --git a/ext/intl/tests/locale_get_display_name5.phpt b/ext/intl/tests/locale_get_display_name5.phpt
index ac64fee021..9f4e1b645c 100644
--- a/ext/intl/tests/locale_get_display_name5.phpt
+++ b/ext/intl/tests/locale_get_display_name5.phpt
@@ -16,7 +16,7 @@ function ut_main()
{
$res_str='';
- $disp_locales=array('en','fr','de');
+ $disp_locales=array('en','fr','de');
$locales = array(
'sl_IT_nedis_KIRTI',
@@ -84,16 +84,16 @@ function ut_main()
$res_str = '';
- foreach( $locales as $locale )
+ foreach( $locales as $locale )
{
- $res_str .= "locale='$locale'\n";
- foreach( $disp_locales as $disp_locale )
- {
- $scr = ut_loc_get_display_name( $locale ,$disp_locale );
- $scr = str_replace(array('(', ')'), '#', $scr);
- $res_str .= "disp_locale=$disp_locale : display_name=$scr";
- $res_str .= "\n";
- }
+ $res_str .= "locale='$locale'\n";
+ foreach( $disp_locales as $disp_locale )
+ {
+ $scr = ut_loc_get_display_name( $locale ,$disp_locale );
+ $scr = str_replace(array('(', ')'), '#', $scr);
+ $res_str .= "disp_locale=$disp_locale : display_name=$scr";
+ $res_str .= "\n";
+ }
$res_str .= "-----------------\n";
}
diff --git a/ext/intl/tests/locale_get_display_name6.phpt b/ext/intl/tests/locale_get_display_name6.phpt
index 9d0542c3d4..a00464e73e 100644
--- a/ext/intl/tests/locale_get_display_name6.phpt
+++ b/ext/intl/tests/locale_get_display_name6.phpt
@@ -16,7 +16,7 @@ function ut_main()
{
$res_str='';
- $disp_locales=array('en','fr','de');
+ $disp_locales=array('en','fr','de');
$locales = array(
'sl_IT_nedis_KIRTI',
@@ -84,16 +84,16 @@ function ut_main()
$res_str = '';
- foreach( $locales as $locale )
+ foreach( $locales as $locale )
{
- $res_str .= "locale='$locale'\n";
- foreach( $disp_locales as $disp_locale )
- {
- $scr = ut_loc_get_display_name( $locale ,$disp_locale );
- $scr = str_replace(array('(', ')'), '#', $scr);
- $res_str .= "disp_locale=$disp_locale : display_name=$scr";
- $res_str .= "\n";
- }
+ $res_str .= "locale='$locale'\n";
+ foreach( $disp_locales as $disp_locale )
+ {
+ $scr = ut_loc_get_display_name( $locale ,$disp_locale );
+ $scr = str_replace(array('(', ')'), '#', $scr);
+ $res_str .= "disp_locale=$disp_locale : display_name=$scr";
+ $res_str .= "\n";
+ }
$res_str .= "-----------------\n";
}
diff --git a/ext/intl/tests/locale_get_display_name7.phpt b/ext/intl/tests/locale_get_display_name7.phpt
index 91e2c92e87..8ef0c09241 100644
--- a/ext/intl/tests/locale_get_display_name7.phpt
+++ b/ext/intl/tests/locale_get_display_name7.phpt
@@ -15,7 +15,7 @@ function ut_main()
{
$res_str='';
- $disp_locales=array('en','fr','de');
+ $disp_locales=array('en','fr','de');
$locales = array(
'sl_IT_nedis_KIRTI',
@@ -83,16 +83,16 @@ function ut_main()
$res_str = '';
- foreach( $locales as $locale )
+ foreach( $locales as $locale )
{
- $res_str .= "locale='$locale'\n";
- foreach( $disp_locales as $disp_locale )
- {
- $scr = ut_loc_get_display_name( $locale ,$disp_locale );
- $scr = str_replace(array('(', ')'), '#', $scr);
- $res_str .= "disp_locale=$disp_locale : display_name=$scr";
- $res_str .= "\n";
- }
+ $res_str .= "locale='$locale'\n";
+ foreach( $disp_locales as $disp_locale )
+ {
+ $scr = ut_loc_get_display_name( $locale ,$disp_locale );
+ $scr = str_replace(array('(', ')'), '#', $scr);
+ $res_str .= "disp_locale=$disp_locale : display_name=$scr";
+ $res_str .= "\n";
+ }
$res_str .= "-----------------\n";
}
diff --git a/ext/intl/tests/locale_get_keywords2.phpt b/ext/intl/tests/locale_get_keywords2.phpt
index 23a099b4ed..8d6f3d113b 100644
--- a/ext/intl/tests/locale_get_keywords2.phpt
+++ b/ext/intl/tests/locale_get_keywords2.phpt
@@ -15,12 +15,12 @@ function ut_main()
$res_str = '';
$locales = array(
- "de_DE@currency=EUR;collation=PHONEBOOK",
+ "de_DE@currency=EUR;collation=PHONEBOOK",
'uk-ua_CALIFORNIA@currency=GRN'
- );
+ );
$locales = array(
- 'de_DE@currency=EUR;collation=PHONEBOOK',
+ 'de_DE@currency=EUR;collation=PHONEBOOK',
'root',
'uk@currency=EURO',
'Hindi',
@@ -77,14 +77,14 @@ function ut_main()
{
$keywords_arr = ut_loc_get_keywords( $locale);
$res_str .= "$locale: ";
- if( $keywords_arr){
- foreach( $keywords_arr as $key => $value){
- $res_str .= "Key is $key and Value is $value \n";
- }
- }
- else{
- $res_str .= "No keywords found.";
- }
+ if( $keywords_arr){
+ foreach( $keywords_arr as $key => $value){
+ $res_str .= "Key is $key and Value is $value \n";
+ }
+ }
+ else{
+ $res_str .= "No keywords found.";
+ }
$res_str .= "\n";
}
diff --git a/ext/intl/tests/locale_get_primary_language.phpt b/ext/intl/tests/locale_get_primary_language.phpt
index 65ec3d89bc..69201e8de2 100644
--- a/ext/intl/tests/locale_get_primary_language.phpt
+++ b/ext/intl/tests/locale_get_primary_language.phpt
@@ -16,14 +16,14 @@ function ut_main()
$locales = array(
'uk-ua_CALIFORNIA@currency=;currency=GRN',
- 'root',
+ 'root',
'uk@currency=EURO',
'Hindi',
//Simple language subtag
'de',
'fr',
'ja',
- 'i-enochian', //(example of a grandfathered tag)
+ 'i-enochian', //(example of a grandfathered tag)
//Language subtag plus Script subtag:
'zh-Hant',
'zh-Hans',
diff --git a/ext/intl/tests/locale_lookup.phpt b/ext/intl/tests/locale_lookup.phpt
index 9d4843038d..da67b390fa 100644
--- a/ext/intl/tests/locale_lookup.phpt
+++ b/ext/intl/tests/locale_lookup.phpt
@@ -13,39 +13,39 @@ locale_lookup.phpt() icu >= 4.8 && icu < 50.1.2
function ut_main()
{
- $loc_ranges = array(
- 'de-de',
- 'sl_IT',
- 'sl_IT_Nedis',
- 'jbo',
- 'art-lojban'
- );
-
- $lang_tags = array(
- 'de-DEVA',
- 'de-DE-1996',
- 'de-DE',
- 'zh_Hans',
- 'de-CH-1996',
- 'sl_IT',
- 'sl_IT_nedis-a-kirti-x-xyz',
- 'sl_IT_rozaj',
- 'sl_IT_NEDIS_ROJAZ_1901',
- 'i-enochian',
- 'sgn-CH-de',
- 'art-lojban',
- 'i-lux',
- 'art-lojban',
- 'jbo',
- 'en_sl_IT',
- 'zh-Hant-CN-x-prv1-prv2'
- );
+ $loc_ranges = array(
+ 'de-de',
+ 'sl_IT',
+ 'sl_IT_Nedis',
+ 'jbo',
+ 'art-lojban'
+ );
+
+ $lang_tags = array(
+ 'de-DEVA',
+ 'de-DE-1996',
+ 'de-DE',
+ 'zh_Hans',
+ 'de-CH-1996',
+ 'sl_IT',
+ 'sl_IT_nedis-a-kirti-x-xyz',
+ 'sl_IT_rozaj',
+ 'sl_IT_NEDIS_ROJAZ_1901',
+ 'i-enochian',
+ 'sgn-CH-de',
+ 'art-lojban',
+ 'i-lux',
+ 'art-lojban',
+ 'jbo',
+ 'en_sl_IT',
+ 'zh-Hant-CN-x-prv1-prv2'
+ );
$res_str = '';
$isCanonical = false;
- foreach($loc_ranges as $loc_range){
+ foreach($loc_ranges as $loc_range){
$res_str .="--------------\n";
$result= ut_loc_locale_lookup( $lang_tags , $loc_range,$isCanonical,"en_US");
$comma_arr =implode(",",$lang_tags);
@@ -56,9 +56,9 @@ function ut_main()
$can_loc_range = ut_loc_canonicalize($loc_range);
$res_str .= "Canonical lookup result:$result\n";
- }
+ }
- $res_str .= "\n";
+ $res_str .= "\n";
return $res_str;
}
diff --git a/ext/intl/tests/locale_lookup_variant2.phpt b/ext/intl/tests/locale_lookup_variant2.phpt
index 75a5350abf..7375284a0b 100644
--- a/ext/intl/tests/locale_lookup_variant2.phpt
+++ b/ext/intl/tests/locale_lookup_variant2.phpt
@@ -13,39 +13,39 @@ locale_lookup.phpt()
function ut_main()
{
- $loc_ranges = array(
- 'de-de',
- 'sl_IT',
- 'sl_IT_Nedis',
- 'jbo',
- 'art-lojban'
- );
-
- $lang_tags = array(
- 'de-DEVA',
- 'de-DE-1996',
- 'de-DE',
- 'zh_Hans',
- 'de-CH-1996',
- 'sl_IT',
- 'sl_IT_nedis-a-kirti-x-xyz',
- 'sl_IT_rozaj',
- 'sl_IT_NEDIS_ROJAZ_1901',
- 'i-enochian',
- 'sgn-CH-de',
- 'art-lojban',
- 'i-lux',
- 'art-lojban',
- 'jbo',
- 'en_sl_IT',
- 'zh-Hant-CN-x-prv1-prv2'
- );
+ $loc_ranges = array(
+ 'de-de',
+ 'sl_IT',
+ 'sl_IT_Nedis',
+ 'jbo',
+ 'art-lojban'
+ );
+
+ $lang_tags = array(
+ 'de-DEVA',
+ 'de-DE-1996',
+ 'de-DE',
+ 'zh_Hans',
+ 'de-CH-1996',
+ 'sl_IT',
+ 'sl_IT_nedis-a-kirti-x-xyz',
+ 'sl_IT_rozaj',
+ 'sl_IT_NEDIS_ROJAZ_1901',
+ 'i-enochian',
+ 'sgn-CH-de',
+ 'art-lojban',
+ 'i-lux',
+ 'art-lojban',
+ 'jbo',
+ 'en_sl_IT',
+ 'zh-Hant-CN-x-prv1-prv2'
+ );
$res_str = '';
$isCanonical = false;
- foreach($loc_ranges as $loc_range){
+ foreach($loc_ranges as $loc_range){
$res_str .="--------------\n";
$result= ut_loc_locale_lookup( $lang_tags , $loc_range,$isCanonical,"en_US");
$comma_arr =implode(",",$lang_tags);
@@ -56,9 +56,9 @@ function ut_main()
$can_loc_range = ut_loc_canonicalize($loc_range);
$res_str .= "Canonical lookup result:$result\n";
- }
+ }
- $res_str .= "\n";
+ $res_str .= "\n";
return $res_str;
}
diff --git a/ext/intl/tests/locale_parse_locale2.phpt b/ext/intl/tests/locale_parse_locale2.phpt
index c823f8c504..59e0c1f678 100644
--- a/ext/intl/tests/locale_parse_locale2.phpt
+++ b/ext/intl/tests/locale_parse_locale2.phpt
@@ -63,7 +63,7 @@ function ut_main()
'de-419-DE',
'a-DE',
'ar-a-aaa-b-bbb-a-ccc',
- 'x-AAAAAA',
+ 'x-AAAAAA',
);
diff --git a/ext/intl/tests/locale_set_default.phpt b/ext/intl/tests/locale_set_default.phpt
index d56c9177cd..9f7438b98b 100644
--- a/ext/intl/tests/locale_set_default.phpt
+++ b/ext/intl/tests/locale_set_default.phpt
@@ -67,22 +67,22 @@ function ut_main()
);
/*
- $locales = array(
- 'es'
- );
+ $locales = array(
+ 'es'
+ );
*/
$res_str = '';
foreach( $locales as $locale )
{
$isSuccessful = ut_loc_set_default( $locale);
- if ($isSuccessful ){
- $lang = ut_loc_get_default( );
- $res_str .= "$locale: set locale '$lang'";
- }
- else{
- $res_str .= "$locale: Error in set locale";
- }
+ if ($isSuccessful ){
+ $lang = ut_loc_get_default( );
+ $res_str .= "$locale: set locale '$lang'";
+ }
+ else{
+ $res_str .= "$locale: Error in set locale";
+ }
$res_str .= "\n";
}
diff --git a/ext/intl/tests/msgfmt_bug70484.phpt b/ext/intl/tests/msgfmt_bug70484.phpt
index 55c516eacd..660fc92f3b 100644
--- a/ext/intl/tests/msgfmt_bug70484.phpt
+++ b/ext/intl/tests/msgfmt_bug70484.phpt
@@ -12,29 +12,28 @@ $locale = array("de", "fr", "en", "ru",);
$data = array(42, 42.42, 2147483643, 2147483643.12345, 5);
foreach ($locale as $lc) {
- echo "$lc string key\n";
- $m = new MessageFormatter($lc, "{n, selectordinal, =5 {five} zero {#-zero} one {#-one} two {#-two} few {#-few} many {#-many} other {#-other}}");
- foreach ($data as $i) {
- var_dump($m->format(array("n" => $i)));
- if ($m->getErrorCode()) {
- echo "$lc $i ", $m->getErrorMessage();
- }
- }
- echo "\n";
+ echo "$lc string key\n";
+ $m = new MessageFormatter($lc, "{n, selectordinal, =5 {five} zero {#-zero} one {#-one} two {#-two} few {#-few} many {#-many} other {#-other}}");
+ foreach ($data as $i) {
+ var_dump($m->format(array("n" => $i)));
+ if ($m->getErrorCode()) {
+ echo "$lc $i ", $m->getErrorMessage();
+ }
+ }
+ echo "\n";
- echo "$lc numeric key\n";
- $m = new MessageFormatter($lc, "{0, selectordinal, =5 {five} zero {#-zero} one {#-one} two {#-two} few {#-few} many {#-many} other {#-other}}");
- foreach ($data as $i) {
- var_dump($m->format(array($i)));
- if ($m->getErrorCode()) {
- echo "$lc $i ", $m->getErrorMessage();
- }
- }
- echo "\n";
+ echo "$lc numeric key\n";
+ $m = new MessageFormatter($lc, "{0, selectordinal, =5 {five} zero {#-zero} one {#-one} two {#-two} few {#-few} many {#-many} other {#-other}}");
+ foreach ($data as $i) {
+ var_dump($m->format(array($i)));
+ if ($m->getErrorCode()) {
+ echo "$lc $i ", $m->getErrorMessage();
+ }
+ }
+ echo "\n";
}
?>
-==DONE==
--EXPECTF--
de string key
string(8) "42-other"
@@ -92,4 +91,3 @@ string(22) "2 147 483 643-other"
string(26) "2 147 483 643,123-other"
string(4) "five"
-==DONE==
diff --git a/ext/intl/tests/msgfmt_clone_bad_obj.phpt b/ext/intl/tests/msgfmt_clone_bad_obj.phpt
index 69105a6b04..829cd6f1e2 100644
--- a/ext/intl/tests/msgfmt_clone_bad_obj.phpt
+++ b/ext/intl/tests/msgfmt_clone_bad_obj.phpt
@@ -6,14 +6,14 @@ Cloning unconstructed MessageFormatter
<?php
class A extends MessageFormatter {
- function __construct() {}
+ function __construct() {}
}
$a = new A;
try {
- $b = clone $a;
+ $b = clone $a;
} catch (Exception $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
--EXPECTF--
string(%d) "Cannot clone unconstructed MessageFormatter"
diff --git a/ext/intl/tests/msgfmt_fail2.phpt b/ext/intl/tests/msgfmt_fail2.phpt
index 0016de4bb7..060976d19e 100644
--- a/ext/intl/tests/msgfmt_fail2.phpt
+++ b/ext/intl/tests/msgfmt_fail2.phpt
@@ -6,126 +6,156 @@ msgfmt creation failures icu >= 4.8
<?php
function err($fmt) {
- if(!$fmt) {
- echo var_export(intl_get_error_message(), true)."\n";
- }
+ if(!$fmt) {
+ echo var_export(intl_get_error_message(), true)."\n";
+ }
}
function print_exception($e) {
- echo "\n" . get_class($e) . ": " . $e->getMessage()
+ echo "\n" . get_class($e) . ": " . $e->getMessage()
. " in " . $e->getFile() . " on line " . $e->getLine() . "\n";
}
function crt($t, $l, $s) {
- switch(true) {
- case $t == "O":
- try {
- return new MessageFormatter($l, $s);
- } catch (Throwable $e) {
- print_exception($e);
- return null;
- }
- break;
- case $t == "C":
- return MessageFormatter::create($l, $s);
- break;
- case $t == "P":
- return msgfmt_create($l, $s);
- break;
- }
+ switch(true) {
+ case $t == "O":
+ try {
+ return new MessageFormatter($l, $s);
+ } catch (Throwable $e) {
+ print_exception($e);
+ return null;
+ }
+ break;
+ case $t == "C":
+ try {
+ return MessageFormatter::create($l, $s);
+ } catch (Throwable $e) {
+ print_exception($e);
+ return null;
+ }
+ break;
+ case $t == "P":
+ try {
+ return msgfmt_create($l, $s);
+ } catch (Throwable $e) {
+ print_exception($e);
+ return null;
+ }
+ break;
+ }
}
$args = array(
- array(null, null),
- array("whatever", "{0,whatever}"),
- array(array(), array()),
- array("en", "{0,choice}"),
- array("fr", "{0,"),
- array("en_US", "\xD0"),
+ array(null, null),
+ array("whatever", "{0,whatever}"),
+ array(array(), array()),
+ array("en", "{0,choice}"),
+ array("fr", "{0,"),
+ array("en_US", "\xD0"),
);
try {
- $fmt = new MessageFormatter();
+ $fmt = new MessageFormatter();
} catch (TypeError $e) {
- print_exception($e);
- $fmt = null;
+ print_exception($e);
+ $fmt = null;
}
err($fmt);
-$fmt = msgfmt_create();
+try {
+ $fmt = msgfmt_create();
+} catch (TypeError $e) {
+ print_exception($e);
+ $fmt = null;
+}
err($fmt);
-$fmt = MessageFormatter::create();
+try {
+ $fmt = MessageFormatter::create();
+} catch (TypeError $e) {
+ print_exception($e);
+ $fmt = null;
+}
err($fmt);
try {
- $fmt = new MessageFormatter('en');
+ $fmt = new MessageFormatter('en');
} catch (TypeError $e) {
- print_exception($e);
- $fmt = null;
+ print_exception($e);
+ $fmt = null;
}
err($fmt);
-$fmt = msgfmt_create('en');
+try {
+ $fmt = msgfmt_create('en');
+} catch (TypeError $e) {
+ print_exception($e);
+ $fmt = null;
+}
err($fmt);
-$fmt = MessageFormatter::create('en');
+try {
+ $fmt = MessageFormatter::create('en');
+} catch (TypeError $e) {
+ print_exception($e);
+ $fmt = null;
+}
err($fmt);
foreach($args as $arg) {
- $fmt = crt("O", $arg[0], $arg[1]);
- err($fmt);
- $fmt = crt("C", $arg[0], $arg[1]);
- err($fmt);
- $fmt = crt("P", $arg[0], $arg[1]);
- err($fmt);
+ $fmt = crt("O", $arg[0], $arg[1]);
+ err($fmt);
+ $fmt = crt("C", $arg[0], $arg[1]);
+ err($fmt);
+ $fmt = crt("P", $arg[0], $arg[1]);
+ err($fmt);
}
?>
--EXPECTF--
ArgumentCountError: MessageFormatter::__construct() expects exactly 2 parameters, 0 given in %s on line %d
-'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
+'U_ZERO_ERROR'
-Warning: msgfmt_create() expects exactly 2 parameters, 0 given in %s on line %d
-'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
+ArgumentCountError: msgfmt_create() expects exactly 2 parameters, 0 given in %s on line %d
+'U_ZERO_ERROR'
-Warning: MessageFormatter::create() expects exactly 2 parameters, 0 given in %s on line %d
-'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
+ArgumentCountError: MessageFormatter::create() expects exactly 2 parameters, 0 given in %s on line %d
+'U_ZERO_ERROR'
ArgumentCountError: MessageFormatter::__construct() expects exactly 2 parameters, 1 given in %s on line %d
-'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
+'U_ZERO_ERROR'
-Warning: msgfmt_create() expects exactly 2 parameters, 1 given in %s on line %d
-'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
+ArgumentCountError: msgfmt_create() expects exactly 2 parameters, 1 given in %s on line %d
+'U_ZERO_ERROR'
-Warning: MessageFormatter::create() expects exactly 2 parameters, 1 given in %s on line %d
-'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
+ArgumentCountError: MessageFormatter::create() expects exactly 2 parameters, 1 given in %s on line %d
+'U_ZERO_ERROR'
-IntlException: Constructor failed in %smsgfmt_fail2.php on line %d
+IntlException: Constructor failed in %s on line %d
'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
-IntlException: Constructor failed in %smsgfmt_fail2.php on line %d
+IntlException: Constructor failed in %s on line %d
'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
TypeError: MessageFormatter::__construct() expects parameter 1 to be string, array given in %s on line %d
-'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
+'U_ZERO_ERROR'
-Warning: MessageFormatter::create() expects parameter 1 to be string, array given in %s on line %d
-'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
+TypeError: MessageFormatter::create() expects parameter 1 to be string, array given in %s on line %d
+'U_ZERO_ERROR'
-Warning: msgfmt_create() expects parameter 1 to be string, array given in %s on line %d
-'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
+TypeError: msgfmt_create() expects parameter 1 to be string, array given in %s on line %d
+'U_ZERO_ERROR'
-IntlException: Constructor failed in %smsgfmt_fail2.php on line %d
+IntlException: Constructor failed in %s on line %d
'msgfmt_create: message formatter creation failed: U_PATTERN_SYNTAX_ERROR'
'msgfmt_create: message formatter creation failed: U_PATTERN_SYNTAX_ERROR'
'msgfmt_create: message formatter creation failed: U_PATTERN_SYNTAX_ERROR'
-IntlException: Constructor failed in %smsgfmt_fail2.php on line %d
+IntlException: Constructor failed in %s on line %d
'msgfmt_create: message formatter creation failed: U_UNMATCHED_BRACES'
'msgfmt_create: message formatter creation failed: U_UNMATCHED_BRACES'
'msgfmt_create: message formatter creation failed: U_UNMATCHED_BRACES'
-IntlException: Constructor failed in %smsgfmt_fail2.php on line %d
+IntlException: Constructor failed in %s on line %d
'msgfmt_create: error converting pattern to UTF-16: U_INVALID_CHAR_FOUND'
'msgfmt_create: error converting pattern to UTF-16: U_INVALID_CHAR_FOUND'
'msgfmt_create: error converting pattern to UTF-16: U_INVALID_CHAR_FOUND'
diff --git a/ext/intl/tests/msgfmt_format.phpt b/ext/intl/tests/msgfmt_format.phpt
index 19581e9698..55f7d65906 100644
--- a/ext/intl/tests/msgfmt_format.phpt
+++ b/ext/intl/tests/msgfmt_format.phpt
@@ -17,24 +17,24 @@ function ut_main()
'ru_UA' => "{0,number,integer} мавп на {1,number,integer} деревах це {2,number} мавпи на кожному деревi",
'de' => "{0,number,integer} Affen über {1,number,integer} Bäume um {2,number} Affen pro Baum",
'en_UK' => "{0,number,integer} monkeys on {1,number,integer} trees make {2,number} monkeys per tree",
- 'root' => '{0,whatever} would not work!',
- 'fr' => "C'est la vie!",
+ 'root' => '{0,whatever} would not work!',
+ 'fr' => "C'est la vie!",
);
$str_res = '';
- $m = 4560;
- $t = 123;
+ $m = 4560;
+ $t = 123;
foreach( $locales as $locale => $pattern )
{
$str_res .= "\nLocale is: $locale\n";
$fmt = ut_msgfmt_create( $locale, $pattern );
- if(!$fmt) {
- $str_res .= dump(intl_get_error_message())."\n";
- continue;
- }
+ if(!$fmt) {
+ $str_res .= dump(intl_get_error_message())."\n";
+ continue;
+ }
$str_res .= dump( ut_msgfmt_format( $fmt, array($m, $t, $m/$t) ) ) . "\n";
- $str_res .= dump( ut_msgfmt_format_message($locale, $pattern, array($m, $t, $m/$t))) . "\n";
+ $str_res .= dump( ut_msgfmt_format_message($locale, $pattern, array($m, $t, $m/$t))) . "\n";
}
return $str_res;
}
diff --git a/ext/intl/tests/msgfmt_format_datetime.phpt b/ext/intl/tests/msgfmt_format_datetime.phpt
index bf0d24ba6a..e110ff0e96 100644
--- a/ext/intl/tests/msgfmt_format_datetime.phpt
+++ b/ext/intl/tests/msgfmt_format_datetime.phpt
@@ -24,8 +24,6 @@ var_dump($mf->format(array($dt)));
var_dump($mf->format(array($dti)));
?>
-==DONE==
--EXPECTF--
string(%s) "May %d, 2012 %d:%d:42 %s"
string(%s) "May %d, 2012 %d:%d:42 %s"
-==DONE==
diff --git a/ext/intl/tests/msgfmt_format_intlcalendar.phpt b/ext/intl/tests/msgfmt_format_intlcalendar.phpt
index 029f89ab9c..4867d767ed 100644
--- a/ext/intl/tests/msgfmt_format_intlcalendar.phpt
+++ b/ext/intl/tests/msgfmt_format_intlcalendar.phpt
@@ -20,11 +20,9 @@ echo $msgf->format(array($cal)), "\n";
'{1, select, date {{0,date,full}} other {{0,time,h:m:s a V}}}');
echo "msgf2: ", $msgf->format(array($time, 'date')), " ",
- $msgf->format(array($time, 'time')), "\n";
+ $msgf->format(array($time, 'time')), "\n";
*/
?>
-==DONE==
--EXPECT--
Quinta-feira, 17 de Maio de 2012 5:35:36 p.m. WEST
-==DONE==
diff --git a/ext/intl/tests/msgfmt_format_intlcalendar_variant2.phpt b/ext/intl/tests/msgfmt_format_intlcalendar_variant2.phpt
index 55dd0e4057..d60ce8c566 100644
--- a/ext/intl/tests/msgfmt_format_intlcalendar_variant2.phpt
+++ b/ext/intl/tests/msgfmt_format_intlcalendar_variant2.phpt
@@ -20,11 +20,9 @@ echo $msgf->format(array($cal)), "\n";
'{1, select, date {{0,date,full}} other {{0,time,h:m:s a V}}}');
echo "msgf2: ", $msgf->format(array($time, 'date')), " ",
- $msgf->format(array($time, 'time')), "\n";
+ $msgf->format(array($time, 'time')), "\n";
*/
?>
-==DONE==
--EXPECT--
Quinta-feira, 17 de Maio de 2012 5:35:36 PM ptlis
-==DONE==
diff --git a/ext/intl/tests/msgfmt_format_intlcalendar_variant3.phpt b/ext/intl/tests/msgfmt_format_intlcalendar_variant3.phpt
index 766c508d31..9235a559f8 100644
--- a/ext/intl/tests/msgfmt_format_intlcalendar_variant3.phpt
+++ b/ext/intl/tests/msgfmt_format_intlcalendar_variant3.phpt
@@ -21,11 +21,9 @@ echo $msgf->format(array($cal)), "\n";
'{1, select, date {{0,date,full}} other {{0,time,h:m:s a V}}}');
echo "msgf2: ", $msgf->format(array($time, 'date')), " ",
- $msgf->format(array($time, 'time')), "\n";
+ $msgf->format(array($time, 'time')), "\n";
*/
?>
-==DONE==
--EXPECT--
quinta-feira, 17 de Maio de 2012 5:35:36 da tarde ptlis
-==DONE==
diff --git a/ext/intl/tests/msgfmt_format_intlcalendar_variant4.phpt b/ext/intl/tests/msgfmt_format_intlcalendar_variant4.phpt
index 8f778b9029..c03254096a 100644
--- a/ext/intl/tests/msgfmt_format_intlcalendar_variant4.phpt
+++ b/ext/intl/tests/msgfmt_format_intlcalendar_variant4.phpt
@@ -20,11 +20,9 @@ echo $msgf->format(array($cal)), "\n";
'{1, select, date {{0,date,full}} other {{0,time,h:m:s a V}}}');
echo "msgf2: ", $msgf->format(array($time, 'date')), " ",
- $msgf->format(array($time, 'time')), "\n";
+ $msgf->format(array($time, 'time')), "\n";
*/
?>
-==DONE==
--EXPECT--
quinta-feira, 17 de maio de 2012 5:35:36 da tarde ptlis
-==DONE==
diff --git a/ext/intl/tests/msgfmt_format_mixed_params.phpt b/ext/intl/tests/msgfmt_format_mixed_params.phpt
index 36ccf0b147..f891e973c0 100644
--- a/ext/intl/tests/msgfmt_format_mixed_params.phpt
+++ b/ext/intl/tests/msgfmt_format_mixed_params.phpt
@@ -10,14 +10,12 @@ ini_set("intl.error_level", E_WARNING);
//ini_set("intl.default_locale", "nl");
$mf = new MessageFormatter('en_US',
- "{0,number} -- {foo,ordinal}");
+ "{0,number} -- {foo,ordinal}");
var_dump($mf->format(array(2.3, "foo" => 1.3)));
var_dump($mf->format(array("foo" => 1.3, 0 => 2.3)));
?>
-==DONE==
--EXPECT--
string(10) "2.3 -- 1st"
string(10) "2.3 -- 1st"
-==DONE==
diff --git a/ext/intl/tests/msgfmt_format_simple_types_numeric_strings.phpt b/ext/intl/tests/msgfmt_format_simple_types_numeric_strings.phpt
index 34d45776b6..b24ae829bc 100644
--- a/ext/intl/tests/msgfmt_format_simple_types_numeric_strings.phpt
+++ b/ext/intl/tests/msgfmt_format_simple_types_numeric_strings.phpt
@@ -12,17 +12,17 @@ ini_set("intl.error_level", E_WARNING);
//ini_set("intl.default_locale", "nl");
$mf = new MessageFormatter('en_US',"
- none {a}
- number {b,number}
- number integer {c,number,integer}
- number currency {d,number,currency}
- number percent {e,number,percent}
- date {f,date}
- time {g,time}
- spellout {h,spellout}
- ordinal {i,ordinal}
- duration {j,duration}
- ");
+ none {a}
+ number {b,number}
+ number integer {c,number,integer}
+ number currency {d,number,currency}
+ number percent {e,number,percent}
+ date {f,date}
+ time {g,time}
+ spellout {h,spellout}
+ ordinal {i,ordinal}
+ duration {j,duration}
+");
$ex = "1336317965.5 str";
var_dump($mf->format(array(
@@ -39,18 +39,16 @@ var_dump($mf->format(array(
)));
?>
-==DONE==
--EXPECTF--
string(%d) "
- none 1336317965.5 str
- number 1,336,317,965.5
- number integer 1,336,317,965
- number currency $1,336,317,965.50
- number percent 133,631,796,550%
- date May %d, 2012
- time %d:%d:05 PM
- spellout one billion three hundred thirty-six million three hundred seventeen thousand nine hundred sixty-five point five
- ordinal 1,336,317,966th
- duration 371,199:26:06
- "
-==DONE==
+ none 1336317965.5 str
+ number 1,336,317,965.5
+ number integer 1,336,317,965
+ number currency $1,336,317,965.50
+ number percent 133,631,796,550%
+ date May %d, 2012
+ time %d:%d:05 PM
+ spellout one billion three hundred thirty-six million three hundred seventeen thousand nine hundred sixty-five point five
+ ordinal 1,336,317,966th
+ duration 371,199:26:06
+"
diff --git a/ext/intl/tests/msgfmt_format_subpatterns.phpt b/ext/intl/tests/msgfmt_format_subpatterns.phpt
index c18bb4be88..50970f0b9e 100644
--- a/ext/intl/tests/msgfmt_format_subpatterns.phpt
+++ b/ext/intl/tests/msgfmt_format_subpatterns.phpt
@@ -45,10 +45,10 @@ $args = array(
$str_res = '';
$fmt = ut_msgfmt_create( 'en_US', $pattern );
- if(!$fmt) {
- $str_res .= dump(intl_get_error_message())."\n";
- return $str_res;
- }
+ if(!$fmt) {
+ $str_res .= dump(intl_get_error_message())."\n";
+ return $str_res;
+ }
foreach ($args as $arg) {
$str_res .= dump( ut_msgfmt_format($fmt, $arg) ). "\n";
$str_res .= dump( ut_msgfmt_format_message('en_US', $pattern, $arg) ) . "\n";
diff --git a/ext/intl/tests/msgfmt_format_subpatterns_named.phpt b/ext/intl/tests/msgfmt_format_subpatterns_named.phpt
index 249f73ce2c..7b56ccb4cc 100644
--- a/ext/intl/tests/msgfmt_format_subpatterns_named.phpt
+++ b/ext/intl/tests/msgfmt_format_subpatterns_named.phpt
@@ -45,10 +45,10 @@ $args = array(
$str_res = '';
$fmt = ut_msgfmt_create( 'en_US', $pattern );
- if(!$fmt) {
- $str_res .= dump(intl_get_error_message())."\n";
- return $str_res;
- }
+ if(!$fmt) {
+ $str_res .= dump(intl_get_error_message())."\n";
+ return $str_res;
+ }
foreach ($args as $arg) {
$str_res .= dump( ut_msgfmt_format($fmt, $arg) ). "\n";
$str_res .= dump( ut_msgfmt_format_message('en_US', $pattern, $arg) ) . "\n";
diff --git a/ext/intl/tests/msgfmt_millisecond_dates.phpt b/ext/intl/tests/msgfmt_millisecond_dates.phpt
index 7dd051426b..2a5723f2e0 100644
--- a/ext/intl/tests/msgfmt_millisecond_dates.phpt
+++ b/ext/intl/tests/msgfmt_millisecond_dates.phpt
@@ -11,7 +11,7 @@ date_default_timezone_set('Europe/Lisbon'); //ignored for now, see bug #58756
$d = 1336308097.123;
$mf = new MessageFormatter('en_US',
- "On {0,time,yyyy-MM-dd G 'at' HH:mm:ss.SSS zzz} something odd happened");
+ "On {0,time,yyyy-MM-dd G 'at' HH:mm:ss.SSS zzz} something odd happened");
var_dump($mf->format(array(1336310569.123)));
@@ -19,11 +19,9 @@ $p = 'On 2012-05-06 AD at 15:22:49.123 GMT+02:00 something odd happened';
var_dump($mf->parse($p));
?>
-==DONE==
--EXPECTF--
string(%d) "On 2012-05-0%d AD at %d:%d:49.123 %s something odd happened"
array(1) {
[0]=>
float(1336310569.123)
}
-==DONE==
diff --git a/ext/intl/tests/msgfmt_parse.phpt b/ext/intl/tests/msgfmt_parse.phpt
index 95645a63a0..962aa083fd 100644
--- a/ext/intl/tests/msgfmt_parse.phpt
+++ b/ext/intl/tests/msgfmt_parse.phpt
@@ -17,32 +17,32 @@ function ut_main()
'ru_UA' => "{0,number,integer} мавп на {1,number,integer} деревах це {2,number} мавпи на кожному деревi",
'de' => "{0,number,integer} Affen über {1,number,integer} Bäume um {2,number} Affen pro Baum",
'en_UK' => "{0,number,integer} monkeys on {1,number,integer} trees make {2,number} monkeys per tree",
- 'root' => '{0,whatever} would not work!',
- 'fr' => 'C\'est {0,number,integer}',
+ 'root' => '{0,whatever} would not work!',
+ 'fr' => 'C\'est {0,number,integer}',
);
- $results = array(
- 'en_US' => "4,560 monkeys on 123 trees make 37.073 monkeys per tree",
- 'ru_UA' => "4 560 мавп на 123 деревах це 37,073 мавпи на кожному деревi",
- 'de' => "4.560 Affen über 123 Bäume um 37,073 Affen pro Baum",
- 'en_UK' => "4,560 monkeys on 123 trees make 37.073 monkeys per tree",
- 'root' => "4,560 monkeys on 123 trees make 37.073 monkeys per tree",
- 'fr' => "C'est 42",
+ $results = array(
+ 'en_US' => "4,560 monkeys on 123 trees make 37.073 monkeys per tree",
+ 'ru_UA' => "4 560 мавп на 123 деревах це 37,073 мавпи на кожному деревi",
+ 'de' => "4.560 Affen über 123 Bäume um 37,073 Affen pro Baum",
+ 'en_UK' => "4,560 monkeys on 123 trees make 37.073 monkeys per tree",
+ 'root' => "4,560 monkeys on 123 trees make 37.073 monkeys per tree",
+ 'fr' => "C'est 42",
- );
+ );
- $str_res = '';
+ $str_res = '';
foreach( $locales as $locale => $pattern )
{
$str_res .= "\nLocale is: $locale\n";
$fmt = ut_msgfmt_create( $locale, $pattern );
- if(!$fmt) {
- $str_res .= dump(intl_get_error_message())."\n";
- continue;
- }
+ if(!$fmt) {
+ $str_res .= dump(intl_get_error_message())."\n";
+ continue;
+ }
$str_res .= dump( ut_msgfmt_parse( $fmt, $results[$locale] ) ) . "\n";
- $str_res .= dump( ut_msgfmt_parse_message($locale, $pattern, $results[$locale])) . "\n";
+ $str_res .= dump( ut_msgfmt_parse_message($locale, $pattern, $results[$locale])) . "\n";
}
return $str_res;
}
diff --git a/ext/intl/tests/msgfmt_setPattern_cache.phpt b/ext/intl/tests/msgfmt_setPattern_cache.phpt
index 90d057c50d..86fda51d41 100644
--- a/ext/intl/tests/msgfmt_setPattern_cache.phpt
+++ b/ext/intl/tests/msgfmt_setPattern_cache.phpt
@@ -10,7 +10,7 @@ ini_set("intl.error_level", E_WARNING);
//ini_set("intl.default_locale", "nl");
$mf = new MessageFormatter('en_US',
- "{0,number} -- {1,ordinal}");
+ "{0,number} -- {1,ordinal}");
var_dump($mf->format(array(1.3, 1.3)));
var_dump($mf->format(array(1.3, 1.3)));
@@ -18,9 +18,7 @@ $mf->setPattern("{0,ordinal} -- {1,number}");
var_dump($mf->format(array(1.3, 1.3)));
?>
-==DONE==
--EXPECT--
string(10) "1.3 -- 1st"
string(10) "1.3 -- 1st"
string(10) "1st -- 1.3"
-==DONE==
diff --git a/ext/intl/tests/normalizer_get_raw_decomposition.phpt b/ext/intl/tests/normalizer_get_raw_decomposition.phpt
index 63caa7d472..590707280f 100644
--- a/ext/intl/tests/normalizer_get_raw_decomposition.phpt
+++ b/ext/intl/tests/normalizer_get_raw_decomposition.phpt
@@ -13,15 +13,15 @@ normalizer_get_raw_decomposition()
function ut_main()
{
- $result = '';
- $strings = [
- "a",
+ $result = '';
+ $strings = [
+ "a",
"\u{FFDA}",
"\u{FDFA}",
"",
"aa",
"\xF5",
- ];
+ ];
foreach ($strings as $string) {
$decomposition = ut_norm_get_raw_decomposition($string, Normalizer::FORM_KC);
@@ -39,7 +39,7 @@ function ut_main()
$result .= "error info: '$error_message' ($error_code)\n";
}
- return $result;
+ return $result;
}
include_once( 'ut_common.inc' );
diff --git a/ext/intl/tests/normalizer_normalize.phpt b/ext/intl/tests/normalizer_normalize.phpt
index 5f8c25ec2f..1a5050526e 100644
--- a/ext/intl/tests/normalizer_normalize.phpt
+++ b/ext/intl/tests/normalizer_normalize.phpt
@@ -12,89 +12,81 @@ normalize()
function ut_main()
{
- $res_str = '';
-
- $forms = array(
- Normalizer::FORM_C,
- Normalizer::FORM_D,
- Normalizer::FORM_KC,
- Normalizer::FORM_KD,
- Normalizer::NONE,
- );
-
- $forms_str = array (
- Normalizer::FORM_C => 'UNORM_FORM_C',
- Normalizer::FORM_D => 'UNORM_FORM_D',
- Normalizer::FORM_KC => 'UNORM_FORM_KC',
- Normalizer::FORM_KD => 'UNORM_FORM_KD',
- Normalizer::NONE => 'UNORM_NONE',
- );
-
- /* just make sure all the form constants are defined as in the api spec */
- if ( Normalizer::FORM_C != Normalizer::NFC ||
- Normalizer::FORM_D != Normalizer::NFD ||
- Normalizer::FORM_KC != Normalizer::NFKC ||
- Normalizer::FORM_KD != Normalizer::NFKD ||
- Normalizer::NONE == Normalizer::FORM_C ) {
-
- $res_str .= "Invalid normalization form declarations!\n";
- }
-
- $char_a_diaeresis = "\xC3\xA4"; // 'LATIN SMALL LETTER A WITH DIAERESIS' (U+00E4)
- $char_a_ring = "\xC3\xA5"; // 'LATIN SMALL LETTER A WITH RING ABOVE' (U+00E5)
- $char_o_diaeresis = "\xC3\xB6"; // 'LATIN SMALL LETTER O WITH DIAERESIS' (U+00F6)
-
- $char_angstrom_sign = "\xE2\x84\xAB"; // 'ANGSTROM SIGN' (U+212B)
- $char_A_ring = "\xC3\x85"; // 'LATIN CAPITAL LETTER A WITH RING ABOVE' (U+00C5)
-
- $char_ohm_sign = "\xE2\x84\xA6"; // 'OHM SIGN' (U+2126)
- $char_omega = "\xCE\xA9"; // 'GREEK CAPITAL LETTER OMEGA' (U+03A9)
-
- $char_combining_ring_above = "\xCC\x8A"; // 'COMBINING RING ABOVE' (U+030A)
-
- $char_fi_ligature = "\xEF\xAC\x81"; // 'LATIN SMALL LIGATURE FI' (U+FB01)
-
- $char_long_s_dot = "\xE1\xBA\x9B"; // 'LATIN SMALL LETTER LONG S WITH DOT ABOVE' (U+1E9B)
-
- $strs = array(
- 'ABC',
- $char_a_diaeresis . '||' . $char_a_ring . '||' . $char_o_diaeresis,
- $char_angstrom_sign . '||' . $char_A_ring . '||' . 'A' . $char_combining_ring_above,
- $char_ohm_sign . '||' . $char_omega,
- $char_fi_ligature,
- $char_long_s_dot,
- );
-
- foreach( $forms as $form )
- {
- foreach( $strs as $str )
- {
- if (Normalizer::NONE == $form) {
- /* Hide deprecation warning. */
- $str_norm = @ut_norm_normalize( $str, $form );
- } else {
- $str_norm = ut_norm_normalize( $str, $form );
- }
- $error_code = intl_get_error_code();
- $error_message = intl_get_error_message();
-
- $str_hex = urlencode($str);
- $str_norm_hex = urlencode($str_norm);
- $res_str .= "'$str_hex' normalized to form '{$forms_str[$form]}' is '$str_norm_hex'"
- . "\terror info: '$error_message' ($error_code)\n"
- . "";
-
- $is_norm = ut_norm_is_normalized( $str, $form );
- $error_code = intl_get_error_code();
- $error_message = intl_get_error_message();
-
- $res_str .= " is in form '{$forms_str[$form]}'? = " . ($is_norm ? "yes" : "no")
- . "\terror info: '$error_message' ($error_code)\n"
- . "";
- }
- }
-
- return $res_str;
+ $res_str = '';
+
+ $forms = array(
+ Normalizer::FORM_C,
+ Normalizer::FORM_D,
+ Normalizer::FORM_KC,
+ Normalizer::FORM_KD,
+ );
+
+ $forms_str = array (
+ Normalizer::FORM_C => 'UNORM_FORM_C',
+ Normalizer::FORM_D => 'UNORM_FORM_D',
+ Normalizer::FORM_KC => 'UNORM_FORM_KC',
+ Normalizer::FORM_KD => 'UNORM_FORM_KD',
+ );
+
+ /* just make sure all the form constants are defined as in the api spec */
+ if ( Normalizer::FORM_C != Normalizer::NFC ||
+ Normalizer::FORM_D != Normalizer::NFD ||
+ Normalizer::FORM_KC != Normalizer::NFKC ||
+ Normalizer::FORM_KD != Normalizer::NFKD) {
+
+ $res_str .= "Invalid normalization form declarations!\n";
+ }
+
+ $char_a_diaeresis = "\xC3\xA4"; // 'LATIN SMALL LETTER A WITH DIAERESIS' (U+00E4)
+ $char_a_ring = "\xC3\xA5"; // 'LATIN SMALL LETTER A WITH RING ABOVE' (U+00E5)
+ $char_o_diaeresis = "\xC3\xB6"; // 'LATIN SMALL LETTER O WITH DIAERESIS' (U+00F6)
+
+ $char_angstrom_sign = "\xE2\x84\xAB"; // 'ANGSTROM SIGN' (U+212B)
+ $char_A_ring = "\xC3\x85"; // 'LATIN CAPITAL LETTER A WITH RING ABOVE' (U+00C5)
+
+ $char_ohm_sign = "\xE2\x84\xA6"; // 'OHM SIGN' (U+2126)
+ $char_omega = "\xCE\xA9"; // 'GREEK CAPITAL LETTER OMEGA' (U+03A9)
+
+ $char_combining_ring_above = "\xCC\x8A"; // 'COMBINING RING ABOVE' (U+030A)
+
+ $char_fi_ligature = "\xEF\xAC\x81"; // 'LATIN SMALL LIGATURE FI' (U+FB01)
+
+ $char_long_s_dot = "\xE1\xBA\x9B"; // 'LATIN SMALL LETTER LONG S WITH DOT ABOVE' (U+1E9B)
+
+ $strs = array(
+ 'ABC',
+ $char_a_diaeresis . '||' . $char_a_ring . '||' . $char_o_diaeresis,
+ $char_angstrom_sign . '||' . $char_A_ring . '||' . 'A' . $char_combining_ring_above,
+ $char_ohm_sign . '||' . $char_omega,
+ $char_fi_ligature,
+ $char_long_s_dot,
+ );
+
+ foreach( $forms as $form )
+ {
+ foreach( $strs as $str )
+ {
+ $str_norm = ut_norm_normalize( $str, $form );
+ $error_code = intl_get_error_code();
+ $error_message = intl_get_error_message();
+
+ $str_hex = urlencode($str);
+ $str_norm_hex = urlencode($str_norm);
+ $res_str .= "'$str_hex' normalized to form '{$forms_str[$form]}' is '$str_norm_hex'"
+ . "\terror info: '$error_message' ($error_code)\n"
+ . "";
+
+ $is_norm = ut_norm_is_normalized( $str, $form );
+ $error_code = intl_get_error_code();
+ $error_message = intl_get_error_message();
+
+ $res_str .= " is in form '{$forms_str[$form]}'? = " . ($is_norm ? "yes" : "no")
+ . "\terror info: '$error_message' ($error_code)\n"
+ . "";
+ }
+ }
+
+ return $res_str;
}
include_once( 'ut_common.inc' );
@@ -150,15 +142,3 @@ ut_run();
is in form 'UNORM_FORM_KD'? = no error info: 'U_ZERO_ERROR' (0)
'%E1%BA%9B' normalized to form 'UNORM_FORM_KD' is 's%CC%87' error info: 'U_ZERO_ERROR' (0)
is in form 'UNORM_FORM_KD'? = no error info: 'U_ZERO_ERROR' (0)
-'ABC' normalized to form 'UNORM_NONE' is 'ABC' error info: 'U_ZERO_ERROR' (0)
- is in form 'UNORM_NONE'? = no error info: 'normalizer_normalize: illegal normalization form: U_ILLEGAL_ARGUMENT_ERROR' (1)
-'%C3%A4%7C%7C%C3%A5%7C%7C%C3%B6' normalized to form 'UNORM_NONE' is '%C3%A4%7C%7C%C3%A5%7C%7C%C3%B6' error info: 'U_ZERO_ERROR' (0)
- is in form 'UNORM_NONE'? = no error info: 'normalizer_normalize: illegal normalization form: U_ILLEGAL_ARGUMENT_ERROR' (1)
-'%E2%84%AB%7C%7C%C3%85%7C%7CA%CC%8A' normalized to form 'UNORM_NONE' is '%E2%84%AB%7C%7C%C3%85%7C%7CA%CC%8A' error info: 'U_ZERO_ERROR' (0)
- is in form 'UNORM_NONE'? = no error info: 'normalizer_normalize: illegal normalization form: U_ILLEGAL_ARGUMENT_ERROR' (1)
-'%E2%84%A6%7C%7C%CE%A9' normalized to form 'UNORM_NONE' is '%E2%84%A6%7C%7C%CE%A9' error info: 'U_ZERO_ERROR' (0)
- is in form 'UNORM_NONE'? = no error info: 'normalizer_normalize: illegal normalization form: U_ILLEGAL_ARGUMENT_ERROR' (1)
-'%EF%AC%81' normalized to form 'UNORM_NONE' is '%EF%AC%81' error info: 'U_ZERO_ERROR' (0)
- is in form 'UNORM_NONE'? = no error info: 'normalizer_normalize: illegal normalization form: U_ILLEGAL_ARGUMENT_ERROR' (1)
-'%E1%BA%9B' normalized to form 'UNORM_NONE' is '%E1%BA%9B' error info: 'U_ZERO_ERROR' (0)
- is in form 'UNORM_NONE'? = no error info: 'normalizer_normalize: illegal normalization form: U_ILLEGAL_ARGUMENT_ERROR' (1)
diff --git a/ext/intl/tests/normalizer_normalize_kc_cf.phpt b/ext/intl/tests/normalizer_normalize_kc_cf.phpt
index 246e41baa2..77e8a95eaa 100644
--- a/ext/intl/tests/normalizer_normalize_kc_cf.phpt
+++ b/ext/intl/tests/normalizer_normalize_kc_cf.phpt
@@ -13,77 +13,72 @@ normalize() NFKC_Casefold
function ut_main()
{
- $res_str = '';
-
- $forms = array(
- Normalizer::FORM_KC_CF,
- );
-
- $forms_str = array (
- Normalizer::FORM_KC_CF => 'UNORM_FORM_KC_CF',
- );
-
- /* just make sure all the form constants are defined as in the api spec */
- if (Normalizer::FORM_C != Normalizer::NFC) {
- $res_str .= "Invalid normalization form declarations!\n";
- }
-
- $char_a_diaeresis = "\xC3\xA4"; // 'LATIN SMALL LETTER A WITH DIAERESIS' (U+00E4)
- $char_a_ring = "\xC3\xA5"; // 'LATIN SMALL LETTER A WITH RING ABOVE' (U+00E5)
- $char_o_diaeresis = "\xC3\xB6"; // 'LATIN SMALL LETTER O WITH DIAERESIS' (U+00F6)
-
- $char_angstrom_sign = "\xE2\x84\xAB"; // 'ANGSTROM SIGN' (U+212B)
- $char_A_ring = "\xC3\x85"; // 'LATIN CAPITAL LETTER A WITH RING ABOVE' (U+00C5)
-
- $char_ohm_sign = "\xE2\x84\xA6"; // 'OHM SIGN' (U+2126)
- $char_omega = "\xCE\xA9"; // 'GREEK CAPITAL LETTER OMEGA' (U+03A9)
-
- $char_combining_ring_above = "\xCC\x8A"; // 'COMBINING RING ABOVE' (U+030A)
-
- $char_fi_ligature = "\xEF\xAC\x81"; // 'LATIN SMALL LIGATURE FI' (U+FB01)
-
- $char_long_s_dot = "\xE1\xBA\x9B"; // 'LATIN SMALL LETTER LONG S WITH DOT ABOVE' (U+1E9B)
-
- $strs = array(
- 'ABC',
- 'abc',
- $char_a_diaeresis . '||' . $char_a_ring . '||' . $char_o_diaeresis,
- $char_angstrom_sign . '||' . $char_A_ring . '||' . 'A' . $char_combining_ring_above,
- $char_ohm_sign . '||' . $char_omega,
- $char_fi_ligature,
- $char_long_s_dot,
- );
-
- foreach( $forms as $form )
- {
- foreach( $strs as $str )
- {
- if (Normalizer::NONE == $form) {
- /* Hide deprecation warning. */
- $str_norm = @ut_norm_normalize( $str, $form );
- } else {
- $str_norm = ut_norm_normalize( $str, $form );
- }
- $error_code = intl_get_error_code();
- $error_message = intl_get_error_message();
-
- $str_hex = urlencode($str);
- $str_norm_hex = urlencode($str_norm);
- $res_str .= "'$str_hex' normalized to form '{$forms_str[$form]}' is '$str_norm_hex'"
- . "\terror info: '$error_message' ($error_code)\n"
- . "";
-
- $is_norm = ut_norm_is_normalized( $str, $form );
- $error_code = intl_get_error_code();
- $error_message = intl_get_error_message();
-
- $res_str .= " is in form '{$forms_str[$form]}'? = " . ($is_norm ? "yes" : "no")
- . "\terror info: '$error_message' ($error_code)\n"
- . "";
- }
- }
-
- return $res_str;
+ $res_str = '';
+
+ $forms = array(
+ Normalizer::FORM_KC_CF,
+ );
+
+ $forms_str = array (
+ Normalizer::FORM_KC_CF => 'UNORM_FORM_KC_CF',
+ );
+
+ /* just make sure all the form constants are defined as in the api spec */
+ if (Normalizer::FORM_C != Normalizer::NFC) {
+ $res_str .= "Invalid normalization form declarations!\n";
+ }
+
+ $char_a_diaeresis = "\xC3\xA4"; // 'LATIN SMALL LETTER A WITH DIAERESIS' (U+00E4)
+ $char_a_ring = "\xC3\xA5"; // 'LATIN SMALL LETTER A WITH RING ABOVE' (U+00E5)
+ $char_o_diaeresis = "\xC3\xB6"; // 'LATIN SMALL LETTER O WITH DIAERESIS' (U+00F6)
+
+ $char_angstrom_sign = "\xE2\x84\xAB"; // 'ANGSTROM SIGN' (U+212B)
+ $char_A_ring = "\xC3\x85"; // 'LATIN CAPITAL LETTER A WITH RING ABOVE' (U+00C5)
+
+ $char_ohm_sign = "\xE2\x84\xA6"; // 'OHM SIGN' (U+2126)
+ $char_omega = "\xCE\xA9"; // 'GREEK CAPITAL LETTER OMEGA' (U+03A9)
+
+ $char_combining_ring_above = "\xCC\x8A"; // 'COMBINING RING ABOVE' (U+030A)
+
+ $char_fi_ligature = "\xEF\xAC\x81"; // 'LATIN SMALL LIGATURE FI' (U+FB01)
+
+ $char_long_s_dot = "\xE1\xBA\x9B"; // 'LATIN SMALL LETTER LONG S WITH DOT ABOVE' (U+1E9B)
+
+ $strs = array(
+ 'ABC',
+ 'abc',
+ $char_a_diaeresis . '||' . $char_a_ring . '||' . $char_o_diaeresis,
+ $char_angstrom_sign . '||' . $char_A_ring . '||' . 'A' . $char_combining_ring_above,
+ $char_ohm_sign . '||' . $char_omega,
+ $char_fi_ligature,
+ $char_long_s_dot,
+ );
+
+ foreach( $forms as $form )
+ {
+ foreach( $strs as $str )
+ {
+ $str_norm = ut_norm_normalize( $str, $form );
+ $error_code = intl_get_error_code();
+ $error_message = intl_get_error_message();
+
+ $str_hex = urlencode($str);
+ $str_norm_hex = urlencode($str_norm);
+ $res_str .= "'$str_hex' normalized to form '{$forms_str[$form]}' is '$str_norm_hex'"
+ . "\terror info: '$error_message' ($error_code)\n"
+ . "";
+
+ $is_norm = ut_norm_is_normalized( $str, $form );
+ $error_code = intl_get_error_code();
+ $error_message = intl_get_error_message();
+
+ $res_str .= " is in form '{$forms_str[$form]}'? = " . ($is_norm ? "yes" : "no")
+ . "\terror info: '$error_message' ($error_code)\n"
+ . "";
+ }
+ }
+
+ return $res_str;
}
include_once( 'ut_common.inc' );
diff --git a/ext/intl/tests/rbbiter___construct_basic.phpt b/ext/intl/tests/rbbiter___construct_basic.phpt
index 31edcd2c83..9f20806fa5 100644
--- a/ext/intl/tests/rbbiter___construct_basic.phpt
+++ b/ext/intl/tests/rbbiter___construct_basic.phpt
@@ -26,15 +26,13 @@ $rbbi = new IntlRuleBasedBreakIterator($rules);
var_dump(get_class($rbbi));
try {
- $obj = new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+', 'aoeu');
+ $obj = new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+', 'aoeu');
} catch (IntlException $e) {
- var_dump(intl_get_error_code(), intl_get_error_message());
+ var_dump(intl_get_error_code(), intl_get_error_message());
}
?>
-==DONE==
--EXPECT--
string(26) "IntlRuleBasedBreakIterator"
int(1)
string(93) "rbbi_create_instance: unable to create instance from compiled rules: U_ILLEGAL_ARGUMENT_ERROR"
-==DONE==
diff --git a/ext/intl/tests/rbbiter_getBinaryRules_basic.phpt b/ext/intl/tests/rbbiter_getBinaryRules_basic.phpt
index 4a8c68a8de..b98f26a72f 100644
--- a/ext/intl/tests/rbbiter_getBinaryRules_basic.phpt
+++ b/ext/intl/tests/rbbiter_getBinaryRules_basic.phpt
@@ -31,9 +31,7 @@ $rbbi2 = new IntlRuleBasedBreakIterator($br, true);
var_dump($rbbi->getRules(), $rbbi2->getRules());
var_dump($rbbi->getRules() == $rbbi2->getRules());
?>
-==DONE==
--EXPECT--
string(128) "$LN = [[:letter:] [:number:]];$S = [.;,:];!!forward;$LN+ {1};$S+ {42};!!reverse;$LN+ {1};$S+ {42};!!safe_forward;!!safe_reverse;"
string(128) "$LN = [[:letter:] [:number:]];$S = [.;,:];!!forward;$LN+ {1};$S+ {42};!!reverse;$LN+ {1};$S+ {42};!!safe_forward;!!safe_reverse;"
bool(true)
-==DONE==
diff --git a/ext/intl/tests/rbbiter_getBinaryRules_basic2.phpt b/ext/intl/tests/rbbiter_getBinaryRules_basic2.phpt
index f3b6c6cb34..6a3f65e3ea 100644
--- a/ext/intl/tests/rbbiter_getBinaryRules_basic2.phpt
+++ b/ext/intl/tests/rbbiter_getBinaryRules_basic2.phpt
@@ -31,7 +31,6 @@ $rbbi2 = new IntlRuleBasedBreakIterator($br, true);
var_dump($rbbi->getRules(), $rbbi2->getRules());
var_dump($rbbi->getRules() == $rbbi2->getRules());
?>
-==DONE==
--EXPECT--
string(137) "$LN = [[:letter:] [:number:]];
$S = [.;,:];
@@ -54,4 +53,3 @@ $S+ {42};
!!safe_forward;
!!safe_reverse;"
bool(true)
-==DONE==
diff --git a/ext/intl/tests/rbbiter_getRuleStatusVec_basic.phpt b/ext/intl/tests/rbbiter_getRuleStatusVec_basic.phpt
index 4a654508cc..4592a62eb9 100644
--- a/ext/intl/tests/rbbiter_getRuleStatusVec_basic.phpt
+++ b/ext/intl/tests/rbbiter_getRuleStatusVec_basic.phpt
@@ -28,11 +28,10 @@ $rbbi = new IntlRuleBasedBreakIterator($rules);
$rbbi->setText('sdfkjsdf88á.... ,;');
do {
- var_dump($rbbi->current(), $rbbi->getRuleStatusVec());
+ var_dump($rbbi->current(), $rbbi->getRuleStatusVec());
} while ($rbbi->next() != IntlBreakIterator::DONE);
?>
-==DONE==
--EXPECT--
int(0)
array(1) {
@@ -56,4 +55,3 @@ array(1) {
[0]=>
int(4)
}
-==DONE==
diff --git a/ext/intl/tests/rbbiter_getRuleStatus_basic.phpt b/ext/intl/tests/rbbiter_getRuleStatus_basic.phpt
index a9c4d32ee4..44da765292 100644
--- a/ext/intl/tests/rbbiter_getRuleStatus_basic.phpt
+++ b/ext/intl/tests/rbbiter_getRuleStatus_basic.phpt
@@ -26,12 +26,11 @@ $rbbi = new IntlRuleBasedBreakIterator($rules);
$rbbi->setText('sdfkjsdf88á.... ,;');
do {
- echo "pos : {$rbbi->current()}\n",
- "rule status: {$rbbi->getRuleStatus()}\n";
+ echo "pos : {$rbbi->current()}\n",
+ "rule status: {$rbbi->getRuleStatus()}\n";
} while ($rbbi->next() != IntlBreakIterator::DONE);
?>
-==DONE==
--EXPECT--
pos : 0
rule status: 0
@@ -43,4 +42,3 @@ pos : 17
rule status: 0
pos : 19
rule status: 42
-==DONE==
diff --git a/ext/intl/tests/rbbiter_getRules_basic.phpt b/ext/intl/tests/rbbiter_getRules_basic.phpt
index 3ad1a92311..918b1eeff0 100644
--- a/ext/intl/tests/rbbiter_getRules_basic.phpt
+++ b/ext/intl/tests/rbbiter_getRules_basic.phpt
@@ -25,7 +25,5 @@ $rbbi = new IntlRuleBasedBreakIterator($rules);
var_dump($rbbi->getRules());
?>
-==DONE==
--EXPECT--
string(128) "$LN = [[:letter:] [:number:]];$S = [.;,:];!!forward;$LN+ {1};$S+ {42};!!reverse;$LN+ {1};$S+ {42};!!safe_forward;!!safe_reverse;"
-==DONE==
diff --git a/ext/intl/tests/rbbiter_getRules_basic2.phpt b/ext/intl/tests/rbbiter_getRules_basic2.phpt
index 67b3831aa2..97cea02d28 100644
--- a/ext/intl/tests/rbbiter_getRules_basic2.phpt
+++ b/ext/intl/tests/rbbiter_getRules_basic2.phpt
@@ -25,7 +25,6 @@ $rbbi = new IntlRuleBasedBreakIterator($rules);
var_dump($rbbi->getRules());
?>
-==DONE==
--EXPECT--
string(137) "$LN = [[:letter:] [:number:]];
$S = [.;,:];
@@ -37,4 +36,3 @@ $LN+ {1};
$S+ {42};
!!safe_forward;
!!safe_reverse;"
-==DONE==
diff --git a/ext/intl/tests/resourcebundle.inc b/ext/intl/tests/resourcebundle.inc
index a7727a3ec8..9eea8aaffb 100644
--- a/ext/intl/tests/resourcebundle.inc
+++ b/ext/intl/tests/resourcebundle.inc
@@ -2,11 +2,11 @@
define('BUNDLE', dirname(__FILE__)."/_files/resourcebundle");
function debug( $res ) {
- if (is_null( $res )) {
- $ret = "NULL\n";
- }
- else {
- $ret = print_r( $res, true ). "\n";
- }
- return $ret . sprintf( "%5d: %s\n", intl_get_error_code(), intl_get_error_message() );
+ if (is_null( $res )) {
+ $ret = "NULL\n";
+ }
+ else {
+ $ret = print_r( $res, true ). "\n";
+ }
+ return $ret . sprintf( "%5d: %s\n", intl_get_error_code(), intl_get_error_message() );
}
diff --git a/ext/intl/tests/resourcebundle_arrayaccess.phpt b/ext/intl/tests/resourcebundle_arrayaccess.phpt
index d035a8d304..8eaaff3af3 100644
--- a/ext/intl/tests/resourcebundle_arrayaccess.phpt
+++ b/ext/intl/tests/resourcebundle_arrayaccess.phpt
@@ -4,27 +4,27 @@ Test ResourceBundle array access and count - existing/missing keys
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
--FILE--
<?php
- include "resourcebundle.inc";
+ include "resourcebundle.inc";
- // fall back
- $r = new ResourceBundle( 'en_US', BUNDLE );
+ // fall back
+ $r = new ResourceBundle( 'en_US', BUNDLE );
- printf( "length: %d\n", count($r) );
- printf( "teststring: %s\n", $r['teststring'] );
- printf( "testint: %d\n", $r['testint'] );
+ printf( "length: %d\n", count($r) );
+ printf( "teststring: %s\n", $r['teststring'] );
+ printf( "testint: %d\n", $r['testint'] );
- print_r( $r['testvector'] );
+ print_r( $r['testvector'] );
- printf( "testbin: %s\n", bin2hex($r['testbin']) );
+ printf( "testbin: %s\n", bin2hex($r['testbin']) );
- $r2 = $r['testtable'];
- printf( "testtable: %d\n", $r2['major'] );
+ $r2 = $r['testtable'];
+ printf( "testtable: %d\n", $r2['major'] );
- $r2 = $r['testarray'];
- printf( "testarray: %s\n", $r2[2] );
+ $r2 = $r['testarray'];
+ printf( "testarray: %s\n", $r2[2] );
- $t = $r['nonexisting'];
- echo debug( $t );
+ $t = $r['nonexisting'];
+ echo debug( $t );
?>
--EXPECT--
length: 6
diff --git a/ext/intl/tests/resourcebundle_countable.phpt b/ext/intl/tests/resourcebundle_countable.phpt
index bacc18f10c..fb703160c9 100644
--- a/ext/intl/tests/resourcebundle_countable.phpt
+++ b/ext/intl/tests/resourcebundle_countable.phpt
@@ -4,11 +4,11 @@ Test ResourceBundle implements Countable
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
--FILE--
<?php
- include "resourcebundle.inc";
+ include "resourcebundle.inc";
- $r = new ResourceBundle( 'es', BUNDLE );
+ $r = new ResourceBundle( 'es', BUNDLE );
- var_dump($r instanceof Countable);
+ var_dump($r instanceof Countable);
?>
--EXPECT--
bool(true)
diff --git a/ext/intl/tests/resourcebundle_create.phpt b/ext/intl/tests/resourcebundle_create.phpt
index 09bad4fddf..d7ba99d523 100644
--- a/ext/intl/tests/resourcebundle_create.phpt
+++ b/ext/intl/tests/resourcebundle_create.phpt
@@ -8,35 +8,35 @@ Test ResourceBundle::__construct() - existing/missing bundles/locales
include "resourcebundle.inc";
function ut_main() {
- $str_res = '';
- // all fine
- $r1 = ut_resourcebundle_create( 'root', BUNDLE );
- $str_res .= debug( $r1 );
- $str_res .= print_r( $r1['teststring'], true)."\n";
-
- // non-root one
- $r1 = ut_resourcebundle_create( 'es', BUNDLE );
- $str_res .= debug( $r1 );
- $str_res .= print_r( $r1['teststring'], true)."\n";
-
- // fall back
- $r1 = ut_resourcebundle_create( 'en_US', BUNDLE );
+ $str_res = '';
+ // all fine
+ $r1 = ut_resourcebundle_create( 'root', BUNDLE );
+ $str_res .= debug( $r1 );
+ $str_res .= print_r( $r1['teststring'], true)."\n";
+
+ // non-root one
+ $r1 = ut_resourcebundle_create( 'es', BUNDLE );
+ $str_res .= debug( $r1 );
+ $str_res .= print_r( $r1['teststring'], true)."\n";
+
+ // fall back
+ $r1 = ut_resourcebundle_create( 'en_US', BUNDLE );
$str_res .= debug( $r1 );
- $str_res .= print_r( $r1['testsring'], true);
+ $str_res .= print_r( $r1['testsring'], true);
- // fall out
- $r2 = ut_resourcebundle_create( 'en_US', BUNDLE, false );
+ // fall out
+ $r2 = ut_resourcebundle_create( 'en_US', BUNDLE, false );
$str_res .= debug( $r2 );
- // missing
- $r3 = ut_resourcebundle_create( 'en_US', 'nonexisting' );
+ // missing
+ $r3 = ut_resourcebundle_create( 'en_US', 'nonexisting' );
$str_res .= debug( $r3 );
- return $str_res;
+ return $str_res;
}
- include_once( 'ut_common.inc' );
- ut_run();
+ include_once( 'ut_common.inc' );
+ ut_run();
?>
--EXPECT--
ResourceBundle Object
diff --git a/ext/intl/tests/resourcebundle_individual.phpt b/ext/intl/tests/resourcebundle_individual.phpt
index 0fb512f8e5..46ce239e4d 100644
--- a/ext/intl/tests/resourcebundle_individual.phpt
+++ b/ext/intl/tests/resourcebundle_individual.phpt
@@ -4,34 +4,34 @@ Test ResourceBundle::get() and length() - existing/missing keys
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
--FILE--
<?php
- include "resourcebundle.inc";
+ include "resourcebundle.inc";
function ut_main() {
- $str_res = '';
- // fall back
- $r = ut_resourcebundle_create( 'en_US', BUNDLE );
+ $str_res = '';
+ // fall back
+ $r = ut_resourcebundle_create( 'en_US', BUNDLE );
- $str_res .= sprintf( "length: %d\n", ut_resourcebundle_count($r) );
- $str_res .= sprintf( "teststring: %s\n", ut_resourcebundle_get($r, 'teststring' ) );
- $str_res .= sprintf( "testint: %d\n", ut_resourcebundle_get($r, 'testint' ) );
+ $str_res .= sprintf( "length: %d\n", ut_resourcebundle_count($r) );
+ $str_res .= sprintf( "teststring: %s\n", ut_resourcebundle_get($r, 'teststring' ) );
+ $str_res .= sprintf( "testint: %d\n", ut_resourcebundle_get($r, 'testint' ) );
- $str_res .= print_r( ut_resourcebundle_get($r, 'testvector' ), true );
+ $str_res .= print_r( ut_resourcebundle_get($r, 'testvector' ), true );
- $str_res .= sprintf( "testbin: %s\n", bin2hex(ut_resourcebundle_get( $r,'testbin' )) );
+ $str_res .= sprintf( "testbin: %s\n", bin2hex(ut_resourcebundle_get( $r,'testbin' )) );
- $r2 = ut_resourcebundle_get($r, 'testtable' );
- $str_res .= sprintf( "testtable: %d\n", ut_resourcebundle_get($r2, 'major' ) );
+ $r2 = ut_resourcebundle_get($r, 'testtable' );
+ $str_res .= sprintf( "testtable: %d\n", ut_resourcebundle_get($r2, 'major' ) );
- $r2 = ut_resourcebundle_get($r,'testarray' );
- $str_res .= sprintf( "testarray: %s\n", ut_resourcebundle_get($r2, 2 ) );
+ $r2 = ut_resourcebundle_get($r,'testarray' );
+ $str_res .= sprintf( "testarray: %s\n", ut_resourcebundle_get($r2, 2 ) );
- $t = ut_resourcebundle_get( $r, 'nonexisting' );
- $str_res .= debug( $t );
+ $t = ut_resourcebundle_get( $r, 'nonexisting' );
+ $str_res .= debug( $t );
- return $str_res;
+ return $str_res;
}
- include_once( 'ut_common.inc' );
- ut_run();
+ include_once( 'ut_common.inc' );
+ ut_run();
?>
--EXPECT--
length: 6
diff --git a/ext/intl/tests/resourcebundle_iterator.phpt b/ext/intl/tests/resourcebundle_iterator.phpt
index e0b83d8190..93833fdf35 100644
--- a/ext/intl/tests/resourcebundle_iterator.phpt
+++ b/ext/intl/tests/resourcebundle_iterator.phpt
@@ -4,33 +4,33 @@ Test ResourceBundle iterator
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
--FILE--
<?php
- include "resourcebundle.inc";
+ include "resourcebundle.inc";
- // fall back
- $r = new ResourceBundle( 'en_US', BUNDLE );
+ // fall back
+ $r = new ResourceBundle( 'en_US', BUNDLE );
- foreach ($r as $onekey => $oneval) {
- echo "Here comes $onekey:\n";
- switch (gettype($oneval)) {
- case 'string':
- echo bin2hex( $oneval ) . "\n";
- break;
+ foreach ($r as $onekey => $oneval) {
+ echo "Here comes $onekey:\n";
+ switch (gettype($oneval)) {
+ case 'string':
+ echo bin2hex( $oneval ) . "\n";
+ break;
- case 'integer':
- echo "$oneval\n";
- break;
+ case 'integer':
+ echo "$oneval\n";
+ break;
- default:
- print_r( $oneval );
- }
- echo "\n";
- }
+ default:
+ print_r( $oneval );
+ }
+ echo "\n";
+ }
- echo "Testarray Contents:\n";
- $r = $r->get( 'testarray' );
- foreach ($r as $onekey => $oneval) {
- echo "$onekey => $oneval\n";
- }
+ echo "Testarray Contents:\n";
+ $r = $r->get( 'testarray' );
+ foreach ($r as $onekey => $oneval) {
+ echo "$onekey => $oneval\n";
+ }
?>
--EXPECT--
Here comes testarray:
diff --git a/ext/intl/tests/resourcebundle_locales.phpt b/ext/intl/tests/resourcebundle_locales.phpt
index c744e63193..16b863d4e8 100644
--- a/ext/intl/tests/resourcebundle_locales.phpt
+++ b/ext/intl/tests/resourcebundle_locales.phpt
@@ -8,15 +8,15 @@ Test ResourceBundle::getLocales
include "resourcebundle.inc";
function ut_main() {
- $str_res = '';
+ $str_res = '';
- $str_res .= join("\n", ut_resourcebundle_locales(BUNDLE));
+ $str_res .= join("\n", ut_resourcebundle_locales(BUNDLE));
- return $str_res;
+ return $str_res;
}
- include_once( 'ut_common.inc' );
- ut_run();
+ include_once( 'ut_common.inc' );
+ ut_run();
?>
--EXPECT--
es
diff --git a/ext/intl/tests/resourcebundle_null_mandatory_args.phpt b/ext/intl/tests/resourcebundle_null_mandatory_args.phpt
index ae6effef6e..6eb325f575 100644
--- a/ext/intl/tests/resourcebundle_null_mandatory_args.phpt
+++ b/ext/intl/tests/resourcebundle_null_mandatory_args.phpt
@@ -18,8 +18,6 @@ $r = new ResourceBundle(NULL, NULL);
$c = $r->get('calendar')->get('gregorian')->get('DateTimePatterns')->get(0);
var_dump($c);
?>
-==DONE==
--EXPECT--
string(14) "h:mm:ss a zzzz"
string(12) "H:mm:ss zzzz"
-==DONE==
diff --git a/ext/intl/tests/resourcebundle_null_mandatory_args_variant2.phpt b/ext/intl/tests/resourcebundle_null_mandatory_args_variant2.phpt
index cf721c8ef2..0b0bf967ad 100644
--- a/ext/intl/tests/resourcebundle_null_mandatory_args_variant2.phpt
+++ b/ext/intl/tests/resourcebundle_null_mandatory_args_variant2.phpt
@@ -19,8 +19,6 @@ $r = new ResourceBundle(NULL, NULL);
$c = $r->get('calendar')->get('gregorian')->get('DateTimePatterns')->get(0);
var_dump($c);
?>
-==DONE==
--EXPECT--
string(14) "h:mm:ss a zzzz"
string(13) "HH:mm:ss zzzz"
-==DONE==
diff --git a/ext/intl/tests/resourcebundle_traversable.phpt b/ext/intl/tests/resourcebundle_traversable.phpt
index 4aeec2330d..93d4c2a41e 100644
--- a/ext/intl/tests/resourcebundle_traversable.phpt
+++ b/ext/intl/tests/resourcebundle_traversable.phpt
@@ -4,12 +4,12 @@ Bug #55610: ResourceBundle does not implement Traversable
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
--FILE--
<?php
- include "resourcebundle.inc";
+ include "resourcebundle.inc";
- $r = new ResourceBundle( 'es', BUNDLE );
+ $r = new ResourceBundle( 'es', BUNDLE );
- var_dump($r instanceof Traversable);
- var_dump(iterator_to_array($r->get('testarray')));
+ var_dump($r instanceof Traversable);
+ var_dump(iterator_to_array($r->get('testarray')));
?>
--EXPECT--
bool(true)
diff --git a/ext/intl/tests/symfony_format_type_double_intl1.phpt b/ext/intl/tests/symfony_format_type_double_intl1.phpt
deleted file mode 100644
index 13a7ad761f..0000000000
--- a/ext/intl/tests/symfony_format_type_double_intl1.phpt
+++ /dev/null
@@ -1,30 +0,0 @@
---TEST--
-Symfony StubNumberFormatterTest#testFormatTypeDoubleIntl #1
---SKIPIF--
-<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
---FILE--
-<?php
-
-
-// PHP Unit's code to unserialize data passed as args to #testFormatTypeDoubleIntl
-$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;i:1;i:2;s:1:"1";}');
-
-var_dump($unit_test_args);
-
-// execute the code from #testFormatTypeDoubleIntl
-$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_DOUBLE);
-
-echo "== didn't crash ==".PHP_EOL;
-
-?>
---EXPECT--
-array(3) {
- [0]=>
- object(NumberFormatter)#1 (0) {
- }
- [1]=>
- int(1)
- [2]=>
- string(1) "1"
-}
-== didn't crash ==
diff --git a/ext/intl/tests/symfony_format_type_double_intl2.phpt b/ext/intl/tests/symfony_format_type_double_intl2.phpt
deleted file mode 100644
index 6bff7cc355..0000000000
--- a/ext/intl/tests/symfony_format_type_double_intl2.phpt
+++ /dev/null
@@ -1,30 +0,0 @@
---TEST--
-Symfony StubNumberFormatterTest#testFormatTypeDoubleIntl #2
---SKIPIF--
-<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
---FILE--
-<?php
-
-
-// PHP Unit's code to unserialize data passed as args to #testFormatTypeDoubleIntl
-$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:1.1000000000000001;i:2;s:3:"1.1";}');
-
-var_dump($unit_test_args);
-
-// execute the code from #testFormatTypeDoubleIntl
-$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_DOUBLE);
-
-echo "== didn't crash ==".PHP_EOL;
-
-?>
---EXPECT--
-array(3) {
- [0]=>
- object(NumberFormatter)#1 (0) {
- }
- [1]=>
- float(1.1)
- [2]=>
- string(3) "1.1"
-}
-== didn't crash ==
diff --git a/ext/intl/tests/symfony_format_type_double_intl3.phpt b/ext/intl/tests/symfony_format_type_double_intl3.phpt
deleted file mode 100644
index 3b0d576df7..0000000000
--- a/ext/intl/tests/symfony_format_type_double_intl3.phpt
+++ /dev/null
@@ -1,30 +0,0 @@
---TEST--
-Symfony StubNumberFormatterTest#testFormatTypeDoubleIntl #3
---SKIPIF--
-<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
---FILE--
-<?php
-
-
-// PHP Unit's code to unserialize data passed as args to #testFormatTypeDoubleIntl
-$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;i:1;i:2;s:7:"SFD1.00";}');
-
-var_dump($unit_test_args);
-
-// execute the code from #testFormatTypeDoubleIntl
-$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_DOUBLE);
-
-echo "== didn't crash ==".PHP_EOL;
-
-?>
---EXPECT--
-array(3) {
- [0]=>
- object(NumberFormatter)#1 (0) {
- }
- [1]=>
- int(1)
- [2]=>
- string(7) "SFD1.00"
-}
-== didn't crash ==
diff --git a/ext/intl/tests/symfony_format_type_double_intl4.phpt b/ext/intl/tests/symfony_format_type_double_intl4.phpt
deleted file mode 100644
index 3476e10892..0000000000
--- a/ext/intl/tests/symfony_format_type_double_intl4.phpt
+++ /dev/null
@@ -1,30 +0,0 @@
---TEST--
-Symfony StubNumberFormatterTest#testFormatTypeDoubleIntl #4
---SKIPIF--
-<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
---FILE--
-<?php
-
-
-// PHP Unit's code to unserialize data passed as args to #testFormatTypeDoubleIntl
-$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:1.1000000000000001;i:2;s:7:"SFD1.10";}');
-
-var_dump($unit_test_args);
-
-// execute the code from #testFormatTypeDoubleIntl
-$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_DOUBLE);
-
-echo "== didn't crash ==".PHP_EOL;
-
-?>
---EXPECT--
-array(3) {
- [0]=>
- object(NumberFormatter)#1 (0) {
- }
- [1]=>
- float(1.1)
- [2]=>
- string(7) "SFD1.10"
-}
-== didn't crash ==
diff --git a/ext/intl/tests/symfony_format_type_int32_intl1.phpt b/ext/intl/tests/symfony_format_type_int32_intl1.phpt
deleted file mode 100644
index 7d892cf5b6..0000000000
--- a/ext/intl/tests/symfony_format_type_int32_intl1.phpt
+++ /dev/null
@@ -1,49 +0,0 @@
---TEST--
-Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #1
---SKIPIF--
-<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
---FILE--
-<?php
-
-// port of Symfony's Symfony\Component\Locale\Tests\Stub\StubNumberFormatterTest#testFormatTypeInt32Intl
-
-
-// Crashes on Windows
-// Windows note: the popup '...program has stopped working'(AEDebug Popup)
-// doesn't always show if you're rapidly running this test repeatedly.
-// regardless of that, the test always crashes every time.
-// (it will show up the first time, or if you wait a while before running it again.)
-// (the popup may also be disabled, which can be done with a registry setting.)
-// you can confirm it crashed by checking the exit code OR
-// the message this test prints at the very end (expected output for pass).
-//
-// Get Exit Code
-// Linux: echo $?
-// Windows: echo %ErrorLevel%
-
-
-
-
-
-// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt32Intl
-$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;i:1;i:2;s:1:"1";}');
-
-var_dump($unit_test_args);
-
-// execute the code from #testFormatTypeInt32Intl
-$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32);
-
-echo "== didn't crash ==".PHP_EOL;
-
-?>
---EXPECT--
-array(3) {
- [0]=>
- object(NumberFormatter)#1 (0) {
- }
- [1]=>
- int(1)
- [2]=>
- string(1) "1"
-}
-== didn't crash ==
diff --git a/ext/intl/tests/symfony_format_type_int32_intl2.phpt b/ext/intl/tests/symfony_format_type_int32_intl2.phpt
deleted file mode 100644
index 6a65a0a809..0000000000
--- a/ext/intl/tests/symfony_format_type_int32_intl2.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #2
---SKIPIF--
-<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
---FILE--
-<?php
-
-// StubNumberFormatterTest#testFormatTypeInt32Intl is tested many times, each with different args.
-// there are 7 sets of args that crash PHP (and other args that don't), each of those 7 is now a separate PHPT test
-// to ensure that each of the 7 args are always tested.
-
-// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt32Intl
-$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:1.1000000000000001;i:2;s:1:"1";}');
-
-var_dump($unit_test_args);
-
-// execute the code from #testFormatTypeInt32Intl
-$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32);
-
-echo "== didn't crash ==".PHP_EOL;
-
-?>
---EXPECT--
-array(3) {
- [0]=>
- object(NumberFormatter)#1 (0) {
- }
- [1]=>
- float(1.1)
- [2]=>
- string(1) "1"
-}
-== didn't crash ==
diff --git a/ext/intl/tests/symfony_format_type_int32_intl3.phpt b/ext/intl/tests/symfony_format_type_int32_intl3.phpt
deleted file mode 100644
index 5e657db419..0000000000
--- a/ext/intl/tests/symfony_format_type_int32_intl3.phpt
+++ /dev/null
@@ -1,32 +0,0 @@
---TEST--
-Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #3
---SKIPIF--
-<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
---FILE--
-<?php
-
-
-// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt32Intl
-$unit_test_args = unserialize('a:4:{i:0;O:15:"NumberFormatter":0:{}i:1;d:2147483648;i:2;s:14:"-2,147,483,648";i:3;s:83:"->format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range.";}');
-
-var_dump($unit_test_args);
-
-// execute the code from #testFormatTypeInt32Intl
-$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32);
-
-echo "== didn't crash ==".PHP_EOL;
-
-?>
---EXPECT--
-array(4) {
- [0]=>
- object(NumberFormatter)#1 (0) {
- }
- [1]=>
- float(2147483648)
- [2]=>
- string(14) "-2,147,483,648"
- [3]=>
- string(83) "->format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range."
-}
-== didn't crash ==
diff --git a/ext/intl/tests/symfony_format_type_int32_intl4.phpt b/ext/intl/tests/symfony_format_type_int32_intl4.phpt
deleted file mode 100644
index 54043d92e9..0000000000
--- a/ext/intl/tests/symfony_format_type_int32_intl4.phpt
+++ /dev/null
@@ -1,30 +0,0 @@
---TEST--
-Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #4
---SKIPIF--
-<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
---FILE--
-<?php
-
-
-// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt32Intl
-$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;i:1;i:2;s:7:"SFD1.00";}');
-
-var_dump($unit_test_args);
-
-// execute the code from #testFormatTypeInt32Intl
-$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32);
-
-echo "== didn't crash ==".PHP_EOL;
-
-?>
---EXPECT--
-array(3) {
- [0]=>
- object(NumberFormatter)#1 (0) {
- }
- [1]=>
- int(1)
- [2]=>
- string(7) "SFD1.00"
-}
-== didn't crash ==
diff --git a/ext/intl/tests/symfony_format_type_int32_intl5.phpt b/ext/intl/tests/symfony_format_type_int32_intl5.phpt
deleted file mode 100644
index d5f78d7119..0000000000
--- a/ext/intl/tests/symfony_format_type_int32_intl5.phpt
+++ /dev/null
@@ -1,30 +0,0 @@
---TEST--
-Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #5
---SKIPIF--
-<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
---FILE--
-<?php
-
-
-// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt32Intl
-$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:1.1000000000000001;i:2;s:7:"SFD1.00";}');
-
-var_dump($unit_test_args);
-
-// execute the code from #testFormatTypeInt32Intl
-$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32);
-
-echo "== didn't crash ==".PHP_EOL;
-
-?>
---EXPECT--
-array(3) {
- [0]=>
- object(NumberFormatter)#1 (0) {
- }
- [1]=>
- float(1.1)
- [2]=>
- string(7) "SFD1.00"
-}
-== didn't crash ==
diff --git a/ext/intl/tests/symfony_format_type_int32_intl6.phpt b/ext/intl/tests/symfony_format_type_int32_intl6.phpt
deleted file mode 100644
index fa708799d1..0000000000
--- a/ext/intl/tests/symfony_format_type_int32_intl6.phpt
+++ /dev/null
@@ -1,32 +0,0 @@
---TEST--
-Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #6
---SKIPIF--
-<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
---FILE--
-<?php
-
-
-// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt32Intl
-$unit_test_args = unserialize('a:4:{i:0;O:15:"NumberFormatter":0:{}i:1;d:2147483648;i:2;s:21:"(SFD2,147,483,648.00)";i:3;s:83:"->format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range.";}');
-
-var_dump($unit_test_args);
-
-// execute the code from #testFormatTypeInt32Intl
-$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32);
-
-echo "== didn't crash ==".PHP_EOL;
-
-?>
---EXPECT--
-array(4) {
- [0]=>
- object(NumberFormatter)#1 (0) {
- }
- [1]=>
- float(2147483648)
- [2]=>
- string(21) "(SFD2,147,483,648.00)"
- [3]=>
- string(83) "->format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range."
-}
-== didn't crash ==
diff --git a/ext/intl/tests/symfony_format_type_int32_intl7.phpt b/ext/intl/tests/symfony_format_type_int32_intl7.phpt
deleted file mode 100644
index 5bbe426677..0000000000
--- a/ext/intl/tests/symfony_format_type_int32_intl7.phpt
+++ /dev/null
@@ -1,32 +0,0 @@
---TEST--
-Symfony StubNumberFormatterTest#testFormatTypeInt32Intl #7
---SKIPIF--
-<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
---FILE--
-<?php
-
-
-// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt32Intl
-$unit_test_args = unserialize('a:4:{i:0;O:15:"NumberFormatter":0:{}i:1;d:-2147483649;i:2;s:19:"SFD2,147,483,647.00";i:3;s:83:"->format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range.";}');
-
-var_dump($unit_test_args);
-
-// execute the code from #testFormatTypeInt32Intl
-$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT32);
-
-echo "== didn't crash ==".PHP_EOL;
-
-?>
---EXPECT--
-array(4) {
- [0]=>
- object(NumberFormatter)#1 (0) {
- }
- [1]=>
- float(-2147483649)
- [2]=>
- string(19) "SFD2,147,483,647.00"
- [3]=>
- string(83) "->format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range."
-}
-== didn't crash ==
diff --git a/ext/intl/tests/symfony_format_type_int64_intl1.phpt b/ext/intl/tests/symfony_format_type_int64_intl1.phpt
deleted file mode 100644
index 01f5820911..0000000000
--- a/ext/intl/tests/symfony_format_type_int64_intl1.phpt
+++ /dev/null
@@ -1,30 +0,0 @@
---TEST--
-Symfony StubNumberFormatterTest#testFormatTypeInt64Intl #1
---SKIPIF--
-<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
---FILE--
-<?php
-
-
-// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt64Intl
-$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;i:1;i:2;s:1:"1";}');
-
-var_dump($unit_test_args);
-
-// execute the code from #testFormatTypeInt64Intl
-//$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64);
-
-echo "== didn't crash ==".PHP_EOL;
-
-?>
---EXPECT--
-array(3) {
- [0]=>
- object(NumberFormatter)#1 (0) {
- }
- [1]=>
- int(1)
- [2]=>
- string(1) "1"
-}
-== didn't crash ==
diff --git a/ext/intl/tests/symfony_format_type_int64_intl2.phpt b/ext/intl/tests/symfony_format_type_int64_intl2.phpt
deleted file mode 100644
index 13d1cdaee7..0000000000
--- a/ext/intl/tests/symfony_format_type_int64_intl2.phpt
+++ /dev/null
@@ -1,30 +0,0 @@
---TEST--
-Symfony StubNumberFormatterTest#testFormatTypeInt64Intl #2
---SKIPIF--
-<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
---FILE--
-<?php
-
-
-// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt64Intl
-$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:1.1000000000000001;i:2;s:1:"1";}');
-
-var_dump($unit_test_args);
-
-// execute the code from #testFormatTypeInt64Intl
-$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64);
-
-echo "== didn't crash ==".PHP_EOL;
-
-?>
---EXPECT--
-array(3) {
- [0]=>
- object(NumberFormatter)#1 (0) {
- }
- [1]=>
- float(1.1)
- [2]=>
- string(1) "1"
-}
-== didn't crash ==
diff --git a/ext/intl/tests/symfony_format_type_int64_intl3.phpt b/ext/intl/tests/symfony_format_type_int64_intl3.phpt
deleted file mode 100644
index a7c80b34c3..0000000000
--- a/ext/intl/tests/symfony_format_type_int64_intl3.phpt
+++ /dev/null
@@ -1,30 +0,0 @@
---TEST--
-Symfony StubNumberFormatterTest#testFormatTypeInt64Intl #3
---SKIPIF--
-<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
---FILE--
-<?php
-
-
-// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt64Intl
-$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:2147483648;i:2;s:13:"2,147,483,648";}');
-
-var_dump($unit_test_args);
-
-// execute the code from #testFormatTypeInt64Intl
-$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64);
-
-echo "== didn't crash ==".PHP_EOL;
-
-?>
---EXPECT--
-array(3) {
- [0]=>
- object(NumberFormatter)#1 (0) {
- }
- [1]=>
- float(2147483648)
- [2]=>
- string(13) "2,147,483,648"
-}
-== didn't crash ==
diff --git a/ext/intl/tests/symfony_format_type_int64_intl4.phpt b/ext/intl/tests/symfony_format_type_int64_intl4.phpt
deleted file mode 100644
index f1a0801edf..0000000000
--- a/ext/intl/tests/symfony_format_type_int64_intl4.phpt
+++ /dev/null
@@ -1,30 +0,0 @@
---TEST--
-Symfony StubNumberFormatterTest#testFormatTypeInt64Intl #4
---SKIPIF--
-<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
---FILE--
-<?php
-
-
-// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt64Intl
-$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:-2147483649;i:2;s:14:"-2,147,483,649";}');
-
-var_dump($unit_test_args);
-
-// execute the code from #testFormatTypeInt64Intl
-$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64);
-
-echo "== didn't crash ==".PHP_EOL;
-
-?>
---EXPECT--
-array(3) {
- [0]=>
- object(NumberFormatter)#1 (0) {
- }
- [1]=>
- float(-2147483649)
- [2]=>
- string(14) "-2,147,483,649"
-}
-== didn't crash ==
diff --git a/ext/intl/tests/symfony_format_type_int64_intl5.phpt b/ext/intl/tests/symfony_format_type_int64_intl5.phpt
deleted file mode 100644
index dad8735b89..0000000000
--- a/ext/intl/tests/symfony_format_type_int64_intl5.phpt
+++ /dev/null
@@ -1,30 +0,0 @@
---TEST--
-Symfony StubNumberFormatterTest#testFormatTypeInt64Intl #5
---SKIPIF--
-<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
---FILE--
-<?php
-
-
-// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt64Intl
-$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;i:1;i:2;s:7:"SFD1.00";}');
-
-var_dump($unit_test_args);
-
-// execute the code from #testFormatTypeInt64Intl
-$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64);
-
-echo "== didn't crash ==".PHP_EOL;
-
-?>
---EXPECT--
-array(3) {
- [0]=>
- object(NumberFormatter)#1 (0) {
- }
- [1]=>
- int(1)
- [2]=>
- string(7) "SFD1.00"
-}
-== didn't crash ==
diff --git a/ext/intl/tests/symfony_format_type_int64_intl6.phpt b/ext/intl/tests/symfony_format_type_int64_intl6.phpt
deleted file mode 100644
index f038cbd0c3..0000000000
--- a/ext/intl/tests/symfony_format_type_int64_intl6.phpt
+++ /dev/null
@@ -1,30 +0,0 @@
---TEST--
-Symfony StubNumberFormatterTest#testFormatTypeInt64Intl #6
---SKIPIF--
-<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
---FILE--
-<?php
-
-
-// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt64Intl
-$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:1.1000000000000001;i:2;s:7:"SFD1.00";}');
-
-var_dump($unit_test_args);
-
-// execute the code from #testFormatTypeInt64Intl
-$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64);
-
-echo "== didn't crash ==".PHP_EOL;
-
-?>
---EXPECT--
-array(3) {
- [0]=>
- object(NumberFormatter)#1 (0) {
- }
- [1]=>
- float(1.1)
- [2]=>
- string(7) "SFD1.00"
-}
-== didn't crash ==
diff --git a/ext/intl/tests/symfony_format_type_int64_intl7.phpt b/ext/intl/tests/symfony_format_type_int64_intl7.phpt
deleted file mode 100644
index 9c8853cafc..0000000000
--- a/ext/intl/tests/symfony_format_type_int64_intl7.phpt
+++ /dev/null
@@ -1,30 +0,0 @@
---TEST--
-Symfony StubNumberFormatterTest#testFormatTypeInt64Intl #7
---SKIPIF--
-<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
---FILE--
-<?php
-
-
-// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt64Intl
-$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:2147483648;i:2;s:19:"SFD2,147,483,648.00";}');
-
-var_dump($unit_test_args);
-
-// execute the code from #testFormatTypeInt64Intl
-$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64);
-
-echo "== didn't crash ==".PHP_EOL;
-
-?>
---EXPECT--
-array(3) {
- [0]=>
- object(NumberFormatter)#1 (0) {
- }
- [1]=>
- float(2147483648)
- [2]=>
- string(19) "SFD2,147,483,648.00"
-}
-== didn't crash ==
diff --git a/ext/intl/tests/symfony_format_type_int64_intl8.phpt b/ext/intl/tests/symfony_format_type_int64_intl8.phpt
deleted file mode 100644
index 50524976ab..0000000000
--- a/ext/intl/tests/symfony_format_type_int64_intl8.phpt
+++ /dev/null
@@ -1,30 +0,0 @@
---TEST--
-Symfony StubNumberFormatterTest#testFormatTypeInt64Intl #8
---SKIPIF--
-<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
---FILE--
-<?php
-
-
-// PHP Unit's code to unserialize data passed as args to #testFormatTypeInt64Intl
-$unit_test_args = unserialize('a:3:{i:0;O:15:"NumberFormatter":0:{}i:1;d:-2147483649;i:2;s:21:"(SFD2,147,483,649.00)";}');
-
-var_dump($unit_test_args);
-
-// execute the code from #testFormatTypeInt64Intl
-$unit_test_args[0]->format($unit_test_args[1], \NumberFormatter::TYPE_INT64);
-
-echo "== didn't crash ==".PHP_EOL;
-
-?>
---EXPECT--
-array(3) {
- [0]=>
- object(NumberFormatter)#1 (0) {
- }
- [1]=>
- float(-2147483649)
- [2]=>
- string(21) "(SFD2,147,483,649.00)"
-}
-== didn't crash ==
diff --git a/ext/intl/tests/timezone_clone_basic.phpt b/ext/intl/tests/timezone_clone_basic.phpt
index a8ef83f864..4a5a58f718 100644
--- a/ext/intl/tests/timezone_clone_basic.phpt
+++ b/ext/intl/tests/timezone_clone_basic.phpt
@@ -18,7 +18,6 @@ print_r($gmt);
print_r(clone $gmt);
?>
-==DONE==
--EXPECTF--
IntlTimeZone Object
(
@@ -47,5 +46,4 @@ IntlTimeZone Object
[id] => GMT
[rawOffset] => 0
[currentOffset] => 0
-)
-==DONE== \ No newline at end of file
+) \ No newline at end of file
diff --git a/ext/intl/tests/timezone_clone_error.phpt b/ext/intl/tests/timezone_clone_error.phpt
index df501be3b4..8df6a8ffe3 100644
--- a/ext/intl/tests/timezone_clone_error.phpt
+++ b/ext/intl/tests/timezone_clone_error.phpt
@@ -17,16 +17,14 @@ var_dump($tz);
try {
var_dump(clone $tz);
} catch (Exception $e) {
- var_dump(get_class($e), $e->getMessage());
+ var_dump(get_class($e), $e->getMessage());
}
?>
-==DONE==
--EXPECT--
object(A)#1 (1) {
["valid"]=>
bool(false)
}
string(9) "Exception"
-string(39) "Cannot clone unconstructed IntlTimeZone"
-==DONE== \ No newline at end of file
+string(39) "Cannot clone unconstructed IntlTimeZone" \ No newline at end of file
diff --git a/ext/intl/tests/timezone_countEquivalentIDs_basic.phpt b/ext/intl/tests/timezone_countEquivalentIDs_basic.phpt
index ec3e4050ab..7a7eef0a72 100644
--- a/ext/intl/tests/timezone_countEquivalentIDs_basic.phpt
+++ b/ext/intl/tests/timezone_countEquivalentIDs_basic.phpt
@@ -13,8 +13,6 @@ var_dump($count >= 2);
$count2 = intltz_count_equivalent_ids('Europe/Lisbon');
var_dump($count2 == $count);
?>
-==DONE==
--EXPECT--
bool(true)
-bool(true)
-==DONE== \ No newline at end of file
+bool(true) \ No newline at end of file
diff --git a/ext/intl/tests/timezone_countEquivalentIDs_error.phpt b/ext/intl/tests/timezone_countEquivalentIDs_error.phpt
index 3087f49cbe..4fc9b02a1d 100644
--- a/ext/intl/tests/timezone_countEquivalentIDs_error.phpt
+++ b/ext/intl/tests/timezone_countEquivalentIDs_error.phpt
@@ -8,25 +8,7 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-var_dump(IntlTimeZone::countEquivalentIDs());
-var_dump(IntlTimeZone::countEquivalentIDs(array()));
var_dump(IntlTimeZone::countEquivalentIDs("foo\x80"));
-var_dump(IntlTimeZone::countEquivalentIDs("foo bar", 7));
--EXPECTF--
-Warning: IntlTimeZone::countEquivalentIDs() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlTimeZone::countEquivalentIDs(): intltz_count_equivalent_ids: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlTimeZone::countEquivalentIDs() expects parameter 1 to be string, array given in %s on line %d
-
-Warning: IntlTimeZone::countEquivalentIDs(): intltz_count_equivalent_ids: bad arguments in %s on line %d
-bool(false)
-
Warning: IntlTimeZone::countEquivalentIDs(): intltz_count_equivalent_ids: could not convert time zone id to UTF-16 in %s on line %d
bool(false)
-
-Warning: IntlTimeZone::countEquivalentIDs() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlTimeZone::countEquivalentIDs(): intltz_count_equivalent_ids: bad arguments in %s on line %d
-bool(false)
diff --git a/ext/intl/tests/timezone_createDefault_basic.phpt b/ext/intl/tests/timezone_createDefault_basic.phpt
index f8e3158cec..0a188df11e 100644
--- a/ext/intl/tests/timezone_createDefault_basic.phpt
+++ b/ext/intl/tests/timezone_createDefault_basic.phpt
@@ -12,7 +12,6 @@ print_r($tz);
$tz = intltz_create_default();
print_r($tz);
?>
-==DONE==
--EXPECTF--
IntlTimeZone Object
(
@@ -28,4 +27,3 @@ IntlTimeZone Object
[rawOffset] => %i
[currentOffset] => %i
)
-==DONE==
diff --git a/ext/intl/tests/timezone_createDefault_error.phpt b/ext/intl/tests/timezone_createDefault_error.phpt
deleted file mode 100644
index f2f2e021b9..0000000000
--- a/ext/intl/tests/timezone_createDefault_error.phpt
+++ /dev/null
@@ -1,16 +0,0 @@
---TEST--
-IntlTimeZone::createDefault(): errors
---SKIPIF--
-<?php
-if (!extension_loaded('intl'))
- die('skip intl extension not enabled');
---FILE--
-<?php
-ini_set("intl.error_level", E_WARNING);
-
-var_dump(IntlTimeZone::createDefault(4));
---EXPECTF--
-Warning: IntlTimeZone::createDefault() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlTimeZone::createDefault(): intltz_create_default: bad arguments in %s on line %d
-NULL
diff --git a/ext/intl/tests/timezone_createEnumeration_basic.phpt b/ext/intl/tests/timezone_createEnumeration_basic.phpt
index 2df32562b1..4500aef976 100644
--- a/ext/intl/tests/timezone_createEnumeration_basic.phpt
+++ b/ext/intl/tests/timezone_createEnumeration_basic.phpt
@@ -17,10 +17,8 @@ var_dump(get_class($tz));
$count2 = count(iterator_to_array($tz));
var_dump($count == $count2);
?>
-==DONE==
--EXPECT--
string(12) "IntlIterator"
bool(true)
string(12) "IntlIterator"
-bool(true)
-==DONE== \ No newline at end of file
+bool(true) \ No newline at end of file
diff --git a/ext/intl/tests/timezone_createEnumeration_error.phpt b/ext/intl/tests/timezone_createEnumeration_error.phpt
index ea92e28d95..4e190129d4 100644
--- a/ext/intl/tests/timezone_createEnumeration_error.phpt
+++ b/ext/intl/tests/timezone_createEnumeration_error.phpt
@@ -9,12 +9,7 @@ if (!extension_loaded('intl'))
ini_set("intl.error_level", E_WARNING);
var_dump(IntlTimeZone::createEnumeration(array()));
-var_dump(IntlTimeZone::createEnumeration(1, 2));
+?>
--EXPECTF--
Warning: IntlTimeZone::createEnumeration(): intltz_create_enumeration: invalid argument type in %s on line %d
bool(false)
-
-Warning: IntlTimeZone::createEnumeration() expects at most 1 parameter, 2 given in %s on line %d
-
-Warning: IntlTimeZone::createEnumeration(): intltz_create_enumeration: bad arguments in %s on line %d
-bool(false)
diff --git a/ext/intl/tests/timezone_createEnumeration_variation1.phpt b/ext/intl/tests/timezone_createEnumeration_variation1.phpt
index 30fc43660e..19a5521a68 100644
--- a/ext/intl/tests/timezone_createEnumeration_variation1.phpt
+++ b/ext/intl/tests/timezone_createEnumeration_variation1.phpt
@@ -16,9 +16,7 @@ $tz->rewind();
var_dump(in_array('Europe/Amsterdam', iterator_to_array($tz)));
?>
-==DONE==
--EXPECT--
string(12) "IntlIterator"
bool(true)
-bool(true)
-==DONE== \ No newline at end of file
+bool(true) \ No newline at end of file
diff --git a/ext/intl/tests/timezone_createEnumeration_variation2.phpt b/ext/intl/tests/timezone_createEnumeration_variation2.phpt
index ddf1a6ece1..c035521322 100644
--- a/ext/intl/tests/timezone_createEnumeration_variation2.phpt
+++ b/ext/intl/tests/timezone_createEnumeration_variation2.phpt
@@ -16,9 +16,7 @@ $tz->rewind();
var_dump(in_array('Europe/Amsterdam', iterator_to_array($tz)));
?>
-==DONE==
--EXPECT--
string(12) "IntlIterator"
bool(true)
-bool(true)
-==DONE== \ No newline at end of file
+bool(true) \ No newline at end of file
diff --git a/ext/intl/tests/timezone_createTimeZoneIDEnumeration_basic.phpt b/ext/intl/tests/timezone_createTimeZoneIDEnumeration_basic.phpt
index 4bcc12f26c..985957d3ca 100644
--- a/ext/intl/tests/timezone_createTimeZoneIDEnumeration_basic.phpt
+++ b/ext/intl/tests/timezone_createTimeZoneIDEnumeration_basic.phpt
@@ -8,18 +8,17 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
$enum = IntlTimeZone::createTimeZoneIDEnumeration(
- IntlTimeZone::TYPE_ANY,
- 'PT',
- -3600000);
+ IntlTimeZone::TYPE_ANY,
+ 'PT',
+ -3600000);
print_r(iterator_to_array($enum));
$enum = intltz_create_time_zone_id_enumeration(
- IntlTimeZone::TYPE_ANY,
- 'PT',
- -3600000);
+ IntlTimeZone::TYPE_ANY,
+ 'PT',
+ -3600000);
print_r(iterator_to_array($enum));
?>
-==DONE==
--EXPECT--
Array
(
@@ -29,4 +28,3 @@ Array
(
[0] => Atlantic/Azores
)
-==DONE==
diff --git a/ext/intl/tests/timezone_createTimeZoneIDEnumeration_error.phpt b/ext/intl/tests/timezone_createTimeZoneIDEnumeration_error.phpt
index 5edfaeaf6b..2b847ec841 100644
--- a/ext/intl/tests/timezone_createTimeZoneIDEnumeration_error.phpt
+++ b/ext/intl/tests/timezone_createTimeZoneIDEnumeration_error.phpt
@@ -8,31 +8,7 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-var_dump(IntlTimeZone::createTimeZoneIDEnumeration());
-var_dump(IntlTimeZone::createTimeZoneIDEnumeration(array()));
var_dump(IntlTimeZone::createTimeZoneIDEnumeration(-1));
-var_dump(IntlTimeZone::createTimeZoneIDEnumeration(IntlTimeZone::TYPE_ANY, array()));
-var_dump(IntlTimeZone::createTimeZoneIDEnumeration(IntlTimeZone::TYPE_ANY, "PT", "a80"));
--EXPECTF--
-Warning: IntlTimeZone::createTimeZoneIDEnumeration() expects at least 1 parameter, 0 given in %s on line %d
-
-Warning: IntlTimeZone::createTimeZoneIDEnumeration(): intltz_create_time_zone_id_enumeration: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlTimeZone::createTimeZoneIDEnumeration() expects parameter 1 to be int, array given in %s on line %d
-
-Warning: IntlTimeZone::createTimeZoneIDEnumeration(): intltz_create_time_zone_id_enumeration: bad arguments in %s on line %d
-bool(false)
-
Warning: IntlTimeZone::createTimeZoneIDEnumeration(): intltz_create_time_zone_id_enumeration: bad zone type in %s on line %d
bool(false)
-
-Warning: IntlTimeZone::createTimeZoneIDEnumeration() expects parameter 2 to be string, array given in %s on line %d
-
-Warning: IntlTimeZone::createTimeZoneIDEnumeration(): intltz_create_time_zone_id_enumeration: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlTimeZone::createTimeZoneIDEnumeration() expects parameter 3 to be int, string given in %s on line %d
-
-Warning: IntlTimeZone::createTimeZoneIDEnumeration(): intltz_create_time_zone_id_enumeration: bad arguments in %s on line %d
-bool(false)
diff --git a/ext/intl/tests/timezone_createTimeZoneIDEnumeration_variant1.phpt b/ext/intl/tests/timezone_createTimeZoneIDEnumeration_variant1.phpt
index 05fc404442..84711ff57f 100644
--- a/ext/intl/tests/timezone_createTimeZoneIDEnumeration_variant1.phpt
+++ b/ext/intl/tests/timezone_createTimeZoneIDEnumeration_variant1.phpt
@@ -8,23 +8,21 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
$enum = IntlTimeZone::createTimeZoneIDEnumeration(
- IntlTimeZone::TYPE_ANY,
- 'PT');
+ IntlTimeZone::TYPE_ANY,
+ 'PT');
$values = iterator_to_array($enum);
var_dump(in_array('Europe/Lisbon', $values));
var_dump(in_array('Atlantic/Azores', $values));
$enum = IntlTimeZone::createTimeZoneIDEnumeration(
- IntlTimeZone::TYPE_ANY,
- 'PT',
- null);
+ IntlTimeZone::TYPE_ANY,
+ 'PT',
+ null);
$values2 = iterator_to_array($enum);
var_dump($values2 == $values);
?>
-==DONE==
--EXPECT--
bool(true)
bool(true)
bool(true)
-==DONE==
diff --git a/ext/intl/tests/timezone_createTimeZoneIDEnumeration_variant2.phpt b/ext/intl/tests/timezone_createTimeZoneIDEnumeration_variant2.phpt
index a21b9a703d..4d37fe3e64 100644
--- a/ext/intl/tests/timezone_createTimeZoneIDEnumeration_variant2.phpt
+++ b/ext/intl/tests/timezone_createTimeZoneIDEnumeration_variant2.phpt
@@ -8,25 +8,25 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
$enum = IntlTimeZone::createTimeZoneIDEnumeration(
- IntlTimeZone::TYPE_ANY);
+ IntlTimeZone::TYPE_ANY);
$countAny = count(iterator_to_array($enum));
$enum = IntlTimeZone::createTimeZoneIDEnumeration(
- IntlTimeZone::TYPE_CANONICAL);
+ IntlTimeZone::TYPE_CANONICAL);
$countCanonical = count(iterator_to_array($enum));
$enum = IntlTimeZone::createTimeZoneIDEnumeration(
- IntlTimeZone::TYPE_CANONICAL_LOCATION);
+ IntlTimeZone::TYPE_CANONICAL_LOCATION);
$countCanonicalLocation = count(iterator_to_array($enum));
var_dump($countAny > $countCanonical);
var_dump($countCanonical > $countCanonicalLocation);
$enum = IntlTimeZone::createTimeZoneIDEnumeration(
- IntlTimeZone::TYPE_ANY, null, null);
+ IntlTimeZone::TYPE_ANY, null, null);
$countAny2 = count(iterator_to_array($enum));
var_dump($countAny == $countAny2);
$enum = IntlTimeZone::createTimeZoneIDEnumeration(
- IntlTimeZone::TYPE_ANY, null, -3600000);
+ IntlTimeZone::TYPE_ANY, null, -3600000);
$values = iterator_to_array($enum);
print_r(
@@ -37,7 +37,6 @@ array('Etc/GMT+1', 'Atlantic/Azores'))
?>
-==DONE==
--EXPECT--
bool(true)
bool(true)
@@ -47,4 +46,3 @@ Array
[0] => Atlantic/Azores
[1] => Etc/GMT+1
)
-==DONE==
diff --git a/ext/intl/tests/timezone_createTimeZone_basic.phpt b/ext/intl/tests/timezone_createTimeZone_basic.phpt
index 88b83150d9..e58d7749d9 100644
--- a/ext/intl/tests/timezone_createTimeZone_basic.phpt
+++ b/ext/intl/tests/timezone_createTimeZone_basic.phpt
@@ -12,7 +12,6 @@ print_r($tz);
$tz = intltz_create_time_zone('GMT+01:00');
print_r($tz);
?>
-==DONE==
--EXPECT--
IntlTimeZone Object
(
@@ -28,4 +27,3 @@ IntlTimeZone Object
[rawOffset] => 3600000
[currentOffset] => 3600000
)
-==DONE==
diff --git a/ext/intl/tests/timezone_createTimeZone_error.phpt b/ext/intl/tests/timezone_createTimeZone_error.phpt
index 553223ee4c..a06f26b128 100644
--- a/ext/intl/tests/timezone_createTimeZone_error.phpt
+++ b/ext/intl/tests/timezone_createTimeZone_error.phpt
@@ -8,25 +8,8 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-var_dump(IntlTimeZone::createTimeZone());
-var_dump(IntlTimeZone::createTimeZone(new stdClass));
-var_dump(IntlTimeZone::createTimeZone("foo bar", 4));
var_dump(IntlTimeZone::createTimeZone("foo\x80"));
+?>
--EXPECTF--
-Warning: IntlTimeZone::createTimeZone() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlTimeZone::createTimeZone(): intltz_create_time_zone: bad arguments in %s on line %d
-NULL
-
-Warning: IntlTimeZone::createTimeZone() expects parameter 1 to be string, object given in %s on line %d
-
-Warning: IntlTimeZone::createTimeZone(): intltz_create_time_zone: bad arguments in %s on line %d
-NULL
-
-Warning: IntlTimeZone::createTimeZone() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlTimeZone::createTimeZone(): intltz_create_time_zone: bad arguments in %s on line %d
-NULL
-
Warning: IntlTimeZone::createTimeZone(): intltz_create_time_zone: could not convert time zone id to UTF-16 in %s on line %d
NULL
diff --git a/ext/intl/tests/timezone_equals_basic.phpt b/ext/intl/tests/timezone_equals_basic.phpt
index 105ae8582f..20703f5494 100644
--- a/ext/intl/tests/timezone_equals_basic.phpt
+++ b/ext/intl/tests/timezone_equals_basic.phpt
@@ -20,7 +20,6 @@ echo "Comparison to GMT:\n";
var_dump($tz1 == intltz_get_gmt());
?>
-==DONE==
--EXPECT--
Comparison to self:
bool(true)
@@ -29,5 +28,4 @@ bool(true)
Comparison to equivalent instance:
bool(false)
Comparison to GMT:
-bool(false)
-==DONE== \ No newline at end of file
+bool(false) \ No newline at end of file
diff --git a/ext/intl/tests/timezone_equals_error.phpt b/ext/intl/tests/timezone_equals_error.phpt
index d8d027a761..3d489d14a6 100644
--- a/ext/intl/tests/timezone_equals_error.phpt
+++ b/ext/intl/tests/timezone_equals_error.phpt
@@ -18,11 +18,10 @@ var_dump($tz, $tz2);
try {
var_dump($tz == $tz2);
} catch (Exception $e) {
- var_dump(get_class($e), $e->getMessage());
+ var_dump(get_class($e), $e->getMessage());
}
?>
-==DONE==
--EXPECT--
object(A)#1 (1) {
["valid"]=>
@@ -39,5 +38,4 @@ object(IntlTimeZone)#2 (4) {
int(0)
}
string(9) "Exception"
-string(63) "Comparison with at least one unconstructed IntlTimeZone operand"
-==DONE== \ No newline at end of file
+string(63) "Comparison with at least one unconstructed IntlTimeZone operand" \ No newline at end of file
diff --git a/ext/intl/tests/timezone_fromDateTimeZone_error.phpt b/ext/intl/tests/timezone_fromDateTimeZone_error.phpt
index f50e59f97c..54a70d1f17 100644
--- a/ext/intl/tests/timezone_fromDateTimeZone_error.phpt
+++ b/ext/intl/tests/timezone_fromDateTimeZone_error.phpt
@@ -10,39 +10,9 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-var_dump(IntlTimeZone::fromDateTimeZone());
-var_dump(IntlTimeZone::fromDateTimeZone(1,2));
-var_dump(IntlTimeZone::fromDateTimeZone('sdfds'));
-var_dump(IntlTimeZone::fromDateTimeZone(new stdclass));
$dt = new DateTime('2012-08-01 00:00:00 WEST');
var_dump(IntlTimeZone::fromDateTimeZone($dt->getTimeZone()));
-
-var_dump(intltz_from_date_time_zone());
+?>
--EXPECTF--
-Warning: IntlTimeZone::fromDateTimeZone() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlTimeZone::fromDateTimeZone(): intltz_from_date_time_zone: bad arguments in %s on line %d
-NULL
-
-Warning: IntlTimeZone::fromDateTimeZone() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlTimeZone::fromDateTimeZone(): intltz_from_date_time_zone: bad arguments in %s on line %d
-NULL
-
-Warning: IntlTimeZone::fromDateTimeZone() expects parameter 1 to be DateTimeZone, string given in %s on line %d
-
-Warning: IntlTimeZone::fromDateTimeZone(): intltz_from_date_time_zone: bad arguments in %s on line %d
-NULL
-
-Warning: IntlTimeZone::fromDateTimeZone() expects parameter 1 to be DateTimeZone, object given in %s on line %d
-
-Warning: IntlTimeZone::fromDateTimeZone(): intltz_from_date_time_zone: bad arguments in %s on line %d
-NULL
-
Warning: IntlTimeZone::fromDateTimeZone(): intltz_from_date_time_zone: time zone id 'WEST' extracted from ext/date DateTimeZone not recognized in %s on line %d
NULL
-
-Warning: intltz_from_date_time_zone() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: intltz_from_date_time_zone(): intltz_from_date_time_zone: bad arguments in %s on line %d
-NULL
diff --git a/ext/intl/tests/timezone_getCanonicalID_basic.phpt b/ext/intl/tests/timezone_getCanonicalID_basic.phpt
index 897e9a9edc..1ed775ac52 100644
--- a/ext/intl/tests/timezone_getCanonicalID_basic.phpt
+++ b/ext/intl/tests/timezone_getCanonicalID_basic.phpt
@@ -12,8 +12,6 @@ echo "\n";
print_R(intltz_get_canonical_id('Portugal'));
echo "\n";
?>
-==DONE==
--EXPECT--
Europe/Lisbon
-Europe/Lisbon
-==DONE== \ No newline at end of file
+Europe/Lisbon \ No newline at end of file
diff --git a/ext/intl/tests/timezone_getCanonicalID_error.phpt b/ext/intl/tests/timezone_getCanonicalID_error.phpt
index 684d946b1e..c1f7b6927a 100644
--- a/ext/intl/tests/timezone_getCanonicalID_error.phpt
+++ b/ext/intl/tests/timezone_getCanonicalID_error.phpt
@@ -8,19 +8,8 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-var_dump(IntlTimeZone::getCanonicalID());
-var_dump(IntlTimeZone::getCanonicalID(array()));
var_dump(IntlTimeZone::getCanonicalID("foo\x81"));
+?>
--EXPECTF--
-Warning: IntlTimeZone::getCanonicalID() expects at least 1 parameter, 0 given in %s on line %d
-
-Warning: IntlTimeZone::getCanonicalID(): intltz_get_canonical_id: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlTimeZone::getCanonicalID() expects parameter 1 to be string, array given in %s on line %d
-
-Warning: IntlTimeZone::getCanonicalID(): intltz_get_canonical_id: bad arguments in %s on line %d
-bool(false)
-
Warning: IntlTimeZone::getCanonicalID(): intltz_get_canonical_id: could not convert time zone id to UTF-16 in %s on line %d
bool(false)
diff --git a/ext/intl/tests/timezone_getCanonicalID_variant1.phpt b/ext/intl/tests/timezone_getCanonicalID_variant1.phpt
index 182fe15b60..8ad31d18ad 100644
--- a/ext/intl/tests/timezone_getCanonicalID_variant1.phpt
+++ b/ext/intl/tests/timezone_getCanonicalID_variant1.phpt
@@ -14,10 +14,8 @@ var_dump(IntlTimeZone::getCanonicalID('GMT +01:25', $isSystemId));
var_dump($isSystemId);
?>
-==DONE==
--EXPECT--
string(13) "Europe/Lisbon"
bool(true)
string(0) ""
bool(false)
-==DONE==
diff --git a/ext/intl/tests/timezone_getCanonicalID_variant1_2.phpt b/ext/intl/tests/timezone_getCanonicalID_variant1_2.phpt
index b60924332a..f41902c580 100644
--- a/ext/intl/tests/timezone_getCanonicalID_variant1_2.phpt
+++ b/ext/intl/tests/timezone_getCanonicalID_variant1_2.phpt
@@ -15,7 +15,6 @@ var_dump(IntlTimeZone::getCanonicalID('GMT +01:25', $isSystemId));
var_dump($isSystemId);
?>
-==DONE==
--EXPECTF--
string(13) "Europe/Lisbon"
bool(true)
@@ -23,4 +22,3 @@ bool(true)
Warning: IntlTimeZone::getCanonicalID(): intltz_get_canonical_id: error obtaining canonical ID in %stimezone_getCanonicalID_variant1_2.php on line %d
bool(false)
bool(true)
-==DONE==
diff --git a/ext/intl/tests/timezone_getDSTSavings_basic.phpt b/ext/intl/tests/timezone_getDSTSavings_basic.phpt
index 8dee5b8e94..6828d9bc08 100644
--- a/ext/intl/tests/timezone_getDSTSavings_basic.phpt
+++ b/ext/intl/tests/timezone_getDSTSavings_basic.phpt
@@ -14,8 +14,6 @@ var_dump($lsb->getDSTSavings());
var_dump(intltz_get_dst_savings($lsb));
?>
-==DONE==
--EXPECT--
int(3600000)
-int(3600000)
-==DONE== \ No newline at end of file
+int(3600000) \ No newline at end of file
diff --git a/ext/intl/tests/timezone_getDSTSavings_error.phpt b/ext/intl/tests/timezone_getDSTSavings_error.phpt
index 9df04f08c1..c20da9021a 100644
--- a/ext/intl/tests/timezone_getDSTSavings_error.phpt
+++ b/ext/intl/tests/timezone_getDSTSavings_error.phpt
@@ -8,17 +8,10 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$tz = IntlTimeZone::createTimeZone('Europe/Lisbon');
-var_dump($tz->getDSTSavings(array()));
-
var_dump(intltz_get_dst_savings(null));
+?>
--EXPECTF--
-Warning: IntlTimeZone::getDSTSavings() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlTimeZone::getDSTSavings(): intltz_get_dst_savings: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intltz_get_dst_savings() must be an instance of IntlTimeZone, null given in %s:%d
+Fatal error: Uncaught TypeError: intltz_get_dst_savings() expects parameter 1 to be IntlTimeZone, null given in %s:%d
Stack trace:
#0 %s(%d): intltz_get_dst_savings(NULL)
#1 {main}
diff --git a/ext/intl/tests/timezone_getDisplayName_basic.phpt b/ext/intl/tests/timezone_getDisplayName_basic.phpt
index e4fc2f37ce..57fab25966 100644
--- a/ext/intl/tests/timezone_getDisplayName_basic.phpt
+++ b/ext/intl/tests/timezone_getDisplayName_basic.phpt
@@ -17,8 +17,6 @@ ini_set('intl.default_locale', 'pt_PT');
var_dump($lsb->getDisplayName());
?>
-==DONE==
--EXPECTF--
string(%d) "Western European%sTime"
-string(%d) "Hora%sda Europa Ocidental"
-==DONE== \ No newline at end of file
+string(%d) "Hora%sda Europa Ocidental" \ No newline at end of file
diff --git a/ext/intl/tests/timezone_getDisplayName_error.phpt b/ext/intl/tests/timezone_getDisplayName_error.phpt
index 8d30f8840f..7f8d913a17 100644
--- a/ext/intl/tests/timezone_getDisplayName_error.phpt
+++ b/ext/intl/tests/timezone_getDisplayName_error.phpt
@@ -9,38 +9,14 @@ if (!extension_loaded('intl'))
ini_set("intl.error_level", E_WARNING);
$tz = IntlTimeZone::createTimeZone('Europe/Lisbon');
-var_dump($tz->getDisplayName(array()));
-var_dump($tz->getDisplayName(false, array()));
var_dump($tz->getDisplayName(false, -1));
-var_dump($tz->getDisplayName(false, IntlTimeZone::DISPLAY_SHORT, array()));
-var_dump($tz->getDisplayName(false, IntlTimeZone::DISPLAY_SHORT, NULL, NULL));
var_dump(intltz_get_display_name(null, IntlTimeZone::DISPLAY_SHORT, false, 'pt_PT'));
--EXPECTF--
-Warning: IntlTimeZone::getDisplayName() expects parameter 1 to be bool, array given in %s on line %d
-
-Warning: IntlTimeZone::getDisplayName(): intltz_get_display_name: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlTimeZone::getDisplayName() expects parameter 2 to be int, array given in %s on line %d
-
-Warning: IntlTimeZone::getDisplayName(): intltz_get_display_name: bad arguments in %s on line %d
-bool(false)
-
Warning: IntlTimeZone::getDisplayName(): intltz_get_display_name: wrong display type in %s on line %d
bool(false)
-Warning: IntlTimeZone::getDisplayName() expects parameter 3 to be string, array given in %s on line %d
-
-Warning: IntlTimeZone::getDisplayName(): intltz_get_display_name: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlTimeZone::getDisplayName() expects at most 3 parameters, 4 given in %s on line %d
-
-Warning: IntlTimeZone::getDisplayName(): intltz_get_display_name: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intltz_get_display_name() must be an instance of IntlTimeZone, null given in %s:%d
+Fatal error: Uncaught TypeError: intltz_get_display_name() expects parameter 1 to be IntlTimeZone, null given in %s:%d
Stack trace:
#0 %s(%d): intltz_get_display_name(NULL, 1, false, 'pt_PT')
#1 {main}
diff --git a/ext/intl/tests/timezone_getDisplayName_variant1.phpt b/ext/intl/tests/timezone_getDisplayName_variant1.phpt
index 83922dd170..ebfb32cee4 100644
--- a/ext/intl/tests/timezone_getDisplayName_variant1.phpt
+++ b/ext/intl/tests/timezone_getDisplayName_variant1.phpt
@@ -18,9 +18,7 @@ var_dump($lsb->getDisplayName(false));
var_dump($lsb->getDisplayName(true));
?>
-==DONE==
--EXPECTF--
string(%d) "Western European%sTime"
string(%d) "Western European%sTime"
-string(28) "Western European Summer Time"
-==DONE== \ No newline at end of file
+string(28) "Western European Summer Time" \ No newline at end of file
diff --git a/ext/intl/tests/timezone_getDisplayName_variant2-49+.phpt b/ext/intl/tests/timezone_getDisplayName_variant2-49+.phpt
index 353b4ec8d6..41431950d3 100644
--- a/ext/intl/tests/timezone_getDisplayName_variant2-49+.phpt
+++ b/ext/intl/tests/timezone_getDisplayName_variant2-49+.phpt
@@ -22,7 +22,6 @@ var_dump($lsb->getDisplayName(false, IntlTimeZone::DISPLAY_SHORT_COMMONLY_USED))
var_dump($lsb->getDisplayName(false, IntlTimeZone::DISPLAY_GENERIC_LOCATION));
?>
-==DONE==
--EXPECT--
string(3) "GMT"
string(30) "Western European Standard Time"
@@ -32,4 +31,3 @@ string(5) "+0000"
string(3) "GMT"
string(3) "GMT"
string(22) "Portugal Time (Lisbon)"
-==DONE==
diff --git a/ext/intl/tests/timezone_getDisplayName_variant3-49+.phpt b/ext/intl/tests/timezone_getDisplayName_variant3-49+.phpt
index 74e6ed9b4d..7c5683639d 100644
--- a/ext/intl/tests/timezone_getDisplayName_variant3-49+.phpt
+++ b/ext/intl/tests/timezone_getDisplayName_variant3-49+.phpt
@@ -17,9 +17,7 @@ var_dump($lsb->getDisplayName(false, IntlTimeZone::DISPLAY_LONG, NULL));
var_dump($lsb->getDisplayName(false, IntlTimeZone::DISPLAY_LONG, 'pt_PT'));
?>
-==DONE==
--EXPECTF--
string(30) "Western European Standard Time"
string(30) "Western European Standard Time"
string(32) "Hora %cadrão da Europa Ocidental"
-==DONE==
diff --git a/ext/intl/tests/timezone_getDisplayName_variant4.phpt b/ext/intl/tests/timezone_getDisplayName_variant4.phpt
index c8379d34a0..a0ca6864db 100644
--- a/ext/intl/tests/timezone_getDisplayName_variant4.phpt
+++ b/ext/intl/tests/timezone_getDisplayName_variant4.phpt
@@ -22,7 +22,6 @@ var_dump($lsb->getDisplayName(false, IntlTimeZone::DISPLAY_SHORT_COMMONLY_USED))
var_dump($lsb->getDisplayName(false, IntlTimeZone::DISPLAY_GENERIC_LOCATION));
?>
-==DONE==
--EXPECT--
string(3) "GMT"
string(30) "Western European Standard Time"
@@ -32,4 +31,3 @@ string(5) "+0000"
string(3) "GMT"
string(3) "GMT"
string(13) "Portugal Time"
-==DONE==
diff --git a/ext/intl/tests/timezone_getEquivalentID_basic.phpt b/ext/intl/tests/timezone_getEquivalentID_basic.phpt
index 8af1e20897..45e0783a06 100644
--- a/ext/intl/tests/timezone_getEquivalentID_basic.phpt
+++ b/ext/intl/tests/timezone_getEquivalentID_basic.phpt
@@ -12,8 +12,6 @@ echo "\n";
print_R(intltz_get_equivalent_id('Europe/Lisbon', 1));
echo "\n";
?>
-==DONE==
--EXPECT--
Portugal
-Portugal
-==DONE== \ No newline at end of file
+Portugal \ No newline at end of file
diff --git a/ext/intl/tests/timezone_getEquivalentID_error.phpt b/ext/intl/tests/timezone_getEquivalentID_error.phpt
index facb8fe8cf..12afaee2fa 100644
--- a/ext/intl/tests/timezone_getEquivalentID_error.phpt
+++ b/ext/intl/tests/timezone_getEquivalentID_error.phpt
@@ -8,25 +8,8 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-var_dump(IntlTimeZone::getEquivalentID('foo'));
-var_dump(IntlTimeZone::getEquivalentID('foo', 'bar'));
-var_dump(IntlTimeZone::getEquivalentID('Europe/Lisbon', 0, 1));
var_dump(IntlTimeZone::getEquivalentID("foo\x80", 0));
+?>
--EXPECTF--
-Warning: IntlTimeZone::getEquivalentID() expects exactly 2 parameters, 1 given in %s on line %d
-
-Warning: IntlTimeZone::getEquivalentID(): intltz_get_equivalent_id: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlTimeZone::getEquivalentID() expects parameter 2 to be int, string given in %s on line %d
-
-Warning: IntlTimeZone::getEquivalentID(): intltz_get_equivalent_id: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlTimeZone::getEquivalentID() expects exactly 2 parameters, 3 given in %s on line %d
-
-Warning: IntlTimeZone::getEquivalentID(): intltz_get_equivalent_id: bad arguments in %s on line %d
-bool(false)
-
Warning: IntlTimeZone::getEquivalentID(): intltz_get_equivalent_id: could not convert time zone id to UTF-16 in %s on line %d
bool(false)
diff --git a/ext/intl/tests/timezone_getErrorCodeMessage_basic.phpt b/ext/intl/tests/timezone_getErrorCodeMessage_basic.phpt
index 18ffbe71be..f7f7a47311 100644
--- a/ext/intl/tests/timezone_getErrorCodeMessage_basic.phpt
+++ b/ext/intl/tests/timezone_getErrorCodeMessage_basic.phpt
@@ -24,7 +24,6 @@ var_dump($lsb->getErrorCode());
var_dump($lsb->getErrorMessage());
?>
-==DONE==
--EXPECTF--
int(0)
string(12) "U_ZERO_ERROR"
@@ -33,4 +32,3 @@ Warning: IntlTimeZone::getOffset(): intltz_get_offset: error obtaining offset in
bool(false)
int(1)
string(67) "intltz_get_offset: error obtaining offset: U_ILLEGAL_ARGUMENT_ERROR"
-==DONE==
diff --git a/ext/intl/tests/timezone_getErrorCode_error.phpt b/ext/intl/tests/timezone_getErrorCode_error.phpt
index f5b06b0757..5b4a59f17f 100644
--- a/ext/intl/tests/timezone_getErrorCode_error.phpt
+++ b/ext/intl/tests/timezone_getErrorCode_error.phpt
@@ -8,17 +8,10 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$tz = IntlTimeZone::createTimeZone('Europe/Lisbon');
-var_dump($tz->getErrorCode(array()));
-
var_dump(intltz_get_error_code(null));
+?>
--EXPECTF--
-Warning: IntlTimeZone::getErrorCode() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlTimeZone::getErrorCode(): intltz_get_error_code: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intltz_get_error_code() must be an instance of IntlTimeZone, null given in %s:%d
+Fatal error: Uncaught TypeError: intltz_get_error_code() expects parameter 1 to be IntlTimeZone, null given in %s:%d
Stack trace:
#0 %s(%d): intltz_get_error_code(NULL)
#1 {main}
diff --git a/ext/intl/tests/timezone_getErrorMessage_error.phpt b/ext/intl/tests/timezone_getErrorMessage_error.phpt
index 6b8ce7d5c8..ffceff358c 100644
--- a/ext/intl/tests/timezone_getErrorMessage_error.phpt
+++ b/ext/intl/tests/timezone_getErrorMessage_error.phpt
@@ -8,17 +8,10 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$tz = IntlTimeZone::createTimeZone('Europe/Lisbon');
-var_dump($tz->getErrorMessage(array()));
-
var_dump(intltz_get_error_message(null));
+?>
--EXPECTF--
-Warning: IntlTimeZone::getErrorMessage() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlTimeZone::getErrorMessage(): intltz_get_error_message: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intltz_get_error_message() must be an instance of IntlTimeZone, null given in %s:%d
+Fatal error: Uncaught TypeError: intltz_get_error_message() expects parameter 1 to be IntlTimeZone, null given in %s:%d
Stack trace:
#0 %s(%d): intltz_get_error_message(NULL)
#1 {main}
diff --git a/ext/intl/tests/timezone_getGMT_basic.phpt b/ext/intl/tests/timezone_getGMT_basic.phpt
index 99b3fa22ca..7004b2dd60 100644
--- a/ext/intl/tests/timezone_getGMT_basic.phpt
+++ b/ext/intl/tests/timezone_getGMT_basic.phpt
@@ -12,7 +12,6 @@ print_r($tz);
$tz = intltz_get_gmt();
print_r($tz);
?>
-==DONE==
--EXPECT--
IntlTimeZone Object
(
@@ -27,5 +26,4 @@ IntlTimeZone Object
[id] => GMT
[rawOffset] => 0
[currentOffset] => 0
-)
-==DONE== \ No newline at end of file
+) \ No newline at end of file
diff --git a/ext/intl/tests/timezone_getGMT_error.phpt b/ext/intl/tests/timezone_getGMT_error.phpt
deleted file mode 100644
index ca478a10d1..0000000000
--- a/ext/intl/tests/timezone_getGMT_error.phpt
+++ /dev/null
@@ -1,16 +0,0 @@
---TEST--
-IntlTimeZone::getGMT(): errors
---SKIPIF--
-<?php
-if (!extension_loaded('intl'))
- die('skip intl extension not enabled');
---FILE--
-<?php
-ini_set("intl.error_level", E_WARNING);
-
-var_dump(IntlTimeZone::getGMT(4));
---EXPECTF--
-Warning: IntlTimeZone::getGMT() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlTimeZone::getGMT(): intltz_get_gmt: bad arguments in %s on line %d
-NULL
diff --git a/ext/intl/tests/timezone_getID_error.phpt b/ext/intl/tests/timezone_getID_error.phpt
index 4d0ffeb96f..1ba7d7482f 100644
--- a/ext/intl/tests/timezone_getID_error.phpt
+++ b/ext/intl/tests/timezone_getID_error.phpt
@@ -8,16 +8,10 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$tz = IntlTimeZone::createTimeZone('Europe/Lisbon');
-var_dump($tz->getID('foo'));
intltz_get_id(null);
+?>
--EXPECTF--
-Warning: IntlTimeZone::getID() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlTimeZone::getID(): intltz_get_id: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intltz_get_id() must be an instance of IntlTimeZone, null given in %s:%d
+Fatal error: Uncaught TypeError: intltz_get_id() expects parameter 1 to be IntlTimeZone, null given in %s:%d
Stack trace:
#0 %s(%d): intltz_get_id(NULL)
#1 {main}
diff --git a/ext/intl/tests/timezone_getOffset_basic.phpt b/ext/intl/tests/timezone_getOffset_basic.phpt
index 403bf8fc35..3dbf5b1ce4 100644
--- a/ext/intl/tests/timezone_getOffset_basic.phpt
+++ b/ext/intl/tests/timezone_getOffset_basic.phpt
@@ -14,20 +14,18 @@ $ams = IntlTimeZone::createTimeZone('Europe/Amsterdam');
$date = strtotime("1 July 2012 +0000");
var_dump($ams->getOffset($date *1000., true, $rawOffset, $dstOffset),
- $rawOffset, $dstOffset);
+ $rawOffset, $dstOffset);
$lsb = IntlTimeZone::createTimeZone('Europe/Lisbon');
var_dump(intltz_get_offset($lsb, $date *1000., true, $rawOffset, $dstOffset),
- $rawOffset, $dstOffset);
+ $rawOffset, $dstOffset);
?>
-==DONE==
--EXPECT--
bool(true)
int(3600000)
int(3600000)
bool(true)
int(0)
-int(3600000)
-==DONE== \ No newline at end of file
+int(3600000) \ No newline at end of file
diff --git a/ext/intl/tests/timezone_getOffset_error.phpt b/ext/intl/tests/timezone_getOffset_error.phpt
index e984fc29f8..9ca81e4650 100644
--- a/ext/intl/tests/timezone_getOffset_error.phpt
+++ b/ext/intl/tests/timezone_getOffset_error.phpt
@@ -16,25 +16,14 @@ ini_set("intl.error_level", E_WARNING);
$tz = IntlTimeZone::createTimeZone('Europe/Lisbon');
var_dump($tz->getOffset(INF, true, $a, $a));
-var_dump($tz->getOffset(time()*1000, true, $a));
-var_dump($tz->getOffset(time()*1000, true, $a, $a, $a));
intltz_get_offset(null, time()*1000, false, $a, $a);
+?>
--EXPECTF--
Warning: IntlTimeZone::getOffset(): intltz_get_offset: error obtaining offset in %s on line %d
bool(false)
-Warning: IntlTimeZone::getOffset() expects exactly 4 parameters, 3 given in %s on line %d
-
-Warning: IntlTimeZone::getOffset(): intltz_get_offset: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlTimeZone::getOffset() expects exactly 4 parameters, 5 given in %s on line %d
-
-Warning: IntlTimeZone::getOffset(): intltz_get_offset: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intltz_get_offset() must be an instance of IntlTimeZone, null given in %s:%d
+Fatal error: Uncaught TypeError: intltz_get_offset() expects parameter 1 to be IntlTimeZone, null given in %s:%d
Stack trace:
#0 %s(%d): intltz_get_offset(NULL, %d, false, NULL, NULL)
#1 {main}
diff --git a/ext/intl/tests/timezone_getRawOffset_basic.phpt b/ext/intl/tests/timezone_getRawOffset_basic.phpt
index a2b4debf2b..bfbf2710ca 100644
--- a/ext/intl/tests/timezone_getRawOffset_basic.phpt
+++ b/ext/intl/tests/timezone_getRawOffset_basic.phpt
@@ -14,8 +14,6 @@ $lsb = IntlTimeZone::createTimeZone('Europe/Lisbon');
var_dump(intltz_get_raw_offset($lsb));
?>
-==DONE==
--EXPECT--
int(3600000)
-int(0)
-==DONE== \ No newline at end of file
+int(0) \ No newline at end of file
diff --git a/ext/intl/tests/timezone_getRawOffset_error.phpt b/ext/intl/tests/timezone_getRawOffset_error.phpt
index dc7df51cca..a16b62468b 100644
--- a/ext/intl/tests/timezone_getRawOffset_error.phpt
+++ b/ext/intl/tests/timezone_getRawOffset_error.phpt
@@ -8,17 +8,10 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$tz = IntlTimeZone::createTimeZone('Europe/Lisbon');
-var_dump($tz->getRawOffset('foo'));
-
intltz_get_raw_offset(null);
+?>
--EXPECTF--
-Warning: IntlTimeZone::getRawOffset() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlTimeZone::getRawOffset(): intltz_get_raw_offset: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intltz_get_raw_offset() must be an instance of IntlTimeZone, null given in %s:%d
+Fatal error: Uncaught TypeError: intltz_get_raw_offset() expects parameter 1 to be IntlTimeZone, null given in %s:%d
Stack trace:
#0 %s(%d): intltz_get_raw_offset(NULL)
#1 {main}
diff --git a/ext/intl/tests/timezone_getRegion_basic.phpt b/ext/intl/tests/timezone_getRegion_basic.phpt
index 3d020e77a3..7d23b7f96d 100644
--- a/ext/intl/tests/timezone_getRegion_basic.phpt
+++ b/ext/intl/tests/timezone_getRegion_basic.phpt
@@ -12,8 +12,6 @@ echo "\n";
print_R(intltz_get_region('Europe/Amsterdam'));
echo "\n";
?>
-==DONE==
--EXPECT--
NL
NL
-==DONE==
diff --git a/ext/intl/tests/timezone_getRegion_error.phpt b/ext/intl/tests/timezone_getRegion_error.phpt
index 7a9e1e1ca7..28fd73c1a7 100644
--- a/ext/intl/tests/timezone_getRegion_error.phpt
+++ b/ext/intl/tests/timezone_getRegion_error.phpt
@@ -8,27 +8,10 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-var_dump(IntlTimeZone::getRegion());
-var_dump(IntlTimeZone::getRegion(array()));
-var_dump(IntlTimeZone::getRegion('Europe/Lisbon', 4));
var_dump(IntlTimeZone::getRegion("foo\x81"));
var_dump(IntlTimeZone::getRegion("foo"));
+?>
--EXPECTF--
-Warning: IntlTimeZone::getRegion() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: IntlTimeZone::getRegion(): intltz_get_region: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlTimeZone::getRegion() expects parameter 1 to be string, array given in %s on line %d
-
-Warning: IntlTimeZone::getRegion(): intltz_get_region: bad arguments in %s on line %d
-bool(false)
-
-Warning: IntlTimeZone::getRegion() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: IntlTimeZone::getRegion(): intltz_get_region: bad arguments in %s on line %d
-bool(false)
-
Warning: IntlTimeZone::getRegion(): intltz_get_region: could not convert time zone id to UTF-16 in %s on line %d
bool(false)
diff --git a/ext/intl/tests/timezone_getTZDataVersion_error.phpt b/ext/intl/tests/timezone_getTZDataVersion_error.phpt
deleted file mode 100644
index eab4573a36..0000000000
--- a/ext/intl/tests/timezone_getTZDataVersion_error.phpt
+++ /dev/null
@@ -1,16 +0,0 @@
---TEST--
-IntlTimeZone::getTZDataVersion(): errors
---SKIPIF--
-<?php
-if (!extension_loaded('intl'))
- die('skip intl extension not enabled');
---FILE--
-<?php
-ini_set("intl.error_level", E_WARNING);
-
-var_dump(IntlTimeZone::getTZDataVersion('foo'));
---EXPECTF--
-Warning: IntlTimeZone::getTZDataVersion() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlTimeZone::getTZDataVersion(): intltz_get_tz_data_version: bad arguments in %s on line %d
-bool(false)
diff --git a/ext/intl/tests/timezone_getTZData_basic.phpt b/ext/intl/tests/timezone_getTZData_basic.phpt
index dea5b7c4b3..e3b8e71122 100644
--- a/ext/intl/tests/timezone_getTZData_basic.phpt
+++ b/ext/intl/tests/timezone_getTZData_basic.phpt
@@ -12,8 +12,6 @@ echo "\n";
print_R(intltz_get_tz_data_version());
echo "\n";
?>
-==DONE==
--EXPECTF--
20%d%s
-20%d%s
-==DONE== \ No newline at end of file
+20%d%s \ No newline at end of file
diff --git a/ext/intl/tests/timezone_getUnknown_basic.phpt b/ext/intl/tests/timezone_getUnknown_basic.phpt
index 7d5f50206a..9277f39911 100644
--- a/ext/intl/tests/timezone_getUnknown_basic.phpt
+++ b/ext/intl/tests/timezone_getUnknown_basic.phpt
@@ -14,7 +14,6 @@ print_r($tz);
$tz = intltz_get_unknown();
print_r($tz);
?>
-==DONE==
--EXPECT--
IntlTimeZone Object
(
@@ -30,4 +29,3 @@ IntlTimeZone Object
[rawOffset] => 0
[currentOffset] => 0
)
-==DONE==
diff --git a/ext/intl/tests/timezone_getUnknown_error.phpt b/ext/intl/tests/timezone_getUnknown_error.phpt
deleted file mode 100644
index 57773c256b..0000000000
--- a/ext/intl/tests/timezone_getUnknown_error.phpt
+++ /dev/null
@@ -1,25 +0,0 @@
---TEST--
-IntlCalendar::getUnknown(): bad arguments
---INI--
-date.timezone=Atlantic/Azores
---SKIPIF--
-<?php
-if (!extension_loaded('intl'))
- die('skip intl extension not enabled');
---FILE--
-<?php
-ini_set("intl.error_level", E_WARNING);
-
-$c = new IntlGregorianCalendar(NULL, 'pt_PT');
-
-IntlTimeZone::getUnknown(1);
-
-intltz_get_unknown(1);
---EXPECTF--
-Warning: IntlTimeZone::getUnknown() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlTimeZone::getUnknown(): intltz_get_unknown: bad arguments in %s on line %d
-
-Warning: intltz_get_unknown() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: intltz_get_unknown(): intltz_get_unknown: bad arguments in %s on line %d
diff --git a/ext/intl/tests/timezone_hasSameRules_basic.phpt b/ext/intl/tests/timezone_hasSameRules_basic.phpt
index 55faaf760b..8965024554 100644
--- a/ext/intl/tests/timezone_hasSameRules_basic.phpt
+++ b/ext/intl/tests/timezone_hasSameRules_basic.phpt
@@ -22,7 +22,6 @@ echo "\nEurope/Lisbon has same rules as Atlantic/Azores:\n";
var_dump(intltz_has_same_rules($lsb, $azo));
?>
-==DONE==
--EXPECT--
Europe/Lisbon has same rules as itself:
bool(true)
@@ -31,5 +30,4 @@ Europe/Lisbon has same rules as Portugal:
bool(true)
Europe/Lisbon has same rules as Atlantic/Azores:
-bool(false)
-==DONE== \ No newline at end of file
+bool(false) \ No newline at end of file
diff --git a/ext/intl/tests/timezone_hasSameRules_error.phpt b/ext/intl/tests/timezone_hasSameRules_error.phpt
index 4ec73a96a6..e1cfb754ba 100644
--- a/ext/intl/tests/timezone_hasSameRules_error.phpt
+++ b/ext/intl/tests/timezone_hasSameRules_error.phpt
@@ -10,28 +10,28 @@ ini_set("intl.error_level", E_WARNING);
function error_handler($errno, $errstr, $errfile, $errline)
{
- var_dump($errno, $errstr);
- return true;
+ var_dump($errno, $errstr);
+ return true;
}
set_error_handler("error_handler");
$tz = IntlTimeZone::createTimeZone('Europe/Lisbon');
try {
- var_dump($tz->hasSameRules('foo'));
+ var_dump($tz->hasSameRules('foo'));
} catch (Error $ex) {
- var_dump($ex->getCode(), $ex->getMessage());
- echo "\n";
+ var_dump($ex->getCode(), $ex->getMessage());
+ echo "\n";
}
try {
- var_dump(intltz_has_same_rules(null, $tz));
+ var_dump(intltz_has_same_rules(null, $tz));
} catch (Error $ex) {
- var_dump($ex->getCode(), $ex->getMessage());
- echo "\n";
+ var_dump($ex->getCode(), $ex->getMessage());
+ echo "\n";
}
--EXPECT--
int(0)
-string(99) "Argument 1 passed to IntlTimeZone::hasSameRules() must be an instance of IntlTimeZone, string given"
+string(81) "IntlTimeZone::hasSameRules() expects parameter 1 to be IntlTimeZone, string given"
int(0)
-string(92) "Argument 1 passed to intltz_has_same_rules() must be an instance of IntlTimeZone, null given"
+string(74) "intltz_has_same_rules() expects parameter 1 to be IntlTimeZone, null given"
diff --git a/ext/intl/tests/timezone_toDateTimeZone_basic.phpt b/ext/intl/tests/timezone_toDateTimeZone_basic.phpt
index 831bc3df1a..3679fe9717 100644
--- a/ext/intl/tests/timezone_toDateTimeZone_basic.phpt
+++ b/ext/intl/tests/timezone_toDateTimeZone_basic.phpt
@@ -11,12 +11,12 @@ ini_set("intl.default_locale", "nl");
date_default_timezone_set('Europe/Lisbon');
function do_test(IntlTimeZone $tz, $proc = false) {
- var_dump($tz->getID(), $tz->getRawOffset());
- if (!$proc)
- $dtz = $tz->toDateTimeZone();
- else
- $dtz = intltz_to_date_time_zone($tz);
- var_dump($dtz->getName(), $dtz->getOffset(new DateTime('2012-01-01 00:00:00')));
+ var_dump($tz->getID(), $tz->getRawOffset());
+ if (!$proc)
+ $dtz = $tz->toDateTimeZone();
+ else
+ $dtz = intltz_to_date_time_zone($tz);
+ var_dump($dtz->getName(), $dtz->getOffset(new DateTime('2012-01-01 00:00:00')));
}
do_test(IntlTimeZone::createTimeZone('CET'));
diff --git a/ext/intl/tests/timezone_toDateTimeZone_error.phpt b/ext/intl/tests/timezone_toDateTimeZone_error.phpt
index d00e78fd3a..119977b124 100644
--- a/ext/intl/tests/timezone_toDateTimeZone_error.phpt
+++ b/ext/intl/tests/timezone_toDateTimeZone_error.phpt
@@ -10,30 +10,18 @@ ini_set("intl.error_level", E_WARNING);
$tz = IntlTimeZone::createTimeZone('Etc/Unknown');
-var_dump($tz->toDateTimeZone(''));
try {
- var_dump($tz->toDateTimeZone());
+ var_dump($tz->toDateTimeZone());
} catch (Exception $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
-var_dump(intltz_to_date_time_zone());
var_dump(intltz_to_date_time_zone(1));
--EXPECTF--
-Warning: IntlTimeZone::toDateTimeZone() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlTimeZone::toDateTimeZone(): intltz_to_date_time_zone: bad arguments in %s on line %d
-bool(false)
-
Warning: IntlTimeZone::toDateTimeZone(): intltz_to_date_time_zone: DateTimeZone constructor threw exception in %s on line %d
string(66) "DateTimeZone::__construct(): Unknown or bad timezone (Etc/Unknown)"
-Warning: intltz_to_date_time_zone() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: intltz_to_date_time_zone(): intltz_to_date_time_zone: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intltz_to_date_time_zone() must be an instance of IntlTimeZone, int given in %s:%d
+Fatal error: Uncaught TypeError: intltz_to_date_time_zone() expects parameter 1 to be IntlTimeZone, int given in %s:%d
Stack trace:
#0 %s(%d): intltz_to_date_time_zone(1)
#1 {main}
diff --git a/ext/intl/tests/timezone_useDaylightTime_basic.phpt b/ext/intl/tests/timezone_useDaylightTime_basic.phpt
index 15baf108b3..7db7f80fde 100644
--- a/ext/intl/tests/timezone_useDaylightTime_basic.phpt
+++ b/ext/intl/tests/timezone_useDaylightTime_basic.phpt
@@ -16,10 +16,8 @@ var_dump($gmt->useDaylightTime());
var_dump(intltz_use_daylight_time($lsb));
var_dump(intltz_use_daylight_time($gmt));
?>
-==DONE==
--EXPECT--
bool(true)
bool(false)
bool(true)
-bool(false)
-==DONE== \ No newline at end of file
+bool(false) \ No newline at end of file
diff --git a/ext/intl/tests/timezone_useDaylightTime_error.phpt b/ext/intl/tests/timezone_useDaylightTime_error.phpt
index c6ab2eefe5..5b37cd16b1 100644
--- a/ext/intl/tests/timezone_useDaylightTime_error.phpt
+++ b/ext/intl/tests/timezone_useDaylightTime_error.phpt
@@ -8,16 +8,10 @@ if (!extension_loaded('intl'))
<?php
ini_set("intl.error_level", E_WARNING);
-$tz = IntlTimeZone::createTimeZone('Europe/Lisbon');
-var_dump($tz->useDaylightTime('foo'));
intltz_use_daylight_time(null);
+?>
--EXPECTF--
-Warning: IntlTimeZone::useDaylightTime() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: IntlTimeZone::useDaylightTime(): intltz_use_daylight_time: bad arguments in %s on line %d
-bool(false)
-
-Fatal error: Uncaught TypeError: Argument 1 passed to intltz_use_daylight_time() must be an instance of IntlTimeZone, null given in %s:%d
+Fatal error: Uncaught TypeError: intltz_use_daylight_time() expects parameter 1 to be IntlTimeZone, null given in %s:%d
Stack trace:
#0 %s(%d): intltz_use_daylight_time(NULL)
#1 {main}
diff --git a/ext/intl/tests/transliterator_create_from_rule_error.phpt b/ext/intl/tests/transliterator_create_from_rule_error.phpt
index d1549ec1b6..64c57da854 100644
--- a/ext/intl/tests/transliterator_create_from_rule_error.phpt
+++ b/ext/intl/tests/transliterator_create_from_rule_error.phpt
@@ -6,12 +6,6 @@ Transliterator::createFromRules (error)
<?php
ini_set("intl.error_level", E_WARNING);
-$t = Transliterator::createFromRules();
-echo intl_get_error_message(),"\n";
-
-$t = Transliterator::createFromRules("a","b");
-echo intl_get_error_message(),"\n";
-
$t = Transliterator::createFromRules("\x8Fss");
echo intl_get_error_message(),"\n";
@@ -31,16 +25,6 @@ $t = Transliterator::createFromRules($rules);
echo intl_get_error_message(),"\n";
echo "Done.\n";
--EXPECTF--
-Warning: Transliterator::createFromRules() expects at least 1 parameter, 0 given in %s on line %d
-
-Warning: Transliterator::createFromRules(): transliterator_create_from_rules: bad arguments in %s on line %d
-transliterator_create_from_rules: bad arguments: U_ILLEGAL_ARGUMENT_ERROR
-
-Warning: Transliterator::createFromRules() expects parameter 2 to be int, string given in %s on line %d
-
-Warning: Transliterator::createFromRules(): transliterator_create_from_rules: bad arguments in %s on line %d
-transliterator_create_from_rules: bad arguments: U_ILLEGAL_ARGUMENT_ERROR
-
Warning: Transliterator::createFromRules(): String conversion of rules to UTF-16 failed in %s on line %d
String conversion of rules to UTF-16 failed: U_INVALID_CHAR_FOUND
diff --git a/ext/intl/tests/transliterator_create_inverse_error.phpt b/ext/intl/tests/transliterator_create_inverse_error.phpt
index 1a1e80ba68..c8d6bdc5a6 100644
--- a/ext/intl/tests/transliterator_create_inverse_error.phpt
+++ b/ext/intl/tests/transliterator_create_inverse_error.phpt
@@ -7,17 +7,10 @@ Transliterator::createInverse (error)
ini_set("intl.error_level", E_WARNING);
-$tr = Transliterator::create("Katakana-Latin");
-$tr->createInverse(array());
-
-$tr = Transliterator::create("Katakana-Latin");
transliterator_create_inverse("jj");
+?>
--EXPECTF--
-Warning: Transliterator::createInverse() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: Transliterator::createInverse(): transliterator_create_inverse: bad arguments in %s on line %d
-
-Fatal error: Uncaught TypeError: Argument 1 passed to transliterator_create_inverse() must be an instance of Transliterator, string given in %s:%d
+Fatal error: Uncaught TypeError: transliterator_create_inverse() expects parameter 1 to be Transliterator, string given in %s:%d
Stack trace:
#0 %s(%d): transliterator_create_inverse('jj')
#1 {main}
diff --git a/ext/intl/tests/transliterator_get_error_code_error.phpt b/ext/intl/tests/transliterator_get_error_code_error.phpt
index e700d2b172..ed766fd968 100644
--- a/ext/intl/tests/transliterator_get_error_code_error.phpt
+++ b/ext/intl/tests/transliterator_get_error_code_error.phpt
@@ -5,22 +5,10 @@ Transliterator::getErrorCode (error)
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
-$t = Transliterator::create("[\p{Bidi_Mirrored}] Hex");
-echo transliterator_get_error_code(), "\n";
-echo $t->getErrorCode(null), "\n";
echo transliterator_get_error_code(array()), "\n";
+?>
--EXPECTF--
-Warning: transliterator_get_error_code() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: transliterator_get_error_code(): transliterator_get_error_code: unable to parse input params in %s on line %d
-
-
-Warning: Transliterator::getErrorCode() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: Transliterator::getErrorCode(): transliterator_get_error_code: unable to parse input params in %s on line %d
-
-
-Fatal error: Uncaught TypeError: Argument 1 passed to transliterator_get_error_code() must be an instance of Transliterator, array given in %s:%d
+Fatal error: Uncaught TypeError: transliterator_get_error_code() expects parameter 1 to be Transliterator, array given in %s:%d
Stack trace:
#0 %s(%d): transliterator_get_error_code(Array)
#1 {main}
diff --git a/ext/intl/tests/transliterator_get_error_message_error.phpt b/ext/intl/tests/transliterator_get_error_message_error.phpt
index ec8282447a..04746c7a5f 100644
--- a/ext/intl/tests/transliterator_get_error_message_error.phpt
+++ b/ext/intl/tests/transliterator_get_error_message_error.phpt
@@ -5,22 +5,10 @@ Transliterator::getErrorMessage (error)
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
-$t = Transliterator::create("[\p{Bidi_Mirrored}] Hex");
-echo transliterator_get_error_message(), "\n";
-echo $t->getErrorMessage(null), "\n";
echo transliterator_get_error_message(array()), "\n";
+?>
--EXPECTF--
-Warning: transliterator_get_error_message() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: transliterator_get_error_message(): transliterator_get_error_message: unable to parse input params in %s on line %d
-
-
-Warning: Transliterator::getErrorMessage() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: Transliterator::getErrorMessage(): transliterator_get_error_message: unable to parse input params in %s on line %d
-
-
-Fatal error: Uncaught TypeError: Argument 1 passed to transliterator_get_error_message() must be an instance of Transliterator, array given in %s:%d
+Fatal error: Uncaught TypeError: transliterator_get_error_message() expects parameter 1 to be Transliterator, array given in %s:%d
Stack trace:
#0 %s(%d): transliterator_get_error_message(Array)
#1 {main}
diff --git a/ext/intl/tests/transliterator_list_ids_error.phpt b/ext/intl/tests/transliterator_list_ids_error.phpt
deleted file mode 100644
index fa651387f1..0000000000
--- a/ext/intl/tests/transliterator_list_ids_error.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-Transliterator::listIDs (error)
---SKIPIF--
-<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
---FILE--
-<?php
-
-ini_set("intl.error_level", E_WARNING);
-var_dump(transliterator_list_ids(array()));
-
-echo "Done.\n";
---EXPECTF--
-Warning: transliterator_list_ids() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: transliterator_list_ids(): transliterator_list_ids: bad arguments in %s on line %d
-bool(false)
-Done.
diff --git a/ext/intl/tests/transliterator_transliterate_error.phpt b/ext/intl/tests/transliterator_transliterate_error.phpt
index cdddcfb87b..da9a887455 100644
--- a/ext/intl/tests/transliterator_transliterate_error.phpt
+++ b/ext/intl/tests/transliterator_transliterate_error.phpt
@@ -10,51 +10,19 @@ ini_set("intl.error_level", E_WARNING);
$tr = Transliterator::create("latin");
//Arguments
-var_dump(transliterator_transliterate());
-var_dump(transliterator_transliterate($tr,array()));
var_dump(transliterator_transliterate($tr,"str",7));
var_dump(transliterator_transliterate($tr,"str",7,6));
-var_dump(transliterator_transliterate($tr,"str",2,-1,"extra"));
-
-//Arguments
-var_dump($tr->transliterate());
-var_dump($tr->transliterate(array()));
//bad UTF-8
transliterator_transliterate($tr, "\x80\x03");
echo "Done.\n";
--EXPECTF--
-Warning: transliterator_transliterate() expects at least 2 parameters, 0 given in %s on line %d
-
-Warning: transliterator_transliterate(): transliterator_transliterate: bad arguments in %s on line %d
-bool(false)
-
-Warning: transliterator_transliterate() expects parameter 2 to be string, array given in %s on line %d
-
-Warning: transliterator_transliterate(): transliterator_transliterate: bad arguments in %s on line %d
-bool(false)
-
Warning: transliterator_transliterate(): transliterator_transliterate: Neither "start" nor the "end" arguments can exceed the number of UTF-16 code units (in this case, 3) in %s on line %d
bool(false)
Warning: transliterator_transliterate(): transliterator_transliterate: "start" argument should be non-negative and not bigger than "end" (if defined) in %s on line %d
bool(false)
-Warning: transliterator_transliterate() expects at most 4 parameters, 5 given in %s on line %d
-
-Warning: transliterator_transliterate(): transliterator_transliterate: bad arguments in %s on line %d
-bool(false)
-
-Warning: Transliterator::transliterate() expects at least 1 parameter, 0 given in %s on line %d
-
-Warning: Transliterator::transliterate(): transliterator_transliterate: bad arguments in %s on line %d
-bool(false)
-
-Warning: Transliterator::transliterate() expects parameter 1 to be string, array given in %s on line %d
-
-Warning: Transliterator::transliterate(): transliterator_transliterate: bad arguments in %s on line %d
-bool(false)
-
Warning: transliterator_transliterate(): String conversion of string to UTF-16 failed in %s on line %d
Done.
diff --git a/ext/intl/tests/uconverter_getAvailable_wrongparam_001.phpt b/ext/intl/tests/uconverter_getAvailable_wrongparam_001.phpt
deleted file mode 100644
index 4e381289b3..0000000000
--- a/ext/intl/tests/uconverter_getAvailable_wrongparam_001.phpt
+++ /dev/null
@@ -1,8 +0,0 @@
---TEST--
-Check the function UConverter::getAvailable with parameter wrong
---SKIPIF--
-<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
---FILE--
-<?php UConverter::getAvailable("This is an ascii string"); ?>
---EXPECTF--
-Warning: UConverter::getAvailable() expects exactly 0 parameters, 1 given in %s on line %d
diff --git a/ext/intl/tests/ut_common.inc b/ext/intl/tests/ut_common.inc
index 6398b2876f..4a2675b01f 100644
--- a/ext/intl/tests/ut_common.inc
+++ b/ext/intl/tests/ut_common.inc
@@ -234,7 +234,7 @@ function ut_loc_get_default( )
}
function ut_loc_set_default( $locale )
{
- return $GLOBALS['oo-mode'] ? Locale::setDefault( $locale ) : locale_set_default( $locale );
+ return $GLOBALS['oo-mode'] ? Locale::setDefault( $locale ) : locale_set_default( $locale );
}
function ut_loc_get_primary_language( $locale )
{
@@ -297,7 +297,7 @@ function ut_loc_locale_lookup( $lang_tag_arr,$loc_range,$isCanonical,$default_lo
return $GLOBALS['oo-mode'] ? Locale::lookup( $lang_tag_arr,$loc_range,$isCanonical,$default_loc ) : locale_lookup( $lang_tag_arr,$loc_range,$isCanonical,$default_loc );
}
function ut_loc_accept_http($http) {
- return $GLOBALS['oo-mode'] ? Locale::acceptFromHttp($http):locale_accept_from_http($http);
+ return $GLOBALS['oo-mode'] ? Locale::acceptFromHttp($http):locale_accept_from_http($http);
}
/* MessageFormatter functions */
function ut_msgfmt_create( $locale, $pattern)
diff --git a/ext/intl/timezone/timezone.stub.php b/ext/intl/timezone/timezone.stub.php
new file mode 100644
index 0000000000..332fb9c1d2
--- /dev/null
+++ b/ext/intl/timezone/timezone.stub.php
@@ -0,0 +1,136 @@
+<?php
+
+class IntlTimeZone
+{
+ private function __construct() {}
+
+ /** @return int|false */
+ public static function countEquivalentIDs(string $zoneId) {}
+
+ /** @return IntlTimeZone */
+ public static function createDefault() {}
+
+ /**
+ * @param IntlTimeZone|string|int|double|null $countryOrRawOffset
+ * @return IntlIterator|false
+ */
+ public static function createEnumeration($countryOrRawOffset = null) {}
+
+ /** @return ?IntlTimeZone */
+ public static function createTimeZone(string $zoneId) {}
+
+ /** @return IntlIterator|false */
+ public static function createTimeZoneIDEnumeration(int $zoneType, ?string $region = null, ?int $rawOffset = null) {}
+
+ /** @return ?IntlTimeZone */
+ public static function fromDateTimeZone(DateTimeZone $zone) {}
+
+ /** @return string|false */
+ public static function getCanonicalID(string $zoneId, &$isSystemID = null) {}
+
+ /** @return string|false */
+ public function getDisplayName(bool $isDaylight = false, int $style = IntlTimeZone::DISPLAY_LONG, ?string $locale = null) {}
+
+ /** @return int */
+ public function getDSTSavings() {}
+
+ /** @return string|false */
+ public static function getEquivalentID(string $zoneId, int $index) {}
+
+ /** @return int|false */
+ public function getErrorCode() {}
+
+ /** @return string|false */
+ public function getErrorMessage() {}
+
+ /** @return IntlTimeZone */
+ public static function getGMT() {}
+
+ /** @return string|false */
+ public function getID() {}
+
+ /** @return bool */
+ public function getOffset(float $date, bool $local, &$rawOffset, &$dstOffset) {}
+
+ /** @return int */
+ public function getRawOffset() {}
+
+ /** @return string|false */
+ public static function getRegion(string $zoneId) {}
+
+ /** @return string|false */
+ public static function getTZDataVersion() {}
+
+ /** @return IntlTimeZone */
+ public static function getUnknown() {}
+
+#if U_ICU_VERSION_MAJOR_NUM >= 52
+ /** @return string|false */
+ public static function getWindowsID(string $timezone) {}
+
+ /** @return string|false */
+ public static function getIDForWindowsID(string $timezone, string $region = UNKNOWN) {}
+#endif
+ /** @return bool */
+ public function hasSameRules(IntlTimeZone $otherTimeZone) {}
+
+ /** @return DateTimeZone|false */
+ public function toDateTimeZone() {}
+
+ /** @return bool */
+ public function useDaylightTime() {}
+}
+
+function intltz_count_equivalent_ids(string $zoneId): int|false {}
+
+function intltz_create_default(): IntlTimeZone {}
+
+/**
+ * @param IntlTimeZone|string|int|double|null $countryOrRawOffset
+ * @return IntlIterator|false
+ */
+function intltz_create_enumeration($countryOrRawOffset = null) {}
+
+function intltz_create_time_zone(string $zoneId): ?IntlTimeZone {}
+
+function intltz_create_time_zone_id_enumeration(int $zoneType, ?string $region = null, ?int $rawOffset = null): IntlIterator|false {}
+
+function intltz_from_date_time_zone(DateTimeZone $zone): ?IntlTimeZone {}
+
+function intltz_get_canonical_id(string $zoneId, &$isSystemID = null): string|false {}
+
+function intltz_get_display_name(IntlTimeZone $tz, bool $isDaylight = false, int $style = IntlTimeZone::DISPLAY_LONG, ?string $locale = null): string|false {}
+
+function intltz_get_dst_savings(IntlTimeZone $tz): int {}
+
+function intltz_get_equivalent_id(string $zoneId, int $index): string|false {}
+
+function intltz_get_error_code(IntlTimeZone $tz): int|false {}
+
+function intltz_get_error_message(IntlTimeZone $tz): string|false {}
+
+function intltz_get_gmt(): IntlTimeZone {}
+
+function intltz_get_id(IntlTimeZone $tz): string|false {}
+
+function intltz_get_offset(IntlTimeZone $tz, float $date, bool $local, &$rawOffset, &$dstOffset): bool {}
+
+function intltz_get_raw_offset(IntlTimeZone $tz): int {}
+
+function intltz_get_region(string $zoneId): string|false {}
+
+function intltz_get_tz_data_version(): string|false {}
+
+function intltz_get_unknown(): IntlTimeZone {}
+
+#if U_ICU_VERSION_MAJOR_NUM >= 52
+function intltz_get_windows_id(string $timezone): string|false {}
+
+function intltz_get_id_for_windows_id(string $timezone, string $region = UNKNOWN): string|false {}
+#endif
+
+function intltz_has_same_rules(IntlTimeZone $tz, IntlTimeZone $otherTimeZone): bool {}
+
+function intltz_to_date_time_zone(IntlTimeZone $tz): DateTimeZone|false {}
+
+function intltz_use_daylight_time(IntlTimeZone $tz): bool {}
diff --git a/ext/intl/timezone/timezone_arginfo.h b/ext/intl/timezone/timezone_arginfo.h
new file mode 100644
index 0000000000..94c7962781
--- /dev/null
+++ b/ext/intl/timezone/timezone_arginfo.h
@@ -0,0 +1,189 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlTimeZone___construct, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlTimeZone_countEquivalentIDs, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, zoneId, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_IntlTimeZone_createDefault arginfo_class_IntlTimeZone___construct
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlTimeZone_createEnumeration, 0, 0, 0)
+ ZEND_ARG_INFO(0, countryOrRawOffset)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_IntlTimeZone_createTimeZone arginfo_class_IntlTimeZone_countEquivalentIDs
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlTimeZone_createTimeZoneIDEnumeration, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, zoneType, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, region, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, rawOffset, IS_LONG, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlTimeZone_fromDateTimeZone, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, zone, DateTimeZone, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlTimeZone_getCanonicalID, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, zoneId, IS_STRING, 0)
+ ZEND_ARG_INFO(1, isSystemID)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlTimeZone_getDisplayName, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, isDaylight, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, style, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_IntlTimeZone_getDSTSavings arginfo_class_IntlTimeZone___construct
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlTimeZone_getEquivalentID, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, zoneId, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_IntlTimeZone_getErrorCode arginfo_class_IntlTimeZone___construct
+
+#define arginfo_class_IntlTimeZone_getErrorMessage arginfo_class_IntlTimeZone___construct
+
+#define arginfo_class_IntlTimeZone_getGMT arginfo_class_IntlTimeZone___construct
+
+#define arginfo_class_IntlTimeZone_getID arginfo_class_IntlTimeZone___construct
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlTimeZone_getOffset, 0, 0, 4)
+ ZEND_ARG_TYPE_INFO(0, date, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, local, _IS_BOOL, 0)
+ ZEND_ARG_INFO(1, rawOffset)
+ ZEND_ARG_INFO(1, dstOffset)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_IntlTimeZone_getRawOffset arginfo_class_IntlTimeZone___construct
+
+#define arginfo_class_IntlTimeZone_getRegion arginfo_class_IntlTimeZone_countEquivalentIDs
+
+#define arginfo_class_IntlTimeZone_getTZDataVersion arginfo_class_IntlTimeZone___construct
+
+#define arginfo_class_IntlTimeZone_getUnknown arginfo_class_IntlTimeZone___construct
+
+#if U_ICU_VERSION_MAJOR_NUM >= 52
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlTimeZone_getWindowsID, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, timezone, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if U_ICU_VERSION_MAJOR_NUM >= 52
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlTimeZone_getIDForWindowsID, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, timezone, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, region, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlTimeZone_hasSameRules, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, otherTimeZone, IntlTimeZone, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_IntlTimeZone_toDateTimeZone arginfo_class_IntlTimeZone___construct
+
+#define arginfo_class_IntlTimeZone_useDaylightTime arginfo_class_IntlTimeZone___construct
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_intltz_count_equivalent_ids, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, zoneId, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_intltz_create_default, 0, 0, IntlTimeZone, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_intltz_create_enumeration arginfo_class_IntlTimeZone_createEnumeration
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_intltz_create_time_zone, 0, 1, IntlTimeZone, 1)
+ ZEND_ARG_TYPE_INFO(0, zoneId, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_intltz_create_time_zone_id_enumeration, 0, 1, IntlIterator, MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, zoneType, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, region, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, rawOffset, IS_LONG, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_intltz_from_date_time_zone, 0, 1, IntlTimeZone, 1)
+ ZEND_ARG_OBJ_INFO(0, zone, DateTimeZone, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_intltz_get_canonical_id, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, zoneId, IS_STRING, 0)
+ ZEND_ARG_INFO(1, isSystemID)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_intltz_get_display_name, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, tz, IntlTimeZone, 0)
+ ZEND_ARG_TYPE_INFO(0, isDaylight, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, style, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_intltz_get_dst_savings, 0, 1, IS_LONG, 0)
+ ZEND_ARG_OBJ_INFO(0, tz, IntlTimeZone, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_intltz_get_equivalent_id, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, zoneId, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_intltz_get_error_code, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, tz, IntlTimeZone, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_intltz_get_error_message, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, tz, IntlTimeZone, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_intltz_get_gmt arginfo_intltz_create_default
+
+#define arginfo_intltz_get_id arginfo_intltz_get_error_message
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_intltz_get_offset, 0, 5, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, tz, IntlTimeZone, 0)
+ ZEND_ARG_TYPE_INFO(0, date, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, local, _IS_BOOL, 0)
+ ZEND_ARG_INFO(1, rawOffset)
+ ZEND_ARG_INFO(1, dstOffset)
+ZEND_END_ARG_INFO()
+
+#define arginfo_intltz_get_raw_offset arginfo_intltz_get_dst_savings
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_intltz_get_region, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, zoneId, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_intltz_get_tz_data_version, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
+ZEND_END_ARG_INFO()
+
+#define arginfo_intltz_get_unknown arginfo_intltz_create_default
+
+#if U_ICU_VERSION_MAJOR_NUM >= 52
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_intltz_get_windows_id, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, timezone, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if U_ICU_VERSION_MAJOR_NUM >= 52
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_intltz_get_id_for_windows_id, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, timezone, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, region, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_intltz_has_same_rules, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, tz, IntlTimeZone, 0)
+ ZEND_ARG_OBJ_INFO(0, otherTimeZone, IntlTimeZone, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_intltz_to_date_time_zone, 0, 1, DateTimeZone, MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, tz, IntlTimeZone, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_intltz_use_daylight_time, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, tz, IntlTimeZone, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/intl/timezone/timezone_class.cpp b/ext/intl/timezone/timezone_class.cpp
index b261f81f81..8a8ac2e29c 100644
--- a/ext/intl/timezone/timezone_class.cpp
+++ b/ext/intl/timezone/timezone_class.cpp
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -32,6 +30,7 @@ extern "C" {
#define USE_TIMEZONE_POINTER 1
#include "timezone_class.h"
#include "timezone_methods.h"
+#include "timezone_arginfo.h"
#include <zend_exceptions.h>
#include <zend_interfaces.h>
#include <ext/date/php_date.h>
@@ -98,7 +97,7 @@ U_CFUNC zval *timezone_convert_to_datetimezone(const TimeZone *timeZone,
goto error;
}
ZVAL_STR(&arg, u8str);
- zend_call_method_with_1_params(ret, NULL, &Z_OBJCE_P(ret)->constructor, "__construct", NULL, &arg);
+ zend_call_method_with_1_params(Z_OBJ_P(ret), NULL, &Z_OBJCE_P(ret)->constructor, "__construct", NULL, &arg);
if (EG(exception)) {
spprintf(&message, 0,
"%s: DateTimeZone constructor threw exception", func);
@@ -196,7 +195,7 @@ U_CFUNC TimeZone *timezone_process_timezone_argument(zval *zv_timezone,
}
timeZone = TimeZone::createTimeZone(id);
if (timeZone == NULL) {
- spprintf(&message, 0, "%s: could not create time zone", func);
+ spprintf(&message, 0, "%s: Could not create time zone", func);
if (message) {
intl_errors_set(outside_error, U_MEMORY_ALLOCATION_ERROR, message, 1);
efree(message);
@@ -205,7 +204,7 @@ U_CFUNC TimeZone *timezone_process_timezone_argument(zval *zv_timezone,
return NULL;
}
if (timeZone->getID(gottenId) != id) {
- spprintf(&message, 0, "%s: no such time zone: '%s'",
+ spprintf(&message, 0, "%s: No such time zone: '%s'",
func, Z_STRVAL_P(zv_timezone));
if (message) {
intl_errors_set(outside_error, U_ILLEGAL_ARGUMENT_ERROR, message, 1);
@@ -224,17 +223,17 @@ U_CFUNC TimeZone *timezone_process_timezone_argument(zval *zv_timezone,
/* }}} */
/* {{{ clone handler for TimeZone */
-static zend_object *TimeZone_clone_obj(zval *object)
+static zend_object *TimeZone_clone_obj(zend_object *object)
{
TimeZone_object *to_orig,
*to_new;
zend_object *ret_val;
intl_error_reset(NULL);
- to_orig = Z_INTL_TIMEZONE_P(object);
+ to_orig = php_intl_timezone_fetch_object(object);
intl_error_reset(TIMEZONE_ERROR_P(to_orig));
- ret_val = TimeZone_ce_ptr->create_object(Z_OBJCE_P(object));
+ ret_val = TimeZone_ce_ptr->create_object(object->ce);
to_new = php_intl_timezone_fetch_object(ret_val);
zend_objects_clone_members(&to_new->zo, &to_orig->zo);
@@ -270,6 +269,9 @@ static int TimeZone_compare_objects(zval *object1, zval *object2)
{
TimeZone_object *to1,
*to2;
+
+ ZEND_COMPARE_OBJECTS_FALLBACK(object1, object2);
+
to1 = Z_INTL_TIMEZONE_P(object1);
to2 = Z_INTL_TIMEZONE_P(object2);
@@ -288,7 +290,7 @@ static int TimeZone_compare_objects(zval *object1, zval *object2)
/* }}} */
/* {{{ get_debug_info handler for TimeZone */
-static HashTable *TimeZone_get_debug_info(zval *object, int *is_temp)
+static HashTable *TimeZone_get_debug_info(zend_object *object, int *is_temp)
{
zval zv;
TimeZone_object *to;
@@ -302,7 +304,7 @@ static HashTable *TimeZone_get_debug_info(zval *object, int *is_temp)
debug_info = zend_new_array(8);
- to = Z_INTL_TIMEZONE_P(object);
+ to = php_intl_timezone_fetch_object(object);
tz = to->utimezone;
if (tz == NULL) {
@@ -389,104 +391,37 @@ static zend_object *TimeZone_object_create(zend_class_entry *ce)
}
/* }}} */
-/* {{{ TimeZone methods arguments info */
-
-ZEND_BEGIN_ARG_INFO_EX(ainfo_tz_idarg, 0, 0, 1)
- ZEND_ARG_INFO(0, zoneId)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ainfo_tz_fromDateTimeZone, 0, 0, 1)
- ZEND_ARG_OBJ_INFO(0, otherTimeZone, IntlTimeZone, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ainfo_tz_createEnumeration, 0, 0, 0)
- ZEND_ARG_INFO(0, countryOrRawOffset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ainfo_tz_countEquivalentIDs, 0, 0, 1)
- ZEND_ARG_INFO(0, zoneId)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ainfo_tz_createTimeZoneIDEnumeration, 0, 0, 1)
- ZEND_ARG_INFO(0, zoneType)
- ZEND_ARG_INFO(0, region)
- ZEND_ARG_INFO(0, rawOffset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ainfo_tz_getCanonicalID, 0, 0, 1)
- ZEND_ARG_INFO(0, zoneId)
- ZEND_ARG_INFO(1, isSystemID)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ainfo_tz_getEquivalentID, 0, 0, 2)
- ZEND_ARG_INFO(0, zoneId)
- ZEND_ARG_INFO(0, index)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ainfo_tz_getOffset, 0, 0, 4)
- ZEND_ARG_INFO(0, date)
- ZEND_ARG_INFO(0, local)
- ZEND_ARG_INFO(1, rawOffset)
- ZEND_ARG_INFO(1, dstOffset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ainfo_tz_hasSameRules, 0, 0, 1)
- ZEND_ARG_OBJ_INFO(0, otherTimeZone, IntlTimeZone, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ainfo_tz_getDisplayName, 0, 0, 0)
- ZEND_ARG_INFO(0, isDaylight)
- ZEND_ARG_INFO(0, style)
- ZEND_ARG_INFO(0, locale)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ainfo_tz_void, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-#if U_ICU_VERSION_MAJOR_NUM >= 52
-ZEND_BEGIN_ARG_INFO_EX(ainfo_tz_getWindowsID, 0, ZEND_RETURN_VALUE, 1)
- ZEND_ARG_INFO(0, timezone)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ainfo_tz_getIDForWindowsID, 0, ZEND_RETURN_VALUE, 1)
- ZEND_ARG_INFO(0, timezone)
- ZEND_ARG_INFO(0, region)
-ZEND_END_ARG_INFO()
-#endif
-
-/* }}} */
-
/* {{{ TimeZone_class_functions
* Every 'IntlTimeZone' class method has an entry in this table
*/
static const zend_function_entry TimeZone_class_functions[] = {
- PHP_ME(IntlTimeZone, __construct, ainfo_tz_void, ZEND_ACC_PRIVATE)
- PHP_ME_MAPPING(createTimeZone, intltz_create_time_zone, ainfo_tz_idarg, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
- PHP_ME_MAPPING(fromDateTimeZone, intltz_from_date_time_zone, ainfo_tz_idarg, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
- PHP_ME_MAPPING(createDefault, intltz_create_default, ainfo_tz_void, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
- PHP_ME_MAPPING(getGMT, intltz_get_gmt, ainfo_tz_void, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
- PHP_ME_MAPPING(getUnknown, intltz_get_unknown, ainfo_tz_void, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
- PHP_ME_MAPPING(createEnumeration, intltz_create_enumeration, ainfo_tz_createEnumeration, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
- PHP_ME_MAPPING(countEquivalentIDs, intltz_count_equivalent_ids, ainfo_tz_idarg, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
- PHP_ME_MAPPING(createTimeZoneIDEnumeration, intltz_create_time_zone_id_enumeration, ainfo_tz_createTimeZoneIDEnumeration, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
- PHP_ME_MAPPING(getCanonicalID, intltz_get_canonical_id, ainfo_tz_getCanonicalID, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
- PHP_ME_MAPPING(getRegion, intltz_get_region, ainfo_tz_idarg, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
- PHP_ME_MAPPING(getTZDataVersion, intltz_get_tz_data_version, ainfo_tz_void, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
- PHP_ME_MAPPING(getEquivalentID, intltz_get_equivalent_id, ainfo_tz_getEquivalentID, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
-
- PHP_ME_MAPPING(getID, intltz_get_id, ainfo_tz_void, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(useDaylightTime, intltz_use_daylight_time, ainfo_tz_void, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(getOffset, intltz_get_offset, ainfo_tz_getOffset, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(getRawOffset, intltz_get_raw_offset, ainfo_tz_void, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(hasSameRules, intltz_has_same_rules, ainfo_tz_hasSameRules, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(getDisplayName, intltz_get_display_name, ainfo_tz_getDisplayName, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(getDSTSavings, intltz_get_dst_savings, ainfo_tz_void, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(toDateTimeZone, intltz_to_date_time_zone, ainfo_tz_void, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(getErrorCode, intltz_get_error_code, ainfo_tz_void, ZEND_ACC_PUBLIC)
- PHP_ME_MAPPING(getErrorMessage, intltz_get_error_message, ainfo_tz_void, ZEND_ACC_PUBLIC)
+ PHP_ME(IntlTimeZone, __construct, arginfo_class_IntlTimeZone___construct, ZEND_ACC_PRIVATE)
+ PHP_ME_MAPPING(createTimeZone, intltz_create_time_zone, arginfo_class_IntlTimeZone_createTimeZone, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+ PHP_ME_MAPPING(fromDateTimeZone, intltz_from_date_time_zone, arginfo_class_IntlTimeZone_fromDateTimeZone, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+ PHP_ME_MAPPING(createDefault, intltz_create_default, arginfo_class_IntlTimeZone_createDefault, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+ PHP_ME_MAPPING(getGMT, intltz_get_gmt, arginfo_class_IntlTimeZone_getGMT, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+ PHP_ME_MAPPING(getUnknown, intltz_get_unknown, arginfo_class_IntlTimeZone_getUnknown, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+ PHP_ME_MAPPING(createEnumeration, intltz_create_enumeration, arginfo_class_IntlTimeZone_createEnumeration, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+ PHP_ME_MAPPING(countEquivalentIDs, intltz_count_equivalent_ids, arginfo_class_IntlTimeZone_countEquivalentIDs, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+ PHP_ME_MAPPING(createTimeZoneIDEnumeration, intltz_create_time_zone_id_enumeration, arginfo_class_IntlTimeZone_createTimeZoneIDEnumeration, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+ PHP_ME_MAPPING(getCanonicalID, intltz_get_canonical_id, arginfo_class_IntlTimeZone_getCanonicalID, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+ PHP_ME_MAPPING(getRegion, intltz_get_region, arginfo_class_IntlTimeZone_getRegion, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+ PHP_ME_MAPPING(getTZDataVersion, intltz_get_tz_data_version, arginfo_class_IntlTimeZone_getTZDataVersion, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+ PHP_ME_MAPPING(getEquivalentID, intltz_get_equivalent_id, arginfo_class_IntlTimeZone_getEquivalentID, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+
+ PHP_ME_MAPPING(getID, intltz_get_id, arginfo_class_IntlTimeZone_getID, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(useDaylightTime, intltz_use_daylight_time, arginfo_class_IntlTimeZone_useDaylightTime, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(getOffset, intltz_get_offset, arginfo_class_IntlTimeZone_getOffset, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(getRawOffset, intltz_get_raw_offset, arginfo_class_IntlTimeZone_getRawOffset, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(hasSameRules, intltz_has_same_rules, arginfo_class_IntlTimeZone_hasSameRules, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(getDisplayName, intltz_get_display_name, arginfo_class_IntlTimeZone_getDisplayName, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(getDSTSavings, intltz_get_dst_savings, arginfo_class_IntlTimeZone_getDSTSavings, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(toDateTimeZone, intltz_to_date_time_zone, arginfo_class_IntlTimeZone_toDateTimeZone, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(getErrorCode, intltz_get_error_code, arginfo_class_IntlTimeZone_getErrorCode, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(getErrorMessage, intltz_get_error_message, arginfo_class_IntlTimeZone_getErrorMessage, ZEND_ACC_PUBLIC)
#if U_ICU_VERSION_MAJOR_NUM >= 52
- PHP_ME_MAPPING(getWindowsID, intltz_get_windows_id, ainfo_tz_getWindowsID, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
- PHP_ME_MAPPING(getIDForWindowsID, intltz_get_id_for_windows_id, ainfo_tz_getIDForWindowsID, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+ PHP_ME_MAPPING(getWindowsID, intltz_get_windows_id, arginfo_class_IntlTimeZone_getWindowsID, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+ PHP_ME_MAPPING(getIDForWindowsID, intltz_get_id_for_windows_id, arginfo_class_IntlTimeZone_getIDForWindowsID, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
#endif
PHP_FE_END
};
@@ -514,7 +449,7 @@ U_CFUNC void timezone_register_IntlTimeZone_class(void)
sizeof TimeZone_handlers);
TimeZone_handlers.offset = XtOffsetOf(TimeZone_object, zo);
TimeZone_handlers.clone_obj = TimeZone_clone_obj;
- TimeZone_handlers.compare_objects = TimeZone_compare_objects;
+ TimeZone_handlers.compare = TimeZone_compare_objects;
TimeZone_handlers.get_debug_info = TimeZone_get_debug_info;
TimeZone_handlers.dtor_obj = TimeZone_objects_dtor;
TimeZone_handlers.free_obj = TimeZone_objects_free;
diff --git a/ext/intl/timezone/timezone_class.h b/ext/intl/timezone/timezone_class.h
index 99e9b56dae..8fe4524415 100644
--- a/ext/intl/timezone/timezone_class.h
+++ b/ext/intl/timezone/timezone_class.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -62,8 +60,8 @@ static inline TimeZone_object *php_intl_timezone_fetch_object(zend_object *obj)
#define TIMEZONE_METHOD_FETCH_OBJECT\
TIMEZONE_METHOD_FETCH_OBJECT_NO_CHECK; \
if (to->utimezone == NULL) { \
- intl_errors_set(&to->err, U_ILLEGAL_ARGUMENT_ERROR, "Found unconstructed IntlTimeZone", 0); \
- RETURN_FALSE; \
+ zend_throw_error(NULL, "Found unconstructed IntlTimeZone"); \
+ RETURN_THROWS(); \
}
zval *timezone_convert_to_datetimezone(const TimeZone *timeZone, intl_error *outside_error, const char *func, zval *ret);
diff --git a/ext/intl/timezone/timezone_methods.cpp b/ext/intl/timezone/timezone_methods.cpp
index 6e1d22324b..d11d8433c6 100644
--- a/ext/intl/timezone/timezone_methods.cpp
+++ b/ext/intl/timezone/timezone_methods.cpp
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -55,9 +53,7 @@ U_CFUNC PHP_FUNCTION(intltz_create_time_zone)
intl_error_reset(NULL);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &str_id, &str_id_len) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_create_time_zone: bad arguments", 0);
- RETURN_NULL();
+ RETURN_THROWS();
}
UErrorCode status = UErrorCode();
@@ -82,9 +78,7 @@ U_CFUNC PHP_FUNCTION(intltz_from_date_time_zone)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O",
&zv_timezone, php_date_get_timezone_ce()) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_from_date_time_zone: bad arguments", 0);
- RETURN_NULL();
+ RETURN_THROWS();
}
tzobj = Z_PHPTIMEZONE_P(zv_timezone);
@@ -109,9 +103,7 @@ U_CFUNC PHP_FUNCTION(intltz_create_default)
intl_error_reset(NULL);
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_create_default: bad arguments", 0);
- RETURN_NULL();
+ return;
}
TimeZone *tz = TimeZone::createDefault();
@@ -123,9 +115,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_gmt)
intl_error_reset(NULL);
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_get_gmt: bad arguments", 0);
- RETURN_NULL();
+ RETURN_THROWS();
}
timezone_object_construct(TimeZone::getGMT(), return_value, 0);
@@ -136,9 +126,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_unknown)
intl_error_reset(NULL);
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_get_unknown: bad arguments", 0);
- RETURN_NULL();
+ RETURN_THROWS();
}
timezone_object_construct(&TimeZone::getUnknown(), return_value, 0);
@@ -153,9 +141,7 @@ U_CFUNC PHP_FUNCTION(intltz_create_enumeration)
/* double indirection to have the zend engine destroy the new zval that
* results from separation */
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|z", &arg) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_create_enumeration: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (arg == NULL || Z_TYPE_P(arg) == IS_NULL) {
@@ -178,7 +164,7 @@ double_offset:
zend_long lval;
double dval;
if (!try_convert_to_string(arg)) {
- return;
+ RETURN_THROWS();
}
switch (is_numeric_string(Z_STRVAL_P(arg), Z_STRLEN_P(arg), &lval, &dval, 0)) {
case IS_DOUBLE:
@@ -215,9 +201,7 @@ U_CFUNC PHP_FUNCTION(intltz_count_equivalent_ids)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",
&str_id, &str_id_len) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_count_equivalent_ids: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
UErrorCode status = UErrorCode();
@@ -246,9 +230,7 @@ U_CFUNC PHP_FUNCTION(intltz_create_time_zone_id_enumeration)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|s!l!",
&zoneType, &region, &region_len, &offset_arg, &arg3isnull) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_create_time_zone_id_enumeration: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (zoneType != UCAL_ZONE_TYPE_ANY && zoneType != UCAL_ZONE_TYPE_CANONICAL
@@ -287,9 +269,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_canonical_id)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|z",
&str_id, &str_id_len, &is_systemid) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_get_canonical_id: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
UErrorCode status = UErrorCode();
@@ -326,9 +306,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_region)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",
&str_id, &str_id_len) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_get_region: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
UErrorCode status = UErrorCode();
@@ -350,9 +328,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_tz_data_version)
intl_error_reset(NULL);
if (zend_parse_parameters_none() == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_get_tz_data_version: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
UErrorCode status = UErrorCode();
@@ -370,11 +346,11 @@ U_CFUNC PHP_FUNCTION(intltz_get_equivalent_id)
zend_long index;
intl_error_reset(NULL);
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl",
- &str_id, &str_id_len, &index) == FAILURE ||
- index < (zend_long)INT32_MIN || index > (zend_long)INT32_MAX) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_get_equivalent_id: bad arguments", 0);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl", &str_id, &str_id_len, &index) == FAILURE) {
+ RETURN_THROWS();
+ }
+
+ if (index < (zend_long)INT32_MIN || index > (zend_long)INT32_MAX) {
RETURN_FALSE;
}
@@ -401,9 +377,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_id)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O",
&object, TimeZone_ce_ptr) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_get_id: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
TIMEZONE_METHOD_FETCH_OBJECT;
@@ -426,9 +400,7 @@ U_CFUNC PHP_FUNCTION(intltz_use_daylight_time)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O",
&object, TimeZone_ce_ptr) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_use_daylight_time: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
TIMEZONE_METHOD_FETCH_OBJECT;
@@ -449,9 +421,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_offset)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"Odbz/z/", &object, TimeZone_ce_ptr, &date, &local, &rawOffsetArg,
&dstOffsetArg) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_get_offset: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
TIMEZONE_METHOD_FETCH_OBJECT;
@@ -475,9 +445,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_raw_offset)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"O", &object, TimeZone_ce_ptr) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_get_raw_offset: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
TIMEZONE_METHOD_FETCH_OBJECT;
@@ -494,9 +462,7 @@ U_CFUNC PHP_FUNCTION(intltz_has_same_rules)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"OO", &object, TimeZone_ce_ptr, &other_object, TimeZone_ce_ptr)
== FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_has_same_rules: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
TIMEZONE_METHOD_FETCH_OBJECT;
other_to = Z_INTL_TIMEZONE_P(other_object);
@@ -527,9 +493,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_display_name)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"O|bls!", &object, TimeZone_ce_ptr, &daylight, &display_type,
&locale_str, &dummy) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_get_display_name: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
bool found = false;
@@ -566,9 +530,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_dst_savings)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"O", &object, TimeZone_ce_ptr) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_get_dst_savings: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
TIMEZONE_METHOD_FETCH_OBJECT;
@@ -583,9 +545,7 @@ U_CFUNC PHP_FUNCTION(intltz_to_date_time_zone)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"O", &object, TimeZone_ce_ptr) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_to_date_time_zone: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
TIMEZONE_METHOD_FETCH_OBJECT;
@@ -606,9 +566,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_error_code)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O",
&object, TimeZone_ce_ptr) == FAILURE) {
- intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_get_error_code: bad arguments", 0);
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* Fetch the object (without resetting its last error code ). */
@@ -626,9 +584,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_error_message)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O",
&object, TimeZone_ce_ptr) == FAILURE) {
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "intltz_get_error_message: bad arguments", 0 );
- RETURN_FALSE;
+ RETURN_THROWS();
}
@@ -655,7 +611,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_windows_id)
UErrorCode error;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &id) == FAILURE) {
- return;
+ RETURN_THROWS();
}
error = U_ZERO_ERROR;
@@ -693,7 +649,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_id_for_windows_id)
UErrorCode error;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|S", &winID, &region) == FAILURE) {
- return;
+ RETURN_THROWS();
}
error = U_ZERO_ERROR;
diff --git a/ext/intl/timezone/timezone_methods.h b/ext/intl/timezone/timezone_methods.h
index 6e6fa3f472..2f9ec349a1 100644
--- a/ext/intl/timezone/timezone_methods.h
+++ b/ext/intl/timezone/timezone_methods.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/transliterator/transliterator.c b/ext/intl/transliterator/transliterator.c
index a80de4bf9a..b865f97876 100644
--- a/ext/intl/transliterator/transliterator.c
+++ b/ext/intl/transliterator/transliterator.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/transliterator/transliterator.h b/ext/intl/transliterator/transliterator.h
index 081a730cbc..9d550bb2a4 100644
--- a/ext/intl/transliterator/transliterator.h
+++ b/ext/intl/transliterator/transliterator.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/transliterator/transliterator.stub.php b/ext/intl/transliterator/transliterator.stub.php
new file mode 100644
index 0000000000..1e96ba66cd
--- /dev/null
+++ b/ext/intl/transliterator/transliterator.stub.php
@@ -0,0 +1,42 @@
+<?php
+
+class Transliterator
+{
+ final private function __construct() {}
+
+ /** @return Transliterator|null */
+ public static function create(string $id, int $direction = Transliterator::FORWARD) {}
+
+ /** @return Transliterator|null */
+ public static function createFromRules(string $rules, int $direction = Transliterator::FORWARD) {}
+
+ /** @return Transliterator|null */
+ public function createInverse() {}
+
+ /** @return array|false */
+ public static function listIDs() {}
+
+ /** @return string|false */
+ public function transliterate(string $subject, int $start = 0, int $end = -1) {}
+
+ /** @return int|false */
+ public function getErrorCode() {}
+
+ /** @return string|false */
+ public function getErrorMessage() {}
+}
+
+function transliterator_create(string $id, int $direction = Transliterator::FORWARD): ?Transliterator {}
+
+function transliterator_create_from_rules(string $rules, int $direction = Transliterator::FORWARD): ?Transliterator {}
+
+function transliterator_list_ids(): array|false {}
+
+function transliterator_create_inverse(Transliterator $orig_trans): ?Transliterator {}
+
+/** @param Transliterator|string */
+function transliterator_transliterate($transliterator, string $subject, int $start = 0, int $end = -1): string|false {}
+
+function transliterator_get_error_code(Transliterator $trans): int|false {}
+
+function transliterator_get_error_message(Transliterator $trans): string|false {}
diff --git a/ext/intl/transliterator/transliterator_arginfo.h b/ext/intl/transliterator/transliterator_arginfo.h
new file mode 100644
index 0000000000..7061b4b5df
--- /dev/null
+++ b/ext/intl/transliterator/transliterator_arginfo.h
@@ -0,0 +1,60 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Transliterator___construct, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Transliterator_create, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, id, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, direction, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Transliterator_createFromRules, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, rules, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, direction, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_Transliterator_createInverse arginfo_class_Transliterator___construct
+
+#define arginfo_class_Transliterator_listIDs arginfo_class_Transliterator___construct
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Transliterator_transliterate, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, subject, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, start, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, end, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_Transliterator_getErrorCode arginfo_class_Transliterator___construct
+
+#define arginfo_class_Transliterator_getErrorMessage arginfo_class_Transliterator___construct
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_transliterator_create, 0, 1, Transliterator, 1)
+ ZEND_ARG_TYPE_INFO(0, id, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, direction, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_transliterator_create_from_rules, 0, 1, Transliterator, 1)
+ ZEND_ARG_TYPE_INFO(0, rules, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, direction, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_transliterator_list_ids, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_transliterator_create_inverse, 0, 1, Transliterator, 1)
+ ZEND_ARG_OBJ_INFO(0, orig_trans, Transliterator, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_transliterator_transliterate, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, transliterator)
+ ZEND_ARG_TYPE_INFO(0, subject, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, start, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, end, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_transliterator_get_error_code, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, trans, Transliterator, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_transliterator_get_error_message, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, trans, Transliterator, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/intl/transliterator/transliterator_class.c b/ext/intl/transliterator/transliterator_class.c
index 4417fba4f0..4afc6017c3 100644
--- a/ext/intl/transliterator/transliterator_class.c
+++ b/ext/intl/transliterator/transliterator_class.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -17,6 +15,7 @@
#include "transliterator_class.h"
#include "php_intl.h"
#include "transliterator_methods.h"
+#include "transliterator_arginfo.h"
#include "intl_error.h"
#include "intl_convert.h"
#include "intl_data.h"
@@ -130,16 +129,16 @@ static zend_object *Transliterator_object_create( zend_class_entry *ce )
*/
/* {{{ clone handler for Transliterator */
-static zend_object *Transliterator_clone_obj( zval *object )
+static zend_object *Transliterator_clone_obj( zend_object *object )
{
Transliterator_object *to_orig,
*to_new;
zend_object *ret_val;
intl_error_reset( NULL );
- to_orig = Z_INTL_TRANSLITERATOR_P( object );
+ to_orig = php_intl_transliterator_fetch_object( object );
intl_error_reset( INTL_DATA_ERROR_P( to_orig ) );
- ret_val = Transliterator_ce_ptr->create_object( Z_OBJCE_P( object ) );
+ ret_val = Transliterator_ce_ptr->create_object( object->ce );
to_new = php_intl_transliterator_fetch_object( ret_val );
zend_objects_clone_members( &to_new->zo, &to_orig->zo );
@@ -189,78 +188,52 @@ err:
}
/* }}} */
-#define TRANSLITERATOR_PROPERTY_HANDLER_PROLOG(return_fail) \
- zval tmp_member; \
- if( Z_TYPE_P( member ) != IS_STRING ) \
- { \
- zend_string *_str = \
- zval_try_get_string_func(member); \
- if (UNEXPECTED(!_str)) { return_fail; } \
- ZVAL_STR(&tmp_member, _str); \
- member = &tmp_member; \
- cache_slot = NULL; \
- }
-
-#define TRANSLITERATOR_PROPERTY_HANDLER_EPILOG \
- if( member == &tmp_member ) \
- { \
- zval_ptr_dtor_str( &tmp_member ); \
- }
-
/* {{{ get_property_ptr_ptr handler */
-static zval *Transliterator_get_property_ptr_ptr( zval *object, zval *member, int type, void **cache_slot )
+static zval *Transliterator_get_property_ptr_ptr( zend_object *object, zend_string *name, int type, void **cache_slot )
{
zval *retval;
- TRANSLITERATOR_PROPERTY_HANDLER_PROLOG(return NULL);
-
if(zend_binary_strcmp( "id", sizeof( "id" ) - 1,
- Z_STRVAL_P( member ), Z_STRLEN_P( member ) ) == 0 )
+ ZSTR_VAL( name ), ZSTR_LEN( name ) ) == 0 )
{
retval = NULL; /* fallback to read_property */
}
else
{
- retval = zend_std_get_property_ptr_ptr( object, member, type, cache_slot );
+ retval = zend_std_get_property_ptr_ptr( object, name, type, cache_slot );
}
- TRANSLITERATOR_PROPERTY_HANDLER_EPILOG;
-
return retval;
}
/* }}} */
/* {{{ read_property handler */
-static zval *Transliterator_read_property( zval *object, zval *member, int type, void **cache_slot, zval *rv )
+static zval *Transliterator_read_property( zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv )
{
zval *retval;
- TRANSLITERATOR_PROPERTY_HANDLER_PROLOG(return &EG(uninitialized_zval));
-
if( ( type != BP_VAR_R && type != BP_VAR_IS ) &&
( zend_binary_strcmp( "id", sizeof( "id" ) - 1,
- Z_STRVAL_P( member ), Z_STRLEN_P( member ) ) == 0 ) )
+ ZSTR_VAL( name ), ZSTR_LEN( name ) ) == 0 ) )
{
php_error_docref(NULL, E_WARNING, "The property \"id\" is read-only" );
retval = &EG( uninitialized_zval );
}
else
{
- retval = zend_std_read_property( object, member, type, cache_slot, rv );
+ retval = zend_std_read_property( object, name, type, cache_slot, rv );
}
- TRANSLITERATOR_PROPERTY_HANDLER_EPILOG;
-
return retval;
}
/* }}} */
/* {{{ write_property handler */
-static zval *Transliterator_write_property( zval *object, zval *member, zval *value, void **cache_slot )
+static zval *Transliterator_write_property( zend_object *object, zend_string *name, zval *value,
+ void **cache_slot )
{
zend_class_entry *scope;
- TRANSLITERATOR_PROPERTY_HANDLER_PROLOG(return value);
if (EG(fake_scope)) {
scope = EG(fake_scope);
@@ -269,59 +242,31 @@ static zval *Transliterator_write_property( zval *object, zval *member, zval *va
}
if( ( scope != Transliterator_ce_ptr ) &&
( zend_binary_strcmp( "id", sizeof( "id" ) - 1,
- Z_STRVAL_P( member ), Z_STRLEN_P( member ) ) == 0 ) )
+ ZSTR_VAL( name ), ZSTR_LEN( name ) ) == 0 ) )
{
php_error_docref(NULL, E_WARNING, "The property \"id\" is read-only" );
}
else
{
- value = zend_std_write_property( object, member, value, cache_slot );
+ value = zend_std_write_property( object, name, value, cache_slot );
}
- TRANSLITERATOR_PROPERTY_HANDLER_EPILOG;
-
return value;
}
/* }}} */
-/*
- * 'Transliterator' class registration structures & functions
- */
-
-/* {{{ Transliterator methods arguments info */
-
-ZEND_BEGIN_ARG_INFO_EX( ainfo_trans_void, 0, 0, 0 )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( ainfo_trans_create, 0, 0, 1 )
- ZEND_ARG_INFO( 0, id )
- ZEND_ARG_INFO( 0, direction )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( ainfo_trans_create_from_rules, 0, 0, 1 )
- ZEND_ARG_INFO( 0, rules )
- ZEND_ARG_INFO( 0, direction )
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX( ainfo_trans_me_transliterate, 0, 0, 1 )
- ZEND_ARG_INFO( 0, subject )
- ZEND_ARG_INFO( 0, start )
- ZEND_ARG_INFO( 0, end )
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ Transliterator_class_functions
* Every 'Transliterator' class method has an entry in this table
*/
static const zend_function_entry Transliterator_class_functions[] = {
- PHP_ME( Transliterator, __construct, ainfo_trans_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL )
- PHP_ME_MAPPING( create, transliterator_create, ainfo_trans_create, ZEND_ACC_STATIC |ZEND_ACC_PUBLIC )
- PHP_ME_MAPPING( createFromRules,transliterator_create_from_rules, ainfo_trans_create_from_rules, ZEND_ACC_STATIC | ZEND_ACC_PUBLIC )
- PHP_ME_MAPPING( createInverse, transliterator_create_inverse, ainfo_trans_void, ZEND_ACC_PUBLIC )
- PHP_ME_MAPPING( listIDs, transliterator_list_ids, ainfo_trans_void, ZEND_ACC_STATIC | ZEND_ACC_PUBLIC )
- PHP_ME_MAPPING( transliterate, transliterator_transliterate, ainfo_trans_me_transliterate, ZEND_ACC_PUBLIC )
- PHP_ME_MAPPING( getErrorCode, transliterator_get_error_code, ainfo_trans_void, ZEND_ACC_PUBLIC )
- PHP_ME_MAPPING( getErrorMessage,transliterator_get_error_message, ainfo_trans_void, ZEND_ACC_PUBLIC )
+ PHP_ME( Transliterator, __construct, arginfo_class_Transliterator___construct, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL )
+ PHP_ME_MAPPING( create, transliterator_create, arginfo_class_Transliterator_create, ZEND_ACC_STATIC |ZEND_ACC_PUBLIC )
+ PHP_ME_MAPPING( createFromRules,transliterator_create_from_rules, arginfo_class_Transliterator_createFromRules, ZEND_ACC_STATIC | ZEND_ACC_PUBLIC )
+ PHP_ME_MAPPING( createInverse, transliterator_create_inverse, arginfo_class_Transliterator_createInverse, ZEND_ACC_PUBLIC )
+ PHP_ME_MAPPING( listIDs, transliterator_list_ids, arginfo_class_Transliterator_listIDs, ZEND_ACC_STATIC | ZEND_ACC_PUBLIC )
+ PHP_ME_MAPPING( transliterate, transliterator_transliterate, arginfo_class_Transliterator_transliterate, ZEND_ACC_PUBLIC )
+ PHP_ME_MAPPING( getErrorCode, transliterator_get_error_code, arginfo_class_Transliterator_getErrorCode, ZEND_ACC_PUBLIC )
+ PHP_ME_MAPPING( getErrorMessage,transliterator_get_error_message, arginfo_class_Transliterator_getErrorMessage, ZEND_ACC_PUBLIC )
PHP_FE_END
};
/* }}} */
diff --git a/ext/intl/transliterator/transliterator_class.h b/ext/intl/transliterator/transliterator_class.h
index 83e99b6f73..907ad79c44 100644
--- a/ext/intl/transliterator/transliterator_class.h
+++ b/ext/intl/transliterator/transliterator_class.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -54,8 +52,8 @@ static inline Transliterator_object *php_intl_transliterator_fetch_object(zend_o
TRANSLITERATOR_METHOD_FETCH_OBJECT_NO_CHECK; \
if( to->utrans == NULL ) \
{ \
- intl_errors_set( &to->err, U_ILLEGAL_ARGUMENT_ERROR, "Found unconstructed transliterator", 0 ); \
- RETURN_FALSE; \
+ zend_throw_error(NULL, "Found unconstructed transliterator"); \
+ RETURN_THROWS(); \
}
int transliterator_object_construct( zval *object,
diff --git a/ext/intl/transliterator/transliterator_methods.c b/ext/intl/transliterator/transliterator_methods.c
index f1518d80a1..766a0cbfe7 100644
--- a/ext/intl/transliterator/transliterator_methods.c
+++ b/ext/intl/transliterator/transliterator_methods.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@@ -33,7 +31,7 @@ static int create_transliterator( char *str_id, size_t str_id_len, zend_long dir
UChar *ustr_id = NULL;
int32_t ustr_id_len = 0;
UTransliterator *utrans;
- UParseError parse_error = {0, -1};
+ UParseError parse_error;
intl_error_reset( NULL );
@@ -115,9 +113,7 @@ PHP_FUNCTION( transliterator_create )
if( zend_parse_parameters( ZEND_NUM_ARGS(), "s|l",
&str_id, &str_id_len, &direction ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "transliterator_create: bad arguments", 0 );
- RETURN_NULL();
+ RETURN_THROWS();
}
object = return_value;
@@ -140,7 +136,7 @@ PHP_FUNCTION( transliterator_create_from_rules )
UChar *ustr_rules = NULL;
int32_t ustr_rules_len = 0;
zend_long direction = TRANSLITERATOR_FORWARD;
- UParseError parse_error = {0, -1};
+ UParseError parse_error;
UTransliterator *utrans;
UChar id[] = {0x52, 0x75, 0x6C, 0x65, 0x73, 0x54, 0x72,
0x61, 0x6E, 0x73, 0x50, 0x48, 0x50, 0}; /* RulesTransPHP */
@@ -149,9 +145,7 @@ PHP_FUNCTION( transliterator_create_from_rules )
if( zend_parse_parameters( ZEND_NUM_ARGS(), "s|l",
&str_rules, &str_rules_len, &direction ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "transliterator_create_from_rules: bad arguments", 0 );
- RETURN_NULL();
+ RETURN_THROWS();
}
if( ( direction != TRANSLITERATOR_FORWARD ) && (direction != TRANSLITERATOR_REVERSE ) )
@@ -214,9 +208,7 @@ PHP_FUNCTION( transliterator_create_inverse )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O",
&object, Transliterator_ce_ptr ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "transliterator_create_inverse: bad arguments", 0 );
- RETURN_NULL();
+ RETURN_THROWS();
}
TRANSLITERATOR_METHOD_FETCH_OBJECT;
@@ -250,12 +242,7 @@ PHP_FUNCTION( transliterator_list_ids )
if( zend_parse_parameters_none() == FAILURE )
{
- /* seems to be the convention in this lib to return false instead of
- * null on bad parameter types, except on constructors and factory
- * methods */
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "transliterator_list_ids: bad arguments", 0 );
- RETURN_FALSE;
+ RETURN_THROWS();
}
en = utrans_openIDs( &status );
@@ -317,9 +304,7 @@ PHP_FUNCTION( transliterator_transliterate )
if( zend_parse_parameters( ZEND_NUM_ARGS(), "zs|ll",
&arg1, &str, &str_len, &start, &limit ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "transliterator_transliterate: bad arguments", 0 );
- RETURN_FALSE;
+ RETURN_THROWS();
}
if( Z_TYPE_P( arg1 ) == IS_OBJECT &&
@@ -331,7 +316,7 @@ PHP_FUNCTION( transliterator_transliterate )
{ /* not a transliterator object as first argument */
int res;
if( !try_convert_to_string( arg1 ) ) {
- return;
+ RETURN_THROWS();
}
object = &tmp_object;
res = create_transliterator( Z_STRVAL_P( arg1 ), Z_STRLEN_P( arg1 ),
@@ -351,9 +336,7 @@ PHP_FUNCTION( transliterator_transliterate )
else if( zend_parse_parameters( ZEND_NUM_ARGS(), "s|ll",
&str, &str_len, &start, &limit ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "transliterator_transliterate: bad arguments", 0 );
- RETURN_FALSE;
+ RETURN_THROWS();
}
if( limit < -1 )
@@ -479,10 +462,7 @@ PHP_FUNCTION( transliterator_get_error_code )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O",
&object, Transliterator_ce_ptr ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "transliterator_get_error_code: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* Fetch the object (without resetting its last error code ). */
@@ -507,10 +487,7 @@ PHP_FUNCTION( transliterator_get_error_message )
if( zend_parse_method_parameters( ZEND_NUM_ARGS(), getThis(), "O",
&object, Transliterator_ce_ptr ) == FAILURE )
{
- intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
- "transliterator_get_error_message: unable to parse input params", 0 );
-
- RETURN_FALSE;
+ RETURN_THROWS();
}
diff --git a/ext/intl/transliterator/transliterator_methods.h b/ext/intl/transliterator/transliterator_methods.h
index ff0b93a29a..71eb79a3d7 100644
--- a/ext/intl/transliterator/transliterator_methods.h
+++ b/ext/intl/transliterator/transliterator_methods.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
diff --git a/ext/intl/uchar/uchar.c b/ext/intl/uchar/uchar.c
index 857b4d5d93..f9ed3153ad 100644
--- a/ext/intl/uchar/uchar.c
+++ b/ext/intl/uchar/uchar.c
@@ -55,9 +55,12 @@ IC_METHOD(chr) {
char buffer[5];
int buffer_len = 0;
- if ((zend_parse_parameters(ZEND_NUM_ARGS(), "z", &zcp) == FAILURE) ||
- (convert_cp(&cp, zcp) == FAILURE)) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &zcp) == FAILURE) {
+ RETURN_THROWS();
+ }
+
+ if (convert_cp(&cp, zcp) == FAILURE) {
+ RETURN_NULL();
}
/* We can use unsafe because we know the codepoint is in valid range
@@ -80,9 +83,12 @@ IC_METHOD(ord) {
UChar32 cp;
zval *zcp;
- if ((zend_parse_parameters(ZEND_NUM_ARGS(), "z", &zcp) == FAILURE) ||
- (convert_cp(&cp, zcp) == FAILURE)) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &zcp) == FAILURE) {
+ RETURN_THROWS();
+ }
+
+ if (convert_cp(&cp, zcp) == FAILURE) {
+ RETURN_NULL();
}
RETURN_LONG(cp);
@@ -99,9 +105,12 @@ IC_METHOD(hasBinaryProperty) {
zend_long prop;
zval *zcp;
- if ((zend_parse_parameters(ZEND_NUM_ARGS(), "zl", &zcp, &prop) == FAILURE) ||
- (convert_cp(&cp, zcp) == FAILURE)) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "zl", &zcp, &prop) == FAILURE) {
+ RETURN_THROWS();
+ }
+
+ if (convert_cp(&cp, zcp) == FAILURE) {
+ RETURN_NULL();
}
RETURN_BOOL(u_hasBinaryProperty(cp, (UProperty)prop));
@@ -118,9 +127,12 @@ IC_METHOD(getIntPropertyValue) {
zend_long prop;
zval *zcp;
- if ((zend_parse_parameters(ZEND_NUM_ARGS(), "zl", &zcp, &prop) == FAILURE) ||
- (convert_cp(&cp, zcp) == FAILURE)) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "zl", &zcp, &prop) == FAILURE) {
+ RETURN_THROWS();
+ }
+
+ if (convert_cp(&cp, zcp) == FAILURE) {
+ RETURN_NULL();
}
RETURN_LONG(u_getIntPropertyValue(cp, (UProperty)prop));
@@ -135,7 +147,7 @@ IC_METHOD(getIntPropertyMinValue) {
zend_long prop;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &prop) == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_LONG(u_getIntPropertyMinValue((UProperty)prop));
@@ -150,7 +162,7 @@ IC_METHOD(getIntPropertyMaxValue) {
zend_long prop;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &prop) == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_LONG(u_getIntPropertyMaxValue((UProperty)prop));
@@ -165,9 +177,12 @@ IC_METHOD(getNumericValue) {
UChar32 cp;
zval *zcp;
- if ((zend_parse_parameters(ZEND_NUM_ARGS(), "z", &zcp) == FAILURE) ||
- (convert_cp(&cp, zcp) == FAILURE)) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &zcp) == FAILURE) {
+ RETURN_THROWS();
+ }
+
+ if (convert_cp(&cp, zcp) == FAILURE) {
+ RETURN_NULL();
}
RETURN_DOUBLE(u_getNumericValue(cp));
@@ -213,7 +228,7 @@ IC_METHOD(enumCharTypes) {
enumCharType_data context;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "f", &context.fci, &context.fci_cache) == FAILURE) {
- return;
+ RETURN_THROWS();
}
u_enumCharTypes((UCharEnumTypeRange*)enumCharType_callback, &context);
}
@@ -227,9 +242,12 @@ IC_METHOD(getBlockCode) {
UChar32 cp;
zval *zcp;
- if ((zend_parse_parameters(ZEND_NUM_ARGS(), "z", &zcp) == FAILURE) ||
- (convert_cp(&cp, zcp) == FAILURE)) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &zcp) == FAILURE) {
+ RETURN_THROWS();
+ }
+
+ if (convert_cp(&cp, zcp) == FAILURE) {
+ RETURN_NULL();
}
RETURN_LONG(ublock_getCode(cp));
@@ -249,8 +267,11 @@ IC_METHOD(charName) {
zend_string *buffer = NULL;
int32_t buffer_len;
- if ((zend_parse_parameters(ZEND_NUM_ARGS(), "z|l", &zcp, &nameChoice) == FAILURE) ||
- (convert_cp(&cp, zcp) == FAILURE)) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|l", &zcp, &nameChoice) == FAILURE) {
+ RETURN_THROWS();
+ }
+
+ if (convert_cp(&cp, zcp) == FAILURE) {
RETURN_NULL();
}
@@ -279,7 +300,7 @@ IC_METHOD(charFromName) {
UErrorCode error = U_ZERO_ERROR;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &name, &name_len, &nameChoice) == FAILURE) {
- RETURN_NULL();
+ RETURN_THROWS();
}
ret = u_charFromName((UCharNameChoice)nameChoice, name, &error);
@@ -332,10 +353,12 @@ IC_METHOD(enumCharNames) {
zend_long nameChoice = U_UNICODE_CHAR_NAME;
UErrorCode error = U_ZERO_ERROR;
- if ((zend_parse_parameters(ZEND_NUM_ARGS(), "zzf|l", &zstart, &zlimit, &context.fci, &context.fci_cache, &nameChoice) == FAILURE) ||
- (convert_cp(&start, zstart) == FAILURE) ||
- (convert_cp(&limit, zlimit) == FAILURE)) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "zzf|l", &zstart, &zlimit, &context.fci, &context.fci_cache, &nameChoice) == FAILURE) {
+ RETURN_THROWS();
+ }
+
+ if (convert_cp(&start, zstart) == FAILURE || convert_cp(&limit, zlimit) == FAILURE) {
+ RETURN_NULL();
}
u_enumCharNames(start, limit, (UEnumCharNamesFn*)enumCharNames_callback, &context, nameChoice, &error);
@@ -354,7 +377,7 @@ IC_METHOD(getPropertyName) {
const char *ret;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l", &property, &nameChoice) == FAILURE) {
- return;
+ RETURN_THROWS();
}
ret = u_getPropertyName((UProperty)property, (UPropertyNameChoice)nameChoice);
@@ -377,7 +400,7 @@ IC_METHOD(getPropertyEnum) {
size_t alias_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &alias, &alias_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_LONG(u_getPropertyEnum(alias));
@@ -395,7 +418,7 @@ IC_METHOD(getPropertyValueName) {
const char *ret;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll|l", &property, &value, &nameChoice) == FAILURE) {
- return;
+ RETURN_THROWS();
}
ret = u_getPropertyValueName((UProperty)property, value, (UPropertyNameChoice)nameChoice);
@@ -420,7 +443,7 @@ IC_METHOD(getPropertyValueEnum) {
size_t name_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &property, &name, &name_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_LONG(u_getPropertyValueEnum((UProperty)property, name));
@@ -437,9 +460,12 @@ IC_METHOD(foldCase) {
zval *zcp;
zend_long options = U_FOLD_CASE_DEFAULT;
- if ((zend_parse_parameters(ZEND_NUM_ARGS(), "z|l", &zcp, &options) == FAILURE) ||
- (convert_cp(&cp, zcp) == FAILURE)) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|l", &zcp, &options) == FAILURE) {
+ RETURN_THROWS();
+ }
+
+ if (convert_cp(&cp, zcp) == FAILURE) {
+ RETURN_NULL();
}
ret = u_foldCase(cp, options);
@@ -466,9 +492,12 @@ IC_METHOD(digit) {
zend_long radix = 10;
int ret;
- if ((zend_parse_parameters(ZEND_NUM_ARGS(), "z|l", &zcp, &radix) == FAILURE) ||
- (convert_cp(&cp, zcp) == FAILURE)) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|l", &zcp, &radix) == FAILURE) {
+ RETURN_THROWS();
+ }
+
+ if (convert_cp(&cp, zcp) == FAILURE) {
+ RETURN_NULL();
}
ret = u_digit(cp, radix);
@@ -490,7 +519,7 @@ IC_METHOD(forDigit) {
zend_long digit, radix = 10;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l", &digit, &radix) == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_LONG(u_forDigit(digit, radix));
@@ -507,9 +536,12 @@ IC_METHOD(charAge) {
UVersionInfo version;
int i;
- if ((zend_parse_parameters(ZEND_NUM_ARGS(), "z", &zcp) == FAILURE) ||
- (convert_cp(&cp, zcp) == FAILURE)) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &zcp) == FAILURE) {
+ RETURN_THROWS();
+ }
+
+ if (convert_cp(&cp, zcp) == FAILURE) {
+ RETURN_NULL();
}
u_charAge(cp, version);
@@ -527,6 +559,9 @@ IC_METHOD(getUnicodeVersion) {
UVersionInfo version;
int i;
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
u_getUnicodeVersion(version);
array_init(return_value);
@@ -548,9 +583,12 @@ IC_METHOD(getFC_NFKC_Closure) {
int32_t closure_len;
UErrorCode error = U_ZERO_ERROR;
- if ((zend_parse_parameters(ZEND_NUM_ARGS(), "z", &zcp) == FAILURE) ||
- (convert_cp(&cp, zcp) == FAILURE)) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &zcp) == FAILURE) {
+ RETURN_THROWS();
+ }
+
+ if (convert_cp(&cp, zcp) == FAILURE) {
+ RETURN_NULL();
}
closure_len = u_getFC_NFKC_Closure(cp, NULL, 0, &error);
diff --git a/ext/json/Makefile.frag b/ext/json/Makefile.frag
index 8719b6607f..f5fe3c3306 100644
--- a/ext/json/Makefile.frag
+++ b/ext/json/Makefile.frag
@@ -2,4 +2,4 @@ $(srcdir)/json_scanner.c: $(srcdir)/json_scanner.re
@$(RE2C) $(RE2C_FLAGS) -t $(srcdir)/php_json_scanner_defs.h --no-generation-date -bci -o $@ $(srcdir)/json_scanner.re
$(srcdir)/json_parser.tab.c: $(srcdir)/json_parser.y
- @$(YACC) --defines -l $(srcdir)/json_parser.y -o $@
+ @$(YACC) $(YFLAGS) --defines -l $(srcdir)/json_parser.y -o $@
diff --git a/ext/json/json.c b/ext/json/json.c
index 8474642266..10ec93e220 100644
--- a/ext/json/json.c
+++ b/ext/json/json.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -29,6 +27,7 @@
#include "php_json.h"
#include "php_json_encoder.h"
#include "php_json_parser.h"
+#include "json_arginfo.h"
#include <zend_exceptions.h>
static PHP_MINFO_FUNCTION(json);
@@ -42,27 +41,6 @@ PHP_JSON_API zend_class_entry *php_json_exception_ce;
PHP_JSON_API ZEND_DECLARE_MODULE_GLOBALS(json)
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_json_encode, 0, 0, 1)
- ZEND_ARG_INFO(0, value)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, depth)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_json_decode, 0, 0, 1)
- ZEND_ARG_INFO(0, json)
- ZEND_ARG_INFO(0, assoc)
- ZEND_ARG_INFO(0, depth)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_json_last_error, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_json_last_error_msg, 0)
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ json_functions[] */
static const zend_function_entry json_functions[] = {
PHP_FE(json_encode, arginfo_json_encode)
@@ -74,12 +52,8 @@ static const zend_function_entry json_functions[] = {
/* }}} */
/* {{{ JsonSerializable methods */
-ZEND_BEGIN_ARG_INFO(json_serialize_arginfo, 0)
- /* No arguments */
-ZEND_END_ARG_INFO();
-
static const zend_function_entry json_serializable_interface[] = {
- PHP_ABSTRACT_ME(JsonSerializable, jsonSerialize, json_serialize_arginfo)
+ PHP_ABSTRACT_ME(JsonSerializable, jsonSerialize, arginfo_class_JsonSerializable_jsonSerialize)
PHP_FE_END
};
/* }}} */
@@ -294,7 +268,7 @@ static PHP_FUNCTION(json_encode)
if (encoder.error_code != PHP_JSON_ERROR_NONE) {
smart_str_free(&buf);
zend_throw_exception(php_json_exception_ce, php_json_get_error_msg(encoder.error_code), encoder.error_code);
- RETURN_FALSE;
+ RETURN_THROWS();
}
}
@@ -339,13 +313,13 @@ static PHP_FUNCTION(json_decode)
}
if (depth <= 0) {
- php_error_docref(NULL, E_WARNING, "Depth must be greater than zero");
- RETURN_NULL();
+ zend_value_error("Depth must be greater than zero");
+ RETURN_THROWS();
}
if (depth > INT_MAX) {
- php_error_docref(NULL, E_WARNING, "Depth must be lower than %d", INT_MAX);
- RETURN_NULL();
+ zend_value_error("Depth must be lower than %d", INT_MAX);
+ RETURN_THROWS();
}
/* For BC reasons, the bool $assoc overrides the long $options bit for PHP_JSON_OBJECT_AS_ARRAY */
@@ -365,9 +339,7 @@ static PHP_FUNCTION(json_decode)
Returns the error code of the last json_encode() or json_decode() call. */
static PHP_FUNCTION(json_last_error)
{
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
RETURN_LONG(JSON_G(error_code));
}
@@ -377,9 +349,7 @@ static PHP_FUNCTION(json_last_error)
Returns the error string of the last json_encode() or json_decode() call. */
static PHP_FUNCTION(json_last_error_msg)
{
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
RETURN_STRING(php_json_get_error_msg(JSON_G(error_code)));
}
diff --git a/ext/json/json.stub.php b/ext/json/json.stub.php
new file mode 100644
index 0000000000..90bedef91e
--- /dev/null
+++ b/ext/json/json.stub.php
@@ -0,0 +1,15 @@
+<?php
+
+function json_encode($value, int $options = 0, int $depth = 512): string|false {}
+
+/** @return mixed */
+function json_decode(string $json, ?bool $assoc = null, int $depth = 512, int $options = 0) {}
+
+function json_last_error(): int {}
+
+function json_last_error_msg(): string {}
+
+interface JsonSerializable
+{
+ public function jsonSerialize();
+}
diff --git a/ext/json/json_arginfo.h b/ext/json/json_arginfo.h
new file mode 100644
index 0000000000..2a06f84f6c
--- /dev/null
+++ b/ext/json/json_arginfo.h
@@ -0,0 +1,23 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_json_encode, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, value)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, depth, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_json_decode, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, json, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, assoc, _IS_BOOL, 1)
+ ZEND_ARG_TYPE_INFO(0, depth, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_json_last_error, 0, 0, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_json_last_error_msg, 0, 0, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_JsonSerializable_jsonSerialize, 0, 0, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/json/json_encoder.c b/ext/json/json_encoder.c
index c0fcbe3282..d08a466643 100644
--- a/ext/json/json_encoder.c
+++ b/ext/json/json_encoder.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/json/json_parser.y b/ext/json/json_parser.y
index aec9b225b8..4705e498a6 100644
--- a/ext/json/json_parser.y
+++ b/ext/json/json_parser.y
@@ -1,8 +1,7 @@
+%require "3.0"
%code top {
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -42,10 +41,9 @@ int json_yydebug = 1;
}
-%define api.pure full
%define api.prefix {php_json_yy}
-%lex-param { php_json_parser *parser }
-%parse-param { php_json_parser *parser }
+%define api.pure full
+%param { php_json_parser *parser }
%union {
zval value;
@@ -120,7 +118,7 @@ object_end:
;
members:
- /* empty */
+ %empty
{
if ((parser->scanner.options & PHP_JSON_OBJECT_AS_ARRAY) && parser->methods.object_create == php_json_parser_object_create) {
ZVAL_EMPTY_ARRAY(&$$);
@@ -184,7 +182,7 @@ array_end:
;
elements:
- /* empty */
+ %empty
{
if (parser->methods.array_create == php_json_parser_array_create) {
ZVAL_EMPTY_ARRAY(&$$);
@@ -255,7 +253,6 @@ static int php_json_parser_object_update(php_json_parser *parser, zval *object,
if (Z_TYPE_P(object) == IS_ARRAY) {
zend_symtable_update(Z_ARRVAL_P(object), key, zvalue);
} else {
- zval zkey;
if (ZSTR_LEN(key) > 0 && ZSTR_VAL(key)[0] == '\0') {
parser->scanner.errcode = PHP_JSON_ERROR_INVALID_PROPERTY_NAME;
zend_string_release_ex(key, 0);
@@ -263,8 +260,7 @@ static int php_json_parser_object_update(php_json_parser *parser, zval *object,
zval_ptr_dtor_nogc(object);
return FAILURE;
}
- ZVAL_NEW_STR(&zkey, key);
- zend_std_write_property(object, &zkey, zvalue, NULL);
+ zend_std_write_property(Z_OBJ_P(object), key, zvalue, NULL);
Z_TRY_DELREF_P(zvalue);
}
zend_string_release_ex(key, 0);
diff --git a/ext/json/json_scanner.re b/ext/json/json_scanner.re
index a64d09bfc3..5b571e6dd2 100644
--- a/ext/json/json_scanner.re
+++ b/ext/json/json_scanner.re
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/json/php_json.h b/ext/json/php_json.h
index 99afe8dd2d..4fc7ded7d4 100644
--- a/ext/json/php_json.h
+++ b/ext/json/php_json.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/json/php_json_encoder.h b/ext/json/php_json_encoder.h
index e8266bfd06..8d9825b4fb 100644
--- a/ext/json/php_json_encoder.h
+++ b/ext/json/php_json_encoder.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/json/php_json_parser.h b/ext/json/php_json_parser.h
index 8b6393d100..05f7a061c6 100644
--- a/ext/json/php_json_parser.h
+++ b/ext/json/php_json_parser.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/json/php_json_scanner.h b/ext/json/php_json_scanner.h
index 7a9356146c..7a2d841703 100644
--- a/ext/json/php_json_scanner.h
+++ b/ext/json/php_json_scanner.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/json/tests/001.phpt b/ext/json/tests/001.phpt
index e908b44349..b429aef0dc 100644
--- a/ext/json/tests/001.phpt
+++ b/ext/json/tests/001.phpt
@@ -5,7 +5,6 @@ json_decode() tests
--FILE--
<?php
-var_dump(json_decode());
var_dump(json_decode(""));
var_dump(json_decode("", 1));
var_dump(json_decode("", 0));
@@ -24,10 +23,7 @@ var_dump(json_decode('{ "": { "": "" }'));
var_dump(json_decode('{ "": "": "" } }'));
?>
-===DONE===
--EXPECTF--
-Warning: json_decode() expects at least 1 parameter, 0 given in %s on line %d
-NULL
NULL
NULL
NULL
@@ -68,4 +64,3 @@ object(stdClass)#%d (1) {
}
NULL
NULL
-===DONE===
diff --git a/ext/json/tests/003.phpt b/ext/json/tests/003.phpt
index 3248689bf9..e0a5e46978 100644
--- a/ext/json/tests/003.phpt
+++ b/ext/json/tests/003.phpt
@@ -25,10 +25,7 @@ echo "Done\n";
--EXPECTF--
array(1) {
[0]=>
- &array(1) {
- [0]=>
- *RECURSION*
- }
+ *RECURSION*
}
bool(false)
diff --git a/ext/json/tests/bug40503.phpt b/ext/json/tests/bug40503.phpt
index 10896a428e..17c8fbd92a 100644
--- a/ext/json/tests/bug40503.phpt
+++ b/ext/json/tests/bug40503.phpt
@@ -7,7 +7,7 @@ serialize_precision=-1
--FILE--
<?php
function json_test_show_eq($x, $y) {
- echo "$x ". ( $x == $y ? "==" : "!=") ." $y\n";
+ echo "$x ". ( $x == $y ? "==" : "!=") ." $y\n";
}
$value = 0x7FFFFFFF; #2147483647;
diff --git a/ext/json/tests/bug42090.phpt b/ext/json/tests/bug42090.phpt
index 9e5b3317e5..b0c9efc102 100644
--- a/ext/json/tests/bug42090.phpt
+++ b/ext/json/tests/bug42090.phpt
@@ -5,13 +5,13 @@ Bug #42090 (json_decode causes segmentation fault)
--FILE--
<?php
var_dump(
- json_decode('""'),
- json_decode('"..".'),
- json_decode('"'),
- json_decode('""""'),
- json_encode('"'),
- json_decode(json_encode('"')),
- json_decode(json_encode('""'))
+ json_decode('""'),
+ json_decode('"..".'),
+ json_decode('"'),
+ json_decode('""""'),
+ json_encode('"'),
+ json_decode(json_encode('"')),
+ json_decode(json_encode('""'))
);
?>
--EXPECT--
diff --git a/ext/json/tests/bug46215.phpt b/ext/json/tests/bug46215.phpt
index be3a80f860..eaf980d49a 100644
--- a/ext/json/tests/bug46215.phpt
+++ b/ext/json/tests/bug46215.phpt
@@ -6,7 +6,7 @@ Bug #46215 (json_encode mutates its parameter and has some class-specific state)
<?php
class foo {
- protected $a = array();
+ protected $a = array();
}
$a = new foo;
diff --git a/ext/json/tests/bug46944.phpt b/ext/json/tests/bug46944.phpt
index 3d70f3ee11..b5b0d97c34 100644
--- a/ext/json/tests/bug46944.phpt
+++ b/ext/json/tests/bug46944.phpt
@@ -6,10 +6,10 @@ Bug #46944 (json_encode() doesn't handle 3 byte utf8 correctly)
<?php
for ($i = 1; $i <= 16; $i++) {
- $first = 0xf0 | ($i >> 2);
- $second = 0x8f | ($i & 3) << 4;
- $string = sprintf("aa%c%c\xbf\xbdzz", $first, $second);
- echo json_encode($string) . "\n";
+ $first = 0xf0 | ($i >> 2);
+ $second = 0x8f | ($i & 3) << 4;
+ $string = sprintf("aa%c%c\xbf\xbdzz", $first, $second);
+ echo json_encode($string) . "\n";
}
diff --git a/ext/json/tests/bug47644.phpt b/ext/json/tests/bug47644.phpt
index c8650958e8..b5f4880cf9 100644
--- a/ext/json/tests/bug47644.phpt
+++ b/ext/json/tests/bug47644.phpt
@@ -9,7 +9,7 @@ if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
<?php
for ($i = 10000000000000000; $i < 10000000000000006; $i++) {
- var_dump(json_decode("[$i]"));
+ var_dump(json_decode("[$i]"));
}
diff --git a/ext/json/tests/bug54058.phpt b/ext/json/tests/bug54058.phpt
index ccb6389110..3f413b65f6 100644
--- a/ext/json/tests/bug54058.phpt
+++ b/ext/json/tests/bug54058.phpt
@@ -22,8 +22,8 @@ json_encode($b);
var_dump(json_last_error(), json_last_error_msg());
$c = array(
- 'foo' => $bad_utf8,
- 'bar' => 1
+ 'foo' => $bad_utf8,
+ 'bar' => 1
);
json_encode($c);
var_dump(json_last_error(), json_last_error_msg());
diff --git a/ext/json/tests/bug61978.phpt b/ext/json/tests/bug61978.phpt
index 68df624de1..a26341e4cc 100644
--- a/ext/json/tests/bug61978.phpt
+++ b/ext/json/tests/bug61978.phpt
@@ -6,25 +6,25 @@ Bug #61978 (Object recursion not detected for classes that implement JsonSeriali
<?php
class JsonTest1 {
- public $test;
- public $me;
- public function __construct() {
- $this->test = '123';
- $this->me = $this;
- }
+ public $test;
+ public $me;
+ public function __construct() {
+ $this->test = '123';
+ $this->me = $this;
+ }
}
class JsonTest2 implements JsonSerializable {
- public $test;
- public function __construct() {
- $this->test = '123';
- }
- public function jsonSerialize() {
- return array(
- 'test' => $this->test,
- 'me' => $this
- );
- }
+ public $test;
+ public function __construct() {
+ $this->test = '123';
+ }
+ public function jsonSerialize() {
+ return array(
+ 'test' => $this->test,
+ 'me' => $this
+ );
+ }
}
diff --git a/ext/json/tests/bug62369.phpt b/ext/json/tests/bug62369.phpt
index 6d9f58b967..9c0be481e4 100644
--- a/ext/json/tests/bug62369.phpt
+++ b/ext/json/tests/bug62369.phpt
@@ -7,27 +7,27 @@ FR #62369 (Segfault on json_encode(deeply_nested_array)
$array = array();
for ($i=0; $i < 550; $i++) {
- $array = array($array);
+ $array = array($array);
}
json_encode($array, 0, 551);
switch (json_last_error()) {
- case JSON_ERROR_NONE:
- echo 'OK' . PHP_EOL;
- break;
- case JSON_ERROR_DEPTH:
- echo 'ERROR' . PHP_EOL;
- break;
+ case JSON_ERROR_NONE:
+ echo 'OK' . PHP_EOL;
+ break;
+ case JSON_ERROR_DEPTH:
+ echo 'ERROR' . PHP_EOL;
+ break;
}
json_encode($array, 0, 540);
switch (json_last_error()) {
- case JSON_ERROR_NONE:
- echo 'OK' . PHP_EOL;
- break;
- case JSON_ERROR_DEPTH:
- echo 'ERROR' . PHP_EOL;
- break;
+ case JSON_ERROR_NONE:
+ echo 'OK' . PHP_EOL;
+ break;
+ case JSON_ERROR_DEPTH:
+ echo 'ERROR' . PHP_EOL;
+ break;
}
--EXPECT--
OK
diff --git a/ext/json/tests/bug63737.phpt b/ext/json/tests/bug63737.phpt
index 35361d850a..1fb06d485e 100644
--- a/ext/json/tests/bug63737.phpt
+++ b/ext/json/tests/bug63737.phpt
@@ -5,10 +5,10 @@ Bug #63737 (json_decode does not properly decode with options parameter)
--FILE--
<?php
function decode($json) {
- $x = json_decode($json);
- var_dump($x);
- $x = json_decode($json, false, 512, JSON_BIGINT_AS_STRING);
- var_dump($x);
+ $x = json_decode($json);
+ var_dump($x);
+ $x = json_decode($json, false, 512, JSON_BIGINT_AS_STRING);
+ var_dump($x);
}
decode('123456789012345678901234567890');
diff --git a/ext/json/tests/bug64874_part1.phpt b/ext/json/tests/bug64874_part1.phpt
index 9e0cb7e1cf..6b79b8dc04 100644
--- a/ext/json/tests/bug64874_part1.phpt
+++ b/ext/json/tests/bug64874_part1.phpt
@@ -5,9 +5,9 @@ Whitespace part of bug #64874 ("json_decode handles whitespace and case-sensitiv
--FILE--
<?php
function decode($json) {
- var_dump(json_decode($json));
- var_dump(json_last_error() !== 0);
- echo "\n";
+ var_dump(json_decode($json));
+ var_dump(json_last_error() !== 0);
+ echo "\n";
}
// Leading whitespace should be ignored
diff --git a/ext/json/tests/bug64874_part2.phpt b/ext/json/tests/bug64874_part2.phpt
index db784bd8e0..338fc1141a 100644
--- a/ext/json/tests/bug64874_part2.phpt
+++ b/ext/json/tests/bug64874_part2.phpt
@@ -5,8 +5,8 @@ Case-sensitivity part of bug #64874 ("json_decode handles whitespace and case-se
--FILE--
<?php
function decode($json) {
- var_dump(json_decode($json));
- echo ((json_last_error() !== 0) ? 'ERROR' : 'SUCCESS') . PHP_EOL;
+ var_dump(json_decode($json));
+ echo ((json_last_error() !== 0) ? 'ERROR' : 'SUCCESS') . PHP_EOL;
}
// Only lowercase should work
diff --git a/ext/json/tests/bug66021.phpt b/ext/json/tests/bug66021.phpt
index 504d17fc78..19d28eb66b 100644
--- a/ext/json/tests/bug66021.phpt
+++ b/ext/json/tests/bug66021.phpt
@@ -6,7 +6,7 @@ Bug #66021 (Blank line inside empty array/object when JSON_PRETTY_PRINT is set)
<?php
class Foo {
- private $bar = 'baz';
+ private $bar = 'baz';
}
echo json_encode(array(array(), (object) array(), new Foo), JSON_PRETTY_PRINT);
diff --git a/ext/json/tests/bug66025.phpt b/ext/json/tests/bug66025.phpt
index 9322d39b66..13bd6ea90b 100644
--- a/ext/json/tests/bug66025.phpt
+++ b/ext/json/tests/bug66025.phpt
@@ -9,8 +9,8 @@ if (!extension_loaded('json')) die('skip');
class Foo implements JsonSerializable {
public function jsonSerialize() {
- return json_encode([1], JSON_PRETTY_PRINT);
- }
+ return json_encode([1], JSON_PRETTY_PRINT);
+ }
}
echo json_encode([new Foo]), "\n";
diff --git a/ext/json/tests/bug68567.phpt b/ext/json/tests/bug68567.phpt
index 064efa76ae..4dbd83e170 100644
--- a/ext/json/tests/bug68567.phpt
+++ b/ext/json/tests/bug68567.phpt
@@ -8,7 +8,5 @@ Bug #68567 JSON_PARTIAL_OUTPUT_ON_ERROR can result in JSON with null key
var_dump(json_encode(array("\x80" => 1), JSON_PARTIAL_OUTPUT_ON_ERROR));
?>
-===DONE===
--EXPECT--
string(6) "{"":1}"
-===DONE===
diff --git a/ext/json/tests/bug68817.phpt b/ext/json/tests/bug68817.phpt
index 99fc5f7954..33d0c84b29 100644
--- a/ext/json/tests/bug68817.phpt
+++ b/ext/json/tests/bug68817.phpt
@@ -8,10 +8,8 @@ Bug #68817 (Null pointer deference)
var_dump(json_decode('[""]'));
?>
-===DONE===
--EXPECT--
array(1) {
[0]=>
string(0) ""
}
-===DONE===
diff --git a/ext/json/tests/bug68992.phpt b/ext/json/tests/bug68992.phpt
index 06448bbb38..8e209e0709 100644
--- a/ext/json/tests/bug68992.phpt
+++ b/ext/json/tests/bug68992.phpt
@@ -9,8 +9,8 @@ if (!extension_loaded('json')) die('skip');
class MyClass implements JsonSerializable {
public function jsonSerialize() {
- throw new Exception('Not implemented!');
- }
+ throw new Exception('Not implemented!');
+ }
}
$classes = [];
for($i = 0; $i < 5; $i++) {
@@ -21,8 +21,8 @@ try {
json_encode($classes);
} catch(Exception $e) {
do {
- printf("%s (%d) [%s]\n", $e->getMessage(), $e->getCode(), get_class($e));
- } while ($e = $e->getPrevious());
+ printf("%s (%d) [%s]\n", $e->getMessage(), $e->getCode(), get_class($e));
+ } while ($e = $e->getPrevious());
}
?>
--EXPECT--
diff --git a/ext/json/tests/bug71835.phpt b/ext/json/tests/bug71835.phpt
index dbe313b70c..334c84c595 100644
--- a/ext/json/tests/bug71835.phpt
+++ b/ext/json/tests/bug71835.phpt
@@ -5,18 +5,18 @@ Bug #71835 (json_encode sometimes incorrectly detects recursion with JsonSeriali
--FILE--
<?php
class SomeClass implements JsonSerializable {
- public function jsonSerialize() {
- return [get_object_vars($this)];
- }
+ public function jsonSerialize() {
+ return [get_object_vars($this)];
+ }
}
$class = new SomeClass;
$arr = [$class];
var_dump(json_encode($arr));
class SomeClass2 implements JsonSerializable {
- public function jsonSerialize() {
- return [(array)$this];
- }
+ public function jsonSerialize() {
+ return [(array)$this];
+ }
}
$class = new SomeClass2;
$arr = [$class];
diff --git a/ext/json/tests/bug72069.phpt b/ext/json/tests/bug72069.phpt
index 0ff8c98621..d7c7729013 100644
--- a/ext/json/tests/bug72069.phpt
+++ b/ext/json/tests/bug72069.phpt
@@ -10,10 +10,10 @@ var_dump($result);
class A implements \JsonSerializable
{
- function jsonSerialize()
- {
- return ['end' => json_decode(null, true)];
- }
+ function jsonSerialize()
+ {
+ return ['end' => json_decode(null, true)];
+ }
}
$a = new A();
$toJsonData = $a->jsonSerialize();
diff --git a/ext/json/tests/bug72787.phpt b/ext/json/tests/bug72787.phpt
index 2b0a49121a..d2d1f80177 100644
--- a/ext/json/tests/bug72787.phpt
+++ b/ext/json/tests/bug72787.phpt
@@ -6,9 +6,12 @@ Bug #72787 (json_decode reads out of bounds)
--FILE--
<?php
-var_dump(json_decode('[]', false, 0x100000000));
+try {
+ var_dump(json_decode('[]', false, 0x100000000));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
?>
--EXPECTF--
-Warning: json_decode(): Depth must be lower than %d in %s on line %d
-NULL
+Depth must be lower than %d
diff --git a/ext/json/tests/bug73113.phpt b/ext/json/tests/bug73113.phpt
index d45e51f683..1bb1706331 100644
--- a/ext/json/tests/bug73113.phpt
+++ b/ext/json/tests/bug73113.phpt
@@ -16,9 +16,9 @@ class JsonSerializableObject implements \JsonSerializable
$obj = new JsonSerializableObject();
try {
- echo json_encode($obj);
+ echo json_encode($obj);
} catch (\Exception $e) {
- echo $e->getMessage();
+ echo $e->getMessage();
}
--EXPECT--
This error is expected
diff --git a/ext/json/tests/fail001.phpt b/ext/json/tests/fail001.phpt
index 21dd42f8c3..b03b77f44d 100644
--- a/ext/json/tests/fail001.phpt
+++ b/ext/json/tests/fail001.phpt
@@ -8,38 +8,38 @@ JSON (http://www.crockford.com/JSON/JSON_checker/test/fail*.json)
<?php
$tests = array(
- '"A JSON payload should be an object or array, not a string."',
- '["Unclosed array"',
- '{unquoted_key: "keys must be quoted}',
- '["extra comma",]',
- '["double extra comma",,]',
- '[ , "<-- missing value"]',
- '["Comma after the close"],',
- '["Extra close"]]',
- '{"Extra comma": true,}',
- '{"Extra value after close": true} "misplaced quoted value"',
- '{"Illegal expression": 1 + 2}',
- '{"Illegal invocation": alert()}',
- '{"Numbers cannot have leading zeroes": 013}',
- '{"Numbers cannot be hex": 0x14}',
- '["Illegal backslash escape: \\x15"]',
- '["Illegal backslash escape: \\\'"]',
- '["Illegal backslash escape: \\017"]',
- '[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]',
- '{"Missing colon" null}',
- '{"Double colon":: null}',
- '{"Comma instead of colon", null}',
- '["Colon instead of comma": false]',
- '["Bad value", truth]',
- "['single quote']"
+ '"A JSON payload should be an object or array, not a string."',
+ '["Unclosed array"',
+ '{unquoted_key: "keys must be quoted}',
+ '["extra comma",]',
+ '["double extra comma",,]',
+ '[ , "<-- missing value"]',
+ '["Comma after the close"],',
+ '["Extra close"]]',
+ '{"Extra comma": true,}',
+ '{"Extra value after close": true} "misplaced quoted value"',
+ '{"Illegal expression": 1 + 2}',
+ '{"Illegal invocation": alert()}',
+ '{"Numbers cannot have leading zeroes": 013}',
+ '{"Numbers cannot be hex": 0x14}',
+ '["Illegal backslash escape: \\x15"]',
+ '["Illegal backslash escape: \\\'"]',
+ '["Illegal backslash escape: \\017"]',
+ '[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]',
+ '{"Missing colon" null}',
+ '{"Double colon":: null}',
+ '{"Comma instead of colon", null}',
+ '["Colon instead of comma": false]',
+ '["Bad value", truth]',
+ "['single quote']"
);
foreach ($tests as $test) {
- echo 'Testing: ' . $test . "\n";
- echo "AS OBJECT\n";
- var_dump(json_decode($test));
- echo "AS ARRAY\n";
- var_dump(json_decode($test, true));
+ echo 'Testing: ' . $test . "\n";
+ echo "AS OBJECT\n";
+ var_dump(json_decode($test));
+ echo "AS ARRAY\n";
+ var_dump(json_decode($test, true));
}
?>
diff --git a/ext/json/tests/json_decode_basic.phpt b/ext/json/tests/json_decode_basic.phpt
index d1169eb777..81501c1857 100644
--- a/ext/json/tests/json_decode_basic.phpt
+++ b/ext/json/tests/json_decode_basic.phpt
@@ -8,38 +8,37 @@ echo "*** Testing json_decode() : basic functionality ***\n";
// array with different values for $string
$inputs = array (
- '0',
- '123',
- '-123',
- '2147483647',
- '-2147483648',
- '123.456',
- '1230',
- '-1230',
- 'true',
- 'false',
- 'null',
- '"abc"',
- '"Hello World\r\n"',
- '[]',
- '[1,2,3,4,5]',
- '{"myInt":99,"myFloat":123.45,"myNull":null,"myBool":true,"myString":"Hello World"}',
- '{"Jan":31,"Feb":29,"Mar":31,"April":30,"May":31,"June":30}',
- '""',
- '{}'
+ '0',
+ '123',
+ '-123',
+ '2147483647',
+ '-2147483648',
+ '123.456',
+ '1230',
+ '-1230',
+ 'true',
+ 'false',
+ 'null',
+ '"abc"',
+ '"Hello World\r\n"',
+ '[]',
+ '[1,2,3,4,5]',
+ '{"myInt":99,"myFloat":123.45,"myNull":null,"myBool":true,"myString":"Hello World"}',
+ '{"Jan":31,"Feb":29,"Mar":31,"April":30,"May":31,"June":30}',
+ '""',
+ '{}'
);
// loop through with each element of the $inputs array to test json_decode() function
$count = 1;
foreach($inputs as $input) {
- echo "-- Iteration $count --\n";
- var_dump(json_decode($input));
- var_dump(json_decode($input, true));
- $count++;
+ echo "-- Iteration $count --\n";
+ var_dump(json_decode($input));
+ var_dump(json_decode($input, true));
+ $count++;
}
?>
-===Done===
--EXPECTF--
*** Testing json_decode() : basic functionality ***
-- Iteration 1 --
@@ -175,4 +174,3 @@ object(stdClass)#%d (0) {
}
array(0) {
}
-===Done===
diff --git a/ext/json/tests/json_decode_error.phpt b/ext/json/tests/json_decode_error.phpt
index 9906a2b0d4..b286df8e74 100644
--- a/ext/json/tests/json_decode_error.phpt
+++ b/ext/json/tests/json_decode_error.phpt
@@ -6,33 +6,17 @@ Test json_decode() function : error conditions
<?php
echo "*** Testing json_decode() : error conditions ***\n";
-echo "\n-- Testing json_decode() function with no arguments --\n";
-var_dump(json_decode());
-
-echo "\n-- Testing json_decode() function with more than expected no. of arguments --\n";
-$extra_arg = 10;
-var_dump(json_decode('"abc"', true, 512, 0, $extra_arg));
-
echo "\n-- Testing json_decode() function with depth below 0 --\n";
-var_dump(json_decode('"abc"', true, -1));
+
+try {
+ var_dump(json_decode('"abc"', true, -1));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
?>
-===Done===
---EXPECTF--
+--EXPECT--
*** Testing json_decode() : error conditions ***
--- Testing json_decode() function with no arguments --
-
-Warning: json_decode() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
--- Testing json_decode() function with more than expected no. of arguments --
-
-Warning: json_decode() expects at most 4 parameters, 5 given in %s on line %d
-NULL
-
-- Testing json_decode() function with depth below 0 --
-
-Warning: json_decode(): Depth must be greater than zero in %s on line %d
-NULL
-===Done===
+Depth must be greater than zero
diff --git a/ext/json/tests/json_decode_exceptions.phpt b/ext/json/tests/json_decode_exceptions.phpt
index 14cf59fd02..ba1b57f5be 100644
--- a/ext/json/tests/json_decode_exceptions.phpt
+++ b/ext/json/tests/json_decode_exceptions.phpt
@@ -6,9 +6,9 @@ Test json_decode() function : JSON_THROW_ON_ERROR flag
<?php
try {
- var_dump(json_decode("{", false, 512, JSON_THROW_ON_ERROR));
+ var_dump(json_decode("{", false, 512, JSON_THROW_ON_ERROR));
} catch (JsonException $e) {
- var_dump($e);
+ var_dump($e);
}
?>
diff --git a/ext/json/tests/json_decode_invalid_utf8.phpt b/ext/json/tests/json_decode_invalid_utf8.phpt
index d92f785424..b69400f360 100644
--- a/ext/json/tests/json_decode_invalid_utf8.phpt
+++ b/ext/json/tests/json_decode_invalid_utf8.phpt
@@ -7,14 +7,14 @@ if (!extension_loaded("json")) print "skip";
--FILE--
<?php
function json_decode_invalid_utf8($str) {
- var_dump(json_decode($str));
- var_dump(json_decode($str, true, 512, JSON_INVALID_UTF8_IGNORE));
- $json = json_decode($str, true, 512, JSON_INVALID_UTF8_SUBSTITUTE);
- if (is_array($json)) {
- var_dump(array_map(function($item) { return bin2hex($item); }, $json));
- } else {
- var_dump(bin2hex($json));
- }
+ var_dump(json_decode($str));
+ var_dump(json_decode($str, true, 512, JSON_INVALID_UTF8_IGNORE));
+ $json = json_decode($str, true, 512, JSON_INVALID_UTF8_SUBSTITUTE);
+ if (is_array($json)) {
+ var_dump(array_map(function($item) { return bin2hex($item); }, $json));
+ } else {
+ var_dump(bin2hex($json));
+ }
}
json_decode_invalid_utf8("\"a\xb0b\"");
json_decode_invalid_utf8("\"a\xd0\xf2b\"");
diff --git a/ext/json/tests/json_encode_basic.phpt b/ext/json/tests/json_encode_basic.phpt
index 119c04f106..d351765c0a 100644
--- a/ext/json/tests/json_encode_basic.phpt
+++ b/ext/json/tests/json_encode_basic.phpt
@@ -26,67 +26,66 @@ $obj->MyString = "Hello World";
// array with different values for $string
$inputs = array (
- // integers
- 0,
- 123,
- -123,
- 2147483647,
- -2147483648,
-
- // floats
- 123.456,
- 1.23E3,
- -1.23E3,
-
- // boolean
- TRUE,
- true,
- FALSE,
- false,
-
- // NULL
- NULL,
- null,
-
- // strings
- "abc",
- 'abc',
- "Hello\t\tWorld\n",
-
- // arrays
- array(),
- array(1,2,3,4,5),
- array(1 => "Sun", 2 => "Mon", 3 => "Tue", 4 => "Wed", 5 => "Thur", 6 => "Fri", 7 => "Sat"),
- array("Jan" => 31, "Feb" => 29, "Mar" => 31, "April" => 30, "May" => 31, "June" => 30),
-
- // empty data
- "",
- '',
-
- // undefined data
- @$undefined_var,
-
- // unset data
- @$unset_var,
-
- // resource variable
- $fp,
-
- // object variable
- $obj
+ // integers
+ 0,
+ 123,
+ -123,
+ 2147483647,
+ -2147483648,
+
+ // floats
+ 123.456,
+ 1.23E3,
+ -1.23E3,
+
+ // boolean
+ TRUE,
+ true,
+ FALSE,
+ false,
+
+ // NULL
+ NULL,
+ null,
+
+ // strings
+ "abc",
+ 'abc',
+ "Hello\t\tWorld\n",
+
+ // arrays
+ array(),
+ array(1,2,3,4,5),
+ array(1 => "Sun", 2 => "Mon", 3 => "Tue", 4 => "Wed", 5 => "Thur", 6 => "Fri", 7 => "Sat"),
+ array("Jan" => 31, "Feb" => 29, "Mar" => 31, "April" => 30, "May" => 31, "June" => 30),
+
+ // empty data
+ "",
+ '',
+
+ // undefined data
+ @$undefined_var,
+
+ // unset data
+ @$unset_var,
+
+ // resource variable
+ $fp,
+
+ // object variable
+ $obj
);
// loop through with each element of the $inputs array to test json_encode() function
$count = 1;
foreach($inputs as $input) {
- echo "-- Iteration $count --\n";
- var_dump(json_encode($input));
- $count ++;
+ echo "-- Iteration $count --\n";
+ var_dump(json_encode($input));
+ $count ++;
}
?>
-===Done===
--EXPECT--
*** Testing json_encode() : basic functionality ***
-- Iteration 1 --
@@ -143,4 +142,3 @@ string(4) "null"
bool(false)
-- Iteration 27 --
string(82) "{"MyInt":99,"MyFloat":123.45,"MyBool":true,"MyNull":null,"MyString":"Hello World"}"
-===Done===
diff --git a/ext/json/tests/json_encode_basic_utf8.phpt b/ext/json/tests/json_encode_basic_utf8.phpt
index ac5000d9fd..76fd268b73 100644
--- a/ext/json/tests/json_encode_basic_utf8.phpt
+++ b/ext/json/tests/json_encode_basic_utf8.phpt
@@ -10,8 +10,6 @@ $utf8_string = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJ
var_dump(json_encode($utf8_string));
?>
-===Done===
--EXPECT--
*** Testing json_encode() : basic functionality with UTF-8 input***
string(103) ""\u65e5\u672c\u8a9e\u30c6\u30ad\u30b9\u30c8\u3067\u3059\u300201234\uff15\uff16\uff17\uff18\uff19\u3002""
-===Done===
diff --git a/ext/json/tests/json_encode_exceptions.phpt b/ext/json/tests/json_encode_exceptions.phpt
index 507f16ede9..a3d1f7ae25 100644
--- a/ext/json/tests/json_encode_exceptions.phpt
+++ b/ext/json/tests/json_encode_exceptions.phpt
@@ -6,9 +6,9 @@ Test json_encode() function : JSON_THROW_ON_ERROR flag
<?php
try {
- var_dump(json_encode("\x80", JSON_THROW_ON_ERROR));
+ var_dump(json_encode("\x80", JSON_THROW_ON_ERROR));
} catch (JsonException $e) {
- var_dump($e);
+ var_dump($e);
}
// JSON_PARTIAL_OUTPUT_ON_ERROR is incompatible with exceptions
diff --git a/ext/json/tests/json_encode_invalid_utf8.phpt b/ext/json/tests/json_encode_invalid_utf8.phpt
index d7ec58a973..7b032b81e6 100644
--- a/ext/json/tests/json_encode_invalid_utf8.phpt
+++ b/ext/json/tests/json_encode_invalid_utf8.phpt
@@ -7,11 +7,11 @@ if (!extension_loaded("json")) print "skip";
--FILE--
<?php
function json_encode_invalid_utf8($str) {
- var_dump(json_encode($str));
- var_dump(json_encode($str, JSON_INVALID_UTF8_IGNORE));
- var_dump(json_encode($str, JSON_INVALID_UTF8_SUBSTITUTE));
- var_dump(json_encode($str, JSON_UNESCAPED_UNICODE));
- var_dump(bin2hex(json_encode($str, JSON_UNESCAPED_UNICODE | JSON_INVALID_UTF8_SUBSTITUTE)));
+ var_dump(json_encode($str));
+ var_dump(json_encode($str, JSON_INVALID_UTF8_IGNORE));
+ var_dump(json_encode($str, JSON_INVALID_UTF8_SUBSTITUTE));
+ var_dump(json_encode($str, JSON_UNESCAPED_UNICODE));
+ var_dump(bin2hex(json_encode($str, JSON_UNESCAPED_UNICODE | JSON_INVALID_UTF8_SUBSTITUTE)));
}
json_encode_invalid_utf8("\x61\xb0\x62");
json_encode_invalid_utf8("\x61\xf0\x80\x80\x41");
diff --git a/ext/json/tests/json_encode_numeric.phpt b/ext/json/tests/json_encode_numeric.phpt
index 9202cd00ed..c3c7edd444 100644
--- a/ext/json/tests/json_encode_numeric.phpt
+++ b/ext/json/tests/json_encode_numeric.phpt
@@ -7,12 +7,12 @@ serialize_precision=-1
--FILE--
<?php
var_dump(
- json_encode("1", JSON_NUMERIC_CHECK),
- json_encode("9.4324", JSON_NUMERIC_CHECK),
- json_encode(array("122321", "3232595.33423"), JSON_NUMERIC_CHECK),
- json_encode("1"),
- json_encode("9.4324"),
- json_encode(array("122321", "3232595.33423"))
+ json_encode("1", JSON_NUMERIC_CHECK),
+ json_encode("9.4324", JSON_NUMERIC_CHECK),
+ json_encode(array("122321", "3232595.33423"), JSON_NUMERIC_CHECK),
+ json_encode("1"),
+ json_encode("9.4324"),
+ json_encode(array("122321", "3232595.33423"))
);
?>
--EXPECT--
diff --git a/ext/json/tests/json_encode_pretty_print.phpt b/ext/json/tests/json_encode_pretty_print.phpt
index 43b93aafe6..0ac4a6d3fb 100644
--- a/ext/json/tests/json_encode_pretty_print.phpt
+++ b/ext/json/tests/json_encode_pretty_print.phpt
@@ -5,11 +5,11 @@ json_encode() with JSON_PRETTY_PRINT
--FILE--
<?php
function encode_decode($json) {
- $struct = json_decode($json);
- $pretty = json_encode($struct, JSON_PRETTY_PRINT);
- echo "$pretty\n";
- $pretty = json_decode($pretty);
- printf("Match: %d\n", $pretty == $struct);
+ $struct = json_decode($json);
+ $pretty = json_encode($struct, JSON_PRETTY_PRINT);
+ echo "$pretty\n";
+ $pretty = json_decode($pretty);
+ printf("Match: %d\n", $pretty == $struct);
}
encode_decode('[1,2,3,[1,2,3]]');
diff --git a/ext/json/tests/json_exceptions_error_clearing.phpt b/ext/json/tests/json_exceptions_error_clearing.phpt
index 6d01dd7c33..70dfca2171 100644
--- a/ext/json/tests/json_exceptions_error_clearing.phpt
+++ b/ext/json/tests/json_exceptions_error_clearing.phpt
@@ -14,26 +14,26 @@ json_decode("\xFF");
var_dump(json_last_error());
try {
- json_decode("", false, 512, JSON_THROW_ON_ERROR);
+ json_decode("", false, 512, JSON_THROW_ON_ERROR);
} catch (JsonException $e) {
- echo "Caught JSON exception: ", $e->getCode(), PHP_EOL;
+ echo "Caught JSON exception: ", $e->getCode(), PHP_EOL;
}
var_dump(json_last_error());
try {
- json_decode("{", false, 512, JSON_THROW_ON_ERROR);
+ json_decode("{", false, 512, JSON_THROW_ON_ERROR);
} catch (JsonException $e) {
- echo "Caught JSON exception: ", $e->getCode(), PHP_EOL;
+ echo "Caught JSON exception: ", $e->getCode(), PHP_EOL;
}
var_dump(json_last_error());
try {
- json_encode(NAN, JSON_THROW_ON_ERROR);
+ json_encode(NAN, JSON_THROW_ON_ERROR);
} catch (JsonException $e) {
- echo "Caught JSON exception: ", $e->getCode(), PHP_EOL;
+ echo "Caught JSON exception: ", $e->getCode(), PHP_EOL;
}
var_dump(json_last_error());
diff --git a/ext/json/tests/json_last_error_error.phpt b/ext/json/tests/json_last_error_error.phpt
index e733b32854..cd88ef8a9e 100644
--- a/ext/json/tests/json_last_error_error.phpt
+++ b/ext/json/tests/json_last_error_error.phpt
@@ -6,15 +6,14 @@ json_last_error() failures
<?php
var_dump(json_last_error());
-var_dump(json_last_error(true));
-var_dump(json_last_error('some', 4, 'args', 'here'));
+
+try {
+ var_dump(json_last_error(true));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
+--EXPECT--
int(0)
-
-Warning: json_last_error() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: json_last_error() expects exactly 0 parameters, 4 given in %s on line %d
-NULL
+json_last_error() expects exactly 0 parameters, 1 given
diff --git a/ext/json/tests/json_last_error_msg_error.phpt b/ext/json/tests/json_last_error_msg_error.phpt
index 719e9fc50c..75b06f72a2 100644
--- a/ext/json/tests/json_last_error_msg_error.phpt
+++ b/ext/json/tests/json_last_error_msg_error.phpt
@@ -6,15 +6,14 @@ json_last_error_msg() failures
<?php
var_dump(json_last_error_msg());
-var_dump(json_last_error_msg(true));
-var_dump(json_last_error_msg('some', 4, 'args', 'here'));
+
+try {
+ var_dump(json_last_error_msg(true));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
--EXPECTF--
string(8) "No error"
-
-Warning: json_last_error_msg() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: json_last_error_msg() expects exactly 0 parameters, 4 given in %s on line %d
-NULL
+json_last_error_msg() expects exactly 0 parameters, 1 given
diff --git a/ext/json/tests/serialize.phpt b/ext/json/tests/serialize.phpt
index 1aa90750da..ab2f9c926d 100644
--- a/ext/json/tests/serialize.phpt
+++ b/ext/json/tests/serialize.phpt
@@ -9,46 +9,46 @@ serialize_precision=-1
class NonSerializingTest
{
- public $data;
+ public $data;
- public function __construct($data)
- {
- $this->data = $data;
- }
+ public function __construct($data)
+ {
+ $this->data = $data;
+ }
}
class SerializingTest extends NonSerializingTest implements JsonSerializable
{
- public function jsonSerialize()
- {
- return $this->data;
- }
+ public function jsonSerialize()
+ {
+ return $this->data;
+ }
}
class ValueSerializingTest extends SerializingTest
{
- public function jsonSerialize()
- {
- return array_values(is_array($this->data) ? $this->data : get_object_vars($this->data));
- }
+ public function jsonSerialize()
+ {
+ return array_values(is_array($this->data) ? $this->data : get_object_vars($this->data));
+ }
}
class SelfSerializingTest extends SerializingTest
{
- public function jsonSerialize()
- {
- return $this;
- }
+ public function jsonSerialize()
+ {
+ return $this;
+ }
}
$adata = array(
- 'str' => 'foo',
- 'int' => 1,
- 'float' => 2.3,
- 'bool' => false,
- 'nil' => null,
- 'arr' => array(1,2,3),
- 'obj' => new StdClass,
+ 'str' => 'foo',
+ 'int' => 1,
+ 'float' => 2.3,
+ 'bool' => false,
+ 'nil' => null,
+ 'arr' => array(1,2,3),
+ 'obj' => new StdClass,
);
$ndata = array_values($adata);
@@ -56,10 +56,10 @@ $ndata = array_values($adata);
$odata = (object)$adata;
foreach(array('NonSerializingTest','SerializingTest','ValueSerializingTest','SelfSerializingTest') as $class) {
- echo "==$class==\n";
- echo json_encode(new $class($adata)), "\n";
- echo json_encode(new $class($ndata)), "\n";
- echo json_encode(new $class($odata)), "\n";
+ echo "==$class==\n";
+ echo json_encode(new $class($adata)), "\n";
+ echo json_encode(new $class($ndata)), "\n";
+ echo json_encode(new $class($odata)), "\n";
}
--EXPECT--
==NonSerializingTest==
diff --git a/ext/ldap/config.m4 b/ext/ldap/config.m4
index f10cccc460..89c4b19531 100644
--- a/ext/ldap/config.m4
+++ b/ext/ldap/config.m4
@@ -51,7 +51,7 @@ PHP_ARG_WITH([ldap-sasl],
if test "$PHP_LDAP" != "no"; then
- PHP_NEW_EXTENSION(ldap, ldap.c, $ext_shared,,-DLDAP_DEPRECATED=1 -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
+ PHP_NEW_EXTENSION(ldap, ldap.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
if test "$PHP_LDAP" = "yes"; then
for i in /usr/local /usr; do
diff --git a/ext/ldap/config.w32 b/ext/ldap/config.w32
index b947aa5177..1cbbfb8ba8 100644
--- a/ext/ldap/config.w32
+++ b/ext/ldap/config.w32
@@ -17,7 +17,6 @@ if (PHP_LDAP != "no") {
AC_DEFINE('HAVE_LDAP_START_TLS_S', 1);
AC_DEFINE('HAVE_LDAP', 1);
AC_DEFINE('HAVE_LDAP_SASL', 1);
- AC_DEFINE('LDAP_DEPRECATED', 1);
AC_DEFINE('HAVE_LDAP_CONTROL_FIND', 1);
AC_DEFINE('HAVE_LDAP_PARSE_EXTENDED_RESULT', 1);
AC_DEFINE('HAVE_LDAP_EXTENDED_OPERATION_S', 1);
diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c
index c09dee52bf..a5bbc68238 100644
--- a/ext/ldap/ldap.c
+++ b/ext/ldap/ldap.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -35,6 +33,7 @@
#include "ext/standard/dl.h"
#include "php_ldap.h"
+#include "ldap_arginfo.h"
#ifdef PHP_WIN32
#include <string.h>
@@ -258,7 +257,7 @@ static void _php_ldap_control_to_array(LDAP *ld, LDAPControl* ctrl, zval* array,
add_assoc_long(&value, "target", target);
add_assoc_long(&value, "count", count);
add_assoc_long(&value, "errcode", errcode);
- if ( context && (context->bv_len >= 0) ) {
+ if (context) {
add_assoc_stringl(&value, "context", context->bv_val, context->bv_len);
}
add_assoc_zval(array, "value", &value);
@@ -1004,7 +1003,7 @@ PHP_FUNCTION(ldap_connect)
}
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|slssl", &host, &hostlen, &port, &wallet, &walletlen, &walletpasswd, &walletpasswdlen, &authmode) != SUCCESS) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (ZEND_NUM_ARGS() == 5) {
@@ -1012,7 +1011,7 @@ PHP_FUNCTION(ldap_connect)
}
#else
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|sl", &host, &hostlen, &port) != SUCCESS) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
#endif
@@ -1031,7 +1030,7 @@ PHP_FUNCTION(ldap_connect)
if (port <= 0 || port > 65535) {
efree(ld);
- php_error_docref(NULL, E_WARNING, "invalid port number: " ZEND_LONG_FMT, port);
+ php_error_docref(NULL, E_WARNING, "Invalid port number: " ZEND_LONG_FMT, port);
RETURN_FALSE;
}
@@ -1125,11 +1124,11 @@ PHP_FUNCTION(ldap_bind)
int rc;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|ss", &link, &ldap_bind_dn, &ldap_bind_dnlen, &ldap_bind_pw, &ldap_bind_pwlen) != SUCCESS) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (ldap_bind_dn != NULL && memchr(ldap_bind_dn, '\0', ldap_bind_dnlen) != NULL) {
@@ -1182,11 +1181,11 @@ PHP_FUNCTION(ldap_bind_ext)
int rc;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|ssa", &link, &ldap_bind_dn, &ldap_bind_dnlen, &ldap_bind_pw, &ldap_bind_pwlen, &serverctrls) != SUCCESS) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (ldap_bind_dn != NULL && memchr(ldap_bind_dn, '\0', ldap_bind_dnlen) != NULL) {
@@ -1347,11 +1346,11 @@ PHP_FUNCTION(ldap_sasl_bind)
php_ldap_bictx *ctx;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|sssssss", &link, &binddn, &dn_len, &passwd, &passwd_len, &sasl_mech, &mech_len, &sasl_realm, &realm_len, &sasl_authc_id, &authc_id_len, &sasl_authz_id, &authz_id_len, &props, &props_len) != SUCCESS) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
ctx = _php_sasl_setdefs(ld->link, sasl_mech, sasl_realm, sasl_authc_id, passwd, sasl_authz_id);
@@ -1380,11 +1379,11 @@ PHP_FUNCTION(ldap_unbind)
ldap_linkdata *ld;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &link) != SUCCESS) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
zend_list_close(Z_RES_P(link));
@@ -1448,7 +1447,7 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
if (zend_parse_parameters(argcount, "zzz|a/lllla/", &link, &base_dn, &filter, &attrs, &attrsonly,
&sizelimit, &timelimit, &deref, &serverctrls) == FAILURE) {
- return;
+ RETURN_THROWS();
}
/* Reverse -> fall through */
@@ -1711,11 +1710,11 @@ PHP_FUNCTION(ldap_free_result)
LDAPMessage *ldap_result;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &result) != SUCCESS) {
- return;
+ RETURN_THROWS();
}
if ((ldap_result = (LDAPMessage *)zend_fetch_resource(Z_RES_P(result), "ldap result", le_result)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
zend_list_close(Z_RES_P(result)); /* Delete list entry */
@@ -1732,15 +1731,15 @@ PHP_FUNCTION(ldap_count_entries)
LDAPMessage *ldap_result;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rr", &link, &result) != SUCCESS) {
- return;
+ RETURN_THROWS();
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ((ldap_result = (LDAPMessage *)zend_fetch_resource(Z_RES_P(result), "ldap result", le_result)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
RETURN_LONG(ldap_count_entries(ld->link, ldap_result));
@@ -1757,15 +1756,15 @@ PHP_FUNCTION(ldap_first_entry)
LDAPMessage *ldap_result, *entry;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rr", &link, &result) != SUCCESS) {
- return;
+ RETURN_THROWS();
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ((ldap_result = (LDAPMessage *)zend_fetch_resource(Z_RES_P(result), "ldap result", le_result)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ((entry = ldap_first_entry(ld->link, ldap_result)) == NULL) {
@@ -1790,14 +1789,14 @@ PHP_FUNCTION(ldap_next_entry)
LDAPMessage *entry_next;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rr", &link, &result_entry) != SUCCESS) {
- return;
+ RETURN_THROWS();
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ((resultentry = (ldap_resultentry *)zend_fetch_resource(Z_RES_P(result_entry), "ldap result entry", le_result_entry)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ((entry_next = ldap_next_entry(ld->link, resultentry->data)) == NULL) {
@@ -1829,14 +1828,14 @@ PHP_FUNCTION(ldap_get_entries)
char *dn;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rr", &link, &result) != SUCCESS) {
- return;
+ RETURN_THROWS();
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ((ldap_result = (LDAPMessage *)zend_fetch_resource(Z_RES_P(result), "ldap result", le_result)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
ldap = ld->link;
@@ -1924,15 +1923,15 @@ PHP_FUNCTION(ldap_first_attribute)
zend_long dummy_ber;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rr|l", &link, &result_entry, &dummy_ber) != SUCCESS) {
- return;
+ RETURN_THROWS();
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ((resultentry = (ldap_resultentry *)zend_fetch_resource(Z_RES_P(result_entry), "ldap result entry", le_result_entry)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ((attribute = ldap_first_attribute(ld->link, resultentry->data, &resultentry->ber)) == NULL) {
@@ -1957,19 +1956,19 @@ PHP_FUNCTION(ldap_next_attribute)
zend_long dummy_ber;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rr|l", &link, &result_entry, &dummy_ber) != SUCCESS) {
- return;
+ RETURN_THROWS();
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ((resultentry = (ldap_resultentry *)zend_fetch_resource(Z_RES_P(result_entry), "ldap result entry", le_result_entry)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (resultentry->ber == NULL) {
- php_error_docref(NULL, E_WARNING, "called before calling ldap_first_attribute() or no attributes found in result entry");
+ php_error_docref(NULL, E_WARNING, "Called before calling ldap_first_attribute() or no attributes found in result entry");
RETURN_FALSE;
}
@@ -2004,15 +2003,15 @@ PHP_FUNCTION(ldap_get_attributes)
BerElement *ber;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rr", &link, &result_entry) != SUCCESS) {
- return;
+ RETURN_THROWS();
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ((resultentry = (ldap_resultentry *)zend_fetch_resource(Z_RES_P(result_entry), "ldap result entry", le_result_entry)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
array_init(return_value);
@@ -2062,15 +2061,15 @@ PHP_FUNCTION(ldap_get_values_len)
size_t attr_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rrs", &link, &result_entry, &attr, &attr_len) != SUCCESS) {
- return;
+ RETURN_THROWS();
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ((resultentry = (ldap_resultentry *)zend_fetch_resource(Z_RES_P(result_entry), "ldap result entry", le_result_entry)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ((ldap_value_len = ldap_get_values_len(ld->link, resultentry->data, attr)) == NULL) {
@@ -2101,15 +2100,15 @@ PHP_FUNCTION(ldap_get_dn)
char *text;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rr", &link, &result_entry) != SUCCESS) {
- return;
+ RETURN_THROWS();
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ((resultentry = (ldap_resultentry *)zend_fetch_resource(Z_RES_P(result_entry), "ldap result entry", le_result_entry)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
text = ldap_get_dn(ld->link, resultentry->data);
@@ -2136,7 +2135,7 @@ PHP_FUNCTION(ldap_explode_dn)
size_t dn_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl", &dn, &dn_len, &with_attrib) != SUCCESS) {
- return;
+ RETURN_THROWS();
}
if (!(ldap_value = ldap_explode_dn(dn, with_attrib))) {
@@ -2167,7 +2166,7 @@ PHP_FUNCTION(ldap_dn2ufn)
size_t dn_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &dn, &dn_len) != SUCCESS) {
- return;
+ RETURN_THROWS();
}
ufn = ldap_dn2ufn(dn);
@@ -2205,11 +2204,11 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper, int ext)
int is_full_add=0; /* flag for full add operation so ldap_mod_add can be put back into oper, gerrit THomson */
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsa/|a", &link, &dn, &dn_len, &entry, &serverctrls) != SUCCESS) {
- return;
+ RETURN_THROWS();
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
num_attribs = zend_hash_num_elements(Z_ARRVAL_P(entry));
@@ -2445,11 +2444,11 @@ static void php_ldap_do_delete(INTERNAL_FUNCTION_PARAMETERS, int ext)
size_t dn_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|a", &link, &dn, &dn_len, &serverctrls) != SUCCESS) {
- return;
+ RETURN_THROWS();
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (serverctrls) {
@@ -2594,11 +2593,11 @@ PHP_FUNCTION(ldap_modify_batch)
*/
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsa/|a", &link, &dn, &dn_len, &mods, &serverctrls) != SUCCESS) {
- return;
+ RETURN_THROWS();
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* perform validation */
@@ -2877,11 +2876,11 @@ PHP_FUNCTION(ldap_errno)
ldap_linkdata *ld;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &link) != SUCCESS) {
- return;
+ RETURN_THROWS();
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
RETURN_LONG(_get_lderrno(ld->link));
@@ -2895,7 +2894,7 @@ PHP_FUNCTION(ldap_err2str)
zend_long perrno;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &perrno) != SUCCESS) {
- return;
+ RETURN_THROWS();
}
RETURN_STRING(ldap_err2string(perrno));
@@ -2911,11 +2910,11 @@ PHP_FUNCTION(ldap_error)
int ld_errno;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &link) != SUCCESS) {
- return;
+ RETURN_THROWS();
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
ld_errno = _get_lderrno(ld->link);
@@ -2938,11 +2937,11 @@ PHP_FUNCTION(ldap_compare)
struct berval lvalue;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsss|a", &link, &dn, &dn_len, &attr, &attr_len, &value, &value_len, &serverctrls) != SUCCESS) {
- return;
+ RETURN_THROWS();
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (serverctrls) {
@@ -2981,39 +2980,6 @@ cleanup:
}
/* }}} */
-/* {{{ proto bool ldap_sort(resource link, resource result, string sortfilter)
- Sort LDAP result entries */
-PHP_FUNCTION(ldap_sort)
-{
- zval *link, *result;
- ldap_linkdata *ld;
- char *sortfilter;
- size_t sflen;
- zend_resource *le;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rrs", &link, &result, &sortfilter, &sflen) != SUCCESS) {
- RETURN_FALSE;
- }
-
- if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
- }
-
- le = Z_RES_P(result);
- if (le->type != le_result) {
- php_error_docref(NULL, E_WARNING, "Supplied resource is not a valid ldap result resource");
- RETURN_FALSE;
- }
-
- if (ldap_sort_entries(ld->link, (LDAPMessage **) &le->ptr, sflen ? sortfilter : NULL, strcmp) != LDAP_SUCCESS) {
- php_error_docref(NULL, E_WARNING, "%s", ldap_err2string(errno));
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP
/* {{{ proto bool ldap_get_option(resource link, int option, mixed retval)
Get the current value of various session-wide parameters */
@@ -3024,11 +2990,11 @@ PHP_FUNCTION(ldap_get_option)
zend_long option;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlz", &link, &option, &retval) != SUCCESS) {
- return;
+ RETURN_THROWS();
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
switch (option) {
@@ -3193,14 +3159,14 @@ PHP_FUNCTION(ldap_set_option)
zend_long option;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zlz", &link, &option, &newval) != SUCCESS) {
- return;
+ RETURN_THROWS();
}
if (Z_TYPE_P(link) == IS_NULL) {
ldap = NULL;
} else {
if ((ld = (ldap_linkdata *)zend_fetch_resource_ex(link, "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
ldap = ld->link;
}
@@ -3311,7 +3277,7 @@ PHP_FUNCTION(ldap_set_option)
zend_string *val;
val = zval_get_string(newval);
if (EG(exception)) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (ldap_set_option(ldap, option, ZSTR_VAL(val))) {
zend_string_release(val);
@@ -3379,15 +3345,15 @@ PHP_FUNCTION(ldap_parse_result)
int rc, lerrcode, myargcount = ZEND_NUM_ARGS();
if (zend_parse_parameters(myargcount, "rrz|zzzz", &link, &result, &errcode, &matcheddn, &errmsg, &referrals, &serverctrls) != SUCCESS) {
- return;
+ RETURN_THROWS();
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ((ldap_result = (LDAPMessage *)zend_fetch_resource(Z_RES_P(result), "ldap result", le_result)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
rc = ldap_parse_result(ld->link, ldap_result, &lerrcode,
@@ -3410,7 +3376,7 @@ PHP_FUNCTION(ldap_parse_result)
case 6:
referrals = zend_try_array_init(referrals);
if (!referrals) {
- return;
+ RETURN_THROWS();
}
if (lreferrals != NULL) {
refp = lreferrals;
@@ -3454,15 +3420,15 @@ PHP_FUNCTION(ldap_parse_exop)
int rc, myargcount = ZEND_NUM_ARGS();
if (zend_parse_parameters(myargcount, "rr|zz", &link, &result, &retdata, &retoid) != SUCCESS) {
- WRONG_PARAM_COUNT;
+ RETURN_THROWS();
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ((ldap_result = (LDAPMessage *)zend_fetch_resource(Z_RES_P(result), "ldap result", le_result)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
rc = ldap_parse_extended_result(ld->link, ldap_result,
@@ -3509,15 +3475,15 @@ PHP_FUNCTION(ldap_first_reference)
LDAPMessage *ldap_result, *entry;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rr", &link, &result) != SUCCESS) {
- return;
+ RETURN_THROWS();
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ((ldap_result = (LDAPMessage *)zend_fetch_resource(Z_RES_P(result), "ldap result", le_result)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ((entry = ldap_first_reference(ld->link, ldap_result)) == NULL) {
@@ -3542,15 +3508,15 @@ PHP_FUNCTION(ldap_next_reference)
LDAPMessage *entry_next;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rr", &link, &result_entry) != SUCCESS) {
- return;
+ RETURN_THROWS();
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ((resultentry = (ldap_resultentry *)zend_fetch_resource(Z_RES_P(result_entry), "ldap result entry", le_result_entry)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ((entry_next = ldap_next_reference(ld->link, resultentry->data)) == NULL) {
@@ -3576,15 +3542,15 @@ PHP_FUNCTION(ldap_parse_reference)
char **lreferrals, **refp;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rrz", &link, &result_entry, &referrals) != SUCCESS) {
- return;
+ RETURN_THROWS();
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ((resultentry = (ldap_resultentry *)zend_fetch_resource(Z_RES_P(result_entry), "ldap result entry", le_result_entry)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (ldap_parse_reference(ld->link, resultentry->data, &lreferrals, NULL /* &serverctrls */, 0) != LDAP_SUCCESS) {
@@ -3593,7 +3559,7 @@ PHP_FUNCTION(ldap_parse_reference)
referrals = zend_try_array_init(referrals);
if (!referrals) {
- return;
+ RETURN_THROWS();
}
if (lreferrals != NULL) {
@@ -3624,11 +3590,11 @@ static void php_ldap_do_rename(INTERNAL_FUNCTION_PARAMETERS, int ext)
zend_bool deleteoldrdn;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsssb|a", &link, &dn, &dn_len, &newrdn, &newrdn_len, &newparent, &newparent_len, &deleteoldrdn, &serverctrls) != SUCCESS) {
- return;
+ RETURN_THROWS();
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (newparent_len == 0) {
@@ -3717,11 +3683,11 @@ PHP_FUNCTION(ldap_start_tls)
int rc, protocol = LDAP_VERSION3;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &link) != SUCCESS) {
- return;
+ RETURN_THROWS();
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (((rc = ldap_set_option(ld->link, LDAP_OPT_PROTOCOL_VERSION, &protocol)) != LDAP_SUCCESS) ||
@@ -3779,11 +3745,11 @@ PHP_FUNCTION(ldap_set_rebind_proc)
ldap_linkdata *ld;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz", &link, &callback) != SUCCESS) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (Z_TYPE_P(callback) == IS_STRING && Z_STRLEN_P(callback) == 0) {
@@ -3871,7 +3837,7 @@ PHP_FUNCTION(ldap_escape)
zend_bool map[256] = {0}, havecharlist = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|sl", &value, &valuelen, &ignores, &ignoreslen, &flags) != SUCCESS) {
- return;
+ RETURN_THROWS();
}
if (!valuelen) {
@@ -3911,7 +3877,7 @@ static void php_ldap_do_translate(INTERNAL_FUNCTION_PARAMETERS, int way)
int result;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &value, &value_len) != SUCCESS) {
- return;
+ RETURN_THROWS();
}
if (value_len == 0) {
@@ -3928,7 +3894,7 @@ static void php_ldap_do_translate(INTERNAL_FUNCTION_PARAMETERS, int way)
RETVAL_STRINGL(value, value_len);
free(value);
} else {
- php_error_docref(NULL, E_WARNING, "Conversion from iso-8859-1 to t61 failed: %s", ldap_err2string(result));
+ php_error_docref(NULL, E_WARNING, "Conversion from ISO-8859-1 to t61 failed: %s", ldap_err2string(result));
RETVAL_FALSE;
}
}
@@ -3969,14 +3935,14 @@ PHP_FUNCTION(ldap_control_paged_result)
int rc, myargcount = ZEND_NUM_ARGS();
if (zend_parse_parameters(myargcount, "rl|bs", &link, &pagesize, &iscritical, &cookie, &cookie_len) != SUCCESS) {
- return;
+ RETURN_THROWS();
}
if (Z_TYPE_P(link) == IS_NULL) {
ldap = NULL;
} else {
if ((ld = (ldap_linkdata *)zend_fetch_resource_ex(link, "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
ldap = ld->link;
}
@@ -4061,15 +4027,15 @@ PHP_FUNCTION(ldap_control_paged_result_response)
int rc, lerrcode, myargcount = ZEND_NUM_ARGS();
if (zend_parse_parameters(myargcount, "rr|zz", &link, &result, &cookie, &estimated) != SUCCESS) {
- return;
+ RETURN_THROWS();
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ((ldap_result = (LDAPMessage *)zend_fetch_resource(Z_RES_P(result), "ldap result", le_result)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
rc = ldap_parse_result(ld->link,
@@ -4159,11 +4125,11 @@ PHP_FUNCTION(ldap_exop)
int rc, msgid;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rS|S!a!zz", &link, &reqoid, &reqdata, &serverctrls, &retdata, &retoid) != SUCCESS) {
- return;
+ RETURN_THROWS();
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (reqdata) {
@@ -4265,11 +4231,11 @@ PHP_FUNCTION(ldap_exop_passwd)
lnewpw.bv_len = 0;
if (zend_parse_parameters(myargcount, "r|sssz/", &link, &luser.bv_val, &luser.bv_len, &loldpw.bv_val, &loldpw.bv_len, &lnewpw.bv_val, &lnewpw.bv_len, &serverctrls) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
switch (myargcount) {
@@ -4350,11 +4316,11 @@ PHP_FUNCTION(ldap_exop_whoami)
int rc;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &link) == FAILURE) {
- WRONG_PARAM_COUNT;
+ RETURN_THROWS();
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* synchronous call */
@@ -4388,11 +4354,11 @@ PHP_FUNCTION(ldap_exop_refresh)
int rc;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsz", &link, &ldn.bv_val, &ldn.bv_len, &ttl) != SUCCESS) {
- WRONG_PARAM_COUNT;
+ RETURN_THROWS();
}
if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
lttl = (ber_int_t)zval_get_long(ttl);
@@ -4410,390 +4376,6 @@ PHP_FUNCTION(ldap_exop_refresh)
/* }}} */
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_connect, 0, 0, 0)
- ZEND_ARG_INFO(0, hostname)
- ZEND_ARG_INFO(0, port)
-#ifdef HAVE_ORALDAP
- ZEND_ARG_INFO(0, wallet)
- ZEND_ARG_INFO(0, wallet_passwd)
- ZEND_ARG_INFO(0, authmode)
-#endif
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_resource, 0, 0, 1)
- ZEND_ARG_INFO(0, link_identifier)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_bind, 0, 0, 1)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, bind_rdn)
- ZEND_ARG_INFO(0, bind_password)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_bind_ext, 0, 0, 1)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, bind_rdn)
- ZEND_ARG_INFO(0, bind_password)
- ZEND_ARG_INFO(0, servercontrols)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_LDAP_SASL
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_sasl_bind, 0, 0, 1)
- ZEND_ARG_INFO(0, link)
- ZEND_ARG_INFO(0, binddn)
- ZEND_ARG_INFO(0, password)
- ZEND_ARG_INFO(0, sasl_mech)
- ZEND_ARG_INFO(0, sasl_realm)
- ZEND_ARG_INFO(0, sasl_authz_id)
- ZEND_ARG_INFO(0, props)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_read, 0, 0, 3)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, base_dn)
- ZEND_ARG_INFO(0, filter)
- ZEND_ARG_INFO(0, attributes)
- ZEND_ARG_INFO(0, attrsonly)
- ZEND_ARG_INFO(0, sizelimit)
- ZEND_ARG_INFO(0, timelimit)
- ZEND_ARG_INFO(0, deref)
- ZEND_ARG_INFO(0, servercontrols)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_list, 0, 0, 3)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, base_dn)
- ZEND_ARG_INFO(0, filter)
- ZEND_ARG_INFO(0, attributes)
- ZEND_ARG_INFO(0, attrsonly)
- ZEND_ARG_INFO(0, sizelimit)
- ZEND_ARG_INFO(0, timelimit)
- ZEND_ARG_INFO(0, deref)
- ZEND_ARG_INFO(0, servercontrols)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_search, 0, 0, 3)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, base_dn)
- ZEND_ARG_INFO(0, filter)
- ZEND_ARG_INFO(0, attributes)
- ZEND_ARG_INFO(0, attrsonly)
- ZEND_ARG_INFO(0, sizelimit)
- ZEND_ARG_INFO(0, timelimit)
- ZEND_ARG_INFO(0, deref)
- ZEND_ARG_INFO(0, servercontrols)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_count_entries, 0, 0, 2)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, result_identifier)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_first_entry, 0, 0, 2)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, result_identifier)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_next_entry, 0, 0, 2)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, result_identifier)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_get_entries, 0, 0, 2)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, result_identifier)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_first_attribute, 0, 0, 2)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, result_entry_identifier)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_next_attribute, 0, 0, 2)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, result_entry_identifier)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_get_attributes, 0, 0, 2)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, result_entry_identifier)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_get_values, 0, 0, 3)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, result_entry_identifier)
- ZEND_ARG_INFO(0, attribute)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_get_values_len, 0, 0, 3)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, result_entry_identifier)
- ZEND_ARG_INFO(0, attribute)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_get_dn, 0, 0, 2)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, result_entry_identifier)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_explode_dn, 0, 0, 2)
- ZEND_ARG_INFO(0, dn)
- ZEND_ARG_INFO(0, with_attrib)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_dn2ufn, 0, 0, 1)
- ZEND_ARG_INFO(0, dn)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_add, 0, 0, 3)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, dn)
- ZEND_ARG_INFO(0, entry)
- ZEND_ARG_INFO(0, servercontrols)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_add_ext, 0, 0, 3)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, dn)
- ZEND_ARG_INFO(0, entry)
- ZEND_ARG_INFO(0, servercontrols)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_delete, 0, 0, 2)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, dn)
- ZEND_ARG_INFO(0, servercontrols)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_delete_ext, 0, 0, 2)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, dn)
- ZEND_ARG_INFO(0, servercontrols)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_modify, 0, 0, 3)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, dn)
- ZEND_ARG_INFO(0, entry)
- ZEND_ARG_INFO(0, servercontrols)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_modify_batch, 0, 0, 3)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, dn)
- ZEND_ARG_ARRAY_INFO(0, modifications_info, 0)
- ZEND_ARG_INFO(0, servercontrols)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_mod_add, 0, 0, 3)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, dn)
- ZEND_ARG_INFO(0, entry)
- ZEND_ARG_INFO(0, servercontrols)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_mod_add_ext, 0, 0, 3)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, dn)
- ZEND_ARG_INFO(0, entry)
- ZEND_ARG_INFO(0, servercontrols)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_mod_replace, 0, 0, 3)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, dn)
- ZEND_ARG_INFO(0, entry)
- ZEND_ARG_INFO(0, servercontrols)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_mod_replace_ext, 0, 0, 3)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, dn)
- ZEND_ARG_INFO(0, entry)
- ZEND_ARG_INFO(0, servercontrols)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_mod_del, 0, 0, 3)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, dn)
- ZEND_ARG_INFO(0, entry)
- ZEND_ARG_INFO(0, servercontrols)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_mod_del_ext, 0, 0, 3)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, dn)
- ZEND_ARG_INFO(0, entry)
- ZEND_ARG_INFO(0, servercontrols)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_err2str, 0, 0, 1)
- ZEND_ARG_INFO(0, errno)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_compare, 0, 0, 4)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, dn)
- ZEND_ARG_INFO(0, attribute)
- ZEND_ARG_INFO(0, value)
- ZEND_ARG_INFO(0, servercontrols)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_sort, 0, 0, 3)
- ZEND_ARG_INFO(0, link)
- ZEND_ARG_INFO(0, result)
- ZEND_ARG_INFO(0, sortfilter)
-ZEND_END_ARG_INFO()
-
-#ifdef LDAP_CONTROL_PAGEDRESULTS
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_control_paged_result, 0, 0, 2)
- ZEND_ARG_INFO(0, link)
- ZEND_ARG_INFO(0, pagesize)
- ZEND_ARG_INFO(0, iscritical)
- ZEND_ARG_INFO(0, cookie)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_control_paged_result_response, 0, 0, 2)
- ZEND_ARG_INFO(0, link)
- ZEND_ARG_INFO(0, result)
- ZEND_ARG_INFO(1, cookie)
- ZEND_ARG_INFO(1, estimated)
-ZEND_END_ARG_INFO();
-#endif
-
-#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_rename, 0, 0, 5)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, dn)
- ZEND_ARG_INFO(0, newrdn)
- ZEND_ARG_INFO(0, newparent)
- ZEND_ARG_INFO(0, deleteoldrdn)
- ZEND_ARG_INFO(0, servercontrols)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_rename_ext, 0, 0, 5)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, dn)
- ZEND_ARG_INFO(0, newrdn)
- ZEND_ARG_INFO(0, newparent)
- ZEND_ARG_INFO(0, deleteoldrdn)
- ZEND_ARG_INFO(0, servercontrols)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_get_option, 0, 0, 3)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, option)
- ZEND_ARG_INFO(1, retval)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_set_option, 0, 0, 3)
- ZEND_ARG_INFO(0, link_identifier)
- ZEND_ARG_INFO(0, option)
- ZEND_ARG_INFO(0, newval)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_first_reference, 0, 0, 2)
- ZEND_ARG_INFO(0, link)
- ZEND_ARG_INFO(0, result)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_next_reference, 0, 0, 2)
- ZEND_ARG_INFO(0, link)
- ZEND_ARG_INFO(0, entry)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_LDAP_PARSE_REFERENCE
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_parse_reference, 0, 0, 3)
- ZEND_ARG_INFO(0, link)
- ZEND_ARG_INFO(0, entry)
- ZEND_ARG_INFO(1, referrals)
-ZEND_END_ARG_INFO()
-#endif
-
-
-#ifdef HAVE_LDAP_PARSE_RESULT
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_parse_result, 0, 0, 3)
- ZEND_ARG_INFO(0, link)
- ZEND_ARG_INFO(0, result)
- ZEND_ARG_INFO(1, errcode)
- ZEND_ARG_INFO(1, matcheddn)
- ZEND_ARG_INFO(1, errmsg)
- ZEND_ARG_INFO(1, referrals)
- ZEND_ARG_INFO(1, serverctrls)
-ZEND_END_ARG_INFO()
-#endif
-#endif
-
-#if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC)
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_set_rebind_proc, 0, 0, 2)
- ZEND_ARG_INFO(0, link)
- ZEND_ARG_INFO(0, callback)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_escape, 0, 0, 1)
- ZEND_ARG_INFO(0, value)
- ZEND_ARG_INFO(0, ignore)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-#ifdef STR_TRANSLATION
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_t61_to_8859, 0, 0, 1)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_8859_to_t61, 0, 0, 1)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-#endif
-
-#ifdef HAVE_LDAP_EXTENDED_OPERATION_S
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_exop, 0, 0, 2)
- ZEND_ARG_INFO(0, link)
- ZEND_ARG_INFO(0, reqoid)
- ZEND_ARG_INFO(0, reqdata)
- ZEND_ARG_INFO(0, servercontrols)
- ZEND_ARG_INFO(1, retdata)
- ZEND_ARG_INFO(1, retoid)
-ZEND_END_ARG_INFO()
-#endif
-
-#ifdef HAVE_LDAP_PASSWD
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_exop_passwd, 0, 0, 1)
- ZEND_ARG_INFO(0, link)
- ZEND_ARG_INFO(0, user)
- ZEND_ARG_INFO(0, oldpw)
- ZEND_ARG_INFO(0, newpw)
- ZEND_ARG_INFO(1, serverctrls)
-ZEND_END_ARG_INFO()
-#endif
-
-#ifdef HAVE_LDAP_WHOAMI_S
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_exop_whoami, 0, 0, 1)
- ZEND_ARG_INFO(0, link)
-ZEND_END_ARG_INFO()
-#endif
-
-#ifdef HAVE_LDAP_REFRESH_S
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_exop_refresh, 0, 0, 3)
- ZEND_ARG_INFO(0, link)
- ZEND_ARG_INFO(0, dn)
- ZEND_ARG_INFO(0, ttl)
-ZEND_END_ARG_INFO()
-#endif
-
-#ifdef HAVE_LDAP_PARSE_EXTENDED_RESULT
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_parse_exop, 0, 0, 4)
- ZEND_ARG_INFO(0, link)
- ZEND_ARG_INFO(0, result)
- ZEND_ARG_INFO(1, retdata)
- ZEND_ARG_INFO(1, retoid)
-ZEND_END_ARG_INFO()
-#endif
-/* }}} */
-
/*
This is just a small subset of the functionality provided by the LDAP library. All the
operations are synchronous. Referrals are not handled automatically.
@@ -4802,17 +4384,17 @@ ZEND_END_ARG_INFO()
*/
static const zend_function_entry ldap_functions[] = {
PHP_FE(ldap_connect, arginfo_ldap_connect)
- PHP_FALIAS(ldap_close, ldap_unbind, arginfo_ldap_resource)
+ PHP_FALIAS(ldap_close, ldap_unbind, arginfo_ldap_close)
PHP_FE(ldap_bind, arginfo_ldap_bind)
PHP_FE(ldap_bind_ext, arginfo_ldap_bind_ext)
#ifdef HAVE_LDAP_SASL
PHP_FE(ldap_sasl_bind, arginfo_ldap_sasl_bind)
#endif
- PHP_FE(ldap_unbind, arginfo_ldap_resource)
+ PHP_FE(ldap_unbind, arginfo_ldap_unbind)
PHP_FE(ldap_read, arginfo_ldap_read)
PHP_FE(ldap_list, arginfo_ldap_list)
PHP_FE(ldap_search, arginfo_ldap_search)
- PHP_FE(ldap_free_result, arginfo_ldap_resource)
+ PHP_FE(ldap_free_result, arginfo_ldap_free_result)
PHP_FE(ldap_count_entries, arginfo_ldap_count_entries)
PHP_FE(ldap_first_entry, arginfo_ldap_first_entry)
PHP_FE(ldap_next_entry, arginfo_ldap_next_entry)
@@ -4841,11 +4423,10 @@ static const zend_function_entry ldap_functions[] = {
PHP_FE(ldap_mod_del_ext, arginfo_ldap_mod_del_ext)
/* end gjt mod */
- PHP_FE(ldap_errno, arginfo_ldap_resource)
+ PHP_FE(ldap_errno, arginfo_ldap_errno)
PHP_FE(ldap_err2str, arginfo_ldap_err2str)
- PHP_FE(ldap_error, arginfo_ldap_resource)
+ PHP_FE(ldap_error, arginfo_ldap_error)
PHP_FE(ldap_compare, arginfo_ldap_compare)
- PHP_DEP_FE(ldap_sort, arginfo_ldap_sort)
#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP
PHP_FE(ldap_rename, arginfo_ldap_rename)
@@ -4861,7 +4442,7 @@ static const zend_function_entry ldap_functions[] = {
PHP_FE(ldap_parse_result, arginfo_ldap_parse_result)
#endif
#ifdef HAVE_LDAP_START_TLS_S
- PHP_FE(ldap_start_tls, arginfo_ldap_resource)
+ PHP_FE(ldap_start_tls, arginfo_ldap_start_tls)
#endif
#ifdef HAVE_LDAP_EXTENDED_OPERATION_S
PHP_FE(ldap_exop, arginfo_ldap_exop)
diff --git a/ext/ldap/ldap.stub.php b/ext/ldap/ldap.stub.php
new file mode 100644
index 0000000000..e8a2fc8a32
--- /dev/null
+++ b/ext/ldap/ldap.stub.php
@@ -0,0 +1,335 @@
+<?php
+
+//TODO: missing arginfo functions defined in C using
+
+#ifdef HAVE_ORALDAP
+/** @return resource|false */
+function ldap_connect(string $hostname = UNKNOWN, int $port = 389, string $wallet = UNKNOWN, string $wallet_passwd = UNKNOWN, int $authmode = GSLC_SSL_NO_AUTH) {}
+#else
+/** @return resource|false */
+function ldap_connect(string $hostname = UNKNOWN, int $port = 389) {}
+#endif
+
+/**
+ * @param resource $link_identifier
+ */
+function ldap_unbind($link_identifier): bool {}
+
+/**
+ * @param resource $link_identifier
+ */
+function ldap_close($link_identifier): bool {}
+
+/**
+ * @param resource $link_identifier
+ */
+function ldap_bind($link_identifier, string $bind_rdn = UNKNOWN, string $bind_password = UNKNOWN): bool {}
+
+/**
+ * @param resource $link_identifier
+ * @return resource|false
+ */
+function ldap_bind_ext($link_identifier, string $bind_rdn = UNKNOWN, string $bind_password = UNKNOWN, array $servercontrols = []) {}
+
+#ifdef HAVE_LDAP_SASL
+/**
+ * @param resource $link
+ */
+function ldap_sasl_bind($link, string $binddn = UNKNOWN, string $password = UNKNOWN, string $sasl_mech = UNKNOWN, string $sasl_realm = UNKNOWN, string $sasl_authc_id = UNKNOWN, string $sasl_authz_id = UNKNOWN, string $props = UNKNOWN): bool {}
+#endif
+
+/**
+ * @param resource|array $link_identifier
+ * @param string|array $base_dn
+ * @param string|array $filter
+ * @return resource|false
+ */
+function ldap_read($link_identifier, $base_dn, $filter, array $attributes = [], int $attrsonly = 0, int $sizelimit = -1, int $timelimit = -1, int $deref = LDAP_DEREF_NEVER, array $servercontrols = []) {}
+
+/**
+ * @param resource|array $link_identifier
+ * @param string|array $base_dn
+ * @param string|array $filter
+ * @return resource|false
+ */
+function ldap_list($link_identifier, $base_dn, $filter, array $attributes = [], int $attrsonly = 0, int $sizelimit = -1, int $timelimit = -1, int $deref = LDAP_DEREF_NEVER, array $servercontrols = []) {}
+
+/**
+ * @param resource|array $link_identifier
+ * @param string|array $base_dn
+ * @param string|array $filter
+ * @return resource|false
+ */
+function ldap_search($link_identifier, $base_dn, $filter, array $attributes = [], int $attrsonly = 0, int $sizelimit = -1, int $timelimit = -1, int $deref = LDAP_DEREF_NEVER, array $servercontrols = []) {}
+
+/**
+ * @param resource $link_identifier
+ */
+function ldap_free_result($link_identifier): bool {}
+
+
+/**
+ * @param resource $link_identifier
+ * @param resource $result_identifier
+ */
+function ldap_count_entries($link_identifier, $result_identifier): int {}
+
+/**
+ * @param resource $link_identifier
+ * @param resource $result_identifier
+ * @return resource|false
+ */
+function ldap_first_entry($link_identifier, $result_identifier) {}
+
+/**
+ * @param resource $link_identifier
+ * @param resource $result_identifier
+ * @return resource|false
+ */
+function ldap_next_entry($link_identifier, $result_identifier) {}
+
+/**
+ * @param resource $link_identifier
+ * @param resource $result_identifier
+ */
+function ldap_get_entries($link_identifier, $result_identifier): array|false {}
+
+/**
+ * @param resource $link_identifier
+ * @param resource $result_entry_identifier
+ */
+function ldap_first_attribute($link_identifier, $result_entry_identifier, int $dummy_ber = UNKNOWN): string|false {}
+
+/**
+ * @param resource $link_identifier
+ * @param resource $result_entry_identifier
+ */
+function ldap_next_attribute($link_identifier, $result_entry_identifier, int $dummy_ber = UNKNOWN): string|false {}
+
+/**
+ * @param resource $link_identifier
+ * @param resource $result_entry_identifier
+ */
+function ldap_get_attributes($link_identifier, $result_entry_identifier): array {}
+
+/**
+ * @param resource $link_identifier
+ * @param resource $result_entry_identifier
+ */
+function ldap_get_values($link_identifier, $result_entry_identifier, string $attribute): array|false {}
+
+/**
+ * @param resource $link_identifier
+ * @param resource $result_entry_identifier
+ */
+function ldap_get_values_len($link_identifier, $result_entry_identifier, string $attribute): array|false {}
+
+/**
+ * @param resource $link_identifier
+ * @param resource $result_entry_identifier
+ */
+function ldap_get_dn($link_identifier, $result_entry_identifier): string|false {}
+
+function ldap_explode_dn(string $dn, int $with_attrib): array|false {}
+
+function ldap_dn2ufn(string $dn): string|false {}
+
+/** @param resource $link_identifier */
+function ldap_add($link_identifier, string $dn, array $entry, array $servercontrols = []): bool {}
+
+/**
+ * @param resource $link_identifier
+ * @return resource|false
+ */
+function ldap_add_ext($link_identifier, string $dn, array $entry, array $servercontrols = []) {}
+
+/** @param resource $link_identifier */
+function ldap_delete($link_identifier, string $dn, array $servercontrols = []): bool {}
+
+/**
+ * @param resource $link_identifier
+ * @return resource|false
+ */
+function ldap_delete_ext($link_identifier, string $dn, array $servercontrols = []) {}
+
+/**
+ * @param resource $link_identifier
+ */
+function ldap_modify($link_identifier, string $dn, array $entry, array $servercontrols = []): bool {}
+
+/**
+ * @param resource $link_identifier
+ */
+function ldap_modify_batch($link_identifier, string $dn, array $modifications_info, array $servercontrols = []): bool {}
+
+/**
+ * @param resource $link_identifier
+ */
+function ldap_mod_add($link_identifier, string $dn, array $entry, array $servercontrols = []): bool {}
+
+/**
+ * @param resource $link_identifier
+ * @return resource|false
+ */
+function ldap_mod_add_ext($link_identifier, string $dn, array $entry, array $servercontrols = []) {}
+
+
+/**
+ * @param resource $link_identifier
+ */
+function ldap_mod_replace($link_identifier, string $dn, array $entry, array $servercontrols = []): bool {}
+
+/**
+ * @param resource $link_identifier
+ * @return resource|false
+ */
+function ldap_mod_replace_ext($link_identifier, string $dn, array $entry, array $servercontrols = []) {}
+
+/**
+ * @param resource $link_identifier
+ */
+function ldap_mod_del($link_identifier, string $dn, array $entry, array $servercontrols = []): bool {}
+
+/**
+ * @param resource $link_identifier
+ * @return resource|false
+ */
+function ldap_mod_del_ext($link_identifier, string $dn, array $entry, array $servercontrols = []) {}
+
+/**
+ * @param resource $link
+ */
+function ldap_errno($link): int {}
+
+/**
+ * @param resource $link
+ */
+function ldap_error($link): string {}
+
+function ldap_err2str(int $errno): string {}
+
+/** @param resource $link_identifier */
+function ldap_compare($link_identifier, string $dn, string $attribute, string $value, array $servercontrols = []): bool|int {}
+
+
+#ifdef LDAP_CONTROL_PAGEDRESULTS
+/**
+ * @param resource $link
+ */
+function ldap_control_paged_result($link, int $pagesize, bool $iscritical = false, string $cookie = ''): bool {}
+
+/**
+ * @param resource $link
+ * @param resource $result
+ */
+function ldap_control_paged_result_response($link, $result, &$cookie = null, &$estimated = null): bool {}
+#endif
+
+#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
+/**
+ * @param resource $link_identifier
+ */
+function ldap_rename($link_identifier, string $dn, string $newrdn, string $newparent, bool $deleteoldrdn, array $servercontrols = []): bool {}
+
+/**
+ * @param resource $link_identifier
+ * @return resource|false
+ */
+function ldap_rename_ext($link_identifier, string $dn, string $newrdn, string $newparent, bool $deleteoldrdn, array $servercontrols = []) {}
+
+
+/**
+ * @param resource $link_identifier
+ */
+function ldap_get_option($link_identifier, int $option, &$retval = null): bool {}
+
+/**
+ * @param ?resource $link_identifier
+ */
+function ldap_set_option($link_identifier, int $option, $newval): bool {}
+
+/**
+ * @param resource $link
+ * @param resource $result
+ * @return resource|false
+ */
+function ldap_first_reference($link, $result) {}
+
+/**
+ * @param resource $link
+ * @param resource $entry
+ * @return resource|false
+ */
+function ldap_next_reference($link, $entry) {}
+
+#ifdef HAVE_LDAP_PARSE_REFERENCE
+/**
+ * @param resource $link
+ * @param resource $entry
+ */
+function ldap_parse_reference($link, $entry, &$referrals): bool {}
+#endif
+
+#ifdef HAVE_LDAP_PARSE_RESULT
+/**
+ * @param resource $link
+ * @param resource $result
+ */
+function ldap_parse_result($link, $result, &$errcode, &$matcheddn = null, &$errmsg = null, &$referrals = null, &$serverctrls = null): bool {}
+#endif
+#endif
+
+#if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC)
+/**
+ * @param resource $link
+ * @param callable $callback
+ */
+function ldap_set_rebind_proc($link, $callback): bool {}
+#endif
+
+#ifdef HAVE_LDAP_START_TLS_S
+function ldap_start_tls($link_identifier): bool {}
+#endif
+
+function ldap_escape(string $value, string $ignore = '', int $flags = 0): string {}
+
+#ifdef STR_TRANSLATION
+function ldap_t61_to_8859(string $value): string|false {}
+
+function ldap_8859_to_t61(string $value): string|false {}
+#endif
+
+
+#ifdef HAVE_LDAP_EXTENDED_OPERATION_S
+/**
+ * @param resource $link
+ * @return resource|bool
+ */
+function ldap_exop($link, string $reqoid, ?string $reqdata = null, ?array $servercontrols = [], &$retdata = null, &$retoid = null) {}
+#endif
+
+#ifdef HAVE_LDAP_PASSWD
+/** @param resource $link */
+function ldap_exop_passwd($link, string $user = '', string $oldpw = '', string $newpw = '', &$serverctrls = null): string|bool {}
+#endif
+
+
+#ifdef HAVE_LDAP_WHOAMI_S
+/** @param resource $link */
+function ldap_exop_whoami($link): string|bool {}
+#endif
+
+
+#ifdef HAVE_LDAP_REFRESH_S
+/** @param resource $link */
+function ldap_exop_refresh($link, string $dn, $ttl): int|false {}
+#endif
+
+
+#ifdef HAVE_LDAP_PARSE_EXTENDED_RESULT
+/**
+ * @param resource $link
+ * @param resource $result
+ */
+function ldap_parse_exop($link, $result, &$retdata = null, &$retoid = null): bool {}
+#endif
diff --git a/ext/ldap/ldap_arginfo.h b/ext/ldap/ldap_arginfo.h
new file mode 100644
index 0000000000..c7e5429bdf
--- /dev/null
+++ b/ext/ldap/ldap_arginfo.h
@@ -0,0 +1,350 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+#if defined(HAVE_ORALDAP)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_connect, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, hostname, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, port, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, wallet, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, wallet_passwd, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, authmode, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if !(defined(HAVE_ORALDAP))
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_connect, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, hostname, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, port, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_unbind, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, link_identifier)
+ZEND_END_ARG_INFO()
+
+#define arginfo_ldap_close arginfo_ldap_unbind
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_bind, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, link_identifier)
+ ZEND_ARG_TYPE_INFO(0, bind_rdn, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, bind_password, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_bind_ext, 0, 0, 1)
+ ZEND_ARG_INFO(0, link_identifier)
+ ZEND_ARG_TYPE_INFO(0, bind_rdn, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, bind_password, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, servercontrols, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_LDAP_SASL)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_sasl_bind, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, link)
+ ZEND_ARG_TYPE_INFO(0, binddn, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, sasl_mech, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, sasl_realm, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, sasl_authc_id, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, sasl_authz_id, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, props, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_read, 0, 0, 3)
+ ZEND_ARG_INFO(0, link_identifier)
+ ZEND_ARG_INFO(0, base_dn)
+ ZEND_ARG_INFO(0, filter)
+ ZEND_ARG_TYPE_INFO(0, attributes, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, attrsonly, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, sizelimit, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, timelimit, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, deref, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, servercontrols, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_ldap_list arginfo_ldap_read
+
+#define arginfo_ldap_search arginfo_ldap_read
+
+#define arginfo_ldap_free_result arginfo_ldap_unbind
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_count_entries, 0, 2, IS_LONG, 0)
+ ZEND_ARG_INFO(0, link_identifier)
+ ZEND_ARG_INFO(0, result_identifier)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_first_entry, 0, 0, 2)
+ ZEND_ARG_INFO(0, link_identifier)
+ ZEND_ARG_INFO(0, result_identifier)
+ZEND_END_ARG_INFO()
+
+#define arginfo_ldap_next_entry arginfo_ldap_first_entry
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ldap_get_entries, 0, 2, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, link_identifier)
+ ZEND_ARG_INFO(0, result_identifier)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ldap_first_attribute, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, link_identifier)
+ ZEND_ARG_INFO(0, result_entry_identifier)
+ ZEND_ARG_TYPE_INFO(0, dummy_ber, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_ldap_next_attribute arginfo_ldap_first_attribute
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_get_attributes, 0, 2, IS_ARRAY, 0)
+ ZEND_ARG_INFO(0, link_identifier)
+ ZEND_ARG_INFO(0, result_entry_identifier)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ldap_get_values, 0, 3, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, link_identifier)
+ ZEND_ARG_INFO(0, result_entry_identifier)
+ ZEND_ARG_TYPE_INFO(0, attribute, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_ldap_get_values_len arginfo_ldap_get_values
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ldap_get_dn, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, link_identifier)
+ ZEND_ARG_INFO(0, result_entry_identifier)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ldap_explode_dn, 0, 2, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, dn, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, with_attrib, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ldap_dn2ufn, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, dn, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_add, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, link_identifier)
+ ZEND_ARG_TYPE_INFO(0, dn, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, entry, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, servercontrols, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_add_ext, 0, 0, 3)
+ ZEND_ARG_INFO(0, link_identifier)
+ ZEND_ARG_TYPE_INFO(0, dn, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, entry, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, servercontrols, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_delete, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, link_identifier)
+ ZEND_ARG_TYPE_INFO(0, dn, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, servercontrols, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_delete_ext, 0, 0, 2)
+ ZEND_ARG_INFO(0, link_identifier)
+ ZEND_ARG_TYPE_INFO(0, dn, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, servercontrols, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_ldap_modify arginfo_ldap_add
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_modify_batch, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, link_identifier)
+ ZEND_ARG_TYPE_INFO(0, dn, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, modifications_info, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, servercontrols, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_ldap_mod_add arginfo_ldap_add
+
+#define arginfo_ldap_mod_add_ext arginfo_ldap_add_ext
+
+#define arginfo_ldap_mod_replace arginfo_ldap_add
+
+#define arginfo_ldap_mod_replace_ext arginfo_ldap_add_ext
+
+#define arginfo_ldap_mod_del arginfo_ldap_add
+
+#define arginfo_ldap_mod_del_ext arginfo_ldap_add_ext
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_errno, 0, 1, IS_LONG, 0)
+ ZEND_ARG_INFO(0, link)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_error, 0, 1, IS_STRING, 0)
+ ZEND_ARG_INFO(0, link)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_err2str, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, errno, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ldap_compare, 0, 4, MAY_BE_BOOL|MAY_BE_LONG)
+ ZEND_ARG_INFO(0, link_identifier)
+ ZEND_ARG_TYPE_INFO(0, dn, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, attribute, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, servercontrols, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(LDAP_CONTROL_PAGEDRESULTS)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_control_paged_result, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, link)
+ ZEND_ARG_TYPE_INFO(0, pagesize, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, iscritical, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, cookie, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(LDAP_CONTROL_PAGEDRESULTS)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_control_paged_result_response, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, link)
+ ZEND_ARG_INFO(0, result)
+ ZEND_ARG_INFO(1, cookie)
+ ZEND_ARG_INFO(1, estimated)
+ZEND_END_ARG_INFO()
+#endif
+
+#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_rename, 0, 5, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, link_identifier)
+ ZEND_ARG_TYPE_INFO(0, dn, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, newrdn, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, newparent, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, deleteoldrdn, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, servercontrols, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_rename_ext, 0, 0, 5)
+ ZEND_ARG_INFO(0, link_identifier)
+ ZEND_ARG_TYPE_INFO(0, dn, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, newrdn, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, newparent, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, deleteoldrdn, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, servercontrols, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_get_option, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, link_identifier)
+ ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0)
+ ZEND_ARG_INFO(1, retval)
+ZEND_END_ARG_INFO()
+#endif
+
+#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_set_option, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, link_identifier)
+ ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0)
+ ZEND_ARG_INFO(0, newval)
+ZEND_END_ARG_INFO()
+#endif
+
+#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_first_reference, 0, 0, 2)
+ ZEND_ARG_INFO(0, link)
+ ZEND_ARG_INFO(0, result)
+ZEND_END_ARG_INFO()
+#endif
+
+#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_next_reference, 0, 0, 2)
+ ZEND_ARG_INFO(0, link)
+ ZEND_ARG_INFO(0, entry)
+ZEND_END_ARG_INFO()
+#endif
+
+#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP && defined(HAVE_LDAP_PARSE_REFERENCE)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_parse_reference, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, link)
+ ZEND_ARG_INFO(0, entry)
+ ZEND_ARG_INFO(1, referrals)
+ZEND_END_ARG_INFO()
+#endif
+
+#if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP && defined(HAVE_LDAP_PARSE_RESULT)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_parse_result, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, link)
+ ZEND_ARG_INFO(0, result)
+ ZEND_ARG_INFO(1, errcode)
+ ZEND_ARG_INFO(1, matcheddn)
+ ZEND_ARG_INFO(1, errmsg)
+ ZEND_ARG_INFO(1, referrals)
+ ZEND_ARG_INFO(1, serverctrls)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_set_rebind_proc, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, link)
+ ZEND_ARG_INFO(0, callback)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_LDAP_START_TLS_S)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_start_tls, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, link_identifier)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_escape, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, ignore, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(STR_TRANSLATION)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ldap_t61_to_8859, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(STR_TRANSLATION)
+#define arginfo_ldap_8859_to_t61 arginfo_ldap_t61_to_8859
+#endif
+
+#if defined(HAVE_LDAP_EXTENDED_OPERATION_S)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_exop, 0, 0, 2)
+ ZEND_ARG_INFO(0, link)
+ ZEND_ARG_TYPE_INFO(0, reqoid, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, reqdata, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, servercontrols, IS_ARRAY, 1)
+ ZEND_ARG_INFO(1, retdata)
+ ZEND_ARG_INFO(1, retoid)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_LDAP_PASSWD)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ldap_exop_passwd, 0, 1, MAY_BE_STRING|MAY_BE_BOOL)
+ ZEND_ARG_INFO(0, link)
+ ZEND_ARG_TYPE_INFO(0, user, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, oldpw, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, newpw, IS_STRING, 0)
+ ZEND_ARG_INFO(1, serverctrls)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_LDAP_WHOAMI_S)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ldap_exop_whoami, 0, 1, MAY_BE_STRING|MAY_BE_BOOL)
+ ZEND_ARG_INFO(0, link)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_LDAP_REFRESH_S)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ldap_exop_refresh, 0, 3, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, link)
+ ZEND_ARG_TYPE_INFO(0, dn, IS_STRING, 0)
+ ZEND_ARG_INFO(0, ttl)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_LDAP_PARSE_EXTENDED_RESULT)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_parse_exop, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, link)
+ ZEND_ARG_INFO(0, result)
+ ZEND_ARG_INFO(1, retdata)
+ ZEND_ARG_INFO(1, retoid)
+ZEND_END_ARG_INFO()
+#endif
diff --git a/ext/ldap/php_ldap.h b/ext/ldap/php_ldap.h
index f777fe9a5f..fcda55e92f 100644
--- a/ext/ldap/php_ldap.h
+++ b/ext/ldap/php_ldap.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/ldap/tests/bug48441.phpt b/ext/ldap/tests/bug48441.phpt
index 4f212e7402..c4b224c7a7 100644
--- a/ext/ldap/tests/bug48441.phpt
+++ b/ext/ldap/tests/bug48441.phpt
@@ -18,19 +18,18 @@ $dn = "$base";
$filter = "(objectclass=person)";
var_dump(
- $result = ldap_search($link, $dn, $filter, array('sn')),
- ldap_get_entries($link, $result)
+ $result = ldap_search($link, $dn, $filter, array('sn')),
+ ldap_get_entries($link, $result)
);
var_dump(
- $result = ldap_search($link, $dn, $filter, array('sn'), 1, 1, 1, LDAP_DEREF_ALWAYS),
- ldap_get_entries($link, $result)
+ $result = ldap_search($link, $dn, $filter, array('sn'), 1, 1, 1, LDAP_DEREF_ALWAYS),
+ ldap_get_entries($link, $result)
);
var_dump(
- $result = ldap_search($link, $dn, $filter, array('sn')),
- ldap_get_entries($link, $result)
+ $result = ldap_search($link, $dn, $filter, array('sn')),
+ ldap_get_entries($link, $result)
);
?>
-===DONE===
--CLEAN--
<?php
include "connect.inc";
@@ -166,4 +165,3 @@ array(4) {
string(%d) "cn=userC,cn=userB,%s"
}
}
-===DONE===
diff --git a/ext/ldap/tests/bug48696.phpt b/ext/ldap/tests/bug48696.phpt
deleted file mode 100644
index 8d25b67236..0000000000
--- a/ext/ldap/tests/bug48696.phpt
+++ /dev/null
@@ -1,15 +0,0 @@
---TEST--
-Bug #48696 (ldap_read() segfaults with invalid parameters)
---SKIPIF--
-<?php
-require_once('skipif.inc');
-require_once('skipifbindfailure.inc');
-?>
---FILE--
-<?php
-
-ldap_read(1,1,1);
-
-?>
---EXPECTF--
-Warning: ldap_read(): supplied argument is not a valid ldap link resource in %s on line %d
diff --git a/ext/ldap/tests/bug73933.phpt b/ext/ldap/tests/bug73933.phpt
index ac934a8dd8..8e50a750e2 100644
--- a/ext/ldap/tests/bug73933.phpt
+++ b/ext/ldap/tests/bug73933.phpt
@@ -10,15 +10,15 @@ require_once('skipif.inc');
$ldap = ldap_connect('127.0.0.1', 3333);
ldap_mod_replace($ldap, null, array(
- 'lockoutTime' => array(0),
+ 'lockoutTime' => array(0),
));
ldap_modify_batch($ldap, null, array( [
- "attrib" => "mail",
- "modtype" => LDAP_MODIFY_BATCH_ADD,
- "values" => [
- "test@example.com",
- "test-2@example.com", ]]));
+ "attrib" => "mail",
+ "modtype" => LDAP_MODIFY_BATCH_ADD,
+ "values" => [
+ "test@example.com",
+ "test-2@example.com", ]]));
ldap_close($ldap);
diff --git a/ext/ldap/tests/bug77958.phpt b/ext/ldap/tests/bug77958.phpt
index 7cac768b1a..b370b40eda 100644
--- a/ext/ldap/tests/bug77958.phpt
+++ b/ext/ldap/tests/bug77958.phpt
@@ -13,26 +13,25 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
insert_dummy_data($link, $base);
$mods = array(
- array(
- "attrib" => "telephoneNumber",
- "modtype" => LDAP_MODIFY_BATCH_ADD,
- "values" => array(
- 123456
- )
- ),
- array(
- "attrib" => "description",
- "modtype" => LDAP_MODIFY_BATCH_REMOVE_ALL
- )
+ array(
+ "attrib" => "telephoneNumber",
+ "modtype" => LDAP_MODIFY_BATCH_ADD,
+ "values" => array(
+ 123456
+ )
+ ),
+ array(
+ "attrib" => "description",
+ "modtype" => LDAP_MODIFY_BATCH_REMOVE_ALL
+ )
);
var_dump(
- ldap_modify_batch($link, "cn=userA,$base", $mods),
- $entry = ldap_first_entry($link, ldap_read($link, "cn=userA,$base", "(telephoneNumber=*)")),
- ldap_get_values($link, $entry, "telephoneNumber")
+ ldap_modify_batch($link, "cn=userA,$base", $mods),
+ $entry = ldap_first_entry($link, ldap_read($link, "cn=userA,$base", "(telephoneNumber=*)")),
+ ldap_get_values($link, $entry, "telephoneNumber")
);
?>
-===DONE===
--CLEAN--
<?php
require "connect.inc";
@@ -52,4 +51,3 @@ array(3) {
["count"]=>
int(2)
}
-===DONE===
diff --git a/ext/ldap/tests/connect.inc b/ext/ldap/tests/connect.inc
index de41cca63c..bd6a144d2e 100644
--- a/ext/ldap/tests/connect.inc
+++ b/ext/ldap/tests/connect.inc
@@ -15,74 +15,74 @@ $protocol_version = getenv("LDAP_TEST_OPT_PROTOCOL_VERSION") ?: 3;
$skip_on_bind_failure = getenv("LDAP_TEST_SKIP_BIND_FAILURE") ?: true;
function ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version) {
- $link = ldap_connect($host, $port);
- ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version);
- ldap_bind($link, $user, $passwd);
- return $link;
+ $link = ldap_connect($host, $port);
+ ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version);
+ ldap_bind($link, $user, $passwd);
+ return $link;
}
function test_bind($host, $port, $user, $passwd, $protocol_version) {
- $link = ldap_connect($host, $port);
- ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version);
- return ldap_bind($link, $user, $passwd);
+ $link = ldap_connect($host, $port);
+ ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version);
+ return ldap_bind($link, $user, $passwd);
}
function insert_dummy_data($link, $base) {
- // Create root if not there
- $testBase = ldap_read($link, $base, '(objectClass=*)', array('objectClass'));
- if (ldap_count_entries($link, $testBase) < 1) {
- ldap_add(
- $link, "$base", array(
- "objectClass" => array(
- "top",
- "organization",
- "dcObject"
- ),
- "o" => "php ldap tests"
- )
- );
- }
- ldap_add($link, "o=test,$base", array(
- "objectClass" => array(
+ // Create root if not there
+ $testBase = ldap_read($link, $base, '(objectClass=*)', array('objectClass'));
+ if (ldap_count_entries($link, $testBase) < 1) {
+ ldap_add(
+ $link, "$base", array(
+ "objectClass" => array(
+ "top",
+ "organization",
+ "dcObject"
+ ),
+ "o" => "php ldap tests"
+ )
+ );
+ }
+ ldap_add($link, "o=test,$base", array(
+ "objectClass" => array(
"top",
"organization"),
- "o" => "test",
- ));
- ldap_add($link, "cn=userA,$base", array(
- "objectclass" => "person",
- "cn" => "userA",
- "sn" => "testSN1",
- "userPassword" => "oops",
- "telephoneNumber" => "xx-xx-xx-xx-xx",
- "description" => "user A",
- ));
- ldap_add($link, "cn=userB,$base", array(
- "objectclass" => "person",
- "cn" => "userB",
- "sn" => "testSN2",
- "userPassword" => "oopsIDitItAgain",
- "description" => "user B",
- ));
- ldap_add($link, "cn=userC,cn=userB,$base", array(
- "objectclass" => "person",
- "cn" => "userC",
- "sn" => "testSN3",
- "userPassword" => "0r1g1na1 passw0rd",
- ));
- ldap_add($link, "o=test2,$base", array(
- "objectClass" => array(
+ "o" => "test",
+ ));
+ ldap_add($link, "cn=userA,$base", array(
+ "objectclass" => "person",
+ "cn" => "userA",
+ "sn" => "testSN1",
+ "userPassword" => "oops",
+ "telephoneNumber" => "xx-xx-xx-xx-xx",
+ "description" => "user A",
+ ));
+ ldap_add($link, "cn=userB,$base", array(
+ "objectclass" => "person",
+ "cn" => "userB",
+ "sn" => "testSN2",
+ "userPassword" => "oopsIDitItAgain",
+ "description" => "user B",
+ ));
+ ldap_add($link, "cn=userC,cn=userB,$base", array(
+ "objectclass" => "person",
+ "cn" => "userC",
+ "sn" => "testSN3",
+ "userPassword" => "0r1g1na1 passw0rd",
+ ));
+ ldap_add($link, "o=test2,$base", array(
+ "objectClass" => array(
"top",
"organization"),
- "o" => "test2",
- "l" => array("here", "there", "Antarctica"),
- ));
+ "o" => "test2",
+ "l" => array("here", "there", "Antarctica"),
+ ));
}
function remove_dummy_data($link, $base) {
- ldap_delete($link, "cn=userC,cn=userB,$base");
- ldap_delete($link, "cn=userA,$base");
- ldap_delete($link, "cn=userB,$base");
- ldap_delete($link, "o=test,$base");
- ldap_delete($link, "o=test2,$base");
+ ldap_delete($link, "cn=userC,cn=userB,$base");
+ ldap_delete($link, "cn=userA,$base");
+ ldap_delete($link, "cn=userB,$base");
+ ldap_delete($link, "o=test,$base");
+ ldap_delete($link, "o=test2,$base");
}
?>
diff --git a/ext/ldap/tests/ldap_add_basic.phpt b/ext/ldap/tests/ldap_add_basic.phpt
index 46fd6578db..b247901d73 100644
--- a/ext/ldap/tests/ldap_add_basic.phpt
+++ b/ext/ldap/tests/ldap_add_basic.phpt
@@ -13,21 +13,20 @@ require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
var_dump(
- ldap_add($link, "dc=my-domain,$base", array(
- "objectClass" => array(
- "top",
- "dcObject",
- "organization"),
- "dc" => "my-domain",
- "o" => "my-domain",
- )),
- ldap_get_entries(
- $link,
- ldap_search($link, "$base", "(o=my-domain)")
- )
+ ldap_add($link, "dc=my-domain,$base", array(
+ "objectClass" => array(
+ "top",
+ "dcObject",
+ "organization"),
+ "dc" => "my-domain",
+ "o" => "my-domain",
+ )),
+ ldap_get_entries(
+ $link,
+ ldap_search($link, "$base", "(o=my-domain)")
+ )
);
?>
-===DONE===
--CLEAN--
<?php
require "connect.inc";
@@ -80,4 +79,3 @@ array(2) {
string(%d) "dc=my-domain,%s"
}
}
-===DONE===
diff --git a/ext/ldap/tests/ldap_add_error.phpt b/ext/ldap/tests/ldap_add_error.phpt
index 533496a4b2..61b4d2808d 100644
--- a/ext/ldap/tests/ldap_add_error.phpt
+++ b/ext/ldap/tests/ldap_add_error.phpt
@@ -12,28 +12,20 @@ require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-// Too few parameters
-var_dump(ldap_add());
-var_dump(ldap_add($link));
-var_dump(ldap_add($link, "$base"));
-
-// Too many parameters
-var_dump(ldap_add($link, "$base", array(), [], "Additional data"));
-
var_dump(ldap_add($link, "$base", array()));
// Invalid DN
var_dump(
- ldap_add($link, "weirdAttribute=val", array(
- "weirdAttribute" => "val",
- )),
- ldap_error($link),
- ldap_errno($link)
+ ldap_add($link, "weirdAttribute=val", array(
+ "weirdAttribute" => "val",
+ )),
+ ldap_error($link),
+ ldap_errno($link)
);
// Duplicate entry
for ($i = 0; $i < 2; $i++)
- var_dump(
+ var_dump(
ldap_add($link, "dc=my-domain,$base", array(
"objectClass" => array(
"top",
@@ -42,52 +34,51 @@ for ($i = 0; $i < 2; $i++)
"dc" => "my-domain",
"o" => "my-domain",
))
- );
+ );
var_dump(ldap_error($link), ldap_errno($link));
// Wrong array indexes
var_dump(
- ldap_add($link, "dc=my-domain2,dc=com", array(
- "objectClass" => array(
- 0 => "top",
- 2 => "dcObject",
- 5 => "organization"),
- "dc" => "my-domain",
- "o" => "my-domain",
- ))
- /* Is this correct behaviour to still have "Already exists" as error/errno?
- ,
- ldap_error($link),
- ldap_errno($link)
- */
+ ldap_add($link, "dc=my-domain2,dc=com", array(
+ "objectClass" => array(
+ 0 => "top",
+ 2 => "dcObject",
+ 5 => "organization"),
+ "dc" => "my-domain",
+ "o" => "my-domain",
+ ))
+ /* Is this correct behaviour to still have "Already exists" as error/errno?
+ ,
+ ldap_error($link),
+ ldap_errno($link)
+ */
);
// Invalid attribute
var_dump(
- ldap_add($link, "$base", array(
- "objectClass" => array(
- "top",
- "dcObject",
- "organization"),
- "dc" => "my-domain",
- "o" => "my-domain",
- "weirdAttr" => "weirdVal",
- )),
- ldap_error($link),
- ldap_errno($link)
+ ldap_add($link, "$base", array(
+ "objectClass" => array(
+ "top",
+ "dcObject",
+ "organization"),
+ "dc" => "my-domain",
+ "o" => "my-domain",
+ "weirdAttr" => "weirdVal",
+ )),
+ ldap_error($link),
+ ldap_errno($link)
);
var_dump(
- ldap_add($link, "$base", array(array( "Oops"
- )))
- /* Is this correct behaviour to still have "Undefined attribute type" as error/errno?
- ,
- ldap_error($link),
- ldap_errno($link)
- */
+ ldap_add($link, "$base", array(array( "Oops"
+ )))
+ /* Is this correct behaviour to still have "Undefined attribute type" as error/errno?
+ ,
+ ldap_error($link),
+ ldap_errno($link)
+ */
);
?>
-===DONE===
--CLEAN--
<?php
require "connect.inc";
@@ -97,18 +88,6 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
ldap_delete($link, "dc=my-domain,$base");
?>
--EXPECTF--
-Warning: ldap_add() expects at least 3 parameters, 0 given in %s on line %d
-NULL
-
-Warning: ldap_add() expects at least 3 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_add() expects at least 3 parameters, 2 given in %s on line %d
-NULL
-
-Warning: ldap_add() expects at most 4 parameters, 5 given in %s on line %d
-NULL
-
Warning: ldap_add(): Add: Protocol error in %s on line %d
bool(false)
@@ -133,4 +112,3 @@ int(17)
Warning: ldap_add(): Unknown attribute in the data in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/ldap/tests/ldap_add_ext.phpt b/ext/ldap/tests/ldap_add_ext.phpt
index 12916d98c3..fbcaff523b 100644
--- a/ext/ldap/tests/ldap_add_ext.phpt
+++ b/ext/ldap/tests/ldap_add_ext.phpt
@@ -16,23 +16,22 @@ require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
var_dump(
- $result = ldap_add_ext($link, "o=test_ldap_add_ext,$base", array(
- "objectClass" => array(
- "top",
- "organization"),
- "o" => "test_ldap_add_ext",
- ), [['oid' => LDAP_CONTROL_POST_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['o']]]]),
- ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls),
- $errcode,
- $errmsg,
- $ctrls[LDAP_CONTROL_POST_READ],
- ldap_get_entries(
- $link,
- ldap_search($link, "$base", "(o=test_ldap_add_ext)")
- )
+ $result = ldap_add_ext($link, "o=test_ldap_add_ext,$base", array(
+ "objectClass" => array(
+ "top",
+ "organization"),
+ "o" => "test_ldap_add_ext",
+ ), [['oid' => LDAP_CONTROL_POST_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['o']]]]),
+ ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls),
+ $errcode,
+ $errmsg,
+ $ctrls[LDAP_CONTROL_POST_READ],
+ ldap_get_entries(
+ $link,
+ ldap_search($link, "$base", "(o=test_ldap_add_ext)")
+ )
);
?>
-===DONE===
--CLEAN--
<?php
require "connect.inc";
@@ -91,4 +90,3 @@ array(2) {
string(%d) "o=test_ldap_add_ext,%s"
}
}
-===DONE===
diff --git a/ext/ldap/tests/ldap_bind_basic.phpt b/ext/ldap/tests/ldap_bind_basic.phpt
index d88dd1083b..35948d0dc2 100644
--- a/ext/ldap/tests/ldap_bind_basic.phpt
+++ b/ext/ldap/tests/ldap_bind_basic.phpt
@@ -14,7 +14,5 @@ $link = ldap_connect($host, $port);
ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version);
var_dump(ldap_bind($link));
?>
-===DONE===
--EXPECT--
bool(true)
-===DONE===
diff --git a/ext/ldap/tests/ldap_bind_error.phpt b/ext/ldap/tests/ldap_bind_error.phpt
index a569ce6922..3970bbdf85 100644
--- a/ext/ldap/tests/ldap_bind_error.phpt
+++ b/ext/ldap/tests/ldap_bind_error.phpt
@@ -13,23 +13,15 @@ require "connect.inc";
$link = ldap_connect($host, $port);
ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version);
-// Invalid parameter count
-var_dump(ldap_bind($link, $user, $passwd, null));
-
// Invalid password
var_dump(ldap_bind($link, $user, "ThisIsNotCorrect$passwd"));
// Invalid DN syntax
var_dump(ldap_bind($link, "unexistingProperty=weirdValue,$user", $passwd));
?>
-===DONE===
--EXPECTF--
-Warning: ldap_bind() expects at most 3 parameters, 4 given in %s on line %d
-bool(false)
-
Warning: ldap_bind(): Unable to bind to server: Invalid credentials in %s on line %d
bool(false)
Warning: ldap_bind(): Unable to bind to server: Invalid DN syntax in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/ldap/tests/ldap_bind_ext.phpt b/ext/ldap/tests/ldap_bind_ext.phpt
index 3dd5903d80..685b0588ce 100644
--- a/ext/ldap/tests/ldap_bind_ext.phpt
+++ b/ext/ldap/tests/ldap_bind_ext.phpt
@@ -17,33 +17,32 @@ $link = ldap_connect($host, $port);
ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version);
var_dump(
- $result = ldap_bind_ext($link, $user, $passwd),
- ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls),
- $errcode,
- $errmsg,
- $ctrls,
- $result = ldap_bind_ext($link, $user, $passwd, [['oid' => LDAP_CONTROL_PASSWORDPOLICYREQUEST]]),
- ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls),
- $errcode,
- $errmsg,
- $ctrls
+ $result = ldap_bind_ext($link, $user, $passwd),
+ ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls),
+ $errcode,
+ $errmsg,
+ $ctrls,
+ $result = ldap_bind_ext($link, $user, $passwd, [['oid' => LDAP_CONTROL_PASSWORDPOLICYREQUEST]]),
+ ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls),
+ $errcode,
+ $errmsg,
+ $ctrls
);
/* Failures */
var_dump(
- $result = ldap_bind_ext($link, $user, "wrongPassword", [['oid' => LDAP_CONTROL_PASSWORDPOLICYREQUEST]]),
- ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls),
- $errcode,
- $errmsg,
- $ctrls,
- $result = ldap_bind_ext($link, "unexistingProperty=weirdValue,$user", $passwd, [['oid' => LDAP_CONTROL_PASSWORDPOLICYREQUEST]]),
- ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls),
- $errcode,
- $errmsg,
- $ctrls
+ $result = ldap_bind_ext($link, $user, "wrongPassword", [['oid' => LDAP_CONTROL_PASSWORDPOLICYREQUEST]]),
+ ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls),
+ $errcode,
+ $errmsg,
+ $ctrls,
+ $result = ldap_bind_ext($link, "unexistingProperty=weirdValue,$user", $passwd, [['oid' => LDAP_CONTROL_PASSWORDPOLICYREQUEST]]),
+ ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls),
+ $errcode,
+ $errmsg,
+ $ctrls
);
?>
-===DONE===
--EXPECTF--
resource(%d) of type (ldap result)
bool(true)
@@ -69,4 +68,3 @@ int(34)
string(10) "invalid DN"
array(0) {
}
-===DONE===
diff --git a/ext/ldap/tests/ldap_bind_variation.phpt b/ext/ldap/tests/ldap_bind_variation.phpt
index 4aed3180ee..6fa4c202f9 100644
--- a/ext/ldap/tests/ldap_bind_variation.phpt
+++ b/ext/ldap/tests/ldap_bind_variation.phpt
@@ -14,7 +14,5 @@ $link = ldap_connect($host, $port);
ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version);
var_dump(ldap_bind($link, $user, $passwd));
?>
-===DONE===
--EXPECT--
bool(true)
-===DONE===
diff --git a/ext/ldap/tests/ldap_compare_basic.phpt b/ext/ldap/tests/ldap_compare_basic.phpt
index a8bb37f004..32f6ccf78f 100644
--- a/ext/ldap/tests/ldap_compare_basic.phpt
+++ b/ext/ldap/tests/ldap_compare_basic.phpt
@@ -13,11 +13,10 @@ require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
insert_dummy_data($link, $base);
var_dump(
- ldap_compare($link, "cn=userA,$base", "sn", "testSN1"),
- ldap_compare($link, "cn=userA,$base", "telephoneNumber", "yy-yy-yy-yy-yy")
+ ldap_compare($link, "cn=userA,$base", "sn", "testSN1"),
+ ldap_compare($link, "cn=userA,$base", "telephoneNumber", "yy-yy-yy-yy-yy")
);
?>
-===DONE===
--CLEAN--
<?php
include "connect.inc";
@@ -28,4 +27,3 @@ remove_dummy_data($link, $base);
--EXPECT--
bool(true)
bool(false)
-===DONE===
diff --git a/ext/ldap/tests/ldap_compare_error.phpt b/ext/ldap/tests/ldap_compare_error.phpt
index 120dfab059..1b1231b6f9 100644
--- a/ext/ldap/tests/ldap_compare_error.phpt
+++ b/ext/ldap/tests/ldap_compare_error.phpt
@@ -13,21 +13,12 @@ require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
insert_dummy_data($link, $base);
-// Too few parameters
-var_dump(ldap_compare($link));
-var_dump(ldap_compare($link, $link));
-var_dump(ldap_compare($link, $link, $link));
-
-// Too many parameters
-var_dump(ldap_compare($link, $link, $link, $link, [], "Additional data"));
-
var_dump(
- ldap_compare($link, "cn=userNotAvailable,$base", "sn", "testSN1"),
- ldap_error($link),
- ldap_errno($link)
+ ldap_compare($link, "cn=userNotAvailable,$base", "sn", "testSN1"),
+ ldap_error($link),
+ ldap_errno($link)
);
?>
-===DONE===
--CLEAN--
<?php
include "connect.inc";
@@ -36,20 +27,7 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
remove_dummy_data($link, $base);
?>
--EXPECTF--
-Warning: ldap_compare() expects at least 4 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_compare() expects at least 4 parameters, 2 given in %s on line %d
-NULL
-
-Warning: ldap_compare() expects at least 4 parameters, 3 given in %s on line %d
-NULL
-
-Warning: ldap_compare() expects at most 5 parameters, 6 given in %s on line %d
-NULL
-
Warning: ldap_compare(): Compare: No such object in %s on line %d
int(-1)
string(14) "No such object"
int(32)
-===DONE===
diff --git a/ext/ldap/tests/ldap_connect_basic.phpt b/ext/ldap/tests/ldap_connect_basic.phpt
index 26133a6b2e..0d03c99d59 100644
--- a/ext/ldap/tests/ldap_connect_basic.phpt
+++ b/ext/ldap/tests/ldap_connect_basic.phpt
@@ -12,7 +12,5 @@ require "connect.inc";
$link = ldap_connect($host, $port);
var_dump($link);
?>
-===DONE===
--EXPECTF--
resource(%d) of type (ldap link)
-===DONE===
diff --git a/ext/ldap/tests/ldap_connect_error.phpt b/ext/ldap/tests/ldap_connect_error.phpt
index b93375c39e..b8adcf1ded 100644
--- a/ext/ldap/tests/ldap_connect_error.phpt
+++ b/ext/ldap/tests/ldap_connect_error.phpt
@@ -12,20 +12,14 @@ ldap.max_links=1
require "connect.inc";
// too many arguments
-var_dump(ldap_connect(null, null, null));
var_dump(ldap_connect("ldap://$host:$port/$base"));
$links = array();
$links[0] = ldap_connect($host, $port);
$links[1] = ldap_connect($host, $port);
?>
-===DONE===
--EXPECTF--
-Warning: ldap_connect() expects at most 2 parameters, 3 given in %s on line %d
-bool(false)
-
Warning: ldap_connect(): Could not create session handle: %s in %s on line %d
bool(false)
Warning: ldap_connect(): Too many open links (1) in %s on line %d
-===DONE===
diff --git a/ext/ldap/tests/ldap_connect_ldap_conf.phpt b/ext/ldap/tests/ldap_connect_ldap_conf.phpt
index 86b17b5613..3c3c906f36 100644
--- a/ext/ldap/tests/ldap_connect_ldap_conf.phpt
+++ b/ext/ldap/tests/ldap_connect_ldap_conf.phpt
@@ -20,7 +20,5 @@ ldap_get_option($link, LDAP_OPT_HOST_NAME, $host);
var_dump($host);
unlink($conf);
?>
-===DONE===
--EXPECT--
string(16) "example.com:3141"
-===DONE===
diff --git a/ext/ldap/tests/ldap_connect_variation.phpt b/ext/ldap/tests/ldap_connect_variation.phpt
index 09b07e7786..1405e0706f 100644
--- a/ext/ldap/tests/ldap_connect_variation.phpt
+++ b/ext/ldap/tests/ldap_connect_variation.phpt
@@ -29,11 +29,9 @@ var_dump($link);
$link = ldap_connect("nonexistent" . $host);
var_dump($link);
?>
-===DONE===
--EXPECTF--
resource(%d) of type (ldap link)
resource(%d) of type (ldap link)
resource(%d) of type (ldap link)
resource(%d) of type (ldap link)
resource(%d) of type (ldap link)
-===DONE===
diff --git a/ext/ldap/tests/ldap_control_paged_results_variation1.phpt b/ext/ldap/tests/ldap_control_paged_results_variation1.phpt
index 76084cfb4b..75d147e0be 100644
--- a/ext/ldap/tests/ldap_control_paged_results_variation1.phpt
+++ b/ext/ldap/tests/ldap_control_paged_results_variation1.phpt
@@ -17,12 +17,11 @@ insert_dummy_data($link, $base);
$dn = "$base";
$filter = "(cn=user*)";
var_dump(
- ldap_control_paged_result($link, 1),
- $result = ldap_search($link, $dn, $filter, array('cn')),
- ldap_get_entries($link, $result)
+ ldap_control_paged_result($link, 1),
+ $result = ldap_search($link, $dn, $filter, array('cn')),
+ ldap_get_entries($link, $result)
);
?>
-===DONE===
--CLEAN--
<?php
include "connect.inc";
@@ -54,4 +53,3 @@ array(2) {
string(%d) "cn=userA,%s"
}
}
-===DONE===
diff --git a/ext/ldap/tests/ldap_control_paged_results_variation2.phpt b/ext/ldap/tests/ldap_control_paged_results_variation2.phpt
index 6b7eb35537..b0b6e62aff 100644
--- a/ext/ldap/tests/ldap_control_paged_results_variation2.phpt
+++ b/ext/ldap/tests/ldap_control_paged_results_variation2.phpt
@@ -17,12 +17,11 @@ insert_dummy_data($link, $base);
$dn = "$base";
$filter = "(cn=user*)";
var_dump(
- ldap_control_paged_result($link, 2),
- $result = ldap_search($link, $dn, $filter, array('cn')),
- ldap_get_entries($link, $result)
+ ldap_control_paged_result($link, 2),
+ $result = ldap_search($link, $dn, $filter, array('cn')),
+ ldap_get_entries($link, $result)
);
?>
-===DONE===
--CLEAN--
<?php
include "connect.inc";
@@ -70,4 +69,3 @@ array(3) {
string(%d) "cn=userB,%s"
}
}
-===DONE===
diff --git a/ext/ldap/tests/ldap_control_paged_results_variation3.phpt b/ext/ldap/tests/ldap_control_paged_results_variation3.phpt
index 0099b1f9a1..de904f051f 100644
--- a/ext/ldap/tests/ldap_control_paged_results_variation3.phpt
+++ b/ext/ldap/tests/ldap_control_paged_results_variation3.phpt
@@ -18,16 +18,15 @@ $dn = "$base";
$filter = "(cn=user*)";
$cookie = '';
var_dump(
- ldap_control_paged_result($link, 2, true, $cookie),
- $result = ldap_search($link, $dn, $filter, array('cn')),
- ldap_get_entries($link, $result),
- ldap_control_paged_result_response($link, $result, $cookie),
- ldap_control_paged_result($link, 20, true, $cookie),
- $result = ldap_search($link, $dn, $filter, array('cn')),
- ldap_get_entries($link, $result)
+ ldap_control_paged_result($link, 2, true, $cookie),
+ $result = ldap_search($link, $dn, $filter, array('cn')),
+ ldap_get_entries($link, $result),
+ ldap_control_paged_result_response($link, $result, $cookie),
+ ldap_control_paged_result($link, 20, true, $cookie),
+ $result = ldap_search($link, $dn, $filter, array('cn')),
+ ldap_get_entries($link, $result)
);
?>
-===DONE===
--CLEAN--
<?php
include "connect.inc";
@@ -102,4 +101,3 @@ array(2) {
string(%d) "cn=userC,cn=userB,%s"
}
}
-===DONE===
diff --git a/ext/ldap/tests/ldap_controls.phpt b/ext/ldap/tests/ldap_controls.phpt
index 8a9c8f9f22..e6e0ab6164 100644
--- a/ext/ldap/tests/ldap_controls.phpt
+++ b/ext/ldap/tests/ldap_controls.phpt
@@ -19,38 +19,37 @@ insert_dummy_data($link, $base);
/* Test assertion control */
var_dump(
- $result = ldap_search($link, "o=test,$base", "objectClass=*", array('o'), 0, 0, 0, LDAP_DEREF_NEVER,
- [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(objectClass=organization)']]]),
- ldap_get_entries($link, $result),
- $result = ldap_search($link, "o=test,$base", "objectClass=*", array('o'), 0, 0, 0, LDAP_DEREF_NEVER,
- [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(objectClass=organizationalUnit)']]]),
- ldap_modify($link, "o=test,$base", ['description' => 'desc'],
- [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(!(description=*))']]]),
- $result = ldap_read($link, "o=test,$base", "objectClass=*", array('description')),
- ldap_get_entries($link, $result),
- ldap_modify($link, "o=test,$base", ['description' => 'desc2'],
- [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(!(description=*))']]]),
- $result = ldap_read($link, "o=test,$base", "objectClass=*", array('description')),
- ldap_get_entries($link, $result),
- ldap_delete($link, "o=test,$base", [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(description=desc2)']]]),
- ldap_errno($link),
- ldap_error($link),
- ldap_rename($link, "o=test,$base", "o=test2", "", TRUE, [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(description=desc2)']]]),
- ldap_compare($link, "o=test,$base", "o", "test"),
- ldap_compare($link, "o=test,$base", "o", "test", [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(description=desc2)']]]),
- ldap_compare($link, "o=test,$base", "o", "test", [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(description=desc)']]])
+ $result = ldap_search($link, "o=test,$base", "objectClass=*", array('o'), 0, 0, 0, LDAP_DEREF_NEVER,
+ [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(objectClass=organization)']]]),
+ ldap_get_entries($link, $result),
+ $result = ldap_search($link, "o=test,$base", "objectClass=*", array('o'), 0, 0, 0, LDAP_DEREF_NEVER,
+ [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(objectClass=organizationalUnit)']]]),
+ ldap_modify($link, "o=test,$base", ['description' => 'desc'],
+ [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(!(description=*))']]]),
+ $result = ldap_read($link, "o=test,$base", "objectClass=*", array('description')),
+ ldap_get_entries($link, $result),
+ ldap_modify($link, "o=test,$base", ['description' => 'desc2'],
+ [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(!(description=*))']]]),
+ $result = ldap_read($link, "o=test,$base", "objectClass=*", array('description')),
+ ldap_get_entries($link, $result),
+ ldap_delete($link, "o=test,$base", [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(description=desc2)']]]),
+ ldap_errno($link),
+ ldap_error($link),
+ ldap_rename($link, "o=test,$base", "o=test2", "", TRUE, [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(description=desc2)']]]),
+ ldap_compare($link, "o=test,$base", "o", "test"),
+ ldap_compare($link, "o=test,$base", "o", "test", [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(description=desc2)']]]),
+ ldap_compare($link, "o=test,$base", "o", "test", [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(description=desc)']]])
);
/* Test valuesreturnfilter control */
var_dump(
- $result = ldap_read($link, "o=test2,$base", "objectClass=*", ["l"]),
- ldap_get_entries($link, $result)[0]['l'],
- $result = ldap_read($link, "o=test2,$base", "objectClass=*", ["l"], 0, 0, 0, LDAP_DEREF_NEVER,
- [['oid' => LDAP_CONTROL_VALUESRETURNFILTER, 'iscritical' => TRUE, 'value' => ['filter' => '(l=*here)']]]),
- ldap_get_entries($link, $result)[0]['l']
+ $result = ldap_read($link, "o=test2,$base", "objectClass=*", ["l"]),
+ ldap_get_entries($link, $result)[0]['l'],
+ $result = ldap_read($link, "o=test2,$base", "objectClass=*", ["l"], 0, 0, 0, LDAP_DEREF_NEVER,
+ [['oid' => LDAP_CONTROL_VALUESRETURNFILTER, 'iscritical' => TRUE, 'value' => ['filter' => '(l=*here)']]]),
+ ldap_get_entries($link, $result)[0]['l']
);
?>
-===DONE===
--CLEAN--
<?php
include "connect.inc";
@@ -159,4 +158,3 @@ array(3) {
[1]=>
string(5) "there"
}
-===DONE===
diff --git a/ext/ldap/tests/ldap_count_entries_basic.phpt b/ext/ldap/tests/ldap_count_entries_basic.phpt
index 7eef960614..01847f1b03 100644
--- a/ext/ldap/tests/ldap_count_entries_basic.phpt
+++ b/ext/ldap/tests/ldap_count_entries_basic.phpt
@@ -15,7 +15,6 @@ insert_dummy_data($link, $base);
$result = ldap_search($link, "$base", "(objectclass=person)");
var_dump(ldap_count_entries($link, $result));
?>
-===DONE===
--CLEAN--
<?php
include "connect.inc";
@@ -25,4 +24,3 @@ remove_dummy_data($link, $base);
?>
--EXPECT--
int(3)
-===DONE===
diff --git a/ext/ldap/tests/ldap_count_entries_error.phpt b/ext/ldap/tests/ldap_count_entries_error.phpt
deleted file mode 100644
index 552625a7eb..0000000000
--- a/ext/ldap/tests/ldap_count_entries_error.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---TEST--
-ldap_count_entries() - Testing counting LDAP entries that should fail
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-require "connect.inc";
-
-$link = ldap_connect($host, $port);
-var_dump(ldap_count_entries($link));
-var_dump(ldap_count_entries($link, $link));
-?>
-===DONE===
---EXPECTF--
-Warning: ldap_count_entries() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_count_entries(): supplied resource is not a valid ldap result resource in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/ldap/tests/ldap_delete_basic.phpt b/ext/ldap/tests/ldap_delete_basic.phpt
index 84499f2a06..046b141407 100644
--- a/ext/ldap/tests/ldap_delete_basic.phpt
+++ b/ext/ldap/tests/ldap_delete_basic.phpt
@@ -12,20 +12,19 @@ require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
ldap_add($link, "dc=my-domain,$base", array(
- "objectClass" => array(
- "top",
- "dcObject",
- "organization"),
- "dc" => "my-domain",
- "o" => "my-domain",
+ "objectClass" => array(
+ "top",
+ "dcObject",
+ "organization"),
+ "dc" => "my-domain",
+ "o" => "my-domain",
));
var_dump(
- ldap_delete($link, "dc=my-domain,$base"),
- @ldap_search($link, "dc=my-domain,$base", "(o=my-domain)")
+ ldap_delete($link, "dc=my-domain,$base"),
+ @ldap_search($link, "dc=my-domain,$base", "(o=my-domain)")
);
?>
-===DONE===
--CLEAN--
<?php
require "connect.inc";
@@ -37,4 +36,3 @@ ldap_delete($link, "dc=my-domain,$base");
--EXPECT--
bool(true)
bool(false)
-===DONE===
diff --git a/ext/ldap/tests/ldap_delete_error.phpt b/ext/ldap/tests/ldap_delete_error.phpt
index a34d7b39fe..e924c3b59a 100644
--- a/ext/ldap/tests/ldap_delete_error.phpt
+++ b/ext/ldap/tests/ldap_delete_error.phpt
@@ -12,28 +12,20 @@ require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-// Too few parameters
-var_dump(ldap_delete());
-var_dump(ldap_delete($link));
-
-// Too many parameters
-var_dump(ldap_delete($link, "$base", [], "Additional data"));
-
// Invalid DN
var_dump(
- ldap_delete($link, "weirdAttribute=val"),
- ldap_error($link),
- ldap_errno($link)
+ ldap_delete($link, "weirdAttribute=val"),
+ ldap_error($link),
+ ldap_errno($link)
);
// Deleting unexisting data
var_dump(
- ldap_delete($link, "dc=my-domain,$base"),
- ldap_error($link),
- ldap_errno($link)
+ ldap_delete($link, "dc=my-domain,$base"),
+ ldap_error($link),
+ ldap_errno($link)
);
?>
-===DONE===
--CLEAN--
<?php
require "connect.inc";
@@ -41,15 +33,6 @@ require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
?>
--EXPECTF--
-Warning: ldap_delete() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: ldap_delete() expects at least 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_delete() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-
Warning: ldap_delete(): Delete: Invalid DN syntax in %s on line %d
bool(false)
string(17) "Invalid DN syntax"
@@ -59,4 +42,3 @@ Warning: ldap_delete(): Delete: No such object in %s on line %d
bool(false)
string(14) "No such object"
int(32)
-===DONE===
diff --git a/ext/ldap/tests/ldap_delete_ext.phpt b/ext/ldap/tests/ldap_delete_ext.phpt
index c4d0264088..bcdc15ba51 100644
--- a/ext/ldap/tests/ldap_delete_ext.phpt
+++ b/ext/ldap/tests/ldap_delete_ext.phpt
@@ -15,26 +15,25 @@ require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
ldap_add($link, "dc=my-domain,$base", array(
- "objectClass" => array(
- "top",
- "dcObject",
- "organization"),
- "dc" => "my-domain",
- "o" => "my-domain",
+ "objectClass" => array(
+ "top",
+ "dcObject",
+ "organization"),
+ "dc" => "my-domain",
+ "o" => "my-domain",
));
var_dump(
- $result = ldap_delete_ext($link, "dc=my-domain,$base",
- [['oid' => LDAP_CONTROL_PRE_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['dc', 'o']]]]
- ),
- ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls),
- $errcode,
- $errmsg,
- $ctrls[LDAP_CONTROL_PRE_READ],
- @ldap_search($link, "dc=my-domain,$base", "(o=my-domain)")
+ $result = ldap_delete_ext($link, "dc=my-domain,$base",
+ [['oid' => LDAP_CONTROL_PRE_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['dc', 'o']]]]
+ ),
+ ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls),
+ $errcode,
+ $errmsg,
+ $ctrls[LDAP_CONTROL_PRE_READ],
+ @ldap_search($link, "dc=my-domain,$base", "(o=my-domain)")
);
?>
-===DONE===
--CLEAN--
<?php
require "connect.inc";
@@ -68,4 +67,3 @@ array(2) {
}
}
bool(false)
-===DONE===
diff --git a/ext/ldap/tests/ldap_dn2ufn.phpt b/ext/ldap/tests/ldap_dn2ufn.phpt
index 8082e97809..54c90658cf 100644
--- a/ext/ldap/tests/ldap_dn2ufn.phpt
+++ b/ext/ldap/tests/ldap_dn2ufn.phpt
@@ -14,20 +14,15 @@ var_dump(ldap_dn2ufn("cn=bob,ou=users,dc=example,dc=com"));
/* Convert DN with < > characters */
var_dump(ldap_dn2ufn("cn=<bob>,dc=example,dc=com"));
-/* Too many parameters */
-ldap_dn2ufn("cn=bob,dc=example,dc=com", 1);
-
/* Bad DN value */
var_dump(ldap_dn2ufn("bob,dc=example,dc=com"));
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
string(16) "bob, example.com"
string(23) "bob, users, example.com"
bool(false)
-
-Warning: ldap_dn2ufn() expects exactly 1 parameter, 2 given in %s on line %d
bool(false)
Done
diff --git a/ext/ldap/tests/ldap_err2str_basic.phpt b/ext/ldap/tests/ldap_err2str_basic.phpt
index 0ecad03402..fe04d3ca44 100644
--- a/ext/ldap/tests/ldap_err2str_basic.phpt
+++ b/ext/ldap/tests/ldap_err2str_basic.phpt
@@ -9,7 +9,5 @@ Patrick Allaert <patrickallaert@php.net>
<?php
var_dump(ldap_err2str(2));
?>
-===DONE===
--EXPECT--
string(14) "Protocol error"
-===DONE===
diff --git a/ext/ldap/tests/ldap_err2str_error.phpt b/ext/ldap/tests/ldap_err2str_error.phpt
deleted file mode 100644
index 0963ac4101..0000000000
--- a/ext/ldap/tests/ldap_err2str_error.phpt
+++ /dev/null
@@ -1,28 +0,0 @@
---TEST--
-ldap_err2str() - Incorrect usage of number to string conversion
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-// Too few args
-var_dump(ldap_err2str());
-
-// Too many args
-var_dump(ldap_err2str(1, "Additional data"));
-
-var_dump(ldap_err2str("weird"));
-?>
-===DONE===
---EXPECTF--
-Warning: ldap_err2str() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: ldap_err2str() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: ldap_err2str() expects parameter 1 to be int, string given in %s on line %d
-NULL
-===DONE===
diff --git a/ext/ldap/tests/ldap_errno_basic.phpt b/ext/ldap/tests/ldap_errno_basic.phpt
index 58fa9387c0..535bb290ac 100644
--- a/ext/ldap/tests/ldap_errno_basic.phpt
+++ b/ext/ldap/tests/ldap_errno_basic.phpt
@@ -12,19 +12,17 @@ require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
@ldap_add($link, "badDN $base", array(
- "objectClass" => array(
- "top",
- "dcObject",
- "organization"),
- "dc" => "my-domain",
- "o" => "my-domain",
+ "objectClass" => array(
+ "top",
+ "dcObject",
+ "organization"),
+ "dc" => "my-domain",
+ "o" => "my-domain",
));
var_dump(
- ldap_errno($link)
+ ldap_errno($link)
);
?>
-===DONE===
--EXPECT--
int(34)
-===DONE===
diff --git a/ext/ldap/tests/ldap_errno_error.phpt b/ext/ldap/tests/ldap_errno_error.phpt
deleted file mode 100644
index a05876c88e..0000000000
--- a/ext/ldap/tests/ldap_errno_error.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---TEST--
-ldap_errno() - ldap_errno() operation that should fail
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-// Too few parameters
-var_dump(ldap_errno());
-
-// Too many parameters
-var_dump(ldap_errno(null, null));
-?>
-===DONE===
---EXPECTF--
-Warning: ldap_errno() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: ldap_errno() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-===DONE===
diff --git a/ext/ldap/tests/ldap_error_basic.phpt b/ext/ldap/tests/ldap_error_basic.phpt
index ba42d1d32e..442936c3ae 100644
--- a/ext/ldap/tests/ldap_error_basic.phpt
+++ b/ext/ldap/tests/ldap_error_basic.phpt
@@ -12,19 +12,17 @@ require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
@ldap_add($link, "badDN $base", array(
- "objectClass" => array(
- "top",
- "dcObject",
- "organization"),
- "dc" => "my-domain",
- "o" => "my-domain",
+ "objectClass" => array(
+ "top",
+ "dcObject",
+ "organization"),
+ "dc" => "my-domain",
+ "o" => "my-domain",
));
var_dump(
- ldap_error($link)
+ ldap_error($link)
);
?>
-===DONE===
--EXPECT--
string(17) "Invalid DN syntax"
-===DONE===
diff --git a/ext/ldap/tests/ldap_error_error.phpt b/ext/ldap/tests/ldap_error_error.phpt
deleted file mode 100644
index e74eacf008..0000000000
--- a/ext/ldap/tests/ldap_error_error.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---TEST--
-ldap_error() - ldap_error() operation that should fail
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-// Too few parameters
-var_dump(ldap_error());
-
-// Too many parameters
-var_dump(ldap_error(null, null));
-?>
-===DONE===
---EXPECTF--
-Warning: ldap_error() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: ldap_error() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-===DONE===
diff --git a/ext/ldap/tests/ldap_exop.phpt b/ext/ldap/tests/ldap_exop.phpt
index f5543c0e4e..abb63e877f 100644
--- a/ext/ldap/tests/ldap_exop.phpt
+++ b/ext/ldap/tests/ldap_exop.phpt
@@ -14,24 +14,24 @@ insert_dummy_data($link, $base);
function build_reqdata_passwd($user, $oldpw, $newpw)
{
- // This is basic and will only work for small strings
- $hex = '';
- if (!empty($user)) {
- $hex .= '80'.sprintf("%'.02x", strlen($user)).bin2hex($user);
- }
- if (!empty($oldpw)) {
- $hex .= '81'.sprintf("%'.02x", strlen($oldpw)).bin2hex($oldpw);
- }
- if (!empty($newpw)) {
- $hex .= '82'.sprintf("%'.02x", strlen($newpw)).bin2hex($newpw);
- }
- return hex2bin('30'.sprintf("%'.02x", strlen($hex)/2).$hex);
+ // This is basic and will only work for small strings
+ $hex = '';
+ if (!empty($user)) {
+ $hex .= '80'.sprintf("%'.02x", strlen($user)).bin2hex($user);
+ }
+ if (!empty($oldpw)) {
+ $hex .= '81'.sprintf("%'.02x", strlen($oldpw)).bin2hex($oldpw);
+ }
+ if (!empty($newpw)) {
+ $hex .= '82'.sprintf("%'.02x", strlen($newpw)).bin2hex($newpw);
+ }
+ return hex2bin('30'.sprintf("%'.02x", strlen($hex)/2).$hex);
}
function extract_genpw($retdata)
{
- // Only works for small strings as well
- return hex2bin(substr(bin2hex($retdata), 4*2));
+ // Only works for small strings as well
+ return hex2bin(substr(bin2hex($retdata), 4*2));
}
$userAPassword = "oops";
@@ -39,23 +39,22 @@ $userAPassword = "oops";
// ldap_exop(resource link, string reqoid [, string reqdata [, array servercontrols [, string &retdata [, string &retoid]]]])
// bool ldap_parse_exop(resource link, resource result [, string &retdata [, string &retoid]])
var_dump(
- ldap_exop($link, LDAP_EXOP_WHO_AM_I, NULL, NULL, $retdata, $retoid),
- $retdata,
- $retoid,
- ldap_exop($link, LDAP_EXOP_WHO_AM_I, NULL, [['oid' => LDAP_CONTROL_PROXY_AUTHZ, 'value' => "dn:cn=userA,$base"]], $retdata),
- $retdata,
- $r = ldap_exop($link, LDAP_EXOP_WHO_AM_I),
- ldap_parse_exop($link, $r, $retdata2),
- $retdata2,
- test_bind($host, $port, "cn=userA,$base", $userAPassword, $protocol_version),
- $r = ldap_exop($link, LDAP_EXOP_MODIFY_PASSWD, build_reqdata_passwd("cn=userA,$base", $userAPassword, "")),
- ldap_parse_exop($link, $r, $retpwdata, $retpwoid),
- $genpw = extract_genpw($retpwdata),
- $retpwoid,
- test_bind($host, $port, "cn=userA,$base", $genpw, $protocol_version)
+ ldap_exop($link, LDAP_EXOP_WHO_AM_I, NULL, NULL, $retdata, $retoid),
+ $retdata,
+ $retoid,
+ ldap_exop($link, LDAP_EXOP_WHO_AM_I, NULL, [['oid' => LDAP_CONTROL_PROXY_AUTHZ, 'value' => "dn:cn=userA,$base"]], $retdata),
+ $retdata,
+ $r = ldap_exop($link, LDAP_EXOP_WHO_AM_I),
+ ldap_parse_exop($link, $r, $retdata2),
+ $retdata2,
+ test_bind($host, $port, "cn=userA,$base", $userAPassword, $protocol_version),
+ $r = ldap_exop($link, LDAP_EXOP_MODIFY_PASSWD, build_reqdata_passwd("cn=userA,$base", $userAPassword, "")),
+ ldap_parse_exop($link, $r, $retpwdata, $retpwoid),
+ $genpw = extract_genpw($retpwdata),
+ $retpwoid,
+ test_bind($host, $port, "cn=userA,$base", $genpw, $protocol_version)
);
?>
-===DONE===
--CLEAN--
<?php
require "connect.inc";
@@ -79,4 +78,3 @@ bool(true)
string(%d) "%s"
string(0) ""
bool(true)
-===DONE===
diff --git a/ext/ldap/tests/ldap_exop_passwd.phpt b/ext/ldap/tests/ldap_exop_passwd.phpt
index e50b30760c..1b0a1e7397 100644
--- a/ext/ldap/tests/ldap_exop_passwd.phpt
+++ b/ext/ldap/tests/ldap_exop_passwd.phpt
@@ -24,7 +24,6 @@ var_dump(
test_bind($host, $port, "cn=userA,$base", "newPassword", $protocol_version)
);
?>
-===DONE===
--CLEAN--
<?php
require "connect.inc";
@@ -41,4 +40,3 @@ string(%d) "%s"
bool(true)
bool(true)
bool(true)
-===DONE===
diff --git a/ext/ldap/tests/ldap_exop_passwd_error.phpt b/ext/ldap/tests/ldap_exop_passwd_error.phpt
index bfb0cbcae2..de21b7af8e 100644
--- a/ext/ldap/tests/ldap_exop_passwd_error.phpt
+++ b/ext/ldap/tests/ldap_exop_passwd_error.phpt
@@ -18,7 +18,6 @@ var_dump(ldap_error($link));
var_dump(ldap_errno($link));
var_dump(test_bind($host, $port, "cn=userA,$base", "newPassword", $protocol_version));
?>
-===DONE===
--CLEAN--
<?php
require "connect.inc";
@@ -37,4 +36,3 @@ int(53)
Warning: ldap_bind(): Unable to bind to server: Invalid credentials in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/ldap/tests/ldap_exop_refresh.phpt b/ext/ldap/tests/ldap_exop_refresh.phpt
index 13539d53c1..b90a92bc00 100644
--- a/ext/ldap/tests/ldap_exop_refresh.phpt
+++ b/ext/ldap/tests/ldap_exop_refresh.phpt
@@ -21,15 +21,14 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
insert_dummy_data($link, $base);
ldap_add($link, "cn=tmp,$base", array(
- "objectclass" => array("person", "dynamicObject"),
- "cn" => "tmp",
- "sn" => "tmp"
+ "objectclass" => array("person", "dynamicObject"),
+ "cn" => "tmp",
+ "sn" => "tmp"
));
var_dump(
- ldap_exop_refresh($link, "cn=tmp,$base", 1234)
+ ldap_exop_refresh($link, "cn=tmp,$base", 1234)
);
?>
-===DONE===
--CLEAN--
<?php
include "connect.inc";
@@ -40,4 +39,3 @@ remove_dummy_data($link, $base);
?>
--EXPECT--
int(1234)
-===DONE===
diff --git a/ext/ldap/tests/ldap_exop_whoami.phpt b/ext/ldap/tests/ldap_exop_whoami.phpt
index 368038f3bd..2c71848b00 100644
--- a/ext/ldap/tests/ldap_exop_whoami.phpt
+++ b/ext/ldap/tests/ldap_exop_whoami.phpt
@@ -17,7 +17,6 @@ var_dump(
ldap_exop_whoami($link)
);
?>
-===DONE===
--CLEAN--
<?php
require "connect.inc";
@@ -28,4 +27,3 @@ remove_dummy_data($link, $base);
?>
--EXPECTF--
string(%d) "dn:%s"
-===DONE===
diff --git a/ext/ldap/tests/ldap_explode_dn.phpt b/ext/ldap/tests/ldap_explode_dn.phpt
index 2337ac9eff..aa8ab10088 100644
--- a/ext/ldap/tests/ldap_explode_dn.phpt
+++ b/ext/ldap/tests/ldap_explode_dn.phpt
@@ -23,12 +23,6 @@ var_dump(ldap_explode_dn("cn=<bob>,dc=example,dc=com", 0));
/* Explode without attributes and < > characters */
var_dump(ldap_explode_dn("cn=<bob>,dc=example,dc=com", 1));
-/* Too few parameters */
-ldap_explode_dn("cn=bob,dc=example,dc=com");
-
-/* Too many parameters */
-ldap_explode_dn("cn=bob,dc=example,dc=com", 1, 1);
-
/* Bad DN value with attributes */
var_dump(ldap_explode_dn("bob,dc=example,dc=com", 0));
@@ -85,10 +79,6 @@ array(5) {
}
bool(false)
bool(false)
-
-Warning: ldap_explode_dn() expects exactly 2 parameters, 1 given in %s on line %d
-
-Warning: ldap_explode_dn() expects exactly 2 parameters, 3 given in %s on line %d
bool(false)
bool(false)
Done
diff --git a/ext/ldap/tests/ldap_first_attribute_basic.phpt b/ext/ldap/tests/ldap_first_attribute_basic.phpt
index eec67c5f90..81bc538aea 100644
--- a/ext/ldap/tests/ldap_first_attribute_basic.phpt
+++ b/ext/ldap/tests/ldap_first_attribute_basic.phpt
@@ -15,10 +15,9 @@ insert_dummy_data($link, $base);
$result = ldap_search($link, "$base", "(objectclass=organization)", array("objectClass"));
$entry = ldap_first_entry($link, $result);
var_dump(
- ldap_first_attribute($link, $entry)
+ ldap_first_attribute($link, $entry)
);
?>
-===DONE===
--CLEAN--
<?php
include "connect.inc";
@@ -28,4 +27,3 @@ remove_dummy_data($link, $base);
?>
--EXPECT--
string(11) "objectClass"
-===DONE===
diff --git a/ext/ldap/tests/ldap_first_attribute_error.phpt b/ext/ldap/tests/ldap_first_attribute_error.phpt
index f7016c539f..79138669bc 100644
--- a/ext/ldap/tests/ldap_first_attribute_error.phpt
+++ b/ext/ldap/tests/ldap_first_attribute_error.phpt
@@ -10,14 +10,11 @@ Patrick Allaert <patrickallaert@php.net>
require "connect.inc";
$link = ldap_connect($host, $port);
-var_dump(ldap_first_attribute($link));
-var_dump(ldap_first_attribute($link, $link));
+try {
+ var_dump(ldap_first_attribute($link, $link));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
-===DONE===
---EXPECTF--
-Warning: ldap_first_attribute() expects %s 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_first_attribute(): supplied resource is not a valid ldap result entry resource in %s on line %d
-bool(false)
-===DONE===
+--EXPECT--
+ldap_first_attribute(): supplied resource is not a valid ldap result entry resource
diff --git a/ext/ldap/tests/ldap_first_entry_basic.phpt b/ext/ldap/tests/ldap_first_entry_basic.phpt
index 5ba6ac42a4..94d46d6d87 100644
--- a/ext/ldap/tests/ldap_first_entry_basic.phpt
+++ b/ext/ldap/tests/ldap_first_entry_basic.phpt
@@ -14,11 +14,10 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
insert_dummy_data($link, $base);
$result = ldap_search($link, "$base", "(objectclass=person)");
var_dump(
- $entry = ldap_first_entry($link, $result),
- ldap_get_values($link, $entry, 'sn')
+ $entry = ldap_first_entry($link, $result),
+ ldap_get_values($link, $entry, 'sn')
);
?>
-===DONE===
--CLEAN--
<?php
include "connect.inc";
@@ -34,4 +33,3 @@ array(2) {
["count"]=>
int(1)
}
-===DONE===
diff --git a/ext/ldap/tests/ldap_first_entry_error.phpt b/ext/ldap/tests/ldap_first_entry_error.phpt
deleted file mode 100644
index 9f232e0e8f..0000000000
--- a/ext/ldap/tests/ldap_first_entry_error.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-ldap_first_entry() - Testing ldap_first_entry() that should fail
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-require "connect.inc";
-
-$link = ldap_connect($host, $port);
-var_dump(ldap_first_entry($link));
-var_dump(ldap_first_entry($link, $link, "Additional data"));
-var_dump(ldap_first_entry($link, $link));
-?>
-===DONE===
---EXPECTF--
-Warning: ldap_first_entry() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_first_entry() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-Warning: ldap_first_entry(): supplied resource is not a valid ldap result resource in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/ldap/tests/ldap_first_reference_basic.phpt b/ext/ldap/tests/ldap_first_reference_basic.phpt
index 9c83c9127d..0e41ee2458 100644
--- a/ext/ldap/tests/ldap_first_reference_basic.phpt
+++ b/ext/ldap/tests/ldap_first_reference_basic.phpt
@@ -23,7 +23,6 @@ $refs = null;
ldap_parse_reference($link, $ref, $refs);
var_dump($refs);
?>
-===DONE===
--CLEAN--
<?php
include "connect.inc";
@@ -39,4 +38,3 @@ array(1) {
[0]=>
string(%d) "cn=userA,%s"
}
-===DONE===
diff --git a/ext/ldap/tests/ldap_first_reference_error.phpt b/ext/ldap/tests/ldap_first_reference_error.phpt
deleted file mode 100644
index d5541e10fc..0000000000
--- a/ext/ldap/tests/ldap_first_reference_error.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-ldap_first_reference() - Testing ldap_first_reference() that should fail
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-require "connect.inc";
-
-$link = ldap_connect($host, $port);
-var_dump(ldap_first_reference($link));
-var_dump(ldap_first_reference($link, $link, "Additional data"));
-var_dump(ldap_first_reference($link, $link));
-?>
-===DONE===
---EXPECTF--
-Warning: ldap_first_reference() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_first_reference() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-Warning: ldap_first_reference(): supplied resource is not a valid ldap result resource in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/ldap/tests/ldap_free_result_basic.phpt b/ext/ldap/tests/ldap_free_result_basic.phpt
index ff2f5402c3..dead9a62d3 100644
--- a/ext/ldap/tests/ldap_free_result_basic.phpt
+++ b/ext/ldap/tests/ldap_free_result_basic.phpt
@@ -15,7 +15,6 @@ insert_dummy_data($link, $base);
$result = ldap_search($link, "$base", "(objectclass=person)");
var_dump(ldap_free_result($result));
?>
-===DONE===
--CLEAN--
<?php
include "connect.inc";
@@ -25,4 +24,3 @@ remove_dummy_data($link, $base);
?>
--EXPECT--
bool(true)
-===DONE===
diff --git a/ext/ldap/tests/ldap_free_result_error.phpt b/ext/ldap/tests/ldap_free_result_error.phpt
deleted file mode 100644
index 05623d62d0..0000000000
--- a/ext/ldap/tests/ldap_free_result_error.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---TEST--
-ldap_free_result() - Testing ldap_free_result() that should fail
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-require "connect.inc";
-
-$link = ldap_connect($host, $port);
-var_dump(ldap_free_result($link));
-var_dump(ldap_free_result($link, "Additional data"));
-?>
-===DONE===
---EXPECTF--
-Warning: ldap_free_result(): supplied resource is not a valid ldap result resource in %s on line %d
-bool(false)
-
-Warning: ldap_free_result() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-===DONE===
diff --git a/ext/ldap/tests/ldap_get_attributes_basic.phpt b/ext/ldap/tests/ldap_get_attributes_basic.phpt
index b831a7f164..0d11bce706 100644
--- a/ext/ldap/tests/ldap_get_attributes_basic.phpt
+++ b/ext/ldap/tests/ldap_get_attributes_basic.phpt
@@ -15,10 +15,9 @@ insert_dummy_data($link, $base);
$result = ldap_search($link, "$base", "(o=test)");
$entry = ldap_first_entry($link, $result);
var_dump(
- ldap_get_attributes($link, $entry)
+ ldap_get_attributes($link, $entry)
);
?>
-===DONE===
--CLEAN--
<?php
include "connect.inc";
@@ -51,4 +50,3 @@ array(5) {
["count"]=>
int(2)
}
-===DONE===
diff --git a/ext/ldap/tests/ldap_get_attributes_error.phpt b/ext/ldap/tests/ldap_get_attributes_error.phpt
deleted file mode 100644
index 465ba4fd72..0000000000
--- a/ext/ldap/tests/ldap_get_attributes_error.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---TEST--
-ldap_get_attributes() - Testing ldap_get_attributes() that should fail
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-require "connect.inc";
-
-$link = ldap_connect($host, $port);
-var_dump(ldap_get_attributes($link));
-var_dump(ldap_get_attributes($link, $link));
-?>
-===DONE===
---EXPECTF--
-Warning: ldap_get_attributes() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_get_attributes(): supplied resource is not a valid ldap result entry resource in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/ldap/tests/ldap_get_dn_basic.phpt b/ext/ldap/tests/ldap_get_dn_basic.phpt
index 38c252c5bb..14865ffe3c 100644
--- a/ext/ldap/tests/ldap_get_dn_basic.phpt
+++ b/ext/ldap/tests/ldap_get_dn_basic.phpt
@@ -15,10 +15,9 @@ insert_dummy_data($link, $base);
$result = ldap_search($link, "$base", "(objectclass=organization)");
$entry = ldap_first_entry($link, $result);
var_dump(
- ldap_get_dn($link, $entry)
+ ldap_get_dn($link, $entry)
);
?>
-===DONE===
--CLEAN--
<?php
include "connect.inc";
@@ -28,4 +27,3 @@ remove_dummy_data($link, $base);
?>
--EXPECTF--
string(%d) "%s"
-===DONE===
diff --git a/ext/ldap/tests/ldap_get_dn_error.phpt b/ext/ldap/tests/ldap_get_dn_error.phpt
deleted file mode 100644
index 71df6a3da1..0000000000
--- a/ext/ldap/tests/ldap_get_dn_error.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---TEST--
-ldap_get_dn() - Testing ldap_get_dn() that should fail
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-require "connect.inc";
-
-$link = ldap_connect($host, $port);
-var_dump(ldap_get_dn($link));
-var_dump(ldap_get_dn($link, $link));
-?>
-===DONE===
---EXPECTF--
-Warning: ldap_get_dn() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_get_dn(): supplied resource is not a valid ldap result entry resource in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/ldap/tests/ldap_get_entries_basic.phpt b/ext/ldap/tests/ldap_get_entries_basic.phpt
index 3efa818ee2..bba2f08c69 100644
--- a/ext/ldap/tests/ldap_get_entries_basic.phpt
+++ b/ext/ldap/tests/ldap_get_entries_basic.phpt
@@ -14,13 +14,12 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
insert_dummy_data($link, $base);
var_dump(
- ldap_get_entries(
- $link,
- ldap_search($link, "$base", "(o=test)")
- )
+ ldap_get_entries(
+ $link,
+ ldap_search($link, "$base", "(o=test)")
+ )
);
?>
-===DONE===
--CLEAN--
<?php
require "connect.inc";
@@ -60,4 +59,3 @@ array(2) {
string(%d) "o=test,%s"
}
}
-===DONE===
diff --git a/ext/ldap/tests/ldap_get_entries_error.phpt b/ext/ldap/tests/ldap_get_entries_error.phpt
deleted file mode 100644
index 7e0f4c0b98..0000000000
--- a/ext/ldap/tests/ldap_get_entries_error.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-ldap_get_entries() - ldap_get_entries() operation that should fail
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-require "connect.inc";
-
-$link = ldap_connect($host, $port);
-
-// Too few parameters
-var_dump(ldap_get_entries($link));
-
-// Too many parameters
-var_dump(ldap_get_entries($link, $link, "Additional data"));
-
-// Bad parameter
-var_dump(ldap_get_entries($link, "string"));
-?>
-===DONE===
---EXPECTF--
-Warning: ldap_get_entries() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_get_entries() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-Warning: ldap_get_entries() expects parameter 2 to be resource, string given in %s on line %d
-NULL
-===DONE===
diff --git a/ext/ldap/tests/ldap_get_entries_variation.phpt b/ext/ldap/tests/ldap_get_entries_variation.phpt
index 87d155a94c..9dd45b6282 100644
--- a/ext/ldap/tests/ldap_get_entries_variation.phpt
+++ b/ext/ldap/tests/ldap_get_entries_variation.phpt
@@ -14,13 +14,12 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
insert_dummy_data($link, $base);
var_dump(
- ldap_get_entries(
- $link,
- ldap_search($link, "$base", "(o=my-unexisting-domain)")
- )
+ ldap_get_entries(
+ $link,
+ ldap_search($link, "$base", "(o=my-unexisting-domain)")
+ )
);
?>
-===DONE===
--CLEAN--
<?php
require "connect.inc";
@@ -33,4 +32,3 @@ array(1) {
["count"]=>
int(0)
}
-===DONE===
diff --git a/ext/ldap/tests/ldap_get_option_basic.phpt b/ext/ldap/tests/ldap_get_option_basic.phpt
index 3136a5acb8..e9aa7cfc4f 100644
--- a/ext/ldap/tests/ldap_get_option_basic.phpt
+++ b/ext/ldap/tests/ldap_get_option_basic.phpt
@@ -14,12 +14,10 @@ $option = null;
ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version);
var_dump(
- ldap_get_option($link, LDAP_OPT_PROTOCOL_VERSION, $option),
- $option
+ ldap_get_option($link, LDAP_OPT_PROTOCOL_VERSION, $option),
+ $option
);
?>
-===DONE===
--EXPECT--
bool(true)
int(3)
-===DONE===
diff --git a/ext/ldap/tests/ldap_get_option_controls.phpt b/ext/ldap/tests/ldap_get_option_controls.phpt
index abe35497d6..813f33e069 100644
--- a/ext/ldap/tests/ldap_get_option_controls.phpt
+++ b/ext/ldap/tests/ldap_get_option_controls.phpt
@@ -16,49 +16,48 @@ insert_dummy_data($link, $base);
function build_ctrl_paged_value($int, $cookie)
{
- // This is basic and will only work for small values
- $hex = '';
- if (!empty($int)) {
- $str = sprintf("%'.02x", $int);
- $hex .= '02'.sprintf("%'.02x%s", strlen($str)/2, $str);
- }
- $hex .= '04'.sprintf("%'.02x", strlen($cookie)).bin2hex($cookie);
- return hex2bin('30'.sprintf("%'.02x", strlen($hex)/2).$hex);
+ // This is basic and will only work for small values
+ $hex = '';
+ if (!empty($int)) {
+ $str = sprintf("%'.02x", $int);
+ $hex .= '02'.sprintf("%'.02x%s", strlen($str)/2, $str);
+ }
+ $hex .= '04'.sprintf("%'.02x", strlen($cookie)).bin2hex($cookie);
+ return hex2bin('30'.sprintf("%'.02x", strlen($hex)/2).$hex);
}
$controls_set = array(
- array(
- 'oid' => LDAP_CONTROL_PAGEDRESULTS,
- 'iscritical' => TRUE,
- 'value' => build_ctrl_paged_value(1, 'opaque')
- )
+ array(
+ 'oid' => LDAP_CONTROL_PAGEDRESULTS,
+ 'iscritical' => TRUE,
+ 'value' => build_ctrl_paged_value(1, 'opaque')
+ )
);
$controls_set2 = array(
- array(
- 'oid' => LDAP_CONTROL_PAGEDRESULTS,
- 'iscritical' => TRUE,
- 'value' => array(
- 'size' => 1,
- 'cookie' => '',
- )
- )
+ array(
+ 'oid' => LDAP_CONTROL_PAGEDRESULTS,
+ 'iscritical' => TRUE,
+ 'value' => array(
+ 'size' => 1,
+ 'cookie' => '',
+ )
+ )
);
var_dump(
- bin2hex($controls_set[0]['value']),
- ldap_get_option($link, LDAP_OPT_SERVER_CONTROLS, $controls_get),
- ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, $controls_set),
- ldap_get_option($link, LDAP_OPT_SERVER_CONTROLS, $controls_get),
- $controls_get,
- ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, $controls_set2),
- ldap_get_option($link, LDAP_OPT_SERVER_CONTROLS, $controls_get),
- $controls_get,
- $result = ldap_search($link, $base, "(objectClass=person)", array('cn')),
- ldap_get_entries($link, $result)['count'],
- ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, array()),
- ldap_get_option($link, LDAP_OPT_SERVER_CONTROLS, $controls_get)
+ bin2hex($controls_set[0]['value']),
+ ldap_get_option($link, LDAP_OPT_SERVER_CONTROLS, $controls_get),
+ ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, $controls_set),
+ ldap_get_option($link, LDAP_OPT_SERVER_CONTROLS, $controls_get),
+ $controls_get,
+ ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, $controls_set2),
+ ldap_get_option($link, LDAP_OPT_SERVER_CONTROLS, $controls_get),
+ $controls_get,
+ $result = ldap_search($link, $base, "(objectClass=person)", array('cn')),
+ ldap_get_entries($link, $result)['count'],
+ ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, array()),
+ ldap_get_option($link, LDAP_OPT_SERVER_CONTROLS, $controls_get)
);
?>
-===DONE===
--CLEAN--
<?php
include "connect.inc";
@@ -109,4 +108,3 @@ resource(%d) of type (ldap result)
int(1)
bool(true)
bool(false)
-===DONE===
diff --git a/ext/ldap/tests/ldap_get_option_error.phpt b/ext/ldap/tests/ldap_get_option_error.phpt
deleted file mode 100644
index cf7a0e5d49..0000000000
--- a/ext/ldap/tests/ldap_get_option_error.phpt
+++ /dev/null
@@ -1,40 +0,0 @@
---TEST--
-ldap_get_option() - ldap_get_option() operation that should fail
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-require "connect.inc";
-
-$link = ldap_connect($host, $port);
-$option = null;
-
-// Too few parameters
-var_dump(ldap_get_option());
-var_dump(ldap_get_option($link));
-var_dump(ldap_get_option($link, LDAP_OPT_PROTOCOL_VERSION));
-
-// Too many parameters
-var_dump(
- ldap_get_option($link, LDAP_OPT_PROTOCOL_VERSION, $option, "Additional data"),
- $option
-);
-?>
-===DONE===
---EXPECTF--
-Warning: ldap_get_option() expects exactly 3 parameters, 0 given in %s on line %d
-NULL
-
-Warning: ldap_get_option() expects exactly 3 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_get_option() expects exactly 3 parameters, 2 given in %s on line %d
-NULL
-
-Warning: ldap_get_option() expects exactly 3 parameters, 4 given in %s on line %d
-NULL
-NULL
-===DONE===
diff --git a/ext/ldap/tests/ldap_get_option_package_basic.phpt b/ext/ldap/tests/ldap_get_option_package_basic.phpt
index af8146dc9c..1ad9442a38 100644
--- a/ext/ldap/tests/ldap_get_option_package_basic.phpt
+++ b/ext/ldap/tests/ldap_get_option_package_basic.phpt
@@ -14,8 +14,6 @@ var_dump(in_array($optionval, ['GnuTLS', 'OpenSSL', 'MozNSS']));
// This is a read-only option.
var_dump(ldap_set_option($link, LDAP_OPT_X_TLS_PACKAGE, 'foo'));
?>
-===DONE===
--EXPECT--
bool(true)
bool(false)
-===DONE===
diff --git a/ext/ldap/tests/ldap_get_option_variation.phpt b/ext/ldap/tests/ldap_get_option_variation.phpt
index a18318849f..80384475b4 100644
--- a/ext/ldap/tests/ldap_get_option_variation.phpt
+++ b/ext/ldap/tests/ldap_get_option_variation.phpt
@@ -13,8 +13,8 @@ $link = ldap_connect($host, $port);
$option = null;
$controls = array(
- array("oid" => "1.2.752.58.10.1", "iscritical" => true),
- array("oid" => "1.2.752.58.1.10", "value" => "magic"),
+ array("oid" => "1.2.752.58.10.1", "iscritical" => true),
+ array("oid" => "1.2.752.58.1.10", "value" => "magic"),
);
ldap_set_option($link, LDAP_OPT_DEREF, LDAP_DEREF_NEVER);
@@ -28,27 +28,26 @@ ldap_set_option($link, LDAP_OPT_CLIENT_CONTROLS, $controls);
ldap_set_option($link, LDAP_OPT_RESTART, false);
var_dump(
- ldap_get_option($link, LDAP_OPT_DEREF, $option),
- $option,
- ldap_get_option($link, LDAP_OPT_SIZELIMIT, $option),
- $option,
- ldap_get_option($link, LDAP_OPT_TIMELIMIT, $option),
- $option,
- ldap_get_option($link, LDAP_OPT_NETWORK_TIMEOUT, $option),
- $option,
- ldap_get_option($link, LDAP_OPT_TIMEOUT, $option),
- $option,
- ldap_get_option($link, LDAP_OPT_REFERRALS, $option),
- $option,
- ldap_get_option($link, LDAP_OPT_RESTART, $option),
- $option,
- ldap_get_option($link, LDAP_OPT_SERVER_CONTROLS, $option),
- $option,
- ldap_get_option($link, LDAP_OPT_CLIENT_CONTROLS, $option),
- $option
+ ldap_get_option($link, LDAP_OPT_DEREF, $option),
+ $option,
+ ldap_get_option($link, LDAP_OPT_SIZELIMIT, $option),
+ $option,
+ ldap_get_option($link, LDAP_OPT_TIMELIMIT, $option),
+ $option,
+ ldap_get_option($link, LDAP_OPT_NETWORK_TIMEOUT, $option),
+ $option,
+ ldap_get_option($link, LDAP_OPT_TIMEOUT, $option),
+ $option,
+ ldap_get_option($link, LDAP_OPT_REFERRALS, $option),
+ $option,
+ ldap_get_option($link, LDAP_OPT_RESTART, $option),
+ $option,
+ ldap_get_option($link, LDAP_OPT_SERVER_CONTROLS, $option),
+ $option,
+ ldap_get_option($link, LDAP_OPT_CLIENT_CONTROLS, $option),
+ $option
);
?>
-===DONE===
--EXPECT--
bool(true)
int(0)
@@ -106,4 +105,3 @@ array(2) {
string(5) "magic"
}
}
-===DONE===
diff --git a/ext/ldap/tests/ldap_get_values_len_basic.phpt b/ext/ldap/tests/ldap_get_values_len_basic.phpt
index 33084f48ab..eaf66c0fbc 100644
--- a/ext/ldap/tests/ldap_get_values_len_basic.phpt
+++ b/ext/ldap/tests/ldap_get_values_len_basic.phpt
@@ -15,10 +15,9 @@ insert_dummy_data($link, $base);
$result = ldap_search($link, "$base", "(o=test)");
$entry = ldap_first_entry($link, $result);
var_dump(
- ldap_get_values_len($link, $entry, "o")
+ ldap_get_values_len($link, $entry, "o")
);
?>
-===DONE===
--CLEAN--
<?php
include "connect.inc";
@@ -33,4 +32,3 @@ array(2) {
["count"]=>
int(1)
}
-===DONE===
diff --git a/ext/ldap/tests/ldap_get_values_len_error.phpt b/ext/ldap/tests/ldap_get_values_len_error.phpt
index 8bcaee070f..df1a380082 100644
--- a/ext/ldap/tests/ldap_get_values_len_error.phpt
+++ b/ext/ldap/tests/ldap_get_values_len_error.phpt
@@ -15,14 +15,8 @@ insert_dummy_data($link, $base);
$result = ldap_search($link, "$base", "(objectclass=organization)");
$entry = ldap_first_entry($link, $result);
-// Too few parameters
-var_dump(ldap_get_values_len($link));
-var_dump(ldap_get_values_len($link, $entry));
-var_dump(ldap_get_values_len($link, $entry, "weirdAttribute", "Additional data"));
-
var_dump(ldap_get_values_len($link, $entry, "inexistentAttribute"));
?>
-===DONE===
--CLEAN--
<?php
include "connect.inc";
@@ -31,15 +25,5 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
remove_dummy_data($link, $base);
?>
--EXPECTF--
-Warning: ldap_get_values_len() expects exactly 3 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_get_values_len() expects exactly 3 parameters, 2 given in %s on line %d
-NULL
-
-Warning: ldap_get_values_len() expects exactly 3 parameters, 4 given in %s on line %d
-NULL
-
Warning: ldap_get_values_len(): Cannot get the value(s) of attribute %s in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/ldap/tests/ldap_list_basic.phpt b/ext/ldap/tests/ldap_list_basic.phpt
index 1aadab6a17..f4d8bda31b 100644
--- a/ext/ldap/tests/ldap_list_basic.phpt
+++ b/ext/ldap/tests/ldap_list_basic.phpt
@@ -16,11 +16,10 @@ include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
insert_dummy_data($link, $base);
var_dump(
- $result = ldap_list($link, "$base", "(objectClass=person)"),
- ldap_get_entries($link, $result)
+ $result = ldap_list($link, "$base", "(objectClass=person)"),
+ ldap_get_entries($link, $result)
);
?>
-===DONE===
--CLEAN--
<?php
include "connect.inc";
@@ -147,4 +146,3 @@ array(3) {
string(%d) "cn=userB,%s"
}
}
-===DONE===
diff --git a/ext/ldap/tests/ldap_list_error.phpt b/ext/ldap/tests/ldap_list_error.phpt
deleted file mode 100644
index 817622e725..0000000000
--- a/ext/ldap/tests/ldap_list_error.phpt
+++ /dev/null
@@ -1,35 +0,0 @@
---TEST--
-ldap_list() - operation that should fail
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-include "connect.inc";
-
-$link = ldap_connect($host, $port);
-
-// Too few parameters
-var_dump(ldap_list());
-var_dump(ldap_list($link));
-var_dump(ldap_list($link, $link));
-
-// Too many parameters
-var_dump(ldap_list($link, "$base", "(objectClass=*)", array(), 0, 0, 0, 0, [], "Additional data"));
-?>
-===DONE===
---EXPECTF--
-Warning: ldap_list() expects at least 3 parameters, 0 given in %s on line %d
-NULL
-
-Warning: ldap_list() expects at least 3 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_list() expects at least 3 parameters, 2 given in %s on line %d
-NULL
-
-Warning: ldap_list() expects at most 9 parameters, 10 given in %s on line %d
-NULL
-===DONE===
diff --git a/ext/ldap/tests/ldap_mod_add_basic.phpt b/ext/ldap/tests/ldap_mod_add_basic.phpt
index a05a6a0418..9096f3eb63 100644
--- a/ext/ldap/tests/ldap_mod_add_basic.phpt
+++ b/ext/ldap/tests/ldap_mod_add_basic.phpt
@@ -14,18 +14,17 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
insert_dummy_data($link, $base);
$entry = array(
- "description" => "Domain description",
+ "description" => "Domain description",
);
var_dump(
- ldap_mod_add($link, "o=test,$base", $entry),
- ldap_get_entries(
- $link,
- ldap_search($link, "o=test,$base", "(Description=Domain description)")
- )
+ ldap_mod_add($link, "o=test,$base", $entry),
+ ldap_get_entries(
+ $link,
+ ldap_search($link, "o=test,$base", "(Description=Domain description)")
+ )
);
?>
-===DONE===
--CLEAN--
<?php
require "connect.inc";
@@ -76,4 +75,3 @@ array(2) {
string(%d) "o=test,%s"
}
}
-===DONE===
diff --git a/ext/ldap/tests/ldap_mod_add_error.phpt b/ext/ldap/tests/ldap_mod_add_error.phpt
index 4bfbaa5551..7dd26616dc 100644
--- a/ext/ldap/tests/ldap_mod_add_error.phpt
+++ b/ext/ldap/tests/ldap_mod_add_error.phpt
@@ -12,14 +12,6 @@ require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-// Too few parameters
-var_dump(ldap_mod_add());
-var_dump(ldap_mod_add($link));
-var_dump(ldap_mod_add($link, "$base"));
-
-// Too many parameters
-var_dump(ldap_mod_add($link, "$base", array(), [], "Additional data"));
-
// DN not found
var_dump(ldap_mod_add($link, "dc=my-domain,$base", array()));
@@ -27,12 +19,12 @@ var_dump(ldap_mod_add($link, "dc=my-domain,$base", array()));
var_dump(ldap_mod_add($link, "weirdAttribute=val", array()));
$entry = array(
- "objectClass" => array(
- "top",
- "dcObject",
- "organization"),
- "dc" => "my-domain",
- "o" => "my-domain",
+ "objectClass" => array(
+ "top",
+ "dcObject",
+ "organization"),
+ "dc" => "my-domain",
+ "o" => "my-domain",
);
ldap_add($link, "dc=my-domain,$base", $entry);
@@ -47,7 +39,6 @@ $entry2["weirdAttribute"] = "weirdVal";
var_dump(ldap_mod_add($link, "dc=my-domain,$base", $entry2));
?>
-===DONE===
--CLEAN--
<?php
require "connect.inc";
@@ -57,18 +48,6 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
ldap_delete($link, "dc=my-domain,$base");
?>
--EXPECTF--
-Warning: ldap_mod_add() expects at least 3 parameters, 0 given in %s on line %d
-NULL
-
-Warning: ldap_mod_add() expects at least 3 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_mod_add() expects at least 3 parameters, 2 given in %s on line %d
-NULL
-
-Warning: ldap_mod_add() expects at most 4 parameters, 5 given in %s on line %d
-NULL
-
Warning: ldap_mod_add(): Modify: No such object in %s on line %d
bool(false)
@@ -80,4 +59,3 @@ bool(false)
Warning: ldap_mod_add(): Modify: Undefined attribute type in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/ldap/tests/ldap_mod_del_basic.phpt b/ext/ldap/tests/ldap_mod_del_basic.phpt
index 788ac0adb3..bafc190968 100644
--- a/ext/ldap/tests/ldap_mod_del_basic.phpt
+++ b/ext/ldap/tests/ldap_mod_del_basic.phpt
@@ -14,18 +14,17 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
insert_dummy_data($link, $base);
$entry = array(
- "description" => "user A"
+ "description" => "user A"
);
var_dump(
- ldap_mod_del($link, "cn=userA,$base", $entry),
- ldap_get_entries(
- $link,
- ldap_search($link, "$base", "(description=user A)")
- )
+ ldap_mod_del($link, "cn=userA,$base", $entry),
+ ldap_get_entries(
+ $link,
+ ldap_search($link, "$base", "(description=user A)")
+ )
);
?>
-===DONE===
--CLEAN--
<?php
require "connect.inc";
@@ -40,4 +39,3 @@ array(1) {
["count"]=>
int(0)
}
-===DONE===
diff --git a/ext/ldap/tests/ldap_mod_del_error.phpt b/ext/ldap/tests/ldap_mod_del_error.phpt
index 129d6472c1..6df125c1b7 100644
--- a/ext/ldap/tests/ldap_mod_del_error.phpt
+++ b/ext/ldap/tests/ldap_mod_del_error.phpt
@@ -12,14 +12,6 @@ require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-// Too few parameters
-var_dump(ldap_mod_del());
-var_dump(ldap_mod_del($link));
-var_dump(ldap_mod_del($link, "$base"));
-
-// Too many parameters
-var_dump(ldap_mod_del($link, "$base", array(), [], "Additional data"));
-
// DN not found
var_dump(ldap_mod_del($link, "dc=my-domain,$base", array()));
@@ -29,7 +21,6 @@ var_dump(ldap_mod_del($link, "weirdAttribute=val", array()));
// Invalid attributes
var_dump(ldap_mod_del($link, "$base", array('dc')));
?>
-===DONE===
--CLEAN--
<?php
require "connect.inc";
@@ -39,18 +30,6 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
ldap_delete($link, "dc=my-domain,$base");
?>
--EXPECTF--
-Warning: ldap_mod_del() expects at least 3 parameters, 0 given in %s on line %d
-NULL
-
-Warning: ldap_mod_del() expects at least 3 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_mod_del() expects at least 3 parameters, 2 given in %s on line %d
-NULL
-
-Warning: ldap_mod_del() expects at most 4 parameters, 5 given in %s on line %d
-NULL
-
Warning: ldap_mod_del(): Modify: No such object in %s on line %d
bool(false)
@@ -59,4 +38,3 @@ bool(false)
Warning: ldap_mod_del(): Unknown attribute in the data in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/ldap/tests/ldap_mod_ext.phpt b/ext/ldap/tests/ldap_mod_ext.phpt
index 391ecbf909..0ca091fed8 100644
--- a/ext/ldap/tests/ldap_mod_ext.phpt
+++ b/ext/ldap/tests/ldap_mod_ext.phpt
@@ -19,41 +19,40 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
insert_dummy_data($link, $base);
$entry = array(
- "description" => "Domain description",
+ "description" => "Domain description",
);
var_dump(
- $result = ldap_mod_add_ext($link, "o=test,$base", $entry,
- [
- ['oid' => LDAP_CONTROL_PRE_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['description']]],
- ['oid' => LDAP_CONTROL_POST_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['description']]],
- ]
- ),
- ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls),
- $errcode,
- $errmsg,
- $ctrls,
- ldap_get_entries(
- $link,
- ldap_search($link, "o=test,$base", "(Description=Domain description)")
- ),
- $result = ldap_mod_del_ext($link, "o=test,$base", $entry,
- [
- ['oid' => LDAP_CONTROL_PRE_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['description']]],
- ['oid' => LDAP_CONTROL_POST_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['description']]],
- ]
- ),
- ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls),
- $errcode,
- $errmsg,
- $ctrls,
- ldap_get_entries(
- $link,
- ldap_search($link, "o=test,$base", "(Description=Domain description)")
- )
+ $result = ldap_mod_add_ext($link, "o=test,$base", $entry,
+ [
+ ['oid' => LDAP_CONTROL_PRE_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['description']]],
+ ['oid' => LDAP_CONTROL_POST_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['description']]],
+ ]
+ ),
+ ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls),
+ $errcode,
+ $errmsg,
+ $ctrls,
+ ldap_get_entries(
+ $link,
+ ldap_search($link, "o=test,$base", "(Description=Domain description)")
+ ),
+ $result = ldap_mod_del_ext($link, "o=test,$base", $entry,
+ [
+ ['oid' => LDAP_CONTROL_PRE_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['description']]],
+ ['oid' => LDAP_CONTROL_POST_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['description']]],
+ ]
+ ),
+ ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls),
+ $errcode,
+ $errmsg,
+ $ctrls,
+ ldap_get_entries(
+ $link,
+ ldap_search($link, "o=test,$base", "(Description=Domain description)")
+ )
);
?>
-===DONE===
--CLEAN--
<?php
require "connect.inc";
@@ -169,4 +168,3 @@ array(1) {
["count"]=>
int(0)
}
-===DONE===
diff --git a/ext/ldap/tests/ldap_mod_replace_basic.phpt b/ext/ldap/tests/ldap_mod_replace_basic.phpt
index 8e9fd4dcad..0dd9f2b1ea 100644
--- a/ext/ldap/tests/ldap_mod_replace_basic.phpt
+++ b/ext/ldap/tests/ldap_mod_replace_basic.phpt
@@ -14,18 +14,17 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
insert_dummy_data($link, $base);
$entry = array(
- "description" => "user X"
+ "description" => "user X"
);
var_dump(
- ldap_mod_replace($link, "cn=userA,$base", $entry),
- ldap_get_entries(
- $link,
- ldap_search($link, "$base", "(description=user X)", array("description"))
- )
+ ldap_mod_replace($link, "cn=userA,$base", $entry),
+ ldap_get_entries(
+ $link,
+ ldap_search($link, "$base", "(description=user X)", array("description"))
+ )
);
?>
-===DONE===
--CLEAN--
<?php
require "connect.inc";
@@ -56,4 +55,3 @@ array(2) {
string(%d) "cn=userA,%s"
}
}
-===DONE===
diff --git a/ext/ldap/tests/ldap_mod_replace_error.phpt b/ext/ldap/tests/ldap_mod_replace_error.phpt
index 4f435b13d2..6a12107651 100644
--- a/ext/ldap/tests/ldap_mod_replace_error.phpt
+++ b/ext/ldap/tests/ldap_mod_replace_error.phpt
@@ -12,14 +12,6 @@ require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-// Too few parameters
-var_dump(ldap_mod_replace());
-var_dump(ldap_mod_replace($link));
-var_dump(ldap_mod_replace($link, "$base"));
-
-// Too many parameters
-var_dump(ldap_mod_replace($link, "$base", array(), [], "Additional data"));
-
// DN not found
var_dump(ldap_mod_replace($link, "dc=my-domain,$base", array()));
@@ -29,7 +21,6 @@ var_dump(ldap_mod_replace($link, "weirdAttribute=val", array()));
// Invalid attributes
var_dump(ldap_mod_replace($link, "$base", array('dc')));
?>
-===DONE===
--CLEAN--
<?php
require "connect.inc";
@@ -37,18 +28,6 @@ require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
?>
--EXPECTF--
-Warning: ldap_mod_replace() expects at least 3 parameters, 0 given in %s on line %d
-NULL
-
-Warning: ldap_mod_replace() expects at least 3 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_mod_replace() expects at least 3 parameters, 2 given in %s on line %d
-NULL
-
-Warning: ldap_mod_replace() expects at most 4 parameters, 5 given in %s on line %d
-NULL
-
Warning: ldap_mod_replace(): Modify: No such object in %s on line %d
bool(false)
@@ -57,4 +36,3 @@ bool(false)
Warning: ldap_mod_replace(): Unknown attribute in the data in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/ldap/tests/ldap_modify_basic.phpt b/ext/ldap/tests/ldap_modify_basic.phpt
index 2f6a51af4d..2589953147 100644
--- a/ext/ldap/tests/ldap_modify_basic.phpt
+++ b/ext/ldap/tests/ldap_modify_basic.phpt
@@ -14,22 +14,21 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
insert_dummy_data($link, $base);
$entry = array(
- "objectClass" => array(
- "top",
- "organization"),
- "o" => "test",
- "description" => "Domain description",
+ "objectClass" => array(
+ "top",
+ "organization"),
+ "o" => "test",
+ "description" => "Domain description",
);
var_dump(
- ldap_modify($link, "o=test,$base", $entry),
- ldap_get_entries(
- $link,
- ldap_search($link, "$base", "(Description=Domain description)")
- )
+ ldap_modify($link, "o=test,$base", $entry),
+ ldap_get_entries(
+ $link,
+ ldap_search($link, "$base", "(Description=Domain description)")
+ )
);
?>
-===DONE===
--CLEAN--
<?php
require "connect.inc";
@@ -80,4 +79,3 @@ array(2) {
string(%d) "o=test,%s"
}
}
-===DONE===
diff --git a/ext/ldap/tests/ldap_modify_batch_basic.phpt b/ext/ldap/tests/ldap_modify_batch_basic.phpt
index 0bec0e03c4..41d7c0f15f 100644
--- a/ext/ldap/tests/ldap_modify_batch_basic.phpt
+++ b/ext/ldap/tests/ldap_modify_batch_basic.phpt
@@ -14,30 +14,29 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
insert_dummy_data($link, $base);
$mods = array(
- array(
- "attrib" => "telephoneNumber",
- "modtype" => LDAP_MODIFY_BATCH_ADD,
- "values" => array(
- "+1 555 5551717"
- )
- ),
- array(
- "attrib" => "sn",
- "modtype" => LDAP_MODIFY_BATCH_REPLACE,
- "values" => array("Brown-Smith")
- ),
- array(
- "attrib" => "description",
- "modtype" => LDAP_MODIFY_BATCH_REMOVE_ALL
- )
+ array(
+ "attrib" => "telephoneNumber",
+ "modtype" => LDAP_MODIFY_BATCH_ADD,
+ "values" => array(
+ "+1 555 5551717"
+ )
+ ),
+ array(
+ "attrib" => "sn",
+ "modtype" => LDAP_MODIFY_BATCH_REPLACE,
+ "values" => array("Brown-Smith")
+ ),
+ array(
+ "attrib" => "description",
+ "modtype" => LDAP_MODIFY_BATCH_REMOVE_ALL
+ )
);
var_dump(
- ldap_modify_batch($link, "cn=userA,$base", $mods),
- ldap_get_entries($link, ldap_search($link, "$base", "(sn=Brown-Smith)"))
+ ldap_modify_batch($link, "cn=userA,$base", $mods),
+ ldap_get_entries($link, ldap_search($link, "$base", "(sn=Brown-Smith)"))
);
?>
-===DONE===
--CLEAN--
<?php
require "connect.inc";
@@ -106,4 +105,3 @@ array(2) {
string(%d) "cn=userA,%s"
}
}
-===DONE===
diff --git a/ext/ldap/tests/ldap_modify_batch_error.phpt b/ext/ldap/tests/ldap_modify_batch_error.phpt
index a2d9ef9deb..627d116d97 100644
--- a/ext/ldap/tests/ldap_modify_batch_error.phpt
+++ b/ext/ldap/tests/ldap_modify_batch_error.phpt
@@ -13,21 +13,13 @@ require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
$addGivenName = array(
- array(
- "attrib" => "givenName",
- "modtype" => LDAP_MODIFY_BATCH_ADD,
- "values" => array("Jack")
- )
+ array(
+ "attrib" => "givenName",
+ "modtype" => LDAP_MODIFY_BATCH_ADD,
+ "values" => array("Jack")
+ )
);
-// Too few parameters
-var_dump(ldap_modify_batch());
-var_dump(ldap_modify_batch($link));
-var_dump(ldap_modify_batch($link, "$base"));
-
-// Too many parameters
-var_dump(ldap_modify_batch($link, "$base", $addGivenName, [], "Invalid additional parameter"));
-
// DN not found
var_dump(ldap_modify_batch($link, "cn=not-found,$base", $addGivenName));
@@ -36,39 +28,38 @@ var_dump(ldap_modify_batch($link, "weirdAttribute=val", $addGivenName));
// prepare
$entry = array(
- "objectClass" => array(
- "top",
- "dcObject",
- "organization"),
- "dc" => "my-domain",
- "o" => "my-domain",
+ "objectClass" => array(
+ "top",
+ "dcObject",
+ "organization"),
+ "dc" => "my-domain",
+ "o" => "my-domain",
);
ldap_add($link, "dc=my-domain,$base", $entry);
// invalid domain
$mods = array(
- array(
- "attrib" => "dc",
- "modtype" => LDAP_MODIFY_BATCH_REPLACE,
- "values" => array("Wrong Domain")
- )
+ array(
+ "attrib" => "dc",
+ "modtype" => LDAP_MODIFY_BATCH_REPLACE,
+ "values" => array("Wrong Domain")
+ )
);
var_dump(ldap_modify_batch($link, "dc=my-domain,$base", $mods));
// invalid attribute
$mods = array(
- array(
- "attrib" => "weirdAttribute",
- "modtype" => LDAP_MODIFY_BATCH_ADD,
- "values" => array("weirdVal", "anotherWeirdval")
- )
+ array(
+ "attrib" => "weirdAttribute",
+ "modtype" => LDAP_MODIFY_BATCH_ADD,
+ "values" => array("weirdVal", "anotherWeirdval")
+ )
);
var_dump(ldap_modify_batch($link, "dc=my-domain,$base", $mods));
?>
-===DONE===
--CLEAN--
<?php
require "connect.inc";
@@ -78,18 +69,6 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
ldap_delete($link, "dc=my-domain,$base");
?>
--EXPECTF--
-Warning: ldap_modify_batch() expects at least 3 parameters, 0 given in %s on line %d
-NULL
-
-Warning: ldap_modify_batch() expects at least 3 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_modify_batch() expects at least 3 parameters, 2 given in %s on line %d
-NULL
-
-Warning: ldap_modify_batch() expects at most 4 parameters, 5 given in %s on line %d
-NULL
-
Warning: ldap_modify_batch(): Batch Modify: No such object in %s on line %d
bool(false)
@@ -101,4 +80,3 @@ bool(false)
Warning: ldap_modify_batch(): Batch Modify: Undefined attribute type in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/ldap/tests/ldap_modify_error.phpt b/ext/ldap/tests/ldap_modify_error.phpt
index 31069bb98c..682abf7504 100644
--- a/ext/ldap/tests/ldap_modify_error.phpt
+++ b/ext/ldap/tests/ldap_modify_error.phpt
@@ -12,14 +12,6 @@ require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-// Too few parameters
-var_dump(ldap_modify());
-var_dump(ldap_modify($link));
-var_dump(ldap_modify($link, "$base"));
-
-// Too many parameters
-var_dump(ldap_modify($link, "$base", array(), [], "Additional data"));
-
// DN not found
var_dump(ldap_modify($link, "cn=not-found,$base", array()));
@@ -27,12 +19,12 @@ var_dump(ldap_modify($link, "cn=not-found,$base", array()));
var_dump(ldap_modify($link, "weirdAttribute=val", array()));
$entry = array(
- "objectClass" => array(
- "top",
- "dcObject",
- "organization"),
- "dc" => "my-domain",
- "o" => "my-domain",
+ "objectClass" => array(
+ "top",
+ "dcObject",
+ "organization"),
+ "dc" => "my-domain",
+ "o" => "my-domain",
);
ldap_add($link, "dc=my-domain,$base", $entry);
@@ -47,7 +39,6 @@ $entry2["weirdAttribute"] = "weirdVal";
var_dump(ldap_modify($link, "dc=my-domain,$base", $entry2));
?>
-===DONE===
--CLEAN--
<?php
require "connect.inc";
@@ -57,18 +48,6 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
ldap_delete($link, "dc=my-domain,$base");
?>
--EXPECTF--
-Warning: ldap_modify() expects at least 3 parameters, 0 given in %s on line %d
-NULL
-
-Warning: ldap_modify() expects at least 3 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_modify() expects at least 3 parameters, 2 given in %s on line %d
-NULL
-
-Warning: ldap_modify() expects at most 4 parameters, 5 given in %s on line %d
-NULL
-
Warning: ldap_modify(): Modify: No such object in %s on line %d
bool(false)
@@ -80,4 +59,3 @@ bool(false)
Warning: ldap_modify(): Modify: Undefined attribute type in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/ldap/tests/ldap_next_attribute_basic.phpt b/ext/ldap/tests/ldap_next_attribute_basic.phpt
index 1acc0e1ad1..4c9584ee0b 100644
--- a/ext/ldap/tests/ldap_next_attribute_basic.phpt
+++ b/ext/ldap/tests/ldap_next_attribute_basic.phpt
@@ -16,13 +16,12 @@ $result = ldap_search($link, "$base", "(cn=userC)");
$entry = ldap_first_entry($link, $result);
$attribute = ldap_first_attribute($link, $entry);
var_dump(
- ldap_next_attribute($link, $entry),
- ldap_next_attribute($link, $entry),
- ldap_next_attribute($link, $entry),
- ldap_next_attribute($link, $entry)
+ ldap_next_attribute($link, $entry),
+ ldap_next_attribute($link, $entry),
+ ldap_next_attribute($link, $entry),
+ ldap_next_attribute($link, $entry)
);
?>
-===DONE===
--CLEAN--
<?php
include "connect.inc";
@@ -35,4 +34,3 @@ string(%d) "%s"
string(%d) "%s"
string(%d) "%s"
bool(false)
-===DONE===
diff --git a/ext/ldap/tests/ldap_next_attribute_error.phpt b/ext/ldap/tests/ldap_next_attribute_error.phpt
index 0bedf8c33f..ffe1222626 100644
--- a/ext/ldap/tests/ldap_next_attribute_error.phpt
+++ b/ext/ldap/tests/ldap_next_attribute_error.phpt
@@ -15,12 +15,9 @@ insert_dummy_data($link, $base);
$result = ldap_search($link, "$base", "(objectclass=organization)");
$entry = ldap_first_entry($link, $result);
var_dump(
- ldap_next_attribute($link),
- ldap_next_attribute($link, $link),
- ldap_next_attribute($link, $entry)
+ ldap_next_attribute($link, $entry)
);
?>
-===DONE===
--CLEAN--
<?php
include "connect.inc";
@@ -29,12 +26,5 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
remove_dummy_data($link, $base);
?>
--EXPECTF--
-Warning: ldap_next_attribute() expects %s 2 parameters, 1 given in %s on line %d
-
-Warning: ldap_next_attribute(): supplied resource is not a valid ldap result entry resource in %s on line %d
-
-Warning: ldap_next_attribute(): called before calling ldap_first_attribute() or no attributes found in result entry in %s on line %d
-NULL
-bool(false)
+Warning: ldap_next_attribute(): Called before calling ldap_first_attribute() or no attributes found in result entry in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/ldap/tests/ldap_next_entry_basic.phpt b/ext/ldap/tests/ldap_next_entry_basic.phpt
index dd43715239..d8f03ce291 100644
--- a/ext/ldap/tests/ldap_next_entry_basic.phpt
+++ b/ext/ldap/tests/ldap_next_entry_basic.phpt
@@ -15,12 +15,11 @@ insert_dummy_data($link, $base);
$result = ldap_list($link, "$base", "(objectClass=person)");
$entry = ldap_first_entry($link, $result);
var_dump(
- $entry = ldap_next_entry($link, $entry),
- ldap_get_values($link, $entry, 'sn'),
- $entry = ldap_next_entry($link, $entry)
+ $entry = ldap_next_entry($link, $entry),
+ ldap_get_values($link, $entry, 'sn'),
+ $entry = ldap_next_entry($link, $entry)
);
?>
-===DONE===
--CLEAN--
<?php
include "connect.inc";
@@ -37,4 +36,3 @@ array(2) {
int(1)
}
bool(false)
-===DONE===
diff --git a/ext/ldap/tests/ldap_next_entry_error.phpt b/ext/ldap/tests/ldap_next_entry_error.phpt
deleted file mode 100644
index 59e9cdcab5..0000000000
--- a/ext/ldap/tests/ldap_next_entry_error.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-ldap_next_entry() - Testing ldap_next_entry() that should fail
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-require "connect.inc";
-
-$link = ldap_connect($host, $port);
-var_dump(ldap_next_entry($link));
-var_dump(ldap_next_entry($link, $link, "Additional data"));
-var_dump(ldap_next_entry($link, $link));
-?>
-===DONE===
---EXPECTF--
-Warning: ldap_next_entry() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_next_entry() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-Warning: ldap_next_entry(): supplied resource is not a valid ldap result entry resource in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/ldap/tests/ldap_next_reference_basic.phpt b/ext/ldap/tests/ldap_next_reference_basic.phpt
index 2476e02c57..7af26ff91c 100644
--- a/ext/ldap/tests/ldap_next_reference_basic.phpt
+++ b/ext/ldap/tests/ldap_next_reference_basic.phpt
@@ -28,7 +28,6 @@ var_dump($ref2 = ldap_next_reference($link, $ref));
ldap_parse_reference($link, $ref2, $refs);
var_dump($refs);
?>
-===DONE===
--CLEAN--
<?php
include "connect.inc";
@@ -45,4 +44,3 @@ array(1) {
[0]=>
string(%d) "cn=userB,%s"
}
-===DONE===
diff --git a/ext/ldap/tests/ldap_next_reference_error.phpt b/ext/ldap/tests/ldap_next_reference_error.phpt
deleted file mode 100644
index 0e47c5ef5c..0000000000
--- a/ext/ldap/tests/ldap_next_reference_error.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-ldap_next_reference() - Testing ldap_next_reference() that should fail
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-require "connect.inc";
-
-$link = ldap_connect($host, $port);
-var_dump(ldap_next_reference($link));
-var_dump(ldap_next_reference($link, $link, "Additional data"));
-var_dump(ldap_next_reference($link, $link));
-?>
-===DONE===
---EXPECTF--
-Warning: ldap_next_reference() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_next_reference() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-Warning: ldap_next_reference(): supplied resource is not a valid ldap result entry resource in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/ldap/tests/ldap_option_reqcert_basic.phpt b/ext/ldap/tests/ldap_option_reqcert_basic.phpt
index 04ced6ecbe..e774a0e03f 100644
--- a/ext/ldap/tests/ldap_option_reqcert_basic.phpt
+++ b/ext/ldap/tests/ldap_option_reqcert_basic.phpt
@@ -18,7 +18,5 @@ ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version);
var_dump(@ldap_bind($link, $user, $passwd));
?>
-===DONE===
--EXPECT--
bool(true)
-===DONE===
diff --git a/ext/ldap/tests/ldap_option_reqcert_error.phpt b/ext/ldap/tests/ldap_option_reqcert_error.phpt
index 477c4aba39..50e542a080 100644
--- a/ext/ldap/tests/ldap_option_reqcert_error.phpt
+++ b/ext/ldap/tests/ldap_option_reqcert_error.phpt
@@ -1,5 +1,5 @@
--TEST--
-ldap_option_reqcert_error() - A test to check if ldap cant connect to a LDAP server with a invalid certificate with certificate checking enabled
+ldap_option_reqcert_error() - A test to check if ldap can't connect to a LDAP server with a invalid certificate with certificate checking enabled
--CREDITS--
Edwin Hoksberg <edwin@edwinhoksberg.nl>
--SKIPIF--
@@ -18,7 +18,5 @@ ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version);
var_dump(@ldap_bind($link, $user, $passwd));
?>
-===DONE===
--EXPECT--
bool(true)
-===DONE===
diff --git a/ext/ldap/tests/ldap_parse_reference_basic.phpt b/ext/ldap/tests/ldap_parse_reference_basic.phpt
index 249f2959f3..d5aeef8a59 100644
--- a/ext/ldap/tests/ldap_parse_reference_basic.phpt
+++ b/ext/ldap/tests/ldap_parse_reference_basic.phpt
@@ -21,11 +21,10 @@ $result = ldap_search($link, "$base", "(cn=*)");
$ref = ldap_first_reference($link, $result);
$refs = null;
var_dump(
- ldap_parse_reference($link, $ref, $refs),
- $refs
+ ldap_parse_reference($link, $ref, $refs),
+ $refs
);
?>
-===DONE===
--CLEAN--
<?php
include "connect.inc";
@@ -42,4 +41,3 @@ array(1) {
[0]=>
string(%d) "cn=userA,%s"
}
-===DONE===
diff --git a/ext/ldap/tests/ldap_parse_reference_error.phpt b/ext/ldap/tests/ldap_parse_reference_error.phpt
deleted file mode 100644
index 9d180e717d..0000000000
--- a/ext/ldap/tests/ldap_parse_reference_error.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-ldap_parse_reference() - ldap_parse_reference() operations that should fail
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-require "connect.inc";
-$link = ldap_connect($host, $port);
-$refs = null;
-var_dump(
- ldap_parse_reference($link, $link),
- ldap_parse_reference($link, $link, $refs),
- ldap_parse_reference($link, $refs, $refs, "Additional data"),
- $refs
-);
-?>
-===DONE===
---EXPECTF--
-Warning: ldap_parse_reference() expects exactly 3 parameters, 2 given in %s on line %d
-
-Warning: ldap_parse_reference(): supplied resource is not a valid ldap result entry resource in %s on line %d
-
-Warning: ldap_parse_reference() expects exactly 3 parameters, 4 given in %s on line %d
-NULL
-bool(false)
-NULL
-NULL
-===DONE===
diff --git a/ext/ldap/tests/ldap_parse_result_basic.phpt b/ext/ldap/tests/ldap_parse_result_basic.phpt
index e2a975d5b1..ed7047164b 100644
--- a/ext/ldap/tests/ldap_parse_result_basic.phpt
+++ b/ext/ldap/tests/ldap_parse_result_basic.phpt
@@ -20,11 +20,10 @@ ldap_add($link, "cn=userref,$base", array(
$result = ldap_search($link, "cn=userref,$base", "(cn=user*)");
$errcode = $dn = $errmsg = $refs = null;
var_dump(
- ldap_parse_result($link, $result, $errcode, $dn, $errmsg, $refs),
- $errcode, $dn, $errmsg, $refs
+ ldap_parse_result($link, $result, $errcode, $dn, $errmsg, $refs),
+ $errcode, $dn, $errmsg, $refs
);
?>
-===DONE===
--CLEAN--
<?php
include "connect.inc";
@@ -43,4 +42,3 @@ array(1) {
[0]=>
string(%d) "cn=userA,%s"
}
-===DONE===
diff --git a/ext/ldap/tests/ldap_parse_result_controls.phpt b/ext/ldap/tests/ldap_parse_result_controls.phpt
index 8ce2328d2f..63ef9e69d7 100644
--- a/ext/ldap/tests/ldap_parse_result_controls.phpt
+++ b/ext/ldap/tests/ldap_parse_result_controls.phpt
@@ -19,16 +19,15 @@ insert_dummy_data($link, $base);
$dn = "$base";
$filter = "(cn=user*)";
var_dump(
- ldap_control_paged_result($link, 1),
- $result = ldap_search($link, $dn, $filter, array('cn')),
- ldap_parse_result($link, $result, $errcode, $dn, $errmsg, $refs, $ctrls),
- $ctrls[LDAP_CONTROL_PAGEDRESULTS]['oid'],
- $ctrls[LDAP_CONTROL_PAGEDRESULTS]['value']['size'],
- bin2hex($ctrls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie']),
- ldap_get_entries($link, $result)['count']
+ ldap_control_paged_result($link, 1),
+ $result = ldap_search($link, $dn, $filter, array('cn')),
+ ldap_parse_result($link, $result, $errcode, $dn, $errmsg, $refs, $ctrls),
+ $ctrls[LDAP_CONTROL_PAGEDRESULTS]['oid'],
+ $ctrls[LDAP_CONTROL_PAGEDRESULTS]['value']['size'],
+ bin2hex($ctrls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie']),
+ ldap_get_entries($link, $result)['count']
);
?>
-===DONE===
--CLEAN--
<?php
include "connect.inc";
@@ -45,4 +44,3 @@ string(22) "1.2.840.113556.1.4.319"
int(%d)
string(%d) "%s"
int(1)
-===DONE===
diff --git a/ext/ldap/tests/ldap_parse_result_error.phpt b/ext/ldap/tests/ldap_parse_result_error.phpt
deleted file mode 100644
index 33f86f40b9..0000000000
--- a/ext/ldap/tests/ldap_parse_result_error.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-ldap_parse_result() - Testing ldap_parse_result() that should fail
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-require "connect.inc";
-var_dump(ldap_parse_result(null, null));
-?>
-===DONE===
---EXPECTF--
-Warning: ldap_parse_result() expects at least 3 parameters, 2 given in %s on line %d
-NULL
-===DONE===
diff --git a/ext/ldap/tests/ldap_read_basic.phpt b/ext/ldap/tests/ldap_read_basic.phpt
index 5a6e7ed057..596c02a71e 100644
--- a/ext/ldap/tests/ldap_read_basic.phpt
+++ b/ext/ldap/tests/ldap_read_basic.phpt
@@ -16,11 +16,10 @@ include "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
insert_dummy_data($link, $base);
var_dump(
- $result = ldap_read($link, "o=test,$base", "(o=*)"),
- ldap_get_entries($link, $result)
+ $result = ldap_read($link, "o=test,$base", "(o=*)"),
+ ldap_get_entries($link, $result)
);
?>
-===DONE===
--CLEAN--
<?php
include "connect.inc";
@@ -61,4 +60,3 @@ array(2) {
string(%d) "o=test,%s"
}
}
-===DONE===
diff --git a/ext/ldap/tests/ldap_read_error.phpt b/ext/ldap/tests/ldap_read_error.phpt
deleted file mode 100644
index 08f6280490..0000000000
--- a/ext/ldap/tests/ldap_read_error.phpt
+++ /dev/null
@@ -1,35 +0,0 @@
---TEST--
-ldap_read() - operation that should fail
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-include "connect.inc";
-
-$link = ldap_connect($host, $port);
-
-// Too few parameters
-var_dump(ldap_read());
-var_dump(ldap_read($link));
-var_dump(ldap_read($link, $link));
-
-// Too many parameters
-var_dump(ldap_read($link, "$base", "(objectClass=*)", array(), 0, 0, 0, 0, [], "Additional data"));
-?>
-===DONE===
---EXPECTF--
-Warning: ldap_read() expects at least 3 parameters, 0 given in %s on line %d
-NULL
-
-Warning: ldap_read() expects at least 3 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_read() expects at least 3 parameters, 2 given in %s on line %d
-NULL
-
-Warning: ldap_read() expects at most 9 parameters, 10 given in %s on line %d
-NULL
-===DONE===
diff --git a/ext/ldap/tests/ldap_read_variation1.phpt b/ext/ldap/tests/ldap_read_variation1.phpt
index 5d65814ec0..d5c731870c 100644
--- a/ext/ldap/tests/ldap_read_variation1.phpt
+++ b/ext/ldap/tests/ldap_read_variation1.phpt
@@ -7,7 +7,9 @@ if (!extension_loaded('ldap')) die('skip ldap extension not available');
--FILE--
<?php
$array = [123, 456, 789];
-@ldap_read(null, null, null, $array);
+try {
+ ldap_read(null, null, null, $array);
+} catch (TypeError $err) {}
var_dump($array);
?>
--EXPECT--
diff --git a/ext/ldap/tests/ldap_rename_basic.phpt b/ext/ldap/tests/ldap_rename_basic.phpt
index c01c4318a6..f985630ac6 100644
--- a/ext/ldap/tests/ldap_rename_basic.phpt
+++ b/ext/ldap/tests/ldap_rename_basic.phpt
@@ -13,13 +13,12 @@ require "connect.inc";
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
insert_dummy_data($link, $base);
var_dump(
- ldap_rename($link, "cn=userA,$base", "cn=userZ", "$base", true)
+ ldap_rename($link, "cn=userA,$base", "cn=userZ", "$base", true)
);
$result = ldap_search($link, "$base", "(cn=userA)", array("cn", "sn"));
$result = ldap_search($link, "$base", "(cn=userZ)", array("cn", "sn"));
var_dump(ldap_get_entries($link, $result));
?>
-===DONE===
--CLEAN--
<?php
include "connect.inc";
@@ -59,4 +58,3 @@ array(2) {
string(%d) "cn=userZ,%s"
}
}
-===DONE===
diff --git a/ext/ldap/tests/ldap_rename_error.phpt b/ext/ldap/tests/ldap_rename_error.phpt
index 8a580e5c34..57c2e03e71 100644
--- a/ext/ldap/tests/ldap_rename_error.phpt
+++ b/ext/ldap/tests/ldap_rename_error.phpt
@@ -10,12 +10,7 @@ Patrick Allaert <patrickallaert@php.net>
require "connect.inc";
$link = ldap_connect($host, $port);
-var_dump(ldap_rename($link));
var_dump(ldap_rename($link, "cn=userNotFound,$base", "cn=userZ", "$base", true));
?>
-===DONE===
---EXPECTF--
-Warning: ldap_rename() expects at least 5 parameters, 1 given in %s on line %d
-NULL
+--EXPECT--
bool(false)
-===DONE===
diff --git a/ext/ldap/tests/ldap_rename_ext.phpt b/ext/ldap/tests/ldap_rename_ext.phpt
index bee180b6f7..e4f7d8364e 100644
--- a/ext/ldap/tests/ldap_rename_ext.phpt
+++ b/ext/ldap/tests/ldap_rename_ext.phpt
@@ -18,22 +18,21 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
insert_dummy_data($link, $base);
var_dump(
- $result = ldap_rename_ext($link, "cn=userA,$base", "cn=userZ", "$base", TRUE,
- [
- ['oid' => LDAP_CONTROL_PRE_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['cn']]],
- ['oid' => LDAP_CONTROL_POST_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['cn']]]
- ]
- ),
- ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls),
- $errcode,
- $errmsg,
- $ctrls[LDAP_CONTROL_PRE_READ],
- $ctrls[LDAP_CONTROL_POST_READ],
- ldap_count_entries($link, ldap_search($link, "$base", "(cn=userA)", array("cn"))),
- ldap_count_entries($link, ldap_search($link, "$base", "(cn=userZ)", array("cn")))
+ $result = ldap_rename_ext($link, "cn=userA,$base", "cn=userZ", "$base", TRUE,
+ [
+ ['oid' => LDAP_CONTROL_PRE_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['cn']]],
+ ['oid' => LDAP_CONTROL_POST_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['cn']]]
+ ]
+ ),
+ ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls),
+ $errcode,
+ $errmsg,
+ $ctrls[LDAP_CONTROL_PRE_READ],
+ $ctrls[LDAP_CONTROL_POST_READ],
+ ldap_count_entries($link, ldap_search($link, "$base", "(cn=userA)", array("cn"))),
+ ldap_count_entries($link, ldap_search($link, "$base", "(cn=userZ)", array("cn")))
);
?>
-===DONE===
--CLEAN--
<?php
require "connect.inc";
@@ -77,4 +76,3 @@ array(2) {
}
int(0)
int(1)
-===DONE===
diff --git a/ext/ldap/tests/ldap_sasl_bind_basic.phpt b/ext/ldap/tests/ldap_sasl_bind_basic.phpt
index 49c2f24a67..d447572e09 100644
--- a/ext/ldap/tests/ldap_sasl_bind_basic.phpt
+++ b/ext/ldap/tests/ldap_sasl_bind_basic.phpt
@@ -21,7 +21,5 @@ $link = ldap_connect($host, $port);
ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version);
var_dump(ldap_sasl_bind($link, null, $passwd, 'DIGEST-MD5', 'realm', $sasl_user));
?>
-===DONE===
--EXPECT--
bool(true)
-===DONE===
diff --git a/ext/ldap/tests/ldap_sasl_bind_error.phpt b/ext/ldap/tests/ldap_sasl_bind_error.phpt
index 180066bb2c..eb68370ff6 100644
--- a/ext/ldap/tests/ldap_sasl_bind_error.phpt
+++ b/ext/ldap/tests/ldap_sasl_bind_error.phpt
@@ -14,9 +14,6 @@ require "connect.inc";
$link = ldap_connect($host, $port);
ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version);
-// Invalid parameter count
-var_dump(ldap_sasl_bind());
-
// Invalid DN
var_dump(ldap_sasl_bind($link, "Invalid DN", $passwd, 'DIGEST-MD5', 'realm', $sasl_user));
@@ -31,11 +28,7 @@ var_dump(ldap_sasl_bind($link, null, $passwd, 'DIGEST-MD5', "realm", "Manager",
// Invalid DN syntax
var_dump(ldap_sasl_bind($link, "unexistingProperty=weirdValue,$user", $passwd));
?>
-===DONE===
--EXPECTF--
-Warning: ldap_sasl_bind() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
-
Warning: ldap_sasl_bind(): Unable to bind to server: Invalid DN syntax in %s on line %d
bool(false)
@@ -50,4 +43,3 @@ bool(false)
Warning: ldap_sasl_bind(): Unable to bind to server: Invalid DN syntax in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/ldap/tests/ldap_search_basic.phpt b/ext/ldap/tests/ldap_search_basic.phpt
index 618366b1a1..f7ed449c16 100644
--- a/ext/ldap/tests/ldap_search_basic.phpt
+++ b/ext/ldap/tests/ldap_search_basic.phpt
@@ -17,11 +17,10 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
insert_dummy_data($link, $base);
var_dump(
- $result = ldap_search($link, "$base", "(objectClass=person)"),
- ldap_get_entries($link, $result)
+ $result = ldap_search($link, "$base", "(objectClass=person)"),
+ ldap_get_entries($link, $result)
);
?>
-===DONE===
--CLEAN--
<?php
include "connect.inc";
@@ -191,4 +190,3 @@ array(4) {
string(%d) "cn=userC,cn=userB,%s"
}
}
-===DONE===
diff --git a/ext/ldap/tests/ldap_search_error.phpt b/ext/ldap/tests/ldap_search_error.phpt
index 795edd3180..0a260b2884 100644
--- a/ext/ldap/tests/ldap_search_error.phpt
+++ b/ext/ldap/tests/ldap_search_error.phpt
@@ -15,15 +15,9 @@ $link = ldap_connect($host, $port);
$dn = "dc=not-found,$base";
$filter = "(dc=*)";
-$result = ldap_search();
-var_dump($result);
-
$result = ldap_search($link, $dn, $filter);
var_dump($result);
-$result = ldap_search($link, $dn, $filter, NULL);
-var_dump($result);
-
$result = ldap_search($link, $dn, $filter, array(1 => 'top'));
var_dump($result);
@@ -36,17 +30,10 @@ var_dump($result);
$result = ldap_search(array($link, $link), $dn, array($filter), array('top'));
var_dump($result);
?>
-===DONE===
--EXPECTF--
-Warning: ldap_search() expects at least 3 parameters, 0 given in %s on line %d
-NULL
-
Warning: ldap_search(): Search: No such object in %s on line %d
bool(false)
-Warning: ldap_search() expects parameter 4 to be array, null given in %s on line %d
-NULL
-
Warning: ldap_search(): Array initialization wrong in %s on line %d
bool(false)
@@ -58,4 +45,3 @@ bool(false)
Warning: ldap_search(): Filter must either be a string, or an array with the same number of elements as the links array in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/ldap/tests/ldap_search_overrides.phpt b/ext/ldap/tests/ldap_search_overrides.phpt
index 2434fe5db2..5bd351a741 100644
--- a/ext/ldap/tests/ldap_search_overrides.phpt
+++ b/ext/ldap/tests/ldap_search_overrides.phpt
@@ -20,21 +20,20 @@ ldap_set_option($link, LDAP_OPT_NETWORK_TIMEOUT, 44);
insert_dummy_data($link, $base);
var_dump(
- $result = ldap_search($link, "$base", "(objectClass=person)", array(), null, 111, 22, LDAP_DEREF_NEVER),
- ldap_get_entries($link, $result)
+ $result = ldap_search($link, "$base", "(objectClass=person)", array(), null, 111, 22, LDAP_DEREF_NEVER),
+ ldap_get_entries($link, $result)
);
var_dump(
- ldap_get_option($link, LDAP_OPT_DEREF, $option),
- $option,
- ldap_get_option($link, LDAP_OPT_SIZELIMIT, $option),
- $option,
- ldap_get_option($link, LDAP_OPT_TIMELIMIT, $option),
- $option,
- ldap_get_option($link, LDAP_OPT_NETWORK_TIMEOUT, $option),
- $option
+ ldap_get_option($link, LDAP_OPT_DEREF, $option),
+ $option,
+ ldap_get_option($link, LDAP_OPT_SIZELIMIT, $option),
+ $option,
+ ldap_get_option($link, LDAP_OPT_TIMELIMIT, $option),
+ $option,
+ ldap_get_option($link, LDAP_OPT_NETWORK_TIMEOUT, $option),
+ $option
);
?>
-===DONE===
--CLEAN--
<?php
include "connect.inc";
@@ -212,4 +211,3 @@ bool(true)
int(33)
bool(true)
int(44)
-===DONE===
diff --git a/ext/ldap/tests/ldap_search_paged_result_controls.phpt b/ext/ldap/tests/ldap_search_paged_result_controls.phpt
index 2187a54148..f60acd3e0c 100644
--- a/ext/ldap/tests/ldap_search_paged_result_controls.phpt
+++ b/ext/ldap/tests/ldap_search_paged_result_controls.phpt
@@ -19,16 +19,15 @@ insert_dummy_data($link, $base);
$dn = "$base";
$filter = "(cn=user*)";
var_dump(
- $result = ldap_search($link, $dn, $filter, array('cn'), 0, 0, 0, LDAP_DEREF_NEVER,
- [['oid' => LDAP_CONTROL_PAGEDRESULTS, 'value' => ['size' => 2]]]),
- ldap_get_entries($link, $result),
- ldap_parse_result($link, $result, $errcode , $matcheddn , $errmsg , $referrals, $controls),
- $result = ldap_search($link, $dn, $filter, array('cn'), 0, 0, 0, LDAP_DEREF_NEVER,
- [['oid' => LDAP_CONTROL_PAGEDRESULTS, 'value' => ['size' => 20, 'cookie' => $controls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie']]]]),
- ldap_get_entries($link, $result)
+ $result = ldap_search($link, $dn, $filter, array('cn'), 0, 0, 0, LDAP_DEREF_NEVER,
+ [['oid' => LDAP_CONTROL_PAGEDRESULTS, 'value' => ['size' => 2]]]),
+ ldap_get_entries($link, $result),
+ ldap_parse_result($link, $result, $errcode , $matcheddn , $errmsg , $referrals, $controls),
+ $result = ldap_search($link, $dn, $filter, array('cn'), 0, 0, 0, LDAP_DEREF_NEVER,
+ [['oid' => LDAP_CONTROL_PAGEDRESULTS, 'value' => ['size' => 20, 'cookie' => $controls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie']]]]),
+ ldap_get_entries($link, $result)
);
?>
-===DONE===
--CLEAN--
<?php
include "connect.inc";
@@ -96,4 +95,3 @@ array(2) {
string(%d) "cn=userC,cn=userB,%s"
}
}
-===DONE===
diff --git a/ext/ldap/tests/ldap_search_sort_controls.phpt b/ext/ldap/tests/ldap_search_sort_controls.phpt
index 16504a6997..f55faf4930 100644
--- a/ext/ldap/tests/ldap_search_sort_controls.phpt
+++ b/ext/ldap/tests/ldap_search_sort_controls.phpt
@@ -19,58 +19,57 @@ insert_dummy_data($link, $base);
/* First test with only SORT control */
var_dump(
- $result = ldap_search($link, $base, '(cn=*)', array('cn'), 0, 0, 0, LDAP_DEREF_NEVER,
- [
- [
- 'oid' => LDAP_CONTROL_SORTREQUEST,
- 'iscritical' => TRUE,
- 'value' => [
- ['attr' => 'cn', 'oid' => '2.5.13.3' /* caseIgnoreOrderingMatch */, 'reverse' => TRUE]
- ]
- ]
- ]
- ),
- ldap_get_entries($link, $result),
- ldap_parse_result($link, $result, $errcode , $matcheddn , $errmsg , $referrals, $controls),
- $errcode,
- $errmsg,
- $controls
+ $result = ldap_search($link, $base, '(cn=*)', array('cn'), 0, 0, 0, LDAP_DEREF_NEVER,
+ [
+ [
+ 'oid' => LDAP_CONTROL_SORTREQUEST,
+ 'iscritical' => TRUE,
+ 'value' => [
+ ['attr' => 'cn', 'oid' => '2.5.13.3' /* caseIgnoreOrderingMatch */, 'reverse' => TRUE]
+ ]
+ ]
+ ]
+ ),
+ ldap_get_entries($link, $result),
+ ldap_parse_result($link, $result, $errcode , $matcheddn , $errmsg , $referrals, $controls),
+ $errcode,
+ $errmsg,
+ $controls
);
/* Then with VLV control */
var_dump(
- $result = ldap_search($link, $base, '(cn=*)', array('cn'), 0, 0, 0, LDAP_DEREF_NEVER,
- [
- [
- 'oid' => LDAP_CONTROL_SORTREQUEST,
- 'iscritical' => TRUE,
- 'value' => [
- ['attr' => 'cn', 'oid' => '2.5.13.3' /* caseIgnoreOrderingMatch */, 'reverse' => TRUE]
- ]
- ],
- [
- 'oid' => LDAP_CONTROL_VLVREQUEST,
- 'iscritical' => TRUE,
- 'value' => [
- 'before' => 0, // Return 0 entry before target
- 'after' => 1, // Return 1 entry after target
- 'offset' => 2, // Target entry is the second one
- 'count' => 0, // We have no idea how many entries there are
- ]
- ]
- ]
- ),
- ldap_get_entries($link, $result),
- ldap_parse_result($link, $result, $errcode , $matcheddn , $errmsg , $referrals, $controls),
- array_keys($controls),
- $controls[LDAP_CONTROL_SORTRESPONSE],
- $controls[LDAP_CONTROL_VLVRESPONSE]['value']['target'],
- $controls[LDAP_CONTROL_VLVRESPONSE]['value']['count'],
- $controls[LDAP_CONTROL_VLVRESPONSE]['value']['errcode'],
- bin2hex($controls[LDAP_CONTROL_VLVRESPONSE]['value']['context'])
+ $result = ldap_search($link, $base, '(cn=*)', array('cn'), 0, 0, 0, LDAP_DEREF_NEVER,
+ [
+ [
+ 'oid' => LDAP_CONTROL_SORTREQUEST,
+ 'iscritical' => TRUE,
+ 'value' => [
+ ['attr' => 'cn', 'oid' => '2.5.13.3' /* caseIgnoreOrderingMatch */, 'reverse' => TRUE]
+ ]
+ ],
+ [
+ 'oid' => LDAP_CONTROL_VLVREQUEST,
+ 'iscritical' => TRUE,
+ 'value' => [
+ 'before' => 0, // Return 0 entry before target
+ 'after' => 1, // Return 1 entry after target
+ 'offset' => 2, // Target entry is the second one
+ 'count' => 0, // We have no idea how many entries there are
+ ]
+ ]
+ ]
+ ),
+ ldap_get_entries($link, $result),
+ ldap_parse_result($link, $result, $errcode , $matcheddn , $errmsg , $referrals, $controls),
+ array_keys($controls),
+ $controls[LDAP_CONTROL_SORTRESPONSE],
+ $controls[LDAP_CONTROL_VLVRESPONSE]['value']['target'],
+ $controls[LDAP_CONTROL_VLVRESPONSE]['value']['count'],
+ $controls[LDAP_CONTROL_VLVRESPONSE]['value']['errcode'],
+ bin2hex($controls[LDAP_CONTROL_VLVRESPONSE]['value']['context'])
);
?>
-===DONE===
--CLEAN--
<?php
include "connect.inc";
@@ -204,4 +203,3 @@ int(2)
int(3)
int(0)
string(%d) "%s"
-===DONE===
diff --git a/ext/ldap/tests/ldap_search_variation1.phpt b/ext/ldap/tests/ldap_search_variation1.phpt
index 766efa7598..88eb79aa77 100644
--- a/ext/ldap/tests/ldap_search_variation1.phpt
+++ b/ext/ldap/tests/ldap_search_variation1.phpt
@@ -19,11 +19,10 @@ insert_dummy_data($link, $base);
$dn = "$base";
$filter = "(dc=*)";
var_dump(
- $result = ldap_search($link, "o=test,$base", "(o=*)", array('o')),
- ldap_get_entries($link, $result)
+ $result = ldap_search($link, "o=test,$base", "(o=*)", array('o')),
+ ldap_get_entries($link, $result)
);
?>
-===DONE===
--CLEAN--
<?php
include "connect.inc";
@@ -53,4 +52,3 @@ array(2) {
string(%d) "o=test,%s"
}
}
-===DONE===
diff --git a/ext/ldap/tests/ldap_search_variation2.phpt b/ext/ldap/tests/ldap_search_variation2.phpt
index f2ad3a6929..8b130aaa08 100644
--- a/ext/ldap/tests/ldap_search_variation2.phpt
+++ b/ext/ldap/tests/ldap_search_variation2.phpt
@@ -17,11 +17,10 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
insert_dummy_data($link, $base);
var_dump(
- $result = ldap_search($link, "$base", "(objectclass=person)", array('sn'), 1),
- ldap_get_entries($link, $result)
+ $result = ldap_search($link, "$base", "(objectclass=person)", array('sn'), 1),
+ ldap_get_entries($link, $result)
);
?>
-===DONE===
--CLEAN--
<?php
include "connect.inc";
@@ -77,4 +76,3 @@ array(4) {
string(%d) "cn=userC,cn=userB,%s"
}
}
-===DONE===
diff --git a/ext/ldap/tests/ldap_search_variation3.phpt b/ext/ldap/tests/ldap_search_variation3.phpt
index 12224de24d..d0b6ec5cad 100644
--- a/ext/ldap/tests/ldap_search_variation3.phpt
+++ b/ext/ldap/tests/ldap_search_variation3.phpt
@@ -19,16 +19,15 @@ insert_dummy_data($link, $base);
$dn = "$base";
$filter = "(objectclass=person)";
var_dump(
- $result = ldap_search($link, $dn, $filter, array('sn'), 1, 3),
- ldap_get_entries($link, $result)
+ $result = ldap_search($link, $dn, $filter, array('sn'), 1, 3),
+ ldap_get_entries($link, $result)
);
var_dump(
- $result = ldap_search($link, $dn, $filter, array('sn'), 1, 1),
- ldap_get_entries($link, $result)
+ $result = ldap_search($link, $dn, $filter, array('sn'), 1, 1),
+ ldap_get_entries($link, $result)
);
?>
-===DONE===
--CLEAN--
<?php
include "connect.inc";
@@ -105,4 +104,3 @@ array(2) {
string(%d) "cn=userA,%s"
}
}
-===DONE===
diff --git a/ext/ldap/tests/ldap_search_variation4.phpt b/ext/ldap/tests/ldap_search_variation4.phpt
index ce164763b9..694840b397 100644
--- a/ext/ldap/tests/ldap_search_variation4.phpt
+++ b/ext/ldap/tests/ldap_search_variation4.phpt
@@ -19,11 +19,10 @@ insert_dummy_data($link, $base);
$dn = "$base";
$filter = "(objectclass=person)";
var_dump(
- $result = ldap_search($link, $dn, $filter, array('sn'), 1, 1, 3),
- ldap_get_entries($link, $result)
+ $result = ldap_search($link, $dn, $filter, array('sn'), 1, 1, 3),
+ ldap_get_entries($link, $result)
);
?>
-===DONE===
--CLEAN--
<?php
include "connect.inc";
@@ -52,4 +51,3 @@ array(2) {
string(%d) "cn=userA,%s"
}
}
-===DONE===
diff --git a/ext/ldap/tests/ldap_search_variation5.phpt b/ext/ldap/tests/ldap_search_variation5.phpt
index de4d405090..211df9a128 100644
--- a/ext/ldap/tests/ldap_search_variation5.phpt
+++ b/ext/ldap/tests/ldap_search_variation5.phpt
@@ -19,19 +19,18 @@ insert_dummy_data($link, $base);
$dn = "$base";
$filter = "(objectclass=person)";
var_dump(
- $result = ldap_search($link, $dn, $filter, array('sn'), 1, 1, 3, LDAP_DEREF_SEARCHING),
- ldap_get_entries($link, $result)
+ $result = ldap_search($link, $dn, $filter, array('sn'), 1, 1, 3, LDAP_DEREF_SEARCHING),
+ ldap_get_entries($link, $result)
);
var_dump(
- $result = ldap_search($link, $dn, $filter, array('sn'), 1, 1, 3, LDAP_DEREF_FINDING),
- ldap_get_entries($link, $result)
+ $result = ldap_search($link, $dn, $filter, array('sn'), 1, 1, 3, LDAP_DEREF_FINDING),
+ ldap_get_entries($link, $result)
);
var_dump(
- $result = ldap_search($link, $dn, $filter, array('sn'), 1, 1, 3, LDAP_DEREF_ALWAYS),
- ldap_get_entries($link, $result)
+ $result = ldap_search($link, $dn, $filter, array('sn'), 1, 1, 3, LDAP_DEREF_ALWAYS),
+ ldap_get_entries($link, $result)
);
?>
-===DONE===
--CLEAN--
<?php
include "connect.inc";
@@ -102,4 +101,3 @@ array(2) {
string(%d) "cn=userA,%s"
}
}
-===DONE===
diff --git a/ext/ldap/tests/ldap_search_variation6.phpt b/ext/ldap/tests/ldap_search_variation6.phpt
index a9202967b4..6451c2930b 100644
--- a/ext/ldap/tests/ldap_search_variation6.phpt
+++ b/ext/ldap/tests/ldap_search_variation6.phpt
@@ -20,22 +20,21 @@ $dn = "$base";
$filter = "(objectclass=person)";
var_dump(
- $result = ldap_search(array($link, $link), $dn, $filter),
- $result0 = ldap_get_entries($link, $result[0]),
- ldap_get_entries($link, $result[1]) === $result0
+ $result = ldap_search(array($link, $link), $dn, $filter),
+ $result0 = ldap_get_entries($link, $result[0]),
+ ldap_get_entries($link, $result[1]) === $result0
);
var_dump(
- $result = ldap_search(array($link, $link), "", $filter),
- ldap_get_entries($link, $result[0]),
- ldap_get_entries($link, $result[1])
+ $result = ldap_search(array($link, $link), "", $filter),
+ ldap_get_entries($link, $result[0]),
+ ldap_get_entries($link, $result[1])
);
var_dump(
- $result = ldap_search(array($link, $link), "", array($filter, $filter)),
- ldap_get_entries($link, $result[0]),
- ldap_get_entries($link, $result[1])
+ $result = ldap_search(array($link, $link), "", array($filter, $filter)),
+ ldap_get_entries($link, $result[0]),
+ ldap_get_entries($link, $result[1])
);
?>
-===DONE===
--CLEAN--
<?php
include "connect.inc";
@@ -239,4 +238,3 @@ array(1) {
["count"]=>
int(0)
}
-===DONE===
diff --git a/ext/ldap/tests/ldap_set_option_basic.phpt b/ext/ldap/tests/ldap_set_option_basic.phpt
index de25e59c21..161f2b5d43 100644
--- a/ext/ldap/tests/ldap_set_option_basic.phpt
+++ b/ext/ldap/tests/ldap_set_option_basic.phpt
@@ -16,8 +16,6 @@ var_dump(ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version));
ldap_get_option($link, LDAP_OPT_PROTOCOL_VERSION, $option);
var_dump($option);
?>
-===DONE===
--EXPECT--
bool(true)
int(3)
-===DONE===
diff --git a/ext/ldap/tests/ldap_set_option_cafiles_basic.phpt b/ext/ldap/tests/ldap_set_option_cafiles_basic.phpt
index ff93c9de00..945216d1c0 100644
--- a/ext/ldap/tests/ldap_set_option_cafiles_basic.phpt
+++ b/ext/ldap/tests/ldap_set_option_cafiles_basic.phpt
@@ -10,21 +10,20 @@ require "connect.inc";
$link = ldap_connect($host, $port);
foreach([
- LDAP_OPT_X_TLS_CACERTDIR,
- LDAP_OPT_X_TLS_CACERTFILE,
- LDAP_OPT_X_TLS_CERTFILE,
- LDAP_OPT_X_TLS_KEYFILE,
- LDAP_OPT_X_TLS_CRLFILE,
- LDAP_OPT_X_TLS_DHFILE,
+ LDAP_OPT_X_TLS_CACERTDIR,
+ LDAP_OPT_X_TLS_CACERTFILE,
+ LDAP_OPT_X_TLS_CERTFILE,
+ LDAP_OPT_X_TLS_KEYFILE,
+ LDAP_OPT_X_TLS_CRLFILE,
+ LDAP_OPT_X_TLS_DHFILE,
] as $option) {
- $result = ldap_set_option($link, $option, '/foo/bar');
- var_dump($result);
+ $result = ldap_set_option($link, $option, '/foo/bar');
+ var_dump($result);
- ldap_get_option($link, $option, $optionval);
- var_dump($optionval);
+ ldap_get_option($link, $option, $optionval);
+ var_dump($optionval);
}
?>
-===DONE===
--EXPECT--
bool(true)
string(8) "/foo/bar"
@@ -38,4 +37,3 @@ bool(true)
string(8) "/foo/bar"
bool(true)
string(8) "/foo/bar"
-===DONE===
diff --git a/ext/ldap/tests/ldap_set_option_ciphersuite_basic.phpt b/ext/ldap/tests/ldap_set_option_ciphersuite_basic.phpt
index 9b47a826e5..f80da7c2dd 100644
--- a/ext/ldap/tests/ldap_set_option_ciphersuite_basic.phpt
+++ b/ext/ldap/tests/ldap_set_option_ciphersuite_basic.phpt
@@ -15,8 +15,6 @@ var_dump($result);
ldap_get_option($link, LDAP_OPT_X_TLS_CIPHER_SUITE, $optionval);
var_dump($optionval);
?>
-===DONE===
--EXPECT--
bool(true)
string(4) "3DES"
-===DONE===
diff --git a/ext/ldap/tests/ldap_set_option_crlcheck_basic.phpt b/ext/ldap/tests/ldap_set_option_crlcheck_basic.phpt
index a9aeec0a7b..eff51c785e 100644
--- a/ext/ldap/tests/ldap_set_option_crlcheck_basic.phpt
+++ b/ext/ldap/tests/ldap_set_option_crlcheck_basic.phpt
@@ -18,18 +18,17 @@ require "connect.inc";
$link = ldap_connect($host, $port);
foreach([
- LDAP_OPT_X_TLS_CRL_NONE,
- LDAP_OPT_X_TLS_CRL_PEER,
- LDAP_OPT_X_TLS_CRL_ALL,
+ LDAP_OPT_X_TLS_CRL_NONE,
+ LDAP_OPT_X_TLS_CRL_PEER,
+ LDAP_OPT_X_TLS_CRL_ALL,
] as $option) {
- $result = ldap_set_option($link, LDAP_OPT_X_TLS_CRLCHECK, $option);
- var_dump($result);
+ $result = ldap_set_option($link, LDAP_OPT_X_TLS_CRLCHECK, $option);
+ var_dump($result);
- ldap_get_option($link, LDAP_OPT_X_TLS_CRLCHECK, $optionval);
- var_dump($optionval);
+ ldap_get_option($link, LDAP_OPT_X_TLS_CRLCHECK, $optionval);
+ var_dump($optionval);
}
?>
-===DONE===
--EXPECT--
bool(true)
int(0)
@@ -37,4 +36,3 @@ bool(true)
int(1)
bool(true)
int(2)
-===DONE===
diff --git a/ext/ldap/tests/ldap_set_option_crlcheck_error.phpt b/ext/ldap/tests/ldap_set_option_crlcheck_error.phpt
index ea5318344a..053ba41c61 100644
--- a/ext/ldap/tests/ldap_set_option_crlcheck_error.phpt
+++ b/ext/ldap/tests/ldap_set_option_crlcheck_error.phpt
@@ -11,7 +11,5 @@ $link = ldap_connect($host, $port);
$result = ldap_set_option($link, LDAP_OPT_X_TLS_CRLCHECK, 9001);
var_dump($result);
?>
-===DONE===
--EXPECT--
bool(false)
-===DONE===
diff --git a/ext/ldap/tests/ldap_set_option_error.phpt b/ext/ldap/tests/ldap_set_option_error.phpt
index 3ea49cbc7e..079c63577d 100644
--- a/ext/ldap/tests/ldap_set_option_error.phpt
+++ b/ext/ldap/tests/ldap_set_option_error.phpt
@@ -11,46 +11,26 @@ require "connect.inc";
$link = ldap_connect($host, $port);
$controls = array(
- array(
- array("xid" => "1.2.752.58.10.1", "iscritical" => true),
- array("xid" => "1.2.752.58.1.10", "value" => "magic"),
- ),
- array(
- array("oid" => "1.2.752.58.10.1", "iscritical" => true),
- array("oid" => "1.2.752.58.1.10", "value" => "magic"),
- "weird"
- ),
- "notanarray"
+ array(
+ array("xid" => "1.2.752.58.10.1", "iscritical" => true),
+ array("xid" => "1.2.752.58.1.10", "value" => "magic"),
+ ),
+ array(
+ array("oid" => "1.2.752.58.10.1", "iscritical" => true),
+ array("oid" => "1.2.752.58.1.10", "value" => "magic"),
+ "weird"
+ ),
+ "notanarray"
);
-// Too few parameters
-var_dump(ldap_set_option());
-var_dump(ldap_set_option($link));
-var_dump(ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION));
-
-// Too many parameters
-var_dump(ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, 3, "Additional data"));
-
var_dump(ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, 10));
foreach ($controls as $control)
- var_dump(ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, $control));
+ var_dump(ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, $control));
var_dump(ldap_set_option($link, 999999, 999999));
?>
-===DONE===
--EXPECTF--
-Warning: ldap_set_option() expects exactly 3 parameters, 0 given in %s on line %d
-NULL
-
-Warning: ldap_set_option() expects exactly 3 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ldap_set_option() expects exactly 3 parameters, 2 given in %s on line %d
-NULL
-
-Warning: ldap_set_option() expects exactly 3 parameters, 4 given in %s on line %d
-NULL
bool(false)
Warning: ldap_set_option(): Control must have an oid key in %s on line %d
@@ -62,4 +42,3 @@ bool(false)
Warning: ldap_set_option(): Expected array value for this option in %s on line %d
bool(false)
bool(false)
-===DONE===
diff --git a/ext/ldap/tests/ldap_set_option_keepalive_basic.phpt b/ext/ldap/tests/ldap_set_option_keepalive_basic.phpt
index 211644b444..f00e885ebe 100644
--- a/ext/ldap/tests/ldap_set_option_keepalive_basic.phpt
+++ b/ext/ldap/tests/ldap_set_option_keepalive_basic.phpt
@@ -10,18 +10,17 @@ require "connect.inc";
$link = ldap_connect($host, $port);
foreach([
- LDAP_OPT_X_KEEPALIVE_IDLE,
- LDAP_OPT_X_KEEPALIVE_PROBES,
- LDAP_OPT_X_KEEPALIVE_INTERVAL,
+ LDAP_OPT_X_KEEPALIVE_IDLE,
+ LDAP_OPT_X_KEEPALIVE_PROBES,
+ LDAP_OPT_X_KEEPALIVE_INTERVAL,
] as $option) {
- $result = ldap_set_option($link, $option, 5);
- var_dump($result);
+ $result = ldap_set_option($link, $option, 5);
+ var_dump($result);
- ldap_get_option($link, $option, $optionval);
- var_dump($optionval);
+ ldap_get_option($link, $option, $optionval);
+ var_dump($optionval);
}
?>
-===DONE===
--EXPECT--
bool(true)
int(5)
@@ -29,4 +28,3 @@ bool(true)
int(5)
bool(true)
int(5)
-===DONE===
diff --git a/ext/ldap/tests/ldap_set_option_reqcert_basic.phpt b/ext/ldap/tests/ldap_set_option_reqcert_basic.phpt
index a8d23b9592..d087dbf88c 100644
--- a/ext/ldap/tests/ldap_set_option_reqcert_basic.phpt
+++ b/ext/ldap/tests/ldap_set_option_reqcert_basic.phpt
@@ -10,20 +10,19 @@ require "connect.inc";
$link = ldap_connect($host, $port);
foreach([
- LDAP_OPT_X_TLS_NEVER,
- LDAP_OPT_X_TLS_HARD,
- LDAP_OPT_X_TLS_DEMAND,
- LDAP_OPT_X_TLS_ALLOW,
- LDAP_OPT_X_TLS_TRY,
+ LDAP_OPT_X_TLS_NEVER,
+ LDAP_OPT_X_TLS_HARD,
+ LDAP_OPT_X_TLS_DEMAND,
+ LDAP_OPT_X_TLS_ALLOW,
+ LDAP_OPT_X_TLS_TRY,
] as $option) {
- $result = ldap_set_option($link, LDAP_OPT_X_TLS_REQUIRE_CERT, $option);
- var_dump($result);
+ $result = ldap_set_option($link, LDAP_OPT_X_TLS_REQUIRE_CERT, $option);
+ var_dump($result);
- ldap_get_option($link, LDAP_OPT_X_TLS_REQUIRE_CERT, $optionval);
- var_dump($optionval);
+ ldap_get_option($link, LDAP_OPT_X_TLS_REQUIRE_CERT, $optionval);
+ var_dump($optionval);
}
?>
-===DONE===
--EXPECT--
bool(true)
int(0)
@@ -35,4 +34,3 @@ bool(true)
int(3)
bool(true)
int(4)
-===DONE===
diff --git a/ext/ldap/tests/ldap_set_option_reqcert_error.phpt b/ext/ldap/tests/ldap_set_option_reqcert_error.phpt
index b59879b97a..b23d445955 100644
--- a/ext/ldap/tests/ldap_set_option_reqcert_error.phpt
+++ b/ext/ldap/tests/ldap_set_option_reqcert_error.phpt
@@ -11,7 +11,5 @@ $link = ldap_connect($host, $port);
$result = ldap_set_option($link, LDAP_OPT_X_TLS_REQUIRE_CERT, 9001);
var_dump($result);
?>
-===DONE===
--EXPECT--
bool(false)
-===DONE===
diff --git a/ext/ldap/tests/ldap_set_option_tls_protocol_min_basic.phpt b/ext/ldap/tests/ldap_set_option_tls_protocol_min_basic.phpt
index 81360d0759..782ea24992 100644
--- a/ext/ldap/tests/ldap_set_option_tls_protocol_min_basic.phpt
+++ b/ext/ldap/tests/ldap_set_option_tls_protocol_min_basic.phpt
@@ -10,20 +10,19 @@ require "connect.inc";
$link = ldap_connect($host, $port);
foreach([
- LDAP_OPT_X_TLS_PROTOCOL_SSL2,
- LDAP_OPT_X_TLS_PROTOCOL_SSL3,
- LDAP_OPT_X_TLS_PROTOCOL_TLS1_0,
- LDAP_OPT_X_TLS_PROTOCOL_TLS1_1,
- LDAP_OPT_X_TLS_PROTOCOL_TLS1_2,
+ LDAP_OPT_X_TLS_PROTOCOL_SSL2,
+ LDAP_OPT_X_TLS_PROTOCOL_SSL3,
+ LDAP_OPT_X_TLS_PROTOCOL_TLS1_0,
+ LDAP_OPT_X_TLS_PROTOCOL_TLS1_1,
+ LDAP_OPT_X_TLS_PROTOCOL_TLS1_2,
] as $option) {
- $result = ldap_set_option($link, LDAP_OPT_X_TLS_PROTOCOL_MIN, $option);
- var_dump($result);
+ $result = ldap_set_option($link, LDAP_OPT_X_TLS_PROTOCOL_MIN, $option);
+ var_dump($result);
- ldap_get_option($link, LDAP_OPT_X_TLS_PROTOCOL_MIN, $optionval);
- var_dump($optionval);
+ ldap_get_option($link, LDAP_OPT_X_TLS_PROTOCOL_MIN, $optionval);
+ var_dump($optionval);
}
?>
-===DONE===
--EXPECT--
bool(true)
int(512)
@@ -35,4 +34,3 @@ bool(true)
int(770)
bool(true)
int(771)
-===DONE===
diff --git a/ext/ldap/tests/ldap_set_option_variation.phpt b/ext/ldap/tests/ldap_set_option_variation.phpt
index 4c0a138552..4f1e8626d7 100644
--- a/ext/ldap/tests/ldap_set_option_variation.phpt
+++ b/ext/ldap/tests/ldap_set_option_variation.phpt
@@ -13,55 +13,54 @@ $link = ldap_connect($host, $port);
$option = null;
$controls = array(
- array("oid" => "1.2.752.58.10.1", "iscritical" => true),
- array("oid" => "1.2.752.58.1.10", "value" => "magic"),
+ array("oid" => "1.2.752.58.10.1", "iscritical" => true),
+ array("oid" => "1.2.752.58.1.10", "value" => "magic"),
);
var_dump(ldap_set_option($link, LDAP_OPT_DEREF, LDAP_DEREF_ALWAYS));
ldap_get_option($link, LDAP_OPT_DEREF, $option);
var_dump(
- $option === LDAP_DEREF_ALWAYS,
- ldap_set_option($link, LDAP_OPT_SIZELIMIT, 123)
+ $option === LDAP_DEREF_ALWAYS,
+ ldap_set_option($link, LDAP_OPT_SIZELIMIT, 123)
);
ldap_get_option($link, LDAP_OPT_SIZELIMIT, $option);
var_dump(
- $option,
- ldap_set_option($link, LDAP_OPT_TIMELIMIT, 33)
+ $option,
+ ldap_set_option($link, LDAP_OPT_TIMELIMIT, 33)
);
ldap_get_option($link, LDAP_OPT_TIMELIMIT, $option);
var_dump(
- $option,
- ldap_set_option($link, LDAP_OPT_NETWORK_TIMEOUT, 44)
+ $option,
+ ldap_set_option($link, LDAP_OPT_NETWORK_TIMEOUT, 44)
);
ldap_get_option($link, LDAP_OPT_NETWORK_TIMEOUT, $option);
var_dump(
- $option,
- ldap_set_option($link, LDAP_OPT_REFERRALS, true)
+ $option,
+ ldap_set_option($link, LDAP_OPT_REFERRALS, true)
);
ldap_get_option($link, LDAP_OPT_REFERRALS, $option);
var_dump(
- (bool) $option,
- ldap_set_option($link, LDAP_OPT_RESTART, false)
+ (bool) $option,
+ ldap_set_option($link, LDAP_OPT_RESTART, false)
);
ldap_get_option($link, LDAP_OPT_RESTART, $option);
var_dump(
- (bool) $option,
- ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, $controls)
+ (bool) $option,
+ ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, $controls)
);
ldap_get_option($link, LDAP_OPT_SERVER_CONTROLS, $option);
var_dump(
- $option,
- ldap_set_option($link, LDAP_OPT_CLIENT_CONTROLS, $controls)
+ $option,
+ ldap_set_option($link, LDAP_OPT_CLIENT_CONTROLS, $controls)
);
ldap_get_option($link, LDAP_OPT_CLIENT_CONTROLS, $option);
var_dump(
- $option,
- ldap_set_option($link, LDAP_OPT_MATCHED_DN, "dc=test,dc=com")
+ $option,
+ ldap_set_option($link, LDAP_OPT_MATCHED_DN, "dc=test,dc=com")
);
ldap_get_option($link, LDAP_OPT_MATCHED_DN, $option);
var_dump($option);
?>
-===DONE===
--EXPECT--
bool(true)
bool(true)
@@ -119,4 +118,3 @@ array(2) {
}
bool(true)
string(14) "dc=test,dc=com"
-===DONE===
diff --git a/ext/ldap/tests/ldap_set_rebind_proc_basic.phpt b/ext/ldap/tests/ldap_set_rebind_proc_basic.phpt
index 428b8d8f02..cc1fc0c313 100644
--- a/ext/ldap/tests/ldap_set_rebind_proc_basic.phpt
+++ b/ext/ldap/tests/ldap_set_rebind_proc_basic.phpt
@@ -27,8 +27,6 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
var_dump(ldap_set_rebind_proc($link, "rebind_proc"));
var_dump(ldap_set_rebind_proc($link, ""));
?>
-===DONE===
--EXPECT--
bool(true)
bool(true)
-===DONE===
diff --git a/ext/ldap/tests/ldap_set_rebind_proc_error.phpt b/ext/ldap/tests/ldap_set_rebind_proc_error.phpt
index c8c7985826..6bede460a4 100644
--- a/ext/ldap/tests/ldap_set_rebind_proc_error.phpt
+++ b/ext/ldap/tests/ldap_set_rebind_proc_error.phpt
@@ -10,7 +10,7 @@ Patrick Allaert <patrickallaert@php.net>
die("skip ldap_set_rebind_proc() does not exist");
}
require "connect.inc";
- $link = fsockopen($host, $port);
+ $link = @fsockopen($host, $port);
if (!$link) {
die("skip no server listening");
}
@@ -33,18 +33,8 @@ function rebind_proc ($ds, $ldap_url) {
}
$link = ldap_connect($host, $port);
-var_dump(ldap_set_rebind_proc($link));
-var_dump(ldap_set_rebind_proc($link, "rebind_proc", "Additional data"));
var_dump(ldap_set_rebind_proc($link, "rebind_proc_inexistent"));
?>
-===DONE===
--EXPECTF--
-Warning: ldap_set_rebind_proc() expects exactly 2 parameters, 1 given in %s on line %d
-bool(false)
-
-Warning: ldap_set_rebind_proc() expects exactly 2 parameters, 3 given in %s on line %d
-bool(false)
-
Warning: ldap_set_rebind_proc(): Two arguments expected for 'rebind_proc_inexistent' to be a valid callback in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/ldap/tests/ldap_sort_basic.phpt b/ext/ldap/tests/ldap_sort_basic.phpt
deleted file mode 100644
index e14381f8c7..0000000000
--- a/ext/ldap/tests/ldap_sort_basic.phpt
+++ /dev/null
@@ -1,201 +0,0 @@
---TEST--
-ldap_sort() - Basic ldap_sort test
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
-<?php require_once('skipifbindfailure.inc'); ?>
---FILE--
-<?php
-require "connect.inc";
-
-$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link, $base);
-ldap_add($link, "cn=userC,$base", array(
- "objectclass" => "person",
- "cn" => "userC",
- "sn" => "zzz",
- "userPassword" => "oops",
- "description" => "a user",
-));
-ldap_add($link, "cn=userD,$base", array(
- "objectclass" => "person",
- "cn" => "userD",
- "sn" => "aaa",
- "userPassword" => "oops",
- "description" => "another user",
-));
-ldap_add($link, "cn=userE,$base", array(
- "objectclass" => "person",
- "cn" => "userE",
- "sn" => "a",
- "userPassword" => "oops",
- "description" => "yet another user",
-));
-$result = ldap_search($link, "$base", "(objectclass=person)", array("sn", "description"));
-var_dump(
- ldap_sort($link, $result, "sn"),
- ldap_get_entries($link, $result)
-);
-?>
-===DONE===
---CLEAN--
-<?php
-include "connect.inc";
-
-$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-ldap_delete($link, "cn=userC,$base");
-ldap_delete($link, "cn=userD,$base");
-ldap_delete($link, "cn=userE,$base");
-remove_dummy_data($link, $base);
-?>
---EXPECTF--
-Deprecated: Function ldap_sort() is deprecated in %s.php on line %d
-bool(true)
-array(7) {
- ["count"]=>
- int(6)
- [0]=>
- array(6) {
- ["sn"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(1) "a"
- }
- [0]=>
- string(2) "sn"
- ["description"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(16) "yet another user"
- }
- [1]=>
- string(11) "description"
- ["count"]=>
- int(2)
- ["dn"]=>
- string(%d) "cn=userE,%s"
- }
- [1]=>
- array(6) {
- ["sn"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(3) "aaa"
- }
- [0]=>
- string(2) "sn"
- ["description"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(12) "another user"
- }
- [1]=>
- string(11) "description"
- ["count"]=>
- int(2)
- ["dn"]=>
- string(%d) "cn=userD,%s"
- }
- [2]=>
- array(6) {
- ["sn"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(7) "testSN1"
- }
- [0]=>
- string(2) "sn"
- ["description"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(6) "user A"
- }
- [1]=>
- string(11) "description"
- ["count"]=>
- int(2)
- ["dn"]=>
- string(%d) "cn=userA,%s"
- }
- [3]=>
- array(6) {
- ["sn"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(7) "testSN2"
- }
- [0]=>
- string(2) "sn"
- ["description"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(6) "user B"
- }
- [1]=>
- string(11) "description"
- ["count"]=>
- int(2)
- ["dn"]=>
- string(%d) "cn=userB,%s"
- }
- [4]=>
- array(4) {
- ["sn"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(7) "testSN3"
- }
- [0]=>
- string(2) "sn"
- ["count"]=>
- int(1)
- ["dn"]=>
- string(%d) "cn=userC,cn=userB,%s"
- }
- [5]=>
- array(6) {
- ["sn"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(3) "zzz"
- }
- [0]=>
- string(2) "sn"
- ["description"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(6) "a user"
- }
- [1]=>
- string(11) "description"
- ["count"]=>
- int(2)
- ["dn"]=>
- string(%d) "cn=userC,%s"
- }
-}
-===DONE===
diff --git a/ext/ldap/tests/ldap_sort_error.phpt b/ext/ldap/tests/ldap_sort_error.phpt
deleted file mode 100644
index c41b56ab51..0000000000
--- a/ext/ldap/tests/ldap_sort_error.phpt
+++ /dev/null
@@ -1,45 +0,0 @@
---TEST--
-ldap_sort() - Testing ldap_sort() that should fail
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-require "connect.inc";
-
-$link = ldap_connect($host, $port);
-var_dump(ldap_sort($link));
-var_dump(ldap_sort($link, $link));
-var_dump(ldap_sort($link, $link, $link, $link));
-var_dump(ldap_sort($link, $link, $link));
-var_dump(ldap_sort($link, $link, "sn"));
-?>
-===DONE===
---EXPECTF--
-Deprecated: Function ldap_sort() is deprecated in %s.php on line %d
-
-Warning: ldap_sort() expects exactly 3 parameters, 1 given in %s on line %d
-bool(false)
-
-Deprecated: Function ldap_sort() is deprecated in %s.php on line %d
-
-Warning: ldap_sort() expects exactly 3 parameters, 2 given in %s on line %d
-bool(false)
-
-Deprecated: Function ldap_sort() is deprecated in %s.php on line %d
-
-Warning: ldap_sort() expects exactly 3 parameters, 4 given in %s on line %d
-bool(false)
-
-Deprecated: Function ldap_sort() is deprecated in %s.php on line %d
-
-Warning: ldap_sort() expects parameter 3 to be string, resource given in %s on line %d
-bool(false)
-
-Deprecated: Function ldap_sort() is deprecated in %s.php on line %d
-
-Warning: ldap_sort(): Supplied resource is not a valid ldap result resource in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/ldap/tests/ldap_sort_variation.phpt b/ext/ldap/tests/ldap_sort_variation.phpt
deleted file mode 100644
index bb121b63cb..0000000000
--- a/ext/ldap/tests/ldap_sort_variation.phpt
+++ /dev/null
@@ -1,201 +0,0 @@
---TEST--
-ldap_sort() - Basic ldap_sort test
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
-<?php require_once('skipifbindfailure.inc'); ?>
---FILE--
-<?php
-require "connect.inc";
-
-$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-insert_dummy_data($link, $base);
-ldap_add($link, "cn=userC,$base", array(
- "objectclass" => "person",
- "cn" => "userC",
- "sn" => "zzz",
- "userPassword" => "oops",
- "description" => "a user",
-));
-ldap_add($link, "cn=userD,$base", array(
- "objectclass" => "person",
- "cn" => "userD",
- "sn" => "aaa",
- "userPassword" => "oops",
- "description" => "another user",
-));
-ldap_add($link, "cn=userE,$base", array(
- "objectclass" => "person",
- "cn" => "userE",
- "sn" => "a",
- "userPassword" => "oops",
- "description" => "yet another user",
-));
-$result = ldap_search($link, "$base", "(objectclass=person)", array("sn", "description"));
-var_dump(
- ldap_sort($link, $result, "description"),
- ldap_get_entries($link, $result)
-);
-?>
-===DONE===
---CLEAN--
-<?php
-include "connect.inc";
-
-$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-ldap_delete($link, "cn=userC,$base");
-ldap_delete($link, "cn=userD,$base");
-ldap_delete($link, "cn=userE,$base");
-remove_dummy_data($link, $base);
-?>
---EXPECTF--
-Deprecated: Function ldap_sort() is deprecated in %s.php on line %d
-bool(true)
-array(7) {
- ["count"]=>
- int(6)
- [0]=>
- array(4) {
- ["sn"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(7) "testSN3"
- }
- [0]=>
- string(2) "sn"
- ["count"]=>
- int(1)
- ["dn"]=>
- string(%d) "cn=userC,cn=userB,%s"
- }
- [1]=>
- array(6) {
- ["sn"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(3) "zzz"
- }
- [0]=>
- string(2) "sn"
- ["description"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(6) "a user"
- }
- [1]=>
- string(11) "description"
- ["count"]=>
- int(2)
- ["dn"]=>
- string(%d) "cn=userC,%s"
- }
- [2]=>
- array(6) {
- ["sn"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(3) "aaa"
- }
- [0]=>
- string(2) "sn"
- ["description"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(12) "another user"
- }
- [1]=>
- string(11) "description"
- ["count"]=>
- int(2)
- ["dn"]=>
- string(%d) "cn=userD,%s"
- }
- [3]=>
- array(6) {
- ["sn"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(7) "testSN1"
- }
- [0]=>
- string(2) "sn"
- ["description"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(6) "user A"
- }
- [1]=>
- string(11) "description"
- ["count"]=>
- int(2)
- ["dn"]=>
- string(%d) "cn=userA,%s"
- }
- [4]=>
- array(6) {
- ["sn"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(7) "testSN2"
- }
- [0]=>
- string(2) "sn"
- ["description"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(6) "user B"
- }
- [1]=>
- string(11) "description"
- ["count"]=>
- int(2)
- ["dn"]=>
- string(%d) "cn=userB,%s"
- }
- [5]=>
- array(6) {
- ["sn"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(1) "a"
- }
- [0]=>
- string(2) "sn"
- ["description"]=>
- array(2) {
- ["count"]=>
- int(1)
- [0]=>
- string(16) "yet another user"
- }
- [1]=>
- string(11) "description"
- ["count"]=>
- int(2)
- ["dn"]=>
- string(%d) "cn=userE,%s"
- }
-}
-===DONE===
diff --git a/ext/ldap/tests/ldap_start_tls_basic.phpt b/ext/ldap/tests/ldap_start_tls_basic.phpt
index cdb50fd6c9..a9e3c6c97c 100644
--- a/ext/ldap/tests/ldap_start_tls_basic.phpt
+++ b/ext/ldap/tests/ldap_start_tls_basic.phpt
@@ -14,7 +14,5 @@ $link = ldap_connect($host, $port);
ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version);
var_dump(ldap_start_tls($link));
?>
-===DONE===
--EXPECT--
bool(true)
-===DONE===
diff --git a/ext/ldap/tests/ldap_start_tls_error.phpt b/ext/ldap/tests/ldap_start_tls_error.phpt
deleted file mode 100644
index 686f5331a8..0000000000
--- a/ext/ldap/tests/ldap_start_tls_error.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-ldap_start_tls() - Binding that should fail
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
-<?php require_once('skipifbindfailure.inc'); ?>
---FILE--
-<?php
-require "connect.inc";
-
-$link = ldap_connect($host, $port);
-ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version);
-
-// Invalid parameter count
-var_dump(ldap_start_tls());
-var_dump(ldap_start_tls($link, $link));
-?>
-===DONE===
---EXPECTF--
-Warning: ldap_start_tls() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: ldap_start_tls() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-===DONE===
diff --git a/ext/ldap/tests/ldap_unbind_basic.phpt b/ext/ldap/tests/ldap_unbind_basic.phpt
index addfac5597..622d215546 100644
--- a/ext/ldap/tests/ldap_unbind_basic.phpt
+++ b/ext/ldap/tests/ldap_unbind_basic.phpt
@@ -14,7 +14,5 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
var_dump(ldap_unbind($link));
?>
-===DONE===
--EXPECT--
bool(true)
-===DONE===
diff --git a/ext/ldap/tests/ldap_unbind_error.phpt b/ext/ldap/tests/ldap_unbind_error.phpt
deleted file mode 100644
index 85e586eb6f..0000000000
--- a/ext/ldap/tests/ldap_unbind_error.phpt
+++ /dev/null
@@ -1,42 +0,0 @@
---TEST--
-ldap_unbind() - ldap_unbind() operations that should fail
---CREDITS--
-Patrick Allaert <patrickallaert@php.net>
-# Belgian PHP Testfest 2009
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
-<?php require_once('skipifbindfailure.inc'); ?>
---FILE--
-<?php
-require "connect.inc";
-
-$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
-
-// Too few parameters
-var_dump(ldap_unbind());
-
-// Too many parameters
-var_dump(ldap_unbind($link, "Additional data"));
-
-// Bad parameter
-var_dump(ldap_unbind("string"));
-
-// unbind twice
-var_dump(ldap_unbind($link));
-var_dump(ldap_unbind($link));
-?>
-===DONE===
---EXPECTF--
-Warning: ldap_unbind() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: ldap_unbind() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
-
-Warning: ldap_unbind() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
-bool(true)
-
-Warning: ldap_unbind(): supplied resource is not a valid ldap link resource in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/ldap/tests/ldap_unbind_variation.phpt b/ext/ldap/tests/ldap_unbind_variation.phpt
index 60edb03b68..0c933543eb 100644
--- a/ext/ldap/tests/ldap_unbind_variation.phpt
+++ b/ext/ldap/tests/ldap_unbind_variation.phpt
@@ -11,16 +11,16 @@ Patrick Allaert <patrickallaert@php.net>
require "connect.inc";
function rebind_proc ($ds, $ldap_url) {
- global $user;
- global $passwd;
- global $protocol_version;
+ global $user;
+ global $passwd;
+ global $protocol_version;
- // required by most modern LDAP servers, use LDAPv3
- ldap_set_option($a, LDAP_OPT_PROTOCOL_VERSION, $protocol_version);
+ // required by most modern LDAP servers, use LDAPv3
+ ldap_set_option($a, LDAP_OPT_PROTOCOL_VERSION, $protocol_version);
- if (!ldap_bind($a, $user, $passwd)) {
- print "Cannot bind";
- }
+ if (!ldap_bind($a, $user, $passwd)) {
+ print "Cannot bind";
+ }
}
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
@@ -28,7 +28,5 @@ ldap_set_rebind_proc($link, "rebind_proc");
var_dump(ldap_unbind($link));
?>
-===DONE===
--EXPECT--
bool(true)
-===DONE===
diff --git a/ext/ldap/tests/skipif.inc b/ext/ldap/tests/skipif.inc
index d3494284b0..dc016787da 100644
--- a/ext/ldap/tests/skipif.inc
+++ b/ext/ldap/tests/skipif.inc
@@ -1,5 +1,5 @@
<?php
if (!extension_loaded('ldap')){
- die('skip ldap extension not available');
+ die('skip ldap extension not available');
}
?>
diff --git a/ext/ldap/tests/skipifbindfailure.inc b/ext/ldap/tests/skipifbindfailure.inc
index f79bb9d690..8f66c6cb96 100644
--- a/ext/ldap/tests/skipifbindfailure.inc
+++ b/ext/ldap/tests/skipifbindfailure.inc
@@ -3,11 +3,11 @@ require_once 'connect.inc';
if ($skip_on_bind_failure) {
- $link = ldap_connect($host, $port);
- ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version);
- if (!@ldap_bind($link, $user, $passwd))
- die(sprintf("skip Can't bind to LDAP Server - [%d] %s", ldap_errno($link), ldap_error($link)));
+ $link = ldap_connect($host, $port);
+ ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version);
+ if (!@ldap_bind($link, $user, $passwd))
+ die(sprintf("skip Can't bind to LDAP Server - [%d] %s", ldap_errno($link), ldap_error($link)));
- ldap_unbind($link);
+ ldap_unbind($link);
}
?>
diff --git a/ext/ldap/tests/skipifcontrol.inc b/ext/ldap/tests/skipifcontrol.inc
index ae551d6add..ff690068ae 100644
--- a/ext/ldap/tests/skipifcontrol.inc
+++ b/ext/ldap/tests/skipifcontrol.inc
@@ -3,11 +3,11 @@ require_once 'connect.inc';
function skipifunsupportedcontrol($oid)
{
- global $host, $port, $user, $passwd, $protocol_version, $base;
- $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
- $result = ldap_read($link, '', '(objectClass=*)', ['supportedControl']);
- if (!in_array($oid, ldap_get_entries($link, $result)[0]['supportedcontrol'])) {
- die(sprintf("skip Unsupported control %s", $oid));
- }
+ global $host, $port, $user, $passwd, $protocol_version, $base;
+ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
+ $result = ldap_read($link, '', '(objectClass=*)', ['supportedControl']);
+ if (!in_array($oid, ldap_get_entries($link, $result)[0]['supportedcontrol'])) {
+ die(sprintf("skip Unsupported control %s", $oid));
+ }
}
?>
diff --git a/ext/libxml/config.w32 b/ext/libxml/config.w32
index dd91c4b893..b11c57bc44 100644
--- a/ext/libxml/config.w32
+++ b/ext/libxml/config.w32
@@ -16,9 +16,6 @@ if (PHP_LIBXML == "yes") {
ADD_DEF_FILE("ext\\libxml\\php_libxml2.def");
}
PHP_INSTALL_HEADERS("ext/libxml/", "php_libxml.h");
- if (PHP_CRT_DEBUG == "yes") {
- ADD_FLAG("CFLAGS_LIBXML", "/D PHP_WIN32_DEBUG_HEAP");
- }
} else {
WARNING("libxml support can't be enabled, iconv or libxml are missing")
PHP_LIBXML = "no"
diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c
index c024e16670..edc2020f46 100644
--- a/ext/libxml/libxml.c
+++ b/ext/libxml/libxml.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -43,6 +41,7 @@
#endif
#include "php_libxml.h"
+#include "libxml_arginfo.h"
#define PHP_LIBXML_ERROR 0
#define PHP_LIBXML_CTX_ERROR 1
@@ -91,33 +90,6 @@ static int php_libxml_post_deactivate(void);
/* }}} */
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO(arginfo_libxml_set_streams_context, 0)
- ZEND_ARG_INFO(0, context)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_libxml_use_internal_errors, 0, 0, 0)
- ZEND_ARG_INFO(0, use_errors)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_libxml_get_last_error, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_libxml_get_errors, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_libxml_clear_errors, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_libxml_disable_entity_loader, 0, 0, 0)
- ZEND_ARG_INFO(0, disable)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_libxml_set_external_entity_loader, 0, 0, 1)
- ZEND_ARG_INFO(0, resolver_function)
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ extension definition structures */
static const zend_function_entry libxml_functions[] = {
PHP_FE(libxml_set_streams_context, arginfo_libxml_set_streams_context)
@@ -749,9 +721,7 @@ PHP_LIBXML_API void php_libxml_initialize(void)
{
if (!_php_libxml_initialized) {
/* we should be the only one's to ever init!! */
- ZEND_IGNORE_LEAKS_BEGIN();
xmlInitParser();
- ZEND_IGNORE_LEAKS_END();
_php_libxml_default_entity_loader = xmlGetExternalEntityLoader();
xmlSetExternalEntityLoader(_php_libxml_pre_ext_ent_loader);
@@ -1006,6 +976,8 @@ static PHP_FUNCTION(libxml_get_last_error)
{
xmlErrorPtr error;
+ ZEND_PARSE_PARAMETERS_NONE();
+
error = xmlGetLastError();
if (error) {
@@ -1037,6 +1009,8 @@ static PHP_FUNCTION(libxml_get_errors)
xmlErrorPtr error;
+ ZEND_PARSE_PARAMETERS_NONE();
+
if (LIBXML(error_list)) {
array_init(return_value);
@@ -1074,6 +1048,8 @@ static PHP_FUNCTION(libxml_get_errors)
Clear last error from libxml */
static PHP_FUNCTION(libxml_clear_errors)
{
+ ZEND_PARSE_PARAMETERS_NONE();
+
xmlResetLastError();
if (LIBXML(error_list)) {
zend_llist_clean(LIBXML(error_list));
diff --git a/ext/libxml/libxml.stub.php b/ext/libxml/libxml.stub.php
new file mode 100644
index 0000000000..7022b2e1f8
--- /dev/null
+++ b/ext/libxml/libxml.stub.php
@@ -0,0 +1,16 @@
+<?php
+
+/** @param resource $context */
+function libxml_set_streams_context($context): void {}
+
+function libxml_use_internal_errors(bool $use_errors = UNKNOWN): bool {}
+
+function libxml_get_last_error(): LibXMLError|false {}
+
+function libxml_get_errors(): array {}
+
+function libxml_clear_errors(): void {}
+
+function libxml_disable_entity_loader(bool $disable = true): bool {}
+
+function libxml_set_external_entity_loader(?callable $resolver_function): bool {}
diff --git a/ext/libxml/libxml_arginfo.h b/ext/libxml/libxml_arginfo.h
new file mode 100644
index 0000000000..0df59c30ca
--- /dev/null
+++ b/ext/libxml/libxml_arginfo.h
@@ -0,0 +1,26 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_libxml_set_streams_context, 0, 1, IS_VOID, 0)
+ ZEND_ARG_INFO(0, context)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_libxml_use_internal_errors, 0, 0, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, use_errors, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_libxml_get_last_error, 0, 0, LibXMLError, MAY_BE_FALSE)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_libxml_get_errors, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_libxml_clear_errors, 0, 0, IS_VOID, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_libxml_disable_entity_loader, 0, 0, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, disable, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_libxml_set_external_entity_loader, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, resolver_function, IS_CALLABLE, 1)
+ZEND_END_ARG_INFO()
diff --git a/ext/libxml/php_libxml.h b/ext/libxml/php_libxml.h
index cf936e95de..f913f956d5 100644
--- a/ext/libxml/php_libxml.h
+++ b/ext/libxml/php_libxml.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/libxml/tests/001.phpt b/ext/libxml/tests/001.phpt
index b636ab7adc..9d25b0d3f4 100644
--- a/ext/libxml/tests/001.phpt
+++ b/ext/libxml/tests/001.phpt
@@ -1,14 +1,13 @@
--TEST--
libxml_use_internal_errors()
--SKIPIF--
-<?php if (!extension_loaded('libxml')) die('skip'); ?>
+<?php if (!extension_loaded('libxml')) die('skip libxml extension not available'); ?>
--FILE--
<?php
var_dump(libxml_use_internal_errors(false));
var_dump(libxml_use_internal_errors(true));
var_dump(libxml_use_internal_errors());
-var_dump(libxml_use_internal_errors(new stdclass));
var_dump(libxml_get_errors());
var_dump(libxml_get_last_error());
@@ -17,13 +16,10 @@ var_dump(libxml_clear_errors());
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
bool(false)
bool(false)
bool(true)
-
-Warning: libxml_use_internal_errors() expects parameter 1 to be bool, object given in %s001.php on line 6
-NULL
array(0) {
}
bool(false)
diff --git a/ext/libxml/tests/002.phpt b/ext/libxml/tests/002.phpt
index f803d7ab1b..f88753d977 100644
--- a/ext/libxml/tests/002.phpt
+++ b/ext/libxml/tests/002.phpt
@@ -1,7 +1,7 @@
--TEST--
libxml_get_errors()
--SKIPIF--
-<?php if (!extension_loaded('simplexml')) die('skip'); ?>
+<?php if (!extension_loaded('simplexml')) die('skip simplexml extension not available'); ?>
--FILE--
<?php
@@ -20,40 +20,40 @@ $doc = simplexml_load_string($xmlstr);
$xml = explode("\n", $xmlstr);
if (!$doc) {
- $errors = libxml_get_errors();
+ $errors = libxml_get_errors();
- foreach ($errors as $error) {
- echo display_xml_error($error, $xml);
- }
+ foreach ($errors as $error) {
+ echo display_xml_error($error, $xml);
+ }
- var_dump(libxml_get_last_error());
+ var_dump(libxml_get_last_error());
}
function display_xml_error($error, $xml)
{
- $return = $xml[$error->line - 1] . "\n";
- $return .= str_repeat('-', $error->column) . "^\n";
-
- switch ($error->level) {
- case LIBXML_ERR_WARNING:
- $return .= "Warning $error->code: ";
- break;
- case LIBXML_ERR_ERROR:
- $return .= "Error $error->code: ";
- break;
- case LIBXML_ERR_FATAL:
- $return .= "Fatal Error $error->code: ";
- break;
- }
-
- $return .= trim($error->message) . "\n Line: $error->line" . "\n Column: $error->column";
-
- if ($error->file) {
- $return .= "\n File: $error->file";
- }
-
- return "$return\n\n--------------------------------------------\n\n";
+ $return = $xml[$error->line - 1] . "\n";
+ $return .= str_repeat('-', $error->column) . "^\n";
+
+ switch ($error->level) {
+ case LIBXML_ERR_WARNING:
+ $return .= "Warning $error->code: ";
+ break;
+ case LIBXML_ERR_ERROR:
+ $return .= "Error $error->code: ";
+ break;
+ case LIBXML_ERR_FATAL:
+ $return .= "Fatal Error $error->code: ";
+ break;
+ }
+
+ $return .= trim($error->message) . "\n Line: $error->line" . "\n Column: $error->column";
+
+ if ($error->file) {
+ $return .= "\n File: $error->file";
+ }
+
+ return "$return\n\n--------------------------------------------\n\n";
}
diff --git a/ext/libxml/tests/003.phpt b/ext/libxml/tests/003.phpt
index c168785647..b7edac6751 100644
--- a/ext/libxml/tests/003.phpt
+++ b/ext/libxml/tests/003.phpt
@@ -1,7 +1,7 @@
--TEST--
libxml_use_internal_errors() memory leaks
--SKIPIF--
-<?php if (!extension_loaded('simplexml')) die('skip'); ?>
+<?php if (!extension_loaded('simplexml')) die('skip simplexml extension not available'); ?>
--FILE--
<?php
var_dump(libxml_use_internal_errors(true));
diff --git a/ext/libxml/tests/004.phpt b/ext/libxml/tests/004.phpt
index f222071abe..e3daa41d24 100644
--- a/ext/libxml/tests/004.phpt
+++ b/ext/libxml/tests/004.phpt
@@ -1,56 +1,42 @@
--TEST--
libxml_set_streams_context()
--SKIPIF--
-<?php if (!extension_loaded('dom')) die('skip'); ?>
+<?php if (!extension_loaded('dom')) die('skip dom extension not available'); ?>
--FILE--
<?php
$ctxs = array(
- NULL,
- 'bogus',
- 123,
- new stdclass,
- array('a'),
- stream_context_create(),
- stream_context_create(array('file')),
- stream_context_create(array('file' => array('some_opt' => 'aaa')))
+ NULL,
+ 'bogus',
+ 123,
+ new stdclass,
+ array('a'),
+ stream_context_create(),
);
-
foreach ($ctxs as $ctx) {
- var_dump(libxml_set_streams_context($ctx));
- $dom = new DOMDocument();
- var_dump($dom->load(__DIR__.'/test.xml'));
+ try {
+ var_dump(libxml_set_streams_context($ctx));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ $dom = new DOMDocument();
+ var_dump($dom->load(__DIR__.'/test.xml'));
}
echo "Done\n";
?>
--EXPECTF--
-Warning: stream_context_create(): options should have the form ["wrappername"]["optionname"] = $value in %s004.php on line %d
-
-Warning: libxml_set_streams_context() expects parameter 1 to be resource, null given in %s004.php on line %d
-NULL
+libxml_set_streams_context() expects parameter 1 to be resource, null given
bool(true)
-
-Warning: libxml_set_streams_context() expects parameter 1 to be resource, string given in %s004.php on line %d
-NULL
+libxml_set_streams_context() expects parameter 1 to be resource, string given
bool(true)
-
-Warning: libxml_set_streams_context() expects parameter 1 to be resource, int given in %s004.php on line %d
-NULL
+libxml_set_streams_context() expects parameter 1 to be resource, int given
bool(true)
-
-Warning: libxml_set_streams_context() expects parameter 1 to be resource, object given in %s004.php on line %d
-NULL
-bool(true)
-
-Warning: libxml_set_streams_context() expects parameter 1 to be resource, array given in %s004.php on line %d
-NULL
+libxml_set_streams_context() expects parameter 1 to be resource, object given
bool(true)
-NULL
-bool(true)
-NULL
+libxml_set_streams_context() expects parameter 1 to be resource, array given
bool(true)
NULL
bool(true)
diff --git a/ext/libxml/tests/bug42112.phpt b/ext/libxml/tests/bug42112.phpt
index b5a3f40b3e..6ca95f6e06 100644
--- a/ext/libxml/tests/bug42112.phpt
+++ b/ext/libxml/tests/bug42112.phpt
@@ -1,7 +1,7 @@
--TEST--
Bug #42112 (deleting a node produces memory corruption)
--SKIPIF--
-<?php if (!extension_loaded('dom')) die('skip'); ?>
+<?php if (!extension_loaded('dom')) die('skip dom extension not available'); ?>
--FILE--
<?php
$xml = <<<EOXML
@@ -21,7 +21,7 @@ remove_node($doc);
$node = $doc->getElementById( 'id1' );
if ($node) {
- print 'Found Node: '.$node->nodeName."\n";
+ print 'Found Node: '.$node->nodeName."\n";
}
$root = $doc->documentElement;
print 'Root Node: '.$root->nodeName."\n";
diff --git a/ext/libxml/tests/bug54440.phpt b/ext/libxml/tests/bug54440.phpt
index 4074ff9fe8..a4d5ed4880 100644
--- a/ext/libxml/tests/bug54440.phpt
+++ b/ext/libxml/tests/bug54440.phpt
@@ -9,9 +9,9 @@ class TestWrapper {
function stream_open($path, $mode, $options, &$opened_path)
{
- if ($this->context)
- print_r(stream_context_get_options($this->context));
- return false;
+ if ($this->context)
+ print_r(stream_context_get_options($this->context));
+ return false;
}
function url_stat($path, $flags)
diff --git a/ext/libxml/tests/bug61367-read.phpt b/ext/libxml/tests/bug61367-read.phpt
index b4ecaa0324..97b6513094 100644
--- a/ext/libxml/tests/bug61367-read.phpt
+++ b/ext/libxml/tests/bug61367-read.phpt
@@ -1,35 +1,34 @@
--TEST--
Bug #61367: open_basedir bypass in libxml RSHUTDOWN: read test
--SKIPIF--
-<?php if(!extension_loaded('dom')) echo 'skip'; ?>
+<?php if(!extension_loaded('dom')) echo 'skip dom extension not available'; ?>
--INI--
open_basedir=.
-error_reporting=E_ALL & ~E_NOTICE
--FILE--
<?php
/*
* Note: Using error_reporting=E_ALL & ~E_NOTICE to suppress "Trying to get property of non-object" notices.
*/
class StreamExploiter {
- public function stream_close ( ) {
- $doc = new DOMDocument;
- $doc->resolveExternals = true;
- $doc->substituteEntities = true;
- $dir = htmlspecialchars(dirname(getcwd()));
- $dir = str_replace('\\', '/', $dir); // fix for windows
- $doc->loadXML( <<<XML
+ public function stream_close ( ) {
+ $doc = new DOMDocument;
+ $doc->resolveExternals = true;
+ $doc->substituteEntities = true;
+ $dir = htmlspecialchars(dirname(getcwd()));
+ $dir = str_replace('\\', '/', $dir); // fix for windows
+ $doc->loadXML( <<<XML
<!DOCTYPE doc [
- <!ENTITY file SYSTEM "file:///$dir/bad">
+ <!ENTITY file SYSTEM "file:///$dir/bad">
]>
<doc>&file;</doc>
XML
- );
- print $doc->documentElement->firstChild->nodeValue;
- }
+ );
+ print $doc->documentElement->firstChild->nodeValue;
+ }
- public function stream_open ( $path , $mode , $options , &$opened_path ) {
- return true;
- }
+ public function stream_open ( $path , $mode , $options , &$opened_path ) {
+ return true;
+ }
}
var_dump(mkdir('test_bug_61367-read'));
@@ -58,3 +57,7 @@ Warning: DOMDocument::loadXML(): I/O warning : failed to load external entity "f
Warning: DOMDocument::loadXML(): Failure to process entity file in Entity, line: 4 in %s on line %d
Warning: DOMDocument::loadXML(): Entity 'file' not defined in Entity, line: 4 in %s on line %d
+
+Warning: Trying to get property 'firstChild' of non-object in %s on line %d
+
+Warning: Trying to get property 'nodeValue' of non-object in %s on line %d
diff --git a/ext/libxml/tests/bug61367-write.phpt b/ext/libxml/tests/bug61367-write.phpt
index 155c9aba9d..f84de1076b 100644
--- a/ext/libxml/tests/bug61367-write.phpt
+++ b/ext/libxml/tests/bug61367-write.phpt
@@ -1,22 +1,22 @@
--TEST--
Bug #61367: open_basedir bypass in libxml RSHUTDOWN: write test
--SKIPIF--
-<?php if(!extension_loaded('dom')) echo 'skip'; ?>
+<?php if(!extension_loaded('dom')) echo 'skip dom extension not available'; ?>
--INI--
open_basedir=.
--FILE--
<?php
class StreamExploiter {
- public function stream_close ( ) {
- $doc = new DOMDocument;
- $doc->appendChild($doc->createTextNode('hello'));
- var_dump($doc->save(dirname(getcwd()) . '/bad'));
- }
+ public function stream_close ( ) {
+ $doc = new DOMDocument;
+ $doc->appendChild($doc->createTextNode('hello'));
+ var_dump($doc->save(dirname(getcwd()) . '/bad'));
+ }
- public function stream_open ( $path , $mode , $options , &$opened_path ) {
- return true;
- }
+ public function stream_open ( $path , $mode , $options , &$opened_path ) {
+ return true;
+ }
}
var_dump(mkdir('test_bug_61367-write'));
@@ -42,5 +42,5 @@ bool(true)
Warning: DOMDocument::save(): open_basedir restriction in effect. File(%s) is not within the allowed path(s): (.) in %s on line %d
-Warning: DOMDocument::save(%s): failed to open stream: Operation not permitted in %s on line %d
+Warning: DOMDocument::save(%s): Failed to open stream: Operation not permitted in %s on line %d
bool(false)
diff --git a/ext/libxml/tests/bug63389.phpt b/ext/libxml/tests/bug63389.phpt
index e9498aae08..92c3e83567 100644
--- a/ext/libxml/tests/bug63389.phpt
+++ b/ext/libxml/tests/bug63389.phpt
@@ -1,14 +1,18 @@
--TEST--
Bug #63389 (Missing context check on libxml_set_streams_context() causes memleak)
--SKIPIF--
-<?php if (!extension_loaded('libxml')) die('skip'); ?>
+<?php if (!extension_loaded('libxml')) die('skip libxml extension not available'); ?>
--FILE--
<?php
$fp = fopen("php://input", "r");
libxml_set_streams_context($fp);
-libxml_set_streams_context("a");
+try {
+ libxml_set_streams_context("a");
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "okey";
?>
---EXPECTF--
-Warning: libxml_set_streams_context() expects parameter 1 to be resource, string given in %sbug63389.php on line %d
+--EXPECT--
+libxml_set_streams_context() expects parameter 1 to be resource, string given
okey
diff --git a/ext/libxml/tests/bug76777.phpt b/ext/libxml/tests/bug76777.phpt
index ce111178f3..5e15024b81 100644
--- a/ext/libxml/tests/bug76777.phpt
+++ b/ext/libxml/tests/bug76777.phpt
@@ -2,7 +2,7 @@
Bug #76777 (first parameter of libxml_set_external_entity_loader callback undefined)
--SKIPIF--
<?php
-if (!extension_loaded('libxml')) die('skip');
+if (!extension_loaded('libxml')) die('skip libxml extension not available');
if (!extension_loaded('dom')) die('skip dom extension not available');
if (getenv("SKIP_ONLINE_TESTS")) die('skip online test');
?>
diff --git a/ext/libxml/tests/libxml_disable_entity_loader.phpt b/ext/libxml/tests/libxml_disable_entity_loader.phpt
index 6477543fb2..7633a889f3 100644
--- a/ext/libxml/tests/libxml_disable_entity_loader.phpt
+++ b/ext/libxml/tests/libxml_disable_entity_loader.phpt
@@ -1,7 +1,10 @@
--TEST--
libxml_disable_entity_loader()
--SKIPIF--
-<?php if (!extension_loaded('libxml') || !extension_loaded('dom') || defined('PHP_WINDOWS_VERSION_MAJOR')) die('skip'); ?>
+<?php
+if (!extension_loaded('libxml')) die('skip libxml extension not available');
+if (!extension_loaded('dom')) die('skip dom extension not available');
+if (defined('PHP_WINDOWS_VERSION_MAJOR')) die('skip not for Windows'); ?>
--FILE--
<?php
diff --git a/ext/libxml/tests/libxml_set_external_entity_loader_basic.phpt b/ext/libxml/tests/libxml_set_external_entity_loader_basic.phpt
index 938229ff86..b8b7b7f796 100644
--- a/ext/libxml/tests/libxml_set_external_entity_loader_basic.phpt
+++ b/ext/libxml/tests/libxml_set_external_entity_loader_basic.phpt
@@ -1,7 +1,7 @@
--TEST--
libxml_set_external_entity_loader() basic test
--SKIPIF--
-<?php if (!extension_loaded('dom')) die('skip'); ?>
+<?php if (!extension_loaded('dom')) die('skip dom extension not available'); ?>
--FILE--
<?php
$xml = <<<XML
@@ -14,15 +14,15 @@ $dtd = <<<DTD
DTD;
libxml_set_external_entity_loader(
- function ($public, $system, $context) use($dtd){
- var_dump($public);
- var_dump($system);
- var_dump($context);
- $f = fopen("php://temp", "r+");
- fwrite($f, $dtd);
- rewind($f);
- return $f;
- }
+ function ($public, $system, $context) use($dtd){
+ var_dump($public);
+ var_dump($system);
+ var_dump($context);
+ $f = fopen("php://temp", "r+");
+ fwrite($f, $dtd);
+ rewind($f);
+ return $f;
+ }
);
$dd = new DOMDocument;
diff --git a/ext/libxml/tests/libxml_set_external_entity_loader_error1.phpt b/ext/libxml/tests/libxml_set_external_entity_loader_error1.phpt
index 40b31ea85d..ea0764f980 100644
--- a/ext/libxml/tests/libxml_set_external_entity_loader_error1.phpt
+++ b/ext/libxml/tests/libxml_set_external_entity_loader_error1.phpt
@@ -1,7 +1,7 @@
--TEST--
libxml_set_external_entity_loader() error: bad arguments
--SKIPIF--
-<?php if (!extension_loaded('dom')) die('skip'); ?>
+<?php if (!extension_loaded('dom')) die('skip dom extension not available'); ?>
--FILE--
<?php
$xml = <<<XML
@@ -12,27 +12,15 @@ XML;
$dd = new DOMDocument;
$r = $dd->loadXML($xml);
-var_dump(libxml_set_external_entity_loader([]));
-var_dump(libxml_set_external_entity_loader());
-var_dump(libxml_set_external_entity_loader(function() {}, 2));
-
var_dump(libxml_set_external_entity_loader(function($a, $b, $c, $d) {}));
try {
- var_dump($dd->validate());
+ var_dump($dd->validate());
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
echo "Done.\n";
--EXPECTF--
-Warning: libxml_set_external_entity_loader() expects parameter 1 to be a valid callback, array must have exactly two members in %s on line %d
-NULL
-
-Warning: libxml_set_external_entity_loader() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: libxml_set_external_entity_loader() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
bool(true)
Warning: DOMDocument::validate(): Could not load the external subset "http://example.com/foobar" in %s on line %d
diff --git a/ext/libxml/tests/libxml_set_external_entity_loader_variation1.phpt b/ext/libxml/tests/libxml_set_external_entity_loader_variation1.phpt
index d65f77e9f8..61c82d3275 100644
--- a/ext/libxml/tests/libxml_set_external_entity_loader_variation1.phpt
+++ b/ext/libxml/tests/libxml_set_external_entity_loader_variation1.phpt
@@ -1,7 +1,7 @@
--TEST--
libxml_set_external_entity_loader() variation: resolve externals and entities
--SKIPIF--
-<?php if (!extension_loaded('dom')) die('skip'); ?>
+<?php if (!extension_loaded('dom')) die('skip dom extension not available'); ?>
--FILE--
<?php
chdir(__DIR__);
@@ -23,17 +23,17 @@ $entity = <<<ENT
ENT;
libxml_set_external_entity_loader(
- function ($public, $system, $context) use($dtd,$entity){
- static $first = true;
- var_dump($public);
- var_dump($system);
- var_dump($context);
- $f = fopen("php://temp", "r+");
- fwrite($f, $first ? $dtd : $entity);
- $first = false;
- rewind($f);
- return $f;
- }
+ function ($public, $system, $context) use($dtd,$entity){
+ static $first = true;
+ var_dump($public);
+ var_dump($system);
+ var_dump($context);
+ $f = fopen("php://temp", "r+");
+ fwrite($f, $first ? $dtd : $entity);
+ $first = false;
+ rewind($f);
+ return $f;
+ }
);
$dd = new DOMDocument;
diff --git a/ext/libxml/tests/libxml_set_external_entity_loader_variation2.phpt b/ext/libxml/tests/libxml_set_external_entity_loader_variation2.phpt
index e51869cf47..122ec5c09d 100644
--- a/ext/libxml/tests/libxml_set_external_entity_loader_variation2.phpt
+++ b/ext/libxml/tests/libxml_set_external_entity_loader_variation2.phpt
@@ -1,7 +1,7 @@
--TEST--
libxml_set_external_entity_loader() variation: restore original handler; returning NULL
--SKIPIF--
-<?php if (!extension_loaded('dom')) die('skip'); ?>
+<?php if (!extension_loaded('dom')) die('skip dom extension not available'); ?>
--CLEAN--
<?php
@unlink(__DIR__ . "/foobar.dtd");
@@ -19,10 +19,10 @@ DTD;
libxml_set_external_entity_loader(
- function ($public, $system, $context) {
- var_dump($public,$system);
- return null;
- }
+ function ($public, $system, $context) {
+ var_dump($public,$system);
+ return null;
+ }
);
$dd = new DOMDocument;
diff --git a/ext/mbstring/libmbfl/filters/mbfilter_iso2022jp_mobile.c b/ext/mbstring/libmbfl/filters/mbfilter_iso2022jp_mobile.c
index 11307682d6..ecfdee1109 100644
--- a/ext/mbstring/libmbfl/filters/mbfilter_iso2022jp_mobile.c
+++ b/ext/mbstring/libmbfl/filters/mbfilter_iso2022jp_mobile.c
@@ -48,7 +48,7 @@ const mbfl_encoding mbfl_encoding_2022jp_kddi = {
mbfl_no_encoding_2022jp_kddi,
"ISO-2022-JP-MOBILE#KDDI",
"ISO-2022-JP",
- &mbfl_encoding_2022jp_kddi_aliases,
+ (const char *(*)[])&mbfl_encoding_2022jp_kddi_aliases,
NULL,
MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE | MBFL_ENCTYPE_GL_UNSAFE,
&vtbl_2022jp_kddi_wchar,
diff --git a/ext/mbstring/libmbfl/filters/mbfilter_uuencode.c b/ext/mbstring/libmbfl/filters/mbfilter_uuencode.c
index 590ecda997..0645ef68c6 100644
--- a/ext/mbstring/libmbfl/filters/mbfilter_uuencode.c
+++ b/ext/mbstring/libmbfl/filters/mbfilter_uuencode.c
@@ -89,7 +89,7 @@ int mbfl_filt_conv_uudec(int c, mbfl_convert_filter * filter)
}
if (filter->cache == 5)
{
- /* thats good enough - wait for a newline */
+ /* that's good enough - wait for a newline */
filter->status = uudec_state_until_newline;
filter->cache = 0;
}
diff --git a/ext/mbstring/libmbfl/mbfl/mbfilter.c b/ext/mbstring/libmbfl/mbfl/mbfilter.c
index 544eae9121..fc87744d79 100644
--- a/ext/mbstring/libmbfl/mbfl/mbfilter.c
+++ b/ext/mbstring/libmbfl/mbfl/mbfilter.c
@@ -83,6 +83,7 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
+#include "zend_operators.h"
#include <stddef.h>
#include <string.h>
@@ -657,7 +658,7 @@ filter_count_output(int c, void *data)
}
size_t
-mbfl_strlen(mbfl_string *string)
+mbfl_strlen(const mbfl_string *string)
{
size_t len, n, k;
unsigned char *p;
@@ -810,6 +811,49 @@ mbfl_oddlen(mbfl_string *string)
/* NOT REACHED */
}
+static const unsigned char *mbfl_find_offset_utf8(
+ const unsigned char *str, const unsigned char *end, ssize_t offset) {
+ if (offset < 0) {
+ const unsigned char *pos = end;
+ while (offset < 0) {
+ if (pos <= str) {
+ return NULL;
+ }
+
+ unsigned char c = *(--pos);
+ if (c < 0x80) {
+ ++offset;
+ } else if ((c & 0xc0) != 0x80) {
+ ++offset;
+ }
+ }
+ return pos;
+ } else {
+ const unsigned char *u8_tbl = mbfl_encoding_utf8.mblen_table;
+ const unsigned char *pos = str;
+ while (offset-- > 0) {
+ if (pos >= end) {
+ return NULL;
+ }
+ pos += u8_tbl[*pos];
+ }
+ return pos;
+ }
+}
+
+static size_t mbfl_pointer_to_offset_utf8(const unsigned char *start, const unsigned char *pos) {
+ size_t result = 0;
+ while (pos > start) {
+ unsigned char c = *--pos;
+ if (c < 0x80) {
+ ++result;
+ } else if ((c & 0xc0) != 0x80) {
+ ++result;
+ }
+ }
+ return result;
+}
+
size_t
mbfl_strpos(
mbfl_string *haystack,
@@ -820,25 +864,13 @@ mbfl_strpos(
size_t result;
mbfl_string _haystack_u8, _needle_u8;
const mbfl_string *haystack_u8, *needle_u8 = NULL;
- const unsigned char *u8_tbl;
-
- if (haystack == NULL || haystack->val == NULL || needle == NULL || needle->val == NULL) {
- return (size_t) -8;
- }
-
- {
- const mbfl_encoding *u8_enc = &mbfl_encoding_utf8;
- if (u8_enc->mblen_table == NULL) {
- return (size_t) -8;
- }
- u8_tbl = u8_enc->mblen_table;
- }
+ const unsigned char *offset_pointer;
if (haystack->encoding->no_encoding != mbfl_no_encoding_utf8) {
mbfl_string_init(&_haystack_u8);
haystack_u8 = mbfl_convert_encoding(haystack, &_haystack_u8, &mbfl_encoding_utf8);
if (haystack_u8 == NULL) {
- result = (size_t) -4;
+ result = MBFL_ERROR_ENCODING;
goto out;
}
} else {
@@ -849,163 +881,56 @@ mbfl_strpos(
mbfl_string_init(&_needle_u8);
needle_u8 = mbfl_convert_encoding(needle, &_needle_u8, &mbfl_encoding_utf8);
if (needle_u8 == NULL) {
- result = (size_t) -4;
+ result = MBFL_ERROR_ENCODING;
goto out;
}
} else {
needle_u8 = needle;
}
- if (needle_u8->len < 1) {
- result = (size_t) -8;
+ offset_pointer = mbfl_find_offset_utf8(
+ haystack_u8->val, haystack_u8->val + haystack_u8->len, offset);
+ if (!offset_pointer) {
+ result = MBFL_ERROR_OFFSET;
goto out;
}
- result = (size_t) -1;
+ result = MBFL_ERROR_NOT_FOUND;
if (haystack_u8->len < needle_u8->len) {
goto out;
}
+ const char *found_pos;
if (!reverse) {
- size_t jtbl[1 << (sizeof(unsigned char) * 8)];
- size_t needle_u8_len = needle_u8->len;
- size_t i;
- const unsigned char *p, *q, *e;
- const unsigned char *haystack_u8_val = haystack_u8->val,
- *needle_u8_val = needle_u8->val;
- for (i = 0; i < sizeof(jtbl) / sizeof(*jtbl); ++i) {
- jtbl[i] = needle_u8_len + 1;
- }
- for (i = 0; i < needle_u8_len - 1; ++i) {
- jtbl[needle_u8_val[i]] = needle_u8_len - i;
- }
- e = haystack_u8_val + haystack_u8->len;
- p = haystack_u8_val;
- while (offset-- > 0) {
- if (p >= e) {
- result = (size_t) -16;
- goto out;
- }
- p += u8_tbl[*p];
- }
- p += needle_u8_len;
- if (p > e) {
- goto out;
- }
- while (p <= e) {
- const unsigned char *pv = p;
- q = needle_u8_val + needle_u8_len;
- for (;;) {
- if (q == needle_u8_val) {
- result = 0;
- while (p > haystack_u8_val) {
- unsigned char c = *--p;
- if (c < 0x80) {
- ++result;
- } else if ((c & 0xc0) != 0x80) {
- ++result;
- }
- }
- goto out;
- }
- if (*--q != *--p) {
- break;
- }
- }
- p += jtbl[*p];
- if (p <= pv) {
- p = pv + 1;
- }
- }
+ found_pos = zend_memnstr(
+ (const char *) offset_pointer,
+ (const char *) needle_u8->val, needle_u8->len,
+ (const char *) haystack_u8->val + haystack_u8->len);
} else {
- size_t jtbl[1 << (sizeof(unsigned char) * 8)];
- size_t needle_u8_len = needle_u8->len, needle_len = 0;
- size_t i;
- const unsigned char *p, *e, *q, *qe;
- const unsigned char *haystack_u8_val = haystack_u8->val,
- *needle_u8_val = needle_u8->val;
- for (i = 0; i < sizeof(jtbl) / sizeof(*jtbl); ++i) {
- jtbl[i] = needle_u8_len;
- }
- for (i = needle_u8_len - 1; i > 0; --i) {
- unsigned char c = needle_u8_val[i];
- jtbl[c] = i;
- if (c < 0x80) {
- ++needle_len;
- } else if ((c & 0xc0) != 0x80) {
- ++needle_len;
- }
- }
- {
- unsigned char c = needle_u8_val[0];
- if (c < 0x80) {
- ++needle_len;
- } else if ((c & 0xc0) != 0x80) {
- ++needle_len;
- }
- }
- e = haystack_u8_val;
- p = e + haystack_u8->len;
- qe = needle_u8_val + needle_u8_len;
- if (offset < 0) {
- if (-offset > needle_len) {
- offset += needle_len;
- while (offset < 0) {
- unsigned char c;
- if (p <= e) {
- result = (size_t) -16;
- goto out;
- }
- c = *(--p);
- if (c < 0x80) {
- ++offset;
- } else if ((c & 0xc0) != 0x80) {
- ++offset;
- }
- }
- }
+ if (offset >= 0) {
+ found_pos = zend_memnrstr(
+ (const char *) offset_pointer,
+ (const char *) needle_u8->val, needle_u8->len,
+ (const char *) haystack_u8->val + haystack_u8->len);
} else {
- const unsigned char *ee = haystack_u8_val + haystack_u8->len;
- while (offset-- > 0) {
- if (e >= ee) {
- result = (size_t) -16;
- goto out;
- }
- e += u8_tbl[*e];
- }
- }
- if (p < e + needle_u8_len) {
- goto out;
- }
- p -= needle_u8_len;
- while (p >= e) {
- const unsigned char *pv = p;
- q = needle_u8_val;
- for (;;) {
- if (q == qe) {
- result = 0;
- p -= needle_u8_len;
- while (p > haystack_u8_val) {
- unsigned char c = *--p;
- if (c < 0x80) {
- ++result;
- } else if ((c & 0xc0) != 0x80) {
- ++result;
- }
- }
- goto out;
- }
- if (*q != *p) {
- break;
- }
- ++p, ++q;
- }
- p -= jtbl[*p];
- if (p >= pv) {
- p = pv - 1;
+ size_t needle_len = mbfl_strlen(needle_u8);
+ offset_pointer = mbfl_find_offset_utf8(
+ offset_pointer, haystack_u8->val + haystack_u8->len, needle_len);
+ if (!offset_pointer) {
+ offset_pointer = haystack_u8->val + haystack_u8->len;
}
+
+ found_pos = zend_memnrstr(
+ (const char *) haystack_u8->val,
+ (const char *) needle_u8->val, needle_u8->len,
+ (const char *) offset_pointer);
}
}
+
+ if (found_pos) {
+ result = mbfl_pointer_to_offset_utf8(haystack_u8->val, (const unsigned char *) found_pos);
+ }
+
out:
if (haystack_u8 == &_haystack_u8) {
mbfl_string_clear(&_haystack_u8);
@@ -1031,9 +956,6 @@ mbfl_substr_count(
mbfl_convert_filter *filter;
struct collector_strpos_data pc;
- if (haystack == NULL || needle == NULL) {
- return (size_t) -8;
- }
/* needle is converted into wchar */
mbfl_wchar_device_init(&pc.needle);
filter = mbfl_convert_filter_new(
@@ -1041,18 +963,18 @@ mbfl_substr_count(
&mbfl_encoding_wchar,
mbfl_wchar_device_output, 0, &pc.needle);
if (filter == NULL) {
- return (size_t) -4;
+ return MBFL_ERROR_ENCODING;
}
mbfl_convert_filter_feed_string(filter, needle->val, needle->len);
mbfl_convert_filter_flush(filter);
mbfl_convert_filter_delete(filter);
pc.needle_len = pc.needle.pos;
if (pc.needle.buffer == NULL) {
- return (size_t) -4;
+ return MBFL_ERROR_ENCODING;
}
- if (pc.needle_len <= 0) {
+ if (pc.needle_len == 0) {
mbfl_wchar_device_clear(&pc.needle);
- return (size_t) -2;
+ return MBFL_ERROR_EMPTY;
}
/* initialize filter and collector data */
filter = mbfl_convert_filter_new(
@@ -1061,13 +983,13 @@ mbfl_substr_count(
collector_strpos, 0, &pc);
if (filter == NULL) {
mbfl_wchar_device_clear(&pc.needle);
- return (size_t) -4;
+ return MBFL_ERROR_ENCODING;
}
pc.start = 0;
pc.output = 0;
pc.needle_pos = 0;
pc.found_pos = 0;
- pc.matched_pos = (size_t) -1;
+ pc.matched_pos = MBFL_ERROR_NOT_FOUND;
/* feed data */
p = haystack->val;
@@ -1075,12 +997,12 @@ mbfl_substr_count(
if (p != NULL) {
while (n > 0) {
if ((*filter->filter_function)(*p++, filter) < 0) {
- pc.matched_pos = (size_t) -4;
+ pc.matched_pos = MBFL_ERROR_ENCODING;
break;
}
- if (pc.matched_pos != (size_t) -1) {
+ if (pc.matched_pos != MBFL_ERROR_NOT_FOUND) {
++result;
- pc.matched_pos = (size_t) -1;
+ pc.matched_pos = MBFL_ERROR_NOT_FOUND;
pc.needle_pos = 0;
}
n--;
diff --git a/ext/mbstring/libmbfl/mbfl/mbfilter.h b/ext/mbstring/libmbfl/mbfl/mbfilter.h
index 0966e2df44..ba5f6b1df7 100644
--- a/ext/mbstring/libmbfl/mbfl/mbfilter.h
+++ b/ext/mbstring/libmbfl/mbfl/mbfilter.h
@@ -193,7 +193,7 @@ static inline int mbfl_is_error(size_t len) {
* strlen
*/
MBFLAPI extern size_t
-mbfl_strlen(mbfl_string *string);
+mbfl_strlen(const mbfl_string *string);
/*
* oddlen
@@ -201,8 +201,14 @@ mbfl_strlen(mbfl_string *string);
MBFLAPI extern size_t
mbfl_oddlen(mbfl_string *string);
+#define MBFL_ERROR_NOT_FOUND ((size_t) -1)
+#define MBFL_ERROR_ENCODING ((size_t) -4)
+#define MBFL_ERROR_EMPTY ((size_t) -8)
+#define MBFL_ERROR_OFFSET ((size_t) -16)
+
/*
- * strpos
+ * strpos.
+ * Errors: MBFL_ERROR_NOT_FOUND, MBFL_ERROR_ENCODING, MBFL_ERROR_OFFSET
*/
MBFLAPI extern size_t
mbfl_strpos(mbfl_string *haystack, mbfl_string *needle, ssize_t offset, int reverse);
diff --git a/ext/mbstring/mb_gpc.c b/ext/mbstring/mb_gpc.c
index c57e2b6be1..9651d21131 100644
--- a/ext/mbstring/mb_gpc.c
+++ b/ext/mbstring/mb_gpc.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mbstring/mb_gpc.h b/ext/mbstring/mb_gpc.h
index b83bf411aa..07c5d1137f 100644
--- a/ext/mbstring/mb_gpc.h
+++ b/ext/mbstring/mb_gpc.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c
index dcd067a390..c2716eae26 100644
--- a/ext/mbstring/mbstring.c
+++ b/ext/mbstring/mbstring.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -77,6 +75,7 @@ onig_match(re, str, end, at, region, option)
#endif
#include "zend_multibyte.h"
+#include "mbstring_arginfo.h"
/* }}} */
#if HAVE_MBSTRING
@@ -183,356 +182,6 @@ static const php_mb_nls_ident_list php_mb_default_identify_list[] = {
/* }}} */
-/* {{{ mb_overload_def mb_ovld[] */
-static const struct mb_overload_def mb_ovld[] = {
- {MB_OVERLOAD_MAIL, "mail", "mb_send_mail", "mb_orig_mail"},
- {MB_OVERLOAD_STRING, "strlen", "mb_strlen", "mb_orig_strlen"},
- {MB_OVERLOAD_STRING, "strpos", "mb_strpos", "mb_orig_strpos"},
- {MB_OVERLOAD_STRING, "strrpos", "mb_strrpos", "mb_orig_strrpos"},
- {MB_OVERLOAD_STRING, "stripos", "mb_stripos", "mb_orig_stripos"},
- {MB_OVERLOAD_STRING, "strripos", "mb_strripos", "mb_orig_strripos"},
- {MB_OVERLOAD_STRING, "strstr", "mb_strstr", "mb_orig_strstr"},
- {MB_OVERLOAD_STRING, "strrchr", "mb_strrchr", "mb_orig_strrchr"},
- {MB_OVERLOAD_STRING, "stristr", "mb_stristr", "mb_orig_stristr"},
- {MB_OVERLOAD_STRING, "substr", "mb_substr", "mb_orig_substr"},
- {MB_OVERLOAD_STRING, "strtolower", "mb_strtolower", "mb_orig_strtolower"},
- {MB_OVERLOAD_STRING, "strtoupper", "mb_strtoupper", "mb_orig_strtoupper"},
- {MB_OVERLOAD_STRING, "substr_count", "mb_substr_count", "mb_orig_substr_count"},
- {0, NULL, NULL, NULL}
-};
-/* }}} */
-
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_language, 0, 0, 0)
- ZEND_ARG_INFO(0, language)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_internal_encoding, 0, 0, 0)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_http_input, 0, 0, 0)
- ZEND_ARG_INFO(0, type)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_http_output, 0, 0, 0)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_detect_order, 0, 0, 0)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_substitute_character, 0, 0, 0)
- ZEND_ARG_INFO(0, substchar)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_preferred_mime_name, 0, 0, 1)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_parse_str, 0, 0, 1)
- ZEND_ARG_INFO(0, encoded_string)
- ZEND_ARG_INFO(1, result)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_output_handler, 0, 0, 2)
- ZEND_ARG_INFO(0, contents)
- ZEND_ARG_INFO(0, status)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_str_split, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, split_length)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_strlen, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_strpos, 0, 0, 2)
- ZEND_ARG_INFO(0, haystack)
- ZEND_ARG_INFO(0, needle)
- ZEND_ARG_INFO(0, offset)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_strrpos, 0, 0, 2)
- ZEND_ARG_INFO(0, haystack)
- ZEND_ARG_INFO(0, needle)
- ZEND_ARG_INFO(0, offset)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_stripos, 0, 0, 2)
- ZEND_ARG_INFO(0, haystack)
- ZEND_ARG_INFO(0, needle)
- ZEND_ARG_INFO(0, offset)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_strripos, 0, 0, 2)
- ZEND_ARG_INFO(0, haystack)
- ZEND_ARG_INFO(0, needle)
- ZEND_ARG_INFO(0, offset)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_strstr, 0, 0, 2)
- ZEND_ARG_INFO(0, haystack)
- ZEND_ARG_INFO(0, needle)
- ZEND_ARG_INFO(0, part)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_strrchr, 0, 0, 2)
- ZEND_ARG_INFO(0, haystack)
- ZEND_ARG_INFO(0, needle)
- ZEND_ARG_INFO(0, part)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_stristr, 0, 0, 2)
- ZEND_ARG_INFO(0, haystack)
- ZEND_ARG_INFO(0, needle)
- ZEND_ARG_INFO(0, part)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_strrichr, 0, 0, 2)
- ZEND_ARG_INFO(0, haystack)
- ZEND_ARG_INFO(0, needle)
- ZEND_ARG_INFO(0, part)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_substr_count, 0, 0, 2)
- ZEND_ARG_INFO(0, haystack)
- ZEND_ARG_INFO(0, needle)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_substr, 0, 0, 2)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, start)
- ZEND_ARG_INFO(0, length)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_strcut, 0, 0, 2)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, start)
- ZEND_ARG_INFO(0, length)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_strwidth, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_strimwidth, 0, 0, 3)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, start)
- ZEND_ARG_INFO(0, width)
- ZEND_ARG_INFO(0, trimmarker)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_convert_encoding, 0, 0, 2)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, to)
- ZEND_ARG_INFO(0, from)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_convert_case, 0, 0, 2)
- ZEND_ARG_INFO(0, sourcestring)
- ZEND_ARG_INFO(0, mode)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_strtoupper, 0, 0, 1)
- ZEND_ARG_INFO(0, sourcestring)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_strtolower, 0, 0, 1)
- ZEND_ARG_INFO(0, sourcestring)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_detect_encoding, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, encoding_list)
- ZEND_ARG_INFO(0, strict)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_mb_list_encodings, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_encoding_aliases, 0, 0, 1)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_encode_mimeheader, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, charset)
- ZEND_ARG_INFO(0, transfer)
- ZEND_ARG_INFO(0, linefeed)
- ZEND_ARG_INFO(0, indent)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_decode_mimeheader, 0, 0, 1)
- ZEND_ARG_INFO(0, string)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_convert_kana, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, option)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_convert_variables, 0, 0, 3)
- ZEND_ARG_INFO(0, to)
- ZEND_ARG_INFO(0, from)
- ZEND_ARG_VARIADIC_INFO(1, vars)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_encode_numericentity, 0, 0, 2)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, convmap)
- ZEND_ARG_INFO(0, encoding)
- ZEND_ARG_INFO(0, is_hex)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_decode_numericentity, 0, 0, 2)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, convmap)
- ZEND_ARG_INFO(0, encoding)
- ZEND_ARG_INFO(0, is_hex)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_send_mail, 0, 0, 3)
- ZEND_ARG_INFO(0, to)
- ZEND_ARG_INFO(0, subject)
- ZEND_ARG_INFO(0, message)
- ZEND_ARG_INFO(0, additional_headers)
- ZEND_ARG_INFO(0, additional_parameters)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_get_info, 0, 0, 0)
- ZEND_ARG_INFO(0, type)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_check_encoding, 0, 0, 0)
- ZEND_ARG_INFO(0, var)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_scrub, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_ord, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_chr, 0, 0, 1)
- ZEND_ARG_INFO(0, cp)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-#if HAVE_MBREGEX
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_regex_encoding, 0, 0, 0)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_ereg, 0, 0, 2)
- ZEND_ARG_INFO(0, pattern)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(1, registers)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_eregi, 0, 0, 2)
- ZEND_ARG_INFO(0, pattern)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(1, registers)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_ereg_replace, 0, 0, 3)
- ZEND_ARG_INFO(0, pattern)
- ZEND_ARG_INFO(0, replacement)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, option)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_eregi_replace, 0, 0, 3)
- ZEND_ARG_INFO(0, pattern)
- ZEND_ARG_INFO(0, replacement)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, option)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_ereg_replace_callback, 0, 0, 3)
- ZEND_ARG_INFO(0, pattern)
- ZEND_ARG_INFO(0, callback)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, option)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_split, 0, 0, 2)
- ZEND_ARG_INFO(0, pattern)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, limit)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_ereg_match, 0, 0, 2)
- ZEND_ARG_INFO(0, pattern)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, option)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_ereg_search, 0, 0, 0)
- ZEND_ARG_INFO(0, pattern)
- ZEND_ARG_INFO(0, option)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_ereg_search_pos, 0, 0, 0)
- ZEND_ARG_INFO(0, pattern)
- ZEND_ARG_INFO(0, option)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_ereg_search_regs, 0, 0, 0)
- ZEND_ARG_INFO(0, pattern)
- ZEND_ARG_INFO(0, option)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_ereg_search_init, 0, 0, 1)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, pattern)
- ZEND_ARG_INFO(0, option)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_mb_ereg_search_getregs, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_mb_ereg_search_getpos, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_ereg_search_setpos, 0, 0, 1)
- ZEND_ARG_INFO(0, position)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mb_regex_set_options, 0, 0, 0)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-#endif /* HAVE_MBREGEX */
-/* }}} */
-
/* {{{ zend_function_entry mbstring_functions[] */
static const zend_function_entry mbstring_functions[] = {
PHP_FE(mb_convert_case, arginfo_mb_convert_case)
@@ -1481,8 +1130,6 @@ PHP_INI_BEGIN()
PHP_INI_ENTRY("mbstring.http_output", NULL, PHP_INI_ALL, OnUpdate_mbstring_http_output)
STD_PHP_INI_ENTRY("mbstring.internal_encoding", NULL, PHP_INI_ALL, OnUpdate_mbstring_internal_encoding, internal_encoding_name, zend_mbstring_globals, mbstring_globals)
PHP_INI_ENTRY("mbstring.substitute_character", NULL, PHP_INI_ALL, OnUpdate_mbstring_substitute_character)
- STD_PHP_INI_ENTRY("mbstring.func_overload", "0",
- PHP_INI_SYSTEM, OnUpdateLong, func_overload, zend_mbstring_globals, mbstring_globals)
STD_PHP_INI_BOOLEAN("mbstring.encoding_translation", "0",
PHP_INI_SYSTEM | PHP_INI_PERDIR,
@@ -1504,7 +1151,7 @@ PHP_INI_BEGIN()
PHP_INI_END()
/* }}} */
-static void mbstring_internal_encoding_changed_hook() {
+static void mbstring_internal_encoding_changed_hook(void) {
/* One of the internal_encoding / input_encoding / output_encoding ini settings changed. */
if (!MBSTRG(internal_encoding_set)) {
const char *encoding = php_get_internal_encoding();
@@ -1552,7 +1199,6 @@ ZEND_TSRMLS_CACHE_UPDATE();
mbstring_globals->current_filter_illegal_mode = MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR;
mbstring_globals->current_filter_illegal_substchar = 0x3f; /* '?' */
mbstring_globals->illegalchars = 0;
- mbstring_globals->func_overload = 0;
mbstring_globals->encoding_translation = 0;
mbstring_globals->strict_detection = 0;
mbstring_globals->outconv = NULL;
@@ -1609,10 +1255,6 @@ ZEND_TSRMLS_CACHE_UPDATE();
sapi_register_post_entries(mbstr_post_entries);
}
- REGISTER_LONG_CONSTANT("MB_OVERLOAD_MAIL", MB_OVERLOAD_MAIL, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MB_OVERLOAD_STRING", MB_OVERLOAD_STRING, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("MB_OVERLOAD_REGEX", MB_OVERLOAD_REGEX, CONST_CS | CONST_PERSISTENT);
-
REGISTER_LONG_CONSTANT("MB_CASE_UPPER", PHP_UNICODE_CASE_UPPER, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("MB_CASE_LOWER", PHP_UNICODE_CASE_LOWER, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("MB_CASE_TITLE", PHP_UNICODE_CASE_TITLE, CONST_CS | CONST_PERSISTENT);
@@ -1638,39 +1280,6 @@ ZEND_TSRMLS_CACHE_UPDATE();
php_mb_rfc1867_getword_conf,
php_mb_rfc1867_basename);
- /* override original function (deprecated). */
- if (MBSTRG(func_overload)){
- zend_function *func, *orig;
- const struct mb_overload_def *p;
- zend_string *str;
-
- p = &(mb_ovld[0]);
- while (p->type > 0) {
- if ((MBSTRG(func_overload) & p->type) == p->type &&
- !zend_hash_str_exists(CG(function_table), p->save_func, strlen(p->save_func))
- ) {
- func = zend_hash_str_find_ptr(CG(function_table), p->ovld_func, strlen(p->ovld_func));
-
- if ((orig = zend_hash_str_find_ptr(CG(function_table), p->orig_func, strlen(p->orig_func))) == NULL) {
- php_error_docref("ref.mbstring", E_WARNING, "mbstring couldn't find function %s.", p->orig_func);
- return FAILURE;
- } else {
- ZEND_ASSERT(orig->type == ZEND_INTERNAL_FUNCTION);
- str = zend_string_init_interned(p->save_func, strlen(p->save_func), 1);
- zend_hash_add_mem(CG(function_table), str, orig, sizeof(zend_internal_function));
- zend_string_release_ex(str, 1);
- function_add_ref(orig);
-
- str = zend_string_init_interned(p->orig_func, strlen(p->orig_func), 1);
- zend_hash_update_mem(CG(function_table), str, func, sizeof(zend_internal_function));
- zend_string_release_ex(str, 1);
- function_add_ref(func);
- }
- }
- p++;
- }
- }
-
return SUCCESS;
}
/* }}} */
@@ -1678,24 +1287,6 @@ ZEND_TSRMLS_CACHE_UPDATE();
/* {{{ PHP_MSHUTDOWN_FUNCTION(mbstring) */
PHP_MSHUTDOWN_FUNCTION(mbstring)
{
- /* clear overloaded function. */
- if (MBSTRG(func_overload)){
- const struct mb_overload_def *p;
- zend_function *orig;
-
- p = &(mb_ovld[0]);
- while (p->type > 0) {
- if ((MBSTRG(func_overload) & p->type) == p->type &&
- (orig = zend_hash_str_find_ptr(CG(function_table), p->save_func, strlen(p->save_func)))) {
-
- zend_hash_str_update_mem(CG(function_table), p->orig_func, strlen(p->orig_func), orig, sizeof(zend_internal_function));
- function_add_ref(orig);
- zend_hash_str_del(CG(function_table), p->save_func, strlen(p->save_func));
- }
- p++;
- }
- }
-
UNREGISTER_INI_ENTRIES();
zend_multibyte_restore_functions();
@@ -1722,12 +1313,6 @@ PHP_RINIT_FUNCTION(mbstring)
php_mb_populate_current_detect_order_list();
- /* override original function. */
- if (MBSTRG(func_overload)){
- zend_error(E_DEPRECATED, "The mbstring.func_overload directive is deprecated");
-
- CG(compiler_options) |= ZEND_COMPILE_NO_BUILTIN_STRLEN;
- }
#if HAVE_MBREGEX
PHP_RINIT(mb_regex) (INIT_FUNC_ARGS_PASSTHRU);
#endif
@@ -1808,7 +1393,7 @@ PHP_FUNCTION(mb_language)
zend_string *name = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|S", &name) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (name == NULL) {
RETVAL_STRING((char *)mbfl_no_language2name(MBSTRG(language)));
@@ -1834,7 +1419,7 @@ PHP_FUNCTION(mb_internal_encoding)
const mbfl_encoding *encoding;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &name, &name_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (name == NULL) {
name = MBSTRG(current_internal_encoding) ? MBSTRG(current_internal_encoding)->name: NULL;
@@ -1869,7 +1454,7 @@ PHP_FUNCTION(mb_http_input)
retname = 1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &typ, &typ_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (typ == NULL) {
result = MBSTRG(http_input_identify);
@@ -1958,7 +1543,7 @@ PHP_FUNCTION(mb_http_output)
const mbfl_encoding *encoding;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &name, &name_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (name == NULL) {
@@ -1989,7 +1574,7 @@ PHP_FUNCTION(mb_detect_order)
zval *arg1 = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|z", &arg1) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!arg1) {
@@ -2015,7 +1600,7 @@ PHP_FUNCTION(mb_detect_order)
break;
default:
if (!try_convert_to_string(arg1)) {
- return;
+ RETURN_THROWS();
}
if (FAILURE == php_mb_parse_encoding_list(Z_STRVAL_P(arg1), Z_STRLEN_P(arg1), &list, &size, 0)) {
if (list) {
@@ -2066,7 +1651,7 @@ PHP_FUNCTION(mb_substitute_character)
zval *arg1 = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|z", &arg1) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!arg1) {
@@ -2126,7 +1711,7 @@ PHP_FUNCTION(mb_preferred_mime_name)
size_t name_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) {
- return;
+ RETURN_THROWS();
} else {
no_encoding = mbfl_name2no_encoding(name);
if (no_encoding == mbfl_no_encoding_invalid) {
@@ -2148,26 +1733,24 @@ PHP_FUNCTION(mb_preferred_mime_name)
#define IS_SJIS1(c) ((((c)>=0x81 && (c)<=0x9f) || ((c)>=0xe0 && (c)<=0xf5)) ? 1 : 0)
#define IS_SJIS2(c) ((((c)>=0x40 && (c)<=0x7e) || ((c)>=0x80 && (c)<=0xfc)) ? 1 : 0)
-/* {{{ proto bool mb_parse_str(string encoded_string [, array result])
+/* {{{ proto bool mb_parse_str(string encoded_string, array &result)
Parses GET/POST/COOKIE data and sets global variables */
PHP_FUNCTION(mb_parse_str)
{
- zval *track_vars_array = NULL;
- char *encstr = NULL;
+ zval *track_vars_array;
+ char *encstr;
size_t encstr_len;
php_mb_encoding_handler_info_t info;
const mbfl_encoding *detected;
track_vars_array = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|z", &encstr, &encstr_len, &track_vars_array) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sz", &encstr, &encstr_len, &track_vars_array) == FAILURE) {
+ RETURN_THROWS();
}
- if (track_vars_array != NULL) {
- track_vars_array = zend_try_array_init(track_vars_array);
- if (!track_vars_array) {
- return;
- }
+ track_vars_array = zend_try_array_init(track_vars_array);
+ if (!track_vars_array) {
+ RETURN_THROWS();
}
encstr = estrndup(encstr, encstr_len);
@@ -2181,22 +1764,7 @@ PHP_FUNCTION(mb_parse_str)
info.num_from_encodings = MBSTRG(http_input_list_size);
info.from_language = MBSTRG(language);
- if (track_vars_array != NULL) {
- detected = _php_mb_encoding_handler_ex(&info, track_vars_array, encstr);
- } else {
- zval tmp;
- zend_array *symbol_table;
- if (zend_forbid_dynamic_call("mb_parse_str() with a single argument") == FAILURE) {
- efree(encstr);
- return;
- }
-
- php_error_docref(NULL, E_DEPRECATED, "Calling mb_parse_str() without the result argument is deprecated");
-
- symbol_table = zend_rebuild_symbol_table();
- ZVAL_ARR(&tmp, symbol_table);
- detected = _php_mb_encoding_handler_ex(&info, &tmp, encstr);
- }
+ detected = _php_mb_encoding_handler_ex(&info, track_vars_array, encstr);
MBSTRG(http_input_identify) = detected;
@@ -2223,7 +1791,7 @@ PHP_FUNCTION(mb_output_handler)
char *s, *mimetype = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl", &arg_string, &arg_string_len, &arg_status) == FAILURE) {
- return;
+ RETURN_THROWS();
}
encoding = MBSTRG(current_http_output_encoding);
@@ -2512,6 +2080,22 @@ PHP_FUNCTION(mb_strlen)
}
/* }}} */
+static void handle_strpos_error(size_t error) {
+ switch (error) {
+ case MBFL_ERROR_NOT_FOUND:
+ break;
+ case MBFL_ERROR_ENCODING:
+ php_error_docref(NULL, E_WARNING, "Conversion error");
+ break;
+ case MBFL_ERROR_OFFSET:
+ zend_value_error("Offset not contained in string");
+ break;
+ default:
+ zend_value_error("Unknown error in mb_strpos");
+ break;
+ }
+}
+
/* {{{ proto int mb_strpos(string haystack, string needle [, int offset [, string encoding]])
Find position of first occurrence of a string within another */
PHP_FUNCTION(mb_strpos)
@@ -2523,7 +2107,7 @@ PHP_FUNCTION(mb_strpos)
size_t n;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|lS", (char **)&haystack.val, &haystack.len, (char **)&needle.val, &needle.len, &offset, &enc_name) == FAILURE) {
- return;
+ RETURN_THROWS();
}
haystack.no_language = needle.no_language = MBSTRG(language);
@@ -2532,42 +2116,11 @@ PHP_FUNCTION(mb_strpos)
RETURN_FALSE;
}
- if (offset != 0) {
- size_t slen = mbfl_strlen(&haystack);
- if (offset < 0) {
- offset += slen;
- }
- if (offset < 0 || offset > slen) {
- php_error_docref(NULL, E_WARNING, "Offset not contained in string");
- RETURN_FALSE;
- }
- }
-
- if (needle.len == 0) {
- php_error_docref(NULL, E_WARNING, "Empty delimiter");
- RETURN_FALSE;
- }
-
n = mbfl_strpos(&haystack, &needle, offset, reverse);
if (!mbfl_is_error(n)) {
RETVAL_LONG(n);
} else {
- switch (-n) {
- case 1:
- break;
- case 2:
- php_error_docref(NULL, E_WARNING, "Needle has not positive length");
- break;
- case 4:
- php_error_docref(NULL, E_WARNING, "Unknown encoding or conversion error");
- break;
- case 8:
- php_error_docref(NULL, E_NOTICE, "Argument is empty");
- break;
- default:
- php_error_docref(NULL, E_WARNING, "Unknown error in mb_strpos");
- break;
- }
+ handle_strpos_error(n);
RETVAL_FALSE;
}
}
@@ -2579,43 +2132,10 @@ PHP_FUNCTION(mb_strrpos)
{
mbfl_string haystack, needle;
zend_string *enc_name = NULL;
- zval *zoffset = NULL;
zend_long offset = 0, n;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|zS", (char **)&haystack.val, &haystack.len, (char **)&needle.val, &needle.len, &zoffset, &enc_name) == FAILURE) {
- return;
- }
-
- if (zoffset) {
- if (Z_TYPE_P(zoffset) == IS_STRING) {
- switch (Z_STRVAL_P(zoffset)[0]) {
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- case ' ':
- case '-':
- case '.':
- convert_to_long_ex(zoffset);
- offset = Z_LVAL_P(zoffset);
- break;
- default :
- enc_name = Z_STR_P(zoffset);
- php_error_docref(NULL, E_DEPRECATED,
- "Passing the encoding as third parameter is deprecated. "
- "Use an explicit zero offset");
- break;
- }
- } else {
- convert_to_long_ex(zoffset);
- offset = Z_LVAL_P(zoffset);
- }
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|lS", (char **)&haystack.val, &haystack.len, (char **)&needle.val, &needle.len, &offset, &enc_name) == FAILURE) {
+ RETURN_THROWS();
}
haystack.no_language = needle.no_language = MBSTRG(language);
@@ -2624,19 +2144,11 @@ PHP_FUNCTION(mb_strrpos)
RETURN_FALSE;
}
- if (offset != 0) {
- size_t haystack_char_len = mbfl_strlen(&haystack);
- if ((offset > 0 && offset > haystack_char_len) ||
- (offset < 0 && -offset > haystack_char_len)) {
- php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string");
- RETURN_FALSE;
- }
- }
-
n = mbfl_strpos(&haystack, &needle, offset, 1);
if (!mbfl_is_error(n)) {
RETVAL_LONG(n);
} else {
+ handle_strpos_error(n);
RETVAL_FALSE;
}
}
@@ -2652,12 +2164,7 @@ PHP_FUNCTION(mb_stripos)
zend_string *from_encoding = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|lS", (char **)&haystack.val, &haystack.len, (char **)&needle.val, &needle.len, &offset, &from_encoding) == FAILURE) {
- return;
- }
-
- if (needle.len == 0) {
- php_error_docref(NULL, E_WARNING, "Empty delimiter");
- RETURN_FALSE;
+ RETURN_THROWS();
}
n = php_mb_stripos(0, (char *)haystack.val, haystack.len, (char *)needle.val, needle.len, offset, from_encoding);
@@ -2665,6 +2172,7 @@ PHP_FUNCTION(mb_stripos)
if (!mbfl_is_error(n)) {
RETVAL_LONG(n);
} else {
+ handle_strpos_error(n);
RETVAL_FALSE;
}
}
@@ -2680,7 +2188,7 @@ PHP_FUNCTION(mb_strripos)
zend_string *from_encoding = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|lS", (char **)&haystack.val, &haystack.len, (char **)&needle.val, &needle.len, &offset, &from_encoding) == FAILURE) {
- return;
+ RETURN_THROWS();
}
n = php_mb_stripos(1, (char *)haystack.val, haystack.len, (char *)needle.val, needle.len, offset, from_encoding);
@@ -2688,6 +2196,7 @@ PHP_FUNCTION(mb_strripos)
if (!mbfl_is_error(n)) {
RETVAL_LONG(n);
} else {
+ handle_strpos_error(n);
RETVAL_FALSE;
}
}
@@ -2703,7 +2212,7 @@ PHP_FUNCTION(mb_strstr)
zend_bool part = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|bS", (char **)&haystack.val, &haystack.len, (char **)&needle.val, &needle.len, &part, &enc_name) == FAILURE) {
- return;
+ RETURN_THROWS();
}
haystack.no_language = needle.no_language = MBSTRG(language);
@@ -2712,11 +2221,6 @@ PHP_FUNCTION(mb_strstr)
RETURN_FALSE;
}
- if (needle.len == 0) {
- php_error_docref(NULL, E_WARNING, "Empty delimiter");
- RETURN_FALSE;
- }
-
n = mbfl_strpos(&haystack, &needle, 0, 0);
if (!mbfl_is_error(n)) {
if (part) {
@@ -2754,7 +2258,7 @@ PHP_FUNCTION(mb_strrchr)
zend_bool part = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|bS", (char **)&haystack.val, &haystack.len, (char **)&needle.val, &needle.len, &part, &enc_name) == FAILURE) {
- return;
+ RETURN_THROWS();
}
haystack.no_language = needle.no_language = MBSTRG(language);
@@ -2763,13 +2267,6 @@ PHP_FUNCTION(mb_strrchr)
RETURN_FALSE;
}
- if (haystack.len == 0) {
- RETURN_FALSE;
- }
- if (needle.len == 0) {
- RETURN_FALSE;
- }
-
n = mbfl_strpos(&haystack, &needle, 0, 1);
if (!mbfl_is_error(n)) {
if (part) {
@@ -2807,7 +2304,7 @@ PHP_FUNCTION(mb_stristr)
zend_string *from_encoding = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|bS", (char **)&haystack.val, &haystack.len, (char **)&needle.val, &needle.len, &part, &from_encoding) == FAILURE) {
- return;
+ RETURN_THROWS();
}
haystack.no_language = needle.no_language = MBSTRG(language);
@@ -2816,11 +2313,6 @@ PHP_FUNCTION(mb_stristr)
RETURN_FALSE;
}
- if (!needle.len) {
- php_error_docref(NULL, E_WARNING, "Empty delimiter");
- RETURN_FALSE;
- }
-
n = php_mb_stripos(0, (char *)haystack.val, haystack.len, (char *)needle.val, needle.len, 0, from_encoding);
if (mbfl_is_error(n)) {
RETURN_FALSE;
@@ -2858,7 +2350,7 @@ PHP_FUNCTION(mb_strrichr)
zend_string *from_encoding = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|bS", (char **)&haystack.val, &haystack.len, (char **)&needle.val, &needle.len, &part, &from_encoding) == FAILURE) {
- return;
+ RETURN_THROWS();
}
haystack.no_language = needle.no_language = MBSTRG(language);
@@ -2903,7 +2395,7 @@ PHP_FUNCTION(mb_substr_count)
zend_string *enc_name = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|S", (char **)&haystack.val, &haystack.len, (char **)&needle.val, &needle.len, &enc_name) == FAILURE) {
- return;
+ RETURN_THROWS();
}
haystack.no_language = needle.no_language = MBSTRG(language);
@@ -2939,7 +2431,7 @@ PHP_FUNCTION(mb_substr)
mbfl_string string, result, *ret;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl|l!S", &str, &str_len, &from, &len, &len_is_null, &encoding) == FAILURE) {
- return;
+ RETURN_THROWS();
}
string.no_language = MBSTRG(language);
@@ -2981,11 +2473,6 @@ PHP_FUNCTION(mb_substr)
real_len = 0;
}
- if (((MBSTRG(func_overload) & MB_OVERLOAD_STRING) == MB_OVERLOAD_STRING)
- && (real_from > mbfl_strlen(&string))) {
- RETURN_FALSE;
- }
-
ret = mbfl_substr(&string, &result, real_from, real_len);
if (NULL == ret) {
RETURN_FALSE;
@@ -3007,7 +2494,7 @@ PHP_FUNCTION(mb_strcut)
mbfl_string string, result, *ret;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl|l!S", (char **)&string.val, &string.len, &from, &len, &len_is_null, &encoding) == FAILURE) {
- return;
+ RETURN_THROWS();
}
string.no_language = MBSTRG(language);
@@ -3064,7 +2551,7 @@ PHP_FUNCTION(mb_strwidth)
zend_string *enc_name = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|S", (char **)&string.val, &string.len, &enc_name) == FAILURE) {
- return;
+ RETURN_THROWS();
}
string.no_language = MBSTRG(language);
@@ -3093,7 +2580,7 @@ PHP_FUNCTION(mb_strimwidth)
mbfl_string string, result, marker, *ret;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sll|sS", &str, &str_len, &from, &width, &trimmarker, &trimmarker_len, &encoding) == FAILURE) {
- return;
+ RETURN_THROWS();
}
string.no_language = marker.no_language = MBSTRG(language);
@@ -3205,9 +2692,9 @@ MBSTRING_API char *php_mb_convert_encoding_ex(const char *input, size_t length,
/* }}} */
/* {{{ MBSTRING_API char *php_mb_convert_encoding() */
-MBSTRING_API char *php_mb_convert_encoding(const char *input, size_t length, const char *_to_encoding, const char *_from_encodings, size_t *output_len)
+MBSTRING_API char *php_mb_convert_encoding(const char *input, size_t length, const mbfl_encoding *to_encoding, const char *_from_encodings, size_t *output_len)
{
- const mbfl_encoding *from_encoding, *to_encoding;
+ const mbfl_encoding *from_encoding;
if (output_len) {
*output_len = 0;
@@ -3215,16 +2702,6 @@ MBSTRING_API char *php_mb_convert_encoding(const char *input, size_t length, con
if (!input) {
return NULL;
}
- /* new encoding */
- if (_to_encoding && strlen(_to_encoding)) {
- to_encoding = mbfl_name2encoding(_to_encoding);
- if (!to_encoding) {
- php_error_docref(NULL, E_WARNING, "Unknown encoding \"%s\"", _to_encoding);
- return NULL;
- }
- } else {
- to_encoding = MBSTRG(current_internal_encoding);
- }
/* pre-conversion encoding */
from_encoding = MBSTRG(current_internal_encoding);
@@ -3257,7 +2734,7 @@ MBSTRING_API char *php_mb_convert_encoding(const char *input, size_t length, con
}
/* }}} */
-MBSTRING_API HashTable *php_mb_convert_encoding_recursive(HashTable *input, const char *_to_encoding, const char *_from_encodings)
+MBSTRING_API HashTable *php_mb_convert_encoding_recursive(HashTable *input, const mbfl_encoding *to_encoding, const char *_from_encodings)
{
HashTable *output, *chash;
zend_long idx;
@@ -3280,7 +2757,7 @@ MBSTRING_API HashTable *php_mb_convert_encoding_recursive(HashTable *input, cons
ZEND_HASH_FOREACH_KEY_VAL(input, idx, key, entry) {
/* convert key */
if (key) {
- ckey = php_mb_convert_encoding(ZSTR_VAL(key), ZSTR_LEN(key), _to_encoding, _from_encodings, &ckey_len);
+ ckey = php_mb_convert_encoding(ZSTR_VAL(key), ZSTR_LEN(key), to_encoding, _from_encodings, &ckey_len);
key = zend_string_init(ckey, ckey_len, 0);
efree(ckey);
}
@@ -3288,7 +2765,7 @@ MBSTRING_API HashTable *php_mb_convert_encoding_recursive(HashTable *input, cons
ZEND_ASSERT(entry);
switch(Z_TYPE_P(entry)) {
case IS_STRING:
- cval = php_mb_convert_encoding(Z_STRVAL_P(entry), Z_STRLEN_P(entry), _to_encoding, _from_encodings, &cval_len);
+ cval = php_mb_convert_encoding(Z_STRVAL_P(entry), Z_STRLEN_P(entry), to_encoding, _from_encodings, &cval_len);
ZVAL_STRINGL(&entry_tmp, cval, cval_len);
efree(cval);
break;
@@ -3300,7 +2777,7 @@ MBSTRING_API HashTable *php_mb_convert_encoding_recursive(HashTable *input, cons
ZVAL_COPY(&entry_tmp, entry);
break;
case IS_ARRAY:
- chash = php_mb_convert_encoding_recursive(Z_ARRVAL_P(entry), _to_encoding, _from_encodings);
+ chash = php_mb_convert_encoding_recursive(Z_ARRVAL_P(entry), to_encoding, _from_encodings);
if (chash) {
ZVAL_ARR(&entry_tmp, chash);
} else {
@@ -3334,22 +2811,27 @@ MBSTRING_API HashTable *php_mb_convert_encoding_recursive(HashTable *input, cons
PHP_FUNCTION(mb_convert_encoding)
{
zval *input;
- char *arg_new;
- size_t new_len;
zval *arg_old = NULL;
size_t size, l, n;
char *_from_encodings = NULL, *ret, *s_free = NULL;
+ zend_string *to_encoding_name;
+ const mbfl_encoding *to_encoding;
zval *hash_entry;
HashTable *target_hash;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "zs|z", &input, &arg_new, &new_len, &arg_old) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "zS|z", &input, &to_encoding_name, &arg_old) == FAILURE) {
+ RETURN_THROWS();
+ }
+
+ to_encoding = php_mb_get_encoding(to_encoding_name);
+ if (!to_encoding) {
+ RETURN_FALSE;
}
if (Z_TYPE_P(input) != IS_STRING && Z_TYPE_P(input) != IS_ARRAY) {
if (!try_convert_to_string(input)) {
- return;
+ RETURN_THROWS();
}
}
@@ -3388,7 +2870,7 @@ PHP_FUNCTION(mb_convert_encoding)
break;
default:
if (!try_convert_to_string(arg_old)) {
- return;
+ RETURN_THROWS();
}
_from_encodings = Z_STRVAL_P(arg_old);
@@ -3398,7 +2880,7 @@ PHP_FUNCTION(mb_convert_encoding)
if (Z_TYPE_P(input) == IS_STRING) {
/* new encoding */
- ret = php_mb_convert_encoding(Z_STRVAL_P(input), Z_STRLEN_P(input), arg_new, _from_encodings, &size);
+ ret = php_mb_convert_encoding(Z_STRVAL_P(input), Z_STRLEN_P(input), to_encoding, _from_encodings, &size);
if (ret != NULL) {
// TODO: avoid reallocation ???
RETVAL_STRINGL(ret, size); /* the string is already strdup()'ed */
@@ -3411,7 +2893,7 @@ PHP_FUNCTION(mb_convert_encoding)
}
} else {
HashTable *tmp;
- tmp = php_mb_convert_encoding_recursive(Z_ARRVAL_P(input), arg_new, _from_encodings);
+ tmp = php_mb_convert_encoding_recursive(Z_ARRVAL_P(input), to_encoding, _from_encodings);
RETURN_ARR(tmp);
}
@@ -3442,7 +2924,7 @@ PHP_FUNCTION(mb_convert_case)
RETVAL_FALSE;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl|S!", &str, &str_len,
&case_mode, &from_encoding) == FAILURE) {
- return;
+ RETURN_THROWS();
}
enc = php_mb_get_encoding(from_encoding);
@@ -3479,7 +2961,7 @@ PHP_FUNCTION(mb_strtoupper)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|S!", &str, &str_len,
&from_encoding) == FAILURE) {
- return;
+ RETURN_THROWS();
}
enc = php_mb_get_encoding(from_encoding);
@@ -3513,7 +2995,7 @@ PHP_FUNCTION(mb_strtolower)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|S!", &str, &str_len,
&from_encoding) == FAILURE) {
- return;
+ RETURN_THROWS();
}
enc = php_mb_get_encoding(from_encoding);
@@ -3548,7 +3030,7 @@ PHP_FUNCTION(mb_detect_encoding)
size_t size;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|z!b", &str, &str_len, &encoding_list, &strict) == FAILURE) {
- return;
+ RETURN_THROWS();
}
/* make encoding list */
@@ -3567,7 +3049,7 @@ PHP_FUNCTION(mb_detect_encoding)
break;
default:
if (!try_convert_to_string(encoding_list)) {
- return;
+ RETURN_THROWS();
}
if (FAILURE == php_mb_parse_encoding_list(Z_STRVAL_P(encoding_list), Z_STRLEN_P(encoding_list), &list, &size, 0)) {
if (list) {
@@ -3621,7 +3103,7 @@ PHP_FUNCTION(mb_list_encodings)
int i;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
array_init(return_value);
@@ -3642,7 +3124,7 @@ PHP_FUNCTION(mb_encoding_aliases)
size_t name_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
encoding = mbfl_name2encoding(name);
@@ -3679,7 +3161,7 @@ PHP_FUNCTION(mb_encode_mimeheader)
string.encoding = MBSTRG(current_internal_encoding);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|sssl", (char **)&string.val, &string.len, &charset_name, &charset_name_len, &trans_enc_name, &trans_enc_name_len, &linefeed, &linefeed_len, &indent) == FAILURE) {
- return;
+ RETURN_THROWS();
}
charset = &mbfl_encoding_pass;
@@ -3729,7 +3211,7 @@ PHP_FUNCTION(mb_decode_mimeheader)
string.encoding = MBSTRG(current_internal_encoding);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", (char **)&string.val, &string.len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
mbfl_string_init(&result);
@@ -3755,7 +3237,7 @@ PHP_FUNCTION(mb_convert_kana)
zend_string *encname = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|sS", (char **)&string.val, &string.len, &optstr, &optstr_len, &encname) == FAILURE) {
- return;
+ RETURN_THROWS();
}
/* option */
@@ -3952,7 +3434,7 @@ PHP_FUNCTION(mb_convert_variables)
int recursion_error = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sz+", &to_enc, &to_enc_len, &zfrom_enc, &args, &argc) == FAILURE) {
- return;
+ RETURN_THROWS();
}
/* new encoding */
@@ -3978,7 +3460,7 @@ PHP_FUNCTION(mb_convert_variables)
break;
default:
if (!try_convert_to_string(zfrom_enc)) {
- return;
+ RETURN_THROWS();
}
php_mb_parse_encoding_list(Z_STRVAL_P(zfrom_enc), Z_STRLEN_P(zfrom_enc), &elist, &elistsz, 0);
break;
@@ -4069,14 +3551,20 @@ php_mb_numericentity_exec(INTERNAL_FUNCTION_PARAMETERS, int type)
{
char *str, *encoding = NULL;
size_t str_len, encoding_len;
- zval *zconvmap, *hash_entry;
+ zval *hash_entry;
HashTable *target_hash;
int i, *convmap, *mapelm, mapsize=0;
zend_bool is_hex = 0;
mbfl_string string, result, *ret;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "sz|sb", &str, &str_len, &zconvmap, &encoding, &encoding_len, &is_hex) == FAILURE) {
- return;
+ if (type == 0) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sh|sb", &str, &str_len, &target_hash, &encoding, &encoding_len, &is_hex) == FAILURE) {
+ RETURN_THROWS();
+ }
+ } else {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sh|s", &str, &str_len, &target_hash, &encoding, &encoding_len) == FAILURE) {
+ RETURN_THROWS();
+ }
}
string.no_language = MBSTRG(language);
@@ -4098,23 +3586,18 @@ php_mb_numericentity_exec(INTERNAL_FUNCTION_PARAMETERS, int type)
}
/* conversion map */
- convmap = NULL;
- if (Z_TYPE_P(zconvmap) == IS_ARRAY) {
- target_hash = Z_ARRVAL_P(zconvmap);
- i = zend_hash_num_elements(target_hash);
- if (i > 0) {
- convmap = (int *)safe_emalloc(i, sizeof(int), 0);
- mapelm = convmap;
- mapsize = 0;
- ZEND_HASH_FOREACH_VAL(target_hash, hash_entry) {
- *mapelm++ = zval_get_long(hash_entry);
- mapsize++;
- } ZEND_HASH_FOREACH_END();
- }
- }
- if (convmap == NULL) {
- RETURN_FALSE;
- }
+ i = zend_hash_num_elements(target_hash);
+ if (i % 4 != 0) {
+ zend_value_error("count($convmap) must be a multiple of 4");
+ RETURN_THROWS();
+ }
+ convmap = (int *)safe_emalloc(i, sizeof(int), 0);
+ mapelm = convmap;
+ mapsize = 0;
+ ZEND_HASH_FOREACH_VAL(target_hash, hash_entry) {
+ *mapelm++ = zval_get_long(hash_entry);
+ mapsize++;
+ } ZEND_HASH_FOREACH_END();
mapsize /= 4;
ret = mbfl_html_numeric_entity(&string, &result, convmap, mapsize, type);
@@ -4383,7 +3866,7 @@ PHP_FUNCTION(mb_send_mail)
}
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sss|zS", &to, &to_len, &subject, &subject_len, &message, &message_len, &headers, &extra_cmd) == FAILURE) {
- return;
+ RETURN_THROWS();
}
/* ASCIIZ check */
@@ -4399,7 +3882,7 @@ PHP_FUNCTION(mb_send_mail)
zend_string_release_ex(tmp_headers, 0);
break;
case IS_ARRAY:
- str_headers = php_mail_build_headers(headers);
+ str_headers = php_mail_build_headers(Z_ARRVAL_P(headers));
break;
default:
php_error_docref(NULL, E_WARNING, "headers parameter must be string or array");
@@ -4627,13 +4110,12 @@ PHP_FUNCTION(mb_get_info)
size_t typ_len;
size_t n;
char *name;
- const struct mb_overload_def *over_func;
- zval row1, row2;
+ zval row;
const mbfl_language *lang = mbfl_no2language(MBSTRG(language));
const mbfl_encoding **entry;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &typ, &typ_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!typ || !strcasecmp("all", typ)) {
@@ -4650,20 +4132,6 @@ PHP_FUNCTION(mb_get_info)
if ((name = (char *)zend_ini_string("mbstring.http_output_conv_mimetypes", sizeof("mbstring.http_output_conv_mimetypes") - 1, 0)) != NULL) {
add_assoc_string(return_value, "http_output_conv_mimetypes", name);
}
- add_assoc_long(return_value, "func_overload", MBSTRG(func_overload));
- if (MBSTRG(func_overload)){
- over_func = &(mb_ovld[0]);
- array_init(&row1);
- while (over_func->type > 0) {
- if ((MBSTRG(func_overload) & over_func->type) == over_func->type ) {
- add_assoc_string(&row1, over_func->orig_func, over_func->ovld_func);
- }
- over_func++;
- }
- add_assoc_zval(return_value, "func_overload_list", &row1);
- } else {
- add_assoc_string(return_value, "func_overload_list", "no overload");
- }
if (lang != NULL) {
if ((name = (char *)mbfl_no_encoding2name(lang->mail_charset)) != NULL) {
add_assoc_string(return_value, "mail_charset", name);
@@ -4688,12 +4156,12 @@ PHP_FUNCTION(mb_get_info)
entry = MBSTRG(current_detect_order_list);
if (n > 0) {
size_t i;
- array_init(&row2);
+ array_init(&row);
for (i = 0; i < n; i++) {
- add_next_index_string(&row2, (*entry)->name);
+ add_next_index_string(&row, (*entry)->name);
entry++;
}
- add_assoc_zval(return_value, "detect_order", &row2);
+ add_assoc_zval(return_value, "detect_order", &row);
}
if (MBSTRG(current_filter_illegal_mode) == MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
add_assoc_string(return_value, "substitute_character", "none");
@@ -4725,21 +4193,6 @@ PHP_FUNCTION(mb_get_info)
if ((name = (char *)zend_ini_string("mbstring.http_output_conv_mimetypes", sizeof("mbstring.http_output_conv_mimetypes") - 1, 0)) != NULL) {
RETVAL_STRING(name);
}
- } else if (!strcasecmp("func_overload", typ)) {
- RETVAL_LONG(MBSTRG(func_overload));
- } else if (!strcasecmp("func_overload_list", typ)) {
- if (MBSTRG(func_overload)){
- over_func = &(mb_ovld[0]);
- array_init(return_value);
- while (over_func->type > 0) {
- if ((MBSTRG(func_overload) & over_func->type) == over_func->type ) {
- add_assoc_string(return_value, over_func->orig_func, over_func->ovld_func);
- }
- over_func++;
- }
- } else {
- RETVAL_STRING("no overload");
- }
} else if (!strcasecmp("mail_charset", typ)) {
if (lang != NULL && (name = (char *)mbfl_no_encoding2name(lang->mail_charset)) != NULL) {
RETVAL_STRING(name);
@@ -4947,7 +4400,7 @@ PHP_FUNCTION(mb_check_encoding)
zend_string *enc = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|zS", &input, &enc) == FAILURE) {
- return;
+ RETURN_THROWS();
}
/* FIXME: Actually check all inputs, except $_FILES file content. */
@@ -4964,7 +4417,7 @@ PHP_FUNCTION(mb_check_encoding)
}
} else {
if (!try_convert_to_string(input)) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (!php_mb_check_encoding(Z_STRVAL_P(input), Z_STRLEN_P(input), enc ? ZSTR_VAL(enc): NULL)) {
RETURN_FALSE;
@@ -5349,30 +4802,6 @@ MBSTRING_API size_t php_mb_stripos(int mode, const char *old_haystack, size_t ol
break;
}
- if (needle.len == 0) {
- break;
- }
-
- if (offset != 0) {
- size_t haystack_char_len = mbfl_strlen(&haystack);
-
- if (mode) {
- if ((offset > 0 && (size_t)offset > haystack_char_len) ||
- (offset < 0 && (size_t)(-offset) > haystack_char_len)) {
- php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string");
- break;
- }
- } else {
- if (offset < 0) {
- offset += (zend_long)haystack_char_len;
- }
- if (offset < 0 || (size_t)offset > haystack_char_len) {
- php_error_docref(NULL, E_WARNING, "Offset not contained in string");
- break;
- }
- }
- }
-
n = mbfl_strpos(&haystack, &needle, offset, mode);
} while(0);
diff --git a/ext/mbstring/mbstring.h b/ext/mbstring/mbstring.h
index eb2d0bce3f..48a33023fc 100644
--- a/ext/mbstring/mbstring.h
+++ b/ext/mbstring/mbstring.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -120,7 +118,7 @@ MBSTRING_API char *php_mb_convert_encoding_ex(
const char *input, size_t length,
const mbfl_encoding *to_encoding, const mbfl_encoding *from_encoding, size_t *output_len);
MBSTRING_API char * php_mb_convert_encoding(const char *input, size_t length,
- const char *_to_encoding,
+ const mbfl_encoding *to_encoding,
const char *_from_encodings,
size_t *output_len);
@@ -153,7 +151,6 @@ ZEND_BEGIN_MODULE_GLOBALS(mbstring)
int filter_illegal_substchar;
int current_filter_illegal_mode;
int current_filter_illegal_substchar;
- zend_long func_overload;
enum mbfl_no_language language;
zend_bool encoding_translation;
zend_bool strict_detection;
@@ -175,17 +172,6 @@ ZEND_BEGIN_MODULE_GLOBALS(mbstring)
#endif
ZEND_END_MODULE_GLOBALS(mbstring)
-#define MB_OVERLOAD_MAIL 1
-#define MB_OVERLOAD_STRING 2
-#define MB_OVERLOAD_REGEX 4
-
-struct mb_overload_def {
- int type;
- char *orig_func;
- char *ovld_func;
- char *save_func;
-};
-
#define MBSTRG(v) ZEND_MODULE_GLOBALS_ACCESSOR(mbstring, v)
#if defined(ZTS) && defined(COMPILE_DL_MBSTRING)
diff --git a/ext/mbstring/mbstring.stub.php b/ext/mbstring/mbstring.stub.php
new file mode 100644
index 0000000000..afe9f50e88
--- /dev/null
+++ b/ext/mbstring/mbstring.stub.php
@@ -0,0 +1,124 @@
+<?php
+
+function mb_language(string $language = UNKNOWN): string|bool {}
+
+function mb_internal_encoding(string $encoding = UNKNOWN): string|bool {}
+
+function mb_http_input(string $type = UNKNOWN): array|string|false {}
+
+function mb_http_output(string $encoding = UNKNOWN): string|bool {}
+
+function mb_detect_order($encoding = UNKNOWN): array|bool {}
+
+function mb_substitute_character($substchar = UNKNOWN): string|int|bool {}
+
+function mb_preferred_mime_name(string $encoding): string|false {}
+
+function mb_parse_str(string $encoded_string, &$result): bool {}
+
+function mb_output_handler(string $contents, int $status): string {}
+
+function mb_str_split(string $str, int $split_length = 1, string $encoding = UNKNOWN): array|false {}
+
+function mb_strlen(string $str, string $encoding = UNKNOWN): int|false {}
+
+function mb_strpos(string $haystack, string $needle, int $offset = 0, string $encoding = UNKNOWN): int|false {}
+
+function mb_strrpos(string $haystack, string $needle, $offset = UNBEK, string $encoding = UNKNOWN): int|false {}
+
+function mb_stripos(string $haystack, string $needle, int $offset = 0, string $encoding = UNKNOWN): int|false {}
+
+function mb_strripos(string $haystack, string $needle, int $offset = 0, string $encoding = UNKNOWN): int|false {}
+
+function mb_strstr(string $haystack, string $needle, bool $part = false, string $encoding = UNKNOWN): string|false {}
+
+function mb_strrchr(string $haystack, string $needle, bool $part = false, string $encoding = UNKNOWN): string|false {}
+
+function mb_stristr(string $haystack, string $needle, bool $part = false, string $encoding = UNKNOWN): string|false {}
+
+function mb_strrichr(string $haystack, string $needle, bool $part = false, string $encoding = UNKNOWN): string|false {}
+
+function mb_substr_count(string $haystack, string $needle, string $encoding = UNKNOWN): int|false {}
+
+function mb_substr(string $str, int $start, ?int $length = null, string $encoding = UNKNOWN): string|false {}
+
+function mb_strcut(string $str, int $start, ?int $length = null, string $encoding = UNKNOWN): string|false {}
+
+function mb_strwidth(string $str, string $encoding = UNKNOWN): int|false {}
+
+function mb_strimwidth(string $str, int $start, int $width, string $trimmarker = UNKNOWN, string $encoding = UNKNOWN): string|false {}
+
+/** @param array|string $str */
+function mb_convert_encoding($str, string $to, $from = UNKNOWN): array|string|false {}
+
+function mb_convert_case(string $sourcestring, int $mode, ?string $encoding = null): string|false {}
+
+function mb_strtoupper(string $sourcestring, ?string $encoding = null): string|false {}
+
+function mb_strtolower(string $sourcestring, ?string $encoding = null): string|false {}
+
+/** @param array|string $encoding_list */
+function mb_detect_encoding(string $str, $encoding_list = null, bool $strict = false): string|false {}
+
+function mb_list_encodings(): array {}
+
+function mb_encoding_aliases(string $encoding): array|false {}
+
+function mb_encode_mimeheader(string $str, string $charset = UNKNOWN, string $transfer = UNKNOWN, string $linefeed = UNKNOWN, int $indent = 0): string|false {}
+
+function mb_decode_mimeheader(string $string): string|false {}
+
+function mb_convert_kana(string $str, string $option = UNKNOWN, string $encoding = UNKNOWN): string|false {}
+
+/** @param array|string $from */
+function mb_convert_variables(string $to, $from, &$var, &...$vars): string|false {}
+
+function mb_encode_numericentity(string $string, array $convmap, string $encoding = UNKNOWN, bool $is_hex = false): string|false {}
+
+function mb_decode_numericentity(string $string, array $convmap, string $encoding = UNKNOWN): string|false {}
+
+function mb_send_mail(string $to, string $subject, string $message, $additional_headers = UNKNOWN, string $additional_parameters = UNKNOWN): bool {}
+
+function mb_get_info(string $type = UNKNOWN): array|string|int|false {}
+
+function mb_check_encoding($var = UNBEK, string $encoding = UNKNOWN): bool {}
+
+function mb_scrub(string $str, string $encoding = UNKNOWN): string|false {}
+
+function mb_ord(string $str, string $encoding = UNKNOWN): int|false {}
+
+function mb_chr(int $cp, string $encoding = UNKNOWN): string|false {}
+
+#if HAVE_MBREGEX
+function mb_regex_encoding(string $encoding = UNKNOWN): string|bool {}
+
+function mb_ereg(string $pattern, string $string, &$registers = UNKNOWN): int|false {}
+
+function mb_eregi(string $pattern, string $string, &$registers = UNKNOWN): int|false {}
+
+function mb_ereg_replace(string $pattern, string $replacement, string $string, string $option = UNKNOWN): string|false|null {}
+
+function mb_eregi_replace(string $pattern, string $replacement, string $string, string $option = UNKNOWN): string|false|null {}
+
+function mb_ereg_replace_callback(string $pattern, callable $callback, string $string, string $option = UNKNOWN): string|false|null {}
+
+function mb_split(string $pattern, string $string, int $limit = -1): array|false {}
+
+function mb_ereg_match(string $pattern, string $string, string $option = UNKNOWN): bool {}
+
+function mb_ereg_search(string $pattern = UNKNOWN, string $option = UNKNOWN): array|bool {}
+
+function mb_ereg_search_pos(string $pattern = UNKNOWN, string $option = UNKNOWN): array|bool {}
+
+function mb_ereg_search_regs(string $pattern = UNKNOWN, string $option = UNKNOWN): array|bool {}
+
+function mb_ereg_search_init(string $string, string $pattern = UNKNOWN, string $option = UNKNOWN): bool {}
+
+function mb_ereg_search_getregs(): array|false {}
+
+function mb_ereg_search_getpos(): int {}
+
+function mb_ereg_search_setpos(int $position): bool {}
+
+function mb_regex_set_options(string $options = UNKNOWN): string {}
+#endif
diff --git a/ext/mbstring/mbstring_arginfo.h b/ext/mbstring/mbstring_arginfo.h
new file mode 100644
index 0000000000..0fd3034bd9
--- /dev/null
+++ b/ext/mbstring/mbstring_arginfo.h
@@ -0,0 +1,304 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_language, 0, 0, MAY_BE_STRING|MAY_BE_BOOL)
+ ZEND_ARG_TYPE_INFO(0, language, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_internal_encoding, 0, 0, MAY_BE_STRING|MAY_BE_BOOL)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_http_input, 0, 0, MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, type, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_mb_http_output arginfo_mb_internal_encoding
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_detect_order, 0, 0, MAY_BE_ARRAY|MAY_BE_BOOL)
+ ZEND_ARG_INFO(0, encoding)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_substitute_character, 0, 0, MAY_BE_STRING|MAY_BE_LONG|MAY_BE_BOOL)
+ ZEND_ARG_INFO(0, substchar)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_preferred_mime_name, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mb_parse_str, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, encoded_string, IS_STRING, 0)
+ ZEND_ARG_INFO(1, result)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mb_output_handler, 0, 2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, contents, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, status, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_str_split, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, split_length, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_strlen, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_strpos, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, haystack, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, needle, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_strrpos, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, haystack, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, needle, IS_STRING, 0)
+ ZEND_ARG_INFO(0, offset)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_mb_stripos arginfo_mb_strpos
+
+#define arginfo_mb_strripos arginfo_mb_strpos
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_strstr, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, haystack, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, needle, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, part, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_mb_strrchr arginfo_mb_strstr
+
+#define arginfo_mb_stristr arginfo_mb_strstr
+
+#define arginfo_mb_strrichr arginfo_mb_strstr
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_substr_count, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, haystack, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, needle, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_substr, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, start, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 1)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_mb_strcut arginfo_mb_substr
+
+#define arginfo_mb_strwidth arginfo_mb_strlen
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_strimwidth, 0, 3, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, start, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, width, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, trimmarker, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_convert_encoding, 0, 2, MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, str)
+ ZEND_ARG_TYPE_INFO(0, to, IS_STRING, 0)
+ ZEND_ARG_INFO(0, from)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_convert_case, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, sourcestring, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_strtoupper, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, sourcestring, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+#define arginfo_mb_strtolower arginfo_mb_strtoupper
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_detect_encoding, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_INFO(0, encoding_list)
+ ZEND_ARG_TYPE_INFO(0, strict, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mb_list_encodings, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_encoding_aliases, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_encode_mimeheader, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, charset, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, transfer, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, linefeed, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, indent, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_decode_mimeheader, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_convert_kana, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, option, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_convert_variables, 0, 3, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, to, IS_STRING, 0)
+ ZEND_ARG_INFO(0, from)
+ ZEND_ARG_INFO(1, var)
+ ZEND_ARG_VARIADIC_INFO(1, vars)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_encode_numericentity, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, convmap, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, is_hex, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_decode_numericentity, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, convmap, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mb_send_mail, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, to, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, subject, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, message, IS_STRING, 0)
+ ZEND_ARG_INFO(0, additional_headers)
+ ZEND_ARG_TYPE_INFO(0, additional_parameters, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_get_info, 0, 0, MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, type, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mb_check_encoding, 0, 0, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, var)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_scrub, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_mb_ord arginfo_mb_strlen
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_chr, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, cp, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#if HAVE_MBREGEX
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_regex_encoding, 0, 0, MAY_BE_STRING|MAY_BE_BOOL)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if HAVE_MBREGEX
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_ereg, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_INFO(1, registers)
+ZEND_END_ARG_INFO()
+#endif
+
+#if HAVE_MBREGEX
+#define arginfo_mb_eregi arginfo_mb_ereg
+#endif
+
+#if HAVE_MBREGEX
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_ereg_replace, 0, 3, MAY_BE_STRING|MAY_BE_FALSE|MAY_BE_NULL)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, replacement, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, option, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if HAVE_MBREGEX
+#define arginfo_mb_eregi_replace arginfo_mb_ereg_replace
+#endif
+
+#if HAVE_MBREGEX
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_ereg_replace_callback, 0, 3, MAY_BE_STRING|MAY_BE_FALSE|MAY_BE_NULL)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, callback, IS_CALLABLE, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, option, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if HAVE_MBREGEX
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_split, 0, 2, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, limit, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if HAVE_MBREGEX
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mb_ereg_match, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, option, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if HAVE_MBREGEX
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_ereg_search, 0, 0, MAY_BE_ARRAY|MAY_BE_BOOL)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, option, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if HAVE_MBREGEX
+#define arginfo_mb_ereg_search_pos arginfo_mb_ereg_search
+#endif
+
+#if HAVE_MBREGEX
+#define arginfo_mb_ereg_search_regs arginfo_mb_ereg_search
+#endif
+
+#if HAVE_MBREGEX
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mb_ereg_search_init, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, option, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if HAVE_MBREGEX
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mb_ereg_search_getregs, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE)
+ZEND_END_ARG_INFO()
+#endif
+
+#if HAVE_MBREGEX
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mb_ereg_search_getpos, 0, 0, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if HAVE_MBREGEX
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mb_ereg_search_setpos, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, position, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if HAVE_MBREGEX
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mb_regex_set_options, 0, 0, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c
index 882978479e..8de9d2d302 100644
--- a/ext/mbstring/php_mbregex.c
+++ b/ext/mbstring/php_mbregex.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -842,7 +840,7 @@ PHP_FUNCTION(mb_regex_encoding)
OnigEncoding mbctype;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &encoding, &encoding_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!encoding) {
@@ -890,23 +888,23 @@ static int _php_mb_onig_search(regex_t* reg, const OnigUChar* str, const OnigUCh
/* {{{ _php_mb_regex_ereg_exec */
static void _php_mb_regex_ereg_exec(INTERNAL_FUNCTION_PARAMETERS, int icase)
{
- zval *arg_pattern, *array = NULL;
- char *string;
- size_t string_len;
+ zval *array = NULL;
+ char *arg_pattern, *string;
+ size_t arg_pattern_len, string_len;
php_mb_regex_t *re;
OnigRegion *regs = NULL;
int i, match_len, beg, end;
OnigOptionType options;
char *str;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "zs|z", &arg_pattern, &string, &string_len, &array) == FAILURE) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|z", &arg_pattern, &arg_pattern_len, &string, &string_len, &array) == FAILURE) {
+ RETURN_THROWS();
}
if (array != NULL) {
array = zend_try_array_init(array);
if (!array) {
- return;
+ RETURN_THROWS();
}
}
@@ -923,25 +921,13 @@ static void _php_mb_regex_ereg_exec(INTERNAL_FUNCTION_PARAMETERS, int icase)
options |= ONIG_OPTION_IGNORECASE;
}
- /* compile the regular expression from the supplied regex */
- if (Z_TYPE_P(arg_pattern) != IS_STRING) {
- /* we convert numbers to integers and treat them as a string */
- if (Z_TYPE_P(arg_pattern) == IS_DOUBLE) {
- convert_to_long_ex(arg_pattern); /* get rid of decimal places */
- }
- if (!try_convert_to_string(arg_pattern)) {
- return;
- }
- /* don't bother doing an extended regex with just a number */
- }
-
- if (Z_STRLEN_P(arg_pattern) == 0) {
- php_error_docref(NULL, E_WARNING, "empty pattern");
+ if (arg_pattern_len == 0) {
+ php_error_docref(NULL, E_WARNING, "Empty pattern");
RETVAL_FALSE;
goto out;
}
- re = php_mbregex_compile_pattern(Z_STRVAL_P(arg_pattern), Z_STRLEN_P(arg_pattern), options, MBREX(current_mbctype), MBREX(regex_default_syntax));
+ re = php_mbregex_compile_pattern(arg_pattern, arg_pattern_len, options, MBREX(current_mbctype), MBREX(regex_default_syntax));
if (re == NULL) {
RETVAL_FALSE;
goto out;
@@ -1006,8 +992,6 @@ PHP_FUNCTION(mb_eregi)
/* {{{ _php_mb_regex_ereg_replace_exec */
static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOptionType options, int is_callable)
{
- zval *arg_pattern_zval;
-
char *arg_pattern;
size_t arg_pattern_len;
@@ -1030,7 +1014,6 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp
OnigUChar *pos;
OnigUChar *string_lim;
char *description = NULL;
- char pat_buf[6];
const mbfl_encoding *enc;
@@ -1049,20 +1032,20 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp
size_t option_str_len = 0;
if (!is_callable) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "zss|s",
- &arg_pattern_zval,
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sss|s",
+ &arg_pattern, &arg_pattern_len,
&replace, &replace_len,
&string, &string_len,
&option_str, &option_str_len) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
} else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "zfs|s",
- &arg_pattern_zval,
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sfs|s",
+ &arg_pattern, &arg_pattern_len,
&arg_replace_fci, &arg_replace_fci_cache,
&string, &string_len,
&option_str, &option_str_len) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
}
@@ -1082,28 +1065,10 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp
}
}
if (eval && !is_callable) {
- php_error_docref(NULL, E_DEPRECATED, "The 'e' option is deprecated, use mb_ereg_replace_callback instead");
- }
- if (Z_TYPE_P(arg_pattern_zval) == IS_STRING) {
- arg_pattern = Z_STRVAL_P(arg_pattern_zval);
- arg_pattern_len = Z_STRLEN_P(arg_pattern_zval);
- } else {
- php_error_docref(NULL, E_DEPRECATED,
- "Non-string patterns will be interpreted as strings in the future. "
- "Use an explicit chr() call to preserve the current behavior");
-
- /* FIXME: this code is not multibyte aware! */
- convert_to_long_ex(arg_pattern_zval);
- pat_buf[0] = (char)Z_LVAL_P(arg_pattern_zval);
- pat_buf[1] = '\0';
- pat_buf[2] = '\0';
- pat_buf[3] = '\0';
- pat_buf[4] = '\0';
- pat_buf[5] = '\0';
-
- arg_pattern = pat_buf;
- arg_pattern_len = 1;
+ php_error_docref(NULL, E_WARNING, "The 'e' option is no longer supported, use mb_ereg_replace_callback instead");
+ RETURN_FALSE;
}
+
/* create regex pattern buffer */
re = php_mbregex_compile_pattern(arg_pattern, arg_pattern_len, options, MBREX(current_mbctype), syntax);
if (re == NULL) {
@@ -1287,7 +1252,7 @@ PHP_FUNCTION(mb_split)
zend_long count = -1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|l", &arg_pattern, &arg_pattern_len, &string, &string_len, &count) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (count > 0) {
@@ -1378,7 +1343,7 @@ PHP_FUNCTION(mb_ereg_match)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|s",
&arg_pattern, &arg_pattern_len, &string, &string_len,
&option_str, &option_str_len)==FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (option_str != NULL) {
@@ -1431,7 +1396,7 @@ _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAMETERS, int mode)
OnigSyntaxType *syntax;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|ss", &arg_pattern, &arg_pattern_len, &arg_options, &arg_options_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
option = MBREX(regex_default_options);
@@ -1568,7 +1533,7 @@ PHP_FUNCTION(mb_ereg_search_init)
OnigOptionType option;
if (zend_parse_parameters(argc, "S|ss", &arg_str, &arg_pattern, &arg_pattern_len, &arg_options, &arg_options_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (argc > 1 && arg_pattern_len == 0) {
@@ -1623,6 +1588,10 @@ PHP_FUNCTION(mb_ereg_search_getregs)
size_t n, i, len, beg, end;
OnigUChar *str;
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
if (MBREX(search_regs) != NULL && Z_TYPE(MBREX(search_str)) == IS_STRING) {
array_init(return_value);
@@ -1657,6 +1626,10 @@ PHP_FUNCTION(mb_ereg_search_getregs)
Get search start position */
PHP_FUNCTION(mb_ereg_search_getpos)
{
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
RETVAL_LONG(MBREX(search_pos));
}
/* }}} */
@@ -1668,7 +1641,7 @@ PHP_FUNCTION(mb_ereg_search_setpos)
zend_long position;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &position) == FAILURE) {
- return;
+ RETURN_THROWS();
}
/* Accept negative position if length of search string can be determined */
@@ -1713,7 +1686,7 @@ PHP_FUNCTION(mb_regex_set_options)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s",
&string, &string_len) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (string != NULL) {
opt = 0;
diff --git a/ext/mbstring/php_mbregex.h b/ext/mbstring/php_mbregex.h
index 497458e603..fd7661371d 100644
--- a/ext/mbstring/php_mbregex.h
+++ b/ext/mbstring/php_mbregex.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -41,21 +39,7 @@
PHP_FE(mb_ereg_search_init, arginfo_mb_ereg_search_init) \
PHP_FE(mb_ereg_search_getregs, arginfo_mb_ereg_search_getregs) \
PHP_FE(mb_ereg_search_getpos, arginfo_mb_ereg_search_getpos) \
- PHP_FE(mb_ereg_search_setpos, arginfo_mb_ereg_search_setpos) \
- PHP_DEP_FALIAS(mbregex_encoding, mb_regex_encoding, arginfo_mb_regex_encoding) \
- PHP_DEP_FALIAS(mbereg, mb_ereg, arginfo_mb_ereg) \
- PHP_DEP_FALIAS(mberegi, mb_eregi, arginfo_mb_eregi) \
- PHP_DEP_FALIAS(mbereg_replace, mb_ereg_replace, arginfo_mb_ereg_replace) \
- PHP_DEP_FALIAS(mberegi_replace, mb_eregi_replace, arginfo_mb_eregi_replace) \
- PHP_DEP_FALIAS(mbsplit, mb_split, arginfo_mb_split) \
- PHP_DEP_FALIAS(mbereg_match, mb_ereg_match, arginfo_mb_ereg_match) \
- PHP_DEP_FALIAS(mbereg_search, mb_ereg_search, arginfo_mb_ereg_search) \
- PHP_DEP_FALIAS(mbereg_search_pos, mb_ereg_search_pos, arginfo_mb_ereg_search_pos) \
- PHP_DEP_FALIAS(mbereg_search_regs, mb_ereg_search_regs, arginfo_mb_ereg_search_regs) \
- PHP_DEP_FALIAS(mbereg_search_init, mb_ereg_search_init, arginfo_mb_ereg_search_init) \
- PHP_DEP_FALIAS(mbereg_search_getregs, mb_ereg_search_getregs, arginfo_mb_ereg_search_getregs) \
- PHP_DEP_FALIAS(mbereg_search_getpos, mb_ereg_search_getpos, arginfo_mb_ereg_search_getpos) \
- PHP_DEP_FALIAS(mbereg_search_setpos, mb_ereg_search_setpos, arginfo_mb_ereg_search_setpos)
+ PHP_FE(mb_ereg_search_setpos, arginfo_mb_ereg_search_setpos)
/* }}} */
#define PHP_MBREGEX_MAXCACHE 50
diff --git a/ext/mbstring/php_unicode.c b/ext/mbstring/php_unicode.c
index 664f760fc3..df16f20955 100644
--- a/ext/mbstring/php_unicode.c
+++ b/ext/mbstring/php_unicode.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mbstring/php_unicode.h b/ext/mbstring/php_unicode.h
index 54a43e32d0..2cd6dd9539 100644
--- a/ext/mbstring/php_unicode.h
+++ b/ext/mbstring/php_unicode.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mbstring/tests/bug20087.phpt b/ext/mbstring/tests/bug20087.phpt
deleted file mode 100644
index 1f62f08fd8..0000000000
--- a/ext/mbstring/tests/bug20087.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-Bug #20087 (Assertion failure)
---SKIPIF--
-<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
---FILE--
-<?php
-$testmoo = "blah blah";
-var_dump(mb_parse_str("testmoo"));
-var_dump($testmoo);
-var_dump(mb_parse_str("test=moo"));
-var_dump($test);
-?>
---EXPECTF--
-Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d
-bool(true)
-string(0) ""
-
-Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d
-bool(true)
-string(3) "moo"
diff --git a/ext/mbstring/tests/bug28220.phpt b/ext/mbstring/tests/bug28220.phpt
index 527fdc6fe3..6845dc3ed9 100644
--- a/ext/mbstring/tests/bug28220.phpt
+++ b/ext/mbstring/tests/bug28220.phpt
@@ -5,19 +5,19 @@ Bug #28220 (mb_strwidth() returns wrong width values for some Hangul characters)
--FILE--
<?php
$coderange = array(
- range(0x0000, 0x1fff),
- range(0xff60, 0xff9f)
+ range(0x0000, 0x1fff),
+ range(0xff60, 0xff9f)
);
foreach ($coderange as $r) {
- $ng = 0;
- foreach ($r as $c) {
- if (mb_strwidth(pack('N1', $c), 'UCS-4BE') != 2) {
- $ng++;
- }
- }
- echo "$ng\n";
+ $ng = 0;
+ foreach ($r as $c) {
+ if (mb_strwidth(pack('N1', $c), 'UCS-4BE') != 2) {
+ $ng++;
+ }
+ }
+ echo "$ng\n";
}
?>
--EXPECT--
diff --git a/ext/mbstring/tests/bug30549.phpt b/ext/mbstring/tests/bug30549.phpt
index a6007e0b38..2feadf1d5a 100644
--- a/ext/mbstring/tests/bug30549.phpt
+++ b/ext/mbstring/tests/bug30549.phpt
@@ -9,13 +9,13 @@ test('ISO-8859-8', array(0xaf => 0x00af, 0xfd => 0x200e, 0xfe => 0x200f));
test('ISO-8859-10', array(0xa4 => 0x012a ));
function test($enc, $map) {
- print "$enc\n";
+ print "$enc\n";
- foreach($map as $fromc => $toc) {
- $ustr = mb_convert_encoding(pack('C', $fromc), 'UCS-4BE', $enc);
- foreach (unpack('Nc', $ustr) as $unic);
- printf("0x%04x, 0x%04x\n", $toc, $unic);
- }
+ foreach($map as $fromc => $toc) {
+ $ustr = mb_convert_encoding(pack('C', $fromc), 'UCS-4BE', $enc);
+ foreach (unpack('Nc', $ustr) as $unic);
+ printf("0x%04x, 0x%04x\n", $toc, $unic);
+ }
}
?>
--EXPECT--
diff --git a/ext/mbstring/tests/bug43301.phpt b/ext/mbstring/tests/bug43301.phpt
deleted file mode 100644
index 6da3dd6bbe..0000000000
--- a/ext/mbstring/tests/bug43301.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-Bug #43301 (mb_ereg*_replace() crashes when replacement string is invalid PHP expression and 'e' option is used)
---SKIPIF--
-<?php
-extension_loaded('mbstring') or die('skip mbstring not available');
-if (!function_exists('mb_ereg')) die('skip mbregex support not available');
-?>
---FILE--
-<?php
-
-$ptr = 'hello';
-
-$txt = <<<doc
-hello, I have got a cr*sh on you
-doc;
-
-echo mb_ereg_replace($ptr,'$1',$txt,'e');
-
-?>
---EXPECTF--
-Deprecated: mb_ereg_replace(): The 'e' option is deprecated, use mb_ereg_replace_callback instead in %s%ebug43301.php on line %d
-
-Fatal error: Uncaught ParseError: syntax error, unexpected '1' (T_LNUMBER), expecting variable (T_VARIABLE) or '{' or '$' in %sbug43301.php(%d) : mbregex replace:1
-Stack trace:
-#0 %sbug43301.php(%d): mb_ereg_replace('hello', '$1', 'hello, I have g...', 'e')
-#1 {main}
-
-Next Error: Failed evaluating code:
-$1 in %sbug43301.php:%d
-Stack trace:
-#0 %sbug43301.php(%d): mb_ereg_replace('hello', '$1', 'hello, I have g...', 'e')
-#1 {main}
- thrown in %sbug43301.php on line %d
diff --git a/ext/mbstring/tests/bug43840.phpt b/ext/mbstring/tests/bug43840.phpt
index 9cf7cacdb9..7a3fd03094 100644
--- a/ext/mbstring/tests/bug43840.phpt
+++ b/ext/mbstring/tests/bug43840.phpt
@@ -24,14 +24,22 @@ $string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXv
$needle = base64_decode('44CC');
foreach($offsets as $i) {
- echo "\n-- Offset is $i --\n";
- echo "--Multibyte String:--\n";
- var_dump( mb_strpos($string_mb, $needle, $i, 'UTF-8') );
- echo"--ASCII String:--\n";
- var_dump(mb_strpos('This is na English ta', 'a', $i));
+ echo "\n-- Offset is $i --\n";
+ echo "--Multibyte String:--\n";
+ try {
+ var_dump( mb_strpos($string_mb, $needle, $i, 'UTF-8') );
+ } catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
+ echo"--ASCII String:--\n";
+ try {
+ var_dump(mb_strpos('This is na English ta', 'a', $i));
+ } catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
}
?>
---EXPECTF--
+--EXPECT--
-- Offset is 20 --
--Multibyte String:--
int(20)
@@ -46,30 +54,18 @@ bool(false)
-- Offset is 22 --
--Multibyte String:--
-
-Warning: mb_strpos(): Offset not contained in string in %s on line %d
-bool(false)
+Offset not contained in string
--ASCII String:--
-
-Warning: mb_strpos(): Offset not contained in string in %s on line %d
-bool(false)
+Offset not contained in string
-- Offset is 53 --
--Multibyte String:--
-
-Warning: mb_strpos(): Offset not contained in string in %s on line %d
-bool(false)
+Offset not contained in string
--ASCII String:--
-
-Warning: mb_strpos(): Offset not contained in string in %s on line %d
-bool(false)
+Offset not contained in string
-- Offset is 54 --
--Multibyte String:--
-
-Warning: mb_strpos(): Offset not contained in string in %s on line %d
-bool(false)
+Offset not contained in string
--ASCII String:--
-
-Warning: mb_strpos(): Offset not contained in string in %s on line %d
-bool(false)
+Offset not contained in string
diff --git a/ext/mbstring/tests/bug43841.phpt b/ext/mbstring/tests/bug43841.phpt
index 01ae2a7525..4a1da505d4 100644
--- a/ext/mbstring/tests/bug43841.phpt
+++ b/ext/mbstring/tests/bug43841.phpt
@@ -17,52 +17,51 @@ function_exists('mb_strrpos') or die("skip mb_strrpos() is not available in this
*/
$offsets = array(-25, -24, -13, -12);
-$string_mb =
-base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvv
-JfvvJjvvJnjgII=');
-$needle = base64_decode('44CC');
+// Japanese string in UTF-8
+$string_mb = "日本語テキストã§ã™ã€‚0123456789。";
+$needle = "。";
foreach ($offsets as $i) {
- echo "\n-- Offset is $i --\n";
- echo "Multibyte String:\n";
- var_dump( mb_strrpos($string_mb, $needle, $i, 'UTF-8') );
- echo "ASCII String:\n";
- echo "mb_strrpos:\n";
- var_dump(mb_strrpos('This is na English ta', 'a', $i));
- echo "strrpos:\n";
- var_dump(strrpos('This is na English ta', 'a', $i));
+ echo "\n-- Offset is $i --\n";
+ echo "Multibyte String:\n";
+ try {
+ var_dump( mb_strrpos($string_mb, $needle, $i, 'UTF-8') );
+ } catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
+ echo "ASCII String:\n";
+ echo "mb_strrpos:\n";
+ try {
+ var_dump(mb_strrpos('This is na English ta', 'a', $i));
+ } catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
+ echo "strrpos:\n";
+ try {
+ var_dump(strrpos('This is na English ta', 'a', $i));
+ } catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
}
?>
---EXPECTF--
+--EXPECT--
-- Offset is -25 --
Multibyte String:
-
-Warning: mb_strrpos(): Offset is greater than the length of haystack string in %s on line %d
-bool(false)
+Offset not contained in string
ASCII String:
mb_strrpos:
-
-Warning: mb_strrpos(): Offset is greater than the length of haystack string in %s on line %d
-bool(false)
+Offset not contained in string
strrpos:
-
-Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
-bool(false)
+Offset not contained in string
-- Offset is -24 --
Multibyte String:
-
-Warning: mb_strrpos(): Offset is greater than the length of haystack string in %s on line %d
-bool(false)
+Offset not contained in string
ASCII String:
mb_strrpos:
-
-Warning: mb_strrpos(): Offset is greater than the length of haystack string in %s on line %d
-bool(false)
+Offset not contained in string
strrpos:
-
-Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
-bool(false)
+Offset not contained in string
-- Offset is -13 --
Multibyte String:
diff --git a/ext/mbstring/tests/bug43994.phpt b/ext/mbstring/tests/bug43994.phpt
index 5825a4901a..387a907c29 100644
--- a/ext/mbstring/tests/bug43994.phpt
+++ b/ext/mbstring/tests/bug43994.phpt
@@ -25,27 +25,27 @@ $inputs = array(NULL, null, false, FALSE, "", '', @$undefined_var,
$iterator = 1;
foreach($inputs as $input) {
- if(@is_array($mb_regs)){
- $mb_regs = '';
- }
- echo "\n-- Iteration $iterator --\n";
- echo "Without \$regs arg:\n";
- var_dump( mb_ereg($input, 'hello, world') );
- echo "With \$regs arg:\n";
- var_dump(mb_ereg($input, 'hello, world', $mb_regs));
- var_dump($mb_regs);
- $iterator++;
+ if(@is_array($mb_regs)){
+ $mb_regs = '';
+ }
+ echo "\n-- Iteration $iterator --\n";
+ echo "Without \$regs arg:\n";
+ var_dump( mb_ereg($input, 'hello, world') );
+ echo "With \$regs arg:\n";
+ var_dump(mb_ereg($input, 'hello, world', $mb_regs));
+ var_dump($mb_regs);
+ $iterator++;
};
?>
--EXPECTF--
-- Iteration 1 --
Without $regs arg:
-Warning: mb_ereg(): empty pattern in %s on line %d
+Warning: mb_ereg(): Empty pattern in %s on line %d
bool(false)
With $regs arg:
-Warning: mb_ereg(): empty pattern in %s on line %d
+Warning: mb_ereg(): Empty pattern in %s on line %d
bool(false)
array(0) {
}
@@ -53,11 +53,11 @@ array(0) {
-- Iteration 2 --
Without $regs arg:
-Warning: mb_ereg(): empty pattern in %s on line %d
+Warning: mb_ereg(): Empty pattern in %s on line %d
bool(false)
With $regs arg:
-Warning: mb_ereg(): empty pattern in %s on line %d
+Warning: mb_ereg(): Empty pattern in %s on line %d
bool(false)
array(0) {
}
@@ -65,11 +65,11 @@ array(0) {
-- Iteration 3 --
Without $regs arg:
-Warning: mb_ereg(): empty pattern in %s on line %d
+Warning: mb_ereg(): Empty pattern in %s on line %d
bool(false)
With $regs arg:
-Warning: mb_ereg(): empty pattern in %s on line %d
+Warning: mb_ereg(): Empty pattern in %s on line %d
bool(false)
array(0) {
}
@@ -77,11 +77,11 @@ array(0) {
-- Iteration 4 --
Without $regs arg:
-Warning: mb_ereg(): empty pattern in %s on line %d
+Warning: mb_ereg(): Empty pattern in %s on line %d
bool(false)
With $regs arg:
-Warning: mb_ereg(): empty pattern in %s on line %d
+Warning: mb_ereg(): Empty pattern in %s on line %d
bool(false)
array(0) {
}
@@ -89,11 +89,11 @@ array(0) {
-- Iteration 5 --
Without $regs arg:
-Warning: mb_ereg(): empty pattern in %s on line %d
+Warning: mb_ereg(): Empty pattern in %s on line %d
bool(false)
With $regs arg:
-Warning: mb_ereg(): empty pattern in %s on line %d
+Warning: mb_ereg(): Empty pattern in %s on line %d
bool(false)
array(0) {
}
@@ -101,11 +101,11 @@ array(0) {
-- Iteration 6 --
Without $regs arg:
-Warning: mb_ereg(): empty pattern in %s on line %d
+Warning: mb_ereg(): Empty pattern in %s on line %d
bool(false)
With $regs arg:
-Warning: mb_ereg(): empty pattern in %s on line %d
+Warning: mb_ereg(): Empty pattern in %s on line %d
bool(false)
array(0) {
}
@@ -113,11 +113,11 @@ array(0) {
-- Iteration 7 --
Without $regs arg:
-Warning: mb_ereg(): empty pattern in %s on line %d
+Warning: mb_ereg(): Empty pattern in %s on line %d
bool(false)
With $regs arg:
-Warning: mb_ereg(): empty pattern in %s on line %d
+Warning: mb_ereg(): Empty pattern in %s on line %d
bool(false)
array(0) {
}
@@ -125,11 +125,11 @@ array(0) {
-- Iteration 8 --
Without $regs arg:
-Warning: mb_ereg(): empty pattern in %s on line %d
+Warning: mb_ereg(): Empty pattern in %s on line %d
bool(false)
With $regs arg:
-Warning: mb_ereg(): empty pattern in %s on line %d
+Warning: mb_ereg(): Empty pattern in %s on line %d
bool(false)
array(0) {
}
diff --git a/ext/mbstring/tests/bug45923.phpt b/ext/mbstring/tests/bug45923.phpt
index eace49678c..37d2b13f8b 100644
--- a/ext/mbstring/tests/bug45923.phpt
+++ b/ext/mbstring/tests/bug45923.phpt
@@ -7,11 +7,15 @@ Bug #45923 (mb_st[r]ripos() offset not handled correctly)
function section($func, $haystack, $needle)
{
- echo "\n------- $func -----------\n\n";
- foreach(array(0, 3, 6, 9, 11, 12, -1, -3, -6, -20) as $offset) {
- echo "> Offset: $offset\n";
- var_dump($func($haystack,$needle,$offset));
- }
+ echo "\n------- $func -----------\n\n";
+ foreach([0, 3, 6, 9, 11, 12, -1, -3, -6, -20] as $offset) {
+ echo "> Offset: $offset\n";
+ try {
+ var_dump($func($haystack, $needle, $offset));
+ } catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
+ }
}
section('strpos' , "abc abc abc" , "abc");
@@ -26,7 +30,7 @@ section('mb_strrpos' , "â—â—‹â—† â—â—‹â—† â—â—‹â—†", "â—â—‹â—†");
section('strripos' , "abc abc abc" , "abc");
section('mb_strripos', "â—â—‹â—† â—â—‹â—† â—â—‹â—†", "â—â—‹â—†");
?>
---EXPECTF--
+--EXPECT--
------- strpos -----------
> Offset: 0
@@ -40,9 +44,7 @@ bool(false)
> Offset: 11
bool(false)
> Offset: 12
-
-Warning: strpos(): Offset not contained in string in %s on line %d
-bool(false)
+Offset not contained in string
> Offset: -1
bool(false)
> Offset: -3
@@ -50,9 +52,7 @@ int(8)
> Offset: -6
int(8)
> Offset: -20
-
-Warning: strpos(): Offset not contained in string in %s on line %d
-bool(false)
+Offset not contained in string
------- mb_strpos -----------
@@ -67,9 +67,7 @@ bool(false)
> Offset: 11
bool(false)
> Offset: 12
-
-Warning: mb_strpos(): Offset not contained in string in %s on line %d
-bool(false)
+Offset not contained in string
> Offset: -1
bool(false)
> Offset: -3
@@ -77,9 +75,7 @@ int(8)
> Offset: -6
int(8)
> Offset: -20
-
-Warning: mb_strpos(): Offset not contained in string in %s on line %d
-bool(false)
+Offset not contained in string
------- stripos -----------
@@ -94,9 +90,7 @@ bool(false)
> Offset: 11
bool(false)
> Offset: 12
-
-Warning: stripos(): Offset not contained in string in %s on line %d
-bool(false)
+Offset not contained in string
> Offset: -1
bool(false)
> Offset: -3
@@ -104,9 +98,7 @@ int(8)
> Offset: -6
int(8)
> Offset: -20
-
-Warning: stripos(): Offset not contained in string in %s on line %d
-bool(false)
+Offset not contained in string
------- mb_stripos -----------
@@ -121,9 +113,7 @@ bool(false)
> Offset: 11
bool(false)
> Offset: 12
-
-Warning: mb_stripos(): Offset not contained in string in %s on line %d
-bool(false)
+Offset not contained in string
> Offset: -1
bool(false)
> Offset: -3
@@ -131,9 +121,7 @@ int(8)
> Offset: -6
int(8)
> Offset: -20
-
-Warning: mb_stripos(): Offset not contained in string in %s on line %d
-bool(false)
+Offset not contained in string
------- strrpos -----------
@@ -148,9 +136,7 @@ bool(false)
> Offset: 11
bool(false)
> Offset: 12
-
-Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
-bool(false)
+Offset not contained in string
> Offset: -1
int(8)
> Offset: -3
@@ -158,9 +144,7 @@ int(8)
> Offset: -6
int(4)
> Offset: -20
-
-Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
-bool(false)
+Offset not contained in string
------- mb_strrpos -----------
@@ -175,9 +159,7 @@ bool(false)
> Offset: 11
bool(false)
> Offset: 12
-
-Warning: mb_strrpos(): Offset is greater than the length of haystack string in %s on line %d
-bool(false)
+Offset not contained in string
> Offset: -1
int(8)
> Offset: -3
@@ -185,9 +167,7 @@ int(8)
> Offset: -6
int(4)
> Offset: -20
-
-Warning: mb_strrpos(): Offset is greater than the length of haystack string in %s on line %d
-bool(false)
+Offset not contained in string
------- strripos -----------
@@ -202,9 +182,7 @@ bool(false)
> Offset: 11
bool(false)
> Offset: 12
-
-Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d
-bool(false)
+Offset not contained in string
> Offset: -1
int(8)
> Offset: -3
@@ -212,9 +190,7 @@ int(8)
> Offset: -6
int(4)
> Offset: -20
-
-Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d
-bool(false)
+Offset not contained in string
------- mb_strripos -----------
@@ -229,9 +205,7 @@ bool(false)
> Offset: 11
bool(false)
> Offset: 12
-
-Warning: mb_strripos(): Offset is greater than the length of haystack string in %s on line %d
-bool(false)
+Offset not contained in string
> Offset: -1
int(8)
> Offset: -3
@@ -239,6 +213,4 @@ int(8)
> Offset: -6
int(4)
> Offset: -20
-
-Warning: mb_strripos(): Offset is greater than the length of haystack string in %s on line %d
-bool(false)
+Offset not contained in string
diff --git a/ext/mbstring/tests/bug48697.phpt b/ext/mbstring/tests/bug48697.phpt
index 93644a5f05..77d1c7a710 100644
--- a/ext/mbstring/tests/bug48697.phpt
+++ b/ext/mbstring/tests/bug48697.phpt
@@ -2,8 +2,6 @@
Bug #48697 (mb_internal_encoding() value gets reset by parse_str() or mb_parse_str()
--SKIPIF--
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
---INI--
-error_reporting=E_ALL & ~E_DEPRECATED
--FILE--
<?php
ini_set('mbstring.internal_encoding', 'ISO-8859-15');
@@ -11,14 +9,15 @@ ini_set('mbstring.encoding_translation', true);
var_dump(mb_internal_encoding());
mb_internal_encoding('UTF-8');
var_dump(mb_internal_encoding());
-parse_str('a=b');
+parse_str('a=b', $ary);
var_dump(mb_internal_encoding());
mb_internal_encoding('UTF-8');
var_dump(mb_internal_encoding());
-parse_str('a=b');
+parse_str('a=b', $ary);
var_dump(mb_internal_encoding());
?>
---EXPECT--
+--EXPECTF--
+Deprecated: ini_set(): Use of mbstring.internal_encoding is deprecated in %s on line %d
string(11) "ISO-8859-15"
string(5) "UTF-8"
string(5) "UTF-8"
diff --git a/ext/mbstring/tests/bug52931.phpt b/ext/mbstring/tests/bug52931.phpt
deleted file mode 100644
index e7d7b6dda4..0000000000
--- a/ext/mbstring/tests/bug52931.phpt
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-Bug #52931 (strripos not overloaded with function overloading enabled)
---SKIPIF--
-<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
---INI--
-mbstring.func_overload = 7
---FILE--
-<?php
-
-$string = '<body>Umlauttest öüä</body>';
-
-var_dump(strlen($string));
-var_dump(mb_strlen($string));
-
-var_dump(strripos($string, '</body>'));
-var_dump(mb_strripos($string, '</body>'));
-
-?>
---EXPECT--
-Deprecated: The mbstring.func_overload directive is deprecated in Unknown on line 0
-int(27)
-int(27)
-int(20)
-int(20)
diff --git a/ext/mbstring/tests/bug52981.phpt b/ext/mbstring/tests/bug52981.phpt
index f6be08bf33..3d909635e3 100644
--- a/ext/mbstring/tests/bug52981.phpt
+++ b/ext/mbstring/tests/bug52981.phpt
@@ -6,10 +6,10 @@ Bug #52981 (Unicode properties are outdated (from Unicode 3.2))
<?php
function test($str)
{
- $upper = mb_strtoupper($str, 'UTF-8');
- $len = strlen($upper);
- for ($i = 0; $i < $len; ++$i) echo dechex(ord($upper[$i])) . ' ';
- echo "\n";
+ $upper = mb_strtoupper($str, 'UTF-8');
+ $len = strlen($upper);
+ for ($i = 0; $i < $len; ++$i) echo dechex(ord($upper[$i])) . ' ';
+ echo "\n";
}
// OK
diff --git a/ext/mbstring/tests/bug62545.phpt b/ext/mbstring/tests/bug62545.phpt
index 6a68d0dee8..49ecc559d8 100644
--- a/ext/mbstring/tests/bug62545.phpt
+++ b/ext/mbstring/tests/bug62545.phpt
@@ -11,8 +11,6 @@ var_dump(
bin2hex(mb_convert_encoding("\x81\x8d\x8f\x90\x9d", 'UTF-8', 'Windows-1252'))
);
?>
-===DONE===
--EXPECT--
string(6) "efbfbd"
string(30) "efbfbdefbfbdefbfbdefbfbdefbfbd"
-===DONE===
diff --git a/ext/mbstring/tests/bug66797.phpt b/ext/mbstring/tests/bug66797.phpt
index 3709dc2bb2..47e8c3a1a4 100644
--- a/ext/mbstring/tests/bug66797.phpt
+++ b/ext/mbstring/tests/bug66797.phpt
@@ -14,10 +14,8 @@ var_dump(
mb_substr('bar', 0x100000000, 1)
);
?>
-==DONE==
--EXPECT--
string(3) "bar"
string(3) "bar"
string(0) ""
string(0) ""
-==DONE==
diff --git a/ext/mbstring/tests/bug66964.phpt b/ext/mbstring/tests/bug66964.phpt
index c33bb67c49..b4e87a6ae1 100644
--- a/ext/mbstring/tests/bug66964.phpt
+++ b/ext/mbstring/tests/bug66964.phpt
@@ -49,16 +49,5 @@ array(5) {
[3]=>
string(21) "日本語テキスト"
[4]=>
- &array(5) {
- [0]=>
- string(21) "日本語テキスト"
- [1]=>
- string(21) "日本語テキスト"
- [2]=>
- string(21) "日本語テキスト"
- [3]=>
- string(21) "日本語テキスト"
- [4]=>
- *RECURSION*
- }
+ *RECURSION*
}
diff --git a/ext/mbstring/tests/bug72164.phpt b/ext/mbstring/tests/bug72164.phpt
index 018754e335..f90fe89938 100644
--- a/ext/mbstring/tests/bug72164.phpt
+++ b/ext/mbstring/tests/bug72164.phpt
@@ -14,5 +14,5 @@ $var8 = mb_ereg_replace($var2,$var3,$var3,$var0);
var_dump($var8);
?>
--EXPECTF--
-Deprecated: mb_ereg_replace(): The 'e' option is deprecated, use mb_ereg_replace_callback instead in %s%ebug72164.php on line %d
-string(0) ""
+Warning: mb_ereg_replace(): The 'e' option is no longer supported, use mb_ereg_replace_callback instead in %s on line %d
+bool(false)
diff --git a/ext/mbstring/tests/bug72402.phpt b/ext/mbstring/tests/bug72402.phpt
index b3fd8464b8..1237207ab1 100644
--- a/ext/mbstring/tests/bug72402.phpt
+++ b/ext/mbstring/tests/bug72402.phpt
@@ -8,11 +8,11 @@ if (!function_exists('mb_ereg')) die('skip mbregex support not available');
--FILE--
<?php
function throwit() {
- throw new Exception('it');
+ throw new Exception('it');
}
$var10 = "throwit";
try {
- $var14 = mb_ereg_replace_callback("", $var10, "");
+ $var14 = mb_ereg_replace_callback("", $var10, "");
} catch(Exception $e) {}
?>
DONE
diff --git a/ext/mbstring/tests/bug72994.phpt b/ext/mbstring/tests/bug72994.phpt
deleted file mode 100644
index c9d2c9acf2..0000000000
--- a/ext/mbstring/tests/bug72994.phpt
+++ /dev/null
@@ -1,21 +0,0 @@
---TEST--
-Bug #72994 (mbc_to_code() out of bounds read)
---SKIPIF--
-<?php
-if (!extension_loaded('mbstring')) die('skip mbstring extension not available');
-if (!function_exists('mb_ereg_replace')) die('skip mb_ereg_replace() not available');
-?>
---FILE--
-<?php
-$var1 = mb_ereg_replace($var-232338951,NULL,NULL,NULL);
-var_dump($var1);
-?>
-===DONE===
---EXPECTF--
-Notice: Undefined variable: var in %s on line %d
-
-Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-
-Warning: mb_ereg_replace(): Pattern is not valid under UTF-8 encoding in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/mbstring/tests/bug73646.phpt b/ext/mbstring/tests/bug73646.phpt
index 7ac824d69c..ea57017f11 100644
--- a/ext/mbstring/tests/bug73646.phpt
+++ b/ext/mbstring/tests/bug73646.phpt
@@ -7,10 +7,7 @@ if (!function_exists('mb_ereg')) die('skip mbregex support not available');
?>
--FILE--
<?php
-
-$v1=str_repeat("#", -1);
-var_dump(mb_ereg_search_init($v1));
+var_dump(mb_ereg_search_init(NULL));
?>
---EXPECTF--
-Warning: str_repeat(): Second argument has to be greater than or equal to 0 in %sbug73646.php on line %d
+--EXPECT--
bool(true)
diff --git a/ext/mbstring/tests/bug76704.phpt b/ext/mbstring/tests/bug76704.phpt
index 502f7e3ef6..0b64460943 100644
--- a/ext/mbstring/tests/bug76704.phpt
+++ b/ext/mbstring/tests/bug76704.phpt
@@ -9,8 +9,6 @@ if (!extension_loaded('mbstring')) die('skip mbstring extension not available');
var_dump(mb_detect_order('Foo, UTF-8'));
var_dump(mb_detect_order(['Foo', 'UTF-8']))
?>
-===DONE===
--EXPECT--
bool(false)
bool(false)
-===DONE===
diff --git a/ext/mbstring/tests/bug79149.phpt b/ext/mbstring/tests/bug79149.phpt
index fe2007536e..7bc8e991fa 100644
--- a/ext/mbstring/tests/bug79149.phpt
+++ b/ext/mbstring/tests/bug79149.phpt
@@ -14,9 +14,9 @@ var_dump(mb_convert_encoding('foo', 'UTF-8', array("foo\0bar")));
Warning: mb_convert_encoding(): Illegal character encoding specified in %s on line %d
string(0) ""
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
Warning: mb_convert_encoding(): Illegal character encoding specified in %s on line %d
string(3) "foo"
diff --git a/ext/mbstring/tests/casefold.phpt b/ext/mbstring/tests/casefold.phpt
index 2138aff255..2f872da1b5 100644
--- a/ext/mbstring/tests/casefold.phpt
+++ b/ext/mbstring/tests/casefold.phpt
@@ -10,11 +10,11 @@ function_exists('mb_convert_case' ) or die("skip mb_convert_case() is not availa
output_handler=
--FILE--
<?php
- mb_internal_encoding( 'ISO-8859-1' );
- print mb_strtolower( "ABCDEFGHIJKLMNOPQRSTUVWXYZ\n" );
- print mb_strtoupper( mb_strtolower( "ABCDEFGHIJKLMNOPQRSTUVWXYZ\n" ) );
- print mb_strtoupper( "äëï\n" );
- print mb_convert_case( "äëï\n", MB_CASE_TITLE );
+ mb_internal_encoding( 'ISO-8859-1' );
+ print mb_strtolower( "ABCDEFGHIJKLMNOPQRSTUVWXYZ\n" );
+ print mb_strtoupper( mb_strtolower( "ABCDEFGHIJKLMNOPQRSTUVWXYZ\n" ) );
+ print mb_strtoupper( "äëï\n" );
+ print mb_convert_case( "äëï\n", MB_CASE_TITLE );
?>
--EXPECT--
abcdefghijklmnopqrstuvwxyz
diff --git a/ext/mbstring/tests/common.inc b/ext/mbstring/tests/common.inc
index c8467a29f5..2ee26bbfd5 100644
--- a/ext/mbstring/tests/common.inc
+++ b/ext/mbstring/tests/common.inc
@@ -5,18 +5,18 @@
// Var def for testing
$t_ary = array(
- 's1' => 'ÆüËܸìEUC-JP¤Îʸ»úÎó',
- 's2' => 'English Text'
- );
+ 's1' => 'ÆüËܸìEUC-JP¤Îʸ»úÎó',
+ 's2' => 'English Text'
+ );
class tc
{
- public $s1 = 'ÆüËܸìEUC-JP¤Îʸ»úÎó';
- public $s2 = 'English Text';
+ public $s1 = 'ÆüËܸìEUC-JP¤Îʸ»úÎó';
+ public $s2 = 'English Text';
- function __construct()
- {
- }
+ function __construct()
+ {
+ }
}
$t_obj = new tc;
diff --git a/ext/mbstring/tests/htmlent.phpt b/ext/mbstring/tests/htmlent.phpt
index 50235b2fed..eb251efd7b 100644
--- a/ext/mbstring/tests/htmlent.phpt
+++ b/ext/mbstring/tests/htmlent.phpt
@@ -24,18 +24,16 @@ filter.default=unsafe_raw
// If you do not see &auml;... on output this means output encoding fails.
// Using UTF-8 internally allows to encode/decode ALL characters.
// &128... will stay as they are since their character codes are above 127
-// and they do not have a named entity representaion.
+// and they do not have a named entity representation.
?>
<?php echo mb_http_input('l').'>'.mb_internal_encoding().'>'.mb_http_output();?>
<?php mb_parse_str("test=&#38;&#64;&#65;&#66;&#128;&#129;&#130;&auml;&ouml;&uuml;&euro;&lang;&rang;", $test);
print_r($test);
?>
-===DONE===
--EXPECT--
HTML-ENTITIES>UTF-8>HTML-ENTITIES
Array
(
[test] => &@AB&#128;&#129;&#130;&auml;&ouml;&uuml;&euro;&lang;&rang;
)
-===DONE===
diff --git a/ext/mbstring/tests/illformed_utf_sequences.phpt b/ext/mbstring/tests/illformed_utf_sequences.phpt
index 11ab1799e9..3b7d431a0e 100644
--- a/ext/mbstring/tests/illformed_utf_sequences.phpt
+++ b/ext/mbstring/tests/illformed_utf_sequences.phpt
@@ -5,16 +5,16 @@ Unicode standard conformance test (ill-formed UTF sequences.)
--FILE--
<?php
function chk_enc($str, $n, $enc = "UTF-8", $with_bom = false) {
- $src = bin2hex(mb_convert_encoding($str, "UCS-4BE", $enc));
- $dst = str_repeat("0000fffd", $n);
- if ($with_bom) {
- $dst = "0000feff" . $dst;
- }
- if ($dst == $src) {
- return false;
- } else {
- return $src;
- }
+ $src = bin2hex(mb_convert_encoding($str, "UCS-4BE", $enc));
+ $dst = str_repeat("0000fffd", $n);
+ if ($with_bom) {
+ $dst = "0000feff" . $dst;
+ }
+ if ($dst == $src) {
+ return false;
+ } else {
+ return $src;
+ }
}
mb_substitute_character(0xfffd);
@@ -61,12 +61,12 @@ echo "UTF-8 and surrogates area\n";
$out = '';
$cnt = 0;
for ($i = 0xd7ff; $i <= 0xe000; ++$i) {
- $s = chk_enc(pack('C3', 0xe0 | ($i >> 12), 0x80 | ($i >> 6) & 0x3f, 0x80 | $i & 0x3f), 3);
- if ($s === false) {
- $cnt++;
- } else {
- $out .= $s;
- }
+ $s = chk_enc(pack('C3', 0xe0 | ($i >> 12), 0x80 | ($i >> 6) & 0x3f, 0x80 | $i & 0x3f), 3);
+ if ($s === false) {
+ $cnt++;
+ } else {
+ $out .= $s;
+ }
}
var_dump($cnt);
var_dump($out);
@@ -88,11 +88,11 @@ $out = '';
$cnt = 0;
for ($i = 0xd7ff; $i <= 0xe000; ++$i) {
$s = chk_enc(pack('C4', $i >> 24, ($i >> 16) & 0xff, ($i >> 8) & 0xff, $i & 0xff), 1, "UTF-32BE");
- if ($s === false) {
- $cnt++;
- } else {
- $out .= $s;
- }
+ if ($s === false) {
+ $cnt++;
+ } else {
+ $out .= $s;
+ }
}
var_dump($cnt);
var_dump($out);
@@ -101,11 +101,11 @@ $out = '';
$cnt = 0;
for ($i = 0xd7ff; $i <= 0xe000; ++$i) {
$s = chk_enc(pack('C4', $i & 0xff, ($i >> 8) & 0xff, ($i >> 16) & 0xff, ($i >> 24) & 0xff), 1, "UTF-32LE");
- if ($s === false) {
- $cnt++;
- } else {
- $out .= $s;
- }
+ if ($s === false) {
+ $cnt++;
+ } else {
+ $out .= $s;
+ }
}
var_dump($cnt);
var_dump($out);
@@ -114,11 +114,11 @@ $out = '';
$cnt = 0;
for ($i = 0xd7ff; $i <= 0xe000; ++$i) {
$s = chk_enc(pack('C4', $i >> 24, ($i >> 16) & 0xff, ($i >> 8) & 0xff, $i & 0xff), 1, "UTF-32");
- if ($s === false) {
- $cnt++;
- } else {
- $out .= $s;
- }
+ if ($s === false) {
+ $cnt++;
+ } else {
+ $out .= $s;
+ }
}
var_dump($cnt);
var_dump($out);
@@ -129,12 +129,12 @@ $out = '';
$cnt = 0;
for ($i = 0xd7ff; $i <= 0xe000; ++$i) {
$s = chk_enc("\x00\x00\xfe\xff". pack('C4', $i >> 24, ($i >> 16) & 0xff, ($i >> 8) & 0xff, $i & 0xff),
- 1, "UTF-32", true);
- if ($s === false) {
- $cnt++;
- } else {
- $out .= $s;
- }
+ 1, "UTF-32", true);
+ if ($s === false) {
+ $cnt++;
+ } else {
+ $out .= $s;
+ }
}
var_dump($cnt);
var_dump(str_replace("0000feff","",$out));
@@ -143,12 +143,12 @@ $out = '';
$cnt = 0;
for ($i = 0xd7ff; $i <= 0xe000; ++$i) {
$s = chk_enc("\xff\xfe\x00\x00". pack('C4', $i & 0xff, ($i >> 8) & 0xff, ($i >> 16) & 0xff, ($i >> 24) & 0xff),
- 1, "UTF-32", true);
- if ($s === false) {
- $cnt++;
- } else {
- $out .= $s;
- }
+ 1, "UTF-32", true);
+ if ($s === false) {
+ $cnt++;
+ } else {
+ $out .= $s;
+ }
}
var_dump($cnt);
var_dump(str_replace("0000feff","",$out));
diff --git a/ext/mbstring/tests/mb_chr.phpt b/ext/mbstring/tests/mb_chr.phpt
index d61178af4d..e4d74e0d67 100644
--- a/ext/mbstring/tests/mb_chr.phpt
+++ b/ext/mbstring/tests/mb_chr.phpt
@@ -13,11 +13,11 @@ var_dump(
// Invalid
var_dump(
- mb_chr(0xd800, "typo"),
- mb_chr(0xd800, "pass"),
- mb_chr(0xd800, "jis"),
- mb_chr(0xd800, "cp50222"),
- mb_chr(0xd800, "utf-7")
+ mb_chr(0xd800, "typo"),
+ mb_chr(0xd800, "pass"),
+ mb_chr(0xd800, "jis"),
+ mb_chr(0xd800, "cp50222"),
+ mb_chr(0xd800, "utf-7")
);
?>
--EXPECTF--
diff --git a/ext/mbstring/tests/mb_chr_ord.phpt b/ext/mbstring/tests/mb_chr_ord.phpt
index 72a4220e8b..77f13dadfa 100644
--- a/ext/mbstring/tests/mb_chr_ord.phpt
+++ b/ext/mbstring/tests/mb_chr_ord.phpt
@@ -6,14 +6,14 @@ mb_chr() and mb_ord()
<?php
ini_set('internal_encoding', 'utf-8');
for($ch = 1; $ch < 80000; $ch++) {
- $str = mb_chr($ch);
- if (false === $str) {
- echo "ERROR($ch)\n";
- continue;
- }
- if ($ch != mb_ord($str)) {
- echo "REAL ERROR($ch)\n";
- }
+ $str = mb_chr($ch);
+ if (false === $str) {
+ echo "ERROR($ch)\n";
+ continue;
+ }
+ if ($ch != mb_ord($str)) {
+ echo "REAL ERROR($ch)\n";
+ }
}
echo 'OK';
--EXPECT--
diff --git a/ext/mbstring/tests/mb_convert_encoding.phpt b/ext/mbstring/tests/mb_convert_encoding.phpt
index f2fda35124..ac5d0d32a6 100644
--- a/ext/mbstring/tests/mb_convert_encoding.phpt
+++ b/ext/mbstring/tests/mb_convert_encoding.phpt
@@ -99,11 +99,6 @@ $s = $euc_jp;
$s = mb_convert_encoding($s, 'BAD');
print("BAD: $s\n"); // BAD
-$s = $euc_jp;
-$s = mb_convert_encoding($s);
-print("MP: $s\n"); // Missing parameter
-
-
?>
--EXPECTF--
== BASIC TEST ==
@@ -129,6 +124,3 @@ EUC-JP:
Warning: mb_convert_encoding(): Unknown encoding "BAD" in %s on line %d
BAD:
-
-Warning: mb_convert_encoding() expects at least 2 parameters, 1 given in %s on line %d
-MP:
diff --git a/ext/mbstring/tests/mb_convert_encoding_array.phpt b/ext/mbstring/tests/mb_convert_encoding_array.phpt
index bd413c4686..bfce6115a8 100644
--- a/ext/mbstring/tests/mb_convert_encoding_array.phpt
+++ b/ext/mbstring/tests/mb_convert_encoding_array.phpt
@@ -30,10 +30,10 @@ $utf8_string[] = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTv
function base64_encode_array($input) {
- foreach ($input as $var) {
- $ret[] = base64_encode($var);
- }
- return $ret;
+ foreach ($input as $var) {
+ $ret[] = base64_encode($var);
+ }
+ return $ret;
}
echo "\n-- Convert to JIS --\n";
diff --git a/ext/mbstring/tests/mb_convert_encoding_array2.phpt b/ext/mbstring/tests/mb_convert_encoding_array2.phpt
index 29991f2165..ac9be2dd12 100644
--- a/ext/mbstring/tests/mb_convert_encoding_array2.phpt
+++ b/ext/mbstring/tests/mb_convert_encoding_array2.phpt
@@ -41,11 +41,11 @@ $utf8_string[] = $tmp;
function base64_encode_array($input) {
- foreach ($input as $var) {
- if (is_scalar($var))
- $ret[] = base64_encode($var);
- }
- return $ret;
+ foreach ($input as $var) {
+ if (is_scalar($var))
+ $ret[] = base64_encode($var);
+ }
+ return $ret;
}
echo "\n-- Convert to JIS --\n";
diff --git a/ext/mbstring/tests/mb_convert_variables.phpt b/ext/mbstring/tests/mb_convert_variables.phpt
index b04e2bf185..830c6a7cd0 100644
--- a/ext/mbstring/tests/mb_convert_variables.phpt
+++ b/ext/mbstring/tests/mb_convert_variables.phpt
@@ -72,34 +72,34 @@ print("{$aa[0]}{$aa[1]}{$aa[2]}\n"); // Converted to EUC-JP
echo "== OBJECT TEST ==\n";
class foo
{
- public $s1;
- public $s2;
- public $s3;
-
- function __construct()
- {
- global $sjis, $jis, $euc_jp;
-
- $this->s1 = $euc_jp;
- $this->s2 = $euc_jp;
- $this->s3 = $euc_jp;
- }
+ public $s1;
+ public $s2;
+ public $s3;
+
+ function __construct()
+ {
+ global $sjis, $jis, $euc_jp;
+
+ $this->s1 = $euc_jp;
+ $this->s2 = $euc_jp;
+ $this->s3 = $euc_jp;
+ }
}
class bar
{
- public $s1;
- public $s2;
- public $s3;
-
- function __construct()
- {
- global $sjis, $jis, $euc_jp;
-
- $this->s1 = $euc_jp;
- $this->s2 = $euc_jp;
- $this->s3 = $euc_jp;
- }
+ public $s1;
+ public $s2;
+ public $s3;
+
+ function __construct()
+ {
+ global $sjis, $jis, $euc_jp;
+
+ $this->s1 = $euc_jp;
+ $this->s2 = $euc_jp;
+ $this->s3 = $euc_jp;
+ }
}
diff --git a/ext/mbstring/tests/mb_decode_mimeheader_basic.phpt b/ext/mbstring/tests/mb_decode_mimeheader_basic.phpt
index 39bea621fe..fb5cdefc78 100644
--- a/ext/mbstring/tests/mb_decode_mimeheader_basic.phpt
+++ b/ext/mbstring/tests/mb_decode_mimeheader_basic.phpt
@@ -27,9 +27,7 @@ $b = mb_decode_mimeheader($a);
var_dump(bin2hex($b));
?>
-===DONE===
--EXPECT--
*** Testing mb_decode_mimeheader() : basic functionality ***
string(60) "e697a5e69cace8aa9ee38386e382ade382b9e38388e381a7e38199e38082"
string(60) "e697a5e69cace8aa9ee38386e382ade382b9e38388e381a7e38199e38082"
-===DONE===
diff --git a/ext/mbstring/tests/mb_decode_mimeheader_variation2.phpt b/ext/mbstring/tests/mb_decode_mimeheader_variation2.phpt
index 33c022b087..b7518b2150 100644
--- a/ext/mbstring/tests/mb_decode_mimeheader_variation2.phpt
+++ b/ext/mbstring/tests/mb_decode_mimeheader_variation2.phpt
@@ -39,7 +39,6 @@ $encoded_words = array(
}
?>
-===DONE===
--EXPECT--
*** Testing mb_decode_mimeheader() : variation ***
string(106) "e697a5e69cace8aa9ee38386e382ade382b9e38388e381a7e38199e380823031323334efbc95efbc96efbc97efbc98efbc99e38082"
@@ -48,4 +47,3 @@ string(106) "e697a5e69cace8aa9ee38386e382ade382b9e38388e381a7e38199e380823031323
string(106) "e697a5e69cace8aa9ee38386e382ade382b9e38388e381a7e38199e380823031323334efbc95efbc96efbc97efbc98efbc99e38082"
string(106) "e697a5e69cace8aa9ee38386e382ade382b9e38388e381a7e38199e380823031323334efbc95efbc96efbc97efbc98efbc99e38082"
string(106) "e697a5e69cace8aa9ee38386e382ade382b9e38388e381a7e38199e380823031323334efbc95efbc96efbc97efbc98efbc99e38082"
-===DONE===
diff --git a/ext/mbstring/tests/mb_decode_mimeheader_variation3.phpt b/ext/mbstring/tests/mb_decode_mimeheader_variation3.phpt
index 6f5c8b9c53..8836463a39 100644
--- a/ext/mbstring/tests/mb_decode_mimeheader_variation3.phpt
+++ b/ext/mbstring/tests/mb_decode_mimeheader_variation3.phpt
@@ -22,8 +22,6 @@ var_dump(bin2hex(mb_decode_mimeheader($encoded_word)));
?>
-===DONE===
--EXPECT--
*** Testing mb_decode_mimeheader() : variation ***
string(48) "e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f3f4f5f6f7f8f9"
-===DONE===
diff --git a/ext/mbstring/tests/mb_decode_numericentity.phpt b/ext/mbstring/tests/mb_decode_numericentity.phpt
index f70e26a43c..868554df31 100644
--- a/ext/mbstring/tests/mb_decode_numericentity.phpt
+++ b/ext/mbstring/tests/mb_decode_numericentity.phpt
@@ -21,6 +21,16 @@ echo mb_decode_numericentity('&#10000000000', $convmap), "\n";
echo mb_decode_numericentity('&#100000000000', $convmap), "\n";
echo mb_decode_numericentity('&#000000000000', $convmap), "\n";
+$convmap = [];
+echo mb_decode_numericentity('f&ouml;o', $convmap, "UTF-8")."\n";
+
+$convmap = array(0x0, 0x2FFFF, 0); // 3 elements
+try {
+ echo mb_decode_numericentity($str3, $convmap, "UTF-8")."\n";
+} catch (ValueError $ex) {
+ echo $ex->getMessage()."\n";
+}
+
?>
--EXPECT--
¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÃÂÃÄÅÆÇÈÉÊËÌÃÃŽÃÃÑÒÓÔÕÖ×ØÙÚÛÜÃÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ
@@ -31,3 +41,5 @@ aŒbœcŠdše€fg
&#10000000000
&#100000000000
&#000000000000
+f&ouml;o
+count($convmap) must be a multiple of 4
diff --git a/ext/mbstring/tests/mb_detect_encoding.phpt b/ext/mbstring/tests/mb_detect_encoding.phpt
index 0c8015d86d..9a8f51281b 100644
--- a/ext/mbstring/tests/mb_detect_encoding.phpt
+++ b/ext/mbstring/tests/mb_detect_encoding.phpt
@@ -87,11 +87,6 @@ $s = $euc_jp;
$s = mb_detect_encoding($s, 'BAD');
print("BAD: $s\n"); // BAD
-$s = $euc_jp;
-$s = mb_detect_encoding();
-print("MP: $s\n"); // Missing parameter
-
-
?>
--EXPECTF--
== BASIC TEST ==
@@ -113,6 +108,3 @@ EUC-JP: EUC-JP
Warning: mb_detect_encoding(): Illegal argument in %s on line %d
BAD: EUC-JP
-
-Warning: mb_detect_encoding() expects at least 1 parameter, 0 given in %s on line %d
-MP:
diff --git a/ext/mbstring/tests/mb_encode_mimeheader_basic.phpt b/ext/mbstring/tests/mb_encode_mimeheader_basic.phpt
index 1352088ccd..205aeafcbe 100644
--- a/ext/mbstring/tests/mb_encode_mimeheader_basic.phpt
+++ b/ext/mbstring/tests/mb_encode_mimeheader_basic.phpt
@@ -26,21 +26,21 @@ $nonEnglish = array('Japanese' => base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44G
'Greek' => base64_decode('zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr868zrXOvc6/LiAwMTIzNDU2Nzg5Lg=='));
foreach ($english as $lang => $input) {
- echo "\nLanguage: $lang\n";
- echo "-- Base 64: --\n";
- var_dump(mb_encode_mimeheader($input, 'UTF-8', 'B'));
- echo "-- Quoted-Printable --\n";
- var_dump(mb_encode_mimeheader($input, 'UTF-8', 'Q'));
+ echo "\nLanguage: $lang\n";
+ echo "-- Base 64: --\n";
+ var_dump(mb_encode_mimeheader($input, 'UTF-8', 'B'));
+ echo "-- Quoted-Printable --\n";
+ var_dump(mb_encode_mimeheader($input, 'UTF-8', 'Q'));
}
mb_internal_encoding('utf-8');
foreach ($nonEnglish as $lang => $input) {
- echo "\nLanguage: $lang\n";
- echo "-- Base 64: --\n";
- var_dump(mb_encode_mimeheader($input, 'UTF-8', 'B'));
- echo "-- Quoted-Printable --\n";
- var_dump(mb_encode_mimeheader($input, 'UTF-8', 'Q'));
+ echo "\nLanguage: $lang\n";
+ echo "-- Base 64: --\n";
+ var_dump(mb_encode_mimeheader($input, 'UTF-8', 'B'));
+ echo "-- Quoted-Printable --\n";
+ var_dump(mb_encode_mimeheader($input, 'UTF-8', 'Q'));
}
echo "Done";
diff --git a/ext/mbstring/tests/mb_encode_mimeheader_basic2.phpt b/ext/mbstring/tests/mb_encode_mimeheader_basic2.phpt
index 151d4a610f..f108938e8b 100644
--- a/ext/mbstring/tests/mb_encode_mimeheader_basic2.phpt
+++ b/ext/mbstring/tests/mb_encode_mimeheader_basic2.phpt
@@ -29,13 +29,13 @@ $inputs = array('SJIS' => $sjis_string,
'EUC_JP' => $euc_jp_string);
foreach ($inputs as $lang => $input) {
- echo "\nLanguage: $lang\n";
- echo "-- Base 64: --\n";
- mb_internal_encoding($lang);
- $outEncoding = "UTF-8";
- var_dump(mb_encode_mimeheader($input, $outEncoding, 'B'));
- echo "-- Quoted-Printable --\n";
- var_dump(mb_encode_mimeheader($input, $outEncoding, 'Q'));
+ echo "\nLanguage: $lang\n";
+ echo "-- Base 64: --\n";
+ mb_internal_encoding($lang);
+ $outEncoding = "UTF-8";
+ var_dump(mb_encode_mimeheader($input, $outEncoding, 'B'));
+ echo "-- Quoted-Printable --\n";
+ var_dump(mb_encode_mimeheader($input, $outEncoding, 'Q'));
}
echo "Done";
diff --git a/ext/mbstring/tests/mb_encode_mimeheader_basic3.phpt b/ext/mbstring/tests/mb_encode_mimeheader_basic3.phpt
index d56a996892..7235255754 100644
--- a/ext/mbstring/tests/mb_encode_mimeheader_basic3.phpt
+++ b/ext/mbstring/tests/mb_encode_mimeheader_basic3.phpt
@@ -29,13 +29,13 @@ $inputs = array('SJIS' => $sjis_string,
'EUC_JP' => $euc_jp_string);
foreach ($inputs as $lang => $input) {
- echo "\nLanguage: $lang\n";
- echo "-- Base 64: --\n";
- mb_internal_encoding($lang);
- $outEncoding = $lang;
- var_dump(mb_encode_mimeheader($input, $outEncoding, 'B'));
- echo "-- Quoted-Printable --\n";
- var_dump(mb_encode_mimeheader($input, $outEncoding, 'Q'));
+ echo "\nLanguage: $lang\n";
+ echo "-- Base 64: --\n";
+ mb_internal_encoding($lang);
+ $outEncoding = $lang;
+ var_dump(mb_encode_mimeheader($input, $outEncoding, 'B'));
+ echo "-- Quoted-Printable --\n";
+ var_dump(mb_encode_mimeheader($input, $outEncoding, 'Q'));
}
echo "Done";
diff --git a/ext/mbstring/tests/mb_encode_mimeheader_variation6.phpt b/ext/mbstring/tests/mb_encode_mimeheader_variation6.phpt
index edf602d550..51dd85956c 100644
--- a/ext/mbstring/tests/mb_encode_mimeheader_variation6.phpt
+++ b/ext/mbstring/tests/mb_encode_mimeheader_variation6.phpt
@@ -28,9 +28,9 @@ $str = base64_decode('zpHPhc+Ez4wgzrXOr869zrHOuSDOtc67zrvOt869zrnOus+MIM66zrXOr8
$iterator = 1;
foreach ($linefeeds as $linefeed) {
- echo "\n-- Iteration $iterator --\n";
- var_dump(mb_encode_mimeheader($str, 'utf-8', 'B', $linefeed));
- $iterator++;
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(mb_encode_mimeheader($str, 'utf-8', 'B', $linefeed));
+ $iterator++;
}
diff --git a/ext/mbstring/tests/mb_encode_numericentity.phpt b/ext/mbstring/tests/mb_encode_numericentity.phpt
index 51ad6c22a1..3f14bfd48b 100644
--- a/ext/mbstring/tests/mb_encode_numericentity.phpt
+++ b/ext/mbstring/tests/mb_encode_numericentity.phpt
@@ -15,8 +15,20 @@ echo mb_encode_numericentity($str2, $convmap, "UTF-8")."\n";
$convmap = array(0xFF, 0x2FFFF, 0, 0xFFFF);
echo mb_encode_numericentity('aŒbœcŠdše€fg', $convmap, "UTF-8")."\n";
+
+$convmap = [];
+echo mb_encode_numericentity('föo', $convmap, "UTF-8")."\n";
+
+$convmap = array(0xFF, 0x2FFFF, 0); // 3 elements
+try {
+ echo mb_encode_numericentity('aŒbœcŠdše€fg', $convmap, "UTF-8")."\n";
+} catch (ValueError $ex) {
+ echo $ex->getMessage()."\n";
+}
?>
--EXPECT--
&#161;&#162;&#163;&#164;&#165;&#166;&#167;&#168;&#169;&#170;&#171;&#172;&#173;&#174;&#175;&#176;&#177;&#178;&#179;&#180;&#181;&#182;&#183;&#184;&#185;&#186;&#187;&#188;&#189;&#190;&#191;&#192;&#193;&#194;&#195;&#196;&#197;&#198;&#199;&#200;&#201;&#202;&#203;&#204;&#205;&#206;&#207;&#208;&#209;&#210;&#211;&#212;&#213;&#214;&#215;&#216;&#217;&#218;&#219;&#220;&#221;&#222;&#223;&#224;&#225;&#226;&#227;&#228;&#229;&#230;&#231;&#232;&#233;&#234;&#235;&#236;&#237;&#238;&#239;&#240;&#241;&#242;&#243;&#244;&#245;&#246;&#247;&#248;&#249;&#250;&#251;&#252;&#253;&#254;&#255;
&#402;&#913;&#914;&#915;&#916;&#917;&#918;&#919;&#920;&#921;&#922;&#923;&#924;&#925;&#926;&#927;&#928;&#929;&#931;&#932;&#933;&#934;&#935;&#936;&#937;&#945;&#946;&#947;&#948;&#949;&#950;&#951;&#952;&#953;&#954;&#955;&#956;&#957;&#958;&#959;&#960;&#961;&#962;&#963;&#964;&#965;&#966;&#967;&#968;&#969;&#977;&#978;&#982;&#8226;&#8230;&#8242;&#8243;&#8254;&#8260;&#8472;&#8465;&#8476;&#8482;&#8501;&#8592;&#8593;&#8594;&#8595;&#8596;&#8629;&#8656;&#8657;&#8658;&#8659;&#8660;&#8704;&#8706;&#8707;&#8709;&#8711;&#8712;&#8713;&#8715;&#8719;&#8721;&#8722;&#8727;&#8730;&#8733;&#8734;&#8736;&#8743;&#8744;&#8745;&#8746;&#8747;&#8756;&#8764;&#8773;&#8776;&#8800;&#8801;&#8804;&#8805;&#8834;&#8835;&#8836;&#8838;&#8839;&#8853;&#8855;&#8869;&#8901;&#8968;&#8969;&#8970;&#8971;&#9001;&#9002;&#9674;&#9824;&#9827;&#9829;&#9830;
a&#338;b&#339;c&#352;d&#353;e&#8364;fg
+föo
+count($convmap) must be a multiple of 4
diff --git a/ext/mbstring/tests/mb_encoding_aliases.phpt b/ext/mbstring/tests/mb_encoding_aliases.phpt
index 8bc0453350..798bdeb5ca 100644
--- a/ext/mbstring/tests/mb_encoding_aliases.phpt
+++ b/ext/mbstring/tests/mb_encoding_aliases.phpt
@@ -4,7 +4,6 @@ mb_encoding_aliases()
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
--FILE--
<?php
-mb_encoding_aliases();
$list = mb_encoding_aliases("ASCII");
sort($list);
var_dump($list);
@@ -13,7 +12,6 @@ var_dump(mb_encoding_aliases("8bit"));
var_dump(mb_encoding_aliases("BAD"));
?>
--EXPECTF--
-Warning: mb_encoding_aliases() expects exactly 1 parameter, 0 given in %s on line 2
array(11) {
[0]=>
string(14) "ANSI_X3.4-1968"
diff --git a/ext/mbstring/tests/mb_ereg.phpt b/ext/mbstring/tests/mb_ereg.phpt
index ff507adc07..bc95a5fbaa 100644
--- a/ext/mbstring/tests/mb_ereg.phpt
+++ b/ext/mbstring/tests/mb_ereg.phpt
@@ -9,26 +9,26 @@ function_exists('mb_ereg') or die("skip mb_ereg() is not available in this build
output_handler=
--FILE--
<?php
- mb_regex_set_options( '' );
+ mb_regex_set_options( '' );
- $encs = array( 'EUC-JP', 'Shift_JIS', 'SJIS', 'UTF-8' );
+ $encs = array( 'EUC-JP', 'Shift_JIS', 'SJIS', 'UTF-8' );
- function test_ereg( $test_enc, $pat, $str, $in_enc = 'EUC-JP' ) {
- mb_regex_encoding( $test_enc );
- $pat = mb_convert_encoding( $pat, $test_enc, $in_enc );
- $str = mb_convert_encoding( $str, $test_enc, $in_enc );
- printf( "(%d)%s\n", mb_ereg( $pat, $str, $reg ), ( is_array( $reg )? bin2hex(mb_convert_encoding( implode( ' ', $reg ), $in_enc, $test_enc )) : '' ) );
- }
- function do_tests( $enc ) {
- test_ereg( $enc, 'abc ([a-z]+) ([a-z]+) ([a-z]+)$', "abc def ghi jkl" );
- $pat = '([£á-£ú]+) ([ ¤¢-¤«]+)([¤«-¤Ê]+) ([¤ï-¤ó]+)$';
- test_ereg( $enc, $pat, '£á£â£ã ¤¢¤ª¤¤ ¤«¤³¤Ê ¤ï¤ñ¤ó' );
- test_ereg( $enc, $pat, '£í£ú£ø£æ£ð ¤¦¤ª¤« ¤­¤« ¤ò¤ð' );
- }
+ function test_ereg( $test_enc, $pat, $str, $in_enc = 'EUC-JP' ) {
+ mb_regex_encoding( $test_enc );
+ $pat = mb_convert_encoding( $pat, $test_enc, $in_enc );
+ $str = mb_convert_encoding( $str, $test_enc, $in_enc );
+ printf( "(%d)%s\n", mb_ereg( $pat, $str, $reg ), ( is_array( $reg )? bin2hex(mb_convert_encoding( implode( ' ', $reg ), $in_enc, $test_enc )) : '' ) );
+ }
+ function do_tests( $enc ) {
+ test_ereg( $enc, 'abc ([a-z]+) ([a-z]+) ([a-z]+)$', "abc def ghi jkl" );
+ $pat = '([£á-£ú]+) ([ ¤¢-¤«]+)([¤«-¤Ê]+) ([¤ï-¤ó]+)$';
+ test_ereg( $enc, $pat, '£á£â£ã ¤¢¤ª¤¤ ¤«¤³¤Ê ¤ï¤ñ¤ó' );
+ test_ereg( $enc, $pat, '£í£ú£ø£æ£ð ¤¦¤ª¤« ¤­¤« ¤ò¤ð' );
+ }
- foreach( $encs as $enc ) {
- do_tests( $enc );
- }
+ foreach( $encs as $enc ) {
+ do_tests( $enc );
+ }
?>
--EXPECT--
(15)6162632064656620676869206a6b6c2064656620676869206a6b6c
diff --git a/ext/mbstring/tests/mb_ereg1.phpt b/ext/mbstring/tests/mb_ereg1.phpt
index 59ef788a77..875426a6c7 100644
--- a/ext/mbstring/tests/mb_ereg1.phpt
+++ b/ext/mbstring/tests/mb_ereg1.phpt
@@ -6,19 +6,22 @@ mb_ereg() and invalid arguments
<?php
$a = array(
- array(1,2,3),
- array("", "", ""),
- array(array(), 1, ""),
- array(1, array(), ""),
- array(1, "", array()),
- );
+ array(1,2,3),
+ array("", "", ""),
+ array(array(), 1, ""),
+ array(1, array(), ""),
+ array(1, "", array()),
+ );
foreach ($a as $args) {
- var_dump(mb_ereg($args[0], $args[1], $args[2]));
- var_dump($args);
+ try {
+ var_dump(mb_ereg($args[0], $args[1], $args[2]));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ var_dump($args);
}
?>
-===DONE===
--EXPECTF--
bool(false)
array(3) {
@@ -31,7 +34,7 @@ array(3) {
}
}
-Warning: mb_ereg(): empty pattern in %s on line %d
+Warning: mb_ereg(): Empty pattern in %s on line %d
bool(false)
array(3) {
[0]=>
@@ -42,9 +45,7 @@ array(3) {
array(0) {
}
}
-
-Notice: Array to string conversion in %s on line %d
-bool(false)
+mb_ereg() expects parameter 1 to be string, array given
array(3) {
[0]=>
array(0) {
@@ -52,12 +53,9 @@ array(3) {
[1]=>
int(1)
[2]=>
- array(0) {
- }
+ &string(0) ""
}
-
-Warning: mb_ereg() expects parameter 2 to be string, array given in %s on line %d
-bool(false)
+mb_ereg() expects parameter 2 to be string, array given
array(3) {
[0]=>
int(1)
@@ -65,7 +63,7 @@ array(3) {
array(0) {
}
[2]=>
- string(0) ""
+ &string(0) ""
}
bool(false)
array(3) {
@@ -77,4 +75,3 @@ array(3) {
array(0) {
}
}
-===DONE===
diff --git a/ext/mbstring/tests/mb_ereg2.phpt b/ext/mbstring/tests/mb_ereg2.phpt
index 30e857eed7..22e3cd36c5 100644
--- a/ext/mbstring/tests/mb_ereg2.phpt
+++ b/ext/mbstring/tests/mb_ereg2.phpt
@@ -15,12 +15,9 @@ var_dump($a, $b, $c);
mb_eregi($a, $b, $c);
var_dump($a, $b, $c);
-mb_ereg_search_init($a, $b, $c);
-var_dump($a, $b, $c);
-
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
int(-1)
int(-1)
array(1) {
@@ -33,12 +30,4 @@ array(1) {
[0]=>
string(2) "-1"
}
-
-Warning: mb_ereg_search_init() expects parameter 3 to be string, array given in %s on line %d
-int(-1)
-int(-1)
-array(1) {
- [0]=>
- string(2) "-1"
-}
Done
diff --git a/ext/mbstring/tests/mb_ereg3.phpt b/ext/mbstring/tests/mb_ereg3.phpt
deleted file mode 100644
index c591563444..0000000000
--- a/ext/mbstring/tests/mb_ereg3.phpt
+++ /dev/null
@@ -1,52 +0,0 @@
---TEST--
-mb_ereg() returning matches
---SKIPIF--
-<?php
-if (!extension_loaded('mbstring')) die('skip mbstring not enabled');
-if (!function_exists("mb_ereg")) print "skip mb_ereg() not available";
-?>
---FILE--
-<?php
-
-// Note: This test is identical to mb_ereg2.phpt, but using deprecated mbereg_* aliases.
-// Deleted it once the deprecated aliases have been removed.
-
-$a = -1; $b = -1; $c = -1;
-mbereg($a, $b, $c);
-var_dump($a, $b, $c);
-
-mberegi($a, $b, $c);
-var_dump($a, $b, $c);
-
-mbereg_search_init($a, $b, $c);
-var_dump($a, $b, $c);
-
-echo "Done\n";
-?>
---EXPECTF--
-Deprecated: Function mbereg() is deprecated in %s on line %d
-int(-1)
-int(-1)
-array(1) {
- [0]=>
- string(2) "-1"
-}
-
-Deprecated: Function mberegi() is deprecated in %s on line %d
-int(-1)
-int(-1)
-array(1) {
- [0]=>
- string(2) "-1"
-}
-
-Deprecated: Function mbereg_search_init() is deprecated in %s on line %d
-
-Warning: mbereg_search_init() expects parameter 3 to be string, array given in %s on line %d
-int(-1)
-int(-1)
-array(1) {
- [0]=>
- string(2) "-1"
-}
-Done
diff --git a/ext/mbstring/tests/mb_ereg_basic.phpt b/ext/mbstring/tests/mb_ereg_basic.phpt
index b13f012b7b..ef5bc11120 100644
--- a/ext/mbstring/tests/mb_ereg_basic.phpt
+++ b/ext/mbstring/tests/mb_ereg_basic.phpt
@@ -19,9 +19,9 @@ function_exists('mb_ereg') or die("skip mb_ereg() is not available in this build
echo "*** Testing mb_ereg() : basic functionality ***\n";
if(mb_regex_encoding('utf-8') == true) {
- echo "Regex encoding set to utf-8\n";
+ echo "Regex encoding set to utf-8\n";
} else {
- echo "Could not set regex encoding to utf-8\n";
+ echo "Could not set regex encoding to utf-8\n";
}
$string_ascii = 'This is an English string. 0123456789.';
$regex_ascii1 = '(.*is)+.*\.[[:blank:]][0-9]{9}';
@@ -59,20 +59,20 @@ echo "Done";
* @param array $regs
*/
function base64_encode_var_dump($regs) {
- if ($regs) {
- echo "array(" . count($regs) . ") {\n";
- foreach ($regs as $key => $value) {
- echo " [$key]=>\n ";
- if (is_string($value)) {
- var_dump(base64_encode($value));
- } else {
- var_dump($value);
- }
- }
- echo "}\n";
- } else {
- echo "NULL\n";
- }
+ if ($regs) {
+ echo "array(" . count($regs) . ") {\n";
+ foreach ($regs as $key => $value) {
+ echo " [$key]=>\n ";
+ if (is_string($value)) {
+ var_dump(base64_encode($value));
+ } else {
+ var_dump($value);
+ }
+ }
+ echo "}\n";
+ } else {
+ echo "NULL\n";
+ }
}
?>
--EXPECT--
diff --git a/ext/mbstring/tests/mb_ereg_replace.phpt b/ext/mbstring/tests/mb_ereg_replace.phpt
index 26838341fe..7afb8fdad6 100644
--- a/ext/mbstring/tests/mb_ereg_replace.phpt
+++ b/ext/mbstring/tests/mb_ereg_replace.phpt
@@ -7,9 +7,9 @@ function_exists('mb_ereg_replace') or die("skip mb_ereg_replace() is not availab
?>
--FILE--
<?php
- mb_regex_set_options( '' );
- print mb_ereg_replace( ' ', '-', 'a b c d e' )."\n";
- print mb_ereg_replace( '([a-z]+)','[\\1]', 'abc def ghi' );
+ mb_regex_set_options( '' );
+ print mb_ereg_replace( ' ', '-', 'a b c d e' )."\n";
+ print mb_ereg_replace( '([a-z]+)','[\\1]', 'abc def ghi' );
?>
--EXPECT--
a-b-c-d-e
diff --git a/ext/mbstring/tests/mb_ereg_replace_variation1.phpt b/ext/mbstring/tests/mb_ereg_replace_variation1.phpt
index 4c6e177b3e..c61e47723d 100644
--- a/ext/mbstring/tests/mb_ereg_replace_variation1.phpt
+++ b/ext/mbstring/tests/mb_ereg_replace_variation1.phpt
@@ -96,87 +96,53 @@ foreach($inputs as $input) {
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing mb_ereg_replace() : usage variations ***
-- Iteration 1 --
-
-Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
string(10) "string_val"
-- Iteration 2 --
-
-Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
string(10) "string_val"
-- Iteration 3 --
-
-Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
string(10) "string_val"
-- Iteration 4 --
-
-Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-
-Warning: mb_ereg_replace(): Pattern is not valid under UTF-8 encoding in %s on line %d
-bool(false)
+string(10) "string_val"
-- Iteration 5 --
-
-Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
string(10) "string_val"
-- Iteration 6 --
-
-Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-
-Warning: mb_ereg_replace(): Pattern is not valid under UTF-8 encoding in %s on line %d
-bool(false)
+string(10) "string_val"
-- Iteration 7 --
-
-Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
string(10) "string_val"
-- Iteration 8 --
-
-Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
string(10) "string_val"
-- Iteration 9 --
-
-Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
string(10) "string_val"
-- Iteration 10 --
-
-Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-string(10) "string_val"
+string(120) "string_valsstring_valtstring_valrstring_valistring_valnstring_valgstring_val_string_valvstring_valastring_vallstring_val"
-- Iteration 11 --
-
-Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-string(10) "string_val"
+string(120) "string_valsstring_valtstring_valrstring_valistring_valnstring_valgstring_val_string_valvstring_valastring_vallstring_val"
-- Iteration 12 --
-
-Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
string(10) "string_val"
-- Iteration 13 --
-
-Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-string(10) "string_val"
+string(120) "string_valsstring_valtstring_valrstring_valistring_valnstring_valgstring_val_string_valvstring_valastring_vallstring_val"
-- Iteration 14 --
-
-Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
string(10) "string_val"
-- Iteration 15 --
-
-Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-string(10) "string_val"
+string(120) "string_valsstring_valtstring_valrstring_valistring_valnstring_valgstring_val_string_valvstring_valastring_vallstring_val"
-- Iteration 16 --
string(120) "string_valsstring_valtstring_valrstring_valistring_valnstring_valgstring_val_string_valvstring_valastring_vallstring_val"
@@ -194,17 +160,11 @@ string(10) "string_val"
string(10) "string_val"
-- Iteration 21 --
-
-Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
string(10) "string_val"
-- Iteration 22 --
-
-Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-string(10) "string_val"
+string(120) "string_valsstring_valtstring_valrstring_valistring_valnstring_valgstring_val_string_valvstring_valastring_vallstring_val"
-- Iteration 23 --
-
-Deprecated: mb_ereg_replace(): Non-string patterns will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-string(10) "string_val"
+string(120) "string_valsstring_valtstring_valrstring_valistring_valnstring_valgstring_val_string_valvstring_valastring_vallstring_val"
Done
diff --git a/ext/mbstring/tests/mb_ereg_search_pos.phpt b/ext/mbstring/tests/mb_ereg_search_pos.phpt
index e9c8aaafc7..1eb425d4aa 100644
--- a/ext/mbstring/tests/mb_ereg_search_pos.phpt
+++ b/ext/mbstring/tests/mb_ereg_search_pos.phpt
@@ -12,13 +12,13 @@ $test_str = 'Iñtërnâtiônàlizætiøn';
if(mb_ereg_search_init($test_str))
{
- $val=mb_ereg_search_pos("nâtiôn");
+ $val=mb_ereg_search_pos("nâtiôn");
- var_dump($val);
+ var_dump($val);
}
else{
- var_dump("false");
+ var_dump("false");
}
?>
--EXPECT--
diff --git a/ext/mbstring/tests/mb_ereg_search_setpos.phpt b/ext/mbstring/tests/mb_ereg_search_setpos.phpt
index 5b76ad0d28..0a90d005dd 100644
--- a/ext/mbstring/tests/mb_ereg_search_setpos.phpt
+++ b/ext/mbstring/tests/mb_ereg_search_setpos.phpt
@@ -17,12 +17,11 @@ mb_ereg_search_init($test_str);
$positions = array( 5, 20, 21, 25, 0, -5, -20, -30);
foreach($positions as $pos) {
- echo("\n* Position: $pos :\n");
- var_dump(mb_ereg_search_setpos($pos));
- var_dump(mb_ereg_search_getpos());
+ echo("\n* Position: $pos :\n");
+ var_dump(mb_ereg_search_setpos($pos));
+ var_dump(mb_ereg_search_getpos());
}
?>
-==DONE==
--EXPECTF--
bool(true)
@@ -66,4 +65,3 @@ int(0)
Warning: mb_ereg_search_setpos(): Position is out of range in %s on line %d
bool(false)
int(0)
-==DONE==
diff --git a/ext/mbstring/tests/mb_ereg_search_xxx.phpt b/ext/mbstring/tests/mb_ereg_search_xxx.phpt
index a2049df144..7c2ef2605a 100644
--- a/ext/mbstring/tests/mb_ereg_search_xxx.phpt
+++ b/ext/mbstring/tests/mb_ereg_search_xxx.phpt
@@ -9,30 +9,30 @@ function_exists('mb_ereg_search') or die("skip\n");
output_handler=
--FILE--
<?php
- mb_regex_set_options( '' );
+ mb_regex_set_options( '' );
- $encs = array( 'EUC-JP', 'Shift_JIS', 'SJIS', 'UTF-8' );
+ $encs = array( 'EUC-JP', 'Shift_JIS', 'SJIS', 'UTF-8' );
- function test_search( $test_enc, $str, $look_for, $opt, $in_enc = 'EUC-JP' ) {
- mb_regex_encoding( $test_enc );
- $str = mb_convert_encoding( $str, $test_enc, $in_enc );
- $look_for = mb_convert_encoding( $look_for, $test_enc, $in_enc );
- mb_ereg_search_init( $str, $look_for, $opt );
- while ( mb_ereg_search_pos() ) {
- $regs = mb_ereg_search_getregs();
- array_shift( $regs );
- printf( "(%s) (%d) %s\n", $test_enc, mb_ereg_search_getpos(), mb_convert_encoding( ( is_array( $regs ) ? implode( '-', $regs ): '' ), $in_enc, $test_enc ) );
- }
- }
- function do_tests( $enc, $opt ) {
- test_search( $enc, "¢Ï¡¦ ¡¦¢Ï\n", ' (¡¦?¢Ï¡¦?)[[:space:]]', $opt );
- test_search( $enc, 'abcde abdeabcf anvfabc odu abcd ', '(ab[a-z]+)', $opt );
- }
+ function test_search( $test_enc, $str, $look_for, $opt, $in_enc = 'EUC-JP' ) {
+ mb_regex_encoding( $test_enc );
+ $str = mb_convert_encoding( $str, $test_enc, $in_enc );
+ $look_for = mb_convert_encoding( $look_for, $test_enc, $in_enc );
+ mb_ereg_search_init( $str, $look_for, $opt );
+ while ( mb_ereg_search_pos() ) {
+ $regs = mb_ereg_search_getregs();
+ array_shift( $regs );
+ printf( "(%s) (%d) %s\n", $test_enc, mb_ereg_search_getpos(), mb_convert_encoding( ( is_array( $regs ) ? implode( '-', $regs ): '' ), $in_enc, $test_enc ) );
+ }
+ }
+ function do_tests( $enc, $opt ) {
+ test_search( $enc, "¢Ï¡¦ ¡¦¢Ï\n", ' (¡¦?¢Ï¡¦?)[[:space:]]', $opt );
+ test_search( $enc, 'abcde abdeabcf anvfabc odu abcd ', '(ab[a-z]+)', $opt );
+ }
- foreach( $encs as $enc ) {
- do_tests( $enc, '' );
- do_tests( $enc, 'x' );
- }
+ foreach( $encs as $enc ) {
+ do_tests( $enc, '' );
+ do_tests( $enc, 'x' );
+ }
?>
--EXPECT--
(EUC-JP) (10) ¡¦¢Ï
diff --git a/ext/mbstring/tests/mb_ereg_variation1.phpt b/ext/mbstring/tests/mb_ereg_variation1.phpt
deleted file mode 100644
index 60baf8743e..0000000000
--- a/ext/mbstring/tests/mb_ereg_variation1.phpt
+++ /dev/null
@@ -1,178 +0,0 @@
---TEST--
-Test mb_ereg() function : usage variations - pass different data types to $pattern argument
---SKIPIF--
-<?php
-extension_loaded('mbstring') or die('skip');
-function_exists('mb_ereg') or die("skip mb_ereg() is not available in this build");
-?>
---FILE--
-<?php
-/* Prototype : int mb_ereg(string $pattern, string $string [, array $registers])
- * Description: Regular expression match for multibyte string
- * Source code: ext/mbstring/php_mbregex.c
- */
-
-/*
- * Pass different data types to $pattern argument
- */
-
-echo "*** Testing mb_ereg() : usage variations ***\n";
-
-// Initialise function arguments not being substituted (if any)
-$string = 'string value';
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-// get a class
-class classA
-{
- public function __toString() {
- return "Class A object";
- }
-}
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-// get a resource variable
-$fp = fopen(__FILE__, "r");
-
-// unexpected values to be passed to $pattern argument
-$inputs = array(
-
-// int data
-/*1*/ 0,
- 1,
- 12345,
- -2345,
-
-// float data
-/*5*/ 10.5,
- -10.5,
- 12.3456789000e10,
- 12.3456789000E-10,
- .5,
-
-// boolean data
-/*10*/ true,
- TRUE,
-
-// string data
-/*12*/ "string",
- 'string',
- $heredoc,
-
-// object data
-/*15*/ new classA(),
-
-// resource variable
-/*16*/ $fp
-);
-
-// loop through each element of $inputs to check the behavior of mb_ereg()
-$iterator = 1;
-foreach($inputs as $input) {
- if (@is_array($regs)){
- $regs = null;
- }
- echo "\n-- Iteration $iterator --\n";
- var_dump( mb_ereg($input, $string, $regs) );
- var_dump($regs);
- $iterator++;
-};
-
-fclose($fp);
-
-echo "Done";
-?>
---EXPECT--
-*** Testing mb_ereg() : usage variations ***
-
--- Iteration 1 --
-bool(false)
-array(0) {
-}
-
--- Iteration 2 --
-bool(false)
-array(0) {
-}
-
--- Iteration 3 --
-bool(false)
-array(0) {
-}
-
--- Iteration 4 --
-bool(false)
-array(0) {
-}
-
--- Iteration 5 --
-bool(false)
-array(0) {
-}
-
--- Iteration 6 --
-bool(false)
-array(0) {
-}
-
--- Iteration 7 --
-bool(false)
-array(0) {
-}
-
--- Iteration 8 --
-bool(false)
-array(0) {
-}
-
--- Iteration 9 --
-bool(false)
-array(0) {
-}
-
--- Iteration 10 --
-bool(false)
-array(0) {
-}
-
--- Iteration 11 --
-bool(false)
-array(0) {
-}
-
--- Iteration 12 --
-int(6)
-array(1) {
- [0]=>
- string(6) "string"
-}
-
--- Iteration 13 --
-int(6)
-array(1) {
- [0]=>
- string(6) "string"
-}
-
--- Iteration 14 --
-bool(false)
-array(0) {
-}
-
--- Iteration 15 --
-bool(false)
-array(0) {
-}
-
--- Iteration 16 --
-bool(false)
-array(0) {
-}
-Done
diff --git a/ext/mbstring/tests/mb_ereg_variation3.phpt b/ext/mbstring/tests/mb_ereg_variation3.phpt
index 17fa9444a4..9f484ee83d 100644
--- a/ext/mbstring/tests/mb_ereg_variation3.phpt
+++ b/ext/mbstring/tests/mb_ereg_variation3.phpt
@@ -37,14 +37,14 @@ $character_classes = array ('aB1' => '[[:alnum:]]+', /*1*/
$iterator = 1;
foreach($character_classes as $string => $pattern) {
- if (is_array(@$regs)) {
- $regs = null;
- }
- // make sure any multibyte output is in base 64
- echo "\n-- Iteration $iterator --\n";
- var_dump(mb_ereg($pattern, $string, $regs));
- base64_encode_var_dump($regs);
- $iterator++;
+ if (is_array(@$regs)) {
+ $regs = null;
+ }
+ // make sure any multibyte output is in base 64
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(mb_ereg($pattern, $string, $regs));
+ base64_encode_var_dump($regs);
+ $iterator++;
}
/**
* replicate a var dump of an array but outputted string values are base64 encoded
@@ -52,20 +52,20 @@ foreach($character_classes as $string => $pattern) {
* @param array $regs
*/
function base64_encode_var_dump($regs) {
- if ($regs) {
- echo "array(" . count($regs) . ") {\n";
- foreach ($regs as $key => $value) {
- echo " [$key]=>\n ";
- if (is_string($value)) {
- var_dump(base64_encode($value));
- } else {
- var_dump($value);
- }
- }
- echo "}\n";
- } else {
- echo "NULL\n";
- }
+ if ($regs) {
+ echo "array(" . count($regs) . ") {\n";
+ foreach ($regs as $key => $value) {
+ echo " [$key]=>\n ";
+ if (is_string($value)) {
+ var_dump(base64_encode($value));
+ } else {
+ var_dump($value);
+ }
+ }
+ echo "}\n";
+ } else {
+ echo "NULL\n";
+ }
}
echo "Done";
diff --git a/ext/mbstring/tests/mb_ereg_variation4.phpt b/ext/mbstring/tests/mb_ereg_variation4.phpt
index 54efbfb3f8..e487c5463c 100644
--- a/ext/mbstring/tests/mb_ereg_variation4.phpt
+++ b/ext/mbstring/tests/mb_ereg_variation4.phpt
@@ -39,15 +39,15 @@ $character_classes = array ('[[:alnum:]]+', /*1*/
$iterator = 1;
foreach ($character_classes as $pattern) {
- if (is_array(@$regs)) {
- $regs = null;
- }
- echo "\n-- Iteration $iterator --\n";
- var_dump(mb_ereg($pattern, $string_mb, $regs));
- if ($regs) {
- base64_encode_var_dump($regs);
- }
- $iterator++;
+ if (is_array(@$regs)) {
+ $regs = null;
+ }
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(mb_ereg($pattern, $string_mb, $regs));
+ if ($regs) {
+ base64_encode_var_dump($regs);
+ }
+ $iterator++;
}
/**
* replicate a var dump of an array but outputted string values are base64 encoded
@@ -55,20 +55,20 @@ foreach ($character_classes as $pattern) {
* @param array $regs
*/
function base64_encode_var_dump($regs) {
- if ($regs) {
- echo "array(" . count($regs) . ") {\n";
- foreach ($regs as $key => $value) {
- echo " [$key]=>\n ";
- if (is_string($value)) {
- var_dump(base64_encode($value));
- } else {
- var_dump($value);
- }
- }
- echo "}\n";
- } else {
- echo "NULL\n";
- }
+ if ($regs) {
+ echo "array(" . count($regs) . ") {\n";
+ foreach ($regs as $key => $value) {
+ echo " [$key]=>\n ";
+ if (is_string($value)) {
+ var_dump(base64_encode($value));
+ } else {
+ var_dump($value);
+ }
+ }
+ echo "}\n";
+ } else {
+ echo "NULL\n";
+ }
}
echo "Done";
diff --git a/ext/mbstring/tests/mb_ereg_variation5.phpt b/ext/mbstring/tests/mb_ereg_variation5.phpt
index 24b12f25a7..5467f24d1f 100644
--- a/ext/mbstring/tests/mb_ereg_variation5.phpt
+++ b/ext/mbstring/tests/mb_ereg_variation5.phpt
@@ -45,20 +45,20 @@ echo "Done";
* @param array $regs
*/
function base64_encode_var_dump($regs) {
- if ($regs) {
- echo "array(" . count($regs) . ") {\n";
- foreach ($regs as $key => $value) {
- echo " [$key]=>\n ";
- if (is_string($value)) {
- var_dump(base64_encode($value));
- } else {
- var_dump($value);
- }
- }
- echo "}\n";
- } else {
- echo "NULL\n";
- }
+ if ($regs) {
+ echo "array(" . count($regs) . ") {\n";
+ foreach ($regs as $key => $value) {
+ echo " [$key]=>\n ";
+ if (is_string($value)) {
+ var_dump(base64_encode($value));
+ } else {
+ var_dump($value);
+ }
+ }
+ echo "}\n";
+ } else {
+ echo "NULL\n";
+ }
}
?>
--EXPECT--
diff --git a/ext/mbstring/tests/mb_ereg_variation6.phpt b/ext/mbstring/tests/mb_ereg_variation6.phpt
index 97e5e58906..e9c506ac77 100644
--- a/ext/mbstring/tests/mb_ereg_variation6.phpt
+++ b/ext/mbstring/tests/mb_ereg_variation6.phpt
@@ -19,9 +19,9 @@ function_exists('mb_ereg') or die("skip mb_ereg() is not available in this build
echo "*** Testing mb_ereg() : usage variations ***\n";
if(mb_regex_encoding('utf-8') == true) {
- echo "Regex encoding set to utf-8\n";
+ echo "Regex encoding set to utf-8\n";
} else {
- echo "Could not set regex encoding to utf-8\n";
+ echo "Could not set regex encoding to utf-8\n";
}
$regex_char = array ('\w+' => '\w+',
@@ -37,18 +37,18 @@ $string_ascii = 'This is an English string. 0123456789.';
$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');
foreach ($regex_char as $displayChar => $char) {
- echo "\n--** Pattern is: $displayChar **--\n";
- if (@$regs_ascii || @$regs_mb) {
- $regs_ascii = null;
- $regs_mb = null;
- }
- echo "-- ASCII String: --\n";
- var_dump(mb_ereg($char, $string_ascii, $regs_ascii));
- base64_encode_var_dump($regs_ascii);
+ echo "\n--** Pattern is: $displayChar **--\n";
+ if (@$regs_ascii || @$regs_mb) {
+ $regs_ascii = null;
+ $regs_mb = null;
+ }
+ echo "-- ASCII String: --\n";
+ var_dump(mb_ereg($char, $string_ascii, $regs_ascii));
+ base64_encode_var_dump($regs_ascii);
- echo "-- Multibyte String: --\n";
- var_dump(mb_ereg($char, $string_mb, $regs_mb));
- base64_encode_var_dump($regs_mb);
+ echo "-- Multibyte String: --\n";
+ var_dump(mb_ereg($char, $string_mb, $regs_mb));
+ base64_encode_var_dump($regs_mb);
}
@@ -58,20 +58,20 @@ foreach ($regex_char as $displayChar => $char) {
* @param array $regs
*/
function base64_encode_var_dump($regs) {
- if ($regs) {
- echo "array(" . count($regs) . ") {\n";
- foreach ($regs as $key => $value) {
- echo " [$key]=>\n ";
- if (is_string($value)) {
- var_dump(base64_encode($value));
- } else {
- var_dump($value);
- }
- }
- echo "}\n";
- } else {
- echo "NULL\n";
- }
+ if ($regs) {
+ echo "array(" . count($regs) . ") {\n";
+ foreach ($regs as $key => $value) {
+ echo " [$key]=>\n ";
+ if (is_string($value)) {
+ var_dump(base64_encode($value));
+ } else {
+ var_dump($value);
+ }
+ }
+ echo "}\n";
+ } else {
+ echo "NULL\n";
+ }
}
echo "Done";
diff --git a/ext/mbstring/tests/mb_ereg_variation7.phpt b/ext/mbstring/tests/mb_ereg_variation7.phpt
index e43d051d2a..63b726ffd8 100644
--- a/ext/mbstring/tests/mb_ereg_variation7.phpt
+++ b/ext/mbstring/tests/mb_ereg_variation7.phpt
@@ -22,9 +22,9 @@ function_exists('mb_ereg') or die("skip mb_ereg() is not available in this build
echo "*** Testing mb_ereg() : usage variations ***\n";
if(mb_regex_encoding('utf-8') == true) {
- echo "Regex encoding set to utf-8\n";
+ echo "Regex encoding set to utf-8\n";
} else {
- echo "Could not set regex encoding to utf-8\n";
+ echo "Could not set regex encoding to utf-8\n";
}
$string_ascii = 'This is an English string. 0123456789.';
@@ -43,20 +43,20 @@ base64_encode_var_dump($regs_mb);
* @param array $regs
*/
function base64_encode_var_dump($regs) {
- if ($regs) {
- echo "array(" . count($regs) . ") {\n";
- foreach ($regs as $key => $value) {
- echo " [$key]=>\n ";
- if (is_string($value)) {
- var_dump(base64_encode($value));
- } else {
- var_dump($value);
- }
- }
- echo "}\n";
- } else {
- echo "NULL\n";
- }
+ if ($regs) {
+ echo "array(" . count($regs) . ") {\n";
+ foreach ($regs as $key => $value) {
+ echo " [$key]=>\n ";
+ if (is_string($value)) {
+ var_dump(base64_encode($value));
+ } else {
+ var_dump($value);
+ }
+ }
+ echo "}\n";
+ } else {
+ echo "NULL\n";
+ }
}
echo "Done";
diff --git a/ext/mbstring/tests/mb_get_info.phpt b/ext/mbstring/tests/mb_get_info.phpt
index 5b9c0c0aef..4b08b9943f 100644
--- a/ext/mbstring/tests/mb_get_info.phpt
+++ b/ext/mbstring/tests/mb_get_info.phpt
@@ -9,7 +9,6 @@ mbstring.internal_encoding=UTF-8
mbstring.http_input=ISO-8859-1
mbstring.http_output=ISO-8859-15
mbstring.http_output_conv_mimetypes=abc
-mbstring.func_overload=2
mbstring.detect_order=UTF-8,ISO-8859-15,ISO-8859-1,ASCII
mbstring.substitute_character=123
mbstring.strict_detection=1
@@ -24,8 +23,7 @@ foreach (array_keys($result) as $key) {
}
?>
--EXPECT--
-Deprecated: The mbstring.func_overload directive is deprecated in Unknown on line 0
-array(15) {
+array(13) {
["internal_encoding"]=>
string(5) "UTF-8"
["http_input"]=>
@@ -34,35 +32,6 @@ array(15) {
string(11) "ISO-8859-15"
["http_output_conv_mimetypes"]=>
string(3) "abc"
- ["func_overload"]=>
- int(2)
- ["func_overload_list"]=>
- array(12) {
- ["strlen"]=>
- string(9) "mb_strlen"
- ["strpos"]=>
- string(9) "mb_strpos"
- ["strrpos"]=>
- string(10) "mb_strrpos"
- ["stripos"]=>
- string(10) "mb_stripos"
- ["strripos"]=>
- string(11) "mb_strripos"
- ["strstr"]=>
- string(9) "mb_strstr"
- ["strrchr"]=>
- string(10) "mb_strrchr"
- ["stristr"]=>
- string(10) "mb_stristr"
- ["substr"]=>
- string(9) "mb_substr"
- ["strtolower"]=>
- string(13) "mb_strtolower"
- ["strtoupper"]=>
- string(13) "mb_strtoupper"
- ["substr_count"]=>
- string(15) "mb_substr_count"
- }
["mail_charset"]=>
string(11) "ISO-2022-KR"
["mail_header_encoding"]=>
@@ -99,60 +68,6 @@ string(11) "ISO-8859-15"
string(11) "ISO-8859-15"
string(3) "abc"
string(3) "abc"
-int(2)
-int(2)
-array(12) {
- ["strlen"]=>
- string(9) "mb_strlen"
- ["strpos"]=>
- string(9) "mb_strpos"
- ["strrpos"]=>
- string(10) "mb_strrpos"
- ["stripos"]=>
- string(10) "mb_stripos"
- ["strripos"]=>
- string(11) "mb_strripos"
- ["strstr"]=>
- string(9) "mb_strstr"
- ["strrchr"]=>
- string(10) "mb_strrchr"
- ["stristr"]=>
- string(10) "mb_stristr"
- ["substr"]=>
- string(9) "mb_substr"
- ["strtolower"]=>
- string(13) "mb_strtolower"
- ["strtoupper"]=>
- string(13) "mb_strtoupper"
- ["substr_count"]=>
- string(15) "mb_substr_count"
-}
-array(12) {
- ["strlen"]=>
- string(9) "mb_strlen"
- ["strpos"]=>
- string(9) "mb_strpos"
- ["strrpos"]=>
- string(10) "mb_strrpos"
- ["stripos"]=>
- string(10) "mb_stripos"
- ["strripos"]=>
- string(11) "mb_strripos"
- ["strstr"]=>
- string(9) "mb_strstr"
- ["strrchr"]=>
- string(10) "mb_strrchr"
- ["stristr"]=>
- string(10) "mb_stristr"
- ["substr"]=>
- string(9) "mb_substr"
- ["strtolower"]=>
- string(13) "mb_strtolower"
- ["strtoupper"]=>
- string(13) "mb_strtoupper"
- ["substr_count"]=>
- string(15) "mb_substr_count"
-}
string(11) "ISO-2022-KR"
string(11) "ISO-2022-KR"
string(6) "BASE64"
diff --git a/ext/mbstring/tests/mb_http_input.phpt b/ext/mbstring/tests/mb_http_input.phpt
index ea78b397b1..586a7d094d 100644
--- a/ext/mbstring/tests/mb_http_input.phpt
+++ b/ext/mbstring/tests/mb_http_input.phpt
@@ -29,17 +29,17 @@ $enc = mb_http_input('P');
// check
if (empty($ini)) {
- // Must be pass
- if ($enc === 'pass') {
- echo "OK\n";
- }
- else {
- echo "NG\n";
- }
+ // Must be pass
+ if ($enc === 'pass') {
+ echo "OK\n";
+ }
+ else {
+ echo "NG\n";
+ }
}
else {
- // Some encoding
- echo "This heppens when php.ini-dist is not used\n";
+ // Some encoding
+ echo "This heppens when php.ini-dist is not used\n";
}
?>
diff --git a/ext/mbstring/tests/mb_http_output.phpt b/ext/mbstring/tests/mb_http_output.phpt
index b62734f02d..60581576b6 100644
--- a/ext/mbstring/tests/mb_http_output.phpt
+++ b/ext/mbstring/tests/mb_http_output.phpt
@@ -47,16 +47,6 @@ $r = mb_http_output('BAD_NAME');
$enc = mb_http_output();
print "$enc\n";
-$r = mb_http_output($t_ary);
-($r === NULL) ? print "OK_BAD_ARY_SET\n" : print "NG_BAD_ARY_SET\n";
-$enc = mb_http_output();
-print "$enc\n";
-
-$r = mb_http_output($t_obj);
-($r === NULL) ? print "OK_BAD_OBJ_SET\n" : print "NG_BAD_OBJ_SET\n";
-$enc = mb_http_output();
-print "$enc\n";
-
?>
--EXPECTF--
OK_ASCII_SET
@@ -74,11 +64,3 @@ EUC-JP
Warning: mb_http_output(): Unknown encoding "BAD_NAME" in %s on line %d
OK_BAD_SET
EUC-JP
-
-Warning: mb_http_output() expects parameter 1 to be string, array given in %s on line %d
-OK_BAD_ARY_SET
-EUC-JP
-
-Warning: mb_http_output() expects parameter 1 to be string, object given in %s on line %d
-OK_BAD_OBJ_SET
-EUC-JP
diff --git a/ext/mbstring/tests/mb_internal_encoding.phpt b/ext/mbstring/tests/mb_internal_encoding.phpt
index 50b696e1bd..9a0191237d 100644
--- a/ext/mbstring/tests/mb_internal_encoding.phpt
+++ b/ext/mbstring/tests/mb_internal_encoding.phpt
@@ -35,16 +35,6 @@ $r = mb_internal_encoding('BAD');
$enc = mb_internal_encoding();
print "$enc\n";
-$r = mb_internal_encoding($t_ary);
-($r === NULL) ? print "OK_BAD_ARY_SET\n" : print "NG_BAD_ARY_SET\n";
-$enc = mb_internal_encoding();
-print "$enc\n";
-
-$r = mb_internal_encoding($t_obj);
-($r === NULL) ? print "OK_BAD_OBJ_SET\n" : print "NG_BAD_OBJ_SET\n";
-$enc = mb_internal_encoding();
-print "$enc\n";
-
?>
--EXPECTF--
OK_EUC-JP_SET
@@ -58,11 +48,3 @@ ASCII
Warning: mb_internal_encoding(): Unknown encoding "BAD" in %s on line %d
OK_BAD_SET
ASCII
-
-Warning: mb_internal_encoding() expects parameter 1 to be string, array given in %s on line %d
-OK_BAD_ARY_SET
-ASCII
-
-Warning: mb_internal_encoding() expects parameter 1 to be string, object given in %s on line %d
-OK_BAD_OBJ_SET
-ASCII
diff --git a/ext/mbstring/tests/mb_internal_encoding_ini_basic2.phpt b/ext/mbstring/tests/mb_internal_encoding_ini_basic2.phpt
index 241e1a6929..af9322c8af 100644
--- a/ext/mbstring/tests/mb_internal_encoding_ini_basic2.phpt
+++ b/ext/mbstring/tests/mb_internal_encoding_ini_basic2.phpt
@@ -19,11 +19,9 @@ echo mb_internal_encoding()."\n";
echo ini_get('mbstring.internal_encoding')."\n";
?>
-===DONE===
--EXPECT--
*** Testing INI mbstring.internal_encoding : basic functionality ***
ISO-8859-7
ISO-8859-7
UTF-8
ISO-8859-7
-===DONE===
diff --git a/ext/mbstring/tests/mb_internal_encoding_variation2.phpt b/ext/mbstring/tests/mb_internal_encoding_variation2.phpt
index ba53c48401..b191f79203 100644
--- a/ext/mbstring/tests/mb_internal_encoding_variation2.phpt
+++ b/ext/mbstring/tests/mb_internal_encoding_variation2.phpt
@@ -80,11 +80,11 @@ $encoding = array('UCS-4', /*1*/
$iterator = 1;
foreach($encoding as $enc) {
- echo "\n-- Iteration $iterator --\n";
- var_dump(mb_internal_encoding());
- var_dump(mb_internal_encoding($enc));
- var_dump(mb_internal_encoding());
- $iterator++;
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(mb_internal_encoding());
+ var_dump(mb_internal_encoding($enc));
+ var_dump(mb_internal_encoding());
+ $iterator++;
}
echo "Done";
?>
diff --git a/ext/mbstring/tests/mb_ord.phpt b/ext/mbstring/tests/mb_ord.phpt
index e0c5610c0b..30fddb846c 100644
--- a/ext/mbstring/tests/mb_ord.phpt
+++ b/ext/mbstring/tests/mb_ord.phpt
@@ -12,12 +12,12 @@ var_dump(
// Invalid
var_dump(
- mb_ord("\u{d800}", "typo"),
- mb_ord("\u{d800}", "pass"),
- mb_ord("\u{d800}", "jis"),
- mb_ord("\u{d800}", "cp50222"),
- mb_ord("\u{d800}", "utf-7"),
- mb_ord("")
+ mb_ord("\u{d800}", "typo"),
+ mb_ord("\u{d800}", "pass"),
+ mb_ord("\u{d800}", "jis"),
+ mb_ord("\u{d800}", "cp50222"),
+ mb_ord("\u{d800}", "utf-7"),
+ mb_ord("")
);
mb_internal_encoding("utf-7");
diff --git a/ext/mbstring/tests/mb_parse_str.phpt b/ext/mbstring/tests/mb_parse_str.phpt
index 8580ac52c5..d1bf0066d3 100644
--- a/ext/mbstring/tests/mb_parse_str.phpt
+++ b/ext/mbstring/tests/mb_parse_str.phpt
@@ -7,23 +7,20 @@ arg_separator.input=&
--FILE--
<?php
$queries = array(
- "foo=abc&bar=def",
- "%2bfoo=def&-bar=jkl",
- "foo[]=abc&foo[]=def&foo[]=ghi&bar[]=jkl"
+ "foo=abc&bar=def",
+ "%2bfoo=def&-bar=jkl",
+ "foo[]=abc&foo[]=def&foo[]=ghi&bar[]=jkl"
);
function test($query) {
- $foo = '';
- $bar = '';
- mb_parse_str($query, $array);
- var_dump($array);
- var_dump($foo);
- var_dump($bar);
- mb_parse_str($query);
- var_dump($foo);
- var_dump($bar);
+ $foo = '';
+ $bar = '';
+ mb_parse_str($query, $array);
+ var_dump($array);
+ var_dump($foo);
+ var_dump($bar);
}
foreach ($queries as $query) {
- test($query);
+ test($query);
}
?>
--EXPECTF--
@@ -35,10 +32,6 @@ array(2) {
}
string(0) ""
string(0) ""
-
-Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d
-string(3) "abc"
-string(3) "def"
array(2) {
["+foo"]=>
string(3) "def"
@@ -47,10 +40,6 @@ array(2) {
}
string(0) ""
string(0) ""
-
-Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d
-string(0) ""
-string(0) ""
array(2) {
["foo"]=>
array(3) {
@@ -69,17 +58,3 @@ array(2) {
}
string(0) ""
string(0) ""
-
-Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d
-array(3) {
- [0]=>
- string(3) "abc"
- [1]=>
- string(3) "def"
- [2]=>
- string(3) "ghi"
-}
-array(1) {
- [0]=>
- string(3) "jkl"
-}
diff --git a/ext/mbstring/tests/mb_parse_str02.phpt b/ext/mbstring/tests/mb_parse_str02.phpt
index e1871bf596..f6456ab661 100644
--- a/ext/mbstring/tests/mb_parse_str02.phpt
+++ b/ext/mbstring/tests/mb_parse_str02.phpt
@@ -7,26 +7,22 @@ arg_separator.input=&#
--FILE--
<?php
$queries = array(
- "foo=abc#bar=def&fubar=ghi",
- "%2bfoo=def&-bar=jkl#+fubar",
- " foo[]=abc&foo[]=def#foo[]=ghi#bar[]=#foo[]&fubar[]=="
+ "foo=abc#bar=def&fubar=ghi",
+ "%2bfoo=def&-bar=jkl#+fubar",
+ " foo[]=abc&foo[]=def#foo[]=ghi#bar[]=#foo[]&fubar[]=="
);
function test($query) {
- $foo = '';
- $bar = '';
- $fubar = '';
- mb_parse_str($query, $array);
- var_dump($array);
- var_dump($foo);
- var_dump($bar);
- var_dump($fubar);
- mb_parse_str($query);
- var_dump($foo);
- var_dump($bar);
- var_dump($fubar);
+ $foo = '';
+ $bar = '';
+ $fubar = '';
+ mb_parse_str($query, $array);
+ var_dump($array);
+ var_dump($foo);
+ var_dump($bar);
+ var_dump($fubar);
}
foreach ($queries as $query) {
- test($query);
+ test($query);
}
?>
--EXPECTF--
@@ -41,11 +37,6 @@ array(3) {
string(0) ""
string(0) ""
string(0) ""
-
-Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d
-string(3) "abc"
-string(3) "def"
-string(3) "ghi"
array(3) {
["+foo"]=>
string(3) "def"
@@ -57,11 +48,6 @@ array(3) {
string(0) ""
string(0) ""
string(0) ""
-
-Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d
-string(0) ""
-string(0) ""
-string(0) ""
array(3) {
["foo"]=>
array(4) {
@@ -88,23 +74,3 @@ array(3) {
string(0) ""
string(0) ""
string(0) ""
-
-Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d
-array(4) {
- [0]=>
- string(3) "abc"
- [1]=>
- string(3) "def"
- [2]=>
- string(3) "ghi"
- [3]=>
- string(0) ""
-}
-array(1) {
- [0]=>
- string(0) ""
-}
-array(1) {
- [0]=>
- string(1) "="
-}
diff --git a/ext/mbstring/tests/mb_regex_encoding_variation2.phpt b/ext/mbstring/tests/mb_regex_encoding_variation2.phpt
index 0ef9eb4384..614c309c23 100644
--- a/ext/mbstring/tests/mb_regex_encoding_variation2.phpt
+++ b/ext/mbstring/tests/mb_regex_encoding_variation2.phpt
@@ -79,11 +79,11 @@ $encoding = array('UCS-4', /*1*/
$iterator = 1;
foreach($encoding as $enc) {
- echo "\n-- Iteration $iterator --\n";
- var_dump(mb_regex_encoding());
- var_dump(mb_regex_encoding($enc));
- var_dump(mb_regex_encoding());
- $iterator++;
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(mb_regex_encoding());
+ var_dump(mb_regex_encoding($enc));
+ var_dump(mb_regex_encoding());
+ $iterator++;
}
echo "Done";
?>
diff --git a/ext/mbstring/tests/mb_regex_set_options.phpt b/ext/mbstring/tests/mb_regex_set_options.phpt
index 301df8f118..ae10ba211c 100644
--- a/ext/mbstring/tests/mb_regex_set_options.phpt
+++ b/ext/mbstring/tests/mb_regex_set_options.phpt
@@ -7,11 +7,11 @@ function_exists('mb_regex_set_options') or die("skip\n");
?>
--FILE--
<?php
- mb_regex_set_options( 'x' );
- print mb_ereg_replace(' -', '+', '- - - - -' );
+ mb_regex_set_options( 'x' );
+ print mb_ereg_replace(' -', '+', '- - - - -' );
- mb_regex_set_options( '' );
- print mb_ereg_replace(' -', '+', '- - - - -' );
+ mb_regex_set_options( '' );
+ print mb_ereg_replace(' -', '+', '- - - - -' );
?>
--EXPECT--
+ + + + +-++++
diff --git a/ext/mbstring/tests/mb_send_mail01.phpt b/ext/mbstring/tests/mb_send_mail01.phpt
index 8ed9ea9721..349fab852c 100644
--- a/ext/mbstring/tests/mb_send_mail01.phpt
+++ b/ext/mbstring/tests/mb_send_mail01.phpt
@@ -21,8 +21,8 @@ mb_send_mail($to, mb_language(), "test");
/* neutral (UTF-8) */
if (mb_language("neutral")) {
- mb_internal_encoding("none");
- mb_send_mail($to, "test ".mb_language(), "test");
+ mb_internal_encoding("none");
+ mb_send_mail($to, "test ".mb_language(), "test");
}
?>
--EXPECTF--
diff --git a/ext/mbstring/tests/mb_send_mail02.phpt b/ext/mbstring/tests/mb_send_mail02.phpt
index 923f571486..06b85c691f 100644
--- a/ext/mbstring/tests/mb_send_mail02.phpt
+++ b/ext/mbstring/tests/mb_send_mail02.phpt
@@ -21,8 +21,8 @@ mb_send_mail($to, mb_language(), "test");
/* Japanese (EUC-JP) */
if (mb_language("japanese")) {
- mb_internal_encoding('EUC-JP');
- mb_send_mail($to, "¥Æ¥¹¥È ".mb_language(), "¥Æ¥¹¥È");
+ mb_internal_encoding('EUC-JP');
+ mb_send_mail($to, "¥Æ¥¹¥È ".mb_language(), "¥Æ¥¹¥È");
}
?>
--EXPECTF--
diff --git a/ext/mbstring/tests/mb_send_mail03.phpt b/ext/mbstring/tests/mb_send_mail03.phpt
index 1b16529450..3d5ffd5659 100644
--- a/ext/mbstring/tests/mb_send_mail03.phpt
+++ b/ext/mbstring/tests/mb_send_mail03.phpt
@@ -21,8 +21,8 @@ mb_send_mail($to, mb_language(), "test");
/* English (iso-8859-1) */
if (mb_language("english")) {
- mb_internal_encoding("ISO-8859-1");
- mb_send_mail($to, "test ".mb_language(), "test");
+ mb_internal_encoding("ISO-8859-1");
+ mb_send_mail($to, "test ".mb_language(), "test");
}
?>
--EXPECTF--
diff --git a/ext/mbstring/tests/mb_send_mail04.phpt b/ext/mbstring/tests/mb_send_mail04.phpt
index fbff4cd616..2eccb87189 100644
--- a/ext/mbstring/tests/mb_send_mail04.phpt
+++ b/ext/mbstring/tests/mb_send_mail04.phpt
@@ -21,8 +21,8 @@ mb_send_mail($to, mb_language(), "test");
/* German (iso-8859-15) */
if (mb_language("german")) {
- mb_internal_encoding("ISO-8859-15");
- mb_send_mail($to, "Pr"."\xfc"."fung ".mb_language(), "Pr"."\xfc"."fung");
+ mb_internal_encoding("ISO-8859-15");
+ mb_send_mail($to, "Pr"."\xfc"."fung ".mb_language(), "Pr"."\xfc"."fung");
}
?>
--EXPECTF--
diff --git a/ext/mbstring/tests/mb_send_mail05.phpt b/ext/mbstring/tests/mb_send_mail05.phpt
index aa68ab8c82..53d97ef3d1 100644
--- a/ext/mbstring/tests/mb_send_mail05.phpt
+++ b/ext/mbstring/tests/mb_send_mail05.phpt
@@ -24,8 +24,8 @@ mb_send_mail($to, mb_language(), "test");
/* Simplified Chinese (HK-GB-2312) */
if (mb_language("simplified chinese")) {
- mb_internal_encoding('GB2312');
- mb_send_mail($to, "²âÑé ".mb_language(), "²âÑé");
+ mb_internal_encoding('GB2312');
+ mb_send_mail($to, "²âÑé ".mb_language(), "²âÑé");
}
?>
--EXPECTF--
diff --git a/ext/mbstring/tests/mb_send_mail06.phpt b/ext/mbstring/tests/mb_send_mail06.phpt
index df3f065136..44a877aaee 100644
--- a/ext/mbstring/tests/mb_send_mail06.phpt
+++ b/ext/mbstring/tests/mb_send_mail06.phpt
@@ -24,8 +24,8 @@ mb_send_mail($to, mb_language(), "test");
/* Traditional Chinese () */
if (mb_language("traditional chinese")) {
- mb_internal_encoding('BIG5');
- mb_send_mail($to, "´úÅç ".mb_language(), "´úÅç");
+ mb_internal_encoding('BIG5');
+ mb_send_mail($to, "´úÅç ".mb_language(), "´úÅç");
}
?>
--EXPECTF--
diff --git a/ext/mbstring/tests/mb_send_mail07.phpt b/ext/mbstring/tests/mb_send_mail07.phpt
index f62eccb8b2..9640abc1e8 100644
--- a/ext/mbstring/tests/mb_send_mail07.phpt
+++ b/ext/mbstring/tests/mb_send_mail07.phpt
@@ -24,8 +24,8 @@ mb_send_mail($to, mb_language(), "test");
/* Korean */
if (mb_language("korean")) {
- mb_internal_encoding('EUC-KR');
- mb_send_mail($to, "Å×½ºÆ® ".mb_language(), "Å×½ºÆ®");
+ mb_internal_encoding('EUC-KR');
+ mb_send_mail($to, "Å×½ºÆ® ".mb_language(), "Å×½ºÆ®");
}
?>
--EXPECTF--
diff --git a/ext/mbstring/tests/mb_split-compat-01.phpt b/ext/mbstring/tests/mb_split-compat-01.phpt
index 8dbc82c130..38adc2a7dd 100644
--- a/ext/mbstring/tests/mb_split-compat-01.phpt
+++ b/ext/mbstring/tests/mb_split-compat-01.phpt
@@ -8,10 +8,10 @@ function_exists('mb_split') or die("skip mb_split() is not available in this bui
--FILE--
<?php
/* (counterpart: ext/standard/tests/reg/009.phpt) */
- $a=mb_split("[[:space:]]","this is a
+ $a=mb_split("[[:space:]]","this is a
test");
- echo count($a) . "\n";
- for ($i = 0; $i < count($a); $i++) {
+ echo count($a) . "\n";
+ for ($i = 0; $i < count($a); $i++) {
echo $a[$i] . "\n";
}
?>
diff --git a/ext/mbstring/tests/mb_split.phpt b/ext/mbstring/tests/mb_split.phpt
index d2476658da..a2260ca059 100644
--- a/ext/mbstring/tests/mb_split.phpt
+++ b/ext/mbstring/tests/mb_split.phpt
@@ -5,34 +5,32 @@ mb_split()
extension_loaded('mbstring') or die('skip mbstring not available');
function_exists('mb_split') or die("skip mb_split() is not available in this build");
?>
---INI--
-mbstring.func_overload=0
--FILE--
<?php
- mb_regex_set_options( '' );
- mb_regex_encoding( 'EUC-JP' );
+ mb_regex_set_options( '' );
+ mb_regex_encoding( 'EUC-JP' );
- function verify_split( $spliton, $str, $count = 0 )
- {
- $result1 = mb_split( $spliton, $str, $count );
- $result2 = preg_split( "/$spliton/", $str, $count );
- if ( $result1 == $result2 ) {
- print "ok\n";
- } else {
- print count($result1).'-'.count($result2)."\n";
- }
- }
+ function verify_split( $spliton, $str, $count = 0 )
+ {
+ $result1 = mb_split( $spliton, $str, $count );
+ $result2 = preg_split( "/$spliton/", $str, $count );
+ if ( $result1 == $result2 ) {
+ print "ok\n";
+ } else {
+ print count($result1).'-'.count($result2)."\n";
+ }
+ }
- var_dump( mb_split( " ", "a b c d e f g" )
- == mb_split( "[[:space:]]", "a\nb\tc\nd e f g" ) );
+ var_dump( mb_split( " ", "a b c d e f g" )
+ == mb_split( "[[:space:]]", "a\nb\tc\nd e f g" ) );
- for ( $i = 1; $i < 5; ++$i ) {
- verify_split( " ", "a\tb\tc\td e\tf g", $i );
- }
+ for ( $i = 1; $i < 5; ++$i ) {
+ verify_split( " ", "a\tb\tc\td e\tf g", $i );
+ }
- for ( $i = 1; $i < 5; ++$i ) {
- verify_split( "\xa1\xa1+", "\xa1\xa1\xa1\xa2\xa2\xa1\xa1\xa1\xa1\xa1\xa1\xa2\xa2\xa1\xa1\xa1", $i );
- }
+ for ( $i = 1; $i < 5; ++$i ) {
+ verify_split( "\xa1\xa1+", "\xa1\xa1\xa1\xa2\xa2\xa1\xa1\xa1\xa1\xa1\xa1\xa2\xa2\xa1\xa1\xa1", $i );
+ }
?>
--EXPECT--
bool(true)
diff --git a/ext/mbstring/tests/mb_str_functions_opt-parameter.phpt b/ext/mbstring/tests/mb_str_functions_opt-parameter.phpt
index 6219e585eb..fc99a48747 100644
--- a/ext/mbstring/tests/mb_str_functions_opt-parameter.phpt
+++ b/ext/mbstring/tests/mb_str_functions_opt-parameter.phpt
@@ -16,7 +16,6 @@ echo mb_substr('foobarbaz', 6, null, 'UTF-8') . "\n";
echo mb_strcut('foobarbaz', 6, null, 'UTF-8') . "\n";
echo mb_strimwidth('foobar', 0, 3, null, 'UTF-8') . "\n";
?>
-==DONE==
--EXPECT--
1
2
@@ -29,4 +28,3 @@ baz
baz
baz
foo
-==DONE==
diff --git a/ext/mbstring/tests/mb_str_split_utf8_utf16.phpt b/ext/mbstring/tests/mb_str_split_utf8_utf16.phpt
index d53dd088de..39bfb0175f 100644
--- a/ext/mbstring/tests/mb_str_split_utf8_utf16.phpt
+++ b/ext/mbstring/tests/mb_str_split_utf8_utf16.phpt
@@ -11,14 +11,14 @@ ini_set('include_path','.');
include_once('common.inc');
/* 123 string and 4-bytes length character 0xf09280a9 */
-$utf8 = pack("H*", "313233f09280a9");
+$utf8 = pack("H*", "313233f09280a9");
/* 123 string and 4-bytes length character 0xf09280a9 head without tail */
-$utf8_bad = pack("H*", "313233f092");
+$utf8_bad = pack("H*", "313233f092");
/* very first and very last utf-16 4-bytes characters */
-$utf16_first_be = pack("H*", "d800dc00");
-$utf16_first_le = pack("H*", "00d800dc");
+$utf16_first_be = pack("H*", "d800dc00");
+$utf16_first_le = pack("H*", "00d800dc");
$utf16_last_be = pack("H*", "dbffdfff");
$utf16_last_le = pack("H*", "ffdbffdf");
@@ -35,37 +35,37 @@ $utf16le_bad = $utf16_first_le . $utf16le_char_bad;
/* print each chunk as HEX string */
echo "UTF-8:";
foreach(mb_str_split($utf8, 2) as $chunk){
- printf(" l:%d v:%s", strlen($chunk), unpack("H*", $chunk)[1]);
+ printf(" l:%d v:%s", strlen($chunk), unpack("H*", $chunk)[1]);
}
echo PHP_EOL;
echo "BAD UTF-8:";
foreach(mb_str_split($utf8_bad, 2) as $chunk){
- printf(" l:%d v:%s", strlen($chunk), unpack("H*", $chunk)[1]);
+ printf(" l:%d v:%s", strlen($chunk), unpack("H*", $chunk)[1]);
}
echo PHP_EOL;
echo "UTF-16BE:";
foreach(mb_str_split($utf16be, 1, "UTF-16BE") as $chunk){
- printf(" l:%d v:%s", strlen($chunk), unpack("H*", $chunk)[1]);
+ printf(" l:%d v:%s", strlen($chunk), unpack("H*", $chunk)[1]);
}
echo PHP_EOL;
echo "UTF-16LE:";
foreach(mb_str_split($utf16le, 1, "UTF-16LE") as $chunk){
- printf(" l:%d v:%s", strlen($chunk), unpack("H*", $chunk)[1]);
+ printf(" l:%d v:%s", strlen($chunk), unpack("H*", $chunk)[1]);
}
echo PHP_EOL;
echo "BAD UTF-16BE:";
foreach(mb_str_split($utf16be_bad, 1, "UTF-16BE") as $chunk){
- printf(" l:%d v:%s", strlen($chunk), unpack("H*", $chunk)[1]);
+ printf(" l:%d v:%s", strlen($chunk), unpack("H*", $chunk)[1]);
}
echo PHP_EOL;
echo "BAD UTF-16LE:";
foreach(mb_str_split($utf16le_bad, 1, "UTF-16LE") as $chunk){
- printf(" l:%d v:%s", strlen($chunk), unpack("H*", $chunk)[1]);
+ printf(" l:%d v:%s", strlen($chunk), unpack("H*", $chunk)[1]);
}
echo PHP_EOL;
diff --git a/ext/mbstring/tests/mb_str_unknown_encoding.phpt b/ext/mbstring/tests/mb_str_unknown_encoding.phpt
index 393b0b55b1..1cba531941 100644
--- a/ext/mbstring/tests/mb_str_unknown_encoding.phpt
+++ b/ext/mbstring/tests/mb_str_unknown_encoding.phpt
@@ -11,7 +11,7 @@ mb_chr(1, 'UTF-0');
mb_convert_case('coudenys', MB_CASE_UPPER, 'UTF-0');
mb_convert_encoding('coudenys', 'UTF-8', 'UTF-0');
mb_convert_kana('coudenys', 'KV', 'UTF-0');
-mb_decode_numericentity('coudenys', 'KV', 'UTF-0');
+mb_decode_numericentity('coudenys', [], 'UTF-0');
mb_ord('coudenys', 'UTF-0');
mb_strcut('coudenys', 0, 4, 'UTF-0');
mb_strimwidth('coudenys', 0, 4, '', 'UTF-0');
diff --git a/ext/mbstring/tests/mb_stripos.phpt b/ext/mbstring/tests/mb_stripos.phpt
index 9da6456992..900b222c93 100644
--- a/ext/mbstring/tests/mb_stripos.phpt
+++ b/ext/mbstring/tests/mb_stripos.phpt
@@ -41,30 +41,6 @@ print mb_stripos($euc_jp, 0, -15, 'EUC-JP') . "\n";
print mb_stripos($euc_jp, 0, -43, 'EUC-JP') . "\n";
-// Invalid offset - should return false with warning
-print ("== INVALID OFFSET ==\n");
-
-$r = mb_stripos($euc_jp, 'ÆüËܸì', 44, 'EUC-JP');
-($r === FALSE) ? print "OK_INVALID_OFFSET\n" : print "NG_INVALID_OFFSET\n";
-$r = mb_stripos($euc_jp, 'ÆüËܸì', 50, 'EUC-JP');
-($r === FALSE) ? print "OK_INVALID_OFFSET\n" : print "NG_INVALID_OFFSET\n";
-$r = mb_stripos($euc_jp, '0', 50, 'EUC-JP');
-($r === FALSE) ? print "OK_INVALID_OFFSET\n" : print "NG_INVALID_OFFSET\n";
-$r = mb_stripos($euc_jp, 3, 50, 'EUC-JP');
-($r === FALSE) ? print "OK_INVALID_OFFSET\n" : print "NG_INVALID_OFFSET\n";
-$r = mb_stripos($euc_jp, 0, 50, 'EUC-JP');
-($r === FALSE) ? print "OK_INVALID_OFFSET\n" : print "NG_INVALID_OFFSET\n";
-$r = mb_stripos($euc_jp, 'ÆüËܸì', -50, 'EUC-JP');
-($r === FALSE) ? print "OK_INVALID_OFFSET\n" : print "NG_INVALID_OFFSET\n";
-$r = mb_stripos($euc_jp, '0', -50, 'EUC-JP');
-($r === FALSE) ? print "OK_INVALID_OFFSET\n" : print "NG_INVALID_OFFSET\n";
-$r = mb_stripos($euc_jp, 3, -50, 'EUC-JP');
-($r === FALSE) ? print "OK_INVALID_OFFSET\n" : print "NG_INVALID_OFFSET\n";
-$r = mb_stripos($euc_jp, 0, -50, 'EUC-JP');
-($r === FALSE) ? print "OK_INVALID_OFFSET\n" : print "NG_INVALID_OFFSET\n";
-$r = mb_stripos($euc_jp, 0, -44, 'EUC-JP');
-($r === FALSE) ? print "OK_INVALID_OFFSET\n" : print "NG_INVALID_OFFSET\n";
-
// Out of range - should return false
print ("== OUT OF RANGE ==\n");
@@ -125,20 +101,7 @@ $r = mb_stripos($euc_jp, '´Ú¹ñ¸ì');
$r = mb_stripos($euc_jp, "\n");
($r === FALSE) ? print "OK_NEWLINE\n" : print "NG_NEWLINE\n";
-
-// Invalid Parameters
-echo "== INVALID PARAMETER TEST ==\n";
-
-$r = mb_stripos($euc_jp,'','EUC-JP');
-($r === NULL) ? print("OK_NULL\n") : print("NG_NULL\n");
-$r = mb_stripos($euc_jp, $t_ary, 'EUC-JP');
-($r === NULL) ? print("OK_ARRAY\n") : print("NG_ARRAY\n");
-$r = mb_stripos($euc_jp, $t_obj, 'EUC-JP');
-($r === NULL) ? print("OK_OBJECT\n") : print("NG_OBJECT\n");
-$r = mb_stripos($euc_jp, $t_obj, 'BAD_ENCODING');
-($r === NULL) ? print("OK_BAD_ENCODING\n") : print("NG_BAD_ENCODING\n");
?>
-==DONE==
--EXPECTF--
String len: 43
== POSITIVE OFFSET ==
@@ -156,37 +119,6 @@ String len: 43
33
30
0
-== INVALID OFFSET ==
-
-Warning: mb_stripos(): Offset not contained in string in %s on line %d
-OK_INVALID_OFFSET
-
-Warning: mb_stripos(): Offset not contained in string in %s on line %d
-OK_INVALID_OFFSET
-
-Warning: mb_stripos(): Offset not contained in string in %s on line %d
-OK_INVALID_OFFSET
-
-Warning: mb_stripos(): Offset not contained in string in %s on line %d
-OK_INVALID_OFFSET
-
-Warning: mb_stripos(): Offset not contained in string in %s on line %d
-OK_INVALID_OFFSET
-
-Warning: mb_stripos(): Offset not contained in string in %s on line %d
-OK_INVALID_OFFSET
-
-Warning: mb_stripos(): Offset not contained in string in %s on line %d
-OK_INVALID_OFFSET
-
-Warning: mb_stripos(): Offset not contained in string in %s on line %d
-OK_INVALID_OFFSET
-
-Warning: mb_stripos(): Offset not contained in string in %s on line %d
-OK_INVALID_OFFSET
-
-Warning: mb_stripos(): Offset not contained in string in %s on line %d
-OK_INVALID_OFFSET
== OUT OF RANGE ==
OK_OUT_RANGE
OK_OUT_RANGE
@@ -213,17 +145,3 @@ OK_NEWLINE
0
OK_STR
OK_NEWLINE
-== INVALID PARAMETER TEST ==
-
-Warning: mb_stripos() expects parameter 3 to be int, string given in %s on line %d
-OK_NULL
-
-Warning: mb_stripos() expects parameter 2 to be string, array given in %s on line %d
-OK_ARRAY
-
-Warning: mb_stripos() expects parameter 2 to be string, object given in %s on line %d
-OK_OBJECT
-
-Warning: mb_stripos() expects parameter 2 to be string, object given in %s on line %d
-OK_BAD_ENCODING
-==DONE==
diff --git a/ext/mbstring/tests/mb_stripos_empty_needle.phpt b/ext/mbstring/tests/mb_stripos_empty_needle.phpt
new file mode 100644
index 0000000000..d991e8bdb5
--- /dev/null
+++ b/ext/mbstring/tests/mb_stripos_empty_needle.phpt
@@ -0,0 +1,94 @@
+--TEST--
+Test mb_stripos() function : with empty needle
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_stripos') or die("skip mb_stripos() is not available in this build");
+?>
+--FILE--
+<?php
+
+mb_internal_encoding('UTF-8');
+
+$string_ascii = 'abc def';
+// Japanese string in UTF-8
+$string_mb = "日本語テキストã§ã™ã€‚0123456789。";
+
+echo "\n-- ASCII string without offset --\n";
+var_dump(mb_stripos($string_ascii, ''));
+
+echo "\n-- ASCII string with in range positive offset --\n";
+var_dump(mb_stripos($string_ascii, '', 2));
+
+echo "\n-- ASCII string with in range negative offset --\n";
+var_dump(mb_stripos($string_ascii, '', -2));
+
+echo "\n-- ASCII string with out of bound positive offset --\n";
+try {
+ var_dump(mb_stripos($string_ascii, '', 150));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+echo "\n-- ASCII string with out of bound negative offset --\n";
+try {
+ var_dump(mb_stripos($string_ascii, '', -150));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+
+echo "\n-- Multi-byte string without offset --\n";
+var_dump(mb_stripos($string_mb, ''));
+
+echo "\n-- Multi-byte string with in range positive offset --\n";
+var_dump(mb_stripos($string_mb, '', 2));
+
+echo "\n-- Multi-byte string with in range negative offset --\n";
+var_dump(mb_stripos($string_mb, '', -2));
+
+echo "\n-- Multi-byte string with out of bound positive offset --\n";
+try {
+ var_dump(mb_stripos($string_mb, '', 150));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+echo "\n-- Multi-byte string with out of bound negative offset --\n";
+try {
+ var_dump(mb_stripos($string_mb, '', -150));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+?>
+--EXPECT--
+-- ASCII string without offset --
+int(0)
+
+-- ASCII string with in range positive offset --
+int(2)
+
+-- ASCII string with in range negative offset --
+int(5)
+
+-- ASCII string with out of bound positive offset --
+Offset not contained in string
+
+-- ASCII string with out of bound negative offset --
+Offset not contained in string
+
+-- Multi-byte string without offset --
+int(0)
+
+-- Multi-byte string with in range positive offset --
+int(2)
+
+-- Multi-byte string with in range negative offset --
+int(19)
+
+-- Multi-byte string with out of bound positive offset --
+Offset not contained in string
+
+-- Multi-byte string with out of bound negative offset --
+Offset not contained in string
diff --git a/ext/mbstring/tests/mb_stripos_invalid_offset.phpt b/ext/mbstring/tests/mb_stripos_invalid_offset.phpt
new file mode 100644
index 0000000000..f4ce16d010
--- /dev/null
+++ b/ext/mbstring/tests/mb_stripos_invalid_offset.phpt
@@ -0,0 +1,93 @@
+--TEST--
+mb_stripos() with invalid offsets
+--SKIPIF--
+<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
+--FILE--
+<?php
+
+ini_set('include_path','.');
+include_once('common.inc');
+mb_internal_encoding('UTF-8') or print("mb_internal_encoding() failed\n");
+
+// Test string
+$string = '0123ã“ã®æ–‡å­—列ã¯æ—¥æœ¬èªžã§ã™ã€‚UTF-8を使ã£ã¦ã„ã¾ã™ã€‚0123日本語ã¯é¢å€’臭ã„。';
+
+$slen = mb_strlen($string);
+echo "String len: $slen\n";
+
+print ("== INVALID OFFSET ==\n");
+
+try {
+ var_dump( mb_stripos($string, '日本語', 44));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+try {
+ var_dump( mb_stripos($string, '日本語', 50));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+try {
+ var_dump( mb_stripos($string, '0', 50));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+try {
+ var_dump(mb_stripos($string, 3, 50));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+try {
+ var_dump(mb_stripos($string, 0, 50));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+try {
+ var_dump(mb_stripos($string, '日本語', -50));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+try {
+ var_dump(mb_stripos($string, '0', -50));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+try {
+ var_dump(mb_stripos($string, 3, -50));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+try {
+ var_dump(mb_stripos($string, 0, -50));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+try {
+ var_dump(mb_stripos($string, 0, -44));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+?>
+--EXPECT--
+String len: 42
+== INVALID OFFSET ==
+Offset not contained in string
+Offset not contained in string
+Offset not contained in string
+Offset not contained in string
+Offset not contained in string
+Offset not contained in string
+Offset not contained in string
+Offset not contained in string
+Offset not contained in string
+Offset not contained in string
diff --git a/ext/mbstring/tests/mb_stripos_variation5_Bug45923.phpt b/ext/mbstring/tests/mb_stripos_variation5_Bug45923.phpt
index cc05393a55..b071fdbff3 100644
--- a/ext/mbstring/tests/mb_stripos_variation5_Bug45923.phpt
+++ b/ext/mbstring/tests/mb_stripos_variation5_Bug45923.phpt
@@ -34,27 +34,30 @@ $needle_mb = base64_decode('44CC');
* 60 is larger than *BYTE* count for $string_mb
*/
for ($i = -30; $i <= 60; $i += 10) {
- echo "\n**-- Offset is: $i --**\n";
- echo "-- ASCII String --\n";
- var_dump(mb_stripos($string_ascii, $needle_ascii, $i));
- echo "--Multibyte String --\n";
- var_dump(mb_stripos($string_mb, $needle_mb, $i, 'UTF-8'));
+ echo "\n**-- Offset is: $i --**\n";
+ echo "-- ASCII String --\n";
+ try {
+ var_dump(mb_stripos($string_ascii, $needle_ascii, $i));
+ } catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
+ echo "--Multibyte String --\n";
+ try {
+ var_dump(mb_stripos($string_mb, $needle_mb, $i, 'UTF-8'));
+ } catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
}
-echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing mb_stripos() : usage variations ***
**-- Offset is: -30 --**
-- ASCII String --
-
-Warning: mb_stripos(): Offset not contained in string in %s on line %d
-bool(false)
+Offset not contained in string
--Multibyte String --
-
-Warning: mb_stripos(): Offset not contained in string in %s on line %d
-bool(false)
+Offset not contained in string
**-- Offset is: -20 --**
-- ASCII String --
@@ -88,41 +91,24 @@ int(20)
**-- Offset is: 30 --**
-- ASCII String --
-
-Warning: mb_stripos(): Offset not contained in string in %s on line %d
-bool(false)
+Offset not contained in string
--Multibyte String --
-
-Warning: mb_stripos(): Offset not contained in string in %s on line %d
-bool(false)
+Offset not contained in string
**-- Offset is: 40 --**
-- ASCII String --
-
-Warning: mb_stripos(): Offset not contained in string in %s on line %d
-bool(false)
+Offset not contained in string
--Multibyte String --
-
-Warning: mb_stripos(): Offset not contained in string in %s on line %d
-bool(false)
+Offset not contained in string
**-- Offset is: 50 --**
-- ASCII String --
-
-Warning: mb_stripos(): Offset not contained in string in %s on line %d
-bool(false)
+Offset not contained in string
--Multibyte String --
-
-Warning: mb_stripos(): Offset not contained in string in %s on line %d
-bool(false)
+Offset not contained in string
**-- Offset is: 60 --**
-- ASCII String --
-
-Warning: mb_stripos(): Offset not contained in string in %s on line %d
-bool(false)
+Offset not contained in string
--Multibyte String --
-
-Warning: mb_stripos(): Offset not contained in string in %s on line %d
-bool(false)
-Done
+Offset not contained in string
diff --git a/ext/mbstring/tests/mb_stristr_basic.phpt b/ext/mbstring/tests/mb_stristr_basic.phpt
index 22fc5b1278..e9ecd8c1d6 100644
--- a/ext/mbstring/tests/mb_stristr_basic.phpt
+++ b/ext/mbstring/tests/mb_stristr_basic.phpt
@@ -48,7 +48,6 @@ $needle2 = base64_decode("zrzOvs6/");
var_dump(mb_stristr($string_mb, $needle2));
?>
-===DONE===
--EXPECT--
*** Testing mb_stristr() : basic functionality ***
@@ -67,4 +66,3 @@ string(44) "ceb1ceb2ceb3ceb4ceb5ceb6ceb7ceb8ceb9cebacebb"
-- Multibyte string: needle doesn't exist --
bool(false)
-===DONE===
diff --git a/ext/mbstring/tests/mb_stristr_empty_needle.phpt b/ext/mbstring/tests/mb_stristr_empty_needle.phpt
new file mode 100644
index 0000000000..60850a942c
--- /dev/null
+++ b/ext/mbstring/tests/mb_stristr_empty_needle.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test mb_stristr() function : with empty needle
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_stristr') or die("skip mb_stristr() is not available in this build");
+?>
+--FILE--
+<?php
+
+mb_internal_encoding('UTF-8');
+
+$string_ascii = 'abc def';
+// Japanese string in UTF-8
+$string_mb = "日本語テキストã§ã™ã€‚0123456789。";
+
+echo "\n-- ASCII string --\n";
+var_dump(mb_stristr($string_ascii, '', false, 'ISO-8859-1'));
+var_dump(mb_stristr($string_ascii, ''));
+var_dump(mb_stristr($string_ascii, '', true));
+
+echo "\n-- Multibyte string --\n";
+var_dump(mb_stristr($string_mb, ''));
+var_dump(mb_stristr($string_mb, '', false, 'utf-8'));
+var_dump(mb_stristr($string_mb, '', true));
+
+?>
+--EXPECT--
+-- ASCII string --
+string(7) "abc def"
+string(7) "abc def"
+string(0) ""
+
+-- Multibyte string --
+string(53) "日本語テキストã§ã™ã€‚0123456789。"
+string(53) "日本語テキストã§ã™ã€‚0123456789。"
+string(0) ""
diff --git a/ext/mbstring/tests/mb_stristr_error2.phpt b/ext/mbstring/tests/mb_stristr_error2.phpt
index d5abd115de..1555f438c5 100644
--- a/ext/mbstring/tests/mb_stristr_error2.phpt
+++ b/ext/mbstring/tests/mb_stristr_error2.phpt
@@ -24,7 +24,6 @@ $part = true;
var_dump( mb_stristr($haystack, $needle, $part, $encoding) );
?>
-===DONE===
--EXPECTF--
*** Testing mb_stristr() : error conditions ***
@@ -32,4 +31,3 @@ var_dump( mb_stristr($haystack, $needle, $part, $encoding) );
Warning: mb_stristr(): Unknown encoding "unknown-encoding" in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/mbstring/tests/mb_stristr_variation5.phpt b/ext/mbstring/tests/mb_stristr_variation5.phpt
index 2fca14ff95..b8161bd3e7 100644
--- a/ext/mbstring/tests/mb_stristr_variation5.phpt
+++ b/ext/mbstring/tests/mb_stristr_variation5.phpt
@@ -47,7 +47,6 @@ var_dump(bin2hex(mb_stristr($string_mb, $needle_mb_mixed, false)));
var_dump(bin2hex(mb_stristr($string_mb, $needle_mb_mixed, true)));
?>
-===DONE===
--EXPECT--
*** Testing mb_stristr() : basic functionality ***
@@ -66,4 +65,3 @@ string(54) "cebccebdcebece9fcea0cea120cebacebbce9cce9dcebecebfcea0"
string(8) "cebacebb"
string(54) "cebccebdcebece9fcea0cea120cebacebbce9cce9dcebecebfcea0"
string(8) "cebacebb"
-===DONE===
diff --git a/ext/mbstring/tests/mb_strlen.phpt b/ext/mbstring/tests/mb_strlen.phpt
index ee71106937..fa546b2c59 100644
--- a/ext/mbstring/tests/mb_strlen.phpt
+++ b/ext/mbstring/tests/mb_strlen.phpt
@@ -2,8 +2,6 @@
mb_strlen()
--SKIPIF--
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
---INI--
-mbstring.func_overload=0
--FILE--
<?php
// TODO: Add more encodings
@@ -55,14 +53,6 @@ print strlen($utf8) . "\n";
// Wrong Parameters
echo "== WRONG PARAMETERS ==\n";
-// Array
-// Note: PHP Warning, strlen() expects parameter 1 to be string, array given
-$r = strlen($t_ary);
-echo $r."\n";
-// Object
-// Note: PHP Warning, strlen() expects parameter 1 to be string, object given
-$r = strlen($t_obj);
-echo $r."\n";
// Wrong encoding
mb_internal_encoding('EUC-JP');
$r = mb_strlen($euc_jp, 'BAD_NAME');
@@ -88,10 +78,4 @@ echo $r."\n";
101
== WRONG PARAMETERS ==
-Warning: strlen() expects parameter 1 to be string, array given in %s on line %d
-
-
-Warning: strlen() expects parameter 1 to be string, object given in %s on line %d
-
-
Warning: mb_strlen(): Unknown encoding "BAD_NAME" in %s on line %d
diff --git a/ext/mbstring/tests/mb_strlen_variation3.phpt b/ext/mbstring/tests/mb_strlen_variation3.phpt
index b5f36dedc1..5a67fdd63b 100644
--- a/ext/mbstring/tests/mb_strlen_variation3.phpt
+++ b/ext/mbstring/tests/mb_strlen_variation3.phpt
@@ -84,22 +84,22 @@ $string_ascii = 'abc def';
$string_mb = base64_decode('44K/44OT44Ol44Os44O844OG44Kj44Oz44Kw44O744Oe44K344O844Oz44O744Kr44Oz44OR44OL44O8');
foreach($encoding as $enc) {
- echo "\n-- Iteration $iterator: $enc --\n";
-
- echo "-- ASCII String --\n";
- if(mb_strlen($string_ascii, $enc)) {
- echo "Encoding $enc recognised\n";
- } else {
- echo "Encoding $enc not recognised\n";
- }
-
- echo "-- Multibyte String --\n";
- if(mb_strlen($string_mb, $enc)){
- echo "Encoding $enc recognised\n";
- } else {
- echo "Encoding $enc not recognised\n";
- }
- $iterator++;
+ echo "\n-- Iteration $iterator: $enc --\n";
+
+ echo "-- ASCII String --\n";
+ if(mb_strlen($string_ascii, $enc)) {
+ echo "Encoding $enc recognised\n";
+ } else {
+ echo "Encoding $enc not recognised\n";
+ }
+
+ echo "-- Multibyte String --\n";
+ if(mb_strlen($string_mb, $enc)){
+ echo "Encoding $enc recognised\n";
+ } else {
+ echo "Encoding $enc not recognised\n";
+ }
+ $iterator++;
}
echo "Done";
diff --git a/ext/mbstring/tests/mb_strpos.phpt b/ext/mbstring/tests/mb_strpos.phpt
index 9bca0ba390..1b689ab95d 100644
--- a/ext/mbstring/tests/mb_strpos.phpt
+++ b/ext/mbstring/tests/mb_strpos.phpt
@@ -41,51 +41,6 @@ print mb_strpos($euc_jp, 0, -15, 'EUC-JP') . "\n";
print mb_strpos($euc_jp, 0, -43, 'EUC-JP') . "\n";
-// Invalid offset - should return false with warning
-print ("== INVALID OFFSET ==\n");
-
-$r = mb_strpos($euc_jp, 'ÆüËܸì', 44, 'EUC-JP');
-($r === FALSE) ? print "OK_INVALID_OFFSET\n" : print "NG_INVALID_OFFSET\n";
-$r = mb_strpos($euc_jp, 'ÆüËܸì', 50, 'EUC-JP');
-($r === FALSE) ? print "OK_INVALID_OFFSET\n" : print "NG_INVALID_OFFSET\n";
-$r = mb_strpos($euc_jp, '0', 50, 'EUC-JP');
-($r === FALSE) ? print "OK_INVALID_OFFSET\n" : print "NG_INVALID_OFFSET\n";
-$r = mb_strpos($euc_jp, 3, 50, 'EUC-JP');
-($r === FALSE) ? print "OK_INVALID_OFFSET\n" : print "NG_INVALID_OFFSET\n";
-$r = mb_strpos($euc_jp, 0, 50, 'EUC-JP');
-($r === FALSE) ? print "OK_INVALID_OFFSET\n" : print "NG_INVALID_OFFSET\n";
-$r = mb_strpos($euc_jp, 'ÆüËܸì', -50, 'EUC-JP');
-($r === FALSE) ? print "OK_INVALID_OFFSET\n" : print "NG_INVALID_OFFSET\n";
-$r = mb_strpos($euc_jp, '0', -50, 'EUC-JP');
-($r === FALSE) ? print "OK_INVALID_OFFSET\n" : print "NG_INVALID_OFFSET\n";
-$r = mb_strpos($euc_jp, 3, -50, 'EUC-JP');
-($r === FALSE) ? print "OK_INVALID_OFFSET\n" : print "NG_INVALID_OFFSET\n";
-$r = mb_strpos($euc_jp, 0, -50, 'EUC-JP');
-($r === FALSE) ? print "OK_INVALID_OFFSET\n" : print "NG_INVALID_OFFSET\n";
-$r = mb_strpos($euc_jp, 0, -44, 'EUC-JP');
-($r === FALSE) ? print "OK_INVALID_OFFSET\n" : print "NG_INVALID_OFFSET\n";
-
-// Out of range - should return false
-print ("== OUT OF RANGE ==\n");
-
-$r = mb_strpos($euc_jp, 'ÆüËܸì', 40, 'EUC-JP');
-($r === FALSE) ? print "OK_OUT_RANGE\n" : print "NG_OUT_RANGE\n";
-$r = mb_strpos($euc_jp, '0', 40, 'EUC-JP');
-($r === FALSE) ? print "OK_OUT_RANGE\n" : print "NG_OUT_RANGE\n";
-$r = mb_strpos($euc_jp, 3, 40, 'EUC-JP');
-($r === FALSE) ? print "OK_OUT_RANGE\n" : print "NG_OUT_RANGE\n";
-$r = mb_strpos($euc_jp, 0, 40, 'EUC-JP');
-($r === FALSE) ? print "OK_OUT_RANGE\n" : print "NG_OUT_RANGE\n";
-$r = mb_strpos($euc_jp, 'ÆüËܸì', -3, 'EUC-JP');
-($r === FALSE) ? print "OK_OUT_RANGE\n" : print "NG_OUT_RANGE\n";
-$r = mb_strpos($euc_jp, '0', -3, 'EUC-JP');
-($r === FALSE) ? print "OK_OUT_RANGE\n" : print "NG_OUT_RANGE\n";
-$r = mb_strpos($euc_jp, 3, -3, 'EUC-JP');
-($r === FALSE) ? print "OK_OUT_RANGE\n" : print "NG_OUT_RANGE\n";
-$r = mb_strpos($euc_jp, 0, -3, 'EUC-JP');
-($r === FALSE) ? print "OK_OUT_RANGE\n" : print "NG_OUT_RANGE\n";
-
-
// Non-existent
echo "== NON-EXISTENT ==\n";
@@ -125,21 +80,8 @@ $r = mb_strpos($euc_jp, '´Ú¹ñ¸ì');
$r = mb_strpos($euc_jp, "\n");
($r === FALSE) ? print "OK_NEWLINE\n" : print "NG_NEWLINE\n";
-
-// Invalid Parameters
-echo "== INVALID PARAMETER TEST ==\n";
-
-$r = mb_strpos($euc_jp,'','EUC-JP');
-($r === NULL) ? print("OK_NULL\n") : print("NG_NULL\n");
-$r = mb_strpos($euc_jp, $t_ary, 'EUC-JP');
-($r === NULL) ? print("OK_ARRAY\n") : print("NG_ARRAY\n");
-$r = mb_strpos($euc_jp, $t_obj, 'EUC-JP');
-($r === NULL) ? print("OK_OBJECT\n") : print("NG_OBJECT\n");
-$r = mb_strpos($euc_jp, $t_obj, 'BAD_ENCODING');
-($r === NULL) ? print("OK_BAD_ENCODING\n") : print("NG_BAD_ENCODING\n");
?>
-==DONE==
---EXPECTF--
+--EXPECT--
String len: 43
== POSITIVE OFFSET ==
10
@@ -156,46 +98,6 @@ String len: 43
33
30
0
-== INVALID OFFSET ==
-
-Warning: mb_strpos(): Offset not contained in string in %s on line %d
-OK_INVALID_OFFSET
-
-Warning: mb_strpos(): Offset not contained in string in %s on line %d
-OK_INVALID_OFFSET
-
-Warning: mb_strpos(): Offset not contained in string in %s on line %d
-OK_INVALID_OFFSET
-
-Warning: mb_strpos(): Offset not contained in string in %s on line %d
-OK_INVALID_OFFSET
-
-Warning: mb_strpos(): Offset not contained in string in %s on line %d
-OK_INVALID_OFFSET
-
-Warning: mb_strpos(): Offset not contained in string in %s on line %d
-OK_INVALID_OFFSET
-
-Warning: mb_strpos(): Offset not contained in string in %s on line %d
-OK_INVALID_OFFSET
-
-Warning: mb_strpos(): Offset not contained in string in %s on line %d
-OK_INVALID_OFFSET
-
-Warning: mb_strpos(): Offset not contained in string in %s on line %d
-OK_INVALID_OFFSET
-
-Warning: mb_strpos(): Offset not contained in string in %s on line %d
-OK_INVALID_OFFSET
-== OUT OF RANGE ==
-OK_OUT_RANGE
-OK_OUT_RANGE
-OK_OUT_RANGE
-OK_OUT_RANGE
-OK_OUT_RANGE
-OK_OUT_RANGE
-OK_OUT_RANGE
-OK_OUT_RANGE
== NON-EXISTENT ==
OK_STR
OK_NEWLINE
@@ -213,17 +115,3 @@ OK_NEWLINE
0
OK_STR
OK_NEWLINE
-== INVALID PARAMETER TEST ==
-
-Warning: mb_strpos() expects parameter 3 to be int, string given in %s on line %d
-OK_NULL
-
-Warning: mb_strpos() expects parameter 2 to be string, array given in %s on line %d
-OK_ARRAY
-
-Warning: mb_strpos() expects parameter 2 to be string, object given in %s on line %d
-OK_OBJECT
-
-Warning: mb_strpos() expects parameter 2 to be string, object given in %s on line %d
-OK_BAD_ENCODING
-==DONE==
diff --git a/ext/mbstring/tests/mb_strpos_empty_needle.phpt b/ext/mbstring/tests/mb_strpos_empty_needle.phpt
new file mode 100644
index 0000000000..da3e984b3a
--- /dev/null
+++ b/ext/mbstring/tests/mb_strpos_empty_needle.phpt
@@ -0,0 +1,93 @@
+--TEST--
+Test mb_strpos() function : with empty needle
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strpos') or die("skip mb_strpos() is not available in this build");
+?>
+--FILE--
+<?php
+
+mb_internal_encoding('UTF-8');
+
+$string_ascii = 'abc def';
+// Japanese string in UTF-8
+$string_mb = "日本語テキストã§ã™ã€‚0123456789。";
+
+echo "\n-- ASCII string without offset --\n";
+var_dump(mb_strpos($string_ascii, ''));
+
+echo "\n-- ASCII string with in range positive offset --\n";
+var_dump(mb_strpos($string_ascii, '', 2));
+
+echo "\n-- ASCII string with in range negative offset --\n";
+var_dump(mb_strpos($string_ascii, '', -2));
+
+echo "\n-- ASCII string with out of bound positive offset --\n";
+try {
+ var_dump(mb_strpos($string_ascii, '', 15));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+echo "\n-- ASCII string with out of bound negative offset --\n";
+try {
+ var_dump(mb_strpos($string_ascii, '', -15));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+echo "\n-- Multi-byte string without offset --\n";
+var_dump(mb_strpos($string_mb, ''));
+
+echo "\n-- Multi-byte string with in range positive offset --\n";
+var_dump(mb_strpos($string_mb, '', 2));
+
+echo "\n-- Multi-byte string with in range negative offset --\n";
+var_dump(mb_strpos($string_mb, '', -2));
+
+echo "\n-- Multi-byte string with out of bound positive offset --\n";
+try {
+ var_dump(mb_strpos($string_mb, '', 150));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+echo "\n-- Multi-byte string with out of bound negative offset --\n";
+try {
+ var_dump(mb_strpos($string_mb, '', -150));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+?>
+--EXPECT--
+-- ASCII string without offset --
+int(0)
+
+-- ASCII string with in range positive offset --
+int(2)
+
+-- ASCII string with in range negative offset --
+int(5)
+
+-- ASCII string with out of bound positive offset --
+Offset not contained in string
+
+-- ASCII string with out of bound negative offset --
+Offset not contained in string
+
+-- Multi-byte string without offset --
+int(0)
+
+-- Multi-byte string with in range positive offset --
+int(2)
+
+-- Multi-byte string with in range negative offset --
+int(19)
+
+-- Multi-byte string with out of bound positive offset --
+Offset not contained in string
+
+-- Multi-byte string with out of bound negative offset --
+Offset not contained in string
diff --git a/ext/mbstring/tests/mb_strpos_invalid_offset.phpt b/ext/mbstring/tests/mb_strpos_invalid_offset.phpt
new file mode 100644
index 0000000000..3e2ea65e9a
--- /dev/null
+++ b/ext/mbstring/tests/mb_strpos_invalid_offset.phpt
@@ -0,0 +1,93 @@
+--TEST--
+mb_strpos() with invalid offsets
+--SKIPIF--
+<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
+--FILE--
+<?php
+
+ini_set('include_path','.');
+include_once('common.inc');
+mb_internal_encoding('UTF-8') or print("mb_internal_encoding() failed\n");
+
+// Test string
+$string = '0123ã“ã®æ–‡å­—列ã¯æ—¥æœ¬èªžã§ã™ã€‚UTF-8を使ã£ã¦ã„ã¾ã™ã€‚0123日本語ã¯é¢å€’臭ã„。';
+
+$slen = mb_strlen($string);
+echo "String len: $slen\n";
+
+print ("== INVALID OFFSET ==\n");
+
+try {
+ var_dump( mb_strpos($string, '日本語', 44));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+try {
+ var_dump( mb_strpos($string, '日本語', 50));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+try {
+ var_dump( mb_strpos($string, '0', 50));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+try {
+ var_dump(mb_strpos($string, 3, 50));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+try {
+ var_dump(mb_strpos($string, 0, 50));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+try {
+ var_dump(mb_strpos($string, '日本語', -50));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+try {
+ var_dump(mb_strpos($string, '0', -50));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+try {
+ var_dump(mb_strpos($string, 3, -50));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+try {
+ var_dump(mb_strpos($string, 0, -50));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+try {
+ var_dump(mb_strpos($string, 0, -44));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+?>
+--EXPECT--
+String len: 42
+== INVALID OFFSET ==
+Offset not contained in string
+Offset not contained in string
+Offset not contained in string
+Offset not contained in string
+Offset not contained in string
+Offset not contained in string
+Offset not contained in string
+Offset not contained in string
+Offset not contained in string
+Offset not contained in string
diff --git a/ext/mbstring/tests/mb_strpos_offset_errors.phpt b/ext/mbstring/tests/mb_strpos_offset_errors.phpt
new file mode 100644
index 0000000000..41d7e257d4
--- /dev/null
+++ b/ext/mbstring/tests/mb_strpos_offset_errors.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Offset errors for various strpos functions
+--FILE--
+<?php
+
+try {
+ var_dump(mb_strpos("f", "bar", 3));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ var_dump(mb_strpos("f", "bar", -3));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ var_dump(mb_strrpos("f", "bar", 3));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ var_dump(mb_strrpos("f", "bar", -3));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ var_dump(mb_stripos("f", "bar", 3));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ var_dump(mb_stripos("f", "bar", -3));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ var_dump(mb_strripos("f", "bar", 3));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ var_dump(mb_strripos("f", "bar", -3));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+?>
+--EXPECT--
+Offset not contained in string
+Offset not contained in string
+Offset not contained in string
+Offset not contained in string
+Offset not contained in string
+Offset not contained in string
+Offset not contained in string
+Offset not contained in string
diff --git a/ext/mbstring/tests/mb_strpos_variation5.phpt b/ext/mbstring/tests/mb_strpos_variation5.phpt
index 097c8dccb4..fe7542099a 100644
--- a/ext/mbstring/tests/mb_strpos_variation5.phpt
+++ b/ext/mbstring/tests/mb_strpos_variation5.phpt
@@ -30,31 +30,34 @@ $needle_mb = base64_decode('44CC');
/*
* Loop through integers as multiples of ten for $offset argument
- * mb_strpos should not be able to accept negative values as $offset.
* 60 is larger than *BYTE* count for $string_mb
*/
for ($i = -30; $i <= 60; $i += 10) {
- echo "\n**-- Offset is: $i --**\n";
- echo "-- ASCII String --\n";
- var_dump(mb_strpos($string_ascii, $needle_ascii, $i));
- echo "--Multibyte String --\n";
- var_dump(mb_strpos($string_mb, $needle_mb, $i, 'UTF-8'));
+ echo "\n**-- Offset is: $i --**\n";
+ echo "-- ASCII String --\n";
+ try {
+ var_dump(mb_strpos($string_ascii, $needle_ascii, $i));
+ } catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
+
+ echo "--Multibyte String --\n";
+ try {
+ var_dump(mb_strpos($string_mb, $needle_mb, $i, 'UTF-8'));
+ } catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
}
-echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing mb_strpos() : usage variations ***
**-- Offset is: -30 --**
-- ASCII String --
-
-Warning: mb_strpos(): Offset not contained in string in %s on line %d
-bool(false)
+Offset not contained in string
--Multibyte String --
-
-Warning: mb_strpos(): Offset not contained in string in %s on line %d
-bool(false)
+Offset not contained in string
**-- Offset is: -20 --**
-- ASCII String --
@@ -88,41 +91,24 @@ int(20)
**-- Offset is: 30 --**
-- ASCII String --
-
-Warning: mb_strpos(): Offset not contained in string in %s on line %d
-bool(false)
+Offset not contained in string
--Multibyte String --
-
-Warning: mb_strpos(): Offset not contained in string in %s on line %d
-bool(false)
+Offset not contained in string
**-- Offset is: 40 --**
-- ASCII String --
-
-Warning: mb_strpos(): Offset not contained in string in %s on line %d
-bool(false)
+Offset not contained in string
--Multibyte String --
-
-Warning: mb_strpos(): Offset not contained in string in %s on line %d
-bool(false)
+Offset not contained in string
**-- Offset is: 50 --**
-- ASCII String --
-
-Warning: mb_strpos(): Offset not contained in string in %s on line %d
-bool(false)
+Offset not contained in string
--Multibyte String --
-
-Warning: mb_strpos(): Offset not contained in string in %s on line %d
-bool(false)
+Offset not contained in string
**-- Offset is: 60 --**
-- ASCII String --
-
-Warning: mb_strpos(): Offset not contained in string in %s on line %d
-bool(false)
+Offset not contained in string
--Multibyte String --
-
-Warning: mb_strpos(): Offset not contained in string in %s on line %d
-bool(false)
-Done
+Offset not contained in string
diff --git a/ext/mbstring/tests/mb_strrchr_basic.phpt b/ext/mbstring/tests/mb_strrchr_basic.phpt
index f13780cf3b..faab33f875 100644
--- a/ext/mbstring/tests/mb_strrchr_basic.phpt
+++ b/ext/mbstring/tests/mb_strrchr_basic.phpt
@@ -42,7 +42,6 @@ $needle2 = base64_decode('44GT44KT44Gr44Gh44Gv44CB5LiW55WM');
var_dump(mb_strrchr($string_mb, $needle2));
?>
-===DONE===
--EXPECT--
*** Testing mb_strrchr() : basic functionality ***
@@ -61,4 +60,3 @@ string(0) ""
-- Multibyte string: needle doesn't exist --
bool(false)
-===DONE===
diff --git a/ext/mbstring/tests/mb_strrchr_empty_needle.phpt b/ext/mbstring/tests/mb_strrchr_empty_needle.phpt
new file mode 100644
index 0000000000..642c9ca15f
--- /dev/null
+++ b/ext/mbstring/tests/mb_strrchr_empty_needle.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test mb_strrchr() function : with empty needle
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strrchr') or die("skip mb_strrchr() is not available in this build");
+?>
+--FILE--
+<?php
+
+mb_internal_encoding('UTF-8');
+
+$string_ascii = 'abc def';
+// Japanese string in UTF-8
+$string_mb = "日本語テキストã§ã™ã€‚0123456789。";
+
+echo "\n-- ASCII string --\n";
+var_dump(mb_strrchr($string_ascii, '', false, 'ISO-8859-1'));
+var_dump(mb_strrchr($string_ascii, ''));
+var_dump(mb_strrchr($string_ascii, '', true));
+
+echo "\n-- Multibyte string --\n";
+var_dump(mb_strrchr($string_mb, ''));
+var_dump(mb_strrchr($string_mb, '', false, 'utf-8'));
+var_dump(mb_strrchr($string_mb, '', true));
+
+?>
+--EXPECT--
+-- ASCII string --
+string(0) ""
+string(0) ""
+string(7) "abc def"
+
+-- Multibyte string --
+string(0) ""
+string(0) ""
+string(53) "日本語テキストã§ã™ã€‚0123456789。"
diff --git a/ext/mbstring/tests/mb_strrchr_error2.phpt b/ext/mbstring/tests/mb_strrchr_error2.phpt
index e81e1befde..35ca2c811f 100644
--- a/ext/mbstring/tests/mb_strrchr_error2.phpt
+++ b/ext/mbstring/tests/mb_strrchr_error2.phpt
@@ -24,7 +24,6 @@ $part = true;
var_dump( mb_strrchr($haystack, $needle, $part, $encoding) );
?>
-===DONE===
--EXPECTF--
*** Testing mb_strrchr() : error conditions ***
@@ -32,4 +31,3 @@ var_dump( mb_strrchr($haystack, $needle, $part, $encoding) );
Warning: mb_strrchr(): Unknown encoding "unknown-encoding" in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/mbstring/tests/mb_strrchr_variation5.phpt b/ext/mbstring/tests/mb_strrchr_variation5.phpt
index 869fdde76f..890e15a080 100644
--- a/ext/mbstring/tests/mb_strrchr_variation5.phpt
+++ b/ext/mbstring/tests/mb_strrchr_variation5.phpt
@@ -47,7 +47,6 @@ else {
?>
-===DONE===
--EXPECT--
*** Testing mb_strrchr() : variation ***
-- Ascii data --
@@ -56,4 +55,3 @@ string(16) "616263646566207a"
-- mb data in utf-8 --
string(30) "e8aa9ee38386e382ade382b9e38388"
string(70) "e697a5e69cace8aa9ee38386e382ade382b9e383883334efbc95efbc96e697a5e69cac"
-===DONE===
diff --git a/ext/mbstring/tests/mb_strrchr_variation6.phpt b/ext/mbstring/tests/mb_strrchr_variation6.phpt
index 8b3108bf69..1003628fd1 100644
--- a/ext/mbstring/tests/mb_strrchr_variation6.phpt
+++ b/ext/mbstring/tests/mb_strrchr_variation6.phpt
@@ -51,7 +51,6 @@ var_dump(mb_strrchr($string_mb, $needle_mb_mixed));
?>
-===DONE===
--EXPECT--
*** Testing mb_strrchr() : variation ***
-- Ascii data --
@@ -62,4 +61,3 @@ bool(false)
string(52) "cebccebdcebecebfcf80cf81cf83cf84cf85cf86cf87cf88cf89"
bool(false)
bool(false)
-===DONE===
diff --git a/ext/mbstring/tests/mb_strrichr_basic.phpt b/ext/mbstring/tests/mb_strrichr_basic.phpt
index 4f82f22474..e08b0e2b00 100644
--- a/ext/mbstring/tests/mb_strrichr_basic.phpt
+++ b/ext/mbstring/tests/mb_strrichr_basic.phpt
@@ -48,7 +48,6 @@ $needle2 = base64_decode('zrzOvs6/');
var_dump(mb_strrichr($string_mb, $needle2));
?>
-===DONE===
--EXPECT--
*** Testing mb_strrichr() : basic functionality ***
@@ -67,4 +66,3 @@ string(44) "ceb1ceb2ceb3ceb4ceb5ceb6ceb7ceb8ceb9cebacebb"
-- Multibyte string: needle doesn't exist --
bool(false)
-===DONE===
diff --git a/ext/mbstring/tests/mb_strrichr_error2.phpt b/ext/mbstring/tests/mb_strrichr_error2.phpt
index fec201e99a..f21b9d8b4f 100644
--- a/ext/mbstring/tests/mb_strrichr_error2.phpt
+++ b/ext/mbstring/tests/mb_strrichr_error2.phpt
@@ -24,7 +24,6 @@ $part = true;
var_dump( mb_strrichr($haystack, $needle, $part, $encoding) );
?>
-===DONE===
--EXPECTF--
*** Testing mb_strrichr() : error conditions ***
@@ -32,4 +31,3 @@ var_dump( mb_strrichr($haystack, $needle, $part, $encoding) );
Warning: mb_strrichr(): Unknown encoding "unknown-encoding" in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/mbstring/tests/mb_strrichr_variation5.phpt b/ext/mbstring/tests/mb_strrichr_variation5.phpt
index a6846cd124..493603f86e 100644
--- a/ext/mbstring/tests/mb_strrichr_variation5.phpt
+++ b/ext/mbstring/tests/mb_strrichr_variation5.phpt
@@ -47,7 +47,6 @@ var_dump(bin2hex(mb_strrichr($string_mb, $needle_mb_mixed, false)));
var_dump(bin2hex(mb_strrichr($string_mb, $needle_mb_mixed, true)));
?>
-===DONE===
--EXPECT--
*** Testing mb_strrichr() : basic functionality ***
@@ -66,4 +65,3 @@ string(20) "ce9cce9dcebecebfcea0"
string(42) "cebacebbcebccebdcebece9fcea0cea120cebacebb"
string(20) "ce9cce9dcebecebfcea0"
string(42) "cebacebbcebccebdcebece9fcea0cea120cebacebb"
-===DONE===
diff --git a/ext/mbstring/tests/mb_strripos_empty_needle.phpt b/ext/mbstring/tests/mb_strripos_empty_needle.phpt
new file mode 100644
index 0000000000..7d41b05a61
--- /dev/null
+++ b/ext/mbstring/tests/mb_strripos_empty_needle.phpt
@@ -0,0 +1,94 @@
+--TEST--
+Test mb_strripos() function : with empty needle
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strripos') or die("skip mb_strripos() is not available in this build");
+?>
+--FILE--
+<?php
+
+mb_internal_encoding('UTF-8');
+
+$string_ascii = 'abc def';
+// Japanese string in UTF-8
+$string_mb = "日本語テキストã§ã™ã€‚0123456789。";
+
+echo "\n-- ASCII string without offset --\n";
+var_dump(mb_strripos($string_ascii, ''));
+
+echo "\n-- ASCII string with in range positive offset --\n";
+var_dump(mb_strripos($string_ascii, '', 2));
+
+echo "\n-- ASCII string with in range negative offset --\n";
+var_dump(mb_strripos($string_ascii, '', -2));
+
+echo "\n-- ASCII string with out of bound positive offset --\n";
+try {
+ var_dump(mb_strripos($string_ascii, '', 15));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+echo "\n-- ASCII string with out of bound negative offset --\n";
+try {
+ var_dump(mb_strripos($string_ascii, '', -15));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+
+echo "\n-- Multi-byte string without offset --\n";
+var_dump(mb_strripos($string_mb, ''));
+
+echo "\n-- Multi-byte string with in range positive offset --\n";
+var_dump(mb_strripos($string_mb, '', 2));
+
+echo "\n-- Multi-byte string with in range negative offset --\n";
+var_dump(mb_strripos($string_mb, '', -2));
+
+echo "\n-- Multi-byte string with out of bound positive offset --\n";
+try {
+ var_dump(mb_strripos($string_mb, '', 150));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+echo "\n-- Multi-byte string with out of bound negative offset --\n";
+try {
+ var_dump(mb_strripos($string_mb, '', -150));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+?>
+--EXPECT--
+-- ASCII string without offset --
+int(7)
+
+-- ASCII string with in range positive offset --
+int(7)
+
+-- ASCII string with in range negative offset --
+int(5)
+
+-- ASCII string with out of bound positive offset --
+Offset not contained in string
+
+-- ASCII string with out of bound negative offset --
+Offset not contained in string
+
+-- Multi-byte string without offset --
+int(21)
+
+-- Multi-byte string with in range positive offset --
+int(21)
+
+-- Multi-byte string with in range negative offset --
+int(19)
+
+-- Multi-byte string with out of bound positive offset --
+Offset not contained in string
+
+-- Multi-byte string with out of bound negative offset --
+Offset not contained in string
diff --git a/ext/mbstring/tests/mb_strripos_variation5_Bug45923.phpt b/ext/mbstring/tests/mb_strripos_variation5_Bug45923.phpt
index fd8f6ae226..ad20bfe3d9 100644
--- a/ext/mbstring/tests/mb_strripos_variation5_Bug45923.phpt
+++ b/ext/mbstring/tests/mb_strripos_variation5_Bug45923.phpt
@@ -35,16 +35,24 @@ $needle_mb = base64_decode('44CC');
* 60 is larger than *BYTE* count for $string_mb
*/
for ($i = -10; $i <= 60; $i += 10) {
- echo "\n**-- Offset is: $i --**\n";
- echo "-- ASCII String --\n";
- var_dump(mb_strripos($string_ascii, $needle_ascii, $i));
- echo "--Multibyte String --\n";
- var_dump(mb_strripos($string_mb, $needle_mb, $i, 'UTF-8'));
+ echo "\n**-- Offset is: $i --**\n";
+ echo "-- ASCII String --\n";
+ try {
+ var_dump(mb_strripos($string_ascii, $needle_ascii, $i));
+ } catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
+
+ echo "--Multibyte String --\n";
+ try {
+ var_dump(mb_strripos($string_mb, $needle_mb, $i, 'UTF-8'));
+ } catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
}
-echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing mb_strripos() : usage variations ***
**-- Offset is: -10 --**
@@ -73,41 +81,24 @@ int(20)
**-- Offset is: 30 --**
-- ASCII String --
-
-Warning: mb_strripos(): Offset is greater than the length of haystack string in %s on line %d
-bool(false)
+Offset not contained in string
--Multibyte String --
-
-Warning: mb_strripos(): Offset is greater than the length of haystack string in %s on line %d
-bool(false)
+Offset not contained in string
**-- Offset is: 40 --**
-- ASCII String --
-
-Warning: mb_strripos(): Offset is greater than the length of haystack string in %s on line %d
-bool(false)
+Offset not contained in string
--Multibyte String --
-
-Warning: mb_strripos(): Offset is greater than the length of haystack string in %s on line %d
-bool(false)
+Offset not contained in string
**-- Offset is: 50 --**
-- ASCII String --
-
-Warning: mb_strripos(): Offset is greater than the length of haystack string in %s on line %d
-bool(false)
+Offset not contained in string
--Multibyte String --
-
-Warning: mb_strripos(): Offset is greater than the length of haystack string in %s on line %d
-bool(false)
+Offset not contained in string
**-- Offset is: 60 --**
-- ASCII String --
-
-Warning: mb_strripos(): Offset is greater than the length of haystack string in %s on line %d
-bool(false)
+Offset not contained in string
--Multibyte String --
-
-Warning: mb_strripos(): Offset is greater than the length of haystack string in %s on line %d
-bool(false)
-Done
+Offset not contained in string
diff --git a/ext/mbstring/tests/mb_strrpos_empty_needle.phpt b/ext/mbstring/tests/mb_strrpos_empty_needle.phpt
new file mode 100644
index 0000000000..974c44dac0
--- /dev/null
+++ b/ext/mbstring/tests/mb_strrpos_empty_needle.phpt
@@ -0,0 +1,94 @@
+--TEST--
+Test mb_strrpos() function : with empty needle
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strrpos') or die("skip mb_strrpos() is not available in this build");
+?>
+--FILE--
+<?php
+
+mb_internal_encoding('UTF-8');
+
+$string_ascii = 'abc def';
+// Japanese string in UTF-8
+$string_mb = "日本語テキストã§ã™ã€‚0123456789。";
+
+echo "\n-- ASCII string without offset --\n";
+var_dump(mb_strrpos($string_ascii, ''));
+
+echo "\n-- ASCII string with in range positive offset --\n";
+var_dump(mb_strrpos($string_ascii, '', 2));
+
+echo "\n-- ASCII string with in range negative offset --\n";
+var_dump(mb_strrpos($string_ascii, '', -2));
+
+echo "\n-- ASCII string with out of bound positive offset --\n";
+try {
+ var_dump(mb_strrpos($string_ascii, '', 15));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+echo "\n-- ASCII string with out of bound negative offset --\n";
+try {
+ var_dump(mb_strrpos($string_ascii, '', -15));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+
+echo "\n-- Multi-byte string without offset --\n";
+var_dump(mb_strrpos($string_mb, ''));
+
+echo "\n-- Multi-byte string with in range positive offset --\n";
+var_dump(mb_strrpos($string_mb, '', 2));
+
+echo "\n-- Multi-byte string with in range negative offset --\n";
+var_dump(mb_strrpos($string_mb, '', -2));
+
+echo "\n-- Multi-byte string with out of bound positive offset --\n";
+try {
+ var_dump(mb_strrpos($string_mb, '', 150));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+echo "\n-- Multi-byte string with out of bound negative offset --\n";
+try {
+ var_dump(mb_strrpos($string_mb, '', -150));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+?>
+--EXPECT--
+-- ASCII string without offset --
+int(7)
+
+-- ASCII string with in range positive offset --
+int(7)
+
+-- ASCII string with in range negative offset --
+int(5)
+
+-- ASCII string with out of bound positive offset --
+Offset not contained in string
+
+-- ASCII string with out of bound negative offset --
+Offset not contained in string
+
+-- Multi-byte string without offset --
+int(21)
+
+-- Multi-byte string with in range positive offset --
+int(21)
+
+-- Multi-byte string with in range negative offset --
+int(19)
+
+-- Multi-byte string with out of bound positive offset --
+Offset not contained in string
+
+-- Multi-byte string with out of bound negative offset --
+Offset not contained in string
diff --git a/ext/mbstring/tests/mb_strrpos_encoding_3rd_param.phpt b/ext/mbstring/tests/mb_strrpos_encoding_3rd_param.phpt
deleted file mode 100644
index 66ccd00908..0000000000
--- a/ext/mbstring/tests/mb_strrpos_encoding_3rd_param.phpt
+++ /dev/null
@@ -1,14 +0,0 @@
---TEST--
-Passing encoding as 3rd param to mb_strrpos (legacy)
---SKIPIF--
-<?php if(!extension_loaded('mbstring')) die('skip mbstring not loaded'); ?>
---FILE--
-<?php
-
-mb_internal_encoding('UTF-16');
-var_dump(mb_strrpos("abc abc abc", "abc", "UTF-8"));
-
-?>
---EXPECTF--
-Deprecated: mb_strrpos(): Passing the encoding as third parameter is deprecated. Use an explicit zero offset in %s on line %d
-int(8)
diff --git a/ext/mbstring/tests/mb_strrpos_variation5.phpt b/ext/mbstring/tests/mb_strrpos_variation5.phpt
deleted file mode 100644
index 6b7b75ecd9..0000000000
--- a/ext/mbstring/tests/mb_strrpos_variation5.phpt
+++ /dev/null
@@ -1,73 +0,0 @@
---TEST--
-Test mb_strrpos() function : usage variations - pass encoding as third argument (deprecated behaviour)
---SKIPIF--
-<?php
-extension_loaded('mbstring') or die('skip');
-function_exists('mb_strrpos') or die("skip mb_strrpos() is not available in this build");
-?>
---FILE--
-<?php
-/* Prototype : int mb_strrpos(string $haystack, string $needle [, int $offset [, string $encoding]])
- * Description: Find position of last occurrence of a string within another
- * Source code: ext/mbstring/mbstring.c
- */
-
-/*
- * Testing deprecated behaviour where third argument can be $encoding
- */
-
-echo "*** Testing mb_strrpos() : usage variations ***\n";
-
-$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');
-$needle_mb = base64_decode('44CC');
-
-$stringh = <<<END
-utf-8
-END;
-
-$inputs = array('Double Quoted String' => "utf-8",
- 'Single Quoted String' => 'utf-8',
- 'Heredoc' => $stringh);
-foreach ($inputs as $type => $input) {
- echo "\n-- $type --\n";
- echo "-- With fourth encoding argument --\n";
- var_dump(mb_strrpos($string_mb, $needle_mb, $input, 'utf-8'));
- echo "-- Without fourth encoding argument --\n";
- var_dump(mb_strrpos($string_mb, $needle_mb, $input));
-}
-
-echo "Done";
-?>
---EXPECTF--
-*** Testing mb_strrpos() : usage variations ***
-
--- Double Quoted String --
--- With fourth encoding argument --
-
-Deprecated: mb_strrpos(): Passing the encoding as third parameter is deprecated. Use an explicit zero offset in %s on line %d
-int(20)
--- Without fourth encoding argument --
-
-Deprecated: mb_strrpos(): Passing the encoding as third parameter is deprecated. Use an explicit zero offset in %s on line %d
-int(20)
-
--- Single Quoted String --
--- With fourth encoding argument --
-
-Deprecated: mb_strrpos(): Passing the encoding as third parameter is deprecated. Use an explicit zero offset in %s on line %d
-int(20)
--- Without fourth encoding argument --
-
-Deprecated: mb_strrpos(): Passing the encoding as third parameter is deprecated. Use an explicit zero offset in %s on line %d
-int(20)
-
--- Heredoc --
--- With fourth encoding argument --
-
-Deprecated: mb_strrpos(): Passing the encoding as third parameter is deprecated. Use an explicit zero offset in %s on line %d
-int(20)
--- Without fourth encoding argument --
-
-Deprecated: mb_strrpos(): Passing the encoding as third parameter is deprecated. Use an explicit zero offset in %s on line %d
-int(20)
-Done
diff --git a/ext/mbstring/tests/mb_strstr.phpt b/ext/mbstring/tests/mb_strstr.phpt
index 61b2fcb1c3..87448467a1 100644
--- a/ext/mbstring/tests/mb_strstr.phpt
+++ b/ext/mbstring/tests/mb_strstr.phpt
@@ -5,11 +5,11 @@ mb_strstr()
--FILE--
<?php
function EUC_JP($utf8str) {
- return mb_convert_encoding($utf8str, "EUC-JP", "UTF-8");
+ return mb_convert_encoding($utf8str, "EUC-JP", "UTF-8");
}
function FROM_EUC_JP($eucjpstr) {
- return mb_convert_encoding($eucjpstr, "UTF-8", "EUC-JP");
+ return mb_convert_encoding($eucjpstr, "UTF-8", "EUC-JP");
}
var_dump(mb_strstr("ã‚ã„ã†ãˆãŠã‹ããã‘ã“", "ãŠã‹ã"));
diff --git a/ext/mbstring/tests/mb_strstr_basic.phpt b/ext/mbstring/tests/mb_strstr_basic.phpt
index b7632020c5..d887eb2e94 100644
--- a/ext/mbstring/tests/mb_strstr_basic.phpt
+++ b/ext/mbstring/tests/mb_strstr_basic.phpt
@@ -42,7 +42,6 @@ $needle2 = base64_decode('44GT44KT44Gr44Gh44Gv44CB5LiW55WM');
var_dump(mb_strstr($string_mb, $needle2));
?>
-===DONE===
--EXPECT--
*** Testing mb_strstr() : basic functionality ***
@@ -61,4 +60,3 @@ string(0) ""
-- Multibyte string: needle doesn't exist --
bool(false)
-===DONE===
diff --git a/ext/mbstring/tests/mb_strstr_empty_needle.phpt b/ext/mbstring/tests/mb_strstr_empty_needle.phpt
new file mode 100644
index 0000000000..fd72a7707e
--- /dev/null
+++ b/ext/mbstring/tests/mb_strstr_empty_needle.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test mb_strstr() function : with empty needle
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+function_exists('mb_strstr') or die("skip mb_strstr() is not available in this build");
+?>
+--FILE--
+<?php
+
+mb_internal_encoding('UTF-8');
+
+$string_ascii = 'abc def';
+// Japanese string in UTF-8
+$string_mb = "日本語テキストã§ã™ã€‚0123456789。";
+
+echo "\n-- ASCII string --\n";
+var_dump(mb_strstr($string_ascii, '', false, 'ISO-8859-1'));
+var_dump(mb_strstr($string_ascii, ''));
+var_dump(mb_strstr($string_ascii, '', true));
+
+echo "\n-- Multibyte string --\n";
+var_dump(mb_strstr($string_mb, ''));
+var_dump(mb_strstr($string_mb, '', false, 'utf-8'));
+var_dump(mb_strstr($string_mb, '', true));
+
+?>
+--EXPECT--
+-- ASCII string --
+string(7) "abc def"
+string(7) "abc def"
+string(0) ""
+
+-- Multibyte string --
+string(53) "日本語テキストã§ã™ã€‚0123456789。"
+string(53) "日本語テキストã§ã™ã€‚0123456789。"
+string(0) ""
diff --git a/ext/mbstring/tests/mb_strstr_error2.phpt b/ext/mbstring/tests/mb_strstr_error2.phpt
index 81daccb432..73a0237783 100644
--- a/ext/mbstring/tests/mb_strstr_error2.phpt
+++ b/ext/mbstring/tests/mb_strstr_error2.phpt
@@ -24,7 +24,6 @@ $part = true;
var_dump( mb_strstr($haystack, $needle, $part, $encoding) );
?>
-===DONE===
--EXPECTF--
*** Testing mb_strstr() : error conditions ***
@@ -32,4 +31,3 @@ var_dump( mb_strstr($haystack, $needle, $part, $encoding) );
Warning: mb_strstr(): Unknown encoding "unknown-encoding" in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/mbstring/tests/mb_strstr_variation5.phpt b/ext/mbstring/tests/mb_strstr_variation5.phpt
index 2b6fd238b8..6bfe954814 100644
--- a/ext/mbstring/tests/mb_strstr_variation5.phpt
+++ b/ext/mbstring/tests/mb_strstr_variation5.phpt
@@ -47,7 +47,6 @@ else {
?>
-===DONE===
--EXPECT--
*** Testing mb_strstr() : variation ***
-- Ascii data --
@@ -56,4 +55,3 @@ string(2) "61"
-- mb data in utf-8 --
string(88) "e8aa9ee38386e382ade382b9e383883334efbc95efbc96e697a5e69cace8aa9ee38386e382ade382b9e38388"
string(12) "e697a5e69cac"
-===DONE===
diff --git a/ext/mbstring/tests/mb_strstr_variation6.phpt b/ext/mbstring/tests/mb_strstr_variation6.phpt
index c2438b771e..97831ecb1b 100644
--- a/ext/mbstring/tests/mb_strstr_variation6.phpt
+++ b/ext/mbstring/tests/mb_strstr_variation6.phpt
@@ -51,7 +51,6 @@ var_dump(mb_strstr($string_mb, $needle_mb_mixed));
?>
-===DONE===
--EXPECT--
*** Testing mb_strstr() : variation ***
-- Ascii data --
@@ -62,4 +61,3 @@ bool(false)
string(52) "cebccebdcebecebfcf80cf81cf83cf84cf85cf86cf87cf88cf89"
bool(false)
bool(false)
-===DONE===
diff --git a/ext/mbstring/tests/mb_strtolower_basic.phpt b/ext/mbstring/tests/mb_strtolower_basic.phpt
index 4f727094b1..a96709db84 100644
--- a/ext/mbstring/tests/mb_strtolower_basic.phpt
+++ b/ext/mbstring/tests/mb_strtolower_basic.phpt
@@ -28,9 +28,9 @@ $ascii = mb_strtolower($ascii_upper);
var_dump($ascii);
if($ascii == $ascii_lower) {
- echo "Correctly converted\n";
+ echo "Correctly converted\n";
} else {
- echo "Incorrectly converted\n";
+ echo "Incorrectly converted\n";
}
echo "\n-- Multibyte String --\n";
@@ -38,9 +38,9 @@ $mb = mb_strtolower($greek_upper, 'UTF-8');
var_dump(base64_encode($mb));
if ($mb == $greek_lower) {
- echo "Correctly converted\n";
+ echo "Correctly converted\n";
} else {
- echo "Incorreclty converted\n";
+ echo "Incorrectly converted\n";
}
echo "Done";
diff --git a/ext/mbstring/tests/mb_strtolower_error2.phpt b/ext/mbstring/tests/mb_strtolower_error2.phpt
index 9a0aed0f01..7da402ad6d 100644
--- a/ext/mbstring/tests/mb_strtolower_error2.phpt
+++ b/ext/mbstring/tests/mb_strtolower_error2.phpt
@@ -23,10 +23,8 @@ $encoding = 'unknown-encoding';
var_dump( mb_strtolower($sourcestring, $encoding) );
?>
-===DONE===
--EXPECTF--
*** Testing mb_strtolower() : error conditions***
Warning: mb_strtolower(): Unknown encoding "unknown-encoding" in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/mbstring/tests/mb_strtolower_variation3.phpt b/ext/mbstring/tests/mb_strtolower_variation3.phpt
index bd0bd58c44..2578ef462c 100644
--- a/ext/mbstring/tests/mb_strtolower_variation3.phpt
+++ b/ext/mbstring/tests/mb_strtolower_variation3.phpt
@@ -27,18 +27,18 @@ echo "\n-- Mixed string (mulitbyte and ASCII characters) --\n";
$a = mb_strtolower($string_mixed, 'UTF-8');
var_dump(base64_encode($a));
if ($a == $string_mixed_lower) {
- echo "Correctly Converted\n";
+ echo "Correctly Converted\n";
} else {
- echo "Incorrectly Converted\n";
+ echo "Incorrectly Converted\n";
}
echo "\n-- Multibyte Only String--\n";
$b = mb_strtolower($string_all_mb, 'UTF-8');
var_dump(base64_encode($b));
if ($b == $string_all_mb) { // Japanese characters only - should not be any conversion
- echo "Correctly Converted\n";
+ echo "Correctly Converted\n";
} else {
- echo "Incorrectly Converted\n";
+ echo "Incorrectly Converted\n";
}
echo "Done";
diff --git a/ext/mbstring/tests/mb_strtolower_variation4.phpt b/ext/mbstring/tests/mb_strtolower_variation4.phpt
index 17bd8c7fe2..590ead4e2d 100644
--- a/ext/mbstring/tests/mb_strtolower_variation4.phpt
+++ b/ext/mbstring/tests/mb_strtolower_variation4.phpt
@@ -26,14 +26,14 @@ $lowers = array('Basic Latin' => 'abcdefghijklmnopqrstuvwxyz',
'Russian' => base64_decode('0LDQsdCy0LPQtNC10LbQtw=='));
foreach ($uppers as $lang => $sourcestring) {
- echo "\n-- $lang --\n";
- $a = mb_strtolower($sourcestring, 'utf-8');
- var_dump(base64_encode($a));
- if ($a == $lowers[$lang]) {
- echo "Correctly Converted\n";
- } else {
- echo "Incorrectly Converted\n";
- }
+ echo "\n-- $lang --\n";
+ $a = mb_strtolower($sourcestring, 'utf-8');
+ var_dump(base64_encode($a));
+ if ($a == $lowers[$lang]) {
+ echo "Correctly Converted\n";
+ } else {
+ echo "Incorrectly Converted\n";
+ }
}
echo "Done";
diff --git a/ext/mbstring/tests/mb_strtoupper_basic.phpt b/ext/mbstring/tests/mb_strtoupper_basic.phpt
index 72601442fd..1c0357dc34 100644
--- a/ext/mbstring/tests/mb_strtoupper_basic.phpt
+++ b/ext/mbstring/tests/mb_strtoupper_basic.phpt
@@ -29,9 +29,9 @@ $ascii = mb_strtoupper($ascii_lower);
var_dump(base64_encode($ascii));
if($ascii == $ascii_upper) {
- echo "Correctly converted\n";
+ echo "Correctly converted\n";
} else {
- echo "Incorrectly converted\n";
+ echo "Incorrectly converted\n";
}
echo "\n-- Multibyte String --\n";
@@ -39,9 +39,9 @@ $mb = mb_strtoupper($greek_lower, 'UTF-8');
var_dump(base64_encode($mb));
if ($mb == $greek_upper) {
- echo "Correctly converted\n";
+ echo "Correctly converted\n";
} else {
- echo "Incorreclty converted\n";
+ echo "Incorrectly converted\n";
}
echo "Done";
diff --git a/ext/mbstring/tests/mb_strtoupper_variation3.phpt b/ext/mbstring/tests/mb_strtoupper_variation3.phpt
index 3a40cb9bf3..d1f0244ae1 100644
--- a/ext/mbstring/tests/mb_strtoupper_variation3.phpt
+++ b/ext/mbstring/tests/mb_strtoupper_variation3.phpt
@@ -28,18 +28,18 @@ echo "\n-- Mixed string (mulitbyte and ASCII characters) --\n";
$a = mb_strtoupper($string_mixed_lower, 'UTF-8');
var_dump(base64_encode($a));
if ($a == $string_mixed_upper) {
- echo "Correctly Converted\n";
+ echo "Correctly Converted\n";
} else {
- echo "Incorrectly Converted\n";
+ echo "Incorrectly Converted\n";
}
echo "\n-- Multibyte Only String--\n";
$b = mb_strtoupper($string_all_mb, 'UTF-8');
var_dump(base64_encode($b));
if ($b == $string_all_mb) { // Japanese characters only - should not be any conversion
- echo "Correctly Converted\n";
+ echo "Correctly Converted\n";
} else {
- echo "Incorrectly Converted\n";
+ echo "Incorrectly Converted\n";
}
echo "Done";
diff --git a/ext/mbstring/tests/mb_strtoupper_variation4.phpt b/ext/mbstring/tests/mb_strtoupper_variation4.phpt
index 7b126e671b..81a8bdd1da 100644
--- a/ext/mbstring/tests/mb_strtoupper_variation4.phpt
+++ b/ext/mbstring/tests/mb_strtoupper_variation4.phpt
@@ -27,14 +27,14 @@ $lowers = array('Basic Latin' => 'abcdefghijklmnopqrstuvwxyz',
'Russian' => base64_decode('0LDQsdCy0LPQtNC10LbQtw=='));
foreach ($lowers as $lang => $sourcestring) {
- echo "\n-- $lang --\n";
- $a = mb_strtoupper($sourcestring, 'UTF-8');
- var_dump(base64_encode($a));
- if ($a == $uppers[$lang]) {
- echo "Correctly Converted\n";
- } else {
- echo "Incorrectly Converted\n";
- }
+ echo "\n-- $lang --\n";
+ $a = mb_strtoupper($sourcestring, 'UTF-8');
+ var_dump(base64_encode($a));
+ if ($a == $uppers[$lang]) {
+ echo "Correctly Converted\n";
+ } else {
+ echo "Incorrectly Converted\n";
+ }
}
echo "Done";
diff --git a/ext/mbstring/tests/mb_substitute_character_basic.phpt b/ext/mbstring/tests/mb_substitute_character_basic.phpt
index 9fa3a5b1ac..63ae10f76c 100644
--- a/ext/mbstring/tests/mb_substitute_character_basic.phpt
+++ b/ext/mbstring/tests/mb_substitute_character_basic.phpt
@@ -27,7 +27,6 @@ var_dump( mb_substitute_character() );
var_dump( mb_substitute_character("b") );
?>
-===DONE===
--EXPECTF--
*** Testing mb_substitute_character() : basic functionality ***
int(63)
@@ -40,4 +39,3 @@ string(4) "none"
Warning: mb_substitute_character(): Unknown character in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/mbstring/tests/mb_substitute_character_variation1.phpt b/ext/mbstring/tests/mb_substitute_character_variation1.phpt
index f738876469..53a21c8787 100644
--- a/ext/mbstring/tests/mb_substitute_character_variation1.phpt
+++ b/ext/mbstring/tests/mb_substitute_character_variation1.phpt
@@ -16,11 +16,11 @@ function_exists('mb_substitute_character') or die("skip mb_substitute_character(
echo "*** Testing mb_substitute_character() : usage variation ***\n";
// Define error handler
-function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
- if (error_reporting() != 0) {
- // report non-silenced errors
- echo "Error: $err_no - $err_msg, $filename($linenum)\n";
- }
+function test_error_handler($err_no, $err_msg, $filename, $linenum) {
+ if (error_reporting() & $err_no) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ }
}
set_error_handler('test_error_handler');
@@ -33,9 +33,9 @@ unset ($unset_var);
// define some classes
class classWithToString
{
- public function __toString() {
- return "Class A object";
- }
+ public function __toString() {
+ return "Class A object";
+ }
}
class classWithoutToString
@@ -118,7 +118,6 @@ foreach($inputs as $key =>$value) {
fclose($fp);
?>
-===DONE===
--EXPECTF--
*** Testing mb_substitute_character() : usage variation ***
@@ -227,4 +226,3 @@ bool(false)
--unset var--
Error: 2 - mb_substitute_character(): Unknown character, %s(%d)
bool(false)
-===DONE===
diff --git a/ext/mbstring/tests/mb_substitute_character_variation2.phpt b/ext/mbstring/tests/mb_substitute_character_variation2.phpt
index d447dc87d7..84b1d569c2 100644
--- a/ext/mbstring/tests/mb_substitute_character_variation2.phpt
+++ b/ext/mbstring/tests/mb_substitute_character_variation2.phpt
@@ -29,11 +29,9 @@ var_dump(bin2hex(mb_convert_encoding($string_mb, "ISO-8859-1", "UTF-8")));
?>
-===DONE===
--EXPECT--
*** Testing mb_substitute_character() : variation ***
string(14) "3f3f3f3f3f3f3f"
string(14) "42424242424242"
string(0) ""
string(14) "3f3f3f3f3f3f3f"
-===DONE===
diff --git a/ext/mbstring/tests/mb_substr.phpt b/ext/mbstring/tests/mb_substr.phpt
index 28b35ea910..ab4f7c17d6 100644
--- a/ext/mbstring/tests/mb_substr.phpt
+++ b/ext/mbstring/tests/mb_substr.phpt
@@ -4,7 +4,6 @@ mb_substr()
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
--INI--
output_handler=
-mbstring.func_overload=0
--FILE--
<?php
// TODO: Add more encodings
diff --git a/ext/mbstring/tests/mb_substr_count.phpt b/ext/mbstring/tests/mb_substr_count.phpt
index 5be5109375..84571515de 100644
--- a/ext/mbstring/tests/mb_substr_count.phpt
+++ b/ext/mbstring/tests/mb_substr_count.phpt
@@ -6,30 +6,30 @@ mb_substr_count()
output_handler=
--FILE--
<?php
- mb_internal_encoding("EUC-JP");
- var_dump(@mb_substr_count("", ""));
- var_dump(@mb_substr_count("¤¢", ""));
- var_dump(@mb_substr_count("", "¤¢"));
- var_dump(@mb_substr_count("", "¤¢"));
- var_dump(@mb_substr_count("", chr(0)));
+ mb_internal_encoding("EUC-JP");
+ var_dump(@mb_substr_count("", ""));
+ var_dump(@mb_substr_count("¤¢", ""));
+ var_dump(@mb_substr_count("", "¤¢"));
+ var_dump(@mb_substr_count("", "¤¢"));
+ var_dump(@mb_substr_count("", chr(0)));
- $a = str_repeat("abcacba", 100);
- var_dump(@mb_substr_count($a, "bca"));
+ $a = str_repeat("abcacba", 100);
+ var_dump(@mb_substr_count($a, "bca"));
- $a = str_repeat("¤¢¤¤¤¦¤¢¤¦¤¤¤¢", 100);
- $b = "¤¤¤¦¤¢";
- var_dump(@mb_substr_count($a, $b));
+ $a = str_repeat("¤¢¤¤¤¦¤¢¤¦¤¤¤¢", 100);
+ $b = "¤¤¤¦¤¢";
+ var_dump(@mb_substr_count($a, $b));
- $to_enc = "UTF-8";
- var_dump(@mb_substr_count(mb_convert_encoding($a, $to_enc),
- mb_convert_encoding($b, $to_enc), $to_enc));
+ $to_enc = "UTF-8";
+ var_dump(@mb_substr_count(mb_convert_encoding($a, $to_enc),
+ mb_convert_encoding($b, $to_enc), $to_enc));
- $to_enc = "Shift_JIS";
- var_dump(@mb_substr_count(mb_convert_encoding($a, $to_enc),
- mb_convert_encoding($b, $to_enc), $to_enc));
+ $to_enc = "Shift_JIS";
+ var_dump(@mb_substr_count(mb_convert_encoding($a, $to_enc),
+ mb_convert_encoding($b, $to_enc), $to_enc));
- $a = str_repeat("abcacbabca", 100);
- var_dump(@mb_substr_count($a, "bca"));
+ $a = str_repeat("abcacbabca", 100);
+ var_dump(@mb_substr_count($a, "bca"));
?>
--EXPECT--
bool(false)
diff --git a/ext/mbstring/tests/mb_substr_variation4.phpt b/ext/mbstring/tests/mb_substr_variation4.phpt
index c31af9b9ef..aac0a20c0d 100644
--- a/ext/mbstring/tests/mb_substr_variation4.phpt
+++ b/ext/mbstring/tests/mb_substr_variation4.phpt
@@ -29,21 +29,21 @@ $string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXv
* 60 is larger than *BYTE* count for $string_mb
*/
for ($i = -60; $i <= 60; $i += 10) {
- if (@$a || @$b) {
- $a = null;
- $b = null;
- }
- echo "\n**-- Offset is: $i --**\n";
- echo "-- ASCII String --\n";
- $a = mb_substr($string_ascii, $i, 4);
- var_dump(base64_encode($a));
- echo "--Multibyte String --\n";
- $b = mb_substr($string_mb, $i, 4, 'UTF-8');
- if (strlen($a) == mb_strlen($b, 'UTF-8')) { // should return same length
- var_dump(base64_encode($b));
- } else {
- echo "Difference in length of ASCII string and multibyte string\n";
- }
+ if (@$a || @$b) {
+ $a = null;
+ $b = null;
+ }
+ echo "\n**-- Offset is: $i --**\n";
+ echo "-- ASCII String --\n";
+ $a = mb_substr($string_ascii, $i, 4);
+ var_dump(base64_encode($a));
+ echo "--Multibyte String --\n";
+ $b = mb_substr($string_mb, $i, 4, 'UTF-8');
+ if (strlen($a) == mb_strlen($b, 'UTF-8')) { // should return same length
+ var_dump(base64_encode($b));
+ } else {
+ echo "Difference in length of ASCII string and multibyte string\n";
+ }
}
diff --git a/ext/mbstring/tests/mb_substr_variation5.phpt b/ext/mbstring/tests/mb_substr_variation5.phpt
index 94231a4624..5ede679251 100644
--- a/ext/mbstring/tests/mb_substr_variation5.phpt
+++ b/ext/mbstring/tests/mb_substr_variation5.phpt
@@ -30,21 +30,21 @@ $string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXv
* 60 is larger than *BYTE* count for $string_mb
*/
for ($i = -60; $i <= 60; $i += 10) {
- if (@$a || @$b) {
- $a = null;
- $b = null;
- }
- echo "\n**-- Offset is: $i --**\n";
- echo "-- ASCII String --\n";
- $a = mb_substr($string_ascii, 1, $i);
- var_dump(base64_encode($a));
- echo "--Multibyte String --\n";
- $b = mb_substr($string_mb, 1, $i, 'UTF-8');
- if (strlen($a) == mb_strlen($b, 'UTF-8')) { // should return same length
- var_dump(base64_encode($b));
- } else {
- echo "Difference in length of ASCII string and multibyte string\n";
- }
+ if (@$a || @$b) {
+ $a = null;
+ $b = null;
+ }
+ echo "\n**-- Offset is: $i --**\n";
+ echo "-- ASCII String --\n";
+ $a = mb_substr($string_ascii, 1, $i);
+ var_dump(base64_encode($a));
+ echo "--Multibyte String --\n";
+ $b = mb_substr($string_mb, 1, $i, 'UTF-8');
+ if (strlen($a) == mb_strlen($b, 'UTF-8')) { // should return same length
+ var_dump(base64_encode($b));
+ } else {
+ echo "Difference in length of ASCII string and multibyte string\n";
+ }
}
diff --git a/ext/mbstring/tests/mb_substr_variation6.phpt b/ext/mbstring/tests/mb_substr_variation6.phpt
index 172ab962b0..8b186fa00a 100644
--- a/ext/mbstring/tests/mb_substr_variation6.phpt
+++ b/ext/mbstring/tests/mb_substr_variation6.phpt
@@ -29,26 +29,26 @@ $string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXv
* 60 is larger than *BYTE* count for $string_mb
*/
for ($i = -60; $i <= 60; $i += 10) {
- if (@$a || @$b) {
- $a = null;
- $b = null;
- }
- echo "\n**-- Offset is: $i --**\n";
- echo "-- ASCII String --\n";
- $a = mb_substr($string_ascii, $i, 4);
- if ($a !== false) {
- var_dump(bin2hex($a));
- }
- else {
- var_dump($a);
- }
- echo "--Multibyte String --\n";
- $b = mb_substr($string_mb, $i, 4, 'UTF-8');
- if (strlen($a) == mb_strlen($b, 'UTF-8')) { // should return same length
- var_dump(bin2hex($b));
- } else {
- echo "Difference in length of ASCII string and multibyte string\n";
- }
+ if (@$a || @$b) {
+ $a = null;
+ $b = null;
+ }
+ echo "\n**-- Offset is: $i --**\n";
+ echo "-- ASCII String --\n";
+ $a = mb_substr($string_ascii, $i, 4);
+ if ($a !== false) {
+ var_dump(bin2hex($a));
+ }
+ else {
+ var_dump($a);
+ }
+ echo "--Multibyte String --\n";
+ $b = mb_substr($string_mb, $i, 4, 'UTF-8');
+ if (strlen($a) == mb_strlen($b, 'UTF-8')) { // should return same length
+ var_dump(bin2hex($b));
+ } else {
+ echo "Difference in length of ASCII string and multibyte string\n";
+ }
}
diff --git a/ext/mbstring/tests/mb_substr_variation7.phpt b/ext/mbstring/tests/mb_substr_variation7.phpt
index 909393177e..243d7065d5 100644
--- a/ext/mbstring/tests/mb_substr_variation7.phpt
+++ b/ext/mbstring/tests/mb_substr_variation7.phpt
@@ -30,26 +30,26 @@ $string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXv
* 60 is larger than *BYTE* count for $string_mb
*/
for ($i = -60; $i <= 60; $i += 10) {
- if (@$a || @$b) {
- $a = null;
- $b = null;
- }
- echo "\n**-- Offset is: $i --**\n";
- echo "-- ASCII String --\n";
- $a = mb_substr($string_ascii, 1, $i);
- if ($a !== false) {
- var_dump(bin2hex($a));
- }
- else {
- var_dump($a);
- }
- echo "--Multibyte String --\n";
- $b = mb_substr($string_mb, 1, $i, 'UTF-8');
- if (strlen($a) == mb_strlen($b, 'UTF-8')) { // should return same length
- var_dump(bin2hex($b));
- } else {
- echo "Difference in length of ASCII string and multibyte string\n";
- }
+ if (@$a || @$b) {
+ $a = null;
+ $b = null;
+ }
+ echo "\n**-- Offset is: $i --**\n";
+ echo "-- ASCII String --\n";
+ $a = mb_substr($string_ascii, 1, $i);
+ if ($a !== false) {
+ var_dump(bin2hex($a));
+ }
+ else {
+ var_dump($a);
+ }
+ echo "--Multibyte String --\n";
+ $b = mb_substr($string_mb, 1, $i, 'UTF-8');
+ if (strlen($a) == mb_strlen($b, 'UTF-8')) { // should return same length
+ var_dump(bin2hex($b));
+ } else {
+ echo "Difference in length of ASCII string and multibyte string\n";
+ }
}
diff --git a/ext/mbstring/tests/overload01.phpt b/ext/mbstring/tests/overload01.phpt
deleted file mode 100644
index 436608a89c..0000000000
--- a/ext/mbstring/tests/overload01.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---TEST--
-Function overloading test 1
---SKIPIF--
-<?php
- extension_loaded('mbstring') or die('skip mbstring not available');
-?>
---INI--
-output_handler=
-mbstring.func_overload=7
-internal_encoding=EUC-JP
---FILE--
-<?php
-echo mb_internal_encoding()."\n";
-
-$ngchars = array('ǽ','ɽ','»½','¥½');
-$str = '¸µÏ½ÍÜ»½Ðò¼Òº¾µ½É½¸½Ç½ÎÏɽ¼¨±½ÌÈÄä˽ÎÏŽÉÕ¹½Ê¸·½»ÒͽÃÎñ½Æ¬¥½¥Õ¥¡¡¼';
-var_dump(strlen($str));
-var_dump(mb_strlen($str));
---EXPECT--
-Deprecated: The mbstring.func_overload directive is deprecated in Unknown on line 0
-EUC-JP
-int(33)
-int(33)
diff --git a/ext/mbstring/tests/overload02.phpt b/ext/mbstring/tests/overload02.phpt
deleted file mode 100644
index 2e4bbe856a..0000000000
--- a/ext/mbstring/tests/overload02.phpt
+++ /dev/null
@@ -1,34 +0,0 @@
---TEST--
-Function overloading test 2
---SKIPIF--
-<?php
- extension_loaded('mbstring') or die('skip mbstring not available');
- if (!function_exists("mb_ereg_replace")) {
- die('skip mb_ereg_replace() function is not available.');
- }
-?>
---INI--
-output_handler=
-mbstring.func_overload=7
-internal_encoding=EUC-JP
---FILE--
-<?php
-echo mb_internal_encoding()."\n";
-
-$ngchars = array('ǽ','ɽ','»½','¥½');
-$str = '¸µÏ½ÍÜ»½Ðò¼Òº¾µ½É½¸½Ç½ÎÏɽ¼¨±½ÌÈÄä˽ÎÏŽÉÕ¹½Ê¸·½»ÒͽÃÎñ½Æ¬¥½¥Õ¥¡¡¼';
-$converted_str = mb_convert_encoding($str, 'Shift_JIS');
-mb_regex_encoding('Shift_JIS');
-foreach($ngchars as $c) {
- $c = mb_convert_encoding($c, 'Shift_JIS');
- $replaced = mb_convert_encoding(str_replace($c, '!!', $converted_str), mb_internal_encoding(), 'Shift_JIS');
- var_dump(strpos($replaced, '!!'));
-}
-?>
---EXPECT--
-Deprecated: The mbstring.func_overload directive is deprecated in Unknown on line 0
-EUC-JP
-int(10)
-int(8)
-int(3)
-int(29)
diff --git a/ext/mbstring/tests/zend_multibyte-01.phpt b/ext/mbstring/tests/zend_multibyte-01.phpt
index aae944de35..6f8aab373d 100644
--- a/ext/mbstring/tests/zend_multibyte-01.phpt
+++ b/ext/mbstring/tests/zend_multibyte-01.phpt
@@ -8,12 +8,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/ext/mbstring/tests/zend_multibyte-11.phpt b/ext/mbstring/tests/zend_multibyte-11.phpt
index c5e02eeae3..a1a589433c 100644
--- a/ext/mbstring/tests/zend_multibyte-11.phpt
+++ b/ext/mbstring/tests/zend_multibyte-11.phpt
@@ -7,8 +7,8 @@ zend.multibyte=1
--FILE--
<?php
declare(encoding="ISO-8859-15") {
- declare(encoding="ISO-8859-1");
- echo "ok\n";
+ declare(encoding="ISO-8859-1");
+ echo "ok\n";
}
?>
--EXPECTF--
diff --git a/ext/mbstring/tests/zend_multibyte-15.phpt b/ext/mbstring/tests/zend_multibyte-15.phpt
index b24ed25fb2..7f552041a6 100644
--- a/ext/mbstring/tests/zend_multibyte-15.phpt
+++ b/ext/mbstring/tests/zend_multibyte-15.phpt
@@ -7,10 +7,10 @@ zend.multibyte=1
--FILE--
<?php
declare(encoding="ISO-8859-15") {
- echo "ok\n";
+ echo "ok\n";
}
declare(encoding="UTF-8") {
- echo "ok\n";
+ echo "ok\n";
}
?>
--EXPECT--
diff --git a/ext/mbstring/tests/zend_multibyte-16.phpt b/ext/mbstring/tests/zend_multibyte-16.phpt
index a9b0920184..0fa0a8e9b2 100644
--- a/ext/mbstring/tests/zend_multibyte-16.phpt
+++ b/ext/mbstring/tests/zend_multibyte-16.phpt
@@ -7,7 +7,7 @@ zend.multibyte=1
--FILE--
<?php
declare(encoding="ISO-8859-15") {
- echo "ok\n";
+ echo "ok\n";
}
echo "ok\n";
?>
diff --git a/ext/mysqli/config.m4 b/ext/mysqli/config.m4
index c78eb2bedc..4f011adf8d 100644
--- a/ext/mysqli/config.m4
+++ b/ext/mysqli/config.m4
@@ -49,7 +49,7 @@ elif test "$PHP_MYSQLI" != "no"; then
MYSQL_CONFIG=$PHP_MYSQLI
MYSQL_LIB_NAME='mysqlclient'
- if test "$enable_maintainer_zts" = "yes"; then
+ if test "$enable_zts" = "yes"; then
MYSQL_LIB_CFG='--libs_r'
MYSQL_LIB_NAME='mysqlclient_r'
else
diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c
index dc2e0e7e33..cbfbb451bc 100644
--- a/ext/mysqli/mysqli.c
+++ b/ext/mysqli/mysqli.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -301,40 +299,26 @@ static int mysqli_write_na(mysqli_object *obj, zval *newval)
/* }}} */
/* {{{ mysqli_read_property */
-zval *mysqli_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv)
+zval *mysqli_read_property(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv)
{
- zval tmp_member;
zval *retval;
mysqli_object *obj;
mysqli_prop_handler *hnd = NULL;
- obj = Z_MYSQLI_P(object);
-
- if (Z_TYPE_P(member) != IS_STRING) {
- zend_string *str = zval_try_get_string_func(member);
- if (UNEXPECTED(!str)) {
- return &EG(uninitialized_zval);
- }
- ZVAL_STR(&tmp_member, str);
- member = &tmp_member;
- }
+ obj = php_mysqli_fetch_object(object);
if (obj->prop_handler != NULL) {
- hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member));
+ hnd = zend_hash_find_ptr(obj->prop_handler, name);
}
if (hnd) {
- if (hnd->read_func(obj, rv, type == BP_VAR_IS) == SUCCESS || type != BP_VAR_IS) {
+ if (hnd->read_func(obj, rv, type == BP_VAR_IS) == SUCCESS) {
retval = rv;
} else {
retval = &EG(uninitialized_zval);
}
} else {
- retval = zend_std_read_property(object, member, type, cache_slot, rv);
- }
-
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
+ retval = zend_std_read_property(object, name, type, cache_slot, rv);
}
return retval;
@@ -342,35 +326,21 @@ zval *mysqli_read_property(zval *object, zval *member, int type, void **cache_sl
/* }}} */
/* {{{ mysqli_write_property */
-zval *mysqli_write_property(zval *object, zval *member, zval *value, void **cache_slot)
+zval *mysqli_write_property(zend_object *object, zend_string *name, zval *value, void **cache_slot)
{
- zval tmp_member;
mysqli_object *obj;
mysqli_prop_handler *hnd = NULL;
- if (Z_TYPE_P(member) != IS_STRING) {
- zend_string *str = zval_try_get_string_func(member);
- if (UNEXPECTED(!str)) {
- return value;
- }
- ZVAL_STR(&tmp_member, str);
- member = &tmp_member;
- }
-
- obj = Z_MYSQLI_P(object);
+ obj = php_mysqli_fetch_object(object);
if (obj->prop_handler != NULL) {
- hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member));
+ hnd = zend_hash_find_ptr(obj->prop_handler, name);
}
if (hnd) {
hnd->write_func(obj, value);
} else {
- value = zend_std_write_property(object, member, value, cache_slot);
- }
-
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
+ value = zend_std_write_property(object, name, value, cache_slot);
}
return value;
@@ -389,20 +359,20 @@ void mysqli_add_property(HashTable *h, const char *pname, size_t pname_len, mysq
}
/* }}} */
-static int mysqli_object_has_property(zval *object, zval *member, int has_set_exists, void **cache_slot) /* {{{ */
+static int mysqli_object_has_property(zend_object *object, zend_string *name, int has_set_exists, void **cache_slot) /* {{{ */
{
- mysqli_object *obj = Z_MYSQLI_P(object);
+ mysqli_object *obj = php_mysqli_fetch_object(object);
mysqli_prop_handler *p;
int ret = 0;
- if ((p = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member))) != NULL) {
+ if ((p = zend_hash_find_ptr(obj->prop_handler, name)) != NULL) {
switch (has_set_exists) {
case ZEND_PROPERTY_EXISTS:
ret = 1;
break;
case ZEND_PROPERTY_NOT_EMPTY: {
zval rv;
- zval *value = mysqli_read_property(object, member, BP_VAR_IS, cache_slot, &rv);
+ zval *value = mysqli_read_property(object, name, BP_VAR_IS, cache_slot, &rv);
if (value != &EG(uninitialized_zval)) {
convert_to_boolean(value);
ret = Z_TYPE_P(value) == IS_TRUE ? 1 : 0;
@@ -411,7 +381,7 @@ static int mysqli_object_has_property(zval *object, zval *member, int has_set_ex
}
case ZEND_PROPERTY_ISSET: {
zval rv;
- zval *value = mysqli_read_property(object, member, BP_VAR_IS, cache_slot, &rv);
+ zval *value = mysqli_read_property(object, name, BP_VAR_IS, cache_slot, &rv);
if (value != &EG(uninitialized_zval)) {
ret = Z_TYPE_P(value) != IS_NULL? 1 : 0;
zval_ptr_dtor(value);
@@ -422,28 +392,27 @@ static int mysqli_object_has_property(zval *object, zval *member, int has_set_ex
php_error_docref(NULL, E_WARNING, "Invalid value for has_set_exists");
}
} else {
- ret = zend_std_has_property(object, member, has_set_exists, cache_slot);
+ ret = zend_std_has_property(object, name, has_set_exists, cache_slot);
}
return ret;
} /* }}} */
-HashTable *mysqli_object_get_debug_info(zval *object, int *is_temp)
+HashTable *mysqli_object_get_debug_info(zend_object *object, int *is_temp)
{
- mysqli_object *obj = Z_MYSQLI_P(object);
+ mysqli_object *obj = php_mysqli_fetch_object(object);
HashTable *retval, *props = obj->prop_handler;
mysqli_prop_handler *entry;
retval = zend_new_array(zend_hash_num_elements(props) + 1);
ZEND_HASH_FOREACH_PTR(props, entry) {
- zval rv, member;
+ zval rv;
zval *value;
- ZVAL_STR(&member, entry->name);
- value = mysqli_read_property(object, &member, BP_VAR_IS, 0, &rv);
+ value = mysqli_read_property(object, entry->name, BP_VAR_IS, 0, &rv);
if (value != &EG(uninitialized_zval)) {
- zend_hash_add(retval, Z_STR(member), value);
+ zend_hash_add(retval, entry->name, value);
}
} ZEND_HASH_FOREACH_END();
@@ -502,7 +471,7 @@ static MYSQLND *mysqli_convert_zv_to_mysqlnd(zval * zv)
mysqli_object *intern = Z_MYSQLI_P(zv);
if (!(my_res = (MYSQLI_RESOURCE *)intern->ptr)) {
/* We know that we have a mysqli object, so this failure should be emitted */
- php_error_docref(NULL, E_WARNING, "Couldn't fetch %s", ZSTR_VAL(intern->zo.ce->name));
+ zend_throw_error(NULL, "%s object is already closed", ZSTR_VAL(intern->zo.ce->name));
return NULL;
}
mysql = (MY_MYSQL *)(my_res->ptr);
@@ -1048,7 +1017,7 @@ PHP_FUNCTION(mysqli_stmt_construct)
{
case 1: /* mysql_stmt_init */
if (zend_parse_parameters(1, "O", &mysql_link, mysqli_link_class_entry)==FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
@@ -1058,7 +1027,7 @@ PHP_FUNCTION(mysqli_stmt_construct)
break;
case 2:
if (zend_parse_parameters(2, "Os", &mysql_link, mysqli_link_class_entry, &statement, &statement_len)==FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
@@ -1105,12 +1074,12 @@ PHP_FUNCTION(mysqli_result_construct)
switch (ZEND_NUM_ARGS()) {
case 1:
if (zend_parse_parameters(1, "O", &mysql_link, mysqli_link_class_entry)==FAILURE) {
- return;
+ RETURN_THROWS();
}
break;
case 2:
if (zend_parse_parameters(2, "Ol", &mysql_link, mysqli_link_class_entry, &resmode)==FAILURE) {
- return;
+ RETURN_THROWS();
}
break;
default:
@@ -1232,8 +1201,8 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags
if (into_object) {
zend_string *class_name = NULL;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O|Sz", &mysql_result, mysqli_result_class_entry, &class_name, &ctor_params) == FAILURE) {
- return;
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O|Sa", &mysql_result, mysqli_result_class_entry, &class_name, &ctor_params) == FAILURE) {
+ RETURN_THROWS();
}
if (class_name == NULL) {
ce = zend_standard_class_def;
@@ -1246,19 +1215,19 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags
}
if (UNEXPECTED(ce->ce_flags & (ZEND_ACC_INTERFACE|ZEND_ACC_TRAIT|ZEND_ACC_IMPLICIT_ABSTRACT_CLASS|ZEND_ACC_EXPLICIT_ABSTRACT_CLASS))) {
zend_throw_error(NULL, "Class '%s' cannot be instantiated", ZSTR_VAL(ce->name));
- return;
+ RETURN_THROWS();
}
fetchtype = MYSQLI_ASSOC;
} else {
if (override_flags) {
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_result, mysqli_result_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
fetchtype = override_flags;
} else {
fetchtype = MYSQLI_BOTH;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O|l", &mysql_result, mysqli_result_class_entry, &fetchtype) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
}
@@ -1304,7 +1273,7 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags
* argument passed by reference.
*/
zend_throw_exception(zend_ce_exception, "Parameter ctor_params must be an array", 0);
- return;
+ RETURN_THROWS();
}
}
diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c
index ffbb841c19..85e7e93603 100644
--- a/ext/mysqli/mysqli_api.c
+++ b/ext/mysqli/mysqli_api.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -144,7 +142,7 @@ PHP_FUNCTION(mysqli_affected_rows)
my_ulonglong rc;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
@@ -166,7 +164,7 @@ PHP_FUNCTION(mysqli_autocommit)
zend_bool automode;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Ob", &mysql_link, mysqli_link_class_entry, &automode) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
@@ -335,7 +333,7 @@ PHP_FUNCTION(mysqli_stmt_bind_param)
if (zend_parse_method_parameters((getThis()) ? 1:2, getThis(), "Os", &mysql_stmt, mysqli_stmt_class_entry,
&types, &types_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID);
@@ -589,7 +587,7 @@ PHP_FUNCTION(mysqli_stmt_bind_result)
zval *mysql_stmt;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O+", &mysql_stmt, mysqli_stmt_class_entry, &args, &argc) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID);
@@ -618,7 +616,7 @@ PHP_FUNCTION(mysqli_change_user)
#endif
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Osss!", &mysql_link, mysqli_link_class_entry, &user, &user_len, &password, &password_len, &dbname, &dbname_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
@@ -660,7 +658,7 @@ PHP_FUNCTION(mysqli_character_set_name)
const char *cs_name;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
@@ -720,7 +718,7 @@ PHP_FUNCTION(mysqli_close)
MY_MYSQL *mysql;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_INITIALIZED);
@@ -745,7 +743,7 @@ PHP_FUNCTION(mysqli_commit)
size_t name_len = 0;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O|ls", &mysql_link, mysqli_link_class_entry, &flags, &name, &name_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
@@ -769,7 +767,7 @@ PHP_FUNCTION(mysqli_data_seek)
zend_long offset;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Ol", &mysql_result, mysqli_result_class_entry, &offset) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, mysql_result, "mysqli_result", MYSQLI_STATUS_VALID);
@@ -796,7 +794,7 @@ PHP_FUNCTION(mysqli_debug)
size_t debug_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &debug, &debug_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
mysql_debug(debug);
@@ -812,11 +810,11 @@ PHP_FUNCTION(mysqli_dump_debug_info)
zval *mysql_link;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
- RETURN_BOOL(!mysql_dump_debug_info(mysql->mysql))
+ RETURN_BOOL(!mysql_dump_debug_info(mysql->mysql));
}
/* }}} */
@@ -828,7 +826,7 @@ PHP_FUNCTION(mysqli_errno)
zval *mysql_link;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
RETURN_LONG(mysql_errno(mysql->mysql));
@@ -844,7 +842,7 @@ PHP_FUNCTION(mysqli_error)
const char *err;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
err = mysql_error(mysql->mysql);
@@ -865,7 +863,7 @@ PHP_FUNCTION(mysqli_stmt_execute)
#endif
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID);
@@ -900,7 +898,7 @@ PHP_FUNCTION(mysqli_stmt_execute)
switch (stmt->stmt->params[i].buffer_type) {
case MYSQL_TYPE_VAR_STRING:
if (!try_convert_to_string(param)) {
- return;
+ RETURN_THROWS();
}
stmt->stmt->params[i].buffer = Z_STRVAL_P(param);
@@ -950,7 +948,7 @@ void mysqli_stmt_fetch_libmysql(INTERNAL_FUNCTION_PARAMETERS)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID);
@@ -1119,7 +1117,7 @@ void mysqli_stmt_fetch_mysqlnd(INTERNAL_FUNCTION_PARAMETERS)
zend_bool fetched_anything;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID);
@@ -1185,7 +1183,7 @@ PHP_FUNCTION(mysqli_fetch_field)
const MYSQL_FIELD *field;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_result, mysqli_result_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, mysql_result, "mysqli_result", MYSQLI_STATUS_VALID);
@@ -1210,7 +1208,7 @@ PHP_FUNCTION(mysqli_fetch_fields)
unsigned int i, num_fields;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_result, mysqli_result_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, mysql_result, "mysqli_result", MYSQLI_STATUS_VALID);
@@ -1239,7 +1237,7 @@ PHP_FUNCTION(mysqli_fetch_field_direct)
zend_long offset;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Ol", &mysql_result, mysqli_result_class_entry, &offset) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, mysql_result, "mysqli_result", MYSQLI_STATUS_VALID);
@@ -1272,7 +1270,7 @@ PHP_FUNCTION(mysqli_fetch_lengths)
#endif
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_result, mysqli_result_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, mysql_result, "mysqli_result", MYSQLI_STATUS_VALID);
@@ -1307,7 +1305,7 @@ PHP_FUNCTION(mysqli_field_count)
zval *mysql_link;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
@@ -1325,7 +1323,7 @@ PHP_FUNCTION(mysqli_field_seek)
zend_long fieldnr;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Ol", &mysql_result, mysqli_result_class_entry, &fieldnr) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, mysql_result, "mysqli_result", MYSQLI_STATUS_VALID);
@@ -1347,7 +1345,7 @@ PHP_FUNCTION(mysqli_field_tell)
zval *mysql_result;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_result, mysqli_result_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, mysql_result, "mysqli_result", MYSQLI_STATUS_VALID);
@@ -1363,7 +1361,7 @@ PHP_FUNCTION(mysqli_free_result)
zval *mysql_result;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_result, mysqli_result_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, mysql_result, "mysqli_result", MYSQLI_STATUS_VALID);
@@ -1376,6 +1374,18 @@ PHP_FUNCTION(mysqli_free_result)
Get MySQL client info */
PHP_FUNCTION(mysqli_get_client_info)
{
+ if (getThis()) {
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+ } else {
+ zval *mysql_link;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
+ RETURN_THROWS();
+ }
+ }
+
const char * info = mysql_get_client_info();
if (info) {
RETURN_STRING(info);
@@ -1387,6 +1397,10 @@ PHP_FUNCTION(mysqli_get_client_info)
Get MySQL client info */
PHP_FUNCTION(mysqli_get_client_version)
{
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
RETURN_LONG((zend_long)mysql_get_client_version());
}
/* }}} */
@@ -1399,7 +1413,7 @@ PHP_FUNCTION(mysqli_get_host_info)
zval *mysql_link = NULL;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
#if !defined(MYSQLI_USE_MYSQLND)
@@ -1418,7 +1432,7 @@ PHP_FUNCTION(mysqli_get_proto_info)
zval *mysql_link = NULL;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
RETURN_LONG(mysql_get_proto_info(mysql->mysql));
@@ -1434,7 +1448,7 @@ PHP_FUNCTION(mysqli_get_server_info)
const char *info;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
@@ -1453,7 +1467,7 @@ PHP_FUNCTION(mysqli_get_server_version)
zval *mysql_link = NULL;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
@@ -1470,7 +1484,7 @@ PHP_FUNCTION(mysqli_info)
const char *info;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
@@ -1487,6 +1501,10 @@ void php_mysqli_init(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_method)
MYSQLI_RESOURCE *mysqli_resource;
MY_MYSQL *mysql;
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
if (is_method && (Z_MYSQLI_P(getThis()))->ptr) {
return;
}
@@ -1497,7 +1515,7 @@ void php_mysqli_init(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_method)
if (!(mysql->mysql = mysql_init(NULL)))
#else
/*
- We create always persistent, as if the user want to connecto
+ We create always persistent, as if the user want to connect
to p:somehost, we can't convert the handle then
*/
if (!(mysql->mysql = mysqlnd_init(MYSQLND_CLIENT_KNOWS_RSET_COPY_DATA, TRUE)))
@@ -1544,7 +1562,7 @@ PHP_FUNCTION(mysqli_insert_id)
zval *mysql_link;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
rc = mysql_insert_id(mysql->mysql);
@@ -1561,7 +1579,7 @@ PHP_FUNCTION(mysqli_kill)
zend_long processid;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Ol", &mysql_link, mysqli_link_class_entry, &processid) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
@@ -1586,7 +1604,7 @@ PHP_FUNCTION(mysqli_more_results)
zval *mysql_link;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
@@ -1601,7 +1619,7 @@ PHP_FUNCTION(mysqli_next_result) {
zval *mysql_link;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
@@ -1618,7 +1636,7 @@ PHP_FUNCTION(mysqli_stmt_more_results)
zval *mysql_stmt;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID);
@@ -1633,7 +1651,7 @@ PHP_FUNCTION(mysqli_stmt_next_result) {
zval *mysql_stmt;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID);
@@ -1650,7 +1668,7 @@ PHP_FUNCTION(mysqli_num_fields)
zval *mysql_result;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_result, mysqli_result_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, mysql_result, "mysqli_result", MYSQLI_STATUS_VALID);
@@ -1666,7 +1684,7 @@ PHP_FUNCTION(mysqli_num_rows)
zval *mysql_result;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_result, mysqli_result_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, mysql_result, "mysqli_result", MYSQLI_STATUS_VALID);
@@ -1757,7 +1775,7 @@ PHP_FUNCTION(mysqli_options)
int expected_type;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Olz", &mysql_link, mysqli_link_class_entry, &mysql_option, &mysql_value) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_INITIALIZED);
@@ -1773,7 +1791,7 @@ PHP_FUNCTION(mysqli_options)
switch (expected_type) {
case IS_STRING:
if (!try_convert_to_string(mysql_value)) {
- return;
+ RETURN_THROWS();
}
break;
case IS_LONG:
@@ -1809,7 +1827,7 @@ PHP_FUNCTION(mysqli_ping)
zend_long rc;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
rc = mysql_ping(mysql->mysql);
@@ -1831,7 +1849,7 @@ PHP_FUNCTION(mysqli_prepare)
MYSQLI_RESOURCE *mysqli_resource;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os",&mysql_link, mysqli_link_class_entry, &query, &query_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
@@ -1921,7 +1939,7 @@ PHP_FUNCTION(mysqli_real_query)
size_t query_len;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os", &mysql_link, mysqli_link_class_entry, &query, &query_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
@@ -1952,7 +1970,7 @@ PHP_FUNCTION(mysqli_real_escape_string) {
zend_string *newstr;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os", &mysql_link, mysqli_link_class_entry, &escapestr, &escapestr_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
@@ -1975,7 +1993,7 @@ PHP_FUNCTION(mysqli_rollback)
size_t name_len = 0;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O|ls", &mysql_link, mysqli_link_class_entry, &flags, &name, &name_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
@@ -2001,7 +2019,7 @@ PHP_FUNCTION(mysqli_stmt_send_long_data)
size_t data_len;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Ols", &mysql_stmt, mysqli_stmt_class_entry, &param_nr, &data, &data_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID);
@@ -2025,7 +2043,7 @@ PHP_FUNCTION(mysqli_stmt_affected_rows)
my_ulonglong rc;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID);
@@ -2045,7 +2063,7 @@ PHP_FUNCTION(mysqli_stmt_close)
zval *mysql_stmt;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID);
@@ -2066,7 +2084,7 @@ PHP_FUNCTION(mysqli_stmt_data_seek)
zend_long offset;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Ol", &mysql_stmt, mysqli_stmt_class_entry, &offset) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (offset < 0) {
php_error_docref(NULL, E_WARNING, "Offset must be positive");
@@ -2087,7 +2105,7 @@ PHP_FUNCTION(mysqli_stmt_field_count)
zval *mysql_stmt;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID);
@@ -2103,7 +2121,7 @@ PHP_FUNCTION(mysqli_stmt_free_result)
zval *mysql_stmt;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID);
@@ -2121,7 +2139,7 @@ PHP_FUNCTION(mysqli_stmt_insert_id)
zval *mysql_stmt;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID);
rc = mysql_stmt_insert_id(stmt->stmt);
@@ -2137,7 +2155,7 @@ PHP_FUNCTION(mysqli_stmt_param_count)
zval *mysql_stmt;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID);
@@ -2153,7 +2171,7 @@ PHP_FUNCTION(mysqli_stmt_reset)
zval *mysql_stmt;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID);
@@ -2174,7 +2192,7 @@ PHP_FUNCTION(mysqli_stmt_num_rows)
my_ulonglong rc;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID);
@@ -2194,7 +2212,7 @@ PHP_FUNCTION(mysqli_select_db)
size_t dbname_len;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os", &mysql_link, mysqli_link_class_entry, &dbname, &dbname_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
@@ -2215,7 +2233,7 @@ PHP_FUNCTION(mysqli_sqlstate)
const char *state;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
state = mysql_sqlstate(mysql->mysql);
@@ -2235,7 +2253,7 @@ PHP_FUNCTION(mysqli_ssl_set)
size_t ssl_parm_len[5], i;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Osssss", &mysql_link, mysqli_link_class_entry, &ssl_parm[0], &ssl_parm_len[0], &ssl_parm[1], &ssl_parm_len[1], &ssl_parm[2], &ssl_parm_len[2], &ssl_parm[3], &ssl_parm_len[3], &ssl_parm[4], &ssl_parm_len[4]) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_INITIALIZED);
@@ -2264,7 +2282,7 @@ PHP_FUNCTION(mysqli_stat)
#endif
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
@@ -2293,7 +2311,7 @@ PHP_FUNCTION(mysqli_refresh)
zend_long options;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Ol", &mysql_link, mysqli_link_class_entry, &options) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_INITIALIZED);
#ifdef MYSQLI_USE_MYSQLND
@@ -2319,12 +2337,12 @@ PHP_FUNCTION(mysqli_stmt_attr_set)
void *mode_p;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oll", &mysql_stmt, mysqli_stmt_class_entry, &attr, &mode_in) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID);
if (mode_in < 0) {
- php_error_docref(NULL, E_WARNING, "mode should be non-negative, " ZEND_LONG_FMT " passed", mode_in);
+ php_error_docref(NULL, E_WARNING, "Mode should be non-negative, " ZEND_LONG_FMT " passed", mode_in);
RETURN_FALSE;
}
@@ -2362,7 +2380,7 @@ PHP_FUNCTION(mysqli_stmt_attr_get)
int rc;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Ol", &mysql_stmt, mysqli_stmt_class_entry, &attr) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID);
@@ -2386,7 +2404,7 @@ PHP_FUNCTION(mysqli_stmt_errno)
zval *mysql_stmt;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_INITIALIZED);
@@ -2403,7 +2421,7 @@ PHP_FUNCTION(mysqli_stmt_error)
const char * err;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_INITIALIZED);
@@ -2425,7 +2443,7 @@ PHP_FUNCTION(mysqli_stmt_init)
MYSQLI_RESOURCE *mysqli_resource;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O",&mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
@@ -2457,7 +2475,7 @@ PHP_FUNCTION(mysqli_stmt_prepare)
size_t query_len;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os", &mysql_stmt, mysqli_stmt_class_entry, &query, &query_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_INITIALIZED);
@@ -2481,7 +2499,7 @@ PHP_FUNCTION(mysqli_stmt_result_metadata)
MYSQLI_RESOURCE *mysqli_resource;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID);
@@ -2505,7 +2523,7 @@ PHP_FUNCTION(mysqli_stmt_store_result)
zval *mysql_stmt;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID);
@@ -2555,7 +2573,7 @@ PHP_FUNCTION(mysqli_stmt_sqlstate)
const char * state;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID);
@@ -2578,7 +2596,7 @@ PHP_FUNCTION(mysqli_store_result)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O|l", &mysql_link, mysqli_link_class_entry, &flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
#if MYSQLI_USE_MYSQLND
@@ -2609,7 +2627,7 @@ PHP_FUNCTION(mysqli_thread_id)
zval *mysql_link;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
@@ -2621,6 +2639,10 @@ PHP_FUNCTION(mysqli_thread_id)
Return whether thread safety is given or not */
PHP_FUNCTION(mysqli_thread_safe)
{
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
RETURN_BOOL(mysql_thread_safe());
}
/* }}} */
@@ -2635,7 +2657,7 @@ PHP_FUNCTION(mysqli_use_result)
MYSQLI_RESOURCE *mysqli_resource;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
@@ -2662,7 +2684,7 @@ PHP_FUNCTION(mysqli_warning_count)
zval *mysql_link;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
diff --git a/ext/mysqli/mysqli_driver.c b/ext/mysqli/mysqli_driver.c
index 3e21534dd9..f63d699f60 100644
--- a/ext/mysqli/mysqli_driver.c
+++ b/ext/mysqli/mysqli_driver.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqli/mysqli_exception.c b/ext/mysqli/mysqli_exception.c
index 6ac5261e07..f93479328c 100644
--- a/ext/mysqli/mysqli_exception.c
+++ b/ext/mysqli/mysqli_exception.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqli/mysqli_fe.c b/ext/mysqli/mysqli_fe.c
index 4869228ef2..97e92e9438 100644
--- a/ext/mysqli/mysqli_fe.c
+++ b/ext/mysqli/mysqli_fe.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -76,6 +74,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_mysqli_only_link, 0, 0, 1)
MYSQLI_ZEND_ARG_OBJ_INFO_LINK()
ZEND_END_ARG_INFO()
+ZEND_BEGIN_ARG_INFO_EX(arginfo_mysqli_optional_link, 0, 0, 0)
+ MYSQLI_ZEND_ARG_OBJ_INFO_LINK()
+ZEND_END_ARG_INFO()
+
ZEND_BEGIN_ARG_INFO_EX(arginfo_mysqli_autocommit, 0, 0, 2)
MYSQLI_ZEND_ARG_OBJ_INFO_LINK()
ZEND_ARG_INFO(0, mode)
@@ -447,7 +449,7 @@ const zend_function_entry mysqli_functions[] = {
#ifdef HAVE_MYSQLI_GET_CHARSET
PHP_FE(mysqli_get_charset, arginfo_mysqli_only_link)
#endif
- PHP_FE(mysqli_get_client_info, arginfo_mysqli_no_options)
+ PHP_FE(mysqli_get_client_info, arginfo_mysqli_optional_link)
PHP_FE(mysqli_get_client_version, arginfo_mysqli_no_options)
PHP_FE(mysqli_get_links_stats, arginfo_mysqli_no_options)
PHP_FE(mysqli_get_host_info, arginfo_mysqli_only_link)
@@ -540,59 +542,59 @@ const zend_function_entry mysqli_functions[] = {
* Every user visible function must have an entry in mysqli_functions[].
*/
const zend_function_entry mysqli_link_methods[] = {
- PHP_FALIAS(autocommit, mysqli_autocommit, arginfo_class_mysqli_autocommit)
- PHP_FALIAS(begin_transaction, mysqli_begin_transaction, arginfo_class_mysqli_begin_transaction)
- PHP_FALIAS(change_user,mysqli_change_user, arginfo_class_mysqli_change_user)
- PHP_FALIAS(character_set_name, mysqli_character_set_name, arginfo_mysqli_no_params)
- PHP_FALIAS(close, mysqli_close, arginfo_mysqli_no_params)
- PHP_FALIAS(commit, mysqli_commit, arginfo_class_mysqli_commit)
- PHP_FALIAS(connect, mysqli_connect, arginfo_mysqli_connect)
- PHP_FALIAS(dump_debug_info, mysqli_dump_debug_info, arginfo_mysqli_no_params)
- PHP_FALIAS(debug, mysqli_debug, arginfo_mysqli_debug)
+ PHP_ME_MAPPING(autocommit, mysqli_autocommit, arginfo_class_mysqli_autocommit, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(begin_transaction, mysqli_begin_transaction, arginfo_class_mysqli_begin_transaction, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(change_user,mysqli_change_user, arginfo_class_mysqli_change_user, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(character_set_name, mysqli_character_set_name, arginfo_mysqli_no_params, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(close, mysqli_close, arginfo_mysqli_no_params, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(commit, mysqli_commit, arginfo_class_mysqli_commit, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(connect, mysqli_connect, arginfo_mysqli_connect, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(dump_debug_info, mysqli_dump_debug_info, arginfo_mysqli_no_params, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(debug, mysqli_debug, arginfo_mysqli_debug, ZEND_ACC_PUBLIC)
#ifdef HAVE_MYSQLI_GET_CHARSET
- PHP_FALIAS(get_charset, mysqli_get_charset, arginfo_mysqli_no_params)
+ PHP_ME_MAPPING(get_charset, mysqli_get_charset, arginfo_mysqli_no_params, ZEND_ACC_PUBLIC)
#endif
- PHP_FALIAS(get_client_info, mysqli_get_client_info, arginfo_mysqli_no_params)
+ PHP_ME_MAPPING(get_client_info, mysqli_get_client_info, arginfo_mysqli_no_params, ZEND_ACC_PUBLIC)
#if defined(MYSQLI_USE_MYSQLND)
- PHP_FALIAS(get_connection_stats, mysqli_get_connection_stats, arginfo_mysqli_no_params)
+ PHP_ME_MAPPING(get_connection_stats, mysqli_get_connection_stats, arginfo_mysqli_no_params, ZEND_ACC_PUBLIC)
#endif
- PHP_FALIAS(get_server_info, mysqli_get_server_info, arginfo_mysqli_no_params)
- PHP_FALIAS(get_warnings, mysqli_get_warnings, arginfo_mysqli_no_params)
- PHP_FALIAS(init,mysqli_init_method, arginfo_mysqli_no_params)
- PHP_FALIAS(kill,mysqli_kill, arginfo_class_mysqli_kill)
- PHP_FALIAS(multi_query, mysqli_multi_query, arginfo_class_mysqli_multi_query)
- PHP_FALIAS(__construct, mysqli_link_construct, arginfo_mysqli_connect)
- PHP_FALIAS(more_results, mysqli_more_results, arginfo_mysqli_no_params)
- PHP_FALIAS(next_result, mysqli_next_result, arginfo_mysqli_no_params)
- PHP_FALIAS(options, mysqli_options, arginfo_class_mysqli_options)
- PHP_FALIAS(ping, mysqli_ping, arginfo_mysqli_no_params)
+ PHP_ME_MAPPING(get_server_info, mysqli_get_server_info, arginfo_mysqli_no_params, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(get_warnings, mysqli_get_warnings, arginfo_mysqli_no_params, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(init,mysqli_init_method, arginfo_mysqli_no_params, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(kill,mysqli_kill, arginfo_class_mysqli_kill, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(multi_query, mysqli_multi_query, arginfo_class_mysqli_multi_query, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(__construct, mysqli_link_construct, arginfo_mysqli_connect, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(more_results, mysqli_more_results, arginfo_mysqli_no_params, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(next_result, mysqli_next_result, arginfo_mysqli_no_params, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(options, mysqli_options, arginfo_class_mysqli_options, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(ping, mysqli_ping, arginfo_mysqli_no_params, ZEND_ACC_PUBLIC)
#if defined(MYSQLI_USE_MYSQLND)
- ZEND_FENTRY(poll, ZEND_FN(mysqli_poll), arginfo_mysqli_poll, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+ PHP_ME_MAPPING(poll, mysqli_poll, arginfo_mysqli_poll, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
#endif
- PHP_FALIAS(prepare, mysqli_prepare, arginfo_class_mysqli_prepare)
- PHP_FALIAS(query, mysqli_query, arginfo_class_mysqli_query)
- PHP_FALIAS(real_connect, mysqli_real_connect, arginfo_class_mysqli_real_connect)
- PHP_FALIAS(real_escape_string, mysqli_real_escape_string, arginfo_class_mysqli_real_escape_string)
+ PHP_ME_MAPPING(prepare, mysqli_prepare, arginfo_class_mysqli_prepare, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(query, mysqli_query, arginfo_class_mysqli_query, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(real_connect, mysqli_real_connect, arginfo_class_mysqli_real_connect, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(real_escape_string, mysqli_real_escape_string, arginfo_class_mysqli_real_escape_string, ZEND_ACC_PUBLIC)
#if defined(MYSQLI_USE_MYSQLND)
- PHP_FALIAS(reap_async_query, mysqli_reap_async_query, arginfo_mysqli_no_params)
+ PHP_ME_MAPPING(reap_async_query, mysqli_reap_async_query, arginfo_mysqli_no_params, ZEND_ACC_PUBLIC)
#endif
- PHP_FALIAS(escape_string, mysqli_real_escape_string, arginfo_class_mysqli_real_escape_string)
- PHP_FALIAS(real_query, mysqli_real_query, arginfo_class_mysqli_real_query)
- PHP_FALIAS(release_savepoint, mysqli_release_savepoint, arginfo_class_mysqli_release_savepoint)
- PHP_FALIAS(rollback, mysqli_rollback, arginfo_class_mysqli_rollback)
- PHP_FALIAS(savepoint, mysqli_savepoint, arginfo_class_mysqli_savepoint)
- PHP_FALIAS(select_db,mysqli_select_db, arginfo_class_mysqli_select_db)
+ PHP_ME_MAPPING(escape_string, mysqli_real_escape_string, arginfo_class_mysqli_real_escape_string, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(real_query, mysqli_real_query, arginfo_class_mysqli_real_query, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(release_savepoint, mysqli_release_savepoint, arginfo_class_mysqli_release_savepoint, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(rollback, mysqli_rollback, arginfo_class_mysqli_rollback, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(savepoint, mysqli_savepoint, arginfo_class_mysqli_savepoint, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(select_db,mysqli_select_db, arginfo_class_mysqli_select_db, ZEND_ACC_PUBLIC)
#ifdef HAVE_MYSQLI_SET_CHARSET
- PHP_FALIAS(set_charset, mysqli_set_charset, arginfo_class_mysqli_set_charset)
+ PHP_ME_MAPPING(set_charset, mysqli_set_charset, arginfo_class_mysqli_set_charset, ZEND_ACC_PUBLIC)
#endif
- PHP_FALIAS(set_opt, mysqli_options, arginfo_class_mysqli_options)
- PHP_FALIAS(ssl_set, mysqli_ssl_set, arginfo_class_mysqli_ssl_set)
- PHP_FALIAS(stat, mysqli_stat, arginfo_mysqli_no_params)
- PHP_FALIAS(stmt_init, mysqli_stmt_init, arginfo_mysqli_no_params)
- PHP_FALIAS(store_result, mysqli_store_result, arginfo_class_store_result)
- PHP_FALIAS(thread_safe, mysqli_thread_safe, arginfo_mysqli_no_params)
- PHP_FALIAS(use_result, mysqli_use_result, arginfo_mysqli_no_params)
- PHP_FALIAS(refresh,mysqli_refresh, arginfo_class_mysqli_refresh)
+ PHP_ME_MAPPING(set_opt, mysqli_options, arginfo_class_mysqli_options, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(ssl_set, mysqli_ssl_set, arginfo_class_mysqli_ssl_set, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(stat, mysqli_stat, arginfo_mysqli_no_params, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(stmt_init, mysqli_stmt_init, arginfo_mysqli_no_params, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(store_result, mysqli_store_result, arginfo_class_store_result, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(thread_safe, mysqli_thread_safe, arginfo_mysqli_no_params, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(use_result, mysqli_use_result, arginfo_mysqli_no_params, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(refresh,mysqli_refresh, arginfo_class_mysqli_refresh, ZEND_ACC_PUBLIC)
PHP_FE_END
};
/* }}} */
@@ -602,22 +604,22 @@ const zend_function_entry mysqli_link_methods[] = {
* Every user visible function must have an entry in mysqli_result_functions[].
*/
const zend_function_entry mysqli_result_methods[] = {
- PHP_FALIAS(__construct, mysqli_result_construct, NULL)
- PHP_FALIAS(close, mysqli_free_result, arginfo_mysqli_no_params)
- PHP_FALIAS(free, mysqli_free_result, arginfo_mysqli_no_params)
- PHP_FALIAS(data_seek, mysqli_data_seek, arginfo_class_mysqli_data_seek)
- PHP_FALIAS(fetch_field, mysqli_fetch_field, arginfo_mysqli_no_params)
- PHP_FALIAS(fetch_fields, mysqli_fetch_fields, arginfo_mysqli_no_params)
- PHP_FALIAS(fetch_field_direct, mysqli_fetch_field_direct, arginfo_class_mysqli_result_and_fieldnr)
+ PHP_ME_MAPPING(__construct, mysqli_result_construct, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(close, mysqli_free_result, arginfo_mysqli_no_params, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(free, mysqli_free_result, arginfo_mysqli_no_params, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(data_seek, mysqli_data_seek, arginfo_class_mysqli_data_seek, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(fetch_field, mysqli_fetch_field, arginfo_mysqli_no_params, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(fetch_fields, mysqli_fetch_fields, arginfo_mysqli_no_params, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(fetch_field_direct, mysqli_fetch_field_direct, arginfo_class_mysqli_result_and_fieldnr, ZEND_ACC_PUBLIC)
#if defined(MYSQLI_USE_MYSQLND)
- PHP_FALIAS(fetch_all, mysqli_fetch_all, arginfo_class_mysqli_fetch_array)
+ PHP_ME_MAPPING(fetch_all, mysqli_fetch_all, arginfo_class_mysqli_fetch_array, ZEND_ACC_PUBLIC)
#endif
- PHP_FALIAS(fetch_array, mysqli_fetch_array, arginfo_class_mysqli_fetch_array)
- PHP_FALIAS(fetch_assoc, mysqli_fetch_assoc, arginfo_mysqli_no_params)
- PHP_FALIAS(fetch_object,mysqli_fetch_object, arginfo_class_mysqli_fetch_object)
- PHP_FALIAS(fetch_row, mysqli_fetch_row, arginfo_mysqli_no_params)
- PHP_FALIAS(field_seek, mysqli_field_seek, arginfo_class_mysqli_result_and_fieldnr)
- PHP_FALIAS(free_result, mysqli_free_result, arginfo_mysqli_no_params)
+ PHP_ME_MAPPING(fetch_array, mysqli_fetch_array, arginfo_class_mysqli_fetch_array, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(fetch_assoc, mysqli_fetch_assoc, arginfo_mysqli_no_params, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(fetch_object,mysqli_fetch_object, arginfo_class_mysqli_fetch_object, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(fetch_row, mysqli_fetch_row, arginfo_mysqli_no_params, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(field_seek, mysqli_field_seek, arginfo_class_mysqli_result_and_fieldnr, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(free_result, mysqli_free_result, arginfo_mysqli_no_params, ZEND_ACC_PUBLIC)
PHP_FE_END
};
/* }}} */
@@ -627,29 +629,29 @@ const zend_function_entry mysqli_result_methods[] = {
* Every user visible function must have an entry in mysqli_stmt_functions[].
*/
const zend_function_entry mysqli_stmt_methods[] = {
- PHP_FALIAS(__construct, mysqli_stmt_construct, NULL)
- PHP_FALIAS(attr_get, mysqli_stmt_attr_get, arginfo_class_mysqli_stmt_attr_get)
- PHP_FALIAS(attr_set,mysqli_stmt_attr_set, arginfo_class_mysqli_stmt_attr_set)
- PHP_FALIAS(bind_param,mysqli_stmt_bind_param, arginfo_class_mysqli_stmt_bind_param)
- PHP_FALIAS(bind_result,mysqli_stmt_bind_result, arginfo_class_mysqli_stmt_bind_result)
- PHP_FALIAS(close, mysqli_stmt_close, arginfo_mysqli_no_params)
- PHP_FALIAS(data_seek, mysqli_stmt_data_seek, arginfo_class_mysqli_data_seek)
- PHP_FALIAS(execute, mysqli_stmt_execute, arginfo_mysqli_no_params)
- PHP_FALIAS(fetch, mysqli_stmt_fetch, arginfo_mysqli_no_params)
- PHP_FALIAS(get_warnings, mysqli_stmt_get_warnings, arginfo_mysqli_no_params)
- PHP_FALIAS(result_metadata, mysqli_stmt_result_metadata, arginfo_mysqli_no_params)
+ PHP_ME_MAPPING(__construct, mysqli_stmt_construct, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(attr_get, mysqli_stmt_attr_get, arginfo_class_mysqli_stmt_attr_get, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(attr_set,mysqli_stmt_attr_set, arginfo_class_mysqli_stmt_attr_set, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(bind_param,mysqli_stmt_bind_param, arginfo_class_mysqli_stmt_bind_param, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(bind_result,mysqli_stmt_bind_result, arginfo_class_mysqli_stmt_bind_result, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(close, mysqli_stmt_close, arginfo_mysqli_no_params, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(data_seek, mysqli_stmt_data_seek, arginfo_class_mysqli_data_seek, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(execute, mysqli_stmt_execute, arginfo_mysqli_no_params, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(fetch, mysqli_stmt_fetch, arginfo_mysqli_no_params, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(get_warnings, mysqli_stmt_get_warnings, arginfo_mysqli_no_params, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(result_metadata, mysqli_stmt_result_metadata, arginfo_mysqli_no_params, ZEND_ACC_PUBLIC)
#if defined(MYSQLI_USE_MYSQLND)
- PHP_FALIAS(more_results, mysqli_stmt_more_results, arginfo_mysqli_no_params)
- PHP_FALIAS(next_result, mysqli_stmt_next_result, arginfo_mysqli_no_params)
+ PHP_ME_MAPPING(more_results, mysqli_stmt_more_results, arginfo_mysqli_no_params, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(next_result, mysqli_stmt_next_result, arginfo_mysqli_no_params, ZEND_ACC_PUBLIC)
#endif
- PHP_FALIAS(num_rows, mysqli_stmt_num_rows, arginfo_mysqli_no_params)
- PHP_FALIAS(send_long_data, mysqli_stmt_send_long_data, arginfo_class_mysqli_stmt_send_long_data)
- PHP_FALIAS(free_result, mysqli_stmt_free_result, arginfo_mysqli_no_params)
- PHP_FALIAS(reset, mysqli_stmt_reset, arginfo_mysqli_no_params)
- PHP_FALIAS(prepare, mysqli_stmt_prepare, arginfo_class_mysqli_prepare)
- PHP_FALIAS(store_result, mysqli_stmt_store_result, arginfo_mysqli_no_params)
+ PHP_ME_MAPPING(num_rows, mysqli_stmt_num_rows, arginfo_mysqli_no_params, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(send_long_data, mysqli_stmt_send_long_data, arginfo_class_mysqli_stmt_send_long_data, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(free_result, mysqli_stmt_free_result, arginfo_mysqli_no_params, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(reset, mysqli_stmt_reset, arginfo_mysqli_no_params, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(prepare, mysqli_stmt_prepare, arginfo_class_mysqli_prepare, ZEND_ACC_PUBLIC)
+ PHP_ME_MAPPING(store_result, mysqli_stmt_store_result, arginfo_mysqli_no_params, ZEND_ACC_PUBLIC)
#if defined(MYSQLI_USE_MYSQLND)
- PHP_FALIAS(get_result, mysqli_stmt_get_result, arginfo_mysqli_no_params)
+ PHP_ME_MAPPING(get_result, mysqli_stmt_get_result, arginfo_mysqli_no_params, ZEND_ACC_PUBLIC)
#endif
PHP_FE_END
};
diff --git a/ext/mysqli/mysqli_fe.h b/ext/mysqli/mysqli_fe.h
index c6e8293d1a..ab2974900d 100644
--- a/ext/mysqli/mysqli_fe.h
+++ b/ext/mysqli/mysqli_fe.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqli/mysqli_libmysql.h b/ext/mysqli/mysqli_libmysql.h
index 391fca9ff5..b6499e4c6e 100644
--- a/ext/mysqli/mysqli_libmysql.h
+++ b/ext/mysqli/mysqli_libmysql.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqli/mysqli_mysqlnd.h b/ext/mysqli/mysqli_mysqlnd.h
index 4c6872cf1a..48eae08258 100644
--- a/ext/mysqli/mysqli_mysqlnd.h
+++ b/ext/mysqli/mysqli_mysqlnd.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqli/mysqli_nonapi.c b/ext/mysqli/mysqli_nonapi.c
index e3f64ae275..4ba77579da 100644
--- a/ext/mysqli/mysqli_nonapi.c
+++ b/ext/mysqli/mysqli_nonapi.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -85,7 +83,7 @@ void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_real_conne
if (!is_real_connect) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!s!s!s!l!s!", &hostname, &hostname_len, &username, &username_len,
&passwd, &passwd_len, &dbname, &dbname_len, &port, &port_is_null, &socket, &socket_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (object && instanceof_function(Z_OBJCE_P(object), mysqli_link_class_entry)) {
@@ -103,7 +101,7 @@ void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_real_conne
/* We have flags too */
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O|s!s!s!s!l!s!l", &object, mysqli_link_class_entry,
&hostname, &hostname_len, &username, &username_len, &passwd, &passwd_len, &dbname, &dbname_len, &port, &port_is_null, &socket, &socket_len, &flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
mysqli_resource = (Z_MYSQLI_P(object))->ptr;
@@ -392,6 +390,10 @@ PHP_FUNCTION(mysqli_link_construct)
Returns the numerical value of the error message from last connect command */
PHP_FUNCTION(mysqli_connect_errno)
{
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
RETURN_LONG(MyG(error_no));
}
/* }}} */
@@ -400,6 +402,10 @@ PHP_FUNCTION(mysqli_connect_errno)
Returns the text of the error message from previous MySQL operation */
PHP_FUNCTION(mysqli_connect_error)
{
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
if (MyG(error_msg)) {
RETURN_STRING(MyG(error_msg));
} else {
@@ -434,7 +440,7 @@ PHP_FUNCTION(mysqli_fetch_all)
zend_long mode = MYSQLND_FETCH_NUM;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O|l", &mysql_result, mysqli_result_class_entry, &mode) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, mysql_result, "mysqli_result", MYSQLI_STATUS_VALID);
@@ -453,7 +459,7 @@ PHP_FUNCTION(mysqli_fetch_all)
PHP_FUNCTION(mysqli_get_client_stats)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
mysqlnd_get_client_stats(return_value);
}
@@ -468,7 +474,7 @@ PHP_FUNCTION(mysqli_get_connection_stats)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O",
&mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
@@ -485,7 +491,7 @@ PHP_FUNCTION(mysqli_error_list)
zval *mysql_link;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
#if defined(MYSQLI_USE_MYSQLND)
@@ -531,7 +537,7 @@ PHP_FUNCTION(mysqli_stmt_error_list)
zval *mysql_stmt;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_INITIALIZED);
#if defined(MYSQLI_USE_MYSQLND)
@@ -587,7 +593,7 @@ PHP_FUNCTION(mysqli_multi_query)
size_t query_len;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os", &mysql_link, mysqli_link_class_entry, &query, &query_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
@@ -637,7 +643,7 @@ PHP_FUNCTION(mysqli_query)
zend_long resultmode = MYSQLI_STORE_RESULT;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os|l", &mysql_link, mysqli_link_class_entry, &query, &query_len, &resultmode) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!query_len) {
@@ -725,7 +731,7 @@ static int mysqlnd_zval_array_to_mysqlnd_array(zval *in_array, MYSQLND ***out_ar
int i = 0, current = 0;
if (Z_TYPE_P(in_array) != IS_ARRAY) {
- return 0;
+ return SUCCESS;
}
*out_array = ecalloc(zend_hash_num_elements(Z_ARRVAL_P(in_array)) + 1, sizeof(MYSQLND *));
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(in_array), elem) {
@@ -738,18 +744,18 @@ static int mysqlnd_zval_array_to_mysqlnd_array(zval *in_array, MYSQLND ***out_ar
MYSQLI_RESOURCE *my_res;
mysqli_object *intern = Z_MYSQLI_P(elem);
if (!(my_res = (MYSQLI_RESOURCE *)intern->ptr)) {
- php_error_docref(NULL, E_WARNING, "[%d] Couldn't fetch %s", i, ZSTR_VAL(intern->zo.ce->name));
- continue;
+ zend_throw_error(NULL, "%s object is already closed", ZSTR_VAL(intern->zo.ce->name));
+ return FAILURE;
}
mysql = (MY_MYSQL*) my_res->ptr;
if (MYSQLI_STATUS_VALID && my_res->status < MYSQLI_STATUS_VALID) {
- php_error_docref(NULL, E_WARNING, "Invalid object %d or resource %s", i, ZSTR_VAL(intern->zo.ce->name));
- continue;
+ zend_throw_error(NULL, "%s object is not fully initialized", ZSTR_VAL(intern->zo.ce->name));
+ return FAILURE;
}
(*out_array)[current++] = mysql->mysql;
}
} ZEND_HASH_FOREACH_END();
- return 0;
+ return SUCCESS;
}
/* }}} */
@@ -840,7 +846,7 @@ PHP_FUNCTION(mysqli_poll)
int desc_num;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "a!a!al|l", &r_array, &e_array, &dont_poll_array, &sec, &usec) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (sec < 0 || usec < 0) {
php_error_docref(NULL, E_WARNING, "Negative values passed for sec and/or usec");
@@ -853,10 +859,16 @@ PHP_FUNCTION(mysqli_poll)
}
if (r_array != NULL) {
- mysqlnd_zval_array_to_mysqlnd_array(r_array, &new_r_array);
+ if (mysqlnd_zval_array_to_mysqlnd_array(r_array, &new_r_array) == FAILURE) {
+ efree(new_r_array);
+ RETURN_THROWS();
+ }
}
if (e_array != NULL) {
- mysqlnd_zval_array_to_mysqlnd_array(e_array, &new_e_array);
+ if (mysqlnd_zval_array_to_mysqlnd_array(e_array, &new_e_array) == FAILURE) {
+ efree(new_e_array);
+ RETURN_THROWS();
+ }
}
ret = mysqlnd_poll(new_r_array, new_e_array, &new_dont_poll_array, sec, usec, &desc_num);
@@ -897,7 +909,7 @@ PHP_FUNCTION(mysqli_reap_async_query)
MYSQL_RES *result = NULL;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
@@ -950,7 +962,7 @@ PHP_FUNCTION(mysqli_stmt_get_result)
zval *mysql_stmt;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID);
@@ -976,7 +988,7 @@ PHP_FUNCTION(mysqli_get_warnings)
MYSQLI_WARNING *w = NULL;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
@@ -1006,7 +1018,7 @@ PHP_FUNCTION(mysqli_stmt_get_warnings)
MYSQLI_WARNING *w = NULL;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &stmt_link, mysqli_stmt_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_STMT(stmt, stmt_link, MYSQLI_STATUS_VALID);
@@ -1034,7 +1046,7 @@ PHP_FUNCTION(mysqli_set_charset)
size_t csname_len;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os", &mysql_link, mysqli_link_class_entry, &cs_name, &csname_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
@@ -1062,7 +1074,7 @@ PHP_FUNCTION(mysqli_get_charset)
#endif
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
@@ -1169,7 +1181,7 @@ PHP_FUNCTION(mysqli_begin_transaction)
zend_bool err = FALSE;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O|ls", &mysql_link, mysqli_link_class_entry, &flags, &name, &name_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
if (flags < 0) {
@@ -1221,7 +1233,7 @@ PHP_FUNCTION(mysqli_savepoint)
size_t name_len = -1;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os", &mysql_link, mysqli_link_class_entry, &name, &name_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
if (!name || !name_len) {
@@ -1250,7 +1262,7 @@ PHP_FUNCTION(mysqli_release_savepoint)
size_t name_len = -1;
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os", &mysql_link, mysqli_link_class_entry, &name, &name_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
if (!name || !name_len) {
@@ -1272,10 +1284,10 @@ PHP_FUNCTION(mysqli_release_savepoint)
Returns information about open and cached links */
PHP_FUNCTION(mysqli_get_links_stats)
{
- if (ZEND_NUM_ARGS()) {
- php_error_docref(NULL, E_WARNING, "no parameters expected");
- return;
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
}
+
array_init(return_value);
add_assoc_long_ex(return_value, "total", sizeof("total") - 1, MyG(num_links));
add_assoc_long_ex(return_value, "active_plinks", sizeof("active_plinks") - 1, MyG(num_active_persistent));
diff --git a/ext/mysqli/mysqli_priv.h b/ext/mysqli/mysqli_priv.h
index 6448c7ce60..6d3db39038 100644
--- a/ext/mysqli/mysqli_priv.h
+++ b/ext/mysqli/mysqli_priv.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqli/mysqli_prop.c b/ext/mysqli/mysqli_prop.c
index 8190d4ab0e..ef564a35d5 100644
--- a/ext/mysqli/mysqli_prop.c
+++ b/ext/mysqli/mysqli_prop.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -32,9 +30,8 @@
#define CHECK_STATUS(value, quiet) \
if (!obj->ptr || ((MYSQLI_RESOURCE *)obj->ptr)->status < value ) { \
if (!quiet) { \
- php_error_docref(NULL, E_WARNING, "Property access is not allowed yet"); \
+ zend_throw_error(NULL, "Property access is not allowed yet"); \
} \
- ZVAL_FALSE(retval); \
return FAILURE; \
} \
@@ -42,9 +39,8 @@
MYSQL *p; \
if (!obj->ptr || !(MY_MYSQL *)((MYSQLI_RESOURCE *)(obj->ptr))->ptr) { \
if (!quiet) { \
- php_error_docref(NULL, E_WARNING, "Couldn't fetch %s", ZSTR_VAL(obj->zo.ce->name)); \
+ zend_throw_error(NULL, "%s object is already closed", ZSTR_VAL(obj->zo.ce->name)); \
} \
- ZVAL_FALSE(retval);\
return FAILURE; \
} else { \
CHECK_STATUS(statusval, quiet);\
@@ -55,9 +51,8 @@ if (!obj->ptr || !(MY_MYSQL *)((MYSQLI_RESOURCE *)(obj->ptr))->ptr) { \
MYSQL_RES *p; \
if (!obj->ptr) { \
if (!quiet) { \
- php_error_docref(NULL, E_WARNING, "Couldn't fetch %s", ZSTR_VAL(obj->zo.ce->name)); \
+ zend_throw_error(NULL, "%s object is already closed", ZSTR_VAL(obj->zo.ce->name)); \
} \
- ZVAL_NULL(retval);\
return FAILURE; \
} else { \
CHECK_STATUS(statusval, quiet);\
@@ -68,9 +63,8 @@ if (!obj->ptr) { \
MYSQL_STMT *p; \
if (!obj->ptr) { \
if (!quiet) { \
- php_error_docref(NULL, E_WARNING, "Couldn't fetch %s", ZSTR_VAL(obj->zo.ce->name)); \
+ zend_throw_error(NULL, "%s object is already closed", ZSTR_VAL(obj->zo.ce->name)); \
} \
- ZVAL_NULL(retval);\
return FAILURE; \
} else { \
CHECK_STATUS(statusval, quiet); \
diff --git a/ext/mysqli/mysqli_report.c b/ext/mysqli/mysqli_report.c
index 330e5a6f70..64cff6cb49 100644
--- a/ext/mysqli/mysqli_report.c
+++ b/ext/mysqli/mysqli_report.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -35,7 +33,7 @@ PHP_FUNCTION(mysqli_report)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MyG(report_mode) = flags;
diff --git a/ext/mysqli/mysqli_result_iterator.c b/ext/mysqli/mysqli_result_iterator.c
index caf19c34d1..3721edf5e3 100644
--- a/ext/mysqli/mysqli_result_iterator.c
+++ b/ext/mysqli/mysqli_result_iterator.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqli/mysqli_warning.c b/ext/mysqli/mysqli_warning.c
index ab6a0d3830..380d2e3fd9 100644
--- a/ext/mysqli/mysqli_warning.c
+++ b/ext/mysqli/mysqli_warning.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -183,7 +181,7 @@ PHP_METHOD(mysqli_warning, next)
if (obj->ptr) {
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O",
&mysqli_warning, mysqli_warning_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
MYSQLI_FETCH_RESOURCE(w, MYSQLI_WARNING *, mysqli_warning, "mysqli_warning", MYSQLI_STATUS_VALID);
@@ -205,9 +203,8 @@ static int mysqli_warning_message(mysqli_object *obj, zval *retval, zend_bool qu
if (!obj->ptr || !((MYSQLI_RESOURCE *)(obj->ptr))->ptr) {
if (!quiet) {
- php_error_docref(NULL, E_WARNING, "Couldn't fetch %s", ZSTR_VAL(obj->zo.ce->name));
+ zend_throw_error(NULL, "Couldn't fetch %s", ZSTR_VAL(obj->zo.ce->name));
}
- ZVAL_NULL(retval);
return FAILURE;
}
@@ -226,9 +223,8 @@ static int mysqli_warning_sqlstate(mysqli_object *obj, zval *retval, zend_bool q
if (!obj->ptr || !((MYSQLI_RESOURCE *)(obj->ptr))->ptr) {
if (!quiet) {
- php_error_docref(NULL, E_WARNING, "Couldn't fetch %s", ZSTR_VAL(obj->zo.ce->name));
+ zend_throw_error(NULL, "Couldn't fetch %s", ZSTR_VAL(obj->zo.ce->name));
}
- ZVAL_NULL(retval);
return FAILURE;
}
@@ -247,9 +243,8 @@ static int mysqli_warning_errno(mysqli_object *obj, zval *retval, zend_bool quie
if (!obj->ptr || !((MYSQLI_RESOURCE *)(obj->ptr))->ptr) {
if (!quiet) {
- php_error_docref(NULL, E_WARNING, "Couldn't fetch %s", ZSTR_VAL(obj->zo.ce->name));
+ zend_throw_error(NULL, "Couldn't fetch %s", ZSTR_VAL(obj->zo.ce->name));
}
- ZVAL_NULL(retval);
return FAILURE;
}
@@ -273,7 +268,7 @@ PHP_METHOD(mysqli_warning, __construct)
MYSQLI_RESOURCE *mysqli_resource;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &z) == FAILURE) {
- return;
+ RETURN_THROWS();
}
obj = Z_MYSQLI_P(z);
@@ -306,7 +301,7 @@ PHP_METHOD(mysqli_warning, __construct)
RETURN_FALSE;
}
} else {
- php_error_docref(NULL, E_WARNING, "invalid class argument");
+ php_error_docref(NULL, E_WARNING, "Invalid class argument");
RETURN_FALSE;
}
diff --git a/ext/mysqli/php_mysqli.h b/ext/mysqli/php_mysqli.h
index 64a979d3fd..e53c6a8169 100644
--- a/ext/mysqli/php_mysqli.h
+++ b/ext/mysqli/php_mysqli.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqli/php_mysqli_structs.h b/ext/mysqli/php_mysqli_structs.h
index 96fbacb82e..02d97b29bc 100644
--- a/ext/mysqli/php_mysqli_structs.h
+++ b/ext/mysqli/php_mysqli_structs.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -86,7 +84,6 @@
enum mysqli_status {
MYSQLI_STATUS_UNKNOWN=0,
- MYSQLI_STATUS_CLEARED,
MYSQLI_STATUS_INITIALIZED,
MYSQLI_STATUS_VALID
};
@@ -249,13 +246,13 @@ extern void php_mysqli_fetch_into_hash_aux(zval *return_value, MYSQL_RES * resul
MYSQLI_RESOURCE *my_res; \
mysqli_object *intern = Z_MYSQLI_P(__id); \
if (!(my_res = (MYSQLI_RESOURCE *)intern->ptr)) {\
- php_error_docref(NULL, E_WARNING, "Couldn't fetch %s", ZSTR_VAL(intern->zo.ce->name));\
- RETURN_FALSE;\
+ zend_throw_error(NULL, "%s object is already closed", ZSTR_VAL(intern->zo.ce->name));\
+ RETURN_THROWS();\
}\
__ptr = (__type)my_res->ptr; \
if (__check && my_res->status < __check) { \
- php_error_docref(NULL, E_WARNING, "invalid object or resource %s\n", ZSTR_VAL(intern->zo.ce->name)); \
- RETURN_FALSE;\
+ zend_throw_error(NULL, "%s object is not fully initialized", ZSTR_VAL(intern->zo.ce->name)); \
+ RETURN_THROWS();\
}\
}
@@ -263,12 +260,12 @@ extern void php_mysqli_fetch_into_hash_aux(zval *return_value, MYSQL_RES * resul
{ \
MYSQLI_RESOURCE *my_res; \
if (!(my_res = (MYSQLI_RESOURCE *)(__obj->ptr))) {\
- php_error_docref(NULL, E_WARNING, "Couldn't fetch %s", ZSTR_VAL(intern->zo.ce->name));\
- return;\
- }\
+ zend_throw_error(NULL, "%s object is already closed", ZSTR_VAL(intern->zo.ce->name));\
+ return;\
+ }\
__ptr = (__type)my_res->ptr; \
if (__check && my_res->status < __check) { \
- php_error_docref(NULL, E_WARNING, "invalid object or resource %s\n", ZSTR_VAL(intern->zo.ce->name)); \
+ zend_throw_error(NULL, "%s object is not fully initialized", ZSTR_VAL(intern->zo.ce->name)); \
return;\
}\
}
@@ -276,21 +273,13 @@ extern void php_mysqli_fetch_into_hash_aux(zval *return_value, MYSQL_RES * resul
#define MYSQLI_FETCH_RESOURCE_CONN(__ptr, __id, __check) \
{ \
MYSQLI_FETCH_RESOURCE((__ptr), MY_MYSQL *, (__id), "mysqli_link", (__check)); \
- if (!(__ptr)->mysql) { \
- mysqli_object *intern = Z_MYSQLI_P(__id); \
- php_error_docref(NULL, E_WARNING, "invalid object or resource %s\n", ZSTR_VAL(intern->zo.ce->name)); \
- RETURN_NULL(); \
- } \
+ ZEND_ASSERT((__ptr)->mysql && "Missing connection?"); \
}
#define MYSQLI_FETCH_RESOURCE_STMT(__ptr, __id, __check) \
{ \
MYSQLI_FETCH_RESOURCE((__ptr), MY_STMT *, (__id), "mysqli_stmt", (__check)); \
- if (!(__ptr)->stmt) { \
- mysqli_object *intern = Z_MYSQLI_P(__id); \
- php_error_docref(NULL, E_WARNING, "invalid object or resource %s\n", ZSTR_VAL(intern->zo.ce->name)); \
- RETURN_NULL();\
- } \
+ ZEND_ASSERT((__ptr)->stmt && "Missing statement?"); \
}
#define MYSQLI_SET_STATUS(__id, __value) \
diff --git a/ext/mysqli/tests/001.phpt b/ext/mysqli/tests/001.phpt
index f7a72aea05..f8ddc8a38d 100644
--- a/ext/mysqli/tests/001.phpt
+++ b/ext/mysqli/tests/001.phpt
@@ -8,55 +8,55 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
-
- $test = "";
-
- /*** test mysqli_connect localhost:port ***/
- $link = my_mysqli_connect($host, $user, $passwd, "", $port, $socket);
- $test .= ($link) ? "1" : "0";
- mysqli_close($link);
-
- /*** test mysqli_real_connect ***/
- $link = mysqli_init();
- $test.= (my_mysqli_real_connect($link, $host, $user, $passwd, "", $port, $socket) )
- ? "1" : "0";
- mysqli_close($link);
-
- /*** test mysqli_real_connect with db ***/
- $link = mysqli_init();
- $test .= (my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))
- ? "1" : "0";
- mysqli_close($link);
-
- /*** test mysqli_real_connect with port ***/
- $link = mysqli_init();
- $test .= (my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))
- ? "1":"0";
- mysqli_close($link);
-
- /* temporary addition for Kent's setup, Win32 box */
- for ($i = 0; $i < 10; $i++) {
- if (!$link = mysqli_init())
- printf("[001 + %d] mysqli_init() failed, [%d] %s\n", $i, mysqli_connect_errno(), mysqli_connect_error());
-
- if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))
- printf("[002 + %d] mysqli_real_connect() failed, [%d] %s\n", $i, mysqli_connect_errno(), mysqli_connect_error());
-
- mysqli_close($link);
- }
-
- /*** test mysqli_real_connect compressed ***/
- /*
- $link = mysqli_init();
- $test .= (my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, MYSQLI_CLIENT_COMPRESS))
- ? "1" : "0";
- mysqli_close($link);
+ require_once("connect.inc");
+
+ $test = "";
+
+ /*** test mysqli_connect localhost:port ***/
+ $link = my_mysqli_connect($host, $user, $passwd, "", $port, $socket);
+ $test .= ($link) ? "1" : "0";
+ mysqli_close($link);
+
+ /*** test mysqli_real_connect ***/
+ $link = mysqli_init();
+ $test.= (my_mysqli_real_connect($link, $host, $user, $passwd, "", $port, $socket) )
+ ? "1" : "0";
+ mysqli_close($link);
+
+ /*** test mysqli_real_connect with db ***/
+ $link = mysqli_init();
+ $test .= (my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))
+ ? "1" : "0";
+ mysqli_close($link);
+
+ /*** test mysqli_real_connect with port ***/
+ $link = mysqli_init();
+ $test .= (my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))
+ ? "1":"0";
+ mysqli_close($link);
+
+ /* temporary addition for Kent's setup, Win32 box */
+ for ($i = 0; $i < 10; $i++) {
+ if (!$link = mysqli_init())
+ printf("[001 + %d] mysqli_init() failed, [%d] %s\n", $i, mysqli_connect_errno(), mysqli_connect_error());
+
+ if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))
+ printf("[002 + %d] mysqli_real_connect() failed, [%d] %s\n", $i, mysqli_connect_errno(), mysqli_connect_error());
+
+ mysqli_close($link);
+ }
+
+ /*** test mysqli_real_connect compressed ***/
+ /*
+ $link = mysqli_init();
+ $test .= (my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, MYSQLI_CLIENT_COMPRESS))
+ ? "1" : "0";
+ mysqli_close($link);
*/
- /* todo ssl connections */
+ /* todo ssl connections */
- var_dump($test);
- print "done!";
+ var_dump($test);
+ print "done!";
?>
--EXPECTF--
%s(4) "1111"
diff --git a/ext/mysqli/tests/002.phpt b/ext/mysqli/tests/002.phpt
index 1c98577454..0960da7a98 100644
--- a/ext/mysqli/tests/002.phpt
+++ b/ext/mysqli/tests/002.phpt
@@ -7,44 +7,44 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ /*** test mysqli_connect 127.0.0.1 ***/
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test_fetch_null"))
- printf("[002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test_fetch_null"))
+ printf("[002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $rc = mysqli_query($link,"CREATE TABLE test_fetch_null(col1 tinyint, col2 smallint,
- col3 int, col4 bigint,
- col5 float, col6 double,
- col7 date, col8 time,
- col9 varbinary(10),
- col10 varchar(50),
- col11 char(20)) ENGINE=" . $engine);
+ $rc = mysqli_query($link,"CREATE TABLE test_fetch_null(col1 tinyint, col2 smallint,
+ col3 int, col4 bigint,
+ col5 float, col6 double,
+ col7 date, col8 time,
+ col9 varbinary(10),
+ col10 varchar(50),
+ col11 char(20)) ENGINE=" . $engine);
- if (!$rc)
- printf("[003] Cannot create table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$rc)
+ printf("[003] Cannot create table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $rc = mysqli_query($link, "INSERT INTO test_fetch_null(col1,col10, col11) VALUES(1,'foo1', 1000),(2,'foo2', 88),(3,'foo3', 389789)");
- if (!$rc)
- printf("[004] Cannot insert records, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $rc = mysqli_query($link, "INSERT INTO test_fetch_null(col1,col10, col11) VALUES(1,'foo1', 1000),(2,'foo2', 88),(3,'foo3', 389789)");
+ if (!$rc)
+ printf("[004] Cannot insert records, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $stmt = mysqli_prepare($link, "SELECT col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11 from test_fetch_null ORDER BY col1");
- mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8, $c9, $c10, $c11);
- mysqli_stmt_execute($stmt);
+ $stmt = mysqli_prepare($link, "SELECT col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11 from test_fetch_null ORDER BY col1");
+ mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8, $c9, $c10, $c11);
+ mysqli_stmt_execute($stmt);
- mysqli_stmt_fetch($stmt);
+ mysqli_stmt_fetch($stmt);
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$c10,$c11);
+ $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$c10,$c11);
- var_dump($test);
+ var_dump($test);
- mysqli_stmt_close($stmt);
- @mysqli_query($link, "DROP TABLE IF EXISTS test_fetch_null");
- mysqli_close($link);
- print "done!";
+ mysqli_stmt_close($stmt);
+ @mysqli_query($link, "DROP TABLE IF EXISTS test_fetch_null");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/003.phpt b/ext/mysqli/tests/003.phpt
index c526dfbdff..faf3407bd7 100644
--- a/ext/mysqli/tests/003.phpt
+++ b/ext/mysqli/tests/003.phpt
@@ -7,70 +7,70 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_query($link, "SET sql_mode=''");
+ mysqli_query($link, "SET sql_mode=''");
- if (!mysqli_query($link,"DROP TABLE IF EXISTS test_bind_result"))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link,"DROP TABLE IF EXISTS test_bind_result"))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $rc = @mysqli_query($link,"CREATE TABLE test_bind_result(
- c1 date,
- c2 time,
- c3 timestamp(14),
- c4 year,
- c5 datetime,
- c6 timestamp(4),
- c7 timestamp(6)) ENGINE=" . $engine);
+ $rc = @mysqli_query($link,"CREATE TABLE test_bind_result(
+ c1 date,
+ c2 time,
+ c3 timestamp(14),
+ c4 year,
+ c5 datetime,
+ c6 timestamp(4),
+ c7 timestamp(6)) ENGINE=" . $engine);
- /*
- Seems that not all MySQL 6.0 installations use defaults that ignore the display widths.
- From the manual:
- From MySQL 4.1.0 on, TIMESTAMP display format differs from that of earlier MySQL releases:
- [...]
- Display widths (used as described in the preceding section) are no longer supported.
- In other words, for declarations such as TIMESTAMP(2), TIMESTAMP(4), and so on,
- the display width is ignored.
- [...]
- */
- if (!$rc)
- $rc = @mysqli_query($link,"CREATE TABLE test_bind_result(
- c1 date,
- c2 time,
- c3 timestamp,
- c4 year,
- c5 datetime,
- c6 timestamp,
- c7 timestamp) ENGINE=" . $engine);
+ /*
+ Seems that not all MySQL 6.0 installations use defaults that ignore the display widths.
+ From the manual:
+ From MySQL 4.1.0 on, TIMESTAMP display format differs from that of earlier MySQL releases:
+ [...]
+ Display widths (used as described in the preceding section) are no longer supported.
+ In other words, for declarations such as TIMESTAMP(2), TIMESTAMP(4), and so on,
+ the display width is ignored.
+ [...]
+ */
+ if (!$rc)
+ $rc = @mysqli_query($link,"CREATE TABLE test_bind_result(
+ c1 date,
+ c2 time,
+ c3 timestamp,
+ c4 year,
+ c5 datetime,
+ c6 timestamp,
+ c7 timestamp) ENGINE=" . $engine);
- if (!$rc)
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$rc)
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $rc = mysqli_query($link, "INSERT INTO test_bind_result VALUES(
- '2002-01-02',
- '12:49:00',
- '2002-01-02 17:46:59',
- 2010,
- '2010-07-10',
- '2020','1999-12-29')");
- if (!$rc)
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $rc = mysqli_query($link, "INSERT INTO test_bind_result VALUES(
+ '2002-01-02',
+ '12:49:00',
+ '2002-01-02 17:46:59',
+ 2010,
+ '2010-07-10',
+ '2020','1999-12-29')");
+ if (!$rc)
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $stmt = mysqli_prepare($link, "SELECT c1, c2, c3, c4, c5, c6, c7 FROM test_bind_result");
- mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
- mysqli_stmt_execute($stmt);
- mysqli_stmt_fetch($stmt);
+ $stmt = mysqli_prepare($link, "SELECT c1, c2, c3, c4, c5, c6, c7 FROM test_bind_result");
+ mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_fetch($stmt);
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
+ $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
- var_dump($test);
+ var_dump($test);
- mysqli_stmt_close($stmt);
- mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result");
- mysqli_close($link);
- print "done!";
+ mysqli_stmt_close($stmt);
+ mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/004.phpt b/ext/mysqli/tests/004.phpt
index e19d4c3119..0c246e0b2b 100644
--- a/ext/mysqli/tests/004.phpt
+++ b/ext/mysqli/tests/004.phpt
@@ -7,48 +7,48 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- include ("connect.inc");
+ include ("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
+ mysqli_select_db($link, $db);
- if (!mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2 text) ENGINE=" . $engine))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2 text) ENGINE=" . $engine))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567890', 'this is a test0')"))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567890', 'this is a test0')"))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567891', 'this is a test1')"))
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567891', 'this is a test1')"))
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567892', 'this is a test2')"))
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567892', 'this is a test2')"))
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567893', 'this is a test3')"))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567893', 'this is a test3')"))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch ORDER BY c1"))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch ORDER BY c1"))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $c1 = $c2 = NULL;
- mysqli_stmt_bind_result($stmt, $c1, $c2);
- mysqli_stmt_execute($stmt);
- $i = 4;
- while ($i--) {
- mysqli_stmt_fetch($stmt);
- $test = array($c1, $c2);
- var_dump($test);
- }
+ $c1 = $c2 = NULL;
+ mysqli_stmt_bind_result($stmt, $c1, $c2);
+ mysqli_stmt_execute($stmt);
+ $i = 4;
+ while ($i--) {
+ mysqli_stmt_fetch($stmt);
+ $test = array($c1, $c2);
+ var_dump($test);
+ }
- mysqli_stmt_close($stmt);
- mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_close($link);
- print "done!";
+ mysqli_stmt_close($stmt);
+ mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/005.phpt b/ext/mysqli/tests/005.phpt
index e1f5be989f..2dffee80c2 100644
--- a/ext/mysqli/tests/005.phpt
+++ b/ext/mysqli/tests/005.phpt
@@ -7,38 +7,38 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "CREATE TABLE test_bind_fetch(c1 char(10), c2 text) ENGINE=" . $engine))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "CREATE TABLE test_bind_fetch(c1 char(10), c2 text) ENGINE=" . $engine))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $a = str_repeat("A1", 32000);
+ $a = str_repeat("A1", 32000);
- mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567890', '$a')");
+ mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567890', '$a')");
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
- mysqli_stmt_bind_result($stmt, $c1, $c2);
- mysqli_stmt_execute($stmt);
- mysqli_stmt_fetch($stmt);
+ $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
+ mysqli_stmt_bind_result($stmt, $c1, $c2);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_fetch($stmt);
- $test[] = $c1;
- $test[] = ($a == $c2) ? "32K String ok" : "32K String failed";
+ $test[] = $c1;
+ $test[] = ($a == $c2) ? "32K String ok" : "32K String failed";
- var_dump($test);
+ var_dump($test);
- /* this will crash with libmysql from PHP 5.0.6 (or earlier) to 5.3.0 */
- mysqli_stmt_fetch($stmt);
+ /* this will crash with libmysql from PHP 5.0.6 (or earlier) to 5.3.0 */
+ mysqli_stmt_fetch($stmt);
- mysqli_stmt_close($stmt);
- mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_close($link);
- print "done!";
+ mysqli_stmt_close($stmt);
+ mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/006.phpt b/ext/mysqli/tests/006.phpt
index d60c52fbde..5e0443a9fb 100644
--- a/ext/mysqli/tests/006.phpt
+++ b/ext/mysqli/tests/006.phpt
@@ -7,43 +7,43 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- if (!mysqli_query($link, "SET sql_mode=''"))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "SET sql_mode=''"))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $rc = mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 int unsigned,
- c2 int unsigned,
- c3 int,
- c4 int,
- c5 int,
- c6 int unsigned,
- c7 int) ENGINE=" . $engine);
- if (!$rc)
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $rc = mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 int unsigned,
+ c2 int unsigned,
+ c3 int,
+ c4 int,
+ c5 int,
+ c6 int unsigned,
+ c7 int) ENGINE=" . $engine);
+ if (!$rc)
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,35999,NULL,-500,-9999999,-0,0)"))
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,35999,NULL,-500,-9999999,-0,0)"))
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
- mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
- mysqli_stmt_execute($stmt);
- mysqli_stmt_fetch($stmt);
+ $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
+ mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_fetch($stmt);
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
+ $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
- var_dump($test);
+ var_dump($test);
- mysqli_stmt_close($stmt);
- mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_close($link);
- print "done!";
+ mysqli_stmt_close($stmt);
+ mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/007.phpt b/ext/mysqli/tests/007.phpt
index 86c7fc2e57..b510d8d8a3 100644
--- a/ext/mysqli/tests/007.phpt
+++ b/ext/mysqli/tests/007.phpt
@@ -7,43 +7,43 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- if (!mysqli_query($link, "SET sql_mode=''"))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "SET sql_mode=''"))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $rc = mysqli_query($link, "CREATE TABLE test_bind_fetch(c1 smallint unsigned,
- c2 smallint unsigned,
- c3 smallint,
- c4 smallint,
- c5 smallint,
- c6 smallint unsigned,
- c7 smallint) ENGINE=" . $engine);
- if (!$rc)
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $rc = mysqli_query($link, "CREATE TABLE test_bind_fetch(c1 smallint unsigned,
+ c2 smallint unsigned,
+ c3 smallint,
+ c4 smallint,
+ c5 smallint,
+ c6 smallint unsigned,
+ c7 smallint) ENGINE=" . $engine);
+ if (!$rc)
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,35999,NULL,-500,-9999999,+30,0)"))
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,35999,NULL,-500,-9999999,+30,0)"))
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
- mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
- mysqli_stmt_execute($stmt);
- mysqli_stmt_fetch($stmt);
+ $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
+ mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_fetch($stmt);
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
+ $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
- var_dump($test);
+ var_dump($test);
- mysqli_stmt_close($stmt);
- mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_close($link);
- print "done!";
+ mysqli_stmt_close($stmt);
+ mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/008.phpt b/ext/mysqli/tests/008.phpt
index f36e524d11..412c3641e5 100644
--- a/ext/mysqli/tests/008.phpt
+++ b/ext/mysqli/tests/008.phpt
@@ -7,43 +7,43 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- if (!mysqli_query($link, "SET sql_mode=''"))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "SET sql_mode=''"))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $rc = mysqli_query($link, "CREATE TABLE test_bind_fetch(c1 tinyint,
- c2 tinyint unsigned,
- c3 tinyint not NULL,
- c4 tinyint,
- c5 tinyint,
- c6 tinyint unsigned,
- c7 tinyint) ENGINE=" . $engine);
- if (!$rc)
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $rc = mysqli_query($link, "CREATE TABLE test_bind_fetch(c1 tinyint,
+ c2 tinyint unsigned,
+ c3 tinyint not NULL,
+ c4 tinyint,
+ c5 tinyint,
+ c6 tinyint unsigned,
+ c7 tinyint) ENGINE=" . $engine);
+ if (!$rc)
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,300,0,-100,-127,+30,0)"))
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,300,0,-100,-127,+30,0)"))
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
- mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
- mysqli_stmt_execute($stmt);
- mysqli_stmt_fetch($stmt);
+ $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
+ mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_fetch($stmt);
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
+ $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
- var_dump($test);
+ var_dump($test);
- mysqli_stmt_close($stmt);
- mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_close($link);
- print "done!";
+ mysqli_stmt_close($stmt);
+ mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/009.phpt b/ext/mysqli/tests/009.phpt
index 906c0f027b..187ac3f9a3 100644
--- a/ext/mysqli/tests/009.phpt
+++ b/ext/mysqli/tests/009.phpt
@@ -11,72 +11,72 @@ mysqli fetch bigint values (ok to fail with 4.1.x)
?>
--FILE--
<?php
- require_once("connect.inc");
-
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
-
- if (!mysqli_query($link, "SET sql_mode=''"))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- $rc = mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 bigint default 5,
- c2 bigint,
- c3 bigint not NULL,
- c4 bigint unsigned,
- c5 bigint unsigned,
- c6 bigint unsigned,
- c7 bigint unsigned,
- c8 bigint unsigned) ENGINE=" . $engine);
- if (!$rc)
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- $rc = mysqli_query($link, "INSERT INTO test_bind_fetch (c2,c3,c4,c5,c6,c7,c8) ".
- "VALUES (-23,4.0,33333333333333,0,-333333333333,99.9,1234)");
- if (!$rc)
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
- mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8);
- mysqli_stmt_execute($stmt);
- $rc = mysqli_stmt_fetch($stmt);
-
- if (mysqli_get_server_version($link) < 50000) {
- // 4.1 is faulty and will return big number for $c6
- if ($c6 == "18446743740376218283") {
- $c6 = 0;
- }
- }
- $c8 = 4567;// change this to test how mysqli/mysqlnd handles is_ref changing
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8);
-
- var_dump($test);
-
- mysqli_stmt_close($stmt);
-
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch_uint"))
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $rc = mysqli_query($link, "CREATE TABLE test_bind_fetch_uint(c1 integer unsigned, c2 integer unsigned) ENGINE=" . $engine);
- if (!$rc)
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_query($link, "INSERT INTO test_bind_fetch_uint (c1,c2) VALUES (20123456, 3123456789)"))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch_uint");
- mysqli_stmt_bind_result($stmt, $c1, $c2);
- mysqli_stmt_execute($stmt);
- $rc = mysqli_stmt_fetch($stmt);
-
- echo $c1, "\n", $c2, "\n";
-
- mysqli_stmt_close($stmt);
- mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch_uint");
- mysqli_close($link);
- print "done!";
+ require_once("connect.inc");
+
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+
+ if (!mysqli_query($link, "SET sql_mode=''"))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ $rc = mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 bigint default 5,
+ c2 bigint,
+ c3 bigint not NULL,
+ c4 bigint unsigned,
+ c5 bigint unsigned,
+ c6 bigint unsigned,
+ c7 bigint unsigned,
+ c8 bigint unsigned) ENGINE=" . $engine);
+ if (!$rc)
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ $rc = mysqli_query($link, "INSERT INTO test_bind_fetch (c2,c3,c4,c5,c6,c7,c8) ".
+ "VALUES (-23,4.0,33333333333333,0,-333333333333,99.9,1234)");
+ if (!$rc)
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
+ mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8);
+ mysqli_stmt_execute($stmt);
+ $rc = mysqli_stmt_fetch($stmt);
+
+ if (mysqli_get_server_version($link) < 50000) {
+ // 4.1 is faulty and will return big number for $c6
+ if ($c6 == "18446743740376218283") {
+ $c6 = 0;
+ }
+ }
+ $c8 = 4567;// change this to test how mysqli/mysqlnd handles is_ref changing
+ $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8);
+
+ var_dump($test);
+
+ mysqli_stmt_close($stmt);
+
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch_uint"))
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $rc = mysqli_query($link, "CREATE TABLE test_bind_fetch_uint(c1 integer unsigned, c2 integer unsigned) ENGINE=" . $engine);
+ if (!$rc)
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_query($link, "INSERT INTO test_bind_fetch_uint (c1,c2) VALUES (20123456, 3123456789)"))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch_uint");
+ mysqli_stmt_bind_result($stmt, $c1, $c2);
+ mysqli_stmt_execute($stmt);
+ $rc = mysqli_stmt_fetch($stmt);
+
+ echo $c1, "\n", $c2, "\n";
+
+ mysqli_stmt_close($stmt);
+ mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch_uint");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/010.phpt b/ext/mysqli/tests/010.phpt
index b1712ca2a6..3b55d0801c 100644
--- a/ext/mysqli/tests/010.phpt
+++ b/ext/mysqli/tests/010.phpt
@@ -9,44 +9,44 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- if (!mysqli_query($link, "SET sql_mode=''"))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "SET sql_mode=''"))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $rc = mysqli_query($link, "CREATE TABLE test_bind_fetch(c1 float(3),
- c2 float,
- c3 float unsigned,
- c4 float,
- c5 float,
- c6 float,
- c7 float(10) unsigned) ENGINE=" . $engine);
- if (!$rc)
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $rc = mysqli_query($link, "CREATE TABLE test_bind_fetch(c1 float(3),
+ c2 float,
+ c3 float unsigned,
+ c4 float,
+ c5 float,
+ c6 float,
+ c7 float(10) unsigned) ENGINE=" . $engine);
+ if (!$rc)
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_query($link, "INSERT INTO test_bind_fetch (c1,c2,c3,c4,c5,c6,c7) VALUES (3.1415926535,-0.000001, -5, 999999999999,
- sin(0.6), 1.00000000000001, 888888888888888)");
+ mysqli_query($link, "INSERT INTO test_bind_fetch (c1,c2,c3,c4,c5,c6,c7) VALUES (3.1415926535,-0.000001, -5, 999999999999,
+ sin(0.6), 1.00000000000001, 888888888888888)");
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
- mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
- mysqli_stmt_execute($stmt);
- mysqli_stmt_fetch($stmt);
+ $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
+ mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_fetch($stmt);
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
+ $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
- var_dump($test);
+ var_dump($test);
- mysqli_stmt_close($stmt);
- mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_close($link);
- print "done!";
+ mysqli_stmt_close($stmt);
+ mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/011.phpt b/ext/mysqli/tests/011.phpt
index 1792fec6a2..4be6fe62c5 100644
--- a/ext/mysqli/tests/011.phpt
+++ b/ext/mysqli/tests/011.phpt
@@ -9,41 +9,41 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $rc = mysqli_query($link, "CREATE TABLE test_bind_result(c1 tinyint, c2 smallint,
- c3 int, c4 bigint,
- c5 float, c6 double,
- c7 varbinary(10),
- c8 varchar(50)) ENGINE=" . $engine);
- if (!$rc)
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $rc = mysqli_query($link, "CREATE TABLE test_bind_result(c1 tinyint, c2 smallint,
+ c3 int, c4 bigint,
+ c5 float, c6 double,
+ c7 varbinary(10),
+ c8 varchar(50)) ENGINE=" . $engine);
+ if (!$rc)
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $rc = mysqli_query($link,"INSERT INTO test_bind_result VALUES(19,2999,3999,4999999,
- 2345.6,5678.89563,
- 'foobar','mysql rulez')");
- if (!$rc)
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $rc = mysqli_query($link,"INSERT INTO test_bind_result VALUES(19,2999,3999,4999999,
+ 2345.6,5678.89563,
+ 'foobar','mysql rulez')");
+ if (!$rc)
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
- mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8);
- mysqli_stmt_execute($stmt);
- mysqli_stmt_fetch($stmt);
+ $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
+ mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_fetch($stmt);
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8);
+ $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8);
- var_dump($test);
+ var_dump($test);
- mysqli_stmt_close($stmt);
- mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result");
- mysqli_close($link);
- print "done!";
+ mysqli_stmt_close($stmt);
+ mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/012.phpt b/ext/mysqli/tests/012.phpt
index 2d8c6500ec..c2981a206c 100644
--- a/ext/mysqli/tests/012.phpt
+++ b/ext/mysqli/tests/012.phpt
@@ -9,40 +9,40 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $rc = mysqli_query($link, "CREATE TABLE test_bind_result(c1 tinyint, c2 smallint,
- c3 int, c4 bigint,
- c5 float, c6 double,
- c7 varbinary(10),
- c8 varchar(10)) ENGINE=" . $engine);
- if (!$rc)
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $rc = mysqli_query($link, "CREATE TABLE test_bind_result(c1 tinyint, c2 smallint,
+ c3 int, c4 bigint,
+ c5 float, c6 double,
+ c7 varbinary(10),
+ c8 varchar(10)) ENGINE=" . $engine);
+ if (!$rc)
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "INSERT INTO test_bind_result VALUES(120,2999,3999,54,
- 2.6,58.89,
- '206','6.7')"))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "INSERT INTO test_bind_result VALUES(120,2999,3999,54,
+ 2.6,58.89,
+ '206','6.7')"))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
- mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8);
- mysqli_stmt_execute($stmt);
- mysqli_stmt_fetch($stmt);
+ $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
+ mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_fetch($stmt);
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8);
+ $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8);
- var_dump($test);
+ var_dump($test);
- mysqli_stmt_close($stmt);
- mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result");
- mysqli_close($link);
- print "done!";
+ mysqli_stmt_close($stmt);
+ mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/013.phpt b/ext/mysqli/tests/013.phpt
index 21fd278489..2361622c46 100644
--- a/ext/mysqli/tests/013.phpt
+++ b/ext/mysqli/tests/013.phpt
@@ -7,54 +7,54 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $rc = mysqli_query($link, "CREATE TABLE test_bind_result(c1 tinyint, c2 smallint,
- c3 int, c4 bigint,
- c5 decimal(4,2), c6 double,
- c7 varbinary(10),
- c8 varchar(10)) ENGINE=" . $engine);
- if (!$rc)
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $rc = mysqli_query($link, "CREATE TABLE test_bind_result(c1 tinyint, c2 smallint,
+ c3 int, c4 bigint,
+ c5 decimal(4,2), c6 double,
+ c7 varbinary(10),
+ c8 varchar(10)) ENGINE=" . $engine);
+ if (!$rc)
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "INSERT INTO test_bind_result VALUES(120,2999,3999,54,
- 2.6,58.89,
- '206','6.7')"))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "INSERT INTO test_bind_result VALUES(120,2999,3999,54,
+ 2.6,58.89,
+ '206','6.7')"))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
+ $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
- $c = array(0,0,0,0,0,0,0,0);
- $b_res= mysqli_stmt_bind_result($stmt, $c[0], $c[1], $c[2], $c[3], $c[4], $c[5], $c[6], $c[7]);
- mysqli_stmt_execute($stmt);
- mysqli_stmt_fetch($stmt);
- mysqli_stmt_fetch($stmt);
- mysqli_stmt_close($stmt);
+ $c = array(0,0,0,0,0,0,0,0);
+ $b_res= mysqli_stmt_bind_result($stmt, $c[0], $c[1], $c[2], $c[3], $c[4], $c[5], $c[6], $c[7]);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_fetch($stmt);
+ mysqli_stmt_fetch($stmt);
+ mysqli_stmt_close($stmt);
- $result = mysqli_query($link, "select * from test_bind_result");
- $d = mysqli_fetch_row($result);
- mysqli_free_result($result);
+ $result = mysqli_query($link, "select * from test_bind_result");
+ $d = mysqli_fetch_row($result);
+ mysqli_free_result($result);
- $test = "";
- for ($i=0; $i < count($c); $i++)
- $test .= ($c[$i] == $d[$i]) ? "1" : "0";
- if ($test == "11111111")
- echo "ok\n";
- else if ($b_res == FALSE && mysqli_get_client_version() > 40100 && mysqli_get_client_version() < 50000 &&
- mysqli_get_server_version($link) > 50000)
- echo "error (4.1 library with 5.x server)";
- else
- echo "error";
+ $test = "";
+ for ($i=0; $i < count($c); $i++)
+ $test .= ($c[$i] == $d[$i]) ? "1" : "0";
+ if ($test == "11111111")
+ echo "ok\n";
+ else if ($b_res == FALSE && mysqli_get_client_version() > 40100 && mysqli_get_client_version() < 50000 &&
+ mysqli_get_server_version($link) > 50000)
+ echo "error (4.1 library with 5.x server)";
+ else
+ echo "error";
- mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result");
- mysqli_close($link);
- print "done!";
+ mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/014.phpt b/ext/mysqli/tests/014.phpt
index 576b337b57..cb100001c5 100644
--- a/ext/mysqli/tests/014.phpt
+++ b/ext/mysqli/tests/014.phpt
@@ -15,66 +15,66 @@ mysqli autocommit/commit/rollback
?>
--FILE--
<?php
- require_once("connect.inc");
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ require_once("connect.inc");
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- if (!mysqli_autocommit($link, TRUE))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_autocommit($link, TRUE))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "CREATE TABLE test(a int, b varchar(10)) engine=InnoDB"))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "CREATE TABLE test(a int, b varchar(10)) engine=InnoDB"))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "INSERT INTO test VALUES (1, 'foobar')"))
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "INSERT INTO test VALUES (1, 'foobar')"))
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_autocommit($link, FALSE))
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_autocommit($link, FALSE))
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "DELETE FROM test"))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DELETE FROM test"))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "INSERT INTO test VALUES (2, 'egon')"))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "INSERT INTO test VALUES (2, 'egon')"))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_rollback($link))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_rollback($link))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$result = mysqli_query($link, "SELECT * FROM test"))
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$result = mysqli_query($link, "SELECT * FROM test"))
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- printf("Num_of_rows=%d\n", mysqli_num_rows($result));
- if (!$row = mysqli_fetch_row($result))
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ printf("Num_of_rows=%d\n", mysqli_num_rows($result));
+ if (!$row = mysqli_fetch_row($result))
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($result);
+ mysqli_free_result($result);
- var_dump($row);
+ var_dump($row);
- if (!mysqli_query($link, "DELETE FROM test"))
- printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DELETE FROM test"))
+ printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "INSERT INTO test VALUES (2, 'egon')"))
- printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "INSERT INTO test VALUES (2, 'egon')"))
+ printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_commit($link))
- printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_commit($link))
+ printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$result = mysqli_query($link, "SELECT * FROM test"))
- printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$result = mysqli_query($link, "SELECT * FROM test"))
+ printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$row = mysqli_fetch_row($result))
- printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$row = mysqli_fetch_row($result))
+ printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($result);
+ mysqli_free_result($result);
- var_dump($row);
+ var_dump($row);
- mysqli_query($link, "DROP TABLE IF EXISTS test");
- mysqli_close($link);
- print "done!";
+ mysqli_query($link, "DROP TABLE IF EXISTS test");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/015.phpt b/ext/mysqli/tests/015.phpt
index 0d2b44d7d3..099fcff24e 100644
--- a/ext/mysqli/tests/015.phpt
+++ b/ext/mysqli/tests/015.phpt
@@ -14,65 +14,65 @@ mysqli autocommit/commit/rollback with innodb
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- if (!$link)
- printf("[001] Cannot connect, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ if (!$link)
+ printf("[001] Cannot connect, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- if (!mysqli_select_db($link, $db))
- printf("[002] Cannot select DB '%s', [%d] %s\n", $db,
- mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_select_db($link, $db))
+ printf("[002] Cannot select DB '%s', [%d] %s\n", $db,
+ mysqli_errno($link), mysqli_error($link));
- if (!mysqli_autocommit($link, TRUE))
- printf("[003] Cannot turn on autocommit mode, [%d] %s\n",
- mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_autocommit($link, TRUE))
+ printf("[003] Cannot turn on autocommit mode, [%d] %s\n",
+ mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link,"DROP TABLE IF EXISTS test") ||
- !mysqli_query($link,"CREATE TABLE test(a int, b varchar(10)) Engine=InnoDB") ||
- !mysqli_query($link, "INSERT INTO test VALUES (1, 'foobar')"))
- printf("[004] Cannot create test data, [%d] %s\n",
- mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link,"DROP TABLE IF EXISTS test") ||
+ !mysqli_query($link,"CREATE TABLE test(a int, b varchar(10)) Engine=InnoDB") ||
+ !mysqli_query($link, "INSERT INTO test VALUES (1, 'foobar')"))
+ printf("[004] Cannot create test data, [%d] %s\n",
+ mysqli_errno($link), mysqli_error($link));
- if (!mysqli_autocommit($link, FALSE))
- printf("[005] Cannot turn off autocommit mode, [%d] %s\n",
- mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_autocommit($link, FALSE))
+ printf("[005] Cannot turn off autocommit mode, [%d] %s\n",
+ mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "DELETE FROM test") ||
- !mysqli_query($link, "INSERT INTO test VALUES (2, 'egon')"))
- printf("[006] Cannot modify test data, [%d] %s\n",
- mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DELETE FROM test") ||
+ !mysqli_query($link, "INSERT INTO test VALUES (2, 'egon')"))
+ printf("[006] Cannot modify test data, [%d] %s\n",
+ mysqli_errno($link), mysqli_error($link));
- if (!mysqli_rollback($link))
- printf("[007] Cannot call rollback, [%d] %s\n",
- mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_rollback($link))
+ printf("[007] Cannot call rollback, [%d] %s\n",
+ mysqli_errno($link), mysqli_error($link));
- $result = mysqli_query($link, "SELECT SQL_NO_CACHE * FROM test");
- if (!$result)
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $row = mysqli_fetch_row($result);
- mysqli_free_result($result);
+ $result = mysqli_query($link, "SELECT SQL_NO_CACHE * FROM test");
+ if (!$result)
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $row = mysqli_fetch_row($result);
+ mysqli_free_result($result);
- var_dump($row);
+ var_dump($row);
- if (!mysqli_query($link, "DELETE FROM test") ||
- !mysqli_query($link, "INSERT INTO test VALUES (2, 'egon')"))
- printf("[009] Cannot modify test data, [%d] %s\n",
- mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DELETE FROM test") ||
+ !mysqli_query($link, "INSERT INTO test VALUES (2, 'egon')"))
+ printf("[009] Cannot modify test data, [%d] %s\n",
+ mysqli_errno($link), mysqli_error($link));
- mysqli_commit($link);
+ mysqli_commit($link);
- $result = mysqli_query($link, "SELECT * FROM test");
- if (!$result)
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $row = mysqli_fetch_row($result);
- mysqli_free_result($result);
+ $result = mysqli_query($link, "SELECT * FROM test");
+ if (!$result)
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $row = mysqli_fetch_row($result);
+ mysqli_free_result($result);
- var_dump($row);
+ var_dump($row);
- mysqli_query($link, "DROP TABLE IF EXISTS test");
- mysqli_close($link);
- print "done!";
+ mysqli_query($link, "DROP TABLE IF EXISTS test");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/016.phpt b/ext/mysqli/tests/016.phpt
index b534f7d455..14fa02df73 100644
--- a/ext/mysqli/tests/016.phpt
+++ b/ext/mysqli/tests/016.phpt
@@ -7,26 +7,26 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- if (!mysqli_query($link, "SET @dummy='foobar'"))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "SET @dummy='foobar'"))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$stmt = mysqli_prepare($link, "SELECT @dummy"))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_prepare($link, "SELECT @dummy"))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_stmt_bind_result($stmt, $dummy);
- mysqli_stmt_execute($stmt);
- mysqli_stmt_fetch($stmt);
+ mysqli_stmt_bind_result($stmt, $dummy);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_fetch($stmt);
- var_dump($dummy);
+ var_dump($dummy);
- mysqli_stmt_close($stmt);
- mysqli_close($link);
- print "done!";
+ mysqli_stmt_close($stmt);
+ mysqli_close($link);
+ print "done!";
?>
--EXPECT--
string(6) "foobar"
diff --git a/ext/mysqli/tests/017.phpt b/ext/mysqli/tests/017.phpt
index 7196ad48c6..0a1903abf8 100644
--- a/ext/mysqli/tests/017.phpt
+++ b/ext/mysqli/tests/017.phpt
@@ -8,28 +8,28 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- if (!$stmt = mysqli_prepare($link, "SELECT md5('bar'), database(), 'foo'"))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_prepare($link, "SELECT md5('bar'), database(), 'foo'"))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_stmt_bind_result($stmt, $c0, $c1, $c2);
- mysqli_stmt_execute($stmt);
+ mysqli_stmt_bind_result($stmt, $c0, $c1, $c2);
+ mysqli_stmt_execute($stmt);
- mysqli_stmt_fetch($stmt);
- mysqli_stmt_close($stmt);
+ mysqli_stmt_fetch($stmt);
+ mysqli_stmt_close($stmt);
- $test = array($c0, $c1, $c2);
- if ($c1 !== $db) {
- echo "Different data\n";
- }
+ $test = array($c0, $c1, $c2);
+ if ($c1 !== $db) {
+ echo "Different data\n";
+ }
- var_dump($test);
- mysqli_close($link);
- print "done!";
+ var_dump($test);
+ mysqli_close($link);
+ print "done!";
?>
--EXPECTF--
array(3) {
diff --git a/ext/mysqli/tests/018.phpt b/ext/mysqli/tests/018.phpt
index 8b3c960924..87a9746949 100644
--- a/ext/mysqli/tests/018.phpt
+++ b/ext/mysqli/tests/018.phpt
@@ -7,26 +7,26 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- if (!mysqli_query($link, "SET AUTOCOMMIT=0"))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "SET AUTOCOMMIT=0"))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$stmt = mysqli_prepare($link, "SELECT @@autocommit"))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_prepare($link, "SELECT @@autocommit"))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_stmt_bind_result($stmt, $c0);
- mysqli_stmt_execute($stmt);
+ mysqli_stmt_bind_result($stmt, $c0);
+ mysqli_stmt_execute($stmt);
- mysqli_stmt_fetch($stmt);
+ mysqli_stmt_fetch($stmt);
- var_dump($c0);
+ var_dump($c0);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--EXPECT--
int(0)
diff --git a/ext/mysqli/tests/019.phpt b/ext/mysqli/tests/019.phpt
index 4688ff9f8a..d35b162cd7 100644
--- a/ext/mysqli/tests/019.phpt
+++ b/ext/mysqli/tests/019.phpt
@@ -7,53 +7,53 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- if (!mysqli_query($link, "DROP TABLE IF EXISTS insert_read"))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS insert_read"))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $rc = mysqli_query($link,"CREATE TABLE insert_read(col1 tinyint, col2 smallint,
- col3 int, col4 bigint,
- col5 float, col6 double,
- col7 date, col8 time,
- col9 varbinary(10),
- col10 varchar(50),
- col11 char(20)) ENGINE=" . $engine);
- if (!$rc)
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $rc = mysqli_query($link,"CREATE TABLE insert_read(col1 tinyint, col2 smallint,
+ col3 int, col4 bigint,
+ col5 float, col6 double,
+ col7 date, col8 time,
+ col9 varbinary(10),
+ col10 varchar(50),
+ col11 char(20)) ENGINE=" . $engine);
+ if (!$rc)
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$stmt = mysqli_prepare($link, "INSERT INTO insert_read(col1,col10, col11, col6) VALUES (?,?,?,?)"))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_prepare($link, "INSERT INTO insert_read(col1,col10, col11, col6) VALUES (?,?,?,?)"))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_stmt_bind_param($stmt, "issd", $c1, $c2, $c3, $c4);
+ mysqli_stmt_bind_param($stmt, "issd", $c1, $c2, $c3, $c4);
- $c1 = 1;
- $c2 = "foo";
- $c3 = "foobar";
- $c4 = 3.14;
+ $c1 = 1;
+ $c2 = "foo";
+ $c3 = "foobar";
+ $c4 = 3.14;
- mysqli_stmt_execute($stmt);
- mysqli_stmt_close($stmt);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_close($stmt);
- if (!$stmt = mysqli_prepare($link, "SELECT col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11 FROM insert_read"))
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_prepare($link, "SELECT col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11 FROM insert_read"))
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8, $c9, $c10, $c11);
- mysqli_stmt_execute($stmt);
+ mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8, $c9, $c10, $c11);
+ mysqli_stmt_execute($stmt);
- mysqli_stmt_fetch($stmt);
+ mysqli_stmt_fetch($stmt);
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$c10,$c11);
+ $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$c10,$c11);
- var_dump($test);
+ var_dump($test);
- mysqli_stmt_close($stmt);
- mysqli_query($link, "DROP TABLE IF EXISTS insert_read");
- mysqli_close($link);
- print "done!";
+ mysqli_stmt_close($stmt);
+ mysqli_query($link, "DROP TABLE IF EXISTS insert_read");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/020.phpt b/ext/mysqli/tests/020.phpt
index 57016de4b8..f1409248c2 100644
--- a/ext/mysqli/tests/020.phpt
+++ b/ext/mysqli/tests/020.phpt
@@ -7,65 +7,65 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
- mysqli_query($link, "SET sql_mode=''");
+ mysqli_select_db($link, $db);
+ mysqli_query($link, "SET sql_mode=''");
- mysqli_query($link,"DROP TABLE IF EXISTS test_bind_result");
+ mysqli_query($link,"DROP TABLE IF EXISTS test_bind_result");
- $rc = @mysqli_query($link,"CREATE TABLE test_bind_result(
- c1 date,
- c2 time,
- c3 timestamp(14),
- c4 year,
- c5 datetime,
- c6 timestamp(4),
- c7 timestamp(6))");
+ $rc = @mysqli_query($link,"CREATE TABLE test_bind_result(
+ c1 date,
+ c2 time,
+ c3 timestamp(14),
+ c4 year,
+ c5 datetime,
+ c6 timestamp(4),
+ c7 timestamp(6))");
- if (!$rc)
- $rc = mysqli_query($link,"CREATE TABLE test_bind_result(
- c1 date,
- c2 time,
- c3 timestamp,
- c4 year,
- c5 datetime,
- c6 timestamp,
- c7 timestamp)");
+ if (!$rc)
+ $rc = mysqli_query($link,"CREATE TABLE test_bind_result(
+ c1 date,
+ c2 time,
+ c3 timestamp,
+ c4 year,
+ c5 datetime,
+ c6 timestamp,
+ c7 timestamp)");
- $stmt = mysqli_prepare($link, "INSERT INTO test_bind_result VALUES (?,?,?,?,?,?,?)");
- mysqli_stmt_bind_param($stmt, "sssssss", $d1, $d2, $d3, $d4, $d5, $d6, $d7);
+ $stmt = mysqli_prepare($link, "INSERT INTO test_bind_result VALUES (?,?,?,?,?,?,?)");
+ mysqli_stmt_bind_param($stmt, "sssssss", $d1, $d2, $d3, $d4, $d5, $d6, $d7);
- $d1 = "2002-01-02";
- $d2 = "12:49:00";
- $d3 = "2002-01-02 17:46:59";
- $d4 = "2010";
- $d5 = "2010-07-10";
- $d6 = "2020";
- $d7 = "1999-12-29";
+ $d1 = "2002-01-02";
+ $d2 = "12:49:00";
+ $d3 = "2002-01-02 17:46:59";
+ $d4 = "2010";
+ $d5 = "2010-07-10";
+ $d6 = "2020";
+ $d7 = "1999-12-29";
- mysqli_stmt_execute($stmt);
- mysqli_stmt_close($stmt);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_close($stmt);
- $stmt = mysqli_prepare($link, "SELECT c1, c2, c3, c4, c5, c6, c7 FROM test_bind_result");
+ $stmt = mysqli_prepare($link, "SELECT c1, c2, c3, c4, c5, c6, c7 FROM test_bind_result");
- mysqli_stmt_bind_result($stmt,$c1, $c2, $c3, $c4, $c5, $c6, $c7);
+ mysqli_stmt_bind_result($stmt,$c1, $c2, $c3, $c4, $c5, $c6, $c7);
- mysqli_stmt_execute($stmt);
- mysqli_stmt_fetch($stmt);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_fetch($stmt);
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
+ $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
- var_dump($test);
+ var_dump($test);
- mysqli_stmt_close($stmt);
- mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result");
- mysqli_close($link);
+ mysqli_stmt_close($stmt);
+ mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result");
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/021.phpt b/ext/mysqli/tests/021.phpt
index d9cf52eddc..3fa3b9a5cc 100644
--- a/ext/mysqli/tests/021.phpt
+++ b/ext/mysqli/tests/021.phpt
@@ -7,36 +7,36 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
+ mysqli_select_db($link, $db);
- mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2 text)");
+ mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2 text)");
- $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?)");
- mysqli_stmt_bind_param($stmt, "ss", $q1, $q2);
- $q1 = "1234567890";
- $q2 = "this is a test";
- mysqli_stmt_execute($stmt);
- mysqli_stmt_close($stmt);
+ $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?)");
+ mysqli_stmt_bind_param($stmt, "ss", $q1, $q2);
+ $q1 = "1234567890";
+ $q2 = "this is a test";
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_close($stmt);
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
- mysqli_stmt_bind_result($stmt, $c1, $c2);
- mysqli_stmt_execute($stmt);
- mysqli_stmt_fetch($stmt);
+ $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
+ mysqli_stmt_bind_result($stmt, $c1, $c2);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_fetch($stmt);
- $test = array($c1,$c2);
+ $test = array($c1,$c2);
- var_dump($test);
+ var_dump($test);
- mysqli_stmt_close($stmt);
- mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_close($link);
- print "done!";
+ mysqli_stmt_close($stmt);
+ mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/022.phpt b/ext/mysqli/tests/022.phpt
index fd8036fd1a..d12ba4aff9 100644
--- a/ext/mysqli/tests/022.phpt
+++ b/ext/mysqli/tests/022.phpt
@@ -7,41 +7,41 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
+ mysqli_select_db($link, $db);
- mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2 text)");
+ mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2 text)");
- $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?)");
- mysqli_stmt_bind_param($stmt, "ss", $a1, $a2);
+ $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?)");
+ mysqli_stmt_bind_param($stmt, "ss", $a1, $a2);
- $a1 = "1234567890";
- $a2 = str_repeat("A1", 32000);
+ $a1 = "1234567890";
+ $a2 = str_repeat("A1", 32000);
- mysqli_stmt_execute($stmt);
- mysqli_stmt_close($stmt);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_close($stmt);
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
- mysqli_stmt_bind_result($stmt, $c1, $c2);
- mysqli_stmt_execute($stmt);
- mysqli_stmt_fetch($stmt);
+ $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
+ mysqli_stmt_bind_result($stmt, $c1, $c2);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_fetch($stmt);
- $test[] = $c1;
- $test[] = ($a2 == $c2) ? "32K String ok" : "32K String failed";
+ $test[] = $c1;
+ $test[] = ($a2 == $c2) ? "32K String ok" : "32K String failed";
- var_dump($test);
+ var_dump($test);
- mysqli_stmt_close($stmt);
- mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_close($link);
+ mysqli_stmt_close($stmt);
+ mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/023.phpt b/ext/mysqli/tests/023.phpt
index 17a8abce77..7c22704d44 100644
--- a/ext/mysqli/tests/023.phpt
+++ b/ext/mysqli/tests/023.phpt
@@ -7,50 +7,50 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
- mysqli_query($link, "SET sql_mode=''");
+ mysqli_select_db($link, $db);
+ mysqli_query($link, "SET sql_mode=''");
- mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 int unsigned,
- c2 int unsigned,
- c3 int,
- c4 int,
- c5 int,
- c6 int unsigned,
- c7 int)");
+ mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 int unsigned,
+ c2 int unsigned,
+ c3 int,
+ c4 int,
+ c5 int,
+ c6 int unsigned,
+ c7 int)");
- $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?,?,?,?,?,?)");
- mysqli_stmt_bind_param($stmt, "iiiiiii", $c1,$c2,$c3,$c4,$c5,$c6,$c7);
- $c1 = -23;
- $c2 = 35999;
- $c3 = NULL;
- $c4 = -500;
- $c5 = -9999999;
- $c6 = -0;
- $c7 = 0;
+ $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?,?,?,?,?,?)");
+ mysqli_stmt_bind_param($stmt, "iiiiiii", $c1,$c2,$c3,$c4,$c5,$c6,$c7);
+ $c1 = -23;
+ $c2 = 35999;
+ $c3 = NULL;
+ $c4 = -500;
+ $c5 = -9999999;
+ $c6 = -0;
+ $c7 = 0;
- mysqli_stmt_execute($stmt);
- mysqli_stmt_close($stmt);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_close($stmt);
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
- mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
- mysqli_stmt_execute($stmt);
- mysqli_stmt_fetch($stmt);
+ $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
+ mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_fetch($stmt);
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
+ $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
- var_dump($test);
+ var_dump($test);
- mysqli_stmt_close($stmt);
- mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_close($link);
+ mysqli_stmt_close($stmt);
+ mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/024.phpt b/ext/mysqli/tests/024.phpt
index 5294a24883..5be231c27d 100644
--- a/ext/mysqli/tests/024.phpt
+++ b/ext/mysqli/tests/024.phpt
@@ -7,50 +7,50 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
- mysqli_query($link, "SET sql_mode=''");
+ mysqli_select_db($link, $db);
+ mysqli_query($link, "SET sql_mode=''");
- mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 smallint unsigned,
- c2 smallint unsigned,
- c3 smallint,
- c4 smallint,
- c5 smallint,
- c6 smallint unsigned,
- c7 smallint)");
+ mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 smallint unsigned,
+ c2 smallint unsigned,
+ c3 smallint,
+ c4 smallint,
+ c5 smallint,
+ c6 smallint unsigned,
+ c7 smallint)");
- $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?,?,?,?,?,?)");
- mysqli_stmt_bind_param($stmt, "iiiiiii", $c1,$c2,$c3,$c4,$c5,$c6,$c7);
+ $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?,?,?,?,?,?)");
+ mysqli_stmt_bind_param($stmt, "iiiiiii", $c1,$c2,$c3,$c4,$c5,$c6,$c7);
- $c1 = -23;
- $c2 = 35999;
- $c3 = NULL;
- $c4 = -500;
- $c5 = -9999999;
- $c6 = -0;
- $c7 = 0;
+ $c1 = -23;
+ $c2 = 35999;
+ $c3 = NULL;
+ $c4 = -500;
+ $c5 = -9999999;
+ $c6 = -0;
+ $c7 = 0;
- mysqli_stmt_execute($stmt);
- mysqli_stmt_close($stmt);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_close($stmt);
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
- mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
- mysqli_stmt_execute($stmt);
- mysqli_stmt_fetch($stmt);
+ $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
+ mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_fetch($stmt);
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
+ $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
- var_dump($test);
+ var_dump($test);
- mysqli_stmt_close($stmt);
- mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_close($link);
- print "done!";
+ mysqli_stmt_close($stmt);
+ mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/025.phpt b/ext/mysqli/tests/025.phpt
index 3b472f9513..6e300890d7 100644
--- a/ext/mysqli/tests/025.phpt
+++ b/ext/mysqli/tests/025.phpt
@@ -7,55 +7,55 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
- mysqli_query($link, "SET sql_mode=''");
+ mysqli_select_db($link, $db);
+ mysqli_query($link, "SET sql_mode=''");
- mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 tinyint,
- c2 tinyint unsigned,
- c3 tinyint not NULL,
- c4 tinyint,
- c5 tinyint,
- c6 tinyint unsigned,
- c7 tinyint)");
+ mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 tinyint,
+ c2 tinyint unsigned,
+ c3 tinyint not NULL,
+ c4 tinyint,
+ c5 tinyint,
+ c6 tinyint unsigned,
+ c7 tinyint)");
- $stmt = mysqli_prepare ($link, "INSERT INTO test_bind_fetch VALUES(?,?,?,?,?,?,?)");
- mysqli_stmt_bind_param($stmt, "iiiiiii", $c1,$c2,$c3,$c4,$c5,$c6,$c7);
+ $stmt = mysqli_prepare ($link, "INSERT INTO test_bind_fetch VALUES(?,?,?,?,?,?,?)");
+ mysqli_stmt_bind_param($stmt, "iiiiiii", $c1,$c2,$c3,$c4,$c5,$c6,$c7);
- $c1 = -23;
- $c2 = 300;
- $c3 = 0;
- $c4 = -100;
- $c5 = -127;
- $c6 = 30;
- $c7 = 0;
+ $c1 = -23;
+ $c2 = 300;
+ $c3 = 0;
+ $c4 = -100;
+ $c5 = -127;
+ $c6 = 30;
+ $c7 = 0;
- mysqli_stmt_execute($stmt);
- mysqli_stmt_close($stmt);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_close($stmt);
- mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,300,0,-100,-127,+30,0)");
+ mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,300,0,-100,-127,+30,0)");
- $c1 = $c2 = $c3 = $c4 = $c5 = $c6 = $c7 = NULL;
+ $c1 = $c2 = $c3 = $c4 = $c5 = $c6 = $c7 = NULL;
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
- mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
- mysqli_stmt_execute($stmt);
- mysqli_stmt_fetch($stmt);
+ $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
+ mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_fetch($stmt);
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
+ $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
- var_dump($test);
+ var_dump($test);
- mysqli_stmt_close($stmt);
- mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_close($link);
+ mysqli_stmt_close($stmt);
+ mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/026.phpt b/ext/mysqli/tests/026.phpt
index 51b2b774bb..1db5f5af84 100644
--- a/ext/mysqli/tests/026.phpt
+++ b/ext/mysqli/tests/026.phpt
@@ -7,42 +7,42 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
- mysqli_query($link, "SET sql_mode=''");
+ mysqli_select_db($link, $db);
+ mysqli_query($link, "SET sql_mode=''");
- mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 varchar(10), c2 text)");
+ mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 varchar(10), c2 text)");
- $stmt = mysqli_prepare ($link, "INSERT INTO test_bind_fetch VALUES (?,?)");
- mysqli_stmt_bind_param($stmt, "sb", $c1, $c2);
+ $stmt = mysqli_prepare ($link, "INSERT INTO test_bind_fetch VALUES (?,?)");
+ mysqli_stmt_bind_param($stmt, "sb", $c1, $c2);
- $c1 = "Hello World";
+ $c1 = "Hello World";
- mysqli_stmt_send_long_data($stmt, 1, "This is the first sentence.");
- mysqli_stmt_send_long_data($stmt, 1, " And this is the second sentence.");
- mysqli_stmt_send_long_data($stmt, 1, " And finally this is the last sentence.");
+ mysqli_stmt_send_long_data($stmt, 1, "This is the first sentence.");
+ mysqli_stmt_send_long_data($stmt, 1, " And this is the second sentence.");
+ mysqli_stmt_send_long_data($stmt, 1, " And finally this is the last sentence.");
- mysqli_stmt_execute($stmt);
- mysqli_stmt_close($stmt);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_close($stmt);
- $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
- mysqli_stmt_bind_result($stmt, $d1, $d2);
- mysqli_stmt_execute($stmt);
- mysqli_stmt_fetch($stmt);
+ $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
+ mysqli_stmt_bind_result($stmt, $d1, $d2);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_fetch($stmt);
- $test = array($d1,$d2);
+ $test = array($d1,$d2);
- var_dump($test);
+ var_dump($test);
- mysqli_stmt_close($stmt);
- mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_close($link);
- print "done!";
+ mysqli_stmt_close($stmt);
+ mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/027.phpt b/ext/mysqli/tests/027.phpt
index f4d985a744..918a6c4483 100644
--- a/ext/mysqli/tests/027.phpt
+++ b/ext/mysqli/tests/027.phpt
@@ -7,17 +7,17 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- $status = mysqli_stat($link);
+ $status = mysqli_stat($link);
- var_dump(strlen($status) > 0);
+ var_dump(strlen($status) > 0);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--EXPECT--
bool(true)
diff --git a/ext/mysqli/tests/028.phpt b/ext/mysqli/tests/028.phpt
index e8d3835374..9b71d4d3da 100644
--- a/ext/mysqli/tests/028.phpt
+++ b/ext/mysqli/tests/028.phpt
@@ -7,17 +7,17 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- $cset = substr(mysqli_character_set_name($link),0,6);
+ $cset = substr(mysqli_character_set_name($link),0,6);
- var_dump($cset);
+ var_dump($cset);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--EXPECTF--
string(%d) "%s"
diff --git a/ext/mysqli/tests/029.phpt b/ext/mysqli/tests/029.phpt
index cf59999eaf..0ed2517227 100644
--- a/ext/mysqli/tests/029.phpt
+++ b/ext/mysqli/tests/029.phpt
@@ -7,24 +7,24 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
+ mysqli_select_db($link, $db);
- mysqli_query($link, "DROP TABLE IF EXISTS general_test");
- mysqli_query($link, "CREATE TABLE general_test (a INT)");
- mysqli_query($link, "INSERT INTO general_test VALUES (1),(2),(3)");
+ mysqli_query($link, "DROP TABLE IF EXISTS general_test");
+ mysqli_query($link, "CREATE TABLE general_test (a INT)");
+ mysqli_query($link, "INSERT INTO general_test VALUES (1),(2),(3)");
- $afc = mysqli_affected_rows($link);
+ $afc = mysqli_affected_rows($link);
- var_dump($afc);
+ var_dump($afc);
- mysqli_query($link, "DROP TABLE IF EXISTS general_test");
- mysqli_close($link);
- print "done!";
+ mysqli_query($link, "DROP TABLE IF EXISTS general_test");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/030.phpt b/ext/mysqli/tests/030.phpt
index e51aec3734..5705a90f91 100644
--- a/ext/mysqli/tests/030.phpt
+++ b/ext/mysqli/tests/030.phpt
@@ -7,22 +7,22 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- $errno = mysqli_errno($link);
- var_dump($errno);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ $errno = mysqli_errno($link);
+ var_dump($errno);
- mysqli_select_db($link, $db);
+ mysqli_select_db($link, $db);
- mysqli_query($link, "SELECT * FROM non_exisiting_table");
- $errno = mysqli_errno($link);
+ mysqli_query($link, "SELECT * FROM non_exisiting_table");
+ $errno = mysqli_errno($link);
- var_dump($errno);
+ var_dump($errno);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--EXPECT--
int(0)
diff --git a/ext/mysqli/tests/031.phpt b/ext/mysqli/tests/031.phpt
index 8518b45a3e..e230e7974c 100644
--- a/ext/mysqli/tests/031.phpt
+++ b/ext/mysqli/tests/031.phpt
@@ -7,22 +7,22 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- $error = mysqli_error($link);
- var_dump($error);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ $error = mysqli_error($link);
+ var_dump($error);
- mysqli_select_db($link, $db);
+ mysqli_select_db($link, $db);
- mysqli_query($link, "SELECT * FROM non_exisiting_table");
- $error = mysqli_error($link);
+ mysqli_query($link, "SELECT * FROM non_exisiting_table");
+ $error = mysqli_error($link);
- var_dump($error);
+ var_dump($error);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--EXPECTF--
string(0) ""
diff --git a/ext/mysqli/tests/032.phpt b/ext/mysqli/tests/032.phpt
index 27d8fb3fa5..660950d6f1 100644
--- a/ext/mysqli/tests/032.phpt
+++ b/ext/mysqli/tests/032.phpt
@@ -7,24 +7,24 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
+ mysqli_select_db($link, $db);
- mysqli_query($link, "DROP TABLE IF EXISTS general_test");
- mysqli_query($link, "CREATE TABLE general_test (a INT)");
- mysqli_query($link, "INSERT INTO general_test VALUES (1),(2),(3)");
+ mysqli_query($link, "DROP TABLE IF EXISTS general_test");
+ mysqli_query($link, "CREATE TABLE general_test (a INT)");
+ mysqli_query($link, "INSERT INTO general_test VALUES (1),(2),(3)");
- $afc = mysqli_info($link);
+ $afc = mysqli_info($link);
- var_dump($afc);
+ var_dump($afc);
- mysqli_query($link, "DROP TABLE IF EXISTS general_test");
- mysqli_close($link);
- print "done!";
+ mysqli_query($link, "DROP TABLE IF EXISTS general_test");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/033.phpt b/ext/mysqli/tests/033.phpt
index 2ac4896432..b5c4e3046b 100644
--- a/ext/mysqli/tests/033.phpt
+++ b/ext/mysqli/tests/033.phpt
@@ -8,17 +8,17 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- $hinfo = mysqli_get_host_info($link);
+ $hinfo = mysqli_get_host_info($link);
- var_dump(str_replace('/','', $hinfo));
+ var_dump(str_replace('/','', $hinfo));
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--EXPECTF--
string(%d) "%s via %s"
diff --git a/ext/mysqli/tests/034.phpt b/ext/mysqli/tests/034.phpt
index 1eae37e1a5..f6e19ce551 100644
--- a/ext/mysqli/tests/034.phpt
+++ b/ext/mysqli/tests/034.phpt
@@ -8,17 +8,17 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- $pinfo = mysqli_get_proto_info($link);
+ $pinfo = mysqli_get_proto_info($link);
- var_dump($pinfo);
+ var_dump($pinfo);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--EXPECT--
int(10)
diff --git a/ext/mysqli/tests/035.phpt b/ext/mysqli/tests/035.phpt
index 8e755b9846..0f2421f629 100644
--- a/ext/mysqli/tests/035.phpt
+++ b/ext/mysqli/tests/035.phpt
@@ -7,17 +7,17 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- $sinfo = substr(mysqli_get_server_info($link),0,1);
+ $sinfo = substr(mysqli_get_server_info($link),0,1);
- var_dump(strlen($sinfo));
+ var_dump(strlen($sinfo));
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--EXPECT--
int(1)
diff --git a/ext/mysqli/tests/036.phpt b/ext/mysqli/tests/036.phpt
index 919625c8cd..af6d81d64e 100644
--- a/ext/mysqli/tests/036.phpt
+++ b/ext/mysqli/tests/036.phpt
@@ -11,36 +11,36 @@ function test: mysqli_insert_id()
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
+ mysqli_select_db($link, $db);
- mysqli_query($link, "DROP TABLE IF EXISTS t036");
- mysqli_query($link, "CREATE TABLE t036 (a bigint not null auto_increment primary key, b varchar(10)) ENGINE = " . $engine);
+ mysqli_query($link, "DROP TABLE IF EXISTS t036");
+ mysqli_query($link, "CREATE TABLE t036 (a bigint not null auto_increment primary key, b varchar(10)) ENGINE = " . $engine);
- mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo1')");
- $test[] = mysqli_insert_id($link);
+ mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo1')");
+ $test[] = mysqli_insert_id($link);
- /* we have to insert more values, cause lexer sets auto_increment to max_int
- see mysql bug #54. So we don't check for the value, only for type (which must
- be type string)
- */
+ /* we have to insert more values, cause lexer sets auto_increment to max_int
+ see mysql bug #54. So we don't check for the value, only for type (which must
+ be type string)
+ */
- mysqli_query($link, "ALTER TABLE t036 AUTO_INCREMENT=9999999999999998");
- mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo2')");
- mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo3')");
- mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo4')");
- $x = mysqli_insert_id($link);
- $test[] = is_string($x);
+ mysqli_query($link, "ALTER TABLE t036 AUTO_INCREMENT=9999999999999998");
+ mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo2')");
+ mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo3')");
+ mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo4')");
+ $x = mysqli_insert_id($link);
+ $test[] = is_string($x);
- var_dump($test);
+ var_dump($test);
- mysqli_query($link, "DROP TABLE IF EXISTS t036");
- mysqli_close($link);
- print "done!";
+ mysqli_query($link, "DROP TABLE IF EXISTS t036");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/037.phpt b/ext/mysqli/tests/037.phpt
index 5826a9834e..7c6f72cb69 100644
--- a/ext/mysqli/tests/037.phpt
+++ b/ext/mysqli/tests/037.phpt
@@ -8,29 +8,29 @@ require_once('skipifconnectfailure.inc');
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
+ mysqli_select_db($link, $db);
- mysqli_query($link, "DROP TABLE IF EXISTS test_result");
+ mysqli_query($link, "DROP TABLE IF EXISTS test_result");
- mysqli_query($link, "CREATE TABLE test_result (a int, b varchar(10)) ENGINE = " . $engine);
+ mysqli_query($link, "CREATE TABLE test_result (a int, b varchar(10)) ENGINE = " . $engine);
- mysqli_query($link, "INSERT INTO test_result VALUES (1, 'foo')");
- $ir[] = mysqli_field_count($link);
+ mysqli_query($link, "INSERT INTO test_result VALUES (1, 'foo')");
+ $ir[] = mysqli_field_count($link);
- mysqli_real_query($link, "SELECT * FROM test_result");
- $ir[] = mysqli_field_count($link);
+ mysqli_real_query($link, "SELECT * FROM test_result");
+ $ir[] = mysqli_field_count($link);
- var_dump($ir);
+ var_dump($ir);
- mysqli_query($link, "DROP TABLE IF EXISTS test_result");
- mysqli_close($link);
- print "done!";
+ mysqli_query($link, "DROP TABLE IF EXISTS test_result");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/038.phpt b/ext/mysqli/tests/038.phpt
index 45b724ca3c..63d7e3ee32 100644
--- a/ext/mysqli/tests/038.phpt
+++ b/ext/mysqli/tests/038.phpt
@@ -7,30 +7,30 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
+ mysqli_select_db($link, $db);
- mysqli_query($link, "DROP TABLE IF EXISTS test_result");
+ mysqli_query($link, "DROP TABLE IF EXISTS test_result");
- mysqli_query($link, "CREATE TABLE test_result (a int, b varchar(10)) ENGINE = " . $engine);
+ mysqli_query($link, "CREATE TABLE test_result (a int, b varchar(10)) ENGINE = " . $engine);
- mysqli_query($link, "INSERT INTO test_result VALUES (1, 'foo')");
+ mysqli_query($link, "INSERT INTO test_result VALUES (1, 'foo')");
- mysqli_real_query($link, "SELECT * FROM test_result");
- if (mysqli_field_count($link)) {
- $result = mysqli_store_result($link);
- $num = mysqli_num_fields($result);
- mysqli_free_result($result);
- }
+ mysqli_real_query($link, "SELECT * FROM test_result");
+ if (mysqli_field_count($link)) {
+ $result = mysqli_store_result($link);
+ $num = mysqli_num_fields($result);
+ mysqli_free_result($result);
+ }
- var_dump($num);
+ var_dump($num);
- mysqli_query($link, "DROP TABLE IF EXISTS test_result");
- mysqli_close($link);
+ mysqli_query($link, "DROP TABLE IF EXISTS test_result");
+ mysqli_close($link);
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/039.phpt b/ext/mysqli/tests/039.phpt
index bde6460d97..186811660d 100644
--- a/ext/mysqli/tests/039.phpt
+++ b/ext/mysqli/tests/039.phpt
@@ -7,23 +7,23 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_real_query($link, "SHOW VARIABLES");
+ mysqli_real_query($link, "SHOW VARIABLES");
- if (mysqli_field_count($link)) {
- $result = mysqli_store_result($link);
- $num = mysqli_num_fields($result);
- mysqli_free_result($result);
- }
+ if (mysqli_field_count($link)) {
+ $result = mysqli_store_result($link);
+ $num = mysqli_num_fields($result);
+ mysqli_free_result($result);
+ }
- var_dump($num);
+ var_dump($num);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--EXPECT--
int(2)
diff --git a/ext/mysqli/tests/040.phpt b/ext/mysqli/tests/040.phpt
index a860f30d81..782cbe57ad 100644
--- a/ext/mysqli/tests/040.phpt
+++ b/ext/mysqli/tests/040.phpt
@@ -7,29 +7,29 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
+ mysqli_select_db($link, $db);
- mysqli_query($link, "DROP TABLE IF EXISTS test_result");
- mysqli_query($link, "CREATE TABLE test_result (a int, b varchar(10)) ENGINE=" . $engine);
- mysqli_query($link, "INSERT INTO test_result VALUES (1, 'foo')");
+ mysqli_query($link, "DROP TABLE IF EXISTS test_result");
+ mysqli_query($link, "CREATE TABLE test_result (a int, b varchar(10)) ENGINE=" . $engine);
+ mysqli_query($link, "INSERT INTO test_result VALUES (1, 'foo')");
- mysqli_real_query($link, "SELECT * FROM test_result");
- if (mysqli_field_count($link)) {
- $result = mysqli_store_result($link);
- $num = mysqli_num_rows($result);
- mysqli_free_result($result);
- }
+ mysqli_real_query($link, "SELECT * FROM test_result");
+ if (mysqli_field_count($link)) {
+ $result = mysqli_store_result($link);
+ $num = mysqli_num_rows($result);
+ mysqli_free_result($result);
+ }
- var_dump($num);
+ var_dump($num);
- mysqli_query($link, "DROP TABLE IF EXISTS test_result");
- mysqli_close($link);
- print "done!";
+ mysqli_query($link, "DROP TABLE IF EXISTS test_result");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/041.phpt b/ext/mysqli/tests/041.phpt
index 86ddd67069..645a82e419 100644
--- a/ext/mysqli/tests/041.phpt
+++ b/ext/mysqli/tests/041.phpt
@@ -8,19 +8,19 @@ require_once('skipifconnectfailure.inc');
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ mysqli_select_db($link, $db);
- mysqli_query($link, "DROP TABLE IF EXISTS test_warnings");
- mysqli_query($link, "DROP TABLE IF EXISTS test_warnings");
+ mysqli_query($link, "DROP TABLE IF EXISTS test_warnings");
+ mysqli_query($link, "DROP TABLE IF EXISTS test_warnings");
- var_dump(mysqli_warning_count($link));
+ var_dump(mysqli_warning_count($link));
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/042.phpt b/ext/mysqli/tests/042.phpt
index e84dfc2a10..8b46049cb8 100644
--- a/ext/mysqli/tests/042.phpt
+++ b/ext/mysqli/tests/042.phpt
@@ -7,46 +7,46 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
- mysqli_query($link, "SET sql_mode=''");
+ mysqli_select_db($link, $db);
+ mysqli_query($link, "SET sql_mode=''");
- mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 smallint unsigned,
- c2 smallint unsigned,
- c3 smallint,
- c4 smallint,
- c5 smallint,
- c6 smallint unsigned,
- c7 smallint) ENGINE=" . $engine);
+ mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 smallint unsigned,
+ c2 smallint unsigned,
+ c3 smallint,
+ c4 smallint,
+ c5 smallint,
+ c6 smallint unsigned,
+ c7 smallint) ENGINE=" . $engine);
- $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?,?,?,?,?,?)");
- mysqli_stmt_bind_param($stmt, "iiiiiii", $c1,$c2,$c3,$c4,$c5,$c6,$c7);
+ $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?,?,?,?,?,?)");
+ mysqli_stmt_bind_param($stmt, "iiiiiii", $c1,$c2,$c3,$c4,$c5,$c6,$c7);
- $c1 = -23;
- $c2 = 35999;
- $c3 = NULL;
- $c4 = -500;
- $c5 = -9999999;
- $c6 = -0;
- $c7 = 0;
+ $c1 = -23;
+ $c2 = 35999;
+ $c3 = NULL;
+ $c4 = -500;
+ $c5 = -9999999;
+ $c6 = -0;
+ $c7 = 0;
- mysqli_stmt_execute($stmt);
- mysqli_stmt_close($stmt);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_close($stmt);
- $result = mysqli_query($link, "SELECT * FROM test_bind_fetch");
- $test = mysqli_fetch_object($result);
- mysqli_free_result($result);
+ $result = mysqli_query($link, "SELECT * FROM test_bind_fetch");
+ $test = mysqli_fetch_object($result);
+ mysqli_free_result($result);
- var_dump($test);
+ var_dump($test);
- mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
- mysqli_close($link);
- print "done!"
+ mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
+ mysqli_close($link);
+ print "done!"
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/043.phpt b/ext/mysqli/tests/043.phpt
index daf79ebbe4..2e265d7c51 100644
--- a/ext/mysqli/tests/043.phpt
+++ b/ext/mysqli/tests/043.phpt
@@ -7,38 +7,38 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
+ mysqli_select_db($link, $db);
- mysqli_query($link,"DROP TABLE IF EXISTS test_update");
- mysqli_query($link,"CREATE TABLE test_update(a varchar(10),
- b int) ENGINE=" . $engine);
+ mysqli_query($link,"DROP TABLE IF EXISTS test_update");
+ mysqli_query($link,"CREATE TABLE test_update(a varchar(10),
+ b int) ENGINE=" . $engine);
- mysqli_query($link, "INSERT INTO test_update VALUES ('foo', 2)");
+ mysqli_query($link, "INSERT INTO test_update VALUES ('foo', 2)");
- $stmt = mysqli_prepare($link, "UPDATE test_update SET a=?,b=? WHERE b=?");
- mysqli_stmt_bind_param($stmt, "sii", $c1, $c2, $c3);
+ $stmt = mysqli_prepare($link, "UPDATE test_update SET a=?,b=? WHERE b=?");
+ mysqli_stmt_bind_param($stmt, "sii", $c1, $c2, $c3);
- $c1 = "Rasmus";
- $c2 = 1;
- $c3 = 2;
+ $c1 = "Rasmus";
+ $c2 = 1;
+ $c3 = 2;
- mysqli_stmt_execute($stmt);
- mysqli_stmt_close($stmt);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_close($stmt);
- $result = mysqli_query($link, "SELECT concat(a, ' is No. ', b) FROM test_update");
- $test = mysqli_fetch_row($result);
- mysqli_free_result($result);
+ $result = mysqli_query($link, "SELECT concat(a, ' is No. ', b) FROM test_update");
+ $test = mysqli_fetch_row($result);
+ mysqli_free_result($result);
- var_dump($test);
+ var_dump($test);
- mysqli_query($link, "DROP TABLE IF EXISTS test_update");
- mysqli_close($link);
- print "done!";
+ mysqli_query($link, "DROP TABLE IF EXISTS test_update");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/044.phpt b/ext/mysqli/tests/044.phpt
index 7dbbbb20a2..91d93d7482 100644
--- a/ext/mysqli/tests/044.phpt
+++ b/ext/mysqli/tests/044.phpt
@@ -7,19 +7,19 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- $i = mysqli_get_server_version($link);
+ $i = mysqli_get_server_version($link);
- $test = $i / $i;
+ $test = $i / $i;
- var_dump($test);
+ var_dump($test);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--EXPECT--
int(1)
diff --git a/ext/mysqli/tests/045.phpt b/ext/mysqli/tests/045.phpt
index 0b7b68239c..10773ace1b 100644
--- a/ext/mysqli/tests/045.phpt
+++ b/ext/mysqli/tests/045.phpt
@@ -20,23 +20,23 @@ mysqli_stmt_bind_result (SHOW)
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- $stmt = mysqli_prepare($link, "SHOW VARIABLES LIKE 'port'");
- mysqli_stmt_execute($stmt);
+ $stmt = mysqli_prepare($link, "SHOW VARIABLES LIKE 'port'");
+ mysqli_stmt_execute($stmt);
- mysqli_stmt_bind_result($stmt, $c1, $c2);
- mysqli_stmt_fetch($stmt);
- mysqli_stmt_close($stmt);
- $test = array ($c1,$c2);
+ mysqli_stmt_bind_result($stmt, $c1, $c2);
+ mysqli_stmt_fetch($stmt);
+ mysqli_stmt_close($stmt);
+ $test = array ($c1,$c2);
- var_dump($test);
+ var_dump($test);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--EXPECTF--
array(2) {
diff --git a/ext/mysqli/tests/046.phpt b/ext/mysqli/tests/046.phpt
index 8e4b8c3b2c..0a64386db2 100644
--- a/ext/mysqli/tests/046.phpt
+++ b/ext/mysqli/tests/046.phpt
@@ -7,32 +7,32 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
+ mysqli_select_db($link, $db);
- mysqli_query($link, "DROP TABLE IF EXISTS test_affected");
- mysqli_query($link, "CREATE TABLE test_affected (foo int) ENGINE=" . $engine);
+ mysqli_query($link, "DROP TABLE IF EXISTS test_affected");
+ mysqli_query($link, "CREATE TABLE test_affected (foo int) ENGINE=" . $engine);
- mysqli_query($link, "INSERT INTO test_affected VALUES (1),(2),(3),(4),(5)");
+ mysqli_query($link, "INSERT INTO test_affected VALUES (1),(2),(3),(4),(5)");
- $stmt = mysqli_prepare($link, "DELETE FROM test_affected WHERE foo=?");
- mysqli_stmt_bind_param($stmt, "i", $c1);
+ $stmt = mysqli_prepare($link, "DELETE FROM test_affected WHERE foo=?");
+ mysqli_stmt_bind_param($stmt, "i", $c1);
- $c1 = 2;
+ $c1 = 2;
- mysqli_stmt_execute($stmt);
- $x = mysqli_stmt_affected_rows($stmt);
+ mysqli_stmt_execute($stmt);
+ $x = mysqli_stmt_affected_rows($stmt);
- mysqli_stmt_close($stmt);
- var_dump($x==1);
+ mysqli_stmt_close($stmt);
+ var_dump($x==1);
- mysqli_query($link, "DROP TABLE IF EXISTS test_affected");
- mysqli_close($link);
- print "done!";
+ mysqli_query($link, "DROP TABLE IF EXISTS test_affected");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/047.phpt b/ext/mysqli/tests/047.phpt
index a89488fa58..4a2c9590cf 100644
--- a/ext/mysqli/tests/047.phpt
+++ b/ext/mysqli/tests/047.phpt
@@ -7,43 +7,43 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
+ mysqli_select_db($link, $db);
- mysqli_query($link, "DROP TABLE IF EXISTS test_affected");
- mysqli_query($link, "CREATE TABLE test_affected (foo int, bar varchar(10) character set latin1) ENGINE=" . $engine);
+ mysqli_query($link, "DROP TABLE IF EXISTS test_affected");
+ mysqli_query($link, "CREATE TABLE test_affected (foo int, bar varchar(10) character set latin1) ENGINE=" . $engine);
- mysqli_query($link, "INSERT INTO test_affected VALUES (1, 'Zak'),(2, 'Greant')");
+ mysqli_query($link, "INSERT INTO test_affected VALUES (1, 'Zak'),(2, 'Greant')");
- $stmt = mysqli_prepare($link, "SELECT * FROM test_affected");
- mysqli_stmt_execute($stmt);
- $result = mysqli_stmt_result_metadata($stmt);
+ $stmt = mysqli_prepare($link, "SELECT * FROM test_affected");
+ mysqli_stmt_execute($stmt);
+ $result = mysqli_stmt_result_metadata($stmt);
- echo "\n=== fetch_fields ===\n";
- var_dump(mysqli_fetch_fields($result));
+ echo "\n=== fetch_fields ===\n";
+ var_dump(mysqli_fetch_fields($result));
- echo "\n=== fetch_field_direct ===\n";
- var_dump(mysqli_fetch_field_direct($result, 0));
- var_dump(mysqli_fetch_field_direct($result, 1));
+ echo "\n=== fetch_field_direct ===\n";
+ var_dump(mysqli_fetch_field_direct($result, 0));
+ var_dump(mysqli_fetch_field_direct($result, 1));
- echo "\n=== fetch_field ===\n";
- while ($field = mysqli_fetch_field($result)) {
- var_dump($field);
- }
+ echo "\n=== fetch_field ===\n";
+ while ($field = mysqli_fetch_field($result)) {
+ var_dump($field);
+ }
- print_r(mysqli_fetch_lengths($result));
+ print_r(mysqli_fetch_lengths($result));
- mysqli_free_result($result);
+ mysqli_free_result($result);
- mysqli_stmt_close($stmt);
- mysqli_query($link, "DROP TABLE IF EXISTS test_affected");
- mysqli_close($link);
- print "done!";
+ mysqli_stmt_close($stmt);
+ mysqli_query($link, "DROP TABLE IF EXISTS test_affected");
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/048.phpt b/ext/mysqli/tests/048.phpt
index 9328e0e282..20271e43fb 100644
--- a/ext/mysqli/tests/048.phpt
+++ b/ext/mysqli/tests/048.phpt
@@ -7,38 +7,38 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $mysql = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $mysql = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- $mysql->select_db($db);
- $mysql->query("DROP TABLE IF EXISTS test_fetch_null");
+ $mysql->select_db($db);
+ $mysql->query("DROP TABLE IF EXISTS test_fetch_null");
- $mysql->query("CREATE TABLE test_fetch_null(col1 tinyint, col2 smallint,
- col3 int, col4 bigint,
- col5 float, col6 double,
- col7 date, col8 time,
- col9 varbinary(10),
- col10 varchar(50),
- col11 char(20)) ENGINE=" . $engine);
+ $mysql->query("CREATE TABLE test_fetch_null(col1 tinyint, col2 smallint,
+ col3 int, col4 bigint,
+ col5 float, col6 double,
+ col7 date, col8 time,
+ col9 varbinary(10),
+ col10 varchar(50),
+ col11 char(20)) ENGINE=" . $engine);
- $mysql->query("INSERT INTO test_fetch_null(col1,col10, col11) VALUES(1,'foo1', 1000),(2,'foo2', 88),(3,'foo3', 389789)");
+ $mysql->query("INSERT INTO test_fetch_null(col1,col10, col11) VALUES(1,'foo1', 1000),(2,'foo2', 88),(3,'foo3', 389789)");
- $stmt = $mysql->prepare("SELECT col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11 from test_fetch_null");
- $stmt->bind_result($c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8, $c9, $c10, $c11);
- $stmt->execute();
+ $stmt = $mysql->prepare("SELECT col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11 from test_fetch_null");
+ $stmt->bind_result($c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8, $c9, $c10, $c11);
+ $stmt->execute();
- $stmt->fetch();
+ $stmt->fetch();
- $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$c10,$c11);
+ $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$c10,$c11);
- var_dump($test);
+ var_dump($test);
- $stmt->close();
- $mysql->query("DROP TABLE IF EXISTS test_fetch_null");
- $mysql->close();
- print "done!";
+ $stmt->close();
+ $mysql->query("DROP TABLE IF EXISTS test_fetch_null");
+ $mysql->close();
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/049.phpt b/ext/mysqli/tests/049.phpt
index 7128de8d38..733518609f 100644
--- a/ext/mysqli/tests/049.phpt
+++ b/ext/mysqli/tests/049.phpt
@@ -8,22 +8,22 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $mysql = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $mysql = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- $mysql->select_db($db);
- $result = $mysql->query("SELECT DATABASE()");
- $row = $result->fetch_row();
- $result->close();
+ $mysql->select_db($db);
+ $result = $mysql->query("SELECT DATABASE()");
+ $row = $result->fetch_row();
+ $result->close();
- var_dump($row);
- if ($row[0] != $db)
- printf("[001] Expecting '%s' got '%s'\n", $db, $row[0]);
+ var_dump($row);
+ if ($row[0] != $db)
+ printf("[001] Expecting '%s' got '%s'\n", $db, $row[0]);
- $mysql->close();
- print "done!";
+ $mysql->close();
+ print "done!";
?>
--EXPECTF--
array(1) {
diff --git a/ext/mysqli/tests/050.phpt b/ext/mysqli/tests/050.phpt
index 448f164be1..c51c7bc1d2 100644
--- a/ext/mysqli/tests/050.phpt
+++ b/ext/mysqli/tests/050.phpt
@@ -7,18 +7,18 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /************************
- * non freed stamement
- ************************/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /************************
+ * non freed stamement
+ ************************/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- $stmt = mysqli_prepare($link, "SELECT CURRENT_USER()");
- mysqli_stmt_execute($stmt);
+ $stmt = mysqli_prepare($link, "SELECT CURRENT_USER()");
+ mysqli_stmt_execute($stmt);
- mysqli_close($link);
- printf("Ok\n");
+ mysqli_close($link);
+ printf("Ok\n");
?>
--EXPECT--
Ok
diff --git a/ext/mysqli/tests/051.phpt b/ext/mysqli/tests/051.phpt
index 4a766fb34d..239f8cbcf0 100644
--- a/ext/mysqli/tests/051.phpt
+++ b/ext/mysqli/tests/051.phpt
@@ -7,19 +7,19 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /************************
- * free statement after close
- ************************/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /************************
+ * free statement after close
+ ************************/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- $stmt1 = mysqli_prepare($link, "SELECT CURRENT_USER()");
- mysqli_stmt_execute($stmt1);
+ $stmt1 = mysqli_prepare($link, "SELECT CURRENT_USER()");
+ mysqli_stmt_execute($stmt1);
- mysqli_close($link);
- @mysqli_stmt_close($stmt1);
- printf("Ok\n");
+ mysqli_close($link);
+ @mysqli_stmt_close($stmt1);
+ printf("Ok\n");
?>
--EXPECT--
Ok
diff --git a/ext/mysqli/tests/052.phpt b/ext/mysqli/tests/052.phpt
index 1d131f1428..e079bc508b 100644
--- a/ext/mysqli/tests/052.phpt
+++ b/ext/mysqli/tests/052.phpt
@@ -7,19 +7,19 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /************************
- * statement call after close
- ************************/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /************************
+ * statement call after close
+ ************************/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- $stmt2 = mysqli_prepare($link, "SELECT CURRENT_USER()");
+ $stmt2 = mysqli_prepare($link, "SELECT CURRENT_USER()");
- mysqli_close($link);
- @mysqli_stmt_execute($stmt2);
- @mysqli_stmt_close($stmt2);
- printf("Ok\n");
+ mysqli_close($link);
+ @mysqli_stmt_execute($stmt2);
+ @mysqli_stmt_close($stmt2);
+ printf("Ok\n");
?>
--EXPECT--
Ok
diff --git a/ext/mysqli/tests/053.phpt b/ext/mysqli/tests/053.phpt
index a1840c9726..4aac61514a 100644
--- a/ext/mysqli/tests/053.phpt
+++ b/ext/mysqli/tests/053.phpt
@@ -7,16 +7,16 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /************************
- * non freed resultset
- ************************/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /************************
+ * non freed resultset
+ ************************/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- $result = mysqli_query($link, "SELECT CURRENT_USER()");
- mysqli_close($link);
- printf("Ok\n");
+ $result = mysqli_query($link, "SELECT CURRENT_USER()");
+ mysqli_close($link);
+ printf("Ok\n");
?>
--EXPECT--
diff --git a/ext/mysqli/tests/054.phpt b/ext/mysqli/tests/054.phpt
index 6bd45a7c4b..b06d5edc3a 100644
--- a/ext/mysqli/tests/054.phpt
+++ b/ext/mysqli/tests/054.phpt
@@ -7,17 +7,17 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /************************
- * free resultset after close
- ************************/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /************************
+ * free resultset after close
+ ************************/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- $result1 = mysqli_query($link, "SELECT CURRENT_USER()");
- mysqli_close($link);
- mysqli_free_result($result1);
- printf("Ok\n");
+ $result1 = mysqli_query($link, "SELECT CURRENT_USER()");
+ mysqli_close($link);
+ mysqli_free_result($result1);
+ printf("Ok\n");
?>
--EXPECT--
Ok
diff --git a/ext/mysqli/tests/055.phpt b/ext/mysqli/tests/055.phpt
index c73266e748..7b6339afaf 100644
--- a/ext/mysqli/tests/055.phpt
+++ b/ext/mysqli/tests/055.phpt
@@ -7,16 +7,16 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /************************
- * don't free anything
- ************************/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /************************
+ * don't free anything
+ ************************/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- $result2 = mysqli_query($link, "SELECT CURRENT_USER()");
- $stmt2 = mysqli_prepare($link, "SELECT CURRENT_USER()");
- printf("Ok\n");
+ $result2 = mysqli_query($link, "SELECT CURRENT_USER()");
+ $stmt2 = mysqli_prepare($link, "SELECT CURRENT_USER()");
+ printf("Ok\n");
?>
--EXPECT--
Ok
diff --git a/ext/mysqli/tests/056.phpt b/ext/mysqli/tests/056.phpt
index 413e678987..9bb3a0eba9 100644
--- a/ext/mysqli/tests/056.phpt
+++ b/ext/mysqli/tests/056.phpt
@@ -7,18 +7,18 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- class foobar extends mysqli {
- function test () {
- return ("I do not like MySQL 4.1");
- }
- }
+ class foobar extends mysqli {
+ function test () {
+ return ("I do not like MySQL 4.1");
+ }
+ }
- $foo = new foobar();
- $foo->connect($host, $user, $passwd, $db, $port, $socket);
- $foo->close();
- printf("%s\n", $foo->test());
+ $foo = new foobar();
+ $foo->connect($host, $user, $passwd, $db, $port, $socket);
+ $foo->close();
+ printf("%s\n", $foo->test());
?>
--EXPECT--
I do not like MySQL 4.1
diff --git a/ext/mysqli/tests/057.phpt b/ext/mysqli/tests/057.phpt
index f4b60ecd4f..7c4f149c48 100644
--- a/ext/mysqli/tests/057.phpt
+++ b/ext/mysqli/tests/057.phpt
@@ -7,60 +7,59 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
+ mysqli_select_db($link, $db);
- mysqli_query($link,"DROP TABLE IF EXISTS test_store_result");
- mysqli_query($link,"CREATE TABLE test_store_result (a int)");
+ mysqli_query($link,"DROP TABLE IF EXISTS test_store_result");
+ mysqli_query($link,"CREATE TABLE test_store_result (a int)");
- mysqli_query($link, "INSERT INTO test_store_result VALUES (1),(2),(3)");
+ mysqli_query($link, "INSERT INTO test_store_result VALUES (1),(2),(3)");
- $stmt = mysqli_prepare($link, "SELECT * FROM test_store_result");
- mysqli_stmt_execute($stmt);
+ $stmt = mysqli_prepare($link, "SELECT * FROM test_store_result");
+ mysqli_stmt_execute($stmt);
- /* this should produce an out of sync error */
- if ($result = mysqli_query($link, "SELECT * FROM test_store_result")) {
- mysqli_free_result($result);
- printf ("Query ok\n");
- }
- mysqli_stmt_close($stmt);
+ /* this should produce an out of sync error */
+ if ($result = mysqli_query($link, "SELECT * FROM test_store_result")) {
+ mysqli_free_result($result);
+ printf ("Query ok\n");
+ }
+ mysqli_stmt_close($stmt);
- /* now we should try mysqli_stmt_reset() */
- $stmt = mysqli_prepare($link, "SELECT * FROM test_store_result");
- var_dump(mysqli_stmt_execute($stmt));
- var_dump(mysqli_stmt_reset($stmt));
+ /* now we should try mysqli_stmt_reset() */
+ $stmt = mysqli_prepare($link, "SELECT * FROM test_store_result");
+ var_dump(mysqli_stmt_execute($stmt));
+ var_dump(mysqli_stmt_reset($stmt));
- var_dump($stmt = mysqli_prepare($link, "SELECT * FROM test_store_result"));
- if ($stmt->affected_rows !== 0)
- printf("[001] Expecting 0, got %d\n", $stmt->affected_rows);
+ var_dump($stmt = mysqli_prepare($link, "SELECT * FROM test_store_result"));
+ if ($stmt->affected_rows !== 0)
+ printf("[001] Expecting 0, got %d\n", $stmt->affected_rows);
- var_dump(mysqli_stmt_execute($stmt));
- var_dump($stmt = @mysqli_prepare($link, "SELECT * FROM test_store_result"), mysqli_error($link));
- var_dump(mysqli_stmt_reset($stmt));
+ var_dump(mysqli_stmt_execute($stmt));
+ var_dump($stmt = @mysqli_prepare($link, "SELECT * FROM test_store_result"), mysqli_error($link));
- $stmt = mysqli_prepare($link, "SELECT * FROM test_store_result");
- mysqli_stmt_execute($stmt);
- $result1 = mysqli_stmt_result_metadata($stmt);
- mysqli_stmt_store_result($stmt);
+ $stmt = mysqli_prepare($link, "SELECT * FROM test_store_result");
+ mysqli_stmt_execute($stmt);
+ $result1 = mysqli_stmt_result_metadata($stmt);
+ mysqli_stmt_store_result($stmt);
- printf ("Rows: %d\n", mysqli_stmt_affected_rows($stmt));
+ printf ("Rows: %d\n", mysqli_stmt_affected_rows($stmt));
- /* this should show an error, cause results are not buffered */
- if ($result = mysqli_query($link, "SELECT * FROM test_store_result")) {
- $row = mysqli_fetch_row($result);
- mysqli_free_result($result);
- }
+ /* this should show an error, cause results are not buffered */
+ if ($result = mysqli_query($link, "SELECT * FROM test_store_result")) {
+ $row = mysqli_fetch_row($result);
+ mysqli_free_result($result);
+ }
- var_dump($row);
+ var_dump($row);
- mysqli_free_result($result1);
- mysqli_stmt_close($stmt);
- mysqli_close($link);
- echo "done!";
+ mysqli_free_result($result1);
+ mysqli_stmt_close($stmt);
+ mysqli_close($link);
+ echo "done!";
?>
--CLEAN--
<?php
@@ -102,9 +101,6 @@ object(mysqli_stmt)#%d (%d) {
bool(true)
bool(false)
string(0) ""
-
-Warning: mysqli_stmt_reset() expects parameter 1 to be mysqli_stmt, bool given in %s on line %d
-NULL
Rows: 3
array(1) {
[0]=>
diff --git a/ext/mysqli/tests/058.phpt b/ext/mysqli/tests/058.phpt
index e839e7e64e..596b28569e 100644
--- a/ext/mysqli/tests/058.phpt
+++ b/ext/mysqli/tests/058.phpt
@@ -7,46 +7,46 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
+ mysqli_select_db($link, $db);
- mysqli_query($link,"DROP TABLE IF EXISTS mbind");
- mysqli_query($link,"CREATE TABLE mbind (a int, b varchar(10))");
+ mysqli_query($link,"DROP TABLE IF EXISTS mbind");
+ mysqli_query($link,"CREATE TABLE mbind (a int, b varchar(10))");
- $stmt = mysqli_prepare($link, "INSERT INTO mbind VALUES (?,?)");
+ $stmt = mysqli_prepare($link, "INSERT INTO mbind VALUES (?,?)");
- mysqli_stmt_bind_param($stmt, "is", $a, $b);
+ mysqli_stmt_bind_param($stmt, "is", $a, $b);
- $a = 1;
- $b = "foo";
+ $a = 1;
+ $b = "foo";
- mysqli_stmt_execute($stmt);
+ mysqli_stmt_execute($stmt);
- mysqli_stmt_bind_param($stmt, "is", $c, $d);
+ mysqli_stmt_bind_param($stmt, "is", $c, $d);
- $c = 2;
- $d = "bar";
+ $c = 2;
+ $d = "bar";
- mysqli_stmt_execute($stmt);
- mysqli_stmt_close($stmt);
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_close($stmt);
- $stmt = mysqli_prepare($link, "SELECT * FROM mbind");
- mysqli_stmt_execute($stmt);
+ $stmt = mysqli_prepare($link, "SELECT * FROM mbind");
+ mysqli_stmt_execute($stmt);
- mysqli_stmt_bind_result($stmt, $e, $f);
- mysqli_stmt_fetch($stmt);
+ mysqli_stmt_bind_result($stmt, $e, $f);
+ mysqli_stmt_fetch($stmt);
- mysqli_stmt_bind_result($stmt, $g, $h);
- mysqli_stmt_fetch($stmt);
+ mysqli_stmt_bind_result($stmt, $g, $h);
+ mysqli_stmt_fetch($stmt);
- var_dump((array($e,$f,$g,$h)));
+ var_dump((array($e,$f,$g,$h)));
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/059.phpt b/ext/mysqli/tests/059.phpt
index 0632553143..c7f3877201 100644
--- a/ext/mysqli/tests/059.phpt
+++ b/ext/mysqli/tests/059.phpt
@@ -7,39 +7,39 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
+ mysqli_select_db($link, $db);
- mysqli_query($link, "SET SQL_MODE='PIPES_AS_CONCAT'");
+ mysqli_query($link, "SET SQL_MODE='PIPES_AS_CONCAT'");
- mysqli_query($link,"DROP TABLE IF EXISTS mbind");
- mysqli_query($link,"CREATE TABLE mbind (b varchar(25))");
+ mysqli_query($link,"DROP TABLE IF EXISTS mbind");
+ mysqli_query($link,"CREATE TABLE mbind (b varchar(25))");
- $stmt = mysqli_prepare($link, "INSERT INTO mbind VALUES (?||?)");
+ $stmt = mysqli_prepare($link, "INSERT INTO mbind VALUES (?||?)");
- mysqli_stmt_bind_param($stmt, "ss", $a, $b);
+ mysqli_stmt_bind_param($stmt, "ss", $a, $b);
- $a = "foo";
- $b = "bar";
+ $a = "foo";
+ $b = "bar";
- mysqli_stmt_execute($stmt);
+ mysqli_stmt_execute($stmt);
- mysqli_stmt_close($stmt);
+ mysqli_stmt_close($stmt);
- $stmt = mysqli_prepare($link, "SELECT * FROM mbind");
- mysqli_stmt_execute($stmt);
+ $stmt = mysqli_prepare($link, "SELECT * FROM mbind");
+ mysqli_stmt_execute($stmt);
- mysqli_stmt_bind_result($stmt, $e);
- mysqli_stmt_fetch($stmt);
+ mysqli_stmt_bind_result($stmt, $e);
+ mysqli_stmt_fetch($stmt);
- var_dump($e);
+ var_dump($e);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/060.phpt b/ext/mysqli/tests/060.phpt
index 9043dd7def..22732f4ef1 100644
--- a/ext/mysqli/tests/060.phpt
+++ b/ext/mysqli/tests/060.phpt
@@ -7,40 +7,40 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- class test_class {
- function __construct($arg1, $arg2) {
- echo __METHOD__ . "($arg1,$arg2)\n";
- }
- }
+ class test_class {
+ function __construct($arg1, $arg2) {
+ echo __METHOD__ . "($arg1,$arg2)\n";
+ }
+ }
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, $db);
- mysqli_query($link, "SET sql_mode=''");
+ mysqli_select_db($link, $db);
+ mysqli_query($link, "SET sql_mode=''");
- mysqli_query($link,"DROP TABLE IF EXISTS test_fetch");
- mysqli_query($link,"CREATE TABLE test_fetch(c1 smallint unsigned,
- c2 smallint unsigned,
- c3 smallint,
- c4 smallint,
- c5 smallint,
- c6 smallint unsigned,
- c7 smallint)");
+ mysqli_query($link,"DROP TABLE IF EXISTS test_fetch");
+ mysqli_query($link,"CREATE TABLE test_fetch(c1 smallint unsigned,
+ c2 smallint unsigned,
+ c3 smallint,
+ c4 smallint,
+ c5 smallint,
+ c6 smallint unsigned,
+ c7 smallint)");
- mysqli_query($link, "INSERT INTO test_fetch VALUES ( -23, 35999, NULL, -500, -9999999, -0, 0)");
+ mysqli_query($link, "INSERT INTO test_fetch VALUES ( -23, 35999, NULL, -500, -9999999, -0, 0)");
- $result = mysqli_query($link, "SELECT * FROM test_fetch");
- $test = mysqli_fetch_object($result, 'test_class', array(1, 2));
- mysqli_free_result($result);
+ $result = mysqli_query($link, "SELECT * FROM test_fetch");
+ $test = mysqli_fetch_object($result, 'test_class', array(1, 2));
+ mysqli_free_result($result);
- var_dump($test);
+ var_dump($test);
- mysqli_close($link);
+ mysqli_close($link);
- echo "Done\n";
+ echo "Done\n";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/061.phpt b/ext/mysqli/tests/061.phpt
index 0da9c1c09d..0b15b2ea85 100644
--- a/ext/mysqli/tests/061.phpt
+++ b/ext/mysqli/tests/061.phpt
@@ -21,45 +21,45 @@ mysqli_close($link);
mysqli.allow_local_infile=1
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- function my_read($fp, &$buffer, $buflen, &$error) {
- $buffer = strrev(fread($fp, $buflen));
- return(strlen($buffer));
- }
+ function my_read($fp, &$buffer, $buflen, &$error) {
+ $buffer = strrev(fread($fp, $buflen));
+ return(strlen($buffer));
+ }
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- /* create temporary file */
- $filename = __DIR__ . "061.csv";
- $fp = fopen($filename, "w");
- fwrite($fp, "foo;bar");
- fclose($fp);
+ /* create temporary file */
+ $filename = __DIR__ . "061.csv";
+ $fp = fopen($filename, "w");
+ fwrite($fp, "foo;bar");
+ fclose($fp);
- if (!mysqli_query($link,"DROP TABLE IF EXISTS t_061"))
- printf("Cannot drop table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link,"CREATE TABLE t_061 (c1 varchar(10), c2 varchar(10))"))
- printf("Cannot create table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link,"DROP TABLE IF EXISTS t_061"))
+ printf("Cannot drop table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link,"CREATE TABLE t_061 (c1 varchar(10), c2 varchar(10))"))
+ printf("Cannot create table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s' INTO TABLE t_061 FIELDS TERMINATED BY ';'", mysqli_real_escape_string($link, $filename))))
- printf("Cannot load data: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s' INTO TABLE t_061 FIELDS TERMINATED BY ';'", mysqli_real_escape_string($link, $filename))))
+ printf("Cannot load data: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_set_local_infile_handler($link, "my_read");
- if (!mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s' INTO TABLE t_061 FIELDS TERMINATED BY ';'", mysqli_real_escape_string($link, $filename))))
- printf("Cannot load data using infile handler: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_set_local_infile_handler($link, "my_read");
+ if (!mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s' INTO TABLE t_061 FIELDS TERMINATED BY ';'", mysqli_real_escape_string($link, $filename))))
+ printf("Cannot load data using infile handler: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if ($result = mysqli_query($link, "SELECT c1,c2 FROM t_061")) {
- while (($row = mysqli_fetch_row($result))) {
- printf("%s-%s\n", $row[0], $row[1]);
- printf("%s-%s\n", gettype($row[0]), gettype($row[1]));
- }
- mysqli_free_result($result);
- }
+ if ($result = mysqli_query($link, "SELECT c1,c2 FROM t_061")) {
+ while (($row = mysqli_fetch_row($result))) {
+ printf("%s-%s\n", $row[0], $row[1]);
+ printf("%s-%s\n", gettype($row[0]), gettype($row[1]));
+ }
+ mysqli_free_result($result);
+ }
- mysqli_close($link);
- unlink($filename);
- print "done!";
+ mysqli_close($link);
+ unlink($filename);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/062.phpt b/ext/mysqli/tests/062.phpt
index b10485d5a2..60472eb16e 100644
--- a/ext/mysqli/tests/062.phpt
+++ b/ext/mysqli/tests/062.phpt
@@ -7,20 +7,20 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
- $mysql->real_query("SELECT 'foo' FROM DUAL");
+ $mysql->real_query("SELECT 'foo' FROM DUAL");
- $myresult = new mysqli_result($mysql);
+ $myresult = new mysqli_result($mysql);
- $row = $myresult->fetch_row();
- $myresult->close();
- $mysql->close();
+ $row = $myresult->fetch_row();
+ $myresult->close();
+ $mysql->close();
- var_dump($row);
- print "done!";
+ var_dump($row);
+ print "done!";
?>
--EXPECT--
array(1) {
diff --git a/ext/mysqli/tests/063.phpt b/ext/mysqli/tests/063.phpt
index b1d5314278..26bfe48ee5 100644
--- a/ext/mysqli/tests/063.phpt
+++ b/ext/mysqli/tests/063.phpt
@@ -7,18 +7,18 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
- $stmt = new mysqli_stmt($mysql, "SELECT 'foo' FROM DUAL");
- $stmt->execute();
- $stmt->bind_result($foo);
- $stmt->fetch();
- $stmt->close();
- $mysql->close();
+ $stmt = new mysqli_stmt($mysql, "SELECT 'foo' FROM DUAL");
+ $stmt->execute();
+ $stmt->bind_result($foo);
+ $stmt->fetch();
+ $stmt->close();
+ $mysql->close();
- var_dump($foo);
+ var_dump($foo);
?>
--EXPECT--
string(3) "foo"
diff --git a/ext/mysqli/tests/064.phpt b/ext/mysqli/tests/064.phpt
index 46af7a6628..b2280ff426 100644
--- a/ext/mysqli/tests/064.phpt
+++ b/ext/mysqli/tests/064.phpt
@@ -7,18 +7,18 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
- $stmt = new mysqli_stmt($mysql, "SELECT NULL FROM DUAL");
- $stmt->execute();
- $stmt->bind_result($foo);
- $stmt->fetch();
- $stmt->close();
- $mysql->close();
+ $stmt = new mysqli_stmt($mysql, "SELECT NULL FROM DUAL");
+ $stmt->execute();
+ $stmt->bind_result($foo);
+ $stmt->fetch();
+ $stmt->close();
+ $mysql->close();
- var_dump($foo);
+ var_dump($foo);
?>
--EXPECT--
NULL
diff --git a/ext/mysqli/tests/065.phpt b/ext/mysqli/tests/065.phpt
index 75c4b02a29..2733cdafb0 100644
--- a/ext/mysqli/tests/065.phpt
+++ b/ext/mysqli/tests/065.phpt
@@ -11,42 +11,42 @@ if (!function_exists('mysqli_set_charset')) {
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!$mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ if (!$mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- if (!mysqli_query($mysql, "SET sql_mode=''"))
- printf("[002] Cannot set SQL-Mode, [%d] %s\n", mysqli_errno($mysql), mysqli_error($mysql));
+ if (!mysqli_query($mysql, "SET sql_mode=''"))
+ printf("[002] Cannot set SQL-Mode, [%d] %s\n", mysqli_errno($mysql), mysqli_error($mysql));
- $esc_str = chr(0xbf) . chr(0x5c);
- $len = $charset = array();
- $tmp = null;
+ $esc_str = chr(0xbf) . chr(0x5c);
+ $len = $charset = array();
+ $tmp = null;
- if ($mysql->set_charset("latin1")) {
- /* 5C should be escaped */
- if (3 !== ($tmp = strlen($mysql->real_escape_string($esc_str))))
- printf("[003] Expecting 3/int got %s/%s\n", gettype($tmp), $tmp);
+ if ($mysql->set_charset("latin1")) {
+ /* 5C should be escaped */
+ if (3 !== ($tmp = strlen($mysql->real_escape_string($esc_str))))
+ printf("[003] Expecting 3/int got %s/%s\n", gettype($tmp), $tmp);
- if ('latin1' !== ($tmp = $mysql->character_set_name()))
- printf("[004] Expecting latin1/string got %s/%s\n", gettype($tmp), $tmp);
- }
+ if ('latin1' !== ($tmp = $mysql->character_set_name()))
+ printf("[004] Expecting latin1/string got %s/%s\n", gettype($tmp), $tmp);
+ }
- if ($res = $mysql->query("SHOW CHARACTER SET LIKE 'gbk'")) {
- $res->free_result();
- if ($mysql->set_charset("gbk")) {
- /* nothing should be escaped, it's a valid gbk character */
+ if ($res = $mysql->query("SHOW CHARACTER SET LIKE 'gbk'")) {
+ $res->free_result();
+ if ($mysql->set_charset("gbk")) {
+ /* nothing should be escaped, it's a valid gbk character */
- if (2 !== ($tmp = strlen($mysql->real_escape_string($esc_str))))
- printf("[005] Expecting 2/int got %s/%s\n", gettype($tmp), $tmp);
+ if (2 !== ($tmp = strlen($mysql->real_escape_string($esc_str))))
+ printf("[005] Expecting 2/int got %s/%s\n", gettype($tmp), $tmp);
- if ('gbk' !== ($tmp = $mysql->character_set_name()))
- printf("[005] Expecting gbk/string got %s/%s\n", gettype($tmp), $tmp);
- }
- }
- $mysql->close();
+ if ('gbk' !== ($tmp = $mysql->character_set_name()))
+ printf("[005] Expecting gbk/string got %s/%s\n", gettype($tmp), $tmp);
+ }
+ }
+ $mysql->close();
- print "done!";
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/066.phpt b/ext/mysqli/tests/066.phpt
index a337e038c1..678457e934 100644
--- a/ext/mysqli/tests/066.phpt
+++ b/ext/mysqli/tests/066.phpt
@@ -7,28 +7,28 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
- if (!mysqli_query($mysql, "SET sql_mode=''"))
- printf("[002] Cannot set SQL-Mode, [%d] %s\n", mysqli_errno($mysql), mysqli_error($mysql));
+ if (!mysqli_query($mysql, "SET sql_mode=''"))
+ printf("[002] Cannot set SQL-Mode, [%d] %s\n", mysqli_errno($mysql), mysqli_error($mysql));
- $mysql->query("DROP TABLE IF EXISTS test_warnings");
+ $mysql->query("DROP TABLE IF EXISTS test_warnings");
- $mysql->query("CREATE TABLE test_warnings (a int not null) ENGINE=myisam");
+ $mysql->query("CREATE TABLE test_warnings (a int not null) ENGINE=myisam");
- $mysql->query("INSERT INTO test_warnings VALUES (1),(2),(NULL)");
+ $mysql->query("INSERT INTO test_warnings VALUES (1),(2),(NULL)");
- if (($warning = $mysql->get_warnings())) {
- do {
- printf("Warning\n");
- } while ($warning->next());
- }
+ if (($warning = $mysql->get_warnings())) {
+ do {
+ printf("Warning\n");
+ } while ($warning->next());
+ }
- $mysql->close();
- print "done!";
+ $mysql->close();
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/067.phpt b/ext/mysqli/tests/067.phpt
index e36993bb6b..8698b94c94 100644
--- a/ext/mysqli/tests/067.phpt
+++ b/ext/mysqli/tests/067.phpt
@@ -19,50 +19,50 @@ function test: nested selects (cursors)
?>
--FILE--
<?php
- function open_cursor($mysql, $query) {
- if (!is_object($stmt = $mysql->prepare($query))) {
- printf("[001] Cannot create statement object for '%s', [%d] %s\n",
- $query, $mysql->errno, $mysql->error);
- }
+ function open_cursor($mysql, $query) {
+ if (!is_object($stmt = $mysql->prepare($query))) {
+ printf("[001] Cannot create statement object for '%s', [%d] %s\n",
+ $query, $mysql->errno, $mysql->error);
+ }
- $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_READ_ONLY);
- return $stmt;
- }
+ $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_READ_ONLY);
+ return $stmt;
+ }
- require_once("connect.inc");
- $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ require_once("connect.inc");
+ $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
- if ((!$IS_MYSQLND && mysqli_get_client_version() < 50009) ||
- (mysqli_get_server_version($mysql) < 50009)) {
- /* we really want to skip it... */
- die(var_dump(63));
- }
+ if ((!$IS_MYSQLND && mysqli_get_client_version() < 50009) ||
+ (mysqli_get_server_version($mysql) < 50009)) {
+ /* we really want to skip it... */
+ die(var_dump(63));
+ }
- $a = array();
+ $a = array();
- for ($i=0;$i < 3; $i++) {
- $mysql->query("DROP TABLE IF EXISTS cursor$i");
- $mysql->query("CREATE TABLE cursor$i (a int not null) ENGINE=" . $engine);
- $mysql->query("INSERT INTO cursor$i VALUES (1),(2),(3),(4),(5),(6)");
- $stmt[$i] = open_cursor($mysql, "SELECT a FROM cursor$i");
- $stmt[$i]->execute();
- $stmt[$i]->bind_result($a[$i]);
- }
+ for ($i=0;$i < 3; $i++) {
+ $mysql->query("DROP TABLE IF EXISTS cursor$i");
+ $mysql->query("CREATE TABLE cursor$i (a int not null) ENGINE=" . $engine);
+ $mysql->query("INSERT INTO cursor$i VALUES (1),(2),(3),(4),(5),(6)");
+ $stmt[$i] = open_cursor($mysql, "SELECT a FROM cursor$i");
+ $stmt[$i]->execute();
+ $stmt[$i]->bind_result($a[$i]);
+ }
- $cnt = 0;
- while ($stmt[0]->fetch()) {
- $stmt[1]->fetch();
- $stmt[2]->fetch();
- $cnt += $a[0] + $a[1] + $a[2];
- }
+ $cnt = 0;
+ while ($stmt[0]->fetch()) {
+ $stmt[1]->fetch();
+ $stmt[2]->fetch();
+ $cnt += $a[0] + $a[1] + $a[2];
+ }
- for ($i=0; $i < 3; $i++) {
- $stmt[$i]->close();
- }
+ for ($i=0; $i < 3; $i++) {
+ $stmt[$i]->close();
+ }
- $mysql->close();
- var_dump($cnt);
+ $mysql->close();
+ var_dump($cnt);
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/068.phpt b/ext/mysqli/tests/068.phpt
index 17160f78f1..24a4255483 100644
--- a/ext/mysqli/tests/068.phpt
+++ b/ext/mysqli/tests/068.phpt
@@ -4,8 +4,8 @@ mysqli get_client_info
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
- $s = mysqli_get_client_info();
- echo gettype($s);
+ $s = mysqli_get_client_info();
+ echo gettype($s);
?>
--EXPECT--
string
diff --git a/ext/mysqli/tests/069.phpt b/ext/mysqli/tests/069.phpt
index 29ed2fd94a..9f1d0b447e 100644
--- a/ext/mysqli/tests/069.phpt
+++ b/ext/mysqli/tests/069.phpt
@@ -7,24 +7,24 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
- $mysql->multi_query('SELECT 1;SELECT 2');
- do {
- $res = $mysql->store_result();
- if ($mysql->errno == 0) {
- while ($arr = $res->fetch_assoc()) {
- var_dump($arr);
- }
- $res->free();
- }
- if (!$mysql->more_results()) {
- break;
- }
- } while (@$mysql->next_result());
- $mysql->close();
- print "done!";
+ $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ $mysql->multi_query('SELECT 1;SELECT 2');
+ do {
+ $res = $mysql->store_result();
+ if ($mysql->errno == 0) {
+ while ($arr = $res->fetch_assoc()) {
+ var_dump($arr);
+ }
+ $res->free();
+ }
+ if (!$mysql->more_results()) {
+ break;
+ }
+ } while (@$mysql->next_result());
+ $mysql->close();
+ print "done!";
?>
--EXPECT--
array(1) {
diff --git a/ext/mysqli/tests/070.phpt b/ext/mysqli/tests/070.phpt
index 6452d6ab78..a9832815da 100644
--- a/ext/mysqli/tests/070.phpt
+++ b/ext/mysqli/tests/070.phpt
@@ -7,12 +7,12 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
- var_dump($mysql->ping());
- $mysql->close();
- print "done!";
+ $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ var_dump($mysql->ping());
+ $mysql->close();
+ print "done!";
?>
--EXPECT--
bool(true)
diff --git a/ext/mysqli/tests/071.phpt b/ext/mysqli/tests/071.phpt
index 48b719c629..0a1e4ce62e 100644
--- a/ext/mysqli/tests/071.phpt
+++ b/ext/mysqli/tests/071.phpt
@@ -8,63 +8,63 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
- $version = $mysql->server_version;
+ $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ $version = $mysql->server_version;
- var_dump($mysql->ping());
+ var_dump($mysql->ping());
- $ret = $mysql->kill($mysql->thread_id);
- if ($IS_MYSQLND) {
- if ($ret !== true){
- printf("[001] Expecting boolean/true got %s/%s\n", gettype($ret), var_export($ret, true));
- }
- } else {
- /* libmysql return value seems to depend on server version */
- if ((($version >= 50123) || ($version <= 40200)) && $version != 50200) {
- /* TODO: find exact version */
- if ($ret !== true){
- printf("[001] Expecting boolean/true got %s/%s @\n", gettype($ret), var_export($ret, true), $version);
- }
- } else {
- if ($ret !== false){
- printf("[001] Expecting boolean/false got %s/%s @\n", gettype($ret), var_export($ret, true), $version);
- }
- }
- }
+ $ret = $mysql->kill($mysql->thread_id);
+ if ($IS_MYSQLND) {
+ if ($ret !== true){
+ printf("[001] Expecting boolean/true got %s/%s\n", gettype($ret), var_export($ret, true));
+ }
+ } else {
+ /* libmysql return value seems to depend on server version */
+ if ((($version >= 50123) || ($version <= 40200)) && $version != 50200) {
+ /* TODO: find exact version */
+ if ($ret !== true){
+ printf("[001] Expecting boolean/true got %s/%s @\n", gettype($ret), var_export($ret, true), $version);
+ }
+ } else {
+ if ($ret !== false){
+ printf("[001] Expecting boolean/false got %s/%s @\n", gettype($ret), var_export($ret, true), $version);
+ }
+ }
+ }
- var_dump($mysql->ping());
+ var_dump($mysql->ping());
- $mysql->close();
+ $mysql->close();
- $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
- var_dump(mysqli_ping($mysql));
+ var_dump(mysqli_ping($mysql));
- $ret = $mysql->kill($mysql->thread_id);
- if ($IS_MYSQLND) {
- if ($ret !== true){
- printf("[002] Expecting boolean/true got %s/%s\n", gettype($ret), var_export($ret, true));
- }
- } else {
- /* libmysql return value seems to depend on server version */
- if ((($version >= 50123) || ($version <= 40200)) && $version != 50200) {
- /* TODO: find exact version */
- if ($ret !== true){
- printf("[002] Expecting boolean/true got %s/%s @\n", gettype($ret), var_export($ret, true), $version);
- }
- } else {
- if ($ret !== false){
- printf("[002] Expecting boolean/false got %s/%s @\n", gettype($ret), var_export($ret, true), $version);
- }
- }
- }
+ $ret = $mysql->kill($mysql->thread_id);
+ if ($IS_MYSQLND) {
+ if ($ret !== true){
+ printf("[002] Expecting boolean/true got %s/%s\n", gettype($ret), var_export($ret, true));
+ }
+ } else {
+ /* libmysql return value seems to depend on server version */
+ if ((($version >= 50123) || ($version <= 40200)) && $version != 50200) {
+ /* TODO: find exact version */
+ if ($ret !== true){
+ printf("[002] Expecting boolean/true got %s/%s @\n", gettype($ret), var_export($ret, true), $version);
+ }
+ } else {
+ if ($ret !== false){
+ printf("[002] Expecting boolean/false got %s/%s @\n", gettype($ret), var_export($ret, true), $version);
+ }
+ }
+ }
- var_dump(mysqli_ping($mysql));
+ var_dump(mysqli_ping($mysql));
- $mysql->close();
- print "done!";
+ $mysql->close();
+ print "done!";
?>
--EXPECT--
bool(true)
diff --git a/ext/mysqli/tests/072.phpt b/ext/mysqli/tests/072.phpt
index 997469d39c..cb4ff60a86 100644
--- a/ext/mysqli/tests/072.phpt
+++ b/ext/mysqli/tests/072.phpt
@@ -7,22 +7,22 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
- $mysql->query("DROP TABLE IF EXISTS not_exists");
+ $mysql->query("DROP TABLE IF EXISTS not_exists");
- var_dump($mysql->warning_count);
+ var_dump($mysql->warning_count);
- $w = $mysql->get_warnings();
+ $w = $mysql->get_warnings();
- var_dump($w->errno);
- var_dump($w->message);
- var_dump($w->sqlstate);
+ var_dump($w->errno);
+ var_dump($w->message);
+ var_dump($w->sqlstate);
- $mysql->close();
- echo "done!"
+ $mysql->close();
+ echo "done!"
?>
--EXPECTF--
int(1)
diff --git a/ext/mysqli/tests/073.phpt b/ext/mysqli/tests/073.phpt
index 86e54ffc93..09156532d8 100644
--- a/ext/mysqli/tests/073.phpt
+++ b/ext/mysqli/tests/073.phpt
@@ -4,15 +4,15 @@ mysqli_driver properties
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- var_dump($driver->embedded);
- var_dump($driver->client_version);
- var_dump($driver->client_info);
- var_dump($driver->driver_version);
- var_dump($driver->reconnect);
- var_dump($driver->report_mode);
- print "done!";
+ var_dump($driver->embedded);
+ var_dump($driver->client_version);
+ var_dump($driver->client_info);
+ var_dump($driver->driver_version);
+ var_dump($driver->reconnect);
+ var_dump($driver->report_mode);
+ print "done!";
?>
--EXPECTF--
bool(%s)
diff --git a/ext/mysqli/tests/074.phpt b/ext/mysqli/tests/074.phpt
index a10f11136b..3f1271130f 100644
--- a/ext/mysqli/tests/074.phpt
+++ b/ext/mysqli/tests/074.phpt
@@ -8,17 +8,17 @@ require_once('skipifconnectfailure.inc');
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ $mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
- var_dump($mysqli->autocommit(false));
- $result = $mysqli->query("SELECT @@autocommit");
- var_dump($result->fetch_row());
+ var_dump($mysqli->autocommit(false));
+ $result = $mysqli->query("SELECT @@autocommit");
+ var_dump($result->fetch_row());
- var_dump($mysqli->autocommit(true));
- $result = $mysqli->query("SELECT @@autocommit");
- var_dump($result->fetch_row());
+ var_dump($mysqli->autocommit(true));
+ $result = $mysqli->query("SELECT @@autocommit");
+ var_dump($result->fetch_row());
?>
--EXPECT--
diff --git a/ext/mysqli/tests/bug28817.phpt b/ext/mysqli/tests/bug28817.phpt
index 1837048517..41c201c589 100644
--- a/ext/mysqli/tests/bug28817.phpt
+++ b/ext/mysqli/tests/bug28817.phpt
@@ -7,29 +7,33 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- class my_mysql extends mysqli {
- public $p_test;
+ class my_mysql extends mysqli {
+ public $p_test;
- function __construct() {
- $this->p_test[] = "foo";
- $this->p_test[] = "bar";
- }
- }
+ function __construct() {
+ $this->p_test[] = "foo";
+ $this->p_test[] = "bar";
+ }
+ }
- $mysql = new my_mysql();
+ $mysql = new my_mysql();
- var_dump($mysql->p_test);
- var_dump($mysql->errno);
+ var_dump($mysql->p_test);
+ try {
+ $mysql->errno;
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- $mysql->connect($host, $user, $passwd, $db, $port, $socket);
- $mysql->select_db("nonexistingdb");
+ $mysql->connect($host, $user, $passwd, $db, $port, $socket);
+ $mysql->select_db("nonexistingdb");
- var_dump($mysql->errno > 0);
+ var_dump($mysql->errno > 0);
- $mysql->close();
+ $mysql->close();
?>
--EXPECTF--
array(2) {
@@ -38,7 +42,5 @@ array(2) {
[1]=>
%s(3) "bar"
}
-
-Warning: main(): Couldn't fetch my_mysql in %s on line %d
-bool(false)
+my_mysql object is already closed
bool(true)
diff --git a/ext/mysqli/tests/bug29311.phpt b/ext/mysqli/tests/bug29311.phpt
index cfd5235e2b..a5808418bf 100644
--- a/ext/mysqli/tests/bug29311.phpt
+++ b/ext/mysqli/tests/bug29311.phpt
@@ -7,45 +7,45 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
-
- /* class 1 calls parent constructor */
- class mysql1 extends mysqli {
- function __construct() {
- global $host, $user, $passwd, $db, $port, $socket;
- parent::__construct($host, $user, $passwd, $db, $port, $socket);
- }
- }
-
- /* class 2 has an own constructor */
- class mysql2 extends mysqli {
-
- function __construct() {
- global $host, $user, $passwd, $db, $port, $socket;
- $this->connect($host, $user, $passwd, $db, $port, $socket);
- }
- }
-
- /* class 3 has no constructor */
- class mysql3 extends mysqli {
-
- }
-
- $foo[0] = new mysql1();
- $foo[1] = new mysql2();
- $foo[2] = new mysql3($host, $user, $passwd, $db, $port, $socket);
-
-
- for ($i=0; $i < 3; $i++) {
- if (($result = $foo[$i]->query("SELECT DATABASE()"))) {
- $row = $result->fetch_row();
- if ($row[0] != $db)
- printf("%d: %s\n", $i, $row[0]);
- $result->close();
- }
- $foo[$i]->close();
- }
- print "done!";
+ require_once("connect.inc");
+
+ /* class 1 calls parent constructor */
+ class mysql1 extends mysqli {
+ function __construct() {
+ global $host, $user, $passwd, $db, $port, $socket;
+ parent::__construct($host, $user, $passwd, $db, $port, $socket);
+ }
+ }
+
+ /* class 2 has an own constructor */
+ class mysql2 extends mysqli {
+
+ function __construct() {
+ global $host, $user, $passwd, $db, $port, $socket;
+ $this->connect($host, $user, $passwd, $db, $port, $socket);
+ }
+ }
+
+ /* class 3 has no constructor */
+ class mysql3 extends mysqli {
+
+ }
+
+ $foo[0] = new mysql1();
+ $foo[1] = new mysql2();
+ $foo[2] = new mysql3($host, $user, $passwd, $db, $port, $socket);
+
+
+ for ($i=0; $i < 3; $i++) {
+ if (($result = $foo[$i]->query("SELECT DATABASE()"))) {
+ $row = $result->fetch_row();
+ if ($row[0] != $db)
+ printf("%d: %s\n", $i, $row[0]);
+ $result->close();
+ }
+ $foo[$i]->close();
+ }
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/bug30967.phpt b/ext/mysqli/tests/bug30967.phpt
index 9af81ea12a..9e68a0caec 100644
--- a/ext/mysqli/tests/bug30967.phpt
+++ b/ext/mysqli/tests/bug30967.phpt
@@ -7,20 +7,20 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- class mysql1 extends mysqli {
- }
+ class mysql1 extends mysqli {
+ }
- class mysql2 extends mysql1 {
- }
+ class mysql2 extends mysql1 {
+ }
- $mysql = new mysql2($host, $user, $passwd, $db, $port, $socket);
+ $mysql = new mysql2($host, $user, $passwd, $db, $port, $socket);
- $mysql->query("THIS DOES NOT WORK");
- printf("%d\n", $mysql->errno);
+ $mysql->query("THIS DOES NOT WORK");
+ printf("%d\n", $mysql->errno);
- $mysql->close();
+ $mysql->close();
?>
--EXPECT--
1064
diff --git a/ext/mysqli/tests/bug31141.phpt b/ext/mysqli/tests/bug31141.phpt
index 71834742a9..9894896dd5 100644
--- a/ext/mysqli/tests/bug31141.phpt
+++ b/ext/mysqli/tests/bug31141.phpt
@@ -6,13 +6,13 @@ Bug #31141 (properties declared in the class extending MySQLi are not available)
<?php
class Test extends mysqli
{
- public $test = array();
+ public $test = array();
- function foo()
- {
- $ar_test = array("foo", "bar");
- $this->test = &$ar_test;
- }
+ function foo()
+ {
+ $ar_test = array("foo", "bar");
+ $this->test = &$ar_test;
+ }
}
$my_test = new Test;
diff --git a/ext/mysqli/tests/bug31668.phpt b/ext/mysqli/tests/bug31668.phpt
index 40bf357b6a..1dad169cc8 100644
--- a/ext/mysqli/tests/bug31668.phpt
+++ b/ext/mysqli/tests/bug31668.phpt
@@ -7,34 +7,34 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
- $mysql->multi_query('SELECT 1;SELECT 2');
- do {
- $res = $mysql->store_result();
- if ($mysql->errno == 0) {
- while ($arr = $res->fetch_assoc()) {
- var_dump($arr);
- }
- $res->free();
- }
- } while ($mysql->next_result());
- var_dump($mysql->error, __LINE__);
- $mysql->close();
+ $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ $mysql->multi_query('SELECT 1;SELECT 2');
+ do {
+ $res = $mysql->store_result();
+ if ($mysql->errno == 0) {
+ while ($arr = $res->fetch_assoc()) {
+ var_dump($arr);
+ }
+ $res->free();
+ }
+ } while ($mysql->next_result());
+ var_dump($mysql->error, __LINE__);
+ $mysql->close();
- $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
- $mysql->multi_query('SELECT 1;SELECT 2');
- do {
- $res = $mysql->store_result();
- if ($mysql->errno == 0) {
- while ($arr = $res->fetch_assoc()) {
- var_dump($arr);
- }
- $res->free();
- }
- } while ($mysql->next_result());
- var_dump($mysql->error, __LINE__);
+ $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ $mysql->multi_query('SELECT 1;SELECT 2');
+ do {
+ $res = $mysql->store_result();
+ if ($mysql->errno == 0) {
+ while ($arr = $res->fetch_assoc()) {
+ var_dump($arr);
+ }
+ $res->free();
+ }
+ } while ($mysql->next_result());
+ var_dump($mysql->error, __LINE__);
?>
--EXPECTF--
array(1) {
diff --git a/ext/mysqli/tests/bug32405.phpt b/ext/mysqli/tests/bug32405.phpt
index 0b3cad50ff..974ad87b78 100644
--- a/ext/mysqli/tests/bug32405.phpt
+++ b/ext/mysqli/tests/bug32405.phpt
@@ -7,29 +7,29 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_select_db($link, "test");
- mysqli_query($link, "SET sql_mode=''");
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ mysqli_select_db($link, "test");
+ mysqli_query($link, "SET sql_mode=''");
- /* two fields are needed. the problem does not occur with 1 field only selected. */
- $link->query("CREATE TABLE test_users(user_id int(10) unsigned NOT NULL auto_increment, login varchar(50) default '', PRIMARY KEY (user_id))");
- $link->query('INSERT INTO test_users VALUES (NULL, "user1"), (NULL, "user2"), (NULL, "user3"), (NULL, "user4")');
+ /* two fields are needed. the problem does not occur with 1 field only selected. */
+ $link->query("CREATE TABLE test_users(user_id int(10) unsigned NOT NULL auto_increment, login varchar(50) default '', PRIMARY KEY (user_id))");
+ $link->query('INSERT INTO test_users VALUES (NULL, "user1"), (NULL, "user2"), (NULL, "user3"), (NULL, "user4")');
- if ($stmt = $link->prepare("SELECT SQL_NO_CACHE user_id, login FROM test_users")) {
- $stmt->execute();
- $stmt->bind_result($col1, $col2);
- while ($stmt->fetch()) {
- var_dump($col1, $col2);
- }
- $stmt->close();
- }
+ if ($stmt = $link->prepare("SELECT SQL_NO_CACHE user_id, login FROM test_users")) {
+ $stmt->execute();
+ $stmt->bind_result($col1, $col2);
+ while ($stmt->fetch()) {
+ var_dump($col1, $col2);
+ }
+ $stmt->close();
+ }
- mysqli_query($link,"DROP TABLE test_users");
- mysqli_close($link);
+ mysqli_query($link,"DROP TABLE test_users");
+ mysqli_close($link);
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/bug33090.phpt b/ext/mysqli/tests/bug33090.phpt
index c95043c551..6bddfa4290 100644
--- a/ext/mysqli/tests/bug33090.phpt
+++ b/ext/mysqli/tests/bug33090.phpt
@@ -7,17 +7,17 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- include ("connect.inc");
+ include ("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, null, $port, $socket);
- mysqli_select_db($link, $db);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, null, $port, $socket);
+ mysqli_select_db($link, $db);
- if (!($link->prepare("this makes no sense"))) {
- printf("%d\n", $link->errno);
- printf("%s\n", $link->sqlstate);
- }
- $link->close();
+ if (!($link->prepare("this makes no sense"))) {
+ printf("%d\n", $link->errno);
+ printf("%s\n", $link->sqlstate);
+ }
+ $link->close();
?>
--EXPECT--
1064
diff --git a/ext/mysqli/tests/bug33263.phpt b/ext/mysqli/tests/bug33263.phpt
index e9ca36fe49..5df4065d25 100644
--- a/ext/mysqli/tests/bug33263.phpt
+++ b/ext/mysqli/tests/bug33263.phpt
@@ -8,30 +8,30 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- class test extends mysqli
- {
- public function __construct($host, $user, $passwd, $db, $port, $socket) {
- parent::init();
- parent::real_connect($host, $user, $passwd, $db, $port, $socket);
- }
- }
+ class test extends mysqli
+ {
+ public function __construct($host, $user, $passwd, $db, $port, $socket) {
+ parent::init();
+ parent::real_connect($host, $user, $passwd, $db, $port, $socket);
+ }
+ }
- $mysql = new test($host, $user, $passwd, $db, $port, $socket);
+ $mysql = new test($host, $user, $passwd, $db, $port, $socket);
- $stmt = $mysql->prepare("SELECT DATABASE()");
- $stmt->execute();
- $stmt->bind_result($database);
- $stmt->fetch();
- $stmt->close();
+ $stmt = $mysql->prepare("SELECT DATABASE()");
+ $stmt->execute();
+ $stmt->bind_result($database);
+ $stmt->fetch();
+ $stmt->close();
- if ($database != $db)
- printf("[001] Expecting '%s' got %s/'%s'.\n",
- gettype($database), $database);
+ if ($database != $db)
+ printf("[001] Expecting '%s' got %s/'%s'.\n",
+ gettype($database), $database);
- $mysql->close();
- print "done!";
+ $mysql->close();
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/bug34785.phpt b/ext/mysqli/tests/bug34785.phpt
index 18dd4c3566..17a18f4ca9 100644
--- a/ext/mysqli/tests/bug34785.phpt
+++ b/ext/mysqli/tests/bug34785.phpt
@@ -7,43 +7,43 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- include ("connect.inc");
+ include ("connect.inc");
- class my_stmt extends mysqli_stmt
- {
- public function __construct($link, $query) {
- parent::__construct($link, $query);
- }
- }
+ class my_stmt extends mysqli_stmt
+ {
+ public function __construct($link, $query) {
+ parent::__construct($link, $query);
+ }
+ }
- class my_result extends mysqli_result
- {
- public function __construct($link, $query) {
- parent::__construct($link, $query);
- }
- }
+ class my_result extends mysqli_result
+ {
+ public function __construct($link, $query) {
+ parent::__construct($link, $query);
+ }
+ }
- /*** test mysqli_connect 127.0.0.1 ***/
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- mysqli_query($link, "SET sql_mode=''");
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ mysqli_query($link, "SET sql_mode=''");
- $stmt = new my_stmt($link, "SELECT 'foo' FROM DUAL");
+ $stmt = new my_stmt($link, "SELECT 'foo' FROM DUAL");
- $stmt->execute();
- $stmt->bind_result($var);
- $stmt->fetch();
+ $stmt->execute();
+ $stmt->bind_result($var);
+ $stmt->fetch();
- $stmt->close();
- var_dump($var);
+ $stmt->close();
+ var_dump($var);
- mysqli_real_query($link, "SELECT 'bar' FROM DUAL");
- $result = new my_result($link, MYSQLI_STORE_RESULT);
- $row = $result->fetch_row();
- $result->close();
+ mysqli_real_query($link, "SELECT 'bar' FROM DUAL");
+ $result = new my_result($link, MYSQLI_STORE_RESULT);
+ $row = $result->fetch_row();
+ $result->close();
- var_dump($row[0]);
+ var_dump($row[0]);
- mysqli_close($link);
+ mysqli_close($link);
?>
--EXPECTF--
%s(3) "foo"
diff --git a/ext/mysqli/tests/bug34810.phpt b/ext/mysqli/tests/bug34810.phpt
index b56d1a5ac7..60ed3f8d1a 100644
--- a/ext/mysqli/tests/bug34810.phpt
+++ b/ext/mysqli/tests/bug34810.phpt
@@ -9,37 +9,37 @@ require_once('skipifconnectfailure.inc');
<?php
class DbConnection {
- public function connect() {
- require_once("connect.inc");
+ public function connect() {
+ require_once("connect.inc");
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- var_dump($link);
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ var_dump($link);
- $link = mysqli_init();
+ $link = mysqli_init();
var_dump($link);
- $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
- $mysql->query("DROP TABLE IF EXISTS test_warnings");
- $mysql->query("CREATE TABLE test_warnings (a int not null)");
- $mysql->query("SET sql_mode=''");
- $mysql->query("INSERT INTO test_warnings VALUES (1),(2),(NULL)");
+ $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ $mysql->query("DROP TABLE IF EXISTS test_warnings");
+ $mysql->query("CREATE TABLE test_warnings (a int not null)");
+ $mysql->query("SET sql_mode=''");
+ $mysql->query("INSERT INTO test_warnings VALUES (1),(2),(NULL)");
- $warning = $mysql->get_warnings();
- if (!$warning)
- printf("[001] No warning!\n");
+ $warning = $mysql->get_warnings();
+ if (!$warning)
+ printf("[001] No warning!\n");
- if ($warning->errno == 1048 || $warning->errno == 1253) {
- /* 1048 - Column 'a' cannot be null, 1263 - Data truncated; NULL supplied to NOT NULL column 'a' at row */
- if ("HY000" != $warning->sqlstate)
- printf("[003] Wrong sql state code: %s\n", $warning->sqlstate);
+ if ($warning->errno == 1048 || $warning->errno == 1253) {
+ /* 1048 - Column 'a' cannot be null, 1263 - Data truncated; NULL supplied to NOT NULL column 'a' at row */
+ if ("HY000" != $warning->sqlstate)
+ printf("[003] Wrong sql state code: %s\n", $warning->sqlstate);
- if ("" == $warning->message)
- printf("[004] Message string must not be empty\n");
- } else {
- printf("[002] Empty error message!\n");
- var_dump($warning);
- }
- }
+ if ("" == $warning->message)
+ printf("[004] Message string must not be empty\n");
+ } else {
+ printf("[002] Empty error message!\n");
+ var_dump($warning);
+ }
+ }
}
$db = new DbConnection();
diff --git a/ext/mysqli/tests/bug35103.phpt b/ext/mysqli/tests/bug35103.phpt
index fc3cad04c2..7a990eacbf 100644
--- a/ext/mysqli/tests/bug35103.phpt
+++ b/ext/mysqli/tests/bug35103.phpt
@@ -12,44 +12,44 @@ $drop = <<<EOSQL
DROP TABLE test_bint;
DROP TABLE test_buint;
EOSQL;
- require_once("connect.inc");
+ require_once("connect.inc");
- $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
- $mysql->query("DROP TABLE IF EXISTS test_bint");
- $mysql->query("CREATE TABLE test_bint (a bigint(20) default NULL) ENGINE=MYISAM");
- $mysql->query("INSERT INTO test_bint VALUES (9223372036854775807),(-9223372036854775808),(-2147483648),(-2147483649),(-2147483647),(2147483647),(2147483648),(2147483649)");
+ $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ $mysql->query("DROP TABLE IF EXISTS test_bint");
+ $mysql->query("CREATE TABLE test_bint (a bigint(20) default NULL) ENGINE=MYISAM");
+ $mysql->query("INSERT INTO test_bint VALUES (9223372036854775807),(-9223372036854775808),(-2147483648),(-2147483649),(-2147483647),(2147483647),(2147483648),(2147483649)");
- $mysql->query("DROP TABLE IF EXISTS test_buint");
- $mysql->query("CREATE TABLE test_buint (a bigint(20) unsigned default NULL)");
- $mysql->query("INSERT INTO test_buint VALUES (18446744073709551615),(9223372036854775807),(9223372036854775808),(2147483647),(2147483649),(4294967295)");
+ $mysql->query("DROP TABLE IF EXISTS test_buint");
+ $mysql->query("CREATE TABLE test_buint (a bigint(20) unsigned default NULL)");
+ $mysql->query("INSERT INTO test_buint VALUES (18446744073709551615),(9223372036854775807),(9223372036854775808),(2147483647),(2147483649),(4294967295)");
- $stmt = $mysql->prepare("SELECT a FROM test_bint ORDER BY a");
- $stmt->bind_result($v);
- $stmt->execute();
- $i=0;
- echo "BIG INT SIGNED, TEST\n";
- while ($i++ < 8) {
- $stmt->fetch();
- echo $v, "\n";
- }
- $stmt->close();
+ $stmt = $mysql->prepare("SELECT a FROM test_bint ORDER BY a");
+ $stmt->bind_result($v);
+ $stmt->execute();
+ $i=0;
+ echo "BIG INT SIGNED, TEST\n";
+ while ($i++ < 8) {
+ $stmt->fetch();
+ echo $v, "\n";
+ }
+ $stmt->close();
- echo str_repeat("-", 20), "\n";
+ echo str_repeat("-", 20), "\n";
- $stmt = $mysql->prepare("SELECT a FROM test_buint ORDER BY a");
- $stmt->bind_result($v2);
- $stmt->execute();
- $j=0;
- echo "BIG INT UNSIGNED TEST\n";
- while ($j++ < 6) {
- $stmt->fetch();
- echo $v2, "\n";
- }
- $stmt->close();
+ $stmt = $mysql->prepare("SELECT a FROM test_buint ORDER BY a");
+ $stmt->bind_result($v2);
+ $stmt->execute();
+ $j=0;
+ echo "BIG INT UNSIGNED TEST\n";
+ while ($j++ < 6) {
+ $stmt->fetch();
+ echo $v2, "\n";
+ }
+ $stmt->close();
- $mysql->multi_query($drop);
+ $mysql->multi_query($drop);
- $mysql->close();
+ $mysql->close();
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/bug35517.phpt b/ext/mysqli/tests/bug35517.phpt
index 78b3206af4..a722179896 100644
--- a/ext/mysqli/tests/bug35517.phpt
+++ b/ext/mysqli/tests/bug35517.phpt
@@ -7,32 +7,32 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
- $mysql->query("CREATE TABLE temp (id INT UNSIGNED NOT NULL)");
- $mysql->query("INSERT INTO temp (id) VALUES (3000000897),(3800001532),(3900002281),(3100059612)");
- $stmt = $mysql->prepare("SELECT id FROM temp");
- $stmt->execute();
- $stmt->bind_result($id);
- while ($stmt->fetch()) {
- if (PHP_INT_SIZE == 8) {
- if ((gettype($id) !== 'int') && (gettype($id) != 'integer'))
- printf("[001] Expecting integer on 64bit got %s/%s\n", gettype($id), var_export($id, true));
- } else {
- if (gettype($id) !== 'string') {
- printf("[002] Expecting string on 32bit got %s/%s\n", gettype($id), var_export($id, true));
- }
- }
- print $id;
- print "\n";
- }
- $stmt->close();
+ $mysql->query("CREATE TABLE temp (id INT UNSIGNED NOT NULL)");
+ $mysql->query("INSERT INTO temp (id) VALUES (3000000897),(3800001532),(3900002281),(3100059612)");
+ $stmt = $mysql->prepare("SELECT id FROM temp");
+ $stmt->execute();
+ $stmt->bind_result($id);
+ while ($stmt->fetch()) {
+ if (PHP_INT_SIZE == 8) {
+ if ((gettype($id) !== 'int') && (gettype($id) != 'integer'))
+ printf("[001] Expecting integer on 64bit got %s/%s\n", gettype($id), var_export($id, true));
+ } else {
+ if (gettype($id) !== 'string') {
+ printf("[002] Expecting string on 32bit got %s/%s\n", gettype($id), var_export($id, true));
+ }
+ }
+ print $id;
+ print "\n";
+ }
+ $stmt->close();
- $mysql->query("DROP TABLE temp");
- $mysql->close();
- print "done!";
+ $mysql->query("DROP TABLE temp");
+ $mysql->close();
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/bug35759.phpt b/ext/mysqli/tests/bug35759.phpt
index d6d7a7582b..5ae032eb83 100644
--- a/ext/mysqli/tests/bug35759.phpt
+++ b/ext/mysqli/tests/bug35759.phpt
@@ -8,49 +8,49 @@ require_once('skipifconnectfailure.inc');
--FILE--
<?php
- require_once("connect.inc");
- $col_num= 1000;
-
- $mysql = new mysqli($host, $user, $passwd, $db, $port, $socket);
- $mysql->query("DROP TABLE IF EXISTS test");
- $create = "CREATE TABLE test (a0 MEDIUMBLOB NOT NULL DEFAULT ''";
- $i= 0;
- while (++$i < $col_num) {
- $create .= ", a$i MEDIUMBLOB NOT NULL DEFAULT ''";
- }
- $create .= ") ENGINE=MyISAM"; // doesn't work with InnoDB, which is default in 5.5
-
- if (!$mysql->query($create)) {
- if (1101 == $mysql->errno) {
- /* SQL strict mode - [1101] BLOB/TEXT column 'a0' can't have a default value */
- print "done!";
- exit(0);
- }
- printf("[001] [%d] %s\n", $mysql->errno, $mysql->error);
- }
-
- if (!$mysql->query("INSERT INTO test (a0) VALUES ('')"))
- printf("[002] [%d] %s\n", $mysql->errno, $mysql->error);
-
- $stmt = $mysql->prepare("SELECT * FROM test");
- if ($stmt) {
-
- $stmt->execute();
- $stmt->store_result();
- for ($i = 0; $i < $col_num; $i++) {
- $params[] = &$col_num;
- }
- call_user_func_array(array($stmt, "bind_result"), $params);
- $stmt->fetch();
-
- $stmt->close();
- } else {
- printf("[003] [%d] %s\n", $mysql->errno, $mysql->error);
- }
-
- $mysql->close();
-
- echo "done!";
+ require_once("connect.inc");
+ $col_num= 1000;
+
+ $mysql = new mysqli($host, $user, $passwd, $db, $port, $socket);
+ $mysql->query("DROP TABLE IF EXISTS test");
+ $create = "CREATE TABLE test (a0 MEDIUMBLOB NOT NULL DEFAULT ''";
+ $i= 0;
+ while (++$i < $col_num) {
+ $create .= ", a$i MEDIUMBLOB NOT NULL DEFAULT ''";
+ }
+ $create .= ") ENGINE=MyISAM"; // doesn't work with InnoDB, which is default in 5.5
+
+ if (!$mysql->query($create)) {
+ if (1101 == $mysql->errno) {
+ /* SQL strict mode - [1101] BLOB/TEXT column 'a0' can't have a default value */
+ print "done!";
+ exit(0);
+ }
+ printf("[001] [%d] %s\n", $mysql->errno, $mysql->error);
+ }
+
+ if (!$mysql->query("INSERT INTO test (a0) VALUES ('')"))
+ printf("[002] [%d] %s\n", $mysql->errno, $mysql->error);
+
+ $stmt = $mysql->prepare("SELECT * FROM test");
+ if ($stmt) {
+
+ $stmt->execute();
+ $stmt->store_result();
+ for ($i = 0; $i < $col_num; $i++) {
+ $params[] = &$col_num;
+ }
+ call_user_func_array(array($stmt, "bind_result"), $params);
+ $stmt->fetch();
+
+ $stmt->close();
+ } else {
+ printf("[003] [%d] %s\n", $mysql->errno, $mysql->error);
+ }
+
+ $mysql->close();
+
+ echo "done!";
?>
--CLEAN--
<?php require("clean_table.inc"); ?>
diff --git a/ext/mysqli/tests/bug36420.phpt b/ext/mysqli/tests/bug36420.phpt
index 6dd03b37f0..619c41bd44 100644
--- a/ext/mysqli/tests/bug36420.phpt
+++ b/ext/mysqli/tests/bug36420.phpt
@@ -14,15 +14,22 @@ $mysqli = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
$result = $mysqli->query('select 1');
$result->close();
-echo $result->num_rows;
+try {
+ $result->num_rows;
+} catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+}
$mysqli->close();
-echo $result->num_rows;
+try {
+ $result->num_rows;
+} catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+}
echo "Done\n";
?>
--EXPECTF--
-Warning: main(): Couldn't fetch mysqli_result in %s on line %d
-
-Warning: main(): Couldn't fetch mysqli_result in %s on line %d
+mysqli_result object is already closed
+mysqli_result object is already closed
Done
diff --git a/ext/mysqli/tests/bug36745.phpt b/ext/mysqli/tests/bug36745.phpt
index 7a630afdc5..744985ab41 100644
--- a/ext/mysqli/tests/bug36745.phpt
+++ b/ext/mysqli/tests/bug36745.phpt
@@ -9,19 +9,19 @@ require_once('skipifconnectfailure.inc');
mysqli.allow_local_infile=1
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /*** test mysqli_connect 127.0.0.1 ***/
- $mysql = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ /*** test mysqli_connect 127.0.0.1 ***/
+ $mysql = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- $mysql->query("DROP TABLE IF EXISTS litest");
- $mysql->query("CREATE TABLE litest (a VARCHAR(20))");
+ $mysql->query("DROP TABLE IF EXISTS litest");
+ $mysql->query("CREATE TABLE litest (a VARCHAR(20))");
- $mysql->query("LOAD DATA LOCAL INFILE 'filenotfound' INTO TABLE litest");
- var_dump($mysql->error);
+ $mysql->query("LOAD DATA LOCAL INFILE 'filenotfound' INTO TABLE litest");
+ var_dump($mysql->error);
- $mysql->close();
- printf("Done");
+ $mysql->close();
+ printf("Done");
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/bug36802.phpt b/ext/mysqli/tests/bug36802.phpt
index 65e6d9a8ce..1189115837 100644
--- a/ext/mysqli/tests/bug36802.phpt
+++ b/ext/mysqli/tests/bug36802.phpt
@@ -4,38 +4,46 @@ Bug #36802 (crashes with with mysqli_set_charset())
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
- class really_my_mysqli extends mysqli {
- function __construct()
- {
- }
- }
+ class really_my_mysqli extends mysqli {
+ function __construct()
+ {
+ }
+ }
- require_once("connect.inc");
- $mysql = mysqli_init();
+ require_once("connect.inc");
+ $mysql = mysqli_init();
- /* following operations should not work */
- if (method_exists($mysql, 'set_charset')) {
- $x[0] = @$mysql->set_charset('utf8');
- } else {
- $x[0] = false;
- }
- $x[1] = @$mysql->query("SELECT 'foo' FROM DUAL");
+ /* following operations should not work */
+ if (method_exists($mysql, 'set_charset')) {
+ try {
+ $mysql->set_charset('utf8');
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+ } else {
+ $x[0] = false;
+ }
- /* following operations should work */
- $x[2] = ($mysql->client_version > 0);
- $x[3] = $mysql->errno;
- $mysql->close();
+ try {
+ $mysql->query("SELECT 'foo' FROM DUAL");
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- var_dump($x);
+ /* following operations should work */
+ $x[1] = ($mysql->client_version > 0);
+ $x[2] = $mysql->errno;
+
+ $mysql->close();
+
+ var_dump($x);
?>
--EXPECT--
-array(4) {
- [0]=>
- bool(false)
+mysqli object is not fully initialized
+mysqli object is not fully initialized
+array(2) {
[1]=>
- bool(false)
- [2]=>
bool(true)
- [3]=>
+ [2]=>
int(0)
}
diff --git a/ext/mysqli/tests/bug36949.phpt b/ext/mysqli/tests/bug36949.phpt
index 2b3cc4955b..5805a65100 100644
--- a/ext/mysqli/tests/bug36949.phpt
+++ b/ext/mysqli/tests/bug36949.phpt
@@ -10,38 +10,38 @@ require_once('skipifconnectfailure.inc');
require_once("connect.inc");
class A {
- private $mysqli;
-
- public function __construct() {
- global $user, $host, $passwd, $db, $port, $socket;
- $this->mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket);
- $result = $this->mysqli->query("SELECT NOW() AS my_time FROM DUAL");
- $row = $result->fetch_object();
- echo $row->my_time."<br>\n";
- $result->close();
- }
-
- public function __destruct() {
- $this->mysqli->close();
- }
+ private $mysqli;
+
+ public function __construct() {
+ global $user, $host, $passwd, $db, $port, $socket;
+ $this->mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket);
+ $result = $this->mysqli->query("SELECT NOW() AS my_time FROM DUAL");
+ $row = $result->fetch_object();
+ echo $row->my_time."<br>\n";
+ $result->close();
+ }
+
+ public function __destruct() {
+ $this->mysqli->close();
+ }
}
class B {
- private $mysqli;
+ private $mysqli;
- public function __construct() {
- global $user, $host, $passwd, $db, $port, $socket;
- $this->mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket);
- $result = $this->mysqli->query("SELECT NOW() AS my_time FROM DUAL");
- $row = $result->fetch_object();
- echo $row->my_time."<br>\n";
- $result->close();
- }
+ public function __construct() {
+ global $user, $host, $passwd, $db, $port, $socket;
+ $this->mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket);
+ $result = $this->mysqli->query("SELECT NOW() AS my_time FROM DUAL");
+ $row = $result->fetch_object();
+ echo $row->my_time."<br>\n";
+ $result->close();
+ }
- public function __destruct() {
- $this->mysqli->close();
- }
+ public function __destruct() {
+ $this->mysqli->close();
+ }
}
$A = new A();
diff --git a/ext/mysqli/tests/bug37090.phpt b/ext/mysqli/tests/bug37090.phpt
index d24e0d4a7f..13d939608d 100644
--- a/ext/mysqli/tests/bug37090.phpt
+++ b/ext/mysqli/tests/bug37090.phpt
@@ -10,22 +10,22 @@ if (!function_exists('mysqli_set_charset')) {
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
- $cs = array();
- $cs[] = $mysql->set_charset("latin1");
- $cs[] = $mysql->character_set_name();
+ $cs = array();
+ $cs[] = $mysql->set_charset("latin1");
+ $cs[] = $mysql->character_set_name();
- $cs[] = $mysql->set_charset("utf8");
- $cs[] = $mysql->character_set_name();
+ $cs[] = $mysql->set_charset("utf8");
+ $cs[] = $mysql->character_set_name();
- $cs[] = $mysql->set_charset("notdefined");
- $cs[] = $mysql->character_set_name();
+ $cs[] = $mysql->set_charset("notdefined");
+ $cs[] = $mysql->character_set_name();
- var_dump($cs);
- print "done!";
+ var_dump($cs);
+ print "done!";
?>
--EXPECT--
array(6) {
diff --git a/ext/mysqli/tests/bug38710.phpt b/ext/mysqli/tests/bug38710.phpt
index 7a47003632..dc6496971a 100644
--- a/ext/mysqli/tests/bug38710.phpt
+++ b/ext/mysqli/tests/bug38710.phpt
@@ -16,7 +16,7 @@ $qry->execute();
$qry->bind_result($text);
$qry->fetch();
if ($text !== str_repeat('a', ($IS_MYSQLND || mysqli_get_server_version($db) > 50110)? 100000:(mysqli_get_server_version($db)>=50000? 8193:8191))) {
- var_dump(strlen($text));
+ var_dump(strlen($text));
}
echo "Done";
?>
diff --git a/ext/mysqli/tests/bug39457.phpt b/ext/mysqli/tests/bug39457.phpt
index ec9239bb15..f518b14331 100644
--- a/ext/mysqli/tests/bug39457.phpt
+++ b/ext/mysqli/tests/bug39457.phpt
@@ -7,15 +7,15 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $mysql = mysqli_init();
- $mysql->connect($host, $user, $passwd, $db, $port, $socket);
+ $mysql = mysqli_init();
+ $mysql->connect($host, $user, $passwd, $db, $port, $socket);
- $mysql->connect($host, $user, $passwd, $db, $port, $socket);
+ $mysql->connect($host, $user, $passwd, $db, $port, $socket);
- $mysql->close();
- echo "OK\n";
+ $mysql->close();
+ echo "OK\n";
?>
--EXPECT--
OK
diff --git a/ext/mysqli/tests/bug42378.phpt b/ext/mysqli/tests/bug42378.phpt
index 1c75141306..3b0638c840 100644
--- a/ext/mysqli/tests/bug42378.phpt
+++ b/ext/mysqli/tests/bug42378.phpt
@@ -10,175 +10,175 @@ require_once('skipifconnectfailure.inc');
memory_limit=83886080
--FILE--
<?php
- require_once("connect.inc");
-
- function create_table($link, $column, $min, $max, $engine, $offset) {
-
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
- printf("[%03d] Cannot drop table test, [%d] %s\n",
- $offset,
- mysqli_errno($link), mysqli_error($link));
- return array();
- }
- print "$column\n";
-
- $sql = sprintf("CREATE TABLE test(id INT AUTO_INCREMENT PRIMARY KEY, col1 %s) ENGINE=%s",
- $column, $engine);
- if (!mysqli_query($link, $sql)) {
- printf("[%03d] Cannot create table test, [%d] %s\n",
- $offset + 1,
- mysqli_errno($link), mysqli_error($link));
- return array();
- }
-
- $values = array();
- for ($i = 1; $i <= 100; $i++) {
- $col1 = mt_rand($min, $max);
- $values[$i] = $col1;
- $sql = sprintf("INSERT INTO test(id, col1) VALUES (%d, %f)",
- $i, $col1);
- if (!mysqli_query($link, $sql)) {
- printf("[%03d] Cannot insert data, [%d] %s\n",
- $offset + 2,
- mysqli_errno($link), mysqli_error($link));
- return array();
- }
- }
-
- return $values;
- }
-
- function test_format($link, $format, $from, $order_by, $expected, $offset) {
-
- if (!$stmt = mysqli_stmt_init($link)) {
- printf("[%03d] Cannot create PS, [%d] %s\n",
- $offset,
- mysqli_errno($link), mysqli_error($link));
- return false;
- }
- print "$format\n";
-
- if ($order_by)
- $sql = sprintf('SELECT %s AS _format FROM %s ORDER BY %s', $format, $from, $order_by);
- else
- $sql = sprintf('SELECT %s AS _format FROM %s', $format, $from);
-
- if (!mysqli_stmt_prepare($stmt, $sql)) {
- printf("[%03d] Cannot prepare PS, [%d] %s\n",
- $offset + 1,
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
-
- if (!mysqli_stmt_execute($stmt)) {
- printf("[%03d] Cannot execute PS, [%d] %s\n",
- $offset + 2,
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
-
- if (!mysqli_stmt_store_result($stmt)) {
- printf("[%03d] Cannot store result set, [%d] %s\n",
- $offset + 3,
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
-
- if (!is_array($expected)) {
-
- $result = null;
- if (!mysqli_stmt_bind_result($stmt, $result)) {
- printf("[%03d] Cannot bind result, [%d] %s\n",
- $offset + 4,
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
-
- if (!mysqli_stmt_fetch($stmt)) {
- printf("[%03d] Cannot fetch result,, [%d] %s\n",
- $offset + 5,
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
-
- if ($result !== $expected) {
- printf("[%03d] Expecting %s/%s got %s/%s with %s - %s.\n",
- $offset + 6,
- gettype($expected), $expected,
- gettype($result), $result,
- $format, $sql);
- }
-
- } else {
-
- $order_by_col = $result = null;
- if (!is_null($order_by)) {
- if (!mysqli_stmt_bind_result($stmt, $order_by_col, $result)) {
- printf("[%03d] Cannot bind result, [%d] %s\n",
- $offset + 7,
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
- } else {
- if (!mysqli_stmt_bind_result($stmt, $result)) {
- printf("[%03d] Cannot bind result, [%d] %s\n",
- $offset + 7,
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
- }
-
- foreach ($expected as $k => $v) {
- if (!mysqli_stmt_fetch($stmt)) {
- break;
- }
- if ($result !== $v) {
- printf("[%03d] Row %d - expecting %s/%s got %s/%s [%s] with %s - %s.\n",
- $offset + 8,
- $k,
- gettype($v), $v,
- gettype($result), $result,
- $order_by_col,
- $format, $sql);
- }
- }
-
- }
-
- mysqli_stmt_free_result($stmt);
- mysqli_stmt_close($stmt);
-
- return true;
- }
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect - [%d] %s\n",
- mysqli_connect_errno(),
- mysqli_connect_error());
-
- /* create new table and select from it */
- $expected = create_table($link, 'FLOAT', -10000, 10000, $engine, 90);
- foreach ($expected as $k => $v)
- $expected[$k] = number_format(round($v), 0, '.', ',');
- test_format($link, 'FORMAT(col1, 0)', 'test', NULL, array(), 100);
-
- $expected = create_table($link, 'FLOAT', -10000, 10000, $engine, 110);
- foreach ($expected as $k => $v)
- $expected[$k] = number_format(round($v), 0, '.', ',');
- test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 120);
-
- $expected = create_table($link, 'FLOAT UNSIGNED', 0, 10000, $engine, 130);
- foreach ($expected as $k => $v)
- $expected[$k] = number_format(round($v), 0, '.', ',');
- test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 140);
-
- $expected = create_table($link, 'DECIMAL(5,0)', -1000, 1000, $engine, 150);
- foreach ($expected as $k => $v)
- $expected[$k] = number_format(round($v), 0, '.', ',');
- test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 160);
-
- mysqli_close($link);
- print "done!";
+ require_once("connect.inc");
+
+ function create_table($link, $column, $min, $max, $engine, $offset) {
+
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
+ printf("[%03d] Cannot drop table test, [%d] %s\n",
+ $offset,
+ mysqli_errno($link), mysqli_error($link));
+ return array();
+ }
+ print "$column\n";
+
+ $sql = sprintf("CREATE TABLE test(id INT AUTO_INCREMENT PRIMARY KEY, col1 %s) ENGINE=%s",
+ $column, $engine);
+ if (!mysqli_query($link, $sql)) {
+ printf("[%03d] Cannot create table test, [%d] %s\n",
+ $offset + 1,
+ mysqli_errno($link), mysqli_error($link));
+ return array();
+ }
+
+ $values = array();
+ for ($i = 1; $i <= 100; $i++) {
+ $col1 = mt_rand($min, $max);
+ $values[$i] = $col1;
+ $sql = sprintf("INSERT INTO test(id, col1) VALUES (%d, %f)",
+ $i, $col1);
+ if (!mysqli_query($link, $sql)) {
+ printf("[%03d] Cannot insert data, [%d] %s\n",
+ $offset + 2,
+ mysqli_errno($link), mysqli_error($link));
+ return array();
+ }
+ }
+
+ return $values;
+ }
+
+ function test_format($link, $format, $from, $order_by, $expected, $offset) {
+
+ if (!$stmt = mysqli_stmt_init($link)) {
+ printf("[%03d] Cannot create PS, [%d] %s\n",
+ $offset,
+ mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+ print "$format\n";
+
+ if ($order_by)
+ $sql = sprintf('SELECT %s AS _format FROM %s ORDER BY %s', $format, $from, $order_by);
+ else
+ $sql = sprintf('SELECT %s AS _format FROM %s', $format, $from);
+
+ if (!mysqli_stmt_prepare($stmt, $sql)) {
+ printf("[%03d] Cannot prepare PS, [%d] %s\n",
+ $offset + 1,
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+
+ if (!mysqli_stmt_execute($stmt)) {
+ printf("[%03d] Cannot execute PS, [%d] %s\n",
+ $offset + 2,
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+
+ if (!mysqli_stmt_store_result($stmt)) {
+ printf("[%03d] Cannot store result set, [%d] %s\n",
+ $offset + 3,
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+
+ if (!is_array($expected)) {
+
+ $result = null;
+ if (!mysqli_stmt_bind_result($stmt, $result)) {
+ printf("[%03d] Cannot bind result, [%d] %s\n",
+ $offset + 4,
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+
+ if (!mysqli_stmt_fetch($stmt)) {
+ printf("[%03d] Cannot fetch result,, [%d] %s\n",
+ $offset + 5,
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+
+ if ($result !== $expected) {
+ printf("[%03d] Expecting %s/%s got %s/%s with %s - %s.\n",
+ $offset + 6,
+ gettype($expected), $expected,
+ gettype($result), $result,
+ $format, $sql);
+ }
+
+ } else {
+
+ $order_by_col = $result = null;
+ if (!is_null($order_by)) {
+ if (!mysqli_stmt_bind_result($stmt, $order_by_col, $result)) {
+ printf("[%03d] Cannot bind result, [%d] %s\n",
+ $offset + 7,
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+ } else {
+ if (!mysqli_stmt_bind_result($stmt, $result)) {
+ printf("[%03d] Cannot bind result, [%d] %s\n",
+ $offset + 7,
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+ }
+
+ foreach ($expected as $k => $v) {
+ if (!mysqli_stmt_fetch($stmt)) {
+ break;
+ }
+ if ($result !== $v) {
+ printf("[%03d] Row %d - expecting %s/%s got %s/%s [%s] with %s - %s.\n",
+ $offset + 8,
+ $k,
+ gettype($v), $v,
+ gettype($result), $result,
+ $order_by_col,
+ $format, $sql);
+ }
+ }
+
+ }
+
+ mysqli_stmt_free_result($stmt);
+ mysqli_stmt_close($stmt);
+
+ return true;
+ }
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect - [%d] %s\n",
+ mysqli_connect_errno(),
+ mysqli_connect_error());
+
+ /* create new table and select from it */
+ $expected = create_table($link, 'FLOAT', -10000, 10000, $engine, 90);
+ foreach ($expected as $k => $v)
+ $expected[$k] = number_format(round($v), 0, '.', ',');
+ test_format($link, 'FORMAT(col1, 0)', 'test', NULL, array(), 100);
+
+ $expected = create_table($link, 'FLOAT', -10000, 10000, $engine, 110);
+ foreach ($expected as $k => $v)
+ $expected[$k] = number_format(round($v), 0, '.', ',');
+ test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 120);
+
+ $expected = create_table($link, 'FLOAT UNSIGNED', 0, 10000, $engine, 130);
+ foreach ($expected as $k => $v)
+ $expected[$k] = number_format(round($v), 0, '.', ',');
+ test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 140);
+
+ $expected = create_table($link, 'DECIMAL(5,0)', -1000, 1000, $engine, 150);
+ foreach ($expected as $k => $v)
+ $expected[$k] = number_format(round($v), 0, '.', ',');
+ test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 160);
+
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/bug42548.phpt b/ext/mysqli/tests/bug42548.phpt
index 8624250eb1..6f4de58a66 100644
--- a/ext/mysqli/tests/bug42548.phpt
+++ b/ext/mysqli/tests/bug42548.phpt
@@ -19,8 +19,8 @@ require_once('connect.inc');
$mysqli = mysqli_init();
$mysqli->real_connect($host, $user, $passwd, $db, $port, $socket);
if (mysqli_connect_errno()) {
- printf("Connect failed: %s\n", mysqli_connect_error());
- exit();
+ printf("Connect failed: %s\n", mysqli_connect_error());
+ exit();
}
$mysqli->query("DROP PROCEDURE IF EXISTS p1") or die($mysqli->error);
@@ -28,22 +28,22 @@ $mysqli->query("CREATE PROCEDURE p1() BEGIN SELECT 23; SELECT 42; END") or die($
if ($mysqli->multi_query("CALL p1();"))
{
- do
- {
- if ($objResult = $mysqli->store_result()) {
- while ($row = $objResult->fetch_assoc()) {
- print_r($row);
- }
- $objResult->close();
- if ($mysqli->more_results()) {
- print "----- next result -----------\n";
- }
- } else {
- print "no results found\n";
- }
- } while ($mysqli->more_results() && $mysqli->next_result());
+ do
+ {
+ if ($objResult = $mysqli->store_result()) {
+ while ($row = $objResult->fetch_assoc()) {
+ print_r($row);
+ }
+ $objResult->close();
+ if ($mysqli->more_results()) {
+ print "----- next result -----------\n";
+ }
+ } else {
+ print "no results found\n";
+ }
+ } while ($mysqli->more_results() && $mysqli->next_result());
} else {
- print $mysqli->error;
+ print $mysqli->error;
}
$mysqli->query("DROP PROCEDURE p1") or die($mysqli->error);
diff --git a/ext/mysqli/tests/bug44897.phpt b/ext/mysqli/tests/bug44897.phpt
index 948e4aaee7..ba7d0ca49d 100644
--- a/ext/mysqli/tests/bug44897.phpt
+++ b/ext/mysqli/tests/bug44897.phpt
@@ -19,57 +19,57 @@ if (mysqli_get_server_version($link) <= 50000) {
?>
--FILE--
<?php
- require_once("table.inc");
+ require_once("table.inc");
- if (!$link->query('DROP PROCEDURE IF EXISTS p'))
- printf("[001] [%d] %s\n", $link->errno, $link->error);
+ if (!$link->query('DROP PROCEDURE IF EXISTS p'))
+ printf("[001] [%d] %s\n", $link->errno, $link->error);
- if (!$link->query('CREATE PROCEDURE p(IN new_id INT, IN new_label CHAR(1)) BEGIN INSERT INTO test(id, label) VALUES (new_id, new_label); SELECT new_label; END;'))
- printf("[002] [%d] %s\n", $link->errno, $link->error);
+ if (!$link->query('CREATE PROCEDURE p(IN new_id INT, IN new_label CHAR(1)) BEGIN INSERT INTO test(id, label) VALUES (new_id, new_label); SELECT new_label; END;'))
+ printf("[002] [%d] %s\n", $link->errno, $link->error);
- $new_id = 100;
- $new_label = 'z';
+ $new_id = 100;
+ $new_label = 'z';
- if (!$stmt = $link->prepare('CALL p(?, ?)'))
- printf("[003] [%d] %s\n", $link->errno, $link->error);
+ if (!$stmt = $link->prepare('CALL p(?, ?)'))
+ printf("[003] [%d] %s\n", $link->errno, $link->error);
- if (!$stmt->bind_param('is', $new_id, $new_label) || !$stmt->execute())
- printf("[004] [%d] %s\n", $stmt->errno, $stmt->error);
+ if (!$stmt->bind_param('is', $new_id, $new_label) || !$stmt->execute())
+ printf("[004] [%d] %s\n", $stmt->errno, $stmt->error);
- $out_new_label = null;
- if (!$stmt->bind_result($out_new_label) || !$stmt->fetch())
- printf("[005] [%d] %s\n", $stmt->errno, $stmt->error);
+ $out_new_label = null;
+ if (!$stmt->bind_result($out_new_label) || !$stmt->fetch())
+ printf("[005] [%d] %s\n", $stmt->errno, $stmt->error);
- if ($out_new_label != $new_label)
- printf("[006] IN value and returned value differ. Expecting %s/%s got %s/%s\n",
- $new_label, gettype($new_label), $out_new_label, gettype($out_new_label));
+ if ($out_new_label != $new_label)
+ printf("[006] IN value and returned value differ. Expecting %s/%s got %s/%s\n",
+ $new_label, gettype($new_label), $out_new_label, gettype($out_new_label));
- $stmt->close();
+ $stmt->close();
- $stmt2 = $link->prepare('SELECT label FROM test WHERE id = ?');
- if (!is_object($stmt2)) {
+ $stmt2 = $link->prepare('SELECT label FROM test WHERE id = ?');
+ if (!is_object($stmt2)) {
- printf("[007] Failed to create new statement object, [%d] %s\n",
- $link->errno, $link->error);
+ printf("[007] Failed to create new statement object, [%d] %s\n",
+ $link->errno, $link->error);
- } else {
+ } else {
- if (!$stmt2->bind_param("i", $new_id) || !$stmt2->execute())
- printf("[008] [%d] %s\n", $stmt2->errno, $stmt2->error);
+ if (!$stmt2->bind_param("i", $new_id) || !$stmt2->execute())
+ printf("[008] [%d] %s\n", $stmt2->errno, $stmt2->error);
- $out_new_label = null;
- if (!$stmt2->bind_result($out_new_label) || !$stmt2->fetch())
- printf("[009] [%d] %s\n", $stmt2->errno, $stmt2->error);
+ $out_new_label = null;
+ if (!$stmt2->bind_result($out_new_label) || !$stmt2->fetch())
+ printf("[009] [%d] %s\n", $stmt2->errno, $stmt2->error);
- if ($out_new_label != $new_label)
- printf("[010] IN value and returned value differ. Expecting %s/%s got %s/%s\n",
- $new_label, gettype($new_label), $out_new_label, gettype($out_new_label));
+ if ($out_new_label != $new_label)
+ printf("[010] IN value and returned value differ. Expecting %s/%s got %s/%s\n",
+ $new_label, gettype($new_label), $out_new_label, gettype($out_new_label));
- }
+ }
- $link->close();
+ $link->close();
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/bug45019.phpt b/ext/mysqli/tests/bug45019.phpt
index f7ace737d8..faad5b9b90 100644
--- a/ext/mysqli/tests/bug45019.phpt
+++ b/ext/mysqli/tests/bug45019.phpt
@@ -8,48 +8,48 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
- require_once("table.inc");
+ require_once("connect.inc");
+ require_once("table.inc");
- // Regular (non-prepared) queries
- print "Using CAST('somestring' AS CHAR)...\n";
- if (!($res = $link->query("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST('two' AS CHAR)")))
- printf("[001] [%d] %s\n", $link->errno, $link->error);
+ // Regular (non-prepared) queries
+ print "Using CAST('somestring' AS CHAR)...\n";
+ if (!($res = $link->query("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST('two' AS CHAR)")))
+ printf("[001] [%d] %s\n", $link->errno, $link->error);
- $data = array();
- while ($row = $res->fetch_assoc()) {
- $data[] = $row['column1'];
- var_dump($row['column1']);
- }
- $res->free();
+ $data = array();
+ while ($row = $res->fetch_assoc()) {
+ $data[] = $row['column1'];
+ var_dump($row['column1']);
+ }
+ $res->free();
- // Prepared Statements
- if (!($stmt = $link->prepare("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST('two' AS CHAR)")))
- printf("[002] [%d] %s\n", $link->errno, $link->error);
+ // Prepared Statements
+ if (!($stmt = $link->prepare("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST('two' AS CHAR)")))
+ printf("[002] [%d] %s\n", $link->errno, $link->error);
- $column1 = null;
- if (!$stmt->bind_result($column1) || !$stmt->execute())
- printf("[003] [%d] %s\n", $stmt->errno, $stmt->error);
+ $column1 = null;
+ if (!$stmt->bind_result($column1) || !$stmt->execute())
+ printf("[003] [%d] %s\n", $stmt->errno, $stmt->error);
- $index = 0;
- while ($stmt->fetch()) {
- /* NOTE: libmysql - http://bugs.mysql.com/bug.php?id=47483 */
- if ($data[$index] != $column1) {
- if ($IS_MYSQLND || $index != 1) {
- printf("[004] Row %d, expecting %s/%s got %s/%s\n",
- $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1);
- } else {
- if ($column1 != "thre")
- printf("[005] Got '%s'. Please check if http://bugs.mysql.com/bug.php?id=47483 has been fixed and adapt tests bug45019.phpt/mysqli_ps_select_union.phpt", $column1);
- }
- }
- $index++;
- }
- $stmt->close();
+ $index = 0;
+ while ($stmt->fetch()) {
+ /* NOTE: libmysql - http://bugs.mysql.com/bug.php?id=47483 */
+ if ($data[$index] != $column1) {
+ if ($IS_MYSQLND || $index != 1) {
+ printf("[004] Row %d, expecting %s/%s got %s/%s\n",
+ $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1);
+ } else {
+ if ($column1 != "thre")
+ printf("[005] Got '%s'. Please check if http://bugs.mysql.com/bug.php?id=47483 has been fixed and adapt tests bug45019.phpt/mysqli_ps_select_union.phpt", $column1);
+ }
+ }
+ $index++;
+ }
+ $stmt->close();
- $link->close();
+ $link->close();
- print "done!";
+ print "done!";
?>
--EXPECT--
Using CAST('somestring' AS CHAR)...
diff --git a/ext/mysqli/tests/bug45289.phpt b/ext/mysqli/tests/bug45289.phpt
index 2ddacf4fdd..65b7ebd707 100644
--- a/ext/mysqli/tests/bug45289.phpt
+++ b/ext/mysqli/tests/bug45289.phpt
@@ -7,30 +7,30 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require('table.inc');
+ require('table.inc');
- $link->close();
+ $link->close();
- $link = mysqli_init();
- if (!($link->real_connect($host, $user, $passwd, $db, $port, $socket)))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ $link = mysqli_init();
+ if (!($link->real_connect($host, $user, $passwd, $db, $port, $socket)))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- $id = 1;
- if (!($stmt = $link->prepare('SELECT id, label FROM test WHERE id=? LIMIT 1')))
- printf("[002] [%d] %s\n", $link->errno, $link->error);
+ $id = 1;
+ if (!($stmt = $link->prepare('SELECT id, label FROM test WHERE id=? LIMIT 1')))
+ printf("[002] [%d] %s\n", $link->errno, $link->error);
- if (!$stmt->bind_param('i', $id) || !$stmt->execute())
- printf("[003] [%d] %s\n", $stmt->errno, $stmt->error);
+ if (!$stmt->bind_param('i', $id) || !$stmt->execute())
+ printf("[003] [%d] %s\n", $stmt->errno, $stmt->error);
- if ($res = $link->store_result()) {
- if ($IS_MYSQLND)
- printf("[004] Can store result!\n");
- else
- printf("[004] [007] http://bugs.mysql.com/bug.php?id=47485\n");
- } else {
- printf("[004] [%d] %s\n", $link->errno, $link->error);
- }
+ if ($res = $link->store_result()) {
+ if ($IS_MYSQLND)
+ printf("[004] Can store result!\n");
+ else
+ printf("[004] [007] http://bugs.mysql.com/bug.php?id=47485\n");
+ } else {
+ printf("[004] [%d] %s\n", $link->errno, $link->error);
+ }
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/bug46109.phpt b/ext/mysqli/tests/bug46109.phpt
index a1c77ac2d8..6b44275ed4 100644
--- a/ext/mysqli/tests/bug46109.phpt
+++ b/ext/mysqli/tests/bug46109.phpt
@@ -7,12 +7,12 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $mysqli = new mysqli();
- $mysqli->init();
- $mysqli->init();
- echo "done";
+ $mysqli = new mysqli();
+ $mysqli->init();
+ $mysqli->init();
+ echo "done";
?>
--EXPECT--
done
diff --git a/ext/mysqli/tests/bug46614.phpt b/ext/mysqli/tests/bug46614.phpt
index 9e78222713..2cdefbf4a3 100644
--- a/ext/mysqli/tests/bug46614.phpt
+++ b/ext/mysqli/tests/bug46614.phpt
@@ -11,13 +11,13 @@ if (!defined("MYSQLI_ASYNC")) {
--FILE--
<?php
class MySQL_Ext extends mysqli{
- protected $fooData = array();
+ protected $fooData = array();
- public function isEmpty()
- {
- $this->extData[] = 'Bar';
- return empty($this->extData);
- }
+ public function isEmpty()
+ {
+ $this->extData[] = 'Bar';
+ return empty($this->extData);
+ }
}
include ("connect.inc");
diff --git a/ext/mysqli/tests/bug47050.phpt b/ext/mysqli/tests/bug47050.phpt
index 0358802bac..ac305b07d2 100644
--- a/ext/mysqli/tests/bug47050.phpt
+++ b/ext/mysqli/tests/bug47050.phpt
@@ -10,22 +10,22 @@ if (!defined("MYSQLI_ASYNC")) {
?>
--FILE--
<?php
- include ("connect.inc");
+ include ("connect.inc");
- $link1 = my_mysqli_connect($host, $user, $passwd, null, $port, $socket);
- mysqli_select_db($link1, $db);
+ $link1 = my_mysqli_connect($host, $user, $passwd, null, $port, $socket);
+ mysqli_select_db($link1, $db);
- $link1->query("SELECT 'test'", MYSQLI_ASYNC);
- $all_links = array($link1);
- $links = $errors = $reject = $all_links;
- mysqli_poll($links, $errors, $reject, 1);
+ $link1->query("SELECT 'test'", MYSQLI_ASYNC);
+ $all_links = array($link1);
+ $links = $errors = $reject = $all_links;
+ mysqli_poll($links, $errors, $reject, 1);
- echo "links: ", sizeof($links), "\n";
- echo "errors: ", sizeof($errors), "\n";
- echo "reject: ", sizeof($reject), "\n";
- echo "all_links: ", sizeof($all_links), "\n";
+ echo "links: ", sizeof($links), "\n";
+ echo "errors: ", sizeof($errors), "\n";
+ echo "reject: ", sizeof($reject), "\n";
+ echo "all_links: ", sizeof($all_links), "\n";
- $link1->close();
+ $link1->close();
?>
--EXPECT--
links: 1
diff --git a/ext/mysqli/tests/bug48909.phpt b/ext/mysqli/tests/bug48909.phpt
index ef46c97c6a..3c7e09f17e 100644
--- a/ext/mysqli/tests/bug48909.phpt
+++ b/ext/mysqli/tests/bug48909.phpt
@@ -7,36 +7,36 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!($link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!($link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (!$link->query("DROP TABLE IF EXISTS test") ||
- !$link->query(sprintf("CREATE TABLE test(id INT, label varchar(255)) ENGINE = %s", $engine)))
- printf("[002] [%d] %s\n", $link->errno, $link->error);
+ if (!$link->query("DROP TABLE IF EXISTS test") ||
+ !$link->query(sprintf("CREATE TABLE test(id INT, label varchar(255)) ENGINE = %s", $engine)))
+ printf("[002] [%d] %s\n", $link->errno, $link->error);
- if (!$stmt = $link->prepare("INSERT INTO test(id, label) VALUES (?, ?)"))
- printf("[003] [%d] %s\n", $link->errno, $link->error);
+ if (!$stmt = $link->prepare("INSERT INTO test(id, label) VALUES (?, ?)"))
+ printf("[003] [%d] %s\n", $link->errno, $link->error);
- if (!$stmt->bind_param("bb",$bvar, $bvar))
- printf("[004] [%d] %s\n", $stmt->errno, $stmt->error);
+ if (!$stmt->bind_param("bb",$bvar, $bvar))
+ printf("[004] [%d] %s\n", $stmt->errno, $stmt->error);
- if (!$stmt->execute()) {
- if ($stmt->errno != 1366) {
- /*
- $bvar is null, b is for BLOB - any error like this should be OK:
- 1366 - Incorrect integer value: '' for column 'id' at row 1
- */
- printf("[005] [%d] %s\n", $stmt->errno, $stmt->error);
- }
- }
+ if (!$stmt->execute()) {
+ if ($stmt->errno != 1366) {
+ /*
+ $bvar is null, b is for BLOB - any error like this should be OK:
+ 1366 - Incorrect integer value: '' for column 'id' at row 1
+ */
+ printf("[005] [%d] %s\n", $stmt->errno, $stmt->error);
+ }
+ }
- $stmt->close();
- $link->close();
+ $stmt->close();
+ $link->close();
- echo "done";
+ echo "done";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/bug49027.phpt b/ext/mysqli/tests/bug49027.phpt
index 059d986584..4aa546cd26 100644
--- a/ext/mysqli/tests/bug49027.phpt
+++ b/ext/mysqli/tests/bug49027.phpt
@@ -7,44 +7,44 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- include ("connect.inc");
+ include ("connect.inc");
- $link = mysqli_init();
- if (!mysqli_options($link, MYSQLI_INIT_COMMAND, "SELECT 1")) {
- printf("[001] Cannot set INIT_COMMAND\n");
- }
+ $link = mysqli_init();
+ if (!mysqli_options($link, MYSQLI_INIT_COMMAND, "SELECT 1")) {
+ printf("[001] Cannot set INIT_COMMAND\n");
+ }
- if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
- printf("[002] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- }
+ if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
+ printf("[002] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
- var_dump($link->query("SELECT 42")->fetch_row());
+ var_dump($link->query("SELECT 42")->fetch_row());
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test") ||
- !mysqli_query($link, sprintf("CREATE TABLE test(id INT) ENGINE=%s", $engine))) {
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test") ||
+ !mysqli_query($link, sprintf("CREATE TABLE test(id INT) ENGINE=%s", $engine))) {
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- mysqli_close($link);
+ mysqli_close($link);
- $link = mysqli_init();
- if (!mysqli_options($link, MYSQLI_INIT_COMMAND, "INSERT INTO test(id) VALUES(1)")) {
- printf("[004] Cannot set INIT_COMMAND\n");
- }
+ $link = mysqli_init();
+ if (!mysqli_options($link, MYSQLI_INIT_COMMAND, "INSERT INTO test(id) VALUES(1)")) {
+ printf("[004] Cannot set INIT_COMMAND\n");
+ }
- if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
- printf("[005] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- }
+ if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
+ printf("[005] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
- if (!$res = mysqli_query($link, "SELECT id FROM test"))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, "SELECT id FROM test"))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump(mysqli_fetch_assoc($res));
+ var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
- mysqli_close($link);
+ mysqli_free_result($res);
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/bug49442.phpt b/ext/mysqli/tests/bug49442.phpt
index d9093f0347..22ff7552b7 100644
--- a/ext/mysqli/tests/bug49442.phpt
+++ b/ext/mysqli/tests/bug49442.phpt
@@ -22,87 +22,87 @@ mysqli.allow_persistent=1
mysqli.max_persistent=1
--FILE--
<?php
- include ("connect.inc");
-
- $link = mysqli_init();
- if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
- printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- }
-
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
- printf("[002] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
-
- if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE=' . $engine)) {
- printf("[003] Failed to create test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
-
- include("local_infile_tools.inc");
- $file = create_standard_csv(4);
-
- if (!@mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s'
- INTO TABLE test
- FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\''
- LINES TERMINATED BY '\n'",
- mysqli_real_escape_string($link, $file)))) {
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
-
- if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id"))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- $rows = array();
- while ($row = mysqli_fetch_assoc($res)) {
- var_dump($row);
- $rows[] = $row;
- }
-
- mysqli_free_result($res);
-
- mysqli_query($link, "DELETE FROM test");
- mysqli_close($link);
-
- if ($IS_MYSQLND) {
- /*
- mysqlnd makes a connection created through mysql_init()/mysqli_real_connect() always a 'persistent' one.
- At this point 'persistent' is not to be confused with what a user calls a 'persistent' - in this case
- 'persistent' means that mysqlnd uses malloc() instead of emalloc(). nothing else. ext/mysqli will
- not consider it as a 'persistent' connection in a user sense, ext/mysqli will not appy max_persistent etc.
- Its only about malloc() vs. emalloc().
-
- However, the bug is about malloc() and efree(). You can make make mysqlnd use malloc() by either using
- pconnect or mysql_init() - so we should test pconnect as well..
- */
- $host = 'p:' . $host;
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[007] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- }
-
- /* bug happened during query processing */
- if (!@mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s'
- INTO TABLE test
- FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\''
- LINES TERMINATED BY '\n'",
- mysqli_real_escape_string($link, $file)))) {
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
-
- /* we survived? that's good enough... */
-
- if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id"))
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- $i = 0;
- while ($row = mysqli_fetch_assoc($res)) {
- if (($row['id'] != $rows[$i]['id']) || ($row['label'] != $rows[$i]['label'])) {
- printf("[010] Wrong values, check manually!\n");
- }
- $i++;
- }
- mysqli_close($link);
- }
-
- print "done!";
+ include ("connect.inc");
+
+ $link = mysqli_init();
+ if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
+
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
+ printf("[002] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE=' . $engine)) {
+ printf("[003] Failed to create test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ include("local_infile_tools.inc");
+ $file = create_standard_csv(4);
+
+ if (!@mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s'
+ INTO TABLE test
+ FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\''
+ LINES TERMINATED BY '\n'",
+ mysqli_real_escape_string($link, $file)))) {
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id"))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ $rows = array();
+ while ($row = mysqli_fetch_assoc($res)) {
+ var_dump($row);
+ $rows[] = $row;
+ }
+
+ mysqli_free_result($res);
+
+ mysqli_query($link, "DELETE FROM test");
+ mysqli_close($link);
+
+ if ($IS_MYSQLND) {
+ /*
+ mysqlnd makes a connection created through mysql_init()/mysqli_real_connect() always a 'persistent' one.
+ At this point 'persistent' is not to be confused with what a user calls a 'persistent' - in this case
+ 'persistent' means that mysqlnd uses malloc() instead of emalloc(). nothing else. ext/mysqli will
+ not consider it as a 'persistent' connection in a user sense, ext/mysqli will not apply max_persistent etc.
+ Its only about malloc() vs. emalloc().
+
+ However, the bug is about malloc() and efree(). You can make make mysqlnd use malloc() by either using
+ pconnect or mysql_init() - so we should test pconnect as well..
+ */
+ $host = 'p:' . $host;
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[007] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
+
+ /* bug happened during query processing */
+ if (!@mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s'
+ INTO TABLE test
+ FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\''
+ LINES TERMINATED BY '\n'",
+ mysqli_real_escape_string($link, $file)))) {
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ /* we survived? that's good enough... */
+
+ if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id"))
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ $i = 0;
+ while ($row = mysqli_fetch_assoc($res)) {
+ if (($row['id'] != $rows[$i]['id']) || ($row['label'] != $rows[$i]['label'])) {
+ printf("[010] Wrong values, check manually!\n");
+ }
+ $i++;
+ }
+ mysqli_close($link);
+ }
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/bug50772.phpt b/ext/mysqli/tests/bug50772.phpt
index 9f26135c60..8987d0ac48 100644
--- a/ext/mysqli/tests/bug50772.phpt
+++ b/ext/mysqli/tests/bug50772.phpt
@@ -7,28 +7,28 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- include "connect.inc";
- $db1 = new mysqli();
+ include "connect.inc";
+ $db1 = new mysqli();
- // These calls fail
- $db1->options(MYSQLI_OPT_CONNECT_TIMEOUT, 3);
- my_mysqli_real_connect($db1, $host, $user, $passwd, $db, $port, $socket);
- if(mysqli_connect_error()) {
- echo "error 1\n";
- } else {
- echo "ok 1\n";
- }
+ // These calls fail
+ $db1->options(MYSQLI_OPT_CONNECT_TIMEOUT, 3);
+ my_mysqli_real_connect($db1, $host, $user, $passwd, $db, $port, $socket);
+ if(mysqli_connect_error()) {
+ echo "error 1\n";
+ } else {
+ echo "ok 1\n";
+ }
- $db2 = mysqli_init();
+ $db2 = mysqli_init();
- $db2->options(MYSQLI_OPT_CONNECT_TIMEOUT, 3);
- my_mysqli_real_connect($db2, $host, $user, $passwd, $db, $port, $socket);
- if(mysqli_connect_error()) {
- echo "error 2\n";
- } else {
- echo "ok 2\n";
- }
- echo "done\n";
+ $db2->options(MYSQLI_OPT_CONNECT_TIMEOUT, 3);
+ my_mysqli_real_connect($db2, $host, $user, $passwd, $db, $port, $socket);
+ if(mysqli_connect_error()) {
+ echo "error 2\n";
+ } else {
+ echo "ok 2\n";
+ }
+ echo "done\n";
?>
--EXPECT--
ok 1
diff --git a/ext/mysqli/tests/bug51605.phpt b/ext/mysqli/tests/bug51605.phpt
index c57a7b36d3..c3238da289 100644
--- a/ext/mysqli/tests/bug51605.phpt
+++ b/ext/mysqli/tests/bug51605.phpt
@@ -12,30 +12,30 @@ mysqli.max_persistent = 0
mysqli.reconnect = Off
--FILE--
<?php
- include ("connect.inc");
+ include ("connect.inc");
- $link = mysqli_init();
- if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
- printf("[002] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- }
- mysqli_close($link);
- echo "closed once\n";
+ $link = mysqli_init();
+ if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
+ printf("[002] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
+ mysqli_close($link);
+ echo "closed once\n";
- $link = mysqli_init();
- if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
- printf("[002] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- }
- mysqli_close($link);
- echo "closed twice\n";
+ $link = mysqli_init();
+ if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
+ printf("[002] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
+ mysqli_close($link);
+ echo "closed twice\n";
- $link = mysqli_init();
- if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
- printf("[003] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- }
- mysqli_close($link);
- echo "closed for third time\n";
+ $link = mysqli_init();
+ if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
+ printf("[003] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
+ mysqli_close($link);
+ echo "closed for third time\n";
- print "done!";
+ print "done!";
?>
--EXPECT--
closed once
diff --git a/ext/mysqli/tests/bug51647.phpt b/ext/mysqli/tests/bug51647.phpt
index cd7ccf8017..8fd107a95d 100644
--- a/ext/mysqli/tests/bug51647.phpt
+++ b/ext/mysqli/tests/bug51647.phpt
@@ -39,69 +39,69 @@ $link->close();
?>
--FILE--
<?php
- include ("connect.inc");
-
- if (!is_object($link = mysqli_init()))
- printf("[001] Cannot create link\n");
-
- if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, MYSQLI_CLIENT_SSL | MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT)) {
- printf("[003] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- }
-
- if (!$res = $link->query('SHOW STATUS like "Ssl_cipher"')) {
- if (1064 == $link->errno) {
- /* ERROR 1064 (42000): You have an error in your SQL syntax; = sql strict mode */
- if ($res = $link->query("SHOW STATUS")) {
- while ($row = $res->fetch_assoc())
- if ($row['Variable_name'] == 'Ssl_cipher')
- break;
- } else {
- printf("[005] [%d] %s\n", $link->errno, $link->error);
- }
- } else {
- printf("[004] [%d] %s\n", $link->errno, $link->error);
- }
- } else {
- if (!$row = $res->fetch_assoc())
- printf("[006] [%d] %s\n", $link->errno, $link->error);
- if (!strlen($row["Value"]))
- printf("[007] Empty cipher. No encrytion!");
- var_dump($row);
- }
-
- $link->close();
-
- if (!is_object($link = mysqli_init()))
- printf("[008] Cannot create link\n");
-
- if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, MYSQLI_CLIENT_SSL)) {
- printf("[009] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- }
-
- if (!$res = $link->query('SHOW STATUS like "Ssl_cipher"')) {
- if (1064 == $link->errno) {
- /* ERROR 1064 (42000): You have an error in your SQL syntax; = sql strict mode */
- if ($res = $link->query("SHOW STATUS")) {
- while ($row = $res->fetch_assoc())
- if ($row['Variable_name'] == 'Ssl_cipher')
- break;
- } else {
- printf("[010] [%d] %s\n", $link->errno, $link->error);
- }
- } else {
- printf("[011] [%d] %s\n", $link->errno, $link->error);
- }
- } else {
- if (!$row = $res->fetch_assoc())
- printf("[012] [%d] %s\n", $link->errno, $link->error);
- if (!strlen($row["Value"]))
- printf("[013] Empty cipher. No encrytion!");
- var_dump($row);
- }
-
- $link->close();
-
- print "done!";
+ include ("connect.inc");
+
+ if (!is_object($link = mysqli_init()))
+ printf("[001] Cannot create link\n");
+
+ if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, MYSQLI_CLIENT_SSL | MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT)) {
+ printf("[003] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
+
+ if (!$res = $link->query('SHOW STATUS like "Ssl_cipher"')) {
+ if (1064 == $link->errno) {
+ /* ERROR 1064 (42000): You have an error in your SQL syntax; = sql strict mode */
+ if ($res = $link->query("SHOW STATUS")) {
+ while ($row = $res->fetch_assoc())
+ if ($row['Variable_name'] == 'Ssl_cipher')
+ break;
+ } else {
+ printf("[005] [%d] %s\n", $link->errno, $link->error);
+ }
+ } else {
+ printf("[004] [%d] %s\n", $link->errno, $link->error);
+ }
+ } else {
+ if (!$row = $res->fetch_assoc())
+ printf("[006] [%d] %s\n", $link->errno, $link->error);
+ if (!strlen($row["Value"]))
+ printf("[007] Empty cipher. No encryption!");
+ var_dump($row);
+ }
+
+ $link->close();
+
+ if (!is_object($link = mysqli_init()))
+ printf("[008] Cannot create link\n");
+
+ if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, MYSQLI_CLIENT_SSL)) {
+ printf("[009] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
+
+ if (!$res = $link->query('SHOW STATUS like "Ssl_cipher"')) {
+ if (1064 == $link->errno) {
+ /* ERROR 1064 (42000): You have an error in your SQL syntax; = sql strict mode */
+ if ($res = $link->query("SHOW STATUS")) {
+ while ($row = $res->fetch_assoc())
+ if ($row['Variable_name'] == 'Ssl_cipher')
+ break;
+ } else {
+ printf("[010] [%d] %s\n", $link->errno, $link->error);
+ }
+ } else {
+ printf("[011] [%d] %s\n", $link->errno, $link->error);
+ }
+ } else {
+ if (!$row = $res->fetch_assoc())
+ printf("[012] [%d] %s\n", $link->errno, $link->error);
+ if (!strlen($row["Value"]))
+ printf("[013] Empty cipher. No encryption!");
+ var_dump($row);
+ }
+
+ $link->close();
+
+ print "done!";
?>
--EXPECTF--
array(2) {
diff --git a/ext/mysqli/tests/bug52082.phpt b/ext/mysqli/tests/bug52082.phpt
index 11157195ab..f601406e8f 100644
--- a/ext/mysqli/tests/bug52082.phpt
+++ b/ext/mysqli/tests/bug52082.phpt
@@ -8,19 +8,19 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
- $link = mysqli_init();
- $link->options(MYSQLI_SET_CHARSET_NAME, "latin2");
- if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
- die("can't connect");
- }
- var_dump($link->query("show variables like 'character_set_client'")->fetch_row());
- var_dump($link->query("show variables like 'character_set_connection'")->fetch_row());
- $link->change_user($user, $passwd, $db);
- var_dump($link->query("show variables like 'character_set_client'")->fetch_row());
- var_dump($link->query("show variables like 'character_set_connection'")->fetch_row());
+ require_once("connect.inc");
+ $link = mysqli_init();
+ $link->options(MYSQLI_SET_CHARSET_NAME, "latin2");
+ if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
+ die("can't connect");
+ }
+ var_dump($link->query("show variables like 'character_set_client'")->fetch_row());
+ var_dump($link->query("show variables like 'character_set_connection'")->fetch_row());
+ $link->change_user($user, $passwd, $db);
+ var_dump($link->query("show variables like 'character_set_client'")->fetch_row());
+ var_dump($link->query("show variables like 'character_set_connection'")->fetch_row());
- print "done!";
+ print "done!";
?>
--EXPECT--
array(2) {
diff --git a/ext/mysqli/tests/bug52891.phpt b/ext/mysqli/tests/bug52891.phpt
index 22fcb735e3..f069255639 100644
--- a/ext/mysqli/tests/bug52891.phpt
+++ b/ext/mysqli/tests/bug52891.phpt
@@ -10,90 +10,90 @@ if (!$IS_MYSQLND) {
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- }
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
- if (!$link->query("DROP TABLE IF EXISTS tuint") ||
- !$link->query("DROP TABLE IF EXISTS tsint")) {
- printf("[002] [%d] %s\n", $link->errno, $link->error);
- }
+ if (!$link->query("DROP TABLE IF EXISTS tuint") ||
+ !$link->query("DROP TABLE IF EXISTS tsint")) {
+ printf("[002] [%d] %s\n", $link->errno, $link->error);
+ }
- if (!$link->query("CREATE TABLE tuint(a BIGINT UNSIGNED) ENGINE=" . $engine) ||
- !$link->query("CREATE TABLE tsint(a BIGINT) ENGINE=" . $engine)) {
- printf("[003] [%d] %s\n", $link->errno, $link->error);
- }
+ if (!$link->query("CREATE TABLE tuint(a BIGINT UNSIGNED) ENGINE=" . $engine) ||
+ !$link->query("CREATE TABLE tsint(a BIGINT) ENGINE=" . $engine)) {
+ printf("[003] [%d] %s\n", $link->errno, $link->error);
+ }
- if (!$stmt1 = $link->prepare("INSERT INTO tuint VALUES(?)"))
- printf("[004] [%d] %s\n", $link->errno, $link->error);
+ if (!$stmt1 = $link->prepare("INSERT INTO tuint VALUES(?)"))
+ printf("[004] [%d] %s\n", $link->errno, $link->error);
- if (!$stmt2 = $link->prepare("INSERT INTO tsint VALUES(?)"))
- printf("[005] [%d] %s\n", $link->errno, $link->error);
+ if (!$stmt2 = $link->prepare("INSERT INTO tsint VALUES(?)"))
+ printf("[005] [%d] %s\n", $link->errno, $link->error);
- $param = 42;
+ $param = 42;
- if (!$stmt1->bind_param("i", $param))
- printf("[006] [%d] %s\n", $stmt1->errno, $stmt1->error);
+ if (!$stmt1->bind_param("i", $param))
+ printf("[006] [%d] %s\n", $stmt1->errno, $stmt1->error);
- if (!$stmt2->bind_param("i", $param))
- printf("[007] [%d] %s\n", $stmt2->errno, $stmt2->error);
+ if (!$stmt2->bind_param("i", $param))
+ printf("[007] [%d] %s\n", $stmt2->errno, $stmt2->error);
- /* first insert normal value to force initial send of types */
- if (!$stmt1->execute())
- printf("[008] [%d] %s\n", $stmt1->errno, $stmt1->error);
+ /* first insert normal value to force initial send of types */
+ if (!$stmt1->execute())
+ printf("[008] [%d] %s\n", $stmt1->errno, $stmt1->error);
- if (!$stmt2->execute())
- printf("[009] [%d] %s\n", $stmt2->errno, $stmt2->error);
+ if (!$stmt2->execute())
+ printf("[009] [%d] %s\n", $stmt2->errno, $stmt2->error);
- /* now try values that don't fit in long, on 32bit, new types should be sent or 0 will be inserted */
- $param = -4294967297;
- if (!$stmt2->execute())
- printf("[010] [%d] %s\n", $stmt2->errno, $stmt2->error);
+ /* now try values that don't fit in long, on 32bit, new types should be sent or 0 will be inserted */
+ $param = -4294967297;
+ if (!$stmt2->execute())
+ printf("[010] [%d] %s\n", $stmt2->errno, $stmt2->error);
- /* again normal value */
- $param = 43;
+ /* again normal value */
+ $param = 43;
- if (!$stmt1->execute())
- printf("[011] [%d] %s\n", $stmt1->errno, $stmt1->error);
+ if (!$stmt1->execute())
+ printf("[011] [%d] %s\n", $stmt1->errno, $stmt1->error);
- if (!$stmt2->execute())
- printf("[012] [%d] %s\n", $stmt2->errno, $stmt2->error);
+ if (!$stmt2->execute())
+ printf("[012] [%d] %s\n", $stmt2->errno, $stmt2->error);
- /* again conversion */
- $param = -4294967295;
- if (!$stmt2->execute())
- printf("[013] [%d] %s\n", $stmt2->errno, $stmt2->error);
+ /* again conversion */
+ $param = -4294967295;
+ if (!$stmt2->execute())
+ printf("[013] [%d] %s\n", $stmt2->errno, $stmt2->error);
- $param = 4294967295;
- if (!$stmt1->execute())
- printf("[014] [%d] %s\n", $stmt1->errno, $stmt1->error);
+ $param = 4294967295;
+ if (!$stmt1->execute())
+ printf("[014] [%d] %s\n", $stmt1->errno, $stmt1->error);
- if (!$stmt2->execute())
- printf("[015] [%d] %s\n", $stmt2->errno, $stmt2->error);
+ if (!$stmt2->execute())
+ printf("[015] [%d] %s\n", $stmt2->errno, $stmt2->error);
- $param = 4294967297;
- if (!$stmt1->execute())
- printf("[016] [%d] %s\n", $stmt1->errno, $stmt1->error);
+ $param = 4294967297;
+ if (!$stmt1->execute())
+ printf("[016] [%d] %s\n", $stmt1->errno, $stmt1->error);
- if (!$stmt2->execute())
- printf("[017] [%d] %s\n", $stmt2->errno, $stmt2->error);
+ if (!$stmt2->execute())
+ printf("[017] [%d] %s\n", $stmt2->errno, $stmt2->error);
- $result = $link->query("SELECT * FROM tsint ORDER BY a ASC");
- $result2 = $link->query("SELECT * FROM tuint ORDER BY a ASC");
+ $result = $link->query("SELECT * FROM tsint ORDER BY a ASC");
+ $result2 = $link->query("SELECT * FROM tuint ORDER BY a ASC");
- echo "tsint:\n";
- while ($row = $result->fetch_assoc()) {
- var_dump($row);
- }
- echo "tuint:\n";
- while ($row = $result2->fetch_assoc()) {
- var_dump($row);
- }
+ echo "tsint:\n";
+ while ($row = $result->fetch_assoc()) {
+ var_dump($row);
+ }
+ echo "tuint:\n";
+ while ($row = $result2->fetch_assoc()) {
+ var_dump($row);
+ }
- echo "done";
+ echo "done";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/bug53503.phpt b/ext/mysqli/tests/bug53503.phpt
index fea62fde79..b71afe28c7 100644
--- a/ext/mysqli/tests/bug53503.phpt
+++ b/ext/mysqli/tests/bug53503.phpt
@@ -19,33 +19,33 @@ mysqli_close($link);
mysqli.allow_local_infile=1
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- }
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
- if (!$link->query("DROP TABLE IF EXISTS test")) {
- printf("[002] [%d] %s\n", $link->errno, $link->error);
- }
+ if (!$link->query("DROP TABLE IF EXISTS test")) {
+ printf("[002] [%d] %s\n", $link->errno, $link->error);
+ }
- if (!$link->query("CREATE TABLE test (dump1 INT UNSIGNED NOT NULL PRIMARY KEY) ENGINE=" . $engine)) {
- printf("[003] [%d] %s\n", $link->errno, $link->error);
- }
+ if (!$link->query("CREATE TABLE test (dump1 INT UNSIGNED NOT NULL PRIMARY KEY) ENGINE=" . $engine)) {
+ printf("[003] [%d] %s\n", $link->errno, $link->error);
+ }
- if (FALSE == file_put_contents('bug53503.data', "1\n2\n3\n"))
- printf("[004] Failed to create CVS file\n");
+ if (FALSE == file_put_contents('bug53503.data', "1\n2\n3\n"))
+ printf("[004] Failed to create CVS file\n");
- if (!$link->query("SELECT 1 FROM DUAL"))
- printf("[005] [%d] %s\n", $link->errno, $link->error);
+ if (!$link->query("SELECT 1 FROM DUAL"))
+ printf("[005] [%d] %s\n", $link->errno, $link->error);
- if (!$link->query("LOAD DATA LOCAL INFILE 'bug53503.data' INTO TABLE test")) {
- printf("[006] [%d] %s\n", $link->errno, $link->error);
- echo "bug";
- } else {
- echo "done";
- }
- $link->close();
+ if (!$link->query("LOAD DATA LOCAL INFILE 'bug53503.data' INTO TABLE test")) {
+ printf("[006] [%d] %s\n", $link->errno, $link->error);
+ echo "bug";
+ } else {
+ echo "done";
+ }
+ $link->close();
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/bug54221.phpt b/ext/mysqli/tests/bug54221.phpt
index eef4695327..602ea68583 100644
--- a/ext/mysqli/tests/bug54221.phpt
+++ b/ext/mysqli/tests/bug54221.phpt
@@ -12,34 +12,34 @@ mysqli.max_persistent = 0
mysqli.reconnect = Off
--FILE--
<?php
- include ("connect.inc");
+ include ("connect.inc");
- $link = mysqli_init();
- if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
- printf("[002] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- }
+ $link = mysqli_init();
+ if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
+ printf("[002] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
- $create = "CREATE TEMPORARY TABLE IF NOT EXISTS t54221(a int)";
+ $create = "CREATE TEMPORARY TABLE IF NOT EXISTS t54221(a int)";
- $query = "$create;$create;$create;";
- if ($link->multi_query($query)) {
- do {
- $sth = $link->store_result();
+ $query = "$create;$create;$create;";
+ if ($link->multi_query($query)) {
+ do {
+ $sth = $link->store_result();
- if ($link->warning_count) {
- $warnings = $link->get_warnings();
- if ($warnings) {
- do {
- echo "Warning: ".$warnings->errno.": ".$warnings->message."\n";
- } while ($warnings->next());
- }
- }
- } while ($link->more_results() && $link->next_result());
- }
+ if ($link->warning_count) {
+ $warnings = $link->get_warnings();
+ if ($warnings) {
+ do {
+ echo "Warning: ".$warnings->errno.": ".$warnings->message."\n";
+ } while ($warnings->next());
+ }
+ }
+ } while ($link->more_results() && $link->next_result());
+ }
- mysqli_close($link);
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--EXPECT--
Warning: 1050: Table 't54221' already exists
diff --git a/ext/mysqli/tests/bug54674.phpt b/ext/mysqli/tests/bug54674.phpt
index e18eed7f99..b3c44be290 100644
--- a/ext/mysqli/tests/bug54674.phpt
+++ b/ext/mysqli/tests/bug54674.phpt
@@ -12,19 +12,19 @@ mysqli.max_persistent = 0
mysqli.reconnect = Off
--FILE--
<?php
- include ("connect.inc");
+ include ("connect.inc");
- $link = mysqli_init();
- if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
- printf("[002] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- }
+ $link = mysqli_init();
+ if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
+ printf("[002] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
- $japanese_so = pack('H4', '835c');
- $link->set_charset('sjis');
- var_dump($link->real_escape_string($japanese_so) === $japanese_so);
- mysqli_close($link);
+ $japanese_so = pack('H4', '835c');
+ $link->set_charset('sjis');
+ var_dump($link->real_escape_string($japanese_so) === $japanese_so);
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--EXPECT--
bool(true)
diff --git a/ext/mysqli/tests/bug55283.phpt b/ext/mysqli/tests/bug55283.phpt
index 843400ff98..306a4af156 100644
--- a/ext/mysqli/tests/bug55283.phpt
+++ b/ext/mysqli/tests/bug55283.phpt
@@ -39,28 +39,28 @@ $link->close();
?>
--FILE--
<?php
- require_once "connect.inc";
- $db1 = new mysqli();
+ require_once "connect.inc";
+ $db1 = new mysqli();
- $flags = MYSQLI_CLIENT_SSL | MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT;
+ $flags = MYSQLI_CLIENT_SSL | MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT;
- $link = mysqli_init();
- mysqli_ssl_set($link, null, null, null, null, "AES256-SHA");
- if (my_mysqli_real_connect($link, 'p:' . $host, $user, $passwd, $db, $port, null, $flags)) {
- $r = $link->query("SHOW STATUS LIKE 'Ssl_cipher'");
- var_dump($r->fetch_row());
- }
+ $link = mysqli_init();
+ mysqli_ssl_set($link, null, null, null, null, "AES256-SHA");
+ if (my_mysqli_real_connect($link, 'p:' . $host, $user, $passwd, $db, $port, null, $flags)) {
+ $r = $link->query("SHOW STATUS LIKE 'Ssl_cipher'");
+ var_dump($r->fetch_row());
+ }
- /* non-persistent connection */
- $link2 = mysqli_init();
- mysqli_ssl_set($link2, null, null, null, null, "AES256-SHA");
- if (my_mysqli_real_connect($link2, $host, $user, $passwd, $db, $port, null, $flags)) {
- $r2 = $link2->query("SHOW STATUS LIKE 'Ssl_cipher'");
- var_dump($r2->fetch_row());
- }
+ /* non-persistent connection */
+ $link2 = mysqli_init();
+ mysqli_ssl_set($link2, null, null, null, null, "AES256-SHA");
+ if (my_mysqli_real_connect($link2, $host, $user, $passwd, $db, $port, null, $flags)) {
+ $r2 = $link2->query("SHOW STATUS LIKE 'Ssl_cipher'");
+ var_dump($r2->fetch_row());
+ }
- echo "done\n";
+ echo "done\n";
?>
--EXPECTF--
array(2) {
diff --git a/ext/mysqli/tests/bug55582.phpt b/ext/mysqli/tests/bug55582.phpt
index 132a731d0c..86626c0279 100644
--- a/ext/mysqli/tests/bug55582.phpt
+++ b/ext/mysqli/tests/bug55582.phpt
@@ -8,21 +8,21 @@ require_once("connect.inc");
?>
--FILE--
<?php
- include "connect.inc";
- if (!($link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))) {
- printf("[001] Cannot connect to the server");
- }
+ include "connect.inc";
+ if (!($link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))) {
+ printf("[001] Cannot connect to the server");
+ }
- var_dump($link->real_query("SELECT 1"));
- $res = $link->use_result();
- var_dump(mysqli_num_rows($res));
- var_dump($res->fetch_assoc());
- var_dump(mysqli_num_rows($res));
- var_dump($res->fetch_assoc());
- var_dump(mysqli_num_rows($res));
+ var_dump($link->real_query("SELECT 1"));
+ $res = $link->use_result();
+ var_dump(mysqli_num_rows($res));
+ var_dump($res->fetch_assoc());
+ var_dump(mysqli_num_rows($res));
+ var_dump($res->fetch_assoc());
+ var_dump(mysqli_num_rows($res));
- $link->close();
- echo "done\n";
+ $link->close();
+ echo "done\n";
?>
--EXPECTF--
bool(true)
diff --git a/ext/mysqli/tests/bug55653.phpt b/ext/mysqli/tests/bug55653.phpt
index 80e654771c..a51a7ddd22 100644
--- a/ext/mysqli/tests/bug55653.phpt
+++ b/ext/mysqli/tests/bug55653.phpt
@@ -7,30 +7,30 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- }
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
- $in_and_out = "a";
+ $in_and_out = "a";
- if (!($stmt = $link->stmt_init()))
- printf("[002] [%d] %s\n", $link->errno, $link->error);
+ if (!($stmt = $link->stmt_init()))
+ printf("[002] [%d] %s\n", $link->errno, $link->error);
- if (!($stmt->prepare("SELECT ?")) ||
- !($stmt->bind_param("s", $in_and_out)) ||
- !($stmt->execute()) ||
- !($stmt->bind_result($in_and_out)))
- printf("[003] [%d] %s\n", $stmt->errno, $stmt->error);
+ if (!($stmt->prepare("SELECT ?")) ||
+ !($stmt->bind_param("s", $in_and_out)) ||
+ !($stmt->execute()) ||
+ !($stmt->bind_result($in_and_out)))
+ printf("[003] [%d] %s\n", $stmt->errno, $stmt->error);
- if (!$stmt->fetch())
- printf("[004] [%d] %s\n", $stmt->errno, $stmt->error);
+ if (!$stmt->fetch())
+ printf("[004] [%d] %s\n", $stmt->errno, $stmt->error);
- if ("a" !== $in_and_out)
- printf("[005] Wrong result: '%s'\n", $in_and_out);
+ if ("a" !== $in_and_out)
+ printf("[005] Wrong result: '%s'\n", $in_and_out);
- echo "done!";
+ echo "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/bug62046.phpt b/ext/mysqli/tests/bug62046.phpt
index e996de361d..5913ef399e 100644
--- a/ext/mysqli/tests/bug62046.phpt
+++ b/ext/mysqli/tests/bug62046.phpt
@@ -7,33 +7,33 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- }
- if (FALSE === ($stmt = $link->prepare('SELECT 42'))) {
- printf("[002] Prepare failed, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- if (FALSE === $stmt->execute()) {
- printf("[003] Execute failed, [%d] %s\n", $stmt->errorno, $stmt->error);
- }
- if (FALSE === $stmt->store_result()) {
- printf("[004] store_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
- }
- $one = NULL;
- if (FALSE === $stmt->bind_result($one)) {
- printf("[005] bind_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
- }
- if (FALSE === $stmt->reset()) {
- printf("[006] bind_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
- }
- while ($stmt->fetch()) {
- var_dump($one);
- }
- $stmt->close();
- $link->close();
- echo "done!";
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
+ if (FALSE === ($stmt = $link->prepare('SELECT 42'))) {
+ printf("[002] Prepare failed, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ if (FALSE === $stmt->execute()) {
+ printf("[003] Execute failed, [%d] %s\n", $stmt->errorno, $stmt->error);
+ }
+ if (FALSE === $stmt->store_result()) {
+ printf("[004] store_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
+ }
+ $one = NULL;
+ if (FALSE === $stmt->bind_result($one)) {
+ printf("[005] bind_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
+ }
+ if (FALSE === $stmt->reset()) {
+ printf("[006] bind_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
+ }
+ while ($stmt->fetch()) {
+ var_dump($one);
+ }
+ $stmt->close();
+ $link->close();
+ echo "done!";
?>
--EXPECT--
int(42)
diff --git a/ext/mysqli/tests/bug63398.phpt b/ext/mysqli/tests/bug63398.phpt
index b6e6c2549d..278c5c4a96 100644
--- a/ext/mysqli/tests/bug63398.phpt
+++ b/ext/mysqli/tests/bug63398.phpt
@@ -19,18 +19,14 @@ mysqli_close($link);
$read = $error = $reject = array();
$read[] = $error[] = $reject[] = $link;
-mysqli_poll($read, $error, $reject, 1);
+try {
+ mysqli_poll($read, $error, $reject, 1);
+} catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+}
echo "okey";
?>
--EXPECTF--
-Warning: mysqli_poll(): [1] Couldn't fetch mysqli in %sbug63398.php on line %d
-
-Warning: mysqli_poll(): [1] Couldn't fetch mysqli in %sbug63398.php on line %d
-
-Warning: mysqli_poll(): No stream arrays were passed in %sbug63398.php on line %d
-
-Warning: mysqli_poll(): [1] Couldn't fetch mysqli in %sbug63398.php on line %d
-
-Warning: mysqli_poll(): [1] Couldn't fetch mysqli in %sbug63398.php on line %d
+mysqli object is already closed
okey
diff --git a/ext/mysqli/tests/bug66043.phpt b/ext/mysqli/tests/bug66043.phpt
index 54ddf6943c..07714f217a 100644
--- a/ext/mysqli/tests/bug66043.phpt
+++ b/ext/mysqli/tests/bug66043.phpt
@@ -13,7 +13,7 @@ require_once('skipifconnectfailure.inc');
<?php
require 'connect.inc';
if (!$db = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
}
$stmt = $db->stmt_init();
diff --git a/ext/mysqli/tests/bug66124.phpt b/ext/mysqli/tests/bug66124.phpt
index d5dec314cf..cede635e14 100644
--- a/ext/mysqli/tests/bug66124.phpt
+++ b/ext/mysqli/tests/bug66124.phpt
@@ -23,9 +23,9 @@ $id = '1311200011005001566';
require_once('connect.inc');
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- exit(1);
+ printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ exit(1);
}
$link->query($table_drop);
@@ -33,8 +33,8 @@ $link->query($table_create);
$stmt = $link->prepare($table_insert);
if (!$stmt) {
- printf("Can't prepare\n");
- exit(1);
+ printf("Can't prepare\n");
+ exit(1);
}
echo "Using 'i':\n";
@@ -43,8 +43,8 @@ $stmt->bind_param('i', $id);
if ($stmt->execute()){
echo "insert id:{$id}=>{$stmt->insert_id}\n";
} else {
- printf("Can't execute\n");
- exit(1);
+ printf("Can't execute\n");
+ exit(1);
}
@@ -55,8 +55,8 @@ if ($result){
echo "fetch id:{$row['id']}\n";
}
} else {
- printf("Can't select\n");
- exit(1);
+ printf("Can't select\n");
+ exit(1);
}
$stmt->close();
@@ -73,8 +73,8 @@ echo "Using 's':\n";
if ($stmt->execute()){
echo "insert id:{$id}\n";
} else{
- printf("Can't execute\n");
- exit(1);
+ printf("Can't execute\n");
+ exit(1);
}
$result = $link->query($table_select);
@@ -84,8 +84,8 @@ if ($result){
echo "fetch id:{$row['id']}\n";
}
} else {
- printf("Can't select\n");
- exit(1);
+ printf("Can't select\n");
+ exit(1);
}
$link->close();
diff --git a/ext/mysqli/tests/bug66762.phpt b/ext/mysqli/tests/bug66762.phpt
index f5240bc926..c1f749d8c4 100644
--- a/ext/mysqli/tests/bug66762.phpt
+++ b/ext/mysqli/tests/bug66762.phpt
@@ -7,18 +7,18 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!$mysqli = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- }
+ if (!$mysqli = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
- $read_stmt = $mysqli->prepare("SELECT 1");
+ $read_stmt = $mysqli->prepare("SELECT 1");
- var_dump($read_stmt->bind_result($data));
+ var_dump($read_stmt->bind_result($data));
- unset($mysqli);
- var_dump($read_stmt->bind_result($data));
+ unset($mysqli);
+ var_dump($read_stmt->bind_result($data));
?>
done!
--EXPECT--
diff --git a/ext/mysqli/tests/bug67839.phpt b/ext/mysqli/tests/bug67839.phpt
index f36c2bf6e7..4e8fd68ffd 100644
--- a/ext/mysqli/tests/bug67839.phpt
+++ b/ext/mysqli/tests/bug67839.phpt
@@ -10,55 +10,55 @@ mysqli_float_handling - ensure 4 byte float is handled correctly
precision=5
--FILE--
<?php
- require('connect.inc');
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- die();
- }
+ require('connect.inc');
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ die();
+ }
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- die();
- }
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ die();
+ }
- if (!mysqli_query($link, "CREATE TABLE test(id INT PRIMARY KEY, fp4 FLOAT, fp8 DOUBLE) ENGINE = InnoDB")) {
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- die();
- }
+ if (!mysqli_query($link, "CREATE TABLE test(id INT PRIMARY KEY, fp4 FLOAT, fp8 DOUBLE) ENGINE = InnoDB")) {
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ die();
+ }
- // Insert via string to make sure the real floating number gets to the DB
- if (!mysqli_query($link, "INSERT INTO test(id, fp4, fp8) VALUES (1, 9.9999, 9.9999)")) {
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- die();
- }
+ // Insert via string to make sure the real floating number gets to the DB
+ if (!mysqli_query($link, "INSERT INTO test(id, fp4, fp8) VALUES (1, 9.9999, 9.9999)")) {
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ die();
+ }
- if (!($stmt = mysqli_prepare($link, "SELECT id, fp4, fp8 FROM test"))) {
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- die();
- }
+ if (!($stmt = mysqli_prepare($link, "SELECT id, fp4, fp8 FROM test"))) {
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ die();
+ }
- $id = null;
- $fp4 = null;
- $fp8 = null;
+ $id = null;
+ $fp4 = null;
+ $fp8 = null;
- if (!mysqli_stmt_bind_result($stmt, $id, $fp4, $fp8)) {
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- die();
- }
+ if (!mysqli_stmt_bind_result($stmt, $id, $fp4, $fp8)) {
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ die();
+ }
- if (!mysqli_stmt_execute($stmt)) {
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- die();
- }
+ if (!mysqli_stmt_execute($stmt)) {
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ die();
+ }
- if (!(mysqli_stmt_fetch($stmt))) {
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- die();
- }
+ if (!(mysqli_stmt_fetch($stmt))) {
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ die();
+ }
- print $id . ": " . $fp4 . ": " . $fp8 . "\n";
+ print $id . ": " . $fp4 . ": " . $fp8 . "\n";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/bug68077.phpt b/ext/mysqli/tests/bug68077.phpt
index 639603aa50..8e5ccfb410 100644
--- a/ext/mysqli/tests/bug68077.phpt
+++ b/ext/mysqli/tests/bug68077.phpt
@@ -23,42 +23,42 @@ mysqli.max_persistent=1
open_basedir=
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- ini_set("open_basedir", __DIR__);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- }
+ ini_set("open_basedir", __DIR__);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
- if (!$link->query("DROP TABLE IF EXISTS test")) {
- printf("[002] [%d] %s\n", $link->errno, $link->error);
- }
+ if (!$link->query("DROP TABLE IF EXISTS test")) {
+ printf("[002] [%d] %s\n", $link->errno, $link->error);
+ }
- if (!$link->query("CREATE TABLE test (dump1 INT UNSIGNED NOT NULL PRIMARY KEY) ENGINE=" . $engine)) {
- printf("[003] [%d] %s\n", $link->errno, $link->error);
- }
+ if (!$link->query("CREATE TABLE test (dump1 INT UNSIGNED NOT NULL PRIMARY KEY) ENGINE=" . $engine)) {
+ printf("[003] [%d] %s\n", $link->errno, $link->error);
+ }
- if (FALSE == file_put_contents(__DIR__ . '/bug53503.data', "1\n2\n3\n"))
- printf("[004] Failed to create CVS file\n");
+ if (FALSE == file_put_contents(__DIR__ . '/bug53503.data', "1\n2\n3\n"))
+ printf("[004] Failed to create CVS file\n");
- if (!$link->query("SELECT 1 FROM DUAL"))
- printf("[005] [%d] %s\n", $link->errno, $link->error);
+ if (!$link->query("SELECT 1 FROM DUAL"))
+ printf("[005] [%d] %s\n", $link->errno, $link->error);
- if (!$link->query("LOAD DATA LOCAL INFILE '" . str_replace("\\", "/", __DIR__) . "/bug53503.data' INTO TABLE test")) {
- printf("[006] [%d] %s\n", $link->errno, $link->error);
- echo "bug\n";
- } else {
- echo "done\n";
- }
+ if (!$link->query("LOAD DATA LOCAL INFILE '" . str_replace("\\", "/", __DIR__) . "/bug53503.data' INTO TABLE test")) {
+ printf("[006] [%d] %s\n", $link->errno, $link->error);
+ echo "bug\n";
+ } else {
+ echo "done\n";
+ }
- ini_set("open_basedir", __DIR__ . "/dummy");
- if (!$link->query("LOAD DATA LOCAL INFILE '" . __DIR__ . "/bug53503.data' INTO TABLE test")) {
- printf("[006] [%d] %s\n", $link->errno, $link->error);
- echo "done\n";
- } else {
- echo "bug\n";
- }
- $link->close();
+ ini_set("open_basedir", __DIR__ . "/dummy");
+ if (!$link->query("LOAD DATA LOCAL INFILE '" . __DIR__ . "/bug53503.data' INTO TABLE test")) {
+ printf("[006] [%d] %s\n", $link->errno, $link->error);
+ echo "done\n";
+ } else {
+ echo "bug\n";
+ }
+ $link->close();
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/bug69899.phpt b/ext/mysqli/tests/bug69899.phpt
index 6859b91c13..da69e3c629 100644
--- a/ext/mysqli/tests/bug69899.phpt
+++ b/ext/mysqli/tests/bug69899.phpt
@@ -26,9 +26,9 @@ $mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket);
$stmt = $mysqli->prepare('SELECT 1');
var_dump(
- $mysqli->close(),
- $stmt->free_result(),
- $stmt->close()
+ $mysqli->close(),
+ $stmt->free_result(),
+ $stmt->close()
);
?>
diff --git a/ext/mysqli/tests/bug70384.phpt b/ext/mysqli/tests/bug70384.phpt
index 0f062f0035..27b9d16f25 100644
--- a/ext/mysqli/tests/bug70384.phpt
+++ b/ext/mysqli/tests/bug70384.phpt
@@ -19,40 +19,40 @@ mysqli_float_handling - ensure 4 byte float is handled correctly
?>
--FILE--
<?php
- require('connect.inc');
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- die();
- }
+ require('connect.inc');
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ die();
+ }
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- die();
- }
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ die();
+ }
- if (!mysqli_query($link, "CREATE TABLE test(jsfield JSON) ENGINE = InnoDB")) {
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- die();
- }
- $jsfield_data = '{"aaa": 123}';
- // Insert via string to make sure the real floating number gets to the DB
- if (!mysqli_query($link, "INSERT INTO test VALUES ('".$jsfield_data."')")) {
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- die();
- }
+ if (!mysqli_query($link, "CREATE TABLE test(jsfield JSON) ENGINE = InnoDB")) {
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ die();
+ }
+ $jsfield_data = '{"aaa": 123}';
+ // Insert via string to make sure the real floating number gets to the DB
+ if (!mysqli_query($link, "INSERT INTO test VALUES ('".$jsfield_data."')")) {
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ die();
+ }
- if (!($res = mysqli_query($link, "SELECT * FROM test"))) {
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- die();
- }
- $rows = $res->fetch_all();
- if (json_encode($rows[0][0]) != json_encode($jsfield_data)) {
- printf("[006] Data differs");
- var_dump(json_encode($rows[0][0]) != json_encode($jsfield_data));
- die();
- }
- mysqli_close($link);
- echo "OK";
+ if (!($res = mysqli_query($link, "SELECT * FROM test"))) {
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ die();
+ }
+ $rows = $res->fetch_all();
+ if (json_encode($rows[0][0]) != json_encode($jsfield_data)) {
+ printf("[006] Data differs");
+ var_dump(json_encode($rows[0][0]) != json_encode($jsfield_data));
+ die();
+ }
+ mysqli_close($link);
+ echo "OK";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/bug70949.phpt b/ext/mysqli/tests/bug70949.phpt
index dc7b202152..b9ad29b6b8 100644
--- a/ext/mysqli/tests/bug70949.phpt
+++ b/ext/mysqli/tests/bug70949.phpt
@@ -22,25 +22,25 @@ $sql = "select * from bug70949";
if ($stmt = $mysql->prepare($sql))
{
- $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_READ_ONLY);
+ $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_READ_ONLY);
- if ($stmt->bind_result($name)) {
- {
- if ($stmt->execute())
- {
- while ($stmt->fetch())
- {
- var_dump($name);
- }
- }
- }
+ if ($stmt->bind_result($name)) {
+ {
+ if ($stmt->execute())
+ {
+ while ($stmt->fetch())
+ {
+ var_dump($name);
+ }
+ }
+ }
- $stmt->free_result();
- $stmt->close();
- }
+ $stmt->free_result();
+ $stmt->close();
+ }
- $mysql->close();
+ $mysql->close();
}
?>
diff --git a/ext/mysqli/tests/bug72701.phpt b/ext/mysqli/tests/bug72701.phpt
index f0eb174172..2145de9b48 100644
--- a/ext/mysqli/tests/bug72701.phpt
+++ b/ext/mysqli/tests/bug72701.phpt
@@ -19,14 +19,12 @@ require_once("connect.inc");
$con = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
if (mysqli_connect_errno()) {
- echo "Failed to connect to MySQL: " . mysqli_connect_error();
+ echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
var_dump(preg_match(",(127.0.0.1|localhost) via .*,i", mysqli_get_host_info($con)));
mysqli_close($con);
?>
-==DONE==
--EXPECT--
int(1)
-==DONE==
diff --git a/ext/mysqli/tests/bug73462.phpt b/ext/mysqli/tests/bug73462.phpt
index 5fb978feb1..1aa18d7fb6 100644
--- a/ext/mysqli/tests/bug73462.phpt
+++ b/ext/mysqli/tests/bug73462.phpt
@@ -8,34 +8,39 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- /* Initial persistent connection */
- $mysql_1 = new mysqli('p:'.$host, $user, $passwd, $db);
- $result = $mysql_1->query("SHOW STATUS LIKE 'Connections'");
- $c1 = $result->fetch_row();
- $result->free();
- $mysql_1->close();
+ /* Initial persistent connection */
+ $mysql_1 = new mysqli('p:'.$host, $user, $passwd, $db);
+ $result = $mysql_1->query("SHOW STATUS LIKE 'Connections'");
+ $c1 = $result->fetch_row();
+ $result->free();
+ $mysql_1->close();
- /* Failed connection to invalid host */
- $mysql_2 = @new mysqli(' !!! invalid !!! ', $user, $passwd, $db);
- @$mysql_2->close();
+ /* Failed connection to invalid host */
+ $mysql_2 = @new mysqli(' !!! invalid !!! ', $user, $passwd, $db);
+ try {
+ $mysql_2->close();
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- /* Re-use persistent connection */
- $mysql_3 = new mysqli('p:'.$host, $user, $passwd, $db);
- $error = mysqli_connect_errno();
- $result = $mysql_3->query("SHOW STATUS LIKE 'Connections'");
- $c3 = $result->fetch_row();
- $result->free();
- $mysql_3->close();
+ /* Re-use persistent connection */
+ $mysql_3 = new mysqli('p:'.$host, $user, $passwd, $db);
+ $error = mysqli_connect_errno();
+ $result = $mysql_3->query("SHOW STATUS LIKE 'Connections'");
+ $c3 = $result->fetch_row();
+ $result->free();
+ $mysql_3->close();
- if (end($c1) !== end($c3))
- printf("[001] Expected '%d' got '%d'.\n", end($c1), end($c3));
+ if (end($c1) !== end($c3))
+ printf("[001] Expected '%d' got '%d'.\n", end($c1), end($c3));
- if ($error !== 0)
- printf("[002] Expected '0' got '%d'.\n", $error);
+ if ($error !== 0)
+ printf("[002] Expected '0' got '%d'.\n", $error);
- print "done!";
+ print "done!";
?>
--EXPECT--
+mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/bug74547.phpt b/ext/mysqli/tests/bug74547.phpt
index 940357ad04..90d790dc9e 100644
--- a/ext/mysqli/tests/bug74547.phpt
+++ b/ext/mysqli/tests/bug74547.phpt
@@ -7,19 +7,17 @@ Bug #74547 mysqli::change_user() doesn't accept null as $database argument w/str
?>
--FILE--
<?php
- declare(strict_types=1);
+ declare(strict_types=1);
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- var_dump(mysqli_change_user($link, $user, $passwd, NULL));
+ var_dump(mysqli_change_user($link, $user, $passwd, NULL));
- mysqli_close($link);
+ mysqli_close($link);
?>
-===DONE===
--EXPECT--
bool(true)
-===DONE===
diff --git a/ext/mysqli/tests/bug74737.phpt b/ext/mysqli/tests/bug74737.phpt
index e3aca90ea7..d270c198fd 100644
--- a/ext/mysqli/tests/bug74737.phpt
+++ b/ext/mysqli/tests/bug74737.phpt
@@ -13,5 +13,5 @@ echo PHP_EOL;
echo $rf->getNumberOfRequiredParameters();
?>
--EXPECT--
-0
+1
0
diff --git a/ext/mysqli/tests/bug74968.phpt b/ext/mysqli/tests/bug74968.phpt
index f78fa92d83..e3e971eb1f 100644
--- a/ext/mysqli/tests/bug74968.phpt
+++ b/ext/mysqli/tests/bug74968.phpt
@@ -7,13 +7,13 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $mysqli = new mysqli("$host:$port", $user, $passwd, $db);
- abstract class test {
- public $a;
- }
- $mysqli->query("SELECT 1 as a")->fetch_object("test");
+ $mysqli = new mysqli("$host:$port", $user, $passwd, $db);
+ abstract class test {
+ public $a;
+ }
+ $mysqli->query("SELECT 1 as a")->fetch_object("test");
?>
==DONE==
--EXPECTF--
diff --git a/ext/mysqli/tests/bug75018.phpt b/ext/mysqli/tests/bug75018.phpt
index 20d836166b..28af0bb77c 100644
--- a/ext/mysqli/tests/bug75018.phpt
+++ b/ext/mysqli/tests/bug75018.phpt
@@ -27,12 +27,10 @@ $sql = "SELECT bit_column_1 FROM $tbl";
$result = $mysqli->query($sql);
while ($row = $result->fetch_assoc()) {
- var_dump($row['bit_column_1']);
+ var_dump($row['bit_column_1']);
}
?>
-==DONE==
--EXPECT--
string(1) "0"
string(4) "1365"
-==DONE==
diff --git a/ext/mysqli/tests/bug75434.phpt b/ext/mysqli/tests/bug75434.phpt
index 751ad4eb8f..1bc325e29f 100644
--- a/ext/mysqli/tests/bug75434.phpt
+++ b/ext/mysqli/tests/bug75434.phpt
@@ -15,10 +15,8 @@ $rm = new ReflectionMethod('mysqli_result', 'fetch_all');
var_dump($rm->getNumberOfParameters());
var_dump($rm->getNumberOfRequiredParameters());
?>
-===DONE===
--EXPECT--
int(2)
int(1)
int(1)
int(0)
-===DONE===
diff --git a/ext/mysqli/tests/bug75448.phpt b/ext/mysqli/tests/bug75448.phpt
index d4b1b05f51..929b152769 100644
--- a/ext/mysqli/tests/bug75448.phpt
+++ b/ext/mysqli/tests/bug75448.phpt
@@ -11,9 +11,11 @@ require_once('skipifconnectfailure.inc');
require_once 'connect.inc';
$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
mysqli_close($link);
-$stmt = mysqli_prepare($link, 'SELECT VERSION()');
-var_dump($stmt);
-?>
---EXPECTF--
-Warning: mysqli_prepare(): Couldn't fetch mysqli in %s on line %d
-bool(false)
+
+try {
+ mysqli_prepare($link, 'SELECT VERSION()');
+} catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+}
+--EXPECT--
+mysqli object is already closed
diff --git a/ext/mysqli/tests/bug77956.phpt b/ext/mysqli/tests/bug77956.phpt
index 6c752299d4..d4bc06f93b 100644
--- a/ext/mysqli/tests/bug77956.phpt
+++ b/ext/mysqli/tests/bug77956.phpt
@@ -19,27 +19,27 @@ if ($msg = check_local_infile_support($link, $engine))
mysqli.allow_local_infile=0
--FILE--
<?php
- require_once("connect.inc");
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- }
- if (!$link->query("DROP TABLE IF EXISTS test")) {
- printf("[002] [%d] %s\n", $link->errno, $link->error);
- }
- if (!$link->query("CREATE TABLE test (dump1 INT UNSIGNED NOT NULL PRIMARY KEY) ENGINE=" . $engine)) {
- printf("[003] [%d] %s\n", $link->errno, $link->error);
- }
- if (FALSE == file_put_contents('bug77956.data', "waa? meukee!"))
- printf("[004] Failed to create CVS file\n");
- if (!$link->query("SELECT 1 FROM DUAL"))
- printf("[005] [%d] %s\n", $link->errno, $link->error);
- if (!$link->query("LOAD DATA LOCAL INFILE 'bug77956.data' INTO TABLE test")) {
- printf("[006] [%d] %s\n", $link->errno, $link->error);
- echo "done";
- } else {
- echo "bug";
- }
- $link->close();
+ require_once("connect.inc");
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
+ if (!$link->query("DROP TABLE IF EXISTS test")) {
+ printf("[002] [%d] %s\n", $link->errno, $link->error);
+ }
+ if (!$link->query("CREATE TABLE test (dump1 INT UNSIGNED NOT NULL PRIMARY KEY) ENGINE=" . $engine)) {
+ printf("[003] [%d] %s\n", $link->errno, $link->error);
+ }
+ if (FALSE == file_put_contents('bug77956.data', "waa? meukee!"))
+ printf("[004] Failed to create CVS file\n");
+ if (!$link->query("SELECT 1 FROM DUAL"))
+ printf("[005] [%d] %s\n", $link->errno, $link->error);
+ if (!$link->query("LOAD DATA LOCAL INFILE 'bug77956.data' INTO TABLE test")) {
+ printf("[006] [%d] %s\n", $link->errno, $link->error);
+ echo "done";
+ } else {
+ echo "bug";
+ }
+ $link->close();
?>
--CLEAN--
<?php
@@ -48,7 +48,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
printf("[clean] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
}
-if (!$link->query($link, 'DROP TABLE IF EXISTS test')) {
+if (!$link->query('DROP TABLE IF EXISTS test')) {
printf("[clean] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
$link->close();
diff --git a/ext/mysqli/tests/bug_bits.phpt b/ext/mysqli/tests/bug_bits.phpt
index 59752e4159..a4afa3e544 100644
--- a/ext/mysqli/tests/bug_bits.phpt
+++ b/ext/mysqli/tests/bug_bits.phpt
@@ -22,12 +22,12 @@ if (!$link->query("CREATE TABLE `bug_bits` (`inty` bigint(20) unsigned NOT NULL
}
$insertQuery = "INSERT INTO `bug_bits` VALUES (18446744073709551615, 18446744073709551615)".
- ",(18446744073709551614, 18446744073709551614)".
- ",(4294967296, 4294967296)".
- ",(4294967295, 4294967295)".
- ",(2147483648, 2147483648)".
- ",(2147483647, 2147483647)".
- ",(1, 1)";
+ ",(18446744073709551614, 18446744073709551614)".
+ ",(4294967296, 4294967296)".
+ ",(4294967295, 4294967295)".
+ ",(2147483648, 2147483648)".
+ ",(2147483647, 2147483647)".
+ ",(1, 1)";
if (!$link->query($insertQuery)) {
printf("[004] [%d] %s\n", $link->errno, $link->error);
}
@@ -37,7 +37,7 @@ if (!($res = $link->query("SELECT * FROM `bug_bits`"))) {
}
while ($row = $res->fetch_assoc()) {
- var_dump($row);
+ var_dump($row);
}
$link->close();
diff --git a/ext/mysqli/tests/bug_mysql_49406.phpt b/ext/mysqli/tests/bug_mysql_49406.phpt
index 74ea471702..73ca0ad882 100644
--- a/ext/mysqli/tests/bug_mysql_49406.phpt
+++ b/ext/mysqli/tests/bug_mysql_49406.phpt
@@ -7,90 +7,90 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!($link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!($link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- $query = "SELECT CASE WHEN 0 THEN CAST('2009-12-03' AS DATE) ELSE CAST('2009-12-03' AS DATE) END";
+ $query = "SELECT CASE WHEN 0 THEN CAST('2009-12-03' AS DATE) ELSE CAST('2009-12-03' AS DATE) END";
- if (!$res = $link->query($query))
- printf("[002] [%d] %s\n", $link->errno, $link->error);
+ if (!$res = $link->query($query))
+ printf("[002] [%d] %s\n", $link->errno, $link->error);
- if (!$row = $res->fetch_row())
- printf("[003] No result, [%d] %s\n", $link->errno, $link->error);
+ if (!$row = $res->fetch_row())
+ printf("[003] No result, [%d] %s\n", $link->errno, $link->error);
- $res->free();
+ $res->free();
- if ($row[0] != '2009-12-03') {
- printf("[004] Expecting '2009-12-03' got '%s'\n", $row[0]);
- }
+ if ($row[0] != '2009-12-03') {
+ printf("[004] Expecting '2009-12-03' got '%s'\n", $row[0]);
+ }
- if (!$stmt = $link->prepare($query))
- printf("[005] [%d] %s\n", $link->errno, $link->error);
+ if (!$stmt = $link->prepare($query))
+ printf("[005] [%d] %s\n", $link->errno, $link->error);
- if (!$stmt->execute() || !$stmt->store_result())
- printf("[006] [%d] %s\n", $stmt->errno, $stmt->error);
+ if (!$stmt->execute() || !$stmt->store_result())
+ printf("[006] [%d] %s\n", $stmt->errno, $stmt->error);
- $datatypes = array(
- MYSQLI_TYPE_TINY => "TINY",
- MYSQLI_TYPE_SHORT => "SHORT",
- MYSQLI_TYPE_LONG => "LONG",
- MYSQLI_TYPE_FLOAT => "FLOAT",
- MYSQLI_TYPE_DOUBLE => "DOUBLE",
- MYSQLI_TYPE_TIMESTAMP => "TIMESTAMP",
- MYSQLI_TYPE_LONGLONG => "LONGLONG",
- MYSQLI_TYPE_INT24 => "INT24",
- MYSQLI_TYPE_DATE => "DATE",
- MYSQLI_TYPE_TIME => "TIME",
- MYSQLI_TYPE_DATETIME => "DATETIME",
- MYSQLI_TYPE_YEAR => "YEAR",
- MYSQLI_TYPE_ENUM => "ENUM",
- MYSQLI_TYPE_SET => "SET",
- MYSQLI_TYPE_TINY_BLOB => "TINYBLOB",
- MYSQLI_TYPE_MEDIUM_BLOB => "MEDIUMBLOB",
- MYSQLI_TYPE_LONG_BLOB => "LONGBLOB",
- MYSQLI_TYPE_BLOB => "BLOB",
- MYSQLI_TYPE_VAR_STRING => "VAR_STRING",
- MYSQLI_TYPE_STRING => "STRING",
- MYSQLI_TYPE_NULL => "NULL",
- MYSQLI_TYPE_NEWDATE => "NEWDATE",
- MYSQLI_TYPE_INTERVAL => "INTERVAL",
- MYSQLI_TYPE_GEOMETRY => "GEOMETRY",
- );
+ $datatypes = array(
+ MYSQLI_TYPE_TINY => "TINY",
+ MYSQLI_TYPE_SHORT => "SHORT",
+ MYSQLI_TYPE_LONG => "LONG",
+ MYSQLI_TYPE_FLOAT => "FLOAT",
+ MYSQLI_TYPE_DOUBLE => "DOUBLE",
+ MYSQLI_TYPE_TIMESTAMP => "TIMESTAMP",
+ MYSQLI_TYPE_LONGLONG => "LONGLONG",
+ MYSQLI_TYPE_INT24 => "INT24",
+ MYSQLI_TYPE_DATE => "DATE",
+ MYSQLI_TYPE_TIME => "TIME",
+ MYSQLI_TYPE_DATETIME => "DATETIME",
+ MYSQLI_TYPE_YEAR => "YEAR",
+ MYSQLI_TYPE_ENUM => "ENUM",
+ MYSQLI_TYPE_SET => "SET",
+ MYSQLI_TYPE_TINY_BLOB => "TINYBLOB",
+ MYSQLI_TYPE_MEDIUM_BLOB => "MEDIUMBLOB",
+ MYSQLI_TYPE_LONG_BLOB => "LONGBLOB",
+ MYSQLI_TYPE_BLOB => "BLOB",
+ MYSQLI_TYPE_VAR_STRING => "VAR_STRING",
+ MYSQLI_TYPE_STRING => "STRING",
+ MYSQLI_TYPE_NULL => "NULL",
+ MYSQLI_TYPE_NEWDATE => "NEWDATE",
+ MYSQLI_TYPE_INTERVAL => "INTERVAL",
+ MYSQLI_TYPE_GEOMETRY => "GEOMETRY",
+ );
- $meta_res = $stmt->result_metadata();
- for ($field_idx = 0; $field_idx < $meta_res->field_count; $field_idx++) {
- $field = $meta_res->fetch_field();
- printf("Field : %d\n", $field_idx);
- printf("Name : %s\n", $field->name);
- printf("Orgname : %s\n", $field->orgname);
- printf("Table : %s\n", $field->table);
- printf("Orgtable : %s\n", $field->orgtable);
- printf("Maxlength : %d\n", $field->max_length);
- printf("Length : %d\n", $field->length);
- printf("Charsetnr : %d\n", $field->charsetnr);
- printf("Flags : %d\n", $field->flags);
- printf("Type : %d (%s)\n", $field->type, (isset($datatypes[$field->type])) ? $datatypes[$field->type] : 'unknown');
- printf("Decimals : %d\n", $field->decimals);
- }
+ $meta_res = $stmt->result_metadata();
+ for ($field_idx = 0; $field_idx < $meta_res->field_count; $field_idx++) {
+ $field = $meta_res->fetch_field();
+ printf("Field : %d\n", $field_idx);
+ printf("Name : %s\n", $field->name);
+ printf("Orgname : %s\n", $field->orgname);
+ printf("Table : %s\n", $field->table);
+ printf("Orgtable : %s\n", $field->orgtable);
+ printf("Maxlength : %d\n", $field->max_length);
+ printf("Length : %d\n", $field->length);
+ printf("Charsetnr : %d\n", $field->charsetnr);
+ printf("Flags : %d\n", $field->flags);
+ printf("Type : %d (%s)\n", $field->type, (isset($datatypes[$field->type])) ? $datatypes[$field->type] : 'unknown');
+ printf("Decimals : %d\n", $field->decimals);
+ }
- $row_stmt = null;
- if (!$stmt->bind_result($row_stmt) || !$stmt->fetch())
- printf("[007] [%d] %s\n", $stmt->errno, $stmt->error);
+ $row_stmt = null;
+ if (!$stmt->bind_result($row_stmt) || !$stmt->fetch())
+ printf("[007] [%d] %s\n", $stmt->errno, $stmt->error);
- if ($row[0] != $row_stmt) {
- printf("[008] PS and non-PS results differ, dumping data\n");
- var_dump($row[0]);
- var_dump($row_stmt);
- }
+ if ($row[0] != $row_stmt) {
+ printf("[008] PS and non-PS results differ, dumping data\n");
+ var_dump($row[0]);
+ var_dump($row_stmt);
+ }
- $stmt->close();
- $link->close();
+ $stmt->close();
+ $link->close();
- echo "done";
+ echo "done";
?>
--EXPECTF--
Field : %s
diff --git a/ext/mysqli/tests/clean_table.inc b/ext/mysqli/tests/clean_table.inc
index 86e5fcb379..a3dc8b66de 100644
--- a/ext/mysqli/tests/clean_table.inc
+++ b/ext/mysqli/tests/clean_table.inc
@@ -2,12 +2,12 @@
require_once('connect.inc');
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[clean] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ printf("[clean] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
}
if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
- printf("[clean] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ printf("[clean] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
mysqli_close($link);
diff --git a/ext/mysqli/tests/connect.inc b/ext/mysqli/tests/connect.inc
index c190e6f61f..439a7ab8f1 100644
--- a/ext/mysqli/tests/connect.inc
+++ b/ext/mysqli/tests/connect.inc
@@ -1,150 +1,150 @@
<?php
- /*
- Default values are "localhost", "root",
- database "test" and empty password.
- Change the MYSQL_TEST environment values
- if you want to use another configuration
- */
-
- $driver = new mysqli_driver;
-
- $host = getenv("MYSQL_TEST_HOST") ?: "localhost";
- $port = getenv("MYSQL_TEST_PORT") ?: 3306;
- $user = getenv("MYSQL_TEST_USER") ?: "root";
- $passwd = getenv("MYSQL_TEST_PASSWD") ?: "";
- $db = getenv("MYSQL_TEST_DB") ?: "test";
- $engine = getenv("MYSQL_TEST_ENGINE") ?: "MyISAM";
- $socket = getenv("MYSQL_TEST_SOCKET") ?: null;
- $skip_on_connect_failure = getenv("MYSQL_TEST_SKIP_CONNECT_FAILURE") ?: true;
- $connect_flags = (int)getenv("MYSQL_TEST_CONNECT_FLAGS") ?: 0;
- if ($socket) {
- ini_set('mysqli.default_socket', $socket);
- }
-
- /* Development setting: test experimal features and/or feature requests that never worked before? */
- $TEST_EXPERIMENTAL = (in_array(getenv("MYSQL_TEST_EXPERIMENTAL"), array(0, 1))) ?
- ((1 == getenv("MYSQL_TEST_EXPERIMENTAL")) ? true : false) :
- false;
-
- $IS_MYSQLND = stristr(mysqli_get_client_info(), "mysqlnd");
-
- if (!function_exists('sys_get_temp_dir')) {
- function sys_get_temp_dir() {
-
- if (!empty($_ENV['TMP']))
- return realpath( $_ENV['TMP'] );
- if (!empty($_ENV['TMPDIR']))
- return realpath( $_ENV['TMPDIR'] );
- if (!empty($_ENV['TEMP']))
- return realpath( $_ENV['TEMP'] );
-
- $temp_file = tempnam(md5(uniqid(rand(), TRUE)), '');
- if ($temp_file) {
- $temp_dir = realpath(dirname($temp_file));
- unlink($temp_file);
- return $temp_dir;
- }
- return FALSE;
- }
- }
-
- if (!function_exists('my_mysqli_connect')) {
-
- /**
- * Whenever possible, please use this wrapper to make testing ot MYSQLI_CLIENT_COMPRESS (and potentially SSL) possible
- *
- * @param enable_env_flags Enable setting of connection flags through env(MYSQL_TEST_CONNECT_FLAGS)?
- */
- function my_mysqli_connect($host, $user, $passwd, $db, $port, $socket, $enable_env_flags = true) {
- global $connect_flags;
-
- $flags = $enable_env_flags? $connect_flags:0;
- if ($flags !== 0) {
- $link = mysqli_init();
- if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, $flags))
- $link = false;
- } else {
- $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- }
-
- return $link;
- }
-
- /**
- * Whenever possible, please use this wrapper to make testing ot MYSQLI_CLIENT_COMPRESS (and potentially SSL) possible
- *
- * @param enable_env_flags Enable setting of connection flags through env(MYSQL_TEST_CONNECT_FLAGS)
- */
- function my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, $flags = 0, $enable_env_flags = true) {
- global $connect_flags;
-
- if ($enable_env_flags)
- $flags = $flags | $connect_flags;
-
- return mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, $flags);
- }
-
- class my_mysqli extends mysqli {
- public function __construct($host, $user, $passwd, $db, $port, $socket, $enable_env_flags = true) {
- global $connect_flags;
-
- $flags = ($enable_env_flags) ? $connect_flags : 0;
-
- if ($flags !== false) {
- parent::init();
- $this->real_connect($host, $user, $passwd, $db, $port, $socket, $flags);
- } else {
- parent::__construct($host, $user, $passwd, $db, $port, $socket);
- }
- }
- }
-
- function have_innodb($link) {
- if (($res = $link->query("SHOW VARIABLES LIKE 'have_innodb'")) &&
- ($row = $res->fetch_row()) &&
- !empty($row)) {
- if ($row[1] == "DISABLED" || $row[1] == "NO") {
- return false;
- }
- return true;
- } else {
- /* MySQL 5.6.1+ */
- if ($res = $link->query("SHOW ENGINES")) {
- while ($row = $res->fetch_assoc()) {
- if (!isset($row['Engine']) || !isset($row['Support']))
- return false;
-
- if (('InnoDB' == $row['Engine']) &&
- (('YES' == $row['Support']) || ('DEFAULT' == $row['Support']))
- ) {
- return true;
- }
- }
- return false;
- } else {
- return false;
- }
- }
- return false;
- }
-
- } else {
- printf("skip Eeeek/BUG/FIXME - connect.inc included twice! skipif bug?\n");
- }
-
- function handle_catchable_fatal($errno, $error, $file, $line) {
- static $errcodes = array();
- if (empty($errcodes)) {
- $constants = get_defined_constants();
- foreach ($constants as $name => $value) {
- if (substr($name, 0, 2) == "E_")
- $errcodes[$value] = $name;
- }
- }
- printf("[%s] %s in %s on line %s\n",
- (isset($errcodes[$errno])) ? $errcodes[$errno] : $errno,
- $error, $file, $line);
-
- return true;
- }
+ /*
+ Default values are "localhost", "root",
+ database "test" and empty password.
+ Change the MYSQL_TEST environment values
+ if you want to use another configuration
+ */
+
+ $driver = new mysqli_driver;
+
+ $host = getenv("MYSQL_TEST_HOST") ?: "localhost";
+ $port = getenv("MYSQL_TEST_PORT") ?: 3306;
+ $user = getenv("MYSQL_TEST_USER") ?: "root";
+ $passwd = getenv("MYSQL_TEST_PASSWD") ?: "";
+ $db = getenv("MYSQL_TEST_DB") ?: "test";
+ $engine = getenv("MYSQL_TEST_ENGINE") ?: "MyISAM";
+ $socket = getenv("MYSQL_TEST_SOCKET") ?: null;
+ $skip_on_connect_failure = getenv("MYSQL_TEST_SKIP_CONNECT_FAILURE") ?: true;
+ $connect_flags = (int)getenv("MYSQL_TEST_CONNECT_FLAGS") ?: 0;
+ if ($socket) {
+ ini_set('mysqli.default_socket', $socket);
+ }
+
+ /* Development setting: test experimal features and/or feature requests that never worked before? */
+ $TEST_EXPERIMENTAL = (in_array(getenv("MYSQL_TEST_EXPERIMENTAL"), array(0, 1))) ?
+ ((1 == getenv("MYSQL_TEST_EXPERIMENTAL")) ? true : false) :
+ false;
+
+ $IS_MYSQLND = stristr(mysqli_get_client_info(), "mysqlnd");
+
+ if (!function_exists('sys_get_temp_dir')) {
+ function sys_get_temp_dir() {
+
+ if (!empty($_ENV['TMP']))
+ return realpath( $_ENV['TMP'] );
+ if (!empty($_ENV['TMPDIR']))
+ return realpath( $_ENV['TMPDIR'] );
+ if (!empty($_ENV['TEMP']))
+ return realpath( $_ENV['TEMP'] );
+
+ $temp_file = tempnam(md5(uniqid(rand(), TRUE)), '');
+ if ($temp_file) {
+ $temp_dir = realpath(dirname($temp_file));
+ unlink($temp_file);
+ return $temp_dir;
+ }
+ return FALSE;
+ }
+ }
+
+ if (!function_exists('my_mysqli_connect')) {
+
+ /**
+ * Whenever possible, please use this wrapper to make testing ot MYSQLI_CLIENT_COMPRESS (and potentially SSL) possible
+ *
+ * @param enable_env_flags Enable setting of connection flags through env(MYSQL_TEST_CONNECT_FLAGS)?
+ */
+ function my_mysqli_connect($host, $user, $passwd, $db, $port, $socket, $enable_env_flags = true) {
+ global $connect_flags;
+
+ $flags = $enable_env_flags? $connect_flags:0;
+ if ($flags !== 0) {
+ $link = mysqli_init();
+ if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, $flags))
+ $link = false;
+ } else {
+ $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ }
+
+ return $link;
+ }
+
+ /**
+ * Whenever possible, please use this wrapper to make testing ot MYSQLI_CLIENT_COMPRESS (and potentially SSL) possible
+ *
+ * @param enable_env_flags Enable setting of connection flags through env(MYSQL_TEST_CONNECT_FLAGS)
+ */
+ function my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, $flags = 0, $enable_env_flags = true) {
+ global $connect_flags;
+
+ if ($enable_env_flags)
+ $flags = $flags | $connect_flags;
+
+ return mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, $flags);
+ }
+
+ class my_mysqli extends mysqli {
+ public function __construct($host, $user, $passwd, $db, $port, $socket, $enable_env_flags = true) {
+ global $connect_flags;
+
+ $flags = ($enable_env_flags) ? $connect_flags : 0;
+
+ if ($flags !== false) {
+ parent::init();
+ $this->real_connect($host, $user, $passwd, $db, $port, $socket, $flags);
+ } else {
+ parent::__construct($host, $user, $passwd, $db, $port, $socket);
+ }
+ }
+ }
+
+ function have_innodb($link) {
+ if (($res = $link->query("SHOW VARIABLES LIKE 'have_innodb'")) &&
+ ($row = $res->fetch_row()) &&
+ !empty($row)) {
+ if ($row[1] == "DISABLED" || $row[1] == "NO") {
+ return false;
+ }
+ return true;
+ } else {
+ /* MySQL 5.6.1+ */
+ if ($res = $link->query("SHOW ENGINES")) {
+ while ($row = $res->fetch_assoc()) {
+ if (!isset($row['Engine']) || !isset($row['Support']))
+ return false;
+
+ if (('InnoDB' == $row['Engine']) &&
+ (('YES' == $row['Support']) || ('DEFAULT' == $row['Support']))
+ ) {
+ return true;
+ }
+ }
+ return false;
+ } else {
+ return false;
+ }
+ }
+ return false;
+ }
+
+ } else {
+ printf("skip Eeeek/BUG/FIXME - connect.inc included twice! skipif bug?\n");
+ }
+
+ function handle_catchable_fatal($errno, $error, $file, $line) {
+ static $errcodes = array();
+ if (empty($errcodes)) {
+ $constants = get_defined_constants();
+ foreach ($constants as $name => $value) {
+ if (substr($name, 0, 2) == "E_")
+ $errcodes[$value] = $name;
+ }
+ }
+ printf("[%s] %s in %s on line %s\n",
+ (isset($errcodes[$errno])) ? $errcodes[$errno] : $errno,
+ $error, $file, $line);
+
+ return true;
+ }
?>
diff --git a/ext/mysqli/tests/gracefull_fail_on_empty_result_set.phpt b/ext/mysqli/tests/gracefull_fail_on_empty_result_set.phpt
index e37e22887a..9c94aa6dfb 100644
--- a/ext/mysqli/tests/gracefull_fail_on_empty_result_set.phpt
+++ b/ext/mysqli/tests/gracefull_fail_on_empty_result_set.phpt
@@ -8,23 +8,22 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
- require('table.inc');
+ require_once("connect.inc");
+ require('table.inc');
- // Returns only one result set
- $link->multi_query("SELECT 1");
+ // Returns only one result set
+ $link->multi_query("SELECT 1");
var_dump($link->next_result()); // should return false
var_dump($link->store_result()); // now what happens here!?
- // Returns only one result set
- $link->multi_query("SELECT 1");
+ // Returns only one result set
+ $link->multi_query("SELECT 1");
var_dump($link->next_result());
var_dump($link->use_result());
$link->close();
?>
-=== DONE ===
--CLEAN--
<?php
require_once("clean_table.inc");
@@ -56,4 +55,3 @@ object(mysqli_result)#3 (5) {
["type"]=>
int(1)
}
-=== DONE ===
diff --git a/ext/mysqli/tests/local_infile_tools.inc b/ext/mysqli/tests/local_infile_tools.inc
index af66d4c20c..fef400d0a9 100644
--- a/ext/mysqli/tests/local_infile_tools.inc
+++ b/ext/mysqli/tests/local_infile_tools.inc
@@ -1,146 +1,146 @@
<?php
- /* Utility function for mysqli_set_local_infile*.phpt tests */
- function shutdown_clean($file) {
- if ($file) {
- unlink($file);
- }
- }
-
- function check_local_infile_support($link, $engine, $table_name = 'test') {
-
- if (!$res = mysqli_query($link, 'SHOW VARIABLES LIKE "local_infile"'))
- return "Cannot check if Server variable 'local_infile' is set to 'ON'";
-
- $row = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- if ('ON' != $row['Value'])
- return sprintf("Server variable 'local_infile' seems not set to 'ON', found '%s'", $row['Value']);
-
- if (!mysqli_query($link, sprintf('DROP TABLE IF EXISTS %s', $table_name))) {
- return "Failed to drop old test table";
- }
-
- if (!mysqli_query($link, $sql = sprintf('CREATE TABLE %s(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE=%s',
- $table_name, $engine)))
- return "Failed to create test table: $sql";
-
- $file = create_standard_csv(1, false);
- if (!$file) {
- mysqli_query($link, sprintf('DROP TABLE IF EXISTS %s', $table_name));
- return "Cannot create CSV file";
- }
-
- if (!@mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s'
- INTO TABLE %s
- FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\''
- LINES TERMINATED BY '\n'",
- mysqli_real_escape_string($link, $file),
- $table_name))) {
- if (1148 == mysqli_errno($link)) {
- mysqli_query($link, sprintf('DROP TABLE IF EXISTS %s', $table_name));
- return "Cannot test LOAD DATA LOCAL INFILE, [1148] The used command is not allowed with this MySQL version";
- } else if ($link->errno) {
- return $link->error;
- }
- }
- mysqli_query($link, sprintf('DROP TABLE IF EXISTS %s', $table_name));
- return "";
- }
-
- function create_standard_csv($offset, $verbose = true) {
- // create a CVS file
- $file = tempnam(sys_get_temp_dir(), 'mysqli_test');
- if (!$fp = fopen($file, 'w')) {
- if ($verbose)
- printf("[%03d + 1] Cannot create CVS file '%s'\n", $offset, $file);
- return NULL;
- } else {
- /* Looks ugly? No, handy if you have crashes... */
- register_shutdown_function("shutdown_clean", $file);
- }
-
- if (!fwrite($fp, "97;'x';\n") ||
- !fwrite($fp, "98;'y';\n") ||
- !fwrite($fp, "99;'z';\n")) {
- if ($verbose)
- printf("[%03d + 3] Cannot write CVS file '%s'\n", $offset, $file);
- return NULL;
- }
-
- fclose($fp);
-
- if (!chmod($file, 0644)) {
- if ($verbose)
- printf("[%03d + 4] Cannot change the file perms of '%s' from 0600 to 0644, MySQL might not be able to read it\n",
- $offset, $file);
- return NULL;
- }
- return $file;
- }
-
- function try_handler($offset, $link, $file, $handler, $expected = null) {
-
- if ('default' == $handler) {
- mysqli_set_local_infile_default($link);
- } else if (!mysqli_set_local_infile_handler($link, $handler)) {
- printf("[%03d] Cannot set infile handler to '%s'\n", $offset, $handler);
- return false;
- }
- printf("Callback set to '%s'\n", $handler);
-
- if (!mysqli_query($link, sprintf("DELETE FROM test"))) {
- printf("[%03d] Cannot remove records, [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if (!@mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s'
- INTO TABLE test
- FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\''
- LINES TERMINATED BY '\n'",
- mysqli_real_escape_string($link, $file)))) {
- printf("[%03d] LOAD DATA failed, [%d] %s\n",
- $offset + 2,
- mysqli_errno($link), mysqli_error($link));
- }
-
- if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id")) {
- printf("[%03d] [%d] %s\n", $offset + 3, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if (!is_array($expected))
- return true;
-
- foreach ($expected as $k => $values) {
- if (!$tmp = mysqli_fetch_assoc($res)) {
- printf("[%03d/%d] [%d] '%s'\n", $offset + 4, $k, mysqli_errno($link), mysqli_error($link));
- return false;
- }
- if ($values['id'] != $tmp['id']) {
- printf("[%03d/%d] Expecting %s got %s\n",
- $offset + 5, $k,
- $values['id'], $tmp['id']);
- return false;
- }
- if ($values['label'] != $tmp['label']) {
- printf("[%03d/%d] Expecting %s got %s\n",
- $offset + 6, $k,
- $values['label'], $tmp['label']);
- return false;
- }
- }
-
- if ($res && $tmp = mysqli_fetch_assoc($res)) {
- printf("[%03d] More results than expected!\n", $offset + 7);
- do {
- var_dump($tmp);
- } while ($tmp = mysqli_fetch_assoc($res));
- return false;
- }
-
- if ($res)
- mysqli_free_result($res);
-
- return true;
- }
+ /* Utility function for mysqli_set_local_infile*.phpt tests */
+ function shutdown_clean($file) {
+ if ($file) {
+ unlink($file);
+ }
+ }
+
+ function check_local_infile_support($link, $engine, $table_name = 'test') {
+
+ if (!$res = mysqli_query($link, 'SHOW VARIABLES LIKE "local_infile"'))
+ return "Cannot check if Server variable 'local_infile' is set to 'ON'";
+
+ $row = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ if ('ON' != $row['Value'])
+ return sprintf("Server variable 'local_infile' seems not set to 'ON', found '%s'", $row['Value']);
+
+ if (!mysqli_query($link, sprintf('DROP TABLE IF EXISTS %s', $table_name))) {
+ return "Failed to drop old test table";
+ }
+
+ if (!mysqli_query($link, $sql = sprintf('CREATE TABLE %s(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE=%s',
+ $table_name, $engine)))
+ return "Failed to create test table: $sql";
+
+ $file = create_standard_csv(1, false);
+ if (!$file) {
+ mysqli_query($link, sprintf('DROP TABLE IF EXISTS %s', $table_name));
+ return "Cannot create CSV file";
+ }
+
+ if (!@mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s'
+ INTO TABLE %s
+ FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\''
+ LINES TERMINATED BY '\n'",
+ mysqli_real_escape_string($link, $file),
+ $table_name))) {
+ if (1148 == mysqli_errno($link)) {
+ mysqli_query($link, sprintf('DROP TABLE IF EXISTS %s', $table_name));
+ return "Cannot test LOAD DATA LOCAL INFILE, [1148] The used command is not allowed with this MySQL version";
+ } else if ($link->errno) {
+ return $link->error;
+ }
+ }
+ mysqli_query($link, sprintf('DROP TABLE IF EXISTS %s', $table_name));
+ return "";
+ }
+
+ function create_standard_csv($offset, $verbose = true) {
+ // create a CVS file
+ $file = tempnam(sys_get_temp_dir(), 'mysqli_test');
+ if (!$fp = fopen($file, 'w')) {
+ if ($verbose)
+ printf("[%03d + 1] Cannot create CVS file '%s'\n", $offset, $file);
+ return NULL;
+ } else {
+ /* Looks ugly? No, handy if you have crashes... */
+ register_shutdown_function("shutdown_clean", $file);
+ }
+
+ if (!fwrite($fp, "97;'x';\n") ||
+ !fwrite($fp, "98;'y';\n") ||
+ !fwrite($fp, "99;'z';\n")) {
+ if ($verbose)
+ printf("[%03d + 3] Cannot write CVS file '%s'\n", $offset, $file);
+ return NULL;
+ }
+
+ fclose($fp);
+
+ if (!chmod($file, 0644)) {
+ if ($verbose)
+ printf("[%03d + 4] Cannot change the file perms of '%s' from 0600 to 0644, MySQL might not be able to read it\n",
+ $offset, $file);
+ return NULL;
+ }
+ return $file;
+ }
+
+ function try_handler($offset, $link, $file, $handler, $expected = null) {
+
+ if ('default' == $handler) {
+ mysqli_set_local_infile_default($link);
+ } else if (!mysqli_set_local_infile_handler($link, $handler)) {
+ printf("[%03d] Cannot set infile handler to '%s'\n", $offset, $handler);
+ return false;
+ }
+ printf("Callback set to '%s'\n", $handler);
+
+ if (!mysqli_query($link, sprintf("DELETE FROM test"))) {
+ printf("[%03d] Cannot remove records, [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if (!@mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s'
+ INTO TABLE test
+ FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\''
+ LINES TERMINATED BY '\n'",
+ mysqli_real_escape_string($link, $file)))) {
+ printf("[%03d] LOAD DATA failed, [%d] %s\n",
+ $offset + 2,
+ mysqli_errno($link), mysqli_error($link));
+ }
+
+ if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id")) {
+ printf("[%03d] [%d] %s\n", $offset + 3, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if (!is_array($expected))
+ return true;
+
+ foreach ($expected as $k => $values) {
+ if (!$tmp = mysqli_fetch_assoc($res)) {
+ printf("[%03d/%d] [%d] '%s'\n", $offset + 4, $k, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+ if ($values['id'] != $tmp['id']) {
+ printf("[%03d/%d] Expecting %s got %s\n",
+ $offset + 5, $k,
+ $values['id'], $tmp['id']);
+ return false;
+ }
+ if ($values['label'] != $tmp['label']) {
+ printf("[%03d/%d] Expecting %s got %s\n",
+ $offset + 6, $k,
+ $values['label'], $tmp['label']);
+ return false;
+ }
+ }
+
+ if ($res && $tmp = mysqli_fetch_assoc($res)) {
+ printf("[%03d] More results than expected!\n", $offset + 7);
+ do {
+ var_dump($tmp);
+ } while ($tmp = mysqli_fetch_assoc($res));
+ return false;
+ }
+
+ if ($res)
+ mysqli_free_result($res);
+
+ return true;
+ }
?>
diff --git a/ext/mysqli/tests/mysqli_affected_rows.phpt b/ext/mysqli/tests/mysqli_affected_rows.phpt
index 95c3bb3426..f89c56ef0f 100644
--- a/ext/mysqli/tests/mysqli_affected_rows.phpt
+++ b/ext/mysqli/tests/mysqli_affected_rows.phpt
@@ -8,128 +8,120 @@ mysqli_affected_rows()
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[004] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (!is_null($tmp = @mysqli_affected_rows()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (0 !== ($tmp = mysqli_affected_rows($link)))
+ printf("[005] Expecting int/0, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
- if (!is_null($tmp = @mysqli_affected_rows($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_null($tmp = @mysqli_affected_rows($link, $link)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE = ' . $engine))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[004] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (1, 'a')"))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (0 !== ($tmp = mysqli_affected_rows($link)))
- printf("[005] Expecting int/0, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
+ if (1 !== ($tmp = mysqli_affected_rows($link)))
+ printf("[010] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ // ignore INSERT error, NOTE: command line returns 0, affected_rows returns -1 as documented
+ mysqli_query($link, "INSERT INTO test(id, label) VALUES (1, 'a')");
+ if (-1 !== ($tmp = mysqli_affected_rows($link)))
+ printf("[011] Expecting int/-1, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE = ' . $engine))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (1, 'a') ON DUPLICATE KEY UPDATE id = 4"))
+ printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (1, 'a')"))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (2 !== ($tmp = mysqli_affected_rows($link)))
+ printf("[013] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
- if (1 !== ($tmp = mysqli_affected_rows($link)))
- printf("[010] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (2, 'b'), (3, 'c')"))
+ printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- // ignore INSERT error, NOTE: command line returns 0, affected_rows returns -1 as documented
- mysqli_query($link, "INSERT INTO test(id, label) VALUES (1, 'a')");
- if (-1 !== ($tmp = mysqli_affected_rows($link)))
- printf("[011] Expecting int/-1, got %s/%s\n", gettype($tmp), $tmp);
+ if (2 !== ($tmp = mysqli_affected_rows($link)))
+ printf("[015] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (1, 'a') ON DUPLICATE KEY UPDATE id = 4"))
- printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "INSERT IGNORE INTO test(id, label) VALUES (1, 'a')")) {
+ printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- if (2 !== ($tmp = mysqli_affected_rows($link)))
- printf("[013] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
+ if (1 !== ($tmp = mysqli_affected_rows($link)))
+ printf("[017] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (2, 'b'), (3, 'c')"))
- printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "INSERT INTO test(id, label) SELECT id + 10, label FROM test"))
+ printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (2 !== ($tmp = mysqli_affected_rows($link)))
- printf("[015] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
+ if (4 !== ($tmp = mysqli_affected_rows($link)))
+ printf("[019] Expecting int/4, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_query($link, "INSERT IGNORE INTO test(id, label) VALUES (1, 'a')")) {
- printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ if (!mysqli_query($link, "REPLACE INTO test(id, label) values (4, 'd')"))
+ printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (1 !== ($tmp = mysqli_affected_rows($link)))
- printf("[017] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
+ if (2 !== ($tmp = mysqli_affected_rows($link)))
+ printf("[021] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_query($link, "INSERT INTO test(id, label) SELECT id + 10, label FROM test"))
- printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "REPLACE INTO test(id, label) values (5, 'e')"))
+ printf("[022] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (4 !== ($tmp = mysqli_affected_rows($link)))
- printf("[019] Expecting int/4, got %s/%s\n", gettype($tmp), $tmp);
+ if (1 !== ($tmp = mysqli_affected_rows($link)))
+ printf("[023] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_query($link, "REPLACE INTO test(id, label) values (4, 'd')"))
- printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "UPDATE test SET label = 'a' WHERE id = 2"))
+ printf("[024] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (2 !== ($tmp = mysqli_affected_rows($link)))
- printf("[021] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
+ if (1 !== ($tmp = mysqli_affected_rows($link)))
+ printf("[025] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_query($link, "REPLACE INTO test(id, label) values (5, 'e')"))
- printf("[022] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $charsets = array('utf8');
+ foreach ($charsets as $k => $charset) {
+ if (!($res = mysqli_query($link, sprintf("SHOW CHARACTER SET LIKE '%s'", $charset))))
+ continue;
+ mysqli_free_result($res);
+ if (true !== ($tmp = mysqli_set_charset($link, $charset)))
+ printf("[026] Expecting boolean/true got %s/%s\n",
+ gettype($tmp), $tmp);
+ if (0 !== ($tmp = mysqli_affected_rows($link)))
+ printf("[027] Expecting int/0 got %s/%s\n", gettype($tmp), $tmp);
+ }
- if (1 !== ($tmp = mysqli_affected_rows($link)))
- printf("[023] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_query($link, "UPDATE test SET label = 'a' WHERE id = 2")) {
+ printf("[028] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- if (!mysqli_query($link, "UPDATE test SET label = 'a' WHERE id = 2"))
- printf("[024] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (0 !== ($tmp = mysqli_affected_rows($link)))
+ printf("[029] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
- if (1 !== ($tmp = mysqli_affected_rows($link)))
- printf("[025] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_query($link, "UPDATE test SET label = 'a' WHERE id = 100")) {
+ printf("[030] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- $charsets = array('utf8');
- foreach ($charsets as $k => $charset) {
- if (!($res = mysqli_query($link, sprintf("SHOW CHARACTER SET LIKE '%s'", $charset))))
- continue;
- mysqli_free_result($res);
- if (true !== ($tmp = mysqli_set_charset($link, $charset)))
- printf("[026] Expecting boolean/true got %s/%s\n",
- gettype($tmp), $tmp);
- if (0 !== ($tmp = mysqli_affected_rows($link)))
- printf("[027] Expecting int/0 got %s/%s\n", gettype($tmp), $tmp);
- }
+ if (0 !== ($tmp = mysqli_affected_rows($link)))
+ printf("[031] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_query($link, "UPDATE test SET label = 'a' WHERE id = 2")) {
- printf("[028] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
+ printf("[032] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (0 !== ($tmp = mysqli_affected_rows($link)))
- printf("[029] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_query($link, "UPDATE test SET label = 'a' WHERE id = 100")) {
- printf("[030] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ mysqli_close($link);
- if (0 !== ($tmp = mysqli_affected_rows($link)))
- printf("[031] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+ try {
+ mysqli_affected_rows($link);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
- printf("[032] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
-
- mysqli_close($link);
-
- if (false !== ($tmp = @mysqli_affected_rows($link)))
- printf("[033] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
--EXPECT--
+mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_affected_rows_oo.phpt b/ext/mysqli/tests/mysqli_affected_rows_oo.phpt
index 7a6a5be996..5a83d1cfb4 100644
--- a/ext/mysqli/tests/mysqli_affected_rows_oo.phpt
+++ b/ext/mysqli/tests/mysqli_affected_rows_oo.phpt
@@ -8,107 +8,115 @@ mysqli->affected_rows
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $mysqli = new mysqli();
- if (false !== ($tmp = @$mysqli->affected_rows))
- printf("[000a] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ $mysqli = new mysqli();
+ try {
+ $mysqli->affected_rows;
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) {
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
+ if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
- if (0 !== ($tmp = $mysqli->affected_rows))
- printf("[002] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+ if (0 !== ($tmp = $mysqli->affected_rows))
+ printf("[002] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
- if (!$mysqli->query('DROP TABLE IF EXISTS test'))
- printf("[003] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query('DROP TABLE IF EXISTS test'))
+ printf("[003] [%d] %s\n", $mysqli->errno, $mysqli->error);
- if (!$mysqli->query('CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE = ' . $engine))
- printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query('CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE = ' . $engine))
+ printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error);
- if (!$mysqli->query("INSERT INTO test(id, label) VALUES (1, 'a')"))
- printf("[005] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query("INSERT INTO test(id, label) VALUES (1, 'a')"))
+ printf("[005] [%d] %s\n", $mysqli->errno, $mysqli->error);
- if (1 !== ($tmp = $mysqli->affected_rows))
- printf("[006] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
+ if (1 !== ($tmp = $mysqli->affected_rows))
+ printf("[006] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
- // ignore INSERT error, NOTE: command line returns 0, affected_rows returns -1 as documented
- $mysqli->query("INSERT INTO test(id, label) VALUES (1, 'a')");
- if (-1 !== ($tmp = $mysqli->affected_rows))
- printf("[007] Expecting int/-1, got %s/%s\n", gettype($tmp), $tmp);
+ // ignore INSERT error, NOTE: command line returns 0, affected_rows returns -1 as documented
+ $mysqli->query("INSERT INTO test(id, label) VALUES (1, 'a')");
+ if (-1 !== ($tmp = $mysqli->affected_rows))
+ printf("[007] Expecting int/-1, got %s/%s\n", gettype($tmp), $tmp);
- if (!$mysqli->query("INSERT INTO test(id, label) VALUES (1, 'a') ON DUPLICATE KEY UPDATE id = 4"))
- printf("[008] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query("INSERT INTO test(id, label) VALUES (1, 'a') ON DUPLICATE KEY UPDATE id = 4"))
+ printf("[008] [%d] %s\n", $mysqli->errno, $mysqli->error);
- if (2 !== ($tmp = $mysqli->affected_rows))
- printf("[009] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
+ if (2 !== ($tmp = $mysqli->affected_rows))
+ printf("[009] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
- if (!$mysqli->query("INSERT INTO test(id, label) VALUES (2, 'b'), (3, 'c')"))
- printf("[010] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query("INSERT INTO test(id, label) VALUES (2, 'b'), (3, 'c')"))
+ printf("[010] [%d] %s\n", $mysqli->errno, $mysqli->error);
- if (2 !== ($tmp = $mysqli->affected_rows))
- printf("[011] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
+ if (2 !== ($tmp = $mysqli->affected_rows))
+ printf("[011] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
- if (!$mysqli->query("INSERT IGNORE INTO test(id, label) VALUES (1, 'a')")) {
- printf("[012] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
+ if (!$mysqli->query("INSERT IGNORE INTO test(id, label) VALUES (1, 'a')")) {
+ printf("[012] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
- if (1 !== ($tmp = $mysqli->affected_rows))
- printf("[013] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
+ if (1 !== ($tmp = $mysqli->affected_rows))
+ printf("[013] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
- if (!$mysqli->query("INSERT INTO test(id, label) SELECT id + 10, label FROM test"))
- printf("[014] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query("INSERT INTO test(id, label) SELECT id + 10, label FROM test"))
+ printf("[014] [%d] %s\n", $mysqli->errno, $mysqli->error);
- if (4 !== ($tmp = $mysqli->affected_rows))
- printf("[015] Expecting int/4, got %s/%s\n", gettype($tmp), $tmp);
+ if (4 !== ($tmp = $mysqli->affected_rows))
+ printf("[015] Expecting int/4, got %s/%s\n", gettype($tmp), $tmp);
- if (!$mysqli->query("REPLACE INTO test(id, label) values (4, 'd')"))
- printf("[015] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query("REPLACE INTO test(id, label) values (4, 'd')"))
+ printf("[015] [%d] %s\n", $mysqli->errno, $mysqli->error);
- if (2 !== ($tmp = $mysqli->affected_rows))
- printf("[016] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
+ if (2 !== ($tmp = $mysqli->affected_rows))
+ printf("[016] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
- if (!$mysqli->query("REPLACE INTO test(id, label) values (5, 'e')"))
- printf("[017] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query("REPLACE INTO test(id, label) values (5, 'e')"))
+ printf("[017] [%d] %s\n", $mysqli->errno, $mysqli->error);
- if (1 !== ($tmp = $mysqli->affected_rows))
- printf("[018] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
+ if (1 !== ($tmp = $mysqli->affected_rows))
+ printf("[018] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
- if (!$mysqli->query("UPDATE test SET label = 'a' WHERE id = 2"))
- printf("[019] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query("UPDATE test SET label = 'a' WHERE id = 2"))
+ printf("[019] [%d] %s\n", $mysqli->errno, $mysqli->error);
- if (1 !== ($tmp = $mysqli->affected_rows))
- printf("[020] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
+ if (1 !== ($tmp = $mysqli->affected_rows))
+ printf("[020] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
- if (!$mysqli->query("UPDATE test SET label = 'a' WHERE id = 2")) {
- printf("[021] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
+ if (!$mysqli->query("UPDATE test SET label = 'a' WHERE id = 2")) {
+ printf("[021] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
- if (0 !== ($tmp = $mysqli->affected_rows))
- printf("[022] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+ if (0 !== ($tmp = $mysqli->affected_rows))
+ printf("[022] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
- if (!$mysqli->query("UPDATE test SET label = 'a' WHERE id = 100")) {
- printf("[023] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
+ if (!$mysqli->query("UPDATE test SET label = 'a' WHERE id = 100")) {
+ printf("[023] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
- if (0 !== ($tmp = $mysqli->affected_rows))
- printf("[024] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+ if (0 !== ($tmp = $mysqli->affected_rows))
+ printf("[024] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
- if (!$mysqli->query('DROP TABLE IF EXISTS test'))
- printf("[025] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query('DROP TABLE IF EXISTS test'))
+ printf("[025] [%d] %s\n", $mysqli->errno, $mysqli->error);
- $mysqli->close();
+ $mysqli->close();
- if (false !== ($tmp = @$mysqli->affected_rows))
- printf("[026] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ try {
+ $mysqli->affected_rows;
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
--EXPECT--
+Property access is not allowed yet
+Property access is not allowed yet
done!
diff --git a/ext/mysqli/tests/mysqli_auth_pam.phpt b/ext/mysqli/tests/mysqli_auth_pam.phpt
index 30d2da5675..cdbcf2947e 100644
--- a/ext/mysqli/tests/mysqli_auth_pam.phpt
+++ b/ext/mysqli/tests/mysqli_auth_pam.phpt
@@ -56,30 +56,30 @@ if (!mysqli_query($link, sprintf("GRANT SELECT ON TABLE %s.test TO pamtest@'%%'"
max_execution_time=240
--FILE--
<?php
- require_once('connect.inc');
- require_once('table.inc');
+ require_once('connect.inc');
+ require_once('table.inc');
- if (!$link = my_mysqli_connect($host, 'pamtest', 'pamtest', $db, $port, $socket)) {
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- } else {
+ if (!$link = my_mysqli_connect($host, 'pamtest', 'pamtest', $db, $port, $socket)) {
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ } else {
- if (!$res = $link->query("SELECT id FROM test WHERE id = 1"))
- printf("[002] [%d] %s\n", $link->errno, $link->error);
+ if (!$res = $link->query("SELECT id FROM test WHERE id = 1"))
+ printf("[002] [%d] %s\n", $link->errno, $link->error);
- if (!$row = mysqli_fetch_assoc($res)) {
- printf("[003] [%d] %s\n", $link->errno, $link->error);
- }
+ if (!$row = mysqli_fetch_assoc($res)) {
+ printf("[003] [%d] %s\n", $link->errno, $link->error);
+ }
- if ($row['id'] != 1) {
- printf("[004] Expecting 1 got %s/'%s'", gettype($row['id']), $row['id']);
- }
+ if ($row['id'] != 1) {
+ printf("[004] Expecting 1 got %s/'%s'", gettype($row['id']), $row['id']);
+ }
- $res->close();
- $link->close();
- }
+ $res->close();
+ $link->close();
+ }
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_autocommit.phpt b/ext/mysqli/tests/mysqli_autocommit.phpt
index ce470fce72..21435e7a08 100644
--- a/ext/mysqli/tests/mysqli_autocommit.phpt
+++ b/ext/mysqli/tests/mysqli_autocommit.phpt
@@ -17,131 +17,122 @@ mysqli_autocommit()
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[004] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
- if (!is_null($tmp = @mysqli_autocommit()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_bool($tmp = mysqli_autocommit($link, true)))
+ printf("[005] Expecting boolean/any, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_autocommit($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_query($link, 'SET AUTOCOMMIT = 0'))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_null($tmp = @mysqli_autocommit($link, $link, $link)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!$res = mysqli_query($link, 'SELECT @@autocommit as auto_commit'))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[004] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ if ($tmp['auto_commit'])
+ printf("[008] Cannot turn off autocommit\n");
- if (!is_bool($tmp = mysqli_autocommit($link, true)))
- printf("[005] Expecting boolean/any, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_autocommit($link, true)))
+ printf("[009] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_query($link, 'SET AUTOCOMMIT = 0'))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, 'SELECT @@autocommit as auto_commit'))
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ if (!$tmp['auto_commit'])
+ printf("[011] Cannot turn on autocommit\n");
- if (!$res = mysqli_query($link, 'SELECT @@autocommit as auto_commit'))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
+ printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- if ($tmp['auto_commit'])
- printf("[008] Cannot turn off autocommit\n");
+ if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB')) {
+ printf("[013] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- if (true !== ($tmp = mysqli_autocommit($link, true)))
- printf("[009] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)'))
+ printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$res = mysqli_query($link, 'SELECT @@autocommit as auto_commit'))
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- if (!$tmp['auto_commit'])
- printf("[011] Cannot turn on autocommit\n");
+ if (!mysqli_query($link, 'ROLLBACK'))
+ printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
- printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS num FROM test'))
+ printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB')) {
- printf("[013] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ if ((!$tmp = mysqli_fetch_assoc($res)) || (1 != $tmp['num']))
+ printf("[17] Expecting 1 row in table test, found %d rows. [%d] %s\n",
+ $tmp['num'], mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)'))
- printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_free_result($res);
- if (!mysqli_query($link, 'ROLLBACK'))
- printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
+ printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS num FROM test'))
- printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'SET AUTOCOMMIT = 1'))
+ printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if ((!$tmp = mysqli_fetch_assoc($res)) || (1 != $tmp['num']))
- printf("[17] Expecting 1 row in table test, found %d rows. [%d] %s\n",
- $tmp['num'], mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, 'SELECT @@autocommit as auto_commit'))
+ printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ if (!$tmp['auto_commit'])
+ printf("[021] Cannot turn on autocommit\n");
- mysqli_free_result($res);
+ if (true !== ($tmp = mysqli_autocommit($link, false)))
+ printf("[022] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
- printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB')) {
+ printf("[023] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- if (!mysqli_query($link, 'SET AUTOCOMMIT = 1'))
- printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)'))
+ printf("[024] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$res = mysqli_query($link, 'SELECT @@autocommit as auto_commit'))
- printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- if (!$tmp['auto_commit'])
- printf("[021] Cannot turn on autocommit\n");
+ if (!mysqli_query($link, 'ROLLBACK'))
+ printf("[025] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (true !== ($tmp = mysqli_autocommit($link, false)))
- printf("[022] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB')) {
- printf("[023] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS num FROM test'))
+ printf("[026] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ if (0 != $tmp['num'])
+ printf("[27] Expecting 0 rows in table test, found %d rows\n", $tmp['num']);
+ mysqli_free_result($res);
- if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)'))
- printf("[024] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)'))
+ printf("[028] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, 'ROLLBACK'))
- printf("[025] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'COMMIT'))
+ printf("[029] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS num FROM test'))
- printf("[026] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- if (0 != $tmp['num'])
- printf("[27] Expecting 0 rows in table test, found %d rows\n", $tmp['num']);
- mysqli_free_result($res);
+ if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS num FROM test'))
+ printf("[030] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)'))
- printf("[028] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if ((!$tmp = mysqli_fetch_assoc($res)) || (1 != $tmp['num']))
+ printf("[31] Expecting 1 row in table test, found %d rows. [%d] %s\n",
+ $tmp['num'], mysqli_errno($link), mysqli_error($link));
+ mysqli_free_result($res);
- if (!mysqli_query($link, 'COMMIT'))
- printf("[029] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
+ printf("[032] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS num FROM test'))
- printf("[030] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_close($link);
- if ((!$tmp = mysqli_fetch_assoc($res)) || (1 != $tmp['num']))
- printf("[31] Expecting 1 row in table test, found %d rows. [%d] %s\n",
- $tmp['num'], mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
+ try {
+ mysqli_autocommit($link, false);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
- printf("[032] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- mysqli_close($link);
-
- if (false !== ($tmp = @mysqli_autocommit($link, false)))
- printf("[033] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!";
-?>
+ print "done!";
--CLEAN--
<?php
require_once("clean_table.inc");
?>
--EXPECT--
+mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_autocommit_oo.phpt b/ext/mysqli/tests/mysqli_autocommit_oo.phpt
index 93ab10e605..2720047e37 100644
--- a/ext/mysqli/tests/mysqli_autocommit_oo.phpt
+++ b/ext/mysqli/tests/mysqli_autocommit_oo.phpt
@@ -18,120 +18,124 @@ mysqli->autocommit()
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) {
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
+ if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
- if (!is_bool($tmp = $mysqli->autocommit(true)))
- printf("[002] Expecting boolean/any, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_bool($tmp = $mysqli->autocommit(true)))
+ printf("[002] Expecting boolean/any, got %s/%s\n", gettype($tmp), $tmp);
- if (!$mysqli->query('SET AUTOCOMMIT = 0'))
- printf("[003] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query('SET AUTOCOMMIT = 0'))
+ printf("[003] [%d] %s\n", $mysqli->errno, $mysqli->error);
- if (!$res = $mysqli->query('SELECT @@autocommit as auto_commit'))
- printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$res = $mysqli->query('SELECT @@autocommit as auto_commit'))
+ printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error);
- $tmp = $res->fetch_assoc();
- $res->free_result();
- if ($tmp['auto_commit'])
- printf("[005] Cannot turn off autocommit\n");
+ $tmp = $res->fetch_assoc();
+ $res->free_result();
+ if ($tmp['auto_commit'])
+ printf("[005] Cannot turn off autocommit\n");
- if (true !== ($tmp = $mysqli->autocommit( true)))
- printf("[006] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = $mysqli->autocommit( true)))
+ printf("[006] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
- if (!$res = $mysqli->query('SELECT @@autocommit as auto_commit'))
- printf("[007] [%d] %s\n", $mysqli->errno, $mysqli->error);
- $tmp = $res->fetch_assoc();
- $res->free_result();
- if (!$tmp['auto_commit'])
- printf("[008] Cannot turn on autocommit\n");
+ if (!$res = $mysqli->query('SELECT @@autocommit as auto_commit'))
+ printf("[007] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ $tmp = $res->fetch_assoc();
+ $res->free_result();
+ if (!$tmp['auto_commit'])
+ printf("[008] Cannot turn on autocommit\n");
- if (!$mysqli->query('DROP TABLE IF EXISTS test'))
- printf("[009] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query('DROP TABLE IF EXISTS test'))
+ printf("[009] [%d] %s\n", $mysqli->errno, $mysqli->error);
- if (!$mysqli->query('CREATE TABLE test(id INT) ENGINE = InnoDB')) {
- printf("[010] Cannot create test table, [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
+ if (!$mysqli->query('CREATE TABLE test(id INT) ENGINE = InnoDB')) {
+ printf("[010] Cannot create test table, [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
- if (!$mysqli->query('INSERT INTO test(id) VALUES (1)'))
- printf("[011] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query('INSERT INTO test(id) VALUES (1)'))
+ printf("[011] [%d] %s\n", $mysqli->errno, $mysqli->error);
- if (!$mysqli->query('ROLLBACK'))
- printf("[012] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query('ROLLBACK'))
+ printf("[012] [%d] %s\n", $mysqli->errno, $mysqli->error);
- if (!$res = $mysqli->query('SELECT COUNT(*) AS num FROM test'))
- printf("[013] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$res = $mysqli->query('SELECT COUNT(*) AS num FROM test'))
+ printf("[013] [%d] %s\n", $mysqli->errno, $mysqli->error);
- if ((!$tmp = $res->fetch_assoc()) || (1 != $tmp['num']))
- printf("[014] Expecting 1 row in table test, found %d rows. [%d] %s\n",
- $tmp['num'], $mysqli->errno, $mysqli->error);
+ if ((!$tmp = $res->fetch_assoc()) || (1 != $tmp['num']))
+ printf("[014] Expecting 1 row in table test, found %d rows. [%d] %s\n",
+ $tmp['num'], $mysqli->errno, $mysqli->error);
- $res->free_result();
+ $res->free_result();
- if (!$mysqli->query('DROP TABLE IF EXISTS test'))
- printf("[015] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query('DROP TABLE IF EXISTS test'))
+ printf("[015] [%d] %s\n", $mysqli->errno, $mysqli->error);
- if (!$mysqli->query('SET AUTOCOMMIT = 1'))
- printf("[016] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query('SET AUTOCOMMIT = 1'))
+ printf("[016] [%d] %s\n", $mysqli->errno, $mysqli->error);
- if (!$res = $mysqli->query('SELECT @@autocommit as auto_commit'))
- printf("[017] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$res = $mysqli->query('SELECT @@autocommit as auto_commit'))
+ printf("[017] [%d] %s\n", $mysqli->errno, $mysqli->error);
- $tmp = $res->fetch_assoc();
- $res->free_result();
- if (!$tmp['auto_commit'])
- printf("[018] Cannot turn on autocommit\n");
+ $tmp = $res->fetch_assoc();
+ $res->free_result();
+ if (!$tmp['auto_commit'])
+ printf("[018] Cannot turn on autocommit\n");
- if (true !== ($tmp = $mysqli->autocommit( false)))
- printf("[019] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = $mysqli->autocommit( false)))
+ printf("[019] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
- if (!$mysqli->query('CREATE TABLE test(id INT) ENGINE = InnoDB')) {
- printf("[020] Cannot create test table, [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
+ if (!$mysqli->query('CREATE TABLE test(id INT) ENGINE = InnoDB')) {
+ printf("[020] Cannot create test table, [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
- if (!$mysqli->query('INSERT INTO test(id) VALUES (1)'))
- printf("[021] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query('INSERT INTO test(id) VALUES (1)'))
+ printf("[021] [%d] %s\n", $mysqli->errno, $mysqli->error);
- if (!$mysqli->query('ROLLBACK'))
- printf("[022] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query('ROLLBACK'))
+ printf("[022] [%d] %s\n", $mysqli->errno, $mysqli->error);
- if (!$res = $mysqli->query('SELECT COUNT(*) AS num FROM test'))
- printf("[023] [%d] %s\n", $mysqli->errno, $mysqli->error);
- $tmp = $res->fetch_assoc();
- if (0 != $tmp['num'])
- printf("[24] Expecting 0 rows in table test, found %d rows\n", $tmp['num']);
- $res->free_result();
+ if (!$res = $mysqli->query('SELECT COUNT(*) AS num FROM test'))
+ printf("[023] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ $tmp = $res->fetch_assoc();
+ if (0 != $tmp['num'])
+ printf("[24] Expecting 0 rows in table test, found %d rows\n", $tmp['num']);
+ $res->free_result();
- if (!$mysqli->query('INSERT INTO test(id) VALUES (1)'))
- printf("[025] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query('INSERT INTO test(id) VALUES (1)'))
+ printf("[025] [%d] %s\n", $mysqli->errno, $mysqli->error);
- if (!$mysqli->query('COMMIT'))
- printf("[025] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query('COMMIT'))
+ printf("[025] [%d] %s\n", $mysqli->errno, $mysqli->error);
- if (!$res = $mysqli->query('SELECT COUNT(*) AS num FROM test'))
- printf("[027] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$res = $mysqli->query('SELECT COUNT(*) AS num FROM test'))
+ printf("[027] [%d] %s\n", $mysqli->errno, $mysqli->error);
- if ((!$tmp = $res->fetch_assoc()) || (1 != $tmp['num']))
- printf("[028] Expecting 1 row in table test, found %d rows. [%d] %s\n",
- $tmp['num'], $mysqli->errno, $mysqli->error);
- $res->free_result();
+ if ((!$tmp = $res->fetch_assoc()) || (1 != $tmp['num']))
+ printf("[028] Expecting 1 row in table test, found %d rows. [%d] %s\n",
+ $tmp['num'], $mysqli->errno, $mysqli->error);
+ $res->free_result();
- if (!$mysqli->query('DROP TABLE IF EXISTS test'))
- printf("[029] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query('DROP TABLE IF EXISTS test'))
+ printf("[029] [%d] %s\n", $mysqli->errno, $mysqli->error);
- $mysqli->close();
+ $mysqli->close();
- if (false !== ($tmp = @$mysqli->autocommit( false)))
- printf("[030] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ try {
+ $mysqli->autocommit(false);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
--EXPECT--
+my_mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_begin_transaction.phpt b/ext/mysqli/tests/mysqli_begin_transaction.phpt
index e3c36a2286..64fd7e3043 100644
--- a/ext/mysqli/tests/mysqli_begin_transaction.phpt
+++ b/ext/mysqli/tests/mysqli_begin_transaction.phpt
@@ -15,104 +15,83 @@ if (!have_innodb($link))
?>
--FILE--
<?php
- require_once("connect.inc");
- /* {{{ proto bool mysqli_begin_transaction(object link, [int flags [, string name]]) */
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_begin_transaction()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_begin_transaction($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_begin_transaction($link, $link)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[004] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
-
- if (!is_null($tmp = @mysqli_begin_transaction($link, $link)))
- printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_begin_transaction($link, 0, $link)))
- printf("[006] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_begin_transaction($link, 0, "mytrx", $link)))
- printf("[007] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB'))
- printf("[009] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (true !== ($tmp = mysqli_autocommit($link, true)))
- printf("[010] Cannot turn on autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp);
-
- /* overrule autocommit */
- if (true !== ($tmp = mysqli_begin_transaction($link)))
- printf("[011] Got %s - [%d] %s\n", var_dump($tmp, true), mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)'))
- printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- $tmp = mysqli_rollback($link);
- if ($tmp !== true)
- printf("[013] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- /* empty */
- $res = mysqli_query($link, "SELECT * FROM test");
- var_dump($res->fetch_assoc());
-
- /* valid flags */
- $flags = array(MYSQLI_TRANS_START_WITH_CONSISTENT_SNAPSHOT);
-
- if (mysqli_get_server_version($link) >= 50605) {
- $flags[] = MYSQLI_TRANS_START_READ_WRITE;
- $flags[] = MYSQLI_TRANS_START_READ_ONLY;
- }
-
- /* just coverage */
- foreach ($flags as $flag) {
- if (!mysqli_begin_transaction($link, $flag, sprintf("flag %d", $flag))) {
- printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- if (!mysqli_query($link, 'SELECT * FROM test') || !mysqli_rollback($link)) {
- printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- }
-
- /* does it really set a flag? */
- if (mysqli_get_server_version($link) >= 50605) {
- if (!mysqli_begin_transaction($link, MYSQLI_TRANS_START_READ_ONLY, sprintf("flag %d", $flag))) {
- printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- if (mysqli_query($link, "INSERT INTO test(id) VALUES (2)")) {
- printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- } else if (!mysqli_commit($link)) {
- printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- } else {
- $res = mysqli_query($link, "SELECT id FROM test WHERE id = 2");
- }
- }
-
- if (!mysqli_begin_transaction($link, -1)) {
- printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
-
- if (mysqli_get_server_version($link) >= 50605) {
- /* does it like stupid names? */
- if (@!$link->begin_transaction(MYSQLI_TRANS_START_READ_WRITE, "*/trick me?\n\0"))
- printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- /* does it like stupid names? */
- if (@!$link->begin_transaction(MYSQLI_TRANS_START_READ_WRITE, "az09"))
- printf("[021] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
-
- print "done!";
+ require_once("connect.inc");
+ /* {{{ proto bool mysqli_begin_transaction(object link, [int flags [, string name]]) */
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[004] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB'))
+ printf("[009] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (true !== ($tmp = mysqli_autocommit($link, true)))
+ printf("[010] Cannot turn on autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp);
+
+ /* overrule autocommit */
+ if (true !== ($tmp = mysqli_begin_transaction($link)))
+ printf("[011] Got %s - [%d] %s\n", var_dump($tmp, true), mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)'))
+ printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ $tmp = mysqli_rollback($link);
+ if ($tmp !== true)
+ printf("[013] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ /* empty */
+ $res = mysqli_query($link, "SELECT * FROM test");
+ var_dump($res->fetch_assoc());
+
+ /* valid flags */
+ $flags = array(MYSQLI_TRANS_START_WITH_CONSISTENT_SNAPSHOT);
+
+ if (mysqli_get_server_version($link) >= 50605) {
+ $flags[] = MYSQLI_TRANS_START_READ_WRITE;
+ $flags[] = MYSQLI_TRANS_START_READ_ONLY;
+ }
+
+ /* just coverage */
+ foreach ($flags as $flag) {
+ if (!mysqli_begin_transaction($link, $flag, sprintf("flag %d", $flag))) {
+ printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ if (!mysqli_query($link, 'SELECT * FROM test') || !mysqli_rollback($link)) {
+ printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ }
+
+ /* does it really set a flag? */
+ if (mysqli_get_server_version($link) >= 50605) {
+ if (!mysqli_begin_transaction($link, MYSQLI_TRANS_START_READ_ONLY, sprintf("flag %d", $flag))) {
+ printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ if (mysqli_query($link, "INSERT INTO test(id) VALUES (2)")) {
+ printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ } else if (!mysqli_commit($link)) {
+ printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ } else {
+ $res = mysqli_query($link, "SELECT id FROM test WHERE id = 2");
+ }
+ }
+
+ if (!mysqli_begin_transaction($link, -1)) {
+ printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ if (mysqli_get_server_version($link) >= 50605) {
+ /* does it like stupid names? */
+ if (@!$link->begin_transaction(MYSQLI_TRANS_START_READ_WRITE, "*/trick me?\n\0"))
+ printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ /* does it like stupid names? */
+ if (@!$link->begin_transaction(MYSQLI_TRANS_START_READ_WRITE, "az09"))
+ printf("[021] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_change_user.phpt b/ext/mysqli/tests/mysqli_change_user.phpt
index 7b9f23cf9e..347126a7d4 100644
--- a/ext/mysqli/tests/mysqli_change_user.phpt
+++ b/ext/mysqli/tests/mysqli_change_user.phpt
@@ -8,141 +8,127 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[006] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (!is_null($tmp = @mysqli_change_user()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = @mysqli_change_user($link, $user . '_unknown_really', $passwd . 'non_empty', $db)))
+ printf("[007] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_change_user($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[008] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (!is_null($tmp = @mysqli_change_user($link, $link)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = @mysqli_change_user($link, $user, $passwd . '_unknown_really', $db)))
+ printf("[009] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_change_user($link, $link, $link)))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ // Reconnect because after 3 failed change_user attempts, the server blocks you off.
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[009a] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (!is_null($tmp = @mysqli_change_user($link, $link, $link, $link, $link)))
- printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_query($link, 'SET @mysqli_change_user_test_var=1'))
+ printf("[010] Failed to set test variable: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[006] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$res = mysqli_query($link, 'SELECT @mysqli_change_user_test_var AS test_var'))
+ printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ if (1 != $tmp['test_var'])
+ printf("[012] Cannot set test variable\n");
- if (false !== ($tmp = @mysqli_change_user($link, $user . '_unknown_really', $passwd . 'non_empty', $db)))
- printf("[007] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_change_user($link, $user, $passwd, $db)))
+ printf("[013] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[008] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$res = mysqli_query($link, 'SELECT database() AS dbname, user() AS user'))
+ printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
- if (false !== ($tmp = @mysqli_change_user($link, $user, $passwd . '_unknown_really', $db)))
- printf("[009] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (substr($tmp['user'], 0, strlen($user)) !== $user)
+ printf("[015] Expecting user %s, got user() %s\n", $user, $tmp['user']);
+ if ($tmp['dbname'] != $db)
+ printf("[016] Expecting database %s, got database() %s\n", $db, $tmp['dbname']);
- // Reconnect because after 3 failed change_user attempts, the server blocks you off.
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[009a] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (false !== ($tmp = @mysqli_change_user($link, $user, $passwd, $db . '_unknown_really')))
+ printf("[011] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_query($link, 'SET @mysqli_change_user_test_var=1'))
- printf("[010] Failed to set test variable: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_close($link);
- if (!$res = mysqli_query($link, 'SELECT @mysqli_change_user_test_var AS test_var'))
- printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- if (1 != $tmp['test_var'])
- printf("[012] Cannot set test variable\n");
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[012] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
- if (true !== ($tmp = mysqli_change_user($link, $user, $passwd, $db)))
- printf("[013] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = @mysqli_change_user($link, str_repeat('user', 16384), str_repeat('pass', 16384), str_repeat('dbase', 16384))))
+ printf("[013] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- if (!$res = mysqli_query($link, 'SELECT database() AS dbname, user() AS user'))
- printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
+ mysqli_close($link);
- if (substr($tmp['user'], 0, strlen($user)) !== $user)
- printf("[015] Expecting user %s, got user() %s\n", $user, $tmp['user']);
- if ($tmp['dbname'] != $db)
- printf("[016] Expecting database %s, got database() %s\n", $db, $tmp['dbname']);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[014] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
- if (false !== ($tmp = @mysqli_change_user($link, $user, $passwd, $db . '_unknown_really')))
- printf("[011] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_close($link);
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[012] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
-
- if (false !== ($tmp = @mysqli_change_user($link, str_repeat('user', 16384), str_repeat('pass', 16384), str_repeat('dbase', 16384))))
- printf("[013] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_close($link);
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[014] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
-
- /* silent protocol change if no db which requires workaround in mysqlnd/libmysql
+ /* silent protocol change if no db which requires workaround in mysqlnd/libmysql
(empty db = no db send with COM_CHANGE_USER) */
- if (true !== ($tmp = mysqli_change_user($link, $user, $passwd, "")))
- printf("[015] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!$res = mysqli_query($link, 'SELECT database() AS dbname, user() AS user'))
- printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
-
- if ($tmp['dbname'] != "")
- printf("[017] Expecting database '', got database() '%s'\n", $tmp['dbname']);
-
- mysqli_close($link);
-
- if (false !== ($tmp = @mysqli_change_user($link, $user, $passwd, $db)))
- printf("[018] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[019] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
-
- if (!mysqli_query($link, 'SET @mysqli_change_user_test_var=1'))
- printf("[020] Failed to set test variable: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!$res = mysqli_query($link, 'SELECT @mysqli_change_user_test_var AS test_var'))
- printf("[021] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- if (1 != $tmp['test_var'])
- printf("[022] Cannot set test variable\n");
-
- if (true !== ($tmp = mysqli_change_user($link, $user, $passwd, $db)))
- printf("[023] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!$res = mysqli_query($link, 'SELECT database() AS dbname, user() AS user'))
- printf("[024] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
-
- if (substr($tmp['user'], 0, strlen($user)) !== $user)
- printf("[025] Expecting user %s, got user() %s\n", $user, $tmp['user']);
- if ($tmp['dbname'] != $db)
- printf("[026] Expecting database %s, got database() %s\n", $db, $tmp['dbname']);
-
- if (!$res = mysqli_query($link, 'SELECT @mysqli_change_user_test_var AS test_var'))
- printf("[027] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- if (NULL !== $tmp['test_var'])
- printf("[028] Test variable is still set!\n");
-
- print "done!";
+ if (true !== ($tmp = mysqli_change_user($link, $user, $passwd, "")))
+ printf("[015] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!$res = mysqli_query($link, 'SELECT database() AS dbname, user() AS user'))
+ printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+
+ if ($tmp['dbname'] != "")
+ printf("[017] Expecting database '', got database() '%s'\n", $tmp['dbname']);
+
+ mysqli_close($link);
+
+ try {
+ mysqli_change_user($link, $user, $passwd, $db);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[019] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+
+ if (!mysqli_query($link, 'SET @mysqli_change_user_test_var=1'))
+ printf("[020] Failed to set test variable: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!$res = mysqli_query($link, 'SELECT @mysqli_change_user_test_var AS test_var'))
+ printf("[021] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ if (1 != $tmp['test_var'])
+ printf("[022] Cannot set test variable\n");
+
+ if (true !== ($tmp = mysqli_change_user($link, $user, $passwd, $db)))
+ printf("[023] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!$res = mysqli_query($link, 'SELECT database() AS dbname, user() AS user'))
+ printf("[024] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+
+ if (substr($tmp['user'], 0, strlen($user)) !== $user)
+ printf("[025] Expecting user %s, got user() %s\n", $user, $tmp['user']);
+ if ($tmp['dbname'] != $db)
+ printf("[026] Expecting database %s, got database() %s\n", $db, $tmp['dbname']);
+
+ if (!$res = mysqli_query($link, 'SELECT @mysqli_change_user_test_var AS test_var'))
+ printf("[027] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ if (NULL !== $tmp['test_var'])
+ printf("[028] Test variable is still set!\n");
+
+ print "done!";
?>
--EXPECT--
+mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_change_user_get_lock.phpt b/ext/mysqli/tests/mysqli_change_user_get_lock.phpt
index 4cc071d7ab..75d0930a83 100644
--- a/ext/mysqli/tests/mysqli_change_user_get_lock.phpt
+++ b/ext/mysqli/tests/mysqli_change_user_get_lock.phpt
@@ -11,87 +11,87 @@ die("skip - is the server still buggy?");
max_execution_time=240
--FILE--
<?php
- require_once('connect.inc');
- require_once('table.inc');
+ require_once('connect.inc');
+ require_once('table.inc');
- // We need this little hack to be able to re-run the test
- $lock = 'phptest_' . mt_rand(0, 100000);
- $thread_id = mysqli_thread_id($link);
+ // We need this little hack to be able to re-run the test
+ $lock = 'phptest_' . mt_rand(0, 100000);
+ $thread_id = mysqli_thread_id($link);
- printf("Testing GET_LOCK()...\n");
+ printf("Testing GET_LOCK()...\n");
- if (!$res = mysqli_query($link, sprintf('SELECT GET_LOCK("%s", 2) AS _ok', $lock)))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, sprintf('SELECT GET_LOCK("%s", 2) AS _ok', $lock)))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$row = mysqli_fetch_assoc($res))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if ($row['_ok'] != 1)
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- else
- printf("... lock '%s' acquired by thread %d\n", $lock, $thread_id);
+ if ($row['_ok'] != 1)
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ else
+ printf("... lock '%s' acquired by thread %d\n", $lock, $thread_id);
- mysqli_free_result($res);
+ mysqli_free_result($res);
- // GET_LOCK("phptest") should be released
- /* From the mysql_change_user documentation:
+ // GET_LOCK("phptest") should be released
+ /* From the mysql_change_user documentation:
This command resets the state as if one had done a new connect. (See Section 25.2.13, “Controlling Automatic Reconnect Behaviorâ€.) It always performs a ROLLBACK of any active transactions, closes and drops all temporary tables, and unlocks all locked tables. Session system variables are reset to the values of the corresponding global system variables. Prepared statements are released and HANDLER variables are closed. Locks acquired with GET_LOCK() are released. These effects occur even if the user didn't change.
- */
- mysqli_change_user($link, $user, $passwd, $db);
+ */
+ mysqli_change_user($link, $user, $passwd, $db);
sleep(5);
- $new_thread_id = mysqli_thread_id($link);
+ $new_thread_id = mysqli_thread_id($link);
- printf("... calling IS_USED_LOCK() on '%s' using thread '%d'\n", $lock, $new_thread_id);
- if (!$res = mysqli_query($link, 'SELECT IS_USED_LOCK("phptest") AS _ok'))
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ printf("... calling IS_USED_LOCK() on '%s' using thread '%d'\n", $lock, $new_thread_id);
+ if (!$res = mysqli_query($link, 'SELECT IS_USED_LOCK("phptest") AS _ok'))
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$row = mysqli_fetch_assoc($res))
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if ($row['_ok'] != NULL)
- printf("[006] Lock '%s' should have been released, [%d] %s\n",
- $lock,
- mysqli_errno($link), mysqli_error($link));
+ if ($row['_ok'] != NULL)
+ printf("[006] Lock '%s' should have been released, [%d] %s\n",
+ $lock,
+ mysqli_errno($link), mysqli_error($link));
- printf("... calling IS_FREE_LOCK() on '%s' using thread '%d'\n", $lock, $new_thread_id);
- if (!$res = mysqli_query($link, 'SELECT IS_FREE_LOCK("phptest") AS _ok'))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ printf("... calling IS_FREE_LOCK() on '%s' using thread '%d'\n", $lock, $new_thread_id);
+ if (!$res = mysqli_query($link, 'SELECT IS_FREE_LOCK("phptest") AS _ok'))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$row = mysqli_fetch_assoc($res))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if ($row['_ok'] != 1)
- printf("[009] Lock '%s' should have been released, [%d] %s\n",
- $lock,
- mysqli_errno($link), mysqli_error($link));
+ if ($row['_ok'] != 1)
+ printf("[009] Lock '%s' should have been released, [%d] %s\n",
+ $lock,
+ mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
+ mysqli_free_result($res);
- /* Ok, let's try a NEW connection and a NEW lock! */
- mysqli_close($link);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[010] Cannot open new connection, [%d] %s\n",
- mysqli_connect_errno(), mysqli_connect_error());
+ /* Ok, let's try a NEW connection and a NEW lock! */
+ mysqli_close($link);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[010] Cannot open new connection, [%d] %s\n",
+ mysqli_connect_errno(), mysqli_connect_error());
- do {
- $newlock = 'phptest_' . mt_rand(0, 100000);
- } while ($lock == $newlock);
+ do {
+ $newlock = 'phptest_' . mt_rand(0, 100000);
+ } while ($lock == $newlock);
- $new_thread_id = mysqli_thread_id($link);
- printf("... calling IS_USED_LOCK() on '%s' using new connection with thread '%d'\n", $newlock, $new_thread_id);
- if (!$res = mysqli_query($link, 'SELECT IS_USED_LOCK("phptest") AS _ok'))
- printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $new_thread_id = mysqli_thread_id($link);
+ printf("... calling IS_USED_LOCK() on '%s' using new connection with thread '%d'\n", $newlock, $new_thread_id);
+ if (!$res = mysqli_query($link, 'SELECT IS_USED_LOCK("phptest") AS _ok'))
+ printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$row = mysqli_fetch_assoc($res))
- printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if ($row['_ok'] != NULL)
- printf("[013] Lock '%s' should have been released, [%d] %s\n",
- $lock,
- mysqli_errno($link), mysqli_error($link));
+ if ($row['_ok'] != NULL)
+ printf("[013] Lock '%s' should have been released, [%d] %s\n",
+ $lock,
+ mysqli_errno($link), mysqli_error($link));
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_change_user_insert_id.phpt b/ext/mysqli/tests/mysqli_change_user_insert_id.phpt
index d25e09b2f5..52e1c1c491 100644
--- a/ext/mysqli/tests/mysqli_change_user_insert_id.phpt
+++ b/ext/mysqli/tests/mysqli_change_user_insert_id.phpt
@@ -13,49 +13,49 @@ if (!$IS_MYSQLND) {
?>
--FILE--
<?php
- require_once('connect.inc');
+ require_once('connect.inc');
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, 'CREATE TABLE test(id INT AUTO_INCREMENT PRIMARY KEY, label CHAR(10))'))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'CREATE TABLE test(id INT AUTO_INCREMENT PRIMARY KEY, label CHAR(10))'))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, 'z')"))
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, 'z')"))
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (($insert_id = mysqli_insert_id($link)) !== 100)
- printf("[005] Expecting 100, got %d, [%d] %s\n",
- $insert_id,
- mysqli_errno($link), mysqli_error($link));
+ if (($insert_id = mysqli_insert_id($link)) !== 100)
+ printf("[005] Expecting 100, got %d, [%d] %s\n",
+ $insert_id,
+ mysqli_errno($link), mysqli_error($link));
- // LAST_INSERT_ID should be reset
- mysqli_change_user($link, $user, $passwd, $db);
+ // LAST_INSERT_ID should be reset
+ mysqli_change_user($link, $user, $passwd, $db);
- if (($insert_id = mysqli_insert_id($link)) !== 0)
- printf("[006] Expecting 0, got %d, [%d] %s\n",
- $insert_id,
- mysqli_errno($link), mysqli_error($link));
+ if (($insert_id = mysqli_insert_id($link)) !== 0)
+ printf("[006] Expecting 0, got %d, [%d] %s\n",
+ $insert_id,
+ mysqli_errno($link), mysqli_error($link));
- if (!$res = mysqli_query($link, 'SELECT LAST_INSERT_ID() as _insert_id'))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, 'SELECT LAST_INSERT_ID() as _insert_id'))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$row = mysqli_fetch_assoc($res))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_free_result($res);
- if ($row['_insert_id'] != $insert_id)
- printf("LAST_INSERT_ID() [%d] and mysqli_insert_id [%d] differ!\n",
- $row['_insert_id'], $insert_id);
+ if ($row['_insert_id'] != $insert_id)
+ printf("LAST_INSERT_ID() [%d] and mysqli_insert_id [%d] differ!\n",
+ $row['_insert_id'], $insert_id);
- if ($row['_insert_id'] != 0)
- printf("Expecting 0 got %d\n", $row['_insert_id']);
+ if ($row['_insert_id'] != 0)
+ printf("Expecting 0 got %d\n", $row['_insert_id']);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_change_user_locks_temporary.phpt b/ext/mysqli/tests/mysqli_change_user_locks_temporary.phpt
index fa8c66f56b..f9e0e30644 100644
--- a/ext/mysqli/tests/mysqli_change_user_locks_temporary.phpt
+++ b/ext/mysqli/tests/mysqli_change_user_locks_temporary.phpt
@@ -9,95 +9,95 @@ die("skip - is the server still buggy?");
?>
--FILE--
<?php
- require_once('connect.inc');
- require_once('table.inc');
+ require_once('connect.inc');
+ require_once('table.inc');
- if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot create second connection handle, [%d] %s\n",
- mysqli_connect_errno(), mysqli_connect_error());
+ if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot create second connection handle, [%d] %s\n",
+ mysqli_connect_errno(), mysqli_connect_error());
- if (!mysqli_query($link, 'LOCK TABLE test WRITE'))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'LOCK TABLE test WRITE'))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- /*
- if ($res = mysqli_query($link2, 'SELECT COUNT(*) AS _num FROM test')) {
- printf("[003] Reading from test should not be possible due to a lock, [%d] %s\n",
- mysqli_errno($link2), mysqli_error($link2));
- mysqli_free_result($res);
- }
- */
+ /*
+ if ($res = mysqli_query($link2, 'SELECT COUNT(*) AS _num FROM test')) {
+ printf("[003] Reading from test should not be possible due to a lock, [%d] %s\n",
+ mysqli_errno($link2), mysqli_error($link2));
+ mysqli_free_result($res);
+ }
+ */
- // LOCKS should be removed
- mysqli_change_user($link, $user, $passwd, $db);
+ // LOCKS should be removed
+ mysqli_change_user($link, $user, $passwd, $db);
- if (!$res = mysqli_query($link2, 'SELECT COUNT(*) AS _num FROM test'))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link2, 'SELECT COUNT(*) AS _num FROM test'))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$row = mysqli_fetch_assoc($res))
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if ($row['_num'] < 1)
- printf("[005] There should be some rows in the table test\n");
+ if ($row['_num'] < 1)
+ printf("[005] There should be some rows in the table test\n");
- mysqli_free_result($res);
- mysqli_close($link2);
+ mysqli_free_result($res);
+ mysqli_close($link2);
- if (!mysqli_query($link, 'DROP TABLE test'))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'DROP TABLE test'))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, 'CREATE TEMPORARY TABLE test(id INT)'))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'CREATE TEMPORARY TABLE test(id INT)'))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1), (2), (3)'))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1), (2), (3)'))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS _num FROM test'))
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS _num FROM test'))
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$row = mysqli_fetch_assoc($res))
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if ($row['_num'] != 3)
- printf("[011] There should be three rows in the table test\n");
+ if ($row['_num'] != 3)
+ printf("[011] There should be three rows in the table test\n");
- mysqli_free_result($res);
+ mysqli_free_result($res);
- // Temporary tables should be dropped
- mysqli_change_user($link, $user, $passwd, $db);
+ // Temporary tables should be dropped
+ mysqli_change_user($link, $user, $passwd, $db);
- if ($res = mysqli_query($link, 'SELECT COUNT(*) AS _num FROM test')) {
- printf("[012] There should be no table test any more, [%d] %s\n",
- mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
- }
+ if ($res = mysqli_query($link, 'SELECT COUNT(*) AS _num FROM test')) {
+ printf("[012] There should be no table test any more, [%d] %s\n",
+ mysqli_errno($link), mysqli_error($link));
+ mysqli_free_result($res);
+ }
- if (!$res = mysqli_query($link, 'SELECT GET_LOCK("phptest", 2) AS _ok'))
- printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, 'SELECT GET_LOCK("phptest", 2) AS _ok'))
+ printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$row = mysqli_fetch_assoc($res))
- printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if ($row['_ok'] != 1)
- printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if ($row['_ok'] != 1)
+ printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
+ mysqli_free_result($res);
- // GET_LOCK("phptest") should be released
- mysqli_change_user($link, $user, $passwd, $db);
+ // GET_LOCK("phptest") should be released
+ mysqli_change_user($link, $user, $passwd, $db);
- if (!$res = mysqli_query($link, 'SELECT IS_FREE_LOCK("phptest") AS _ok'))
- printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, 'SELECT IS_FREE_LOCK("phptest") AS _ok'))
+ printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$row = mysqli_fetch_assoc($res))
- printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if ($row['_ok'] != 1)
- printf("[018] Lock 'phptest' should have been released, [%d] %s\n",
- mysqli_errno($link), mysqli_error($link));
+ if ($row['_ok'] != 1)
+ printf("[018] Lock 'phptest' should have been released, [%d] %s\n",
+ mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
- mysqli_close($link);
- print "done!";
+ mysqli_free_result($res);
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_change_user_new.phpt b/ext/mysqli/tests/mysqli_change_user_new.phpt
index e9ef937406..1d6d2f5945 100644
--- a/ext/mysqli/tests/mysqli_change_user_new.phpt
+++ b/ext/mysqli/tests/mysqli_change_user_new.phpt
@@ -15,25 +15,25 @@ if (mysqli_get_server_version($link) < 50600)
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- /* Pre 5.6: link remains useable */
- if (false !== ($tmp = @mysqli_change_user($link, $user . '_unknown_really', $passwd . 'non_empty', $db)))
- printf("[002] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ /* Pre 5.6: link remains useable */
+ if (false !== ($tmp = @mysqli_change_user($link, $user . '_unknown_really', $passwd . 'non_empty', $db)))
+ printf("[002] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- if (!$res = mysqli_query($link, 'SELECT 1 AS _one'))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- else
- var_dump($res->fetch_assoc());
+ if (!$res = mysqli_query($link, 'SELECT 1 AS _one'))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ else
+ var_dump($res->fetch_assoc());
- print "done!";
+ print "done!";
?>
--EXPECT--
[003] [2006] MySQL server has gone away
diff --git a/ext/mysqli/tests/mysqli_change_user_old.phpt b/ext/mysqli/tests/mysqli_change_user_old.phpt
index a077d9c4b6..314ff2e6df 100644
--- a/ext/mysqli/tests/mysqli_change_user_old.phpt
+++ b/ext/mysqli/tests/mysqli_change_user_old.phpt
@@ -15,98 +15,98 @@ if (mysqli_get_server_version($link) >= 50600)
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[006] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[006] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (false !== ($tmp = mysqli_change_user($link, $user . '_unknown_really', $passwd . 'non_empty', $db)))
- printf("[007] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_change_user($link, $user . '_unknown_really', $passwd . 'non_empty', $db)))
+ printf("[007] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- if (false !== ($tmp = mysqli_change_user($link, $user, $passwd . '_unknown_really', $db)))
- printf("[008] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_change_user($link, $user, $passwd . '_unknown_really', $db)))
+ printf("[008] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- if (false !== ($tmp = mysqli_change_user($link, $user, $passwd, $db . '_unknown_really')))
- printf("[009] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_change_user($link, $user, $passwd, $db . '_unknown_really')))
+ printf("[009] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- // Reconnect because Percona and MariaDB block any commands after 3 failed
- // change_user commands
- mysqli_close($link);
+ // Reconnect because Percona and MariaDB block any commands after 3 failed
+ // change_user commands
+ mysqli_close($link);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[020] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
- if (!mysqli_query($link, 'SET @mysqli_change_user_test_var=1'))
- printf("[010] Failed to set test variable: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[020] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
+ if (!mysqli_query($link, 'SET @mysqli_change_user_test_var=1'))
+ printf("[010] Failed to set test variable: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$res = mysqli_query($link, 'SELECT @mysqli_change_user_test_var AS test_var'))
- printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- if (1 != $tmp['test_var'])
- printf("[012] Cannot set test variable\n");
+ if (!$res = mysqli_query($link, 'SELECT @mysqli_change_user_test_var AS test_var'))
+ printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ if (1 != $tmp['test_var'])
+ printf("[012] Cannot set test variable\n");
- if (true !== ($tmp = mysqli_change_user($link, $user, $passwd, $db)))
- printf("[013] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_change_user($link, $user, $passwd, $db)))
+ printf("[013] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
- if (!$res = mysqli_query($link, 'SELECT database() AS dbname, user() AS user'))
- printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
+ if (!$res = mysqli_query($link, 'SELECT database() AS dbname, user() AS user'))
+ printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
- if (substr($tmp['user'], 0, strlen($user)) !== $user)
- printf("[015] Expecting user %s, got user() %s\n", $user, $tmp['user']);
- if ($tmp['dbname'] != $db)
- printf("[016] Expecting database %s, got database() %s\n", $db, $tmp['dbname']);
+ if (substr($tmp['user'], 0, strlen($user)) !== $user)
+ printf("[015] Expecting user %s, got user() %s\n", $user, $tmp['user']);
+ if ($tmp['dbname'] != $db)
+ printf("[016] Expecting database %s, got database() %s\n", $db, $tmp['dbname']);
- if (!$res = mysqli_query($link, 'SELECT @mysqli_change_user_test_var AS test_var'))
- printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- if (NULL !== $tmp['test_var'])
- printf("[019] Test variable is still set!\n");
+ if (!$res = mysqli_query($link, 'SELECT @mysqli_change_user_test_var AS test_var'))
+ printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ if (NULL !== $tmp['test_var'])
+ printf("[019] Test variable is still set!\n");
- mysqli_close($link);
+ mysqli_close($link);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[020] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[020] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
- if (false !== ($tmp = mysqli_change_user($link, str_repeat('user', 16384), str_repeat('pass', 16384), str_repeat('dbase', 16384))))
- printf("[021] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_change_user($link, str_repeat('user', 16384), str_repeat('pass', 16384), str_repeat('dbase', 16384))))
+ printf("[021] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
+ mysqli_close($link);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[022] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[022] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
- /* silent protocol change if no db which requires workaround in mysqlnd/libmysql
+ /* silent protocol change if no db which requires workaround in mysqlnd/libmysql
(empty db = no db send with COM_CHANGE_USER) */
- if (true !== ($tmp = mysqli_change_user($link, $user, $passwd, "")))
- printf("[023] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_change_user($link, $user, $passwd, "")))
+ printf("[023] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
- if (!$res = mysqli_query($link, 'SELECT database() AS dbname, user() AS user'))
- printf("[024] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
+ if (!$res = mysqli_query($link, 'SELECT database() AS dbname, user() AS user'))
+ printf("[024] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
- if ($tmp['dbname'] != "")
- printf("[025] Expecting database '', got database() '%s'\n", $tmp['dbname']);
+ if ($tmp['dbname'] != "")
+ printf("[025] Expecting database '', got database() '%s'\n", $tmp['dbname']);
- mysqli_close($link);
+ mysqli_close($link);
- if (false !== ($tmp = @mysqli_change_user($link, $user, $passwd, $db)))
- printf("[026] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = @mysqli_change_user($link, $user, $passwd, $db)))
+ printf("[026] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_change_user_oo.phpt b/ext/mysqli/tests/mysqli_change_user_oo.phpt
index 7707cca095..5ef86a1443 100644
--- a/ext/mysqli/tests/mysqli_change_user_oo.phpt
+++ b/ext/mysqli/tests/mysqli_change_user_oo.phpt
@@ -16,65 +16,65 @@ if (mysqli_get_server_version($link) >= 50600)
?>
--FILE--
<?php
- include_once("connect.inc");
+ include_once("connect.inc");
- $link = NULL;
- $tmp = NULL;
+ $link = NULL;
+ $tmp = NULL;
- if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (false !== ($tmp = $mysqli->change_user($user . '_unknown_really', $passwd . 'non_empty', $db)))
- printf("[006] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = $mysqli->change_user($user . '_unknown_really', $passwd . 'non_empty', $db)))
+ printf("[006] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- if (false !== ($tmp = $mysqli->change_user($user, $passwd . '_unknown_really', $db)))
- printf("[007] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = $mysqli->change_user($user, $passwd . '_unknown_really', $db)))
+ printf("[007] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- if (false !== ($tmp = $mysqli->change_user($user, $passwd, $db . '_unknown_really')))
- printf("[008] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = $mysqli->change_user($user, $passwd, $db . '_unknown_really')))
+ printf("[008] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- // Reconnect because after 3 failed change_user attempts, the server blocks you off.
- if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ // Reconnect because after 3 failed change_user attempts, the server blocks you off.
+ if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (!$mysqli->query('SET @mysqli_change_user_test_var=1'))
- printf("[009] Failed to set test variable: [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (!$mysqli->query('SET @mysqli_change_user_test_var=1'))
+ printf("[009] Failed to set test variable: [%d] %s\n", $mysqli->errno, $mysqli->error);
- if (!$res = $mysqli->query('SELECT @mysqli_change_user_test_var AS test_var'))
- printf("[010] [%d] %s\n", $mysqli->errno, $mysqli->error);
- $tmp = $res->fetch_assoc();
- $res->free_result();
- if (1 != $tmp['test_var'])
- printf("[011] Cannot set test variable\n");
+ if (!$res = $mysqli->query('SELECT @mysqli_change_user_test_var AS test_var'))
+ printf("[010] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ $tmp = $res->fetch_assoc();
+ $res->free_result();
+ if (1 != $tmp['test_var'])
+ printf("[011] Cannot set test variable\n");
- if (true !== ($tmp = $mysqli->change_user($user, $passwd, $db)))
- printf("[012] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = $mysqli->change_user($user, $passwd, $db)))
+ printf("[012] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
- if (!$res = $mysqli->query('SELECT database() AS dbname, user() AS user'))
- printf("[013] [%d] %s\n", $mysqli->errno, $mysqli->error);
- $tmp = $res->fetch_assoc();
- $res->free_result();
+ if (!$res = $mysqli->query('SELECT database() AS dbname, user() AS user'))
+ printf("[013] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ $tmp = $res->fetch_assoc();
+ $res->free_result();
- if (substr($tmp['user'], 0, strlen($user)) !== $user)
- printf("[014] Expecting user %s, got user() %s\n", $user, $tmp['user']);
- if ($tmp['dbname'] != $db)
- printf("[015] Expecting database %s, got database() %s\n", $db, $tmp['dbname']);
+ if (substr($tmp['user'], 0, strlen($user)) !== $user)
+ printf("[014] Expecting user %s, got user() %s\n", $user, $tmp['user']);
+ if ($tmp['dbname'] != $db)
+ printf("[015] Expecting database %s, got database() %s\n", $db, $tmp['dbname']);
- if (!$res = $mysqli->query('SELECT @mysqli_change_user_test_var AS test_var'))
- printf("[016] [%d] %s\n", $mysqli->errno, $mysqli->error);
- $tmp = $res->fetch_assoc();
- $res->free_result();
- if (NULL !== $tmp['test_var'])
- printf("[017] Test variable is still set!\n");
+ if (!$res = $mysqli->query('SELECT @mysqli_change_user_test_var AS test_var'))
+ printf("[016] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ $tmp = $res->fetch_assoc();
+ $res->free_result();
+ if (NULL !== $tmp['test_var'])
+ printf("[017] Test variable is still set!\n");
- $mysqli->close();
+ $mysqli->close();
- if (false !== ($tmp = @$mysqli->change_user($user, $passwd, $db)))
- printf("[018] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = @$mysqli->change_user($user, $passwd, $db)))
+ printf("[018] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_change_user_prepared_statements.phpt b/ext/mysqli/tests/mysqli_change_user_prepared_statements.phpt
index 1f3eaceceb..4409d453ab 100644
--- a/ext/mysqli/tests/mysqli_change_user_prepared_statements.phpt
+++ b/ext/mysqli/tests/mysqli_change_user_prepared_statements.phpt
@@ -8,26 +8,26 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once('connect.inc');
+ require_once('connect.inc');
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- if (!$stmt = mysqli_prepare($link, "SELECT 'prepared statements should be released'"))
- printf("[002] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ if (!$stmt = mysqli_prepare($link, "SELECT 'prepared statements should be released'"))
+ printf("[002] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- mysqli_change_user($link, $user, $passwd, $db);
+ mysqli_change_user($link, $user, $passwd, $db);
- $wrong = null;
- if ($stmt->execute() && $stmt->bind_result($wrong) && $stmt->fetch()) {
- printf("This is wrong, because after a mysqli_change_user() %s\n", $wrong);
- } else {
- if ($stmt->errno == 0)
- printf("Error code 2013, 1243 or similar should have been set\n");
- }
+ $wrong = null;
+ if ($stmt->execute() && $stmt->bind_result($wrong) && $stmt->fetch()) {
+ printf("This is wrong, because after a mysqli_change_user() %s\n", $wrong);
+ } else {
+ if ($stmt->errno == 0)
+ printf("Error code 2013, 1243 or similar should have been set\n");
+ }
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_change_user_rollback.phpt b/ext/mysqli/tests/mysqli_change_user_rollback.phpt
index 1731abafef..19c4e36375 100644
--- a/ext/mysqli/tests/mysqli_change_user_rollback.phpt
+++ b/ext/mysqli/tests/mysqli_change_user_rollback.phpt
@@ -14,53 +14,53 @@ if (!have_innodb($link))
?>
--FILE--
<?php
- require_once('connect.inc');
- require_once('table.inc');
+ require_once('connect.inc');
+ require_once('table.inc');
- if (!mysqli_query($link, 'ALTER TABLE test ENGINE=InnoDB'))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'ALTER TABLE test ENGINE=InnoDB'))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_autocommit($link, false);
+ mysqli_autocommit($link, false);
- if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS _num FROM test'))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS _num FROM test'))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$row = mysqli_fetch_assoc($res))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_free_result($res);
- $num = $row['_num'];
- assert($num > 0);
+ $num = $row['_num'];
+ assert($num > 0);
- if (!$res = mysqli_query($link, 'DELETE FROM test'))
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, 'DELETE FROM test'))
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS _num FROM test'))
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS _num FROM test'))
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$row = mysqli_fetch_assoc($res))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_free_result($res);
- if (0 != $row['_num'])
- printf("[007] Rows should have been deleted in this transaction\n");
+ if (0 != $row['_num'])
+ printf("[007] Rows should have been deleted in this transaction\n");
- // DELETE should be rolled back
- mysqli_change_user($link, $user, $passwd, $db);
+ // DELETE should be rolled back
+ mysqli_change_user($link, $user, $passwd, $db);
- if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS _num FROM test'))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS _num FROM test'))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$row = mysqli_fetch_assoc($res))
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if ($row['_num'] != $num)
- printf("[010] Expecting %d rows in the table test, found %d rows\n",
- $num, $row['_num']);
+ if ($row['_num'] != $num)
+ printf("[010] Expecting %d rows in the table test, found %d rows\n",
+ $num, $row['_num']);
- mysqli_free_result($res);
- mysqli_close($link);
- print "done!";
+ mysqli_free_result($res);
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_change_user_set_names.phpt b/ext/mysqli/tests/mysqli_change_user_set_names.phpt
index 614aa7a023..bb2558b882 100644
--- a/ext/mysqli/tests/mysqli_change_user_set_names.phpt
+++ b/ext/mysqli/tests/mysqli_change_user_set_names.phpt
@@ -23,135 +23,135 @@ if ($version[0] <= 4 && $version[1] < 1)
?>
--FILE--
<?php
- require_once('connect.inc');
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
-
- if (!$res = mysqli_query($link, "SHOW CHARACTER SET LIKE 'latin%'"))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- $charsets = array();
- while ($row = mysqli_fetch_assoc($res))
- $charsets[$row['Charset']] = $row['Default collation'];
-
- mysqli_free_result($res);
- if (!mysqli_query($link, 'SET NAMES DEFAULT'))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!$res = mysqli_query($link, 'SELECT
- @@character_set_client AS charset_client,
- @@character_set_connection AS charset_connection,
- @@character_set_results AS charset_results,
- @@collation_connection AS collation_connection,
- @@collation_database AS collation_database,
- @@collation_server AS collation_server'))
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!$defaults = mysqli_fetch_assoc($res))
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
-
- $not_changed = $defaults;
- foreach ($charsets as $charset => $collation) {
-
- if (isset($not_changed['charset_client']) &&
- $charset != $not_changed['charset_client'] &&
- mysqli_query($link, sprintf("SET @@character_set_client = '%s'", $charset)))
- unset($not_changed['charset_client']);
-
- if (isset($not_changed['charset_connection']) &&
- $charset != $not_changed['charset_connection'] &&
- mysqli_query($link, sprintf("SET @@character_connection = '%s'", $charset)))
- unset($not_changed['charset_connection']);
-
- if (isset($not_changed['charset_results']) &&
- $charset != $not_changed['charset_results'] &&
- mysqli_query($link, sprintf("SET @@character_set_results = '%s'", $charset)))
- unset($not_changed['charset_results']);
-
- if (isset($not_changed['collation_connection']) &&
- $collation != $not_changed['collation_connection'] &&
- mysqli_query($link, sprintf("SET @@collation_connection = '%s'", $collation)))
- unset($not_changed['collation_connection']);
-
- if (isset($not_changed['collation_database']) &&
- $collation != $not_changed['collation_database'] &&
- mysqli_query($link, sprintf("SET @@collation_database = '%s'", $collation)))
- unset($not_changed['collation_database']);
-
- if (isset($not_changed['collation_server']) &&
- $collation != $not_changed['collation_server'] &&
- mysqli_query($link, sprintf("SET @@collation_server = '%s'", $collation)))
- unset($not_changed['collation_server']);
-
- if (empty($not_changed))
- break;
- }
-
- if (!$res = mysqli_query($link, 'SELECT
- @@character_set_client AS charset_client,
- @@character_set_connection AS charset_connection,
- @@character_set_results AS charset_results,
- @@collation_connection AS collation_connection,
- @@collation_database AS collation_database,
- @@collation_server AS collation_server'))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!$modified = mysqli_fetch_assoc($res))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
-
- if ($modified == $defaults)
- printf("[008] Not all settings have been changed\n");
-
- // LAST_INSERT_ID should be reset
- mysqli_change_user($link, $user, $passwd, $db);
-
- if (!$res = mysqli_query($link, 'SELECT
- @@character_set_client AS charset_client,
- @@character_set_connection AS charset_connection,
- @@character_set_results AS charset_results,
- @@collation_connection AS collation_connection,
- @@collation_database AS collation_database,
- @@collation_server AS collation_server'))
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!$new = mysqli_fetch_assoc($res))
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
-
- if ($new == $modified) {
- printf("[011] Charsets/collations have not been reset.\n");
- printf("Got:\n");
- var_dump($new);
- printf("Expected:\n");
- var_dump($defaults);
- }
-
- if ($new != $defaults) {
- printf("[012] Charsets/collations have not been reset to their defaults.\n");
- printf("Got:\n");
- var_dump($new);
- printf("Expected:\n");
- var_dump($defaults);
- }
-
- if (!is_object($charset = mysqli_get_charset($link)))
- printf("[013] Expecting object/std_class, got %s/%s\n", gettype($charset), $charset);
-
- if ($charset->charset != $defaults['charset_connection'])
- printf("[014] Expecting connection charset to be %s got %s\n",
- $defaults['charset_connection'],
- $charset->charset);
-
- if ($charset->collation != $defaults['collation_connection'])
- printf("[015] Expecting collation to be %s got %s\n",
- $defaults['collation_connection'],
- $charset->collation);
-
- mysqli_close($link);
- print "done!";
+ require_once('connect.inc');
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+
+ if (!$res = mysqli_query($link, "SHOW CHARACTER SET LIKE 'latin%'"))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ $charsets = array();
+ while ($row = mysqli_fetch_assoc($res))
+ $charsets[$row['Charset']] = $row['Default collation'];
+
+ mysqli_free_result($res);
+ if (!mysqli_query($link, 'SET NAMES DEFAULT'))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!$res = mysqli_query($link, 'SELECT
+ @@character_set_client AS charset_client,
+ @@character_set_connection AS charset_connection,
+ @@character_set_results AS charset_results,
+ @@collation_connection AS collation_connection,
+ @@collation_database AS collation_database,
+ @@collation_server AS collation_server'))
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!$defaults = mysqli_fetch_assoc($res))
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_free_result($res);
+
+ $not_changed = $defaults;
+ foreach ($charsets as $charset => $collation) {
+
+ if (isset($not_changed['charset_client']) &&
+ $charset != $not_changed['charset_client'] &&
+ mysqli_query($link, sprintf("SET @@character_set_client = '%s'", $charset)))
+ unset($not_changed['charset_client']);
+
+ if (isset($not_changed['charset_connection']) &&
+ $charset != $not_changed['charset_connection'] &&
+ mysqli_query($link, sprintf("SET @@character_connection = '%s'", $charset)))
+ unset($not_changed['charset_connection']);
+
+ if (isset($not_changed['charset_results']) &&
+ $charset != $not_changed['charset_results'] &&
+ mysqli_query($link, sprintf("SET @@character_set_results = '%s'", $charset)))
+ unset($not_changed['charset_results']);
+
+ if (isset($not_changed['collation_connection']) &&
+ $collation != $not_changed['collation_connection'] &&
+ mysqli_query($link, sprintf("SET @@collation_connection = '%s'", $collation)))
+ unset($not_changed['collation_connection']);
+
+ if (isset($not_changed['collation_database']) &&
+ $collation != $not_changed['collation_database'] &&
+ mysqli_query($link, sprintf("SET @@collation_database = '%s'", $collation)))
+ unset($not_changed['collation_database']);
+
+ if (isset($not_changed['collation_server']) &&
+ $collation != $not_changed['collation_server'] &&
+ mysqli_query($link, sprintf("SET @@collation_server = '%s'", $collation)))
+ unset($not_changed['collation_server']);
+
+ if (empty($not_changed))
+ break;
+ }
+
+ if (!$res = mysqli_query($link, 'SELECT
+ @@character_set_client AS charset_client,
+ @@character_set_connection AS charset_connection,
+ @@character_set_results AS charset_results,
+ @@collation_connection AS collation_connection,
+ @@collation_database AS collation_database,
+ @@collation_server AS collation_server'))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!$modified = mysqli_fetch_assoc($res))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_free_result($res);
+
+ if ($modified == $defaults)
+ printf("[008] Not all settings have been changed\n");
+
+ // LAST_INSERT_ID should be reset
+ mysqli_change_user($link, $user, $passwd, $db);
+
+ if (!$res = mysqli_query($link, 'SELECT
+ @@character_set_client AS charset_client,
+ @@character_set_connection AS charset_connection,
+ @@character_set_results AS charset_results,
+ @@collation_connection AS collation_connection,
+ @@collation_database AS collation_database,
+ @@collation_server AS collation_server'))
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!$new = mysqli_fetch_assoc($res))
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_free_result($res);
+
+ if ($new == $modified) {
+ printf("[011] Charsets/collations have not been reset.\n");
+ printf("Got:\n");
+ var_dump($new);
+ printf("Expected:\n");
+ var_dump($defaults);
+ }
+
+ if ($new != $defaults) {
+ printf("[012] Charsets/collations have not been reset to their defaults.\n");
+ printf("Got:\n");
+ var_dump($new);
+ printf("Expected:\n");
+ var_dump($defaults);
+ }
+
+ if (!is_object($charset = mysqli_get_charset($link)))
+ printf("[013] Expecting object/std_class, got %s/%s\n", gettype($charset), $charset);
+
+ if ($charset->charset != $defaults['charset_connection'])
+ printf("[014] Expecting connection charset to be %s got %s\n",
+ $defaults['charset_connection'],
+ $charset->charset);
+
+ if ($charset->collation != $defaults['collation_connection'])
+ printf("[015] Expecting collation to be %s got %s\n",
+ $defaults['collation_connection'],
+ $charset->collation);
+
+ mysqli_close($link);
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_character_set.phpt b/ext/mysqli/tests/mysqli_character_set.phpt
index 855141e40d..ee09719b64 100644
--- a/ext/mysqli/tests/mysqli_character_set.phpt
+++ b/ext/mysqli/tests/mysqli_character_set.phpt
@@ -12,92 +12,92 @@ if (!function_exists('mysqli_set_charset')) {
?>
--FILE--
<?php
- require_once("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
-
- if (!$res = mysqli_query($link, 'SELECT version() AS server_version'))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- $version = explode('.', $tmp['server_version']);
- if (empty($version))
- printf("[003] Cannot determine server version, need MySQL Server 4.1+ for the test!\n");
-
- if ($version[0] <= 4 && $version[1] < 1)
- printf("[004] Need MySQL Server 4.1+ for the test!\n");
-
- if (!$res = mysqli_query($link, "SHOW CHARACTER SET"))
- printf("[005] Cannot get list of available character sets, [%d] %s\n",
- mysqli_errno($link), mysqli_error($link));
-
- $charsets = array();
- while ($row = mysqli_fetch_assoc($res))
- $charsets[] = $row;
- mysqli_free_result($res);
-
- foreach ($charsets as $charset) {
- $k = $charset['Charset'];
- /* The server currently 17.07.2007 can't handle data sent in ucs2 */
- /* The server currently 16.08.2010 can't handle data sent in utf16 and utf32 */
- /* The server currently 02.09.2011 can't handle data sent in utf16le */
- if ($charset['Charset'] == 'ucs2' || $charset['Charset'] == 'utf16' || $charset['Charset'] == 'utf32' || 'utf16le' == $charset['Charset']) {
- continue;
- }
-
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
- printf("[006 + %s] [%d] %s\n", $k, mysqli_errno($link), mysqli_error($link));
-
- $sql = sprintf("CREATE TABLE test(id INT, label CHAR(1)) CHARACTER SET '%s' ", $charset['Charset']);
- if (!mysqli_query($link, $sql)) {
- printf("[007 + %s] %s [%d] %s\n", $k, $sql, mysqli_errno($link), mysqli_error($link));
- continue;
- }
-
- if (!mysqli_set_charset($link, $charset['Charset'])) {
- printf("[008 + %s] [%d] %s\n", $k, mysqli_errno($link), mysqli_error($link));
- continue;
- }
-
- for ($i = 1; $i <= 3; $i++) {
- if (!mysqli_query($link, sprintf("INSERT INTO test (id, label) VALUES (%d, '%s')",
- $i, mysqli_real_escape_string($link, chr(ord("a") + $i)))))
- {
- var_dump($charset['Charset']);
- printf("[009 + %s] [%d] %s\n", $k, mysqli_errno($link), mysqli_error($link));
- continue;
- }
- }
-
- if (!$res = mysqli_query($link, "SELECT id, label FROM test"))
- printf("[010 + %s] [%d] %s\n", $k, mysqli_errno($link), mysqli_error($link));
-
- for ($i = 1; $i <= 3; $i++) {
-
- if (!$tmp = mysqli_fetch_assoc($res))
- printf("[011 + %s] [%d] %s\n", $k, mysqli_errno($link), mysqli_error($link));
-
- if ($tmp['id'] != $i)
- printf("[012 + %s] Expecting %d, got %s, [%d] %s\n", $k,
- $i, $tmp['id'],
- mysqli_errno($link), mysqli_error($link));
-
- if ($tmp['label'] != chr(ord("a") + $i))
- printf("[013 + %s] Expecting %d, got %s, [%d] %s\n", $k,
- chr(ord("a") + $i), $tmp['label'],
- mysqli_errno($link), mysqli_error($link));
-
- }
- mysqli_free_result($res);
- }
-
- mysqli_close($link);
-
- print "done!";
+ require_once("connect.inc");
+
+ $tmp = NULL;
+ $link = NULL;
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+
+ if (!$res = mysqli_query($link, 'SELECT version() AS server_version'))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ $version = explode('.', $tmp['server_version']);
+ if (empty($version))
+ printf("[003] Cannot determine server version, need MySQL Server 4.1+ for the test!\n");
+
+ if ($version[0] <= 4 && $version[1] < 1)
+ printf("[004] Need MySQL Server 4.1+ for the test!\n");
+
+ if (!$res = mysqli_query($link, "SHOW CHARACTER SET"))
+ printf("[005] Cannot get list of available character sets, [%d] %s\n",
+ mysqli_errno($link), mysqli_error($link));
+
+ $charsets = array();
+ while ($row = mysqli_fetch_assoc($res))
+ $charsets[] = $row;
+ mysqli_free_result($res);
+
+ foreach ($charsets as $charset) {
+ $k = $charset['Charset'];
+ /* The server currently 17.07.2007 can't handle data sent in ucs2 */
+ /* The server currently 16.08.2010 can't handle data sent in utf16 and utf32 */
+ /* The server currently 02.09.2011 can't handle data sent in utf16le */
+ if ($charset['Charset'] == 'ucs2' || $charset['Charset'] == 'utf16' || $charset['Charset'] == 'utf32' || 'utf16le' == $charset['Charset']) {
+ continue;
+ }
+
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
+ printf("[006 + %s] [%d] %s\n", $k, mysqli_errno($link), mysqli_error($link));
+
+ $sql = sprintf("CREATE TABLE test(id INT, label CHAR(1)) CHARACTER SET '%s' ", $charset['Charset']);
+ if (!mysqli_query($link, $sql)) {
+ printf("[007 + %s] %s [%d] %s\n", $k, $sql, mysqli_errno($link), mysqli_error($link));
+ continue;
+ }
+
+ if (!mysqli_set_charset($link, $charset['Charset'])) {
+ printf("[008 + %s] [%d] %s\n", $k, mysqli_errno($link), mysqli_error($link));
+ continue;
+ }
+
+ for ($i = 1; $i <= 3; $i++) {
+ if (!mysqli_query($link, sprintf("INSERT INTO test (id, label) VALUES (%d, '%s')",
+ $i, mysqli_real_escape_string($link, chr(ord("a") + $i)))))
+ {
+ var_dump($charset['Charset']);
+ printf("[009 + %s] [%d] %s\n", $k, mysqli_errno($link), mysqli_error($link));
+ continue;
+ }
+ }
+
+ if (!$res = mysqli_query($link, "SELECT id, label FROM test"))
+ printf("[010 + %s] [%d] %s\n", $k, mysqli_errno($link), mysqli_error($link));
+
+ for ($i = 1; $i <= 3; $i++) {
+
+ if (!$tmp = mysqli_fetch_assoc($res))
+ printf("[011 + %s] [%d] %s\n", $k, mysqli_errno($link), mysqli_error($link));
+
+ if ($tmp['id'] != $i)
+ printf("[012 + %s] Expecting %d, got %s, [%d] %s\n", $k,
+ $i, $tmp['id'],
+ mysqli_errno($link), mysqli_error($link));
+
+ if ($tmp['label'] != chr(ord("a") + $i))
+ printf("[013 + %s] Expecting %d, got %s, [%d] %s\n", $k,
+ chr(ord("a") + $i), $tmp['label'],
+ mysqli_errno($link), mysqli_error($link));
+
+ }
+ mysqli_free_result($res);
+ }
+
+ mysqli_close($link);
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_character_set_name.phpt b/ext/mysqli/tests/mysqli_character_set_name.phpt
index 90dd46fa73..b2e9a4e4f5 100644
--- a/ext/mysqli/tests/mysqli_character_set_name.phpt
+++ b/ext/mysqli/tests/mysqli_character_set_name.phpt
@@ -8,68 +8,55 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- /* NOTE: http://bugs.mysql.com/bug.php?id=7923 makes this test fail very likely on all 4.1.x - 5.0.x! */
- require_once("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_character_set_name()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_character_set_name($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_character_set_name($link, $link, $link)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[005] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
-
- if (!$res = mysqli_query($link, 'SELECT version() AS server_version'))
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- $version = explode('.', $tmp['server_version']);
- if (empty($version))
- printf("[006] Cannot determine server version, need MySQL Server 4.1+ for the test!\n");
-
- if ($version[0] <= 4 && $version[1] < 1)
- printf("[007] Need MySQL Server 4.1+ for the test!\n");
-
- if (!$res = mysqli_query($link, 'SELECT @@character_set_connection AS charset, @@collation_connection AS collation'))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- if (!$tmp['charset'])
- printf("[009] Cannot determine current character set and collation\n");
-
- $charset = mysqli_character_set_name($link);
- if ($tmp['charset'] !== $charset) {
- if ($tmp['collation'] === $charset) {
- printf("[010] Could be known server bug http://bugs.mysql.com/bug.php?id=7923, collation %s instead of character set returned, expected string/%s, got %s/%s\n",
- $tmp['collation'], $tmp['charset'], gettype($charset), $charset);
- } else {
- printf("[011] Expecting character set %s/%s, got %s/%s\n", gettype($tmp['charset']), $tmp['charset'], gettype($charset), $charset);
- }
- }
-
- $charset2 = mysqli_character_set_name($link);
- if ($charset2 !== $charset) {
- printf("[012] Alias mysqli_character_set_name returned %s/%s, expected %s/%s\n", gettype($charset2), $charset2, gettype($charset), $charset);
- }
-
- mysqli_close($link);
-
- if (false !== ($tmp = @mysqli_character_set_name($link)))
- printf("[013] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- /* Make sure that the function alias exists */
- if (!is_null($tmp = @mysqli_character_set_name()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!";
-?>
+ /* NOTE: http://bugs.mysql.com/bug.php?id=7923 makes this test fail very likely on all 4.1.x - 5.0.x! */
+ require_once("connect.inc");
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[005] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+
+ if (!$res = mysqli_query($link, 'SELECT version() AS server_version'))
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ $version = explode('.', $tmp['server_version']);
+ if (empty($version))
+ printf("[006] Cannot determine server version, need MySQL Server 4.1+ for the test!\n");
+
+ if ($version[0] <= 4 && $version[1] < 1)
+ printf("[007] Need MySQL Server 4.1+ for the test!\n");
+
+ if (!$res = mysqli_query($link, 'SELECT @@character_set_connection AS charset, @@collation_connection AS collation'))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ if (!$tmp['charset'])
+ printf("[009] Cannot determine current character set and collation\n");
+
+ $charset = mysqli_character_set_name($link);
+ if ($tmp['charset'] !== $charset) {
+ if ($tmp['collation'] === $charset) {
+ printf("[010] Could be known server bug http://bugs.mysql.com/bug.php?id=7923, collation %s instead of character set returned, expected string/%s, got %s/%s\n",
+ $tmp['collation'], $tmp['charset'], gettype($charset), $charset);
+ } else {
+ printf("[011] Expecting character set %s/%s, got %s/%s\n", gettype($tmp['charset']), $tmp['charset'], gettype($charset), $charset);
+ }
+ }
+
+ $charset2 = mysqli_character_set_name($link);
+ if ($charset2 !== $charset) {
+ printf("[012] Alias mysqli_character_set_name returned %s/%s, expected %s/%s\n", gettype($charset2), $charset2, gettype($charset), $charset);
+ }
+
+ mysqli_close($link);
+
+ try {
+ mysqli_character_set_name($link);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ print "done!";
--EXPECT--
+mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_character_set_name_oo.phpt b/ext/mysqli/tests/mysqli_character_set_name_oo.phpt
index 5d303fd503..cedc138e68 100644
--- a/ext/mysqli/tests/mysqli_character_set_name_oo.phpt
+++ b/ext/mysqli/tests/mysqli_character_set_name_oo.phpt
@@ -8,63 +8,66 @@ mysqli_chararcter_set_name(), mysql_client_encoding() [alias]
?>
--FILE--
<?php
- /* NOTE: http://bugs.mysql.com/bug.php?id=7923 makes this test fail very likely on all 4.1.x - 5.0.x! */
- require_once("connect.inc");
+ /* NOTE: http://bugs.mysql.com/bug.php?id=7923 makes this test fail very likely on all 4.1.x - 5.0.x! */
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (!is_null($tmp = @$mysqli->character_set_name($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!$res = $mysqli->query('SELECT version() AS server_version'))
+ printf("[003] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ $tmp = $res->fetch_assoc();
+ $res->free_result();
+ $version = explode('.', $tmp['server_version']);
+ if (empty($version))
+ printf("[006] Cannot determine server version, need MySQL Server 4.1+ for the test!\n");
- if (!$res = $mysqli->query('SELECT version() AS server_version'))
- printf("[003] [%d] %s\n", $mysqli->errno, $mysqli->error);
- $tmp = $res->fetch_assoc();
- $res->free_result();
- $version = explode('.', $tmp['server_version']);
- if (empty($version))
- printf("[006] Cannot determine server version, need MySQL Server 4.1+ for the test!\n");
+ if ($version[0] <= 4 && $version[1] < 1)
+ printf("[007] Need MySQL Server 4.1+ for the test!\n");
- if ($version[0] <= 4 && $version[1] < 1)
- printf("[007] Need MySQL Server 4.1+ for the test!\n");
+ if (!$res = $mysqli->query('SELECT @@character_set_connection AS charset, @@collation_connection AS collation'))
+ printf("[008] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ $tmp = $res->fetch_assoc();
+ $res->free_result();
+ if (!$tmp['charset'])
+ printf("[009] Cannot determine current character set and collation\n");
- if (!$res = $mysqli->query('SELECT @@character_set_connection AS charset, @@collation_connection AS collation'))
- printf("[008] [%d] %s\n", $mysqli->errno, $mysqli->error);
- $tmp = $res->fetch_assoc();
- $res->free_result();
- if (!$tmp['charset'])
- printf("[009] Cannot determine current character set and collation\n");
+ $charset = $mysqli->character_set_name();
+ if ($tmp['charset'] !== $charset) {
+ if ($tmp['collation'] === $charset) {
+ printf("[010] Could be known server bug http://bugs.mysql.com/bug.php?id=7923, collation %s instead of character set returned, expected string/%s, got %s/%s\n",
+ $tmp['collation'], $tmp['charset'], gettype($charset), $charset);
+ } else {
+ printf("[011] Expecting character set %s/%s, got %s/%s\n", gettype($tmp['charset']), $tmp['charset'], gettype($charset), $charset);
+ }
+ }
- $charset = $mysqli->character_set_name();
- if ($tmp['charset'] !== $charset) {
- if ($tmp['collation'] === $charset) {
- printf("[010] Could be known server bug http://bugs.mysql.com/bug.php?id=7923, collation %s instead of character set returned, expected string/%s, got %s/%s\n",
- $tmp['collation'], $tmp['charset'], gettype($charset), $charset);
- } else {
- printf("[011] Expecting character set %s/%s, got %s/%s\n", gettype($tmp['charset']), $tmp['charset'], gettype($charset), $charset);
- }
- }
+ $charset2 = $mysqli->character_set_name();
+ if ($charset2 !== $charset) {
+ printf("[012] Alias mysqli_character_set_name returned %s/%s, expected %s/%s\n",
+ gettype($charset2), $charset2, gettype($charset), $charset);
+ }
- $charset2 = $mysqli->character_set_name();
- if ($charset2 !== $charset) {
- printf("[012] Alias mysqli_character_set_name returned %s/%s, expected %s/%s\n",
- gettype($charset2), $charset2, gettype($charset), $charset);
- }
+ $mysqli->close();
- $mysqli->close();
+ try {
+ $mysqli->character_set_name();
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- if (false !== ($tmp = @$mysqli->character_set_name()))
- printf("[013] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ try {
+ $mysqli->character_set_name();
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- /* Make sure that the function alias exists */
- if (false !== ($tmp = @$mysqli->character_set_name()))
- printf("[014] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!";
-?>
+ print "done!";
--EXPECT--
+my_mysqli object is already closed
+my_mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_class_mysqli_driver_interface.phpt b/ext/mysqli/tests/mysqli_class_mysqli_driver_interface.phpt
index 78784210bb..27cf9f0fc6 100644
--- a/ext/mysqli/tests/mysqli_class_mysqli_driver_interface.phpt
+++ b/ext/mysqli/tests/mysqli_class_mysqli_driver_interface.phpt
@@ -8,80 +8,80 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require('connect.inc');
- require('table.inc');
-
- $driver = new mysqli_driver();
-
- printf("Parent class:\n");
- var_dump(get_parent_class($driver));
-
- printf("\nMethods:\n");
- $methods = get_class_methods($driver);
- $expected_methods = array();
-
- foreach ($methods as $k => $method) {
- if (isset($expected_methods[$method])) {
- unset($expected_methods[$method]);
- unset($methods[$k]);
- }
- }
- if (!empty($expected_methods)) {
- printf("Dumping list of missing methods.\n");
- var_dump($expected_methods);
- }
- if (!empty($methods)) {
- printf("Dumping list of unexpected methods.\n");
- var_dump($methods);
- }
- if (empty($expected_methods) && empty($methods))
- printf("ok\n");
-
- printf("\nClass variables:\n");
- $variables = array_keys(get_class_vars(get_class($driver)));
- sort($variables);
- foreach ($variables as $k => $var)
- printf("%s\n", $var);
-
- printf("\nObject variables:\n");
- $variables = array_keys(get_object_vars($driver));
- foreach ($variables as $k => $var)
- printf("%s\n", $var);
-
- printf("\nMagic, magic properties:\n");
-
- assert(mysqli_get_client_info() === $driver->client_info);
- printf("driver->client_info = '%s'\n", $driver->client_info);
-
- assert(mysqli_get_client_version() === $driver->client_version);
- printf("driver->client_version = '%s'\n", $driver->client_version);
-
- assert($driver->driver_version > 0);
- printf("driver->driver_version = '%s'\n", $driver->driver_version);
-
- assert(in_array($driver->report_mode,
- array(
- MYSQLI_REPORT_ALL,
- MYSQLI_REPORT_STRICT,
- MYSQLI_REPORT_ERROR,
- MYSQLI_REPORT_INDEX,
- MYSQLI_REPORT_OFF
- )
- ));
-
- printf("driver->report_mode = '%s'\n", $driver->report_mode);
- $driver->report_mode = MYSQLI_REPORT_STRICT;
- assert($driver->report_mode === MYSQLI_REPORT_STRICT);
-
- assert(is_bool($driver->embedded));
- printf("driver->embedded = '%s'\n", $driver->embedded);
-
- printf("driver->reconnect = '%s'\n", $driver->reconnect);
-
- printf("\nAccess to undefined properties:\n");
- printf("driver->unknown = '%s'\n", @$driver->unknown);
-
- print "done!";
+ require('connect.inc');
+ require('table.inc');
+
+ $driver = new mysqli_driver();
+
+ printf("Parent class:\n");
+ var_dump(get_parent_class($driver));
+
+ printf("\nMethods:\n");
+ $methods = get_class_methods($driver);
+ $expected_methods = array();
+
+ foreach ($methods as $k => $method) {
+ if (isset($expected_methods[$method])) {
+ unset($expected_methods[$method]);
+ unset($methods[$k]);
+ }
+ }
+ if (!empty($expected_methods)) {
+ printf("Dumping list of missing methods.\n");
+ var_dump($expected_methods);
+ }
+ if (!empty($methods)) {
+ printf("Dumping list of unexpected methods.\n");
+ var_dump($methods);
+ }
+ if (empty($expected_methods) && empty($methods))
+ printf("ok\n");
+
+ printf("\nClass variables:\n");
+ $variables = array_keys(get_class_vars(get_class($driver)));
+ sort($variables);
+ foreach ($variables as $k => $var)
+ printf("%s\n", $var);
+
+ printf("\nObject variables:\n");
+ $variables = array_keys(get_object_vars($driver));
+ foreach ($variables as $k => $var)
+ printf("%s\n", $var);
+
+ printf("\nMagic, magic properties:\n");
+
+ assert(mysqli_get_client_info() === $driver->client_info);
+ printf("driver->client_info = '%s'\n", $driver->client_info);
+
+ assert(mysqli_get_client_version() === $driver->client_version);
+ printf("driver->client_version = '%s'\n", $driver->client_version);
+
+ assert($driver->driver_version > 0);
+ printf("driver->driver_version = '%s'\n", $driver->driver_version);
+
+ assert(in_array($driver->report_mode,
+ array(
+ MYSQLI_REPORT_ALL,
+ MYSQLI_REPORT_STRICT,
+ MYSQLI_REPORT_ERROR,
+ MYSQLI_REPORT_INDEX,
+ MYSQLI_REPORT_OFF
+ )
+ ));
+
+ printf("driver->report_mode = '%s'\n", $driver->report_mode);
+ $driver->report_mode = MYSQLI_REPORT_STRICT;
+ assert($driver->report_mode === MYSQLI_REPORT_STRICT);
+
+ assert(is_bool($driver->embedded));
+ printf("driver->embedded = '%s'\n", $driver->embedded);
+
+ printf("driver->reconnect = '%s'\n", $driver->reconnect);
+
+ printf("\nAccess to undefined properties:\n");
+ printf("driver->unknown = '%s'\n", @$driver->unknown);
+
+ print "done!";
?>
--EXPECTF--
Parent class:
diff --git a/ext/mysqli/tests/mysqli_class_mysqli_driver_reflection.phpt b/ext/mysqli/tests/mysqli_class_mysqli_driver_reflection.phpt
index 7b6c0a65d9..5d125dda84 100644
--- a/ext/mysqli/tests/mysqli_class_mysqli_driver_reflection.phpt
+++ b/ext/mysqli/tests/mysqli_class_mysqli_driver_reflection.phpt
@@ -16,10 +16,10 @@ if (!$IS_MYSQLND)
?>
--FILE--
<?php
- require_once('reflection_tools.inc');
- $class = new ReflectionClass('mysqli_driver');
- inspectClass($class);
- print "done!";
+ require_once('reflection_tools.inc');
+ $class = new ReflectionClass('mysqli_driver');
+ inspectClass($class);
+ print "done!";
?>
--EXPECTF--
Inspecting class 'mysqli_driver'
diff --git a/ext/mysqli/tests/mysqli_class_mysqli_interface.phpt b/ext/mysqli/tests/mysqli_class_mysqli_interface.phpt
index dfefb9098c..794f8eb241 100644
--- a/ext/mysqli/tests/mysqli_class_mysqli_interface.phpt
+++ b/ext/mysqli/tests/mysqli_class_mysqli_interface.phpt
@@ -8,257 +8,257 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require('connect.inc');
-
- $mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket);
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
-
- printf("Parent class:\n");
- var_dump(get_parent_class($mysqli));
-
- printf("\nMethods:\n");
- $methods = get_class_methods($mysqli);
- $expected_methods = array(
- '__construct' => true,
- 'autocommit' => true,
- 'begin_transaction' => true,
- 'change_user' => true,
- 'character_set_name' => true,
- 'close' => true,
- 'commit' => true,
- 'connect' => true,
- 'dump_debug_info' => true,
- 'escape_string' => true,
- 'get_charset' => true,
- 'get_client_info' => true,
- 'get_server_info' => true,
- 'get_warnings' => true,
- 'init' => true,
- 'kill' => true,
- 'more_results' => true,
- 'multi_query' => true,
- 'next_result' => true,
- 'options' => true,
- 'ping' => true,
- 'prepare' => true,
- 'query' => true,
- 'real_connect' => true,
- 'real_escape_string' => true,
- 'real_query' => true,
- 'refresh' => true,
- 'rollback' => true,
- 'release_savepoint' => true,
- 'savepoint' => true,
- 'select_db' => true,
- 'set_charset' => true,
- 'set_opt' => true,
- 'ssl_set' => true,
- 'stat' => true,
- 'stmt_init' => true,
- 'store_result' => true,
- 'thread_safe' => true,
- 'use_result' => true,
- );
-
- if ($IS_MYSQLND) {
- // mysqlnd only
- /* $expected_methods['get_client_stats'] = true; */
- $expected_methods['get_connection_stats'] = true;
- $expected_methods['reap_async_query'] = true;
- $expected_methods['poll'] = true;
- }
-
- /* we should add ruled when to expect them */
- if (function_exists('mysqli_debug'))
- $expected_methods['debug'] = true;
- if (function_exists('ssl_set'))
- $expected_methods['ssl_set'] = true;
-
- foreach ($methods as $k => $method) {
- if (isset($expected_methods[$method])) {
- unset($methods[$k]);
- unset($expected_methods[$method]);
- }
- }
- if (!empty($methods)) {
- printf("Dumping list of unexpected methods.\n");
- var_dump($methods);
- }
- if (!empty($expected_methods)) {
- printf("Dumping list of missing methods.\n");
- var_dump($expected_methods);
- }
- if (empty($methods) && empty($expected_methods))
- printf("ok\n");
-
- printf("\nClass variables:\n");
-
- $expected_class_variables = $expected_object_variables = array(
- "affected_rows" => true,
- "client_info" => true,
- "client_version" => true,
- "connect_errno" => true,
- "connect_error" => true,
- "errno" => true,
- "error" => true,
- "field_count" => true,
- "host_info" => true,
- "info" => true,
- "insert_id" => true,
- "protocol_version" => true,
- "server_info" => true,
- "server_version" => true,
- "sqlstate" => true,
- "thread_id" => true,
- "warning_count" => true,
- );
-
- $expected_class_variables["error_list"] = true;
- $expected_object_variables["error_list"] = true;
-
- $variables = get_class_vars(get_class($mysqli));
- foreach ($variables as $var => $v) {
- if (isset($expected_class_variables[$var])) {
- unset($expected_class_variables[$var]);
- unset($variables[$var]);
- }
- }
-
- if (!empty($expected_class_variables)) {
- printf("Dumping list of missing class variables\n");
- var_dump($expected_class_variables);
- }
- if (!empty($variables)) {
- printf("Dumping list of unexpected class variables\n");
- var_dump($variables);
- }
- echo "ok\n";
-
- printf("\nObject variables:\n");
- $variables = get_object_vars($mysqli);
- foreach ($variables as $var => $v) {
- if (isset($expected_object_variables[$var])) {
- unset($expected_object_variables[$var]);
- unset($variables[$var]);
- }
- }
-
- if (!empty($expected_object_variables)) {
- printf("Dumping list of missing object variables\n");
- var_dump($expected_object_variables);
- }
- if (!empty($variables)) {
- printf("Dumping list of unexpected object variables\n");
- var_dump($variables);
- }
- echo "ok\n";
-
-
- printf("\nMagic, magic properties:\n");
-
- assert(mysqli_affected_rows($link) === $mysqli->affected_rows);
- printf("mysqli->affected_rows = '%s'/%s ('%s'/%s)\n",
- $mysqli->affected_rows, gettype($mysqli->affected_rows),
- mysqli_affected_rows($link), gettype(mysqli_affected_rows($link)));
-
- assert(mysqli_get_client_info() === $mysqli->client_info);
- printf("mysqli->client_info = '%s'/%s ('%s'/%s)\n",
- $mysqli->client_info, gettype($mysqli->client_info),
- mysqli_get_client_info(), gettype(mysqli_get_client_info()));
-
- assert(mysqli_get_client_version() === $mysqli->client_version);
- printf("mysqli->client_version = '%s'/%s ('%s'/%s)\n",
- $mysqli->client_version, gettype($mysqli->client_version),
- mysqli_get_client_version(), gettype(mysqli_get_client_version()));
-
- assert(mysqli_errno($link) === $mysqli->errno);
- printf("mysqli->errno = '%s'/%s ('%s'/%s)\n",
- $mysqli->errno, gettype($mysqli->errno),
- mysqli_errno($link), gettype(mysqli_errno($link)));
-
- assert(mysqli_error($link) === $mysqli->error);
- printf("mysqli->error = '%s'/%s ('%s'/%s)\n",
- $mysqli->error, gettype($mysqli->error),
- mysqli_error($link), gettype(mysqli_error($link)));
-
- assert(mysqli_error_list($link) === $mysqli->error_list);
- assert(is_array($mysqli->error_list));
-
- assert(mysqli_field_count($link) === $mysqli->field_count);
- printf("mysqli->field_count = '%s'/%s ('%s'/%s)\n",
- $mysqli->field_count, gettype($mysqli->field_count),
- mysqli_field_count($link), gettype(mysqli_field_count($link)));
-
- assert(mysqli_insert_id($link) === $mysqli->insert_id);
- printf("mysqli->insert_id = '%s'/%s ('%s'/%s)\n",
- $mysqli->insert_id, gettype($mysqli->insert_id),
- mysqli_insert_id($link), gettype(mysqli_insert_id($link)));
-
- assert(mysqli_sqlstate($link) === $mysqli->sqlstate);
- printf("mysqli->sqlstate = '%s'/%s ('%s'/%s)\n",
- $mysqli->sqlstate, gettype($mysqli->sqlstate),
- mysqli_sqlstate($link), gettype(mysqli_sqlstate($link)));
-
- assert(mysqli_get_host_info($link) === $mysqli->host_info);
- printf("mysqli->host_info = '%s'/%s ('%s'/%s)\n",
- $mysqli->host_info, gettype($mysqli->host_info),
- mysqli_get_host_info($link), gettype(mysqli_get_host_info($link)));
-
- /* note that the data types are different */
- assert(mysqli_info($link) == $mysqli->info);
- printf("mysqli->info = '%s'/%s ('%s'/%s)\n",
- $mysqli->info, gettype($mysqli->info),
- mysqli_info($link), gettype(mysqli_info($link)));
-
- assert(mysqli_thread_id($link) > $mysqli->thread_id);
- assert(gettype($mysqli->thread_id) == gettype(mysqli_thread_id($link)));
- printf("mysqli->thread_id = '%s'/%s ('%s'/%s)\n",
- $mysqli->thread_id, gettype($mysqli->thread_id),
- mysqli_thread_id($link), gettype(mysqli_thread_id($link)));
-
- assert(mysqli_get_proto_info($link) === $mysqli->protocol_version);
- printf("mysqli->protocol_version = '%s'/%s ('%s'/%s)\n",
- $mysqli->protocol_version, gettype($mysqli->protocol_version),
- mysqli_get_proto_info($link), gettype(mysqli_get_proto_info($link)));
-
- assert(mysqli_get_server_info($link) === $mysqli->server_info);
- printf("mysqli->server_info = '%s'/%s ('%s'/%s)\n",
- $mysqli->server_info, gettype($mysqli->server_info),
- mysqli_get_server_info($link), gettype(mysqli_get_server_info($link)));
-
- assert(mysqli_get_server_version($link) === $mysqli->server_version);
- printf("mysqli->server_version = '%s'/%s ('%s'/%s)\n",
- $mysqli->server_version, gettype($mysqli->server_version),
- mysqli_get_server_version($link), gettype(mysqli_get_server_version($link)));
-
- assert(mysqli_warning_count($link) === $mysqli->warning_count);
- printf("mysqli->warning_count = '%s'/%s ('%s'/%s)\n",
- $mysqli->warning_count, gettype($mysqli->warning_count),
- mysqli_warning_count($link), gettype(mysqli_warning_count($link)));
-
- printf("\nAccess to undefined properties:\n");
- printf("mysqli->unknown = '%s'\n", @$mysqli->unknown);
-
- @$mysqli->unknown = 13;
- printf("setting mysqli->unknown, mysqli_unknown = '%s'\n", @$mysqli->unknown);
-
- $unknown = 'friday';
- @$mysqli->unknown = $unknown;
- printf("setting mysqli->unknown, mysqli_unknown = '%s'\n", @$mysqli->unknown);
-
- $mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
- printf("\nAccess hidden properties for MYSLQI_STATUS_INITIALIZED (TODO documentation):\n");
- assert(mysqli_connect_error() === $mysqli->connect_error);
- printf("mysqli->connect_error = '%s'/%s ('%s'/%s)\n",
- $mysqli->connect_error, gettype($mysqli->connect_error),
- mysqli_connect_error(), gettype(mysqli_connect_error()));
-
- assert(mysqli_connect_errno() === $mysqli->connect_errno);
- printf("mysqli->connect_errno = '%s'/%s ('%s'/%s)\n",
- $mysqli->connect_errno, gettype($mysqli->connect_errno),
- mysqli_connect_errno(), gettype(mysqli_connect_errno()));
-
- print "done!";
+ require('connect.inc');
+
+ $mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket);
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+
+ printf("Parent class:\n");
+ var_dump(get_parent_class($mysqli));
+
+ printf("\nMethods:\n");
+ $methods = get_class_methods($mysqli);
+ $expected_methods = array(
+ '__construct' => true,
+ 'autocommit' => true,
+ 'begin_transaction' => true,
+ 'change_user' => true,
+ 'character_set_name' => true,
+ 'close' => true,
+ 'commit' => true,
+ 'connect' => true,
+ 'dump_debug_info' => true,
+ 'escape_string' => true,
+ 'get_charset' => true,
+ 'get_client_info' => true,
+ 'get_server_info' => true,
+ 'get_warnings' => true,
+ 'init' => true,
+ 'kill' => true,
+ 'more_results' => true,
+ 'multi_query' => true,
+ 'next_result' => true,
+ 'options' => true,
+ 'ping' => true,
+ 'prepare' => true,
+ 'query' => true,
+ 'real_connect' => true,
+ 'real_escape_string' => true,
+ 'real_query' => true,
+ 'refresh' => true,
+ 'rollback' => true,
+ 'release_savepoint' => true,
+ 'savepoint' => true,
+ 'select_db' => true,
+ 'set_charset' => true,
+ 'set_opt' => true,
+ 'ssl_set' => true,
+ 'stat' => true,
+ 'stmt_init' => true,
+ 'store_result' => true,
+ 'thread_safe' => true,
+ 'use_result' => true,
+ );
+
+ if ($IS_MYSQLND) {
+ // mysqlnd only
+ /* $expected_methods['get_client_stats'] = true; */
+ $expected_methods['get_connection_stats'] = true;
+ $expected_methods['reap_async_query'] = true;
+ $expected_methods['poll'] = true;
+ }
+
+ /* we should add ruled when to expect them */
+ if (function_exists('mysqli_debug'))
+ $expected_methods['debug'] = true;
+ if (function_exists('ssl_set'))
+ $expected_methods['ssl_set'] = true;
+
+ foreach ($methods as $k => $method) {
+ if (isset($expected_methods[$method])) {
+ unset($methods[$k]);
+ unset($expected_methods[$method]);
+ }
+ }
+ if (!empty($methods)) {
+ printf("Dumping list of unexpected methods.\n");
+ var_dump($methods);
+ }
+ if (!empty($expected_methods)) {
+ printf("Dumping list of missing methods.\n");
+ var_dump($expected_methods);
+ }
+ if (empty($methods) && empty($expected_methods))
+ printf("ok\n");
+
+ printf("\nClass variables:\n");
+
+ $expected_class_variables = $expected_object_variables = array(
+ "affected_rows" => true,
+ "client_info" => true,
+ "client_version" => true,
+ "connect_errno" => true,
+ "connect_error" => true,
+ "errno" => true,
+ "error" => true,
+ "field_count" => true,
+ "host_info" => true,
+ "info" => true,
+ "insert_id" => true,
+ "protocol_version" => true,
+ "server_info" => true,
+ "server_version" => true,
+ "sqlstate" => true,
+ "thread_id" => true,
+ "warning_count" => true,
+ );
+
+ $expected_class_variables["error_list"] = true;
+ $expected_object_variables["error_list"] = true;
+
+ $variables = get_class_vars(get_class($mysqli));
+ foreach ($variables as $var => $v) {
+ if (isset($expected_class_variables[$var])) {
+ unset($expected_class_variables[$var]);
+ unset($variables[$var]);
+ }
+ }
+
+ if (!empty($expected_class_variables)) {
+ printf("Dumping list of missing class variables\n");
+ var_dump($expected_class_variables);
+ }
+ if (!empty($variables)) {
+ printf("Dumping list of unexpected class variables\n");
+ var_dump($variables);
+ }
+ echo "ok\n";
+
+ printf("\nObject variables:\n");
+ $variables = get_object_vars($mysqli);
+ foreach ($variables as $var => $v) {
+ if (isset($expected_object_variables[$var])) {
+ unset($expected_object_variables[$var]);
+ unset($variables[$var]);
+ }
+ }
+
+ if (!empty($expected_object_variables)) {
+ printf("Dumping list of missing object variables\n");
+ var_dump($expected_object_variables);
+ }
+ if (!empty($variables)) {
+ printf("Dumping list of unexpected object variables\n");
+ var_dump($variables);
+ }
+ echo "ok\n";
+
+
+ printf("\nMagic, magic properties:\n");
+
+ assert(mysqli_affected_rows($link) === $mysqli->affected_rows);
+ printf("mysqli->affected_rows = '%s'/%s ('%s'/%s)\n",
+ $mysqli->affected_rows, gettype($mysqli->affected_rows),
+ mysqli_affected_rows($link), gettype(mysqli_affected_rows($link)));
+
+ assert(mysqli_get_client_info() === $mysqli->client_info);
+ printf("mysqli->client_info = '%s'/%s ('%s'/%s)\n",
+ $mysqli->client_info, gettype($mysqli->client_info),
+ mysqli_get_client_info(), gettype(mysqli_get_client_info()));
+
+ assert(mysqli_get_client_version() === $mysqli->client_version);
+ printf("mysqli->client_version = '%s'/%s ('%s'/%s)\n",
+ $mysqli->client_version, gettype($mysqli->client_version),
+ mysqli_get_client_version(), gettype(mysqli_get_client_version()));
+
+ assert(mysqli_errno($link) === $mysqli->errno);
+ printf("mysqli->errno = '%s'/%s ('%s'/%s)\n",
+ $mysqli->errno, gettype($mysqli->errno),
+ mysqli_errno($link), gettype(mysqli_errno($link)));
+
+ assert(mysqli_error($link) === $mysqli->error);
+ printf("mysqli->error = '%s'/%s ('%s'/%s)\n",
+ $mysqli->error, gettype($mysqli->error),
+ mysqli_error($link), gettype(mysqli_error($link)));
+
+ assert(mysqli_error_list($link) === $mysqli->error_list);
+ assert(is_array($mysqli->error_list));
+
+ assert(mysqli_field_count($link) === $mysqli->field_count);
+ printf("mysqli->field_count = '%s'/%s ('%s'/%s)\n",
+ $mysqli->field_count, gettype($mysqli->field_count),
+ mysqli_field_count($link), gettype(mysqli_field_count($link)));
+
+ assert(mysqli_insert_id($link) === $mysqli->insert_id);
+ printf("mysqli->insert_id = '%s'/%s ('%s'/%s)\n",
+ $mysqli->insert_id, gettype($mysqli->insert_id),
+ mysqli_insert_id($link), gettype(mysqli_insert_id($link)));
+
+ assert(mysqli_sqlstate($link) === $mysqli->sqlstate);
+ printf("mysqli->sqlstate = '%s'/%s ('%s'/%s)\n",
+ $mysqli->sqlstate, gettype($mysqli->sqlstate),
+ mysqli_sqlstate($link), gettype(mysqli_sqlstate($link)));
+
+ assert(mysqli_get_host_info($link) === $mysqli->host_info);
+ printf("mysqli->host_info = '%s'/%s ('%s'/%s)\n",
+ $mysqli->host_info, gettype($mysqli->host_info),
+ mysqli_get_host_info($link), gettype(mysqli_get_host_info($link)));
+
+ /* note that the data types are different */
+ assert(mysqli_info($link) == $mysqli->info);
+ printf("mysqli->info = '%s'/%s ('%s'/%s)\n",
+ $mysqli->info, gettype($mysqli->info),
+ mysqli_info($link), gettype(mysqli_info($link)));
+
+ assert(mysqli_thread_id($link) > $mysqli->thread_id);
+ assert(gettype($mysqli->thread_id) == gettype(mysqli_thread_id($link)));
+ printf("mysqli->thread_id = '%s'/%s ('%s'/%s)\n",
+ $mysqli->thread_id, gettype($mysqli->thread_id),
+ mysqli_thread_id($link), gettype(mysqli_thread_id($link)));
+
+ assert(mysqli_get_proto_info($link) === $mysqli->protocol_version);
+ printf("mysqli->protocol_version = '%s'/%s ('%s'/%s)\n",
+ $mysqli->protocol_version, gettype($mysqli->protocol_version),
+ mysqli_get_proto_info($link), gettype(mysqli_get_proto_info($link)));
+
+ assert(mysqli_get_server_info($link) === $mysqli->server_info);
+ printf("mysqli->server_info = '%s'/%s ('%s'/%s)\n",
+ $mysqli->server_info, gettype($mysqli->server_info),
+ mysqli_get_server_info($link), gettype(mysqli_get_server_info($link)));
+
+ assert(mysqli_get_server_version($link) === $mysqli->server_version);
+ printf("mysqli->server_version = '%s'/%s ('%s'/%s)\n",
+ $mysqli->server_version, gettype($mysqli->server_version),
+ mysqli_get_server_version($link), gettype(mysqli_get_server_version($link)));
+
+ assert(mysqli_warning_count($link) === $mysqli->warning_count);
+ printf("mysqli->warning_count = '%s'/%s ('%s'/%s)\n",
+ $mysqli->warning_count, gettype($mysqli->warning_count),
+ mysqli_warning_count($link), gettype(mysqli_warning_count($link)));
+
+ printf("\nAccess to undefined properties:\n");
+ printf("mysqli->unknown = '%s'\n", @$mysqli->unknown);
+
+ @$mysqli->unknown = 13;
+ printf("setting mysqli->unknown, mysqli_unknown = '%s'\n", @$mysqli->unknown);
+
+ $unknown = 'friday';
+ @$mysqli->unknown = $unknown;
+ printf("setting mysqli->unknown, mysqli_unknown = '%s'\n", @$mysqli->unknown);
+
+ $mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ printf("\nAccess hidden properties for MYSLQI_STATUS_INITIALIZED (TODO documentation):\n");
+ assert(mysqli_connect_error() === $mysqli->connect_error);
+ printf("mysqli->connect_error = '%s'/%s ('%s'/%s)\n",
+ $mysqli->connect_error, gettype($mysqli->connect_error),
+ mysqli_connect_error(), gettype(mysqli_connect_error()));
+
+ assert(mysqli_connect_errno() === $mysqli->connect_errno);
+ printf("mysqli->connect_errno = '%s'/%s ('%s'/%s)\n",
+ $mysqli->connect_errno, gettype($mysqli->connect_errno),
+ mysqli_connect_errno(), gettype(mysqli_connect_errno()));
+
+ print "done!";
?>
--EXPECTF--
Parent class:
diff --git a/ext/mysqli/tests/mysqli_class_mysqli_properties_no_conn.phpt b/ext/mysqli/tests/mysqli_class_mysqli_properties_no_conn.phpt
index b7f227a7c2..fa7c7cd53d 100644
--- a/ext/mysqli/tests/mysqli_class_mysqli_properties_no_conn.phpt
+++ b/ext/mysqli/tests/mysqli_class_mysqli_properties_no_conn.phpt
@@ -8,135 +8,233 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require('table.inc');
-
- function dump_properties($mysqli) {
-
- printf("\nClass variables:\n");
- $variables = array_keys(get_class_vars(get_class($mysqli)));
- sort($variables);
- foreach ($variables as $k => $var) {
- printf("%s = '%s'\n", $var, var_export(@$mysqli->$var, true));
- }
-
- printf("\nObject variables:\n");
- $variables = array_keys(get_object_vars($mysqli));
- foreach ($variables as $k => $var) {
- printf("%s = '%s'\n", $var, var_export(@$mysqli->$var, true));
- }
-
- printf("\nMagic, magic properties:\n");
-
- assert(@mysqli_affected_rows($mysqli) === @$mysqli->affected_rows);
- printf("mysqli->affected_rows = '%s'/%s ('%s'/%s)\n",
- @$mysqli->affected_rows, gettype(@$mysqli->affected_rows),
- @mysqli_affected_rows($mysqli), gettype(@mysqli_affected_rows($mysqli)));
-
- assert(@mysqli_get_client_info() === @$mysqli->client_info);
- printf("mysqli->client_info = '%s'/%s ('%s'/%s)\n",
- @$mysqli->client_info, gettype(@$mysqli->client_info),
- @mysqli_get_client_info(), gettype(@mysqli_get_client_info()));
-
- assert(@mysqli_get_client_version() === @$mysqli->client_version);
- printf("mysqli->client_version = '%s'/%s ('%s'/%s)\n",
- @$mysqli->client_version, gettype(@$mysqli->client_version),
- @mysqli_get_client_version(), gettype(@mysqli_get_client_version()));
-
- assert(@mysqli_errno($mysqli) === @$mysqli->errno);
- printf("mysqli->errno = '%s'/%s ('%s'/%s)\n",
- @$mysqli->errno, gettype(@$mysqli->errno),
-
- @mysqli_errno($mysqli), gettype(@mysqli_errno($mysqli)));
-
- assert(@mysqli_error($mysqli) === @$mysqli->error);
- printf("mysqli->error = '%s'/%s ('%s'/%s)\n",
- @$mysqli->error, gettype(@$mysqli->error),
- @mysqli_error($mysqli), gettype(@mysqli_error($mysqli)));
-
- assert(@mysqli_field_count($mysqli) === @$mysqli->field_count);
- printf("mysqli->field_count = '%s'/%s ('%s'/%s)\n",
- @$mysqli->field_count, gettype(@$mysqli->field_count),
- @mysqli_field_count($mysqli), gettype(@mysqli_field_count($mysqli)));
-
- assert(@mysqli_insert_id($mysqli) === @$mysqli->insert_id);
- printf("mysqli->insert_id = '%s'/%s ('%s'/%s)\n",
- @$mysqli->insert_id, gettype(@$mysqli->insert_id),
- @mysqli_insert_id($mysqli), gettype(@mysqli_insert_id($mysqli)));
-
- assert(@mysqli_sqlstate($mysqli) === @$mysqli->sqlstate);
- printf("mysqli->sqlstate = '%s'/%s ('%s'/%s)\n",
- @$mysqli->sqlstate, gettype(@$mysqli->sqlstate),
- @mysqli_sqlstate($mysqli), gettype(@mysqli_sqlstate($mysqli)));
-
- assert(@mysqli_get_host_info($mysqli) === @$mysqli->host_info);
- printf("mysqli->host_info = '%s'/%s ('%s'/%s)\n",
- @$mysqli->host_info, gettype(@$mysqli->host_info),
- @mysqli_get_host_info($mysqli), gettype(@mysqli_get_host_info($mysqli)));
-
- /* note that the data types are different */
- assert(@mysqli_info($mysqli) == @$mysqli->info);
- printf("mysqli->info = '%s'/%s ('%s'/%s)\n",
- @$mysqli->info, gettype(@$mysqli->info),
- @mysqli_info($mysqli), gettype(@mysqli_info($mysqli)));
-
- assert(@mysqli_thread_id($mysqli) > @$mysqli->thread_id);
- assert(gettype(@$mysqli->thread_id) == gettype(@mysqli_thread_id($mysqli)));
- printf("mysqli->thread_id = '%s'/%s ('%s'/%s)\n",
- @$mysqli->thread_id, gettype(@$mysqli->thread_id),
- @mysqli_thread_id($mysqli), gettype(@mysqli_thread_id($mysqli)));
-
- assert(@mysqli_get_proto_info($mysqli) === @$mysqli->protocol_version);
- printf("mysqli->protocol_version = '%s'/%s ('%s'/%s)\n",
- @$mysqli->protocol_version, gettype(@$mysqli->protocol_version),
- @mysqli_get_proto_info($mysqli), gettype(@mysqli_get_proto_info($mysqli)));
-
- assert(@mysqli_get_server_info($mysqli) === @$mysqli->server_info);
- printf("mysqli->server_info = '%s'/%s ('%s'/%s)\n",
- @$mysqli->server_info, gettype(@$mysqli->server_info),
- @mysqli_get_server_info($mysqli), gettype(@mysqli_get_server_info($mysqli)));
-
- assert(@mysqli_get_server_version($mysqli) === @$mysqli->server_version);
- printf("mysqli->server_version = '%s'/%s ('%s'/%s)\n",
- @$mysqli->server_version, gettype(@$mysqli->server_version),
- @mysqli_get_server_version($mysqli), gettype(@mysqli_get_server_version($mysqli)));
-
- assert(@mysqli_warning_count($mysqli) === @$mysqli->warning_count);
- printf("mysqli->warning_count = '%s'/%s ('%s'/%s)\n",
- @$mysqli->warning_count, gettype(@$mysqli->warning_count),
- @mysqli_warning_count($mysqli), gettype(@mysqli_warning_count($mysqli)));
-
- printf("\nAccess to undefined properties:\n");
- printf("mysqli->unknown = '%s'\n", @$mysqli->unknown);
-
- @$mysqli->unknown = 13;
- printf("setting mysqli->unknown, @mysqli_unknown = '%s'\n", @$mysqli->unknown);
-
- $unknown = 'friday';
- @$mysqli->unknown = $unknown;
- printf("setting mysqli->unknown, @mysqli_unknown = '%s'\n", @$mysqli->unknown);
-
- printf("\nAccess hidden properties for MYSLQI_STATUS_INITIALIZED (TODO documentation):\n");
- assert(@mysqli_connect_error() === @$mysqli->connect_error);
- printf("mysqli->connect_error = '%s'/%s ('%s'/%s)\n",
- @$mysqli->connect_error, gettype(@$mysqli->connect_error),
- @mysqli_connect_error(), gettype(@mysqli_connect_error()));
-
- assert(@mysqli_connect_errno() === @$mysqli->connect_errno);
- printf("mysqli->connect_errno = '%s'/%s ('%s'/%s)\n",
- @$mysqli->connect_errno, gettype(@$mysqli->connect_errno),
- @mysqli_connect_errno(), gettype(@mysqli_connect_errno()));
- }
-
- printf("Without RS\n");
- $mysqli = @new mysqli($host, $user, $passwd . "invalid", $db, $port, $socket);
- dump_properties($mysqli);
-
- printf("With RS\n");
- $mysqli = @new mysqli($host, $user, $passwd . "invalid", $db, $port, $socket);
- $res = @$mysqli->query("SELECT * FROM test");
- dump_properties($mysqli);
-
- print "done!";
+ require('table.inc');
+
+ function dump_properties($mysqli) {
+
+ printf("\nClass variables:\n");
+ $variables = array_keys(get_class_vars(get_class($mysqli)));
+ sort($variables);
+ foreach ($variables as $k => $var) {
+ try {
+ printf("%s = '%s'\n", $var, var_export($mysqli->$var, true));
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+ }
+
+ printf("\nObject variables:\n");
+ $variables = array_keys(get_object_vars($mysqli));
+ foreach ($variables as $k => $var) {
+ try {
+ printf("%s = '%s'\n", $var, var_export($mysqli->$var, true));
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+ }
+
+ printf("\nMagic, magic properties:\n");
+ try {
+ mysqli_affected_rows($mysqli);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ try {
+ $mysqli->affected_rows;
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ try {
+ $mysqli->client_info;
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ printf("mysqli->client_version = '%s'/%s\n", $mysqli->client_version, gettype($mysqli->client_version));
+
+ try {
+ mysqli_errno($mysqli);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ try {
+ $mysqli->errno;
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ try {
+ mysqli_error($mysqli);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ try {
+ $mysqli->error;
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ try {
+ mysqli_field_count($mysqli);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ try {
+ $mysqli->field_count;
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ try {
+ mysqli_insert_id($mysqli);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ try {
+ $mysqli->insert_id;
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ try {
+ mysqli_sqlstate($mysqli);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ try {
+ $mysqli->sqlstate;
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ try {
+ mysqli_get_host_info($mysqli);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ try {
+ $mysqli->host_info;
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ try {
+ mysqli_info($mysqli);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ try {
+ $mysqli->info;
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ try {
+ mysqli_thread_id($mysqli);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ try {
+ $mysqli->thread_id;
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ try {
+ mysqli_get_proto_info($mysqli);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ try {
+ $mysqli->protocol_version;
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ try {
+ mysqli_get_server_info($mysqli);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ try {
+ $mysqli->server_info;
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ try {
+ mysqli_get_server_version($mysqli);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ try {
+ $mysqli->server_version;
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ try {
+ mysqli_warning_count($mysqli);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ try {
+ $mysqli->warning_count;
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+
+ printf("\nAccess to undefined properties:\n");
+ printf("mysqli->unknown = '%s'\n", @$mysqli->unknown);
+
+ @$mysqli->unknown = 13;
+ printf("setting mysqli->unknown, @mysqli_unknown = '%s'\n", @$mysqli->unknown);
+
+ $unknown = 'friday';
+ @$mysqli->unknown = $unknown;
+ printf("setting mysqli->unknown, @mysqli_unknown = '%s'\n", @$mysqli->unknown);
+
+ printf("\nAccess hidden properties for MYSLQI_STATUS_INITIALIZED (TODO documentation):\n");
+ assert(@mysqli_connect_error() === @$mysqli->connect_error);
+ printf("mysqli->connect_error = '%s'/%s ('%s'/%s)\n",
+ @$mysqli->connect_error, gettype(@$mysqli->connect_error),
+ @mysqli_connect_error(), gettype(@mysqli_connect_error()));
+
+ assert(@mysqli_connect_errno() === @$mysqli->connect_errno);
+ printf("mysqli->connect_errno = '%s'/%s ('%s'/%s)\n",
+ @$mysqli->connect_errno, gettype(@$mysqli->connect_errno),
+ @mysqli_connect_errno(), gettype(@mysqli_connect_errno()));
+ }
+
+ printf("Without RS\n");
+ $mysqli = @new mysqli($host, $user, $passwd . "invalid", $db, $port, $socket);
+ dump_properties($mysqli);
+
+ printf("\nWith RS\n");
+ $mysqli = @new mysqli($host, $user, $passwd . "invalid", $db, $port, $socket);
+ try {
+ $mysqli->query("SELECT * FROM test");
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+ dump_properties($mysqli);
+
+ print "done!";
?>
--CLEAN--
<?php require_once("clean_table.inc"); ?>
@@ -144,65 +242,74 @@ require_once('skipifconnectfailure.inc');
Without RS
Class variables:
-affected_rows = 'false'
-client_info = 'false'
+Property access is not allowed yet
+Property access is not allowed yet
client_version = '%s'
connect_errno = '%s'
connect_error = ''%s'
-errno = 'false'
-error = 'false'
-error_list = 'false'
-field_count = 'false'
-host_info = 'false'
-info = 'false'
-insert_id = 'false'
-protocol_version = 'false'
-server_info = 'false'
-server_version = 'false'
-sqlstate = 'false'
-thread_id = 'false'
-warning_count = 'false'
+mysqli object is already closed
+mysqli object is already closed
+Property access is not allowed yet
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
Object variables:
-affected_rows = 'false'
-client_info = 'false'
+Property access is not allowed yet
+Property access is not allowed yet
client_version = '%s'
connect_errno = '%s'
-connect_error = '%s'
-errno = 'false'
-error = 'false'
-error_list = 'false'
-field_count = 'false'
-host_info = 'false'
-info = 'false'
-insert_id = 'false'
-server_info = 'false'
-server_version = 'false'
-sqlstate = 'false'
-protocol_version = 'false'
-thread_id = 'false'
-warning_count = 'false'
+connect_error = ''%s'
+mysqli object is already closed
+mysqli object is already closed
+Property access is not allowed yet
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
Magic, magic properties:
-mysqli->affected_rows = ''/boolean (''/boolean)
-
-Warning: assert(): assert(@mysqli_get_client_info() === @$mysqli->client_info) failed in %s on line %d
-mysqli->client_info = ''/boolean ('%s'/%s)
-mysqli->client_version = '%s'/integer ('%s'/integer)
-mysqli->errno = ''/boolean (''/boolean)
-mysqli->error = ''/boolean (''/boolean)
-mysqli->field_count = ''/boolean (''/boolean)
-mysqli->insert_id = ''/boolean (''/boolean)
-mysqli->sqlstate = ''/boolean (''/boolean)
-mysqli->host_info = ''/boolean (''/boolean)
-mysqli->info = ''/boolean (''/boolean)
-
-Warning: assert(): assert(@mysqli_thread_id($mysqli) > @$mysqli->thread_id) failed in %s on line %d
-mysqli->thread_id = ''/boolean (''/boolean)
-mysqli->protocol_version = ''/boolean (''/boolean)
-mysqli->server_info = ''/boolean (''/boolean)
-mysqli->server_version = ''/boolean (''/boolean)
-mysqli->warning_count = ''/boolean (''/boolean)
+mysqli object is already closed
+Property access is not allowed yet
+Property access is not allowed yet
+mysqli->client_version = '80000'/integer
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
Access to undefined properties:
mysqli->unknown = ''
@@ -212,68 +319,79 @@ setting mysqli->unknown, @mysqli_unknown = 'friday'
Access hidden properties for MYSLQI_STATUS_INITIALIZED (TODO documentation):
mysqli->connect_error = '%s'/%s)
mysqli->connect_errno = '%s'/integer ('%s'/integer)
+
With RS
+mysqli object is already closed
Class variables:
-affected_rows = 'false'
-client_info = 'false'
+Property access is not allowed yet
+Property access is not allowed yet
client_version = '%s'
connect_errno = '%s'
connect_error = '%s'
-errno = 'false'
-error = 'false'
-error_list = 'false'
-field_count = 'false'
-host_info = 'false'
-info = 'false'
-insert_id = 'false'
-protocol_version = 'false'
-server_info = 'false'
-server_version = 'false'
-sqlstate = 'false'
-thread_id = 'false'
-warning_count = 'false'
+mysqli object is already closed
+mysqli object is already closed
+Property access is not allowed yet
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
Object variables:
-affected_rows = 'false'
-client_info = 'false'
+Property access is not allowed yet
+Property access is not allowed yet
client_version = '%s'
connect_errno = '%s'
connect_error = '%s'
-errno = 'false'
-error = 'false'
-error_list = 'false'
-field_count = 'false'
-host_info = 'false'
-info = 'false'
-insert_id = 'false'
-server_info = 'false'
-server_version = 'false'
-sqlstate = 'false'
-protocol_version = 'false'
-thread_id = 'false'
-warning_count = 'false'
+mysqli object is already closed
+mysqli object is already closed
+Property access is not allowed yet
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
Magic, magic properties:
-mysqli->affected_rows = ''/boolean (''/boolean)
-
-Warning: assert(): assert(@mysqli_get_client_info() === @$mysqli->client_info) failed in %s on line %d
-mysqli->client_info = ''/boolean ('%s'/%s)
-mysqli->client_version = '%s'/integer ('%s'/integer)
-mysqli->errno = ''/boolean (''/boolean)
-mysqli->error = ''/boolean (''/boolean)
-mysqli->field_count = ''/boolean (''/boolean)
-mysqli->insert_id = ''/boolean (''/boolean)
-mysqli->sqlstate = ''/boolean (''/boolean)
-mysqli->host_info = ''/boolean (''/boolean)
-mysqli->info = ''/boolean (''/boolean)
-
-Warning: assert(): assert(@mysqli_thread_id($mysqli) > @$mysqli->thread_id) failed in %s on line %d
-mysqli->thread_id = ''/boolean (''/boolean)
-mysqli->protocol_version = ''/boolean (''/boolean)
-mysqli->server_info = ''/boolean (''/boolean)
-mysqli->server_version = ''/boolean (''/boolean)
-mysqli->warning_count = ''/boolean (''/boolean)
+mysqli object is already closed
+Property access is not allowed yet
+Property access is not allowed yet
+mysqli->client_version = '80000'/integer
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
+mysqli object is already closed
Access to undefined properties:
mysqli->unknown = ''
diff --git a/ext/mysqli/tests/mysqli_class_mysqli_reflection.phpt b/ext/mysqli/tests/mysqli_class_mysqli_reflection.phpt
index 47beb1d79b..9b181d3838 100644
--- a/ext/mysqli/tests/mysqli_class_mysqli_reflection.phpt
+++ b/ext/mysqli/tests/mysqli_class_mysqli_reflection.phpt
@@ -17,10 +17,10 @@ if (!$IS_MYSQLND)
?>
--FILE--
<?php
- require_once('reflection_tools.inc');
- $class = new ReflectionClass('mysqli');
- inspectClass($class);
- print "done!\n";
+ require_once('reflection_tools.inc');
+ $class = new ReflectionClass('mysqli');
+ inspectClass($class);
+ print "done!\n";
?>
--EXPECT--
Inspecting class 'mysqli'
@@ -53,42 +53,42 @@ Number of Required Parameters: 0
Inspecting parameter 'host' of method '__construct'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'user' of method '__construct'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'password' of method '__construct'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'database' of method '__construct'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'port' of method '__construct'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'socket' of method '__construct'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
@@ -111,42 +111,42 @@ Number of Required Parameters: 0
Inspecting parameter 'host' of method '__construct'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'user' of method '__construct'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'password' of method '__construct'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'database' of method '__construct'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'port' of method '__construct'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'socket' of method '__construct'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
@@ -169,7 +169,7 @@ Number of Required Parameters: 1
Inspecting parameter 'mode' of method 'autocommit'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
@@ -192,14 +192,14 @@ Number of Required Parameters: 0
Inspecting parameter 'flags' of method 'begin_transaction'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'name' of method 'begin_transaction'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
@@ -222,21 +222,21 @@ Number of Required Parameters: 3
Inspecting parameter 'user' of method 'change_user'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
Inspecting parameter 'password' of method 'change_user'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
Inspecting parameter 'database' of method 'change_user'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
@@ -291,14 +291,14 @@ Number of Required Parameters: 0
Inspecting parameter 'flags' of method 'commit'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'name' of method 'commit'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
@@ -321,42 +321,42 @@ Number of Required Parameters: 0
Inspecting parameter 'host' of method 'connect'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'user' of method 'connect'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'password' of method 'connect'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'database' of method 'connect'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'port' of method 'connect'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'socket' of method 'connect'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
@@ -379,7 +379,7 @@ Number of Required Parameters: 1
Inspecting parameter 'debug_options' of method 'debug'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
@@ -418,7 +418,7 @@ Number of Required Parameters: 1
Inspecting parameter 'string_to_escape' of method 'escape_string'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
@@ -537,7 +537,7 @@ Number of Required Parameters: 1
Inspecting parameter 'connection_id' of method 'kill'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
@@ -576,7 +576,7 @@ Number of Required Parameters: 1
Inspecting parameter 'query' of method 'multi_query'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
@@ -615,14 +615,14 @@ Number of Required Parameters: 2
Inspecting parameter 'option' of method 'options'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
Inspecting parameter 'value' of method 'options'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
@@ -682,14 +682,14 @@ isDefaultValueAvailable: no
Inspecting parameter 'sec' of method 'poll'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
Inspecting parameter 'usec' of method 'poll'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
@@ -712,7 +712,7 @@ Number of Required Parameters: 1
Inspecting parameter 'query' of method 'prepare'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
@@ -735,14 +735,14 @@ Number of Required Parameters: 1
Inspecting parameter 'query' of method 'query'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
Inspecting parameter 'resultmode' of method 'query'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
@@ -765,49 +765,49 @@ Number of Required Parameters: 0
Inspecting parameter 'host' of method 'real_connect'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'user' of method 'real_connect'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'password' of method 'real_connect'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'database' of method 'real_connect'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'port' of method 'real_connect'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'socket' of method 'real_connect'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'flags' of method 'real_connect'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
@@ -830,7 +830,7 @@ Number of Required Parameters: 1
Inspecting parameter 'string_to_escape' of method 'real_escape_string'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
@@ -853,7 +853,7 @@ Number of Required Parameters: 1
Inspecting parameter 'query' of method 'real_query'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
@@ -892,7 +892,7 @@ Number of Required Parameters: 1
Inspecting parameter 'options' of method 'refresh'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
@@ -915,7 +915,7 @@ Number of Required Parameters: 1
Inspecting parameter 'name' of method 'release_savepoint'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
@@ -938,14 +938,14 @@ Number of Required Parameters: 0
Inspecting parameter 'flags' of method 'rollback'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
Inspecting parameter 'name' of method 'rollback'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
@@ -968,7 +968,7 @@ Number of Required Parameters: 1
Inspecting parameter 'name' of method 'savepoint'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
@@ -991,7 +991,7 @@ Number of Required Parameters: 1
Inspecting parameter 'database' of method 'select_db'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
@@ -1014,7 +1014,7 @@ Number of Required Parameters: 1
Inspecting parameter 'charset' of method 'set_charset'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
@@ -1037,14 +1037,14 @@ Number of Required Parameters: 2
Inspecting parameter 'option' of method 'set_opt'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
Inspecting parameter 'value' of method 'set_opt'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
@@ -1067,35 +1067,35 @@ Number of Required Parameters: 5
Inspecting parameter 'key' of method 'ssl_set'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
Inspecting parameter 'cert' of method 'ssl_set'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
Inspecting parameter 'certificate_authority' of method 'ssl_set'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
Inspecting parameter 'certificate_authority_path' of method 'ssl_set'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
Inspecting parameter 'cipher' of method 'ssl_set'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
@@ -1150,7 +1150,7 @@ Number of Required Parameters: 0
Inspecting parameter 'flags' of method 'store_result'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
diff --git a/ext/mysqli/tests/mysqli_class_mysqli_result_interface.phpt b/ext/mysqli/tests/mysqli_class_mysqli_result_interface.phpt
index 7367a5cd7c..3dc73a0819 100644
--- a/ext/mysqli/tests/mysqli_class_mysqli_result_interface.phpt
+++ b/ext/mysqli/tests/mysqli_class_mysqli_result_interface.phpt
@@ -8,151 +8,145 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require('connect.inc');
- require('table.inc');
-
- $mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
- $mysqli_result = $mysqli->query('SELECT * FROM test');
- $row = $mysqli_result->fetch_row();
-
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- $res = mysqli_query($link, 'SELECT * FROM test');
- assert(mysqli_fetch_row($res) === $row);
-
- printf("Parent class:\n");
- var_dump(get_parent_class($mysqli_result));
-
- printf("\nMethods:\n");
- $methods = get_class_methods($mysqli_result);
- $expected_methods = array(
- '__construct' => true,
- 'close' => true,
- 'data_seek' => true,
- 'fetch_array' => true,
- 'fetch_assoc' => true,
- 'fetch_field' => true,
- 'fetch_field_direct' => true,
- 'fetch_fields' => true,
- 'fetch_object' => true,
- 'fetch_row' => true,
- 'field_seek' => true,
- 'free' => true,
- 'free_result' => true,
- );
- if ($IS_MYSQLND)
- $expected_methods['fetch_all'] = true;
-
- foreach ($methods as $k => $method) {
- if (isset($expected_methods[$method])) {
- unset($expected_methods[$method]);
- unset($methods[$k]);
- }
- if ($method == 'mysqli_result') {
- // get_class_method reports different constructor names
- unset($expected_methods['__construct']);
- unset($methods[$k]);
- }
- }
-
- if (!empty($expected_methods)) {
- printf("Dumping list of missing methods.\n");
- var_dump($expected_methods);
- }
- if (!empty($methods)) {
- printf("Dumping list of unexpected methods.\n");
- var_dump($methods);
- }
- if (empty($expected_methods) && empty($methods))
- printf("ok\n");
-
-
- printf("\nClass variables:\n");
- $variables = array_keys(get_class_vars(get_class($mysqli_result)));
- sort($variables);
- foreach ($variables as $k => $var)
- printf("%s\n", $var);
-
- printf("\nObject variables:\n");
- $variables = array_keys(get_object_vars($mysqli_result));
- foreach ($variables as $k => $var)
- printf("%s\n", $var);
-
- printf("\nMagic, magic properties:\n");
-
- assert(($tmp = mysqli_field_tell($res)) === $mysqli_result->current_field);
- printf("mysqli_result->current_field = '%s'/%s ('%s'/%s)\n",
- $mysqli_result->current_field, gettype($mysqli_result->current_field),
- $tmp, gettype($tmp));
-
- assert(($tmp = mysqli_field_count($link)) === $mysqli_result->field_count);
- printf("mysqli_result->field_count = '%s'/%s ('%s'/%s)\n",
- $mysqli_result->field_count, gettype($mysqli_result->field_count),
- $tmp, gettype($tmp));
-
- assert(($tmp = mysqli_fetch_lengths($res)) === $mysqli_result->lengths);
- printf("mysqli_result->lengths -> '%s'/%s ('%s'/%s)\n",
- ((is_array($mysqli_result->lengths)) ? implode(' ', $mysqli_result->lengths) : 'n/a'),
- gettype($mysqli_result->lengths),
- ((is_array($tmp)) ? implode(' ', $tmp) : 'n/a'),
- gettype($tmp));
-
- assert(($tmp = mysqli_num_rows($res)) === $mysqli_result->num_rows);
- printf("mysqli_result->num_rows = '%s'/%s ('%s'/%s)\n",
- $mysqli_result->num_rows, gettype($mysqli_result->num_rows),
- $tmp, gettype($tmp));
-
- assert(in_array($mysqli_result->type, array(MYSQLI_STORE_RESULT, MYSQLI_USE_RESULT)));
- printf("mysqli_result->type = '%s'/%s\n",
- ((MYSQLI_STORE_RESULT == $mysqli_result->type) ? 'store' : 'use'),
- gettype($mysqli_result->type));
-
- printf("\nAccess to undefined properties:\n");
- printf("mysqli_result->unknown = '%s'\n", @$mysqli_result->unknown);
-
- printf("\nConstructor:\n");
- if (!is_object($res = new mysqli_result($link)))
- printf("[001] Expecting object/mysqli_result got %s/%s\n", gettye($res), $res);
-
- if (null !== ($tmp = @$res->num_rows))
- printf("[002] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_query($link, "SELECT id FROM test ORDER BY id"))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!is_object($res = new mysqli_result($link)))
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!is_object($res = new mysqli_result($link, MYSQLI_STORE_RESULT)))
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!is_object($res = new mysqli_result($link, MYSQLI_USE_RESULT)))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!is_object($res = new mysqli_result($link, 'invalid')))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- $valid = array(MYSQLI_STORE_RESULT, MYSQLI_USE_RESULT);
- do {
- $mode = mt_rand(-1000, 1000);
- } while (in_array($mode, $valid));
-
- if ($TEST_EXPERIMENTAL) {
- ob_start();
- if (!is_object($res = new mysqli_result($link, $mode)))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $content = ob_get_contents();
- ob_end_clean();
- if (!stristr($content, 'Invalid value for resultmode'))
- printf("[009] Expecting warning because of invalid resultmode\n");
- }
-
- if (!is_object($res = new mysqli_result('foo')))
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!is_object($res = @new mysqli_result($link, MYSQLI_STORE_RESULT, 1)))
- printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- print "done!";
+ require('connect.inc');
+ require('table.inc');
+
+ $mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ $mysqli_result = $mysqli->query('SELECT * FROM test');
+ $row = $mysqli_result->fetch_row();
+
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ $res = mysqli_query($link, 'SELECT * FROM test');
+ assert(mysqli_fetch_row($res) === $row);
+
+ printf("Parent class:\n");
+ var_dump(get_parent_class($mysqli_result));
+
+ printf("\nMethods:\n");
+ $methods = get_class_methods($mysqli_result);
+ $expected_methods = array(
+ '__construct' => true,
+ 'close' => true,
+ 'data_seek' => true,
+ 'fetch_array' => true,
+ 'fetch_assoc' => true,
+ 'fetch_field' => true,
+ 'fetch_field_direct' => true,
+ 'fetch_fields' => true,
+ 'fetch_object' => true,
+ 'fetch_row' => true,
+ 'field_seek' => true,
+ 'free' => true,
+ 'free_result' => true,
+ );
+ if ($IS_MYSQLND)
+ $expected_methods['fetch_all'] = true;
+
+ foreach ($methods as $k => $method) {
+ if (isset($expected_methods[$method])) {
+ unset($expected_methods[$method]);
+ unset($methods[$k]);
+ }
+ if ($method == 'mysqli_result') {
+ // get_class_method reports different constructor names
+ unset($expected_methods['__construct']);
+ unset($methods[$k]);
+ }
+ }
+
+ if (!empty($expected_methods)) {
+ printf("Dumping list of missing methods.\n");
+ var_dump($expected_methods);
+ }
+ if (!empty($methods)) {
+ printf("Dumping list of unexpected methods.\n");
+ var_dump($methods);
+ }
+ if (empty($expected_methods) && empty($methods))
+ printf("ok\n");
+
+
+ printf("\nClass variables:\n");
+ $variables = array_keys(get_class_vars(get_class($mysqli_result)));
+ sort($variables);
+ foreach ($variables as $k => $var)
+ printf("%s\n", $var);
+
+ printf("\nObject variables:\n");
+ $variables = array_keys(get_object_vars($mysqli_result));
+ foreach ($variables as $k => $var)
+ printf("%s\n", $var);
+
+ printf("\nMagic, magic properties:\n");
+
+ assert(($tmp = mysqli_field_tell($res)) === $mysqli_result->current_field);
+ printf("mysqli_result->current_field = '%s'/%s ('%s'/%s)\n",
+ $mysqli_result->current_field, gettype($mysqli_result->current_field),
+ $tmp, gettype($tmp));
+
+ assert(($tmp = mysqli_field_count($link)) === $mysqli_result->field_count);
+ printf("mysqli_result->field_count = '%s'/%s ('%s'/%s)\n",
+ $mysqli_result->field_count, gettype($mysqli_result->field_count),
+ $tmp, gettype($tmp));
+
+ assert(($tmp = mysqli_fetch_lengths($res)) === $mysqli_result->lengths);
+ printf("mysqli_result->lengths -> '%s'/%s ('%s'/%s)\n",
+ ((is_array($mysqli_result->lengths)) ? implode(' ', $mysqli_result->lengths) : 'n/a'),
+ gettype($mysqli_result->lengths),
+ ((is_array($tmp)) ? implode(' ', $tmp) : 'n/a'),
+ gettype($tmp));
+
+ assert(($tmp = mysqli_num_rows($res)) === $mysqli_result->num_rows);
+ printf("mysqli_result->num_rows = '%s'/%s ('%s'/%s)\n",
+ $mysqli_result->num_rows, gettype($mysqli_result->num_rows),
+ $tmp, gettype($tmp));
+
+ assert(in_array($mysqli_result->type, array(MYSQLI_STORE_RESULT, MYSQLI_USE_RESULT)));
+ printf("mysqli_result->type = '%s'/%s\n",
+ ((MYSQLI_STORE_RESULT == $mysqli_result->type) ? 'store' : 'use'),
+ gettype($mysqli_result->type));
+
+ printf("\nAccess to undefined properties:\n");
+ printf("mysqli_result->unknown = '%s'\n", @$mysqli_result->unknown);
+
+ printf("\nConstructor:\n");
+ if (!is_object($res = new mysqli_result($link)))
+ printf("[001] Expecting object/mysqli_result got %s/%s\n", gettye($res), $res);
+
+ try {
+ $res->num_rows;
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ if (!mysqli_query($link, "SELECT id FROM test ORDER BY id"))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!is_object($res = new mysqli_result($link)))
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!is_object($res = new mysqli_result($link, MYSQLI_STORE_RESULT)))
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!is_object($res = new mysqli_result($link, MYSQLI_USE_RESULT)))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ $valid = array(MYSQLI_STORE_RESULT, MYSQLI_USE_RESULT);
+ do {
+ $mode = mt_rand(-1000, 1000);
+ } while (in_array($mode, $valid));
+
+ if ($TEST_EXPERIMENTAL) {
+ ob_start();
+ if (!is_object($res = new mysqli_result($link, $mode)))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $content = ob_get_contents();
+ ob_end_clean();
+ if (!stristr($content, 'Invalid value for resultmode'))
+ printf("[009] Expecting warning because of invalid resultmode\n");
+ }
+
+ print "done!";
?>
--EXPECTF--
Parent class:
@@ -186,8 +180,5 @@ Access to undefined properties:
mysqli_result->unknown = ''
Constructor:
-
-Warning: mysqli_result::__construct() expects parameter 2 to be int, string given in %s on line %d
-
-Warning: mysqli_result::__construct() expects parameter 1 to be mysqli, string given in %s on line %d
+mysqli_result object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_class_mysqli_result_reflection.phpt b/ext/mysqli/tests/mysqli_class_mysqli_result_reflection.phpt
index b3b7759ace..83b4fbbd95 100644
--- a/ext/mysqli/tests/mysqli_class_mysqli_result_reflection.phpt
+++ b/ext/mysqli/tests/mysqli_class_mysqli_result_reflection.phpt
@@ -17,10 +17,10 @@ if (!$IS_MYSQLND)
?>
--FILE--
<?php
- require_once('reflection_tools.inc');
- $class = new ReflectionClass('mysqli_result');
- inspectClass($class);
- print "done!";
+ require_once('reflection_tools.inc');
+ $class = new ReflectionClass('mysqli_result');
+ inspectClass($class);
+ print "done!";
?>
--EXPECT--
Inspecting class 'mysqli_result'
@@ -101,7 +101,7 @@ Number of Required Parameters: 1
Inspecting parameter 'offset' of method 'data_seek'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
@@ -124,7 +124,7 @@ Number of Required Parameters: 0
Inspecting parameter 'result_type' of method 'fetch_all'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
@@ -147,7 +147,7 @@ Number of Required Parameters: 0
Inspecting parameter 'result_type' of method 'fetch_array'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
@@ -202,7 +202,7 @@ Number of Required Parameters: 1
Inspecting parameter 'field_nr' of method 'fetch_field_direct'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
@@ -241,7 +241,7 @@ Number of Required Parameters: 0
Inspecting parameter 'class_name' of method 'fetch_object'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: yes
isDefaultValueAvailable: no
@@ -287,7 +287,7 @@ Number of Required Parameters: 1
Inspecting parameter 'field_nr' of method 'field_seek'
isArray: no
-allowsNull: no
+allowsNull: yes
isPassedByReference: no
isOptional: no
isDefaultValueAvailable: no
diff --git a/ext/mysqli/tests/mysqli_class_mysqli_stmt_interface.phpt b/ext/mysqli/tests/mysqli_class_mysqli_stmt_interface.phpt
index 8fc4583a4c..8c79d35297 100644
--- a/ext/mysqli/tests/mysqli_class_mysqli_stmt_interface.phpt
+++ b/ext/mysqli/tests/mysqli_class_mysqli_stmt_interface.phpt
@@ -8,85 +8,94 @@ Interface of the class mysqli_stmt
?>
--FILE--
<?php
- require('connect.inc');
- require('table.inc');
-
- $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- $stmt = new mysqli_stmt($link);
-
- printf("Parent class:\n");
- var_dump(get_parent_class($stmt));
-
- printf("\nMethods:\n");
-
- $methods = get_class_methods($stmt);
- $expected_methods = array(
- '__construct' => true,
- 'attr_get' => true,
- 'attr_set' => true,
- 'bind_param' => true,
- 'bind_result' => true,
- 'close' => true,
- 'data_seek' => true,
- 'execute' => true,
- 'fetch' => true,
- 'free_result' => true,
- 'get_warnings' => true,
- 'num_rows' => true,
- 'prepare' => true,
- 'reset' => true,
- 'result_metadata' => true,
- 'send_long_data' => true,
- 'store_result' => true,
- );
-
- if ($IS_MYSQLND) {
- $expected_methods['get_result'] = true;
- $expected_methods['more_results'] = true;
- $expected_methods['next_result'] = true;
- }
-
- foreach ($methods as $k => $method) {
- if (isset($expected_methods[$method])) {
- unset($methods[$k]);
- unset($expected_methods[$method]);
- }
- if ($method == 'mysqli_stmt') {
- // get_class_method reports different constructor names
- unset($expected_methods['__construct']);
- unset($methods[$k]);
- }
- }
- if (!empty($methods)) {
- printf("More methods found than indicated. Dumping list of unexpected methods.\n");
- var_dump($methods);
- }
- if (!empty($expected_methods)) {
- printf("Some methods are missing. Dumping list of missing methods.\n");
- var_dump($expected_methods);
- }
- if (empty($methods) && empty($expected_methods))
- printf("ok\n");
-
- printf("\nClass variables:\n");
- $variables = array_keys(get_class_vars(get_class($stmt)));
- sort($variables);
- foreach ($variables as $k => $var)
- printf("%s\n", $var);
-
- printf("\nObject variables:\n");
- $variables = array_keys(get_object_vars($stmt));
- foreach ($variables as $k => $var)
- printf("%s\n", $var);
+ require('connect.inc');
+ require('table.inc');
+
+ $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ $stmt = new mysqli_stmt($link);
+
+ printf("Parent class:\n");
+ var_dump(get_parent_class($stmt));
+
+ printf("\nMethods:\n");
+
+ $methods = get_class_methods($stmt);
+ $expected_methods = array(
+ '__construct' => true,
+ 'attr_get' => true,
+ 'attr_set' => true,
+ 'bind_param' => true,
+ 'bind_result' => true,
+ 'close' => true,
+ 'data_seek' => true,
+ 'execute' => true,
+ 'fetch' => true,
+ 'free_result' => true,
+ 'get_warnings' => true,
+ 'num_rows' => true,
+ 'prepare' => true,
+ 'reset' => true,
+ 'result_metadata' => true,
+ 'send_long_data' => true,
+ 'store_result' => true,
+ );
+
+ if ($IS_MYSQLND) {
+ $expected_methods['get_result'] = true;
+ $expected_methods['more_results'] = true;
+ $expected_methods['next_result'] = true;
+ }
+
+ foreach ($methods as $k => $method) {
+ if (isset($expected_methods[$method])) {
+ unset($methods[$k]);
+ unset($expected_methods[$method]);
+ }
+ if ($method == 'mysqli_stmt') {
+ // get_class_method reports different constructor names
+ unset($expected_methods['__construct']);
+ unset($methods[$k]);
+ }
+ }
+ if (!empty($methods)) {
+ printf("More methods found than indicated. Dumping list of unexpected methods.\n");
+ var_dump($methods);
+ }
+ if (!empty($expected_methods)) {
+ printf("Some methods are missing. Dumping list of missing methods.\n");
+ var_dump($expected_methods);
+ }
+ if (empty($methods) && empty($expected_methods))
+ printf("ok\n");
+
+ printf("\nClass variables:\n");
+ $variables = array_keys(get_class_vars(get_class($stmt)));
+ sort($variables);
+ foreach ($variables as $k => $var)
+ printf("%s\n", $var);
+
+ printf("\nObject variables:\n");
+ $variables = array_keys(get_object_vars($stmt));
+ foreach ($variables as $k => $var)
+ printf("%s\n", $var);
printf("\nMagic, magic properties:\n");
-assert(mysqli_stmt_affected_rows($stmt) === $stmt->affected_rows);
-printf("stmt->affected_rows = '%s'\n", $stmt->affected_rows);
+try {
+ mysqli_stmt_affected_rows($stmt);
+} catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+}
-if (!$stmt->prepare("INSERT INTO test(id, label) VALUES (100, 'z')") ||
-!$stmt->execute())
-printf("[001] [%d] %s\n", $stmt->errno, $stmt->error);
+try {
+ $stmt->affected_rows;
+} catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+if (!$stmt->prepare("INSERT INTO test(id, label) VALUES (100, 'z')") || !$stmt->execute()) {
+ printf("[001] [%d] %s\n", $stmt->errno, $stmt->error);
+}
assert(mysqli_stmt_affected_rows($stmt) === $stmt->affected_rows);
printf("stmt->affected_rows = '%s'\n", $stmt->affected_rows);
@@ -123,16 +132,6 @@ printf("stmt->unknown = '%s'\n", @$stmt->unknown);
@$stmt->unknown = 13;
printf("stmt->unknown = '%s'\n", @$stmt->unknown);
-printf("\nPrepare using the constructor:\n");
-$stmt = new mysqli_stmt($link, 'SELECT id FROM test ORDER BY id');
-if (!$stmt->execute())
-printf("[002] [%d] %s\n", $stmt->errno, $stmt->error);
-$stmt->close();
-
-$obj = new stdClass();
-if (!is_object($stmt = new mysqli_stmt($link, $obj)))
-printf("[003] Expecting NULL got %s/%s\n", gettype($stmt), $stmt);
-
print "done!";
?>
--EXPECTF--
@@ -167,14 +166,8 @@ sqlstate
id
Magic, magic properties:
-
-Warning: mysqli_stmt_affected_rows(): invalid object or resource mysqli_stmt
- in %s on line %d
-
-Warning: main(): Property access is not allowed yet in %s on line %d
-
-Warning: main(): Property access is not allowed yet in %s on line %d
-stmt->affected_rows = ''
+mysqli_stmt object is not fully initialized
+Property access is not allowed yet
stmt->affected_rows = '1'
stmt->errno = '0'
stmt->error = ''
@@ -191,8 +184,4 @@ stmt->sqlstate = '00000'
Access to undefined properties:
stmt->unknown = ''
stmt->unknown = '13'
-
-Prepare using the constructor:
-
-Warning: mysqli_stmt::__construct() expects parameter 2 to be string, object given in %s on line %d
done!
diff --git a/ext/mysqli/tests/mysqli_class_mysqli_warning.phpt b/ext/mysqli/tests/mysqli_class_mysqli_warning.phpt
index 4d3c883e45..127777fc6a 100644
--- a/ext/mysqli/tests/mysqli_class_mysqli_warning.phpt
+++ b/ext/mysqli/tests/mysqli_class_mysqli_warning.phpt
@@ -12,82 +12,82 @@ if (!$TEST_EXPERIMENTAL)
?>
--FILE--
<?php
- require('connect.inc');
-
- $warning = new mysqli_warning();
- $warning = new mysqli_warning(null);
- $warning = new mysqli_warning(null, null);
-
- $mysqli = new mysqli();
- $warning = new mysqli_warning($mysqli);
-
- $mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
- $stmt = new mysqli_stmt($mysqli);
- $warning = new mysqli_warning($stmt);
-
- $stmt = $mysqli->stmt_init();
- $warning = new mysqli_warning($stmt);
-
- $obj = new stdClass();
- $warning = new mysqli_warning($obj);
-
- include("table.inc");
- $mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
- $res = $mysqli->query('INSERT INTO test(id, label) VALUES (1, "zz")');
- $warning = mysqli_get_warnings($mysqli);
-
- printf("Parent class:\n");
- var_dump(get_parent_class($warning));
-
- printf("\nMethods:\n");
- $methods = get_class_methods($warning);
- $expected_methods = array(
- 'next' => true,
- );
-
- foreach ($methods as $k => $method) {
- if (isset($expected_methods[$method])) {
- unset($methods[$k]);
- unset($expected_methods[$method]);
- }
- }
- if (!empty($methods)) {
- printf("Dumping list of unexpected methods.\n");
- var_dump($methods);
- }
- if (!empty($expected_methods)) {
- printf("Dumping list of missing methods.\n");
- var_dump($expected_methods);
- }
- if (empty($methods) && empty($expected_methods))
- printf("ok\n");
-
- printf("\nClass variables:\n");
- $variables = get_class_vars(get_class($mysqli));
- sort($variables);
- foreach ($variables as $k => $var)
- printf("%s\n", $var);
-
- printf("\nObject variables:\n");
- $variables = get_object_vars($mysqli);
- foreach ($variables as $k => $var)
- printf("%s\n", $var);
-
- printf("\nMagic, magic properties:\n");
-
- assert('' === $warning->message);
- printf("warning->message = '%s'\n", $warning->message);
-
- assert('' === $warning->sqlstate);
- printf("warning->sqlstate= '%s'\n", $warning->sqlstate);
-
- assert(0 === $warning->errno);
- printf("warning->errno = '%s'\n", $warning->errno);
-
- printf("\nAccess to undefined properties:\n");
- printf("warning->unknown = '%s'\n", @$warning->unknown);
-
- print "done!";
+ require('connect.inc');
+
+ $warning = new mysqli_warning();
+ $warning = new mysqli_warning(null);
+ $warning = new mysqli_warning(null, null);
+
+ $mysqli = new mysqli();
+ $warning = new mysqli_warning($mysqli);
+
+ $mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ $stmt = new mysqli_stmt($mysqli);
+ $warning = new mysqli_warning($stmt);
+
+ $stmt = $mysqli->stmt_init();
+ $warning = new mysqli_warning($stmt);
+
+ $obj = new stdClass();
+ $warning = new mysqli_warning($obj);
+
+ include("table.inc");
+ $mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
+ $res = $mysqli->query('INSERT INTO test(id, label) VALUES (1, "zz")');
+ $warning = mysqli_get_warnings($mysqli);
+
+ printf("Parent class:\n");
+ var_dump(get_parent_class($warning));
+
+ printf("\nMethods:\n");
+ $methods = get_class_methods($warning);
+ $expected_methods = array(
+ 'next' => true,
+ );
+
+ foreach ($methods as $k => $method) {
+ if (isset($expected_methods[$method])) {
+ unset($methods[$k]);
+ unset($expected_methods[$method]);
+ }
+ }
+ if (!empty($methods)) {
+ printf("Dumping list of unexpected methods.\n");
+ var_dump($methods);
+ }
+ if (!empty($expected_methods)) {
+ printf("Dumping list of missing methods.\n");
+ var_dump($expected_methods);
+ }
+ if (empty($methods) && empty($expected_methods))
+ printf("ok\n");
+
+ printf("\nClass variables:\n");
+ $variables = get_class_vars(get_class($mysqli));
+ sort($variables);
+ foreach ($variables as $k => $var)
+ printf("%s\n", $var);
+
+ printf("\nObject variables:\n");
+ $variables = get_object_vars($mysqli);
+ foreach ($variables as $k => $var)
+ printf("%s\n", $var);
+
+ printf("\nMagic, magic properties:\n");
+
+ assert('' === $warning->message);
+ printf("warning->message = '%s'\n", $warning->message);
+
+ assert('' === $warning->sqlstate);
+ printf("warning->sqlstate= '%s'\n", $warning->sqlstate);
+
+ assert(0 === $warning->errno);
+ printf("warning->errno = '%s'\n", $warning->errno);
+
+ printf("\nAccess to undefined properties:\n");
+ printf("warning->unknown = '%s'\n", @$warning->unknown);
+
+ print "done!";
?>
--CLEAN--
<?php
@@ -100,15 +100,11 @@ Warning: mysqli_warning::mysqli_warning() expects parameter 1 to be object, null
Warning: Wrong parameter count for mysqli_warning::mysqli_warning() in %s on line %d
-Warning: mysqli_warning::mysqli_warning(): Couldn't fetch mysqli in %s on line %d
+Warning: mysqli_warning::mysqli_warning(): mysqli object is already closed in %s on line %d
+mysqli_stmt object is not fully initialized
+mysqli_stmt object is not fully initialized
-Warning: mysqli_warning::mysqli_warning(): invalid object or resource mysqli_stmt
- in %s on line %d
-
-Warning: mysqli_warning::mysqli_warning(): invalid object or resource mysqli_stmt
- in %s on line %d
-
-Warning: mysqli_warning::mysqli_warning(): invalid class argument in /home/nixnutz/php6_mysqlnd/ext/mysqli/tests/mysqli_class_mysqli_warning.php on line 19
+Warning: mysqli_warning::mysqli_warning(): Invalid class argument in /home/nixnutz/php6_mysqlnd/ext/mysqli/tests/mysqli_class_mysqli_warning.php on line 19
Warning: mysqli_warning::mysqli_warning(): No warnings found in %s on line %d
Parent class:
diff --git a/ext/mysqli/tests/mysqli_class_mysqli_warning_reflection.phpt b/ext/mysqli/tests/mysqli_class_mysqli_warning_reflection.phpt
index f57945e589..e8aef44b10 100644
--- a/ext/mysqli/tests/mysqli_class_mysqli_warning_reflection.phpt
+++ b/ext/mysqli/tests/mysqli_class_mysqli_warning_reflection.phpt
@@ -16,10 +16,10 @@ if (!$IS_MYSQLND)
?>
--FILE--
<?php
- require_once('reflection_tools.inc');
- $class = new ReflectionClass('mysqli_warning');
- inspectClass($class);
- print "done!\n";
+ require_once('reflection_tools.inc');
+ $class = new ReflectionClass('mysqli_warning');
+ inspectClass($class);
+ print "done!\n";
?>
--EXPECTF--
Inspecting class 'mysqli_warning'
diff --git a/ext/mysqli/tests/mysqli_close.phpt b/ext/mysqli/tests/mysqli_close.phpt
index a300fb8314..a0d7fa2eab 100644
--- a/ext/mysqli/tests/mysqli_close.phpt
+++ b/ext/mysqli/tests/mysqli_close.phpt
@@ -8,33 +8,23 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (!is_null($tmp = @mysqli_close()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ $tmp = mysqli_close($link);
+ if (true !== $tmp)
+ printf("[005] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_close($link, $link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ try {
+ mysqli_query($link, "SELECT 1");
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
-
- $tmp = @mysqli_close(NULL);
- if (NULL !== $tmp)
- printf("[004] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- $tmp = mysqli_close($link);
- if (true !== $tmp)
- printf("[005] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- if (false !== ($tmp = @mysqli_query($link, "SELECT 1")))
- printf("[006] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!";
-?>
+ print "done!";
--EXPECT--
+mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_close_oo.phpt b/ext/mysqli/tests/mysqli_close_oo.phpt
index 305d5edf88..351df66d94 100644
--- a/ext/mysqli/tests/mysqli_close_oo.phpt
+++ b/ext/mysqli/tests/mysqli_close_oo.phpt
@@ -8,29 +8,34 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (!is_null($tmp = @$mysqli->close($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ $tmp = $mysqli->close();
+ if (true !== $tmp)
+ printf("[003] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- $tmp = $mysqli->close();
- if (true !== $tmp)
- printf("[003] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ try {
+ $mysqli->close();
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- if (false !== ($tmp = @$mysqli->close()))
- printf("[004] Expecting false got %s/%s\n", gettype($tmp), $tmp);
+ try {
+ $mysqli->query("SELECT 1");
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- if (false !== ($tmp = @$mysqli->query("SELECT 1")))
- printf("[005] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!";
+ print "done!";
?>
--EXPECT--
+my_mysqli object is already closed
+my_mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_commit.phpt b/ext/mysqli/tests/mysqli_commit.phpt
index 2fd3745d85..33bb2011cd 100644
--- a/ext/mysqli/tests/mysqli_commit.phpt
+++ b/ext/mysqli/tests/mysqli_commit.phpt
@@ -15,63 +15,55 @@ if (!have_innodb($link))
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[004] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (!is_null($tmp = @mysqli_commit()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_autocommit($link, false)))
+ printf("[005] Cannot turn off autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_commit($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_null($tmp = @mysqli_commit($link, $link)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB'))
+ printf("[007] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[004] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)'))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (true !== ($tmp = mysqli_autocommit($link, false)))
- printf("[005] Cannot turn off autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp);
+ $tmp = mysqli_commit($link);
+ if ($tmp !== true)
+ printf("[009] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'ROLLBACK'))
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB'))
- printf("[007] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS num FROM test'))
+ printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ if (1 != $tmp['num'])
+ printf("[12] Expecting 1 row in table test, found %d rows\n", $tmp['num']);
+ mysqli_free_result($res);
- if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)'))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
+ printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_commit($link);
- if ($tmp !== true)
- printf("[009] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ mysqli_close($link);
- if (!mysqli_query($link, 'ROLLBACK'))
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ try {
+ mysqli_commit($link);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS num FROM test'))
- printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- if (1 != $tmp['num'])
- printf("[12] Expecting 1 row in table test, found %d rows\n", $tmp['num']);
- mysqli_free_result($res);
-
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
- printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- mysqli_close($link);
-
- if (false !== ($tmp = @mysqli_commit($link)))
- printf("[014] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
--EXPECT--
+mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_commit_oo.phpt b/ext/mysqli/tests/mysqli_commit_oo.phpt
index 46069fd425..9ae81f9700 100644
--- a/ext/mysqli/tests/mysqli_commit_oo.phpt
+++ b/ext/mysqli/tests/mysqli_commit_oo.phpt
@@ -15,95 +15,101 @@ if (!have_innodb($link))
?>
--FILE--
<?php
- require_once("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
-
- $mysqli = new mysqli();
- if (false !== ($tmp = @$mysqli->commit())) {
- printf("[013] Expecting false got %s/%s\n", gettype($tmp), $tmp);
- }
-
- if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) {
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
-
- if (true !== ($tmp = $mysqli->commit())) {
- printf("[002] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
- }
-
- if (true !== ($tmp = $mysqli->autocommit(false))) {
- printf("[003] Cannot turn off autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp);
- }
-
- if (!$mysqli->query('DROP TABLE IF EXISTS test')) {
- printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
-
- if (!$mysqli->query('CREATE TABLE test(id INT) ENGINE = InnoDB')) {
- printf("[005] Cannot create test table, [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
-
- if (!$mysqli->query('INSERT INTO test(id) VALUES (1)')) {
- printf("[006] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
-
- $tmp = $mysqli->commit();
- if ($tmp !== true) {
- printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- }
-
- if (!$mysqli->query('ROLLBACK'))
- printf("[008] [%d] %s\n", $mysqli->errno, $mysqli->error);
-
- if (!$res = $mysqli->query('SELECT COUNT(*) AS num FROM test')) {
- printf("[009] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
-
- $tmp = $res->fetch_assoc();
- if (1 != $tmp['num']) {
- printf("[010] Expecting 1 row in table test, found %d rows\n", $tmp['num']);
- }
- $res->free();
-
- if (!$mysqli->query('DROP TABLE IF EXISTS test')) {
- printf("[011] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
-
- if (!$mysqli->commit(0 , "tx_name0123")) {
- printf("[012] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
- if (!$mysqli->commit(0 , "*/ nonsense")) {
- printf("[013] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
- if (!$mysqli->commit(0 , "tx_name ulf вендел")) {
- printf("[014] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
- if (!$mysqli->commit(0 , "tx_name \t\n\r\b")) {
- printf("[015] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
- if (!$mysqli->commit(MYSQLI_TRANS_COR_AND_CHAIN | MYSQLI_TRANS_COR_NO_RELEASE , "tx_name")) {
- printf("[016] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
-
- $mysqli->close();
-
- if (false !== ($tmp = @$mysqli->commit())) {
- printf("[017] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- }
-
- print "done!";
-?>
+ require_once("connect.inc");
+
+ $tmp = NULL;
+ $link = NULL;
+
+ $mysqli = new mysqli();
+ try {
+ $mysqli->commit();
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
+
+ if (true !== ($tmp = $mysqli->commit())) {
+ printf("[002] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
+ }
+
+ if (true !== ($tmp = $mysqli->autocommit(false))) {
+ printf("[003] Cannot turn off autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp);
+ }
+
+ if (!$mysqli->query('DROP TABLE IF EXISTS test')) {
+ printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
+
+ if (!$mysqli->query('CREATE TABLE test(id INT) ENGINE = InnoDB')) {
+ printf("[005] Cannot create test table, [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
+
+ if (!$mysqli->query('INSERT INTO test(id) VALUES (1)')) {
+ printf("[006] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
+
+ $tmp = $mysqli->commit();
+ if ($tmp !== true) {
+ printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ }
+
+ if (!$mysqli->query('ROLLBACK'))
+ printf("[008] [%d] %s\n", $mysqli->errno, $mysqli->error);
+
+ if (!$res = $mysqli->query('SELECT COUNT(*) AS num FROM test')) {
+ printf("[009] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
+
+ $tmp = $res->fetch_assoc();
+ if (1 != $tmp['num']) {
+ printf("[010] Expecting 1 row in table test, found %d rows\n", $tmp['num']);
+ }
+ $res->free();
+
+ if (!$mysqli->query('DROP TABLE IF EXISTS test')) {
+ printf("[011] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
+
+ if (!$mysqli->commit(0 , "tx_name0123")) {
+ printf("[012] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
+ if (!$mysqli->commit(0 , "*/ nonsense")) {
+ printf("[013] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
+ if (!$mysqli->commit(0 , "tx_name ulf вендел")) {
+ printf("[014] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
+ if (!$mysqli->commit(0 , "tx_name \t\n\r\b")) {
+ printf("[015] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
+ if (!$mysqli->commit(MYSQLI_TRANS_COR_AND_CHAIN | MYSQLI_TRANS_COR_NO_RELEASE , "tx_name")) {
+ printf("[016] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
+
+ $mysqli->close();
+
+ try {
+ $mysqli->commit();
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ print "done!";
--CLEAN--
<?php
require_once("clean_table.inc");
?>
--EXPECTF--
+mysqli object is not fully initialized
+
Warning: mysqli::commit(): Transaction name truncated. Must be only [0-9A-Za-z\-_=]+ in %s on line %d
Warning: mysqli::commit(): Transaction name truncated. Must be only [0-9A-Za-z\-_=]+ in %s on line %d
Warning: mysqli::commit(): Transaction name truncated. Must be only [0-9A-Za-z\-_=]+ in %s on line %d
+my_mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_connect.phpt b/ext/mysqli/tests/mysqli_connect.phpt
index 66cd94bd54..a1372f3511 100644
--- a/ext/mysqli/tests/mysqli_connect.phpt
+++ b/ext/mysqli/tests/mysqli_connect.phpt
@@ -8,145 +8,141 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
-
- /* we need to check, if the server allows anonymous login (empty user) */
- $tmp = @mysqli_connect('localhost');
- $anon_allow = (gettype($tmp) == "object");
-
- $exptype = ($anon_allow) ? "mysqli_object" : "false";
-
- $obj = new stdClass();
- if (!is_null($tmp = @mysqli_connect($obj)))
- printf("[001] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
-
- $tmp = @mysqli_connect($link);
- if (($anon_allow && gettype($tmp) != "object") || (!$anon_allow && $tmp != false)) {
- printf("[002] Expecting %s, got %s/%s\n", $exptype, gettype($tmp), $tmp);
- }
-
- $tmp = @mysqli_connect($link, $link);
- if (($anon_allow && gettype($tmp) != "object") || (!$anon_allow && $tmp != false)) {
- printf("[003] Expecting %s, got %s/%s\n", $exptype, gettype($tmp), $tmp);
- }
-
- $tmp = @mysqli_connect($link, $link, $link);
- if (($anon_allow && gettype($tmp) != "object") || (!$anon_allow && $tmp != false)) {
- printf("[004] Expecting %s, got %s/%s\n", $exptype, gettype($tmp), $tmp);
- }
-
- $tmp = @mysqli_connect($link, $link, $link, $link);
- if (($anon_allow && gettype($tmp) != "object") || (!$anon_allow && $tmp != false)) {
- printf("[005] Expecting %s, got %s/%s\n", $exptype, gettype($tmp), $tmp);
- }
-
- $tmp = @mysqli_connect($link, $link, $link, $link, $link);
- if (($anon_allow && gettype($tmp) != "object") || (!$anon_allow && $tmp != false)) {
- printf("[006] Expecting %s, got %s/%s\n", $exptype, gettype($tmp), $tmp);
- }
-
- $tmp = @mysqli_connect($link, $link, $link, $link, $link, $link);
- if (($anon_allow && gettype($tmp) != "object") || (!$anon_allow && $tmp != false)) {
- printf("[007] Expecting %s, got %s/%s\n", $exptype, gettype($tmp), $tmp);
- }
-
- if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[008] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
-
- mysqli_close($link);
-
- if ($link = mysqli_connect($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket))
- printf("[009] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
- $host, $user . 'unknown_really', $db, $port, $socket);
-
- if (false !== $link)
- printf("[010] Expecting boolean/false, got %s/%s\n", gettype($link), $link);
-
- // Run the following tests without an anoynmous MySQL user and use a password for the test user!
- ini_set('mysqli.default_socket', $socket);
- if (!is_object($link = mysqli_connect($host, $user, $passwd, $db, $port))) {
- printf("[011] Usage of mysqli.default_socket failed\n") ;
- } else {
- if (!$res = mysqli_query($link, "SELECT 'mysqli.default_socket' AS 'testing'"))
- printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
- mysqli_close($link);
- }
-
- ini_set('mysqli.default_port', $port);
- if (!is_object($link = mysqli_connect($host, $user, $passwd, $db))) {
- printf("[013] Usage of mysqli.default_port failed\n") ;
- } else {
- if (!$res = mysqli_query($link, "SELECT 'mysqli.default_port' AS 'testing'"))
- printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
- mysqli_close($link);
- }
-
- ini_set('mysqli.default_pw', $passwd);
- if (!is_object($link = mysqli_connect($host, $user))) {
- printf("[015] Usage of mysqli.default_pw failed\n") ;
- } else {
- if (!$res = mysqli_query($link, "SELECT 'mysqli.default_pw' AS 'testing'"))
- printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
- mysqli_close($link);
- }
-
- ini_set('mysqli.default_user', $user);
- if (!is_object($link = mysqli_connect($host))) {
- printf("[017] Usage of mysqli.default_user failed\n") ;
- } else {
- if (!$res = mysqli_query($link, "SELECT 'mysqli.default_user' AS 'testing'"))
- printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump(mysqli_fetch_array($res, MYSQLI_BOTH));
- mysqli_free_result($res);
- mysqli_close($link);
- }
-
- ini_set('mysqli.default_host', $host);
- if (!is_object($link = mysqli_connect())) {
- printf("[019] Usage of mysqli.default_host failed\n") ;
- } else {
- if (!$res = mysqli_query($link, "SELECT 'mysqli.default_host' AS 'testing'"))
- printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump(mysqli_fetch_array($res, MYSQLI_NUM));
- mysqli_free_result($res);
- mysqli_close($link);
- }
-
- if ($IS_MYSQLND) {
- ini_set('mysqli.default_host', 'p:' . $host);
- if (!is_object($link = mysqli_connect())) {
- printf("[021] Usage of mysqli.default_host (persistent) failed\n") ;
- } else {
- if (!$res = mysqli_query($link, "SELECT 'mysqli.default_host (persistent)' AS 'testing'"))
- printf("[022] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- if ($tmp['testing'] !== 'mysqli.default_host (persistent)') {
- printf("[023] Result looks strange - check manually, [%d] %s\n",
- mysqli_errno($link), mysqli_error($link));
- var_dump($tmp);
- }
- mysqli_free_result($res);
- mysqli_close($link);
- }
-
- ini_set('mysqli.default_host', 'p:');
- if (is_object($link = @mysqli_connect())) {
- printf("[024] Usage of mysqli.default_host=p: did not fail\n") ;
- mysqli_close($link);
- }
- }
-
- print "done!";
+ require_once("connect.inc");
+
+ $tmp = NULL;
+ $link = NULL;
+
+ /* we need to check, if the server allows anonymous login (empty user) */
+ $tmp = @mysqli_connect('localhost');
+ $anon_allow = (gettype($tmp) == "object");
+
+ $exptype = ($anon_allow) ? "mysqli_object" : "false";
+
+ $tmp = @mysqli_connect($link);
+ if (($anon_allow && gettype($tmp) != "object") || (!$anon_allow && $tmp != false)) {
+ printf("[002] Expecting %s, got %s/%s\n", $exptype, gettype($tmp), $tmp);
+ }
+
+ $tmp = @mysqli_connect($link, $link);
+ if (($anon_allow && gettype($tmp) != "object") || (!$anon_allow && $tmp != false)) {
+ printf("[003] Expecting %s, got %s/%s\n", $exptype, gettype($tmp), $tmp);
+ }
+
+ $tmp = @mysqli_connect($link, $link, $link);
+ if (($anon_allow && gettype($tmp) != "object") || (!$anon_allow && $tmp != false)) {
+ printf("[004] Expecting %s, got %s/%s\n", $exptype, gettype($tmp), $tmp);
+ }
+
+ $tmp = @mysqli_connect($link, $link, $link, $link);
+ if (($anon_allow && gettype($tmp) != "object") || (!$anon_allow && $tmp != false)) {
+ printf("[005] Expecting %s, got %s/%s\n", $exptype, gettype($tmp), $tmp);
+ }
+
+ $tmp = @mysqli_connect($link, $link, $link, $link, $link);
+ if (($anon_allow && gettype($tmp) != "object") || (!$anon_allow && $tmp != false)) {
+ printf("[006] Expecting %s, got %s/%s\n", $exptype, gettype($tmp), $tmp);
+ }
+
+ $tmp = @mysqli_connect($link, $link, $link, $link, $link, $link);
+ if (($anon_allow && gettype($tmp) != "object") || (!$anon_allow && $tmp != false)) {
+ printf("[007] Expecting %s, got %s/%s\n", $exptype, gettype($tmp), $tmp);
+ }
+
+ if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[008] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+
+ mysqli_close($link);
+
+ if ($link = mysqli_connect($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket))
+ printf("[009] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
+ $host, $user . 'unknown_really', $db, $port, $socket);
+
+ if (false !== $link)
+ printf("[010] Expecting boolean/false, got %s/%s\n", gettype($link), $link);
+
+ // Run the following tests without an anoynmous MySQL user and use a password for the test user!
+ ini_set('mysqli.default_socket', $socket);
+ if (!is_object($link = mysqli_connect($host, $user, $passwd, $db, $port))) {
+ printf("[011] Usage of mysqli.default_socket failed\n") ;
+ } else {
+ if (!$res = mysqli_query($link, "SELECT 'mysqli.default_socket' AS 'testing'"))
+ printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
+ mysqli_close($link);
+ }
+
+ ini_set('mysqli.default_port', $port);
+ if (!is_object($link = mysqli_connect($host, $user, $passwd, $db))) {
+ printf("[013] Usage of mysqli.default_port failed\n") ;
+ } else {
+ if (!$res = mysqli_query($link, "SELECT 'mysqli.default_port' AS 'testing'"))
+ printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
+ mysqli_close($link);
+ }
+
+ ini_set('mysqli.default_pw', $passwd);
+ if (!is_object($link = mysqli_connect($host, $user))) {
+ printf("[015] Usage of mysqli.default_pw failed\n") ;
+ } else {
+ if (!$res = mysqli_query($link, "SELECT 'mysqli.default_pw' AS 'testing'"))
+ printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
+ mysqli_close($link);
+ }
+
+ ini_set('mysqli.default_user', $user);
+ if (!is_object($link = mysqli_connect($host))) {
+ printf("[017] Usage of mysqli.default_user failed\n") ;
+ } else {
+ if (!$res = mysqli_query($link, "SELECT 'mysqli.default_user' AS 'testing'"))
+ printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ var_dump(mysqli_fetch_array($res, MYSQLI_BOTH));
+ mysqli_free_result($res);
+ mysqli_close($link);
+ }
+
+ ini_set('mysqli.default_host', $host);
+ if (!is_object($link = mysqli_connect())) {
+ printf("[019] Usage of mysqli.default_host failed\n") ;
+ } else {
+ if (!$res = mysqli_query($link, "SELECT 'mysqli.default_host' AS 'testing'"))
+ printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ var_dump(mysqli_fetch_array($res, MYSQLI_NUM));
+ mysqli_free_result($res);
+ mysqli_close($link);
+ }
+
+ if ($IS_MYSQLND) {
+ ini_set('mysqli.default_host', 'p:' . $host);
+ if (!is_object($link = mysqli_connect())) {
+ printf("[021] Usage of mysqli.default_host (persistent) failed\n") ;
+ } else {
+ if (!$res = mysqli_query($link, "SELECT 'mysqli.default_host (persistent)' AS 'testing'"))
+ printf("[022] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ if ($tmp['testing'] !== 'mysqli.default_host (persistent)') {
+ printf("[023] Result looks strange - check manually, [%d] %s\n",
+ mysqli_errno($link), mysqli_error($link));
+ var_dump($tmp);
+ }
+ mysqli_free_result($res);
+ mysqli_close($link);
+ }
+
+ ini_set('mysqli.default_host', 'p:');
+ if (is_object($link = @mysqli_connect())) {
+ printf("[024] Usage of mysqli.default_host=p: did not fail\n") ;
+ mysqli_close($link);
+ }
+ }
+
+ print "done!";
?>
--EXPECTF--
Warning: mysqli_connect(): (%s/%d): Access denied for user '%s'@'%s' (using password: YES) in %s on line %d
diff --git a/ext/mysqli/tests/mysqli_connect_attr.phpt b/ext/mysqli/tests/mysqli_connect_attr.phpt
index 96c79b1a6b..86f3e08a5c 100644
--- a/ext/mysqli/tests/mysqli_connect_attr.phpt
+++ b/ext/mysqli/tests/mysqli_connect_attr.phpt
@@ -37,13 +37,13 @@ mysqli_close($link);
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
$res = NULL;
- if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",$host, $user, $db, $port, $socket);
+ if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",$host, $user, $db, $port, $socket);
//in case $host is empty, do not test for _server_host field
if (isset($host) && trim($host) != '') {
diff --git a/ext/mysqli/tests/mysqli_connect_errno.phpt b/ext/mysqli/tests/mysqli_connect_errno.phpt
index e596a1891a..f542ba88e8 100644
--- a/ext/mysqli/tests/mysqli_connect_errno.phpt
+++ b/ext/mysqli/tests/mysqli_connect_errno.phpt
@@ -8,33 +8,37 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- // too many parameter
- if (0 !== ($tmp = @mysqli_connect_errno($link)))
- printf("[001] Expecting integer/0, got %s/%s\n", gettype($tmp), $tmp);
+ // too many parameter
+ try {
+ mysqli_connect_errno($link);
+ } catch (ArgumentCountError $exception) {
+ print($exception->getMessage() . "\n");
+ }
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (0 !== ($tmp = mysqli_connect_errno()))
- printf("[003] Expecting integer/0, got %s/%s\n", gettype($tmp), $tmp);
+ if (0 !== ($tmp = mysqli_connect_errno()))
+ printf("[003] Expecting integer/0, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
+ mysqli_close($link);
- $link = @my_mysqli_connect($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket);
- if (false !== $link)
- printf("[004] Connect to the server should fail using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s, expecting boolean/false, got %s/%s\n",
- $host, $user . 'unknown_really', $db, $port, $socket, gettype($link), var_export($link, true));
+ $link = @my_mysqli_connect($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket);
+ if (false !== $link)
+ printf("[004] Connect to the server should fail using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s, expecting boolean/false, got %s/%s\n",
+ $host, $user . 'unknown_really', $db, $port, $socket, gettype($link), var_export($link, true));
- if (0 === ($tmp = mysqli_connect_errno()))
- printf("[005] Expecting integer/any non-zero, got %s/%s\n", gettype($tmp), $tmp);
+ if (0 === ($tmp = mysqli_connect_errno()))
+ printf("[005] Expecting integer/any non-zero, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--EXPECT--
+mysqli_connect_errno() expects exactly 0 parameters, 1 given
done!
diff --git a/ext/mysqli/tests/mysqli_connect_error.phpt b/ext/mysqli/tests/mysqli_connect_error.phpt
index d0c79d6c71..0f51d15dfd 100644
--- a/ext/mysqli/tests/mysqli_connect_error.phpt
+++ b/ext/mysqli/tests/mysqli_connect_error.phpt
@@ -8,32 +8,36 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- // too many parameter
- if (!is_null($tmp = @mysqli_connect_error($link)))
- printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
+ // too many parameter
+ try {
+ mysqli_connect_error($link);
+ } catch (ArgumentCountError $exception) {
+ print($exception->getMessage() . "\n");
+ }
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (NULL !== ($tmp = mysqli_connect_error()))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = mysqli_connect_error()))
+ printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
+ mysqli_close($link);
- if ($link = @my_mysqli_connect($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket))
- printf("[003] Connect to the server should fail using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
- $host, $user . 'unknown_really', $db, $port, $socket);
+ if ($link = @my_mysqli_connect($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket))
+ printf("[003] Connect to the server should fail using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
+ $host, $user . 'unknown_really', $db, $port, $socket);
- if ('' === ($tmp = mysqli_connect_error()))
- printf("[004] Expecting string/'', got %s/%s\n", gettype($tmp), $tmp);
+ if ('' === ($tmp = mysqli_connect_error()))
+ printf("[004] Expecting string/'', got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--EXPECT--
+mysqli_connect_error() expects exactly 0 parameters, 1 given
done!
diff --git a/ext/mysqli/tests/mysqli_connect_oo.phpt b/ext/mysqli/tests/mysqli_connect_oo.phpt
index 15520d42b5..e39b4ac2da 100644
--- a/ext/mysqli/tests/mysqli_connect_oo.phpt
+++ b/ext/mysqli/tests/mysqli_connect_oo.phpt
@@ -8,146 +8,150 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
-
- $obj = new stdClass();
-
- if ($mysqli = new mysqli($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket) && !mysqli_connect_errno())
- printf("[003] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
- $host, $user . 'unknown_really', $db, $port, $socket);
-
- if (false !== $mysqli)
- printf("[004] Expecting boolean/false, got %s/%s\n", gettype($mysqli), $mysqli);
-
- // Run the following tests without an anoynmous MySQL user and use a password for the test user!
- ini_set('mysqli.default_socket', $socket);
- if (!is_object($mysqli = new mysqli($host, $user, $passwd, $db, $port)) || (0 !== mysqli_connect_errno())) {
- printf("[005] Usage of mysqli.default_socket failed\n") ;
- } else {
- $mysqli->close();
- }
-
- ini_set('mysqli.default_port', $port);
- if (!is_object($mysqli = new mysqli($host, $user, $passwd, $db)) || (0 !== mysqli_connect_errno())) {
- printf("[006] Usage of mysqli.default_port failed\n") ;
- } else {
- $mysqli->close();
- }
-
- ini_set('mysqli.default_pw', $passwd);
- if (!is_object($mysqli = new mysqli($host, $user)) || (0 !== mysqli_connect_errno())) {
- printf("[007] Usage of mysqli.default_pw failed\n") ;
- } else {
- $mysqli->close();
- }
-
- ini_set('mysqli.default_user', $user);
- if (!is_object($mysqli = new mysqli($host)) || (0 !== mysqli_connect_errno())) {
- printf("[008] Usage of mysqli.default_user failed\n") ;
- } else {
- $mysqli->close();
- }
-
- ini_set('mysqli.default_host', $host);
- if (!is_object($mysqli = new mysqli()) || (0 !== mysqli_connect_errno())) {
- printf("[012] Failed to create mysqli object\n");
- } else {
- // There shall be NO connection! Using new mysqli(void) shall not use defaults for a connection!
- // We had long discussions on this and found that the ext/mysqli API as
- // such is broken. As we can't fix it, we document how it has behaved from
- // the first day on. And that's: no connection.
- if (false !== ($tmp = @$mysqli->query('SELECT 1'))) {
- printf("[013] There shall be no connection!\n");
- $mysqli->close();
- }
- }
-
- if ($IS_MYSQLND) {
- ini_set('mysqli.default_host', 'p:' . $host);
- if (!is_object($mysqli = new mysqli())) {
- // Due to an API flaw this shall not connect
- printf("[010] Failed to create mysqli object\n");
- } else {
- // There shall be NO connection! Using new mysqli(void) shall not use defaults for a connection!
- // We had long discussions on this and found that the ext/mysqli API as
- // such is broken. As we can't fix it, we document how it has behaved from
- // the first day on. And that's: no connection.
- if (false !== ($tmp = @$mysqli->query('SELECT 1'))) {
- printf("[011] There shall be no connection!\n");
- $mysqli->close();
- }
- }
- }
-
- print "... and now Exceptions\n";
- mysqli_report(MYSQLI_REPORT_OFF);
- mysqli_report(MYSQLI_REPORT_STRICT);
-
- try {
- $mysqli = new mysqli($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket);
- printf("[016] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
- $host, $user . 'unknown_really', $db, $port, $socket);
- $mysqli->close();
- } catch (mysqli_sql_exception $e) {
- printf("%s\n", $e->getMessage());
- }
-
- ini_set('mysqli.default_socket', $socket);
- try {
- $mysqli = new mysqli($host, $user, $passwd, $db, $port);
- $mysqli->close();
- } catch (mysqli_sql_exception $e) {
- printf("%s\n", $e->getMessage());
- printf("[017] Usage of mysqli.default_socket failed\n") ;
- }
-
- ini_set('mysqli.default_port', $port);
- try {
- $mysqli = new mysqli($host, $user, $passwd, $db);
- $mysqli->close();
- } catch (mysqli_sql_exception $e) {
- printf("%s\n", $e->getMessage());
- printf("[018] Usage of mysqli.default_port failed\n") ;
- }
-
- ini_set('mysqli.default_pw', $passwd);
- try {
- $mysqli = new mysqli($host, $user);
- $mysqli->close();
- } catch (mysqli_sql_exception $e) {
- printf("%s\n", $e->getMessage());
- printf("[019] Usage of mysqli.default_pw failed\n");
- }
-
- ini_set('mysqli.default_user', $user);
- try {
- $mysqli = new mysqli($host);
- $mysqli->close();
- } catch (mysqli_sql_exception $e) {
- printf("%s\n", $e->getMessage());
- printf("[020] Usage of mysqli.default_user failed\n") ;
- }
-
- ini_set('mysqli.default_host', $host);
- try {
- /* NOTE that at this point one must use a different syntax! */
- $mysqli = mysqli_init();
- $mysqli->real_connect();
- assert(0 === mysqli_connect_errno());
- $mysqli->close();
- assert(0 === mysqli_connect_errno());
- } catch (mysqli_sql_exception $e) {
- printf("%s\n", $e->getMessage());
- printf("[021] Usage of mysqli.default_host failed\n");
- }
-
- print "done!";
+ require_once("connect.inc");
+
+ $tmp = NULL;
+ $link = NULL;
+
+ $obj = new stdClass();
+
+ if ($mysqli = new mysqli($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket) && !mysqli_connect_errno())
+ printf("[003] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
+ $host, $user . 'unknown_really', $db, $port, $socket);
+
+ if (false !== $mysqli)
+ printf("[004] Expecting boolean/false, got %s/%s\n", gettype($mysqli), $mysqli);
+
+ // Run the following tests without an anoynmous MySQL user and use a password for the test user!
+ ini_set('mysqli.default_socket', $socket);
+ if (!is_object($mysqli = new mysqli($host, $user, $passwd, $db, $port)) || (0 !== mysqli_connect_errno())) {
+ printf("[005] Usage of mysqli.default_socket failed\n") ;
+ } else {
+ $mysqli->close();
+ }
+
+ ini_set('mysqli.default_port', $port);
+ if (!is_object($mysqli = new mysqli($host, $user, $passwd, $db)) || (0 !== mysqli_connect_errno())) {
+ printf("[006] Usage of mysqli.default_port failed\n") ;
+ } else {
+ $mysqli->close();
+ }
+
+ ini_set('mysqli.default_pw', $passwd);
+ if (!is_object($mysqli = new mysqli($host, $user)) || (0 !== mysqli_connect_errno())) {
+ printf("[007] Usage of mysqli.default_pw failed\n") ;
+ } else {
+ $mysqli->close();
+ }
+
+ ini_set('mysqli.default_user', $user);
+ if (!is_object($mysqli = new mysqli($host)) || (0 !== mysqli_connect_errno())) {
+ printf("[008] Usage of mysqli.default_user failed\n") ;
+ } else {
+ $mysqli->close();
+ }
+
+ ini_set('mysqli.default_host', $host);
+ if (!is_object($mysqli = new mysqli()) || (0 !== mysqli_connect_errno())) {
+ printf("[012] Failed to create mysqli object\n");
+ } else {
+ // There shall be NO connection! Using new mysqli(void) shall not use defaults for a connection!
+ // We had long discussions on this and found that the ext/mysqli API as
+ // such is broken. As we can't fix it, we document how it has behaved from
+ // the first day on. And that's: no connection.
+ try {
+ $mysqli->query('SELECT 1');
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+ }
+
+ if ($IS_MYSQLND) {
+ ini_set('mysqli.default_host', 'p:' . $host);
+ if (!is_object($mysqli = new mysqli())) {
+ // Due to an API flaw this shall not connect
+ printf("[010] Failed to create mysqli object\n");
+ } else {
+ // There shall be NO connection! Using new mysqli(void) shall not use defaults for a connection!
+ // We had long discussions on this and found that the ext/mysqli API as
+ // such is broken. As we can't fix it, we document how it has behaved from
+ // the first day on. And that's: no connection.
+ try {
+ $mysqli->query('SELECT 1');
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+ }
+ }
+
+ print "... and now Exceptions\n";
+ mysqli_report(MYSQLI_REPORT_OFF);
+ mysqli_report(MYSQLI_REPORT_STRICT);
+
+ try {
+ $mysqli = new mysqli($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket);
+ printf("[016] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
+ $host, $user . 'unknown_really', $db, $port, $socket);
+ $mysqli->close();
+ } catch (mysqli_sql_exception $e) {
+ printf("%s\n", $e->getMessage());
+ }
+
+ ini_set('mysqli.default_socket', $socket);
+ try {
+ $mysqli = new mysqli($host, $user, $passwd, $db, $port);
+ $mysqli->close();
+ } catch (mysqli_sql_exception $e) {
+ printf("%s\n", $e->getMessage());
+ printf("[017] Usage of mysqli.default_socket failed\n") ;
+ }
+
+ ini_set('mysqli.default_port', $port);
+ try {
+ $mysqli = new mysqli($host, $user, $passwd, $db);
+ $mysqli->close();
+ } catch (mysqli_sql_exception $e) {
+ printf("%s\n", $e->getMessage());
+ printf("[018] Usage of mysqli.default_port failed\n") ;
+ }
+
+ ini_set('mysqli.default_pw', $passwd);
+ try {
+ $mysqli = new mysqli($host, $user);
+ $mysqli->close();
+ } catch (mysqli_sql_exception $e) {
+ printf("%s\n", $e->getMessage());
+ printf("[019] Usage of mysqli.default_pw failed\n");
+ }
+
+ ini_set('mysqli.default_user', $user);
+ try {
+ $mysqli = new mysqli($host);
+ $mysqli->close();
+ } catch (mysqli_sql_exception $e) {
+ printf("%s\n", $e->getMessage());
+ printf("[020] Usage of mysqli.default_user failed\n") ;
+ }
+
+ ini_set('mysqli.default_host', $host);
+ try {
+ /* NOTE that at this point one must use a different syntax! */
+ $mysqli = mysqli_init();
+ $mysqli->real_connect();
+ assert(0 === mysqli_connect_errno());
+ $mysqli->close();
+ assert(0 === mysqli_connect_errno());
+ } catch (mysqli_sql_exception $e) {
+ printf("%s\n", $e->getMessage());
+ printf("[021] Usage of mysqli.default_host failed\n");
+ }
+
+ print "done!";
?>
--EXPECTF--
Warning: mysqli::__construct(): (%s/%d): Access denied for user '%sunknown%s'@'%s' (using password: %s) in %s on line %d
+mysqli object is not fully initialized
+mysqli object is not fully initialized
... and now Exceptions
Access denied for user '%s'@'%s' (using password: %s)
done!
diff --git a/ext/mysqli/tests/mysqli_connect_oo_defaults.phpt b/ext/mysqli/tests/mysqli_connect_oo_defaults.phpt
index cdc8049719..c5e65f7616 100644
--- a/ext/mysqli/tests/mysqli_connect_oo_defaults.phpt
+++ b/ext/mysqli/tests/mysqli_connect_oo_defaults.phpt
@@ -8,153 +8,153 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
-
- if ($socket != "")
- /* mysqli.default_socket requires non-empty string */
- ini_set('mysqli.default_socket', 'socket');
-
- ini_set('mysqli.default_port', 9999);
- ini_set('mysqli.default_pw', 'password');
- ini_set('mysqli.default_user', 'user');
- ini_set('mysqli.default_host', 'host');
-
- mysqli_report(MYSQLI_REPORT_OFF);
- mysqli_report(MYSQLI_REPORT_STRICT);
-
- if ($socket != "") {
- ini_set('mysqli.default_socket', $socket);
- try {
- $mysqli = mysqli_init();
- $mysqli->real_connect($host, $user, $passwd, $db, $port);
-
- if (!$res = $mysqli->query("SELECT 'mysqli.default_socket' AS testing"))
- printf("[001] [%d] %s\n", $mysqli->errno, $mysqli->error);
- $tmp = $res->fetch_assoc();
- $res->free_result();
-
- if (!isset($tmp['testing']) || $tmp['testing'] != 'mysqli.default_socket') {
- printf("[002] mysqli.default_socket not properly set?\n");
- var_dump($tmp);
- }
-
- $mysqli->close();
-
- } catch (mysqli_sql_exception $e) {
- printf("%s\n", $e->getMessage());
- printf("[002] Usage of mysqli.default_socket failed\n");
- }
- }
-
- ini_set('mysqli.default_port', $port);
- try {
- $mysqli = mysqli_init();
- $mysqli->real_connect($host, $user, $passwd, $db);
-
- if (!$res = $mysqli->query("SELECT 'mysqli.default_port' AS testing"))
- printf("[003] [%d] %s\n", $mysqli->errno, $mysqli->error);
- var_dump($res->fetch_assoc());
- $res->free_result();
-
- $mysqli->close();
-
- } catch (mysqli_sql_exception $e) {
- printf("%s\n", $e->getMessage());
- printf("[004] Usage of mysqli.default_port failed\n");
- }
-
- ini_set('mysqli.default_pw', $passwd);
- try {
- $mysqli = mysqli_init();
- $mysqli->real_connect($host, $user);
- $mysqli->select_db($db);
-
- if (!$res = $mysqli->query("SELECT 'mysqli.default_pw' AS testing"))
- printf("[005] [%d] %s\n", $mysqli->errno, $mysqli->error);
- var_dump($res->fetch_assoc());
- $res->free_result();
-
- $mysqli->close();
-
- } catch (mysqli_sql_exception $e) {
- printf("%s\n", $e->getMessage());
- printf("[006] Usage of mysqli.default_pw failed\n");
- }
-
- ini_set('mysqli.default_user', $user);
- try {
- $mysqli = mysqli_init();
- $mysqli->real_connect($host);
- $mysqli->select_db($db);
-
- if (!$res = $mysqli->query("SELECT 'mysqli.default_user' AS testing"))
- printf("[007] [%d] %s\n", $mysqli->errno, $mysqli->error);
- var_dump($res->fetch_assoc());
- $res->free_result();
-
- $mysqli->close();
-
- } catch (mysqli_sql_exception $e) {
- printf("%s\n", $e->getMessage());
- printf("[008] Usage of mysqli.default_user failed\n");
- }
-
- ini_set('mysqli.default_host', $host);
- try {
- $mysqli = mysqli_init();
- $mysqli->real_connect();
- $mysqli->select_db($db);
-
- if (!$res = $mysqli->query("SELECT 1"))
- printf("[009] [%d] %s\n", $mysqli->errno, $mysqli->error);
- $res->free_result();
-
- if (!$res = $mysqli->query("SELECT SUBSTRING_INDEX(USER(),'@',1) AS username"))
- printf("[010] [%d] %s\n", $mysqli->errno, $mysqli->error);
-
- $tmp = $res->fetch_assoc();
- $res->free_result();
- if ($tmp['username'] !== $user)
- printf("[011] Expecting string/%s, got %s/%s\n", $user, gettype($tmp['username']), $tmp['username']);
-
- $mysqli->close();
-
- } catch (mysqli_sql_exception $e) {
- printf("%s\n", $e->getMessage());
- printf("[012] Usage of mysqli.default_host failed\n");
- }
-
- try {
- $link = mysqli_connect($host, $user, $passwd, null, ini_get('mysqli.default_port'));
- mysqli_select_db($link, $db);
- if (!$res = mysqli_query($link, "SELECT 'have been set' AS all_defaults"))
- printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
- mysqli_close($link);
- } catch (mysqli_sql_exception $e) {
- printf("%s\n", $e->getMessage());
- printf("[014] Usage of mysqli_connect() has failed\n");
- }
-
- try {
- $link = mysqli_connect($host, $user, $passwd, null);
- mysqli_select_db($link, $db);
- if (!$res = mysqli_query($link, "SELECT 'have been set' AS all_defaults"))
- printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
- mysqli_close($link);
- } catch (mysqli_sql_exception $e) {
- printf("%s\n", $e->getMessage());
- printf("[016] Usage of mysqli_connect() has failed\n");
- }
-
-
- print "done!";
+ require_once("connect.inc");
+
+ $tmp = NULL;
+ $link = NULL;
+
+ if ($socket != "")
+ /* mysqli.default_socket requires non-empty string */
+ ini_set('mysqli.default_socket', 'socket');
+
+ ini_set('mysqli.default_port', 9999);
+ ini_set('mysqli.default_pw', 'password');
+ ini_set('mysqli.default_user', 'user');
+ ini_set('mysqli.default_host', 'host');
+
+ mysqli_report(MYSQLI_REPORT_OFF);
+ mysqli_report(MYSQLI_REPORT_STRICT);
+
+ if ($socket != "") {
+ ini_set('mysqli.default_socket', $socket);
+ try {
+ $mysqli = mysqli_init();
+ $mysqli->real_connect($host, $user, $passwd, $db, $port);
+
+ if (!$res = $mysqli->query("SELECT 'mysqli.default_socket' AS testing"))
+ printf("[001] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ $tmp = $res->fetch_assoc();
+ $res->free_result();
+
+ if (!isset($tmp['testing']) || $tmp['testing'] != 'mysqli.default_socket') {
+ printf("[002] mysqli.default_socket not properly set?\n");
+ var_dump($tmp);
+ }
+
+ $mysqli->close();
+
+ } catch (mysqli_sql_exception $e) {
+ printf("%s\n", $e->getMessage());
+ printf("[002] Usage of mysqli.default_socket failed\n");
+ }
+ }
+
+ ini_set('mysqli.default_port', $port);
+ try {
+ $mysqli = mysqli_init();
+ $mysqli->real_connect($host, $user, $passwd, $db);
+
+ if (!$res = $mysqli->query("SELECT 'mysqli.default_port' AS testing"))
+ printf("[003] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ var_dump($res->fetch_assoc());
+ $res->free_result();
+
+ $mysqli->close();
+
+ } catch (mysqli_sql_exception $e) {
+ printf("%s\n", $e->getMessage());
+ printf("[004] Usage of mysqli.default_port failed\n");
+ }
+
+ ini_set('mysqli.default_pw', $passwd);
+ try {
+ $mysqli = mysqli_init();
+ $mysqli->real_connect($host, $user);
+ $mysqli->select_db($db);
+
+ if (!$res = $mysqli->query("SELECT 'mysqli.default_pw' AS testing"))
+ printf("[005] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ var_dump($res->fetch_assoc());
+ $res->free_result();
+
+ $mysqli->close();
+
+ } catch (mysqli_sql_exception $e) {
+ printf("%s\n", $e->getMessage());
+ printf("[006] Usage of mysqli.default_pw failed\n");
+ }
+
+ ini_set('mysqli.default_user', $user);
+ try {
+ $mysqli = mysqli_init();
+ $mysqli->real_connect($host);
+ $mysqli->select_db($db);
+
+ if (!$res = $mysqli->query("SELECT 'mysqli.default_user' AS testing"))
+ printf("[007] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ var_dump($res->fetch_assoc());
+ $res->free_result();
+
+ $mysqli->close();
+
+ } catch (mysqli_sql_exception $e) {
+ printf("%s\n", $e->getMessage());
+ printf("[008] Usage of mysqli.default_user failed\n");
+ }
+
+ ini_set('mysqli.default_host', $host);
+ try {
+ $mysqli = mysqli_init();
+ $mysqli->real_connect();
+ $mysqli->select_db($db);
+
+ if (!$res = $mysqli->query("SELECT 1"))
+ printf("[009] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ $res->free_result();
+
+ if (!$res = $mysqli->query("SELECT SUBSTRING_INDEX(USER(),'@',1) AS username"))
+ printf("[010] [%d] %s\n", $mysqli->errno, $mysqli->error);
+
+ $tmp = $res->fetch_assoc();
+ $res->free_result();
+ if ($tmp['username'] !== $user)
+ printf("[011] Expecting string/%s, got %s/%s\n", $user, gettype($tmp['username']), $tmp['username']);
+
+ $mysqli->close();
+
+ } catch (mysqli_sql_exception $e) {
+ printf("%s\n", $e->getMessage());
+ printf("[012] Usage of mysqli.default_host failed\n");
+ }
+
+ try {
+ $link = mysqli_connect($host, $user, $passwd, null, ini_get('mysqli.default_port'));
+ mysqli_select_db($link, $db);
+ if (!$res = mysqli_query($link, "SELECT 'have been set' AS all_defaults"))
+ printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
+ mysqli_close($link);
+ } catch (mysqli_sql_exception $e) {
+ printf("%s\n", $e->getMessage());
+ printf("[014] Usage of mysqli_connect() has failed\n");
+ }
+
+ try {
+ $link = mysqli_connect($host, $user, $passwd, null);
+ mysqli_select_db($link, $db);
+ if (!$res = mysqli_query($link, "SELECT 'have been set' AS all_defaults"))
+ printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
+ mysqli_close($link);
+ } catch (mysqli_sql_exception $e) {
+ printf("%s\n", $e->getMessage());
+ printf("[016] Usage of mysqli_connect() has failed\n");
+ }
+
+
+ print "done!";
?>
--EXPECT--
array(1) {
diff --git a/ext/mysqli/tests/mysqli_connect_oo_warnings.phpt b/ext/mysqli/tests/mysqli_connect_oo_warnings.phpt
index 8204d0f1da..5b410b746b 100644
--- a/ext/mysqli/tests/mysqli_connect_oo_warnings.phpt
+++ b/ext/mysqli/tests/mysqli_connect_oo_warnings.phpt
@@ -12,34 +12,34 @@ new mysqli()
?>
--FILE--
<?php
- require_once("connect.inc");
-
- $myhost = 'invalidhost';
- $link = NULL;
-
- print "1) bail\n";
- if (!is_object($mysqli = new mysqli($myhost)) || ('mysqli' !== get_class($mysqli)))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($mysqli), (is_object($mysqli)) ? var_export($mysqli, true) : $mysqli);
-
- print "2) be quiet\n";
- if (!is_object($mysqli = @new mysqli($myhost)) || ('mysqli' !== get_class($mysqli)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($mysqli), (is_object($mysqli)) ? var_export($mysqli, true) : $mysqli);
- var_dump(mysqli_connect_error());
- var_dump(mysqli_connect_errno());
-
- print "3) bail\n";
- if (false !== ($link = mysqli_connect($myhost))) {
- printf("[003] Expecting boolean/false, got %s/%s\n", gettype($link), $link);
- }
-
- print "4) be quiet\n";
- if (false !== ($link = @mysqli_connect($myhost))) {
- printf("[004] Expecting boolean/false, got %s/%s\n", gettype($link), $link);
- }
- var_dump(mysqli_connect_error());
- var_dump(mysqli_connect_errno());
-
- print "done!";
+ require_once("connect.inc");
+
+ $myhost = 'invalidhost';
+ $link = NULL;
+
+ print "1) bail\n";
+ if (!is_object($mysqli = new mysqli($myhost)) || ('mysqli' !== get_class($mysqli)))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($mysqli), (is_object($mysqli)) ? var_export($mysqli, true) : $mysqli);
+
+ print "2) be quiet\n";
+ if (!is_object($mysqli = @new mysqli($myhost)) || ('mysqli' !== get_class($mysqli)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($mysqli), (is_object($mysqli)) ? var_export($mysqli, true) : $mysqli);
+ var_dump(mysqli_connect_error());
+ var_dump(mysqli_connect_errno());
+
+ print "3) bail\n";
+ if (false !== ($link = mysqli_connect($myhost))) {
+ printf("[003] Expecting boolean/false, got %s/%s\n", gettype($link), $link);
+ }
+
+ print "4) be quiet\n";
+ if (false !== ($link = @mysqli_connect($myhost))) {
+ printf("[004] Expecting boolean/false, got %s/%s\n", gettype($link), $link);
+ }
+ var_dump(mysqli_connect_error());
+ var_dump(mysqli_connect_errno());
+
+ print "done!";
?>
--EXPECTF--
1) bail
diff --git a/ext/mysqli/tests/mysqli_connect_twice.phpt b/ext/mysqli/tests/mysqli_connect_twice.phpt
index c5ba7493c1..6fa6746537 100644
--- a/ext/mysqli/tests/mysqli_connect_twice.phpt
+++ b/ext/mysqli/tests/mysqli_connect_twice.phpt
@@ -8,69 +8,69 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (!$thread_id = mysqli_thread_id($link))
- printf("[002] Cannot determine thread id, test will fail, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$thread_id = mysqli_thread_id($link))
+ printf("[002] Cannot determine thread id, test will fail, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (true !== ($tmp = my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)))
- printf("[003] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)))
+ printf("[003] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
- if (!is_int($new_thread_id = mysqli_thread_id($link)) || ($new_thread_id < 0))
- printf("[004] Expecting int/any got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_int($new_thread_id = mysqli_thread_id($link)) || ($new_thread_id < 0))
+ printf("[004] Expecting int/any got %s/%s\n", gettype($tmp), $tmp);
- if ($thread_id == $new_thread_id)
- printf("[005] Expecting new connection and new thread id. Old thread id %d, new thread id %d\n", $thread_id, $new_thread_id);
+ if ($thread_id == $new_thread_id)
+ printf("[005] Expecting new connection and new thread id. Old thread id %d, new thread id %d\n", $thread_id, $new_thread_id);
- if (!($res = mysqli_query($link, "SELECT 'ok' AS it_works")) ||
- !($row = mysqli_fetch_assoc($res)))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!($res = mysqli_query($link, "SELECT 'ok' AS it_works")) ||
+ !($row = mysqli_fetch_assoc($res)))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump($row);
- mysqli_free_result($res);
+ var_dump($row);
+ mysqli_free_result($res);
- mysqli_close($link);
+ mysqli_close($link);
- if (!$link = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[007] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[007] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (!$thread_id = $link->thread_id)
- printf("[008] Cannot determine thread id, test will fail, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$thread_id = $link->thread_id)
+ printf("[008] Cannot determine thread id, test will fail, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (true !== ($tmp = $link->real_connect($host, $user, $passwd, $db, $port, $socket)))
- printf("[009] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = $link->real_connect($host, $user, $passwd, $db, $port, $socket)))
+ printf("[009] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
- if (!is_int($new_thread_id = $link->thread_id) || ($new_thread_id < 0))
- printf("[010] Expecting int/any got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_int($new_thread_id = $link->thread_id) || ($new_thread_id < 0))
+ printf("[010] Expecting int/any got %s/%s\n", gettype($tmp), $tmp);
- if ($thread_id == $new_thread_id)
- printf("[011] Expecting new connection and new thread id. Old thread id %d, new thread id %d\n", $thread_id, $new_thread_id);
+ if ($thread_id == $new_thread_id)
+ printf("[011] Expecting new connection and new thread id. Old thread id %d, new thread id %d\n", $thread_id, $new_thread_id);
- if (!($res = $link->query("SELECT 'works also with oo' AS syntax")) ||
- !($row = $res->fetch_assoc()))
- printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!($res = $link->query("SELECT 'works also with oo' AS syntax")) ||
+ !($row = $res->fetch_assoc()))
+ printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump($row);
- mysqli_free_result($res);
+ var_dump($row);
+ mysqli_free_result($res);
- mysqli_close($link);
+ mysqli_close($link);
- if (NULL !== ($tmp = $link->connect($host, $user, $passwd, $db, $port, $socket)))
- printf("[013] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = $link->connect($host, $user, $passwd, $db, $port, $socket)))
+ printf("[013] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
- if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[014] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[014] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (NULL !== ($tmp = $link->connect($host, $user, $passwd, $db, $port, $socket)))
- printf("[015] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = $link->connect($host, $user, $passwd, $db, $port, $socket)))
+ printf("[015] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--EXPECT--
array(1) {
diff --git a/ext/mysqli/tests/mysqli_constants.phpt b/ext/mysqli/tests/mysqli_constants.phpt
index 1994a5ec96..b281a9c9c5 100644
--- a/ext/mysqli/tests/mysqli_constants.phpt
+++ b/ext/mysqli/tests/mysqli_constants.phpt
@@ -10,234 +10,234 @@ require_once('skipifconnectfailure.inc');
mysqli.allow_local_infile=1
--FILE--
<?php
- require("connect.inc");
- require("table.inc");
-
- $php_version = (int)str_replace('.', '', PHP_VERSION);
- $constants = get_defined_constants(true);
- sort($constants);
-
- $expected_constants = array(
- 'MYSQLI_READ_DEFAULT_GROUP' => true,
- 'MYSQLI_READ_DEFAULT_FILE' => true,
- 'MYSQLI_OPT_CONNECT_TIMEOUT' => true,
- 'MYSQLI_OPT_LOCAL_INFILE' => true,
- 'MYSQLI_OPT_READ_TIMEOUT' => true,
- 'MYSQLI_INIT_COMMAND' => true,
- 'MYSQLI_CLIENT_SSL' => true,
- "MYSQLI_CLIENT_COMPRESS" => true,
- "MYSQLI_CLIENT_INTERACTIVE" => true,
- "MYSQLI_CLIENT_IGNORE_SPACE" => true,
- "MYSQLI_CLIENT_NO_SCHEMA" => true,
- "MYSQLI_CLIENT_FOUND_ROWS" => true,
- "MYSQLI_STORE_RESULT" => true,
- "MYSQLI_USE_RESULT" => true,
- "MYSQLI_ASSOC" => true,
- "MYSQLI_NUM" => true,
- "MYSQLI_BOTH" => true,
- "MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH"=> true,
- "MYSQLI_NOT_NULL_FLAG" => true,
- "MYSQLI_PRI_KEY_FLAG" => true,
- "MYSQLI_UNIQUE_KEY_FLAG" => true,
- "MYSQLI_MULTIPLE_KEY_FLAG" => true,
- "MYSQLI_BLOB_FLAG" => true,
- "MYSQLI_UNSIGNED_FLAG" => true,
- "MYSQLI_ZEROFILL_FLAG" => true,
- "MYSQLI_AUTO_INCREMENT_FLAG" => true,
- "MYSQLI_TIMESTAMP_FLAG" => true,
- "MYSQLI_SET_FLAG" => true,
- "MYSQLI_NUM_FLAG" => true,
- "MYSQLI_ENUM_FLAG" => true,
- "MYSQLI_BINARY_FLAG" => true,
- "MYSQLI_PART_KEY_FLAG" => true,
- "MYSQLI_GROUP_FLAG" => true,
- "MYSQLI_SERVER_QUERY_NO_GOOD_INDEX_USED"=> true,
- "MYSQLI_SERVER_QUERY_NO_INDEX_USED" => true,
-
- "MYSQLI_TYPE_DECIMAL" => true,
- "MYSQLI_TYPE_TINY" => true,
- "MYSQLI_TYPE_SHORT" => true,
- "MYSQLI_TYPE_LONG" => true,
- "MYSQLI_TYPE_FLOAT" => true,
- "MYSQLI_TYPE_DOUBLE" => true,
- "MYSQLI_TYPE_NULL" => true,
- "MYSQLI_TYPE_TIMESTAMP" => true,
- "MYSQLI_TYPE_LONGLONG" => true,
- "MYSQLI_TYPE_INT24" => true,
- "MYSQLI_TYPE_DATE" => true,
- "MYSQLI_TYPE_TIME" => true,
- "MYSQLI_TYPE_DATETIME" => true,
- "MYSQLI_TYPE_YEAR" => true,
- "MYSQLI_TYPE_NEWDATE" => true,
- "MYSQLI_TYPE_ENUM" => true,
- "MYSQLI_TYPE_SET" => true,
- "MYSQLI_TYPE_TINY_BLOB" => true,
- "MYSQLI_TYPE_MEDIUM_BLOB" => true,
- "MYSQLI_TYPE_LONG_BLOB" => true,
- "MYSQLI_TYPE_BLOB" => true,
- "MYSQLI_TYPE_VAR_STRING" => true,
- "MYSQLI_TYPE_STRING" => true,
- "MYSQLI_TYPE_CHAR" => true,
- "MYSQLI_TYPE_INTERVAL" => true,
- "MYSQLI_TYPE_GEOMETRY" => true,
- "MYSQLI_NO_DATA" => true,
- "MYSQLI_REPORT_INDEX" => true,
- "MYSQLI_REPORT_STRICT" => true,
- "MYSQLI_REPORT_ALL" => true,
- "MYSQLI_REPORT_ERROR" => true,
- "MYSQLI_REPORT_OFF" => true,
- "MYSQLI_SET_CHARSET_NAME" => true,
- "MYSQLI_SET_CHARSET_DIR" => true,
- "MYSQLI_REFRESH_GRANT" => true,
- "MYSQLI_REFRESH_LOG" => true,
- "MYSQLI_REFRESH_TABLES" => true,
- "MYSQLI_REFRESH_HOSTS" => true,
- "MYSQLI_REFRESH_STATUS" => true,
- "MYSQLI_REFRESH_THREADS" => true,
- "MYSQLI_REFRESH_SLAVE" => true,
- "MYSQLI_REFRESH_MASTER" => true,
- "MYSQLI_DEBUG_TRACE_ENABLED" => true,
- "MYSQLI_TRANS_START_WITH_CONSISTENT_SNAPSHOT" => true,
- "MYSQLI_TRANS_START_READ_WRITE" => true,
- "MYSQLI_TRANS_START_READ_ONLY" => true,
- "MYSQLI_TRANS_COR_AND_CHAIN" => true,
- "MYSQLI_TRANS_COR_AND_NO_CHAIN" => true,
- "MYSQLI_TRANS_COR_RELEASE" => true,
- "MYSQLI_TRANS_COR_NO_RELEASE" => true,
- );
-
- /* depends on the build - experimental */
- if ($IS_MYSQLND && defined('MYSQLI_OPT_INT_AND_FLOAT_NATIVE')) {
- $expected_constants['MYSQLI_OPT_INT_AND_FLOAT_NATIVE'] = true;
- }
-
- if ($IS_MYSQLND && defined('MYSQLI_STORE_RESULT_COPY_DATA')) {
- $expected_constants['MYSQLI_STORE_RESULT_COPY_DATA'] = true;
- }
-
- if ($IS_MYSQLND || defined('MYSQLI_REFRESH_BACKUP_LOG')) {
- $expected_constants['MYSQLI_REFRESH_BACKUP_LOG'] = true;
- }
-
- if ($IS_MYSQLND) {
- $version = 50007 + 1;
- $expected_constants['MYSQLI_OPT_NET_CMD_BUFFER_SIZE'] = true;
- $expected_constants['MYSQLI_OPT_NET_READ_BUFFER_SIZE'] = true;
- $expected_constants['MYSQLI_ASYNC'] = true;
-
- $expected_constants['MYSQLI_SERVER_PS_OUT_PARAMS'] = true;
- } else {
- $version = mysqli_get_client_version();
- }
-
- if (($version > 51122 && $version < 60000) || ($version > 60003) || $IS_MYSQLND) {
- $expected_constants['MYSQLI_ON_UPDATE_NOW_FLAG'] = true;
- }
-
- /* First introduced in MySQL 6.0, backported to MySQL 5.5 */
- if ($version >= 50500 || $IS_MYSQLND) {
- $expected_constants['MYSQLI_SERVER_QUERY_WAS_SLOW'] = true;
- }
-
- if ($version >= 50033 || $IS_MYSQLND) {
- $expected_constants['MYSQLI_CLIENT_SSL_VERIFY_SERVER_CERT'] = true;
- }
- if ($IS_MYSQLND) {
- $expected_constants['MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT'] = true;
- }
-
- /* First introduced in MySQL 6.0, backported to MySQL 5.5 */
- if ($version >= 50606 || $IS_MYSQLND) {
- $expected_constants['MYSQLI_SERVER_PUBLIC_KEY'] = true;
- }
-
- if ($version > 50002) {
- $expected_constants = array_merge($expected_constants, array(
- "MYSQLI_TYPE_NEWDECIMAL" => true,
- "MYSQLI_TYPE_BIT" => true,
- ));
- }
-
- if ($version > 50002 || $IS_MYSQLND) {
- $expected_constants['MYSQLI_NO_DEFAULT_VALUE_FLAG'] = true;
- }
-
- if ($version > 50003) {
- $expected_constants = array_merge($expected_constants, array(
- "MYSQLI_STMT_ATTR_CURSOR_TYPE" => true,
- "MYSQLI_CURSOR_TYPE_NO_CURSOR" => true,
- "MYSQLI_CURSOR_TYPE_READ_ONLY" => true,
- "MYSQLI_CURSOR_TYPE_FOR_UPDATE" => true,
- "MYSQLI_CURSOR_TYPE_SCROLLABLE" => true,
- ));
- }
-
- if ($version > 50007) {
- $expected_constants = array_merge($expected_constants, array(
- "MYSQLI_STMT_ATTR_PREFETCH_ROWS" => true,
- ));
- }
-
- if ($version > 50110 || $IS_MYSQLND) {
- $expected_constants['MYSQLI_OPT_SSL_VERIFY_SERVER_CERT'] = true;
- }
-
- /* pretty dump test, but that is the best way to mimic mysql.c */
- if (defined('MYSQLI_DATA_TRUNCATED'))
- $expected_constants["MYSQLI_DATA_TRUNCATED"] = true;
-
- if (defined('MYSQLI_SERVER_PS_OUT_PARAMS'))
- $expected_constants["MYSQLI_SERVER_PS_OUT_PARAMS"] = true;
-
- if (!$IS_MYSQLND) {
- /* libmysql only */
-
- /* are they available in all versions of ext/mysqli ?
- ... no we must have removed them at some point - for BC, weakening the test
- */
- if (defined("MYSQLI_RPL_MASTER")) {
- $expected_constants["MYSQLI_RPL_MASTER"] = true;
- $expected_constants["MYSQLI_RPL_SLAVE"] = true;
- $expected_constants["MYSQLI_RPL_ADMIN"] = true;
- }
- }
-
- if ($IS_MYSQLND || (!$IS_MYSQLND && ($version > 50610))) {
- /* could be that MySQL/libmysql 5.6.9 had the flag already but it was no stable release */
- $expected_constants["MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS"] = true;
- $expected_constants["MYSQLI_CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS"] = true;
- }
-
- if ($IS_MYSQLND) {
- $expected_constants["MYSQLI_TYPE_JSON"] = true;
- }
-
- $unexpected_constants = array();
-
- foreach ($constants as $group => $consts) {
- foreach ($consts as $name => $value) {
- if (stristr($name, 'mysqli')) {
- $name = strtoupper($name);
- if (isset($expected_constants[$name])) {
- unset($expected_constants[$name]);
- } else {
- $unexpected_constants[$name] = $name;
- }
- }
- }
- }
-
- if (!empty($unexpected_constants)) {
- printf("Dumping list of unexpected constants\n");
- var_dump($unexpected_constants);
- }
-
- if (!empty($expected_constants)) {
- printf("Dumping list of missing constants\n");
- var_dump($expected_constants);
- }
-
- print "done!";
+ require("connect.inc");
+ require("table.inc");
+
+ $php_version = (int)str_replace('.', '', PHP_VERSION);
+ $constants = get_defined_constants(true);
+ sort($constants);
+
+ $expected_constants = array(
+ 'MYSQLI_READ_DEFAULT_GROUP' => true,
+ 'MYSQLI_READ_DEFAULT_FILE' => true,
+ 'MYSQLI_OPT_CONNECT_TIMEOUT' => true,
+ 'MYSQLI_OPT_LOCAL_INFILE' => true,
+ 'MYSQLI_OPT_READ_TIMEOUT' => true,
+ 'MYSQLI_INIT_COMMAND' => true,
+ 'MYSQLI_CLIENT_SSL' => true,
+ "MYSQLI_CLIENT_COMPRESS" => true,
+ "MYSQLI_CLIENT_INTERACTIVE" => true,
+ "MYSQLI_CLIENT_IGNORE_SPACE" => true,
+ "MYSQLI_CLIENT_NO_SCHEMA" => true,
+ "MYSQLI_CLIENT_FOUND_ROWS" => true,
+ "MYSQLI_STORE_RESULT" => true,
+ "MYSQLI_USE_RESULT" => true,
+ "MYSQLI_ASSOC" => true,
+ "MYSQLI_NUM" => true,
+ "MYSQLI_BOTH" => true,
+ "MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH"=> true,
+ "MYSQLI_NOT_NULL_FLAG" => true,
+ "MYSQLI_PRI_KEY_FLAG" => true,
+ "MYSQLI_UNIQUE_KEY_FLAG" => true,
+ "MYSQLI_MULTIPLE_KEY_FLAG" => true,
+ "MYSQLI_BLOB_FLAG" => true,
+ "MYSQLI_UNSIGNED_FLAG" => true,
+ "MYSQLI_ZEROFILL_FLAG" => true,
+ "MYSQLI_AUTO_INCREMENT_FLAG" => true,
+ "MYSQLI_TIMESTAMP_FLAG" => true,
+ "MYSQLI_SET_FLAG" => true,
+ "MYSQLI_NUM_FLAG" => true,
+ "MYSQLI_ENUM_FLAG" => true,
+ "MYSQLI_BINARY_FLAG" => true,
+ "MYSQLI_PART_KEY_FLAG" => true,
+ "MYSQLI_GROUP_FLAG" => true,
+ "MYSQLI_SERVER_QUERY_NO_GOOD_INDEX_USED"=> true,
+ "MYSQLI_SERVER_QUERY_NO_INDEX_USED" => true,
+
+ "MYSQLI_TYPE_DECIMAL" => true,
+ "MYSQLI_TYPE_TINY" => true,
+ "MYSQLI_TYPE_SHORT" => true,
+ "MYSQLI_TYPE_LONG" => true,
+ "MYSQLI_TYPE_FLOAT" => true,
+ "MYSQLI_TYPE_DOUBLE" => true,
+ "MYSQLI_TYPE_NULL" => true,
+ "MYSQLI_TYPE_TIMESTAMP" => true,
+ "MYSQLI_TYPE_LONGLONG" => true,
+ "MYSQLI_TYPE_INT24" => true,
+ "MYSQLI_TYPE_DATE" => true,
+ "MYSQLI_TYPE_TIME" => true,
+ "MYSQLI_TYPE_DATETIME" => true,
+ "MYSQLI_TYPE_YEAR" => true,
+ "MYSQLI_TYPE_NEWDATE" => true,
+ "MYSQLI_TYPE_ENUM" => true,
+ "MYSQLI_TYPE_SET" => true,
+ "MYSQLI_TYPE_TINY_BLOB" => true,
+ "MYSQLI_TYPE_MEDIUM_BLOB" => true,
+ "MYSQLI_TYPE_LONG_BLOB" => true,
+ "MYSQLI_TYPE_BLOB" => true,
+ "MYSQLI_TYPE_VAR_STRING" => true,
+ "MYSQLI_TYPE_STRING" => true,
+ "MYSQLI_TYPE_CHAR" => true,
+ "MYSQLI_TYPE_INTERVAL" => true,
+ "MYSQLI_TYPE_GEOMETRY" => true,
+ "MYSQLI_NO_DATA" => true,
+ "MYSQLI_REPORT_INDEX" => true,
+ "MYSQLI_REPORT_STRICT" => true,
+ "MYSQLI_REPORT_ALL" => true,
+ "MYSQLI_REPORT_ERROR" => true,
+ "MYSQLI_REPORT_OFF" => true,
+ "MYSQLI_SET_CHARSET_NAME" => true,
+ "MYSQLI_SET_CHARSET_DIR" => true,
+ "MYSQLI_REFRESH_GRANT" => true,
+ "MYSQLI_REFRESH_LOG" => true,
+ "MYSQLI_REFRESH_TABLES" => true,
+ "MYSQLI_REFRESH_HOSTS" => true,
+ "MYSQLI_REFRESH_STATUS" => true,
+ "MYSQLI_REFRESH_THREADS" => true,
+ "MYSQLI_REFRESH_SLAVE" => true,
+ "MYSQLI_REFRESH_MASTER" => true,
+ "MYSQLI_DEBUG_TRACE_ENABLED" => true,
+ "MYSQLI_TRANS_START_WITH_CONSISTENT_SNAPSHOT" => true,
+ "MYSQLI_TRANS_START_READ_WRITE" => true,
+ "MYSQLI_TRANS_START_READ_ONLY" => true,
+ "MYSQLI_TRANS_COR_AND_CHAIN" => true,
+ "MYSQLI_TRANS_COR_AND_NO_CHAIN" => true,
+ "MYSQLI_TRANS_COR_RELEASE" => true,
+ "MYSQLI_TRANS_COR_NO_RELEASE" => true,
+ );
+
+ /* depends on the build - experimental */
+ if ($IS_MYSQLND && defined('MYSQLI_OPT_INT_AND_FLOAT_NATIVE')) {
+ $expected_constants['MYSQLI_OPT_INT_AND_FLOAT_NATIVE'] = true;
+ }
+
+ if ($IS_MYSQLND && defined('MYSQLI_STORE_RESULT_COPY_DATA')) {
+ $expected_constants['MYSQLI_STORE_RESULT_COPY_DATA'] = true;
+ }
+
+ if ($IS_MYSQLND || defined('MYSQLI_REFRESH_BACKUP_LOG')) {
+ $expected_constants['MYSQLI_REFRESH_BACKUP_LOG'] = true;
+ }
+
+ if ($IS_MYSQLND) {
+ $version = 50007 + 1;
+ $expected_constants['MYSQLI_OPT_NET_CMD_BUFFER_SIZE'] = true;
+ $expected_constants['MYSQLI_OPT_NET_READ_BUFFER_SIZE'] = true;
+ $expected_constants['MYSQLI_ASYNC'] = true;
+
+ $expected_constants['MYSQLI_SERVER_PS_OUT_PARAMS'] = true;
+ } else {
+ $version = mysqli_get_client_version();
+ }
+
+ if (($version > 51122 && $version < 60000) || ($version > 60003) || $IS_MYSQLND) {
+ $expected_constants['MYSQLI_ON_UPDATE_NOW_FLAG'] = true;
+ }
+
+ /* First introduced in MySQL 6.0, backported to MySQL 5.5 */
+ if ($version >= 50500 || $IS_MYSQLND) {
+ $expected_constants['MYSQLI_SERVER_QUERY_WAS_SLOW'] = true;
+ }
+
+ if ($version >= 50033 || $IS_MYSQLND) {
+ $expected_constants['MYSQLI_CLIENT_SSL_VERIFY_SERVER_CERT'] = true;
+ }
+ if ($IS_MYSQLND) {
+ $expected_constants['MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT'] = true;
+ }
+
+ /* First introduced in MySQL 6.0, backported to MySQL 5.5 */
+ if ($version >= 50606 || $IS_MYSQLND) {
+ $expected_constants['MYSQLI_SERVER_PUBLIC_KEY'] = true;
+ }
+
+ if ($version > 50002) {
+ $expected_constants = array_merge($expected_constants, array(
+ "MYSQLI_TYPE_NEWDECIMAL" => true,
+ "MYSQLI_TYPE_BIT" => true,
+ ));
+ }
+
+ if ($version > 50002 || $IS_MYSQLND) {
+ $expected_constants['MYSQLI_NO_DEFAULT_VALUE_FLAG'] = true;
+ }
+
+ if ($version > 50003) {
+ $expected_constants = array_merge($expected_constants, array(
+ "MYSQLI_STMT_ATTR_CURSOR_TYPE" => true,
+ "MYSQLI_CURSOR_TYPE_NO_CURSOR" => true,
+ "MYSQLI_CURSOR_TYPE_READ_ONLY" => true,
+ "MYSQLI_CURSOR_TYPE_FOR_UPDATE" => true,
+ "MYSQLI_CURSOR_TYPE_SCROLLABLE" => true,
+ ));
+ }
+
+ if ($version > 50007) {
+ $expected_constants = array_merge($expected_constants, array(
+ "MYSQLI_STMT_ATTR_PREFETCH_ROWS" => true,
+ ));
+ }
+
+ if ($version > 50110 || $IS_MYSQLND) {
+ $expected_constants['MYSQLI_OPT_SSL_VERIFY_SERVER_CERT'] = true;
+ }
+
+ /* pretty dump test, but that is the best way to mimic mysql.c */
+ if (defined('MYSQLI_DATA_TRUNCATED'))
+ $expected_constants["MYSQLI_DATA_TRUNCATED"] = true;
+
+ if (defined('MYSQLI_SERVER_PS_OUT_PARAMS'))
+ $expected_constants["MYSQLI_SERVER_PS_OUT_PARAMS"] = true;
+
+ if (!$IS_MYSQLND) {
+ /* libmysql only */
+
+ /* are they available in all versions of ext/mysqli ?
+ ... no we must have removed them at some point - for BC, weakening the test
+ */
+ if (defined("MYSQLI_RPL_MASTER")) {
+ $expected_constants["MYSQLI_RPL_MASTER"] = true;
+ $expected_constants["MYSQLI_RPL_SLAVE"] = true;
+ $expected_constants["MYSQLI_RPL_ADMIN"] = true;
+ }
+ }
+
+ if ($IS_MYSQLND || (!$IS_MYSQLND && ($version > 50610))) {
+ /* could be that MySQL/libmysql 5.6.9 had the flag already but it was no stable release */
+ $expected_constants["MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS"] = true;
+ $expected_constants["MYSQLI_CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS"] = true;
+ }
+
+ if ($IS_MYSQLND) {
+ $expected_constants["MYSQLI_TYPE_JSON"] = true;
+ }
+
+ $unexpected_constants = array();
+
+ foreach ($constants as $group => $consts) {
+ foreach ($consts as $name => $value) {
+ if (stristr($name, 'mysqli')) {
+ $name = strtoupper($name);
+ if (isset($expected_constants[$name])) {
+ unset($expected_constants[$name]);
+ } else {
+ $unexpected_constants[$name] = $name;
+ }
+ }
+ }
+ }
+
+ if (!empty($unexpected_constants)) {
+ printf("Dumping list of unexpected constants\n");
+ var_dump($unexpected_constants);
+ }
+
+ if (!empty($expected_constants)) {
+ printf("Dumping list of missing constants\n");
+ var_dump($expected_constants);
+ }
+
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_constants_categories.phpt b/ext/mysqli/tests/mysqli_constants_categories.phpt
index 6a90e3d3f0..d02463e20a 100644
--- a/ext/mysqli/tests/mysqli_constants_categories.phpt
+++ b/ext/mysqli/tests/mysqli_constants_categories.phpt
@@ -7,18 +7,18 @@ require_once('skipifemb.inc');
?>
--FILE--
<?php
- $constants = get_defined_constants(true);
+ $constants = get_defined_constants(true);
- foreach ($constants as $group => $consts) {
- foreach ($consts as $name => $value) {
- if (stristr($name, 'mysqli')) {
- if ('mysqli' != $group)
- printf("found constant '%s' in group '%s'. expecting group 'mysqli'\n", $name, $group);
- }
- }
- }
+ foreach ($constants as $group => $consts) {
+ foreach ($consts as $name => $value) {
+ if (stristr($name, 'mysqli')) {
+ if ('mysqli' != $group)
+ printf("found constant '%s' in group '%s'. expecting group 'mysqli'\n", $name, $group);
+ }
+ }
+ }
- print "done!";
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_data_seek.phpt b/ext/mysqli/tests/mysqli_data_seek.phpt
index 9bc3b12f73..53c8b8354d 100644
--- a/ext/mysqli/tests/mysqli_data_seek.phpt
+++ b/ext/mysqli/tests/mysqli_data_seek.phpt
@@ -8,60 +8,51 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ require('table.inc');
+ if (!$res = mysqli_query($link, 'SELECT * FROM test ORDER BY id LIMIT 4', MYSQLI_STORE_RESULT))
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (NULL !== ($tmp = @mysqli_data_seek()))
- printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_data_seek($res, 3)))
+ printf("[005] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (NULL !== ($tmp = @mysqli_data_seek($link)))
- printf("[002] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
+ $row = mysqli_fetch_assoc($res);
+ if (4 != $row['id'])
+ printf("[006] Expecting record 4/d, got record %s/%s\n", $row['id'], $row['label']);
- if (NULL !== ($tmp = @mysqli_data_seek($link, $link)))
- printf("[003] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_data_seek($res, 0)))
+ printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
- if (!$res = mysqli_query($link, 'SELECT * FROM test ORDER BY id LIMIT 4', MYSQLI_STORE_RESULT))
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $row = mysqli_fetch_assoc($res);
+ if (1 != $row['id'])
+ printf("[008] Expecting record 1/a, got record %s/%s\n", $row['id'], $row['label']);
- if (true !== ($tmp = mysqli_data_seek($res, 3)))
- printf("[005] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_data_seek($res, 4)))
+ printf("[009] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- $row = mysqli_fetch_assoc($res);
- if (4 != $row['id'])
- printf("[006] Expecting record 4/d, got record %s/%s\n", $row['id'], $row['label']);
+ if (false !== ($tmp = mysqli_data_seek($res, -1)))
+ printf("[010] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- if (true !== ($tmp = mysqli_data_seek($res, 0)))
- printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ mysqli_free_result($res);
- $row = mysqli_fetch_assoc($res);
- if (1 != $row['id'])
- printf("[008] Expecting record 1/a, got record %s/%s\n", $row['id'], $row['label']);
+ if (!$res = mysqli_query($link, 'SELECT * FROM test ORDER BY id', MYSQLI_USE_RESULT))
+ printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (false !== ($tmp = mysqli_data_seek($res, 4)))
- printf("[009] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_data_seek($res, 3)))
+ printf("[012] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- if (false !== ($tmp = mysqli_data_seek($res, -1)))
- printf("[010] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ mysqli_free_result($res);
- mysqli_free_result($res);
+ try {
+ mysqli_data_seek($res, 1);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- if (!$res = mysqli_query($link, 'SELECT * FROM test ORDER BY id', MYSQLI_USE_RESULT))
- printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_close($link);
- if (false !== ($tmp = mysqli_data_seek($res, 3)))
- printf("[012] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_free_result($res);
-
- if (false !== ($tmp = mysqli_data_seek($res, 1)))
- printf("[013] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_close($link);
-
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
@@ -69,6 +60,5 @@ require_once('skipifconnectfailure.inc');
?>
--EXPECTF--
Warning: mysqli_data_seek(): Function cannot be used with MYSQL_USE_RESULT in %s on line %d
-
-Warning: mysqli_data_seek(): Couldn't fetch mysqli_result in %s on line %d
+mysqli_result object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_data_seek_oo.phpt b/ext/mysqli/tests/mysqli_data_seek_oo.phpt
index 7fb14f0956..0d1ee8b79f 100644
--- a/ext/mysqli/tests/mysqli_data_seek_oo.phpt
+++ b/ext/mysqli/tests/mysqli_data_seek_oo.phpt
@@ -8,76 +8,70 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
+ require('table.inc');
- $tmp = NULL;
- $link = NULL;
+ if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- require('table.inc');
+ $res = new mysqli_result($mysqli);
- if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ try {
+ $res->data_seek(0);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- $res = new mysqli_result($mysqli);
- if (false !== ($tmp = @$res->data_seek(0)))
- printf("[002] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (!$res = $mysqli->query('SELECT * FROM test ORDER BY id LIMIT 4', MYSQLI_STORE_RESULT))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$res = $mysqli->query('SELECT * FROM test ORDER BY id LIMIT 4', MYSQLI_STORE_RESULT))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (true !== ($tmp = $res->data_seek(3)))
+ printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (NULL !== ($tmp = @$res->data_seek()))
- printf("[004] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
+ $row = $res->fetch_assoc();
+ if (4 != $row['id'])
+ printf("[008] Expecting record 4/d, got record %s/%s\n", $row['id'], $row['label']);
- if (NULL !== ($tmp = @$res->data_seek($link)))
- printf("[005] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = $res->data_seek(0)))
+ printf("[009] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (NULL !== ($tmp = @$res->data_seek($link, $link)))
- printf("[006] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
+ $row = $res->fetch_assoc();
+ if (1 != $row['id'])
+ printf("[010] Expecting record 1/a, got record %s/%s\n", $row['id'], $row['label']);
- if (true !== ($tmp = $res->data_seek(3)))
- printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = $res->data_seek(4)))
+ printf("[011] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- $row = $res->fetch_assoc();
- if (4 != $row['id'])
- printf("[008] Expecting record 4/d, got record %s/%s\n", $row['id'], $row['label']);
+ if (false !== ($tmp = $res->data_seek(-1)))
+ printf("[012] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- if (true !== ($tmp = $res->data_seek(0)))
- printf("[009] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ $res->free_result();
- $row = $res->fetch_assoc();
- if (1 != $row['id'])
- printf("[010] Expecting record 1/a, got record %s/%s\n", $row['id'], $row['label']);
+ if (!$res = $mysqli->query('SELECT * FROM test ORDER BY id', MYSQLI_USE_RESULT))
+ printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (false !== ($tmp = $res->data_seek(4)))
- printf("[011] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = $res->data_seek(3)))
+ printf("[014] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- if (false !== ($tmp = $res->data_seek(-1)))
- printf("[012] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ $res->free_result();
- $res->free_result();
+ try {
+ $res->data_seek(1);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- if (!$res = $mysqli->query('SELECT * FROM test ORDER BY id', MYSQLI_USE_RESULT))
- printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $mysqli->close();
- if (false !== ($tmp = $res->data_seek(3)))
- printf("[014] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- $res->free_result();
-
- if (false !== ($tmp = $res->data_seek(1)))
- printf("[015] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- $mysqli->close();
-
- print "done!";
-?>
+ print "done!";
--CLEAN--
<?php
require_once("clean_table.inc");
?>
--EXPECTF--
-Warning: mysqli_result::data_seek(): Function cannot be used with MYSQL_USE_RESULT in %s on line %d
+mysqli_result object is already closed
-Warning: mysqli_result::data_seek(): Couldn't fetch mysqli_result in %s on line %d
+Warning: mysqli_result::data_seek(): Function cannot be used with MYSQL_USE_RESULT in %s on line %d
+mysqli_result object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_debug.phpt b/ext/mysqli/tests/mysqli_debug.phpt
index aa455d7f6e..c701d765c2 100644
--- a/ext/mysqli/tests/mysqli_debug.phpt
+++ b/ext/mysqli/tests/mysqli_debug.phpt
@@ -17,49 +17,46 @@ if (defined('MYSQLI_DEBUG_TRACE_ENABLED') && !MYSQLI_DEBUG_TRACE_ENABLED)
?>
--FILE--
<?php
- require_once('connect.inc');
+ require_once('connect.inc');
- if (NULL !== ($tmp = @mysqli_debug()))
- printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
+ // NOTE: documentation is not clear on this: function always return NULL or TRUE
+ if (true !== ($tmp = mysqli_debug(sprintf('d:t:O,%s/mysqli_debug_phpt.trace', sys_get_temp_dir()))))
+ printf("[002] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- // NOTE: documentation is not clear on this: function always return NULL or TRUE
- if (true !== ($tmp = mysqli_debug(sprintf('d:t:O,%s/mysqli_debug_phpt.trace', sys_get_temp_dir()))))
- printf("[002] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ if ($IS_MYSQLND) {
+ // let's make this mysqlnd only - for libmysql we need debug installation
- if ($IS_MYSQLND) {
- // let's make this mysqlnd only - for libmysql we need debug installation
+ // table.inc will create a database connection and run some SQL queries, therefore
+ // the debug file should have entries
+ require_once('table.inc');
- // table.inc will create a database connection and run some SQL queries, therefore
- // the debug file should have entries
- require_once('table.inc');
+ clearstatcache();
+ $trace_file = sprintf('%s/mysqli_debug_phpt.trace', sys_get_temp_dir());
+ if (!file_exists($trace_file))
+ printf("[003] Trace file '%s' has not been created\n", $trace_file);
+ if (filesize($trace_file) < 50)
+ printf("[004] Trace file '%s' is very small. filesize() reports only %d bytes. Please check.\n",
+ $trace_file,
+ filesize($trace_file));
- clearstatcache();
- $trace_file = sprintf('%s/mysqli_debug_phpt.trace', sys_get_temp_dir());
- if (!file_exists($trace_file))
- printf("[003] Trace file '%s' has not been created\n", $trace_file);
- if (filesize($trace_file) < 50)
- printf("[004] Trace file '%s' is very small. filesize() reports only %d bytes. Please check.\n",
- $trace_file,
- filesize($trace_file));
+ // will mysqli_debug() mind if the trace file gets removed?
+ unlink($trace_file);
+ clearstatcache();
- // will mysqli_debug() mind if the trace file gets removed?
- unlink($trace_file);
- clearstatcache();
+ if (!$res = mysqli_query($link, 'SELECT * FROM test'))
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ else
+ mysqli_free_result($res);
- if (!$res = mysqli_query($link, 'SELECT * FROM test'))
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- else
- mysqli_free_result($res);
+ mysqli_close($link);
- mysqli_close($link);
+ clearstatcache();
+ if (!file_exists($trace_file))
+ printf("[006] Trace file '%s' does not exist\n", $trace_file);
+ unlink($trace_file);
+ }
- clearstatcache();
- if (!file_exists($trace_file))
- printf("[006] Trace file '%s' does not exist\n", $trace_file);
- unlink($trace_file);
- }
-
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_debug_append.phpt b/ext/mysqli/tests/mysqli_debug_append.phpt
index 8c934eabac..e75639e89d 100644
--- a/ext/mysqli/tests/mysqli_debug_append.phpt
+++ b/ext/mysqli/tests/mysqli_debug_append.phpt
@@ -22,70 +22,70 @@ if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test is not for Windows platfo
?>
--FILE--
<?php
- require_once('connect.inc');
-
- if (true !== ($tmp = mysqli_debug(sprintf('d:t:O,%s/mysqli_debug_phpt.trace', sys_get_temp_dir()))))
- printf("[001] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- // table.inc will create a database connection and run some SQL queries, therefore
- // the debug file should have entries
- require_once('table.inc');
-
- clearstatcache();
- $trace_file = sprintf('%s/mysqli_debug_phpt.trace', sys_get_temp_dir());
- if (!file_exists($trace_file))
- printf("[002] Trace file '%s' has not been created\n", $trace_file);
- if (filesize($trace_file) < 50)
- printf("[003] Trace file '%s' is very small. filesize() reports only %d bytes. Please check.\n",
- $trace_file,
- filesize($trace_file));
-
- // will mysqli_debug() mind if the trace file gets removed?
- unlink($trace_file);
- clearstatcache();
-
- if (!$fp = fopen($trace_file, 'w')) {
- printf("[004] Cannot create trace file to test append mode\n");
- } else {
-
- if (!fwrite($fp, 'mysqli_debug.phpt test line'))
- printf("[005] Cannot write to trace file.\n");
- fclose($fp);
-
- if (true !== ($tmp = mysqli_debug(sprintf('d:a,%s', $trace_file))))
- printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!$res = mysqli_query($link, 'SELECT * FROM test'))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- else
- mysqli_free_result($res);
-
- $trace = file_get_contents($trace_file);
- if (!strstr($trace, 'mysqli_debug.phpt test line'))
- printf("[008] Cannot find original file content any more. Seems that the trace file got overwritten and not appended. Please check.");
-
- if (true !== ($tmp = mysqli_debug(sprintf('d:A,%s', $trace_file))))
- printf("[009] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!$res = mysqli_query($link, 'SELECT * FROM test'))
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- else
- mysqli_free_result($res);
-
- if (!strstr(file_get_contents($trace_file), $trace))
- printf("[011] Cannot find original file content any more. Seems that the trace file got overwritten and not appended. Please check.");
- }
-
- // what will happen if we create new trace entries...?
- unlink($trace_file);
- clearstatcache();
- if (file_exists($trace_file))
- printf("[012] Could not remove trace file '%s'.\n", $trace_file);
-
- mysqli_close($link);
- print "done";
- if ($IS_MYSQLND)
- print "libmysql/DBUG package prints some debug info here."
+ require_once('connect.inc');
+
+ if (true !== ($tmp = mysqli_debug(sprintf('d:t:O,%s/mysqli_debug_phpt.trace', sys_get_temp_dir()))))
+ printf("[001] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ // table.inc will create a database connection and run some SQL queries, therefore
+ // the debug file should have entries
+ require_once('table.inc');
+
+ clearstatcache();
+ $trace_file = sprintf('%s/mysqli_debug_phpt.trace', sys_get_temp_dir());
+ if (!file_exists($trace_file))
+ printf("[002] Trace file '%s' has not been created\n", $trace_file);
+ if (filesize($trace_file) < 50)
+ printf("[003] Trace file '%s' is very small. filesize() reports only %d bytes. Please check.\n",
+ $trace_file,
+ filesize($trace_file));
+
+ // will mysqli_debug() mind if the trace file gets removed?
+ unlink($trace_file);
+ clearstatcache();
+
+ if (!$fp = fopen($trace_file, 'w')) {
+ printf("[004] Cannot create trace file to test append mode\n");
+ } else {
+
+ if (!fwrite($fp, 'mysqli_debug.phpt test line'))
+ printf("[005] Cannot write to trace file.\n");
+ fclose($fp);
+
+ if (true !== ($tmp = mysqli_debug(sprintf('d:a,%s', $trace_file))))
+ printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!$res = mysqli_query($link, 'SELECT * FROM test'))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ else
+ mysqli_free_result($res);
+
+ $trace = file_get_contents($trace_file);
+ if (!strstr($trace, 'mysqli_debug.phpt test line'))
+ printf("[008] Cannot find original file content any more. Seems that the trace file got overwritten and not appended. Please check.");
+
+ if (true !== ($tmp = mysqli_debug(sprintf('d:A,%s', $trace_file))))
+ printf("[009] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!$res = mysqli_query($link, 'SELECT * FROM test'))
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ else
+ mysqli_free_result($res);
+
+ if (!strstr(file_get_contents($trace_file), $trace))
+ printf("[011] Cannot find original file content any more. Seems that the trace file got overwritten and not appended. Please check.");
+ }
+
+ // what will happen if we create new trace entries...?
+ unlink($trace_file);
+ clearstatcache();
+ if (file_exists($trace_file))
+ printf("[012] Could not remove trace file '%s'.\n", $trace_file);
+
+ mysqli_close($link);
+ print "done";
+ if ($IS_MYSQLND)
+ print "libmysql/DBUG package prints some debug info here."
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_debug_control_string.phpt b/ext/mysqli/tests/mysqli_debug_control_string.phpt
index 42a802d81a..00994abd03 100644
--- a/ext/mysqli/tests/mysqli_debug_control_string.phpt
+++ b/ext/mysqli/tests/mysqli_debug_control_string.phpt
@@ -20,57 +20,57 @@ if (!$IS_MYSQLND)
?>
--FILE--
<?php
- require_once('connect.inc');
- require_once('table.inc');
+ require_once('connect.inc');
+ require_once('table.inc');
- function try_control_string($link, $control_string, $trace_file, $offset) {
+ function try_control_string($link, $control_string, $trace_file, $offset) {
- if (true !== ($tmp = mysqli_debug($control_string))) {
- printf("[%03d][control string '%s'] Expecting boolean/true, got %s/%s.\n",
- $offset + 1,
- $control_string,
- gettype($tmp),
- $tmp);
- return false;
- }
+ if (true !== ($tmp = mysqli_debug($control_string))) {
+ printf("[%03d][control string '%s'] Expecting boolean/true, got %s/%s.\n",
+ $offset + 1,
+ $control_string,
+ gettype($tmp),
+ $tmp);
+ return false;
+ }
- if (!$res = mysqli_query($link, 'SELECT * FROM test')) {
- printf("[%03d][control string '%s'] [%d] %s.\n",
- $offset + 2,
- $control_string,
- mysqli_errno($link),
- mysqli_error($link));
- return false;
- }
+ if (!$res = mysqli_query($link, 'SELECT * FROM test')) {
+ printf("[%03d][control string '%s'] [%d] %s.\n",
+ $offset + 2,
+ $control_string,
+ mysqli_errno($link),
+ mysqli_error($link));
+ return false;
+ }
- clearstatcache();
- if (!file_exists($trace_file)) {
- printf("[%03d][control string '%s'] Trace file has not been written.\n",
- $offset + 3,
- $control_string,
- gettype($tmp),
- $tmp);
- return false;
- }
+ clearstatcache();
+ if (!file_exists($trace_file)) {
+ printf("[%03d][control string '%s'] Trace file has not been written.\n",
+ $offset + 3,
+ $control_string,
+ gettype($tmp),
+ $tmp);
+ return false;
+ }
- unlink($trace_file);
- }
+ unlink($trace_file);
+ }
- $trace_file = sprintf('%s%s%s', sys_get_temp_dir(), DIRECTORY_SEPARATOR, 'mysqli_debug_phpt.trace');
- try_control_string($link, 't:,,:o,' . $trace_file, $trace_file, 10);
- try_control_string($link, ':' . chr(0) . 'A,' . $trace_file, $trace_file, 20);
- try_control_string($link, 't:o,' . $trace_file . ':abc', $trace_file, 30);
- try_control_string($link, 't:o,' . $trace_file . ':ABC,123:b', $trace_file, 40);
- try_control_string($link, 't:ABC,123:b;:o,' . $trace_file, $trace_file, 50);
- try_control_string($link, 't:A;BC,123:b;:o,' . $trace_file, $trace_file, 60);
- try_control_string($link, 't:p:o,' . $trace_file, $trace_file, 70);
- try_control_string($link, 't:p,1,,2:o,' . $trace_file, $trace_file, 80);
- try_control_string($link, 't:z,1,,2:o,' . $trace_file, $trace_file, 90);#
+ $trace_file = sprintf('%s%s%s', sys_get_temp_dir(), DIRECTORY_SEPARATOR, 'mysqli_debug_phpt.trace');
+ try_control_string($link, 't:,,:o,' . $trace_file, $trace_file, 10);
+ try_control_string($link, ':' . chr(0) . 'A,' . $trace_file, $trace_file, 20);
+ try_control_string($link, 't:o,' . $trace_file . ':abc', $trace_file, 30);
+ try_control_string($link, 't:o,' . $trace_file . ':ABC,123:b', $trace_file, 40);
+ try_control_string($link, 't:ABC,123:b;:o,' . $trace_file, $trace_file, 50);
+ try_control_string($link, 't:A;BC,123:b;:o,' . $trace_file, $trace_file, 60);
+ try_control_string($link, 't:p:o,' . $trace_file, $trace_file, 70);
+ try_control_string($link, 't:p,1,,2:o,' . $trace_file, $trace_file, 80);
+ try_control_string($link, 't:z,1,,2:o,' . $trace_file, $trace_file, 90);#
- mysqli_close($link);
- print "done";
- if ($IS_MYSQLND)
- print "libmysql/DBUG package prints some debug info here."
+ mysqli_close($link);
+ print "done";
+ if ($IS_MYSQLND)
+ print "libmysql/DBUG package prints some debug info here."
?>
--EXPECTF--
[023][control string '%s'] Trace file has not been written.
diff --git a/ext/mysqli/tests/mysqli_debug_ini.phpt b/ext/mysqli/tests/mysqli_debug_ini.phpt
index f1a37bf882..3416e9a9e2 100644
--- a/ext/mysqli/tests/mysqli_debug_ini.phpt
+++ b/ext/mysqli/tests/mysqli_debug_ini.phpt
@@ -29,24 +29,24 @@ else
mysqlnd.debug="t:O,/tmp/mysqli_debug_phpt.trace"
--FILE--
<?php
- require_once('connect.inc');
- require_once('table.inc');
+ require_once('connect.inc');
+ require_once('table.inc');
- var_dump(ini_get('mysqlnd.debug'));
+ var_dump(ini_get('mysqlnd.debug'));
- $trace_file = '/tmp/mysqli_debug_phpt.trace';
- clearstatcache();
- if (!file_exists($trace_file))
- printf("[003] Trace file '%s' has not been created\n", $trace_file);
- if (filesize($trace_file) < 50)
- printf("[004] Trace file '%s' is very small. filesize() reports only %d bytes. Please check.\n",
- $trace_file,
- filesize($trace_file));
+ $trace_file = '/tmp/mysqli_debug_phpt.trace';
+ clearstatcache();
+ if (!file_exists($trace_file))
+ printf("[003] Trace file '%s' has not been created\n", $trace_file);
+ if (filesize($trace_file) < 50)
+ printf("[004] Trace file '%s' is very small. filesize() reports only %d bytes. Please check.\n",
+ $trace_file,
+ filesize($trace_file));
- mysqli_close($link);
- unlink($trace_file);
+ mysqli_close($link);
+ unlink($trace_file);
- print "done!";
+ print "done!";
?>
--EXPECT--
string(32) "t:O,/tmp/mysqli_debug_phpt.trace"
diff --git a/ext/mysqli/tests/mysqli_debug_mysqlnd_control_string.phpt b/ext/mysqli/tests/mysqli_debug_mysqlnd_control_string.phpt
index 9999d84395..a18ee5e7d3 100644
--- a/ext/mysqli/tests/mysqli_debug_mysqlnd_control_string.phpt
+++ b/ext/mysqli/tests/mysqli_debug_mysqlnd_control_string.phpt
@@ -20,206 +20,206 @@ if (!$IS_MYSQLND)
?>
--FILE--
<?php
- require_once('connect.inc');
- require_once('table.inc');
-
- function try_control_string($link, $control_string, $trace_file, $offset) {
-
- @unlink($trace_file);
- if (true !== ($tmp = @mysqli_debug($control_string))) {
- printf("[%03d][control string '%s'] Expecting boolean/true, got %s/%s.\n",
- $offset + 1,
- $control_string,
- gettype($tmp),
- $tmp);
- return false;
- }
-
- if (!$res = mysqli_query($link, 'SELECT * FROM test')) {
- printf("[%03d][control string '%s'] [%d] %s.\n",
- $offset + 2,
- $control_string,
- mysqli_errno($link),
- mysqli_error($link));
- return false;
- }
- while ($row = mysqli_fetch_assoc($res))
- ;
- mysqli_free_result($res);
-
- clearstatcache();
- if (!file_exists($trace_file)) {
- printf("[%03d][control string '%s'] Trace file has not been written.\n",
- $offset + 3,
- $control_string,
- gettype($tmp),
- $tmp);
- return false;
- }
-
- return trim(substr(file_get_contents($trace_file), 0, 100024));
- }
-
- $trace_file = sprintf('%s%s%s', sys_get_temp_dir(), DIRECTORY_SEPARATOR, 'mysqli_debug_phpt.trace');
-
- $trace = try_control_string($link, 't:O,' . $trace_file, $trace_file, 10);
- if (!strstr($trace, 'SELECT * FROM test') && !strstr($trace, 'mysql_real_query'))
- printf("[015] SELECT query cannot be found in trace. Trace contents seems wrong.\n");
-
- // T - gettimeofday() system call, system dependent format
- // 16:57:03.350734 >mysql_real_query
- $trace = try_control_string($link, 't:O,' . $trace_file . ':T', $trace_file, 20);
- if (!preg_match('@^[012]{0,1}[0-9]{1}:[0-5]{0,1}[0-9]{1}:[0-5]{0,1}[0-9]{1}@ismU', $trace))
- printf("[025] Timestamp not found. One reason could be that the test is borked and does not recognize the format of the gettimeofday() system call. Check manually (and fix the test, if needed :-)). First characters from trace are '%s'\n", substr($trace, 0, 80));
-
- // i - add PID of the current process
- // currently PHP is not multi-threaded, so it should be save to test for the PID of this PHP process
- if (false === ($pid = getmypid()))
- $pid = "[\d]+";
-
- $trace = try_control_string($link, 't:O,' . $trace_file . ':i', $trace_file, 30);
- if (!preg_match("@^" . $pid . "*@ismU", $trace))
- printf("[035] Process ID has not been found, first characters from trace are '%s'\n", substr($trace, 0, 80));
-
- // L - line numbers
- $trace = try_control_string($link, 't:O,' . $trace_file . ':L', $trace_file, 40);
- if (!preg_match("@^[\d]+@ismU", $trace))
- printf("[045] Line numbers have not been found, first characters from trace are '%s'\n", substr($trace, 0, 80));
-
- // F - file name
- $trace = try_control_string($link, 't:O,' . $trace_file . ':F', $trace_file, 50);
- // hopefully we'll never see a file name that's not covered by this regular expression...
- if (!preg_match("@^\s*[/\w\\\\d\.\-]+\.[ch]@ismU", $trace))
- printf("[055] File names seem to be missing, first characters from trace are '%s'\n", substr($trace, 0, 80));
-
- // -n - print function nesting depth
- $trace = try_control_string($link, 't:O,' . $trace_file . ':n', $trace_file, 60);
- if (!preg_match("@^\d+:@ismU", $trace))
- printf("[065] Nesting level seem to be missing, first characters from trace are '%s'\n", substr($trace, 0, 80));
-
- // -t,[N] - maximum nesting level
- $trace = try_control_string($link, 't,1:n:O,' . $trace_file, $trace_file, 70);
- $lines = explode("\n", $trace);
- foreach ($lines as $k => $line) {
- $line = trim($line);
- if (!preg_match("@^(\d+):+@ismU", $line, $matches)) {
- printf("[075] Nesting level seem to be missing, first characters from trace are '%s'\n", substr($line, 0, 80));
- } else {
- if (!isset($matches[1]) || ((int)$matches[1] > 1)) {
- printf("[076] Nesting level seem to be %d, should not be higher than 1, first characters from trace are '%s'\n",
- $matches[1],
- substr($line, 0, 80));
- }
- }
- }
-
- // omitting t
- $trace = try_control_string($link, 'n:O,' . $trace_file, $trace_file, 80);
- $lines = explode("\n", $trace);
- foreach ($lines as $k => $line) {
- $line = trim($line);
- if (preg_match("@^[|\s]*>[\w]+@ism", $line, $matches)) {
- printf("[085] Looks like a function call, but there should be none in the trace file, first characters from trace are '%s'\n",
- substr($line, 0, 80));
- }
- }
-
- // -f[,functions] - Limit debugger list to specified functions. Empty list -> all functions
- $lines_all_funcs = explode("\n", try_control_string($link, 't:O,' . $trace_file, $trace_file, 90));
- $functions_all_funcs = array();
- foreach ($lines_all_funcs as $k => $line) {
- $line = trim($line);
- if (preg_match("@^[|\s]*>([\w:]+)@ism", $line, $matches)) {
- $functions_all_funcs[$matches[1]] = $matches[1];
- }
- }
-
- $lines_trace = explode("\n", try_control_string($link, 't:f:O,' . $trace_file, $trace_file, 100));
- $functions_trace = array();
- foreach ($lines_trace as $k => $line) {
- $line = trim($line);
- if (preg_match("@^[|\s]*>([\w:]+)@ism", $line, $matches)) {
- $functions_trace[$matches[1]] = $matches[1];
- }
- }
-
- $tmp = array_diff($functions_all_funcs, $functions_trace);
- if (!empty($tmp)) {
- printf("[105] Looks like not all functions are listed in the trace. Check manually, dumping diff.");
- var_dump($tmp);
- }
-
- // get two or three function names to play with...
- $test_functions = array('simple' => array(), 'doubledot' => array());
-
- foreach ($functions_all_funcs as $func) {
- if (count($test_functions['simple']) < 2 && !strstr($func, '::'))
- $test_functions['simple'][$func] = $func;
- else if (count($test_functions['doubledot']) < 2 && strstr($func, '::'))
- $test_functions['doubledot'][$func] = $func;
- }
-
- $control_string = '';
- if ($func = reset($test_functions['simple']))
- $control_string .= sprintf('%s,', $func);
- if ($func = reset($test_functions['doubledot']))
- $control_string .= sprintf('%s,', $func);
- if ($func = next($test_functions['simple']))
- $control_string .= sprintf('%s,', $func);
- if ($func = next($test_functions['doubledot']))
- $control_string .= sprintf('%s,', $func);
- $control_string = sprintf('t:f,%s:O,%s', $control_string, $trace_file);
-
- $lines_trace = explode("\n", try_control_string($link, $control_string, $trace_file, 110));
- $functions_trace = array();
- foreach ($lines_trace as $k => $line) {
- $line = trim($line);
- if (preg_match("@^[|\s]*>([\w:]+)@ism", $line, $matches)) {
- $functions_trace[$matches[1]] = $matches[1];
- }
- }
-
- foreach ($test_functions['simple'] as $func)
- if (isset($functions_trace[$func])) {
- unset($functions_trace[$func]);
- unset($test_functions['simple'][$func]);
- }
-
- foreach ($test_functions['doubledot'] as $func)
- if (isset($functions_trace[$func])) {
- unset($functions_trace[$func]);
- unset($test_functions['doubledot'][$func]);
- }
-
- if (!empty($functions_trace)) {
- printf("[115] Dumping list of unexpected functions which should have not been shown when using control string '%s'.\n",
- $control_string);
- var_dump($functions_trace);
- }
- $tmp = array_merge($test_functions['doubledot'], $test_functions['simple']);
- if (!empty($tmp)) {
- printf("[116] Dumping list of functions which should have been shown when using control string '%s'.\n",
- $control_string);
- var_dump($tmp);
- }
-
- if ($IS_MYSQLND) {
- // mysqlnd only option
- // m - trace memory allocations
- $trace = try_control_string($link, 't:O,' . $trace_file . ':m', $trace_file, 120);
- if (!preg_match("@^[|\s]*>\_mysqlnd_p?efree@ismU", $trace, $matches) &&
- !preg_match("@^[|\s]*>\_mysqlnd_p?emalloc@ismU", $trace, $matches)) {
- printf("[125] Memory dump does neither contain _mysqlnd_pefree nor _mysqlnd_pemalloc calls - check manually.\n");
- var_dump($trace);
- }
-
- }
-
- mysqli_close($link);
- print "done";
- if ($IS_MYSQLND)
- print "libmysql/DBUG package prints some debug info here.";
- @unlink($trace_file);
+ require_once('connect.inc');
+ require_once('table.inc');
+
+ function try_control_string($link, $control_string, $trace_file, $offset) {
+
+ @unlink($trace_file);
+ if (true !== ($tmp = @mysqli_debug($control_string))) {
+ printf("[%03d][control string '%s'] Expecting boolean/true, got %s/%s.\n",
+ $offset + 1,
+ $control_string,
+ gettype($tmp),
+ $tmp);
+ return false;
+ }
+
+ if (!$res = mysqli_query($link, 'SELECT * FROM test')) {
+ printf("[%03d][control string '%s'] [%d] %s.\n",
+ $offset + 2,
+ $control_string,
+ mysqli_errno($link),
+ mysqli_error($link));
+ return false;
+ }
+ while ($row = mysqli_fetch_assoc($res))
+ ;
+ mysqli_free_result($res);
+
+ clearstatcache();
+ if (!file_exists($trace_file)) {
+ printf("[%03d][control string '%s'] Trace file has not been written.\n",
+ $offset + 3,
+ $control_string,
+ gettype($tmp),
+ $tmp);
+ return false;
+ }
+
+ return trim(substr(file_get_contents($trace_file), 0, 100024));
+ }
+
+ $trace_file = sprintf('%s%s%s', sys_get_temp_dir(), DIRECTORY_SEPARATOR, 'mysqli_debug_phpt.trace');
+
+ $trace = try_control_string($link, 't:O,' . $trace_file, $trace_file, 10);
+ if (!strstr($trace, 'SELECT * FROM test') && !strstr($trace, 'mysql_real_query'))
+ printf("[015] SELECT query cannot be found in trace. Trace contents seems wrong.\n");
+
+ // T - gettimeofday() system call, system dependent format
+ // 16:57:03.350734 >mysql_real_query
+ $trace = try_control_string($link, 't:O,' . $trace_file . ':T', $trace_file, 20);
+ if (!preg_match('@^[012]{0,1}[0-9]{1}:[0-5]{0,1}[0-9]{1}:[0-5]{0,1}[0-9]{1}@ismU', $trace))
+ printf("[025] Timestamp not found. One reason could be that the test is borked and does not recognize the format of the gettimeofday() system call. Check manually (and fix the test, if needed :-)). First characters from trace are '%s'\n", substr($trace, 0, 80));
+
+ // i - add PID of the current process
+ // currently PHP is not multi-threaded, so it should be save to test for the PID of this PHP process
+ if (false === ($pid = getmypid()))
+ $pid = "[\d]+";
+
+ $trace = try_control_string($link, 't:O,' . $trace_file . ':i', $trace_file, 30);
+ if (!preg_match("@^" . $pid . "*@ismU", $trace))
+ printf("[035] Process ID has not been found, first characters from trace are '%s'\n", substr($trace, 0, 80));
+
+ // L - line numbers
+ $trace = try_control_string($link, 't:O,' . $trace_file . ':L', $trace_file, 40);
+ if (!preg_match("@^[\d]+@ismU", $trace))
+ printf("[045] Line numbers have not been found, first characters from trace are '%s'\n", substr($trace, 0, 80));
+
+ // F - file name
+ $trace = try_control_string($link, 't:O,' . $trace_file . ':F', $trace_file, 50);
+ // hopefully we'll never see a file name that's not covered by this regular expression...
+ if (!preg_match("@^\s*[/\w\\\\d\.\-]+\.[ch]@ismU", $trace))
+ printf("[055] File names seem to be missing, first characters from trace are '%s'\n", substr($trace, 0, 80));
+
+ // -n - print function nesting depth
+ $trace = try_control_string($link, 't:O,' . $trace_file . ':n', $trace_file, 60);
+ if (!preg_match("@^\d+:@ismU", $trace))
+ printf("[065] Nesting level seem to be missing, first characters from trace are '%s'\n", substr($trace, 0, 80));
+
+ // -t,[N] - maximum nesting level
+ $trace = try_control_string($link, 't,1:n:O,' . $trace_file, $trace_file, 70);
+ $lines = explode("\n", $trace);
+ foreach ($lines as $k => $line) {
+ $line = trim($line);
+ if (!preg_match("@^(\d+):+@ismU", $line, $matches)) {
+ printf("[075] Nesting level seem to be missing, first characters from trace are '%s'\n", substr($line, 0, 80));
+ } else {
+ if (!isset($matches[1]) || ((int)$matches[1] > 1)) {
+ printf("[076] Nesting level seem to be %d, should not be higher than 1, first characters from trace are '%s'\n",
+ $matches[1],
+ substr($line, 0, 80));
+ }
+ }
+ }
+
+ // omitting t
+ $trace = try_control_string($link, 'n:O,' . $trace_file, $trace_file, 80);
+ $lines = explode("\n", $trace);
+ foreach ($lines as $k => $line) {
+ $line = trim($line);
+ if (preg_match("@^[|\s]*>[\w]+@ism", $line, $matches)) {
+ printf("[085] Looks like a function call, but there should be none in the trace file, first characters from trace are '%s'\n",
+ substr($line, 0, 80));
+ }
+ }
+
+ // -f[,functions] - Limit debugger list to specified functions. Empty list -> all functions
+ $lines_all_funcs = explode("\n", try_control_string($link, 't:O,' . $trace_file, $trace_file, 90));
+ $functions_all_funcs = array();
+ foreach ($lines_all_funcs as $k => $line) {
+ $line = trim($line);
+ if (preg_match("@^[|\s]*>([\w:]+)@ism", $line, $matches)) {
+ $functions_all_funcs[$matches[1]] = $matches[1];
+ }
+ }
+
+ $lines_trace = explode("\n", try_control_string($link, 't:f:O,' . $trace_file, $trace_file, 100));
+ $functions_trace = array();
+ foreach ($lines_trace as $k => $line) {
+ $line = trim($line);
+ if (preg_match("@^[|\s]*>([\w:]+)@ism", $line, $matches)) {
+ $functions_trace[$matches[1]] = $matches[1];
+ }
+ }
+
+ $tmp = array_diff($functions_all_funcs, $functions_trace);
+ if (!empty($tmp)) {
+ printf("[105] Looks like not all functions are listed in the trace. Check manually, dumping diff.");
+ var_dump($tmp);
+ }
+
+ // get two or three function names to play with...
+ $test_functions = array('simple' => array(), 'doubledot' => array());
+
+ foreach ($functions_all_funcs as $func) {
+ if (count($test_functions['simple']) < 2 && !strstr($func, '::'))
+ $test_functions['simple'][$func] = $func;
+ else if (count($test_functions['doubledot']) < 2 && strstr($func, '::'))
+ $test_functions['doubledot'][$func] = $func;
+ }
+
+ $control_string = '';
+ if ($func = reset($test_functions['simple']))
+ $control_string .= sprintf('%s,', $func);
+ if ($func = reset($test_functions['doubledot']))
+ $control_string .= sprintf('%s,', $func);
+ if ($func = next($test_functions['simple']))
+ $control_string .= sprintf('%s,', $func);
+ if ($func = next($test_functions['doubledot']))
+ $control_string .= sprintf('%s,', $func);
+ $control_string = sprintf('t:f,%s:O,%s', $control_string, $trace_file);
+
+ $lines_trace = explode("\n", try_control_string($link, $control_string, $trace_file, 110));
+ $functions_trace = array();
+ foreach ($lines_trace as $k => $line) {
+ $line = trim($line);
+ if (preg_match("@^[|\s]*>([\w:]+)@ism", $line, $matches)) {
+ $functions_trace[$matches[1]] = $matches[1];
+ }
+ }
+
+ foreach ($test_functions['simple'] as $func)
+ if (isset($functions_trace[$func])) {
+ unset($functions_trace[$func]);
+ unset($test_functions['simple'][$func]);
+ }
+
+ foreach ($test_functions['doubledot'] as $func)
+ if (isset($functions_trace[$func])) {
+ unset($functions_trace[$func]);
+ unset($test_functions['doubledot'][$func]);
+ }
+
+ if (!empty($functions_trace)) {
+ printf("[115] Dumping list of unexpected functions which should have not been shown when using control string '%s'.\n",
+ $control_string);
+ var_dump($functions_trace);
+ }
+ $tmp = array_merge($test_functions['doubledot'], $test_functions['simple']);
+ if (!empty($tmp)) {
+ printf("[116] Dumping list of functions which should have been shown when using control string '%s'.\n",
+ $control_string);
+ var_dump($tmp);
+ }
+
+ if ($IS_MYSQLND) {
+ // mysqlnd only option
+ // m - trace memory allocations
+ $trace = try_control_string($link, 't:O,' . $trace_file . ':m', $trace_file, 120);
+ if (!preg_match("@^[|\s]*>\_mysqlnd_p?efree@ismU", $trace, $matches) &&
+ !preg_match("@^[|\s]*>\_mysqlnd_p?emalloc@ismU", $trace, $matches)) {
+ printf("[125] Memory dump does neither contain _mysqlnd_pefree nor _mysqlnd_pemalloc calls - check manually.\n");
+ var_dump($trace);
+ }
+
+ }
+
+ mysqli_close($link);
+ print "done";
+ if ($IS_MYSQLND)
+ print "libmysql/DBUG package prints some debug info here.";
+ @unlink($trace_file);
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_debug_mysqlnd_only.phpt b/ext/mysqli/tests/mysqli_debug_mysqlnd_only.phpt
index 333aaa10c0..a6d5d08146 100644
--- a/ext/mysqli/tests/mysqli_debug_mysqlnd_only.phpt
+++ b/ext/mysqli/tests/mysqli_debug_mysqlnd_only.phpt
@@ -21,108 +21,108 @@ if (!$IS_MYSQLND)
?>
--FILE--
<?php
- require_once('connect.inc');
- require_once('table.inc');
-
- function try_control_string($link, $control_string, $trace_file, $offset) {
-
- @unlink($trace_file);
- if (true !== ($tmp = @mysqli_debug($control_string))) {
- printf("[%03d][control string '%s'] Expecting boolean/true, got %s/%s.\n",
- $offset + 1,
- $control_string,
- gettype($tmp),
- $tmp);
- return false;
- }
-
- if (!$res = mysqli_query($link, 'SELECT * FROM test')) {
- printf("[%03d][control string '%s'] [%d] %s.\n",
- $offset + 2,
- $control_string,
- mysqli_errno($link),
- mysqli_error($link));
- return false;
- }
- while ($row = mysqli_fetch_assoc($res))
- ;
- mysqli_free_result($res);
-
- clearstatcache();
- if (!file_exists($trace_file)) {
- printf("[%03d][control string '%s'] Trace file has not been written.\n",
- $offset + 3,
- $control_string,
- gettype($tmp),
- $tmp);
- return false;
- }
-
- return trim(substr(file_get_contents($trace_file), 0, 100024));
- }
-
- $memory_funcs = array(
- '_mysqlnd_ecalloc',
- '_mysqlnd_emalloc',
- '_mysqlnd_palloc_free_thd_cache_reference',
- '_mysqlnd_pecalloc',
- '_mysqlnd_pefree',
- '_mysqlnd_pemalloc',
- '_mysqlnd_perealloc',
- );
- $trace_file = sprintf('%s%s%s', sys_get_temp_dir(), DIRECTORY_SEPARATOR, 'mysqli_debug_phpt.trace');
-
- $trace = try_control_string($link, 't:m:O,' . $trace_file, $trace_file, 10);
- if (!strstr($trace, 'SELECT * FROM test') && !strstr($trace, 'mysql_real_query'))
- printf("[015] SELECT query cannot be found in trace. Trace contents seems wrong.\n");
-
- $lines_trace = explode("\n", $trace);
- $functions_trace = array();
- foreach ($lines_trace as $k => $line) {
- $line = trim($line);
- if (preg_match("@^[|\s]*>([\w:]+)@ism", $line, $matches)) {
- $functions_trace[$matches[1]] = $matches[1];
- }
- }
-
- $found = 0;
- foreach ($memory_funcs as $k => $name)
- if (isset($functions_trace[$name]))
- $found++;
-
- if ($found < 1) {
- printf("[016] Only %d memory functions have been found, expecting at least %d.\n",
- $found, 1);
- var_dump($trace);
- }
-
- $trace = try_control_string($link, 't:O,' . $trace_file, $trace_file, 20);
- if (!strstr($trace, 'SELECT * FROM test') && !strstr($trace, 'mysql_real_query'))
- printf("[025] SELECT query cannot be found in trace. Trace contents seems wrong.\n");
-
- $lines_trace = explode("\n", $trace);
- $functions_trace = array();
- foreach ($lines_trace as $k => $line) {
- $line = trim($line);
- if (preg_match("@^[|\s]*>([\w:]+)@ism", $line, $matches)) {
- $functions_trace[$matches[1]] = $matches[1];
- }
- }
-
- $found = 0;
- foreach ($memory_funcs as $k => $name)
- if (isset($functions_trace[$name]))
- $found++;
-
- if ($found > 2) {
- printf("[026] More than %d memory functions have been recorded, that's strange.\n",
- $found);
- var_dump($trace);
- }
-
- mysqli_close($link);
- @unlink($trace_file);
- print "done!";
+ require_once('connect.inc');
+ require_once('table.inc');
+
+ function try_control_string($link, $control_string, $trace_file, $offset) {
+
+ @unlink($trace_file);
+ if (true !== ($tmp = @mysqli_debug($control_string))) {
+ printf("[%03d][control string '%s'] Expecting boolean/true, got %s/%s.\n",
+ $offset + 1,
+ $control_string,
+ gettype($tmp),
+ $tmp);
+ return false;
+ }
+
+ if (!$res = mysqli_query($link, 'SELECT * FROM test')) {
+ printf("[%03d][control string '%s'] [%d] %s.\n",
+ $offset + 2,
+ $control_string,
+ mysqli_errno($link),
+ mysqli_error($link));
+ return false;
+ }
+ while ($row = mysqli_fetch_assoc($res))
+ ;
+ mysqli_free_result($res);
+
+ clearstatcache();
+ if (!file_exists($trace_file)) {
+ printf("[%03d][control string '%s'] Trace file has not been written.\n",
+ $offset + 3,
+ $control_string,
+ gettype($tmp),
+ $tmp);
+ return false;
+ }
+
+ return trim(substr(file_get_contents($trace_file), 0, 100024));
+ }
+
+ $memory_funcs = array(
+ '_mysqlnd_ecalloc',
+ '_mysqlnd_emalloc',
+ '_mysqlnd_palloc_free_thd_cache_reference',
+ '_mysqlnd_pecalloc',
+ '_mysqlnd_pefree',
+ '_mysqlnd_pemalloc',
+ '_mysqlnd_perealloc',
+ );
+ $trace_file = sprintf('%s%s%s', sys_get_temp_dir(), DIRECTORY_SEPARATOR, 'mysqli_debug_phpt.trace');
+
+ $trace = try_control_string($link, 't:m:O,' . $trace_file, $trace_file, 10);
+ if (!strstr($trace, 'SELECT * FROM test') && !strstr($trace, 'mysql_real_query'))
+ printf("[015] SELECT query cannot be found in trace. Trace contents seems wrong.\n");
+
+ $lines_trace = explode("\n", $trace);
+ $functions_trace = array();
+ foreach ($lines_trace as $k => $line) {
+ $line = trim($line);
+ if (preg_match("@^[|\s]*>([\w:]+)@ism", $line, $matches)) {
+ $functions_trace[$matches[1]] = $matches[1];
+ }
+ }
+
+ $found = 0;
+ foreach ($memory_funcs as $k => $name)
+ if (isset($functions_trace[$name]))
+ $found++;
+
+ if ($found < 1) {
+ printf("[016] Only %d memory functions have been found, expecting at least %d.\n",
+ $found, 1);
+ var_dump($trace);
+ }
+
+ $trace = try_control_string($link, 't:O,' . $trace_file, $trace_file, 20);
+ if (!strstr($trace, 'SELECT * FROM test') && !strstr($trace, 'mysql_real_query'))
+ printf("[025] SELECT query cannot be found in trace. Trace contents seems wrong.\n");
+
+ $lines_trace = explode("\n", $trace);
+ $functions_trace = array();
+ foreach ($lines_trace as $k => $line) {
+ $line = trim($line);
+ if (preg_match("@^[|\s]*>([\w:]+)@ism", $line, $matches)) {
+ $functions_trace[$matches[1]] = $matches[1];
+ }
+ }
+
+ $found = 0;
+ foreach ($memory_funcs as $k => $name)
+ if (isset($functions_trace[$name]))
+ $found++;
+
+ if ($found > 2) {
+ printf("[026] More than %d memory functions have been recorded, that's strange.\n",
+ $found);
+ var_dump($trace);
+ }
+
+ mysqli_close($link);
+ @unlink($trace_file);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_disable_reads_from_master.phpt b/ext/mysqli/tests/mysqli_disable_reads_from_master.phpt
index 268bd619cb..92b4e8fc27 100644
--- a/ext/mysqli/tests/mysqli_disable_reads_from_master.phpt
+++ b/ext/mysqli/tests/mysqli_disable_reads_from_master.phpt
@@ -12,36 +12,36 @@ if (!function_exists('mysqli_disable_reads_from_master')) {
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (NULL !== ($tmp = @mysqli_disable_reads_from_master()))
- printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = @mysqli_disable_reads_from_master()))
+ printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (NULL !== ($tmp = @mysqli_disable_reads_from_master($link)))
- printf("[002] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = @mysqli_disable_reads_from_master($link)))
+ printf("[002] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
- if (!is_bool($tmp = mysqli_disable_reads_from_master($link)))
- printf("[004] Expecting boolean/[true|false] value, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_bool($tmp = mysqli_disable_reads_from_master($link)))
+ printf("[004] Expecting boolean/[true|false] value, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
+ mysqli_close($link);
- if (NULL !== ($tmp = mysqli_disable_reads_from_master($link)))
- printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = mysqli_disable_reads_from_master($link)))
+ printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
--EXPECTF--
-Warning: mysqli_disable_reads_from_master(): Couldn't fetch mysqli in %s on line %d
+Warning: mysqli_disable_reads_from_master(): mysqli object is already closed in %s on line %d
done!
diff --git a/ext/mysqli/tests/mysqli_driver.phpt b/ext/mysqli/tests/mysqli_driver.phpt
index 9f70cb4899..d4fa124a59 100644
--- a/ext/mysqli/tests/mysqli_driver.phpt
+++ b/ext/mysqli/tests/mysqli_driver.phpt
@@ -8,106 +8,106 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require("table.inc");
-
- if (!is_object($driver = new mysqli_driver()))
- printf("[001] Failed to create mysqli_driver object\n");
-
- $client_info = mysqli_get_client_info();
- if (($tmp = $driver->client_info) !== $client_info)
- printf("[002] Expecting %s/%s, got %s/%s\n",
- gettype($client_info), $client_info,
- gettype($tmp), $tmp);
-
- $client_version = mysqli_get_client_version();
- if (($tmp = $driver->client_version) !== $client_version)
- printf("[003] Expecting %s/%s, got %s/%s\n",
- gettype($client_version), $client_version,
- gettype($tmp), $tmp);
-
- if (!is_int($tmp = $driver->driver_version) || (0 == $tmp))
- printf("[004] Expecting int/any, got %s/%s\n",
- gettype($tmp), $tmp);
-
-
- $all_modes = array(MYSQLI_REPORT_INDEX, MYSQLI_REPORT_ERROR, MYSQLI_REPORT_STRICT,
- MYSQLI_REPORT_ALL, MYSQLI_REPORT_OFF);
- $report_mode = $driver->report_mode;
- if (!is_int($report_mode))
- printf("[005] Expecting int/any, got %s/%s\n",
- gettype($report_mode), $report_mode);
-
- if (!in_array($report_mode, $all_modes))
- printf("[006] Illegal report mode returned? Got %s, expected %s\n",
- $report_mode, implode(', ', $all_modes));
-
- $driver->report_mode = MYSQLI_REPORT_STRICT;
- $ok = false;
- try {
-
- if ($link = my_mysqli_connect($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket))
- printf("[007] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
- $host, $user . 'unknown_really', $db, $port, $socket);
- mysqli_close($link);
-
- } catch (mysqli_sql_exception $e) {
- $ok = true;
- if ('' == $e->getMessage())
- printf("[008] getMessage() has returned an empty string.\n");
- if ('' == $e->getCode())
- printf("[009] getCode() has returned an empty string.\n");
- if ('' == $e->getFile())
- printf("[010] getFile() has returned an empty string.\n");
- if ('' == $e->getLine())
- printf("[011] getLine() has returned an empty string.\n");
- $tmp = $e->getTrace();
- if (empty($tmp))
- printf("[012] getTrace() has returned an empty array.\n");
- if ('' == $e->getTraceAsString())
- printf("[013] getTraceAsString() has returned an empty string.\n");
- if ('' == $e->__toString())
- printf("[014] __toString() has returned an empty string.\n");
-
- }
- if (!$ok)
- printf("[015] Error reporting mode has not been switched to exceptions and or no exception thrown\n");
-
-
- $driver->report_mode = MYSQLI_REPORT_OFF;
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[016] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- mysqli_query($link, "NO_SQL");
- mysqli_close($link);
-
- $driver->report_mode = MYSQLI_REPORT_ERROR;
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[017] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- mysqli_query($link, "NO_SQL");
- mysqli_close($link);
-
- if (MYSQLI_REPORT_ERROR !== $driver->report_mode)
- printf("[018] Error mode should be different\n");
-
- /* TODO - more report testing should go in here, but it's not really documented what behaviour is expected */
-
- $driver->report_mode = $report_mode;
-
- $reconnect = $driver->reconnect;
- if (!is_bool($reconnect))
- printf("[019] Expecting boolean/any, got %s/%s\n",
- gettype($reconnect), $reconnect);
-
- /* pointless, but I need more documentation */
- $driver->reconnect = true;
- $driver->reconnect = false;
- $driver->reconnect = $reconnect;
-
- if (!is_bool($embedded = $driver->embedded))
- printf("[020] Expecting boolean/any, got %s/%s\n",
- gettype($embedded), $embedded);
-
- print "done!";
+ require("table.inc");
+
+ if (!is_object($driver = new mysqli_driver()))
+ printf("[001] Failed to create mysqli_driver object\n");
+
+ $client_info = mysqli_get_client_info();
+ if (($tmp = $driver->client_info) !== $client_info)
+ printf("[002] Expecting %s/%s, got %s/%s\n",
+ gettype($client_info), $client_info,
+ gettype($tmp), $tmp);
+
+ $client_version = mysqli_get_client_version();
+ if (($tmp = $driver->client_version) !== $client_version)
+ printf("[003] Expecting %s/%s, got %s/%s\n",
+ gettype($client_version), $client_version,
+ gettype($tmp), $tmp);
+
+ if (!is_int($tmp = $driver->driver_version) || (0 == $tmp))
+ printf("[004] Expecting int/any, got %s/%s\n",
+ gettype($tmp), $tmp);
+
+
+ $all_modes = array(MYSQLI_REPORT_INDEX, MYSQLI_REPORT_ERROR, MYSQLI_REPORT_STRICT,
+ MYSQLI_REPORT_ALL, MYSQLI_REPORT_OFF);
+ $report_mode = $driver->report_mode;
+ if (!is_int($report_mode))
+ printf("[005] Expecting int/any, got %s/%s\n",
+ gettype($report_mode), $report_mode);
+
+ if (!in_array($report_mode, $all_modes))
+ printf("[006] Illegal report mode returned? Got %s, expected %s\n",
+ $report_mode, implode(', ', $all_modes));
+
+ $driver->report_mode = MYSQLI_REPORT_STRICT;
+ $ok = false;
+ try {
+
+ if ($link = my_mysqli_connect($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket))
+ printf("[007] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
+ $host, $user . 'unknown_really', $db, $port, $socket);
+ mysqli_close($link);
+
+ } catch (mysqli_sql_exception $e) {
+ $ok = true;
+ if ('' == $e->getMessage())
+ printf("[008] getMessage() has returned an empty string.\n");
+ if ('' == $e->getCode())
+ printf("[009] getCode() has returned an empty string.\n");
+ if ('' == $e->getFile())
+ printf("[010] getFile() has returned an empty string.\n");
+ if ('' == $e->getLine())
+ printf("[011] getLine() has returned an empty string.\n");
+ $tmp = $e->getTrace();
+ if (empty($tmp))
+ printf("[012] getTrace() has returned an empty array.\n");
+ if ('' == $e->getTraceAsString())
+ printf("[013] getTraceAsString() has returned an empty string.\n");
+ if ('' == $e->__toString())
+ printf("[014] __toString() has returned an empty string.\n");
+
+ }
+ if (!$ok)
+ printf("[015] Error reporting mode has not been switched to exceptions and or no exception thrown\n");
+
+
+ $driver->report_mode = MYSQLI_REPORT_OFF;
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[016] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ mysqli_query($link, "NO_SQL");
+ mysqli_close($link);
+
+ $driver->report_mode = MYSQLI_REPORT_ERROR;
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[017] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ mysqli_query($link, "NO_SQL");
+ mysqli_close($link);
+
+ if (MYSQLI_REPORT_ERROR !== $driver->report_mode)
+ printf("[018] Error mode should be different\n");
+
+ /* TODO - more report testing should go in here, but it's not really documented what behaviour is expected */
+
+ $driver->report_mode = $report_mode;
+
+ $reconnect = $driver->reconnect;
+ if (!is_bool($reconnect))
+ printf("[019] Expecting boolean/any, got %s/%s\n",
+ gettype($reconnect), $reconnect);
+
+ /* pointless, but I need more documentation */
+ $driver->reconnect = true;
+ $driver->reconnect = false;
+ $driver->reconnect = $reconnect;
+
+ if (!is_bool($embedded = $driver->embedded))
+ printf("[020] Expecting boolean/any, got %s/%s\n",
+ gettype($embedded), $embedded);
+
+ print "done!";
?>
--EXPECTF--
Warning: mysqli_query(): (%d/%d): You have an error in your SQL syntax; check the manual that corresponds to your %s server version for the right syntax to use near 'NO_SQL' at line 1 in %s on line %d
diff --git a/ext/mysqli/tests/mysqli_driver_unclonable.phpt b/ext/mysqli/tests/mysqli_driver_unclonable.phpt
index 2b82f91d65..98559f46fc 100644
--- a/ext/mysqli/tests/mysqli_driver_unclonable.phpt
+++ b/ext/mysqli/tests/mysqli_driver_unclonable.phpt
@@ -5,9 +5,9 @@ Trying to clone mysqli_driver object
<?php require_once('skipifemb.inc'); ?>
--FILE--
<?php
- $driver = new mysqli_driver;
- $driver_clone = clone $driver;
- print "done!";
+ $driver = new mysqli_driver;
+ $driver_clone = clone $driver;
+ print "done!";
?>
--EXPECTF--
Fatal error: Uncaught Error: Trying to clone an uncloneable object of class mysqli_driver in %s:%d
diff --git a/ext/mysqli/tests/mysqli_dump_debug_info.phpt b/ext/mysqli/tests/mysqli_dump_debug_info.phpt
index b3fbde7fd9..95366417cf 100644
--- a/ext/mysqli/tests/mysqli_dump_debug_info.phpt
+++ b/ext/mysqli/tests/mysqli_dump_debug_info.phpt
@@ -8,37 +8,28 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
-
- if (NULL !== ($tmp = @mysqli_dump_debug_info()))
- printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (NULL !== ($tmp = @mysqli_dump_debug_info($link)))
- printf("[002] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- exit(1);
- }
-
- if (!is_bool($tmp = mysqli_dump_debug_info($link)))
- printf("[004] Expecting boolean/[true|false] value, got %s/%s, [%d] %s\n",
- gettype($tmp), $tmp,
- mysqli_errno($link), mysqli_error($link));
-
- mysqli_close($link);
-
- if (false !== ($tmp = mysqli_dump_debug_info($link)))
- printf("[005] Expecting NULL, got %s/%s, [%d] %s\n",
- gettype($tmp), $tmp,
- mysqli_errno($link), mysqli_error($link));
-
- print "done!";
-?>
---EXPECTF--
-Warning: mysqli_dump_debug_info(): Couldn't fetch mysqli in %s on line %d
+ require_once("connect.inc");
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ exit(1);
+ }
+
+ if (!is_bool($tmp = mysqli_dump_debug_info($link)))
+ printf("[004] Expecting boolean/[true|false] value, got %s/%s, [%d] %s\n",
+ gettype($tmp), $tmp,
+ mysqli_errno($link), mysqli_error($link));
+
+ mysqli_close($link);
+
+ try {
+ mysqli_dump_debug_info($link);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ print "done!";
+--EXPECT--
+mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_dump_debug_info_oo.phpt b/ext/mysqli/tests/mysqli_dump_debug_info_oo.phpt
index a0b5365432..ae153a320a 100644
--- a/ext/mysqli/tests/mysqli_dump_debug_info_oo.phpt
+++ b/ext/mysqli/tests/mysqli_dump_debug_info_oo.phpt
@@ -8,31 +8,29 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", $host, $user, $db, $port, $socket);
+ if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", $host, $user, $db, $port, $socket);
- if (NULL !== ($tmp = @$mysqli->dump_debug_info($link)))
- printf("[002] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_bool($tmp = $mysqli->dump_debug_info()))
+ printf("[003] Expecting boolean/[true|false] value, got %s/%s, [%d] %s\n",
+ gettype($tmp), $tmp,
+ $mysqli->errno, $mysqli->error);
- if (!is_bool($tmp = $mysqli->dump_debug_info()))
- printf("[003] Expecting boolean/[true|false] value, got %s/%s, [%d] %s\n",
- gettype($tmp), $tmp,
- $mysqli->errno, $mysqli->error);
+ $mysqli->close();
- $mysqli->close();
+ try {
+ $mysqli->dump_debug_info();
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- if (false !== ($tmp = $mysqli->dump_debug_info()))
- printf("[004] Expecting false, got %s/%s, [%d] %s\n",
- gettype($tmp), $tmp,
- $mysqli->errno, $mysqli->error);
-
- print "done!";
+ print "done!";
?>
---EXPECTF--
-Warning: mysqli::dump_debug_info(): Couldn't fetch mysqli in %s on line %d
+--EXPECT--
+mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_embedded_connect.phpt b/ext/mysqli/tests/mysqli_embedded_connect.phpt
index d1a8730a06..7c6ca78ad4 100644
--- a/ext/mysqli/tests/mysqli_embedded_connect.phpt
+++ b/ext/mysqli/tests/mysqli_embedded_connect.phpt
@@ -8,24 +8,24 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ require_once("connect.inc");
+ $tmp = NULL;
+ $link = NULL;
- if (NULL !== ($tmp = @mysqli_embedded_connect()))
- printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = @mysqli_embedded_connect()))
+ printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!$link = mysqli_embedded_connect($db)) {
- printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
+ if (!$link = mysqli_embedded_connect($db)) {
+ printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
- if (!is_bool($tmp = mysqli_embedded_connect($db . '_unknown')))
- printf("[003] Expecting boolean/[true|false] value, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_bool($tmp = mysqli_embedded_connect($db . '_unknown')))
+ printf("[003] Expecting boolean/[true|false] value, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--EXPECTF--
Warning: mysqli_embedded_connect() expects parameter 1 to be mysqli, null given in %s on line %d
diff --git a/ext/mysqli/tests/mysqli_enable_reads_from_master.phpt b/ext/mysqli/tests/mysqli_enable_reads_from_master.phpt
index 17b4b37529..203f58fd28 100644
--- a/ext/mysqli/tests/mysqli_enable_reads_from_master.phpt
+++ b/ext/mysqli/tests/mysqli_enable_reads_from_master.phpt
@@ -12,32 +12,36 @@ if (!function_exists('mysqli_enable_reads_from_master')) {
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (NULL !== ($tmp = @mysqli_enable_reads_from_master()))
- printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = @mysqli_enable_reads_from_master()))
+ printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (NULL !== ($tmp = @mysqli_enable_reads_from_master($link)))
- printf("[002] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = @mysqli_enable_reads_from_master($link)))
+ printf("[002] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
- if (!is_bool($tmp = mysqli_enable_reads_from_master($link)))
- printf("[004] Expecting boolean/[true|false] value, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_bool($tmp = mysqli_enable_reads_from_master($link)))
+ printf("[004] Expecting boolean/[true|false] value, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
+ try {
+ mysqli_close($link);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- if (NULL !== ($tmp = mysqli_enable_reads_from_master($link)))
- printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = mysqli_enable_reads_from_master($link)))
+ printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--EXPECTF--
-Warning: mysqli_enable_reads_from_master(): Couldn't fetch mysqli in %s on line %d
+mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_errno.phpt b/ext/mysqli/tests/mysqli_errno.phpt
index 0a9c245341..2cfb17fde3 100644
--- a/ext/mysqli/tests/mysqli_errno.phpt
+++ b/ext/mysqli/tests/mysqli_errno.phpt
@@ -8,45 +8,38 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_errno()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_errno($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
}
- var_dump(mysqli_errno($link));
+ var_dump(mysqli_errno($link));
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
- printf("[004] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
+ printf("[004] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- mysqli_query($link, 'SELECT * FROM test');
- var_dump(mysqli_errno($link));
+ mysqli_query($link, 'SELECT * FROM test');
+ var_dump(mysqli_errno($link));
- @mysqli_query($link, 'No SQL');
- if (($tmp = mysqli_errno($link)) == 0)
- printf("[005] Expecting int/any non zero got %s/%s\n", gettype($tmp), $tmp);
+ @mysqli_query($link, 'No SQL');
+ if (($tmp = mysqli_errno($link)) == 0)
+ printf("[005] Expecting int/any non zero got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
+ mysqli_close($link);
- var_dump(mysqli_errno($link));
+ try {
+ mysqli_errno($link);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- print "done!";
+ print "done!";
?>
--EXPECTF--
int(0)
int(%d)
-
-Warning: mysqli_errno(): Couldn't fetch mysqli in %s on line %d
-bool(false)
+mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_errno_oo.phpt b/ext/mysqli/tests/mysqli_errno_oo.phpt
index f2fa2529a1..d35477b2c4 100644
--- a/ext/mysqli/tests/mysqli_errno_oo.phpt
+++ b/ext/mysqli/tests/mysqli_errno_oo.phpt
@@ -8,42 +8,44 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- $mysqli = new mysqli();
- if (0 !== ($tmp = @$mysqli->errno))
- printf("[001] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+ $mysqli = new mysqli();
+ if (0 !== ($tmp = @$mysqli->errno))
+ printf("[001] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
- if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- var_dump($mysqli->errno);
+ var_dump($mysqli->errno);
- if (!$mysqli->query('DROP TABLE IF EXISTS test')) {
- printf("[003] Failed to drop old test table: [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
+ if (!$mysqli->query('DROP TABLE IF EXISTS test')) {
+ printf("[003] Failed to drop old test table: [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
- $mysqli->query('SELECT * FROM test');
- var_dump($mysqli->errno);
+ $mysqli->query('SELECT * FROM test');
+ var_dump($mysqli->errno);
- @$mysqli->query('No SQL');
- if (($tmp = $mysqli->errno) === 0)
- printf("[004] Expecting int/any non zero got %s/%s\n", gettype($tmp), $tmp);
+ @$mysqli->query('No SQL');
+ if (($tmp = $mysqli->errno) === 0)
+ printf("[004] Expecting int/any non zero got %s/%s\n", gettype($tmp), $tmp);
- $mysqli->close();
+ $mysqli->close();
- var_dump($mysqli->errno);
+ try {
+ $mysqli->errno;
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- print "done!";
+ print "done!";
?>
--EXPECTF--
int(0)
int(%d)
-
-Warning: main(): Couldn't fetch mysqli in %s on line %d
-bool(false)
+mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_error.phpt b/ext/mysqli/tests/mysqli_error.phpt
index fd61f0f5d2..7a35cd0dd1 100644
--- a/ext/mysqli/tests/mysqli_error.phpt
+++ b/ext/mysqli/tests/mysqli_error.phpt
@@ -8,42 +8,36 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
- if (!is_null($tmp = @mysqli_error()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ $tmp = mysqli_error($link);
+ if (!is_string($tmp) || ('' !== $tmp))
+ printf("[004] Expecting string/empty, got %s/%s. [%d] %s\n", gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
- if (!is_null($tmp = @mysqli_error($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
+ printf("[005] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
+ mysqli_query($link, 'SELECT * FROM test');
+ $tmp = mysqli_error($link);
+ if (!is_string($tmp) || !preg_match("/Table '\w*\.test' doesn't exist/su", $tmp))
+ printf("[006] Expecting string/[Table... doesn't exit], got %s/%s. [%d] %s\n", gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_error($link);
- if (!is_string($tmp) || ('' !== $tmp))
- printf("[004] Expecting string/empty, got %s/%s. [%d] %s\n", gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
+ mysqli_close($link);
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
- printf("[005] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ try {
+ mysqli_error($link);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- mysqli_query($link, 'SELECT * FROM test');
- $tmp = mysqli_error($link);
- if (!is_string($tmp) || !preg_match("/Table '\w*\.test' doesn't exist/su", $tmp))
- printf("[006] Expecting string/[Table... doesn't exit], got %s/%s. [%d] %s\n", gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
-
- mysqli_close($link);
-
- var_dump(mysqli_error($link));
-
- print "done!";
+ print "done!";
?>
---EXPECTF--
-Warning: mysqli_error(): Couldn't fetch mysqli in %s on line %d
-bool(false)
+--EXPECT--
+mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_error_oo.phpt b/ext/mysqli/tests/mysqli_error_oo.phpt
index d05fd6f383..177e3a9f5a 100644
--- a/ext/mysqli/tests/mysqli_error_oo.phpt
+++ b/ext/mysqli/tests/mysqli_error_oo.phpt
@@ -8,39 +8,42 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- $mysqli = new mysqli();
- if ('' !== ($tmp = @$mysqli->error))
- printf("[001] Expecting empty string, got %s/'%s'\n", gettype($tmp), $tmp);
+ $mysqli = new mysqli();
+ if ('' !== ($tmp = @$mysqli->error))
+ printf("[001] Expecting empty string, got %s/'%s'\n", gettype($tmp), $tmp);
- if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- $tmp = $mysqli->error;
- if (!is_string($tmp) || ('' !== $tmp))
- printf("[003] Expecting string/empty, got %s/%s. [%d] %s\n", gettype($tmp), $tmp, $mysqli->errno, $mysqli->error);
+ $tmp = $mysqli->error;
+ if (!is_string($tmp) || ('' !== $tmp))
+ printf("[003] Expecting string/empty, got %s/%s. [%d] %s\n", gettype($tmp), $tmp, $mysqli->errno, $mysqli->error);
- if (!$mysqli->query('DROP TABLE IF EXISTS test')) {
- printf("[004] Failed to drop old test table: [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
+ if (!$mysqli->query('DROP TABLE IF EXISTS test')) {
+ printf("[004] Failed to drop old test table: [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
- $mysqli->query('SELECT * FROM test');
- $tmp = $mysqli->error;
- if (!is_string($tmp) || !preg_match("/Table '\w*\.test' doesn't exist/su", $tmp))
- printf("[006] Expecting string/[Table... doesn't exit], got %s/%s. [%d] %s\n", gettype($tmp), $tmp, $mysqli->errno, $mysqli->error);
+ $mysqli->query('SELECT * FROM test');
+ $tmp = $mysqli->error;
+ if (!is_string($tmp) || !preg_match("/Table '\w*\.test' doesn't exist/su", $tmp))
+ printf("[006] Expecting string/[Table... doesn't exit], got %s/%s. [%d] %s\n", gettype($tmp), $tmp, $mysqli->errno, $mysqli->error);
- $mysqli->close();
+ $mysqli->close();
- var_dump($mysqli->error);
+ try {
+ $mysqli->error;
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- print "done!";
+ print "done!";
?>
---EXPECTF--
-Warning: main(): Couldn't fetch mysqli in %s on line %d
-bool(false)
+--EXPECT--
+mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_error_unicode.phpt b/ext/mysqli/tests/mysqli_error_unicode.phpt
index f4d8da9110..1025f1cda2 100644
--- a/ext/mysqli/tests/mysqli_error_unicode.phpt
+++ b/ext/mysqli/tests/mysqli_error_unicode.phpt
@@ -8,42 +8,34 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
- if (!is_null($tmp = @mysqli_error()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ mysqli_query($link, "set names utf8");
- if (!is_null($tmp = @mysqli_error($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ $tmp = mysqli_error($link);
+ if (!is_string($tmp) || ('' !== $tmp))
+ printf("[004] Expecting string/empty, got %s/%s. [%d] %s\n", gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
- if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
- mysqli_query($link, "set names utf8");
+ mysqli_query($link, 'SELECT * FROM нÑма_такава_таблица');
+ $tmp = mysqli_error($link);
+ var_dump(str_replace($db.".", "", $tmp));
- $tmp = mysqli_error($link);
- if (!is_string($tmp) || ('' !== $tmp))
- printf("[004] Expecting string/empty, got %s/%s. [%d] %s\n", gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
+ mysqli_close($link);
+ try {
+ mysqli_error($link);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- mysqli_query($link, 'SELECT * FROM нÑма_такава_таблица');
- $tmp = mysqli_error($link);
- var_dump(str_replace($db.".", "", $tmp));
-
- mysqli_close($link);
-
- var_dump(mysqli_error($link));
-
- print "done!";
-?>
+ print "done!";
--EXPECTF--
string(%d) "Table 'нÑма_такава_таблица' doesn't exist"
-
-Warning: mysqli_error(): Couldn't fetch mysqli in %s on line %d
-bool(false)
+mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_expire_password.phpt b/ext/mysqli/tests/mysqli_expire_password.phpt
index 679e210f92..18517e521a 100644
--- a/ext/mysqli/tests/mysqli_expire_password.phpt
+++ b/ext/mysqli/tests/mysqli_expire_password.phpt
@@ -50,71 +50,71 @@ if (!mysqli_query($link, sprintf("GRANT SELECT ON TABLE %s.test TO expiretest@'%
?>
--FILE--
<?php
- require_once('connect.inc');
- require_once('table.inc');
-
- /* default */
- if (!$link = my_mysqli_connect($host, 'expiretest', "", $db, $port, $socket)) {
- printf("[001] Cannot connect [%d] %s\n",
- mysqli_connect_errno(), mysqli_connect_error());
- } else {
- $link->query("SELECT id FROM test WHERE id = 1");
- printf("[002] Connect should fail, [%d] %s\n", $link->errno, $link->error);
- }
- /* explicitly requesting default */
- $link = mysqli_init();
- $link->options(MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, 0);
- if (!my_mysqli_real_connect($link, $host, 'expiretest', "", $db, $port, $socket)) {
- printf("[003] Cannot connect [%d] %s\n",
- mysqli_connect_errno(), mysqli_connect_error());
- } else {
- $link->query("SELECT id FROM test WHERE id = 1");
- printf("[004] Connect should fail, [%d] %s\n", $link->errno, $link->error);
- }
-
- /* allow connect */
- $link = mysqli_init();
- $link->options(MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, 1);
- if (!my_mysqli_real_connect($link, $host, 'expiretest', "", $db, $port, $socket)) {
- printf("[005] Cannot connect [%d] %s\n",
- mysqli_connect_errno(), mysqli_connect_error());
- } else {
- $link->query("SELECT id FROM test WHERE id = 1");
- printf("[006] Connect allowed, query fail, [%d] %s\n", $link->errno, $link->error);
- $link->close();
- }
-
- /* allow connect, fix pw */
- $link = mysqli_init();
- $link->options(MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, 1);
- if (!my_mysqli_real_connect($link, $host, 'expiretest', "", $db, $port, $socket)) {
- printf("[007] Cannot connect [%d] %s\n",
- mysqli_connect_errno(), mysqli_connect_error());
- } else {
- if (!$link->query("SET PASSWORD='expiretest'")) {
- $link->query("SET PASSWORD=PASSWORD('expiretest')");
- }
- printf("[008] Connect allowed, pw set, [%d] %s\n", $link->errno, $link->error);
- if ($res = $link->query("SELECT id FROM test WHERE id = 1"))
- var_dump($res->fetch_assoc());
- $link->close();
- }
-
-
- /* check login */
- if (!$link = my_mysqli_connect($host, 'expiretest', "expiretest", $db, $port, $socket)) {
- printf("[001] Cannot connect [%d] %s\n",
- mysqli_connect_errno(), mysqli_connect_error());
- } else {
- $link->query("SELECT id FROM test WHERE id = 1");
- if ($res = $link->query("SELECT id FROM test WHERE id = 1"))
- var_dump($res->fetch_assoc());
- $link->close();
- }
-
-
-
- print "done!";
+ require_once('connect.inc');
+ require_once('table.inc');
+
+ /* default */
+ if (!$link = my_mysqli_connect($host, 'expiretest', "", $db, $port, $socket)) {
+ printf("[001] Cannot connect [%d] %s\n",
+ mysqli_connect_errno(), mysqli_connect_error());
+ } else {
+ $link->query("SELECT id FROM test WHERE id = 1");
+ printf("[002] Connect should fail, [%d] %s\n", $link->errno, $link->error);
+ }
+ /* explicitly requesting default */
+ $link = mysqli_init();
+ $link->options(MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, 0);
+ if (!my_mysqli_real_connect($link, $host, 'expiretest', "", $db, $port, $socket)) {
+ printf("[003] Cannot connect [%d] %s\n",
+ mysqli_connect_errno(), mysqli_connect_error());
+ } else {
+ $link->query("SELECT id FROM test WHERE id = 1");
+ printf("[004] Connect should fail, [%d] %s\n", $link->errno, $link->error);
+ }
+
+ /* allow connect */
+ $link = mysqli_init();
+ $link->options(MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, 1);
+ if (!my_mysqli_real_connect($link, $host, 'expiretest', "", $db, $port, $socket)) {
+ printf("[005] Cannot connect [%d] %s\n",
+ mysqli_connect_errno(), mysqli_connect_error());
+ } else {
+ $link->query("SELECT id FROM test WHERE id = 1");
+ printf("[006] Connect allowed, query fail, [%d] %s\n", $link->errno, $link->error);
+ $link->close();
+ }
+
+ /* allow connect, fix pw */
+ $link = mysqli_init();
+ $link->options(MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, 1);
+ if (!my_mysqli_real_connect($link, $host, 'expiretest', "", $db, $port, $socket)) {
+ printf("[007] Cannot connect [%d] %s\n",
+ mysqli_connect_errno(), mysqli_connect_error());
+ } else {
+ if (!$link->query("SET PASSWORD='expiretest'")) {
+ $link->query("SET PASSWORD=PASSWORD('expiretest')");
+ }
+ printf("[008] Connect allowed, pw set, [%d] %s\n", $link->errno, $link->error);
+ if ($res = $link->query("SELECT id FROM test WHERE id = 1"))
+ var_dump($res->fetch_assoc());
+ $link->close();
+ }
+
+
+ /* check login */
+ if (!$link = my_mysqli_connect($host, 'expiretest', "expiretest", $db, $port, $socket)) {
+ printf("[001] Cannot connect [%d] %s\n",
+ mysqli_connect_errno(), mysqli_connect_error());
+ } else {
+ $link->query("SELECT id FROM test WHERE id = 1");
+ if ($res = $link->query("SELECT id FROM test WHERE id = 1"))
+ var_dump($res->fetch_assoc());
+ $link->close();
+ }
+
+
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_explain_metadata.phpt b/ext/mysqli/tests/mysqli_explain_metadata.phpt
index 157559b340..91ef498c62 100644
--- a/ext/mysqli/tests/mysqli_explain_metadata.phpt
+++ b/ext/mysqli/tests/mysqli_explain_metadata.phpt
@@ -11,149 +11,149 @@ if (!$IS_MYSQLND)
?>
--FILE--
<?php
- require_once('connect.inc');
- require_once('table.inc');
+ require_once('connect.inc');
+ require_once('table.inc');
- if (!$res = mysqli_query($link, 'EXPLAIN SELECT t1.*, t2.* FROM test AS t1, test AS t2'))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, 'EXPLAIN SELECT t1.*, t2.* FROM test AS t1, test AS t2'))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $num_rows = 0;
- $num_fields = 0;
- $field_names = array();
- if (!$row = mysqli_fetch_assoc($res)) {
- printf("[002] Expecting result but got no data [%d] %s\n",
- mysqli_errno($link), mysqli_error($link));
- } else {
- $num_rows++;
- $num_fields = count($row);
- foreach ($row as $name => $value)
- $field_names[$name] = gettype($value);
- }
+ $num_rows = 0;
+ $num_fields = 0;
+ $field_names = array();
+ if (!$row = mysqli_fetch_assoc($res)) {
+ printf("[002] Expecting result but got no data [%d] %s\n",
+ mysqli_errno($link), mysqli_error($link));
+ } else {
+ $num_rows++;
+ $num_fields = count($row);
+ foreach ($row as $name => $value)
+ $field_names[$name] = gettype($value);
+ }
- while ($row = mysqli_fetch_assoc($res))
- $num_rows++;
+ while ($row = mysqli_fetch_assoc($res))
+ $num_rows++;
- if (($tmp = mysqli_num_rows($res)) !== $num_rows) {
- printf("[003] Expecting int/%d got %s/%s\n",
- $num_rows, gettype($tmp), $tmp);
- }
- if (($tmp = mysqli_field_count($link)) !== $num_fields) {
- printf("[004] Expecting int/%d got %s/%s\n",
- $num_fields, gettype($tmp), $tmp);
- }
- $fields = mysqli_fetch_fields($res);
- if (($tmp = count($fields)) !== $num_fields) {
- printf("[005] Expecting int/%d got %s/%s\n",
- $num_fields, gettype($tmp), $tmp);
- }
+ if (($tmp = mysqli_num_rows($res)) !== $num_rows) {
+ printf("[003] Expecting int/%d got %s/%s\n",
+ $num_rows, gettype($tmp), $tmp);
+ }
+ if (($tmp = mysqli_field_count($link)) !== $num_fields) {
+ printf("[004] Expecting int/%d got %s/%s\n",
+ $num_fields, gettype($tmp), $tmp);
+ }
+ $fields = mysqli_fetch_fields($res);
+ if (($tmp = count($fields)) !== $num_fields) {
+ printf("[005] Expecting int/%d got %s/%s\n",
+ $num_fields, gettype($tmp), $tmp);
+ }
- foreach ($fields as $k => $field) {
- $field->max_length = 0;// change it or we will get diff error
- if (isset($field_names[$field->name])) {
- unset($field_names[$field->name]);
- } else {
- printf("[006] Unexpected field '%s', dumping info\n");
- var_dump($field);
- }
- }
- if (!empty($field_names)) {
- printf("[007] Field descriptions missing for the following columns\n");
- var_dump($field_names);
- }
+ foreach ($fields as $k => $field) {
+ $field->max_length = 0;// change it or we will get diff error
+ if (isset($field_names[$field->name])) {
+ unset($field_names[$field->name]);
+ } else {
+ printf("[006] Unexpected field '%s', dumping info\n");
+ var_dump($field);
+ }
+ }
+ if (!empty($field_names)) {
+ printf("[007] Field descriptions missing for the following columns\n");
+ var_dump($field_names);
+ }
- mysqli_free_result($res);
+ mysqli_free_result($res);
- $stmt = mysqli_stmt_init($link);
- /* Depending on your version, the MySQL server migit not support this */
- if ($stmt->prepare('EXPLAIN SELECT t1.*, t2.* FROM test AS t1, test AS t2') && $stmt->execute()) {
- if (!mysqli_stmt_store_result($stmt))
- printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $stmt = mysqli_stmt_init($link);
+ /* Depending on your version, the MySQL server migit not support this */
+ if ($stmt->prepare('EXPLAIN SELECT t1.*, t2.* FROM test AS t1, test AS t2') && $stmt->execute()) {
+ if (!mysqli_stmt_store_result($stmt))
+ printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!$res_meta = mysqli_stmt_result_metadata($stmt))
- printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!$res_meta = mysqli_stmt_result_metadata($stmt))
+ printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (($tmp = mysqli_stmt_num_rows($stmt)) !== $num_rows) {
- printf("[010] Expecting int/%d got %s/%s\n",
- $num_rows, gettype($tmp), $tmp);
- }
- if (($tmp = mysqli_stmt_field_count($stmt)) !== $num_fields) {
- printf("[011] Expecting int/%d got %s/%s\n",
- $num_fields, gettype($tmp), $tmp);
- }
- if (($tmp = mysqli_field_count($link)) !== $num_fields) {
- printf("[013] Expecting int/%d got %s/%s\n",
- $num_fields, gettype($tmp), $tmp);
- }
- if (($tmp = $res_meta->field_count) !== $num_fields) {
- printf("[014] Expecting int/%d got %s/%s\n",
- $num_fields, gettype($tmp), $tmp);
- }
- $fields_res_meta = mysqli_fetch_fields($res_meta);
- if (($tmp = count($fields_res_meta)) !== $num_fields)
- printf("[015] Expecting int/%d got %s/%s\n",
- $num_fields, gettype($tmp), $tmp);
+ if (($tmp = mysqli_stmt_num_rows($stmt)) !== $num_rows) {
+ printf("[010] Expecting int/%d got %s/%s\n",
+ $num_rows, gettype($tmp), $tmp);
+ }
+ if (($tmp = mysqli_stmt_field_count($stmt)) !== $num_fields) {
+ printf("[011] Expecting int/%d got %s/%s\n",
+ $num_fields, gettype($tmp), $tmp);
+ }
+ if (($tmp = mysqli_field_count($link)) !== $num_fields) {
+ printf("[013] Expecting int/%d got %s/%s\n",
+ $num_fields, gettype($tmp), $tmp);
+ }
+ if (($tmp = $res_meta->field_count) !== $num_fields) {
+ printf("[014] Expecting int/%d got %s/%s\n",
+ $num_fields, gettype($tmp), $tmp);
+ }
+ $fields_res_meta = mysqli_fetch_fields($res_meta);
+ if (($tmp = count($fields_res_meta)) !== $num_fields)
+ printf("[015] Expecting int/%d got %s/%s\n",
+ $num_fields, gettype($tmp), $tmp);
- if ($fields_res_meta != $fields) {
- printf("[016] Prepared Statement metadata differs from normal metadata, dumping\n");
- var_dump($fields_res_meta);
- var_dump($fields);
- }
+ if ($fields_res_meta != $fields) {
+ printf("[016] Prepared Statement metadata differs from normal metadata, dumping\n");
+ var_dump($fields_res_meta);
+ var_dump($fields);
+ }
- if (function_exists('mysqli_stmt_get_result') &&
- $stmt->prepare('EXPLAIN SELECT t1.*, t2.* FROM test AS t1, test AS t2') &&
- $stmt->execute()) {
- if (!$res_stmt = mysqli_stmt_get_result($stmt)) {
- printf("[017] Cannot fetch result from PS [%d] %s\n",
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
- if (($tmp = mysqli_num_rows($res_stmt)) !== $num_rows) {
- printf("[018] Expecting int/%d got %s/%s\n",
- $num_rows, gettype($tmp), $tmp);
- }
- if ((mysqli_stmt_num_rows($stmt)) !== 0) {
- printf("[019] Expecting int/0 got %s/%s\n", gettype($tmp), $tmp);
- }
- if (($tmp = mysqli_stmt_field_count($stmt)) !== $num_fields) {
- printf("[020] Expecting int/%d got %s/%s\n",
- $num_fields, gettype($tmp), $tmp);
+ if (function_exists('mysqli_stmt_get_result') &&
+ $stmt->prepare('EXPLAIN SELECT t1.*, t2.* FROM test AS t1, test AS t2') &&
+ $stmt->execute()) {
+ if (!$res_stmt = mysqli_stmt_get_result($stmt)) {
+ printf("[017] Cannot fetch result from PS [%d] %s\n",
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
+ if (($tmp = mysqli_num_rows($res_stmt)) !== $num_rows) {
+ printf("[018] Expecting int/%d got %s/%s\n",
+ $num_rows, gettype($tmp), $tmp);
+ }
+ if ((mysqli_stmt_num_rows($stmt)) !== 0) {
+ printf("[019] Expecting int/0 got %s/%s\n", gettype($tmp), $tmp);
+ }
+ if (($tmp = mysqli_stmt_field_count($stmt)) !== $num_fields) {
+ printf("[020] Expecting int/%d got %s/%s\n",
+ $num_fields, gettype($tmp), $tmp);
- }
- if (($tmp = $res_stmt->field_count) !== $num_fields) {
- printf("[021] Expecting int/%d got %s/%s\n",
- $num_fields, gettype($tmp), $tmp);
- }
+ }
+ if (($tmp = $res_stmt->field_count) !== $num_fields) {
+ printf("[021] Expecting int/%d got %s/%s\n",
+ $num_fields, gettype($tmp), $tmp);
+ }
- $fields_stmt = mysqli_fetch_fields($res_stmt);
- if (($tmp = count($fields_stmt)) !== $num_fields) {
- printf("[022] Expecting int/%d got %s/%s\n",
- $num_fields, gettype($tmp), $tmp);
- }
- reset($fields);
- foreach ($fields_stmt as $fields_stmt_val) {
- $fields_val = current($fields);
- next($fields);
- unset($fields_stmt_val->max_length);
- unset($fields_val->max_length);
- if ($fields_stmt_val != $fields_val) {
- printf("[023] PS mysqli_stmt_get_result() metadata seems wrong, dumping\n");
- var_dump($fields_stmt_val);
- var_dump($fields_val);
- }
- }
+ $fields_stmt = mysqli_fetch_fields($res_stmt);
+ if (($tmp = count($fields_stmt)) !== $num_fields) {
+ printf("[022] Expecting int/%d got %s/%s\n",
+ $num_fields, gettype($tmp), $tmp);
+ }
+ reset($fields);
+ foreach ($fields_stmt as $fields_stmt_val) {
+ $fields_val = current($fields);
+ next($fields);
+ unset($fields_stmt_val->max_length);
+ unset($fields_val->max_length);
+ if ($fields_stmt_val != $fields_val) {
+ printf("[023] PS mysqli_stmt_get_result() metadata seems wrong, dumping\n");
+ var_dump($fields_stmt_val);
+ var_dump($fields_val);
+ }
+ }
/*
- if ($fields_stmt != $fields) {
- printf("[023] PS mysqli_stmt_get_result() metadata seems wrong, dumping\n");
- var_dump($fields_stmt);
- var_dump($fields);
- }
+ if ($fields_stmt != $fields) {
+ printf("[023] PS mysqli_stmt_get_result() metadata seems wrong, dumping\n");
+ var_dump($fields_stmt);
+ var_dump($fields);
+ }
*/
- mysqli_free_result($res_stmt);
- }
- }
- mysqli_stmt_close($stmt);
+ mysqli_free_result($res_stmt);
+ }
+ }
+ mysqli_stmt_close($stmt);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_fetch_all.phpt b/ext/mysqli/tests/mysqli_fetch_all.phpt
index f9a7ee3770..76c6b971f4 100644
--- a/ext/mysqli/tests/mysqli_fetch_all.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_all.phpt
@@ -10,316 +10,306 @@ if (!function_exists('mysqli_fetch_all'))
?>
--FILE--
<?php
- require_once("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_fetch_all()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_fetch_all($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- require('table.inc');
- if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 2")) {
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
-
- print "[005]\n";
- var_dump(mysqli_fetch_all($res));
- mysqli_free_result($res);
-
- if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 2")) {
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
-
- print "[007]\n";
- var_dump(mysqli_fetch_all($res, MYSQLI_NUM));
- mysqli_free_result($res);
-
- if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 2")) {
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
-
- print "[008]\n";
- var_dump(mysqli_fetch_all($res, MYSQLI_BOTH));
- mysqli_free_result($res);
-
- if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 2")) {
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
-
- print "[010]\n";
- var_dump(mysqli_fetch_all($res, MYSQLI_ASSOC));
-
- print "[011]\n";
- var_dump(mysqli_fetch_all($res));
- mysqli_free_result($res);
-
- if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 2")) {
- printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
-
- print "[013]\n";
- var_dump(mysqli_fetch_all($res, MYSQLI_ASSOC));
-
- print "[016]\n";
- var_dump(mysqli_fetch_all($res));
-
- if (!$res = mysqli_query($link, "SELECT 1 AS a, 2 AS a, 3 AS c, 4 AS C, NULL AS d, true AS e")) {
- printf("[010] Cannot run query, [%d] %s\n", mysqli_errno($link), $mysqli_error($link));
- }
- print "[017]\n";
- var_dump(mysqli_fetch_all($res, MYSQLI_BOTH));
-
- mysqli_free_result($res);
- if (!$res = mysqli_query($link, "SELECT 1 AS a, 2 AS b, 3 AS c, 4 AS C")) {
- printf("[018] Cannot run query, [%d] %s\n",
- mysqli_errno($link), $mysqli_error($link));
- exit(1);
- }
-
- do {
- $illegal_mode = mt_rand(-10000, 10000);
- } while (in_array($illegal_mode, array(MYSQLI_ASSOC, MYSQLI_NUM, MYSQLI_BOTH)));
- // NOTE: for BC reasons with ext/mysql, ext/mysqli accepts invalid result modes.
- $tmp = mysqli_fetch_all($res, $illegal_mode);
- if (false !== $tmp)
- printf("[019] Expecting boolean/false although, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
-
- mysqli_free_result($res);
-
- function func_mysqli_fetch_all($link, $engine, $sql_type, $sql_value, $php_value, $offset, $regexp_comparison = NULL) {
-
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
- printf("[%04d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if (!mysqli_query($link, $sql = sprintf("CREATE TABLE test(id INT NOT NULL, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) {
- // don't bail, engine might not support the datatype
- return false;
- }
-
- if (is_null($php_value)) {
- if (!mysqli_query($link, $sql = sprintf("INSERT INTO test(id, label) VALUES (1, NULL)"))) {
- printf("[%04d] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link));
- return false;
- }
- } else {
- if (is_string($sql_value)) {
- if (!mysqli_query($link, $sql = "INSERT INTO test(id, label) VALUES (1, '" . $sql_value . "')")) {
- printf("[%04ds] [%d] %s - %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link), $sql);
- return false;
- }
- } else {
- if (!mysqli_query($link, $sql = sprintf("INSERT INTO test(id, label) VALUES (1, '%d')", $sql_value))) {
- printf("[%04di] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link));
- return false;
- }
- }
- }
-
- if (!$res = mysqli_query($link, "SELECT id, label FROM test")) {
- printf("[%04d] [%d] %s\n", $offset + 2, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if (!$tmp = mysqli_fetch_all($res, MYSQLI_BOTH)) {
- printf("[%04d] [%d] %s\n", $offset + 3, mysqli_errno($link), mysqli_error($link));
- return false;
- }
- $row = $tmp[0];
-
- $fields = mysqli_fetch_fields($res);
-
- if (!(gettype($php_value)=="unicode" && ($fields[1]->flags & 128))) {
-
- if ($regexp_comparison) {
- if (!preg_match($regexp_comparison, (string)$row['label']) || !preg_match($regexp_comparison, (string)$row[1])) {
- printf("[%04d] Expecting %s/%s [reg exp = %s], got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4,
- gettype($php_value), $php_value, $regexp_comparison,
- gettype($row[1]), $row[1],
- gettype($row['label']), $row['label'], mysqli_errno($link), mysqli_error($link));
- return false;
- }
- } else {
- if (($row['label'] !== $php_value) || ($row[1] != $php_value)) {
- printf("[%04d] Expecting %s/%s, got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4,
- gettype($php_value), $php_value,
- gettype($row[1]), $row[1],
- gettype($row['label']), $row['label'], mysqli_errno($link), mysqli_error($link));
- return false;
- }
- }
- }
-
- return true;
- }
-
- function func_mysqli_fetch_array_make_string($len) {
-
- $ret = '';
- for ($i = 0; $i < $len; $i++)
- $ret .= chr(mt_rand(65, 90));
-
- return $ret;
- }
-
- func_mysqli_fetch_all($link, $engine, "TINYINT", -11, "-11", 20);
- func_mysqli_fetch_all($link, $engine, "TINYINT", NULL, NULL, 30);
- func_mysqli_fetch_all($link, $engine, "TINYINT UNSIGNED", 1, "1", 40);
- func_mysqli_fetch_all($link, $engine, "TINYINT UNSIGNED", NULL, NULL, 50);
-
- func_mysqli_fetch_all($link, $engine, "BOOL", 1, "1", 60);
- func_mysqli_fetch_all($link, $engine, "BOOL", NULL, NULL, 70);
- func_mysqli_fetch_all($link, $engine, "BOOLEAN", 0, "0", 80);
- func_mysqli_fetch_all($link, $engine, "BOOLEAN", NULL, NULL, 90);
-
- func_mysqli_fetch_all($link, $engine, "SMALLINT", -32768, "-32768", 100);
- func_mysqli_fetch_all($link, $engine, "SMALLINT", 32767, "32767", 110);
- func_mysqli_fetch_all($link, $engine, "SMALLINT", NULL, NULL, 120);
- func_mysqli_fetch_all($link, $engine, "SMALLINT UNSIGNED", 65535, "65535", 130);
- func_mysqli_fetch_all($link, $engine, "SMALLINT UNSIGNED", NULL, NULL, 140);
-
- func_mysqli_fetch_all($link, $engine, "MEDIUMINT", -8388608, "-8388608", 150);
- func_mysqli_fetch_all($link, $engine, "MEDIUMINT", 8388607, "8388607", 160);
- func_mysqli_fetch_all($link, $engine, "MEDIUMINT", NULL, NULL, 170);
- func_mysqli_fetch_all($link, $engine, "MEDIUMINT UNSIGNED", 16777215, "16777215", 180);
- func_mysqli_fetch_all($link, $engine, "MEDIUMINT UNSIGNED", NULL, NULL, 190);
-
- func_mysqli_fetch_all($link, $engine, "INTEGER", -2147483648, "-2147483648", 200);
- func_mysqli_fetch_all($link, $engine, "INTEGER", 2147483647, "2147483647", 210);
- func_mysqli_fetch_all($link, $engine, "INTEGER", NULL, NULL, 220);
- func_mysqli_fetch_all($link, $engine, "INTEGER UNSIGNED", "4294967295", "4294967295", 230);
- func_mysqli_fetch_all($link, $engine, "INTEGER UNSIGNED", NULL, NULL, 240);
-
- func_mysqli_fetch_all($link, $engine, "BIGINT", "-9223372036854775808", "-9223372036854775808", 250);
-
- func_mysqli_fetch_all($link, $engine, "BIGINT", NULL, NULL, 260);
- func_mysqli_fetch_all($link, $engine, "BIGINT UNSIGNED", "18446744073709551615", "18446744073709551615", 270);
- func_mysqli_fetch_all($link, $engine, "BIGINT UNSIGNED", NULL, NULL, 280);
-
- func_mysqli_fetch_all($link, $engine, "FLOAT", (string)(-9223372036854775808 - 1.1), "-9.22337e+18", 290, "/-9\.22337e\+?[0]?18/iu");
- func_mysqli_fetch_all($link, $engine, "FLOAT", NULL, NULL, 300);
- func_mysqli_fetch_all($link, $engine, "FLOAT UNSIGNED", (string)(18446744073709551615 + 1.1), "1.84467e+19", 310, "/1\.84467e\+?[0]?19/iu");
- func_mysqli_fetch_all($link, $engine, "FLOAT UNSIGNED ", NULL, NULL, 320);
-
- func_mysqli_fetch_all($link, $engine, "DOUBLE(10,2)", "-99999999.99", "-99999999.99", 330);
- func_mysqli_fetch_all($link, $engine, "DOUBLE(10,2)", NULL, NULL, 340);
- func_mysqli_fetch_all($link, $engine, "DOUBLE(10,2) UNSIGNED", "99999999.99", "99999999.99", 350);
- func_mysqli_fetch_all($link, $engine, "DOUBLE(10,2) UNSIGNED", NULL, NULL, 360);
-
- func_mysqli_fetch_all($link, $engine, "DECIMAL(10,2)", "-99999999.99", "-99999999.99", 370);
- func_mysqli_fetch_all($link, $engine, "DECIMAL(10,2)", NULL, NULL, 380);
- func_mysqli_fetch_all($link, $engine, "DECIMAL(10,2)", "99999999.99", "99999999.99", 390);
- func_mysqli_fetch_all($link, $engine, "DECIMAL(10,2)", NULL, NULL, 400);
-
- // don't care about date() strict TZ warnings...
- func_mysqli_fetch_all($link, $engine, "DATE", @date('Y-m-d'), @date('Y-m-d'), 410);
- func_mysqli_fetch_all($link, $engine, "DATE NOT NULL", @date('Y-m-d'), @date('Y-m-d'), 420);
- func_mysqli_fetch_all($link, $engine, "DATE", NULL, NULL, 430);
-
- func_mysqli_fetch_all($link, $engine, "DATETIME", @date('Y-m-d H:i:s'), @date('Y-m-d H:i:s'), 440);
- func_mysqli_fetch_all($link, $engine, "DATETIME NOT NULL", @date('Y-m-d H:i:s'), @date('Y-m-d H:i:s'), 450);
- func_mysqli_fetch_all($link, $engine, "DATETIME", NULL, NULL, 460);
-
- func_mysqli_fetch_all($link, $engine, "TIMESTAMP", @date('Y-m-d H:i:s'), @date('Y-m-d H:i:s'), 470);
-
- func_mysqli_fetch_all($link, $engine, "TIME", @date('H:i:s'), @date('H:i:s'), 480);
- func_mysqli_fetch_all($link, $engine, "TIME NOT NULL", @date('H:i:s'), @date('H:i:s'), 490);
- func_mysqli_fetch_all($link, $engine, "TIME", NULL, NULL, 500);
-
- func_mysqli_fetch_all($link, $engine, "YEAR", @date('Y'), @date('Y'), 510);
- func_mysqli_fetch_all($link, $engine, "YEAR NOT NULL", @date('Y'), @date('Y'), 520);
- func_mysqli_fetch_all($link, $engine, "YEAR", NULL, NULL, 530);
-
- $string255 = func_mysqli_fetch_array_make_string(255);
- func_mysqli_fetch_all($link, $engine, "CHAR(1)", "a", "a", 540);
- func_mysqli_fetch_all($link, $engine, "CHAR(255)", $string255, $string255, 550);
- func_mysqli_fetch_all($link, $engine, "CHAR(1) NOT NULL", "a", "a", 560);
- func_mysqli_fetch_all($link, $engine, "CHAR(1)", NULL, NULL, 570);
-
- $string65k = func_mysqli_fetch_array_make_string(65400);
- func_mysqli_fetch_all($link, $engine, "VARCHAR(1)", "a", "a", 580);
- func_mysqli_fetch_all($link, $engine, "VARCHAR(255)", $string255, $string255, 590);
- func_mysqli_fetch_all($link, $engine, "VARCHAR(65400)", $string65k, $string65k, 600);
- func_mysqli_fetch_all($link, $engine, "VARCHAR(1) NOT NULL", "a", "a", 610);
- func_mysqli_fetch_all($link, $engine, "VARCHAR(1)", NULL, NULL, 620);
-
- func_mysqli_fetch_all($link, $engine, "BINARY(1)", "a", "a", 630);
- func_mysqli_fetch_all($link, $engine, "BINARY(2)", chr(0) . "a", chr(0) . "a", 640);
- func_mysqli_fetch_all($link, $engine, "BINARY(1) NOT NULL", "b", "b", 650);
- func_mysqli_fetch_all($link, $engine, "BINARY(1)", NULL, NULL, 660);
-
- func_mysqli_fetch_all($link, $engine, "VARBINARY(1)", "a", "a", 670);
- func_mysqli_fetch_all($link, $engine, "VARBINARY(2)", chr(0) . "a", chr(0) . "a", 680);
- func_mysqli_fetch_all($link, $engine, "VARBINARY(1) NOT NULL", "b", "b", 690);
- func_mysqli_fetch_all($link, $engine, "VARBINARY(1)", NULL, NULL, 700);
-
- func_mysqli_fetch_all($link, $engine, "TINYBLOB", "a", "a", 710);
- func_mysqli_fetch_all($link, $engine, "TINYBLOB", chr(0) . "a", chr(0) . "a", 720);
- func_mysqli_fetch_all($link, $engine, "TINYBLOB NOT NULL", "b", "b", 730);
- func_mysqli_fetch_all($link, $engine, "TINYBLOB", NULL, NULL, 740);
-
- func_mysqli_fetch_all($link, $engine, "TINYTEXT", "a", "a", 750);
- func_mysqli_fetch_all($link, $engine, "TINYTEXT NOT NULL", "a", "a", 760);
- func_mysqli_fetch_all($link, $engine, "TINYTEXT", NULL, NULL, 770);
-
- func_mysqli_fetch_all($link, $engine, "BLOB", "a", "a", 780);
- func_mysqli_fetch_all($link, $engine, "BLOB", chr(0) . "a", chr(0) . "a", 780);
- func_mysqli_fetch_all($link, $engine, "BLOB", NULL, NULL, 790);
-
- func_mysqli_fetch_all($link, $engine, "TEXT", "a", "a", 800);
- func_mysqli_fetch_all($link, $engine, "TEXT", chr(0) . "a", chr(0) . "a", 810);
- func_mysqli_fetch_all($link, $engine, "TEXT", NULL, NULL, 820);
-
- func_mysqli_fetch_all($link, $engine, "MEDIUMBLOB", "a", "a", 830);
- func_mysqli_fetch_all($link, $engine, "MEDIUMBLOB", chr(0) . "a", chr(0) . "a", 840);
- func_mysqli_fetch_all($link, $engine, "MEDIUMBLOB", NULL, NULL, 850);
-
- func_mysqli_fetch_all($link, $engine, "MEDIUMTEXT", "a", "a", 860);
- func_mysqli_fetch_all($link, $engine, "MEDIUMTEXT", chr(0) . "a", chr(0) . "a", 870);
- func_mysqli_fetch_all($link, $engine, "MEDIUMTEXT", NULL, NULL, 880);
-
- func_mysqli_fetch_all($link, $engine, "LONGBLOB", "a", "a", 890);
- func_mysqli_fetch_all($link, $engine, "LONGTEXT", chr(0) . "a", chr(0) . "a", 900);
- func_mysqli_fetch_all($link, $engine, "LONGBLOB", NULL, NULL, 910);
-
- func_mysqli_fetch_all($link, $engine, "ENUM('a', 'b')", "a", "a", 920);
- func_mysqli_fetch_all($link, $engine, "ENUM('a', 'b')", NULL, NULL, 930);
-
- func_mysqli_fetch_all($link, $engine, "SET('a', 'b')", "a", "a", 940);
- func_mysqli_fetch_all($link, $engine, "SET('a', 'b')", NULL, NULL, 950);
-
- mysqli_close($link);
-
- if (false !== ($tmp = mysqli_fetch_array($res, MYSQLI_ASSOC)))
- printf("[015] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[016] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
-
- if (!$res = mysqli_real_query($link, "SELECT 1 AS _one"))
- printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- /* on mysqlnd level this would not be allowed */
- if (!is_object($res = mysqli_use_result($link)))
- printf("[018] Expecting object, got %s/%s. [%d] %s\n",
- gettype($res), $res, mysqli_errno($link), mysqli_error($link));
-
- $rows = mysqli_fetch_all($res, MYSQLI_ASSOC);
- if (!is_array($rows) || (count($rows) > 1) || !isset($rows[0]['_one']) || ($rows[0]['_one'] != 1)) {
- printf("[019] Results seem wrong, dumping\n");
- var_dump($rows);
- }
-
-
- print "done!";
+ require_once("connect.inc");
+
+ require('table.inc');
+ if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 2")) {
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ print "[005]\n";
+ var_dump(mysqli_fetch_all($res));
+ mysqli_free_result($res);
+
+ if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 2")) {
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ print "[007]\n";
+ var_dump(mysqli_fetch_all($res, MYSQLI_NUM));
+ mysqli_free_result($res);
+
+ if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 2")) {
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ print "[008]\n";
+ var_dump(mysqli_fetch_all($res, MYSQLI_BOTH));
+ mysqli_free_result($res);
+
+ if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 2")) {
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ print "[010]\n";
+ var_dump(mysqli_fetch_all($res, MYSQLI_ASSOC));
+
+ print "[011]\n";
+ var_dump(mysqli_fetch_all($res));
+ mysqli_free_result($res);
+
+ if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 2")) {
+ printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ print "[013]\n";
+ var_dump(mysqli_fetch_all($res, MYSQLI_ASSOC));
+
+ print "[016]\n";
+ var_dump(mysqli_fetch_all($res));
+
+ if (!$res = mysqli_query($link, "SELECT 1 AS a, 2 AS a, 3 AS c, 4 AS C, NULL AS d, true AS e")) {
+ printf("[010] Cannot run query, [%d] %s\n", mysqli_errno($link), $mysqli_error($link));
+ }
+ print "[017]\n";
+ var_dump(mysqli_fetch_all($res, MYSQLI_BOTH));
+
+ mysqli_free_result($res);
+ if (!$res = mysqli_query($link, "SELECT 1 AS a, 2 AS b, 3 AS c, 4 AS C")) {
+ printf("[018] Cannot run query, [%d] %s\n",
+ mysqli_errno($link), $mysqli_error($link));
+ exit(1);
+ }
+
+ do {
+ $illegal_mode = mt_rand(-10000, 10000);
+ } while (in_array($illegal_mode, array(MYSQLI_ASSOC, MYSQLI_NUM, MYSQLI_BOTH)));
+ // NOTE: for BC reasons with ext/mysql, ext/mysqli accepts invalid result modes.
+
+ mysqli_fetch_all($res, $illegal_mode);
+ mysqli_free_result($res);
+
+ function func_mysqli_fetch_all($link, $engine, $sql_type, $sql_value, $php_value, $offset, $regexp_comparison = NULL) {
+
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
+ printf("[%04d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if (!mysqli_query($link, $sql = sprintf("CREATE TABLE test(id INT NOT NULL, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) {
+ // don't bail, engine might not support the datatype
+ return false;
+ }
+
+ if (is_null($php_value)) {
+ if (!mysqli_query($link, $sql = sprintf("INSERT INTO test(id, label) VALUES (1, NULL)"))) {
+ printf("[%04d] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+ } else {
+ if (is_string($sql_value)) {
+ if (!mysqli_query($link, $sql = "INSERT INTO test(id, label) VALUES (1, '" . $sql_value . "')")) {
+ printf("[%04ds] [%d] %s - %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link), $sql);
+ return false;
+ }
+ } else {
+ if (!mysqli_query($link, $sql = sprintf("INSERT INTO test(id, label) VALUES (1, '%d')", $sql_value))) {
+ printf("[%04di] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+ }
+ }
+
+ if (!$res = mysqli_query($link, "SELECT id, label FROM test")) {
+ printf("[%04d] [%d] %s\n", $offset + 2, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if (!$tmp = mysqli_fetch_all($res, MYSQLI_BOTH)) {
+ printf("[%04d] [%d] %s\n", $offset + 3, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+ $row = $tmp[0];
+
+ $fields = mysqli_fetch_fields($res);
+
+ if (!(gettype($php_value)=="unicode" && ($fields[1]->flags & 128))) {
+
+ if ($regexp_comparison) {
+ if (!preg_match($regexp_comparison, (string)$row['label']) || !preg_match($regexp_comparison, (string)$row[1])) {
+ printf("[%04d] Expecting %s/%s [reg exp = %s], got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4,
+ gettype($php_value), $php_value, $regexp_comparison,
+ gettype($row[1]), $row[1],
+ gettype($row['label']), $row['label'], mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+ } else {
+ if (($row['label'] !== $php_value) || ($row[1] != $php_value)) {
+ printf("[%04d] Expecting %s/%s, got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4,
+ gettype($php_value), $php_value,
+ gettype($row[1]), $row[1],
+ gettype($row['label']), $row['label'], mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ function func_mysqli_fetch_array_make_string($len) {
+
+ $ret = '';
+ for ($i = 0; $i < $len; $i++)
+ $ret .= chr(mt_rand(65, 90));
+
+ return $ret;
+ }
+
+ func_mysqli_fetch_all($link, $engine, "TINYINT", -11, "-11", 20);
+ func_mysqli_fetch_all($link, $engine, "TINYINT", NULL, NULL, 30);
+ func_mysqli_fetch_all($link, $engine, "TINYINT UNSIGNED", 1, "1", 40);
+ func_mysqli_fetch_all($link, $engine, "TINYINT UNSIGNED", NULL, NULL, 50);
+
+ func_mysqli_fetch_all($link, $engine, "BOOL", 1, "1", 60);
+ func_mysqli_fetch_all($link, $engine, "BOOL", NULL, NULL, 70);
+ func_mysqli_fetch_all($link, $engine, "BOOLEAN", 0, "0", 80);
+ func_mysqli_fetch_all($link, $engine, "BOOLEAN", NULL, NULL, 90);
+
+ func_mysqli_fetch_all($link, $engine, "SMALLINT", -32768, "-32768", 100);
+ func_mysqli_fetch_all($link, $engine, "SMALLINT", 32767, "32767", 110);
+ func_mysqli_fetch_all($link, $engine, "SMALLINT", NULL, NULL, 120);
+ func_mysqli_fetch_all($link, $engine, "SMALLINT UNSIGNED", 65535, "65535", 130);
+ func_mysqli_fetch_all($link, $engine, "SMALLINT UNSIGNED", NULL, NULL, 140);
+
+ func_mysqli_fetch_all($link, $engine, "MEDIUMINT", -8388608, "-8388608", 150);
+ func_mysqli_fetch_all($link, $engine, "MEDIUMINT", 8388607, "8388607", 160);
+ func_mysqli_fetch_all($link, $engine, "MEDIUMINT", NULL, NULL, 170);
+ func_mysqli_fetch_all($link, $engine, "MEDIUMINT UNSIGNED", 16777215, "16777215", 180);
+ func_mysqli_fetch_all($link, $engine, "MEDIUMINT UNSIGNED", NULL, NULL, 190);
+
+ func_mysqli_fetch_all($link, $engine, "INTEGER", -2147483648, "-2147483648", 200);
+ func_mysqli_fetch_all($link, $engine, "INTEGER", 2147483647, "2147483647", 210);
+ func_mysqli_fetch_all($link, $engine, "INTEGER", NULL, NULL, 220);
+ func_mysqli_fetch_all($link, $engine, "INTEGER UNSIGNED", "4294967295", "4294967295", 230);
+ func_mysqli_fetch_all($link, $engine, "INTEGER UNSIGNED", NULL, NULL, 240);
+
+ func_mysqli_fetch_all($link, $engine, "BIGINT", "-9223372036854775808", "-9223372036854775808", 250);
+
+ func_mysqli_fetch_all($link, $engine, "BIGINT", NULL, NULL, 260);
+ func_mysqli_fetch_all($link, $engine, "BIGINT UNSIGNED", "18446744073709551615", "18446744073709551615", 270);
+ func_mysqli_fetch_all($link, $engine, "BIGINT UNSIGNED", NULL, NULL, 280);
+
+ func_mysqli_fetch_all($link, $engine, "FLOAT", (string)(-9223372036854775808 - 1.1), "-9.22337e+18", 290, "/-9\.22337e\+?[0]?18/iu");
+ func_mysqli_fetch_all($link, $engine, "FLOAT", NULL, NULL, 300);
+ func_mysqli_fetch_all($link, $engine, "FLOAT UNSIGNED", (string)(18446744073709551615 + 1.1), "1.84467e+19", 310, "/1\.84467e\+?[0]?19/iu");
+ func_mysqli_fetch_all($link, $engine, "FLOAT UNSIGNED ", NULL, NULL, 320);
+
+ func_mysqli_fetch_all($link, $engine, "DOUBLE(10,2)", "-99999999.99", "-99999999.99", 330);
+ func_mysqli_fetch_all($link, $engine, "DOUBLE(10,2)", NULL, NULL, 340);
+ func_mysqli_fetch_all($link, $engine, "DOUBLE(10,2) UNSIGNED", "99999999.99", "99999999.99", 350);
+ func_mysqli_fetch_all($link, $engine, "DOUBLE(10,2) UNSIGNED", NULL, NULL, 360);
+
+ func_mysqli_fetch_all($link, $engine, "DECIMAL(10,2)", "-99999999.99", "-99999999.99", 370);
+ func_mysqli_fetch_all($link, $engine, "DECIMAL(10,2)", NULL, NULL, 380);
+ func_mysqli_fetch_all($link, $engine, "DECIMAL(10,2)", "99999999.99", "99999999.99", 390);
+ func_mysqli_fetch_all($link, $engine, "DECIMAL(10,2)", NULL, NULL, 400);
+
+ // don't care about date() strict TZ warnings...
+ func_mysqli_fetch_all($link, $engine, "DATE", @date('Y-m-d'), @date('Y-m-d'), 410);
+ func_mysqli_fetch_all($link, $engine, "DATE NOT NULL", @date('Y-m-d'), @date('Y-m-d'), 420);
+ func_mysqli_fetch_all($link, $engine, "DATE", NULL, NULL, 430);
+
+ func_mysqli_fetch_all($link, $engine, "DATETIME", @date('Y-m-d H:i:s'), @date('Y-m-d H:i:s'), 440);
+ func_mysqli_fetch_all($link, $engine, "DATETIME NOT NULL", @date('Y-m-d H:i:s'), @date('Y-m-d H:i:s'), 450);
+ func_mysqli_fetch_all($link, $engine, "DATETIME", NULL, NULL, 460);
+
+ func_mysqli_fetch_all($link, $engine, "TIMESTAMP", @date('Y-m-d H:i:s'), @date('Y-m-d H:i:s'), 470);
+
+ func_mysqli_fetch_all($link, $engine, "TIME", @date('H:i:s'), @date('H:i:s'), 480);
+ func_mysqli_fetch_all($link, $engine, "TIME NOT NULL", @date('H:i:s'), @date('H:i:s'), 490);
+ func_mysqli_fetch_all($link, $engine, "TIME", NULL, NULL, 500);
+
+ func_mysqli_fetch_all($link, $engine, "YEAR", @date('Y'), @date('Y'), 510);
+ func_mysqli_fetch_all($link, $engine, "YEAR NOT NULL", @date('Y'), @date('Y'), 520);
+ func_mysqli_fetch_all($link, $engine, "YEAR", NULL, NULL, 530);
+
+ $string255 = func_mysqli_fetch_array_make_string(255);
+ func_mysqli_fetch_all($link, $engine, "CHAR(1)", "a", "a", 540);
+ func_mysqli_fetch_all($link, $engine, "CHAR(255)", $string255, $string255, 550);
+ func_mysqli_fetch_all($link, $engine, "CHAR(1) NOT NULL", "a", "a", 560);
+ func_mysqli_fetch_all($link, $engine, "CHAR(1)", NULL, NULL, 570);
+
+ $string65k = func_mysqli_fetch_array_make_string(65400);
+ func_mysqli_fetch_all($link, $engine, "VARCHAR(1)", "a", "a", 580);
+ func_mysqli_fetch_all($link, $engine, "VARCHAR(255)", $string255, $string255, 590);
+ func_mysqli_fetch_all($link, $engine, "VARCHAR(65400)", $string65k, $string65k, 600);
+ func_mysqli_fetch_all($link, $engine, "VARCHAR(1) NOT NULL", "a", "a", 610);
+ func_mysqli_fetch_all($link, $engine, "VARCHAR(1)", NULL, NULL, 620);
+
+ func_mysqli_fetch_all($link, $engine, "BINARY(1)", "a", "a", 630);
+ func_mysqli_fetch_all($link, $engine, "BINARY(2)", chr(0) . "a", chr(0) . "a", 640);
+ func_mysqli_fetch_all($link, $engine, "BINARY(1) NOT NULL", "b", "b", 650);
+ func_mysqli_fetch_all($link, $engine, "BINARY(1)", NULL, NULL, 660);
+
+ func_mysqli_fetch_all($link, $engine, "VARBINARY(1)", "a", "a", 670);
+ func_mysqli_fetch_all($link, $engine, "VARBINARY(2)", chr(0) . "a", chr(0) . "a", 680);
+ func_mysqli_fetch_all($link, $engine, "VARBINARY(1) NOT NULL", "b", "b", 690);
+ func_mysqli_fetch_all($link, $engine, "VARBINARY(1)", NULL, NULL, 700);
+
+ func_mysqli_fetch_all($link, $engine, "TINYBLOB", "a", "a", 710);
+ func_mysqli_fetch_all($link, $engine, "TINYBLOB", chr(0) . "a", chr(0) . "a", 720);
+ func_mysqli_fetch_all($link, $engine, "TINYBLOB NOT NULL", "b", "b", 730);
+ func_mysqli_fetch_all($link, $engine, "TINYBLOB", NULL, NULL, 740);
+
+ func_mysqli_fetch_all($link, $engine, "TINYTEXT", "a", "a", 750);
+ func_mysqli_fetch_all($link, $engine, "TINYTEXT NOT NULL", "a", "a", 760);
+ func_mysqli_fetch_all($link, $engine, "TINYTEXT", NULL, NULL, 770);
+
+ func_mysqli_fetch_all($link, $engine, "BLOB", "a", "a", 780);
+ func_mysqli_fetch_all($link, $engine, "BLOB", chr(0) . "a", chr(0) . "a", 780);
+ func_mysqli_fetch_all($link, $engine, "BLOB", NULL, NULL, 790);
+
+ func_mysqli_fetch_all($link, $engine, "TEXT", "a", "a", 800);
+ func_mysqli_fetch_all($link, $engine, "TEXT", chr(0) . "a", chr(0) . "a", 810);
+ func_mysqli_fetch_all($link, $engine, "TEXT", NULL, NULL, 820);
+
+ func_mysqli_fetch_all($link, $engine, "MEDIUMBLOB", "a", "a", 830);
+ func_mysqli_fetch_all($link, $engine, "MEDIUMBLOB", chr(0) . "a", chr(0) . "a", 840);
+ func_mysqli_fetch_all($link, $engine, "MEDIUMBLOB", NULL, NULL, 850);
+
+ func_mysqli_fetch_all($link, $engine, "MEDIUMTEXT", "a", "a", 860);
+ func_mysqli_fetch_all($link, $engine, "MEDIUMTEXT", chr(0) . "a", chr(0) . "a", 870);
+ func_mysqli_fetch_all($link, $engine, "MEDIUMTEXT", NULL, NULL, 880);
+
+ func_mysqli_fetch_all($link, $engine, "LONGBLOB", "a", "a", 890);
+ func_mysqli_fetch_all($link, $engine, "LONGTEXT", chr(0) . "a", chr(0) . "a", 900);
+ func_mysqli_fetch_all($link, $engine, "LONGBLOB", NULL, NULL, 910);
+
+ func_mysqli_fetch_all($link, $engine, "ENUM('a', 'b')", "a", "a", 920);
+ func_mysqli_fetch_all($link, $engine, "ENUM('a', 'b')", NULL, NULL, 930);
+
+ func_mysqli_fetch_all($link, $engine, "SET('a', 'b')", "a", "a", 940);
+ func_mysqli_fetch_all($link, $engine, "SET('a', 'b')", NULL, NULL, 950);
+
+ mysqli_close($link);
+
+ try {
+ mysqli_fetch_array($res, MYSQLI_ASSOC);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[016] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
+
+ if (!$res = mysqli_real_query($link, "SELECT 1 AS _one"))
+ printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ /* on mysqlnd level this would not be allowed */
+ if (!is_object($res = mysqli_use_result($link)))
+ printf("[018] Expecting object, got %s/%s. [%d] %s\n",
+ gettype($res), $res, mysqli_errno($link), mysqli_error($link));
+
+ $rows = mysqli_fetch_all($res, MYSQLI_ASSOC);
+ if (!is_array($rows) || (count($rows) > 1) || !isset($rows[0]['_one']) || ($rows[0]['_one'] != 1)) {
+ printf("[019] Results seem wrong, dumping\n");
+ var_dump($rows);
+ }
+
+ print "done!";
?>
--CLEAN--
<?php
@@ -455,6 +445,5 @@ array(1) {
}
Warning: mysqli_fetch_all(): Mode can be only MYSQLI_FETCH_NUM, MYSQLI_FETCH_ASSOC or MYSQLI_FETCH_BOTH in %s on line %d
-
-Warning: mysqli_fetch_array(): Couldn't fetch mysqli_result in %s on line %d
+mysqli_result object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_fetch_all_oo.phpt b/ext/mysqli/tests/mysqli_fetch_all_oo.phpt
index 9dac357ae1..992a61a348 100644
--- a/ext/mysqli/tests/mysqli_fetch_all_oo.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_all_oo.phpt
@@ -11,297 +11,300 @@ if (!function_exists('mysqli_fetch_all'))
?>
--FILE--
<?php
- require_once("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
-
- $mysqli = new mysqli();
-
- if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
-
- require('table.inc');
- if (!$res = $mysqli->query("SELECT * FROM test ORDER BY id LIMIT 2")) {
- printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
-
- print "[005]\n";
- var_dump($res->fetch_all());
- $res->free_result();
-
- if (!$res = $mysqli->query("SELECT * FROM test ORDER BY id LIMIT 2")) {
- printf("[006] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
-
- print "[007]\n";
- var_dump($res->fetch_all(MYSQLI_NUM));
- $res->free_result();
-
- if (!$res = $mysqli->query("SELECT * FROM test ORDER BY id LIMIT 2")) {
- printf("[008] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
-
- print "[008]\n";
- var_dump($res->fetch_all(MYSQLI_BOTH));
- $res->free_result();
-
- if (!$res = $mysqli->query("SELECT * FROM test ORDER BY id LIMIT 2")) {
- printf("[009] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
-
- print "[010]\n";
- var_dump($res->fetch_all(MYSQLI_ASSOC));
-
- print "[011]\n";
- var_dump($res->fetch_array());
- $res->free_result();
-
- if (!$res = $mysqli->query("SELECT * FROM test ORDER BY id LIMIT 2")) {
- printf("[012] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
-
- print "[013]\n";
- var_dump($res->fetch_all(MYSQLI_ASSOC));
-
- print "[016]\n";
- var_dump($res->fetch_array());
-
- if (!$res = $mysqli->query("SELECT 1 AS a, 2 AS a, 3 AS c, 4 AS C, NULL AS d, true AS e")) {
- printf("[010] Cannot run query, [%d] %s\n", $mysqli->errno, $$mysqli->error);
- }
- print "[017]\n";
- var_dump($res->fetch_all(MYSQLI_BOTH));
-
- $res->free_result();
- if (!$res = $mysqli->query("SELECT 1 AS a, 2 AS b, 3 AS c, 4 AS C")) {
- printf("[018] Cannot run query, [%d] %s\n",
- $mysqli->errno, $$mysqli->error);
- exit(1);
- }
-
- do {
- $illegal_mode = mt_rand(-10000, 10000);
- } while (in_array($illegal_mode, array(MYSQLI_ASSOC, MYSQLI_NUM, MYSQLI_BOTH)));
- // NOTE: for BC reasons with ext/mysql, ext/mysqli accepts invalid result modes.
- $tmp = $res->fetch_all($illegal_mode);
- if (false !== $tmp)
- printf("[019] Expecting boolean/false although, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, $mysqli->errno, $mysqli->error);
-
- $res->free_result();
-
- function func_mysqli_fetch_all_oo($link, $engine, $sql_type, $sql_value, $php_value, $offset, $regexp_comparison = NULL) {
-
- if (!$link->query("DROP TABLE IF EXISTS test")) {
- printf("[%04d] [%d] %s\n", $offset, $link->errno, $link->error);
- return false;
- }
-
- if (!$link->query($sql = sprintf("CREATE TABLE test(id INT NOT NULL, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) {
- // don't bail, engine might not support the datatype
- return false;
- }
-
- if (is_null($php_value)) {
- if (!$link->query($sql = sprintf("INSERT INTO test(id, label) VALUES (1, NULL)"))) {
- printf("[%04d] [%d] %s\n", $offset + 1, $link->errno, $link->error);
- return false;
- }
- } else {
- if (is_string($sql_value)) {
- if (!$link->query($sql = "INSERT INTO test(id, label) VALUES (1, '" . $sql_value . "')")) {
- printf("[%04ds] [%d] %s - %s\n", $offset + 1, $link->errno, $link->error, $sql);
- return false;
- }
- } else {
- if (!$link->query($sql = sprintf("INSERT INTO test(id, label) VALUES (1, '%d')", $sql_value))) {
- printf("[%04di] [%d] %s\n", $offset + 1, $link->errno, $link->error);
- return false;
- }
- }
- }
-
- if (!$res = $link->query("SELECT id, label FROM test")) {
- printf("[%04d] [%d] %s\n", $offset + 2, $link->errno, $link->error);
- return false;
- }
-
- if (!$tmp = $res->fetch_all(MYSQLI_BOTH)) {
- printf("[%04d] [%d] %s\n", $offset + 3, $link->errno, $link->error);
- return false;
- }
- $row = $tmp[0];
-
- $fields = mysqli_fetch_fields($res);
-
- if (!(gettype($php_value)=="unicode" && ($fields[1]->flags & 128))) {
- if ($regexp_comparison) {
- if (!preg_match($regexp_comparison, (string)$row['label']) || !preg_match($regexp_comparison, (string)$row[1])) {
- printf("[%04d] Expecting %s/%s [reg exp = %s], got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4,
- gettype($php_value), $php_value, $regexp_comparison,
- gettype($row[1]), $row[1],
- gettype($row['label']), $row['label'], $link->errno, $link->error);
- return false;
- }
- } else {
- if (($row['label'] !== $php_value) || ($row[1] != $php_value)) {
- printf("[%04d] Expecting %s/%s, got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4,
- gettype($php_value), $php_value,
- gettype($row[1]), $row[1],
- gettype($row['label']), $row['label'], $link->errno, $link->error);
- return false;
- }
- }
- }
-
- return true;
- }
-
- function func_mysqli_fetch_array_oo_make_string($len) {
-
- $ret = '';
- for ($i = 0; $i < $len; $i++)
- $ret .= chr(mt_rand(65, 90));
-
- return $ret;
- }
-
- func_mysqli_fetch_all_oo($link, $engine, "TINYINT", -11, "-11", 20);
- func_mysqli_fetch_all_oo($link, $engine, "TINYINT", NULL, NULL, 30);
- func_mysqli_fetch_all_oo($link, $engine, "TINYINT UNSIGNED", 1, "1", 40);
- func_mysqli_fetch_all_oo($link, $engine, "TINYINT UNSIGNED", NULL, NULL, 50);
-
- func_mysqli_fetch_all_oo($link, $engine, "BOOL", 1, "1", 60);
- func_mysqli_fetch_all_oo($link, $engine, "BOOL", NULL, NULL, 70);
- func_mysqli_fetch_all_oo($link, $engine, "BOOLEAN", 0, "0", 80);
- func_mysqli_fetch_all_oo($link, $engine, "BOOLEAN", NULL, NULL, 90);
-
- func_mysqli_fetch_all_oo($link, $engine, "SMALLINT", -32768, "-32768", 100);
- func_mysqli_fetch_all_oo($link, $engine, "SMALLINT", 32767, "32767", 110);
- func_mysqli_fetch_all_oo($link, $engine, "SMALLINT", NULL, NULL, 120);
- func_mysqli_fetch_all_oo($link, $engine, "SMALLINT UNSIGNED", 65400, "65400", 130);
- func_mysqli_fetch_all_oo($link, $engine, "SMALLINT UNSIGNED", NULL, NULL, 140);
-
- func_mysqli_fetch_all_oo($link, $engine, "MEDIUMINT", -8388608, "-8388608", 150);
- func_mysqli_fetch_all_oo($link, $engine, "MEDIUMINT", 8388607, "8388607", 160);
- func_mysqli_fetch_all_oo($link, $engine, "MEDIUMINT", NULL, NULL, 170);
- func_mysqli_fetch_all_oo($link, $engine, "MEDIUMINT UNSIGNED", 16777215, "16777215", 180);
- func_mysqli_fetch_all_oo($link, $engine, "MEDIUMINT UNSIGNED", NULL, NULL, 190);
-
- func_mysqli_fetch_all_oo($link, $engine, "INTEGER", -2147483648, "-2147483648", 200);
- func_mysqli_fetch_all_oo($link, $engine, "INTEGER", 2147483647, "2147483647", 210);
- func_mysqli_fetch_all_oo($link, $engine, "INTEGER", NULL, NULL, 220);
- func_mysqli_fetch_all_oo($link, $engine, "INTEGER UNSIGNED", "4294967295", "4294967295", 230);
- func_mysqli_fetch_all_oo($link, $engine, "INTEGER UNSIGNED", NULL, NULL, 240);
-
- func_mysqli_fetch_all_oo($link, $engine, "BIGINT", "-9223372036854775808", "-9223372036854775808", 250);
- func_mysqli_fetch_all_oo($link, $engine, "BIGINT", NULL, NULL, 260);
- func_mysqli_fetch_all_oo($link, $engine, "BIGINT UNSIGNED", "18446744073709551615", "18446744073709551615", 270);
- func_mysqli_fetch_all_oo($link, $engine, "BIGINT UNSIGNED", NULL, NULL, 280);
-
- func_mysqli_fetch_all_oo($link, $engine, "FLOAT", (string)(-9223372036854775808 - 1.1), "-9.22337e+18", 290, "/-9\.22337e\+?[0]?18/iu");
- func_mysqli_fetch_all_oo($link, $engine, "FLOAT", NULL, NULL, 300);
- func_mysqli_fetch_all_oo($link, $engine, "FLOAT UNSIGNED", (string)(18446744073709551615 + 1.1), "1.84467e+?19", 310, "/1\.84467e\+?[0]?19/iu");
- func_mysqli_fetch_all_oo($link, $engine, "FLOAT UNSIGNED ", NULL, NULL, 320);
-
- func_mysqli_fetch_all_oo($link, $engine, "DOUBLE(10,2)", "-99999999.99", "-99999999.99", 330);
- func_mysqli_fetch_all_oo($link, $engine, "DOUBLE(10,2)", NULL, NULL, 340);
- func_mysqli_fetch_all_oo($link, $engine, "DOUBLE(10,2) UNSIGNED", "99999999.99", "99999999.99", 350);
- func_mysqli_fetch_all_oo($link, $engine, "DOUBLE(10,2) UNSIGNED", NULL, NULL, 360);
-
- func_mysqli_fetch_all_oo($link, $engine, "DECIMAL(10,2)", "-99999999.99", "-99999999.99", 370);
- func_mysqli_fetch_all_oo($link, $engine, "DECIMAL(10,2)", NULL, NULL, 380);
- func_mysqli_fetch_all_oo($link, $engine, "DECIMAL(10,2)", "99999999.99", "99999999.99", 390);
- func_mysqli_fetch_all_oo($link, $engine, "DECIMAL(10,2)", NULL, NULL, 400);
-
- // don't care about date() strict TZ warnings...
- $date = @date('Y-m-d');
- func_mysqli_fetch_all_oo($link, $engine, "DATE", $date, $date, 410);
- func_mysqli_fetch_all_oo($link, $engine, "DATE NOT NULL", $date, $date, 420);
- func_mysqli_fetch_all_oo($link, $engine, "DATE", NULL, NULL, 430);
-
- $datetime = @date('Y-m-d H:i:s');
- func_mysqli_fetch_all_oo($link, $engine, "DATETIME", $datetime, $datetime, 440);
- func_mysqli_fetch_all_oo($link, $engine, "DATETIME NOT NULL", $datetime, $datetime, 450);
- func_mysqli_fetch_all_oo($link, $engine, "DATETIME", NULL, NULL, 460);
-
- func_mysqli_fetch_all_oo($link, $engine, "TIMESTAMP", $datetime, $datetime, 470);
-
- $time = @date('H:i:s');
- func_mysqli_fetch_all_oo($link, $engine, "TIME", $time, $time, 480);
- func_mysqli_fetch_all_oo($link, $engine, "TIME NOT NULL", $time, $time, 490);
- func_mysqli_fetch_all_oo($link, $engine, "TIME", NULL, NULL, 500);
-
- func_mysqli_fetch_all_oo($link, $engine, "YEAR", @date('Y'), @date('Y'), 510);
- func_mysqli_fetch_all_oo($link, $engine, "YEAR NOT NULL", @date('Y'), @date('Y'), 520);
- func_mysqli_fetch_all_oo($link, $engine, "YEAR", NULL, NULL, 530);
-
- $string255 = func_mysqli_fetch_array_oo_make_string(255);
- func_mysqli_fetch_all_oo($link, $engine, "CHAR(1)", "a", "a", 540);
- func_mysqli_fetch_all_oo($link, $engine, "CHAR(255)", $string255, $string255, 550);
- func_mysqli_fetch_all_oo($link, $engine, "CHAR(1) NOT NULL", "a", "a", 560);
- func_mysqli_fetch_all_oo($link, $engine, "CHAR(1)", NULL, NULL, 570);
-
- $string65k = func_mysqli_fetch_array_oo_make_string(65400);
- func_mysqli_fetch_all_oo($link, $engine, "VARCHAR(1)", "a", "a", 580);
- func_mysqli_fetch_all_oo($link, $engine, "VARCHAR(255)", $string255, $string255, 590);
- func_mysqli_fetch_all_oo($link, $engine, "VARCHAR(65400)", $string65k, $string65k, 600);
- func_mysqli_fetch_all_oo($link, $engine, "VARCHAR(1) NOT NULL", "a", "a", 610);
- func_mysqli_fetch_all_oo($link, $engine, "VARCHAR(1)", NULL, NULL, 620);
-
- func_mysqli_fetch_all_oo($link, $engine, "BINARY(1)", "a", "a", 630);
- func_mysqli_fetch_all_oo($link, $engine, "BINARY(2)", chr(0) . "a", chr(0) . "a", 640);
- func_mysqli_fetch_all_oo($link, $engine, "BINARY(1) NOT NULL", "b", "b", 650);
- func_mysqli_fetch_all_oo($link, $engine, "BINARY(1)", NULL, NULL, 660);
-
- func_mysqli_fetch_all_oo($link, $engine, "VARBINARY(1)", "a", "a", 670);
- func_mysqli_fetch_all_oo($link, $engine, "VARBINARY(2)", chr(0) . "a", chr(0) . "a", 680);
- func_mysqli_fetch_all_oo($link, $engine, "VARBINARY(1) NOT NULL", "b", "b", 690);
- func_mysqli_fetch_all_oo($link, $engine, "VARBINARY(1)", NULL, NULL, 700);
-
- func_mysqli_fetch_all_oo($link, $engine, "TINYBLOB", "a", "a", 710);
- func_mysqli_fetch_all_oo($link, $engine, "TINYBLOB", chr(0) . "a", chr(0) . "a", 720);
- func_mysqli_fetch_all_oo($link, $engine, "TINYBLOB NOT NULL", "b", "b", 730);
- func_mysqli_fetch_all_oo($link, $engine, "TINYBLOB", NULL, NULL, 740);
-
- func_mysqli_fetch_all_oo($link, $engine, "TINYTEXT", "a", "a", 750);
- func_mysqli_fetch_all_oo($link, $engine, "TINYTEXT NOT NULL", "a", "a", 760);
- func_mysqli_fetch_all_oo($link, $engine, "TINYTEXT", NULL, NULL, 770);
-
- func_mysqli_fetch_all_oo($link, $engine, "BLOB", "a", "a", 780);
- func_mysqli_fetch_all_oo($link, $engine, "BLOB", chr(0) . "a", chr(0) . "a", 780);
- func_mysqli_fetch_all_oo($link, $engine, "BLOB", NULL, NULL, 790);
-
- func_mysqli_fetch_all_oo($link, $engine, "TEXT", "a", "a", 800);
- func_mysqli_fetch_all_oo($link, $engine, "TEXT", chr(0) . "a", chr(0) . "a", 810);
- func_mysqli_fetch_all_oo($link, $engine, "TEXT", NULL, NULL, 820);
-
- func_mysqli_fetch_all_oo($link, $engine, "MEDIUMBLOB", "a", "a", 830);
- func_mysqli_fetch_all_oo($link, $engine, "MEDIUMBLOB", chr(0) . "a", chr(0) . "a", 840);
- func_mysqli_fetch_all_oo($link, $engine, "MEDIUMBLOB", NULL, NULL, 850);
-
- func_mysqli_fetch_all_oo($link, $engine, "MEDIUMTEXT", "a", "a", 860);
- func_mysqli_fetch_all_oo($link, $engine, "MEDIUMTEXT", chr(0) . "a", chr(0) . "a", 870);
- func_mysqli_fetch_all_oo($link, $engine, "MEDIUMTEXT", NULL, NULL, 880);
-
- func_mysqli_fetch_all_oo($link, $engine, "LONGBLOB", "a", "a", 890);
- func_mysqli_fetch_all_oo($link, $engine, "LONGTEXT", chr(0) . "a", chr(0) . "a", 900);
- func_mysqli_fetch_all_oo($link, $engine, "LONGBLOB", NULL, NULL, 910);
-
- func_mysqli_fetch_all_oo($link, $engine, "ENUM('a', 'b')", "a", "a", 920);
- func_mysqli_fetch_all_oo($link, $engine, "ENUM('a', 'b')", NULL, NULL, 930);
-
- func_mysqli_fetch_all_oo($link, $engine, "SET('a', 'b')", "a", "a", 940);
- func_mysqli_fetch_all_oo($link, $engine, "SET('a', 'b')", NULL, NULL, 950);
-
- mysqli_close($link);
-
- if (false !== ($tmp = $res->fetch_array(MYSQLI_ASSOC)))
- printf("[015] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!";
+ require_once("connect.inc");
+
+ $tmp = NULL;
+ $link = NULL;
+
+ $mysqli = new mysqli();
+
+ if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+
+ require('table.inc');
+ if (!$res = $mysqli->query("SELECT * FROM test ORDER BY id LIMIT 2")) {
+ printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
+
+ print "[005]\n";
+ var_dump($res->fetch_all());
+ $res->free_result();
+
+ if (!$res = $mysqli->query("SELECT * FROM test ORDER BY id LIMIT 2")) {
+ printf("[006] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
+
+ print "[007]\n";
+ var_dump($res->fetch_all(MYSQLI_NUM));
+ $res->free_result();
+
+ if (!$res = $mysqli->query("SELECT * FROM test ORDER BY id LIMIT 2")) {
+ printf("[008] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
+
+ print "[008]\n";
+ var_dump($res->fetch_all(MYSQLI_BOTH));
+ $res->free_result();
+
+ if (!$res = $mysqli->query("SELECT * FROM test ORDER BY id LIMIT 2")) {
+ printf("[009] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
+
+ print "[010]\n";
+ var_dump($res->fetch_all(MYSQLI_ASSOC));
+
+ print "[011]\n";
+ var_dump($res->fetch_array());
+ $res->free_result();
+
+ if (!$res = $mysqli->query("SELECT * FROM test ORDER BY id LIMIT 2")) {
+ printf("[012] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
+
+ print "[013]\n";
+ var_dump($res->fetch_all(MYSQLI_ASSOC));
+
+ print "[016]\n";
+ var_dump($res->fetch_array());
+
+ if (!$res = $mysqli->query("SELECT 1 AS a, 2 AS a, 3 AS c, 4 AS C, NULL AS d, true AS e")) {
+ printf("[010] Cannot run query, [%d] %s\n", $mysqli->errno, $$mysqli->error);
+ }
+ print "[017]\n";
+ var_dump($res->fetch_all(MYSQLI_BOTH));
+
+ $res->free_result();
+ if (!$res = $mysqli->query("SELECT 1 AS a, 2 AS b, 3 AS c, 4 AS C")) {
+ printf("[018] Cannot run query, [%d] %s\n",
+ $mysqli->errno, $$mysqli->error);
+ exit(1);
+ }
+
+ do {
+ $illegal_mode = mt_rand(-10000, 10000);
+ } while (in_array($illegal_mode, array(MYSQLI_ASSOC, MYSQLI_NUM, MYSQLI_BOTH)));
+ // NOTE: for BC reasons with ext/mysql, ext/mysqli accepts invalid result modes.
+ $tmp = $res->fetch_all($illegal_mode);
+ if (false !== $tmp)
+ printf("[019] Expecting boolean/false although, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, $mysqli->errno, $mysqli->error);
+
+ $res->free_result();
+
+ function func_mysqli_fetch_all_oo($link, $engine, $sql_type, $sql_value, $php_value, $offset, $regexp_comparison = NULL) {
+
+ if (!$link->query("DROP TABLE IF EXISTS test")) {
+ printf("[%04d] [%d] %s\n", $offset, $link->errno, $link->error);
+ return false;
+ }
+
+ if (!$link->query($sql = sprintf("CREATE TABLE test(id INT NOT NULL, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) {
+ // don't bail, engine might not support the datatype
+ return false;
+ }
+
+ if (is_null($php_value)) {
+ if (!$link->query($sql = sprintf("INSERT INTO test(id, label) VALUES (1, NULL)"))) {
+ printf("[%04d] [%d] %s\n", $offset + 1, $link->errno, $link->error);
+ return false;
+ }
+ } else {
+ if (is_string($sql_value)) {
+ if (!$link->query($sql = "INSERT INTO test(id, label) VALUES (1, '" . $sql_value . "')")) {
+ printf("[%04ds] [%d] %s - %s\n", $offset + 1, $link->errno, $link->error, $sql);
+ return false;
+ }
+ } else {
+ if (!$link->query($sql = sprintf("INSERT INTO test(id, label) VALUES (1, '%d')", $sql_value))) {
+ printf("[%04di] [%d] %s\n", $offset + 1, $link->errno, $link->error);
+ return false;
+ }
+ }
+ }
+
+ if (!$res = $link->query("SELECT id, label FROM test")) {
+ printf("[%04d] [%d] %s\n", $offset + 2, $link->errno, $link->error);
+ return false;
+ }
+
+ if (!$tmp = $res->fetch_all(MYSQLI_BOTH)) {
+ printf("[%04d] [%d] %s\n", $offset + 3, $link->errno, $link->error);
+ return false;
+ }
+ $row = $tmp[0];
+
+ $fields = mysqli_fetch_fields($res);
+
+ if (!(gettype($php_value)=="unicode" && ($fields[1]->flags & 128))) {
+ if ($regexp_comparison) {
+ if (!preg_match($regexp_comparison, (string)$row['label']) || !preg_match($regexp_comparison, (string)$row[1])) {
+ printf("[%04d] Expecting %s/%s [reg exp = %s], got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4,
+ gettype($php_value), $php_value, $regexp_comparison,
+ gettype($row[1]), $row[1],
+ gettype($row['label']), $row['label'], $link->errno, $link->error);
+ return false;
+ }
+ } else {
+ if (($row['label'] !== $php_value) || ($row[1] != $php_value)) {
+ printf("[%04d] Expecting %s/%s, got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4,
+ gettype($php_value), $php_value,
+ gettype($row[1]), $row[1],
+ gettype($row['label']), $row['label'], $link->errno, $link->error);
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ function func_mysqli_fetch_array_oo_make_string($len) {
+
+ $ret = '';
+ for ($i = 0; $i < $len; $i++)
+ $ret .= chr(mt_rand(65, 90));
+
+ return $ret;
+ }
+
+ func_mysqli_fetch_all_oo($link, $engine, "TINYINT", -11, "-11", 20);
+ func_mysqli_fetch_all_oo($link, $engine, "TINYINT", NULL, NULL, 30);
+ func_mysqli_fetch_all_oo($link, $engine, "TINYINT UNSIGNED", 1, "1", 40);
+ func_mysqli_fetch_all_oo($link, $engine, "TINYINT UNSIGNED", NULL, NULL, 50);
+
+ func_mysqli_fetch_all_oo($link, $engine, "BOOL", 1, "1", 60);
+ func_mysqli_fetch_all_oo($link, $engine, "BOOL", NULL, NULL, 70);
+ func_mysqli_fetch_all_oo($link, $engine, "BOOLEAN", 0, "0", 80);
+ func_mysqli_fetch_all_oo($link, $engine, "BOOLEAN", NULL, NULL, 90);
+
+ func_mysqli_fetch_all_oo($link, $engine, "SMALLINT", -32768, "-32768", 100);
+ func_mysqli_fetch_all_oo($link, $engine, "SMALLINT", 32767, "32767", 110);
+ func_mysqli_fetch_all_oo($link, $engine, "SMALLINT", NULL, NULL, 120);
+ func_mysqli_fetch_all_oo($link, $engine, "SMALLINT UNSIGNED", 65400, "65400", 130);
+ func_mysqli_fetch_all_oo($link, $engine, "SMALLINT UNSIGNED", NULL, NULL, 140);
+
+ func_mysqli_fetch_all_oo($link, $engine, "MEDIUMINT", -8388608, "-8388608", 150);
+ func_mysqli_fetch_all_oo($link, $engine, "MEDIUMINT", 8388607, "8388607", 160);
+ func_mysqli_fetch_all_oo($link, $engine, "MEDIUMINT", NULL, NULL, 170);
+ func_mysqli_fetch_all_oo($link, $engine, "MEDIUMINT UNSIGNED", 16777215, "16777215", 180);
+ func_mysqli_fetch_all_oo($link, $engine, "MEDIUMINT UNSIGNED", NULL, NULL, 190);
+
+ func_mysqli_fetch_all_oo($link, $engine, "INTEGER", -2147483648, "-2147483648", 200);
+ func_mysqli_fetch_all_oo($link, $engine, "INTEGER", 2147483647, "2147483647", 210);
+ func_mysqli_fetch_all_oo($link, $engine, "INTEGER", NULL, NULL, 220);
+ func_mysqli_fetch_all_oo($link, $engine, "INTEGER UNSIGNED", "4294967295", "4294967295", 230);
+ func_mysqli_fetch_all_oo($link, $engine, "INTEGER UNSIGNED", NULL, NULL, 240);
+
+ func_mysqli_fetch_all_oo($link, $engine, "BIGINT", "-9223372036854775808", "-9223372036854775808", 250);
+ func_mysqli_fetch_all_oo($link, $engine, "BIGINT", NULL, NULL, 260);
+ func_mysqli_fetch_all_oo($link, $engine, "BIGINT UNSIGNED", "18446744073709551615", "18446744073709551615", 270);
+ func_mysqli_fetch_all_oo($link, $engine, "BIGINT UNSIGNED", NULL, NULL, 280);
+
+ func_mysqli_fetch_all_oo($link, $engine, "FLOAT", (string)(-9223372036854775808 - 1.1), "-9.22337e+18", 290, "/-9\.22337e\+?[0]?18/iu");
+ func_mysqli_fetch_all_oo($link, $engine, "FLOAT", NULL, NULL, 300);
+ func_mysqli_fetch_all_oo($link, $engine, "FLOAT UNSIGNED", (string)(18446744073709551615 + 1.1), "1.84467e+?19", 310, "/1\.84467e\+?[0]?19/iu");
+ func_mysqli_fetch_all_oo($link, $engine, "FLOAT UNSIGNED ", NULL, NULL, 320);
+
+ func_mysqli_fetch_all_oo($link, $engine, "DOUBLE(10,2)", "-99999999.99", "-99999999.99", 330);
+ func_mysqli_fetch_all_oo($link, $engine, "DOUBLE(10,2)", NULL, NULL, 340);
+ func_mysqli_fetch_all_oo($link, $engine, "DOUBLE(10,2) UNSIGNED", "99999999.99", "99999999.99", 350);
+ func_mysqli_fetch_all_oo($link, $engine, "DOUBLE(10,2) UNSIGNED", NULL, NULL, 360);
+
+ func_mysqli_fetch_all_oo($link, $engine, "DECIMAL(10,2)", "-99999999.99", "-99999999.99", 370);
+ func_mysqli_fetch_all_oo($link, $engine, "DECIMAL(10,2)", NULL, NULL, 380);
+ func_mysqli_fetch_all_oo($link, $engine, "DECIMAL(10,2)", "99999999.99", "99999999.99", 390);
+ func_mysqli_fetch_all_oo($link, $engine, "DECIMAL(10,2)", NULL, NULL, 400);
+
+ // don't care about date() strict TZ warnings...
+ $date = @date('Y-m-d');
+ func_mysqli_fetch_all_oo($link, $engine, "DATE", $date, $date, 410);
+ func_mysqli_fetch_all_oo($link, $engine, "DATE NOT NULL", $date, $date, 420);
+ func_mysqli_fetch_all_oo($link, $engine, "DATE", NULL, NULL, 430);
+
+ $datetime = @date('Y-m-d H:i:s');
+ func_mysqli_fetch_all_oo($link, $engine, "DATETIME", $datetime, $datetime, 440);
+ func_mysqli_fetch_all_oo($link, $engine, "DATETIME NOT NULL", $datetime, $datetime, 450);
+ func_mysqli_fetch_all_oo($link, $engine, "DATETIME", NULL, NULL, 460);
+
+ func_mysqli_fetch_all_oo($link, $engine, "TIMESTAMP", $datetime, $datetime, 470);
+
+ $time = @date('H:i:s');
+ func_mysqli_fetch_all_oo($link, $engine, "TIME", $time, $time, 480);
+ func_mysqli_fetch_all_oo($link, $engine, "TIME NOT NULL", $time, $time, 490);
+ func_mysqli_fetch_all_oo($link, $engine, "TIME", NULL, NULL, 500);
+
+ func_mysqli_fetch_all_oo($link, $engine, "YEAR", @date('Y'), @date('Y'), 510);
+ func_mysqli_fetch_all_oo($link, $engine, "YEAR NOT NULL", @date('Y'), @date('Y'), 520);
+ func_mysqli_fetch_all_oo($link, $engine, "YEAR", NULL, NULL, 530);
+
+ $string255 = func_mysqli_fetch_array_oo_make_string(255);
+ func_mysqli_fetch_all_oo($link, $engine, "CHAR(1)", "a", "a", 540);
+ func_mysqli_fetch_all_oo($link, $engine, "CHAR(255)", $string255, $string255, 550);
+ func_mysqli_fetch_all_oo($link, $engine, "CHAR(1) NOT NULL", "a", "a", 560);
+ func_mysqli_fetch_all_oo($link, $engine, "CHAR(1)", NULL, NULL, 570);
+
+ $string65k = func_mysqli_fetch_array_oo_make_string(65400);
+ func_mysqli_fetch_all_oo($link, $engine, "VARCHAR(1)", "a", "a", 580);
+ func_mysqli_fetch_all_oo($link, $engine, "VARCHAR(255)", $string255, $string255, 590);
+ func_mysqli_fetch_all_oo($link, $engine, "VARCHAR(65400)", $string65k, $string65k, 600);
+ func_mysqli_fetch_all_oo($link, $engine, "VARCHAR(1) NOT NULL", "a", "a", 610);
+ func_mysqli_fetch_all_oo($link, $engine, "VARCHAR(1)", NULL, NULL, 620);
+
+ func_mysqli_fetch_all_oo($link, $engine, "BINARY(1)", "a", "a", 630);
+ func_mysqli_fetch_all_oo($link, $engine, "BINARY(2)", chr(0) . "a", chr(0) . "a", 640);
+ func_mysqli_fetch_all_oo($link, $engine, "BINARY(1) NOT NULL", "b", "b", 650);
+ func_mysqli_fetch_all_oo($link, $engine, "BINARY(1)", NULL, NULL, 660);
+
+ func_mysqli_fetch_all_oo($link, $engine, "VARBINARY(1)", "a", "a", 670);
+ func_mysqli_fetch_all_oo($link, $engine, "VARBINARY(2)", chr(0) . "a", chr(0) . "a", 680);
+ func_mysqli_fetch_all_oo($link, $engine, "VARBINARY(1) NOT NULL", "b", "b", 690);
+ func_mysqli_fetch_all_oo($link, $engine, "VARBINARY(1)", NULL, NULL, 700);
+
+ func_mysqli_fetch_all_oo($link, $engine, "TINYBLOB", "a", "a", 710);
+ func_mysqli_fetch_all_oo($link, $engine, "TINYBLOB", chr(0) . "a", chr(0) . "a", 720);
+ func_mysqli_fetch_all_oo($link, $engine, "TINYBLOB NOT NULL", "b", "b", 730);
+ func_mysqli_fetch_all_oo($link, $engine, "TINYBLOB", NULL, NULL, 740);
+
+ func_mysqli_fetch_all_oo($link, $engine, "TINYTEXT", "a", "a", 750);
+ func_mysqli_fetch_all_oo($link, $engine, "TINYTEXT NOT NULL", "a", "a", 760);
+ func_mysqli_fetch_all_oo($link, $engine, "TINYTEXT", NULL, NULL, 770);
+
+ func_mysqli_fetch_all_oo($link, $engine, "BLOB", "a", "a", 780);
+ func_mysqli_fetch_all_oo($link, $engine, "BLOB", chr(0) . "a", chr(0) . "a", 780);
+ func_mysqli_fetch_all_oo($link, $engine, "BLOB", NULL, NULL, 790);
+
+ func_mysqli_fetch_all_oo($link, $engine, "TEXT", "a", "a", 800);
+ func_mysqli_fetch_all_oo($link, $engine, "TEXT", chr(0) . "a", chr(0) . "a", 810);
+ func_mysqli_fetch_all_oo($link, $engine, "TEXT", NULL, NULL, 820);
+
+ func_mysqli_fetch_all_oo($link, $engine, "MEDIUMBLOB", "a", "a", 830);
+ func_mysqli_fetch_all_oo($link, $engine, "MEDIUMBLOB", chr(0) . "a", chr(0) . "a", 840);
+ func_mysqli_fetch_all_oo($link, $engine, "MEDIUMBLOB", NULL, NULL, 850);
+
+ func_mysqli_fetch_all_oo($link, $engine, "MEDIUMTEXT", "a", "a", 860);
+ func_mysqli_fetch_all_oo($link, $engine, "MEDIUMTEXT", chr(0) . "a", chr(0) . "a", 870);
+ func_mysqli_fetch_all_oo($link, $engine, "MEDIUMTEXT", NULL, NULL, 880);
+
+ func_mysqli_fetch_all_oo($link, $engine, "LONGBLOB", "a", "a", 890);
+ func_mysqli_fetch_all_oo($link, $engine, "LONGTEXT", chr(0) . "a", chr(0) . "a", 900);
+ func_mysqli_fetch_all_oo($link, $engine, "LONGBLOB", NULL, NULL, 910);
+
+ func_mysqli_fetch_all_oo($link, $engine, "ENUM('a', 'b')", "a", "a", 920);
+ func_mysqli_fetch_all_oo($link, $engine, "ENUM('a', 'b')", NULL, NULL, 930);
+
+ func_mysqli_fetch_all_oo($link, $engine, "SET('a', 'b')", "a", "a", 940);
+ func_mysqli_fetch_all_oo($link, $engine, "SET('a', 'b')", NULL, NULL, 950);
+
+ mysqli_close($link);
+
+ try {
+ $res->fetch_array(MYSQLI_ASSOC);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ print "done!";
?>
--CLEAN--
<?php
@@ -435,6 +438,5 @@ array(1) {
}
Warning: mysqli_result::fetch_all(): Mode can be only MYSQLI_FETCH_NUM, MYSQLI_FETCH_ASSOC or MYSQLI_FETCH_BOTH in %s on line %d
-
-Warning: mysqli_result::fetch_array(): Couldn't fetch mysqli_result in %s on line %d
+mysqli_result object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_fetch_array.phpt b/ext/mysqli/tests/mysqli_fetch_array.phpt
index e9dd1602b5..fe1c6b94ca 100644
--- a/ext/mysqli/tests/mysqli_fetch_array.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_array.phpt
@@ -8,289 +8,284 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_fetch_array()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_fetch_array($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- require('table.inc');
- if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 5")) {
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
-
- print "[005]\n";
- var_dump(mysqli_fetch_array($res));
-
- print "[006]\n";
- var_dump(mysqli_fetch_array($res, MYSQLI_NUM));
-
- print "[007]\n";
- var_dump(mysqli_fetch_array($res, MYSQLI_BOTH));
-
- print "[008]\n";
- var_dump(mysqli_fetch_array($res, MYSQLI_ASSOC));
-
- print "[009]\n";
- var_dump(mysqli_fetch_array($res));
-
- mysqli_free_result($res);
-
- if (!$res = mysqli_query($link, "SELECT 1 AS a, 2 AS a, 3 AS c, 4 AS C, NULL AS d, true AS e")) {
- printf("[010] Cannot run query, [%d] %s\n", mysqli_errno($link), $mysqli_error($link));
- }
- print "[011]\n";
- var_dump(mysqli_fetch_array($res, MYSQLI_BOTH));
-
- mysqli_free_result($res);
- if (!$res = mysqli_query($link, "SELECT 1 AS a, 2 AS b, 3 AS c, 4 AS C")) {
- printf("[012] Cannot run query, [%d] %s\n",
- mysqli_errno($link), $mysqli_error($link));
- exit(1);
- }
-
- do {
- $illegal_mode = mt_rand(-10000, 10000);
- } while (in_array($illegal_mode, array(MYSQLI_ASSOC, MYSQLI_NUM, MYSQLI_BOTH)));
- // NOTE: for BC reasons with ext/mysql, ext/mysqli accepts invalid result modes.
- $tmp = mysqli_fetch_array($res, $illegal_mode);
- if (false !== $tmp)
- printf("[013] Expecting boolean/false although, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
-
- $tmp = mysqli_fetch_array($res, $illegal_mode);
- if (false !== $tmp)
- printf("[014] Expecting boolean/false, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
-
- mysqli_free_result($res);
-
- function func_mysqli_fetch_array($link, $engine, $sql_type, $sql_value, $php_value, $offset, $regexp_comparison = NULL, $binary_type = false) {
-
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
- printf("[%04d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if (!mysqli_query($link, $sql = sprintf("CREATE TABLE test(id INT NOT NULL, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) {
- // don't bail, engine might not support the datatype
- return false;
- }
-
- if (is_null($php_value)) {
- if (!mysqli_query($link, $sql = sprintf("INSERT INTO test(id, label) VALUES (1, NULL)"))) {
- printf("[%04d] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link));
- return false;
- }
- } else {
- if (is_string($sql_value)) {
- if (!mysqli_query($link, $sql = "INSERT INTO test(id, label) VALUES (1, '" . $sql_value . "')")) {
- printf("[%04ds] [%d] %s - %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link), $sql);
- return false;
- }
- } else {
- if (!mysqli_query($link, $sql = sprintf("INSERT INTO test(id, label) VALUES (1, '%d')", $sql_value))) {
- printf("[%04di] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link));
- return false;
- }
- }
- }
- if (!$res = mysqli_query($link, "SELECT id, label FROM test")) {
- printf("[%04d] [%d] %s\n", $offset + 2, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if (!$row = mysqli_fetch_array($res, MYSQLI_BOTH)) {
- printf("[%04d] [%d] %s\n", $offset + 3, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if ($regexp_comparison) {
- if (!preg_match($regexp_comparison, (string)$row['label']) || !preg_match($regexp_comparison, (string)$row[1])) {
- printf("[%04d] Expecting %s/%s [reg exp = %s], got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4,
- gettype($php_value), $php_value, $regexp_comparison,
- gettype($row[1]), $row[1],
- gettype($row['label']), $row['label'], mysqli_errno($link), mysqli_error($link));
- return false;
- }
- } else if ((gettype($php_value) == 'unicode') && $binary_type) {
- // Unicode is on and we are told that the MySQL column type is a binary type.
- // Don't expect a unicode value from the database, you'll get binary string
- if (($row['label'] != $php_value) || ($row[1] != $php_value)) {
- printf("[%04d] Expecting %s/%s, got %s/%s resp. %s/%s. [%d] %s\n", $offset + 5,
- gettype($php_value), $php_value,
- gettype($row[1]), $row[1],
- gettype($row['label']), $row['label'], mysqli_errno($link), mysqli_error($link));
- return false;
- }
- if (gettype($row['label']) == 'unicode') {
- var_dump(mysqli_fetch_field_direct($res, 1), $row['label']);
- printf("[%04d] SQL Type: '%s', binary columns are supposed to return binary string and not unicode\n",
- $offset + 6, $sql_type);
- return false;
- }
- } else {
- if (($row['label'] !== $php_value) || ($row[1] != $php_value)) {
- printf("[%04d] Expecting %s/%s, got %s/%s resp. %s/%s. [%d] %s\n", $offset + 7,
- gettype($php_value), $php_value,
- gettype($row[1]), $row[1],
- gettype($row['label']), $row['label'], mysqli_errno($link), mysqli_error($link));
- return false;
- }
- }
- return true;
- }
-
- function func_mysqli_fetch_array_make_string($len) {
-
- $ret = '';
- for ($i = 0; $i < $len; $i++)
- $ret .= chr(mt_rand(65, 90));
-
- return $ret;
- }
-
- func_mysqli_fetch_array($link, $engine, "TINYINT", -11, "-11", 20);
- func_mysqli_fetch_array($link, $engine, "TINYINT", NULL, NULL, 30);
- func_mysqli_fetch_array($link, $engine, "TINYINT UNSIGNED", 1, "1", 40);
- func_mysqli_fetch_array($link, $engine, "TINYINT UNSIGNED", NULL, NULL, 50);
-
- func_mysqli_fetch_array($link, $engine, "BOOL", 1, "1", 60);
- func_mysqli_fetch_array($link, $engine, "BOOL", NULL, NULL, 70);
- func_mysqli_fetch_array($link, $engine, "BOOLEAN", 0, "0", 80);
- func_mysqli_fetch_array($link, $engine, "BOOLEAN", NULL, NULL, 90);
-
- func_mysqli_fetch_array($link, $engine, "SMALLINT", -32768, "-32768", 100);
- func_mysqli_fetch_array($link, $engine, "SMALLINT", 32767, "32767", 110);
- func_mysqli_fetch_array($link, $engine, "SMALLINT", NULL, NULL, 120);
- func_mysqli_fetch_array($link, $engine, "SMALLINT UNSIGNED", 65535, "65535", 130);
- func_mysqli_fetch_array($link, $engine, "SMALLINT UNSIGNED", NULL, NULL, 140);
-
- func_mysqli_fetch_array($link, $engine, "MEDIUMINT", -8388608, "-8388608", 150);
- func_mysqli_fetch_array($link, $engine, "MEDIUMINT", 8388607, "8388607", 160);
- func_mysqli_fetch_array($link, $engine, "MEDIUMINT", NULL, NULL, 170);
- func_mysqli_fetch_array($link, $engine, "MEDIUMINT UNSIGNED", 16777215, "16777215", 180);
- func_mysqli_fetch_array($link, $engine, "MEDIUMINT UNSIGNED", NULL, NULL, 190);
-
- func_mysqli_fetch_array($link, $engine, "INTEGER", -2147483648, "-2147483648", 200);
- func_mysqli_fetch_array($link, $engine, "INTEGER", 2147483647, "2147483647", 210);
- func_mysqli_fetch_array($link, $engine, "INTEGER", NULL, NULL, 220);
- func_mysqli_fetch_array($link, $engine, "INTEGER UNSIGNED", "4294967295", "4294967295", 230);
- func_mysqli_fetch_array($link, $engine, "INTEGER UNSIGNED", NULL, NULL, 240);
-
- if ($IS_MYSQLND ||
- ((mysqli_get_server_version($link) >= 51000) &&
- (mysqli_get_client_version($link) >= 51000))) {
- func_mysqli_fetch_array($link, $engine, "BIGINT", "-9223372036854775808", "-9223372036854775808", 250);
- func_mysqli_fetch_array($link, $engine, "BIGINT", NULL, NULL, 260);
- func_mysqli_fetch_array($link, $engine, "BIGINT UNSIGNED", "18446744073709551615", "18446744073709551615", 260);
- func_mysqli_fetch_array($link, $engine, "BIGINT UNSIGNED", NULL, NULL, 280);
- }
-
- func_mysqli_fetch_array($link, $engine, "FLOAT", (string)(-9223372036854775808 - 1.1), "-9.22337e+18", 290, "/-9\.22337e\+?[0]?18/iu");
- func_mysqli_fetch_array($link, $engine, "FLOAT", NULL, NULL, 300);
- func_mysqli_fetch_array($link, $engine, "FLOAT UNSIGNED", (string)(18446744073709551615 + 1.1), "1.84467e+?19", 310, "/1\.84467e\+?[0]?19/iu");
- func_mysqli_fetch_array($link, $engine, "FLOAT UNSIGNED ", NULL, NULL, 320);
-
- func_mysqli_fetch_array($link, $engine, "DOUBLE(10,2)", "-99999999.99", "-99999999.99", 330);
- func_mysqli_fetch_array($link, $engine, "DOUBLE(10,2)", NULL, NULL, 340);
- func_mysqli_fetch_array($link, $engine, "DOUBLE(10,2) UNSIGNED", "99999999.99", "99999999.99", 350);
- func_mysqli_fetch_array($link, $engine, "DOUBLE(10,2) UNSIGNED", NULL, NULL, 360);
-
- func_mysqli_fetch_array($link, $engine, "DECIMAL(10,2)", "-99999999.99", "-99999999.99", 370);
- func_mysqli_fetch_array($link, $engine, "DECIMAL(10,2)", NULL, NULL, 380);
- func_mysqli_fetch_array($link, $engine, "DECIMAL(10,2)", "99999999.99", "99999999.99", 390);
- func_mysqli_fetch_array($link, $engine, "DECIMAL(10,2)", NULL, NULL, 400);
-
- // don't care about date() strict TZ warnings...
- $date = @date('Y-m-d');
- func_mysqli_fetch_array($link, $engine, "DATE",$date, $date, 410);
- func_mysqli_fetch_array($link, $engine, "DATE NOT NULL",$date, $date, 420);
- func_mysqli_fetch_array($link, $engine, "DATE", NULL, NULL, 430);
-
- $date = @date('Y-m-d H:i:s');
- func_mysqli_fetch_array($link, $engine, "DATETIME", $date, $date, 440);
- func_mysqli_fetch_array($link, $engine, "DATETIME NOT NULL", $date, $date, 450);
- func_mysqli_fetch_array($link, $engine, "DATETIME", NULL, NULL, 460);
- func_mysqli_fetch_array($link, $engine, "TIMESTAMP", $date, $date, 470);
-
- $date = @date('H:i:s');
- func_mysqli_fetch_array($link, $engine, "TIME", $date, $date, 480);
- func_mysqli_fetch_array($link, $engine, "TIME NOT NULL", $date, $date, 490);
- func_mysqli_fetch_array($link, $engine, "TIME", NULL, NULL, 500);
-
- func_mysqli_fetch_array($link, $engine, "YEAR", @date('Y'), @date('Y'), 510);
- func_mysqli_fetch_array($link, $engine, "YEAR NOT NULL", @date('Y'), @date('Y'), 520);
- func_mysqli_fetch_array($link, $engine, "YEAR", NULL, NULL, 530);
-
- $string255 = func_mysqli_fetch_array_make_string(255);
- func_mysqli_fetch_array($link, $engine, "CHAR(1)", "a", "a", 540);
- func_mysqli_fetch_array($link, $engine, "CHAR(255)", $string255, $string255, 550);
- func_mysqli_fetch_array($link, $engine, "CHAR(1) NOT NULL", "a", "a", 560);
- func_mysqli_fetch_array($link, $engine, "CHAR(1)", NULL, NULL, 570);
-
- $string65k = func_mysqli_fetch_array_make_string(65400);
- func_mysqli_fetch_array($link, $engine, "VARCHAR(1)", "a", "a", 580);
- func_mysqli_fetch_array($link, $engine, "VARCHAR(255)", $string255, $string255, 590);
- func_mysqli_fetch_array($link, $engine, "VARCHAR(65400)", $string65k, $string65k, 600);
- func_mysqli_fetch_array($link, $engine, "VARCHAR(1) NOT NULL", "a", "a", 610);
- func_mysqli_fetch_array($link, $engine, "VARCHAR(1)", NULL, NULL, 620);
-
- func_mysqli_fetch_array($link, $engine, "BINARY(1)", "a", "a", 630, null, true);
- func_mysqli_fetch_array($link, $engine, "BINARY(2)", chr(0) . "a", chr(0) . "a", 640, null, true);
- func_mysqli_fetch_array($link, $engine, "BINARY(1) NOT NULL", "b", "b", 650, null, true);
- func_mysqli_fetch_array($link, $engine, "BINARY(1)", NULL, NULL, 660, null, true);
-
- func_mysqli_fetch_array($link, $engine, "VARBINARY(1)", "a", "a", 670, null, true);
- func_mysqli_fetch_array($link, $engine, "VARBINARY(2)", chr(0) . "a", chr(0) . "a", 680, null, true);
- func_mysqli_fetch_array($link, $engine, "VARBINARY(1) NOT NULL", "b", "b", 690, null, true);
- func_mysqli_fetch_array($link, $engine, "VARBINARY(1)", NULL, NULL, 700, null, true);
-
- func_mysqli_fetch_array($link, $engine, "TINYBLOB", "a", "a", 710, null, true);
- func_mysqli_fetch_array($link, $engine, "TINYBLOB", chr(0) . "a", chr(0) . "a", 720, null, true);
- func_mysqli_fetch_array($link, $engine, "TINYBLOB NOT NULL", "b", "b", 730, null, true);
- func_mysqli_fetch_array($link, $engine, "TINYBLOB", NULL, NULL, 740, null, true);
-
- func_mysqli_fetch_array($link, $engine, "TINYTEXT", "a", "a", 750);
- func_mysqli_fetch_array($link, $engine, "TINYTEXT NOT NULL", "a", "a", 760);
- func_mysqli_fetch_array($link, $engine, "TINYTEXT", NULL, NULL, 770);
-
- func_mysqli_fetch_array($link, $engine, "BLOB", "a", "a", 780, null, true);
- func_mysqli_fetch_array($link, $engine, "BLOB", chr(0) . "a", chr(0) . "a", 780, null, true);
- func_mysqli_fetch_array($link, $engine, "BLOB", NULL, NULL, 790, null, true);
-
- func_mysqli_fetch_array($link, $engine, "TEXT", "a", "a", 800);
- func_mysqli_fetch_array($link, $engine, "TEXT", chr(0) . "a", chr(0) . "a", 810);
- func_mysqli_fetch_array($link, $engine, "TEXT", NULL, NULL, 820);
-
- func_mysqli_fetch_array($link, $engine, "MEDIUMBLOB", "a", "a", 830, null, true);
- func_mysqli_fetch_array($link, $engine, "MEDIUMBLOB", chr(0) . "a", chr(0) . "a", 840, null, true);
- func_mysqli_fetch_array($link, $engine, "MEDIUMBLOB", NULL, NULL, 850, null, true);
-
- func_mysqli_fetch_array($link, $engine, "MEDIUMTEXT", "a", "a", 860);
- func_mysqli_fetch_array($link, $engine, "MEDIUMTEXT", chr(0) . "a", chr(0) . "a", 870);
- func_mysqli_fetch_array($link, $engine, "MEDIUMTEXT", NULL, NULL, 880);
-
- func_mysqli_fetch_array($link, $engine, "LONGBLOB", "a", "a", 890, null, true);
- func_mysqli_fetch_array($link, $engine, "LONGTEXT", chr(0) . "a", chr(0) . "a", 900);
- func_mysqli_fetch_array($link, $engine, "LONGBLOB", NULL, NULL, 910, null, true);
-
- func_mysqli_fetch_array($link, $engine, "ENUM('a', 'b')", "a", "a", 920);
- func_mysqli_fetch_array($link, $engine, "ENUM('a', 'b')", NULL, NULL, 930);
-
- func_mysqli_fetch_array($link, $engine, "SET('a', 'b')", "a", "a", 940);
- func_mysqli_fetch_array($link, $engine, "SET('a', 'b')", NULL, NULL, 950);
-
- mysqli_close($link);
-
- if (false !== ($tmp = mysqli_fetch_array($res, MYSQLI_ASSOC)))
- printf("[015] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!";
+ require_once("connect.inc");
+
+ require('table.inc');
+ if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 5")) {
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ print "[005]\n";
+ var_dump(mysqli_fetch_array($res));
+
+ print "[006]\n";
+ var_dump(mysqli_fetch_array($res, MYSQLI_NUM));
+
+ print "[007]\n";
+ var_dump(mysqli_fetch_array($res, MYSQLI_BOTH));
+
+ print "[008]\n";
+ var_dump(mysqli_fetch_array($res, MYSQLI_ASSOC));
+
+ print "[009]\n";
+ var_dump(mysqli_fetch_array($res));
+
+ mysqli_free_result($res);
+
+ if (!$res = mysqli_query($link, "SELECT 1 AS a, 2 AS a, 3 AS c, 4 AS C, NULL AS d, true AS e")) {
+ printf("[010] Cannot run query, [%d] %s\n", mysqli_errno($link), $mysqli_error($link));
+ }
+ print "[011]\n";
+ var_dump(mysqli_fetch_array($res, MYSQLI_BOTH));
+
+ mysqli_free_result($res);
+ if (!$res = mysqli_query($link, "SELECT 1 AS a, 2 AS b, 3 AS c, 4 AS C")) {
+ printf("[012] Cannot run query, [%d] %s\n",
+ mysqli_errno($link), $mysqli_error($link));
+ exit(1);
+ }
+
+ do {
+ $illegal_mode = mt_rand(-10000, 10000);
+ } while (in_array($illegal_mode, array(MYSQLI_ASSOC, MYSQLI_NUM, MYSQLI_BOTH)));
+ // NOTE: for BC reasons with ext/mysql, ext/mysqli accepts invalid result modes.
+ $tmp = mysqli_fetch_array($res, $illegal_mode);
+ if (false !== $tmp)
+ printf("[013] Expecting boolean/false although, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
+
+ $tmp = mysqli_fetch_array($res, $illegal_mode);
+ if (false !== $tmp)
+ printf("[014] Expecting boolean/false, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
+
+ mysqli_free_result($res);
+
+ function func_mysqli_fetch_array($link, $engine, $sql_type, $sql_value, $php_value, $offset, $regexp_comparison = NULL, $binary_type = false) {
+
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
+ printf("[%04d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if (!mysqli_query($link, $sql = sprintf("CREATE TABLE test(id INT NOT NULL, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) {
+ // don't bail, engine might not support the datatype
+ return false;
+ }
+
+ if (is_null($php_value)) {
+ if (!mysqli_query($link, $sql = sprintf("INSERT INTO test(id, label) VALUES (1, NULL)"))) {
+ printf("[%04d] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+ } else {
+ if (is_string($sql_value)) {
+ if (!mysqli_query($link, $sql = "INSERT INTO test(id, label) VALUES (1, '" . $sql_value . "')")) {
+ printf("[%04ds] [%d] %s - %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link), $sql);
+ return false;
+ }
+ } else {
+ if (!mysqli_query($link, $sql = sprintf("INSERT INTO test(id, label) VALUES (1, '%d')", $sql_value))) {
+ printf("[%04di] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+ }
+ }
+ if (!$res = mysqli_query($link, "SELECT id, label FROM test")) {
+ printf("[%04d] [%d] %s\n", $offset + 2, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if (!$row = mysqli_fetch_array($res, MYSQLI_BOTH)) {
+ printf("[%04d] [%d] %s\n", $offset + 3, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if ($regexp_comparison) {
+ if (!preg_match($regexp_comparison, (string)$row['label']) || !preg_match($regexp_comparison, (string)$row[1])) {
+ printf("[%04d] Expecting %s/%s [reg exp = %s], got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4,
+ gettype($php_value), $php_value, $regexp_comparison,
+ gettype($row[1]), $row[1],
+ gettype($row['label']), $row['label'], mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+ } else if ((gettype($php_value) == 'unicode') && $binary_type) {
+ // Unicode is on and we are told that the MySQL column type is a binary type.
+ // Don't expect a unicode value from the database, you'll get binary string
+ if (($row['label'] != $php_value) || ($row[1] != $php_value)) {
+ printf("[%04d] Expecting %s/%s, got %s/%s resp. %s/%s. [%d] %s\n", $offset + 5,
+ gettype($php_value), $php_value,
+ gettype($row[1]), $row[1],
+ gettype($row['label']), $row['label'], mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+ if (gettype($row['label']) == 'unicode') {
+ var_dump(mysqli_fetch_field_direct($res, 1), $row['label']);
+ printf("[%04d] SQL Type: '%s', binary columns are supposed to return binary string and not unicode\n",
+ $offset + 6, $sql_type);
+ return false;
+ }
+ } else {
+ if (($row['label'] !== $php_value) || ($row[1] != $php_value)) {
+ printf("[%04d] Expecting %s/%s, got %s/%s resp. %s/%s. [%d] %s\n", $offset + 7,
+ gettype($php_value), $php_value,
+ gettype($row[1]), $row[1],
+ gettype($row['label']), $row['label'], mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+ }
+ return true;
+ }
+
+ function func_mysqli_fetch_array_make_string($len) {
+
+ $ret = '';
+ for ($i = 0; $i < $len; $i++)
+ $ret .= chr(mt_rand(65, 90));
+
+ return $ret;
+ }
+
+ func_mysqli_fetch_array($link, $engine, "TINYINT", -11, "-11", 20);
+ func_mysqli_fetch_array($link, $engine, "TINYINT", NULL, NULL, 30);
+ func_mysqli_fetch_array($link, $engine, "TINYINT UNSIGNED", 1, "1", 40);
+ func_mysqli_fetch_array($link, $engine, "TINYINT UNSIGNED", NULL, NULL, 50);
+
+ func_mysqli_fetch_array($link, $engine, "BOOL", 1, "1", 60);
+ func_mysqli_fetch_array($link, $engine, "BOOL", NULL, NULL, 70);
+ func_mysqli_fetch_array($link, $engine, "BOOLEAN", 0, "0", 80);
+ func_mysqli_fetch_array($link, $engine, "BOOLEAN", NULL, NULL, 90);
+
+ func_mysqli_fetch_array($link, $engine, "SMALLINT", -32768, "-32768", 100);
+ func_mysqli_fetch_array($link, $engine, "SMALLINT", 32767, "32767", 110);
+ func_mysqli_fetch_array($link, $engine, "SMALLINT", NULL, NULL, 120);
+ func_mysqli_fetch_array($link, $engine, "SMALLINT UNSIGNED", 65535, "65535", 130);
+ func_mysqli_fetch_array($link, $engine, "SMALLINT UNSIGNED", NULL, NULL, 140);
+
+ func_mysqli_fetch_array($link, $engine, "MEDIUMINT", -8388608, "-8388608", 150);
+ func_mysqli_fetch_array($link, $engine, "MEDIUMINT", 8388607, "8388607", 160);
+ func_mysqli_fetch_array($link, $engine, "MEDIUMINT", NULL, NULL, 170);
+ func_mysqli_fetch_array($link, $engine, "MEDIUMINT UNSIGNED", 16777215, "16777215", 180);
+ func_mysqli_fetch_array($link, $engine, "MEDIUMINT UNSIGNED", NULL, NULL, 190);
+
+ func_mysqli_fetch_array($link, $engine, "INTEGER", -2147483648, "-2147483648", 200);
+ func_mysqli_fetch_array($link, $engine, "INTEGER", 2147483647, "2147483647", 210);
+ func_mysqli_fetch_array($link, $engine, "INTEGER", NULL, NULL, 220);
+ func_mysqli_fetch_array($link, $engine, "INTEGER UNSIGNED", "4294967295", "4294967295", 230);
+ func_mysqli_fetch_array($link, $engine, "INTEGER UNSIGNED", NULL, NULL, 240);
+
+ if ($IS_MYSQLND ||
+ ((mysqli_get_server_version($link) >= 51000) &&
+ (mysqli_get_client_version($link) >= 51000))) {
+ func_mysqli_fetch_array($link, $engine, "BIGINT", "-9223372036854775808", "-9223372036854775808", 250);
+ func_mysqli_fetch_array($link, $engine, "BIGINT", NULL, NULL, 260);
+ func_mysqli_fetch_array($link, $engine, "BIGINT UNSIGNED", "18446744073709551615", "18446744073709551615", 260);
+ func_mysqli_fetch_array($link, $engine, "BIGINT UNSIGNED", NULL, NULL, 280);
+ }
+
+ func_mysqli_fetch_array($link, $engine, "FLOAT", (string)(-9223372036854775808 - 1.1), "-9.22337e+18", 290, "/-9\.22337e\+?[0]?18/iu");
+ func_mysqli_fetch_array($link, $engine, "FLOAT", NULL, NULL, 300);
+ func_mysqli_fetch_array($link, $engine, "FLOAT UNSIGNED", (string)(18446744073709551615 + 1.1), "1.84467e+?19", 310, "/1\.84467e\+?[0]?19/iu");
+ func_mysqli_fetch_array($link, $engine, "FLOAT UNSIGNED ", NULL, NULL, 320);
+
+ func_mysqli_fetch_array($link, $engine, "DOUBLE(10,2)", "-99999999.99", "-99999999.99", 330);
+ func_mysqli_fetch_array($link, $engine, "DOUBLE(10,2)", NULL, NULL, 340);
+ func_mysqli_fetch_array($link, $engine, "DOUBLE(10,2) UNSIGNED", "99999999.99", "99999999.99", 350);
+ func_mysqli_fetch_array($link, $engine, "DOUBLE(10,2) UNSIGNED", NULL, NULL, 360);
+
+ func_mysqli_fetch_array($link, $engine, "DECIMAL(10,2)", "-99999999.99", "-99999999.99", 370);
+ func_mysqli_fetch_array($link, $engine, "DECIMAL(10,2)", NULL, NULL, 380);
+ func_mysqli_fetch_array($link, $engine, "DECIMAL(10,2)", "99999999.99", "99999999.99", 390);
+ func_mysqli_fetch_array($link, $engine, "DECIMAL(10,2)", NULL, NULL, 400);
+
+ // don't care about date() strict TZ warnings...
+ $date = @date('Y-m-d');
+ func_mysqli_fetch_array($link, $engine, "DATE",$date, $date, 410);
+ func_mysqli_fetch_array($link, $engine, "DATE NOT NULL",$date, $date, 420);
+ func_mysqli_fetch_array($link, $engine, "DATE", NULL, NULL, 430);
+
+ $date = @date('Y-m-d H:i:s');
+ func_mysqli_fetch_array($link, $engine, "DATETIME", $date, $date, 440);
+ func_mysqli_fetch_array($link, $engine, "DATETIME NOT NULL", $date, $date, 450);
+ func_mysqli_fetch_array($link, $engine, "DATETIME", NULL, NULL, 460);
+ func_mysqli_fetch_array($link, $engine, "TIMESTAMP", $date, $date, 470);
+
+ $date = @date('H:i:s');
+ func_mysqli_fetch_array($link, $engine, "TIME", $date, $date, 480);
+ func_mysqli_fetch_array($link, $engine, "TIME NOT NULL", $date, $date, 490);
+ func_mysqli_fetch_array($link, $engine, "TIME", NULL, NULL, 500);
+
+ func_mysqli_fetch_array($link, $engine, "YEAR", @date('Y'), @date('Y'), 510);
+ func_mysqli_fetch_array($link, $engine, "YEAR NOT NULL", @date('Y'), @date('Y'), 520);
+ func_mysqli_fetch_array($link, $engine, "YEAR", NULL, NULL, 530);
+
+ $string255 = func_mysqli_fetch_array_make_string(255);
+ func_mysqli_fetch_array($link, $engine, "CHAR(1)", "a", "a", 540);
+ func_mysqli_fetch_array($link, $engine, "CHAR(255)", $string255, $string255, 550);
+ func_mysqli_fetch_array($link, $engine, "CHAR(1) NOT NULL", "a", "a", 560);
+ func_mysqli_fetch_array($link, $engine, "CHAR(1)", NULL, NULL, 570);
+
+ $string65k = func_mysqli_fetch_array_make_string(65400);
+ func_mysqli_fetch_array($link, $engine, "VARCHAR(1)", "a", "a", 580);
+ func_mysqli_fetch_array($link, $engine, "VARCHAR(255)", $string255, $string255, 590);
+ func_mysqli_fetch_array($link, $engine, "VARCHAR(65400)", $string65k, $string65k, 600);
+ func_mysqli_fetch_array($link, $engine, "VARCHAR(1) NOT NULL", "a", "a", 610);
+ func_mysqli_fetch_array($link, $engine, "VARCHAR(1)", NULL, NULL, 620);
+
+ func_mysqli_fetch_array($link, $engine, "BINARY(1)", "a", "a", 630, null, true);
+ func_mysqli_fetch_array($link, $engine, "BINARY(2)", chr(0) . "a", chr(0) . "a", 640, null, true);
+ func_mysqli_fetch_array($link, $engine, "BINARY(1) NOT NULL", "b", "b", 650, null, true);
+ func_mysqli_fetch_array($link, $engine, "BINARY(1)", NULL, NULL, 660, null, true);
+
+ func_mysqli_fetch_array($link, $engine, "VARBINARY(1)", "a", "a", 670, null, true);
+ func_mysqli_fetch_array($link, $engine, "VARBINARY(2)", chr(0) . "a", chr(0) . "a", 680, null, true);
+ func_mysqli_fetch_array($link, $engine, "VARBINARY(1) NOT NULL", "b", "b", 690, null, true);
+ func_mysqli_fetch_array($link, $engine, "VARBINARY(1)", NULL, NULL, 700, null, true);
+
+ func_mysqli_fetch_array($link, $engine, "TINYBLOB", "a", "a", 710, null, true);
+ func_mysqli_fetch_array($link, $engine, "TINYBLOB", chr(0) . "a", chr(0) . "a", 720, null, true);
+ func_mysqli_fetch_array($link, $engine, "TINYBLOB NOT NULL", "b", "b", 730, null, true);
+ func_mysqli_fetch_array($link, $engine, "TINYBLOB", NULL, NULL, 740, null, true);
+
+ func_mysqli_fetch_array($link, $engine, "TINYTEXT", "a", "a", 750);
+ func_mysqli_fetch_array($link, $engine, "TINYTEXT NOT NULL", "a", "a", 760);
+ func_mysqli_fetch_array($link, $engine, "TINYTEXT", NULL, NULL, 770);
+
+ func_mysqli_fetch_array($link, $engine, "BLOB", "a", "a", 780, null, true);
+ func_mysqli_fetch_array($link, $engine, "BLOB", chr(0) . "a", chr(0) . "a", 780, null, true);
+ func_mysqli_fetch_array($link, $engine, "BLOB", NULL, NULL, 790, null, true);
+
+ func_mysqli_fetch_array($link, $engine, "TEXT", "a", "a", 800);
+ func_mysqli_fetch_array($link, $engine, "TEXT", chr(0) . "a", chr(0) . "a", 810);
+ func_mysqli_fetch_array($link, $engine, "TEXT", NULL, NULL, 820);
+
+ func_mysqli_fetch_array($link, $engine, "MEDIUMBLOB", "a", "a", 830, null, true);
+ func_mysqli_fetch_array($link, $engine, "MEDIUMBLOB", chr(0) . "a", chr(0) . "a", 840, null, true);
+ func_mysqli_fetch_array($link, $engine, "MEDIUMBLOB", NULL, NULL, 850, null, true);
+
+ func_mysqli_fetch_array($link, $engine, "MEDIUMTEXT", "a", "a", 860);
+ func_mysqli_fetch_array($link, $engine, "MEDIUMTEXT", chr(0) . "a", chr(0) . "a", 870);
+ func_mysqli_fetch_array($link, $engine, "MEDIUMTEXT", NULL, NULL, 880);
+
+ func_mysqli_fetch_array($link, $engine, "LONGBLOB", "a", "a", 890, null, true);
+ func_mysqli_fetch_array($link, $engine, "LONGTEXT", chr(0) . "a", chr(0) . "a", 900);
+ func_mysqli_fetch_array($link, $engine, "LONGBLOB", NULL, NULL, 910, null, true);
+
+ func_mysqli_fetch_array($link, $engine, "ENUM('a', 'b')", "a", "a", 920);
+ func_mysqli_fetch_array($link, $engine, "ENUM('a', 'b')", NULL, NULL, 930);
+
+ func_mysqli_fetch_array($link, $engine, "SET('a', 'b')", "a", "a", 940);
+ func_mysqli_fetch_array($link, $engine, "SET('a', 'b')", NULL, NULL, 950);
+
+ mysqli_close($link);
+
+ try {
+ mysqli_fetch_array($res, MYSQLI_ASSOC);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ print "done!";
?>
--EXPECTF--
[005]
@@ -369,6 +364,5 @@ array(11) {
Warning: mysqli_fetch_array(): The result type should be either MYSQLI_NUM, MYSQLI_ASSOC or MYSQLI_BOTH in %s on line %d
Warning: mysqli_fetch_array(): The result type should be either MYSQLI_NUM, MYSQLI_ASSOC or MYSQLI_BOTH in %s on line %d
-
-Warning: mysqli_fetch_array(): Couldn't fetch mysqli_result in %s on line %d
+mysqli_result object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_fetch_array_assoc.phpt b/ext/mysqli/tests/mysqli_fetch_array_assoc.phpt
index 4701926d6c..6899c0bfba 100644
--- a/ext/mysqli/tests/mysqli_fetch_array_assoc.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_array_assoc.phpt
@@ -8,24 +8,24 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require('table.inc');
+ require('table.inc');
- if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 5")) {
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- print "[002]\n";
- var_dump(mysqli_fetch_array($res, MYSQLI_ASSOC));
- mysqli_free_result($res);
+ if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 5")) {
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ print "[002]\n";
+ var_dump(mysqli_fetch_array($res, MYSQLI_ASSOC));
+ mysqli_free_result($res);
- if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id LIMIT 5")) {
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- print "[004]\n";
- var_dump(mysqli_fetch_array($res, MYSQLI_ASSOC));
- mysqli_free_result($res);
+ if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id LIMIT 5")) {
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ print "[004]\n";
+ var_dump(mysqli_fetch_array($res, MYSQLI_ASSOC));
+ mysqli_free_result($res);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_fetch_array_large.phpt b/ext/mysqli/tests/mysqli_fetch_array_large.phpt
index 3c6a0f03f3..59d5669126 100644
--- a/ext/mysqli/tests/mysqli_fetch_array_large.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_array_large.phpt
@@ -9,155 +9,155 @@ require_once('skipifconnectfailure.inc');
memory_limit=-1
--FILE--
<?php
- require_once("connect.inc");
-
- function mysqli_fetch_array_large($offset, $link, $package_size) {
-
- /* we are aiming for maximum compression to test MYSQLI_CLIENT_COMPRESS */
- $random_char = str_repeat('a', 255);
- $sql = "INSERT INTO test(label) VALUES ";
-
- while (strlen($sql) < ($package_size - 259))
- $sql .= sprintf("('%s'), ", $random_char);
-
- $sql = substr($sql, 0, -2);
- $len = strlen($sql);
- assert($len < $package_size);
-
- if (!@mysqli_query($link, $sql)) {
- if (1153 == mysqli_errno($link) || 2006 == mysqli_errno($link) || stristr(mysqli_error($link), 'max_allowed_packet'))
- /*
- myslqnd - [1153] Got a packet bigger than 'max_allowed_packet' bytes
- libmysql -[2006] MySQL server has gone away
- */
- return false;
-
- printf("[%03d + 1] len = %d, [%d] %s\n", $offset, $len, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- /* buffered result set - let's hope we do not run into PHP memory limit... */
- if (!$res = mysqli_query($link, "SELECT id, label FROM test")) {
- printf("[%03d + 2] len = %d, [%d] %s\n", $offset, $len, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- while ($row = mysqli_fetch_assoc($res)) {
- if ($row['label'] != $random_char) {
- printf("[%03d + 3] Wrong results - expecting '%s' got '%s', len = %d, [%d] %s\n",
- $offset, $random_char, $row['label'], $len, mysqli_errno($link), mysqli_error($link));
- return false;
- }
- }
- mysqli_free_result($res);
-
- if (!$stmt = mysqli_prepare($link, "SELECT id, label FROM test")) {
- printf("[%03d + 4] len = %d, [%d] %s\n", $offset, $len, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- /* unbuffered result set */
- if (!mysqli_stmt_execute($stmt)) {
- printf("[%03d + 5] len = %d, [%d] %s, [%d] %s\n", $offset, $len, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- $id = $label = NULL;
- if (!mysqli_stmt_bind_result($stmt, $id, $label)) {
- printf("[%03d + 6] len = %d, [%d] %s, [%d] %s\n", $offset, $len, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- while (mysqli_stmt_fetch($stmt)) {
- if ($label != $random_char) {
- printf("[%03d + 7] Wrong results - expecting '%s' got '%s', len = %d, [%d] %s\n",
- $offset, $random_char, $label, $len, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
- }
-
- mysqli_stmt_free_result($stmt);
- mysqli_stmt_close($stmt);
-
- return true;
- }
-
- function parse_memory_limit($limit) {
-
- $val = trim($limit);
- $last = strtolower($val[strlen($val)-1]);
-
- switch($last) {
- // The 'G' modifier is available since PHP 5.1.0
- case 'g':
- $val *= 1024;
- case 'm':
- $val *= 1024;
- case 'k':
- $val *= 1024;
- default:
- break;
- }
- return $val;
- }
-
-
- function test_fetch($host, $user, $passwd, $db, $port, $socket, $engine, $flags = null) {
-
- $link = mysqli_init();
- if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, $flags)) {
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- return false;
- }
-
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test") ||
- !mysqli_query($link, sprintf("CREATE TABLE test(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, label VARCHAR(255)) ENGINE = %s", $engine))) {
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- $package_size = 524288;
- $offset = 3;
- $limit = (ini_get('memory_limit') > 0) ? parse_memory_limit(ini_get('memory_limit')) : pow(2, 32);
-
- /* try to respect php.ini but make run time a soft limit */
- $max_runtime = (ini_get('max_execution_time') > 0) ? ini_get('max_execution_time') : 30;
- set_time_limit(0);
-
- do {
- if ($package_size > $limit) {
- printf("stop: memory limit - %s vs. %s\n", $package_size, $limit);
- break;
- }
-
- $start = microtime(true);
- if (!mysqli_fetch_array_large($offset++, $link, $package_size)) {
- printf("stop: packet size - %d\n", $package_size);
- break;
- }
-
- $duration = microtime(true) - $start;
- $max_runtime -= $duration;
- if ($max_runtime < ($duration * 3)) {
- /* likely the next iteration will not be within max_execution_time */
- printf("stop: time limit - %2.2fs\n", $max_runtime);
- break;
- }
-
- $package_size += $package_size;
-
- } while (true);
-
-
- mysqli_close($link);
- return true;
- }
-
-
- test_fetch($host, $user, $passwd, $db, $port, $socket, $engine, null);
- test_fetch($host, $user, $passwd, $db, $port, $socket, $engine, MYSQLI_CLIENT_COMPRESS);
- print "done!";
+ require_once("connect.inc");
+
+ function mysqli_fetch_array_large($offset, $link, $package_size) {
+
+ /* we are aiming for maximum compression to test MYSQLI_CLIENT_COMPRESS */
+ $random_char = str_repeat('a', 255);
+ $sql = "INSERT INTO test(label) VALUES ";
+
+ while (strlen($sql) < ($package_size - 259))
+ $sql .= sprintf("('%s'), ", $random_char);
+
+ $sql = substr($sql, 0, -2);
+ $len = strlen($sql);
+ assert($len < $package_size);
+
+ if (!@mysqli_query($link, $sql)) {
+ if (1153 == mysqli_errno($link) || 2006 == mysqli_errno($link) || stristr(mysqli_error($link), 'max_allowed_packet'))
+ /*
+ myslqnd - [1153] Got a packet bigger than 'max_allowed_packet' bytes
+ libmysql -[2006] MySQL server has gone away
+ */
+ return false;
+
+ printf("[%03d + 1] len = %d, [%d] %s\n", $offset, $len, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ /* buffered result set - let's hope we do not run into PHP memory limit... */
+ if (!$res = mysqli_query($link, "SELECT id, label FROM test")) {
+ printf("[%03d + 2] len = %d, [%d] %s\n", $offset, $len, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ while ($row = mysqli_fetch_assoc($res)) {
+ if ($row['label'] != $random_char) {
+ printf("[%03d + 3] Wrong results - expecting '%s' got '%s', len = %d, [%d] %s\n",
+ $offset, $random_char, $row['label'], $len, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+ }
+ mysqli_free_result($res);
+
+ if (!$stmt = mysqli_prepare($link, "SELECT id, label FROM test")) {
+ printf("[%03d + 4] len = %d, [%d] %s\n", $offset, $len, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ /* unbuffered result set */
+ if (!mysqli_stmt_execute($stmt)) {
+ printf("[%03d + 5] len = %d, [%d] %s, [%d] %s\n", $offset, $len, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ $id = $label = NULL;
+ if (!mysqli_stmt_bind_result($stmt, $id, $label)) {
+ printf("[%03d + 6] len = %d, [%d] %s, [%d] %s\n", $offset, $len, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ while (mysqli_stmt_fetch($stmt)) {
+ if ($label != $random_char) {
+ printf("[%03d + 7] Wrong results - expecting '%s' got '%s', len = %d, [%d] %s\n",
+ $offset, $random_char, $label, $len, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+ }
+
+ mysqli_stmt_free_result($stmt);
+ mysqli_stmt_close($stmt);
+
+ return true;
+ }
+
+ function parse_memory_limit($limit) {
+
+ $val = trim($limit);
+ $last = strtolower($val[strlen($val)-1]);
+
+ switch($last) {
+ // The 'G' modifier is available since PHP 5.1.0
+ case 'g':
+ $val *= 1024;
+ case 'm':
+ $val *= 1024;
+ case 'k':
+ $val *= 1024;
+ default:
+ break;
+ }
+ return $val;
+ }
+
+
+ function test_fetch($host, $user, $passwd, $db, $port, $socket, $engine, $flags = null) {
+
+ $link = mysqli_init();
+ if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, $flags)) {
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ return false;
+ }
+
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test") ||
+ !mysqli_query($link, sprintf("CREATE TABLE test(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, label VARCHAR(255)) ENGINE = %s", $engine))) {
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ $package_size = 524288;
+ $offset = 3;
+ $limit = (ini_get('memory_limit') > 0) ? parse_memory_limit(ini_get('memory_limit')) : pow(2, 32);
+
+ /* try to respect php.ini but make run time a soft limit */
+ $max_runtime = (ini_get('max_execution_time') > 0) ? ini_get('max_execution_time') : 30;
+ set_time_limit(0);
+
+ do {
+ if ($package_size > $limit) {
+ printf("stop: memory limit - %s vs. %s\n", $package_size, $limit);
+ break;
+ }
+
+ $start = microtime(true);
+ if (!mysqli_fetch_array_large($offset++, $link, $package_size)) {
+ printf("stop: packet size - %d\n", $package_size);
+ break;
+ }
+
+ $duration = microtime(true) - $start;
+ $max_runtime -= $duration;
+ if ($max_runtime < ($duration * 3)) {
+ /* likely the next iteration will not be within max_execution_time */
+ printf("stop: time limit - %2.2fs\n", $max_runtime);
+ break;
+ }
+
+ $package_size += $package_size;
+
+ } while (true);
+
+
+ mysqli_close($link);
+ return true;
+ }
+
+
+ test_fetch($host, $user, $passwd, $db, $port, $socket, $engine, null);
+ test_fetch($host, $user, $passwd, $db, $port, $socket, $engine, MYSQLI_CLIENT_COMPRESS);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_fetch_array_many_rows.phpt b/ext/mysqli/tests/mysqli_fetch_array_many_rows.phpt
index d372ef5574..5f86e3739a 100644
--- a/ext/mysqli/tests/mysqli_fetch_array_many_rows.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_array_many_rows.phpt
@@ -8,104 +8,104 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require("table.inc");
-
- // do as much as we can do in 5 seconds
- $start = microtime(true);
- for ($id = 100, $start = microtime(true); (microtime(true) - $start) < 5; $id++) {
- if (!mysqli_query($link, $sql = sprintf("INSERT INTO test(id, label) VALUES (%d, '%s')",
- $id, mysqli_real_escape_string($link, chr(65 + ($id % 26)))))) {
- printf("[001] %s failed: [%d] %s\n", $sql, mysqli_errno($link), mysqli_error($link));
- break;
- }
- }
-
- if (!$res = mysqli_query($link, 'SELECT id, label FROM test')) {
- printf("[002] SELECT failed: [%d] %s\n", mysqli_errno($link), mysqli_errno($link));
- }
-
- while ($row = mysqli_fetch_array($res)) {
- // overwrite results and check if the cache magic works
- $row['label'] = NULL;
- }
- mysqli_free_result($res);
-
- if (!$res = mysqli_query($link, 'SELECT id, label FROM test')) {
- printf("[003] SELECT failed: [%d] %s\n", mysqli_errno($link), mysqli_errno($link));
- }
-
- $i = 0;
- $results = array();
- while ($row = mysqli_fetch_array($res, MYSQLI_BOTH)) {
-
- // create copies and destroy later
- $results[$i++] = &$row;
- if ($i % 999) {
- $results = array();
- }
-
- if ($row[0] < 0 || $row[0] > $id) {
- printf("[004] Unexpected result row[0] = '%s' (range 0...%d), [%d] %s\n",
- $row[0], $id, mysqli_errno($link), mysqli_error($link));
- break;
- }
- if ($row[0] !== $row['id']) {
- printf("[005] Unexpected result row[0] = '%s', row[id] = '%s', [%d] %s\n",
- $row[0], $row[id], mysqli_errno($link), mysqli_error($link));
- break;
- }
-
- $len = strlen($row[1]);
- if (!is_string($row[1]) || $len == 0 || $len > 1) {
- printf("[006] Unexpected result row[1] = '%s', [%d] %s\n",
- $row[1], mysqli_errno($link), mysqli_error($link));
- break;
- }
- if ($row[1] !== $row['label']) {
- printf("[007] Unexpected result row[1] = '%s', row[label] = '%s', [%d] %s\n",
- $row[1], $row['label'], mysqli_errno($link), mysqli_error($link));
- break;
- }
-
- }
- mysqli_free_result($res);
-
- if (!$res = mysqli_query($link, 'SELECT id, label FROM test')) {
- printf("[008] SELECT failed: [%d] %s\n", mysqli_errno($link), mysqli_errno($link));
- }
-
- while ($row = mysqli_fetch_array($res, MYSQLI_ASSOC)) {
- // overwrite results and check if the cache magic works
- $row['label'] = NULL;
- }
- mysqli_free_result($res);
-
- if (!$res = mysqli_query($link, 'SELECT count(*) AS num FROM test')) {
- printf("[009] SELECT failed: [%d] %s\n", mysqli_errno($link), mysqli_errno($link));
- }
- $row = mysqli_fetch_assoc($res);
- $num = $row['num'];
- mysqli_free_result($res);
-
- if (!$res = mysqli_query($link, 'SELECT id, label FROM test')) {
- printf("[010] SELECT failed: [%d] %s\n", mysqli_errno($link), mysqli_errno($link));
- }
-
- $i = 0;
- while ($row = mysqli_fetch_array($res, MYSQLI_NUM)) {
- // overwrite results and check if the cache magic works
- $row[0] = NULL;
- $i++;
- }
- mysqli_free_result($res);
-
- if ($i != $num)
- printf("[011] Expecting %d results, got %d results, [%d] %s\n",
- $num, $i, mysqli_errno($link), mysqli_error($link));
-
- mysqli_close($link);
-
- print "done!";
+ require("table.inc");
+
+ // do as much as we can do in 5 seconds
+ $start = microtime(true);
+ for ($id = 100, $start = microtime(true); (microtime(true) - $start) < 5; $id++) {
+ if (!mysqli_query($link, $sql = sprintf("INSERT INTO test(id, label) VALUES (%d, '%s')",
+ $id, mysqli_real_escape_string($link, chr(65 + ($id % 26)))))) {
+ printf("[001] %s failed: [%d] %s\n", $sql, mysqli_errno($link), mysqli_error($link));
+ break;
+ }
+ }
+
+ if (!$res = mysqli_query($link, 'SELECT id, label FROM test')) {
+ printf("[002] SELECT failed: [%d] %s\n", mysqli_errno($link), mysqli_errno($link));
+ }
+
+ while ($row = mysqli_fetch_array($res)) {
+ // overwrite results and check if the cache magic works
+ $row['label'] = NULL;
+ }
+ mysqli_free_result($res);
+
+ if (!$res = mysqli_query($link, 'SELECT id, label FROM test')) {
+ printf("[003] SELECT failed: [%d] %s\n", mysqli_errno($link), mysqli_errno($link));
+ }
+
+ $i = 0;
+ $results = array();
+ while ($row = mysqli_fetch_array($res, MYSQLI_BOTH)) {
+
+ // create copies and destroy later
+ $results[$i++] = &$row;
+ if ($i % 999) {
+ $results = array();
+ }
+
+ if ($row[0] < 0 || $row[0] > $id) {
+ printf("[004] Unexpected result row[0] = '%s' (range 0...%d), [%d] %s\n",
+ $row[0], $id, mysqli_errno($link), mysqli_error($link));
+ break;
+ }
+ if ($row[0] !== $row['id']) {
+ printf("[005] Unexpected result row[0] = '%s', row[id] = '%s', [%d] %s\n",
+ $row[0], $row[id], mysqli_errno($link), mysqli_error($link));
+ break;
+ }
+
+ $len = strlen($row[1]);
+ if (!is_string($row[1]) || $len == 0 || $len > 1) {
+ printf("[006] Unexpected result row[1] = '%s', [%d] %s\n",
+ $row[1], mysqli_errno($link), mysqli_error($link));
+ break;
+ }
+ if ($row[1] !== $row['label']) {
+ printf("[007] Unexpected result row[1] = '%s', row[label] = '%s', [%d] %s\n",
+ $row[1], $row['label'], mysqli_errno($link), mysqli_error($link));
+ break;
+ }
+
+ }
+ mysqli_free_result($res);
+
+ if (!$res = mysqli_query($link, 'SELECT id, label FROM test')) {
+ printf("[008] SELECT failed: [%d] %s\n", mysqli_errno($link), mysqli_errno($link));
+ }
+
+ while ($row = mysqli_fetch_array($res, MYSQLI_ASSOC)) {
+ // overwrite results and check if the cache magic works
+ $row['label'] = NULL;
+ }
+ mysqli_free_result($res);
+
+ if (!$res = mysqli_query($link, 'SELECT count(*) AS num FROM test')) {
+ printf("[009] SELECT failed: [%d] %s\n", mysqli_errno($link), mysqli_errno($link));
+ }
+ $row = mysqli_fetch_assoc($res);
+ $num = $row['num'];
+ mysqli_free_result($res);
+
+ if (!$res = mysqli_query($link, 'SELECT id, label FROM test')) {
+ printf("[010] SELECT failed: [%d] %s\n", mysqli_errno($link), mysqli_errno($link));
+ }
+
+ $i = 0;
+ while ($row = mysqli_fetch_array($res, MYSQLI_NUM)) {
+ // overwrite results and check if the cache magic works
+ $row[0] = NULL;
+ $i++;
+ }
+ mysqli_free_result($res);
+
+ if ($i != $num)
+ printf("[011] Expecting %d results, got %d results, [%d] %s\n",
+ $num, $i, mysqli_errno($link), mysqli_error($link));
+
+ mysqli_close($link);
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_fetch_array_oo.phpt b/ext/mysqli/tests/mysqli_fetch_array_oo.phpt
index b0e2234960..616be43e8b 100644
--- a/ext/mysqli/tests/mysqli_fetch_array_oo.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_array_oo.phpt
@@ -8,273 +8,276 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
-
- require('table.inc');
- if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
-
- if (!$res = $mysqli->query("SELECT * FROM test ORDER BY id LIMIT 5")) {
- printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
-
- print "[005]\n";
- var_dump($res->fetch_array());
-
- print "[006]\n";
- var_dump($res->fetch_array(MYSQLI_NUM));
-
- print "[007]\n";
- var_dump($res->fetch_array(MYSQLI_BOTH));
-
- print "[008]\n";
- var_dump($res->fetch_array(MYSQLI_ASSOC));
-
- print "[009]\n";
- var_dump($res->fetch_array());
-
- $res->free_result();
-
- if (!$res = $mysqli->query("SELECT 1 AS a, 2 AS a, 3 AS c, 4 AS C, NULL AS d, true AS e")) {
- printf("[010] Cannot run query, [%d] %s\n", $mysqli->errno, $$mysqli->error);
- }
- print "[011]\n";
- var_dump($res->fetch_array(MYSQLI_BOTH));
-
- $res->free_result();
- if (!$res = $mysqli->query("SELECT 1 AS a, 2 AS b, 3 AS c, 4 AS C")) {
- printf("[012] Cannot run query, [%d] %s\n",
- $mysqli->errno, $$mysqli->error);
- exit(1);
- }
-
- do {
- $illegal_mode = mt_rand(-10000, 10000);
- } while (in_array($illegal_mode, array(MYSQLI_ASSOC, MYSQLI_NUM, MYSQLI_BOTH)));
- // NOTE: for BC reasons with ext/mysql, ext/mysqli accepts invalid result modes.
- $tmp = $res->fetch_array($illegal_mode);
- if (false !== $tmp)
- printf("[013] Expecting boolean/false although, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, $mysqli->errno, $mysqli->error);
-
- $tmp = $res->fetch_array($illegal_mode);
- if (false !== $tmp)
- printf("[014] Expecting boolean/false, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, $mysqli->errno, $mysqli->error);
-
- $res->free_result();
-
- function func_mysqli_fetch_array($mysqli, $engine, $sql_type, $sql_value, $php_value, $offset, $regexp_comparison = NULL) {
-
- if (!$mysqli->query("DROP TABLE IF EXISTS test")) {
- printf("[%04d] [%d] %s\n", $offset, $mysqli->errno, $mysqli->error);
- return false;
- }
-
- if (!$mysqli->query($sql = sprintf("CREATE TABLE test(id INT NOT NULL, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) {
- // don't bail, engine might not support the datatype
- return false;
- }
-
- if (is_null($php_value)) {
- if (!$mysqli->query($sql = sprintf("INSERT INTO test(id, label) VALUES (1, NULL)"))) {
- printf("[%04d] [%d] %s\n", $offset + 1, $mysqli->errno, $mysqli->error);
- return false;
- }
- } else {
- if (is_string($sql_value)) {
- if (!$mysqli->query($sql = "INSERT INTO test(id, label) VALUES (1, '" . $sql_value . "')")) {
- printf("[%04ds] [%d] %s - %s\n", $offset + 1, $mysqli->errno, $mysqli->error, $sql);
- return false;
- }
- } else {
- if (!$mysqli->query($sql = sprintf("INSERT INTO test(id, label) VALUES (1, '%d')", $sql_value))) {
- printf("[%04di] [%d] %s\n", $offset + 1, $mysqli->errno, $mysqli->error);
- return false;
- }
- }
- }
-
- if (!$res = $mysqli->query("SELECT id, label FROM test")) {
- printf("[%04d] [%d] %s\n", $offset + 2, $mysqli->errno, $mysqli->error);
- return false;
- }
-
- if (!$row = $res->fetch_array(MYSQLI_BOTH)) {
- printf("[%04d] [%d] %s\n", $offset + 3, $mysqli->errno, $mysqli->error);
- return false;
- }
- $fields = mysqli_fetch_fields($res);
-
- if (!(gettype($php_value)=="unicode" && ($fields[1]->flags & 128))) {
- if ($regexp_comparison) {
- if (!preg_match($regexp_comparison, (string)$row['label']) || !preg_match($regexp_comparison, (string)$row[1])) {
- printf("[%04d] Expecting %s/%s [reg exp = %s], got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4,
- gettype($php_value), $php_value, $regexp_comparison,
- gettype($row[1]), $row[1],
- gettype($row['label']), $row['label'], $mysqli->errno, $mysqli->error);
- return false;
- }
- } else {
- if (($row['label'] !== $php_value) || ($row[1] != $php_value)) {
- printf("[%04d] Expecting %s/%s, got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4,
- gettype($php_value), $php_value,
- gettype($row[1]), $row[1],
- gettype($row['label']), $row['label'], $mysqli->errno, $mysqli->error);
- return false;
- }
- }
- }
- return true;
- }
-
- function func_mysqli_fetch_array_make_string($len) {
-
- $ret = '';
- for ($i = 0; $i < $len; $i++)
- $ret .= chr(mt_rand(65, 90));
-
- return $ret;
- }
-
- func_mysqli_fetch_array($mysqli, $engine, "TINYINT", -11, "-11", 20);
- func_mysqli_fetch_array($mysqli, $engine, "TINYINT", NULL, NULL, 30);
- func_mysqli_fetch_array($mysqli, $engine, "TINYINT UNSIGNED", 1, "1", 40);
- func_mysqli_fetch_array($mysqli, $engine, "TINYINT UNSIGNED", NULL, NULL, 50);
-
- func_mysqli_fetch_array($mysqli, $engine, "BOOL", 1, "1", 60);
- func_mysqli_fetch_array($mysqli, $engine, "BOOL", NULL, NULL, 70);
- func_mysqli_fetch_array($mysqli, $engine, "BOOLEAN", 0, "0", 80);
- func_mysqli_fetch_array($mysqli, $engine, "BOOLEAN", NULL, NULL, 90);
-
- func_mysqli_fetch_array($mysqli, $engine, "SMALLINT", -32768, "-32768", 100);
- func_mysqli_fetch_array($mysqli, $engine, "SMALLINT", 32767, "32767", 110);
- func_mysqli_fetch_array($mysqli, $engine, "SMALLINT", NULL, NULL, 120);
- func_mysqli_fetch_array($mysqli, $engine, "SMALLINT UNSIGNED", 65535, "65535", 130);
- func_mysqli_fetch_array($mysqli, $engine, "SMALLINT UNSIGNED", NULL, NULL, 140);
-
- func_mysqli_fetch_array($mysqli, $engine, "MEDIUMINT", -8388608, "-8388608", 150);
- func_mysqli_fetch_array($mysqli, $engine, "MEDIUMINT", 8388607, "8388607", 160);
- func_mysqli_fetch_array($mysqli, $engine, "MEDIUMINT", NULL, NULL, 170);
- func_mysqli_fetch_array($mysqli, $engine, "MEDIUMINT UNSIGNED", 16777215, "16777215", 180);
- func_mysqli_fetch_array($mysqli, $engine, "MEDIUMINT UNSIGNED", NULL, NULL, 190);
-
- func_mysqli_fetch_array($mysqli, $engine, "INTEGER", -2147483648, "-2147483648", 200);
- func_mysqli_fetch_array($mysqli, $engine, "INTEGER", 2147483647, "2147483647", 210);
- func_mysqli_fetch_array($mysqli, $engine, "INTEGER", NULL, NULL, 220);
- func_mysqli_fetch_array($mysqli, $engine, "INTEGER UNSIGNED", "4294967295", "4294967295", 230);
- func_mysqli_fetch_array($mysqli, $engine, "INTEGER UNSIGNED", NULL, NULL, 240);
-
- if ($IS_MYSQLND ||
- ((mysqli_get_server_version($link) >= 51000) &&
- (mysqli_get_client_version($link) >= 51000))) {
- func_mysqli_fetch_array($mysqli, $engine, "BIGINT", "-9223372036854775808", "-9223372036854775808", 250);
- func_mysqli_fetch_array($mysqli, $engine, "BIGINT", NULL, NULL, 260);
- func_mysqli_fetch_array($mysqli, $engine, "BIGINT UNSIGNED", "18446744073709551615", "18446744073709551615", 270);
- func_mysqli_fetch_array($mysqli, $engine, "BIGINT UNSIGNED", NULL, NULL, 280);
- }
-
- func_mysqli_fetch_array($mysqli, $engine, "FLOAT", (string)(-9223372036854775808 - 1.1), "-9.22337e+18", 290, "/-9\.22337e\+?[0]?18/iu");
- func_mysqli_fetch_array($mysqli, $engine, "FLOAT", NULL, NULL, 300);
- func_mysqli_fetch_array($mysqli, $engine, "FLOAT UNSIGNED", (string)(18446744073709551615 + 1.1), "1.84467e+?19", 310, "/1\.84467e\+?[0]?19/iu");
- func_mysqli_fetch_array($mysqli, $engine, "FLOAT UNSIGNED ", NULL, NULL, 320);
-
- func_mysqli_fetch_array($mysqli, $engine, "DOUBLE(10,2)", "-99999999.99", "-99999999.99", 330);
- func_mysqli_fetch_array($mysqli, $engine, "DOUBLE(10,2)", NULL, NULL, 340);
- func_mysqli_fetch_array($mysqli, $engine, "DOUBLE(10,2) UNSIGNED", "99999999.99", "99999999.99", 350);
- func_mysqli_fetch_array($mysqli, $engine, "DOUBLE(10,2) UNSIGNED", NULL, NULL, 360);
- func_mysqli_fetch_array($mysqli, $engine, "DECIMAL(10,2)", "-99999999.99", "-99999999.99", 370);
- func_mysqli_fetch_array($mysqli, $engine, "DECIMAL(10,2)", NULL, NULL, 380);
- func_mysqli_fetch_array($mysqli, $engine, "DECIMAL(10,2)", "99999999.99", "99999999.99", 390);
- func_mysqli_fetch_array($mysqli, $engine, "DECIMAL(10,2)", NULL, NULL, 400);
-
- // don't care about date() strict TZ warnings...
- $date = @date('Y-m-d');
- func_mysqli_fetch_array($mysqli, $engine, "DATE",$date, $date, 410);
- func_mysqli_fetch_array($mysqli, $engine, "DATE NOT NULL",$date, $date, 420);
- func_mysqli_fetch_array($mysqli, $engine, "DATE", NULL, NULL, 430);
-
- $date = @date('Y-m-d H:i:s');
- func_mysqli_fetch_array($mysqli, $engine, "DATETIME", $date, $date, 440);
- func_mysqli_fetch_array($mysqli, $engine, "DATETIME NOT NULL", $date, $date, 450);
- func_mysqli_fetch_array($mysqli, $engine, "DATETIME", NULL, NULL, 460);
- func_mysqli_fetch_array($mysqli, $engine, "TIMESTAMP", $date, $date, 470);
- $date = @date('H:i:s');
- func_mysqli_fetch_array($mysqli, $engine, "TIME", $date, $date, 480);
- func_mysqli_fetch_array($mysqli, $engine, "TIME NOT NULL", $date, $date, 490);
- func_mysqli_fetch_array($mysqli, $engine, "TIME", NULL, NULL, 500);
- func_mysqli_fetch_array($mysqli, $engine, "YEAR", @date('Y'), @date('Y'), 510);
- func_mysqli_fetch_array($mysqli, $engine, "YEAR NOT NULL", @date('Y'), @date('Y'), 520);
- func_mysqli_fetch_array($mysqli, $engine, "YEAR", NULL, NULL, 530);
-
- $string255 = func_mysqli_fetch_array_make_string(255);
- func_mysqli_fetch_array($mysqli, $engine, "CHAR(1)", "a", "a", 540);
- func_mysqli_fetch_array($mysqli, $engine, "CHAR(255)", $string255, $string255, 550);
- func_mysqli_fetch_array($mysqli, $engine, "CHAR(1) NOT NULL", "a", "a", 560);
- func_mysqli_fetch_array($mysqli, $engine, "CHAR(1)", NULL, NULL, 570);
-
- $string65k = func_mysqli_fetch_array_make_string(65400);
- func_mysqli_fetch_array($mysqli, $engine, "VARCHAR(1)", "a", "a", 580);
- func_mysqli_fetch_array($mysqli, $engine, "VARCHAR(255)", $string255, $string255, 590);
- func_mysqli_fetch_array($mysqli, $engine, "VARCHAR(65400)", $string65k, $string65k, 600);
- func_mysqli_fetch_array($mysqli, $engine, "VARCHAR(1) NOT NULL", "a", "a", 610);
- func_mysqli_fetch_array($mysqli, $engine, "VARCHAR(1)", NULL, NULL, 620);
-
- func_mysqli_fetch_array($mysqli, $engine, "BINARY(1)", "a", "a", 630);
- func_mysqli_fetch_array($mysqli, $engine, "BINARY(2)", chr(0) . "a", chr(0) . "a", 640);
- func_mysqli_fetch_array($mysqli, $engine, "BINARY(1) NOT NULL", "b", "b", 650);
- func_mysqli_fetch_array($mysqli, $engine, "BINARY(1)", NULL, NULL, 660);
-
- func_mysqli_fetch_array($mysqli, $engine, "VARBINARY(1)", "a", "a", 670);
- func_mysqli_fetch_array($mysqli, $engine, "VARBINARY(2)", chr(0) . "a", chr(0) . "a", 680);
- func_mysqli_fetch_array($mysqli, $engine, "VARBINARY(1) NOT NULL", "b", "b", 690);
- func_mysqli_fetch_array($mysqli, $engine, "VARBINARY(1)", NULL, NULL, 700);
-
- func_mysqli_fetch_array($mysqli, $engine, "TINYBLOB", "a", "a", 710);
- func_mysqli_fetch_array($mysqli, $engine, "TINYBLOB", chr(0) . "a", chr(0) . "a", 720);
- func_mysqli_fetch_array($mysqli, $engine, "TINYBLOB NOT NULL", "b", "b", 730);
- func_mysqli_fetch_array($mysqli, $engine, "TINYBLOB", NULL, NULL, 740);
-
- func_mysqli_fetch_array($mysqli, $engine, "TINYTEXT", "a", "a", 750);
- func_mysqli_fetch_array($mysqli, $engine, "TINYTEXT NOT NULL", "a", "a", 760);
- func_mysqli_fetch_array($mysqli, $engine, "TINYTEXT", NULL, NULL, 770);
-
- func_mysqli_fetch_array($mysqli, $engine, "BLOB", "a", "a", 780);
- func_mysqli_fetch_array($mysqli, $engine, "BLOB", chr(0) . "a", chr(0) . "a", 780);
- func_mysqli_fetch_array($mysqli, $engine, "BLOB", NULL, NULL, 790);
-
- func_mysqli_fetch_array($mysqli, $engine, "TEXT", "a", "a", 800);
- func_mysqli_fetch_array($mysqli, $engine, "TEXT", chr(0) . "a", chr(0) . "a", 810);
- func_mysqli_fetch_array($mysqli, $engine, "TEXT", NULL, NULL, 820);
-
- func_mysqli_fetch_array($mysqli, $engine, "MEDIUMBLOB", "a", "a", 830);
- func_mysqli_fetch_array($mysqli, $engine, "MEDIUMBLOB", chr(0) . "a", chr(0) . "a", 840);
- func_mysqli_fetch_array($mysqli, $engine, "MEDIUMBLOB", NULL, NULL, 850);
-
- func_mysqli_fetch_array($mysqli, $engine, "MEDIUMTEXT", "a", "a", 860);
- func_mysqli_fetch_array($mysqli, $engine, "MEDIUMTEXT", chr(0) . "a", chr(0) . "a", 870);
- func_mysqli_fetch_array($mysqli, $engine, "MEDIUMTEXT", NULL, NULL, 880);
-
- func_mysqli_fetch_array($mysqli, $engine, "LONGBLOB", "a", "a", 890);
- func_mysqli_fetch_array($mysqli, $engine, "LONGTEXT", chr(0) . "a", chr(0) . "a", 900);
- func_mysqli_fetch_array($mysqli, $engine, "LONGBLOB", NULL, NULL, 910);
-
- func_mysqli_fetch_array($mysqli, $engine, "ENUM('a', 'b')", "a", "a", 920);
- func_mysqli_fetch_array($mysqli, $engine, "ENUM('a', 'b')", NULL, NULL, 930);
-
- func_mysqli_fetch_array($mysqli, $engine, "SET('a', 'b')", "a", "a", 940);
- func_mysqli_fetch_array($mysqli, $engine, "SET('a', 'b')", NULL, NULL, 950);
-
- $mysqli->close();
-
- if (false !== ($tmp = $res->fetch_array(MYSQLI_ASSOC)))
- printf("[015] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!";
+ require_once("connect.inc");
+
+ $tmp = NULL;
+ $link = NULL;
+
+ require('table.inc');
+ if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+
+ if (!$res = $mysqli->query("SELECT * FROM test ORDER BY id LIMIT 5")) {
+ printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
+
+ print "[005]\n";
+ var_dump($res->fetch_array());
+
+ print "[006]\n";
+ var_dump($res->fetch_array(MYSQLI_NUM));
+
+ print "[007]\n";
+ var_dump($res->fetch_array(MYSQLI_BOTH));
+
+ print "[008]\n";
+ var_dump($res->fetch_array(MYSQLI_ASSOC));
+
+ print "[009]\n";
+ var_dump($res->fetch_array());
+
+ $res->free_result();
+
+ if (!$res = $mysqli->query("SELECT 1 AS a, 2 AS a, 3 AS c, 4 AS C, NULL AS d, true AS e")) {
+ printf("[010] Cannot run query, [%d] %s\n", $mysqli->errno, $$mysqli->error);
+ }
+ print "[011]\n";
+ var_dump($res->fetch_array(MYSQLI_BOTH));
+
+ $res->free_result();
+ if (!$res = $mysqli->query("SELECT 1 AS a, 2 AS b, 3 AS c, 4 AS C")) {
+ printf("[012] Cannot run query, [%d] %s\n",
+ $mysqli->errno, $$mysqli->error);
+ exit(1);
+ }
+
+ do {
+ $illegal_mode = mt_rand(-10000, 10000);
+ } while (in_array($illegal_mode, array(MYSQLI_ASSOC, MYSQLI_NUM, MYSQLI_BOTH)));
+ // NOTE: for BC reasons with ext/mysql, ext/mysqli accepts invalid result modes.
+ $tmp = $res->fetch_array($illegal_mode);
+ if (false !== $tmp)
+ printf("[013] Expecting boolean/false although, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, $mysqli->errno, $mysqli->error);
+
+ $tmp = $res->fetch_array($illegal_mode);
+ if (false !== $tmp)
+ printf("[014] Expecting boolean/false, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, $mysqli->errno, $mysqli->error);
+
+ $res->free_result();
+
+ function func_mysqli_fetch_array($mysqli, $engine, $sql_type, $sql_value, $php_value, $offset, $regexp_comparison = NULL) {
+
+ if (!$mysqli->query("DROP TABLE IF EXISTS test")) {
+ printf("[%04d] [%d] %s\n", $offset, $mysqli->errno, $mysqli->error);
+ return false;
+ }
+
+ if (!$mysqli->query($sql = sprintf("CREATE TABLE test(id INT NOT NULL, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) {
+ // don't bail, engine might not support the datatype
+ return false;
+ }
+
+ if (is_null($php_value)) {
+ if (!$mysqli->query($sql = sprintf("INSERT INTO test(id, label) VALUES (1, NULL)"))) {
+ printf("[%04d] [%d] %s\n", $offset + 1, $mysqli->errno, $mysqli->error);
+ return false;
+ }
+ } else {
+ if (is_string($sql_value)) {
+ if (!$mysqli->query($sql = "INSERT INTO test(id, label) VALUES (1, '" . $sql_value . "')")) {
+ printf("[%04ds] [%d] %s - %s\n", $offset + 1, $mysqli->errno, $mysqli->error, $sql);
+ return false;
+ }
+ } else {
+ if (!$mysqli->query($sql = sprintf("INSERT INTO test(id, label) VALUES (1, '%d')", $sql_value))) {
+ printf("[%04di] [%d] %s\n", $offset + 1, $mysqli->errno, $mysqli->error);
+ return false;
+ }
+ }
+ }
+
+ if (!$res = $mysqli->query("SELECT id, label FROM test")) {
+ printf("[%04d] [%d] %s\n", $offset + 2, $mysqli->errno, $mysqli->error);
+ return false;
+ }
+
+ if (!$row = $res->fetch_array(MYSQLI_BOTH)) {
+ printf("[%04d] [%d] %s\n", $offset + 3, $mysqli->errno, $mysqli->error);
+ return false;
+ }
+ $fields = mysqli_fetch_fields($res);
+
+ if (!(gettype($php_value)=="unicode" && ($fields[1]->flags & 128))) {
+ if ($regexp_comparison) {
+ if (!preg_match($regexp_comparison, (string)$row['label']) || !preg_match($regexp_comparison, (string)$row[1])) {
+ printf("[%04d] Expecting %s/%s [reg exp = %s], got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4,
+ gettype($php_value), $php_value, $regexp_comparison,
+ gettype($row[1]), $row[1],
+ gettype($row['label']), $row['label'], $mysqli->errno, $mysqli->error);
+ return false;
+ }
+ } else {
+ if (($row['label'] !== $php_value) || ($row[1] != $php_value)) {
+ printf("[%04d] Expecting %s/%s, got %s/%s resp. %s/%s. [%d] %s\n", $offset + 4,
+ gettype($php_value), $php_value,
+ gettype($row[1]), $row[1],
+ gettype($row['label']), $row['label'], $mysqli->errno, $mysqli->error);
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ function func_mysqli_fetch_array_make_string($len) {
+
+ $ret = '';
+ for ($i = 0; $i < $len; $i++)
+ $ret .= chr(mt_rand(65, 90));
+
+ return $ret;
+ }
+
+ func_mysqli_fetch_array($mysqli, $engine, "TINYINT", -11, "-11", 20);
+ func_mysqli_fetch_array($mysqli, $engine, "TINYINT", NULL, NULL, 30);
+ func_mysqli_fetch_array($mysqli, $engine, "TINYINT UNSIGNED", 1, "1", 40);
+ func_mysqli_fetch_array($mysqli, $engine, "TINYINT UNSIGNED", NULL, NULL, 50);
+
+ func_mysqli_fetch_array($mysqli, $engine, "BOOL", 1, "1", 60);
+ func_mysqli_fetch_array($mysqli, $engine, "BOOL", NULL, NULL, 70);
+ func_mysqli_fetch_array($mysqli, $engine, "BOOLEAN", 0, "0", 80);
+ func_mysqli_fetch_array($mysqli, $engine, "BOOLEAN", NULL, NULL, 90);
+
+ func_mysqli_fetch_array($mysqli, $engine, "SMALLINT", -32768, "-32768", 100);
+ func_mysqli_fetch_array($mysqli, $engine, "SMALLINT", 32767, "32767", 110);
+ func_mysqli_fetch_array($mysqli, $engine, "SMALLINT", NULL, NULL, 120);
+ func_mysqli_fetch_array($mysqli, $engine, "SMALLINT UNSIGNED", 65535, "65535", 130);
+ func_mysqli_fetch_array($mysqli, $engine, "SMALLINT UNSIGNED", NULL, NULL, 140);
+
+ func_mysqli_fetch_array($mysqli, $engine, "MEDIUMINT", -8388608, "-8388608", 150);
+ func_mysqli_fetch_array($mysqli, $engine, "MEDIUMINT", 8388607, "8388607", 160);
+ func_mysqli_fetch_array($mysqli, $engine, "MEDIUMINT", NULL, NULL, 170);
+ func_mysqli_fetch_array($mysqli, $engine, "MEDIUMINT UNSIGNED", 16777215, "16777215", 180);
+ func_mysqli_fetch_array($mysqli, $engine, "MEDIUMINT UNSIGNED", NULL, NULL, 190);
+
+ func_mysqli_fetch_array($mysqli, $engine, "INTEGER", -2147483648, "-2147483648", 200);
+ func_mysqli_fetch_array($mysqli, $engine, "INTEGER", 2147483647, "2147483647", 210);
+ func_mysqli_fetch_array($mysqli, $engine, "INTEGER", NULL, NULL, 220);
+ func_mysqli_fetch_array($mysqli, $engine, "INTEGER UNSIGNED", "4294967295", "4294967295", 230);
+ func_mysqli_fetch_array($mysqli, $engine, "INTEGER UNSIGNED", NULL, NULL, 240);
+
+ if ($IS_MYSQLND ||
+ ((mysqli_get_server_version($link) >= 51000) &&
+ (mysqli_get_client_version($link) >= 51000))) {
+ func_mysqli_fetch_array($mysqli, $engine, "BIGINT", "-9223372036854775808", "-9223372036854775808", 250);
+ func_mysqli_fetch_array($mysqli, $engine, "BIGINT", NULL, NULL, 260);
+ func_mysqli_fetch_array($mysqli, $engine, "BIGINT UNSIGNED", "18446744073709551615", "18446744073709551615", 270);
+ func_mysqli_fetch_array($mysqli, $engine, "BIGINT UNSIGNED", NULL, NULL, 280);
+ }
+
+ func_mysqli_fetch_array($mysqli, $engine, "FLOAT", (string)(-9223372036854775808 - 1.1), "-9.22337e+18", 290, "/-9\.22337e\+?[0]?18/iu");
+ func_mysqli_fetch_array($mysqli, $engine, "FLOAT", NULL, NULL, 300);
+ func_mysqli_fetch_array($mysqli, $engine, "FLOAT UNSIGNED", (string)(18446744073709551615 + 1.1), "1.84467e+?19", 310, "/1\.84467e\+?[0]?19/iu");
+ func_mysqli_fetch_array($mysqli, $engine, "FLOAT UNSIGNED ", NULL, NULL, 320);
+
+ func_mysqli_fetch_array($mysqli, $engine, "DOUBLE(10,2)", "-99999999.99", "-99999999.99", 330);
+ func_mysqli_fetch_array($mysqli, $engine, "DOUBLE(10,2)", NULL, NULL, 340);
+ func_mysqli_fetch_array($mysqli, $engine, "DOUBLE(10,2) UNSIGNED", "99999999.99", "99999999.99", 350);
+ func_mysqli_fetch_array($mysqli, $engine, "DOUBLE(10,2) UNSIGNED", NULL, NULL, 360);
+ func_mysqli_fetch_array($mysqli, $engine, "DECIMAL(10,2)", "-99999999.99", "-99999999.99", 370);
+ func_mysqli_fetch_array($mysqli, $engine, "DECIMAL(10,2)", NULL, NULL, 380);
+ func_mysqli_fetch_array($mysqli, $engine, "DECIMAL(10,2)", "99999999.99", "99999999.99", 390);
+ func_mysqli_fetch_array($mysqli, $engine, "DECIMAL(10,2)", NULL, NULL, 400);
+
+ // don't care about date() strict TZ warnings...
+ $date = @date('Y-m-d');
+ func_mysqli_fetch_array($mysqli, $engine, "DATE",$date, $date, 410);
+ func_mysqli_fetch_array($mysqli, $engine, "DATE NOT NULL",$date, $date, 420);
+ func_mysqli_fetch_array($mysqli, $engine, "DATE", NULL, NULL, 430);
+
+ $date = @date('Y-m-d H:i:s');
+ func_mysqli_fetch_array($mysqli, $engine, "DATETIME", $date, $date, 440);
+ func_mysqli_fetch_array($mysqli, $engine, "DATETIME NOT NULL", $date, $date, 450);
+ func_mysqli_fetch_array($mysqli, $engine, "DATETIME", NULL, NULL, 460);
+ func_mysqli_fetch_array($mysqli, $engine, "TIMESTAMP", $date, $date, 470);
+ $date = @date('H:i:s');
+ func_mysqli_fetch_array($mysqli, $engine, "TIME", $date, $date, 480);
+ func_mysqli_fetch_array($mysqli, $engine, "TIME NOT NULL", $date, $date, 490);
+ func_mysqli_fetch_array($mysqli, $engine, "TIME", NULL, NULL, 500);
+ func_mysqli_fetch_array($mysqli, $engine, "YEAR", @date('Y'), @date('Y'), 510);
+ func_mysqli_fetch_array($mysqli, $engine, "YEAR NOT NULL", @date('Y'), @date('Y'), 520);
+ func_mysqli_fetch_array($mysqli, $engine, "YEAR", NULL, NULL, 530);
+
+ $string255 = func_mysqli_fetch_array_make_string(255);
+ func_mysqli_fetch_array($mysqli, $engine, "CHAR(1)", "a", "a", 540);
+ func_mysqli_fetch_array($mysqli, $engine, "CHAR(255)", $string255, $string255, 550);
+ func_mysqli_fetch_array($mysqli, $engine, "CHAR(1) NOT NULL", "a", "a", 560);
+ func_mysqli_fetch_array($mysqli, $engine, "CHAR(1)", NULL, NULL, 570);
+
+ $string65k = func_mysqli_fetch_array_make_string(65400);
+ func_mysqli_fetch_array($mysqli, $engine, "VARCHAR(1)", "a", "a", 580);
+ func_mysqli_fetch_array($mysqli, $engine, "VARCHAR(255)", $string255, $string255, 590);
+ func_mysqli_fetch_array($mysqli, $engine, "VARCHAR(65400)", $string65k, $string65k, 600);
+ func_mysqli_fetch_array($mysqli, $engine, "VARCHAR(1) NOT NULL", "a", "a", 610);
+ func_mysqli_fetch_array($mysqli, $engine, "VARCHAR(1)", NULL, NULL, 620);
+
+ func_mysqli_fetch_array($mysqli, $engine, "BINARY(1)", "a", "a", 630);
+ func_mysqli_fetch_array($mysqli, $engine, "BINARY(2)", chr(0) . "a", chr(0) . "a", 640);
+ func_mysqli_fetch_array($mysqli, $engine, "BINARY(1) NOT NULL", "b", "b", 650);
+ func_mysqli_fetch_array($mysqli, $engine, "BINARY(1)", NULL, NULL, 660);
+
+ func_mysqli_fetch_array($mysqli, $engine, "VARBINARY(1)", "a", "a", 670);
+ func_mysqli_fetch_array($mysqli, $engine, "VARBINARY(2)", chr(0) . "a", chr(0) . "a", 680);
+ func_mysqli_fetch_array($mysqli, $engine, "VARBINARY(1) NOT NULL", "b", "b", 690);
+ func_mysqli_fetch_array($mysqli, $engine, "VARBINARY(1)", NULL, NULL, 700);
+
+ func_mysqli_fetch_array($mysqli, $engine, "TINYBLOB", "a", "a", 710);
+ func_mysqli_fetch_array($mysqli, $engine, "TINYBLOB", chr(0) . "a", chr(0) . "a", 720);
+ func_mysqli_fetch_array($mysqli, $engine, "TINYBLOB NOT NULL", "b", "b", 730);
+ func_mysqli_fetch_array($mysqli, $engine, "TINYBLOB", NULL, NULL, 740);
+
+ func_mysqli_fetch_array($mysqli, $engine, "TINYTEXT", "a", "a", 750);
+ func_mysqli_fetch_array($mysqli, $engine, "TINYTEXT NOT NULL", "a", "a", 760);
+ func_mysqli_fetch_array($mysqli, $engine, "TINYTEXT", NULL, NULL, 770);
+
+ func_mysqli_fetch_array($mysqli, $engine, "BLOB", "a", "a", 780);
+ func_mysqli_fetch_array($mysqli, $engine, "BLOB", chr(0) . "a", chr(0) . "a", 780);
+ func_mysqli_fetch_array($mysqli, $engine, "BLOB", NULL, NULL, 790);
+
+ func_mysqli_fetch_array($mysqli, $engine, "TEXT", "a", "a", 800);
+ func_mysqli_fetch_array($mysqli, $engine, "TEXT", chr(0) . "a", chr(0) . "a", 810);
+ func_mysqli_fetch_array($mysqli, $engine, "TEXT", NULL, NULL, 820);
+
+ func_mysqli_fetch_array($mysqli, $engine, "MEDIUMBLOB", "a", "a", 830);
+ func_mysqli_fetch_array($mysqli, $engine, "MEDIUMBLOB", chr(0) . "a", chr(0) . "a", 840);
+ func_mysqli_fetch_array($mysqli, $engine, "MEDIUMBLOB", NULL, NULL, 850);
+
+ func_mysqli_fetch_array($mysqli, $engine, "MEDIUMTEXT", "a", "a", 860);
+ func_mysqli_fetch_array($mysqli, $engine, "MEDIUMTEXT", chr(0) . "a", chr(0) . "a", 870);
+ func_mysqli_fetch_array($mysqli, $engine, "MEDIUMTEXT", NULL, NULL, 880);
+
+ func_mysqli_fetch_array($mysqli, $engine, "LONGBLOB", "a", "a", 890);
+ func_mysqli_fetch_array($mysqli, $engine, "LONGTEXT", chr(0) . "a", chr(0) . "a", 900);
+ func_mysqli_fetch_array($mysqli, $engine, "LONGBLOB", NULL, NULL, 910);
+
+ func_mysqli_fetch_array($mysqli, $engine, "ENUM('a', 'b')", "a", "a", 920);
+ func_mysqli_fetch_array($mysqli, $engine, "ENUM('a', 'b')", NULL, NULL, 930);
+
+ func_mysqli_fetch_array($mysqli, $engine, "SET('a', 'b')", "a", "a", 940);
+ func_mysqli_fetch_array($mysqli, $engine, "SET('a', 'b')", NULL, NULL, 950);
+
+ $mysqli->close();
+
+ try {
+ $res->fetch_array(MYSQLI_ASSOC);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ print "done!";
?>
--CLEAN--
<?php
@@ -357,6 +360,5 @@ array(11) {
Warning: mysqli_result::fetch_array(): The result type should be either MYSQLI_NUM, MYSQLI_ASSOC or MYSQLI_BOTH in %s on line %d
Warning: mysqli_result::fetch_array(): The result type should be either MYSQLI_NUM, MYSQLI_ASSOC or MYSQLI_BOTH in %s on line %d
-
-Warning: mysqli_result::fetch_array(): Couldn't fetch mysqli_result in %s on line %d
+mysqli_result object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_fetch_assoc.phpt b/ext/mysqli/tests/mysqli_fetch_assoc.phpt
index 6b98b5f51c..5372d6f1de 100644
--- a/ext/mysqli/tests/mysqli_fetch_assoc.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_assoc.phpt
@@ -8,70 +8,64 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ // Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test
- // Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test
+ require('table.inc');
+ if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id LIMIT 1")) {
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- if (!is_null($tmp = @mysqli_fetch_assoc()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ print "[005]\n";
+ var_dump(mysqli_fetch_assoc($res));
- if (!is_null($tmp = @mysqli_fetch_assoc($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ print "[006]\n";
+ var_dump(mysqli_fetch_assoc($res));
- require('table.inc');
- if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id LIMIT 1")) {
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ mysqli_free_result($res);
- print "[005]\n";
- var_dump(mysqli_fetch_assoc($res));
+ if (!$res = mysqli_query($link, "SELECT
+ 1 AS a,
+ 2 AS a,
+ 3 AS c,
+ 4 AS C,
+ NULL AS d,
+ true AS e,
+ 5 AS '-1',
+ 6 AS '-10',
+ 7 AS '-100',
+ 8 AS '-1000',
+ 9 AS '10000',
+ 'a' AS '100000',
+ 'b' AS '1000000',
+ 'c' AS '9',
+ 'd' AS '9',
+ 'e' AS '01',
+ 'f' AS '-02'
+ ")) {
+ printf("[007] Cannot run query, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ print "[008]\n";
+ var_dump(mysqli_fetch_assoc($res));
- print "[006]\n";
- var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
- mysqli_free_result($res);
+ try {
+ mysqli_fetch_assoc($res);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- if (!$res = mysqli_query($link, "SELECT
- 1 AS a,
- 2 AS a,
- 3 AS c,
- 4 AS C,
- NULL AS d,
- true AS e,
- 5 AS '-1',
- 6 AS '-10',
- 7 AS '-100',
- 8 AS '-1000',
- 9 AS '10000',
- 'a' AS '100000',
- 'b' AS '1000000',
- 'c' AS '9',
- 'd' AS '9',
- 'e' AS '01',
- 'f' AS '-02'
- ")) {
- printf("[007] Cannot run query, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- print "[008]\n";
- var_dump(mysqli_fetch_assoc($res));
+ mysqli_close($link);
- mysqli_free_result($res);
-
- if (false !== ($tmp = mysqli_fetch_assoc($res)))
- printf("[008] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_close($link);
-
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
---EXPECTF--
+--EXPECT--
[005]
array(2) {
["id"]=>
@@ -114,6 +108,5 @@ array(15) {
["-02"]=>
string(1) "f"
}
-
-Warning: mysqli_fetch_assoc(): Couldn't fetch mysqli_result in %s on line %d
+mysqli_result object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_fetch_assoc_bit.phpt b/ext/mysqli/tests/mysqli_fetch_assoc_bit.phpt
index 586bfb03b3..60c635995a 100644
--- a/ext/mysqli/tests/mysqli_fetch_assoc_bit.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_assoc_bit.phpt
@@ -17,97 +17,97 @@ mysqli_fetch_assoc() - BIT
?>
--FILE--
<?php
- require('connect.inc');
+ require('connect.inc');
- function dec32bin($dec, $bits) {
+ function dec32bin($dec, $bits) {
- $maxval = pow(2, $bits);
- $bin = '';
- for ($bitval = $maxval; $bitval >= 1; $bitval = $bitval / 2) {
- if (($dec / $bitval) >= 1) {
- $bin .= '1';
- $dec -= $bitval;
- } else {
- $bin .= '0';
- }
- }
- return $bin;
- }
+ $maxval = pow(2, $bits);
+ $bin = '';
+ for ($bitval = $maxval; $bitval >= 1; $bitval = $bitval / 2) {
+ if (($dec / $bitval) >= 1) {
+ $bin .= '1';
+ $dec -= $bitval;
+ } else {
+ $bin .= '0';
+ }
+ }
+ return $bin;
+ }
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- for ($bits = 1; $bits <= 46; $bits++) {
- if (1 == $bits)
- $max_value = 1;
- else
- $max_value = pow(2, $bits) - 1;
- $tests = 0;
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test") ||
- !mysqli_query($link, $sql = sprintf('CREATE TABLE test(id BIGINT, bit_value BIT(%d) NOT NULL, bit_null BIT(%d) DEFAULT NULL) ENGINE="%s"', $bits, $bits, $engine)))
- printf("[002 - %d] [%d] %s\n",$bits, mysqli_errno($link), mysqli_error($link));
+ for ($bits = 1; $bits <= 46; $bits++) {
+ if (1 == $bits)
+ $max_value = 1;
+ else
+ $max_value = pow(2, $bits) - 1;
+ $tests = 0;
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test") ||
+ !mysqli_query($link, $sql = sprintf('CREATE TABLE test(id BIGINT, bit_value BIT(%d) NOT NULL, bit_null BIT(%d) DEFAULT NULL) ENGINE="%s"', $bits, $bits, $engine)))
+ printf("[002 - %d] [%d] %s\n",$bits, mysqli_errno($link), mysqli_error($link));
- $tests = 0;
- $rand_max = mt_getrandmax();
- while ($tests < 10) {
+ $tests = 0;
+ $rand_max = mt_getrandmax();
+ while ($tests < 10) {
- $tests++;
- if (1 == $tests)
- $value = 0;
- else if (2 == $tests)
- $value = $max_value;
- else {
- if ($max_value > $rand_max) {
- $max_loops = floor($max_value/$rand_max);
- $num_loops = mt_rand(1, $max_loops);
- $value = 0;
- for ($i = 0; $i < $num_loops; $i++)
- $value += mt_rand(0, $rand_max);
- } else {
- $value = mt_rand(0, $max_value);
- }
- }
+ $tests++;
+ if (1 == $tests)
+ $value = 0;
+ else if (2 == $tests)
+ $value = $max_value;
+ else {
+ if ($max_value > $rand_max) {
+ $max_loops = floor($max_value/$rand_max);
+ $num_loops = mt_rand(1, $max_loops);
+ $value = 0;
+ for ($i = 0; $i < $num_loops; $i++)
+ $value += mt_rand(0, $rand_max);
+ } else {
+ $value = mt_rand(0, $max_value);
+ }
+ }
- $bin = ($bits < 32) ? decbin($value) : dec32bin($value, $bits);
- $sql = sprintf("INSERT INTO test(id, bit_value) VALUES (%s, b'%s')", $value, $bin);
- for ($i = 0; ($i < strlen($bin)) && ($bin[$i] == '0'); $i++)
- ;
- $bin2 = substr($bin, $i, strlen($bin));
+ $bin = ($bits < 32) ? decbin($value) : dec32bin($value, $bits);
+ $sql = sprintf("INSERT INTO test(id, bit_value) VALUES (%s, b'%s')", $value, $bin);
+ for ($i = 0; ($i < strlen($bin)) && ($bin[$i] == '0'); $i++)
+ ;
+ $bin2 = substr($bin, $i, strlen($bin));
- if (!mysqli_query($link, $sql))
- printf("[003 - %d] [%d] %s\n", $bits, mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, $sql))
+ printf("[003 - %d] [%d] %s\n", $bits, mysqli_errno($link), mysqli_error($link));
- $sql = sprintf("SELECT id, BIN(bit_value) AS _bin, bit_value + 0 AS _bit_value0, bit_value, bit_null FROM test WHERE id = %s", $value);
- if (!$res = mysqli_query($link, $sql))
- printf("[004 - %d] [%d] %s\n", $bits, mysqli_errno($link), mysqli_error($link));
+ $sql = sprintf("SELECT id, BIN(bit_value) AS _bin, bit_value + 0 AS _bit_value0, bit_value, bit_null FROM test WHERE id = %s", $value);
+ if (!$res = mysqli_query($link, $sql))
+ printf("[004 - %d] [%d] %s\n", $bits, mysqli_errno($link), mysqli_error($link));
- if (!$row = mysqli_fetch_assoc($res))
- printf("[005 - %d] [%d] %s\n", $bits, mysqli_errno($link), mysqli_error($link));
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[005 - %d] [%d] %s\n", $bits, mysqli_errno($link), mysqli_error($link));
- if (($value != $row['id']) || (($bin != $row['_bin']) && ($bin2 != $row['_bin']))) {
- debug_zval_dump($row);
- printf("[006 - %d] Insert of %s in BIT(%d) column might have failed. id = %s, bin = %s (%s/%s)\n",
- $bits, $value, $bits, $row['id'], $row['_bin'], $bin, $bin2);
- break;
- }
- if ($value != $row['bit_value']) {
- debug_zval_dump($row);
- printf("%10s %64s\n%10s %64s\n", '_bin', $row['_bin'], 'insert', $bin);
- printf("[007 - %d] Expecting %s got %s\n", $bits, $value, $row['bit_value']);
- break;
- }
+ if (($value != $row['id']) || (($bin != $row['_bin']) && ($bin2 != $row['_bin']))) {
+ debug_zval_dump($row);
+ printf("[006 - %d] Insert of %s in BIT(%d) column might have failed. id = %s, bin = %s (%s/%s)\n",
+ $bits, $value, $bits, $row['id'], $row['_bin'], $bin, $bin2);
+ break;
+ }
+ if ($value != $row['bit_value']) {
+ debug_zval_dump($row);
+ printf("%10s %64s\n%10s %64s\n", '_bin', $row['_bin'], 'insert', $bin);
+ printf("[007 - %d] Expecting %s got %s\n", $bits, $value, $row['bit_value']);
+ break;
+ }
- if (null !== $row['bit_null']) {
- debug_zval_dump($row);
- printf("[008 - %d] Expecting null got %s/%s\n", $bits, gettype($row['bit_value']), $row['bit_value']);
- break;
- }
- }
- }
+ if (null !== $row['bit_null']) {
+ debug_zval_dump($row);
+ printf("[008 - %d] Expecting null got %s/%s\n", $bits, gettype($row['bit_value']), $row['bit_value']);
+ break;
+ }
+ }
+ }
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_fetch_assoc_no_alias.phpt b/ext/mysqli/tests/mysqli_fetch_assoc_no_alias.phpt
index f86502704a..a581499daa 100644
--- a/ext/mysqli/tests/mysqli_fetch_assoc_no_alias.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_assoc_no_alias.phpt
@@ -8,79 +8,79 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require('table.inc');
+ require('table.inc');
- if (!$res = mysqli_query($link, "SELECT 1, 2")) {
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- print "[002]\n";
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
+ if (!$res = mysqli_query($link, "SELECT 1, 2")) {
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ print "[002]\n";
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
- if (!$res = mysqli_query($link, "SELECT 1 AS a, 2")) {
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- print "[004]\n";
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
+ if (!$res = mysqli_query($link, "SELECT 1 AS a, 2")) {
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ print "[004]\n";
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
- if (!$res = mysqli_query($link, "SELECT 1 AS a, 2, 2 as '2'")) {
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- print "[006]\n";
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
+ if (!$res = mysqli_query($link, "SELECT 1 AS a, 2, 2 as '2'")) {
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ print "[006]\n";
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
- if (!$res = mysqli_query($link, "SELECT 1 AS a, 2 as '2', 2")) {
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- print "[008]\n";
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
+ if (!$res = mysqli_query($link, "SELECT 1 AS a, 2 as '2', 2")) {
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ print "[008]\n";
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
- /* Now do it with unbuffered queries */
- if (!$res = mysqli_real_query($link, "SELECT 1, 2")) {
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- if (!$res = mysqli_use_result($link)) {
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- print "[011]\n";
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
+ /* Now do it with unbuffered queries */
+ if (!$res = mysqli_real_query($link, "SELECT 1, 2")) {
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ if (!$res = mysqli_use_result($link)) {
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ print "[011]\n";
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
- if (!$res = mysqli_real_query($link, "SELECT 1 AS a, 2")) {
- printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- if (!$res = mysqli_use_result($link)) {
- printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- print "[014]\n";
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
+ if (!$res = mysqli_real_query($link, "SELECT 1 AS a, 2")) {
+ printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ if (!$res = mysqli_use_result($link)) {
+ printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ print "[014]\n";
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
- if (!$res = mysqli_real_query($link, "SELECT 1 AS a, 2, 2 as '2'")) {
- printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- if (!$res = mysqli_use_result($link)) {
- printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- print "[017]\n";
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
+ if (!$res = mysqli_real_query($link, "SELECT 1 AS a, 2, 2 as '2'")) {
+ printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ if (!$res = mysqli_use_result($link)) {
+ printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ print "[017]\n";
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
- if (!$res = mysqli_real_query($link, "SELECT 1 AS a, 2 as '2', 2")) {
- printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- if (!$res = mysqli_use_result($link)) {
- printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- print "[017]\n";
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
- mysqli_close($link);
+ if (!$res = mysqli_real_query($link, "SELECT 1 AS a, 2 as '2', 2")) {
+ printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ if (!$res = mysqli_use_result($link)) {
+ printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ print "[017]\n";
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--EXPECTF--
[002]
diff --git a/ext/mysqli/tests/mysqli_fetch_assoc_no_alias_utf8.phpt b/ext/mysqli/tests/mysqli_fetch_assoc_no_alias_utf8.phpt
index fdbf222df8..e1ed5c5c87 100644
--- a/ext/mysqli/tests/mysqli_fetch_assoc_no_alias_utf8.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_assoc_no_alias_utf8.phpt
@@ -35,48 +35,48 @@ mysqli_fetch_assoc() - utf8
?>
--FILE--
<?php
- require('table.inc');
+ require('table.inc');
- /* some cyrillic (utf8) comes here */
- if (!$res = mysqli_query($link, "SET NAMES UTF8")) {
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ /* some cyrillic (utf8) comes here */
+ if (!$res = mysqli_query($link, "SET NAMES UTF8")) {
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- if (!$res = mysqli_query($link, "SELECT 1 AS 'Ðндрей ХриÑтов', 2 AS 'Улф Вендел', 3 AS 'Георг Рихтер'")) {
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- print "[003]\n";
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
+ if (!$res = mysqli_query($link, "SELECT 1 AS 'Ðндрей ХриÑтов', 2 AS 'Улф Вендел', 3 AS 'Георг Рихтер'")) {
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ print "[003]\n";
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
- if (!$res = mysqli_query($link, "CREATE TABLE автори_на_mysqlnd (id integer not null auto_increment primary key, име varchar(20) character set ucs2, Ñ„Ð°Ð¼Ð¸Ð»Ð¸Ñ varchar(20) character set utf8)")) {
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- if (!$res = mysqli_query($link, "INSERT INTO автори_на_mysqlnd (име, фамилиÑ) VALUES ('Ðндрей', 'ХриÑтов'), ('Георг', 'Рихтер'), ('Улф','Вендел')")) {
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- if (!$res = mysqli_query($link, "INSERT INTO автори_на_mysqlnd (име, фамилиÑ) VALUES ('Andrey', 'Hristov'), ('Georg', 'Richter'), ('Ulf','Wendel')")) {
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- if (!$res = mysqli_query($link, "INSERT INTO автори_на_mysqlnd (име, фамилиÑ) VALUES ('安德烈', 'Hristov'), ('格奥尔', 'Richter'), ('乌尔夫','Wendel')")) {
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ if (!$res = mysqli_query($link, "CREATE TABLE автори_на_mysqlnd (id integer not null auto_increment primary key, име varchar(20) character set ucs2, Ñ„Ð°Ð¼Ð¸Ð»Ð¸Ñ varchar(20) character set utf8)")) {
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ if (!$res = mysqli_query($link, "INSERT INTO автори_на_mysqlnd (име, фамилиÑ) VALUES ('Ðндрей', 'ХриÑтов'), ('Георг', 'Рихтер'), ('Улф','Вендел')")) {
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ if (!$res = mysqli_query($link, "INSERT INTO автори_на_mysqlnd (име, фамилиÑ) VALUES ('Andrey', 'Hristov'), ('Georg', 'Richter'), ('Ulf','Wendel')")) {
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ if (!$res = mysqli_query($link, "INSERT INTO автори_на_mysqlnd (име, фамилиÑ) VALUES ('安德烈', 'Hristov'), ('格奥尔', 'Richter'), ('乌尔夫','Wendel')")) {
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- if (!$res = mysqli_query($link, "SELECT id, име, Ñ„Ð°Ð¼Ð¸Ð»Ð¸Ñ FROM автори_на_mysqlnd ORDER BY фамилиÑ, име")) {
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- print "[009]\n";
- while ($row = mysqli_fetch_assoc($res)) {
- var_dump($row);
- }
- mysqli_free_result($res);
+ if (!$res = mysqli_query($link, "SELECT id, име, Ñ„Ð°Ð¼Ð¸Ð»Ð¸Ñ FROM автори_на_mysqlnd ORDER BY фамилиÑ, име")) {
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ print "[009]\n";
+ while ($row = mysqli_fetch_assoc($res)) {
+ var_dump($row);
+ }
+ mysqli_free_result($res);
- if (!$res = mysqli_query($link, "DROP TABLE автори_на_mysqlnd")) {
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ if (!$res = mysqli_query($link, "DROP TABLE автори_на_mysqlnd")) {
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--EXPECTF--
[003]
diff --git a/ext/mysqli/tests/mysqli_fetch_assoc_oo.phpt b/ext/mysqli/tests/mysqli_fetch_assoc_oo.phpt
index e4f6465176..db07a2ef4b 100644
--- a/ext/mysqli/tests/mysqli_fetch_assoc_oo.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_assoc_oo.phpt
@@ -8,57 +8,60 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- // Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test
- $mysqli = new mysqli();
- $res = @new mysqli_result($mysqli);
- if (false !== ($tmp = @$res->fetch_assoc()))
- printf("[001] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ // Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test
+ $mysqli = new mysqli();
+ try {
+ new mysqli_result($mysqli);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- require('table.inc');
- if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ require('table.inc');
+ if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (!is_null($tmp = @$res->fetch_assoc($link)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!$res = $mysqli->query("SELECT id, label FROM test ORDER BY id LIMIT 1")) {
+ printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
- if (!$res = $mysqli->query("SELECT id, label FROM test ORDER BY id LIMIT 1")) {
- printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
+ print "[005]\n";
+ var_dump($res->fetch_assoc());
- print "[005]\n";
- var_dump($res->fetch_assoc());
+ print "[006]\n";
+ var_dump($res->fetch_assoc());
- print "[006]\n";
- var_dump($res->fetch_assoc());
+ $res->free_result();
- $res->free_result();
+ if (!$res = $mysqli->query("SELECT 1 AS a, 2 AS a, 3 AS c, 4 AS C, NULL AS d, true AS e")) {
+ printf("[007] Cannot run query, [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
+ print "[008]\n";
+ var_dump($res->fetch_assoc());
- if (!$res = $mysqli->query("SELECT 1 AS a, 2 AS a, 3 AS c, 4 AS C, NULL AS d, true AS e")) {
- printf("[007] Cannot run query, [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
- print "[008]\n";
- var_dump($res->fetch_assoc());
+ $res->free_result();
- $res->free_result();
+ try {
+ $res->fetch_assoc();
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- if (false !== ($tmp = $res->fetch_assoc()))
- printf("[008] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ mysqli_close($link);
- mysqli_close($link);
-
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
---EXPECTF--
+--EXPECT--
+mysqli object is not fully initialized
[005]
array(2) {
["id"]=>
@@ -81,6 +84,5 @@ array(5) {
["e"]=>
string(1) "1"
}
-
-Warning: mysqli_result::fetch_assoc(): Couldn't fetch mysqli_result in %s on line %d
+mysqli_result object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_fetch_assoc_zerofill.phpt b/ext/mysqli/tests/mysqli_fetch_assoc_zerofill.phpt
index 551877e800..b06124a89c 100644
--- a/ext/mysqli/tests/mysqli_fetch_assoc_zerofill.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_assoc_zerofill.phpt
@@ -8,67 +8,67 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once('connect.inc');
- require_once('table.inc');
+ require_once('connect.inc');
+ require_once('table.inc');
- function zerofill($offset, $link, $datatype, $insert = 1) {
+ function zerofill($offset, $link, $datatype, $insert = 1) {
- mysqli_query($link, 'ALTER TABLE test DROP zero');
- $sql = sprintf('ALTER TABLE test ADD zero %s UNSIGNED ZEROFILL', $datatype);
- if (!mysqli_query($link, $sql)) {
- // no worries - server might not support it
- return true;
- }
+ mysqli_query($link, 'ALTER TABLE test DROP zero');
+ $sql = sprintf('ALTER TABLE test ADD zero %s UNSIGNED ZEROFILL', $datatype);
+ if (!mysqli_query($link, $sql)) {
+ // no worries - server might not support it
+ return true;
+ }
- if (!mysqli_query($link, sprintf('UPDATE test SET zero = %s', $insert))) {
- printf("[%03d] UPDATE failed, [%d] %s\n",
- $offset, mysqli_errno($link), mysqli_error($link));
- return false;
- }
+ if (!mysqli_query($link, sprintf('UPDATE test SET zero = %s', $insert))) {
+ printf("[%03d] UPDATE failed, [%d] %s\n",
+ $offset, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
- if (!($res = mysqli_query($link, 'SELECT zero FROM test LIMIT 1'))) {
- printf("[%03d] SELECT failed, [%d] %s\n",
- $offset, mysqli_errno($link), mysqli_error($link));
- return false;
- }
+ if (!($res = mysqli_query($link, 'SELECT zero FROM test LIMIT 1'))) {
+ printf("[%03d] SELECT failed, [%d] %s\n",
+ $offset, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
- $row = mysqli_fetch_assoc($res);
- $meta = mysqli_fetch_fields($res);
- mysqli_free_result($res);
- $meta = $meta[0];
- $length = $meta->length;
- if ($length > strlen($insert)) {
+ $row = mysqli_fetch_assoc($res);
+ $meta = mysqli_fetch_fields($res);
+ mysqli_free_result($res);
+ $meta = $meta[0];
+ $length = $meta->length;
+ if ($length > strlen($insert)) {
- $expected = str_repeat('0', $length - strlen($insert));
- $expected .= $insert;
- if ($expected !== $row['zero']) {
- printf("[%03d] Expecting '%s' got '%s'\n", $offset, $expected, $row['zero']);
- return false;
- }
+ $expected = str_repeat('0', $length - strlen($insert));
+ $expected .= $insert;
+ if ($expected !== $row['zero']) {
+ printf("[%03d] Expecting '%s' got '%s'\n", $offset, $expected, $row['zero']);
+ return false;
+ }
- } else if ($length <= 1) {
- printf("[%03d] Length reported is too small to run test\n", $offset);
- return false;
- }
+ } else if ($length <= 1) {
+ printf("[%03d] Length reported is too small to run test\n", $offset);
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- zerofill(2, $link, 'TINYINT');
- zerofill(3, $link, 'SMALLINT');
- zerofill(4, $link, 'MEDIUMINT');
- zerofill(5, $link, 'INT');
- zerofill(6, $link, 'INTEGER');
- zerofill(7, $link, 'BIGINT');
- zerofill(8, $link, 'FLOAT');
- zerofill(9, $link, 'DOUBLE');
- zerofill(10, $link, 'DOUBLE PRECISION');
- zerofill(11, $link, 'DECIMAL');
- zerofill(12, $link, 'DEC');
+ zerofill(2, $link, 'TINYINT');
+ zerofill(3, $link, 'SMALLINT');
+ zerofill(4, $link, 'MEDIUMINT');
+ zerofill(5, $link, 'INT');
+ zerofill(6, $link, 'INTEGER');
+ zerofill(7, $link, 'BIGINT');
+ zerofill(8, $link, 'FLOAT');
+ zerofill(9, $link, 'DOUBLE');
+ zerofill(10, $link, 'DOUBLE PRECISION');
+ zerofill(11, $link, 'DECIMAL');
+ zerofill(12, $link, 'DEC');
- mysqli_close($link);
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_fetch_field.phpt b/ext/mysqli/tests/mysqli_fetch_field.phpt
index 684795a48e..33a35c7005 100644
--- a/ext/mysqli/tests/mysqli_fetch_field.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_field.phpt
@@ -8,79 +8,74 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
-
- // Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test
- if (!is_null($tmp = @mysqli_fetch_field()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_fetch_field($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- require('table.inc');
-
- // Make sure that client, connection and result charsets are all the
- // same. Not sure whether this is strictly necessary.
- if (!mysqli_set_charset($link, 'utf8'))
- printf("[%d] %s\n", mysqli_errno($link), mysqli_errno($link));
-
- $charsetInfo = mysqli_get_charset($link);
-
- if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 1")) {
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
-
- /* ID column, binary charset */
- $tmp = mysqli_fetch_field($res);
- var_dump($tmp);
-
- /* label column, result set charset */
- $tmp = mysqli_fetch_field($res);
- var_dump($tmp);
- if ($tmp->charsetnr != $charsetInfo->number) {
- printf("[004] Expecting charset %s/%d got %d\n",
- $charsetInfo->charset, $charsetInfo->number, $tmp->charsetnr);
- }
- if ($tmp->length != $charsetInfo->max_length) {
- printf("[005] Expecting length %d got %d\n",
- $charsetInfo->max_length, $tmp->max_length);
- }
- if ($tmp->db != $db) {
- printf("011] Expecting database '%s' got '%s'\n",
- $db, $tmp->db);
- }
-
- var_dump(mysqli_fetch_field($res));
-
- mysqli_free_result($res);
-
- // Read http://bugs.php.net/bug.php?id=42344 on defaults!
- if (false !== ($tmp = mysqli_fetch_field($res)))
- printf("[006] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_query($link, "CREATE TABLE test(id INT NOT NULL DEFAULT 1)"))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_query($link, "INSERT INTO test(id) VALUES (2)"))
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!$res = mysqli_query($link, "SELECT id as _default_test FROM test")) {
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- var_dump(mysqli_fetch_assoc($res));
- /* binary */
- var_dump(mysqli_fetch_field($res));
- mysqli_free_result($res);
-
- mysqli_close($link);
-
- print "done!";
+ require_once("connect.inc");
+
+ // Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test
+
+ require('table.inc');
+
+ // Make sure that client, connection and result charsets are all the
+ // same. Not sure whether this is strictly necessary.
+ if (!mysqli_set_charset($link, 'utf8'))
+ printf("[%d] %s\n", mysqli_errno($link), mysqli_errno($link));
+
+ $charsetInfo = mysqli_get_charset($link);
+
+ if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 1")) {
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ /* ID column, binary charset */
+ $tmp = mysqli_fetch_field($res);
+ var_dump($tmp);
+
+ /* label column, result set charset */
+ $tmp = mysqli_fetch_field($res);
+ var_dump($tmp);
+ if ($tmp->charsetnr != $charsetInfo->number) {
+ printf("[004] Expecting charset %s/%d got %d\n",
+ $charsetInfo->charset, $charsetInfo->number, $tmp->charsetnr);
+ }
+ if ($tmp->length != $charsetInfo->max_length) {
+ printf("[005] Expecting length %d got %d\n",
+ $charsetInfo->max_length, $tmp->max_length);
+ }
+ if ($tmp->db != $db) {
+ printf("011] Expecting database '%s' got '%s'\n",
+ $db, $tmp->db);
+ }
+
+ var_dump(mysqli_fetch_field($res));
+
+ mysqli_free_result($res);
+
+ // Read http://bugs.php.net/bug.php?id=42344 on defaults!
+ try {
+ mysqli_fetch_field($res);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_query($link, "CREATE TABLE test(id INT NOT NULL DEFAULT 1)"))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_query($link, "INSERT INTO test(id) VALUES (2)"))
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!$res = mysqli_query($link, "SELECT id as _default_test FROM test")) {
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ var_dump(mysqli_fetch_assoc($res));
+ /* binary */
+ var_dump(mysqli_fetch_field($res));
+ mysqli_free_result($res);
+
+ mysqli_close($link);
+
+ print "done!";
?>
--CLEAN--
<?php
@@ -144,8 +139,7 @@ object(stdClass)#%d (13) {
int(0)
}
bool(false)
-
-Warning: mysqli_fetch_field(): Couldn't fetch mysqli_result in %s on line %d
+mysqli_result object is already closed
array(1) {
["_default_test"]=>
string(1) "2"
diff --git a/ext/mysqli/tests/mysqli_fetch_field_direct.phpt b/ext/mysqli/tests/mysqli_fetch_field_direct.phpt
index be883ef625..0afe6e4626 100644
--- a/ext/mysqli/tests/mysqli_fetch_field_direct.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_field_direct.phpt
@@ -8,37 +8,28 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ require('table.inc');
- if (!is_null($tmp = @mysqli_fetch_field_direct()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 1")) {
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- if (!is_null($tmp = @mysqli_fetch_field_direct($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ var_dump(mysqli_fetch_field_direct($res, -1));
+ var_dump(mysqli_fetch_field_direct($res, 0));
+ var_dump(mysqli_fetch_field_direct($res, 2));
- if (!is_null($tmp = @mysqli_fetch_field_direct($link, $link)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ mysqli_free_result($res);
- require('table.inc');
+ try {
+ mysqli_fetch_field_direct($res, 0);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 1")) {
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
-
- var_dump(mysqli_fetch_field_direct($res, -1));
- var_dump(mysqli_fetch_field_direct($res, 0));
- var_dump(mysqli_fetch_field_direct($res, 2));
-
- mysqli_free_result($res);
-
- if (false !== ($tmp = mysqli_fetch_field_direct($res, 0)))
- printf("[005] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
@@ -78,6 +69,5 @@ object(stdClass)#%d (13) {
Warning: mysqli_fetch_field_direct(): Field offset is invalid for resultset in %s on line %d
bool(false)
-
-Warning: mysqli_fetch_field_direct(): Couldn't fetch mysqli_result in %s on line %d
+mysqli_result object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_fetch_field_direct_oo.phpt b/ext/mysqli/tests/mysqli_fetch_field_direct_oo.phpt
index c240050e17..33806f1c55 100644
--- a/ext/mysqli/tests/mysqli_fetch_field_direct_oo.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_field_direct_oo.phpt
@@ -8,52 +8,47 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $mysqli = new mysqli();
+ try {
+ new mysqli_result($mysqli);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- $mysqli = new mysqli();
- $res = @new mysqli_result($mysqli);
- if (!is_null($tmp = @$res->fetch_field_direct()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ require('table.inc');
- require('table.inc');
+ if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$res = $mysqli->query("SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 1")) {
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- if (!$res = $mysqli->query("SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 1")) {
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ var_dump($res->fetch_field_direct(-1));
+ var_dump($res->fetch_field_direct(0));
+ var_dump($res->fetch_field_direct(2));
- if (!is_null($tmp = @$res->fetch_field_direct()))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ $res->free_result();
- if (!is_null($tmp = @$res->fetch_field_direct($link)))
- printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ try {
+ $res->fetch_field_direct(0);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- if (!is_null($tmp = @$res->fetch_field_direct($link, $link)))
- printf("[006] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- var_dump($res->fetch_field_direct(-1));
- var_dump($res->fetch_field_direct(0));
- var_dump($res->fetch_field_direct(2));
-
- $res->free_result();
-
- if (false !== ($tmp = $res->fetch_field_direct(0)))
- printf("[007] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- $mysqli->close();
- print "done!";
+ $mysqli->close();
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
--EXPECTF--
+mysqli object is not fully initialized
+
Warning: mysqli_result::fetch_field_direct(): Field offset is invalid for resultset in %s on line %d
bool(false)
object(stdClass)#%d (13) {
@@ -87,6 +82,5 @@ object(stdClass)#%d (13) {
Warning: mysqli_result::fetch_field_direct(): Field offset is invalid for resultset in %s on line %d
bool(false)
-
-Warning: mysqli_result::fetch_field_direct(): Couldn't fetch mysqli_result in %s on line %d
+mysqli_result object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_fetch_field_flags.phpt b/ext/mysqli/tests/mysqli_fetch_field_flags.phpt
index 169c5d653f..5983075942 100644
--- a/ext/mysqli/tests/mysqli_fetch_field_flags.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_field_flags.phpt
@@ -17,206 +17,206 @@ mysqli_close($link);
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
/* TODO: mysqli.c needs to export a few more constants - see all the defined() calls! */
- $flags = array(
- MYSQLI_NOT_NULL_FLAG => 'NOT_NULL',
- MYSQLI_PRI_KEY_FLAG => 'PRI_KEY',
- MYSQLI_UNIQUE_KEY_FLAG => 'UNIQUE_KEY',
- MYSQLI_MULTIPLE_KEY_FLAG => 'MULTIPLE_KEY',
- MYSQLI_BLOB_FLAG => 'BLOB',
- MYSQLI_UNSIGNED_FLAG => 'UNSIGNED',
- MYSQLI_ZEROFILL_FLAG => 'ZEROFILL',
- MYSQLI_AUTO_INCREMENT_FLAG => 'AUTO_INCREMENT',
- MYSQLI_TIMESTAMP_FLAG => 'TIMESTAMP',
- MYSQLI_SET_FLAG => 'SET',
- MYSQLI_NUM_FLAG => 'NUM',
- MYSQLI_PART_KEY_FLAG => 'PART_KEY',
- // MYSQLI_GROUP_FLAG => 'MYSQLI_GROUP_FLAG' - internal usage only
- (defined('MYSQLI_NO_DEFAULT_VALUE_FLAG') ? MYSQLI_NO_DEFAULT_VALUE_FLAG : 4096) => 'NO_DEFAULT_VALUE',
- (defined('MYSQLI_BINARY_FLAG') ? MYSQLI_BINARY_FLAG : 128) => 'BINARY',
- (defined('MYSQLI_ENUM_FLAG') ? MYSQLI_ENUM_FLAG : 256) => 'ENUM',
- // MYSQLI_BINCMP_FLAG
- );
-
- // 5.1.24 / 6.0.4+
- if (defined('MYSQLI_ON_UPDATE_NOW'))
- $flags[MYSQLI_ON_UPDATE_NOW] = 'ON_UPDATE_NOW';
- else
- $flags[8192] = 'ON_UPDATE_NOW';
-
- krsort($flags);
-
- $columns = array(
- 'INT DEFAULT NULL' => 'NUM',
- 'INT NOT NULL' => 'NOT_NULL NO_DEFAULT_VALUE NUM',
- 'INT NOT NULL DEFAULT 1' => 'NOT_NULL NUM',
- 'INT UNSIGNED DEFAULT NULL' => 'UNSIGNED NUM',
- 'INT UNSIGNED NOT NULL' => 'NOT_NULL UNSIGNED NO_DEFAULT_VALUE NUM',
- 'INT UNSIGNED NOT NULL DEFAULT 1' => 'NOT_NULL UNSIGNED NUM',
- 'INT UNSIGNED ZEROFILL DEFAULT NULL' => 'UNSIGNED ZEROFILL NUM',
- 'INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY' => 'NOT_NULL PRI_KEY UNSIGNED AUTO_INCREMENT NUM PART_KEY',
- 'CHAR(1) DEFAULT NULL' => '',
- 'CHAR(1) NOT NULL' => 'NOT_NULL NO_DEFAULT_VALUE',
- 'VARBINARY(127) DEFAULT NULL' => 'BINARY',
- 'BLOB' => 'BLOB BINARY',
- 'TINYBLOB' => 'BLOB BINARY',
- 'MEDIUMBLOB' => 'BLOB BINARY',
- 'LONGBLOB' => 'BLOB BINARY',
- 'TEXT' => 'BLOB',
- 'TINYTEXT' => 'BLOB',
- 'MEDIUMTEXT' => 'BLOB',
- 'LONGTEXT' => 'BLOB',
- 'SET("one", "two")' => 'SET',
- 'SET("one", "two") NOT NULL' => 'NOT_NULL SET NO_DEFAULT_VALUE',
- 'SET("one", "two") NOT NULL DEFAULT "one"' => 'NOT_NULL SET',
- 'ENUM("one", "two")' => 'ENUM',
- 'ENUM("one", "two") NOT NULL' => 'NOT_NULL ENUM NO_DEFAULT_VALUE',
- 'ENUM("one", "two") NOT NULL DEFAULT "one"' => 'NOT_NULL ENUM',
- 'TINYINT UNIQUE' => 'UNIQUE_KEY NUM PART_KEY',
- 'SMALLINT UNIQUE' => 'UNIQUE_KEY NUM PART_KEY',
- 'MEDIUMINT UNIQUE DEFAULT 1' => 'UNIQUE_KEY NUM PART_KEY',
- 'BIGINT UNSIGNED UNIQUE DEFAULT 100' => 'UNIQUE_KEY UNSIGNED NUM PART_KEY',
- 'BIT' => 'UNSIGNED',
- 'VARCHAR(2) NOT NULL PRIMARY KEY' => 'NOT_NULL PRI_KEY NO_DEFAULT_VALUE PART_KEY'
- );
-
-
-
- function checkFlags($reported_flags, $expected_flags, $flags) {
- $found_flags = $unexpected_flags = '';
- foreach ($flags as $code => $name) {
- if ($reported_flags >= $code) {
- $reported_flags -= $code;
- $found_flags .= $name . ' ';
- if (stristr($expected_flags, $name)) {
- $expected_flags = trim(str_ireplace($name, '', $expected_flags));
- } else {
- $unexpected_flags .= $name . ' ';
- }
- }
- }
-
- return array($expected_flags, $unexpected_flags, $found_flags);
- }
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
-
- foreach ($columns as $column_def => $expected_flags) {
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
- printf("[002] %s [%d] %s\n", $column_def,
- mysqli_errno($link), mysqli_error($link));
- continue;
- }
-
- $create = sprintf('CREATE TABLE test(id INT, col1 %s)', $column_def);
- if (!mysqli_query($link, $create)) {
- // Server might not support it - skip
- continue;
- }
-
- if (!$res = mysqli_query($link, 'SELECT * FROM test')) {
- printf("[003] Can't select from table, %s [%d] %s\n", $column_def,
- mysqli_errno($link), mysqli_error($link));
- continue;
- }
-
- $field = mysqli_fetch_field_direct($res, 1);
- if (!is_object($field)) {
- printf("[004] Fetching the meta data failed, %s [%d] %s\n", $column_def,
- mysqli_errno($link), mysqli_error($link));
- continue;
- }
- if ($field->name != 'col1') {
- printf("[005] Field information seems wrong, %s [%d] %s\n", $column_def,
- mysqli_errno($link), mysqli_error($link));
- continue;
- }
-
- /*
- TODO
- Unfortunately different server versions give you slightly different
- results.The test does not yet fully reflect all server changes/bugs etc.
- */
- switch ($column_def) {
- case 'INT UNSIGNED NOT NULL':
- case 'INT NOT NULL':
- case 'CHAR(1) NOT NULL':
- case 'SET("one", "two") NOT NULL':
- case 'ENUM("one", "two") NOT NULL':
- $version = mysqli_get_server_version($link);
- if ($version < 50000) {
- // TODO - check exact version!
- $expected_flags = trim(str_replace('NO_DEFAULT_VALUE', '', $expected_flags));
- }
- break;
-
- case 'BIT':
- $version = mysqli_get_server_version($link);
- if (($version <= 50114 && $version > 50100) || ($version == 50200)) {
- // TODO - check exact version!
- $expected_flags = trim(str_replace('UNSIGNED', '', $expected_flags));
- }
-
- default:
- break;
- }
-
- list($missing_flags, $unexpected_flags, $flags_found) = checkFlags($field->flags, $expected_flags, $flags);
- if ($unexpected_flags) {
- printf("[006] Found unexpected flags '%s' for %s, found '%s' with MySQL %s'\n",
- $unexpected_flags, $column_def, $flags_found, mysqli_get_server_version($link));
- }
- if ($missing_flags) {
- printf("[007] The flags '%s' have not been reported for %s, found '%s'\n",
- $missing_flags, $column_def, $flags_found);
- var_dump($create);
- var_dump(mysqli_get_server_version($link));
- die($missing_flags);
- }
-
- mysqli_free_result($res);
- }
-
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
- printf("[008] %s [%d] %s\n", $column_def,
- mysqli_errno($link), mysqli_error($link));
- }
-
- $column_def = array('col1 CHAR(1)', 'col2 CHAR(2)','INDEX idx_col1_col2(col1, col2)');
- $expected_flags = array('col1' => 'MULTIPLE_KEY PART_KEY', 'col2' => 'PART_KEY');
- $create = 'CREATE TABLE test(id INT, ';
- foreach ($column_def as $k => $v) {
- $create .= sprintf('%s, ', $v);
- }
- $create = sprintf('%s)', substr($create, 0, -2));
-
- if (mysqli_query($link, $create)) {
- if (!$res = mysqli_query($link, 'SELECT * FROM test')) {
- printf("[009] Cannot run SELECT, [%d] %s\n",
- mysqli_errno($link), mysqli_error($link));
- }
- // id column - skip it
- $field = mysqli_fetch_field($res);
- while ($field = mysqli_fetch_field($res)) {
- if (!isset($expected_flags[$field->name])) {
- printf("[010] Found unexpected field '%s'\n", $field->name);
- }
- list($missing_flags, $unexpected_flags, $flags_found) = checkFlags($field->flags, $expected_flags[$field->name], $flags);
- if ($unexpected_flags)
- printf("[011] Found unexpected flags '%s' for %s, found '%s'\n",
- $unexpected_flags, $field->name, $flags_found);
- if ($missing_flags)
- printf("[012] The flags '%s' have not been reported for %s, found '%s'\n",
- $missing_flags, $field->name, $flags_found);
- }
- }
-
- mysqli_close($link);
- print "done!";
+ $flags = array(
+ MYSQLI_NOT_NULL_FLAG => 'NOT_NULL',
+ MYSQLI_PRI_KEY_FLAG => 'PRI_KEY',
+ MYSQLI_UNIQUE_KEY_FLAG => 'UNIQUE_KEY',
+ MYSQLI_MULTIPLE_KEY_FLAG => 'MULTIPLE_KEY',
+ MYSQLI_BLOB_FLAG => 'BLOB',
+ MYSQLI_UNSIGNED_FLAG => 'UNSIGNED',
+ MYSQLI_ZEROFILL_FLAG => 'ZEROFILL',
+ MYSQLI_AUTO_INCREMENT_FLAG => 'AUTO_INCREMENT',
+ MYSQLI_TIMESTAMP_FLAG => 'TIMESTAMP',
+ MYSQLI_SET_FLAG => 'SET',
+ MYSQLI_NUM_FLAG => 'NUM',
+ MYSQLI_PART_KEY_FLAG => 'PART_KEY',
+ // MYSQLI_GROUP_FLAG => 'MYSQLI_GROUP_FLAG' - internal usage only
+ (defined('MYSQLI_NO_DEFAULT_VALUE_FLAG') ? MYSQLI_NO_DEFAULT_VALUE_FLAG : 4096) => 'NO_DEFAULT_VALUE',
+ (defined('MYSQLI_BINARY_FLAG') ? MYSQLI_BINARY_FLAG : 128) => 'BINARY',
+ (defined('MYSQLI_ENUM_FLAG') ? MYSQLI_ENUM_FLAG : 256) => 'ENUM',
+ // MYSQLI_BINCMP_FLAG
+ );
+
+ // 5.1.24 / 6.0.4+
+ if (defined('MYSQLI_ON_UPDATE_NOW'))
+ $flags[MYSQLI_ON_UPDATE_NOW] = 'ON_UPDATE_NOW';
+ else
+ $flags[8192] = 'ON_UPDATE_NOW';
+
+ krsort($flags);
+
+ $columns = array(
+ 'INT DEFAULT NULL' => 'NUM',
+ 'INT NOT NULL' => 'NOT_NULL NO_DEFAULT_VALUE NUM',
+ 'INT NOT NULL DEFAULT 1' => 'NOT_NULL NUM',
+ 'INT UNSIGNED DEFAULT NULL' => 'UNSIGNED NUM',
+ 'INT UNSIGNED NOT NULL' => 'NOT_NULL UNSIGNED NO_DEFAULT_VALUE NUM',
+ 'INT UNSIGNED NOT NULL DEFAULT 1' => 'NOT_NULL UNSIGNED NUM',
+ 'INT UNSIGNED ZEROFILL DEFAULT NULL' => 'UNSIGNED ZEROFILL NUM',
+ 'INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY' => 'NOT_NULL PRI_KEY UNSIGNED AUTO_INCREMENT NUM PART_KEY',
+ 'CHAR(1) DEFAULT NULL' => '',
+ 'CHAR(1) NOT NULL' => 'NOT_NULL NO_DEFAULT_VALUE',
+ 'VARBINARY(127) DEFAULT NULL' => 'BINARY',
+ 'BLOB' => 'BLOB BINARY',
+ 'TINYBLOB' => 'BLOB BINARY',
+ 'MEDIUMBLOB' => 'BLOB BINARY',
+ 'LONGBLOB' => 'BLOB BINARY',
+ 'TEXT' => 'BLOB',
+ 'TINYTEXT' => 'BLOB',
+ 'MEDIUMTEXT' => 'BLOB',
+ 'LONGTEXT' => 'BLOB',
+ 'SET("one", "two")' => 'SET',
+ 'SET("one", "two") NOT NULL' => 'NOT_NULL SET NO_DEFAULT_VALUE',
+ 'SET("one", "two") NOT NULL DEFAULT "one"' => 'NOT_NULL SET',
+ 'ENUM("one", "two")' => 'ENUM',
+ 'ENUM("one", "two") NOT NULL' => 'NOT_NULL ENUM NO_DEFAULT_VALUE',
+ 'ENUM("one", "two") NOT NULL DEFAULT "one"' => 'NOT_NULL ENUM',
+ 'TINYINT UNIQUE' => 'UNIQUE_KEY NUM PART_KEY',
+ 'SMALLINT UNIQUE' => 'UNIQUE_KEY NUM PART_KEY',
+ 'MEDIUMINT UNIQUE DEFAULT 1' => 'UNIQUE_KEY NUM PART_KEY',
+ 'BIGINT UNSIGNED UNIQUE DEFAULT 100' => 'UNIQUE_KEY UNSIGNED NUM PART_KEY',
+ 'BIT' => 'UNSIGNED',
+ 'VARCHAR(2) NOT NULL PRIMARY KEY' => 'NOT_NULL PRI_KEY NO_DEFAULT_VALUE PART_KEY'
+ );
+
+
+
+ function checkFlags($reported_flags, $expected_flags, $flags) {
+ $found_flags = $unexpected_flags = '';
+ foreach ($flags as $code => $name) {
+ if ($reported_flags >= $code) {
+ $reported_flags -= $code;
+ $found_flags .= $name . ' ';
+ if (stristr($expected_flags, $name)) {
+ $expected_flags = trim(str_ireplace($name, '', $expected_flags));
+ } else {
+ $unexpected_flags .= $name . ' ';
+ }
+ }
+ }
+
+ return array($expected_flags, $unexpected_flags, $found_flags);
+ }
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+
+ foreach ($columns as $column_def => $expected_flags) {
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
+ printf("[002] %s [%d] %s\n", $column_def,
+ mysqli_errno($link), mysqli_error($link));
+ continue;
+ }
+
+ $create = sprintf('CREATE TABLE test(id INT, col1 %s)', $column_def);
+ if (!mysqli_query($link, $create)) {
+ // Server might not support it - skip
+ continue;
+ }
+
+ if (!$res = mysqli_query($link, 'SELECT * FROM test')) {
+ printf("[003] Can't select from table, %s [%d] %s\n", $column_def,
+ mysqli_errno($link), mysqli_error($link));
+ continue;
+ }
+
+ $field = mysqli_fetch_field_direct($res, 1);
+ if (!is_object($field)) {
+ printf("[004] Fetching the meta data failed, %s [%d] %s\n", $column_def,
+ mysqli_errno($link), mysqli_error($link));
+ continue;
+ }
+ if ($field->name != 'col1') {
+ printf("[005] Field information seems wrong, %s [%d] %s\n", $column_def,
+ mysqli_errno($link), mysqli_error($link));
+ continue;
+ }
+
+ /*
+ TODO
+ Unfortunately different server versions give you slightly different
+ results.The test does not yet fully reflect all server changes/bugs etc.
+ */
+ switch ($column_def) {
+ case 'INT UNSIGNED NOT NULL':
+ case 'INT NOT NULL':
+ case 'CHAR(1) NOT NULL':
+ case 'SET("one", "two") NOT NULL':
+ case 'ENUM("one", "two") NOT NULL':
+ $version = mysqli_get_server_version($link);
+ if ($version < 50000) {
+ // TODO - check exact version!
+ $expected_flags = trim(str_replace('NO_DEFAULT_VALUE', '', $expected_flags));
+ }
+ break;
+
+ case 'BIT':
+ $version = mysqli_get_server_version($link);
+ if (($version <= 50114 && $version > 50100) || ($version == 50200)) {
+ // TODO - check exact version!
+ $expected_flags = trim(str_replace('UNSIGNED', '', $expected_flags));
+ }
+
+ default:
+ break;
+ }
+
+ list($missing_flags, $unexpected_flags, $flags_found) = checkFlags($field->flags, $expected_flags, $flags);
+ if ($unexpected_flags) {
+ printf("[006] Found unexpected flags '%s' for %s, found '%s' with MySQL %s'\n",
+ $unexpected_flags, $column_def, $flags_found, mysqli_get_server_version($link));
+ }
+ if ($missing_flags) {
+ printf("[007] The flags '%s' have not been reported for %s, found '%s'\n",
+ $missing_flags, $column_def, $flags_found);
+ var_dump($create);
+ var_dump(mysqli_get_server_version($link));
+ die($missing_flags);
+ }
+
+ mysqli_free_result($res);
+ }
+
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
+ printf("[008] %s [%d] %s\n", $column_def,
+ mysqli_errno($link), mysqli_error($link));
+ }
+
+ $column_def = array('col1 CHAR(1)', 'col2 CHAR(2)','INDEX idx_col1_col2(col1, col2)');
+ $expected_flags = array('col1' => 'MULTIPLE_KEY PART_KEY', 'col2' => 'PART_KEY');
+ $create = 'CREATE TABLE test(id INT, ';
+ foreach ($column_def as $k => $v) {
+ $create .= sprintf('%s, ', $v);
+ }
+ $create = sprintf('%s)', substr($create, 0, -2));
+
+ if (mysqli_query($link, $create)) {
+ if (!$res = mysqli_query($link, 'SELECT * FROM test')) {
+ printf("[009] Cannot run SELECT, [%d] %s\n",
+ mysqli_errno($link), mysqli_error($link));
+ }
+ // id column - skip it
+ $field = mysqli_fetch_field($res);
+ while ($field = mysqli_fetch_field($res)) {
+ if (!isset($expected_flags[$field->name])) {
+ printf("[010] Found unexpected field '%s'\n", $field->name);
+ }
+ list($missing_flags, $unexpected_flags, $flags_found) = checkFlags($field->flags, $expected_flags[$field->name], $flags);
+ if ($unexpected_flags)
+ printf("[011] Found unexpected flags '%s' for %s, found '%s'\n",
+ $unexpected_flags, $field->name, $flags_found);
+ if ($missing_flags)
+ printf("[012] The flags '%s' have not been reported for %s, found '%s'\n",
+ $missing_flags, $field->name, $flags_found);
+ }
+ }
+
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_fetch_field_oo.phpt b/ext/mysqli/tests/mysqli_fetch_field_oo.phpt
index 2293c9581a..4a10ced2c2 100644
--- a/ext/mysqli/tests/mysqli_fetch_field_oo.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_field_oo.phpt
@@ -8,68 +8,69 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ // Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test
+ $mysqli = new mysqli();
+ $res = false;
+ try {
+ new mysqli_result($mysqli);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- // Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test
- $mysqli = new mysqli();
- $res = @new mysqli_result($mysqli);
- if (false !== ($tmp = @$res->fetch_field()))
- printf("[001] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ require('table.inc');
+ if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- require('table.inc');
- if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ // Make sure that client, connection and result charsets are all the
+ // same. Not sure whether this is strictly necessary.
+ if (!$mysqli->set_charset('utf8'))
+ printf("[%d] %s\n", $mysqli->errno, $mysqli->errno);
- if (!is_null($tmp = @$res->fetch_field($link)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ $charsetInfo = $mysqli->get_charset();
- // Make sure that client, connection and result charsets are all the
- // same. Not sure whether this is strictly necessary.
- if (!$mysqli->set_charset('utf8'))
- printf("[%d] %s\n", $mysqli->errno, $mysqli->errno);
+ if (!$res = $mysqli->query("SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 1")) {
+ printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
- $charsetInfo = $mysqli->get_charset();
+ var_dump($res->fetch_field());
- if (!$res = $mysqli->query("SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 1")) {
- printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
+ $tmp = $res->fetch_field();
+ var_dump($tmp);
+ if ($tmp->charsetnr != $charsetInfo->number) {
+ printf("[005] Expecting charset %s/%d got %d\n",
+ $charsetInfo->charset, $charsetInfo->number, $tmp->charsetnr);
+ }
+ if ($tmp->length != $charsetInfo->max_length) {
+ printf("[006] Expecting length %d got %d\n",
+ $charsetInfo->max_length, $tmp->max_length);
+ }
+ if ($tmp->db != $db) {
+ printf("[007] Expecting database '%s' got '%s'\n",
+ $db, $tmp->db);
+ }
- var_dump($res->fetch_field());
+ var_dump($res->fetch_field());
- $tmp = $res->fetch_field();
- var_dump($tmp);
- if ($tmp->charsetnr != $charsetInfo->number) {
- printf("[005] Expecting charset %s/%d got %d\n",
- $charsetInfo->charset, $charsetInfo->number, $tmp->charsetnr);
- }
- if ($tmp->length != $charsetInfo->max_length) {
- printf("[006] Expecting length %d got %d\n",
- $charsetInfo->max_length, $tmp->max_length);
- }
- if ($tmp->db != $db) {
- printf("[007] Expecting database '%s' got '%s'\n",
- $db, $tmp->db);
- }
+ $res->free_result();
- var_dump($res->fetch_field());
+ try {
+ $res->fetch_field();
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- $res->free_result();
-
- if (false !== ($tmp = $res->fetch_field()))
- printf("[007] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- $mysqli->close();
- print "done!";
+ $mysqli->close();
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
--EXPECTF--
+mysqli object is not fully initialized
object(stdClass)#%d (13) {
["name"]=>
string(2) "ID"
@@ -127,6 +128,5 @@ object(stdClass)#%d (13) {
int(0)
}
bool(false)
-
-Warning: mysqli_result::fetch_field(): Couldn't fetch mysqli_result in %s on line %d
+mysqli_result object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_fetch_field_types.phpt b/ext/mysqli/tests/mysqli_fetch_field_types.phpt
index 31661bdda2..ae21349ab0 100644
--- a/ext/mysqli/tests/mysqli_fetch_field_types.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_field_types.phpt
@@ -8,115 +8,115 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require('table.inc');
+ require('table.inc');
- function mysqli_field_datatypes($link, $sql_type, $php_value, $php_type, $datatypes, $default_charset="latin1") {
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
- printf("[001] %s, [%d] %s\n", $sql_type,
- mysqli_errno($link), mysqli_error($link));
- return false;
- }
+ function mysqli_field_datatypes($link, $sql_type, $php_value, $php_type, $datatypes, $default_charset="latin1") {
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
+ printf("[001] %s, [%d] %s\n", $sql_type,
+ mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
- $create = sprintf("CREATE TABLE test(id %s) DEFAULT CHARSET %s", $sql_type, $default_charset);
- if (!mysqli_query($link, $create)) {
- printf("[002] '%s' - '%s', [%d] %s\n", $sql_type, $create,
- mysqli_errno($link), mysqli_error($link));
- return false;
- }
+ $create = sprintf("CREATE TABLE test(id %s) DEFAULT CHARSET %s", $sql_type, $default_charset);
+ if (!mysqli_query($link, $create)) {
+ printf("[002] '%s' - '%s', [%d] %s\n", $sql_type, $create,
+ mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
- if (is_string($php_value))
- $sql = sprintf("INSERT INTO test(id) VALUES ('%s')", $php_value);
- else
- $sql = sprintf("INSERT INTO test(id) VALUES (%s)", $php_value);
+ if (is_string($php_value))
+ $sql = sprintf("INSERT INTO test(id) VALUES ('%s')", $php_value);
+ else
+ $sql = sprintf("INSERT INTO test(id) VALUES (%s)", $php_value);
- if (!mysqli_query($link, $sql)) {
- printf("[003] '%s' - '%s' - '%s', [%d] %s\n", $sql_type, $create, $sql,
- mysqli_errno($link), mysqli_error($link));
- return false;
- }
+ if (!mysqli_query($link, $sql)) {
+ printf("[003] '%s' - '%s' - '%s', [%d] %s\n", $sql_type, $create, $sql,
+ mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
- if (!$res = mysqli_query($link, 'SELECT id FROM test')) {
- printf("[004] %s, [%d] %s\n", $sql_type,
- mysqli_errno($link), mysqli_error($link));
- return false;
- }
+ if (!$res = mysqli_query($link, 'SELECT id FROM test')) {
+ printf("[004] %s, [%d] %s\n", $sql_type,
+ mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
- if (!is_object($field = mysqli_fetch_field($res))) {
- printf("[004] %s, expecting object got %s, [%d] %s\n", $sql_type,
- gettype($field),
- mysqli_errno($link), mysqli_error($link));
- return false;
- }
+ if (!is_object($field = mysqli_fetch_field($res))) {
+ printf("[004] %s, expecting object got %s, [%d] %s\n", $sql_type,
+ gettype($field),
+ mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
- if ($field->type != $php_type) {
- $code_name = 'unknown';
- foreach ($datatypes as $k => $v) {
- if ($k == $field->type) {
- $code_name = (is_array($v)) ? $v[0] : $v;
- break;
- }
- }
- printf("[006] Expecting %d for %s got code %d for %s\n",
- $php_type, $sql_type, $field->type, $code_name);
- return false;
- }
+ if ($field->type != $php_type) {
+ $code_name = 'unknown';
+ foreach ($datatypes as $k => $v) {
+ if ($k == $field->type) {
+ $code_name = (is_array($v)) ? $v[0] : $v;
+ break;
+ }
+ }
+ printf("[006] Expecting %d for %s got code %d for %s\n",
+ $php_type, $sql_type, $field->type, $code_name);
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- $datatypes = array(
- MYSQLI_TYPE_TINY => array('TINYINT', 5),
- MYSQLI_TYPE_SHORT => array('SMALLINT', 10),
- MYSQLI_TYPE_LONG => 'MYSQLI_TYPE_LONG - TODO add testing',
- MYSQLI_TYPE_FLOAT => array('FLOAT', '1.3'),
- MYSQLI_TYPE_DOUBLE => array('DOUBLE', '1.4'),
- MYSQLI_TYPE_TIMESTAMP => array('TIMESTAMP', '2007-08-20 18:34:00'),
- MYSQLI_TYPE_LONGLONG => array('BIGINT', 100),
- MYSQLI_TYPE_INT24 => array('MEDIUMINT', 10),
- MYSQLI_TYPE_DATE => array('DATE', '2007-08-20'),
- MYSQLI_TYPE_TIME => array('TIME', '18:41:38'),
- MYSQLI_TYPE_DATETIME => array('DATETIME', '2007-08-20 18:42:01'),
- MYSQLI_TYPE_YEAR => array('YEAR', '2007'),
- MYSQLI_TYPE_ENUM => array('ENUM("everything", "is", "just", "wonderful")', 'is'),
- // MYSQLI_TYPE_SET => array('SET("I", "smash", "the")', 'I,smash,the'), - string
- // MYSQLI_TYPE_TINY_BLOB => array("TINYBLOB", "I got a tiny blog"), - blob
- // MYSQLI_TYPE_MEDIUM_BLOB => array("MEDIUMBLOB", "No blob for masses"), - blob
- // MYSQLI_TYPE_LONG_BLOB => array("LONGBLOB", "Small is beautiful?"), - blob
- MYSQLI_TYPE_BLOB => array("LONGBLOB", 'MySQL does not report proper type. Use Length to distinct BLOB types'),
- MYSQLI_TYPE_BLOB => array("MEDIUMBLOB", 'MySQL does not report proper type. Use Length to distinct BLOB types'),
- MYSQLI_TYPE_BLOB => array("TINYBLOB", 'MySQL does not report proper type. Use Length to distinct BLOB types'),
- MYSQLI_TYPE_BLOB => array("BLOB", 'silly'),
- MYSQLI_TYPE_VAR_STRING => array("VARCHAR(32768)", 'varchar'),
- MYSQLI_TYPE_STRING => 'MYSQLI_TYPE_STRING - TODO add testing',
- MYSQLI_TYPE_STRING => array('CHAR(1)', 'a'),
- MYSQLI_TYPE_STRING => array("SET('I', 'smash', 'the')", 'smash'),
- MYSQLI_TYPE_NULL => 'MYSQLI_TYPE_NULL - TODO add testing',
- MYSQLI_TYPE_NEWDATE => 'MYSQLI_TYPE_NEWDATE - TODO add testing',
- MYSQLI_TYPE_INTERVAL => 'MYSQLI_TYPE_INTERVAL - TODO add testing',
- MYSQLI_TYPE_GEOMETRY => 'MYSQLI_TYPE_GEOMETRY - TODO add testing',
- );
+ $datatypes = array(
+ MYSQLI_TYPE_TINY => array('TINYINT', 5),
+ MYSQLI_TYPE_SHORT => array('SMALLINT', 10),
+ MYSQLI_TYPE_LONG => 'MYSQLI_TYPE_LONG - TODO add testing',
+ MYSQLI_TYPE_FLOAT => array('FLOAT', '1.3'),
+ MYSQLI_TYPE_DOUBLE => array('DOUBLE', '1.4'),
+ MYSQLI_TYPE_TIMESTAMP => array('TIMESTAMP', '2007-08-20 18:34:00'),
+ MYSQLI_TYPE_LONGLONG => array('BIGINT', 100),
+ MYSQLI_TYPE_INT24 => array('MEDIUMINT', 10),
+ MYSQLI_TYPE_DATE => array('DATE', '2007-08-20'),
+ MYSQLI_TYPE_TIME => array('TIME', '18:41:38'),
+ MYSQLI_TYPE_DATETIME => array('DATETIME', '2007-08-20 18:42:01'),
+ MYSQLI_TYPE_YEAR => array('YEAR', '2007'),
+ MYSQLI_TYPE_ENUM => array('ENUM("everything", "is", "just", "wonderful")', 'is'),
+ // MYSQLI_TYPE_SET => array('SET("I", "smash", "the")', 'I,smash,the'), - string
+ // MYSQLI_TYPE_TINY_BLOB => array("TINYBLOB", "I got a tiny blog"), - blob
+ // MYSQLI_TYPE_MEDIUM_BLOB => array("MEDIUMBLOB", "No blob for masses"), - blob
+ // MYSQLI_TYPE_LONG_BLOB => array("LONGBLOB", "Small is beautiful?"), - blob
+ MYSQLI_TYPE_BLOB => array("LONGBLOB", 'MySQL does not report proper type. Use Length to distinct BLOB types'),
+ MYSQLI_TYPE_BLOB => array("MEDIUMBLOB", 'MySQL does not report proper type. Use Length to distinct BLOB types'),
+ MYSQLI_TYPE_BLOB => array("TINYBLOB", 'MySQL does not report proper type. Use Length to distinct BLOB types'),
+ MYSQLI_TYPE_BLOB => array("BLOB", 'silly'),
+ MYSQLI_TYPE_VAR_STRING => array("VARCHAR(32768)", 'varchar'),
+ MYSQLI_TYPE_STRING => 'MYSQLI_TYPE_STRING - TODO add testing',
+ MYSQLI_TYPE_STRING => array('CHAR(1)', 'a'),
+ MYSQLI_TYPE_STRING => array("SET('I', 'smash', 'the')", 'smash'),
+ MYSQLI_TYPE_NULL => 'MYSQLI_TYPE_NULL - TODO add testing',
+ MYSQLI_TYPE_NEWDATE => 'MYSQLI_TYPE_NEWDATE - TODO add testing',
+ MYSQLI_TYPE_INTERVAL => 'MYSQLI_TYPE_INTERVAL - TODO add testing',
+ MYSQLI_TYPE_GEOMETRY => 'MYSQLI_TYPE_GEOMETRY - TODO add testing',
+ );
- if ($IS_MYSQLND) {
- $version = 50007 + 1;
- } else {
- $version = mysqli_get_client_version();
- }
+ if ($IS_MYSQLND) {
+ $version = 50007 + 1;
+ } else {
+ $version = mysqli_get_client_version();
+ }
- if ($version > 50002) {
- $datatypes[MYSQLI_TYPE_NEWDECIMAL] = array('DECIMAL', '1.1');
- $datatypes[MYSQLI_TYPE_BIT] = array('BIT', 0);
- } else {
- $datatypes[MYSQLI_TYPE_DECIMAL] = array('DECIMAL', '1.1');
- }
+ if ($version > 50002) {
+ $datatypes[MYSQLI_TYPE_NEWDECIMAL] = array('DECIMAL', '1.1');
+ $datatypes[MYSQLI_TYPE_BIT] = array('BIT', 0);
+ } else {
+ $datatypes[MYSQLI_TYPE_DECIMAL] = array('DECIMAL', '1.1');
+ }
- foreach ($datatypes as $php_type => $datatype) {
- if (is_array($datatype))
- mysqli_field_datatypes($link, $datatype[0], $datatype[1], $php_type, $datatypes);
- }
+ foreach ($datatypes as $php_type => $datatype) {
+ if (is_array($datatype))
+ mysqli_field_datatypes($link, $datatype[0], $datatype[1], $php_type, $datatypes);
+ }
- mysqli_close($link);
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_fetch_fields.phpt b/ext/mysqli/tests/mysqli_fetch_fields.phpt
index c79555c3a1..5a16f73633 100644
--- a/ext/mysqli/tests/mysqli_fetch_fields.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_fields.phpt
@@ -8,58 +8,53 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ // Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test
- // Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test
- if (!is_null($tmp = @mysqli_fetch_fields()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ require('table.inc');
- if (!is_null($tmp = @mysqli_fetch_fields($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ // Make sure that client, connection and result charsets are all the
+ // same. Not sure whether this is strictly necessary.
+ if (!mysqli_set_charset($link, 'utf8'))
+ printf("[%d] %s\n", mysqli_errno($link), mysqli_errno($link));
- require('table.inc');
+ $charsetInfo = mysqli_get_charset($link);
- // Make sure that client, connection and result charsets are all the
- // same. Not sure whether this is strictly necessary.
- if (!mysqli_set_charset($link, 'utf8'))
- printf("[%d] %s\n", mysqli_errno($link), mysqli_errno($link));
+ if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 1")) {
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- $charsetInfo = mysqli_get_charset($link);
+ $fields = mysqli_fetch_fields($res);
+ foreach ($fields as $k => $field) {
+ var_dump($field);
+ switch ($k) {
+ case 1:
+ /* label column, result set charset */
+ if ($field->charsetnr != $charsetInfo->number) {
+ printf("[004] Expecting charset %s/%d got %d\n",
+ $charsetInfo->charset,
+ $charsetInfo->number, $field->charsetnr);
+ }
+ if ($field->length != $charsetInfo->max_length) {
+ printf("[005] Expecting length %d got %d\n",
+ $charsetInfo->max_length,
+ $field->max_length);
+ }
+ break;
+ }
+ }
- if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 1")) {
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ mysqli_free_result($res);
- $fields = mysqli_fetch_fields($res);
- foreach ($fields as $k => $field) {
- var_dump($field);
- switch ($k) {
- case 1:
- /* label column, result set charset */
- if ($field->charsetnr != $charsetInfo->number) {
- printf("[004] Expecting charset %s/%d got %d\n",
- $charsetInfo->charset,
- $charsetInfo->number, $field->charsetnr);
- }
- if ($field->length != $charsetInfo->max_length) {
- printf("[005] Expecting length %d got %d\n",
- $charsetInfo->max_length,
- $field->max_length);
- }
- break;
- }
- }
+ try {
+ mysqli_fetch_fields($res);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- mysqli_free_result($res);
-
- if (false !== ($tmp = mysqli_fetch_fields($res)))
- printf("[006] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
@@ -122,6 +117,5 @@ object(stdClass)#%d (13) {
["decimals"]=>
int(0)
}
-
-Warning: mysqli_fetch_fields(): Couldn't fetch mysqli_result in %s on line %d
+mysqli_result object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_fetch_lengths.phpt b/ext/mysqli/tests/mysqli_fetch_lengths.phpt
index 85921f800d..707c3691d0 100644
--- a/ext/mysqli/tests/mysqli_fetch_lengths.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_lengths.phpt
@@ -8,41 +8,39 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!$mysqli = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
+ if (!$mysqli = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
- if (!is_null($tmp = @mysqli_fetch_lengths()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ require('table.inc');
+ if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id LIMIT 1")) {
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- if (!is_null($tmp = @mysqli_fetch_lengths($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ var_dump(mysqli_fetch_lengths($res));
+ while ($row = mysqli_fetch_assoc($res))
+ var_dump(mysqli_fetch_lengths($res));
+ var_dump(mysqli_fetch_lengths($res));
- require('table.inc');
- if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id LIMIT 1")) {
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ mysqli_free_result($res);
- var_dump(mysqli_fetch_lengths($res));
- while ($row = mysqli_fetch_assoc($res))
- var_dump(mysqli_fetch_lengths($res));
- var_dump(mysqli_fetch_lengths($res));
+ try {
+ mysqli_fetch_lengths($res);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- mysqli_free_result($res);
-
- var_dump(mysqli_fetch_lengths($res));
-
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
---EXPECTF--
+--EXPECT--
bool(false)
array(2) {
[0]=>
@@ -51,7 +49,5 @@ array(2) {
int(1)
}
bool(false)
-
-Warning: mysqli_fetch_lengths(): Couldn't fetch mysqli_result in %s on line %d
-bool(false)
+mysqli_result object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_fetch_lengths_oo.phpt b/ext/mysqli/tests/mysqli_fetch_lengths_oo.phpt
index c352bea8a0..18cc383939 100644
--- a/ext/mysqli/tests/mysqli_fetch_lengths_oo.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_lengths_oo.phpt
@@ -8,25 +8,29 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect\n");
+ if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect\n");
- require('table.inc');
- if (!$res = $mysqli->query("SELECT id, label FROM test ORDER BY id LIMIT 1")) {
- printf("[002] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
+ require('table.inc');
+ if (!$res = $mysqli->query("SELECT id, label FROM test ORDER BY id LIMIT 1")) {
+ printf("[002] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
- var_dump($res->lengths);
- while ($row = $res->fetch_assoc())
- var_dump($res->lengths);
- var_dump($res->lengths);
+ var_dump($res->lengths);
+ while ($row = $res->fetch_assoc())
+ var_dump($res->lengths);
+ var_dump($res->lengths);
- $res->free_result();
- var_dump($res->lengths);
- $mysqli->close();
- print "done!";
+ $res->free_result();
+ try {
+ $res->lengths;
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+ $mysqli->close();
+ print "done!";
?>
--CLEAN--
<?php
@@ -35,7 +39,7 @@ require_once('skipifconnectfailure.inc');
<?php
require_once("clean_table.inc");
?>
---EXPECTF--
+--EXPECT--
NULL
array(2) {
[0]=>
@@ -44,7 +48,5 @@ array(2) {
int(1)
}
NULL
-
-Warning: main(): Property access is not allowed yet in %s on line %d
-bool(false)
+Property access is not allowed yet
done!
diff --git a/ext/mysqli/tests/mysqli_fetch_object.phpt b/ext/mysqli/tests/mysqli_fetch_object.phpt
index 09ea19161a..cc6d4c8d14 100644
--- a/ext/mysqli/tests/mysqli_fetch_object.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_object.phpt
@@ -8,151 +8,143 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- include_once("connect.inc");
-
- set_error_handler('handle_catchable_fatal');
-
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_fetch_object()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_fetch_object($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- require('table.inc');
- if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 5")) {
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
-
- $obj = mysqli_fetch_object($res);
- if (($obj->ID !== "1") || ($obj->label !== "a") || (get_class($obj) != 'stdClass')) {
- printf("[004] Object seems wrong. [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump($obj);
- }
-
- class mysqli_fetch_object_test {
-
- public $a = null;
- public $b = null;
-
- public function toString() {
- var_dump($this);
- }
- }
-
- $obj = mysqli_fetch_object($res, 'mysqli_fetch_object_test');
- if (($obj->ID !== "2") || ($obj->label !== "b") || ($obj->a !== NULL) || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_test')) {
- printf("[005] Object seems wrong. [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump($obj);
- }
-
-
-
- class mysqli_fetch_object_construct extends mysqli_fetch_object_test {
-
- public function __construct($a, $b) {
- $this->a = $a;
- $this->b = $b;
- }
-
- }
-
- try {
- $obj = mysqli_fetch_object($res, 'mysqli_fetch_object_construct', array());
- if (($obj->ID !== "3") || ($obj->label !== "c") || ($obj->a !== NULL) || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_construct')) {
- printf("[006] Object seems wrong. [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump($obj);
- }
- } catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
- }
-
- try {
- $obj = mysqli_fetch_object($res, 'mysqli_fetch_object_construct', array('a'));
- if (($obj->ID !== "4") || ($obj->label !== "d") || ($obj->a !== 'a') || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_construct')) {
- printf("[007] Object seems wrong. [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump($obj);
- }
- } catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
- }
-
- $obj = mysqli_fetch_object($res, 'mysqli_fetch_object_construct', array('a', 'b'));
- if (($obj->ID !== "5") || ($obj->label !== "e") || ($obj->a !== 'a') || ($obj->b !== 'b') || (get_class($obj) != 'mysqli_fetch_object_construct')) {
- printf("[008] Object seems wrong. [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump($obj);
- }
-
- var_dump(mysqli_fetch_object($res, 'mysqli_fetch_object_construct', array('a', 'b', 'c')));
- var_dump(mysqli_fetch_object($res));
-
- mysqli_free_result($res);
-
- if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST")) {
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
-
- mysqli_free_result($res);
- var_dump(mysqli_fetch_object($res));
-
- if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 5"))
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- /*
- TODO
- I'm using the procedural interface, this should not throw an exception.
- Also, I did not ask to get exceptions using the mysqli_options()
- */
- try {
- if (false !== ($obj = @mysqli_fetch_object($res, 'mysqli_fetch_object_construct', 'a')))
- printf("[011] Should have failed\n");
- } catch (Error $e) {
- handle_catchable_fatal($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
- }
-
- mysqli_free_result($res);
-
- if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 5"))
- printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- class mysqli_fetch_object_private_constructor extends mysqli_fetch_object_test {
-
- private function __construct($a, $b) {
- $this->a = $a;
- $this->b = $b;
- }
- }
- /*
- TODO
- I think we should bail out here. The following line will give a Fatal error: Call to private ... from invalid context
- var_dump($obj = new mysqli_fetch_object_private_constructor(1, 2));
- This does not fail.
- */
- $obj = mysqli_fetch_object($res, 'mysqli_fetch_object_private_constructor', array('a', 'b'));
- mysqli_free_result($res);
-
- // Fatal error, script execution will end
- var_dump(mysqli_fetch_object($res, 'this_class_does_not_exist'));
-
-
- mysqli_close($link);
- print "done!";
+ include_once("connect.inc");
+
+ set_error_handler('handle_catchable_fatal');
+
+ require('table.inc');
+ if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 5")) {
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ $obj = mysqli_fetch_object($res);
+ if (($obj->ID !== "1") || ($obj->label !== "a") || (get_class($obj) != 'stdClass')) {
+ printf("[004] Object seems wrong. [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ var_dump($obj);
+ }
+
+ class mysqli_fetch_object_test {
+
+ public $a = null;
+ public $b = null;
+
+ public function toString() {
+ var_dump($this);
+ }
+ }
+
+ $obj = mysqli_fetch_object($res, 'mysqli_fetch_object_test');
+ if (($obj->ID !== "2") || ($obj->label !== "b") || ($obj->a !== NULL) || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_test')) {
+ printf("[005] Object seems wrong. [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ var_dump($obj);
+ }
+
+
+
+ class mysqli_fetch_object_construct extends mysqli_fetch_object_test {
+
+ public function __construct($a, $b) {
+ $this->a = $a;
+ $this->b = $b;
+ }
+
+ }
+
+ try {
+ $obj = mysqli_fetch_object($res, 'mysqli_fetch_object_construct', array());
+ if (($obj->ID !== "3") || ($obj->label !== "c") || ($obj->a !== NULL) || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_construct')) {
+ printf("[006] Object seems wrong. [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ var_dump($obj);
+ }
+ } catch (Throwable $e) {
+ echo "Exception: " . $e->getMessage() . "\n";
+ }
+
+ try {
+ $obj = mysqli_fetch_object($res, 'mysqli_fetch_object_construct', array('a'));
+ if (($obj->ID !== "4") || ($obj->label !== "d") || ($obj->a !== 'a') || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_construct')) {
+ printf("[007] Object seems wrong. [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ var_dump($obj);
+ }
+ } catch (Throwable $e) {
+ echo "Exception: " . $e->getMessage() . "\n";
+ }
+
+ $obj = mysqli_fetch_object($res, 'mysqli_fetch_object_construct', array('a', 'b'));
+ if (($obj->ID !== "5") || ($obj->label !== "e") || ($obj->a !== 'a') || ($obj->b !== 'b') || (get_class($obj) != 'mysqli_fetch_object_construct')) {
+ printf("[008] Object seems wrong. [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ var_dump($obj);
+ }
+
+ var_dump(mysqli_fetch_object($res, 'mysqli_fetch_object_construct', array('a', 'b', 'c')));
+ var_dump(mysqli_fetch_object($res));
+
+ mysqli_free_result($res);
+
+ if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST")) {
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ mysqli_free_result($res);
+ try {
+ mysqli_fetch_object($res);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 5"))
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ /*
+ TODO
+ I'm using the procedural interface, this should not throw an exception.
+ Also, I did not ask to get exceptions using the mysqli_options()
+ */
+ try {
+ if (false !== ($obj = @mysqli_fetch_object($res, 'mysqli_fetch_object_construct', 'a')))
+ printf("[011] Should have failed\n");
+ } catch (Error $e) {
+ handle_catchable_fatal($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
+ }
+
+ mysqli_free_result($res);
+
+ if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 5"))
+ printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ class mysqli_fetch_object_private_constructor extends mysqli_fetch_object_test {
+
+ private function __construct($a, $b) {
+ $this->a = $a;
+ $this->b = $b;
+ }
+ }
+ /*
+ TODO
+ I think we should bail out here. The following line will give a Fatal error: Call to private ... from invalid context
+ var_dump($obj = new mysqli_fetch_object_private_constructor(1, 2));
+ This does not fail.
+ */
+ $obj = mysqli_fetch_object($res, 'mysqli_fetch_object_private_constructor', array('a', 'b'));
+ mysqli_free_result($res);
+
+ // Fatal error, script execution will end
+ var_dump(mysqli_fetch_object($res, 'this_class_does_not_exist'));
+
+
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
--EXPECTF--
-[E_WARNING] mysqli_fetch_object() expects at least 1 parameter, 0 given in %s on line %d
-[E_WARNING] mysqli_fetch_object() expects parameter 1 to be mysqli_result, null given in %s on line %d
Exception: Too few arguments to function mysqli_fetch_object_construct::__construct(), 0 passed and exactly 2 expected
Exception: Too few arguments to function mysqli_fetch_object_construct::__construct(), 1 passed and exactly 2 expected
NULL
NULL
-[E_WARNING] mysqli_fetch_object(): Couldn't fetch mysqli_result in %s on line %d
-bool(false)
-[0] Argument 3 passed to mysqli_fetch_object() must be of the type array, string given in %s on line %d
+mysqli_result object is already closed
+[0] mysqli_fetch_object() expects parameter 3 to be array, string given in %s on line %d
Fatal error: Class 'this_class_does_not_exist' not found in %s on line %d
diff --git a/ext/mysqli/tests/mysqli_fetch_object_no_constructor.phpt b/ext/mysqli/tests/mysqli_fetch_object_no_constructor.phpt
index cb9f98cfa6..f773b76528 100644
--- a/ext/mysqli/tests/mysqli_fetch_object_no_constructor.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_object_no_constructor.phpt
@@ -8,41 +8,41 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- require('table.inc');
- if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 5")) {
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ require('table.inc');
+ if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 5")) {
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- class mysqli_fetch_object_test {
+ class mysqli_fetch_object_test {
- public $a = null;
- public $b = null;
+ public $a = null;
+ public $b = null;
- public function toString() {
- var_dump($this);
- }
- }
+ public function toString() {
+ var_dump($this);
+ }
+ }
- printf("No exception with PHP:\n");
- var_dump($obj = new mysqli_fetch_object_test(1, 2));
+ printf("No exception with PHP:\n");
+ var_dump($obj = new mysqli_fetch_object_test(1, 2));
- printf("\nException with mysqli. Note that at all other places we throws errors but no exceptions unless the error mode has been changed:\n");
- try {
- var_dump($obj = mysqli_fetch_object($res, 'mysqli_fetch_object_test', array(1, 2)));
- } catch (Exception $e) {
- printf("Exception: %s\n", $e->getMessage());
- }
+ printf("\nException with mysqli. Note that at all other places we throws errors but no exceptions unless the error mode has been changed:\n");
+ try {
+ var_dump($obj = mysqli_fetch_object($res, 'mysqli_fetch_object_test', array(1, 2)));
+ } catch (Exception $e) {
+ printf("Exception: %s\n", $e->getMessage());
+ }
- printf("\nFatal error with PHP (but no exception!):\n");
- var_dump($obj->mysqli_fetch_object_test(1, 2));
+ printf("\nFatal error with PHP (but no exception!):\n");
+ var_dump($obj->mysqli_fetch_object_test(1, 2));
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_fetch_object_no_object.phpt b/ext/mysqli/tests/mysqli_fetch_object_no_object.phpt
index c8e2b8508e..c12b91e68e 100644
--- a/ext/mysqli/tests/mysqli_fetch_object_no_object.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_object_no_object.phpt
@@ -8,15 +8,15 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require('table.inc');
- if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 5")) {
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ require('table.inc');
+ if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 5")) {
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- $obj = mysqli_fetch_object($res);
- var_dump(gettype($obj));
- mysqli_close($link);
- print "done!";
+ $obj = mysqli_fetch_object($res);
+ var_dump(gettype($obj));
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_fetch_object_oo.phpt b/ext/mysqli/tests/mysqli_fetch_object_oo.phpt
index d8c8cc70fd..0e90b29e71 100644
--- a/ext/mysqli/tests/mysqli_fetch_object_oo.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_object_oo.phpt
@@ -8,138 +8,134 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
- set_error_handler('handle_catchable_fatal');
-
- $tmp = NULL;
- $link = NULL;
-
- $mysqli = new mysqli();
- $res = @new mysqli_result($mysqli);
- if (false !== ($tmp = @$res->fetch_object()))
- printf("[001] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- require('table.inc');
- if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
-
- if (!$res = $mysqli->query("SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 5")) {
- printf("[003] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
-
- if (!is_null($tmp = @$res->fetch_object($link)))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- try {
- if (!is_null($tmp = @$res->fetch_object($link, $link)))
- printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- } catch (Error $e) {
- handle_catchable_fatal($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
- }
-
-
- try {
- if (!is_null($tmp = @$res->fetch_object($link, $link, $link)))
- printf("[006] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- } catch (Error $e) {
- handle_catchable_fatal($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
- }
-
- $obj = mysqli_fetch_object($res);
- if (($obj->ID !== "1") || ($obj->label !== "a") || (get_class($obj) != 'stdClass')) {
- printf("[007] Object seems wrong. [%d] %s\n", $mysqli->errno, $mysqli->error);
- var_dump($obj);
- }
-
- class mysqli_fetch_object_test {
-
- public $a = null;
- public $b = null;
-
- public function toString() {
- var_dump($this);
- }
- }
-
- $obj = $res->fetch_object('mysqli_fetch_object_test');
- if (($obj->ID !== "2") || ($obj->label !== "b") || ($obj->a !== NULL) || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_test')) {
- printf("[008] Object seems wrong. [%d] %s\n", $mysqli->errno, $mysqli->error);
- var_dump($obj);
- }
-
- class mysqli_fetch_object_construct extends mysqli_fetch_object_test {
-
- public function __construct($a, $b) {
- $this->a = $a;
- $this->b = $b;
- }
-
- }
-
- try {
- $obj = $res->fetch_object('mysqli_fetch_object_construct', null);
-
- if (($obj->ID !== "3") || ($obj->label !== "c") || ($obj->a !== NULL) || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_construct')) {
- printf("[009] Object seems wrong. [%d] %s\n", $mysqli->errno, $mysqli->error);
- var_dump($obj);
- }
- } catch (Error $e) {
- handle_catchable_fatal($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
- mysqli_fetch_object($res);
- }
-
- try {
- $obj = $res->fetch_object('mysqli_fetch_object_construct', array('a'));
- if (($obj->ID !== "4") || ($obj->label !== "d") || ($obj->a !== 'a') || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_construct')) {
- printf("[010] Object seems wrong. [%d] %s\n", $mysqli->errno, $mysqli->error);
- var_dump($obj);
- }
- } catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
- }
-
- $obj = $res->fetch_object('mysqli_fetch_object_construct', array('a', 'b'));
- if (($obj->ID !== "5") || ($obj->label !== "e") || ($obj->a !== 'a') || ($obj->b !== 'b') || (get_class($obj) != 'mysqli_fetch_object_construct')) {
- printf("[011] Object seems wrong. [%d] %s\n", $mysqli->errno, $mysqli->error);
- var_dump($obj);
- }
-
- var_dump($res->fetch_object('mysqli_fetch_object_construct', array('a', 'b', 'c')));
- var_dump(mysqli_fetch_object($res));
-
- mysqli_free_result($res);
-
- if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST")) {
- printf("[012] [%d] %s\n", $mysqli->errno, $mysqli->error);
- }
-
- mysqli_free_result($res);
-
- var_dump(mysqli_fetch_object($res));
-
- // Fatal error, script execution will end
- var_dump($res->fetch_object('this_class_does_not_exist'));
-
- $mysqli->close();
- print "done!";
+ require_once("connect.inc");
+ set_error_handler('handle_catchable_fatal');
+
+ $mysqli = new mysqli();
+ try {
+ new mysqli_result($mysqli);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ require('table.inc');
+ if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+
+ if (!$res = $mysqli->query("SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 5")) {
+ printf("[003] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
+
+ try {
+ if (!is_null($tmp = @$res->fetch_object($link, $link)))
+ printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ } catch (Error $e) {
+ handle_catchable_fatal($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
+ }
+
+
+ try {
+ if (!is_null($tmp = @$res->fetch_object($link, $link, $link)))
+ printf("[006] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ } catch (Error $e) {
+ handle_catchable_fatal($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
+ }
+
+ $obj = mysqli_fetch_object($res);
+ if (($obj->ID !== "1") || ($obj->label !== "a") || (get_class($obj) != 'stdClass')) {
+ printf("[007] Object seems wrong. [%d] %s\n", $mysqli->errno, $mysqli->error);
+ var_dump($obj);
+ }
+
+ class mysqli_fetch_object_test {
+
+ public $a = null;
+ public $b = null;
+
+ public function toString() {
+ var_dump($this);
+ }
+ }
+
+ $obj = $res->fetch_object('mysqli_fetch_object_test');
+ if (($obj->ID !== "2") || ($obj->label !== "b") || ($obj->a !== NULL) || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_test')) {
+ printf("[008] Object seems wrong. [%d] %s\n", $mysqli->errno, $mysqli->error);
+ var_dump($obj);
+ }
+
+ class mysqli_fetch_object_construct extends mysqli_fetch_object_test {
+
+ public function __construct($a, $b) {
+ $this->a = $a;
+ $this->b = $b;
+ }
+
+ }
+
+ try {
+ $obj = $res->fetch_object('mysqli_fetch_object_construct', null);
+
+ if (($obj->ID !== "3") || ($obj->label !== "c") || ($obj->a !== NULL) || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_construct')) {
+ printf("[009] Object seems wrong. [%d] %s\n", $mysqli->errno, $mysqli->error);
+ var_dump($obj);
+ }
+ } catch (Error $e) {
+ handle_catchable_fatal($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
+ mysqli_fetch_object($res);
+ }
+
+ try {
+ $obj = $res->fetch_object('mysqli_fetch_object_construct', array('a'));
+ if (($obj->ID !== "4") || ($obj->label !== "d") || ($obj->a !== 'a') || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_construct')) {
+ printf("[010] Object seems wrong. [%d] %s\n", $mysqli->errno, $mysqli->error);
+ var_dump($obj);
+ }
+ } catch (Throwable $e) {
+ echo "Exception: " . $e->getMessage() . "\n";
+ }
+
+ $obj = $res->fetch_object('mysqli_fetch_object_construct', array('a', 'b'));
+ if (($obj->ID !== "5") || ($obj->label !== "e") || ($obj->a !== 'a') || ($obj->b !== 'b') || (get_class($obj) != 'mysqli_fetch_object_construct')) {
+ printf("[011] Object seems wrong. [%d] %s\n", $mysqli->errno, $mysqli->error);
+ var_dump($obj);
+ }
+
+ var_dump($res->fetch_object('mysqli_fetch_object_construct', array('a', 'b', 'c')));
+ var_dump(mysqli_fetch_object($res));
+
+ mysqli_free_result($res);
+
+ if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST")) {
+ printf("[012] [%d] %s\n", $mysqli->errno, $mysqli->error);
+ }
+
+ mysqli_free_result($res);
+
+ try {
+ mysqli_fetch_object($res);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ // Fatal error, script execution will end
+ var_dump($res->fetch_object('this_class_does_not_exist'));
+
+ $mysqli->close();
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
--EXPECTF--
-[E_WARNING] mysqli_result::__construct(): invalid object or resource mysql%s
-%s on line %d
-[E_WARNING] mysqli_result::fetch_object(): Couldn't fetch mysqli_result in %s on line %d
-[E_WARNING] mysqli_result::fetch_object() expects parameter 1 to be string, object given in %s on line %d
-[0] Argument 2 passed to mysqli_result::fetch_object() must be of the type array, object given in %s on line %d
-[0] Argument 2 passed to mysqli_result::fetch_object() must be of the type array, object given in %s on line %d
-[0] Argument 2 passed to mysqli_result::fetch_object() must be of the type array, null given in %s on line %d
+mysqli object is not fully initialized
+[0] mysqli_result::fetch_object() expects parameter 1 to be string, object given in %s on line %d
+[0] mysqli_result::fetch_object() expects at most 2 parameters, 3 given in %s on line %d
+[0] mysqli_result::fetch_object() expects parameter 2 to be array, null given in %s on line %d
Exception: Too few arguments to function mysqli_fetch_object_construct::__construct(), 1 passed and exactly 2 expected
NULL
NULL
-[E_WARNING] mysqli_fetch_object(): Couldn't fetch mysqli_result in %s on line %d
-bool(false)
+mysqli_result object is already closed
Fatal error: Class 'this_class_does_not_exist' not found in %s on line %d
diff --git a/ext/mysqli/tests/mysqli_fetch_row.phpt b/ext/mysqli/tests/mysqli_fetch_row.phpt
index 7ca1b9a132..ef52b5a48c 100644
--- a/ext/mysqli/tests/mysqli_fetch_row.phpt
+++ b/ext/mysqli/tests/mysqli_fetch_row.phpt
@@ -8,40 +8,35 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ require('table.inc');
+ if (!$res = mysqli_query($link, "SELECT id, label, id AS _id FROM test ORDER BY id LIMIT 1")) {
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- if (!is_null($tmp = @mysqli_fetch_row()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ print "[004]\n";
+ var_dump(mysqli_fetch_row($res));
- if (!is_null($tmp = @mysqli_fetch_row($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ print "[005]\n";
+ var_dump(mysqli_fetch_row($res));
- require('table.inc');
- if (!$res = mysqli_query($link, "SELECT id, label, id AS _id FROM test ORDER BY id LIMIT 1")) {
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ mysqli_free_result($res);
- print "[004]\n";
- var_dump(mysqli_fetch_row($res));
+ try {
+ mysqli_fetch_row($res);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- print "[005]\n";
- var_dump(mysqli_fetch_row($res));
-
- mysqli_free_result($res);
-
- var_dump(mysqli_fetch_row($res));
-
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
---EXPECTF--
+--EXPECT--
[004]
array(3) {
[0]=>
@@ -53,7 +48,5 @@ array(3) {
}
[005]
NULL
-
-Warning: mysqli_fetch_row(): Couldn't fetch mysqli_result in %s on line %d
-bool(false)
+mysqli_result object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_field_count.phpt b/ext/mysqli/tests/mysqli_field_count.phpt
index d6581c6699..fd2549ecb2 100644
--- a/ext/mysqli/tests/mysqli_field_count.phpt
+++ b/ext/mysqli/tests/mysqli_field_count.phpt
@@ -8,56 +8,48 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ require('table.inc');
- if (!is_null($tmp = @mysqli_field_count()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ var_dump(mysqli_field_count($link));
- if (!is_null($tmp = @mysqli_field_count($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 1")) {
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- require('table.inc');
+ var_dump(mysqli_field_count($link));
- var_dump(mysqli_field_count($link));
+ mysqli_free_result($res);
- if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id LIMIT 1")) {
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, 'x')"))
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ var_dump($link->field_count);
+ var_dump(mysqli_field_count($link));
- var_dump(mysqli_field_count($link));
+ if (!$res = mysqli_query($link, "SELECT NULL as _null, '' AS '', 'three' AS 'drei'"))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ var_dump(mysqli_field_count($link));
+ mysqli_free_result($res);
- mysqli_free_result($res);
+ mysqli_close($link);
- if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, 'x')"))
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump($link->field_count);
- var_dump(mysqli_field_count($link));
+ try {
+ mysqli_field_count($link);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- if (!$res = mysqli_query($link, "SELECT NULL as _null, '' AS '', 'three' AS 'drei'"))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump(mysqli_field_count($link));
- mysqli_free_result($res);
-
- mysqli_close($link);
-
- var_dump(mysqli_field_count($link));
-
- print "done!";
-?>
+ print "done!";
--CLEAN--
<?php
require_once("clean_table.inc");
?>
---EXPECTF--
+--EXPECT--
int(0)
int(2)
int(0)
int(0)
int(3)
-
-Warning: mysqli_field_count(): Couldn't fetch mysqli in %s on line %d
-bool(false)
+mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_field_seek.phpt b/ext/mysqli/tests/mysqli_field_seek.phpt
index c34cf3f647..9eb9f0315b 100644
--- a/ext/mysqli/tests/mysqli_field_seek.phpt
+++ b/ext/mysqli/tests/mysqli_field_seek.phpt
@@ -8,116 +8,107 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- function mysqli_field_seek_flags($flags) {
+ function mysqli_field_seek_flags($flags) {
- $ret = '';
+ $ret = '';
- if ($flags & MYSQLI_NOT_NULL_FLAG)
- $ret .= 'MYSQLI_NOT_NULL_FLAG ';
+ if ($flags & MYSQLI_NOT_NULL_FLAG)
+ $ret .= 'MYSQLI_NOT_NULL_FLAG ';
- if ($flags & MYSQLI_PRI_KEY_FLAG)
- $ret .= 'MYSQLI_PRI_KEY_FLAG ';
+ if ($flags & MYSQLI_PRI_KEY_FLAG)
+ $ret .= 'MYSQLI_PRI_KEY_FLAG ';
- if ($flags & MYSQLI_UNIQUE_KEY_FLAG)
- $ret .= 'MYSQLI_UNIQUE_KEY_FLAG ';
+ if ($flags & MYSQLI_UNIQUE_KEY_FLAG)
+ $ret .= 'MYSQLI_UNIQUE_KEY_FLAG ';
- if ($flags & MYSQLI_MULTIPLE_KEY_FLAG)
- $ret .= 'MYSQLI_MULTIPLE_KEY_FLAG ';
+ if ($flags & MYSQLI_MULTIPLE_KEY_FLAG)
+ $ret .= 'MYSQLI_MULTIPLE_KEY_FLAG ';
- if ($flags & MYSQLI_BLOB_FLAG)
- $ret .= 'MYSQLI_BLOB_FLAG ';
+ if ($flags & MYSQLI_BLOB_FLAG)
+ $ret .= 'MYSQLI_BLOB_FLAG ';
- if ($flags & MYSQLI_UNSIGNED_FLAG)
- $ret .= 'MYSQLI_UNSIGNED_FLAG ';
+ if ($flags & MYSQLI_UNSIGNED_FLAG)
+ $ret .= 'MYSQLI_UNSIGNED_FLAG ';
- if ($flags & MYSQLI_ZEROFILL_FLAG)
- $ret .= 'MYSQLI_ZEROFILL_FLAG ';
+ if ($flags & MYSQLI_ZEROFILL_FLAG)
+ $ret .= 'MYSQLI_ZEROFILL_FLAG ';
- if ($flags & MYSQLI_AUTO_INCREMENT_FLAG)
- $ret .= 'MYSQLI_AUTO_INCREMENT_FLAG ';
+ if ($flags & MYSQLI_AUTO_INCREMENT_FLAG)
+ $ret .= 'MYSQLI_AUTO_INCREMENT_FLAG ';
- if ($flags & MYSQLI_TIMESTAMP_FLAG)
- $ret .= 'MYSQLI_TIMESTAMP_FLAG ';
+ if ($flags & MYSQLI_TIMESTAMP_FLAG)
+ $ret .= 'MYSQLI_TIMESTAMP_FLAG ';
- if ($flags & MYSQLI_SET_FLAG)
- $ret .= 'MYSQLI_SET_FLAG ';
+ if ($flags & MYSQLI_SET_FLAG)
+ $ret .= 'MYSQLI_SET_FLAG ';
- if ($flags & MYSQLI_NUM_FLAG)
- $ret .= 'MYSQLI_NUM_FLAG ';
+ if ($flags & MYSQLI_NUM_FLAG)
+ $ret .= 'MYSQLI_NUM_FLAG ';
- if ($flags & MYSQLI_PART_KEY_FLAG)
- $ret .= 'MYSQLI_PART_KEY_FLAG ';
+ if ($flags & MYSQLI_PART_KEY_FLAG)
+ $ret .= 'MYSQLI_PART_KEY_FLAG ';
- if ($flags & MYSQLI_GROUP_FLAG)
- $ret .= 'MYSQLI_GROUP_FLAG ';
+ if ($flags & MYSQLI_GROUP_FLAG)
+ $ret .= 'MYSQLI_GROUP_FLAG ';
- return $ret;
- }
+ return $ret;
+ }
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ require('table.inc');
- if (!is_null($tmp = @mysqli_field_seek()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ // Make sure that client, connection and result charsets are all the
+ // same. Not sure whether this is strictly necessary.
+ if (!mysqli_set_charset($link, 'utf8'))
+ printf("[%d] %s\n", mysqli_errno($link), mysqli_errno($link));
- if (!is_null($tmp = @mysqli_field_seek($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ $charsetInfo = mysqli_get_charset($link);
- require('table.inc');
+ if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id LIMIT 1", MYSQLI_USE_RESULT)) {
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- // Make sure that client, connection and result charsets are all the
- // same. Not sure whether this is strictly necessary.
- if (!mysqli_set_charset($link, 'utf8'))
- printf("[%d] %s\n", mysqli_errno($link), mysqli_errno($link));
+ var_dump(mysqli_field_seek($res, -1));
+ var_dump(mysqli_fetch_field($res));
+ var_dump(mysqli_field_seek($res, 0));
+ var_dump(mysqli_fetch_field($res));
+ var_dump(mysqli_field_seek($res, 1));
- $charsetInfo = mysqli_get_charset($link);
+ $field = mysqli_fetch_field($res);
+ var_dump($field);
+ /* label column, result set charset */
+ if ($field->charsetnr != $charsetInfo->number) {
+ printf("[004] Expecting charset %s/%d got %d\n",
+ $charsetInfo->charset, $charsetInfo->number, $field->charsetnr);
+ }
+ if ($field->length != $charsetInfo->max_length) {
+ printf("[005] Expecting length %d got %d\n",
+ $charsetInfo->max_length, $field->max_length);
+ }
- if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id LIMIT 1", MYSQLI_USE_RESULT)) {
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ var_dump(mysqli_field_tell($res));
+ var_dump(mysqli_field_seek($res, 2));
+ var_dump(mysqli_fetch_field($res));
- var_dump(mysqli_field_seek($res, -1));
- var_dump(mysqli_fetch_field($res));
- var_dump(mysqli_field_seek($res, 0));
- var_dump(mysqli_fetch_field($res));
- var_dump(mysqli_field_seek($res, 1));
+ mysqli_free_result($res);
- $field = mysqli_fetch_field($res);
- var_dump($field);
- /* label column, result set charset */
- if ($field->charsetnr != $charsetInfo->number) {
- printf("[004] Expecting charset %s/%d got %d\n",
- $charsetInfo->charset, $charsetInfo->number, $field->charsetnr);
- }
- if ($field->length != $charsetInfo->max_length) {
- printf("[005] Expecting length %d got %d\n",
- $charsetInfo->max_length, $field->max_length);
- }
+ if (!$res = mysqli_query($link, "SELECT NULL as _null", MYSQLI_STORE_RESULT)) {
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ var_dump(mysqli_field_seek($res, 0));
+ var_dump(mysqli_fetch_field($res));
- var_dump(mysqli_field_tell($res));
- var_dump(mysqli_field_seek($res, 2));
- var_dump(mysqli_fetch_field($res));
- var_dump(mysqli_field_seek($res, PHP_INT_MAX + 1));
+ mysqli_free_result($res);
- if (!is_null($tmp = @mysqli_field_seek($res, 0, "too many")))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ try {
+ mysqli_field_seek($res, 0);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- mysqli_free_result($res);
-
- if (!$res = mysqli_query($link, "SELECT NULL as _null", MYSQLI_STORE_RESULT)) {
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- var_dump(mysqli_field_seek($res, 0));
- var_dump(mysqli_fetch_field($res));
-
- mysqli_free_result($res);
-
- var_dump(mysqli_field_seek($res, 0));
-
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
@@ -217,9 +208,6 @@ int(2)
Warning: mysqli_field_seek(): Invalid field offset in %s on line %d
bool(false)
bool(false)
-
-Warning: mysqli_field_seek() expects parameter 2 to be int, float given in %s on line %d
-NULL
bool(true)
object(stdClass)#%d (13) {
["name"]=>
@@ -249,7 +237,5 @@ object(stdClass)#%d (13) {
["decimals"]=>
int(0)
}
-
-Warning: mysqli_field_seek(): Couldn't fetch mysqli_result in %s on line %d
-bool(false)
+mysqli_result object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_field_tell.phpt b/ext/mysqli/tests/mysqli_field_tell.phpt
index 9885c1d9d8..bf169003aa 100644
--- a/ext/mysqli/tests/mysqli_field_tell.phpt
+++ b/ext/mysqli/tests/mysqli_field_tell.phpt
@@ -8,51 +8,41 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ require('table.inc');
+ if (!$res = mysqli_query($link, "SELECT id FROM test ORDER BY id LIMIT 1", MYSQLI_USE_RESULT)) {
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- if (!is_null($tmp = @mysqli_field_tell()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ var_dump(mysqli_field_tell($res));
+ var_dump(mysqli_field_tell($res));
+ var_dump(mysqli_fetch_field($res));
+ var_dump(mysqli_fetch_field($res));
+ var_dump(mysqli_field_tell($res));
- if (!is_null($tmp = @mysqli_field_tell($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ var_dump(mysqli_field_seek($res, 2));
+ var_dump(mysqli_field_tell($res));
- require('table.inc');
- if (!$res = mysqli_query($link, "SELECT id FROM test ORDER BY id LIMIT 1", MYSQLI_USE_RESULT)) {
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ var_dump(mysqli_field_seek($res, -1));
+ var_dump(mysqli_field_tell($res));
- var_dump(mysqli_field_tell($res));
- var_dump(mysqli_field_seek(1));
- var_dump(mysqli_field_tell($res));
- var_dump(mysqli_fetch_field($res));
- var_dump(mysqli_fetch_field($res));
- var_dump(mysqli_field_tell($res));
+ var_dump(mysqli_field_seek($res, 0));
+ var_dump(mysqli_field_tell($res));
- if (!is_null($tmp = @mysqli_field_tell($res, 'too many arguments')))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- var_dump(mysqli_field_seek($res, 2));
- var_dump(mysqli_field_tell($res));
+ mysqli_free_result($res);
- var_dump(mysqli_field_seek($res, -1));
- var_dump(mysqli_field_tell($res));
+ try {
+ mysqli_field_tell($res);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- var_dump(mysqli_field_seek($res, 0));
- var_dump(mysqli_field_tell($res));
+ mysqli_close($link);
-
-
- mysqli_free_result($res);
-
- var_dump(mysqli_field_tell($res));
-
- mysqli_close($link);
-
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
@@ -60,9 +50,6 @@ require_once('skipifconnectfailure.inc');
?>
--EXPECTF--
int(0)
-
-Warning: mysqli_field_seek() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
int(0)
object(stdClass)#%d (13) {
["name"]=>
@@ -104,7 +91,5 @@ bool(false)
int(1)
bool(true)
int(0)
-
-Warning: mysqli_field_tell(): Couldn't fetch mysqli_result in %s on line %d
-bool(false)
+mysqli_result object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_fork.phpt b/ext/mysqli/tests/mysqli_fork.phpt
index cc4c72f561..af9f8a1f24 100644
--- a/ext/mysqli/tests/mysqli_fork.phpt
+++ b/ext/mysqli/tests/mysqli_fork.phpt
@@ -21,206 +21,206 @@ if (!have_innodb($link))
?>
--FILE--
<?php
- require_once("table.inc");
-
- $res = mysqli_query($link, "SELECT 'dumped by the parent' AS message");
- $pid = pcntl_fork();
- switch ($pid) {
- case -1:
- printf("[001] Cannot fork child");
- break;
-
- case 0:
- /* child */
- exit(0);
- break;
-
- default:
- /* parent */
- $status = null;
- $wait_id = pcntl_waitpid($pid, $status);
- if (pcntl_wifexited($status) && (0 != ($tmp = pcntl_wexitstatus($status)))) {
- printf("Exit code: %s\n", (pcntl_wifexited($status)) ? pcntl_wexitstatus($status) : 'n/a');
- printf("Signal: %s\n", (pcntl_wifsignaled($status)) ? pcntl_wtermsig($status) : 'n/a');
- printf("Stopped: %d\n", (pcntl_wifstopped($status)) ? pcntl_wstopsig($status) : 'n/a');
- }
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
- break;
- }
-
- if (@mysqli_query($link, "SELECT id FROM test WHERE id = 1"))
- printf("[003] Expecting error and closed connection, child exit should have closed connection\n");
- else if ((($errno = mysqli_errno($link)) == 0) || ('' == ($error = mysqli_error($link))))
- printf("[004] Expecting error string and error code from MySQL, got errno = %s/%s, error = %s/%s\n",
- gettype($errno), $errno, gettype($error), $error);
-
- mysqli_close($link);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[005] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
-
- /* non trivial tests require a message list for parent-child communication */
- if (!mysqli_query($link, "DROP TABLE IF EXISTS messages"))
- printf("[006] [%d] %s\n", mysqli_error($link), mysqli_errno($link));
-
- if (!mysqli_query($link, "CREATE TABLE messages(
- msg_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
- msg_time TIMESTAMP,
- pid INT NOT NULL,
- sender ENUM('child', 'parent') NOT NULL,
- msg TEXT) ENGINE = InnoDB"))
- printf("[007] [%d] %s\n", mysqli_error($link), mysqli_errno($link));
-
- mysqli_autocommit($link, false);
- if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 3", MYSQLI_USE_RESULT))
- printf("[008] [%d] %s\n", mysqli_error($link), mysqli_errno($link));
-
- $pid = pcntl_fork();
-
- switch ($pid) {
- case -1:
- printf("[009] Cannot fork child");
- break;
-
- case 0:
- /* child */
- if (!($plink = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) || !mysqli_autocommit($plink, true))
- exit(mysqli_errno($plink));
-
- $sql = sprintf("INSERT INTO messages(pid, sender, msg) VALUES (%d, 'child', '%%s')", posix_getpid());
- if (!mysqli_query($plink, sprintf($sql, 'start')))
- exit(mysqli_errno($plink));
-
- $parent_sql = sprintf("SELECT msg_id, msg_time, msg FROM messages WHERE pid = %d AND sender = 'parent' ORDER BY msg_id DESC LIMIT 1", posix_getppid());
- $msg_id = 0;
- while ($row = mysqli_fetch_assoc($res)) {
- /* send row to parent */
- ob_start();
- var_dump($row);
- $tmp = ob_get_contents();
- ob_end_clean();
- if (!mysqli_query($plink, sprintf($sql, $tmp)))
- exit(mysqli_errno($plink));
-
- /* let the parent reply... */
- $start = time();
- do {
- usleep(100);
- if (!$pres = mysqli_query($plink, $parent_sql))
- continue;
- $tmp = mysqli_fetch_assoc($pres);
- mysqli_free_result($pres);
- if (!$tmp || $tmp['msg_id'] == $msg_id)
- /* no new message */
- continue;
- if ($tmp['msg'] == 'stop')
- break 2;
- $msg_id = $tmp['msg_id'];
- break;
- } while ((time() - $start) < 5);
-
- }
-
- if (!mysqli_query($plink, sprintf($sql, 'stop')) || !mysqli_commit($link))
- exit(mysqli_errno($plink));
- exit(0);
- break;
-
- default:
- /* parent */
- if (!$plink = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[010] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
-
- $status = null;
- $start = time();
- $sql = sprintf("SELECT msg_id, msg_time, msg FROM messages WHERE pid = %d AND sender = 'child' ORDER BY msg_id DESC LIMIT 1", $pid);
- $parent_sql = sprintf("INSERT INTO messages (pid, sender, msg) VALUES (%d, 'parent', '%%s')", posix_getpid());
- $last_msg_id = 0;
- $num_rows = 0;
- do {
- $wait_id = pcntl_waitpid($pid, $status, WNOHANG);
- if ($pres = mysqli_query($plink, $sql)) {
- $row = mysqli_fetch_assoc($pres);
- if ($row && $row['msg_id'] != $last_msg_id) {
- $last_msg_id = $row['msg_id'];
- switch ($row['msg']) {
- case 'start':
- break;
- case 'stop':
- break 2;
- default:
- /* client has started fetching rows */
- $client_row = $row['msg'];
-
- $num_rows++;
- if ($num_rows > 3) {
- printf("[011] Child has fetched more than three rows!\n");
- var_dump($client_row);
- if (!mysqli_query($plink, sprintf($parent_sql, 'stop'))) {
- printf("[012] Parent cannot inform child\n", mysqli_errno($plink), mysqli_error($plink));
- }
- break 2;
- }
-
- if (!$parent_row = mysqli_fetch_assoc($res)) {
- printf("[013] Parent cannot fetch row %d\n", $num_rows, mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($plink, sprintf($parent_sql, 'stop'))) {
- printf("[014] Parent cannot inform child\n", mysqli_errno($plink), mysqli_error($plink));
- }
- break 2;
- }
-
- ob_start();
- var_dump($parent_row);
- $parent_row = ob_get_contents();
- ob_end_clean();
-
- if ($parent_row != $client_row) {
- printf("[015] Child indicates different results than parent.\n");
- var_dump($client_row);
- var_dump($parent_row);
- if (!mysqli_query($plink, sprintf($parent_sql, 'stop'))) {
- printf("[016] Parent cannot inform child\n", mysqli_errno($plink), mysqli_error($plink));
- }
- break 2;
- }
-
- if (!mysqli_query($plink, sprintf($parent_sql, 'continue'))) {
- printf("[017] Parent cannot inform child to continue.\n", mysqli_errno($plink), mysqli_error($plink));
- }
- break;
- }
- }
- mysqli_free_result($pres);
- }
- usleep(100);
- } while (((time() - $start) < 5) && ($num_rows < 3));
- mysqli_close($plink);
- $wait_id = pcntl_waitpid($pid, $status);
- if (pcntl_wifexited($status) && (0 != ($tmp = pcntl_wexitstatus($status)))) {
- printf("Exit code: %s\n", (pcntl_wifexited($status)) ? pcntl_wexitstatus($status) : 'n/a');
- printf("Signal: %s\n", (pcntl_wifsignaled($status)) ? pcntl_wtermsig($status) : 'n/a');
- printf("Stopped: %d\n", (pcntl_wifstopped($status)) ? pcntl_wstopsig($status) : 'n/a');
- }
- break;
- }
- mysqli_free_result($res);
- mysqli_close($link);
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[018] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
-
- if (!$res = mysqli_query($link, "SELECT sender, msg FROM messages ORDER BY msg_id ASC"))
- printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- while ($row = mysqli_fetch_assoc($res))
- printf("%10s %s\n", $row['sender'], substr($row['msg'], 0, 5));
- mysqli_free_result($res);
-
- print "done!";
+ require_once("table.inc");
+
+ $res = mysqli_query($link, "SELECT 'dumped by the parent' AS message");
+ $pid = pcntl_fork();
+ switch ($pid) {
+ case -1:
+ printf("[001] Cannot fork child");
+ break;
+
+ case 0:
+ /* child */
+ exit(0);
+ break;
+
+ default:
+ /* parent */
+ $status = null;
+ $wait_id = pcntl_waitpid($pid, $status);
+ if (pcntl_wifexited($status) && (0 != ($tmp = pcntl_wexitstatus($status)))) {
+ printf("Exit code: %s\n", (pcntl_wifexited($status)) ? pcntl_wexitstatus($status) : 'n/a');
+ printf("Signal: %s\n", (pcntl_wifsignaled($status)) ? pcntl_wtermsig($status) : 'n/a');
+ printf("Stopped: %d\n", (pcntl_wifstopped($status)) ? pcntl_wstopsig($status) : 'n/a');
+ }
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
+ break;
+ }
+
+ if (@mysqli_query($link, "SELECT id FROM test WHERE id = 1"))
+ printf("[003] Expecting error and closed connection, child exit should have closed connection\n");
+ else if ((($errno = mysqli_errno($link)) == 0) || ('' == ($error = mysqli_error($link))))
+ printf("[004] Expecting error string and error code from MySQL, got errno = %s/%s, error = %s/%s\n",
+ gettype($errno), $errno, gettype($error), $error);
+
+ mysqli_close($link);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[005] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+
+ /* non trivial tests require a message list for parent-child communication */
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS messages"))
+ printf("[006] [%d] %s\n", mysqli_error($link), mysqli_errno($link));
+
+ if (!mysqli_query($link, "CREATE TABLE messages(
+ msg_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ msg_time TIMESTAMP,
+ pid INT NOT NULL,
+ sender ENUM('child', 'parent') NOT NULL,
+ msg TEXT) ENGINE = InnoDB"))
+ printf("[007] [%d] %s\n", mysqli_error($link), mysqli_errno($link));
+
+ mysqli_autocommit($link, false);
+ if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 3", MYSQLI_USE_RESULT))
+ printf("[008] [%d] %s\n", mysqli_error($link), mysqli_errno($link));
+
+ $pid = pcntl_fork();
+
+ switch ($pid) {
+ case -1:
+ printf("[009] Cannot fork child");
+ break;
+
+ case 0:
+ /* child */
+ if (!($plink = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) || !mysqli_autocommit($plink, true))
+ exit(mysqli_errno($plink));
+
+ $sql = sprintf("INSERT INTO messages(pid, sender, msg) VALUES (%d, 'child', '%%s')", posix_getpid());
+ if (!mysqli_query($plink, sprintf($sql, 'start')))
+ exit(mysqli_errno($plink));
+
+ $parent_sql = sprintf("SELECT msg_id, msg_time, msg FROM messages WHERE pid = %d AND sender = 'parent' ORDER BY msg_id DESC LIMIT 1", posix_getppid());
+ $msg_id = 0;
+ while ($row = mysqli_fetch_assoc($res)) {
+ /* send row to parent */
+ ob_start();
+ var_dump($row);
+ $tmp = ob_get_contents();
+ ob_end_clean();
+ if (!mysqli_query($plink, sprintf($sql, $tmp)))
+ exit(mysqli_errno($plink));
+
+ /* let the parent reply... */
+ $start = time();
+ do {
+ usleep(100);
+ if (!$pres = mysqli_query($plink, $parent_sql))
+ continue;
+ $tmp = mysqli_fetch_assoc($pres);
+ mysqli_free_result($pres);
+ if (!$tmp || $tmp['msg_id'] == $msg_id)
+ /* no new message */
+ continue;
+ if ($tmp['msg'] == 'stop')
+ break 2;
+ $msg_id = $tmp['msg_id'];
+ break;
+ } while ((time() - $start) < 5);
+
+ }
+
+ if (!mysqli_query($plink, sprintf($sql, 'stop')) || !mysqli_commit($link))
+ exit(mysqli_errno($plink));
+ exit(0);
+ break;
+
+ default:
+ /* parent */
+ if (!$plink = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[010] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+
+ $status = null;
+ $start = time();
+ $sql = sprintf("SELECT msg_id, msg_time, msg FROM messages WHERE pid = %d AND sender = 'child' ORDER BY msg_id DESC LIMIT 1", $pid);
+ $parent_sql = sprintf("INSERT INTO messages (pid, sender, msg) VALUES (%d, 'parent', '%%s')", posix_getpid());
+ $last_msg_id = 0;
+ $num_rows = 0;
+ do {
+ $wait_id = pcntl_waitpid($pid, $status, WNOHANG);
+ if ($pres = mysqli_query($plink, $sql)) {
+ $row = mysqli_fetch_assoc($pres);
+ if ($row && $row['msg_id'] != $last_msg_id) {
+ $last_msg_id = $row['msg_id'];
+ switch ($row['msg']) {
+ case 'start':
+ break;
+ case 'stop':
+ break 2;
+ default:
+ /* client has started fetching rows */
+ $client_row = $row['msg'];
+
+ $num_rows++;
+ if ($num_rows > 3) {
+ printf("[011] Child has fetched more than three rows!\n");
+ var_dump($client_row);
+ if (!mysqli_query($plink, sprintf($parent_sql, 'stop'))) {
+ printf("[012] Parent cannot inform child\n", mysqli_errno($plink), mysqli_error($plink));
+ }
+ break 2;
+ }
+
+ if (!$parent_row = mysqli_fetch_assoc($res)) {
+ printf("[013] Parent cannot fetch row %d\n", $num_rows, mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($plink, sprintf($parent_sql, 'stop'))) {
+ printf("[014] Parent cannot inform child\n", mysqli_errno($plink), mysqli_error($plink));
+ }
+ break 2;
+ }
+
+ ob_start();
+ var_dump($parent_row);
+ $parent_row = ob_get_contents();
+ ob_end_clean();
+
+ if ($parent_row != $client_row) {
+ printf("[015] Child indicates different results than parent.\n");
+ var_dump($client_row);
+ var_dump($parent_row);
+ if (!mysqli_query($plink, sprintf($parent_sql, 'stop'))) {
+ printf("[016] Parent cannot inform child\n", mysqli_errno($plink), mysqli_error($plink));
+ }
+ break 2;
+ }
+
+ if (!mysqli_query($plink, sprintf($parent_sql, 'continue'))) {
+ printf("[017] Parent cannot inform child to continue.\n", mysqli_errno($plink), mysqli_error($plink));
+ }
+ break;
+ }
+ }
+ mysqli_free_result($pres);
+ }
+ usleep(100);
+ } while (((time() - $start) < 5) && ($num_rows < 3));
+ mysqli_close($plink);
+ $wait_id = pcntl_waitpid($pid, $status);
+ if (pcntl_wifexited($status) && (0 != ($tmp = pcntl_wexitstatus($status)))) {
+ printf("Exit code: %s\n", (pcntl_wifexited($status)) ? pcntl_wexitstatus($status) : 'n/a');
+ printf("Signal: %s\n", (pcntl_wifsignaled($status)) ? pcntl_wtermsig($status) : 'n/a');
+ printf("Stopped: %d\n", (pcntl_wifstopped($status)) ? pcntl_wstopsig($status) : 'n/a');
+ }
+ break;
+ }
+ mysqli_free_result($res);
+ mysqli_close($link);
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[018] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+
+ if (!$res = mysqli_query($link, "SELECT sender, msg FROM messages ORDER BY msg_id ASC"))
+ printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ while ($row = mysqli_fetch_assoc($res))
+ printf("%10s %s\n", $row['sender'], substr($row['msg'], 0, 5));
+ mysqli_free_result($res);
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_free_result.phpt b/ext/mysqli/tests/mysqli_free_result.phpt
index 6cd7778319..f562573733 100644
--- a/ext/mysqli/tests/mysqli_free_result.phpt
+++ b/ext/mysqli/tests/mysqli_free_result.phpt
@@ -8,47 +8,45 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ require('table.inc');
+ if (!$res = mysqli_query($link, "SELECT id FROM test ORDER BY id LIMIT 1")) {
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- if (!is_null($tmp = @mysqli_free_result()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ print "a\n";
+ var_dump(mysqli_free_result($res));
- if (!is_null($tmp = @mysqli_free_result($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ print "b\n";
+ try {
+ mysqli_free_result($res);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- require('table.inc');
- if (!$res = mysqli_query($link, "SELECT id FROM test ORDER BY id LIMIT 1")) {
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ if (!$res = mysqli_query($link, "SELECT id FROM test ORDER BY id LIMIT 1")) {
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- print "a\n";
- var_dump(mysqli_free_result($res));
- print "b\n";
- var_dump(mysqli_free_result($res));
+ print "c\n";
+ var_dump(mysqli_store_result($link));
+ var_dump(mysqli_error($link));
+ print "[005]\n";
- if (!$res = mysqli_query($link, "SELECT id FROM test ORDER BY id LIMIT 1")) {
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- print "c\n";
- var_dump($res = mysqli_store_result($link));
- var_dump(mysqli_error($link));
- print "[005]\n";
- var_dump(mysqli_free_result($res));
+ mysqli_free_result($res);
- if (!$res = mysqli_query($link, "SELECT id FROM test ORDER BY id LIMIT 1")) {
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- print "d\n";
- var_dump($res = mysqli_use_result($link));
- var_dump(mysqli_error($link));
- print "[007]\n";
- var_dump(mysqli_free_result($res));
+ if (!$res = mysqli_query($link, "SELECT id FROM test ORDER BY id LIMIT 1")) {
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ print "d\n";
+ var_dump(mysqli_use_result($link));
+ var_dump(mysqli_error($link));
+ print "[007]\n";
+ var_dump(mysqli_free_result($res));
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
@@ -58,21 +56,14 @@ require_once('skipifconnectfailure.inc');
a
NULL
b
-
-Warning: mysqli_free_result(): Couldn't fetch mysqli_result in %s on line %d
-bool(false)
+mysqli_result object is already closed
c
bool(false)
-%s(0) ""
+string(0) ""
[005]
-
-Warning: mysqli_free_result() expects parameter 1 to be mysqli_result, bool given in %s on line %d
-NULL
d
bool(false)
-%s(0) ""
+string(0) ""
[007]
-
-Warning: mysqli_free_result() expects parameter 1 to be mysqli_result, bool given in %s on line %d
NULL
done!
diff --git a/ext/mysqli/tests/mysqli_get_charset.phpt b/ext/mysqli/tests/mysqli_get_charset.phpt
index 537809dd70..4c253ec551 100644
--- a/ext/mysqli/tests/mysqli_get_charset.phpt
+++ b/ext/mysqli/tests/mysqli_get_charset.phpt
@@ -10,106 +10,97 @@ if (!function_exists('mysqli_get_charset'))
?>
--FILE--
<?php
- require_once("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_get_charset()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_get_charset($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_set_charset($link, $link)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- require('table.inc');
-
- if (!$res = mysqli_query($link, 'SELECT version() AS server_version'))
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- $version = explode('.', $tmp['server_version']);
- if (empty($version))
- printf("[005] Cannot determine server version, need MySQL Server 4.1+ for the test!\n");
-
- if ($version[0] <= 4 && $version[1] < 1)
- printf("[006] Need MySQL Server 4.1+ for the test!\n");
-
- if (!$res = mysqli_query($link, 'SELECT @@character_set_connection AS charset, @@collation_connection AS collation'))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- if (!($character_set_connection = $tmp['charset']) || !($collation_connection = $tmp['collation']))
- printf("[008] Cannot determine current character set and collation\n");
-
- if (!$res = mysqli_query($link, $sql = sprintf("SHOW CHARACTER SET LIKE '%s'", $character_set_connection)))
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- if (empty($tmp))
- printf("[010] Cannot fetch Maxlen and/or Comment, test will fail: $sql\n");
-
- $maxlen = (isset($tmp['Maxlen'])) ? $tmp['Maxlen'] : '';
- $comment = (isset($tmp['Description'])) ? $tmp['Description'] : '';
-
- if (!$res = mysqli_query($link, sprintf("SHOW COLLATION LIKE '%s'", $collation_connection)))
- printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- if (!($id = $tmp['Id']))
- printf("[012] Cannot fetch Id/Number, test will fail\n");
-
- if (!$res = mysqli_query($link, sprintf("SHOW VARIABLES LIKE 'character_sets_dir'")))
- printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- if (!($character_sets_dir = $tmp['Value']))
- printf("[014] Cannot fetch character_sets_dir, test will fail\n");
-
- if (!is_object($charset = mysqli_get_charset($link)))
- printf("[015] Expecting object/std_class, got %s/%s\n", gettype($charset), $charset);
-
- if (!isset($charset->charset) ||
- !in_array(gettype($charset->charset), array("string", "unicode")) ||
- ($character_set_connection !== $charset->charset))
- printf("[016] Expecting string/%s, got %s/%s\n", $character_set_connection, gettype($charset->charset), $charset->charset);
- if (!isset($charset->collation) ||
- !in_array(gettype($charset->collation), array("string", "unicode")) ||
- ($collation_connection !== $charset->collation))
- printf("[017] Expecting string/%s, got %s/%s\n", $collation_connection, gettype($charset->collation), $charset->collation);
-
- if (!isset($charset->dir) ||
- !is_string($charset->dir))
- printf("[019] Expecting string - ideally %s*, got %s/%s\n", $character_sets_dir, gettype($charset->dir), $charset->dir);
-
- if (!isset($charset->min_length) ||
- !(is_int($charset->min_length)) ||
- ($charset->min_length < 0) ||
- ($charset->min_length > $charset->max_length))
- printf("[020] Expecting int between 0 ... %d, got %s/%s\n", $charset->max_length,
- gettype($charset->min_length), $charset->min_length);
-
- if (!isset($charset->number) ||
- !is_int($charset->number) ||
- ($charset->number !== (int)$id))
- printf("[021] Expecting int/%d, got %s/%s\n", $id, gettype($charset->number), $charset->number);
-
- if (!isset($charset->state) ||
- !is_int($charset->state))
- printf("[022] Expecting int/any, got %s/%s\n", gettype($charset->state), $charset->state);
-
- mysqli_close($link);
-
- if (false !== ($tmp = mysqli_get_charset($link)))
- printf("[023] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!";
+ require_once("connect.inc");
+
+ require('table.inc');
+
+ if (!$res = mysqli_query($link, 'SELECT version() AS server_version'))
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ $version = explode('.', $tmp['server_version']);
+ if (empty($version))
+ printf("[005] Cannot determine server version, need MySQL Server 4.1+ for the test!\n");
+
+ if ($version[0] <= 4 && $version[1] < 1)
+ printf("[006] Need MySQL Server 4.1+ for the test!\n");
+
+ if (!$res = mysqli_query($link, 'SELECT @@character_set_connection AS charset, @@collation_connection AS collation'))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ if (!($character_set_connection = $tmp['charset']) || !($collation_connection = $tmp['collation']))
+ printf("[008] Cannot determine current character set and collation\n");
+
+ if (!$res = mysqli_query($link, $sql = sprintf("SHOW CHARACTER SET LIKE '%s'", $character_set_connection)))
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ if (empty($tmp))
+ printf("[010] Cannot fetch Maxlen and/or Comment, test will fail: $sql\n");
+
+ $maxlen = (isset($tmp['Maxlen'])) ? $tmp['Maxlen'] : '';
+ $comment = (isset($tmp['Description'])) ? $tmp['Description'] : '';
+
+ if (!$res = mysqli_query($link, sprintf("SHOW COLLATION LIKE '%s'", $collation_connection)))
+ printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ if (!($id = $tmp['Id']))
+ printf("[012] Cannot fetch Id/Number, test will fail\n");
+
+ if (!$res = mysqli_query($link, sprintf("SHOW VARIABLES LIKE 'character_sets_dir'")))
+ printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ if (!($character_sets_dir = $tmp['Value']))
+ printf("[014] Cannot fetch character_sets_dir, test will fail\n");
+
+ if (!is_object($charset = mysqli_get_charset($link)))
+ printf("[015] Expecting object/std_class, got %s/%s\n", gettype($charset), $charset);
+
+ if (!isset($charset->charset) ||
+ !in_array(gettype($charset->charset), array("string", "unicode")) ||
+ ($character_set_connection !== $charset->charset))
+ printf("[016] Expecting string/%s, got %s/%s\n", $character_set_connection, gettype($charset->charset), $charset->charset);
+ if (!isset($charset->collation) ||
+ !in_array(gettype($charset->collation), array("string", "unicode")) ||
+ ($collation_connection !== $charset->collation))
+ printf("[017] Expecting string/%s, got %s/%s\n", $collation_connection, gettype($charset->collation), $charset->collation);
+
+ if (!isset($charset->dir) ||
+ !is_string($charset->dir))
+ printf("[019] Expecting string - ideally %s*, got %s/%s\n", $character_sets_dir, gettype($charset->dir), $charset->dir);
+
+ if (!isset($charset->min_length) ||
+ !(is_int($charset->min_length)) ||
+ ($charset->min_length < 0) ||
+ ($charset->min_length > $charset->max_length))
+ printf("[020] Expecting int between 0 ... %d, got %s/%s\n", $charset->max_length,
+ gettype($charset->min_length), $charset->min_length);
+
+ if (!isset($charset->number) ||
+ !is_int($charset->number) ||
+ ($charset->number !== (int)$id))
+ printf("[021] Expecting int/%d, got %s/%s\n", $id, gettype($charset->number), $charset->number);
+
+ if (!isset($charset->state) ||
+ !is_int($charset->state))
+ printf("[022] Expecting int/any, got %s/%s\n", gettype($charset->state), $charset->state);
+
+ mysqli_close($link);
+
+ try {
+ mysqli_get_charset($link);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
---EXPECTF--
-Warning: mysqli_get_charset(): Couldn't fetch mysqli in %s on line %d
+--EXPECT--
+mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_get_client_info.phpt b/ext/mysqli/tests/mysqli_get_client_info.phpt
index 0e8642d35d..41b0870b37 100644
--- a/ext/mysqli/tests/mysqli_get_client_info.phpt
+++ b/ext/mysqli/tests/mysqli_get_client_info.phpt
@@ -8,11 +8,11 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
- if (!is_string($info = mysqli_get_client_info()) || ('' === $info))
- printf("[001] Expecting string/any_non_empty, got %s/%s\n", gettype($info), $info);
+ require_once("connect.inc");
+ if (!is_string($info = mysqli_get_client_info()) || ('' === $info))
+ printf("[001] Expecting string/any_non_empty, got %s/%s\n", gettype($info), $info);
- print "done!";
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_get_client_stats.phpt b/ext/mysqli/tests/mysqli_get_client_stats.phpt
index f7de44b1db..49fd7470d6 100644
--- a/ext/mysqli/tests/mysqli_get_client_stats.phpt
+++ b/ext/mysqli/tests/mysqli_get_client_stats.phpt
@@ -15,909 +15,905 @@ mysqlnd.collect_memory_statistics=1
mysqli.allow_local_infile=1
--FILE--
<?php
- /*
- TODO
- no_index_used - difficult to simulate because server/engine dependent
- bad_index_used - difficult to simulate because server/engine dependent
- flushed_normal_sets
- flushed_ps_sets
- explicit_close
- implicit_close
- disconnect_close
- in_middle_of_command_close
- explicit_free_result
- implicit_free_result
- explicit_stmt_close
- implicit_stmt_close
- */
-
- function mysqli_get_client_stats_assert_eq($field, $current, $expected, &$test_counter, $desc = "") {
-
- $test_counter++;
- if (is_array($current) && is_array($expected)) {
- if ($current[$field] !== $expected[$field]) {
- printf("[%03d] %s Expecting %s = %s/%s, got %s/%s\n",
- $test_counter, $desc,
- $field, $expected[$field], gettype($expected[$field]),
- $current[$field], gettype($current[$field]));
- }
- } else if (is_array($current)) {
- if ($current[$field] !== $expected) {
- printf("[%03d] %s Expecting %s = %s/%s, got %s/%s\n",
- $test_counter, $desc,
- $field, $expected, gettype($expected),
- $current[$field], gettype($current[$field]));
- }
- } else {
- if ($current !== $expected) {
- printf("[%03d] %s Expecting %s = %s/%s, got %s/%s\n",
- $test_counter, $desc,
- $field, $expected, gettype($expected),
- $current, gettype($current));
- }
- }
-
- }
-
- function mysqli_get_client_stats_assert_gt($field, $current, $expected, &$test_counter, $desc = "") {
-
- $test_counter++;
- if (is_array($current) && is_array($expected)) {
- if ($current[$field] <= $expected[$field]) {
- printf("[%03d] %s Expecting %s > %s/%s, got %s/%s\n",
- $test_counter, $desc,
- $field, $expected[$field], gettype($expected[$field]),
- $current[$field], gettype($current[$field]));
- }
- } else {
- if ($current <= $expected) {
- printf("[%03d] %s Expecting %s > %s/%s, got %s/%s\n",
- $test_counter, $desc, $field,
- $expected, gettype($expected),
- $current, gettype($current));
- }
- }
-
- }
-
-
- $tmp = $link = null;
- if (!is_null($tmp = @mysqli_get_client_stats($link)))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- require_once("connect.inc");
-
- if (!is_array($info = mysqli_get_client_stats()) || empty($info))
- printf("[002] Expecting array/any_non_empty, got %s/%s\n", gettype($info), $info);
-
- var_dump($info);
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- exit(1);
- }
-
- if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
- printf("[004] Expecting array/any_non_empty, got %s/%s\n", gettype($new_info), $new_info);
-
- if (count($info) != count($new_info)) {
- printf("[005] Expecting the same number of entries in the arrays\n");
- var_dump($info);
- var_dump($new_info);
- }
-
- $test_counter = 6;
-
- mysqli_get_client_stats_assert_gt('bytes_sent', $new_info, $info, $test_counter);
- mysqli_get_client_stats_assert_gt('bytes_received', $new_info, $info, $test_counter);
- mysqli_get_client_stats_assert_gt('packets_sent', $new_info, $info, $test_counter);
- mysqli_get_client_stats_assert_gt('packets_received', $new_info, $info, $test_counter);
- mysqli_get_client_stats_assert_gt('protocol_overhead_in', $new_info, $info, $test_counter);
- mysqli_get_client_stats_assert_gt('protocol_overhead_out', $new_info, $info, $test_counter);
-
- // we assume the above as tested and in the following we check only those
- mysqli_get_client_stats_assert_eq('result_set_queries', $new_info, $info, $test_counter);
-
- /* we need to skip this test in unicode - we send set names utf8 during mysql_connect */
- mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, $info, $test_counter);
- mysqli_get_client_stats_assert_eq('buffered_sets', $new_info, $info, $test_counter);
- mysqli_get_client_stats_assert_eq('unbuffered_sets', $new_info, $info, $test_counter);
- mysqli_get_client_stats_assert_eq('ps_buffered_sets', $new_info, $info, $test_counter);
- mysqli_get_client_stats_assert_eq('ps_unbuffered_sets', $new_info, $info, $test_counter);
-
- mysqli_get_client_stats_assert_eq('rows_skipped_ps', $new_info, $info, $test_counter);
- mysqli_get_client_stats_assert_eq('copy_on_write_saved', $new_info, $info, $test_counter);
- mysqli_get_client_stats_assert_eq('copy_on_write_performed', $new_info, $info, $test_counter);
- mysqli_get_client_stats_assert_eq('command_buffer_too_small', $new_info, $info, $test_counter);
- // This is not a mistake that I use string(1) "1" here! Andrey did not go for int to avoid any
- // issues for very large numbers and 32 vs. 64bit systems
- mysqli_get_client_stats_assert_eq('connect_success', $new_info, "1", $test_counter);
- mysqli_get_client_stats_assert_eq('connect_failure', $new_info, $info, $test_counter);
- mysqli_get_client_stats_assert_eq('connection_reused', $new_info, $info, $test_counter);
-
- // No data fetched so far
- mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $new_info, "0", $test_counter);
- mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $new_info, "0", $test_counter);
-
- require('table.inc');
- if (!is_array($info = mysqli_get_client_stats()) || empty($info))
- printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
- ++$test_counter, gettype($info), $info);
-
- // fetch stats
- $expected = $info;
-
- // buffered normal
- print "Testing buffered normal...\n";
- if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS _num FROM test', MYSQLI_STORE_RESULT))
- printf("[%03d] SELECT COUNT() FROM test failed, [%d] %s\n",
- ++$test_counter, mysqli_errno($link), mysqli_error($link));
-
- $expected['rows_fetched_from_server_normal'] = (string)($expected['rows_fetched_from_server_normal'] + 1);
- $expected['buffered_sets'] = (string)($expected['buffered_sets'] + 1);
- $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1);
- $expected['rows_buffered_from_client_normal'] = (string)($expected['rows_buffered_from_client_normal'] + 1);
-
- if (!is_array($info = mysqli_get_client_stats()) || empty($info))
- printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
- ++$test_counter, gettype($info), $info);
-
- mysqli_get_client_stats_assert_gt('bytes_sent', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_gt('bytes_received', $info, $expected, $test_counter);
-
- // real_data_* get incremented after mysqli_*fetch*()
+ /*
+ TODO
+ no_index_used - difficult to simulate because server/engine dependent
+ bad_index_used - difficult to simulate because server/engine dependent
+ flushed_normal_sets
+ flushed_ps_sets
+ explicit_close
+ implicit_close
+ disconnect_close
+ in_middle_of_command_close
+ explicit_free_result
+ implicit_free_result
+ explicit_stmt_close
+ implicit_stmt_close
+ */
+
+ function mysqli_get_client_stats_assert_eq($field, $current, $expected, &$test_counter, $desc = "") {
+
+ $test_counter++;
+ if (is_array($current) && is_array($expected)) {
+ if ($current[$field] !== $expected[$field]) {
+ printf("[%03d] %s Expecting %s = %s/%s, got %s/%s\n",
+ $test_counter, $desc,
+ $field, $expected[$field], gettype($expected[$field]),
+ $current[$field], gettype($current[$field]));
+ }
+ } else if (is_array($current)) {
+ if ($current[$field] !== $expected) {
+ printf("[%03d] %s Expecting %s = %s/%s, got %s/%s\n",
+ $test_counter, $desc,
+ $field, $expected, gettype($expected),
+ $current[$field], gettype($current[$field]));
+ }
+ } else {
+ if ($current !== $expected) {
+ printf("[%03d] %s Expecting %s = %s/%s, got %s/%s\n",
+ $test_counter, $desc,
+ $field, $expected, gettype($expected),
+ $current, gettype($current));
+ }
+ }
+
+ }
+
+ function mysqli_get_client_stats_assert_gt($field, $current, $expected, &$test_counter, $desc = "") {
+
+ $test_counter++;
+ if (is_array($current) && is_array($expected)) {
+ if ($current[$field] <= $expected[$field]) {
+ printf("[%03d] %s Expecting %s > %s/%s, got %s/%s\n",
+ $test_counter, $desc,
+ $field, $expected[$field], gettype($expected[$field]),
+ $current[$field], gettype($current[$field]));
+ }
+ } else {
+ if ($current <= $expected) {
+ printf("[%03d] %s Expecting %s > %s/%s, got %s/%s\n",
+ $test_counter, $desc, $field,
+ $expected, gettype($expected),
+ $current, gettype($current));
+ }
+ }
+
+ }
+
+
+ require_once("connect.inc");
+
+ if (!is_array($info = mysqli_get_client_stats()) || empty($info))
+ printf("[002] Expecting array/any_non_empty, got %s/%s\n", gettype($info), $info);
+
+ var_dump($info);
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ exit(1);
+ }
+
+ if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+ printf("[004] Expecting array/any_non_empty, got %s/%s\n", gettype($new_info), $new_info);
+
+ if (count($info) != count($new_info)) {
+ printf("[005] Expecting the same number of entries in the arrays\n");
+ var_dump($info);
+ var_dump($new_info);
+ }
+
+ $test_counter = 6;
+
+ mysqli_get_client_stats_assert_gt('bytes_sent', $new_info, $info, $test_counter);
+ mysqli_get_client_stats_assert_gt('bytes_received', $new_info, $info, $test_counter);
+ mysqli_get_client_stats_assert_gt('packets_sent', $new_info, $info, $test_counter);
+ mysqli_get_client_stats_assert_gt('packets_received', $new_info, $info, $test_counter);
+ mysqli_get_client_stats_assert_gt('protocol_overhead_in', $new_info, $info, $test_counter);
+ mysqli_get_client_stats_assert_gt('protocol_overhead_out', $new_info, $info, $test_counter);
+
+ // we assume the above as tested and in the following we check only those
+ mysqli_get_client_stats_assert_eq('result_set_queries', $new_info, $info, $test_counter);
+
+ /* we need to skip this test in unicode - we send set names utf8 during mysql_connect */
+ mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, $info, $test_counter);
+ mysqli_get_client_stats_assert_eq('buffered_sets', $new_info, $info, $test_counter);
+ mysqli_get_client_stats_assert_eq('unbuffered_sets', $new_info, $info, $test_counter);
+ mysqli_get_client_stats_assert_eq('ps_buffered_sets', $new_info, $info, $test_counter);
+ mysqli_get_client_stats_assert_eq('ps_unbuffered_sets', $new_info, $info, $test_counter);
+
+ mysqli_get_client_stats_assert_eq('rows_skipped_ps', $new_info, $info, $test_counter);
+ mysqli_get_client_stats_assert_eq('copy_on_write_saved', $new_info, $info, $test_counter);
+ mysqli_get_client_stats_assert_eq('copy_on_write_performed', $new_info, $info, $test_counter);
+ mysqli_get_client_stats_assert_eq('command_buffer_too_small', $new_info, $info, $test_counter);
+ // This is not a mistake that I use string(1) "1" here! Andrey did not go for int to avoid any
+ // issues for very large numbers and 32 vs. 64bit systems
+ mysqli_get_client_stats_assert_eq('connect_success', $new_info, "1", $test_counter);
+ mysqli_get_client_stats_assert_eq('connect_failure', $new_info, $info, $test_counter);
+ mysqli_get_client_stats_assert_eq('connection_reused', $new_info, $info, $test_counter);
+
+ // No data fetched so far
+ mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $new_info, "0", $test_counter);
+ mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $new_info, "0", $test_counter);
+
+ require('table.inc');
+ if (!is_array($info = mysqli_get_client_stats()) || empty($info))
+ printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+ ++$test_counter, gettype($info), $info);
+
+ // fetch stats
+ $expected = $info;
+
+ // buffered normal
+ print "Testing buffered normal...\n";
+ if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS _num FROM test', MYSQLI_STORE_RESULT))
+ printf("[%03d] SELECT COUNT() FROM test failed, [%d] %s\n",
+ ++$test_counter, mysqli_errno($link), mysqli_error($link));
+
+ $expected['rows_fetched_from_server_normal'] = (string)($expected['rows_fetched_from_server_normal'] + 1);
+ $expected['buffered_sets'] = (string)($expected['buffered_sets'] + 1);
+ $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1);
+ $expected['rows_buffered_from_client_normal'] = (string)($expected['rows_buffered_from_client_normal'] + 1);
+
+ if (!is_array($info = mysqli_get_client_stats()) || empty($info))
+ printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+ ++$test_counter, gettype($info), $info);
+
+ mysqli_get_client_stats_assert_gt('bytes_sent', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_gt('bytes_received', $info, $expected, $test_counter);
+
+ // real_data_* get incremented after mysqli_*fetch*()
mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, "0", $test_counter);
- mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, "0", $test_counter);
+ mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, "0", $test_counter);
- mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_buffered', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('buffered_sets', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('rows_buffered_from_client_normal', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_buffered', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('buffered_sets', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('rows_buffered_from_client_normal', $info, $expected, $test_counter);
- /* no change to rows_fetched_from_client_normal_buffered! */
- if (!$row = mysqli_fetch_assoc($res))
- printf("[%03d] fetch_assoc - SELECT COUNT() FROM test failed, [%d] %s\n",
- ++$test_counter, mysqli_errno($link), mysqli_error($link));
+ /* no change to rows_fetched_from_client_normal_buffered! */
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[%03d] fetch_assoc - SELECT COUNT() FROM test failed, [%d] %s\n",
+ ++$test_counter, mysqli_errno($link), mysqli_error($link));
- $expected['rows_fetched_from_client_normal_buffered'] = (string)($expected['rows_fetched_from_client_normal_buffered'] + 1);
+ $expected['rows_fetched_from_client_normal_buffered'] = (string)($expected['rows_fetched_from_client_normal_buffered'] + 1);
- if (!is_array($info = mysqli_get_client_stats()) || empty($info))
- printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
- ++$test_counter, gettype($info), $info);
+ if (!is_array($info = mysqli_get_client_stats()) || empty($info))
+ printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+ ++$test_counter, gettype($info), $info);
- // fetch will increment
- mysqli_get_client_stats_assert_gt('bytes_received_real_data_normal', $info, $expected, $test_counter);
- $expected['bytes_received_real_data_normal'] = $info['bytes_received_real_data_normal'];
- mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, "0", $test_counter);
+ // fetch will increment
+ mysqli_get_client_stats_assert_gt('bytes_received_real_data_normal', $info, $expected, $test_counter);
+ $expected['bytes_received_real_data_normal'] = $info['bytes_received_real_data_normal'];
+ mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, "0", $test_counter);
- mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_buffered', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('rows_buffered_from_client_normal', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_buffered', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('rows_buffered_from_client_normal', $info, $expected, $test_counter);
- $num_rows = $row['_num'];
- mysqli_free_result($res);
+ $num_rows = $row['_num'];
+ mysqli_free_result($res);
- print "Testing buffered normal... - SELECT id, label FROM test\n";
- if (!$res = mysqli_query($link, 'SELECT id, label FROM test', MYSQLI_STORE_RESULT))
- printf("[%03d] SELECT id, label FROM test failed, [%d] %s\n",
- ++$test_counter, mysqli_errno($link), mysqli_error($link));
+ print "Testing buffered normal... - SELECT id, label FROM test\n";
+ if (!$res = mysqli_query($link, 'SELECT id, label FROM test', MYSQLI_STORE_RESULT))
+ printf("[%03d] SELECT id, label FROM test failed, [%d] %s\n",
+ ++$test_counter, mysqli_errno($link), mysqli_error($link));
- assert(mysqli_num_rows($res) == $num_rows);
+ assert(mysqli_num_rows($res) == $num_rows);
- if (!is_array($info = mysqli_get_client_stats()) || empty($info))
- printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
- ++$test_counter, gettype($info), $info);
+ if (!is_array($info = mysqli_get_client_stats()) || empty($info))
+ printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+ ++$test_counter, gettype($info), $info);
- $expected['rows_fetched_from_server_normal'] = (string)($expected['rows_fetched_from_server_normal'] + $num_rows);
- $expected['rows_buffered_from_client_normal'] = (string)($expected['rows_buffered_from_client_normal'] + $num_rows);
- $expected['buffered_sets'] = (string)($expected['buffered_sets'] + 1);
- $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1);
+ $expected['rows_fetched_from_server_normal'] = (string)($expected['rows_fetched_from_server_normal'] + $num_rows);
+ $expected['rows_buffered_from_client_normal'] = (string)($expected['rows_buffered_from_client_normal'] + $num_rows);
+ $expected['buffered_sets'] = (string)($expected['buffered_sets'] + 1);
+ $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1);
- mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_buffered', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('buffered_sets', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('rows_buffered_from_client_normal', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('rows_buffered_from_client_normal', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_buffered', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('buffered_sets', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('rows_buffered_from_client_normal', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('rows_buffered_from_client_normal', $info, $expected, $test_counter);
- /* fetching none, but stats should not be affected - current implementation */
- mysqli_free_result($res);
+ /* fetching none, but stats should not be affected - current implementation */
+ mysqli_free_result($res);
- if (!is_array($info = mysqli_get_client_stats()) || empty($info))
- printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
- ++$test_counter, gettype($info), $info);
+ if (!is_array($info = mysqli_get_client_stats()) || empty($info))
+ printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+ ++$test_counter, gettype($info), $info);
- mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_buffered', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_buffered', $info, $expected, $test_counter);
- print "Testing unbuffered normal...\n";
- if (!$res = mysqli_query($link, 'SELECT id, label FROM test', MYSQLI_USE_RESULT))
- printf("[%03d] SELECT id, label FROM test failed, [%d] %s\n",
- ++$test_counter, mysqli_errno($link), mysqli_error($link));
+ print "Testing unbuffered normal...\n";
+ if (!$res = mysqli_query($link, 'SELECT id, label FROM test', MYSQLI_USE_RESULT))
+ printf("[%03d] SELECT id, label FROM test failed, [%d] %s\n",
+ ++$test_counter, mysqli_errno($link), mysqli_error($link));
- if (!is_array($info = mysqli_get_client_stats()) || empty($info))
- printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
- ++$test_counter, gettype($info), $info);
+ if (!is_array($info = mysqli_get_client_stats()) || empty($info))
+ printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+ ++$test_counter, gettype($info), $info);
- mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_unbuffered', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_unbuffered', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter);
- while ($row = mysqli_fetch_assoc($res))
- ;
- mysqli_free_result($res);
+ while ($row = mysqli_fetch_assoc($res))
+ ;
+ mysqli_free_result($res);
- $expected['rows_fetched_from_server_normal'] = (string)($expected['rows_fetched_from_server_normal'] + $num_rows);
- $expected['rows_fetched_from_client_normal_unbuffered'] = (string)($expected['rows_fetched_from_client_normal_unbuffered'] + $num_rows);
- $expected['unbuffered_sets'] = (string)($expected['unbuffered_sets'] + 1);
- $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1);
+ $expected['rows_fetched_from_server_normal'] = (string)($expected['rows_fetched_from_server_normal'] + $num_rows);
+ $expected['rows_fetched_from_client_normal_unbuffered'] = (string)($expected['rows_fetched_from_client_normal_unbuffered'] + $num_rows);
+ $expected['unbuffered_sets'] = (string)($expected['unbuffered_sets'] + 1);
+ $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1);
- if (!is_array($info = mysqli_get_client_stats()) || empty($info))
- printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
- ++$test_counter, gettype($info), $info);
+ if (!is_array($info = mysqli_get_client_stats()) || empty($info))
+ printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+ ++$test_counter, gettype($info), $info);
- mysqli_get_client_stats_assert_gt('bytes_received_real_data_normal', $info, $expected, $test_counter);
- $expected['bytes_received_real_data_normal'] = $info['bytes_received_real_data_normal'];
+ mysqli_get_client_stats_assert_gt('bytes_received_real_data_normal', $info, $expected, $test_counter);
+ $expected['bytes_received_real_data_normal'] = $info['bytes_received_real_data_normal'];
- mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_unbuffered', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('unbuffered_sets', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_unbuffered', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('unbuffered_sets', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter);
- print "Testing unbuffered normal... - SELECT id, label FROM test, not all fetched\n";
- if (!$res = mysqli_query($link, 'SELECT id, label FROM test', MYSQLI_USE_RESULT))
- printf("[%03d] SELECT id, label FROM test failed, [%d] %s\n",
- ++$test_counter, mysqli_errno($link), mysqli_error($link));
+ print "Testing unbuffered normal... - SELECT id, label FROM test, not all fetched\n";
+ if (!$res = mysqli_query($link, 'SELECT id, label FROM test', MYSQLI_USE_RESULT))
+ printf("[%03d] SELECT id, label FROM test failed, [%d] %s\n",
+ ++$test_counter, mysqli_errno($link), mysqli_error($link));
- for ($i = 0; $i < $num_rows - 1; $i++)
- $row = mysqli_fetch_assoc($res);
+ for ($i = 0; $i < $num_rows - 1; $i++)
+ $row = mysqli_fetch_assoc($res);
- $expected['rows_fetched_from_server_normal'] = (string)($expected['rows_fetched_from_server_normal'] + $num_rows - 1);
- $expected['rows_fetched_from_client_normal_unbuffered'] = (string)($expected['rows_fetched_from_client_normal_unbuffered'] + $num_rows - 1);
- $expected['unbuffered_sets'] = (string)($expected['unbuffered_sets'] + 1);
- $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1);
+ $expected['rows_fetched_from_server_normal'] = (string)($expected['rows_fetched_from_server_normal'] + $num_rows - 1);
+ $expected['rows_fetched_from_client_normal_unbuffered'] = (string)($expected['rows_fetched_from_client_normal_unbuffered'] + $num_rows - 1);
+ $expected['unbuffered_sets'] = (string)($expected['unbuffered_sets'] + 1);
+ $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1);
- if (!is_array($info = mysqli_get_client_stats()) || empty($info))
- printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
- ++$test_counter, gettype($info), $info);
+ if (!is_array($info = mysqli_get_client_stats()) || empty($info))
+ printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+ ++$test_counter, gettype($info), $info);
- mysqli_get_client_stats_assert_gt('bytes_received_real_data_normal', $info, $expected, $test_counter);
- $expected['bytes_received_real_data_normal'] = $info['bytes_received_real_data_normal'];
+ mysqli_get_client_stats_assert_gt('bytes_received_real_data_normal', $info, $expected, $test_counter);
+ $expected['bytes_received_real_data_normal'] = $info['bytes_received_real_data_normal'];
- mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_unbuffered', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('unbuffered_sets', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_unbuffered', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('unbuffered_sets', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter);
- print "Testing if implicit fetching and cleaning happens...\n";
- mysqli_free_result($res);
+ print "Testing if implicit fetching and cleaning happens...\n";
+ mysqli_free_result($res);
- /* last row has been implicitly cleaned from the wire by freeing the result set */
- $expected['rows_fetched_from_server_normal'] = (string)($expected['rows_fetched_from_server_normal'] + 1);
- $expected['rows_fetched_from_client_normal_unbuffered'] = (string)($expected['rows_fetched_from_client_normal_unbuffered'] + 1);
- $expected['rows_skipped_normal'] = (string)($info['rows_skipped_normal'] + 1);
- $expected['flushed_normal_sets'] = (string)($expected['flushed_normal_sets'] + 1);
+ /* last row has been implicitly cleaned from the wire by freeing the result set */
+ $expected['rows_fetched_from_server_normal'] = (string)($expected['rows_fetched_from_server_normal'] + 1);
+ $expected['rows_fetched_from_client_normal_unbuffered'] = (string)($expected['rows_fetched_from_client_normal_unbuffered'] + 1);
+ $expected['rows_skipped_normal'] = (string)($info['rows_skipped_normal'] + 1);
+ $expected['flushed_normal_sets'] = (string)($expected['flushed_normal_sets'] + 1);
- if (!is_array($info = mysqli_get_client_stats()) || empty($info))
- printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
- ++$test_counter, gettype($info), $info);
+ if (!is_array($info = mysqli_get_client_stats()) || empty($info))
+ printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+ ++$test_counter, gettype($info), $info);
- mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_unbuffered', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('rows_skipped_normal', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('flushed_normal_sets', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_unbuffered', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('rows_skipped_normal', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('flushed_normal_sets', $info, $expected, $test_counter);
- print "Testing buffered Prepared Statements...\n";
- if (!$stmt = mysqli_stmt_init($link))
- printf("[%03d] stmt_init() failed, [%d] %s\n",
- ++$test_counter, mysqli_errno($link), mysqli_error($link));
+ print "Testing buffered Prepared Statements...\n";
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[%03d] stmt_init() failed, [%d] %s\n",
+ ++$test_counter, mysqli_errno($link), mysqli_error($link));
- if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test') ||
- !mysqli_stmt_execute($stmt))
- printf("[%03d] prepare/execute failed, [%d] %s\n",
- ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test') ||
+ !mysqli_stmt_execute($stmt))
+ printf("[%03d] prepare/execute failed, [%d] %s\n",
+ ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- /* by default PS is unbuffered - no change */
- mysqli_get_client_stats_assert_eq('rows_fetched_from_server_ps', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('rows_fetched_from_client_ps_buffered', $info, $expected, $test_counter);
+ /* by default PS is unbuffered - no change */
+ mysqli_get_client_stats_assert_eq('rows_fetched_from_server_ps', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('rows_fetched_from_client_ps_buffered', $info, $expected, $test_counter);
- if (!mysqli_stmt_store_result($stmt))
- printf("[%03d] store_result failed, [%d] %s\n",
- ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_free_result($stmt);
+ if (!mysqli_stmt_store_result($stmt))
+ printf("[%03d] store_result failed, [%d] %s\n",
+ ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_stmt_free_result($stmt);
- mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, "0", $test_counter);
- mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, "0", $test_counter);
+ mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter);
- $expected['rows_fetched_from_server_ps'] = (string)($expected['rows_fetched_from_server_ps'] + $num_rows);
- $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1);
- $expected['ps_buffered_sets'] = (string)($expected['ps_buffered_sets'] + 1);
- $expected['rows_buffered_from_client_ps'] = (string)($expected['rows_buffered_from_client_ps'] + $num_rows);
+ $expected['rows_fetched_from_server_ps'] = (string)($expected['rows_fetched_from_server_ps'] + $num_rows);
+ $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1);
+ $expected['ps_buffered_sets'] = (string)($expected['ps_buffered_sets'] + 1);
+ $expected['rows_buffered_from_client_ps'] = (string)($expected['rows_buffered_from_client_ps'] + $num_rows);
- if (!is_array($info = mysqli_get_client_stats()) || empty($info))
- printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
- ++$test_counter, gettype($info), $info);
+ if (!is_array($info = mysqli_get_client_stats()) || empty($info))
+ printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+ ++$test_counter, gettype($info), $info);
- mysqli_get_client_stats_assert_eq('rows_fetched_from_server_ps', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('rows_fetched_from_client_ps_buffered', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('ps_buffered_sets', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('rows_buffered_from_client_ps', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('rows_fetched_from_server_ps', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('rows_fetched_from_client_ps_buffered', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('ps_buffered_sets', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('rows_buffered_from_client_ps', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, "0", $test_counter);
+ mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, "0", $test_counter);
- print "Testing buffered Prepared Statements... - fetching all\n";
+ print "Testing buffered Prepared Statements... - fetching all\n";
- if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test') ||
- !mysqli_stmt_execute($stmt))
- printf("[%03d] prepare/execute failed, [%d] %s\n",
- ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test') ||
+ !mysqli_stmt_execute($stmt))
+ printf("[%03d] prepare/execute failed, [%d] %s\n",
+ ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $id = $label = null;
- if (!mysqli_stmt_bind_result($stmt, $id, $label))
- printf("[%03d] bind_result failed, [%d] %s\n",
- ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $id = $label = null;
+ if (!mysqli_stmt_bind_result($stmt, $id, $label))
+ printf("[%03d] bind_result failed, [%d] %s\n",
+ ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_store_result($stmt))
- printf("[%03d] store_result failed, [%d] %s\n",
- ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_store_result($stmt))
+ printf("[%03d] store_result failed, [%d] %s\n",
+ ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- while (mysqli_stmt_fetch($stmt))
- ;
+ while (mysqli_stmt_fetch($stmt))
+ ;
- $expected['rows_fetched_from_server_ps'] = (string)($expected['rows_fetched_from_server_ps'] + $num_rows);
- $expected['rows_fetched_from_client_ps_buffered'] = (string)($expected['rows_fetched_from_client_ps_buffered'] + $num_rows);
- $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1);
- $expected['ps_buffered_sets'] = (string)($expected['ps_buffered_sets'] + 1);
- $expected['rows_buffered_from_client_ps'] = (string)($expected['rows_buffered_from_client_ps'] + $num_rows);
+ $expected['rows_fetched_from_server_ps'] = (string)($expected['rows_fetched_from_server_ps'] + $num_rows);
+ $expected['rows_fetched_from_client_ps_buffered'] = (string)($expected['rows_fetched_from_client_ps_buffered'] + $num_rows);
+ $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1);
+ $expected['ps_buffered_sets'] = (string)($expected['ps_buffered_sets'] + 1);
+ $expected['rows_buffered_from_client_ps'] = (string)($expected['rows_buffered_from_client_ps'] + $num_rows);
- if (!is_array($info = mysqli_get_client_stats()) || empty($info))
- printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
- ++$test_counter, gettype($info), $info);
+ if (!is_array($info = mysqli_get_client_stats()) || empty($info))
+ printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+ ++$test_counter, gettype($info), $info);
- mysqli_get_client_stats_assert_gt('bytes_received_real_data_ps', $info, $expected, $test_counter);
- $expected['bytes_received_real_data_ps'] = $info['bytes_received_real_data_ps'];
+ mysqli_get_client_stats_assert_gt('bytes_received_real_data_ps', $info, $expected, $test_counter);
+ $expected['bytes_received_real_data_ps'] = $info['bytes_received_real_data_ps'];
- mysqli_get_client_stats_assert_eq('rows_fetched_from_server_ps', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('rows_fetched_from_client_ps_buffered', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('ps_buffered_sets', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('rows_buffered_from_client_ps', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('rows_fetched_from_server_ps', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('rows_fetched_from_client_ps_buffered', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('ps_buffered_sets', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('rows_buffered_from_client_ps', $info, $expected, $test_counter);
- mysqli_stmt_free_result($stmt);
+ mysqli_stmt_free_result($stmt);
- print "Testing buffered Prepared Statements... - fetching all but one\n";
+ print "Testing buffered Prepared Statements... - fetching all but one\n";
- if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test') ||
- !mysqli_stmt_execute($stmt))
- printf("[%03d] prepare/execute failed, [%d] %s\n",
- ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test') ||
+ !mysqli_stmt_execute($stmt))
+ printf("[%03d] prepare/execute failed, [%d] %s\n",
+ ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $id = $label = null;
- if (!mysqli_stmt_bind_result($stmt, $id, $label))
- printf("[%03d] bind_result failed, [%d] %s\n",
- ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $id = $label = null;
+ if (!mysqli_stmt_bind_result($stmt, $id, $label))
+ printf("[%03d] bind_result failed, [%d] %s\n",
+ ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_store_result($stmt))
- printf("[%03d] store_result failed, [%d] %s\n",
- ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_store_result($stmt))
+ printf("[%03d] store_result failed, [%d] %s\n",
+ ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- for ($i = 0; $i < $num_rows - 1; $i++)
- mysqli_stmt_fetch($stmt);
+ for ($i = 0; $i < $num_rows - 1; $i++)
+ mysqli_stmt_fetch($stmt);
- $expected['rows_fetched_from_server_ps'] = (string)($expected['rows_fetched_from_server_ps'] + $num_rows);
- $expected['rows_fetched_from_client_ps_buffered'] = (string)($expected['rows_fetched_from_client_ps_buffered'] + $num_rows - 1);
- $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1);
- $expected['ps_buffered_sets'] = (string)($expected['ps_buffered_sets'] + 1);
- $expected['rows_buffered_from_client_ps'] = (string)($expected['rows_buffered_from_client_ps'] + $num_rows);
+ $expected['rows_fetched_from_server_ps'] = (string)($expected['rows_fetched_from_server_ps'] + $num_rows);
+ $expected['rows_fetched_from_client_ps_buffered'] = (string)($expected['rows_fetched_from_client_ps_buffered'] + $num_rows - 1);
+ $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1);
+ $expected['ps_buffered_sets'] = (string)($expected['ps_buffered_sets'] + 1);
+ $expected['rows_buffered_from_client_ps'] = (string)($expected['rows_buffered_from_client_ps'] + $num_rows);
- if (!is_array($info = mysqli_get_client_stats()) || empty($info))
- printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
- ++$test_counter, gettype($info), $info);
+ if (!is_array($info = mysqli_get_client_stats()) || empty($info))
+ printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+ ++$test_counter, gettype($info), $info);
- mysqli_get_client_stats_assert_gt('bytes_received_real_data_ps', $info, $expected, $test_counter);
- $expected['bytes_received_real_data_ps'] = $info['bytes_received_real_data_ps'];
+ mysqli_get_client_stats_assert_gt('bytes_received_real_data_ps', $info, $expected, $test_counter);
+ $expected['bytes_received_real_data_ps'] = $info['bytes_received_real_data_ps'];
- mysqli_get_client_stats_assert_eq('rows_fetched_from_server_ps', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('rows_fetched_from_client_ps_buffered', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('ps_buffered_sets', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('rows_buffered_from_client_ps', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('rows_fetched_from_server_ps', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('rows_fetched_from_client_ps_buffered', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('ps_buffered_sets', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('rows_buffered_from_client_ps', $info, $expected, $test_counter);
- $expected['rows_skipped_ps'] = $info['rows_skipped_ps'];
- mysqli_stmt_free_result($stmt);
+ $expected['rows_skipped_ps'] = $info['rows_skipped_ps'];
+ mysqli_stmt_free_result($stmt);
- if (!is_array($info = mysqli_get_client_stats()) || empty($info))
- printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
- ++$test_counter, gettype($info), $info);
+ if (!is_array($info = mysqli_get_client_stats()) || empty($info))
+ printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+ ++$test_counter, gettype($info), $info);
- /* buffered result set - no skipping possible! */
- mysqli_get_client_stats_assert_eq('rows_skipped_ps', $info, $expected, $test_counter);
+ /* buffered result set - no skipping possible! */
+ mysqli_get_client_stats_assert_eq('rows_skipped_ps', $info, $expected, $test_counter);
- print "Testing unbuffered Prepared Statements... - fetching all\n";
+ print "Testing unbuffered Prepared Statements... - fetching all\n";
- if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test') ||
- !mysqli_stmt_execute($stmt))
- printf("[%03d] prepare/execute failed, [%d] %s\n",
- ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test') ||
+ !mysqli_stmt_execute($stmt))
+ printf("[%03d] prepare/execute failed, [%d] %s\n",
+ ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $id = $label = null;
- if (!mysqli_stmt_bind_result($stmt, $id, $label))
- printf("[%03d] bind_result failed, [%d] %s\n",
- ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $id = $label = null;
+ if (!mysqli_stmt_bind_result($stmt, $id, $label))
+ printf("[%03d] bind_result failed, [%d] %s\n",
+ ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $i = 0;
- while (mysqli_stmt_fetch($stmt))
- $i++;
- assert($num_rows = $i);
+ $i = 0;
+ while (mysqli_stmt_fetch($stmt))
+ $i++;
+ assert($num_rows = $i);
- $expected['rows_fetched_from_server_ps'] = (string)($expected['rows_fetched_from_server_ps'] + $num_rows);
- $expected['rows_fetched_from_client_ps_unbuffered'] = (string)($expected['rows_fetched_from_client_ps_unbuffered'] + $num_rows);
- $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1);
- $expected['ps_unbuffered_sets'] = (string)($expected['ps_unbuffered_sets'] + 1);
+ $expected['rows_fetched_from_server_ps'] = (string)($expected['rows_fetched_from_server_ps'] + $num_rows);
+ $expected['rows_fetched_from_client_ps_unbuffered'] = (string)($expected['rows_fetched_from_client_ps_unbuffered'] + $num_rows);
+ $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1);
+ $expected['ps_unbuffered_sets'] = (string)($expected['ps_unbuffered_sets'] + 1);
- if (!is_array($info = mysqli_get_client_stats()) || empty($info))
- printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
- ++$test_counter, gettype($info), $info);
+ if (!is_array($info = mysqli_get_client_stats()) || empty($info))
+ printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+ ++$test_counter, gettype($info), $info);
- mysqli_get_client_stats_assert_gt('bytes_received_real_data_ps', $info, $expected, $test_counter);
- $expected['bytes_received_real_data_ps'] = $info['bytes_received_real_data_ps'];
+ mysqli_get_client_stats_assert_gt('bytes_received_real_data_ps', $info, $expected, $test_counter);
+ $expected['bytes_received_real_data_ps'] = $info['bytes_received_real_data_ps'];
- mysqli_get_client_stats_assert_eq('rows_fetched_from_server_ps', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('rows_fetched_from_client_ps_unbuffered', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('ps_unbuffered_sets', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('rows_buffered_from_client_ps', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('rows_fetched_from_server_ps', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('rows_fetched_from_client_ps_unbuffered', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('ps_unbuffered_sets', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('rows_buffered_from_client_ps', $info, $expected, $test_counter);
- mysqli_stmt_free_result($stmt);
+ mysqli_stmt_free_result($stmt);
- print "Testing unbuffered Prepared Statements... - fetching all but one\n";
+ print "Testing unbuffered Prepared Statements... - fetching all but one\n";
- if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test') ||
- !mysqli_stmt_execute($stmt))
- printf("[%03d] prepare/execute failed, [%d] %s\n",
- ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test') ||
+ !mysqli_stmt_execute($stmt))
+ printf("[%03d] prepare/execute failed, [%d] %s\n",
+ ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $id = $label = null;
- if (!mysqli_stmt_bind_result($stmt, $id, $label))
- printf("[%03d] bind_result failed, [%d] %s\n",
- ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- for ($i = 0; $i < $num_rows - 1; $i++)
- mysqli_stmt_fetch($stmt);
-
- $expected['rows_fetched_from_server_ps'] = (string)($expected['rows_fetched_from_server_ps'] + $num_rows - 1);
- $expected['rows_fetched_from_client_ps_unbuffered'] = (string)($expected['rows_fetched_from_client_ps_unbuffered'] + $num_rows - 1);
- $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1);
- $expected['ps_unbuffered_sets'] = (string)($expected['ps_unbuffered_sets'] + 1);
-
- if (!is_array($info = mysqli_get_client_stats()) || empty($info))
- printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
- ++$test_counter, gettype($info), $info);
-
- mysqli_get_client_stats_assert_gt('bytes_received_real_data_ps', $info, $expected, $test_counter);
- $expected['bytes_received_real_data_ps'] = $info['bytes_received_real_data_ps'];
-
- mysqli_get_client_stats_assert_eq('rows_fetched_from_server_ps', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('rows_fetched_from_client_ps_unbuffered', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('ps_unbuffered_sets', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('rows_buffered_from_client_ps', $info, $expected, $test_counter);
-
- mysqli_stmt_free_result($stmt);
- $expected['rows_skipped_ps'] = (string)($expected['rows_skipped_ps'] + 1);
- $expected['flushed_ps_sets'] = (string)($expected['flushed_ps_sets'] + 1);
- $expected['rows_fetched_from_server_ps'] = (string)($expected['rows_fetched_from_server_ps'] + 1);
-
- if (!is_array($info = mysqli_get_client_stats()) || empty($info))
- printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
- ++$test_counter, gettype($info), $info);
-
- mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, $expected, $test_counter);
-
- mysqli_get_client_stats_assert_eq('rows_skipped_ps', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('flushed_ps_sets', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('rows_fetched_from_server_ps', $info, $expected, $test_counter);
-
- /*
- print "Checking for normal buffered side effects...\n";
- foreach ($info as $k => $v)
- if ($info[$k] != $expected[$k])
- printf("$k - $v != %s\n", $expected[$k]);
- */
- print "... done with fetch statistics\n";
-
- if (!is_array($info = mysqli_get_client_stats()) || empty($info))
- printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
- ++$test_counter, gettype($info), $info);
-
- mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, $expected, $test_counter);
-
- //
- // result_set_queries statistics
- //
-
- if (!is_array($info = mysqli_get_client_stats()) || empty($info))
- printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
- ++$test_counter, gettype($info), $info);
-
- if (!$res = mysqli_query($link, "SELECT id, label FROM test"))
- printf("[%03d] SELECT failed, [%d] %s\n", ++$test_counter,
- mysqli_errno($link), mysqli_error($link));
-
- $rows = 0;
- while ($row = mysqli_fetch_assoc($res))
- $rows++;
-
- if (0 == $rows)
- printf("[%03d] Expecting at least one result, [%d] %s\n", ++$test_counter,
- mysqli_errno($link), mysqli_error($link));
-
- mysqli_free_result($res);
-
- if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
- printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
- ++$test_counter, gettype($new_info), $new_info);
-
- mysqli_get_client_stats_assert_eq('result_set_queries', $new_info, (string)($info['result_set_queries'] + 1), $test_counter);
- $info = $new_info;
-
- mysqli_get_client_stats_assert_gt('bytes_received_real_data_normal', $info, $expected, $test_counter);
- $expected['bytes_received_real_data_normal'] = $info['bytes_received_real_data_normal'];
-
- //
- // non_result_set_queries - DDL
- //
-
- // CREATE TABLE, DROP TABLE
- if (!mysqli_query($link, "DROP TABLE IF EXISTS non_result_set_queries_test"))
- printf("[%03d] DROP TABLE failed, [%d] %s\n", ++$test_counter,
- mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_query($link, "CREATE TABLE non_result_set_queries_test(id INT) ENGINE = " . $engine)) {
- printf("[%03d] CREATE TABLE failed, [%d] %s\n", ++$test_counter,
- mysqli_errno($link), mysqli_error($link));
- } else {
- if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
- printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
- ++$test_counter, gettype($new_info), $new_info);
- mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 2), $test_counter, 'CREATE/DROP TABLE');
- }
- $info = $new_info;
-
- // ALERT TABLE
- if (!mysqli_query($link, "ALTER TABLE non_result_set_queries_test ADD label CHAR(1)")) {
- printf("[%03d] ALTER TABLE failed, [%d] %s\n", ++$test_counter,
- mysqli_errno($link), mysqli_error($link));
- } else {
- if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
- printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
- ++$test_counter, gettype($new_info), $new_info);
- mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'ALTER TABLE');
- }
- $info = $new_info;
-
- // CREATE INDEX, DROP INDEX
- if (!mysqli_query($link, "CREATE INDEX idx_1 ON non_result_set_queries_test(id)")) {
- printf("[%03d] CREATE INDEX failed, [%d] %s\n", ++$test_counter,
- mysqli_errno($link), mysqli_error($link));
- } else {
-
- if (!mysqli_query($link, "DROP INDEX idx_1 ON non_result_set_queries_test"))
- printf("[%03d] DROP INDEX failed, [%d] %s\n", ++$test_counter,
- mysqli_errno($link), mysqli_error($link));
-
- if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
- printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
- ++$test_counter, gettype($new_info), $new_info);
- mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 2), $test_counter, 'DROP INDEX');
- }
- $info = $new_info;
-
- // RENAME TABLE
- if (!mysqli_query($link, "DROP TABLE IF EXISTS client_stats_test"))
- printf("[%03d] Cleanup, DROP TABLE client_stats_test failed, [%d] %s\n", ++$test_counter,
- mysqli_errno($link), mysqli_error($link));
-
- if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
- printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
- ++$test_counter, gettype($new_info), $new_info);
- $info = $new_info;
-
- if (!mysqli_query($link, "RENAME TABLE non_result_set_queries_test TO client_stats_test")) {
- printf("[%03d] RENAME TABLE failed, [%d] %s\n", ++$test_counter,
- mysqli_errno($link), mysqli_error($link));
-
- } else {
- if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
- printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
- ++$test_counter, gettype($new_info), $new_info);
- mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'RENAME TABLE');
-
- }
- $info = $new_info;
-
- if (!mysqli_query($link, "DROP TABLE IF EXISTS non_result_set_queries_test"))
- printf("[%03d] Cleanup, DROP TABLE failed, [%d] %s\n", ++$test_counter,
- mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_query($link, "DROP TABLE IF EXISTS client_stats_test"))
- printf("[%03d] Cleanup, DROP TABLE failed, [%d] %s\n", ++$test_counter,
- mysqli_errno($link), mysqli_error($link));
-
- // Let's see if we have privileges for CREATE DATABASE
- mysqli_query($link, "DROP DATABASE IF EXISTS mysqli_get_client_stats");
- if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
- printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
- ++$test_counter, gettype($new_info), $new_info);
- $info = $new_info;
-
-
- // CREATE, ALTER, DROP DATABASE
- if (mysqli_query($link, "CREATE DATABASE mysqli_get_client_stats")) {
-
- if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
- printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
- ++$test_counter, gettype($new_info), $new_info);
- mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'CREATE DATABASE');
- $info = $new_info;
-
- if (!mysqli_query($link, "ALTER DATABASE DEFAULT CHARACTER SET latin1"))
- printf("[%03d] ALTER DATABASE failed, [%d] %s\n", ++$test_counter,
- mysqli_errno($link), mysqli_error($link));
-
- if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
- printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
- ++$test_counter, gettype($new_info), $new_info);
- mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'CREATE DATABASE');
- $info = $new_info;
-
- if (!mysqli_query($link, "CREATE DATABASE mysqli_get_client_stats_"))
- printf("[%03d] CREATE DATABASE failed, [%d] %s\n", ++$test_counter,
- mysqli_errno($link), mysqli_error($link));
- if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
- printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
- ++$test_counter, gettype($new_info), $new_info);
- $info = $new_info;
-
- if (!mysqli_query($link, "DROP DATABASE mysqli_get_client_stats_"))
- printf("[%03d] DROP DATABASE failed, [%d] %s\n", ++$test_counter,
- mysqli_errno($link), mysqli_error($link));
-
- if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
- printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
- ++$test_counter, gettype($new_info), $new_info);
- mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'DROP DATABASE');
- $info = $new_info;
- }
-
- // CREATE SERVER, ALTER SERVER, DROP SERVER
- // We don't really try to use federated, we just want to see if the syntax works
- mysqli_query($link, "DROP SERVER IF EXISTS myself");
-
- if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
- printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
- ++$test_counter, gettype($new_info), $new_info);
- $info = $new_info;
-
- $sql = sprintf("CREATE SERVER myself FOREIGN DATA WRAPPER mysql OPTIONS (user '%s', password '%s', database '%s')",
- $user, $passwd, $db);
- if (mysqli_query($link, $sql)) {
- // server knows about it
-
- if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
- printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
- ++$test_counter, gettype($new_info), $new_info);
-
- mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'CREATE SERVER');
- $info = $new_info;
-
- if (!mysqli_query($link, sprintf("ALTER SERVER myself OPTIONS(user '%s_')", $user)))
- printf("[%03d] ALTER SERVER failed, [%d] %s\n", ++$test_counter,
- mysqli_errno($link), mysqli_error($link));
-
- if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
- printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
- ++$test_counter, gettype($new_info), $new_info);
- mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'ALTER SERVER');
- $info = $new_info;
-
- if (!mysqli_query($link, "DROP SERVER myself"))
- printf("[%03d] DROP SERVER failed, [%d] %s\n", ++$test_counter,
- mysqli_errno($link), mysqli_error($link));
-
- if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
- printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
- ++$test_counter, gettype($new_info), $new_info);
- mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'DROP SERVER');
- $info = $new_info;
- }
-
- mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, $expected, $test_counter);
-
- /*
- We don't test the NDB ones.
- 13.1. Data Definition Statements
- 13.1.3. ALTER LOGFILE GROUP Syntax
- 13.1.4. ALTER TABLESPACE Syntax
- 13.1.9. CREATE LOGFILE GROUP Syntax
- 13.1.10. CREATE TABLESPACE Syntax
- 13.1.15. DROP LOGFILE GROUP Syntax
- 13.1.16. DROP TABLESPACE Syntax
- */
-
- //
- // DML
- //
- if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
- printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
- ++$test_counter, gettype($new_info), $new_info);
- $info = $new_info;
-
- if (!mysqli_query($link, "INSERT INTO test(id) VALUES (100)"))
- printf("[%03d] INSERT failed, [%d] %s\n", ++$test_counter,
- mysqli_errno($link), mysqli_error($link));
-
- if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
- printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
- ++$test_counter, gettype($new_info), $new_info);
- mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'INSERT');
- $info = $new_info;
-
- if (!mysqli_query($link, "UPDATE test SET label ='z' WHERE id = 100"))
- printf("[%03d] UPDATE failed, [%d] %s\n", ++$test_counter,
- mysqli_errno($link), mysqli_error($link));
-
- if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
- printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
- ++$test_counter, gettype($new_info), $new_info);
- mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'UPDATE');
- $info = $new_info;
-
- if (!mysqli_query($link, "REPLACE INTO test(id, label) VALUES (100, 'b')"))
- printf("[%03d] INSERT failed, [%d] %s\n", ++$test_counter,
- mysqli_errno($link), mysqli_error($link));
-
- if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
- printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
- ++$test_counter, gettype($new_info), $new_info);
- mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'REPLACE');
- $info = $new_info;
-
- // NOTE: this will NOT update dbl_ddls counter
- if (!$res = mysqli_query($link, "SELECT id, label FROM test WHERE id = 100"))
- printf("[%03d] SELECT@dml failed, [%d] %s\n", ++$test_counter,
- mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
-
- if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
- printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
- ++$test_counter, gettype($new_info), $new_info);
- mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, $info, $test_counter, 'SELECT@dml');
- $info = $new_info;
-
- if (!mysqli_query($link, "DELETE FROM test WHERE id = 100"))
- printf("[%03d] DELETE failed, [%d] %s\n", ++$test_counter,
- mysqli_errno($link), mysqli_error($link));
-
- if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
- printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
- ++$test_counter, gettype($new_info), $new_info);
- mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'DELETE');
- $info = $new_info;
-
- if (!$res = mysqli_query($link, "TRUNCATE TABLE test"))
- printf("[%03d] TRUNCATE failed, [%d] %s\n", ++$test_counter,
- mysqli_errno($link), mysqli_error($link));
-
- if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
- printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
- ++$test_counter, gettype($new_info), $new_info);
- mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'TRUNCATE');
- $info = $new_info;
-
-
- $file = tempnam(sys_get_temp_dir(), 'mysqli_test');
- if ($fp = fopen($file, 'w')) {
- @fwrite($fp, '1;"a"');
- fclose($fp);
- chmod($file, 0644);
- $sql = sprintf('LOAD DATA LOCAL INFILE "%s" INTO TABLE test', mysqli_real_escape_string($link, $file));
- if (mysqli_query($link, $sql)) {
- if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
- printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
- ++$test_counter, gettype($new_info), $new_info);
- mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'LOAD DATA LOCAL');
- $info = $new_info;
- }
- unlink($file);
- }
-
- mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter);
- mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, $expected, $test_counter);
-
- /*
- We skip those:
- 13.2. Data Manipulation Statements
- 13.2.2. DO Syntax
- 13.2.3. HANDLER Syntax
- 13.2.5. LOAD DATA INFILE Syntax
- */
- mysqli_query($link, "DELETE FROM test");
- if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (1, 'a'), (2, 'b')"))
- printf("[%03d] Cannot insert new records, [%d] %s\n", ++$test_counter,
- mysqli_errno($link), mysqli_error($link));
-
- if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id"))
- printf("[%03d] Cannot SELECT with mysqli_real_query(), [%d] %s\n", ++$test_counter,
- mysqli_errno($link), mysqli_error($link));
-
- if (!is_object($res = mysqli_use_result($link)))
- printf("[%03d] mysqli_use_result() failed, [%d] %s\n", ++$test_counter,
- mysqli_errno($link), mysqli_error($link));
-
- while ($row = mysqli_fetch_assoc($res))
- ;
- mysqli_free_result($res);
- if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
- printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
- ++$test_counter, gettype($new_info), $new_info);
- mysqli_get_client_stats_assert_eq('unbuffered_sets', $new_info, (string)($info['unbuffered_sets'] + 1), $test_counter, 'mysqli_use_result()');
- $info = $new_info;
-
- if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id"))
- printf("[%03d] Cannot SELECT with mysqli_real_query() II, [%d] %s\n", ++$test_counter,
- mysqli_errno($link), mysqli_error($link));
-
- if (!is_object($res = mysqli_store_result($link)))
- printf("[%03d] mysqli_use_result() failed, [%d] %s\n", ++$test_counter,
- mysqli_errno($link), mysqli_error($link));
-
- while ($row = mysqli_fetch_assoc($res))
- ;
- mysqli_free_result($res);
- if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
- printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
- ++$test_counter, gettype($new_info), $new_info);
- mysqli_get_client_stats_assert_eq('buffered_sets', $new_info, (string)($info['buffered_sets'] + 1), $test_counter, 'mysqli_use_result()');
- $info = $new_info;
-
- mysqli_close($link);
-
- mysqli_get_client_stats_assert_gt('bytes_received_real_data_normal', $info, $expected, $test_counter);
- $expected['bytes_received_real_data_normal'] = $info['bytes_received_real_data_normal'];
- mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, $expected, $test_counter);
-
- /*
- no_index_used
- bad_index_used
- flushed_normal_sets
- flushed_ps_sets
- explicit_close
- implicit_close
- disconnect_close
- in_middle_of_command_close
- explicit_free_result
- implicit_free_result
- explicit_stmt_close
- implicit_stmt_close
- */
-
- print "done!";
+ $id = $label = null;
+ if (!mysqli_stmt_bind_result($stmt, $id, $label))
+ printf("[%03d] bind_result failed, [%d] %s\n",
+ ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ for ($i = 0; $i < $num_rows - 1; $i++)
+ mysqli_stmt_fetch($stmt);
+
+ $expected['rows_fetched_from_server_ps'] = (string)($expected['rows_fetched_from_server_ps'] + $num_rows - 1);
+ $expected['rows_fetched_from_client_ps_unbuffered'] = (string)($expected['rows_fetched_from_client_ps_unbuffered'] + $num_rows - 1);
+ $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1);
+ $expected['ps_unbuffered_sets'] = (string)($expected['ps_unbuffered_sets'] + 1);
+
+ if (!is_array($info = mysqli_get_client_stats()) || empty($info))
+ printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+ ++$test_counter, gettype($info), $info);
+
+ mysqli_get_client_stats_assert_gt('bytes_received_real_data_ps', $info, $expected, $test_counter);
+ $expected['bytes_received_real_data_ps'] = $info['bytes_received_real_data_ps'];
+
+ mysqli_get_client_stats_assert_eq('rows_fetched_from_server_ps', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('rows_fetched_from_client_ps_unbuffered', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('ps_unbuffered_sets', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('rows_buffered_from_client_ps', $info, $expected, $test_counter);
+
+ mysqli_stmt_free_result($stmt);
+ $expected['rows_skipped_ps'] = (string)($expected['rows_skipped_ps'] + 1);
+ $expected['flushed_ps_sets'] = (string)($expected['flushed_ps_sets'] + 1);
+ $expected['rows_fetched_from_server_ps'] = (string)($expected['rows_fetched_from_server_ps'] + 1);
+
+ if (!is_array($info = mysqli_get_client_stats()) || empty($info))
+ printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+ ++$test_counter, gettype($info), $info);
+
+ mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, $expected, $test_counter);
+
+ mysqli_get_client_stats_assert_eq('rows_skipped_ps', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('flushed_ps_sets', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('rows_fetched_from_server_ps', $info, $expected, $test_counter);
+
+ /*
+ print "Checking for normal buffered side effects...\n";
+ foreach ($info as $k => $v)
+ if ($info[$k] != $expected[$k])
+ printf("$k - $v != %s\n", $expected[$k]);
+ */
+ print "... done with fetch statistics\n";
+
+ if (!is_array($info = mysqli_get_client_stats()) || empty($info))
+ printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+ ++$test_counter, gettype($info), $info);
+
+ mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, $expected, $test_counter);
+
+ //
+ // result_set_queries statistics
+ //
+
+ if (!is_array($info = mysqli_get_client_stats()) || empty($info))
+ printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+ ++$test_counter, gettype($info), $info);
+
+ if (!$res = mysqli_query($link, "SELECT id, label FROM test"))
+ printf("[%03d] SELECT failed, [%d] %s\n", ++$test_counter,
+ mysqli_errno($link), mysqli_error($link));
+
+ $rows = 0;
+ while ($row = mysqli_fetch_assoc($res))
+ $rows++;
+
+ if (0 == $rows)
+ printf("[%03d] Expecting at least one result, [%d] %s\n", ++$test_counter,
+ mysqli_errno($link), mysqli_error($link));
+
+ mysqli_free_result($res);
+
+ if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+ printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+ ++$test_counter, gettype($new_info), $new_info);
+
+ mysqli_get_client_stats_assert_eq('result_set_queries', $new_info, (string)($info['result_set_queries'] + 1), $test_counter);
+ $info = $new_info;
+
+ mysqli_get_client_stats_assert_gt('bytes_received_real_data_normal', $info, $expected, $test_counter);
+ $expected['bytes_received_real_data_normal'] = $info['bytes_received_real_data_normal'];
+
+ //
+ // non_result_set_queries - DDL
+ //
+
+ // CREATE TABLE, DROP TABLE
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS non_result_set_queries_test"))
+ printf("[%03d] DROP TABLE failed, [%d] %s\n", ++$test_counter,
+ mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_query($link, "CREATE TABLE non_result_set_queries_test(id INT) ENGINE = " . $engine)) {
+ printf("[%03d] CREATE TABLE failed, [%d] %s\n", ++$test_counter,
+ mysqli_errno($link), mysqli_error($link));
+ } else {
+ if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+ printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+ ++$test_counter, gettype($new_info), $new_info);
+ mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 2), $test_counter, 'CREATE/DROP TABLE');
+ }
+ $info = $new_info;
+
+ // ALERT TABLE
+ if (!mysqli_query($link, "ALTER TABLE non_result_set_queries_test ADD label CHAR(1)")) {
+ printf("[%03d] ALTER TABLE failed, [%d] %s\n", ++$test_counter,
+ mysqli_errno($link), mysqli_error($link));
+ } else {
+ if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+ printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+ ++$test_counter, gettype($new_info), $new_info);
+ mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'ALTER TABLE');
+ }
+ $info = $new_info;
+
+ // CREATE INDEX, DROP INDEX
+ if (!mysqli_query($link, "CREATE INDEX idx_1 ON non_result_set_queries_test(id)")) {
+ printf("[%03d] CREATE INDEX failed, [%d] %s\n", ++$test_counter,
+ mysqli_errno($link), mysqli_error($link));
+ } else {
+
+ if (!mysqli_query($link, "DROP INDEX idx_1 ON non_result_set_queries_test"))
+ printf("[%03d] DROP INDEX failed, [%d] %s\n", ++$test_counter,
+ mysqli_errno($link), mysqli_error($link));
+
+ if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+ printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+ ++$test_counter, gettype($new_info), $new_info);
+ mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 2), $test_counter, 'DROP INDEX');
+ }
+ $info = $new_info;
+
+ // RENAME TABLE
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS client_stats_test"))
+ printf("[%03d] Cleanup, DROP TABLE client_stats_test failed, [%d] %s\n", ++$test_counter,
+ mysqli_errno($link), mysqli_error($link));
+
+ if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+ printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+ ++$test_counter, gettype($new_info), $new_info);
+ $info = $new_info;
+
+ if (!mysqli_query($link, "RENAME TABLE non_result_set_queries_test TO client_stats_test")) {
+ printf("[%03d] RENAME TABLE failed, [%d] %s\n", ++$test_counter,
+ mysqli_errno($link), mysqli_error($link));
+
+ } else {
+ if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+ printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+ ++$test_counter, gettype($new_info), $new_info);
+ mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'RENAME TABLE');
+
+ }
+ $info = $new_info;
+
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS non_result_set_queries_test"))
+ printf("[%03d] Cleanup, DROP TABLE failed, [%d] %s\n", ++$test_counter,
+ mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS client_stats_test"))
+ printf("[%03d] Cleanup, DROP TABLE failed, [%d] %s\n", ++$test_counter,
+ mysqli_errno($link), mysqli_error($link));
+
+ // Let's see if we have privileges for CREATE DATABASE
+ mysqli_query($link, "DROP DATABASE IF EXISTS mysqli_get_client_stats");
+ if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+ printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+ ++$test_counter, gettype($new_info), $new_info);
+ $info = $new_info;
+
+
+ // CREATE, ALTER, DROP DATABASE
+ if (mysqli_query($link, "CREATE DATABASE mysqli_get_client_stats")) {
+
+ if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+ printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+ ++$test_counter, gettype($new_info), $new_info);
+ mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'CREATE DATABASE');
+ $info = $new_info;
+
+ if (!mysqli_query($link, "ALTER DATABASE DEFAULT CHARACTER SET latin1"))
+ printf("[%03d] ALTER DATABASE failed, [%d] %s\n", ++$test_counter,
+ mysqli_errno($link), mysqli_error($link));
+
+ if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+ printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+ ++$test_counter, gettype($new_info), $new_info);
+ mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'CREATE DATABASE');
+ $info = $new_info;
+
+ if (!mysqli_query($link, "CREATE DATABASE mysqli_get_client_stats_"))
+ printf("[%03d] CREATE DATABASE failed, [%d] %s\n", ++$test_counter,
+ mysqli_errno($link), mysqli_error($link));
+ if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+ printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+ ++$test_counter, gettype($new_info), $new_info);
+ $info = $new_info;
+
+ if (!mysqli_query($link, "DROP DATABASE mysqli_get_client_stats_"))
+ printf("[%03d] DROP DATABASE failed, [%d] %s\n", ++$test_counter,
+ mysqli_errno($link), mysqli_error($link));
+
+ if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+ printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+ ++$test_counter, gettype($new_info), $new_info);
+ mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'DROP DATABASE');
+ $info = $new_info;
+ }
+
+ // CREATE SERVER, ALTER SERVER, DROP SERVER
+ // We don't really try to use federated, we just want to see if the syntax works
+ mysqli_query($link, "DROP SERVER IF EXISTS myself");
+
+ if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+ printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+ ++$test_counter, gettype($new_info), $new_info);
+ $info = $new_info;
+
+ $sql = sprintf("CREATE SERVER myself FOREIGN DATA WRAPPER mysql OPTIONS (user '%s', password '%s', database '%s')",
+ $user, $passwd, $db);
+ if (mysqli_query($link, $sql)) {
+ // server knows about it
+
+ if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+ printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+ ++$test_counter, gettype($new_info), $new_info);
+
+ mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'CREATE SERVER');
+ $info = $new_info;
+
+ if (!mysqli_query($link, sprintf("ALTER SERVER myself OPTIONS(user '%s_')", $user)))
+ printf("[%03d] ALTER SERVER failed, [%d] %s\n", ++$test_counter,
+ mysqli_errno($link), mysqli_error($link));
+
+ if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+ printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+ ++$test_counter, gettype($new_info), $new_info);
+ mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'ALTER SERVER');
+ $info = $new_info;
+
+ if (!mysqli_query($link, "DROP SERVER myself"))
+ printf("[%03d] DROP SERVER failed, [%d] %s\n", ++$test_counter,
+ mysqli_errno($link), mysqli_error($link));
+
+ if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+ printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+ ++$test_counter, gettype($new_info), $new_info);
+ mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'DROP SERVER');
+ $info = $new_info;
+ }
+
+ mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, $expected, $test_counter);
+
+ /*
+ We don't test the NDB ones.
+ 13.1. Data Definition Statements
+ 13.1.3. ALTER LOGFILE GROUP Syntax
+ 13.1.4. ALTER TABLESPACE Syntax
+ 13.1.9. CREATE LOGFILE GROUP Syntax
+ 13.1.10. CREATE TABLESPACE Syntax
+ 13.1.15. DROP LOGFILE GROUP Syntax
+ 13.1.16. DROP TABLESPACE Syntax
+ */
+
+ //
+ // DML
+ //
+ if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+ printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+ ++$test_counter, gettype($new_info), $new_info);
+ $info = $new_info;
+
+ if (!mysqli_query($link, "INSERT INTO test(id) VALUES (100)"))
+ printf("[%03d] INSERT failed, [%d] %s\n", ++$test_counter,
+ mysqli_errno($link), mysqli_error($link));
+
+ if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+ printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+ ++$test_counter, gettype($new_info), $new_info);
+ mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'INSERT');
+ $info = $new_info;
+
+ if (!mysqli_query($link, "UPDATE test SET label ='z' WHERE id = 100"))
+ printf("[%03d] UPDATE failed, [%d] %s\n", ++$test_counter,
+ mysqli_errno($link), mysqli_error($link));
+
+ if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+ printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+ ++$test_counter, gettype($new_info), $new_info);
+ mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'UPDATE');
+ $info = $new_info;
+
+ if (!mysqli_query($link, "REPLACE INTO test(id, label) VALUES (100, 'b')"))
+ printf("[%03d] INSERT failed, [%d] %s\n", ++$test_counter,
+ mysqli_errno($link), mysqli_error($link));
+
+ if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+ printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+ ++$test_counter, gettype($new_info), $new_info);
+ mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'REPLACE');
+ $info = $new_info;
+
+ // NOTE: this will NOT update dbl_ddls counter
+ if (!$res = mysqli_query($link, "SELECT id, label FROM test WHERE id = 100"))
+ printf("[%03d] SELECT@dml failed, [%d] %s\n", ++$test_counter,
+ mysqli_errno($link), mysqli_error($link));
+ mysqli_free_result($res);
+
+ if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+ printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+ ++$test_counter, gettype($new_info), $new_info);
+ mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, $info, $test_counter, 'SELECT@dml');
+ $info = $new_info;
+
+ if (!mysqli_query($link, "DELETE FROM test WHERE id = 100"))
+ printf("[%03d] DELETE failed, [%d] %s\n", ++$test_counter,
+ mysqli_errno($link), mysqli_error($link));
+
+ if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+ printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+ ++$test_counter, gettype($new_info), $new_info);
+ mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'DELETE');
+ $info = $new_info;
+
+ if (!$res = mysqli_query($link, "TRUNCATE TABLE test"))
+ printf("[%03d] TRUNCATE failed, [%d] %s\n", ++$test_counter,
+ mysqli_errno($link), mysqli_error($link));
+
+ if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+ printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+ ++$test_counter, gettype($new_info), $new_info);
+ mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'TRUNCATE');
+ $info = $new_info;
+
+
+ $file = tempnam(sys_get_temp_dir(), 'mysqli_test');
+ if ($fp = fopen($file, 'w')) {
+ @fwrite($fp, '1;"a"');
+ fclose($fp);
+ chmod($file, 0644);
+ $sql = sprintf('LOAD DATA LOCAL INFILE "%s" INTO TABLE test', mysqli_real_escape_string($link, $file));
+ if (mysqli_query($link, $sql)) {
+ if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+ printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+ ++$test_counter, gettype($new_info), $new_info);
+ mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'LOAD DATA LOCAL');
+ $info = $new_info;
+ }
+ unlink($file);
+ }
+
+ mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter);
+ mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, $expected, $test_counter);
+
+ /*
+ We skip those:
+ 13.2. Data Manipulation Statements
+ 13.2.2. DO Syntax
+ 13.2.3. HANDLER Syntax
+ 13.2.5. LOAD DATA INFILE Syntax
+ */
+ mysqli_query($link, "DELETE FROM test");
+ if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (1, 'a'), (2, 'b')"))
+ printf("[%03d] Cannot insert new records, [%d] %s\n", ++$test_counter,
+ mysqli_errno($link), mysqli_error($link));
+
+ if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id"))
+ printf("[%03d] Cannot SELECT with mysqli_real_query(), [%d] %s\n", ++$test_counter,
+ mysqli_errno($link), mysqli_error($link));
+
+ if (!is_object($res = mysqli_use_result($link)))
+ printf("[%03d] mysqli_use_result() failed, [%d] %s\n", ++$test_counter,
+ mysqli_errno($link), mysqli_error($link));
+
+ while ($row = mysqli_fetch_assoc($res))
+ ;
+ mysqli_free_result($res);
+ if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+ printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+ ++$test_counter, gettype($new_info), $new_info);
+ mysqli_get_client_stats_assert_eq('unbuffered_sets', $new_info, (string)($info['unbuffered_sets'] + 1), $test_counter, 'mysqli_use_result()');
+ $info = $new_info;
+
+ if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id"))
+ printf("[%03d] Cannot SELECT with mysqli_real_query() II, [%d] %s\n", ++$test_counter,
+ mysqli_errno($link), mysqli_error($link));
+
+ if (!is_object($res = mysqli_store_result($link)))
+ printf("[%03d] mysqli_use_result() failed, [%d] %s\n", ++$test_counter,
+ mysqli_errno($link), mysqli_error($link));
+
+ while ($row = mysqli_fetch_assoc($res))
+ ;
+ mysqli_free_result($res);
+ if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+ printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+ ++$test_counter, gettype($new_info), $new_info);
+ mysqli_get_client_stats_assert_eq('buffered_sets', $new_info, (string)($info['buffered_sets'] + 1), $test_counter, 'mysqli_use_result()');
+ $info = $new_info;
+
+ mysqli_close($link);
+
+ mysqli_get_client_stats_assert_gt('bytes_received_real_data_normal', $info, $expected, $test_counter);
+ $expected['bytes_received_real_data_normal'] = $info['bytes_received_real_data_normal'];
+ mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, $expected, $test_counter);
+
+ /*
+ no_index_used
+ bad_index_used
+ flushed_normal_sets
+ flushed_ps_sets
+ explicit_close
+ implicit_close
+ disconnect_close
+ in_middle_of_command_close
+ explicit_free_result
+ implicit_free_result
+ explicit_stmt_close
+ implicit_stmt_close
+ */
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_get_client_stats_implicit_free.phpt b/ext/mysqli/tests/mysqli_get_client_stats_implicit_free.phpt
index 9c889caf8f..bbf3d702c9 100644
--- a/ext/mysqli/tests/mysqli_get_client_stats_implicit_free.phpt
+++ b/ext/mysqli/tests/mysqli_get_client_stats_implicit_free.phpt
@@ -14,27 +14,27 @@ mysqlnd.collect_statistics=1
mysqlnd.collect_memory_statistics=1
--FILE--
<?php
- require_once('connect.inc');
- require_once('table.inc');
+ require_once('connect.inc');
+ require_once('table.inc');
- $stats = mysqli_get_client_stats();
- printf("BEGINNING: implicit_free_result = %d\n", $stats['implicit_free_result']);
+ $stats = mysqli_get_client_stats();
+ printf("BEGINNING: implicit_free_result = %d\n", $stats['implicit_free_result']);
- if (!$res = mysqli_query($link, 'SELECT id FROM test'))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, 'SELECT id FROM test'))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
- mysqli_close($link);
+ mysqli_free_result($res);
+ mysqli_close($link);
- $after = mysqli_get_client_stats();
- if ($after['implicit_free_result'] != $stats['implicit_free_result'])
- printf("[002] Where is the missing mysqli_free_result() call? implicit_free_result has changed by %d.\n",
- $after['implicit_free_result'] - $stats['implicit_free_result']);
+ $after = mysqli_get_client_stats();
+ if ($after['implicit_free_result'] != $stats['implicit_free_result'])
+ printf("[002] Where is the missing mysqli_free_result() call? implicit_free_result has changed by %d.\n",
+ $after['implicit_free_result'] - $stats['implicit_free_result']);
- $stats = $after;
- printf("END: implicit_free_result = %d\n", $stats['implicit_free_result']);
+ $stats = $after;
+ printf("END: implicit_free_result = %d\n", $stats['implicit_free_result']);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_get_client_stats_off.phpt b/ext/mysqli/tests/mysqli_get_client_stats_off.phpt
index 5d9b2aad94..cd713fbc9b 100644
--- a/ext/mysqli/tests/mysqli_get_client_stats_off.phpt
+++ b/ext/mysqli/tests/mysqli_get_client_stats_off.phpt
@@ -14,31 +14,31 @@ mysqlnd.collect_statistics=0
mysqlnd.collect_memory_statistics=0
--FILE--
<?php
- $before = mysqli_get_client_stats();
- if (!is_array($before) || empty($before)) {
- printf("[001] Expecting non-empty array, got %s.\n", gettype($before));
- var_dump($before);
- }
+ $before = mysqli_get_client_stats();
+ if (!is_array($before) || empty($before)) {
+ printf("[001] Expecting non-empty array, got %s.\n", gettype($before));
+ var_dump($before);
+ }
- // connect and table inc connect to mysql and create tables
- require_once('connect.inc');
- require_once('table.inc');
- $after = mysqli_get_client_stats();
+ // connect and table inc connect to mysql and create tables
+ require_once('connect.inc');
+ require_once('table.inc');
+ $after = mysqli_get_client_stats();
- if ($before !== $after) {
- printf("[002] Statistics have changed\n");
- var_dump($before);
- var_dump($after);
- }
+ if ($before !== $after) {
+ printf("[002] Statistics have changed\n");
+ var_dump($before);
+ var_dump($after);
+ }
- foreach ($after as $k => $v)
- if ($v != 0) {
- printf("[003] Field %s should not have any other value but 0, got %s.\n",
- $k, $v);
- }
+ foreach ($after as $k => $v)
+ if ($v != 0) {
+ printf("[003] Field %s should not have any other value but 0, got %s.\n",
+ $k, $v);
+ }
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_get_client_stats_ps.phpt b/ext/mysqli/tests/mysqli_get_client_stats_ps.phpt
index ea1055f806..ef9042b5a3 100644
--- a/ext/mysqli/tests/mysqli_get_client_stats_ps.phpt
+++ b/ext/mysqli/tests/mysqli_get_client_stats_ps.phpt
@@ -14,80 +14,80 @@ mysqlnd.collect_statistics=1
mysqlnd.collect_memory_statistics=1
--FILE--
<?php
- require_once('connect.inc');
- require_once('table.inc');
-
- $stats = mysqli_get_client_stats();
- printf("BEGINNING: rows_fetched_from_client_ps_unbuffered = %d\n", $stats['rows_fetched_from_client_ps_unbuffered']);
- printf("BEGINNING: rows_fetched_from_client_ps_buffered = %d\n", $stats['rows_fetched_from_client_ps_buffered']);
- printf("BEGINNING: rows_fetched_from_client_ps_cursor = %d\n", $stats['rows_fetched_from_client_ps_cursor']);
-
- if (!$stmt = mysqli_stmt_init($link))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- $id = null;
- if (!mysqli_stmt_prepare($stmt, 'SELECT id FROM test') ||
- !mysqli_stmt_execute($stmt) ||
- !mysqli_stmt_store_result($stmt) ||
- !mysqli_stmt_bind_result($stmt, $id))
- printf("[002] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $num_rows = 0;
- while (mysqli_stmt_fetch($stmt))
- $num_rows++;
-
- mysqli_stmt_free_result($stmt);
-
- $after = mysqli_get_client_stats();
-
- if ($after['rows_fetched_from_client_ps_unbuffered'] != $stats['rows_fetched_from_client_ps_unbuffered'])
- printf("[003] Unbuffered rows got increased after buffered PS, expecting %d got %d.\n",
- $stats['rows_fetched_from_client_ps_unbuffered'],
- $after['rows_fetched_from_client_ps_unbuffered']);
-
- $stats['rows_fetched_from_client_ps_buffered'] += $num_rows;
- if ($after['rows_fetched_from_client_ps_buffered'] != $stats['rows_fetched_from_client_ps_buffered'] )
- printf("[005] Buffered rows should be %d got %d.\n",
- $stats['rows_fetched_from_client_ps_buffered'],
- $after['rows_fetched_from_client_ps_buffered']);
-
- $stats = $after;
- printf("BUFFERED: rows_fetched_from_client_ps_unbuffered = %d\n", $stats['rows_fetched_from_client_ps_unbuffered']);
- printf("BUFFERED: rows_fetched_from_client_ps_buffered = %d\n", $stats['rows_fetched_from_client_ps_buffered']);
- printf("BUFFERED: rows_fetched_from_client_ps_cursor = %d\n", $stats['rows_fetched_from_client_ps_cursor']);
-
- $id = null;
- if (!mysqli_stmt_prepare($stmt, 'SELECT id FROM test') ||
- !mysqli_stmt_execute($stmt) ||
- !mysqli_stmt_bind_result($stmt, $id))
- printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $num_rows = 0;
- while (mysqli_stmt_fetch($stmt))
- $num_rows++;
-
- $after = mysqli_get_client_stats();
- $stats['rows_fetched_from_client_ps_unbuffered'] += $num_rows;
- if ($after['rows_fetched_from_client_ps_unbuffered'] != $stats['rows_fetched_from_client_ps_unbuffered'])
- printf("[007] Unbuffered rows should be %d got %d.\n",
- $stats['rows_fetched_from_client_ps_unbuffered'],
- $after['rows_fetched_from_client_ps_unbuffered']);
-
- if ($after['rows_fetched_from_client_ps_buffered'] != $stats['rows_fetched_from_client_ps_buffered'] )
- printf("[005] Buffered rows should be unchanged, expecting %d got %d.\n",
- $stats['rows_fetched_from_client_ps_buffered'],
- $after['rows_fetched_from_client_ps_buffered']);
-
- mysqli_stmt_free_result($stmt);
- mysqli_stmt_close($stmt);
-
- $stats = $after;
- printf("UNBUFFERED: rows_fetched_from_client_ps_unbuffered = %d\n", $stats['rows_fetched_from_client_ps_unbuffered']);
- printf("UNBUFFERED: rows_fetched_from_client_ps_buffered = %d\n", $stats['rows_fetched_from_client_ps_buffered']);
- printf("UNBUFFERED: rows_fetched_from_client_ps_cursor = %d\n", $stats['rows_fetched_from_client_ps_cursor']);
-
- mysqli_close($link);
- print "done!";
+ require_once('connect.inc');
+ require_once('table.inc');
+
+ $stats = mysqli_get_client_stats();
+ printf("BEGINNING: rows_fetched_from_client_ps_unbuffered = %d\n", $stats['rows_fetched_from_client_ps_unbuffered']);
+ printf("BEGINNING: rows_fetched_from_client_ps_buffered = %d\n", $stats['rows_fetched_from_client_ps_buffered']);
+ printf("BEGINNING: rows_fetched_from_client_ps_cursor = %d\n", $stats['rows_fetched_from_client_ps_cursor']);
+
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ $id = null;
+ if (!mysqli_stmt_prepare($stmt, 'SELECT id FROM test') ||
+ !mysqli_stmt_execute($stmt) ||
+ !mysqli_stmt_store_result($stmt) ||
+ !mysqli_stmt_bind_result($stmt, $id))
+ printf("[002] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $num_rows = 0;
+ while (mysqli_stmt_fetch($stmt))
+ $num_rows++;
+
+ mysqli_stmt_free_result($stmt);
+
+ $after = mysqli_get_client_stats();
+
+ if ($after['rows_fetched_from_client_ps_unbuffered'] != $stats['rows_fetched_from_client_ps_unbuffered'])
+ printf("[003] Unbuffered rows got increased after buffered PS, expecting %d got %d.\n",
+ $stats['rows_fetched_from_client_ps_unbuffered'],
+ $after['rows_fetched_from_client_ps_unbuffered']);
+
+ $stats['rows_fetched_from_client_ps_buffered'] += $num_rows;
+ if ($after['rows_fetched_from_client_ps_buffered'] != $stats['rows_fetched_from_client_ps_buffered'] )
+ printf("[005] Buffered rows should be %d got %d.\n",
+ $stats['rows_fetched_from_client_ps_buffered'],
+ $after['rows_fetched_from_client_ps_buffered']);
+
+ $stats = $after;
+ printf("BUFFERED: rows_fetched_from_client_ps_unbuffered = %d\n", $stats['rows_fetched_from_client_ps_unbuffered']);
+ printf("BUFFERED: rows_fetched_from_client_ps_buffered = %d\n", $stats['rows_fetched_from_client_ps_buffered']);
+ printf("BUFFERED: rows_fetched_from_client_ps_cursor = %d\n", $stats['rows_fetched_from_client_ps_cursor']);
+
+ $id = null;
+ if (!mysqli_stmt_prepare($stmt, 'SELECT id FROM test') ||
+ !mysqli_stmt_execute($stmt) ||
+ !mysqli_stmt_bind_result($stmt, $id))
+ printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $num_rows = 0;
+ while (mysqli_stmt_fetch($stmt))
+ $num_rows++;
+
+ $after = mysqli_get_client_stats();
+ $stats['rows_fetched_from_client_ps_unbuffered'] += $num_rows;
+ if ($after['rows_fetched_from_client_ps_unbuffered'] != $stats['rows_fetched_from_client_ps_unbuffered'])
+ printf("[007] Unbuffered rows should be %d got %d.\n",
+ $stats['rows_fetched_from_client_ps_unbuffered'],
+ $after['rows_fetched_from_client_ps_unbuffered']);
+
+ if ($after['rows_fetched_from_client_ps_buffered'] != $stats['rows_fetched_from_client_ps_buffered'] )
+ printf("[005] Buffered rows should be unchanged, expecting %d got %d.\n",
+ $stats['rows_fetched_from_client_ps_buffered'],
+ $after['rows_fetched_from_client_ps_buffered']);
+
+ mysqli_stmt_free_result($stmt);
+ mysqli_stmt_close($stmt);
+
+ $stats = $after;
+ printf("UNBUFFERED: rows_fetched_from_client_ps_unbuffered = %d\n", $stats['rows_fetched_from_client_ps_unbuffered']);
+ printf("UNBUFFERED: rows_fetched_from_client_ps_buffered = %d\n", $stats['rows_fetched_from_client_ps_buffered']);
+ printf("UNBUFFERED: rows_fetched_from_client_ps_cursor = %d\n", $stats['rows_fetched_from_client_ps_cursor']);
+
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_get_client_stats_skipped.phpt b/ext/mysqli/tests/mysqli_get_client_stats_skipped.phpt
index 0358656ab5..f5b03996b8 100644
--- a/ext/mysqli/tests/mysqli_get_client_stats_skipped.phpt
+++ b/ext/mysqli/tests/mysqli_get_client_stats_skipped.phpt
@@ -14,37 +14,37 @@ if (!function_exists('mysqli_get_client_stats')) {
?>
--FILE--
<?php
- require_once('connect.inc');
- require_once('table.inc');
+ require_once('connect.inc');
+ require_once('table.inc');
- if (!$res = mysqli_query($link, 'SELECT id FROM test', MYSQLI_STORE_RESULT))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, 'SELECT id FROM test', MYSQLI_STORE_RESULT))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $num_rows = mysqli_num_rows($res);
- assert($num_rows > 2);
- mysqli_free_result($res);
+ $num_rows = mysqli_num_rows($res);
+ assert($num_rows > 2);
+ mysqli_free_result($res);
- $before = mysqli_get_client_stats();
- printf("BEFORE: rows_skipped_normal = %d\n", $before['rows_skipped_normal']);
+ $before = mysqli_get_client_stats();
+ printf("BEFORE: rows_skipped_normal = %d\n", $before['rows_skipped_normal']);
- if (!$res = mysqli_query($link, 'SELECT id FROM test', MYSQLI_USE_RESULT))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, 'SELECT id FROM test', MYSQLI_USE_RESULT))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- /* fetch all rows but the last one */
- for ($i = 0; $i < $num_rows - 1; $i++)
- $row = mysqli_fetch_assoc($res);
+ /* fetch all rows but the last one */
+ for ($i = 0; $i < $num_rows - 1; $i++)
+ $row = mysqli_fetch_assoc($res);
- /* enforce implicit cleaning of the wire and skipping the last row */
- mysqli_free_result($res);
- $after = mysqli_get_client_stats();
- printf("AFTER: rows_skipped_normal = %d\n", $after['rows_skipped_normal']);
+ /* enforce implicit cleaning of the wire and skipping the last row */
+ mysqli_free_result($res);
+ $after = mysqli_get_client_stats();
+ printf("AFTER: rows_skipped_normal = %d\n", $after['rows_skipped_normal']);
- if ($after['rows_skipped_normal'] != $before['rows_skipped_normal'] + 1)
- printf("Statistics should show an increase of 1 for rows_skipped_normal, ".
- "but before=%d after=%d\n", $before['rows_skipped_normal'], $after['rows_skipped_normal']);
+ if ($after['rows_skipped_normal'] != $before['rows_skipped_normal'] + 1)
+ printf("Statistics should show an increase of 1 for rows_skipped_normal, ".
+ "but before=%d after=%d\n", $before['rows_skipped_normal'], $after['rows_skipped_normal']);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--EXPECTF--
BEFORE: rows_skipped_normal = %d
diff --git a/ext/mysqli/tests/mysqli_get_client_version.phpt b/ext/mysqli/tests/mysqli_get_client_version.phpt
index dbf5e3004a..88e1e85e15 100644
--- a/ext/mysqli/tests/mysqli_get_client_version.phpt
+++ b/ext/mysqli/tests/mysqli_get_client_version.phpt
@@ -5,10 +5,10 @@ mysqli_get_client_version()
<?php require_once('skipifemb.inc'); ?>
--FILE--
<?php
- if (!is_int($info = mysqli_get_client_version()) || ($info < 100))
- printf("[001] Expecting int/any_non_empty, got %s/%s\n", gettype($info), $info);
+ if (!is_int($info = mysqli_get_client_version()) || ($info < 100))
+ printf("[001] Expecting int/any_non_empty, got %s/%s\n", gettype($info), $info);
- print "done!";
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_get_connection_stats.phpt b/ext/mysqli/tests/mysqli_get_connection_stats.phpt
index 80875a44e6..8f1ffb52c9 100644
--- a/ext/mysqli/tests/mysqli_get_connection_stats.phpt
+++ b/ext/mysqli/tests/mysqli_get_connection_stats.phpt
@@ -14,70 +14,63 @@ if (!function_exists('mysqli_get_connection_stats')) {
?>
--FILE--
<?php
- $tmp = $link = null;
- if (!is_null($tmp = @mysqli_get_connection_stats()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ require("table.inc");
- if (!is_null($tmp = @mysqli_get_connection_stats($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_array($info = mysqli_get_connection_stats($link)) || empty($info))
+ printf("[003] Expecting array/any_non_empty, got %s/%s\n", gettype($info), $info);
- require("table.inc");
+ if (!is_array($info2 = mysqli_get_client_stats()) || empty($info2))
+ printf("[004] Expecting array/any_non_empty, got %s/%s\n", gettype($info2), $info2);
- if (!is_array($info = mysqli_get_connection_stats($link)) || empty($info))
- printf("[003] Expecting array/any_non_empty, got %s/%s\n", gettype($info), $info);
+ foreach ($info as $k => &$v) {
+ if (strpos($k, "mem_") === 0) {
+ $v = 0;
+ }
+ }
+ foreach ($info2 as $k => &$v) {
+ if (strpos($k, "mem_") === 0) {
+ $v = 0;
+ }
+ }
- if (!is_array($info2 = mysqli_get_client_stats()) || empty($info2))
- printf("[004] Expecting array/any_non_empty, got %s/%s\n", gettype($info2), $info2);
+ if ($info !== $info2) {
+ printf("[005] The hashes should be identical except of the memory related fields\n");
+ var_dump($info);
+ var_dump($info2);
+ }
- foreach ($info as $k => &$v) {
- if (strpos($k, "mem_") === 0) {
- $v = 0;
- }
- }
- foreach ($info2 as $k => &$v) {
- if (strpos($k, "mem_") === 0) {
- $v = 0;
- }
- }
+ if (!is_array($info = $link->get_connection_stats()) || empty($info))
+ printf("[006] Expecting array/any_non_empty, got %s/%s\n", gettype($info), $info);
- if ($info !== $info2) {
- printf("[005] The hashes should be identical except of the memory related fields\n");
- var_dump($info);
- var_dump($info2);
- }
+ foreach ($info as $k => &$v) {
+ if (strpos($k, "mem_") === 0) {
+ $v = 0;
+ }
+ }
- if (!is_array($info = $link->get_connection_stats()) || empty($info))
- printf("[006] Expecting array/any_non_empty, got %s/%s\n", gettype($info), $info);
+ if ($info !== $info2) {
+ printf("[007] The hashes should be identical except of the memory related fields\n");
+ var_dump($info);
+ var_dump($info2);
+ }
- foreach ($info as $k => &$v) {
- if (strpos($k, "mem_") === 0) {
- $v = 0;
- }
- }
+ mysqli_close($link);
+ require("table.inc");
- if ($info !== $info2) {
- printf("[007] The hashes should be identical except of the memory related fields\n");
- var_dump($info);
- var_dump($info2);
- }
+ if (!is_array($info = mysqli_get_connection_stats($link)) || empty($info))
+ printf("[008] Expecting array/any_non_empty, got %s/%s\n", gettype($info), $info);
- mysqli_close($link);
- require("table.inc");
+ if (!is_array($info2 = mysqli_get_client_stats()) || empty($info2))
+ printf("[009] Expecting array/any_non_empty, got %s/%s\n", gettype($info2), $info2);
- if (!is_array($info = mysqli_get_connection_stats($link)) || empty($info))
- printf("[008] Expecting array/any_non_empty, got %s/%s\n", gettype($info), $info);
+ // assuming the test is run in a plain-vanilla CLI environment
+ if ($info === $info2) {
+ printf("[010] The hashes should not be identical\n");
+ var_dump($info);
+ var_dump($info2);
+ }
- if (!is_array($info2 = mysqli_get_client_stats()) || empty($info2))
- printf("[009] Expecting array/any_non_empty, got %s/%s\n", gettype($info2), $info2);
-
- // assuming the test is run in a plain-vanilla CLI environment
- if ($info === $info2) {
- printf("[010] The hashes should not be identical\n");
- var_dump($info);
- var_dump($info2);
- }
-
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_get_connection_stats_off.phpt b/ext/mysqli/tests/mysqli_get_connection_stats_off.phpt
index a91d84413c..9dcfbe795c 100644
--- a/ext/mysqli/tests/mysqli_get_connection_stats_off.phpt
+++ b/ext/mysqli/tests/mysqli_get_connection_stats_off.phpt
@@ -14,40 +14,40 @@ if (!function_exists('mysqli_get_connection_stats')) {
?>
--FILE--
<?php
- // connect and table inc connect to mysql and create tables
- require_once('connect.inc');
+ // connect and table inc connect to mysql and create tables
+ require_once('connect.inc');
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
- $before = mysqli_get_connection_stats($link);
- if (!is_array($before) || empty($before)) {
- printf("[002] Expecting non-empty array, got %s.\n", gettype($before));
- var_dump($before);
- }
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
+ $before = mysqli_get_connection_stats($link);
+ if (!is_array($before) || empty($before)) {
+ printf("[002] Expecting non-empty array, got %s.\n", gettype($before));
+ var_dump($before);
+ }
- mysqli_close($link);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
- $after = mysqli_get_connection_stats($link);
+ mysqli_close($link);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
+ $after = mysqli_get_connection_stats($link);
- if ($before !== $after) {
- printf("[004] Statistics differ!");
- var_dump($before);
- var_dump($after);
- }
+ if ($before !== $after) {
+ printf("[004] Statistics differ!");
+ var_dump($before);
+ var_dump($after);
+ }
- foreach ($after as $k => $v)
- if ($v != 0) {
- printf("[004] Field %s should not have any other value but 0, got %s.\n",
- $k, $v);
- }
+ foreach ($after as $k => $v)
+ if ($v != 0) {
+ printf("[004] Field %s should not have any other value but 0, got %s.\n",
+ $k, $v);
+ }
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_get_host_info.phpt b/ext/mysqli/tests/mysqli_get_host_info.phpt
index ada57f7d9f..072ebc87ad 100644
--- a/ext/mysqli/tests/mysqli_get_host_info.phpt
+++ b/ext/mysqli/tests/mysqli_get_host_info.phpt
@@ -8,24 +8,18 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!is_null($tmp = @mysqli_get_host_info()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ require "table.inc";
+ if (!is_string($info = mysqli_get_host_info($link)) || ('' === $info))
+ printf("[003] Expecting string/any_non_empty, got %s/%s\n", gettype($info), $info);
- if (!is_null($tmp = @mysqli_get_host_info(NULL)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- require "table.inc";
- if (!is_string($info = mysqli_get_host_info($link)) || ('' === $info))
- printf("[003] Expecting string/any_non_empty, got %s/%s\n", gettype($info), $info);
-
- if ($IS_MYSQLND && $host != 'localhost' && $host != '127.0.0.1' && $port != '' && $host != "" && strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
- /* this should be a TCP/IP connection and not a Unix Socket (or SHM or Named Pipe) */
- if (!stristr($info, "TCP/IP"))
- printf("[004] Should be a TCP/IP connection but mysqlnd says '%s'\n", $info);
- }
- print "done!";
+ if ($IS_MYSQLND && $host != 'localhost' && $host != '127.0.0.1' && $port != '' && $host != "" && strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
+ /* this should be a TCP/IP connection and not a Unix Socket (or SHM or Named Pipe) */
+ if (!stristr($info, "TCP/IP"))
+ printf("[004] Should be a TCP/IP connection but mysqlnd says '%s'\n", $info);
+ }
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_get_proto_info.phpt b/ext/mysqli/tests/mysqli_get_proto_info.phpt
index b24ab11fbd..2eeae3d03a 100644
--- a/ext/mysqli/tests/mysqli_get_proto_info.phpt
+++ b/ext/mysqli/tests/mysqli_get_proto_info.phpt
@@ -8,22 +8,13 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!is_null($tmp = @mysqli_get_proto_info()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ require "table.inc";
+ if (!is_int($info = mysqli_get_proto_info($link)) || ($info < 1))
+ printf("[003] Expecting int/any_non_empty, got %s/%s\n", gettype($info), $info);
- if (!is_null($tmp = @mysqli_get_proto_info(NULL)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- require "table.inc";
- if (!is_int($info = mysqli_get_proto_info($link)) || ($info < 1))
- printf("[003] Expecting int/any_non_empty, got %s/%s\n", gettype($info), $info);
-
- if (!is_null($tmp = @mysqli_get_proto_info('too many', 'arguments')))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!";
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_get_server_info.phpt b/ext/mysqli/tests/mysqli_get_server_info.phpt
index 3ea1b4a70d..3a1e08e029 100644
--- a/ext/mysqli/tests/mysqli_get_server_info.phpt
+++ b/ext/mysqli/tests/mysqli_get_server_info.phpt
@@ -8,22 +8,13 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!is_null($tmp = @mysqli_get_server_info()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ require "table.inc";
+ if (!is_string($info = mysqli_get_server_info($link)) || ('' === $info))
+ printf("[003] Expecting string/any_non_empty, got %s/%s\n", gettype($info), $info);
- if (!is_null($tmp = @mysqli_get_server_info(NULL)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- require "table.inc";
- if (!is_string($info = mysqli_get_server_info($link)) || ('' === $info))
- printf("[003] Expecting string/any_non_empty, got %s/%s\n", gettype($info), $info);
-
- if (!is_null($tmp = @mysqli_get_server_info('too', 'many arguments')))
- printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_get_server_version.phpt b/ext/mysqli/tests/mysqli_get_server_version.phpt
index ddbf4e73bb..c249d70885 100644
--- a/ext/mysqli/tests/mysqli_get_server_version.phpt
+++ b/ext/mysqli/tests/mysqli_get_server_version.phpt
@@ -8,21 +8,15 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!is_null($tmp = @mysqli_get_server_version()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ require "table.inc";
+ /* 5.1.5 -> 50105 -- major_version*10000 + minor_version *100 + sub_version */
+ /* < 30000 = pre 3.2.3, very unlikely! */
+ if (!is_int($info = mysqli_get_server_version($link)) || ($info < (3 * 10000)))
+ printf("[003] Expecting int/any >= 30000, got %s/%s\n", gettype($info), $info);
- if (!is_null($tmp = @mysqli_get_server_version(NULL)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- require "table.inc";
- /* 5.1.5 -> 50105 -- major_version*10000 + minor_version *100 + sub_version */
- /* < 30000 = pre 3.2.3, very unlikely! */
- if (!is_int($info = mysqli_get_server_version($link)) || ($info < (3 * 10000)))
- printf("[003] Expecting int/any >= 30000, got %s/%s\n", gettype($info), $info);
-
- print "done!";
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_get_warnings.phpt b/ext/mysqli/tests/mysqli_get_warnings.phpt
index b0076c1859..20b2607f39 100644
--- a/ext/mysqli/tests/mysqli_get_warnings.phpt
+++ b/ext/mysqli/tests/mysqli_get_warnings.phpt
@@ -11,135 +11,135 @@ if (!$TEST_EXPERIMENTAL)
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_get_warnings()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_get_warnings()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_get_warnings($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_get_warnings($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_get_warnings('')))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = @mysqli_get_warnings('')))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[003] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- }
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[003] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
- if (false !== ($tmp = mysqli_get_warnings($link))) {
- printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp));
- }
+ if (false !== ($tmp = mysqli_get_warnings($link))) {
+ printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp));
+ }
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "CREATE TABLE test (id SMALLINT)"))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "CREATE TABLE test (id SMALLINT)"))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "INSERT INTO test (id) VALUES (1000000)"))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "INSERT INTO test (id) VALUES (1000000)"))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_object($warning = mysqli_get_warnings($link)) || 'mysqli_warning' != get_class($warning)) {
- printf("[008] Expecting object/mysqli_warning, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp));
- }
+ if (!is_object($warning = mysqli_get_warnings($link)) || 'mysqli_warning' != get_class($warning)) {
+ printf("[008] Expecting object/mysqli_warning, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp));
+ }
- if (!method_exists($warning, 'next'))
- printf("[009] Borked object, method next is missing\n");
+ if (!method_exists($warning, 'next'))
+ printf("[009] Borked object, method next is missing\n");
- $properties = array_merge(get_object_vars($warning), get_class_vars(get_class($warning)));
- if (!empty($properties))
- printf("[010] Properties have always been magic, hidden things - why are they visible now, a BC break...\n");
+ $properties = array_merge(get_object_vars($warning), get_class_vars(get_class($warning)));
+ if (!empty($properties))
+ printf("[010] Properties have always been magic, hidden things - why are they visible now, a BC break...\n");
- if ((!is_string($warning->message)) || ('' == $warning->message)) /* NULL or not there at all */
- printf("[011] Expecting string/not empty, got %s/%s\n", gettype($warning->message), $warning->message);
+ if ((!is_string($warning->message)) || ('' == $warning->message)) /* NULL or not there at all */
+ printf("[011] Expecting string/not empty, got %s/%s\n", gettype($warning->message), $warning->message);
- if ((!is_string($warning->sqlstate)) || ('' == $warning->sqlstate)) /* NULL or not there at all */
- printf("[012] Expecting string/not empty, got %s/%s\n", gettype($warning->sqlstate), $warning->sqlstate);
+ if ((!is_string($warning->sqlstate)) || ('' == $warning->sqlstate)) /* NULL or not there at all */
+ printf("[012] Expecting string/not empty, got %s/%s\n", gettype($warning->sqlstate), $warning->sqlstate);
- if ((!is_int($warning->errno)) || (0 == $warning->errno)) /* NULL or not there at all */
- printf("[013] Expecting int/not 0, got %s/%s\n", gettype($warning->errno), $warning->errno);
+ if ((!is_int($warning->errno)) || (0 == $warning->errno)) /* NULL or not there at all */
+ printf("[013] Expecting int/not 0, got %s/%s\n", gettype($warning->errno), $warning->errno);
- if (false !== ($tmp = $warning->next()))
- printf("[014] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = $warning->next()))
+ printf("[014] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_query($link, "INSERT INTO test (id) VALUES (1000000), (1000001)"))
- printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "INSERT INTO test (id) VALUES (1000000), (1000001)"))
+ printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (($tmp = mysqli_warning_count($link)) !== 2)
- printf("[016] Expecting 2 warnings, got %d warnings", $tmp);
+ if (($tmp = mysqli_warning_count($link)) !== 2)
+ printf("[016] Expecting 2 warnings, got %d warnings", $tmp);
- if (!is_object($warning = mysqli_get_warnings($link)) || 'mysqli_warning' != get_class($warning)) {
- printf("[017] Expecting object/mysqli_warning, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp));
- }
+ if (!is_object($warning = mysqli_get_warnings($link)) || 'mysqli_warning' != get_class($warning)) {
+ printf("[017] Expecting object/mysqli_warning, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp));
+ }
- if (true !== ($tmp = $warning->next()))
- printf("[018] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = $warning->next()))
+ printf("[018] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (false !== ($tmp = $warning->next()))
- printf("[020] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = $warning->next()))
+ printf("[020] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
+ mysqli_close($link);
- if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[021] Cannot create mysqli object: [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[021] Cannot create mysqli object: [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- if (!$mysqli->query("DROP TABLE IF EXISTS t1"))
- printf("[022] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$mysqli->query("DROP TABLE IF EXISTS t1"))
+ printf("[022] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$mysqli->query("CREATE TABLE t1 (a smallint)"))
- printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$mysqli->query("CREATE TABLE t1 (a smallint)"))
+ printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_object($warning = new mysqli_warning($mysqli)))
- printf("[024] Expecting object/mysqli_warning, got %s/%s", gettype($warning), $warning);
+ if (!is_object($warning = new mysqli_warning($mysqli)))
+ printf("[024] Expecting object/mysqli_warning, got %s/%s", gettype($warning), $warning);
- if (!is_string($warning->message) || ('' == $warning->message))
- printf("[025] Expecting string, got %s/%s", gettype($warning->message), $warning->message);
+ if (!is_string($warning->message) || ('' == $warning->message))
+ printf("[025] Expecting string, got %s/%s", gettype($warning->message), $warning->message);
- if (!$mysqli->query("DROP TABLE t1"))
- printf("[026] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$mysqli->query("DROP TABLE t1"))
+ printf("[026] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- /* Yes, I really want to check if the object property is empty */
- if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[027] Cannot create mysqli object: [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ /* Yes, I really want to check if the object property is empty */
+ if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[027] Cannot create mysqli object: [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- $warning = new mysqli_warning($mysqli);
- if (false !== ($tmp = $warning->next()))
- printf("[028] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ $warning = new mysqli_warning($mysqli);
+ if (false !== ($tmp = $warning->next()))
+ printf("[028] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- if ('' != ($tmp = $warning->message))
- printf("[029] Expecting string/empty, got %s/%s\n", gettype($tmp), $tmp);
+ if ('' != ($tmp = $warning->message))
+ printf("[029] Expecting string/empty, got %s/%s\n", gettype($tmp), $tmp);
- if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[030] Cannot create mysqli object: [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[030] Cannot create mysqli object: [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- if (!$mysqli->query("DROP TABLE IF EXISTS t1"))
- printf("[031] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$mysqli->query("DROP TABLE IF EXISTS t1"))
+ printf("[031] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$mysqli->query("CREATE TABLE t1 (a smallint)"))
- printf("[032] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$mysqli->query("CREATE TABLE t1 (a smallint)"))
+ printf("[032] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- /* out of range, three warnings */
- if (!$mysqli->query("INSERT IGNORE INTO t1(a) VALUES (65536), (65536), (65536)"))
- printf("[033] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ /* out of range, three warnings */
+ if (!$mysqli->query("INSERT IGNORE INTO t1(a) VALUES (65536), (65536), (65536)"))
+ printf("[033] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $warning = new mysqli_warning($mysqli);
- $i = 1;
- while ($warning->next() && ('' != ($tmp = $warning->message))) {
- $i++;
- }
- if (3 != $i)
- printf("[034] Expecting three warnings, got %d warnings\n", $i);
+ $warning = new mysqli_warning($mysqli);
+ $i = 1;
+ while ($warning->next() && ('' != ($tmp = $warning->message))) {
+ $i++;
+ }
+ if (3 != $i)
+ printf("[034] Expecting three warnings, got %d warnings\n", $i);
- $stmt = mysqli_stmt_init();
- $warning = new mysqli_warning($stmt);
- if (false !== ($tmp = $warning->next()))
- printf("[035] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ $stmt = mysqli_stmt_init();
+ $warning = new mysqli_warning($stmt);
+ if (false !== ($tmp = $warning->next()))
+ printf("[035] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
<?php
require_once("connect.inc");
@@ -147,10 +147,10 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
- printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
if (!mysqli_query($link, "DROP TABLE IF EXISTS t1"))
- printf("[c003] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ printf("[c003] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
mysqli_close($link);
?>
diff --git a/ext/mysqli/tests/mysqli_info.phpt b/ext/mysqli/tests/mysqli_info.phpt
index 56ee2cce05..e0736701ac 100644
--- a/ext/mysqli/tests/mysqli_info.phpt
+++ b/ext/mysqli/tests/mysqli_info.phpt
@@ -10,87 +10,81 @@ require_once('skipifconnectfailure.inc');
mysqli.allow_local_infile=1
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!is_null($tmp = @mysqli_info()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ require "table.inc";
+ if (!$res = mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, 'a')"))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_null($tmp = @mysqli_info(NULL)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ // NOTE: empty string, no multiple insert syntax
+ if (!is_null($tmp = mysqli_info($link)) || ('' != $tmp))
+ printf("[004] Expecting null, got %s/%s\n", gettype($tmp), $tmp);
- require "table.inc";
- if (!$res = mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, 'a')"))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, "INSERT INTO test(id, label) VALUES (101, 'a'), (102, 'b')"))
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- // NOTE: empty string, no multiple insert syntax
- if (!is_null($tmp = mysqli_info($link)) || ('' != $tmp))
- printf("[004] Expecting null, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_string($tmp = mysqli_info($link)) || ('' == $tmp))
+ printf("[006] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp);
- if (!$res = mysqli_query($link, "INSERT INTO test(id, label) VALUES (101, 'a'), (102, 'b')"))
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, 'INSERT INTO test(id, label) SELECT id + 200, label FROM test'))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_string($tmp = mysqli_info($link)) || ('' == $tmp))
- printf("[006] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_string($tmp = mysqli_info($link)) || ('' == $tmp))
+ printf("[008] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp);
- if (!$res = mysqli_query($link, 'INSERT INTO test(id, label) SELECT id + 200, label FROM test'))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, 'ALTER TABLE test MODIFY label CHAR(2)'))
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_string($tmp = mysqli_info($link)) || ('' == $tmp))
- printf("[008] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_string($tmp = mysqli_info($link)) || ('' == $tmp))
+ printf("[010] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp);
- if (!$res = mysqli_query($link, 'ALTER TABLE test MODIFY label CHAR(2)'))
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, "UPDATE test SET label = 'b' WHERE id >= 100"))
+ printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_string($tmp = mysqli_info($link)) || ('' == $tmp))
- printf("[010] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_string($tmp = mysqli_info($link)) || ('' == $tmp))
+ printf("[012] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp);
- if (!$res = mysqli_query($link, "UPDATE test SET label = 'b' WHERE id >= 100"))
- printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, "SELECT 1"))
+ printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_string($tmp = mysqli_info($link)) || ('' == $tmp))
- printf("[012] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = mysqli_info($link)) || ('' != $tmp))
+ printf("[014] Expecting null, got %s/%s\n", gettype($tmp), $tmp);
+ mysqli_free_result($res);
- if (!$res = mysqli_query($link, "SELECT 1"))
- printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ // NOTE: no LOAD DATA INFILE test
+ if ($dir = sys_get_temp_dir()) {
+ do {
+ $file = $dir . '/' . 'mysqli_info_phpt.cvs';
+ if (!$fp = fopen($file, 'w'))
+ /* ignore this error */
+ break;
- if (!is_null($tmp = mysqli_info($link)) || ('' != $tmp))
- printf("[014] Expecting null, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_free_result($res);
+ if (!fwrite($fp, "100;'a';\n") ||
+ !fwrite($fp, "101;'b';\n") ||
+ !fwrite($fp, "102;'c';\n")) {
+ @unlink($file);
+ break;
+ }
+ fclose($fp);
+ if (!mysqli_query($link, "DELETE FROM test")) {
+ printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ break;
+ }
- // NOTE: no LOAD DATA INFILE test
- if ($dir = sys_get_temp_dir()) {
- do {
- $file = $dir . '/' . 'mysqli_info_phpt.cvs';
- if (!$fp = fopen($file, 'w'))
- /* ignore this error */
- break;
+ if (!@mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s' INTO TABLE test FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\'' LINES TERMINATED BY '\n'", $file))) {
+ /* ok, because we might not be allowed to do this */
+ @unlink($file);
+ break;
+ }
- if (!fwrite($fp, "100;'a';\n") ||
- !fwrite($fp, "101;'b';\n") ||
- !fwrite($fp, "102;'c';\n")) {
- @unlink($file);
- break;
- }
- fclose($fp);
- if (!mysqli_query($link, "DELETE FROM test")) {
- printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- break;
- }
+ if (!is_string($tmp = mysqli_info($link)) || ('' == $tmp))
+ printf("[016] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp);
- if (!@mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s' INTO TABLE test FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\'' LINES TERMINATED BY '\n'", $file))) {
- /* ok, because we might not be allowed to do this */
- @unlink($file);
- break;
- }
+ unlink($file);
+ } while (false);
+ }
- if (!is_string($tmp = mysqli_info($link)) || ('' == $tmp))
- printf("[016] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp);
-
- unlink($file);
- } while (false);
- }
-
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_init.phpt b/ext/mysqli/tests/mysqli_init.phpt
index 01e53d5fe8..c8f3ac8ec5 100644
--- a/ext/mysqli/tests/mysqli_init.phpt
+++ b/ext/mysqli/tests/mysqli_init.phpt
@@ -8,18 +8,18 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- $link = mysqli_init();
+ $link = mysqli_init();
- if (!is_object($link) && false !== $link)
- printf("[001] Expecting object/mysqli_link or boolean/false, got %s/%s\n", gettype($link), $link);
+ if (!is_object($link) && false !== $link)
+ printf("[001] Expecting object/mysqli_link or boolean/false, got %s/%s\n", gettype($link), $link);
- if (is_object($link) && 'mysqli' != get_class($link))
- printf("[002] Expecting object of type mysqli got object of type %s\n", get_class($link));
+ if (is_object($link) && 'mysqli' != get_class($link))
+ printf("[002] Expecting object of type mysqli got object of type %s\n", get_class($link));
- if ($link)
- mysqli_close($link);
+ if ($link)
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_insert_id.phpt b/ext/mysqli/tests/mysqli_insert_id.phpt
index 7d4c0e085c..a9fc31998d 100644
--- a/ext/mysqli/tests/mysqli_insert_id.phpt
+++ b/ext/mysqli/tests/mysqli_insert_id.phpt
@@ -8,133 +8,127 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_insert_id()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_insert_id($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- require('table.inc');
-
- if (0 !== ($tmp = mysqli_insert_id($link)))
- printf("[003] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id LIMIT 1")) {
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- if (0 !== ($tmp = mysqli_insert_id($link)))
- printf("[005] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_free_result($res);
-
- // no auto_increment column
- if (!$res = mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, 'a')")) {
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- if (0 !== ($tmp = mysqli_insert_id($link)))
- printf("[007] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!$res = mysqli_query($link, "ALTER TABLE test MODIFY id INT NOT NULL AUTO_INCREMENT")) {
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
-
- if (!$res = mysqli_query($link, "INSERT INTO test(label) VALUES ('a')")) {
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- if (($last_id = mysqli_insert_id($link)) <= 0)
- printf("[010] Expecting int/any >0, got %s/%s\n", gettype($last_id), $last_id);
-
- if (mysqli_query($link, "LOCK TABLE test WRITE")) {
- /* we need exclusive access for a moment */
- /* let's hope nobody changes auto_increment_increment while this code executes */
- do {
- if (mysqli_get_server_version($link) >= 50000) {
- if (!$res = mysqli_query($link, 'SELECT @@auto_increment_increment AS inc')) {
- printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- break;
- }
- if (!$row = mysqli_fetch_assoc($res)) {
- printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- break;
- }
- mysqli_free_result($res);
- $inc = $row['inc'];
- } else {
- $inc = 1;
- }
-
- if (!mysqli_query($link, "INSERT INTO test(label) VALUES ('b')")) {
- printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- break;
- }
- if (($next_id = mysqli_insert_id($link)) <= $last_id)
- /*
- very likely a bug, but someone could have done something on the server
- between the second last insert and the lock, therefore don't stop just bail
- */
- printf("[014] Expecting int/any > %d, got %s/%s\n", $last_id, gettype($next_id), $next_id);
-
- $last_id = $next_id;
- if (!mysqli_query($link, "INSERT INTO test(label) VALUES ('c'), ('d'), ('e')")) {
- printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- break;
- }
- /*
- Note: For a multiple-row insert, LAST_INSERT_ID() and mysql_insert_id() actually
- return the AUTO_INCREMENT key from the first of the inserted rows. This allows
- multiple-row inserts to be reproduced correctly on other servers in a replication setup.
- */
- if (($next_id = mysqli_insert_id($link)) != $last_id + $inc) {
- printf("[016] Expecting int/%d, got %s/%s\n", $last_id + 1, gettype($next_id), $next_id);
- break;
- }
-
- if (!$res = mysqli_query($link, "SELECT LAST_INSERT_ID() AS last_id")) {
- printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- break;
- }
- if (!$row = mysqli_fetch_assoc($res)) {
- printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- break;
- }
- mysqli_free_result($res);
-
- if ($next_id != $row['last_id']) {
- printf("[019] Something is wrong, check manually. Expecting %s got %s.\n",
- $next_id, $row['last_id']);
- break;
- }
- } while (false);
- mysqli_query($link, "UNLOCK TABLE test");
- }
-
- if (!$res = mysqli_query($link, "INSERT INTO test(id, label) VALUES (1000, 'a')")) {
- printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- if (1000 !== ($tmp = mysqli_insert_id($link)))
- printf("[021] Expecting int/1000, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!$res = mysqli_query($link, "INSERT INTO test(label) VALUES ('b'), ('c')")) {
- printf("[022] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- if (1000 >= ($tmp = mysqli_insert_id($link)))
- printf("[023] Expecting int/>1000, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_close($link);
-
- var_dump(mysqli_insert_id($link));
-
- print "done!";
+ require_once("connect.inc");
+
+ require('table.inc');
+
+ if (0 !== ($tmp = mysqli_insert_id($link)))
+ printf("[003] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id LIMIT 1")) {
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ if (0 !== ($tmp = mysqli_insert_id($link)))
+ printf("[005] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+ mysqli_free_result($res);
+
+ // no auto_increment column
+ if (!$res = mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, 'a')")) {
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ if (0 !== ($tmp = mysqli_insert_id($link)))
+ printf("[007] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!$res = mysqli_query($link, "ALTER TABLE test MODIFY id INT NOT NULL AUTO_INCREMENT")) {
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ if (!$res = mysqli_query($link, "INSERT INTO test(label) VALUES ('a')")) {
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ if (($last_id = mysqli_insert_id($link)) <= 0)
+ printf("[010] Expecting int/any >0, got %s/%s\n", gettype($last_id), $last_id);
+
+ if (mysqli_query($link, "LOCK TABLE test WRITE")) {
+ /* we need exclusive access for a moment */
+ /* let's hope nobody changes auto_increment_increment while this code executes */
+ do {
+ if (mysqli_get_server_version($link) >= 50000) {
+ if (!$res = mysqli_query($link, 'SELECT @@auto_increment_increment AS inc')) {
+ printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ break;
+ }
+ if (!$row = mysqli_fetch_assoc($res)) {
+ printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ break;
+ }
+ mysqli_free_result($res);
+ $inc = $row['inc'];
+ } else {
+ $inc = 1;
+ }
+
+ if (!mysqli_query($link, "INSERT INTO test(label) VALUES ('b')")) {
+ printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ break;
+ }
+ if (($next_id = mysqli_insert_id($link)) <= $last_id)
+ /*
+ very likely a bug, but someone could have done something on the server
+ between the second last insert and the lock, therefore don't stop just bail
+ */
+ printf("[014] Expecting int/any > %d, got %s/%s\n", $last_id, gettype($next_id), $next_id);
+
+ $last_id = $next_id;
+ if (!mysqli_query($link, "INSERT INTO test(label) VALUES ('c'), ('d'), ('e')")) {
+ printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ break;
+ }
+ /*
+ Note: For a multiple-row insert, LAST_INSERT_ID() and mysql_insert_id() actually
+ return the AUTO_INCREMENT key from the first of the inserted rows. This allows
+ multiple-row inserts to be reproduced correctly on other servers in a replication setup.
+ */
+ if (($next_id = mysqli_insert_id($link)) != $last_id + $inc) {
+ printf("[016] Expecting int/%d, got %s/%s\n", $last_id + 1, gettype($next_id), $next_id);
+ break;
+ }
+
+ if (!$res = mysqli_query($link, "SELECT LAST_INSERT_ID() AS last_id")) {
+ printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ break;
+ }
+ if (!$row = mysqli_fetch_assoc($res)) {
+ printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ break;
+ }
+ mysqli_free_result($res);
+
+ if ($next_id != $row['last_id']) {
+ printf("[019] Something is wrong, check manually. Expecting %s got %s.\n",
+ $next_id, $row['last_id']);
+ break;
+ }
+ } while (false);
+ mysqli_query($link, "UNLOCK TABLE test");
+ }
+
+ if (!$res = mysqli_query($link, "INSERT INTO test(id, label) VALUES (1000, 'a')")) {
+ printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ if (1000 !== ($tmp = mysqli_insert_id($link)))
+ printf("[021] Expecting int/1000, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!$res = mysqli_query($link, "INSERT INTO test(label) VALUES ('b'), ('c')")) {
+ printf("[022] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ if (1000 >= ($tmp = mysqli_insert_id($link)))
+ printf("[023] Expecting int/>1000, got %s/%s\n", gettype($tmp), $tmp);
+
+ mysqli_close($link);
+
+ try {
+ mysqli_insert_id($link);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
---EXPECTF--
-Warning: mysqli_insert_id(): Couldn't fetch mysqli in %s on line %d
-bool(false)
+--EXPECT--
+mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_insert_packet_overflow.phpt b/ext/mysqli/tests/mysqli_insert_packet_overflow.phpt
index 496e5e48fe..fc6b6a3ad7 100644
--- a/ext/mysqli/tests/mysqli_insert_packet_overflow.phpt
+++ b/ext/mysqli/tests/mysqli_insert_packet_overflow.phpt
@@ -21,92 +21,92 @@ mysqli_close($link);
memory_limit=256M
--FILE--
<?php
- require('connect.inc');
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ require('connect.inc');
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- if (!$res = mysqli_query($link, "SHOW GLOBAL VARIABLES LIKE 'max_allowed_packet'"))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, "SHOW GLOBAL VARIABLES LIKE 'max_allowed_packet'"))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$row = mysqli_fetch_assoc($res))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
+ mysqli_free_result($res);
- if (0 === ($org_max_allowed_packet = (int)$row['Value']))
- printf("[004] Cannot determine max_allowed_packet size and/or bogus max_allowed_packet setting used.\n");
+ if (0 === ($org_max_allowed_packet = (int)$row['Value']))
+ printf("[004] Cannot determine max_allowed_packet size and/or bogus max_allowed_packet setting used.\n");
- $max_len = pow(2, 24);
- if ($org_max_allowed_packet < $max_len) {
- if (!mysqli_query($link, "SET GLOBAL max_allowed_packet = " . ($max_len + 100))) {
- if (1227 == mysqli_errno($link)) {
- /* [1227] Access denied; you need the SUPER privilege for this operation */
- print "done!";
- exit(0);
- } else {
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- }
- }
- mysqli_close($link);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[006] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ $max_len = pow(2, 24);
+ if ($org_max_allowed_packet < $max_len) {
+ if (!mysqli_query($link, "SET GLOBAL max_allowed_packet = " . ($max_len + 100))) {
+ if (1227 == mysqli_errno($link)) {
+ /* [1227] Access denied; you need the SUPER privilege for this operation */
+ print "done!";
+ exit(0);
+ } else {
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ }
+ }
+ mysqli_close($link);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[006] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- if (!mysqli_query($link, "SET NAMES 'latin1'"))
- printf("[007] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ if (!mysqli_query($link, "SET NAMES 'latin1'"))
+ printf("[007] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- if (!$res = mysqli_query($link, "SHOW GLOBAL VARIABLES LIKE 'max_allowed_packet'"))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, "SHOW GLOBAL VARIABLES LIKE 'max_allowed_packet'"))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$row = mysqli_fetch_assoc($res))
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
+ mysqli_free_result($res);
- if (0 === ($max_allowed_packet = (int)$row['Value']))
- printf("[010] Cannot determine max_allowed_packet size and/or bogus max_allowed_packet setting used.\n");
+ if (0 === ($max_allowed_packet = (int)$row['Value']))
+ printf("[010] Cannot determine max_allowed_packet size and/or bogus max_allowed_packet setting used.\n");
- $max_len = pow(2, 24);
- if ($max_allowed_packet < $max_len) {
- printf("[011] Failed to change max_allowed_packet");
- }
+ $max_len = pow(2, 24);
+ if ($max_allowed_packet < $max_len) {
+ printf("[011] Failed to change max_allowed_packet");
+ }
- if (!mysqli_query($link, "CREATE TABLE test(col_blob LONGBLOB) ENGINE=" . $engine))
- printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "CREATE TABLE test(col_blob LONGBLOB) ENGINE=" . $engine))
+ printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $query_prefix = "INSERT INTO test(col_blob) VALUES ('";
- $query_postfix = "')";
- $query_len = strlen($query_prefix) + strlen($query_postfix);
- $com_query_len = 2;
+ $query_prefix = "INSERT INTO test(col_blob) VALUES ('";
+ $query_postfix = "')";
+ $query_len = strlen($query_prefix) + strlen($query_postfix);
+ $com_query_len = 2;
- $blob = str_repeat('a', $max_len - $com_query_len - $query_len);
- $query = sprintf("%s%s%s", $query_prefix, $blob, $query_postfix);
+ $blob = str_repeat('a', $max_len - $com_query_len - $query_len);
+ $query = sprintf("%s%s%s", $query_prefix, $blob, $query_postfix);
- if (!mysqli_query($link, $query))
- printf("[013] max_allowed_packet = %d, strlen(query) = %d, [%d] %s\n", $max_allowed_packet, strlen($query), mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, $query))
+ printf("[013] max_allowed_packet = %d, strlen(query) = %d, [%d] %s\n", $max_allowed_packet, strlen($query), mysqli_errno($link), mysqli_error($link));
- if (!$res = mysqli_query($link, "SELECT col_blob FROM test"))
- printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, "SELECT col_blob FROM test"))
+ printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$row = mysqli_fetch_assoc($res)) {
- printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- } else {
- if ($row['col_blob'] != $blob) {
- printf("[016] Blob seems wrong, dumping data\n");
- var_dump(strlen($row['col_blob']));
- var_dump(strlen($blob));
- }
- mysqli_free_result($res);
- }
+ if (!$row = mysqli_fetch_assoc($res)) {
+ printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ } else {
+ if ($row['col_blob'] != $blob) {
+ printf("[016] Blob seems wrong, dumping data\n");
+ var_dump(strlen($row['col_blob']));
+ var_dump(strlen($blob));
+ }
+ mysqli_free_result($res);
+ }
- if (!mysqli_query($link, "SET GLOBAL max_allowed_packet = " . $org_max_allowed_packet))
- if (1227 != mysqli_errno($link))
- printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "SET GLOBAL max_allowed_packet = " . $org_max_allowed_packet))
+ if (1227 != mysqli_errno($link))
+ printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_close($link);
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_kill.phpt b/ext/mysqli/tests/mysqli_kill.phpt
index 8b4e36afd4..943e213a81 100644
--- a/ext/mysqli/tests/mysqli_kill.phpt
+++ b/ext/mysqli/tests/mysqli_kill.phpt
@@ -8,70 +8,61 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_kill()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_kill($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- require('table.inc');
-
- // Zend will cast the NULL to 0
- if (!is_bool($tmp = mysqli_kill($link, null)))
- printf("[003] Expecting boolean/any, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!$thread_id = mysqli_thread_id($link))
- printf("[004] Cannot determine thread id, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- $tmp = mysqli_kill($link, $thread_id);
- if (!is_bool($tmp))
- printf("[005] Expecting boolean/any, got %s/%s\n", gettype($tmp), $tmp);
-
- if ($res = mysqli_query($link, "SELECT id FROM test LIMIT 1"))
- pintf("[006] Expecting boolean/false, got %s/%s\n", gettype($res), $res);
-
- var_dump($error = mysqli_error($link));
- if (!is_string($error) || ('' === $error))
- printf("[007] Expecting string/any non empty, got %s/%s\n", gettype($error), $error);
- var_dump($res);
- var_dump($link);
- if ($IS_MYSQLND) {
- if ($link->info != 'Records: 6 Duplicates: 0 Warnings: 0') {
- printf("[008] mysqlnd used to be more verbose and used to support SELECT\n");
- }
- } else {
- if ($link->info != NULL) {
- printf("[008] Time for wonders - libmysql has started to support SELECT, change test\n");
- }
- }
+ require_once("connect.inc");
+
+ require('table.inc');
+
+ // Zend will cast the NULL to 0
+ if (!is_bool($tmp = mysqli_kill($link, null)))
+ printf("[003] Expecting boolean/any, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!$thread_id = mysqli_thread_id($link))
+ printf("[004] Cannot determine thread id, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ $tmp = mysqli_kill($link, $thread_id);
+ if (!is_bool($tmp))
+ printf("[005] Expecting boolean/any, got %s/%s\n", gettype($tmp), $tmp);
+
+ if ($res = mysqli_query($link, "SELECT id FROM test LIMIT 1"))
+ pintf("[006] Expecting boolean/false, got %s/%s\n", gettype($res), $res);
+
+ var_dump($error = mysqli_error($link));
+ if (!is_string($error) || ('' === $error))
+ printf("[007] Expecting string/any non empty, got %s/%s\n", gettype($error), $error);
+ var_dump($res);
+ var_dump($link);
+ if ($IS_MYSQLND) {
+ if ($link->info != 'Records: 6 Duplicates: 0 Warnings: 0') {
+ printf("[008] mysqlnd used to be more verbose and used to support SELECT\n");
+ }
+ } else {
+ if ($link->info != NULL) {
+ printf("[008] Time for wonders - libmysql has started to support SELECT, change test\n");
+ }
+ }
- mysqli_close($link);
+ mysqli_close($link);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[010] Cannot connect, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[010] Cannot connect, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- mysqli_kill($link, -1);
- if ((!$res = mysqli_query($link, "SELECT id FROM test LIMIT 1")) ||
- (!$tmp = mysqli_fetch_assoc($res))) {
- printf("[011] Connection should not be gone, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- var_dump($tmp);
- mysqli_free_result($res);
- mysqli_close($link);
+ mysqli_kill($link, -1);
+ if ((!$res = mysqli_query($link, "SELECT id FROM test LIMIT 1")) ||
+ (!$tmp = mysqli_fetch_assoc($res))) {
+ printf("[011] Connection should not be gone, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ var_dump($tmp);
+ mysqli_free_result($res);
+ mysqli_close($link);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[012] Cannot connect, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[012] Cannot connect, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- mysqli_change_user($link, "This might work if you accept anonymous users in your setup", "password", $db); mysqli_kill($link, -1);
+ mysqli_change_user($link, "This might work if you accept anonymous users in your setup", "password", $db); mysqli_kill($link, -1);
- mysqli_close($link);
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_last_insert_id.phpt b/ext/mysqli/tests/mysqli_last_insert_id.phpt
index d966eca05e..b0c453d08e 100644
--- a/ext/mysqli/tests/mysqli_last_insert_id.phpt
+++ b/ext/mysqli/tests/mysqli_last_insert_id.phpt
@@ -7,172 +7,172 @@ API vs. SQL LAST_INSERT_ID()
?>
--FILE--
<?php
- /*
- CAUTION: the insert_id() API call is not supposed to return
- the same value as a call to the LAST_INSERT_ID() SQL function.
- It is not necessarily a bug if API and SQL function return different
- values. Check the MySQL C API reference manual for details.
- */
- require_once("connect.inc");
-
- function get_sql_id($link) {
- if (!($res = $link->query("SELECT LAST_INSERT_ID() AS _id"))) {
- printf("[003] [%d] %s\n", $link->errno, $link->error);
- return NULL;
- }
- $row = $res->fetch_assoc();
- $res->close();
-
- return $row['_id'];
- }
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
-
- if (!$link->query("DROP TABLE IF EXISTS test") ||
- !$link->query("CREATE TABLE test (id INT auto_increment, label varchar(10) not null, PRIMARY KEY (id)) ENGINE=MyISAM") ||
- !$link->query("INSERT INTO test (id, label) VALUES (null, 'a')")) {
- printf("[002] [%d] %s\n", $link->errno, $link->error);
- }
-
- $api_id = $link->insert_id;
- $sql_id = get_sql_id($link);
- printf("API: %d, SQL: %d\n", $api_id, $sql_id);
-
- if ($api_id < 1)
- printf("[004] Expecting id > 0 got %d, [%d] %s\n", $api_id, $link->errno, $link->error) ;
- if ($api_id != $sql_id)
- printf("[005] SQL id %d should be equal to API id %d\n", $sql_id, $api_id);
-
- // Not an INSERT, API value must become 0
- if (!($res = $link->query("SELECT 1 FROM DUAL")))
- printf("[006] [%d] %s\n", $link->errno, $link->error);
- else
- $res->close();
-
- $api_id = $link->insert_id;
- $new_sql_id = get_sql_id($link);
- if (0 !== $api_id) {
- printf("[007] API id should have been reset to 0 because previous query was SELECT, got API %d, SQL %d\n",
- $api_id, $new_sql_id);
- }
- if ($new_sql_id != $sql_id) {
- printf("[008] The servers LAST_INSERT_ID() changed unexpectedly from %d to %d\n", $sql_id, $new_sql_id);
- }
-
- // Insert fails, LAST_INSERT_ID shall not change, API shall return 0
- if ($link->query("INSERT INTO test (id, label) VALUES (null, null)")) {
- printf("[009] The INSERT did not fail as planned, [%d] %s\n", $link->errno, $link->error);
- }
- $api_id = $link->insert_id;
- $new_sql_id = get_sql_id($link);
-
- if (0 !== $api_id) {
- printf("[010] API id should have been reset to 0 because previous query was SELECT, got API %d, SQL %d\n",
- $api_id, $new_sql_id);
- }
- if ($new_sql_id != $sql_id) {
- printf("[011] The servers LAST_INSERT_ID() changed unexpectedly from %d to %d\n", $sql_id, $new_sql_id);
- }
-
- // Sequence counter pattern...
- if (!$link->query("UPDATE test SET id=LAST_INSERT_ID(id+1)"))
- printf("[012] [%d] %s\n", $link->errno, $link->error);
-
- $api_id = $link->insert_id;
- $new_sql_id = get_sql_id($link);
- if ($api_id < 1)
- printf("[013] Expecting id > 0 got %d, [%d] %s\n", $api_id, $link->errno, $link->error) ;
- if ($api_id != $new_sql_id)
- printf("[014] SQL id %d should be equal to API id %d\n", $new_sql_id, $api_id);
- if ($sql_id == $new_sql_id)
- printf("[015] SQL id %d should have had changed, got %d\n", $sql_id, $new_sql_id);
-
- $sql_id = $new_sql_id;
-
- // Not an INSERT (after UPDATE), API value must become 0
- if (!$link->query("SET @myvar=1"))
- printf("[016] [%d] %s\n", $link->errno, $link->error);
-
- $api_id = $link->insert_id;
- $new_sql_id = get_sql_id($link);
- if (0 !== $api_id) {
- printf("[017] API id should have been reset to 0 because previous query was SET, got API %d, SQL %d\n",
- $api_id, $new_sql_id);
- }
- if ($new_sql_id != $sql_id) {
- printf("[018] The servers LAST_INSERT_ID() changed unexpectedly from %d to %d\n", $sql_id, $new_sql_id);
- }
-
- if (!$link->query("INSERT INTO test(id, label) VALUES (LAST_INSERT_ID(id + 1), 'b')"))
- printf("[019] [%d] %s\n", $link->errno, $link->error);
-
- $api_id = $link->insert_id;
- $sql_id = get_sql_id($link);
- if ($api_id != $sql_id)
- printf("[020] SQL id %d should be equal to API id %d\n", $sql_id, $api_id);
-
- if (!$link->query("INSERT INTO test(label) VALUES ('c')"))
- printf("[021] [%d] %s\n", $link->errno, $link->error);
-
- $api_id = $link->insert_id;
- $sql_id = get_sql_id($link);
- if ($api_id != $sql_id)
- printf("[022] SQL id %d should be equal to API id %d\n", $sql_id, $api_id);
-
- if (!($res = $link->query("SELECT id, label FROM test ORDER BY id ASC")))
- printf("[023] [%d] %s\n", $link->errno, $link->error);
-
- printf("Dumping table contents before INSERT...SELECT experiments...\n");
- while ($row = $res->fetch_assoc()) {
- printf("id = %d, label = '%s'\n", $row['id'], $row['label']);
- }
- $res->close();
-
- if (!$link->query("INSERT INTO test(label) SELECT CONCAT(label, id) FROM test ORDER BY id ASC"))
- printf("[024] [%d] %s\n", $link->errno, $link->error);
-
- $api_id = $link->insert_id;
- $sql_id = get_sql_id($link);
- if ($api_id != $sql_id)
- printf("[025] SQL id %d should be equal to API id %d\n", $sql_id, $api_id);
-
- if ($link->query("INSERT INTO test(id, label) SELECT id, CONCAT(label, id) FROM test ORDER BY id ASC"))
- printf("[026] INSERT should have failed because of duplicate PK value, [%d] %s\n", $link->errno, $link->error);
-
- $api_id = $link->insert_id;
- $new_sql_id = get_sql_id($link);
- if (0 !== $api_id) {
- printf("[027] API id should have been reset to 0 because previous query failed, got API %d, SQL %d\n",
- $api_id, $new_sql_id);
- }
- if ($new_sql_id != $sql_id) {
- printf("[028] The servers LAST_INSERT_ID() changed unexpectedly from %d to %d\n", $sql_id, $new_sql_id);
- }
-
- /* API insert id will be 101 because of UPDATE, SQL unchanged */
- if (!$link->query(sprintf("INSERT INTO test(id, label) VALUES (%d, 'z') ON DUPLICATE KEY UPDATE id = 101", $sql_id) ))
- printf("[029] [%d] %s\n", $link->errno, $link->error);
-
- $api_id = $link->insert_id;
- $new_sql_id = get_sql_id($link);
- if ($api_id != 101)
- printf("[030] API id should be %d got %d\n", $sql_id, $api_id);
- if ($new_sql_id != $sql_id) {
- printf("[031] The servers LAST_INSERT_ID() changed unexpectedly from %d to %d\n", $sql_id, $new_sql_id);
- }
-
- if (!($res = $link->query("SELECT id, label FROM test ORDER BY id ASC")))
- printf("[032] [%d] %s\n", $link->errno, $link->error);
-
- printf("Dumping table contents after INSERT...SELECT...\n");
- while ($row = $res->fetch_assoc()) {
- printf("id = %d, label = '%s'\n", $row['id'], $row['label']);
- }
- $res->close();
-
- print "done!";
+ /*
+ CAUTION: the insert_id() API call is not supposed to return
+ the same value as a call to the LAST_INSERT_ID() SQL function.
+ It is not necessarily a bug if API and SQL function return different
+ values. Check the MySQL C API reference manual for details.
+ */
+ require_once("connect.inc");
+
+ function get_sql_id($link) {
+ if (!($res = $link->query("SELECT LAST_INSERT_ID() AS _id"))) {
+ printf("[003] [%d] %s\n", $link->errno, $link->error);
+ return NULL;
+ }
+ $row = $res->fetch_assoc();
+ $res->close();
+
+ return $row['_id'];
+ }
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+
+ if (!$link->query("DROP TABLE IF EXISTS test") ||
+ !$link->query("CREATE TABLE test (id INT auto_increment, label varchar(10) not null, PRIMARY KEY (id)) ENGINE=MyISAM") ||
+ !$link->query("INSERT INTO test (id, label) VALUES (null, 'a')")) {
+ printf("[002] [%d] %s\n", $link->errno, $link->error);
+ }
+
+ $api_id = $link->insert_id;
+ $sql_id = get_sql_id($link);
+ printf("API: %d, SQL: %d\n", $api_id, $sql_id);
+
+ if ($api_id < 1)
+ printf("[004] Expecting id > 0 got %d, [%d] %s\n", $api_id, $link->errno, $link->error) ;
+ if ($api_id != $sql_id)
+ printf("[005] SQL id %d should be equal to API id %d\n", $sql_id, $api_id);
+
+ // Not an INSERT, API value must become 0
+ if (!($res = $link->query("SELECT 1 FROM DUAL")))
+ printf("[006] [%d] %s\n", $link->errno, $link->error);
+ else
+ $res->close();
+
+ $api_id = $link->insert_id;
+ $new_sql_id = get_sql_id($link);
+ if (0 !== $api_id) {
+ printf("[007] API id should have been reset to 0 because previous query was SELECT, got API %d, SQL %d\n",
+ $api_id, $new_sql_id);
+ }
+ if ($new_sql_id != $sql_id) {
+ printf("[008] The servers LAST_INSERT_ID() changed unexpectedly from %d to %d\n", $sql_id, $new_sql_id);
+ }
+
+ // Insert fails, LAST_INSERT_ID shall not change, API shall return 0
+ if ($link->query("INSERT INTO test (id, label) VALUES (null, null)")) {
+ printf("[009] The INSERT did not fail as planned, [%d] %s\n", $link->errno, $link->error);
+ }
+ $api_id = $link->insert_id;
+ $new_sql_id = get_sql_id($link);
+
+ if (0 !== $api_id) {
+ printf("[010] API id should have been reset to 0 because previous query was SELECT, got API %d, SQL %d\n",
+ $api_id, $new_sql_id);
+ }
+ if ($new_sql_id != $sql_id) {
+ printf("[011] The servers LAST_INSERT_ID() changed unexpectedly from %d to %d\n", $sql_id, $new_sql_id);
+ }
+
+ // Sequence counter pattern...
+ if (!$link->query("UPDATE test SET id=LAST_INSERT_ID(id+1)"))
+ printf("[012] [%d] %s\n", $link->errno, $link->error);
+
+ $api_id = $link->insert_id;
+ $new_sql_id = get_sql_id($link);
+ if ($api_id < 1)
+ printf("[013] Expecting id > 0 got %d, [%d] %s\n", $api_id, $link->errno, $link->error) ;
+ if ($api_id != $new_sql_id)
+ printf("[014] SQL id %d should be equal to API id %d\n", $new_sql_id, $api_id);
+ if ($sql_id == $new_sql_id)
+ printf("[015] SQL id %d should have had changed, got %d\n", $sql_id, $new_sql_id);
+
+ $sql_id = $new_sql_id;
+
+ // Not an INSERT (after UPDATE), API value must become 0
+ if (!$link->query("SET @myvar=1"))
+ printf("[016] [%d] %s\n", $link->errno, $link->error);
+
+ $api_id = $link->insert_id;
+ $new_sql_id = get_sql_id($link);
+ if (0 !== $api_id) {
+ printf("[017] API id should have been reset to 0 because previous query was SET, got API %d, SQL %d\n",
+ $api_id, $new_sql_id);
+ }
+ if ($new_sql_id != $sql_id) {
+ printf("[018] The servers LAST_INSERT_ID() changed unexpectedly from %d to %d\n", $sql_id, $new_sql_id);
+ }
+
+ if (!$link->query("INSERT INTO test(id, label) VALUES (LAST_INSERT_ID(id + 1), 'b')"))
+ printf("[019] [%d] %s\n", $link->errno, $link->error);
+
+ $api_id = $link->insert_id;
+ $sql_id = get_sql_id($link);
+ if ($api_id != $sql_id)
+ printf("[020] SQL id %d should be equal to API id %d\n", $sql_id, $api_id);
+
+ if (!$link->query("INSERT INTO test(label) VALUES ('c')"))
+ printf("[021] [%d] %s\n", $link->errno, $link->error);
+
+ $api_id = $link->insert_id;
+ $sql_id = get_sql_id($link);
+ if ($api_id != $sql_id)
+ printf("[022] SQL id %d should be equal to API id %d\n", $sql_id, $api_id);
+
+ if (!($res = $link->query("SELECT id, label FROM test ORDER BY id ASC")))
+ printf("[023] [%d] %s\n", $link->errno, $link->error);
+
+ printf("Dumping table contents before INSERT...SELECT experiments...\n");
+ while ($row = $res->fetch_assoc()) {
+ printf("id = %d, label = '%s'\n", $row['id'], $row['label']);
+ }
+ $res->close();
+
+ if (!$link->query("INSERT INTO test(label) SELECT CONCAT(label, id) FROM test ORDER BY id ASC"))
+ printf("[024] [%d] %s\n", $link->errno, $link->error);
+
+ $api_id = $link->insert_id;
+ $sql_id = get_sql_id($link);
+ if ($api_id != $sql_id)
+ printf("[025] SQL id %d should be equal to API id %d\n", $sql_id, $api_id);
+
+ if ($link->query("INSERT INTO test(id, label) SELECT id, CONCAT(label, id) FROM test ORDER BY id ASC"))
+ printf("[026] INSERT should have failed because of duplicate PK value, [%d] %s\n", $link->errno, $link->error);
+
+ $api_id = $link->insert_id;
+ $new_sql_id = get_sql_id($link);
+ if (0 !== $api_id) {
+ printf("[027] API id should have been reset to 0 because previous query failed, got API %d, SQL %d\n",
+ $api_id, $new_sql_id);
+ }
+ if ($new_sql_id != $sql_id) {
+ printf("[028] The servers LAST_INSERT_ID() changed unexpectedly from %d to %d\n", $sql_id, $new_sql_id);
+ }
+
+ /* API insert id will be 101 because of UPDATE, SQL unchanged */
+ if (!$link->query(sprintf("INSERT INTO test(id, label) VALUES (%d, 'z') ON DUPLICATE KEY UPDATE id = 101", $sql_id) ))
+ printf("[029] [%d] %s\n", $link->errno, $link->error);
+
+ $api_id = $link->insert_id;
+ $new_sql_id = get_sql_id($link);
+ if ($api_id != 101)
+ printf("[030] API id should be %d got %d\n", $sql_id, $api_id);
+ if ($new_sql_id != $sql_id) {
+ printf("[031] The servers LAST_INSERT_ID() changed unexpectedly from %d to %d\n", $sql_id, $new_sql_id);
+ }
+
+ if (!($res = $link->query("SELECT id, label FROM test ORDER BY id ASC")))
+ printf("[032] [%d] %s\n", $link->errno, $link->error);
+
+ printf("Dumping table contents after INSERT...SELECT...\n");
+ while ($row = $res->fetch_assoc()) {
+ printf("id = %d, label = '%s'\n", $row['id'], $row['label']);
+ }
+ $res->close();
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_max_links.phpt b/ext/mysqli/tests/mysqli_max_links.phpt
index f3469e20e6..5dd7be9dcc 100644
--- a/ext/mysqli/tests/mysqli_max_links.phpt
+++ b/ext/mysqli/tests/mysqli_max_links.phpt
@@ -10,31 +10,23 @@ require_once('skipifconnectfailure.inc');
mysqli.max_links=1
--FILE--
<?php
- require_once("connect.inc");
- require_once("table.inc");
-
- // to make sure we have at least one working connection...
- var_dump(mysqli_ping($link));
- // to make sure that max_links is really set to one
- var_dump((int)ini_get('mysqli.max_links'));
-
- $links = array();
- for ($i = 1; $i <= 5; $i++)
- if ($links[$i] = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[%03d] One link is already open, it should not be possible to open more, [%d] %s, [%d] %s\n",
- $i, mysqli_connect_errno(), mysqli_connect_error(),
- mysqli_errno($links[$i]), mysqli_error($links[$i]));
-
- for ($i = 1; $i <= 5; $i++) {
- if ($res = mysqli_query($links[$i], 'SELECT id FROM test LIMIT 1')) {
- printf("[%03d] Can run query on link %d\n", 5 + $i, $i);
- mysqli_free_result($res);
- }
- mysqli_close($links[$i]);
- }
-
- mysqli_close($link);
- print "done!";
+ require_once("connect.inc");
+ require_once("table.inc");
+
+ // to make sure we have at least one working connection...
+ var_dump(mysqli_ping($link));
+ // to make sure that max_links is really set to one
+ var_dump((int)ini_get('mysqli.max_links'));
+
+ $links = array();
+ for ($i = 1; $i <= 5; $i++)
+ if ($links[$i] = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[%03d] One link is already open, it should not be possible to open more, [%d] %s, [%d] %s\n",
+ $i, mysqli_connect_errno(), mysqli_connect_error(),
+ mysqli_errno($links[$i]), mysqli_error($links[$i]));
+
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
@@ -53,24 +45,4 @@ Warning: mysqli_%sonnect(): Too many open links (1) in %s on line %d
Warning: mysqli_%sonnect(): Too many open links (1) in %s on line %d
Warning: mysqli_%sonnect(): Too many open links (1) in %s on line %d
-
-Warning: mysqli_query() expects parameter 1 to be mysqli, bool given in %s on line %d
-
-Warning: mysqli_close() expects parameter 1 to be mysqli, bool given in %s on line %d
-
-Warning: mysqli_query() expects parameter 1 to be mysqli, bool given in %s on line %d
-
-Warning: mysqli_close() expects parameter 1 to be mysqli, bool given in %s on line %d
-
-Warning: mysqli_query() expects parameter 1 to be mysqli, bool given in %s on line %d
-
-Warning: mysqli_close() expects parameter 1 to be mysqli, bool given in %s on line %d
-
-Warning: mysqli_query() expects parameter 1 to be mysqli, bool given in %s on line %d
-
-Warning: mysqli_close() expects parameter 1 to be mysqli, bool given in %s on line %d
-
-Warning: mysqli_query() expects parameter 1 to be mysqli, bool given in %s on line %d
-
-Warning: mysqli_close() expects parameter 1 to be mysqli, bool given in %s on line %d
done!
diff --git a/ext/mysqli/tests/mysqli_more_results.phpt b/ext/mysqli/tests/mysqli_more_results.phpt
index 7f0a1f748b..b6a9cb3c6a 100644
--- a/ext/mysqli/tests/mysqli_more_results.phpt
+++ b/ext/mysqli/tests/mysqli_more_results.phpt
@@ -8,60 +8,55 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ require('table.inc');
- if (!is_null($tmp = @mysqli_more_results()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ print "[004]\n";
+ var_dump(mysqli_more_results($link));
- if (!is_null($tmp = @mysqli_more_results($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_multi_query($link, "SELECT 1 AS a; SELECT 1 AS a, 2 AS b; SELECT id FROM test ORDER BY id LIMIT 3"))
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ print "[006]\n";
+ $i = 1;
- require('table.inc');
+ if (mysqli_get_server_version($link) > 41000 && !($ret = mysqli_more_results($link)))
+ printf("[007] Expecting boolean/true, got %s/%s\n", gettype($ret), $ret);
+ do {
+ $res = mysqli_store_result($link);
+ mysqli_free_result($res);
+ if (mysqli_more_results($link))
+ printf("%d\n", $i++);
+ } while (mysqli_next_result($link));
- print "[004]\n";
- var_dump(mysqli_more_results($link));
+ if (!mysqli_multi_query($link, "SELECT 1 AS a; SELECT 1 AS a, 2 AS b; SELECT id FROM test ORDER BY id LIMIT 3"))
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ print "[010]\n";
+ $i = 1;
+ if (mysqli_get_server_version($link) > 41000 && !($ret = mysqli_more_results($link)))
+ printf("[011] Expecting boolean/true, got %s/%s\n", gettype($ret), $ret);
- if (!mysqli_multi_query($link, "SELECT 1 AS a; SELECT 1 AS a, 2 AS b; SELECT id FROM test ORDER BY id LIMIT 3"))
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- print "[006]\n";
- $i = 1;
+ do {
+ $res = mysqli_use_result($link);
+ // NOTE: if you use mysqli_use_result() with mysqli_more_results() or any other info function,
+ // you must fetch all rows before you can loop to the next result set!
+ // See also the MySQL Reference Manual: mysql_use_result()
+ while ($row = mysqli_fetch_array($res))
+ ;
+ mysqli_free_result($res);
+ if (mysqli_more_results($link))
+ printf("%d\n", $i++);
+ } while (mysqli_next_result($link));
- if (mysqli_get_server_version($link) > 41000 && !($ret = mysqli_more_results($link)))
- printf("[007] Expecting boolean/true, got %s/%s\n", gettype($ret), $ret);
- do {
- $res = mysqli_store_result($link);
- mysqli_free_result($res);
- if (mysqli_more_results($link))
- printf("%d\n", $i++);
- } while (mysqli_next_result($link));
+ mysqli_close($link);
- if (!mysqli_multi_query($link, "SELECT 1 AS a; SELECT 1 AS a, 2 AS b; SELECT id FROM test ORDER BY id LIMIT 3"))
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- print "[010]\n";
- $i = 1;
- if (mysqli_get_server_version($link) > 41000 && !($ret = mysqli_more_results($link)))
- printf("[011] Expecting boolean/true, got %s/%s\n", gettype($ret), $ret);
+ try {
+ mysqli_more_results($link);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- do {
- $res = mysqli_use_result($link);
- // NOTE: if you use mysqli_use_result() with mysqli_more_results() or any other info function,
- // you must fetch all rows before you can loop to the next result set!
- // See also the MySQL Reference Manual: mysql_use_result()
- while ($row = mysqli_fetch_array($res))
- ;
- mysqli_free_result($res);
- if (mysqli_more_results($link))
- printf("%d\n", $i++);
- } while (mysqli_next_result($link));
-
- mysqli_close($link);
-
- var_dump(mysqli_more_results($link));
-
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
@@ -76,7 +71,5 @@ bool(false)
[010]
1
2
-
-Warning: mysqli_more_results(): Couldn't fetch mysqli in %s on line %d
-bool(false)
+mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_multi_query.phpt b/ext/mysqli/tests/mysqli_multi_query.phpt
index 05f564313d..571b2d7f2a 100644
--- a/ext/mysqli/tests/mysqli_multi_query.phpt
+++ b/ext/mysqli/tests/mysqli_multi_query.phpt
@@ -8,112 +8,107 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ require('table.inc');
- if (!is_null($tmp = @mysqli_multi_query()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_multi_query($link, "")))
+ printf("[003] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_multi_query($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_multi_query($link, "SELECT 1 AS a; SELECT 1 AS a, 2 AS b; SELECT id FROM test ORDER BY id LIMIT 3"))
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- require('table.inc');
+ $i = 0;
+ do {
+ $res = mysqli_store_result($link);
+ while ($row = mysqli_fetch_array($res))
+ ;
+ mysqli_free_result($res);
+ $i++;
+ } while (mysqli_next_result($link));
- if (false !== ($tmp = mysqli_multi_query($link, "")))
- printf("[003] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ printf("[006] %d\n", $i);
- if (!mysqli_multi_query($link, "SELECT 1 AS a; SELECT 1 AS a, 2 AS b; SELECT id FROM test ORDER BY id LIMIT 3"))
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_multi_query($link, "ALTER TABLE test MODIFY id INT AUTO_INCREMENT; INSERT INTO test(label) VALUES ('a'); SELECT id, label FROM test ORDER BY id"))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $i = 0;
- do {
- $res = mysqli_store_result($link);
- while ($row = mysqli_fetch_array($res))
- ;
- mysqli_free_result($res);
- $i++;
- } while (mysqli_next_result($link));
+ $i = 0;
+ while (mysqli_next_result($link) && ($res = mysqli_store_result($link))) {
- printf("[006] %d\n", $i);
+ while ($row = mysqli_fetch_array($res))
+ ;
+ mysqli_free_result($res);
+ printf("%d/%d\n", $i, mysqli_insert_id($link));
+ $i++;
+ }
+ printf("[008] %d\n", $i);
- if (!mysqli_multi_query($link, "ALTER TABLE test MODIFY id INT AUTO_INCREMENT; INSERT INTO test(label) VALUES ('a'); SELECT id, label FROM test ORDER BY id"))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_multi_query($link, "SELECT id, label FROM test"))
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $i = 0;
- while (mysqli_next_result($link) && ($res = mysqli_store_result($link))) {
+ $i = 0;
+ while (mysqli_next_result($link) && ($res = mysqli_store_result($link))) {
+ while ($row = mysqli_fetch_array($res))
+ $i++;
+ mysqli_free_result($res);
+ }
+ printf("[010] %d\n", $i);
- while ($row = mysqli_fetch_array($res))
- ;
- mysqli_free_result($res);
- printf("%d/%d\n", $i, mysqli_insert_id($link));
- $i++;
- }
- printf("[008] %d\n", $i);
+ if (!mysqli_multi_query($link, "SELECT 1 AS num, 'a' AS somechar; SELECT 2 AS num, 'a' AS somechar; SELECT 3 AS num, 'a' AS somechar"))
+ printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_multi_query($link, "SELECT id, label FROM test"))
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $res_num = 1;
+ do {
+ if (!$res = mysqli_store_result($link)) {
+ printf("[012 - %d] [%d] %s\n", $res_num, mysqli_errno($link), mysqli_error($link));
+ continue;
+ }
- $i = 0;
- while (mysqli_next_result($link) && ($res = mysqli_store_result($link))) {
- while ($row = mysqli_fetch_array($res))
- $i++;
- mysqli_free_result($res);
- }
- printf("[010] %d\n", $i);
+ $num_rows = 0;
+ while ($row = mysqli_fetch_array($res)) {
- if (!mysqli_multi_query($link, "SELECT 1 AS num, 'a' AS somechar; SELECT 2 AS num, 'a' AS somechar; SELECT 3 AS num, 'a' AS somechar"))
- printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $num_rows++;
+ if ($row['num'] != $res_num)
+ printf("[013 - %d] Expecting %s got %s\n", $res_num, $res_num, $row['num']);
+ if ($row['somechar'] != "a")
+ printf("[014 - %d] Expecting a got %s\n", $res_num, $row['somechar']);
- $res_num = 1;
- do {
- if (!$res = mysqli_store_result($link)) {
- printf("[012 - %d] [%d] %s\n", $res_num, mysqli_errno($link), mysqli_error($link));
- continue;
- }
+ if (1 == $num_rows) {
+ /* simple metadata check */
+ if (!($lengths = mysqli_fetch_lengths($res)))
+ printf("[015 - %d] [%d] %s\n", $res_num, mysqli_errno($link), mysqli_error($link));
- $num_rows = 0;
- while ($row = mysqli_fetch_array($res)) {
+ if (count($lengths) != 2)
+ printf("[016 - %d] Expecting 2 column lengths got %d [%d] %s\n", $res_num, count($lengths));
- $num_rows++;
- if ($row['num'] != $res_num)
- printf("[013 - %d] Expecting %s got %s\n", $res_num, $res_num, $row['num']);
- if ($row['somechar'] != "a")
- printf("[014 - %d] Expecting a got %s\n", $res_num, $row['somechar']);
+ foreach ($lengths as $k => $length)
+ if ($length <= 0)
+ printf("[017 - %d] Strange column lengths for column %d, got %d expecting any > 0\n",
+ $res_num, $k, $length);
+ }
+ }
- if (1 == $num_rows) {
- /* simple metadata check */
- if (!($lengths = mysqli_fetch_lengths($res)))
- printf("[015 - %d] [%d] %s\n", $res_num, mysqli_errno($link), mysqli_error($link));
+ if ($num_rows != 1)
+ printf("[018 - %d] Expecting 1 row, got %d rows\n", $num_rows);
- if (count($lengths) != 2)
- printf("[016 - %d] Expecting 2 column lengths got %d [%d] %s\n", $res_num, count($lengths));
+ $res_num++;
- foreach ($lengths as $k => $length)
- if ($length <= 0)
- printf("[017 - %d] Strange column lengths for column %d, got %d expecting any > 0\n",
- $res_num, $k, $length);
- }
- }
+ mysqli_free_result($res);
- if ($num_rows != 1)
- printf("[018 - %d] Expecting 1 row, got %d rows\n", $num_rows);
+ } while (mysqli_next_result($link));
- $res_num++;
+ if ($res_num != 4)
+ printf("[015] Expecting 3 result sets got %d result set[s]\n", $res_num);
- mysqli_free_result($res);
+ mysqli_close($link);
- } while (mysqli_next_result($link));
+ try {
+ mysqli_multi_query($link, "SELECT id, label FROM test");
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- if ($res_num != 4)
- printf("[015] Expecting 3 result sets got %d result set[s]\n", $res_num);
-
- mysqli_close($link);
-
- var_dump(mysqli_multi_query($link, "SELECT id, label FROM test"));
-
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
@@ -124,7 +119,5 @@ require_once('skipifconnectfailure.inc');
[008] 0
[009] [2014] Commands out of sync; you can't run this command now
[010] 7
-
-Warning: mysqli_multi_query(): Couldn't fetch mysqli in %s on line %d
-bool(false)
+mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_mysqlnd_read_timeout.phpt b/ext/mysqli/tests/mysqli_mysqlnd_read_timeout.phpt
index 4f65f77480..159d7d9853 100644
--- a/ext/mysqli/tests/mysqli_mysqlnd_read_timeout.phpt
+++ b/ext/mysqli/tests/mysqli_mysqlnd_read_timeout.phpt
@@ -15,18 +15,18 @@ max_execution_time=60
mysqlnd.net_read_timeout=1
--FILE--
<?php
- include ("connect.inc");
+ include ("connect.inc");
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- }
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
- if (!$res = mysqli_query($link, "SELECT SLEEP(5)"))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, "SELECT SLEEP(5)"))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_close($link);
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--EXPECT--
[002] [2006] MySQL server has gone away
diff --git a/ext/mysqli/tests/mysqli_mysqlnd_read_timeout_long.phpt b/ext/mysqli/tests/mysqli_mysqlnd_read_timeout_long.phpt
index 7b69aff617..3825cd6bd8 100644
--- a/ext/mysqli/tests/mysqli_mysqlnd_read_timeout_long.phpt
+++ b/ext/mysqli/tests/mysqli_mysqlnd_read_timeout_long.phpt
@@ -23,22 +23,22 @@ mysqlnd.net_read_timeout=12
max_execution_time=12
--FILE--
<?php
- set_time_limit(12);
- include ("connect.inc");
+ set_time_limit(12);
+ include ("connect.inc");
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- }
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
- if (!$res = mysqli_query($link, "SELECT SLEEP(6)"))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, "SELECT SLEEP(6)"))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump($res->fetch_assoc());
+ var_dump($res->fetch_assoc());
- mysqli_free_result($res);
- mysqli_close($link);
+ mysqli_free_result($res);
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--EXPECT--
array(1) {
diff --git a/ext/mysqli/tests/mysqli_mysqlnd_read_timeout_zero.phpt b/ext/mysqli/tests/mysqli_mysqlnd_read_timeout_zero.phpt
index df273c4f14..9d1e316573 100644
--- a/ext/mysqli/tests/mysqli_mysqlnd_read_timeout_zero.phpt
+++ b/ext/mysqli/tests/mysqli_mysqlnd_read_timeout_zero.phpt
@@ -23,21 +23,21 @@ max_execution_time=10
mysqlnd.net_read_timeout=0
--FILE--
<?php
- include ("connect.inc");
+ include ("connect.inc");
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- }
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
- if (!$res = mysqli_query($link, "SELECT SLEEP(2)"))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, "SELECT SLEEP(2)"))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump($res->fetch_assoc());
+ var_dump($res->fetch_assoc());
- mysqli_free_result($res);
- mysqli_close($link);
+ mysqli_free_result($res);
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--EXPECT--
array(1) {
diff --git a/ext/mysqli/tests/mysqli_next_result.phpt b/ext/mysqli/tests/mysqli_next_result.phpt
index 6760cbbadc..22e13f4e3f 100644
--- a/ext/mysqli/tests/mysqli_next_result.phpt
+++ b/ext/mysqli/tests/mysqli_next_result.phpt
@@ -8,72 +8,65 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ require('table.inc');
- if (!is_null($tmp = @mysqli_next_result()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_next_result($link)))
+ printf("[003] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_next_result($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ $res = mysqli_query($link, "SELECT 1 AS res");
+ if (false !== ($tmp = mysqli_next_result($link)))
+ printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ mysqli_free_result($res);
- if (false !== ($tmp = mysqli_next_result($link)))
- printf("[003] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ function func_test_mysqli_next_result($link, $query, $offset, $num_results) {
- $res = mysqli_query($link, "SELECT 1 AS res");
- if (false !== ($tmp = mysqli_next_result($link)))
- printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_multi_query($link, $query))
+ printf("[%03d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
+ $i = 0;
+ do {
+ if ($res = mysqli_store_result($link)) {
+ mysqli_free_result($res);
+ $i++;
+ }
+ } while (true === mysqli_next_result($link));
- function func_test_mysqli_next_result($link, $query, $offset, $num_results) {
+ if ($i !== $num_results) {
+ printf("[%03d] Expecting %d result(s), got %d result(s)\n", $offset + 2, $num_results, $i);
+ }
- if (!mysqli_multi_query($link, $query))
- printf("[%03d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
+ if (mysqli_more_results($link))
+ printf("[%03d] mysqli_more_results() indicates more results than expected\n", $offset + 3);
- $i = 0;
- do {
- if ($res = mysqli_store_result($link)) {
- mysqli_free_result($res);
- $i++;
- }
- } while (true === mysqli_next_result($link));
+ if (!($res = mysqli_query($link, "SELECT 1 AS b"))) {
+ printf("[%03d] [%d] %s\n", $offset + 4, mysqli_errno($link), mysqli_error($link));
+ } else {
+ mysqli_free_result($res);
+ }
- if ($i !== $num_results) {
- printf("[%03d] Expecting %d result(s), got %d result(s)\n", $offset + 2, $num_results, $i);
- }
+ }
- if (mysqli_more_results($link))
- printf("[%03d] mysqli_more_results() indicates more results than expected\n", $offset + 3);
+ func_test_mysqli_next_result($link, "SELECT 1 AS a; SELECT 1 AS a, 2 AS b; SELECT id FROM test ORDER BY id LIMIT 3", 5, 3);
+ func_test_mysqli_next_result($link, "SELECT 1 AS a; INSERT INTO test(id, label) VALUES (100, 'y'); SELECT 1 AS a, 2 AS b", 8, 2);
+ func_test_mysqli_next_result($link, "DELETE FROM test WHERE id >= 100; SELECT 1 AS a; ", 11, 1);
- if (!($res = mysqli_query($link, "SELECT 1 AS b"))) {
- printf("[%03d] [%d] %s\n", $offset + 4, mysqli_errno($link), mysqli_error($link));
- } else {
- mysqli_free_result($res);
- }
+ mysqli_close($link);
- }
+ try {
+ mysqli_next_result($link);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- func_test_mysqli_next_result($link, "SELECT 1 AS a; SELECT 1 AS a, 2 AS b; SELECT id FROM test ORDER BY id LIMIT 3", 5, 3);
- func_test_mysqli_next_result($link, "SELECT 1 AS a; INSERT INTO test(id, label) VALUES (100, 'y'); SELECT 1 AS a, 2 AS b", 8, 2);
- func_test_mysqli_next_result($link, "DELETE FROM test WHERE id >= 100; SELECT 1 AS a; ", 11, 1);
-
- mysqli_close($link);
-
- var_dump(mysqli_next_result($link));
-
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
--EXPECTF--
-
-Warning: mysqli_next_result(): Couldn't fetch mysqli in %s on line %d
-bool(false)
+mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_no_reconnect.phpt b/ext/mysqli/tests/mysqli_no_reconnect.phpt
index 481f49eedf..1f7ca8d834 100644
--- a/ext/mysqli/tests/mysqli_no_reconnect.phpt
+++ b/ext/mysqli/tests/mysqli_no_reconnect.phpt
@@ -10,118 +10,118 @@ require_once('skipifconnectfailure.inc');
mysqli.reconnect=0
--FILE--
<?php
- require_once("connect.inc");
- require_once("table.inc");
-
- if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot create second database connection, [%d] %s\n",
- mysqli_connect_errno(), mysqli_connect_error());
-
- $thread_id_timeout = mysqli_thread_id($link);
- $thread_id_control = mysqli_thread_id($link2);
-
- if (!$res = mysqli_query($link2, "SHOW FULL PROCESSLIST"))
- printf("[002] Cannot get full processlist, [%d] %s\n",
- mysqli_errno($link2), mysqli_error($link));
-
- $running_threads = array();
- while ($row = mysqli_fetch_assoc($res))
- $running_threads[$row['Id']] = $row;
- mysqli_free_result($res);
-
- if (!isset($running_threads[$thread_id_timeout]) ||
- !isset($running_threads[$thread_id_control]))
- printf("[003] Processlist is borked, [%d] %s\n",
- mysqli_errno($link2), mysqli_error($link));
-
- if (!mysqli_query($link, "SET SESSION wait_timeout = 2"))
- printf("[004] Cannot set wait_timeout, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!$res = mysqli_query($link, "SHOW VARIABLES LIKE 'wait_timeout'"))
- printf("[005] Cannot check if wait_timeout has been set, [%d] %s\n",
- mysqli_errno($link), mysqli_error($link));
-
- if (!$row = mysqli_fetch_assoc($res))
- printf("[006] Cannot get wait_timeout, [%d] %s\n",
- mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
-
- if ($row['Value'] != 2)
- printf("[007] Failed setting the wait_timeout, test will not work, [%d] %s\n",
- mysqli_errno($link), mysqli_error($link));
-
- // after 2+ seconds the server should kill the connection
- sleep(3);
-
- if (!$res = mysqli_query($link2, "SHOW FULL PROCESSLIST"))
- printf("[008] Cannot get full processlist, [%d] %s\n",
- mysqli_errno($link2), mysqli_error($link));
-
- $running_threads = array();
- while ($row = mysqli_fetch_assoc($res))
- $running_threads[$row['Id']] = $row;
- mysqli_free_result($res);
-
- if (isset($running_threads[$thread_id_timeout]))
- printf("[009] Server should have killed the timeout connection, [%d] %s\n",
- mysqli_errno($link2), mysqli_error($link));
-
- if (false !== @mysqli_ping($link))
- printf("[010] Reconnect should not have happened");
-
- if ($res = @mysqli_query($link, "SELECT DATABASE() as _dbname"))
- printf("[011] Executing a query should not be possible, connection should be closed, [%d] %s\n",
- mysqli_errno($link), mysqli_error($link));
-
- if (!$link = @my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[012] Cannot create database connection, [%d] %s\n",
- mysqli_connect_errno(), mysqli_connect_error());
-
- $thread_id_timeout = mysqli_thread_id($link);
- /*
- Don't test for the mysqli_query() return value here.
- It is undefined if the server replies to the query and how.
- For example, it seems that on Linux when connecting to MySQL 5.1,
- the server always manages to send a full a reply. Whereas MySQl 5.5
- may not. The behaviour is undefined. Any return value is fine.
- */
- if ($IS_MYSQLND) {
- /*
- mysqlnd is a bit more verbose than libmysql. mysqlnd should print:
- Warning: mysqli_query(): MySQL server has gone away in %s on line %d
-
- Warning: mysqli_query(): Error reading result set's header in %d on line %d
- */
- @mysqli_query($link, sprintf('KILL %d', $thread_id_timeout));
- } else {
- mysqli_query($link, sprintf('KILL %d', $thread_id_timeout));
- }
- // Give the server a second to really kill the other thread...
- sleep(1);
-
- if (!$res = mysqli_query($link2, "SHOW FULL PROCESSLIST"))
- printf("[014] Cannot get full processlist, [%d] %s\n",
- mysqli_errno($link2), mysqli_error($link));
-
- $running_threads = array();
- while ($row = mysqli_fetch_assoc($res))
- $running_threads[$row['Id']] = $row;
- mysqli_free_result($res);
-
- if (isset($running_threads[$thread_id_timeout]) ||
- !isset($running_threads[$thread_id_control]))
- printf("[015] Processlist is borked, [%d] %s\n",
- mysqli_errno($link2), mysqli_error($link));
-
- if (false !== ($tmp = @mysqli_ping($link)))
- printf("[016] Expecting boolean/false got %s/%s\n", gettype($tmp), $tmp);
-
- if ($res = @mysqli_query($link, "SELECT DATABASE() as _dbname"))
- printf("[017] Running a query should not be possible, connection should be gone, [%d] %s\n",
- mysqli_errno($link), mysqli_error($link));
-
- mysqli_close($link2);
- print "done!";
+ require_once("connect.inc");
+ require_once("table.inc");
+
+ if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot create second database connection, [%d] %s\n",
+ mysqli_connect_errno(), mysqli_connect_error());
+
+ $thread_id_timeout = mysqli_thread_id($link);
+ $thread_id_control = mysqli_thread_id($link2);
+
+ if (!$res = mysqli_query($link2, "SHOW FULL PROCESSLIST"))
+ printf("[002] Cannot get full processlist, [%d] %s\n",
+ mysqli_errno($link2), mysqli_error($link));
+
+ $running_threads = array();
+ while ($row = mysqli_fetch_assoc($res))
+ $running_threads[$row['Id']] = $row;
+ mysqli_free_result($res);
+
+ if (!isset($running_threads[$thread_id_timeout]) ||
+ !isset($running_threads[$thread_id_control]))
+ printf("[003] Processlist is borked, [%d] %s\n",
+ mysqli_errno($link2), mysqli_error($link));
+
+ if (!mysqli_query($link, "SET SESSION wait_timeout = 2"))
+ printf("[004] Cannot set wait_timeout, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!$res = mysqli_query($link, "SHOW VARIABLES LIKE 'wait_timeout'"))
+ printf("[005] Cannot check if wait_timeout has been set, [%d] %s\n",
+ mysqli_errno($link), mysqli_error($link));
+
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[006] Cannot get wait_timeout, [%d] %s\n",
+ mysqli_errno($link), mysqli_error($link));
+ mysqli_free_result($res);
+
+ if ($row['Value'] != 2)
+ printf("[007] Failed setting the wait_timeout, test will not work, [%d] %s\n",
+ mysqli_errno($link), mysqli_error($link));
+
+ // after 2+ seconds the server should kill the connection
+ sleep(3);
+
+ if (!$res = mysqli_query($link2, "SHOW FULL PROCESSLIST"))
+ printf("[008] Cannot get full processlist, [%d] %s\n",
+ mysqli_errno($link2), mysqli_error($link));
+
+ $running_threads = array();
+ while ($row = mysqli_fetch_assoc($res))
+ $running_threads[$row['Id']] = $row;
+ mysqli_free_result($res);
+
+ if (isset($running_threads[$thread_id_timeout]))
+ printf("[009] Server should have killed the timeout connection, [%d] %s\n",
+ mysqli_errno($link2), mysqli_error($link));
+
+ if (false !== @mysqli_ping($link))
+ printf("[010] Reconnect should not have happened");
+
+ if ($res = @mysqli_query($link, "SELECT DATABASE() as _dbname"))
+ printf("[011] Executing a query should not be possible, connection should be closed, [%d] %s\n",
+ mysqli_errno($link), mysqli_error($link));
+
+ if (!$link = @my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[012] Cannot create database connection, [%d] %s\n",
+ mysqli_connect_errno(), mysqli_connect_error());
+
+ $thread_id_timeout = mysqli_thread_id($link);
+ /*
+ Don't test for the mysqli_query() return value here.
+ It is undefined if the server replies to the query and how.
+ For example, it seems that on Linux when connecting to MySQL 5.1,
+ the server always manages to send a full a reply. Whereas MySQl 5.5
+ may not. The behaviour is undefined. Any return value is fine.
+ */
+ if ($IS_MYSQLND) {
+ /*
+ mysqlnd is a bit more verbose than libmysql. mysqlnd should print:
+ Warning: mysqli_query(): MySQL server has gone away in %s on line %d
+
+ Warning: mysqli_query(): Error reading result set's header in %d on line %d
+ */
+ @mysqli_query($link, sprintf('KILL %d', $thread_id_timeout));
+ } else {
+ mysqli_query($link, sprintf('KILL %d', $thread_id_timeout));
+ }
+ // Give the server a second to really kill the other thread...
+ sleep(1);
+
+ if (!$res = mysqli_query($link2, "SHOW FULL PROCESSLIST"))
+ printf("[014] Cannot get full processlist, [%d] %s\n",
+ mysqli_errno($link2), mysqli_error($link));
+
+ $running_threads = array();
+ while ($row = mysqli_fetch_assoc($res))
+ $running_threads[$row['Id']] = $row;
+ mysqli_free_result($res);
+
+ if (isset($running_threads[$thread_id_timeout]) ||
+ !isset($running_threads[$thread_id_control]))
+ printf("[015] Processlist is borked, [%d] %s\n",
+ mysqli_errno($link2), mysqli_error($link));
+
+ if (false !== ($tmp = @mysqli_ping($link)))
+ printf("[016] Expecting boolean/false got %s/%s\n", gettype($tmp), $tmp);
+
+ if ($res = @mysqli_query($link, "SELECT DATABASE() as _dbname"))
+ printf("[017] Running a query should not be possible, connection should be gone, [%d] %s\n",
+ mysqli_errno($link), mysqli_error($link));
+
+ mysqli_close($link2);
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_num_fields.phpt b/ext/mysqli/tests/mysqli_num_fields.phpt
index f891b309c2..df2161f685 100644
--- a/ext/mysqli/tests/mysqli_num_fields.phpt
+++ b/ext/mysqli/tests/mysqli_num_fields.phpt
@@ -8,50 +8,47 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ require('table.inc');
- if (!is_null($tmp = @mysqli_num_fields()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ function func_test_mysqli_num_fields($link, $query, $expected, $offset, $test_free = false) {
- if (!is_null($tmp = @mysqli_num_fields($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!($res = mysqli_query($link, $query))) {
+ printf("[%03d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
+ return;
+ }
- require('table.inc');
+ if ($expected !== ($tmp = mysqli_num_fields($res)))
+ printf("[%03d] Expecting %s/%d, got %s/%d\n", $offset + 1,
+ gettype($expected), $expected,
+ gettype($tmp), $tmp);
- function func_test_mysqli_num_fields($link, $query, $expected, $offset, $test_free = false) {
+ mysqli_free_result($res);
- if (!($res = mysqli_query($link, $query))) {
- printf("[%03d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
- return;
- }
+ try {
+ mysqli_num_fields($res);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+ }
- if ($expected !== ($tmp = mysqli_num_fields($res)))
- printf("[%03d] Expecting %s/%d, got %s/%d\n", $offset + 1,
- gettype($expected), $expected,
- gettype($tmp), $tmp);
+ func_test_mysqli_num_fields($link, "SELECT 1 AS a", 1, 5);
+ func_test_mysqli_num_fields($link, "SELECT id, label FROM test", 2, 10);
+ func_test_mysqli_num_fields($link, "SELECT 1 AS a, NULL AS b, 'foo' AS c", 3, 15);
+ func_test_mysqli_num_fields($link, "SELECT id FROM test", 1, 20, true);
- mysqli_free_result($res);
+ mysqli_close($link);
- if ($test_free && (false !== ($tmp = mysqli_num_fields($res))))
- printf("[%03d] Expecting false, got %s/%s\n", $offset + 2, gettype($tmp), $tmp);
- }
-
- func_test_mysqli_num_fields($link, "SELECT 1 AS a", 1, 5);
- func_test_mysqli_num_fields($link, "SELECT id, label FROM test", 2, 10);
- func_test_mysqli_num_fields($link, "SELECT 1 AS a, NULL AS b, 'foo' AS c", 3, 15);
- func_test_mysqli_num_fields($link, "SELECT id FROM test", 1, 20, true);
-
- mysqli_close($link);
-
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
---EXPECTF--
-Warning: mysqli_num_fields(): Couldn't fetch mysqli_result in %s on line %d
+--EXPECT--
+mysqli_result object is already closed
+mysqli_result object is already closed
+mysqli_result object is already closed
+mysqli_result object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_num_rows.phpt b/ext/mysqli/tests/mysqli_num_rows.phpt
index c6e646e4c3..3266f37dce 100644
--- a/ext/mysqli/tests/mysqli_num_rows.phpt
+++ b/ext/mysqli/tests/mysqli_num_rows.phpt
@@ -8,81 +8,74 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ require('table.inc');
- if (!is_null($tmp = @mysqli_num_rows()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ function func_test_mysqli_num_rows($link, $query, $expected, $offset, $test_free = false) {
- if (!is_null($tmp = @mysqli_num_rows($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!$res = mysqli_query($link, $query, MYSQLI_STORE_RESULT)) {
+ printf("[%03d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
+ return;
+ }
- require('table.inc');
+ if (!is_bool($res)) {
+ if ($expected !== ($tmp = mysqli_num_rows($res)))
+ printf("[%03d] Expecting %s/%d, got %s/%d\n", $offset + 1,
+ gettype($expected), $expected,
+ gettype($tmp), $tmp);
- function func_test_mysqli_num_rows($link, $query, $expected, $offset, $test_free = false) {
+ mysqli_free_result($res);
- if (!$res = mysqli_query($link, $query, MYSQLI_STORE_RESULT)) {
- printf("[%03d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
- return;
- }
+ try {
+ mysqli_num_rows($res);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+ }
+ }
- if ($expected !== ($tmp = mysqli_num_rows($res)))
- printf("[%03d] Expecting %s/%d, got %s/%d\n", $offset + 1,
- gettype($expected), $expected,
- gettype($tmp), $tmp);
+ func_test_mysqli_num_rows($link, "SELECT 1 AS a", 1, 5);
+ func_test_mysqli_num_rows($link, "SHOW VARIABLES LIKE '%nixnutz%'", 0, 10);
+ func_test_mysqli_num_rows($link, "INSERT INTO test(id, label) VALUES (100, 'z')", NULL, 15);
+ func_test_mysqli_num_rows($link, "SELECT id FROM test LIMIT 2", 2, 20, true);
- mysqli_free_result($res);
+ if ($res = mysqli_query($link, 'SELECT COUNT(id) AS num FROM test')) {
- if ($test_free && (false !== ($tmp = mysqli_num_rows($res))))
- printf("[%03d] Expecting false, got %s/%s\n", $offset + 2, gettype($tmp), $tmp);
+ $row = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
- }
+ func_test_mysqli_num_rows($link, "SELECT id, label FROM test", (int)$row['num'], 25);
- func_test_mysqli_num_rows($link, "SELECT 1 AS a", 1, 5);
- func_test_mysqli_num_rows($link, "SHOW VARIABLES LIKE '%nixnutz%'", 0, 10);
- func_test_mysqli_num_rows($link, "INSERT INTO test(id, label) VALUES (100, 'z')", NULL, 15);
- func_test_mysqli_num_rows($link, "SELECT id FROM test LIMIT 2", 2, 20, true);
+ } else {
+ printf("[030] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- if ($res = mysqli_query($link, 'SELECT COUNT(id) AS num FROM test')) {
+ print "run_tests.php don't fool me with your 'ungreedy' expression '.+?'!\n";
- $row = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
+ if ($res = mysqli_query($link, 'SELECT id FROM test', MYSQLI_USE_RESULT)) {
- func_test_mysqli_num_rows($link, "SELECT id, label FROM test", (int)$row['num'], 25);
+ $row = mysqli_fetch_row($res);
+ if (0 !== ($tmp = mysqli_num_rows($res)))
+ printf("[031] Expecting int/0, got %s/%d\n", gettype($tmp), $tmp);
- } else {
- printf("[030] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ mysqli_free_result($res);
+ } else {
+ printf("[032] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- print "run_tests.php don't fool me with your 'ungreedy' expression '.+?'!\n";
-
- if ($res = mysqli_query($link, 'SELECT id FROM test', MYSQLI_USE_RESULT)) {
-
- $row = mysqli_fetch_row($res);
- if (0 !== ($tmp = mysqli_num_rows($res)))
- printf("[031] Expecting int/0, got %s/%d\n", gettype($tmp), $tmp);
-
- mysqli_free_result($res);
-
- } else {
- printf("[032] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
-
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
--EXPECTF--
-Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, bool given in %s on line %d
-
-Warning: mysqli_free_result() expects parameter 1 to be mysqli_result, bool given in %s on line %d
-
-Warning: mysqli_num_rows(): Couldn't fetch mysqli_result in %s on line %d
+mysqli_result object is already closed
+mysqli_result object is already closed
+mysqli_result object is already closed
+mysqli_result object is already closed
run_tests.php don't fool me with your 'ungreedy' expression '.+?'!
Warning: mysqli_num_rows(): Function cannot be used with MYSQL_USE_RESULT in %s on line %d
diff --git a/ext/mysqli/tests/mysqli_open_bug74432.phpt b/ext/mysqli/tests/mysqli_open_bug74432.phpt
index 08139081c4..9d529925e9 100644
--- a/ext/mysqli/tests/mysqli_open_bug74432.phpt
+++ b/ext/mysqli/tests/mysqli_open_bug74432.phpt
@@ -8,19 +8,19 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- /* This behavior is undocumented, but might be in use. Until there's no officially
- supported alternative, ensure changes doesn't cause BC breach. Otherwise,
- the test should be removed once the undocumented behavior changes. */
+ /* This behavior is undocumented, but might be in use. Until there's no officially
+ supported alternative, ensure changes doesn't cause BC breach. Otherwise,
+ the test should be removed once the undocumented behavior changes. */
- require_once("connect.inc");
+ require_once("connect.inc");
- $handle = mysqli_connect("$host:$port", $user, $passwd);
+ $handle = mysqli_connect("$host:$port", $user, $passwd);
- var_dump($handle);
+ var_dump($handle);
- if ($handle) {
- mysqli_close($handle);
- }
+ if ($handle) {
+ mysqli_close($handle);
+ }
?>
--EXPECTF--
object(mysqli)#%d (%d) {
diff --git a/ext/mysqli/tests/mysqli_options.phpt b/ext/mysqli/tests/mysqli_options.phpt
index 6d5247943b..bec663a64a 100644
--- a/ext/mysqli/tests/mysqli_options.phpt
+++ b/ext/mysqli/tests/mysqli_options.phpt
@@ -8,107 +8,94 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
-
- $valid_options = array(
- MYSQLI_READ_DEFAULT_GROUP => "MYSQLI_READ_DEFAULT_GROUP",
- MYSQLI_READ_DEFAULT_FILE => "MYSQLI_READ_DEFAULT_FILE",
- MYSQLI_OPT_CONNECT_TIMEOUT => "MYSQLI_OPT_CONNECT_TIMEOUT",
- MYSQLI_OPT_LOCAL_INFILE => "MYSQLI_OPT_LOCAL_INFILE",
- MYSQLI_INIT_COMMAND => "MYSQLI_INIT_COMMAND",
- MYSQLI_SET_CHARSET_NAME => "MYSQLI_SET_CHARSET_NAME",
- MYSQLI_OPT_SSL_VERIFY_SERVER_CERT => "MYSQLI_OPT_SSL_VERIFY_SERVER_CERT",
- );
-
- if ($IS_MYSQLND && defined('MYSQLI_OPT_NET_CMD_BUFFER_SIZE'))
- $valid_options[] = constant('MYSQLI_OPT_NET_CMD_BUFFER_SIZE');
- if ($IS_MYSQLND && defined('MYSQLI_OPT_NET_READ_BUFFER_SIZE'))
- $valid_options[] = constant('MYSQLI_OPT_NET_READ_BUFFER_SIZE');
- if ($IS_MYSQLND && defined('MYSQLI_OPT_INT_AND_FLOAT_NATIVE'))
- $valid_options[] = constant('MYSQLI_OPT_INT_AND_FLOAT_NATIVE');
-
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_options()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_options($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- $link = mysqli_init();
-
- /* set it twice, checking if memory for the previous one is correctly freed */
- mysqli_options($link, MYSQLI_SET_CHARSET_NAME, "utf8");
- mysqli_options($link, MYSQLI_SET_CHARSET_NAME, "latin1");
-
- if (!is_null($tmp = @mysqli_options($link, MYSQLI_OPT_CONNECT_TIMEOUT)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_options($link, "s", 'extra_my.cnf')))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_options($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=0', 'foo')))
- printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- // print "run_tests.php don't fool me with your 'ungreedy' expression '.+?'!\n";
- var_dump("MYSQLI_READ_DEFAULT_GROUP", mysqli_options($link, MYSQLI_READ_DEFAULT_GROUP, 'extra_my.cnf'));
- var_dump("MYSQLI_READ_DEFAULT_FILE", mysqli_options($link, MYSQLI_READ_DEFAULT_FILE, 'extra_my.cnf'));
- var_dump("MYSQLI_OPT_CONNECT_TIMEOUT", mysqli_options($link, MYSQLI_OPT_CONNECT_TIMEOUT, 10));
- var_dump("MYSQLI_OPT_LOCAL_INFILE", mysqli_options($link, MYSQLI_OPT_LOCAL_INFILE, 1));
- var_dump("MYSQLI_INIT_COMMAND", mysqli_options($link, MYSQLI_INIT_COMMAND, array('SET AUTOCOMMIT=0', 'SET AUTOCOMMIT=1')));
-
- if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[006] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
-
- if (!$res = mysqli_query($link2, 'SELECT version() AS server_version'))
- printf("[007] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- $version = explode('.', $tmp['server_version']);
- if (empty($version))
- printf("[008] Cannot determine server version, need MySQL Server 4.1+ for the test!\n");
-
- if ($version[0] <= 4 && $version[1] < 1)
- printf("[009] Need MySQL Server 4.1+ for the test!\n");
-
- if (!$res = mysqli_query($link2, "SHOW CHARACTER SET"))
- printf("[010] Cannot get list of available character sets, [%d] %s\n",
- mysqli_errno($link2), mysqli_error($link2));
-
- $charsets = array();
- while ($row = mysqli_fetch_assoc($res))
- $charsets[] = $row;
- mysqli_free_result($res);
- mysqli_close($link2);
-
- foreach ($charsets as $charset) {
- $k = $charset['Charset'];
- /* The server currently 17.07.2007 can't handle data sent in ucs2 */
- /* The server currently 16.08.2010 can't handle data sent in utf16 and utf32 */
- if ($charset['Charset'] == 'ucs2' || $charset['Charset'] == 'utf16' || $charset['Charset'] == 'utf32') {
- continue;
- }
- if (true !== mysqli_options($link, MYSQLI_SET_CHARSET_NAME, $charset['Charset'])) {
- printf("[009] Setting charset name '%s' has failed\n", $charset['Charset']);
- }
- }
-
- var_dump("MYSQLI_READ_DEFAULT_GROUP", mysqli_options($link, MYSQLI_READ_DEFAULT_GROUP, 'extra_my.cnf'));
- var_dump("MYSQLI_READ_DEFAULT_FILE", mysqli_options($link, MYSQLI_READ_DEFAULT_FILE, 'extra_my.cnf'));
- var_dump("MYSQLI_OPT_CONNECT_TIMEOUT", mysqli_options($link, MYSQLI_OPT_CONNECT_TIMEOUT, 10));
- var_dump("MYSQLI_OPT_LOCAL_INFILE", mysqli_options($link, MYSQLI_OPT_LOCAL_INFILE, 1));
- var_dump("MYSQLI_INIT_COMMAND", mysqli_options($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=0'));
-
- /* mysqli_real_connect() */
- var_dump("MYSQLI_CLIENT_SSL", mysqli_options($link, MYSQLI_CLIENT_SSL, 'not a mysqli_option'));
-
- mysqli_close($link);
-
- echo "Link closed";
- var_dump("MYSQLI_INIT_COMMAND", mysqli_options($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=1'));
- print "done!";
+ require_once("connect.inc");
+
+ $valid_options = array(
+ MYSQLI_READ_DEFAULT_GROUP => "MYSQLI_READ_DEFAULT_GROUP",
+ MYSQLI_READ_DEFAULT_FILE => "MYSQLI_READ_DEFAULT_FILE",
+ MYSQLI_OPT_CONNECT_TIMEOUT => "MYSQLI_OPT_CONNECT_TIMEOUT",
+ MYSQLI_OPT_LOCAL_INFILE => "MYSQLI_OPT_LOCAL_INFILE",
+ MYSQLI_INIT_COMMAND => "MYSQLI_INIT_COMMAND",
+ MYSQLI_SET_CHARSET_NAME => "MYSQLI_SET_CHARSET_NAME",
+ MYSQLI_OPT_SSL_VERIFY_SERVER_CERT => "MYSQLI_OPT_SSL_VERIFY_SERVER_CERT",
+ );
+
+ if ($IS_MYSQLND && defined('MYSQLI_OPT_NET_CMD_BUFFER_SIZE'))
+ $valid_options[] = constant('MYSQLI_OPT_NET_CMD_BUFFER_SIZE');
+ if ($IS_MYSQLND && defined('MYSQLI_OPT_NET_READ_BUFFER_SIZE'))
+ $valid_options[] = constant('MYSQLI_OPT_NET_READ_BUFFER_SIZE');
+ if ($IS_MYSQLND && defined('MYSQLI_OPT_INT_AND_FLOAT_NATIVE'))
+ $valid_options[] = constant('MYSQLI_OPT_INT_AND_FLOAT_NATIVE');
+
+ $link = mysqli_init();
+
+ /* set it twice, checking if memory for the previous one is correctly freed */
+ mysqli_options($link, MYSQLI_SET_CHARSET_NAME, "utf8");
+ mysqli_options($link, MYSQLI_SET_CHARSET_NAME, "latin1");
+
+ // print "run_tests.php don't fool me with your 'ungreedy' expression '.+?'!\n";
+ var_dump("MYSQLI_READ_DEFAULT_GROUP", mysqli_options($link, MYSQLI_READ_DEFAULT_GROUP, 'extra_my.cnf'));
+ var_dump("MYSQLI_READ_DEFAULT_FILE", mysqli_options($link, MYSQLI_READ_DEFAULT_FILE, 'extra_my.cnf'));
+ var_dump("MYSQLI_OPT_CONNECT_TIMEOUT", mysqli_options($link, MYSQLI_OPT_CONNECT_TIMEOUT, 10));
+ var_dump("MYSQLI_OPT_LOCAL_INFILE", mysqli_options($link, MYSQLI_OPT_LOCAL_INFILE, 1));
+ var_dump("MYSQLI_INIT_COMMAND", mysqli_options($link, MYSQLI_INIT_COMMAND, array('SET AUTOCOMMIT=0', 'SET AUTOCOMMIT=1')));
+
+ if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[006] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+
+ if (!$res = mysqli_query($link2, 'SELECT version() AS server_version'))
+ printf("[007] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ $version = explode('.', $tmp['server_version']);
+ if (empty($version))
+ printf("[008] Cannot determine server version, need MySQL Server 4.1+ for the test!\n");
+
+ if ($version[0] <= 4 && $version[1] < 1)
+ printf("[009] Need MySQL Server 4.1+ for the test!\n");
+
+ if (!$res = mysqli_query($link2, "SHOW CHARACTER SET"))
+ printf("[010] Cannot get list of available character sets, [%d] %s\n",
+ mysqli_errno($link2), mysqli_error($link2));
+
+ $charsets = array();
+ while ($row = mysqli_fetch_assoc($res))
+ $charsets[] = $row;
+ mysqli_free_result($res);
+ mysqli_close($link2);
+
+ foreach ($charsets as $charset) {
+ $k = $charset['Charset'];
+ /* The server currently 17.07.2007 can't handle data sent in ucs2 */
+ /* The server currently 16.08.2010 can't handle data sent in utf16 and utf32 */
+ if ($charset['Charset'] == 'ucs2' || $charset['Charset'] == 'utf16' || $charset['Charset'] == 'utf32') {
+ continue;
+ }
+ if (true !== mysqli_options($link, MYSQLI_SET_CHARSET_NAME, $charset['Charset'])) {
+ printf("[009] Setting charset name '%s' has failed\n", $charset['Charset']);
+ }
+ }
+
+ var_dump("MYSQLI_READ_DEFAULT_GROUP", mysqli_options($link, MYSQLI_READ_DEFAULT_GROUP, 'extra_my.cnf'));
+ var_dump("MYSQLI_READ_DEFAULT_FILE", mysqli_options($link, MYSQLI_READ_DEFAULT_FILE, 'extra_my.cnf'));
+ var_dump("MYSQLI_OPT_CONNECT_TIMEOUT", mysqli_options($link, MYSQLI_OPT_CONNECT_TIMEOUT, 10));
+ var_dump("MYSQLI_OPT_LOCAL_INFILE", mysqli_options($link, MYSQLI_OPT_LOCAL_INFILE, 1));
+ var_dump("MYSQLI_INIT_COMMAND", mysqli_options($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=0'));
+
+ /* mysqli_real_connect() */
+ var_dump("MYSQLI_CLIENT_SSL", mysqli_options($link, MYSQLI_CLIENT_SSL, 'not a mysqli_option'));
+
+ mysqli_close($link);
+
+ echo "Link closed\n";
+ try {
+ mysqli_options($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=1');
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ print "done!";
?>
--EXPECTF--
%s(25) "MYSQLI_READ_DEFAULT_GROUP"
@@ -120,7 +107,7 @@ bool(true)
%s(23) "MYSQLI_OPT_LOCAL_INFILE"
bool(true)
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
%s(19) "MYSQLI_INIT_COMMAND"
bool(true)
%s(25) "MYSQLI_READ_DEFAULT_GROUP"
@@ -136,7 +123,5 @@ bool(true)
%s(17) "MYSQLI_CLIENT_SSL"
bool(false)
Link closed
-Warning: mysqli_options(): Couldn't fetch mysqli in %s line %d
-%s(19) "MYSQLI_INIT_COMMAND"
-bool(false)
+mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_options_init_command.phpt b/ext/mysqli/tests/mysqli_options_init_command.phpt
index 734adcf5c8..35e98e7e47 100644
--- a/ext/mysqli/tests/mysqli_options_init_command.phpt
+++ b/ext/mysqli/tests/mysqli_options_init_command.phpt
@@ -9,64 +9,64 @@ require_once('skipifconnectfailure.inc');
<?php require_once('skipifemb.inc'); ?>
--FILE--
<?php
- /* see mysqli.c for details */
- require_once("connect.inc");
+ /* see mysqli.c for details */
+ require_once("connect.inc");
- if (!($link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!($link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- /* TODO: test more options */
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test") ||
- !mysqli_query($link, sprintf("CREATE TABLE test(id INT) ENGINE = %s\n", $engine)) ||
- !mysqli_query($link, "INSERT INTO test(id) VALUES (1)"))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ /* TODO: test more options */
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test") ||
+ !mysqli_query($link, sprintf("CREATE TABLE test(id INT) ENGINE = %s\n", $engine)) ||
+ !mysqli_query($link, "INSERT INTO test(id) VALUES (1)"))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$res = mysqli_query($link, "SELECT COUNT(id) AS _num_rows FROM test"))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, "SELECT COUNT(id) AS _num_rows FROM test"))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $row = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
+ $row = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
- if ($row['_num_rows'] != 1)
- printf("[003] Expecting 1 got %s\n", $row['_num_rows']);
+ if ($row['_num_rows'] != 1)
+ printf("[003] Expecting 1 got %s\n", $row['_num_rows']);
- mysqli_close($link);
+ mysqli_close($link);
- $link = mysqli_init();
- if (true !== mysqli_options($link, MYSQLI_INIT_COMMAND, "INSERT INTO test(id) VALUES (2)"))
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $link = mysqli_init();
+ if (true !== mysqli_options($link, MYSQLI_INIT_COMMAND, "INSERT INTO test(id) VALUES (2)"))
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))
- printf("[005] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))
+ printf("[005] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (!$res = mysqli_query($link, "SELECT COUNT(id) AS _num_rows FROM test"))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, "SELECT COUNT(id) AS _num_rows FROM test"))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $row = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
+ $row = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
- if ($row['_num_rows'] != 2)
- printf("[007] Expecting 1 got %s\n", $row['_num_rows']);
+ if ($row['_num_rows'] != 2)
+ printf("[007] Expecting 1 got %s\n", $row['_num_rows']);
- mysqli_close($link);
+ mysqli_close($link);
- $link = mysqli_init();
- if (true !== mysqli_options($link, MYSQLI_INIT_COMMAND, "INSERT INTO test(i_do_no_exist) VALUES (2)"))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $link = mysqli_init();
+ if (true !== mysqli_options($link, MYSQLI_INIT_COMMAND, "INSERT INTO test(i_do_no_exist) VALUES (2)"))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_close($link);
+ mysqli_close($link);
- $link = mysqli_init();
- if (true !== mysqli_options($link, MYSQLI_INIT_COMMAND, "INSERT INTO test(i_do_no_exist) VALUES (2)"))
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $link = mysqli_init();
+ if (true !== mysqli_options($link, MYSQLI_INIT_COMMAND, "INSERT INTO test(i_do_no_exist) VALUES (2)"))
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))
- printf("[010] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))
+ printf("[010] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_options_int_and_float_native.phpt b/ext/mysqli/tests/mysqli_options_int_and_float_native.phpt
index 94acab84bb..8f81d4a3e4 100644
--- a/ext/mysqli/tests/mysqli_options_int_and_float_native.phpt
+++ b/ext/mysqli/tests/mysqli_options_int_and_float_native.phpt
@@ -12,94 +12,94 @@ if (!$IS_MYSQLND)
?>
--FILE--
<?php
- require_once("connect.inc");
-
-
- $types = array(
- 'BIT' => array('BIT(8)', 0),
- 'TINYINT' => array('TINYINT', 120),
- 'BOOL' => array('BOOL', 0),
- 'BOOLEAN' => array('BOOLEAN', 1),
- 'SMALLINT' => array('SMALLINT', 32000),
- 'MEDIUMINT' => array('MEDIUMINT', 999),
- 'INT' => array('INT', 999),
- 'BIGINT' => array('BIGINT', 999),
- 'FLOAT' => array('FLOAT', 1.3),
- 'DOUBLE' => array('DOUBLE', -1.3),
- );
-
- foreach ($types as $name => $data) {
- $link = mysqli_init();
- if (!mysqli_options($link, MYSQLI_OPT_INT_AND_FLOAT_NATIVE, 1)) {
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- continue;
- }
-
- if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
- printf("[002] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- continue;
- }
-
-
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- continue;
- }
-
- if (!mysqli_query($link, sprintf("CREATE TABLE test (id %s)", $data[0]))) {
- printf("[004] TODO [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- continue;
- }
-
- if (!mysqli_query($link, sprintf("INSERT INTO test(id) VALUES (%f)", $data[1]))) {
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- continue;
- }
-
- if (!$res = mysqli_query($link, "SELECT id FROM test")) {
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- continue;
- }
-
- $row = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
-
- if ($row['id'] !== $data[1]) {
- printf("[007] Expecting %s - %s/%s got %s/%s\n",
- $name,
- $data[1], gettype($data[1]), $row['id'], gettype($row['id']));
- }
- mysqli_close($link);
-
- $link = mysqli_init();
- if (!mysqli_options($link, MYSQLI_OPT_INT_AND_FLOAT_NATIVE, 0)) {
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- continue;
- }
-
- if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
- printf("[009] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- continue;
- }
-
- if (!$res = mysqli_query($link, "SELECT id FROM test")) {
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- continue;
- }
-
- $row = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
-
- if (!is_string($row['id']) || ($row['id'] != $data[1])) {
- printf("[011] Expecting %s - %s/string got %s/%s\n",
- $name,
- $data[1], $row['id'], gettype($row['id']));
- }
- mysqli_close($link);
-
- }
-
- print "done!";
+ require_once("connect.inc");
+
+
+ $types = array(
+ 'BIT' => array('BIT(8)', 0),
+ 'TINYINT' => array('TINYINT', 120),
+ 'BOOL' => array('BOOL', 0),
+ 'BOOLEAN' => array('BOOLEAN', 1),
+ 'SMALLINT' => array('SMALLINT', 32000),
+ 'MEDIUMINT' => array('MEDIUMINT', 999),
+ 'INT' => array('INT', 999),
+ 'BIGINT' => array('BIGINT', 999),
+ 'FLOAT' => array('FLOAT', 1.3),
+ 'DOUBLE' => array('DOUBLE', -1.3),
+ );
+
+ foreach ($types as $name => $data) {
+ $link = mysqli_init();
+ if (!mysqli_options($link, MYSQLI_OPT_INT_AND_FLOAT_NATIVE, 1)) {
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ continue;
+ }
+
+ if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
+ printf("[002] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ continue;
+ }
+
+
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ continue;
+ }
+
+ if (!mysqli_query($link, sprintf("CREATE TABLE test (id %s)", $data[0]))) {
+ printf("[004] TODO [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ continue;
+ }
+
+ if (!mysqli_query($link, sprintf("INSERT INTO test(id) VALUES (%f)", $data[1]))) {
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ continue;
+ }
+
+ if (!$res = mysqli_query($link, "SELECT id FROM test")) {
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ continue;
+ }
+
+ $row = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+
+ if ($row['id'] !== $data[1]) {
+ printf("[007] Expecting %s - %s/%s got %s/%s\n",
+ $name,
+ $data[1], gettype($data[1]), $row['id'], gettype($row['id']));
+ }
+ mysqli_close($link);
+
+ $link = mysqli_init();
+ if (!mysqli_options($link, MYSQLI_OPT_INT_AND_FLOAT_NATIVE, 0)) {
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ continue;
+ }
+
+ if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
+ printf("[009] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ continue;
+ }
+
+ if (!$res = mysqli_query($link, "SELECT id FROM test")) {
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ continue;
+ }
+
+ $row = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+
+ if (!is_string($row['id']) || ($row['id'] != $data[1])) {
+ printf("[011] Expecting %s - %s/string got %s/%s\n",
+ $name,
+ $data[1], $row['id'], gettype($row['id']));
+ }
+ mysqli_close($link);
+
+ }
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_options_openbasedir.phpt b/ext/mysqli/tests/mysqli_options_openbasedir.phpt
index d7b4b6b13e..52dc03296d 100644
--- a/ext/mysqli/tests/mysqli_options_openbasedir.phpt
+++ b/ext/mysqli/tests/mysqli_options_openbasedir.phpt
@@ -11,15 +11,15 @@ require_once('skipifconnectfailure.inc');
require_once('connect.inc');
ini_set("open_basedir", __DIR__);
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ printf("[001] Cannot connect, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
if ($IS_MYSQLND) {
- if (true !== mysqli_options($link, MYSQLI_OPT_LOCAL_INFILE, 1))
- printf("[002] Can not set MYSQLI_OPT_LOCAL_INFILE although open_basedir is set!\n");
+ if (true !== mysqli_options($link, MYSQLI_OPT_LOCAL_INFILE, 1))
+ printf("[002] Can not set MYSQLI_OPT_LOCAL_INFILE although open_basedir is set!\n");
} else {
- if (false !== mysqli_options($link, MYSQLI_OPT_LOCAL_INFILE, 1))
- printf("[002] Can set MYSQLI_OPT_LOCAL_INFILE although open_basedir is set!\n");
+ if (false !== mysqli_options($link, MYSQLI_OPT_LOCAL_INFILE, 1))
+ printf("[002] Can set MYSQLI_OPT_LOCAL_INFILE although open_basedir is set!\n");
}
mysqli_close($link);
diff --git a/ext/mysqli/tests/mysqli_pam_sha256.phpt b/ext/mysqli/tests/mysqli_pam_sha256.phpt
index b263939837..2085ab135a 100644
--- a/ext/mysqli/tests/mysqli_pam_sha256.phpt
+++ b/ext/mysqli/tests/mysqli_pam_sha256.phpt
@@ -79,29 +79,29 @@ $link->close();
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!$link = my_mysqli_connect($host, 'shatest', 'shatest', $db, $port, $socket)) {
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, "shatest", $db, $port, $socket);
- } else {
+ if (!$link = my_mysqli_connect($host, 'shatest', 'shatest', $db, $port, $socket)) {
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, "shatest", $db, $port, $socket);
+ } else {
- if (!$res = $link->query("SELECT id FROM test WHERE id = 1"))
- printf("[002] [%d] %s\n", $link->errno, $link->error);
+ if (!$res = $link->query("SELECT id FROM test WHERE id = 1"))
+ printf("[002] [%d] %s\n", $link->errno, $link->error);
- if (!$row = mysqli_fetch_assoc($res)) {
- printf("[003] [%d] %s\n", $link->errno, $link->error);
- }
+ if (!$row = mysqli_fetch_assoc($res)) {
+ printf("[003] [%d] %s\n", $link->errno, $link->error);
+ }
- if ($row['id'] != 1) {
- printf("[004] Expecting 1 got %s/'%s'", gettype($row['id']), $row['id']);
- }
+ if ($row['id'] != 1) {
+ printf("[004] Expecting 1 got %s/'%s'", gettype($row['id']), $row['id']);
+ }
- $res->close();
- $link->close();
- }
+ $res->close();
+ $link->close();
+ }
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_pam_sha256_public_key_ini.phpt b/ext/mysqli/tests/mysqli_pam_sha256_public_key_ini.phpt
index cd96c55ad5..5620d4f4e7 100644
--- a/ext/mysqli/tests/mysqli_pam_sha256_public_key_ini.phpt
+++ b/ext/mysqli/tests/mysqli_pam_sha256_public_key_ini.phpt
@@ -94,25 +94,25 @@ $link->close();
mysqlnd.sha256_server_public_key="test_sha256_ini"
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $link = new mysqli($host, 'shatest', 'shatest', $db, $port, $socket);
- if ($link->connect_errno) {
- printf("[001] [%d] %s\n", $link->connect_errno, $link->connect_error);
- } else {
- if (!$res = $link->query("SELECT id FROM test WHERE id = 1"))
- printf("[002] [%d] %s\n", $link->errno, $link->error);
+ $link = new mysqli($host, 'shatest', 'shatest', $db, $port, $socket);
+ if ($link->connect_errno) {
+ printf("[001] [%d] %s\n", $link->connect_errno, $link->connect_error);
+ } else {
+ if (!$res = $link->query("SELECT id FROM test WHERE id = 1"))
+ printf("[002] [%d] %s\n", $link->errno, $link->error);
- if (!$row = mysqli_fetch_assoc($res)) {
- printf("[003] [%d] %s\n", $link->errno, $link->error);
- }
+ if (!$row = mysqli_fetch_assoc($res)) {
+ printf("[003] [%d] %s\n", $link->errno, $link->error);
+ }
- if ($row['id'] != 1) {
- printf("[004] Expecting 1 got %s/'%s'", gettype($row['id']), $row['id']);
- }
- }
- print "done!";
+ if ($row['id'] != 1) {
+ printf("[004] Expecting 1 got %s/'%s'", gettype($row['id']), $row['id']);
+ }
+ }
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_pam_sha256_public_key_option.phpt b/ext/mysqli/tests/mysqli_pam_sha256_public_key_option.phpt
index 190158316b..e0c25d607f 100644
--- a/ext/mysqli/tests/mysqli_pam_sha256_public_key_option.phpt
+++ b/ext/mysqli/tests/mysqli_pam_sha256_public_key_option.phpt
@@ -89,36 +89,36 @@ $link->close();
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $file = sprintf("%s%s%s_%s", sys_get_temp_dir(), DIRECTORY_SEPARATOR, "test_sha256_" , @date("Ymd"));
- if (file_exists($file) && is_readable($file)) {
+ $file = sprintf("%s%s%s_%s", sys_get_temp_dir(), DIRECTORY_SEPARATOR, "test_sha256_" , @date("Ymd"));
+ if (file_exists($file) && is_readable($file)) {
- $link = mysqli_init();
- if (!($link->options(MYSQLI_SERVER_PUBLIC_KEY, $file))) {
- printf("[001] mysqli_options failed, [%d] %s\n", $link->errno, $link->error);
- }
+ $link = mysqli_init();
+ if (!($link->options(MYSQLI_SERVER_PUBLIC_KEY, $file))) {
+ printf("[001] mysqli_options failed, [%d] %s\n", $link->errno, $link->error);
+ }
- if (!$link->real_connect($host, 'shatest', 'shatest', $db, $port, $socket)) {
- printf("[002] [%d] %s\n", $link->connect_errno, $link->connect_error);
- }
+ if (!$link->real_connect($host, 'shatest', 'shatest', $db, $port, $socket)) {
+ printf("[002] [%d] %s\n", $link->connect_errno, $link->connect_error);
+ }
- if (!$res = $link->query("SELECT id FROM test WHERE id = 1"))
- printf("[003] [%d] %s\n", $link->errno, $link->error);
+ if (!$res = $link->query("SELECT id FROM test WHERE id = 1"))
+ printf("[003] [%d] %s\n", $link->errno, $link->error);
- if (!$row = mysqli_fetch_assoc($res)) {
- printf("[004] [%d] %s\n", $link->errno, $link->error);
- }
+ if (!$row = mysqli_fetch_assoc($res)) {
+ printf("[004] [%d] %s\n", $link->errno, $link->error);
+ }
- if ($row['id'] != 1) {
- printf("[005] Expecting 1 got %s/'%s'", gettype($row['id']), $row['id']);
- }
+ if ($row['id'] != 1) {
+ printf("[005] Expecting 1 got %s/'%s'", gettype($row['id']), $row['id']);
+ }
- $res->close();
- $link->close();
- }
+ $res->close();
+ $link->close();
+ }
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_pam_sha256_public_key_option_invalid.phpt b/ext/mysqli/tests/mysqli_pam_sha256_public_key_option_invalid.phpt
index 73b2ebe95c..8e8121f6e7 100644
--- a/ext/mysqli/tests/mysqli_pam_sha256_public_key_option_invalid.phpt
+++ b/ext/mysqli/tests/mysqli_pam_sha256_public_key_option_invalid.phpt
@@ -89,80 +89,80 @@ $link->close();
?>
--FILE--
<?php
- require_once("connect.inc");
-
- function sha_connect($offset, $host, $db, $port, $socket, $file) {
-
- $link = mysqli_init();
- if (!($link->options(MYSQLI_SERVER_PUBLIC_KEY, $file))) {
- printf("[%03d + 001] mysqli_options failed, [%d] %s\n", $offset, $link->errno, $link->error);
- return false;
- }
-
- if (!$link->real_connect($host, 'shatest', 'shatest', $db, $port, $socket)) {
- printf("[%03d + 002] [%d] %s\n", $offset, $link->connect_errno, $link->connect_error);
- return false;
- }
-
- if (!$res = $link->query("SELECT id FROM test WHERE id = 1"))
- printf("[%03d + 003] [%d] %s\n", $offset, $link->errno, $link->error);
- return false;
-
- if (!$row = mysqli_fetch_assoc($res)) {
- printf("[%03d + 004] [%d] %s\n", $offset, $link->errno, $link->error);
- return false;
- }
-
- if ($row['id'] != 1) {
- printf("[%03d + 005] Expecting 1 got %s/'%s'", $offset, gettype($row['id']), $row['id']);
- return false;
- }
-
- $res->close();
- $link->close();
- return true;
- }
-
- $file = sprintf("%s%s%s_%s", sys_get_temp_dir(), DIRECTORY_SEPARATOR, "test_sha256_" , @date("Ymd"));
- if (file_exists($file) && is_readable($file)) {
-
- /* valid key */
- sha_connect(100, $host, $db, $port, $socket, $file);
-
- /* invalid key */
- $file_wrong = sprintf("%s%s%s_%s", sys_get_temp_dir(), DIRECTORY_SEPARATOR, "test_sha256_wrong" , @date("Ymd"));
-
- $key = file_get_contents($file);
- $key = str_replace("A", "a", $key);
- $key = str_replace("M", "m", $key);
- @unlink($file_wrong);
- if (!($fp = fopen($file_wrong, "w"))) {
- printf("[002] Can't write public key file.");
- } else {
- fwrite($fp, $key);
- fclose($fp);
- sha_connect(200, $host, $db, $port, $socket, $file_wrong);
- }
-
- /* empty file */
- @unlink($file_wrong);
- if (!($fp = fopen($file_wrong, "w"))) {
- printf("[003] Can't write public key file.");
- } else {
- fwrite($fp, "");
- fclose($fp);
- sha_connect(300, $host, $db, $port, $socket, $file_wrong);
- }
-
- /* file does not exist */
- @unlink($file_wrong);
- sha_connect(400, $host, $db, $port, $socket, $file_wrong);
-
- } else {
- printf("[001] Cannot read public key file.");
- }
-
- print "done!";
+ require_once("connect.inc");
+
+ function sha_connect($offset, $host, $db, $port, $socket, $file) {
+
+ $link = mysqli_init();
+ if (!($link->options(MYSQLI_SERVER_PUBLIC_KEY, $file))) {
+ printf("[%03d + 001] mysqli_options failed, [%d] %s\n", $offset, $link->errno, $link->error);
+ return false;
+ }
+
+ if (!$link->real_connect($host, 'shatest', 'shatest', $db, $port, $socket)) {
+ printf("[%03d + 002] [%d] %s\n", $offset, $link->connect_errno, $link->connect_error);
+ return false;
+ }
+
+ if (!$res = $link->query("SELECT id FROM test WHERE id = 1"))
+ printf("[%03d + 003] [%d] %s\n", $offset, $link->errno, $link->error);
+ return false;
+
+ if (!$row = mysqli_fetch_assoc($res)) {
+ printf("[%03d + 004] [%d] %s\n", $offset, $link->errno, $link->error);
+ return false;
+ }
+
+ if ($row['id'] != 1) {
+ printf("[%03d + 005] Expecting 1 got %s/'%s'", $offset, gettype($row['id']), $row['id']);
+ return false;
+ }
+
+ $res->close();
+ $link->close();
+ return true;
+ }
+
+ $file = sprintf("%s%s%s_%s", sys_get_temp_dir(), DIRECTORY_SEPARATOR, "test_sha256_" , @date("Ymd"));
+ if (file_exists($file) && is_readable($file)) {
+
+ /* valid key */
+ sha_connect(100, $host, $db, $port, $socket, $file);
+
+ /* invalid key */
+ $file_wrong = sprintf("%s%s%s_%s", sys_get_temp_dir(), DIRECTORY_SEPARATOR, "test_sha256_wrong" , @date("Ymd"));
+
+ $key = file_get_contents($file);
+ $key = str_replace("A", "a", $key);
+ $key = str_replace("M", "m", $key);
+ @unlink($file_wrong);
+ if (!($fp = fopen($file_wrong, "w"))) {
+ printf("[002] Can't write public key file.");
+ } else {
+ fwrite($fp, $key);
+ fclose($fp);
+ sha_connect(200, $host, $db, $port, $socket, $file_wrong);
+ }
+
+ /* empty file */
+ @unlink($file_wrong);
+ if (!($fp = fopen($file_wrong, "w"))) {
+ printf("[003] Can't write public key file.");
+ } else {
+ fwrite($fp, "");
+ fclose($fp);
+ sha_connect(300, $host, $db, $port, $socket, $file_wrong);
+ }
+
+ /* file does not exist */
+ @unlink($file_wrong);
+ sha_connect(400, $host, $db, $port, $socket, $file_wrong);
+
+ } else {
+ printf("[001] Cannot read public key file.");
+ }
+
+ print "done!";
?>
--CLEAN--
<?php
@@ -181,7 +181,7 @@ Warning: mysqli::real_connect(): (HY000/1045): %s in %s on line %d
Warning: mysqli::real_connect(): (HY000/1045): %s in %s on line %d
[300 + 002] [1045] %s
-Warning: mysqli::real_connect(%sest_sha256_wrong_%d): failed to open stream: No such file or directory in %s on line %d
+Warning: mysqli::real_connect(%sest_sha256_wrong_%d): Failed to open stream: No such file or directory in %s on line %d
Warning: mysqli::real_connect(): (HY000/1045): %s in %s on line %d
[400 + 002] [1045] %s
diff --git a/ext/mysqli/tests/mysqli_pconn_conn_multiple.phpt b/ext/mysqli/tests/mysqli_pconn_conn_multiple.phpt
index f1adcf49f5..a68a6bb339 100644
--- a/ext/mysqli/tests/mysqli_pconn_conn_multiple.phpt
+++ b/ext/mysqli/tests/mysqli_pconn_conn_multiple.phpt
@@ -12,133 +12,133 @@ mysqli.max_persistent=-1
mysqli.max_links=-1
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $phost = 'p:' . $host;
+ $phost = 'p:' . $host;
- if (!$link = my_mysqli_connect($phost, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $phost, $user, $db, $port, $socket);
+ if (!$link = my_mysqli_connect($phost, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $phost, $user, $db, $port, $socket);
- if (!$thread_id = $link->thread_id)
- printf("[002] Cannot determine thread id, test will fail, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$thread_id = $link->thread_id)
+ printf("[002] Cannot determine thread id, test will fail, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (true !== ($tmp = my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)))
- printf("[003] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)))
+ printf("[003] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
- if (!is_int($new_thread_id = mysqli_thread_id($link)) || ($new_thread_id < 0))
- printf("[004] Expecting int/any got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_int($new_thread_id = mysqli_thread_id($link)) || ($new_thread_id < 0))
+ printf("[004] Expecting int/any got %s/%s\n", gettype($tmp), $tmp);
- if ($thread_id == $new_thread_id)
- printf("[005] Expecting new connection and new thread id. Old thread id %d, new thread id %d\n", $thread_id, $new_thread_id);
+ if ($thread_id == $new_thread_id)
+ printf("[005] Expecting new connection and new thread id. Old thread id %d, new thread id %d\n", $thread_id, $new_thread_id);
- if (!($res = mysqli_query($link, "SELECT 'ok' AS it_works")) ||
- !($row = mysqli_fetch_assoc($res)))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!($res = mysqli_query($link, "SELECT 'ok' AS it_works")) ||
+ !($row = mysqli_fetch_assoc($res)))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump($row);
- mysqli_free_result($res);
+ var_dump($row);
+ mysqli_free_result($res);
- mysqli_close($link);
+ mysqli_close($link);
- if (!$link = new my_mysqli($phost, $user, $passwd, $db, $port, $socket))
- printf("[007] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $phost, $user, $db, $port, $socket);
+ if (!$link = new my_mysqli($phost, $user, $passwd, $db, $port, $socket))
+ printf("[007] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $phost, $user, $db, $port, $socket);
- if (!$thread_id = $link->thread_id)
- printf("[008] Cannot determine thread id, test will fail, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$thread_id = $link->thread_id)
+ printf("[008] Cannot determine thread id, test will fail, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (true !== ($tmp = $link->real_connect($host, $user, $passwd, $db, $port, $socket)))
- printf("[009] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = $link->real_connect($host, $user, $passwd, $db, $port, $socket)))
+ printf("[009] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
- if (!is_int($new_thread_id = $link->thread_id) || ($new_thread_id < 0))
- printf("[010] Expecting int/any got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_int($new_thread_id = $link->thread_id) || ($new_thread_id < 0))
+ printf("[010] Expecting int/any got %s/%s\n", gettype($tmp), $tmp);
- if ($thread_id == $new_thread_id)
- printf("[011] Expecting new connection and new thread id. Old thread id %d, new thread id %d\n", $thread_id, $new_thread_id);
+ if ($thread_id == $new_thread_id)
+ printf("[011] Expecting new connection and new thread id. Old thread id %d, new thread id %d\n", $thread_id, $new_thread_id);
- if (!($res = $link->query("SELECT 'works also with oo' AS syntax")) ||
- !($row = $res->fetch_assoc()))
- printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!($res = $link->query("SELECT 'works also with oo' AS syntax")) ||
+ !($row = $res->fetch_assoc()))
+ printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump($row);
- mysqli_free_result($res);
+ var_dump($row);
+ mysqli_free_result($res);
- mysqli_close($link);
+ mysqli_close($link);
- if (NULL !== ($tmp = $link->connect($phost, $user, $passwd, $db, $port, $socket)))
- printf("[013] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = $link->connect($phost, $user, $passwd, $db, $port, $socket)))
+ printf("[013] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
- if (!$link = mysqli_connect($phost, $user, $passwd, $db, $port, $socket))
- printf("[014] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $phost, $user, $db, $port, $socket);
+ if (!$link = mysqli_connect($phost, $user, $passwd, $db, $port, $socket))
+ printf("[014] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $phost, $user, $db, $port, $socket);
- if (NULL !== ($tmp = $link->connect($host, $user, $passwd, $db, $port, $socket)))
- printf("[015] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = $link->connect($host, $user, $passwd, $db, $port, $socket)))
+ printf("[015] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
- printf("Flipping phost/host order\n");
+ printf("Flipping phost/host order\n");
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[016] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[016] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (!$thread_id = mysqli_thread_id($link))
- printf("[017] Cannot determine thread id, test will fail, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$thread_id = mysqli_thread_id($link))
+ printf("[017] Cannot determine thread id, test will fail, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (true !== ($tmp = my_mysqli_real_connect($link, $phost, $user, $passwd, $db, $port, $socket)))
- printf("[018] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = my_mysqli_real_connect($link, $phost, $user, $passwd, $db, $port, $socket)))
+ printf("[018] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
- if (!is_int($new_thread_id = mysqli_thread_id($link)) || ($new_thread_id < 0))
- printf("[019] Expecting int/any got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_int($new_thread_id = mysqli_thread_id($link)) || ($new_thread_id < 0))
+ printf("[019] Expecting int/any got %s/%s\n", gettype($tmp), $tmp);
- if ($thread_id == $new_thread_id)
- printf("[020] Expecting new connection and new thread id. Old thread id %d, new thread id %d\n", $thread_id, $new_thread_id);
+ if ($thread_id == $new_thread_id)
+ printf("[020] Expecting new connection and new thread id. Old thread id %d, new thread id %d\n", $thread_id, $new_thread_id);
- if (!($res = mysqli_query($link, "SELECT 'ok' AS it_works")) ||
- !($row = mysqli_fetch_assoc($res)))
- printf("[021] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!($res = mysqli_query($link, "SELECT 'ok' AS it_works")) ||
+ !($row = mysqli_fetch_assoc($res)))
+ printf("[021] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump($row);
- mysqli_free_result($res);
+ var_dump($row);
+ mysqli_free_result($res);
- mysqli_close($link);
+ mysqli_close($link);
- if (!$link = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[022] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[022] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (!$thread_id = $link->thread_id)
- printf("[023] Cannot determine thread id, test will fail, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$thread_id = $link->thread_id)
+ printf("[023] Cannot determine thread id, test will fail, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (true !== ($tmp = $link->real_connect($phost, $user, $passwd, $db, $port, $socket)))
- printf("[024] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = $link->real_connect($phost, $user, $passwd, $db, $port, $socket)))
+ printf("[024] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
- if (!is_int($new_thread_id = $link->thread_id) || ($new_thread_id < 0))
- printf("[025] Expecting int/any got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_int($new_thread_id = $link->thread_id) || ($new_thread_id < 0))
+ printf("[025] Expecting int/any got %s/%s\n", gettype($tmp), $tmp);
- if ($thread_id == $new_thread_id)
- printf("[026] Expecting new connection and new thread id. Old thread id %d, new thread id %d\n", $thread_id, $new_thread_id);
+ if ($thread_id == $new_thread_id)
+ printf("[026] Expecting new connection and new thread id. Old thread id %d, new thread id %d\n", $thread_id, $new_thread_id);
- if (!($res = $link->query("SELECT 'works also with oo' AS syntax")) ||
- !($row = $res->fetch_assoc()))
- printf("[027] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!($res = $link->query("SELECT 'works also with oo' AS syntax")) ||
+ !($row = $res->fetch_assoc()))
+ printf("[027] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump($row);
- mysqli_free_result($res);
+ var_dump($row);
+ mysqli_free_result($res);
- mysqli_close($link);
+ mysqli_close($link);
- if (NULL !== ($tmp = $link->connect($host, $user, $passwd, $db, $port, $socket)))
- printf("[028] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = $link->connect($host, $user, $passwd, $db, $port, $socket)))
+ printf("[028] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
- if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[029] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[029] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (NULL !== ($tmp = $link->connect($phost, $user, $passwd, $db, $port, $socket)))
- printf("[030] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = $link->connect($phost, $user, $passwd, $db, $port, $socket)))
+ printf("[030] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--EXPECT--
array(1) {
diff --git a/ext/mysqli/tests/mysqli_pconn_disabled.phpt b/ext/mysqli/tests/mysqli_pconn_disabled.phpt
index e8c592f9ff..a59a43cbd5 100644
--- a/ext/mysqli/tests/mysqli_pconn_disabled.phpt
+++ b/ext/mysqli/tests/mysqli_pconn_disabled.phpt
@@ -14,44 +14,44 @@ mysqli.max_persistent=2
mysqli.max_links=2
--FILE--
<?php
- require_once("connect.inc");
-
- $host = 'p:' . $host;
- if (!$link1 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- // automatic downgrade to normal connections has failed
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n",
- $host, $user, $db, $port, $socket, mysqli_connect_errno(), mysqli_connect_error());
- }
- if (!mysqli_query($link1, "SET @pcondisabled = 'Connection 1'"))
- printf("[002] Cannot set user variable to check if we got the same persistent connection, [%d] %s\n",
- mysqli_errno($link1), mysqli_error($link1));
-
- if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- // automatic downgrade to normal connections has failed
- printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n",
- $host, $user, $db, $port, $socket, mysqli_connect_errno(), mysqli_connect_error());
- }
-
- if (!$res = mysqli_query($link1, 'SELECT @pcondisabled AS _test'))
- printf("[004] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2));
-
- $row = mysqli_fetch_assoc($res);
- printf("Connecction 1 - SELECT @pcondisabled -> '%s'\n", $row['_test']);
- mysqli_free_result($res);
-
- if (!$res = mysqli_query($link2, 'SELECT @pcondisabled AS _test'))
- printf("[005] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2));
-
- $row = mysqli_fetch_assoc($res);
- printf("Connecction 2 - SELECT @pcondisabled -> '%s'\n", $row['_test']);
- mysqli_free_result($res);
-
- if ($link1 === $link2)
- printf("[006] Links should not be identical\n");
-
- mysqli_close($link1);
- mysqli_close($link2);
- print "done!";
+ require_once("connect.inc");
+
+ $host = 'p:' . $host;
+ if (!$link1 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ // automatic downgrade to normal connections has failed
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n",
+ $host, $user, $db, $port, $socket, mysqli_connect_errno(), mysqli_connect_error());
+ }
+ if (!mysqli_query($link1, "SET @pcondisabled = 'Connection 1'"))
+ printf("[002] Cannot set user variable to check if we got the same persistent connection, [%d] %s\n",
+ mysqli_errno($link1), mysqli_error($link1));
+
+ if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ // automatic downgrade to normal connections has failed
+ printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n",
+ $host, $user, $db, $port, $socket, mysqli_connect_errno(), mysqli_connect_error());
+ }
+
+ if (!$res = mysqli_query($link1, 'SELECT @pcondisabled AS _test'))
+ printf("[004] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2));
+
+ $row = mysqli_fetch_assoc($res);
+ printf("Connecction 1 - SELECT @pcondisabled -> '%s'\n", $row['_test']);
+ mysqli_free_result($res);
+
+ if (!$res = mysqli_query($link2, 'SELECT @pcondisabled AS _test'))
+ printf("[005] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2));
+
+ $row = mysqli_fetch_assoc($res);
+ printf("Connecction 2 - SELECT @pcondisabled -> '%s'\n", $row['_test']);
+ mysqli_free_result($res);
+
+ if ($link1 === $link2)
+ printf("[006] Links should not be identical\n");
+
+ mysqli_close($link1);
+ mysqli_close($link2);
+ print "done!";
?>
--EXPECTF--
Warning: my_mysqli_connect(): Persistent connections are disabled. Downgrading to normal in %s on line %d
diff --git a/ext/mysqli/tests/mysqli_pconn_kill.phpt b/ext/mysqli/tests/mysqli_pconn_kill.phpt
index f4be4c7c7b..abf2c838f8 100644
--- a/ext/mysqli/tests/mysqli_pconn_kill.phpt
+++ b/ext/mysqli/tests/mysqli_pconn_kill.phpt
@@ -12,84 +12,89 @@ mysqli.allow_persistent=1
mysqli.max_persistent=2
--FILE--
<?php
- require_once("connect.inc");
- require_once("table.inc");
-
- $host = 'p:' . $host;
- if (!$plink = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
-
- // get the thread ids of the two connections...
- $thread_id = mysqli_thread_id($link);
- $pthread_id = mysqli_thread_id($plink);
-
- if (!$res = mysqli_query($link, 'SHOW FULL PROCESSLIST'))
- printf("[002] Cannot get processlist, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- $running_threads = array();
- while ($row = mysqli_fetch_assoc($res))
- $running_threads[$row['Id']] = $row;
- mysqli_free_result($res);
-
- if (count($running_threads) < 2)
- printf("[003] Processlist is too short, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!isset($running_threads[$thread_id]))
- printf("[004] Cannot find thread id of the regular link, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!isset($running_threads[$pthread_id]))
- printf("[005] Cannot find thread id of the persistent link, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- // Kill the persistent connection - don't use mysqli_kill, mysqlnd will catch that...
- if (!mysqli_query($link, sprintf('KILL %d', $pthread_id)))
- printf("[006] Cannot kill persistent connection, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_close($plink);
- // Give the server think-time to kill the pthread
- sleep(1);
-
- if (!$res = mysqli_query($link, 'SHOW FULL PROCESSLIST'))
- printf("[007] Cannot get processlist, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- $running_threads2 = array();
- while ($row = mysqli_fetch_assoc($res))
- $running_threads2[$row['Id']] = $row;
- mysqli_free_result($res);
-
- if (isset($running_threads2[$pthread_id]))
- printf("[008] Thread of the persistent connection should have been gone, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!isset($running_threads2[$thread_id]))
- printf("[009] Thread of the regular connection should be still there, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- // On PHP side this should do nothing. PHP should not try to close the connection or something.
- @mysqli_close($plink);
-
- if (!$plink = @my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[011] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- if (!$res3 = @mysqli_query($plink, 'SELECT id FROM test ORDER BY id LIMIT 1')) {
- printf("[012] New persistent connection cannot execute queries, [%d] %s\n", @mysqli_errno($plink), @mysqli_error($plink));
- }
-
- @mysqli_free_result($res3);
- @mysqli_close($plink);
- mysqli_close($link);
-
- // remove the "p:<host>" from the host variable
- $host = substr($host, 2);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[013] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- if (!$res4 = mysqli_query($link, 'SELECT id FROM test ORDER BY id LIMIT 1'))
- printf("[014] New regular connection cannot execute queries, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- mysqli_free_result($res4);
- mysqli_close($link);
- print "done!";
+ require_once("connect.inc");
+ require_once("table.inc");
+
+ $host = 'p:' . $host;
+ if (!$plink = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+
+ // get the thread ids of the two connections...
+ $thread_id = mysqli_thread_id($link);
+ $pthread_id = mysqli_thread_id($plink);
+
+ if (!$res = mysqli_query($link, 'SHOW FULL PROCESSLIST'))
+ printf("[002] Cannot get processlist, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ $running_threads = array();
+ while ($row = mysqli_fetch_assoc($res))
+ $running_threads[$row['Id']] = $row;
+ mysqli_free_result($res);
+
+ if (count($running_threads) < 2)
+ printf("[003] Processlist is too short, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!isset($running_threads[$thread_id]))
+ printf("[004] Cannot find thread id of the regular link, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!isset($running_threads[$pthread_id]))
+ printf("[005] Cannot find thread id of the persistent link, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ // Kill the persistent connection - don't use mysqli_kill, mysqlnd will catch that...
+ if (!mysqli_query($link, sprintf('KILL %d', $pthread_id)))
+ printf("[006] Cannot kill persistent connection, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_close($plink);
+ // Give the server think-time to kill the pthread
+ sleep(1);
+
+ if (!$res = mysqli_query($link, 'SHOW FULL PROCESSLIST'))
+ printf("[007] Cannot get processlist, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ $running_threads2 = array();
+ while ($row = mysqli_fetch_assoc($res))
+ $running_threads2[$row['Id']] = $row;
+ mysqli_free_result($res);
+
+ if (isset($running_threads2[$pthread_id]))
+ printf("[008] Thread of the persistent connection should have been gone, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!isset($running_threads2[$thread_id]))
+ printf("[009] Thread of the regular connection should be still there, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ // On PHP side this should do nothing. PHP should not try to close the connection or something.
+ try {
+ mysqli_close($plink);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ if (!$plink = @my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[011] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ if (!$res3 = @mysqli_query($plink, 'SELECT id FROM test ORDER BY id LIMIT 1')) {
+ printf("[012] New persistent connection cannot execute queries, [%d] %s\n", @mysqli_errno($plink), @mysqli_error($plink));
+ }
+
+ @mysqli_free_result($res3);
+ @mysqli_close($plink);
+ mysqli_close($link);
+
+ // remove the "p:<host>" from the host variable
+ $host = substr($host, 2);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[013] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ if (!$res4 = mysqli_query($link, 'SELECT id FROM test ORDER BY id LIMIT 1'))
+ printf("[014] New regular connection cannot execute queries, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ mysqli_free_result($res4);
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
--EXPECT--
+mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_pconn_limits.phpt b/ext/mysqli/tests/mysqli_pconn_limits.phpt
index 311d8ed21e..b00b99883a 100644
--- a/ext/mysqli/tests/mysqli_pconn_limits.phpt
+++ b/ext/mysqli/tests/mysqli_pconn_limits.phpt
@@ -13,77 +13,77 @@ mysqli.max_persistent=-1
mysqli.max_links=-1
--FILE--
<?php
- require_once("connect.inc");
- // opens a regular connection
- require_once("table.inc");
+ require_once("connect.inc");
+ // opens a regular connection
+ require_once("table.inc");
- if (!$res = mysqli_query($link, "SELECT 'works..' as _desc"))
- printf("[001] Cannot run query, [%d] %s\n",
- mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, "SELECT 'works..' as _desc"))
+ printf("[001] Cannot run query, [%d] %s\n",
+ mysqli_errno($link), mysqli_error($link));
- $row = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- printf("Regular connection 1 - '%s'\n", $row['_desc']);
+ $row = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ printf("Regular connection 1 - '%s'\n", $row['_desc']);
- if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[002] Cannot open second regular connection, [%d] %s\n",
- mysqli_connect_errno(), mysqli_connect_error());
+ if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[002] Cannot open second regular connection, [%d] %s\n",
+ mysqli_connect_errno(), mysqli_connect_error());
- if (!$res = mysqli_query($link2, "SELECT 'works...' as _desc"))
- printf("[003] Cannot run query, [%d] %s\n",
- mysqli_errno($link2), mysqli_error($link2));
+ if (!$res = mysqli_query($link2, "SELECT 'works...' as _desc"))
+ printf("[003] Cannot run query, [%d] %s\n",
+ mysqli_errno($link2), mysqli_error($link2));
- $row = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- printf("Regular connection 2 - '%s'\n", $row['_desc']);
+ $row = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ printf("Regular connection 2 - '%s'\n", $row['_desc']);
- $host = 'p:' . $host;
- if (!$plink = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[004] Cannot create persistent connection using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n",
- $host, $user, $db, $port, $socket,
- mysqli_connect_errno(), mysqli_connect_error());
+ $host = 'p:' . $host;
+ if (!$plink = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[004] Cannot create persistent connection using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n",
+ $host, $user, $db, $port, $socket,
+ mysqli_connect_errno(), mysqli_connect_error());
- if (!$res = mysqli_query($plink, "SELECT 'works...' as _desc"))
- printf("[005] Cannot run query, [%d] %s\n",
- mysqli_errno($plink), mysqli_error($plink));
+ if (!$res = mysqli_query($plink, "SELECT 'works...' as _desc"))
+ printf("[005] Cannot run query, [%d] %s\n",
+ mysqli_errno($plink), mysqli_error($plink));
- $row = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- printf("Persistent connection 1 - '%s'\n", $row['_desc']);
+ $row = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ printf("Persistent connection 1 - '%s'\n", $row['_desc']);
- if (!$plink2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[006] Cannot create persistent connection using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n",
- $host, $user, $db, $port, $socket,
- mysqli_connect_errno(), mysqli_connect_error());
+ if (!$plink2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[006] Cannot create persistent connection using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n",
+ $host, $user, $db, $port, $socket,
+ mysqli_connect_errno(), mysqli_connect_error());
- if (!$res = mysqli_query($plink2, "SELECT 'works...' as _desc"))
- printf("[007] Cannot run query, [%d] %s\n",
- mysqli_errno($plink2), mysqli_error($plink2));
+ if (!$res = mysqli_query($plink2, "SELECT 'works...' as _desc"))
+ printf("[007] Cannot run query, [%d] %s\n",
+ mysqli_errno($plink2), mysqli_error($plink2));
- $row = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- printf("Persistent connection 2 - '%s'\n", $row['_desc']);
+ $row = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ printf("Persistent connection 2 - '%s'\n", $row['_desc']);
- $plink3 = mysqli_init();
- if (!my_mysqli_real_connect($plink3, $host, $user, $passwd, $db, $port, $socket))
- printf("[008] Cannot create persistent connection using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n",
- $host, $user, $db, $port, $socket,
- mysqli_connect_errno(), mysqli_connect_error());
+ $plink3 = mysqli_init();
+ if (!my_mysqli_real_connect($plink3, $host, $user, $passwd, $db, $port, $socket))
+ printf("[008] Cannot create persistent connection using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n",
+ $host, $user, $db, $port, $socket,
+ mysqli_connect_errno(), mysqli_connect_error());
- if (!$res = mysqli_query($plink3, "SELECT 'works...' as _desc"))
- printf("[009] Cannot run query, [%d] %s\n",
- mysqli_errno($plink2), mysqli_error($plink2));
+ if (!$res = mysqli_query($plink3, "SELECT 'works...' as _desc"))
+ printf("[009] Cannot run query, [%d] %s\n",
+ mysqli_errno($plink2), mysqli_error($plink2));
- $row = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- printf("Persistent connection 3 - '%s'\n", $row['_desc']);
+ $row = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ printf("Persistent connection 3 - '%s'\n", $row['_desc']);
- mysqli_close($link);
- mysqli_close($link2);
- mysqli_close($plink);
- mysqli_close($plink2);
- mysqli_close($plink3);
- print "done!";
+ mysqli_close($link);
+ mysqli_close($link2);
+ mysqli_close($plink);
+ mysqli_close($plink2);
+ mysqli_close($plink3);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_pconn_max_links.phpt b/ext/mysqli/tests/mysqli_pconn_max_links.phpt
index 7a96d90665..b8be6f121c 100644
--- a/ext/mysqli/tests/mysqli_pconn_max_links.phpt
+++ b/ext/mysqli/tests/mysqli_pconn_max_links.phpt
@@ -45,147 +45,151 @@ mysqli.max_persistent=2
mysqli.rollback_on_cached_plink=1
--FILE--
<?php
- require_once("connect.inc");
- require_once('table.inc');
-
-
- if (!mysqli_query($link, 'DROP USER pcontest') ||
- !mysqli_query($link, 'DROP USER pcontest@localhost') ||
- !mysqli_query($link, 'CREATE USER pcontest@"%" IDENTIFIED BY "pcontest"') ||
- !mysqli_query($link, 'CREATE USER pcontest@localhost IDENTIFIED BY "pcontest"') ||
- !mysqli_query($link, sprintf("GRANT SELECT ON TABLE %s.test TO pcontest@'%%'", $db)) ||
- !mysqli_query($link, sprintf("GRANT SELECT ON TABLE %s.test TO pcontest@'localhost'", $db))) {
- printf("[000] Init failed, [%d] %s\n",
- mysqli_errno($plink), mysqli_error($plink));
- }
+ require_once("connect.inc");
+ require_once('table.inc');
+
+
+ if (!mysqli_query($link, 'DROP USER pcontest') ||
+ !mysqli_query($link, 'DROP USER pcontest@localhost') ||
+ !mysqli_query($link, 'CREATE USER pcontest@"%" IDENTIFIED BY "pcontest"') ||
+ !mysqli_query($link, 'CREATE USER pcontest@localhost IDENTIFIED BY "pcontest"') ||
+ !mysqli_query($link, sprintf("GRANT SELECT ON TABLE %s.test TO pcontest@'%%'", $db)) ||
+ !mysqli_query($link, sprintf("GRANT SELECT ON TABLE %s.test TO pcontest@'localhost'", $db))) {
+ printf("[000] Init failed, [%d] %s\n",
+ mysqli_errno($plink), mysqli_error($plink));
+ }
- var_dump(mysqli_get_links_stats(1));
+ try {
+ mysqli_get_links_stats(1);
+ } catch (ArgumentCountError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- echo "Before pconnect:";
- var_dump(mysqli_get_links_stats());
+ echo "Before pconnect:";
+ var_dump(mysqli_get_links_stats());
- if (!$plink = my_mysqli_connect('p:' . $host, 'pcontest', 'pcontest', $db, $port, $socket))
- printf("[001] Cannot connect using the second DB user created during SKIPIF, [%d] %s\n",
- mysqli_connect_errno(), mysqli_connect_error());
+ if (!$plink = my_mysqli_connect('p:' . $host, 'pcontest', 'pcontest', $db, $port, $socket))
+ printf("[001] Cannot connect using the second DB user created during SKIPIF, [%d] %s\n",
+ mysqli_connect_errno(), mysqli_connect_error());
- echo "After pconnect:";
- var_dump(mysqli_get_links_stats());
+ echo "After pconnect:";
+ var_dump(mysqli_get_links_stats());
- ob_start();
- phpinfo();
- $phpinfo = strip_tags(ob_get_contents());
- ob_end_clean();
+ ob_start();
+ phpinfo();
+ $phpinfo = strip_tags(ob_get_contents());
+ ob_end_clean();
- $phpinfo = substr($phpinfo, strpos($phpinfo, 'MysqlI Support => enabled'), 500);
- if (!preg_match('@Active Persistent Links\s+=>\s+(\d+)@ismU', $phpinfo, $matches))
- printf("[002] Cannot get # active persistent links from phpinfo()\n");
- $num_plinks = $matches[1];
+ $phpinfo = substr($phpinfo, strpos($phpinfo, 'MysqlI Support => enabled'), 500);
+ if (!preg_match('@Active Persistent Links\s+=>\s+(\d+)@ismU', $phpinfo, $matches))
+ printf("[002] Cannot get # active persistent links from phpinfo()\n");
+ $num_plinks = $matches[1];
- if (!$res = mysqli_query($plink, 'SELECT id, label FROM test WHERE id = 1'))
- printf("[003] Cannot run query on persistent connection of second DB user, [%d] %s\n",
- mysqli_errno($plink), mysqli_error($plink));
+ if (!$res = mysqli_query($plink, 'SELECT id, label FROM test WHERE id = 1'))
+ printf("[003] Cannot run query on persistent connection of second DB user, [%d] %s\n",
+ mysqli_errno($plink), mysqli_error($plink));
- if (!$row = mysqli_fetch_assoc($res))
- printf("[004] Cannot run fetch result, [%d] %s\n",
- mysqli_errno($plink), mysqli_error($plink));
- mysqli_free_result($res);
- var_dump($row);
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[004] Cannot run fetch result, [%d] %s\n",
+ mysqli_errno($plink), mysqli_error($plink));
+ mysqli_free_result($res);
+ var_dump($row);
- // change the password for the second DB user and kill the persistent connection
- if ((!mysqli_query($link, 'SET PASSWORD FOR pcontest = "newpass"') &&
- !mysqli_query($link, 'SET PASSWORD FOR pcontest = PASSWORD("newpass")'))||
- !mysqli_query($link, 'FLUSH PRIVILEGES'))
- printf("[005] Cannot change PW of second DB user, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ // change the password for the second DB user and kill the persistent connection
+ if ((!mysqli_query($link, 'SET PASSWORD FOR pcontest = "newpass"') &&
+ !mysqli_query($link, 'SET PASSWORD FOR pcontest = PASSWORD("newpass")'))||
+ !mysqli_query($link, 'FLUSH PRIVILEGES'))
+ printf("[005] Cannot change PW of second DB user, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
// change the password for the second DB user and kill the persistent connection
- if ((!mysqli_query($link, 'SET PASSWORD FOR pcontest@localhost = "newpass"') &&
- !mysqli_query($link, 'SET PASSWORD FOR pcontest@localhost = PASSWORD("newpass")')) ||
- !mysqli_query($link, 'FLUSH PRIVILEGES'))
- printf("[006] Cannot change PW of second DB user, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- // persistent connections cannot be closed but only be killed
- $pthread_id = mysqli_thread_id($plink);
- if (!mysqli_query($link, sprintf('KILL %d', $pthread_id)))
- printf("[007] Cannot KILL persistent connection of second DB user, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- // give the server a second to really kill the thread
- sleep(1);
-
- if (!$res = mysqli_query($link, "SHOW FULL PROCESSLIST"))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- $running_threads = array();
- while ($row = mysqli_fetch_assoc($res))
- $running_threads[$row['Id']] = $row;
- mysqli_free_result($res);
-
- if (isset($running_threads[$pthread_id]))
- printf("[009] Persistent connection has not been killed\n");
-
- echo "Before second pconnect:";
- var_dump(mysqli_get_links_stats());
-
- // this fails and we have 0 (<= $num_plinks) connections
- if ($plink = @my_mysqli_connect('p:' . $host, 'pcontest', 'pcontest', $db, $port, $socket))
- printf("[010] Can connect using the old password, [%d] %s\n",
- mysqli_connect_errno($link), mysqli_connect_error($link));
-
- echo "After second pconnect:";
- var_dump(mysqli_get_links_stats());
-
- ob_start();
- phpinfo();
- $phpinfo = strip_tags(ob_get_contents());
- ob_end_clean();
- $phpinfo = substr($phpinfo, stripos($phpinfo, 'MysqlI Support => enabled'), 500);
- if (!preg_match('@Active Persistent Links\s+=>\s+(\d+)@ismU', $phpinfo, $matches))
- printf("[010] Cannot get # of active persistent links from phpinfo()\n");
-
- var_dump(mysqli_get_links_stats());
-
- $num_plinks_kill = $matches[1];
- $sstats = mysqli_get_links_stats();
- if ($sstats['active_plinks'] != $num_plinks_kill) {
- printf("[010.2] Num of active plinks differ %s %s\n", $sstats['active_plinks'], $num_plinks_kill);
- }
- if ($num_plinks_kill > $num_plinks)
- printf("[011] Expecting Active Persistent Links < %d, got %d\n", $num_plinks, $num_plinks_kill);
-
- if (!$plink = my_mysqli_connect('p:' . $host, 'pcontest', 'newpass', $db, $port, $socket))
- printf("[012] Cannot connect using the new password, [%d] %s\n",
- mysqli_connect_errno(), mysqli_connect_error());
-
- if (!$res = mysqli_query($plink, 'SELECT id, label FROM test WHERE id = 1'))
- printf("[013] Cannot run query on persistent connection of second DB user, [%d] %s\n",
- mysqli_errno($plink), mysqli_error($plink));
-
- if (!$row = mysqli_fetch_assoc($res))
- printf("[014] Cannot run fetch result, [%d] %s\n",
- mysqli_errno($plink), mysqli_error($plink));
- mysqli_free_result($res);
- var_dump($row);
-
- if ($plink2 = my_mysqli_connect('p:' . $host, 'pcontest', 'newpass', $db, $port, $socket)) {
- printf("[015] Can open more persistent connections than allowed, [%d] %s\n",
- mysqli_connect_errno(), mysqli_connect_error());
- var_dump(mysqli_get_links_stats());
- }
-
- ob_start();
- phpinfo();
- $phpinfo = strip_tags(ob_get_contents());
- ob_end_clean();
- $phpinfo = substr($phpinfo, stripos($phpinfo, 'MysqlI Support => enabled'), 500);
- if (!preg_match('@Active Persistent Links\s+=>\s+(\d+)@ismU', $phpinfo, $matches))
- printf("[016] Cannot get # of active persistent links from phpinfo()\n");
-
- $num_plinks = $matches[1];
- if ($num_plinks > (int)ini_get('mysqli.max_persistent'))
- printf("[017] mysqli.max_persistent=%d allows %d open connections!\n", ini_get('mysqli.max_persistent'),$num_plinks);
+ if ((!mysqli_query($link, 'SET PASSWORD FOR pcontest@localhost = "newpass"') &&
+ !mysqli_query($link, 'SET PASSWORD FOR pcontest@localhost = PASSWORD("newpass")')) ||
+ !mysqli_query($link, 'FLUSH PRIVILEGES'))
+ printf("[006] Cannot change PW of second DB user, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ // persistent connections cannot be closed but only be killed
+ $pthread_id = mysqli_thread_id($plink);
+ if (!mysqli_query($link, sprintf('KILL %d', $pthread_id)))
+ printf("[007] Cannot KILL persistent connection of second DB user, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ // give the server a second to really kill the thread
+ sleep(1);
+
+ if (!$res = mysqli_query($link, "SHOW FULL PROCESSLIST"))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ $running_threads = array();
+ while ($row = mysqli_fetch_assoc($res))
+ $running_threads[$row['Id']] = $row;
+ mysqli_free_result($res);
+
+ if (isset($running_threads[$pthread_id]))
+ printf("[009] Persistent connection has not been killed\n");
+
+ echo "Before second pconnect:";
+ var_dump(mysqli_get_links_stats());
+
+ // this fails and we have 0 (<= $num_plinks) connections
+ if ($plink = @my_mysqli_connect('p:' . $host, 'pcontest', 'pcontest', $db, $port, $socket))
+ printf("[010] Can connect using the old password, [%d] %s\n",
+ mysqli_connect_errno($link), mysqli_connect_error($link));
+
+ echo "After second pconnect:";
+ var_dump(mysqli_get_links_stats());
+
+ ob_start();
+ phpinfo();
+ $phpinfo = strip_tags(ob_get_contents());
+ ob_end_clean();
+ $phpinfo = substr($phpinfo, stripos($phpinfo, 'MysqlI Support => enabled'), 500);
+ if (!preg_match('@Active Persistent Links\s+=>\s+(\d+)@ismU', $phpinfo, $matches))
+ printf("[010] Cannot get # of active persistent links from phpinfo()\n");
+
+ var_dump(mysqli_get_links_stats());
+
+ $num_plinks_kill = $matches[1];
+ $sstats = mysqli_get_links_stats();
+ if ($sstats['active_plinks'] != $num_plinks_kill) {
+ printf("[010.2] Num of active plinks differ %s %s\n", $sstats['active_plinks'], $num_plinks_kill);
+ }
+ if ($num_plinks_kill > $num_plinks)
+ printf("[011] Expecting Active Persistent Links < %d, got %d\n", $num_plinks, $num_plinks_kill);
+
+ if (!$plink = my_mysqli_connect('p:' . $host, 'pcontest', 'newpass', $db, $port, $socket))
+ printf("[012] Cannot connect using the new password, [%d] %s\n",
+ mysqli_connect_errno(), mysqli_connect_error());
+
+ if (!$res = mysqli_query($plink, 'SELECT id, label FROM test WHERE id = 1'))
+ printf("[013] Cannot run query on persistent connection of second DB user, [%d] %s\n",
+ mysqli_errno($plink), mysqli_error($plink));
+
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[014] Cannot run fetch result, [%d] %s\n",
+ mysqli_errno($plink), mysqli_error($plink));
+ mysqli_free_result($res);
+ var_dump($row);
+
+ if ($plink2 = my_mysqli_connect('p:' . $host, 'pcontest', 'newpass', $db, $port, $socket)) {
+ printf("[015] Can open more persistent connections than allowed, [%d] %s\n",
+ mysqli_connect_errno(), mysqli_connect_error());
+ var_dump(mysqli_get_links_stats());
+ }
- mysqli_query($link, 'REVOKE ALL PRIVILEGES, GRANT OPTION FROM pcontest');
- mysqli_query($link, 'DROP USER pcontest');
- mysqli_close($link);
- print "done!";
+ ob_start();
+ phpinfo();
+ $phpinfo = strip_tags(ob_get_contents());
+ ob_end_clean();
+ $phpinfo = substr($phpinfo, stripos($phpinfo, 'MysqlI Support => enabled'), 500);
+ if (!preg_match('@Active Persistent Links\s+=>\s+(\d+)@ismU', $phpinfo, $matches))
+ printf("[016] Cannot get # of active persistent links from phpinfo()\n");
+
+ $num_plinks = $matches[1];
+ if ($num_plinks > (int)ini_get('mysqli.max_persistent'))
+ printf("[017] mysqli.max_persistent=%d allows %d open connections!\n", ini_get('mysqli.max_persistent'),$num_plinks);
+
+ mysqli_query($link, 'REVOKE ALL PRIVILEGES, GRANT OPTION FROM pcontest');
+ mysqli_query($link, 'DROP USER pcontest');
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
@@ -203,9 +207,8 @@ mysqli_query($link, 'DROP USER pcontest');
mysqli_close($link);
?>
---EXPECTF--
-Warning: mysqli_get_links_stats(): no parameters expected in %s on line %d
-NULL
+--EXPECT--
+mysqli_get_links_stats() expects exactly 0 parameters, 1 given
Before pconnect:array(3) {
["total"]=>
int(1)
diff --git a/ext/mysqli/tests/mysqli_pconn_reuse.phpt b/ext/mysqli/tests/mysqli_pconn_reuse.phpt
index 926f6b797c..89600c48d9 100644
--- a/ext/mysqli/tests/mysqli_pconn_reuse.phpt
+++ b/ext/mysqli/tests/mysqli_pconn_reuse.phpt
@@ -14,72 +14,72 @@ mysqli.max_persistent=2
mysqli.max_links=2
--FILE--
<?php
- require_once("connect.inc");
-
- $host = 'p:' . $host;
- if (!$link1 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n",
- $host, $user, $db, $port, $socket, mysqli_connect_errno(), mysqli_connect_error());
- }
- if (!mysqli_query($link1, 'SET @pcondisabled = "Connection 1"'))
- printf("[002] Cannot set user variable to check if we got the same persistent connection, [%d] %s\n",
- mysqli_errno($link1), mysqli_error($link1));
-
- if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n",
- $host, $user, $db, $port, $socket, mysqli_connect_errno(), mysqli_connect_error());
- }
-
- if (!$res = mysqli_query($link1, 'SELECT @pcondisabled AS _test'))
- printf("[004] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2));
-
- $row = mysqli_fetch_assoc($res);
- printf("Connection 1 - SELECT @pcondisabled -> '%s'\n", $row['_test']);
- mysqli_free_result($res);
-
- if (!$res = mysqli_query($link2, 'SELECT @pcondisabled AS _test'))
- printf("[005] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2));
-
- $row = mysqli_fetch_assoc($res);
- printf("Connection 2 (no reuse) - SELECT @pcondisabled -> '%s'\n", $row['_test']);
- $thread_id = mysqli_thread_id($link2);
- printf("Connection 2 (no reuse) - Thread ID -> '%s'\n", $thread_id);
- mysqli_free_result($res);
-
- if (!mysqli_query($link2, 'SET @pcondisabled = "Connection 2"'))
- printf("[006] Cannot set user variable to check if we got the same persistent connection, [%d] %s\n",
- mysqli_errno($link2), mysqli_error($link2));
-
- if (!$res = mysqli_query($link2, 'SELECT @pcondisabled AS _test'))
- printf("[007] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2));
-
- $row = mysqli_fetch_assoc($res);
- printf("Connection 2 - SELECT @pcondisabled -> '%s'\n", $row['_test']);
- mysqli_free_result($res);
-
- mysqli_close($link2);
-
- /* reuse of existing persistent connection expected! */
- if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[008] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n",
- $host, $user, $db, $port, $socket, mysqli_connect_errno(), mysqli_connect_error());
- }
-
- if (!$res = mysqli_query($link2, 'SELECT @pcondisabled AS _test'))
- printf("[009] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2));
-
- $row = mysqli_fetch_assoc($res);
- printf("Connection 2 (reuse) - SELECT @pcondisabled -> '%s'\n", $row['_test']);
- $thread_id_reuse = mysqli_thread_id($link2);
- printf("Connection 2 (reuse) - Thread ID -> '%s'\n", $thread_id_reuse);
- mysqli_free_result($res);
-
- if ($thread_id != $thread_id_reuse)
- printf("[010] Seems as if we have got a new connection, connections should have been cached and reused!\n");
-
- mysqli_close($link1);
- mysqli_close($link2);
- print "done!";
+ require_once("connect.inc");
+
+ $host = 'p:' . $host;
+ if (!$link1 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n",
+ $host, $user, $db, $port, $socket, mysqli_connect_errno(), mysqli_connect_error());
+ }
+ if (!mysqli_query($link1, 'SET @pcondisabled = "Connection 1"'))
+ printf("[002] Cannot set user variable to check if we got the same persistent connection, [%d] %s\n",
+ mysqli_errno($link1), mysqli_error($link1));
+
+ if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n",
+ $host, $user, $db, $port, $socket, mysqli_connect_errno(), mysqli_connect_error());
+ }
+
+ if (!$res = mysqli_query($link1, 'SELECT @pcondisabled AS _test'))
+ printf("[004] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2));
+
+ $row = mysqli_fetch_assoc($res);
+ printf("Connection 1 - SELECT @pcondisabled -> '%s'\n", $row['_test']);
+ mysqli_free_result($res);
+
+ if (!$res = mysqli_query($link2, 'SELECT @pcondisabled AS _test'))
+ printf("[005] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2));
+
+ $row = mysqli_fetch_assoc($res);
+ printf("Connection 2 (no reuse) - SELECT @pcondisabled -> '%s'\n", $row['_test']);
+ $thread_id = mysqli_thread_id($link2);
+ printf("Connection 2 (no reuse) - Thread ID -> '%s'\n", $thread_id);
+ mysqli_free_result($res);
+
+ if (!mysqli_query($link2, 'SET @pcondisabled = "Connection 2"'))
+ printf("[006] Cannot set user variable to check if we got the same persistent connection, [%d] %s\n",
+ mysqli_errno($link2), mysqli_error($link2));
+
+ if (!$res = mysqli_query($link2, 'SELECT @pcondisabled AS _test'))
+ printf("[007] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2));
+
+ $row = mysqli_fetch_assoc($res);
+ printf("Connection 2 - SELECT @pcondisabled -> '%s'\n", $row['_test']);
+ mysqli_free_result($res);
+
+ mysqli_close($link2);
+
+ /* reuse of existing persistent connection expected! */
+ if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[008] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n",
+ $host, $user, $db, $port, $socket, mysqli_connect_errno(), mysqli_connect_error());
+ }
+
+ if (!$res = mysqli_query($link2, 'SELECT @pcondisabled AS _test'))
+ printf("[009] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2));
+
+ $row = mysqli_fetch_assoc($res);
+ printf("Connection 2 (reuse) - SELECT @pcondisabled -> '%s'\n", $row['_test']);
+ $thread_id_reuse = mysqli_thread_id($link2);
+ printf("Connection 2 (reuse) - Thread ID -> '%s'\n", $thread_id_reuse);
+ mysqli_free_result($res);
+
+ if ($thread_id != $thread_id_reuse)
+ printf("[010] Seems as if we have got a new connection, connections should have been cached and reused!\n");
+
+ mysqli_close($link1);
+ mysqli_close($link2);
+ print "done!";
?>
--EXPECTF--
Connection 1 - SELECT @pcondisabled -> 'Connection 1'
diff --git a/ext/mysqli/tests/mysqli_pconn_twice.phpt b/ext/mysqli/tests/mysqli_pconn_twice.phpt
index ca2acd1369..e388847507 100644
--- a/ext/mysqli/tests/mysqli_pconn_twice.phpt
+++ b/ext/mysqli/tests/mysqli_pconn_twice.phpt
@@ -13,57 +13,57 @@ mysqli.max_persistent=-1
mysqli.max_links=-1
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $host = 'p:' . $host;
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ $host = 'p:' . $host;
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (true !== ($tmp = my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)))
- printf("[003] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)))
+ printf("[003] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
- /* it is undefined which pooled connection we get - thread ids may differ */
+ /* it is undefined which pooled connection we get - thread ids may differ */
- if (!($res = mysqli_query($link, "SELECT 'ok' AS it_works")) ||
- !($row = mysqli_fetch_assoc($res)))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!($res = mysqli_query($link, "SELECT 'ok' AS it_works")) ||
+ !($row = mysqli_fetch_assoc($res)))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump($row);
- mysqli_free_result($res);
+ var_dump($row);
+ mysqli_free_result($res);
- mysqli_close($link);
+ mysqli_close($link);
- if (!$link = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[007] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[007] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (true !== ($tmp = $link->real_connect($host, $user, $passwd, $db, $port, $socket)))
- printf("[009] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = $link->real_connect($host, $user, $passwd, $db, $port, $socket)))
+ printf("[009] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
- /* it is undefined which pooled connection we get - thread ids may differ */
+ /* it is undefined which pooled connection we get - thread ids may differ */
- if (!($res = $link->query("SELECT 'works also with oo' AS syntax")) ||
- !($row = $res->fetch_assoc()))
- printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!($res = $link->query("SELECT 'works also with oo' AS syntax")) ||
+ !($row = $res->fetch_assoc()))
+ printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump($row);
- mysqli_free_result($res);
+ var_dump($row);
+ mysqli_free_result($res);
- mysqli_close($link);
+ mysqli_close($link);
- if (NULL !== ($tmp = $link->connect($host, $user, $passwd, $db, $port, $socket)))
- printf("[013] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = $link->connect($host, $user, $passwd, $db, $port, $socket)))
+ printf("[013] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
- if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[014] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[014] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (NULL !== ($tmp = $link->connect($host, $user, $passwd, $db, $port, $socket)))
- printf("[015] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = $link->connect($host, $user, $passwd, $db, $port, $socket)))
+ printf("[015] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--EXPECT--
array(1) {
diff --git a/ext/mysqli/tests/mysqli_pconnect.phpt b/ext/mysqli/tests/mysqli_pconnect.phpt
index 3fb14d25d9..16fbb27e31 100644
--- a/ext/mysqli/tests/mysqli_pconnect.phpt
+++ b/ext/mysqli/tests/mysqli_pconnect.phpt
@@ -8,65 +8,65 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $host = 'p:' . $host;
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ $host = 'p:' . $host;
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- mysqli_close($link);
+ mysqli_close($link);
- $num = 20;
- $connections = array();
- for ($i = 0; $i < $num; $i++) {
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[003] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- $connections[] = $link;
- }
- while (count($connections)) {
- do {
- $index = mt_rand(0, $num);
- } while (!isset($connections[$index]));
- mysqli_close($connections[$index]);
- unset($connections[$index]);
- }
+ $num = 20;
+ $connections = array();
+ for ($i = 0; $i < $num; $i++) {
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[003] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ $connections[] = $link;
+ }
+ while (count($connections)) {
+ do {
+ $index = mt_rand(0, $num);
+ } while (!isset($connections[$index]));
+ mysqli_close($connections[$index]);
+ unset($connections[$index]);
+ }
- $connections = array();
- $num = 20;
- for ($i = 0; $i < $num; $i++) {
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[004] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- $connections[] = $link;
- }
- $left = $num;
+ $connections = array();
+ $num = 20;
+ for ($i = 0; $i < $num; $i++) {
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[004] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ $connections[] = $link;
+ }
+ $left = $num;
- while (count($connections) && $left > 0) {
- do {
- $index = mt_rand(0, $num);
- } while (!isset($connections[$index]) && $left > 0);
- if (mt_rand(0, 1) > 0) {
- $left--;
- mysqli_close($connections[$index]);
- unset($connections[$index]);
- } else {
- $left--;
- if (!$connections[$index] = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[004] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- }
- flush();
- }
+ while (count($connections) && $left > 0) {
+ do {
+ $index = mt_rand(0, $num);
+ } while (!isset($connections[$index]) && $left > 0);
+ if (mt_rand(0, 1) > 0) {
+ $left--;
+ mysqli_close($connections[$index]);
+ unset($connections[$index]);
+ } else {
+ $left--;
+ if (!$connections[$index] = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[004] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ }
+ flush();
+ }
- while (count($connections)) {
- do {
- $index = mt_rand(0, $num);
- } while (!isset($connections[$index]));
- mysqli_close($connections[$index]);
- unset($connections[$index]);
- }
+ while (count($connections)) {
+ do {
+ $index = mt_rand(0, $num);
+ } while (!isset($connections[$index]));
+ mysqli_close($connections[$index]);
+ unset($connections[$index]);
+ }
- print "done!";
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_phpinfo.phpt b/ext/mysqli/tests/mysqli_phpinfo.phpt
index 4f856f2b65..d1ecdea796 100644
--- a/ext/mysqli/tests/mysqli_phpinfo.phpt
+++ b/ext/mysqli/tests/mysqli_phpinfo.phpt
@@ -8,54 +8,54 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- include("connect.inc");
+ include("connect.inc");
- @ob_clean();
- ob_start();
- phpinfo();
- $phpinfo = ob_get_contents();
- ob_end_clean();
+ @ob_clean();
+ ob_start();
+ phpinfo();
+ $phpinfo = ob_get_contents();
+ ob_end_clean();
- /* all versions should at least dump this minimum information */
- if (!stristr($phpinfo, "mysqli support"))
- printf("[001] ext/mysqli should have exposed itself.\n");
+ /* all versions should at least dump this minimum information */
+ if (!stristr($phpinfo, "mysqli support"))
+ printf("[001] ext/mysqli should have exposed itself.\n");
- if (!stristr($phpinfo, "client api library version"))
- printf("[002] ext/mysqli should have exposed the library version.\n");
+ if (!stristr($phpinfo, "client api library version"))
+ printf("[002] ext/mysqli should have exposed the library version.\n");
- if (!stristr($phpinfo, "mysqli.default_host"))
- printf("[003] php.ini setting mysqli.default_host not shown.\n");
+ if (!stristr($phpinfo, "mysqli.default_host"))
+ printf("[003] php.ini setting mysqli.default_host not shown.\n");
- if (!stristr($phpinfo, "mysqli.default_port"))
- printf("[004] php.ini setting mysqli.default_port not shown.\n");
+ if (!stristr($phpinfo, "mysqli.default_port"))
+ printf("[004] php.ini setting mysqli.default_port not shown.\n");
- if (!stristr($phpinfo, "mysqli.default_pw"))
- printf("[005] php.ini setting mysqli.default_pw not shown.\n");
+ if (!stristr($phpinfo, "mysqli.default_pw"))
+ printf("[005] php.ini setting mysqli.default_pw not shown.\n");
- if (!stristr($phpinfo, "mysqli.default_socket"))
- printf("[006] php.ini setting mysqli.default_socket not shown.\n");
+ if (!stristr($phpinfo, "mysqli.default_socket"))
+ printf("[006] php.ini setting mysqli.default_socket not shown.\n");
- if (!stristr($phpinfo, "mysqli.default_user"))
- printf("[007] php.ini setting mysqli.default_user not shown.\n");
+ if (!stristr($phpinfo, "mysqli.default_user"))
+ printf("[007] php.ini setting mysqli.default_user not shown.\n");
- if (!stristr($phpinfo, "mysqli.max_links"))
- printf("[008] php.ini setting mysqli.max_links not shown.\n");
+ if (!stristr($phpinfo, "mysqli.max_links"))
+ printf("[008] php.ini setting mysqli.max_links not shown.\n");
- if (!stristr($phpinfo, "mysqli.reconnect"))
- printf("[009] php.ini setting mysqli.reconnect not shown.\n");
+ if (!stristr($phpinfo, "mysqli.reconnect"))
+ printf("[009] php.ini setting mysqli.reconnect not shown.\n");
- if ($IS_MYSQLND) {
- $expected = array(
- 'size',
- 'mysqli.allow_local_infile',
- 'mysqli.allow_persistent', 'mysqli.max_persistent'
- );
- foreach ($expected as $k => $entry)
- if (!stristr($phpinfo, $entry))
- printf("[010] Could not find entry for '%s'\n", $entry);
- }
+ if ($IS_MYSQLND) {
+ $expected = array(
+ 'size',
+ 'mysqli.allow_local_infile',
+ 'mysqli.allow_persistent', 'mysqli.max_persistent'
+ );
+ foreach ($expected as $k => $entry)
+ if (!stristr($phpinfo, $entry))
+ printf("[010] Could not find entry for '%s'\n", $entry);
+ }
- print "done!";
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_ping.phpt b/ext/mysqli/tests/mysqli_ping.phpt
index 6ddb29efef..40a3115f3d 100644
--- a/ext/mysqli/tests/mysqli_ping.phpt
+++ b/ext/mysqli/tests/mysqli_ping.phpt
@@ -8,40 +8,33 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ require('table.inc');
- if (!is_null($tmp = @mysqli_ping()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ var_dump(mysqli_ping($link));
- require('table.inc');
+ // provoke an error to check if mysqli_ping resets it
+ $res = mysqli_query($link, 'SELECT * FROM unknown_table');
+ if (!($errno = mysqli_errno($link)))
+ printf("[003] Statement should have caused an error\n");
- if (!is_null($tmp = @mysqli_ping($link, $link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ var_dump(mysqli_ping($link));
+ if ($errno === mysqli_errno($link))
+ printf("[004] Error codes should have been reset\n");
- var_dump(mysqli_ping($link));
+ mysqli_close($link);
- // provoke an error to check if mysqli_ping resets it
- $res = mysqli_query($link, 'SELECT * FROM unknown_table');
- if (!($errno = mysqli_errno($link)))
- printf("[003] Statement should have caused an error\n");
+ try {
+ mysqli_ping($link);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- var_dump(mysqli_ping($link));
- if ($errno === mysqli_errno($link))
- printf("[004] Error codes should have been reset\n");
-
- mysqli_close($link);
-
- if (false !== ($tmp = mysqli_ping($link)))
- printf("[005] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!";
+ print "done!";
?>
---EXPECTF--
+--EXPECT--
bool(true)
bool(true)
-
-Warning: mysqli_ping(): Couldn't fetch mysqli in %s on line %d
+mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_poll.phpt b/ext/mysqli/tests/mysqli_poll.phpt
index b9c66381f9..97b1a7e61a 100644
--- a/ext/mysqli/tests/mysqli_poll.phpt
+++ b/ext/mysqli/tests/mysqli_poll.phpt
@@ -12,126 +12,103 @@ if (!$IS_MYSQLND)
?>
--FILE--
<?php
- require_once('connect.inc');
-
- function get_connection() {
- global $host, $user, $passwd, $db, $port, $socket;
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- return $link;
- }
-
- if (!$link = get_connection())
- printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
-
- if (NULL !== ($tmp = @mysqli_poll()))
- printf("[002] Expecting NULL got %s\n", var_export($tmp, true));
-
- $l = array($link);
- if (NULL !== ($tmp = @mysqli_poll($l)))
- printf("[003] Expecting NULL got %s\n", var_export($tmp, true));
-
- $l = array($link); $n = NULL;
- if (NULL !== ($tmp = @mysqli_poll($l, $n)))
- printf("[004] Expecting NULL got %s\n", var_export($tmp, true));
-
- $l = array($link); $n = NULL;
- if (NULL !== ($tmp = @mysqli_poll($l, $n, $n)))
- printf("[005] Expecting NULL got %s\n", var_export($tmp, true));
-
- $l = array($link); $e = NULL; $r = NULL;
- if (NULL !== ($tmp = @mysqli_poll($l, $e, $r, -1)))
- printf("[007] Expecting boolean/false got %s/%s\n", gettype($tmp), var_export($tmp, true));
-
- $l = array($link); $e = NULL; $r = NULL;
- if (NULL !== ($tmp = @mysqli_poll($l, $e, $r, 0, -1)))
- printf("[008] Expecting boolean/false got %s/%s\n", gettype($tmp), var_export($tmp, true));
-
- $read = $error = $reject = array($link);
- if (0 !== ($tmp = (mysqli_poll($read, $error, $reject, 0, 1))))
- printf("[009] Expecting int/0 got %s/%s\n", gettype($tmp), var_export($tmp, true));
-
- $read = $error = $reject = array($link);
- if (false !== ($tmp = (mysqli_poll($read, $error, $reject, -1, 1))))
- printf("[010] Expecting false got %s/%s\n", gettype($tmp), var_export($tmp, true));
-
- $read = $error = $reject = array($link);
- if (false !== ($tmp = (mysqli_poll($read, $error, $reject, 0, -1))))
- printf("[011] Expecting false got %s/%s\n", gettype($tmp), var_export($tmp, true));
-
- function poll_async($offset, $link, $links, $errors, $reject, $exp_ready, $use_oo_syntax) {
-
- if ($exp_ready !== ($tmp = mysqli_poll($links, $errors, $reject, 0, 1000)))
- printf("[%03d + 1] There should be %d links ready to read from, %d ready\n",
- $exp_ready, $tmp);
-
- foreach ($links as $mysqli) {
- if ($use_oo_syntax) {
- $res = $mysqli->reap_async_query();
- } else {
- $res = mysqli_reap_async_query($mysqli);
- }
- if (is_object($res)) {
- printf("[%03d + 2] Can fetch resultset although no query has been run!\n", $offset);
- } else if (mysqli_errno($mysqli) > 0) {
- printf("[%03d + 3] Error indicated through links array: %d/%s",
- $offset, mysqli_errno($mysqli), mysqli_error($mysqli));
- } else {
- printf("[%03d + 4] Cannot fetch and no error set - non resultset query (no SELECT)!\n", $offset);
- }
- }
-
- foreach ($errors as $mysqli)
- printf("[%03d + 5] Error on %d: %d/%s\n",
- $offset, mysqli_thread_id($mysqli), mysqli_errno($mysqli), mysqli_error($mysqli));
-
- foreach ($reject as $mysqli)
- printf("[%03d + 6] Rejecting thread %d: %d/%s\n",
- $offset, mysqli_thread_id($mysqli), mysqli_errno($mysqli), mysqli_error($mysqli));
-
- }
-
- // Connections on which no query has been send - 1
- $link = get_connection();
- $links = array($link);
- $errors = array($link);
- $reject = array($link);
- poll_async(12, $link, $links, $errors, $reject, 0, false);
- mysqli_close($link);
-
- $link = get_connection();
- $links = array($link);
- $errors = array($link);
- $reject = array($link);
- poll_async(13, $link, $links, $errors, $reject, 0, true);
- mysqli_close($link);
-
- // Connections on which no query has been send - 2
- // Difference: pass $links twice
- $link = get_connection();
- $links = array($link, $link);
- $errors = array($link, $link);
- $reject = array();
- poll_async(14, $link, $links, $errors, $reject, 0, false);
-
- // Connections on which no query has been send - 3
- // Difference: pass two connections
- $link = get_connection();
- $links = array($link, get_connection());
- $errors = array($link, $link);
- $reject = array();
- poll_async(15, $link, $links, $errors, $reject, 0, false);
-
- // Reference mess...
- $link = get_connection();
- $links = array($link);
- $errors = array($link);
- $ref_errors =& $errors;
- $reject = array();
- poll_async(16, $link, $links, $ref_errors, $reject, 0, false);
-
- print "done!";
+ require_once('connect.inc');
+
+ function get_connection() {
+ global $host, $user, $passwd, $db, $port, $socket;
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ return $link;
+ }
+
+ if (!$link = get_connection())
+ printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+
+ $read = $error = $reject = array($link);
+ if (0 !== ($tmp = (mysqli_poll($read, $error, $reject, 0, 1))))
+ printf("[009] Expecting int/0 got %s/%s\n", gettype($tmp), var_export($tmp, true));
+
+ $read = $error = $reject = array($link);
+ if (false !== ($tmp = (mysqli_poll($read, $error, $reject, -1, 1))))
+ printf("[010] Expecting false got %s/%s\n", gettype($tmp), var_export($tmp, true));
+
+ $read = $error = $reject = array($link);
+ if (false !== ($tmp = (mysqli_poll($read, $error, $reject, 0, -1))))
+ printf("[011] Expecting false got %s/%s\n", gettype($tmp), var_export($tmp, true));
+
+ function poll_async($offset, $link, $links, $errors, $reject, $exp_ready, $use_oo_syntax) {
+
+ if ($exp_ready !== ($tmp = mysqli_poll($links, $errors, $reject, 0, 1000)))
+ printf("[%03d + 1] There should be %d links ready to read from, %d ready\n",
+ $exp_ready, $tmp);
+
+ foreach ($links as $mysqli) {
+ if ($use_oo_syntax) {
+ $res = $mysqli->reap_async_query();
+ } else {
+ $res = mysqli_reap_async_query($mysqli);
+ }
+ if (is_object($res)) {
+ printf("[%03d + 2] Can fetch resultset although no query has been run!\n", $offset);
+ } else if (mysqli_errno($mysqli) > 0) {
+ printf("[%03d + 3] Error indicated through links array: %d/%s",
+ $offset, mysqli_errno($mysqli), mysqli_error($mysqli));
+ } else {
+ printf("[%03d + 4] Cannot fetch and no error set - non resultset query (no SELECT)!\n", $offset);
+ }
+ }
+
+ foreach ($errors as $mysqli)
+ printf("[%03d + 5] Error on %d: %d/%s\n",
+ $offset, mysqli_thread_id($mysqli), mysqli_errno($mysqli), mysqli_error($mysqli));
+
+ foreach ($reject as $mysqli)
+ printf("[%03d + 6] Rejecting thread %d: %d/%s\n",
+ $offset, mysqli_thread_id($mysqli), mysqli_errno($mysqli), mysqli_error($mysqli));
+
+ }
+
+ // Connections on which no query has been send - 1
+ $link = get_connection();
+ $links = array($link);
+ $errors = array($link);
+ $reject = array($link);
+ poll_async(12, $link, $links, $errors, $reject, 0, false);
+ mysqli_close($link);
+
+ $link = get_connection();
+ $links = array($link);
+ $errors = array($link);
+ $reject = array($link);
+ poll_async(13, $link, $links, $errors, $reject, 0, true);
+ mysqli_close($link);
+
+ // Connections on which no query has been send - 2
+ // Difference: pass $links twice
+ $link = get_connection();
+ $links = array($link, $link);
+ $errors = array($link, $link);
+ $reject = array();
+ poll_async(14, $link, $links, $errors, $reject, 0, false);
+
+ // Connections on which no query has been send - 3
+ // Difference: pass two connections
+ $link = get_connection();
+ $links = array($link, get_connection());
+ $errors = array($link, $link);
+ $reject = array();
+ poll_async(15, $link, $links, $errors, $reject, 0, false);
+
+ // Reference mess...
+ $link = get_connection();
+ $links = array($link);
+ $errors = array($link);
+ $ref_errors =& $errors;
+ $reject = array();
+ poll_async(16, $link, $links, $ref_errors, $reject, 0, false);
+
+ print "done!";
?>
--EXPECTF--
Warning: mysqli_poll(): Negative values passed for sec and/or usec in %s on line %d
diff --git a/ext/mysqli/tests/mysqli_poll_kill.phpt b/ext/mysqli/tests/mysqli_poll_kill.phpt
index 7c10d13df1..c796c06c70 100644
--- a/ext/mysqli/tests/mysqli_poll_kill.phpt
+++ b/ext/mysqli/tests/mysqli_poll_kill.phpt
@@ -12,175 +12,175 @@ if (!$IS_MYSQLND)
?>
--FILE--
<?php
- require_once('connect.inc');
-
- function get_connection() {
- global $host, $user, $passwd, $db, $port, $socket;
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- return $link;
- }
-
- // Killing connection - 1
-
- $link = get_connection();
- if (true !== ($tmp = mysqli_query($link, "SELECT 1 AS 'processed before killed'", MYSQLI_ASYNC | MYSQLI_USE_RESULT)))
- printf("[002] Expecting boolean/true got %s/%s\n", gettype($tmp), var_export($tmp, true));
-
- // Sleep 0.1s - the asynchronous query should have been processed after the wait period
- usleep(100000);
- $thread_id = mysqli_thread_id($link);
- mysqli_kill(get_connection(), $thread_id);
-
- $links = array($link);
- $errors = array($link);
- $reject = array($link);
-
- // Yes, 1 - the asynchronous query should have been processed
- if (1 !== ($tmp = (mysqli_poll($links, $errors, $reject, 0, 10000))))
- printf("[003] Expecting int/1 got %s/%s\n", gettype($tmp), var_export($tmp, true));
-
- if (!is_array($links) || empty($links))
- printf("[004] Expecting non-empty array got %s/%s\n", gettype($links), var_export($links, true));
- else
- foreach ($links as $link) {
- if (is_object($res = mysqli_reap_async_query($link))) {
- // Yes, you can fetch a result - the query has been processed
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
- } else if ($link->errno > 0) {
- printf("[005] Error: %d\n", $link->errno);
- }
- }
-
- // No error!
- if (!is_array($errors) || !empty($errors))
- printf("[006] Expecting non-empty array got %s/%s\n", gettype($errors), var_export($errors, true));
-
- if (!is_array($reject) || !empty($reject))
- printf("[007] Expecting empty array got %s/%s\n", gettype($reject), var_export($reject, true));
-
- // Lets pass a dead connection
- $links = array($link);
- $errors = array($link);
- $reject = array($link);
- if (0 !== ($tmp = mysqli_poll($links, $errors, $reject, 1)))
- printf("[008] There should be no connection ready! Returned %s/%s, expecting int/0.\n",
- gettype($tmp), var_export($tmp, true));
-
- if (!empty($errors))
- printf("[009] There should be no errors but one rejected connection\n");
-
- foreach ($reject as $mysqli)
- if (mysqli_thread_id($mysqli) != $thread_id) {
- printf("[010] Rejected thread %d should have rejected thread %d\n",
- mysqli_thread_id($mysqli), $thread_id);
- }
-
- // Killing connection - 2
-
- $link = get_connection();
- if (true !== ($tmp = mysqli_query($link, "SELECT 1", MYSQLI_ASYNC | MYSQLI_USE_RESULT)))
- printf("[011] Expecting boolean/true got %s/%s\n", gettype($tmp), var_export($tmp, true));
-
- usleep(100000);
- $thread_id = mysqli_thread_id($link);
- mysqli_kill(get_connection(), $thread_id);
-
- // Yes, 1 - fetch OK packet of kill!
- $processed = 0;
- $begin = microtime(true);
- do {
- $links = array($link, $link);
- $errors = array($link, $link);
- $reject = array($link, $link);
- $ready = mysqli_poll($links, $errors, $reject, 1);
-
- if (!empty($errors)) {
- foreach ($errors as $mysqli) {
- printf("[012] Error on thread %d: %s/%s\n",
- mysqli_thread_id($mysqli),
- mysqli_errno($mysqli),
- mysqli_error($mysqli));
- }
- break;
- }
-
- if (FALSE === $ready) {
- printf("[013] MySQLi indicates some error\n");
- break;
- }
-
- if (!empty($reject)) {
- foreach ($reject as $mysqli) {
- printf("[014] Rejecting thread %d: %s/%s\n",
- mysqli_thread_id($mysqli),
- mysqli_errno($mysqli),
- mysqli_error($mysqli));
- }
- $processed += count($reject);
- }
-
- foreach ($links as $mysqli) {
- if (is_object($res = mysqli_reap_async_query($mysqli))) {
- printf("Fetching from thread %d...\n", mysqli_thread_id($mysqli));
- var_dump(mysqli_fetch_assoc($res));
- } else if (mysqli_errno($mysqli) > 0) {
- printf("[015] %d/%s\n", mysqli_errno($mysqli), mysqli_error($mysqli));
- }
- $processed++;
- }
-
- if ((microtime(true) - $begin) > 5) {
- printf("[016] Pulling the emergency break after 5s, something is wrong...\n");
- break;
- }
-
- } while ($processed < 2);
-
-
- // Killing connection - 3
-
- $link = get_connection();
- $thread_id = mysqli_thread_id($link);
- mysqli_kill(get_connection(), $thread_id);
- // Sleep 0.1s to ensure the KILL gets recognized
- usleep(100000);
- if (false !== ($tmp = mysqli_query($link, "SELECT 1 AS 'processed before killed'", MYSQLI_ASYNC | MYSQLI_USE_RESULT)))
- printf("[017] Expecting boolean/false got %s/%s\n", gettype($tmp), var_export($tmp, true));
-
- $links = array($link);
- $errors = array($link);
- $reject = array($link);
-
- if (0 !== ($tmp = (mysqli_poll($links, $errors, $reject, 0, 10000))))
- printf("[018] Expecting int/0 got %s/%s\n", gettype($tmp), var_export($tmp, true));
-
- if (!is_array($links) || empty($links))
- printf("[019] Expecting non-empty array got %s/%s\n", gettype($links), var_export($links, true));
- else
- foreach ($links as $link) {
- if (is_object($res = mysqli_reap_async_query($link))) {
- // No, you cannot fetch the result
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
- } else if ($link->errno > 0) {
- // But you are supposed to handle the error the way its shown here!
- printf("[020] Error: %d/%s\n", $link->errno, $link->error);
- }
- }
-
- // None of these will indicate an error, check errno on the list of returned connections!
- if (!is_array($errors) || !empty($errors))
- printf("[021] Expecting non-empty array got %s/%s\n", gettype($errors), var_export($errors, true));
-
- if (!is_array($reject) || !empty($reject))
- printf("[021] Expecting empty array got %s/%s\n", gettype($reject), var_export($reject, true));
-
-
- mysqli_close($link);
- print "done!";
+ require_once('connect.inc');
+
+ function get_connection() {
+ global $host, $user, $passwd, $db, $port, $socket;
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ return $link;
+ }
+
+ // Killing connection - 1
+
+ $link = get_connection();
+ if (true !== ($tmp = mysqli_query($link, "SELECT 1 AS 'processed before killed'", MYSQLI_ASYNC | MYSQLI_USE_RESULT)))
+ printf("[002] Expecting boolean/true got %s/%s\n", gettype($tmp), var_export($tmp, true));
+
+ // Sleep 0.1s - the asynchronous query should have been processed after the wait period
+ usleep(100000);
+ $thread_id = mysqli_thread_id($link);
+ mysqli_kill(get_connection(), $thread_id);
+
+ $links = array($link);
+ $errors = array($link);
+ $reject = array($link);
+
+ // Yes, 1 - the asynchronous query should have been processed
+ if (1 !== ($tmp = (mysqli_poll($links, $errors, $reject, 0, 10000))))
+ printf("[003] Expecting int/1 got %s/%s\n", gettype($tmp), var_export($tmp, true));
+
+ if (!is_array($links) || empty($links))
+ printf("[004] Expecting non-empty array got %s/%s\n", gettype($links), var_export($links, true));
+ else
+ foreach ($links as $link) {
+ if (is_object($res = mysqli_reap_async_query($link))) {
+ // Yes, you can fetch a result - the query has been processed
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
+ } else if ($link->errno > 0) {
+ printf("[005] Error: %d\n", $link->errno);
+ }
+ }
+
+ // No error!
+ if (!is_array($errors) || !empty($errors))
+ printf("[006] Expecting non-empty array got %s/%s\n", gettype($errors), var_export($errors, true));
+
+ if (!is_array($reject) || !empty($reject))
+ printf("[007] Expecting empty array got %s/%s\n", gettype($reject), var_export($reject, true));
+
+ // Lets pass a dead connection
+ $links = array($link);
+ $errors = array($link);
+ $reject = array($link);
+ if (0 !== ($tmp = mysqli_poll($links, $errors, $reject, 1)))
+ printf("[008] There should be no connection ready! Returned %s/%s, expecting int/0.\n",
+ gettype($tmp), var_export($tmp, true));
+
+ if (!empty($errors))
+ printf("[009] There should be no errors but one rejected connection\n");
+
+ foreach ($reject as $mysqli)
+ if (mysqli_thread_id($mysqli) != $thread_id) {
+ printf("[010] Rejected thread %d should have rejected thread %d\n",
+ mysqli_thread_id($mysqli), $thread_id);
+ }
+
+ // Killing connection - 2
+
+ $link = get_connection();
+ if (true !== ($tmp = mysqli_query($link, "SELECT 1", MYSQLI_ASYNC | MYSQLI_USE_RESULT)))
+ printf("[011] Expecting boolean/true got %s/%s\n", gettype($tmp), var_export($tmp, true));
+
+ usleep(100000);
+ $thread_id = mysqli_thread_id($link);
+ mysqli_kill(get_connection(), $thread_id);
+
+ // Yes, 1 - fetch OK packet of kill!
+ $processed = 0;
+ $begin = microtime(true);
+ do {
+ $links = array($link, $link);
+ $errors = array($link, $link);
+ $reject = array($link, $link);
+ $ready = mysqli_poll($links, $errors, $reject, 1);
+
+ if (!empty($errors)) {
+ foreach ($errors as $mysqli) {
+ printf("[012] Error on thread %d: %s/%s\n",
+ mysqli_thread_id($mysqli),
+ mysqli_errno($mysqli),
+ mysqli_error($mysqli));
+ }
+ break;
+ }
+
+ if (FALSE === $ready) {
+ printf("[013] MySQLi indicates some error\n");
+ break;
+ }
+
+ if (!empty($reject)) {
+ foreach ($reject as $mysqli) {
+ printf("[014] Rejecting thread %d: %s/%s\n",
+ mysqli_thread_id($mysqli),
+ mysqli_errno($mysqli),
+ mysqli_error($mysqli));
+ }
+ $processed += count($reject);
+ }
+
+ foreach ($links as $mysqli) {
+ if (is_object($res = mysqli_reap_async_query($mysqli))) {
+ printf("Fetching from thread %d...\n", mysqli_thread_id($mysqli));
+ var_dump(mysqli_fetch_assoc($res));
+ } else if (mysqli_errno($mysqli) > 0) {
+ printf("[015] %d/%s\n", mysqli_errno($mysqli), mysqli_error($mysqli));
+ }
+ $processed++;
+ }
+
+ if ((microtime(true) - $begin) > 5) {
+ printf("[016] Pulling the emergency break after 5s, something is wrong...\n");
+ break;
+ }
+
+ } while ($processed < 2);
+
+
+ // Killing connection - 3
+
+ $link = get_connection();
+ $thread_id = mysqli_thread_id($link);
+ mysqli_kill(get_connection(), $thread_id);
+ // Sleep 0.1s to ensure the KILL gets recognized
+ usleep(100000);
+ if (false !== ($tmp = mysqli_query($link, "SELECT 1 AS 'processed before killed'", MYSQLI_ASYNC | MYSQLI_USE_RESULT)))
+ printf("[017] Expecting boolean/false got %s/%s\n", gettype($tmp), var_export($tmp, true));
+
+ $links = array($link);
+ $errors = array($link);
+ $reject = array($link);
+
+ if (0 !== ($tmp = (mysqli_poll($links, $errors, $reject, 0, 10000))))
+ printf("[018] Expecting int/0 got %s/%s\n", gettype($tmp), var_export($tmp, true));
+
+ if (!is_array($links) || empty($links))
+ printf("[019] Expecting non-empty array got %s/%s\n", gettype($links), var_export($links, true));
+ else
+ foreach ($links as $link) {
+ if (is_object($res = mysqli_reap_async_query($link))) {
+ // No, you cannot fetch the result
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
+ } else if ($link->errno > 0) {
+ // But you are supposed to handle the error the way its shown here!
+ printf("[020] Error: %d/%s\n", $link->errno, $link->error);
+ }
+ }
+
+ // None of these will indicate an error, check errno on the list of returned connections!
+ if (!is_array($errors) || !empty($errors))
+ printf("[021] Expecting non-empty array got %s/%s\n", gettype($errors), var_export($errors, true));
+
+ if (!is_array($reject) || !empty($reject))
+ printf("[021] Expecting empty array got %s/%s\n", gettype($reject), var_export($reject, true));
+
+
+ mysqli_close($link);
+ print "done!";
?>
--XFAIL--
To be fixed later. Minor issue about fetching error message from killed line
diff --git a/ext/mysqli/tests/mysqli_poll_mixing_insert_select.phpt b/ext/mysqli/tests/mysqli_poll_mixing_insert_select.phpt
index bfe780a9cd..13dcb12093 100644
--- a/ext/mysqli/tests/mysqli_poll_mixing_insert_select.phpt
+++ b/ext/mysqli/tests/mysqli_poll_mixing_insert_select.phpt
@@ -12,150 +12,150 @@ if (!$IS_MYSQLND)
?>
--FILE--
<?php
- require_once('table.inc');
-
- function get_connection() {
- global $host, $user, $passwd, $db, $port, $socket;
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- return $link;
- }
-
-
- // Note: some queries will fail! They are supposed to fail.
- $queries = array(
- 'CREATE TABLE IF NOT EXISTS bogus(id INT)',
- 'SET @a = 1',
- 'SELECT * FROM test ORDER BY id ASC LIMIT 2',
- "INSERT INTO test(id, label) VALUES (100, 'z')",
- 'SELECT * FROM test ORDER BY id ASC LIMIT 2',
- 'SELECT',
- 'UPDATE test SET id = 101 WHERE id > 3',
- 'UPDATE_FIX test SET id = 101 WHERE id > 3',
- 'DROP TABLE IF EXISTS bogus',
- 'DELETE FROM test WHERE id = @a',
- 'DELETE FROM test WHERE id = 1',
- );
-
- $link = get_connection();
- $have_proc = false;
- mysqli_real_query($link, "DROP PROCEDURE IF EXISTS p");
- if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25), OUT ver_out VARCHAR(25)) BEGIN SELECT ver_in INTO ver_out; END;')) {
- $have_proc = true;
- $queries[] = "CALL p('myversion', @version)";
- }
- mysqli_close($link);
-
- $links = array();
- for ($i = 0; $i < count($queries); $i++) {
-
- $link = get_connection();
-
- if (true !== ($tmp = mysqli_query($link, $queries[$i], MYSQLI_ASYNC | MYSQLI_USE_RESULT)))
- printf("[002] Expecting true got %s/%s\n", gettype($tmp), var_export($tmp, true));
-
- // WARNING KLUDGE NOTE
- // Add a tiny delay to ensure that queries get executed in a certain order
- // If your MySQL server is very slow the test may randomly fail!
- usleep(20000);
-
- $links[mysqli_thread_id($link)] = array(
- 'query' => $queries[$i],
- 'link' => $link,
- 'processed' => false,
- );
- }
-
- $saved_errors = array();
- do {
- $poll_links = $poll_errors = $poll_reject = array();
- foreach ($links as $thread_id => $link) {
- if (!$link['processed']) {
- $poll_links[] = $link['link'];
- $poll_errors[] = $link['link'];
- $poll_reject[] = $link['link'];
- }
- }
- if (0 == count($poll_links))
- break;
-
- if (0 === ($num_ready = mysqli_poll($poll_links, $poll_errors, $poll_reject, 0, 200000)))
- continue;
-
- if (!empty($poll_errors)) {
- die(var_dump($poll_errors));
- }
-
- if (FALSE === $num_ready) {
- die("Some mysqli indicated error");
- }
-
- foreach ($poll_links as $link) {
- $thread_id = mysqli_thread_id($link);
- $links[$thread_id]['processed'] = true;
-
- if (is_object($res = mysqli_reap_async_query($link))) {
- // result set object
- while ($row = mysqli_fetch_assoc($res)) {
- // eat up all results
- ;
- }
- mysqli_free_result($res);
- } else {
- // either there is no result (no SELECT) or there is an error
- if (mysqli_errno($link) > 0) {
- $saved_errors[$thread_id] = mysqli_errno($link);
- printf("[003] '%s' caused %d\n", $links[$thread_id]['query'], mysqli_errno($link));
- }
- }
- }
-
- } while (true);
-
- // Checking if all lines are still usable
- foreach ($links as $thread_id => $link) {
- if (isset($saved_errors[$thread_id]) &&
- $saved_errors[$thread_id] != mysqli_errno($link['link'])) {
- printf("[004] Error state not saved for query '%s', %d != %d\n", $link['query'],
- $saved_errors[$thread_id], mysqli_errno($link['link']));
- }
-
- if (!$res = mysqli_query($link['link'], 'SELECT * FROM test WHERE id = 100'))
- printf("[005] Expecting true got %s/%s\n", gettype($tmp), var_export($tmp, true));
- if (!$row = mysqli_fetch_row($res))
- printf("[006] Expecting true got %s/%s\n", gettype($tmp), var_export($tmp, true));
-
- mysqli_free_result($res);
- }
-
- if ($res = mysqli_query($link['link'], "SELECT * FROM test WHERE id = 100")) {
- $row = mysqli_fetch_assoc($res);
- var_dump($row);
- mysqli_free_result($res);
- }
-
- if ($have_proc && ($res = mysqli_query($link['link'], "SELECT @version as _version"))) {
- $row = mysqli_fetch_assoc($res);
- if ($row['_version'] != 'myversion') {
- printf("[007] Check procedures\n");
- }
- mysqli_free_result($res);
- }
-
- foreach ($links as $link)
- mysqli_close($link['link']);
-
- $link = get_connection();
- if (!mysqli_query($link, 'SELECT 1', MYSQLI_ASYNC))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_query($link, 'SELECT 1', MYSQLI_ASYNC))
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- mysqli_close($link);
-
- print "done!";
+ require_once('table.inc');
+
+ function get_connection() {
+ global $host, $user, $passwd, $db, $port, $socket;
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ return $link;
+ }
+
+
+ // Note: some queries will fail! They are supposed to fail.
+ $queries = array(
+ 'CREATE TABLE IF NOT EXISTS bogus(id INT)',
+ 'SET @a = 1',
+ 'SELECT * FROM test ORDER BY id ASC LIMIT 2',
+ "INSERT INTO test(id, label) VALUES (100, 'z')",
+ 'SELECT * FROM test ORDER BY id ASC LIMIT 2',
+ 'SELECT',
+ 'UPDATE test SET id = 101 WHERE id > 3',
+ 'UPDATE_FIX test SET id = 101 WHERE id > 3',
+ 'DROP TABLE IF EXISTS bogus',
+ 'DELETE FROM test WHERE id = @a',
+ 'DELETE FROM test WHERE id = 1',
+ );
+
+ $link = get_connection();
+ $have_proc = false;
+ mysqli_real_query($link, "DROP PROCEDURE IF EXISTS p");
+ if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25), OUT ver_out VARCHAR(25)) BEGIN SELECT ver_in INTO ver_out; END;')) {
+ $have_proc = true;
+ $queries[] = "CALL p('myversion', @version)";
+ }
+ mysqli_close($link);
+
+ $links = array();
+ for ($i = 0; $i < count($queries); $i++) {
+
+ $link = get_connection();
+
+ if (true !== ($tmp = mysqli_query($link, $queries[$i], MYSQLI_ASYNC | MYSQLI_USE_RESULT)))
+ printf("[002] Expecting true got %s/%s\n", gettype($tmp), var_export($tmp, true));
+
+ // WARNING KLUDGE NOTE
+ // Add a tiny delay to ensure that queries get executed in a certain order
+ // If your MySQL server is very slow the test may randomly fail!
+ usleep(20000);
+
+ $links[mysqli_thread_id($link)] = array(
+ 'query' => $queries[$i],
+ 'link' => $link,
+ 'processed' => false,
+ );
+ }
+
+ $saved_errors = array();
+ do {
+ $poll_links = $poll_errors = $poll_reject = array();
+ foreach ($links as $thread_id => $link) {
+ if (!$link['processed']) {
+ $poll_links[] = $link['link'];
+ $poll_errors[] = $link['link'];
+ $poll_reject[] = $link['link'];
+ }
+ }
+ if (0 == count($poll_links))
+ break;
+
+ if (0 === ($num_ready = mysqli_poll($poll_links, $poll_errors, $poll_reject, 0, 200000)))
+ continue;
+
+ if (!empty($poll_errors)) {
+ die(var_dump($poll_errors));
+ }
+
+ if (FALSE === $num_ready) {
+ die("Some mysqli indicated error");
+ }
+
+ foreach ($poll_links as $link) {
+ $thread_id = mysqli_thread_id($link);
+ $links[$thread_id]['processed'] = true;
+
+ if (is_object($res = mysqli_reap_async_query($link))) {
+ // result set object
+ while ($row = mysqli_fetch_assoc($res)) {
+ // eat up all results
+ ;
+ }
+ mysqli_free_result($res);
+ } else {
+ // either there is no result (no SELECT) or there is an error
+ if (mysqli_errno($link) > 0) {
+ $saved_errors[$thread_id] = mysqli_errno($link);
+ printf("[003] '%s' caused %d\n", $links[$thread_id]['query'], mysqli_errno($link));
+ }
+ }
+ }
+
+ } while (true);
+
+ // Checking if all lines are still usable
+ foreach ($links as $thread_id => $link) {
+ if (isset($saved_errors[$thread_id]) &&
+ $saved_errors[$thread_id] != mysqli_errno($link['link'])) {
+ printf("[004] Error state not saved for query '%s', %d != %d\n", $link['query'],
+ $saved_errors[$thread_id], mysqli_errno($link['link']));
+ }
+
+ if (!$res = mysqli_query($link['link'], 'SELECT * FROM test WHERE id = 100'))
+ printf("[005] Expecting true got %s/%s\n", gettype($tmp), var_export($tmp, true));
+ if (!$row = mysqli_fetch_row($res))
+ printf("[006] Expecting true got %s/%s\n", gettype($tmp), var_export($tmp, true));
+
+ mysqli_free_result($res);
+ }
+
+ if ($res = mysqli_query($link['link'], "SELECT * FROM test WHERE id = 100")) {
+ $row = mysqli_fetch_assoc($res);
+ var_dump($row);
+ mysqli_free_result($res);
+ }
+
+ if ($have_proc && ($res = mysqli_query($link['link'], "SELECT @version as _version"))) {
+ $row = mysqli_fetch_assoc($res);
+ if ($row['_version'] != 'myversion') {
+ printf("[007] Check procedures\n");
+ }
+ mysqli_free_result($res);
+ }
+
+ foreach ($links as $link)
+ mysqli_close($link['link']);
+
+ $link = get_connection();
+ if (!mysqli_query($link, 'SELECT 1', MYSQLI_ASYNC))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_query($link, 'SELECT 1', MYSQLI_ASYNC))
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ mysqli_close($link);
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_poll_reference.phpt b/ext/mysqli/tests/mysqli_poll_reference.phpt
index ab2ed2aee8..6aaa180dbe 100644
--- a/ext/mysqli/tests/mysqli_poll_reference.phpt
+++ b/ext/mysqli/tests/mysqli_poll_reference.phpt
@@ -19,189 +19,189 @@ if (mysqli_get_server_version($link) < 50012)
?>
--FILE--
<?php
- require_once('connect.inc');
-
- function get_connection() {
- global $host, $user, $passwd, $db, $port, $socket;
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- return $link;
- }
-
-
- $mysqli1 = get_connection();
- $mysqli2 = get_connection();
-
- var_dump(mysqli_query($mysqli1, "SELECT SLEEP(0.10)", MYSQLI_ASYNC | MYSQLI_USE_RESULT));
- var_dump(mysqli_query($mysqli2, "SELECT SLEEP(0.20)", MYSQLI_ASYNC | MYSQLI_USE_RESULT));
-
- $processed = $loops = 0;
- do {
- $loops++;
- if ($loops > 10) {
- printf("[002] The queries should have finished already\n");
- break;
- }
- // WARNING: All arrays point to the same object - this will give bogus results!
- // The behaviour is in line with stream_select(). Be warned, be careful.
- $links = $errors = $reject = array($mysqli1, $mysqli2);
- if (0 == ($ready = mysqli_poll($links, $errors, $reject, 0, 50000))) {
- continue;
- }
-
- foreach ($links as $link) {
- if ($res = mysqli_reap_async_query($link)) {
- mysqli_free_result($res);
- }
- $processed++;
- }
- } while ($processed < 2);
-
- mysqli_close($mysqli1);
- mysqli_close($mysqli2);
-
- $mysqli1 = get_connection();
- $mysqli2 = get_connection();
-
- var_dump(mysqli_query($mysqli1, "SELECT SLEEP(0.10)", MYSQLI_ASYNC | MYSQLI_USE_RESULT));
- var_dump(mysqli_query($mysqli2, "SELECT SLEEP(0.20)", MYSQLI_ASYNC | MYSQLI_USE_RESULT));
-
- $processed = $loops = 0;
- do {
- $loops++;
- if ($loops > 10) {
- printf("[003] The queries should have finished already\n");
- break;
- }
- // WARNING: All arrays point to the same object - this will give bogus results!
- $links = $errors = array($mysqli1, $mysqli2);
- $reject = array($mysqli1, $mysqli2);
- if (0 == ($ready = mysqli_poll($links, $errors, $reject, 0, 50000))) {
- continue;
- }
- foreach ($links as $link) {
- if ($res = mysqli_reap_async_query($link)) {
- mysqli_free_result($res);
- }
- $processed++;
- }
- } while ($processed < 2);
-
- mysqli_close($mysqli1);
- mysqli_close($mysqli2);
-
- $mysqli1 = get_connection();
- $mysqli2 = get_connection();
-
- var_dump(mysqli_query($mysqli1, "SELECT SLEEP(0.10)", MYSQLI_ASYNC | MYSQLI_USE_RESULT));
- var_dump(mysqli_query($mysqli2, "SELECT SLEEP(0.20)", MYSQLI_ASYNC | MYSQLI_USE_RESULT));
-
- $processed = $loops = 0;
- do {
- $loops++;
- if ($loops > 10) {
- printf("[004] The queries should have finished already\n");
- break;
- }
- // WARNING: All arrays point to the same object - this will give bogus results!
- $links = array($mysqli1, $mysqli2);
- $errors = $reject = array($mysqli1, $mysqli2);
- if (0 == ($ready = mysqli_poll($links, $errors, $reject, 0, 50000))) {
- continue;
- }
- foreach ($links as $link) {
- if ($res = mysqli_reap_async_query($link)) {
- mysqli_free_result($res);
- }
- $processed++;
- }
- } while ($processed < 2);
-
- mysqli_close($mysqli1);
- mysqli_close($mysqli2);
-
- // This is bogus code and bogus usage - OK to throw no errors!
- $mysqli1 = get_connection();
- $mysqli2 = get_connection();
-
- var_dump(mysqli_query($mysqli1, "SELECT SLEEP(0.10)", MYSQLI_ASYNC | MYSQLI_USE_RESULT));
- $thread_id = mysqli_thread_id($mysqli2);
- printf("Connection %d should be rejected...\n", $thread_id);
-
- $processed = $loops = 0;
- do {
- $loops++;
- if ($loops > 10) {
- printf("[005] The queries should have finished already\n");
- break;
- }
- $links = $errors = $reject = array($mysqli1, $mysqli2);
- if (0 == ($ready = mysqli_poll($links, $errors, $reject, 0, 50000))) {
- continue;
- }
- // WARNING: Due to the reference issue none of these should ever fire!
- foreach ($reject as $link) {
- printf("Connection %d was rejected...\n", mysqli_thread_id($link));
+ require_once('connect.inc');
+
+ function get_connection() {
+ global $host, $user, $passwd, $db, $port, $socket;
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ return $link;
+ }
+
+
+ $mysqli1 = get_connection();
+ $mysqli2 = get_connection();
+
+ var_dump(mysqli_query($mysqli1, "SELECT SLEEP(0.10)", MYSQLI_ASYNC | MYSQLI_USE_RESULT));
+ var_dump(mysqli_query($mysqli2, "SELECT SLEEP(0.20)", MYSQLI_ASYNC | MYSQLI_USE_RESULT));
+
+ $processed = $loops = 0;
+ do {
+ $loops++;
+ if ($loops > 10) {
+ printf("[002] The queries should have finished already\n");
+ break;
+ }
+ // WARNING: All arrays point to the same object - this will give bogus results!
+ // The behaviour is in line with stream_select(). Be warned, be careful.
+ $links = $errors = $reject = array($mysqli1, $mysqli2);
+ if (0 == ($ready = mysqli_poll($links, $errors, $reject, 0, 50000))) {
+ continue;
+ }
+
+ foreach ($links as $link) {
+ if ($res = mysqli_reap_async_query($link)) {
+ mysqli_free_result($res);
+ }
+ $processed++;
+ }
+ } while ($processed < 2);
+
+ mysqli_close($mysqli1);
+ mysqli_close($mysqli2);
+
+ $mysqli1 = get_connection();
+ $mysqli2 = get_connection();
+
+ var_dump(mysqli_query($mysqli1, "SELECT SLEEP(0.10)", MYSQLI_ASYNC | MYSQLI_USE_RESULT));
+ var_dump(mysqli_query($mysqli2, "SELECT SLEEP(0.20)", MYSQLI_ASYNC | MYSQLI_USE_RESULT));
+
+ $processed = $loops = 0;
+ do {
+ $loops++;
+ if ($loops > 10) {
+ printf("[003] The queries should have finished already\n");
+ break;
+ }
+ // WARNING: All arrays point to the same object - this will give bogus results!
+ $links = $errors = array($mysqli1, $mysqli2);
+ $reject = array($mysqli1, $mysqli2);
+ if (0 == ($ready = mysqli_poll($links, $errors, $reject, 0, 50000))) {
+ continue;
+ }
+ foreach ($links as $link) {
+ if ($res = mysqli_reap_async_query($link)) {
+ mysqli_free_result($res);
+ }
+ $processed++;
+ }
+ } while ($processed < 2);
+
+ mysqli_close($mysqli1);
+ mysqli_close($mysqli2);
+
+ $mysqli1 = get_connection();
+ $mysqli2 = get_connection();
+
+ var_dump(mysqli_query($mysqli1, "SELECT SLEEP(0.10)", MYSQLI_ASYNC | MYSQLI_USE_RESULT));
+ var_dump(mysqli_query($mysqli2, "SELECT SLEEP(0.20)", MYSQLI_ASYNC | MYSQLI_USE_RESULT));
+
+ $processed = $loops = 0;
+ do {
+ $loops++;
+ if ($loops > 10) {
+ printf("[004] The queries should have finished already\n");
+ break;
+ }
+ // WARNING: All arrays point to the same object - this will give bogus results!
+ $links = array($mysqli1, $mysqli2);
+ $errors = $reject = array($mysqli1, $mysqli2);
+ if (0 == ($ready = mysqli_poll($links, $errors, $reject, 0, 50000))) {
+ continue;
+ }
+ foreach ($links as $link) {
+ if ($res = mysqli_reap_async_query($link)) {
+ mysqli_free_result($res);
+ }
+ $processed++;
+ }
+ } while ($processed < 2);
+
+ mysqli_close($mysqli1);
+ mysqli_close($mysqli2);
+
+ // This is bogus code and bogus usage - OK to throw no errors!
+ $mysqli1 = get_connection();
+ $mysqli2 = get_connection();
+
+ var_dump(mysqli_query($mysqli1, "SELECT SLEEP(0.10)", MYSQLI_ASYNC | MYSQLI_USE_RESULT));
+ $thread_id = mysqli_thread_id($mysqli2);
+ printf("Connection %d should be rejected...\n", $thread_id);
+
+ $processed = $loops = 0;
+ do {
+ $loops++;
+ if ($loops > 10) {
+ printf("[005] The queries should have finished already\n");
+ break;
+ }
+ $links = $errors = $reject = array($mysqli1, $mysqli2);
+ if (0 == ($ready = mysqli_poll($links, $errors, $reject, 0, 50000))) {
+ continue;
+ }
+ // WARNING: Due to the reference issue none of these should ever fire!
+ foreach ($reject as $link) {
+ printf("Connection %d was rejected...\n", mysqli_thread_id($link));
if (mysqli_thread_id($link) != $thread_id) {
printf("[006] Connector %d should have been rejected. But also %d has been rejected.",
$thread_id, mysqli_thread_id($link));
}
- $processed++;
- }
- foreach ($errors as $link) {
- printf("Connection %d has an error...\n", mysqli_thread_id($link));
- $processed++;
- }
- foreach ($links as $link) {
- if ($res = mysqli_reap_async_query($link)) {
- mysqli_free_result($res);
- $processed++;
- }
- }
- } while ($processed < 2);
-
- mysqli_close($mysqli1);
- mysqli_close($mysqli2);
-
- $mysqli1 = get_connection();
- $mysqli2 = get_connection();
-
- var_dump(mysqli_query($mysqli1, "SELECT SLEEP(0.10)", MYSQLI_ASYNC | MYSQLI_USE_RESULT));
- var_dump(mysqli_query($mysqli2, "SELECT SLEEP(0.20)", MYSQLI_ASYNC | MYSQLI_USE_RESULT));
-
- $processed = $loops = 0;
- $all = array($mysqli1, $mysqli2);
- do {
- $loops++;
- if ($loops > 10) {
- printf("[006] The queries should have finished already\n");
- break;
- }
- $links = $errors = $reject = $all;
- ob_start();
- if (0 == ($ready = mysqli_poll($links, $errors, $reject, 0, 50000))) {
- $tmp = ob_get_contents();
- ob_end_clean();
- if ($tmp != '') {
- printf("Expected error:\n%s\n", $tmp);
- break;
- }
- continue;
- }
- foreach ($links as $link) {
- if ($res = mysqli_reap_async_query($link)) {
- mysqli_free_result($res);
- }
- $processed++;
- }
- } while ($processed < 2);
-
- $ready = mysqli_poll($links, $errors, $reject, 0, 50000);
- mysqli_close($mysqli1);
- mysqli_close($mysqli2);
-
- print "done!";
+ $processed++;
+ }
+ foreach ($errors as $link) {
+ printf("Connection %d has an error...\n", mysqli_thread_id($link));
+ $processed++;
+ }
+ foreach ($links as $link) {
+ if ($res = mysqli_reap_async_query($link)) {
+ mysqli_free_result($res);
+ $processed++;
+ }
+ }
+ } while ($processed < 2);
+
+ mysqli_close($mysqli1);
+ mysqli_close($mysqli2);
+
+ $mysqli1 = get_connection();
+ $mysqli2 = get_connection();
+
+ var_dump(mysqli_query($mysqli1, "SELECT SLEEP(0.10)", MYSQLI_ASYNC | MYSQLI_USE_RESULT));
+ var_dump(mysqli_query($mysqli2, "SELECT SLEEP(0.20)", MYSQLI_ASYNC | MYSQLI_USE_RESULT));
+
+ $processed = $loops = 0;
+ $all = array($mysqli1, $mysqli2);
+ do {
+ $loops++;
+ if ($loops > 10) {
+ printf("[006] The queries should have finished already\n");
+ break;
+ }
+ $links = $errors = $reject = $all;
+ ob_start();
+ if (0 == ($ready = mysqli_poll($links, $errors, $reject, 0, 50000))) {
+ $tmp = ob_get_contents();
+ ob_end_clean();
+ if ($tmp != '') {
+ printf("Expected error:\n%s\n", $tmp);
+ break;
+ }
+ continue;
+ }
+ foreach ($links as $link) {
+ if ($res = mysqli_reap_async_query($link)) {
+ mysqli_free_result($res);
+ }
+ $processed++;
+ }
+ } while ($processed < 2);
+
+ $ready = mysqli_poll($links, $errors, $reject, 0, 50000);
+ mysqli_close($mysqli1);
+ mysqli_close($mysqli2);
+
+ print "done!";
?>
--EXPECTF--
bool(true)
diff --git a/ext/mysqli/tests/mysqli_prepare.phpt b/ext/mysqli/tests/mysqli_prepare.phpt
index 0c3bedf5b5..7c2ab21d6b 100644
--- a/ext/mysqli/tests/mysqli_prepare.phpt
+++ b/ext/mysqli/tests/mysqli_prepare.phpt
@@ -8,113 +8,97 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ require('table.inc');
- if (!is_null($tmp = @mysqli_prepare()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = @mysqli_prepare($link, false)))
+ printf("[003] Expecting boolean/false, got %s\n", gettype($tmp));
- if (!is_null($tmp = @mysqli_prepare($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!$res = mysqli_query($link, "SELECT id, label FROM test", MYSQLI_USE_RESULT))
+ printf("[004] [%d] %s, next test will fail\n", mysqli_errno($link), mysqli_error($link));
- require('table.inc');
+ if (false !== ($tmp = mysqli_prepare($link, 'SELECT id FROM test WHERE id > ?')))
+ printf("[005] Expecting boolean/false, got %s, [%d] %s\n", gettype($tmp), mysqli_errno($link), mysqli_error($link));
- if (false !== ($tmp = @mysqli_prepare($link, false)))
- printf("[003] Expecting boolean/false, got %s\n", gettype($tmp));
+ mysqli_free_result($res);
- if (!$res = mysqli_query($link, "SELECT id, label FROM test", MYSQLI_USE_RESULT))
- printf("[004] [%d] %s, next test will fail\n", mysqli_errno($link), mysqli_error($link));
+ if (!is_object(($stmt = mysqli_prepare($link, 'SELECT id FROM test'))) || !mysqli_stmt_execute($stmt))
+ printf("[006][%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_stmt_close($stmt);
- if (false !== ($tmp = mysqli_prepare($link, 'SELECT id FROM test WHERE id > ?')))
- printf("[005] Expecting boolean/false, got %s, [%d] %s\n", gettype($tmp), mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test2"))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_object(($stmt = mysqli_prepare($link, 'SELECT id FROM test'))) || !mysqli_stmt_execute($stmt))
- printf("[006][%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_stmt_close($stmt);
+ if (!is_object(($stmt = mysqli_prepare($link, 'CREATE TABLE test2(id INT) ENGINE =' . $engine))) || !mysqli_stmt_execute($stmt))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_stmt_close($stmt);
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test2"))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!is_object(($stmt = mysqli_prepare($link, 'INSERT INTO test2(id) VALUES(?)'))))
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_object(($stmt = mysqli_prepare($link, 'CREATE TABLE test2(id INT) ENGINE =' . $engine))) || !mysqli_stmt_execute($stmt))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_stmt_close($stmt);
+ $id = 1;
+ if (!mysqli_stmt_bind_param($stmt, 'i', $id) || !mysqli_stmt_execute($stmt))
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_stmt_close($stmt);
+ if (!is_object(($stmt = mysqli_prepare($link, 'REPLACE INTO test2(id) VALUES (?)'))))
+ printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_object(($stmt = mysqli_prepare($link, 'INSERT INTO test2(id) VALUES(?)'))))
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $id = 2;
+ if (!mysqli_stmt_bind_param($stmt, 'i', $id) || !mysqli_stmt_execute($stmt))
+ printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_stmt_close($stmt);
- $id = 1;
- if (!mysqli_stmt_bind_param($stmt, 'i', $id) || !mysqli_stmt_execute($stmt))
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_stmt_close($stmt);
+ if (!is_object(($stmt = mysqli_prepare($link, 'UPDATE test2 SET id = ? WHERE id = ?'))))
+ printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_object(($stmt = mysqli_prepare($link, 'REPLACE INTO test2(id) VALUES (?)'))))
- printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $id = 3;
+ $where = 2;
+ if (!mysqli_stmt_bind_param($stmt, 'ii', $id, $where) || !mysqli_stmt_execute($stmt))
+ printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_stmt_close($stmt);
- $id = 2;
- if (!mysqli_stmt_bind_param($stmt, 'i', $id) || !mysqli_stmt_execute($stmt))
- printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_stmt_close($stmt);
+ if (!is_object(($stmt = mysqli_prepare($link, 'DELETE FROM test2 WHERE id = ?'))))
+ printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_object(($stmt = mysqli_prepare($link, 'UPDATE test2 SET id = ? WHERE id = ?'))))
- printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $where = 3;
+ if (!mysqli_stmt_bind_param($stmt, 'i', $where) || !mysqli_stmt_execute($stmt))
+ printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_stmt_close($stmt);
- $id = 3;
- $where = 2;
- if (!mysqli_stmt_bind_param($stmt, 'ii', $id, $where) || !mysqli_stmt_execute($stmt))
- printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_stmt_close($stmt);
+ if (!is_object(($stmt = mysqli_prepare($link, 'SET @testvar = ?'))))
+ printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_object(($stmt = mysqli_prepare($link, 'DELETE FROM test2 WHERE id = ?'))))
- printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $testvar = 'testvar';
+ if (!mysqli_stmt_bind_param($stmt, 's', $testvar) || !mysqli_stmt_execute($stmt))
+ printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_stmt_close($stmt);
- $where = 3;
- if (!mysqli_stmt_bind_param($stmt, 'i', $where) || !mysqli_stmt_execute($stmt))
- printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_stmt_close($stmt);
+ if (!is_object(($stmt = mysqli_prepare($link, "DO GET_LOCK('testlock', 1)"))))
+ printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_stmt_close($stmt);
- if (!is_object(($stmt = mysqli_prepare($link, 'SET @testvar = ?'))))
- printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!is_object(($stmt = mysqli_prepare($link, 'SELECT id, @testvar FROM test2'))))
+ printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $testvar = 'testvar';
- if (!mysqli_stmt_bind_param($stmt, 's', $testvar) || !mysqli_stmt_execute($stmt))
- printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_stmt_close($stmt);
+ $id = $testvar = null;
+ if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_bind_result($stmt, $id, $testvar))
+ printf("[021] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ while (mysqli_stmt_fetch($stmt)) {
+ if (('testvar' !== $testvar) || (1 !== $id))
+ printf("[022] Expecting 'testvar'/1, got %s/%s. [%d] %s\n",
+ $testvar, $id, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
- if (!is_object(($stmt = mysqli_prepare($link, "DO GET_LOCK('testlock', 1)"))))
- printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_stmt_close($stmt);
+ var_dump(mysqli_stmt_prepare($stmt, 'SELECT 1; SELECT 2'));
- if (!is_object(($stmt = mysqli_prepare($link, 'SELECT id, @testvar FROM test2'))))
- printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_stmt_close($stmt);
+ mysqli_close($link);
- $id = $testvar = null;
- if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_bind_result($stmt, $id, $testvar))
- printf("[021] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- while (mysqli_stmt_fetch($stmt)) {
- if (('testvar' !== $testvar) || (1 !== $id))
- printf("[022] Expecting 'testvar'/1, got %s/%s. [%d] %s\n",
- $testvar, $id, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
-
- var_dump(mysqli_stmt_prepare($stmt, 'SELECT 1; SELECT 2'));
-
- mysqli_stmt_close($stmt);
-
- if (!is_null($tmp = @mysqli_stmt_prepare($link, 'SELECT id FROM test', 'foo')))
- printf("[023] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_close($link);
-
- if (!is_null($tmp = @mysqli_stmt_prepare($link, 'SELECT id FROM test')))
- printf("[024] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_prepare_no_object.phpt b/ext/mysqli/tests/mysqli_prepare_no_object.phpt
index 0a1d22d756..2b6a07d2ac 100644
--- a/ext/mysqli/tests/mysqli_prepare_no_object.phpt
+++ b/ext/mysqli/tests/mysqli_prepare_no_object.phpt
@@ -8,31 +8,31 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require('table.inc');
+ require('table.inc');
- if (false !== ($tmp = mysqli_prepare($link, false)))
- printf("[001] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp));
- printf("a) [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (false !== ($tmp = mysqli_prepare($link, false)))
+ printf("[001] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp));
+ printf("a) [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (false !== ($tmp = mysqli_prepare($link, '')))
- printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp));
- printf("b) [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (false !== ($tmp = mysqli_prepare($link, '')))
+ printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp));
+ printf("b) [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_close($link);
+ mysqli_close($link);
- if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (false !== ($tmp = $mysqli->prepare(false)))
- printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp));
- printf("c) [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (false !== ($tmp = $mysqli->prepare(false)))
+ printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp));
+ printf("c) [%d] %s\n", $mysqli->errno, $mysqli->error);
- if (false !== ($tmp = $mysqli->prepare('')))
- printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp));
- printf("c) [%d] %s\n", $mysqli->errno, $mysqli->error);
+ if (false !== ($tmp = $mysqli->prepare('')))
+ printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp));
+ printf("c) [%d] %s\n", $mysqli->errno, $mysqli->error);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_ps_select_union.phpt b/ext/mysqli/tests/mysqli_ps_select_union.phpt
index cb5699fc1e..8467690776 100644
--- a/ext/mysqli/tests/mysqli_ps_select_union.phpt
+++ b/ext/mysqli/tests/mysqli_ps_select_union.phpt
@@ -8,248 +8,248 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
- require_once("table.inc");
-
- // Regular (non-prepared) queries
- print "Using CAST('somestring' AS CHAR)...\n";
- if (!($res = $link->query("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST('two' AS CHAR)")))
- printf("[001] [%d] %s\n", $link->errno, $link->error);
-
- $data = array();
- while ($row = $res->fetch_assoc()) {
- $data[] = $row['column1'];
- var_dump($row['column1']);
- }
- $res->free();
-
- // Prepared Statements
- if (!($stmt = $link->prepare("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST('two' AS CHAR)")))
- printf("[002] [%d] %s\n", $link->errno, $link->error);
-
- $column1 = null;
- if (!$stmt->execute() || !$stmt->bind_result($column1))
- printf("[003] [%d] %s\n", $stmt->errno, $stmt->error);
-
- $index = 0;
- while ($stmt->fetch()) {
- if ($data[$index] != $column1) {
- printf("[004] Row %d, expecting %s/%s got %s/%s\n",
- $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1);
- }
- $index++;
- }
- $stmt->close();
-
- if ($IS_MYSQLND) {
- /*
- Advantage mysqlnd -
- The metadata mysqlnd has available after prepare is better than
- the one made available by the MySQL Client Library (libmysql).
- "libmysql" will give wrong results and that is OK -
- http://bugs.mysql.com/bug.php?id=47483
- */
- if (!($stmt = $link->prepare("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST('two' AS CHAR)")))
- printf("[005] [%d] %s\n", $link->errno, $link->error);
-
- $column1 = null;
- /* Note: bind_result before execute */
- if (!$stmt->bind_result($column1) || !$stmt->execute())
- printf("[006] [%d] %s\n", $stmt->errno, $stmt->error);
-
- $index = 0;
- while ($stmt->fetch()) {
- if ($data[$index] != $column1) {
- printf("[007] Row %d, expecting %s/%s got %s/%s\n",
- $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1);
- }
- $index++;
- }
- $stmt->close();
- }
-
- // Regular (non-prepared) queries
- print "Mixing CAST('somestring'AS CHAR), integer and CAST(integer AS CHAR)...\n";
- if (!($res = $link->query("SELECT 1 AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST(2 AS CHAR)")))
- printf("[008] [%d] %s\n", $link->errno, $link->error);
-
- $data = array();
- while ($row = $res->fetch_assoc()) {
- $data[] = $row['column1'];
- }
- $res->free();
-
- // Prepared Statements
- if (!($stmt = $link->prepare("SELECT 1 AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST(2 AS CHAR)")))
- printf("[009] [%d] %s\n", $link->errno, $link->error);
-
- $column1 = null;
- if (!$stmt->execute() || !$stmt->bind_result($column1))
- printf("[010] [%d] %s\n", $stmt->errno, $stmt->error);
-
- $index = 0;
- while ($stmt->fetch()) {
- if ($data[$index] != $column1) {
- printf("[011] Row %d, expecting %s/%s got %s/%s\n",
- $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1);
- }
- var_dump($column1);
- $index++;
- }
- $stmt->close();
-
- if ($IS_MYSQLND) {
- /* Advantage mysqlnd - see above... */
- if (!($stmt = $link->prepare("SELECT 1 AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST(2 AS CHAR)")))
- printf("[012] [%d] %s\n", $link->errno, $link->error);
-
- $column1 = null;
- if (!$stmt->bind_result($column1) || !$stmt->execute())
- printf("[013] [%d] %s\n", $stmt->errno, $stmt->error);
-
- $index = 0;
- while ($stmt->fetch()) {
- if ($data[$index] != $column1) {
- printf("[014] Row %d, expecting %s/%s got %s/%s\n",
- $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1);
- }
- $index++;
- }
- $stmt->close();
- }
-
- print "Using integer only...\n";
- if (!($res = $link->query("SELECT 1 AS column1 UNION SELECT 303 UNION SELECT 2")))
- printf("[015] [%d] %s\n", $link->errno, $link->error);
-
- $data = array();
- while ($row = $res->fetch_assoc()) {
- $data[] = $row['column1'];
- }
- $res->free();
-
- // Prepared Statements
- if (!($stmt = $link->prepare("SELECT 1 AS column1 UNION SELECT 303 UNION SELECT 2")))
- printf("[016] [%d] %s\n", $link->errno, $link->error);
-
- $column1 = null;
- if (!$stmt->execute() || !$stmt->bind_result($column1))
- printf("[017] [%d] %s\n", $stmt->errno, $stmt->error);
-
- $index = 0;
- while ($stmt->fetch()) {
- if ($data[$index] != $column1) {
- printf("[018] Row %d, expecting %s/%s got %s/%s\n",
- $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1);
- }
- var_dump($column1);
- $index++;
- }
- $stmt->close();
-
- if ($IS_MYSQLND) {
- /* Advantage mysqlnd - see above */
- if (!($stmt = $link->prepare("SELECT 1 AS column1 UNION SELECT 303 UNION SELECT 2")))
- printf("[019] [%d] %s\n", $link->errno, $link->error);
-
- $column1 = null;
- if (!$stmt->bind_result($column1) || !$stmt->execute())
- printf("[020] [%d] %s\n", $stmt->errno, $stmt->error);
-
- $index = 0;
- while ($stmt->fetch()) {
- if ($data[$index] != $column1) {
- printf("[021] Row %d, expecting %s/%s got %s/%s\n",
- $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1);
- }
- $index++;
- }
- $stmt->close();
- }
-
- print "Testing bind_param(), strings only...\n";
- $two = 'two';
- $three = 'three';
- if (!($stmt = $link->prepare("SELECT 'one' AS column1 UNION SELECT ? UNION SELECT ?")))
- printf("[022] [%d] %s\n", $stmt->errno, $stmt->error);
-
- $column1 = null;
- if (!$stmt->bind_param('ss', $three, $two) || !$stmt->execute() || !$stmt->bind_result($column1))
- printf("[023] [%d] %s\n", $stmt->errno, $stmt->error);
-
- $index = 0;
- $data = array();
- while ($stmt->fetch()) {
- $data[$index++] = $column1;
- var_dump($column1);
- }
- $stmt->close();
-
- if ($IS_MYSQLND) {
- /* Advantage mysqlnd - see above */
- $two = 'two';
- $three = 'three';
- if (!($stmt = $link->prepare("SELECT 'one' AS column1 UNION SELECT ? UNION SELECT ?")))
- printf("[024] [%d] %s\n", $stmt->errno, $stmt->error);
-
- $column1 = null;
- if (!$stmt->bind_param('ss', $three, $two) || !$stmt->bind_result($column1) || !$stmt->execute())
- printf("[025] [%d] %s\n", $stmt->errno, $stmt->error);
-
- $index = 0;
- while ($stmt->fetch()) {
- if ($data[$index] != $column1) {
- printf("[26] Row %d, expecting %s/%s, got %s/%s\n",
- $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1);
- }
- $index++;
- }
- $stmt->close();
- }
-
- print "Testing bind_param(), strings only, with CAST AS CHAR...\n";
- $two = 'two';
- $three = 'three beers are more than enough';
- if (!($stmt = $link->prepare("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST(? AS CHAR) UNION SELECT CAST(? AS CHAR)")))
- printf("[027] [%d] %s\n", $stmt->errno, $stmt->error);
-
- $column1 = null;
- if (!$stmt->bind_param('ss', $three, $two) || !$stmt->execute() || !$stmt->bind_result($column1))
- printf("[028] [%d] %s\n", $stmt->errno, $stmt->error);
-
- $index = 0;
- $data = array();
- while ($stmt->fetch()) {
- $data[$index++] = $column1;
- var_dump($column1);
- }
- $stmt->close();
-
- if ($IS_MYSQLND) {
- /* Advantage mysqlnd - see above */
- $two = 'two';
- $three = 'three beers are more than enough';
- if (!($stmt = $link->prepare("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST(? AS CHAR) UNION SELECT CAST(? AS CHAR)")))
- printf("[029] [%d] %s\n", $stmt->errno, $stmt->error);
-
- $column1 = null;
- if (!$stmt->bind_param('ss', $three, $two) || !$stmt->bind_result($column1) || !$stmt->execute())
- printf("[030] [%d] %s\n", $stmt->errno, $stmt->error);
-
- $index = 0;
- while ($stmt->fetch()) {
- if ($data[$index] != $column1) {
- printf("[31] Row %d, expecting %s/%s, got %s/%s\n",
- $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1);
- }
- $index++;
- }
- $stmt->close();
- }
-
- $link->close();
-
- print "done!";
+ require_once("connect.inc");
+ require_once("table.inc");
+
+ // Regular (non-prepared) queries
+ print "Using CAST('somestring' AS CHAR)...\n";
+ if (!($res = $link->query("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST('two' AS CHAR)")))
+ printf("[001] [%d] %s\n", $link->errno, $link->error);
+
+ $data = array();
+ while ($row = $res->fetch_assoc()) {
+ $data[] = $row['column1'];
+ var_dump($row['column1']);
+ }
+ $res->free();
+
+ // Prepared Statements
+ if (!($stmt = $link->prepare("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST('two' AS CHAR)")))
+ printf("[002] [%d] %s\n", $link->errno, $link->error);
+
+ $column1 = null;
+ if (!$stmt->execute() || !$stmt->bind_result($column1))
+ printf("[003] [%d] %s\n", $stmt->errno, $stmt->error);
+
+ $index = 0;
+ while ($stmt->fetch()) {
+ if ($data[$index] != $column1) {
+ printf("[004] Row %d, expecting %s/%s got %s/%s\n",
+ $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1);
+ }
+ $index++;
+ }
+ $stmt->close();
+
+ if ($IS_MYSQLND) {
+ /*
+ Advantage mysqlnd -
+ The metadata mysqlnd has available after prepare is better than
+ the one made available by the MySQL Client Library (libmysql).
+ "libmysql" will give wrong results and that is OK -
+ http://bugs.mysql.com/bug.php?id=47483
+ */
+ if (!($stmt = $link->prepare("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST('two' AS CHAR)")))
+ printf("[005] [%d] %s\n", $link->errno, $link->error);
+
+ $column1 = null;
+ /* Note: bind_result before execute */
+ if (!$stmt->bind_result($column1) || !$stmt->execute())
+ printf("[006] [%d] %s\n", $stmt->errno, $stmt->error);
+
+ $index = 0;
+ while ($stmt->fetch()) {
+ if ($data[$index] != $column1) {
+ printf("[007] Row %d, expecting %s/%s got %s/%s\n",
+ $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1);
+ }
+ $index++;
+ }
+ $stmt->close();
+ }
+
+ // Regular (non-prepared) queries
+ print "Mixing CAST('somestring'AS CHAR), integer and CAST(integer AS CHAR)...\n";
+ if (!($res = $link->query("SELECT 1 AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST(2 AS CHAR)")))
+ printf("[008] [%d] %s\n", $link->errno, $link->error);
+
+ $data = array();
+ while ($row = $res->fetch_assoc()) {
+ $data[] = $row['column1'];
+ }
+ $res->free();
+
+ // Prepared Statements
+ if (!($stmt = $link->prepare("SELECT 1 AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST(2 AS CHAR)")))
+ printf("[009] [%d] %s\n", $link->errno, $link->error);
+
+ $column1 = null;
+ if (!$stmt->execute() || !$stmt->bind_result($column1))
+ printf("[010] [%d] %s\n", $stmt->errno, $stmt->error);
+
+ $index = 0;
+ while ($stmt->fetch()) {
+ if ($data[$index] != $column1) {
+ printf("[011] Row %d, expecting %s/%s got %s/%s\n",
+ $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1);
+ }
+ var_dump($column1);
+ $index++;
+ }
+ $stmt->close();
+
+ if ($IS_MYSQLND) {
+ /* Advantage mysqlnd - see above... */
+ if (!($stmt = $link->prepare("SELECT 1 AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST(2 AS CHAR)")))
+ printf("[012] [%d] %s\n", $link->errno, $link->error);
+
+ $column1 = null;
+ if (!$stmt->bind_result($column1) || !$stmt->execute())
+ printf("[013] [%d] %s\n", $stmt->errno, $stmt->error);
+
+ $index = 0;
+ while ($stmt->fetch()) {
+ if ($data[$index] != $column1) {
+ printf("[014] Row %d, expecting %s/%s got %s/%s\n",
+ $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1);
+ }
+ $index++;
+ }
+ $stmt->close();
+ }
+
+ print "Using integer only...\n";
+ if (!($res = $link->query("SELECT 1 AS column1 UNION SELECT 303 UNION SELECT 2")))
+ printf("[015] [%d] %s\n", $link->errno, $link->error);
+
+ $data = array();
+ while ($row = $res->fetch_assoc()) {
+ $data[] = $row['column1'];
+ }
+ $res->free();
+
+ // Prepared Statements
+ if (!($stmt = $link->prepare("SELECT 1 AS column1 UNION SELECT 303 UNION SELECT 2")))
+ printf("[016] [%d] %s\n", $link->errno, $link->error);
+
+ $column1 = null;
+ if (!$stmt->execute() || !$stmt->bind_result($column1))
+ printf("[017] [%d] %s\n", $stmt->errno, $stmt->error);
+
+ $index = 0;
+ while ($stmt->fetch()) {
+ if ($data[$index] != $column1) {
+ printf("[018] Row %d, expecting %s/%s got %s/%s\n",
+ $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1);
+ }
+ var_dump($column1);
+ $index++;
+ }
+ $stmt->close();
+
+ if ($IS_MYSQLND) {
+ /* Advantage mysqlnd - see above */
+ if (!($stmt = $link->prepare("SELECT 1 AS column1 UNION SELECT 303 UNION SELECT 2")))
+ printf("[019] [%d] %s\n", $link->errno, $link->error);
+
+ $column1 = null;
+ if (!$stmt->bind_result($column1) || !$stmt->execute())
+ printf("[020] [%d] %s\n", $stmt->errno, $stmt->error);
+
+ $index = 0;
+ while ($stmt->fetch()) {
+ if ($data[$index] != $column1) {
+ printf("[021] Row %d, expecting %s/%s got %s/%s\n",
+ $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1);
+ }
+ $index++;
+ }
+ $stmt->close();
+ }
+
+ print "Testing bind_param(), strings only...\n";
+ $two = 'two';
+ $three = 'three';
+ if (!($stmt = $link->prepare("SELECT 'one' AS column1 UNION SELECT ? UNION SELECT ?")))
+ printf("[022] [%d] %s\n", $stmt->errno, $stmt->error);
+
+ $column1 = null;
+ if (!$stmt->bind_param('ss', $three, $two) || !$stmt->execute() || !$stmt->bind_result($column1))
+ printf("[023] [%d] %s\n", $stmt->errno, $stmt->error);
+
+ $index = 0;
+ $data = array();
+ while ($stmt->fetch()) {
+ $data[$index++] = $column1;
+ var_dump($column1);
+ }
+ $stmt->close();
+
+ if ($IS_MYSQLND) {
+ /* Advantage mysqlnd - see above */
+ $two = 'two';
+ $three = 'three';
+ if (!($stmt = $link->prepare("SELECT 'one' AS column1 UNION SELECT ? UNION SELECT ?")))
+ printf("[024] [%d] %s\n", $stmt->errno, $stmt->error);
+
+ $column1 = null;
+ if (!$stmt->bind_param('ss', $three, $two) || !$stmt->bind_result($column1) || !$stmt->execute())
+ printf("[025] [%d] %s\n", $stmt->errno, $stmt->error);
+
+ $index = 0;
+ while ($stmt->fetch()) {
+ if ($data[$index] != $column1) {
+ printf("[26] Row %d, expecting %s/%s, got %s/%s\n",
+ $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1);
+ }
+ $index++;
+ }
+ $stmt->close();
+ }
+
+ print "Testing bind_param(), strings only, with CAST AS CHAR...\n";
+ $two = 'two';
+ $three = 'three beers are more than enough';
+ if (!($stmt = $link->prepare("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST(? AS CHAR) UNION SELECT CAST(? AS CHAR)")))
+ printf("[027] [%d] %s\n", $stmt->errno, $stmt->error);
+
+ $column1 = null;
+ if (!$stmt->bind_param('ss', $three, $two) || !$stmt->execute() || !$stmt->bind_result($column1))
+ printf("[028] [%d] %s\n", $stmt->errno, $stmt->error);
+
+ $index = 0;
+ $data = array();
+ while ($stmt->fetch()) {
+ $data[$index++] = $column1;
+ var_dump($column1);
+ }
+ $stmt->close();
+
+ if ($IS_MYSQLND) {
+ /* Advantage mysqlnd - see above */
+ $two = 'two';
+ $three = 'three beers are more than enough';
+ if (!($stmt = $link->prepare("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST(? AS CHAR) UNION SELECT CAST(? AS CHAR)")))
+ printf("[029] [%d] %s\n", $stmt->errno, $stmt->error);
+
+ $column1 = null;
+ if (!$stmt->bind_param('ss', $three, $two) || !$stmt->bind_result($column1) || !$stmt->execute())
+ printf("[030] [%d] %s\n", $stmt->errno, $stmt->error);
+
+ $index = 0;
+ while ($stmt->fetch()) {
+ if ($data[$index] != $column1) {
+ printf("[31] Row %d, expecting %s/%s, got %s/%s\n",
+ $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1);
+ }
+ $index++;
+ }
+ $stmt->close();
+ }
+
+ $link->close();
+
+ print "done!";
?>
--EXPECT--
Using CAST('somestring' AS CHAR)...
diff --git a/ext/mysqli/tests/mysqli_query.phpt b/ext/mysqli/tests/mysqli_query.phpt
index 08145cddcf..ba159cf985 100644
--- a/ext/mysqli/tests/mysqli_query.phpt
+++ b/ext/mysqli/tests/mysqli_query.phpt
@@ -8,104 +8,95 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ require('table.inc');
- if (!is_null($tmp = @mysqli_query()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = @mysqli_query($link, '')))
+ printf("[002a] Expecting boolean/false got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_query($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_query($link, 'THIS IS NOT SQL')))
+ printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ if (false !== ($tmp = mysqli_query($link, "SELECT 'this is sql but with backslash g'\g")))
+ printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- if (false !== ($tmp = @mysqli_query($link, '')))
- printf("[002a] Expecting boolean/false got %s/%s\n", gettype($tmp), $tmp);
+ if ((0 === mysqli_errno($link)) || ('' == mysqli_error($link)))
+ printf("[006] mysqli_errno()/mysqli_error should return some error\n");
- if (NULL !== ($tmp = @mysqli_query($link, "SELECT 1 AS a", MYSQLI_USE_RESULT, "foo")))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!$res = mysqli_query($link, "SELECT 'this is sql but with semicolon' AS valid ; "))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (false !== ($tmp = mysqli_query($link, 'THIS IS NOT SQL')))
- printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
- if (false !== ($tmp = mysqli_query($link, "SELECT 'this is sql but with backslash g'\g")))
- printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ if (!$res = mysqli_query($link, "SELECT 'a' AS ''"))
+ printf("[007a] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if ((0 === mysqli_errno($link)) || ('' == mysqli_error($link)))
- printf("[006] mysqli_errno()/mysqli_error should return some error\n");
+ var_dump($tmp = mysqli_fetch_assoc($res));
+ var_dump($tmp[""]);
+ mysqli_free_result($res);
- if (!$res = mysqli_query($link, "SELECT 'this is sql but with semicolon' AS valid ; "))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (false !== ($res = mysqli_query($link, 'SELECT "this is sql but with semicolon" AS valid ; SHOW VARIABLES')))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
+ if (mysqli_get_server_version($link) > 50000) {
+ // let's try to play with stored procedures
+ mysqli_query($link, 'DROP PROCEDURE IF EXISTS p');
+ if (mysqli_query($link, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) BEGIN SELECT VERSION() INTO ver_param; END;')) {
+ $res = mysqli_query($link, 'CALL p(@version)');
+ $res = mysqli_query($link, 'SELECT @version AS p_version');
- if (!$res = mysqli_query($link, "SELECT 'a' AS ''"))
- printf("[007a] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ if (!is_array($tmp) || empty($tmp) || !isset($tmp['p_version']) || ('' == $tmp['p_version'])) {
+ printf("[008a] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ var_dump($tmp);
+ }
- var_dump($tmp = mysqli_fetch_assoc($res));
- var_dump($tmp[""]);
- mysqli_free_result($res);
+ mysqli_free_result($res);
+ } else {
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- if (false !== ($res = mysqli_query($link, 'SELECT "this is sql but with semicolon" AS valid ; SHOW VARIABLES')))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_query($link, 'DROP FUNCTION IF EXISTS f');
+ if (mysqli_query($link, 'CREATE FUNCTION f( ver_param VARCHAR(25)) RETURNS VARCHAR(25) DETERMINISTIC RETURN ver_param;')) {
+ $res = mysqli_query($link, 'SELECT f(VERSION()) AS f_version');
- if (mysqli_get_server_version($link) > 50000) {
- // let's try to play with stored procedures
- mysqli_query($link, 'DROP PROCEDURE IF EXISTS p');
- if (mysqli_query($link, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) BEGIN SELECT VERSION() INTO ver_param; END;')) {
- $res = mysqli_query($link, 'CALL p(@version)');
- $res = mysqli_query($link, 'SELECT @version AS p_version');
+ $tmp = mysqli_fetch_assoc($res);
+ if (!is_array($tmp) || empty($tmp) || !isset($tmp['f_version']) || ('' == $tmp['f_version'])) {
+ printf("[009a] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ var_dump($tmp);
+ }
- $tmp = mysqli_fetch_assoc($res);
- if (!is_array($tmp) || empty($tmp) || !isset($tmp['p_version']) || ('' == $tmp['p_version'])) {
- printf("[008a] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump($tmp);
- }
+ mysqli_free_result($res);
+ } else {
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ }
- mysqli_free_result($res);
- } else {
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ if (!is_object($res = mysqli_query($link, "SELECT id FROM test ORDER BY id", MYSQLI_USE_RESULT)))
+ printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_free_result($res);
- mysqli_query($link, 'DROP FUNCTION IF EXISTS f');
- if (mysqli_query($link, 'CREATE FUNCTION f( ver_param VARCHAR(25)) RETURNS VARCHAR(25) DETERMINISTIC RETURN ver_param;')) {
- $res = mysqli_query($link, 'SELECT f(VERSION()) AS f_version');
+ if (!is_object($res = mysqli_query($link, "SELECT id FROM test ORDER BY id", MYSQLI_STORE_RESULT)))
+ printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_free_result($res);
- $tmp = mysqli_fetch_assoc($res);
- if (!is_array($tmp) || empty($tmp) || !isset($tmp['f_version']) || ('' == $tmp['f_version'])) {
- printf("[009a] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump($tmp);
- }
+ if (false !== ($res = @mysqli_query($link, "SELECT id FROM test ORDER BY id", 1234)))
+ printf("[013] Invalid mode should return false got %s/%s, [%d] %s\n",
+ gettype($res), (is_object($res)) ? 'object' : $res,
+ mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
- } else {
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- }
- if (!is_object($res = mysqli_query($link, "SELECT id FROM test ORDER BY id", MYSQLI_USE_RESULT)))
- printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
+ mysqli_close($link);
- if (!is_object($res = mysqli_query($link, "SELECT id FROM test ORDER BY id", MYSQLI_STORE_RESULT)))
- printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
+ try {
+ mysqli_query($link, "SELECT id FROM test");
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- if (false !== ($res = @mysqli_query($link, "SELECT id FROM test ORDER BY id", 1234)))
- printf("[013] Invalid mode should return false got %s/%s, [%d] %s\n",
- gettype($res), (is_object($res)) ? 'object' : $res,
- mysqli_errno($link), mysqli_error($link));
-
-
- mysqli_close($link);
-
- if (false !== ($tmp = mysqli_query($link, "SELECT id FROM test")))
- printf("[011] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
@@ -121,7 +112,7 @@ if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
mysqli_close($link);
?>
---EXPECTF--
+--EXPECT--
array(1) {
["valid"]=>
string(30) "this is sql but with semicolon"
@@ -131,6 +122,5 @@ array(1) {
string(1) "a"
}
string(1) "a"
-
-Warning: mysqli_query(): Couldn't fetch mysqli in %s on line %d
+mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_query_iterators.phpt b/ext/mysqli/tests/mysqli_query_iterators.phpt
index 81ca8c0fae..199cddbcc5 100644
--- a/ext/mysqli/tests/mysqli_query_iterators.phpt
+++ b/ext/mysqli/tests/mysqli_query_iterators.phpt
@@ -8,60 +8,65 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- require('table.inc');
+ require('table.inc');
- echo "--- Testing default ---\n";
- if (!is_object($res = mysqli_query($link, "SELECT id FROM test ORDER BY id")))
- printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- else {
- foreach ($res as $row) {
- var_dump($row);
- }
- echo "======\n";
- foreach ($res as $row) {
- var_dump($row);
- }
- mysqli_free_result($res);
- foreach ($res as $row) {
- var_dump($row);
- }
- }
- echo "--- Testing USE_RESULT ---\n";
- if (!is_object($res = mysqli_query($link, "SELECT id FROM test ORDER BY id", MYSQLI_USE_RESULT)))
- printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- else {
- foreach ($res as $row) {
- var_dump($row);
- }
- echo "======\n";
- foreach ($res as $row) {
- var_dump($row);
- }
- mysqli_free_result($res);
- }
+ echo "--- Testing default ---\n";
+ if (!is_object($res = mysqli_query($link, "SELECT id FROM test ORDER BY id")))
+ printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ else {
+ foreach ($res as $row) {
+ var_dump($row);
+ }
+ echo "======\n";
- echo "--- Testing STORE_RESULT ---\n";
- if (!is_object($res = mysqli_query($link, "SELECT id FROM test ORDER BY id", MYSQLI_STORE_RESULT)))
- printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- else {
- foreach ($res as $row) {
- var_dump($row);
- }
- echo "======\n";
- foreach ($res as $row) {
- var_dump($row);
- }
- mysqli_free_result($res);
- }
+ foreach ($res as $row) {
+ var_dump($row);
+ }
+ mysqli_free_result($res);
+ try {
+ foreach ($res as $row) {
+ $row;
+ }
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+ }
+ echo "--- Testing USE_RESULT ---\n";
+ if (!is_object($res = mysqli_query($link, "SELECT id FROM test ORDER BY id", MYSQLI_USE_RESULT)))
+ printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ else {
+ foreach ($res as $row) {
+ var_dump($row);
+ }
+ echo "======\n";
+ foreach ($res as $row) {
+ var_dump($row);
+ }
+ mysqli_free_result($res);
+ }
- mysqli_close($link);
+ echo "--- Testing STORE_RESULT ---\n";
+ if (!is_object($res = mysqli_query($link, "SELECT id FROM test ORDER BY id", MYSQLI_STORE_RESULT)))
+ printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ else {
+ foreach ($res as $row) {
+ var_dump($row);
+ }
+ echo "======\n";
+ foreach ($res as $row) {
+ var_dump($row);
+ }
+ mysqli_free_result($res);
+ }
- print "done!";
+ mysqli_close($link);
+
+ print "done!";
?>
--CLEAN--
<?php
@@ -118,8 +123,7 @@ array(1) {
["id"]=>
string(1) "6"
}
-
-Warning: main(): Couldn't fetch mysqli_result in %s on line %d
+mysqli_result object is already closed
--- Testing USE_RESULT ---
array(1) {
["id"]=>
diff --git a/ext/mysqli/tests/mysqli_query_stored_proc.phpt b/ext/mysqli/tests/mysqli_query_stored_proc.phpt
index aad39cd94d..4a77ac91c8 100644
--- a/ext/mysqli/tests/mysqli_query_stored_proc.phpt
+++ b/ext/mysqli/tests/mysqli_query_stored_proc.phpt
@@ -14,141 +14,141 @@ if (mysqli_get_server_version($link) <= 50000) {
?>
--FILE--
<?php
- require_once('connect.inc');
- require_once('table.inc');
+ require_once('connect.inc');
+ require_once('table.inc');
- if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
- printf("[001] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
+ printf("[001] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
- if (mysqli_query($link, 'CREATE PROCEDURE p() READS SQL DATA BEGIN SELECT id, label FROM test ORDER BY id ASC;
+ if (mysqli_query($link, 'CREATE PROCEDURE p() READS SQL DATA BEGIN SELECT id, label FROM test ORDER BY id ASC;
END;')) {
- /* stored proc which returns one result set */
- if (mysqli_multi_query($link, 'CALL p()')) {
- do {
- if ($res = mysqli_use_result($link)) {
- // skip results, don't fetch all from server
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
- }
- } while (mysqli_more_results($link) && mysqli_next_result($link));
-
- } else {
- printf("[003] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
-
- if (mysqli_multi_query($link, 'CALL p()')) {
- do {
- if ($res = mysqli_store_result($link)) {
- // fetch all results from server, but skip on client side
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
- }
- } while (mysqli_more_results($link) && mysqli_next_result($link));
-
- } else {
- printf("[004] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
-
- if (mysqli_multi_query($link, 'CALL p()')) {
- do {
- if ($res = mysqli_store_result($link)) {
- // fetch all results from server, but skip on client side
- var_dump(mysqli_fetch_assoc($res));
- while (mysqli_fetch_assoc($res))
- ;
- mysqli_free_result($res);
- }
- } while (mysqli_more_results($link) && mysqli_next_result($link));
-
- } else {
- printf("[005] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
-
- } else {
- printf("[002] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
- }
-
- if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
- printf("[006] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
-
- if (mysqli_query($link, 'CREATE PROCEDURE p() READS SQL DATA BEGIN SELECT id, label FROM test ORDER BY id ASC; SELECT id FROM test ORDER BY id ASC; END;')) {
- /* stored proc which returns two result sets */
-
- if (mysqli_multi_query($link, 'CALL p()')) {
- do {
- if ($res = mysqli_store_result($link)) {
- // fetch all results from server, but skip on client side
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
- }
- } while (mysqli_more_results($link) && mysqli_next_result($link));
-
- } else {
- printf("[008] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
-
- } else {
- printf("[007] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
- }
-
- if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
- printf("[009] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
-
- if (mysqli_real_query($link, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) BEGIN SELECT VERSION() INTO ver_param; END;')) {
- /* no result set, just output parameter */
- if (!mysqli_query($link, 'CALL p(@version)'))
- printf("[011] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_query($link, "SET @version = 'unknown'"))
- printf("[012] Cannot reset user variable, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_query($link, 'CALL p(@version)'))
- printf("[013] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!$res = mysqli_query($link, 'SELECT @version as _vers'))
- printf("[014] Cannot fetch user variable, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!$row = mysqli_fetch_assoc($res) ||
- $row['_vers'] == 'unknown')
- printf("[015] Results seem wrong, got %s, [%d] %s\n",
- $row['_vers'],
- mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
-
- } else {
- printf("[010] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
- }
-
- if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
- printf("[016] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
-
- if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25), OUT ver_out VARCHAR(25)) BEGIN SELECT ver_in INTO ver_out; END;')) {
- /* no result set, one input, one output parameter */
- if (!mysqli_query($link, "CALL p('myversion', @version)"))
- printf("[018] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_query($link, "SET @version = 'unknown'"))
- printf("[019] Cannot reset user variable, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_query($link, "CALL p('myversion', @version)"))
- printf("[020] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!$res = mysqli_query($link, 'SELECT @version as _vers'))
- printf("[021] Cannot fetch user variable, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!$row = mysqli_fetch_assoc($res) ||
- $row['_vers'] == 'myversion')
- printf("[022] Results seem wrong, got %s, [%d] %s\n",
- $row['_vers'],
- mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
-
- } else {
- printf("[017] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
- }
-
- mysqli_close($link);
- print "done!";
+ /* stored proc which returns one result set */
+ if (mysqli_multi_query($link, 'CALL p()')) {
+ do {
+ if ($res = mysqli_use_result($link)) {
+ // skip results, don't fetch all from server
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
+ }
+ } while (mysqli_more_results($link) && mysqli_next_result($link));
+
+ } else {
+ printf("[003] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ if (mysqli_multi_query($link, 'CALL p()')) {
+ do {
+ if ($res = mysqli_store_result($link)) {
+ // fetch all results from server, but skip on client side
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
+ }
+ } while (mysqli_more_results($link) && mysqli_next_result($link));
+
+ } else {
+ printf("[004] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ if (mysqli_multi_query($link, 'CALL p()')) {
+ do {
+ if ($res = mysqli_store_result($link)) {
+ // fetch all results from server, but skip on client side
+ var_dump(mysqli_fetch_assoc($res));
+ while (mysqli_fetch_assoc($res))
+ ;
+ mysqli_free_result($res);
+ }
+ } while (mysqli_more_results($link) && mysqli_next_result($link));
+
+ } else {
+ printf("[005] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ } else {
+ printf("[002] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
+ printf("[006] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+
+ if (mysqli_query($link, 'CREATE PROCEDURE p() READS SQL DATA BEGIN SELECT id, label FROM test ORDER BY id ASC; SELECT id FROM test ORDER BY id ASC; END;')) {
+ /* stored proc which returns two result sets */
+
+ if (mysqli_multi_query($link, 'CALL p()')) {
+ do {
+ if ($res = mysqli_store_result($link)) {
+ // fetch all results from server, but skip on client side
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
+ }
+ } while (mysqli_more_results($link) && mysqli_next_result($link));
+
+ } else {
+ printf("[008] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ } else {
+ printf("[007] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
+ printf("[009] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+
+ if (mysqli_real_query($link, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) BEGIN SELECT VERSION() INTO ver_param; END;')) {
+ /* no result set, just output parameter */
+ if (!mysqli_query($link, 'CALL p(@version)'))
+ printf("[011] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_query($link, "SET @version = 'unknown'"))
+ printf("[012] Cannot reset user variable, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_query($link, 'CALL p(@version)'))
+ printf("[013] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!$res = mysqli_query($link, 'SELECT @version as _vers'))
+ printf("[014] Cannot fetch user variable, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!$row = mysqli_fetch_assoc($res) ||
+ $row['_vers'] == 'unknown')
+ printf("[015] Results seem wrong, got %s, [%d] %s\n",
+ $row['_vers'],
+ mysqli_errno($link), mysqli_error($link));
+ mysqli_free_result($res);
+
+ } else {
+ printf("[010] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
+ printf("[016] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+
+ if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25), OUT ver_out VARCHAR(25)) BEGIN SELECT ver_in INTO ver_out; END;')) {
+ /* no result set, one input, one output parameter */
+ if (!mysqli_query($link, "CALL p('myversion', @version)"))
+ printf("[018] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_query($link, "SET @version = 'unknown'"))
+ printf("[019] Cannot reset user variable, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_query($link, "CALL p('myversion', @version)"))
+ printf("[020] Cannot call SP, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!$res = mysqli_query($link, 'SELECT @version as _vers'))
+ printf("[021] Cannot fetch user variable, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!$row = mysqli_fetch_assoc($res) ||
+ $row['_vers'] == 'myversion')
+ printf("[022] Results seem wrong, got %s, [%d] %s\n",
+ $row['_vers'],
+ mysqli_errno($link), mysqli_error($link));
+ mysqli_free_result($res);
+
+ } else {
+ printf("[017] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_query_unicode.phpt b/ext/mysqli/tests/mysqli_query_unicode.phpt
index 819a849d94..0cec3b398a 100644
--- a/ext/mysqli/tests/mysqli_query_unicode.phpt
+++ b/ext/mysqli/tests/mysqli_query_unicode.phpt
@@ -14,89 +14,79 @@ mysqli_close($link);
?>
--FILE--
<?php
- include_once("connect.inc");
+ include_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ require_once('table.inc');
- if (!is_null($tmp = @mysqli_query()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (TRUE !== ($tmp = @mysqli_query($link, "set names utf8")))
+ printf("[002.5] Expecting TRUE, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_query($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_query($link, 'това не е еÑкюел')))
+ printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- require_once('table.inc');
+ if (false !== ($tmp = mysqli_query($link, "SELECT 'това е еÑкюел, но ÑÑŠÑ Ð¾Ð±Ñ€Ð°Ñ‚Ð½Ð° наклонена и g'\g")))
+ printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- if (TRUE !== ($tmp = @mysqli_query($link, "set names utf8")))
- printf("[002.5] Expecting TRUE, got %s/%s\n", gettype($tmp), $tmp);
+ if ((0 === mysqli_errno($link)) || ('' == mysqli_error($link)))
+ printf("[006] mysqli_errno()/mysqli_error should return some error\n");
- if (NULL !== ($tmp = @mysqli_query($link, "SELECT 1 AS колона", MYSQLI_USE_RESULT, "foo")))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!$res = mysqli_query($link, "SELECT 'това еÑкюел, но Ñ Ñ‚Ð¾Ñ‡ÐºÐ° и запетаÑ' AS правилен ; "))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (false !== ($tmp = mysqli_query($link, 'това не е еÑкюел')))
- printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
- if (false !== ($tmp = mysqli_query($link, "SELECT 'това е еÑкюел, но ÑÑŠÑ Ð¾Ð±Ñ€Ð°Ñ‚Ð½Ð° наклонена и g'\g")))
- printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($res = mysqli_query($link, "SELECT 'това еÑкюел, но Ñ Ñ‚Ð¾Ñ‡ÐºÐ° и запетаÑ' AS правилен ; SHOW VARIABLES")))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if ((0 === mysqli_errno($link)) || ('' == mysqli_error($link)))
- printf("[006] mysqli_errno()/mysqli_error should return some error\n");
+ if (mysqli_get_server_version($link) > 50000) {
+ // let's try to play with stored procedures
+ mysqli_query($link, 'DROP PROCEDURE IF EXISTS процедурка');
+ if (mysqli_query($link, 'CREATE PROCEDURE процедурка(OUT верÑÐ¸Ñ VARCHAR(25)) BEGIN SELECT VERSION() INTO верÑиÑ; END;')) {
+ $res = mysqli_query($link, 'CALL процедурка(@version)');
+ $res = mysqli_query($link, 'SELECT @version AS п_верÑиÑ');
- if (!$res = mysqli_query($link, "SELECT 'това еÑкюел, но Ñ Ñ‚Ð¾Ñ‡ÐºÐ° и запетаÑ' AS правилен ; "))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ if (!is_array($tmp) || empty($tmp) || !isset($tmp['п_верÑиÑ']) || ('' == $tmp['п_верÑиÑ'])) {
+ printf("[008a] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ var_dump($tmp);
+ }
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
+ mysqli_free_result($res);
+ } else {
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- if (false !== ($res = mysqli_query($link, "SELECT 'това еÑкюел, но Ñ Ñ‚Ð¾Ñ‡ÐºÐ° и запетаÑ' AS правилен ; SHOW VARIABLES")))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_query($link, 'DROP FUNCTION IF EXISTS функцийка');
+ if (mysqli_query($link, 'CREATE FUNCTION функцийка( параметър_верÑÐ¸Ñ VARCHAR(25)) RETURNS VARCHAR(25) DETERMINISTIC RETURN параметър_верÑиÑ;')) {
+ $res = mysqli_query($link, 'SELECT функцийка(VERSION()) AS Ñ„_верÑиÑ');
- if (mysqli_get_server_version($link) > 50000) {
- // let's try to play with stored procedures
- mysqli_query($link, 'DROP PROCEDURE IF EXISTS процедурка');
- if (mysqli_query($link, 'CREATE PROCEDURE процедурка(OUT верÑÐ¸Ñ VARCHAR(25)) BEGIN SELECT VERSION() INTO верÑиÑ; END;')) {
- $res = mysqli_query($link, 'CALL процедурка(@version)');
- $res = mysqli_query($link, 'SELECT @version AS п_верÑиÑ');
+ $tmp = mysqli_fetch_assoc($res);
+ if (!is_array($tmp) || empty($tmp) || !isset($tmp['Ñ„_верÑиÑ']) || ('' == $tmp['Ñ„_верÑиÑ'])) {
+ printf("[009a] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ var_dump($tmp);
+ }
- $tmp = mysqli_fetch_assoc($res);
- if (!is_array($tmp) || empty($tmp) || !isset($tmp['п_верÑиÑ']) || ('' == $tmp['п_верÑиÑ'])) {
- printf("[008a] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump($tmp);
- }
+ mysqli_free_result($res);
+ } else {
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ }
- mysqli_free_result($res);
- } else {
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ mysqli_close($link);
- mysqli_query($link, 'DROP FUNCTION IF EXISTS функцийка');
- if (mysqli_query($link, 'CREATE FUNCTION функцийка( параметър_верÑÐ¸Ñ VARCHAR(25)) RETURNS VARCHAR(25) DETERMINISTIC RETURN параметър_верÑиÑ;')) {
- $res = mysqli_query($link, 'SELECT функцийка(VERSION()) AS Ñ„_верÑиÑ');
+ try {
+ mysqli_query($link, "SELECT id FROM test");
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- $tmp = mysqli_fetch_assoc($res);
- if (!is_array($tmp) || empty($tmp) || !isset($tmp['Ñ„_верÑиÑ']) || ('' == $tmp['Ñ„_верÑиÑ'])) {
- printf("[009a] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump($tmp);
- }
-
- mysqli_free_result($res);
- } else {
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- }
-
- mysqli_close($link);
-
- if (false !== ($tmp = mysqli_query($link, "SELECT id FROM test")))
- printf("[014] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!";
+ print "done!";
?>
--EXPECTF--
array(1) {
["правилен"]=>
string(%d) "това еÑкюел, но Ñ Ñ‚Ð¾Ñ‡ÐºÐ° и запетаÑ"
}
-
-Warning: mysqli_query(): Couldn't fetch mysqli in %s on line %d
+mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_real_connect.phpt b/ext/mysqli/tests/mysqli_real_connect.phpt
index 2e39833ffe..05aeca1f6f 100644
--- a/ext/mysqli/tests/mysqli_real_connect.phpt
+++ b/ext/mysqli/tests/mysqli_real_connect.phpt
@@ -10,167 +10,143 @@ require_once('skipifconnectfailure.inc');
mysqli.allow_local_infile=1
--FILE--
<?php
- include("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
-
- if (NULL !== ($tmp = @mysqli_real_connect($link)))
- printf("[001a] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (NULL !== ($tmp = @mysqli_real_connect($link, $link)))
- printf("[001b] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (NULL !== ($tmp = @mysqli_real_connect($link, $link, $link)))
- printf("[001c] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (NULL !== ($tmp = @mysqli_real_connect($link, $link, $link, $link)))
- printf("[001d] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (NULL !== ($tmp = @mysqli_real_connect($link, $link, $link, $link, $link)))
- printf("[001e] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (NULL !== ($tmp = @mysqli_real_connect($link, $link, $link, $link, $link, $link)))
- printf("[001f] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (NULL !== ($tmp = @mysqli_real_connect($link, $link, $link, $link, $link, $link, $link)))
- printf("[001g] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- // ( mysqli link [, string hostname [, string username [, string passwd [, string dbname [, int port [, string socket [, int flags]]]]]]]
- if (NULL !== ($tmp = @mysqli_real_connect($link, $link, $link, $link, $link, $link, $link, $link)))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!$link = mysqli_init())
- printf("[002] mysqli_init() failed\n");
-
- if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))
- printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
-
- mysqli_close($link);
- if (!$link = mysqli_init())
- printf("[004] mysqli_init() failed\n");
-
- if (false !== ($tmp = mysqli_real_connect($link, $host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket)))
- printf("[005] Expecting boolean/false got %s/%s. Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n", gettype($tmp), $tmp, $host, $user . 'unknown_really', $db, $port, $socket);
-
- // Run the following tests without an anoynmous MySQL user and use a password for the test user!
- ini_set('mysqli.default_socket', $socket);
- if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port)) {
- printf("[006] Usage of mysqli.default_socket failed\n");
- } else {
- mysqli_close($link);
- if (!$link = mysqli_init())
- printf("[007] mysqli_init() failed\n");
- }
-
- ini_set('mysqli.default_port', $port);
- if (!mysqli_real_connect($link, $host, $user, $passwd, $db)) {
- printf("[008] Usage of mysqli.default_port failed\n");
- } else {
- mysqli_close($link);
- if (!$link = mysqli_init())
- printf("[009] mysqli_init() failed\n");
- }
-
- ini_set('mysqli.default_pw', $passwd);
- if (!mysqli_real_connect($link, $host, $user)) {
- printf("[010] Usage of mysqli.default_pw failed\n") ;
- } else {
- mysqli_close($link);
- if (!$link = mysqli_init())
- printf("[011] mysqli_init() failed\n");
- }
-
- ini_set('mysqli.default_user', $user);
- if (!mysqli_real_connect($link, $host)) {
- printf("[012] Usage of mysqli.default_user failed\n") ;
- } else {
- mysqli_close($link);
- if (!$link = mysqli_init())
- printf("[011] mysqli_init() failed\n");
- }
-
- ini_set('mysqli.default_host', $host);
- if (!mysqli_real_connect($link)) {
- printf("[014] Usage of mysqli.default_host failed\n") ;
- } else {
- mysqli_close($link);
- if (!$link = mysqli_init())
- printf("[015] mysqli_init() failed\n");
- }
-
- // CLIENT_MULTI_STATEMENTS - should be disabled silently
- if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, 65536))
- printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if ($res = mysqli_query($link, "SELECT 1 AS a; SELECT 2 AS b")) {
- printf("[017] Should have failed. CLIENT_MULTI_STATEMENT should have been disabled.\n");
- var_dump($res->num_rows);
- mysqli_next_result($link);
- $res = mysqli_store_result($link);
- var_dump($res->num_rows);
- }
-
-
- mysqli_close($link);
- if (!$link = mysqli_init())
- printf("[018] mysqli_init() failed\n");
-
- if (ini_get('open_basedir')) {
- // CLIENT_LOCAL_FILES should be blocked - but how to test it ?!
-
- if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, 128))
- printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- $filename = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'mysqli_real_connect_phpt';
- if (!$fp = fopen($filename, 'w'))
- printf("[020] Cannot open temporary file %s\n", $filename);
-
- fwrite($fp, '100;z');
- fclose($fp);
-
- // how do we test if gets forbidden because of a missing right or the flag, this test is partly bogus ?
- if (mysqli_query($link, "LOAD DATA LOCAL INFILE '$filename' INTO TABLE test FIELDS TERMINATED BY ';'"))
- printf("[021] LOAD DATA INFILE should have been forbidden!\n");
-
- unlink($filename);
- }
-
- mysqli_close($link);
- var_dump($link);
-
- if ($IS_MYSQLND) {
- ini_set('mysqli.default_host', 'p:' . $host);
- $link = mysqli_init();
- if (!@mysqli_real_connect($link)) {
- printf("[022] Usage of mysqli.default_host=p:%s (persistent) failed\n", $host) ;
- } else {
- if (!$res = mysqli_query($link, "SELECT 'mysqli.default_host (persistent)' AS 'testing'"))
- printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- if ($tmp['testing'] !== 'mysqli.default_host (persistent)') {
- printf("[024] Result looks strange - check manually, [%d] %s\n",
- mysqli_errno($link), mysqli_error($link));
- var_dump($tmp);
- }
- mysqli_free_result($res);
- mysqli_close($link);
- }
-
- ini_set('mysqli.default_host', 'p:');
- $link = mysqli_init();
- if (@mysqli_real_connect($link)) {
- printf("[025] Usage of mysqli.default_host=p: did not fail\n") ;
- mysqli_close($link);
- }
- @mysqli_close($link);
- }
-
- if (false !== ($tmp = mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)))
- printf("[026] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!";
+ include("connect.inc");
+
+ // ( mysqli link [, string hostname [, string username [, string passwd [, string dbname [, int port [, string socket [, int flags]]]]]]]
+ if (!$link = mysqli_init())
+ printf("[002] mysqli_init() failed\n");
+
+ if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))
+ printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+
+ mysqli_close($link);
+ if (!$link = mysqli_init())
+ printf("[004] mysqli_init() failed\n");
+
+ if (false !== ($tmp = mysqli_real_connect($link, $host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket)))
+ printf("[005] Expecting boolean/false got %s/%s. Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n", gettype($tmp), $tmp, $host, $user . 'unknown_really', $db, $port, $socket);
+
+ // Run the following tests without an anoynmous MySQL user and use a password for the test user!
+ ini_set('mysqli.default_socket', $socket);
+ if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port)) {
+ printf("[006] Usage of mysqli.default_socket failed\n");
+ } else {
+ mysqli_close($link);
+ if (!$link = mysqli_init())
+ printf("[007] mysqli_init() failed\n");
+ }
+
+ ini_set('mysqli.default_port', $port);
+ if (!mysqli_real_connect($link, $host, $user, $passwd, $db)) {
+ printf("[008] Usage of mysqli.default_port failed\n");
+ } else {
+ mysqli_close($link);
+ if (!$link = mysqli_init())
+ printf("[009] mysqli_init() failed\n");
+ }
+
+ ini_set('mysqli.default_pw', $passwd);
+ if (!mysqli_real_connect($link, $host, $user)) {
+ printf("[010] Usage of mysqli.default_pw failed\n") ;
+ } else {
+ mysqli_close($link);
+ if (!$link = mysqli_init())
+ printf("[011] mysqli_init() failed\n");
+ }
+
+ ini_set('mysqli.default_user', $user);
+ if (!mysqli_real_connect($link, $host)) {
+ printf("[012] Usage of mysqli.default_user failed\n") ;
+ } else {
+ mysqli_close($link);
+ if (!$link = mysqli_init())
+ printf("[011] mysqli_init() failed\n");
+ }
+
+ ini_set('mysqli.default_host', $host);
+ if (!mysqli_real_connect($link)) {
+ printf("[014] Usage of mysqli.default_host failed\n") ;
+ } else {
+ mysqli_close($link);
+ if (!$link = mysqli_init())
+ printf("[015] mysqli_init() failed\n");
+ }
+
+ // CLIENT_MULTI_STATEMENTS - should be disabled silently
+ if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, 65536))
+ printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if ($res = mysqli_query($link, "SELECT 1 AS a; SELECT 2 AS b")) {
+ printf("[017] Should have failed. CLIENT_MULTI_STATEMENT should have been disabled.\n");
+ var_dump($res->num_rows);
+ mysqli_next_result($link);
+ $res = mysqli_store_result($link);
+ var_dump($res->num_rows);
+ }
+
+
+ mysqli_close($link);
+ if (!$link = mysqli_init())
+ printf("[018] mysqli_init() failed\n");
+
+ if (ini_get('open_basedir')) {
+ // CLIENT_LOCAL_FILES should be blocked - but how to test it ?!
+
+ if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, 128))
+ printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ $filename = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'mysqli_real_connect_phpt';
+ if (!$fp = fopen($filename, 'w'))
+ printf("[020] Cannot open temporary file %s\n", $filename);
+
+ fwrite($fp, '100;z');
+ fclose($fp);
+
+ // how do we test if gets forbidden because of a missing right or the flag, this test is partly bogus ?
+ if (mysqli_query($link, "LOAD DATA LOCAL INFILE '$filename' INTO TABLE test FIELDS TERMINATED BY ';'"))
+ printf("[021] LOAD DATA INFILE should have been forbidden!\n");
+
+ unlink($filename);
+ }
+
+ mysqli_close($link);
+ var_dump($link);
+
+ if ($IS_MYSQLND) {
+ ini_set('mysqli.default_host', 'p:' . $host);
+ $link = mysqli_init();
+ if (!@mysqli_real_connect($link)) {
+ printf("[022] Usage of mysqli.default_host=p:%s (persistent) failed\n", $host) ;
+ } else {
+ if (!$res = mysqli_query($link, "SELECT 'mysqli.default_host (persistent)' AS 'testing'"))
+ printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ if ($tmp['testing'] !== 'mysqli.default_host (persistent)') {
+ printf("[024] Result looks strange - check manually, [%d] %s\n",
+ mysqli_errno($link), mysqli_error($link));
+ var_dump($tmp);
+ }
+ mysqli_free_result($res);
+ mysqli_close($link);
+ }
+
+ ini_set('mysqli.default_host', 'p:');
+ $link = mysqli_init();
+ if (@mysqli_real_connect($link)) {
+ printf("[025] Usage of mysqli.default_host=p: did not fail\n") ;
+ mysqli_close($link);
+ }
+ @mysqli_close($link);
+ }
+
+ try {
+ mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ print "done!";
?>
--CLEAN--
<?php
@@ -186,6 +162,5 @@ object(mysqli)#%d (%d) {
["connect_error"]=>
NULL
}
-
-Warning: mysqli_real_connect(): Couldn't fetch mysqli in %s on line %d
+mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_real_connect_pconn.phpt b/ext/mysqli/tests/mysqli_real_connect_pconn.phpt
index 0d1c4985f2..121504a8fd 100644
--- a/ext/mysqli/tests/mysqli_real_connect_pconn.phpt
+++ b/ext/mysqli/tests/mysqli_real_connect_pconn.phpt
@@ -15,137 +15,137 @@ mysqli.allow_persistent=1
mysqli.max_persistent=10
--FILE--
<?php
- require_once("connect.inc");
- $host = 'p:' . $host;
-
- if (!$link = mysqli_init())
- printf("[002] mysqli_init() failed\n");
-
- if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))
- printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
-
- mysqli_close($link);
- if (!$link = mysqli_init())
- printf("[004] mysqli_init() failed\n");
-
- if (false !== ($tmp = mysqli_real_connect($link, $host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket)))
- printf("[005] Expecting boolean/false got %s/%s. Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n", gettype($tmp), $tmp, $host, $user . 'unknown_really', $db, $port, $socket);
-
- // Run the following tests without an anoynmous MySQL user and use a password for the test user!
- ini_set('mysqli.default_socket', $socket);
- if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port)) {
- printf("[006] Usage of mysqli.default_socket failed\n");
- } else {
- mysqli_close($link);
- if (!$link = mysqli_init())
- printf("[007] mysqli_init() failed\n");
- }
-
- ini_set('mysqli.default_port', $port);
- if (!mysqli_real_connect($link, $host, $user, $passwd, $db)) {
- printf("[008] Usage of mysqli.default_port failed\n");
- } else {
- mysqli_close($link);
- if (!$link = mysqli_init())
- printf("[009] mysqli_init() failed\n");
- }
-
- ini_set('mysqli.default_pw', $passwd);
- if (!mysqli_real_connect($link, $host, $user)) {
- printf("[010] Usage of mysqli.default_pw failed\n") ;
- } else {
- mysqli_close($link);
- if (!$link = mysqli_init())
- printf("[011] mysqli_init() failed\n");
- }
-
- ini_set('mysqli.default_user', $user);
- if (!mysqli_real_connect($link, $host)) {
- printf("[012] Usage of mysqli.default_user failed\n") ;
- } else {
- mysqli_close($link);
- if (!$link = mysqli_init())
- printf("[011] mysqli_init() failed\n");
- }
-
- ini_set('mysqli.default_host', $host);
- if (!mysqli_real_connect($link)) {
- printf("[014] Usage of mysqli.default_host failed\n") ;
- } else {
- mysqli_close($link);
- if (!$link = mysqli_init())
- printf("[015] mysqli_init() failed\n");
- }
-
- // CLIENT_MULTI_STATEMENTS - should be disabled silently
- if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, 65536))
- printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if ($res = mysqli_query($link, "SELECT 1 AS a; SELECT 2 AS b")) {
- printf("[017] Should have failed. CLIENT_MULTI_STATEMENT should have been disabled.\n");
- var_dump($res->num_rows);
- mysqli_next_result($link);
- $res = mysqli_store_result($link);
- var_dump($res->num_rows);
- }
-
-
- mysqli_close($link);
- if (!$link = mysqli_init())
- printf("[018] mysqli_init() failed\n");
-
- if (ini_get('open_basedir')) {
- // CLIENT_LOCAL_FILES should be blocked - but how to test it ?!
-
- if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, 128))
- printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- $filename = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'mysqli_real_connect_phpt';
- if (!$fp = fopen($filename, 'w'))
- printf("[020] Cannot open temporary file %s\n", $filename);
-
- fwrite($fp, '100;z');
- fclose($fp);
-
- // how do we test if gets forbidden because of a missing right or the flag, this test is partly bogus ?
- if (mysqli_query($link, "LOAD DATA LOCAL INFILE '$filename' INTO TABLE test FIELDS TERMINATED BY ';'"))
- printf("[021] LOAD DATA INFILE should have been forbidden!\n");
-
- unlink($filename);
- }
-
- mysqli_close($link);
-
- if ($IS_MYSQLND) {
- $link = mysqli_init();
- if (!@mysqli_real_connect($link)) {
- printf("[022] Usage of mysqli.default_host=p:%s (persistent) failed\n", $host) ;
- } else {
- if (!$res = mysqli_query($link, "SELECT 'mysqli.default_host (persistent)' AS 'testing'"))
- printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- if ($tmp['testing'] !== 'mysqli.default_host (persistent)') {
- printf("[024] Result looks strange - check manually, [%d] %s\n",
- mysqli_errno($link), mysqli_error($link));
- var_dump($tmp);
- }
- mysqli_free_result($res);
- mysqli_close($link);
- }
-
- ini_set('mysqli.default_host', 'p:');
- $link = mysqli_init();
- if (@mysqli_real_connect($link)) {
- printf("[025] Usage of mysqli.default_host=p: did not fail\n") ;
- mysqli_close($link);
- }
- }
-
- if (NULL === ($tmp = mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)))
- printf("[026] Expecting not NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!";
+ require_once("connect.inc");
+ $host = 'p:' . $host;
+
+ if (!$link = mysqli_init())
+ printf("[002] mysqli_init() failed\n");
+
+ if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))
+ printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+
+ mysqli_close($link);
+ if (!$link = mysqli_init())
+ printf("[004] mysqli_init() failed\n");
+
+ if (false !== ($tmp = mysqli_real_connect($link, $host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket)))
+ printf("[005] Expecting boolean/false got %s/%s. Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n", gettype($tmp), $tmp, $host, $user . 'unknown_really', $db, $port, $socket);
+
+ // Run the following tests without an anoynmous MySQL user and use a password for the test user!
+ ini_set('mysqli.default_socket', $socket);
+ if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port)) {
+ printf("[006] Usage of mysqli.default_socket failed\n");
+ } else {
+ mysqli_close($link);
+ if (!$link = mysqli_init())
+ printf("[007] mysqli_init() failed\n");
+ }
+
+ ini_set('mysqli.default_port', $port);
+ if (!mysqli_real_connect($link, $host, $user, $passwd, $db)) {
+ printf("[008] Usage of mysqli.default_port failed\n");
+ } else {
+ mysqli_close($link);
+ if (!$link = mysqli_init())
+ printf("[009] mysqli_init() failed\n");
+ }
+
+ ini_set('mysqli.default_pw', $passwd);
+ if (!mysqli_real_connect($link, $host, $user)) {
+ printf("[010] Usage of mysqli.default_pw failed\n") ;
+ } else {
+ mysqli_close($link);
+ if (!$link = mysqli_init())
+ printf("[011] mysqli_init() failed\n");
+ }
+
+ ini_set('mysqli.default_user', $user);
+ if (!mysqli_real_connect($link, $host)) {
+ printf("[012] Usage of mysqli.default_user failed\n") ;
+ } else {
+ mysqli_close($link);
+ if (!$link = mysqli_init())
+ printf("[011] mysqli_init() failed\n");
+ }
+
+ ini_set('mysqli.default_host', $host);
+ if (!mysqli_real_connect($link)) {
+ printf("[014] Usage of mysqli.default_host failed\n") ;
+ } else {
+ mysqli_close($link);
+ if (!$link = mysqli_init())
+ printf("[015] mysqli_init() failed\n");
+ }
+
+ // CLIENT_MULTI_STATEMENTS - should be disabled silently
+ if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, 65536))
+ printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if ($res = mysqli_query($link, "SELECT 1 AS a; SELECT 2 AS b")) {
+ printf("[017] Should have failed. CLIENT_MULTI_STATEMENT should have been disabled.\n");
+ var_dump($res->num_rows);
+ mysqli_next_result($link);
+ $res = mysqli_store_result($link);
+ var_dump($res->num_rows);
+ }
+
+
+ mysqli_close($link);
+ if (!$link = mysqli_init())
+ printf("[018] mysqli_init() failed\n");
+
+ if (ini_get('open_basedir')) {
+ // CLIENT_LOCAL_FILES should be blocked - but how to test it ?!
+
+ if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, 128))
+ printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ $filename = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'mysqli_real_connect_phpt';
+ if (!$fp = fopen($filename, 'w'))
+ printf("[020] Cannot open temporary file %s\n", $filename);
+
+ fwrite($fp, '100;z');
+ fclose($fp);
+
+ // how do we test if gets forbidden because of a missing right or the flag, this test is partly bogus ?
+ if (mysqli_query($link, "LOAD DATA LOCAL INFILE '$filename' INTO TABLE test FIELDS TERMINATED BY ';'"))
+ printf("[021] LOAD DATA INFILE should have been forbidden!\n");
+
+ unlink($filename);
+ }
+
+ mysqli_close($link);
+
+ if ($IS_MYSQLND) {
+ $link = mysqli_init();
+ if (!@mysqli_real_connect($link)) {
+ printf("[022] Usage of mysqli.default_host=p:%s (persistent) failed\n", $host) ;
+ } else {
+ if (!$res = mysqli_query($link, "SELECT 'mysqli.default_host (persistent)' AS 'testing'"))
+ printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ if ($tmp['testing'] !== 'mysqli.default_host (persistent)') {
+ printf("[024] Result looks strange - check manually, [%d] %s\n",
+ mysqli_errno($link), mysqli_error($link));
+ var_dump($tmp);
+ }
+ mysqli_free_result($res);
+ mysqli_close($link);
+ }
+
+ ini_set('mysqli.default_host', 'p:');
+ $link = mysqli_init();
+ if (@mysqli_real_connect($link)) {
+ printf("[025] Usage of mysqli.default_host=p: did not fail\n") ;
+ mysqli_close($link);
+ }
+ }
+
+ if (NULL === ($tmp = mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)))
+ printf("[026] Expecting not NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_real_escape_string.phpt b/ext/mysqli/tests/mysqli_real_escape_string.phpt
index 05588cac63..185d245dcc 100644
--- a/ext/mysqli/tests/mysqli_real_escape_string.phpt
+++ b/ext/mysqli/tests/mysqli_real_escape_string.phpt
@@ -8,51 +8,38 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ require('table.inc');
- if (NULL !== ($tmp = @mysqli_real_escape_string()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if ('\\\\' !== ($tmp = mysqli_real_escape_string($link, '\\')))
+ printf("[004] Expecting \\\\, got %s\n", $tmp);
- if (NULL !== ($tmp = @mysqli_real_escape_string($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if ('\"' !== ($tmp = mysqli_real_escape_string($link, '"')))
+ printf("[005] Expecting \", got %s\n", $tmp);
- require('table.inc');
+ if ("\'" !== ($tmp = mysqli_real_escape_string($link, "'")))
+ printf("[006] Expecting ', got %s\n", $tmp);
- if (NULL !== ($tmp =@mysqli_real_escape_string($link, "foo", "foo")))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if ("\\n" !== ($tmp = mysqli_real_escape_string($link, "\n")))
+ printf("[007] Expecting \\n, got %s\n", $tmp);
- if ('\\\\' !== ($tmp = mysqli_real_escape_string($link, '\\')))
- printf("[004] Expecting \\\\, got %s\n", $tmp);
+ if ("\\r" !== ($tmp = mysqli_real_escape_string($link, "\r")))
+ printf("[008] Expecting \\r, got %s\n", $tmp);
- if ('\"' !== ($tmp = mysqli_real_escape_string($link, '"')))
- printf("[005] Expecting \", got %s\n", $tmp);
+ if ("foo\\0bar" !== ($tmp = mysqli_real_escape_string($link, "foo" . chr(0) . "bar")))
+ printf("[009] Expecting %s, got %s\n", "foo\\0bar", $tmp);
- if ("\'" !== ($tmp = mysqli_real_escape_string($link, "'")))
- printf("[006] Expecting ', got %s\n", $tmp);
+ mysqli_close($link);
- if ("\\n" !== ($tmp = mysqli_real_escape_string($link, "\n")))
- printf("[007] Expecting \\n, got %s\n", $tmp);
+ try {
+ mysqli_real_escape_string($link, 'foo');
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- if ("\\r" !== ($tmp = mysqli_real_escape_string($link, "\r")))
- printf("[008] Expecting \\r, got %s\n", $tmp);
-
- if ("foo\\0bar" !== ($tmp = mysqli_real_escape_string($link, "foo" . chr(0) . "bar")))
- printf("[009] Expecting %s, got %s\n", "foo\\0bar", $tmp);
-
- mysqli_close($link);
-
- if (false !== ($tmp = mysqli_real_escape_string($link, 'foo')))
- printf("[010] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- /* Make sure that the function alias exists */
- if (NULL !== ($tmp = @mysqli_escape_string()))
- printf("[011] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!";
+ print "done!";
?>
---EXPECTF--
-Warning: mysqli_real_escape_string(): Couldn't fetch mysqli in %s on line %d
+--EXPECT--
+mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_real_escape_string_big5.phpt b/ext/mysqli/tests/mysqli_real_escape_string_big5.phpt
index 20384d9a0f..97113b858e 100644
--- a/ext/mysqli/tests/mysqli_real_escape_string_big5.phpt
+++ b/ext/mysqli/tests/mysqli_real_escape_string_big5.phpt
@@ -18,57 +18,57 @@ mysqli_close($link);
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
{
- printf("[001] Cannot connect to the server using host=%s, user=%s,
+ printf("[001] Cannot connect to the server using host=%s, user=%s,
passwd=***, dbname=%s, port=%s, socket=%s - [%d] %s\n", $host, $user, $db,
$port, $socket, mysqli_connect_errno(), mysqli_connect_error());
- }
+ }
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
- printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link),
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
+ printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
- }
+ }
- if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY
+ if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY
KEY(id)) ENGINE=' . $engine . " DEFAULT CHARSET=big5")) {
- printf("Failed to create test table: [%d] %s\n", mysqli_errno($link),
+ printf("Failed to create test table: [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
- }
+ }
- var_dump(mysqli_set_charset($link, "big5"));
+ var_dump(mysqli_set_charset($link, "big5"));
- if ('§ä¨ì¥H¤U¤º®e\\\\§ä¨ì¥H¤U¤º®e' !== ($tmp = mysqli_real_escape_string($link,
+ if ('§ä¨ì¥H¤U¤º®e\\\\§ä¨ì¥H¤U¤º®e' !== ($tmp = mysqli_real_escape_string($link,
'§ä¨ì¥H¤U¤º®e\\§ä¨ì¥H¤U¤º®e')))
- printf("[004] Expecting \\\\, got %s\n", $tmp);
+ printf("[004] Expecting \\\\, got %s\n", $tmp);
- if ('§ä¨ì¥H¤U¤º®e\"§ä¨ì¥H¤U¤º®e' !== ($tmp = mysqli_real_escape_string($link,
+ if ('§ä¨ì¥H¤U¤º®e\"§ä¨ì¥H¤U¤º®e' !== ($tmp = mysqli_real_escape_string($link,
'§ä¨ì¥H¤U¤º®e"§ä¨ì¥H¤U¤º®e')))
- printf("[005] Expecting \", got %s\n", $tmp);
+ printf("[005] Expecting \", got %s\n", $tmp);
- if ("§ä¨ì¥H¤U¤º®e\'§ä¨ì¥H¤U¤º®e" !== ($tmp = mysqli_real_escape_string($link,
+ if ("§ä¨ì¥H¤U¤º®e\'§ä¨ì¥H¤U¤º®e" !== ($tmp = mysqli_real_escape_string($link,
"§ä¨ì¥H¤U¤º®e'§ä¨ì¥H¤U¤º®e")))
- printf("[006] Expecting ', got %s\n", $tmp);
+ printf("[006] Expecting ', got %s\n", $tmp);
- if ("§ä¨ì¥H¤U¤º®e\\n§ä¨ì¥H¤U¤º®e" !== ($tmp = mysqli_real_escape_string($link,
+ if ("§ä¨ì¥H¤U¤º®e\\n§ä¨ì¥H¤U¤º®e" !== ($tmp = mysqli_real_escape_string($link,
"§ä¨ì¥H¤U¤º®e\n§ä¨ì¥H¤U¤º®e")))
- printf("[007] Expecting \\n, got %s\n", $tmp);
+ printf("[007] Expecting \\n, got %s\n", $tmp);
- if ("§ä¨ì¥H¤U¤º®e\\r§ä¨ì¥H¤U¤º®e" !== ($tmp = mysqli_real_escape_string($link,
+ if ("§ä¨ì¥H¤U¤º®e\\r§ä¨ì¥H¤U¤º®e" !== ($tmp = mysqli_real_escape_string($link,
"§ä¨ì¥H¤U¤º®e\r§ä¨ì¥H¤U¤º®e")))
- printf("[008] Expecting \\r, got %s\n", $tmp);
+ printf("[008] Expecting \\r, got %s\n", $tmp);
- if ("§ä¨ì¥H¤U¤º®e\\0§ä¨ì¥H¤U¤º®e" !== ($tmp = mysqli_real_escape_string($link, "§ä¨ì¥H¤U¤º®e"
+ if ("§ä¨ì¥H¤U¤º®e\\0§ä¨ì¥H¤U¤º®e" !== ($tmp = mysqli_real_escape_string($link, "§ä¨ì¥H¤U¤º®e"
. chr(0) . "§ä¨ì¥H¤U¤º®e")))
- printf("[009] Expecting %s, got %s\n", "§ä¨ì¥H¤U¤º®e\\0§ä¨ì¥H¤U¤º®e", $tmp);
+ printf("[009] Expecting %s, got %s\n", "§ä¨ì¥H¤U¤º®e\\0§ä¨ì¥H¤U¤º®e", $tmp);
- var_dump(mysqli_query($link, "INSERT INTO test(id, label) VALUES (100,
+ var_dump(mysqli_query($link, "INSERT INTO test(id, label) VALUES (100,
'§ä')"));
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_real_escape_string_eucjpms.phpt b/ext/mysqli/tests/mysqli_real_escape_string_eucjpms.phpt
index 14bf97c635..7d51309346 100644
--- a/ext/mysqli/tests/mysqli_real_escape_string_eucjpms.phpt
+++ b/ext/mysqli/tests/mysqli_real_escape_string_eucjpms.phpt
@@ -20,48 +20,48 @@ mysqli_close($link);
<?php
require_once("connect.inc");
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
{
- printf("[001] Cannot connect to the server using host=%s, user=%s,
+ printf("[001] Cannot connect to the server using host=%s, user=%s,
passwd=***, dbname=%s, port=%s, socket=%s - [%d] %s\n", $host, $user, $db,
$port, $socket, mysqli_connect_errno(), mysqli_connect_error());
- }
+ }
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
- printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link),
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
+ printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
- }
+ }
- if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY
+ if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY
KEY(id)) ENGINE=' . $engine . " DEFAULT CHARSET=eucjpms")) {
- printf("Failed to create test table: [%d] %s\n", mysqli_errno($link),
+ printf("Failed to create test table: [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
- }
+ }
- var_dump(mysqli_set_charset($link, "eucjpms"));
+ var_dump(mysqli_set_charset($link, "eucjpms"));
- if ('¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\\\\¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï' !== ($tmp = mysqli_real_escape_string($link, '¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\\¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï')))
- printf("[004] Expecting \\\\, got %s\n", $tmp);
+ if ('¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\\\\¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï' !== ($tmp = mysqli_real_escape_string($link, '¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\\¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï')))
+ printf("[004] Expecting \\\\, got %s\n", $tmp);
- if ('¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\"¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï' !== ($tmp = mysqli_real_escape_string($link, '¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï"¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï')))
- printf("[005] Expecting \", got %s\n", $tmp);
+ if ('¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\"¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï' !== ($tmp = mysqli_real_escape_string($link, '¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï"¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï')))
+ printf("[005] Expecting \", got %s\n", $tmp);
- if ("¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\'¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï" !== ($tmp = mysqli_real_escape_string($link, "¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï'¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï")))
- printf("[006] Expecting ', got %s\n", $tmp);
+ if ("¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\'¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï" !== ($tmp = mysqli_real_escape_string($link, "¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï'¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï")))
+ printf("[006] Expecting ', got %s\n", $tmp);
- if ("¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\\n¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï" !== ($tmp = mysqli_real_escape_string($link, "¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\n¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï")))
- printf("[007] Expecting \\n, got %s\n", $tmp);
+ if ("¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\\n¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï" !== ($tmp = mysqli_real_escape_string($link, "¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\n¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï")))
+ printf("[007] Expecting \\n, got %s\n", $tmp);
- if ("¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\\r¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï" !== ($tmp = mysqli_real_escape_string($link, "¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\r¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï")))
- printf("[008] Expecting \\r, got %s\n", $tmp);
+ if ("¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\\r¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï" !== ($tmp = mysqli_real_escape_string($link, "¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\r¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï")))
+ printf("[008] Expecting \\r, got %s\n", $tmp);
- if ("¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\\0¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï" !== ($tmp = mysqli_real_escape_string($link, "¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï" . chr(0) . "¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï")))
- printf("[009] Expecting %s, got %s\n", "¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\\0¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï", $tmp);
+ if ("¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\\0¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï" !== ($tmp = mysqli_real_escape_string($link, "¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï" . chr(0) . "¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï")))
+ printf("[009] Expecting %s, got %s\n", "¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï\\0¤³¤ÎÁȤ߹ç¤ï¤»¤Ç¤Ï", $tmp);
- var_dump(mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, '¤³')"));
+ var_dump(mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, '¤³')"));
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_real_escape_string_euckr.phpt b/ext/mysqli/tests/mysqli_real_escape_string_euckr.phpt
index cff45e06d4..21c3f99736 100644
--- a/ext/mysqli/tests/mysqli_real_escape_string_euckr.phpt
+++ b/ext/mysqli/tests/mysqli_real_escape_string_euckr.phpt
@@ -18,49 +18,49 @@ mysqli_close($link);
?>
--FILE--
<?php
- require_once("connect.inc");
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ require_once("connect.inc");
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
{
- printf("[001] Cannot connect to the server using host=%s, user=%s,
+ printf("[001] Cannot connect to the server using host=%s, user=%s,
passwd=***, dbname=%s, port=%s, socket=%s - [%d] %s\n", $host, $user, $db,
$port, $socket, mysqli_connect_errno(), mysqli_connect_error());
- }
+ }
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
- printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link),
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
+ printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
- }
+ }
- if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY
+ if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY
KEY(id)) ENGINE=' . $engine . " DEFAULT CHARSET=euckr")) {
- printf("Failed to create test table: [%d] %s\n", mysqli_errno($link),
+ printf("Failed to create test table: [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
- }
+ }
- var_dump(mysqli_set_charset($link, "euckr"));
+ var_dump(mysqli_set_charset($link, "euckr"));
- if ('±Ç´ë¼º\\\\±Ç´ë¼º' !== ($tmp = mysqli_real_escape_string($link, '±Ç´ë¼º\\±Ç´ë¼º')))
- printf("[004] Expecting \\\\, got %s\n", $tmp);
+ if ('±Ç´ë¼º\\\\±Ç´ë¼º' !== ($tmp = mysqli_real_escape_string($link, '±Ç´ë¼º\\±Ç´ë¼º')))
+ printf("[004] Expecting \\\\, got %s\n", $tmp);
- if ('±Ç´ë¼º\"±Ç´ë¼º' !== ($tmp = mysqli_real_escape_string($link, '±Ç´ë¼º"±Ç´ë¼º')))
- printf("[005] Expecting \", got %s\n", $tmp);
+ if ('±Ç´ë¼º\"±Ç´ë¼º' !== ($tmp = mysqli_real_escape_string($link, '±Ç´ë¼º"±Ç´ë¼º')))
+ printf("[005] Expecting \", got %s\n", $tmp);
- if ("±Ç´ë¼º\'±Ç´ë¼º" !== ($tmp = mysqli_real_escape_string($link, "±Ç´ë¼º'±Ç´ë¼º")))
- printf("[006] Expecting ', got %s\n", $tmp);
+ if ("±Ç´ë¼º\'±Ç´ë¼º" !== ($tmp = mysqli_real_escape_string($link, "±Ç´ë¼º'±Ç´ë¼º")))
+ printf("[006] Expecting ', got %s\n", $tmp);
- if ("±Ç´ë¼º\\n±Ç´ë¼º" !== ($tmp = mysqli_real_escape_string($link, "±Ç´ë¼º\n±Ç´ë¼º")))
- printf("[007] Expecting \\n, got %s\n", $tmp);
+ if ("±Ç´ë¼º\\n±Ç´ë¼º" !== ($tmp = mysqli_real_escape_string($link, "±Ç´ë¼º\n±Ç´ë¼º")))
+ printf("[007] Expecting \\n, got %s\n", $tmp);
- if ("±Ç´ë¼º\\r±Ç´ë¼º" !== ($tmp = mysqli_real_escape_string($link, "±Ç´ë¼º\r±Ç´ë¼º")))
- printf("[008] Expecting \\r, got %s\n", $tmp);
+ if ("±Ç´ë¼º\\r±Ç´ë¼º" !== ($tmp = mysqli_real_escape_string($link, "±Ç´ë¼º\r±Ç´ë¼º")))
+ printf("[008] Expecting \\r, got %s\n", $tmp);
- if ("±Ç´ë¼º\\0±Ç´ë¼º" !== ($tmp = mysqli_real_escape_string($link, "±Ç´ë¼º" . chr(0) . "±Ç´ë¼º")))
- printf("[009] Expecting %s, got %s\n", "±Ç´ë¼º\\0±Ç´ë¼º", $tmp);
+ if ("±Ç´ë¼º\\0±Ç´ë¼º" !== ($tmp = mysqli_real_escape_string($link, "±Ç´ë¼º" . chr(0) . "±Ç´ë¼º")))
+ printf("[009] Expecting %s, got %s\n", "±Ç´ë¼º\\0±Ç´ë¼º", $tmp);
- var_dump(mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, '±Ç')"));
+ var_dump(mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, '±Ç')"));
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_real_escape_string_gb2312.phpt b/ext/mysqli/tests/mysqli_real_escape_string_gb2312.phpt
index 537ac7292f..505c0bfa6c 100644
--- a/ext/mysqli/tests/mysqli_real_escape_string_gb2312.phpt
+++ b/ext/mysqli/tests/mysqli_real_escape_string_gb2312.phpt
@@ -19,49 +19,49 @@ mysqli_close($link);
--FILE--
<?php
- require_once("connect.inc");
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ require_once("connect.inc");
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
{
- printf("[001] Cannot connect to the server using host=%s, user=%s,
+ printf("[001] Cannot connect to the server using host=%s, user=%s,
passwd=***, dbname=%s, port=%s, socket=%s - [%d] %s\n", $host, $user, $db,
$port, $socket, mysqli_connect_errno(), mysqli_connect_error());
- }
+ }
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
- printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link),
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
+ printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
- }
+ }
- if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY
+ if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY
KEY(id)) ENGINE=' . $engine . " DEFAULT CHARSET=gb2312")) {
- printf("Failed to create test table: [%d] %s\n", mysqli_errno($link),
+ printf("Failed to create test table: [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
- }
+ }
- var_dump(mysqli_set_charset($link, "gb2312"));
+ var_dump(mysqli_set_charset($link, "gb2312"));
- if ('Ê×ÏÈ\\\\Ê×ÏÈ' !== ($tmp = mysqli_real_escape_string($link, 'Ê×ÏÈ\\Ê×ÏÈ')))
- printf("[004] Expecting \\\\, got %s\n", $tmp);
+ if ('Ê×ÏÈ\\\\Ê×ÏÈ' !== ($tmp = mysqli_real_escape_string($link, 'Ê×ÏÈ\\Ê×ÏÈ')))
+ printf("[004] Expecting \\\\, got %s\n", $tmp);
- if ('Ê×ÏÈ\"Ê×ÏÈ' !== ($tmp = mysqli_real_escape_string($link, 'Ê×ÏÈ"Ê×ÏÈ')))
- printf("[005] Expecting \", got %s\n", $tmp);
+ if ('Ê×ÏÈ\"Ê×ÏÈ' !== ($tmp = mysqli_real_escape_string($link, 'Ê×ÏÈ"Ê×ÏÈ')))
+ printf("[005] Expecting \", got %s\n", $tmp);
- if ("Ê×ÏÈ\'Ê×ÏÈ" !== ($tmp = mysqli_real_escape_string($link, "Ê×ÏÈ'Ê×ÏÈ")))
- printf("[006] Expecting ', got %s\n", $tmp);
+ if ("Ê×ÏÈ\'Ê×ÏÈ" !== ($tmp = mysqli_real_escape_string($link, "Ê×ÏÈ'Ê×ÏÈ")))
+ printf("[006] Expecting ', got %s\n", $tmp);
- if ("Ê×ÏÈ\\nÊ×ÏÈ" !== ($tmp = mysqli_real_escape_string($link, "Ê×ÏÈ\nÊ×ÏÈ")))
- printf("[007] Expecting \\n, got %s\n", $tmp);
+ if ("Ê×ÏÈ\\nÊ×ÏÈ" !== ($tmp = mysqli_real_escape_string($link, "Ê×ÏÈ\nÊ×ÏÈ")))
+ printf("[007] Expecting \\n, got %s\n", $tmp);
- if ("Ê×ÏÈ\\rÊ×ÏÈ" !== ($tmp = mysqli_real_escape_string($link, "Ê×ÏÈ\rÊ×ÏÈ")))
- printf("[008] Expecting \\r, got %s\n", $tmp);
+ if ("Ê×ÏÈ\\rÊ×ÏÈ" !== ($tmp = mysqli_real_escape_string($link, "Ê×ÏÈ\rÊ×ÏÈ")))
+ printf("[008] Expecting \\r, got %s\n", $tmp);
- if ("Ê×ÏÈ\\0Ê×ÏÈ" !== ($tmp = mysqli_real_escape_string($link, "Ê×ÏÈ" . chr(0) . "Ê×ÏÈ")))
- printf("[009] Expecting %s, got %s\n", "Ê×ÏÈ\\0Ê×ÏÈ", $tmp);
+ if ("Ê×ÏÈ\\0Ê×ÏÈ" !== ($tmp = mysqli_real_escape_string($link, "Ê×ÏÈ" . chr(0) . "Ê×ÏÈ")))
+ printf("[009] Expecting %s, got %s\n", "Ê×ÏÈ\\0Ê×ÏÈ", $tmp);
- var_dump(mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, 'Ê×')"));
+ var_dump(mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, 'Ê×')"));
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_real_escape_string_gbk.phpt b/ext/mysqli/tests/mysqli_real_escape_string_gbk.phpt
index 85ac847666..3dd8c84a58 100644
--- a/ext/mysqli/tests/mysqli_real_escape_string_gbk.phpt
+++ b/ext/mysqli/tests/mysqli_real_escape_string_gbk.phpt
@@ -19,49 +19,49 @@ mysqli_close($link);
--FILE--
<?php
- require_once("connect.inc");
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ require_once("connect.inc");
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
{
- printf("[001] Cannot connect to the server using host=%s, user=%s,
+ printf("[001] Cannot connect to the server using host=%s, user=%s,
passwd=***, dbname=%s, port=%s, socket=%s - [%d] %s\n", $host, $user, $db,
$port, $socket, mysqli_connect_errno(), mysqli_connect_error());
- }
+ }
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
- printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link),
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
+ printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
- }
+ }
- if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(3), PRIMARY
+ if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(3), PRIMARY
KEY(id)) ENGINE=' . $engine . " DEFAULT CHARSET=gbk")) {
- printf("Failed to create test table: [%d] %s\n", mysqli_errno($link),
+ printf("Failed to create test table: [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
- }
+ }
- var_dump(mysqli_set_charset($link, "gbk"));
+ var_dump(mysqli_set_charset($link, "gbk"));
- if ('�İ汾\\\\�İ汾' !== ($tmp = mysqli_real_escape_string($link, '�İ汾\\�İ汾')))
- printf("[004] Expecting \\\\, got %s\n", $tmp);
+ if ('�İ汾\\\\�İ汾' !== ($tmp = mysqli_real_escape_string($link, '�İ汾\\�İ汾')))
+ printf("[004] Expecting \\\\, got %s\n", $tmp);
- if ('�İ汾\"�İ汾' !== ($tmp = mysqli_real_escape_string($link, '�İ汾"�İ汾')))
- printf("[005] Expecting \", got %s\n", $tmp);
+ if ('�İ汾\"�İ汾' !== ($tmp = mysqli_real_escape_string($link, '�İ汾"�İ汾')))
+ printf("[005] Expecting \", got %s\n", $tmp);
- if ("�İ汾\'�İ汾" !== ($tmp = mysqli_real_escape_string($link, "�İ汾'�İ汾")))
- printf("[006] Expecting ', got %s\n", $tmp);
+ if ("�İ汾\'�İ汾" !== ($tmp = mysqli_real_escape_string($link, "�İ汾'�İ汾")))
+ printf("[006] Expecting ', got %s\n", $tmp);
- if ("�İ汾\\n�İ汾" !== ($tmp = mysqli_real_escape_string($link, "�İ汾\n�İ汾")))
- printf("[007] Expecting \\n, got %s\n", $tmp);
+ if ("�İ汾\\n�İ汾" !== ($tmp = mysqli_real_escape_string($link, "�İ汾\n�İ汾")))
+ printf("[007] Expecting \\n, got %s\n", $tmp);
- if ("�İ汾\\r�İ汾" !== ($tmp = mysqli_real_escape_string($link, "�İ汾\r�İ汾")))
- printf("[008] Expecting \\r, got %s\n", $tmp);
+ if ("�İ汾\\r�İ汾" !== ($tmp = mysqli_real_escape_string($link, "�İ汾\r�İ汾")))
+ printf("[008] Expecting \\r, got %s\n", $tmp);
- if ("�İ汾\\0�İ汾" !== ($tmp = mysqli_real_escape_string($link, "�İ汾" . chr(0) . "�İ汾")))
- printf("[009] Expecting %s, got %s\n", "�İ汾\\0�İ汾", $tmp);
+ if ("�İ汾\\0�İ汾" !== ($tmp = mysqli_real_escape_string($link, "�İ汾" . chr(0) . "�İ汾")))
+ printf("[009] Expecting %s, got %s\n", "�İ汾\\0�İ汾", $tmp);
- var_dump(mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, '��')"));
+ var_dump(mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, '��')"));
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_real_escape_string_nobackslash.phpt b/ext/mysqli/tests/mysqli_real_escape_string_nobackslash.phpt
index d4e43243fa..b8e48ccf8f 100644
--- a/ext/mysqli/tests/mysqli_real_escape_string_nobackslash.phpt
+++ b/ext/mysqli/tests/mysqli_real_escape_string_nobackslash.phpt
@@ -8,54 +8,54 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
- require_once('table.inc');
+ require_once("connect.inc");
+ require_once('table.inc');
- if (!mysqli_query($link, 'SET @@sql_mode="NO_BACKSLASH_ESCAPES"'))
- printf("[001] Cannot set NO_BACKSLASH_ESCAPES, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'SET @@sql_mode="NO_BACKSLASH_ESCAPES"'))
+ printf("[001] Cannot set NO_BACKSLASH_ESCAPES, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if ('\\' !== ($tmp = mysqli_real_escape_string($link, '\\')))
- printf("[002] Expecting \\, got %s\n", $tmp);
+ if ('\\' !== ($tmp = mysqli_real_escape_string($link, '\\')))
+ printf("[002] Expecting \\, got %s\n", $tmp);
- if ('"' !== ($tmp = mysqli_real_escape_string($link, '"')))
- printf("[003] Expecting \", got %s\n", $tmp);
+ if ('"' !== ($tmp = mysqli_real_escape_string($link, '"')))
+ printf("[003] Expecting \", got %s\n", $tmp);
- if ("''" !== ($tmp = mysqli_real_escape_string($link, "'")))
- printf("[004] Expecting '', got %s\n", $tmp);
+ if ("''" !== ($tmp = mysqli_real_escape_string($link, "'")))
+ printf("[004] Expecting '', got %s\n", $tmp);
- if ("\n" !== ($tmp = mysqli_real_escape_string($link, "\n")))
- printf("[005] Expecting \\n, got %s\n", $tmp);
+ if ("\n" !== ($tmp = mysqli_real_escape_string($link, "\n")))
+ printf("[005] Expecting \\n, got %s\n", $tmp);
- if ("\r" !== ($tmp = mysqli_real_escape_string($link, "\r")))
- printf("[006] Expecting \\r, got %s\n", $tmp);
+ if ("\r" !== ($tmp = mysqli_real_escape_string($link, "\r")))
+ printf("[006] Expecting \\r, got %s\n", $tmp);
- assert("foo" . chr(0) . "bar" === "foo" . chr(0) . "bar");
- if ("foo" . chr(0) . "bar" !== ($tmp = mysqli_real_escape_string($link, "foo" . chr(0) . "bar")))
- printf("[007] Expecting %s, got %s\n", "foo" . chr(0) . "bar", $tmp);
+ assert("foo" . chr(0) . "bar" === "foo" . chr(0) . "bar");
+ if ("foo" . chr(0) . "bar" !== ($tmp = mysqli_real_escape_string($link, "foo" . chr(0) . "bar")))
+ printf("[007] Expecting %s, got %s\n", "foo" . chr(0) . "bar", $tmp);
- if (!mysqli_query($link, sprintf('INSERT INTO test(id, label) VALUES (100, "%s")',
- mysqli_real_escape_string($link, "\\"))))
- printf("[009] Cannot INSERT, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, sprintf('INSERT INTO test(id, label) VALUES (100, "%s")',
+ mysqli_real_escape_string($link, "\\"))))
+ printf("[009] Cannot INSERT, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!($res = mysqli_query($link, 'SELECT label FROM test WHERE id = 100')) ||
- !($row = mysqli_fetch_assoc($res)))
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!($res = mysqli_query($link, 'SELECT label FROM test WHERE id = 100')) ||
+ !($row = mysqli_fetch_assoc($res)))
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump($row);
- mysqli_free_result($res);
+ var_dump($row);
+ mysqli_free_result($res);
- if (!mysqli_query($link, 'SET @@sql_mode=""'))
- printf("[011] Cannot disable NO_BACKSLASH_ESCAPES, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'SET @@sql_mode=""'))
+ printf("[011] Cannot disable NO_BACKSLASH_ESCAPES, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if ('\\\\' !== ($tmp = mysqli_real_escape_string($link, '\\')))
- printf("[012] Expecting \\, got %s\n", $tmp);
+ if ('\\\\' !== ($tmp = mysqli_real_escape_string($link, '\\')))
+ printf("[012] Expecting \\, got %s\n", $tmp);
- if ("foo\\0bar" !== ($tmp = mysqli_real_escape_string($link, "foo" . chr(0) . "bar")))
- printf("[013] Expecting %s, got %s\n", "foo" . chr(0) . "bar", $tmp);
+ if ("foo\\0bar" !== ($tmp = mysqli_real_escape_string($link, "foo" . chr(0) . "bar")))
+ printf("[013] Expecting %s, got %s\n", "foo" . chr(0) . "bar", $tmp);
- mysqli_close($link);
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--EXPECT--
array(1) {
diff --git a/ext/mysqli/tests/mysqli_real_escape_string_sjis.phpt b/ext/mysqli/tests/mysqli_real_escape_string_sjis.phpt
index 9e1562dba0..611590af27 100644
--- a/ext/mysqli/tests/mysqli_real_escape_string_sjis.phpt
+++ b/ext/mysqli/tests/mysqli_real_escape_string_sjis.phpt
@@ -18,33 +18,33 @@ mysqli_close($link);
--FILE--
<?php
- require_once("connect.inc");
- require_once('table.inc');
+ require_once("connect.inc");
+ require_once('table.inc');
- var_dump(mysqli_set_charset($link, "sjis"));
+ var_dump(mysqli_set_charset($link, "sjis"));
- if ('?p??\\\\?p??' !== ($tmp = mysqli_real_escape_string($link, '?p??\\?p??')))
- printf("[004] Expecting \\\\, got %s\n", $tmp);
+ if ('?p??\\\\?p??' !== ($tmp = mysqli_real_escape_string($link, '?p??\\?p??')))
+ printf("[004] Expecting \\\\, got %s\n", $tmp);
- if ('?p??\"?p??' !== ($tmp = mysqli_real_escape_string($link, '?p??"?p??')))
- printf("[005] Expecting \", got %s\n", $tmp);
+ if ('?p??\"?p??' !== ($tmp = mysqli_real_escape_string($link, '?p??"?p??')))
+ printf("[005] Expecting \", got %s\n", $tmp);
- if ("?p??\'?p??" !== ($tmp = mysqli_real_escape_string($link, "?p??'?p??")))
- printf("[006] Expecting ', got %s\n", $tmp);
+ if ("?p??\'?p??" !== ($tmp = mysqli_real_escape_string($link, "?p??'?p??")))
+ printf("[006] Expecting ', got %s\n", $tmp);
- if ("?p??\\n?p??" !== ($tmp = mysqli_real_escape_string($link, "?p??\n?p??")))
- printf("[007] Expecting \\n, got %s\n", $tmp);
+ if ("?p??\\n?p??" !== ($tmp = mysqli_real_escape_string($link, "?p??\n?p??")))
+ printf("[007] Expecting \\n, got %s\n", $tmp);
- if ("?p??\\r?p??" !== ($tmp = mysqli_real_escape_string($link, "?p??\r?p??")))
- printf("[008] Expecting \\r, got %s\n", $tmp);
+ if ("?p??\\r?p??" !== ($tmp = mysqli_real_escape_string($link, "?p??\r?p??")))
+ printf("[008] Expecting \\r, got %s\n", $tmp);
- if ("?p??\\0?p??" !== ($tmp = mysqli_real_escape_string($link, "?p??" . chr(0) . "?p??")))
- printf("[009] Expecting %s, got %s\n", "?p??\\0?p??", $tmp);
+ if ("?p??\\0?p??" !== ($tmp = mysqli_real_escape_string($link, "?p??" . chr(0) . "?p??")))
+ printf("[009] Expecting %s, got %s\n", "?p??\\0?p??", $tmp);
- var_dump(mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, '?p')"));
+ var_dump(mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, '?p')"));
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--EXPECT--
bool(true)
diff --git a/ext/mysqli/tests/mysqli_real_escape_string_unicode.phpt b/ext/mysqli/tests/mysqli_real_escape_string_unicode.phpt
index b3465ad2b1..acbbc4ed85 100644
--- a/ext/mysqli/tests/mysqli_real_escape_string_unicode.phpt
+++ b/ext/mysqli/tests/mysqli_real_escape_string_unicode.phpt
@@ -8,81 +8,72 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ require('table.inc');
- if (NULL !== ($tmp = @mysqli_real_escape_string()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if ('фу\\\\бар' !== ($tmp = mysqli_real_escape_string($link, 'фу\\бар')))
+ printf("[004] Expecting фу\\\\бар, got %s\n", $tmp);
- if (NULL !== ($tmp = @mysqli_real_escape_string($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if ('бар\"фуÑ' !== ($tmp = mysqli_real_escape_string($link, 'бар"фуÑ')))
+ printf("[005] Expecting бар\"фуÑ, got %s\n", $tmp);
- require('table.inc');
+ if ("лала\'лали" !== ($tmp = mysqli_real_escape_string($link, "лала'лали")))
+ printf("[006] Expecting лала'лали, got %s\n", $tmp);
- if (NULL !== ($tmp =@mysqli_real_escape_string($link, "фуу", "бар")))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if ("абра\\nкадабра" !== ($tmp = mysqli_real_escape_string($link, "абра\nкадабра")))
+ printf("[007] Expecting абра\\nкадабра, got %s\n", $tmp);
- if ('фу\\\\бар' !== ($tmp = mysqli_real_escape_string($link, 'фу\\бар')))
- printf("[004] Expecting фу\\\\бар, got %s\n", $tmp);
+ if ("манда\\rин" !== ($tmp = mysqli_real_escape_string($link, "манда\rин")))
+ printf("[008] Expecting \\r, got %s\n", $tmp);
- if ('бар\"фуÑ' !== ($tmp = mysqli_real_escape_string($link, 'бар"фуÑ')))
- printf("[005] Expecting бар\"фуÑ, got %s\n", $tmp);
+ if ("иху\\0аху" !== ($tmp = mysqli_real_escape_string($link, "иху" . chr(0) . "аху")))
+ printf("[009] Expecting %s, got %s\n", "иху\\0аху", $tmp);
- if ("лала\'лали" !== ($tmp = mysqli_real_escape_string($link, "лала'лали")))
- printf("[006] Expecting лала'лали, got %s\n", $tmp);
+ if (($exp='абра\\\\ка\"да\\'."'".'бра\ZÑим\\nÑала\\rби\\0м') !==
+ ($tmp = mysqli_real_escape_string($link, "абра\\ка\"да'бра\032Ñим\nÑала\rби" . chr(0) . "м")))
+ {
+ printf("[010] Expecting %s, got %s\n", $exp, $tmp, var_dump($exp, $tmp));
+ }
- if ("абра\\nкадабра" !== ($tmp = mysqli_real_escape_string($link, "абра\nкадабра")))
- printf("[007] Expecting абра\\nкадабра, got %s\n", $tmp);
+ if ('富\\\\é…’å§' !== ($tmp = mysqli_real_escape_string($link, '富\\é…’å§')))
+ printf("[011] Expecting 富\\\\é…’å§, got %s\n", $tmp);
- if ("манда\\rин" !== ($tmp = mysqli_real_escape_string($link, "манда\rин")))
- printf("[008] Expecting \\r, got %s\n", $tmp);
+ if ('é…’å§\"å°é¢˜å¤§åš' !== ($tmp = mysqli_real_escape_string($link, 'é…’å§"å°é¢˜å¤§åš')))
+ printf("[012] Expecting é…’å§\"å°é¢˜å¤§åš, got %s\n", $tmp);
- if ("иху\\0аху" !== ($tmp = mysqli_real_escape_string($link, "иху" . chr(0) . "аху")))
- printf("[009] Expecting %s, got %s\n", "иху\\0аху", $tmp);
+ if ("拉拉\'西雅图" !== ($tmp = mysqli_real_escape_string($link, "拉拉'西雅图")))
+ printf("[013] Expecting 拉拉'西雅图, got %s\n", $tmp);
- if (($exp='абра\\\\ка\"да\\'."'".'бра\ZÑим\\nÑала\\rби\\0м') !==
- ($tmp = mysqli_real_escape_string($link, "абра\\ка\"да'бра\032Ñим\nÑала\rби" . chr(0) . "м")))
- {
- printf("[010] Expecting %s, got %s\n", $exp, $tmp, var_dump($exp, $tmp));
- }
+ if ("阿åœæ‹‰\\nè½»" !== ($tmp = mysqli_real_escape_string($link, "阿åœæ‹‰\nè½»")))
+ printf("[014] Expecting 阿åœæ‹‰\\nè½», got %s\n", $tmp);
- if ('富\\\\é…’å§' !== ($tmp = mysqli_real_escape_string($link, '富\\é…’å§')))
- printf("[011] Expecting 富\\\\é…’å§, got %s\n", $tmp);
+ if ("张明安\\r在" !== ($tmp = mysqli_real_escape_string($link, "张明安\r在")))
+ printf("[015] Expecting 张明安\\r在, got %s\n", $tmp);
- if ('é…’å§\"å°é¢˜å¤§åš' !== ($tmp = mysqli_real_escape_string($link, 'é…’å§"å°é¢˜å¤§åš')))
- printf("[012] Expecting é…’å§\"å°é¢˜å¤§åš, got %s\n", $tmp);
+ if ("竺å¯æ¡¢\\0空调器" !== ($tmp = mysqli_real_escape_string($link, "竺å¯æ¡¢" . chr(0) . "空调器")))
+ printf("[016] Expecting %s, got %s\n", "竺å¯æ¡¢\\0空调器", $tmp);
- if ("拉拉\'西雅图" !== ($tmp = mysqli_real_escape_string($link, "拉拉'西雅图")))
- printf("[013] Expecting 拉拉'西雅图, got %s\n", $tmp);
+ if (($exp='阿åœæ‹‰\\\\嘉\"达丰\\'."'".'乳罩\Zè¾›\\nè¨æ‹‰\\r毕\\0ç±³') !==
+ ($tmp = mysqli_real_escape_string($link, "阿åœæ‹‰\\嘉\"达丰'乳罩\032è¾›\nè¨æ‹‰\r毕" . chr(0) . "ç±³")))
+ {
+ printf("[017] Expecting %s, got %s\n", $exp, $tmp, var_dump($exp, $tmp));
+ }
- if ("阿åœæ‹‰\\nè½»" !== ($tmp = mysqli_real_escape_string($link, "阿åœæ‹‰\nè½»")))
- printf("[014] Expecting 阿åœæ‹‰\\nè½», got %s\n", $tmp);
+ mysqli_close($link);
- if ("张明安\\r在" !== ($tmp = mysqli_real_escape_string($link, "张明安\r在")))
- printf("[015] Expecting 张明安\\r在, got %s\n", $tmp);
+ try {
+ mysqli_real_escape_string($link, 'foo');
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- if ("竺å¯æ¡¢\\0空调器" !== ($tmp = mysqli_real_escape_string($link, "竺å¯æ¡¢" . chr(0) . "空调器")))
- printf("[016] Expecting %s, got %s\n", "竺å¯æ¡¢\\0空调器", $tmp);
-
- if (($exp='阿åœæ‹‰\\\\嘉\"达丰\\'."'".'乳罩\Zè¾›\\nè¨æ‹‰\\r毕\\0ç±³') !==
- ($tmp = mysqli_real_escape_string($link, "阿åœæ‹‰\\嘉\"达丰'乳罩\032è¾›\nè¨æ‹‰\r毕" . chr(0) . "ç±³")))
- {
- printf("[017] Expecting %s, got %s\n", $exp, $tmp, var_dump($exp, $tmp));
- }
-
- mysqli_close($link);
-
- if (false !== ($tmp = mysqli_real_escape_string($link, 'foo')))
- printf("[018] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
---EXPECTF--
-Warning: mysqli_real_escape_string(): Couldn't fetch mysqli in %s on line %d
+--EXPECT--
+mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_real_query.phpt b/ext/mysqli/tests/mysqli_real_query.phpt
index 9b99435d42..45df8a9edc 100644
--- a/ext/mysqli/tests/mysqli_real_query.phpt
+++ b/ext/mysqli/tests/mysqli_real_query.phpt
@@ -7,87 +7,78 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ require('table.inc');
- if (!is_null($tmp = @mysqli_real_query()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_real_query($link, 'THIS IS NOT SQL')))
+ printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_real_query($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_real_query($link, "SELECT 'this is sql but with backslash g'\g")))
+ printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ if ((0 === mysqli_errno($link)) || ('' == mysqli_error($link)))
+ printf("[006] mysqli_errno()/mysqli_error should return some error\n");
- if (NULL !== ($tmp = @mysqli_real_query($link, "SELECT 1 AS a", MYSQLI_USE_RESULT, "foo")))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_real_query($link, "SELECT 'this is sql but with semicolon' AS valid ; "))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (false !== ($tmp = mysqli_real_query($link, 'THIS IS NOT SQL')))
- printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_object($res = mysqli_use_result($link)))
+ printf("[008] Expecting reseult object, got %s/%s [%d] %s\n", gettype($res), $res, mysqli_errno($link), mysqli_error($link));
- if (false !== ($tmp = mysqli_real_query($link, "SELECT 'this is sql but with backslash g'\g")))
- printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
- if ((0 === mysqli_errno($link)) || ('' == mysqli_error($link)))
- printf("[006] mysqli_errno()/mysqli_error should return some error\n");
+ if (false !== ($res = mysqli_real_query($link, "SELECT 'this is sql but with semicolon' AS valid ; SHOW VARIABLES")))
+ printf("[008] Expecting boolean/false, got %s/%s, [%d] %s\n", gettype($res), $res,
+ mysqli_errno($link), mysqli_error($link));
- if (!mysqli_real_query($link, "SELECT 'this is sql but with semicolon' AS valid ; "))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!is_object($res = mysqli_use_result($link)))
- printf("[008] Expecting reseult object, got %s/%s [%d] %s\n", gettype($res), $res, mysqli_errno($link), mysqli_error($link));
-
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
-
- if (false !== ($res = mysqli_real_query($link, "SELECT 'this is sql but with semicolon' AS valid ; SHOW VARIABLES")))
- printf("[008] Expecting boolean/false, got %s/%s, [%d] %s\n", gettype($res), $res,
- mysqli_errno($link), mysqli_error($link));
-
- if (mysqli_get_server_version($link) > 50000) {
- // let's try to play with stored procedures
- mysqli_real_query($link, 'DROP PROCEDURE IF EXISTS p');
- if (mysqli_real_query($link, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) BEGIN SELECT VERSION() INTO ver_param;
+ if (mysqli_get_server_version($link) > 50000) {
+ // let's try to play with stored procedures
+ mysqli_real_query($link, 'DROP PROCEDURE IF EXISTS p');
+ if (mysqli_real_query($link, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) BEGIN SELECT VERSION() INTO ver_param;
END;')) {
- mysqli_real_query($link, 'CALL p(@version)');
- mysqli_real_query($link, 'SELECT @version AS p_version');
- $res = mysqli_store_result($link);
-
- $tmp = mysqli_fetch_assoc($res);
- if (!is_array($tmp) || empty($tmp) || !isset($tmp['p_version']) || ('' == $tmp['p_version'])) {
- printf("[008a] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump($tmp);
- }
-
- mysqli_free_result($res);
- } else {
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- mysqli_real_query($link, 'DROP FUNCTION IF EXISTS f');
- if (mysqli_real_query($link, 'CREATE FUNCTION f( ver_param VARCHAR(25)) RETURNS VARCHAR(25) DETERMINISTIC RETURN
+ mysqli_real_query($link, 'CALL p(@version)');
+ mysqli_real_query($link, 'SELECT @version AS p_version');
+ $res = mysqli_store_result($link);
+
+ $tmp = mysqli_fetch_assoc($res);
+ if (!is_array($tmp) || empty($tmp) || !isset($tmp['p_version']) || ('' == $tmp['p_version'])) {
+ printf("[008a] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ var_dump($tmp);
+ }
+
+ mysqli_free_result($res);
+ } else {
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ mysqli_real_query($link, 'DROP FUNCTION IF EXISTS f');
+ if (mysqli_real_query($link, 'CREATE FUNCTION f( ver_param VARCHAR(25)) RETURNS VARCHAR(25) DETERMINISTIC RETURN
ver_param;')) {
- mysqli_real_query($link, 'SELECT f(VERSION()) AS f_version');
- $res = mysqli_store_result($link);
-
- $tmp = mysqli_fetch_assoc($res);
- if (!is_array($tmp) || empty($tmp) || !isset($tmp['f_version']) || ('' == $tmp['f_version'])) {
- printf("[009a] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump($tmp);
- }
-
- mysqli_free_result($res);
- } else {
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- }
-
- mysqli_close($link);
-
- if (false !== ($tmp = mysqli_real_query($link, "SELECT id FROM test")))
- printf("[011] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!";
+ mysqli_real_query($link, 'SELECT f(VERSION()) AS f_version');
+ $res = mysqli_store_result($link);
+
+ $tmp = mysqli_fetch_assoc($res);
+ if (!is_array($tmp) || empty($tmp) || !isset($tmp['f_version']) || ('' == $tmp['f_version'])) {
+ printf("[009a] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ var_dump($tmp);
+ }
+
+ mysqli_free_result($res);
+ } else {
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ }
+
+ mysqli_close($link);
+
+ try {
+ mysqli_real_query($link, "SELECT id FROM test");
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ print "done!";
?>
--CLEAN--
<?php
@@ -103,11 +94,10 @@ if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
mysqli_close($link);
?>
---EXPECTF--
+--EXPECT--
array(1) {
["valid"]=>
string(30) "this is sql but with semicolon"
}
-
-Warning: mysqli_real_query(): Couldn't fetch mysqli in %s on line %d
+mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_reap_async_query.phpt b/ext/mysqli/tests/mysqli_reap_async_query.phpt
index 745323c0ce..8f9fd5cb1c 100644
--- a/ext/mysqli/tests/mysqli_reap_async_query.phpt
+++ b/ext/mysqli/tests/mysqli_reap_async_query.phpt
@@ -12,80 +12,70 @@ if (!$IS_MYSQLND)
?>
--FILE--
<?php
- require_once('connect.inc');
-
- function get_connection() {
- global $host, $user, $passwd, $db, $port, $socket;
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- return $link;
- }
-
- if (!$link = get_connection())
- printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
-
- if (NULL !== ($tmp = @mysqli_reap_async_query()))
- printf("[002] Expecting NULL got %s\n", var_export($tmp, true));
-
- $l = array($link);
- if (NULL !== ($tmp = @mysqli_reap_async_query($l)))
- printf("[003] Expecting NULL got %s\n", var_export($tmp, true));
-
- if (NULL !== ($tmp = @mysqli_reap_async_query($link, $link)))
- printf("[004] Expecting NULL got %s\n", var_export($tmp, true));
-
-
- function poll_async($offset, $link, $links, $errors, $reject, $exp_ready, $use_oo_syntax) {
-
- if ($exp_ready !== ($tmp = mysqli_poll($links, $errors, $reject, 0, 50 * 1000)))
- printf("[%03d + 1] There should be %d links ready to read from, %d ready\n",
- $offset, $exp_ready, $tmp);
-
- foreach ($links as $mysqli) {
- if ($use_oo_syntax) {
- $res = $mysqli->reap_async_query();
- } else {
- $res = mysqli_reap_async_query($mysqli);
- }
- if (is_object($res)) {
- printf("[%03d + 2] %s\n", $offset, var_export($res->fetch_assoc(), true));
- } else if (mysqli_errno($mysqli) > 0) {
- printf("[%03d + 3] Error indicated through links array: %d/%s",
- $offset, mysqli_errno($mysqli), mysqli_error($mysqli));
- } else {
- printf("[%03d + 4] Cannot fetch and no error set - non resultset query (no SELECT)!\n", $offset);
- }
- }
-
- foreach ($errors as $mysqli)
- printf("[%03d + 5] Error on %d: %d/%s\n",
- $offset, mysqli_thread_id($mysqli), mysqli_errno($mysqli), mysqli_error($mysqli));
-
- foreach ($reject as $mysqli)
- printf("[%03d + 6] Rejecting thread %d: %d/%s\n",
- $offset, mysqli_thread_id($mysqli), mysqli_errno($mysqli), mysqli_error($mysqli));
-
- }
-
- // Connections on which no query has been send - 1
- $link = get_connection();
- $link->query("SELECT 1 AS _one", MYSQLI_ASYNC | MYSQLI_STORE_RESULT);
- $links = array($link);
- $errors = array($link);
- $reject = array($link);
- poll_async(12, $link, $links, $errors, $reject, 1, false);
- mysqli_close($link);
-
- $link = get_connection();
- $link->query("SELECT 2 AS _two", MYSQLI_ASYNC | MYSQLI_USE_RESULT);
- $links = array($link);
- $errors = array($link);
- $reject = array($link);
- poll_async(13, $link, $links, $errors, $reject, 1, true);
- mysqli_close($link);
-
- print "done!";
+ require_once('connect.inc');
+
+ function get_connection() {
+ global $host, $user, $passwd, $db, $port, $socket;
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ return $link;
+ }
+
+ if (!$link = get_connection())
+ printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+
+
+ function poll_async($offset, $link, $links, $errors, $reject, $exp_ready, $use_oo_syntax) {
+
+ if ($exp_ready !== ($tmp = mysqli_poll($links, $errors, $reject, 0, 50 * 1000)))
+ printf("[%03d + 1] There should be %d links ready to read from, %d ready\n",
+ $offset, $exp_ready, $tmp);
+
+ foreach ($links as $mysqli) {
+ if ($use_oo_syntax) {
+ $res = $mysqli->reap_async_query();
+ } else {
+ $res = mysqli_reap_async_query($mysqli);
+ }
+ if (is_object($res)) {
+ printf("[%03d + 2] %s\n", $offset, var_export($res->fetch_assoc(), true));
+ } else if (mysqli_errno($mysqli) > 0) {
+ printf("[%03d + 3] Error indicated through links array: %d/%s",
+ $offset, mysqli_errno($mysqli), mysqli_error($mysqli));
+ } else {
+ printf("[%03d + 4] Cannot fetch and no error set - non resultset query (no SELECT)!\n", $offset);
+ }
+ }
+
+ foreach ($errors as $mysqli)
+ printf("[%03d + 5] Error on %d: %d/%s\n",
+ $offset, mysqli_thread_id($mysqli), mysqli_errno($mysqli), mysqli_error($mysqli));
+
+ foreach ($reject as $mysqli)
+ printf("[%03d + 6] Rejecting thread %d: %d/%s\n",
+ $offset, mysqli_thread_id($mysqli), mysqli_errno($mysqli), mysqli_error($mysqli));
+
+ }
+
+ // Connections on which no query has been send - 1
+ $link = get_connection();
+ $link->query("SELECT 1 AS _one", MYSQLI_ASYNC | MYSQLI_STORE_RESULT);
+ $links = array($link);
+ $errors = array($link);
+ $reject = array($link);
+ poll_async(12, $link, $links, $errors, $reject, 1, false);
+ mysqli_close($link);
+
+ $link = get_connection();
+ $link->query("SELECT 2 AS _two", MYSQLI_ASYNC | MYSQLI_USE_RESULT);
+ $links = array($link);
+ $errors = array($link);
+ $reject = array($link);
+ poll_async(13, $link, $links, $errors, $reject, 1, true);
+ mysqli_close($link);
+
+ print "done!";
?>
--EXPECT--
[012 + 2] array (
diff --git a/ext/mysqli/tests/mysqli_reconnect.phpt b/ext/mysqli/tests/mysqli_reconnect.phpt
index 606d380285..0ad110f0df 100644
--- a/ext/mysqli/tests/mysqli_reconnect.phpt
+++ b/ext/mysqli/tests/mysqli_reconnect.phpt
@@ -12,119 +12,119 @@ if (stristr(mysqli_get_client_info(), 'mysqlnd'))
mysqli.reconnect=1
--FILE--
<?php
- require_once("connect.inc");
- require_once("table.inc");
+ require_once("connect.inc");
+ require_once("table.inc");
- if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot create second database connection, [%d] %s\n",
- mysqli_connect_errno(), mysqli_connect_error());
+ if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot create second database connection, [%d] %s\n",
+ mysqli_connect_errno(), mysqli_connect_error());
- $thread_id_timeout = mysqli_thread_id($link);
- $thread_id_control = mysqli_thread_id($link2);
+ $thread_id_timeout = mysqli_thread_id($link);
+ $thread_id_control = mysqli_thread_id($link2);
- if (!$res = mysqli_query($link2, "SHOW FULL PROCESSLIST"))
- printf("[002] Cannot get full processlist, [%d] %s\n",
- mysqli_errno($link2), mysqli_error($link));
-
- $running_threads = array();
- while ($row = mysqli_fetch_assoc($res))
- $running_threads[$row['Id']] = $row;
- mysqli_free_result($res);
-
- if (!isset($running_threads[$thread_id_timeout]) ||
- !isset($running_threads[$thread_id_control]))
- printf("[003] Processlist is borked, [%d] %s\n",
- mysqli_errno($link2), mysqli_error($link));
-
- if (!mysqli_query($link, "SET SESSION wait_timeout = 2"))
- printf("[004] Cannot set wait_timeout, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!$res = mysqli_query($link, "SHOW VARIABLES LIKE 'wait_timeout'"))
- printf("[005] Cannot check if wait_timeout has been set, [%d] %s\n",
- mysqli_errno($link), mysqli_error($link));
-
- if (!$row = mysqli_fetch_assoc($res))
- printf("[006] Cannot get wait_timeout, [%d] %s\n",
- mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
-
- if ($row['Value'] != 2)
- printf("[007] Failed setting the wait_timeout, test will not work, [%d] %s\n",
- mysqli_errno($link), mysqli_error($link));
-
- // after 2+ seconds the server should kill the connection
- sleep(3);
-
- if (!$res = mysqli_query($link2, "SHOW FULL PROCESSLIST"))
- printf("[008] Cannot get full processlist, [%d] %s\n",
- mysqli_errno($link2), mysqli_error($link));
-
- $running_threads = array();
- while ($row = mysqli_fetch_assoc($res))
- $running_threads[$row['Id']] = $row;
- mysqli_free_result($res);
-
- if (isset($running_threads[$thread_id_timeout]))
- printf("[009] Server should have killed the timeout connection, [%d] %s\n",
- mysqli_errno($link2), mysqli_error($link));
-
- if (true !== mysqli_ping($link))
- printf("[010] Reconnect should have happened");
-
- if (!$res = mysqli_query($link, "SELECT DATABASE() as _dbname"))
- printf("[011] Cannot get database name, [%d] %s\n",
- mysqli_errno($link), mysqli_error($link));
-
- if (!$row = mysqli_fetch_assoc($res))
- printf("[012] Cannot get database name, [%d] %s\n",
- mysqli_errno($link), mysqli_error($link));
-
- mysqli_free_result($res);
- if ($row['_dbname'] != $db)
- printf("[013] Connection should has been made to DB/Schema '%s', expecting '%s', [%d] %s\n",
- $row['_dbname'], $db, mysqli_errno($link), mysqli_error($link));
-
- // ... and now we try KILL
- $thread_id_timeout = mysqli_thread_id($link);
-
- if (!mysqli_query($link2, sprintf('KILL %d', $thread_id_timeout)))
- printf("[014] Cannot KILL timeout connection, [%d] %s\n", mysqli_errno($link2), mysqli_error($link2));
- // Give the server a second to really kill the other thread...
- sleep(1);
-
- if (!$res = mysqli_query($link2, "SHOW FULL PROCESSLIST"))
- printf("[015] Cannot get full processlist, [%d] %s\n",
- mysqli_errno($link2), mysqli_error($link));
-
- $running_threads = array();
- while ($row = mysqli_fetch_assoc($res))
- $running_threads[$row['Id']] = $row;
- mysqli_free_result($res);
-
- if (isset($running_threads[$thread_id_timeout]) ||
- !isset($running_threads[$thread_id_control]))
- printf("[016] Processlist is borked, [%d] %s\n",
- mysqli_errno($link2), mysqli_error($link));
-
- if (true !== ($tmp = mysqli_ping($link)))
- printf("[017] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
-
- if (!$res = mysqli_query($link, "SELECT DATABASE() as _dbname"))
- printf("[018] Cannot get database name, [%d] %s\n",
- mysqli_errno($link), mysqli_error($link));
-
- if (!$row = mysqli_fetch_assoc($res))
- printf("[019] Cannot get database name, [%d] %s\n",
- mysqli_errno($link), mysqli_error($link));
-
- mysqli_free_result($res);
- if ($row['_dbname'] != $db)
- printf("[020] Connection should has been made to DB/Schema '%s', expecting '%s', [%d] %s\n",
- $row['_dbname'], $db, mysqli_errno($link), mysqli_error($link));
-
- mysqli_close($link);
- mysqli_close($link2);
- print "done!";
+ if (!$res = mysqli_query($link2, "SHOW FULL PROCESSLIST"))
+ printf("[002] Cannot get full processlist, [%d] %s\n",
+ mysqli_errno($link2), mysqli_error($link));
+
+ $running_threads = array();
+ while ($row = mysqli_fetch_assoc($res))
+ $running_threads[$row['Id']] = $row;
+ mysqli_free_result($res);
+
+ if (!isset($running_threads[$thread_id_timeout]) ||
+ !isset($running_threads[$thread_id_control]))
+ printf("[003] Processlist is borked, [%d] %s\n",
+ mysqli_errno($link2), mysqli_error($link));
+
+ if (!mysqli_query($link, "SET SESSION wait_timeout = 2"))
+ printf("[004] Cannot set wait_timeout, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!$res = mysqli_query($link, "SHOW VARIABLES LIKE 'wait_timeout'"))
+ printf("[005] Cannot check if wait_timeout has been set, [%d] %s\n",
+ mysqli_errno($link), mysqli_error($link));
+
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[006] Cannot get wait_timeout, [%d] %s\n",
+ mysqli_errno($link), mysqli_error($link));
+ mysqli_free_result($res);
+
+ if ($row['Value'] != 2)
+ printf("[007] Failed setting the wait_timeout, test will not work, [%d] %s\n",
+ mysqli_errno($link), mysqli_error($link));
+
+ // after 2+ seconds the server should kill the connection
+ sleep(3);
+
+ if (!$res = mysqli_query($link2, "SHOW FULL PROCESSLIST"))
+ printf("[008] Cannot get full processlist, [%d] %s\n",
+ mysqli_errno($link2), mysqli_error($link));
+
+ $running_threads = array();
+ while ($row = mysqli_fetch_assoc($res))
+ $running_threads[$row['Id']] = $row;
+ mysqli_free_result($res);
+
+ if (isset($running_threads[$thread_id_timeout]))
+ printf("[009] Server should have killed the timeout connection, [%d] %s\n",
+ mysqli_errno($link2), mysqli_error($link));
+
+ if (true !== mysqli_ping($link))
+ printf("[010] Reconnect should have happened");
+
+ if (!$res = mysqli_query($link, "SELECT DATABASE() as _dbname"))
+ printf("[011] Cannot get database name, [%d] %s\n",
+ mysqli_errno($link), mysqli_error($link));
+
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[012] Cannot get database name, [%d] %s\n",
+ mysqli_errno($link), mysqli_error($link));
+
+ mysqli_free_result($res);
+ if ($row['_dbname'] != $db)
+ printf("[013] Connection should has been made to DB/Schema '%s', expecting '%s', [%d] %s\n",
+ $row['_dbname'], $db, mysqli_errno($link), mysqli_error($link));
+
+ // ... and now we try KILL
+ $thread_id_timeout = mysqli_thread_id($link);
+
+ if (!mysqli_query($link2, sprintf('KILL %d', $thread_id_timeout)))
+ printf("[014] Cannot KILL timeout connection, [%d] %s\n", mysqli_errno($link2), mysqli_error($link2));
+ // Give the server a second to really kill the other thread...
+ sleep(1);
+
+ if (!$res = mysqli_query($link2, "SHOW FULL PROCESSLIST"))
+ printf("[015] Cannot get full processlist, [%d] %s\n",
+ mysqli_errno($link2), mysqli_error($link));
+
+ $running_threads = array();
+ while ($row = mysqli_fetch_assoc($res))
+ $running_threads[$row['Id']] = $row;
+ mysqli_free_result($res);
+
+ if (isset($running_threads[$thread_id_timeout]) ||
+ !isset($running_threads[$thread_id_control]))
+ printf("[016] Processlist is borked, [%d] %s\n",
+ mysqli_errno($link2), mysqli_error($link));
+
+ if (true !== ($tmp = mysqli_ping($link)))
+ printf("[017] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!$res = mysqli_query($link, "SELECT DATABASE() as _dbname"))
+ printf("[018] Cannot get database name, [%d] %s\n",
+ mysqli_errno($link), mysqli_error($link));
+
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[019] Cannot get database name, [%d] %s\n",
+ mysqli_errno($link), mysqli_error($link));
+
+ mysqli_free_result($res);
+ if ($row['_dbname'] != $db)
+ printf("[020] Connection should has been made to DB/Schema '%s', expecting '%s', [%d] %s\n",
+ $row['_dbname'], $db, mysqli_errno($link), mysqli_error($link));
+
+ mysqli_close($link);
+ mysqli_close($link2);
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_release_savepoint.phpt b/ext/mysqli/tests/mysqli_release_savepoint.phpt
index e6417288d4..a8b2cb1cf2 100644
--- a/ext/mysqli/tests/mysqli_release_savepoint.phpt
+++ b/ext/mysqli/tests/mysqli_release_savepoint.phpt
@@ -15,61 +15,48 @@ if (!have_innodb($link))
?>
--FILE--
<?php
- require_once("connect.inc");
- /* {{{ proto bool mysqli_release_savepoint(object link, string name) */
- $tmp = NULL;
- $link = NULL;
+ require_once("connect.inc");
+ /* {{{ proto bool mysqli_release_savepoint(object link, string name) */
+ $tmp = NULL;
+ $link = NULL;
- if (!is_null($tmp = @mysqli_release_savepoint()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (!is_null($tmp = @mysqli_release_savepoint($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_release_savepoint($link, '')))
+ printf("[006] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $name = array();
- if (!is_null($tmp = @mysqli_release_savepoint($link, $name)))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB'))
+ printf("[008] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_null($tmp = @mysqli_release_savepoint($link, 'foo', $link)))
- printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_autocommit($link, false)))
+ printf("[009] Cannot turn off autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp);
- if (false !== ($tmp = mysqli_release_savepoint($link, '')))
- printf("[006] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ /* note that there is no savepoint my... */
+ if (true !== ($tmp = mysqli_release_savepoint($link, 'my')))
+ printf("[010] Got %s - [%d] %s\n", var_dump($tmp, true), mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)'))
+ printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB'))
- printf("[008] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_commit($link);
+ if ($tmp !== true)
+ printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (true !== ($tmp = mysqli_autocommit($link, false)))
- printf("[009] Cannot turn off autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_savepoint($link, 'my')))
+ printf("[013] Got %s - [%d] %s\n", var_dump($tmp, true), mysqli_errno($link), mysqli_error($link));
- /* note that there is no savepoint my... */
- if (true !== ($tmp = mysqli_release_savepoint($link, 'my')))
- printf("[010] Got %s - [%d] %s\n", var_dump($tmp, true), mysqli_errno($link), mysqli_error($link));
+ $res = mysqli_query($link, "SELECT * FROM test");
+ var_dump($res->fetch_assoc());
- if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)'))
- printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (true !== ($tmp = mysqli_release_savepoint($link, 'my')))
+ printf("[014] Got %s - [%d] %s\n", var_dump($tmp, true), mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_commit($link);
- if ($tmp !== true)
- printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- if (true !== ($tmp = mysqli_savepoint($link, 'my')))
- printf("[013] Got %s - [%d] %s\n", var_dump($tmp, true), mysqli_errno($link), mysqli_error($link));
-
- $res = mysqli_query($link, "SELECT * FROM test");
- var_dump($res->fetch_assoc());
-
- if (true !== ($tmp = mysqli_release_savepoint($link, 'my')))
- printf("[014] Got %s - [%d] %s\n", var_dump($tmp, true), mysqli_errno($link), mysqli_error($link));
-
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_report.phpt b/ext/mysqli/tests/mysqli_report.phpt
index 889fda5fbd..17baea0f66 100644
--- a/ext/mysqli/tests/mysqli_report.phpt
+++ b/ext/mysqli/tests/mysqli_report.phpt
@@ -8,276 +8,269 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
-
- if (NULL !== ($tmp = @mysqli_report()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (true !== ($tmp = mysqli_report(-1)))
- printf("[002] Expecting boolean/true even for invalid flags, got %s/%s\n", gettype($tmp), $tmp);
-
- if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_ERROR)))
- printf("[003] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_STRICT)))
- printf("[004] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_INDEX)))
- printf("[005] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_ALL)))
- printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_OFF)))
- printf("[008] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- require('table.inc');
-
- /*
- Internal macro MYSQL_REPORT_ERROR
- */
- mysqli_report(MYSQLI_REPORT_ERROR);
-
- mysqli_multi_query($link, "BAR; FOO;");
- mysqli_query($link, "FOO");
- mysqli_kill($link, -1);
-
- // mysqli_ping() cannot be tested, because one would need to cause an error inside the C function to test it
- mysqli_prepare($link, "FOO");
- mysqli_real_query($link, "FOO");
- if (@mysqli_select_db($link, "Oh lord, let this be an unknown database name"))
- printf("[009] select_db should have failed\n");
- // mysqli_store_result() and mysqli_use_result() cannot be tested, because one would need to cause an error inside the C function to test it
-
-
- // Check that none of the above would have caused any error messages if MYSQL_REPORT_ERROR would
- // not have been set. If that would be the case, the test would be broken.
- mysqli_report(MYSQLI_REPORT_OFF);
-
- mysqli_multi_query($link, "BAR; FOO;");
- mysqli_query($link, "FOO");
- mysqli_kill($link, -1);
- mysqli_prepare($link, "FOO");
- mysqli_real_query($link, "FOO");
- mysqli_select_db($link, "Oh lord, let this be an unknown database name");
-
- /*
- Internal macro MYSQL_REPORT_STMT_ERROR
- */
-
- mysqli_report(MYSQLI_REPORT_ERROR);
-
- $stmt = mysqli_stmt_init($link);
- mysqli_stmt_prepare($stmt, "FOO");
-
- $stmt = mysqli_stmt_init($link);
- mysqli_stmt_prepare($stmt, "SELECT id FROM test WHERE id > ?");
- $id = 1;
- mysqli_kill($link, mysqli_thread_id($link));
- mysqli_stmt_bind_param($stmt, "i", $id);
- mysqli_stmt_close($stmt);
- mysqli_close($link);
-
- /* mysqli_stmt_execute() = mysql_stmt_execute cannot be tested from PHP */
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[008] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- $stmt = mysqli_stmt_init($link);
- mysqli_stmt_prepare($stmt, "SELECT id FROM test WHERE id > ?");
- $id = 1;
- mysqli_stmt_bind_param($stmt, "i", $id);
- // mysqli_kill($link, mysqli_thread_id($link));
- mysqli_stmt_execute($stmt);
- mysqli_stmt_close($stmt);
- mysqli_close($link);
-
- /* mysqli_kill() "trick" does not work for any of the following because of an E_COMMANDS_OUT_OF_SYNC */
- /* mysqli_stmt_bind_result() = mysql_stmt_bind_result() cannot be tested from PHP */
- /* mysqli_stmt_fetch() = mysql_stmt_fetch() cannot be tested from PHP */
- /* mysqli_stmt_result_metadata() = mysql_stmt_result_metadata() cannot be tested from PHP */
- /* mysqli_stmt_store_result() = mysql_stmt_store_result() cannot be tested from PHP */
-
- // Check
- mysqli_report(MYSQLI_REPORT_OFF);
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[010] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- $stmt = mysqli_stmt_init($link);
- mysqli_stmt_prepare($stmt, "FOO");
-
- $stmt = mysqli_stmt_init($link);
- mysqli_stmt_prepare($stmt, "SELECT id FROM test WHERE id > ?");
- $id = 1;
- mysqli_kill($link, mysqli_thread_id($link));
- mysqli_stmt_bind_param($stmt, "i", $id);
- mysqli_stmt_close($stmt);
- mysqli_close($link);
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[011] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- $stmt = mysqli_stmt_init($link);
- mysqli_stmt_prepare($stmt, "SELECT id FROM test WHERE id > ?");
- $id = 1;
- mysqli_stmt_bind_param($stmt, "i", $id);
- mysqli_kill($link, mysqli_thread_id($link));
- mysqli_stmt_execute($stmt);
- mysqli_stmt_close($stmt);
- mysqli_close($link);
-
- /*
- MYSQLI_REPORT_STRICT
-
- MYSQLI_REPORT_STRICT --->
- php_mysqli_report_error() ->
- MYSQLI_REPORT_MYSQL_ERROR,
- MYSQLI_REPORT_STMT_ERROR ->
- already tested
-
- php_mysqli_throw_sql_exception() ->
- my_mysqli_real_connect()
- my_mysqli_connect()
-
- can't be tested: mysqli_query() via mysql_use_result()/mysql_store_result()
- */
- mysqli_report(MYSQLI_REPORT_OFF);
- mysqli_report(MYSQLI_REPORT_STRICT);
-
- try {
-
- if ($link = my_mysqli_connect($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket))
- printf("[012] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
- $host, $user . 'unknown_really', $db, $port, $socket);
- mysqli_close($link);
-
- } catch (mysqli_sql_exception $e) {
- printf("[013] %s\n", $e->getMessage());
- }
-
- try {
- if (!$link = mysqli_init())
- printf("[014] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
-
- if ($link = my_mysqli_real_connect($link, $host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket))
- printf("[015] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
- $host, $user . 'unknown_really', $db, $port, $socket);
- mysqli_close($link);
- } catch (mysqli_sql_exception $e) {
- printf("[016] %s\n", $e->getMessage());
- }
-
- /*
- MYSQLI_REPORT_INDEX --->
- mysqli_query()
- mysqli_stmt_execute()
- mysqli_prepare()
- mysqli_real_query()
- mysqli_store_result()
- mysqli_use_result()
-
- No test, because of to many prerequisites:
- - Server needs to be started with and
- --log-slow-queries --log-queries-not-using-indexes
- - query must cause the warning on all MySQL versions
-
- TODO:
- */
- $log_slow_queries = false;
- $log_queries_not_using_indexes = false;
- mysqli_report(MYSQLI_REPORT_OFF);
- mysqli_report(MYSQLI_REPORT_INDEX);
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[017] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
-
- if (mysqli_get_server_version($link) <= 50600) {
- // this might cause a warning - no index used
- if (!$res = @mysqli_query($link, "SHOW VARIABLES LIKE 'log_slow_queries'"))
- printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!$row = mysqli_fetch_assoc($res))
- printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- $log_slow_query = ('ON' == $row['Value']);
-
- if (mysqli_get_server_version($link) >= 50111) {
- // this might cause a warning - no index used
- if (!$res = @mysqli_query($link, "SHOW VARIABLES LIKE 'log_queries_not_using_indexes'"))
- printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!$row = mysqli_fetch_assoc($res))
- printf("[021] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- $log_queries_not_using_indexes = ('ON' == $row['Value']);
-
- if ($log_slow_queries && $log_queries_not_using_indexes) {
-
- for ($i = 100; $i < 20000; $i++) {
- if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES ($i, 'z')"))
- printf("[022 - %d] [%d] %s\n", $i - 99, mysqli_errno($link), mysqli_error($link));
- }
-
- // this might cause a warning - no index used
- if (!$res = @mysqli_query($link, "SELECT id, label FROM test WHERE id = 1323"))
- printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- mysqli_free_result($res);
- }
- }
- }
-
- // Maybe we've provoked an index message, maybe not.
- // All we can do is make a few dummy calls to ensure that all codes gets executed which
- // checks the flag. Functions to check: mysqli_query() - done above,
- // mysqli_stmt_execute(), mysqli_prepare(), mysqli_real_query(), mysqli_store_result()
- // mysqli_use_result(), mysqli_thread_safe(), mysqli_thread_id()
- mysqli_report(MYSQLI_REPORT_OFF);
- mysqli_close($link);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[024] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ require_once("connect.inc");
+
+ if (true !== ($tmp = mysqli_report(-1)))
+ printf("[002] Expecting boolean/true even for invalid flags, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_ERROR)))
+ printf("[003] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_STRICT)))
+ printf("[004] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_INDEX)))
+ printf("[005] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_ALL)))
+ printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_OFF)))
+ printf("[008] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ require('table.inc');
+
+ /*
+ Internal macro MYSQL_REPORT_ERROR
+ */
+ mysqli_report(MYSQLI_REPORT_ERROR);
+
+ mysqli_multi_query($link, "BAR; FOO;");
+ mysqli_query($link, "FOO");
+ mysqli_kill($link, -1);
+
+ // mysqli_ping() cannot be tested, because one would need to cause an error inside the C function to test it
+ mysqli_prepare($link, "FOO");
+ mysqli_real_query($link, "FOO");
+ if (@mysqli_select_db($link, "Oh lord, let this be an unknown database name"))
+ printf("[009] select_db should have failed\n");
+ // mysqli_store_result() and mysqli_use_result() cannot be tested, because one would need to cause an error inside the C function to test it
+
+
+ // Check that none of the above would have caused any error messages if MYSQL_REPORT_ERROR would
+ // not have been set. If that would be the case, the test would be broken.
+ mysqli_report(MYSQLI_REPORT_OFF);
+
+ mysqli_multi_query($link, "BAR; FOO;");
+ mysqli_query($link, "FOO");
+ mysqli_kill($link, -1);
+ mysqli_prepare($link, "FOO");
+ mysqli_real_query($link, "FOO");
+ mysqli_select_db($link, "Oh lord, let this be an unknown database name");
+
+ /*
+ Internal macro MYSQL_REPORT_STMT_ERROR
+ */
+
+ mysqli_report(MYSQLI_REPORT_ERROR);
+
+ $stmt = mysqli_stmt_init($link);
+ mysqli_stmt_prepare($stmt, "FOO");
+
+ $stmt = mysqli_stmt_init($link);
+ mysqli_stmt_prepare($stmt, "SELECT id FROM test WHERE id > ?");
+ $id = 1;
+ mysqli_kill($link, mysqli_thread_id($link));
+ mysqli_stmt_bind_param($stmt, "i", $id);
+ mysqli_stmt_close($stmt);
+ mysqli_close($link);
+
+ /* mysqli_stmt_execute() = mysql_stmt_execute cannot be tested from PHP */
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[008] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ $stmt = mysqli_stmt_init($link);
+ mysqli_stmt_prepare($stmt, "SELECT id FROM test WHERE id > ?");
+ $id = 1;
+ mysqli_stmt_bind_param($stmt, "i", $id);
+ // mysqli_kill($link, mysqli_thread_id($link));
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_close($stmt);
+ mysqli_close($link);
+
+ /* mysqli_kill() "trick" does not work for any of the following because of an E_COMMANDS_OUT_OF_SYNC */
+ /* mysqli_stmt_bind_result() = mysql_stmt_bind_result() cannot be tested from PHP */
+ /* mysqli_stmt_fetch() = mysql_stmt_fetch() cannot be tested from PHP */
+ /* mysqli_stmt_result_metadata() = mysql_stmt_result_metadata() cannot be tested from PHP */
+ /* mysqli_stmt_store_result() = mysql_stmt_store_result() cannot be tested from PHP */
+
+ // Check
+ mysqli_report(MYSQLI_REPORT_OFF);
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[010] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ $stmt = mysqli_stmt_init($link);
+ mysqli_stmt_prepare($stmt, "FOO");
+
+ $stmt = mysqli_stmt_init($link);
+ mysqli_stmt_prepare($stmt, "SELECT id FROM test WHERE id > ?");
+ $id = 1;
+ mysqli_kill($link, mysqli_thread_id($link));
+ mysqli_stmt_bind_param($stmt, "i", $id);
+ mysqli_stmt_close($stmt);
+ mysqli_close($link);
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[011] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ $stmt = mysqli_stmt_init($link);
+ mysqli_stmt_prepare($stmt, "SELECT id FROM test WHERE id > ?");
+ $id = 1;
+ mysqli_stmt_bind_param($stmt, "i", $id);
+ mysqli_kill($link, mysqli_thread_id($link));
+ mysqli_stmt_execute($stmt);
+ mysqli_stmt_close($stmt);
+ mysqli_close($link);
+
+ /*
+ MYSQLI_REPORT_STRICT
+
+ MYSQLI_REPORT_STRICT --->
+ php_mysqli_report_error() ->
+ MYSQLI_REPORT_MYSQL_ERROR,
+ MYSQLI_REPORT_STMT_ERROR ->
+ already tested
+
+ php_mysqli_throw_sql_exception() ->
+ my_mysqli_real_connect()
+ my_mysqli_connect()
+
+ can't be tested: mysqli_query() via mysql_use_result()/mysql_store_result()
+ */
+ mysqli_report(MYSQLI_REPORT_OFF);
+ mysqli_report(MYSQLI_REPORT_STRICT);
+
+ try {
+
+ if ($link = my_mysqli_connect($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket))
+ printf("[012] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
+ $host, $user . 'unknown_really', $db, $port, $socket);
+ mysqli_close($link);
+
+ } catch (mysqli_sql_exception $e) {
+ printf("[013] %s\n", $e->getMessage());
+ }
+
+ try {
+ if (!$link = mysqli_init())
+ printf("[014] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+
+ if ($link = my_mysqli_real_connect($link, $host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket))
+ printf("[015] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
+ $host, $user . 'unknown_really', $db, $port, $socket);
+ mysqli_close($link);
+ } catch (mysqli_sql_exception $e) {
+ printf("[016] %s\n", $e->getMessage());
+ }
+
+ /*
+ MYSQLI_REPORT_INDEX --->
+ mysqli_query()
+ mysqli_stmt_execute()
+ mysqli_prepare()
+ mysqli_real_query()
+ mysqli_store_result()
+ mysqli_use_result()
+
+ No test, because of to many prerequisites:
+ - Server needs to be started with and
+ --log-slow-queries --log-queries-not-using-indexes
+ - query must cause the warning on all MySQL versions
+
+ TODO:
+ */
+ $log_slow_queries = false;
+ $log_queries_not_using_indexes = false;
+ mysqli_report(MYSQLI_REPORT_OFF);
+ mysqli_report(MYSQLI_REPORT_INDEX);
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[017] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+
+ if (mysqli_get_server_version($link) <= 50600) {
+ // this might cause a warning - no index used
+ if (!$res = @mysqli_query($link, "SHOW VARIABLES LIKE 'log_slow_queries'"))
+ printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ $log_slow_query = ('ON' == $row['Value']);
+
+ if (mysqli_get_server_version($link) >= 50111) {
+ // this might cause a warning - no index used
+ if (!$res = @mysqli_query($link, "SHOW VARIABLES LIKE 'log_queries_not_using_indexes'"))
+ printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[021] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ $log_queries_not_using_indexes = ('ON' == $row['Value']);
+
+ if ($log_slow_queries && $log_queries_not_using_indexes) {
+
+ for ($i = 100; $i < 20000; $i++) {
+ if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES ($i, 'z')"))
+ printf("[022 - %d] [%d] %s\n", $i - 99, mysqli_errno($link), mysqli_error($link));
+ }
+
+ // this might cause a warning - no index used
+ if (!$res = @mysqli_query($link, "SELECT id, label FROM test WHERE id = 1323"))
+ printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ mysqli_free_result($res);
+ }
+ }
+ }
- if (!$stmt = mysqli_stmt_init($link))
- printf("[025] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ // Maybe we've provoked an index message, maybe not.
+ // All we can do is make a few dummy calls to ensure that all codes gets executed which
+ // checks the flag. Functions to check: mysqli_query() - done above,
+ // mysqli_stmt_execute(), mysqli_prepare(), mysqli_real_query(), mysqli_store_result()
+ // mysqli_use_result(), mysqli_thread_safe(), mysqli_thread_id()
+ mysqli_report(MYSQLI_REPORT_OFF);
+ mysqli_close($link);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[024] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test'))
- printf("[026] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[025] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_stmt_execute($stmt))
- printf("[027] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test'))
+ printf("[026] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_close($stmt);
+ if (!mysqli_stmt_execute($stmt))
+ printf("[027] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_real_query($link, 'SELECT label, id FROM test'))
- printf("[028] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_stmt_close($stmt);
- if (!$res = mysqli_use_result($link))
- printf("[029] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_real_query($link, 'SELECT label, id FROM test'))
+ printf("[028] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
+ if (!$res = mysqli_use_result($link))
+ printf("[029] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_real_query($link, 'SELECT label, id FROM test'))
- printf("[030] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_free_result($res);
- if (!$res = mysqli_store_result($link))
- printf("[031] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_real_query($link, 'SELECT label, id FROM test'))
+ printf("[030] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
+ if (!$res = mysqli_store_result($link))
+ printf("[031] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$stmt = mysqli_prepare($link, 'SELECT id * 3 FROM test'))
- printf("[032] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- else
- mysqli_stmt_close($stmt);
+ mysqli_free_result($res);
- if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, 'z')", MYSQLI_USE_RESULT) ||
- !mysqli_query($link, 'DELETE FROM test WHERE id > 50', MYSQLI_USE_RESULT))
- printf("[033] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_prepare($link, 'SELECT id * 3 FROM test'))
+ printf("[032] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ else
+ mysqli_stmt_close($stmt);
- $tmp = mysqli_thread_safe($link);
- $tmp = mysqli_thread_id($link);
+ if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, 'z')", MYSQLI_USE_RESULT) ||
+ !mysqli_query($link, 'DELETE FROM test WHERE id > 50', MYSQLI_USE_RESULT))
+ printf("[033] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_close($link);
- print "done!";
+ $tmp = mysqli_thread_id($link);
+
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_report_new.phpt b/ext/mysqli/tests/mysqli_report_new.phpt
index 0717aaf73b..5bfa260c9e 100644
--- a/ext/mysqli/tests/mysqli_report_new.phpt
+++ b/ext/mysqli/tests/mysqli_report_new.phpt
@@ -16,29 +16,29 @@ if (mysqli_get_server_version($link) < 50600)
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- require('table.inc');
+ require('table.inc');
- /*
- Internal macro MYSQL_REPORT_ERROR
- */
- mysqli_report(MYSQLI_REPORT_ERROR);
+ /*
+ Internal macro MYSQL_REPORT_ERROR
+ */
+ mysqli_report(MYSQLI_REPORT_ERROR);
- mysqli_change_user($link, "0123456789-10-456789-20-456789-30-456789-40-456789-50-456789-60-456789-70-456789-80-456789-90-456789", "password", $db);
+ mysqli_change_user($link, "0123456789-10-456789-20-456789-30-456789-40-456789-50-456789-60-456789-70-456789-80-456789-90-456789", "password", $db);
- mysqli_report(MYSQLI_REPORT_OFF);
+ mysqli_report(MYSQLI_REPORT_OFF);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- mysqli_change_user($link, "This might work if you accept anonymous users in your setup", "password", $db);
+ mysqli_change_user($link, "This might work if you accept anonymous users in your setup", "password", $db);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_report_wo_ps.phpt b/ext/mysqli/tests/mysqli_report_wo_ps.phpt
index 535efb1fac..bf7d4500e5 100644
--- a/ext/mysqli/tests/mysqli_report_wo_ps.phpt
+++ b/ext/mysqli/tests/mysqli_report_wo_ps.phpt
@@ -15,86 +15,86 @@ if (mysqli_get_server_version($link) >= 50600)
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (true !== ($tmp = mysqli_report(-1)))
- printf("[002] Expecting boolean/true even for invalid flags, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_report(-1)))
+ printf("[002] Expecting boolean/true even for invalid flags, got %s/%s\n", gettype($tmp), $tmp);
- if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_ERROR)))
- printf("[003] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_ERROR)))
+ printf("[003] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_STRICT)))
- printf("[004] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_STRICT)))
+ printf("[004] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_INDEX)))
- printf("[005] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_INDEX)))
+ printf("[005] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_ALL)))
- printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_ALL)))
+ printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_OFF)))
- printf("[008] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_report(MYSQLI_REPORT_OFF)))
+ printf("[008] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ require('table.inc');
- /*
- Internal macro MYSQL_REPORT_ERROR
- */
- mysqli_report(MYSQLI_REPORT_ERROR);
+ /*
+ Internal macro MYSQL_REPORT_ERROR
+ */
+ mysqli_report(MYSQLI_REPORT_ERROR);
- mysqli_multi_query($link, "BAR; FOO;");
- mysqli_query($link, "FOO");
- mysqli_change_user($link, "0123456789-10-456789-20-456789-30-456789-40-456789-50-456789-60-456789-70-456789-80-456789-90-456789", "password", $db);
- mysqli_kill($link, -1);
+ mysqli_multi_query($link, "BAR; FOO;");
+ mysqli_query($link, "FOO");
+ mysqli_change_user($link, "0123456789-10-456789-20-456789-30-456789-40-456789-50-456789-60-456789-70-456789-80-456789-90-456789", "password", $db);
+ mysqli_kill($link, -1);
- // mysqli_ping() cannot be tested, because one would need to cause an error inside the C function to test it
- mysqli_real_query($link, "FOO");
- if (@mysqli_select_db($link, "Oh lord, let this be an unknown database name"))
- printf("[009] select_db should have failed\n");
- // mysqli_store_result() and mysqli_use_result() cannot be tested, because one would need to cause an error inside the C function to test it
+ // mysqli_ping() cannot be tested, because one would need to cause an error inside the C function to test it
+ mysqli_real_query($link, "FOO");
+ if (@mysqli_select_db($link, "Oh lord, let this be an unknown database name"))
+ printf("[009] select_db should have failed\n");
+ // mysqli_store_result() and mysqli_use_result() cannot be tested, because one would need to cause an error inside the C function to test it
- // Check that none of the above would have caused any error messages if MYSQL_REPORT_ERROR would
- // not have been set. If that would be the case, the test would be broken.
- mysqli_report(MYSQLI_REPORT_OFF);
+ // Check that none of the above would have caused any error messages if MYSQL_REPORT_ERROR would
+ // not have been set. If that would be the case, the test would be broken.
+ mysqli_report(MYSQLI_REPORT_OFF);
- mysqli_multi_query($link, "BAR; FOO;");
- mysqli_query($link, "FOO");
- mysqli_change_user($link, "This might work if you accept anonymous users in your setup", "password", $db);
- mysqli_kill($link, -1);
- mysqli_real_query($link, "FOO");
- mysqli_select_db($link, "Oh lord, let this be an unknown database name");
+ mysqli_multi_query($link, "BAR; FOO;");
+ mysqli_query($link, "FOO");
+ mysqli_change_user($link, "This might work if you accept anonymous users in your setup", "password", $db);
+ mysqli_kill($link, -1);
+ mysqli_real_query($link, "FOO");
+ mysqli_select_db($link, "Oh lord, let this be an unknown database name");
- mysqli_report(MYSQLI_REPORT_OFF);
- mysqli_report(MYSQLI_REPORT_STRICT);
+ mysqli_report(MYSQLI_REPORT_OFF);
+ mysqli_report(MYSQLI_REPORT_STRICT);
- try {
+ try {
- if ($link = my_mysqli_connect($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket))
- printf("[010] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
- $host, $user . 'unknown_really', $db, $port, $socket);
- mysqli_close($link);
+ if ($link = my_mysqli_connect($host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket))
+ printf("[010] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
+ $host, $user . 'unknown_really', $db, $port, $socket);
+ mysqli_close($link);
- } catch (mysqli_sql_exception $e) {
- printf("[011] %s\n", $e->getMessage());
- }
+ } catch (mysqli_sql_exception $e) {
+ printf("[011] %s\n", $e->getMessage());
+ }
- try {
- if (!$link = mysqli_init())
- printf("[012] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+ try {
+ if (!$link = mysqli_init())
+ printf("[012] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
- if ($link = my_mysqli_real_connect($link, $host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket))
- printf("[013] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
- $host, $user . 'unknown_really', $db, $port, $socket);
- mysqli_close($link);
- } catch (mysqli_sql_exception $e) {
- printf("[014] %s\n", $e->getMessage());
- }
+ if ($link = my_mysqli_real_connect($link, $host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket))
+ printf("[013] Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n",
+ $host, $user . 'unknown_really', $db, $port, $socket);
+ mysqli_close($link);
+ } catch (mysqli_sql_exception $e) {
+ printf("[014] %s\n", $e->getMessage());
+ }
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_result_invalid_mode.phpt b/ext/mysqli/tests/mysqli_result_invalid_mode.phpt
index 29ff65780c..9f902920db 100644
--- a/ext/mysqli/tests/mysqli_result_invalid_mode.phpt
+++ b/ext/mysqli/tests/mysqli_result_invalid_mode.phpt
@@ -8,18 +8,18 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require('connect.inc');
- require('table.inc');
+ require('connect.inc');
+ require('table.inc');
- $valid = array(MYSQLI_STORE_RESULT, MYSQLI_USE_RESULT);
- do {
- $mode = mt_rand(-1000, 1000);
- } while (in_array($mode, $valid));
+ $valid = array(MYSQLI_STORE_RESULT, MYSQLI_USE_RESULT);
+ do {
+ $mode = mt_rand(-1000, 1000);
+ } while (in_array($mode, $valid));
- if (!is_object($res = new mysqli_result($link, $mode)))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!is_object($res = new mysqli_result($link, $mode)))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_result_references.phpt b/ext/mysqli/tests/mysqli_result_references.phpt
index d4fe48816a..7084955380 100644
--- a/ext/mysqli/tests/mysqli_result_references.phpt
+++ b/ext/mysqli/tests/mysqli_result_references.phpt
@@ -8,73 +8,74 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once('connect.inc');
- require_once('table.inc');
+ require_once('connect.inc');
+ require_once('table.inc');
- $references = array();
+ $references = array();
- if (!(mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2")) ||
- !($res = mysqli_store_result($link)))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!(mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2")) ||
+ !($res = mysqli_store_result($link)))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $idx = 0;
- while ($row = mysqli_fetch_assoc($res)) {
- /* mysqlnd: force separation - create copies */
- $references[$idx] = array(
- 'id' => &$row['id'],
- 'label' => $row['label'] . '');
- $references[$idx++]['id'] += 0;
- }
+ $idx = 0;
+ while ($row = mysqli_fetch_assoc($res)) {
+ /* mysqlnd: force separation - create copies */
+ $references[$idx] = array(
+ 'id' => &$row['id'],
+ 'label' => $row['label'] . '');
+ $references[$idx++]['id'] += 0;
+ }
- mysqli_close($link);
+ mysqli_close($link);
- mysqli_data_seek($res, 0);
- while ($row = mysqli_fetch_assoc($res)) {
- /* mysqlnd: force separation - create copies */
- $references[$idx] = array(
- 'id' => &$row['id'],
- 'label' => $row['label'] . '');
- $references[$idx++]['id'] += 0;
- }
+ mysqli_data_seek($res, 0);
+ while ($row = mysqli_fetch_assoc($res)) {
+ /* mysqlnd: force separation - create copies */
+ $references[$idx] = array(
+ 'id' => &$row['id'],
+ 'label' => $row['label'] . '');
+ $references[$idx++]['id'] += 0;
+ }
- mysqli_free_result($res);
+ mysqli_free_result($res);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (!(mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2")) ||
- !($res = mysqli_use_result($link)))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!(mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2")) ||
+ !($res = mysqli_use_result($link)))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- while ($row = mysqli_fetch_assoc($res)) {
- /* mysqlnd: force separation - create copies*/
- $references[$idx] = array(
- 'id' => &$row['id'],
- 'label' => $row['label'] . '');
- $references[$idx]['id2'] = &$references[$idx]['id'];
- $references[$idx]['id'] += 1;
- $references[$idx++]['id2'] += 1;
- }
+ while ($row = mysqli_fetch_assoc($res)) {
+ /* mysqlnd: force separation - create copies*/
+ $references[$idx] = array(
+ 'id' => &$row['id'],
+ 'label' => $row['label'] . '');
+ $references[$idx]['id2'] = &$references[$idx]['id'];
+ $references[$idx]['id'] += 1;
+ $references[$idx++]['id2'] += 1;
+ }
- $references[$idx++] = &$res;
- mysqli_free_result($res);
- debug_zval_dump($references);
+ $references[$idx++] = &$res;
+ mysqli_free_result($res);
- if (!(mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 1")) ||
- !($res = mysqli_use_result($link)))
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ debug_zval_dump($references);
- $tmp = array();
- while ($row = mysqli_fetch_assoc($res)) {
- $tmp[] = $row;
- }
- $tmp = unserialize(serialize($tmp));
- debug_zval_dump($tmp);
- mysqli_free_result($res);
+ if (!(mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 1")) ||
+ !($res = mysqli_use_result($link)))
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_close($link);
- print "done!";
+ $tmp = array();
+ while ($row = mysqli_fetch_assoc($res)) {
+ $tmp[] = $row;
+ }
+ $tmp = unserialize(serialize($tmp));
+ debug_zval_dump($tmp);
+ mysqli_free_result($res);
+
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_result_references_mysqlnd.phpt b/ext/mysqli/tests/mysqli_result_references_mysqlnd.phpt
index 1a8f44b3f3..d33c89b4dc 100644
--- a/ext/mysqli/tests/mysqli_result_references_mysqlnd.phpt
+++ b/ext/mysqli/tests/mysqli_result_references_mysqlnd.phpt
@@ -12,45 +12,45 @@ if (!$IS_MYSQLND)
require_once('skipifemb.inc'); ?>
--FILE--
<?php
- require_once('connect.inc');
- require_once('table.inc');
+ require_once('connect.inc');
+ require_once('table.inc');
- $references = array();
+ $references = array();
- if (!(mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 1")) ||
- !($res = mysqli_store_result($link)))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!(mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 1")) ||
+ !($res = mysqli_store_result($link)))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $idx = 0;
- while ($row = mysqli_fetch_assoc($res)) {
- /* will overwrite itself */
- $references[$idx]['row_ref'] = &$row;
- $references[$idx]['row_copy'] = $row;
- $references[$idx]['id_ref'] = &$row['id'];
- $references[$idx++]['id_copy'] = $row['id'];
- }
+ $idx = 0;
+ while ($row = mysqli_fetch_assoc($res)) {
+ /* will overwrite itself */
+ $references[$idx]['row_ref'] = &$row;
+ $references[$idx]['row_copy'] = $row;
+ $references[$idx]['id_ref'] = &$row['id'];
+ $references[$idx++]['id_copy'] = $row['id'];
+ }
- debug_zval_dump($references);
- mysqli_free_result($res);
+ debug_zval_dump($references);
+ mysqli_free_result($res);
- if (!(mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2")) ||
- !($res = mysqli_use_result($link)))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!(mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2")) ||
+ !($res = mysqli_use_result($link)))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $rows = array();
- for ($i = 0; $i < 2; $i++) {
- $rows[$i] = mysqli_fetch_assoc($res);
- $references[$idx]['row_ref'] = &$rows[$i];
- $references[$idx]['row_copy'] = $rows[$i];
- $references[$idx]['id_ref'] = &$rows[$i]['id'];
- $references[$idx]['id_copy'] = $rows[$i]['id'];
- /* enforce separation */
- $references[$idx]['id_copy_mod']= $rows[$i]['id'] + 0;
- }
- mysqli_free_result($res);
+ $rows = array();
+ for ($i = 0; $i < 2; $i++) {
+ $rows[$i] = mysqli_fetch_assoc($res);
+ $references[$idx]['row_ref'] = &$rows[$i];
+ $references[$idx]['row_copy'] = $rows[$i];
+ $references[$idx]['id_ref'] = &$rows[$i]['id'];
+ $references[$idx]['id_copy'] = $rows[$i]['id'];
+ /* enforce separation */
+ $references[$idx]['id_copy_mod']= $rows[$i]['id'] + 0;
+ }
+ mysqli_free_result($res);
- debug_zval_dump($references);
- print "done!";
+ debug_zval_dump($references);
+ print "done!";
?>
--EXPECTF--
array(1) refcount(%d){
diff --git a/ext/mysqli/tests/mysqli_result_unclonable.phpt b/ext/mysqli/tests/mysqli_result_unclonable.phpt
index 6eff412a1d..06f7d5899d 100644
--- a/ext/mysqli/tests/mysqli_result_unclonable.phpt
+++ b/ext/mysqli/tests/mysqli_result_unclonable.phpt
@@ -8,17 +8,17 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (!($res = mysqli_query($link, "SELECT 'good' AS morning")))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!($res = mysqli_query($link, "SELECT 'good' AS morning")))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $res_clone = clone $res;
- print "done!";
+ $res_clone = clone $res;
+ print "done!";
?>
--EXPECTF--
Fatal error: Uncaught Error: Trying to clone an uncloneable object of class mysqli_result in %s:%d
diff --git a/ext/mysqli/tests/mysqli_rollback.phpt b/ext/mysqli/tests/mysqli_rollback.phpt
index 3a15ebbb79..92ab3e28b5 100644
--- a/ext/mysqli/tests/mysqli_rollback.phpt
+++ b/ext/mysqli/tests/mysqli_rollback.phpt
@@ -15,61 +15,52 @@ mysqli_rollback()
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (!is_null($tmp = @mysqli_rollback()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_autocommit($link, false)))
+ printf("[005] Cannot turn off autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_rollback($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
-
- if (!is_null($tmp = @mysqli_rollback($link, 'foo')))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (true !== ($tmp = mysqli_autocommit($link, false)))
- printf("[005] Cannot turn off autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB'))
- printf("[007] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB'))
+ printf("[007] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)'))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)'))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_rollback($link);
- if ($tmp !== true)
- printf("[009] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ $tmp = mysqli_rollback($link);
+ if ($tmp !== true)
+ printf("[009] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS num FROM test'))
- printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- if (0 != $tmp['num'])
- printf("[12] Expecting 0 rows in table test, found %d rows\n", $tmp['num']);
- mysqli_free_result($res);
+ if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS num FROM test'))
+ printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ if (0 != $tmp['num'])
+ printf("[12] Expecting 0 rows in table test, found %d rows\n", $tmp['num']);
+ mysqli_free_result($res);
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
- printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
+ printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_close($link);
+ mysqli_close($link);
- if (false !== ($tmp = mysqli_rollback($link)))
- printf("[014] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ try {
+ mysqli_rollback($link);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- print "done!\n";
+ print "done!\n";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
---EXPECTF--
-Warning: mysqli_rollback(): Couldn't fetch mysqli in %s on line %d
+--EXPECT--
+mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_savepoint.phpt b/ext/mysqli/tests/mysqli_savepoint.phpt
index 866d96aa98..0da27b8caf 100644
--- a/ext/mysqli/tests/mysqli_savepoint.phpt
+++ b/ext/mysqli/tests/mysqli_savepoint.phpt
@@ -15,52 +15,37 @@ if (!have_innodb($link))
?>
--FILE--
<?php
- require_once("connect.inc");
- /* {{{ proto bool mysqli_savepoint(object link, string name) */
- $tmp = NULL;
- $link = NULL;
+ require_once("connect.inc");
+ /* {{{ proto bool mysqli_savepoint(object link, string name) */
- if (!is_null($tmp = @mysqli_savepoint()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (!is_null($tmp = @mysqli_savepoint($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_savepoint($link, '')))
+ printf("[006] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $name = array();
- if (!is_null($tmp = @mysqli_savepoint($link, $name)))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB'))
+ printf("[008] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_null($tmp = @mysqli_savepoint($link, 'foo', $link)))
- printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_autocommit($link, false)))
+ printf("[009] Cannot turn off autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp);
- if (false !== ($tmp = mysqli_savepoint($link, '')))
- printf("[006] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ /* overrule autocommit */
+ if (true !== ($tmp = mysqli_savepoint($link, 'my')))
+ printf("[010] Got %s - [%d] %s\n", var_dump($tmp, true), mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)'))
+ printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB'))
- printf("[008] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_rollback($link);
+ if ($tmp !== true)
+ printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (true !== ($tmp = mysqli_autocommit($link, false)))
- printf("[009] Cannot turn off autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp);
-
- /* overrule autocommit */
- if (true !== ($tmp = mysqli_savepoint($link, 'my')))
- printf("[010] Got %s - [%d] %s\n", var_dump($tmp, true), mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)'))
- printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- $tmp = mysqli_rollback($link);
- if ($tmp !== true)
- printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_select_db.phpt b/ext/mysqli/tests/mysqli_select_db.phpt
index 041b7fbb22..67716d0664 100644
--- a/ext/mysqli/tests/mysqli_select_db.phpt
+++ b/ext/mysqli/tests/mysqli_select_db.phpt
@@ -8,105 +8,96 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
- require_once("table.inc");
+ require_once("connect.inc");
+ require_once("table.inc");
- $tmp = NULL;
- $link = NULL;
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (!is_null($tmp = @mysqli_select_db()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ /* does not make too much sense, unless we have access to at least one more database than $db */
+ if (!mysqli_select_db($link, $db))
+ printf("[005] Cannot select DB %s, [%d] %s\n", $db, mysqli_errno($link), mysqli_error($link));
- if (!is_null($tmp = @mysqli_select_db($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!$res = mysqli_query($link, "SELECT DATABASE() AS dbname"))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_null($tmp = @mysqli_select_db($link, $db, "foo")))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if ($row['dbname'] !== (string)$db)
+ printf("[008] Expecting database '%s', found '%s'\n", $db, $row['dbname']);
+ mysqli_free_result($res);
- /* does not make too much sense, unless we have access to at least one more database than $db */
- if (!mysqli_select_db($link, $db))
- printf("[005] Cannot select DB %s, [%d] %s\n", $db, mysqli_errno($link), mysqli_error($link));
+ if (mysqli_select_db($link, 'mysql')) {
+ // Yippie, a second database to play with - that's great because mysqli_select_db
+ // ($db) was done by mysqli__connect() already and the previous test
+ // was quite useless
+ if (!$res = mysqli_query($link, "SELECT DATABASE() AS dbname"))
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$res = mysqli_query($link, "SELECT DATABASE() AS dbname"))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$row = mysqli_fetch_assoc($res))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (strtolower($row['dbname']) !== 'mysql')
+ printf("[011] Expecting database 'mysql', found '%s'\n", $row['dbname']);
+ mysqli_free_result($res);
+ }
- if ($row['dbname'] !== (string)$db)
- printf("[008] Expecting database '%s', found '%s'\n", $db, $row['dbname']);
- mysqli_free_result($res);
+ if (!$link->select_db($db))
+ printf("[012] Failed to set '%s' as current DB; [%d] %s\n", $link->errno, $link->error);
- if (mysqli_select_db($link, 'mysql')) {
- // Yippie, a second database to play with - that's great because mysqli_select_db
- // ($db) was done by mysqli__connect() already and the previous test
- // was quite useless
- if (!$res = mysqli_query($link, "SELECT DATABASE() AS dbname"))
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, "SELECT DATABASE() AS dbname"))
+ printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$row = mysqli_fetch_assoc($res))
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (strtolower($row['dbname']) !== 'mysql')
- printf("[011] Expecting database 'mysql', found '%s'\n", $row['dbname']);
- mysqli_free_result($res);
- }
+ $current_db = $row['dbname'];
- if (!$link->select_db($db))
- printf("[012] Failed to set '%s' as current DB; [%d] %s\n", $link->errno, $link->error);
+ mysqli_report(MYSQLI_REPORT_OFF);
+ mysqli_select_db($link, 'I can not imagine that this database exists');
+ mysqli_report(MYSQLI_REPORT_ERROR);
- if (!$res = mysqli_query($link, "SELECT DATABASE() AS dbname"))
- printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ ob_start();
+ mysqli_select_db($link, 'I can not imagine that this database exists');
+ $output = ob_get_contents();
+ ob_end_clean();
+ if (!stristr($output, "1049") && !stristr($output, "1044") && !stristr($output, "1045")) {
+ /* Error: 1049 SQLSTATE: 42000 (ER_BAD_DB_ERROR) Message: Unknown database '%s' */
+ /* Error: 1044 SQLSTATE: 42000 (ER_DBACCESS_DENIED_ERROR) Message: Access denied for user '%s'@'%s' to database '%s' */
+ /* Error: 1045 SQLSTATE: 28000 (ER_ACCESS_DENIED_ERROR) Message: Access denied for user '%s'@'%s' (using password: %s) */
+ echo $output;
+ }
- if (!$row = mysqli_fetch_assoc($res))
- printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, "SELECT DATABASE() AS dbname"))
+ printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $current_db = $row['dbname'];
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_report(MYSQLI_REPORT_OFF);
- mysqli_select_db($link, 'I can not imagine that this database exists');
- mysqli_report(MYSQLI_REPORT_ERROR);
+ if (strtolower($row['dbname']) != strtolower($current_db))
+ printf("[017] Current DB should not change if set fails\n");
- ob_start();
- mysqli_select_db($link, 'I can not imagine that this database exists');
- $output = ob_get_contents();
- ob_end_clean();
- if (!stristr($output, "1049") && !stristr($output, "1044") && !stristr($output, "1045")) {
- /* Error: 1049 SQLSTATE: 42000 (ER_BAD_DB_ERROR) Message: Unknown database '%s' */
- /* Error: 1044 SQLSTATE: 42000 (ER_DBACCESS_DENIED_ERROR) Message: Access denied for user '%s'@'%s' to database '%s' */
- /* Error: 1045 SQLSTATE: 28000 (ER_ACCESS_DENIED_ERROR) Message: Access denied for user '%s'@'%s' (using password: %s) */
- echo $output;
- }
- if (!$res = mysqli_query($link, "SELECT DATABASE() AS dbname"))
- printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = $link->query("SELECT id FROM test WHERE id = 1"))
+ printf("[018] [%d] %s\n");
- if (!$row = mysqli_fetch_assoc($res))
- printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $row = $res->fetch_assoc();
+ $res->free();
- if (strtolower($row['dbname']) != strtolower($current_db))
- printf("[017] Current DB should not change if set fails\n");
+ mysqli_close($link);
+ try {
+ mysqli_select_db($link, $db);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- if (!$res = $link->query("SELECT id FROM test WHERE id = 1"))
- printf("[018] [%d] %s\n");
-
- $row = $res->fetch_assoc();
- $res->free();
-
- mysqli_close($link);
-
- if (false !== ($tmp = mysqli_select_db($link, $db)))
- printf("[019] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!\n";
+ print "done!\n";
?>
--CLEAN--
<?php require_once("clean_table.inc"); ?>
---EXPECTF--
-Warning: mysqli_select_db(): Couldn't fetch mysqli in %s on line %d
+--EXPECT--
+mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_send_query.phpt b/ext/mysqli/tests/mysqli_send_query.phpt
index d07985c2b7..b8d5a1b801 100644
--- a/ext/mysqli/tests/mysqli_send_query.phpt
+++ b/ext/mysqli/tests/mysqli_send_query.phpt
@@ -14,37 +14,39 @@ if (!$TEST_EXPERIMENTAL)
?>
--FILE--
<?php
- /* NOTE: tests is a stub, but function is deprecated, as long as it does not crash when invoking it... */
- require_once("connect.inc");
+ /* NOTE: tests is a stub, but function is deprecated, as long as it does not crash when invoking it... */
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- if (NULL !== ($tmp = @mysqli_send_query()))
- printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = @mysqli_send_query()))
+ printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (NULL !== ($tmp = @mysqli_send_query($link)))
- printf("[002] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (NULL !== ($tmp = @mysqli_send_query($link)))
+ printf("[002] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
- $query = array();
- if (NULL !== ($tmp = @mysqli_send_query($link, $query)))
- printf("[004] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
+ $query = array();
+ if (NULL !== ($tmp = @mysqli_send_query($link, $query)))
+ printf("[004] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_int($tmp = mysqli_send_query($link, 'SELECT 1')))
- printf("[005] Expecting integer/any value, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_int($tmp = mysqli_send_query($link, 'SELECT 1')))
+ printf("[005] Expecting integer/any value, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_close($link);
+ mysqli_close($link);
- if (NULL !== ($tmp = mysqli_send_query($link, 'SELECT 1')))
- printf("[006] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!";
+ try {
+ mysqli_send_query($link, 'SELECT 1');
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+ print "done!";
?>
--EXPECTF--
-Warning: mysqli_send_query(): Couldn't fetch mysqli in %s on line %d
+mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_set_charset.phpt b/ext/mysqli/tests/mysqli_set_charset.phpt
index df90333867..43b8be3f00 100644
--- a/ext/mysqli/tests/mysqli_set_charset.phpt
+++ b/ext/mysqli/tests/mysqli_set_charset.phpt
@@ -46,85 +46,76 @@ if ((($res = mysqli_query($link, 'SHOW CHARACTER SET LIKE "latin1"', MYSQLI_STOR
?>
--FILE--
<?php
- require_once("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_set_charset()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_set_charset($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_set_charset($link, $link)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- require('table.inc');
-
- if (!$res = mysqli_query($link, 'SELECT @@character_set_connection AS charset, @@collation_connection AS collation'))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- if (!$character_set_connection = $tmp['charset'])
- printf("[008] Cannot determine current character set and collation\n");
-
- $new_charset = ('latin1' == $character_set_connection) ? 'latin2' : 'latin1';
- if (!$res = mysqli_query($link, sprintf('SHOW CHARACTER SET LIKE "%s"', $new_charset), MYSQLI_STORE_RESULT))
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (mysqli_num_rows($res) == 0)
- printf("[010] Test will fail, because alternative test character set '%s' seems not supported\n", $new_charset);
-
- if (false !== ($ret = mysqli_set_charset($link, "this is not a valid character set")))
- printf("[011] Expecting boolean/false because of invalid character set, got %s/%s\n", gettype($ret), $ret);
-
- mysqli_close($link);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[012] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
-
- if (true !== ($ret = mysqli_set_charset($link, $new_charset)))
- printf("[013] Expecting boolean/true, got %s/%s\n", gettype($ret), $ret);
-
- if (!$res = mysqli_query($link, 'SELECT @@character_set_connection AS charset, @@collation_connection AS collation'))
- printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- if ($new_charset !== $tmp['charset'])
- printf("[015] Character set not changed? Expecting %s, got %s\n", $new_charset, $tmp['charset']);
-
- if (!$res = mysqli_query($link, "SHOW CHARACTER SET"))
- printf("[016] Cannot get list of character sets\n");
-
- while ($tmp = mysqli_fetch_assoc($res)) {
- if ('ucs2' == $tmp['Charset'] || 'utf16' == $tmp['Charset'] || 'utf32' == $tmp['Charset'] || 'utf16le' == $tmp['Charset'])
- continue;
-
- /* Uncomment to see where it hangs - var_dump($tmp); flush(); */
- if (!@mysqli_set_charset($link, $tmp['Charset'])) {
- printf("[017] Cannot set character set to '%s', [%d] %s\n", $tmp['Charset'],
- mysqli_errno($link), mysqli_error($link));
- continue;
- }
-
- /* Uncomment to see where it hangs - var_dump($tmp); flush(); */
- if (!mysqli_query($link, sprintf("SET NAMES %s", mysqli_real_escape_string($link, $tmp['Charset']))))
- printf("[018] Cannot run SET NAMES %s, [%d] %s\n", $tmp['Charset'], mysqli_errno($link), mysqli_error($link));
- }
- mysqli_free_result($res);
-
- mysqli_close($link);
-
- if (false !== ($tmp = mysqli_set_charset($link, $new_charset)))
- printf("[019] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!";
+ require_once("connect.inc");
+
+ require('table.inc');
+
+ if (!$res = mysqli_query($link, 'SELECT @@character_set_connection AS charset, @@collation_connection AS collation'))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ if (!$character_set_connection = $tmp['charset'])
+ printf("[008] Cannot determine current character set and collation\n");
+
+ $new_charset = ('latin1' == $character_set_connection) ? 'latin2' : 'latin1';
+ if (!$res = mysqli_query($link, sprintf('SHOW CHARACTER SET LIKE "%s"', $new_charset), MYSQLI_STORE_RESULT))
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (mysqli_num_rows($res) == 0)
+ printf("[010] Test will fail, because alternative test character set '%s' seems not supported\n", $new_charset);
+
+ if (false !== ($ret = mysqli_set_charset($link, "this is not a valid character set")))
+ printf("[011] Expecting boolean/false because of invalid character set, got %s/%s\n", gettype($ret), $ret);
+
+ mysqli_close($link);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[012] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+
+ if (true !== ($ret = mysqli_set_charset($link, $new_charset)))
+ printf("[013] Expecting boolean/true, got %s/%s\n", gettype($ret), $ret);
+
+ if (!$res = mysqli_query($link, 'SELECT @@character_set_connection AS charset, @@collation_connection AS collation'))
+ printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ if ($new_charset !== $tmp['charset'])
+ printf("[015] Character set not changed? Expecting %s, got %s\n", $new_charset, $tmp['charset']);
+
+ if (!$res = mysqli_query($link, "SHOW CHARACTER SET"))
+ printf("[016] Cannot get list of character sets\n");
+
+ while ($tmp = mysqli_fetch_assoc($res)) {
+ if ('ucs2' == $tmp['Charset'] || 'utf16' == $tmp['Charset'] || 'utf32' == $tmp['Charset'] || 'utf16le' == $tmp['Charset'])
+ continue;
+
+ /* Uncomment to see where it hangs - var_dump($tmp); flush(); */
+ if (!@mysqli_set_charset($link, $tmp['Charset'])) {
+ printf("[017] Cannot set character set to '%s', [%d] %s\n", $tmp['Charset'],
+ mysqli_errno($link), mysqli_error($link));
+ continue;
+ }
+
+ /* Uncomment to see where it hangs - var_dump($tmp); flush(); */
+ if (!mysqli_query($link, sprintf("SET NAMES %s", mysqli_real_escape_string($link, $tmp['Charset']))))
+ printf("[018] Cannot run SET NAMES %s, [%d] %s\n", $tmp['Charset'], mysqli_errno($link), mysqli_error($link));
+ }
+ mysqli_free_result($res);
+
+ mysqli_close($link);
+
+ try {
+ mysqli_set_charset($link, $new_charset);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
---EXPECTF--
-Warning: mysqli_set_charset(): Couldn't fetch mysqli in %s on line %d
+--EXPECT--
+mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_set_opt.phpt b/ext/mysqli/tests/mysqli_set_opt.phpt
index 757b8490b7..c0e55dd5d6 100644
--- a/ext/mysqli/tests/mysqli_set_opt.phpt
+++ b/ext/mysqli/tests/mysqli_set_opt.phpt
@@ -8,49 +8,35 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_set_opt()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_set_opt($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- $link = mysqli_init();
-
- if (!is_null($tmp = @mysqli_set_opt($link, MYSQLI_OPT_CONNECT_TIMEOUT)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_set_opt($link, "s", 'extra_my.cnf')))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_set_opt($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=0', 'foo')))
- printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- // print "run_tests.php don't fool me with your 'ungreedy' expression '.+?'!\n";
- var_dump(mysqli_set_opt($link, MYSQLI_READ_DEFAULT_GROUP, 'extra_my.cnf'));
- var_dump(mysqli_set_opt($link, MYSQLI_READ_DEFAULT_FILE, 'extra_my.cnf'));
- var_dump(mysqli_set_opt($link, MYSQLI_OPT_CONNECT_TIMEOUT, 10));
- var_dump(mysqli_set_opt($link, MYSQLI_OPT_LOCAL_INFILE, 1));
- var_dump(mysqli_set_opt($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=0'));
- var_dump(my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket));
- var_dump(mysqli_set_opt($link, MYSQLI_READ_DEFAULT_GROUP, 'extra_my.cnf'));
- var_dump(mysqli_set_opt($link, MYSQLI_READ_DEFAULT_FILE, 'extra_my.cnf'));
- var_dump(mysqli_set_opt($link, MYSQLI_OPT_CONNECT_TIMEOUT, 10));
- var_dump(mysqli_set_opt($link, MYSQLI_OPT_LOCAL_INFILE, 1));
- var_dump(mysqli_set_opt($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=0'));
- var_dump(mysqli_set_opt($link, MYSQLI_CLIENT_SSL, 'not an mysqli_option'));
-
- mysqli_close($link);
-
- var_dump(mysqli_set_opt($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=1'));
-
- print "done!";
+ require_once("connect.inc");
+
+ $link = mysqli_init();
+
+ // print "run_tests.php don't fool me with your 'ungreedy' expression '.+?'!\n";
+ var_dump(mysqli_set_opt($link, MYSQLI_READ_DEFAULT_GROUP, 'extra_my.cnf'));
+ var_dump(mysqli_set_opt($link, MYSQLI_READ_DEFAULT_FILE, 'extra_my.cnf'));
+ var_dump(mysqli_set_opt($link, MYSQLI_OPT_CONNECT_TIMEOUT, 10));
+ var_dump(mysqli_set_opt($link, MYSQLI_OPT_LOCAL_INFILE, 1));
+ var_dump(mysqli_set_opt($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=0'));
+ var_dump(my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket));
+ var_dump(mysqli_set_opt($link, MYSQLI_READ_DEFAULT_GROUP, 'extra_my.cnf'));
+ var_dump(mysqli_set_opt($link, MYSQLI_READ_DEFAULT_FILE, 'extra_my.cnf'));
+ var_dump(mysqli_set_opt($link, MYSQLI_OPT_CONNECT_TIMEOUT, 10));
+ var_dump(mysqli_set_opt($link, MYSQLI_OPT_LOCAL_INFILE, 1));
+ var_dump(mysqli_set_opt($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=0'));
+ var_dump(mysqli_set_opt($link, MYSQLI_CLIENT_SSL, 'not an mysqli_option'));
+
+ mysqli_close($link);
+
+ try {
+ mysqli_set_opt($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=1');
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ print "done!";
?>
---EXPECTF--
+--EXPECT--
bool(true)
bool(true)
bool(true)
@@ -63,7 +49,5 @@ bool(true)
bool(true)
bool(true)
bool(false)
-
-Warning: mysqli_set_opt(): Couldn't fetch mysqli in %s on line %d
-bool(false)
+mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_sqlstate.phpt b/ext/mysqli/tests/mysqli_sqlstate.phpt
index b36291872e..cf60977763 100644
--- a/ext/mysqli/tests/mysqli_sqlstate.phpt
+++ b/ext/mysqli/tests/mysqli_sqlstate.phpt
@@ -8,43 +8,33 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ require('table.inc');
- if (!is_null($tmp = @mysqli_sqlstate()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ var_dump(mysqli_sqlstate($link));
+ mysqli_query($link, "SELECT unknown_column FROM test");
+ var_dump(mysqli_sqlstate($link));
+ mysqli_free_result(mysqli_query($link, "SELECT id FROM test"));
+ var_dump(mysqli_sqlstate($link));
- if (!is_null($tmp = @mysqli_sqlstate($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ mysqli_close($link);
- require('table.inc');
+ try {
+ mysqli_sqlstate($link);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- var_dump(@mysqli_sqlstate($link, "foo"));
-
- var_dump(mysqli_sqlstate($link));
- mysqli_query($link, "SELECT unknown_column FROM test");
- var_dump(mysqli_sqlstate($link));
- mysqli_free_result(mysqli_query($link, "SELECT id FROM test"));
- var_dump(mysqli_sqlstate($link));
-
- mysqli_close($link);
-
- var_dump(mysqli_sqlstate($link));
-
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
--EXPECTF--
-NULL
%s(5) "00000"
%s(5) "42S22"
%s(5) "00000"
-
-Warning: mysqli_sqlstate(): Couldn't fetch mysqli in %s on line %d
-bool(false)
+mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_ssl_set.phpt b/ext/mysqli/tests/mysqli_ssl_set.phpt
index 8463cc58b8..7f079f21ea 100644
--- a/ext/mysqli/tests/mysqli_ssl_set.phpt
+++ b/ext/mysqli/tests/mysqli_ssl_set.phpt
@@ -10,52 +10,31 @@ if (!function_exists('mysqli_ssl_set'))
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ /*
+ This function always returns TRUE value.
- if (!is_null($tmp = @mysqli_ssl_set()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ $link = mysqli_init();
+ if (NULL !== ($tmp = @mysqli_ssl_set(
+ $link,
+ 'The path name to the key file.',
+ 'The path name to the certificate file.',
+ 'The path name to the certificate authority file.',
+ 'The pathname to a directory that contains trusted SSL CA certificates in PEM format.',
+ 'A list of allowable ciphers to use for SSL encryption.')))
+ printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_ssl_set($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!is_null($tmp = @mysqli_ssl_set($link, $link)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ If SSL setup is incorrect my_mysqli_real_connect()
+ will return an error when you attempt to connect.
- if (!is_null($tmp = @mysqli_ssl_set($link, $link, $link)))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ ... and the above SSL setup should be always incorrect.
- if (!is_null($tmp = @mysqli_ssl_set($link, $link, $link, $link)))
- printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_ssl_set($link, $link, $link, $link, $link)))
- printf("[006] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- /*
- This function always returns TRUE value.
-
- $link = mysqli_init();
- if (NULL !== ($tmp = @mysqli_ssl_set(
- $link,
- 'The path name to the key file.',
- 'The path name to the certificate file.',
- 'The path name to the certificate authority file.',
- 'The pathname to a directory that contains trusted SSL CA certificates in PEM format.',
- 'A list of allowable ciphers to use for SSL encryption.')))
- printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
-
- If SSL setup is incorrect my_mysqli_real_connect()
- will return an error when you attempt to connect.
-
- ... and the above SSL setup should be always incorrect.
-
- if (false !== ($tmp = my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)))
- printf("[008] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- */
- print "done!\n";
+ if (false !== ($tmp = my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)))
+ printf("[008] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ */
+ print "done!\n";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_stat.phpt b/ext/mysqli/tests/mysqli_stat.phpt
index 2507a4c8f8..dd0b3d24c9 100644
--- a/ext/mysqli/tests/mysqli_stat.phpt
+++ b/ext/mysqli/tests/mysqli_stat.phpt
@@ -8,33 +8,24 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ require('table.inc');
- if (!is_null($tmp = @mysqli_stat()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if ((!is_string($tmp = mysqli_stat($link))) || ('' === $tmp))
+ printf("[004] Expecting non empty string, got %s/'%s', [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_errno($link), mysql_error($link));
- if (!is_null($tmp = @mysqli_stat($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ mysqli_close($link);
- require('table.inc');
+ try {
+ mysqli_stat($link);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- if (!is_null($tmp = @mysqli_stat($link, "foo")))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if ((!is_string($tmp = mysqli_stat($link))) || ('' === $tmp))
- printf("[004] Expecting non empty string, got %s/'%s', [%d] %s\n",
- gettype($tmp), $tmp, mysqli_errno($link), mysql_error($link));
-
- mysqli_close($link);
-
- if (false !== ($tmp = mysqli_stat($link)))
- printf("[005] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!";
+ print "done!";
?>
---EXPECTF--
-Warning: mysqli_stat(): Couldn't fetch mysqli in %s on line %d
+--EXPECT--
+mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_stmt_affected_rows.phpt b/ext/mysqli/tests/mysqli_stmt_affected_rows.phpt
index 1e08f0dec3..505acc68f1 100644
--- a/ext/mysqli/tests/mysqli_stmt_affected_rows.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_affected_rows.phpt
@@ -8,238 +8,232 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
+ $stmt = mysqli_stmt_init($link);
- if (!is_null($tmp = @mysqli_stmt_affected_rows()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_stmt_prepare($stmt, 'DROP TABLE IF EXISTS test') ||
+ !mysqli_stmt_execute($stmt)) {
+ printf("[003] Failed to drop old test table: [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
- if (!is_null($tmp = @mysqli_stmt_affected_rows($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_stmt_prepare($stmt, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE = ' . $engine) ||
+ !mysqli_stmt_execute($stmt)) {
+ printf("[004] Failed to create test table: [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
- $stmt = mysqli_stmt_init($link);
+ if (0 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
+ printf("[005] Expecting int/0, got %s/'%s'\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_prepare($stmt, 'DROP TABLE IF EXISTS test') ||
- !mysqli_stmt_execute($stmt)) {
- printf("[003] Failed to drop old test table: [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
+ mysqli_stmt_close($stmt);
+ $stmt = mysqli_stmt_init($link);
- if (!mysqli_stmt_prepare($stmt, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE = ' . $engine) ||
- !mysqli_stmt_execute($stmt)) {
- printf("[004] Failed to create test table: [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (1, 'a')") ||
+ !mysqli_stmt_execute($stmt))
+ printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (0 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
- printf("[005] Expecting int/0, got %s/'%s'\n", gettype($tmp), $tmp);
+ mysqli_stmt_close($stmt);
+ $stmt = mysqli_stmt_init($link);
- mysqli_stmt_close($stmt);
- $stmt = mysqli_stmt_init($link);
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (100, 'z')") ||
+ !mysqli_stmt_execute($stmt))
+ printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (1, 'a')") ||
- !mysqli_stmt_execute($stmt))
- printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
+ printf("[008] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_stmt_close($stmt);
- $stmt = mysqli_stmt_init($link);
+ mysqli_stmt_close($stmt);
+ $stmt = mysqli_stmt_init($link);
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (100, 'z')") ||
- !mysqli_stmt_execute($stmt))
- printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (100, 'z')") ||
+ !mysqli_stmt_execute($stmt))
+ // NOTE: the error message varies with the MySQL Server version, dump only the error code!
+ printf("[009] [%d] (error message varies with the MySQL Server version, check the error code)\n", mysqli_stmt_errno($stmt));
- if (1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
- printf("[008] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
+ /* an error occurred: affected rows should return -1 */
+ if (-1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
+ printf("[010] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_stmt_close($stmt);
- $stmt = mysqli_stmt_init($link);
+ mysqli_stmt_close($stmt);
+ $stmt = mysqli_stmt_init($link);
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (100, 'z')") ||
- !mysqli_stmt_execute($stmt))
- // NOTE: the error message varies with the MySQL Server version, dump only the error code!
- printf("[009] [%d] (error message varies with the MySQL Server version, check the error code)\n", mysqli_stmt_errno($stmt));
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (1, 'a') ON DUPLICATE KEY UPDATE id = 4") ||
+ !mysqli_stmt_execute($stmt))
+ printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- /* an error occurred: affected rows should return -1 */
- if (-1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
- printf("[010] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+ if (2 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
+ printf("[012] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_stmt_close($stmt);
- $stmt = mysqli_stmt_init($link);
+ mysqli_stmt_close($stmt);
+ $stmt = mysqli_stmt_init($link);
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (1, 'a') ON DUPLICATE KEY UPDATE id = 4") ||
- !mysqli_stmt_execute($stmt))
- printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (2, 'b'), (3, 'c')") ||
+ !mysqli_stmt_execute($stmt))
+ printf("[013] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (2 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
- printf("[012] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
+ if (2 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
+ printf("[014] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_stmt_close($stmt);
- $stmt = mysqli_stmt_init($link);
+ mysqli_stmt_close($stmt);
+ $stmt = mysqli_stmt_init($link);
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (2, 'b'), (3, 'c')") ||
- !mysqli_stmt_execute($stmt))
- printf("[013] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "INSERT IGNORE INTO test(id, label) VALUES (1, 'a')") ||
+ !mysqli_stmt_execute($stmt))
+ printf("[015] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (2 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
- printf("[014] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
+ if (1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
+ printf("[016] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_stmt_close($stmt);
- $stmt = mysqli_stmt_init($link);
+ if (!($res = mysqli_query($link, "SELECT count(id) AS num FROM test")) ||
+ !($tmp = mysqli_fetch_assoc($res)))
+ printf("[017] [%d] %s\n", mysqli_error($link), mysqli_error($link));
+ $num = (int)$tmp['num'];
+ mysqli_free_result($res);
- if (!mysqli_stmt_prepare($stmt, "INSERT IGNORE INTO test(id, label) VALUES (1, 'a')") ||
- !mysqli_stmt_execute($stmt))
- printf("[015] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_stmt_close($stmt);
+ $stmt = mysqli_stmt_init($link);
- if (1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
- printf("[016] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) SELECT id + 10, label FROM test") ||
+ !mysqli_stmt_execute($stmt))
+ printf("[018] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!($res = mysqli_query($link, "SELECT count(id) AS num FROM test")) ||
- !($tmp = mysqli_fetch_assoc($res)))
- printf("[017] [%d] %s\n", mysqli_error($link), mysqli_error($link));
- $num = (int)$tmp['num'];
- mysqli_free_result($res);
+ if ($num !== ($tmp = mysqli_stmt_affected_rows($stmt)))
+ printf("[019] Expecting int/%d, got %s/%s\n", $num, gettype($tmp), $tmp);
- mysqli_stmt_close($stmt);
- $stmt = mysqli_stmt_init($link);
+ mysqli_stmt_close($stmt);
+ $stmt = mysqli_stmt_init($link);
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) SELECT id + 10, label FROM test") ||
- !mysqli_stmt_execute($stmt))
- printf("[018] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "REPLACE INTO test(id, label) values (4, 'd')") ||
+ !mysqli_stmt_execute($stmt))
+ printf("[020] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if ($num !== ($tmp = mysqli_stmt_affected_rows($stmt)))
- printf("[019] Expecting int/%d, got %s/%s\n", $num, gettype($tmp), $tmp);
+ if (2 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
+ printf("[021] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_stmt_close($stmt);
- $stmt = mysqli_stmt_init($link);
+ mysqli_stmt_close($stmt);
+ $stmt = mysqli_stmt_init($link);
- if (!mysqli_stmt_prepare($stmt, "REPLACE INTO test(id, label) values (4, 'd')") ||
- !mysqli_stmt_execute($stmt))
- printf("[020] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "REPLACE INTO test(id, label) values (5, 'e')") ||
+ !mysqli_stmt_execute($stmt))
+ printf("[022] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (2 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
- printf("[021] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
+ if (1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
+ printf("[023] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_stmt_close($stmt);
- $stmt = mysqli_stmt_init($link);
+ mysqli_stmt_close($stmt);
+ $stmt = mysqli_stmt_init($link);
- if (!mysqli_stmt_prepare($stmt, "REPLACE INTO test(id, label) values (5, 'e')") ||
- !mysqli_stmt_execute($stmt))
- printf("[022] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "UPDATE test SET label = 'a' WHERE id = 2") ||
+ !mysqli_stmt_execute($stmt))
+ printf("[024] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
- printf("[023] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
+ if (1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
+ printf("[025] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_stmt_close($stmt);
- $stmt = mysqli_stmt_init($link);
+ if (!mysqli_stmt_prepare($stmt, "UPDATE test SET label = 'a' WHERE id = 2") ||
+ !mysqli_stmt_execute($stmt))
+ printf("[026] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_prepare($stmt, "UPDATE test SET label = 'a' WHERE id = 2") ||
- !mysqli_stmt_execute($stmt))
- printf("[024] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (0 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
+ printf("[027] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
- if (1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
- printf("[025] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
+ mysqli_stmt_close($stmt);
+ $stmt = mysqli_stmt_init($link);
- if (!mysqli_stmt_prepare($stmt, "UPDATE test SET label = 'a' WHERE id = 2") ||
- !mysqli_stmt_execute($stmt))
- printf("[026] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "UPDATE test SET label = 'a' WHERE id = 100") ||
+ !mysqli_stmt_execute($stmt))
+ printf("[028] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (0 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
- printf("[027] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+ if (1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
+ printf("[029] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_stmt_close($stmt);
- $stmt = mysqli_stmt_init($link);
+ if (!mysqli_stmt_prepare($stmt, 'SELECT label FROM test WHERE id = 100') ||
+ !mysqli_stmt_execute($stmt))
+ printf("[030] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_prepare($stmt, "UPDATE test SET label = 'a' WHERE id = 100") ||
- !mysqli_stmt_execute($stmt))
- printf("[028] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ /* use it like num_rows */
+ /* PS are unbuffered, num_rows cannot determine the row count before all rows have been fetched and/or buffered */
+ if (-1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
+ printf("[031] Expecting int/-1, got %s/%s\n", gettype($tmp), $tmp);
- if (1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
- printf("[029] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
+ if (0 !== ($tmp = mysqli_stmt_num_rows($stmt)))
+ printf("[032] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_prepare($stmt, 'SELECT label FROM test WHERE id = 100') ||
- !mysqli_stmt_execute($stmt))
- printf("[030] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_store_result($stmt))
+ printf("[033] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- /* use it like num_rows */
- /* PS are unbuffered, num_rows cannot determine the row count before all rows have been fetched and/or buffered */
- if (-1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
- printf("[031] Expecting int/-1, got %s/%s\n", gettype($tmp), $tmp);
+ if (1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
+ printf("[034] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
- if (0 !== ($tmp = mysqli_stmt_num_rows($stmt)))
- printf("[032] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+ if (1 !== ($tmp = mysqli_stmt_num_rows($stmt)))
+ printf("[035] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_store_result($stmt))
- printf("[033] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_stmt_free_result($stmt);
+ mysqli_stmt_close($stmt);
+ $stmt = mysqli_stmt_init($link);
- if (1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
- printf("[034] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_stmt_prepare($stmt, 'SELECT label FROM test WHERE 1 = 2') ||
+ !mysqli_stmt_execute($stmt))
+ printf("[036] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (1 !== ($tmp = mysqli_stmt_num_rows($stmt)))
- printf("[035] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+ /* use it like num_rows */
+ if (-1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
+ printf("[037] Expecting int/-1, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_stmt_free_result($stmt);
- mysqli_stmt_close($stmt);
- $stmt = mysqli_stmt_init($link);
+ if (true !== ($tmp = mysqli_stmt_store_result($stmt)))
+ printf("[038] Expecting boolean/true, got %s\%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_prepare($stmt, 'SELECT label FROM test WHERE 1 = 2') ||
- !mysqli_stmt_execute($stmt))
- printf("[036] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (0 !== ($tmp = mysqli_stmt_num_rows($stmt)))
+ printf("[039] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
- /* use it like num_rows */
- if (-1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
- printf("[037] Expecting int/-1, got %s/%s\n", gettype($tmp), $tmp);
+ if (0 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
+ printf("[040] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
- if (true !== ($tmp = mysqli_stmt_store_result($stmt)))
- printf("[038] Expecting boolean/true, got %s\%s\n", gettype($tmp), $tmp);
+ /* try to use stmt_affected_rows like stmt_num_rows */
+ /* stmt_affected_rows is not really meant for SELECT! */
+ if (mysqli_stmt_prepare($stmt, 'SELECT unknown_column FROM this_table_does_not_exist') ||
+ mysqli_stmt_execute($stmt))
+ printf("[041] The invalid SELECT statement is issued on purpose\n");
- if (0 !== ($tmp = mysqli_stmt_num_rows($stmt)))
- printf("[039] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+ if (-1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
+ printf("[042] Expecting int/-1, got %s/%s\n", gettype($tmp), $tmp);
- if (0 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
- printf("[040] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+ if ($IS_MYSQLND) {
+ if (false !== ($tmp = mysqli_stmt_store_result($stmt)))
+ printf("[043] Expecting boolean/false, got %s\%s\n", gettype($tmp), $tmp);
+ } else {
+ if (true !== ($tmp = mysqli_stmt_store_result($stmt)))
+ printf("[043] Libmysql does not care if the previous statement was bogus, expecting boolean/true, got %s\%s\n", gettype($tmp), $tmp);
+ }
- /* try to use stmt_affected_rows like stmt_num_rows */
- /* stmt_affected_rows is not really meant for SELECT! */
- if (mysqli_stmt_prepare($stmt, 'SELECT unknown_column FROM this_table_does_not_exist') ||
- mysqli_stmt_execute($stmt))
- printf("[041] The invalid SELECT statement is issued on purpose\n");
+ if (0 !== ($tmp = mysqli_stmt_num_rows($stmt)))
+ printf("[044] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
- if (-1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
- printf("[042] Expecting int/-1, got %s/%s\n", gettype($tmp), $tmp);
+ if (-1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
+ printf("[045] Expecting int/-1, got %s/%s\n", gettype($tmp), $tmp);
- if ($IS_MYSQLND) {
- if (false !== ($tmp = mysqli_stmt_store_result($stmt)))
- printf("[043] Expecting boolean/false, got %s\%s\n", gettype($tmp), $tmp);
- } else {
- if (true !== ($tmp = mysqli_stmt_store_result($stmt)))
- printf("[043] Libmysql does not care if the previous statement was bogus, expecting boolean/true, got %s\%s\n", gettype($tmp), $tmp);
- }
+ mysqli_stmt_close($stmt);
+ $stmt = mysqli_stmt_init($link);
- if (0 !== ($tmp = mysqli_stmt_num_rows($stmt)))
- printf("[044] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_stmt_prepare($stmt, "DROP TABLE IF EXISTS test") ||
+ !mysqli_stmt_execute($stmt))
+ printf("[046] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (-1 !== ($tmp = mysqli_stmt_affected_rows($stmt)))
- printf("[045] Expecting int/-1, got %s/%s\n", gettype($tmp), $tmp);
+ mysqli_stmt_close($stmt);
- mysqli_stmt_close($stmt);
- $stmt = mysqli_stmt_init($link);
+ try {
+ mysqli_stmt_affected_rows($stmt);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- if (!mysqli_stmt_prepare($stmt, "DROP TABLE IF EXISTS test") ||
- !mysqli_stmt_execute($stmt))
- printf("[046] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_close($link);
- mysqli_stmt_close($stmt);
-
- if (false !== ($tmp = mysqli_stmt_affected_rows($stmt)))
- printf("[047] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_close($link);
-
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
@@ -247,6 +241,5 @@ require_once('skipifconnectfailure.inc');
?>
--EXPECTF--
[009] [%d] (error message varies with the MySQL Server version, check the error code)
-
-Warning: mysqli_stmt_affected_rows(): Couldn't fetch mysqli_stmt in %s on line %d
+mysqli_stmt object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_stmt_attr_get.phpt b/ext/mysqli/tests/mysqli_stmt_attr_get.phpt
index 92937a15ce..0844a6c8ac 100644
--- a/ext/mysqli/tests/mysqli_stmt_attr_get.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_attr_get.phpt
@@ -8,63 +8,56 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ require('table.inc');
- if (!is_null($tmp = @mysqli_stmt_attr_get()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ $valid_attr = array("max_length" => MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH);
+ if (mysqli_get_client_version() > 50003)
+ $valid_attr["cursor_type"] = MYSQLI_STMT_ATTR_CURSOR_TYPE;
- if (!is_null($tmp = @mysqli_stmt_attr_get($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if ($IS_MYSQLND && mysqli_get_client_version() > 50007)
+ $valid_attr["prefetch_rows"] = MYSQLI_STMT_ATTR_PREFETCH_ROWS;
- if (!is_null($tmp = @mysqli_stmt_attr_get($link, $link)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ do {
+ $invalid_attr = mt_rand(0, 10000);
+ } while (in_array($invalid_attr, $valid_attr));
- require('table.inc');
+ $stmt = mysqli_stmt_init($link);
+ mysqli_stmt_prepare($stmt, 'SELECT * FROM test');
- if (!is_null($tmp = @mysqli_stmt_attr_get($link, $link)))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ try {
+ mysqli_stmt_attr_get($stmt, $invalid_attr);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- $valid_attr = array("max_length" => MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH);
- if (mysqli_get_client_version() > 50003)
- $valid_attr["cursor_type"] = MYSQLI_STMT_ATTR_CURSOR_TYPE;
+ foreach ($valid_attr as $k => $attr) {
+ if (false === ($tmp = mysqli_stmt_attr_get($stmt, $attr))) {
+ printf("[006] Expecting any type, but not boolean/false, got %s/%s for attribute %s/%s\n",
+ gettype($tmp), $tmp, $k, $attr);
+ }
+ }
- if ($IS_MYSQLND && mysqli_get_client_version() > 50007)
- $valid_attr["prefetch_rows"] = MYSQLI_STMT_ATTR_PREFETCH_ROWS;
+ $stmt->close();
- do {
- $invalid_attr = mt_rand(0, 10000);
- } while (in_array($invalid_attr, $valid_attr));
+ foreach ($valid_attr as $k => $attr) {
+ try {
+ mysqli_stmt_attr_get($stmt, $attr);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+ }
- $stmt = mysqli_stmt_init($link);
- mysqli_stmt_prepare($stmt, 'SELECT * FROM test');
- if (false !== ($tmp = @mysqli_stmt_attr_get($stmt, $invalid_attr)))
- printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- foreach ($valid_attr as $k => $attr) {
- if (false === ($tmp = mysqli_stmt_attr_get($stmt, $attr))) {
- printf("[006] Expecting any type, but not boolean/false, got %s/%s for attribute %s/%s\n",
- gettype($tmp), $tmp, $k, $attr);
- }
- }
-
- $stmt->close();
-
- foreach ($valid_attr as $k => $attr) {
- if (false !== ($tmp = @mysqli_stmt_attr_get($stmt, $attr))) {
- printf("[007] Expecting false, got %s/%s for attribute %s/%s\n",
- gettype($tmp), $tmp, $k, $attr);
- }
- }
-
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
--EXPECT--
+mysqli_stmt object is already closed
+mysqli_stmt object is already closed
+mysqli_stmt object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_stmt_attr_get_prefetch.phpt b/ext/mysqli/tests/mysqli_stmt_attr_get_prefetch.phpt
index b48df9d410..2781810d9b 100644
--- a/ext/mysqli/tests/mysqli_stmt_attr_get_prefetch.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_attr_get_prefetch.phpt
@@ -9,17 +9,17 @@ die("SKIP: prefetch isn't supported at the moment");
?>
--FILE--
<?php
- require('table.inc');
+ require('table.inc');
- $stmt = mysqli_stmt_init($link);
- mysqli_stmt_prepare($stmt, 'SELECT * FROM test');
- if (1 !== ($tmp = mysqli_stmt_attr_get($stmt, MYSQLI_STMT_ATTR_PREFETCH_ROWS))) {
- printf("[001] Expecting int/1, got %s/%s for attribute %s/%s\n",
- gettype($tmp), $tmp, $k, $attr);
- }
- $stmt->close();
- mysqli_close($link);
- print "done!";
+ $stmt = mysqli_stmt_init($link);
+ mysqli_stmt_prepare($stmt, 'SELECT * FROM test');
+ if (1 !== ($tmp = mysqli_stmt_attr_get($stmt, MYSQLI_STMT_ATTR_PREFETCH_ROWS))) {
+ printf("[001] Expecting int/1, got %s/%s for attribute %s/%s\n",
+ gettype($tmp), $tmp, $k, $attr);
+ }
+ $stmt->close();
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_attr_set.phpt b/ext/mysqli/tests/mysqli_stmt_attr_set.phpt
index b3d60380cb..4fad53cba2 100644
--- a/ext/mysqli/tests/mysqli_stmt_attr_set.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_attr_set.phpt
@@ -8,270 +8,259 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_attr_set()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_attr_set($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_attr_set($link, $link)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_attr_set($link, $link, $link)))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- require('table.inc');
-
- $valid_attr = array(MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH);
- if ((mysqli_get_client_version() > 50003) || $IS_MYSQLND) {
- $valid_attr[] = MYSQLI_STMT_ATTR_CURSOR_TYPE;
- $valid_attr[] = MYSQLI_CURSOR_TYPE_NO_CURSOR;
- $valid_attr[] = MYSQLI_CURSOR_TYPE_READ_ONLY;
- $valid_attr[] = MYSQLI_CURSOR_TYPE_FOR_UPDATE;
- $valid_attr[] = MYSQLI_CURSOR_TYPE_SCROLLABLE;
- }
-
- if ((mysqli_get_client_version() > 50007) || $IS_MYSQLND)
- $valid_attr[] = MYSQLI_STMT_ATTR_PREFETCH_ROWS;
-
-
- $stmt = mysqli_stmt_init($link);
- if (false !== ($tmp = @mysqli_stmt_attr_set($stmt, 0, 0)))
- printf("[005] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- $stmt->prepare("SELECT * FROM test");
-
- mt_srand(microtime(true));
-
- for ($i = -100; $i < 1000; $i++) {
- if (in_array($i, $valid_attr))
- continue;
- $invalid_attr = $i;
- if (false !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0))) {
- printf("[006a] Expecting boolean/false for attribute %d, got %s/%s\n", $invalid_attr, gettype($tmp), $tmp);
- }
- }
-
- for ($i = 0; $i < 2; $i++) {
- do {
- $invalid_attr = mt_rand(-1 * (min(4294967296, PHP_INT_MAX) + 1), min(4294967296, PHP_INT_MAX));
- } while (in_array($invalid_attr, $valid_attr));
- if (false !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0))) {
- printf("[006b] Expecting boolean/false for attribute %d, got %s/%s\n", $invalid_attr, gettype($tmp), $tmp);
- }
- }
- $stmt->close();
-
- //
- // MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH
- //
-
-
- // expecting max_length not to be set and be 0 in all cases
- $stmt = mysqli_stmt_init($link);
- $stmt->prepare("SELECT label FROM test");
- $stmt->execute();
- $stmt->store_result();
- $res = $stmt->result_metadata();
- $fields = $res->fetch_fields();
- $max_lengths = array();
- foreach ($fields as $k => $meta) {
- $max_lengths[$meta->name] = $meta->max_length;
- if ($meta->max_length !== 0)
- printf("[007] max_length should be not set (= 0), got %s for field %s\n", $meta->max_length, $meta->name);
- }
- $res->close();
- $stmt->close();
-
- // expecting max_length to _be_ set
- $stmt = mysqli_stmt_init($link);
- $stmt->prepare("SELECT label FROM test");
- $stmt->attr_set(MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH, 1);
- $res = $stmt->attr_get(MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH);
- if ($res !== 1)
- printf("[007.1] max_length should be 1, got %s\n", $res);
- $stmt->execute();
- $stmt->store_result();
- $res = $stmt->result_metadata();
- $fields = $res->fetch_fields();
- $max_lengths = array();
- foreach ($fields as $k => $meta) {
- $max_lengths[$meta->name] = $meta->max_length;
- if ($meta->max_length === 0)
- printf("[008] max_length should be set (!= 0), got %s for field %s\n", $meta->max_length, $meta->name);
- }
- $res->close();
- $stmt->close();
-
- // expecting max_length not to be set
- $stmt = mysqli_stmt_init($link);
- $stmt->prepare("SELECT label FROM test");
- $stmt->attr_set(MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH, 0);
- $res = $stmt->attr_get(MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH);
- if ($res !== 0)
- printf("[008.1] max_length should be 0, got %s\n", $res);
- $stmt->execute();
- $stmt->store_result();
- $res = $stmt->result_metadata();
- $fields = $res->fetch_fields();
- $max_lengths = array();
- foreach ($fields as $k => $meta) {
- $max_lengths[$meta->name] = $meta->max_length;
- if ($meta->max_length !== 0)
- printf("[009] max_length should not be set (= 0), got %s for field %s\n", $meta->max_length, $meta->name);
- }
- $res->close();
- $stmt->close();
-
- //
- // Cursors
- //
-
- if (mysqli_get_client_version() > 50003) {
-
- $cursor_types = array(
- MYSQLI_CURSOR_TYPE_NO_CURSOR,
- MYSQLI_CURSOR_TYPE_READ_ONLY,
- MYSQLI_CURSOR_TYPE_FOR_UPDATE,
- MYSQLI_CURSOR_TYPE_SCROLLABLE
- );
- do {
- $invalid_cursor_type = mt_rand(-1000, 1000);
- } while (in_array($invalid_cursor_type, $cursor_types));
-
- $stmt = mysqli_stmt_init($link);
- $stmt->prepare("SELECT id, label FROM test");
-
- if (false !== ($tmp = @$stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, $invalid_cursor_type)))
- printf("[010] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (false !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_FOR_UPDATE)))
- printf("[011] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (false !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_SCROLLABLE)))
- printf("[012] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_NO_CURSOR)))
- printf("[013] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_READ_ONLY)))
- printf("[014] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- $stmt->close();
-
- $stmt = mysqli_stmt_init($link);
- $stmt->prepare("SELECT id, label FROM test");
- $stmt->execute();
- $id = $label = NULL;
- $stmt->bind_result($id, $label);
- $results = array();
- while ($stmt->fetch())
- $results[$id] = $label;
- $stmt->close();
- if (empty($results))
- printf("[015] Results should not be empty, subsequent tests will probably fail!\n");
-
- $stmt = mysqli_stmt_init($link);
- $stmt->prepare("SELECT id, label FROM test");
- if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_NO_CURSOR)))
- printf("[016] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- $stmt->execute();
- $id = $label = NULL;
- $stmt->bind_result($id, $label);
- $results2 = array();
- while ($stmt->fetch())
- $results2[$id] = $label;
- $stmt->close();
- if ($results != $results2) {
- printf("[017] Results should not differ. Dumping both result sets.\n");
- var_dump($results);
- var_dump($results2);
- }
-
- $stmt = mysqli_stmt_init($link);
- $stmt->prepare("SELECT id, label FROM test");
- if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_READ_ONLY)))
- printf("[018] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- $stmt->execute();
- $id = $label = NULL;
- $stmt->bind_result($id, $label);
- $results2 = array();
- while ($stmt->fetch())
- $results2[$id] = $label;
- $stmt->close();
- if ($results != $results2) {
- printf("[019] Results should not differ. Dumping both result sets.\n");
- var_dump($results);
- var_dump($results2);
- }
-
- }
-
-
- //
- // MYSQLI_STMT_ATTR_PREFETCH_ROWS
- //
-
- if (mysqli_get_client_version() > 50007) {
-
- $stmt = mysqli_stmt_init($link);
- $stmt->prepare("SELECT id, label FROM test");
- if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_PREFETCH_ROWS, 1)))
- printf("[020] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- $stmt->execute();
- $id = $label = NULL;
- $stmt->bind_result($id, $label);
- $results = array();
- while ($stmt->fetch())
- $results[$id] = $label;
- $stmt->close();
- if (empty($results))
- printf("[021] Results should not be empty, subsequent tests will probably fail!\n");
-
- /* prefetch is not supported
- $stmt = mysqli_stmt_init($link);
- $stmt->prepare("SELECT label FROM test");
- if (false !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_PREFETCH_ROWS, -1)))
- printf("[022] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- $stmt->close();
-
- $stmt = mysqli_stmt_init($link);
- $stmt->prepare("SELECT label FROM test");
- if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_PREFETCH_ROWS, PHP_INT_MAX)))
- printf("[023] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- $stmt->close();
-
- $stmt = mysqli_stmt_init($link);
- $stmt->prepare("SELECT id, label FROM test");
- if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_PREFETCH_ROWS, 2)))
- printf("[024] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- $stmt->execute();
- $id = $label = NULL;
- $stmt->bind_result($id, $label);
- $results2 = array();
- while ($stmt->fetch())
- $results2[$id] = $label;
- $stmt->close();
- if ($results != $results2) {
- printf("[025] Results should not differ. Dumping both result sets.\n");
- var_dump($results);
- var_dump($results2);
- }
- */
-
- }
-
- mysqli_close($link);
- print "done!";
+require_once("connect.inc");
+
+ require('table.inc');
+
+ $valid_attr = array(MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH);
+ if ((mysqli_get_client_version() > 50003) || $IS_MYSQLND) {
+ $valid_attr[] = MYSQLI_STMT_ATTR_CURSOR_TYPE;
+ $valid_attr[] = MYSQLI_CURSOR_TYPE_NO_CURSOR;
+ $valid_attr[] = MYSQLI_CURSOR_TYPE_READ_ONLY;
+ $valid_attr[] = MYSQLI_CURSOR_TYPE_FOR_UPDATE;
+ $valid_attr[] = MYSQLI_CURSOR_TYPE_SCROLLABLE;
+ }
+
+ if ((mysqli_get_client_version() > 50007) || $IS_MYSQLND)
+ $valid_attr[] = MYSQLI_STMT_ATTR_PREFETCH_ROWS;
+
+
+ $stmt = mysqli_stmt_init($link);
+ try {
+ mysqli_stmt_attr_set($stmt, 0, 0);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ $stmt->prepare("SELECT * FROM test");
+
+ mt_srand(microtime(true));
+
+ for ($i = -100; $i < 1000; $i++) {
+ if (in_array($i, $valid_attr))
+ continue;
+ $invalid_attr = $i;
+ if (false !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0))) {
+ printf("[006a] Expecting boolean/false for attribute %d, got %s/%s\n", $invalid_attr, gettype($tmp), $tmp);
+ }
+ }
+
+ for ($i = 0; $i < 2; $i++) {
+ do {
+ $invalid_attr = mt_rand(-1 * (min(4294967296, PHP_INT_MAX) + 1), min(4294967296, PHP_INT_MAX));
+ } while (in_array($invalid_attr, $valid_attr));
+ if (false !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0))) {
+ printf("[006b] Expecting boolean/false for attribute %d, got %s/%s\n", $invalid_attr, gettype($tmp), $tmp);
+ }
+ }
+ $stmt->close();
+
+ //
+ // MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH
+ //
+
+
+ // expecting max_length not to be set and be 0 in all cases
+ $stmt = mysqli_stmt_init($link);
+ $stmt->prepare("SELECT label FROM test");
+ $stmt->execute();
+ $stmt->store_result();
+ $res = $stmt->result_metadata();
+ $fields = $res->fetch_fields();
+ $max_lengths = array();
+ foreach ($fields as $k => $meta) {
+ $max_lengths[$meta->name] = $meta->max_length;
+ if ($meta->max_length !== 0)
+ printf("[007] max_length should be not set (= 0), got %s for field %s\n", $meta->max_length, $meta->name);
+ }
+ $res->close();
+ $stmt->close();
+
+ // expecting max_length to _be_ set
+ $stmt = mysqli_stmt_init($link);
+ $stmt->prepare("SELECT label FROM test");
+ $stmt->attr_set(MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH, 1);
+ $res = $stmt->attr_get(MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH);
+ if ($res !== 1)
+ printf("[007.1] max_length should be 1, got %s\n", $res);
+ $stmt->execute();
+ $stmt->store_result();
+ $res = $stmt->result_metadata();
+ $fields = $res->fetch_fields();
+ $max_lengths = array();
+ foreach ($fields as $k => $meta) {
+ $max_lengths[$meta->name] = $meta->max_length;
+ if ($meta->max_length === 0)
+ printf("[008] max_length should be set (!= 0), got %s for field %s\n", $meta->max_length, $meta->name);
+ }
+ $res->close();
+ $stmt->close();
+
+ // expecting max_length not to be set
+ $stmt = mysqli_stmt_init($link);
+ $stmt->prepare("SELECT label FROM test");
+ $stmt->attr_set(MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH, 0);
+ $res = $stmt->attr_get(MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH);
+ if ($res !== 0)
+ printf("[008.1] max_length should be 0, got %s\n", $res);
+ $stmt->execute();
+ $stmt->store_result();
+ $res = $stmt->result_metadata();
+ $fields = $res->fetch_fields();
+ $max_lengths = array();
+ foreach ($fields as $k => $meta) {
+ $max_lengths[$meta->name] = $meta->max_length;
+ if ($meta->max_length !== 0)
+ printf("[009] max_length should not be set (= 0), got %s for field %s\n", $meta->max_length, $meta->name);
+ }
+ $res->close();
+ $stmt->close();
+
+ //
+ // Cursors
+ //
+
+ if (mysqli_get_client_version() > 50003) {
+
+ $cursor_types = array(
+ MYSQLI_CURSOR_TYPE_NO_CURSOR,
+ MYSQLI_CURSOR_TYPE_READ_ONLY,
+ MYSQLI_CURSOR_TYPE_FOR_UPDATE,
+ MYSQLI_CURSOR_TYPE_SCROLLABLE
+ );
+ do {
+ $invalid_cursor_type = mt_rand(-1000, 1000);
+ } while (in_array($invalid_cursor_type, $cursor_types));
+
+ $stmt = mysqli_stmt_init($link);
+ $stmt->prepare("SELECT id, label FROM test");
+
+ if (false !== ($tmp = @$stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, $invalid_cursor_type)))
+ printf("[010] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (false !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_FOR_UPDATE)))
+ printf("[011] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (false !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_SCROLLABLE)))
+ printf("[012] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_NO_CURSOR)))
+ printf("[013] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_READ_ONLY)))
+ printf("[014] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ $stmt->close();
+
+ $stmt = mysqli_stmt_init($link);
+ $stmt->prepare("SELECT id, label FROM test");
+ $stmt->execute();
+ $id = $label = NULL;
+ $stmt->bind_result($id, $label);
+ $results = array();
+ while ($stmt->fetch())
+ $results[$id] = $label;
+ $stmt->close();
+ if (empty($results))
+ printf("[015] Results should not be empty, subsequent tests will probably fail!\n");
+
+ $stmt = mysqli_stmt_init($link);
+ $stmt->prepare("SELECT id, label FROM test");
+ if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_NO_CURSOR)))
+ printf("[016] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ $stmt->execute();
+ $id = $label = NULL;
+ $stmt->bind_result($id, $label);
+ $results2 = array();
+ while ($stmt->fetch())
+ $results2[$id] = $label;
+ $stmt->close();
+ if ($results != $results2) {
+ printf("[017] Results should not differ. Dumping both result sets.\n");
+ var_dump($results);
+ var_dump($results2);
+ }
+
+ $stmt = mysqli_stmt_init($link);
+ $stmt->prepare("SELECT id, label FROM test");
+ if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_READ_ONLY)))
+ printf("[018] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ $stmt->execute();
+ $id = $label = NULL;
+ $stmt->bind_result($id, $label);
+ $results2 = array();
+ while ($stmt->fetch())
+ $results2[$id] = $label;
+ $stmt->close();
+ if ($results != $results2) {
+ printf("[019] Results should not differ. Dumping both result sets.\n");
+ var_dump($results);
+ var_dump($results2);
+ }
+
+ }
+
+
+ //
+ // MYSQLI_STMT_ATTR_PREFETCH_ROWS
+ //
+
+ if (mysqli_get_client_version() > 50007) {
+
+ $stmt = mysqli_stmt_init($link);
+ $stmt->prepare("SELECT id, label FROM test");
+ if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_PREFETCH_ROWS, 1)))
+ printf("[020] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ $stmt->execute();
+ $id = $label = NULL;
+ $stmt->bind_result($id, $label);
+ $results = array();
+ while ($stmt->fetch())
+ $results[$id] = $label;
+ $stmt->close();
+ if (empty($results))
+ printf("[021] Results should not be empty, subsequent tests will probably fail!\n");
+
+ /* prefetch is not supported
+ $stmt = mysqli_stmt_init($link);
+ $stmt->prepare("SELECT label FROM test");
+ if (false !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_PREFETCH_ROWS, -1)))
+ printf("[022] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ $stmt->close();
+
+ $stmt = mysqli_stmt_init($link);
+ $stmt->prepare("SELECT label FROM test");
+ if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_PREFETCH_ROWS, PHP_INT_MAX)))
+ printf("[023] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ $stmt->close();
+
+ $stmt = mysqli_stmt_init($link);
+ $stmt->prepare("SELECT id, label FROM test");
+ if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_PREFETCH_ROWS, 2)))
+ printf("[024] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ $stmt->execute();
+ $id = $label = NULL;
+ $stmt->bind_result($id, $label);
+ $results2 = array();
+ while ($stmt->fetch())
+ $results2[$id] = $label;
+ $stmt->close();
+ if ($results != $results2) {
+ printf("[025] Results should not differ. Dumping both result sets.\n");
+ var_dump($results);
+ var_dump($results2);
+ }
+ */
+
+ }
+
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
--EXPECT--
+mysqli_stmt object is not fully initialized
done!
diff --git a/ext/mysqli/tests/mysqli_stmt_big_prepare.phpt b/ext/mysqli/tests/mysqli_stmt_big_prepare.phpt
index 5ad6f583e7..afc34c27b4 100644
--- a/ext/mysqli/tests/mysqli_stmt_big_prepare.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_big_prepare.phpt
@@ -8,39 +8,39 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- // Note: No SQL tests here! We can expand one of the *fetch()
- // tests to a generic SQL test, if we ever need that.
- // We would duplicate the SQL test cases if we have it here and in one of the
- // fetch tests, because the fetch tests would have to call prepare/execute etc.
- // anyway.
+ // Note: No SQL tests here! We can expand one of the *fetch()
+ // tests to a generic SQL test, if we ever need that.
+ // We would duplicate the SQL test cases if we have it here and in one of the
+ // fetch tests, because the fetch tests would have to call prepare/execute etc.
+ // anyway.
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- require('table.inc');
+ require('table.inc');
- $cleanupIds = range(1000, 3007);
- $model = 50;
+ $cleanupIds = range(1000, 3007);
+ $model = 50;
- $params = '(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)';
+ $params = '(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)';
- /* create a prepared statement */
- if ($stmt = $link->prepare("SHOW STATUS WHERE 1 = ? AND 1 IN {$params}")) {
+ /* create a prepared statement */
+ if ($stmt = $link->prepare("SHOW STATUS WHERE 1 = ? AND 1 IN {$params}")) {
- $stmt->bind_param('iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii', $model, $cleanupIds[0], $cleanupIds[1], $cleanupIds[2], $cleanupIds[3], $cleanupIds[4], $cleanupIds[5], $cleanupIds[6], $cleanupIds[7], $cleanupIds[8], $cleanupIds[9], $cleanupIds[10], $cleanupIds[11], $cleanupIds[12], $cleanupIds[13], $cleanupIds[14], $cleanupIds[15], $cleanupIds[16], $cleanupIds[17], $cleanupIds[18], $cleanupIds[19], $cleanupIds[20], $cleanupIds[21], $cleanupIds[22], $cleanupIds[23], $cleanupIds[24], $cleanupIds[25], $cleanupIds[26], $cleanupIds[27], $cleanupIds[28], $cleanupIds[29], $cleanupIds[30], $cleanupIds[31], $cleanupIds[32], $cleanupIds[33], $cleanupIds[34], $cleanupIds[35], $cleanupIds[36], $cleanupIds[37], $cleanupIds[38], $cleanupIds[39], $cleanupIds[40], $cleanupIds[41], $cleanupIds[42], $cleanupIds[43], $cleanupIds[44], $cleanupIds[45], $cleanupIds[46], $cleanupIds[47], $cleanupIds[48], $cleanupIds[49], $cleanupIds[50], $cleanupIds[51], $cleanupIds[52], $cleanupIds[53], $cleanupIds[54], $cleanupIds[55], $cleanupIds[56], $cleanupIds[57], $cleanupIds[58], $cleanupIds[59], $cleanupIds[60], $cleanupIds[61], $cleanupIds[62], $cleanupIds[63], $cleanupIds[64], $cleanupIds[65], $cleanupIds[66], $cleanupIds[67], $cleanupIds[68], $cleanupIds[69], $cleanupIds[70], $cleanupIds[71], $cleanupIds[72], $cleanupIds[73], $cleanupIds[74], $cleanupIds[75], $cleanupIds[76], $cleanupIds[77], $cleanupIds[78], $cleanupIds[79], $cleanupIds[80], $cleanupIds[81], $cleanupIds[82], $cleanupIds[83], $cleanupIds[84], $cleanupIds[85], $cleanupIds[86], $cleanupIds[87], $cleanupIds[88], $cleanupIds[89], $cleanupIds[90], $cleanupIds[91], $cleanupIds[92], $cleanupIds[93], $cleanupIds[94], $cleanupIds[95], $cleanupIds[96], $cleanupIds[97], $cleanupIds[98], $cleanupIds[99], $cleanupIds[100], $cleanupIds[101], $cleanupIds[102], $cleanupIds[103], $cleanupIds[104], $cleanupIds[105], $cleanupIds[106], $cleanupIds[107], $cleanupIds[108], $cleanupIds[109], $cleanupIds[110], $cleanupIds[111], $cleanupIds[112], $cleanupIds[113], $cleanupIds[114], $cleanupIds[115], $cleanupIds[116], $cleanupIds[117], $cleanupIds[118], $cleanupIds[119], $cleanupIds[120], $cleanupIds[121], $cleanupIds[122], $cleanupIds[123], $cleanupIds[124], $cleanupIds[125], $cleanupIds[126], $cleanupIds[127], $cleanupIds[128], $cleanupIds[129], $cleanupIds[130], $cleanupIds[131], $cleanupIds[132], $cleanupIds[133], $cleanupIds[134], $cleanupIds[135], $cleanupIds[136], $cleanupIds[137], $cleanupIds[138], $cleanupIds[139], $cleanupIds[140], $cleanupIds[141], $cleanupIds[142], $cleanupIds[143], $cleanupIds[144], $cleanupIds[145], $cleanupIds[146], $cleanupIds[147], $cleanupIds[148], $cleanupIds[149], $cleanupIds[150], $cleanupIds[151], $cleanupIds[152], $cleanupIds[153], $cleanupIds[154], $cleanupIds[155], $cleanupIds[156], $cleanupIds[157], $cleanupIds[158], $cleanupIds[159], $cleanupIds[160], $cleanupIds[161], $cleanupIds[162], $cleanupIds[163], $cleanupIds[164], $cleanupIds[165], $cleanupIds[166], $cleanupIds[167], $cleanupIds[168], $cleanupIds[169], $cleanupIds[170], $cleanupIds[171], $cleanupIds[172], $cleanupIds[173], $cleanupIds[174], $cleanupIds[175], $cleanupIds[176], $cleanupIds[177], $cleanupIds[178], $cleanupIds[179], $cleanupIds[180], $cleanupIds[181], $cleanupIds[182], $cleanupIds[183], $cleanupIds[184], $cleanupIds[185], $cleanupIds[186], $cleanupIds[187], $cleanupIds[188], $cleanupIds[189], $cleanupIds[190], $cleanupIds[191], $cleanupIds[192], $cleanupIds[193], $cleanupIds[194], $cleanupIds[195], $cleanupIds[196], $cleanupIds[197], $cleanupIds[198], $cleanupIds[199], $cleanupIds[200], $cleanupIds[201], $cleanupIds[202], $cleanupIds[203], $cleanupIds[204], $cleanupIds[205], $cleanupIds[206], $cleanupIds[207], $cleanupIds[208], $cleanupIds[209], $cleanupIds[210], $cleanupIds[211], $cleanupIds[212], $cleanupIds[213], $cleanupIds[214], $cleanupIds[215], $cleanupIds[216], $cleanupIds[217], $cleanupIds[218], $cleanupIds[219], $cleanupIds[220], $cleanupIds[221], $cleanupIds[222], $cleanupIds[223], $cleanupIds[224], $cleanupIds[225], $cleanupIds[226], $cleanupIds[227], $cleanupIds[228], $cleanupIds[229], $cleanupIds[230], $cleanupIds[231], $cleanupIds[232], $cleanupIds[233], $cleanupIds[234], $cleanupIds[235], $cleanupIds[236], $cleanupIds[237], $cleanupIds[238], $cleanupIds[239], $cleanupIds[240], $cleanupIds[241], $cleanupIds[242], $cleanupIds[243], $cleanupIds[244], $cleanupIds[245], $cleanupIds[246], $cleanupIds[247], $cleanupIds[248], $cleanupIds[249], $cleanupIds[250], $cleanupIds[251], $cleanupIds[252], $cleanupIds[253], $cleanupIds[254], $cleanupIds[255], $cleanupIds[256], $cleanupIds[257], $cleanupIds[258], $cleanupIds[259], $cleanupIds[260], $cleanupIds[261], $cleanupIds[262], $cleanupIds[263], $cleanupIds[264], $cleanupIds[265], $cleanupIds[266], $cleanupIds[267], $cleanupIds[268], $cleanupIds[269], $cleanupIds[270], $cleanupIds[271], $cleanupIds[272], $cleanupIds[273], $cleanupIds[274], $cleanupIds[275], $cleanupIds[276], $cleanupIds[277], $cleanupIds[278], $cleanupIds[279], $cleanupIds[280], $cleanupIds[281], $cleanupIds[282], $cleanupIds[283], $cleanupIds[284], $cleanupIds[285], $cleanupIds[286], $cleanupIds[287], $cleanupIds[288], $cleanupIds[289], $cleanupIds[290], $cleanupIds[291], $cleanupIds[292], $cleanupIds[293], $cleanupIds[294], $cleanupIds[295], $cleanupIds[296], $cleanupIds[297], $cleanupIds[298], $cleanupIds[299], $cleanupIds[300], $cleanupIds[301], $cleanupIds[302], $cleanupIds[303], $cleanupIds[304], $cleanupIds[305], $cleanupIds[306], $cleanupIds[307], $cleanupIds[308], $cleanupIds[309], $cleanupIds[310], $cleanupIds[311], $cleanupIds[312], $cleanupIds[313], $cleanupIds[314], $cleanupIds[315], $cleanupIds[316], $cleanupIds[317], $cleanupIds[318], $cleanupIds[319], $cleanupIds[320], $cleanupIds[321], $cleanupIds[322], $cleanupIds[323], $cleanupIds[324], $cleanupIds[325], $cleanupIds[326], $cleanupIds[327], $cleanupIds[328], $cleanupIds[329], $cleanupIds[330], $cleanupIds[331], $cleanupIds[332], $cleanupIds[333], $cleanupIds[334], $cleanupIds[335], $cleanupIds[336], $cleanupIds[337], $cleanupIds[338], $cleanupIds[339], $cleanupIds[340], $cleanupIds[341], $cleanupIds[342], $cleanupIds[343], $cleanupIds[344], $cleanupIds[345], $cleanupIds[346], $cleanupIds[347], $cleanupIds[348], $cleanupIds[349], $cleanupIds[350], $cleanupIds[351], $cleanupIds[352], $cleanupIds[353], $cleanupIds[354], $cleanupIds[355], $cleanupIds[356], $cleanupIds[357], $cleanupIds[358], $cleanupIds[359], $cleanupIds[360], $cleanupIds[361], $cleanupIds[362], $cleanupIds[363], $cleanupIds[364], $cleanupIds[365], $cleanupIds[366], $cleanupIds[367], $cleanupIds[368], $cleanupIds[369], $cleanupIds[370], $cleanupIds[371], $cleanupIds[372], $cleanupIds[373], $cleanupIds[374], $cleanupIds[375], $cleanupIds[376], $cleanupIds[377], $cleanupIds[378], $cleanupIds[379], $cleanupIds[380], $cleanupIds[381], $cleanupIds[382], $cleanupIds[383], $cleanupIds[384], $cleanupIds[385], $cleanupIds[386], $cleanupIds[387], $cleanupIds[388], $cleanupIds[389], $cleanupIds[390], $cleanupIds[391], $cleanupIds[392], $cleanupIds[393], $cleanupIds[394], $cleanupIds[395], $cleanupIds[396], $cleanupIds[397], $cleanupIds[398], $cleanupIds[399], $cleanupIds[400], $cleanupIds[401], $cleanupIds[402], $cleanupIds[403], $cleanupIds[404], $cleanupIds[405], $cleanupIds[406], $cleanupIds[407], $cleanupIds[408], $cleanupIds[409], $cleanupIds[410], $cleanupIds[411], $cleanupIds[412], $cleanupIds[413], $cleanupIds[414], $cleanupIds[415], $cleanupIds[416], $cleanupIds[417], $cleanupIds[418], $cleanupIds[419], $cleanupIds[420], $cleanupIds[421], $cleanupIds[422], $cleanupIds[423], $cleanupIds[424], $cleanupIds[425], $cleanupIds[426], $cleanupIds[427], $cleanupIds[428], $cleanupIds[429], $cleanupIds[430], $cleanupIds[431], $cleanupIds[432], $cleanupIds[433], $cleanupIds[434], $cleanupIds[435], $cleanupIds[436], $cleanupIds[437], $cleanupIds[438], $cleanupIds[439], $cleanupIds[440], $cleanupIds[441], $cleanupIds[442], $cleanupIds[443], $cleanupIds[444], $cleanupIds[445], $cleanupIds[446], $cleanupIds[447], $cleanupIds[448], $cleanupIds[449], $cleanupIds[450], $cleanupIds[451], $cleanupIds[452], $cleanupIds[453], $cleanupIds[454], $cleanupIds[455], $cleanupIds[456], $cleanupIds[457], $cleanupIds[458], $cleanupIds[459], $cleanupIds[460], $cleanupIds[461], $cleanupIds[462], $cleanupIds[463], $cleanupIds[464], $cleanupIds[465], $cleanupIds[466], $cleanupIds[467], $cleanupIds[468], $cleanupIds[469], $cleanupIds[470], $cleanupIds[471], $cleanupIds[472], $cleanupIds[473], $cleanupIds[474], $cleanupIds[475], $cleanupIds[476], $cleanupIds[477], $cleanupIds[478], $cleanupIds[479], $cleanupIds[480], $cleanupIds[481], $cleanupIds[482], $cleanupIds[483], $cleanupIds[484], $cleanupIds[485], $cleanupIds[486], $cleanupIds[487], $cleanupIds[488], $cleanupIds[489], $cleanupIds[490], $cleanupIds[491], $cleanupIds[492], $cleanupIds[493], $cleanupIds[494], $cleanupIds[495], $cleanupIds[496], $cleanupIds[497], $cleanupIds[498], $cleanupIds[499], $cleanupIds[500], $cleanupIds[501], $cleanupIds[502], $cleanupIds[503], $cleanupIds[504], $cleanupIds[505], $cleanupIds[506], $cleanupIds[507], $cleanupIds[508], $cleanupIds[509], $cleanupIds[510], $cleanupIds[511], $cleanupIds[512], $cleanupIds[513], $cleanupIds[514], $cleanupIds[515], $cleanupIds[516], $cleanupIds[517], $cleanupIds[518], $cleanupIds[519], $cleanupIds[520], $cleanupIds[521], $cleanupIds[522], $cleanupIds[523], $cleanupIds[524], $cleanupIds[525], $cleanupIds[526], $cleanupIds[527], $cleanupIds[528], $cleanupIds[529], $cleanupIds[530], $cleanupIds[531], $cleanupIds[532], $cleanupIds[533], $cleanupIds[534], $cleanupIds[535], $cleanupIds[536], $cleanupIds[537], $cleanupIds[538], $cleanupIds[539], $cleanupIds[540], $cleanupIds[541], $cleanupIds[542], $cleanupIds[543], $cleanupIds[544], $cleanupIds[545], $cleanupIds[546], $cleanupIds[547], $cleanupIds[548], $cleanupIds[549], $cleanupIds[550], $cleanupIds[551], $cleanupIds[552], $cleanupIds[553], $cleanupIds[554], $cleanupIds[555], $cleanupIds[556], $cleanupIds[557], $cleanupIds[558], $cleanupIds[559], $cleanupIds[560], $cleanupIds[561], $cleanupIds[562], $cleanupIds[563], $cleanupIds[564], $cleanupIds[565], $cleanupIds[566], $cleanupIds[567], $cleanupIds[568], $cleanupIds[569], $cleanupIds[570], $cleanupIds[571], $cleanupIds[572], $cleanupIds[573], $cleanupIds[574], $cleanupIds[575], $cleanupIds[576], $cleanupIds[577], $cleanupIds[578], $cleanupIds[579], $cleanupIds[580], $cleanupIds[581], $cleanupIds[582], $cleanupIds[583], $cleanupIds[584], $cleanupIds[585], $cleanupIds[586], $cleanupIds[587], $cleanupIds[588], $cleanupIds[589], $cleanupIds[590], $cleanupIds[591], $cleanupIds[592], $cleanupIds[593], $cleanupIds[594], $cleanupIds[595], $cleanupIds[596], $cleanupIds[597], $cleanupIds[598], $cleanupIds[599], $cleanupIds[600], $cleanupIds[601], $cleanupIds[602], $cleanupIds[603], $cleanupIds[604], $cleanupIds[605], $cleanupIds[606], $cleanupIds[607], $cleanupIds[608], $cleanupIds[609], $cleanupIds[610], $cleanupIds[611], $cleanupIds[612], $cleanupIds[613], $cleanupIds[614], $cleanupIds[615], $cleanupIds[616], $cleanupIds[617], $cleanupIds[618], $cleanupIds[619], $cleanupIds[620], $cleanupIds[621], $cleanupIds[622], $cleanupIds[623], $cleanupIds[624], $cleanupIds[625], $cleanupIds[626], $cleanupIds[627], $cleanupIds[628], $cleanupIds[629], $cleanupIds[630], $cleanupIds[631], $cleanupIds[632], $cleanupIds[633], $cleanupIds[634], $cleanupIds[635], $cleanupIds[636], $cleanupIds[637], $cleanupIds[638], $cleanupIds[639], $cleanupIds[640], $cleanupIds[641], $cleanupIds[642], $cleanupIds[643], $cleanupIds[644], $cleanupIds[645], $cleanupIds[646], $cleanupIds[647], $cleanupIds[648], $cleanupIds[649], $cleanupIds[650], $cleanupIds[651], $cleanupIds[652], $cleanupIds[653], $cleanupIds[654], $cleanupIds[655], $cleanupIds[656], $cleanupIds[657], $cleanupIds[658], $cleanupIds[659], $cleanupIds[660], $cleanupIds[661], $cleanupIds[662], $cleanupIds[663], $cleanupIds[664], $cleanupIds[665], $cleanupIds[666], $cleanupIds[667], $cleanupIds[668], $cleanupIds[669], $cleanupIds[670], $cleanupIds[671], $cleanupIds[672], $cleanupIds[673], $cleanupIds[674], $cleanupIds[675], $cleanupIds[676], $cleanupIds[677], $cleanupIds[678], $cleanupIds[679], $cleanupIds[680], $cleanupIds[681], $cleanupIds[682], $cleanupIds[683], $cleanupIds[684], $cleanupIds[685], $cleanupIds[686], $cleanupIds[687], $cleanupIds[688], $cleanupIds[689], $cleanupIds[690], $cleanupIds[691], $cleanupIds[692], $cleanupIds[693], $cleanupIds[694], $cleanupIds[695], $cleanupIds[696], $cleanupIds[697], $cleanupIds[698], $cleanupIds[699], $cleanupIds[700], $cleanupIds[701], $cleanupIds[702], $cleanupIds[703], $cleanupIds[704], $cleanupIds[705], $cleanupIds[706], $cleanupIds[707], $cleanupIds[708], $cleanupIds[709], $cleanupIds[710], $cleanupIds[711], $cleanupIds[712], $cleanupIds[713], $cleanupIds[714], $cleanupIds[715], $cleanupIds[716], $cleanupIds[717], $cleanupIds[718], $cleanupIds[719], $cleanupIds[720], $cleanupIds[721], $cleanupIds[722], $cleanupIds[723], $cleanupIds[724], $cleanupIds[725], $cleanupIds[726], $cleanupIds[727], $cleanupIds[728], $cleanupIds[729], $cleanupIds[730], $cleanupIds[731], $cleanupIds[732], $cleanupIds[733], $cleanupIds[734], $cleanupIds[735], $cleanupIds[736], $cleanupIds[737], $cleanupIds[738], $cleanupIds[739], $cleanupIds[740], $cleanupIds[741], $cleanupIds[742], $cleanupIds[743], $cleanupIds[744], $cleanupIds[745], $cleanupIds[746], $cleanupIds[747], $cleanupIds[748], $cleanupIds[749], $cleanupIds[750], $cleanupIds[751], $cleanupIds[752], $cleanupIds[753], $cleanupIds[754], $cleanupIds[755], $cleanupIds[756], $cleanupIds[757], $cleanupIds[758], $cleanupIds[759], $cleanupIds[760], $cleanupIds[761], $cleanupIds[762], $cleanupIds[763], $cleanupIds[764], $cleanupIds[765], $cleanupIds[766], $cleanupIds[767], $cleanupIds[768], $cleanupIds[769], $cleanupIds[770], $cleanupIds[771], $cleanupIds[772], $cleanupIds[773], $cleanupIds[774], $cleanupIds[775], $cleanupIds[776], $cleanupIds[777], $cleanupIds[778], $cleanupIds[779], $cleanupIds[780], $cleanupIds[781], $cleanupIds[782], $cleanupIds[783], $cleanupIds[784], $cleanupIds[785], $cleanupIds[786], $cleanupIds[787], $cleanupIds[788], $cleanupIds[789], $cleanupIds[790], $cleanupIds[791], $cleanupIds[792], $cleanupIds[793], $cleanupIds[794], $cleanupIds[795], $cleanupIds[796], $cleanupIds[797], $cleanupIds[798], $cleanupIds[799], $cleanupIds[800], $cleanupIds[801], $cleanupIds[802], $cleanupIds[803], $cleanupIds[804], $cleanupIds[805], $cleanupIds[806], $cleanupIds[807], $cleanupIds[808], $cleanupIds[809], $cleanupIds[810], $cleanupIds[811], $cleanupIds[812], $cleanupIds[813], $cleanupIds[814], $cleanupIds[815], $cleanupIds[816], $cleanupIds[817], $cleanupIds[818], $cleanupIds[819], $cleanupIds[820], $cleanupIds[821], $cleanupIds[822], $cleanupIds[823], $cleanupIds[824], $cleanupIds[825], $cleanupIds[826], $cleanupIds[827], $cleanupIds[828], $cleanupIds[829], $cleanupIds[830], $cleanupIds[831], $cleanupIds[832], $cleanupIds[833], $cleanupIds[834], $cleanupIds[835], $cleanupIds[836], $cleanupIds[837], $cleanupIds[838], $cleanupIds[839], $cleanupIds[840], $cleanupIds[841], $cleanupIds[842], $cleanupIds[843], $cleanupIds[844], $cleanupIds[845], $cleanupIds[846], $cleanupIds[847], $cleanupIds[848], $cleanupIds[849], $cleanupIds[850], $cleanupIds[851], $cleanupIds[852], $cleanupIds[853], $cleanupIds[854], $cleanupIds[855], $cleanupIds[856], $cleanupIds[857], $cleanupIds[858], $cleanupIds[859], $cleanupIds[860], $cleanupIds[861], $cleanupIds[862], $cleanupIds[863], $cleanupIds[864], $cleanupIds[865], $cleanupIds[866], $cleanupIds[867], $cleanupIds[868], $cleanupIds[869], $cleanupIds[870], $cleanupIds[871], $cleanupIds[872], $cleanupIds[873], $cleanupIds[874], $cleanupIds[875], $cleanupIds[876], $cleanupIds[877], $cleanupIds[878], $cleanupIds[879], $cleanupIds[880], $cleanupIds[881], $cleanupIds[882], $cleanupIds[883], $cleanupIds[884], $cleanupIds[885], $cleanupIds[886], $cleanupIds[887], $cleanupIds[888], $cleanupIds[889], $cleanupIds[890], $cleanupIds[891], $cleanupIds[892], $cleanupIds[893], $cleanupIds[894], $cleanupIds[895], $cleanupIds[896], $cleanupIds[897], $cleanupIds[898], $cleanupIds[899], $cleanupIds[900], $cleanupIds[901], $cleanupIds[902], $cleanupIds[903], $cleanupIds[904], $cleanupIds[905], $cleanupIds[906], $cleanupIds[907], $cleanupIds[908], $cleanupIds[909], $cleanupIds[910], $cleanupIds[911], $cleanupIds[912], $cleanupIds[913], $cleanupIds[914], $cleanupIds[915], $cleanupIds[916], $cleanupIds[917], $cleanupIds[918], $cleanupIds[919], $cleanupIds[920], $cleanupIds[921], $cleanupIds[922], $cleanupIds[923], $cleanupIds[924], $cleanupIds[925], $cleanupIds[926], $cleanupIds[927], $cleanupIds[928], $cleanupIds[929], $cleanupIds[930], $cleanupIds[931], $cleanupIds[932], $cleanupIds[933], $cleanupIds[934], $cleanupIds[935], $cleanupIds[936], $cleanupIds[937], $cleanupIds[938], $cleanupIds[939], $cleanupIds[940], $cleanupIds[941], $cleanupIds[942], $cleanupIds[943], $cleanupIds[944], $cleanupIds[945], $cleanupIds[946], $cleanupIds[947], $cleanupIds[948], $cleanupIds[949], $cleanupIds[950], $cleanupIds[951], $cleanupIds[952], $cleanupIds[953], $cleanupIds[954], $cleanupIds[955], $cleanupIds[956], $cleanupIds[957], $cleanupIds[958], $cleanupIds[959], $cleanupIds[960], $cleanupIds[961], $cleanupIds[962], $cleanupIds[963], $cleanupIds[964], $cleanupIds[965], $cleanupIds[966], $cleanupIds[967], $cleanupIds[968], $cleanupIds[969], $cleanupIds[970], $cleanupIds[971], $cleanupIds[972], $cleanupIds[973], $cleanupIds[974], $cleanupIds[975], $cleanupIds[976], $cleanupIds[977], $cleanupIds[978], $cleanupIds[979], $cleanupIds[980], $cleanupIds[981], $cleanupIds[982], $cleanupIds[983], $cleanupIds[984], $cleanupIds[985], $cleanupIds[986], $cleanupIds[987], $cleanupIds[988], $cleanupIds[989], $cleanupIds[990], $cleanupIds[991], $cleanupIds[992], $cleanupIds[993], $cleanupIds[994], $cleanupIds[995], $cleanupIds[996], $cleanupIds[997], $cleanupIds[998], $cleanupIds[999], $cleanupIds[1000], $cleanupIds[1001], $cleanupIds[1002], $cleanupIds[1003], $cleanupIds[1004], $cleanupIds[1005], $cleanupIds[1006], $cleanupIds[1007], $cleanupIds[1008], $cleanupIds[1009], $cleanupIds[1010], $cleanupIds[1011], $cleanupIds[1012], $cleanupIds[1013], $cleanupIds[1014], $cleanupIds[1015], $cleanupIds[1016], $cleanupIds[1017], $cleanupIds[1018], $cleanupIds[1019], $cleanupIds[1020], $cleanupIds[1021], $cleanupIds[1022], $cleanupIds[1023], $cleanupIds[1024], $cleanupIds[1025], $cleanupIds[1026], $cleanupIds[1027], $cleanupIds[1028], $cleanupIds[1029], $cleanupIds[1030], $cleanupIds[1031], $cleanupIds[1032], $cleanupIds[1033], $cleanupIds[1034], $cleanupIds[1035], $cleanupIds[1036], $cleanupIds[1037], $cleanupIds[1038], $cleanupIds[1039], $cleanupIds[1040], $cleanupIds[1041], $cleanupIds[1042], $cleanupIds[1043], $cleanupIds[1044], $cleanupIds[1045], $cleanupIds[1046], $cleanupIds[1047], $cleanupIds[1048], $cleanupIds[1049], $cleanupIds[1050], $cleanupIds[1051], $cleanupIds[1052], $cleanupIds[1053], $cleanupIds[1054], $cleanupIds[1055], $cleanupIds[1056], $cleanupIds[1057], $cleanupIds[1058], $cleanupIds[1059], $cleanupIds[1060], $cleanupIds[1061], $cleanupIds[1062], $cleanupIds[1063], $cleanupIds[1064], $cleanupIds[1065], $cleanupIds[1066], $cleanupIds[1067], $cleanupIds[1068], $cleanupIds[1069], $cleanupIds[1070], $cleanupIds[1071], $cleanupIds[1072], $cleanupIds[1073], $cleanupIds[1074], $cleanupIds[1075], $cleanupIds[1076], $cleanupIds[1077], $cleanupIds[1078], $cleanupIds[1079], $cleanupIds[1080], $cleanupIds[1081], $cleanupIds[1082], $cleanupIds[1083], $cleanupIds[1084], $cleanupIds[1085], $cleanupIds[1086], $cleanupIds[1087], $cleanupIds[1088], $cleanupIds[1089], $cleanupIds[1090], $cleanupIds[1091], $cleanupIds[1092], $cleanupIds[1093], $cleanupIds[1094], $cleanupIds[1095], $cleanupIds[1096], $cleanupIds[1097], $cleanupIds[1098], $cleanupIds[1099], $cleanupIds[1100], $cleanupIds[1101], $cleanupIds[1102], $cleanupIds[1103], $cleanupIds[1104], $cleanupIds[1105], $cleanupIds[1106], $cleanupIds[1107], $cleanupIds[1108], $cleanupIds[1109], $cleanupIds[1110], $cleanupIds[1111], $cleanupIds[1112], $cleanupIds[1113], $cleanupIds[1114], $cleanupIds[1115], $cleanupIds[1116], $cleanupIds[1117], $cleanupIds[1118], $cleanupIds[1119], $cleanupIds[1120], $cleanupIds[1121], $cleanupIds[1122], $cleanupIds[1123], $cleanupIds[1124], $cleanupIds[1125], $cleanupIds[1126], $cleanupIds[1127], $cleanupIds[1128], $cleanupIds[1129], $cleanupIds[1130], $cleanupIds[1131], $cleanupIds[1132], $cleanupIds[1133], $cleanupIds[1134], $cleanupIds[1135], $cleanupIds[1136], $cleanupIds[1137], $cleanupIds[1138], $cleanupIds[1139], $cleanupIds[1140], $cleanupIds[1141], $cleanupIds[1142], $cleanupIds[1143], $cleanupIds[1144], $cleanupIds[1145], $cleanupIds[1146], $cleanupIds[1147], $cleanupIds[1148], $cleanupIds[1149], $cleanupIds[1150], $cleanupIds[1151], $cleanupIds[1152], $cleanupIds[1153], $cleanupIds[1154], $cleanupIds[1155], $cleanupIds[1156], $cleanupIds[1157], $cleanupIds[1158], $cleanupIds[1159], $cleanupIds[1160], $cleanupIds[1161], $cleanupIds[1162], $cleanupIds[1163], $cleanupIds[1164], $cleanupIds[1165], $cleanupIds[1166], $cleanupIds[1167], $cleanupIds[1168], $cleanupIds[1169], $cleanupIds[1170], $cleanupIds[1171], $cleanupIds[1172], $cleanupIds[1173], $cleanupIds[1174], $cleanupIds[1175], $cleanupIds[1176], $cleanupIds[1177], $cleanupIds[1178], $cleanupIds[1179], $cleanupIds[1180], $cleanupIds[1181], $cleanupIds[1182], $cleanupIds[1183], $cleanupIds[1184], $cleanupIds[1185], $cleanupIds[1186], $cleanupIds[1187], $cleanupIds[1188], $cleanupIds[1189], $cleanupIds[1190], $cleanupIds[1191], $cleanupIds[1192], $cleanupIds[1193], $cleanupIds[1194], $cleanupIds[1195], $cleanupIds[1196], $cleanupIds[1197], $cleanupIds[1198], $cleanupIds[1199], $cleanupIds[1200], $cleanupIds[1201], $cleanupIds[1202], $cleanupIds[1203], $cleanupIds[1204], $cleanupIds[1205], $cleanupIds[1206], $cleanupIds[1207], $cleanupIds[1208], $cleanupIds[1209], $cleanupIds[1210], $cleanupIds[1211], $cleanupIds[1212], $cleanupIds[1213], $cleanupIds[1214], $cleanupIds[1215], $cleanupIds[1216], $cleanupIds[1217], $cleanupIds[1218], $cleanupIds[1219], $cleanupIds[1220], $cleanupIds[1221], $cleanupIds[1222], $cleanupIds[1223], $cleanupIds[1224], $cleanupIds[1225], $cleanupIds[1226], $cleanupIds[1227], $cleanupIds[1228], $cleanupIds[1229], $cleanupIds[1230], $cleanupIds[1231], $cleanupIds[1232], $cleanupIds[1233], $cleanupIds[1234], $cleanupIds[1235], $cleanupIds[1236], $cleanupIds[1237], $cleanupIds[1238], $cleanupIds[1239], $cleanupIds[1240], $cleanupIds[1241], $cleanupIds[1242], $cleanupIds[1243], $cleanupIds[1244], $cleanupIds[1245], $cleanupIds[1246], $cleanupIds[1247], $cleanupIds[1248], $cleanupIds[1249], $cleanupIds[1250], $cleanupIds[1251], $cleanupIds[1252], $cleanupIds[1253], $cleanupIds[1254], $cleanupIds[1255], $cleanupIds[1256], $cleanupIds[1257], $cleanupIds[1258], $cleanupIds[1259], $cleanupIds[1260], $cleanupIds[1261], $cleanupIds[1262], $cleanupIds[1263], $cleanupIds[1264], $cleanupIds[1265], $cleanupIds[1266], $cleanupIds[1267], $cleanupIds[1268], $cleanupIds[1269], $cleanupIds[1270], $cleanupIds[1271], $cleanupIds[1272], $cleanupIds[1273], $cleanupIds[1274], $cleanupIds[1275], $cleanupIds[1276], $cleanupIds[1277], $cleanupIds[1278], $cleanupIds[1279], $cleanupIds[1280], $cleanupIds[1281], $cleanupIds[1282], $cleanupIds[1283], $cleanupIds[1284], $cleanupIds[1285], $cleanupIds[1286], $cleanupIds[1287], $cleanupIds[1288], $cleanupIds[1289], $cleanupIds[1290], $cleanupIds[1291], $cleanupIds[1292], $cleanupIds[1293], $cleanupIds[1294], $cleanupIds[1295], $cleanupIds[1296], $cleanupIds[1297], $cleanupIds[1298], $cleanupIds[1299], $cleanupIds[1300], $cleanupIds[1301], $cleanupIds[1302], $cleanupIds[1303], $cleanupIds[1304], $cleanupIds[1305], $cleanupIds[1306], $cleanupIds[1307], $cleanupIds[1308], $cleanupIds[1309], $cleanupIds[1310], $cleanupIds[1311], $cleanupIds[1312], $cleanupIds[1313], $cleanupIds[1314], $cleanupIds[1315], $cleanupIds[1316], $cleanupIds[1317], $cleanupIds[1318], $cleanupIds[1319], $cleanupIds[1320], $cleanupIds[1321], $cleanupIds[1322], $cleanupIds[1323], $cleanupIds[1324], $cleanupIds[1325], $cleanupIds[1326], $cleanupIds[1327], $cleanupIds[1328], $cleanupIds[1329], $cleanupIds[1330], $cleanupIds[1331], $cleanupIds[1332], $cleanupIds[1333], $cleanupIds[1334], $cleanupIds[1335], $cleanupIds[1336], $cleanupIds[1337], $cleanupIds[1338], $cleanupIds[1339], $cleanupIds[1340], $cleanupIds[1341], $cleanupIds[1342], $cleanupIds[1343], $cleanupIds[1344], $cleanupIds[1345], $cleanupIds[1346], $cleanupIds[1347], $cleanupIds[1348], $cleanupIds[1349], $cleanupIds[1350], $cleanupIds[1351], $cleanupIds[1352], $cleanupIds[1353], $cleanupIds[1354], $cleanupIds[1355], $cleanupIds[1356], $cleanupIds[1357], $cleanupIds[1358], $cleanupIds[1359], $cleanupIds[1360], $cleanupIds[1361], $cleanupIds[1362], $cleanupIds[1363], $cleanupIds[1364], $cleanupIds[1365], $cleanupIds[1366], $cleanupIds[1367], $cleanupIds[1368], $cleanupIds[1369], $cleanupIds[1370], $cleanupIds[1371], $cleanupIds[1372], $cleanupIds[1373], $cleanupIds[1374], $cleanupIds[1375], $cleanupIds[1376], $cleanupIds[1377], $cleanupIds[1378], $cleanupIds[1379], $cleanupIds[1380], $cleanupIds[1381], $cleanupIds[1382], $cleanupIds[1383], $cleanupIds[1384], $cleanupIds[1385], $cleanupIds[1386], $cleanupIds[1387], $cleanupIds[1388], $cleanupIds[1389], $cleanupIds[1390], $cleanupIds[1391], $cleanupIds[1392], $cleanupIds[1393], $cleanupIds[1394], $cleanupIds[1395], $cleanupIds[1396], $cleanupIds[1397], $cleanupIds[1398], $cleanupIds[1399], $cleanupIds[1400], $cleanupIds[1401], $cleanupIds[1402], $cleanupIds[1403], $cleanupIds[1404], $cleanupIds[1405], $cleanupIds[1406], $cleanupIds[1407], $cleanupIds[1408], $cleanupIds[1409], $cleanupIds[1410], $cleanupIds[1411], $cleanupIds[1412], $cleanupIds[1413], $cleanupIds[1414], $cleanupIds[1415], $cleanupIds[1416], $cleanupIds[1417], $cleanupIds[1418], $cleanupIds[1419], $cleanupIds[1420], $cleanupIds[1421], $cleanupIds[1422], $cleanupIds[1423], $cleanupIds[1424], $cleanupIds[1425], $cleanupIds[1426], $cleanupIds[1427], $cleanupIds[1428], $cleanupIds[1429], $cleanupIds[1430], $cleanupIds[1431], $cleanupIds[1432], $cleanupIds[1433], $cleanupIds[1434], $cleanupIds[1435], $cleanupIds[1436], $cleanupIds[1437], $cleanupIds[1438], $cleanupIds[1439], $cleanupIds[1440], $cleanupIds[1441], $cleanupIds[1442], $cleanupIds[1443], $cleanupIds[1444], $cleanupIds[1445], $cleanupIds[1446], $cleanupIds[1447], $cleanupIds[1448], $cleanupIds[1449], $cleanupIds[1450], $cleanupIds[1451], $cleanupIds[1452], $cleanupIds[1453], $cleanupIds[1454], $cleanupIds[1455], $cleanupIds[1456], $cleanupIds[1457], $cleanupIds[1458], $cleanupIds[1459], $cleanupIds[1460], $cleanupIds[1461], $cleanupIds[1462], $cleanupIds[1463], $cleanupIds[1464], $cleanupIds[1465], $cleanupIds[1466], $cleanupIds[1467], $cleanupIds[1468], $cleanupIds[1469], $cleanupIds[1470], $cleanupIds[1471], $cleanupIds[1472], $cleanupIds[1473], $cleanupIds[1474], $cleanupIds[1475], $cleanupIds[1476], $cleanupIds[1477], $cleanupIds[1478], $cleanupIds[1479], $cleanupIds[1480], $cleanupIds[1481], $cleanupIds[1482], $cleanupIds[1483], $cleanupIds[1484], $cleanupIds[1485], $cleanupIds[1486], $cleanupIds[1487], $cleanupIds[1488], $cleanupIds[1489], $cleanupIds[1490], $cleanupIds[1491], $cleanupIds[1492], $cleanupIds[1493], $cleanupIds[1494], $cleanupIds[1495], $cleanupIds[1496], $cleanupIds[1497], $cleanupIds[1498], $cleanupIds[1499], $cleanupIds[1500], $cleanupIds[1501], $cleanupIds[1502], $cleanupIds[1503], $cleanupIds[1504], $cleanupIds[1505], $cleanupIds[1506], $cleanupIds[1507], $cleanupIds[1508], $cleanupIds[1509], $cleanupIds[1510], $cleanupIds[1511], $cleanupIds[1512], $cleanupIds[1513], $cleanupIds[1514], $cleanupIds[1515], $cleanupIds[1516], $cleanupIds[1517], $cleanupIds[1518], $cleanupIds[1519], $cleanupIds[1520], $cleanupIds[1521], $cleanupIds[1522], $cleanupIds[1523], $cleanupIds[1524], $cleanupIds[1525], $cleanupIds[1526], $cleanupIds[1527], $cleanupIds[1528], $cleanupIds[1529], $cleanupIds[1530], $cleanupIds[1531], $cleanupIds[1532], $cleanupIds[1533], $cleanupIds[1534], $cleanupIds[1535], $cleanupIds[1536], $cleanupIds[1537], $cleanupIds[1538], $cleanupIds[1539], $cleanupIds[1540], $cleanupIds[1541], $cleanupIds[1542], $cleanupIds[1543], $cleanupIds[1544], $cleanupIds[1545], $cleanupIds[1546], $cleanupIds[1547], $cleanupIds[1548], $cleanupIds[1549], $cleanupIds[1550], $cleanupIds[1551], $cleanupIds[1552], $cleanupIds[1553], $cleanupIds[1554], $cleanupIds[1555], $cleanupIds[1556], $cleanupIds[1557], $cleanupIds[1558], $cleanupIds[1559], $cleanupIds[1560], $cleanupIds[1561], $cleanupIds[1562], $cleanupIds[1563], $cleanupIds[1564], $cleanupIds[1565], $cleanupIds[1566], $cleanupIds[1567], $cleanupIds[1568], $cleanupIds[1569], $cleanupIds[1570], $cleanupIds[1571], $cleanupIds[1572], $cleanupIds[1573], $cleanupIds[1574], $cleanupIds[1575], $cleanupIds[1576], $cleanupIds[1577], $cleanupIds[1578], $cleanupIds[1579], $cleanupIds[1580], $cleanupIds[1581], $cleanupIds[1582], $cleanupIds[1583], $cleanupIds[1584], $cleanupIds[1585], $cleanupIds[1586], $cleanupIds[1587], $cleanupIds[1588], $cleanupIds[1589], $cleanupIds[1590], $cleanupIds[1591], $cleanupIds[1592], $cleanupIds[1593], $cleanupIds[1594], $cleanupIds[1595], $cleanupIds[1596], $cleanupIds[1597], $cleanupIds[1598], $cleanupIds[1599], $cleanupIds[1600], $cleanupIds[1601], $cleanupIds[1602], $cleanupIds[1603], $cleanupIds[1604], $cleanupIds[1605], $cleanupIds[1606], $cleanupIds[1607], $cleanupIds[1608], $cleanupIds[1609], $cleanupIds[1610], $cleanupIds[1611], $cleanupIds[1612], $cleanupIds[1613], $cleanupIds[1614], $cleanupIds[1615], $cleanupIds[1616], $cleanupIds[1617], $cleanupIds[1618], $cleanupIds[1619], $cleanupIds[1620], $cleanupIds[1621], $cleanupIds[1622], $cleanupIds[1623], $cleanupIds[1624], $cleanupIds[1625], $cleanupIds[1626], $cleanupIds[1627], $cleanupIds[1628], $cleanupIds[1629], $cleanupIds[1630], $cleanupIds[1631], $cleanupIds[1632], $cleanupIds[1633], $cleanupIds[1634], $cleanupIds[1635], $cleanupIds[1636], $cleanupIds[1637], $cleanupIds[1638], $cleanupIds[1639], $cleanupIds[1640], $cleanupIds[1641], $cleanupIds[1642], $cleanupIds[1643], $cleanupIds[1644], $cleanupIds[1645], $cleanupIds[1646], $cleanupIds[1647], $cleanupIds[1648], $cleanupIds[1649], $cleanupIds[1650], $cleanupIds[1651], $cleanupIds[1652], $cleanupIds[1653], $cleanupIds[1654], $cleanupIds[1655], $cleanupIds[1656], $cleanupIds[1657], $cleanupIds[1658], $cleanupIds[1659], $cleanupIds[1660], $cleanupIds[1661], $cleanupIds[1662], $cleanupIds[1663], $cleanupIds[1664], $cleanupIds[1665], $cleanupIds[1666], $cleanupIds[1667], $cleanupIds[1668], $cleanupIds[1669], $cleanupIds[1670], $cleanupIds[1671], $cleanupIds[1672], $cleanupIds[1673], $cleanupIds[1674], $cleanupIds[1675], $cleanupIds[1676], $cleanupIds[1677], $cleanupIds[1678], $cleanupIds[1679], $cleanupIds[1680], $cleanupIds[1681], $cleanupIds[1682], $cleanupIds[1683], $cleanupIds[1684], $cleanupIds[1685], $cleanupIds[1686], $cleanupIds[1687], $cleanupIds[1688], $cleanupIds[1689], $cleanupIds[1690], $cleanupIds[1691], $cleanupIds[1692], $cleanupIds[1693], $cleanupIds[1694], $cleanupIds[1695], $cleanupIds[1696], $cleanupIds[1697], $cleanupIds[1698], $cleanupIds[1699], $cleanupIds[1700], $cleanupIds[1701], $cleanupIds[1702], $cleanupIds[1703], $cleanupIds[1704], $cleanupIds[1705], $cleanupIds[1706], $cleanupIds[1707], $cleanupIds[1708], $cleanupIds[1709], $cleanupIds[1710], $cleanupIds[1711], $cleanupIds[1712], $cleanupIds[1713], $cleanupIds[1714], $cleanupIds[1715], $cleanupIds[1716], $cleanupIds[1717], $cleanupIds[1718], $cleanupIds[1719], $cleanupIds[1720], $cleanupIds[1721], $cleanupIds[1722], $cleanupIds[1723], $cleanupIds[1724], $cleanupIds[1725], $cleanupIds[1726], $cleanupIds[1727], $cleanupIds[1728], $cleanupIds[1729], $cleanupIds[1730], $cleanupIds[1731], $cleanupIds[1732], $cleanupIds[1733], $cleanupIds[1734], $cleanupIds[1735], $cleanupIds[1736], $cleanupIds[1737], $cleanupIds[1738], $cleanupIds[1739], $cleanupIds[1740], $cleanupIds[1741], $cleanupIds[1742], $cleanupIds[1743], $cleanupIds[1744], $cleanupIds[1745], $cleanupIds[1746], $cleanupIds[1747], $cleanupIds[1748], $cleanupIds[1749], $cleanupIds[1750], $cleanupIds[1751], $cleanupIds[1752], $cleanupIds[1753], $cleanupIds[1754], $cleanupIds[1755], $cleanupIds[1756], $cleanupIds[1757], $cleanupIds[1758], $cleanupIds[1759], $cleanupIds[1760], $cleanupIds[1761], $cleanupIds[1762], $cleanupIds[1763], $cleanupIds[1764], $cleanupIds[1765], $cleanupIds[1766], $cleanupIds[1767], $cleanupIds[1768], $cleanupIds[1769], $cleanupIds[1770], $cleanupIds[1771], $cleanupIds[1772], $cleanupIds[1773], $cleanupIds[1774], $cleanupIds[1775], $cleanupIds[1776], $cleanupIds[1777], $cleanupIds[1778], $cleanupIds[1779], $cleanupIds[1780], $cleanupIds[1781], $cleanupIds[1782], $cleanupIds[1783], $cleanupIds[1784], $cleanupIds[1785], $cleanupIds[1786], $cleanupIds[1787], $cleanupIds[1788], $cleanupIds[1789], $cleanupIds[1790], $cleanupIds[1791], $cleanupIds[1792], $cleanupIds[1793], $cleanupIds[1794], $cleanupIds[1795], $cleanupIds[1796], $cleanupIds[1797], $cleanupIds[1798], $cleanupIds[1799], $cleanupIds[1800], $cleanupIds[1801], $cleanupIds[1802], $cleanupIds[1803], $cleanupIds[1804], $cleanupIds[1805], $cleanupIds[1806], $cleanupIds[1807], $cleanupIds[1808], $cleanupIds[1809], $cleanupIds[1810], $cleanupIds[1811], $cleanupIds[1812], $cleanupIds[1813], $cleanupIds[1814], $cleanupIds[1815], $cleanupIds[1816], $cleanupIds[1817], $cleanupIds[1818], $cleanupIds[1819], $cleanupIds[1820], $cleanupIds[1821], $cleanupIds[1822], $cleanupIds[1823], $cleanupIds[1824], $cleanupIds[1825], $cleanupIds[1826], $cleanupIds[1827], $cleanupIds[1828], $cleanupIds[1829], $cleanupIds[1830], $cleanupIds[1831], $cleanupIds[1832], $cleanupIds[1833], $cleanupIds[1834], $cleanupIds[1835], $cleanupIds[1836], $cleanupIds[1837], $cleanupIds[1838], $cleanupIds[1839], $cleanupIds[1840], $cleanupIds[1841], $cleanupIds[1842], $cleanupIds[1843], $cleanupIds[1844], $cleanupIds[1845], $cleanupIds[1846], $cleanupIds[1847], $cleanupIds[1848], $cleanupIds[1849], $cleanupIds[1850], $cleanupIds[1851], $cleanupIds[1852], $cleanupIds[1853], $cleanupIds[1854], $cleanupIds[1855], $cleanupIds[1856], $cleanupIds[1857], $cleanupIds[1858], $cleanupIds[1859], $cleanupIds[1860], $cleanupIds[1861], $cleanupIds[1862], $cleanupIds[1863], $cleanupIds[1864], $cleanupIds[1865], $cleanupIds[1866], $cleanupIds[1867], $cleanupIds[1868], $cleanupIds[1869], $cleanupIds[1870], $cleanupIds[1871], $cleanupIds[1872], $cleanupIds[1873], $cleanupIds[1874], $cleanupIds[1875], $cleanupIds[1876], $cleanupIds[1877], $cleanupIds[1878], $cleanupIds[1879], $cleanupIds[1880], $cleanupIds[1881], $cleanupIds[1882], $cleanupIds[1883], $cleanupIds[1884], $cleanupIds[1885], $cleanupIds[1886], $cleanupIds[1887], $cleanupIds[1888], $cleanupIds[1889], $cleanupIds[1890], $cleanupIds[1891], $cleanupIds[1892], $cleanupIds[1893], $cleanupIds[1894], $cleanupIds[1895], $cleanupIds[1896], $cleanupIds[1897], $cleanupIds[1898], $cleanupIds[1899], $cleanupIds[1900], $cleanupIds[1901], $cleanupIds[1902], $cleanupIds[1903], $cleanupIds[1904], $cleanupIds[1905], $cleanupIds[1906], $cleanupIds[1907], $cleanupIds[1908], $cleanupIds[1909], $cleanupIds[1910], $cleanupIds[1911], $cleanupIds[1912], $cleanupIds[1913], $cleanupIds[1914], $cleanupIds[1915], $cleanupIds[1916], $cleanupIds[1917], $cleanupIds[1918], $cleanupIds[1919], $cleanupIds[1920], $cleanupIds[1921], $cleanupIds[1922], $cleanupIds[1923], $cleanupIds[1924], $cleanupIds[1925], $cleanupIds[1926], $cleanupIds[1927], $cleanupIds[1928], $cleanupIds[1929], $cleanupIds[1930], $cleanupIds[1931], $cleanupIds[1932], $cleanupIds[1933], $cleanupIds[1934], $cleanupIds[1935], $cleanupIds[1936], $cleanupIds[1937], $cleanupIds[1938], $cleanupIds[1939], $cleanupIds[1940], $cleanupIds[1941], $cleanupIds[1942], $cleanupIds[1943], $cleanupIds[1944], $cleanupIds[1945], $cleanupIds[1946], $cleanupIds[1947], $cleanupIds[1948], $cleanupIds[1949], $cleanupIds[1950], $cleanupIds[1951], $cleanupIds[1952], $cleanupIds[1953], $cleanupIds[1954], $cleanupIds[1955], $cleanupIds[1956], $cleanupIds[1957], $cleanupIds[1958], $cleanupIds[1959], $cleanupIds[1960], $cleanupIds[1961], $cleanupIds[1962], $cleanupIds[1963], $cleanupIds[1964], $cleanupIds[1965], $cleanupIds[1966], $cleanupIds[1967], $cleanupIds[1968], $cleanupIds[1969], $cleanupIds[1970], $cleanupIds[1971], $cleanupIds[1972], $cleanupIds[1973], $cleanupIds[1974], $cleanupIds[1975], $cleanupIds[1976], $cleanupIds[1977], $cleanupIds[1978], $cleanupIds[1979], $cleanupIds[1980], $cleanupIds[1981], $cleanupIds[1982], $cleanupIds[1983], $cleanupIds[1984], $cleanupIds[1985], $cleanupIds[1986], $cleanupIds[1987], $cleanupIds[1988], $cleanupIds[1989], $cleanupIds[1990], $cleanupIds[1991], $cleanupIds[1992], $cleanupIds[1993], $cleanupIds[1994], $cleanupIds[1995], $cleanupIds[1996], $cleanupIds[1997], $cleanupIds[1998], $cleanupIds[1999], $cleanupIds[2000], $cleanupIds[2001], $cleanupIds[2002], $cleanupIds[2003], $cleanupIds[2004], $cleanupIds[2005], $cleanupIds[2006]);
+ $stmt->bind_param('iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii', $model, $cleanupIds[0], $cleanupIds[1], $cleanupIds[2], $cleanupIds[3], $cleanupIds[4], $cleanupIds[5], $cleanupIds[6], $cleanupIds[7], $cleanupIds[8], $cleanupIds[9], $cleanupIds[10], $cleanupIds[11], $cleanupIds[12], $cleanupIds[13], $cleanupIds[14], $cleanupIds[15], $cleanupIds[16], $cleanupIds[17], $cleanupIds[18], $cleanupIds[19], $cleanupIds[20], $cleanupIds[21], $cleanupIds[22], $cleanupIds[23], $cleanupIds[24], $cleanupIds[25], $cleanupIds[26], $cleanupIds[27], $cleanupIds[28], $cleanupIds[29], $cleanupIds[30], $cleanupIds[31], $cleanupIds[32], $cleanupIds[33], $cleanupIds[34], $cleanupIds[35], $cleanupIds[36], $cleanupIds[37], $cleanupIds[38], $cleanupIds[39], $cleanupIds[40], $cleanupIds[41], $cleanupIds[42], $cleanupIds[43], $cleanupIds[44], $cleanupIds[45], $cleanupIds[46], $cleanupIds[47], $cleanupIds[48], $cleanupIds[49], $cleanupIds[50], $cleanupIds[51], $cleanupIds[52], $cleanupIds[53], $cleanupIds[54], $cleanupIds[55], $cleanupIds[56], $cleanupIds[57], $cleanupIds[58], $cleanupIds[59], $cleanupIds[60], $cleanupIds[61], $cleanupIds[62], $cleanupIds[63], $cleanupIds[64], $cleanupIds[65], $cleanupIds[66], $cleanupIds[67], $cleanupIds[68], $cleanupIds[69], $cleanupIds[70], $cleanupIds[71], $cleanupIds[72], $cleanupIds[73], $cleanupIds[74], $cleanupIds[75], $cleanupIds[76], $cleanupIds[77], $cleanupIds[78], $cleanupIds[79], $cleanupIds[80], $cleanupIds[81], $cleanupIds[82], $cleanupIds[83], $cleanupIds[84], $cleanupIds[85], $cleanupIds[86], $cleanupIds[87], $cleanupIds[88], $cleanupIds[89], $cleanupIds[90], $cleanupIds[91], $cleanupIds[92], $cleanupIds[93], $cleanupIds[94], $cleanupIds[95], $cleanupIds[96], $cleanupIds[97], $cleanupIds[98], $cleanupIds[99], $cleanupIds[100], $cleanupIds[101], $cleanupIds[102], $cleanupIds[103], $cleanupIds[104], $cleanupIds[105], $cleanupIds[106], $cleanupIds[107], $cleanupIds[108], $cleanupIds[109], $cleanupIds[110], $cleanupIds[111], $cleanupIds[112], $cleanupIds[113], $cleanupIds[114], $cleanupIds[115], $cleanupIds[116], $cleanupIds[117], $cleanupIds[118], $cleanupIds[119], $cleanupIds[120], $cleanupIds[121], $cleanupIds[122], $cleanupIds[123], $cleanupIds[124], $cleanupIds[125], $cleanupIds[126], $cleanupIds[127], $cleanupIds[128], $cleanupIds[129], $cleanupIds[130], $cleanupIds[131], $cleanupIds[132], $cleanupIds[133], $cleanupIds[134], $cleanupIds[135], $cleanupIds[136], $cleanupIds[137], $cleanupIds[138], $cleanupIds[139], $cleanupIds[140], $cleanupIds[141], $cleanupIds[142], $cleanupIds[143], $cleanupIds[144], $cleanupIds[145], $cleanupIds[146], $cleanupIds[147], $cleanupIds[148], $cleanupIds[149], $cleanupIds[150], $cleanupIds[151], $cleanupIds[152], $cleanupIds[153], $cleanupIds[154], $cleanupIds[155], $cleanupIds[156], $cleanupIds[157], $cleanupIds[158], $cleanupIds[159], $cleanupIds[160], $cleanupIds[161], $cleanupIds[162], $cleanupIds[163], $cleanupIds[164], $cleanupIds[165], $cleanupIds[166], $cleanupIds[167], $cleanupIds[168], $cleanupIds[169], $cleanupIds[170], $cleanupIds[171], $cleanupIds[172], $cleanupIds[173], $cleanupIds[174], $cleanupIds[175], $cleanupIds[176], $cleanupIds[177], $cleanupIds[178], $cleanupIds[179], $cleanupIds[180], $cleanupIds[181], $cleanupIds[182], $cleanupIds[183], $cleanupIds[184], $cleanupIds[185], $cleanupIds[186], $cleanupIds[187], $cleanupIds[188], $cleanupIds[189], $cleanupIds[190], $cleanupIds[191], $cleanupIds[192], $cleanupIds[193], $cleanupIds[194], $cleanupIds[195], $cleanupIds[196], $cleanupIds[197], $cleanupIds[198], $cleanupIds[199], $cleanupIds[200], $cleanupIds[201], $cleanupIds[202], $cleanupIds[203], $cleanupIds[204], $cleanupIds[205], $cleanupIds[206], $cleanupIds[207], $cleanupIds[208], $cleanupIds[209], $cleanupIds[210], $cleanupIds[211], $cleanupIds[212], $cleanupIds[213], $cleanupIds[214], $cleanupIds[215], $cleanupIds[216], $cleanupIds[217], $cleanupIds[218], $cleanupIds[219], $cleanupIds[220], $cleanupIds[221], $cleanupIds[222], $cleanupIds[223], $cleanupIds[224], $cleanupIds[225], $cleanupIds[226], $cleanupIds[227], $cleanupIds[228], $cleanupIds[229], $cleanupIds[230], $cleanupIds[231], $cleanupIds[232], $cleanupIds[233], $cleanupIds[234], $cleanupIds[235], $cleanupIds[236], $cleanupIds[237], $cleanupIds[238], $cleanupIds[239], $cleanupIds[240], $cleanupIds[241], $cleanupIds[242], $cleanupIds[243], $cleanupIds[244], $cleanupIds[245], $cleanupIds[246], $cleanupIds[247], $cleanupIds[248], $cleanupIds[249], $cleanupIds[250], $cleanupIds[251], $cleanupIds[252], $cleanupIds[253], $cleanupIds[254], $cleanupIds[255], $cleanupIds[256], $cleanupIds[257], $cleanupIds[258], $cleanupIds[259], $cleanupIds[260], $cleanupIds[261], $cleanupIds[262], $cleanupIds[263], $cleanupIds[264], $cleanupIds[265], $cleanupIds[266], $cleanupIds[267], $cleanupIds[268], $cleanupIds[269], $cleanupIds[270], $cleanupIds[271], $cleanupIds[272], $cleanupIds[273], $cleanupIds[274], $cleanupIds[275], $cleanupIds[276], $cleanupIds[277], $cleanupIds[278], $cleanupIds[279], $cleanupIds[280], $cleanupIds[281], $cleanupIds[282], $cleanupIds[283], $cleanupIds[284], $cleanupIds[285], $cleanupIds[286], $cleanupIds[287], $cleanupIds[288], $cleanupIds[289], $cleanupIds[290], $cleanupIds[291], $cleanupIds[292], $cleanupIds[293], $cleanupIds[294], $cleanupIds[295], $cleanupIds[296], $cleanupIds[297], $cleanupIds[298], $cleanupIds[299], $cleanupIds[300], $cleanupIds[301], $cleanupIds[302], $cleanupIds[303], $cleanupIds[304], $cleanupIds[305], $cleanupIds[306], $cleanupIds[307], $cleanupIds[308], $cleanupIds[309], $cleanupIds[310], $cleanupIds[311], $cleanupIds[312], $cleanupIds[313], $cleanupIds[314], $cleanupIds[315], $cleanupIds[316], $cleanupIds[317], $cleanupIds[318], $cleanupIds[319], $cleanupIds[320], $cleanupIds[321], $cleanupIds[322], $cleanupIds[323], $cleanupIds[324], $cleanupIds[325], $cleanupIds[326], $cleanupIds[327], $cleanupIds[328], $cleanupIds[329], $cleanupIds[330], $cleanupIds[331], $cleanupIds[332], $cleanupIds[333], $cleanupIds[334], $cleanupIds[335], $cleanupIds[336], $cleanupIds[337], $cleanupIds[338], $cleanupIds[339], $cleanupIds[340], $cleanupIds[341], $cleanupIds[342], $cleanupIds[343], $cleanupIds[344], $cleanupIds[345], $cleanupIds[346], $cleanupIds[347], $cleanupIds[348], $cleanupIds[349], $cleanupIds[350], $cleanupIds[351], $cleanupIds[352], $cleanupIds[353], $cleanupIds[354], $cleanupIds[355], $cleanupIds[356], $cleanupIds[357], $cleanupIds[358], $cleanupIds[359], $cleanupIds[360], $cleanupIds[361], $cleanupIds[362], $cleanupIds[363], $cleanupIds[364], $cleanupIds[365], $cleanupIds[366], $cleanupIds[367], $cleanupIds[368], $cleanupIds[369], $cleanupIds[370], $cleanupIds[371], $cleanupIds[372], $cleanupIds[373], $cleanupIds[374], $cleanupIds[375], $cleanupIds[376], $cleanupIds[377], $cleanupIds[378], $cleanupIds[379], $cleanupIds[380], $cleanupIds[381], $cleanupIds[382], $cleanupIds[383], $cleanupIds[384], $cleanupIds[385], $cleanupIds[386], $cleanupIds[387], $cleanupIds[388], $cleanupIds[389], $cleanupIds[390], $cleanupIds[391], $cleanupIds[392], $cleanupIds[393], $cleanupIds[394], $cleanupIds[395], $cleanupIds[396], $cleanupIds[397], $cleanupIds[398], $cleanupIds[399], $cleanupIds[400], $cleanupIds[401], $cleanupIds[402], $cleanupIds[403], $cleanupIds[404], $cleanupIds[405], $cleanupIds[406], $cleanupIds[407], $cleanupIds[408], $cleanupIds[409], $cleanupIds[410], $cleanupIds[411], $cleanupIds[412], $cleanupIds[413], $cleanupIds[414], $cleanupIds[415], $cleanupIds[416], $cleanupIds[417], $cleanupIds[418], $cleanupIds[419], $cleanupIds[420], $cleanupIds[421], $cleanupIds[422], $cleanupIds[423], $cleanupIds[424], $cleanupIds[425], $cleanupIds[426], $cleanupIds[427], $cleanupIds[428], $cleanupIds[429], $cleanupIds[430], $cleanupIds[431], $cleanupIds[432], $cleanupIds[433], $cleanupIds[434], $cleanupIds[435], $cleanupIds[436], $cleanupIds[437], $cleanupIds[438], $cleanupIds[439], $cleanupIds[440], $cleanupIds[441], $cleanupIds[442], $cleanupIds[443], $cleanupIds[444], $cleanupIds[445], $cleanupIds[446], $cleanupIds[447], $cleanupIds[448], $cleanupIds[449], $cleanupIds[450], $cleanupIds[451], $cleanupIds[452], $cleanupIds[453], $cleanupIds[454], $cleanupIds[455], $cleanupIds[456], $cleanupIds[457], $cleanupIds[458], $cleanupIds[459], $cleanupIds[460], $cleanupIds[461], $cleanupIds[462], $cleanupIds[463], $cleanupIds[464], $cleanupIds[465], $cleanupIds[466], $cleanupIds[467], $cleanupIds[468], $cleanupIds[469], $cleanupIds[470], $cleanupIds[471], $cleanupIds[472], $cleanupIds[473], $cleanupIds[474], $cleanupIds[475], $cleanupIds[476], $cleanupIds[477], $cleanupIds[478], $cleanupIds[479], $cleanupIds[480], $cleanupIds[481], $cleanupIds[482], $cleanupIds[483], $cleanupIds[484], $cleanupIds[485], $cleanupIds[486], $cleanupIds[487], $cleanupIds[488], $cleanupIds[489], $cleanupIds[490], $cleanupIds[491], $cleanupIds[492], $cleanupIds[493], $cleanupIds[494], $cleanupIds[495], $cleanupIds[496], $cleanupIds[497], $cleanupIds[498], $cleanupIds[499], $cleanupIds[500], $cleanupIds[501], $cleanupIds[502], $cleanupIds[503], $cleanupIds[504], $cleanupIds[505], $cleanupIds[506], $cleanupIds[507], $cleanupIds[508], $cleanupIds[509], $cleanupIds[510], $cleanupIds[511], $cleanupIds[512], $cleanupIds[513], $cleanupIds[514], $cleanupIds[515], $cleanupIds[516], $cleanupIds[517], $cleanupIds[518], $cleanupIds[519], $cleanupIds[520], $cleanupIds[521], $cleanupIds[522], $cleanupIds[523], $cleanupIds[524], $cleanupIds[525], $cleanupIds[526], $cleanupIds[527], $cleanupIds[528], $cleanupIds[529], $cleanupIds[530], $cleanupIds[531], $cleanupIds[532], $cleanupIds[533], $cleanupIds[534], $cleanupIds[535], $cleanupIds[536], $cleanupIds[537], $cleanupIds[538], $cleanupIds[539], $cleanupIds[540], $cleanupIds[541], $cleanupIds[542], $cleanupIds[543], $cleanupIds[544], $cleanupIds[545], $cleanupIds[546], $cleanupIds[547], $cleanupIds[548], $cleanupIds[549], $cleanupIds[550], $cleanupIds[551], $cleanupIds[552], $cleanupIds[553], $cleanupIds[554], $cleanupIds[555], $cleanupIds[556], $cleanupIds[557], $cleanupIds[558], $cleanupIds[559], $cleanupIds[560], $cleanupIds[561], $cleanupIds[562], $cleanupIds[563], $cleanupIds[564], $cleanupIds[565], $cleanupIds[566], $cleanupIds[567], $cleanupIds[568], $cleanupIds[569], $cleanupIds[570], $cleanupIds[571], $cleanupIds[572], $cleanupIds[573], $cleanupIds[574], $cleanupIds[575], $cleanupIds[576], $cleanupIds[577], $cleanupIds[578], $cleanupIds[579], $cleanupIds[580], $cleanupIds[581], $cleanupIds[582], $cleanupIds[583], $cleanupIds[584], $cleanupIds[585], $cleanupIds[586], $cleanupIds[587], $cleanupIds[588], $cleanupIds[589], $cleanupIds[590], $cleanupIds[591], $cleanupIds[592], $cleanupIds[593], $cleanupIds[594], $cleanupIds[595], $cleanupIds[596], $cleanupIds[597], $cleanupIds[598], $cleanupIds[599], $cleanupIds[600], $cleanupIds[601], $cleanupIds[602], $cleanupIds[603], $cleanupIds[604], $cleanupIds[605], $cleanupIds[606], $cleanupIds[607], $cleanupIds[608], $cleanupIds[609], $cleanupIds[610], $cleanupIds[611], $cleanupIds[612], $cleanupIds[613], $cleanupIds[614], $cleanupIds[615], $cleanupIds[616], $cleanupIds[617], $cleanupIds[618], $cleanupIds[619], $cleanupIds[620], $cleanupIds[621], $cleanupIds[622], $cleanupIds[623], $cleanupIds[624], $cleanupIds[625], $cleanupIds[626], $cleanupIds[627], $cleanupIds[628], $cleanupIds[629], $cleanupIds[630], $cleanupIds[631], $cleanupIds[632], $cleanupIds[633], $cleanupIds[634], $cleanupIds[635], $cleanupIds[636], $cleanupIds[637], $cleanupIds[638], $cleanupIds[639], $cleanupIds[640], $cleanupIds[641], $cleanupIds[642], $cleanupIds[643], $cleanupIds[644], $cleanupIds[645], $cleanupIds[646], $cleanupIds[647], $cleanupIds[648], $cleanupIds[649], $cleanupIds[650], $cleanupIds[651], $cleanupIds[652], $cleanupIds[653], $cleanupIds[654], $cleanupIds[655], $cleanupIds[656], $cleanupIds[657], $cleanupIds[658], $cleanupIds[659], $cleanupIds[660], $cleanupIds[661], $cleanupIds[662], $cleanupIds[663], $cleanupIds[664], $cleanupIds[665], $cleanupIds[666], $cleanupIds[667], $cleanupIds[668], $cleanupIds[669], $cleanupIds[670], $cleanupIds[671], $cleanupIds[672], $cleanupIds[673], $cleanupIds[674], $cleanupIds[675], $cleanupIds[676], $cleanupIds[677], $cleanupIds[678], $cleanupIds[679], $cleanupIds[680], $cleanupIds[681], $cleanupIds[682], $cleanupIds[683], $cleanupIds[684], $cleanupIds[685], $cleanupIds[686], $cleanupIds[687], $cleanupIds[688], $cleanupIds[689], $cleanupIds[690], $cleanupIds[691], $cleanupIds[692], $cleanupIds[693], $cleanupIds[694], $cleanupIds[695], $cleanupIds[696], $cleanupIds[697], $cleanupIds[698], $cleanupIds[699], $cleanupIds[700], $cleanupIds[701], $cleanupIds[702], $cleanupIds[703], $cleanupIds[704], $cleanupIds[705], $cleanupIds[706], $cleanupIds[707], $cleanupIds[708], $cleanupIds[709], $cleanupIds[710], $cleanupIds[711], $cleanupIds[712], $cleanupIds[713], $cleanupIds[714], $cleanupIds[715], $cleanupIds[716], $cleanupIds[717], $cleanupIds[718], $cleanupIds[719], $cleanupIds[720], $cleanupIds[721], $cleanupIds[722], $cleanupIds[723], $cleanupIds[724], $cleanupIds[725], $cleanupIds[726], $cleanupIds[727], $cleanupIds[728], $cleanupIds[729], $cleanupIds[730], $cleanupIds[731], $cleanupIds[732], $cleanupIds[733], $cleanupIds[734], $cleanupIds[735], $cleanupIds[736], $cleanupIds[737], $cleanupIds[738], $cleanupIds[739], $cleanupIds[740], $cleanupIds[741], $cleanupIds[742], $cleanupIds[743], $cleanupIds[744], $cleanupIds[745], $cleanupIds[746], $cleanupIds[747], $cleanupIds[748], $cleanupIds[749], $cleanupIds[750], $cleanupIds[751], $cleanupIds[752], $cleanupIds[753], $cleanupIds[754], $cleanupIds[755], $cleanupIds[756], $cleanupIds[757], $cleanupIds[758], $cleanupIds[759], $cleanupIds[760], $cleanupIds[761], $cleanupIds[762], $cleanupIds[763], $cleanupIds[764], $cleanupIds[765], $cleanupIds[766], $cleanupIds[767], $cleanupIds[768], $cleanupIds[769], $cleanupIds[770], $cleanupIds[771], $cleanupIds[772], $cleanupIds[773], $cleanupIds[774], $cleanupIds[775], $cleanupIds[776], $cleanupIds[777], $cleanupIds[778], $cleanupIds[779], $cleanupIds[780], $cleanupIds[781], $cleanupIds[782], $cleanupIds[783], $cleanupIds[784], $cleanupIds[785], $cleanupIds[786], $cleanupIds[787], $cleanupIds[788], $cleanupIds[789], $cleanupIds[790], $cleanupIds[791], $cleanupIds[792], $cleanupIds[793], $cleanupIds[794], $cleanupIds[795], $cleanupIds[796], $cleanupIds[797], $cleanupIds[798], $cleanupIds[799], $cleanupIds[800], $cleanupIds[801], $cleanupIds[802], $cleanupIds[803], $cleanupIds[804], $cleanupIds[805], $cleanupIds[806], $cleanupIds[807], $cleanupIds[808], $cleanupIds[809], $cleanupIds[810], $cleanupIds[811], $cleanupIds[812], $cleanupIds[813], $cleanupIds[814], $cleanupIds[815], $cleanupIds[816], $cleanupIds[817], $cleanupIds[818], $cleanupIds[819], $cleanupIds[820], $cleanupIds[821], $cleanupIds[822], $cleanupIds[823], $cleanupIds[824], $cleanupIds[825], $cleanupIds[826], $cleanupIds[827], $cleanupIds[828], $cleanupIds[829], $cleanupIds[830], $cleanupIds[831], $cleanupIds[832], $cleanupIds[833], $cleanupIds[834], $cleanupIds[835], $cleanupIds[836], $cleanupIds[837], $cleanupIds[838], $cleanupIds[839], $cleanupIds[840], $cleanupIds[841], $cleanupIds[842], $cleanupIds[843], $cleanupIds[844], $cleanupIds[845], $cleanupIds[846], $cleanupIds[847], $cleanupIds[848], $cleanupIds[849], $cleanupIds[850], $cleanupIds[851], $cleanupIds[852], $cleanupIds[853], $cleanupIds[854], $cleanupIds[855], $cleanupIds[856], $cleanupIds[857], $cleanupIds[858], $cleanupIds[859], $cleanupIds[860], $cleanupIds[861], $cleanupIds[862], $cleanupIds[863], $cleanupIds[864], $cleanupIds[865], $cleanupIds[866], $cleanupIds[867], $cleanupIds[868], $cleanupIds[869], $cleanupIds[870], $cleanupIds[871], $cleanupIds[872], $cleanupIds[873], $cleanupIds[874], $cleanupIds[875], $cleanupIds[876], $cleanupIds[877], $cleanupIds[878], $cleanupIds[879], $cleanupIds[880], $cleanupIds[881], $cleanupIds[882], $cleanupIds[883], $cleanupIds[884], $cleanupIds[885], $cleanupIds[886], $cleanupIds[887], $cleanupIds[888], $cleanupIds[889], $cleanupIds[890], $cleanupIds[891], $cleanupIds[892], $cleanupIds[893], $cleanupIds[894], $cleanupIds[895], $cleanupIds[896], $cleanupIds[897], $cleanupIds[898], $cleanupIds[899], $cleanupIds[900], $cleanupIds[901], $cleanupIds[902], $cleanupIds[903], $cleanupIds[904], $cleanupIds[905], $cleanupIds[906], $cleanupIds[907], $cleanupIds[908], $cleanupIds[909], $cleanupIds[910], $cleanupIds[911], $cleanupIds[912], $cleanupIds[913], $cleanupIds[914], $cleanupIds[915], $cleanupIds[916], $cleanupIds[917], $cleanupIds[918], $cleanupIds[919], $cleanupIds[920], $cleanupIds[921], $cleanupIds[922], $cleanupIds[923], $cleanupIds[924], $cleanupIds[925], $cleanupIds[926], $cleanupIds[927], $cleanupIds[928], $cleanupIds[929], $cleanupIds[930], $cleanupIds[931], $cleanupIds[932], $cleanupIds[933], $cleanupIds[934], $cleanupIds[935], $cleanupIds[936], $cleanupIds[937], $cleanupIds[938], $cleanupIds[939], $cleanupIds[940], $cleanupIds[941], $cleanupIds[942], $cleanupIds[943], $cleanupIds[944], $cleanupIds[945], $cleanupIds[946], $cleanupIds[947], $cleanupIds[948], $cleanupIds[949], $cleanupIds[950], $cleanupIds[951], $cleanupIds[952], $cleanupIds[953], $cleanupIds[954], $cleanupIds[955], $cleanupIds[956], $cleanupIds[957], $cleanupIds[958], $cleanupIds[959], $cleanupIds[960], $cleanupIds[961], $cleanupIds[962], $cleanupIds[963], $cleanupIds[964], $cleanupIds[965], $cleanupIds[966], $cleanupIds[967], $cleanupIds[968], $cleanupIds[969], $cleanupIds[970], $cleanupIds[971], $cleanupIds[972], $cleanupIds[973], $cleanupIds[974], $cleanupIds[975], $cleanupIds[976], $cleanupIds[977], $cleanupIds[978], $cleanupIds[979], $cleanupIds[980], $cleanupIds[981], $cleanupIds[982], $cleanupIds[983], $cleanupIds[984], $cleanupIds[985], $cleanupIds[986], $cleanupIds[987], $cleanupIds[988], $cleanupIds[989], $cleanupIds[990], $cleanupIds[991], $cleanupIds[992], $cleanupIds[993], $cleanupIds[994], $cleanupIds[995], $cleanupIds[996], $cleanupIds[997], $cleanupIds[998], $cleanupIds[999], $cleanupIds[1000], $cleanupIds[1001], $cleanupIds[1002], $cleanupIds[1003], $cleanupIds[1004], $cleanupIds[1005], $cleanupIds[1006], $cleanupIds[1007], $cleanupIds[1008], $cleanupIds[1009], $cleanupIds[1010], $cleanupIds[1011], $cleanupIds[1012], $cleanupIds[1013], $cleanupIds[1014], $cleanupIds[1015], $cleanupIds[1016], $cleanupIds[1017], $cleanupIds[1018], $cleanupIds[1019], $cleanupIds[1020], $cleanupIds[1021], $cleanupIds[1022], $cleanupIds[1023], $cleanupIds[1024], $cleanupIds[1025], $cleanupIds[1026], $cleanupIds[1027], $cleanupIds[1028], $cleanupIds[1029], $cleanupIds[1030], $cleanupIds[1031], $cleanupIds[1032], $cleanupIds[1033], $cleanupIds[1034], $cleanupIds[1035], $cleanupIds[1036], $cleanupIds[1037], $cleanupIds[1038], $cleanupIds[1039], $cleanupIds[1040], $cleanupIds[1041], $cleanupIds[1042], $cleanupIds[1043], $cleanupIds[1044], $cleanupIds[1045], $cleanupIds[1046], $cleanupIds[1047], $cleanupIds[1048], $cleanupIds[1049], $cleanupIds[1050], $cleanupIds[1051], $cleanupIds[1052], $cleanupIds[1053], $cleanupIds[1054], $cleanupIds[1055], $cleanupIds[1056], $cleanupIds[1057], $cleanupIds[1058], $cleanupIds[1059], $cleanupIds[1060], $cleanupIds[1061], $cleanupIds[1062], $cleanupIds[1063], $cleanupIds[1064], $cleanupIds[1065], $cleanupIds[1066], $cleanupIds[1067], $cleanupIds[1068], $cleanupIds[1069], $cleanupIds[1070], $cleanupIds[1071], $cleanupIds[1072], $cleanupIds[1073], $cleanupIds[1074], $cleanupIds[1075], $cleanupIds[1076], $cleanupIds[1077], $cleanupIds[1078], $cleanupIds[1079], $cleanupIds[1080], $cleanupIds[1081], $cleanupIds[1082], $cleanupIds[1083], $cleanupIds[1084], $cleanupIds[1085], $cleanupIds[1086], $cleanupIds[1087], $cleanupIds[1088], $cleanupIds[1089], $cleanupIds[1090], $cleanupIds[1091], $cleanupIds[1092], $cleanupIds[1093], $cleanupIds[1094], $cleanupIds[1095], $cleanupIds[1096], $cleanupIds[1097], $cleanupIds[1098], $cleanupIds[1099], $cleanupIds[1100], $cleanupIds[1101], $cleanupIds[1102], $cleanupIds[1103], $cleanupIds[1104], $cleanupIds[1105], $cleanupIds[1106], $cleanupIds[1107], $cleanupIds[1108], $cleanupIds[1109], $cleanupIds[1110], $cleanupIds[1111], $cleanupIds[1112], $cleanupIds[1113], $cleanupIds[1114], $cleanupIds[1115], $cleanupIds[1116], $cleanupIds[1117], $cleanupIds[1118], $cleanupIds[1119], $cleanupIds[1120], $cleanupIds[1121], $cleanupIds[1122], $cleanupIds[1123], $cleanupIds[1124], $cleanupIds[1125], $cleanupIds[1126], $cleanupIds[1127], $cleanupIds[1128], $cleanupIds[1129], $cleanupIds[1130], $cleanupIds[1131], $cleanupIds[1132], $cleanupIds[1133], $cleanupIds[1134], $cleanupIds[1135], $cleanupIds[1136], $cleanupIds[1137], $cleanupIds[1138], $cleanupIds[1139], $cleanupIds[1140], $cleanupIds[1141], $cleanupIds[1142], $cleanupIds[1143], $cleanupIds[1144], $cleanupIds[1145], $cleanupIds[1146], $cleanupIds[1147], $cleanupIds[1148], $cleanupIds[1149], $cleanupIds[1150], $cleanupIds[1151], $cleanupIds[1152], $cleanupIds[1153], $cleanupIds[1154], $cleanupIds[1155], $cleanupIds[1156], $cleanupIds[1157], $cleanupIds[1158], $cleanupIds[1159], $cleanupIds[1160], $cleanupIds[1161], $cleanupIds[1162], $cleanupIds[1163], $cleanupIds[1164], $cleanupIds[1165], $cleanupIds[1166], $cleanupIds[1167], $cleanupIds[1168], $cleanupIds[1169], $cleanupIds[1170], $cleanupIds[1171], $cleanupIds[1172], $cleanupIds[1173], $cleanupIds[1174], $cleanupIds[1175], $cleanupIds[1176], $cleanupIds[1177], $cleanupIds[1178], $cleanupIds[1179], $cleanupIds[1180], $cleanupIds[1181], $cleanupIds[1182], $cleanupIds[1183], $cleanupIds[1184], $cleanupIds[1185], $cleanupIds[1186], $cleanupIds[1187], $cleanupIds[1188], $cleanupIds[1189], $cleanupIds[1190], $cleanupIds[1191], $cleanupIds[1192], $cleanupIds[1193], $cleanupIds[1194], $cleanupIds[1195], $cleanupIds[1196], $cleanupIds[1197], $cleanupIds[1198], $cleanupIds[1199], $cleanupIds[1200], $cleanupIds[1201], $cleanupIds[1202], $cleanupIds[1203], $cleanupIds[1204], $cleanupIds[1205], $cleanupIds[1206], $cleanupIds[1207], $cleanupIds[1208], $cleanupIds[1209], $cleanupIds[1210], $cleanupIds[1211], $cleanupIds[1212], $cleanupIds[1213], $cleanupIds[1214], $cleanupIds[1215], $cleanupIds[1216], $cleanupIds[1217], $cleanupIds[1218], $cleanupIds[1219], $cleanupIds[1220], $cleanupIds[1221], $cleanupIds[1222], $cleanupIds[1223], $cleanupIds[1224], $cleanupIds[1225], $cleanupIds[1226], $cleanupIds[1227], $cleanupIds[1228], $cleanupIds[1229], $cleanupIds[1230], $cleanupIds[1231], $cleanupIds[1232], $cleanupIds[1233], $cleanupIds[1234], $cleanupIds[1235], $cleanupIds[1236], $cleanupIds[1237], $cleanupIds[1238], $cleanupIds[1239], $cleanupIds[1240], $cleanupIds[1241], $cleanupIds[1242], $cleanupIds[1243], $cleanupIds[1244], $cleanupIds[1245], $cleanupIds[1246], $cleanupIds[1247], $cleanupIds[1248], $cleanupIds[1249], $cleanupIds[1250], $cleanupIds[1251], $cleanupIds[1252], $cleanupIds[1253], $cleanupIds[1254], $cleanupIds[1255], $cleanupIds[1256], $cleanupIds[1257], $cleanupIds[1258], $cleanupIds[1259], $cleanupIds[1260], $cleanupIds[1261], $cleanupIds[1262], $cleanupIds[1263], $cleanupIds[1264], $cleanupIds[1265], $cleanupIds[1266], $cleanupIds[1267], $cleanupIds[1268], $cleanupIds[1269], $cleanupIds[1270], $cleanupIds[1271], $cleanupIds[1272], $cleanupIds[1273], $cleanupIds[1274], $cleanupIds[1275], $cleanupIds[1276], $cleanupIds[1277], $cleanupIds[1278], $cleanupIds[1279], $cleanupIds[1280], $cleanupIds[1281], $cleanupIds[1282], $cleanupIds[1283], $cleanupIds[1284], $cleanupIds[1285], $cleanupIds[1286], $cleanupIds[1287], $cleanupIds[1288], $cleanupIds[1289], $cleanupIds[1290], $cleanupIds[1291], $cleanupIds[1292], $cleanupIds[1293], $cleanupIds[1294], $cleanupIds[1295], $cleanupIds[1296], $cleanupIds[1297], $cleanupIds[1298], $cleanupIds[1299], $cleanupIds[1300], $cleanupIds[1301], $cleanupIds[1302], $cleanupIds[1303], $cleanupIds[1304], $cleanupIds[1305], $cleanupIds[1306], $cleanupIds[1307], $cleanupIds[1308], $cleanupIds[1309], $cleanupIds[1310], $cleanupIds[1311], $cleanupIds[1312], $cleanupIds[1313], $cleanupIds[1314], $cleanupIds[1315], $cleanupIds[1316], $cleanupIds[1317], $cleanupIds[1318], $cleanupIds[1319], $cleanupIds[1320], $cleanupIds[1321], $cleanupIds[1322], $cleanupIds[1323], $cleanupIds[1324], $cleanupIds[1325], $cleanupIds[1326], $cleanupIds[1327], $cleanupIds[1328], $cleanupIds[1329], $cleanupIds[1330], $cleanupIds[1331], $cleanupIds[1332], $cleanupIds[1333], $cleanupIds[1334], $cleanupIds[1335], $cleanupIds[1336], $cleanupIds[1337], $cleanupIds[1338], $cleanupIds[1339], $cleanupIds[1340], $cleanupIds[1341], $cleanupIds[1342], $cleanupIds[1343], $cleanupIds[1344], $cleanupIds[1345], $cleanupIds[1346], $cleanupIds[1347], $cleanupIds[1348], $cleanupIds[1349], $cleanupIds[1350], $cleanupIds[1351], $cleanupIds[1352], $cleanupIds[1353], $cleanupIds[1354], $cleanupIds[1355], $cleanupIds[1356], $cleanupIds[1357], $cleanupIds[1358], $cleanupIds[1359], $cleanupIds[1360], $cleanupIds[1361], $cleanupIds[1362], $cleanupIds[1363], $cleanupIds[1364], $cleanupIds[1365], $cleanupIds[1366], $cleanupIds[1367], $cleanupIds[1368], $cleanupIds[1369], $cleanupIds[1370], $cleanupIds[1371], $cleanupIds[1372], $cleanupIds[1373], $cleanupIds[1374], $cleanupIds[1375], $cleanupIds[1376], $cleanupIds[1377], $cleanupIds[1378], $cleanupIds[1379], $cleanupIds[1380], $cleanupIds[1381], $cleanupIds[1382], $cleanupIds[1383], $cleanupIds[1384], $cleanupIds[1385], $cleanupIds[1386], $cleanupIds[1387], $cleanupIds[1388], $cleanupIds[1389], $cleanupIds[1390], $cleanupIds[1391], $cleanupIds[1392], $cleanupIds[1393], $cleanupIds[1394], $cleanupIds[1395], $cleanupIds[1396], $cleanupIds[1397], $cleanupIds[1398], $cleanupIds[1399], $cleanupIds[1400], $cleanupIds[1401], $cleanupIds[1402], $cleanupIds[1403], $cleanupIds[1404], $cleanupIds[1405], $cleanupIds[1406], $cleanupIds[1407], $cleanupIds[1408], $cleanupIds[1409], $cleanupIds[1410], $cleanupIds[1411], $cleanupIds[1412], $cleanupIds[1413], $cleanupIds[1414], $cleanupIds[1415], $cleanupIds[1416], $cleanupIds[1417], $cleanupIds[1418], $cleanupIds[1419], $cleanupIds[1420], $cleanupIds[1421], $cleanupIds[1422], $cleanupIds[1423], $cleanupIds[1424], $cleanupIds[1425], $cleanupIds[1426], $cleanupIds[1427], $cleanupIds[1428], $cleanupIds[1429], $cleanupIds[1430], $cleanupIds[1431], $cleanupIds[1432], $cleanupIds[1433], $cleanupIds[1434], $cleanupIds[1435], $cleanupIds[1436], $cleanupIds[1437], $cleanupIds[1438], $cleanupIds[1439], $cleanupIds[1440], $cleanupIds[1441], $cleanupIds[1442], $cleanupIds[1443], $cleanupIds[1444], $cleanupIds[1445], $cleanupIds[1446], $cleanupIds[1447], $cleanupIds[1448], $cleanupIds[1449], $cleanupIds[1450], $cleanupIds[1451], $cleanupIds[1452], $cleanupIds[1453], $cleanupIds[1454], $cleanupIds[1455], $cleanupIds[1456], $cleanupIds[1457], $cleanupIds[1458], $cleanupIds[1459], $cleanupIds[1460], $cleanupIds[1461], $cleanupIds[1462], $cleanupIds[1463], $cleanupIds[1464], $cleanupIds[1465], $cleanupIds[1466], $cleanupIds[1467], $cleanupIds[1468], $cleanupIds[1469], $cleanupIds[1470], $cleanupIds[1471], $cleanupIds[1472], $cleanupIds[1473], $cleanupIds[1474], $cleanupIds[1475], $cleanupIds[1476], $cleanupIds[1477], $cleanupIds[1478], $cleanupIds[1479], $cleanupIds[1480], $cleanupIds[1481], $cleanupIds[1482], $cleanupIds[1483], $cleanupIds[1484], $cleanupIds[1485], $cleanupIds[1486], $cleanupIds[1487], $cleanupIds[1488], $cleanupIds[1489], $cleanupIds[1490], $cleanupIds[1491], $cleanupIds[1492], $cleanupIds[1493], $cleanupIds[1494], $cleanupIds[1495], $cleanupIds[1496], $cleanupIds[1497], $cleanupIds[1498], $cleanupIds[1499], $cleanupIds[1500], $cleanupIds[1501], $cleanupIds[1502], $cleanupIds[1503], $cleanupIds[1504], $cleanupIds[1505], $cleanupIds[1506], $cleanupIds[1507], $cleanupIds[1508], $cleanupIds[1509], $cleanupIds[1510], $cleanupIds[1511], $cleanupIds[1512], $cleanupIds[1513], $cleanupIds[1514], $cleanupIds[1515], $cleanupIds[1516], $cleanupIds[1517], $cleanupIds[1518], $cleanupIds[1519], $cleanupIds[1520], $cleanupIds[1521], $cleanupIds[1522], $cleanupIds[1523], $cleanupIds[1524], $cleanupIds[1525], $cleanupIds[1526], $cleanupIds[1527], $cleanupIds[1528], $cleanupIds[1529], $cleanupIds[1530], $cleanupIds[1531], $cleanupIds[1532], $cleanupIds[1533], $cleanupIds[1534], $cleanupIds[1535], $cleanupIds[1536], $cleanupIds[1537], $cleanupIds[1538], $cleanupIds[1539], $cleanupIds[1540], $cleanupIds[1541], $cleanupIds[1542], $cleanupIds[1543], $cleanupIds[1544], $cleanupIds[1545], $cleanupIds[1546], $cleanupIds[1547], $cleanupIds[1548], $cleanupIds[1549], $cleanupIds[1550], $cleanupIds[1551], $cleanupIds[1552], $cleanupIds[1553], $cleanupIds[1554], $cleanupIds[1555], $cleanupIds[1556], $cleanupIds[1557], $cleanupIds[1558], $cleanupIds[1559], $cleanupIds[1560], $cleanupIds[1561], $cleanupIds[1562], $cleanupIds[1563], $cleanupIds[1564], $cleanupIds[1565], $cleanupIds[1566], $cleanupIds[1567], $cleanupIds[1568], $cleanupIds[1569], $cleanupIds[1570], $cleanupIds[1571], $cleanupIds[1572], $cleanupIds[1573], $cleanupIds[1574], $cleanupIds[1575], $cleanupIds[1576], $cleanupIds[1577], $cleanupIds[1578], $cleanupIds[1579], $cleanupIds[1580], $cleanupIds[1581], $cleanupIds[1582], $cleanupIds[1583], $cleanupIds[1584], $cleanupIds[1585], $cleanupIds[1586], $cleanupIds[1587], $cleanupIds[1588], $cleanupIds[1589], $cleanupIds[1590], $cleanupIds[1591], $cleanupIds[1592], $cleanupIds[1593], $cleanupIds[1594], $cleanupIds[1595], $cleanupIds[1596], $cleanupIds[1597], $cleanupIds[1598], $cleanupIds[1599], $cleanupIds[1600], $cleanupIds[1601], $cleanupIds[1602], $cleanupIds[1603], $cleanupIds[1604], $cleanupIds[1605], $cleanupIds[1606], $cleanupIds[1607], $cleanupIds[1608], $cleanupIds[1609], $cleanupIds[1610], $cleanupIds[1611], $cleanupIds[1612], $cleanupIds[1613], $cleanupIds[1614], $cleanupIds[1615], $cleanupIds[1616], $cleanupIds[1617], $cleanupIds[1618], $cleanupIds[1619], $cleanupIds[1620], $cleanupIds[1621], $cleanupIds[1622], $cleanupIds[1623], $cleanupIds[1624], $cleanupIds[1625], $cleanupIds[1626], $cleanupIds[1627], $cleanupIds[1628], $cleanupIds[1629], $cleanupIds[1630], $cleanupIds[1631], $cleanupIds[1632], $cleanupIds[1633], $cleanupIds[1634], $cleanupIds[1635], $cleanupIds[1636], $cleanupIds[1637], $cleanupIds[1638], $cleanupIds[1639], $cleanupIds[1640], $cleanupIds[1641], $cleanupIds[1642], $cleanupIds[1643], $cleanupIds[1644], $cleanupIds[1645], $cleanupIds[1646], $cleanupIds[1647], $cleanupIds[1648], $cleanupIds[1649], $cleanupIds[1650], $cleanupIds[1651], $cleanupIds[1652], $cleanupIds[1653], $cleanupIds[1654], $cleanupIds[1655], $cleanupIds[1656], $cleanupIds[1657], $cleanupIds[1658], $cleanupIds[1659], $cleanupIds[1660], $cleanupIds[1661], $cleanupIds[1662], $cleanupIds[1663], $cleanupIds[1664], $cleanupIds[1665], $cleanupIds[1666], $cleanupIds[1667], $cleanupIds[1668], $cleanupIds[1669], $cleanupIds[1670], $cleanupIds[1671], $cleanupIds[1672], $cleanupIds[1673], $cleanupIds[1674], $cleanupIds[1675], $cleanupIds[1676], $cleanupIds[1677], $cleanupIds[1678], $cleanupIds[1679], $cleanupIds[1680], $cleanupIds[1681], $cleanupIds[1682], $cleanupIds[1683], $cleanupIds[1684], $cleanupIds[1685], $cleanupIds[1686], $cleanupIds[1687], $cleanupIds[1688], $cleanupIds[1689], $cleanupIds[1690], $cleanupIds[1691], $cleanupIds[1692], $cleanupIds[1693], $cleanupIds[1694], $cleanupIds[1695], $cleanupIds[1696], $cleanupIds[1697], $cleanupIds[1698], $cleanupIds[1699], $cleanupIds[1700], $cleanupIds[1701], $cleanupIds[1702], $cleanupIds[1703], $cleanupIds[1704], $cleanupIds[1705], $cleanupIds[1706], $cleanupIds[1707], $cleanupIds[1708], $cleanupIds[1709], $cleanupIds[1710], $cleanupIds[1711], $cleanupIds[1712], $cleanupIds[1713], $cleanupIds[1714], $cleanupIds[1715], $cleanupIds[1716], $cleanupIds[1717], $cleanupIds[1718], $cleanupIds[1719], $cleanupIds[1720], $cleanupIds[1721], $cleanupIds[1722], $cleanupIds[1723], $cleanupIds[1724], $cleanupIds[1725], $cleanupIds[1726], $cleanupIds[1727], $cleanupIds[1728], $cleanupIds[1729], $cleanupIds[1730], $cleanupIds[1731], $cleanupIds[1732], $cleanupIds[1733], $cleanupIds[1734], $cleanupIds[1735], $cleanupIds[1736], $cleanupIds[1737], $cleanupIds[1738], $cleanupIds[1739], $cleanupIds[1740], $cleanupIds[1741], $cleanupIds[1742], $cleanupIds[1743], $cleanupIds[1744], $cleanupIds[1745], $cleanupIds[1746], $cleanupIds[1747], $cleanupIds[1748], $cleanupIds[1749], $cleanupIds[1750], $cleanupIds[1751], $cleanupIds[1752], $cleanupIds[1753], $cleanupIds[1754], $cleanupIds[1755], $cleanupIds[1756], $cleanupIds[1757], $cleanupIds[1758], $cleanupIds[1759], $cleanupIds[1760], $cleanupIds[1761], $cleanupIds[1762], $cleanupIds[1763], $cleanupIds[1764], $cleanupIds[1765], $cleanupIds[1766], $cleanupIds[1767], $cleanupIds[1768], $cleanupIds[1769], $cleanupIds[1770], $cleanupIds[1771], $cleanupIds[1772], $cleanupIds[1773], $cleanupIds[1774], $cleanupIds[1775], $cleanupIds[1776], $cleanupIds[1777], $cleanupIds[1778], $cleanupIds[1779], $cleanupIds[1780], $cleanupIds[1781], $cleanupIds[1782], $cleanupIds[1783], $cleanupIds[1784], $cleanupIds[1785], $cleanupIds[1786], $cleanupIds[1787], $cleanupIds[1788], $cleanupIds[1789], $cleanupIds[1790], $cleanupIds[1791], $cleanupIds[1792], $cleanupIds[1793], $cleanupIds[1794], $cleanupIds[1795], $cleanupIds[1796], $cleanupIds[1797], $cleanupIds[1798], $cleanupIds[1799], $cleanupIds[1800], $cleanupIds[1801], $cleanupIds[1802], $cleanupIds[1803], $cleanupIds[1804], $cleanupIds[1805], $cleanupIds[1806], $cleanupIds[1807], $cleanupIds[1808], $cleanupIds[1809], $cleanupIds[1810], $cleanupIds[1811], $cleanupIds[1812], $cleanupIds[1813], $cleanupIds[1814], $cleanupIds[1815], $cleanupIds[1816], $cleanupIds[1817], $cleanupIds[1818], $cleanupIds[1819], $cleanupIds[1820], $cleanupIds[1821], $cleanupIds[1822], $cleanupIds[1823], $cleanupIds[1824], $cleanupIds[1825], $cleanupIds[1826], $cleanupIds[1827], $cleanupIds[1828], $cleanupIds[1829], $cleanupIds[1830], $cleanupIds[1831], $cleanupIds[1832], $cleanupIds[1833], $cleanupIds[1834], $cleanupIds[1835], $cleanupIds[1836], $cleanupIds[1837], $cleanupIds[1838], $cleanupIds[1839], $cleanupIds[1840], $cleanupIds[1841], $cleanupIds[1842], $cleanupIds[1843], $cleanupIds[1844], $cleanupIds[1845], $cleanupIds[1846], $cleanupIds[1847], $cleanupIds[1848], $cleanupIds[1849], $cleanupIds[1850], $cleanupIds[1851], $cleanupIds[1852], $cleanupIds[1853], $cleanupIds[1854], $cleanupIds[1855], $cleanupIds[1856], $cleanupIds[1857], $cleanupIds[1858], $cleanupIds[1859], $cleanupIds[1860], $cleanupIds[1861], $cleanupIds[1862], $cleanupIds[1863], $cleanupIds[1864], $cleanupIds[1865], $cleanupIds[1866], $cleanupIds[1867], $cleanupIds[1868], $cleanupIds[1869], $cleanupIds[1870], $cleanupIds[1871], $cleanupIds[1872], $cleanupIds[1873], $cleanupIds[1874], $cleanupIds[1875], $cleanupIds[1876], $cleanupIds[1877], $cleanupIds[1878], $cleanupIds[1879], $cleanupIds[1880], $cleanupIds[1881], $cleanupIds[1882], $cleanupIds[1883], $cleanupIds[1884], $cleanupIds[1885], $cleanupIds[1886], $cleanupIds[1887], $cleanupIds[1888], $cleanupIds[1889], $cleanupIds[1890], $cleanupIds[1891], $cleanupIds[1892], $cleanupIds[1893], $cleanupIds[1894], $cleanupIds[1895], $cleanupIds[1896], $cleanupIds[1897], $cleanupIds[1898], $cleanupIds[1899], $cleanupIds[1900], $cleanupIds[1901], $cleanupIds[1902], $cleanupIds[1903], $cleanupIds[1904], $cleanupIds[1905], $cleanupIds[1906], $cleanupIds[1907], $cleanupIds[1908], $cleanupIds[1909], $cleanupIds[1910], $cleanupIds[1911], $cleanupIds[1912], $cleanupIds[1913], $cleanupIds[1914], $cleanupIds[1915], $cleanupIds[1916], $cleanupIds[1917], $cleanupIds[1918], $cleanupIds[1919], $cleanupIds[1920], $cleanupIds[1921], $cleanupIds[1922], $cleanupIds[1923], $cleanupIds[1924], $cleanupIds[1925], $cleanupIds[1926], $cleanupIds[1927], $cleanupIds[1928], $cleanupIds[1929], $cleanupIds[1930], $cleanupIds[1931], $cleanupIds[1932], $cleanupIds[1933], $cleanupIds[1934], $cleanupIds[1935], $cleanupIds[1936], $cleanupIds[1937], $cleanupIds[1938], $cleanupIds[1939], $cleanupIds[1940], $cleanupIds[1941], $cleanupIds[1942], $cleanupIds[1943], $cleanupIds[1944], $cleanupIds[1945], $cleanupIds[1946], $cleanupIds[1947], $cleanupIds[1948], $cleanupIds[1949], $cleanupIds[1950], $cleanupIds[1951], $cleanupIds[1952], $cleanupIds[1953], $cleanupIds[1954], $cleanupIds[1955], $cleanupIds[1956], $cleanupIds[1957], $cleanupIds[1958], $cleanupIds[1959], $cleanupIds[1960], $cleanupIds[1961], $cleanupIds[1962], $cleanupIds[1963], $cleanupIds[1964], $cleanupIds[1965], $cleanupIds[1966], $cleanupIds[1967], $cleanupIds[1968], $cleanupIds[1969], $cleanupIds[1970], $cleanupIds[1971], $cleanupIds[1972], $cleanupIds[1973], $cleanupIds[1974], $cleanupIds[1975], $cleanupIds[1976], $cleanupIds[1977], $cleanupIds[1978], $cleanupIds[1979], $cleanupIds[1980], $cleanupIds[1981], $cleanupIds[1982], $cleanupIds[1983], $cleanupIds[1984], $cleanupIds[1985], $cleanupIds[1986], $cleanupIds[1987], $cleanupIds[1988], $cleanupIds[1989], $cleanupIds[1990], $cleanupIds[1991], $cleanupIds[1992], $cleanupIds[1993], $cleanupIds[1994], $cleanupIds[1995], $cleanupIds[1996], $cleanupIds[1997], $cleanupIds[1998], $cleanupIds[1999], $cleanupIds[2000], $cleanupIds[2001], $cleanupIds[2002], $cleanupIds[2003], $cleanupIds[2004], $cleanupIds[2005], $cleanupIds[2006]);
- /* execute query */
- $stmt->execute();
+ /* execute query */
+ $stmt->execute();
- /* close statement */
- $stmt->close();
- }
+ /* close statement */
+ $stmt->close();
+ }
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_bind_limits.phpt b/ext/mysqli/tests/mysqli_stmt_bind_limits.phpt
index 0b1d41a176..44ab45c257 100644
--- a/ext/mysqli/tests/mysqli_stmt_bind_limits.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_bind_limits.phpt
@@ -8,108 +8,108 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
-
- function bind_many($offset, $link, $num_params, $rows, $eval = true) {
-
- $drop = "DROP TABLE IF EXISTS test";
- $create = "CREATE TABLE test(id INT AUTO_INCREMENT PRIMARY KEY, ";
- $insert = "INSERT INTO test";
- $columns = "";
- $values = "";
- $stmt_params = "";
- $params = array();
- for ($i = 0; $i < $num_params; $i++) {
- $create .= "col" . $i . " INT, ";
- $columns .= "col" . $i . ", ";
- $values .= "?, ";
- $stmt_params .= '$params[' . $i . '], ';
- for ($j = 0; $j < $rows; $j++)
- $params[($j * $rows) + $i] = $i;
- }
- $create = substr($create, 0, -2) . ")";
-
- $stmt_types = str_repeat("i", $num_params * $rows);
- $stmt_params = substr(str_repeat($stmt_params, $rows), 0, -2);
- $values = substr($values, 0, -2);
- $insert .= "(" . substr($columns, 0, -2) . ") VALUES ";
- $insert .= substr(str_repeat("(" . $values . "), ", $rows), 0, -2);
-
- $stmt_bind_param = 'return mysqli_stmt_bind_param($stmt, "' . $stmt_types . '", ' . $stmt_params . ');';
-
- printf("Testing %d columns with %d rows...\n", $num_params, $rows);
-
- if (!$link->query($drop) || !$link->query($create)) {
- printf("[%03d + 01] [%d] %s\n", $offset, $link->errno, $link->error);
- return false;
- }
- printf("... table created\n");
-
- if (!$stmt = $link->prepare($insert)) {
- printf("[%03d + 02] [%d] %s\n", $offset, $link->errno, $link->error);
- return false;
- }
- if ($stmt->param_count != $num_params * $rows) {
- printf("[%03d + 03] Parameter count should be %d but got %d\n", $offset, $num_params * $rows, $stmt->param_count);
- return false;
- }
- printf("... statement with %d parameters prepared\n", $stmt->param_count);
-
- if ($eval) {
- if (!eval($stmt_bind_param)) {
- printf("[%03d + 03] [%d] %s\n", $offset, $stmt->errno, $stmt->error);
- return false;
- }
- } else {
- $param_ref = array($stmt_types);
- for ($i = 0; $i < $rows; $i++)
- for ($j = 0; $j < $num_params; $j++)
- $param_ref[] = &$params[($i * $rows) + $j];
-
- if (!call_user_func_array(array($stmt, 'bind_param'), $param_ref)) {
- printf("[%03d + 03] [%d] %s\n", $offset, $stmt->errno, $stmt->error);
- return false;
- }
- }
- if ($stmt->param_count != $num_params * $rows) {
- printf("[%03d + 03] Parameter count should be %d but got %d\n", $offset, $num_params * $rows, $stmt->param_count);
- return false;
- }
-
- if (!$stmt->execute()) {
- printf("[%03d + 04] [%d] %s\n", $offset, $stmt->errno, $stmt->error);
- return false;
- }
- printf("Statement done\n");
-
- $stmt->close();
-
- if (!($res = $link->query("SELECT * FROM test"))) {
- printf("[%03d + 05] [%d] %s\n", $offset, $link->errno, $link->error);
- return false;
- }
-
- $row = $res->fetch_row();
- $res->close();
-
- for ($i = 0; $i < $num_params; $i++) {
- if ($row[$i + 1] != $i) {
- printf("[%03d + 06] [%d] %s\n", $offset, $link->errno, $link->error);
- }
- }
-
- return true;
- }
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
-
- var_dump(bind_many(10, $link, 273, 240, true));
- var_dump(bind_many(20, $link, 273, 240, false));
- mysqli_close($link);
- print "done!";
+ require_once("connect.inc");
+
+ function bind_many($offset, $link, $num_params, $rows, $eval = true) {
+
+ $drop = "DROP TABLE IF EXISTS test";
+ $create = "CREATE TABLE test(id INT AUTO_INCREMENT PRIMARY KEY, ";
+ $insert = "INSERT INTO test";
+ $columns = "";
+ $values = "";
+ $stmt_params = "";
+ $params = array();
+ for ($i = 0; $i < $num_params; $i++) {
+ $create .= "col" . $i . " INT, ";
+ $columns .= "col" . $i . ", ";
+ $values .= "?, ";
+ $stmt_params .= '$params[' . $i . '], ';
+ for ($j = 0; $j < $rows; $j++)
+ $params[($j * $rows) + $i] = $i;
+ }
+ $create = substr($create, 0, -2) . ")";
+
+ $stmt_types = str_repeat("i", $num_params * $rows);
+ $stmt_params = substr(str_repeat($stmt_params, $rows), 0, -2);
+ $values = substr($values, 0, -2);
+ $insert .= "(" . substr($columns, 0, -2) . ") VALUES ";
+ $insert .= substr(str_repeat("(" . $values . "), ", $rows), 0, -2);
+
+ $stmt_bind_param = 'return mysqli_stmt_bind_param($stmt, "' . $stmt_types . '", ' . $stmt_params . ');';
+
+ printf("Testing %d columns with %d rows...\n", $num_params, $rows);
+
+ if (!$link->query($drop) || !$link->query($create)) {
+ printf("[%03d + 01] [%d] %s\n", $offset, $link->errno, $link->error);
+ return false;
+ }
+ printf("... table created\n");
+
+ if (!$stmt = $link->prepare($insert)) {
+ printf("[%03d + 02] [%d] %s\n", $offset, $link->errno, $link->error);
+ return false;
+ }
+ if ($stmt->param_count != $num_params * $rows) {
+ printf("[%03d + 03] Parameter count should be %d but got %d\n", $offset, $num_params * $rows, $stmt->param_count);
+ return false;
+ }
+ printf("... statement with %d parameters prepared\n", $stmt->param_count);
+
+ if ($eval) {
+ if (!eval($stmt_bind_param)) {
+ printf("[%03d + 03] [%d] %s\n", $offset, $stmt->errno, $stmt->error);
+ return false;
+ }
+ } else {
+ $param_ref = array($stmt_types);
+ for ($i = 0; $i < $rows; $i++)
+ for ($j = 0; $j < $num_params; $j++)
+ $param_ref[] = &$params[($i * $rows) + $j];
+
+ if (!call_user_func_array(array($stmt, 'bind_param'), $param_ref)) {
+ printf("[%03d + 03] [%d] %s\n", $offset, $stmt->errno, $stmt->error);
+ return false;
+ }
+ }
+ if ($stmt->param_count != $num_params * $rows) {
+ printf("[%03d + 03] Parameter count should be %d but got %d\n", $offset, $num_params * $rows, $stmt->param_count);
+ return false;
+ }
+
+ if (!$stmt->execute()) {
+ printf("[%03d + 04] [%d] %s\n", $offset, $stmt->errno, $stmt->error);
+ return false;
+ }
+ printf("Statement done\n");
+
+ $stmt->close();
+
+ if (!($res = $link->query("SELECT * FROM test"))) {
+ printf("[%03d + 05] [%d] %s\n", $offset, $link->errno, $link->error);
+ return false;
+ }
+
+ $row = $res->fetch_row();
+ $res->close();
+
+ for ($i = 0; $i < $num_params; $i++) {
+ if ($row[$i + 1] != $i) {
+ printf("[%03d + 06] [%d] %s\n", $offset, $link->errno, $link->error);
+ }
+ }
+
+ return true;
+ }
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
+
+ var_dump(bind_many(10, $link, 273, 240, true));
+ var_dump(bind_many(20, $link, 273, 240, false));
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_bind_param.phpt b/ext/mysqli/tests/mysqli_stmt_bind_param.phpt
index d2d825438e..aba40decf4 100644
--- a/ext/mysqli/tests/mysqli_stmt_bind_param.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_bind_param.phpt
@@ -8,382 +8,366 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- /*
- The way we test the INSERT and data types overlaps with
- the mysqli_stmt_bind_result test in large parts. There is only
- one difference. This test uses mysqli_query()/mysqli_fetch_assoc() to
- fetch the inserted values. This way we test
- mysqli_query()/mysqli_fetch_assoc() for all possible data types
- in this file and we test mysqli_stmt_bind_result() in the other
- test -- therefore the "duplicate" makes some sense to me.
- */
- require_once("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_bind_param()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_bind_param($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_bind_param($link, $link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- require('table.inc');
-
- $stmt = mysqli_stmt_init($link);
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
- printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = null;
- $label = null;
-
- /*
- libmysql gives a less descriptive error message but mysqlnd,
- we did not unify the error messages but ignore this slight difference silently
- */
- if (!false === ($tmp = @mysqli_stmt_bind_param($stmt, " ", $tmp)))
- printf("[003d] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!false === ($tmp = @mysqli_stmt_bind_param($stmt, "", $id, $label)))
- printf("[003a] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- /* TODO: somehwhat undocumented syntax! */
- $param = array($id);
- if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "is", $param)))
- printf("[003b] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- $param = array($id, $label, $id);
- if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "is", $param)))
- printf("[003c] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "a", $id)))
- printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "a", $id, $label)))
- printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "aa", $id, $label)))
- printf("[006] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "ia", $id, $label)))
- printf("[007] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!true === ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label)))
- printf("[008] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (function_exists("memory_get_usage")) {
- $mem = memory_get_usage();
- for ($i = 0; $i < 20000; $i++) {
- if (!true === ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label)))
- printf("[008][$i] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- }
- if (($tmp = (memory_get_usage() - $mem)) > 600)
- printf("[009] Function seems to be leaking, because it used %d bytes. During tests it used only 92 bytes.", $tmp);
- }
-
- $id = 100;
- $label = "z";
- if (!mysqli_stmt_execute($stmt))
- printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- mysqli_stmt_close($stmt);
-
- if (!($res = mysqli_query($link, "SELECT id, label FROM test WHERE id = " . $id)))
- printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $row = mysqli_fetch_assoc($res);
- if (($row['id'] != $id) || ($row['label'] != $label))
- printf("[012] Expecting '%s'/%s', got '%s'/%s'!\n", $id, $label, $row['id'], $row['label']);
- mysqli_free_result($res);
-
- function func_mysqli_stmt_bind_datatype($link, $engine, $bind_type, $sql_type, $bind_value, $offset, $alternative = null) {
-
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
- printf("[%03d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if (!mysqli_query($link, sprintf("CREATE TABLE test(id INT NOT NULL, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) {
- // don't bail - it might be that the server does not support the data type
- return false;
- }
-
- if (!$stmt = mysqli_stmt_init($link)) {
- printf("[%03d] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUE (?, ?)")) {
- printf("[%03d] [%d] %s\n", $offset + 2, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
-
- $id = 1;
- if (!mysqli_stmt_bind_param($stmt, "i" . $bind_type, $id, $bind_value)) {
- printf("[%03d] [%d] %s\n", $offset + 3, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
-
- if (!mysqli_stmt_execute($stmt)) {
- printf("[%03d] [%d] %s\n", $offset + 4, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
- mysqli_stmt_close($stmt);
-
- if (!$res = mysqli_query($link, "SELECT id, label FROM test")) {
- printf("[%03d] [%d] %s\n", $offset + 5, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if (!$row = mysqli_fetch_assoc($res)) {
- printf("[%03d] [%d] %s\n", $offset + 5, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if ($alternative) {
- if (($row['id'] != $id) || (($row['label'] != $bind_value) && ($row['label'] != $alternative))) {
- printf("[%03d] Testing '%s', '%s': expecting '%s'/'%s' (%s), got '%s'/'%s'\n",
- $offset + 6, $bind_type, $sql_type,
- $id, $bind_value, gettype($bind_value), $row['id'], $row['label']);
- return false;
- }
- } else {
- if (($row['id'] != $id) || ($row['label'] != $bind_value)) {
- printf("[%03d] Testing '%s', '%s': expecting '%s'/'%s', got '%s'/'%s'\n",
- $offset + 6, $bind_type, $sql_type,
- $id, $bind_value, $row['id'], $row['label']);
- return false;
- }
- }
-
- mysqli_free_result($res);
- return true;
- }
-
- function func_mysqli_stmt_bind_make_string($len) {
-
- $ret = '';
- for ($i = 0; $i < $len; $i++)
- $ret .= chr(mt_rand(65, 90));
-
- return $ret;
- }
-
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "TINYINT", -11, 20);
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "TINYINT", NULL, 30);
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "TINYINT UNSIGNED", 1, 40);
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "TINYINT UNSIGNED", NULL, 50);
-
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "BOOL", 1, 60);
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "BOOL", NULL, 70);
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "BOOLEAN", 0, 80);
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "BOOLEAN", NULL, 90);
-
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "SMALLINT", -32768, 100);
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "SMALLINT", 32767, 110);
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "SMALLINT", NULL, 120);
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "SMALLINT UNSIGNED", 65535, 130);
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "SMALLINT UNSIGNED", NULL, 140);
-
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "MEDIUMINT", -8388608, 150);
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "MEDIUMINT", 8388607, 160);
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "MEDIUMINT", NULL, 170);
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "MEDIUMINT UNSIGNED", 16777215, 180);
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "MEDIUMINT UNSIGNED", NULL, 190);
-
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "INTEGER", -2147483648, 200);
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "INTEGER", 2147483647, 210);
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "INTEGER", NULL, 220);
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "INTEGER UNSIGNED", (defined("PHP_INT_MAX")) ? min(4294967295, PHP_INT_MAX) : 1, 230);
- func_mysqli_stmt_bind_datatype($link, $engine, "d", "INTEGER UNSIGNED", 4294967295, 240);
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "INTEGER UNSIGNED", NULL, 250);
-
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "BIGINT", -1 * PHP_INT_MAX + 1, 260);
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "BIGINT", NULL, 270);
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "BIGINT", PHP_INT_MAX, 280);
- func_mysqli_stmt_bind_datatype($link, $engine, "i", "BIGINT UNSIGNED", NULL, 290);
-
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "BIGINT", "-9223372036854775808", 900);
- // ?? func_mysqli_stmt_bind_datatype($link, $engine, "d", "BIGINT", -9223372036854775808, 910);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "BIGINT UNSIGNED", "18446744073709551615", 920);
+ /*
+ The way we test the INSERT and data types overlaps with
+ the mysqli_stmt_bind_result test in large parts. There is only
+ one difference. This test uses mysqli_query()/mysqli_fetch_assoc() to
+ fetch the inserted values. This way we test
+ mysqli_query()/mysqli_fetch_assoc() for all possible data types
+ in this file and we test mysqli_stmt_bind_result() in the other
+ test -- therefore the "duplicate" makes some sense to me.
+ */
+ require_once("connect.inc");
+
+ require('table.inc');
+
+ $stmt = mysqli_stmt_init($link);
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
+ printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = null;
+ $label = null;
+
+ /*
+ libmysql gives a less descriptive error message but mysqlnd,
+ we did not unify the error messages but ignore this slight difference silently
+ */
+ if (!false === ($tmp = @mysqli_stmt_bind_param($stmt, " ", $tmp)))
+ printf("[003d] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!false === ($tmp = @mysqli_stmt_bind_param($stmt, "", $id, $label)))
+ printf("[003a] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ /* TODO: somehwhat undocumented syntax! */
+ $param = array($id);
+ if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "is", $param)))
+ printf("[003b] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ $param = array($id, $label, $id);
+ if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "is", $param)))
+ printf("[003c] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "a", $id)))
+ printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "a", $id, $label)))
+ printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "aa", $id, $label)))
+ printf("[006] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "ia", $id, $label)))
+ printf("[007] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!true === ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label)))
+ printf("[008] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (function_exists("memory_get_usage")) {
+ $mem = memory_get_usage();
+ for ($i = 0; $i < 20000; $i++) {
+ if (!true === ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label)))
+ printf("[008][$i] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ }
+ if (($tmp = (memory_get_usage() - $mem)) > 600)
+ printf("[009] Function seems to be leaking, because it used %d bytes. During tests it used only 92 bytes.", $tmp);
+ }
+
+ $id = 100;
+ $label = "z";
+ if (!mysqli_stmt_execute($stmt))
+ printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ mysqli_stmt_close($stmt);
+
+ if (!($res = mysqli_query($link, "SELECT id, label FROM test WHERE id = " . $id)))
+ printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $row = mysqli_fetch_assoc($res);
+ if (($row['id'] != $id) || ($row['label'] != $label))
+ printf("[012] Expecting '%s'/%s', got '%s'/%s'!\n", $id, $label, $row['id'], $row['label']);
+ mysqli_free_result($res);
+
+ function func_mysqli_stmt_bind_datatype($link, $engine, $bind_type, $sql_type, $bind_value, $offset, $alternative = null) {
+
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
+ printf("[%03d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if (!mysqli_query($link, sprintf("CREATE TABLE test(id INT NOT NULL, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) {
+ // don't bail - it might be that the server does not support the data type
+ return false;
+ }
+
+ if (!$stmt = mysqli_stmt_init($link)) {
+ printf("[%03d] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUE (?, ?)")) {
+ printf("[%03d] [%d] %s\n", $offset + 2, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+
+ $id = 1;
+ if (!mysqli_stmt_bind_param($stmt, "i" . $bind_type, $id, $bind_value)) {
+ printf("[%03d] [%d] %s\n", $offset + 3, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+
+ if (!mysqli_stmt_execute($stmt)) {
+ printf("[%03d] [%d] %s\n", $offset + 4, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+ mysqli_stmt_close($stmt);
+
+ if (!$res = mysqli_query($link, "SELECT id, label FROM test")) {
+ printf("[%03d] [%d] %s\n", $offset + 5, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if (!$row = mysqli_fetch_assoc($res)) {
+ printf("[%03d] [%d] %s\n", $offset + 5, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if ($alternative) {
+ if (($row['id'] != $id) || (($row['label'] != $bind_value) && ($row['label'] != $alternative))) {
+ printf("[%03d] Testing '%s', '%s': expecting '%s'/'%s' (%s), got '%s'/'%s'\n",
+ $offset + 6, $bind_type, $sql_type,
+ $id, $bind_value, gettype($bind_value), $row['id'], $row['label']);
+ return false;
+ }
+ } else {
+ if (($row['id'] != $id) || ($row['label'] != $bind_value)) {
+ printf("[%03d] Testing '%s', '%s': expecting '%s'/'%s', got '%s'/'%s'\n",
+ $offset + 6, $bind_type, $sql_type,
+ $id, $bind_value, $row['id'], $row['label']);
+ return false;
+ }
+ }
+
+ mysqli_free_result($res);
+ return true;
+ }
+
+ function func_mysqli_stmt_bind_make_string($len) {
+
+ $ret = '';
+ for ($i = 0; $i < $len; $i++)
+ $ret .= chr(mt_rand(65, 90));
+
+ return $ret;
+ }
+
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "TINYINT", -11, 20);
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "TINYINT", NULL, 30);
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "TINYINT UNSIGNED", 1, 40);
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "TINYINT UNSIGNED", NULL, 50);
+
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "BOOL", 1, 60);
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "BOOL", NULL, 70);
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "BOOLEAN", 0, 80);
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "BOOLEAN", NULL, 90);
+
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "SMALLINT", -32768, 100);
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "SMALLINT", 32767, 110);
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "SMALLINT", NULL, 120);
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "SMALLINT UNSIGNED", 65535, 130);
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "SMALLINT UNSIGNED", NULL, 140);
+
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "MEDIUMINT", -8388608, 150);
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "MEDIUMINT", 8388607, 160);
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "MEDIUMINT", NULL, 170);
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "MEDIUMINT UNSIGNED", 16777215, 180);
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "MEDIUMINT UNSIGNED", NULL, 190);
+
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "INTEGER", -2147483648, 200);
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "INTEGER", 2147483647, 210);
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "INTEGER", NULL, 220);
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "INTEGER UNSIGNED", (defined("PHP_INT_MAX")) ? min(4294967295, PHP_INT_MAX) : 1, 230);
+ func_mysqli_stmt_bind_datatype($link, $engine, "d", "INTEGER UNSIGNED", 4294967295, 240);
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "INTEGER UNSIGNED", NULL, 250);
+
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "BIGINT", -1 * PHP_INT_MAX + 1, 260);
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "BIGINT", NULL, 270);
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "BIGINT", PHP_INT_MAX, 280);
+ func_mysqli_stmt_bind_datatype($link, $engine, "i", "BIGINT UNSIGNED", NULL, 290);
+
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "BIGINT", "-9223372036854775808", 900);
+ // ?? func_mysqli_stmt_bind_datatype($link, $engine, "d", "BIGINT", -9223372036854775808, 910);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "BIGINT UNSIGNED", "18446744073709551615", 920);
/*
- ??
- func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT", -9223372036854775808 - 1.1, 300);
- func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT UNSIGNED", 18446744073709551615 + 1.1, 320);
- */
- func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT", NULL, 310);
- func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT UNSIGNED ", NULL, 330);
- if (2147483647 == PHP_INT_MAX) {
- func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT UNSIGNED", PHP_INT_MAX, 930, '2.14748e+09');
- func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT", -1 * PHP_INT_MAX + 1, 940, '-2.14748e+09');
- }
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "FLOAT", "-9223372036854775808", 300, '-9.22337e+18');
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "FLOAT UNSIGNED", "18446744073709551615", 320, '1.84467e+19');
- func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT", -10.01, 950);
- func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT UNSIGNED", 10.01, 960);
-
- func_mysqli_stmt_bind_datatype($link, $engine, "d", "DOUBLE(10,2)", NULL, 350);
- func_mysqli_stmt_bind_datatype($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", NULL, 370);
- func_mysqli_stmt_bind_datatype($link, $engine, "d", "DOUBLE(10,2)", -99999999.99, 340);
- func_mysqli_stmt_bind_datatype($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", 99999999.99, 360);
-
- /*
- func_mysqli_stmt_bind_datatype($link, $engine, "d", "DOUBLE(10,2)", -99999999.99, 340);
- func_mysqli_stmt_bind_datatype($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", 99999999.99, 360);
- */
- func_mysqli_stmt_bind_datatype($link, $engine, "d", "DECIMAL(10,2)", -99999999.99, 380);
- func_mysqli_stmt_bind_datatype($link, $engine, "d", "DECIMAL(10,2)", NULL, 390);
- func_mysqli_stmt_bind_datatype($link, $engine, "d", "DECIMAL(10,2)", 99999999.99, 400);
- func_mysqli_stmt_bind_datatype($link, $engine, "d", "DECIMAL(10,2)", NULL, 410);
-
- // don't care about date() strict TZ warnings...
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "DATE", @date('Y-m-d'), 420);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "DATE NOT NULL", @date('Y-m-d'), 430);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "DATE", NULL, 440);
-
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "DATETIME", @date('Y-m-d H:i:s'), 450);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "DATETIME NOT NULL", @date('Y-m-d H:i:s'), 460);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "DATETIME", NULL, 470);
-
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "TIMESTAMP", @date('Y-m-d H:i:s'), 480);
-
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "TIME", @date('H:i:s'), 490);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "TIME NOT NULL", @date('H:i:s'), 500);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "TIME", NULL, 510);
-
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "YEAR", @date('Y'), 520);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "YEAR NOT NULL", @date('Y'), 530);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "YEAR", NULL, 540);
-
- $string255 = func_mysqli_stmt_bind_make_string(255);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "CHAR(1)", "a", 550);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "CHAR(255)", $string255, 560);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "CHAR(1) NOT NULL", "a", 570);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "CHAR(1)", NULL, 580);
-
- $string65k = func_mysqli_stmt_bind_make_string(65535);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARCHAR(1)", "a", 590);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARCHAR(255)", $string255, 600);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARCHAR(65635)", $string65k, 610);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARCHAR(1) NOT NULL", "a", 620);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARCHAR(1)", NULL, 630);
-
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "BINARY(1)", "a", 640);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "BINARY(1)", chr(0), 650);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "BINARY(1) NOT NULL", "b", 660);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "BINARY(1)", NULL, 670);
-
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARBINARY(1)", "a", 680);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARBINARY(1)", chr(0), 690);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARBINARY(1) NOT NULL", "b", 700);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARBINARY(1)", NULL, 710);
-
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYBLOB", "a", 720);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYBLOB", chr(0), 730);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYBLOB NOT NULL", "b", 740);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYBLOB", NULL, 750);
-
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYTEXT", "a", 760);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYTEXT NOT NULL", "a", 770);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYTEXT", NULL, 780);
-
- // Note: you cannot insert any blob values this way. But you can check the API at least partly this way
- // Extra BLOB tests are in mysqli_stmt_send_long()
- func_mysqli_stmt_bind_datatype($link, $engine, "b", "BLOB", "", 790);
- func_mysqli_stmt_bind_datatype($link, $engine, "b", "TEXT", "", 800);
- func_mysqli_stmt_bind_datatype($link, $engine, "b", "MEDIUMBLOB", "", 810);
- func_mysqli_stmt_bind_datatype($link, $engine, "b", "MEDIUMTEXT", "", 820);
- func_mysqli_stmt_bind_datatype($link, $engine, "b", "LONGBLOB", "", 830);
- func_mysqli_stmt_bind_datatype($link, $engine, "b", "LONGTEXT", "", 840);
-
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "ENUM('a', 'b')", "a", 850);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "ENUM('a', 'b')", NULL, 860);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "SET('a', 'b')", "a", 870);
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "SET('a', 'b')", NULL, 880);
-
- if (mysqli_get_server_version($link) >= 50600)
- func_mysqli_stmt_bind_datatype($link, $engine, "s", "TIME", "13:27:34.123456", 890, "13:27:34");
-
- $stmt = mysqli_stmt_init($link);
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
- printf("[2000] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = null;
- $label = null;
- if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label)))
- printf("[2001] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- mysqli_stmt_execute($stmt);
-
- if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label)))
- printf("[2002] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- mysqli_stmt_close($stmt);
- include("table.inc");
-
- if (!$stmt = mysqli_stmt_init($link))
- printf("[2003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
- printf("[2004] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = $label = null;
- if (true !== ($tmp = $stmt->bind_param('is', $id, $label)))
- printf("[2005] Expecting boolean/true got %s/%s, [%d] %s\n",
- gettype($tmp), $tmp,
- $stmt->errno, $stmt->error);
-
- $id = 100; $label = 'z';
- if (!$stmt->execute())
- printf("[2006] [%d] %s\n", $stmt->errno, $stmt->error);
-
- if (!$res = mysqli_query($link, "SELECT id, label FROM test WHERE id = 100"))
- printf("[2007] Expecting record 100/z, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!$row = mysqli_fetch_assoc($res))
- printf("[2008] Expecting row, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if ($row['id'] != 100 || $row['label'] != 'z') {
- printf("[2009] Row seems wrong, dumping record\n");
- var_dump($row);
- }
- mysqli_free_result($res);
-
- $value_list = array(array('id' => 101, 'label' => 'a'), array('id' => 102, 'label' => 'b'));
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
- printf("[2010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ ??
+ func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT", -9223372036854775808 - 1.1, 300);
+ func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT UNSIGNED", 18446744073709551615 + 1.1, 320);
+ */
+ func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT", NULL, 310);
+ func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT UNSIGNED ", NULL, 330);
+ if (2147483647 == PHP_INT_MAX) {
+ func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT UNSIGNED", PHP_INT_MAX, 930, '2.14748e+09');
+ func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT", -1 * PHP_INT_MAX + 1, 940, '-2.14748e+09');
+ }
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "FLOAT", "-9223372036854775808", 300, '-9.22337e+18');
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "FLOAT UNSIGNED", "18446744073709551615", 320, '1.84467e+19');
+ func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT", -10.01, 950);
+ func_mysqli_stmt_bind_datatype($link, $engine, "d", "FLOAT UNSIGNED", 10.01, 960);
+
+ func_mysqli_stmt_bind_datatype($link, $engine, "d", "DOUBLE(10,2)", NULL, 350);
+ func_mysqli_stmt_bind_datatype($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", NULL, 370);
+ func_mysqli_stmt_bind_datatype($link, $engine, "d", "DOUBLE(10,2)", -99999999.99, 340);
+ func_mysqli_stmt_bind_datatype($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", 99999999.99, 360);
+
+ /*
+ func_mysqli_stmt_bind_datatype($link, $engine, "d", "DOUBLE(10,2)", -99999999.99, 340);
+ func_mysqli_stmt_bind_datatype($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", 99999999.99, 360);
+ */
+ func_mysqli_stmt_bind_datatype($link, $engine, "d", "DECIMAL(10,2)", -99999999.99, 380);
+ func_mysqli_stmt_bind_datatype($link, $engine, "d", "DECIMAL(10,2)", NULL, 390);
+ func_mysqli_stmt_bind_datatype($link, $engine, "d", "DECIMAL(10,2)", 99999999.99, 400);
+ func_mysqli_stmt_bind_datatype($link, $engine, "d", "DECIMAL(10,2)", NULL, 410);
+
+ // don't care about date() strict TZ warnings...
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "DATE", @date('Y-m-d'), 420);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "DATE NOT NULL", @date('Y-m-d'), 430);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "DATE", NULL, 440);
+
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "DATETIME", @date('Y-m-d H:i:s'), 450);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "DATETIME NOT NULL", @date('Y-m-d H:i:s'), 460);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "DATETIME", NULL, 470);
+
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "TIMESTAMP", @date('Y-m-d H:i:s'), 480);
+
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "TIME", @date('H:i:s'), 490);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "TIME NOT NULL", @date('H:i:s'), 500);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "TIME", NULL, 510);
+
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "YEAR", @date('Y'), 520);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "YEAR NOT NULL", @date('Y'), 530);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "YEAR", NULL, 540);
+
+ $string255 = func_mysqli_stmt_bind_make_string(255);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "CHAR(1)", "a", 550);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "CHAR(255)", $string255, 560);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "CHAR(1) NOT NULL", "a", 570);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "CHAR(1)", NULL, 580);
+
+ $string65k = func_mysqli_stmt_bind_make_string(65535);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARCHAR(1)", "a", 590);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARCHAR(255)", $string255, 600);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARCHAR(65635)", $string65k, 610);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARCHAR(1) NOT NULL", "a", 620);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARCHAR(1)", NULL, 630);
+
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "BINARY(1)", "a", 640);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "BINARY(1)", chr(0), 650);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "BINARY(1) NOT NULL", "b", 660);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "BINARY(1)", NULL, 670);
+
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARBINARY(1)", "a", 680);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARBINARY(1)", chr(0), 690);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARBINARY(1) NOT NULL", "b", 700);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "VARBINARY(1)", NULL, 710);
+
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYBLOB", "a", 720);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYBLOB", chr(0), 730);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYBLOB NOT NULL", "b", 740);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYBLOB", NULL, 750);
+
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYTEXT", "a", 760);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYTEXT NOT NULL", "a", 770);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "TINYTEXT", NULL, 780);
+
+ // Note: you cannot insert any blob values this way. But you can check the API at least partly this way
+ // Extra BLOB tests are in mysqli_stmt_send_long()
+ func_mysqli_stmt_bind_datatype($link, $engine, "b", "BLOB", "", 790);
+ func_mysqli_stmt_bind_datatype($link, $engine, "b", "TEXT", "", 800);
+ func_mysqli_stmt_bind_datatype($link, $engine, "b", "MEDIUMBLOB", "", 810);
+ func_mysqli_stmt_bind_datatype($link, $engine, "b", "MEDIUMTEXT", "", 820);
+ func_mysqli_stmt_bind_datatype($link, $engine, "b", "LONGBLOB", "", 830);
+ func_mysqli_stmt_bind_datatype($link, $engine, "b", "LONGTEXT", "", 840);
+
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "ENUM('a', 'b')", "a", 850);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "ENUM('a', 'b')", NULL, 860);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "SET('a', 'b')", "a", 870);
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "SET('a', 'b')", NULL, 880);
+
+ if (mysqli_get_server_version($link) >= 50600)
+ func_mysqli_stmt_bind_datatype($link, $engine, "s", "TIME", "13:27:34.123456", 890, "13:27:34");
+
+ $stmt = mysqli_stmt_init($link);
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
+ printf("[2000] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = null;
+ $label = null;
+ if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label)))
+ printf("[2001] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ mysqli_stmt_execute($stmt);
+
+ if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label)))
+ printf("[2002] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ mysqli_stmt_close($stmt);
+ include("table.inc");
+
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[2003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
+ printf("[2004] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = $label = null;
+ if (true !== ($tmp = $stmt->bind_param('is', $id, $label)))
+ printf("[2005] Expecting boolean/true got %s/%s, [%d] %s\n",
+ gettype($tmp), $tmp,
+ $stmt->errno, $stmt->error);
+
+ $id = 100; $label = 'z';
+ if (!$stmt->execute())
+ printf("[2006] [%d] %s\n", $stmt->errno, $stmt->error);
+
+ if (!$res = mysqli_query($link, "SELECT id, label FROM test WHERE id = 100"))
+ printf("[2007] Expecting record 100/z, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[2008] Expecting row, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if ($row['id'] != 100 || $row['label'] != 'z') {
+ printf("[2009] Row seems wrong, dumping record\n");
+ var_dump($row);
+ }
+ mysqli_free_result($res);
+
+ $value_list = array(array('id' => 101, 'label' => 'a'), array('id' => 102, 'label' => 'b'));
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
+ printf("[2010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
foreach ($value_list as $k => $values) {
- if (!mysqli_stmt_bind_param($stmt, 'is', $values['id'], $values['label'])) {
- printf("[2011] bind_param() failed for id = %d, [%d] %s\n",
- $values['id'], mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- continue;
- }
- if (!$stmt->execute())
- printf("[2012] [%d] execute() failed for id = %d, [%d] %s\n",
- $values['id'], mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!$res = mysqli_query($link, sprintf("SELECT label FROM test WHERE id = %d", $values['id'])))
- printf("[2013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$row = mysqli_fetch_assoc($res))
- printf("[2014] Cannot find row id = %d\n", $values['id']);
- else if (isset($row['label']) && ($values['label'] != $row['label']))
- printf("[2015] Expecting label = %s, got label = %s\n", $values['label'], $row['label']);
-
- mysqli_free_result($res);
- }
-
- mysqli_stmt_close($stmt);
- mysqli_close($link);
-
- /* Check that the function alias exists. It's a deprecated function,
- but we have not announce the removal so far, therefore we need to check for it */
- if (!is_null($tmp = @mysqli_stmt_bind_param()))
- printf("[021] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- print "done!";
+ if (!mysqli_stmt_bind_param($stmt, 'is', $values['id'], $values['label'])) {
+ printf("[2011] bind_param() failed for id = %d, [%d] %s\n",
+ $values['id'], mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ continue;
+ }
+ if (!$stmt->execute())
+ printf("[2012] [%d] execute() failed for id = %d, [%d] %s\n",
+ $values['id'], mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!$res = mysqli_query($link, sprintf("SELECT label FROM test WHERE id = %d", $values['id'])))
+ printf("[2013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[2014] Cannot find row id = %d\n", $values['id']);
+ else if (isset($row['label']) && ($values['label'] != $row['label']))
+ printf("[2015] Expecting label = %s, got label = %s\n", $values['label'], $row['label']);
+
+ mysqli_free_result($res);
+ }
+
+ mysqli_stmt_close($stmt);
+ mysqli_close($link);
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_bind_param_call_user_func.phpt b/ext/mysqli/tests/mysqli_stmt_bind_param_call_user_func.phpt
index a8a18ace85..3de2910fd4 100644
--- a/ext/mysqli/tests/mysqli_stmt_bind_param_call_user_func.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_bind_param_call_user_func.phpt
@@ -8,321 +8,321 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require('connect.inc');
- require('table.inc');
-
- if (!$stmt = mysqli_stmt_init($link))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
- printf("[002] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = 1;
- if (!mysqli_stmt_bind_param($stmt, 'i', $id) ||
- !mysqli_stmt_execute($stmt))
- printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = $label = null;
- if (!mysqli_stmt_bind_result($stmt, $id, $label) ||
- (true !== mysqli_stmt_fetch($stmt)))
- printf("[004] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- print "Regular, procedural, using variables\n";
- var_dump($id);
- var_dump($label);
-
- mysqli_stmt_close($stmt);
- if (!$stmt = mysqli_stmt_init($link))
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
- printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $types = 'i';
- $id = 1;
- $params = array(
- 0 => &$stmt,
- 1 => &$types,
- 2 => &$id
- );
- if (!call_user_func_array('mysqli_stmt_bind_param', $params))
- printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!mysqli_stmt_execute($stmt))
- printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = $label = null;
- if (!mysqli_stmt_bind_result($stmt, $id, $label) ||
- (true !== mysqli_stmt_fetch($stmt)))
- printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- print "Call user func, procedural, using references for everything\n";
- var_dump($id);
- var_dump($label);
-
- mysqli_stmt_close($stmt);
- if (!$stmt = mysqli_stmt_init($link))
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
- printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $types = 'i';
- $id = 1;
- $params = array(
- 0 => &$types,
- 1 => &$id
- );
- if (!call_user_func_array(array($stmt, 'bind_param'), $params))
- printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!mysqli_stmt_execute($stmt))
- printf("[013] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = $label = null;
- if (!mysqli_stmt_bind_result($stmt, $id, $label) ||
- (true !== mysqli_stmt_fetch($stmt)))
- printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- print "Call user func, object oriented, using references for everything\n";
- var_dump($id);
- var_dump($label);
-
- mysqli_stmt_close($stmt);
- if (!$stmt = mysqli_stmt_init($link))
- printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
- printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $types = 'i';
- $id = 1;
- $params = array(
- 0 => $types,
- 1 => &$id
- );
- if (!call_user_func_array(array($stmt, 'bind_param'), $params))
- printf("[017] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!mysqli_stmt_execute($stmt))
- printf("[018] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = $label = null;
- if (!mysqli_stmt_bind_result($stmt, $id, $label) ||
- (true !== mysqli_stmt_fetch($stmt)))
- printf("[019] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- print "Call user func, object oriented, using variable for types. using references for bound parameter\n";
- var_dump($id);
- var_dump($label);
-
- mysqli_stmt_close($stmt);
- if (!$stmt = mysqli_stmt_init($link))
- printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
- printf("[021] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = 1;
- $params = array(
- 0 => 'i',
- 1 => &$id
- );
- if (!call_user_func_array(array($stmt, 'bind_param'), $params))
- printf("[022] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!mysqli_stmt_execute($stmt))
- printf("[023] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = $label = null;
- if (!mysqli_stmt_bind_result($stmt, $id, $label) ||
- (true !== mysqli_stmt_fetch($stmt)))
- printf("[024] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- print "Call user func, object oriented, using constant for types. using references for bound parameter\n";
- var_dump($id);
- var_dump($label);
-
- mysqli_stmt_close($stmt);
- if (!$stmt = mysqli_stmt_init($link))
- printf("[025] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
- printf("[026] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $types = 'i';
- $id = 1;
- $params = array(
- 0 => &$stmt,
- 1 => $types,
- 2 => &$id
- );
- if (!call_user_func_array('mysqli_stmt_bind_param', $params))
- printf("[027] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!mysqli_stmt_execute($stmt))
- printf("[028] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = $label = null;
- if (!mysqli_stmt_bind_result($stmt, $id, $label) ||
- (true !== mysqli_stmt_fetch($stmt)))
- printf("[029] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- print "Call user func, procedural, using references for everything but using variable for types\n";
- var_dump($id);
- var_dump($label);
-
- mysqli_stmt_close($stmt);
- if (!$stmt = mysqli_stmt_init($link))
- printf("[025] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
- printf("[026] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $types = 'i';
- $id = 1;
- $params = array(
- 0 => $stmt,
- 1 => $types,
- 2 => &$id
- );
- if (!call_user_func_array('mysqli_stmt_bind_param', $params))
- printf("[027] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!mysqli_stmt_execute($stmt))
- printf("[028] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = $label = null;
- if (!mysqli_stmt_bind_result($stmt, $id, $label) ||
- (true !== mysqli_stmt_fetch($stmt)))
- printf("[029] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- print "Call user func, procedural, using references for bound parameter, using variables for resource and types\n";
- var_dump($id);
- var_dump($label);
-
- mysqli_stmt_close($stmt);
- if (!$stmt = mysqli_stmt_init($link))
- printf("[030] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
- printf("[031] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $types = 'i';
- $id = 1;
- $params = array(
- 0 => $stmt,
- 1 => $types,
- 2 => &$id
- );
- if (!call_user_func_array('mysqli_stmt_bind_param', $params))
- printf("[032] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!mysqli_stmt_execute($stmt))
- printf("[033] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = $label = null;
- if (!mysqli_stmt_bind_result($stmt, $id, $label) ||
- (true !== mysqli_stmt_fetch($stmt)))
- printf("[034] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- print "Call user func, procedural, using references for bound parameter, using variables for resource and types\n";
- var_dump($id);
- var_dump($label);
-
- mysqli_stmt_close($stmt);
- if (!$stmt = mysqli_stmt_init($link))
- printf("[035] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
- printf("[036] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = 1;
- $params = array(
- 0 => $stmt,
- 1 => 'i',
- 2 => &$id
- );
- if (!call_user_func_array('mysqli_stmt_bind_param', $params))
- printf("[037] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!mysqli_stmt_execute($stmt))
- printf("[038] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = $label = null;
- if (!mysqli_stmt_bind_result($stmt, $id, $label) ||
- (true !== mysqli_stmt_fetch($stmt)))
- printf("[039] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- print "Call user func, procedural, using references for bound parameter, using variable for resource, using constant for types\n";
- var_dump($id);
- var_dump($label);
-
- mysqli_stmt_close($stmt);
- if (!$stmt = mysqli_stmt_init($link))
- printf("[040] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
- printf("[041] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = 1;
- if (!call_user_func_array('mysqli_stmt_bind_param', array($stmt, 'i', &$id)))
- printf("[042] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!mysqli_stmt_execute($stmt))
- printf("[043] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = $label = null;
- if (!mysqli_stmt_bind_result($stmt, $id, $label) ||
- (true !== mysqli_stmt_fetch($stmt)))
- printf("[044] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- print "Call user func, procedural, using references for bound parameter, using variable for resource, using constant for types, array\n";
- var_dump($id);
- var_dump($label);
-
- //
- // Any of those shall fail - see also bugs.php.net/43568
- //
- mysqli_stmt_close($stmt);
- if (!$stmt = mysqli_stmt_init($link))
- printf("[045] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
- printf("[046] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = 1;
- $params = array(
- 0 => 'i',
- 1 => &$id
- );
- if (!call_user_func_array(array($stmt, 'bind_param'), $params))
- printf("[047] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!mysqli_stmt_execute($stmt))
- printf("[048] [%d] (Message might vary with MySQL Server version, e.g. No data supplied for parameters in prepared statement)\n", mysqli_stmt_errno($stmt));
-
- mysqli_stmt_close($stmt);
- if (!$stmt = mysqli_stmt_init($link))
- printf("[049] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
- printf("[050] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $types = 'i';
- $id = 1;
- $params = array(
- 0 => $stmt,
- 1 => 'i',
- 2 => &$id
- );
- if (!call_user_func_array('mysqli_stmt_bind_param', $params))
- printf("[051] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!mysqli_stmt_execute($stmt))
- printf("[052] [%d] (Message might vary with MySQL Server version, e.g. No data supplied for parameters in prepared statement)\n", mysqli_stmt_errno($stmt));
-
- print "done!";
+ require('connect.inc');
+ require('table.inc');
+
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
+ printf("[002] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = 1;
+ if (!mysqli_stmt_bind_param($stmt, 'i', $id) ||
+ !mysqli_stmt_execute($stmt))
+ printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = $label = null;
+ if (!mysqli_stmt_bind_result($stmt, $id, $label) ||
+ (true !== mysqli_stmt_fetch($stmt)))
+ printf("[004] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ print "Regular, procedural, using variables\n";
+ var_dump($id);
+ var_dump($label);
+
+ mysqli_stmt_close($stmt);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
+ printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $types = 'i';
+ $id = 1;
+ $params = array(
+ 0 => &$stmt,
+ 1 => &$types,
+ 2 => &$id
+ );
+ if (!call_user_func_array('mysqli_stmt_bind_param', $params))
+ printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!mysqli_stmt_execute($stmt))
+ printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = $label = null;
+ if (!mysqli_stmt_bind_result($stmt, $id, $label) ||
+ (true !== mysqli_stmt_fetch($stmt)))
+ printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ print "Call user func, procedural, using references for everything\n";
+ var_dump($id);
+ var_dump($label);
+
+ mysqli_stmt_close($stmt);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
+ printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $types = 'i';
+ $id = 1;
+ $params = array(
+ 0 => &$types,
+ 1 => &$id
+ );
+ if (!call_user_func_array(array($stmt, 'bind_param'), $params))
+ printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!mysqli_stmt_execute($stmt))
+ printf("[013] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = $label = null;
+ if (!mysqli_stmt_bind_result($stmt, $id, $label) ||
+ (true !== mysqli_stmt_fetch($stmt)))
+ printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ print "Call user func, object oriented, using references for everything\n";
+ var_dump($id);
+ var_dump($label);
+
+ mysqli_stmt_close($stmt);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
+ printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $types = 'i';
+ $id = 1;
+ $params = array(
+ 0 => $types,
+ 1 => &$id
+ );
+ if (!call_user_func_array(array($stmt, 'bind_param'), $params))
+ printf("[017] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!mysqli_stmt_execute($stmt))
+ printf("[018] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = $label = null;
+ if (!mysqli_stmt_bind_result($stmt, $id, $label) ||
+ (true !== mysqli_stmt_fetch($stmt)))
+ printf("[019] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ print "Call user func, object oriented, using variable for types. using references for bound parameter\n";
+ var_dump($id);
+ var_dump($label);
+
+ mysqli_stmt_close($stmt);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
+ printf("[021] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = 1;
+ $params = array(
+ 0 => 'i',
+ 1 => &$id
+ );
+ if (!call_user_func_array(array($stmt, 'bind_param'), $params))
+ printf("[022] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!mysqli_stmt_execute($stmt))
+ printf("[023] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = $label = null;
+ if (!mysqli_stmt_bind_result($stmt, $id, $label) ||
+ (true !== mysqli_stmt_fetch($stmt)))
+ printf("[024] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ print "Call user func, object oriented, using constant for types. using references for bound parameter\n";
+ var_dump($id);
+ var_dump($label);
+
+ mysqli_stmt_close($stmt);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[025] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
+ printf("[026] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $types = 'i';
+ $id = 1;
+ $params = array(
+ 0 => &$stmt,
+ 1 => $types,
+ 2 => &$id
+ );
+ if (!call_user_func_array('mysqli_stmt_bind_param', $params))
+ printf("[027] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!mysqli_stmt_execute($stmt))
+ printf("[028] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = $label = null;
+ if (!mysqli_stmt_bind_result($stmt, $id, $label) ||
+ (true !== mysqli_stmt_fetch($stmt)))
+ printf("[029] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ print "Call user func, procedural, using references for everything but using variable for types\n";
+ var_dump($id);
+ var_dump($label);
+
+ mysqli_stmt_close($stmt);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[025] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
+ printf("[026] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $types = 'i';
+ $id = 1;
+ $params = array(
+ 0 => $stmt,
+ 1 => $types,
+ 2 => &$id
+ );
+ if (!call_user_func_array('mysqli_stmt_bind_param', $params))
+ printf("[027] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!mysqli_stmt_execute($stmt))
+ printf("[028] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = $label = null;
+ if (!mysqli_stmt_bind_result($stmt, $id, $label) ||
+ (true !== mysqli_stmt_fetch($stmt)))
+ printf("[029] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ print "Call user func, procedural, using references for bound parameter, using variables for resource and types\n";
+ var_dump($id);
+ var_dump($label);
+
+ mysqli_stmt_close($stmt);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[030] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
+ printf("[031] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $types = 'i';
+ $id = 1;
+ $params = array(
+ 0 => $stmt,
+ 1 => $types,
+ 2 => &$id
+ );
+ if (!call_user_func_array('mysqli_stmt_bind_param', $params))
+ printf("[032] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!mysqli_stmt_execute($stmt))
+ printf("[033] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = $label = null;
+ if (!mysqli_stmt_bind_result($stmt, $id, $label) ||
+ (true !== mysqli_stmt_fetch($stmt)))
+ printf("[034] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ print "Call user func, procedural, using references for bound parameter, using variables for resource and types\n";
+ var_dump($id);
+ var_dump($label);
+
+ mysqli_stmt_close($stmt);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[035] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
+ printf("[036] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = 1;
+ $params = array(
+ 0 => $stmt,
+ 1 => 'i',
+ 2 => &$id
+ );
+ if (!call_user_func_array('mysqli_stmt_bind_param', $params))
+ printf("[037] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!mysqli_stmt_execute($stmt))
+ printf("[038] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = $label = null;
+ if (!mysqli_stmt_bind_result($stmt, $id, $label) ||
+ (true !== mysqli_stmt_fetch($stmt)))
+ printf("[039] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ print "Call user func, procedural, using references for bound parameter, using variable for resource, using constant for types\n";
+ var_dump($id);
+ var_dump($label);
+
+ mysqli_stmt_close($stmt);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[040] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
+ printf("[041] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = 1;
+ if (!call_user_func_array('mysqli_stmt_bind_param', array($stmt, 'i', &$id)))
+ printf("[042] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!mysqli_stmt_execute($stmt))
+ printf("[043] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = $label = null;
+ if (!mysqli_stmt_bind_result($stmt, $id, $label) ||
+ (true !== mysqli_stmt_fetch($stmt)))
+ printf("[044] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ print "Call user func, procedural, using references for bound parameter, using variable for resource, using constant for types, array\n";
+ var_dump($id);
+ var_dump($label);
+
+ //
+ // Any of those shall fail - see also bugs.php.net/43568
+ //
+ mysqli_stmt_close($stmt);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[045] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
+ printf("[046] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = 1;
+ $params = array(
+ 0 => 'i',
+ 1 => &$id
+ );
+ if (!call_user_func_array(array($stmt, 'bind_param'), $params))
+ printf("[047] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!mysqli_stmt_execute($stmt))
+ printf("[048] [%d] (Message might vary with MySQL Server version, e.g. No data supplied for parameters in prepared statement)\n", mysqli_stmt_errno($stmt));
+
+ mysqli_stmt_close($stmt);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[049] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test WHERE id = ?'))
+ printf("[050] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $types = 'i';
+ $id = 1;
+ $params = array(
+ 0 => $stmt,
+ 1 => 'i',
+ 2 => &$id
+ );
+ if (!call_user_func_array('mysqli_stmt_bind_param', $params))
+ printf("[051] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!mysqli_stmt_execute($stmt))
+ printf("[052] [%d] (Message might vary with MySQL Server version, e.g. No data supplied for parameters in prepared statement)\n", mysqli_stmt_errno($stmt));
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_bind_param_check_param_no_change.phpt b/ext/mysqli/tests/mysqli_stmt_bind_param_check_param_no_change.phpt
index b8f209ef79..4b243ef3d6 100644
--- a/ext/mysqli/tests/mysqli_stmt_bind_param_check_param_no_change.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_bind_param_check_param_no_change.phpt
@@ -8,59 +8,59 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require('table.inc');
- $link->set_charset('latin1');
+ require('table.inc');
+ $link->set_charset('latin1');
- class foo {
- // @var $bar string
- public $bar;
- }
+ class foo {
+ // @var $bar string
+ public $bar;
+ }
- $foo = new foo;
- $foo->bar = "фубар";
+ $foo = new foo;
+ $foo->bar = "фубар";
- echo "Test 1:\n";
- $stmt = $link->prepare("SELECT ? FOO");
- var_dump($foo); // here you can see the bar member var being a string
- $stmt->bind_param("s", $foo->bar);
- var_dump($foo); // this will show $foo->bar being a reference string
- $stmt->bind_result($one);
- $stmt->execute();
- $stmt->fetch();
- $stmt->free_result();
- echo("$one\n\n");
+ echo "Test 1:\n";
+ $stmt = $link->prepare("SELECT ? FOO");
+ var_dump($foo); // here you can see the bar member var being a string
+ $stmt->bind_param("s", $foo->bar);
+ var_dump($foo); // this will show $foo->bar being a reference string
+ $stmt->bind_result($one);
+ $stmt->execute();
+ $stmt->fetch();
+ $stmt->free_result();
+ echo("$one\n\n");
- // it is getting worse. Binding the same var twice with different
- // types you can get unexpected results (e.g. binary trash for the
- // string and misc data for the integer. See next 2 tests.
+ // it is getting worse. Binding the same var twice with different
+ // types you can get unexpected results (e.g. binary trash for the
+ // string and misc data for the integer. See next 2 tests.
- echo "Test 2:\n";
- $stmt = $link->prepare("SELECT ? FOO, ? BAR");
- var_dump($foo);
- $stmt->bind_param("si", $foo->bar, $foo->bar);
- echo "---\n";
- var_dump($foo);
- echo "---\n";
- $stmt->execute();
- var_dump($foo);
- echo "---\n";
- $stmt->bind_result($one, $two);
- $stmt->fetch();
- $stmt->free_result();
- echo("$one - $two\n\n");
+ echo "Test 2:\n";
+ $stmt = $link->prepare("SELECT ? FOO, ? BAR");
+ var_dump($foo);
+ $stmt->bind_param("si", $foo->bar, $foo->bar);
+ echo "---\n";
+ var_dump($foo);
+ echo "---\n";
+ $stmt->execute();
+ var_dump($foo);
+ echo "---\n";
+ $stmt->bind_result($one, $two);
+ $stmt->fetch();
+ $stmt->free_result();
+ echo("$one - $two\n\n");
- echo "Test 3:\n";
- $stmt = $link->prepare("SELECT ? FOO, ? BAR");
- var_dump($foo);
- $stmt->bind_param("is", $foo->bar, $foo->bar);
- var_dump($foo);
- $stmt->bind_result($one, $two);
- $stmt->execute();
- $stmt->fetch();
- $stmt->free_result();
- echo("$one - $two\n\n");
- echo "done!";
+ echo "Test 3:\n";
+ $stmt = $link->prepare("SELECT ? FOO, ? BAR");
+ var_dump($foo);
+ $stmt->bind_param("is", $foo->bar, $foo->bar);
+ var_dump($foo);
+ $stmt->bind_result($one, $two);
+ $stmt->execute();
+ $stmt->fetch();
+ $stmt->free_result();
+ echo("$one - $two\n\n");
+ echo "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_bind_param_many_columns.phpt b/ext/mysqli/tests/mysqli_stmt_bind_param_many_columns.phpt
index 0b054c4827..efe86972d9 100644
--- a/ext/mysqli/tests/mysqli_stmt_bind_param_many_columns.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_bind_param_many_columns.phpt
@@ -10,87 +10,87 @@ require_once('skipifconnectfailure.inc');
memory_limit=256M
--FILE--
<?php
- /*
- The way we test the INSERT and data types overlaps with
- the mysqli_stmt_bind_result test in large parts. There is only
- one difference. This test uses mysqli_query()/mysqli_fetch_assoc() to
- fetch the inserted values. This way we test
- mysqli_query()/mysqli_fetch_assoc() for all possible data types
- in this file and we test mysqli_stmt_bind_result() in the other
- test -- therefore the "duplicate" makes some sense to me.
- */
- require_once("connect.inc");
+ /*
+ The way we test the INSERT and data types overlaps with
+ the mysqli_stmt_bind_result test in large parts. There is only
+ one difference. This test uses mysqli_query()/mysqli_fetch_assoc() to
+ fetch the inserted values. This way we test
+ mysqli_query()/mysqli_fetch_assoc() for all possible data types
+ in this file and we test mysqli_stmt_bind_result() in the other
+ test -- therefore the "duplicate" makes some sense to me.
+ */
+ require_once("connect.inc");
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- exit(1);
- }
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ exit(1);
+ }
- $cols = 2500;
+ $cols = 2500;
- list($old_max_allowed_packet) = $link->query("SELECT @@max_allowed_packet")->fetch_row();
- if (!$link->query("SET GLOBAL max_allowed_packet=(2<<29)")) {
- if (1227 == mysqli_errno($link)) {
- /* [1227] Access denied; you need the SUPER privilege for this operation */
- $cols = 10;
- } else {
- $cols = 10;
- printf("[002] Failed to set max_allowed_packet the test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- }
- mysqli_close($link);
+ list($old_max_allowed_packet) = $link->query("SELECT @@max_allowed_packet")->fetch_row();
+ if (!$link->query("SET GLOBAL max_allowed_packet=(2<<29)")) {
+ if (1227 == mysqli_errno($link)) {
+ /* [1227] Access denied; you need the SUPER privilege for this operation */
+ $cols = 10;
+ } else {
+ $cols = 10;
+ printf("[002] Failed to set max_allowed_packet the test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ }
+ mysqli_close($link);
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- exit(1);
- }
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ exit(1);
+ }
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
- printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- exit(1);
- }
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
+ printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ exit(1);
+ }
- $str = array();
- for ($i = 1; $i <= $cols; $i++) {
- $str[] ="a$i BLOB";
- }
- $link->query("CREATE TABLE test(" . implode(" , ", $str) . ") ENGINE=MyISAM");
- if (mysqli_errno($link)) {
- printf("Failed to create the test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- die("");
- }
- $stmt = $link->prepare("INSERT INTO test VALUES(".str_repeat("?, ", $cols-1) . "?)");
- var_dump($stmt->id);
- $s = str_repeat("a", 2 << 12);
- $eval_str="\$stmt->bind_param(\"".str_repeat("s",$cols)."\", ";
- for ($i = 1; $i < $cols; $i++) {
- $eval_str.="\$s,";
- }
- $eval_str.="\$s";
- $eval_str.=");";
- eval($eval_str);
- printf("executing\n");
- if (!$stmt->execute()) {
- printf("failed");
- printf("Failed to execute: [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- } else {
- var_dump(true);
- }
+ $str = array();
+ for ($i = 1; $i <= $cols; $i++) {
+ $str[] ="a$i BLOB";
+ }
+ $link->query("CREATE TABLE test(" . implode(" , ", $str) . ") ENGINE=MyISAM");
+ if (mysqli_errno($link)) {
+ printf("Failed to create the test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ die("");
+ }
+ $stmt = $link->prepare("INSERT INTO test VALUES(".str_repeat("?, ", $cols-1) . "?)");
+ var_dump($stmt->id);
+ $s = str_repeat("a", 2 << 12);
+ $eval_str="\$stmt->bind_param(\"".str_repeat("s",$cols)."\", ";
+ for ($i = 1; $i < $cols; $i++) {
+ $eval_str.="\$s,";
+ }
+ $eval_str.="\$s";
+ $eval_str.=");";
+ eval($eval_str);
+ printf("executing\n");
+ if (!$stmt->execute()) {
+ printf("failed");
+ printf("Failed to execute: [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ } else {
+ var_dump(true);
+ }
- mysqli_stmt_close($stmt);
+ mysqli_stmt_close($stmt);
- if (!$link->query("SET GLOBAL max_allowed_packet=$old_max_allowed_packet")) {
- if (1227 != mysqli_errno($link))
- printf("Failed to set max_allowed_packet the test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
+ if (!$link->query("SET GLOBAL max_allowed_packet=$old_max_allowed_packet")) {
+ if (1227 != mysqli_errno($link))
+ printf("Failed to set max_allowed_packet the test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
- mysqli_close($link);
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_bind_param_references.phpt b/ext/mysqli/tests/mysqli_stmt_bind_param_references.phpt
index e7b581f815..f05e46fe9d 100644
--- a/ext/mysqli/tests/mysqli_stmt_bind_param_references.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_bind_param_references.phpt
@@ -8,196 +8,196 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require('table.inc');
-
- function findRow($offset, $link, $id, $label) {
-
- $sql = sprintf("SELECT id, label FROM test WHERE id = '%d' AND label = '%s'",
- $id, $label);
- if (!$res = mysqli_query($link, $sql)) {
- printf("[%03d + 1] %s failed, [%d] %s\n",
- $offset, $sql, mysqli_errno($link), mysqli_error($link));
- return false;
- }
- if (!$row = mysqli_fetch_assoc($res)) {
- printf("[%03d + 2] fetch for %s failed, [%d] %s\n",
- $offset, $sql, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- mysqli_free_result($res);
- if ($row['id'] != $id) {
- printf("[%03d + 3] Expecting %s/%s got %s/%s\n",
- $offset, gettype($id), $id,
- gettype($row['id']), $row['id']
- );
- return false;
- }
-
- if ($row['label'] != $label) {
- printf("[%03d + 4] Expecting %s/%s got %s/%s\n",
- $offset, gettype($label), $label,
- gettype($row['label']), $row['label']
- );
- return false;
- }
-
- $sql = sprintf("DELETE FROM test WHERE id = '%d' AND label = '%s'",
- $id, $label);
- if (!mysqli_query($link, $sql)) {
- printf("[%03d + 5] %s failed, [%d] %s\n",
- $offset, $sql, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- return true;
- }
- // or we will get dups around [28]
- mysqli_query($link, "ALTER TABLE test DROP PRIMARY KEY");
-
- $stmt = mysqli_stmt_init($link);
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
- printf("[001] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = 100;
- $label = 'v';
- if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label)))
- printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (true !== mysqli_stmt_execute($stmt))
- printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- // no need to check the return value, will bail and make EXPECTF fail if need be
- findRow(4, $link, $id, $label);
-
- $id++;
- $label_ref = &$label;
- $label = 'w';
- if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label_ref)))
- printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (true !== mysqli_stmt_execute($stmt))
- printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- findRow(7, $link, $id, $label_ref);
-
- $id++;
- $label_ref_ref = &$label_ref;
- $label = 'x';
-
- if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label_ref_ref)))
- printf("[007] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (true !== mysqli_stmt_execute($stmt))
- printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- findRow(9, $link, $id, $label_ref_ref);
-
- $id = 9;
- $label = $id;
- $label_num = &$label;
-
- if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label_num)))
- printf("[010] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (true !== mysqli_stmt_execute($stmt))
- printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- findRow(12, $link, $id, $label_num);
-
- $label_num = &$id;
- if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label_num)))
- printf("[013] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (true !== mysqli_stmt_execute($stmt))
- printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- findRow(15, $link, $id, $label_num);
-
- $label = 9;
- $id = &$label;
-
- if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label)))
- printf("[015] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (true !== mysqli_stmt_execute($stmt))
- printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- findRow(17, $link, $id, $label);
-
- $base = 9;
- $id = &$base;
- $label = &$id;
-
- if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label)))
- printf("[018] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (true !== mysqli_stmt_execute($stmt))
- printf("[019] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- findRow(20, $link, $id, $label);
-
- $id_ref = &$id;
- $label_ref = &$label;
-
- if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id_ref, $label_ref)))
- printf("[021] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (true !== mysqli_stmt_execute($stmt))
- printf("[022] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- findRow(23, $link, $id_ref, $label_ref);
-
- $id_ref_ref = &$GLOBALS['id_ref'];
- $label_ref_ref = &$GLOBALS['label_ref_ref'];
-
- if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id_ref_ref, $label_ref_ref)))
- printf("[024] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (true !== mysqli_stmt_execute($stmt))
- printf("[025] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- findRow(26, $link, $id_ref_ref, $label_ref_ref);
-
- unset($id);
- unset($label);
- $id = 102;
- $label = new stdClass();
- $label->label = 'y';
- $id_ref = &$GLOBALS['id'];
- $label_ref = &$label->label;
- if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id_ref, $label_ref)))
- printf("[027] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- if (true !== @mysqli_stmt_execute($stmt))
- printf("[028] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- findRow(29, $link, $id_ref, $label_ref);
-
- $id = 103;
- $label_a = &$label_b;
- $label_b = &$label_a;
- $label_a = 'z';
-
- if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label_b)))
- printf("[030] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (true !== mysqli_stmt_execute($stmt))
- printf("[031] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- findRow(32, $link, $id, $label_b);
-
- class foo {
- public $foo;
- function __construct() {
- $this->foo = &$this->bar;
- }
- }
- class bar extends foo {
- public $bar = 'v';
- }
- $bar = new bar();
- $id++;
- $label = &$GLOBALS['bar']->foo;
-
- if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label)))
- printf("[033] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (true !== mysqli_stmt_execute($stmt))
- printf("[034] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- findRow(35, $link, $id, $label);
-
- mysqli_stmt_close($stmt);
- mysqli_close($link);
- print "done!";
+ require('table.inc');
+
+ function findRow($offset, $link, $id, $label) {
+
+ $sql = sprintf("SELECT id, label FROM test WHERE id = '%d' AND label = '%s'",
+ $id, $label);
+ if (!$res = mysqli_query($link, $sql)) {
+ printf("[%03d + 1] %s failed, [%d] %s\n",
+ $offset, $sql, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+ if (!$row = mysqli_fetch_assoc($res)) {
+ printf("[%03d + 2] fetch for %s failed, [%d] %s\n",
+ $offset, $sql, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ mysqli_free_result($res);
+ if ($row['id'] != $id) {
+ printf("[%03d + 3] Expecting %s/%s got %s/%s\n",
+ $offset, gettype($id), $id,
+ gettype($row['id']), $row['id']
+ );
+ return false;
+ }
+
+ if ($row['label'] != $label) {
+ printf("[%03d + 4] Expecting %s/%s got %s/%s\n",
+ $offset, gettype($label), $label,
+ gettype($row['label']), $row['label']
+ );
+ return false;
+ }
+
+ $sql = sprintf("DELETE FROM test WHERE id = '%d' AND label = '%s'",
+ $id, $label);
+ if (!mysqli_query($link, $sql)) {
+ printf("[%03d + 5] %s failed, [%d] %s\n",
+ $offset, $sql, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ return true;
+ }
+ // or we will get dups around [28]
+ mysqli_query($link, "ALTER TABLE test DROP PRIMARY KEY");
+
+ $stmt = mysqli_stmt_init($link);
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
+ printf("[001] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = 100;
+ $label = 'v';
+ if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label)))
+ printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (true !== mysqli_stmt_execute($stmt))
+ printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ // no need to check the return value, will bail and make EXPECTF fail if need be
+ findRow(4, $link, $id, $label);
+
+ $id++;
+ $label_ref = &$label;
+ $label = 'w';
+ if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label_ref)))
+ printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (true !== mysqli_stmt_execute($stmt))
+ printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ findRow(7, $link, $id, $label_ref);
+
+ $id++;
+ $label_ref_ref = &$label_ref;
+ $label = 'x';
+
+ if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label_ref_ref)))
+ printf("[007] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (true !== mysqli_stmt_execute($stmt))
+ printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ findRow(9, $link, $id, $label_ref_ref);
+
+ $id = 9;
+ $label = $id;
+ $label_num = &$label;
+
+ if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label_num)))
+ printf("[010] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (true !== mysqli_stmt_execute($stmt))
+ printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ findRow(12, $link, $id, $label_num);
+
+ $label_num = &$id;
+ if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label_num)))
+ printf("[013] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (true !== mysqli_stmt_execute($stmt))
+ printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ findRow(15, $link, $id, $label_num);
+
+ $label = 9;
+ $id = &$label;
+
+ if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label)))
+ printf("[015] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (true !== mysqli_stmt_execute($stmt))
+ printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ findRow(17, $link, $id, $label);
+
+ $base = 9;
+ $id = &$base;
+ $label = &$id;
+
+ if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label)))
+ printf("[018] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (true !== mysqli_stmt_execute($stmt))
+ printf("[019] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ findRow(20, $link, $id, $label);
+
+ $id_ref = &$id;
+ $label_ref = &$label;
+
+ if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id_ref, $label_ref)))
+ printf("[021] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (true !== mysqli_stmt_execute($stmt))
+ printf("[022] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ findRow(23, $link, $id_ref, $label_ref);
+
+ $id_ref_ref = &$GLOBALS['id_ref'];
+ $label_ref_ref = &$GLOBALS['label_ref_ref'];
+
+ if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id_ref_ref, $label_ref_ref)))
+ printf("[024] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (true !== mysqli_stmt_execute($stmt))
+ printf("[025] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ findRow(26, $link, $id_ref_ref, $label_ref_ref);
+
+ unset($id);
+ unset($label);
+ $id = 102;
+ $label = new stdClass();
+ $label->label = 'y';
+ $id_ref = &$GLOBALS['id'];
+ $label_ref = &$label->label;
+ if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id_ref, $label_ref)))
+ printf("[027] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== @mysqli_stmt_execute($stmt))
+ printf("[028] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ findRow(29, $link, $id_ref, $label_ref);
+
+ $id = 103;
+ $label_a = &$label_b;
+ $label_b = &$label_a;
+ $label_a = 'z';
+
+ if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label_b)))
+ printf("[030] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (true !== mysqli_stmt_execute($stmt))
+ printf("[031] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ findRow(32, $link, $id, $label_b);
+
+ class foo {
+ public $foo;
+ function __construct() {
+ $this->foo = &$this->bar;
+ }
+ }
+ class bar extends foo {
+ public $bar = 'v';
+ }
+ $bar = new bar();
+ $id++;
+ $label = &$GLOBALS['bar']->foo;
+
+ if (true !== ($tmp = mysqli_stmt_bind_param($stmt, "is", $id, $label)))
+ printf("[033] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (true !== mysqli_stmt_execute($stmt))
+ printf("[034] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ findRow(35, $link, $id, $label);
+
+ mysqli_stmt_close($stmt);
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_bind_param_type_juggling.phpt b/ext/mysqli/tests/mysqli_stmt_bind_param_type_juggling.phpt
index 72adfb04e7..5a8dd90577 100644
--- a/ext/mysqli/tests/mysqli_stmt_bind_param_type_juggling.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_bind_param_type_juggling.phpt
@@ -8,116 +8,116 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require('table.inc');
-
- function bind_twice($link, $engine, $sql_type1, $sql_type2, $bind_type1, $bind_type2, $bind_value1, $bind_value2, $offset) {
-
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
- printf("[%03d + 1] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
- return false;
- }
- mysqli_autocommit($link, true);
-
- $sql = sprintf("CREATE TABLE test(col1 %s, col2 %s) ENGINE=%s", $sql_type1, $sql_type2, $engine);
- if (!mysqli_query($link, $sql)) {
- printf("[%03d + 2] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if (!$stmt = mysqli_stmt_init($link)) {
- printf("[%03d + 3] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(col1, col2) VALUES (?, ?)")) {
- printf("[%03d + 4] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
-
- if (!mysqli_stmt_bind_param($stmt, $bind_type1 . $bind_type2, $bind_value1, $bind_value1)) {
- printf("[%03d + 5] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
-
- if (!mysqli_stmt_execute($stmt)) {
- printf("[%03d + 6] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
-
- if (!mysqli_stmt_bind_param($stmt, $bind_type1 . $bind_type2, $bind_value1, $bind_value2)) {
- printf("[%03d + 7] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
- if (!mysqli_stmt_execute($stmt)) {
- printf("[%03d + 8] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
-
- mysqli_stmt_close($stmt);
- if (!$res = mysqli_query($link, "SELECT col1, col2 FROM test")) {
- printf("[%03d + 9] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if (2 !== ($tmp = mysqli_num_rows($res))) {
- printf("[%03d + 10] Expecting 2 rows, got %d rows [%d] %s\n", $offset, $tmp, mysqli_errno($link), mysqli_error($link));
- }
-
- $row = mysqli_fetch_assoc($res);
- if (($row['col1'] != $bind_value1) || ($row['col2'] != $bind_value1)) {
- printf("[%03d + 11] Expecting col1 = %s, col2 = %s got col1 = %s, col2 = %s - [%d] %s\n",
- $offset, $bind_value1, $bind_value1,
- $row['col1'], $row['col2'],
- mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- $row = mysqli_fetch_assoc($res);
- if (($row['col1'] != $bind_value1) || ($row['col2'] != $bind_value2)) {
- printf("[%03d + 12] Expecting col1 = %s, col2 = %s got col1 = %s, col2 = %s - [%d] %s\n",
- $offset, $bind_value1, $bind_value2,
- $row['col1'], $row['col2'],
- mysqli_errno($link), mysqli_error($link));
- return false;
- }
- mysqli_free_result($res);
- return true;
- }
-
- bind_twice($link, $engine, 'CHAR(1)', 'CHAR(1)', 's', 's', 'a', 'b', 10);
- bind_twice($link, $engine, 'INT', 'INT', 'i', 'i', 1, 2, 20);
- bind_twice($link, $engine, 'FLOAT', 'FLOAT', 'd', 'd', 1.01, 1.02, 30);
-
- /* type juggling - note that int->char works */
- bind_twice($link, $engine, 'CHAR(1)', 'CHAR(1)', 's', 's', 1, 2, 40);
- /* type juggling - note that string->integer works */
- bind_twice($link, $engine, 'INT', 'INT', 'i', 'i', '1', '2', 50);
- /* type juggling - note that string->float works*/
- bind_twice($link, $engine, 'FLOAT', 'FLOAT', 'd', 'd', '1.01', '1.02', 60);
-
- /* now, let's have two columns of different type and do type juggling */
- /*
- what the test will do is:
- 1) col1 INT, col2 CHAR(1)
+ require('table.inc');
+
+ function bind_twice($link, $engine, $sql_type1, $sql_type2, $bind_type1, $bind_type2, $bind_value1, $bind_value2, $offset) {
+
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
+ printf("[%03d + 1] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+ mysqli_autocommit($link, true);
+
+ $sql = sprintf("CREATE TABLE test(col1 %s, col2 %s) ENGINE=%s", $sql_type1, $sql_type2, $engine);
+ if (!mysqli_query($link, $sql)) {
+ printf("[%03d + 2] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if (!$stmt = mysqli_stmt_init($link)) {
+ printf("[%03d + 3] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(col1, col2) VALUES (?, ?)")) {
+ printf("[%03d + 4] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+
+ if (!mysqli_stmt_bind_param($stmt, $bind_type1 . $bind_type2, $bind_value1, $bind_value1)) {
+ printf("[%03d + 5] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+
+ if (!mysqli_stmt_execute($stmt)) {
+ printf("[%03d + 6] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+
+ if (!mysqli_stmt_bind_param($stmt, $bind_type1 . $bind_type2, $bind_value1, $bind_value2)) {
+ printf("[%03d + 7] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+ if (!mysqli_stmt_execute($stmt)) {
+ printf("[%03d + 8] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+
+ mysqli_stmt_close($stmt);
+ if (!$res = mysqli_query($link, "SELECT col1, col2 FROM test")) {
+ printf("[%03d + 9] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if (2 !== ($tmp = mysqli_num_rows($res))) {
+ printf("[%03d + 10] Expecting 2 rows, got %d rows [%d] %s\n", $offset, $tmp, mysqli_errno($link), mysqli_error($link));
+ }
+
+ $row = mysqli_fetch_assoc($res);
+ if (($row['col1'] != $bind_value1) || ($row['col2'] != $bind_value1)) {
+ printf("[%03d + 11] Expecting col1 = %s, col2 = %s got col1 = %s, col2 = %s - [%d] %s\n",
+ $offset, $bind_value1, $bind_value1,
+ $row['col1'], $row['col2'],
+ mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ $row = mysqli_fetch_assoc($res);
+ if (($row['col1'] != $bind_value1) || ($row['col2'] != $bind_value2)) {
+ printf("[%03d + 12] Expecting col1 = %s, col2 = %s got col1 = %s, col2 = %s - [%d] %s\n",
+ $offset, $bind_value1, $bind_value2,
+ $row['col1'], $row['col2'],
+ mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+ mysqli_free_result($res);
+ return true;
+ }
+
+ bind_twice($link, $engine, 'CHAR(1)', 'CHAR(1)', 's', 's', 'a', 'b', 10);
+ bind_twice($link, $engine, 'INT', 'INT', 'i', 'i', 1, 2, 20);
+ bind_twice($link, $engine, 'FLOAT', 'FLOAT', 'd', 'd', 1.01, 1.02, 30);
+
+ /* type juggling - note that int->char works */
+ bind_twice($link, $engine, 'CHAR(1)', 'CHAR(1)', 's', 's', 1, 2, 40);
+ /* type juggling - note that string->integer works */
+ bind_twice($link, $engine, 'INT', 'INT', 'i', 'i', '1', '2', 50);
+ /* type juggling - note that string->float works*/
+ bind_twice($link, $engine, 'FLOAT', 'FLOAT', 'd', 'd', '1.01', '1.02', 60);
+
+ /* now, let's have two columns of different type and do type juggling */
+ /*
+ what the test will do is:
+ 1) col1 INT, col2 CHAR(1)
2) bind_param('is', 1, 1)
3) execute()
- 4) bind_param('is', 1, 'a')
- 5) execute()
+ 4) bind_param('is', 1, 'a')
+ 5) execute()
- col1 INT, col2 INT
+ col1 INT, col2 INT
bind_param('ii', '1', '2') --> OK (int column, string value)
- bind_param('ii', 1, 2) --> OK (int column, int value)
+ bind_param('ii', 1, 2) --> OK (int column, int value)
col1 CHAR(1), col2 CHAR(2)
bind_param('ss', 1, 2) --> OK (string column, int value)
- So, what about:
- col1 INT, COL2 CHAR(1)
- bind_param('is', 1, 1) ---> ??
- */
- bind_twice($link, $engine, 'INT', 'CHAR(1)', 'i', 's', 1, 'a', 70);
+ So, what about:
+ col1 INT, COL2 CHAR(1)
+ bind_param('is', 1, 1) ---> ??
+ */
+ bind_twice($link, $engine, 'INT', 'CHAR(1)', 'i', 's', 1, 'a', 70);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_bind_result.phpt b/ext/mysqli/tests/mysqli_stmt_bind_result.phpt
index dcd05e5f68..c1dddca4f2 100644
--- a/ext/mysqli/tests/mysqli_stmt_bind_result.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_bind_result.phpt
@@ -8,320 +8,302 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_bind_result()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_bind_result($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- require('table.inc');
-
- $stmt = mysqli_stmt_init($link);
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 1"))
- printf("[002a] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!is_null($tmp = mysqli_stmt_bind_result($stmt)))
- printf("[002b] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_stmt_close($stmt);
- $stmt = mysqli_stmt_init($link);
-
- $id = null;
- $label = null;
- $foo = null;
-
- if (false !== ($tmp = mysqli_stmt_bind_result($stmt, $id)))
- printf("[003] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 1"))
- printf("[004] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (false !== ($tmp = mysqli_stmt_bind_result($stmt, $id)))
- printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label)))
- printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- if (false !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label, $foo)))
- printf("[007] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_stmt_execute($stmt))
- printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- while (mysqli_stmt_fetch($stmt)) {
- var_dump($id);
- var_dump($label);
- }
- mysqli_stmt_close($stmt);
-
-
- function func_mysqli_stmt_bind_result($link, $engine, $bind_type, $sql_type, $bind_value, $offset, $type_hint = null) {
-
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
- printf("[%04d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if (!mysqli_query($link, sprintf("CREATE TABLE test(id INT, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) {
- // don't bail - column type might not be supported by the server, ignore this
- return false;
- }
-
- if (!$stmt = mysqli_stmt_init($link)) {
- printf("[%04d] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)")) {
- printf("[%04d] [%d] %s\n", $offset + 2, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
-
- $id = null;
- if (!mysqli_stmt_bind_param($stmt, "i" . $bind_type, $id, $bind_value)) {
- printf("[%04d] [%d] %s\n", $offset + 3, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_close($stmt);
- return false;
- }
-
- for ($id = 1; $id < 4; $id++) {
- if (!mysqli_stmt_execute($stmt)) {
- printf("[%04d] [%d] %s\n", $offset + 3 + $id, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_close($stmt);
- return false;
- }
- }
- mysqli_stmt_close($stmt);
-
- $stmt = mysqli_stmt_init($link);
-
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test")) {
- printf("[%04d] [%d] %s\n", $offset + 7, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_close($stmt);
- return false;
- }
-
- if (!mysqli_stmt_execute($stmt)) {
- printf("[%04d] [%d] %s\n", $offset + 8, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_close($stmt);
- return false;
- }
-
- $result = mysqli_stmt_result_metadata($stmt);
-
- $bind_res = null;
- if (!mysqli_stmt_bind_result($stmt, $id, $bind_res)) {
- printf("[%04d] [%d] %s\n", $offset + 9, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_close($stmt);
- return false;
- }
- $num = 0;
- $fields = mysqli_fetch_fields($result);
-
- while (mysqli_stmt_fetch($stmt)) {
- if (!gettype($bind_res)=="unicode") {
- if ($bind_res !== $bind_value && (!$type_hint || ($type_hint !== gettype($bind_res)))) {
- printf("[%04d] [%d] Expecting %s/'%s' [type hint = %s], got %s/'%s'\n",
- $offset + 10, $num,
- gettype($bind_value), $bind_value, $type_hint,
- gettype($bind_res), $bind_res);
- mysqli_stmt_close($stmt);
- return false;
- }
- }
- $num++;
- }
-
- if ($num != 3) {
- printf("[%04d] [%d] %s, expecting 3 results, got only %d results\n",
- $offset + 11, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), $num);
- mysqli_stmt_close($stmt);
- return false;
- }
-
- mysqli_stmt_close($stmt);
- return true;
- }
-
-
- function func_mysqli_stmt_bind_make_string($len) {
-
- $ret = '';
- for ($i = 0; $i < $len; $i++)
- $ret .= chr(mt_rand(65, 90));
-
- return $ret;
- }
-
- func_mysqli_stmt_bind_result($link, $engine, "i", "TINYINT", -11, 20);
- func_mysqli_stmt_bind_result($link, $engine, "i", "TINYINT", NULL, 40);
- func_mysqli_stmt_bind_result($link, $engine, "i", "TINYINT UNSIGNED", 1, 60);
- func_mysqli_stmt_bind_result($link, $engine, "i", "TINYINT UNSIGNED", NULL, 80);
-
- func_mysqli_stmt_bind_result($link, $engine, "i", "BOOL", 1, 100);
- func_mysqli_stmt_bind_result($link, $engine, "i", "BOOL", NULL, 120);
- func_mysqli_stmt_bind_result($link, $engine, "i", "BOOLEAN", 0, 140);
- func_mysqli_stmt_bind_result($link, $engine, "i", "BOOLEAN", NULL, 160);
-
- func_mysqli_stmt_bind_result($link, $engine, "i", "SMALLINT", -32768, 180);
- func_mysqli_stmt_bind_result($link, $engine, "i", "SMALLINT", 32767, 200);
- func_mysqli_stmt_bind_result($link, $engine, "i", "SMALLINT", NULL, 220);
- func_mysqli_stmt_bind_result($link, $engine, "i", "SMALLINT UNSIGNED", 65535, 240);
- func_mysqli_stmt_bind_result($link, $engine, "i", "SMALLINT UNSIGNED", NULL, 260);
-
- func_mysqli_stmt_bind_result($link, $engine, "d", "MEDIUMINT", -8388608, 280, "integer");
- func_mysqli_stmt_bind_result($link, $engine, "d", "MEDIUMINT", 8388607, 300, "integer");
- func_mysqli_stmt_bind_result($link, $engine, "d", "MEDIUMINT", NULL, 320);
- func_mysqli_stmt_bind_result($link, $engine, "d", "MEDIUMINT UNSIGNED", 16777215, 340, "integer");
- func_mysqli_stmt_bind_result($link, $engine, "d", "MEDIUMINT UNSIGNED", NULL, 360);
-
- func_mysqli_stmt_bind_result($link, $engine, "i", "INTEGER", (defined("PHP_INT_MAX")) ? max(-1 * PHP_INT_MAX + 1, -2147483648) : 1, 380);
- func_mysqli_stmt_bind_result($link, $engine, "i", "INTEGER", -2147483647, 400, "integer");
- func_mysqli_stmt_bind_result($link, $engine, "i", "INTEGER", (defined("PHP_INT_MAX")) ? min(2147483647, PHP_INT_MAX) : 1, 420);
- func_mysqli_stmt_bind_result($link, $engine, "i", "INTEGER", NULL, 440);
- func_mysqli_stmt_bind_result($link, $engine, "i", "INTEGER UNSIGNED", (defined("PHP_INT_MAX")) ? min(4294967295, 2147483647) : 1, 460);
- func_mysqli_stmt_bind_result($link, $engine, "i", "INTEGER UNSIGNED", 4294967295, 480, (defined("PHP_INT_MAX") && (4294967295 > PHP_INT_MAX)) ? "string" : null);
- func_mysqli_stmt_bind_result($link, $engine, "i", "INTEGER UNSIGNED", NULL, 500);
-
- /* test is broken too: we bind "integer" but value is a float
- func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT", -9223372036854775808, 520);
- func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT UNSIGNED", 18446744073709551615, 560);
- */
- func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT", NULL, 540);
- func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT UNSIGNED", NULL, 580);
- func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT", -1, 1780);
- func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT UNSIGNED", 1, 1800);
- func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT", -1 * PHP_INT_MAX + 1, 1820);
- func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT UNSIGNED", PHP_INT_MAX, 1840);
- func_mysqli_stmt_bind_result($link, $engine, "s", "BIGINT UNSIGNED", "18446744073709551615", 1860);
- func_mysqli_stmt_bind_result($link, $engine, "s", "BIGINT", "-9223372036854775808", 1880);
-
- func_mysqli_stmt_bind_result($link, $engine, "d", "FLOAT", -9223372036854775808 - 1.1, 600);
- func_mysqli_stmt_bind_result($link, $engine, "d", "FLOAT", NULL, 620);
- func_mysqli_stmt_bind_result($link, $engine, "d", "FLOAT UNSIGNED", 18446744073709551615 + 1.1, 640);
- func_mysqli_stmt_bind_result($link, $engine, "d", "FLOAT UNSIGNED ", NULL, 660);
-
- // Yes, we need the temporary variable. The PHP casting will fouls us otherwise.
- $tmp = strval('-99999999.99');
- func_mysqli_stmt_bind_result($link, $engine, "d", "DOUBLE(10,2)", $tmp, 680, "string");
- func_mysqli_stmt_bind_result($link, $engine, "d", "DOUBLE(10,2)", NULL, 700);
- $tmp = strval('99999999.99');
- func_mysqli_stmt_bind_result($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", $tmp , 720, "string");
- func_mysqli_stmt_bind_result($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", NULL, 740);
- $tmp = strval('-99999999.99');
- func_mysqli_stmt_bind_result($link, $engine, "d", "DECIMAL(10,2)", $tmp, 760, "string");
- func_mysqli_stmt_bind_result($link, $engine, "d", "DECIMAL(10,2)", NULL, 780);
- $tmp = strval('99999999.99');
- func_mysqli_stmt_bind_result($link, $engine, "d", "DECIMAL(10,2)", $tmp, 800, "string");
- func_mysqli_stmt_bind_result($link, $engine, "d", "DECIMAL(10,2)", NULL, 820);
-
- // don't care about date() strict TZ warnings...
- func_mysqli_stmt_bind_result($link, $engine, "s", "DATE", @date('Y-m-d'), 840);
- func_mysqli_stmt_bind_result($link, $engine, "s", "DATE NOT NULL", @date('Y-m-d'), 860);
- func_mysqli_stmt_bind_result($link, $engine, "s", "DATE", NULL, 880);
-
- func_mysqli_stmt_bind_result($link, $engine, "s", "DATETIME", @date('Y-m-d H:i:s'), 900);
- func_mysqli_stmt_bind_result($link, $engine, "s", "DATETIME NOT NULL", @date('Y-m-d H:i:s'), 920);
- func_mysqli_stmt_bind_result($link, $engine, "s", "DATETIME", NULL, 940);
-
- func_mysqli_stmt_bind_result($link, $engine, "s", "TIMESTAMP", @date('Y-m-d H:i:s'), 960);
-
- func_mysqli_stmt_bind_result($link, $engine, "s", "TIME", @date('H:i:s'), 980);
- func_mysqli_stmt_bind_result($link, $engine, "s", "TIME NOT NULL", @date('H:i:s'), 1000);
- func_mysqli_stmt_bind_result($link, $engine, "s", "TIME", NULL, 1020);
-
- $tmp = intval(@date('Y'));
- func_mysqli_stmt_bind_result($link, $engine, "s", "YEAR", $tmp, 1040, "integer");
- func_mysqli_stmt_bind_result($link, $engine, "s", "YEAR NOT NULL", $tmp, 1060, "integer");
- func_mysqli_stmt_bind_result($link, $engine, "s", "YEAR", NULL, 1080);
-
- $string255 = func_mysqli_stmt_bind_make_string(255);
- func_mysqli_stmt_bind_result($link, $engine, "s", "CHAR(1)", "a", 1110, 'string');
- func_mysqli_stmt_bind_result($link, $engine, "s", "CHAR(255)", $string255, 1120, 'string');
- func_mysqli_stmt_bind_result($link, $engine, "s", "CHAR(1) NOT NULL", "a", 1140, 'string');
- func_mysqli_stmt_bind_result($link, $engine, "s", "CHAR(1)", NULL, 1160);
-
- $string65k = func_mysqli_stmt_bind_make_string(65535);
- func_mysqli_stmt_bind_result($link, $engine, "s", "VARCHAR(1)", "a", 1180, 'string');
- func_mysqli_stmt_bind_result($link, $engine, "s", "VARCHAR(255)", $string255, 1200, 'string');
- func_mysqli_stmt_bind_result($link, $engine, "s", "VARCHAR(65635)", $string65k, 1220, 'string');
- func_mysqli_stmt_bind_result($link, $engine, "s", "VARCHAR(1) NOT NULL", "a", 1240, 'string');
- func_mysqli_stmt_bind_result($link, $engine, "s", "VARCHAR(1)", NULL, 1260);
-
- func_mysqli_stmt_bind_result($link, $engine, "s", "BINARY(1)", "a", 1280);
- func_mysqli_stmt_bind_result($link, $engine, "s", "BINARY(1)", chr(0), 1300);
- func_mysqli_stmt_bind_result($link, $engine, "s", "BINARY(1) NOT NULL", "b", 1320);
- func_mysqli_stmt_bind_result($link, $engine, "s", "BINARY(1)", NULL, 1340);
-
- func_mysqli_stmt_bind_result($link, $engine, "s", "VARBINARY(1)", "a", 1360);
- func_mysqli_stmt_bind_result($link, $engine, "s", "VARBINARY(1)", chr(0), 1380);
- func_mysqli_stmt_bind_result($link, $engine, "s", "VARBINARY(1) NOT NULL", "b", 1400);
- func_mysqli_stmt_bind_result($link, $engine, "s", "VARBINARY(1)", NULL, 1420);
-
- func_mysqli_stmt_bind_result($link, $engine, "s", "TINYBLOB", "a", 1440);
- func_mysqli_stmt_bind_result($link, $engine, "s", "TINYBLOB", chr(0), 1460);
- func_mysqli_stmt_bind_result($link, $engine, "s", "TINYBLOB NOT NULL", "b", 1480);
- func_mysqli_stmt_bind_result($link, $engine, "s", "TINYBLOB", NULL, 1500);
-
- func_mysqli_stmt_bind_result($link, $engine, "s", "TINYTEXT", "a", 1520, 'string');
- func_mysqli_stmt_bind_result($link, $engine, "s", "TINYTEXT NOT NULL", "a", 1540, 'string');
- func_mysqli_stmt_bind_result($link, $engine, "s", "TINYTEXT", NULL, 1560, 'string');
-
- // Note: you cannot insert any blob values this way. But you can check the API at least partly this way
- // Extra BLOB tests are in mysqli_stmt_send_long()
- func_mysqli_stmt_bind_result($link, $engine, "b", "BLOB", "", 1580);
- func_mysqli_stmt_bind_result($link, $engine, "b", "TEXT", "", 1600, 'string');
- func_mysqli_stmt_bind_result($link, $engine, "b", "MEDIUMBLOB", "", 1620);
- func_mysqli_stmt_bind_result($link, $engine, "b", "MEDIUMTEXT", "", 1640, 'string');
-
- /* Is this one related? http://bugs.php.net/bug.php?id=35759 */
- if (($IS_MYSQLND) || (!$IS_MYSQLND && (ini_get('memory_limit') > 4294967296))) {
- /* NOTE: the MySQL Client Library - not mysqlnd - will allocate
- a hugge max_length(type) = 4GB bind buffer */
- func_mysqli_stmt_bind_result($link, $engine, "b", "LONGBLOB", "", 1660);
- func_mysqli_stmt_bind_result($link, $engine, "b", "LONGTEXT", "", 1680, 'string');
- }
-
- func_mysqli_stmt_bind_result($link, $engine, "s", "ENUM('a', 'b')", "a", 1700, 'string');
- func_mysqli_stmt_bind_result($link, $engine, "s", "ENUM('a', 'b')", NULL, 1720, 'string');
- func_mysqli_stmt_bind_result($link, $engine, "s", "SET('a', 'b')", "a", 1740, 'string');
- func_mysqli_stmt_bind_result($link, $engine, "s", "SET('a', 'b')", NULL, 1760, 'string');
-
- if (mysqli_get_server_version($link) >= 50600)
- func_mysqli_stmt_bind_result($link, $engine, "s", "TIME", "13:31:34.123456", 1770, "13:31:34");
-
- /* Check that the function alias exists. It's a deprecated function,
- but we have not announce the removal so far, therefore we need to check for it */
- if (!is_null($tmp = @mysqli_stmt_bind_result()))
- printf("[3000] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- $stmt = mysqli_stmt_init($link);
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (1000, 'z')"))
- printf("[3001] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = null;
- if (false !== @mysqli_stmt_bind_result($stmt, $id))
- printf("[3002] Bind result should not be allowed");
-
- mysqli_stmt_close($stmt);
-
- mysqli_close($link);
- print "done!";
+ require_once("connect.inc");
+ require('table.inc');
+
+ $stmt = mysqli_stmt_init($link);
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 1"))
+ printf("[002a] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ mysqli_stmt_close($stmt);
+ $stmt = mysqli_stmt_init($link);
+
+ $id = null;
+ $label = null;
+ $foo = null;
+
+ try {
+ mysqli_stmt_bind_result($stmt, $id);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 1"))
+ printf("[004] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (false !== ($tmp = mysqli_stmt_bind_result($stmt, $id)))
+ printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label)))
+ printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (false !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label, $foo)))
+ printf("[007] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_stmt_execute($stmt))
+ printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ while (mysqli_stmt_fetch($stmt)) {
+ var_dump($id);
+ var_dump($label);
+ }
+ mysqli_stmt_close($stmt);
+
+
+ function func_mysqli_stmt_bind_result($link, $engine, $bind_type, $sql_type, $bind_value, $offset, $type_hint = null) {
+
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
+ printf("[%04d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if (!mysqli_query($link, sprintf("CREATE TABLE test(id INT, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) {
+ // don't bail - column type might not be supported by the server, ignore this
+ return false;
+ }
+
+ if (!$stmt = mysqli_stmt_init($link)) {
+ printf("[%04d] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)")) {
+ printf("[%04d] [%d] %s\n", $offset + 2, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+
+ $id = null;
+ if (!mysqli_stmt_bind_param($stmt, "i" . $bind_type, $id, $bind_value)) {
+ printf("[%04d] [%d] %s\n", $offset + 3, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_stmt_close($stmt);
+ return false;
+ }
+
+ for ($id = 1; $id < 4; $id++) {
+ if (!mysqli_stmt_execute($stmt)) {
+ printf("[%04d] [%d] %s\n", $offset + 3 + $id, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_stmt_close($stmt);
+ return false;
+ }
+ }
+ mysqli_stmt_close($stmt);
+
+ $stmt = mysqli_stmt_init($link);
+
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test")) {
+ printf("[%04d] [%d] %s\n", $offset + 7, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_stmt_close($stmt);
+ return false;
+ }
+
+ if (!mysqli_stmt_execute($stmt)) {
+ printf("[%04d] [%d] %s\n", $offset + 8, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_stmt_close($stmt);
+ return false;
+ }
+
+ $result = mysqli_stmt_result_metadata($stmt);
+
+ $bind_res = null;
+ if (!mysqli_stmt_bind_result($stmt, $id, $bind_res)) {
+ printf("[%04d] [%d] %s\n", $offset + 9, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_stmt_close($stmt);
+ return false;
+ }
+ $num = 0;
+ $fields = mysqli_fetch_fields($result);
+
+ while (mysqli_stmt_fetch($stmt)) {
+ if (!gettype($bind_res)=="unicode") {
+ if ($bind_res !== $bind_value && (!$type_hint || ($type_hint !== gettype($bind_res)))) {
+ printf("[%04d] [%d] Expecting %s/'%s' [type hint = %s], got %s/'%s'\n",
+ $offset + 10, $num,
+ gettype($bind_value), $bind_value, $type_hint,
+ gettype($bind_res), $bind_res);
+ mysqli_stmt_close($stmt);
+ return false;
+ }
+ }
+ $num++;
+ }
+
+ if ($num != 3) {
+ printf("[%04d] [%d] %s, expecting 3 results, got only %d results\n",
+ $offset + 11, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), $num);
+ mysqli_stmt_close($stmt);
+ return false;
+ }
+
+ mysqli_stmt_close($stmt);
+ return true;
+ }
+
+
+ function func_mysqli_stmt_bind_make_string($len) {
+
+ $ret = '';
+ for ($i = 0; $i < $len; $i++)
+ $ret .= chr(mt_rand(65, 90));
+
+ return $ret;
+ }
+
+ func_mysqli_stmt_bind_result($link, $engine, "i", "TINYINT", -11, 20);
+ func_mysqli_stmt_bind_result($link, $engine, "i", "TINYINT", NULL, 40);
+ func_mysqli_stmt_bind_result($link, $engine, "i", "TINYINT UNSIGNED", 1, 60);
+ func_mysqli_stmt_bind_result($link, $engine, "i", "TINYINT UNSIGNED", NULL, 80);
+
+ func_mysqli_stmt_bind_result($link, $engine, "i", "BOOL", 1, 100);
+ func_mysqli_stmt_bind_result($link, $engine, "i", "BOOL", NULL, 120);
+ func_mysqli_stmt_bind_result($link, $engine, "i", "BOOLEAN", 0, 140);
+ func_mysqli_stmt_bind_result($link, $engine, "i", "BOOLEAN", NULL, 160);
+
+ func_mysqli_stmt_bind_result($link, $engine, "i", "SMALLINT", -32768, 180);
+ func_mysqli_stmt_bind_result($link, $engine, "i", "SMALLINT", 32767, 200);
+ func_mysqli_stmt_bind_result($link, $engine, "i", "SMALLINT", NULL, 220);
+ func_mysqli_stmt_bind_result($link, $engine, "i", "SMALLINT UNSIGNED", 65535, 240);
+ func_mysqli_stmt_bind_result($link, $engine, "i", "SMALLINT UNSIGNED", NULL, 260);
+
+ func_mysqli_stmt_bind_result($link, $engine, "d", "MEDIUMINT", -8388608, 280, "integer");
+ func_mysqli_stmt_bind_result($link, $engine, "d", "MEDIUMINT", 8388607, 300, "integer");
+ func_mysqli_stmt_bind_result($link, $engine, "d", "MEDIUMINT", NULL, 320);
+ func_mysqli_stmt_bind_result($link, $engine, "d", "MEDIUMINT UNSIGNED", 16777215, 340, "integer");
+ func_mysqli_stmt_bind_result($link, $engine, "d", "MEDIUMINT UNSIGNED", NULL, 360);
+
+ func_mysqli_stmt_bind_result($link, $engine, "i", "INTEGER", (defined("PHP_INT_MAX")) ? max(-1 * PHP_INT_MAX + 1, -2147483648) : 1, 380);
+ func_mysqli_stmt_bind_result($link, $engine, "i", "INTEGER", -2147483647, 400, "integer");
+ func_mysqli_stmt_bind_result($link, $engine, "i", "INTEGER", (defined("PHP_INT_MAX")) ? min(2147483647, PHP_INT_MAX) : 1, 420);
+ func_mysqli_stmt_bind_result($link, $engine, "i", "INTEGER", NULL, 440);
+ func_mysqli_stmt_bind_result($link, $engine, "i", "INTEGER UNSIGNED", (defined("PHP_INT_MAX")) ? min(4294967295, 2147483647) : 1, 460);
+ func_mysqli_stmt_bind_result($link, $engine, "i", "INTEGER UNSIGNED", 4294967295, 480, (defined("PHP_INT_MAX") && (4294967295 > PHP_INT_MAX)) ? "string" : null);
+ func_mysqli_stmt_bind_result($link, $engine, "i", "INTEGER UNSIGNED", NULL, 500);
+
+ /* test is broken too: we bind "integer" but value is a float
+ func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT", -9223372036854775808, 520);
+ func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT UNSIGNED", 18446744073709551615, 560);
+ */
+ func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT", NULL, 540);
+ func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT UNSIGNED", NULL, 580);
+ func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT", -1, 1780);
+ func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT UNSIGNED", 1, 1800);
+ func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT", -1 * PHP_INT_MAX + 1, 1820);
+ func_mysqli_stmt_bind_result($link, $engine, "i", "BIGINT UNSIGNED", PHP_INT_MAX, 1840);
+ func_mysqli_stmt_bind_result($link, $engine, "s", "BIGINT UNSIGNED", "18446744073709551615", 1860);
+ func_mysqli_stmt_bind_result($link, $engine, "s", "BIGINT", "-9223372036854775808", 1880);
+
+ func_mysqli_stmt_bind_result($link, $engine, "d", "FLOAT", -9223372036854775808 - 1.1, 600);
+ func_mysqli_stmt_bind_result($link, $engine, "d", "FLOAT", NULL, 620);
+ func_mysqli_stmt_bind_result($link, $engine, "d", "FLOAT UNSIGNED", 18446744073709551615 + 1.1, 640);
+ func_mysqli_stmt_bind_result($link, $engine, "d", "FLOAT UNSIGNED ", NULL, 660);
+
+ // Yes, we need the temporary variable. The PHP casting will fouls us otherwise.
+ $tmp = strval('-99999999.99');
+ func_mysqli_stmt_bind_result($link, $engine, "d", "DOUBLE(10,2)", $tmp, 680, "string");
+ func_mysqli_stmt_bind_result($link, $engine, "d", "DOUBLE(10,2)", NULL, 700);
+ $tmp = strval('99999999.99');
+ func_mysqli_stmt_bind_result($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", $tmp , 720, "string");
+ func_mysqli_stmt_bind_result($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", NULL, 740);
+ $tmp = strval('-99999999.99');
+ func_mysqli_stmt_bind_result($link, $engine, "d", "DECIMAL(10,2)", $tmp, 760, "string");
+ func_mysqli_stmt_bind_result($link, $engine, "d", "DECIMAL(10,2)", NULL, 780);
+ $tmp = strval('99999999.99');
+ func_mysqli_stmt_bind_result($link, $engine, "d", "DECIMAL(10,2)", $tmp, 800, "string");
+ func_mysqli_stmt_bind_result($link, $engine, "d", "DECIMAL(10,2)", NULL, 820);
+
+ // don't care about date() strict TZ warnings...
+ func_mysqli_stmt_bind_result($link, $engine, "s", "DATE", @date('Y-m-d'), 840);
+ func_mysqli_stmt_bind_result($link, $engine, "s", "DATE NOT NULL", @date('Y-m-d'), 860);
+ func_mysqli_stmt_bind_result($link, $engine, "s", "DATE", NULL, 880);
+
+ func_mysqli_stmt_bind_result($link, $engine, "s", "DATETIME", @date('Y-m-d H:i:s'), 900);
+ func_mysqli_stmt_bind_result($link, $engine, "s", "DATETIME NOT NULL", @date('Y-m-d H:i:s'), 920);
+ func_mysqli_stmt_bind_result($link, $engine, "s", "DATETIME", NULL, 940);
+
+ func_mysqli_stmt_bind_result($link, $engine, "s", "TIMESTAMP", @date('Y-m-d H:i:s'), 960);
+
+ func_mysqli_stmt_bind_result($link, $engine, "s", "TIME", @date('H:i:s'), 980);
+ func_mysqli_stmt_bind_result($link, $engine, "s", "TIME NOT NULL", @date('H:i:s'), 1000);
+ func_mysqli_stmt_bind_result($link, $engine, "s", "TIME", NULL, 1020);
+
+ $tmp = intval(@date('Y'));
+ func_mysqli_stmt_bind_result($link, $engine, "s", "YEAR", $tmp, 1040, "integer");
+ func_mysqli_stmt_bind_result($link, $engine, "s", "YEAR NOT NULL", $tmp, 1060, "integer");
+ func_mysqli_stmt_bind_result($link, $engine, "s", "YEAR", NULL, 1080);
+
+ $string255 = func_mysqli_stmt_bind_make_string(255);
+ func_mysqli_stmt_bind_result($link, $engine, "s", "CHAR(1)", "a", 1110, 'string');
+ func_mysqli_stmt_bind_result($link, $engine, "s", "CHAR(255)", $string255, 1120, 'string');
+ func_mysqli_stmt_bind_result($link, $engine, "s", "CHAR(1) NOT NULL", "a", 1140, 'string');
+ func_mysqli_stmt_bind_result($link, $engine, "s", "CHAR(1)", NULL, 1160);
+
+ $string65k = func_mysqli_stmt_bind_make_string(65535);
+ func_mysqli_stmt_bind_result($link, $engine, "s", "VARCHAR(1)", "a", 1180, 'string');
+ func_mysqli_stmt_bind_result($link, $engine, "s", "VARCHAR(255)", $string255, 1200, 'string');
+ func_mysqli_stmt_bind_result($link, $engine, "s", "VARCHAR(65635)", $string65k, 1220, 'string');
+ func_mysqli_stmt_bind_result($link, $engine, "s", "VARCHAR(1) NOT NULL", "a", 1240, 'string');
+ func_mysqli_stmt_bind_result($link, $engine, "s", "VARCHAR(1)", NULL, 1260);
+
+ func_mysqli_stmt_bind_result($link, $engine, "s", "BINARY(1)", "a", 1280);
+ func_mysqli_stmt_bind_result($link, $engine, "s", "BINARY(1)", chr(0), 1300);
+ func_mysqli_stmt_bind_result($link, $engine, "s", "BINARY(1) NOT NULL", "b", 1320);
+ func_mysqli_stmt_bind_result($link, $engine, "s", "BINARY(1)", NULL, 1340);
+
+ func_mysqli_stmt_bind_result($link, $engine, "s", "VARBINARY(1)", "a", 1360);
+ func_mysqli_stmt_bind_result($link, $engine, "s", "VARBINARY(1)", chr(0), 1380);
+ func_mysqli_stmt_bind_result($link, $engine, "s", "VARBINARY(1) NOT NULL", "b", 1400);
+ func_mysqli_stmt_bind_result($link, $engine, "s", "VARBINARY(1)", NULL, 1420);
+
+ func_mysqli_stmt_bind_result($link, $engine, "s", "TINYBLOB", "a", 1440);
+ func_mysqli_stmt_bind_result($link, $engine, "s", "TINYBLOB", chr(0), 1460);
+ func_mysqli_stmt_bind_result($link, $engine, "s", "TINYBLOB NOT NULL", "b", 1480);
+ func_mysqli_stmt_bind_result($link, $engine, "s", "TINYBLOB", NULL, 1500);
+
+ func_mysqli_stmt_bind_result($link, $engine, "s", "TINYTEXT", "a", 1520, 'string');
+ func_mysqli_stmt_bind_result($link, $engine, "s", "TINYTEXT NOT NULL", "a", 1540, 'string');
+ func_mysqli_stmt_bind_result($link, $engine, "s", "TINYTEXT", NULL, 1560, 'string');
+
+ // Note: you cannot insert any blob values this way. But you can check the API at least partly this way
+ // Extra BLOB tests are in mysqli_stmt_send_long()
+ func_mysqli_stmt_bind_result($link, $engine, "b", "BLOB", "", 1580);
+ func_mysqli_stmt_bind_result($link, $engine, "b", "TEXT", "", 1600, 'string');
+ func_mysqli_stmt_bind_result($link, $engine, "b", "MEDIUMBLOB", "", 1620);
+ func_mysqli_stmt_bind_result($link, $engine, "b", "MEDIUMTEXT", "", 1640, 'string');
+
+ /* Is this one related? http://bugs.php.net/bug.php?id=35759 */
+ if (($IS_MYSQLND) || (!$IS_MYSQLND && (ini_get('memory_limit') > 4294967296))) {
+ /* NOTE: the MySQL Client Library - not mysqlnd - will allocate
+ a hugge max_length(type) = 4GB bind buffer */
+ func_mysqli_stmt_bind_result($link, $engine, "b", "LONGBLOB", "", 1660);
+ func_mysqli_stmt_bind_result($link, $engine, "b", "LONGTEXT", "", 1680, 'string');
+ }
+
+ func_mysqli_stmt_bind_result($link, $engine, "s", "ENUM('a', 'b')", "a", 1700, 'string');
+ func_mysqli_stmt_bind_result($link, $engine, "s", "ENUM('a', 'b')", NULL, 1720, 'string');
+ func_mysqli_stmt_bind_result($link, $engine, "s", "SET('a', 'b')", "a", 1740, 'string');
+ func_mysqli_stmt_bind_result($link, $engine, "s", "SET('a', 'b')", NULL, 1760, 'string');
+
+ if (mysqli_get_server_version($link) >= 50600)
+ func_mysqli_stmt_bind_result($link, $engine, "s", "TIME", "13:31:34.123456", 1770, "13:31:34");
+
+ $stmt = mysqli_stmt_init($link);
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (1000, 'z')"))
+ printf("[3001] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = null;
+ if (false !== @mysqli_stmt_bind_result($stmt, $id))
+ printf("[3002] Bind result should not be allowed");
+
+ mysqli_stmt_close($stmt);
+
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
--EXPECTF--
-Warning: mysqli_stmt_bind_result() expects at least 2 parameters, 1 given in %s on line %d
-
-Warning: mysqli_stmt_bind_result(): invalid object or resource mysqli_stmt
- in %s on line %d
+mysqli_stmt object is not fully initialized
Warning: mysqli_stmt_bind_result(): Number of bind variables doesn't match number of fields in prepared statement in %s on line %d
diff --git a/ext/mysqli/tests/mysqli_stmt_bind_result_bit.phpt b/ext/mysqli/tests/mysqli_stmt_bind_result_bit.phpt
index 734d691c28..39a2f503f8 100644
--- a/ext/mysqli/tests/mysqli_stmt_bind_result_bit.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_bind_result_bit.phpt
@@ -8,148 +8,148 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
-
- function dec32bin($dec, $bits) {
-
- $maxval = pow(2, $bits);
- $bin = '';
- for ($bitval = $maxval; $bitval >= 1; $bitval = $bitval / 2) {
- if (($dec / $bitval) >= 1) {
- $bin .= '1';
- $dec -= $bitval;
- } else {
- $bin .= '0';
- }
- }
- return $bin;
- }
-
- if (!$link_ins = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
-
- if (!$link_sel = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
-
- for ($bits = 1; $bits <= 46; $bits++) {
-
- if (1 == $bits)
- $max_value = 1;
- else
- $max_value = pow(2, $bits) - 1;
-
- if (!mysqli_query($link_ins, "DROP TABLE IF EXISTS test")) {
- printf("[003 - %d] [%d] %s\n", $bits, mysqli_errno($link_ins), mysqli_error($link_ins));
- }
-
- if (!mysqli_query($link_ins, sprintf("CREATE TABLE test(id BIGINT, bit_value BIT(%d) NOT NULL, bit_null BIT(%d) DEFAULT NULL) ENGINE = %s", $bits, $bits, $engine))) {
- // don't bail - column type might not be supported by the server, ignore this
- continue;
- }
- if (!$stmt_ins = mysqli_stmt_init($link_ins)) {
- printf("[004 - %d] [%d] %s\n", $bits, mysqli_errno($link_ins), mysqli_error($link_ins));
- continue;
- }
-
- if (!mysqli_stmt_prepare($stmt_ins, "INSERT INTO test(id, bit_value) VALUES (?, ?)")) {
- printf("[005 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt_ins), mysqli_stmt_error($stmt_ins));
- mysqli_stmt_close($stmt_ins);
- continue;
- }
-
- if (!($stmt_sel = mysqli_stmt_init($link_sel))) {
- printf("[006 - %d] [%d] %s\n", $bits, mysqli_errno($link_sel), mysqli_error($link_sel));
- mysqli_stmt_close($stmt_ins);
- continue;
- }
-
- $tests = 0;
- $rand_max = mt_getrandmax();
- while ($tests < 10) {
-
- $tests++;
- if (1 == $tests)
- $value = 0;
- else if (2 == $tests)
- $value = $max_value;
- else {
- if ($max_value > $rand_max) {
- $max_loops = floor($max_value/$rand_max);
- $num_loops = mt_rand(1, $max_loops);
- $value = 0;
- for ($i = 0; $i < $num_loops; $i++)
- $value += mt_rand(0, $rand_max);
- } else {
- $value = mt_rand(0, $max_value);
- }
- }
-
- $bin = ($bits < 32) ? decbin($value) : dec32bin($value, $bits);
- for ($i = 0; ($i < strlen($bin)) && ($bin[$i] == '0'); $i++)
- ;
- $bin2 = substr($bin, $i, strlen($bin));
-
- if (!mysqli_stmt_bind_param($stmt_ins, "dd", $value, $value)) {
- printf("[007 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt_ins), mysqli_stmt_error($stmt_ins));
- mysqli_stmt_close($stmt_ins);
- continue;
- }
- if (!mysqli_stmt_execute($stmt_ins)) {
- printf("[008 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt_ins), mysqli_stmt_error($stmt_ins));
- break;
- }
- $sql = sprintf("SELECT id, BIN(bit_value) AS _bin, bit_value, bit_value + 0 AS _bit_value0, bit_null FROM test WHERE id = %s", $value);
- if ((!mysqli_stmt_prepare($stmt_sel, $sql)) ||
- (!mysqli_stmt_execute($stmt_sel))) {
- printf("[009 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt_sel), mysqli_stmt_error($stmt_sel));
- break;
- }
-
- $row = array('id' => -1, '_bin' => - 1, 'bit_value' => -1, '_bit_value0' => -1, 'bit_null' => -1);
- if (!mysqli_stmt_bind_result($stmt_sel, $row['id'], $row['_bin'], $row['bit_value'], $row['_bit_value0'], $row['bit_null'])) {
- printf("[010 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt_sel), mysqli_stmt_error($stmt_sel));
- break;
- }
-
- if (!($ret = mysqli_stmt_fetch($stmt_sel))) {
- printf("[011 - %d] mysqli_stmt_fetch() has failed for %d bits - ret = %s/%s, [%d] %s, [%d] %s\n",
- $bits, $bits,
- gettype($ret), $ret,
- mysqli_stmt_errno($stmt_sel), mysqli_stmt_error($stmt_sel),
- mysqli_errno($link_sel), mysqli_errno($link_sel)
- );
- break;
- }
-
- if (($value != $row['id']) || (($bin != $row['_bin']) && ($bin2 != $row['_bin']))) {
- debug_zval_dump($row);
- printf("[012 - %d] Insert of %s in BIT(%d) column might have failed. id = %s, bin = %s (%s/%s)\n",
- $bits, $value, $bits, $row['id'], $row['_bin'], $bin, $bin2);
- break;
- }
- if ($value != $row['bit_value']) {
- debug_zval_dump($row);
- printf("[013 - %d] Expecting %s got %s\n", $bits, $value, $row['bit_value']);
- break;
- }
-
- if (null !== $row['bit_null']) {
- debug_zval_dump($row);
- printf("[014 - %d] Expecting null got %s/%s\n", $bits, gettype($row['bit_value']), $row['bit_value']);
- break;
- }
-
- }
-
- mysqli_stmt_close($stmt_ins);
- mysqli_stmt_close($stmt_sel);
- }
-
- mysqli_close($link_ins);
- mysqli_close($link_sel);
- print "done!";
+ require_once("connect.inc");
+
+ function dec32bin($dec, $bits) {
+
+ $maxval = pow(2, $bits);
+ $bin = '';
+ for ($bitval = $maxval; $bitval >= 1; $bitval = $bitval / 2) {
+ if (($dec / $bitval) >= 1) {
+ $bin .= '1';
+ $dec -= $bitval;
+ } else {
+ $bin .= '0';
+ }
+ }
+ return $bin;
+ }
+
+ if (!$link_ins = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+
+ if (!$link_sel = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+
+ for ($bits = 1; $bits <= 46; $bits++) {
+
+ if (1 == $bits)
+ $max_value = 1;
+ else
+ $max_value = pow(2, $bits) - 1;
+
+ if (!mysqli_query($link_ins, "DROP TABLE IF EXISTS test")) {
+ printf("[003 - %d] [%d] %s\n", $bits, mysqli_errno($link_ins), mysqli_error($link_ins));
+ }
+
+ if (!mysqli_query($link_ins, sprintf("CREATE TABLE test(id BIGINT, bit_value BIT(%d) NOT NULL, bit_null BIT(%d) DEFAULT NULL) ENGINE = %s", $bits, $bits, $engine))) {
+ // don't bail - column type might not be supported by the server, ignore this
+ continue;
+ }
+ if (!$stmt_ins = mysqli_stmt_init($link_ins)) {
+ printf("[004 - %d] [%d] %s\n", $bits, mysqli_errno($link_ins), mysqli_error($link_ins));
+ continue;
+ }
+
+ if (!mysqli_stmt_prepare($stmt_ins, "INSERT INTO test(id, bit_value) VALUES (?, ?)")) {
+ printf("[005 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt_ins), mysqli_stmt_error($stmt_ins));
+ mysqli_stmt_close($stmt_ins);
+ continue;
+ }
+
+ if (!($stmt_sel = mysqli_stmt_init($link_sel))) {
+ printf("[006 - %d] [%d] %s\n", $bits, mysqli_errno($link_sel), mysqli_error($link_sel));
+ mysqli_stmt_close($stmt_ins);
+ continue;
+ }
+
+ $tests = 0;
+ $rand_max = mt_getrandmax();
+ while ($tests < 10) {
+
+ $tests++;
+ if (1 == $tests)
+ $value = 0;
+ else if (2 == $tests)
+ $value = $max_value;
+ else {
+ if ($max_value > $rand_max) {
+ $max_loops = floor($max_value/$rand_max);
+ $num_loops = mt_rand(1, $max_loops);
+ $value = 0;
+ for ($i = 0; $i < $num_loops; $i++)
+ $value += mt_rand(0, $rand_max);
+ } else {
+ $value = mt_rand(0, $max_value);
+ }
+ }
+
+ $bin = ($bits < 32) ? decbin($value) : dec32bin($value, $bits);
+ for ($i = 0; ($i < strlen($bin)) && ($bin[$i] == '0'); $i++)
+ ;
+ $bin2 = substr($bin, $i, strlen($bin));
+
+ if (!mysqli_stmt_bind_param($stmt_ins, "dd", $value, $value)) {
+ printf("[007 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt_ins), mysqli_stmt_error($stmt_ins));
+ mysqli_stmt_close($stmt_ins);
+ continue;
+ }
+ if (!mysqli_stmt_execute($stmt_ins)) {
+ printf("[008 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt_ins), mysqli_stmt_error($stmt_ins));
+ break;
+ }
+ $sql = sprintf("SELECT id, BIN(bit_value) AS _bin, bit_value, bit_value + 0 AS _bit_value0, bit_null FROM test WHERE id = %s", $value);
+ if ((!mysqli_stmt_prepare($stmt_sel, $sql)) ||
+ (!mysqli_stmt_execute($stmt_sel))) {
+ printf("[009 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt_sel), mysqli_stmt_error($stmt_sel));
+ break;
+ }
+
+ $row = array('id' => -1, '_bin' => - 1, 'bit_value' => -1, '_bit_value0' => -1, 'bit_null' => -1);
+ if (!mysqli_stmt_bind_result($stmt_sel, $row['id'], $row['_bin'], $row['bit_value'], $row['_bit_value0'], $row['bit_null'])) {
+ printf("[010 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt_sel), mysqli_stmt_error($stmt_sel));
+ break;
+ }
+
+ if (!($ret = mysqli_stmt_fetch($stmt_sel))) {
+ printf("[011 - %d] mysqli_stmt_fetch() has failed for %d bits - ret = %s/%s, [%d] %s, [%d] %s\n",
+ $bits, $bits,
+ gettype($ret), $ret,
+ mysqli_stmt_errno($stmt_sel), mysqli_stmt_error($stmt_sel),
+ mysqli_errno($link_sel), mysqli_errno($link_sel)
+ );
+ break;
+ }
+
+ if (($value != $row['id']) || (($bin != $row['_bin']) && ($bin2 != $row['_bin']))) {
+ debug_zval_dump($row);
+ printf("[012 - %d] Insert of %s in BIT(%d) column might have failed. id = %s, bin = %s (%s/%s)\n",
+ $bits, $value, $bits, $row['id'], $row['_bin'], $bin, $bin2);
+ break;
+ }
+ if ($value != $row['bit_value']) {
+ debug_zval_dump($row);
+ printf("[013 - %d] Expecting %s got %s\n", $bits, $value, $row['bit_value']);
+ break;
+ }
+
+ if (null !== $row['bit_null']) {
+ debug_zval_dump($row);
+ printf("[014 - %d] Expecting null got %s/%s\n", $bits, gettype($row['bit_value']), $row['bit_value']);
+ break;
+ }
+
+ }
+
+ mysqli_stmt_close($stmt_ins);
+ mysqli_stmt_close($stmt_sel);
+ }
+
+ mysqli_close($link_ins);
+ mysqli_close($link_sel);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_bind_result_format.phpt b/ext/mysqli/tests/mysqli_stmt_bind_result_format.phpt
index 8cff6b1496..62a3e499ae 100644
--- a/ext/mysqli/tests/mysqli_stmt_bind_result_format.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_bind_result_format.phpt
@@ -10,204 +10,204 @@ require_once('skipifconnectfailure.inc');
memory_limit=83886080
--FILE--
<?php
- require_once("connect.inc");
-
- function create_table($link, $column, $min, $max, $engine, $offset) {
-
- if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
- printf("[%03d] Cannot drop table test, [%d] %s\n",
- $offset,
- mysqli_errno($link), mysqli_error($link));
- return array();
- }
-
- $sql = sprintf("CREATE TABLE test(id INT AUTO_INCREMENT PRIMARY KEY, col1 %s) ENGINE=%s",
- $column, $engine);
- if (!mysqli_query($link, $sql)) {
- printf("[%03d] Cannot create table test, [%d] %s\n",
- $offset + 1,
- mysqli_errno($link), mysqli_error($link));
- return array();
- }
-
- $values = array();
- for ($i = 1; $i <= 100; $i++) {
- $col1 = mt_rand($min, $max);
- $values[$i] = $col1;
- $sql = sprintf("INSERT INTO test(id, col1) VALUES (%d, %f)",
- $i, $col1);
- if (!mysqli_query($link, $sql)) {
- printf("[%03d] Cannot insert data, [%d] %s\n",
- $offset + 2,
- mysqli_errno($link), mysqli_error($link));
- return array();
- }
- }
-
- return $values;
- }
-
- function test_format($link, $format, $from, $order_by, $expected, $offset) {
-
- if (!$stmt = mysqli_stmt_init($link)) {
- printf("[%03d] Cannot create PS, [%d] %s\n",
- $offset,
- mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if ($order_by)
- $sql = sprintf('SELECT %s AS _format FROM %s ORDER BY %s', $format, $from, $order_by);
- else
- $sql = sprintf('SELECT %s AS _format FROM %s', $format, $from);
-
- if (!mysqli_stmt_prepare($stmt, $sql)) {
- printf("[%03d] Cannot prepare PS, [%d] %s\n",
- $offset + 1,
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
-
- if (!mysqli_stmt_execute($stmt)) {
- printf("[%03d] Cannot execute PS, [%d] %s\n",
- $offset + 2,
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
-
- if (!mysqli_stmt_store_result($stmt)) {
- printf("[%03d] Cannot store result set, [%d] %s\n",
- $offset + 3,
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
-
- if (!is_array($expected)) {
-
- $result = null;
- if (!mysqli_stmt_bind_result($stmt, $result)) {
- printf("[%03d] Cannot bind result, [%d] %s\n",
- $offset + 4,
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
-
- if (!mysqli_stmt_fetch($stmt)) {
- printf("[%03d] Cannot fetch result,, [%d] %s\n",
- $offset + 5,
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
-
- if ($result !== $expected) {
- printf("[%03d] Expecting %s/%s got %s/%s with %s - %s.\n",
- $offset + 6,
- gettype($expected), $expected,
- gettype($result), $result,
- $format, $sql);
- }
-
- } else {
-
- $order_by_col = $result = null;
- if (!mysqli_stmt_bind_result($stmt, $order_by_col, $result)) {
- printf("[%03d] Cannot bind result, [%d] %s\n",
- $offset + 7,
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
-
- foreach ($expected as $k => $v) {
- if (!mysqli_stmt_fetch($stmt)) {
- break;
- }
- if ($result !== $v) {
- printf("[%03d] Row %d - expecting %s/%s got %s/%s [%s] with %s - %s.\n",
- $offset + 8,
- $k,
- gettype($v), $v,
- gettype($result), $result,
- $order_by_col,
- $format, $sql);
- }
- }
-
- }
-
- mysqli_stmt_free_result($stmt);
- mysqli_stmt_close($stmt);
-
- return true;
- }
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect - [%d] %s\n",
- mysqli_connect_errno(),
- mysqli_connect_error());
-
- /* select from dual - pseudo table */
- test_format($link, 'FORMAT(1.01, 0)', 'DUAL', null, '1', 10);
- test_format($link, 'FORMAT(1.23, 1)', 'DUAL', null, '1.2', 20);
- test_format($link, 'FORMAT(1.23, 2)', 'DUAL', null, '1.23', 30);
- test_format($link, 'FORMAT(1234.567, 3)', 'DUAL', null, '1,234.567', 40);
- /* no typo! */
- test_format($link, 'FORMAT(1234.567, 4)', 'DUAL', null, '1,234.5670', 50);
-
- mysqli_close($link);
- require_once('table.inc');
-
- /* select from existing table */
- test_format($link, 'FORMAT(id, 0)', 'test', null, '1', 60);
- test_format($link, 'FORMAT(id + 0.1, 1)', 'test', null, '1.1', 70);
- test_format($link, 'FORMAT(id + 0.01, 2)', 'test', null, '1.01', 80);
-
- /* create new table and select from it */
- $expected = create_table($link, 'FLOAT', -10000, 10000, $engine, 90);
- foreach ($expected as $k => $v)
- $expected[$k] = number_format(round($v), 0, '.', ',');
- test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 100);
-
- $expected = create_table($link, 'FLOAT UNSIGNED', 0, 10000, $engine, 110);
- foreach ($expected as $k => $v)
- $expected[$k] = number_format(round($v), 0, '.', ',');
- test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 120);
-
- $expected = create_table($link, 'TINYINT', -128, 127, $engine, 130);
- foreach ($expected as $k => $v)
- $expected[$k] = number_format(round($v), 0, '.', ',');
- test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 140);
-
- $expected = create_table($link, 'SMALLINT UNSIGNED', 0, 65535, $engine, 150);
- foreach ($expected as $k => $v)
- $expected[$k] = number_format(round($v), 0, '.', ',');
- test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 160);
-
- $expected = create_table($link, 'MEDIUMINT', 0, 8388607, $engine, 170);
- foreach ($expected as $k => $v)
- $expected[$k] = number_format(round($v), 0, '.', ',');
- test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 180);
-
- $expected = create_table($link, 'INT UNSIGNED', 0, 1000, $engine, 190);
- foreach ($expected as $k => $v)
- $expected[$k] = number_format(round($v), 0, '.', ',');
- test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 200);
-
- $expected = create_table($link, 'BIGINT', -1000, 1000, $engine, 210);
- foreach ($expected as $k => $v)
- $expected[$k] = number_format(round($v), 0, '.', ',');
- test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 220);
-
- $expected = create_table($link, 'DECIMAL(5,0)', -1000, 1000, $engine, 230);
- foreach ($expected as $k => $v)
- $expected[$k] = number_format(round($v), 0, '.', ',');
- test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 240);
-
- // http://bugs.php.net/bug.php?id=42378
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
- printf("[300] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
-
- if (mysqli_query($link, "CREATE TABLE `test` (
+ require_once("connect.inc");
+
+ function create_table($link, $column, $min, $max, $engine, $offset) {
+
+ if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
+ printf("[%03d] Cannot drop table test, [%d] %s\n",
+ $offset,
+ mysqli_errno($link), mysqli_error($link));
+ return array();
+ }
+
+ $sql = sprintf("CREATE TABLE test(id INT AUTO_INCREMENT PRIMARY KEY, col1 %s) ENGINE=%s",
+ $column, $engine);
+ if (!mysqli_query($link, $sql)) {
+ printf("[%03d] Cannot create table test, [%d] %s\n",
+ $offset + 1,
+ mysqli_errno($link), mysqli_error($link));
+ return array();
+ }
+
+ $values = array();
+ for ($i = 1; $i <= 100; $i++) {
+ $col1 = mt_rand($min, $max);
+ $values[$i] = $col1;
+ $sql = sprintf("INSERT INTO test(id, col1) VALUES (%d, %f)",
+ $i, $col1);
+ if (!mysqli_query($link, $sql)) {
+ printf("[%03d] Cannot insert data, [%d] %s\n",
+ $offset + 2,
+ mysqli_errno($link), mysqli_error($link));
+ return array();
+ }
+ }
+
+ return $values;
+ }
+
+ function test_format($link, $format, $from, $order_by, $expected, $offset) {
+
+ if (!$stmt = mysqli_stmt_init($link)) {
+ printf("[%03d] Cannot create PS, [%d] %s\n",
+ $offset,
+ mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if ($order_by)
+ $sql = sprintf('SELECT %s AS _format FROM %s ORDER BY %s', $format, $from, $order_by);
+ else
+ $sql = sprintf('SELECT %s AS _format FROM %s', $format, $from);
+
+ if (!mysqli_stmt_prepare($stmt, $sql)) {
+ printf("[%03d] Cannot prepare PS, [%d] %s\n",
+ $offset + 1,
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+
+ if (!mysqli_stmt_execute($stmt)) {
+ printf("[%03d] Cannot execute PS, [%d] %s\n",
+ $offset + 2,
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+
+ if (!mysqli_stmt_store_result($stmt)) {
+ printf("[%03d] Cannot store result set, [%d] %s\n",
+ $offset + 3,
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+
+ if (!is_array($expected)) {
+
+ $result = null;
+ if (!mysqli_stmt_bind_result($stmt, $result)) {
+ printf("[%03d] Cannot bind result, [%d] %s\n",
+ $offset + 4,
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+
+ if (!mysqli_stmt_fetch($stmt)) {
+ printf("[%03d] Cannot fetch result,, [%d] %s\n",
+ $offset + 5,
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+
+ if ($result !== $expected) {
+ printf("[%03d] Expecting %s/%s got %s/%s with %s - %s.\n",
+ $offset + 6,
+ gettype($expected), $expected,
+ gettype($result), $result,
+ $format, $sql);
+ }
+
+ } else {
+
+ $order_by_col = $result = null;
+ if (!mysqli_stmt_bind_result($stmt, $order_by_col, $result)) {
+ printf("[%03d] Cannot bind result, [%d] %s\n",
+ $offset + 7,
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+
+ foreach ($expected as $k => $v) {
+ if (!mysqli_stmt_fetch($stmt)) {
+ break;
+ }
+ if ($result !== $v) {
+ printf("[%03d] Row %d - expecting %s/%s got %s/%s [%s] with %s - %s.\n",
+ $offset + 8,
+ $k,
+ gettype($v), $v,
+ gettype($result), $result,
+ $order_by_col,
+ $format, $sql);
+ }
+ }
+
+ }
+
+ mysqli_stmt_free_result($stmt);
+ mysqli_stmt_close($stmt);
+
+ return true;
+ }
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect - [%d] %s\n",
+ mysqli_connect_errno(),
+ mysqli_connect_error());
+
+ /* select from dual - pseudo table */
+ test_format($link, 'FORMAT(1.01, 0)', 'DUAL', null, '1', 10);
+ test_format($link, 'FORMAT(1.23, 1)', 'DUAL', null, '1.2', 20);
+ test_format($link, 'FORMAT(1.23, 2)', 'DUAL', null, '1.23', 30);
+ test_format($link, 'FORMAT(1234.567, 3)', 'DUAL', null, '1,234.567', 40);
+ /* no typo! */
+ test_format($link, 'FORMAT(1234.567, 4)', 'DUAL', null, '1,234.5670', 50);
+
+ mysqli_close($link);
+ require_once('table.inc');
+
+ /* select from existing table */
+ test_format($link, 'FORMAT(id, 0)', 'test', null, '1', 60);
+ test_format($link, 'FORMAT(id + 0.1, 1)', 'test', null, '1.1', 70);
+ test_format($link, 'FORMAT(id + 0.01, 2)', 'test', null, '1.01', 80);
+
+ /* create new table and select from it */
+ $expected = create_table($link, 'FLOAT', -10000, 10000, $engine, 90);
+ foreach ($expected as $k => $v)
+ $expected[$k] = number_format(round($v), 0, '.', ',');
+ test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 100);
+
+ $expected = create_table($link, 'FLOAT UNSIGNED', 0, 10000, $engine, 110);
+ foreach ($expected as $k => $v)
+ $expected[$k] = number_format(round($v), 0, '.', ',');
+ test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 120);
+
+ $expected = create_table($link, 'TINYINT', -128, 127, $engine, 130);
+ foreach ($expected as $k => $v)
+ $expected[$k] = number_format(round($v), 0, '.', ',');
+ test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 140);
+
+ $expected = create_table($link, 'SMALLINT UNSIGNED', 0, 65535, $engine, 150);
+ foreach ($expected as $k => $v)
+ $expected[$k] = number_format(round($v), 0, '.', ',');
+ test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 160);
+
+ $expected = create_table($link, 'MEDIUMINT', 0, 8388607, $engine, 170);
+ foreach ($expected as $k => $v)
+ $expected[$k] = number_format(round($v), 0, '.', ',');
+ test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 180);
+
+ $expected = create_table($link, 'INT UNSIGNED', 0, 1000, $engine, 190);
+ foreach ($expected as $k => $v)
+ $expected[$k] = number_format(round($v), 0, '.', ',');
+ test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 200);
+
+ $expected = create_table($link, 'BIGINT', -1000, 1000, $engine, 210);
+ foreach ($expected as $k => $v)
+ $expected[$k] = number_format(round($v), 0, '.', ',');
+ test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 220);
+
+ $expected = create_table($link, 'DECIMAL(5,0)', -1000, 1000, $engine, 230);
+ foreach ($expected as $k => $v)
+ $expected[$k] = number_format(round($v), 0, '.', ',');
+ test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 240);
+
+ // http://bugs.php.net/bug.php?id=42378
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
+ printf("[300] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ if (mysqli_query($link, "CREATE TABLE `test` (
`targetport` int(11) NOT NULL default '0',
`sources` double(17,4) default NULL,
`current_sources` double(17,4) default NULL,
@@ -222,116 +222,116 @@ memory_limit=83886080
PRIMARY KEY (`targetport`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1")) {
- do {
- $values = array();
- for ($i = 0; $i < 200; $i++) {
- $current_targets = mt_rand(-100000, 100000) / 10;
- do {
- $trend = (mt_rand(0, 3) > 1) ? (mt_rand(-10000, 10000) / 100) : 'NULL';
- } while (isset($values[$trend]));
-
- $sql = sprintf('INSERT INTO test(targetport, current_targets, maxreports, trend) VALUES (%d, %f, %s, %s)',
- $i,
- $current_targets,
- (mt_rand(0, 1) > 0) ? mt_rand(0, 1000) : 'NULL',
- $trend);
- if (!mysqli_query($link, $sql)) {
- printf("[301] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- break 2;
- }
- if ($current_targets > 0 && $trend !== 'NULL')
- $values[$trend] = $i;
- }
- krsort($values);
-
- if (!$stmt = mysqli_stmt_init($link)) {
- printf("[302] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- break;
- }
-
- if (!mysqli_stmt_prepare($stmt, 'SELECT trend, targetport, FORMAT(trend, 2) FROM test WHERE current_targets > 0 AND trend IS NOT NULL ORDER BY trend DESC LIMIT 100')) {
- printf("[303] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link));
- break;
- }
-
- if (!mysqli_stmt_execute($stmt)) {
- printf("[304] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link));
- break;
- }
-
- if (!mysqli_stmt_store_result($stmt)) {
- printf("[305] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link));
- break;
- }
-
- $trend = $targetport = $format = null;
- if (!mysqli_stmt_bind_result($stmt, $trend, $targetport, $format)) {
-
- printf("[305] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link));
- break;
- }
-
- foreach ($values as $exp_trend => $exp_targetport) {
- if (!mysqli_stmt_fetch($stmt)) {
- break;
- }
- if ($targetport != $exp_targetport) {
- printf("[306] Values fetched from MySQL seem to be wrong, check manually\n");
- printf("%s/%s - %s/%s - '%s'\n", $trend, $exp_trend, $targetport, $exp_targetport, $format);
- }
- }
- mysqli_stmt_free_result($stmt);
- mysqli_stmt_close($stmt);
-
- // same but OO interface
- if (!$stmt = mysqli_stmt_init($link)) {
- printf("[307] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- break;
- }
-
- if (!$stmt->prepare('SELECT trend, targetport, FORMAT(trend, 2) FROM test WHERE current_targets > 0 AND trend IS NOT NULL ORDER BY trend DESC LIMIT 100')) {
- printf("[308] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link));
- break;
- }
-
- if (!$stmt->execute()) {
- printf("[309] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link));
- break;
- }
-
- if (!$stmt->store_result()) {
- printf("[310] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link));
- break;
- }
-
- $trend = $targetport = $format = null;
- if (!$stmt->bind_result($trend, $targetport, $format)) {
-
- printf("[311] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link));
- break;
- }
-
- foreach ($values as $exp_trend => $exp_targetport) {
- if (!$stmt->fetch()) {
- break;
- }
- if ($targetport != $exp_targetport) {
- printf("[312] Values fetched from MySQL seem to be wrong, check manually\n");
- printf("%s/%s - %s/%s - '%s'\n", $trend, $exp_trend, $targetport, $exp_targetport, $format);
- }
- }
- $stmt->free_result();
- $stmt->close();
-
- } while (false);
-
- } else {
- var_dump(mysqli_error($link));
- }
-
-
- mysqli_close($link);
- print "done!";
+ do {
+ $values = array();
+ for ($i = 0; $i < 200; $i++) {
+ $current_targets = mt_rand(-100000, 100000) / 10;
+ do {
+ $trend = (mt_rand(0, 3) > 1) ? (mt_rand(-10000, 10000) / 100) : 'NULL';
+ } while (isset($values[$trend]));
+
+ $sql = sprintf('INSERT INTO test(targetport, current_targets, maxreports, trend) VALUES (%d, %f, %s, %s)',
+ $i,
+ $current_targets,
+ (mt_rand(0, 1) > 0) ? mt_rand(0, 1000) : 'NULL',
+ $trend);
+ if (!mysqli_query($link, $sql)) {
+ printf("[301] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ break 2;
+ }
+ if ($current_targets > 0 && $trend !== 'NULL')
+ $values[$trend] = $i;
+ }
+ krsort($values);
+
+ if (!$stmt = mysqli_stmt_init($link)) {
+ printf("[302] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ break;
+ }
+
+ if (!mysqli_stmt_prepare($stmt, 'SELECT trend, targetport, FORMAT(trend, 2) FROM test WHERE current_targets > 0 AND trend IS NOT NULL ORDER BY trend DESC LIMIT 100')) {
+ printf("[303] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link));
+ break;
+ }
+
+ if (!mysqli_stmt_execute($stmt)) {
+ printf("[304] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link));
+ break;
+ }
+
+ if (!mysqli_stmt_store_result($stmt)) {
+ printf("[305] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link));
+ break;
+ }
+
+ $trend = $targetport = $format = null;
+ if (!mysqli_stmt_bind_result($stmt, $trend, $targetport, $format)) {
+
+ printf("[305] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link));
+ break;
+ }
+
+ foreach ($values as $exp_trend => $exp_targetport) {
+ if (!mysqli_stmt_fetch($stmt)) {
+ break;
+ }
+ if ($targetport != $exp_targetport) {
+ printf("[306] Values fetched from MySQL seem to be wrong, check manually\n");
+ printf("%s/%s - %s/%s - '%s'\n", $trend, $exp_trend, $targetport, $exp_targetport, $format);
+ }
+ }
+ mysqli_stmt_free_result($stmt);
+ mysqli_stmt_close($stmt);
+
+ // same but OO interface
+ if (!$stmt = mysqli_stmt_init($link)) {
+ printf("[307] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ break;
+ }
+
+ if (!$stmt->prepare('SELECT trend, targetport, FORMAT(trend, 2) FROM test WHERE current_targets > 0 AND trend IS NOT NULL ORDER BY trend DESC LIMIT 100')) {
+ printf("[308] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link));
+ break;
+ }
+
+ if (!$stmt->execute()) {
+ printf("[309] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link));
+ break;
+ }
+
+ if (!$stmt->store_result()) {
+ printf("[310] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link));
+ break;
+ }
+
+ $trend = $targetport = $format = null;
+ if (!$stmt->bind_result($trend, $targetport, $format)) {
+
+ printf("[311] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link));
+ break;
+ }
+
+ foreach ($values as $exp_trend => $exp_targetport) {
+ if (!$stmt->fetch()) {
+ break;
+ }
+ if ($targetport != $exp_targetport) {
+ printf("[312] Values fetched from MySQL seem to be wrong, check manually\n");
+ printf("%s/%s - %s/%s - '%s'\n", $trend, $exp_trend, $targetport, $exp_targetport, $format);
+ }
+ }
+ $stmt->free_result();
+ $stmt->close();
+
+ } while (false);
+
+ } else {
+ var_dump(mysqli_error($link));
+ }
+
+
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_bind_result_references.phpt b/ext/mysqli/tests/mysqli_stmt_bind_result_references.phpt
index fec6a3f8df..8040f35bca 100644
--- a/ext/mysqli/tests/mysqli_stmt_bind_result_references.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_bind_result_references.phpt
@@ -8,238 +8,238 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require('table.inc');
-
- $stmt = mysqli_stmt_init($link);
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 1"))
- printf("[001] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 1"))
- printf("[001] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ require('table.inc');
+
+ $stmt = mysqli_stmt_init($link);
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 1"))
+ printf("[001] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 1"))
+ printf("[001] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- print "plain vanilla...\n";
- unset($id); unset($label);
- $id = $label = null;
- if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label)))
- printf("[002] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
- printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ print "plain vanilla...\n";
+ unset($id); unset($label);
+ $id = $label = null;
+ if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label)))
+ printf("[002] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
+ printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- var_dump($id);
- var_dump($label);
+ var_dump($id);
+ var_dump($label);
- print "reference, one level...\n";
- unset($id); unset($id_ref); unset($label); unset($label_ref);
- $id = null;
- $id_ref = &$id;
- $label = null;
- $label_ref = &$label;
-
- if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id_ref, $label_ref)))
- printf("[004] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
- printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- var_dump($id_ref);
- var_dump($id);
- var_dump($label_ref);
- var_dump($label);
-
-
- print "reference, two levels...\n";
- unset($id); unset($id_ref); unset($id_ref_ref); unset($label); unset($label_ref); unset($label_ref_ref);
- $id = null;
- $id_ref = &$id;
- $id_ref_ref = &$id_ref;
- $label = null;
- $label_ref = &$label;
- $label_ref_ref = &$label_ref;
-
- if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id_ref_ref, $label_ref_ref)))
- printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
- printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- var_dump($id_ref_ref);
- var_dump($id_ref);
- var_dump($id);
- var_dump($label_ref_ref);
- var_dump($label_ref);
- var_dump($label);
-
- print "reference, \$GLOBALS...\n";
- unset($id); unset($id_ref); unset($label); unset($label_ref);
- $id = 100;
- $id_ref = &$GLOBALS['id'];
- $label = null;
- $label_ref = &$GLOBALS['label'];
-
- if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id_ref, $label_ref)))
- printf("[008] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
- printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- var_dump($id_ref);
- var_dump($id);
- var_dump($label_ref);
- var_dump($label);
-
- print "reference, same target...\n";
- $id = null;
- $label = &$id;
-
- if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label)))
- printf("[010] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
- printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- var_dump($id);
- var_dump($label);
-
- print "reference, simple object...\n";
- unset($obj);
- $obj = new stdClass();
- $obj->id = null;
- $obj->label = null;
-
- if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $obj->id, $obj->label)))
- printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
- printf("[013] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- var_dump($obj->id);
- var_dump($obj->label);
-
-
- print "reference, simple object w reference...\n";
- unset($id); unset($label); unset($obj);
- $obj = new stdClass();
- $obj->id = null;
- $obj->label = null;
- $id = &$obj->id;
- $label = &$obj->label;
-
- if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label)))
- printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
- printf("[013] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- var_dump($obj->id);
- var_dump($obj->label);
-
- print "reference, simple object w reference, change after bind...\n";
- unset($id); unset($label); unset($obj);
- $obj = new stdClass();
- $obj->id = null;
- $obj->label = null;
- $id = &$obj->id;
- $label = &$obj->label;
-
- if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label)))
- printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- $label = &$obj->id;
- $id = null;
-
- if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
- printf("[013] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- var_dump($obj->id);
- var_dump($id);
- var_dump($obj->label);
- var_dump($label);
-
- print "reference, one level, change after bind...\n";
- unset($id); unset($label); unset($id_ref); unset($label_ref);
- $id = null;
- $id_ref = &$id;
- $label = null;
- $label_ref = &$label;
-
- if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id_ref, $label_ref)))
- printf("[014] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- $id_ref = 1;
- $label_ref = 1;
-
- if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
- printf("[015] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- var_dump($id_ref);
- var_dump($id);
- var_dump($label_ref);
- var_dump($label);
-
- print "reference, circle...\n";
- unset($id); unset($label_a); unset($label_b);
- $id = null;
- $label_a = &$label_b;
- $label_b = &$label_a;
-
- if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label_a)))
- printf("[016] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
- printf("[017] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- var_dump($id);
- var_dump($label_a);
- var_dump($label_b);
-
- print "reference, object, forward declaration...\n";
- unset($bar); unset($id); unset($label_ref);
- class foo {
- public $foo;
- public function __construct() {
- $this->foo = &$this->bar;
- }
- }
- class bar extends foo {
- public $bar = null;
- }
- $bar = new bar();
- $id = null;
- $label_ref = &$bar->bar;
-
- if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label_ref)))
- printf("[018] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
- printf("[019] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- var_dump($id);
- var_dump($bar);
- var_dump($label_ref);
-
- print "references, object, private...\n";
- unset($bar); unset($id); unset($label);
- class mega_bar extends bar {
- private $id;
- public $id_ref;
- public function __construct() {
- parent::__construct();
- $this->id_ref = &$this->id;
- }
- }
- $bar = new mega_bar();
- $id = &$bar->id_ref;
- $label = &$bar->foo;
-
- if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label)))
- printf("[020] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
- printf("[021] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- var_dump($id);
- var_dump($label);
- var_dump($bar);
-
- mysqli_stmt_close($stmt);
- mysqli_close($link);
-
- print "done!";
+ print "reference, one level...\n";
+ unset($id); unset($id_ref); unset($label); unset($label_ref);
+ $id = null;
+ $id_ref = &$id;
+ $label = null;
+ $label_ref = &$label;
+
+ if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id_ref, $label_ref)))
+ printf("[004] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
+ printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ var_dump($id_ref);
+ var_dump($id);
+ var_dump($label_ref);
+ var_dump($label);
+
+
+ print "reference, two levels...\n";
+ unset($id); unset($id_ref); unset($id_ref_ref); unset($label); unset($label_ref); unset($label_ref_ref);
+ $id = null;
+ $id_ref = &$id;
+ $id_ref_ref = &$id_ref;
+ $label = null;
+ $label_ref = &$label;
+ $label_ref_ref = &$label_ref;
+
+ if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id_ref_ref, $label_ref_ref)))
+ printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
+ printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ var_dump($id_ref_ref);
+ var_dump($id_ref);
+ var_dump($id);
+ var_dump($label_ref_ref);
+ var_dump($label_ref);
+ var_dump($label);
+
+ print "reference, \$GLOBALS...\n";
+ unset($id); unset($id_ref); unset($label); unset($label_ref);
+ $id = 100;
+ $id_ref = &$GLOBALS['id'];
+ $label = null;
+ $label_ref = &$GLOBALS['label'];
+
+ if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id_ref, $label_ref)))
+ printf("[008] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
+ printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ var_dump($id_ref);
+ var_dump($id);
+ var_dump($label_ref);
+ var_dump($label);
+
+ print "reference, same target...\n";
+ $id = null;
+ $label = &$id;
+
+ if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label)))
+ printf("[010] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
+ printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ var_dump($id);
+ var_dump($label);
+
+ print "reference, simple object...\n";
+ unset($obj);
+ $obj = new stdClass();
+ $obj->id = null;
+ $obj->label = null;
+
+ if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $obj->id, $obj->label)))
+ printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
+ printf("[013] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ var_dump($obj->id);
+ var_dump($obj->label);
+
+
+ print "reference, simple object w reference...\n";
+ unset($id); unset($label); unset($obj);
+ $obj = new stdClass();
+ $obj->id = null;
+ $obj->label = null;
+ $id = &$obj->id;
+ $label = &$obj->label;
+
+ if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label)))
+ printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
+ printf("[013] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ var_dump($obj->id);
+ var_dump($obj->label);
+
+ print "reference, simple object w reference, change after bind...\n";
+ unset($id); unset($label); unset($obj);
+ $obj = new stdClass();
+ $obj->id = null;
+ $obj->label = null;
+ $id = &$obj->id;
+ $label = &$obj->label;
+
+ if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label)))
+ printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ $label = &$obj->id;
+ $id = null;
+
+ if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
+ printf("[013] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ var_dump($obj->id);
+ var_dump($id);
+ var_dump($obj->label);
+ var_dump($label);
+
+ print "reference, one level, change after bind...\n";
+ unset($id); unset($label); unset($id_ref); unset($label_ref);
+ $id = null;
+ $id_ref = &$id;
+ $label = null;
+ $label_ref = &$label;
+
+ if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id_ref, $label_ref)))
+ printf("[014] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ $id_ref = 1;
+ $label_ref = 1;
+
+ if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
+ printf("[015] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ var_dump($id_ref);
+ var_dump($id);
+ var_dump($label_ref);
+ var_dump($label);
+
+ print "reference, circle...\n";
+ unset($id); unset($label_a); unset($label_b);
+ $id = null;
+ $label_a = &$label_b;
+ $label_b = &$label_a;
+
+ if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label_a)))
+ printf("[016] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
+ printf("[017] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ var_dump($id);
+ var_dump($label_a);
+ var_dump($label_b);
+
+ print "reference, object, forward declaration...\n";
+ unset($bar); unset($id); unset($label_ref);
+ class foo {
+ public $foo;
+ public function __construct() {
+ $this->foo = &$this->bar;
+ }
+ }
+ class bar extends foo {
+ public $bar = null;
+ }
+ $bar = new bar();
+ $id = null;
+ $label_ref = &$bar->bar;
+
+ if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label_ref)))
+ printf("[018] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
+ printf("[019] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ var_dump($id);
+ var_dump($bar);
+ var_dump($label_ref);
+
+ print "references, object, private...\n";
+ unset($bar); unset($id); unset($label);
+ class mega_bar extends bar {
+ private $id;
+ public $id_ref;
+ public function __construct() {
+ parent::__construct();
+ $this->id_ref = &$this->id;
+ }
+ }
+ $bar = new mega_bar();
+ $id = &$bar->id_ref;
+ $label = &$bar->foo;
+
+ if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label)))
+ printf("[020] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt) || mysqli_stmt_fetch($stmt))
+ printf("[021] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ var_dump($id);
+ var_dump($label);
+ var_dump($bar);
+
+ mysqli_stmt_close($stmt);
+ mysqli_close($link);
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_bind_result_zerofill.phpt b/ext/mysqli/tests/mysqli_stmt_bind_result_zerofill.phpt
index 11755b4aef..f1a68e3c0e 100644
--- a/ext/mysqli/tests/mysqli_stmt_bind_result_zerofill.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_bind_result_zerofill.phpt
@@ -8,86 +8,86 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once('connect.inc');
- require_once('table.inc');
+ require_once('connect.inc');
+ require_once('table.inc');
- function zerofill($offset, $link, $datatype, $insert = 1) {
+ function zerofill($offset, $link, $datatype, $insert = 1) {
- mysqli_query($link, 'ALTER TABLE test DROP zero');
- $sql = sprintf('ALTER TABLE test ADD zero %s UNSIGNED ZEROFILL', $datatype);
- if (!mysqli_query($link, $sql)) {
- // no worries - server might not support it
- return true;
- }
+ mysqli_query($link, 'ALTER TABLE test DROP zero');
+ $sql = sprintf('ALTER TABLE test ADD zero %s UNSIGNED ZEROFILL', $datatype);
+ if (!mysqli_query($link, $sql)) {
+ // no worries - server might not support it
+ return true;
+ }
- if (!mysqli_query($link, sprintf('UPDATE test SET zero = %s', $insert))) {
- printf("[%03d] UPDATE failed, [%d] %s\n",
- $offset, mysqli_errno($link), mysqli_error($link));
- return false;
- }
+ if (!mysqli_query($link, sprintf('UPDATE test SET zero = %s', $insert))) {
+ printf("[%03d] UPDATE failed, [%d] %s\n",
+ $offset, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
- if (!($stmt = mysqli_prepare($link, 'SELECT zero FROM test LIMIT 1'))) {
- printf("[%03d] SELECT failed, [%d] %s\n",
- $offset, mysqli_errno($link), mysqli_error($link));
- return false;
- }
+ if (!($stmt = mysqli_prepare($link, 'SELECT zero FROM test LIMIT 1'))) {
+ printf("[%03d] SELECT failed, [%d] %s\n",
+ $offset, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
- $result = null;
- if (!mysqli_stmt_bind_result($stmt, $result)) {
- printf("[%03d] Bind failed, [%d] %s\n",
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
+ $result = null;
+ if (!mysqli_stmt_bind_result($stmt, $result)) {
+ printf("[%03d] Bind failed, [%d] %s\n",
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
- if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt)) {
- printf("[%03d] Execute or fetch failed, [%d] %s\n",
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
+ if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt)) {
+ printf("[%03d] Execute or fetch failed, [%d] %s\n",
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
- $res = mysqli_stmt_result_metadata($stmt);
- $meta = mysqli_fetch_fields($res);
- mysqli_stmt_free_result($stmt);
+ $res = mysqli_stmt_result_metadata($stmt);
+ $meta = mysqli_fetch_fields($res);
+ mysqli_stmt_free_result($stmt);
- $meta = $meta[0];
- $length = $meta->length;
- if ($length > strlen($insert)) {
+ $meta = $meta[0];
+ $length = $meta->length;
+ if ($length > strlen($insert)) {
- $expected = str_repeat('0', $length - strlen($insert));
- $expected .= $insert;
- if ($expected !== $result) {
- printf("[%03d] Expecting '%s' got '%s'\n", $offset, $expected, $result);
- return false;
- }
+ $expected = str_repeat('0', $length - strlen($insert));
+ $expected .= $insert;
+ if ($expected !== $result) {
+ printf("[%03d] Expecting '%s' got '%s'\n", $offset, $expected, $result);
+ return false;
+ }
- } else if ($length <= 1) {
- printf("[%03d] Length reported is too small to run test\n", $offset);
- return false;
- }
+ } else if ($length <= 1) {
+ printf("[%03d] Length reported is too small to run test\n", $offset);
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- /*
- We map those to PHP numeric types -
- no padding/filling done. Neither with libmysql nor with mysqlnd.
- zerofill(2, $link, 'TINYINT');
- zerofill(3, $link, 'SMALLINT');
- zerofill(4, $link, 'MEDIUMINT');
- zerofill(5, $link, 'INT');
- zerofill(6, $link, 'INTEGER');
- zerofill(7, $link, 'BIGINT');
- zerofill(8, $link, 'FLOAT');
- zerofill(9, $link, 'DOUBLE');
- zerofill(10, $link, 'DOUBLE PRECISION');
- */
- zerofill(11, $link, 'DECIMAL');
- zerofill(12, $link, 'DEC');
+ /*
+ We map those to PHP numeric types -
+ no padding/filling done. Neither with libmysql nor with mysqlnd.
+ zerofill(2, $link, 'TINYINT');
+ zerofill(3, $link, 'SMALLINT');
+ zerofill(4, $link, 'MEDIUMINT');
+ zerofill(5, $link, 'INT');
+ zerofill(6, $link, 'INTEGER');
+ zerofill(7, $link, 'BIGINT');
+ zerofill(8, $link, 'FLOAT');
+ zerofill(9, $link, 'DOUBLE');
+ zerofill(10, $link, 'DOUBLE PRECISION');
+ */
+ zerofill(11, $link, 'DECIMAL');
+ zerofill(12, $link, 'DEC');
- mysqli_close($link);
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_close.phpt b/ext/mysqli/tests/mysqli_stmt_close.phpt
index 6ea64e815a..fd91eaecd1 100644
--- a/ext/mysqli/tests/mysqli_stmt_close.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_close.phpt
@@ -8,84 +8,79 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ require('table.inc');
- if (!is_null($tmp = @mysqli_stmt_close()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_null($tmp = @mysqli_stmt_close($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ // Yes, amazing, eh? AFAIK a work around of a constructor bug...
+ try {
+ mysqli_stmt_close($stmt);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- require('table.inc');
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test"))
+ printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!$stmt = mysqli_stmt_init($link))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (true !== ($tmp = mysqli_stmt_close($stmt)))
+ printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- // Yes, amazing, eh? AFAIK a work around of a constructor bug...
- if (false !== ($tmp = mysqli_stmt_close($stmt)))
- printf("[004] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ try {
+ mysqli_stmt_close($stmt);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test"))
- printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (true !== ($tmp = mysqli_stmt_close($stmt)))
- printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
+ printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (false !== ($tmp = mysqli_stmt_close($stmt)))
- printf("[007] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ $id = $label = null;
+ if (!mysqli_stmt_bind_param($stmt, "is", $id, $label))
+ printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!$stmt = mysqli_stmt_init($link))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $id = 100; $label = 'z';
+ if (!mysqli_stmt_execute($stmt))
+ printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
- printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_kill($link, mysqli_thread_id($link));
- $id = $label = null;
- if (!mysqli_stmt_bind_param($stmt, "is", $id, $label))
- printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (true !== ($tmp = mysqli_stmt_close($stmt)))
+ printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- $id = 100; $label = 'z';
- if (!mysqli_stmt_execute($stmt))
- printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_close($link);
- mysqli_kill($link, mysqli_thread_id($link));
+ require('table.inc');
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (true !== ($tmp = mysqli_stmt_close($stmt)))
- printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test"))
+ printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_close($link);
+ $id = $label = null;
+ if (!mysqli_stmt_bind_result($stmt, $id, $label))
+ printf("[015] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- require('table.inc');
- if (!$stmt = mysqli_stmt_init($link))
- printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt))
+ printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test"))
- printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_kill($link, mysqli_thread_id($link));
- $id = $label = null;
- if (!mysqli_stmt_bind_result($stmt, $id, $label))
- printf("[015] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (true !== ($tmp = mysqli_stmt_close($stmt)))
+ printf("[017] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_fetch($stmt))
- printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- mysqli_kill($link, mysqli_thread_id($link));
-
- if (true !== ($tmp = mysqli_stmt_close($stmt)))
- printf("[017] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
---EXPECTF--
-Warning: mysqli_stmt_close(): invalid object or resource mysqli_stmt
- in %s on line %d
-
-Warning: mysqli_stmt_close(): Couldn't fetch mysqli_stmt in %s on line %d
+--EXPECT--
+mysqli_stmt object is not fully initialized
+mysqli_stmt object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_stmt_data_seek.phpt b/ext/mysqli/tests/mysqli_stmt_data_seek.phpt
index f9224eef62..72d807512f 100644
--- a/ext/mysqli/tests/mysqli_stmt_data_seek.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_data_seek.phpt
@@ -8,92 +8,87 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ require('table.inc');
- if (!is_null($tmp = @mysqli_stmt_data_seek()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_null($tmp = @mysqli_stmt_data_seek($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ try {
+ mysqli_stmt_data_seek($stmt, 1);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- require('table.inc');
+ if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id"))
+ printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!$stmt = mysqli_stmt_init($link))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (true !== ($tmp = mysqli_stmt_execute($stmt)))
+ printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (false !== ($tmp = mysqli_stmt_data_seek($stmt, 1)))
- printf("[004] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id"))
- printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $id = null;
+ if (!mysqli_stmt_bind_result($stmt, $id))
+ printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (true !== ($tmp = mysqli_stmt_execute($stmt)))
- printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_stmt_store_result($stmt))
+ printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!is_null($tmp = mysqli_stmt_data_seek($stmt, 2)))
+ printf("[009] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- $id = null;
- if (!mysqli_stmt_bind_result($stmt, $id))
- printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_fetch($stmt))
+ printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_store_result($stmt))
- printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ var_dump($id);
- if (!is_null($tmp = mysqli_stmt_data_seek($stmt, 2)))
- printf("[009] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = mysqli_stmt_data_seek($stmt, 0)))
+ printf("[011] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_fetch($stmt))
- printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_fetch($stmt))
+ printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- var_dump($id);
+ var_dump($id);
- if (!is_null($tmp = mysqli_stmt_data_seek($stmt, 0)))
- printf("[011] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_null($tmp = mysqli_stmt_data_seek($stmt, mysqli_stmt_num_rows($stmt) + 100)))
+ printf("[013] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_fetch($stmt))
- printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (mysqli_stmt_fetch($stmt))
+ printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- var_dump($id);
+ var_dump($id);
- if (!is_null($tmp = mysqli_stmt_data_seek($stmt, mysqli_stmt_num_rows($stmt) + 100)))
- printf("[013] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_stmt_data_seek($stmt, -1)))
+ printf("[015] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (mysqli_stmt_fetch($stmt))
- printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (mysqli_stmt_fetch($stmt))
+ printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- var_dump($id);
+ var_dump($id);
- if (false !== ($tmp = mysqli_stmt_data_seek($stmt, -1)))
- printf("[015] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ mysqli_stmt_close($stmt);
- if (mysqli_stmt_fetch($stmt))
- printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ try {
+ mysqli_stmt_data_seek($stmt, 0);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- var_dump($id);
-
- mysqli_stmt_close($stmt);
-
- if (false !== ($tmp = mysqli_stmt_data_seek($stmt, 0)))
- printf("[017] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
--EXPECTF--
-Warning: mysqli_stmt_data_seek(): invalid object or resource mysqli_stmt
- in %s on line %d
+mysqli_stmt object is not fully initialized
int(3)
int(1)
int(1)
Warning: mysqli_stmt_data_seek(): Offset must be positive in %s on line %d
int(1)
-
-Warning: mysqli_stmt_data_seek(): Couldn't fetch mysqli_stmt in %s on line %d
+mysqli_stmt object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_stmt_datatype_change.phpt b/ext/mysqli/tests/mysqli_stmt_datatype_change.phpt
index 3a1c004c2e..4bffb7cab7 100644
--- a/ext/mysqli/tests/mysqli_stmt_datatype_change.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_datatype_change.phpt
@@ -8,51 +8,51 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
- if (!$c1 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- exit(1);
- }
- if (!$c2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- exit(1);
- }
+ require_once("connect.inc");
+ if (!$c1 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ exit(1);
+ }
+ if (!$c2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ exit(1);
+ }
- $c1->query("use $db");
- $c2->query("use $db");
- $c1->query("drop table if exists type_change");
- $c1->query("create table type_change(a int, b char(10)) ENGINE = " . $engine);
- $c1->query("insert into type_change values (1, 'one'), (2, 'two')");
- $s1 = $c1->prepare("select a from type_change order by a");
- var_dump($s1->execute(), $s1->bind_result($col1));
- echo "---- Row 1\n";
- var_dump($s1->fetch());
- var_dump($col1);
- echo "---- Row 2\n";
- var_dump($s1->fetch());
- var_dump($col1);
- echo "---- Row 3\n";
- var_dump($s1->fetch());
- echo "----\n";
+ $c1->query("use $db");
+ $c2->query("use $db");
+ $c1->query("drop table if exists type_change");
+ $c1->query("create table type_change(a int, b char(10)) ENGINE = " . $engine);
+ $c1->query("insert into type_change values (1, 'one'), (2, 'two')");
+ $s1 = $c1->prepare("select a from type_change order by a");
+ var_dump($s1->execute(), $s1->bind_result($col1));
+ echo "---- Row 1\n";
+ var_dump($s1->fetch());
+ var_dump($col1);
+ echo "---- Row 2\n";
+ var_dump($s1->fetch());
+ var_dump($col1);
+ echo "---- Row 3\n";
+ var_dump($s1->fetch());
+ echo "----\n";
- echo "ALTER\n";
- var_dump($c2->query("alter table type_change drop a"));
- var_dump($s1->execute());
- var_dump($c1->error);
+ echo "ALTER\n";
+ var_dump($c2->query("alter table type_change drop a"));
+ var_dump($s1->execute());
+ var_dump($c1->error);
- echo "---- Row 1\n";
- var_dump($s1->fetch());
- var_dump($col1);
- echo "---- Row 2\n";
- var_dump($s1->fetch());
- var_dump($col1);
- echo "---- Row 3\n";
- var_dump($s1->fetch());
- echo "----\n";
+ echo "---- Row 1\n";
+ var_dump($s1->fetch());
+ var_dump($col1);
+ echo "---- Row 2\n";
+ var_dump($s1->fetch());
+ var_dump($col1);
+ echo "---- Row 3\n";
+ var_dump($s1->fetch());
+ echo "----\n";
- echo "done!";
+ echo "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_errno.phpt b/ext/mysqli/tests/mysqli_stmt_errno.phpt
index d98a98b87a..9928d0c1f3 100644
--- a/ext/mysqli/tests/mysqli_stmt_errno.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_errno.phpt
@@ -8,61 +8,55 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ require('table.inc');
- if (!is_null($tmp = @mysqli_stmt_errno()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_null($tmp = @mysqli_stmt_errno($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ // properly initialized?
+ if (0 !== ($tmp = mysqli_stmt_errno($stmt)))
+ printf("[004] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ if (mysqli_stmt_prepare($stmt, "SELECT i_do_not_exist_believe_me FROM test ORDER BY id"))
+ printf("[005] Statement should have failed!\n");
- if (!$stmt = mysqli_stmt_init($link))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ // set after error server?
+ if (0 === ($tmp = mysqli_stmt_errno($stmt)))
+ printf("[006] Expecting int/any non zero, got %s/%s\n", gettype($tmp), $tmp);
- // properly initialized?
- if (0 !== ($tmp = mysqli_stmt_errno($stmt)))
- printf("[004] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id"))
+ printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (mysqli_stmt_prepare($stmt, "SELECT i_do_not_exist_believe_me FROM test ORDER BY id"))
- printf("[005] Statement should have failed!\n");
+ // reset after error & success
+ if (0 != ($tmp = mysqli_stmt_errno($stmt)))
+ printf("[008] Expecting zero, got %s/%s\n", gettype($tmp), $tmp);
- // set after error server?
- if (0 === ($tmp = mysqli_stmt_errno($stmt)))
- printf("[006] Expecting int/any non zero, got %s/%s\n", gettype($tmp), $tmp);
+ mysqli_kill($link, mysqli_thread_id($link));
- if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id"))
- printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (true === ($tmp = mysqli_stmt_execute($stmt)))
+ printf("[009] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- // reset after error & success
- if (0 != ($tmp = mysqli_stmt_errno($stmt)))
- printf("[008] Expecting zero, got %s/%s\n", gettype($tmp), $tmp);
+ // set after client error
+ if (0 === ($tmp = mysqli_stmt_errno($stmt)))
+ printf("[010] Expecting int/any non zero, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_kill($link, mysqli_thread_id($link));
+ mysqli_stmt_close($stmt);
- if (true === ($tmp = mysqli_stmt_execute($stmt)))
- printf("[009] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ try {
+ mysqli_stmt_errno($stmt);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- // set after client error
- if (0 === ($tmp = mysqli_stmt_errno($stmt)))
- printf("[010] Execting int/any non zero, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_stmt_close($stmt);
-
- if (false !== ($tmp = mysqli_stmt_errno($stmt)))
- printf("[011] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
---EXPECTF--
-Warning: mysqli_stmt_errno(): Couldn't fetch mysqli_stmt in %s on line %d
+--EXPECT--
+mysqli_stmt object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_stmt_error.phpt b/ext/mysqli/tests/mysqli_stmt_error.phpt
index ad8efef602..98e6102655 100644
--- a/ext/mysqli/tests/mysqli_stmt_error.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_error.phpt
@@ -8,61 +8,55 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ require('table.inc');
- if (!is_null($tmp = @mysqli_stmt_error()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_null($tmp = @mysqli_stmt_error($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ // properly initialized?
+ if ('' !== ($tmp = mysqli_stmt_error($stmt)))
+ printf("[004] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ if (mysqli_stmt_prepare($stmt, "SELECT i_do_not_exist_believe_me FROM test ORDER BY id"))
+ printf("[005] Statement should have failed!\n");
- if (!$stmt = mysqli_stmt_init($link))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ // set after error server?
+ if ('' === ($tmp = mysqli_stmt_error($stmt)))
+ printf("[006] Expecting string/any non empty, got %s/%s\n", gettype($tmp), $tmp);
- // properly initialized?
- if ('' !== ($tmp = mysqli_stmt_error($stmt)))
- printf("[004] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id"))
+ printf("[007] [%d] %s\n", mysqli_stmt_error($stmt), mysqli_stmt_error($stmt));
- if (mysqli_stmt_prepare($stmt, "SELECT i_do_not_exist_believe_me FROM test ORDER BY id"))
- printf("[005] Statement should have failed!\n");
+ // reset after error & success
+ if ('' !== ($tmp = mysqli_stmt_error($stmt)))
+ printf("[008] Expecting empty string, got %s/%s\n", gettype($tmp), $tmp);
- // set after error server?
- if ('' === ($tmp = mysqli_stmt_error($stmt)))
- printf("[006] Expecting string/any non empty, got %s/%s\n", gettype($tmp), $tmp);
+ mysqli_kill($link, mysqli_thread_id($link));
- if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id"))
- printf("[007] [%d] %s\n", mysqli_stmt_error($stmt), mysqli_stmt_error($stmt));
+ if (true === ($tmp = mysqli_stmt_execute($stmt)))
+ printf("[009] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- // reset after error & success
- if ('' !== ($tmp = mysqli_stmt_error($stmt)))
- printf("[008] Expecting empty string, got %s/%s\n", gettype($tmp), $tmp);
+ // set after client error
+ if ('' === ($tmp = mysqli_stmt_error($stmt)))
+ printf("[010] Expecting string/any non empty, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_kill($link, mysqli_thread_id($link));
+ mysqli_stmt_close($stmt);
- if (true === ($tmp = mysqli_stmt_execute($stmt)))
- printf("[009] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ try {
+ mysqli_stmt_error($stmt);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- // set after client error
- if ('' === ($tmp = mysqli_stmt_error($stmt)))
- printf("[010] Execting string/any non empty, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_stmt_close($stmt);
-
- if (false !== ($tmp = mysqli_stmt_error($stmt)))
- printf("[011] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
---EXPECTF--
-Warning: mysqli_stmt_error(): Couldn't fetch mysqli_stmt in %s on line %d
+--EXPECT--
+mysqli_stmt object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_stmt_execute.phpt b/ext/mysqli/tests/mysqli_stmt_execute.phpt
index d97111a6fd..d3f404aa3d 100644
--- a/ext/mysqli/tests/mysqli_stmt_execute.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_execute.phpt
@@ -14,137 +14,133 @@ if (mysqli_get_server_version($link) <= 40100) {
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ require('table.inc');
- if (!is_null($tmp = @mysqli_stmt_execute()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_null($tmp = @mysqli_stmt_execute($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ // stmt object status test
+ try {
+ mysqli_stmt_execute($stmt);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- require('table.inc');
+ if (mysqli_stmt_prepare($stmt, "SELECT i_do_not_exist_believe_me FROM test ORDER BY id"))
+ printf("[005] Statement should have failed!\n");
- if (!$stmt = mysqli_stmt_init($link))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ // stmt object status test
+ try {
+ mysqli_stmt_execute($stmt);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- // stmt object status test
- if (false !== ($tmp = mysqli_stmt_execute($stmt)))
- printf("[004] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id LIMIT 1"))
+ printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (mysqli_stmt_prepare($stmt, "SELECT i_do_not_exist_believe_me FROM test ORDER BY id"))
- printf("[005] Statement should have failed!\n");
+ if (true !== ($tmp = mysqli_stmt_execute($stmt)))
+ printf("[008] Expecting boolean/true, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- // stmt object status test
- if (false !== ($tmp = mysqli_stmt_execute($stmt)))
- printf("[006] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
+ printf("[009] [%d] %s\n", mysqli_stmt_execute($stmt), mysqli_stmt_execute($stmt));
- if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id LIMIT 1"))
- printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ // no input variables bound
+ if (false !== ($tmp = mysqli_stmt_execute($stmt)))
+ printf("[010] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- if (true !== ($tmp = mysqli_stmt_execute($stmt)))
- printf("[008] Expecting boolean/true, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $id = 100;
+ $label = "z";
+ if (!mysqli_stmt_bind_param($stmt, "is", $id, $label))
+ printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
- printf("[009] [%d] %s\n", mysqli_stmt_execute($stmt), mysqli_stmt_execute($stmt));
+ if (true !== ($tmp = mysqli_stmt_execute($stmt)))
+ printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- // no input variables bound
- if (false !== ($tmp = mysqli_stmt_execute($stmt)))
- printf("[010] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ // calling reset between executions
+ mysqli_stmt_close($stmt);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $id = 100;
- $label = "z";
- if (!mysqli_stmt_bind_param($stmt, "is", $id, $label))
- printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id LIMIT ?"))
+ printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (true !== ($tmp = mysqli_stmt_execute($stmt)))
- printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $limit = 1;
+ if (!mysqli_stmt_bind_param($stmt, "i", $limit))
+ printf("[015] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- // calling reset between executions
- mysqli_stmt_close($stmt);
- if (!$stmt = mysqli_stmt_init($link))
- printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (true !== ($tmp = mysqli_stmt_execute($stmt)))
+ printf("[016] Expecting boolean/true, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id LIMIT ?"))
- printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $id = null;
+ if (!mysqli_stmt_bind_result($stmt, $id) || !mysqli_stmt_fetch($stmt))
+ printf("[017] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $limit = 1;
- if (!mysqli_stmt_bind_param($stmt, "i", $limit))
- printf("[015] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if ($id !== 1)
+ printf("[018] Expecting int/1 got %s/%s\n", gettype($id), $id);
- if (true !== ($tmp = mysqli_stmt_execute($stmt)))
- printf("[016] Expecting boolean/true, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (true !== ($tmp = mysqli_stmt_reset($stmt)))
+ printf("[019] Expecting boolean/true, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $id = null;
- if (!mysqli_stmt_bind_result($stmt, $id) || !mysqli_stmt_fetch($stmt))
- printf("[017] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (true !== ($tmp = mysqli_stmt_execute($stmt)))
+ printf("[020] Expecting boolean/true after reset to prepare status, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if ($id !== 1)
- printf("[018] Expecting int/1 got %s/%s\n", gettype($id), $id);
+ $id = null;
+ if (!mysqli_stmt_fetch($stmt))
+ printf("[021] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (true !== ($tmp = mysqli_stmt_reset($stmt)))
- printf("[019] Expecting boolean/true, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if ($id !== 1)
+ printf("[022] Expecting int/1 got %s/%s\n", gettype($id), $id);
- if (true !== ($tmp = mysqli_stmt_execute($stmt)))
- printf("[020] Expecting boolean/true after reset to prepare status, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_stmt_close($stmt);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $id = null;
- if (!mysqli_stmt_fetch($stmt))
- printf("[021] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id LIMIT 1"))
+ printf("[024] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if ($id !== 1)
- printf("[022] Expecting int/1 got %s/%s\n", gettype($id), $id);
+ if (true !== ($tmp = mysqli_stmt_execute($stmt)))
+ printf("[025] Expecting boolean/true, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_close($stmt);
- if (!$stmt = mysqli_stmt_init($link))
- printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (true !== ($tmp = mysqli_stmt_reset($stmt)))
+ printf("[026] Expecting boolean/true, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id LIMIT 1"))
- printf("[024] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ var_dump(mysqli_stmt_execute($stmt));
+ var_dump(mysqli_stmt_fetch($stmt));
- if (true !== ($tmp = mysqli_stmt_execute($stmt)))
- printf("[025] Expecting boolean/true, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_kill($link, mysqli_thread_id($link));
- if (true !== ($tmp = mysqli_stmt_reset($stmt)))
- printf("[026] Expecting boolean/true, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (false !== ($tmp = mysqli_stmt_execute($stmt)))
+ printf("[027] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- var_dump(mysqli_stmt_execute($stmt));
- var_dump(mysqli_stmt_fetch($stmt));
+ mysqli_stmt_close($stmt);
- mysqli_kill($link, mysqli_thread_id($link));
+ try {
+ mysqli_stmt_execute($stmt);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- if (false !== ($tmp = mysqli_stmt_execute($stmt)))
- printf("[027] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_stmt_close($stmt);
-
- if (false !== ($tmp = mysqli_stmt_execute($stmt)))
- printf("[028] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
---EXPECTF--
-Warning: mysqli_stmt_execute(): invalid object or resource mysqli_stmt
- in %s on line %d
-
-Warning: mysqli_stmt_execute(): invalid object or resource mysqli_stmt
- in %s on line %d
+--EXPECT--
+mysqli_stmt object is not fully initialized
+mysqli_stmt object is not fully initialized
bool(true)
bool(true)
[027] Expecting boolean/false, got boolean/1
-
-Warning: mysqli_stmt_execute(): Couldn't fetch mysqli_stmt in %s on line %d
+mysqli_stmt object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_stmt_execute_stored_proc.phpt b/ext/mysqli/tests/mysqli_stmt_execute_stored_proc.phpt
index 6537b8d88b..33e6cd1c8b 100644
--- a/ext/mysqli/tests/mysqli_stmt_execute_stored_proc.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_execute_stored_proc.phpt
@@ -14,172 +14,172 @@ if (mysqli_get_server_version($link) <= 50000) {
?>
--FILE--
<?php
- require_once('connect.inc');
- require_once('table.inc');
+ require_once('connect.inc');
+ require_once('table.inc');
- if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
- printf("[009] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
+ printf("[009] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
- if (mysqli_real_query($link, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) BEGIN SELECT VERSION() INTO ver_param; END;')) {
- /* no result set, one output parameter */
- if (!$stmt = mysqli_prepare($link, 'CALL p(@version)'))
- printf("[011] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (mysqli_real_query($link, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) BEGIN SELECT VERSION() INTO ver_param; END;')) {
+ /* no result set, one output parameter */
+ if (!$stmt = mysqli_prepare($link, 'CALL p(@version)'))
+ printf("[011] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_stmt_execute($stmt))
- printf("[012] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_execute($stmt))
+ printf("[012] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- /* yes, I really want to call it twice! */
- if (!mysqli_stmt_execute($stmt))
- printf("[013] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ /* yes, I really want to call it twice! */
+ if (!mysqli_stmt_execute($stmt))
+ printf("[013] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_close($stmt))
- printf("[014] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_close($stmt))
+ printf("[014] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!$stmt = mysqli_prepare($link, 'SELECT @version AS _version'))
- printf("[015] Cannot prepare SELECT, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_prepare($link, 'SELECT @version AS _version'))
+ printf("[015] Cannot prepare SELECT, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_stmt_execute($stmt))
- printf("[016] Cannot execute SELECT, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_execute($stmt))
+ printf("[016] Cannot execute SELECT, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $version = 'unknown';
- if (!mysqli_stmt_bind_result($stmt, $version) ||
- !mysqli_stmt_fetch($stmt))
- printf("[017] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $version = 'unknown';
+ if (!mysqli_stmt_bind_result($stmt, $version) ||
+ !mysqli_stmt_fetch($stmt))
+ printf("[017] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (($version == "unknown") || ($version == ""))
- printf("[018] Results seem wrong, got %s, [%d] %s\n",
- $version,
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (($version == "unknown") || ($version == ""))
+ printf("[018] Results seem wrong, got %s, [%d] %s\n",
+ $version,
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_free_result($stmt);
- mysqli_stmt_close($stmt);
+ mysqli_stmt_free_result($stmt);
+ mysqli_stmt_close($stmt);
- } else {
- printf("[010] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
- }
+ } else {
+ printf("[010] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+ }
- if (function_exists('mysqli_stmt_get_result')) {
+ if (function_exists('mysqli_stmt_get_result')) {
- if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
- printf("[019] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
+ printf("[019] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
- if (mysqli_real_query($link, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) BEGIN SELECT VERSION() INTO ver_param; END;')) {
- // no result set, one output parameter
- if (!$stmt = mysqli_prepare($link, 'CALL p(@version)'))
- printf("[020] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (mysqli_real_query($link, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) BEGIN SELECT VERSION() INTO ver_param; END;')) {
+ // no result set, one output parameter
+ if (!$stmt = mysqli_prepare($link, 'CALL p(@version)'))
+ printf("[020] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_stmt_execute($stmt))
- printf("[021] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_execute($stmt))
+ printf("[021] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_close($stmt))
- printf("[022] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_close($stmt))
+ printf("[022] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!$stmt = mysqli_prepare($link, 'SELECT @version AS _version'))
- printf("[023] Cannot prepare SELECT, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_prepare($link, 'SELECT @version AS _version'))
+ printf("[023] Cannot prepare SELECT, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_stmt_execute($stmt))
- printf("[024] Cannot execute SELECT, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_execute($stmt))
+ printf("[024] Cannot execute SELECT, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!$res = mysqli_stmt_get_result($stmt))
- printf("[025] Cannot get result set, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!$res = mysqli_stmt_get_result($stmt))
+ printf("[025] Cannot get result set, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if ((!($row = mysqli_fetch_assoc($res))) || ($row['_version'] == ""))
- printf("[026] Results seem wrong, got %s, [%d] %s\n",
- $row['_version'],
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if ((!($row = mysqli_fetch_assoc($res))) || ($row['_version'] == ""))
+ printf("[026] Results seem wrong, got %s, [%d] %s\n",
+ $row['_version'],
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_free_result($res);
- mysqli_stmt_close($stmt);
+ mysqli_free_result($res);
+ mysqli_stmt_close($stmt);
- } else {
- printf("[027] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
- }
+ } else {
+ printf("[027] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+ }
- }
+ }
- if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
- printf("[028] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
+ printf("[028] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
- if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25), OUT ver_out VARCHAR(25)) BEGIN SELECT ver_in INTO ver_out; END;')) {
- // no result set, one input parameter, output parameter
- // yes, I really do not want to bind input values...
- if (!$stmt = mysqli_prepare($link, "CALL p('myversion', @version)"))
- printf("[029] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25), OUT ver_out VARCHAR(25)) BEGIN SELECT ver_in INTO ver_out; END;')) {
+ // no result set, one input parameter, output parameter
+ // yes, I really do not want to bind input values...
+ if (!$stmt = mysqli_prepare($link, "CALL p('myversion', @version)"))
+ printf("[029] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_stmt_execute($stmt))
- printf("[030] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_execute($stmt))
+ printf("[030] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_close($stmt))
- printf("[031] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_close($stmt))
+ printf("[031] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!$stmt = mysqli_prepare($link, 'SELECT @version AS _version'))
- printf("[032] Cannot prepare SELECT, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_prepare($link, 'SELECT @version AS _version'))
+ printf("[032] Cannot prepare SELECT, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_stmt_execute($stmt))
- printf("[033] Cannot execute SELECT, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_execute($stmt))
+ printf("[033] Cannot execute SELECT, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $version = 'unknown';
- if (!mysqli_stmt_bind_result($stmt, $version) ||
- !mysqli_stmt_fetch($stmt))
- printf("[034] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $version = 'unknown';
+ if (!mysqli_stmt_bind_result($stmt, $version) ||
+ !mysqli_stmt_fetch($stmt))
+ printf("[034] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if ($version != "myversion")
- printf("[035] Results seem wrong, got %s, [%d] %s\n",
- $version,
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if ($version != "myversion")
+ printf("[035] Results seem wrong, got %s, [%d] %s\n",
+ $version,
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_free_result($stmt);
- mysqli_stmt_close($stmt);
+ mysqli_stmt_free_result($stmt);
+ mysqli_stmt_close($stmt);
- } else {
- printf("[036] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
- }
+ } else {
+ printf("[036] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+ }
- if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
- printf("[037] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
+ printf("[037] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
- if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25), OUT ver_out VARCHAR(25)) BEGIN SELECT ver_in INTO ver_out; END;')) {
- // no result set, one input parameter, output parameter
- // yes, I really do not want to bind input values...
- if (!$stmt = mysqli_prepare($link, 'CALL p(?, @version)'))
- printf("[038] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25), OUT ver_out VARCHAR(25)) BEGIN SELECT ver_in INTO ver_out; END;')) {
+ // no result set, one input parameter, output parameter
+ // yes, I really do not want to bind input values...
+ if (!$stmt = mysqli_prepare($link, 'CALL p(?, @version)'))
+ printf("[038] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $version = 'myversion';
- if (!mysqli_stmt_bind_param($stmt, 's', $version))
- printf("[039] Cannot bind input parameter, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $version = 'myversion';
+ if (!mysqli_stmt_bind_param($stmt, 's', $version))
+ printf("[039] Cannot bind input parameter, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_execute($stmt))
- printf("[040] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_execute($stmt))
+ printf("[040] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_close($stmt))
- printf("[041] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_close($stmt))
+ printf("[041] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!$stmt = mysqli_prepare($link, 'SELECT @version AS _version'))
- printf("[042] Cannot prepare SELECT, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_prepare($link, 'SELECT @version AS _version'))
+ printf("[042] Cannot prepare SELECT, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_stmt_execute($stmt))
- printf("[043] Cannot execute SELECT, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_execute($stmt))
+ printf("[043] Cannot execute SELECT, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $version = 'unknown';
- if (!mysqli_stmt_bind_result($stmt, $version) ||
- !mysqli_stmt_fetch($stmt))
- printf("[044] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $version = 'unknown';
+ if (!mysqli_stmt_bind_result($stmt, $version) ||
+ !mysqli_stmt_fetch($stmt))
+ printf("[044] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if ($version !== "myversion")
- printf("[045] Results seem wrong, got %s, [%d] %s\n",
- $version,
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if ($version !== "myversion")
+ printf("[045] Results seem wrong, got %s, [%d] %s\n",
+ $version,
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_free_result($stmt);
- mysqli_stmt_close($stmt);
+ mysqli_stmt_free_result($stmt);
+ mysqli_stmt_close($stmt);
- } else {
- printf("[046] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
- }
+ } else {
+ printf("[046] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+ }
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_execute_stored_proc_next_result.phpt b/ext/mysqli/tests/mysqli_stmt_execute_stored_proc_next_result.phpt
index aed04962f2..f322a1a76c 100644
--- a/ext/mysqli/tests/mysqli_stmt_execute_stored_proc_next_result.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_execute_stored_proc_next_result.phpt
@@ -14,104 +14,104 @@ if (mysqli_get_server_version($link) < 50503) {
?>
--FILE--
<?php
- require_once('connect.inc');
+ require_once('connect.inc');
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
- if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
- printf("[003] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
+ printf("[003] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
- if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25)) BEGIN SELECT ver_in AS _ver_out; END;')) {
- // one result set
- if (!$stmt = mysqli_prepare($link, 'CALL p(?)'))
- printf("[005] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25)) BEGIN SELECT ver_in AS _ver_out; END;')) {
+ // one result set
+ if (!$stmt = mysqli_prepare($link, 'CALL p(?)'))
+ printf("[005] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $version = 'myversion';
- if (!mysqli_stmt_bind_param($stmt, 's', $version))
- printf("[006] Cannot bind input parameter, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $version = 'myversion';
+ if (!mysqli_stmt_bind_param($stmt, 's', $version))
+ printf("[006] Cannot bind input parameter, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_execute($stmt))
- printf("[007] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_execute($stmt))
+ printf("[007] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $version = 'unknown';
- if (!mysqli_stmt_bind_result($stmt, $version) ||
- !mysqli_stmt_fetch($stmt))
- printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $version = 'unknown';
+ if (!mysqli_stmt_bind_result($stmt, $version) ||
+ !mysqli_stmt_fetch($stmt))
+ printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if ($version !== "myversion")
- printf("[009] Results seem wrong, got %s, [%d] %s\n",
- $version,
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if ($version !== "myversion")
+ printf("[009] Results seem wrong, got %s, [%d] %s\n",
+ $version,
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_free_result($stmt);
+ mysqli_stmt_free_result($stmt);
- printf("[010] More results: %s\n", (mysqli_more_results($link)) ? "yes" : "no");
- printf("[011] Next result: %s\n", (mysqli_next_result($link)) ? "yes" : "no");
+ printf("[010] More results: %s\n", (mysqli_more_results($link)) ? "yes" : "no");
+ printf("[011] Next result: %s\n", (mysqli_next_result($link)) ? "yes" : "no");
- if (!mysqli_stmt_close($stmt))
- printf("[012] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_close($stmt))
+ printf("[012] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!$link->query("SELECT 1"))
- printf("[013] [%d] %s\n", $link->errno, $link->error);
+ if (!$link->query("SELECT 1"))
+ printf("[013] [%d] %s\n", $link->errno, $link->error);
- } else {
- printf("[004] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
- }
+ } else {
+ printf("[004] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+ }
- if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
- printf("[014] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
+ printf("[014] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
- if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25)) BEGIN SELECT ver_in AS _ver_out; SELECT 1 AS _more; END;')) {
- // two result sets
- if (!$stmt = mysqli_prepare($link, 'CALL p(?)'))
- printf("[015] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25)) BEGIN SELECT ver_in AS _ver_out; SELECT 1 AS _more; END;')) {
+ // two result sets
+ if (!$stmt = mysqli_prepare($link, 'CALL p(?)'))
+ printf("[015] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $version = 'myversion';
- if (!mysqli_stmt_bind_param($stmt, 's', $version))
- printf("[016] Cannot bind input parameter, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $version = 'myversion';
+ if (!mysqli_stmt_bind_param($stmt, 's', $version))
+ printf("[016] Cannot bind input parameter, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_execute($stmt))
- printf("[017] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_execute($stmt))
+ printf("[017] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $version = NULL;
- if (!mysqli_stmt_bind_result($stmt, $version) ||
- !mysqli_stmt_fetch($stmt))
- printf("[018] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $version = NULL;
+ if (!mysqli_stmt_bind_result($stmt, $version) ||
+ !mysqli_stmt_fetch($stmt))
+ printf("[018] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if ($version !== "myversion")
- printf("[019] Results seem wrong, got %s, [%d] %s\n",
- $version,
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if ($version !== "myversion")
+ printf("[019] Results seem wrong, got %s, [%d] %s\n",
+ $version,
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_more_results($link) || !mysqli_next_result($link))
- printf("[020] [%d] %s\n", $link->errno, $link->error);
+ if (!mysqli_more_results($link) || !mysqli_next_result($link))
+ printf("[020] [%d] %s\n", $link->errno, $link->error);
- $more = NULL;
- if (!mysqli_stmt_bind_result($stmt, $more) ||
- !mysqli_stmt_fetch($stmt))
- printf("[021] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $more = NULL;
+ if (!mysqli_stmt_bind_result($stmt, $more) ||
+ !mysqli_stmt_fetch($stmt))
+ printf("[021] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if ($more !== 1)
- printf("[022] Results seem wrong, got %s, [%d] %s\n",
- $more,
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if ($more !== 1)
+ printf("[022] Results seem wrong, got %s, [%d] %s\n",
+ $more,
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_close($stmt))
- printf("[023] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_close($stmt))
+ printf("[023] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!$link->query("SELECT 1"))
- printf("[024] [%d] %s\n", $link->errno, $link->error);
+ if (!$link->query("SELECT 1"))
+ printf("[024] [%d] %s\n", $link->errno, $link->error);
- } else {
- printf("[025] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
- }
+ } else {
+ printf("[025] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+ }
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_execute_stored_proc_out.phpt b/ext/mysqli/tests/mysqli_stmt_execute_stored_proc_out.phpt
index 6ab270b8f4..c65330ebc9 100644
--- a/ext/mysqli/tests/mysqli_stmt_execute_stored_proc_out.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_execute_stored_proc_out.phpt
@@ -19,49 +19,49 @@ if ($IS_MYSQLND) {
?>
--FILE--
<?php
- require_once('connect.inc');
+ require_once('connect.inc');
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
- if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
- printf("[003] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p'))
+ printf("[003] [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
- if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25), OUT ver_out VARCHAR(25)) BEGIN SELECT ver_in INTO ver_out; END;')) {
- if (!$stmt = mysqli_prepare($link, 'CALL p(?, ?)'))
- printf("[005] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25), OUT ver_out VARCHAR(25)) BEGIN SELECT ver_in INTO ver_out; END;')) {
+ if (!$stmt = mysqli_prepare($link, 'CALL p(?, ?)'))
+ printf("[005] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $ver_in = 'myversion';
- $ver_out = '';
- if (!mysqli_stmt_bind_param($stmt, 'ss', $ver_in, $ver_out))
- printf("[006] Cannot bind parameter, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $ver_in = 'myversion';
+ $ver_out = '';
+ if (!mysqli_stmt_bind_param($stmt, 'ss', $ver_in, $ver_out))
+ printf("[006] Cannot bind parameter, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_execute($stmt))
- printf("[007] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_execute($stmt))
+ printf("[007] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- printf("[008] More results: %s\n", (mysqli_more_results($link) ? "yes" : "no"));
- printf("[009] Next results: %s\n", (mysqli_next_result($link) ? "yes" : "no"));
+ printf("[008] More results: %s\n", (mysqli_more_results($link) ? "yes" : "no"));
+ printf("[009] Next results: %s\n", (mysqli_next_result($link) ? "yes" : "no"));
- if (!mysqli_stmt_bind_result($stmt, $ver_out) || !mysqli_stmt_fetch($stmt))
- printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_bind_result($stmt, $ver_out) || !mysqli_stmt_fetch($stmt))
+ printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if ("myversion" !== $ver_out)
- printf("[011] Results seem wrong got '%s'\n", $ver_out);
+ if ("myversion" !== $ver_out)
+ printf("[011] Results seem wrong got '%s'\n", $ver_out);
- if (!mysqli_stmt_close($stmt))
- printf("[012] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_close($stmt))
+ printf("[012] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!$res = $link->query("SELECT 1"))
- printf("[013] [%d] %s\n", $link->errno, $link->error);
+ if (!$res = $link->query("SELECT 1"))
+ printf("[013] [%d] %s\n", $link->errno, $link->error);
- } else {
- printf("[004] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
- }
+ } else {
+ printf("[004] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link));
+ }
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_fetch.phpt b/ext/mysqli/tests/mysqli_stmt_fetch.phpt
index 4b41c9213d..4dce9dfefa 100644
--- a/ext/mysqli/tests/mysqli_stmt_fetch.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_fetch.phpt
@@ -8,91 +8,81 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- /*
- NOTE: no datatype tests here! This is done by
- mysqli_stmt_bind_result.phpt already. Restrict
- this test case to the basics.
- */
- require_once("connect.inc");
+ /*
+ NOTE: no datatype tests here! This is done by
+ mysqli_stmt_bind_result.phpt already. Restrict
+ this test case to the basics.
+ */
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ require('table.inc');
- if (!is_null($tmp = @mysqli_stmt_fetch()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_null($tmp = @mysqli_stmt_fetch($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ // stmt object status test
+ try {
+ mysqli_stmt_fetch($stmt);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- require('table.inc');
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2"))
+ printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!$stmt = mysqli_stmt_init($link))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ // FIXME - different versions return different values ?!
+ if ((NULL !== ($tmp = mysqli_stmt_fetch($stmt))) && (false !== $tmp))
+ printf("[006] Expecting NULL or boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- // stmt object status test
- if (false !== ($tmp = mysqli_stmt_fetch($stmt)))
- printf("[004] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_stmt_execute($stmt))
+ printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2"))
- printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (true !== ($tmp = mysqli_stmt_fetch($stmt)))
+ printf("[008] NULL, got %s/%s\n", gettype($tmp), $tmp);
- // FIXME - different versions return different values ?!
- if ((NULL !== ($tmp = mysqli_stmt_fetch($stmt))) && (false !== $tmp))
- printf("[006] Expecting NULL or boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ mysqli_stmt_close($stmt);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_stmt_execute($stmt))
- printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2"))
+ printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (true !== ($tmp = mysqli_stmt_fetch($stmt)))
- printf("[008] NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_stmt_execute($stmt))
+ printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_close($stmt);
- if (!$stmt = mysqli_stmt_init($link))
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $id = NULL;
+ $label = NULL;
+ if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label)))
+ printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2"))
- printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (true !== ($tmp = mysqli_stmt_fetch($stmt)))
+ printf("[013] Expecting boolean/true, got %s/%s, [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_execute($stmt))
- printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_kill($link, mysqli_thread_id($link)))
+ printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $id = NULL;
- $label = NULL;
- if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label)))
- printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_stmt_fetch($stmt)))
+ printf("[015] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (true !== ($tmp = mysqli_stmt_fetch($stmt)))
- printf("[013] Expecting boolean/true, got %s/%s, [%d] %s\n",
- gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_stmt_close($stmt);
- if (!mysqli_kill($link, mysqli_thread_id($link)))
- printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ try {
+ mysqli_stmt_fetch($stmt);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- if (true !== ($tmp = mysqli_stmt_fetch($stmt)))
- printf("[015] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ mysqli_close($link);
- mysqli_stmt_close($stmt);
-
- if (false !== ($tmp = mysqli_stmt_fetch($stmt)))
- printf("[016] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_close($link);
-
- /* Check that the function alias exists. It's a deprecated function,
- but we have not announce the removal so far, therefore we need to check for it */
- if (!is_null($tmp = @mysqli_stmt_fetch()))
- printf("[017] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
--EXPECTF--
-Warning: mysqli_stmt_fetch(): invalid object or resource mysqli_stmt
- in %s on line %d
+mysqli_stmt object is not fully initialized
[014] [%d] Commands out of sync; you can't run this command now
-
-Warning: mysqli_stmt_fetch(): Couldn't fetch mysqli_stmt in %s on line %d
+mysqli_stmt object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_stmt_fetch_bit.phpt b/ext/mysqli/tests/mysqli_stmt_fetch_bit.phpt
index 495fcdce7d..b3c74e4af2 100644
--- a/ext/mysqli/tests/mysqli_stmt_fetch_bit.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_fetch_bit.phpt
@@ -16,57 +16,57 @@ Fetching BIT column values using the PS API
?>
--FILE--
<?php
- require('connect.inc');
+ require('connect.inc');
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- /* NOTE: works only for up to 31 bits! This limitation should be documented. */
- for ($bits = 1; $bits < 32; $bits++) {
- $max_value = pow(2, $bits) - 1;
- $tests = 0;
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test") ||
- !mysqli_query($link, $sql = sprintf('CREATE TABLE test(id INT, label BIT(%d)) ENGINE="%s"', $bits, $engine)))
- printf("[002 - %d] [%d] %s\n",$bits, mysqli_errno($link), mysqli_error($link));
+ /* NOTE: works only for up to 31 bits! This limitation should be documented. */
+ for ($bits = 1; $bits < 32; $bits++) {
+ $max_value = pow(2, $bits) - 1;
+ $tests = 0;
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test") ||
+ !mysqli_query($link, $sql = sprintf('CREATE TABLE test(id INT, label BIT(%d)) ENGINE="%s"', $bits, $engine)))
+ printf("[002 - %d] [%d] %s\n",$bits, mysqli_errno($link), mysqli_error($link));
- if (!$stmt = mysqli_stmt_init($link))
- printf("[003 - %d] [%d] %s\n", $bits, mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[003 - %d] [%d] %s\n", $bits, mysqli_errno($link), mysqli_error($link));
- while ($tests < min($max_value, 20)) {
- $tests++;
- $value = mt_rand(0, $max_value);
- $sql = sprintf("INSERT INTO test(id, label) VALUES (%d, b'%s')", $value, decbin($value));
+ while ($tests < min($max_value, 20)) {
+ $tests++;
+ $value = mt_rand(0, $max_value);
+ $sql = sprintf("INSERT INTO test(id, label) VALUES (%d, b'%s')", $value, decbin($value));
- if (!mysqli_stmt_prepare($stmt, $sql) ||
- !mysqli_stmt_execute($stmt))
- printf("[004 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, $sql) ||
+ !mysqli_stmt_execute($stmt))
+ printf("[004 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $id = $_label0 = $label = null;
- $sql = sprintf("SELECT id, label + 0 AS _label0, label FROM test WHERE id = %d", $value);
- if (!mysqli_stmt_prepare($stmt, $sql) ||
- !mysqli_stmt_execute($stmt) ||
- !mysqli_stmt_bind_result($stmt, $id, $_label0, $label))
- printf("[005 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $id = $_label0 = $label = null;
+ $sql = sprintf("SELECT id, label + 0 AS _label0, label FROM test WHERE id = %d", $value);
+ if (!mysqli_stmt_prepare($stmt, $sql) ||
+ !mysqli_stmt_execute($stmt) ||
+ !mysqli_stmt_bind_result($stmt, $id, $_label0, $label))
+ printf("[005 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_fetch($stmt))
- printf("[006 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_fetch($stmt))
+ printf("[006 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (($id !== $_label0) || ($value !== $_label0)) {
- printf("[007 - %d] Insert of %d in BIT(%d) column might have failed. MySQL reports odd values, id = %s, _label0 = %s, label = %s.\n", $bits, $value, $bits, $id, $_label0, $label);
- }
- if ($value != $label) {
- printf("[008 - %d] Wrong values, (original) value = %s, id = %s, label + 0 AS label0 = %s, label = %s\n",
- $bits, $value, $id, $_label0, $label);
- }
- }
+ if (($id !== $_label0) || ($value !== $_label0)) {
+ printf("[007 - %d] Insert of %d in BIT(%d) column might have failed. MySQL reports odd values, id = %s, _label0 = %s, label = %s.\n", $bits, $value, $bits, $id, $_label0, $label);
+ }
+ if ($value != $label) {
+ printf("[008 - %d] Wrong values, (original) value = %s, id = %s, label + 0 AS label0 = %s, label = %s\n",
+ $bits, $value, $id, $_label0, $label);
+ }
+ }
- mysqli_stmt_close($stmt);
+ mysqli_stmt_close($stmt);
- }
+ }
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_fetch_fields_win32_unicode.phpt b/ext/mysqli/tests/mysqli_stmt_fetch_fields_win32_unicode.phpt
index 14333e7665..fe5d2f3799 100644
--- a/ext/mysqli/tests/mysqli_stmt_fetch_fields_win32_unicode.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_fetch_fields_win32_unicode.phpt
@@ -8,43 +8,43 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
- require_once('table.inc');
+ require_once("connect.inc");
+ require_once('table.inc');
- $bind_res = $id = null;
- if (!($stmt = mysqli_stmt_init($link)) ||
- !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test") ||
- !mysqli_stmt_execute($stmt) ||
- !($result = mysqli_stmt_result_metadata($stmt)) ||
- !mysqli_stmt_bind_result($stmt, $id, $bind_res) ||
- !($fields = mysqli_fetch_fields($result))) {
- printf("FAIL 1\n");
- }
- while (mysqli_stmt_fetch($stmt)) {
- ;
- }
- mysqli_free_result($result);
- mysqli_stmt_close($stmt);
+ $bind_res = $id = null;
+ if (!($stmt = mysqli_stmt_init($link)) ||
+ !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test") ||
+ !mysqli_stmt_execute($stmt) ||
+ !($result = mysqli_stmt_result_metadata($stmt)) ||
+ !mysqli_stmt_bind_result($stmt, $id, $bind_res) ||
+ !($fields = mysqli_fetch_fields($result))) {
+ printf("FAIL 1\n");
+ }
+ while (mysqli_stmt_fetch($stmt)) {
+ ;
+ }
+ mysqli_free_result($result);
+ mysqli_stmt_close($stmt);
- if (!($stmt = mysqli_stmt_init($link)) ||
- !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test") ||
- !mysqli_stmt_execute($stmt) ||
- !($result = mysqli_stmt_result_metadata($stmt)) ||
- !mysqli_stmt_bind_result($stmt, $id, $bind_res)) {
- printf("FAIL 2\n");
- }
- print "OK: 1\n";
- if (!($fields = mysqli_fetch_fields($result)))
- printf("Aua 3\n");
- print "OK: 2\n";
- while (mysqli_stmt_fetch($stmt)) {
- ;
- }
- mysqli_free_result($result);
- mysqli_stmt_close($stmt);
+ if (!($stmt = mysqli_stmt_init($link)) ||
+ !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test") ||
+ !mysqli_stmt_execute($stmt) ||
+ !($result = mysqli_stmt_result_metadata($stmt)) ||
+ !mysqli_stmt_bind_result($stmt, $id, $bind_res)) {
+ printf("FAIL 2\n");
+ }
+ print "OK: 1\n";
+ if (!($fields = mysqli_fetch_fields($result)))
+ printf("Aua 3\n");
+ print "OK: 2\n";
+ while (mysqli_stmt_fetch($stmt)) {
+ ;
+ }
+ mysqli_free_result($result);
+ mysqli_stmt_close($stmt);
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_fetch_geom.phpt b/ext/mysqli/tests/mysqli_stmt_fetch_geom.phpt
index f76d407ad0..8c87199602 100644
--- a/ext/mysqli/tests/mysqli_stmt_fetch_geom.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_fetch_geom.phpt
@@ -11,128 +11,128 @@ mysqli_stmt_fetch - geometry / spatial types
?>
--FILE--
<?php
- require('connect.inc');
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
-
- function func_mysqli_stmt_fetch_geom($link, $engine, $sql_type, $bind_value, $offset) {
-
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
- printf("[%04d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if (!mysqli_query($link, sprintf("CREATE TABLE test(id INT, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) {
- // don't bail - column type might not be supported by the server, ignore this
- return false;
- }
-
- for ($id = 1; $id < 4; $id++) {
- $sql = sprintf("INSERT INTO test(id, label) VALUES (%d, %s)", $id, $bind_value);
- if (!mysqli_query($link, $sql)) {
- printf("[%04d] [%d] %s\n", $offset + 2 + $id, mysqli_errno($link), mysqli_error($link));
- }
- }
-
- if (!$stmt = mysqli_stmt_init($link)) {
- printf("[%04d] [%d] %s\n", $offset + 6, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test")) {
- printf("[%04d] [%d] %s\n", $offset + 7, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_close($stmt);
- return false;
- }
-
- if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_store_result($stmt)) {
- printf("[%04d] [%d] %s\n", $offset + 8, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_close($stmt);
- return false;
- }
-
- if (!mysqli_stmt_bind_result($stmt, $id, $bind_res)) {
- printf("[%04d] [%d] %s\n", $offset + 9, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_close($stmt);
- return false;
- }
-
- $result = mysqli_stmt_result_metadata($stmt);
- $fields = mysqli_fetch_fields($result);
- if ($fields[1]->type != MYSQLI_TYPE_GEOMETRY) {
- printf("[%04d] [%d] %s wrong type %d\n", $offset + 10, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), $fields[1]->type);
- }
-
- $num = 0;
- $rows = array();
- while (true === @mysqli_stmt_fetch($stmt)) {
- $rows[] = array('id' => $id, 'label' => $bind_res);
- $num++;
- }
-
- if ($num != 3) {
- printf("[%04d] [%d] %s, expecting 3 results, got only %d results\n",
- $offset + 17, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), $num);
- return false;
- }
- mysqli_stmt_close($stmt);
-
- foreach ($rows as $row) {
- if (!$stmt = mysqli_stmt_init($link)) {
- printf("[%04d] [%d] %s\n", $offset + 10, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)")) {
- printf("[%04d] [%d] %s\n", $offset + 11, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
-
- $new_id = $row['id'] + 10;
- if (!mysqli_stmt_bind_param($stmt, "is", $new_id, $row['label'])) {
- printf("[%04d] [%d] %s\n", $offset + 12, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
-
- if (!mysqli_stmt_execute($stmt)) {
- printf("[%04d] [%d] %s\n", $offset + 13, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
- mysqli_stmt_close($stmt);
-
- if (!$res_normal = mysqli_query($link, sprintf("SELECT id, label FROM test WHERE id = %d",
- $new_id))) {
- printf("[%04d] [%d] %s\n", $offset + 14, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if (!$row_normal = mysqli_fetch_assoc($res_normal)) {
- printf("[%04d] [%d] %s\n", $offset + 15, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if ($row_normal['label'] != $row['label']) {
- printf("[%04d] PS and non-PS return different data.\n", $offset + 16);
- return false;
- }
- mysqli_free_result($res_normal);
- }
-
- return true;
- }
-
- $geomFromText = $link->server_version >= 80000 ? "ST_GeomFromText" : "GeomFromText";
- func_mysqli_stmt_fetch_geom($link, $engine, "GEOMETRY", "$geomFromText('POINT(2 2)')", 20);
- func_mysqli_stmt_fetch_geom($link, $engine, "POINT", "$geomFromText('POINT(1 1)')", 40);
- func_mysqli_stmt_fetch_geom($link, $engine, "LINESTRING", "$geomFromText('LINESTRING(0 0,1 1,2 2)')", 60);
- func_mysqli_stmt_fetch_geom($link, $engine, "POLYGON", "$geomFromText('POLYGON((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5))')", 80);
- func_mysqli_stmt_fetch_geom($link, $engine, "MULTIPOINT", "$geomFromText('MULTIPOINT(1 1, 2 2)')", 100);
- func_mysqli_stmt_fetch_geom($link, $engine, "MULTILINESTRING", "$geomFromText('MULTILINESTRING((0 0,1 1,2 2),(0 0,1 1,3 3))')", 120);
- func_mysqli_stmt_fetch_geom($link, $engine, "MULTIPOLYGON", "$geomFromText('MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5)),((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5)))')", 140);
- func_mysqli_stmt_fetch_geom($link, $engine, "GEOMETRYCOLLECTION", "$geomFromText('GEOMETRYCOLLECTION(POINT(1 1),LINESTRING(0 0,1 1,2 2,3 3,4 4))')", 160);
-
- mysqli_close($link);
- print "done!";
+ require('connect.inc');
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+
+ function func_mysqli_stmt_fetch_geom($link, $engine, $sql_type, $bind_value, $offset) {
+
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
+ printf("[%04d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if (!mysqli_query($link, sprintf("CREATE TABLE test(id INT, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) {
+ // don't bail - column type might not be supported by the server, ignore this
+ return false;
+ }
+
+ for ($id = 1; $id < 4; $id++) {
+ $sql = sprintf("INSERT INTO test(id, label) VALUES (%d, %s)", $id, $bind_value);
+ if (!mysqli_query($link, $sql)) {
+ printf("[%04d] [%d] %s\n", $offset + 2 + $id, mysqli_errno($link), mysqli_error($link));
+ }
+ }
+
+ if (!$stmt = mysqli_stmt_init($link)) {
+ printf("[%04d] [%d] %s\n", $offset + 6, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test")) {
+ printf("[%04d] [%d] %s\n", $offset + 7, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_stmt_close($stmt);
+ return false;
+ }
+
+ if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_store_result($stmt)) {
+ printf("[%04d] [%d] %s\n", $offset + 8, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_stmt_close($stmt);
+ return false;
+ }
+
+ if (!mysqli_stmt_bind_result($stmt, $id, $bind_res)) {
+ printf("[%04d] [%d] %s\n", $offset + 9, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_stmt_close($stmt);
+ return false;
+ }
+
+ $result = mysqli_stmt_result_metadata($stmt);
+ $fields = mysqli_fetch_fields($result);
+ if ($fields[1]->type != MYSQLI_TYPE_GEOMETRY) {
+ printf("[%04d] [%d] %s wrong type %d\n", $offset + 10, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), $fields[1]->type);
+ }
+
+ $num = 0;
+ $rows = array();
+ while (true === @mysqli_stmt_fetch($stmt)) {
+ $rows[] = array('id' => $id, 'label' => $bind_res);
+ $num++;
+ }
+
+ if ($num != 3) {
+ printf("[%04d] [%d] %s, expecting 3 results, got only %d results\n",
+ $offset + 17, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), $num);
+ return false;
+ }
+ mysqli_stmt_close($stmt);
+
+ foreach ($rows as $row) {
+ if (!$stmt = mysqli_stmt_init($link)) {
+ printf("[%04d] [%d] %s\n", $offset + 10, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)")) {
+ printf("[%04d] [%d] %s\n", $offset + 11, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+
+ $new_id = $row['id'] + 10;
+ if (!mysqli_stmt_bind_param($stmt, "is", $new_id, $row['label'])) {
+ printf("[%04d] [%d] %s\n", $offset + 12, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+
+ if (!mysqli_stmt_execute($stmt)) {
+ printf("[%04d] [%d] %s\n", $offset + 13, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+ mysqli_stmt_close($stmt);
+
+ if (!$res_normal = mysqli_query($link, sprintf("SELECT id, label FROM test WHERE id = %d",
+ $new_id))) {
+ printf("[%04d] [%d] %s\n", $offset + 14, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if (!$row_normal = mysqli_fetch_assoc($res_normal)) {
+ printf("[%04d] [%d] %s\n", $offset + 15, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if ($row_normal['label'] != $row['label']) {
+ printf("[%04d] PS and non-PS return different data.\n", $offset + 16);
+ return false;
+ }
+ mysqli_free_result($res_normal);
+ }
+
+ return true;
+ }
+
+ $geomFromText = $link->server_version >= 80000 ? "ST_GeomFromText" : "GeomFromText";
+ func_mysqli_stmt_fetch_geom($link, $engine, "GEOMETRY", "$geomFromText('POINT(2 2)')", 20);
+ func_mysqli_stmt_fetch_geom($link, $engine, "POINT", "$geomFromText('POINT(1 1)')", 40);
+ func_mysqli_stmt_fetch_geom($link, $engine, "LINESTRING", "$geomFromText('LINESTRING(0 0,1 1,2 2)')", 60);
+ func_mysqli_stmt_fetch_geom($link, $engine, "POLYGON", "$geomFromText('POLYGON((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5))')", 80);
+ func_mysqli_stmt_fetch_geom($link, $engine, "MULTIPOINT", "$geomFromText('MULTIPOINT(1 1, 2 2)')", 100);
+ func_mysqli_stmt_fetch_geom($link, $engine, "MULTILINESTRING", "$geomFromText('MULTILINESTRING((0 0,1 1,2 2),(0 0,1 1,3 3))')", 120);
+ func_mysqli_stmt_fetch_geom($link, $engine, "MULTIPOLYGON", "$geomFromText('MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5)),((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5)))')", 140);
+ func_mysqli_stmt_fetch_geom($link, $engine, "GEOMETRYCOLLECTION", "$geomFromText('GEOMETRYCOLLECTION(POINT(1 1),LINESTRING(0 0,1 1,2 2,3 3,4 4))')", 160);
+
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_field_count.phpt b/ext/mysqli/tests/mysqli_stmt_field_count.phpt
index 847fe04a3b..51afb04e1b 100644
--- a/ext/mysqli/tests/mysqli_stmt_field_count.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_field_count.phpt
@@ -8,95 +8,94 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_field_count()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_field_count($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- require('table.inc');
-
- $stmt = mysqli_stmt_init($link);
- if (false !== ($tmp = mysqli_stmt_field_count($stmt)))
- printf("[003] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (mysqli_stmt_prepare($stmt, ''))
- printf("[004] Prepare should fail for an empty statement\n");
-
- if (false !== ($tmp = mysqli_stmt_field_count($stmt)))
- printf("[005] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_stmt_prepare($stmt, 'SELECT 1'))
- printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (1 !== ($tmp = mysqli_stmt_field_count($stmt)))
- printf("[007] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_stmt_prepare($stmt, 'SELECT 1, 2'))
- printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (2 !== ($tmp = mysqli_stmt_field_count($stmt)))
- printf("[009] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test'))
- printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (2 !== ($tmp = mysqli_stmt_field_count($stmt)))
- printf("[011] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_stmt_prepare($stmt, 'SELECT label FROM test') ||
- !mysqli_stmt_execute($stmt))
- printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (1 !== ($tmp = mysqli_stmt_field_count($stmt)))
- printf("[013] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
-
- $label = null;
- if (mysqli_stmt_bind_param($stmt, "s", $label))
- printf("[014] expected error - got ok\n");
- while (mysqli_stmt_fetch($stmt))
- if (1 !== ($tmp = mysqli_stmt_field_count($stmt)))
- printf("[015] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_stmt_prepare($stmt, 'INSERT INTO test(id) VALUES (100)'))
- printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (0 !== ($tmp = mysqli_stmt_field_count($stmt)))
- printf("[017] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_stmt_prepare($stmt, "UPDATE test SET label = 'z' WHERE id = 1") ||
- !mysqli_stmt_execute($stmt))
- printf("[018] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (0 !== ($tmp = mysqli_stmt_field_count($stmt)))
- printf("[019] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_stmt_close($stmt);
-
- if (mysqli_stmt_prepare($stmt, 'SELECT id FROM test'))
- printf("[020] Prepare should fail, statement has been closed\n");
-
- if (false !== ($tmp = mysqli_stmt_field_count($stmt)))
- printf("[021] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_close($link);
-
- print "done!";
+ require_once("connect.inc");
+
+ require('table.inc');
+
+ $stmt = mysqli_stmt_init($link);
+
+ try {
+ mysqli_stmt_field_count($stmt);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ if (mysqli_stmt_prepare($stmt, ''))
+ printf("[004] Prepare should fail for an empty statement\n");
+
+ try {
+ mysqli_stmt_field_count($stmt);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ if (!mysqli_stmt_prepare($stmt, 'SELECT 1'))
+ printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (1 !== ($tmp = mysqli_stmt_field_count($stmt)))
+ printf("[007] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_stmt_prepare($stmt, 'SELECT 1, 2'))
+ printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (2 !== ($tmp = mysqli_stmt_field_count($stmt)))
+ printf("[009] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test'))
+ printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (2 !== ($tmp = mysqli_stmt_field_count($stmt)))
+ printf("[011] Expecting int/2, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_stmt_prepare($stmt, 'SELECT label FROM test') ||
+ !mysqli_stmt_execute($stmt))
+ printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (1 !== ($tmp = mysqli_stmt_field_count($stmt)))
+ printf("[013] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
+
+ $label = null;
+ if (mysqli_stmt_bind_param($stmt, "s", $label))
+ printf("[014] expected error - got ok\n");
+ while (mysqli_stmt_fetch($stmt))
+ if (1 !== ($tmp = mysqli_stmt_field_count($stmt)))
+ printf("[015] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_stmt_prepare($stmt, 'INSERT INTO test(id) VALUES (100)'))
+ printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (0 !== ($tmp = mysqli_stmt_field_count($stmt)))
+ printf("[017] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_stmt_prepare($stmt, "UPDATE test SET label = 'z' WHERE id = 1") ||
+ !mysqli_stmt_execute($stmt))
+ printf("[018] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (0 !== ($tmp = mysqli_stmt_field_count($stmt)))
+ printf("[019] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+
+ mysqli_stmt_close($stmt);
+
+ try {
+ mysqli_stmt_prepare($stmt, 'SELECT id FROM test');
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ try {
+ mysqli_stmt_field_count($stmt);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ mysqli_close($link);
+
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
--EXPECTF--
-Warning: mysqli_stmt_field_count(): invalid object or resource mysqli_stmt
- in %s on line %d
-
-Warning: mysqli_stmt_field_count(): invalid object or resource mysqli_stmt
- in %s on line %d
+mysqli_stmt object is not fully initialized
+mysqli_stmt object is not fully initialized
Warning: mysqli_stmt_bind_param(): Number of variables doesn't match number of parameters in prepared statement in %s on line %d
-
-Warning: mysqli_stmt_prepare(): Couldn't fetch mysqli_stmt in %s on line %d
-
-Warning: mysqli_stmt_field_count(): Couldn't fetch mysqli_stmt in %s on line %d
+mysqli_stmt object is already closed
+mysqli_stmt object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_stmt_free_result.phpt b/ext/mysqli/tests/mysqli_stmt_free_result.phpt
index 292905ab63..b43afce5c9 100644
--- a/ext/mysqli/tests/mysqli_stmt_free_result.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_free_result.phpt
@@ -8,79 +8,74 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- /*
- NOTE: no datatype tests here! This is done by
- mysqli_stmt_bind_result.phpt already. Restrict
- this test case to the basics.
- */
- require_once("connect.inc");
+ /*
+ NOTE: no datatype tests here! This is done by
+ mysqli_stmt_bind_result.phpt already. Restrict
+ this test case to the basics.
+ */
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ require('table.inc');
- if (!is_null($tmp = @mysqli_stmt_free_result()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_null($tmp = @mysqli_stmt_free_result($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ // stmt object status test
+ try {
+ mysqli_stmt_free_result($stmt);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- require('table.inc');
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id"))
+ printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!$stmt = mysqli_stmt_init($link))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (NULL !== ($tmp = mysqli_stmt_free_result($stmt)))
+ printf("[006] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- // stmt object status test
- if (false !== ($tmp = mysqli_stmt_free_result($stmt)))
- printf("[004] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_stmt_execute($stmt))
+ printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id"))
- printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (NULL !== ($tmp = mysqli_stmt_free_result($stmt)))
+ printf("[008] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (NULL !== ($tmp = mysqli_stmt_free_result($stmt)))
- printf("[006] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_stmt_store_result($stmt)))
+ printf("[009] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_execute($stmt))
- printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_stmt_close($stmt);
- if (NULL !== ($tmp = mysqli_stmt_free_result($stmt)))
- printf("[008] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (false !== ($tmp = mysqli_stmt_store_result($stmt)))
- printf("[009] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id"))
+ printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_close($stmt);
+ if (!mysqli_stmt_execute($stmt))
+ printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!$stmt = mysqli_stmt_init($link))
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (true !== ($tmp = mysqli_stmt_store_result($stmt)))
+ printf("[013] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id"))
- printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (NULL !== ($tmp = mysqli_stmt_free_result($stmt)))
+ printf("[014] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_execute($stmt))
- printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_stmt_close($stmt);
- if (true !== ($tmp = mysqli_stmt_store_result($stmt)))
- printf("[013] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ try {
+ mysqli_stmt_free_result($stmt);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- if (NULL !== ($tmp = mysqli_stmt_free_result($stmt)))
- printf("[014] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ mysqli_close($link);
- mysqli_stmt_close($stmt);
-
- if (false !== ($tmp = mysqli_stmt_free_result($stmt)))
- printf("[015] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_close($link);
-
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
---EXPECTF--
-Warning: mysqli_stmt_free_result(): invalid object or resource mysqli_stmt
- in %s on line %d
-
-Warning: mysqli_stmt_free_result(): Couldn't fetch mysqli_stmt in %s on line %d
+--EXPECT--
+mysqli_stmt object is not fully initialized
+mysqli_stmt object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_stmt_get_result.phpt b/ext/mysqli/tests/mysqli_stmt_get_result.phpt
index e8f2843920..09c63ab7f8 100644
--- a/ext/mysqli/tests/mysqli_stmt_get_result.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_get_result.phpt
@@ -11,163 +11,161 @@ if (!function_exists('mysqli_stmt_get_result'))
?>
--FILE--
<?php
- /*
- NOTE: no datatype tests here! This is done by
- mysqli_stmt_bind_result.phpt already. Restrict
- this test case to the basics.
- */
- require_once("connect.inc");
+ /*
+ NOTE: no datatype tests here! This is done by
+ mysqli_stmt_bind_result.phpt already. Restrict
+ this test case to the basics.
+ */
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ require('table.inc');
- if (!is_null($tmp = @mysqli_stmt_get_result()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_null($tmp = @mysqli_stmt_get_result($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ // stmt object status test
+ try {
+ mysqli_stmt_fetch($stmt);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- require('table.inc');
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2"))
+ printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!$stmt = mysqli_stmt_init($link))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ // FIXME - different versions return different values ?!
+ if ((NULL !== ($tmp = mysqli_stmt_get_result($stmt))) && (false !== $tmp))
+ printf("[006] Expecting NULL or boolean/false, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
- // stmt object status test
- if (false !== ($tmp = mysqli_stmt_fetch($stmt)))
- printf("[004] Expecting false, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
+ if (!mysqli_stmt_execute($stmt))
+ printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2"))
- printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_store_result($stmt))
+ printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- // FIXME - different versions return different values ?!
- if ((NULL !== ($tmp = mysqli_stmt_get_result($stmt))) && (false !== $tmp))
- printf("[006] Expecting NULL or boolean/false, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
+ if (is_object($tmp = mysqli_stmt_store_result($stmt)))
+ printf("[009] non-object, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
- if (!mysqli_stmt_execute($stmt))
- printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_stmt_close($stmt);
- if (!mysqli_stmt_store_result($stmt))
- printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (is_object($tmp = mysqli_stmt_store_result($stmt)))
- printf("[009] non-object, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
+ // stmt object status test
+ try {
+ mysqli_stmt_fetch($stmt);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- mysqli_stmt_close($stmt);
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2"))
+ printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!$stmt = mysqli_stmt_init($link))
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ // FIXME - different versions return different values ?!
+ if ((NULL !== ($tmp = mysqli_stmt_get_result($stmt))) && (false !== $tmp))
+ printf("[013] Expecting NULL or boolean/false, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
- // stmt object status test
- if (false !== ($tmp = mysqli_stmt_fetch($stmt)))
- printf("[011] Expecting false, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
+ if (!mysqli_stmt_execute($stmt))
+ printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2"))
- printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!is_object($tmp = mysqli_stmt_get_result($stmt)))
+ printf("[016] NULL, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
- // FIXME - different versions return different values ?!
- if ((NULL !== ($tmp = mysqli_stmt_get_result($stmt))) && (false !== $tmp))
- printf("[013] Expecting NULL or boolean/false, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
+ mysqli_free_result($tmp);
+ mysqli_stmt_close($stmt);
- if (!mysqli_stmt_execute($stmt))
- printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_object($tmp = mysqli_stmt_get_result($stmt)))
- printf("[016] NULL, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
+ // stmt object status test
+ try {
+ mysqli_stmt_get_result($stmt);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- mysqli_free_result($tmp);
- mysqli_stmt_close($stmt);
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2"))
+ printf("[019] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!$stmt = mysqli_stmt_init($link))
- printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (false !== ($tmp = mysqli_stmt_get_result($stmt)))
+ printf("[020] Expecting false, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
- // stmt object status test
- if (false !== ($tmp = mysqli_stmt_get_result($stmt)))
- printf("[018] Expecting false, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
+ if (!mysqli_stmt_execute($stmt))
+ printf("[023] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2"))
- printf("[019] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!is_object($tmp = mysqli_stmt_get_result($stmt)))
+ printf("[024] Expecting object, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
- if (false !== ($tmp = mysqli_stmt_get_result($stmt)))
- printf("[020] Expecting false, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
+ if (false !== ($tmp = mysqli_stmt_fetch($stmt)))
+ printf("[025] false, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
- if (!mysqli_stmt_execute($stmt))
- printf("[023] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label))) {
+ printf("[026] [%d] [%s]\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ printf("[027] [%d] [%s]\n", mysqli_errno($link), mysqli_error($link));
+ printf("[028] Expecting boolean/true, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
+ }
- if (!is_object($tmp = mysqli_stmt_get_result($stmt)))
- printf("[024] Expecting object, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
+ if (false !== ($tmp = mysqli_stmt_fetch($stmt)))
+ printf("[029] false, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
- if (false !== ($tmp = mysqli_stmt_fetch($stmt)))
- printf("[025] false, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
+ mysqli_stmt_close($stmt);
- if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label))) {
- printf("[026] [%d] [%s]\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- printf("[027] [%d] [%s]\n", mysqli_errno($link), mysqli_error($link));
- printf("[028] Expecting boolean/true, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
- }
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[032] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (false !== ($tmp = mysqli_stmt_fetch($stmt)))
- printf("[029] false, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2"))
+ printf("[033] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_close($stmt);
+ if (!mysqli_stmt_execute($stmt))
+ printf("[034] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!$stmt = mysqli_stmt_init($link))
- printf("[032] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $id = NULL;
+ $label = NULL;
+ if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label)))
+ printf("[035] Expecting boolean/true, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2"))
- printf("[033] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!is_object($tmp = $result = mysqli_stmt_get_result($stmt)))
+ printf("[036] Expecting array, got %s/%s, [%d] %s\n",
+ gettype($tmp), var_export($tmp, 1),
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_execute($stmt))
- printf("[034] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (false !== ($tmp = mysqli_stmt_fetch($stmt)))
+ printf("[037] Expecting boolean/false, got %s/%s, [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $id = NULL;
- $label = NULL;
- if (true !== ($tmp = mysqli_stmt_bind_result($stmt, $id, $label)))
- printf("[035] Expecting boolean/true, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
+ printf("[038] [%d] [%s]\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ printf("[039] [%d] [%s]\n", mysqli_errno($link), mysqli_error($link));
+ while ($row = mysqli_fetch_assoc($result)) {
+ var_dump($row);
+ }
+ mysqli_free_result($result);
- if (!is_object($tmp = $result = mysqli_stmt_get_result($stmt)))
- printf("[036] Expecting array, got %s/%s, [%d] %s\n",
- gettype($tmp), var_export($tmp, 1),
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_kill($link, mysqli_thread_id($link)))
+ printf("[040] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (false !== ($tmp = mysqli_stmt_fetch($stmt)))
- printf("[037] Expecting boolean/false, got %s/%s, [%d] %s\n",
- gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (false !== ($tmp = mysqli_stmt_get_result($stmt)))
+ printf("[041] Expecting false, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
- printf("[038] [%d] [%s]\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- printf("[039] [%d] [%s]\n", mysqli_errno($link), mysqli_error($link));
- while ($row = mysqli_fetch_assoc($result)) {
- var_dump($row);
- }
- mysqli_free_result($result);
+ mysqli_stmt_close($stmt);
- if (!mysqli_kill($link, mysqli_thread_id($link)))
- printf("[040] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ try {
+ mysqli_stmt_fetch($stmt);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- if (false !== ($tmp = mysqli_stmt_get_result($stmt)))
- printf("[041] Expecting false, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
+ mysqli_close($link);
- mysqli_stmt_close($stmt);
-
- if (false !== ($tmp = mysqli_stmt_fetch($stmt)))
- printf("[042] Expecting false, got %s/%s\n", gettype($tmp), var_export($tmp, 1));
-
- mysqli_close($link);
-
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
--EXPECTF--
-Warning: mysqli_stmt_fetch(): invalid object or resource mysqli_stmt
- in %s on line %d
-
-Warning: mysqli_stmt_fetch(): invalid object or resource mysqli_stmt
- in %s on line %d
-
-Warning: mysqli_stmt_get_result(): invalid object or resource mysqli_stmt
- in %s on line %d
+mysqli_stmt object is not fully initialized
+mysqli_stmt object is not fully initialized
+mysqli_stmt object is not fully initialized
[038] [2014] [Commands out of sync; you can't run this command now]
[039] [0] []
array(2) {
@@ -182,6 +180,5 @@ array(2) {
["label"]=>
%s(1) "b"
}
-
-Warning: mysqli_stmt_fetch(): Couldn't fetch mysqli_stmt in %s on line %d
+mysqli_stmt object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_stmt_get_result2.phpt b/ext/mysqli/tests/mysqli_stmt_get_result2.phpt
index 00ed7adee4..bbcb926c01 100644
--- a/ext/mysqli/tests/mysqli_stmt_get_result2.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_get_result2.phpt
@@ -10,152 +10,141 @@ if (!function_exists('mysqli_stmt_get_result'))
?>
--FILE--
<?php
- /*
- NOTE: no datatype tests here! This is done by
- mysqli_stmt_bind_result.phpt already. Restrict
- this test case to the basics.
- */
- require_once("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_get_result()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_get_result($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- require('table.inc');
-
- if (!$stmt = mysqli_stmt_init($link))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!is_null($tmp = @mysqli_stmt_get_result($stmt, "foo")))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 1"))
- printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!mysqli_stmt_execute($stmt))
- printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) {
- printf("[007] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
- gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
- while ($row = mysqli_fetch_assoc($res))
- var_dump($row);
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
-
- if (false !== ($res = mysqli_stmt_get_result($stmt))) {
- printf("[008] boolean/false got %s/%s, [%d] %s\n",
- gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
-
- mysqli_stmt_execute($stmt);
- if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) {
- printf("[009] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
- gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
- while ($row = mysqli_fetch_assoc($res))
- var_dump($row);
- var_dump(mysqli_fetch_assoc($res));
- mysqli_free_result($res);
-
- mysqli_stmt_close($stmt);
-
- if (!($stmt = mysqli_stmt_init($link)) ||
- !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2") ||
- !mysqli_stmt_execute($stmt))
- printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $id = $label = null;
- if (!mysqli_stmt_bind_result($stmt, $id, $label))
- printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!mysqli_stmt_fetch($stmt))
- printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (false !== ($res = mysqli_stmt_get_result($stmt))) {
- printf("[013] boolean/false got %s/%s, [%d] %s\n",
- gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
-
- mysqli_stmt_close($stmt);
-
- if (!($stmt = mysqli_stmt_init($link)) ||
- !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2") ||
- !mysqli_stmt_execute($stmt))
- printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) {
- printf("[015] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
- gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
-
- $id = $label = null;
- if (!mysqli_stmt_bind_result($stmt, $id, $label))
- printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!mysqli_stmt_fetch($stmt))
- printf("[017] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- mysqli_stmt_close($stmt);
-
- if (!($stmt = mysqli_stmt_init($link)) ||
- !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2") ||
- !mysqli_stmt_execute($stmt))
- printf("[018] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) {
- printf("[019] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
- gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
-
- $id = $label = null;
- if (!mysqli_stmt_bind_result($stmt, $id, $label))
- printf("[020] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $row = mysqli_fetch_assoc($res);
- if (NULL !== $id || NULL !== $label)
- printf("[021] Bound variables should not have been set\n");
- mysqli_free_result($res);
-
- mysqli_stmt_close($stmt);
-
- if (!($stmt = mysqli_stmt_init($link)) ||
- !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2") ||
- !mysqli_stmt_execute($stmt))
- printf("[022] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) {
- printf("[023] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
- gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
- if (!in_array($res->type, array(MYSQLI_STORE_RESULT, MYSQLI_USE_RESULT))) {
- printf("[024] Unknown result set type %s\n", $res->type);
- }
- if ($res->type !== MYSQLI_STORE_RESULT)
- printf("[025] Expecting int/%d got %s/%s", MYSQLI_STORE_RESULT, gettype($res->type), $res->type);
-
- mysqli_free_result($res);
- mysqli_stmt_close($stmt);
- mysqli_close($link);
-
- if (false !== ($res = mysqli_stmt_get_result($stmt))) {
- printf("[026] Expecting false got %s/%s\n",
- gettype($res), $res);
- }
-
- print "done!";
+ /*
+ NOTE: no datatype tests here! This is done by
+ mysqli_stmt_bind_result.phpt already. Restrict
+ this test case to the basics.
+ */
+ require_once("connect.inc");
+
+ require('table.inc');
+
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 1"))
+ printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!mysqli_stmt_execute($stmt))
+ printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) {
+ printf("[007] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
+ gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
+ while ($row = mysqli_fetch_assoc($res))
+ var_dump($row);
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
+
+ if (false !== ($res = mysqli_stmt_get_result($stmt))) {
+ printf("[008] boolean/false got %s/%s, [%d] %s\n",
+ gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
+
+ mysqli_stmt_execute($stmt);
+ if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) {
+ printf("[009] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
+ gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
+ while ($row = mysqli_fetch_assoc($res))
+ var_dump($row);
+ var_dump(mysqli_fetch_assoc($res));
+ mysqli_free_result($res);
+
+ mysqli_stmt_close($stmt);
+
+ if (!($stmt = mysqli_stmt_init($link)) ||
+ !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2") ||
+ !mysqli_stmt_execute($stmt))
+ printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $id = $label = null;
+ if (!mysqli_stmt_bind_result($stmt, $id, $label))
+ printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!mysqli_stmt_fetch($stmt))
+ printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (false !== ($res = mysqli_stmt_get_result($stmt))) {
+ printf("[013] boolean/false got %s/%s, [%d] %s\n",
+ gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
+
+ mysqli_stmt_close($stmt);
+
+ if (!($stmt = mysqli_stmt_init($link)) ||
+ !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2") ||
+ !mysqli_stmt_execute($stmt))
+ printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) {
+ printf("[015] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
+ gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
+
+ $id = $label = null;
+ if (!mysqli_stmt_bind_result($stmt, $id, $label))
+ printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!mysqli_stmt_fetch($stmt))
+ printf("[017] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ mysqli_stmt_close($stmt);
+
+ if (!($stmt = mysqli_stmt_init($link)) ||
+ !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2") ||
+ !mysqli_stmt_execute($stmt))
+ printf("[018] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) {
+ printf("[019] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
+ gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
+
+ $id = $label = null;
+ if (!mysqli_stmt_bind_result($stmt, $id, $label))
+ printf("[020] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $row = mysqli_fetch_assoc($res);
+ if (NULL !== $id || NULL !== $label)
+ printf("[021] Bound variables should not have been set\n");
+ mysqli_free_result($res);
+
+ mysqli_stmt_close($stmt);
+
+ if (!($stmt = mysqli_stmt_init($link)) ||
+ !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2") ||
+ !mysqli_stmt_execute($stmt))
+ printf("[022] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) {
+ printf("[023] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
+ gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
+ if (!in_array($res->type, array(MYSQLI_STORE_RESULT, MYSQLI_USE_RESULT))) {
+ printf("[024] Unknown result set type %s\n", $res->type);
+ }
+ if ($res->type !== MYSQLI_STORE_RESULT)
+ printf("[025] Expecting int/%d got %s/%s", MYSQLI_STORE_RESULT, gettype($res->type), $res->type);
+
+ mysqli_free_result($res);
+ mysqli_stmt_close($stmt);
+ mysqli_close($link);
+
+ try {
+ mysqli_stmt_get_result($stmt);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
---EXPECTF--
+--EXPECT--
array(2) {
["id"]=>
int(1)
@@ -171,6 +160,5 @@ array(2) {
}
NULL
[017] [2014] Commands out of sync; you can't run this command now
-
-Warning: mysqli_stmt_get_result(): Couldn't fetch mysqli_stmt in %s on line %d
+mysqli_stmt object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_stmt_get_result_bit.phpt b/ext/mysqli/tests/mysqli_stmt_get_result_bit.phpt
index c7109063e7..7c4292de00 100644
--- a/ext/mysqli/tests/mysqli_stmt_get_result_bit.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_get_result_bit.phpt
@@ -20,110 +20,110 @@ Fetching BIT column values using the PS API
?>
--FILE--
<?php
- require('connect.inc');
-
- function dec32bin($dec, $bits) {
-
- $maxval = pow(2, $bits);
- $bin = '';
- for ($bitval = $maxval; $bitval >= 1; $bitval = $bitval / 2) {
- if (($dec / $bitval) >= 1) {
- $bin .= '1';
- $dec -= $bitval;
- } else {
- $bin .= '0';
- }
- }
- return $bin;
- }
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
-
- for ($bits = 1; $bits <= 46; $bits++) {
- if (1 == $bits)
- $max_value = 1;
- else
- $max_value = pow(2, $bits) - 1;
-
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test") ||
- !mysqli_query($link, $sql = sprintf('CREATE TABLE test(id BIGINT UNSIGNED, bit_value BIT(%d) NOT NULL, bit_null BIT(%d) DEFAULT NULL) ENGINE="%s"', $bits, $bits, $engine)))
- printf("[002 - %d] [%d] %s\n",$bits, mysqli_errno($link), mysqli_error($link));
-
- if (!$stmt = mysqli_stmt_init($link))
- printf("[003 - %d] [%d] %s\n", $bits, mysqli_errno($link), mysqli_error($link));
-
- $tests = 0;
- $rand_max = mt_getrandmax();
- while ($tests < 10) {
-
- $tests++;
- if (1 == $tests)
- $value = 0;
- else if (2 == $tests)
- $value = $max_value;
- else {
- if ($max_value > $rand_max) {
- $max_loops = floor($max_value/$rand_max);
- $num_loops = mt_rand(1, $max_loops);
- $value = 0;
- for ($i = 0; $i < $num_loops; $i++)
- $value += mt_rand(0, $rand_max);
- } else {
- $value = mt_rand(0, $max_value);
- }
- }
-
- $bin = ($bits < 32) ? decbin($value) : dec32bin($value, $bits);
- $sql = sprintf("INSERT INTO test(id, bit_value) VALUES (%s, b'%s')", $value, $bin);
- for ($i = 0; ($i < strlen($bin)) && ($bin[$i] == '0'); $i++)
- ;
- $bin2 = substr($bin, $i, strlen($bin));
-
- if (!mysqli_stmt_prepare($stmt, $sql) ||
- !mysqli_stmt_execute($stmt))
- printf("[004 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- $sql = sprintf("SELECT bin(bit_value) AS _bin, id, bit_value, bit_null FROM test WHERE id = %s", $value);
- if (!mysqli_stmt_prepare($stmt, $sql) ||
- !mysqli_stmt_execute($stmt))
- printf("[005 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!$res = mysqli_stmt_get_result($stmt))
- printf("[006 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!$row = mysqli_fetch_assoc($res))
- printf("[007 - %d] [%d] %s\n", $bits, mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
-
- if (($value != $row['id']) || (($bin != $row['_bin']) && ($bin2 != $row['_bin']))) {
- debug_zval_dump($row);
- printf("[008 - %d] Insert of %s in BIT(%d) column might have failed. id = %s, bin = %s (%s/%s)\n",
- $bits, $value, $bits, $row['id'], $row['_bin'], $bin, $bin2);
- break;
- }
- if ($value != $row['bit_value']) {
- debug_zval_dump($row);
- printf("%10s %64s\n%10s %64s\n", '_bin', $row['_bin'], 'insert', $bin);
- printf("[009 - %d] Expecting %s got %s\n", $bits, $value, $row['bit_value']);
- break;
- }
-
- if (null !== $row['bit_null']) {
- debug_zval_dump($row);
- printf("[010 - %d] Expecting null got %s/%s\n", $bits, gettype($row['bit_value']), $row['bit_value']);
- break;
- }
-
- }
-
- mysqli_stmt_close($stmt);
-
- }
-
- mysqli_close($link);
- print "done!";
+ require('connect.inc');
+
+ function dec32bin($dec, $bits) {
+
+ $maxval = pow(2, $bits);
+ $bin = '';
+ for ($bitval = $maxval; $bitval >= 1; $bitval = $bitval / 2) {
+ if (($dec / $bitval) >= 1) {
+ $bin .= '1';
+ $dec -= $bitval;
+ } else {
+ $bin .= '0';
+ }
+ }
+ return $bin;
+ }
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+
+ for ($bits = 1; $bits <= 46; $bits++) {
+ if (1 == $bits)
+ $max_value = 1;
+ else
+ $max_value = pow(2, $bits) - 1;
+
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test") ||
+ !mysqli_query($link, $sql = sprintf('CREATE TABLE test(id BIGINT UNSIGNED, bit_value BIT(%d) NOT NULL, bit_null BIT(%d) DEFAULT NULL) ENGINE="%s"', $bits, $bits, $engine)))
+ printf("[002 - %d] [%d] %s\n",$bits, mysqli_errno($link), mysqli_error($link));
+
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[003 - %d] [%d] %s\n", $bits, mysqli_errno($link), mysqli_error($link));
+
+ $tests = 0;
+ $rand_max = mt_getrandmax();
+ while ($tests < 10) {
+
+ $tests++;
+ if (1 == $tests)
+ $value = 0;
+ else if (2 == $tests)
+ $value = $max_value;
+ else {
+ if ($max_value > $rand_max) {
+ $max_loops = floor($max_value/$rand_max);
+ $num_loops = mt_rand(1, $max_loops);
+ $value = 0;
+ for ($i = 0; $i < $num_loops; $i++)
+ $value += mt_rand(0, $rand_max);
+ } else {
+ $value = mt_rand(0, $max_value);
+ }
+ }
+
+ $bin = ($bits < 32) ? decbin($value) : dec32bin($value, $bits);
+ $sql = sprintf("INSERT INTO test(id, bit_value) VALUES (%s, b'%s')", $value, $bin);
+ for ($i = 0; ($i < strlen($bin)) && ($bin[$i] == '0'); $i++)
+ ;
+ $bin2 = substr($bin, $i, strlen($bin));
+
+ if (!mysqli_stmt_prepare($stmt, $sql) ||
+ !mysqli_stmt_execute($stmt))
+ printf("[004 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ $sql = sprintf("SELECT bin(bit_value) AS _bin, id, bit_value, bit_null FROM test WHERE id = %s", $value);
+ if (!mysqli_stmt_prepare($stmt, $sql) ||
+ !mysqli_stmt_execute($stmt))
+ printf("[005 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!$res = mysqli_stmt_get_result($stmt))
+ printf("[006 - %d] [%d] %s\n", $bits, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[007 - %d] [%d] %s\n", $bits, mysqli_errno($link), mysqli_error($link));
+ mysqli_free_result($res);
+
+ if (($value != $row['id']) || (($bin != $row['_bin']) && ($bin2 != $row['_bin']))) {
+ debug_zval_dump($row);
+ printf("[008 - %d] Insert of %s in BIT(%d) column might have failed. id = %s, bin = %s (%s/%s)\n",
+ $bits, $value, $bits, $row['id'], $row['_bin'], $bin, $bin2);
+ break;
+ }
+ if ($value != $row['bit_value']) {
+ debug_zval_dump($row);
+ printf("%10s %64s\n%10s %64s\n", '_bin', $row['_bin'], 'insert', $bin);
+ printf("[009 - %d] Expecting %s got %s\n", $bits, $value, $row['bit_value']);
+ break;
+ }
+
+ if (null !== $row['bit_null']) {
+ debug_zval_dump($row);
+ printf("[010 - %d] Expecting null got %s/%s\n", $bits, gettype($row['bit_value']), $row['bit_value']);
+ break;
+ }
+
+ }
+
+ mysqli_stmt_close($stmt);
+
+ }
+
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_get_result_field_count.phpt b/ext/mysqli/tests/mysqli_stmt_get_result_field_count.phpt
index 8508150f98..2d58ca20d3 100644
--- a/ext/mysqli/tests/mysqli_stmt_get_result_field_count.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_get_result_field_count.phpt
@@ -11,35 +11,35 @@ mysqli_stmt_get_result() - meta data, field_count()
?>
--FILE--
<?php
- require('table.inc');
+ require('table.inc');
- if (!$stmt = mysqli_stmt_init($link))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 3"))
- printf("[002] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 3"))
+ printf("[002] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_execute($stmt))
- printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_execute($stmt))
+ printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) {
- printf("[004] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
- gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
+ if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) {
+ printf("[004] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
+ gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
- if (!is_object($res_meta = mysqli_stmt_result_metadata($stmt)) ||
- 'mysqli_result' != get_class($res_meta)) {
- printf("[005] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
- gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
+ if (!is_object($res_meta = mysqli_stmt_result_metadata($stmt)) ||
+ 'mysqli_result' != get_class($res_meta)) {
+ printf("[005] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
+ gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
- printf("%s %s\n",
- $res_meta->field_count,
- $res->field_count);
+ printf("%s %s\n",
+ $res_meta->field_count,
+ $res->field_count);
- mysqli_stmt_close($stmt);
- mysqli_close($link);
- print "done!";
+ mysqli_stmt_close($stmt);
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_get_result_geom.phpt b/ext/mysqli/tests/mysqli_stmt_get_result_geom.phpt
index aeadc3b1d7..9b8369a7ca 100644
--- a/ext/mysqli/tests/mysqli_stmt_get_result_geom.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_get_result_geom.phpt
@@ -14,127 +14,127 @@ mysqli_stmt_get_result - geometry / spatial types
?>
--FILE--
<?php
- require('connect.inc');
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
-
- function func_mysqli_stmt_get_result_geom($link, $engine, $sql_type, $bind_value, $offset) {
-
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
- printf("[%04d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if (!mysqli_query($link, sprintf("CREATE TABLE test(id INT, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) {
- // don't bail - column type might not be supported by the server, ignore this
- return false;
- }
-
- for ($id = 1; $id < 4; $id++) {
- $sql = sprintf("INSERT INTO test(id, label) VALUES (%d, %s)", $id, $bind_value);
- if (!mysqli_query($link, $sql)) {
- printf("[%04d] [%d] %s\n", $offset + 2 + $id, mysqli_errno($link), mysqli_error($link));
- }
- }
-
- if (!$stmt = mysqli_stmt_init($link)) {
- printf("[%04d] [%d] %s\n", $offset + 6, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test")) {
- printf("[%04d] [%d] %s\n", $offset + 7, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_close($stmt);
- return false;
- }
-
- if (!mysqli_stmt_execute($stmt)) {
- printf("[%04d] [%d] %s\n", $offset + 8, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_close($stmt);
- return false;
- }
- if (!$res = mysqli_stmt_get_result($stmt)) {
- printf("[%04d] [%d] %s\n", $offset + 9, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_close($stmt);
- return false;
- }
-
- $result = mysqli_stmt_result_metadata($stmt);
- $fields = mysqli_fetch_fields($result);
- if ($fields[1]->type != MYSQLI_TYPE_GEOMETRY) {
- printf("[%04d] [%d] %s wrong type %d\n", $offset + 10, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), $fields[1]->type);
- }
-
- $num = 0;
- while ($row = mysqli_fetch_assoc($res)) {
- $bind_res = &$row['label'];
-
- if (!$stmt2 = mysqli_stmt_init($link)) {
- printf("[%04d] [%d] %s\n", $offset + 11, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if (!mysqli_stmt_prepare($stmt2, "INSERT INTO test(id, label) VALUES (?, ?)")) {
- printf("[%04d] [%d] %s\n", $offset + 12, mysqli_stmt_errno($stmt2), mysqli_stmt_error($stmt2));
- return false;
- }
-
- $id = $row['id'] + 10;
- if (!mysqli_stmt_bind_param($stmt2, "is", $id, $bind_res)) {
- printf("[%04d] [%d] %s\n", $offset + 13, mysqli_stmt_errno($stmt2), mysqli_stmt_error($stmt2));
- return false;
- }
-
- if (!mysqli_stmt_execute($stmt2)) {
- printf("[%04d] [%d] %s\n", $offset + 14, mysqli_stmt_errno($stmt2), mysqli_stmt_error($stmt2));
- return false;
- }
- mysqli_stmt_close($stmt2);
-
- if (!$res_normal = mysqli_query($link, sprintf("SELECT id, label FROM test WHERE id = %d",
- $row['id'] + 10))) {
- printf("[%04d] [%d] %s\n", $offset + 15, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if (!$row_normal = mysqli_fetch_assoc($res_normal)) {
- printf("[%04d] [%d] %s\n", $offset + 16, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if ($row_normal['label'] != $bind_res) {
- printf("[%04d] PS and non-PS return different data.\n", $offset + 17);
- return false;
- }
- mysqli_free_result($res_normal);
- $num++;
- }
-
- if ($num != 3) {
- printf("[%04d] [%d] %s, expecting 3 results, got only %d results\n",
- $offset + 18, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), $num);
- mysqli_free_result($res);
- mysqli_stmt_close($stmt);
- return false;
- }
- mysqli_free_result($res);
- mysqli_stmt_close($stmt);
-
- return true;
- }
-
- $geomFromText = $link->server_version >= 80000 ? "ST_GeomFromText" : "GeomFromText";
- func_mysqli_stmt_get_result_geom($link, $engine, "GEOMETRY", "$geomFromText('POINT(2 2)')", 20);
- func_mysqli_stmt_get_result_geom($link, $engine, "POINT", "$geomFromText('POINT(1 1)')", 40);
- func_mysqli_stmt_get_result_geom($link, $engine, "LINESTRING", "$geomFromText('LINESTRING(0 0,1 1,2 2)')", 60);
- func_mysqli_stmt_get_result_geom($link, $engine, "POLYGON", "$geomFromText('POLYGON((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5))')", 80);
- func_mysqli_stmt_get_result_geom($link, $engine, "MULTIPOINT", "$geomFromText('MULTIPOINT(1 1, 2 2)')", 100);
- func_mysqli_stmt_get_result_geom($link, $engine, "MULTILINESTRING", "$geomFromText('MULTILINESTRING((0 0,1 1,2 2),(0 0,1 1,3 3))')", 120);
- func_mysqli_stmt_get_result_geom($link, $engine, "MULTIPOLYGON", "$geomFromText('MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5)),((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5)))')", 140);
- func_mysqli_stmt_get_result_geom($link, $engine, "GEOMETRYCOLLECTION", "$geomFromText('GEOMETRYCOLLECTION(POINT(1 1),LINESTRING(0 0,1 1,2 2,3 3,4 4))')", 160);
-
- mysqli_close($link);
- print "done!";
+ require('connect.inc');
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+
+ function func_mysqli_stmt_get_result_geom($link, $engine, $sql_type, $bind_value, $offset) {
+
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
+ printf("[%04d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if (!mysqli_query($link, sprintf("CREATE TABLE test(id INT, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) {
+ // don't bail - column type might not be supported by the server, ignore this
+ return false;
+ }
+
+ for ($id = 1; $id < 4; $id++) {
+ $sql = sprintf("INSERT INTO test(id, label) VALUES (%d, %s)", $id, $bind_value);
+ if (!mysqli_query($link, $sql)) {
+ printf("[%04d] [%d] %s\n", $offset + 2 + $id, mysqli_errno($link), mysqli_error($link));
+ }
+ }
+
+ if (!$stmt = mysqli_stmt_init($link)) {
+ printf("[%04d] [%d] %s\n", $offset + 6, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test")) {
+ printf("[%04d] [%d] %s\n", $offset + 7, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_stmt_close($stmt);
+ return false;
+ }
+
+ if (!mysqli_stmt_execute($stmt)) {
+ printf("[%04d] [%d] %s\n", $offset + 8, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_stmt_close($stmt);
+ return false;
+ }
+ if (!$res = mysqli_stmt_get_result($stmt)) {
+ printf("[%04d] [%d] %s\n", $offset + 9, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_stmt_close($stmt);
+ return false;
+ }
+
+ $result = mysqli_stmt_result_metadata($stmt);
+ $fields = mysqli_fetch_fields($result);
+ if ($fields[1]->type != MYSQLI_TYPE_GEOMETRY) {
+ printf("[%04d] [%d] %s wrong type %d\n", $offset + 10, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), $fields[1]->type);
+ }
+
+ $num = 0;
+ while ($row = mysqli_fetch_assoc($res)) {
+ $bind_res = &$row['label'];
+
+ if (!$stmt2 = mysqli_stmt_init($link)) {
+ printf("[%04d] [%d] %s\n", $offset + 11, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if (!mysqli_stmt_prepare($stmt2, "INSERT INTO test(id, label) VALUES (?, ?)")) {
+ printf("[%04d] [%d] %s\n", $offset + 12, mysqli_stmt_errno($stmt2), mysqli_stmt_error($stmt2));
+ return false;
+ }
+
+ $id = $row['id'] + 10;
+ if (!mysqli_stmt_bind_param($stmt2, "is", $id, $bind_res)) {
+ printf("[%04d] [%d] %s\n", $offset + 13, mysqli_stmt_errno($stmt2), mysqli_stmt_error($stmt2));
+ return false;
+ }
+
+ if (!mysqli_stmt_execute($stmt2)) {
+ printf("[%04d] [%d] %s\n", $offset + 14, mysqli_stmt_errno($stmt2), mysqli_stmt_error($stmt2));
+ return false;
+ }
+ mysqli_stmt_close($stmt2);
+
+ if (!$res_normal = mysqli_query($link, sprintf("SELECT id, label FROM test WHERE id = %d",
+ $row['id'] + 10))) {
+ printf("[%04d] [%d] %s\n", $offset + 15, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if (!$row_normal = mysqli_fetch_assoc($res_normal)) {
+ printf("[%04d] [%d] %s\n", $offset + 16, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if ($row_normal['label'] != $bind_res) {
+ printf("[%04d] PS and non-PS return different data.\n", $offset + 17);
+ return false;
+ }
+ mysqli_free_result($res_normal);
+ $num++;
+ }
+
+ if ($num != 3) {
+ printf("[%04d] [%d] %s, expecting 3 results, got only %d results\n",
+ $offset + 18, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), $num);
+ mysqli_free_result($res);
+ mysqli_stmt_close($stmt);
+ return false;
+ }
+ mysqli_free_result($res);
+ mysqli_stmt_close($stmt);
+
+ return true;
+ }
+
+ $geomFromText = $link->server_version >= 80000 ? "ST_GeomFromText" : "GeomFromText";
+ func_mysqli_stmt_get_result_geom($link, $engine, "GEOMETRY", "$geomFromText('POINT(2 2)')", 20);
+ func_mysqli_stmt_get_result_geom($link, $engine, "POINT", "$geomFromText('POINT(1 1)')", 40);
+ func_mysqli_stmt_get_result_geom($link, $engine, "LINESTRING", "$geomFromText('LINESTRING(0 0,1 1,2 2)')", 60);
+ func_mysqli_stmt_get_result_geom($link, $engine, "POLYGON", "$geomFromText('POLYGON((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5))')", 80);
+ func_mysqli_stmt_get_result_geom($link, $engine, "MULTIPOINT", "$geomFromText('MULTIPOINT(1 1, 2 2)')", 100);
+ func_mysqli_stmt_get_result_geom($link, $engine, "MULTILINESTRING", "$geomFromText('MULTILINESTRING((0 0,1 1,2 2),(0 0,1 1,3 3))')", 120);
+ func_mysqli_stmt_get_result_geom($link, $engine, "MULTIPOLYGON", "$geomFromText('MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5)),((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5)))')", 140);
+ func_mysqli_stmt_get_result_geom($link, $engine, "GEOMETRYCOLLECTION", "$geomFromText('GEOMETRYCOLLECTION(POINT(1 1),LINESTRING(0 0,1 1,2 2,3 3,4 4))')", 160);
+
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_get_result_metadata.phpt b/ext/mysqli/tests/mysqli_stmt_get_result_metadata.phpt
index febc659167..eb902188e0 100644
--- a/ext/mysqli/tests/mysqli_stmt_get_result_metadata.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_get_result_metadata.phpt
@@ -11,199 +11,211 @@ if (!function_exists('mysqli_stmt_get_result'))
?>
--FILE--
<?php
- require('table.inc');
-
- if (!$stmt = mysqli_stmt_init($link))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 3"))
- printf("[002] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!mysqli_stmt_execute($stmt))
- printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) {
- printf("[004] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
- gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
-
- if (!is_object($res_meta = mysqli_stmt_result_metadata($stmt)) ||
- 'mysqli_result' != get_class($res_meta)) {
- printf("[005] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
- gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
-
- var_dump(mysqli_fetch_assoc($res));
- var_dump(mysqli_fetch_assoc($res_meta));
-
- mysqli_free_result($res);
- mysqli_free_result($res_meta);
- mysqli_stmt_close($stmt);
-
- // !mysqli_stmt_prepare($stmt, "SELECT id, label, id + 1 as _id, concat(label, '_') _label FROM test as _test ORDER BY id ASC LIMIT 3") ||
- if (!($stmt = mysqli_stmt_init($link)) ||
- !mysqli_stmt_prepare($stmt, "SELECT id , label, id + 1 AS _id, label AS _label, null AS _null, CONCAT(label, '_') _label_concat FROM test _test ORDER BY id ASC LIMIT 3") ||
- !mysqli_stmt_execute($stmt))
- printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) {
- printf("[007] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
- gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
-
- if (!is_object($res_meta = mysqli_stmt_result_metadata($stmt)) ||
- 'mysqli_result' != get_class($res_meta)) {
- printf("[008] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
- gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
-
- if (($tmp1 = mysqli_num_fields($res)) !== ($tmp2 = mysqli_num_fields($res_meta))) {
- printf("[009] %s/%s !== %s/%s\n", gettype($tmp1), $tmp1, gettype($tmp2), $tmp2);
- }
-
- /*
- if (($tmp1 = mysqli_field_count($link)) !== ($tmp2 = $res->field_count()))
- printf("[010] %s/%s !== %s/%s\n", gettype($tmp1), $tmp1, gettype($tmp2), $tmp2);
-
- if (($tmp1 = $res_meta->field_count()) !== $tmp2)
- printf("[011] %s/%s !== %s/%s\n", gettype($tmp1), $tmp1, gettype($tmp2), $tmp2);
- */
-
- if (($tmp1 = mysqli_field_tell($res)) !== ($tmp2 = $res_meta->current_field))
- printf("[012] %s/%s !== %s/%s\n", gettype($tmp1), $tmp1, gettype($tmp2), $tmp2);
-
- if (0 !== $tmp1)
- printf("[013] Expecting int/0 got %s/%s\n", gettype($tmp1), $tmp1);
-
- $fields = array();
- while ($info = $res->fetch_field())
- $fields['res'][] = $info;
- var_dump($info);
- while ($info = $res_meta->fetch_field())
- $fields['meta'][] = $info;
- var_dump($info);
- $fields['all_res'] = $res->fetch_fields();
- $fields['all_meta'] = $res_meta->fetch_fields();
-
- if (count($fields['res']) != count($fields['meta'])) {
- printf("[014] stmt_get_result indicates %d fields, stmt_result_metadata indicates %d fields\n",
- count($fields['res']),
- count($fields['meta']));
- }
-
- foreach ($fields['res'] as $k => $info) {
- printf("%s\n", $info->name);
- if ($info->name !== $fields['meta'][$k]->name)
- printf("[015 - %d] Expecting name %s/%s got %s/%s\n",
- $k, gettype($info->name), $info->name, gettype($fields['meta'][$k]->name), $fields['meta'][$k]->name);
-
- if ($info->orgname !== $fields['meta'][$k]->orgname)
- printf("[016 - %d] Expecting orgname %s/%s got %s/%s\n",
- $k, gettype($info->orgname), $info->orgname, gettype($fields['meta'][$k]->orgname), $fields['meta'][$k]->orgname);
-
- if ($info->table !== $fields['meta'][$k]->table)
- printf("[017 - %d] Expecting table %s/%s got %s/%s\n",
- $k, gettype($info->table), $info->table, gettype($fields['meta'][$k]->table), $fields['meta'][$k]->table);
-
- if ($info->orgtable !== $fields['meta'][$k]->orgtable)
- printf("[018 - %d] Expecting orgtable %s/%s got %s/%s\n",
- $k, gettype($info->orgtable), $info->orgtable, gettype($fields['meta'][$k]->orgtable), $fields['meta'][$k]->orgtable);
-
- if ($info->def !== $fields['meta'][$k]->def)
- printf("[019 - %d] Expecting def %s/%s got %s/%s\n",
- $k, gettype($info->def), $info->def, gettype($fields['meta'][$k]->def), $fields['meta'][$k]->def);
+ require('table.inc');
+
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 3"))
+ printf("[002] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!mysqli_stmt_execute($stmt))
+ printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) {
+ printf("[004] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
+ gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
+
+ if (!is_object($res_meta = mysqli_stmt_result_metadata($stmt)) ||
+ 'mysqli_result' != get_class($res_meta)) {
+ printf("[005] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
+ gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
+
+ var_dump(mysqli_fetch_assoc($res));
+ var_dump(mysqli_fetch_assoc($res_meta));
+
+ mysqli_free_result($res);
+ mysqli_free_result($res_meta);
+ mysqli_stmt_close($stmt);
+
+ // !mysqli_stmt_prepare($stmt, "SELECT id, label, id + 1 as _id, concat(label, '_') _label FROM test as _test ORDER BY id ASC LIMIT 3") ||
+ if (!($stmt = mysqli_stmt_init($link)) ||
+ !mysqli_stmt_prepare($stmt, "SELECT id , label, id + 1 AS _id, label AS _label, null AS _null, CONCAT(label, '_') _label_concat FROM test _test ORDER BY id ASC LIMIT 3") ||
+ !mysqli_stmt_execute($stmt))
+ printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) {
+ printf("[007] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
+ gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
+
+ if (!is_object($res_meta = mysqli_stmt_result_metadata($stmt)) ||
+ 'mysqli_result' != get_class($res_meta)) {
+ printf("[008] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
+ gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
+
+ if (($tmp1 = mysqli_num_fields($res)) !== ($tmp2 = mysqli_num_fields($res_meta))) {
+ printf("[009] %s/%s !== %s/%s\n", gettype($tmp1), $tmp1, gettype($tmp2), $tmp2);
+ }
+
+ /*
+ if (($tmp1 = mysqli_field_count($link)) !== ($tmp2 = $res->field_count()))
+ printf("[010] %s/%s !== %s/%s\n", gettype($tmp1), $tmp1, gettype($tmp2), $tmp2);
+
+ if (($tmp1 = $res_meta->field_count()) !== $tmp2)
+ printf("[011] %s/%s !== %s/%s\n", gettype($tmp1), $tmp1, gettype($tmp2), $tmp2);
+ */
+
+ if (($tmp1 = mysqli_field_tell($res)) !== ($tmp2 = $res_meta->current_field))
+ printf("[012] %s/%s !== %s/%s\n", gettype($tmp1), $tmp1, gettype($tmp2), $tmp2);
+
+ if (0 !== $tmp1)
+ printf("[013] Expecting int/0 got %s/%s\n", gettype($tmp1), $tmp1);
+
+ $fields = array();
+ while ($info = $res->fetch_field())
+ $fields['res'][] = $info;
+ var_dump($info);
+ while ($info = $res_meta->fetch_field())
+ $fields['meta'][] = $info;
+ var_dump($info);
+ $fields['all_res'] = $res->fetch_fields();
+ $fields['all_meta'] = $res_meta->fetch_fields();
+
+ if (count($fields['res']) != count($fields['meta'])) {
+ printf("[014] stmt_get_result indicates %d fields, stmt_result_metadata indicates %d fields\n",
+ count($fields['res']),
+ count($fields['meta']));
+ }
+
+ foreach ($fields['res'] as $k => $info) {
+ printf("%s\n", $info->name);
+ if ($info->name !== $fields['meta'][$k]->name)
+ printf("[015 - %d] Expecting name %s/%s got %s/%s\n",
+ $k, gettype($info->name), $info->name, gettype($fields['meta'][$k]->name), $fields['meta'][$k]->name);
+
+ if ($info->orgname !== $fields['meta'][$k]->orgname)
+ printf("[016 - %d] Expecting orgname %s/%s got %s/%s\n",
+ $k, gettype($info->orgname), $info->orgname, gettype($fields['meta'][$k]->orgname), $fields['meta'][$k]->orgname);
+
+ if ($info->table !== $fields['meta'][$k]->table)
+ printf("[017 - %d] Expecting table %s/%s got %s/%s\n",
+ $k, gettype($info->table), $info->table, gettype($fields['meta'][$k]->table), $fields['meta'][$k]->table);
+
+ if ($info->orgtable !== $fields['meta'][$k]->orgtable)
+ printf("[018 - %d] Expecting orgtable %s/%s got %s/%s\n",
+ $k, gettype($info->orgtable), $info->orgtable, gettype($fields['meta'][$k]->orgtable), $fields['meta'][$k]->orgtable);
+
+ if ($info->def !== $fields['meta'][$k]->def)
+ printf("[019 - %d] Expecting def %s/%s got %s/%s\n",
+ $k, gettype($info->def), $info->def, gettype($fields['meta'][$k]->def), $fields['meta'][$k]->def);
/*
- if ($info->max_length !== $fields['meta'][$k]->max_length)
- printf("[020 - %d] Expecting max_length %s/%s got %s/%s\n",
- $k, gettype($info->max_length), $info->max_length, gettype($fields['meta'][$k]->max_length), $fields['meta'][$k]->max_length);
+ if ($info->max_length !== $fields['meta'][$k]->max_length)
+ printf("[020 - %d] Expecting max_length %s/%s got %s/%s\n",
+ $k, gettype($info->max_length), $info->max_length, gettype($fields['meta'][$k]->max_length), $fields['meta'][$k]->max_length);
*/
- if ($info->length !== $fields['meta'][$k]->length)
- printf("[021 - %d] Expecting length %s/%s got %s/%s\n",
- $k, gettype($info->length), $info->length, gettype($fields['meta'][$k]->length), $fields['meta'][$k]->length);
-
- if ($info->charsetnr !== $fields['meta'][$k]->charsetnr)
- printf("[022 - %d] Expecting charsetnr %s/%s got %s/%s\n",
- $k, gettype($info->charsetnr), $info->charsetnr, gettype($fields['meta'][$k]->charsetnr), $fields['meta'][$k]->charsetnr);
-
- if ($info->flags !== $fields['meta'][$k]->flags)
- printf("[023 - %d] Expecting flags %s/%s got %s/%s\n",
- $k, gettype($info->flags), $info->flags, gettype($fields['meta'][$k]->flags), $fields['meta'][$k]->flags);
-
- if ($info->type !== $fields['meta'][$k]->type)
- printf("[024 - %d] Expecting type %s/%s got %s/%s\n",
- $k, gettype($info->type), $info->type, gettype($fields['meta'][$k]->type), $fields['meta'][$k]->type);
-
- if ($info->decimals !== $fields['meta'][$k]->decimals)
- printf("[025 - %d] Expecting decimals %s/%s got %s/%s\n",
- $k, getdecimals($info->decimals), $info->decimals, getdecimals($fields['meta'][$k]->decimals), $fields['meta'][$k]->decimals);
-
- /* Make them equal for the check */
- $tmp = $fields['all_res'][$k]->max_length;
- $fields['all_res'][$k]->max_length = $fields['all_meta'][$k]->max_length;
-
- if ($fields['all_res'][$k] != $fields['all_meta'][$k]) {
- printf("[026 - %d] fetch_fields() seems to have returned different data, dumping\n", $k);
- var_dump($fields['all_res'][$k]);
- var_dump($fields['all_meta'][$k]);
- }
- $fields['all_res'][$k]->max_length = $tmp;
- }
-
- $num = count($fields['res']);
- for ($i = 0; $i < 100; $i++) {
- $pos = mt_rand(-1, $num + 1);
- if ($pos >= 0 && $pos < $num) {
- if (true !== mysqli_field_seek($res, $pos))
- printf("[027] field_seek(res) failed\n");
- if (true !== $res_meta->field_seek($pos))
- printf("[028] field_seek(res__meta) failed\n");
-
- $tmp1 = $res->fetch_field();
- $tmp2 = mysqli_fetch_field($res_meta);
- $tmp2->max_length = $tmp1->max_length;
- if ($tmp1 != $tmp2) {
- printf("[029] Field info differs, dumping data\n");
- var_dump($tmp1);
- var_dump($tmp2);
- }
-
- if ($tmp1 != $fields['res'][$pos]) {
- printf("[030] Field info differs, dumping data\n");
- var_dump($tmp1);
- var_dump($fields['res'][$pos]);
- }
-
- $pos++;
- if ($pos !== ($tmp = mysqli_field_tell($res)))
- printf("[031] Expecting %s/%s got %s/%s\n",
- gettype($pos), $pos, gettype($tmp), $tmp);
-
- if ($pos !== ($tmp = mysqli_field_tell($res_meta)))
- printf("[032] Expecting %s/%s got %s/%s\n",
- gettype($pos), $pos, gettype($tmp), $tmp);
- } else {
-
- if (false !== @mysqli_field_seek($res, $pos))
- printf("[033] field_seek(%d) did not fail\n", $pos);
- if (false !== @mysqli_field_seek($res_meta, $pos))
- printf("[034] field_seek(%d) did not fail\n", $pos);
- }
- }
-
- $res->free_result();
- mysqli_free_result($res_meta);
-
- var_dump(mysqli_fetch_field($res));
-
- mysqli_stmt_close($stmt);
-
- var_dump(mysqli_fetch_field($res));
-
- mysqli_close($link);
-
- var_dump(mysqli_fetch_field($res));
-
- print "done!";
+ if ($info->length !== $fields['meta'][$k]->length)
+ printf("[021 - %d] Expecting length %s/%s got %s/%s\n",
+ $k, gettype($info->length), $info->length, gettype($fields['meta'][$k]->length), $fields['meta'][$k]->length);
+
+ if ($info->charsetnr !== $fields['meta'][$k]->charsetnr)
+ printf("[022 - %d] Expecting charsetnr %s/%s got %s/%s\n",
+ $k, gettype($info->charsetnr), $info->charsetnr, gettype($fields['meta'][$k]->charsetnr), $fields['meta'][$k]->charsetnr);
+
+ if ($info->flags !== $fields['meta'][$k]->flags)
+ printf("[023 - %d] Expecting flags %s/%s got %s/%s\n",
+ $k, gettype($info->flags), $info->flags, gettype($fields['meta'][$k]->flags), $fields['meta'][$k]->flags);
+
+ if ($info->type !== $fields['meta'][$k]->type)
+ printf("[024 - %d] Expecting type %s/%s got %s/%s\n",
+ $k, gettype($info->type), $info->type, gettype($fields['meta'][$k]->type), $fields['meta'][$k]->type);
+
+ if ($info->decimals !== $fields['meta'][$k]->decimals)
+ printf("[025 - %d] Expecting decimals %s/%s got %s/%s\n",
+ $k, getdecimals($info->decimals), $info->decimals, getdecimals($fields['meta'][$k]->decimals), $fields['meta'][$k]->decimals);
+
+ /* Make them equal for the check */
+ $tmp = $fields['all_res'][$k]->max_length;
+ $fields['all_res'][$k]->max_length = $fields['all_meta'][$k]->max_length;
+
+ if ($fields['all_res'][$k] != $fields['all_meta'][$k]) {
+ printf("[026 - %d] fetch_fields() seems to have returned different data, dumping\n", $k);
+ var_dump($fields['all_res'][$k]);
+ var_dump($fields['all_meta'][$k]);
+ }
+ $fields['all_res'][$k]->max_length = $tmp;
+ }
+
+ $num = count($fields['res']);
+ for ($i = 0; $i < 100; $i++) {
+ $pos = mt_rand(-1, $num + 1);
+ if ($pos >= 0 && $pos < $num) {
+ if (true !== mysqli_field_seek($res, $pos))
+ printf("[027] field_seek(res) failed\n");
+ if (true !== $res_meta->field_seek($pos))
+ printf("[028] field_seek(res__meta) failed\n");
+
+ $tmp1 = $res->fetch_field();
+ $tmp2 = mysqli_fetch_field($res_meta);
+ $tmp2->max_length = $tmp1->max_length;
+ if ($tmp1 != $tmp2) {
+ printf("[029] Field info differs, dumping data\n");
+ var_dump($tmp1);
+ var_dump($tmp2);
+ }
+
+ if ($tmp1 != $fields['res'][$pos]) {
+ printf("[030] Field info differs, dumping data\n");
+ var_dump($tmp1);
+ var_dump($fields['res'][$pos]);
+ }
+
+ $pos++;
+ if ($pos !== ($tmp = mysqli_field_tell($res)))
+ printf("[031] Expecting %s/%s got %s/%s\n",
+ gettype($pos), $pos, gettype($tmp), $tmp);
+
+ if ($pos !== ($tmp = mysqli_field_tell($res_meta)))
+ printf("[032] Expecting %s/%s got %s/%s\n",
+ gettype($pos), $pos, gettype($tmp), $tmp);
+ } else {
+
+ if (false !== @mysqli_field_seek($res, $pos))
+ printf("[033] field_seek(%d) did not fail\n", $pos);
+ if (false !== @mysqli_field_seek($res_meta, $pos))
+ printf("[034] field_seek(%d) did not fail\n", $pos);
+ }
+ }
+
+ $res->free_result();
+ mysqli_free_result($res_meta);
+
+ try {
+ mysqli_fetch_field($res);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ mysqli_stmt_close($stmt);
+
+ try {
+ mysqli_fetch_field($res);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ mysqli_close($link);
+
+ try {
+ mysqli_fetch_field($res);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ print "done!";
?>
--CLEAN--
<?php
@@ -225,13 +237,7 @@ _id
_label
_null
_label_concat
-
-Warning: mysqli_fetch_field(): Couldn't fetch mysqli_result in %s on line %d
-bool(false)
-
-Warning: mysqli_fetch_field(): Couldn't fetch mysqli_result in %s on line %d
-bool(false)
-
-Warning: mysqli_fetch_field(): Couldn't fetch mysqli_result in %s on line %d
-bool(false)
+mysqli_result object is already closed
+mysqli_result object is already closed
+mysqli_result object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_stmt_get_result_metadata_fetch_field.phpt b/ext/mysqli/tests/mysqli_stmt_get_result_metadata_fetch_field.phpt
index 5481db04f4..1c5d3ecbc7 100644
--- a/ext/mysqli/tests/mysqli_stmt_get_result_metadata_fetch_field.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_get_result_metadata_fetch_field.phpt
@@ -11,55 +11,55 @@ if (!function_exists('mysqli_stmt_get_result'))
?>
--FILE--
<?php
- require('table.inc');
+ require('table.inc');
- // Make sure that client, connection and result charsets are all the
- // same. Not sure whether this is strictly necessary.
- if (!mysqli_set_charset($link, 'utf8'))
- printf("[%d] %s\n", mysqli_errno($link), mysqli_errno($link));
+ // Make sure that client, connection and result charsets are all the
+ // same. Not sure whether this is strictly necessary.
+ if (!mysqli_set_charset($link, 'utf8'))
+ printf("[%d] %s\n", mysqli_errno($link), mysqli_errno($link));
- $charsetInfo = mysqli_get_charset($link);
+ $charsetInfo = mysqli_get_charset($link);
- if (!($stmt = mysqli_stmt_init($link)) ||
- !mysqli_stmt_prepare($stmt, "SELECT id, label, id + 1 as _id, concat(label, '_') ___label FROM test ORDER BY id ASC LIMIT 3") ||
- !mysqli_stmt_execute($stmt))
- printf("[001] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!($stmt = mysqli_stmt_init($link)) ||
+ !mysqli_stmt_prepare($stmt, "SELECT id, label, id + 1 as _id, concat(label, '_') ___label FROM test ORDER BY id ASC LIMIT 3") ||
+ !mysqli_stmt_execute($stmt))
+ printf("[001] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) {
- printf("[002] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
- gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
+ if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) {
+ printf("[002] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
+ gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
- if (!is_object($res_meta = mysqli_stmt_result_metadata($stmt)) ||
- 'mysqli_result' != get_class($res_meta)) {
- printf("[003] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
- gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
+ if (!is_object($res_meta = mysqli_stmt_result_metadata($stmt)) ||
+ 'mysqli_result' != get_class($res_meta)) {
+ printf("[003] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
+ gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
- $i = 0;
- while ($field = $res->fetch_field()) {
- var_dump($field);
- $i++;
- if (2 == $i) {
- /*
- Label column, result set charset.
- All of the following columns are "too hot" - too server dependent
- */
- if ($field->charsetnr != $charsetInfo->number) {
- printf("[004] Expecting charset %s/%d got %d\n",
- $charsetInfo->charset,
- $charsetInfo->number, $field->charsetnr);
- }
- if ($field->length != $charsetInfo->max_length) {
- printf("[005] Expecting length %d got %d\n",
- $charsetInfo->max_length, $field->max_length);
- }
- }
- }
+ $i = 0;
+ while ($field = $res->fetch_field()) {
+ var_dump($field);
+ $i++;
+ if (2 == $i) {
+ /*
+ Label column, result set charset.
+ All of the following columns are "too hot" - too server dependent
+ */
+ if ($field->charsetnr != $charsetInfo->number) {
+ printf("[004] Expecting charset %s/%d got %d\n",
+ $charsetInfo->charset,
+ $charsetInfo->number, $field->charsetnr);
+ }
+ if ($field->length != $charsetInfo->max_length) {
+ printf("[005] Expecting length %d got %d\n",
+ $charsetInfo->max_length, $field->max_length);
+ }
+ }
+ }
- mysqli_stmt_close($stmt);
- mysqli_close($link);
- print "done!";
+ mysqli_stmt_close($stmt);
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_get_result_non_select.phpt b/ext/mysqli/tests/mysqli_stmt_get_result_non_select.phpt
index 1cd2981ed2..23254e1755 100644
--- a/ext/mysqli/tests/mysqli_stmt_get_result_non_select.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_get_result_non_select.phpt
@@ -11,81 +11,81 @@ if (!function_exists('mysqli_stmt_get_result'))
?>
--FILE--
<?php
- /*
- NOTE: no datatype tests here! This is done by
- mysqli_stmt_bind_result.phpt already. Restrict
- this test case to the basics.
- */
- require('table.inc');
+ /*
+ NOTE: no datatype tests here! This is done by
+ mysqli_stmt_bind_result.phpt already. Restrict
+ this test case to the basics.
+ */
+ require('table.inc');
- if (!$stmt = mysqli_stmt_init($link))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (mysqli_query($link, 'PREPARE mystmt FROM "SHOW ENGINES"')) {
- mysqli_query($link, 'DEALLOCATE PREPARE mystmt');
+ if (mysqli_query($link, 'PREPARE mystmt FROM "SHOW ENGINES"')) {
+ mysqli_query($link, 'DEALLOCATE PREPARE mystmt');
- if (!$stmt->prepare('SHOW ENGINES') ||
- !$stmt->execute())
- printf("[002] [%d] %s\n", $stmt->errno, $stmt->error);
+ if (!$stmt->prepare('SHOW ENGINES') ||
+ !$stmt->execute())
+ printf("[002] [%d] %s\n", $stmt->errno, $stmt->error);
- if (!$res = $stmt->get_result())
- printf("[003] [%d] %s\n", $stmt->errno, $stmt->error);
+ if (!$res = $stmt->get_result())
+ printf("[003] [%d] %s\n", $stmt->errno, $stmt->error);
- $engines = mysqli_fetch_all($res, MYSQLI_NUM);
- if (empty($engines)) {
- printf("[004] It is very unlikely that SHOW ENGINES returns no data, check manually\n");
- } else {
- $found = false;
- foreach ($engines as $k => $engine)
- foreach ($engine as $k => $v)
- if (stristr($v, 'MyISAM')) {
- $found = true;
- break;
- }
- if (!$found)
- printf("[005] It is very unlikely that SHOW ENGINES does not show MyISAM, check manually\n");
- }
- mysqli_free_result($res);
- }
+ $engines = mysqli_fetch_all($res, MYSQLI_NUM);
+ if (empty($engines)) {
+ printf("[004] It is very unlikely that SHOW ENGINES returns no data, check manually\n");
+ } else {
+ $found = false;
+ foreach ($engines as $k => $engine)
+ foreach ($engine as $k => $v)
+ if (stristr($v, 'MyISAM')) {
+ $found = true;
+ break;
+ }
+ if (!$found)
+ printf("[005] It is very unlikely that SHOW ENGINES does not show MyISAM, check manually\n");
+ }
+ mysqli_free_result($res);
+ }
- if (mysqli_query($link, 'PREPARE mystmt FROM "DESCRIBE test id"')) {
- mysqli_query($link, 'DEALLOCATE PREPARE mystmt');
+ if (mysqli_query($link, 'PREPARE mystmt FROM "DESCRIBE test id"')) {
+ mysqli_query($link, 'DEALLOCATE PREPARE mystmt');
- if (!$stmt->prepare('DESCRIBE test id') ||
- !$stmt->execute())
- printf("[006] [%d] %s\n", $stmt->errno, $stmt->error);
+ if (!$stmt->prepare('DESCRIBE test id') ||
+ !$stmt->execute())
+ printf("[006] [%d] %s\n", $stmt->errno, $stmt->error);
- if (!$res = $stmt->get_result())
- printf("[007] [%d] %s\n", $stmt->errno, $stmt->error);
+ if (!$res = $stmt->get_result())
+ printf("[007] [%d] %s\n", $stmt->errno, $stmt->error);
- $description = mysqli_fetch_assoc($res);
- if ($description['Field'] != 'id') {
- printf("[008] Returned data seems wrong, [%d] %s\n",
- mysqli_errno($link), mysqli_error($link));
- var_dump($description);
- }
- mysqli_free_result($res);
- }
+ $description = mysqli_fetch_assoc($res);
+ if ($description['Field'] != 'id') {
+ printf("[008] Returned data seems wrong, [%d] %s\n",
+ mysqli_errno($link), mysqli_error($link));
+ var_dump($description);
+ }
+ mysqli_free_result($res);
+ }
- if (mysqli_query($link, 'PREPARE mystmt FROM "EXPLAIN SELECT id FROM test"')) {
- mysqli_query($link, 'DEALLOCATE PREPARE mystmt');
+ if (mysqli_query($link, 'PREPARE mystmt FROM "EXPLAIN SELECT id FROM test"')) {
+ mysqli_query($link, 'DEALLOCATE PREPARE mystmt');
- if (!$stmt->prepare('EXPLAIN SELECT id FROM test') ||
- !$stmt->execute())
- printf("[009] [%d] %s\n", $stmt->errno, $stmt->error);
+ if (!$stmt->prepare('EXPLAIN SELECT id FROM test') ||
+ !$stmt->execute())
+ printf("[009] [%d] %s\n", $stmt->errno, $stmt->error);
- if (!$res = $stmt->get_result())
- printf("[010] [%d] %s\n", $stmt->errno, $stmt->error);
+ if (!$res = $stmt->get_result())
+ printf("[010] [%d] %s\n", $stmt->errno, $stmt->error);
- $tmp = mysqli_fetch_assoc($res);
- if (empty($tmp))
- printf("[011] Empty EXPLAIN result set seems wrong, check manually, [%d] %s\n",
- mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
- }
- mysqli_close($link);
+ $tmp = mysqli_fetch_assoc($res);
+ if (empty($tmp))
+ printf("[011] Empty EXPLAIN result set seems wrong, check manually, [%d] %s\n",
+ mysqli_errno($link), mysqli_error($link));
+ mysqli_free_result($res);
+ }
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_get_result_seek.phpt b/ext/mysqli/tests/mysqli_stmt_get_result_seek.phpt
index 51198523c9..68dad8b281 100644
--- a/ext/mysqli/tests/mysqli_stmt_get_result_seek.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_get_result_seek.phpt
@@ -11,120 +11,124 @@ if (!function_exists('mysqli_stmt_get_result'))
?>
--FILE--
<?php
- require('table.inc');
-
- if (!$stmt = mysqli_stmt_init($link))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 3"))
- printf("[002] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!mysqli_stmt_execute($stmt))
- printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) {
- printf("[004] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
- gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
-
- if (3 !== $res->num_rows)
- printf("[005] Expecting 3 rows, got %s/%s rows\n", gettype($res->num_rows), $res->num_rows);
-
- if (2 !== $res->field_count)
- printf("[006] Expecting 2 fields, got %s/%s rows\n", gettype($res->field_count), $res->field_count);
-
- if (0 !== $res->current_field)
- printf("[006] Expecting offset 0, got %s/%s rows\n", gettype($res->current_field), $res->current_field);
-
- for ($i = 2; $i > 0; $i--) {
- if (!$res->data_seek($i))
- printf("[007] Cannot seek to position %d, [%d] %s\n",
- $i, mysqli_stmt_errno($stmt), $stmt->error);
- $row = $res->fetch_array(MYSQLI_BOTH);
- if (($row[0] !== $row['id']) || ($row[0] !== $i + 1)) {
- printf("[008] Record looks wrong, dumping data\n");
- var_dump($row);
- } else {
- unset($row[0]);
- unset($row['id']);
- }
- if ($row[1] !== $row['label']) {
- printf("[009] Record looks wrong, dumping data\n");
- var_dump($row);
- } else {
- unset($row[1]);
- unset($row['label']);
- }
- if (!empty($row)) {
- printf("[010] Not empty, dumping unexpected data\n");
- var_dump($row);
- }
- }
-
- if (false !== ($tmp = $res->data_seek(-1)))
- printf("[011] Expecting boolean/false got %s/%s\n", gettype($tmp), $tmp);
-
- if (false !== ($tmp = $res->data_seek($res->num_rows + 1)))
- printf("[012] Expecting boolean/false got %s/%s\n", gettype($tmp), $tmp);
-
- if (NULL !== ($tmp = $res->data_seek(PHP_INT_MAX + 1)))
- printf("[013] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
-
- for ($i = 0; $i < 100; $i++) {
- /* intentionally out of range! */
- $pos = mt_rand(-1, 4);
- $tmp = mysqli_data_seek($res, $pos);
- if (($pos >= 0 && $pos < 3)) {
- if (true !== $tmp)
- printf("[015] Expecting boolan/true got %s/%s\n", gettype($tmp), $tmp);
- $row = $res->fetch_array(MYSQLI_NUM);
- if ($row[0] !== $pos + 1)
- printf("[016] Expecting id = %d for pos %d got %s/%s\n",
- $pos + 1, $pos, gettype($row[0]), $row[0]);
- } else {
- if (false !== $tmp)
- printf("[014] Expecting boolan/false got %s/%s\n", gettype($tmp), $tmp);
- }
- }
-
- mysqli_stmt_close($stmt);
-
- if (true !== ($tmp = mysqli_data_seek($res, 0)))
- printf("[015] Expecting boolan/true got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_array($row = $res->fetch_array(MYSQLI_NUM)))
- printf("[016] Expecting array got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_free_result($res);
-
- if (false !== ($tmp = mysqli_data_seek($res, 0)))
- printf("[017] Expecting false got %s/%s\n", gettype($tmp), $tmp);
-
- if (false !== ($row = $res->fetch_array(MYSQLI_NUM)))
- printf("[018] Expecting false got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_close($link);
-
- if (false !== ($tmp = mysqli_data_seek($res, 0)))
- printf("[019] Expecting false got %s/%s\n", gettype($tmp), $tmp);
-
- if (false !== ($row = $res->fetch_array(MYSQLI_NUM)))
- printf("[020] Expecting false got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!";
+ require('table.inc');
+
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 3"))
+ printf("[002] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!mysqli_stmt_execute($stmt))
+ printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) {
+ printf("[004] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
+ gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
+
+ if (3 !== $res->num_rows)
+ printf("[005] Expecting 3 rows, got %s/%s rows\n", gettype($res->num_rows), $res->num_rows);
+
+ if (2 !== $res->field_count)
+ printf("[006] Expecting 2 fields, got %s/%s rows\n", gettype($res->field_count), $res->field_count);
+
+ if (0 !== $res->current_field)
+ printf("[006] Expecting offset 0, got %s/%s rows\n", gettype($res->current_field), $res->current_field);
+
+ for ($i = 2; $i > 0; $i--) {
+ if (!$res->data_seek($i))
+ printf("[007] Cannot seek to position %d, [%d] %s\n",
+ $i, mysqli_stmt_errno($stmt), $stmt->error);
+ $row = $res->fetch_array(MYSQLI_BOTH);
+ if (($row[0] !== $row['id']) || ($row[0] !== $i + 1)) {
+ printf("[008] Record looks wrong, dumping data\n");
+ var_dump($row);
+ } else {
+ unset($row[0]);
+ unset($row['id']);
+ }
+ if ($row[1] !== $row['label']) {
+ printf("[009] Record looks wrong, dumping data\n");
+ var_dump($row);
+ } else {
+ unset($row[1]);
+ unset($row['label']);
+ }
+ if (!empty($row)) {
+ printf("[010] Not empty, dumping unexpected data\n");
+ var_dump($row);
+ }
+ }
+
+ if (false !== ($tmp = $res->data_seek(-1)))
+ printf("[011] Expecting boolean/false got %s/%s\n", gettype($tmp), $tmp);
+
+ if (false !== ($tmp = $res->data_seek($res->num_rows + 1)))
+ printf("[012] Expecting boolean/false got %s/%s\n", gettype($tmp), $tmp);
+
+ for ($i = 0; $i < 100; $i++) {
+ /* intentionally out of range! */
+ $pos = mt_rand(-1, 4);
+ $tmp = mysqli_data_seek($res, $pos);
+ if (($pos >= 0 && $pos < 3)) {
+ if (true !== $tmp)
+ printf("[015] Expecting boolan/true got %s/%s\n", gettype($tmp), $tmp);
+ $row = $res->fetch_array(MYSQLI_NUM);
+ if ($row[0] !== $pos + 1)
+ printf("[016] Expecting id = %d for pos %d got %s/%s\n",
+ $pos + 1, $pos, gettype($row[0]), $row[0]);
+ } else {
+ if (false !== $tmp)
+ printf("[014] Expecting boolan/false got %s/%s\n", gettype($tmp), $tmp);
+ }
+ }
+
+ mysqli_stmt_close($stmt);
+
+ if (true !== ($tmp = mysqli_data_seek($res, 0)))
+ printf("[015] Expecting boolan/true got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!is_array($row = $res->fetch_array(MYSQLI_NUM)))
+ printf("[016] Expecting array got %s/%s\n", gettype($tmp), $tmp);
+
+ mysqli_free_result($res);
+
+ try {
+ mysqli_data_seek($res, 0);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ try {
+ $res->fetch_array(MYSQLI_NUM);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ mysqli_close($link);
+
+ try {
+ mysqli_data_seek($res, 0);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ try {
+ $res->fetch_array(MYSQLI_NUM);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
---EXPECTF--
-Warning: mysqli_result::data_seek() expects parameter 1 to be int, float given in %s on line %d
-
-Warning: mysqli_data_seek(): Couldn't fetch mysqli_result in %s on line %d
-
-Warning: mysqli_result::fetch_array(): Couldn't fetch mysqli_result in %s on line %d
-
-Warning: mysqli_data_seek(): Couldn't fetch mysqli_result in %s on line %d
-
-Warning: mysqli_result::fetch_array(): Couldn't fetch mysqli_result in %s on line %d
+--EXPECT--
+mysqli_result object is already closed
+mysqli_result object is already closed
+mysqli_result object is already closed
+mysqli_result object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_stmt_get_result_types.phpt b/ext/mysqli/tests/mysqli_stmt_get_result_types.phpt
index 7d21558593..30b49df4e5 100644
--- a/ext/mysqli/tests/mysqli_stmt_get_result_types.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_get_result_types.phpt
@@ -11,243 +11,243 @@ mysqli_stmt_get_result - data types
?>
--FILE--
<?php
- require('connect.inc');
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
-
- function func_mysqli_stmt_get_result($link, $engine, $bind_type, $sql_type, $bind_value, $offset, $type_hint = null) {
-
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
- printf("[%04d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if (!mysqli_query($link, sprintf("CREATE TABLE test(id INT, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) {
- // don't bail - column type might not be supported by the server, ignore this
- return false;
- }
-
- if (!$stmt = mysqli_stmt_init($link)) {
- printf("[%04d] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)")) {
- printf("[%04d] [%d] %s\n", $offset + 2, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
-
- $id = null;
- if (!mysqli_stmt_bind_param($stmt, "i" . $bind_type, $id, $bind_value)) {
- printf("[%04d] [%d] %s\n", $offset + 3, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_close($stmt);
- return false;
- }
-
- for ($id = 1; $id < 4; $id++) {
- if (!mysqli_stmt_execute($stmt)) {
- printf("[%04d] [%d] %s\n", $offset + 3 + $id, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_close($stmt);
- return false;
- }
- }
- mysqli_stmt_close($stmt);
-
- $stmt = mysqli_stmt_init($link);
-
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test")) {
- printf("[%04d] [%d] %s\n", $offset + 7, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_close($stmt);
- return false;
- }
-
- if (!mysqli_stmt_execute($stmt)) {
- printf("[%04d] [%d] %s\n", $offset + 8, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_close($stmt);
- return false;
- }
-
- $result = mysqli_stmt_result_metadata($stmt);
-
- if (!$res = mysqli_stmt_get_result($stmt)) {
- printf("[%04d] [%d] %s\n", $offset + 9, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_close($stmt);
- return false;
- }
- $num = 0;
- $fields = mysqli_fetch_fields($result);
-
- while ($row = mysqli_fetch_assoc($res)) {
- $bind_res = &$row['label'];
- if (!gettype($bind_res) == 'unicode') {
- if ($bind_res !== $bind_value && (!$type_hint || ($type_hint !== gettype($bind_res)))) {
- printf("[%04d] [%d] Expecting %s/'%s' [type hint = %s], got %s/'%s'\n",
- $offset + 10, $num,
- gettype($bind_value), $bind_value, $type_hint,
- gettype($bind_res), $bind_res);
- mysqli_free_result($res);
- mysqli_stmt_close($stmt);
- return false;
- }
- }
- $num++;
- }
-
- if ($num != 3) {
- printf("[%04d] [%d] %s, expecting 3 results, got only %d results\n",
- $offset + 11, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), $num);
- mysqli_free_result($res);
- mysqli_stmt_close($stmt);
- return false;
- }
-
- mysqli_free_result($res);
- mysqli_stmt_close($stmt);
- return true;
- }
-
-
- function func_mysqli_stmt_bind_make_string($len) {
-
- $ret = '';
- for ($i = 0; $i < $len; $i++)
- $ret .= chr(mt_rand(65, 90));
-
- return $ret;
- }
-
- func_mysqli_stmt_get_result($link, $engine, "i", "TINYINT", -11, 20);
- func_mysqli_stmt_get_result($link, $engine, "i", "TINYINT", NULL, 40);
- func_mysqli_stmt_get_result($link, $engine, "i", "TINYINT UNSIGNED", 1, 60);
- func_mysqli_stmt_get_result($link, $engine, "i", "TINYINT UNSIGNED", NULL, 80);
-
- func_mysqli_stmt_get_result($link, $engine, "i", "BOOL", 1, 100);
- func_mysqli_stmt_get_result($link, $engine, "i", "BOOL", NULL, 120);
- func_mysqli_stmt_get_result($link, $engine, "i", "BOOLEAN", 0, 140);
- func_mysqli_stmt_get_result($link, $engine, "i", "BOOLEAN", NULL, 160);
-
- func_mysqli_stmt_get_result($link, $engine, "i", "SMALLINT", -32768, 180);
- func_mysqli_stmt_get_result($link, $engine, "i", "SMALLINT", 32767, 200);
- func_mysqli_stmt_get_result($link, $engine, "i", "SMALLINT", NULL, 220);
- func_mysqli_stmt_get_result($link, $engine, "i", "SMALLINT UNSIGNED", 65535, 240);
- func_mysqli_stmt_get_result($link, $engine, "i", "SMALLINT UNSIGNED", NULL, 260);
-
- func_mysqli_stmt_get_result($link, $engine, "d", "MEDIUMINT", -8388608, 280, "integer");
- func_mysqli_stmt_get_result($link, $engine, "d", "MEDIUMINT", 8388607, 300, "integer");
- func_mysqli_stmt_get_result($link, $engine, "d", "MEDIUMINT", NULL, 320);
- func_mysqli_stmt_get_result($link, $engine, "d", "MEDIUMINT UNSIGNED", 16777215, 340, "integer");
- func_mysqli_stmt_get_result($link, $engine, "d", "MEDIUMINT UNSIGNED", NULL, 360);
-
- func_mysqli_stmt_get_result($link, $engine, "i", "INTEGER", (defined("PHP_INT_MAX")) ? max(-1 * PHP_INT_MAX + 1, -2147483648) : 1, 380);
- func_mysqli_stmt_get_result($link, $engine, "i", "INTEGER", -2147483647, 400, "integer");
- func_mysqli_stmt_get_result($link, $engine, "i", "INTEGER", (defined("PHP_INT_MAX")) ? min(2147483647, PHP_INT_MAX) : 1, 420);
- func_mysqli_stmt_get_result($link, $engine, "i", "INTEGER", NULL, 440);
- func_mysqli_stmt_get_result($link, $engine, "i", "INTEGER UNSIGNED", (defined("PHP_INT_MAX")) ? min(4294967295, 2147483647) : 1, 460);
- func_mysqli_stmt_get_result($link, $engine, "i", "INTEGER UNSIGNED", 4294967295, 480, (defined("PHP_INT_MAX") && (4294967295 > PHP_INT_MAX)) ? "string" : null);
- func_mysqli_stmt_get_result($link, $engine, "i", "INTEGER UNSIGNED", NULL, 500);
-
- /* test is broken too: we bind "integer" but value is a float
- func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT", -9223372036854775808, 520);
- func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT UNSIGNED", 18446744073709551615, 560);
- */
- func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT", NULL, 540);
- func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT UNSIGNED", NULL, 580);
- func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT", -1, 1780);
- func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT UNSIGNED", 1, 1800);
- func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT", -1 * PHP_INT_MAX + 1, 1820);
- func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT UNSIGNED", PHP_INT_MAX, 1840);
- func_mysqli_stmt_get_result($link, $engine, "s", "BIGINT UNSIGNED", "18446744073709551615", 1860);
- func_mysqli_stmt_get_result($link, $engine, "s", "BIGINT", "-9223372036854775808", 1880);
-
- func_mysqli_stmt_get_result($link, $engine, "d", "FLOAT", -9223372036854775808 - 1.1, 600);
- func_mysqli_stmt_get_result($link, $engine, "d", "FLOAT", NULL, 620);
- func_mysqli_stmt_get_result($link, $engine, "d", "FLOAT UNSIGNED", 18446744073709551615 + 1.1, 640);
- func_mysqli_stmt_get_result($link, $engine, "d", "FLOAT UNSIGNED ", NULL, 660);
-
- // Yes, we need the temporary variable. The PHP casting will fouls us otherwise.
- $tmp = strval('-99999999.99');
- func_mysqli_stmt_get_result($link, $engine, "d", "DOUBLE(10,2)", $tmp, 680, "string");
- func_mysqli_stmt_get_result($link, $engine, "d", "DOUBLE(10,2)", NULL, 700);
- $tmp = strval('99999999.99');
- func_mysqli_stmt_get_result($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", $tmp , 720, "string");
- func_mysqli_stmt_get_result($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", NULL, 740);
- $tmp = strval('-99999999.99');
- func_mysqli_stmt_get_result($link, $engine, "d", "DECIMAL(10,2)", $tmp, 760, "string");
- func_mysqli_stmt_get_result($link, $engine, "d", "DECIMAL(10,2)", NULL, 780);
- $tmp = strval('99999999.99');
- func_mysqli_stmt_get_result($link, $engine, "d", "DECIMAL(10,2)", $tmp, 800, "string");
- func_mysqli_stmt_get_result($link, $engine, "d", "DECIMAL(10,2)", NULL, 820);
-
- // don't care about date() strict TZ warnings...
- func_mysqli_stmt_get_result($link, $engine, "s", "DATE", @date('Y-m-d'), 840);
- func_mysqli_stmt_get_result($link, $engine, "s", "DATE NOT NULL", @date('Y-m-d'), 860);
- func_mysqli_stmt_get_result($link, $engine, "s", "DATE", NULL, 880);
-
- func_mysqli_stmt_get_result($link, $engine, "s", "DATETIME", @date('Y-m-d H:i:s'), 900);
- func_mysqli_stmt_get_result($link, $engine, "s", "DATETIME NOT NULL", @date('Y-m-d H:i:s'), 920);
- func_mysqli_stmt_get_result($link, $engine, "s", "DATETIME", NULL, 940);
-
- func_mysqli_stmt_get_result($link, $engine, "s", "TIMESTAMP", @date('Y-m-d H:i:s'), 960);
-
- func_mysqli_stmt_get_result($link, $engine, "s", "TIME", @date('H:i:s'), 980);
- func_mysqli_stmt_get_result($link, $engine, "s", "TIME NOT NULL", @date('H:i:s'), 1000);
- func_mysqli_stmt_get_result($link, $engine, "s", "TIME", NULL, 1020);
-
- $tmp = intval(@date('Y'));
- func_mysqli_stmt_get_result($link, $engine, "s", "YEAR", $tmp, 1040, "integer");
- func_mysqli_stmt_get_result($link, $engine, "s", "YEAR NOT NULL", $tmp, 1060, "integer");
- func_mysqli_stmt_get_result($link, $engine, "s", "YEAR", NULL, 1080);
-
- $string255 = func_mysqli_stmt_bind_make_string(255);
- func_mysqli_stmt_get_result($link, $engine, "s", "CHAR(1)", "a", 1110, 'string');
- func_mysqli_stmt_get_result($link, $engine, "s", "CHAR(255)", $string255, 1120, 'string');
- func_mysqli_stmt_get_result($link, $engine, "s", "CHAR(1) NOT NULL", "a", 1140, 'string');
- func_mysqli_stmt_get_result($link, $engine, "s", "CHAR(1)", NULL, 1160);
-
- $string65k = func_mysqli_stmt_bind_make_string(65535);
- func_mysqli_stmt_get_result($link, $engine, "s", "VARCHAR(1)", "a", 1180, 'string');
- func_mysqli_stmt_get_result($link, $engine, "s", "VARCHAR(255)", $string255, 1200, 'string');
- func_mysqli_stmt_get_result($link, $engine, "s", "VARCHAR(65635)", $string65k, 1220, 'string');
- func_mysqli_stmt_get_result($link, $engine, "s", "VARCHAR(1) NOT NULL", "a", 1240, 'string');
- func_mysqli_stmt_get_result($link, $engine, "s", "VARCHAR(1)", NULL, 1260);
-
- func_mysqli_stmt_get_result($link, $engine, "s", "BINARY(1)", "a", 1280);
- func_mysqli_stmt_get_result($link, $engine, "s", "BINARY(1)", chr(0), 1300);
- func_mysqli_stmt_get_result($link, $engine, "s", "BINARY(1) NOT NULL", "b", 1320);
- func_mysqli_stmt_get_result($link, $engine, "s", "BINARY(1)", NULL, 1340);
-
- func_mysqli_stmt_get_result($link, $engine, "s", "VARBINARY(1)", "a", 1360);
- func_mysqli_stmt_get_result($link, $engine, "s", "VARBINARY(1)", chr(0), 1380);
- func_mysqli_stmt_get_result($link, $engine, "s", "VARBINARY(1) NOT NULL", "b", 1400);
- func_mysqli_stmt_get_result($link, $engine, "s", "VARBINARY(1)", NULL, 1420);
-
- func_mysqli_stmt_get_result($link, $engine, "s", "TINYBLOB", "a", 1440);
- func_mysqli_stmt_get_result($link, $engine, "s", "TINYBLOB", chr(0), 1460);
- func_mysqli_stmt_get_result($link, $engine, "s", "TINYBLOB NOT NULL", "b", 1480);
- func_mysqli_stmt_get_result($link, $engine, "s", "TINYBLOB", NULL, 1500);
-
- func_mysqli_stmt_get_result($link, $engine, "s", "TINYTEXT", "a", 1520, 'string');
- func_mysqli_stmt_get_result($link, $engine, "s", "TINYTEXT NOT NULL", "a", 1540, 'string');
- func_mysqli_stmt_get_result($link, $engine, "s", "TINYTEXT", NULL, 1560, 'string');
-
- // Note: you cannot insert any blob values this way. But you can check the API at least partly this way
- // Extra BLOB tests are in mysqli_stmt_send_long()
- func_mysqli_stmt_get_result($link, $engine, "b", "BLOB", "", 1580);
- func_mysqli_stmt_get_result($link, $engine, "b", "TEXT", "", 1600, 'string');
- func_mysqli_stmt_get_result($link, $engine, "b", "MEDIUMBLOB", "", 1620);
- func_mysqli_stmt_get_result($link, $engine, "b", "MEDIUMTEXT", "", 1640, 'string');
-
- /* Is this one related? http://bugs.php.net/bug.php?id=35759 */
- func_mysqli_stmt_get_result($link, $engine, "b", "LONGBLOB", "", 1660);
- func_mysqli_stmt_get_result($link, $engine, "b", "LONGTEXT", "", 1680, 'string');
-
- func_mysqli_stmt_get_result($link, $engine, "s", "ENUM('a', 'b')", "a", 1700, 'string');
- func_mysqli_stmt_get_result($link, $engine, "s", "ENUM('a', 'b')", NULL, 1720, 'string');
- func_mysqli_stmt_get_result($link, $engine, "s", "SET('a', 'b')", "a", 1740, 'string');
- func_mysqli_stmt_get_result($link, $engine, "s", "SET('a', 'b')", NULL, 1760, 'string');
-
- mysqli_close($link);
- print "done!";
+ require('connect.inc');
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+
+ function func_mysqli_stmt_get_result($link, $engine, $bind_type, $sql_type, $bind_value, $offset, $type_hint = null) {
+
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
+ printf("[%04d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if (!mysqli_query($link, sprintf("CREATE TABLE test(id INT, label %s, PRIMARY KEY(id)) ENGINE = %s", $sql_type, $engine))) {
+ // don't bail - column type might not be supported by the server, ignore this
+ return false;
+ }
+
+ if (!$stmt = mysqli_stmt_init($link)) {
+ printf("[%04d] [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)")) {
+ printf("[%04d] [%d] %s\n", $offset + 2, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+
+ $id = null;
+ if (!mysqli_stmt_bind_param($stmt, "i" . $bind_type, $id, $bind_value)) {
+ printf("[%04d] [%d] %s\n", $offset + 3, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_stmt_close($stmt);
+ return false;
+ }
+
+ for ($id = 1; $id < 4; $id++) {
+ if (!mysqli_stmt_execute($stmt)) {
+ printf("[%04d] [%d] %s\n", $offset + 3 + $id, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_stmt_close($stmt);
+ return false;
+ }
+ }
+ mysqli_stmt_close($stmt);
+
+ $stmt = mysqli_stmt_init($link);
+
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test")) {
+ printf("[%04d] [%d] %s\n", $offset + 7, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_stmt_close($stmt);
+ return false;
+ }
+
+ if (!mysqli_stmt_execute($stmt)) {
+ printf("[%04d] [%d] %s\n", $offset + 8, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_stmt_close($stmt);
+ return false;
+ }
+
+ $result = mysqli_stmt_result_metadata($stmt);
+
+ if (!$res = mysqli_stmt_get_result($stmt)) {
+ printf("[%04d] [%d] %s\n", $offset + 9, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_stmt_close($stmt);
+ return false;
+ }
+ $num = 0;
+ $fields = mysqli_fetch_fields($result);
+
+ while ($row = mysqli_fetch_assoc($res)) {
+ $bind_res = &$row['label'];
+ if (!gettype($bind_res) == 'unicode') {
+ if ($bind_res !== $bind_value && (!$type_hint || ($type_hint !== gettype($bind_res)))) {
+ printf("[%04d] [%d] Expecting %s/'%s' [type hint = %s], got %s/'%s'\n",
+ $offset + 10, $num,
+ gettype($bind_value), $bind_value, $type_hint,
+ gettype($bind_res), $bind_res);
+ mysqli_free_result($res);
+ mysqli_stmt_close($stmt);
+ return false;
+ }
+ }
+ $num++;
+ }
+
+ if ($num != 3) {
+ printf("[%04d] [%d] %s, expecting 3 results, got only %d results\n",
+ $offset + 11, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), $num);
+ mysqli_free_result($res);
+ mysqli_stmt_close($stmt);
+ return false;
+ }
+
+ mysqli_free_result($res);
+ mysqli_stmt_close($stmt);
+ return true;
+ }
+
+
+ function func_mysqli_stmt_bind_make_string($len) {
+
+ $ret = '';
+ for ($i = 0; $i < $len; $i++)
+ $ret .= chr(mt_rand(65, 90));
+
+ return $ret;
+ }
+
+ func_mysqli_stmt_get_result($link, $engine, "i", "TINYINT", -11, 20);
+ func_mysqli_stmt_get_result($link, $engine, "i", "TINYINT", NULL, 40);
+ func_mysqli_stmt_get_result($link, $engine, "i", "TINYINT UNSIGNED", 1, 60);
+ func_mysqli_stmt_get_result($link, $engine, "i", "TINYINT UNSIGNED", NULL, 80);
+
+ func_mysqli_stmt_get_result($link, $engine, "i", "BOOL", 1, 100);
+ func_mysqli_stmt_get_result($link, $engine, "i", "BOOL", NULL, 120);
+ func_mysqli_stmt_get_result($link, $engine, "i", "BOOLEAN", 0, 140);
+ func_mysqli_stmt_get_result($link, $engine, "i", "BOOLEAN", NULL, 160);
+
+ func_mysqli_stmt_get_result($link, $engine, "i", "SMALLINT", -32768, 180);
+ func_mysqli_stmt_get_result($link, $engine, "i", "SMALLINT", 32767, 200);
+ func_mysqli_stmt_get_result($link, $engine, "i", "SMALLINT", NULL, 220);
+ func_mysqli_stmt_get_result($link, $engine, "i", "SMALLINT UNSIGNED", 65535, 240);
+ func_mysqli_stmt_get_result($link, $engine, "i", "SMALLINT UNSIGNED", NULL, 260);
+
+ func_mysqli_stmt_get_result($link, $engine, "d", "MEDIUMINT", -8388608, 280, "integer");
+ func_mysqli_stmt_get_result($link, $engine, "d", "MEDIUMINT", 8388607, 300, "integer");
+ func_mysqli_stmt_get_result($link, $engine, "d", "MEDIUMINT", NULL, 320);
+ func_mysqli_stmt_get_result($link, $engine, "d", "MEDIUMINT UNSIGNED", 16777215, 340, "integer");
+ func_mysqli_stmt_get_result($link, $engine, "d", "MEDIUMINT UNSIGNED", NULL, 360);
+
+ func_mysqli_stmt_get_result($link, $engine, "i", "INTEGER", (defined("PHP_INT_MAX")) ? max(-1 * PHP_INT_MAX + 1, -2147483648) : 1, 380);
+ func_mysqli_stmt_get_result($link, $engine, "i", "INTEGER", -2147483647, 400, "integer");
+ func_mysqli_stmt_get_result($link, $engine, "i", "INTEGER", (defined("PHP_INT_MAX")) ? min(2147483647, PHP_INT_MAX) : 1, 420);
+ func_mysqli_stmt_get_result($link, $engine, "i", "INTEGER", NULL, 440);
+ func_mysqli_stmt_get_result($link, $engine, "i", "INTEGER UNSIGNED", (defined("PHP_INT_MAX")) ? min(4294967295, 2147483647) : 1, 460);
+ func_mysqli_stmt_get_result($link, $engine, "i", "INTEGER UNSIGNED", 4294967295, 480, (defined("PHP_INT_MAX") && (4294967295 > PHP_INT_MAX)) ? "string" : null);
+ func_mysqli_stmt_get_result($link, $engine, "i", "INTEGER UNSIGNED", NULL, 500);
+
+ /* test is broken too: we bind "integer" but value is a float
+ func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT", -9223372036854775808, 520);
+ func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT UNSIGNED", 18446744073709551615, 560);
+ */
+ func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT", NULL, 540);
+ func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT UNSIGNED", NULL, 580);
+ func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT", -1, 1780);
+ func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT UNSIGNED", 1, 1800);
+ func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT", -1 * PHP_INT_MAX + 1, 1820);
+ func_mysqli_stmt_get_result($link, $engine, "i", "BIGINT UNSIGNED", PHP_INT_MAX, 1840);
+ func_mysqli_stmt_get_result($link, $engine, "s", "BIGINT UNSIGNED", "18446744073709551615", 1860);
+ func_mysqli_stmt_get_result($link, $engine, "s", "BIGINT", "-9223372036854775808", 1880);
+
+ func_mysqli_stmt_get_result($link, $engine, "d", "FLOAT", -9223372036854775808 - 1.1, 600);
+ func_mysqli_stmt_get_result($link, $engine, "d", "FLOAT", NULL, 620);
+ func_mysqli_stmt_get_result($link, $engine, "d", "FLOAT UNSIGNED", 18446744073709551615 + 1.1, 640);
+ func_mysqli_stmt_get_result($link, $engine, "d", "FLOAT UNSIGNED ", NULL, 660);
+
+ // Yes, we need the temporary variable. The PHP casting will fouls us otherwise.
+ $tmp = strval('-99999999.99');
+ func_mysqli_stmt_get_result($link, $engine, "d", "DOUBLE(10,2)", $tmp, 680, "string");
+ func_mysqli_stmt_get_result($link, $engine, "d", "DOUBLE(10,2)", NULL, 700);
+ $tmp = strval('99999999.99');
+ func_mysqli_stmt_get_result($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", $tmp , 720, "string");
+ func_mysqli_stmt_get_result($link, $engine, "d", "DOUBLE(10,2) UNSIGNED", NULL, 740);
+ $tmp = strval('-99999999.99');
+ func_mysqli_stmt_get_result($link, $engine, "d", "DECIMAL(10,2)", $tmp, 760, "string");
+ func_mysqli_stmt_get_result($link, $engine, "d", "DECIMAL(10,2)", NULL, 780);
+ $tmp = strval('99999999.99');
+ func_mysqli_stmt_get_result($link, $engine, "d", "DECIMAL(10,2)", $tmp, 800, "string");
+ func_mysqli_stmt_get_result($link, $engine, "d", "DECIMAL(10,2)", NULL, 820);
+
+ // don't care about date() strict TZ warnings...
+ func_mysqli_stmt_get_result($link, $engine, "s", "DATE", @date('Y-m-d'), 840);
+ func_mysqli_stmt_get_result($link, $engine, "s", "DATE NOT NULL", @date('Y-m-d'), 860);
+ func_mysqli_stmt_get_result($link, $engine, "s", "DATE", NULL, 880);
+
+ func_mysqli_stmt_get_result($link, $engine, "s", "DATETIME", @date('Y-m-d H:i:s'), 900);
+ func_mysqli_stmt_get_result($link, $engine, "s", "DATETIME NOT NULL", @date('Y-m-d H:i:s'), 920);
+ func_mysqli_stmt_get_result($link, $engine, "s", "DATETIME", NULL, 940);
+
+ func_mysqli_stmt_get_result($link, $engine, "s", "TIMESTAMP", @date('Y-m-d H:i:s'), 960);
+
+ func_mysqli_stmt_get_result($link, $engine, "s", "TIME", @date('H:i:s'), 980);
+ func_mysqli_stmt_get_result($link, $engine, "s", "TIME NOT NULL", @date('H:i:s'), 1000);
+ func_mysqli_stmt_get_result($link, $engine, "s", "TIME", NULL, 1020);
+
+ $tmp = intval(@date('Y'));
+ func_mysqli_stmt_get_result($link, $engine, "s", "YEAR", $tmp, 1040, "integer");
+ func_mysqli_stmt_get_result($link, $engine, "s", "YEAR NOT NULL", $tmp, 1060, "integer");
+ func_mysqli_stmt_get_result($link, $engine, "s", "YEAR", NULL, 1080);
+
+ $string255 = func_mysqli_stmt_bind_make_string(255);
+ func_mysqli_stmt_get_result($link, $engine, "s", "CHAR(1)", "a", 1110, 'string');
+ func_mysqli_stmt_get_result($link, $engine, "s", "CHAR(255)", $string255, 1120, 'string');
+ func_mysqli_stmt_get_result($link, $engine, "s", "CHAR(1) NOT NULL", "a", 1140, 'string');
+ func_mysqli_stmt_get_result($link, $engine, "s", "CHAR(1)", NULL, 1160);
+
+ $string65k = func_mysqli_stmt_bind_make_string(65535);
+ func_mysqli_stmt_get_result($link, $engine, "s", "VARCHAR(1)", "a", 1180, 'string');
+ func_mysqli_stmt_get_result($link, $engine, "s", "VARCHAR(255)", $string255, 1200, 'string');
+ func_mysqli_stmt_get_result($link, $engine, "s", "VARCHAR(65635)", $string65k, 1220, 'string');
+ func_mysqli_stmt_get_result($link, $engine, "s", "VARCHAR(1) NOT NULL", "a", 1240, 'string');
+ func_mysqli_stmt_get_result($link, $engine, "s", "VARCHAR(1)", NULL, 1260);
+
+ func_mysqli_stmt_get_result($link, $engine, "s", "BINARY(1)", "a", 1280);
+ func_mysqli_stmt_get_result($link, $engine, "s", "BINARY(1)", chr(0), 1300);
+ func_mysqli_stmt_get_result($link, $engine, "s", "BINARY(1) NOT NULL", "b", 1320);
+ func_mysqli_stmt_get_result($link, $engine, "s", "BINARY(1)", NULL, 1340);
+
+ func_mysqli_stmt_get_result($link, $engine, "s", "VARBINARY(1)", "a", 1360);
+ func_mysqli_stmt_get_result($link, $engine, "s", "VARBINARY(1)", chr(0), 1380);
+ func_mysqli_stmt_get_result($link, $engine, "s", "VARBINARY(1) NOT NULL", "b", 1400);
+ func_mysqli_stmt_get_result($link, $engine, "s", "VARBINARY(1)", NULL, 1420);
+
+ func_mysqli_stmt_get_result($link, $engine, "s", "TINYBLOB", "a", 1440);
+ func_mysqli_stmt_get_result($link, $engine, "s", "TINYBLOB", chr(0), 1460);
+ func_mysqli_stmt_get_result($link, $engine, "s", "TINYBLOB NOT NULL", "b", 1480);
+ func_mysqli_stmt_get_result($link, $engine, "s", "TINYBLOB", NULL, 1500);
+
+ func_mysqli_stmt_get_result($link, $engine, "s", "TINYTEXT", "a", 1520, 'string');
+ func_mysqli_stmt_get_result($link, $engine, "s", "TINYTEXT NOT NULL", "a", 1540, 'string');
+ func_mysqli_stmt_get_result($link, $engine, "s", "TINYTEXT", NULL, 1560, 'string');
+
+ // Note: you cannot insert any blob values this way. But you can check the API at least partly this way
+ // Extra BLOB tests are in mysqli_stmt_send_long()
+ func_mysqli_stmt_get_result($link, $engine, "b", "BLOB", "", 1580);
+ func_mysqli_stmt_get_result($link, $engine, "b", "TEXT", "", 1600, 'string');
+ func_mysqli_stmt_get_result($link, $engine, "b", "MEDIUMBLOB", "", 1620);
+ func_mysqli_stmt_get_result($link, $engine, "b", "MEDIUMTEXT", "", 1640, 'string');
+
+ /* Is this one related? http://bugs.php.net/bug.php?id=35759 */
+ func_mysqli_stmt_get_result($link, $engine, "b", "LONGBLOB", "", 1660);
+ func_mysqli_stmt_get_result($link, $engine, "b", "LONGTEXT", "", 1680, 'string');
+
+ func_mysqli_stmt_get_result($link, $engine, "s", "ENUM('a', 'b')", "a", 1700, 'string');
+ func_mysqli_stmt_get_result($link, $engine, "s", "ENUM('a', 'b')", NULL, 1720, 'string');
+ func_mysqli_stmt_get_result($link, $engine, "s", "SET('a', 'b')", "a", 1740, 'string');
+ func_mysqli_stmt_get_result($link, $engine, "s", "SET('a', 'b')", NULL, 1760, 'string');
+
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_get_warnings.phpt b/ext/mysqli/tests/mysqli_stmt_get_warnings.phpt
index 1ebe6d051f..c37c45af7d 100644
--- a/ext/mysqli/tests/mysqli_stmt_get_warnings.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_get_warnings.phpt
@@ -24,87 +24,82 @@ mysqli_query($link, "DROP TABLE IF EXISTS test");
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ require('table.inc');
- if (!is_null($tmp = @mysqli_stmt_get_warnings()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_null($tmp = @mysqli_stmt_get_warnings($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ try {
+ mysqli_stmt_get_warnings($stmt);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- require('table.inc');
+ if (!mysqli_stmt_prepare($stmt, "SET sql_mode=''") || !mysqli_stmt_execute($stmt))
+ printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!$stmt = mysqli_stmt_init($link))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_stmt_prepare($stmt, "DROP TABLE IF EXISTS test") || !mysqli_stmt_execute($stmt))
+ printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (false !== ($tmp = mysqli_stmt_get_warnings($stmt)))
- printf("[004] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_stmt_get_warnings($stmt)))
+ printf("[007] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- if (!mysqli_stmt_prepare($stmt, "SET sql_mode=''") || !mysqli_stmt_execute($stmt))
- printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "CREATE TABLE test(id SMALLINT, label CHAR(1))") || !mysqli_stmt_execute($stmt))
+ printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_prepare($stmt, "DROP TABLE IF EXISTS test") || !mysqli_stmt_execute($stmt))
- printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (false !== ($tmp = mysqli_stmt_get_warnings($stmt)))
+ printf("[009] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- if (false !== ($tmp = mysqli_stmt_get_warnings($stmt)))
- printf("[007] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (100000, 'a'), (100001, 'b')") ||
+ !mysqli_stmt_execute($stmt))
+ printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_prepare($stmt, "CREATE TABLE test(id SMALLINT, label CHAR(1))") || !mysqli_stmt_execute($stmt))
- printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!is_object($warning = mysqli_stmt_get_warnings($stmt)))
+ printf("[011] Expecting mysqli_warning object, got %s/%s\n", gettype($warning), $warning);
- if (false !== ($tmp = mysqli_stmt_get_warnings($stmt)))
- printf("[009] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+ if ('mysqli_warning' !== get_class($warning))
+ printf("[012] Expecting object of type mysqli_warning got type '%s'", get_class($warning));
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (100000, 'a'), (100001, 'b')") ||
- !mysqli_stmt_execute($stmt))
- printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!method_exists($warning, 'next'))
+ printf("[013] Object mysqli_warning seems to lack method next()\n");
- if (!is_object($warning = mysqli_stmt_get_warnings($stmt)))
- printf("[011] Expecting mysqli_warning object, got %s/%s\n", gettype($warning), $warning);
+ $i = 0;
+ do {
- if ('mysqli_warning' !== get_class($warning))
- printf("[012] Expecting object of type mysqli_warning got type '%s'", get_class($warning));
+ if ('' == $warning->message)
+ printf("[014 - %d] Message should not be empty\n", $i);
- if (!method_exists($warning, 'next'))
- printf("[013] Object mysqli_warning seems to lack method next()\n");
+ if ('' == $warning->sqlstate)
+ printf("[015 - %d] SQL State should not be empty\n", $i);
- $i = 0;
- do {
+ if (0 == $warning->errno)
+ printf("[016 - %d] Error number should not be zero\n", $i);
- if ('' == $warning->message)
- printf("[014 - %d] Message should not be empty\n", $i);
+ $i++;
- if ('' == $warning->sqlstate)
- printf("[015 - %d] SQL State should not be empty\n", $i);
+ } while ($warning->next());
- if (0 == $warning->errno)
- printf("[016 - %d] Error number should not be zero\n", $i);
+ if (2 != $i)
+ printf("[017] Expected 2 warnings, got %d warnings\n", $i);
- $i++;
+ mysqli_stmt_close($stmt);
- } while ($warning->next());
+ try {
+ mysqli_stmt_get_warnings($stmt);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- if (2 != $i)
- printf("[017] Expected 2 warnings, got %d warnings\n", $i);
-
- mysqli_stmt_close($stmt);
-
- if (false !== ($tmp = mysqli_stmt_get_warnings($stmt)))
- printf("[018] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
---EXPECTF--
-Warning: mysqli_stmt_get_warnings(): invalid object or resource mysqli_stmt
- in %s on line %d
-
-Warning: mysqli_stmt_get_warnings(): Couldn't fetch mysqli_stmt in %s on line %d
+--EXPECT--
+mysqli_stmt object is not fully initialized
+mysqli_stmt object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_stmt_init.phpt b/ext/mysqli/tests/mysqli_stmt_init.phpt
index b82a855dd2..e68b405acc 100644
--- a/ext/mysqli/tests/mysqli_stmt_init.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_init.phpt
@@ -8,51 +8,42 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- /*
- NOTE: no datatype tests here! This is done by
- mysqli_stmt_bind_result.phpt already. Restrict
- this test case to the basics.
- */
- require_once("connect.inc");
+ /*
+ NOTE: no datatype tests here! This is done by
+ mysqli_stmt_bind_result.phpt already. Restrict
+ this test case to the basics.
+ */
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ require('table.inc');
- if (!is_null($tmp = @mysqli_stmt_init()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_object($stmt = mysqli_stmt_init($link)))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_null($tmp = @mysqli_stmt_init($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_object($stmt2 = @mysqli_stmt_init($link)))
+ printf("[003a] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- require('table.inc');
+ try {
+ mysqli_stmt_close($stmt);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- if (!is_object($stmt = mysqli_stmt_init($link)))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_close($link);
- if (!is_object($stmt2 = @mysqli_stmt_init($link)))
- printf("[003a] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ try {
+ mysqli_stmt_init($link);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- mysqli_stmt_close($stmt);
-
- if (NULL !== ($tmp = mysqli_stmt_init($stmt)))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_close($link);
-
- if (false !== ($tmp = mysqli_stmt_init($link)))
- printf("[005] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
---EXPECTF--
-Warning: mysqli_stmt_close(): invalid object or resource mysqli_stmt
- in %s on line %d
-
-Warning: mysqli_stmt_init() expects parameter 1 to be mysqli, object given in %s on line %d
-
-Warning: mysqli_stmt_init(): Couldn't fetch mysqli in %s on line %d
+--EXPECT--
+mysqli_stmt object is not fully initialized
+mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_stmt_insert_id.phpt b/ext/mysqli/tests/mysqli_stmt_insert_id.phpt
index e3ef9a25ec..fe5e794e57 100644
--- a/ext/mysqli/tests/mysqli_stmt_insert_id.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_insert_id.phpt
@@ -8,70 +8,68 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ require('table.inc');
- if (!is_null($tmp = @mysqli_stmt_insert_id()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ $stmt = mysqli_stmt_init($link);
- $stmt = @new mysqli_stmt($link);
- if (!is_null($tmp = @mysqli_insert_id($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ try {
+ mysqli_stmt_insert_id($stmt);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- require('table.inc');
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 1") ||
+ !mysqli_stmt_execute($stmt)) {
+ printf("[004] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
- $stmt = mysqli_stmt_init($link);
- if (false !== ($tmp = @mysqli_stmt_insert_id($stmt)))
- printf("[003] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (0 !== ($tmp = mysqli_stmt_insert_id($stmt)))
+ printf("[005] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+ mysqli_stmt_close($stmt);
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 1") ||
- !mysqli_stmt_execute($stmt)) {
- printf("[004] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
+ // no auto_increment column
+ $stmt = mysqli_stmt_init($link);
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (100, 'a')") ||
+ !mysqli_stmt_execute($stmt)) {
+ printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
- if (0 !== ($tmp = mysqli_stmt_insert_id($stmt)))
- printf("[005] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_stmt_close($stmt);
+ if (0 !== ($tmp = mysqli_stmt_insert_id($stmt)))
+ printf("[007] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
- // no auto_increment column
- $stmt = mysqli_stmt_init($link);
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (100, 'a')") ||
- !mysqli_stmt_execute($stmt)) {
- printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
+ if (mysqli_get_server_version($link) > 50000 &&
+ (!mysqli_stmt_prepare($stmt, "ALTER TABLE test MODIFY id INT NOT NULL AUTO_INCREMENT") ||
+ !mysqli_stmt_execute($stmt))) {
+ printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ } else if (mysqli_get_server_version($link) < 50000){
+ mysqli_query($link, "ALTER TABLE test MODIFY id INT NOT NULL AUTO_INCREMENT");
+ }
- if (0 !== ($tmp = mysqli_stmt_insert_id($stmt)))
- printf("[007] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(label) VALUES ('a')") ||
+ !mysqli_stmt_execute($stmt)) {
+ printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
+ if (0 === ($tmp = mysqli_stmt_insert_id($stmt)))
+ printf("[010] Expecting int/any non zero, got %s/%s\n", gettype($tmp), $tmp);
+ mysqli_stmt_close($stmt);
- if (mysqli_get_server_version($link) > 50000 &&
- (!mysqli_stmt_prepare($stmt, "ALTER TABLE test MODIFY id INT NOT NULL AUTO_INCREMENT") ||
- !mysqli_stmt_execute($stmt))) {
- printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- } else if (mysqli_get_server_version($link) < 50000){
- mysqli_query($link, "ALTER TABLE test MODIFY id INT NOT NULL AUTO_INCREMENT");
- }
+ mysqli_close($link);
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(label) VALUES ('a')") ||
- !mysqli_stmt_execute($stmt)) {
- printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
- if (0 === ($tmp = mysqli_stmt_insert_id($stmt)))
- printf("[010] Expecting int/any non zero, got %s/%s\n", gettype($tmp), $tmp);
- mysqli_stmt_close($stmt);
+ try {
+ mysqli_stmt_insert_id($stmt);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- mysqli_close($link);
-
- var_dump(mysqli_stmt_insert_id($stmt));
-
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
---EXPECTF--
-Warning: mysqli_stmt_insert_id(): Couldn't fetch mysqli_stmt in %s on line %d
-bool(false)
+--EXPECT--
+mysqli_stmt object is not fully initialized
+mysqli_stmt object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_stmt_multires.phpt b/ext/mysqli/tests/mysqli_stmt_multires.phpt
index 23a8ad27a8..abb9ecbfb2 100644
--- a/ext/mysqli/tests/mysqli_stmt_multires.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_multires.phpt
@@ -11,86 +11,86 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
- require('table.inc');
-
- $stmt = mysqli_stmt_init($link);
- if (!$link->query('DROP PROCEDURE IF EXISTS p123')) {
- printf("[001] [%d] %s\n", $link->error, $link->errno);
- }
-
- if (!$link->query("CREATE PROCEDURE p123() BEGIN SELECT id+12, CONCAT_WS('-',label,'ahoi') FROM test ORDER BY id LIMIT 1; SELECT id + 42, CONCAT_WS('---',label, label) FROM test ORDER BY id LIMIT 1; END")) {
- printf("[002] [%d] %s\n", $link->error, $link->errno);
- }
-
- if (!($stmt = $link->prepare("CALL p123"))) {
- printf("[003] [%d] %s\n", $stmt->error, $stmt->errno);
- }
-
- if (!$stmt->execute()) {
- printf("[005] [%d] %s\n", $stmt->error, $stmt->errno);
- }
-
- $c_id = NULL;
- $c_label = NULL;
- if (!$stmt->bind_result($c_id, $c_label)) {
- printf("[004] [%d] %s\n", $stmt->error, $stmt->errno);
- }
- var_dump("pre:",$c_id, $c_label);
-
- if (!$stmt->fetch()) {
- printf("[006] [%d] %s\n", $stmt->error, $stmt->errno);
- }
-
- var_dump("post:",$c_id, $c_label);
-
- if ($stmt->fetch()) {
- printf("[007] Shouldn't have fetched anything\n");
- var_dump($c_id, $c_label);
- }
-
- if ($stmt->fetch()) {
- printf("[008] No more rows expected\n");
- }
-
- if (!$stmt->more_results()) {
- printf("[009] Expected more results\n");
- } else {
- var_dump("[009] next_result:", $stmt->next_result());
- }
-
- if (!$stmt->bind_result($c_id, $c_label)) {
- printf("[010] [%d] %s\n", $stmt->error, $stmt->errno);
- }
- var_dump("pre:",$c_id, $c_label);
-
- if (!$stmt->fetch()) {
- printf("[011] [%d] %s\n", $stmt->error, $stmt->errno);
- }
-
- var_dump("post:",$c_id, $c_label);
-
- if ($stmt->fetch()) {
- printf("[012] No more rows expected\n");
- }
-
- if (!$stmt->more_results()) {
- printf("[013] Expected more results\n");
- } else {
- var_dump("[013] next_result:", $stmt->next_result());
- }
-
- if ($stmt->more_results()) {
- printf("[014] No more results expected\n");
- } else {
- printf("[014] No result, as expected\n");
- }
-
- $stmt->close();
- $link->close();
-
-
- echo "done";
+ require_once("connect.inc");
+ require('table.inc');
+
+ $stmt = mysqli_stmt_init($link);
+ if (!$link->query('DROP PROCEDURE IF EXISTS p123')) {
+ printf("[001] [%d] %s\n", $link->error, $link->errno);
+ }
+
+ if (!$link->query("CREATE PROCEDURE p123() BEGIN SELECT id+12, CONCAT_WS('-',label,'ahoi') FROM test ORDER BY id LIMIT 1; SELECT id + 42, CONCAT_WS('---',label, label) FROM test ORDER BY id LIMIT 1; END")) {
+ printf("[002] [%d] %s\n", $link->error, $link->errno);
+ }
+
+ if (!($stmt = $link->prepare("CALL p123"))) {
+ printf("[003] [%d] %s\n", $stmt->error, $stmt->errno);
+ }
+
+ if (!$stmt->execute()) {
+ printf("[005] [%d] %s\n", $stmt->error, $stmt->errno);
+ }
+
+ $c_id = NULL;
+ $c_label = NULL;
+ if (!$stmt->bind_result($c_id, $c_label)) {
+ printf("[004] [%d] %s\n", $stmt->error, $stmt->errno);
+ }
+ var_dump("pre:",$c_id, $c_label);
+
+ if (!$stmt->fetch()) {
+ printf("[006] [%d] %s\n", $stmt->error, $stmt->errno);
+ }
+
+ var_dump("post:",$c_id, $c_label);
+
+ if ($stmt->fetch()) {
+ printf("[007] Shouldn't have fetched anything\n");
+ var_dump($c_id, $c_label);
+ }
+
+ if ($stmt->fetch()) {
+ printf("[008] No more rows expected\n");
+ }
+
+ if (!$stmt->more_results()) {
+ printf("[009] Expected more results\n");
+ } else {
+ var_dump("[009] next_result:", $stmt->next_result());
+ }
+
+ if (!$stmt->bind_result($c_id, $c_label)) {
+ printf("[010] [%d] %s\n", $stmt->error, $stmt->errno);
+ }
+ var_dump("pre:",$c_id, $c_label);
+
+ if (!$stmt->fetch()) {
+ printf("[011] [%d] %s\n", $stmt->error, $stmt->errno);
+ }
+
+ var_dump("post:",$c_id, $c_label);
+
+ if ($stmt->fetch()) {
+ printf("[012] No more rows expected\n");
+ }
+
+ if (!$stmt->more_results()) {
+ printf("[013] Expected more results\n");
+ } else {
+ var_dump("[013] next_result:", $stmt->next_result());
+ }
+
+ if ($stmt->more_results()) {
+ printf("[014] No more results expected\n");
+ } else {
+ printf("[014] No result, as expected\n");
+ }
+
+ $stmt->close();
+ $link->close();
+
+
+ echo "done";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_num_rows.phpt b/ext/mysqli/tests/mysqli_stmt_num_rows.phpt
index 5355b3deb7..33d9dfe552 100644
--- a/ext/mysqli/tests/mysqli_stmt_num_rows.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_num_rows.phpt
@@ -8,111 +8,104 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_num_rows()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_num_rows($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- require('table.inc');
-
- if (!$stmt = mysqli_stmt_init($link))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- function func_test_mysqli_stmt_num_rows($stmt, $query, $expected, $offset) {
-
- if (!mysqli_stmt_prepare($stmt, $query)) {
- printf("[%03d] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
-
- if (!mysqli_stmt_execute($stmt)) {
- printf("[%03d] [%d] %s\n", $offset + 1, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
-
- if (!mysqli_stmt_store_result($stmt)) {
- printf("[%03d] [%d] %s\n", $offset + 2, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
-
- if ($expected !== ($tmp = mysqli_stmt_num_rows($stmt)))
- printf("[%03d] Expecting %s/%d, got %s/%d\n", $offset + 3,
- gettype($expected), $expected,
- gettype($tmp), $tmp);
-
- mysqli_stmt_free_result($stmt);
-
- return true;
- }
-
- func_test_mysqli_stmt_num_rows($stmt, "SELECT 1 AS a", 1, 10);
- func_test_mysqli_stmt_num_rows($stmt, "SHOW VARIABLES LIKE '%nixnutz%'", 0, 20);
- // Note: for statements that return no result set mysqli_num_rows() differs from mysqli_stmt_num_rows() slightly
- // mysqli_num_rows() failed to fetch the result set and the PHP parameter check makes it return NULL
- // mysqli_stmt_numrows() has a valid resource to work on and it will return int/0 instead. No bug, but
- // slightly different behaviour... - if you really check the data types and don't rely on casting like 98% of all PHP
- // users do.
- func_test_mysqli_stmt_num_rows($stmt, "INSERT INTO test(id, label) VALUES (100, 'z')", 0, 30);
-
- if ($res = mysqli_query($link, 'SELECT COUNT(id) AS num FROM test')) {
- $row = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- func_test_mysqli_stmt_num_rows($stmt, "SELECT id, label FROM test", (int)$row['num'], 40);
- } else {
- printf("[050] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
-
- print "run_tests.php don't fool me with your 'ungreedy' expression '.+?'!\n";
-
- if (!mysqli_stmt_prepare($stmt, 'SELECT id FROM test'))
- printf("[051] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (mysqli_stmt_execute($stmt)) {
-
- $i = 0;
- do {
- if (0 !== ($tmp = mysqli_stmt_num_rows($stmt)))
- printf("[53 - %03d] Expecting int/0, got %s/%s\n", $i, gettype($tmp), $tmp);
- $i++;
- } while (mysqli_stmt_fetch($stmt));
-
- /* NOTE to users
- Behaviour with libmysql is UNDEFINED, see http://news.php.net/php.internals/55210
- Because it is undefined it is allowed to the mysqlnd DEVELOPER to implement
- any behaviour they like, including the one checked for in this test.
- What the test does is cover an implementation detail of the mysqlnd library.
- This implementation detail may, at any time, change without prior notice.
- On the contrary, the mysqlnd way is a reasonable one and, maybe, one fine
- day, after Klingons visited earh, becomes the official one. Meanwhile do
- not rely on it.
- */
- if ($IS_MYSQLND && (7 !== ($tmp = mysqli_stmt_num_rows($stmt))))
- printf("[54] Expecting int/7, got %s/%s\n", gettype($tmp), $tmp);
-
- } else {
- printf("[055] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
-
- mysqli_stmt_close($stmt);
-
- if (false !== ($tmp = mysqli_stmt_num_rows($stmt)))
- printf("[056] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_close($link);
- print "done!";
+ require_once("connect.inc");
+
+ require('table.inc');
+
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ function func_test_mysqli_stmt_num_rows($stmt, $query, $expected, $offset) {
+
+ if (!mysqli_stmt_prepare($stmt, $query)) {
+ printf("[%03d] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+
+ if (!mysqli_stmt_execute($stmt)) {
+ printf("[%03d] [%d] %s\n", $offset + 1, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+
+ if (!mysqli_stmt_store_result($stmt)) {
+ printf("[%03d] [%d] %s\n", $offset + 2, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+
+ if ($expected !== ($tmp = mysqli_stmt_num_rows($stmt)))
+ printf("[%03d] Expecting %s/%d, got %s/%d\n", $offset + 3,
+ gettype($expected), $expected,
+ gettype($tmp), $tmp);
+
+ mysqli_stmt_free_result($stmt);
+
+ return true;
+ }
+
+ func_test_mysqli_stmt_num_rows($stmt, "SELECT 1 AS a", 1, 10);
+ func_test_mysqli_stmt_num_rows($stmt, "SHOW VARIABLES LIKE '%nixnutz%'", 0, 20);
+ // Note: for statements that return no result set mysqli_num_rows() differs from mysqli_stmt_num_rows() slightly
+ // mysqli_num_rows() failed to fetch the result set and the PHP parameter check makes it return NULL
+ // mysqli_stmt_numrows() has a valid resource to work on and it will return int/0 instead. No bug, but
+ // slightly different behaviour... - if you really check the data types and don't rely on casting like 98% of all PHP
+ // users do.
+ func_test_mysqli_stmt_num_rows($stmt, "INSERT INTO test(id, label) VALUES (100, 'z')", 0, 30);
+
+ if ($res = mysqli_query($link, 'SELECT COUNT(id) AS num FROM test')) {
+ $row = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ func_test_mysqli_stmt_num_rows($stmt, "SELECT id, label FROM test", (int)$row['num'], 40);
+ } else {
+ printf("[050] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ print "run_tests.php don't fool me with your 'ungreedy' expression '.+?'!\n";
+
+ if (!mysqli_stmt_prepare($stmt, 'SELECT id FROM test'))
+ printf("[051] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (mysqli_stmt_execute($stmt)) {
+
+ $i = 0;
+ do {
+ if (0 !== ($tmp = mysqli_stmt_num_rows($stmt)))
+ printf("[53 - %03d] Expecting int/0, got %s/%s\n", $i, gettype($tmp), $tmp);
+ $i++;
+ } while (mysqli_stmt_fetch($stmt));
+
+ /* NOTE to users
+ Behaviour with libmysql is UNDEFINED, see http://news.php.net/php.internals/55210
+ Because it is undefined it is allowed to the mysqlnd DEVELOPER to implement
+ any behaviour they like, including the one checked for in this test.
+ What the test does is cover an implementation detail of the mysqlnd library.
+ This implementation detail may, at any time, change without prior notice.
+ On the contrary, the mysqlnd way is a reasonable one and, maybe, one fine
+ day, after Klingons visited earh, becomes the official one. Meanwhile do
+ not rely on it.
+ */
+ if ($IS_MYSQLND && (7 !== ($tmp = mysqli_stmt_num_rows($stmt))))
+ printf("[54] Expecting int/7, got %s/%s\n", gettype($tmp), $tmp);
+
+ } else {
+ printf("[055] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
+
+ mysqli_stmt_close($stmt);
+
+ try {
+ mysqli_stmt_num_rows($stmt);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
---EXPECTF--
+--EXPECT--
run_tests.php don't fool me with your 'ungreedy' expression '.+?'!
-
-Warning: mysqli_stmt_num_rows(): Couldn't fetch mysqli_stmt in %s on line %d
+mysqli_stmt object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_stmt_param_count.phpt b/ext/mysqli/tests/mysqli_stmt_param_count.phpt
index e847d165f6..49e5517177 100644
--- a/ext/mysqli/tests/mysqli_stmt_param_count.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_param_count.phpt
@@ -8,65 +8,55 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ require('table.inc');
- if (!is_null($tmp = @mysqli_stmt_param_count()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_null($tmp = @mysqli_stmt_param_count($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ try {
+ mysqli_stmt_param_count($stmt);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- require('table.inc');
+ function func_test_mysqli_stmt_param_count($stmt, $query, $expected, $offset) {
- if (!$stmt = mysqli_stmt_init($link))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_stmt_prepare($stmt, $query)) {
+ printf("[%03d] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_error($stmt));
+ return false;
+ }
- if (false !== ($tmp = mysqli_stmt_param_count($stmt)))
- printf("[004] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if ($expected !== ($tmp = mysqli_stmt_param_count($stmt)))
+ printf("[%03d] Expecting %s/%d, got %s/%d\n", $offset + 3,
+ gettype($expected), $expected,
+ gettype($tmp), $tmp);
+ return true;
+ }
- function func_test_mysqli_stmt_param_count($stmt, $query, $expected, $offset) {
+ func_test_mysqli_stmt_param_count($stmt, "SELECT 1 AS a", 0, 10);
+ func_test_mysqli_stmt_param_count($stmt, "INSERT INTO test(id) VALUES (?)", 1, 20);
+ func_test_mysqli_stmt_param_count($stmt, "INSERT INTO test(id, label) VALUES (?, ?)", 2, 30);
+ func_test_mysqli_stmt_param_count($stmt, "INSERT INTO test(id, label) VALUES (?, '?')", 1, 40);
- if (!mysqli_stmt_prepare($stmt, $query)) {
- printf("[%03d] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_error($stmt));
- return false;
- }
+ mysqli_stmt_close($stmt);
- if ($expected !== ($tmp = mysqli_stmt_param_count($stmt)))
- printf("[%03d] Expecting %s/%d, got %s/%d\n", $offset + 3,
- gettype($expected), $expected,
- gettype($tmp), $tmp);
- return true;
- }
+ try {
+ mysqli_stmt_param_count($stmt);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- func_test_mysqli_stmt_param_count($stmt, "SELECT 1 AS a", 0, 10);
- func_test_mysqli_stmt_param_count($stmt, "INSERT INTO test(id) VALUES (?)", 1, 20);
- func_test_mysqli_stmt_param_count($stmt, "INSERT INTO test(id, label) VALUES (?, ?)", 2, 30);
- func_test_mysqli_stmt_param_count($stmt, "INSERT INTO test(id, label) VALUES (?, '?')", 1, 40);
+ mysqli_close($link);
- mysqli_stmt_close($stmt);
-
- if (false !== ($tmp = mysqli_stmt_param_count($stmt)))
- printf("[40] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_close($link);
-
- /* Check that the function alias exists. It's a deprecated function,
- but we have not announce the removal so far, therefore we need to check for it */
- if (!is_null($tmp = @mysqli_stmt_param_count()))
- printf("[041] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
--EXPECTF--
-Warning: mysqli_stmt_param_count(): invalid object or resource mysqli_stmt
- in %s on line %d
-
-Warning: mysqli_stmt_param_count(): Couldn't fetch mysqli_stmt in %s on line %d
+mysqli_stmt object is not fully initialized
+mysqli_stmt object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_stmt_prepare.phpt b/ext/mysqli/tests/mysqli_stmt_prepare.phpt
index d0e38075d9..0f89a705c9 100644
--- a/ext/mysqli/tests/mysqli_stmt_prepare.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_prepare.phpt
@@ -8,49 +8,40 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- // Note: No SQL tests here! We can expand one of the *fetch()
- // tests to a generic SQL test, if we ever need that.
- // We would duplicate the SQL test cases if we have it here and in one of the
- // fetch tests, because the fetch tests would have to call prepare/execute etc.
- // anyway.
+ // Note: No SQL tests here! We can expand one of the *fetch()
+ // tests to a generic SQL test, if we ever need that.
+ // We would duplicate the SQL test cases if we have it here and in one of the
+ // fetch tests, because the fetch tests would have to call prepare/execute etc.
+ // anyway.
- $tmp = NULL;
- $link = NULL;
+ require('table.inc');
- if (!is_null($tmp = @mysqli_stmt_prepare()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_null($tmp = @mysqli_stmt_prepare($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (false !== ($tmp = mysqli_stmt_prepare($stmt, '')))
+ printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ if (true !== ($tmp = mysqli_stmt_prepare($stmt, 'SELECT id FROM test')))
+ printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (!$stmt = mysqli_stmt_init($link))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_stmt_close($stmt);
- if (NULL !== ($tmp = @mysqli_stmt_prepare($stmt)))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ try {
+ mysqli_stmt_prepare($stmt, "SELECT id FROM test");
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- if (false !== ($tmp = mysqli_stmt_prepare($stmt, '')))
- printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (true !== ($tmp = mysqli_stmt_prepare($stmt, 'SELECT id FROM test')))
- printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_stmt_close($stmt);
-
- if (false !== ($tmp = mysqli_stmt_prepare($stmt, "SELECT id FROM test")))
- printf("[007] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
---EXPECTF--
-Warning: mysqli_stmt_prepare(): Couldn't fetch mysqli_stmt in %s on line %d
+--EXPECT--
+mysqli_stmt object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_stmt_reset.phpt b/ext/mysqli/tests/mysqli_stmt_reset.phpt
index b7ec4e3ed7..ac557b0c20 100644
--- a/ext/mysqli/tests/mysqli_stmt_reset.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_reset.phpt
@@ -8,105 +8,100 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- // Note: No SQL tests here! We can expand one of the *fetch()
- // tests to a generic SQL test, if we ever need that.
- // We would duplicate the SQL test cases if we have it here and in one of the
- // fetch tests, because the fetch tests would have to call prepare/execute etc.
- // anyway.
+ // Note: No SQL tests here! We can expand one of the *fetch()
+ // tests to a generic SQL test, if we ever need that.
+ // We would duplicate the SQL test cases if we have it here and in one of the
+ // fetch tests, because the fetch tests would have to call prepare/execute etc.
+ // anyway.
- $tmp = NULL;
- $link = NULL;
+ require('table.inc');
- if (!is_null($tmp = @mysqli_stmt_reset()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_null($tmp = @mysqli_stmt_reset($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ try {
+ mysqli_stmt_reset($stmt);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- require('table.inc');
+ if (true !== ($tmp = mysqli_stmt_prepare($stmt, 'SELECT id FROM test')))
+ printf("[005] Expecting boolean/true, got %s/%s, [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!$stmt = mysqli_stmt_init($link))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (true !== ($tmp = mysqli_stmt_reset($stmt)))
+ printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (false !== ($tmp = mysqli_stmt_reset($stmt)))
- printf("[004] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = mysqli_stmt_execute($stmt)))
+ printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
- if (true !== ($tmp = mysqli_stmt_prepare($stmt, 'SELECT id FROM test')))
- printf("[005] Expecting boolean/true, got %s/%s, [%d] %s\n",
- gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $id = null;
+ if (!mysqli_stmt_bind_result($stmt, $id))
+ printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (true !== ($tmp = mysqli_stmt_reset($stmt)))
- printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_stmt_fetch($stmt))
+ printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (true !== ($tmp = mysqli_stmt_execute($stmt)))
- printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+ var_dump($id);
+ mysqli_stmt_close($stmt);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $id = null;
- if (!mysqli_stmt_bind_result($stmt, $id))
- printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
+ printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_stmt_fetch($stmt))
- printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_query($link, "CREATE TABLE test(id INT NOT NULL AUTO_INCREMENT, label BLOB, PRIMARY KEY(id))"))
+ printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump($id);
- mysqli_stmt_close($stmt);
- if (!$stmt = mysqli_stmt_init($link))
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(label) VALUES (?)"))
+ printf("[013] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
- printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $label = null;
+ if (!mysqli_stmt_bind_param($stmt, "b", $label))
+ printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_query($link, "CREATE TABLE test(id INT NOT NULL AUTO_INCREMENT, label BLOB, PRIMARY KEY(id))"))
- printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $label = 'abc';
+ for ($i = 0; $i < 10; $i++) {
+ if (!mysqli_stmt_send_long_data($stmt, 0, $label))
+ printf("[015 - %d] [%d] %s\n", $i, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(label) VALUES (?)"))
- printf("[013] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_reset($stmt))
+ printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $label = null;
- if (!mysqli_stmt_bind_param($stmt, "b", $label))
- printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_execute($stmt))
+ printf("[017] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $label = 'abc';
- for ($i = 0; $i < 10; $i++) {
- if (!mysqli_stmt_send_long_data($stmt, 0, $label))
- printf("[015 - %d] [%d] %s\n", $i, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
+ if (!$res = mysqli_query($link, "SELECT label FROM test"))
+ printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_stmt_reset($stmt))
- printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_stmt_execute($stmt))
- printf("[017] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_free_result($res);
- if (!$res = mysqli_query($link, "SELECT label FROM test"))
- printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if ($row['label'] != '')
+ printf("[020] Expecting empty string, got string/%s\n", $row['label']);
- if (!$row = mysqli_fetch_assoc($res))
- printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_stmt_close($stmt);
- mysqli_free_result($res);
+ try {
+ mysqli_stmt_reset($stmt);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- if ($row['label'] != '')
- printf("[020] Expecting empty string, got string/%s\n", $row['label']);
-
- mysqli_stmt_close($stmt);
-
- if (false !== ($tmp = mysqli_stmt_reset($stmt)))
- printf("[021] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
---EXPECTF--
-Warning: mysqli_stmt_reset(): invalid object or resource mysqli_stmt
- in %s on line %d
+--EXPECT--
+mysqli_stmt object is not fully initialized
int(1)
-
-Warning: mysqli_stmt_reset(): Couldn't fetch mysqli_stmt in %s on line %d
+mysqli_stmt object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_stmt_result_metadata.phpt b/ext/mysqli/tests/mysqli_stmt_result_metadata.phpt
index 8f4e13ef39..aedcc5d9aa 100644
--- a/ext/mysqli/tests/mysqli_stmt_result_metadata.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_result_metadata.phpt
@@ -8,99 +8,90 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ require('table.inc');
- if (!is_null($tmp = @mysqli_stmt_result_metadata()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_null($tmp = @mysqli_stmt_result_metadata($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ try {
+ mysqli_stmt_result_metadata($stmt);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- require('table.inc');
+ if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test"))
+ printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!$stmt = mysqli_stmt_init($link))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!is_object(($res = mysqli_stmt_result_metadata($stmt))))
+ printf("[006] Expecting object, got %s/%s\n", gettype($tmp), $tmp);
- if (false !== ($tmp = mysqli_stmt_result_metadata($stmt)))
- printf("[004] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (2 !== ($tmp = mysqli_num_fields($res)))
+ printf("[007] Expecting int/2, got %s/%s, [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
- if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test"))
- printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!is_object($field0_fetch = mysqli_fetch_field($res)))
+ printf("[008] Expecting object, got %s/%s, [%d] %s\n",
+ gettype($field0_fetch), $field0_fetch, mysqli_errno($link), mysqli_error($link));
- if (!is_object(($res = mysqli_stmt_result_metadata($stmt))))
- printf("[006] Expecting object, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_object($field0_direct = mysqli_fetch_field_direct($res, 0)))
+ printf("[009] Expecting object, got %s/%s, [%d] %s\n",
+ gettype($field0_direct), $field0_direct, mysqli_errno($link), mysqli_error($link));
- if (2 !== ($tmp = mysqli_num_fields($res)))
- printf("[007] Expecting int/2, got %s/%s, [%d] %s\n",
- gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
+ if ($field0_fetch != $field0_direct) {
+ printf("[010] mysqli_fetch_field() differs from mysqli_fetch_field_direct()\n");
+ var_dump($field0_fetch);
+ var_dump($field0_direct);
+ }
- if (!is_object($field0_fetch = mysqli_fetch_field($res)))
- printf("[008] Expecting object, got %s/%s, [%d] %s\n",
- gettype($field0_fetch), $field0_fetch, mysqli_errno($link), mysqli_error($link));
+ var_dump($field0_fetch);
- if (!is_object($field0_direct = mysqli_fetch_field_direct($res, 0)))
- printf("[009] Expecting object, got %s/%s, [%d] %s\n",
- gettype($field0_direct), $field0_direct, mysqli_errno($link), mysqli_error($link));
+ if (!is_array($tmp = mysqli_fetch_fields($res)))
+ printf("[011] Expecting array, got %s/%s, [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
- if ($field0_fetch != $field0_direct) {
- printf("[010] mysqli_fetch_field() differs from mysqli_fetch_field_direct()\n");
- var_dump($field0_fetch);
- var_dump($field0_direct);
- }
+ if (empty($tmp[0]) || empty($tmp[1]) || $tmp[0] != $field0_direct) {
+ printf("[012] mysqli_fetch_fields() return value is suspicious\n");
+ var_dump($tmp);
+ }
- var_dump($field0_fetch);
+ if (!mysqli_field_seek($res, 1))
+ printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_array($tmp = mysqli_fetch_fields($res)))
- printf("[011] Expecting array, got %s/%s, [%d] %s\n",
- gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
+ if (!is_object($field1_direct = mysqli_fetch_field_direct($res, 1)))
+ printf("[014] Expecting object, got %s/%s, [%d] %s\n",
+ gettype($field1_direct), $field1_direct, mysqli_errno($link), mysqli_error($link));
- if (empty($tmp[0]) || empty($tmp[1]) || $tmp[0] != $field0_direct) {
- printf("[012] mysqli_fetch_fields() return value is suspicious\n");
- var_dump($tmp);
- }
+ if ($tmp[1] != $field1_direct) {
+ printf("[015] mysqli_fetch_field_direct() differs from mysqli_fetch_fields()\n");
+ var_dump($field1_direct);
+ var_dump($tmp);
+ }
- if (!mysqli_field_seek($res, 1))
- printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (1 !== ($tmp = mysqli_field_tell($res)))
+ printf("[016] Expecting int/1, got %s/%s, [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
- if (!is_object($field1_direct = mysqli_fetch_field_direct($res, 1)))
- printf("[014] Expecting object, got %s/%s, [%d] %s\n",
- gettype($field1_direct), $field1_direct, mysqli_errno($link), mysqli_error($link));
+ mysqli_free_result($res);
+ mysqli_stmt_close($stmt);
- if ($tmp[1] != $field1_direct) {
- printf("[015] mysqli_fetch_field_direct() differs from mysqli_fetch_fields()\n");
- var_dump($field1_direct);
- var_dump($tmp);
- }
+ try {
+ mysqli_stmt_result_metadata($stmt);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- if (1 !== ($tmp = mysqli_field_tell($res)))
- printf("[016] Expecting int/1, got %s/%s, [%d] %s\n",
- gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
-
- mysqli_free_result($res);
- mysqli_stmt_close($stmt);
-
- if (false !== ($tmp = mysqli_stmt_result_metadata($stmt)))
- printf("[017] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- /* Check that the function alias exists. It's a deprecated function,
- but we have not announce the removal so far, therefore we need to check for it */
- if (!is_null($tmp = @mysqli_stmt_result_metadata()))
- printf("[018] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
--EXPECTF--
-Warning: mysqli_stmt_result_metadata(): invalid object or resource mysqli_stmt
- in %s on line %d
-object(stdClass)#5 (13) {
+mysqli_stmt object is not fully initialized
+object(stdClass)#%d (13) {
["name"]=>
string(2) "id"
["orgname"]=>
@@ -128,6 +119,5 @@ object(stdClass)#5 (13) {
["decimals"]=>
int(0)
}
-
-Warning: mysqli_stmt_result_metadata(): Couldn't fetch mysqli_stmt in %s on line %d
+mysqli_stmt object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_stmt_result_metadata_sqltests.phpt b/ext/mysqli/tests/mysqli_stmt_result_metadata_sqltests.phpt
index 7f858e0216..a07719b906 100644
--- a/ext/mysqli/tests/mysqli_stmt_result_metadata_sqltests.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_result_metadata_sqltests.phpt
@@ -10,219 +10,219 @@ die("skip Check again when the Klingons visit earth - http://bugs.mysql.com/bug.
?>
--FILE--
<?php
- require('table.inc');
-
- function testStatement($offset, $link, $sql, $expected_lib, $expected_mysqlnd, $check_mysqlnd, $compare) {
-
- if (!$stmt = mysqli_stmt_init($link)) {
- printf("[%04d - %s] [%d] %s\n",
- $offset, $sql,
- mysqli_errno($link), mysqli_error($link));
- return false;
- }
-
- if (!@mysqli_stmt_prepare($stmt, $sql)) {
- /* Not all server versions will support all statements */
- /* Failing to prepare is OK */
- return true;
- }
-
- if (empty($expected_lib) && (false !== $res)) {
- printf("[%04d - %s] No metadata expected\n",
- $offset + 1, $sql);
- return false;
- } else if (!empty($expected_lib) && (false == $res)) {
- printf("[%04d - %s] Metadata expected\n",
- $offset + 2, $sql);
- return false;
- }
- if (!empty($expected_lib)) {
- if (!is_object($res)) {
- printf("[%04d - %s] [%d] %s\n",
- $offset + 3, $sql,
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
- if (get_class($res) != 'mysqli_result') {
- printf("[%04d - %s] Expecting object/mysqli_result got object/%s\n",
- $offset + 4, $sql, get_class($res));
- return false;
- }
-
- $meta = array(
- 'num_fields' => mysqli_num_fields($res),
- 'fetch_field' => mysqli_fetch_field($res),
- 'fetch_field_direct0' => mysqli_fetch_field_direct($res, 0),
- 'fetch_field_direct1' => @mysqli_fetch_field_direct($res, 1),
- 'fetch_fields' => count(mysqli_fetch_fields($res)),
- 'field_count' => $res->field_count,
- 'field_seek-1' => @mysqli_field_seek($res, -1),
- 'field_seek0' => mysqli_field_seek($res, 0),
- 'field_tell' => mysqli_field_tell($res),
- );
- if (is_object($meta['fetch_field'])) {
- $meta['fetch_field']->charsetnr = 'ignore';
- $meta['fetch_field']->flags = 'ignore';
- }
- if (is_object($meta['fetch_field_direct0'])) {
- $meta['fetch_field_direct0']->charsetnr = 'ignore';
- $meta['fetch_field_direct0']->flags = 'ignore';
- }
- if (is_object($meta['fetch_field_direct1'])) {
- $meta['fetch_field_direct1']->charsetnr = 'ignore';
- $meta['fetch_field_direct1']->flags = 'ignore';
- }
- mysqli_free_result($res);
-
- if ($meta != $expected_lib) {
- printf("[%04d - %s] Metadata differes from expected values\n",
- $offset + 5, $sql);
- var_dump($meta);
- var_dump($expected_lib);
- return false;
- }
- }
-
- if (function_exists('mysqli_stmt_get_result')) {
- /* mysqlnd only */
- if (!mysqli_stmt_execute($stmt)) {
- printf("[%04d - %s] [%d] %s\n",
- $offset + 6, $sql,
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
-
- $res = mysqli_stmt_get_result($stmt);
- if (false === $res && !empty($expected_mysqlnd)) {
- printf("[%04d - %s] Expecting resultset [%d] %s\n",
- $offset + 7, $sql,
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- } else if (empty($expected_mysqlnd) && false !== $res) {
- printf("[%04d - %s] Unexpected resultset [%d] %s\n",
- $offset + 8, $sql,
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
-
- if (!is_object($res)) {
- printf("[%04d - %s] [%d] %s\n",
- $offset + 9, $sql,
- mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- return false;
- }
- if ('mysqli_result' != get_class($res)) {
- printf("[%04d - %s] Expecting object/mysqli_result got object/%s\n",
- $offset + 10, $sql,
- get_class($res));
- return false;
- }
-
- $meta_res = array(
- 'num_fields' => mysqli_num_fields($res),
- 'fetch_field' => mysqli_fetch_field($res),
- 'fetch_field_direct0' => mysqli_fetch_field_direct($res, 0),
- 'fetch_field_direct1' => @mysqli_fetch_field_direct($res, 1),
- 'fetch_fields' => count(mysqli_fetch_fields($res)),
- 'field_count' => mysqli_field_count($link),
- 'field_seek-1' => @mysqli_field_seek($res, -1),
- 'field_seek0' => mysqli_field_seek($res, 0),
- 'field_tell' => mysqli_field_tell($res),
- );
- if (is_object($meta_res['fetch_field'])) {
- $meta_res['fetch_field']->charsetnr = 'ignore';
- $meta_res['fetch_field']->flags = 'ignore';
- }
- if (is_object($meta_res['fetch_field_direct0'])) {
- $meta_res['fetch_field_direct0']->charsetnr = 'ignore';
- $meta_res['fetch_field_direct0']->flags = 'ignore';
- }
- if (is_object($meta_res['fetch_field_direct1'])) {
- $meta_res['fetch_field_direct1']->charsetnr = 'ignore';
- $meta_res['fetch_field_direct1']->flags = 'ignore';
- }
- mysqli_free_result($res);
- if ($check_mysqlnd && $meta_res != $expected_mysqlnd) {
- printf("[%04d - %s] Metadata differs from expected\n",
- $offset + 11, $sql);
- var_dump($meta_res);
- var_dump($expected_mysqlnd);
- } else {
- if ($meta_res['field_count'] < 1) {
- printf("[%04d - %s] Metadata seems wrong, no fields?\n",
- $offset + 12, $sql);
- var_dump($meta_res);
- var_dump(mysqli_fetch_assoc($res));
- }
- }
-
- if ($compare && $meta_res != $meta) {
- printf("[%04d - %s] Metadata returned by mysqli_stmt_result_metadata() and mysqli_stmt_get_result() differ\n",
- $offset + 13, $sql);
- var_dump($meta_res);
- var_dump($meta);
- }
-
- }
-
- mysqli_stmt_close($stmt);
- return true;
- }
-
- /* Note: very weak testing, we accept almost any result */
-
- testStatement(100, $link, 'ANALYZE TABLE test', array(), array(1), false, false);
- testStatement(120, $link, 'OPTIMIZE TABLE test', array(), array(1), false, false);
- testStatement(140, $link, 'REPAIR TABLE test', array(), array(1), false, false);
-
- testStatement(160, $link, 'SHOW AUTHORS', array(), array(1), false, false);
- testStatement(180, $link, 'SHOW CHARACTER SET', array(), array(1), false, false);
- testStatement(200, $link, 'SHOW COLLATION', array(), array(1), false, false);
- testStatement(220, $link, 'SHOW CONTRIBUTORS', array(), array(1), false, false);
- testStatement(240, $link, 'SHOW CREATE DATABASE ' . $db, array(), array(1), false, false);
- testStatement(260, $link, 'SHOW DATABASES', array(), array(1), false, false);
- testStatement(280, $link, 'SHOW ENGINE InnoDB STATUS', array(), array(1), false, false);
- testStatement(300, $link, 'SHOW ENGINES', array(), array(1), false, false);
- testStatement(320, $link, 'SHOW PLUGINS', array(), array(1), false, false);
- testStatement(340, $link, 'SHOW PROCESSLIST', array(), array(1), false, false);
- testStatement(360, $link, 'SHOW FULL PROCESSLIST', array(), array(1), false, false);
- testStatement(380, $link, 'SHOW STATUS', array(), array(1), false, false);
- testStatement(400, $link, 'SHOW TABLE STATUS', array(), array(1), false, false);
- testStatement(420, $link, 'SHOW TABLE STATUS', array(), array(1), false, false);
- testStatement(440, $link, 'SHOW TABLES', array(), array(1), false, false);
- testStatement(460, $link, 'SHOW OPEN TABLES', array(), array(1), false, false);
- testStatement(460, $link, 'SHOW VARIABLES', array(), array(1), false, false);
-
- $field0 = new stdClass();
- $field0->name = 'id';
- $field0->orgname = 'id';
- $field0->table = 'test';
- $field0->orgtable = 'test';
- $field0->def = '';
- $field0->max_length = 0;
- $field0->length = 11;
- $field0->charsetnr = 'ignore';
- $field0->flags = 'ignore';
- $field0->type = MYSQLI_TYPE_LONG;
- $field0->decimals = 0;
- $meta_lib = array(
- 'num_fields' => 1,
- 'fetch_field' => $field0,
- 'fetch_field_direct0' => $field0,
- 'fetch_field_direct1' => false,
- 'fetch_fields' => 1,
- 'field_count' => 1,
- 'field_seek-1' => false,
- 'field_seek0' => true,
- 'field_tell' => 0,
- );
- $meta_mysqlnd = $meta_lib;
- testStatement(480, $link, 'SELECT id FROM test', $meta_lib, $meta_mysqlnd, true, true);
-
- testStatement(500, $link, 'CHECKSUM TABLE test', array(), array(1), false, false);
-
- mysqli_close($link);
- print "done!";
+ require('table.inc');
+
+ function testStatement($offset, $link, $sql, $expected_lib, $expected_mysqlnd, $check_mysqlnd, $compare) {
+
+ if (!$stmt = mysqli_stmt_init($link)) {
+ printf("[%04d - %s] [%d] %s\n",
+ $offset, $sql,
+ mysqli_errno($link), mysqli_error($link));
+ return false;
+ }
+
+ if (!@mysqli_stmt_prepare($stmt, $sql)) {
+ /* Not all server versions will support all statements */
+ /* Failing to prepare is OK */
+ return true;
+ }
+
+ if (empty($expected_lib) && (false !== $res)) {
+ printf("[%04d - %s] No metadata expected\n",
+ $offset + 1, $sql);
+ return false;
+ } else if (!empty($expected_lib) && (false == $res)) {
+ printf("[%04d - %s] Metadata expected\n",
+ $offset + 2, $sql);
+ return false;
+ }
+ if (!empty($expected_lib)) {
+ if (!is_object($res)) {
+ printf("[%04d - %s] [%d] %s\n",
+ $offset + 3, $sql,
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+ if (get_class($res) != 'mysqli_result') {
+ printf("[%04d - %s] Expecting object/mysqli_result got object/%s\n",
+ $offset + 4, $sql, get_class($res));
+ return false;
+ }
+
+ $meta = array(
+ 'num_fields' => mysqli_num_fields($res),
+ 'fetch_field' => mysqli_fetch_field($res),
+ 'fetch_field_direct0' => mysqli_fetch_field_direct($res, 0),
+ 'fetch_field_direct1' => @mysqli_fetch_field_direct($res, 1),
+ 'fetch_fields' => count(mysqli_fetch_fields($res)),
+ 'field_count' => $res->field_count,
+ 'field_seek-1' => @mysqli_field_seek($res, -1),
+ 'field_seek0' => mysqli_field_seek($res, 0),
+ 'field_tell' => mysqli_field_tell($res),
+ );
+ if (is_object($meta['fetch_field'])) {
+ $meta['fetch_field']->charsetnr = 'ignore';
+ $meta['fetch_field']->flags = 'ignore';
+ }
+ if (is_object($meta['fetch_field_direct0'])) {
+ $meta['fetch_field_direct0']->charsetnr = 'ignore';
+ $meta['fetch_field_direct0']->flags = 'ignore';
+ }
+ if (is_object($meta['fetch_field_direct1'])) {
+ $meta['fetch_field_direct1']->charsetnr = 'ignore';
+ $meta['fetch_field_direct1']->flags = 'ignore';
+ }
+ mysqli_free_result($res);
+
+ if ($meta != $expected_lib) {
+ printf("[%04d - %s] Metadata differs from expected values\n",
+ $offset + 5, $sql);
+ var_dump($meta);
+ var_dump($expected_lib);
+ return false;
+ }
+ }
+
+ if (function_exists('mysqli_stmt_get_result')) {
+ /* mysqlnd only */
+ if (!mysqli_stmt_execute($stmt)) {
+ printf("[%04d - %s] [%d] %s\n",
+ $offset + 6, $sql,
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+
+ $res = mysqli_stmt_get_result($stmt);
+ if (false === $res && !empty($expected_mysqlnd)) {
+ printf("[%04d - %s] Expecting resultset [%d] %s\n",
+ $offset + 7, $sql,
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ } else if (empty($expected_mysqlnd) && false !== $res) {
+ printf("[%04d - %s] Unexpected resultset [%d] %s\n",
+ $offset + 8, $sql,
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+
+ if (!is_object($res)) {
+ printf("[%04d - %s] [%d] %s\n",
+ $offset + 9, $sql,
+ mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ return false;
+ }
+ if ('mysqli_result' != get_class($res)) {
+ printf("[%04d - %s] Expecting object/mysqli_result got object/%s\n",
+ $offset + 10, $sql,
+ get_class($res));
+ return false;
+ }
+
+ $meta_res = array(
+ 'num_fields' => mysqli_num_fields($res),
+ 'fetch_field' => mysqli_fetch_field($res),
+ 'fetch_field_direct0' => mysqli_fetch_field_direct($res, 0),
+ 'fetch_field_direct1' => @mysqli_fetch_field_direct($res, 1),
+ 'fetch_fields' => count(mysqli_fetch_fields($res)),
+ 'field_count' => mysqli_field_count($link),
+ 'field_seek-1' => @mysqli_field_seek($res, -1),
+ 'field_seek0' => mysqli_field_seek($res, 0),
+ 'field_tell' => mysqli_field_tell($res),
+ );
+ if (is_object($meta_res['fetch_field'])) {
+ $meta_res['fetch_field']->charsetnr = 'ignore';
+ $meta_res['fetch_field']->flags = 'ignore';
+ }
+ if (is_object($meta_res['fetch_field_direct0'])) {
+ $meta_res['fetch_field_direct0']->charsetnr = 'ignore';
+ $meta_res['fetch_field_direct0']->flags = 'ignore';
+ }
+ if (is_object($meta_res['fetch_field_direct1'])) {
+ $meta_res['fetch_field_direct1']->charsetnr = 'ignore';
+ $meta_res['fetch_field_direct1']->flags = 'ignore';
+ }
+ mysqli_free_result($res);
+ if ($check_mysqlnd && $meta_res != $expected_mysqlnd) {
+ printf("[%04d - %s] Metadata differs from expected\n",
+ $offset + 11, $sql);
+ var_dump($meta_res);
+ var_dump($expected_mysqlnd);
+ } else {
+ if ($meta_res['field_count'] < 1) {
+ printf("[%04d - %s] Metadata seems wrong, no fields?\n",
+ $offset + 12, $sql);
+ var_dump($meta_res);
+ var_dump(mysqli_fetch_assoc($res));
+ }
+ }
+
+ if ($compare && $meta_res != $meta) {
+ printf("[%04d - %s] Metadata returned by mysqli_stmt_result_metadata() and mysqli_stmt_get_result() differ\n",
+ $offset + 13, $sql);
+ var_dump($meta_res);
+ var_dump($meta);
+ }
+
+ }
+
+ mysqli_stmt_close($stmt);
+ return true;
+ }
+
+ /* Note: very weak testing, we accept almost any result */
+
+ testStatement(100, $link, 'ANALYZE TABLE test', array(), array(1), false, false);
+ testStatement(120, $link, 'OPTIMIZE TABLE test', array(), array(1), false, false);
+ testStatement(140, $link, 'REPAIR TABLE test', array(), array(1), false, false);
+
+ testStatement(160, $link, 'SHOW AUTHORS', array(), array(1), false, false);
+ testStatement(180, $link, 'SHOW CHARACTER SET', array(), array(1), false, false);
+ testStatement(200, $link, 'SHOW COLLATION', array(), array(1), false, false);
+ testStatement(220, $link, 'SHOW CONTRIBUTORS', array(), array(1), false, false);
+ testStatement(240, $link, 'SHOW CREATE DATABASE ' . $db, array(), array(1), false, false);
+ testStatement(260, $link, 'SHOW DATABASES', array(), array(1), false, false);
+ testStatement(280, $link, 'SHOW ENGINE InnoDB STATUS', array(), array(1), false, false);
+ testStatement(300, $link, 'SHOW ENGINES', array(), array(1), false, false);
+ testStatement(320, $link, 'SHOW PLUGINS', array(), array(1), false, false);
+ testStatement(340, $link, 'SHOW PROCESSLIST', array(), array(1), false, false);
+ testStatement(360, $link, 'SHOW FULL PROCESSLIST', array(), array(1), false, false);
+ testStatement(380, $link, 'SHOW STATUS', array(), array(1), false, false);
+ testStatement(400, $link, 'SHOW TABLE STATUS', array(), array(1), false, false);
+ testStatement(420, $link, 'SHOW TABLE STATUS', array(), array(1), false, false);
+ testStatement(440, $link, 'SHOW TABLES', array(), array(1), false, false);
+ testStatement(460, $link, 'SHOW OPEN TABLES', array(), array(1), false, false);
+ testStatement(460, $link, 'SHOW VARIABLES', array(), array(1), false, false);
+
+ $field0 = new stdClass();
+ $field0->name = 'id';
+ $field0->orgname = 'id';
+ $field0->table = 'test';
+ $field0->orgtable = 'test';
+ $field0->def = '';
+ $field0->max_length = 0;
+ $field0->length = 11;
+ $field0->charsetnr = 'ignore';
+ $field0->flags = 'ignore';
+ $field0->type = MYSQLI_TYPE_LONG;
+ $field0->decimals = 0;
+ $meta_lib = array(
+ 'num_fields' => 1,
+ 'fetch_field' => $field0,
+ 'fetch_field_direct0' => $field0,
+ 'fetch_field_direct1' => false,
+ 'fetch_fields' => 1,
+ 'field_count' => 1,
+ 'field_seek-1' => false,
+ 'field_seek0' => true,
+ 'field_tell' => 0,
+ );
+ $meta_mysqlnd = $meta_lib;
+ testStatement(480, $link, 'SELECT id FROM test', $meta_lib, $meta_mysqlnd, true, true);
+
+ testStatement(500, $link, 'CHECKSUM TABLE test', array(), array(1), false, false);
+
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_send_long_data.phpt b/ext/mysqli/tests/mysqli_stmt_send_long_data.phpt
index 1fc2745511..00afa5513d 100644
--- a/ext/mysqli/tests/mysqli_stmt_send_long_data.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_send_long_data.phpt
@@ -8,123 +8,99 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ require('table.inc');
- if (!is_null($tmp = @mysqli_stmt_send_long_data()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_null($tmp = @mysqli_stmt_send_long_data($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
+ printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- require('table.inc');
+ if (!mysqli_query($link, sprintf("CREATE TABLE test(id INT NOT NULL AUTO_INCREMENT, label LONGBLOB, PRIMARY KEY(id)) ENGINE = %s", $engine)))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$stmt = mysqli_stmt_init($link))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
+ printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (NULL !== ($tmp = @mysqli_stmt_send_long_data($stmt, '')))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ $id = null;
+ $label = null;
+ if (!mysqli_stmt_bind_param($stmt, "ib", $id, $label))
+ printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
- printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, "SHOW VARIABLES LIKE 'max_allowed_packet'"))
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, sprintf("CREATE TABLE test(id INT NOT NULL AUTO_INCREMENT, label LONGBLOB, PRIMARY KEY(id)) ENGINE = %s", $engine)))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
- printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_free_result($res);
- $id = null;
- $label = null;
- if (!mysqli_stmt_bind_param($stmt, "ib", $id, $label))
- printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (isset($row['VARIABLE_VALUE']) && !isset($row['Value']))
+ // MySQL 6.0
+ $row['Value'] = $row['VARIABLE_VALUE'];
- if (!$res = mysqli_query($link, "SHOW VARIABLES LIKE 'max_allowed_packet'"))
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (0 === ($max_allowed_packet = (int)$row['Value']))
+ printf("[011] Cannot determine max_allowed_packet size and/or bogus max_allowed_packet setting used.\n");
- if (!$row = mysqli_fetch_assoc($res))
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ // let's ignore upper limits for LONGBLOB (2^32) ...
+ // maximum packet size up to which we test is 10M
+ $tmp = '';
+ $blob = '';
+ for ($i = 0; $i < 1024; $i++) {
+ $tmp .= 'a';
+ }
- mysqli_free_result($res);
+ $limit = min(floor($max_allowed_packet / 1024 / 2), 10240);
+ for ($i = 0; $i < $limit; $i++)
+ $blob .= $tmp;
+ /*
+ if (floor($max_allowed_packet / 1024) <= 10240) {
+ $limit = strlen($blob) - $max_allowed_packet - 1;
+ for ($i = 0; $i < $limit; $i++)
+ $blob .= 'a';
+ }
+ */
+ assert(strlen($blob) <= $max_allowed_packet);
- if (isset($row['VARIABLE_VALUE']) && !isset($row['Value']))
- // MySQL 6.0
- $row['Value'] = $row['VARIABLE_VALUE'];
+ if (false !== ($tmp = mysqli_stmt_send_long_data($stmt, -1, $blob)))
+ printf("[012] Expecting boolean/false, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (0 === ($max_allowed_packet = (int)$row['Value']))
- printf("[011] Cannot determine max_allowed_packet size and/or bogus max_allowed_packet setting used.\n");
+ if (false !== ($tmp = mysqli_stmt_send_long_data($stmt, 999, $blob)))
+ printf("[014] Expecting boolean/false, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- // let's ignore upper limits for LONGBLOB (2^32) ...
- // maximum packet size up to which we test is 10M
- $tmp = '';
- $blob = '';
- for ($i = 0; $i < 1024; $i++) {
- $tmp .= 'a';
- }
+ if (true !== ($tmp = mysqli_stmt_send_long_data($stmt, 1, $blob)))
+ printf("[015] Expecting boolean/true, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $limit = min(floor($max_allowed_packet / 1024 / 2), 10240);
- for ($i = 0; $i < $limit; $i++)
- $blob .= $tmp;
- /*
- if (floor($max_allowed_packet / 1024) <= 10240) {
- $limit = strlen($blob) - $max_allowed_packet - 1;
- for ($i = 0; $i < $limit; $i++)
- $blob .= 'a';
- }
- */
- assert(strlen($blob) <= $max_allowed_packet);
+ $id = 1;
+ if (true !== mysqli_stmt_execute($stmt))
+ printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_stmt_close($stmt);
- if (false !== ($tmp = mysqli_stmt_send_long_data($stmt, -1, $blob)))
- printf("[012] Expecting boolean/false, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id"))
+ printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (NULL !== ($tmp = @mysqli_stmt_send_long_data($stmt, PHP_INT_MAX + 1, $blob)))
- printf("[013] Expecting NULL, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (1 != ($tmp = mysqli_num_rows($res)))
+ printf("[018] Expecting 1 rows, mysqli_num_rows() reports %d rows. [%d] %s\n",
+ $tmp, mysqli_errno($link), mysqli_error($link));
- if (false !== ($tmp = mysqli_stmt_send_long_data($stmt, 999, $blob)))
- printf("[014] Expecting boolean/false, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (true !== ($tmp = mysqli_stmt_send_long_data($stmt, 1, $blob)))
- printf("[015] Expecting boolean/true, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_free_result($res);
- $id = 1;
- if (true !== mysqli_stmt_execute($stmt))
- printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- mysqli_stmt_close($stmt);
+ if (empty($row['id']) || empty($row['label']) || ($row['id'] != 1))
+ printf("[020] Record seems to be incomplete\n");
- if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id"))
- printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if ($blob != $row['label'])
+ printf("[021] Blob value has not been stored properly!\n");
- if (1 != ($tmp = mysqli_num_rows($res)))
- printf("[018] Expecting 1 rows, mysqli_num_rows() reports %d rows. [%d] %s\n",
- $tmp, mysqli_errno($link), mysqli_error($link));
-
- if (!$row = mysqli_fetch_assoc($res))
- printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- mysqli_free_result($res);
-
- if (empty($row['id']) || empty($row['label']) || ($row['id'] != 1))
- printf("[020] Record seems to be incomplete\n");
-
- if ($blob != $row['label'])
- printf("[021] Blob value has not been stored properly!\n");
-
- if (NULL !== ($tmp = @mysqli_stmt_send_long_data($stmt, '')))
- printf("[022] Expecting NULL, got %s/%s\n");
-
- /* Check that the function alias exists. It's a deprecated function,
- but we have not announce the removal so far, therefore we need to check for it */
- if (!is_null($tmp = @mysqli_stmt_send_long_data()))
- printf("[023] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_send_long_data_packet_size_libmysql.phpt b/ext/mysqli/tests/mysqli_stmt_send_long_data_packet_size_libmysql.phpt
index 38048894af..63c1f59bfe 100644
--- a/ext/mysqli/tests/mysqli_stmt_send_long_data_packet_size_libmysql.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_send_long_data_packet_size_libmysql.phpt
@@ -11,84 +11,84 @@ if (stristr(mysqli_get_client_info(), 'mysqlnd'))
?>
--FILE--
<?php
- require('table.inc');
+ require('table.inc');
- if (!$stmt = mysqli_stmt_init($link))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, sprintf("CREATE TABLE test(id INT NOT NULL AUTO_INCREMENT, label LONGBLOB, PRIMARY KEY(id)) ENGINE = %s", $engine)))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, sprintf("CREATE TABLE test(id INT NOT NULL AUTO_INCREMENT, label LONGBLOB, PRIMARY KEY(id)) ENGINE = %s", $engine)))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
- printf("[004] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
+ printf("[004] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $id = null;
- $label = null;
- if (!mysqli_stmt_bind_param($stmt, "ib", $id, $label))
- printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $id = null;
+ $label = null;
+ if (!mysqli_stmt_bind_param($stmt, "ib", $id, $label))
+ printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!$res = mysqli_query($link, "SHOW VARIABLES LIKE 'max_allowed_packet'"))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, "SHOW VARIABLES LIKE 'max_allowed_packet'"))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$row = mysqli_fetch_assoc($res))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
+ mysqli_free_result($res);
- if (0 === ($max_allowed_packet = (int)$row['Value']))
- printf("[008] Cannot determine max_allowed_packet size and/or bogus max_allowed_packet setting used.\n");
+ if (0 === ($max_allowed_packet = (int)$row['Value']))
+ printf("[008] Cannot determine max_allowed_packet size and/or bogus max_allowed_packet setting used.\n");
- // let's ignore upper limits for LONGBLOB (2^32) ...
- // maximum packet size up to which we test is 10M
- $tmp = '';
- $blob = '';
- for ($i = 0; $i < 1024; $i++) {
- $tmp .= 'a';
- }
+ // let's ignore upper limits for LONGBLOB (2^32) ...
+ // maximum packet size up to which we test is 10M
+ $tmp = '';
+ $blob = '';
+ for ($i = 0; $i < 1024; $i++) {
+ $tmp .= 'a';
+ }
- $limit = min(floor($max_allowed_packet / 1024 / 2), 10240);
- for ($i = 0; $i < $limit; $i++)
- $blob .= $tmp;
+ $limit = min(floor($max_allowed_packet / 1024 / 2), 10240);
+ for ($i = 0; $i < $limit; $i++)
+ $blob .= $tmp;
- assert(strlen($blob) <= $max_allowed_packet);
+ assert(strlen($blob) <= $max_allowed_packet);
- if (true != ($tmp = mysqli_stmt_send_long_data($stmt, 1, $blob)))
- printf("[009] Expecting boolean/true, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (true != ($tmp = mysqli_stmt_send_long_data($stmt, 1, $blob)))
+ printf("[009] Expecting boolean/true, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $id = 1;
- if (true !== mysqli_stmt_execute($stmt))
- printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $id = 1;
+ if (true !== mysqli_stmt_execute($stmt))
+ printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- /*
- TODO - we skip this part of the test for now, because of bugs.mysql.com/26824
- if (floor($max_allowed_packet / 1024 / 2) <= 10240) {
- // test with a blob smaller than 10M allows us to test
- // for too long packages without wasting too much memory
- $limit = $max_allowed_packet - strlen($blob) + 1;
- $blob2 = $blob;
- for ($i = 0; $i < $limit; $i++)
- $blob2 .= 'b';
+ /*
+ TODO - we skip this part of the test for now, because of bugs.mysql.com/26824
+ if (floor($max_allowed_packet / 1024 / 2) <= 10240) {
+ // test with a blob smaller than 10M allows us to test
+ // for too long packages without wasting too much memory
+ $limit = $max_allowed_packet - strlen($blob) + 1;
+ $blob2 = $blob;
+ for ($i = 0; $i < $limit; $i++)
+ $blob2 .= 'b';
- assert(strlen($blob2) > $max_allowed_packet);
+ assert(strlen($blob2) > $max_allowed_packet);
- if (true != ($tmp = mysqli_stmt_send_long_data($stmt, 1, $blob2)))
- printf("[011] Expecting boolean/false, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (true != ($tmp = mysqli_stmt_send_long_data($stmt, 1, $blob2)))
+ printf("[011] Expecting boolean/false, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $id = 2;
- if (false !== ($tmp = mysqli_stmt_execute($stmt)))
- printf("[012] Expecting boolean/false, got %s/%s, [%d] %s\n",
- gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
- */
- mysqli_stmt_close($stmt);
- mysqli_close($link);
+ $id = 2;
+ if (false !== ($tmp = mysqli_stmt_execute($stmt)))
+ printf("[012] Expecting boolean/false, got %s/%s, [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
+ */
+ mysqli_stmt_close($stmt);
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_send_long_data_packet_size_mysqlnd.phpt b/ext/mysqli/tests/mysqli_stmt_send_long_data_packet_size_mysqlnd.phpt
index fa26a3a45e..927d07c5cf 100644
--- a/ext/mysqli/tests/mysqli_stmt_send_long_data_packet_size_mysqlnd.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_send_long_data_packet_size_mysqlnd.phpt
@@ -11,89 +11,89 @@ if (!stristr(mysqli_get_client_info(), 'mysqlnd'))
?>
--FILE--
<?php
- require('table.inc');
+ require('table.inc');
- if (!$stmt = mysqli_stmt_init($link))
- printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, sprintf("CREATE TABLE test(id INT NOT NULL AUTO_INCREMENT, label LONGBLOB, PRIMARY KEY(id)) ENGINE = %s", $engine)))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, sprintf("CREATE TABLE test(id INT NOT NULL AUTO_INCREMENT, label LONGBLOB, PRIMARY KEY(id)) ENGINE = %s", $engine)))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
- printf("[004] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (?, ?)"))
+ printf("[004] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $id = null;
- $label = null;
- if (!mysqli_stmt_bind_param($stmt, "ib", $id, $label))
- printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $id = null;
+ $label = null;
+ if (!mysqli_stmt_bind_param($stmt, "ib", $id, $label))
+ printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!$res = mysqli_query($link, "SHOW VARIABLES LIKE 'max_allowed_packet'"))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_query($link, "SHOW VARIABLES LIKE 'max_allowed_packet'"))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!$row = mysqli_fetch_assoc($res))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$row = mysqli_fetch_assoc($res))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
+ mysqli_free_result($res);
- if (0 === ($max_allowed_packet = (int)$row['Value']))
- printf("[008] Cannot determine max_allowed_packet size and/or bogus max_allowed_packet setting used.\n");
+ if (0 === ($max_allowed_packet = (int)$row['Value']))
+ printf("[008] Cannot determine max_allowed_packet size and/or bogus max_allowed_packet setting used.\n");
- // let's ignore upper limits for LONGBLOB (2^32) ...
- // maximum packet size up to which we test is 10M
- $tmp = '';
- $blob = '';
- $tmp = str_repeat('a', 1024);
+ // let's ignore upper limits for LONGBLOB (2^32) ...
+ // maximum packet size up to which we test is 10M
+ $tmp = '';
+ $blob = '';
+ $tmp = str_repeat('a', 1024);
- $limit = min(floor($max_allowed_packet / 1024 / 2), 10240);
- $blob = str_repeat($tmp, $limit);
+ $limit = min(floor($max_allowed_packet / 1024 / 2), 10240);
+ $blob = str_repeat($tmp, $limit);
- assert(strlen($blob) <= $max_allowed_packet);
+ assert(strlen($blob) <= $max_allowed_packet);
- if (true !== ($tmp = mysqli_stmt_send_long_data($stmt, 1, $blob)))
- printf("[009] Expecting boolean/true, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (true !== ($tmp = mysqli_stmt_send_long_data($stmt, 1, $blob)))
+ printf("[009] Expecting boolean/true, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $id = 1;
- if (true !== mysqli_stmt_execute($stmt))
- printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ $id = 1;
+ if (true !== mysqli_stmt_execute($stmt))
+ printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- /*
- TODO - we skip this because of the open bug http://bugs.mysql.com/bug.php?id=26824
- It would always fail.
+ /*
+ TODO - we skip this because of the open bug http://bugs.mysql.com/bug.php?id=26824
+ It would always fail.
- This should be added to the EXPECTF, if you reactivate the test
+ This should be added to the EXPECTF, if you reactivate the test
Warning: mysqli_stmt_send_long_data(): Skipped %d bytes. Last command STMT_SEND_LONG_DATA hasn't consumed all the output from the server in %s on line %d
Warning: mysqli_stmt_send_long_data(): There was an error while sending long data. Probably max_allowed_packet_size is smaller than the data. You have to increase it or send smaller chunks of data. Answer was %d bytes long. in %s on line %d
- if (floor($max_allowed_packet / 1024 / 2) <= 10240) {
- // test with a blob smaller than 10M allows us to test
- // for too long packages without wasting too much memory
- $limit = $max_allowed_packet - strlen($blob) + 1;
- $blob2 = $blob;
- $blob2 .= str_repeat('b', $limit);
+ if (floor($max_allowed_packet / 1024 / 2) <= 10240) {
+ // test with a blob smaller than 10M allows us to test
+ // for too long packages without wasting too much memory
+ $limit = $max_allowed_packet - strlen($blob) + 1;
+ $blob2 = $blob;
+ $blob2 .= str_repeat('b', $limit);
- assert(strlen($blob2) > $max_allowed_packet);
+ assert(strlen($blob2) > $max_allowed_packet);
- if (false !== ($tmp = mysqli_stmt_send_long_data($stmt, 1, $blob2)))
- printf("[011] Expecting boolean/false, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ if (false !== ($tmp = mysqli_stmt_send_long_data($stmt, 1, $blob2)))
+ printf("[011] Expecting boolean/false, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- $id = 2;
- if (false !== ($tmp = mysqli_stmt_execute($stmt)))
- printf("[012] Expecting boolean/false, got %s/%s, [%d] %s\n",
- gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
- */
- mysqli_stmt_close($stmt);
- mysqli_close($link);
+ $id = 2;
+ if (false !== ($tmp = mysqli_stmt_execute($stmt)))
+ printf("[012] Expecting boolean/false, got %s/%s, [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
+ */
+ mysqli_stmt_close($stmt);
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_stmt_sqlstate.phpt b/ext/mysqli/tests/mysqli_stmt_sqlstate.phpt
index 1784106162..a365d4eb9e 100644
--- a/ext/mysqli/tests/mysqli_stmt_sqlstate.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_sqlstate.phpt
@@ -8,56 +8,48 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ require('table.inc');
- if (!is_null($tmp = @mysqli_stmt_sqlstate()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_null($tmp = @mysqli_stmt_sqlstate($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ try {
+ mysqli_stmt_sqlstate($stmt);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- require('table.inc');
+ if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test"))
+ printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!is_null($tmp = @mysqli_stmt_sqlstate($link, '')))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if ('00000' !== ($tmp = mysqli_stmt_sqlstate($stmt)))
+ printf("[007] Expecting string/00000, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!$stmt = mysqli_stmt_init($link))
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (mysqli_stmt_prepare($stmt, "SELECT believe_me FROM i_dont_belive_that_this_table_exists"))
+ printf("[008] Should fail! [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (false !== ($tmp = mysqli_stmt_sqlstate($stmt)))
- printf("[005] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if ('' === ($tmp = mysqli_stmt_sqlstate($stmt)))
+ printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test"))
- printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ mysqli_stmt_close($stmt);
- if ('00000' !== ($tmp = mysqli_stmt_sqlstate($stmt)))
- printf("[007] Expecting string/00000, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ try {
+ mysqli_stmt_sqlstate($stmt);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- if (mysqli_stmt_prepare($stmt, "SELECT believe_me FROM i_dont_belive_that_this_table_exists"))
- printf("[008] Should fail! [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if ('' === ($tmp = mysqli_stmt_sqlstate($stmt)))
- printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- mysqli_stmt_close($stmt);
-
- if (false !== ($tmp = mysqli_stmt_sqlstate($stmt)))
- printf("[010] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_close($link);
- print "done!";
+ mysqli_close($link);
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
---EXPECTF--
-Warning: mysqli_stmt_sqlstate(): invalid object or resource mysqli_stmt
- in %s on line %d
-
-Warning: mysqli_stmt_sqlstate(): Couldn't fetch mysqli_stmt in %s on line %d
+--EXPECT--
+mysqli_stmt object is not fully initialized
+mysqli_stmt object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_stmt_store_result.phpt b/ext/mysqli/tests/mysqli_stmt_store_result.phpt
index 89b8ed3bf8..3c6ebe66b4 100644
--- a/ext/mysqli/tests/mysqli_stmt_store_result.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_store_result.phpt
@@ -8,83 +8,79 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_stmt_store_result()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_stmt_store_result($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- require('table.inc');
-
- if (false !== ($tmp = @mysqli_stmt_store_result(new mysqli_stmt())))
- printf("[003] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!$stmt = mysqli_stmt_init($link))
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- // stmt object status test
- if (false !== ($tmp = @mysqli_stmt_store_result($stmt)))
- printf("[005] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (100, 'z')") ||
- !mysqli_stmt_execute($stmt))
- printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (true !== ($tmp = @mysqli_stmt_store_result($stmt)))
- printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test ORDER BY id') ||
- !mysqli_stmt_execute($stmt))
- printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!$link_buf = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[009] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
-
- if (!$stmt_buf = mysqli_stmt_init($link_buf))
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!mysqli_stmt_prepare($stmt_buf, "SELECT id, label FROM test ORDER BY id") ||
- !mysqli_stmt_execute($stmt_buf))
- printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt_buf), mysqli_stmt_error($stmt_buf));
-
- $id = $label = $id_buf = $label_buf = null;
- if (!mysqli_stmt_bind_result($stmt, $id, $label))
- printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
- if (!mysqli_stmt_bind_result($stmt_buf, $id_buf, $label_buf))
- printf("[013] [%d] %s\n", mysqli_stmt_errno($stmt_buf), mysqli_stmt_error($stmt_buf));
-
- while (mysqli_stmt_fetch($stmt)) {
- if (!mysqli_stmt_fetch($stmt_buf)) {
- printf("[014] Unbuffered statement indicates more rows than buffered, [%d] %s\n",
- mysqli_stmt_errno($stmt_buf), mysqli_stmt_error($stmt_buf));
- }
- if ($id !== $id_buf)
- printf("[015] unbuffered '%s'/%s, buffered '%s'/%s\n",
- $id, gettype($id), $id_buf, gettype($id_buf));
- if ($label !== $label_buf)
- printf("[016] unbuffered '%s'/%s, buffered '%s'/%s\n",
- $label, gettype($label), $label_buf, gettype($label_buf));
- }
-
- mysqli_stmt_close($stmt);
- mysqli_stmt_close($stmt_buf);
-
- if (false !== ($tmp = @mysqli_stmt_store_result($stmt)))
- printf("[017] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_close($link);
- mysqli_close($link_buf);
- print "done!";
+ require_once("connect.inc");
+
+ require('table.inc');
+
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ // stmt object status test
+ try {
+ mysqli_stmt_store_result($stmt);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (100, 'z')") ||
+ !mysqli_stmt_execute($stmt))
+ printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (true !== ($tmp = @mysqli_stmt_store_result($stmt)))
+ printf("[007] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test ORDER BY id') ||
+ !mysqli_stmt_execute($stmt))
+ printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!$link_buf = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[009] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+
+ if (!$stmt_buf = mysqli_stmt_init($link_buf))
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!mysqli_stmt_prepare($stmt_buf, "SELECT id, label FROM test ORDER BY id") ||
+ !mysqli_stmt_execute($stmt_buf))
+ printf("[011] [%d] %s\n", mysqli_stmt_errno($stmt_buf), mysqli_stmt_error($stmt_buf));
+
+ $id = $label = $id_buf = $label_buf = null;
+ if (!mysqli_stmt_bind_result($stmt, $id, $label))
+ printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+ if (!mysqli_stmt_bind_result($stmt_buf, $id_buf, $label_buf))
+ printf("[013] [%d] %s\n", mysqli_stmt_errno($stmt_buf), mysqli_stmt_error($stmt_buf));
+
+ while (mysqli_stmt_fetch($stmt)) {
+ if (!mysqli_stmt_fetch($stmt_buf)) {
+ printf("[014] Unbuffered statement indicates more rows than buffered, [%d] %s\n",
+ mysqli_stmt_errno($stmt_buf), mysqli_stmt_error($stmt_buf));
+ }
+ if ($id !== $id_buf)
+ printf("[015] unbuffered '%s'/%s, buffered '%s'/%s\n",
+ $id, gettype($id), $id_buf, gettype($id_buf));
+ if ($label !== $label_buf)
+ printf("[016] unbuffered '%s'/%s, buffered '%s'/%s\n",
+ $label, gettype($label), $label_buf, gettype($label_buf));
+ }
+
+ mysqli_stmt_close($stmt);
+ mysqli_stmt_close($stmt_buf);
+
+ try {
+ mysqli_stmt_store_result($stmt);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ mysqli_close($link);
+ mysqli_close($link_buf);
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
--EXPECT--
+mysqli_stmt object is not fully initialized
+mysqli_stmt object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_stmt_unclonable.phpt b/ext/mysqli/tests/mysqli_stmt_unclonable.phpt
index 18dddc90c7..722295b177 100644
--- a/ext/mysqli/tests/mysqli_stmt_unclonable.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_unclonable.phpt
@@ -8,18 +8,18 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (!$stmt = mysqli_stmt_init($link))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$stmt = mysqli_stmt_init($link))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- /* no, still bails out */
- $stmt_clone = clone $stmt;
- print "done!";
+ /* no, still bails out */
+ $stmt_clone = clone $stmt;
+ print "done!";
?>
--EXPECTF--
Fatal error: Uncaught Error: Trying to clone an uncloneable object of class mysqli_stmt in %s:%d
diff --git a/ext/mysqli/tests/mysqli_store_result.phpt b/ext/mysqli/tests/mysqli_store_result.phpt
index b87d147e38..6fa2d140f5 100644
--- a/ext/mysqli/tests/mysqli_store_result.phpt
+++ b/ext/mysqli/tests/mysqli_store_result.phpt
@@ -8,57 +8,51 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ require('table.inc');
- if (!is_null($tmp = @mysqli_store_result()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id"))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_null($tmp = @mysqli_store_result($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_object($res = mysqli_store_result($link)))
+ printf("[004] Expecting object, got %s/%s. [%d] %s\n",
+ gettype($res), $res, mysqli_errno($link), mysqli_error($link));
- require('table.inc');
+ if (true !== ($tmp = mysqli_data_seek($res, 2)))
+ printf("[005] Expecting boolean/true, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
- if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id"))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_free_result($res);
- if (!is_object($res = mysqli_store_result($link)))
- printf("[004] Expecting object, got %s/%s. [%d] %s\n",
- gettype($res), $res, mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DELETE FROM test"))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (true !== ($tmp = mysqli_data_seek($res, 2)))
- printf("[005] Expecting boolean/true, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
+ if (false !== ($res = mysqli_store_result($link)))
+ printf("[007] Expecting boolean/false, got %s/%s. [%d] %s\n",
+ gettype($res), $res, mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
+ if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id"))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "DELETE FROM test"))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (false !== ($tmp = mysqli_data_seek($res, 1)))
+ printf("[009] Expecting boolean/false, got %s/%s\n",
+ gettype($tmp), $tmp);
- if (false !== ($res = mysqli_store_result($link)))
- printf("[007] Expecting boolean/false, got %s/%s. [%d] %s\n",
- gettype($res), $res, mysqli_errno($link), mysqli_error($link));
+ mysqli_close($link);
- if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id"))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ try {
+ mysqli_store_result($link);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- if (false !== ($tmp = mysqli_data_seek($res, 1)))
- printf("[009] Expecting boolean/false, got %s/%s\n",
- gettype($tmp), $tmp);
-
- mysqli_close($link);
-
- if (false !== ($tmp = mysqli_store_result($link)))
- printf("[010] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
--EXPECTF--
-Warning: mysqli_store_result(): Couldn't fetch mysqli in %s on line %d
+mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_store_result_buffered_c.phpt b/ext/mysqli/tests/mysqli_store_result_buffered_c.phpt
index cc776f01e2..f685617915 100644
--- a/ext/mysqli/tests/mysqli_store_result_buffered_c.phpt
+++ b/ext/mysqli/tests/mysqli_store_result_buffered_c.phpt
@@ -10,28 +10,28 @@ require_once('skipifconnectfailure.inc');
mysqlnd.debug=d:t:O,{TMP}/mysqlnd.trace
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ $tmp = NULL;
+ $link = NULL;
- require('table.inc');
+ require('table.inc');
- if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id"))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id"))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA)))
- printf("[004] Expecting object, got %s/%s. [%d] %s\n",
- gettype($res), $res, mysqli_errno($link), mysqli_error($link));
+ if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA)))
+ printf("[004] Expecting object, got %s/%s. [%d] %s\n",
+ gettype($res), $res, mysqli_errno($link), mysqli_error($link));
- if (true !== ($tmp = mysqli_data_seek($res, 2)))
- printf("[005] Expecting boolean/true, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
+ if (true !== ($tmp = mysqli_data_seek($res, 2)))
+ printf("[005] Expecting boolean/true, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
+ mysqli_free_result($res);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_store_result_copy.phpt b/ext/mysqli/tests/mysqli_store_result_copy.phpt
index dbe5d2f905..c82bb9e01a 100644
--- a/ext/mysqli/tests/mysqli_store_result_copy.phpt
+++ b/ext/mysqli/tests/mysqli_store_result_copy.phpt
@@ -16,183 +16,183 @@ mysqlnd.mempool_default_size=1
mysqlnd.fetch_data_copy=0
--FILE--
<?php
- require_once("connect.inc");
-
- $tmp = NULL;
- $link = NULL;
-
- require('table.inc');
-
- if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id"))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA)))
- printf("[004] Expecting object, got %s/%s. [%d] %s\n",
- gettype($res), $res, mysqli_errno($link), mysqli_error($link));
-
- if (true !== ($tmp = mysqli_data_seek($res, 2)))
- printf("[005] Expecting boolean/true, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
-
- var_dump($res->fetch_assoc());
-
- if (true !== ($tmp = mysqli_data_seek($res, 0)))
- printf("[006] Expecting boolean/true, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
-
- while ($row = $res->fetch_assoc()) {
- printf("id = %d, label = %s\n", $row['id'], $row['label']);
- }
-
- mysqli_free_result($res);
- mysqli_close($link);
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[007] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
-
-
- if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id"))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA)))
- printf("[009] Expecting object, got %s/%s. [%d] %s\n",
- gettype($res), $res, mysqli_errno($link), mysqli_error($link));
+ require_once("connect.inc");
+
+ $tmp = NULL;
+ $link = NULL;
+
+ require('table.inc');
+
+ if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id"))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA)))
+ printf("[004] Expecting object, got %s/%s. [%d] %s\n",
+ gettype($res), $res, mysqli_errno($link), mysqli_error($link));
+
+ if (true !== ($tmp = mysqli_data_seek($res, 2)))
+ printf("[005] Expecting boolean/true, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
+
+ var_dump($res->fetch_assoc());
+
+ if (true !== ($tmp = mysqli_data_seek($res, 0)))
+ printf("[006] Expecting boolean/true, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
+
+ while ($row = $res->fetch_assoc()) {
+ printf("id = %d, label = %s\n", $row['id'], $row['label']);
+ }
+
+ mysqli_free_result($res);
+ mysqli_close($link);
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[007] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
+
+
+ if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id"))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA)))
+ printf("[009] Expecting object, got %s/%s. [%d] %s\n",
+ gettype($res), $res, mysqli_errno($link), mysqli_error($link));
- $no_result = 0;
- for ($i = 0; $i < 1000; $i++) {
- $idx = mt_rand(-100, 100);
- if (true === @mysqli_data_seek($res, $idx)) {
- $row = $res->fetch_assoc();
- if (!isset($row['id']) || !isset($row['label'])) {
- printf("[010] Brute force seek %d returned %d\n", $idx, var_export($row, true));
- }
- } else {
- $no_result++;
- }
- }
- printf("No result: %d\n", $no_result);
-
- /* implicit free, implicit store */
- /* meta and fetch lengths code */
- if (!$res = mysqli_query($link, "SELECT CONCAT(id, id) AS _c, label FROM test ORDER BY id DESC LIMIT 2"))
- printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- printf("Default\n");
- var_dump(mysqli_fetch_lengths($res));
- $fields = $res->fetch_fields();
- while ($row = $res->fetch_assoc()) {
- var_dump(mysqli_fetch_lengths($res));
- }
- var_dump(mysqli_fetch_lengths($res));
-
- if (!$res = mysqli_real_query($link, "SELECT CONCAT(id, id) AS _c, label FROM test ORDER BY id DESC LIMIT 2"))
- printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA)))
- printf("[013] Expecting object, got %s/%s. [%d] %s\n",
- gettype($res), $res, mysqli_errno($link), mysqli_error($link));
-
- printf("Copy\n");
- var_dump(mysqli_fetch_lengths($res));
- $fields_copy = $res->fetch_fields();
- while ($row = $res->fetch_assoc()) {
- var_dump(mysqli_fetch_lengths($res));
- }
- var_dump(mysqli_fetch_lengths($res));
-
- /* There's no need for in-depth testing here. If you want in-depth switch mysqlnd
- globally to copy mode and run all the tests */
- foreach ($fields as $k => $field_info) {
- if ($fields_copy[$k] != $field_info) {
- printf("[014] Metadata seems to differ, dumping\n");
- var_dump($field_info);
- var_dump($fields_copy[$k]);
- }
- }
-
- /* fetch all */
-
- if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id DESC LIMIT 2"))
- printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA)))
- printf("[016] Expecting object, got %s/%s. [%d] %s\n",
- gettype($res), $res, mysqli_errno($link), mysqli_error($link));
-
- foreach (mysqli_fetch_all($res, MYSQLI_ASSOC) as $row) {
- printf("id = %d label = %s\n", $row['id'], $row['label']);
- }
-
- if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id DESC LIMIT 2"))
- printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA)))
- printf("[018] Expecting object, got %s/%s. [%d] %s\n",
- gettype($res), $res, mysqli_errno($link), mysqli_error($link));
-
- /* provoke out of sync */
- if (!mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id DESC LIMIT 2"))
- printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- var_dump($res->fetch_assoc());
-
- if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2"))
- printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA)))
- printf("[021] Expecting object, got %s/%s. [%d] %s\n",
- gettype($res), $res, mysqli_errno($link), mysqli_error($link));
-
- /* user conn killed, res associated with conn, fetch from res */
- unset($link);
- var_dump($res->fetch_assoc());
-
-
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("[022] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- }
-
- if (!$res = mysqli_real_query($link, "INSERT INTO test(id, label) VALUES (100, 'z')"))
- printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA);
-
- if (mysqli_get_server_version($link) > 50000) {
- // let's try to play with stored procedures
- mysqli_real_query($link, 'DROP PROCEDURE IF EXISTS p');
- if (mysqli_real_query($link, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) READS SQL DATA BEGIN SELECT id FROM test WHERE id >= 100 ORDER BY id; SELECT id + 1, label FROM test WHERE id > 0 AND id < 3 ORDER BY id; SELECT VERSION() INTO ver_param;
+ $no_result = 0;
+ for ($i = 0; $i < 1000; $i++) {
+ $idx = mt_rand(-100, 100);
+ if (true === @mysqli_data_seek($res, $idx)) {
+ $row = $res->fetch_assoc();
+ if (!isset($row['id']) || !isset($row['label'])) {
+ printf("[010] Brute force seek %d returned %d\n", $idx, var_export($row, true));
+ }
+ } else {
+ $no_result++;
+ }
+ }
+ printf("No result: %d\n", $no_result);
+
+ /* implicit free, implicit store */
+ /* meta and fetch lengths code */
+ if (!$res = mysqli_query($link, "SELECT CONCAT(id, id) AS _c, label FROM test ORDER BY id DESC LIMIT 2"))
+ printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ printf("Default\n");
+ var_dump(mysqli_fetch_lengths($res));
+ $fields = $res->fetch_fields();
+ while ($row = $res->fetch_assoc()) {
+ var_dump(mysqli_fetch_lengths($res));
+ }
+ var_dump(mysqli_fetch_lengths($res));
+
+ if (!$res = mysqli_real_query($link, "SELECT CONCAT(id, id) AS _c, label FROM test ORDER BY id DESC LIMIT 2"))
+ printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA)))
+ printf("[013] Expecting object, got %s/%s. [%d] %s\n",
+ gettype($res), $res, mysqli_errno($link), mysqli_error($link));
+
+ printf("Copy\n");
+ var_dump(mysqli_fetch_lengths($res));
+ $fields_copy = $res->fetch_fields();
+ while ($row = $res->fetch_assoc()) {
+ var_dump(mysqli_fetch_lengths($res));
+ }
+ var_dump(mysqli_fetch_lengths($res));
+
+ /* There's no need for in-depth testing here. If you want in-depth switch mysqlnd
+ globally to copy mode and run all the tests */
+ foreach ($fields as $k => $field_info) {
+ if ($fields_copy[$k] != $field_info) {
+ printf("[014] Metadata seems to differ, dumping\n");
+ var_dump($field_info);
+ var_dump($fields_copy[$k]);
+ }
+ }
+
+ /* fetch all */
+
+ if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id DESC LIMIT 2"))
+ printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA)))
+ printf("[016] Expecting object, got %s/%s. [%d] %s\n",
+ gettype($res), $res, mysqli_errno($link), mysqli_error($link));
+
+ foreach (mysqli_fetch_all($res, MYSQLI_ASSOC) as $row) {
+ printf("id = %d label = %s\n", $row['id'], $row['label']);
+ }
+
+ if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id DESC LIMIT 2"))
+ printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA)))
+ printf("[018] Expecting object, got %s/%s. [%d] %s\n",
+ gettype($res), $res, mysqli_errno($link), mysqli_error($link));
+
+ /* provoke out of sync */
+ if (!mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id DESC LIMIT 2"))
+ printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ var_dump($res->fetch_assoc());
+
+ if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2"))
+ printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA)))
+ printf("[021] Expecting object, got %s/%s. [%d] %s\n",
+ gettype($res), $res, mysqli_errno($link), mysqli_error($link));
+
+ /* user conn killed, res associated with conn, fetch from res */
+ unset($link);
+ var_dump($res->fetch_assoc());
+
+
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+ printf("[022] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ }
+
+ if (!$res = mysqli_real_query($link, "INSERT INTO test(id, label) VALUES (100, 'z')"))
+ printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA);
+
+ if (mysqli_get_server_version($link) > 50000) {
+ // let's try to play with stored procedures
+ mysqli_real_query($link, 'DROP PROCEDURE IF EXISTS p');
+ if (mysqli_real_query($link, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) READS SQL DATA BEGIN SELECT id FROM test WHERE id >= 100 ORDER BY id; SELECT id + 1, label FROM test WHERE id > 0 AND id < 3 ORDER BY id; SELECT VERSION() INTO ver_param;
END;')) {
- mysqli_multi_query($link, "CALL p(@version)");
- do {
- if ($res = $link->store_result(MYSQLI_STORE_RESULT_COPY_DATA)) {
- printf("---\n");
- var_dump($res->fetch_all());
- $res->free();
- } else {
- if ($link->errno) {
- echo "Store failed: (" . $link->errno . ") " . $link->error;
- }
- }
- } while ($link->more_results() && $link->next_result());
- mysqli_real_query($link, 'SELECT @version AS p_version');
- $res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA);
-
- $tmp = mysqli_fetch_assoc($res);
- if (!is_array($tmp) || empty($tmp) || !isset($tmp['p_version']) || ('' == $tmp['p_version'])) {
- printf("[024] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- var_dump($tmp);
- }
-
- mysqli_free_result($res);
- } else {
- printf("[025] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
- }
-
- print "done!";
+ mysqli_multi_query($link, "CALL p(@version)");
+ do {
+ if ($res = $link->store_result(MYSQLI_STORE_RESULT_COPY_DATA)) {
+ printf("---\n");
+ var_dump($res->fetch_all());
+ $res->free();
+ } else {
+ if ($link->errno) {
+ echo "Store failed: (" . $link->errno . ") " . $link->error;
+ }
+ }
+ } while ($link->more_results() && $link->next_result());
+ mysqli_real_query($link, 'SELECT @version AS p_version');
+ $res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA);
+
+ $tmp = mysqli_fetch_assoc($res);
+ if (!is_array($tmp) || empty($tmp) || !isset($tmp['p_version']) || ('' == $tmp['p_version'])) {
+ printf("[024] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ var_dump($tmp);
+ }
+
+ mysqli_free_result($res);
+ } else {
+ printf("[025] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+ }
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/mysqli_thread_id.phpt b/ext/mysqli/tests/mysqli_thread_id.phpt
index 4a71d60f41..ce64b9a072 100644
--- a/ext/mysqli/tests/mysqli_thread_id.phpt
+++ b/ext/mysqli/tests/mysqli_thread_id.phpt
@@ -8,37 +8,31 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ require('table.inc');
- if (!is_null($tmp = @mysqli_thread_id()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_int($tmp = mysqli_thread_id($link)) || (0 === $tmp))
+ printf("[003] Expecting int/any but zero, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
- if (!is_null($tmp = @mysqli_thread_id($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ // should work if the thread id is correct
+ mysqli_kill($link, mysqli_thread_id($link));
- require('table.inc');
+ mysqli_close($link);
- if (!is_int($tmp = mysqli_thread_id($link)) || (0 === $tmp))
- printf("[003] Expecting int/any but zero, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
+ try {
+ mysqli_thread_id($link);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- // should work if the thread id is correct
- mysqli_kill($link, mysqli_thread_id($link));
-
- mysqli_close($link);
-
- if (false !== ($tmp = mysqli_thread_id($link)))
- printf("[005] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
---EXPECTF--
-Warning: mysqli_thread_id(): Couldn't fetch mysqli in %s on line %d
+--EXPECT--
+mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_thread_safe.phpt b/ext/mysqli/tests/mysqli_thread_safe.phpt
index 15b93dd209..3f45127095 100644
--- a/ext/mysqli/tests/mysqli_thread_safe.phpt
+++ b/ext/mysqli/tests/mysqli_thread_safe.phpt
@@ -7,10 +7,10 @@ require_once('skipifemb.inc');
?>
--FILE--
<?php
- if (!is_bool($tmp = mysqli_thread_safe()))
- printf("[001] Expecting boolean/any, got %s/%s.\n", gettype($tmp), $tmp);
+ if (!is_bool($tmp = mysqli_thread_safe()))
+ printf("[001] Expecting boolean/any, got %s/%s.\n", gettype($tmp), $tmp);
- print "done!";
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/mysqli/tests/mysqli_unclonable.phpt b/ext/mysqli/tests/mysqli_unclonable.phpt
index a6bb1946c7..d7f42c2f6e 100644
--- a/ext/mysqli/tests/mysqli_unclonable.phpt
+++ b/ext/mysqli/tests/mysqli_unclonable.phpt
@@ -8,16 +8,16 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- $link_clone = clone $link;
- mysqli_close($link);
+ $link_clone = clone $link;
+ mysqli_close($link);
- print "done!";
+ print "done!";
?>
--EXPECTF--
Fatal error: Uncaught Error: Trying to clone an uncloneable object of class mysqli in %s:%d
diff --git a/ext/mysqli/tests/mysqli_use_result.phpt b/ext/mysqli/tests/mysqli_use_result.phpt
index 190cafa5d5..1b679d142d 100644
--- a/ext/mysqli/tests/mysqli_use_result.phpt
+++ b/ext/mysqli/tests/mysqli_use_result.phpt
@@ -8,52 +8,46 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ require('table.inc');
- if (!is_null($tmp = @mysqli_use_result()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id"))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_null($tmp = @mysqli_use_result($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!is_object($res = mysqli_use_result($link)))
+ printf("[004] Expecting object, got %s/%s. [%d] %s\n",
+ gettype($res), $res, mysqli_errno($link), mysqli_error($link));
- require('table.inc');
+ if (false !== ($tmp = mysqli_data_seek($res, 2)))
+ printf("[005] Expecting boolean/true, got %s/%s. [%d] %s\n",
+ gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
- if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id"))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_free_result($res);
- if (!is_object($res = mysqli_use_result($link)))
- printf("[004] Expecting object, got %s/%s. [%d] %s\n",
- gettype($res), $res, mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DELETE FROM test"))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (false !== ($tmp = mysqli_data_seek($res, 2)))
- printf("[005] Expecting boolean/true, got %s/%s. [%d] %s\n",
- gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
+ if (false !== ($res = mysqli_use_result($link)))
+ printf("[007] Expecting boolean/false, got %s/%s. [%d] %s\n",
+ gettype($res), $res, mysqli_errno($link), mysqli_error($link));
- mysqli_free_result($res);
+ if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id"))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "DELETE FROM test"))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (false !== ($tmp = mysqli_data_seek($res, 1)))
+ printf("[009] Expecting boolean/false, got %s/%s\n",
+ gettype($tmp), $tmp);
- if (false !== ($res = mysqli_use_result($link)))
- printf("[007] Expecting boolean/false, got %s/%s. [%d] %s\n",
- gettype($res), $res, mysqli_errno($link), mysqli_error($link));
+ mysqli_close($link);
- if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id"))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ try {
+ mysqli_use_result($link);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- if (false !== ($tmp = mysqli_data_seek($res, 1)))
- printf("[009] Expecting boolean/false, got %s/%s\n",
- gettype($tmp), $tmp);
-
- mysqli_close($link);
-
- if (false !== ($tmp = mysqli_use_result($link)))
- printf("[010] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
@@ -61,6 +55,5 @@ require_once('skipifconnectfailure.inc');
?>
--EXPECTF--
Warning: mysqli_data_seek(): Function cannot be used with MYSQL_USE_RESULT in %s on line %d
-
-Warning: mysqli_use_result(): Couldn't fetch mysqli in %s on line %d
+mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_warning_count.phpt b/ext/mysqli/tests/mysqli_warning_count.phpt
index 9d59f26e52..c59084732b 100644
--- a/ext/mysqli/tests/mysqli_warning_count.phpt
+++ b/ext/mysqli/tests/mysqli_warning_count.phpt
@@ -8,45 +8,36 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- $tmp = NULL;
- $link = NULL;
+ require('table.inc');
- if (!is_null($tmp = @mysqli_warning_count()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (!$res = mysqli_query($link, "SELECT id, label FROM test"))
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_null($tmp = @mysqli_warning_count($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (0 !== ($tmp = mysqli_warning_count($link)))
+ printf("[005] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
- require('table.inc');
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS this_table_does_not_exist"))
+ printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (NULL !== ($tmp = @mysqli_warning_count($link, "too_many")))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if (1 !== ($tmp = mysqli_warning_count($link)))
+ printf("[007] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
- if (!$res = mysqli_query($link, "SELECT id, label FROM test"))
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_close($link);
- if (0 !== ($tmp = mysqli_warning_count($link)))
- printf("[005] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
+ try {
+ mysqli_warning_count($link);
+ } catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- if (!mysqli_query($link, "DROP TABLE IF EXISTS this_table_does_not_exist"))
- printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (1 !== ($tmp = mysqli_warning_count($link)))
- printf("[007] Expecting int/1, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_close($link);
-
- if (false !== ($tmp = mysqli_warning_count($link)))
- printf("[010] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
--EXPECTF--
-Warning: mysqli_warning_count(): Couldn't fetch mysqli in %s on line %d
+mysqli object is already closed
done!
diff --git a/ext/mysqli/tests/mysqli_warning_unclonable.phpt b/ext/mysqli/tests/mysqli_warning_unclonable.phpt
index 1079ac374b..e68cd96212 100644
--- a/ext/mysqli/tests/mysqli_warning_unclonable.phpt
+++ b/ext/mysqli/tests/mysqli_warning_unclonable.phpt
@@ -11,27 +11,27 @@ if (!$TEST_EXPERIMENTAL)
?>
--FILE--
<?php
- require_once("connect.inc");
+ require_once("connect.inc");
- if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
- printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
+ printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "CREATE TABLE test (id SMALLINT)"))
- printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "CREATE TABLE test (id SMALLINT)"))
+ printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!mysqli_query($link, "INSERT INTO test (id) VALUES (1000000)"))
- printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!mysqli_query($link, "INSERT INTO test (id) VALUES (1000000)"))
+ printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- if (!is_object($warning = mysqli_get_warnings($link)) || 'mysqli_warning' != get_class($warning)) {
- printf("[005] Expecting object/mysqli_warning, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp));
- }
+ if (!is_object($warning = mysqli_get_warnings($link)) || 'mysqli_warning' != get_class($warning)) {
+ printf("[005] Expecting object/mysqli_warning, got %s/%s\n", gettype($tmp), (is_object($tmp) ? var_dump($tmp, true) : $tmp));
+ }
- $warning_clone = clone $warning;
- print "done!";
+ $warning_clone = clone $warning;
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/mysqli/tests/reflection_tools.inc b/ext/mysqli/tests/reflection_tools.inc
index 6648526ed0..0e46c2afa9 100644
--- a/ext/mysqli/tests/reflection_tools.inc
+++ b/ext/mysqli/tests/reflection_tools.inc
@@ -1,121 +1,121 @@
<?php
- function inspectClass($class) {
-
- /* not used: public ReflectionClass[] getInterfaces() */
-
- printf("\nInspecting class '%s'\n", $class->getName());
- printf("isInternal: %s\n", ($class->isInternal()) ? 'yes' : 'no');
- printf("isUserDefined: %s\n", ($class->isUserDefined()) ? 'yes' : 'no');
- printf("isInstantiable: %s\n", ($class->isInstantiable()) ? 'yes' : 'no');
- printf("isInterface: %s\n", ($class->isInterface()) ? 'yes' : 'no');
- printf("isAbstract: %s\n", ($class->isAbstract()) ? 'yes' : 'no');
- printf("isFinal: %s\n", ($class->isFinal()) ? 'yes' : 'no');
- printf("isIteratable: %s\n", ($class->isIterateable()) ? 'yes' : 'no');
- printf("Modifiers: '%d'\n", $class->getModifiers());
- printf("Parent Class: '%s'\n", $class->getParentClass());
- printf("Extension: '%s'\n", $class->getExtensionName());
-
- if ($method = $class->getConstructor())
- inspectMethod($method);
-
- if ($methods = $class->getMethods()) {
- $tmp = array();
- foreach ($methods as $method)
- $tmp[$method->getName()] = $method;
-
- ksort($tmp, SORT_STRING);
- foreach ($tmp as $method)
- inspectMethod($method);
- }
-
- if ($properties = $class->getProperties()) {
- $tmp = array();
- foreach ($properties as $prop)
- $tmp[$prop->getName()] = $prop;
- ksort($tmp, SORT_STRING);
- foreach ($tmp as $prop)
- inspectProperty($prop);
- }
-
-
- if ($properties = $class->getDefaultProperties()) {
- ksort($properties, SORT_STRING);
- foreach ($properties as $name => $v)
- printf("Default property '%s'\n", $name);
- }
-
- if ($properties = $class->getStaticProperties()) {
- ksort($properties, SORT_STRING);
- foreach ($properties as $name => $v)
- printf("Static property '%s'\n", $name);
- }
-
- if ($constants = $class->getConstants()) {
- ksort($constants, SORT_STRING);
- foreach ($constant as $name => $value)
- printf("Constant '%s' = '%s'\n", $name, $value);
- }
-
- }
-
- function inspectProperty(&$prop) {
-
- printf("\nInspecting property '%s'\n", $prop->getName());
- printf("isPublic: %s\n", ($prop->isPublic()) ? 'yes' : 'no');
- printf("isPrivate: %s\n", ($prop->isPrivate()) ? 'yes' : 'no');
- printf("isProtected: %s\n", ($prop->isProtected()) ? 'yes' : 'no');
- printf("isStatic: %s\n", ($prop->isStatic()) ? 'yes' : 'no');
- printf("isDefault: %s\n", ($prop->isDefault()) ? 'yes' : 'no');
- printf("Modifiers: %d\n", $prop->getModifiers());
- // printf("Value\n"); var_export($prop->getValue());
-
- }
-
- function inspectMethod(&$method) {
-
- printf("\nInspecting method '%s'\n", $method->getName());
- printf("isFinal: %s\n", ($method->isFinal()) ? 'yes' : 'no');
- printf("isAbstract: %s\n", ($method->isAbstract()) ? 'yes' : 'no');
- printf("isPublic: %s\n", ($method->isPublic()) ? 'yes' : 'no');
- printf("isPrivate: %s\n", ($method->isPrivate()) ? 'yes' : 'no');
- printf("isProtected: %s\n", ($method->isProtected()) ? 'yes' : 'no');
- printf("isStatic: %s\n", ($method->isStatic()) ? 'yes' : 'no');
- printf("isConstructor: %s\n", ($method->isConstructor()) ? 'yes' : 'no');
- printf("isDestructor: %s\n", ($method->isDestructor()) ? 'yes' : 'no');
- printf("isInternal: %s\n", ($method->isInternal()) ? 'yes' : 'no');
- printf("isUserDefined: %s\n", ($method->isUserDefined()) ? 'yes' : 'no');
- printf("returnsReference: %s\n", ($method->returnsReference()) ? 'yes' : 'no');
- printf("Modifiers: %d\n", $method->getModifiers());
- printf("Number of Parameters: %d\n", $method->getNumberOfParameters());
- printf("Number of Required Parameters: %d\n", $method->getNumberOfRequiredParameters());
-
- if ($params = $method->getParameters()) {
- $tmp = array();
- foreach ($params as $k => $param)
- $tmp[$param->getName()] = $param;
+ function inspectClass($class) {
+
+ /* not used: public ReflectionClass[] getInterfaces() */
+
+ printf("\nInspecting class '%s'\n", $class->getName());
+ printf("isInternal: %s\n", ($class->isInternal()) ? 'yes' : 'no');
+ printf("isUserDefined: %s\n", ($class->isUserDefined()) ? 'yes' : 'no');
+ printf("isInstantiable: %s\n", ($class->isInstantiable()) ? 'yes' : 'no');
+ printf("isInterface: %s\n", ($class->isInterface()) ? 'yes' : 'no');
+ printf("isAbstract: %s\n", ($class->isAbstract()) ? 'yes' : 'no');
+ printf("isFinal: %s\n", ($class->isFinal()) ? 'yes' : 'no');
+ printf("isIteratable: %s\n", ($class->isIterateable()) ? 'yes' : 'no');
+ printf("Modifiers: '%d'\n", $class->getModifiers());
+ printf("Parent Class: '%s'\n", $class->getParentClass());
+ printf("Extension: '%s'\n", $class->getExtensionName());
+
+ if ($method = $class->getConstructor())
+ inspectMethod($method);
+
+ if ($methods = $class->getMethods()) {
+ $tmp = array();
+ foreach ($methods as $method)
+ $tmp[$method->getName()] = $method;
+
+ ksort($tmp, SORT_STRING);
+ foreach ($tmp as $method)
+ inspectMethod($method);
+ }
+
+ if ($properties = $class->getProperties()) {
+ $tmp = array();
+ foreach ($properties as $prop)
+ $tmp[$prop->getName()] = $prop;
+ ksort($tmp, SORT_STRING);
+ foreach ($tmp as $prop)
+ inspectProperty($prop);
+ }
+
+
+ if ($properties = $class->getDefaultProperties()) {
+ ksort($properties, SORT_STRING);
+ foreach ($properties as $name => $v)
+ printf("Default property '%s'\n", $name);
+ }
+
+ if ($properties = $class->getStaticProperties()) {
+ ksort($properties, SORT_STRING);
+ foreach ($properties as $name => $v)
+ printf("Static property '%s'\n", $name);
+ }
+
+ if ($constants = $class->getConstants()) {
+ ksort($constants, SORT_STRING);
+ foreach ($constant as $name => $value)
+ printf("Constant '%s' = '%s'\n", $name, $value);
+ }
+
+ }
+
+ function inspectProperty(&$prop) {
+
+ printf("\nInspecting property '%s'\n", $prop->getName());
+ printf("isPublic: %s\n", ($prop->isPublic()) ? 'yes' : 'no');
+ printf("isPrivate: %s\n", ($prop->isPrivate()) ? 'yes' : 'no');
+ printf("isProtected: %s\n", ($prop->isProtected()) ? 'yes' : 'no');
+ printf("isStatic: %s\n", ($prop->isStatic()) ? 'yes' : 'no');
+ printf("isDefault: %s\n", ($prop->isDefault()) ? 'yes' : 'no');
+ printf("Modifiers: %d\n", $prop->getModifiers());
+ // printf("Value\n"); var_export($prop->getValue());
+
+ }
+
+ function inspectMethod(&$method) {
+
+ printf("\nInspecting method '%s'\n", $method->getName());
+ printf("isFinal: %s\n", ($method->isFinal()) ? 'yes' : 'no');
+ printf("isAbstract: %s\n", ($method->isAbstract()) ? 'yes' : 'no');
+ printf("isPublic: %s\n", ($method->isPublic()) ? 'yes' : 'no');
+ printf("isPrivate: %s\n", ($method->isPrivate()) ? 'yes' : 'no');
+ printf("isProtected: %s\n", ($method->isProtected()) ? 'yes' : 'no');
+ printf("isStatic: %s\n", ($method->isStatic()) ? 'yes' : 'no');
+ printf("isConstructor: %s\n", ($method->isConstructor()) ? 'yes' : 'no');
+ printf("isDestructor: %s\n", ($method->isDestructor()) ? 'yes' : 'no');
+ printf("isInternal: %s\n", ($method->isInternal()) ? 'yes' : 'no');
+ printf("isUserDefined: %s\n", ($method->isUserDefined()) ? 'yes' : 'no');
+ printf("returnsReference: %s\n", ($method->returnsReference()) ? 'yes' : 'no');
+ printf("Modifiers: %d\n", $method->getModifiers());
+ printf("Number of Parameters: %d\n", $method->getNumberOfParameters());
+ printf("Number of Required Parameters: %d\n", $method->getNumberOfRequiredParameters());
+
+ if ($params = $method->getParameters()) {
+ $tmp = array();
+ foreach ($params as $k => $param)
+ $tmp[$param->getName()] = $param;
// ksort($tmp, SORT_STRING);
- foreach ($tmp as $param)
- inspectParameter($method, $param);
- }
+ foreach ($tmp as $param)
+ inspectParameter($method, $param);
+ }
- if ($static = $method->getStaticVariables()) {
- sort($static, SORT_STRING);
- printf("Static variables: %s\n", implode('/', $static));
- }
+ if ($static = $method->getStaticVariables()) {
+ sort($static, SORT_STRING);
+ printf("Static variables: %s\n", implode('/', $static));
+ }
- }
+ }
- function inspectParameter(&$method, &$param) {
+ function inspectParameter(&$method, &$param) {
- printf("\nInspecting parameter '%s' of method '%s'\n",
- $param->getName(), $method->getName());
- printf("isArray: %s\n", ($param->isArray()) ? 'yes': 'no');
- printf("allowsNull: %s\n", ($param->allowsNull()) ? 'yes' : 'no');
- printf("isPassedByReference: %s\n", ($param->isPassedByReference()) ? 'yes' : 'no');
- printf("isOptional: %s\n", ($param->isOptional()) ? 'yes' : 'no');
- printf("isDefaultValueAvailable: %s\n", ($param->isDefaultValueAvailable()) ? 'yes' : 'no');
- // printf("getDefaultValue: %s\n", ($param->getDefaultValue()) ? 'yes' : 'no');
+ printf("\nInspecting parameter '%s' of method '%s'\n",
+ $param->getName(), $method->getName());
+ printf("isArray: %s\n", ($param->isArray()) ? 'yes': 'no');
+ printf("allowsNull: %s\n", ($param->allowsNull()) ? 'yes' : 'no');
+ printf("isPassedByReference: %s\n", ($param->isPassedByReference()) ? 'yes' : 'no');
+ printf("isOptional: %s\n", ($param->isOptional()) ? 'yes' : 'no');
+ printf("isDefaultValueAvailable: %s\n", ($param->isDefaultValueAvailable()) ? 'yes' : 'no');
+ // printf("getDefaultValue: %s\n", ($param->getDefaultValue()) ? 'yes' : 'no');
- }
+ }
?>
diff --git a/ext/mysqli/tests/skipif.inc b/ext/mysqli/tests/skipif.inc
index 5562aab84b..a5a5df14c2 100644
--- a/ext/mysqli/tests/skipif.inc
+++ b/ext/mysqli/tests/skipif.inc
@@ -1,5 +1,5 @@
<?php
if (!extension_loaded('mysqli')){
- die('skip mysqli extension not available');
+ die('skip mysqli extension not available');
}
?>
diff --git a/ext/mysqli/tests/skipifconnectfailure.inc b/ext/mysqli/tests/skipifconnectfailure.inc
index 32a976357c..ccde567baa 100644
--- a/ext/mysqli/tests/skipifconnectfailure.inc
+++ b/ext/mysqli/tests/skipifconnectfailure.inc
@@ -1,10 +1,10 @@
<?php
require_once('connect.inc');
if ($skip_on_connect_failure) {
- include_once('connect.inc');
- $link = @my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
- if (!is_object($link))
- die(sprintf("skip Can't connect to MySQL Server - [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
- mysqli_close($link);
+ include_once('connect.inc');
+ $link = @my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+ if (!is_object($link))
+ die(sprintf("skip Can't connect to MySQL Server - [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
+ mysqli_close($link);
}
?>
diff --git a/ext/mysqli/tests/skipifemb.inc b/ext/mysqli/tests/skipifemb.inc
index ad143a42a4..2b7941d825 100644
--- a/ext/mysqli/tests/skipifemb.inc
+++ b/ext/mysqli/tests/skipifemb.inc
@@ -1,5 +1,5 @@
<?php
- $driver = new mysqli_driver();
- if ($driver->embedded)
- die("skip test doesn't run with embedded server");
+ $driver = new mysqli_driver();
+ if ($driver->embedded)
+ die("skip test doesn't run with embedded server");
?>
diff --git a/ext/mysqli/tests/skipifnotemb.inc b/ext/mysqli/tests/skipifnotemb.inc
index fa5fb9f0a3..e88e423836 100644
--- a/ext/mysqli/tests/skipifnotemb.inc
+++ b/ext/mysqli/tests/skipifnotemb.inc
@@ -1,5 +1,5 @@
<?php
- $driver = new mysqli_driver();
- if (!$driver->embedded)
- die("skip test for with embedded server only");
+ $driver = new mysqli_driver();
+ if (!$driver->embedded)
+ die("skip test for with embedded server only");
?>
diff --git a/ext/mysqli/tests/table.inc b/ext/mysqli/tests/table.inc
index e0d7a06c57..16b688f74b 100644
--- a/ext/mysqli/tests/table.inc
+++ b/ext/mysqli/tests/table.inc
@@ -2,27 +2,27 @@
require_once('connect.inc');
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
- printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
- exit(1);
+ printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+ exit(1);
}
if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
- printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- exit(1);
+ printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ exit(1);
}
if (!mysqli_query($link, 'SET SESSION sql_mode=\'\'')) {
- printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- exit(1);
+ printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ exit(1);
}
if (!mysqli_query($link, 'CREATE TABLE test(id INT DEFAULT 0, label CHAR(1), PRIMARY KEY(id)) ENGINE=' . $engine)) {
- printf("Failed to create test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- exit(1);
+ printf("Failed to create test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ exit(1);
}
if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (1, 'a'), (2, 'b'), (3, 'c'), (4, 'd'), (5, 'e'), (6, 'f')")) {
- printf("[%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ printf("[%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
?>
diff --git a/ext/mysqlnd/mysql_float_to_double.h b/ext/mysqlnd/mysql_float_to_double.h
index 0690a4c498..2d4d4809cd 100644
--- a/ext/mysqlnd/mysql_float_to_double.h
+++ b/ext/mysqlnd/mysql_float_to_double.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqlnd/mysqlnd.h b/ext/mysqlnd/mysqlnd.h
index 77cbce93ae..b914afed6a 100644
--- a/ext/mysqlnd/mysqlnd.h
+++ b/ext/mysqlnd/mysqlnd.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqlnd/mysqlnd_alloc.c b/ext/mysqlnd/mysqlnd_alloc.c
index e4fe274901..5beb3707cb 100644
--- a/ext/mysqlnd/mysqlnd_alloc.c
+++ b/ext/mysqlnd/mysqlnd_alloc.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqlnd/mysqlnd_alloc.h b/ext/mysqlnd/mysqlnd_alloc.h
index 5764063df7..8ef00e00e4 100644
--- a/ext/mysqlnd/mysqlnd_alloc.h
+++ b/ext/mysqlnd/mysqlnd_alloc.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqlnd/mysqlnd_auth.c b/ext/mysqlnd/mysqlnd_auth.c
index 24c77220fc..8702ef1c57 100644
--- a/ext/mysqlnd/mysqlnd_auth.c
+++ b/ext/mysqlnd/mysqlnd_auth.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqlnd/mysqlnd_auth.h b/ext/mysqlnd/mysqlnd_auth.h
index 54fac21bde..be51294e92 100644
--- a/ext/mysqlnd/mysqlnd_auth.h
+++ b/ext/mysqlnd/mysqlnd_auth.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqlnd/mysqlnd_block_alloc.c b/ext/mysqlnd/mysqlnd_block_alloc.c
index cb785238c7..a1b83308de 100644
--- a/ext/mysqlnd/mysqlnd_block_alloc.c
+++ b/ext/mysqlnd/mysqlnd_block_alloc.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqlnd/mysqlnd_block_alloc.h b/ext/mysqlnd/mysqlnd_block_alloc.h
index 1adf8997c0..4336da6289 100644
--- a/ext/mysqlnd/mysqlnd_block_alloc.h
+++ b/ext/mysqlnd/mysqlnd_block_alloc.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqlnd/mysqlnd_charset.c b/ext/mysqlnd/mysqlnd_charset.c
index 729cdcd11f..48bef05e49 100644
--- a/ext/mysqlnd/mysqlnd_charset.c
+++ b/ext/mysqlnd/mysqlnd_charset.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqlnd/mysqlnd_charset.h b/ext/mysqlnd/mysqlnd_charset.h
index a87891c67c..8736ab7201 100644
--- a/ext/mysqlnd/mysqlnd_charset.h
+++ b/ext/mysqlnd/mysqlnd_charset.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqlnd/mysqlnd_commands.c b/ext/mysqlnd/mysqlnd_commands.c
index 76a67f8f8f..953c3a2fcd 100644
--- a/ext/mysqlnd/mysqlnd_commands.c
+++ b/ext/mysqlnd/mysqlnd_commands.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqlnd/mysqlnd_commands.h b/ext/mysqlnd/mysqlnd_commands.h
index f043910dcb..ec844f99f3 100644
--- a/ext/mysqlnd/mysqlnd_commands.h
+++ b/ext/mysqlnd/mysqlnd_commands.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqlnd/mysqlnd_connection.c b/ext/mysqlnd/mysqlnd_connection.c
index 2822672da5..c1b2926711 100644
--- a/ext/mysqlnd/mysqlnd_connection.c
+++ b/ext/mysqlnd/mysqlnd_connection.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -2643,7 +2641,7 @@ mysqlnd_poll(MYSQLND **r_array, MYSQLND **e_array, MYSQLND ***dont_poll, long se
retval = php_select(max_fd + 1, &rfds, &wfds, &efds, tv_p);
if (retval == -1) {
- php_error_docref(NULL, E_WARNING, "unable to select [%d]: %s (max_fd=%d)",
+ php_error_docref(NULL, E_WARNING, "Unable to select [%d]: %s (max_fd=%d)",
errno, strerror(errno), max_fd);
DBG_RETURN(FAIL);
}
diff --git a/ext/mysqlnd/mysqlnd_connection.h b/ext/mysqlnd/mysqlnd_connection.h
index 5887327b35..795ec3c5ea 100644
--- a/ext/mysqlnd/mysqlnd_connection.h
+++ b/ext/mysqlnd/mysqlnd_connection.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqlnd/mysqlnd_debug.c b/ext/mysqlnd/mysqlnd_debug.c
index cb512e1e9e..5d4e06b0b1 100644
--- a/ext/mysqlnd/mysqlnd_debug.c
+++ b/ext/mysqlnd/mysqlnd_debug.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqlnd/mysqlnd_debug.h b/ext/mysqlnd/mysqlnd_debug.h
index 32dc7316a7..49d2f8426a 100644
--- a/ext/mysqlnd/mysqlnd_debug.h
+++ b/ext/mysqlnd/mysqlnd_debug.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqlnd/mysqlnd_driver.c b/ext/mysqlnd/mysqlnd_driver.c
index c1da994f41..6ca1441bb6 100644
--- a/ext/mysqlnd/mysqlnd_driver.c
+++ b/ext/mysqlnd/mysqlnd_driver.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqlnd/mysqlnd_enum_n_def.h b/ext/mysqlnd/mysqlnd_enum_n_def.h
index 8eaf68214e..955eccac0e 100644
--- a/ext/mysqlnd/mysqlnd_enum_n_def.h
+++ b/ext/mysqlnd/mysqlnd_enum_n_def.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqlnd/mysqlnd_ext_plugin.c b/ext/mysqlnd/mysqlnd_ext_plugin.c
index c2884b4f30..58a4ee767e 100644
--- a/ext/mysqlnd/mysqlnd_ext_plugin.c
+++ b/ext/mysqlnd/mysqlnd_ext_plugin.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqlnd/mysqlnd_ext_plugin.h b/ext/mysqlnd/mysqlnd_ext_plugin.h
index 1d4d96364f..713eb1f44f 100644
--- a/ext/mysqlnd/mysqlnd_ext_plugin.h
+++ b/ext/mysqlnd/mysqlnd_ext_plugin.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqlnd/mysqlnd_libmysql_compat.h b/ext/mysqlnd/mysqlnd_libmysql_compat.h
index 93f7254a7c..df4b96eec3 100644
--- a/ext/mysqlnd/mysqlnd_libmysql_compat.h
+++ b/ext/mysqlnd/mysqlnd_libmysql_compat.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqlnd/mysqlnd_loaddata.c b/ext/mysqlnd/mysqlnd_loaddata.c
index 5362f1c7dd..6cd100ab74 100644
--- a/ext/mysqlnd/mysqlnd_loaddata.c
+++ b/ext/mysqlnd/mysqlnd_loaddata.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqlnd/mysqlnd_plugin.c b/ext/mysqlnd/mysqlnd_plugin.c
index 1d19dba7e2..25ba2669e1 100644
--- a/ext/mysqlnd/mysqlnd_plugin.c
+++ b/ext/mysqlnd/mysqlnd_plugin.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqlnd/mysqlnd_plugin.h b/ext/mysqlnd/mysqlnd_plugin.h
index 863bb5a476..005088f742 100644
--- a/ext/mysqlnd/mysqlnd_plugin.h
+++ b/ext/mysqlnd/mysqlnd_plugin.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqlnd/mysqlnd_priv.h b/ext/mysqlnd/mysqlnd_priv.h
index eeec53c8d1..d0b97eb16e 100644
--- a/ext/mysqlnd/mysqlnd_priv.h
+++ b/ext/mysqlnd/mysqlnd_priv.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqlnd/mysqlnd_protocol_frame_codec.c b/ext/mysqlnd/mysqlnd_protocol_frame_codec.c
index 038a1eb6ad..cdea2a007f 100644
--- a/ext/mysqlnd/mysqlnd_protocol_frame_codec.c
+++ b/ext/mysqlnd/mysqlnd_protocol_frame_codec.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqlnd/mysqlnd_protocol_frame_codec.h b/ext/mysqlnd/mysqlnd_protocol_frame_codec.h
index abd65da708..8ba317f0e2 100644
--- a/ext/mysqlnd/mysqlnd_protocol_frame_codec.h
+++ b/ext/mysqlnd/mysqlnd_protocol_frame_codec.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqlnd/mysqlnd_ps.c b/ext/mysqlnd/mysqlnd_ps.c
index 5207c1b506..01096d10d5 100644
--- a/ext/mysqlnd/mysqlnd_ps.c
+++ b/ext/mysqlnd/mysqlnd_ps.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqlnd/mysqlnd_ps.h b/ext/mysqlnd/mysqlnd_ps.h
index fbc3d51fb7..0d4f7f8068 100644
--- a/ext/mysqlnd/mysqlnd_ps.h
+++ b/ext/mysqlnd/mysqlnd_ps.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqlnd/mysqlnd_ps_codec.c b/ext/mysqlnd/mysqlnd_ps_codec.c
index 12edd9a284..c0b3d1d6ff 100644
--- a/ext/mysqlnd/mysqlnd_ps_codec.c
+++ b/ext/mysqlnd/mysqlnd_ps_codec.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -98,7 +96,7 @@ ps_fetch_from_1_to_8_bytes(zval * zv, const MYSQLND_FIELD * const field, const u
case 8:lval = (int64_t) sint8korr(*row);break;
/*
7, 6 and 5 are not possible.
- BIT is only unsigned, thus only uint5|6|7 macroses exist
+ BIT is only unsigned, thus only uint5|6|7 macros exist
*/
case 4:lval = (int64_t) sint4korr(*row);break;
case 3:lval = (int64_t) sint3korr(*row);break;
diff --git a/ext/mysqlnd/mysqlnd_read_buffer.c b/ext/mysqlnd/mysqlnd_read_buffer.c
index 5efb9fec1f..d2ff02e7ca 100644
--- a/ext/mysqlnd/mysqlnd_read_buffer.c
+++ b/ext/mysqlnd/mysqlnd_read_buffer.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqlnd/mysqlnd_read_buffer.h b/ext/mysqlnd/mysqlnd_read_buffer.h
index d033d7b06d..7d90653c8f 100644
--- a/ext/mysqlnd/mysqlnd_read_buffer.h
+++ b/ext/mysqlnd/mysqlnd_read_buffer.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqlnd/mysqlnd_result.c b/ext/mysqlnd/mysqlnd_result.c
index 69e47759ca..25f0e8215a 100644
--- a/ext/mysqlnd/mysqlnd_result.c
+++ b/ext/mysqlnd/mysqlnd_result.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -1883,7 +1881,12 @@ MYSQLND_CLASS_METHODS_START(mysqlnd_res)
MYSQLND_METHOD(mysqlnd_res, free_result),
MYSQLND_METHOD(mysqlnd_res, free_result_internal),
MYSQLND_METHOD(mysqlnd_res, free_result_contents_internal),
- mysqlnd_result_meta_init
+ mysqlnd_result_meta_init,
+ NULL, /* unused1 */
+ NULL, /* unused2 */
+ NULL, /* unused3 */
+ NULL, /* unused4 */
+ NULL /* unused5 */
MYSQLND_CLASS_METHODS_END;
diff --git a/ext/mysqlnd/mysqlnd_result.h b/ext/mysqlnd/mysqlnd_result.h
index 9df70271bc..14f894ccba 100644
--- a/ext/mysqlnd/mysqlnd_result.h
+++ b/ext/mysqlnd/mysqlnd_result.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqlnd/mysqlnd_result_meta.c b/ext/mysqlnd/mysqlnd_result_meta.c
index 9a8b8d72ee..b9e4129add 100644
--- a/ext/mysqlnd/mysqlnd_result_meta.c
+++ b/ext/mysqlnd/mysqlnd_result_meta.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqlnd/mysqlnd_result_meta.h b/ext/mysqlnd/mysqlnd_result_meta.h
index f35b6c890e..b0a1fe23b1 100644
--- a/ext/mysqlnd/mysqlnd_result_meta.h
+++ b/ext/mysqlnd/mysqlnd_result_meta.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqlnd/mysqlnd_reverse_api.c b/ext/mysqlnd/mysqlnd_reverse_api.c
index 25175e9b03..580dc12ce8 100644
--- a/ext/mysqlnd/mysqlnd_reverse_api.c
+++ b/ext/mysqlnd/mysqlnd_reverse_api.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqlnd/mysqlnd_reverse_api.h b/ext/mysqlnd/mysqlnd_reverse_api.h
index 3311086bfa..49579f9562 100644
--- a/ext/mysqlnd/mysqlnd_reverse_api.h
+++ b/ext/mysqlnd/mysqlnd_reverse_api.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqlnd/mysqlnd_statistics.c b/ext/mysqlnd/mysqlnd_statistics.c
index 2058441254..0a34ebc81c 100644
--- a/ext/mysqlnd/mysqlnd_statistics.c
+++ b/ext/mysqlnd/mysqlnd_statistics.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqlnd/mysqlnd_statistics.h b/ext/mysqlnd/mysqlnd_statistics.h
index 5626fbffe6..0a6310d716 100644
--- a/ext/mysqlnd/mysqlnd_statistics.h
+++ b/ext/mysqlnd/mysqlnd_statistics.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqlnd/mysqlnd_structs.h b/ext/mysqlnd/mysqlnd_structs.h
index fcd3bc2f39..ee3dba0e87 100644
--- a/ext/mysqlnd/mysqlnd_structs.h
+++ b/ext/mysqlnd/mysqlnd_structs.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqlnd/mysqlnd_vio.c b/ext/mysqlnd/mysqlnd_vio.c
index a5685e6707..bc59cbeed8 100644
--- a/ext/mysqlnd/mysqlnd_vio.c
+++ b/ext/mysqlnd/mysqlnd_vio.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -131,7 +129,7 @@ MYSQLND_METHOD(mysqlnd_vio, open_pipe)(MYSQLND_VIO * const vio, const MYSQLND_CS
streams_options |= IGNORE_URL;
net_stream = php_stream_open_wrapper(scheme.s + sizeof("pipe://") - 1, "r+", streams_options, NULL);
if (!net_stream) {
- SET_CLIENT_ERROR(error_info, CR_CONNECTION_ERROR, UNKNOWN_SQLSTATE, "Unknown errror while connecting");
+ SET_CLIENT_ERROR(error_info, CR_CONNECTION_ERROR, UNKNOWN_SQLSTATE, "Unknown error while connecting");
DBG_RETURN(NULL);
}
/*
diff --git a/ext/mysqlnd/mysqlnd_vio.h b/ext/mysqlnd/mysqlnd_vio.h
index 93038bd8bb..7c71aaa01e 100644
--- a/ext/mysqlnd/mysqlnd_vio.h
+++ b/ext/mysqlnd/mysqlnd_vio.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.c b/ext/mysqlnd/mysqlnd_wireprotocol.c
index ba289a6fce..d9e8561af7 100644
--- a/ext/mysqlnd/mysqlnd_wireprotocol.c
+++ b/ext/mysqlnd/mysqlnd_wireprotocol.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.h b/ext/mysqlnd/mysqlnd_wireprotocol.h
index c4ef4c3dad..e917736bb5 100644
--- a/ext/mysqlnd/mysqlnd_wireprotocol.h
+++ b/ext/mysqlnd/mysqlnd_wireprotocol.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqlnd/php_mysqlnd.c b/ext/mysqlnd/php_mysqlnd.c
index 276d8968cd..c3ed9ca8f2 100644
--- a/ext/mysqlnd/php_mysqlnd.c
+++ b/ext/mysqlnd/php_mysqlnd.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/mysqlnd/php_mysqlnd.h b/ext/mysqlnd/php_mysqlnd.h
index f202d038bb..1fc0c1130b 100644
--- a/ext/mysqlnd/php_mysqlnd.h
+++ b/ext/mysqlnd/php_mysqlnd.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c
index a3364be7e6..b25a50dcb8 100644
--- a/ext/oci8/oci8.c
+++ b/ext/oci8/oci8.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -1540,7 +1538,7 @@ sb4 php_oci_error(OCIError *err_p, sword errstatus)
if (errcode) {
php_error_docref(NULL, E_WARNING, "%s", errbuf);
} else {
- php_error_docref(NULL, E_WARNING, "failed to fetch error message");
+ php_error_docref(NULL, E_WARNING, "Failed to fetch error message");
}
break;
case OCI_INVALID_HANDLE:
diff --git a/ext/oci8/oci8_collection.c b/ext/oci8/oci8_collection.c
index a89b5abe2c..b6a363da1b 100644
--- a/ext/oci8/oci8_collection.c
+++ b/ext/oci8/oci8_collection.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -197,7 +195,7 @@ php_oci_collection *php_oci_collection_create(php_oci_connection *connection, ch
break;
/* we only support VARRAYs and TABLEs */
default:
- php_error_docref(NULL, E_WARNING, "unknown collection type %d", collection->coll_typecode);
+ php_error_docref(NULL, E_WARNING, "Unknown collection type %d", collection->coll_typecode);
break;
}
diff --git a/ext/oci8/oci8_failover.c b/ext/oci8/oci8_failover.c
index 9c606749a6..7854defdbc 100644
--- a/ext/oci8/oci8_failover.c
+++ b/ext/oci8/oci8_failover.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c
index ae05c08a28..299788cab6 100644
--- a/ext/oci8/oci8_interface.c
+++ b/ext/oci8/oci8_interface.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -52,14 +50,14 @@ PHP_FUNCTION(oci_register_taf_callback)
zend_string *callback_name;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|z!", &z_connection, &callback) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (callback) {
#if PHP_MAJOR_VERSION > 7 || (PHP_MAJOR_VERSION == 7 && PHP_MINOR_VERSION >= 2)
if (!zend_is_callable(callback, 0, 0)) {
callback_name = zend_get_callable_name(callback);
- php_error_docref(NULL, E_WARNING, "function '%s' is not callable", ZSTR_VAL(callback_name));
+ php_error_docref(NULL, E_WARNING, "Function '%s' is not callable", ZSTR_VAL(callback_name));
#if PHP_VERSION_ID < 70300
zend_string_release(callback_name);
#else
@@ -69,7 +67,7 @@ PHP_FUNCTION(oci_register_taf_callback)
}
#else
if (!zend_is_callable(callback, 0, &callback_name)) {
- php_error_docref(NULL, E_WARNING, "function '%s' is not callable", ZSTR_VAL(callback_name));
+ php_error_docref(NULL, E_WARNING, "Function '%s' is not callable", ZSTR_VAL(callback_name));
#if PHP_VERSION_ID < 70300
zend_string_release(callback_name);
#else
@@ -103,7 +101,7 @@ PHP_FUNCTION(oci_unregister_taf_callback)
php_oci_connection *connection;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &z_connection) == FAILURE) {
- return;
+ RETURN_THROWS();
}
PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
@@ -269,7 +267,7 @@ PHP_FUNCTION(oci_free_descriptor)
if (!getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_descriptor, oci_lob_class_entry_ptr) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
@@ -298,12 +296,12 @@ PHP_FUNCTION(oci_lob_save)
if (getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &data, &data_len, &offset) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Os|l", &z_descriptor, oci_lob_class_entry_ptr, &data, &data_len, &offset) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
@@ -337,12 +335,12 @@ PHP_FUNCTION(oci_lob_import)
if (getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &filename, &filename_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Op", &z_descriptor, oci_lob_class_entry_ptr, &filename, &filename_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
@@ -371,7 +369,7 @@ PHP_FUNCTION(oci_lob_load)
if (!getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_descriptor, oci_lob_class_entry_ptr) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
@@ -409,12 +407,12 @@ PHP_FUNCTION(oci_lob_read)
if (getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &length) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ol", &z_descriptor, oci_lob_class_entry_ptr, &length) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
@@ -454,7 +452,7 @@ PHP_FUNCTION(oci_lob_eof)
if (!getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_descriptor, oci_lob_class_entry_ptr) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
@@ -483,7 +481,7 @@ PHP_FUNCTION(oci_lob_tell)
if (!getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_descriptor, oci_lob_class_entry_ptr) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
@@ -507,7 +505,7 @@ PHP_FUNCTION(oci_lob_rewind)
if (!getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_descriptor, oci_lob_class_entry_ptr) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
@@ -535,12 +533,12 @@ PHP_FUNCTION(oci_lob_seek)
if (getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l", &offset, &whence) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ol|l", &z_descriptor, oci_lob_class_entry_ptr, &offset, &whence) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
@@ -590,7 +588,7 @@ PHP_FUNCTION(oci_lob_size)
if (!getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_descriptor, oci_lob_class_entry_ptr) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
@@ -621,7 +619,7 @@ PHP_FUNCTION(oci_lob_write)
if (getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &data, &data_len, &write_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (ZEND_NUM_ARGS() == 2) {
@@ -630,7 +628,7 @@ PHP_FUNCTION(oci_lob_write)
}
else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Os|l", &z_descriptor, oci_lob_class_entry_ptr, &data, &data_len, &write_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (ZEND_NUM_ARGS() == 3) {
@@ -665,12 +663,12 @@ PHP_FUNCTION(oci_lob_append)
if (getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_descriptor_from, oci_lob_class_entry_ptr) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "OO", &z_descriptor_dest, oci_lob_class_entry_ptr, &z_descriptor_from, oci_lob_class_entry_ptr) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
@@ -706,12 +704,12 @@ PHP_FUNCTION(oci_lob_truncate)
if (getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &trim_length) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O|l", &z_descriptor, oci_lob_class_entry_ptr, &trim_length) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
@@ -746,7 +744,7 @@ PHP_FUNCTION(oci_lob_erase)
if (getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|ll", &offset, &length) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (ZEND_NUM_ARGS() > 0 && offset < 0) {
@@ -761,7 +759,7 @@ PHP_FUNCTION(oci_lob_erase)
}
else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O|ll", &z_descriptor, oci_lob_class_entry_ptr, &offset, &length) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (ZEND_NUM_ARGS() > 1 && offset < 0) {
@@ -799,12 +797,12 @@ PHP_FUNCTION(oci_lob_flush)
if (getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &flush_flag) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O|l", &z_descriptor, oci_lob_class_entry_ptr, &flush_flag) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
@@ -837,12 +835,12 @@ PHP_FUNCTION(ocisetbufferinglob)
if (getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &flag) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ob", &z_descriptor, oci_lob_class_entry_ptr, &flag) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
@@ -869,7 +867,7 @@ PHP_FUNCTION(ocigetbufferinglob)
if (!getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_descriptor, oci_lob_class_entry_ptr) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
@@ -896,7 +894,7 @@ PHP_FUNCTION(oci_lob_copy)
zend_long length = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "OO|l", &z_descriptor_dest, oci_lob_class_entry_ptr, &z_descriptor_from, oci_lob_class_entry_ptr, &length) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((tmp_dest = zend_hash_str_find(Z_OBJPROP_P(z_descriptor_dest), "descriptor", sizeof("descriptor")-1)) == NULL) {
@@ -938,7 +936,7 @@ PHP_FUNCTION(oci_lob_is_equal)
boolean is_equal;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "OO", &z_descriptor_first, oci_lob_class_entry_ptr, &z_descriptor_second, oci_lob_class_entry_ptr) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((tmp_first = zend_hash_str_find(Z_OBJPROP_P(z_descriptor_first), "descriptor", sizeof("descriptor")-1)) == NULL) {
@@ -980,7 +978,7 @@ PHP_FUNCTION(oci_lob_export)
if (getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|ll", &filename, &filename_len, &start, &length) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (ZEND_NUM_ARGS() > 1 && start < 0) {
@@ -988,13 +986,13 @@ PHP_FUNCTION(oci_lob_export)
RETURN_FALSE;
}
if (ZEND_NUM_ARGS() > 2 && length < 0) {
- php_error_docref(NULL, E_WARNING, "Length parameter must be greater than or equal to 0");
+ php_error_docref(NULL, E_WARNING, "length parameter must be greater than or equal to 0");
RETURN_FALSE;
}
}
else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Op|ll", &z_descriptor, oci_lob_class_entry_ptr, &filename, &filename_len, &start, &length) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (ZEND_NUM_ARGS() > 2 && start < 0) {
@@ -1002,7 +1000,7 @@ PHP_FUNCTION(oci_lob_export)
RETURN_FALSE;
}
if (ZEND_NUM_ARGS() > 3 && length < 0) {
- php_error_docref(NULL, E_WARNING, "Length parameter must be greater than or equal to 0");
+ php_error_docref(NULL, E_WARNING, "length parameter must be greater than or equal to 0");
RETURN_FALSE;
}
}
@@ -1088,12 +1086,12 @@ PHP_FUNCTION(oci_lob_write_temporary)
if (getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &data, &data_len, &type) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Os|l", &z_descriptor, oci_lob_class_entry_ptr, &data, &data_len, &type) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
@@ -1120,7 +1118,7 @@ PHP_FUNCTION(oci_lob_close)
if (!getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_descriptor, oci_lob_class_entry_ptr) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
@@ -1148,7 +1146,7 @@ PHP_FUNCTION(oci_new_descriptor)
zend_long type = OCI_DTYPE_LOB;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|l", &z_connection, &type) == FAILURE) {
- return;
+ RETURN_THROWS();
}
PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
@@ -1417,7 +1415,7 @@ PHP_FUNCTION(oci_cancel)
php_oci_statement *statement;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &z_statement) == FAILURE) {
- return;
+ RETURN_THROWS();
}
PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement);
@@ -1493,7 +1491,7 @@ PHP_FUNCTION(oci_fetch_all)
/* Fetch by Row: array will contain one sub-array per query row */
array = zend_try_array_init(array);
if (!array) {
- return;
+ RETURN_THROWS();
}
columns = safe_emalloc(statement->ncolumns, sizeof(php_oci_out_column *), 0);
@@ -1537,7 +1535,7 @@ PHP_FUNCTION(oci_fetch_all)
/* Fetch by columns: array will contain one sub-array per query column */
array = zend_try_array_init_size(array, statement->ncolumns);
if (!array) {
- return;
+ RETURN_THROWS();
}
columns = safe_emalloc(statement->ncolumns, sizeof(php_oci_out_column *), 0);
@@ -1760,7 +1758,7 @@ go_out:
}
if (!errh) {
- php_error_docref(NULL, E_WARNING, "Oci_error: unable to find error handle");
+ php_error_docref(NULL, E_WARNING, "oci_error: unable to find error handle");
RETURN_FALSE;
}
@@ -2107,15 +2105,15 @@ PHP_FUNCTION(oci_password_change)
PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
if (!user_len) {
- php_error_docref(NULL, E_WARNING, "username cannot be empty");
+ php_error_docref(NULL, E_WARNING, "Username cannot be empty");
RETURN_FALSE;
}
if (!pass_old_len) {
- php_error_docref(NULL, E_WARNING, "old password cannot be empty");
+ php_error_docref(NULL, E_WARNING, "Old password cannot be empty");
RETURN_FALSE;
}
if (!pass_new_len) {
- php_error_docref(NULL, E_WARNING, "new password cannot be empty");
+ php_error_docref(NULL, E_WARNING, "New password cannot be empty");
RETURN_FALSE;
}
@@ -2126,15 +2124,15 @@ PHP_FUNCTION(oci_password_change)
} else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "ssss", &dbname, &dbname_len, &user, &user_len, &pass_old, &pass_old_len, &pass_new, &pass_new_len) == SUCCESS) {
if (!user_len) {
- php_error_docref(NULL, E_WARNING, "username cannot be empty");
+ php_error_docref(NULL, E_WARNING, "Username cannot be empty");
RETURN_FALSE;
}
if (!pass_old_len) {
- php_error_docref(NULL, E_WARNING, "old password cannot be empty");
+ php_error_docref(NULL, E_WARNING, "Old password cannot be empty");
RETURN_FALSE;
}
if (!pass_new_len) {
- php_error_docref(NULL, E_WARNING, "new password cannot be empty");
+ php_error_docref(NULL, E_WARNING, "New password cannot be empty");
RETURN_FALSE;
}
@@ -2307,7 +2305,7 @@ PHP_FUNCTION(oci_free_collection)
if (!getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_collection, oci_coll_class_entry_ptr) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
@@ -2334,12 +2332,12 @@ PHP_FUNCTION(oci_collection_append)
if (getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &value, &value_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Os", &z_collection, oci_coll_class_entry_ptr, &value, &value_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
@@ -2368,12 +2366,12 @@ PHP_FUNCTION(oci_collection_element_get)
if (getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &element_index) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ol", &z_collection, oci_coll_class_entry_ptr, &element_index) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
@@ -2384,11 +2382,9 @@ PHP_FUNCTION(oci_collection_element_get)
PHP_OCI_ZVAL_TO_COLLECTION(tmp, collection);
- if (php_oci_collection_element_get(collection, element_index, &value)) {
+ if (php_oci_collection_element_get(collection, element_index, return_value)) {
RETURN_FALSE;
}
-
- RETURN_ZVAL(&value, 1, 1);
}
/* }}} */
@@ -2401,12 +2397,12 @@ PHP_FUNCTION(oci_collection_assign)
if (getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_collection_from, oci_coll_class_entry_ptr) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "OO", &z_collection_dest, oci_coll_class_entry_ptr, &z_collection_from, oci_coll_class_entry_ptr) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
@@ -2442,12 +2438,12 @@ PHP_FUNCTION(oci_collection_element_assign)
if (getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &element_index, &value, &value_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ols", &z_collection, oci_coll_class_entry_ptr, &element_index, &value, &value_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
@@ -2475,7 +2471,7 @@ PHP_FUNCTION(oci_collection_size)
if (!getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_collection, oci_coll_class_entry_ptr) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
@@ -2503,7 +2499,7 @@ PHP_FUNCTION(oci_collection_max)
if (!getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_collection, oci_coll_class_entry_ptr) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
@@ -2531,12 +2527,12 @@ PHP_FUNCTION(oci_collection_trim)
if (getThis()) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &trim_size) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ol", &z_collection, oci_coll_class_entry_ptr, &trim_size) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
@@ -2565,7 +2561,7 @@ PHP_FUNCTION(oci_new_collection)
size_t tdo_len, schema_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|s", &z_connection, &tdo, &tdo_len, &schema, &schema_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
diff --git a/ext/oci8/oci8_lob.c b/ext/oci8/oci8_lob.c
index 5a31618713..2c5598673f 100644
--- a/ext/oci8/oci8_lob.c
+++ b/ext/oci8/oci8_lob.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/oci8/oci8_statement.c b/ext/oci8/oci8_statement.c
index fa6e97e47f..9eb0f15efb 100644
--- a/ext/oci8/oci8_statement.c
+++ b/ext/oci8/oci8_statement.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -1092,7 +1090,7 @@ int php_oci_bind_post_exec(zval *data)
break;
}
} else if ((Z_TYPE_P(zv) == IS_TRUE) || (Z_TYPE_P(zv) == IS_FALSE)) {
- /* This convetrsion is done on purpose (ext/oci8 uses LVAL as a temorary value) */
+ /* This convetrsion is done on purpose (ext/oci8 uses LVAL as a temporary value) */
if (Z_LVAL_P(zv) == 0)
ZVAL_BOOL(zv, FALSE);
else if (Z_LVAL_P(zv) == 1)
@@ -1411,12 +1409,12 @@ sb4 php_oci_bind_in_callback(
} else if (phpbind->statement != 0) {
/* RSET */
*bufpp = phpbind->statement;
- *alenp = -1; /* seems to be allright */
+ *alenp = -1; /* seems to be alright */
*indpp = (dvoid *)&phpbind->indicator;
} else {
/* descriptor bind */
*bufpp = phpbind->descriptor;
- *alenp = -1; /* seems to be allright */
+ *alenp = -1; /* seems to be alright */
*indpp = (dvoid *)&phpbind->indicator;
}
diff --git a/ext/oci8/package.xml b/ext/oci8/package.xml
index 4b1981201a..b9366a1775 100644
--- a/ext/oci8/package.xml
+++ b/ext/oci8/package.xml
@@ -713,7 +713,7 @@ to conform with the license.
</stability>
<license uri="http://www.php.net/license">PHP</license>
<notes>
-Bump PHP OCI8 2.0 mininum requirements to PHP 5.2 and Oracle client
+Bump PHP OCI8 2.0 minimum requirements to PHP 5.2 and Oracle client
library 10.2. (Use OCI8 1.4 for older PHP version support or if only
Oracle 9.2 client libraries are available.)
diff --git a/ext/oci8/php_oci8.h b/ext/oci8/php_oci8.h
index 061c2c7ae7..4eb3ebeb47 100644
--- a/ext/oci8/php_oci8.h
+++ b/ext/oci8/php_oci8.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/oci8/php_oci8_int.h b/ext/oci8/php_oci8_int.h
index 8d1e326815..60d9b32fe0 100644
--- a/ext/oci8/php_oci8_int.h
+++ b/ext/oci8/php_oci8_int.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -371,22 +369,22 @@ typedef struct {
#define PHP_OCI_ZVAL_TO_CONNECTION(zval, connection) \
if ((connection = (php_oci_connection *)zend_fetch_resource2(Z_RES_P(zval), "oci8 connection", le_connection, le_pconnection)) == NULL) { \
- RETURN_FALSE; \
+ RETURN_THROWS(); \
}
#define PHP_OCI_ZVAL_TO_STATEMENT(zval, statement) \
if ((statement = (php_oci_statement *)zend_fetch_resource(Z_RES_P(zval), "oci8 statement", le_statement)) == NULL) { \
- RETURN_FALSE; \
+ RETURN_THROWS(); \
}
#define PHP_OCI_ZVAL_TO_DESCRIPTOR(zval, descriptor) \
if ((descriptor = (php_oci_descriptor *)zend_fetch_resource(Z_RES_P(zval), "oci8 descriptor", le_descriptor)) == NULL) { \
- RETURN_FALSE; \
+ RETURN_THROWS(); \
}
#define PHP_OCI_ZVAL_TO_COLLECTION(zval, collection) \
if ((collection = (php_oci_collection *)zend_fetch_resource(Z_RES_P(zval), "oci8 collection", le_collection)) == NULL) { \
- RETURN_FALSE; \
+ RETURN_THROWS(); \
}
#define PHP_OCI_FETCH_RESOURCE_EX(zval, var, type, name, resource_type) \
diff --git a/ext/oci8/tests/array_bind_014.phpt b/ext/oci8/tests/array_bind_014.phpt
index ca5823bc0f..abf7907739 100644
--- a/ext/oci8/tests/array_bind_014.phpt
+++ b/ext/oci8/tests/array_bind_014.phpt
@@ -47,8 +47,8 @@ $statement = oci_parse($c, $create_pkg_body);
oci_execute($statement);
for ($i = 1; $i < 6; $i++) {
- $statement = oci_parse($c, "INSERT INTO bind_test VALUES (".$i.")");
- oci_execute($statement);
+ $statement = oci_parse($c, "INSERT INTO bind_test VALUES (".$i.")");
+ oci_execute($statement);
}
$statement = oci_parse($c, "BEGIN array_bind_014_pkg.iobind(:c1); END;");
diff --git a/ext/oci8/tests/b47243_1.phpt b/ext/oci8/tests/b47243_1.phpt
index 8e0b043518..826404021b 100644
--- a/ext/oci8/tests/b47243_1.phpt
+++ b/ext/oci8/tests/b47243_1.phpt
@@ -20,6 +20,5 @@ oci_fetch_all($s, $r);
?>
===DONE===
-<?php exit(0); ?>
--EXPECT--
===DONE===
diff --git a/ext/oci8/tests/b47243_2.phpt b/ext/oci8/tests/b47243_2.phpt
index faf61e6c79..f7a9978978 100644
--- a/ext/oci8/tests/b47243_2.phpt
+++ b/ext/oci8/tests/b47243_2.phpt
@@ -21,6 +21,5 @@ oci_free_statement($s);
?>
===DONE===
-<?php exit(0); ?>
--EXPECT--
===DONE===
diff --git a/ext/oci8/tests/b47243_3.phpt b/ext/oci8/tests/b47243_3.phpt
index 74eadc8df9..c9d9936c21 100644
--- a/ext/oci8/tests/b47243_3.phpt
+++ b/ext/oci8/tests/b47243_3.phpt
@@ -22,6 +22,5 @@ oci_close($c);
?>
===DONE===
-<?php exit(0); ?>
--EXPECT--
===DONE===
diff --git a/ext/oci8/tests/bind_boolean_1.phpt b/ext/oci8/tests/bind_boolean_1.phpt
index 7c77187056..bd4ba356ec 100644
--- a/ext/oci8/tests/bind_boolean_1.phpt
+++ b/ext/oci8/tests/bind_boolean_1.phpt
@@ -100,8 +100,6 @@ oci_execute($s);
var_dump($b1, $b2);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Test 1
bool(true)
@@ -135,4 +133,3 @@ bool(true)
bool(false)
bool(false)
bool(true)
-===DONE===
diff --git a/ext/oci8/tests/bind_char_1.phpt b/ext/oci8/tests/bind_char_1.phpt
index fbd1d65bd2..f405155980 100644
--- a/ext/oci8/tests/bind_char_1.phpt
+++ b/ext/oci8/tests/bind_char_1.phpt
@@ -20,11 +20,11 @@ require(__DIR__.'/connect.inc');
// Initialization
$stmtarray = array(
- "drop table bind_char_tab",
- "create table bind_char_tab (id number, c1 char(10), c2 varchar2(10))",
- "insert into bind_char_tab values (1, 'abc', NULL)",
- "insert into bind_char_tab values (2, NULL, 'abc')",
- "insert into bind_char_tab values (3, NULL, 'abc ')"
+ "drop table bind_char_tab",
+ "create table bind_char_tab (id number, c1 char(10), c2 varchar2(10))",
+ "insert into bind_char_tab values (1, 'abc', NULL)",
+ "insert into bind_char_tab values (2, NULL, 'abc')",
+ "insert into bind_char_tab values (3, NULL, 'abc ')"
);
oci8_test_sql_execute($c, $stmtarray);
@@ -39,32 +39,32 @@ echo "Test 1.1: Type: default. Length: default\n";
$s = oci_parse($c, "select * from bind_char_tab where c1 = :bv");
$r = oci_bind_by_name($s, ":bv", $bv1);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 1.2: Type: AFC. Length: default\n";
$r = oci_bind_by_name($s, ":bv", $bv1, -1, SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 1.3: Type: AFC: Length: 0\n";
$r = oci_bind_by_name($s, ":bv", $bv1, 0, SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 1.4: Type: AFC: Length: strlen\n";
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1), SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 1.5: Type: AFC. Length: strlen-1\n";
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)-1, SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 1.6: Type: AFC. Length: strlen+1\n";
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)+1, SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "\n\n*** NULL data tests against CHAR ***\n";
@@ -74,32 +74,32 @@ echo "Test 2.1: Type: default. Length: default\n";
$s = oci_parse($c, "select * from bind_char_tab where c1 = :bv");
$r = oci_bind_by_name($s, ":bv", $bv1);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 2.2: Type: AFC. Length: default\n";
$r = oci_bind_by_name($s, ":bv", $bv1, -1, SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 2.3: Type: AFC: Length: 0\n";
$r = oci_bind_by_name($s, ":bv", $bv1, 0, SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 2.4: Type: AFC: Length: strlen\n";
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1), SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 2.5: Type: AFC. Length: strlen-1\n";
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)-1, SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 2.6: Type: AFC. Length: strlen+1\n";
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)+1, SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "\n\n*** Non-null Data Tests against VARCHAR2***\n";
@@ -110,32 +110,32 @@ echo "Test 3.1: Type: default. Length: default\n";
$s = oci_parse($c, "select * from bind_char_tab where c2 = :bv");
$r = oci_bind_by_name($s, ":bv", $bv1);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 3.2: Type: AFC. Length: default\n";
$r = oci_bind_by_name($s, ":bv", $bv1, -1, SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 3.3: Type: AFC: Length: 0\n";
$r = oci_bind_by_name($s, ":bv", $bv1, 0, SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 3.4: Type: AFC: Length: strlen\n";
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1), SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 3.5: Type: AFC. Length: strlen-1\n";
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)-1, SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 3.6: Type: AFC. Length: strlen+1\n";
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)+1, SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "\n\n*** NULL data tests against VARCHAR2 ***\n";
@@ -146,55 +146,55 @@ echo "Test 4.1: Type: default. Length: default\n";
$s = oci_parse($c, "select * from bind_char_tab where c2 = :bv");
$r = oci_bind_by_name($s, ":bv", $bv1);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 4.2: Type: AFC. Length: default\n";
$r = oci_bind_by_name($s, ":bv", $bv1, -1, SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 4.3: Type: AFC: Length: 0\n";
$r = oci_bind_by_name($s, ":bv", $bv1, 0, SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 4.4: Type: AFC: Length: strlen\n";
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1), SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 4.5: Type: AFC. Length: strlen-1\n";
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)-1, SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 4.6: Type: AFC. Length: strlen+1\n";
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)+1, SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
function do_e_q($s)
{
- echo " Querying:\n";
-
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- echo " Oci_execute error ORA-".$m['code']." Exiting Query\n";
- return;
- }
- while ($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) {
- foreach ($row as $item) {
- echo " :" . $item . ":\n";
- }
- }
+ echo " Querying:\n";
+
+ $r = @oci_execute($s);
+ if (!$r) {
+ $m = oci_error($s);
+ echo " Oci_execute error ORA-".$m['code']." Exiting Query\n";
+ return;
+ }
+ while ($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) {
+ foreach ($row as $item) {
+ echo " :" . $item . ":\n";
+ }
+ }
}
// Cleanup
$stmtarray = array(
- "drop table bind_char_tab"
+ "drop table bind_char_tab"
);
oci8_test_sql_execute($c, $stmtarray);
diff --git a/ext/oci8/tests/bind_char_1_11gR1.phpt b/ext/oci8/tests/bind_char_1_11gR1.phpt
index ea49c96b75..d281833a77 100644
--- a/ext/oci8/tests/bind_char_1_11gR1.phpt
+++ b/ext/oci8/tests/bind_char_1_11gR1.phpt
@@ -22,11 +22,11 @@ require(__DIR__.'/connect.inc');
// Initialization
$stmtarray = array(
- "drop table bind_char_tab",
- "create table bind_char_tab (id number, c1 char(10), c2 varchar2(10))",
- "insert into bind_char_tab values (1, 'abc', NULL)",
- "insert into bind_char_tab values (2, NULL, 'abc')",
- "insert into bind_char_tab values (3, NULL, 'abc ')"
+ "drop table bind_char_tab",
+ "create table bind_char_tab (id number, c1 char(10), c2 varchar2(10))",
+ "insert into bind_char_tab values (1, 'abc', NULL)",
+ "insert into bind_char_tab values (2, NULL, 'abc')",
+ "insert into bind_char_tab values (3, NULL, 'abc ')"
);
oci8_test_sql_execute($c, $stmtarray);
@@ -41,32 +41,32 @@ echo "Test 1.1: Type: default. Length: default\n";
$s = oci_parse($c, "select * from bind_char_tab where c1 = :bv");
$r = oci_bind_by_name($s, ":bv", $bv1);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 1.2: Type: AFC. Length: default\n";
$r = oci_bind_by_name($s, ":bv", $bv1, -1, SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 1.3: Type: AFC: Length: 0\n";
$r = oci_bind_by_name($s, ":bv", $bv1, 0, SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 1.4: Type: AFC: Length: strlen\n";
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1), SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 1.5: Type: AFC. Length: strlen-1\n";
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)-1, SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 1.6: Type: AFC. Length: strlen+1\n";
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)+1, SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "\n\n*** NULL data tests against CHAR ***\n";
@@ -76,32 +76,32 @@ echo "Test 2.1: Type: default. Length: default\n";
$s = oci_parse($c, "select * from bind_char_tab where c1 = :bv");
$r = oci_bind_by_name($s, ":bv", $bv1);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 2.2: Type: AFC. Length: default\n";
$r = oci_bind_by_name($s, ":bv", $bv1, -1, SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 2.3: Type: AFC: Length: 0\n";
$r = oci_bind_by_name($s, ":bv", $bv1, 0, SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 2.4: Type: AFC: Length: strlen\n";
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1), SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 2.5: Type: AFC. Length: strlen-1\n";
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)-1, SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 2.6: Type: AFC. Length: strlen+1\n";
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)+1, SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "\n\n*** Non-null Data Tests against VARCHAR2***\n";
@@ -112,32 +112,32 @@ echo "Test 3.1: Type: default. Length: default\n";
$s = oci_parse($c, "select * from bind_char_tab where c2 = :bv");
$r = oci_bind_by_name($s, ":bv", $bv1);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 3.2: Type: AFC. Length: default\n";
$r = oci_bind_by_name($s, ":bv", $bv1, -1, SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 3.3: Type: AFC: Length: 0\n";
$r = oci_bind_by_name($s, ":bv", $bv1, 0, SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 3.4: Type: AFC: Length: strlen\n";
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1), SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 3.5: Type: AFC. Length: strlen-1\n";
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)-1, SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 3.6: Type: AFC. Length: strlen+1\n";
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)+1, SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "\n\n*** NULL data tests against VARCHAR2 ***\n";
@@ -148,55 +148,55 @@ echo "Test 4.1: Type: default. Length: default\n";
$s = oci_parse($c, "select * from bind_char_tab where c2 = :bv");
$r = oci_bind_by_name($s, ":bv", $bv1);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 4.2: Type: AFC. Length: default\n";
$r = oci_bind_by_name($s, ":bv", $bv1, -1, SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 4.3: Type: AFC: Length: 0\n";
$r = oci_bind_by_name($s, ":bv", $bv1, 0, SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 4.4: Type: AFC: Length: strlen\n";
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1), SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 4.5: Type: AFC. Length: strlen-1\n";
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)-1, SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 4.6: Type: AFC. Length: strlen+1\n";
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)+1, SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
function do_e_q($s)
{
- echo " Querying:\n";
-
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- echo " Oci_execute error ORA-".$m['code']." Exiting Query\n";
- return;
- }
- while ($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) {
- foreach ($row as $item) {
- echo " :" . $item . ":\n";
- }
- }
+ echo " Querying:\n";
+
+ $r = @oci_execute($s);
+ if (!$r) {
+ $m = oci_error($s);
+ echo " Oci_execute error ORA-".$m['code']." Exiting Query\n";
+ return;
+ }
+ while ($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) {
+ foreach ($row as $item) {
+ echo " :" . $item . ":\n";
+ }
+ }
}
// Cleanup
$stmtarray = array(
- "drop table bind_char_tab"
+ "drop table bind_char_tab"
);
oci8_test_sql_execute($c, $stmtarray);
diff --git a/ext/oci8/tests/bind_char_2.phpt b/ext/oci8/tests/bind_char_2.phpt
index 8200dcf368..1e5fb08a94 100644
--- a/ext/oci8/tests/bind_char_2.phpt
+++ b/ext/oci8/tests/bind_char_2.phpt
@@ -20,10 +20,10 @@ require(__DIR__.'/connect.inc');
// Initialization
$stmtarray = array(
- "alter session set nls_date_format='YYYY-MM-DD'",
- "drop table bind_char_tab",
- "create table bind_char_tab (id number, c1 date)",
- "insert into bind_char_tab values (1, '2008-04-20')",
+ "alter session set nls_date_format='YYYY-MM-DD'",
+ "drop table bind_char_tab",
+ "create table bind_char_tab (id number, c1 date)",
+ "insert into bind_char_tab values (1, '2008-04-20')",
);
oci8_test_sql_execute($c, $stmtarray);
@@ -41,49 +41,49 @@ if ($r)
echo "Test 1.2: Type: AFC. Length: default\n";
$r = oci_bind_by_name($s, ":bv", $bv1, -1, SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 1.3: Type: AFC: Length: 0\n";
$r = oci_bind_by_name($s, ":bv", $bv1, 0, SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 1.4: Type: AFC: Length: strlen\n";
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1), SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 1.5: Type: AFC. Length: strlen-1\n";
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)-1, SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 1.6: Type: AFC. Length: strlen+1\n";
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)+1, SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
function do_e_q($s)
{
- echo " Querying:\n";
-
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- echo " Oci_execute error ORA-".$m['code']." Exiting Query\n";
- return;
- }
- while ($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) {
- foreach ($row as $item) {
- echo " :" . $item . ":\n";
- }
- }
+ echo " Querying:\n";
+
+ $r = @oci_execute($s);
+ if (!$r) {
+ $m = oci_error($s);
+ echo " Oci_execute error ORA-".$m['code']." Exiting Query\n";
+ return;
+ }
+ while ($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) {
+ foreach ($row as $item) {
+ echo " :" . $item . ":\n";
+ }
+ }
}
// Cleanup
$stmtarray = array(
- "drop table bind_char_tab"
+ "drop table bind_char_tab"
);
oci8_test_sql_execute($c, $stmtarray);
diff --git a/ext/oci8/tests/bind_char_2_11gR1.phpt b/ext/oci8/tests/bind_char_2_11gR1.phpt
index 3ee9648221..11ed50fb83 100644
--- a/ext/oci8/tests/bind_char_2_11gR1.phpt
+++ b/ext/oci8/tests/bind_char_2_11gR1.phpt
@@ -20,10 +20,10 @@ require(__DIR__.'/connect.inc');
// Initialization
$stmtarray = array(
- "alter session set nls_date_format='YYYY-MM-DD'",
- "drop table bind_char_tab",
- "create table bind_char_tab (id number, c1 date)",
- "insert into bind_char_tab values (1, '2008-04-20')",
+ "alter session set nls_date_format='YYYY-MM-DD'",
+ "drop table bind_char_tab",
+ "create table bind_char_tab (id number, c1 date)",
+ "insert into bind_char_tab values (1, '2008-04-20')",
);
oci8_test_sql_execute($c, $stmtarray);
@@ -41,49 +41,49 @@ if ($r)
echo "Test 1.2: Type: AFC. Length: default\n";
$r = oci_bind_by_name($s, ":bv", $bv1, -1, SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 1.3: Type: AFC: Length: 0\n";
$r = oci_bind_by_name($s, ":bv", $bv1, 0, SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 1.4: Type: AFC: Length: strlen\n";
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1), SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 1.5: Type: AFC. Length: strlen-1\n";
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)-1, SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
echo "Test 1.6: Type: AFC. Length: strlen+1\n";
$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)+1, SQLT_AFC);
if ($r)
- do_e_q($s);
+ do_e_q($s);
function do_e_q($s)
{
- echo " Querying:\n";
-
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- echo " Oci_execute error ORA-".$m['code']." Exiting Query\n";
- return;
- }
- while ($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) {
- foreach ($row as $item) {
- echo " :" . $item . ":\n";
- }
- }
+ echo " Querying:\n";
+
+ $r = @oci_execute($s);
+ if (!$r) {
+ $m = oci_error($s);
+ echo " Oci_execute error ORA-".$m['code']." Exiting Query\n";
+ return;
+ }
+ while ($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) {
+ foreach ($row as $item) {
+ echo " :" . $item . ":\n";
+ }
+ }
}
// Cleanup
$stmtarray = array(
- "drop table bind_char_tab"
+ "drop table bind_char_tab"
);
oci8_test_sql_execute($c, $stmtarray);
diff --git a/ext/oci8/tests/bind_char_3.phpt b/ext/oci8/tests/bind_char_3.phpt
index f4d8c1f242..62f767367e 100644
--- a/ext/oci8/tests/bind_char_3.phpt
+++ b/ext/oci8/tests/bind_char_3.phpt
@@ -20,7 +20,7 @@ require(__DIR__.'/connect.inc');
// Initialization
$stmtarray = array(
- "create or replace function bind_char_3_fn(p1 char) return char as begin return p1; end;",
+ "create or replace function bind_char_3_fn(p1 char) return char as begin return p1; end;",
);
oci8_test_sql_execute($c, $stmtarray);
@@ -33,7 +33,7 @@ $s = oci_parse($c, "begin :bv2 := bind_char_3_fn(:bv1); end;");
$bv1 = 'abc';
$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
echo "Test 1.2 In Length: default. In Type: default. Out Length: 10. Out Type: default\n";
@@ -41,7 +41,7 @@ echo "Test 1.2 In Length: default. In Type: default. Out Length: 10.
$bv1 = 'abc';
$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -50,7 +50,7 @@ echo "Test 1.3 In Length: -1. In Type: AFC. Out Length: 10.
$bv1 = 'abc';
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -60,7 +60,7 @@ echo "Test 1.4 In Length: -1. In Type: AFC. Out Length: 10.
$bv1 = 'abc';
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -69,7 +69,7 @@ echo "Test 1.5 In Length: strlen. In Type: AFC. Out Length: strlen(input)
$bv1 = 'abc';
$r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1), SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -78,7 +78,7 @@ echo "Test 1.6 In Length: strlen. In Type: AFC. Out Length: strlen(input)
$bv1 = 'abc';
$r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1)-1, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -87,7 +87,7 @@ echo "Test 1.7 In Length: strlen. In Type: AFC. Out Length: strlen(input)
$bv1 = 'abc';
$r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1)+1, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -98,7 +98,7 @@ echo "Test 2.1 In Length: -1. In Type: AFC. Out Length: 10.
$bv1 = '';
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -106,7 +106,7 @@ echo "Test 2.2 In Length: default. In Type: default. Out Length: 10.
$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -116,7 +116,7 @@ echo "Test 2.3 In Length: -1. In Type: AFC. Out Length: 10.
$bv1 = '';
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -126,7 +126,7 @@ echo "Test 2.4 In Length: -1. In Type: AFC. Out Length: 10.
$bv1 = '';
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -136,7 +136,7 @@ echo "Test 2.5 In Length: -1. In Type: AFC. Out Length: 0.
$bv1 = '';
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -146,7 +146,7 @@ echo "Test 2.6 In Length: 0. In Type: AFC. Out Length: 0.
$bv1 = '';
$r = oci_bind_by_name($s, ':bv1', $bv1, 0, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -156,7 +156,7 @@ echo "Test 2.7 In Length: 1. In Type: AFC. Out Length: 1.
$bv1 = '';
$r = oci_bind_by_name($s, ':bv1', $bv1, 1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 1, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -168,7 +168,7 @@ echo "Test 3.1 In Length: -1. In Type: AFC. Out Length: 10.
$bv1 = null;
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -177,7 +177,7 @@ echo "Test 3.2 In Length: default. In Type: default. Out Length: 10.
$bv1 = null;
$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -187,7 +187,7 @@ echo "Test 3.3 In Length: -1. In Type: AFC. Out Length: 10.
$bv1 = null;
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -197,7 +197,7 @@ echo "Test 3.4 In Length: -1. In Type: AFC. Out Length: 10.
$bv1 = null;
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -206,7 +206,7 @@ echo "Test 3.5 In Length: -1. In Type: AFC. Out Length: 0.
$bv1 = null;
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -216,26 +216,26 @@ echo "Test 3.6 In Length: -1. In Type: AFC. Out Length: 1.
$bv1 = null;
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 1, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
function do_e($s)
{
- echo " Executing:\n";
-
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- echo " Oci_execute error ORA-".$m['code']."\n";
- return;
- }
+ echo " Executing:\n";
+
+ $r = @oci_execute($s);
+ if (!$r) {
+ $m = oci_error($s);
+ echo " Oci_execute error ORA-".$m['code']."\n";
+ return;
+ }
}
// Cleanup
$stmtarray = array(
- "drop function bind_char_3_fn"
+ "drop function bind_char_3_fn"
);
oci8_test_sql_execute($c, $stmtarray);
diff --git a/ext/oci8/tests/bind_char_3_11gR1.phpt b/ext/oci8/tests/bind_char_3_11gR1.phpt
index 1adcae2a74..c809101199 100644
--- a/ext/oci8/tests/bind_char_3_11gR1.phpt
+++ b/ext/oci8/tests/bind_char_3_11gR1.phpt
@@ -20,7 +20,7 @@ require(__DIR__.'/connect.inc');
// Initialization
$stmtarray = array(
- "create or replace function bind_char_3_fn(p1 char) return char as begin return p1; end;",
+ "create or replace function bind_char_3_fn(p1 char) return char as begin return p1; end;",
);
oci8_test_sql_execute($c, $stmtarray);
@@ -33,7 +33,7 @@ $s = oci_parse($c, "begin :bv2 := bind_char_3_fn(:bv1); end;");
$bv1 = 'abc';
$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
echo "Test 1.2 In Length: default. In Type: default. Out Length: 10. Out Type: default\n";
@@ -41,7 +41,7 @@ echo "Test 1.2 In Length: default. In Type: default. Out Length: 10.
$bv1 = 'abc';
$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -50,7 +50,7 @@ echo "Test 1.3 In Length: -1. In Type: AFC. Out Length: 10.
$bv1 = 'abc';
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -60,7 +60,7 @@ echo "Test 1.4 In Length: -1. In Type: AFC. Out Length: 10.
$bv1 = 'abc';
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -69,7 +69,7 @@ echo "Test 1.5 In Length: strlen. In Type: AFC. Out Length: strlen(input)
$bv1 = 'abc';
$r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1), SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -78,7 +78,7 @@ echo "Test 1.6 In Length: strlen. In Type: AFC. Out Length: strlen(input)
$bv1 = 'abc';
$r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1)-1, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -87,7 +87,7 @@ echo "Test 1.7 In Length: strlen. In Type: AFC. Out Length: strlen(input)
$bv1 = 'abc';
$r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1)+1, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -98,7 +98,7 @@ echo "Test 2.1 In Length: -1. In Type: AFC. Out Length: 10.
$bv1 = '';
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -106,7 +106,7 @@ echo "Test 2.2 In Length: default. In Type: default. Out Length: 10.
$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -116,7 +116,7 @@ echo "Test 2.3 In Length: -1. In Type: AFC. Out Length: 10.
$bv1 = '';
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -126,7 +126,7 @@ echo "Test 2.4 In Length: -1. In Type: AFC. Out Length: 10.
$bv1 = '';
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -136,7 +136,7 @@ echo "Test 2.5 In Length: -1. In Type: AFC. Out Length: 0.
$bv1 = '';
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -146,7 +146,7 @@ echo "Test 2.6 In Length: 0. In Type: AFC. Out Length: 0.
$bv1 = '';
$r = oci_bind_by_name($s, ':bv1', $bv1, 0, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -156,7 +156,7 @@ echo "Test 2.7 In Length: 1. In Type: AFC. Out Length: 1.
$bv1 = '';
$r = oci_bind_by_name($s, ':bv1', $bv1, 1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 1, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -168,7 +168,7 @@ echo "Test 3.1 In Length: -1. In Type: AFC. Out Length: 10.
$bv1 = null;
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -177,7 +177,7 @@ echo "Test 3.2 In Length: default. In Type: default. Out Length: 10.
$bv1 = null;
$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -187,7 +187,7 @@ echo "Test 3.3 In Length: -1. In Type: AFC. Out Length: 10.
$bv1 = null;
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -197,7 +197,7 @@ echo "Test 3.4 In Length: -1. In Type: AFC. Out Length: 10.
$bv1 = null;
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -206,7 +206,7 @@ echo "Test 3.5 In Length: -1. In Type: AFC. Out Length: 0.
$bv1 = null;
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -216,26 +216,26 @@ echo "Test 3.6 In Length: -1. In Type: AFC. Out Length: 1.
$bv1 = null;
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 1, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
function do_e($s)
{
- echo " Executing:\n";
-
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- echo " Oci_execute error ORA-".$m['code']."\n";
- return;
- }
+ echo " Executing:\n";
+
+ $r = @oci_execute($s);
+ if (!$r) {
+ $m = oci_error($s);
+ echo " Oci_execute error ORA-".$m['code']."\n";
+ return;
+ }
}
// Cleanup
$stmtarray = array(
- "drop function bind_char_3_fn"
+ "drop function bind_char_3_fn"
);
oci8_test_sql_execute($c, $stmtarray);
diff --git a/ext/oci8/tests/bind_char_4.phpt b/ext/oci8/tests/bind_char_4.phpt
index 218f0b03cf..627ba45e86 100644
--- a/ext/oci8/tests/bind_char_4.phpt
+++ b/ext/oci8/tests/bind_char_4.phpt
@@ -22,7 +22,7 @@ require(__DIR__.'/connect.inc');
// Initialization
$stmtarray = array(
- "create or replace function bind_char_3_fn(p1 varchar2) return varchar2 as begin return p1; end;",
+ "create or replace function bind_char_3_fn(p1 varchar2) return varchar2 as begin return p1; end;",
);
oci8_test_sql_execute($c, $stmtarray);
@@ -35,7 +35,7 @@ $s = oci_parse($c, "begin :bv2 := bind_char_3_fn(:bv1); end;");
$bv1 = 'abc';
$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
echo "Test 1.2 In Length: default. In Type: default. Out Length: 10. Out Type: default\n";
@@ -43,7 +43,7 @@ echo "Test 1.2 In Length: default. In Type: default. Out Length: 10.
$bv1 = 'abc';
$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -52,7 +52,7 @@ echo "Test 1.3 In Length: -1. In Type: AFC. Out Length: 10.
$bv1 = 'abc';
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -62,7 +62,7 @@ echo "Test 1.4 In Length: -1. In Type: AFC. Out Length: 10.
$bv1 = 'abc';
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -71,7 +71,7 @@ echo "Test 1.5 In Length: strlen. In Type: AFC. Out Length: strlen(input)
$bv1 = 'abc';
$r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1), SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -80,7 +80,7 @@ echo "Test 1.6 In Length: strlen. In Type: AFC. Out Length: strlen(input)
$bv1 = 'abc';
$r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1)-1, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -89,7 +89,7 @@ echo "Test 1.7 In Length: strlen. In Type: AFC. Out Length: strlen(input)
$bv1 = 'abc';
$r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1)+1, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -100,7 +100,7 @@ echo "Test 2.1 In Length: -1. In Type: AFC. Out Length: 10.
$bv1 = '';
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -108,7 +108,7 @@ echo "Test 2.2 In Length: default. In Type: default. Out Length: 10.
$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -118,7 +118,7 @@ echo "Test 2.3 In Length: -1. In Type: AFC. Out Length: 10.
$bv1 = '';
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -128,7 +128,7 @@ echo "Test 2.4 In Length: -1. In Type: AFC. Out Length: 10.
$bv1 = '';
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -138,7 +138,7 @@ echo "Test 2.5 In Length: -1. In Type: AFC. Out Length: 0.
$bv1 = '';
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -148,7 +148,7 @@ echo "Test 2.6 In Length: 0. In Type: AFC. Out Length: 0.
$bv1 = '';
$r = oci_bind_by_name($s, ':bv1', $bv1, 0, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -158,7 +158,7 @@ echo "Test 2.7 In Length: 1. In Type: AFC. Out Length: 1.
$bv1 = '';
$r = oci_bind_by_name($s, ':bv1', $bv1, 1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 1, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -170,7 +170,7 @@ echo "Test 3.1 In Length: -1. In Type: AFC. Out Length: 10.
$bv1 = null;
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -179,7 +179,7 @@ echo "Test 3.2 In Length: default. In Type: default. Out Length: 10.
$bv1 = null;
$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -189,7 +189,7 @@ echo "Test 3.3 In Length: -1. In Type: AFC. Out Length: 10.
$bv1 = null;
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -199,7 +199,7 @@ echo "Test 3.4 In Length: -1. In Type: AFC. Out Length: 10.
$bv1 = null;
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -208,7 +208,7 @@ echo "Test 3.5 In Length: -1. In Type: AFC. Out Length: 0.
$bv1 = null;
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -218,26 +218,26 @@ echo "Test 3.6 In Length: -1. In Type: AFC. Out Length: 1.
$bv1 = null;
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 1, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
function do_e($s)
{
- echo " Executing:\n";
-
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- echo " Oci_execute error ORA-".$m['code']."\n";
- return;
- }
+ echo " Executing:\n";
+
+ $r = @oci_execute($s);
+ if (!$r) {
+ $m = oci_error($s);
+ echo " Oci_execute error ORA-".$m['code']."\n";
+ return;
+ }
}
// Cleanup
$stmtarray = array(
- "drop function bind_char_3_fn"
+ "drop function bind_char_3_fn"
);
oci8_test_sql_execute($c, $stmtarray);
diff --git a/ext/oci8/tests/bind_char_4_11gR1.phpt b/ext/oci8/tests/bind_char_4_11gR1.phpt
index 51350e533e..e40887c450 100644
--- a/ext/oci8/tests/bind_char_4_11gR1.phpt
+++ b/ext/oci8/tests/bind_char_4_11gR1.phpt
@@ -22,7 +22,7 @@ require(__DIR__.'/connect.inc');
// Initialization
$stmtarray = array(
- "create or replace function bind_char_3_fn(p1 varchar2) return varchar2 as begin return p1; end;",
+ "create or replace function bind_char_3_fn(p1 varchar2) return varchar2 as begin return p1; end;",
);
oci8_test_sql_execute($c, $stmtarray);
@@ -35,7 +35,7 @@ $s = oci_parse($c, "begin :bv2 := bind_char_3_fn(:bv1); end;");
$bv1 = 'abc';
$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
echo "Test 1.2 In Length: default. In Type: default. Out Length: 10. Out Type: default\n";
@@ -43,7 +43,7 @@ echo "Test 1.2 In Length: default. In Type: default. Out Length: 10.
$bv1 = 'abc';
$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -52,7 +52,7 @@ echo "Test 1.3 In Length: -1. In Type: AFC. Out Length: 10.
$bv1 = 'abc';
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -62,7 +62,7 @@ echo "Test 1.4 In Length: -1. In Type: AFC. Out Length: 10.
$bv1 = 'abc';
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -71,7 +71,7 @@ echo "Test 1.5 In Length: strlen. In Type: AFC. Out Length: strlen(input)
$bv1 = 'abc';
$r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1), SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -80,7 +80,7 @@ echo "Test 1.6 In Length: strlen. In Type: AFC. Out Length: strlen(input)
$bv1 = 'abc';
$r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1)-1, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -89,7 +89,7 @@ echo "Test 1.7 In Length: strlen. In Type: AFC. Out Length: strlen(input)
$bv1 = 'abc';
$r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1)+1, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -100,7 +100,7 @@ echo "Test 2.1 In Length: -1. In Type: AFC. Out Length: 10.
$bv1 = '';
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -108,7 +108,7 @@ echo "Test 2.2 In Length: default. In Type: default. Out Length: 10.
$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -118,7 +118,7 @@ echo "Test 2.3 In Length: -1. In Type: AFC. Out Length: 10.
$bv1 = '';
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -128,7 +128,7 @@ echo "Test 2.4 In Length: -1. In Type: AFC. Out Length: 10.
$bv1 = '';
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -138,7 +138,7 @@ echo "Test 2.5 In Length: -1. In Type: AFC. Out Length: 0.
$bv1 = '';
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -148,7 +148,7 @@ echo "Test 2.6 In Length: 0. In Type: AFC. Out Length: 0.
$bv1 = '';
$r = oci_bind_by_name($s, ':bv1', $bv1, 0, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -158,7 +158,7 @@ echo "Test 2.7 In Length: 1. In Type: AFC. Out Length: 1.
$bv1 = '';
$r = oci_bind_by_name($s, ':bv1', $bv1, 1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 1, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -170,7 +170,7 @@ echo "Test 3.1 In Length: -1. In Type: AFC. Out Length: 10.
$bv1 = null;
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -179,7 +179,7 @@ echo "Test 3.2 In Length: default. In Type: default. Out Length: 10.
$bv1 = null;
$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -189,7 +189,7 @@ echo "Test 3.3 In Length: -1. In Type: AFC. Out Length: 10.
$bv1 = null;
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -199,7 +199,7 @@ echo "Test 3.4 In Length: -1. In Type: AFC. Out Length: 10.
$bv1 = null;
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -208,7 +208,7 @@ echo "Test 3.5 In Length: -1. In Type: AFC. Out Length: 0.
$bv1 = null;
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
@@ -218,26 +218,26 @@ echo "Test 3.6 In Length: -1. In Type: AFC. Out Length: 1.
$bv1 = null;
$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 1, SQLT_AFC);
if ($r)
- do_e($s);
+ do_e($s);
var_dump($bv1, $bv2);
function do_e($s)
{
- echo " Executing:\n";
-
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- echo " Oci_execute error ORA-".$m['code']."\n";
- return;
- }
+ echo " Executing:\n";
+
+ $r = @oci_execute($s);
+ if (!$r) {
+ $m = oci_error($s);
+ echo " Oci_execute error ORA-".$m['code']."\n";
+ return;
+ }
}
// Cleanup
$stmtarray = array(
- "drop function bind_char_3_fn"
+ "drop function bind_char_3_fn"
);
oci8_test_sql_execute($c, $stmtarray);
diff --git a/ext/oci8/tests/bind_empty.phpt b/ext/oci8/tests/bind_empty.phpt
index ae8cbbca2d..62ec898abb 100644
--- a/ext/oci8/tests/bind_empty.phpt
+++ b/ext/oci8/tests/bind_empty.phpt
@@ -89,8 +89,6 @@ $statement = oci_parse($c, $drop);
@oci_execute($statement);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Test 1
bool(true)
@@ -124,4 +122,3 @@ NULL
Test 6
NULL
NULL
-===DONE===
diff --git a/ext/oci8/tests/bind_misccoltypes.phpt b/ext/oci8/tests/bind_misccoltypes.phpt
index 0cc307b4d4..928256ad6b 100644
--- a/ext/oci8/tests/bind_misccoltypes.phpt
+++ b/ext/oci8/tests/bind_misccoltypes.phpt
@@ -16,9 +16,9 @@ $stmtarray = array(
"alter session set nls_date_format = 'DD-MON-YY'",
- "drop table bind_misccoltypes_tab",
+ "drop table bind_misccoltypes_tab",
- "create table bind_misccoltypes_tab (
+ "create table bind_misccoltypes_tab (
id number,
char_t char(1),
char_t10 char(10),
@@ -260,7 +260,7 @@ check_col($c, 'date_t', 60);
// Clean up
$stmtarray = array(
- "drop table bind_misccoltypes_tab"
+ "drop table bind_misccoltypes_tab"
);
oci8_test_sql_execute($c, $stmtarray);
@@ -268,8 +268,6 @@ oci8_test_sql_execute($c, $stmtarray);
oci_close($c);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
TEST86 insert all ORATYPE values
@@ -363,4 +361,3 @@ array(1) {
string(9) "09-APR-10"
}
}
-===DONE===
diff --git a/ext/oci8/tests/bind_misccoltypes_errs.phpt b/ext/oci8/tests/bind_misccoltypes_errs.phpt
index 5c443d0f69..4f5de46e80 100644
--- a/ext/oci8/tests/bind_misccoltypes_errs.phpt
+++ b/ext/oci8/tests/bind_misccoltypes_errs.phpt
@@ -10,9 +10,9 @@ require(__DIR__.'/connect.inc');
// Initialization
$stmtarray = array(
- "drop table bind_misccoltypes_errs_tab",
+ "drop table bind_misccoltypes_errs_tab",
- "create table bind_misccoltypes_errs_tab (
+ "create table bind_misccoltypes_errs_tab (
id number,
char_t char(1),
char_t10 char(10),
@@ -108,7 +108,7 @@ check_col($c, 'varchar2_t10', 7);
// Clean up
$stmtarray = array(
- "drop table bind_misccoltypes_errs_tab"
+ "drop table bind_misccoltypes_errs_tab"
);
oci8_test_sql_execute($c, $stmtarray);
@@ -116,8 +116,6 @@ oci8_test_sql_execute($c, $stmtarray);
oci_close($c);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Test 1 insert numbers
@@ -166,4 +164,3 @@ array(1) {
array(0) {
}
}
-===DONE===
diff --git a/ext/oci8/tests/bind_number.phpt b/ext/oci8/tests/bind_number.phpt
index 429bbe0ef7..851f2da605 100644
--- a/ext/oci8/tests/bind_number.phpt
+++ b/ext/oci8/tests/bind_number.phpt
@@ -14,26 +14,26 @@ require(__DIR__.'/connect.inc');
// Initialization
$stmtarray = array(
- "drop table bind_number_tab",
- "create table bind_number_tab (
- id number,
- number_t6 number(6),
- float_t float,
- binary_float_t binary_float,
- binary_double_t binary_double,
- decimal_t decimal,
- integer_t integer)"
+ "drop table bind_number_tab",
+ "create table bind_number_tab (
+ id number,
+ number_t6 number(6),
+ float_t float,
+ binary_float_t binary_float,
+ binary_double_t binary_double,
+ decimal_t decimal,
+ integer_t integer)"
);
oci8_test_sql_execute($c, $stmtarray);
function check_col($c, $colname, $id)
{
- $s = oci_parse($c, "select $colname from bind_number_tab where id = :id");
- oci_bind_by_name($s, ":id", $id);
- oci_execute($s);
- oci_fetch_all($s, $r);
- var_dump($r);
+ $s = oci_parse($c, "select $colname from bind_number_tab where id = :id");
+ oci_bind_by_name($s, ":id", $id);
+ oci_execute($s);
+ oci_fetch_all($s, $r);
+ var_dump($r);
}
// Run Test
@@ -123,14 +123,12 @@ check_col($c, 'integer_t', 76);
// Clean up
$stmtarray = array(
- "drop table bind_number_tab"
+ "drop table bind_number_tab"
);
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Test 1 - invalid number
@@ -212,4 +210,3 @@ array(1) {
string(2) "42"
}
}
-===DONE===
diff --git a/ext/oci8/tests/bind_query.phpt b/ext/oci8/tests/bind_query.phpt
index 12e58d3e33..9c1fa3d8d1 100644
--- a/ext/oci8/tests/bind_query.phpt
+++ b/ext/oci8/tests/bind_query.phpt
@@ -10,10 +10,10 @@ require(__DIR__.'/connect.inc');
// Initialization
$stmtarray = array(
- "drop table bind_query_tab",
- "create table bind_query_tab (empno number(4), ename varchar2(10), sal number(7,2))",
- "insert into bind_query_tab values (7934, 'MILLER', 1300)",
- "insert into bind_query_tab values (7902, 'FORD', 3000)"
+ "drop table bind_query_tab",
+ "create table bind_query_tab (empno number(4), ename varchar2(10), sal number(7,2))",
+ "insert into bind_query_tab values (7934, 'MILLER', 1300)",
+ "insert into bind_query_tab values (7902, 'FORD', 3000)"
);
oci8_test_sql_execute($c, $stmtarray);
@@ -56,14 +56,12 @@ while (oci_fetch($s)) {
// Clean up
$stmtarray = array(
- "drop table bind_query_tab"
+ "drop table bind_query_tab"
);
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Test 1
array(1) {
@@ -75,4 +73,3 @@ string(4) "FORD"
string(6) "MILLER"
Test 3
string(4) "FORD"
-===DONE===
diff --git a/ext/oci8/tests/bind_rowid.phpt b/ext/oci8/tests/bind_rowid.phpt
index 40e5b5e90e..1652326356 100644
--- a/ext/oci8/tests/bind_rowid.phpt
+++ b/ext/oci8/tests/bind_rowid.phpt
@@ -9,19 +9,19 @@ require(__DIR__."/connect.inc");
function do_query($c)
{
- $s = oci_parse($c, 'select address from rid_tab order by id');
- $id = 1;
- oci_execute($s, OCI_DEFAULT);
- while ($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) {
- var_dump($row);
- }
+ $s = oci_parse($c, 'select address from rid_tab order by id');
+ $id = 1;
+ oci_execute($s, OCI_DEFAULT);
+ while ($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) {
+ var_dump($row);
+ }
}
$stmtarray = array(
- "drop table rid_tab",
- "create table rid_tab (id number, address varchar2(40))",
- "insert into rid_tab (id, address) values (1, 'original text #1')",
- "insert into rid_tab (id, address) values (2, 'original text #2')"
+ "drop table rid_tab",
+ "create table rid_tab (id number, address varchar2(40))",
+ "insert into rid_tab (id, address) values (1, 'original text #1')",
+ "insert into rid_tab (id, address) values (2, 'original text #2')"
);
oci8_test_sql_execute($c, $stmtarray);
diff --git a/ext/oci8/tests/bind_sqltafc.phpt b/ext/oci8/tests/bind_sqltafc.phpt
index 90bd38f445..8b4fea93bf 100644
--- a/ext/oci8/tests/bind_sqltafc.phpt
+++ b/ext/oci8/tests/bind_sqltafc.phpt
@@ -10,9 +10,9 @@ require(__DIR__.'/connect.inc');
// Initialization
$stmtarray = array(
- "drop table bind_sqltafc_tab",
- "create table bind_sqltafc_tab (id number, char_t char(1), char_t10 char(10), varchar2_t10 varchar2(10), number_t number)",
- "insert into bind_sqltafc_tab values (0, 'a', 'abcd', 'efghij', 1.1)"
+ "drop table bind_sqltafc_tab",
+ "create table bind_sqltafc_tab (id number, char_t char(1), char_t10 char(10), varchar2_t10 varchar2(10), number_t number)",
+ "insert into bind_sqltafc_tab values (0, 'a', 'abcd', 'efghij', 1.1)"
);
oci8_test_sql_execute($c, $stmtarray);
@@ -79,7 +79,7 @@ q($c, 6);
// Clean up
$stmtarray = array(
- "drop table bind_sqltafc_tab"
+ "drop table bind_sqltafc_tab"
);
oci8_test_sql_execute($c, $stmtarray);
@@ -87,8 +87,6 @@ oci8_test_sql_execute($c, $stmtarray);
oci_close($c);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Test 0 - base table creation without binds
array(5) {
@@ -205,4 +203,3 @@ array(5) {
NULL
}
}
-===DONE===
diff --git a/ext/oci8/tests/bind_sqltchr_1.phpt b/ext/oci8/tests/bind_sqltchr_1.phpt
index b8c460ca79..0ef7274498 100644
--- a/ext/oci8/tests/bind_sqltchr_1.phpt
+++ b/ext/oci8/tests/bind_sqltchr_1.phpt
@@ -133,8 +133,6 @@ $stmtarray = array(
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
TEST241 bind SQLT_CHR
array(1) {
@@ -225,4 +223,3 @@ array(1) {
NULL
}
}
-===DONE===
diff --git a/ext/oci8/tests/bind_sqltchr_2.phpt b/ext/oci8/tests/bind_sqltchr_2.phpt
index fae96d8925..d054d21f57 100644
--- a/ext/oci8/tests/bind_sqltchr_2.phpt
+++ b/ext/oci8/tests/bind_sqltchr_2.phpt
@@ -41,10 +41,7 @@ $stmtarray = array(
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Test 1 - PL/SQL IN and OUT variables
string(22) "Cat got your keyboard?"
string(22) "CAT GOT YOUR KEYBOARD?"
-===DONE===
diff --git a/ext/oci8/tests/bind_sqltint.phpt b/ext/oci8/tests/bind_sqltint.phpt
index 0924652155..a25265f90a 100644
--- a/ext/oci8/tests/bind_sqltint.phpt
+++ b/ext/oci8/tests/bind_sqltint.phpt
@@ -10,7 +10,7 @@ require(__DIR__.'/connect.inc');
// Initialization
$stmtarray = array(
- "drop table bind_sqltint_tab",
+ "drop table bind_sqltint_tab",
"create table bind_sqltint_tab (
id number,
@@ -208,14 +208,12 @@ var_dump($p2);
// Clean up
$stmtarray = array(
- "drop table bind_sqltint_tab"
+ "drop table bind_sqltint_tab"
);
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
TEST141 wrong bind type SQLT_INT
array(1) {
@@ -333,4 +331,3 @@ int(4444)
TEST159
int(5555)
-===DONE===
diff --git a/ext/oci8/tests/bind_sqltnum.phpt b/ext/oci8/tests/bind_sqltnum.phpt
index b8742ee8a8..3f8e371ea3 100644
--- a/ext/oci8/tests/bind_sqltnum.phpt
+++ b/ext/oci8/tests/bind_sqltnum.phpt
@@ -16,7 +16,7 @@ require(__DIR__.'/connect.inc');
// Initialization
$stmtarray = array(
- "drop table bind_sqltnum_tab",
+ "drop table bind_sqltnum_tab",
"create table bind_sqltnum_tab (
id number,
@@ -165,14 +165,12 @@ check_col($c, 'number_t92', 50);
// Clean up
$stmtarray = array(
- "drop table bind_sqltnum_tab"
+ "drop table bind_sqltnum_tab"
);
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Test 1 - baseline test
array(2) {
@@ -276,4 +274,3 @@ array(1) {
array(0) {
}
}
-===DONE===
diff --git a/ext/oci8/tests/bind_sqltnum_11g.phpt b/ext/oci8/tests/bind_sqltnum_11g.phpt
index 7ef1549120..3686127fbc 100644
--- a/ext/oci8/tests/bind_sqltnum_11g.phpt
+++ b/ext/oci8/tests/bind_sqltnum_11g.phpt
@@ -16,7 +16,7 @@ require(__DIR__.'/connect.inc');
// Initialization
$stmtarray = array(
- "drop table bind_sqltnum_tab",
+ "drop table bind_sqltnum_tab",
"create table bind_sqltnum_tab (
id number,
@@ -165,14 +165,12 @@ check_col($c, 'number_t92', 50);
// Clean up
$stmtarray = array(
- "drop table bind_sqltnum_tab"
+ "drop table bind_sqltnum_tab"
);
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Test 1 - baseline test
array(2) {
@@ -276,4 +274,3 @@ array(1) {
array(0) {
}
}
-===DONE===
diff --git a/ext/oci8/tests/bind_unsupported_1.phpt b/ext/oci8/tests/bind_unsupported_1.phpt
index f8ae599c42..84ff5ca7db 100644
--- a/ext/oci8/tests/bind_unsupported_1.phpt
+++ b/ext/oci8/tests/bind_unsupported_1.phpt
@@ -31,8 +31,6 @@ foreach ($types as $t => $v) {
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Test - SQLT_AVC
@@ -55,4 +53,3 @@ Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 68 in %sbind
Test - SQLT_ODT
Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 156 in %sbind_unsupported_1.php on line %d
-===DONE===
diff --git a/ext/oci8/tests/bind_unsupported_2.phpt b/ext/oci8/tests/bind_unsupported_2.phpt
index fefd57d148..e82154a6ad 100644
--- a/ext/oci8/tests/bind_unsupported_2.phpt
+++ b/ext/oci8/tests/bind_unsupported_2.phpt
@@ -24,8 +24,6 @@ foreach ($types as $t => $v) {
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Test - SQLT_BDOUBLE
@@ -33,4 +31,3 @@ Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 22 in %sbind
Test - SQLT_BFLOAT
Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 21 in %sbind_unsupported_2.php on line %d
-===DONE===
diff --git a/ext/oci8/tests/bind_unsupported_3.phpt b/ext/oci8/tests/bind_unsupported_3.phpt
index 4fe9e0819c..27d1b20949 100644
--- a/ext/oci8/tests/bind_unsupported_3.phpt
+++ b/ext/oci8/tests/bind_unsupported_3.phpt
@@ -27,8 +27,6 @@ foreach ($types as $t => $v) {
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Test - SQLT_CLOB
@@ -42,4 +40,3 @@ Warning: oci_bind_by_name(): Unable to find descriptor property in %sbind_unsupp
Test - OCI_B_BLOB
Warning: oci_bind_by_name(): Unable to find descriptor property in %sbind_unsupported_3.php on line %d
-===DONE===
diff --git a/ext/oci8/tests/bug27303_1.phpt b/ext/oci8/tests/bug27303_1.phpt
index 6310185b7f..a0e254a753 100644
--- a/ext/oci8/tests/bug27303_1.phpt
+++ b/ext/oci8/tests/bug27303_1.phpt
@@ -37,9 +37,9 @@ $r = OCIBindByName($stid, ':MYBV', $mybv);
if (!$r) { echo "Bind error"; die; }
for ($i = 1; $i < MYLIMIT; $i++) {
- $r = OCIExecute($stid, OCI_DEFAULT);
- if (!$r) { echo "Execute error"; die; }
- var_dump($mybv);
+ $r = OCIExecute($stid, OCI_DEFAULT);
+ if (!$r) { echo "Execute error"; die; }
+ var_dump($mybv);
}
OCICommit($c);
diff --git a/ext/oci8/tests/bug27303_1_11gR1.phpt b/ext/oci8/tests/bug27303_1_11gR1.phpt
index 1c9296bef8..35495a81da 100644
--- a/ext/oci8/tests/bug27303_1_11gR1.phpt
+++ b/ext/oci8/tests/bug27303_1_11gR1.phpt
@@ -35,9 +35,9 @@ $r = OCIBindByName($stid, ':MYBV', $mybv);
if (!$r) { echo "Bind error"; die; }
for ($i = 1; $i < MYLIMIT; $i++) {
- $r = OCIExecute($stid, OCI_DEFAULT);
- if (!$r) { echo "Execute error"; die; }
- var_dump($mybv);
+ $r = OCIExecute($stid, OCI_DEFAULT);
+ if (!$r) { echo "Execute error"; die; }
+ var_dump($mybv);
}
OCICommit($c);
diff --git a/ext/oci8/tests/bug27303_2.phpt b/ext/oci8/tests/bug27303_2.phpt
index 039f0e4acc..3674b72486 100644
--- a/ext/oci8/tests/bug27303_2.phpt
+++ b/ext/oci8/tests/bug27303_2.phpt
@@ -39,9 +39,9 @@ $r = OCIBindByName($stid, ':MYBV', $mybv);
if (!$r) { echo "Bind error"; die; }
for ($i = 1; $i < MYLIMIT; $i++) {
- $r = OCIExecute($stid, OCI_DEFAULT);
- if (!$r) { echo "Execute error"; die; }
- var_dump($mybv);
+ $r = OCIExecute($stid, OCI_DEFAULT);
+ if (!$r) { echo "Execute error"; die; }
+ var_dump($mybv);
}
OCICommit($c);
diff --git a/ext/oci8/tests/bug27303_2_11gR1.phpt b/ext/oci8/tests/bug27303_2_11gR1.phpt
index 4c9a175edd..1abb66538a 100644
--- a/ext/oci8/tests/bug27303_2_11gR1.phpt
+++ b/ext/oci8/tests/bug27303_2_11gR1.phpt
@@ -39,9 +39,9 @@ $r = OCIBindByName($stid, ':MYBV', $mybv);
if (!$r) { echo "Bind error"; die; }
for ($i = 1; $i < MYLIMIT; $i++) {
- $r = OCIExecute($stid, OCI_DEFAULT);
- if (!$r) { echo "Execute error"; die; }
- var_dump($mybv);
+ $r = OCIExecute($stid, OCI_DEFAULT);
+ if (!$r) { echo "Execute error"; die; }
+ var_dump($mybv);
}
OCICommit($c);
diff --git a/ext/oci8/tests/bug27303_3.phpt b/ext/oci8/tests/bug27303_3.phpt
index dfc85e08b7..347a1a93d9 100644
--- a/ext/oci8/tests/bug27303_3.phpt
+++ b/ext/oci8/tests/bug27303_3.phpt
@@ -14,8 +14,8 @@ $create_st[] = "create sequence myseq";
$create_st[] = "create table mytab (mydata varchar2(20), seqcol number)";
foreach ($create_st as $statement) {
- $stmt = oci_parse($c, $statement);
- @oci_execute($stmt);
+ $stmt = oci_parse($c, $statement);
+ @oci_execute($stmt);
}
define('MYLIMIT', 200);
@@ -31,9 +31,9 @@ $r = OCIBindByName($stid, ':MYBV', $mybv, 5, SQLT_INT);
if (!$r) { echo "Bind error"; die; }
for ($i = 1; $i < MYLIMIT; $i++) {
- $r = OCIExecute($stid, OCI_DEFAULT);
- if (!$r) { echo "Execute error"; die; }
- var_dump($mybv);
+ $r = OCIExecute($stid, OCI_DEFAULT);
+ if (!$r) { echo "Execute error"; die; }
+ var_dump($mybv);
}
OCICommit($c);
@@ -43,8 +43,8 @@ $drop_st[] = "drop sequence myseq";
$drop_st[] = "drop table mytab";
foreach ($create_st as $statement) {
- $stmt = oci_parse($c, $statement);
- oci_execute($stmt);
+ $stmt = oci_parse($c, $statement);
+ oci_execute($stmt);
}
echo "Done\n";
diff --git a/ext/oci8/tests/bug27303_4.phpt b/ext/oci8/tests/bug27303_4.phpt
index 5ee7090428..e51f3cdc75 100644
--- a/ext/oci8/tests/bug27303_4.phpt
+++ b/ext/oci8/tests/bug27303_4.phpt
@@ -36,9 +36,9 @@ $r = OCIBindByName($stid, ':MYBV', $mybv, 0 );
if (!$r) { echo "Bind error"; die; }
for ($i = 1; $i < MYLIMIT; $i++) {
- $r = OCIExecute($stid, OCI_DEFAULT);
- if (!$r) { echo "Execute error"; die; }
- var_dump($mybv);
+ $r = OCIExecute($stid, OCI_DEFAULT);
+ if (!$r) { echo "Execute error"; die; }
+ var_dump($mybv);
}
OCICommit($c);
diff --git a/ext/oci8/tests/bug27303_4_11gR1.phpt b/ext/oci8/tests/bug27303_4_11gR1.phpt
index 290f26d764..bd5e2571fc 100644
--- a/ext/oci8/tests/bug27303_4_11gR1.phpt
+++ b/ext/oci8/tests/bug27303_4_11gR1.phpt
@@ -34,9 +34,9 @@ $r = OCIBindByName($stid, ':MYBV', $mybv, 0 );
if (!$r) { echo "Bind error"; die; }
for ($i = 1; $i < MYLIMIT; $i++) {
- $r = OCIExecute($stid, OCI_DEFAULT);
- if (!$r) { echo "Execute error"; die; }
- var_dump($mybv);
+ $r = OCIExecute($stid, OCI_DEFAULT);
+ if (!$r) { echo "Execute error"; die; }
+ var_dump($mybv);
}
OCICommit($c);
diff --git a/ext/oci8/tests/bug32325.phpt b/ext/oci8/tests/bug32325.phpt
index 1dbe8cc6ce..3665f01edc 100644
--- a/ext/oci8/tests/bug32325.phpt
+++ b/ext/oci8/tests/bug32325.phpt
@@ -23,8 +23,8 @@ oci8_test_sql_execute($c, $stmtarray);
$collection = oci_new_collection($c, "BUG32325_T");
$sql = "begin
- select bug32325_t(1,2,3,4) into :list from dual;
- end;";
+ select bug32325_t(1,2,3,4) into :list from dual;
+ end;";
$stmt = oci_parse($c, $sql);
diff --git a/ext/oci8/tests/bug36010.phpt b/ext/oci8/tests/bug36010.phpt
index 83288dd355..0947d3f6fb 100644
--- a/ext/oci8/tests/bug36010.phpt
+++ b/ext/oci8/tests/bug36010.phpt
@@ -12,11 +12,11 @@ require __DIR__.'/connect.inc';
function f($conn)
{
- $sql = "begin :p_clob := 'lob string'; end;";
- $stid = oci_parse($conn, $sql);
- $clob = oci_new_descriptor($conn, OCI_D_LOB);
- oci_bind_by_name($stid, ":p_clob", $clob, -1, OCI_B_CLOB);
- $r = oci_execute($stid, OCI_DEFAULT);
+ $sql = "begin :p_clob := 'lob string'; end;";
+ $stid = oci_parse($conn, $sql);
+ $clob = oci_new_descriptor($conn, OCI_D_LOB);
+ oci_bind_by_name($stid, ":p_clob", $clob, -1, OCI_B_CLOB);
+ $r = oci_execute($stid, OCI_DEFAULT);
}
f($c);
diff --git a/ext/oci8/tests/bug36096.phpt b/ext/oci8/tests/bug36096.phpt
index 1cf5e9106c..eba558e08c 100644
--- a/ext/oci8/tests/bug36096.phpt
+++ b/ext/oci8/tests/bug36096.phpt
@@ -11,10 +11,10 @@ $sql = "SELECT 'ABC' FROM DUAL WHERE 1<>1";
$stmt = oci_parse($c, $sql);
if(oci_execute($stmt, OCI_COMMIT_ON_SUCCESS)){
- var_dump(oci_fetch($stmt));
- var_dump(oci_result($stmt, 1));
- var_dump(oci_field_name($stmt, 1));
- var_dump(oci_field_type($stmt, 1));
+ var_dump(oci_fetch($stmt));
+ var_dump(oci_result($stmt, 1));
+ var_dump(oci_field_name($stmt, 1));
+ var_dump(oci_field_type($stmt, 1));
}
echo "Done\n";
diff --git a/ext/oci8/tests/bug36403.phpt b/ext/oci8/tests/bug36403.phpt
index 0f3b53b923..60819aa423 100644
--- a/ext/oci8/tests/bug36403.phpt
+++ b/ext/oci8/tests/bug36403.phpt
@@ -12,8 +12,8 @@ require(__DIR__.'/connect.inc');
// Initialization
$stmtarray = array(
- "drop table bug36403_tab",
- "create table bug36403_tab (c1 number, col2 number, column3 number, col4 number)"
+ "drop table bug36403_tab",
+ "create table bug36403_tab (c1 number, col2 number, column3 number, col4 number)"
);
oci8_test_sql_execute($c, $stmtarray);
@@ -25,7 +25,7 @@ echo "Test 1\n";
$s = oci_parse($c, "select * from bug36403_tab");
oci_execute($s, OCI_DESCRIBE_ONLY);
for ($i = oci_num_fields($s); $i > 0; $i--) {
- echo oci_field_name($s, $i) . "\n";
+ echo oci_field_name($s, $i) . "\n";
}
echo "Test 2\n";
@@ -37,14 +37,12 @@ $row = oci_fetch_array($s);
// Clean up
$stmtarray = array(
- "drop table bug36403_tab"
+ "drop table bug36403_tab"
);
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Test 1
COL4
@@ -54,4 +52,3 @@ C1
Test 2
Warning: oci_fetch_array(): ORA-%r(24338|01002)%r: %sbug36403.php on line %d
-===DONE===
diff --git a/ext/oci8/tests/bug37220.phpt b/ext/oci8/tests/bug37220.phpt
index 11ee2b23b6..ce0ac0a503 100644
--- a/ext/oci8/tests/bug37220.phpt
+++ b/ext/oci8/tests/bug37220.phpt
@@ -13,8 +13,8 @@ require __DIR__.'/connect.inc';
// Initialization
$stmtarray = array(
- "create table bug37220_tab( mycolumn xmltype not null)",
- "insert into bug37220_tab values(xmltype('<THETAG myID=\"1234\"></THETAG>'))"
+ "create table bug37220_tab( mycolumn xmltype not null)",
+ "insert into bug37220_tab values(xmltype('<THETAG myID=\"1234\"></THETAG>'))"
);
oci8_test_sql_execute($c, $stmtarray);
@@ -24,8 +24,8 @@ oci8_test_sql_execute($c, $stmtarray);
// bug37220_tab a normal Oracle table)
$query = "UPDATE bug37220_tab
- SET bug37220_tab.mycolumn = updateXML(bug37220_tab.mycolumn,'/THETAG',xmltype.createXML(:data))
- WHERE existsNode(bug37220_tab.mycolumn,'/THETAG[@myID=\"1234\"]') = 1";
+ SET bug37220_tab.mycolumn = updateXML(bug37220_tab.mycolumn,'/THETAG',xmltype.createXML(:data))
+ WHERE existsNode(bug37220_tab.mycolumn,'/THETAG[@myID=\"1234\"]') = 1";
$stmt = oci_parse ($c, $query);
$clob = oci_new_descriptor($c, OCI_D_LOB);
oci_bind_by_name($stmt, ':data', $clob, -1, OCI_B_CLOB);
@@ -42,16 +42,16 @@ $stmt = oci_parse ($c, $query);
oci_execute($stmt);
while ($row = oci_fetch_array($stmt, OCI_ASSOC+OCI_RETURN_NULLS)) {
- foreach ($row as $item) {
- echo trim($item)."\n";
- }
- echo "\n";
+ foreach ($row as $item) {
+ echo trim($item)."\n";
+ }
+ echo "\n";
}
// Cleanup
$stmtarray = array(
- "drop table bug37220_tab"
+ "drop table bug37220_tab"
);
oci8_test_sql_execute($c, $stmtarray);
diff --git a/ext/oci8/tests/bug38173.phpt b/ext/oci8/tests/bug38173.phpt
index 2d4cb7c33b..087e6a7485 100644
--- a/ext/oci8/tests/bug38173.phpt
+++ b/ext/oci8/tests/bug38173.phpt
@@ -26,15 +26,15 @@ oci_execute($s1);
oci_execute($s2);
for($i=0; $i < 5; $i++) {
- $insert = "INSERT INTO t1 VALUES(".$i.")";
- $s = oci_parse($c, $insert);
- oci_execute($s);
+ $insert = "INSERT INTO t1 VALUES(".$i.")";
+ $s = oci_parse($c, $insert);
+ oci_execute($s);
}
for($i=0; $i < 5; $i++) {
- $insert = "INSERT INTO t2 VALUES(".$i.")";
- $s = oci_parse($c, $insert);
- oci_execute($s);
+ $insert = "INSERT INTO t2 VALUES(".$i.")";
+ $s = oci_parse($c, $insert);
+ oci_execute($s);
}
$query ="
diff --git a/ext/oci8/tests/bug41069.phpt b/ext/oci8/tests/bug41069.phpt
index af322ba7d1..49d2905a4d 100644
--- a/ext/oci8/tests/bug41069.phpt
+++ b/ext/oci8/tests/bug41069.phpt
@@ -10,46 +10,46 @@ if ($test_drcp) die("skip DRCP does not support shared database links");
--INI--
oci8.default_prefetch=5
--FILE--
- <?php
+ <?php
- require(__DIR__.'/connect.inc');
+ require(__DIR__.'/connect.inc');
// Initialization
$stmtarray = array(
- "alter session set nls_date_format = 'MM/DD/YYYY'",
+ "alter session set nls_date_format = 'MM/DD/YYYY'",
- "drop database link bug41069_dblink",
+ "drop database link bug41069_dblink",
- "drop table bug41069_tab",
+ "drop table bug41069_tab",
- "create shared database link bug41069_dblink authenticated by $user identified by $password using '$dbase'",
+ "create shared database link bug41069_dblink authenticated by $user identified by $password using '$dbase'",
- "create table bug41069_tab
- (
- c1 number(20),
- c2 varchar2(60 byte),
- c3 varchar2(1000 byte),
- c4 varchar2(255 byte),
- c5 varchar2(2 byte),
- c6 varchar2(1 byte),
- c7 varchar2(255 byte),
- c8 varchar2(50 byte),
- c9 date,
- c10 date,
- c12 number(20),
- c13 varchar2(20 byte),
- c15 varchar2(50 byte)
- )",
+ "create table bug41069_tab
+ (
+ c1 number(20),
+ c2 varchar2(60 byte),
+ c3 varchar2(1000 byte),
+ c4 varchar2(255 byte),
+ c5 varchar2(2 byte),
+ c6 varchar2(1 byte),
+ c7 varchar2(255 byte),
+ c8 varchar2(50 byte),
+ c9 date,
+ c10 date,
+ c12 number(20),
+ c13 varchar2(20 byte),
+ c15 varchar2(50 byte)
+ )",
- "insert into bug41069_tab (c1, c2, c5, c6, c9, c10, c12, c15) values
- (111, 'aaaaaaa', 'b', 'c', '01/17/2008', '01/07/2017', 2222, 'zzzzzzzzzz')",
+ "insert into bug41069_tab (c1, c2, c5, c6, c9, c10, c12, c15) values
+ (111, 'aaaaaaa', 'b', 'c', '01/17/2008', '01/07/2017', 2222, 'zzzzzzzzzz')",
- "insert into bug41069_tab (c1, c2, c3, c4, c5, c6, c7, c9, c10, c12, c13, c15) values
- (112, 'aaaaaaa', 'bbbbbbbb', 'ccccccc', 'd', 'e', 'rrrrrrr', '04/16/2007', '04/16/2007', 2223, 'xxxxxxxx', 'zzzzzzzz')",
+ "insert into bug41069_tab (c1, c2, c3, c4, c5, c6, c7, c9, c10, c12, c13, c15) values
+ (112, 'aaaaaaa', 'bbbbbbbb', 'ccccccc', 'd', 'e', 'rrrrrrr', '04/16/2007', '04/16/2007', 2223, 'xxxxxxxx', 'zzzzzzzz')",
- "insert into bug41069_tab (c1, c2, c3, c4, c5, c6, c7, c9, c10, c12, c15) values
- (113, 'aaaaaaa', 'bbbbbbbbbb', 'cccccc', 'e', 'f', 'dddd', '12/04/2006', '12/04/2006', 2224, 'zzzzzzz')"
+ "insert into bug41069_tab (c1, c2, c3, c4, c5, c6, c7, c9, c10, c12, c15) values
+ (113, 'aaaaaaa', 'bbbbbbbbbb', 'cccccc', 'e', 'f', 'dddd', '12/04/2006', '12/04/2006', 2224, 'zzzzzzz')"
);
oci8_test_sql_execute($c, $stmtarray);
@@ -74,8 +74,8 @@ var_dump($results);
$c = oci_new_connect($user, $password, $dbase);
$stmtarray = array(
- "drop database link bug41069_dblink",
- "drop table bug41069_tab"
+ "drop database link bug41069_dblink",
+ "drop table bug41069_tab"
);
oci8_test_sql_execute($c, $stmtarray);
diff --git a/ext/oci8/tests/bug42134.phpt b/ext/oci8/tests/bug42134.phpt
index d1e0b97c84..13273cff8f 100644
--- a/ext/oci8/tests/bug42134.phpt
+++ b/ext/oci8/tests/bug42134.phpt
@@ -13,49 +13,49 @@ require(__DIR__.'/details.inc');
// Test collection creation error for normal connection
if (!empty($dbase)) {
- $c = oci_connect($user,$password,$dbase);
+ $c = oci_connect($user,$password,$dbase);
}
else {
- $c = oci_connect($user,$password);
+ $c = oci_connect($user,$password);
}
$collection = oci_new_collection($c, "ABC");
if (!$collection) {
- echo "Normal connection: New Collection error\n";
- $m = oci_error($c);
- var_dump($m);
+ echo "Normal connection: New Collection error\n";
+ $m = oci_error($c);
+ var_dump($m);
}
// Test collection creation error for new connection
if (!empty($dbase)) {
- $c = oci_new_connect($user,$password,$dbase);
+ $c = oci_new_connect($user,$password,$dbase);
}
else {
- $c = oci_new_connect($user,$password);
+ $c = oci_new_connect($user,$password);
}
$collection = oci_new_collection($c, "DEF");
if (!$collection) {
- echo "New connection: New Collection error\n";
- $m = oci_error($c);
- var_dump($m);
+ echo "New connection: New Collection error\n";
+ $m = oci_error($c);
+ var_dump($m);
}
// Test collection creation error for persistent connection
if (!empty($dbase)) {
- $c = oci_pconnect($user,$password,$dbase);
+ $c = oci_pconnect($user,$password,$dbase);
}
else {
- $c = oci_pconnect($user,$password);
+ $c = oci_pconnect($user,$password);
}
$collection = oci_new_collection($c, "GHI");
if (!$collection) {
- echo "Persistent connection: New Collection error\n";
- $m = oci_error($c);
- var_dump($m);
+ echo "Persistent connection: New Collection error\n";
+ $m = oci_error($c);
+ var_dump($m);
}
echo "Done\n";
diff --git a/ext/oci8/tests/bug42173.phpt b/ext/oci8/tests/bug42173.phpt
index 33e1adaae4..9c6b4996e2 100644
--- a/ext/oci8/tests/bug42173.phpt
+++ b/ext/oci8/tests/bug42173.phpt
@@ -38,8 +38,8 @@ interval'1 2:20:20.123' day to second,
interval'1 2:20:20.12345' day to second)");
foreach ($stmts as $sql) {
- $s = oci_parse($c, $sql);
- $r = @oci_execute($s);
+ $s = oci_parse($c, $sql);
+ $r = @oci_execute($s);
}
$s = oci_parse($c, "select * from ts_test");
@@ -48,14 +48,14 @@ $row = oci_fetch_array($s, OCI_ASSOC);
var_dump($row);
foreach ($row as $name => $field) {
- echo "\nColumn $name\n";
- var_dump(oci_field_is_null($s, $name));
- var_dump(oci_field_name($s, $name));
- var_dump(oci_field_type($s, $name));
- var_dump(oci_field_type_raw($s, $name));
- var_dump(oci_field_scale($s, $name));
- var_dump(oci_field_precision($s, $name));
- var_dump(oci_field_size($s, $name));
+ echo "\nColumn $name\n";
+ var_dump(oci_field_is_null($s, $name));
+ var_dump(oci_field_name($s, $name));
+ var_dump(oci_field_type($s, $name));
+ var_dump(oci_field_type_raw($s, $name));
+ var_dump(oci_field_scale($s, $name));
+ var_dump(oci_field_precision($s, $name));
+ var_dump(oci_field_size($s, $name));
}
// Cleanup
diff --git a/ext/oci8/tests/bug42496_1.phpt b/ext/oci8/tests/bug42496_1.phpt
index b3d6cf0203..9db7d720e9 100644
--- a/ext/oci8/tests/bug42496_1.phpt
+++ b/ext/oci8/tests/bug42496_1.phpt
@@ -14,11 +14,11 @@ require __DIR__.'/connect.inc';
// Initialization
$stmtarray = array(
- "DROP table bug42496_1_tab",
- "CREATE table bug42496_1_tab(c1 CLOB, c2 CLOB)",
- "INSERT INTO bug42496_1_tab VALUES('test1', 'test1')",
- "INSERT INTO bug42496_1_tab VALUES('test2', 'test2')",
- "INSERT INTO bug42496_1_tab VALUES('test3', 'test3')"
+ "DROP table bug42496_1_tab",
+ "CREATE table bug42496_1_tab(c1 CLOB, c2 CLOB)",
+ "INSERT INTO bug42496_1_tab VALUES('test1', 'test1')",
+ "INSERT INTO bug42496_1_tab VALUES('test2', 'test2')",
+ "INSERT INTO bug42496_1_tab VALUES('test3', 'test3')"
);
oci8_test_sql_execute($c, $stmtarray);
@@ -28,17 +28,17 @@ oci8_test_sql_execute($c, $stmtarray);
echo "Test 1\n";
for ($i = 0; $i < 15000; $i++) {
- $s = oci_parse($c, "SELECT * from bug42496_1_tab");
- oci_define_by_name($s, "C1", $col1);
- oci_define_by_name($s, "C2", $col2);
- if (oci_execute($s)) {
- $arr = array();
- while ($arr = oci_fetch_assoc($s)) {
- $arr['C1']->free();
- $arr['C2']->free();
- }
- }
- oci_free_statement($s);
+ $s = oci_parse($c, "SELECT * from bug42496_1_tab");
+ oci_define_by_name($s, "C1", $col1);
+ oci_define_by_name($s, "C2", $col2);
+ if (oci_execute($s)) {
+ $arr = array();
+ while ($arr = oci_fetch_assoc($s)) {
+ $arr['C1']->free();
+ $arr['C2']->free();
+ }
+ }
+ oci_free_statement($s);
}
echo "Done\n";
@@ -46,7 +46,7 @@ echo "Done\n";
// Cleanup
$stmtarray = array(
- "DROP table bug42496_1_tab"
+ "DROP table bug42496_1_tab"
);
oci8_test_sql_execute($c, $stmtarray);
diff --git a/ext/oci8/tests/bug42496_2.phpt b/ext/oci8/tests/bug42496_2.phpt
index bcb4076601..52c42f8bcf 100644
--- a/ext/oci8/tests/bug42496_2.phpt
+++ b/ext/oci8/tests/bug42496_2.phpt
@@ -14,11 +14,11 @@ require __DIR__.'/connect.inc';
// Initialization
$stmtarray = array(
- "DROP table bug42496_2_tab",
- "CREATE table bug42496_2_tab(c1 CLOB, c2 CLOB)",
- "INSERT INTO bug42496_2_tab VALUES('test1', 'test1')",
- "INSERT INTO bug42496_2_tab VALUES('test2', 'test2')",
- "INSERT INTO bug42496_2_tab VALUES('test3', 'test3')"
+ "DROP table bug42496_2_tab",
+ "CREATE table bug42496_2_tab(c1 CLOB, c2 CLOB)",
+ "INSERT INTO bug42496_2_tab VALUES('test1', 'test1')",
+ "INSERT INTO bug42496_2_tab VALUES('test2', 'test2')",
+ "INSERT INTO bug42496_2_tab VALUES('test3', 'test3')"
);
oci8_test_sql_execute($c, $stmtarray);
@@ -28,15 +28,15 @@ oci8_test_sql_execute($c, $stmtarray);
echo "Test 2\n";
for ($i = 0; $i < 15000; $i++) {
- $s = oci_parse($c, "SELECT * from bug42496_2_tab");
- if (oci_execute($s)) {
- $arr = array();
- while ($arr = oci_fetch_assoc($s)) {
- $arr['C1']->free();
- $arr['C2']->free();
- }
- }
- oci_free_statement($s);
+ $s = oci_parse($c, "SELECT * from bug42496_2_tab");
+ if (oci_execute($s)) {
+ $arr = array();
+ while ($arr = oci_fetch_assoc($s)) {
+ $arr['C1']->free();
+ $arr['C2']->free();
+ }
+ }
+ oci_free_statement($s);
}
echo "Done\n";
@@ -44,7 +44,7 @@ echo "Done\n";
// Cleanup
$stmtarray = array(
- "DROP table bug42496_2_tab"
+ "DROP table bug42496_2_tab"
);
oci8_test_sql_execute($c, $stmtarray);
diff --git a/ext/oci8/tests/bug43497.phpt b/ext/oci8/tests/bug43497.phpt
index 29ff9e6a5c..45325f6b44 100644
--- a/ext/oci8/tests/bug43497.phpt
+++ b/ext/oci8/tests/bug43497.phpt
@@ -18,8 +18,8 @@ function sessionid($c) // determines and returns current session ID
$stmt = oci_parse($c, $query);
if (oci_execute($stmt, OCI_DEFAULT)) {
- $row = oci_fetch($stmt);
- return oci_result($stmt, 1);
+ $row = oci_fetch($stmt);
+ return oci_result($stmt, 1);
}
return null;
@@ -33,10 +33,10 @@ function templobs($c, $sid) // returns number of temporary LOBs
$stmt = oci_parse($c, $query);
if (oci_execute($stmt, OCI_DEFAULT)) {
- $row = oci_fetch($stmt);
- $val = oci_result($stmt, 1);
- oci_free_statement($stmt);
- return $val;
+ $row = oci_fetch($stmt);
+ $val = oci_result($stmt, 1);
+ oci_free_statement($stmt);
+ return $val;
}
return null;
}
@@ -47,14 +47,14 @@ function readxmltab_ex($c)
{
$stmt = oci_parse($c, "select extract(xml, '/').getclobval() from bug43497_tab");
- $cntchk = 0;
- if (oci_execute($stmt)) {
- while ($result = oci_fetch_array($stmt, OCI_NUM)) {
- $result[0]->free(); // cleanup properly
- ++$cntchk;
- }
- }
- echo "Loop count check = $cntchk\n";
+ $cntchk = 0;
+ if (oci_execute($stmt)) {
+ while ($result = oci_fetch_array($stmt, OCI_NUM)) {
+ $result[0]->free(); // cleanup properly
+ ++$cntchk;
+ }
+ }
+ echo "Loop count check = $cntchk\n";
}
// Read all XML data using explicit LOB locator but without freeing the temp lobs
@@ -62,13 +62,13 @@ function readxmltab_ex_nofree($c)
{
$stmt = oci_parse($c, "select extract(xml, '/').getclobval() from bug43497_tab");
- $cntchk = 0;
- if (oci_execute($stmt)) {
- while ($result = oci_fetch_array($stmt, OCI_NUM)) {
- ++$cntchk;
- }
- }
- echo "Loop count check = $cntchk\n";
+ $cntchk = 0;
+ if (oci_execute($stmt)) {
+ while ($result = oci_fetch_array($stmt, OCI_NUM)) {
+ ++$cntchk;
+ }
+ }
+ echo "Loop count check = $cntchk\n";
}
// Read all XML data using implicit LOB locator
@@ -76,18 +76,18 @@ function readxmltab_im($c)
{
$stmt = oci_parse($c, "select extract(xml, '/').getclobval() from bug43497_tab");
- $cntchk = 0;
- if (oci_execute($stmt)) {
- while ($result = oci_fetch_array($stmt, OCI_NUM+OCI_RETURN_LOBS)) {
- ++$cntchk;
- }
- }
- echo "Loop count check = $cntchk\n";
+ $cntchk = 0;
+ if (oci_execute($stmt)) {
+ while ($result = oci_fetch_array($stmt, OCI_NUM+OCI_RETURN_LOBS)) {
+ ++$cntchk;
+ }
+ }
+ echo "Loop count check = $cntchk\n";
}
function createxmltab($c) // create table w/ field of XML type
{
- @dropxmltab($c);
+ @dropxmltab($c);
$stmt = oci_parse($c, "create table bug43497_tab (id number primary key, xml xmltype)");
oci_execute($stmt);
}
@@ -101,31 +101,31 @@ function dropxmltab($c) // delete table
function fillxmltab($c)
{
- for ($id = 1; $id <= 100; $id++) {
-
- // create an XML element string with random data
- $s = "<data>";
- for ($j = 0; $j < 128; $j++) {
- $s .= rand();
- }
- $s .= "</data>\n";
- for ($j = 0; $j < 4; $j++) {
- $s .= $s;
- }
- $data = "<?xml version=\"1.0\"?><records>" . $s . "</records>";
-
- // insert XML data into database
-
- $stmt = oci_parse($c, "insert into bug43497_tab(id, xml) values (:id, sys.xmltype.createxml(:xml))");
- oci_bind_by_name($stmt, ":id", $id);
- $clob = oci_new_descriptor($c, OCI_D_LOB);
- oci_bind_by_name($stmt, ":xml", $clob, -1, OCI_B_CLOB);
- $clob->writetemporary($data);
- oci_execute($stmt);
-
- $clob->close();
- $clob->free();
- }
+ for ($id = 1; $id <= 100; $id++) {
+
+ // create an XML element string with random data
+ $s = "<data>";
+ for ($j = 0; $j < 128; $j++) {
+ $s .= rand();
+ }
+ $s .= "</data>\n";
+ for ($j = 0; $j < 4; $j++) {
+ $s .= $s;
+ }
+ $data = "<?xml version=\"1.0\"?><records>" . $s . "</records>";
+
+ // insert XML data into database
+
+ $stmt = oci_parse($c, "insert into bug43497_tab(id, xml) values (:id, sys.xmltype.createxml(:xml))");
+ oci_bind_by_name($stmt, ":id", $id);
+ $clob = oci_new_descriptor($c, OCI_D_LOB);
+ oci_bind_by_name($stmt, ":xml", $clob, -1, OCI_B_CLOB);
+ $clob->writetemporary($data);
+ oci_execute($stmt);
+
+ $clob->close();
+ $clob->free();
+ }
}
diff --git a/ext/oci8/tests/bug44008.phpt b/ext/oci8/tests/bug44008.phpt
index 0b031aef90..faf26f472e 100644
--- a/ext/oci8/tests/bug44008.phpt
+++ b/ext/oci8/tests/bug44008.phpt
@@ -13,9 +13,9 @@ require __DIR__.'/connect.inc';
// Initialization
$stmtarray = array(
- "create or replace procedure bug44008_proc (p in out clob)
- as begin p := 'A';
- end;"
+ "create or replace procedure bug44008_proc (p in out clob)
+ as begin p := 'A';
+ end;"
);
oci8_test_sql_execute($c, $stmtarray);
diff --git a/ext/oci8/tests/bug44113.phpt b/ext/oci8/tests/bug44113.phpt
index 8a48d6aff0..ca2a03e914 100644
--- a/ext/oci8/tests/bug44113.phpt
+++ b/ext/oci8/tests/bug44113.phpt
@@ -14,20 +14,20 @@ require(__DIR__.'/connect.inc');
// Initialization
$stmtarray = array(
- "create or replace type bug44113_list_t as table of number"
+ "create or replace type bug44113_list_t as table of number"
);
oci8_test_sql_execute($c, $stmtarray);
// Run Test
// The test can take some time to complete and can exceed PHP's test
-// timout limit on slow networks.
+// timeout limit on slow networks.
for ($x = 0; $x < 70000; $x++) {
- if (!($var = oci_new_collection($c, 'BUG44113_LIST_T'))) {
- print "Failed new collection creation on $x\n";
- break;
- }
+ if (!($var = oci_new_collection($c, 'BUG44113_LIST_T'))) {
+ print "Failed new collection creation on $x\n";
+ break;
+ }
}
print "Completed $x\n";
@@ -35,7 +35,7 @@ print "Completed $x\n";
// Cleanup
$stmtarray = array(
- "drop type bug44113_list_t"
+ "drop type bug44113_list_t"
);
oci8_test_sql_execute($c, $stmtarray);
diff --git a/ext/oci8/tests/bug44206.phpt b/ext/oci8/tests/bug44206.phpt
index 069a840423..2b051771e2 100644
--- a/ext/oci8/tests/bug44206.phpt
+++ b/ext/oci8/tests/bug44206.phpt
@@ -14,24 +14,24 @@ require __DIR__.'/connect.inc';
for ($x = 0; $x < 400; $x++)
{
- $stmt = "select cursor (select $x from dual) a,
- cursor (select $x from dual) b
- from dual";
- $s = oci_parse($c, $stmt);
- $r = oci_execute($s);
+ $stmt = "select cursor (select $x from dual) a,
+ cursor (select $x from dual) b
+ from dual";
+ $s = oci_parse($c, $stmt);
+ $r = oci_execute($s);
if (!$r) {
echo "Exiting $x\n";
exit;
}
- $mode = OCI_ASSOC | OCI_RETURN_NULLS;
- $result = oci_fetch_array($s, $mode);
- oci_execute($result['A']);
- oci_execute($result['B']);
- oci_fetch_array($result['A'], $mode);
- oci_fetch_array($result['B'], $mode);
- oci_free_statement($result['A']);
- oci_free_statement($result['B']);
- oci_free_statement($s);
+ $mode = OCI_ASSOC | OCI_RETURN_NULLS;
+ $result = oci_fetch_array($s, $mode);
+ oci_execute($result['A']);
+ oci_execute($result['B']);
+ oci_fetch_array($result['A'], $mode);
+ oci_fetch_array($result['B'], $mode);
+ oci_free_statement($result['A']);
+ oci_free_statement($result['B']);
+ oci_free_statement($s);
}
echo "Completed $x\n";
diff --git a/ext/oci8/tests/bug45458.phpt b/ext/oci8/tests/bug45458.phpt
index 3a4b514857..3e2652642c 100644
--- a/ext/oci8/tests/bug45458.phpt
+++ b/ext/oci8/tests/bug45458.phpt
@@ -37,8 +37,6 @@ oci_free_statement($s);
oci_close($c);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Test 1
array(1) {
@@ -81,4 +79,3 @@ array(1) {
}
string(1) "X"
string(1) "X"
-===DONE===
diff --git a/ext/oci8/tests/bug46994.phpt b/ext/oci8/tests/bug46994.phpt
index 079f5df6c4..ace65b8bd2 100644
--- a/ext/oci8/tests/bug46994.phpt
+++ b/ext/oci8/tests/bug46994.phpt
@@ -13,15 +13,15 @@ require(__DIR__.'/connect.inc');
// Initialization
$stmtarray = array(
- "create or replace procedure bug46994_proc1(p1 in out nocopy clob) is
- begin
- dbms_lob.trim(p1, 0);
- dbms_lob.writeappend(p1, 26, 'This should be the output.');
+ "create or replace procedure bug46994_proc1(p1 in out nocopy clob) is
+ begin
+ dbms_lob.trim(p1, 0);
+ dbms_lob.writeappend(p1, 26, 'This should be the output.');
end bug46994_proc1;",
- "create or replace procedure bug46994_proc2(p1 in out nocopy clob) is
- begin
- dbms_lob.trim(p1, 0);
- dbms_lob.writeappend(p1, 37, 'The output should be even longer now.');
+ "create or replace procedure bug46994_proc2(p1 in out nocopy clob) is
+ begin
+ dbms_lob.trim(p1, 0);
+ dbms_lob.writeappend(p1, 37, 'The output should be even longer now.');
end bug46994_proc2;"
);
@@ -60,8 +60,8 @@ var_dump($myclob->load()); // Use cached size code path
// Cleanup
$stmtarray = array(
- "drop procedure bug46994_proc1",
- "drop procedure bug46994_proc2"
+ "drop procedure bug46994_proc1",
+ "drop procedure bug46994_proc2"
);
oci8_test_sql_execute($c, $stmtarray);
@@ -69,8 +69,6 @@ oci8_test_sql_execute($c, $stmtarray);
oci_close($c);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Test 1
string(26) "This should be the output."
@@ -80,4 +78,3 @@ Test 3
string(26) "This should be the output."
Test 4
string(26) "This should be the output."
-===DONE===
diff --git a/ext/oci8/tests/bug47189.phpt b/ext/oci8/tests/bug47189.phpt
index a5b5217ac5..96aec54722 100644
--- a/ext/oci8/tests/bug47189.phpt
+++ b/ext/oci8/tests/bug47189.phpt
@@ -29,8 +29,6 @@ oci_fetch_all($s, $rs1, 0, 1, OCI_FETCHSTATEMENT_BY_ROW);
var_dump($rs1);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Test 1
array(1) {
@@ -54,4 +52,3 @@ array(1) {
Warning: oci_fetch_all(): ORA-01002: %s in %s on line %d
array(0) {
}
-===DONE===
diff --git a/ext/oci8/tests/bug47281.phpt b/ext/oci8/tests/bug47281.phpt
index 01b273129c..377141e3cc 100644
--- a/ext/oci8/tests/bug47281.phpt
+++ b/ext/oci8/tests/bug47281.phpt
@@ -57,11 +57,8 @@ $stmtarray = array(
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Test 1
ORA-20000: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaBcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccDeeeeeeeeeeee
Test 2
oci_execute(): ORA-20000: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaBcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccDeeeeeeeeeeee
-===DONE===
diff --git a/ext/oci8/tests/bug47281_tt.phpt b/ext/oci8/tests/bug47281_tt.phpt
index acb1eef55e..f0e6d0200d 100644
--- a/ext/oci8/tests/bug47281_tt.phpt
+++ b/ext/oci8/tests/bug47281_tt.phpt
@@ -49,11 +49,8 @@ $stmtarray = array(
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Test 1
ORA-57000: TT8507: ORA-20000: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
Test 2
oci_execute(): ORA-57000: TT8507: ORA-20000: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
-===DONE===
diff --git a/ext/oci8/tests/bug51291_1.phpt b/ext/oci8/tests/bug51291_1.phpt
index 406d9b5dcd..5d46a370f5 100644
--- a/ext/oci8/tests/bug51291_1.phpt
+++ b/ext/oci8/tests/bug51291_1.phpt
@@ -139,8 +139,6 @@ if (!$r) {
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Test 1 - Parse
array(4) {
@@ -391,4 +389,3 @@ array(4) {
["sqltext"]=>
string(30) "select reallynothere from dual"
}
-===DONE===
diff --git a/ext/oci8/tests/bug51291_2.phpt b/ext/oci8/tests/bug51291_2.phpt
index c39eefbbdc..56655283fa 100644
--- a/ext/oci8/tests/bug51291_2.phpt
+++ b/ext/oci8/tests/bug51291_2.phpt
@@ -31,8 +31,6 @@ if (!$r) {
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Test 1 - Execute - after successful 2nd query with same statement
bool(false)
@@ -53,4 +51,3 @@ Execute status is true
bool(false)
bool(false)
bool(false)
-===DONE===
diff --git a/ext/oci8/tests/bug68298.phpt b/ext/oci8/tests/bug68298.phpt
index ed15b84997..f0fc201bb5 100644
--- a/ext/oci8/tests/bug68298.phpt
+++ b/ext/oci8/tests/bug68298.phpt
@@ -11,8 +11,8 @@ if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platforms only");
require(__DIR__.'/connect.inc');
$stmtarray = array(
- "DROP TABLE BUG68298",
- "CREATE TABLE BUG68298 (COL1 NUMBER(20))"
+ "DROP TABLE BUG68298",
+ "CREATE TABLE BUG68298 (COL1 NUMBER(20))"
);
oci8_test_sql_execute($c, $stmtarray);
@@ -36,8 +36,6 @@ var_dump($r);
$stmtarray = array("DROP TABLE BUG68298");
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
array(1) {
["COL1"]=>
@@ -48,4 +46,3 @@ array(1) {
string(20) "-1152921504606846975"
}
}
-===DONE===
diff --git a/ext/oci8/tests/bug71148.phpt b/ext/oci8/tests/bug71148.phpt
index 838dbc4fbb..60fac0d3ae 100644
--- a/ext/oci8/tests/bug71148.phpt
+++ b/ext/oci8/tests/bug71148.phpt
@@ -157,8 +157,6 @@ $stmtarray = array(
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Test 1: Bind input parameter in a local function
array(2) {
@@ -188,4 +186,3 @@ Test 6: Bind IN OUT parameter within the same scope of execute
string(4) "STR1"
string(4) "STR2"
string(9) "STR1 STR2"
-===DONE===
diff --git a/ext/oci8/tests/bug71422.phpt b/ext/oci8/tests/bug71422.phpt
index 6896c5de0d..798981ed0b 100644
--- a/ext/oci8/tests/bug71422.phpt
+++ b/ext/oci8/tests/bug71422.phpt
@@ -10,9 +10,9 @@ if (!extension_loaded('oci8')) die ("skip no oci8 extension");
require(__DIR__.'/connect.inc');
$stmtarray = array(
- "DROP TABLE BUG71422_TEST",
- "CREATE TABLE BUG71422_TEST (TEST_ID NUMBER(*,0) NOT NULL, LABEL VARCHAR2(50 CHAR), CONSTRAINT BUG71422_TEST_PK PRIMARY KEY (TEST_ID))",
- "INSERT INTO BUG71422_TEST (TEST_ID, LABEL) VALUES (1, 'Foo')"
+ "DROP TABLE BUG71422_TEST",
+ "CREATE TABLE BUG71422_TEST (TEST_ID NUMBER(*,0) NOT NULL, LABEL VARCHAR2(50 CHAR), CONSTRAINT BUG71422_TEST_PK PRIMARY KEY (TEST_ID))",
+ "INSERT INTO BUG71422_TEST (TEST_ID, LABEL) VALUES (1, 'Foo')"
);
oci8_test_sql_execute($c, $stmtarray);
@@ -20,7 +20,7 @@ oci8_test_sql_execute($c, $stmtarray);
$stmt = oci_parse($c, 'SELECT LABEL AS RAW_QUERY FROM BUG71422_TEST WHERE TEST_ID=1');
oci_execute($stmt);
while ($row = oci_fetch_array($stmt, OCI_ASSOC+OCI_RETURN_NULLS)) {
- var_dump($row);
+ var_dump($row);
}
$stmt = oci_parse($c, 'SELECT LABEL AS NUMERIC_BIND_PARAMETER FROM BUG71422_TEST WHERE TEST_ID=:test_id');
@@ -28,7 +28,7 @@ $value = 1;
oci_bind_by_name($stmt, ':test_id', $value, -1, SQLT_INT);
oci_execute($stmt);
while ($row = oci_fetch_array($stmt, OCI_ASSOC+OCI_RETURN_NULLS)) {
- var_dump($row);
+ var_dump($row);
}
$stmt = oci_parse($c, 'SELECT LABEL AS STRING_BIND_PARAMETER FROM BUG71422_TEST WHERE TEST_ID=:test_id');
@@ -36,19 +36,17 @@ $value = 1;
oci_bind_by_name($stmt, ':test_id', $value, -1, SQLT_CHR);
oci_execute($stmt);
while ($row = oci_fetch_array($stmt, OCI_ASSOC+OCI_RETURN_NULLS)) {
- var_dump($row);
+ var_dump($row);
}
// Cleanup
$stmtarray = array(
- "DROP TABLE BUG71422_TEST"
+ "DROP TABLE BUG71422_TEST"
);
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
array(1) {
["RAW_QUERY"]=>
@@ -62,4 +60,3 @@ array(1) {
["STRING_BIND_PARAMETER"]=>
string(3) "Foo"
}
-===DONE===
diff --git a/ext/oci8/tests/bug71600.phpt b/ext/oci8/tests/bug71600.phpt
index 9cf9f2e971..718d653445 100644
--- a/ext/oci8/tests/bug71600.phpt
+++ b/ext/oci8/tests/bug71600.phpt
@@ -78,8 +78,6 @@ $stmtarray = array(
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Test 1
Executing SELECT statament...
@@ -93,4 +91,3 @@ Fetching data by rows...
2 Records Found
0|1|9
1|11|19
-===DONE===
diff --git a/ext/oci8/tests/bug72524.phpt b/ext/oci8/tests/bug72524.phpt
index f696277f86..9159c75cac 100644
--- a/ext/oci8/tests/bug72524.phpt
+++ b/ext/oci8/tests/bug72524.phpt
@@ -75,8 +75,6 @@ $stmtarray = array(
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Test 1 - P1 Value: NULL P1 Length: Default P1 Type: Default P2 Value: NULL P2 Length: Default P2 Type: Default
bool(true)
@@ -92,4 +90,3 @@ Test 5 - P1 Value: NULL P1 Length: 0 P1 Type: SQLT_LNG P2 Value: NULL P2
Warning: oci_execute(): ORA-24816: %s in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/oci8/tests/bug74625.phpt b/ext/oci8/tests/bug74625.phpt
index 9bcaf29788..7effbb7f76 100644
--- a/ext/oci8/tests/bug74625.phpt
+++ b/ext/oci8/tests/bug74625.phpt
@@ -47,8 +47,6 @@ $stmtarray = array(
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
array(5) {
[0]=>
@@ -62,4 +60,3 @@ array(5) {
[4]=>
int(-10)
}
-===DONE===
diff --git a/ext/oci8/tests/calltimeout1.phpt b/ext/oci8/tests/calltimeout1.phpt
index 123e51561a..865fd62b68 100644
--- a/ext/oci8/tests/calltimeout1.phpt
+++ b/ext/oci8/tests/calltimeout1.phpt
@@ -43,9 +43,6 @@ oci_set_call_timeout($c, 4000); // milliseconds
$r = mysleep($c, 8); // seconds
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Test 1
Execute error was ORA-03136: %s
-===DONE===
diff --git a/ext/oci8/tests/clientversion.phpt b/ext/oci8/tests/clientversion.phpt
index 262ded462f..e31ccc1ac8 100644
--- a/ext/oci8/tests/clientversion.phpt
+++ b/ext/oci8/tests/clientversion.phpt
@@ -10,8 +10,5 @@ if (!extension_loaded('oci8')) die("skip no oci8 extension");
echo oci_client_version(), "\n";
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
%d.%d.%d.%d.%d
-===DONE===
diff --git a/ext/oci8/tests/coll_009.phpt b/ext/oci8/tests/coll_009.phpt
index e55a4a210c..2707fbccf7 100644
--- a/ext/oci8/tests/coll_009.phpt
+++ b/ext/oci8/tests/coll_009.phpt
@@ -11,8 +11,8 @@ require(__DIR__.'/skipif.inc');
require __DIR__."/connect.inc";
$ora_sql = "DROP TYPE
- ".$type_name."
- ";
+ ".$type_name."
+ ";
$statement = OCIParse($c,$ora_sql);
@OCIExecute($statement);
diff --git a/ext/oci8/tests/coll_009_func.phpt b/ext/oci8/tests/coll_009_func.phpt
index fca04599e2..5b3e08579a 100644
--- a/ext/oci8/tests/coll_009_func.phpt
+++ b/ext/oci8/tests/coll_009_func.phpt
@@ -11,8 +11,8 @@ require(__DIR__.'/skipif.inc');
require __DIR__."/connect.inc";
$ora_sql = "DROP TYPE
- ".$type_name."
- ";
+ ".$type_name."
+ ";
$statement = OCIParse($c,$ora_sql);
@OCIExecute($statement);
diff --git a/ext/oci8/tests/coll_010.phpt b/ext/oci8/tests/coll_010.phpt
index 33e1b6fd18..42bd788a81 100644
--- a/ext/oci8/tests/coll_010.phpt
+++ b/ext/oci8/tests/coll_010.phpt
@@ -11,8 +11,8 @@ require(__DIR__.'/skipif.inc');
require __DIR__."/connect.inc";
$ora_sql = "DROP TYPE
- ".$type_name."
- ";
+ ".$type_name."
+ ";
$statement = OCIParse($c,$ora_sql);
@OCIExecute($statement);
diff --git a/ext/oci8/tests/coll_010_func.phpt b/ext/oci8/tests/coll_010_func.phpt
index 2f67283538..9ef6c22250 100644
--- a/ext/oci8/tests/coll_010_func.phpt
+++ b/ext/oci8/tests/coll_010_func.phpt
@@ -11,8 +11,8 @@ require(__DIR__.'/skipif.inc');
require __DIR__."/connect.inc";
$ora_sql = "DROP TYPE
- ".$type_name."
- ";
+ ".$type_name."
+ ";
$statement = OCIParse($c,$ora_sql);
@OCIExecute($statement);
diff --git a/ext/oci8/tests/coll_011.phpt b/ext/oci8/tests/coll_011.phpt
index 13c4613b00..562de0889f 100644
--- a/ext/oci8/tests/coll_011.phpt
+++ b/ext/oci8/tests/coll_011.phpt
@@ -11,8 +11,8 @@ require(__DIR__.'/skipif.inc');
require __DIR__."/connect.inc";
$ora_sql = "DROP TYPE
- ".$type_name."
- ";
+ ".$type_name."
+ ";
$statement = OCIParse($c,$ora_sql);
@OCIExecute($statement);
diff --git a/ext/oci8/tests/coll_011_func.phpt b/ext/oci8/tests/coll_011_func.phpt
index bc6bd6ea73..ca43336ffc 100644
--- a/ext/oci8/tests/coll_011_func.phpt
+++ b/ext/oci8/tests/coll_011_func.phpt
@@ -11,8 +11,8 @@ require(__DIR__.'/skipif.inc');
require __DIR__."/connect.inc";
$ora_sql = "DROP TYPE
- ".$type_name."
- ";
+ ".$type_name."
+ ";
$statement = OCIParse($c,$ora_sql);
@OCIExecute($statement);
diff --git a/ext/oci8/tests/coll_012.phpt b/ext/oci8/tests/coll_012.phpt
index 615a3aad7a..be0439e8ba 100644
--- a/ext/oci8/tests/coll_012.phpt
+++ b/ext/oci8/tests/coll_012.phpt
@@ -11,8 +11,8 @@ require(__DIR__.'/skipif.inc');
require __DIR__."/connect.inc";
$ora_sql = "DROP TYPE
- ".$type_name."
- ";
+ ".$type_name."
+ ";
$statement = OCIParse($c,$ora_sql);
@OCIExecute($statement);
diff --git a/ext/oci8/tests/coll_012_func.phpt b/ext/oci8/tests/coll_012_func.phpt
index 41a7084109..fa6a026d16 100644
--- a/ext/oci8/tests/coll_012_func.phpt
+++ b/ext/oci8/tests/coll_012_func.phpt
@@ -11,8 +11,8 @@ require(__DIR__.'/skipif.inc');
require __DIR__."/connect.inc";
$ora_sql = "DROP TYPE
- ".$type_name."
- ";
+ ".$type_name."
+ ";
$statement = OCIParse($c,$ora_sql);
@OCIExecute($statement);
diff --git a/ext/oci8/tests/coll_013.phpt b/ext/oci8/tests/coll_013.phpt
index ef3af0a8e7..1e943bf57e 100644
--- a/ext/oci8/tests/coll_013.phpt
+++ b/ext/oci8/tests/coll_013.phpt
@@ -11,8 +11,8 @@ require(__DIR__.'/skipif.inc');
require __DIR__."/connect.inc";
$ora_sql = "DROP TYPE
- ".$type_name."
- ";
+ ".$type_name."
+ ";
$statement = OCIParse($c,$ora_sql);
@OCIExecute($statement);
diff --git a/ext/oci8/tests/coll_013_func.phpt b/ext/oci8/tests/coll_013_func.phpt
index bb6d7083e3..417bfdb18f 100644
--- a/ext/oci8/tests/coll_013_func.phpt
+++ b/ext/oci8/tests/coll_013_func.phpt
@@ -11,8 +11,8 @@ require(__DIR__.'/skipif.inc');
require __DIR__."/connect.inc";
$ora_sql = "DROP TYPE
- ".$type_name."
- ";
+ ".$type_name."
+ ";
$statement = OCIParse($c,$ora_sql);
@OCIExecute($statement);
diff --git a/ext/oci8/tests/coll_014.phpt b/ext/oci8/tests/coll_014.phpt
index 0af0ead329..697d306818 100644
--- a/ext/oci8/tests/coll_014.phpt
+++ b/ext/oci8/tests/coll_014.phpt
@@ -11,8 +11,8 @@ require(__DIR__.'/skipif.inc');
require __DIR__."/connect.inc";
$ora_sql = "DROP TYPE
- ".$type_name."
- ";
+ ".$type_name."
+ ";
$statement = OCIParse($c,$ora_sql);
@OCIExecute($statement);
diff --git a/ext/oci8/tests/coll_014_func.phpt b/ext/oci8/tests/coll_014_func.phpt
index 24b0bbf8ba..fc9df35a7c 100644
--- a/ext/oci8/tests/coll_014_func.phpt
+++ b/ext/oci8/tests/coll_014_func.phpt
@@ -11,8 +11,8 @@ require(__DIR__.'/skipif.inc');
require __DIR__."/connect.inc";
$ora_sql = "DROP TYPE
- ".$type_name."
- ";
+ ".$type_name."
+ ";
$statement = OCIParse($c,$ora_sql);
@OCIExecute($statement);
diff --git a/ext/oci8/tests/coll_015.phpt b/ext/oci8/tests/coll_015.phpt
index 2ed2375ecc..d3bffd2fe5 100644
--- a/ext/oci8/tests/coll_015.phpt
+++ b/ext/oci8/tests/coll_015.phpt
@@ -11,8 +11,8 @@ require(__DIR__.'/skipif.inc');
require __DIR__."/connect.inc";
$ora_sql = "DROP TYPE
- ".$type_name."
- ";
+ ".$type_name."
+ ";
$statement = OCIParse($c,$ora_sql);
@OCIExecute($statement);
diff --git a/ext/oci8/tests/coll_015_func.phpt b/ext/oci8/tests/coll_015_func.phpt
index a9c16aec01..3685a28b96 100644
--- a/ext/oci8/tests/coll_015_func.phpt
+++ b/ext/oci8/tests/coll_015_func.phpt
@@ -11,8 +11,8 @@ require(__DIR__.'/skipif.inc');
require __DIR__."/connect.inc";
$ora_sql = "DROP TYPE
- ".$type_name."
- ";
+ ".$type_name."
+ ";
$statement = OCIParse($c,$ora_sql);
@OCIExecute($statement);
diff --git a/ext/oci8/tests/coll_016.phpt b/ext/oci8/tests/coll_016.phpt
index 80059688b3..d4b19efb43 100644
--- a/ext/oci8/tests/coll_016.phpt
+++ b/ext/oci8/tests/coll_016.phpt
@@ -11,8 +11,8 @@ require(__DIR__.'/skipif.inc');
require __DIR__."/connect.inc";
$ora_sql = "DROP TYPE
- ".$type_name."
- ";
+ ".$type_name."
+ ";
$statement = OCIParse($c,$ora_sql);
@OCIExecute($statement);
diff --git a/ext/oci8/tests/coll_016_func.phpt b/ext/oci8/tests/coll_016_func.phpt
index da26428d8d..95ed0588dc 100644
--- a/ext/oci8/tests/coll_016_func.phpt
+++ b/ext/oci8/tests/coll_016_func.phpt
@@ -11,8 +11,8 @@ require(__DIR__.'/skipif.inc');
require __DIR__."/connect.inc";
$ora_sql = "DROP TYPE
- ".$type_name."
- ";
+ ".$type_name."
+ ";
$statement = OCIParse($c,$ora_sql);
@OCIExecute($statement);
diff --git a/ext/oci8/tests/coll_017.phpt b/ext/oci8/tests/coll_017.phpt
index 81fdfb2553..0bd730934f 100644
--- a/ext/oci8/tests/coll_017.phpt
+++ b/ext/oci8/tests/coll_017.phpt
@@ -11,8 +11,8 @@ require(__DIR__.'/skipif.inc');
require __DIR__."/connect.inc";
$ora_sql = "DROP TYPE
- ".$type_name."
- ";
+ ".$type_name."
+ ";
$statement = OCIParse($c,$ora_sql);
@OCIExecute($statement);
diff --git a/ext/oci8/tests/coll_017_func.phpt b/ext/oci8/tests/coll_017_func.phpt
index c582eb0f8d..e3d9be2a43 100644
--- a/ext/oci8/tests/coll_017_func.phpt
+++ b/ext/oci8/tests/coll_017_func.phpt
@@ -11,8 +11,8 @@ require(__DIR__.'/skipif.inc');
require __DIR__."/connect.inc";
$ora_sql = "DROP TYPE
- ".$type_name."
- ";
+ ".$type_name."
+ ";
$statement = OCIParse($c,$ora_sql);
@OCIExecute($statement);
diff --git a/ext/oci8/tests/commit_001.phpt b/ext/oci8/tests/commit_001.phpt
index de4682eefc..d99a6b3cbf 100644
--- a/ext/oci8/tests/commit_001.phpt
+++ b/ext/oci8/tests/commit_001.phpt
@@ -14,20 +14,20 @@ require(__DIR__.'/create_table.inc');
$insert_sql = "insert into ".$schema.$table_name." (id, value) values (1,1)";
if (!($s = oci_parse($c, $insert_sql))) {
- die("oci_parse(insert) failed!\n");
+ die("oci_parse(insert) failed!\n");
}
/* check with OCI_NO_AUTO_COMMIT mode */
for ($i = 0; $i<3; $i++) {
- if (!oci_execute($s, OCI_NO_AUTO_COMMIT)) {
- die("oci_execute(insert) failed!\n");
- }
+ if (!oci_execute($s, OCI_NO_AUTO_COMMIT)) {
+ die("oci_execute(insert) failed!\n");
+ }
}
for ($i = 0; $i<3; $i++) {
- if (!oci_execute($s, OCI_DEFAULT)) {
- die("oci_execute(insert) failed!\n");
- }
+ if (!oci_execute($s, OCI_DEFAULT)) {
+ die("oci_execute(insert) failed!\n");
+ }
}
@@ -36,19 +36,19 @@ var_dump(oci_rollback($c));
$select_sql = "select * from ".$schema.$table_name."";
if (!($select = oci_parse($c, $select_sql))) {
- die("oci_parse(select) failed!\n");
+ die("oci_parse(select) failed!\n");
}
/* oci_fetch_all */
if (!oci_execute($select)) {
- die("oci_execute(select) failed!\n");
+ die("oci_execute(select) failed!\n");
}
var_dump(oci_fetch_all($select, $all));
var_dump($all);
/* ocifetchstatement */
if (!oci_execute($s)) {
- die("oci_execute(select) failed!\n");
+ die("oci_execute(select) failed!\n");
}
$insert_sql = "insert into ".$schema.$table_name." (id, value) values (1,1)";
@@ -67,7 +67,7 @@ var_dump(oci_commit($c));
/* oci_fetch_all */
if (!oci_execute($select)) {
- die("oci_execute(select) failed!\n");
+ die("oci_execute(select) failed!\n");
}
var_dump(oci_fetch_all($select, $all));
var_dump($all);
diff --git a/ext/oci8/tests/commit_002.phpt b/ext/oci8/tests/commit_002.phpt
index b38d9aaa2d..4696f3b556 100644
--- a/ext/oci8/tests/commit_002.phpt
+++ b/ext/oci8/tests/commit_002.phpt
@@ -13,8 +13,8 @@ require(__DIR__.'/connect.inc');
// Initialization
$stmtarray = array(
- "drop table commit_002_tab",
- "create table commit_002_tab
+ "drop table commit_002_tab",
+ "create table commit_002_tab
( x int constraint commit_002_tab_check_x check ( x > 0 ) deferrable initially immediate,
y int constraint commit_002_tab_check_y check ( y > 0 ) deferrable initially deferred)"
);
@@ -54,14 +54,12 @@ if (!$r) {
// Clean up
$stmtarray = array(
- "drop table commit_002_tab"
+ "drop table commit_002_tab"
);
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
First Insert
Could not execute: ORA-02290: %s (%s.COMMIT_002_TAB_CHECK_X) %s
@@ -71,4 +69,3 @@ Warning: oci_commit(): ORA-02091: %s
ORA-02290: %s (%s.COMMIT_002_TAB_CHECK_Y) %s in %scommit_002.php on line %d
Could not commit: ORA-02091: %s
ORA-02290: %s (%s.COMMIT_002_TAB_CHECK_Y) %s
-===DONE===
diff --git a/ext/oci8/tests/commit_old.phpt b/ext/oci8/tests/commit_old.phpt
index 658cfd24b3..bfbae9b597 100644
--- a/ext/oci8/tests/commit_old.phpt
+++ b/ext/oci8/tests/commit_old.phpt
@@ -14,13 +14,13 @@ require __DIR__.'/create_table.inc';
$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)";
if (!($s = ociparse($c, $insert_sql))) {
- die("ociparse(insert) failed!\n");
+ die("ociparse(insert) failed!\n");
}
for ($i = 0; $i<3; $i++) {
- if (!ociexecute($s, OCI_DEFAULT)) {
- die("ociexecute(insert) failed!\n");
- }
+ if (!ociexecute($s, OCI_DEFAULT)) {
+ die("ociexecute(insert) failed!\n");
+ }
}
var_dump(ocirollback($c));
@@ -28,18 +28,18 @@ var_dump(ocirollback($c));
$select_sql = "SELECT * FROM ".$schema.$table_name."";
if (!($select = ociparse($c, $select_sql))) {
- die("ociparse(select) failed!\n");
+ die("ociparse(select) failed!\n");
}
if (!oci_execute($select)) {
- die("ociexecute(select) failed!\n");
+ die("ociexecute(select) failed!\n");
}
var_dump(ocifetchstatement($select, $all));
var_dump($all);
/* ocifetchstatement */
if (!ociexecute($s)) {
- die("ociexecute(select) failed!\n");
+ die("ociexecute(select) failed!\n");
}
$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)";
@@ -57,7 +57,7 @@ for ($i = 0; $i<3; $i++) {
var_dump(ocicommit($c));
if (!ociexecute($select)) {
- die("ociexecute(select) failed!\n");
+ die("ociexecute(select) failed!\n");
}
var_dump(ocifetchstatement($select, $all));
var_dump($all);
diff --git a/ext/oci8/tests/conn_attr.inc b/ext/oci8/tests/conn_attr.inc
index f05f3bc064..c2e3c36442 100644
--- a/ext/oci8/tests/conn_attr.inc
+++ b/ext/oci8/tests/conn_attr.inc
@@ -30,29 +30,29 @@ if ((isset($matches[1]) && $matches[1] >= 11)) {
foreach ($stmtarray as $stmt) {
$s = oci_parse($c, $stmt);
$r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
+ if (!$r) {
+ $m = oci_error($s);
+ if (!in_array($m['code'], array( // ignore expected errors
942 // table or view does not exist
, 1918 // user does not exist
, 2289 // sequence does not exist
, 4080 // trigger does not exist
, 38802 // edition does not exist
))) {
- echo "Error:" . $stmt . PHP_EOL . $m['message'] . PHP_EOL;
+ echo "Error:" . $stmt . PHP_EOL . $m['message'] . PHP_EOL;
if ($m['code'] == 38807) {
echo "You appear to already have an edition in use that prevents this PHP test from running. Query DBA_EDITIONS to see existing editions.". PHP_EOL;
}
die;
- }
- }
+ }
+ }
}
function get_attr($conn,$attr)
{
$sel_stmt="select " .$attr. " from v\$session where sid =
- (select sid from v\$session where audsid =
- sys_context('userenv','sessionid')) order by 1";
+ (select sid from v\$session where audsid =
+ sys_context('userenv','sessionid')) order by 1";
$s2 = oci_parse($conn,$sel_stmt);
oci_execute($s2,OCI_DEFAULT);
while (oci_fetch($s2)) {
@@ -66,10 +66,10 @@ function get_attr($conn,$attr)
function get_conn($conn_type)
{
- $user = $GLOBALS['testuser'];
- $password = $GLOBALS['testpassword'];
- $dbase = $GLOBALS['dbase'];
- switch($conn_type) {
+ $user = $GLOBALS['testuser'];
+ $password = $GLOBALS['testpassword'];
+ $dbase = $GLOBALS['dbase'];
+ switch($conn_type) {
case 1:
echo "Testing with oci_connect()\n";
return(oci_connect($user,$password,$dbase));
@@ -82,41 +82,41 @@ function get_conn($conn_type)
echo "Testing with oci_new_connect()\n";
return(oci_new_connect($user,$password,$dbase));
break;
- }
+ }
}
function set_attr($conn,$attr,$sufix)
{
- if (!strcmp($attr,'MODULE'))
- $r = oci_set_module_name($conn,'PHP TEST'.$sufix);
- else if (!strcmp($attr,'ACTION'))
+ if (!strcmp($attr,'MODULE'))
+ $r = oci_set_module_name($conn,'PHP TEST'.$sufix);
+ else if (!strcmp($attr,'ACTION'))
$r = oci_set_action($conn,'TASK'.$sufix);
- else if (!strcmp($attr,'CLIENT_INFO'))
+ else if (!strcmp($attr,'CLIENT_INFO'))
$r = oci_set_client_info($conn,'INFO1'.$sufix);
- else if (!strcmp($attr,'CLIENT_IDENTIFIER'))
+ else if (!strcmp($attr,'CLIENT_IDENTIFIER'))
$r = oci_set_client_identifier($conn,'ID00'.$sufix);
- else
- echo "Pass one of the above four attributes!!!\n";
- if ($r) {
- echo "Value of $attr has been set successfully\n";
+ else
+ echo "Pass one of the above four attributes!!!\n";
+ if ($r) {
+ echo "Value of $attr has been set successfully\n";
}
- //Do a round-trip here
- oci_server_version($conn);
- return $r;
+ //Do a round-trip here
+ oci_server_version($conn);
+ return $r;
}
function set_edit_attr($value)
{
- $r = oci_set_edition($value);
+ $r = oci_set_edition($value);
if ($r) {
- echo " The value of edition has been successfully set\n";
+ echo " The value of edition has been successfully set\n";
}
- return $r;
+ return $r;
}
function get_edit_attr ($conn) {
- $sel_stmt = "select sys_context('USERENV', 'CURRENT_EDITION_NAME') from dual";
+ $sel_stmt = "select sys_context('USERENV', 'CURRENT_EDITION_NAME') from dual";
$s2 = oci_parse($conn,$sel_stmt);
oci_execute($s2,OCI_DEFAULT);
while (oci_fetch($s2)) {
@@ -126,8 +126,8 @@ function get_edit_attr ($conn) {
function get_sys_attr($conn,$attr)
{
- $sel_stmt="select " .$attr. " from v\$session where sid =
- (select sid from v\$session where audsid = sys_context('userenv','sessionid')) order by 1";
+ $sel_stmt="select " .$attr. " from v\$session where sid =
+ (select sid from v\$session where audsid = sys_context('userenv','sessionid')) order by 1";
$s2 = oci_parse($conn,$sel_stmt);
oci_execute($s2,OCI_DEFAULT);
while (oci_fetch($s2)) {
@@ -136,14 +136,14 @@ function get_sys_attr($conn,$attr)
}
function clean_up($c) {
- $stmtarray = array(
+ $stmtarray = array(
"drop edition myedition1 cascade",
"drop edition myedition cascade",
"drop user " . $GLOBALS['testuser'] . " cascade",
- );
+ );
- foreach ($stmtarray as $stmt) {
+ foreach ($stmtarray as $stmt) {
$s = oci_parse($c, $stmt);
@oci_execute($s);
- }
+ }
}
diff --git a/ext/oci8/tests/conn_attr_1.phpt b/ext/oci8/tests/conn_attr_1.phpt
index 1c1f767398..ce23b2b5aa 100644
--- a/ext/oci8/tests/conn_attr_1.phpt
+++ b/ext/oci8/tests/conn_attr_1.phpt
@@ -36,19 +36,19 @@ echo"**Test 1.2 - Set and get values for the attributes **************\n";
$conn1 = get_conn(1); //oci_connect()
foreach($attr_array as $attr) {
- set_attr($conn1,$attr,1);
+ set_attr($conn1,$attr,1);
get_attr($conn1,$attr);
}
$conn2 = get_conn(2); //oci_pconnect()
foreach($attr_array as $attr) {
- set_attr($conn2,$attr,2);
+ set_attr($conn2,$attr,2);
get_attr($conn2,$attr);
}
$conn3 = get_conn(3); //oci_new_connect()
foreach($attr_array as $attr) {
- set_attr($conn3,$attr,3);
+ set_attr($conn3,$attr,3);
get_attr($conn3,$attr);
}
diff --git a/ext/oci8/tests/conn_attr_2.phpt b/ext/oci8/tests/conn_attr_2.phpt
index 898bd52bcd..61d59093b1 100644
--- a/ext/oci8/tests/conn_attr_2.phpt
+++ b/ext/oci8/tests/conn_attr_2.phpt
@@ -29,21 +29,21 @@ echo"**Set values using pconnect-1**\n";
var_dump($pc1 = oci_pconnect($testuser,$testpassword,$dbase));
foreach($attr_array as $attr) {
- set_attr($pc1,$attr,100);
+ set_attr($pc1,$attr,100);
}
// using pc1 again
echo"\n**Get values using pconnect-2**\n";
var_dump($pc3 = oci_pconnect($testuser,$testpassword,$dbase));
foreach($attr_array as $attr) {
- get_attr($pc3,$attr);
+ get_attr($pc3,$attr);
}
// Get with different pconnect
echo"\n**Get values using pconnect-3**\n";
var_dump($pc2 = oci_pconnect($testuser,$testpassword,$dbase,'UTF8'));
foreach($attr_array as $attr) {
- get_attr($pc2,$attr);
+ get_attr($pc2,$attr);
}
oci_close($pc1);
@@ -54,7 +54,7 @@ oci_close($pc3);
echo "\n**Re-open a pconnect()**\n";
var_dump($pc4 = oci_pconnect($testuser,$testpassword,$dbase));
foreach($attr_array as $attr) {
- get_attr($pc4,$attr);
+ get_attr($pc4,$attr);
}
oci_close($pc4);
@@ -68,10 +68,10 @@ if (!$sys_c1) {
var_dump($e);
}
} else {
- set_attr($sys_c1,'ACTION',10);
- get_sys_attr($sys_c1,'ACTION');
- get_attr($sys_c1,'ACTION');
- oci_close($sys_c1);
+ set_attr($sys_c1,'ACTION',10);
+ get_sys_attr($sys_c1,'ACTION');
+ get_attr($sys_c1,'ACTION');
+ oci_close($sys_c1);
}
clean_up($c);
diff --git a/ext/oci8/tests/conn_attr_4.phpt b/ext/oci8/tests/conn_attr_4.phpt
index 46a219c05d..7a7f5269eb 100644
--- a/ext/oci8/tests/conn_attr_4.phpt
+++ b/ext/oci8/tests/conn_attr_4.phpt
@@ -59,16 +59,16 @@ echo "\nSetting to different values \n";
$values_array = array(1000,NULL,'this is a very huge string with a length > 64 !!!!!this is a very huge string with a length > 64 !!!!!this is a very huge string with a length > 64 !!!!!this is a very huge string with a length > 64 !!!!!');
foreach($values_array as $val ) {
- oci_set_module_name($c1,$val);
- oci_set_client_identifier($c1,$val);
- oci_set_client_info($c1,$val);
- $r = oci_set_action($c1,$val);
- if ($r) {
- echo "Values set successfully to $val\n";
- foreach($attr_array as $attr) {
+ oci_set_module_name($c1,$val);
+ oci_set_client_identifier($c1,$val);
+ oci_set_client_info($c1,$val);
+ $r = oci_set_action($c1,$val);
+ if ($r) {
+ echo "Values set successfully to $val\n";
+ foreach($attr_array as $attr) {
get_attr($c1,$attr);
}
- }
+ }
}
clean_up($c);
diff --git a/ext/oci8/tests/connect.phpt b/ext/oci8/tests/connect.phpt
index d534e44871..f13d6fd421 100644
--- a/ext/oci8/tests/connect.phpt
+++ b/ext/oci8/tests/connect.phpt
@@ -8,10 +8,10 @@ oci_connect()
require __DIR__."/connect.inc";
if (!empty($dbase)) {
- var_dump(oci_connect($user, $password, $dbase));
+ var_dump(oci_connect($user, $password, $dbase));
}
else {
- var_dump(oci_connect($user, $password));
+ var_dump(oci_connect($user, $password));
}
echo "Done\n";
diff --git a/ext/oci8/tests/connect_1.phpt b/ext/oci8/tests/connect_1.phpt
index 6d76c8ddcc..297b0897b6 100644
--- a/ext/oci8/tests/connect_1.phpt
+++ b/ext/oci8/tests/connect_1.phpt
@@ -8,17 +8,17 @@ oci_pconnect() & oci_new_connect()
require __DIR__."/connect.inc";
if (!empty($dbase)) {
- var_dump($c1 = oci_pconnect($user, $password, $dbase));
+ var_dump($c1 = oci_pconnect($user, $password, $dbase));
}
else {
- var_dump($c1 = oci_pconnect($user, $password));
+ var_dump($c1 = oci_pconnect($user, $password));
}
if (!empty($dbase)) {
- var_dump($c2 = oci_new_connect($user, $password, $dbase));
+ var_dump($c2 = oci_new_connect($user, $password, $dbase));
}
else {
- var_dump($c2 = oci_new_connect($user, $password));
+ var_dump($c2 = oci_new_connect($user, $password));
}
var_dump(oci_close($c1));
diff --git a/ext/oci8/tests/connect_1_old.phpt b/ext/oci8/tests/connect_1_old.phpt
index 2014d59fe3..3ce756f51c 100644
--- a/ext/oci8/tests/connect_1_old.phpt
+++ b/ext/oci8/tests/connect_1_old.phpt
@@ -8,17 +8,17 @@ ociplogon() & ocinlogon()
require __DIR__."/connect.inc";
if (!empty($dbase)) {
- var_dump($c1 = ociplogon($user, $password, $dbase));
+ var_dump($c1 = ociplogon($user, $password, $dbase));
}
else {
- var_dump($c1 = ociplogon($user, $password));
+ var_dump($c1 = ociplogon($user, $password));
}
if (!empty($dbase)) {
- var_dump($c2 = ocinlogon($user, $password, $dbase));
+ var_dump($c2 = ocinlogon($user, $password, $dbase));
}
else {
- var_dump($c2 = ocinlogon($user, $password));
+ var_dump($c2 = ocinlogon($user, $password));
}
var_dump(ocilogoff($c1));
diff --git a/ext/oci8/tests/connect_old.phpt b/ext/oci8/tests/connect_old.phpt
index a2012bfd19..c55197fca1 100644
--- a/ext/oci8/tests/connect_old.phpt
+++ b/ext/oci8/tests/connect_old.phpt
@@ -8,10 +8,10 @@ ocilogon()
require __DIR__."/connect.inc";
if (!empty($dbase)) {
- var_dump(ocilogon($user, $password, $dbase));
+ var_dump(ocilogon($user, $password, $dbase));
}
else {
- var_dump(ocilogon($user, $password));
+ var_dump(ocilogon($user, $password));
}
echo "Done\n";
diff --git a/ext/oci8/tests/connect_scope1.phpt b/ext/oci8/tests/connect_scope1.phpt
index aefee2f882..684103b9f3 100644
--- a/ext/oci8/tests/connect_scope1.phpt
+++ b/ext/oci8/tests/connect_scope1.phpt
@@ -10,14 +10,14 @@ require(__DIR__.'/details.inc');
// Initialization
$stmtarray = array(
- "drop table connect_scope1_tab",
- "create table connect_scope1_tab (c1 number)",
+ "drop table connect_scope1_tab",
+ "create table connect_scope1_tab (c1 number)",
);
if (!empty($dbase))
- $c1 = oci_new_connect($user,$password,$dbase);
+ $c1 = oci_new_connect($user,$password,$dbase);
else
- $c1 = oci_new_connect($user,$password);
+ $c1 = oci_new_connect($user,$password);
oci8_test_sql_execute($c1, $stmtarray);
@@ -27,15 +27,15 @@ echo "Test 1 - oci_connect\n";
function f()
{
- global $user, $password, $dbase;
-
- if (!empty($dbase))
- $c = oci_connect($user,$password,$dbase);
- else
- $c = oci_connect($user,$password);
- $s = oci_parse($c, "insert into connect_scope1_tab values (1)");
- oci_execute($s, OCI_DEFAULT); // no commit
- return($s); // this keeps the connection refcount positive so the connection isn't closed
+ global $user, $password, $dbase;
+
+ if (!empty($dbase))
+ $c = oci_connect($user,$password,$dbase);
+ else
+ $c = oci_connect($user,$password);
+ $s = oci_parse($c, "insert into connect_scope1_tab values (1)");
+ oci_execute($s, OCI_DEFAULT); // no commit
+ return($s); // this keeps the connection refcount positive so the connection isn't closed
}
$s2 = f();
@@ -60,7 +60,7 @@ var_dump($r);
// Cleanup
$stmtarray = array(
- "drop table connect_scope1_tab"
+ "drop table connect_scope1_tab"
);
oci8_test_sql_execute($c1, $stmtarray);
diff --git a/ext/oci8/tests/connect_scope2.phpt b/ext/oci8/tests/connect_scope2.phpt
index aa192b1459..9a2de41e30 100644
--- a/ext/oci8/tests/connect_scope2.phpt
+++ b/ext/oci8/tests/connect_scope2.phpt
@@ -10,14 +10,14 @@ require(__DIR__.'/details.inc');
// Initialization
$stmtarray = array(
- "drop table connect_scope2_tab",
- "create table connect_scope2_tab (c1 number)",
+ "drop table connect_scope2_tab",
+ "create table connect_scope2_tab (c1 number)",
);
if (!empty($dbase))
- $c1 = oci_new_connect($user,$password,$dbase);
+ $c1 = oci_new_connect($user,$password,$dbase);
else
- $c1 = oci_new_connect($user,$password);
+ $c1 = oci_new_connect($user,$password);
oci8_test_sql_execute($c1, $stmtarray);
@@ -27,15 +27,15 @@ echo "Test 1 - oci_pconnect\n";
function f()
{
- global $user, $password, $dbase;
-
- if (!empty($dbase))
- $c = oci_pconnect($user,$password,$dbase);
- else
- $c = oci_pconnect($user,$password);
- $s = oci_parse($c, "insert into connect_scope2_tab values (1)");
- oci_execute($s, OCI_DEFAULT); // no commit
- return($s); // this keeps the connection refcount positive so the connection isn't closed
+ global $user, $password, $dbase;
+
+ if (!empty($dbase))
+ $c = oci_pconnect($user,$password,$dbase);
+ else
+ $c = oci_pconnect($user,$password);
+ $s = oci_parse($c, "insert into connect_scope2_tab values (1)");
+ oci_execute($s, OCI_DEFAULT); // no commit
+ return($s); // this keeps the connection refcount positive so the connection isn't closed
}
$s2 = f();
@@ -60,7 +60,7 @@ var_dump($r);
// Cleanup
$stmtarray = array(
- "drop table connect_scope2_tab"
+ "drop table connect_scope2_tab"
);
oci8_test_sql_execute($c1, $stmtarray);
diff --git a/ext/oci8/tests/connect_scope_try1.phpt b/ext/oci8/tests/connect_scope_try1.phpt
index d3628f9eaa..54f4cc552b 100644
--- a/ext/oci8/tests/connect_scope_try1.phpt
+++ b/ext/oci8/tests/connect_scope_try1.phpt
@@ -12,14 +12,14 @@ require(__DIR__.'/details.inc');
// Initialization
$stmtarray = array(
- "drop table scope_try1_tab",
- "create table scope_try1_tab (c1 number)"
+ "drop table scope_try1_tab",
+ "create table scope_try1_tab (c1 number)"
);
if (!empty($dbase))
- $c1 = oci_new_connect($user,$password,$dbase);
+ $c1 = oci_new_connect($user,$password,$dbase);
else
- $c1 = oci_new_connect($user,$password);
+ $c1 = oci_new_connect($user,$password);
oci8_test_sql_execute($c1, $stmtarray);
@@ -33,28 +33,28 @@ set_error_handler(function($x, $y) { throw new Exception($y, $x); });
try
{
- if (!empty($dbase))
- $c = oci_connect($user,$password,$dbase);
- else
- $c = oci_connect($user,$password);
- $s = oci_parse($c, "insert into scope_try1_tab values (1)");
- oci_execute($s, OCI_DEFAULT); // no commit
- $s = oci_parse($c, "insert into scope_try1_tab values (ABC)"); // syntax error -> throws exception
- oci_execute($s, OCI_DEFAULT); // no commit
+ if (!empty($dbase))
+ $c = oci_connect($user,$password,$dbase);
+ else
+ $c = oci_connect($user,$password);
+ $s = oci_parse($c, "insert into scope_try1_tab values (1)");
+ oci_execute($s, OCI_DEFAULT); // no commit
+ $s = oci_parse($c, "insert into scope_try1_tab values (ABC)"); // syntax error -> throws exception
+ oci_execute($s, OCI_DEFAULT); // no commit
}
catch (Exception $e)
{
- echo "Caught Exception: ". $e->getMessage(), "\n";
- var_dump($c);
+ echo "Caught Exception: ". $e->getMessage(), "\n";
+ var_dump($c);
- // Verify data is not yet committed
- $s1 = oci_parse($c1, "select * from scope_try1_tab");
- oci_execute($s1);
- oci_fetch_all($s1, $r);
- var_dump($r);
+ // Verify data is not yet committed
+ $s1 = oci_parse($c1, "select * from scope_try1_tab");
+ oci_execute($s1);
+ oci_fetch_all($s1, $r);
+ var_dump($r);
- // Now commit
- oci_commit($c);
+ // Now commit
+ oci_commit($c);
}
// Verify data was committed in the Catch block
@@ -67,7 +67,7 @@ var_dump($r);
// Cleanup
$stmtarray = array(
- "drop table scope_try1_tab"
+ "drop table scope_try1_tab"
);
oci8_test_sql_execute($c1, $stmtarray);
diff --git a/ext/oci8/tests/connect_scope_try2.phpt b/ext/oci8/tests/connect_scope_try2.phpt
index 76e6909f44..2ec7b78c5f 100644
--- a/ext/oci8/tests/connect_scope_try2.phpt
+++ b/ext/oci8/tests/connect_scope_try2.phpt
@@ -12,14 +12,14 @@ require(__DIR__.'/details.inc');
// Initialization
$stmtarray = array(
- "drop table scope_try2_tab",
- "create table scope_try2_tab (c1 number)"
+ "drop table scope_try2_tab",
+ "create table scope_try2_tab (c1 number)"
);
if (!empty($dbase))
- $c1 = oci_new_connect($user,$password,$dbase);
+ $c1 = oci_new_connect($user,$password,$dbase);
else
- $c1 = oci_new_connect($user,$password);
+ $c1 = oci_new_connect($user,$password);
oci8_test_sql_execute($c1, $stmtarray);
@@ -33,28 +33,28 @@ set_error_handler(function($x, $y) { throw new Exception($y, $x); });
try
{
- if (!empty($dbase))
- $c = oci_connect($user,$password,$dbase);
- else
- $c = oci_connect($user,$password);
- $s = oci_parse($c, "insert into scope_try2_tab values (1)");
- oci_execute($s, OCI_DEFAULT); // no commit
- $s = oci_parse($c, "insert into scope_try2_tab values (ABC)"); // syntax error -> throws exception
- oci_execute($s, OCI_DEFAULT); // no commit
+ if (!empty($dbase))
+ $c = oci_connect($user,$password,$dbase);
+ else
+ $c = oci_connect($user,$password);
+ $s = oci_parse($c, "insert into scope_try2_tab values (1)");
+ oci_execute($s, OCI_DEFAULT); // no commit
+ $s = oci_parse($c, "insert into scope_try2_tab values (ABC)"); // syntax error -> throws exception
+ oci_execute($s, OCI_DEFAULT); // no commit
}
catch (Exception $e)
{
- echo "Caught Exception: ". $e->getMessage(), "\n";
- var_dump($c);
+ echo "Caught Exception: ". $e->getMessage(), "\n";
+ var_dump($c);
- // Verify data is not yet committed
- $s1 = oci_parse($c1, "select * from scope_try2_tab");
- oci_execute($s1);
- oci_fetch_all($s1, $r);
- var_dump($r);
+ // Verify data is not yet committed
+ $s1 = oci_parse($c1, "select * from scope_try2_tab");
+ oci_execute($s1);
+ oci_fetch_all($s1, $r);
+ var_dump($r);
- // Now commit
- oci_commit($c);
+ // Now commit
+ oci_commit($c);
}
// Verify data was committed in the Catch block
@@ -67,7 +67,7 @@ var_dump($r);
// Cleanup
$stmtarray = array(
- "drop table scope_try2_tab"
+ "drop table scope_try2_tab"
);
oci8_test_sql_execute($c1, $stmtarray);
diff --git a/ext/oci8/tests/connect_scope_try3.phpt b/ext/oci8/tests/connect_scope_try3.phpt
index d9cbfce355..7c09750410 100644
--- a/ext/oci8/tests/connect_scope_try3.phpt
+++ b/ext/oci8/tests/connect_scope_try3.phpt
@@ -12,14 +12,14 @@ require(__DIR__.'/details.inc');
// Initialization
$stmtarray = array(
- "drop table scope_try3_tab",
- "create table scope_try3_tab (c1 number)"
+ "drop table scope_try3_tab",
+ "create table scope_try3_tab (c1 number)"
);
if (!empty($dbase))
- $c1 = oci_new_connect($user,$password,$dbase);
+ $c1 = oci_new_connect($user,$password,$dbase);
else
- $c1 = oci_new_connect($user,$password);
+ $c1 = oci_new_connect($user,$password);
oci8_test_sql_execute($c1, $stmtarray);
@@ -33,28 +33,28 @@ set_error_handler(function($x, $y) { throw new Exception($y, $x); });
try
{
- if (!empty($dbase))
- $c = oci_new_connect($user,$password,$dbase);
- else
- $c = oci_new_connect($user,$password);
- $s = oci_parse($c, "insert into scope_try3_tab values (1)");
- oci_execute($s, OCI_DEFAULT); // no commit
- $s = oci_parse($c, "insert into scope_try3_tab values (ABC)"); // syntax error -> throws exception
- oci_execute($s, OCI_DEFAULT); // no commit
+ if (!empty($dbase))
+ $c = oci_new_connect($user,$password,$dbase);
+ else
+ $c = oci_new_connect($user,$password);
+ $s = oci_parse($c, "insert into scope_try3_tab values (1)");
+ oci_execute($s, OCI_DEFAULT); // no commit
+ $s = oci_parse($c, "insert into scope_try3_tab values (ABC)"); // syntax error -> throws exception
+ oci_execute($s, OCI_DEFAULT); // no commit
}
catch (Exception $e)
{
- echo "Caught Exception: ". $e->getMessage(), "\n";
- var_dump($c);
+ echo "Caught Exception: ". $e->getMessage(), "\n";
+ var_dump($c);
- // Verify data is not yet committed
- $s1 = oci_parse($c1, "select * from scope_try3_tab");
- oci_execute($s1);
- oci_fetch_all($s1, $r);
- var_dump($r);
+ // Verify data is not yet committed
+ $s1 = oci_parse($c1, "select * from scope_try3_tab");
+ oci_execute($s1);
+ oci_fetch_all($s1, $r);
+ var_dump($r);
- // Now commit
- oci_commit($c);
+ // Now commit
+ oci_commit($c);
}
// Verify data was committed in the Catch block
@@ -67,7 +67,7 @@ var_dump($r);
// Cleanup
$stmtarray = array(
- "drop table scope_try3_tab"
+ "drop table scope_try3_tab"
);
oci8_test_sql_execute($c1, $stmtarray);
diff --git a/ext/oci8/tests/connect_scope_try4.phpt b/ext/oci8/tests/connect_scope_try4.phpt
index cdefe36ee9..04f82712a8 100644
--- a/ext/oci8/tests/connect_scope_try4.phpt
+++ b/ext/oci8/tests/connect_scope_try4.phpt
@@ -12,14 +12,14 @@ require(__DIR__.'/details.inc');
// Initialization
$stmtarray = array(
- "drop table scope_try4_tab",
- "create table scope_try4_tab (c1 number)"
+ "drop table scope_try4_tab",
+ "create table scope_try4_tab (c1 number)"
);
if (!empty($dbase))
- $c1 = oci_new_connect($user,$password,$dbase);
+ $c1 = oci_new_connect($user,$password,$dbase);
else
- $c1 = oci_new_connect($user,$password);
+ $c1 = oci_new_connect($user,$password);
oci8_test_sql_execute($c1, $stmtarray);
@@ -33,28 +33,28 @@ set_error_handler(function($x, $y) { throw new Exception($y, $x); });
try
{
- if (!empty($dbase))
- $c = oci_new_connect($user,$password,$dbase);
- else
- $c = oci_new_connect($user,$password);
- $s = oci_parse($c, "insert into scope_try4_tab values (1)");
- oci_execute($s, OCI_DEFAULT); // no commit
- $s = oci_parse($c, "insert into scope_try4_tab values (ABC)"); // syntax error -> throws exception
- oci_execute($s, OCI_DEFAULT); // no commit
+ if (!empty($dbase))
+ $c = oci_new_connect($user,$password,$dbase);
+ else
+ $c = oci_new_connect($user,$password);
+ $s = oci_parse($c, "insert into scope_try4_tab values (1)");
+ oci_execute($s, OCI_DEFAULT); // no commit
+ $s = oci_parse($c, "insert into scope_try4_tab values (ABC)"); // syntax error -> throws exception
+ oci_execute($s, OCI_DEFAULT); // no commit
}
catch (Exception $e)
{
- echo "Caught Exception: ". $e->getMessage(), "\n";
- var_dump($c);
+ echo "Caught Exception: ". $e->getMessage(), "\n";
+ var_dump($c);
- // Verify data is not yet committed
- $s1 = oci_parse($c1, "select * from scope_try4_tab");
- oci_execute($s1);
- oci_fetch_all($s1, $r);
- var_dump($r);
+ // Verify data is not yet committed
+ $s1 = oci_parse($c1, "select * from scope_try4_tab");
+ oci_execute($s1);
+ oci_fetch_all($s1, $r);
+ var_dump($r);
- // Now commit
- oci_commit($c);
+ // Now commit
+ oci_commit($c);
}
// Verify data was committed in the Catch block
@@ -67,7 +67,7 @@ var_dump($r);
// Cleanup
$stmtarray = array(
- "drop table scope_try4_tab"
+ "drop table scope_try4_tab"
);
oci8_test_sql_execute($c1, $stmtarray);
diff --git a/ext/oci8/tests/connect_scope_try5.phpt b/ext/oci8/tests/connect_scope_try5.phpt
index 1e99d0a2e1..43b7ff0049 100644
--- a/ext/oci8/tests/connect_scope_try5.phpt
+++ b/ext/oci8/tests/connect_scope_try5.phpt
@@ -12,14 +12,14 @@ require(__DIR__.'/details.inc');
// Initialization
$stmtarray = array(
- "drop table scope_try5_tab",
- "create table scope_try5_tab (c1 number)"
+ "drop table scope_try5_tab",
+ "create table scope_try5_tab (c1 number)"
);
if (!empty($dbase))
- $c1 = oci_new_connect($user,$password,$dbase);
+ $c1 = oci_new_connect($user,$password,$dbase);
else
- $c1 = oci_new_connect($user,$password);
+ $c1 = oci_new_connect($user,$password);
oci8_test_sql_execute($c1, $stmtarray);
@@ -33,28 +33,28 @@ set_error_handler(function($x, $y) { throw new Exception($y, $x); });
try
{
- if (!empty($dbase))
- $c = oci_pconnect($user,$password,$dbase);
- else
- $c = oci_pconnect($user,$password);
- $s = oci_parse($c, "insert into scope_try5_tab values (1)");
- oci_execute($s, OCI_DEFAULT); // no commit
- $s = oci_parse($c, "insert into scope_try5_tab values (ABC)"); // syntax error -> throws exception
- oci_execute($s, OCI_DEFAULT); // no commit
+ if (!empty($dbase))
+ $c = oci_pconnect($user,$password,$dbase);
+ else
+ $c = oci_pconnect($user,$password);
+ $s = oci_parse($c, "insert into scope_try5_tab values (1)");
+ oci_execute($s, OCI_DEFAULT); // no commit
+ $s = oci_parse($c, "insert into scope_try5_tab values (ABC)"); // syntax error -> throws exception
+ oci_execute($s, OCI_DEFAULT); // no commit
}
catch (Exception $e)
{
- echo "Caught Exception: ". $e->getMessage(), "\n";
- var_dump($c);
+ echo "Caught Exception: ". $e->getMessage(), "\n";
+ var_dump($c);
- // Verify data is not yet committed
- $s1 = oci_parse($c1, "select * from scope_try5_tab");
- oci_execute($s1);
- oci_fetch_all($s1, $r);
- var_dump($r);
+ // Verify data is not yet committed
+ $s1 = oci_parse($c1, "select * from scope_try5_tab");
+ oci_execute($s1);
+ oci_fetch_all($s1, $r);
+ var_dump($r);
- // Now commit
- oci_commit($c);
+ // Now commit
+ oci_commit($c);
}
// Verify data was committed in the Catch block
@@ -67,7 +67,7 @@ var_dump($r);
// Cleanup
$stmtarray = array(
- "drop table scope_try5_tab"
+ "drop table scope_try5_tab"
);
oci8_test_sql_execute($c1, $stmtarray);
diff --git a/ext/oci8/tests/connect_scope_try6.phpt b/ext/oci8/tests/connect_scope_try6.phpt
index 84ea97ac43..fc31bddfd8 100644
--- a/ext/oci8/tests/connect_scope_try6.phpt
+++ b/ext/oci8/tests/connect_scope_try6.phpt
@@ -12,14 +12,14 @@ require(__DIR__.'/details.inc');
// Initialization
$stmtarray = array(
- "drop table scope_try6_tab",
- "create table scope_try6_tab (c1 number)"
+ "drop table scope_try6_tab",
+ "create table scope_try6_tab (c1 number)"
);
if (!empty($dbase))
- $c1 = oci_new_connect($user,$password,$dbase);
+ $c1 = oci_new_connect($user,$password,$dbase);
else
- $c1 = oci_new_connect($user,$password);
+ $c1 = oci_new_connect($user,$password);
oci8_test_sql_execute($c1, $stmtarray);
@@ -33,28 +33,28 @@ set_error_handler(function($x, $y) { throw new Exception($y, $x); });
try
{
- if (!empty($dbase))
- $c = oci_pconnect($user,$password,$dbase);
- else
- $c = oci_pconnect($user,$password);
- $s = oci_parse($c, "insert into scope_try6_tab values (1)");
- oci_execute($s, OCI_DEFAULT); // no commit
- $s = oci_parse($c, "insert into scope_try6_tab values (ABC)"); // syntax error -> throws exception
- oci_execute($s, OCI_DEFAULT); // no commit
+ if (!empty($dbase))
+ $c = oci_pconnect($user,$password,$dbase);
+ else
+ $c = oci_pconnect($user,$password);
+ $s = oci_parse($c, "insert into scope_try6_tab values (1)");
+ oci_execute($s, OCI_DEFAULT); // no commit
+ $s = oci_parse($c, "insert into scope_try6_tab values (ABC)"); // syntax error -> throws exception
+ oci_execute($s, OCI_DEFAULT); // no commit
}
catch (Exception $e)
{
- echo "Caught Exception: ". $e->getMessage(), "\n";
- var_dump($c);
+ echo "Caught Exception: ". $e->getMessage(), "\n";
+ var_dump($c);
- // Verify data is not yet committed
- $s1 = oci_parse($c1, "select * from scope_try6_tab");
- oci_execute($s1);
- oci_fetch_all($s1, $r);
- var_dump($r);
+ // Verify data is not yet committed
+ $s1 = oci_parse($c1, "select * from scope_try6_tab");
+ oci_execute($s1);
+ oci_fetch_all($s1, $r);
+ var_dump($r);
- // Now commit
- oci_commit($c);
+ // Now commit
+ oci_commit($c);
}
// Verify data was committed in the Catch block
@@ -67,7 +67,7 @@ var_dump($r);
// Cleanup
$stmtarray = array(
- "drop table scope_try6_tab"
+ "drop table scope_try6_tab"
);
oci8_test_sql_execute($c1, $stmtarray);
diff --git a/ext/oci8/tests/connect_without_oracle_home.phpt b/ext/oci8/tests/connect_without_oracle_home.phpt
index d83f30e0e9..203fd57e92 100644
--- a/ext/oci8/tests/connect_without_oracle_home.phpt
+++ b/ext/oci8/tests/connect_without_oracle_home.phpt
@@ -23,16 +23,13 @@ ORACLE_HOME=""
require __DIR__."/details.inc";
if (!empty($dbase)) {
- var_dump(oci_connect($user, $password, $dbase));
+ var_dump(oci_connect($user, $password, $dbase));
}
else {
- var_dump(oci_connect($user, $password));
+ var_dump(oci_connect($user, $password));
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Warning: oci_connect(): OCIEnvNlsCreate() failed. There is something wrong with your system - please check that ORACLE_HOME and %s are set and point to the right directories in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/oci8/tests/connect_without_oracle_home_11.phpt b/ext/oci8/tests/connect_without_oracle_home_11.phpt
index a7c3fbba83..85ac993877 100644
--- a/ext/oci8/tests/connect_without_oracle_home_11.phpt
+++ b/ext/oci8/tests/connect_without_oracle_home_11.phpt
@@ -26,19 +26,16 @@ ORACLE_HOME=""
require __DIR__."/details.inc";
if (!empty($dbase)) {
- var_dump(oci_connect($user, $password, $dbase));
+ var_dump(oci_connect($user, $password, $dbase));
}
else {
- var_dump(oci_connect($user, $password));
+ var_dump(oci_connect($user, $password));
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Warning: oci_connect(): OCIEnvNlsCreate() failed. There is something wrong with your system - please check that ORACLE_HOME and %s are set and point to the right directories in %s on line %d
Warning: oci_connect(): Error while trying to retrieve text for error ORA-01804
in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/oci8/tests/connect_without_oracle_home_old.phpt b/ext/oci8/tests/connect_without_oracle_home_old.phpt
index d77b3e3699..bd217acd77 100644
--- a/ext/oci8/tests/connect_without_oracle_home_old.phpt
+++ b/ext/oci8/tests/connect_without_oracle_home_old.phpt
@@ -19,19 +19,16 @@ ORACLE_HOME=""
require __DIR__."/details.inc";
if (!empty($dbase)) {
- var_dump(ocilogon($user, $password, $dbase));
+ var_dump(ocilogon($user, $password, $dbase));
}
else {
- var_dump(ocilogon($user, $password));
+ var_dump(ocilogon($user, $password));
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Warning: ocilogon(): OCIEnvNlsCreate() failed. There is something wrong with your system - please check that ORACLE_HOME and %s are set and point to the right directories in %s on line %d
Warning: ocilogon(): %s ORA-01804
in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/oci8/tests/connect_without_oracle_home_old_11.phpt b/ext/oci8/tests/connect_without_oracle_home_old_11.phpt
index c3c21f9d4c..243741bfde 100644
--- a/ext/oci8/tests/connect_without_oracle_home_old_11.phpt
+++ b/ext/oci8/tests/connect_without_oracle_home_old_11.phpt
@@ -26,19 +26,16 @@ ORACLE_HOME=""
require __DIR__."/details.inc";
if (!empty($dbase)) {
- var_dump(ocilogon($user, $password, $dbase));
+ var_dump(ocilogon($user, $password, $dbase));
}
else {
- var_dump(ocilogon($user, $password));
+ var_dump(ocilogon($user, $password));
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Warning: ocilogon(): OCIEnvNlsCreate() failed. There is something wrong with your system - please check that ORACLE_HOME and %s are set and point to the right directories in %s on line %d
Warning: ocilogon(): Error while trying to retrieve text for error ORA-01804
in %sconnect_without_oracle_home_old_11.php on line %d
bool(false)
-===DONE===
diff --git a/ext/oci8/tests/cursor_bind.phpt b/ext/oci8/tests/cursor_bind.phpt
index d0f862b0d6..17b4b0d91a 100644
--- a/ext/oci8/tests/cursor_bind.phpt
+++ b/ext/oci8/tests/cursor_bind.phpt
@@ -54,8 +54,6 @@ $stmtarray = array(
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
array(2) {
[0]=>
@@ -76,4 +74,3 @@ array(2) {
string(1) "1"
}
bool(false)
-===DONE===
diff --git a/ext/oci8/tests/cursors.phpt b/ext/oci8/tests/cursors.phpt
index 8a33f51649..a9fa0dcb41 100644
--- a/ext/oci8/tests/cursors.phpt
+++ b/ext/oci8/tests/cursors.phpt
@@ -14,17 +14,17 @@ require __DIR__."/create_table.inc";
$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)";
if (!($s = oci_parse($c, $insert_sql))) {
- die("oci_parse(insert) failed!\n");
+ die("oci_parse(insert) failed!\n");
}
for ($i = 0; $i<3; $i++) {
- if (!oci_execute($s)) {
- die("oci_execute(insert) failed!\n");
- }
+ if (!oci_execute($s)) {
+ die("oci_execute(insert) failed!\n");
+ }
}
if (!oci_commit($c)) {
- die("oci_commit() failed!\n");
+ die("oci_commit() failed!\n");
}
$sql = "select CURSOR(select * from ".$schema.$table_name.") as curs FROM dual";
@@ -33,13 +33,13 @@ $stmt = oci_parse($c, $sql);
oci_execute($stmt);
while ($data = oci_fetch_assoc($stmt)) {
- oci_execute($data["CURS"]);
- $subdata = oci_fetch_assoc($data["CURS"]);
- var_dump($subdata);
- var_dump(oci_cancel($data["CURS"]));
- $subdata = oci_fetch_assoc($data["CURS"]);
- var_dump($subdata);
- var_dump(oci_cancel($data["CURS"]));
+ oci_execute($data["CURS"]);
+ $subdata = oci_fetch_assoc($data["CURS"]);
+ var_dump($subdata);
+ var_dump(oci_cancel($data["CURS"]));
+ $subdata = oci_fetch_assoc($data["CURS"]);
+ var_dump($subdata);
+ var_dump(oci_cancel($data["CURS"]));
}
require __DIR__."/drop_table.inc";
diff --git a/ext/oci8/tests/cursors_old.phpt b/ext/oci8/tests/cursors_old.phpt
index b130da5165..7c5c668f62 100644
--- a/ext/oci8/tests/cursors_old.phpt
+++ b/ext/oci8/tests/cursors_old.phpt
@@ -30,13 +30,13 @@ $stmt = ociparse($c, $sql);
ociexecute($stmt);
while ($result = ocifetchinto($stmt, $data, OCI_ASSOC)) {
- ociexecute($data["CURS"]);
- ocifetchinto($data["CURS"], $subdata, OCI_ASSOC);
- var_dump($subdata);
- var_dump(ocicancel($data["CURS"]));
- ocifetchinto($data["CURS"], $subdata, OCI_ASSOC);
- var_dump($subdata);
- var_dump(ocicancel($data["CURS"]));
+ ociexecute($data["CURS"]);
+ ocifetchinto($data["CURS"], $subdata, OCI_ASSOC);
+ var_dump($subdata);
+ var_dump(ocicancel($data["CURS"]));
+ ocifetchinto($data["CURS"], $subdata, OCI_ASSOC);
+ var_dump($subdata);
+ var_dump(ocicancel($data["CURS"]));
}
// Cleanup
diff --git a/ext/oci8/tests/db_op_1.phpt b/ext/oci8/tests/db_op_1.phpt
index 7ca97952d7..70941839f7 100644
--- a/ext/oci8/tests/db_op_1.phpt
+++ b/ext/oci8/tests/db_op_1.phpt
@@ -41,8 +41,6 @@ dq($c, 'select /*+ MONITOR */ * from dual');
dq($c, 'select dbop_name from v$sql_monitor where dbop_name is not null order by dbop_exec_id desc');
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Test 1
array(1) {
@@ -53,4 +51,3 @@ array(1) {
["DBOP_NAME"]=>
string(7) "db_op_1"
}
-===DONE===
diff --git a/ext/oci8/tests/db_op_2.phpt b/ext/oci8/tests/db_op_2.phpt
index 26c5d30865..4d4624b737 100644
--- a/ext/oci8/tests/db_op_2.phpt
+++ b/ext/oci8/tests/db_op_2.phpt
@@ -49,8 +49,6 @@ dq($c, 'select /*+ MONITOR */ \'dboptest\' from dual');
dq($c, 'select sql_text, dbop_name from v$sql_monitor where sql_text like \'%dboptest%\' order by dbop_exec_id desc');
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Test 1
array(1) {
@@ -76,4 +74,3 @@ array(2) {
["DBOP_NAME"]=>
NULL
}
-===DONE===
diff --git a/ext/oci8/tests/dbmsoutput.phpt b/ext/oci8/tests/dbmsoutput.phpt
index 40da29654d..01ba9db0b5 100644
--- a/ext/oci8/tests/dbmsoutput.phpt
+++ b/ext/oci8/tests/dbmsoutput.phpt
@@ -71,20 +71,20 @@ function getdbmsoutput_do($c)
function getdbmsoutput_do2($c)
{
- $orignumlines = $numlines = 100;
- $s = oci_parse($c, "begin dbms_output.get_lines(:lines, :numlines); end;");
- $r = oci_bind_by_name($s, ":numlines", $numlines);
- $res = array();
- while ($numlines >= $orignumlines) {
- oci_bind_array_by_name($s, ":lines", $lines, $numlines, 255, SQLT_CHR);
- oci_execute($s);
- if ($numlines == 0) {
- break;
- }
- $res = array_merge($res, array_slice($lines, 0, $numlines));
- unset($lines);
- }
- return $res;
+ $orignumlines = $numlines = 100;
+ $s = oci_parse($c, "begin dbms_output.get_lines(:lines, :numlines); end;");
+ $r = oci_bind_by_name($s, ":numlines", $numlines);
+ $res = array();
+ while ($numlines >= $orignumlines) {
+ oci_bind_array_by_name($s, ":lines", $lines, $numlines, 255, SQLT_CHR);
+ oci_execute($s);
+ if ($numlines == 0) {
+ break;
+ }
+ $res = array_merge($res, array_slice($lines, 0, $numlines));
+ unset($lines);
+ }
+ return $res;
}
function getdbmsoutput_pl($c)
@@ -124,14 +124,12 @@ var_dump(getdbmsoutput_pl($c));
// Clean up
$stmtarray = array(
- "drop procedure dbmsoutput_proc"
+ "drop procedure dbmsoutput_proc"
);
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Test 1
array(1) {
@@ -747,4 +745,3 @@ array(100) {
[99]=>
string(53) "99 test 4 Hello, world! Lots and lots and ... of text"
}
-===DONE===
diff --git a/ext/oci8/tests/debug.phpt b/ext/oci8/tests/debug.phpt
index a197639af6..f66eeb9698 100644
--- a/ext/oci8/tests/debug.phpt
+++ b/ext/oci8/tests/debug.phpt
@@ -10,10 +10,10 @@ require(__DIR__."/details.inc");
oci_internal_debug(true);
if (!empty($dbase)) {
- oci_connect($user, $password, $dbase);
+ oci_connect($user, $password, $dbase);
}
else {
- oci_connect($user, $password);
+ oci_connect($user, $password);
}
oci_internal_debug(false);
diff --git a/ext/oci8/tests/default_prefetch0.phpt b/ext/oci8/tests/default_prefetch0.phpt
index 6a62328713..4dce73431c 100644
--- a/ext/oci8/tests/default_prefetch0.phpt
+++ b/ext/oci8/tests/default_prefetch0.phpt
@@ -26,11 +26,11 @@ oci8_test_sql_execute($c, $stmtarray);
$select_sql = "select * from default_prefetch_tab";
if (!($s = oci_parse($c, $select_sql))) {
- die("oci_parse(select) failed!\n");
+ die("oci_parse(select) failed!\n");
}
if (!oci_execute($s)) {
- die("oci_execute(select) failed!\n");
+ die("oci_execute(select) failed!\n");
}
var_dump(oci_fetch($s));
diff --git a/ext/oci8/tests/default_prefetch1.phpt b/ext/oci8/tests/default_prefetch1.phpt
index ca9590a82f..dbe92e75f4 100644
--- a/ext/oci8/tests/default_prefetch1.phpt
+++ b/ext/oci8/tests/default_prefetch1.phpt
@@ -26,11 +26,11 @@ oci8_test_sql_execute($c, $stmtarray);
$select_sql = "select * from default_prefetch1_tab";
if (!($s = oci_parse($c, $select_sql))) {
- die("oci_parse(select) failed!\n");
+ die("oci_parse(select) failed!\n");
}
if (!oci_execute($s)) {
- die("oci_execute(select) failed!\n");
+ die("oci_execute(select) failed!\n");
}
var_dump(oci_fetch($s));
diff --git a/ext/oci8/tests/default_prefetch2.phpt b/ext/oci8/tests/default_prefetch2.phpt
index 1d2a80b845..6d01fb1bac 100644
--- a/ext/oci8/tests/default_prefetch2.phpt
+++ b/ext/oci8/tests/default_prefetch2.phpt
@@ -26,13 +26,13 @@ oci8_test_sql_execute($c, $stmtarray);
$select_sql = "select * from default_prefetch2_tab";
if (!($s = oci_parse($c, $select_sql))) {
- die("oci_parse(select) failed!\n");
+ die("oci_parse(select) failed!\n");
}
var_dump(oci_set_prefetch($s, 10));
if (!oci_execute($s)) {
- die("oci_execute(select) failed!\n");
+ die("oci_execute(select) failed!\n");
}
var_dump(oci_fetch($s));
diff --git a/ext/oci8/tests/define.phpt b/ext/oci8/tests/define.phpt
index e3f19e6337..8fd459e10e 100644
--- a/ext/oci8/tests/define.phpt
+++ b/ext/oci8/tests/define.phpt
@@ -29,7 +29,7 @@ oci_define_by_name($stmt, "STRING", $string, 20);
oci_execute($stmt);
while (oci_fetch($stmt)) {
- var_dump($string);
+ var_dump($string);
}
// Cleanup
diff --git a/ext/oci8/tests/define0.phpt b/ext/oci8/tests/define0.phpt
index b783ec647c..fecbf23757 100644
--- a/ext/oci8/tests/define0.phpt
+++ b/ext/oci8/tests/define0.phpt
@@ -29,7 +29,7 @@ $string = '';
oci_define_by_name($stmt, "STRING", $string, 20);
oci_execute($stmt);
while (oci_fetch($stmt)) {
- var_dump($string);
+ var_dump($string);
}
echo "Test 2\n";
@@ -51,11 +51,8 @@ $stmtarray = array(
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Test 1
string(%d) "some"
Test 2
string(%d) "some"
-===DONE===
diff --git a/ext/oci8/tests/define1.phpt b/ext/oci8/tests/define1.phpt
index 28c4b7f1f4..37efddafb9 100644
--- a/ext/oci8/tests/define1.phpt
+++ b/ext/oci8/tests/define1.phpt
@@ -32,7 +32,7 @@ var_dump(oci_define_by_name($stmt, ""));
oci_execute($stmt);
while (oci_fetch($stmt)) {
- var_dump($string);
+ var_dump($string);
}
// Cleanup
diff --git a/ext/oci8/tests/define2.phpt b/ext/oci8/tests/define2.phpt
index a018bbcb44..9dbac4620b 100644
--- a/ext/oci8/tests/define2.phpt
+++ b/ext/oci8/tests/define2.phpt
@@ -11,8 +11,8 @@ require(__DIR__.'/skipif.inc');
require(__DIR__."/connect.inc");
$stmtarray = array(
- "drop table phptestrawtable",
- "create table phptestrawtable( id number(10), fileimage raw(1000))"
+ "drop table phptestrawtable",
+ "create table phptestrawtable( id number(10), fileimage raw(1000))"
);
oci8_test_sql_execute($c, $stmtarray);
@@ -34,8 +34,8 @@ var_dump(oci_define_by_name($stmt, 'FILEIMAGE', $fi));
oci_execute($stmt);
while (oci_fetch($stmt)) {
- var_dump($fi);
- echo "file md5:" . md5($fi) . "\n";
+ var_dump($fi);
+ echo "file md5:" . md5($fi) . "\n";
}
echo "Test 2\n";
@@ -44,8 +44,8 @@ var_dump(oci_define_by_name($stmt, 'FILEIMAGE', $fi));
oci_execute($stmt);
while (oci_fetch($stmt)) {
- var_dump($fi);
- echo "file md5:" . md5($fi) . "\n";
+ var_dump($fi);
+ echo "file md5:" . md5($fi) . "\n";
}
echo "Test 3 - test repeatability\n";
@@ -54,8 +54,8 @@ var_dump(oci_define_by_name($stmt, 'FILEIMAGE', $fi, SQLT_STR));
oci_execute($stmt);
while (oci_fetch($stmt)) {
- var_dump($fi);
- echo "file md5:" . md5($fi) . "\n";
+ var_dump($fi);
+ echo "file md5:" . md5($fi) . "\n";
}
echo "Test 4 - wrong type\n";
@@ -64,8 +64,8 @@ var_dump(oci_define_by_name($stmt, 'FILEIMAGE', $fi, SQLT_RSET));
oci_execute($stmt);
while (oci_fetch($stmt)) {
- var_dump($fi);
- echo "file md5:" . md5($fi) . "\n";
+ var_dump($fi);
+ echo "file md5:" . md5($fi) . "\n";
}
// Cleanup
diff --git a/ext/oci8/tests/define3.phpt b/ext/oci8/tests/define3.phpt
index 669ae39d93..e70f636938 100644
--- a/ext/oci8/tests/define3.phpt
+++ b/ext/oci8/tests/define3.phpt
@@ -11,8 +11,8 @@ require(__DIR__.'/skipif.inc');
require(__DIR__."/connect.inc");
$stmtarray = array(
- "drop table phpdefblobtable",
- "create table phpdefblobtable (id number(10), fileimage blob)"
+ "drop table phpdefblobtable",
+ "create table phpdefblobtable (id number(10), fileimage blob)"
);
oci8_test_sql_execute($c, $stmtarray);
@@ -76,7 +76,7 @@ while (oci_fetch($stmt)) {
}
$stmtarray = array(
- "drop table phpdefblobtable"
+ "drop table phpdefblobtable"
);
oci8_test_sql_execute($c, $stmtarray);
diff --git a/ext/oci8/tests/define4.phpt b/ext/oci8/tests/define4.phpt
index 25296f96d3..d7ffc3fd58 100644
--- a/ext/oci8/tests/define4.phpt
+++ b/ext/oci8/tests/define4.phpt
@@ -30,12 +30,12 @@ oci_execute($stmt);
echo "Test 2\n";
while (oci_fetch($stmt)) {
- var_dump(oci_result($stmt, 'VALUE'));
- var_dump($string);
- var_dump(oci_result($stmt, 'STRING'));
- var_dump($string);
- var_dump(oci_result($stmt, 'VALUE'));
- var_dump(oci_result($stmt, 'STRING'));
+ var_dump(oci_result($stmt, 'VALUE'));
+ var_dump($string);
+ var_dump(oci_result($stmt, 'STRING'));
+ var_dump($string);
+ var_dump(oci_result($stmt, 'VALUE'));
+ var_dump(oci_result($stmt, 'STRING'));
}
echo "Test 3\n";
diff --git a/ext/oci8/tests/define5.phpt b/ext/oci8/tests/define5.phpt
index 2dd9980d45..3f1e57741b 100644
--- a/ext/oci8/tests/define5.phpt
+++ b/ext/oci8/tests/define5.phpt
@@ -25,8 +25,8 @@ $stmt = oci_parse($c, "select string from define5_tab where id = 1");
oci_execute($stmt);
var_dump(oci_define_by_name($stmt, "STRING", $string));
while (oci_fetch($stmt)) {
- var_dump($string); // gives NULL
- var_dump(oci_result($stmt, 'STRING'));
+ var_dump($string); // gives NULL
+ var_dump(oci_result($stmt, 'STRING'));
}
echo "Test 2 - normal define order\n";
@@ -35,15 +35,15 @@ var_dump(oci_define_by_name($stmt, "STRING", $string));
oci_execute($stmt);
while (oci_fetch($stmt)) {
- var_dump($string);
+ var_dump($string);
}
echo "Test 3 - no new define done\n";
$stmt = oci_parse($c, "select string from define5_tab where id = 2");
oci_execute($stmt);
while (oci_fetch($stmt)) {
- var_dump($string); // not updated with new value
- var_dump(oci_result($stmt, 'STRING'));
+ var_dump($string); // not updated with new value
+ var_dump(oci_result($stmt, 'STRING'));
}
// Cleanup
diff --git a/ext/oci8/tests/define6.phpt b/ext/oci8/tests/define6.phpt
index c23cd452c6..a59ba30a60 100644
--- a/ext/oci8/tests/define6.phpt
+++ b/ext/oci8/tests/define6.phpt
@@ -119,8 +119,6 @@ $stmtarray = array(
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Test 1 - define last
NULL
@@ -135,4 +133,3 @@ string(1) "1"
Test 6 - fetch on wrong handle
Warning: oci_fetch_row(): ORA-24374: %s in %sdefine6.php on line %d
-===DONE===
diff --git a/ext/oci8/tests/define_old.phpt b/ext/oci8/tests/define_old.phpt
index 634a86d370..25458e1283 100644
--- a/ext/oci8/tests/define_old.phpt
+++ b/ext/oci8/tests/define_old.phpt
@@ -29,7 +29,7 @@ ocidefinebyname($stmt, "STRING", $string, 20);
ociexecute($stmt);
while (ocifetch($stmt)) {
- var_dump($string);
+ var_dump($string);
}
// Cleanup
diff --git a/ext/oci8/tests/descriptors.phpt b/ext/oci8/tests/descriptors.phpt
index 193e1e76f8..44d4ab0a01 100644
--- a/ext/oci8/tests/descriptors.phpt
+++ b/ext/oci8/tests/descriptors.phpt
@@ -12,11 +12,11 @@ require __DIR__.'/connect.inc';
require __DIR__.'/create_table.inc';
$ora_sql = "INSERT INTO
- ".$schema.$table_name." (blob)
- VALUES (empty_blob())
- RETURNING
- blob
- INTO :v_blob ";
+ ".$schema.$table_name." (blob)
+ VALUES (empty_blob())
+ RETURNING
+ blob
+ INTO :v_blob ";
$statement = oci_parse($c,$ora_sql);
$blob = oci_new_descriptor($c,OCI_D_LOB);
diff --git a/ext/oci8/tests/details.inc b/ext/oci8/tests/details.inc
index 731b562d0a..101ebfcd79 100644
--- a/ext/oci8/tests/details.inc
+++ b/ext/oci8/tests/details.inc
@@ -12,32 +12,32 @@
*/
if (file_exists(dirname(__FILE__)."/details_local.inc")) {
- include(dirname(__FILE__)."/details_local.inc"); // this file is not part of the source distribution; make it your own local variant of details.inc
+ include(dirname(__FILE__)."/details_local.inc"); // this file is not part of the source distribution; make it your own local variant of details.inc
} else {
- if (false !== getenv('PHP_OCI8_TEST_DB')) {
- $user = getenv('PHP_OCI8_TEST_USER'); // Database username for tests
- $password = getenv('PHP_OCI8_TEST_PASS'); // Password for $user
- $dbase = getenv('PHP_OCI8_TEST_DB'); // Database connection string
- $test_drcp = getenv('PHP_OCI8_TEST_DRCP');
- if (false !== $test_drcp && 0 == strcasecmp($test_drcp,'TRUE')) {
- $test_drcp = TRUE;
- } else {
- $test_drcp = FALSE;
- }
- } else {
- $user = "system";
- $password = "oracle";
- $dbase = "localhost/XE";
- $test_drcp = FALSE;
- }
+ if (false !== getenv('PHP_OCI8_TEST_DB')) {
+ $user = getenv('PHP_OCI8_TEST_USER'); // Database username for tests
+ $password = getenv('PHP_OCI8_TEST_PASS'); // Password for $user
+ $dbase = getenv('PHP_OCI8_TEST_DB'); // Database connection string
+ $test_drcp = getenv('PHP_OCI8_TEST_DRCP');
+ if (false !== $test_drcp && 0 == strcasecmp($test_drcp,'TRUE')) {
+ $test_drcp = TRUE;
+ } else {
+ $test_drcp = FALSE;
+ }
+ } else {
+ $user = "system";
+ $password = "oracle";
+ $dbase = "localhost/XE";
+ $test_drcp = FALSE;
+ }
- /*
- * Common object names for scripts to use
- */
+ /*
+ * Common object names for scripts to use
+ */
- $table_name = "tb".substr(str_replace(Array(".", "-"), "_", php_uname("n")), 0, 5);
- $type_name = strtoupper("tp".substr(str_replace(Array(".", "-"), "_", php_uname("n")), 0, 5));
- $schema = '';
+ $table_name = "tb".substr(str_replace(Array(".", "-"), "_", php_uname("n")), 0, 5);
+ $type_name = strtoupper("tp".substr(str_replace(Array(".", "-"), "_", php_uname("n")), 0, 5));
+ $schema = '';
}
@@ -59,14 +59,14 @@ if (!function_exists('oci8_test_sql_execute')) {
if (!$r) {
$m = oci_error($s);
if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
+ 942 // table or view does not exist
, 1918 // user does not exist
, 2024 // database link not found
, 2289 // sequence does not exist
, 4080 // trigger does not exist
, 38802 // edition does not exist
))) {
- echo "oci8_test_sql_execute() error:". PHP_EOL . $stmt . PHP_EOL . $m['message'] . PHP_EOL;
+ echo "oci8_test_sql_execute() error:". PHP_EOL . $stmt . PHP_EOL . $m['message'] . PHP_EOL;
}
}
}
diff --git a/ext/oci8/tests/drcp_characterset.phpt b/ext/oci8/tests/drcp_characterset.phpt
index c5a5339e04..fdcacead93 100644
--- a/ext/oci8/tests/drcp_characterset.phpt
+++ b/ext/oci8/tests/drcp_characterset.phpt
@@ -31,17 +31,17 @@ var_dump($p2);
//character sets
if((int)$c1 === (int)$c2)
- echo "First and third connections share a resource: NOT OK\n";
+ echo "First and third connections share a resource: NOT OK\n";
else
- echo "First and third connections are different: OK\n";
+ echo "First and third connections are different: OK\n";
// The two connections p1 and p2 should not share resources as they use different
//character sets
if((int)$p1 === (int)$p2)
- echo "Second and fourth connections share a resource: NOT OK\n";
+ echo "Second and fourth connections share a resource: NOT OK\n";
else
- echo "Second and fourth connections are different: OK\n";
+ echo "Second and fourth connections are different: OK\n";
// Close all the connections
oci_close($c1);
diff --git a/ext/oci8/tests/drcp_conn_close1.phpt b/ext/oci8/tests/drcp_conn_close1.phpt
index 18ed1cec72..b1afb4779b 100644
--- a/ext/oci8/tests/drcp_conn_close1.phpt
+++ b/ext/oci8/tests/drcp_conn_close1.phpt
@@ -13,7 +13,7 @@ require __DIR__."/details.inc";
// Test will open a connection
// Close the connection
// Open another connection
-// With oci_close() being a no-op, the same conneciton will be returned
+// With oci_close() being a no-op, the same connection will be returned
echo "This is with a OCI_CONNECT\n";
@@ -30,9 +30,9 @@ oci_close($conn2);
// Compare the resource numbers
if ($rn1 === $rn2)
- echo "Both connections share a resource : OK\n";
+ echo "Both connections share a resource : OK\n";
else
- echo "Both connections are different : NOT OK\n";
+ echo "Both connections are different : NOT OK\n";
echo "Done\n";
diff --git a/ext/oci8/tests/drcp_conn_close2.phpt b/ext/oci8/tests/drcp_conn_close2.phpt
index 4a20c9cf72..cb4df083a6 100644
--- a/ext/oci8/tests/drcp_conn_close2.phpt
+++ b/ext/oci8/tests/drcp_conn_close2.phpt
@@ -14,7 +14,7 @@ require __DIR__."/details.inc";
// Close the connection
// Open another connection
// With oci_close() the connection is released to the pool and hence the
-// the second conneciton will be different
+// the second connection will be different
// OCI_CONNECT
@@ -31,9 +31,9 @@ oci_close($conn2);
// Compare the resource numbers
if ($rn1 === $rn2)
- echo "Both connections share a resource : NOT OK\n";
+ echo "Both connections share a resource : NOT OK\n";
else
- echo "Both connections are different : OK\n";
+ echo "Both connections are different : OK\n";
echo "Done\n";
diff --git a/ext/oci8/tests/drcp_functions.inc b/ext/oci8/tests/drcp_functions.inc
index 320026486e..595f82da1f 100644
--- a/ext/oci8/tests/drcp_functions.inc
+++ b/ext/oci8/tests/drcp_functions.inc
@@ -4,90 +4,90 @@
function drcp_create_table($conn)
{
- $create_sql = "CREATE TABLE DRCPTEST (id NUMBER, name VARCHAR2(10), dept VARCHAR2(10))";
- $statement = oci_parse($conn, $create_sql);
- oci_execute($statement);
+ $create_sql = "CREATE TABLE DRCPTEST (id NUMBER, name VARCHAR2(10), dept VARCHAR2(10))";
+ $statement = oci_parse($conn, $create_sql);
+ oci_execute($statement);
- $id_values = array(100,101,102,103,104,105,106,107,108);
- $name_values = array("WIILIAMS","JOHN","SMITH","JONES","ADAMS","ROBERT",
- "BILL","LAWSON","MARY");
- $dept_values = array("ACCOUNTS","HR","HR","ADMIN","ACCOUNTS","HR",
- "ACCOUNTS","HR","ACCOUNTS");
- for($i=0; $i<8; $i++) {
- $insert = "INSERT INTO DRCPTEST VALUES(".$id_values[$i].",'". $name_values[$i]."','".$dept_values[$i]."')";
- $s = oci_parse($conn, $insert);
- oci_execute($s);
- }
+ $id_values = array(100,101,102,103,104,105,106,107,108);
+ $name_values = array("WIILIAMS","JOHN","SMITH","JONES","ADAMS","ROBERT",
+ "BILL","LAWSON","MARY");
+ $dept_values = array("ACCOUNTS","HR","HR","ADMIN","ACCOUNTS","HR",
+ "ACCOUNTS","HR","ACCOUNTS");
+ for($i=0; $i<8; $i++) {
+ $insert = "INSERT INTO DRCPTEST VALUES(".$id_values[$i].",'". $name_values[$i]."','".$dept_values[$i]."')";
+ $s = oci_parse($conn, $insert);
+ oci_execute($s);
+ }
}
function drcp_drop_table($conn)
{
- $ora_sql = "DROP TABLE DRCPTEST";
- $statement = oci_parse($conn, $ora_sql);
- oci_execute($statement);
+ $ora_sql = "DROP TABLE DRCPTEST";
+ $statement = oci_parse($conn, $ora_sql);
+ oci_execute($statement);
}
function drcp_update_table($conn)
{
- $update_stmt ="Update drcptest set dept ='NEWDEPT' where id = 105";
- $s1 = oci_parse($conn,$update_stmt);
- oci_execute($s1,OCI_DEFAULT);
- echo "Update done-- DEPT value has been set to NEWDEPT\n";
+ $update_stmt ="Update drcptest set dept ='NEWDEPT' where id = 105";
+ $s1 = oci_parse($conn,$update_stmt);
+ oci_execute($s1,OCI_DEFAULT);
+ echo "Update done-- DEPT value has been set to NEWDEPT\n";
}
function drcp_select_value($conn)
{
- $sel_stmt="select dept from drcptest where id=105";
- $s2 = oci_parse($conn,$sel_stmt);
- oci_execute($s2,OCI_DEFAULT);
- while(oci_fetch($s2)) {
- echo "The value of DEPT for id 105 is ".oci_result($s2,1)."\n";
- }
+ $sel_stmt="select dept from drcptest where id=105";
+ $s2 = oci_parse($conn,$sel_stmt);
+ oci_execute($s2,OCI_DEFAULT);
+ while(oci_fetch($s2)) {
+ echo "The value of DEPT for id 105 is ".oci_result($s2,1)."\n";
+ }
}
function drcp_select_packagevar($conn)
{
- $sel_stmt="select drcp_test_package.f1 as f1 from dual";
- $s2 = oci_parse($conn, $sel_stmt);
- oci_define_by_name($s2,'f1',$ret_num);
- oci_execute($s2);
- while(oci_fetch($s2)) {
- echo " The value of the package variable is ".oci_result($s2,1)."\n";
- }
+ $sel_stmt="select drcp_test_package.f1 as f1 from dual";
+ $s2 = oci_parse($conn, $sel_stmt);
+ oci_define_by_name($s2,'f1',$ret_num);
+ oci_execute($s2);
+ while(oci_fetch($s2)) {
+ echo " The value of the package variable is ".oci_result($s2,1)."\n";
+ }
}
function drcp_set_packagevar($conn,$num)
{
- $set_stmt = "begin drcp_test_package.p1($num); end;";
- $s1 = oci_parse($conn,$set_stmt);
- oci_execute($s1);
- echo " Package variable value set to " .$num."\n";
+ $set_stmt = "begin drcp_test_package.p1($num); end;";
+ $s1 = oci_parse($conn,$set_stmt);
+ oci_execute($s1);
+ echo " Package variable value set to " .$num."\n";
}
function drcp_create_package($c)
{
- $create_package_stmt = "create or replace package drcp_test_package as
- var int :=0;
- procedure p1(var1 int);
- function f1 return number;
- end;";
- $s1 = oci_parse($c, $create_package_stmt);
- oci_execute($s1);
+ $create_package_stmt = "create or replace package drcp_test_package as
+ var int :=0;
+ procedure p1(var1 int);
+ function f1 return number;
+ end;";
+ $s1 = oci_parse($c, $create_package_stmt);
+ oci_execute($s1);
- $package_body = "create or replace package body drcp_test_package as
- procedure p1(var1 int) is
- begin
- var :=var1;
- end;
- function f1 return number is
- begin
- return drcp_test_package.var;
- end;
- end;";
+ $package_body = "create or replace package body drcp_test_package as
+ procedure p1(var1 int) is
+ begin
+ var :=var1;
+ end;
+ function f1 return number is
+ begin
+ return drcp_test_package.var;
+ end;
+ end;";
- $s2 = oci_parse($c, $package_body);
- oci_execute($s2);
+ $s2 = oci_parse($c, $package_body);
+ oci_execute($s2);
}
?>
diff --git a/ext/oci8/tests/drcp_newconnect.phpt b/ext/oci8/tests/drcp_newconnect.phpt
index cf4b6de17b..3c41edbb73 100644
--- a/ext/oci8/tests/drcp_newconnect.phpt
+++ b/ext/oci8/tests/drcp_newconnect.phpt
@@ -24,9 +24,9 @@ $rn2 = (int)$c2;
// rn1 and rn2 should be different.
if ($rn1 === $rn2)
- echo "First and second connections share a resource: Not OK\n";
+ echo "First and second connections share a resource: Not OK\n";
else
- echo "First and second connections are different OK\n";
+ echo "First and second connections are different OK\n";
// Close the connections
oci_close($c1);
diff --git a/ext/oci8/tests/drcp_pconn_close1.phpt b/ext/oci8/tests/drcp_pconn_close1.phpt
index 83dad880d9..e4849169ae 100644
--- a/ext/oci8/tests/drcp_pconn_close1.phpt
+++ b/ext/oci8/tests/drcp_pconn_close1.phpt
@@ -13,7 +13,7 @@ require __DIR__."/details.inc";
// Test will open a persistent connection
// Close the connection
// Open another connection
-// With oci_close() being a no-op, the same conneciton will be returned
+// With oci_close() being a no-op, the same connection will be returned
echo "This is with a OCI_PCONNECT\n";
var_dump($conn1 = oci_pconnect($user,$password,$dbase));
@@ -29,9 +29,9 @@ oci_close($conn2);
// Compare the resource numbers
if ($rn1 === $rn2)
- echo "Both connections share a resource : OK\n";
+ echo "Both connections share a resource : OK\n";
else
- echo "Both connections are different : NOT OK\n";
+ echo "Both connections are different : NOT OK\n";
echo "Done\n";
diff --git a/ext/oci8/tests/drcp_pconn_close2.phpt b/ext/oci8/tests/drcp_pconn_close2.phpt
index 02bed68358..4961cb9545 100644
--- a/ext/oci8/tests/drcp_pconn_close2.phpt
+++ b/ext/oci8/tests/drcp_pconn_close2.phpt
@@ -31,9 +31,9 @@ oci_close($conn2);
// Compare the resource numbers
if ($rn1 === $rn2)
- echo "Both connections share a resource : NOT OK\n";
+ echo "Both connections share a resource : NOT OK\n";
else
- echo "Both connections are different : OK\n";
+ echo "Both connections are different : OK\n";
echo "Done\n";
diff --git a/ext/oci8/tests/drcp_scope1.phpt b/ext/oci8/tests/drcp_scope1.phpt
index 78e2e900c9..807c352a20 100644
--- a/ext/oci8/tests/drcp_scope1.phpt
+++ b/ext/oci8/tests/drcp_scope1.phpt
@@ -42,32 +42,32 @@ function2($user,$password,$dbase,$conn_type);
function function1($user,$password,$dbase,$conn_type)
{
- switch($conn_type)
- {
- case 1:
- var_dump($conn1 = oci_new_connect($user,$password,$dbase));
- break;
- case 2:
- var_dump($conn1 = oci_connect($user,$password,$dbase));
- break;
- }
- drcp_update_table($conn1);
+ switch($conn_type)
+ {
+ case 1:
+ var_dump($conn1 = oci_new_connect($user,$password,$dbase));
+ break;
+ case 2:
+ var_dump($conn1 = oci_connect($user,$password,$dbase));
+ break;
+ }
+ drcp_update_table($conn1);
}
// This is the second scope
function function2($user,$password,$dbase,$conn_type)
{
- switch($conn_type)
- {
- case 1:
- var_dump($conn1 = oci_new_connect($user,$password,$dbase));
- break;
- case 2:
- var_dump($conn1 = oci_connect($user,$password,$dbase));
- break;
- }
- drcp_select_value($conn1);
+ switch($conn_type)
+ {
+ case 1:
+ var_dump($conn1 = oci_new_connect($user,$password,$dbase));
+ break;
+ case 2:
+ var_dump($conn1 = oci_connect($user,$password,$dbase));
+ break;
+ }
+ drcp_select_value($conn1);
}
drcp_drop_table($c);
diff --git a/ext/oci8/tests/drcp_scope2.phpt b/ext/oci8/tests/drcp_scope2.phpt
index 05a4c558ec..99e102075d 100644
--- a/ext/oci8/tests/drcp_scope2.phpt
+++ b/ext/oci8/tests/drcp_scope2.phpt
@@ -42,32 +42,32 @@ function2($user,$password,$dbase,$conn_type);
function function1($user,$password,$dbase,$conn_type)
{
- switch($conn_type)
- {
- case 1:
- var_dump($conn1 = oci_new_connect($user,$password,$dbase));
- break;
- case 2:
- var_dump($conn1 = oci_connect($user,$password,$dbase));
- break;
- }
- drcp_update_table($conn1);
+ switch($conn_type)
+ {
+ case 1:
+ var_dump($conn1 = oci_new_connect($user,$password,$dbase));
+ break;
+ case 2:
+ var_dump($conn1 = oci_connect($user,$password,$dbase));
+ break;
+ }
+ drcp_update_table($conn1);
}
// This is the second scope
function function2($user,$password,$dbase,$conn_type)
{
- switch($conn_type)
- {
- case 1:
- var_dump($conn1 = oci_new_connect($user,$password,$dbase));
- break;
- case 2:
- var_dump($conn1 = oci_connect($user,$password,$dbase));
- break;
- }
- drcp_select_value($conn1);
+ switch($conn_type)
+ {
+ case 1:
+ var_dump($conn1 = oci_new_connect($user,$password,$dbase));
+ break;
+ case 2:
+ var_dump($conn1 = oci_connect($user,$password,$dbase));
+ break;
+ }
+ drcp_select_value($conn1);
}
drcp_drop_table($c);
oci_close($c);
diff --git a/ext/oci8/tests/drcp_scope3.phpt b/ext/oci8/tests/drcp_scope3.phpt
index 975f87bed9..8d97d48e99 100644
--- a/ext/oci8/tests/drcp_scope3.phpt
+++ b/ext/oci8/tests/drcp_scope3.phpt
@@ -32,16 +32,16 @@ function2($user,$password,$dbase);
function function1($user,$password,$dbase)
{
- var_dump($c = oci_pconnect($user,$password,$dbase));
- drcp_update_table($c);
+ var_dump($c = oci_pconnect($user,$password,$dbase));
+ drcp_update_table($c);
}
// This is the second scope
function function2($user,$password,$dbase)
{
- var_dump($c = oci_pconnect($user,$password,$dbase));
- drcp_select_value($c);
+ var_dump($c = oci_pconnect($user,$password,$dbase));
+ drcp_select_value($c);
}
drcp_drop_table($c);
diff --git a/ext/oci8/tests/drcp_scope4.phpt b/ext/oci8/tests/drcp_scope4.phpt
index dced1c3f1c..abc631a437 100644
--- a/ext/oci8/tests/drcp_scope4.phpt
+++ b/ext/oci8/tests/drcp_scope4.phpt
@@ -35,16 +35,16 @@ function2($user,$password,$dbase);
function function1($user,$password,$dbase)
{
- var_dump($c = oci_pconnect($user,$password,$dbase));
- drcp_update_table($c);
+ var_dump($c = oci_pconnect($user,$password,$dbase));
+ drcp_update_table($c);
}
// This is the second scope
function function2($user,$password,$dbase)
{
- var_dump($c = oci_pconnect($user,$password,$dbase));
- drcp_select_value($c);
+ var_dump($c = oci_pconnect($user,$password,$dbase));
+ drcp_select_value($c);
}
drcp_drop_table($c);
diff --git a/ext/oci8/tests/drcp_scope5.phpt b/ext/oci8/tests/drcp_scope5.phpt
index d3ccb56da0..b84853423a 100644
--- a/ext/oci8/tests/drcp_scope5.phpt
+++ b/ext/oci8/tests/drcp_scope5.phpt
@@ -35,17 +35,17 @@ function2($user,$password,$dbase);
function function1($user,$password,$dbase)
{
- var_dump($c = oci_pconnect($user,$password,$dbase));
- drcp_update_table($c);
+ var_dump($c = oci_pconnect($user,$password,$dbase));
+ drcp_update_table($c);
}
// This is the second scope
function function2($user,$password,$dbase)
{
- var_dump($c = oci_pconnect($user,$password,$dbase));
- drcp_select_value($c);
- oci_commit($c);
+ var_dump($c = oci_pconnect($user,$password,$dbase));
+ drcp_select_value($c);
+ oci_commit($c);
}
drcp_drop_table($c);
diff --git a/ext/oci8/tests/driver_name.phpt b/ext/oci8/tests/driver_name.phpt
index 29b2cef520..c9d1181ef6 100644
--- a/ext/oci8/tests/driver_name.phpt
+++ b/ext/oci8/tests/driver_name.phpt
@@ -43,7 +43,7 @@ echo "Done\n";
function get_attr($conn)
{
- $sel_stmt = "select client_driver
+ $sel_stmt = "select client_driver
from v\$session_connect_info sci, v\$session s
where sci.client_driver is not null
and sci.sid = s.sid
diff --git a/ext/oci8/tests/driver_name_11gR2.phpt b/ext/oci8/tests/driver_name_11gR2.phpt
index bb82b92fa3..6eb2e0d6e7 100644
--- a/ext/oci8/tests/driver_name_11gR2.phpt
+++ b/ext/oci8/tests/driver_name_11gR2.phpt
@@ -40,7 +40,7 @@ echo "Done\n";
function get_attr($conn)
{
- $sel_stmt = "select client_driver
+ $sel_stmt = "select client_driver
from v\$session_connect_info sci, v\$session s
where sci.client_driver is not null
and sci.sid = s.sid
diff --git a/ext/oci8/tests/dupcolnames.phpt b/ext/oci8/tests/dupcolnames.phpt
index 40d2c99b13..1fddc6cf23 100644
--- a/ext/oci8/tests/dupcolnames.phpt
+++ b/ext/oci8/tests/dupcolnames.phpt
@@ -57,8 +57,6 @@ $stmtarray = array(
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Test 1 - OCI_ASSOC
array(3) {
@@ -99,4 +97,3 @@ array(7) {
[3]=>
string(5) "jones"
}
-===DONE===
diff --git a/ext/oci8/tests/edition_1.phpt b/ext/oci8/tests/edition_1.phpt
index 9bdf699a70..b75dfe4350 100644
--- a/ext/oci8/tests/edition_1.phpt
+++ b/ext/oci8/tests/edition_1.phpt
@@ -39,11 +39,11 @@ $testpassword = 'testuser';
require(__DIR__."/conn_attr.inc");
function select_fn($conn) {
- $s = oci_parse($conn,"select * from view_ed");
- oci_execute($s);
- while ($row = oci_fetch_row($s)) {
- var_dump($row);
- }
+ $s = oci_parse($conn,"select * from view_ed");
+ oci_execute($s);
+ while ($row = oci_fetch_row($s)) {
+ var_dump($row);
+ }
}
/* Create a editon MYEDITION
create a view view_ed in MYEDITION1.
diff --git a/ext/oci8/tests/edition_2.phpt b/ext/oci8/tests/edition_2.phpt
index 054e685943..a556fb4a17 100644
--- a/ext/oci8/tests/edition_2.phpt
+++ b/ext/oci8/tests/edition_2.phpt
@@ -63,7 +63,7 @@ get_edit_attr($pc1);
oci_close($pc1);
-echo"\n\n**Test 1.3 change the value and verify with existing conenctions.*********\n";
+echo"\n\n**Test 1.3 change the value and verify with existing connections.*********\n";
set_edit_attr('MYEDITION1');
get_edit_attr($conn2);
get_edit_attr($conn3); // Old value
@@ -87,12 +87,12 @@ oci_close($c5);
echo "\n\n**Test 1.4 - with different type of values *********\n";
$values_array = array(123,NULL,'NO EDITION','edition name which has more than thirty chars!!!edition name which has more than thirty chars!!!');
foreach ($values_array as $val ) {
- set_edit_attr($val);
- $c1 = get_conn(1); //oci_connect()
- if ($c1) {
- get_edit_attr($c1);
- oci_close($c1);
- }
+ set_edit_attr($val);
+ $c1 = get_conn(1); //oci_connect()
+ if ($c1) {
+ get_edit_attr($c1);
+ oci_close($c1);
+ }
}
echo "\n\n**Test 1.5 - Negative case with an invalid string value. *********\n";
@@ -131,7 +131,7 @@ echo " Set the value back using oci-set_edition\n";
set_edit_attr('MYEDITION');
get_edit_attr($c2);
-echo " Get the value with a new conenction\n";
+echo " Get the value with a new connection\n";
$c3 = get_conn(1);
get_edit_attr($c3);
@@ -149,7 +149,7 @@ echo "Done\n";
function set_scope() {
- $r = set_edit_attr('MYEDITION1');
+ $r = set_edit_attr('MYEDITION1');
}
function get_scope() {
@@ -158,8 +158,8 @@ function get_scope() {
$m = oci_error();
die("Error:" . $m['message']);
}
- get_edit_attr($sc1);
- oci_close($sc1);
+ get_edit_attr($sc1);
+ oci_close($sc1);
}
?>
--EXPECTF--
@@ -178,7 +178,7 @@ The value of current EDITION is MYEDITION
The value of current EDITION is MYEDITION
-**Test 1.3 change the value and verify with existing conenctions.*********
+**Test 1.3 change the value and verify with existing connections.*********
The value of edition has been successfully set
The value of current EDITION is MYEDITION
The value of current EDITION is MYEDITION
@@ -235,7 +235,7 @@ The value of current EDITION is MYEDITION
Set the value back using oci-set_edition
The value of edition has been successfully set
The value of current EDITION is MYEDITION
- Get the value with a new conenction
+ Get the value with a new connection
Testing with oci_connect()
The value of current EDITION is MYEDITION
diff --git a/ext/oci8/tests/error3.phpt b/ext/oci8/tests/error3.phpt
index c993a97b5d..0da7a43d38 100644
--- a/ext/oci8/tests/error3.phpt
+++ b/ext/oci8/tests/error3.phpt
@@ -31,10 +31,7 @@ end;");
oci_execute($s);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Test 1
Warning: oci_execute(): ORA-20333: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBab in %serror3.php on line %d
-===DONE===
diff --git a/ext/oci8/tests/error_parse.phpt b/ext/oci8/tests/error_parse.phpt
index 1992826618..548ed3bfc0 100644
--- a/ext/oci8/tests/error_parse.phpt
+++ b/ext/oci8/tests/error_parse.phpt
@@ -15,49 +15,49 @@ require(__DIR__.'/details.inc');
// Test parse error for normal connection
if (!empty($dbase)) {
- $c1 = oci_connect($user,$password,$dbase);
+ $c1 = oci_connect($user,$password,$dbase);
}
else {
- $c1 = oci_connect($user,$password);
+ $c1 = oci_connect($user,$password);
}
$s = @oci_parse($c1, "select ' from dual");
if (!$s) {
- echo "Normal connection: Parse error\n";
- $m = oci_error($c1);
- var_dump($m);
+ echo "Normal connection: Parse error\n";
+ $m = oci_error($c1);
+ var_dump($m);
}
// Test parse error for new connection
if (!empty($dbase)) {
- $c2 = oci_new_connect($user,$password,$dbase);
+ $c2 = oci_new_connect($user,$password,$dbase);
}
else {
- $c2 = oci_new_connect($user,$password);
+ $c2 = oci_new_connect($user,$password);
}
$s = @oci_parse($c2, "select ' from dual");
if (!$s) {
- echo "New connection: Parse error\n";
- $m = oci_error($c2);
- var_dump($m);
+ echo "New connection: Parse error\n";
+ $m = oci_error($c2);
+ var_dump($m);
}
// Test parse error for persistent connection
if (!empty($dbase)) {
- $c3 = oci_pconnect($user,$password,$dbase);
+ $c3 = oci_pconnect($user,$password,$dbase);
}
else {
- $c3 = oci_pconnect($user,$password);
+ $c3 = oci_pconnect($user,$password);
}
$s = @oci_parse($c3, "select ' from dual");
if (!$s) {
- echo "Persistent connection: Parse error\n";
- $m = oci_error($c3);
- var_dump($m);
+ echo "Persistent connection: Parse error\n";
+ $m = oci_error($c3);
+ var_dump($m);
}
// Verify that passing no connection doesn't affect future calls
diff --git a/ext/oci8/tests/error_set.phpt b/ext/oci8/tests/error_set.phpt
index 95673f554a..ed04407098 100644
--- a/ext/oci8/tests/error_set.phpt
+++ b/ext/oci8/tests/error_set.phpt
@@ -51,8 +51,6 @@ $r = oci_set_client_info($c, $s);
var_dump($r);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Test 1
bool(false)
@@ -69,4 +67,3 @@ bool(true)
bool(true)
bool(true)
bool(true)
-===DONE===
diff --git a/ext/oci8/tests/extauth_01.phpt b/ext/oci8/tests/extauth_01.phpt
index ba48b0eb58..db23097d82 100644
--- a/ext/oci8/tests/extauth_01.phpt
+++ b/ext/oci8/tests/extauth_01.phpt
@@ -18,8 +18,8 @@ echo "Test 1\n";
$c = oci_connect('/', 'notemtpy', 'anything', null, OCI_CRED_EXT);
if (!$c) {
- $m = oci_error();
- var_dump($m);
+ $m = oci_error();
+ var_dump($m);
}
var_dump($c);
@@ -27,8 +27,8 @@ echo "Test 2\n";
$c = oci_connect('notemtpy', 'notemtpy', 'anything', null, OCI_CRED_EXT);
if (!$c) {
- $m = oci_error();
- var_dump($m);
+ $m = oci_error();
+ var_dump($m);
}
var_dump($c);
@@ -36,8 +36,8 @@ echo "Test 3\n";
$c = oci_connect('notemtpy', '', 'anything', null, OCI_CRED_EXT);
if (!$c) {
- $m = oci_error();
- var_dump($m);
+ $m = oci_error();
+ var_dump($m);
}
var_dump($c);
@@ -45,8 +45,8 @@ echo "Test 4\n";
$c = oci_connect('a', 'b', 'c', null, OCI_SYSDBA+OCI_SYSOPER);
if (!$c) {
- $m = oci_error();
- var_dump($m);
+ $m = oci_error();
+ var_dump($m);
}
var_dump($c);
@@ -54,8 +54,8 @@ echo "Test 5\n";
$c = oci_connect('a', 'b', 'c', null, OCI_SYSDBA+OCI_SYSOPER+OCI_CRED_EXT);
if (!$c) {
- $m = oci_error();
- var_dump($m);
+ $m = oci_error();
+ var_dump($m);
}
var_dump($c);
@@ -63,8 +63,8 @@ echo "Test 6\n";
$c = oci_connect('', '', 'anything', null, OCI_CRED_EXT);
if (!$c) {
- $m = oci_error();
- var_dump($m);
+ $m = oci_error();
+ var_dump($m);
}
var_dump($c);
@@ -72,8 +72,8 @@ echo "Test 7\n";
$c = oci_connect('/', '', 'anything', null, OCI_CRED_EXT);
if (!$c) {
- $m = oci_error();
- var_dump($m);
+ $m = oci_error();
+ var_dump($m);
}
var_dump($c);
@@ -81,8 +81,8 @@ echo "Test 8\n";
$c = oci_connect('/', null, 'anything', null, OCI_CRED_EXT);
if (!$c) {
- $m = oci_error();
- var_dump($m);
+ $m = oci_error();
+ var_dump($m);
}
var_dump($c);
@@ -90,8 +90,8 @@ echo "Test 9\n";
$c = oci_connect('/', '', 'd', null, OCI_SYSDBA+OCI_CRED_EXT);
if (!$c) {
- $m = oci_error();
- var_dump($m);
+ $m = oci_error();
+ var_dump($m);
}
var_dump($c);
@@ -99,15 +99,13 @@ echo "Test 10\n";
$c = oci_connect('/', '', 'd', null, OCI_SYSOPER+OCI_CRED_EXT);
if (!$c) {
- $m = oci_error();
- var_dump($m);
+ $m = oci_error();
+ var_dump($m);
}
var_dump($c);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Test 1
@@ -195,4 +193,3 @@ array(4) {
string(0) ""
}
bool(false)
-===DONE===
diff --git a/ext/oci8/tests/extauth_02.phpt b/ext/oci8/tests/extauth_02.phpt
index ea665eb918..c8c3dd6725 100644
--- a/ext/oci8/tests/extauth_02.phpt
+++ b/ext/oci8/tests/extauth_02.phpt
@@ -17,8 +17,8 @@ echo "Test 1\n";
$c = oci_new_connect('/', 'notemtpy', 'anything', null, OCI_CRED_EXT);
if (!$c) {
- $m = oci_error();
- var_dump($m);
+ $m = oci_error();
+ var_dump($m);
}
var_dump($c);
@@ -26,8 +26,8 @@ echo "Test 2\n";
$c = oci_new_connect('notemtpy', 'notemtpy', 'anything', null, OCI_CRED_EXT);
if (!$c) {
- $m = oci_error();
- var_dump($m);
+ $m = oci_error();
+ var_dump($m);
}
var_dump($c);
@@ -35,8 +35,8 @@ echo "Test 3\n";
$c = oci_new_connect('notemtpy', '', 'anything', null, OCI_CRED_EXT);
if (!$c) {
- $m = oci_error();
- var_dump($m);
+ $m = oci_error();
+ var_dump($m);
}
var_dump($c);
@@ -44,8 +44,8 @@ echo "Test 4\n";
$c = oci_new_connect('a', 'b', 'c', null, OCI_SYSDBA+OCI_SYSOPER);
if (!$c) {
- $m = oci_error();
- var_dump($m);
+ $m = oci_error();
+ var_dump($m);
}
var_dump($c);
@@ -53,8 +53,8 @@ echo "Test 5\n";
$c = oci_new_connect('a', 'b', 'c', null, OCI_SYSDBA+OCI_SYSOPER+OCI_CRED_EXT);
if (!$c) {
- $m = oci_error();
- var_dump($m);
+ $m = oci_error();
+ var_dump($m);
}
var_dump($c);
@@ -62,8 +62,8 @@ echo "Test 6\n";
$c = oci_new_connect('', '', 'anything', null, OCI_CRED_EXT);
if (!$c) {
- $m = oci_error();
- var_dump($m);
+ $m = oci_error();
+ var_dump($m);
}
var_dump($c);
@@ -71,8 +71,8 @@ echo "Test 7\n";
$c = oci_new_connect('/', '', 'anything', null, OCI_CRED_EXT);
if (!$c) {
- $m = oci_error();
- var_dump($m);
+ $m = oci_error();
+ var_dump($m);
}
var_dump($c);
@@ -80,8 +80,8 @@ echo "Test 8\n";
$c = oci_new_connect('/', null, 'anything', null, OCI_CRED_EXT);
if (!$c) {
- $m = oci_error();
- var_dump($m);
+ $m = oci_error();
+ var_dump($m);
}
var_dump($c);
@@ -89,8 +89,8 @@ echo "Test 9\n";
$c = oci_new_connect('/', '', 'd', null, OCI_SYSDBA+OCI_CRED_EXT);
if (!$c) {
- $m = oci_error();
- var_dump($m);
+ $m = oci_error();
+ var_dump($m);
}
var_dump($c);
@@ -98,15 +98,13 @@ echo "Test 10\n";
$c = oci_new_connect('/', '', 'd', null, OCI_SYSOPER+OCI_CRED_EXT);
if (!$c) {
- $m = oci_error();
- var_dump($m);
+ $m = oci_error();
+ var_dump($m);
}
var_dump($c);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Test 1
@@ -194,4 +192,3 @@ array(4) {
string(0) ""
}
bool(false)
-===DONE===
diff --git a/ext/oci8/tests/extauth_03.phpt b/ext/oci8/tests/extauth_03.phpt
index 3ced42fc23..863f94499b 100644
--- a/ext/oci8/tests/extauth_03.phpt
+++ b/ext/oci8/tests/extauth_03.phpt
@@ -17,8 +17,8 @@ echo "Test 1\n";
$c = oci_pconnect('/', 'notemtpy', 'anything', null, OCI_CRED_EXT);
if (!$c) {
- $m = oci_error();
- var_dump($m);
+ $m = oci_error();
+ var_dump($m);
}
var_dump($c);
@@ -26,8 +26,8 @@ echo "Test 2\n";
$c = oci_pconnect('notemtpy', 'notemtpy', 'anything', null, OCI_CRED_EXT);
if (!$c) {
- $m = oci_error();
- var_dump($m);
+ $m = oci_error();
+ var_dump($m);
}
var_dump($c);
@@ -35,8 +35,8 @@ echo "Test 3\n";
$c = oci_pconnect('notemtpy', '', 'anything', null, OCI_CRED_EXT);
if (!$c) {
- $m = oci_error();
- var_dump($m);
+ $m = oci_error();
+ var_dump($m);
}
var_dump($c);
@@ -44,8 +44,8 @@ echo "Test 4\n";
$c = oci_pconnect('a', 'b', 'c', null, OCI_SYSDBA+OCI_SYSOPER);
if (!$c) {
- $m = oci_error();
- var_dump($m);
+ $m = oci_error();
+ var_dump($m);
}
var_dump($c);
@@ -53,8 +53,8 @@ echo "Test 5\n";
$c = oci_pconnect('a', 'b', 'c', null, OCI_SYSDBA+OCI_SYSOPER+OCI_CRED_EXT);
if (!$c) {
- $m = oci_error();
- var_dump($m);
+ $m = oci_error();
+ var_dump($m);
}
var_dump($c);
@@ -62,8 +62,8 @@ echo "Test 6\n";
$c = oci_pconnect('', '', 'anything', null, OCI_CRED_EXT);
if (!$c) {
- $m = oci_error();
- var_dump($m);
+ $m = oci_error();
+ var_dump($m);
}
var_dump($c);
@@ -71,8 +71,8 @@ echo "Test 7\n";
$c = oci_pconnect('/', '', 'anything', null, OCI_CRED_EXT);
if (!$c) {
- $m = oci_error();
- var_dump($m);
+ $m = oci_error();
+ var_dump($m);
}
var_dump($c);
@@ -80,8 +80,8 @@ echo "Test 8\n";
$c = oci_pconnect('/', null, 'anything', null, OCI_CRED_EXT);
if (!$c) {
- $m = oci_error();
- var_dump($m);
+ $m = oci_error();
+ var_dump($m);
}
var_dump($c);
@@ -89,8 +89,8 @@ echo "Test 9\n";
$c = oci_pconnect('/', '', 'd', null, OCI_SYSDBA+OCI_CRED_EXT);
if (!$c) {
- $m = oci_error();
- var_dump($m);
+ $m = oci_error();
+ var_dump($m);
}
var_dump($c);
@@ -98,15 +98,13 @@ echo "Test 10\n";
$c = oci_pconnect('/', '', 'd', null, OCI_SYSOPER+OCI_CRED_EXT);
if (!$c) {
- $m = oci_error();
- var_dump($m);
+ $m = oci_error();
+ var_dump($m);
}
var_dump($c);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Test 1
@@ -194,4 +192,3 @@ array(4) {
string(0) ""
}
bool(false)
-===DONE===
diff --git a/ext/oci8/tests/extauth_04.phpt b/ext/oci8/tests/extauth_04.phpt
index 1597c2a942..5f4e64fc84 100644
--- a/ext/oci8/tests/extauth_04.phpt
+++ b/ext/oci8/tests/extauth_04.phpt
@@ -14,8 +14,8 @@ echo "Test 1\n";
$c = oci_connect('/', '', 'anything', null, OCI_CRED_EXT);
if (!$c) {
- $m = oci_error();
- var_dump($m);
+ $m = oci_error();
+ var_dump($m);
}
var_dump($c);
@@ -23,8 +23,8 @@ echo "Test 2\n";
$c = oci_new_connect('/', '', 'anything', null, OCI_CRED_EXT);
if (!$c) {
- $m = oci_error();
- var_dump($m);
+ $m = oci_error();
+ var_dump($m);
}
var_dump($c);
@@ -32,14 +32,12 @@ echo "Test 3\n";
$c = oci_pconnect('/', '', 'anything', null, OCI_CRED_EXT);
if (!$c) {
- $m = oci_error();
- var_dump($m);
+ $m = oci_error();
+ var_dump($m);
}
var_dump($c);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Test 1
@@ -56,4 +54,3 @@ Test 3
Warning: oci_pconnect(): External Authentication is not supported on Windows in %s on line %d
bool(false)
bool(false)
-===DONE===
diff --git a/ext/oci8/tests/fetch.phpt b/ext/oci8/tests/fetch.phpt
index eeba992db2..eae30bad23 100644
--- a/ext/oci8/tests/fetch.phpt
+++ b/ext/oci8/tests/fetch.phpt
@@ -22,18 +22,18 @@ oci8_test_sql_execute($c, $stmtarray);
// Run Test
if (!($s = oci_parse($c, "select * from fetch_tab"))) {
- die("oci_parse(select) failed!\n");
+ die("oci_parse(select) failed!\n");
}
if (!oci_execute($s)) {
- die("oci_execute(select) failed!\n");
+ die("oci_execute(select) failed!\n");
}
while(ocifetch($s)) {
- $row = ociresult($s, 1);
- $row1 = ociresult($s, 2);
- var_dump($row);
- var_dump($row1);
+ $row = ociresult($s, 1);
+ $row1 = ociresult($s, 2);
+ var_dump($row);
+ var_dump($row1);
}
// Cleanup
diff --git a/ext/oci8/tests/fetch_all1.phpt b/ext/oci8/tests/fetch_all1.phpt
index 2d27f8e02b..b531364109 100644
--- a/ext/oci8/tests/fetch_all1.phpt
+++ b/ext/oci8/tests/fetch_all1.phpt
@@ -20,19 +20,19 @@ $stmtarray = array(
oci8_test_sql_execute($c, $stmtarray);
if (!($s = oci_parse($c, "select * from fetch_all_tab"))) {
- die("oci_parse(select) failed!\n");
+ die("oci_parse(select) failed!\n");
}
/* oci_fetch_all */
if (!oci_execute($s)) {
- die("oci_execute(select) failed!\n");
+ die("oci_execute(select) failed!\n");
}
var_dump(oci_fetch_all($s, $all));
var_dump($all);
/* ocifetchstatement */
if (!oci_execute($s)) {
- die("oci_execute(select) failed!\n");
+ die("oci_execute(select) failed!\n");
}
var_dump(ocifetchstatement($s, $all));
diff --git a/ext/oci8/tests/fetch_all2.phpt b/ext/oci8/tests/fetch_all2.phpt
index cafd0eb509..c9f5175c58 100644
--- a/ext/oci8/tests/fetch_all2.phpt
+++ b/ext/oci8/tests/fetch_all2.phpt
@@ -16,7 +16,7 @@ $insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)";
$s = oci_parse($c, $insert_sql);
for ($i = 0; $i<3; $i++) {
- oci_execute($s);
+ oci_execute($s);
}
oci_commit($c);
diff --git a/ext/oci8/tests/fetch_all4.phpt b/ext/oci8/tests/fetch_all4.phpt
index ff4f7c400e..039cb9ff47 100644
--- a/ext/oci8/tests/fetch_all4.phpt
+++ b/ext/oci8/tests/fetch_all4.phpt
@@ -10,9 +10,9 @@ require(__DIR__.'/connect.inc');
// Initialization
$stmtarray = array(
- "drop table fetch_all4_tab",
- "create table fetch_all4_tab (mycol1 number, mycol2 varchar2(20))",
- "insert into fetch_all4_tab values (1, 'abc')"
+ "drop table fetch_all4_tab",
+ "create table fetch_all4_tab (mycol1 number, mycol2 varchar2(20))",
+ "insert into fetch_all4_tab values (1, 'abc')"
);
oci8_test_sql_execute($c, $stmtarray);
@@ -39,14 +39,12 @@ var_dump($row);
// Clean up
$stmtarray = array(
- "drop table fetch_all4_tab"
+ "drop table fetch_all4_tab"
);
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Test 1
int(0)
@@ -60,4 +58,3 @@ array(2) {
}
Test 2
bool(false)
-===DONE===
diff --git a/ext/oci8/tests/fetch_all5.phpt b/ext/oci8/tests/fetch_all5.phpt
index 26c7447c2c..86d451c98b 100644
--- a/ext/oci8/tests/fetch_all5.phpt
+++ b/ext/oci8/tests/fetch_all5.phpt
@@ -10,11 +10,11 @@ require(__DIR__.'/connect.inc');
// Initialization
$stmtarray = array(
- "drop table fetch_all5_tab",
- "create table fetch_all5_tab (mycol1 number, mycol2 varchar2(20))",
- "insert into fetch_all5_tab values (1, 'abc')",
- "insert into fetch_all5_tab values (2, 'def')",
- "insert into fetch_all5_tab values (3, 'ghi')"
+ "drop table fetch_all5_tab",
+ "create table fetch_all5_tab (mycol1 number, mycol2 varchar2(20))",
+ "insert into fetch_all5_tab values (1, 'abc')",
+ "insert into fetch_all5_tab values (2, 'def')",
+ "insert into fetch_all5_tab values (3, 'ghi')"
);
oci8_test_sql_execute($c, $stmtarray);
@@ -48,7 +48,7 @@ var_dump($res);
// Clean up
$stmtarray = array(
- "drop table fetch_all5_tab"
+ "drop table fetch_all5_tab"
);
oci8_test_sql_execute($c, $stmtarray);
@@ -56,8 +56,6 @@ oci8_test_sql_execute($c, $stmtarray);
oci_close($c);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Test 1
int(3)
@@ -107,4 +105,3 @@ Test 3
int(0)
array(0) {
}
-===DONE===
diff --git a/ext/oci8/tests/fetch_array.phpt b/ext/oci8/tests/fetch_array.phpt
index b7f327dcd4..ff74ad7673 100644
--- a/ext/oci8/tests/fetch_array.phpt
+++ b/ext/oci8/tests/fetch_array.phpt
@@ -14,17 +14,17 @@ require __DIR__.'/create_table.inc';
$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)";
if (!($s = oci_parse($c, $insert_sql))) {
- die("oci_parse(insert) failed!\n");
+ die("oci_parse(insert) failed!\n");
}
for ($i = 0; $i<3; $i++) {
- if (!oci_execute($s)) {
- die("oci_execute(insert) failed!\n");
- }
+ if (!oci_execute($s)) {
+ die("oci_execute(insert) failed!\n");
+ }
}
if (!oci_commit($c)) {
- die("oci_commit() failed!\n");
+ die("oci_commit() failed!\n");
}
echo "Test 1\n";
@@ -32,68 +32,68 @@ echo "Test 1\n";
$select_sql = "SELECT * FROM ".$schema."".$table_name."";
if (!($s = oci_parse($c, $select_sql))) {
- die("oci_parse(select) failed!\n");
+ die("oci_parse(select) failed!\n");
}
if (!oci_execute($s)) {
- die("oci_execute(select) failed!\n");
+ die("oci_execute(select) failed!\n");
}
while ($row = oci_fetch_array($s)) {
- var_dump($row);
+ var_dump($row);
}
echo "Test 2\n";
if (!oci_execute($s)) {
- die("oci_execute(select) failed!\n");
+ die("oci_execute(select) failed!\n");
}
while ($row = oci_fetch_array($s, OCI_NUM)) {
- var_dump($row);
+ var_dump($row);
}
echo "Test 3\n";
if (!oci_execute($s)) {
- die("oci_execute(select) failed!\n");
+ die("oci_execute(select) failed!\n");
}
while ($row = oci_fetch_array($s, OCI_ASSOC)) {
- var_dump($row);
+ var_dump($row);
}
echo "Test 4\n";
if (!oci_execute($s)) {
- die("oci_execute(select) failed!\n");
+ die("oci_execute(select) failed!\n");
}
while ($row = oci_fetch_array($s, OCI_BOTH)) {
- var_dump($row);
+ var_dump($row);
}
echo "Test 5\n";
if (!oci_execute($s)) {
- die("oci_execute(select) failed!\n");
+ die("oci_execute(select) failed!\n");
}
while ($row = oci_fetch_array($s, OCI_RETURN_LOBS)) {
- var_dump($row);
+ var_dump($row);
}
echo "Test 6\n";
if (!oci_execute($s)) {
- die("oci_execute(select) failed!\n");
+ die("oci_execute(select) failed!\n");
}
while ($row = oci_fetch_array($s, OCI_RETURN_NULLS)) {
- var_dump($row);
+ var_dump($row);
}
echo "Test 7\n";
if (!oci_execute($s)) {
- die("oci_execute(select) failed!\n");
+ die("oci_execute(select) failed!\n");
}
while ($row = oci_fetch_array($s, OCI_NUM+OCI_RETURN_NULLS)) {
- var_dump($row);
+ var_dump($row);
}
require __DIR__.'/drop_table.inc';
diff --git a/ext/oci8/tests/fetch_assoc.phpt b/ext/oci8/tests/fetch_assoc.phpt
index e891858efa..bf0c1a0f18 100644
--- a/ext/oci8/tests/fetch_assoc.phpt
+++ b/ext/oci8/tests/fetch_assoc.phpt
@@ -8,11 +8,11 @@ oci_fetch_assoc()
require __DIR__."/connect.inc";
$stmtarray = array(
- "drop table fetch_assoc_tab",
- "create table fetch_assoc_tab (id number, value number, dummy varchar2(20))",
- "insert into fetch_assoc_tab values (1,1,null)",
- "insert into fetch_assoc_tab values (1,1,null)",
- "insert into fetch_assoc_tab values (1,1,null)"
+ "drop table fetch_assoc_tab",
+ "create table fetch_assoc_tab (id number, value number, dummy varchar2(20))",
+ "insert into fetch_assoc_tab values (1,1,null)",
+ "insert into fetch_assoc_tab values (1,1,null)",
+ "insert into fetch_assoc_tab values (1,1,null)"
);
oci8_test_sql_execute($c, $stmtarray);
@@ -20,20 +20,20 @@ oci8_test_sql_execute($c, $stmtarray);
$select_sql = "select * from fetch_assoc_tab";
if (!($s = oci_parse($c, $select_sql))) {
- die("oci_parse(select) failed!\n");
+ die("oci_parse(select) failed!\n");
}
if (!oci_execute($s)) {
- die("oci_execute(select) failed!\n");
+ die("oci_execute(select) failed!\n");
}
while ($row = oci_fetch_assoc($s)) {
- var_dump($row);
+ var_dump($row);
}
// Clean up
$stmtarray = array(
- "drop table fetch_assoc_tab"
+ "drop table fetch_assoc_tab"
);
oci8_test_sql_execute($c, $stmtarray);
diff --git a/ext/oci8/tests/fetch_into.phpt b/ext/oci8/tests/fetch_into.phpt
index 04f6743a75..634e7379ef 100644
--- a/ext/oci8/tests/fetch_into.phpt
+++ b/ext/oci8/tests/fetch_into.phpt
@@ -22,19 +22,19 @@ oci8_test_sql_execute($c, $stmtarray);
// Run Test
if (!($s = oci_parse($c, "select * from fetch_into_tab"))) {
- die("oci_parse(select) failed!\n");
+ die("oci_parse(select) failed!\n");
}
/* ocifetchinto */
if (!oci_execute($s)) {
- die("oci_execute(select) failed!\n");
+ die("oci_execute(select) failed!\n");
}
var_dump(ocifetchinto($s, $all));
var_dump($all);
/* ocifetchinto */
if (!oci_execute($s)) {
- die("oci_execute(select) failed!\n");
+ die("oci_execute(select) failed!\n");
}
var_dump(ocifetchinto($s, $all, OCI_NUM+OCI_ASSOC+OCI_RETURN_NULLS+OCI_RETURN_LOBS));
var_dump($all);
diff --git a/ext/oci8/tests/fetch_into1.phpt b/ext/oci8/tests/fetch_into1.phpt
index 97e511869e..27591eaa97 100644
--- a/ext/oci8/tests/fetch_into1.phpt
+++ b/ext/oci8/tests/fetch_into1.phpt
@@ -14,27 +14,27 @@ require __DIR__.'/create_table.inc';
$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value, string) VALUES (1, 1, NULL)";
if (!($s = oci_parse($c, $insert_sql))) {
- die("oci_parse(insert) failed!\n");
+ die("oci_parse(insert) failed!\n");
}
for ($i = 0; $i<20; $i++) {
- if (!oci_execute($s)) {
- die("oci_execute(insert) failed!\n");
- }
+ if (!oci_execute($s)) {
+ die("oci_execute(insert) failed!\n");
+ }
}
if (!oci_commit($c)) {
- die("oci_commit() failed!\n");
+ die("oci_commit() failed!\n");
}
$select_sql = "SELECT * FROM ".$schema."".$table_name."";
if (!($s = oci_parse($c, $select_sql))) {
- die("oci_parse(select) failed!\n");
+ die("oci_parse(select) failed!\n");
}
if (!oci_execute($s)) {
- die("oci_execute(select) failed!\n");
+ die("oci_execute(select) failed!\n");
}
var_dump(ocifetchinto($s, $all, OCI_NUM));
var_dump($all);
diff --git a/ext/oci8/tests/fetch_into2.phpt b/ext/oci8/tests/fetch_into2.phpt
index b79e282350..8c166e1eca 100644
--- a/ext/oci8/tests/fetch_into2.phpt
+++ b/ext/oci8/tests/fetch_into2.phpt
@@ -14,27 +14,27 @@ require __DIR__.'/create_table.inc';
$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value, string) VALUES (1, 1, NULL)";
if (!($s = oci_parse($c, $insert_sql))) {
- die("oci_parse(insert) failed!\n");
+ die("oci_parse(insert) failed!\n");
}
for ($i = 0; $i<20; $i++) {
- if (!oci_execute($s)) {
- die("oci_execute(insert) failed!\n");
- }
+ if (!oci_execute($s)) {
+ die("oci_execute(insert) failed!\n");
+ }
}
if (!oci_commit($c)) {
- die("oci_commit() failed!\n");
+ die("oci_commit() failed!\n");
}
$select_sql = "SELECT * FROM ".$schema."".$table_name."";
if (!($s = oci_parse($c, $select_sql))) {
- die("oci_parse(select) failed!\n");
+ die("oci_parse(select) failed!\n");
}
if (!oci_execute($s)) {
- die("oci_execute(select) failed!\n");
+ die("oci_execute(select) failed!\n");
}
var_dump(ocifetchinto($s));
var_dump($all);
diff --git a/ext/oci8/tests/fetch_object.phpt b/ext/oci8/tests/fetch_object.phpt
index 053b3136f3..1e270b6000 100644
--- a/ext/oci8/tests/fetch_object.phpt
+++ b/ext/oci8/tests/fetch_object.phpt
@@ -77,8 +77,6 @@ $stmtarray = array(
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Test 1
object(stdClass)#1 (3) {
@@ -120,4 +118,3 @@ Test 3
Notice: Undefined property: stdClass::$CASESENSITIVE in %sfetch_object.php on line %d
-===DONE===
diff --git a/ext/oci8/tests/fetch_object_1.phpt b/ext/oci8/tests/fetch_object_1.phpt
index 3480aa25b1..586daebca8 100644
--- a/ext/oci8/tests/fetch_object_1.phpt
+++ b/ext/oci8/tests/fetch_object_1.phpt
@@ -77,8 +77,6 @@ $stmtarray = array(
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Test 1
object(stdClass)#%d (3) {
@@ -120,4 +118,3 @@ Test 3
Notice: Undefined property: stdClass::$CASESENSITIVE in %sfetch_object_1.php on line %d
-===DONE===
diff --git a/ext/oci8/tests/fetch_object_2.phpt b/ext/oci8/tests/fetch_object_2.phpt
index 648d1dd073..8d8c334182 100644
--- a/ext/oci8/tests/fetch_object_2.phpt
+++ b/ext/oci8/tests/fetch_object_2.phpt
@@ -63,8 +63,6 @@ $stmtarray = array(
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Test 1
object(stdClass)#%d (3) {
@@ -110,4 +108,3 @@ Test 2
789
3rd row col2 string
3 more text
-===DONE===
diff --git a/ext/oci8/tests/fetch_row.phpt b/ext/oci8/tests/fetch_row.phpt
index b50b65d480..6dcc1f2c5c 100644
--- a/ext/oci8/tests/fetch_row.phpt
+++ b/ext/oci8/tests/fetch_row.phpt
@@ -22,14 +22,14 @@ oci8_test_sql_execute($c, $stmtarray);
// Run Test
if (!($s = oci_parse($c, "select * from fetch_row_tab"))) {
- die("oci_parse(select) failed!\n");
+ die("oci_parse(select) failed!\n");
}
if (!oci_execute($s)) {
- die("oci_execute(select) failed!\n");
+ die("oci_execute(select) failed!\n");
}
while ($row = oci_fetch_row($s)) {
- var_dump($row);
+ var_dump($row);
}
// Cleanup
diff --git a/ext/oci8/tests/field_funcs.phpt b/ext/oci8/tests/field_funcs.phpt
index 1432dcd4c0..76ff3d4f9f 100644
--- a/ext/oci8/tests/field_funcs.phpt
+++ b/ext/oci8/tests/field_funcs.phpt
@@ -14,41 +14,41 @@ require __DIR__.'/create_table.inc';
$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)";
if (!($s = oci_parse($c, $insert_sql))) {
- die("oci_parse(insert) failed!\n");
+ die("oci_parse(insert) failed!\n");
}
for ($i = 0; $i<3; $i++) {
- if (!oci_execute($s)) {
- die("oci_execute(insert) failed!\n");
- }
+ if (!oci_execute($s)) {
+ die("oci_execute(insert) failed!\n");
+ }
}
if (!oci_commit($c)) {
- die("oci_commit() failed!\n");
+ die("oci_commit() failed!\n");
}
$select_sql = "SELECT * FROM ".$schema."".$table_name."";
if (!($s = oci_parse($c, $select_sql))) {
- die("oci_parse(select) failed!\n");
+ die("oci_parse(select) failed!\n");
}
if (!oci_execute($s)) {
- die("oci_execute(select) failed!\n");
+ die("oci_execute(select) failed!\n");
}
$row = oci_fetch_array($s, OCI_NUM + OCI_RETURN_NULLS + OCI_RETURN_LOBS);
var_dump($row);
foreach ($row as $num => $field) {
- $num++;
- var_dump(oci_field_is_null($s, $num));
- var_dump(oci_field_name($s, $num));
- var_dump(oci_field_type($s, $num));
- var_dump(oci_field_type_raw($s, $num));
- var_dump(oci_field_scale($s, $num));
- var_dump(oci_field_precision($s, $num));
- var_dump(oci_field_size($s, $num));
+ $num++;
+ var_dump(oci_field_is_null($s, $num));
+ var_dump(oci_field_name($s, $num));
+ var_dump(oci_field_type($s, $num));
+ var_dump(oci_field_type_raw($s, $num));
+ var_dump(oci_field_scale($s, $num));
+ var_dump(oci_field_precision($s, $num));
+ var_dump(oci_field_size($s, $num));
}
diff --git a/ext/oci8/tests/field_funcs2.phpt b/ext/oci8/tests/field_funcs2.phpt
index 896a63d11b..623bc3d835 100644
--- a/ext/oci8/tests/field_funcs2.phpt
+++ b/ext/oci8/tests/field_funcs2.phpt
@@ -11,26 +11,26 @@ $s = oci_parse($c, 'drop table field_funcs2_tab');
@oci_execute($s);
$t = array("C01" => "NUMBER",
- "C02" => "NUMBER(*,1)",
- "C03" => "NUMBER(9)",
- "C04" => "NUMBER(9,2)",
- "C05" => "NUMBER(9,1)",
- "C06" => "NUMBER(7,-2)",
- "C07" => "DECIMAL(4,9)",
- "C08" => "NUMERIC(4,9)",
- "C09" => "DECIMAL(4)",
- "C10" => "INTEGER",
- "C11" => "INT",
- "C12" => "SMALLINT",
- "C13" => "FLOAT",
- "C14" => "FLOAT(9)",
- "C15" => "DOUBLE PRECISION",
- "C16" => "REAL",
- );
+ "C02" => "NUMBER(*,1)",
+ "C03" => "NUMBER(9)",
+ "C04" => "NUMBER(9,2)",
+ "C05" => "NUMBER(9,1)",
+ "C06" => "NUMBER(7,-2)",
+ "C07" => "DECIMAL(4,9)",
+ "C08" => "NUMERIC(4,9)",
+ "C09" => "DECIMAL(4)",
+ "C10" => "INTEGER",
+ "C11" => "INT",
+ "C12" => "SMALLINT",
+ "C13" => "FLOAT",
+ "C14" => "FLOAT(9)",
+ "C15" => "DOUBLE PRECISION",
+ "C16" => "REAL",
+ );
$stmt = "create table field_funcs2_tab (\n";
foreach ($t as $colname => $type) {
- $stmt .= "$colname $type,\n";
+ $stmt .= "$colname $type,\n";
}
$stmt[strlen($stmt)-2] = ")";
@@ -41,10 +41,10 @@ $s = oci_parse($c, "select * from field_funcs2_tab");
oci_execute($s);
for ($i = 1; $i <= oci_num_fields($s); $i++) {
- $name = oci_field_name($s, $i);
- $precision = oci_field_precision($s, $i);
- $scale = oci_field_scale($s, $i);
- echo "$name ".$t[$name] .": precision $precision, scale $scale\n";
+ $name = oci_field_name($s, $i);
+ $precision = oci_field_precision($s, $i);
+ $scale = oci_field_scale($s, $i);
+ echo "$name ".$t[$name] .": precision $precision, scale $scale\n";
}
echo "Done\n";
diff --git a/ext/oci8/tests/field_funcs3.phpt b/ext/oci8/tests/field_funcs3.phpt
index 23f4b5ea61..75d050321e 100644
--- a/ext/oci8/tests/field_funcs3.phpt
+++ b/ext/oci8/tests/field_funcs3.phpt
@@ -25,38 +25,36 @@ oci8_test_sql_execute($c, $stmtarray);
$select_sql = "select * from field_funcs3_tab";
if (!($s = oci_parse($c, $select_sql))) {
- die("oci_parse(select) failed!\n");
+ die("oci_parse(select) failed!\n");
}
if (!oci_execute($s)) {
- die("oci_execute(select) failed!\n");
+ die("oci_execute(select) failed!\n");
}
$row = oci_fetch_array($s, OCI_NUM + OCI_RETURN_NULLS + OCI_RETURN_LOBS);
var_dump($row);
foreach ($row as $num => $field) {
- $num++;
- var_dump(oci_field_is_null($s, $num));
- var_dump(oci_field_name($s, $num));
- var_dump(oci_field_type($s, $num));
- var_dump(oci_field_type_raw($s, $num));
- var_dump(oci_field_scale($s, $num));
- var_dump(oci_field_precision($s, $num));
- var_dump(oci_field_size($s, $num));
+ $num++;
+ var_dump(oci_field_is_null($s, $num));
+ var_dump(oci_field_name($s, $num));
+ var_dump(oci_field_type($s, $num));
+ var_dump(oci_field_type_raw($s, $num));
+ var_dump(oci_field_scale($s, $num));
+ var_dump(oci_field_precision($s, $num));
+ var_dump(oci_field_size($s, $num));
}
// Clean up
$stmtarray = array(
- "drop table field_funcs3_tab"
+ "drop table field_funcs3_tab"
);
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
array(4) {
[0]=>
@@ -96,4 +94,3 @@ int(12)
int(0)
int(0)
int(7)
-===DONE===
diff --git a/ext/oci8/tests/field_funcs_old.phpt b/ext/oci8/tests/field_funcs_old.phpt
index 6417de15cd..afb6dc62e1 100644
--- a/ext/oci8/tests/field_funcs_old.phpt
+++ b/ext/oci8/tests/field_funcs_old.phpt
@@ -14,41 +14,41 @@ require __DIR__.'/create_table.inc';
$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)";
if (!($s = ociparse($c, $insert_sql))) {
- die("ociparse(insert) failed!\n");
+ die("ociparse(insert) failed!\n");
}
for ($i = 0; $i<3; $i++) {
- if (!ociexecute($s)) {
- die("ociexecute(insert) failed!\n");
- }
+ if (!ociexecute($s)) {
+ die("ociexecute(insert) failed!\n");
+ }
}
if (!ocicommit($c)) {
- die("ocicommit() failed!\n");
+ die("ocicommit() failed!\n");
}
$select_sql = "SELECT * FROM ".$schema."".$table_name."";
if (!($s = ociparse($c, $select_sql))) {
- die("ociparse(select) failed!\n");
+ die("ociparse(select) failed!\n");
}
if (!ociexecute($s)) {
- die("ociexecute(select) failed!\n");
+ die("ociexecute(select) failed!\n");
}
ocifetchinto($s, $row, OCI_NUM + OCI_RETURN_NULLS + OCI_RETURN_LOBS);
var_dump($row);
foreach ($row as $num => $field) {
- $num++;
- var_dump(ocicolumnisnull($s, $num));
- var_dump(ocicolumnname($s, $num));
- var_dump(ocicolumntype($s, $num));
- var_dump(ocicolumntyperaw($s, $num));
- var_dump(ocicolumnscale($s, $num));
- var_dump(ocicolumnprecision($s, $num));
- var_dump(ocicolumnsize($s, $num));
+ $num++;
+ var_dump(ocicolumnisnull($s, $num));
+ var_dump(ocicolumnname($s, $num));
+ var_dump(ocicolumntype($s, $num));
+ var_dump(ocicolumntyperaw($s, $num));
+ var_dump(ocicolumnscale($s, $num));
+ var_dump(ocicolumnprecision($s, $num));
+ var_dump(ocicolumnsize($s, $num));
}
diff --git a/ext/oci8/tests/imp_res_1.phpt b/ext/oci8/tests/imp_res_1.phpt
index 7379b606f2..28725fdd17 100644
--- a/ext/oci8/tests/imp_res_1.phpt
+++ b/ext/oci8/tests/imp_res_1.phpt
@@ -117,8 +117,6 @@ $stmtarray = array(
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Test 1 - oci_fetch_assoc
array(2) {
@@ -627,4 +625,3 @@ array(4) {
["C2"]=>
string(5) "klmno"
}
-===DONE===
diff --git a/ext/oci8/tests/imp_res_2.phpt b/ext/oci8/tests/imp_res_2.phpt
index b246e2ed77..8f7abdadd8 100644
--- a/ext/oci8/tests/imp_res_2.phpt
+++ b/ext/oci8/tests/imp_res_2.phpt
@@ -82,8 +82,6 @@ $stmtarray = array(
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Test 1
Test 2
@@ -96,4 +94,3 @@ array(1) {
[0]=>
string(1) "X"
}
-===DONE===
diff --git a/ext/oci8/tests/imp_res_3.phpt b/ext/oci8/tests/imp_res_3.phpt
index bd48267e96..d7f4debef9 100644
--- a/ext/oci8/tests/imp_res_3.phpt
+++ b/ext/oci8/tests/imp_res_3.phpt
@@ -80,8 +80,6 @@ $stmtarray = array(
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Test 1
1 a 1 a 1 a 1 a 1 a
@@ -1254,4 +1252,3 @@ Test 1
v
w
X
-===DONE===
diff --git a/ext/oci8/tests/imp_res_4.phpt b/ext/oci8/tests/imp_res_4.phpt
index 79e9b39dd3..b4bff4ae36 100644
--- a/ext/oci8/tests/imp_res_4.phpt
+++ b/ext/oci8/tests/imp_res_4.phpt
@@ -59,8 +59,6 @@ $stmtarray = array(
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Test 1
@@ -79,4 +77,3 @@ array(1) {
[0]=>
string(1) "2"
}
-===DONE===
diff --git a/ext/oci8/tests/imp_res_5.phpt b/ext/oci8/tests/imp_res_5.phpt
index 26107eda94..ca611acaeb 100644
--- a/ext/oci8/tests/imp_res_5.phpt
+++ b/ext/oci8/tests/imp_res_5.phpt
@@ -59,8 +59,6 @@ $stmtarray = array(
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Test 1
@@ -81,4 +79,3 @@ array(1) {
[0]=>
string(1) "2"
}
-===DONE===
diff --git a/ext/oci8/tests/imp_res_6.phpt b/ext/oci8/tests/imp_res_6.phpt
index c1ea7d34f3..d1734b9e59 100644
--- a/ext/oci8/tests/imp_res_6.phpt
+++ b/ext/oci8/tests/imp_res_6.phpt
@@ -71,8 +71,6 @@ $stmtarray = array(
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Test 1
array(2) {
@@ -115,4 +113,3 @@ array(2) {
["C2"]=>
string(1) "f"
}
-===DONE===
diff --git a/ext/oci8/tests/imp_res_7.phpt b/ext/oci8/tests/imp_res_7.phpt
index 6ba9d5fc14..a4b86ceb46 100644
--- a/ext/oci8/tests/imp_res_7.phpt
+++ b/ext/oci8/tests/imp_res_7.phpt
@@ -591,8 +591,6 @@ while (($row = oci_fetch_row($s)) != false) {
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Test 1
1
@@ -870,4 +868,3 @@ Test 1
273
274
275
-===DONE===
diff --git a/ext/oci8/tests/imp_res_call_error.phpt b/ext/oci8/tests/imp_res_call_error.phpt
index 5c2ab9988a..503bef6728 100644
--- a/ext/oci8/tests/imp_res_call_error.phpt
+++ b/ext/oci8/tests/imp_res_call_error.phpt
@@ -49,8 +49,6 @@ $stmtarray = array(
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Test 1
@@ -58,4 +56,3 @@ Warning: oci_execute(): ORA-29478: %s
ORA-06512: at "SYS.DBMS_SQL", line %d
ORA-06512: at "SYS.DBMS_SQL", line %d
ORA-06512: at "%s.IMP_RES_CALL_ERR_PROC", line %d in %simp_res_call_error.php on line %d
-===DONE===
diff --git a/ext/oci8/tests/imp_res_cancel.phpt b/ext/oci8/tests/imp_res_cancel.phpt
index e3caa86672..54c6784ea8 100644
--- a/ext/oci8/tests/imp_res_cancel.phpt
+++ b/ext/oci8/tests/imp_res_cancel.phpt
@@ -55,8 +55,6 @@ $stmtarray = array(
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Test 1
1
@@ -65,4 +63,3 @@ bool(true)
bool(true)
3
bool(true)
-===DONE===
diff --git a/ext/oci8/tests/imp_res_close.phpt b/ext/oci8/tests/imp_res_close.phpt
index 3e719b9ee2..4bd7fcb68a 100644
--- a/ext/oci8/tests/imp_res_close.phpt
+++ b/ext/oci8/tests/imp_res_close.phpt
@@ -58,11 +58,8 @@ $stmtarray = array(
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Test 1
1
Warning: oci_fetch_array(): supplied resource is not a valid oci8 statement resource in %simp_res_close.php on line %d
-===DONE===
diff --git a/ext/oci8/tests/imp_res_cursor.phpt b/ext/oci8/tests/imp_res_cursor.phpt
index 221ef80d47..4aba076bb2 100644
--- a/ext/oci8/tests/imp_res_cursor.phpt
+++ b/ext/oci8/tests/imp_res_cursor.phpt
@@ -85,8 +85,6 @@ $stmtarray = array(
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Test 1
X
@@ -96,4 +94,3 @@ Test 1
t
u
-===DONE===
diff --git a/ext/oci8/tests/imp_res_dbmsoutput.phpt b/ext/oci8/tests/imp_res_dbmsoutput.phpt
index b84ef8c556..186c522f41 100644
--- a/ext/oci8/tests/imp_res_dbmsoutput.phpt
+++ b/ext/oci8/tests/imp_res_dbmsoutput.phpt
@@ -103,8 +103,6 @@ $stmtarray = array(
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Test 1
array(2) {
@@ -133,4 +131,3 @@ array(2) {
[1]=>
string(18) "dbms_output Line 2"
}
-===DONE===
diff --git a/ext/oci8/tests/imp_res_field.phpt b/ext/oci8/tests/imp_res_field.phpt
index c96e7c3ef5..9280e4f7c0 100644
--- a/ext/oci8/tests/imp_res_field.phpt
+++ b/ext/oci8/tests/imp_res_field.phpt
@@ -124,8 +124,6 @@ $stmtarray = array(
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Test 1 - can't get IRS fields from parent
num fields : 0
@@ -224,4 +222,3 @@ array(1) {
}
num fields : 1
C4_NUMBER52 : is_null T, precision 5, scale 2, size 22, typeraw 2, type NUMBER
-===DONE===
diff --git a/ext/oci8/tests/imp_res_func_error.phpt b/ext/oci8/tests/imp_res_func_error.phpt
index 424ae47bb8..705d3ca89c 100644
--- a/ext/oci8/tests/imp_res_func_error.phpt
+++ b/ext/oci8/tests/imp_res_func_error.phpt
@@ -55,8 +55,6 @@ $stmtarray = array(
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Test 1
@@ -64,4 +62,3 @@ Warning: oci_execute(): ORA-29478: %s
ORA-06512: %s
ORA-06512: %s
ORA-06512: %s
-===DONE===
diff --git a/ext/oci8/tests/imp_res_get_1.phpt b/ext/oci8/tests/imp_res_get_1.phpt
index 7eac1033f4..5b7cad4036 100644
--- a/ext/oci8/tests/imp_res_get_1.phpt
+++ b/ext/oci8/tests/imp_res_get_1.phpt
@@ -88,8 +88,6 @@ $stmtarray = array(
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Test 1
1 abcde
@@ -106,4 +104,3 @@ Test 2 - with execute
t
u
X
-===DONE===
diff --git a/ext/oci8/tests/imp_res_get_2.phpt b/ext/oci8/tests/imp_res_get_2.phpt
index b8c2a08af5..2966412e16 100644
--- a/ext/oci8/tests/imp_res_get_2.phpt
+++ b/ext/oci8/tests/imp_res_get_2.phpt
@@ -94,8 +94,6 @@ $stmtarray = array(
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Test 1
1 abcde
@@ -104,4 +102,3 @@ Test 1
t
u
X
-===DONE===
diff --git a/ext/oci8/tests/imp_res_get_3.phpt b/ext/oci8/tests/imp_res_get_3.phpt
index 4b39dd1117..f12d740aac 100644
--- a/ext/oci8/tests/imp_res_get_3.phpt
+++ b/ext/oci8/tests/imp_res_get_3.phpt
@@ -80,8 +80,6 @@ $stmtarray = array(
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Test 1
1 abcde
@@ -264,4 +262,3 @@ Test 1
t
u
X
-===DONE===
diff --git a/ext/oci8/tests/imp_res_get_4.phpt b/ext/oci8/tests/imp_res_get_4.phpt
index 193e2f623e..03125029ed 100644
--- a/ext/oci8/tests/imp_res_get_4.phpt
+++ b/ext/oci8/tests/imp_res_get_4.phpt
@@ -118,8 +118,6 @@ $stmtarray = array(
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Test 1
1 abcde
@@ -143,4 +141,3 @@ Return is false
Warning: oci_fetch_array(): ORA-01002: %s in %simp_res_get_4.php on line %d
Return is false
-===DONE===
diff --git a/ext/oci8/tests/imp_res_get_5.phpt b/ext/oci8/tests/imp_res_get_5.phpt
index 79bb170a59..dca564b4f0 100644
--- a/ext/oci8/tests/imp_res_get_5.phpt
+++ b/ext/oci8/tests/imp_res_get_5.phpt
@@ -93,8 +93,6 @@ while (($row = oci_fetch_row($s)) != false) { // parent
oci_free_statement($s);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Test 1
3
@@ -121,4 +119,3 @@ Test 3 - fetch part of IRS explicitly
Test 4 - skip IRSs
5
6
-===DONE===
diff --git a/ext/oci8/tests/imp_res_get_all.phpt b/ext/oci8/tests/imp_res_get_all.phpt
index a1d99eeebf..cfc883e9d3 100644
--- a/ext/oci8/tests/imp_res_get_all.phpt
+++ b/ext/oci8/tests/imp_res_get_all.phpt
@@ -57,8 +57,6 @@ while (($s1 = oci_get_implicit_resultset($s))) {
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Test 1
array(1) {
@@ -117,4 +115,3 @@ array(1) {
string(1) "6"
}
}
-===DONE===
diff --git a/ext/oci8/tests/imp_res_get_cancel.phpt b/ext/oci8/tests/imp_res_get_cancel.phpt
index 5bc36f08cd..dee5625502 100644
--- a/ext/oci8/tests/imp_res_get_cancel.phpt
+++ b/ext/oci8/tests/imp_res_get_cancel.phpt
@@ -46,10 +46,7 @@ while (($s1 = oci_get_implicit_resultset($s))) {
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Test 1
1
3
-===DONE===
diff --git a/ext/oci8/tests/imp_res_get_close_1.phpt b/ext/oci8/tests/imp_res_get_close_1.phpt
index a9c2fc455c..0aef8577c2 100644
--- a/ext/oci8/tests/imp_res_get_close_1.phpt
+++ b/ext/oci8/tests/imp_res_get_close_1.phpt
@@ -52,8 +52,6 @@ while (($s1 = oci_get_implicit_resultset($s))) {
oci_free_statement($s);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Test 1
1
@@ -65,4 +63,3 @@ Warning: oci_fetch_array(): supplied resource is not a valid oci8 statement reso
5
Warning: oci_fetch_array(): supplied resource is not a valid oci8 statement resource in %s on line %d
-===DONE===
diff --git a/ext/oci8/tests/imp_res_get_close_2.phpt b/ext/oci8/tests/imp_res_get_close_2.phpt
index d435b8968d..9a0693105c 100644
--- a/ext/oci8/tests/imp_res_get_close_2.phpt
+++ b/ext/oci8/tests/imp_res_get_close_2.phpt
@@ -51,8 +51,6 @@ while (($s1 = oci_get_implicit_resultset($s))) {
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Test 1
1
@@ -60,4 +58,3 @@ Test 1
Warning: oci_fetch_array(): OCI_INVALID_HANDLE in %s on line %d
Warning: oci_get_implicit_resultset(): supplied resource is not a valid oci8 statement resource in %s on line %d
-===DONE===
diff --git a/ext/oci8/tests/imp_res_get_close_3.phpt b/ext/oci8/tests/imp_res_get_close_3.phpt
index 268c353801..36d8c50d06 100644
--- a/ext/oci8/tests/imp_res_get_close_3.phpt
+++ b/ext/oci8/tests/imp_res_get_close_3.phpt
@@ -52,8 +52,6 @@ while (($s1 = oci_get_implicit_resultset($s))) {
oci_free_statement($s);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Test 1
1
@@ -62,4 +60,3 @@ Test 1
4
5
6
-===DONE===
diff --git a/ext/oci8/tests/imp_res_get_cursor.phpt b/ext/oci8/tests/imp_res_get_cursor.phpt
index 1694fc830a..29742e465e 100644
--- a/ext/oci8/tests/imp_res_get_cursor.phpt
+++ b/ext/oci8/tests/imp_res_get_cursor.phpt
@@ -87,8 +87,6 @@ $stmtarray = array(
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Test 1
1 abcde
@@ -98,4 +96,3 @@ Test 1
t
u
X
-===DONE===
diff --git a/ext/oci8/tests/imp_res_get_dbmsoutput.phpt b/ext/oci8/tests/imp_res_get_dbmsoutput.phpt
index 95bb50cd51..52e289ca7d 100644
--- a/ext/oci8/tests/imp_res_get_dbmsoutput.phpt
+++ b/ext/oci8/tests/imp_res_get_dbmsoutput.phpt
@@ -117,8 +117,6 @@ $stmtarray = array(
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Test 1
array(3) {
@@ -152,4 +150,3 @@ array(3) {
[2]=>
string(6) "Line 3"
}
-===DONE===
diff --git a/ext/oci8/tests/imp_res_get_exec.phpt b/ext/oci8/tests/imp_res_get_exec.phpt
index f9391cc122..d0b9028a03 100644
--- a/ext/oci8/tests/imp_res_get_exec.phpt
+++ b/ext/oci8/tests/imp_res_get_exec.phpt
@@ -46,10 +46,7 @@ oci_free_statement($s);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Test 1
1
2
-===DONE===
diff --git a/ext/oci8/tests/imp_res_get_none.phpt b/ext/oci8/tests/imp_res_get_none.phpt
index 87d86c2f9f..a8d92d7326 100644
--- a/ext/oci8/tests/imp_res_get_none.phpt
+++ b/ext/oci8/tests/imp_res_get_none.phpt
@@ -38,9 +38,6 @@ while (($s1 = oci_get_implicit_resultset($s))) {
var_dump($s1);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Test 1
bool(false)
-===DONE===
diff --git a/ext/oci8/tests/imp_res_insert.phpt b/ext/oci8/tests/imp_res_insert.phpt
index 074f5ee879..21c7820506 100644
--- a/ext/oci8/tests/imp_res_insert.phpt
+++ b/ext/oci8/tests/imp_res_insert.phpt
@@ -103,8 +103,6 @@ $stmtarray = array(
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Test 1 - No commit in procedure, OCI_COMMIT_ON_SUCCESS mode
111
@@ -149,4 +147,3 @@ array(4) {
[3]=>
string(3) "444"
}
-===DONE===
diff --git a/ext/oci8/tests/imp_res_lob.phpt b/ext/oci8/tests/imp_res_lob.phpt
index 48185b6355..6673761688 100644
--- a/ext/oci8/tests/imp_res_lob.phpt
+++ b/ext/oci8/tests/imp_res_lob.phpt
@@ -82,8 +82,6 @@ $stmtarray = array(
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Test 1
1 aaaaa a
@@ -98,4 +96,3 @@ Test 1
Test 2 - don't fetch all rows
1 aaaaa a
-===DONE===
diff --git a/ext/oci8/tests/imp_res_prefetch.phpt b/ext/oci8/tests/imp_res_prefetch.phpt
index 849874bd00..6425697f7b 100644
--- a/ext/oci8/tests/imp_res_prefetch.phpt
+++ b/ext/oci8/tests/imp_res_prefetch.phpt
@@ -81,8 +81,6 @@ $stmtarray = array(
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Test 1 - prefetch 0
bool(true)
@@ -182,4 +180,3 @@ array(1) {
[0]=>
string(1) "v"
}
-===DONE===
diff --git a/ext/oci8/tests/ini_1.phpt b/ext/oci8/tests/ini_1.phpt
index 9c9b378e7b..3c306a65d3 100644
--- a/ext/oci8/tests/ini_1.phpt
+++ b/ext/oci8/tests/ini_1.phpt
@@ -53,8 +53,6 @@ var_dump(ini_set('oci8.old_oci_close_semantics', 'Off'));
echo 'oci8.old_oci_close_semantics = ' . ini_get('oci8.old_oci_close_semantics') . "\n";
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Test 1 - check initialization
oci8.privileged_connect = 1
@@ -85,4 +83,3 @@ bool(false)
oci8.default_prefetch = 555
bool(false)
oci8.old_oci_close_semantics = 1
-===DONE===
diff --git a/ext/oci8/tests/lob_001.phpt b/ext/oci8/tests/lob_001.phpt
index 3a3a48dee0..3e9c061ee0 100644
--- a/ext/oci8/tests/lob_001.phpt
+++ b/ext/oci8/tests/lob_001.phpt
Binary files differ
diff --git a/ext/oci8/tests/lob_002.phpt b/ext/oci8/tests/lob_002.phpt
index e83ae21187..156fd668d3 100644
--- a/ext/oci8/tests/lob_002.phpt
+++ b/ext/oci8/tests/lob_002.phpt
@@ -13,8 +13,8 @@ require(__DIR__.'/connect.inc');
// Initialization
$stmtarray = array(
- "drop table lob_002_tab",
- "create table lob_002_tab (id number, b1 BLOB)",
+ "drop table lob_002_tab",
+ "create table lob_002_tab (id number, b1 BLOB)",
);
oci8_test_sql_execute($c, $stmtarray);
@@ -47,14 +47,12 @@ var_dump(strlen($row[0]));
// Cleanup
$stmtarray = array(
- "drop table lob_002_tab"
+ "drop table lob_002_tab"
);
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
object(OCI-Lob)#%d (1) {
["descriptor"]=>
@@ -72,4 +70,3 @@ Warning: OCI-Lob::seek() expects parameter 1 to be int%s string given in %slob_0
NULL
bool(false)
int(40004)
-===DONE===
diff --git a/ext/oci8/tests/lob_008.phpt b/ext/oci8/tests/lob_008.phpt
index 53b75302ef..57fce95130 100644
--- a/ext/oci8/tests/lob_008.phpt
+++ b/ext/oci8/tests/lob_008.phpt
@@ -37,7 +37,7 @@ var_dump($row = oci_fetch_array($s));
$len = 0;
while (!$row[0]->eof()) {
- $len += strlen($row[0]->read(1024));
+ $len += strlen($row[0]->read(1024));
}
var_dump($len);
diff --git a/ext/oci8/tests/lob_009.phpt b/ext/oci8/tests/lob_009.phpt
index 090503f927..56d2495a62 100644
--- a/ext/oci8/tests/lob_009.phpt
+++ b/ext/oci8/tests/lob_009.phpt
@@ -35,7 +35,7 @@ oci_execute($s, OCI_DEFAULT);
var_dump($row = oci_fetch_array($s));
while (!$row[0]->eof()) {
- var_dump(str_replace("\r", "", $row[0]->read(1024)));
+ var_dump(str_replace("\r", "", $row[0]->read(1024)));
}
require __DIR__.'/drop_table.inc';
diff --git a/ext/oci8/tests/lob_010.phpt b/ext/oci8/tests/lob_010.phpt
index b4a0a77d1e..50924e5516 100644
--- a/ext/oci8/tests/lob_010.phpt
+++ b/ext/oci8/tests/lob_010.phpt
@@ -34,7 +34,7 @@ oci_execute($s, OCI_DEFAULT);
$row = oci_fetch_array($s);
while (!$row[0]->eof()) {
- var_dump($row[0]->read(1024));
+ var_dump($row[0]->read(1024));
}
require __DIR__.'/drop_table.inc';
diff --git a/ext/oci8/tests/lob_018.phpt b/ext/oci8/tests/lob_018.phpt
index be678728f0..2feab1a3f3 100644
--- a/ext/oci8/tests/lob_018.phpt
+++ b/ext/oci8/tests/lob_018.phpt
@@ -13,8 +13,8 @@ require(__DIR__.'/connect.inc');
// Initialization
$stmtarray = array(
- "drop table lob_018_tab",
- "create table lob_018_tab (mykey number, lob_1 clob)",
+ "drop table lob_018_tab",
+ "create table lob_018_tab (mykey number, lob_1 clob)",
);
oci8_test_sql_execute($c, $stmtarray);
@@ -45,8 +45,8 @@ $statement = oci_parse ($c, $query);
oci_execute($statement, OCI_DEFAULT);
while ($row = oci_fetch_array($statement, OCI_ASSOC)) {
- $result = $row['LOB_1']->load();
- var_dump($result);
+ $result = $row['LOB_1']->load();
+ var_dump($result);
}
echo "Test 2\n";
@@ -56,8 +56,8 @@ $statement = oci_parse ($c, $query);
oci_execute($statement, OCI_DEFAULT);
while ($row = oci_fetch_array($statement, OCI_ASSOC)) {
- $result = $row['LOB_1']->load();
- var_dump($result);
+ $result = $row['LOB_1']->load();
+ var_dump($result);
}
echo "Test 3 - bind with SQLT_CLOB (an alias for OCI_B_CLOB)\n";
@@ -76,8 +76,8 @@ $statement = oci_parse ($c, $query);
oci_execute($statement, OCI_DEFAULT);
while ($row = oci_fetch_array($statement, OCI_ASSOC)) {
- $result = $row['LOB_1']->load();
- var_dump($result);
+ $result = $row['LOB_1']->load();
+ var_dump($result);
}
// Cleanup
@@ -89,8 +89,6 @@ $stmtarray = array(
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Test 1
string(4) "data"
@@ -100,4 +98,3 @@ string(9) "long data"
string(4) "data"
Test 3 - bind with SQLT_CLOB (an alias for OCI_B_CLOB)
string(10) "more stuff"
-===DONE===
diff --git a/ext/oci8/tests/lob_022.phpt b/ext/oci8/tests/lob_022.phpt
index 3de78dcd2a..e353eda526 100644
--- a/ext/oci8/tests/lob_022.phpt
+++ b/ext/oci8/tests/lob_022.phpt
@@ -48,8 +48,8 @@ $statement = oci_parse ($c, $query);
oci_execute($statement, OCI_DEFAULT);
while ($row = oci_fetch_array($statement, OCI_ASSOC)) {
- $result = $row['LOB_1']->load();
- var_dump($result);
+ $result = $row['LOB_1']->load();
+ var_dump($result);
}
$query = 'SELECT * FROM lob_test ORDER BY mykey DESC';
@@ -57,8 +57,8 @@ $statement = oci_parse ($c, $query);
oci_execute($statement, OCI_DEFAULT);
while ($row = oci_fetch_array($statement, OCI_ASSOC)) {
- $result = $row['LOB_1']->load();
- var_dump($result);
+ $result = $row['LOB_1']->load();
+ var_dump($result);
}
$drop = "DROP table lob_test";
diff --git a/ext/oci8/tests/lob_023.phpt b/ext/oci8/tests/lob_023.phpt
index 8093ab63af..f8b295a441 100644
--- a/ext/oci8/tests/lob_023.phpt
+++ b/ext/oci8/tests/lob_023.phpt
@@ -40,7 +40,7 @@ oci_execute($s, OCI_DEFAULT);
var_dump($row = oci_fetch_array($s));
while (!$row[0]->eof()) {
- var_dump(str_replace("\r", "", $row[0]->read(1024)));
+ var_dump(str_replace("\r", "", $row[0]->read(1024)));
}
require __DIR__.'/drop_table.inc';
diff --git a/ext/oci8/tests/lob_027.phpt b/ext/oci8/tests/lob_027.phpt
index ec759ccb0a..ccea9b30cb 100644
--- a/ext/oci8/tests/lob_027.phpt
+++ b/ext/oci8/tests/lob_027.phpt
@@ -39,15 +39,15 @@ oci_commit($c);
for ($i = 5; $i >= 0; $i--) {
- $select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE";
- $s = oci_parse($c, $select_sql);
- oci_execute($s, OCI_DEFAULT);
+ $select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE";
+ $s = oci_parse($c, $select_sql);
+ oci_execute($s, OCI_DEFAULT);
- $row = oci_fetch_array($s);
- var_dump($row['BLOB']->load());
- var_dump($row['BLOB']->truncate(($i-1)*10));
+ $row = oci_fetch_array($s);
+ var_dump($row['BLOB']->load());
+ var_dump($row['BLOB']->truncate(($i-1)*10));
- oci_commit($c);
+ oci_commit($c);
}
$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE";
diff --git a/ext/oci8/tests/lob_040.phpt b/ext/oci8/tests/lob_040.phpt
index 2c0d361a59..3711c4b54d 100644
--- a/ext/oci8/tests/lob_040.phpt
+++ b/ext/oci8/tests/lob_040.phpt
@@ -14,8 +14,8 @@ require(__DIR__.'/connect.inc');
require(__DIR__.'/create_table.inc');
for ($i = 0; $i < NUMLOBS; $i++) {
- $s = oci_parse($c, "insert into ".$schema.$table_name." (id, clob) values(".$i.", '".$i."aaaa".$i.$i."aaaaaaaaaaaaaaaaaaaaaaaaaaaz')");
- oci_execute($s);
+ $s = oci_parse($c, "insert into ".$schema.$table_name." (id, clob) values(".$i.", '".$i."aaaa".$i.$i."aaaaaaaaaaaaaaaaaaaaaaaaaaaz')");
+ oci_execute($s);
}
echo "Test 1: CLOB as locator\n";
@@ -25,15 +25,15 @@ oci_execute($s);
$row = array();
for ($i = 0; $i < NUMLOBS; $i++) {
- $row[$i] = oci_fetch_array($s, OCI_NUM);
+ $row[$i] = oci_fetch_array($s, OCI_NUM);
}
for ($i = 0; $i < NUMLOBS; $i++) {
- echo "Row $i Size: " . $row[$i][0]->size() . "\n";
- echo "Pos 1: " . $row[$i][0]->tell() . "\n";
- echo "Data: " . $row[$i][0]->read(5) . "\n";
- echo "Pos 2: " . $row[$i][0]->tell() . "\n";
- echo "Data: " . $row[$i][0]->read(12) . "\n";
+ echo "Row $i Size: " . $row[$i][0]->size() . "\n";
+ echo "Pos 1: " . $row[$i][0]->tell() . "\n";
+ echo "Data: " . $row[$i][0]->read(5) . "\n";
+ echo "Pos 2: " . $row[$i][0]->tell() . "\n";
+ echo "Data: " . $row[$i][0]->read(12) . "\n";
}
echo "Done\n";
diff --git a/ext/oci8/tests/lob_041.phpt b/ext/oci8/tests/lob_041.phpt
index dd0bfd58be..e2bf5fbaa1 100644
--- a/ext/oci8/tests/lob_041.phpt
+++ b/ext/oci8/tests/lob_041.phpt
@@ -13,9 +13,9 @@ require __DIR__.'/connect.inc';
// Initialization
$stmtarray = array(
- "DROP table lob_041_tab",
- "CREATE table lob_041_tab(c1 CLOB)",
- "INSERT INTO lob_041_tab VALUES('test data')"
+ "DROP table lob_041_tab",
+ "CREATE table lob_041_tab(c1 CLOB)",
+ "INSERT INTO lob_041_tab VALUES('test data')"
);
oci8_test_sql_execute($c, $stmtarray);
@@ -57,7 +57,7 @@ var_dump($data);
echo "Done\n";
$stmtarray = array(
- "DROP table lob_041_tab"
+ "DROP table lob_041_tab"
);
oci8_test_sql_execute($c, $stmtarray);
diff --git a/ext/oci8/tests/lob_043.phpt b/ext/oci8/tests/lob_043.phpt
index 25e6870832..c0f8973dfd 100644
--- a/ext/oci8/tests/lob_043.phpt
+++ b/ext/oci8/tests/lob_043.phpt
@@ -14,9 +14,9 @@ require(__DIR__.'/connect.inc');
// Initialization
$stmtarray = array(
- "drop table lob_043_tab",
- "create table lob_043_tab(id number, c1 clob)",
- "begin
+ "drop table lob_043_tab",
+ "create table lob_043_tab(id number, c1 clob)",
+ "begin
for i in 1..50000 loop
insert into lob_043_tab (id, c1) values (i, i || ' abcdefghijklmnopq');
end loop;
@@ -70,7 +70,7 @@ $r = f2($c);
// Clean up
$stmtarray = array(
- "drop table lob_043_tab"
+ "drop table lob_043_tab"
);
oci8_test_sql_execute($c, $stmtarray);
@@ -78,11 +78,8 @@ oci8_test_sql_execute($c, $stmtarray);
oci_close($c);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Test 1
f1 ended
Test 2
f2 ended
-===DONE===
diff --git a/ext/oci8/tests/lob_044.phpt b/ext/oci8/tests/lob_044.phpt
index a2007c9c4b..242eef195d 100644
--- a/ext/oci8/tests/lob_044.phpt
+++ b/ext/oci8/tests/lob_044.phpt
@@ -13,8 +13,8 @@ require(__DIR__.'/connect.inc');
// Initialization
$stmtarray = array(
- "drop table lob_044_tab",
- "create table lob_044_tab (blob BLOB)",
+ "drop table lob_044_tab",
+ "create table lob_044_tab (blob BLOB)",
);
oci8_test_sql_execute($c, $stmtarray);
@@ -51,14 +51,12 @@ var_dump($row[0]->read(10000));
// Clean up
$stmtarray = array(
- "drop table lob_044_tab"
+ "drop table lob_044_tab"
);
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Test 1 - truncate on insert
int(72)
@@ -70,4 +68,3 @@ string(0) ""
Test 2 - read it back
string(0) ""
-===DONE===
diff --git a/ext/oci8/tests/lob_temp2.phpt b/ext/oci8/tests/lob_temp2.phpt
index e789014d36..1861f3021d 100644
--- a/ext/oci8/tests/lob_temp2.phpt
+++ b/ext/oci8/tests/lob_temp2.phpt
@@ -27,7 +27,6 @@ oci_fetch_all($s, $res);
var_dump($res);
?>
-===DONE===
--EXPECT--
bool(true)
array(1) {
@@ -37,4 +36,3 @@ array(1) {
string(4) "test"
}
}
-===DONE===
diff --git a/ext/oci8/tests/null_byte_1.phpt b/ext/oci8/tests/null_byte_1.phpt
index 61b5ecc2fe..5c8075cc81 100644
--- a/ext/oci8/tests/null_byte_1.phpt
+++ b/ext/oci8/tests/null_byte_1.phpt
@@ -32,8 +32,6 @@ $r = $lob->export("/tmp/abc\0def");
var_dump($r);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Test 1: Import
@@ -43,4 +41,3 @@ Test 2: Export
Warning: OCI-Lob::export() expects parameter 1 to be a valid path, string given in %snull_byte_1.php on line %d
NULL
-===DONE===
diff --git a/ext/oci8/tests/null_byte_2.phpt b/ext/oci8/tests/null_byte_2.phpt
index e95564e322..132fda5e1d 100644
--- a/ext/oci8/tests/null_byte_2.phpt
+++ b/ext/oci8/tests/null_byte_2.phpt
@@ -31,8 +31,6 @@ oci_execute($s);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Test 1: Valid use of a null byte
array(1) {
@@ -47,4 +45,3 @@ Test 3: Using a null byte in a bind variable name
Warning: oci_bind_by_name(): ORA-01036: %s in %snull_byte_2.php on line %d
Warning: oci_execute(): ORA-01008: %s in %snull_byte_2.php on line %d
-===DONE===
diff --git a/ext/oci8/tests/null_byte_3.phpt b/ext/oci8/tests/null_byte_3.phpt
index f44d218aa0..d739cf179b 100644
--- a/ext/oci8/tests/null_byte_3.phpt
+++ b/ext/oci8/tests/null_byte_3.phpt
@@ -27,8 +27,6 @@ oci_fetch_all($s, $res);
var_dump($res);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Test 1: Invalid use of a null byte
@@ -39,4 +37,3 @@ array(1) {
array(0) {
}
}
-===DONE===
diff --git a/ext/oci8/tests/password.phpt b/ext/oci8/tests/password.phpt
index b3f3bfce0c..1e8d8c83aa 100644
--- a/ext/oci8/tests/password.phpt
+++ b/ext/oci8/tests/password.phpt
@@ -14,8 +14,8 @@ if ($test_drcp) die("skip password change not supported in DRCP Mode");
require(__DIR__."/connect.inc");
$stmtarray = array(
- "drop user testuser_pw cascade",
- "create user testuser_pw identified by testuserpwd",
+ "drop user testuser_pw cascade",
+ "create user testuser_pw identified by testuserpwd",
"grant connect, create session to testuser_pw"
);
@@ -41,21 +41,21 @@ $rn3 = (int)$c3;
// Connections should differ
if ($rn1 == $rn2) {
- echo "First and second connections share a resource: Not OK\n";
- var_dump($c1);
+ echo "First and second connections share a resource: Not OK\n";
+ var_dump($c1);
}
else {
- echo "First and second connections are different: OK\n";
+ echo "First and second connections are different: OK\n";
}
// Connections should be the same
if ($rn1 == $rn3) {
- echo "First and third connections share a resource: OK\n";
+ echo "First and third connections share a resource: OK\n";
}
else {
- echo "First and third connections are different: Not OK\n";
- var_dump($c1);
- var_dump($c2);
+ echo "First and third connections are different: Not OK\n";
+ var_dump($c1);
+ var_dump($c2);
}
echo "Done\n";
diff --git a/ext/oci8/tests/password_2.phpt b/ext/oci8/tests/password_2.phpt
index b3e9e3058f..b47fad57f3 100644
--- a/ext/oci8/tests/password_2.phpt
+++ b/ext/oci8/tests/password_2.phpt
@@ -14,7 +14,7 @@ if ($test_drcp) die("skip password change not supported in DRCP Mode");
require(__DIR__."/connect.inc");
$stmtarray = array(
- "drop user testuser_pw2 cascade",
+ "drop user testuser_pw2 cascade",
"create user testuser_pw2 identified by testuserpwd",
"grant connect, create session to testuser_pw2"
);
@@ -40,21 +40,21 @@ $rn3 = (int)$c3;
// Connections should differ
if ($rn1 == $rn2) {
- echo "First and second connections share a resource: Not OK\n";
- var_dump($c1);
+ echo "First and second connections share a resource: Not OK\n";
+ var_dump($c1);
}
else {
- echo "First and second connections are different: OK\n";
+ echo "First and second connections are different: OK\n";
}
// Connections should be the same
if ($rn1 == $rn3) {
- echo "First and third connections share a resource: OK\n";
+ echo "First and third connections share a resource: OK\n";
}
else {
- echo "First and third connections are different: Not OK\n";
- var_dump($c1);
- var_dump($c2);
+ echo "First and third connections are different: Not OK\n";
+ var_dump($c1);
+ var_dump($c2);
}
echo "Done\n";
diff --git a/ext/oci8/tests/password_new.phpt b/ext/oci8/tests/password_new.phpt
index 6e9d2f4780..c0e53001df 100644
--- a/ext/oci8/tests/password_new.phpt
+++ b/ext/oci8/tests/password_new.phpt
@@ -2,7 +2,7 @@
oci_password_change()
--SKIPIF--
<?php
-$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on thes
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require(__DIR__.'/skipif.inc');
require(__DIR__.'/connect.inc');
if (empty($dbase)) die ("skip requires database connection string be set");
diff --git a/ext/oci8/tests/password_old.phpt b/ext/oci8/tests/password_old.phpt
index f791e25c3a..a92dba4366 100644
--- a/ext/oci8/tests/password_old.phpt
+++ b/ext/oci8/tests/password_old.phpt
@@ -2,7 +2,7 @@
ocipasswordchange()
--SKIPIF--
<?php
-$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on thes
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require(__DIR__.'/skipif.inc');
require(__DIR__.'/connect.inc');
if (empty($dbase)) die ("skip requires database connection string be set");
diff --git a/ext/oci8/tests/pecl_bug10194.phpt b/ext/oci8/tests/pecl_bug10194.phpt
index c0265af34f..d4b0707abc 100644
--- a/ext/oci8/tests/pecl_bug10194.phpt
+++ b/ext/oci8/tests/pecl_bug10194.phpt
@@ -34,7 +34,7 @@ $row = oci_fetch_assoc($statement);
$string = str_repeat("test", 32768*4*4);
for ($i = 0; $i < 8; $i++) {
- $row['CLOB']->write($string);
+ $row['CLOB']->write($string);
}
oci_commit($c);
diff --git a/ext/oci8/tests/pecl_bug16035.phpt b/ext/oci8/tests/pecl_bug16035.phpt
index d557e0a5c0..2fdef26831 100644
--- a/ext/oci8/tests/pecl_bug16035.phpt
+++ b/ext/oci8/tests/pecl_bug16035.phpt
@@ -19,11 +19,8 @@ ORACLE_HOME=""
oci_connect('abc', 'def', 'ghi', 'jkl');
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Warning: oci_connect(): OCIEnvNlsCreate() failed. There is something wrong with your system - please check that ORACLE_HOME and %s are set and point to the right directories in %s on line %d
Warning: oci_connect(): Error while trying to retrieve text for error ORA-01804
in %specl_bug16035.php on line %d
-===DONE===
diff --git a/ext/oci8/tests/pecl_bug16842.phpt b/ext/oci8/tests/pecl_bug16842.phpt
index c4a3fc2650..302b81d68c 100644
--- a/ext/oci8/tests/pecl_bug16842.phpt
+++ b/ext/oci8/tests/pecl_bug16842.phpt
@@ -33,8 +33,6 @@ var_dump(oci_error($s));
oci_close($c);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Test 1
Raises NO_DATA_FOUND
@@ -70,4 +68,3 @@ ORA-06512: at line 1"
["sqltext"]=>
string(29) "begin raise ZERO_DIVIDE; end;"
}
-===DONE===
diff --git a/ext/oci8/tests/pecl_bug6109.phpt b/ext/oci8/tests/pecl_bug6109.phpt
index f5cee7065d..b529058ff8 100644
--- a/ext/oci8/tests/pecl_bug6109.phpt
+++ b/ext/oci8/tests/pecl_bug6109.phpt
@@ -15,12 +15,12 @@ $s = oci_parse($c, 'delete from table_does_not_exist');
$r = @oci_execute($s);
if ($r) {
- echo "whoops - table does exist\n";
+ echo "whoops - table does exist\n";
} else {
- for ($i = 0; $i < 5; $i++) {
- $err = oci_error($s);
- echo ($i) .' -> '.$err['message'] ."\n";
- }
+ for ($i = 0; $i < 5; $i++) {
+ $err = oci_error($s);
+ echo ($i) .' -> '.$err['message'] ."\n";
+ }
}
// Cleanup
diff --git a/ext/oci8/tests/pecl_bug8816.phpt b/ext/oci8/tests/pecl_bug8816.phpt
index 30b76265dc..dda6b9f8b1 100644
--- a/ext/oci8/tests/pecl_bug8816.phpt
+++ b/ext/oci8/tests/pecl_bug8816.phpt
@@ -29,17 +29,17 @@ $values = array("1234567890111111111", "122222222222222", "985456745674567654567
$i = 0;
foreach ($values as $val) {
- $i++;
- $insert = "INSERT INTO t1 VALUES($i, ".$val.")";
- $s = oci_parse($c, $insert);
- oci_execute($s);
+ $i++;
+ $insert = "INSERT INTO t1 VALUES($i, ".$val.")";
+ $s = oci_parse($c, $insert);
+ oci_execute($s);
}
foreach ($values as $val) {
- $insert = "INSERT INTO t2 VALUES($i, ".$val.")";
- $s = oci_parse($c, $insert);
- oci_execute($s);
- $i--;
+ $insert = "INSERT INTO t2 VALUES($i, ".$val.")";
+ $s = oci_parse($c, $insert);
+ oci_execute($s);
+ $i--;
}
$query ="
@@ -56,7 +56,7 @@ $sth = oci_parse($c, $query);
oci_execute($sth);
while ( $row = oci_fetch_assoc($sth) ) {
- var_dump($row);
+ var_dump($row);
}
$s1 = oci_parse($c, $drop_1);
diff --git a/ext/oci8/tests/prefetch.phpt b/ext/oci8/tests/prefetch.phpt
index fa71b5ac6a..2bf1153ada 100644
--- a/ext/oci8/tests/prefetch.phpt
+++ b/ext/oci8/tests/prefetch.phpt
@@ -24,13 +24,13 @@ oci8_test_sql_execute($c, $stmtarray);
$select_sql = "select * from prefetch_tab";
if (!($s = oci_parse($c, $select_sql))) {
- die("oci_parse(select) failed!\n");
+ die("oci_parse(select) failed!\n");
}
var_dump(oci_set_prefetch($s, 10));
if (!oci_execute($s)) {
- die("oci_execute(select) failed!\n");
+ die("oci_execute(select) failed!\n");
}
var_dump(oci_fetch($s));
diff --git a/ext/oci8/tests/prefetch_old.phpt b/ext/oci8/tests/prefetch_old.phpt
index 58bdae7565..1fdf01305e 100644
--- a/ext/oci8/tests/prefetch_old.phpt
+++ b/ext/oci8/tests/prefetch_old.phpt
@@ -20,19 +20,19 @@ oci8_test_sql_execute($c, $stmtarray);
// Run Test
if (!ocicommit($c)) {
- die("ocicommit() failed!\n");
+ die("ocicommit() failed!\n");
}
$select_sql = "select * from prefetch_old_tab";
if (!($s = ociparse($c, $select_sql))) {
- die("ociparse(select) failed!\n");
+ die("ociparse(select) failed!\n");
}
var_dump(ocisetprefetch($s, 10));
if (!ociexecute($s)) {
- die("ociexecute(select) failed!\n");
+ die("ociexecute(select) failed!\n");
}
var_dump(ocifetch($s));
diff --git a/ext/oci8/tests/refcur_prefetch_1.phpt b/ext/oci8/tests/refcur_prefetch_1.phpt
index 1f00b9b031..911a481063 100644
--- a/ext/oci8/tests/refcur_prefetch_1.phpt
+++ b/ext/oci8/tests/refcur_prefetch_1.phpt
@@ -23,25 +23,25 @@ require(__DIR__."/connect.inc");
// Creates the necessary package and tables.
$stmtarray = array(
- "DROP TABLE refcurtest",
- "CREATE TABLE refcurtest (c1 NUMBER, c2 VARCHAR(20))",
+ "DROP TABLE refcurtest",
+ "CREATE TABLE refcurtest (c1 NUMBER, c2 VARCHAR(20))",
"CREATE or REPLACE PACKAGE refcurpkg is
type refcursortype is ref cursor;
procedure open_ref_cur(cur1 out refcursortype);
procedure fetch_ref_cur(cur1 in refcursortype, c1 out number,c2 out varchar2);
end refcurpkg;",
"CREATE or REPLACE PACKAGE body refcurpkg is
- procedure open_ref_cur(cur1 out refcursortype) is
+ procedure open_ref_cur(cur1 out refcursortype) is
begin
- open cur1 for select * from refcurtest order by c1;
- end open_ref_cur;
- procedure fetch_ref_cur(cur1 in refcursortype, c1 out number,
- c2 out varchar2) is
- begin
- fetch cur1 into c1,c2;
- end fetch_ref_cur;
+ open cur1 for select * from refcurtest order by c1;
+ end open_ref_cur;
+ procedure fetch_ref_cur(cur1 in refcursortype, c1 out number,
+ c2 out varchar2) is
+ begin
+ fetch cur1 into c1,c2;
+ end fetch_ref_cur;
end refcurpkg;"
- );
+ );
oci8_test_sql_execute($c, $stmtarray);
diff --git a/ext/oci8/tests/refcur_prefetch_2.phpt b/ext/oci8/tests/refcur_prefetch_2.phpt
index 10f0764a7a..69146914a4 100644
--- a/ext/oci8/tests/refcur_prefetch_2.phpt
+++ b/ext/oci8/tests/refcur_prefetch_2.phpt
@@ -23,25 +23,25 @@ require __DIR__."/connect.inc";
// Creates the necessary package and tables.
$stmtarray = array(
- "DROP TABLE refcurtest",
- "CREATE TABLE refcurtest (c1 NUMBER, c2 VARCHAR(20))",
+ "DROP TABLE refcurtest",
+ "CREATE TABLE refcurtest (c1 NUMBER, c2 VARCHAR(20))",
"CREATE or REPLACE PACKAGE refcurpkg is
type refcursortype is ref cursor;
procedure open_ref_cur(cur1 out refcursortype);
procedure fetch_ref_cur(cur1 in refcursortype, c1 out number,c2 out varchar2);
end refcurpkg;",
"CREATE or REPLACE PACKAGE body refcurpkg is
- procedure open_ref_cur(cur1 out refcursortype) is
+ procedure open_ref_cur(cur1 out refcursortype) is
begin
- open cur1 for select * from refcurtest order by c1;
- end open_ref_cur;
- procedure fetch_ref_cur(cur1 in refcursortype, c1 out number,
- c2 out varchar2) is
- begin
- fetch cur1 into c1,c2;
- end fetch_ref_cur;
+ open cur1 for select * from refcurtest order by c1;
+ end open_ref_cur;
+ procedure fetch_ref_cur(cur1 in refcursortype, c1 out number,
+ c2 out varchar2) is
+ begin
+ fetch cur1 into c1,c2;
+ end fetch_ref_cur;
end refcurpkg;"
- );
+ );
oci8_test_sql_execute($c, $stmtarray);
@@ -130,7 +130,7 @@ var_dump($c2);
function print_roundtrips($c) {
$sql_stmt = "select value from v\$mystat a,v\$statname c where
- a.statistic#=c.statistic# and c.name='SQL*Net roundtrips to/from client'";
+ a.statistic#=c.statistic# and c.name='SQL*Net roundtrips to/from client'";
$s = oci_parse($c,$sql_stmt);
oci_define_by_name($s,"VALUE",$value);
oci_execute($s);
diff --git a/ext/oci8/tests/refcur_prefetch_4.phpt b/ext/oci8/tests/refcur_prefetch_4.phpt
index 8aee48cfee..6c0b1b26d0 100644
--- a/ext/oci8/tests/refcur_prefetch_4.phpt
+++ b/ext/oci8/tests/refcur_prefetch_4.phpt
@@ -23,9 +23,9 @@ require __DIR__."/connect.inc";
// Creates the necessary package and tables.
$stmtarray = array(
- "DROP TABLE refcurtest",
+ "DROP TABLE refcurtest",
- "CREATE TABLE refcurtest (c1 NUMBER, c2 VARCHAR(20))",
+ "CREATE TABLE refcurtest (c1 NUMBER, c2 VARCHAR(20))",
"CREATE or REPLACE PACKAGE refcurpkg is
type refcursortype is ref cursor;
@@ -34,16 +34,16 @@ $stmtarray = array(
end refcurpkg;",
"CREATE or REPLACE PACKAGE body refcurpkg is
- procedure open_ref_cur(cur1 out refcursortype) is
+ procedure open_ref_cur(cur1 out refcursortype) is
begin
- open cur1 for select * from refcurtest order by c1;
- end open_ref_cur;
- procedure fetch_ref_cur(cur1 in refcursortype, c1 out number, c2 out varchar2) is
- begin
- fetch cur1 into c1,c2;
- end fetch_ref_cur;
+ open cur1 for select * from refcurtest order by c1;
+ end open_ref_cur;
+ procedure fetch_ref_cur(cur1 in refcursortype, c1 out number, c2 out varchar2) is
+ begin
+ fetch cur1 into c1,c2;
+ end fetch_ref_cur;
end refcurpkg;"
- );
+ );
oci8_test_sql_execute($c, $stmtarray);
@@ -134,7 +134,7 @@ var_dump($c2);
function print_roundtrips($c) {
$sql_stmt = "select value from v\$mystat a,v\$statname c where
- a.statistic#=c.statistic# and c.name='SQL*Net roundtrips to/from client'";
+ a.statistic#=c.statistic# and c.name='SQL*Net roundtrips to/from client'";
$s = oci_parse($c,$sql_stmt);
oci_define_by_name($s,"VALUE",$value);
oci_execute($s);
diff --git a/ext/oci8/tests/reflection1.phpt b/ext/oci8/tests/reflection1.phpt
index 2cf3e4055b..43c3205337 100644
--- a/ext/oci8/tests/reflection1.phpt
+++ b/ext/oci8/tests/reflection1.phpt
@@ -129,8 +129,6 @@ reflection::export(new reflectionfunction('oci_set_client_identifier'));
reflection::export(new reflectionfunction('oci_get_implicit_resultset'));
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Function [ <internal%s> function oci_define_by_name ] {
@@ -1101,4 +1099,3 @@ Function [ <internal%s> function oci_get_implicit_resultset ] {
}
}
-===DONE===
diff --git a/ext/oci8/tests/reflection2.phpt b/ext/oci8/tests/reflection2.phpt
index 9e63db1d63..38ee637b27 100644
--- a/ext/oci8/tests/reflection2.phpt
+++ b/ext/oci8/tests/reflection2.phpt
@@ -9,8 +9,6 @@ reflection::export(new reflectionclass('OCI-Lob'));
reflection::export(new reflectionclass('OCI-Collection'));
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Class [ <internal:oci8> class OCI-Lob ] {
@@ -255,4 +253,3 @@ Class [ <internal%s> class OCI-Collection ] {
}
}
-===DONE===
diff --git a/ext/oci8/tests/serverversion.phpt b/ext/oci8/tests/serverversion.phpt
index 2667cc5539..d2a781e6a3 100644
--- a/ext/oci8/tests/serverversion.phpt
+++ b/ext/oci8/tests/serverversion.phpt
@@ -8,10 +8,10 @@ oci_server_version()
require __DIR__."/connect.inc";
if (!empty($dbase)) {
- var_dump($c = oci_connect($user, $password, $dbase));
+ var_dump($c = oci_connect($user, $password, $dbase));
}
else {
- var_dump($c = oci_connect($user, $password));
+ var_dump($c = oci_connect($user, $password));
}
$v = oci_server_version($c);
diff --git a/ext/oci8/tests/statement_type.phpt b/ext/oci8/tests/statement_type.phpt
index e294cac60e..d8e6772750 100644
--- a/ext/oci8/tests/statement_type.phpt
+++ b/ext/oci8/tests/statement_type.phpt
@@ -12,8 +12,8 @@ $sqls = Array(
"DELETE FROM table WHERE id = 1",
"INSERT INTO table VALUES(1)",
"UPDATE table SET id = 1",
- "DROP TABLE table",
- "CREATE OR REPLACE PROCEDURE myproc(v1 NUMBER) as BEGIN DBMS_OUTPUT.PUT_LINE(v1); END;",
+ "DROP TABLE table",
+ "CREATE OR REPLACE PROCEDURE myproc(v1 NUMBER) as BEGIN DBMS_OUTPUT.PUT_LINE(v1); END;",
"CREATE TABLE table (id NUMBER)",
"ALTER TABLE table ADD (col1 NUMBER)",
"BEGIN NULL; END;",
@@ -24,8 +24,8 @@ $sqls = Array(
);
foreach ($sqls as $sql) {
- $s = oci_parse($c, $sql);
- var_dump(oci_statement_type($s));
+ $s = oci_parse($c, $sql);
+ var_dump(oci_statement_type($s));
}
echo "Done\n";
diff --git a/ext/oci8/tests/statement_type_old.phpt b/ext/oci8/tests/statement_type_old.phpt
index aa0565e27b..b095bc245f 100644
--- a/ext/oci8/tests/statement_type_old.phpt
+++ b/ext/oci8/tests/statement_type_old.phpt
@@ -8,10 +8,10 @@ ocistatementtype()
require __DIR__."/connect.inc";
if (!empty($dbase)) {
- var_dump($c = ocilogon($user, $password, $dbase));
+ var_dump($c = ocilogon($user, $password, $dbase));
}
else {
- var_dump($c = ocilogon($user, $password));
+ var_dump($c = ocilogon($user, $password));
}
$sqls = Array(
@@ -19,8 +19,8 @@ $sqls = Array(
"DELETE FROM table WHERE id = 1",
"INSERT INTO table VALUES(1)",
"UPDATE table SET id = 1",
- "DROP TABLE table",
- "CREATE OR REPLACE PROCEDURE myproc(v1 NUMBER) as BEGIN DBMS_OUTPUT.PUT_LINE(v1); END;",
+ "DROP TABLE table",
+ "CREATE OR REPLACE PROCEDURE myproc(v1 NUMBER) as BEGIN DBMS_OUTPUT.PUT_LINE(v1); END;",
"CREATE TABLE table (id NUMBER)",
"ALTER TABLE table ADD (col1 NUMBER)",
"BEGIN NULL; END;",
@@ -31,8 +31,8 @@ $sqls = Array(
);
foreach ($sqls as $sql) {
- $s = ociparse($c, $sql);
- var_dump(ocistatementtype($s));
+ $s = ociparse($c, $sql);
+ var_dump(ocistatementtype($s));
}
echo "Done\n";
diff --git a/ext/oci8/tests/testping.phpt b/ext/oci8/tests/testping.phpt
index 2c64c440d7..589b5c21b0 100644
--- a/ext/oci8/tests/testping.phpt
+++ b/ext/oci8/tests/testping.phpt
@@ -10,12 +10,12 @@ oci8.ping_interval=0
require(__DIR__.'/details.inc');
for ($i = 0; $i < 2; $i++) {
- if (!empty($dbase)) {
- $c = oci_pconnect($user,$password,$dbase);
- }
- else {
- $c = oci_pconnect($user,$password);
- }
+ if (!empty($dbase)) {
+ $c = oci_pconnect($user,$password,$dbase);
+ }
+ else {
+ $c = oci_pconnect($user,$password);
+ }
}
echo "Done\n";
diff --git a/ext/oci8/tests/xmltype_01.phpt b/ext/oci8/tests/xmltype_01.phpt
index debbe14f83..a99a39223e 100644
--- a/ext/oci8/tests/xmltype_01.phpt
+++ b/ext/oci8/tests/xmltype_01.phpt
@@ -14,37 +14,37 @@ require(__DIR__."/connect.inc");
// Initialization
$stmtarray = array(
- "drop table xtt",
- "create table xtt
- (xt_id number, xt_spec xmltype)
- xmltype xt_spec store as clob",
- "insert into xtt (xt_id, xt_spec) values
- (1,
- xmltype('<?xml version=\"1.0\"?>
- <Xt>
- <XtId>1</XtId>
- <Size>Big</Size>
- <Area>12345</Area>
- <Hardness>20</Hardness>
- <Lip>Curved</Lip>
- <Color>Red</Color>
- <Nice>N</Nice>
- <Compact>Tiny</Compact>
- <Material>Steel</Material>
- </Xt>'))"
+ "drop table xtt",
+ "create table xtt
+ (xt_id number, xt_spec xmltype)
+ xmltype xt_spec store as clob",
+ "insert into xtt (xt_id, xt_spec) values
+ (1,
+ xmltype('<?xml version=\"1.0\"?>
+ <Xt>
+ <XtId>1</XtId>
+ <Size>Big</Size>
+ <Area>12345</Area>
+ <Hardness>20</Hardness>
+ <Lip>Curved</Lip>
+ <Color>Red</Color>
+ <Nice>N</Nice>
+ <Compact>Tiny</Compact>
+ <Material>Steel</Material>
+ </Xt>'))"
);
oci8_test_sql_execute($c, str_replace("\r", "", $stmtarray));
function do_query($c)
{
- $s = oci_parse($c, 'select XMLType.getClobVal(xt_spec)
- from xtt where xt_id = 1');
- oci_execute($s);
- $row = oci_fetch_row($s);
- $data = $row[0]->load();
- var_dump($data);
- return($data);
+ $s = oci_parse($c, 'select XMLType.getClobVal(xt_spec)
+ from xtt where xt_id = 1');
+ oci_execute($s);
+ $row = oci_fetch_row($s);
+ $data = $row[0]->load();
+ var_dump($data);
+ return($data);
}
// Check
@@ -58,8 +58,8 @@ $sx->Nice = 'Y';
// Insert changes using a temporary CLOB
$s = oci_parse($c, 'update xtt
- set xt_spec = XMLType(:clob)
- where xt_id = 1');
+ set xt_spec = XMLType(:clob)
+ where xt_id = 1');
$lob = oci_new_descriptor($c, OCI_D_LOB);
oci_bind_by_name($s, ':clob', $lob, -1, OCI_B_CLOB);
$lob->writeTemporary($sx->asXml());
@@ -73,7 +73,7 @@ $data = do_query($c);
// Cleanup
$stmtarray = array(
- "drop table xtt",
+ "drop table xtt",
);
oci8_test_sql_execute($c, $stmtarray);
diff --git a/ext/oci8/tests/xmltype_02.phpt b/ext/oci8/tests/xmltype_02.phpt
index 35f8750255..6b701b0c93 100644
--- a/ext/oci8/tests/xmltype_02.phpt
+++ b/ext/oci8/tests/xmltype_02.phpt
@@ -14,8 +14,8 @@ require(__DIR__.'/connect.inc');
// Initialization
$stmtarray = array(
- "drop table xmltype_02_tab",
- "create table xmltype_02_tab (warehouse_id number, warehouse_spec xmltype)",
+ "drop table xmltype_02_tab",
+ "create table xmltype_02_tab (warehouse_id number, warehouse_spec xmltype)",
);
oci8_test_sql_execute($c, $stmtarray);
@@ -101,14 +101,12 @@ $row[0]->free();
// Clean up
$stmtarray = array(
- "drop table xmltype_02_tab"
+ "drop table xmltype_02_tab"
);
oci8_test_sql_execute($c, $stmtarray);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Test 1 Insert new XML data using a temporary CLOB
array(1) {
@@ -178,4 +176,3 @@ string(%d) "<?xml version="1.0"?>
%sVClearance>10</VClearance>
</Warehouse>
"
-===DONE===
diff --git a/ext/odbc/odbc.stub.php b/ext/odbc/odbc.stub.php
new file mode 100644
index 0000000000..9eafe46ae5
--- /dev/null
+++ b/ext/odbc/odbc.stub.php
@@ -0,0 +1,191 @@
+<?php
+
+function odbc_close_all(): void {}
+
+/** @param resource $result_id */
+function odbc_binmode($result_id, int $mode): bool {}
+
+/** @param resource $result_id */
+function odbc_longreadlen($result_id, int $length): bool {}
+
+/**
+ * @param resource $result_id
+ * @return resource|false
+ */
+function odbc_prepare($connection_id, string $query) {}
+
+/** @param resource $result_id */
+function odbc_execute($result_id, array $parameters_array = UNKNOWN): bool {}
+
+/** @param resource $result_id */
+function odbc_cursor($result_id): string|false {}
+
+#ifdef HAVE_SQLDATASOURCES
+/** @param resource $connection_id */
+function odbc_data_source($connection_id, int $fetch_type): array|false {}
+#endif
+
+/**
+ * @param resource $connection_id
+ * @return resource|false
+ */
+function odbc_exec($connection_id, string $query, int $flags = UNKNOWN) {}
+
+/**
+ * @param resource $connection_id
+ * @return resource|false
+ */
+function odbc_do($connection_id, string $query, int $flags = UNKNOWN) {}
+
+#ifdef PHP_ODBC_HAVE_FETCH_HASH
+/** @param resource $result */
+function odbc_fetch_object($result, int $rownumber = -1): stdClass|false {}
+
+/** @param resource $result */
+function odbc_fetch_array($result, int $rownumber = -1): array|false {}
+#endif
+
+/** @param resource $result_id */
+function odbc_fetch_into($result_id, &$result_array, int $rownumber = 0): int|false {}
+
+/** @param resource $result_id */
+function odbc_fetch_row($result_id, int $row_number = UNKNOWN): bool {}
+
+/**
+ * @param resource $result_id
+ * @param string|int $field
+ */
+function odbc_result($result_id, $field): string|bool|null {}
+
+/** @param resource $result_id */
+function odbc_result_all($result_id, string $format = ''): int|false {}
+
+/** @param resource $result_id */
+function odbc_free_result($result_id): bool {}
+
+/** @return resource|false */
+function odbc_connect(string $dsn, string $user, string $password, int $cursor_option = SQL_CUR_USE_DRIVER) {}
+
+/** @return resource|false */
+function odbc_pconnect(string $dsn, string $user, string $password, int $cursor_option = SQL_CUR_USE_DRIVER) {}
+
+/** @param resource $connection_id */
+function odbc_close($connection_id): void {}
+
+/** @param resource $result_id */
+function odbc_num_rows($result_id): int {}
+
+#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30)
+/** @param resource $result_id */
+function odbc_next_result($result_id): bool {}
+#endif
+
+/** @param resource $result_id */
+function odbc_num_fields($result_id): int {}
+
+/** @param resource $result_id */
+function odbc_field_name($result_id, int $field_number): string|false {}
+
+/** @param resource $result_id */
+function odbc_field_type($result_id, int $field_number): string|false {}
+
+/** @param resource $result_id */
+function odbc_field_len($result_id, int $field_number): int|false {}
+
+/** @param resource $result_id */
+function odbc_field_precision($result_id, int $field_number): int|false {}
+
+/** @param resource $result_id */
+function odbc_field_scale($result_id, int $field_number): int|false {}
+
+/** @param resource $result_id */
+function odbc_field_num($result_id, string $field_name): int|false {}
+
+/** @param resource $connection_id */
+function odbc_autocommit($connection_id, int $onoff = 0): int|bool {}
+
+/** @param resource $connection_id */
+function odbc_commit($connection_id): bool {}
+
+/** @param resource $connection_id */
+function odbc_rollback($connection_id): bool {}
+
+/** @param resource $connection_id */
+function odbc_error($connection_id = UNKNOWN): string {}
+
+/** @param resource $connection_id */
+function odbc_errormsg($connection_id = UNKNOWN): string {}
+
+/** @param resource $conn_id */
+function odbc_setoption($conn_id, int $which, int $option, int $value): bool {}
+
+/**
+ * @param resource $connection_id
+ * @return resource|false
+ */
+function odbc_tables($connection_id, ?string $qualfier = null, string $owner = UNKNOWN, string $name = UNKNOWN, string $table_types = UNKNOWN) {}
+
+/**
+ * @param resource $connection_id
+ * @return resource|false
+ */
+function odbc_columns($connection_id, ?string $qualifier = null, string $owner = UNKNOWN, string $table_name = UNKNOWN, string $column_name = UNKNOWN) {}
+
+/**
+ * @param resource $connection_id
+ * @return resource|false
+ */
+function odbc_gettypeinfo($connection_id, int $data_type = 0) {}
+
+/**
+ * @param resource $connection_id
+ * @return resource|false
+ */
+function odbc_primarykeys($connection_id, ?string $qualifier, string $owner, string $table) {}
+
+#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35)
+/**
+ * @param resource $connection_id
+ * @return resource|false
+ */
+function odbc_procedurecolumns($connection_id, ?string $qualifier = null, string $owner = UNKNOWN, string $proc = UNKNOWN, string $column = UNKNOWN) {}
+
+/**
+ * @param resource $connection_id
+ * @return resource|false
+ */
+function odbc_procedures($connection_id, ?string $qualifier = null, string $owner = UNKNOWN, string $name = UNKNOWN) {}
+
+/**
+ * @param resource $connection_id
+ * @return resource|false
+ */
+function odbc_foreignkeys($connection_id, ?string $pk_qualifier, string $pk_owner, string $pk_table, string $fk_qualifier, string $fk_owner, string $fk_table) {}
+#endif
+
+/**
+ * @see https://bugs.php.net/bug.php?id=78470
+ * @param resource $connection_id
+ * @return resource|false
+ */
+function odbc_specialcolumns($connection_id, int $type, ?string $qualifier, string $owner, string $table, int $scope) {}
+
+/**
+ * @param resource $connection_id
+ * @return resource|false
+ */
+function odbc_statistics($connection_id, ?string $qualfier, string $owner, string $name, int $unique, int $accuracy) {}
+
+#if !defined(HAVE_DBMAKER) && !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) &&!defined(HAVE_SOLID_35)
+/**
+ * @param resource $connection_id
+ * @return resource|false
+ */
+function odbc_tableprivileges($connection_id, ?string $qualifier, string $owner, string $name) {}
+
+/**
+ * @param resource $connection_id
+ * @return resource|false
+ */
+function odbc_columnprivileges($connection_id, ?string $catalog, string $schema, string $table, string $column) {}
+#endif
diff --git a/ext/odbc/odbc_arginfo.h b/ext/odbc/odbc_arginfo.h
new file mode 100644
index 0000000000..41f00cb2a0
--- /dev/null
+++ b/ext/odbc/odbc_arginfo.h
@@ -0,0 +1,248 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_close_all, 0, 0, IS_VOID, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_binmode, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, result_id)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_longreadlen, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, result_id)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_prepare, 0, 0, 2)
+ ZEND_ARG_INFO(0, connection_id)
+ ZEND_ARG_TYPE_INFO(0, query, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_execute, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, result_id)
+ ZEND_ARG_TYPE_INFO(0, parameters_array, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_odbc_cursor, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, result_id)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_SQLDATASOURCES)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_odbc_data_source, 0, 2, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, connection_id)
+ ZEND_ARG_TYPE_INFO(0, fetch_type, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_exec, 0, 0, 2)
+ ZEND_ARG_INFO(0, connection_id)
+ ZEND_ARG_TYPE_INFO(0, query, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_odbc_do arginfo_odbc_exec
+
+#if defined(PHP_ODBC_HAVE_FETCH_HASH)
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_odbc_fetch_object, 0, 1, stdClass, MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, result)
+ ZEND_ARG_TYPE_INFO(0, rownumber, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(PHP_ODBC_HAVE_FETCH_HASH)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_odbc_fetch_array, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, result)
+ ZEND_ARG_TYPE_INFO(0, rownumber, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_odbc_fetch_into, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, result_id)
+ ZEND_ARG_INFO(1, result_array)
+ ZEND_ARG_TYPE_INFO(0, rownumber, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_fetch_row, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, result_id)
+ ZEND_ARG_TYPE_INFO(0, row_number, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_odbc_result, 0, 2, MAY_BE_STRING|MAY_BE_BOOL|MAY_BE_NULL)
+ ZEND_ARG_INFO(0, result_id)
+ ZEND_ARG_INFO(0, field)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_odbc_result_all, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, result_id)
+ ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_free_result, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, result_id)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_connect, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, dsn, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, user, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, cursor_option, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_odbc_pconnect arginfo_odbc_connect
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_close, 0, 1, IS_VOID, 0)
+ ZEND_ARG_INFO(0, connection_id)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_num_rows, 0, 1, IS_LONG, 0)
+ ZEND_ARG_INFO(0, result_id)
+ZEND_END_ARG_INFO()
+
+#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_next_result, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, result_id)
+ZEND_END_ARG_INFO()
+#endif
+
+#define arginfo_odbc_num_fields arginfo_odbc_num_rows
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_odbc_field_name, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, result_id)
+ ZEND_ARG_TYPE_INFO(0, field_number, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_odbc_field_type arginfo_odbc_field_name
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_odbc_field_len, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, result_id)
+ ZEND_ARG_TYPE_INFO(0, field_number, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_odbc_field_precision arginfo_odbc_field_len
+
+#define arginfo_odbc_field_scale arginfo_odbc_field_len
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_odbc_field_num, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, result_id)
+ ZEND_ARG_TYPE_INFO(0, field_name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_odbc_autocommit, 0, 1, MAY_BE_LONG|MAY_BE_BOOL)
+ ZEND_ARG_INFO(0, connection_id)
+ ZEND_ARG_TYPE_INFO(0, onoff, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_commit, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, connection_id)
+ZEND_END_ARG_INFO()
+
+#define arginfo_odbc_rollback arginfo_odbc_commit
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_error, 0, 0, IS_STRING, 0)
+ ZEND_ARG_INFO(0, connection_id)
+ZEND_END_ARG_INFO()
+
+#define arginfo_odbc_errormsg arginfo_odbc_error
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_setoption, 0, 4, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, conn_id)
+ ZEND_ARG_TYPE_INFO(0, which, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, value, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_tables, 0, 0, 1)
+ ZEND_ARG_INFO(0, connection_id)
+ ZEND_ARG_TYPE_INFO(0, qualfier, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, owner, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, table_types, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_columns, 0, 0, 1)
+ ZEND_ARG_INFO(0, connection_id)
+ ZEND_ARG_TYPE_INFO(0, qualifier, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, owner, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, table_name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, column_name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_gettypeinfo, 0, 0, 1)
+ ZEND_ARG_INFO(0, connection_id)
+ ZEND_ARG_TYPE_INFO(0, data_type, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_primarykeys, 0, 0, 4)
+ ZEND_ARG_INFO(0, connection_id)
+ ZEND_ARG_TYPE_INFO(0, qualifier, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, owner, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, table, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_procedurecolumns, 0, 0, 1)
+ ZEND_ARG_INFO(0, connection_id)
+ ZEND_ARG_TYPE_INFO(0, qualifier, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, owner, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, proc, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, column, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_procedures, 0, 0, 1)
+ ZEND_ARG_INFO(0, connection_id)
+ ZEND_ARG_TYPE_INFO(0, qualifier, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, owner, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_foreignkeys, 0, 0, 7)
+ ZEND_ARG_INFO(0, connection_id)
+ ZEND_ARG_TYPE_INFO(0, pk_qualifier, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, pk_owner, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, pk_table, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, fk_qualifier, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, fk_owner, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, fk_table, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_specialcolumns, 0, 0, 6)
+ ZEND_ARG_INFO(0, connection_id)
+ ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, qualifier, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, owner, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, table, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, scope, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_statistics, 0, 0, 6)
+ ZEND_ARG_INFO(0, connection_id)
+ ZEND_ARG_TYPE_INFO(0, qualfier, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, owner, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, unique, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, accuracy, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#if !defined(HAVE_DBMAKER) && !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) &&!defined(HAVE_SOLID_35)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_tableprivileges, 0, 0, 4)
+ ZEND_ARG_INFO(0, connection_id)
+ ZEND_ARG_TYPE_INFO(0, qualifier, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, owner, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if !defined(HAVE_DBMAKER) && !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) &&!defined(HAVE_SOLID_35)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_columnprivileges, 0, 0, 5)
+ ZEND_ARG_INFO(0, connection_id)
+ ZEND_ARG_TYPE_INFO(0, catalog, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, schema, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, table, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, column, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c
index 19fce8d0fd..160682510f 100644
--- a/ext/odbc/php_odbc.c
+++ b/ext/odbc/php_odbc.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -34,6 +32,7 @@
#include "php_odbc.h"
#include "php_odbc_includes.h"
#include "php_globals.h"
+#include "odbc_arginfo.h"
#if HAVE_UODBC
@@ -64,261 +63,6 @@ static int le_result, le_conn, le_pconn;
#define SAFE_SQL_NTS(n) ((SQLSMALLINT) ((n)?(SQL_NTS):0))
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO(arginfo_odbc_close_all, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_binmode, 0, 0, 2)
- ZEND_ARG_INFO(0, result_id)
- ZEND_ARG_INFO(0, mode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_longreadlen, 0, 0, 2)
- ZEND_ARG_INFO(0, result_id)
- ZEND_ARG_INFO(0, length)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_prepare, 0, 0, 2)
- ZEND_ARG_INFO(0, connection_id)
- ZEND_ARG_INFO(0, query)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_execute, 0, 0, 1)
- ZEND_ARG_INFO(0, result_id)
- ZEND_ARG_INFO(0, parameters_array)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_cursor, 0, 0, 1)
- ZEND_ARG_INFO(0, result_id)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_SQLDATASOURCES
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_data_source, 0, 0, 2)
- ZEND_ARG_INFO(0, connection_id)
- ZEND_ARG_INFO(0, fetch_type)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_exec, 0, 0, 2)
- ZEND_ARG_INFO(0, connection_id)
- ZEND_ARG_INFO(0, query)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-#ifdef PHP_ODBC_HAVE_FETCH_HASH
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_fetch_object, 0, 0, 1)
- ZEND_ARG_INFO(0, result)
- ZEND_ARG_INFO(0, rownumber)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_fetch_array, 0, 0, 1)
- ZEND_ARG_INFO(0, result)
- ZEND_ARG_INFO(0, rownumber)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_fetch_into, 0, 0, 2)
- ZEND_ARG_INFO(0, result_id)
- ZEND_ARG_INFO(1, result_array)
- ZEND_ARG_INFO(0, rownumber)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_fetch_row, 0, 0, 1)
- ZEND_ARG_INFO(0, result_id)
- ZEND_ARG_INFO(0, row_number)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_result, 0, 0, 2)
- ZEND_ARG_INFO(0, result_id)
- ZEND_ARG_INFO(0, field)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_result_all, 0, 0, 1)
- ZEND_ARG_INFO(0, result_id)
- ZEND_ARG_INFO(0, format)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_free_result, 0, 0, 1)
- ZEND_ARG_INFO(0, result_id)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_connect, 0, 0, 3)
- ZEND_ARG_INFO(0, dsn)
- ZEND_ARG_INFO(0, user)
- ZEND_ARG_INFO(0, password)
- ZEND_ARG_INFO(0, cursor_option)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_pconnect, 0, 0, 3)
- ZEND_ARG_INFO(0, dsn)
- ZEND_ARG_INFO(0, user)
- ZEND_ARG_INFO(0, password)
- ZEND_ARG_INFO(0, cursor_option)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_close, 0, 0, 1)
- ZEND_ARG_INFO(0, connection_id)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_num_rows, 0, 0, 1)
- ZEND_ARG_INFO(0, result_id)
-ZEND_END_ARG_INFO()
-
-#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30)
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_next_result, 0, 0, 1)
- ZEND_ARG_INFO(0, result_id)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_num_fields, 0, 0, 1)
- ZEND_ARG_INFO(0, result_id)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_field_name, 0, 0, 2)
- ZEND_ARG_INFO(0, result_id)
- ZEND_ARG_INFO(0, field_number)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_field_type, 0, 0, 2)
- ZEND_ARG_INFO(0, result_id)
- ZEND_ARG_INFO(0, field_number)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_field_len, 0, 0, 2)
- ZEND_ARG_INFO(0, result_id)
- ZEND_ARG_INFO(0, field_number)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_field_scale, 0, 0, 2)
- ZEND_ARG_INFO(0, result_id)
- ZEND_ARG_INFO(0, field_number)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_field_num, 0, 0, 2)
- ZEND_ARG_INFO(0, result_id)
- ZEND_ARG_INFO(0, field_name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_autocommit, 0, 0, 1)
- ZEND_ARG_INFO(0, connection_id)
- ZEND_ARG_INFO(0, onoff)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_commit, 0, 0, 1)
- ZEND_ARG_INFO(0, connection_id)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_rollback, 0, 0, 1)
- ZEND_ARG_INFO(0, connection_id)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_error, 0, 0, 0)
- ZEND_ARG_INFO(0, connection_id)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_errormsg, 0, 0, 0)
- ZEND_ARG_INFO(0, connection_id)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_setoption, 0, 0, 4)
- ZEND_ARG_INFO(0, conn_id)
- ZEND_ARG_INFO(0, which)
- ZEND_ARG_INFO(0, option)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_tables, 0, 0, 1)
- ZEND_ARG_INFO(0, connection_id)
- ZEND_ARG_INFO(0, qualifier)
- ZEND_ARG_INFO(0, owner)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, table_types)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_columns, 0, 0, 1)
- ZEND_ARG_INFO(0, connection_id)
- ZEND_ARG_INFO(0, qualifier)
- ZEND_ARG_INFO(0, owner)
- ZEND_ARG_INFO(0, table_name)
- ZEND_ARG_INFO(0, column_name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_gettypeinfo, 0, 0, 1)
- ZEND_ARG_INFO(0, connection_id)
- ZEND_ARG_INFO(0, data_type)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_primarykeys, 0, 0, 4)
- ZEND_ARG_INFO(0, connection_id)
- ZEND_ARG_INFO(0, qualifier)
- ZEND_ARG_INFO(0, owner)
- ZEND_ARG_INFO(0, table)
-ZEND_END_ARG_INFO()
-
-#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35)
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_procedurecolumns, 0, 0, 1)
- ZEND_ARG_INFO(0, connection_id)
- ZEND_ARG_INFO(0, qualifier)
- ZEND_ARG_INFO(0, owner)
- ZEND_ARG_INFO(0, proc)
- ZEND_ARG_INFO(0, column)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_procedures, 0, 0, 1)
- ZEND_ARG_INFO(0, connection_id)
- ZEND_ARG_INFO(0, qualifier)
- ZEND_ARG_INFO(0, owner)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_foreignkeys, 0, 0, 7)
- ZEND_ARG_INFO(0, connection_id)
- ZEND_ARG_INFO(0, pk_qualifier)
- ZEND_ARG_INFO(0, pk_owner)
- ZEND_ARG_INFO(0, pk_table)
- ZEND_ARG_INFO(0, fk_qualifier)
- ZEND_ARG_INFO(0, fk_owner)
- ZEND_ARG_INFO(0, fk_table)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_specialcolumns, 0, 0, 7)
- ZEND_ARG_INFO(0, connection_id)
- ZEND_ARG_INFO(0, type)
- ZEND_ARG_INFO(0, qualifier)
- ZEND_ARG_INFO(0, owner)
- ZEND_ARG_INFO(0, table)
- ZEND_ARG_INFO(0, scope)
- ZEND_ARG_INFO(0, nullable)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_statistics, 0, 0, 6)
- ZEND_ARG_INFO(0, connection_id)
- ZEND_ARG_INFO(0, qualifier)
- ZEND_ARG_INFO(0, owner)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, unique)
- ZEND_ARG_INFO(0, accuracy)
-ZEND_END_ARG_INFO()
-
-#if !defined(HAVE_DBMAKER) && !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) &&!defined(HAVE_SOLID_35)
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_tableprivileges, 0, 0, 4)
- ZEND_ARG_INFO(0, connection_id)
- ZEND_ARG_INFO(0, qualifier)
- ZEND_ARG_INFO(0, owner)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_columnprivileges, 0, 0, 5)
- ZEND_ARG_INFO(0, connection_id)
- ZEND_ARG_INFO(0, catalog)
- ZEND_ARG_INFO(0, schema)
- ZEND_ARG_INFO(0, table)
- ZEND_ARG_INFO(0, column)
-ZEND_END_ARG_INFO()
-#endif
-/* }}} */
-
/* {{{ odbc_functions[]
*/
static const zend_function_entry odbc_functions[] = {
@@ -375,8 +119,8 @@ static const zend_function_entry odbc_functions[] = {
PHP_FE(odbc_procedures, arginfo_odbc_procedures)
PHP_FE(odbc_procedurecolumns, arginfo_odbc_procedurecolumns)
#endif
- PHP_FALIAS(odbc_do, odbc_exec, arginfo_odbc_exec)
- PHP_FALIAS(odbc_field_precision, odbc_field_len, arginfo_odbc_field_len)
+ PHP_FALIAS(odbc_do, odbc_exec, arginfo_odbc_do)
+ PHP_FALIAS(odbc_field_precision, odbc_field_len, arginfo_odbc_field_precision)
PHP_FE_END
};
/* }}} */
@@ -917,11 +661,11 @@ void php_odbc_fetch_attribs(INTERNAL_FUNCTION_PARAMETERS, int mode)
zend_long flag;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &pv_res, &flag) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (mode) {
@@ -1055,11 +799,11 @@ void odbc_transact(INTERNAL_FUNCTION_PARAMETERS, int type)
zval *pv_conn;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pv_conn) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_conn), "ODBC-Link", le_conn, le_pconn))) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
rc = SQLTransact(conn->henv, conn->hdbc, (SQLUSMALLINT)((type)?SQL_COMMIT:SQL_ROLLBACK));
@@ -1102,11 +846,11 @@ void odbc_column_lengths(INTERNAL_FUNCTION_PARAMETERS, int type)
zend_long pv_num;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &pv_res, &pv_num) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (result->numcols == 0) {
@@ -1139,7 +883,7 @@ PHP_FUNCTION(odbc_close_all)
zend_resource *p;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
/* Loop through list and close all statements */
@@ -1197,11 +941,11 @@ PHP_FUNCTION(odbc_prepare)
#endif
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &pv_conn, &query, &query_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_conn), "ODBC-Link", le_conn, le_pconn))) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
@@ -1304,11 +1048,11 @@ PHP_FUNCTION(odbc_execute)
RETCODE rc;
if (zend_parse_parameters(numArgs, "r|a", &pv_res, &pv_param_arr) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* XXX check for already bound parameters*/
@@ -1351,7 +1095,7 @@ PHP_FUNCTION(odbc_execute)
}
}
efree(params);
- RETURN_FALSE;
+ RETURN_THROWS();
}
params[i-1].vallen = Z_STRLEN_P(tmp);
@@ -1510,11 +1254,11 @@ PHP_FUNCTION(odbc_cursor)
RETCODE rc;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pv_res) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
rc = SQLGetInfo(result->conn_ptr->hdbc,SQL_MAX_CURSOR_NAME_LEN, (void *)&max_len,sizeof(max_len),&len);
@@ -1569,7 +1313,7 @@ PHP_FUNCTION(odbc_data_source)
SQLSMALLINT len1=0, len2=0, fetch_type;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &zv_conn, &zv_fetch_type) == FAILURE) {
- return;
+ RETURN_THROWS();
}
fetch_type = (SQLSMALLINT) zv_fetch_type;
@@ -1580,7 +1324,7 @@ PHP_FUNCTION(odbc_data_source)
}
if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(zv_conn), "ODBC-Link", le_conn, le_pconn))) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* now we have the "connection" lets call the DataSource object */
@@ -1634,11 +1378,11 @@ PHP_FUNCTION(odbc_exec)
#endif
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|l", &pv_conn, &query, &query_len, &pv_flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_conn), "ODBC-Link", le_conn, le_pconn))) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
@@ -1721,7 +1465,7 @@ static void php_odbc_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
zend_long pv_row = -1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|l", &pv_res, &pv_row) == FAILURE) {
- return;
+ RETURN_THROWS();
}
rownum = pv_row;
@@ -1729,12 +1473,12 @@ static void php_odbc_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
zval *pv_res, tmp;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pv_res) == FAILURE) {
- return;
+ RETURN_THROWS();
}
#endif
if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (result->numcols == 0) {
@@ -1875,18 +1619,18 @@ PHP_FUNCTION(odbc_fetch_into)
#ifdef HAVE_SQL_EXTENDED_FETCH
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz|l", &pv_res, &pv_res_arr, &pv_row) == FAILURE) {
- return;
+ RETURN_THROWS();
}
rownum = pv_row;
#else
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz", &pv_res, &pv_res_arr) == FAILURE) {
- return;
+ RETURN_THROWS();
}
#endif /* HAVE_SQL_EXTENDED_FETCH */
if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (result->numcols == 0) {
@@ -1896,7 +1640,7 @@ PHP_FUNCTION(odbc_fetch_into)
pv_res_arr = zend_try_array_init(pv_res_arr);
if (!pv_res_arr) {
- return;
+ RETURN_THROWS();
}
#ifdef HAVE_SQL_EXTENDED_FETCH
@@ -1988,11 +1732,11 @@ PHP_FUNCTION(solid_fetch_prev)
zval *pv_res;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pv_res) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (result->numcols == 0) {
php_error_docref(NULL, E_WARNING, "No tuples available at this result index");
@@ -2028,13 +1772,13 @@ PHP_FUNCTION(odbc_fetch_row)
#endif
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|l", &pv_res, &pv_row) == FAILURE) {
- return;
+ RETURN_THROWS();
}
rownum = pv_row;
if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (result->numcols == 0) {
@@ -2089,7 +1833,7 @@ PHP_FUNCTION(odbc_result)
field = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz", &pv_res, &pv_field) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (Z_TYPE_P(pv_field) == IS_STRING) {
@@ -2100,7 +1844,7 @@ PHP_FUNCTION(odbc_result)
}
if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ((result->numcols == 0)) {
@@ -2275,11 +2019,11 @@ PHP_FUNCTION(odbc_result_all)
#endif
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|s", &pv_res, &pv_format, &pv_format_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (result->numcols == 0) {
@@ -2392,11 +2136,11 @@ PHP_FUNCTION(odbc_free_result)
int i;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pv_res) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (result->values) {
@@ -2538,7 +2282,7 @@ void odbc_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
* defaulting to the cursors default
*/
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sss|l", &db, &db_len, &uid, &uid_len, &pwd, &pwd_len, &pv_opt) == FAILURE) {
- return;
+ RETURN_THROWS();
}
cur_opt = pv_opt;
@@ -2691,11 +2435,11 @@ PHP_FUNCTION(odbc_close)
int is_pconn = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pv_conn) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_conn), "ODBC-Link", le_conn, le_pconn))) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (Z_RES_P(pv_conn)->type == le_pconn) {
@@ -2728,11 +2472,11 @@ PHP_FUNCTION(odbc_num_rows)
zval *pv_res;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pv_res) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
SQLRowCount(result->stmt, &rows);
@@ -2750,11 +2494,11 @@ PHP_FUNCTION(odbc_next_result)
int rc, i;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pv_res) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (result->values) {
@@ -2801,11 +2545,11 @@ PHP_FUNCTION(odbc_num_fields)
zval *pv_res;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pv_res) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
RETURN_LONG(result->numcols);
@@ -2821,11 +2565,11 @@ PHP_FUNCTION(odbc_field_name)
zend_long pv_num;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &pv_res, &pv_num) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (result->numcols == 0) {
@@ -2858,11 +2602,11 @@ PHP_FUNCTION(odbc_field_type)
zend_long pv_num;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &pv_res, &pv_num) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (result->numcols == 0) {
@@ -2881,7 +2625,7 @@ PHP_FUNCTION(odbc_field_type)
}
PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)pv_num, SQL_COLUMN_TYPE_NAME, tmp, 31, &tmplen, NULL);
- RETURN_STRING(tmp)
+ RETURN_STRING(tmp);
}
/* }}} */
@@ -2911,11 +2655,11 @@ PHP_FUNCTION(odbc_field_num)
zval *pv_res;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &pv_res, &fname, &fname_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (result->numcols == 0) {
@@ -2948,11 +2692,11 @@ PHP_FUNCTION(odbc_autocommit)
zend_long pv_onoff = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|l", &pv_conn, &pv_onoff) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_conn), "ODBC-Link", le_conn, le_pconn))) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (ZEND_NUM_ARGS() > 1) {
@@ -2999,12 +2743,12 @@ static void php_odbc_lasterror(INTERNAL_FUNCTION_PARAMETERS, int mode)
char *ret;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|r", &pv_handle) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (ZEND_NUM_ARGS() == 1) {
if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_handle), "ODBC-Link", le_conn, le_pconn))) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (mode == 0) {
ret = conn->laststate;
@@ -3056,13 +2800,13 @@ PHP_FUNCTION(odbc_setoption)
zend_long pv_which, pv_opt, pv_val;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlll", &pv_handle, &pv_which, &pv_opt, &pv_val) == FAILURE) {
- return;
+ RETURN_THROWS();
}
switch (pv_which) {
case 1: /* SQLSetConnectOption */
if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_handle), "ODBC-Link", le_conn, le_pconn))) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (conn->persistent) {
@@ -3077,7 +2821,7 @@ PHP_FUNCTION(odbc_setoption)
break;
case 2: /* SQLSetStmtOption */
if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_handle), "ODBC result", le_result)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
rc = SQLSetStmtOption(result->stmt, (unsigned short) pv_opt, pv_val);
@@ -3114,11 +2858,11 @@ PHP_FUNCTION(odbc_tables)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|s!sss", &pv_conn, &cat, &cat_len, &schema, &schema_len,
&table, &table_len, &type, &type_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_conn), "ODBC-Link", le_conn, le_pconn))) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
@@ -3183,11 +2927,11 @@ PHP_FUNCTION(odbc_columns)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|s!sss", &pv_conn, &cat, &cat_len, &schema, &schema_len,
&table, &table_len, &column, &column_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_conn), "ODBC-Link", le_conn, le_pconn))) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
@@ -3255,11 +2999,11 @@ PHP_FUNCTION(odbc_columnprivileges)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs!sss", &pv_conn, &cat, &cat_len, &schema, &schema_len,
&table, &table_len, &column, &column_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_conn), "ODBC-Link", le_conn, le_pconn))) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
@@ -3321,7 +3065,7 @@ PHP_FUNCTION(odbc_foreignkeys)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs!sssss", &pv_conn, &pcat, &pcat_len, &pschema, &pschema_len,
&ptable, &ptable_len, &fcat, &fcat_len, &fschema, &fschema_len, &ftable, &ftable_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
#if defined(HAVE_DBMAKER) || defined(HAVE_IBMDB2)
@@ -3337,7 +3081,7 @@ PHP_FUNCTION(odbc_foreignkeys)
#endif
if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_conn), "ODBC-Link", le_conn, le_pconn))) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
@@ -3399,13 +3143,13 @@ PHP_FUNCTION(odbc_gettypeinfo)
SQLSMALLINT data_type;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|l", &pv_conn, &pv_data_type) == FAILURE) {
- return;
+ RETURN_THROWS();
}
data_type = (SQLSMALLINT) pv_data_type;
if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_conn), "ODBC-Link", le_conn, le_pconn))) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
@@ -3460,11 +3204,11 @@ PHP_FUNCTION(odbc_primarykeys)
RETCODE rc;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs!ss", &pv_conn, &cat, &cat_len, &schema, &schema_len, &table, &table_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_conn), "ODBC-Link", le_conn, le_pconn))) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
@@ -3528,11 +3272,11 @@ PHP_FUNCTION(odbc_procedurecolumns)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|s!sss", &pv_conn, &cat, &cat_len, &schema, &schema_len,
&proc, &proc_len, &col, &col_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_conn), "ODBC-Link", le_conn, le_pconn))) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
@@ -3597,11 +3341,11 @@ PHP_FUNCTION(odbc_procedures)
}
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|s!ss", &pv_conn, &cat, &cat_len, &schema, &schema_len, &proc, &proc_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_conn), "ODBC-Link", le_conn, le_pconn))) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
@@ -3663,7 +3407,7 @@ PHP_FUNCTION(odbc_specialcolumns)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rls!ssl", &pv_conn, &vtype, &cat, &cat_len, &schema, &schema_len,
&name, &name_len, &vscope, &vnullable) == FAILURE) {
- return;
+ RETURN_THROWS();
}
type = (SQLUSMALLINT) vtype;
@@ -3671,7 +3415,7 @@ PHP_FUNCTION(odbc_specialcolumns)
nullable = (SQLUSMALLINT) vnullable;
if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_conn), "ODBC-Link", le_conn, le_pconn))) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
@@ -3735,14 +3479,14 @@ PHP_FUNCTION(odbc_statistics)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs!ssll", &pv_conn, &cat, &cat_len, &schema, &schema_len,
&name, &name_len, &vunique, &vreserved) == FAILURE) {
- return;
+ RETURN_THROWS();
}
unique = (SQLUSMALLINT) vunique;
reserved = (SQLUSMALLINT) vreserved;
if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_conn), "ODBC-Link", le_conn, le_pconn))) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
@@ -3803,11 +3547,11 @@ PHP_FUNCTION(odbc_tableprivileges)
RETCODE rc;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs!ss", &pv_conn, &cat, &cat_len, &schema, &schema_len, &table, &table_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_conn), "ODBC-Link", le_conn, le_pconn))) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
diff --git a/ext/odbc/php_odbc.h b/ext/odbc/php_odbc.h
index 351b31ea40..500c784de2 100644
--- a/ext/odbc/php_odbc.h
+++ b/ext/odbc/php_odbc.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/odbc/php_odbc_includes.h b/ext/odbc/php_odbc_includes.h
index 858a28af68..5e2e83e7b2 100644
--- a/ext/odbc/php_odbc_includes.h
+++ b/ext/odbc/php_odbc_includes.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/odbc/tests/bug47803.phpt b/ext/odbc/tests/bug47803.phpt
index e80b0de38b..f13da017ba 100644
--- a/ext/odbc/tests/bug47803.phpt
+++ b/ext/odbc/tests/bug47803.phpt
@@ -8,9 +8,9 @@ Bug #47803 Executing prepared statements is successful only for the first two st
include __DIR__ . "/config.inc";
$create_table = "CREATE TABLE FOO(
- [PAR_ID] [int] NOT NULL,
- [PAR_INT] [int] NULL,
- [PAR_CHR] [varchar](500) NULL
+ [PAR_ID] [int] NOT NULL,
+ [PAR_INT] [int] NULL,
+ [PAR_CHR] [varchar](500) NULL
)";
$inserts = "INSERT INTO FOO
@@ -19,16 +19,16 @@ $inserts = "INSERT INTO FOO
,[PAR_CHR])
VALUES
(1,14,''),
- (2,30,''),
- (3,7,''),
- (4,7,''),
- (5,0,''),
- (6,0,''),
- (7,20130901,''),
- (8,20140201,''),
- (9,20140201,''),
- (10,20140620,''),
- (11,221,'')";
+ (2,30,''),
+ (3,7,''),
+ (4,7,''),
+ (5,0,''),
+ (6,0,''),
+ (7,20130901,''),
+ (8,20140201,''),
+ (9,20140201,''),
+ (10,20140620,''),
+ (11,221,'')";
date_default_timezone_set('Europe/Warsaw');
@@ -40,47 +40,47 @@ odbc_exec($link, $create_table);
odbc_exec($link, $inserts);
$upd_params = array(
- array('id'=>1, 'name'=>'test 1'),
- array('id'=>2, 'name'=>'test 2'),
- array('id'=>3, 'name'=>'test 3'),
- array('id'=>4, 'name'=>'test 4'),
- array('id'=>5, 'name'=>'test 5'),
- array('id'=>10, 'name'=>'test 10'),
- array('id'=>9, 'name'=>'test 9'),
- array('id'=>8, 'name'=>'test 8'),
- array('id'=>7, 'name'=>'test 7'),
- array('id'=>6, 'name'=>'test 6'),
+ array('id'=>1, 'name'=>'test 1'),
+ array('id'=>2, 'name'=>'test 2'),
+ array('id'=>3, 'name'=>'test 3'),
+ array('id'=>4, 'name'=>'test 4'),
+ array('id'=>5, 'name'=>'test 5'),
+ array('id'=>10, 'name'=>'test 10'),
+ array('id'=>9, 'name'=>'test 9'),
+ array('id'=>8, 'name'=>'test 8'),
+ array('id'=>7, 'name'=>'test 7'),
+ array('id'=>6, 'name'=>'test 6'),
);
$sql = "UPDATE FOO
SET [PAR_CHR] = ?
WHERE [PAR_ID] = ?";
$result = odbc_prepare($link, $sql);
if (!$result) {
- print ('[sql] prep: '.$sql);
- goto out;
+ print ('[sql] prep: '.$sql);
+ goto out;
}
foreach ($upd_params as &$k) {
- if(!odbc_execute($result, array($k['name'], $k['id']))) {
- print ('[sql] exec: '."array({$k['name']}, {$k['id']})");
- goto out;
- }
+ if(!odbc_execute($result, array($k['name'], $k['id']))) {
+ print ('[sql] exec: '."array({$k['name']}, {$k['id']})");
+ goto out;
+ }
}
odbc_free_result($result);
$sql = "SELECT * FROM FOO WHERE [PAR_ID] = ?";
$result = odbc_prepare($link, $sql);
if (!$result) {
- print ('[sql] prep: '.$sql);
- goto out;
+ print ('[sql] prep: '.$sql);
+ goto out;
}
foreach ($upd_params as $k) {
- if(!odbc_execute($result, array($k['id']))) {
- print ('[sql] exec: '."array({$k['id']})");
- goto out;
- }
- while (($r = odbc_fetch_array($result)) !== false) {
- var_dump($r);
- }
+ if(!odbc_execute($result, array($k['id']))) {
+ print ('[sql] exec: '."array({$k['id']})");
+ goto out;
+ }
+ while (($r = odbc_fetch_array($result)) !== false) {
+ var_dump($r);
+ }
}
out:
@@ -88,7 +88,6 @@ if ($result) odbc_free_result($result);
odbc_close($link);
?>
-==DONE==
--EXPECT--
array(3) {
["PAR_ID"]=>
@@ -170,7 +169,6 @@ array(3) {
["PAR_CHR"]=>
string(6) "test 7"
}
-==DONE==
--CLEAN--
<?php
include 'config.inc';
diff --git a/ext/odbc/tests/bug60616.phpt b/ext/odbc/tests/bug60616.phpt
index 16536881af..9d98d46b08 100644
--- a/ext/odbc/tests/bug60616.phpt
+++ b/ext/odbc/tests/bug60616.phpt
@@ -31,31 +31,31 @@ odbc_exec($conn, "INSERT INTO FOO(ID, CHAR_COL, VARCHAR_COL, TEXT_COL) VALUES (2
$res = odbc_exec($conn, 'SELECT * FROM FOO ORDER BY ID ASC');
while(odbc_fetch_row($res)) {
- $char_col = odbc_result($res, "CHAR_COL");
- $varchar_col = odbc_result($res, "VARCHAR_COL");
- $id = odbc_result($res, "ID");
- $text_col = "";
- while (($chunk=odbc_result($res, "TEXT_COL")) !== false) {
- $text_col .= $chunk;
- }
+ $char_col = odbc_result($res, "CHAR_COL");
+ $varchar_col = odbc_result($res, "VARCHAR_COL");
+ $id = odbc_result($res, "ID");
+ $text_col = "";
+ while (($chunk=odbc_result($res, "TEXT_COL")) !== false) {
+ $text_col .= $chunk;
+ }
- if ($id == 1) {
- $euc_jp_check = $euc_jp . str_repeat(" ", (200 - mb_strlen($euc_jp)));
- if (strcmp($char_col, $euc_jp_check) == 0 && strcmp($varchar_col, $euc_jp) == 0 &&
- strcmp($text_col, $euc_jp) == 0) {
- print "EUC-JP matched\n";
- } else {
- print "EUC-JP mismatched\n";
- }
- } else {
- $ascii_check = $ascii . str_repeat(" ", (200 - strlen($ascii)));
- if (strcmp($char_col, $ascii_check) == 0 && strcmp($varchar_col, $ascii) == 0 &&
- strcmp($text_col, $ascii) == 0) {
- print "ASCII matched\n";
- } else {
- print "ASCII mismatched\n";
- }
- }
+ if ($id == 1) {
+ $euc_jp_check = $euc_jp . str_repeat(" ", (200 - mb_strlen($euc_jp)));
+ if (strcmp($char_col, $euc_jp_check) == 0 && strcmp($varchar_col, $euc_jp) == 0 &&
+ strcmp($text_col, $euc_jp) == 0) {
+ print "EUC-JP matched\n";
+ } else {
+ print "EUC-JP mismatched\n";
+ }
+ } else {
+ $ascii_check = $ascii . str_repeat(" ", (200 - strlen($ascii)));
+ if (strcmp($char_col, $ascii_check) == 0 && strcmp($varchar_col, $ascii) == 0 &&
+ strcmp($text_col, $ascii) == 0) {
+ print "ASCII matched\n";
+ } else {
+ print "ASCII mismatched\n";
+ }
+ }
}
?>
diff --git a/ext/odbc/tests/bug68087.phpt b/ext/odbc/tests/bug68087.phpt
index 3bc18125a6..64b232d9bc 100644
--- a/ext/odbc/tests/bug68087.phpt
+++ b/ext/odbc/tests/bug68087.phpt
@@ -22,23 +22,23 @@ odbc_exec($conn, "INSERT INTO FOO(ID, VARCHAR_COL, DATE_COL) VALUES (2, 'helloag
$res = odbc_exec($conn, 'SELECT * FROM FOO ORDER BY ID ASC');
while(odbc_fetch_row($res)) {
- $id = odbc_result($res, "ID");
- $varchar_col = odbc_result($res, "VARCHAR_COL");
- $date = odbc_result($res, "DATE_COL");
-
- if ($id == 1) {
- if ($date != $id_1_date) {
- print "Date_1 mismatched\n";
- } else {
- print "Date_1 matched\n";
- }
- } else {
- if ($date != $id_2_date) {
- print "Date_2 mismatched\n";
- } else {
- print "Date_2 matched\n";
- }
- }
+ $id = odbc_result($res, "ID");
+ $varchar_col = odbc_result($res, "VARCHAR_COL");
+ $date = odbc_result($res, "DATE_COL");
+
+ if ($id == 1) {
+ if ($date != $id_1_date) {
+ print "Date_1 mismatched\n";
+ } else {
+ print "Date_1 matched\n";
+ }
+ } else {
+ if ($date != $id_2_date) {
+ print "Date_2 mismatched\n";
+ } else {
+ print "Date_2 matched\n";
+ }
+ }
}
?>
diff --git a/ext/odbc/tests/bug69354.phpt b/ext/odbc/tests/bug69354.phpt
index 0e53aceab3..cf4e9114ad 100644
--- a/ext/odbc/tests/bug69354.phpt
+++ b/ext/odbc/tests/bug69354.phpt
@@ -17,20 +17,18 @@ odbc_exec($conn, "INSERT INTO FOO(ID, VARCHAR_COL) VALUES (1, '" . str_repeat("a
$res = odbc_exec($conn,"select VARCHAR_COL from FOO");
if ($res) {
- if (odbc_fetch_row($res)) {
- $ret = odbc_result($res,'varchar_col');
- echo strlen($ret), "\n";
- echo $ret[0], "\n";
- echo $ret[strlen($ret)-1], "\n";
- }
+ if (odbc_fetch_row($res)) {
+ $ret = odbc_result($res,'varchar_col');
+ echo strlen($ret), "\n";
+ echo $ret[0], "\n";
+ echo $ret[strlen($ret)-1], "\n";
+ }
}
?>
-==DONE==
--EXPECT--
100
a
a
-==DONE==
--CLEAN--
<?php
include 'config.inc';
diff --git a/ext/odbc/tests/bug71171.phpt b/ext/odbc/tests/bug71171.phpt
index 94cfb4d0e8..f7a856d14c 100644
--- a/ext/odbc/tests/bug71171.phpt
+++ b/ext/odbc/tests/bug71171.phpt
@@ -17,18 +17,16 @@ odbc_exec($conn, "INSERT INTO FOO(ID, VARCHAR_COL) VALUES (1, '" . chr(0x81) . "
$res = odbc_exec($conn,"SELECT ID FROM FOO WHERE VARCHAR_COL = '" . chr(0x81) . "'");
if ($res) {
- while($record = odbc_fetch_array($res)) var_dump($record);
+ while($record = odbc_fetch_array($res)) var_dump($record);
}
odbc_close($conn);
?>
-==DONE==
--EXPECT--
array(1) {
["ID"]=>
string(1) "1"
}
-==DONE==
--CLEAN--
<?php
include 'config.inc';
diff --git a/ext/odbc/tests/bug73448.phpt b/ext/odbc/tests/bug73448.phpt
index 5f0be913f2..ea6c585c0f 100644
--- a/ext/odbc/tests/bug73448.phpt
+++ b/ext/odbc/tests/bug73448.phpt
@@ -10,34 +10,33 @@ include 'config.inc';
$conn = odbc_connect($dsn, $user, $pass);
$sqlCommandList = array(
- "/* empty batch is without error */",
- "/* non existent procedure xy */ execute xy",
- "/* empty batch,error message is not empty */",
- "/* valid select with result */ select * from sys.sysobjects",
- "/* another erroneous query */ SELECT * FROM zwiebelfleisch",
- "/* valid select with result */ select * from sys.sysobjects",
+ "/* empty batch is without error */",
+ "/* non existent procedure xy */ execute xy",
+ "/* empty batch,error message is not empty */",
+ "/* valid select with result */ select * from sys.sysobjects",
+ "/* another erroneous query */ SELECT * FROM zwiebelfleisch",
+ "/* valid select with result */ select * from sys.sysobjects",
);
foreach ($sqlCommandList as $exampleNumber => $sql) {
- $r = @odbc_exec($conn, $sql);
+ $r = @odbc_exec($conn, $sql);
- if (false === $r) {
- $e = odbc_errormsg($conn);
- $n = odbc_error($conn);
+ if (false === $r) {
+ $e = odbc_errormsg($conn);
+ $n = odbc_error($conn);
- var_dump($sql, $n, $e);
- echo "\n";
- }
+ var_dump($sql, $n, $e);
+ echo "\n";
+ }
- if ($r) {
- odbc_free_result($r);
- }
+ if ($r) {
+ odbc_free_result($r);
+ }
}
odbc_close($conn);
?>
-==DONE==
--EXPECTF--
string(42) "/* non existent procedure xy */ execute xy"
string(5) "37000"
@@ -47,4 +46,3 @@ string(58) "/* another erroneous query */ SELECT * FROM zwiebelfleisch"
string(5) "S0002"
string(%d) "[Microsoft][%s][SQL Server]Invalid object name 'zwiebelfleisch'."
-==DONE==
diff --git a/ext/odbc/tests/bug73725.phpt b/ext/odbc/tests/bug73725.phpt
index 1ab2ba0eaa..c48a9112e7 100644
--- a/ext/odbc/tests/bug73725.phpt
+++ b/ext/odbc/tests/bug73725.phpt
@@ -23,7 +23,6 @@ $r = odbc_fetch_array($rc);
var_dump($r);
?>
-==DONE==
--EXPECT--
array(3) {
["i"]=>
@@ -41,7 +40,6 @@ array(3) {
["k"]=>
string(2) "34"
}
-==DONE==
--CLEAN--
<?php
include 'config.inc';
diff --git a/ext/odbc/tests/bug78473.phpt b/ext/odbc/tests/bug78473.phpt
index fd73b6cc07..c595d51fad 100644
--- a/ext/odbc/tests/bug78473.phpt
+++ b/ext/odbc/tests/bug78473.phpt
@@ -6,9 +6,13 @@ if (!extension_loaded('odbc')) die('skip odbc extension not available');
?>
--FILE--
<?php
-odbc_close(STDIN);
+try {
+ odbc_close(STDIN);
+} catch (TypeError $err) {
+ echo $err->getMessage(), PHP_EOL;
+}
var_dump(STDIN);
?>
--EXPECTF--
-Warning: odbc_close(): supplied resource is not a valid ODBC-Link resource in %s on line %d
+odbc_close(): supplied resource is not a valid ODBC-Link resource
resource(%d) of type (stream)
diff --git a/ext/odbc/tests/config.inc b/ext/odbc/tests/config.inc
index d9da63d0b7..78be4b2d99 100644
--- a/ext/odbc/tests/config.inc
+++ b/ext/odbc/tests/config.inc
@@ -8,11 +8,11 @@ $user = getenv("ODBC_TEST_USER");
$pass = getenv("ODBC_TEST_PASS");
if (false === $dsn) {
- $dsn = 'myodbc3';
+ $dsn = 'myodbc3';
}
if (false === $user) {
- $user = 'root';
+ $user = 'root';
}
if (false == $pass) {
- $pass = '';
+ $pass = '';
}
diff --git a/ext/odbc/tests/odbc_data_source_001.phpt b/ext/odbc/tests/odbc_data_source_001.phpt
index 8f5767315a..fedbbc1b02 100644
--- a/ext/odbc/tests/odbc_data_source_001.phpt
+++ b/ext/odbc/tests/odbc_data_source_001.phpt
@@ -15,16 +15,12 @@ include 'config.inc';
$conn = odbc_connect($dsn, $user, $pass);
var_dump(odbc_data_source($conn, NULL));
-var_dump(odbc_data_source($conn, ''));
var_dump(odbc_data_source($conn, SQL_FETCH_FIRST));
?>
--EXPECTF--
Warning: odbc_data_source(): Invalid fetch type (0) in %s on line %d
bool(false)
-
-Warning: odbc_data_source() expects parameter 2 to be int, string given in %s on line %d
-NULL
array(%d) {
%a
}
diff --git a/ext/odbc/tests/odbc_free_result_001.phpt b/ext/odbc/tests/odbc_free_result_001.phpt
index cdc421117d..223b3f0a4c 100644
--- a/ext/odbc/tests/odbc_free_result_001.phpt
+++ b/ext/odbc/tests/odbc_free_result_001.phpt
@@ -22,10 +22,21 @@ $res = odbc_exec($conn, 'SELECT * FROM FOO');
var_dump(odbc_fetch_row($res));
var_dump(odbc_result($res, 'test'));
var_dump(odbc_free_result($res));
-var_dump(odbc_free_result($conn));
-var_dump(odbc_free_result(NULL));
-var_dump(odbc_fetch_row($res));
-var_dump(odbc_result($res, 'test'));
+try {
+ var_dump(odbc_free_result($conn));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(odbc_fetch_row($res));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(odbc_result($res, 'test'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
odbc_exec($conn, 'DROP TABLE FOO');
@@ -36,15 +47,6 @@ odbc_exec($conn, 'DROP DATABASE odbcTEST');
bool(true)
string(1) "1"
bool(true)
-
-Warning: odbc_free_result(): supplied resource is not a valid ODBC result resource in %s on line %d
-bool(false)
-
-Warning: odbc_free_result() expects parameter 1 to be resource, null given in %s on line %d
-NULL
-
-Warning: odbc_fetch_row(): supplied resource is not a valid ODBC result resource in %s on line %d
-bool(false)
-
-Warning: odbc_result(): supplied resource is not a valid ODBC result resource in %s on line %d
-bool(false)
+odbc_free_result(): supplied resource is not a valid ODBC result resource
+odbc_fetch_row(): supplied resource is not a valid ODBC result resource
+odbc_result(): supplied resource is not a valid ODBC result resource
diff --git a/ext/odbc/tests/skipif.inc b/ext/odbc/tests/skipif.inc
index 4cd13d0be6..a2c9a4aade 100644
--- a/ext/odbc/tests/skipif.inc
+++ b/ext/odbc/tests/skipif.inc
@@ -6,5 +6,5 @@ include 'config.inc';
$conn = @odbc_connect($dsn, $user, $pass);
if (!$conn) {
- die('skip could not connect');
+ die('skip could not connect');
}
diff --git a/ext/opcache/Optimizer/block_pass.c b/ext/opcache/Optimizer/block_pass.c
index 3327ec86df..baf01bbb36 100644
--- a/ext/opcache/Optimizer/block_pass.c
+++ b/ext/opcache/Optimizer/block_pass.c
@@ -33,51 +33,33 @@
/* Checks if a constant (like "true") may be replaced by its value */
int zend_optimizer_get_persistent_constant(zend_string *name, zval *result, int copy)
{
- zend_constant *c;
- char *lookup_name;
- int retval = 1;
- ALLOCA_FLAG(use_heap);
-
- if ((c = zend_hash_find_ptr(EG(zend_constants), name)) == NULL) {
- lookup_name = do_alloca(ZSTR_LEN(name) + 1, use_heap);
- memcpy(lookup_name, ZSTR_VAL(name), ZSTR_LEN(name) + 1);
- zend_str_tolower(lookup_name, ZSTR_LEN(name));
-
- if ((c = zend_hash_str_find_ptr(EG(zend_constants), lookup_name, ZSTR_LEN(name))) != NULL) {
- if (!(ZEND_CONSTANT_FLAGS(c) & CONST_CT_SUBST) || (ZEND_CONSTANT_FLAGS(c) & CONST_CS)) {
- retval = 0;
- }
- } else {
- retval = 0;
- }
- free_alloca(lookup_name, use_heap);
- }
-
- if (retval) {
+ zend_constant *c = zend_hash_find_ptr(EG(zend_constants), name);
+ if (c) {
if ((ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT)
+ && !(ZEND_CONSTANT_FLAGS(c) & CONST_DEPRECATED)
&& (!(ZEND_CONSTANT_FLAGS(c) & CONST_NO_FILE_CACHE)
|| !(CG(compiler_options) & ZEND_COMPILE_WITH_FILE_CACHE))) {
ZVAL_COPY_VALUE(result, &c->value);
if (copy) {
Z_TRY_ADDREF_P(result);
}
+ return 1;
} else {
- retval = 0;
+ return 0;
}
}
- return retval;
+ /* Special constants null/true/false can always be substituted. */
+ c = zend_get_special_const(ZSTR_VAL(name), ZSTR_LEN(name));
+ if (c) {
+ ZVAL_COPY_VALUE(result, &c->value);
+ return 1;
+ }
+ return 0;
}
-/* CFG back references management */
-
-#define DEL_SOURCE(from, to)
-#define ADD_SOURCE(from, to)
-
/* Data dependencies macros */
-#define VAR_NUM_EX(op) VAR_NUM((op).var)
-
#define VAR_SOURCE(op) Tsource[VAR_NUM(op.var)]
#define SET_VAR_SOURCE(opline) Tsource[VAR_NUM(opline->result.var)] = opline
@@ -86,15 +68,6 @@ static void strip_leading_nops(zend_op_array *op_array, zend_basic_block *b)
zend_op *opcodes = op_array->opcodes;
do {
- /* check if NOP breaks incorrect smart branch */
- if (b->len == 2
- && (opcodes[b->start + 1].opcode == ZEND_JMPZ
- || opcodes[b->start + 1].opcode == ZEND_JMPNZ)
- && (opcodes[b->start + 1].op1_type & (IS_CV|IS_CONST))
- && b->start > 0
- && zend_is_smart_branch(opcodes + b->start - 1)) {
- break;
- }
b->start++;
b->len--;
} while (b->len > 0 && opcodes[b->start].opcode == ZEND_NOP);
@@ -125,14 +98,6 @@ static void strip_nops(zend_op_array *op_array, zend_basic_block *b)
}
j++;
}
- if (i + 1 < b->start + b->len
- && (op_array->opcodes[i+1].opcode == ZEND_JMPZ
- || op_array->opcodes[i+1].opcode == ZEND_JMPNZ)
- && op_array->opcodes[i+1].op1_type & (IS_CV|IS_CONST)
- && zend_is_smart_branch(op_array->opcodes + j - 1)) {
- /* don't remove NOP, that splits incorrect smart branch */
- j++;
- }
i++;
}
b->len = j - b->start;
@@ -203,52 +168,6 @@ static void zend_optimize_block(zend_basic_block *block, zend_op_array *op_array
literal_dtor(&ZEND_OP1_LITERAL(src));
MAKE_NOP(src);
++(*opt_count);
- switch (opline->opcode) {
- case ZEND_JMPZ:
- if (zend_is_true(&ZEND_OP1_LITERAL(opline))) {
- MAKE_NOP(opline);
- DEL_SOURCE(block, block->successors[0]);
- block->successors_count = 1;
- block->successors[0] = block->successors[1];
- } else {
- opline->opcode = ZEND_JMP;
- COPY_NODE(opline->op1, opline->op2);
- DEL_SOURCE(block, block->successors[1]);
- block->successors_count = 1;
- }
- break;
- case ZEND_JMPNZ:
- if (zend_is_true(&ZEND_OP1_LITERAL(opline))) {
- opline->opcode = ZEND_JMP;
- COPY_NODE(opline->op1, opline->op2);
- DEL_SOURCE(block, block->successors[1]);
- block->successors_count = 1;
- } else {
- MAKE_NOP(opline);
- DEL_SOURCE(block, block->successors[0]);
- block->successors_count = 1;
- block->successors[0] = block->successors[1];
- }
- break;
- case ZEND_JMPZNZ:
- if (zend_is_true(&ZEND_OP1_LITERAL(opline))) {
- zend_op *target_opline = ZEND_OFFSET_TO_OPLINE(opline, opline->extended_value);
- ZEND_SET_OP_JMP_ADDR(opline, opline->op1, target_opline);
- DEL_SOURCE(block, block->successors[0]);
- block->successors[0] = block->successors[1];
- } else {
- zend_op *target_opline = ZEND_OP2_JMP_ADDR(opline);
- ZEND_SET_OP_JMP_ADDR(opline, opline->op1, target_opline);
- DEL_SOURCE(block, block->successors[0]);
- }
- block->successors_count = 1;
- opline->op1_type = IS_UNUSED;
- opline->extended_value = 0;
- opline->opcode = ZEND_JMP;
- break;
- default:
- break;
- }
} else {
zval_ptr_dtor_nogc(&c);
}
@@ -278,75 +197,91 @@ static void zend_optimize_block(zend_basic_block *block, zend_op_array *op_array
}
}
- if (opline->opcode == ZEND_ECHO) {
- if (opline->op1_type & (IS_TMP_VAR|IS_VAR)) {
- src = VAR_SOURCE(opline->op1);
- if (src &&
- src->opcode == ZEND_CAST &&
- src->extended_value == IS_STRING) {
- /* T = CAST(X, String), ECHO(T) => NOP, ECHO(X) */
- VAR_SOURCE(opline->op1) = NULL;
- COPY_NODE(opline->op1, src->op1);
- MAKE_NOP(src);
- ++(*opt_count);
- }
- }
-
- if (opline->op1_type == IS_CONST) {
- if (last_op && last_op->opcode == ZEND_ECHO &&
- last_op->op1_type == IS_CONST &&
- Z_TYPE(ZEND_OP1_LITERAL(opline)) != IS_DOUBLE &&
- Z_TYPE(ZEND_OP1_LITERAL(last_op)) != IS_DOUBLE) {
- /* compress consecutive ECHO's.
- * Float to string conversion may be affected by current
- * locale setting.
- */
- int l, old_len;
-
- if (Z_TYPE(ZEND_OP1_LITERAL(opline)) != IS_STRING) {
- convert_to_string(&ZEND_OP1_LITERAL(opline));
- }
- if (Z_TYPE(ZEND_OP1_LITERAL(last_op)) != IS_STRING) {
- convert_to_string(&ZEND_OP1_LITERAL(last_op));
+ switch (opline->opcode) {
+ case ZEND_ECHO:
+ if (opline->op1_type & (IS_TMP_VAR|IS_VAR)) {
+ src = VAR_SOURCE(opline->op1);
+ if (src &&
+ src->opcode == ZEND_CAST &&
+ src->extended_value == IS_STRING) {
+ /* T = CAST(X, String), ECHO(T) => NOP, ECHO(X) */
+ VAR_SOURCE(opline->op1) = NULL;
+ COPY_NODE(opline->op1, src->op1);
+ MAKE_NOP(src);
+ ++(*opt_count);
}
- old_len = Z_STRLEN(ZEND_OP1_LITERAL(last_op));
- l = old_len + Z_STRLEN(ZEND_OP1_LITERAL(opline));
- if (!Z_REFCOUNTED(ZEND_OP1_LITERAL(last_op))) {
- zend_string *tmp = zend_string_alloc(l, 0);
- memcpy(ZSTR_VAL(tmp), Z_STRVAL(ZEND_OP1_LITERAL(last_op)), old_len);
- Z_STR(ZEND_OP1_LITERAL(last_op)) = tmp;
- } else {
- Z_STR(ZEND_OP1_LITERAL(last_op)) = zend_string_extend(Z_STR(ZEND_OP1_LITERAL(last_op)), l, 0);
+ } else if (opline->op1_type == IS_CONST &&
+ Z_TYPE(ZEND_OP1_LITERAL(opline)) != IS_DOUBLE) {
+ if (last_op == opline - 1) {
+ /* compress consecutive ECHO's.
+ * Float to string conversion may be affected by current
+ * locale setting.
+ */
+ int l, old_len;
+
+ if (Z_TYPE(ZEND_OP1_LITERAL(opline)) != IS_STRING) {
+ convert_to_string(&ZEND_OP1_LITERAL(opline));
+ }
+ if (Z_TYPE(ZEND_OP1_LITERAL(last_op)) != IS_STRING) {
+ convert_to_string(&ZEND_OP1_LITERAL(last_op));
+ }
+ old_len = Z_STRLEN(ZEND_OP1_LITERAL(last_op));
+ l = old_len + Z_STRLEN(ZEND_OP1_LITERAL(opline));
+ if (!Z_REFCOUNTED(ZEND_OP1_LITERAL(last_op))) {
+ zend_string *tmp = zend_string_alloc(l, 0);
+ memcpy(ZSTR_VAL(tmp), Z_STRVAL(ZEND_OP1_LITERAL(last_op)), old_len);
+ Z_STR(ZEND_OP1_LITERAL(last_op)) = tmp;
+ } else {
+ Z_STR(ZEND_OP1_LITERAL(last_op)) = zend_string_extend(Z_STR(ZEND_OP1_LITERAL(last_op)), l, 0);
+ }
+ Z_TYPE_INFO(ZEND_OP1_LITERAL(last_op)) = IS_STRING_EX;
+ memcpy(Z_STRVAL(ZEND_OP1_LITERAL(last_op)) + old_len, Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline)));
+ Z_STRVAL(ZEND_OP1_LITERAL(last_op))[l] = '\0';
+ zval_ptr_dtor_nogc(&ZEND_OP1_LITERAL(opline));
+ ZVAL_STR(&ZEND_OP1_LITERAL(opline), zend_new_interned_string(Z_STR(ZEND_OP1_LITERAL(last_op))));
+ ZVAL_NULL(&ZEND_OP1_LITERAL(last_op));
+ MAKE_NOP(last_op);
+ ++(*opt_count);
}
- Z_TYPE_INFO(ZEND_OP1_LITERAL(last_op)) = IS_STRING_EX;
- memcpy(Z_STRVAL(ZEND_OP1_LITERAL(last_op)) + old_len, Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline)));
- Z_STRVAL(ZEND_OP1_LITERAL(last_op))[l] = '\0';
- zval_ptr_dtor_nogc(&ZEND_OP1_LITERAL(opline));
- ZVAL_STR(&ZEND_OP1_LITERAL(opline), zend_new_interned_string(Z_STR(ZEND_OP1_LITERAL(last_op))));
- ZVAL_NULL(&ZEND_OP1_LITERAL(last_op));
- MAKE_NOP(last_op);
- ++(*opt_count);
+ last_op = opline;
}
- last_op = opline;
- } else {
- last_op = NULL;
- }
- } else {
- last_op = NULL;
- }
-
- switch (opline->opcode) {
+ break;
case ZEND_FREE:
if (opline->op1_type == IS_TMP_VAR) {
src = VAR_SOURCE(opline->op1);
- if (src &&
- (src->opcode == ZEND_BOOL || src->opcode == ZEND_BOOL_NOT)) {
- /* T = BOOL(X), FREE(T) => T = BOOL(X) */
- /* The remaining BOOL is removed by a separate optimization */
- VAR_SOURCE(opline->op1) = NULL;
- MAKE_NOP(opline);
- ++(*opt_count);
+ if (src) {
+ switch (src->opcode) {
+ case ZEND_BOOL:
+ case ZEND_BOOL_NOT:
+ /* T = BOOL(X), FREE(T) => T = BOOL(X) */
+ /* The remaining BOOL is removed by a separate optimization */
+ VAR_SOURCE(opline->op1) = NULL;
+ MAKE_NOP(opline);
+ ++(*opt_count);
+ break;
+ case ZEND_ASSIGN:
+ case ZEND_ASSIGN_DIM:
+ case ZEND_ASSIGN_OBJ:
+ case ZEND_ASSIGN_STATIC_PROP:
+ case ZEND_ASSIGN_OP:
+ case ZEND_ASSIGN_DIM_OP:
+ case ZEND_ASSIGN_OBJ_OP:
+ case ZEND_ASSIGN_STATIC_PROP_OP:
+ case ZEND_PRE_INC:
+ case ZEND_PRE_DEC:
+ case ZEND_PRE_INC_OBJ:
+ case ZEND_PRE_DEC_OBJ:
+ case ZEND_PRE_INC_STATIC_PROP:
+ case ZEND_PRE_DEC_STATIC_PROP:
+ src->result_type = IS_UNUSED;
+ VAR_SOURCE(opline->op1) = NULL;
+ MAKE_NOP(opline);
+ ++(*opt_count);
+ break;
+ default:
+ break;
+ }
}
} else if (opline->op1_type == IS_VAR) {
src = VAR_SOURCE(opline->op1);
@@ -360,6 +295,13 @@ static void zend_optimize_block(zend_basic_block *block, zend_op_array *op_array
src->result_type = IS_UNUSED;
MAKE_NOP(opline);
++(*opt_count);
+ if (src->opcode == ZEND_QM_ASSIGN) {
+ if (src->op1_type & (IS_VAR|IS_TMP_VAR)) {
+ src->opcode = ZEND_FREE;
+ } else {
+ MAKE_NOP(src);
+ }
+ }
}
}
break;
@@ -592,6 +534,7 @@ static void zend_optimize_block(zend_basic_block *block, zend_op_array *op_array
MAKE_NOP(opline);
++(*opt_count);
break;
+ case ZEND_ISSET_ISEMPTY_CV:
case ZEND_ISSET_ISEMPTY_VAR:
case ZEND_ISSET_ISEMPTY_DIM_OBJ:
case ZEND_ISSET_ISEMPTY_PROP_OBJ:
@@ -600,6 +543,7 @@ static void zend_optimize_block(zend_basic_block *block, zend_op_array *op_array
case ZEND_TYPE_CHECK:
case ZEND_DEFINED:
case ZEND_IN_ARRAY:
+ case ZEND_ARRAY_KEY_EXISTS:
if (opline->opcode == ZEND_BOOL_NOT) {
break;
}
@@ -615,56 +559,135 @@ static void zend_optimize_block(zend_basic_block *block, zend_op_array *op_array
case ZEND_JMPZ:
case ZEND_JMPNZ:
- case ZEND_JMPZ_EX:
- case ZEND_JMPNZ_EX:
- case ZEND_JMPZNZ:
- optimize_jmpznz:
- if (opline->op1_type == IS_TMP_VAR &&
- (!zend_bitset_in(used_ext, VAR_NUM(opline->op1.var)) ||
- (opline->result_type == opline->op1_type &&
- opline->result.var == opline->op1.var))) {
- src = VAR_SOURCE(opline->op1);
- if (src) {
- if (src->opcode == ZEND_BOOL_NOT &&
- opline->opcode != ZEND_JMPZ_EX &&
- opline->opcode != ZEND_JMPNZ_EX) {
- VAR_SOURCE(opline->op1) = NULL;
- COPY_NODE(opline->op1, src->op1);
- if (opline->opcode == ZEND_JMPZ) {
+ while (1) {
+ if (opline->op1_type == IS_CONST) {
+ ++(*opt_count);
+ block->successors_count = 1;
+ if (zend_is_true(&ZEND_OP1_LITERAL(opline)) ==
+ (opline->opcode == ZEND_JMPZ)) {
+
+ MAKE_NOP(opline);
+ block->successors[0] = block->successors[1];
+ block->len--;
+ cfg->blocks[block->successors[0]].flags |= ZEND_BB_FOLLOW;
+ break;
+ } else {
+ zend_basic_block *next = cfg->blocks + block->successors[1];
+
+ next->flags &= ~ZEND_BB_FOLLOW;
+ if (!(next->flags & (ZEND_BB_TARGET|ZEND_BB_PROTECTED))) {
+ next->flags &= ~ZEND_BB_REACHABLE;
+ }
+ opline->opcode = ZEND_JMP;
+ COPY_NODE(opline->op1, opline->op2);
+ break;
+ }
+ } else if (opline->op1_type == IS_TMP_VAR &&
+ !zend_bitset_in(used_ext, VAR_NUM(opline->op1.var))) {
+ src = VAR_SOURCE(opline->op1);
+ if (src) {
+ if (src->opcode == ZEND_BOOL_NOT) {
+ VAR_SOURCE(opline->op1) = NULL;
+ COPY_NODE(opline->op1, src->op1);
/* T = BOOL_NOT(X) + JMPZ(T) -> NOP, JMPNZ(X) */
- opline->opcode = ZEND_JMPNZ;
- } else if (opline->opcode == ZEND_JMPNZ) {
- /* T = BOOL_NOT(X) + JMPNZ(T) -> NOP, JMPZ(X) */
- opline->opcode = ZEND_JMPZ;
-#if 0
- } else if (opline->opcode == ZEND_JMPZ_EX) {
- /* T = BOOL_NOT(X) + JMPZ_EX(T) -> NOP, JMPNZ_EX(X) */
- opline->opcode = ZEND_JMPNZ_EX;
- } else if (opline->opcode == ZEND_JMPNZ_EX) {
- /* T = BOOL_NOT(X) + JMPNZ_EX(T) -> NOP, JMPZ_EX(X) */
- opline->opcode = ZEND_JMPZ;
-#endif
- } else {
+ opline->opcode = INV_COND(opline->opcode);
+ MAKE_NOP(src);
+ ++(*opt_count);
+ continue;
+ } else if (src->opcode == ZEND_BOOL ||
+ src->opcode == ZEND_QM_ASSIGN) {
+ VAR_SOURCE(opline->op1) = NULL;
+ COPY_NODE(opline->op1, src->op1);
+ MAKE_NOP(src);
+ ++(*opt_count);
+ continue;
+ }
+ }
+ }
+ break;
+ }
+ break;
+
+ case ZEND_JMPZNZ:
+ while (1) {
+ if (opline->op1_type == IS_CONST) {
+ ++(*opt_count);
+ if (zend_is_true(&ZEND_OP1_LITERAL(opline))) {
+ zend_op *target_opline = ZEND_OFFSET_TO_OPLINE(opline, opline->extended_value);
+ ZEND_SET_OP_JMP_ADDR(opline, opline->op1, target_opline);
+ block->successors[0] = block->successors[1];
+ } else {
+ zend_op *target_opline = ZEND_OP2_JMP_ADDR(opline);
+ ZEND_SET_OP_JMP_ADDR(opline, opline->op1, target_opline);
+ }
+ block->successors_count = 1;
+ opline->op1_type = IS_UNUSED;
+ opline->extended_value = 0;
+ opline->opcode = ZEND_JMP;
+ break;
+ } else if (opline->op1_type == IS_TMP_VAR &&
+ !zend_bitset_in(used_ext, VAR_NUM(opline->op1.var))) {
+ src = VAR_SOURCE(opline->op1);
+ if (src) {
+ if (src->opcode == ZEND_BOOL_NOT) {
/* T = BOOL_NOT(X) + JMPZNZ(T,L1,L2) -> NOP, JMPZNZ(X,L2,L1) */
uint32_t tmp;
- ZEND_ASSERT(opline->opcode == ZEND_JMPZNZ);
+ VAR_SOURCE(opline->op1) = NULL;
+ COPY_NODE(opline->op1, src->op1);
tmp = block->successors[0];
block->successors[0] = block->successors[1];
block->successors[1] = tmp;
+ MAKE_NOP(src);
+ ++(*opt_count);
+ continue;
+ } else if (src->opcode == ZEND_BOOL ||
+ src->opcode == ZEND_QM_ASSIGN) {
+ VAR_SOURCE(opline->op1) = NULL;
+ COPY_NODE(opline->op1, src->op1);
+ MAKE_NOP(src);
+ ++(*opt_count);
+ continue;
}
- MAKE_NOP(src);
- ++(*opt_count);
- goto optimize_jmpznz;
- } else if (src->opcode == ZEND_BOOL ||
- src->opcode == ZEND_QM_ASSIGN) {
- VAR_SOURCE(opline->op1) = NULL;
- COPY_NODE(opline->op1, src->op1);
- MAKE_NOP(src);
+ }
+ }
+ break;
+ }
+ break;
+
+ case ZEND_JMPZ_EX:
+ case ZEND_JMPNZ_EX:
+ while (1) {
+ if (opline->op1_type == IS_CONST) {
+ if (zend_is_true(&ZEND_OP1_LITERAL(opline)) ==
+ (opline->opcode == ZEND_JMPZ_EX)) {
+
++(*opt_count);
- goto optimize_jmpznz;
+ opline->opcode = ZEND_QM_ASSIGN;
+ zval_ptr_dtor_nogc(&ZEND_OP1_LITERAL(opline));
+ ZVAL_BOOL(&ZEND_OP1_LITERAL(opline), opline->opcode == ZEND_JMPZ_EX);
+ opline->op2.num = 0;
+ block->successors_count = 1;
+ block->successors[0] = block->successors[1];
+ cfg->blocks[block->successors[0]].flags |= ZEND_BB_FOLLOW;
+ break;
+ }
+ } else if (opline->op1_type == IS_TMP_VAR &&
+ (!zend_bitset_in(used_ext, VAR_NUM(opline->op1.var)) ||
+ opline->result.var == opline->op1.var)) {
+ src = VAR_SOURCE(opline->op1);
+ if (src) {
+ if (src->opcode == ZEND_BOOL ||
+ src->opcode == ZEND_QM_ASSIGN) {
+ VAR_SOURCE(opline->op1) = NULL;
+ COPY_NODE(opline->op1, src->op1);
+ MAKE_NOP(src);
+ ++(*opt_count);
+ continue;
+ }
}
}
+ break;
}
break;
@@ -894,6 +917,23 @@ optimize_const_unary_op:
/* strip T = QM_ASSIGN(T) */
MAKE_NOP(opline);
++(*opt_count);
+ } else if (opline->op1_type == IS_TMP_VAR &&
+ opline->result_type == IS_TMP_VAR &&
+ !zend_bitset_in(used_ext, VAR_NUM(opline->op1.var))) {
+ /* T1 = ..., T2 = QM_ASSIGN(T1) to T2 = ..., NOP */
+ src = VAR_SOURCE(opline->op1);
+ if (src &&
+ src->opcode != ZEND_COPY_TMP &&
+ src->opcode != ZEND_ADD_ARRAY_ELEMENT &&
+ src->opcode != ZEND_ADD_ARRAY_UNPACK &&
+ (src->opcode != ZEND_DECLARE_LAMBDA_FUNCTION ||
+ src == opline -1)) {
+ src->result.var = opline->result.var;
+ VAR_SOURCE(opline->op1) = NULL;
+ VAR_SOURCE(opline->result) = src;
+ MAKE_NOP(opline);
+ ++(*opt_count);
+ }
}
break;
}
@@ -1089,11 +1129,84 @@ static void assemble_code_blocks(zend_cfg *cfg, zend_op_array *op_array, zend_op
}
}
-static void zend_jmp_optimization(zend_basic_block *block, zend_op_array *op_array, zend_cfg *cfg, zend_uchar *same_t, uint32_t *opt_count)
+static zend_always_inline zend_basic_block *get_target_block(const zend_cfg *cfg, zend_basic_block *block, int n, uint32_t *opt_count)
+{
+ int b;
+ zend_basic_block *target_block = cfg->blocks + block->successors[n];
+
+ if (target_block->len == 0 && !(target_block->flags & ZEND_BB_PROTECTED)) {
+ do {
+ b = target_block->successors[0];
+ target_block = cfg->blocks + b;
+ } while (target_block->len == 0 && !(target_block->flags & ZEND_BB_PROTECTED));
+ block->successors[n] = b;
+ ++(*opt_count);
+ }
+ return target_block;
+}
+
+static zend_always_inline zend_basic_block *get_follow_block(const zend_cfg *cfg, zend_basic_block *block, int n, uint32_t *opt_count)
+{
+ int b;
+ zend_basic_block *target_block = cfg->blocks + block->successors[n];
+
+ if (target_block->len == 0 && !(target_block->flags & ZEND_BB_PROTECTED)) {
+ do {
+ b = target_block->successors[0];
+ target_block = cfg->blocks + b;
+ } while (target_block->len == 0 && !(target_block->flags & ZEND_BB_PROTECTED));
+ block->successors[n] = b;
+ ++(*opt_count);
+ }
+ return target_block;
+}
+
+static zend_always_inline zend_basic_block *get_next_block(const zend_cfg *cfg, zend_basic_block *block)
+{
+ zend_basic_block *next_block = block + 1;
+ zend_basic_block *end = cfg->blocks + cfg->blocks_count;
+
+ while (1) {
+ if (next_block == end) {
+ return NULL;
+ } else if (next_block->flags & ZEND_BB_REACHABLE) {
+ break;
+ }
+ next_block++;
+ }
+ while (next_block->len == 0 && !(next_block->flags & ZEND_BB_PROTECTED)) {
+ next_block = cfg->blocks + next_block->successors[0];
+ }
+ return next_block;
+}
+
+
+/* we use "jmp_hitlist" to avoid infinity loops during jmp optimization */
+static zend_always_inline int in_hitlist(int target, int *jmp_hitlist, int jmp_hitlist_count)
+{
+ int i;
+
+ for (i = 0; i < jmp_hitlist_count; i++) {
+ if (jmp_hitlist[i] == target) {
+ return 1;
+ }
+ }
+ return 0;
+}
+
+#define CHECK_LOOP(target) \
+ if (EXPECTED(!in_hitlist(target, jmp_hitlist, jmp_hitlist_count))) { \
+ jmp_hitlist[jmp_hitlist_count++] = target; \
+ } else { \
+ break; \
+ }
+
+static void zend_jmp_optimization(zend_basic_block *block, zend_op_array *op_array, const zend_cfg *cfg, int *jmp_hitlist, uint32_t *opt_count)
{
/* last_op is the last opcode of the current block */
- zend_basic_block *blocks = cfg->blocks;
- zend_op *last_op;
+ zend_basic_block *target_block, *follow_block, *next_block;
+ zend_op *last_op, *target;
+ int next, jmp_hitlist_count;
if (block->len == 0) {
return;
@@ -1102,35 +1215,32 @@ static void zend_jmp_optimization(zend_basic_block *block, zend_op_array *op_arr
last_op = op_array->opcodes + block->start + block->len - 1;
switch (last_op->opcode) {
case ZEND_JMP:
- {
- zend_basic_block *target_block = blocks + block->successors[0];
- zend_op *target = op_array->opcodes + target_block->start;
- int next = (block - blocks) + 1;
-
- while (next < cfg->blocks_count && !(blocks[next].flags & ZEND_BB_REACHABLE)) {
- /* find used one */
- next++;
- }
+ jmp_hitlist_count = 0;
- /* JMP(next) -> NOP */
- if (block->successors[0] == next) {
- MAKE_NOP(last_op);
- ++(*opt_count);
- block->len--;
+ target_block = get_target_block(cfg, block, 0, opt_count);
+ while (target_block->len == 1) {
+ target = op_array->opcodes + target_block->start;
+ if (target->opcode == ZEND_JMP) {
+ /* JMP L, L: JMP L1 -> JMP L1 */
+ next = target_block->successors[0];
+ } else {
break;
}
+ CHECK_LOOP(next);
+ block->successors[0] = next;
+ ++(*opt_count);
+ target_block = get_target_block(cfg, block, 0, opt_count);
+ }
- if (target->opcode == ZEND_JMP &&
- block->successors[0] != target_block->successors[0] &&
- !(target_block->flags & ZEND_BB_PROTECTED)) {
- /* JMP L, L: JMP L1 -> JMP L1 */
- *last_op = *target;
- DEL_SOURCE(block, block->successors[0]);
- block->successors[0] = target_block->successors[0];
- ADD_SOURCE(block, block->successors[0]);
- ++(*opt_count);
- } else if (target->opcode == ZEND_JMPZNZ &&
- !(target_block->flags & ZEND_BB_PROTECTED)) {
+ next_block = get_next_block(cfg, block);
+ if (target_block == next_block) {
+ /* JMP(next) -> NOP */
+ MAKE_NOP(last_op);
+ ++(*opt_count);
+ block->len--;
+ } else if (target_block->len == 1) {
+ target = op_array->opcodes + target_block->start;
+ if (target->opcode == ZEND_JMPZNZ) {
/* JMP L, L: JMPZNZ L1,L2 -> JMPZNZ L1,L2 */
*last_op = *target;
if (last_op->op1_type == IS_CONST) {
@@ -1138,15 +1248,14 @@ static void zend_jmp_optimization(zend_basic_block *block, zend_op_array *op_arr
ZVAL_COPY(&zv, &ZEND_OP1_LITERAL(last_op));
last_op->op1.constant = zend_optimizer_add_literal(op_array, &zv);
}
- DEL_SOURCE(block, block->successors[0]);
block->successors_count = 2;
block->successors[0] = target_block->successors[0];
block->successors[1] = target_block->successors[1];
- ADD_SOURCE(block, block->successors[0]);
- ADD_SOURCE(block, block->successors[1]);
++(*opt_count);
+ goto optimize_jmpznz;
} else if ((target->opcode == ZEND_RETURN ||
target->opcode == ZEND_RETURN_BY_REF ||
+ target->opcode == ZEND_GENERATOR_RETURN ||
target->opcode == ZEND_EXIT) &&
!(op_array->fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK)) {
/* JMP L, L: RETURN to immediate RETURN */
@@ -1156,96 +1265,68 @@ static void zend_jmp_optimization(zend_basic_block *block, zend_op_array *op_arr
ZVAL_COPY(&zv, &ZEND_OP1_LITERAL(last_op));
last_op->op1.constant = zend_optimizer_add_literal(op_array, &zv);
}
- DEL_SOURCE(block, block->successors[0]);
block->successors_count = 0;
++(*opt_count);
-#if 0
- /* Temporarily disabled - see bug #0025274 */
- } else if (0&& block->op1_to != block &&
- block->op1_to != blocks &&
- op_array->last_try_catch == 0 &&
- target->opcode != ZEND_FREE) {
- /* Block Reordering (saves one JMP on each "for" loop iteration)
- * It is disabled for some cases (ZEND_FREE)
- * which may break register allocation.
- */
- zend_bool can_reorder = 0;
- zend_block_source *cs = block->op1_to->sources;
-
- /* the "target" block doesn't had any followed block */
- while(cs) {
- if (cs->from->follow_to == block->op1_to) {
- can_reorder = 0;
- break;
- }
- cs = cs->next;
- }
- if (can_reorder) {
- next = block->op1_to;
- /* the "target" block is not followed by current "block" */
- while (next->follow_to != NULL) {
- if (next->follow_to == block) {
- can_reorder = 0;
- break;
- }
- next = next->follow_to;
- }
- if (can_reorder) {
- zend_basic_block *prev = blocks;
+ }
+ }
+ break;
- while (prev->next != block->op1_to) {
- prev = prev->next;
- }
- prev->next = next->next;
- next->next = block->next;
- block->next = block->op1_to;
+ case ZEND_JMP_SET:
+ case ZEND_COALESCE:
+ jmp_hitlist_count = 0;
- block->follow_to = block->op1_to;
- block->op1_to = NULL;
- MAKE_NOP(last_op);
- block->len--;
- if(block->len == 0) {
- /* this block is nothing but NOP now */
- delete_code_block(block, ctx);
- }
- break;
- }
- }
-#endif
+ target_block = get_target_block(cfg, block, 0, opt_count);
+ while (target_block->len == 1) {
+ target = op_array->opcodes + target_block->start;
+
+ if (target->opcode == ZEND_JMP) {
+ /* JMP_SET(X, L), L: JMP(L2) -> JMP_SET(X, L2) */
+ next = target_block->successors[0];
+ CHECK_LOOP(next);
+ block->successors[0] = next;
+ ++(*opt_count);
+ } else {
+ break;
}
+ target_block = get_target_block(cfg, block, 0, opt_count);
}
break;
case ZEND_JMPZ:
case ZEND_JMPNZ:
- /* constant conditional JMPs */
- if (last_op->op1_type == IS_CONST) {
- int should_jmp = zend_is_true(&ZEND_OP1_LITERAL(last_op));
+ jmp_hitlist_count = 0;
- if (last_op->opcode == ZEND_JMPZ) {
- should_jmp = !should_jmp;
- }
- literal_dtor(&ZEND_OP1_LITERAL(last_op));
- last_op->op1_type = IS_UNUSED;
- if (should_jmp) {
- /* JMPNZ(true) -> JMP */
- last_op->opcode = ZEND_JMP;
- DEL_SOURCE(block, block->successors[1]);
- block->successors_count = 1;
+ target_block = get_target_block(cfg, block, 0, opt_count);
+ while (target_block->len == 1) {
+ target = op_array->opcodes + target_block->start;
+
+ if (target->opcode == ZEND_JMP) {
+ /* JMPZ(X, L), L: JMP(L2) -> JMPZ(X, L2) */
+ next = target_block->successors[0];
+ } else if (target->opcode == last_op->opcode &&
+ SAME_VAR(target->op1, last_op->op1)) {
+ /* JMPZ(X, L), L: JMPZ(X, L2) -> JMPZ(X, L2) */
+ next = target_block->successors[0];
+ } else if (target->opcode == INV_COND(last_op->opcode) &&
+ SAME_VAR(target->op1, last_op->op1)) {
+ /* JMPZ(X, L), L: JMPNZ(X, L2) -> JMPZ(X, L+1) */
+ next = target_block->successors[1];
+ } else if (target->opcode == ZEND_JMPZNZ &&
+ SAME_VAR(target->op1, last_op->op1)) {
+ /* JMPZ(X, L), L: JMPZNZ(X, L2, L3) -> JMPZ(X, L2) */
+ next = target_block->successors[last_op->opcode == ZEND_JMPNZ];
} else {
- /* JMPNZ(false) -> NOP */
- MAKE_NOP(last_op);
- DEL_SOURCE(block, block->successors[0]);
- block->successors_count = 1;
- block->successors[0] = block->successors[1];
+ break;
}
+ CHECK_LOOP(next);
+ block->successors[0] = next;
++(*opt_count);
- break;
+ target_block = get_target_block(cfg, block, 0, opt_count);
}
- if (block->successors[0] == block->successors[1]) {
+ follow_block = get_follow_block(cfg, block, 1, opt_count);
+ if (target_block == follow_block) {
/* L: JMP[N]Z(X, L+1) -> NOP or FREE(X) */
-
if (last_op->op1_type == IS_CV) {
last_op->opcode = ZEND_CHECK_VAR;
last_op->op2.num = 0;
@@ -1254,122 +1335,55 @@ static void zend_jmp_optimization(zend_basic_block *block, zend_op_array *op_arr
last_op->op2.num = 0;
} else {
MAKE_NOP(last_op);
+ block->len--;
}
block->successors_count = 1;
++(*opt_count);
- break;
- }
+ } else if (follow_block->len == 1) {
+ target = op_array->opcodes + follow_block->start;
+ if (target->opcode == ZEND_JMP) {
+ if (block->successors[0] == follow_block->successors[0]) {
+ /* JMPZ(X,L1), JMP(L1) -> NOP, JMP(L1) */
+ if (last_op->op1_type == IS_CV) {
+ last_op->opcode = ZEND_CHECK_VAR;
+ last_op->op2.num = 0;
+ } else if (last_op->op1_type & (IS_VAR|IS_TMP_VAR)) {
+ last_op->opcode = ZEND_FREE;
+ last_op->op2.num = 0;
+ } else {
+ MAKE_NOP(last_op);
+ block->len--;
+ }
+ block->successors_count = 1;
+ ++(*opt_count);
+ break;
+ } else if (!(follow_block->flags & (ZEND_BB_TARGET | ZEND_BB_PROTECTED))) {
+ next_block = get_next_block(cfg, follow_block);
- if (1) {
- zend_uchar same_type = last_op->op1_type;
- uint32_t same_var = VAR_NUM_EX(last_op->op1);
- zend_op *target;
- zend_op *target_end;
- zend_basic_block *target_block = blocks + block->successors[0];
+ if (target_block == next_block) {
+ /* JMPZ(X,L1) JMP(L2) L1: -> JMPNZ(X,L2) NOP*/
-next_target:
- target = op_array->opcodes + target_block->start;
- target_end = target + target_block->len;
- while (target < target_end && target->opcode == ZEND_NOP) {
- target++;
- }
+ last_op->opcode = INV_COND(last_op->opcode);
- /* next block is only NOP's */
- if (target == target_end) {
- target_block = blocks + target_block->successors[0];
- ++(*opt_count);
- goto next_target;
- } else if (target->opcode == INV_COND(last_op->opcode) &&
- /* JMPZ(X, L), L: JMPNZ(X, L2) -> JMPZ(X, L+1) */
- (target->op1_type & (IS_TMP_VAR|IS_CV)) &&
- same_type == target->op1_type &&
- same_var == VAR_NUM_EX(target->op1) &&
- !(target_block->flags & ZEND_BB_PROTECTED)
- ) {
- DEL_SOURCE(block, block->successors[0]);
- block->successors[0] = target_block->successors[1];
- ADD_SOURCE(block, block->successors[0]);
- ++(*opt_count);
- } else if (target->opcode == INV_COND_EX(last_op->opcode) &&
- (target->op1_type & (IS_TMP_VAR|IS_CV)) &&
- same_type == target->op1_type &&
- same_var == VAR_NUM_EX(target->op1) &&
- !(target_block->flags & ZEND_BB_PROTECTED)) {
- /* JMPZ(X, L), L: T = JMPNZ_EX(X, L2) -> T = JMPZ_EX(X, L+1) */
- last_op->opcode += 3;
- COPY_NODE(last_op->result, target->result);
- DEL_SOURCE(block, block->successors[0]);
- block->successors[0] = target_block->successors[1];
- ADD_SOURCE(block, block->successors[0]);
- ++(*opt_count);
- } else if (target->opcode == last_op->opcode &&
- (target->op1_type & (IS_TMP_VAR|IS_CV)) &&
- same_type == target->op1_type &&
- same_var == VAR_NUM_EX(target->op1) &&
- !(target_block->flags & ZEND_BB_PROTECTED)) {
- /* JMPZ(X, L), L: JMPZ(X, L2) -> JMPZ(X, L2) */
- DEL_SOURCE(block, block->successors[0]);
- block->successors[0] = target_block->successors[0];
- ADD_SOURCE(block, block->successors[0]);
- ++(*opt_count);
- } else if (target->opcode == ZEND_JMP &&
- !(target_block->flags & ZEND_BB_PROTECTED)) {
- /* JMPZ(X, L), L: JMP(L2) -> JMPZ(X, L2) */
- DEL_SOURCE(block, block->successors[0]);
- block->successors[0] = target_block->successors[0];
- ADD_SOURCE(block, block->successors[0]);
- ++(*opt_count);
- } else if (target->opcode == ZEND_JMPZNZ &&
- (target->op1_type & (IS_TMP_VAR|IS_CV)) &&
- same_type == target->op1_type &&
- same_var == VAR_NUM_EX(target->op1) &&
- !(target_block->flags & ZEND_BB_PROTECTED)) {
- /* JMPZ(X, L), L: JMPZNZ(X, L2, L3) -> JMPZ(X, L2) */
- DEL_SOURCE(block, block->successors[0]);
- if (last_op->opcode == ZEND_JMPZ) {
- block->successors[0] = target_block->successors[0];
- } else {
- block->successors[0] = target_block->successors[1];
- }
- ADD_SOURCE(block, block->successors[0]);
- ++(*opt_count);
- }
- }
+ block->successors[0] = follow_block->successors[0];
+ block->successors[1] = next_block - cfg->blocks;
- if (last_op->opcode == ZEND_JMPZ || last_op->opcode == ZEND_JMPNZ) {
- zend_op *target;
- zend_op *target_end;
- zend_basic_block *target_block;
+ follow_block->flags &= ~ZEND_BB_REACHABLE;
+ MAKE_NOP(target);
+ follow_block->len = 0;
- while (1) {
- target_block = blocks + block->successors[1];
- target = op_array->opcodes + target_block->start;
- target_end = op_array->opcodes + target_block->start + 1;
- while (target < target_end && target->opcode == ZEND_NOP) {
- target++;
- }
+ next_block->flags |= ZEND_BB_FOLLOW;
- /* next block is only NOP's */
- if (target == target_end && !(target_block->flags & ZEND_BB_PROTECTED)) {
- DEL_SOURCE(block, block->successors[1]);
- block->successors[1] = target_block->successors[0];
- ADD_SOURCE(block, block->successors[1]);
- ++(*opt_count);
- } else {
- break;
+ break;
+ }
}
- }
- /* JMPZ(X,L1), JMP(L2) -> JMPZNZ(X,L1,L2) */
- if (target->opcode == ZEND_JMP &&
- !(target_block->flags & ZEND_BB_PROTECTED)) {
- DEL_SOURCE(block, block->successors[1]);
+
+ /* JMPZ(X,L1), JMP(L2) -> JMPZNZ(X,L1,L2) */
if (last_op->opcode == ZEND_JMPZ) {
- block->successors[1] = target_block->successors[0];
- ADD_SOURCE(block, block->successors[1]);
+ block->successors[1] = follow_block->successors[0];
} else {
block->successors[1] = block->successors[0];
- block->successors[0] = target_block->successors[0];
- ADD_SOURCE(block, block->successors[0]);
+ block->successors[0] = follow_block->successors[0];
}
last_op->opcode = ZEND_JMPZNZ;
++(*opt_count);
@@ -1379,212 +1393,153 @@ next_target:
case ZEND_JMPNZ_EX:
case ZEND_JMPZ_EX:
- /* constant conditional JMPs */
- if (last_op->op1_type == IS_CONST) {
- int should_jmp = zend_is_true(&ZEND_OP1_LITERAL(last_op));
-
- if (last_op->opcode == ZEND_JMPZ_EX) {
- should_jmp = !should_jmp;
- }
- if (!should_jmp) {
- /* T = JMPZ_EX(true,L) -> T = QM_ASSIGN(true)
- * T = JMPNZ_EX(false,L) -> T = QM_ASSIGN(false)
- */
- last_op->opcode = ZEND_QM_ASSIGN;
- SET_UNUSED(last_op->op2);
- DEL_SOURCE(block, block->successors[0]);
- block->successors_count = 1;
- block->successors[0] = block->successors[1];
- ++(*opt_count);
- }
- break;
- }
-
- if (1) {
- zend_op *target, *target_end;
- zend_basic_block *target_block;
- int var_num = op_array->last_var + op_array->T;
+ jmp_hitlist_count = 0;
- if (var_num <= 0) {
- return;
- }
- memset(same_t, 0, var_num);
- same_t[VAR_NUM_EX(last_op->op1)] |= last_op->op1_type;
- same_t[VAR_NUM_EX(last_op->result)] |= last_op->result_type;
- target_block = blocks + block->successors[0];
-next_target_ex:
+ target_block = get_target_block(cfg, block, 0, opt_count);
+ while (target_block->len == 1) {
target = op_array->opcodes + target_block->start;
- target_end = target + target_block->len;
- while (target < target_end && target->opcode == ZEND_NOP) {
- target++;
- }
- /* next block is only NOP's */
- if (target == target_end) {
- target_block = blocks + target_block->successors[0];
- ++(*opt_count);
- goto next_target_ex;
+
+ if (target->opcode == ZEND_JMP) {
+ /* T = JMPZ_EX(X, L), L: JMP(L2) -> T = JMPZ(X, L2) */
+ next = target_block->successors[0];
} else if (target->opcode == last_op->opcode-3 &&
- (target->op1_type & (IS_TMP_VAR|IS_CV)) &&
- (same_t[VAR_NUM_EX(target->op1)] & target->op1_type) != 0 &&
- !(target_block->flags & ZEND_BB_PROTECTED)) {
+ (SAME_VAR(target->op1, last_op->result) ||
+ SAME_VAR(target->op1, last_op->op1))) {
/* T = JMPZ_EX(X, L1), L1: JMPZ({X|T}, L2) -> T = JMPZ_EX(X, L2) */
- DEL_SOURCE(block, block->successors[0]);
- block->successors[0] = target_block->successors[0];
- ADD_SOURCE(block, block->successors[0]);
- ++(*opt_count);
- } else if (target->opcode == INV_EX_COND(last_op->opcode) &&
- (target->op1_type & (IS_TMP_VAR|IS_CV)) &&
- (same_t[VAR_NUM_EX(target->op1)] & target->op1_type) != 0 &&
- !(target_block->flags & ZEND_BB_PROTECTED)) {
- /* T = JMPZ_EX(X, L1), L1: JMPNZ({X|T1}, L2) -> T = JMPZ_EX(X, L1+1) */
- DEL_SOURCE(block, block->successors[0]);
- block->successors[0] = target_block->successors[1];
- ADD_SOURCE(block, block->successors[0]);
- ++(*opt_count);
- } else if (target->opcode == INV_EX_COND_EX(last_op->opcode) &&
- (target->op1_type & (IS_TMP_VAR|IS_CV)) &&
- (same_t[VAR_NUM_EX(target->op1)] & target->op1_type) != 0 &&
- (same_t[VAR_NUM_EX(target->result)] & target->result_type) != 0 &&
- !(target_block->flags & ZEND_BB_PROTECTED)) {
- /* T = JMPZ_EX(X, L1), L1: T = JMPNZ_EX(T, L2) -> T = JMPZ_EX(X, L1+1) */
- DEL_SOURCE(block, block->successors[0]);
- block->successors[0] = target_block->successors[1];
- ADD_SOURCE(block, block->successors[0]);
- ++(*opt_count);
+ next = target_block->successors[0];
} else if (target->opcode == last_op->opcode &&
- (target->op1_type & (IS_TMP_VAR|IS_CV)) &&
- (same_t[VAR_NUM_EX(target->op1)] & target->op1_type) != 0 &&
- (same_t[VAR_NUM_EX(target->result)] & target->result_type) != 0 &&
- !(target_block->flags & ZEND_BB_PROTECTED)) {
- /* T = JMPZ_EX(X, L1), L1: T = JMPZ({X|T}, L2) -> T = JMPZ_EX(X, L2) */
- DEL_SOURCE(block, block->successors[0]);
- block->successors[0] = target_block->successors[0];
- ADD_SOURCE(block, block->successors[0]);
- ++(*opt_count);
- } else if (target->opcode == ZEND_JMP &&
- !(target_block->flags & ZEND_BB_PROTECTED)) {
- /* T = JMPZ_EX(X, L), L: JMP(L2) -> T = JMPZ(X, L2) */
- DEL_SOURCE(block, block->successors[0]);
- block->successors[0] = target_block->successors[0];
- ADD_SOURCE(block, block->successors[0]);
- ++(*opt_count);
+ target->result.var == last_op->result.var &&
+ (SAME_VAR(target->op1, last_op->result) ||
+ SAME_VAR(target->op1, last_op->op1))) {
+ /* T = JMPZ_EX(X, L1), L1: T = JMPZ_EX({X|T}, L2) -> T = JMPZ_EX(X, L2) */
+ next = target_block->successors[0];
} else if (target->opcode == ZEND_JMPZNZ &&
- (target->op1_type & (IS_TMP_VAR|IS_CV)) &&
- (same_t[VAR_NUM_EX(target->op1)] & target->op1_type) != 0 &&
- !(target_block->flags & ZEND_BB_PROTECTED)) {
+ (SAME_VAR(target->op1, last_op->result) ||
+ SAME_VAR(target->op1, last_op->op1))) {
/* T = JMPZ_EX(X, L), L: JMPZNZ({X|T}, L2, L3) -> T = JMPZ_EX(X, L2) */
- DEL_SOURCE(block, block->successors[0]);
- if (last_op->opcode == ZEND_JMPZ_EX) {
- block->successors[0] = target_block->successors[0];
- } else {
- block->successors[0] = target_block->successors[1];
- }
- ADD_SOURCE(block, block->successors[0]);
- ++(*opt_count);
+ next = target_block->successors[last_op->opcode == ZEND_JMPNZ_EX];
+ } else if (target->opcode == INV_EX_COND(last_op->opcode) &&
+ (SAME_VAR(target->op1, last_op->result) ||
+ SAME_VAR(target->op1, last_op->op1))) {
+ /* T = JMPZ_EX(X, L1), L1: JMPNZ({X|T1}, L2) -> T = JMPZ_EX(X, L1+1) */
+ next = target_block->successors[1];
+ } else if (target->opcode == INV_EX_COND_EX(last_op->opcode) &&
+ target->result.var == last_op->result.var &&
+ (SAME_VAR(target->op1, last_op->result) ||
+ SAME_VAR(target->op1, last_op->op1))) {
+ /* T = JMPZ_EX(X, L1), L1: T = JMPNZ_EX({X|T}, L2) -> T = JMPZ_EX(X, L1+1) */
+ next = target_block->successors[1];
+ } else if (target->opcode == ZEND_BOOL &&
+ (SAME_VAR(target->op1, last_op->result) ||
+ SAME_VAR(target->op1, last_op->op1))) {
+ /* convert Y = JMPZ_EX(X,L1), L1: Z = BOOL(Y) to
+ Z = JMPZ_EX(X,L1+1) */
+
+ /* NOTE: This optimization pattern is not safe, but works, */
+ /* because result of JMPZ_EX instruction */
+ /* is not used on the following path and */
+ /* should be used once on the branch path. */
+ /* */
+ /* The pattern works well only if jums processed in */
+ /* direct order, otherwise it breaks JMPZ_EX */
+ /* sequences too early. */
+ last_op->result.var = target->result.var;
+ next = target_block->successors[0];
+ } else {
+ break;
}
+ CHECK_LOOP(next);
+ block->successors[0] = next;
+ ++(*opt_count);
+ target_block = get_target_block(cfg, block, 0, opt_count);
+ }
+
+ follow_block = get_follow_block(cfg, block, 1, opt_count);
+ if (target_block == follow_block) {
+ /* L: T = JMP[N]Z_EX(X, L+1) -> T = BOOL(X) */
+ last_op->opcode = ZEND_BOOL;
+ last_op->op2.num = 0;
+ block->successors_count = 1;
+ ++(*opt_count);
+ break;
}
break;
case ZEND_JMPZNZ: {
- int next = (block - blocks) + 1;
+optimize_jmpznz:
+ jmp_hitlist_count = 0;
+ target_block = get_target_block(cfg, block, 0, opt_count);
+ while (target_block->len == 1) {
+ target = op_array->opcodes + target_block->start;
- while (next < cfg->blocks_count && !(blocks[next].flags & ZEND_BB_REACHABLE)) {
- /* find first accessed one */
- next++;
+ if (target->opcode == ZEND_JMP) {
+ /* JMPZNZ(X, L1, L2), L1: JMP(L3) -> JMPZNZ(X, L3, L2) */
+ next = target_block->successors[0];
+ } else if ((target->opcode == ZEND_JMPZ || target->opcode == ZEND_JMPZNZ) &&
+ SAME_VAR(target->op1, last_op->op1)) {
+ /* JMPZNZ(X, L1, L2), L1: JMPZ(X, L3) -> JMPZNZ(X, L3, L2) */
+ next = target_block->successors[0];
+ } else if (target->opcode == ZEND_JMPNZ &&
+ SAME_VAR(target->op1, last_op->op1)) {
+ /* JMPZNZ(X, L1, L2), L1: X = JMPNZ(X, L3) -> JMPZNZ(X, L1+1, L2) */
+ next = target_block->successors[1];
+ } else {
+ break;
+ }
+ CHECK_LOOP(next);
+ block->successors[0] = next;
+ ++(*opt_count);
+ target_block = get_target_block(cfg, block, 0, opt_count);
}
- if (last_op->op1_type == IS_CONST) {
- if (!zend_is_true(&ZEND_OP1_LITERAL(last_op))) {
- /* JMPZNZ(false,L1,L2) -> JMP(L1) */
- literal_dtor(&ZEND_OP1_LITERAL(last_op));
- last_op->opcode = ZEND_JMP;
- SET_UNUSED(last_op->op1);
- SET_UNUSED(last_op->op2);
- DEL_SOURCE(block, block->successors[1]);
- block->successors_count = 1;
+ jmp_hitlist_count = 0;
+ follow_block = get_target_block(cfg, block, 1, opt_count);
+ while (follow_block->len == 1) {
+ target = op_array->opcodes + follow_block->start;
+
+ if (target->opcode == ZEND_JMP) {
+ /* JMPZNZ(X, L1, L2), L1: JMP(L3) -> JMPZNZ(X, L3, L2) */
+ next = follow_block->successors[0];
+ } else if (target->opcode == ZEND_JMPNZ &&
+ SAME_VAR(target->op1, last_op->op1)) {
+ /* JMPZNZ(X, L1, L2), L1: X = JMPNZ(X, L3) -> JMPZNZ(X, L1+1, L2) */
+ next = follow_block->successors[0];
+ } else if ((target->opcode == ZEND_JMPZ || target->opcode == ZEND_JMPZNZ) &&
+ SAME_VAR(target->op1, last_op->op1)) {
+ /* JMPZNZ(X, L1, L2), L1: JMPZ(X, L3) -> JMPZNZ(X, L3, L2) */
+ next = target_block->successors[1];
} else {
- /* JMPZNZ(true,L1,L2) -> JMP(L2) */
- literal_dtor(&ZEND_OP1_LITERAL(last_op));
- last_op->opcode = ZEND_JMP;
- SET_UNUSED(last_op->op1);
- SET_UNUSED(last_op->op2);
- DEL_SOURCE(block, block->successors[0]);
- block->successors_count = 1;
- block->successors[0] = block->successors[1];
+ break;
}
+ CHECK_LOOP(next);
+ block->successors[1] = next;
++(*opt_count);
- } else if (block->successors[0] == block->successors[1]) {
- /* both goto the same one - it's JMP */
- if (!(last_op->op1_type & (IS_VAR|IS_TMP_VAR))) {
- /* JMPZNZ(?,L,L) -> JMP(L) */
- last_op->opcode = ZEND_JMP;
- SET_UNUSED(last_op->op1);
- SET_UNUSED(last_op->op2);
- block->successors_count = 1;
- ++(*opt_count);
- }
- } else if (block->successors[0] == next) {
+ follow_block = get_target_block(cfg, block, 1, opt_count);
+ }
+
+ next_block = get_next_block(cfg, block);
+ if (target_block == follow_block &&
+ !(last_op->op1_type & (IS_VAR|IS_TMP_VAR))) {
+ /* JMPZNZ(?,L,L) -> JMP(L) */
+ last_op->opcode = ZEND_JMP;
+ SET_UNUSED(last_op->op1);
+ SET_UNUSED(last_op->op2);
+ last_op->extended_value = 0;
+ block->successors_count = 1;
+ ++(*opt_count);
+ } else if (target_block == next_block) {
/* jumping to next on Z - can follow to it and jump only on NZ */
/* JMPZNZ(X,L1,L2) L1: -> JMPNZ(X,L2) */
+ int tmp = block->successors[0];
last_op->opcode = ZEND_JMPNZ;
block->successors[0] = block->successors[1];
- block->successors[1] = next;
+ block->successors[1] = tmp;
++(*opt_count);
- /* no need to add source */
- } else if (block->successors[1] == next) {
+ } else if (follow_block == next_block) {
/* jumping to next on NZ - can follow to it and jump only on Z */
/* JMPZNZ(X,L1,L2) L2: -> JMPZ(X,L1) */
last_op->opcode = ZEND_JMPZ;
++(*opt_count);
- /* no need to add source */
- }
-
- if (last_op->opcode == ZEND_JMPZNZ) {
- zend_uchar same_type = last_op->op1_type;
- zend_uchar same_var = VAR_NUM_EX(last_op->op1);
- zend_op *target;
- zend_op *target_end;
- zend_basic_block *target_block = blocks + block->successors[0];
-
-next_target_znz:
- target = op_array->opcodes + target_block->start;
- target_end = target + target_block->len;
- while (target < target_end && target->opcode == ZEND_NOP) {
- target++;
- }
- /* next block is only NOP's */
- if (target == target_end) {
- target_block = blocks + target_block->successors[0];
- ++(*opt_count);
- goto next_target_znz;
- } else if ((target->opcode == ZEND_JMPZ || target->opcode == ZEND_JMPZNZ) &&
- (target->op1_type & (IS_TMP_VAR|IS_CV)) &&
- same_type == target->op1_type &&
- same_var == VAR_NUM_EX(target->op1) &&
- !(target_block->flags & ZEND_BB_PROTECTED)) {
- /* JMPZNZ(X, L1, L2), L1: JMPZ(X, L3) -> JMPZNZ(X, L3, L2) */
- DEL_SOURCE(block, block->successors[0]);
- block->successors[0] = target_block->successors[0];
- ADD_SOURCE(block, block->successors[0]);
- ++(*opt_count);
- } else if (target->opcode == ZEND_JMPNZ &&
- (target->op1_type & (IS_TMP_VAR|IS_CV)) &&
- same_type == target->op1_type &&
- same_var == VAR_NUM_EX(target->op1) &&
- !(target_block->flags & ZEND_BB_PROTECTED)) {
- /* JMPZNZ(X, L1, L2), L1: X = JMPNZ(X, L3) -> JMPZNZ(X, L1+1, L2) */
- DEL_SOURCE(block, block->successors[0]);
- block->successors[0] = target_block->successors[1];
- ADD_SOURCE(block, block->successors[0]);
- ++(*opt_count);
- } else if (target->opcode == ZEND_JMP &&
- !(target_block->flags & ZEND_BB_PROTECTED)) {
- /* JMPZNZ(X, L1, L2), L1: JMP(L3) -> JMPZNZ(X, L3, L2) */
- DEL_SOURCE(block, block->successors[0]);
- block->successors[0] = target_block->successors[0];
- ADD_SOURCE(block, block->successors[0]);
- ++(*opt_count);
- }
}
break;
}
@@ -1719,7 +1674,7 @@ static void zend_t_usage(zend_cfg *cfg, zend_op_array *op_array, zend_bitset use
while (opline >= end) {
/* usage checks */
- if (opline->result_type == IS_VAR) {
+ if (opline->result_type & (IS_VAR|IS_TMP_VAR)) {
if (!zend_bitset_in(usage, VAR_NUM(opline->result.var))) {
switch (opline->opcode) {
case ZEND_ASSIGN_OP:
@@ -1736,17 +1691,12 @@ static void zend_t_usage(zend_cfg *cfg, zend_op_array *op_array, zend_bitset use
case ZEND_DO_FCALL_BY_NAME:
opline->result_type = IS_UNUSED;
break;
- }
- } else {
- zend_bitset_excl(usage, VAR_NUM(opline->result.var));
- }
- } else if (opline->result_type == IS_TMP_VAR) {
- if (!zend_bitset_in(usage, VAR_NUM(opline->result.var))) {
- switch (opline->opcode) {
case ZEND_POST_INC:
case ZEND_POST_DEC:
case ZEND_POST_INC_OBJ:
case ZEND_POST_DEC_OBJ:
+ case ZEND_POST_INC_STATIC_PROP:
+ case ZEND_POST_DEC_STATIC_PROP:
opline->opcode -= 2;
opline->result_type = IS_UNUSED;
break;
@@ -1884,8 +1834,8 @@ void zend_optimize_cfg(zend_op_array *op_array, zend_optimizer_ctx *ctx)
zend_bitset usage;
void *checkpoint;
zend_op **Tsource;
- zend_uchar *same_t;
uint32_t opt_count;
+ int *jmp_hitlist;
/* Build CFG */
checkpoint = zend_arena_checkpoint(ctx->arena);
@@ -1905,8 +1855,8 @@ void zend_optimize_cfg(zend_op_array *op_array, zend_optimizer_ctx *ctx)
bitset_len = zend_bitset_len(op_array->last_var + op_array->T);
Tsource = zend_arena_calloc(&ctx->arena, op_array->last_var + op_array->T, sizeof(zend_op *));
- same_t = zend_arena_alloc(&ctx->arena, op_array->last_var + op_array->T);
usage = zend_arena_alloc(&ctx->arena, bitset_len * ZEND_BITSET_ELM_SIZE);
+ jmp_hitlist = zend_arena_alloc(&ctx->arena, cfg.blocks_count * sizeof(int));
blocks = cfg.blocks;
end = blocks + cfg.blocks_count;
@@ -1938,10 +1888,12 @@ void zend_optimize_cfg(zend_op_array *op_array, zend_optimizer_ctx *ctx)
}
}
+ opt_count = 0;
+
/* Jump optimization for each block */
for (b = blocks; b < end; b++) {
if (b->flags & ZEND_BB_REACHABLE) {
- zend_jmp_optimization(b, op_array, &cfg, same_t, &opt_count);
+ zend_jmp_optimization(b, op_array, &cfg, jmp_hitlist, &opt_count);
}
}
@@ -1956,8 +1908,6 @@ void zend_optimize_cfg(zend_op_array *op_array, zend_optimizer_ctx *ctx)
}
}
- zend_bitset_clear(usage, bitset_len);
- zend_t_usage(&cfg, op_array, usage, ctx);
assemble_code_blocks(&cfg, op_array, ctx);
if (ctx->debug_level & ZEND_DUMP_AFTER_BLOCK_PASS) {
diff --git a/ext/opcache/Optimizer/compact_literals.c b/ext/opcache/Optimizer/compact_literals.c
index f754dbaa44..4aabe04c6e 100644
--- a/ext/opcache/Optimizer/compact_literals.c
+++ b/ext/opcache/Optimizer/compact_literals.c
@@ -56,25 +56,31 @@ typedef struct _literal_info {
info[n].flags = ((kind) | (related)); \
} while (0)
-static zend_bool class_name_type_hint(const zend_op_array *op_array, uint32_t arg_num)
+static size_t type_num_classes(const zend_op_array *op_array, uint32_t arg_num)
{
zend_arg_info *arg_info;
-
if (arg_num > 0) {
- if (op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS) {
- if (EXPECTED(arg_num <= op_array->num_args)) {
- arg_info = &op_array->arg_info[arg_num-1];
- } else if (UNEXPECTED(op_array->fn_flags & ZEND_ACC_VARIADIC)) {
- arg_info = &op_array->arg_info[op_array->num_args];
- } else {
- return 0;
- }
- return ZEND_TYPE_IS_CLASS(arg_info->type);
+ if (!(op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS)) {
+ return 0;
+ }
+ if (EXPECTED(arg_num <= op_array->num_args)) {
+ arg_info = &op_array->arg_info[arg_num-1];
+ } else if (UNEXPECTED(op_array->fn_flags & ZEND_ACC_VARIADIC)) {
+ arg_info = &op_array->arg_info[op_array->num_args];
+ } else {
+ return 0;
}
} else {
arg_info = op_array->arg_info - 1;
- return ZEND_TYPE_IS_CLASS(arg_info->type);
}
+
+ if (ZEND_TYPE_HAS_CLASS(arg_info->type)) {
+ if (ZEND_TYPE_HAS_LIST(arg_info->type)) {
+ return ZEND_TYPE_LIST(arg_info->type)->num_types;
+ }
+ return 1;
+ }
+
return 0;
}
@@ -168,13 +174,13 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx
LITERAL_INFO(opline->op1.constant, LITERAL_CLASS, 2);
break;
case ZEND_DEFINED:
- LITERAL_INFO(opline->op1.constant, LITERAL_CONST, 2);
+ LITERAL_INFO(opline->op1.constant, LITERAL_CONST, 1);
break;
case ZEND_FETCH_CONSTANT:
- if ((opline->op1.num & (IS_CONSTANT_IN_NAMESPACE|IS_CONSTANT_UNQUALIFIED)) == (IS_CONSTANT_IN_NAMESPACE|IS_CONSTANT_UNQUALIFIED)) {
- LITERAL_INFO(opline->op2.constant, LITERAL_CONST, 5);
- } else {
+ if (opline->op1.num & IS_CONSTANT_UNQUALIFIED_IN_NAMESPACE) {
LITERAL_INFO(opline->op2.constant, LITERAL_CONST, 3);
+ } else {
+ LITERAL_INFO(opline->op2.constant, LITERAL_CONST, 2);
}
break;
case ZEND_FETCH_CLASS_CONSTANT:
@@ -503,24 +509,25 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx
}
switch (opline->opcode) {
case ZEND_RECV_INIT:
- if (class_name_type_hint(op_array, opline->op1.num)) {
- opline->extended_value = cache_size;
- cache_size += sizeof(void *);
- }
- break;
case ZEND_RECV:
case ZEND_RECV_VARIADIC:
- if (class_name_type_hint(op_array, opline->op1.num)) {
- opline->op2.num = cache_size;
- cache_size += sizeof(void *);
+ {
+ size_t num_classes = type_num_classes(op_array, opline->op1.num);
+ if (num_classes) {
+ opline->extended_value = cache_size;
+ cache_size += num_classes * sizeof(void *);
}
break;
+ }
case ZEND_VERIFY_RETURN_TYPE:
- if (class_name_type_hint(op_array, 0)) {
+ {
+ size_t num_classes = type_num_classes(op_array, 0);
+ if (num_classes) {
opline->op2.num = cache_size;
- cache_size += sizeof(void *);
+ cache_size += num_classes * sizeof(void *);
}
break;
+ }
case ZEND_ASSIGN_STATIC_PROP_OP:
if (opline->op1_type == IS_CONST) {
// op1 static property
diff --git a/ext/opcache/Optimizer/dce.c b/ext/opcache/Optimizer/dce.c
index 8370bdc779..ea81687bf4 100644
--- a/ext/opcache/Optimizer/dce.c
+++ b/ext/opcache/Optimizer/dce.c
@@ -124,6 +124,7 @@ static inline zend_bool may_have_side_effects(
case ZEND_IN_ARRAY:
case ZEND_FUNC_NUM_ARGS:
case ZEND_FUNC_GET_ARGS:
+ case ZEND_ARRAY_KEY_EXISTS:
/* No side effects */
return 0;
case ZEND_ROPE_END:
@@ -241,6 +242,8 @@ static inline zend_bool may_have_side_effects(
}
}
return 0;
+ case ZEND_CHECK_VAR:
+ return (OP1_INFO() & MAY_BE_UNDEF) != 0;
default:
/* For everything we didn't handle, assume a side-effect */
return 1;
diff --git a/ext/opcache/Optimizer/dfa_pass.c b/ext/opcache/Optimizer/dfa_pass.c
index 471328b6c5..8802577154 100644
--- a/ext/opcache/Optimizer/dfa_pass.c
+++ b/ext/opcache/Optimizer/dfa_pass.c
@@ -125,33 +125,6 @@ int zend_dfa_analyze_op_array(zend_op_array *op_array, zend_optimizer_ctx *ctx,
return SUCCESS;
}
-static zend_bool is_smart_branch_inhibiting_nop(
- zend_op_array *op_array, uint32_t target, uint32_t current,
- zend_basic_block *b, zend_basic_block *blocks_end)
-{
- uint32_t next;
- /* Target points one past the last non-nop instruction. Make sure there is one. */
- if (target == 0) {
- return 0;
- }
-
- /* Find the next instruction, skipping unreachable or empty blocks. */
- next = current + 1;
- if (next >= b->start + b->len) {
- do {
- b++;
- if (b == blocks_end) {
- return 0;
- }
- } while (!(b->flags & ZEND_BB_REACHABLE) || b->len == 0);
- next = b->start;
- }
-
- return (op_array->opcodes[next].opcode == ZEND_JMPZ ||
- op_array->opcodes[next].opcode == ZEND_JMPNZ) &&
- zend_is_smart_branch(op_array->opcodes + target - 1);
-}
-
static void zend_ssa_remove_nops(zend_op_array *op_array, zend_ssa *ssa, zend_optimizer_ctx *ctx)
{
zend_basic_block *blocks = ssa->cfg.blocks;
@@ -199,8 +172,7 @@ static void zend_ssa_remove_nops(zend_op_array *op_array, zend_ssa *ssa, zend_op
old_end = b->start + b->len;
while (i < old_end) {
shiftlist[i] = i - target;
- if (EXPECTED(op_array->opcodes[i].opcode != ZEND_NOP) ||
- is_smart_branch_inhibiting_nop(op_array, target, i, b, blocks_end)) {
+ if (EXPECTED(op_array->opcodes[i].opcode != ZEND_NOP)) {
if (i != target) {
op_array->opcodes[target] = op_array->opcodes[i];
ssa->ops[target] = ssa->ops[i];
@@ -323,6 +295,8 @@ static inline zend_bool can_elide_return_type_check(
zend_ssa_var_info *use_info = &ssa->var_info[ssa_op->op1_use];
zend_ssa_var_info *def_info = &ssa->var_info[ssa_op->op1_def];
+ /* TODO: It would be better to rewrite this without using def_info,
+ * which may not be an exact representation of the type. */
if (use_info->type & MAY_BE_REF) {
return 0;
}
@@ -333,11 +307,11 @@ static inline zend_bool can_elide_return_type_check(
}
/* These types are not represented exactly */
- if (ZEND_TYPE_CODE(info->type) == IS_CALLABLE || ZEND_TYPE_CODE(info->type) == IS_ITERABLE) {
+ if (ZEND_TYPE_FULL_MASK(info->type) & (MAY_BE_CALLABLE|MAY_BE_ITERABLE)) {
return 0;
}
- if (ZEND_TYPE_IS_CLASS(info->type)) {
+ if (ZEND_TYPE_HAS_CLASS(info->type)) {
if (!use_info->ce || !def_info->ce || !safe_instanceof(use_info->ce, def_info->ce)) {
return 0;
}
@@ -492,6 +466,24 @@ int zend_dfa_optimize_calls(zend_op_array *op_array, zend_ssa *ssa)
MAKE_NOP(send_array);
removed_ops++;
+ op_num = call_info->caller_call_opline - op_array->opcodes;
+ ssa_op = ssa->ops + op_num;
+ if (ssa_op->result_def >= 0) {
+ int var = ssa_op->result_def;
+ int use = ssa->vars[var].use_chain;
+
+ if (ssa->vars[var].phi_use_chain == NULL) {
+ if (ssa->ops[use].op1_use == var
+ && ssa->ops[use].op1_use_chain == -1) {
+ call_info->caller_call_opline->result_type = IS_TMP_VAR;
+ op_array->opcodes[use].op1_type = IS_TMP_VAR;
+ } else if (ssa->ops[use].op2_use == var
+ && ssa->ops[use].op2_use_chain == -1) {
+ call_info->caller_call_opline->result_type = IS_TMP_VAR;
+ op_array->opcodes[use].op2_type = IS_TMP_VAR;
+ }
+ }
+ }
}
}
}
@@ -541,8 +533,7 @@ static void compress_block(zend_op_array *op_array, zend_basic_block *block)
while (block->len > 0) {
zend_op *opline = &op_array->opcodes[block->start + block->len - 1];
- if (opline->opcode == ZEND_NOP
- && (block->len == 1 || !zend_is_smart_branch(opline - 1))) {
+ if (opline->opcode == ZEND_NOP) {
block->len--;
} else {
break;
@@ -1204,8 +1195,64 @@ void zend_dfa_optimize_op_array(zend_op_array *op_array, zend_optimizer_ctx *ctx
/* Update opcodes */
op_array->opcodes[op_2].result_type = opline->op1_type;
op_array->opcodes[op_2].result.var = opline->op1.var;
+
MAKE_NOP(opline);
remove_nops = 1;
+
+ if (op_array->opcodes[op_2].opcode == ZEND_SUB
+ && op_array->opcodes[op_2].op1_type == op_array->opcodes[op_2].result_type
+ && op_array->opcodes[op_2].op1.var == op_array->opcodes[op_2].result.var
+ && op_array->opcodes[op_2].op2_type == IS_CONST
+ && Z_TYPE_P(CT_CONSTANT_EX(op_array, op_array->opcodes[op_2].op2.constant)) == IS_LONG
+ && Z_LVAL_P(CT_CONSTANT_EX(op_array, op_array->opcodes[op_2].op2.constant)) == 1
+ && ssa->ops[op_2].op1_use >= 0
+ && !(ssa->var_info[ssa->ops[op_2].op1_use].type & (MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF))) {
+
+ op_array->opcodes[op_2].opcode = ZEND_PRE_DEC;
+ SET_UNUSED(op_array->opcodes[op_2].op2);
+ SET_UNUSED(op_array->opcodes[op_2].result);
+
+ ssa->ops[op_2].result_def = -1;
+ ssa->ops[op_2].op1_def = v;
+
+ } else if (op_array->opcodes[op_2].opcode == ZEND_ADD
+ && op_array->opcodes[op_2].op1_type == op_array->opcodes[op_2].result_type
+ && op_array->opcodes[op_2].op1.var == op_array->opcodes[op_2].result.var
+ && op_array->opcodes[op_2].op2_type == IS_CONST
+ && Z_TYPE_P(CT_CONSTANT_EX(op_array, op_array->opcodes[op_2].op2.constant)) == IS_LONG
+ && Z_LVAL_P(CT_CONSTANT_EX(op_array, op_array->opcodes[op_2].op2.constant)) == 1
+ && ssa->ops[op_2].op1_use >= 0
+ && !(ssa->var_info[ssa->ops[op_2].op1_use].type & (MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF))) {
+
+ op_array->opcodes[op_2].opcode = ZEND_PRE_INC;
+ SET_UNUSED(op_array->opcodes[op_2].op2);
+ SET_UNUSED(op_array->opcodes[op_2].result);
+
+ ssa->ops[op_2].result_def = -1;
+ ssa->ops[op_2].op1_def = v;
+
+ } else if (op_array->opcodes[op_2].opcode == ZEND_ADD
+ && op_array->opcodes[op_2].op2_type == op_array->opcodes[op_2].result_type
+ && op_array->opcodes[op_2].op2.var == op_array->opcodes[op_2].result.var
+ && op_array->opcodes[op_2].op1_type == IS_CONST
+ && Z_TYPE_P(CT_CONSTANT_EX(op_array, op_array->opcodes[op_2].op1.constant)) == IS_LONG
+ && Z_LVAL_P(CT_CONSTANT_EX(op_array, op_array->opcodes[op_2].op1.constant)) == 1
+ && ssa->ops[op_2].op2_use >= 0
+ && !(ssa->var_info[ssa->ops[op_2].op2_use].type & (MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF))) {
+
+ op_array->opcodes[op_2].opcode = ZEND_PRE_INC;
+ op_array->opcodes[op_2].op1_type = op_array->opcodes[op_2].op2_type;
+ op_array->opcodes[op_2].op1.var = op_array->opcodes[op_2].op2.var;
+ SET_UNUSED(op_array->opcodes[op_2].op2);
+ SET_UNUSED(op_array->opcodes[op_2].result);
+
+ ssa->ops[op_2].result_def = -1;
+ ssa->ops[op_2].op1_def = v;
+ ssa->ops[op_2].op1_use = ssa->ops[op_2].op2_use;
+ ssa->ops[op_2].op1_use_chain = ssa->ops[op_2].op2_use_chain;
+ ssa->ops[op_2].op2_use = -1;
+ ssa->ops[op_2].op2_use_chain = -1;
+ }
}
} else if (opline->op2_type == IS_CONST
|| ((opline->op2_type & (IS_TMP_VAR|IS_VAR|IS_CV))
diff --git a/ext/opcache/Optimizer/escape_analysis.c b/ext/opcache/Optimizer/escape_analysis.c
index c561bec9dc..3b8733eaae 100644
--- a/ext/opcache/Optimizer/escape_analysis.c
+++ b/ext/opcache/Optimizer/escape_analysis.c
@@ -176,12 +176,12 @@ static int is_allocation_def(zend_op_array *op_array, zend_ssa *ssa, int def, in
case ZEND_NEW:
/* objects with destructors should escape */
if (opline->op1_type == IS_CONST) {
- zend_class_entry *ce = get_class_entry(script, Z_STR_P(CRT_CONSTANT_EX(op_array, opline, opline->op1, ssa->rt_constants)+1));
- uint32_t forbidden_flags = ZEND_ACC_INHERITED
+ zend_class_entry *ce = get_class_entry(script, Z_STR_P(CRT_CONSTANT(opline->op1)+1));
+ uint32_t forbidden_flags =
/* These flags will always cause an exception */
- | ZEND_ACC_IMPLICIT_ABSTRACT_CLASS | ZEND_ACC_EXPLICIT_ABSTRACT_CLASS
+ ZEND_ACC_IMPLICIT_ABSTRACT_CLASS | ZEND_ACC_EXPLICIT_ABSTRACT_CLASS
| ZEND_ACC_INTERFACE | ZEND_ACC_TRAIT;
- if (ce && !ce->create_object && !ce->constructor &&
+ if (ce && !ce->parent && !ce->create_object && !ce->constructor &&
!ce->destructor && !ce->__get && !ce->__set &&
!(ce->ce_flags & forbidden_flags) &&
(ce->ce_flags & ZEND_ACC_CONSTANTS_UPDATED)) {
@@ -191,7 +191,7 @@ static int is_allocation_def(zend_op_array *op_array, zend_ssa *ssa, int def, in
break;
case ZEND_QM_ASSIGN:
if (opline->op1_type == IS_CONST
- && Z_TYPE_P(CRT_CONSTANT_EX(op_array, opline, opline->op1, ssa->rt_constants)) == IS_ARRAY) {
+ && Z_TYPE_P(CRT_CONSTANT(opline->op1)) == IS_ARRAY) {
return 1;
}
if (opline->op1_type == IS_CV && (OP1_INFO() & MAY_BE_ARRAY)) {
@@ -208,7 +208,7 @@ static int is_allocation_def(zend_op_array *op_array, zend_ssa *ssa, int def, in
switch (opline->opcode) {
case ZEND_ASSIGN:
if (opline->op2_type == IS_CONST
- && Z_TYPE_P(CRT_CONSTANT_EX(op_array, opline, opline->op2, ssa->rt_constants)) == IS_ARRAY) {
+ && Z_TYPE_P(CRT_CONSTANT(opline->op2)) == IS_ARRAY) {
return 1;
}
if (opline->op2_type == IS_CV && (OP2_INFO() & MAY_BE_ARRAY)) {
@@ -245,10 +245,9 @@ static int is_local_def(zend_op_array *op_array, zend_ssa *ssa, int def, int var
case ZEND_NEW:
/* objects with destructors should escape */
if (opline->op1_type == IS_CONST) {
- zend_class_entry *ce = get_class_entry(script, Z_STR_P(CRT_CONSTANT_EX(op_array, opline, opline->op1, ssa->rt_constants)+1));
+ zend_class_entry *ce = get_class_entry(script, Z_STR_P(CRT_CONSTANT(opline->op1)+1));
if (ce && !ce->create_object && !ce->constructor &&
- !ce->destructor && !ce->__get && !ce->__set &&
- !(ce->ce_flags & ZEND_ACC_INHERITED)) {
+ !ce->destructor && !ce->__get && !ce->__set && !ce->parent) {
return 1;
}
}
@@ -338,7 +337,7 @@ static int is_escape_use(zend_op_array *op_array, zend_ssa *ssa, int use, int va
if (opline->op1_type != IS_CV
|| (OP1_INFO() & MAY_BE_REF)
|| (op->op1_def >= 0 && ssa->vars[op->op1_def].alias)) {
- /* asignment into escaping structure */
+ /* assignment into escaping structure */
return 1;
}
/* reference dependencies processed separately */
@@ -354,7 +353,7 @@ static int is_escape_use(zend_op_array *op_array, zend_ssa *ssa, int use, int va
if (opline->op1_type != IS_CV
|| (OP1_INFO() & MAY_BE_REF)
|| (op->op1_def >= 0 && ssa->vars[op->op1_def].alias)) {
- /* asignment into escaping variable */
+ /* assignment into escaping variable */
return 1;
}
if (opline->op2_type == IS_CV || opline->result_type != IS_UNUSED) {
diff --git a/ext/opcache/Optimizer/optimize_func_calls.c b/ext/opcache/Optimizer/optimize_func_calls.c
index ae707a2409..2894ca89f4 100644
--- a/ext/opcache/Optimizer/optimize_func_calls.c
+++ b/ext/opcache/Optimizer/optimize_func_calls.c
@@ -116,7 +116,7 @@ static void zend_try_inline_call(zend_op_array *op_array, zend_op *fcall, zend_o
for (i = 0; i < num_args; i++) {
/* Don't inline functions with by-reference arguments. This would require
* correct handling of INDIRECT arguments. */
- if (func->op_array.arg_info[i].pass_by_reference) {
+ if (ZEND_ARG_SEND_MODE(&func->op_array.arg_info[i])) {
return;
}
}
@@ -126,7 +126,7 @@ static void zend_try_inline_call(zend_op_array *op_array, zend_op *fcall, zend_o
i = fcall->extended_value;
do {
- if (Z_TYPE_P(RT_CONSTANT(&func->op_array.opcodes[i], func->op_array.opcodes[i].op2)) == IS_CONSTANT_AST) {
+ if (Z_TYPE_P(CRT_CONSTANT_EX(&func->op_array, &func->op_array.opcodes[i], func->op_array.opcodes[i].op2)) == IS_CONSTANT_AST) {
return;
}
i++;
@@ -136,7 +136,7 @@ static void zend_try_inline_call(zend_op_array *op_array, zend_op *fcall, zend_o
if (RETURN_VALUE_USED(opline)) {
zval zv;
- ZVAL_COPY(&zv, RT_CONSTANT(ret_opline, ret_opline->op1));
+ ZVAL_COPY(&zv, CRT_CONSTANT_EX(&func->op_array, ret_opline, ret_opline->op1));
opline->opcode = ZEND_QM_ASSIGN;
opline->op1_type = IS_CONST;
opline->op1.constant = zend_optimizer_add_literal(op_array, &zv);
@@ -173,7 +173,7 @@ void zend_optimize_func_calls(zend_op_array *op_array, zend_optimizer_ctx *ctx)
case ZEND_INIT_FCALL:
case ZEND_NEW:
call_stack[call].func = zend_optimizer_get_called_func(
- ctx->script, op_array, opline, 0);
+ ctx->script, op_array, opline);
call_stack[call].try_inline = opline->opcode != ZEND_NEW;
/* break missing intentionally */
case ZEND_INIT_DYNAMIC_CALL:
diff --git a/ext/opcache/Optimizer/optimize_temp_vars_5.c b/ext/opcache/Optimizer/optimize_temp_vars_5.c
index 825091bfc3..6f7400159d 100644
--- a/ext/opcache/Optimizer/optimize_temp_vars_5.c
+++ b/ext/opcache/Optimizer/optimize_temp_vars_5.c
@@ -102,7 +102,7 @@ void zend_optimize_temporary_variables(zend_op_array *op_array, zend_optimizer_c
if (!zend_bitset_in(valid_T, currT)) {
int use_new_var = 0;
- /* Code in "finally" blocks may modify temorary variables.
+ /* Code in "finally" blocks may modify temporary variables.
* We allocate new temporaries for values that need to
* relive FAST_CALLs.
*/
diff --git a/ext/opcache/Optimizer/pass1.c b/ext/opcache/Optimizer/pass1.c
new file mode 100644
index 0000000000..7d244a283c
--- /dev/null
+++ b/ext/opcache/Optimizer/pass1.c
@@ -0,0 +1,736 @@
+/*
+ +----------------------------------------------------------------------+
+ | Zend OPcache |
+ +----------------------------------------------------------------------+
+ | Copyright (c) The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Andi Gutmans <andi@php.net> |
+ | Zeev Suraski <zeev@php.net> |
+ | Stanislav Malyshev <stas@zend.com> |
+ | Dmitry Stogov <dmitry@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* pass 1 (Simple local optimizations)
+ * - persistent constant substitution (true, false, null, etc)
+ * - constant casting (ADD expects numbers, CONCAT strings, etc)
+ * - constant expression evaluation
+ * - optimize constant conditional JMPs
+ * - pre-evaluate constant function calls
+ * - eliminate FETCH $GLOBALS followed by FETCH_DIM/UNSET_DIM/ISSET_ISEMPTY_DIM
+ */
+
+#include "php.h"
+#include "Optimizer/zend_optimizer.h"
+#include "Optimizer/zend_optimizer_internal.h"
+#include "zend_API.h"
+#include "zend_constants.h"
+#include "zend_execute.h"
+#include "zend_vm.h"
+
+void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx)
+{
+ zend_op *opline = op_array->opcodes;
+ zend_op *end = opline + op_array->last;
+ zend_bool collect_constants = (ZEND_OPTIMIZER_PASS_15 & ctx->optimization_level)?
+ (op_array == &ctx->script->main_op_array) : 0;
+
+ while (opline < end) {
+ switch (opline->opcode) {
+ case ZEND_ADD:
+ case ZEND_SUB:
+ case ZEND_MUL:
+ case ZEND_DIV:
+ case ZEND_POW:
+ if (opline->op1_type == IS_CONST) {
+ if (Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_STRING) {
+ /* don't optimise if it should produce a runtime numeric string error */
+ if (is_numeric_string(Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline)), NULL, NULL, 0)) {
+ convert_scalar_to_number(&ZEND_OP1_LITERAL(opline));
+ }
+ }
+ }
+ if (opline->op2_type == IS_CONST) {
+ if (Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING) {
+ /* don't optimise if it should produce a runtime numeric string error */
+ if (is_numeric_string(Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline)), NULL, NULL, 0)) {
+ convert_scalar_to_number(&ZEND_OP2_LITERAL(opline));
+ }
+ }
+ if (opline->op1_type == IS_CONST) {
+ goto constant_binary_op;
+ }
+ }
+ break;
+
+ case ZEND_MOD:
+ case ZEND_SL:
+ case ZEND_SR:
+ if (opline->op1_type == IS_CONST) {
+ if (Z_TYPE(ZEND_OP1_LITERAL(opline)) != IS_LONG) {
+ /* don't optimise if it should produce a runtime numeric string error */
+ if (!(Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_STRING
+ && !is_numeric_string(Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline)), NULL, NULL, 0))) {
+ convert_to_long(&ZEND_OP1_LITERAL(opline));
+ }
+ }
+ }
+ if (opline->op2_type == IS_CONST) {
+ if (Z_TYPE(ZEND_OP2_LITERAL(opline)) != IS_LONG) {
+ /* don't optimise if it should produce a runtime numeric string error */
+ if (!(Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING
+ && !is_numeric_string(Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline)), NULL, NULL, 0))) {
+ convert_to_long(&ZEND_OP2_LITERAL(opline));
+ }
+ }
+ if (opline->op1_type == IS_CONST) {
+ goto constant_binary_op;
+ }
+ }
+ break;
+
+ case ZEND_CONCAT:
+ case ZEND_FAST_CONCAT:
+ if (opline->op1_type == IS_CONST) {
+ if (Z_TYPE(ZEND_OP1_LITERAL(opline)) != IS_STRING) {
+ convert_to_string(&ZEND_OP1_LITERAL(opline));
+ }
+ }
+ if (opline->op2_type == IS_CONST) {
+ if (Z_TYPE(ZEND_OP2_LITERAL(opline)) != IS_STRING) {
+ convert_to_string(&ZEND_OP2_LITERAL(opline));
+ }
+ if (opline->op1_type == IS_CONST) {
+ goto constant_binary_op;
+ }
+ }
+ break;
+
+ case ZEND_BW_OR:
+ case ZEND_BW_AND:
+ case ZEND_BW_XOR:
+ case ZEND_IS_EQUAL:
+ case ZEND_IS_NOT_EQUAL:
+ case ZEND_IS_SMALLER:
+ case ZEND_IS_SMALLER_OR_EQUAL:
+ case ZEND_IS_IDENTICAL:
+ case ZEND_IS_NOT_IDENTICAL:
+ case ZEND_BOOL_XOR:
+ case ZEND_SPACESHIP:
+ case ZEND_CASE:
+ if (opline->op1_type == IS_CONST &&
+ opline->op2_type == IS_CONST) {
+ /* binary operation with constant operands */
+ zval result;
+
+constant_binary_op:
+ if (zend_optimizer_eval_binary_op(&result, opline->opcode, &ZEND_OP1_LITERAL(opline), &ZEND_OP2_LITERAL(opline)) == SUCCESS) {
+ literal_dtor(&ZEND_OP1_LITERAL(opline));
+ literal_dtor(&ZEND_OP2_LITERAL(opline));
+ if (zend_optimizer_replace_by_const(op_array, opline + 1, IS_TMP_VAR, opline->result.var, &result)) {
+ MAKE_NOP(opline);
+ } else {
+ opline->opcode = ZEND_QM_ASSIGN;
+ SET_UNUSED(opline->op2);
+ zend_optimizer_update_op1_const(op_array, opline, &result);
+ }
+ }
+ }
+ break;
+
+ case ZEND_ASSIGN_OP:
+ if (opline->op2_type == IS_CONST) {
+ if (opline->extended_value == ZEND_ADD
+ || opline->extended_value == ZEND_SUB
+ || opline->extended_value == ZEND_MUL
+ || opline->extended_value == ZEND_DIV
+ || opline->extended_value == ZEND_POW) {
+ if (Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING) {
+ /* don't optimise if it should produce a runtime numeric string error */
+ if (is_numeric_string(Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline)), NULL, NULL, 0)) {
+ convert_scalar_to_number(&ZEND_OP2_LITERAL(opline));
+ }
+ }
+ } else if (opline->extended_value == ZEND_MOD
+ || opline->extended_value == ZEND_SL
+ || opline->extended_value == ZEND_SR) {
+ if (Z_TYPE(ZEND_OP2_LITERAL(opline)) != IS_LONG) {
+ /* don't optimise if it should produce a runtime numeric string error */
+ if (!(Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING
+ && !is_numeric_string(Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline)), NULL, NULL, 0))) {
+ convert_to_long(&ZEND_OP2_LITERAL(opline));
+ }
+ }
+ } else if (opline->extended_value == ZEND_CONCAT) {
+ if (Z_TYPE(ZEND_OP2_LITERAL(opline)) != IS_STRING) {
+ convert_to_string(&ZEND_OP2_LITERAL(opline));
+ }
+ }
+ }
+ break;
+
+ case ZEND_CAST:
+ if (opline->op1_type == IS_CONST) {
+ /* cast of constant operand */
+ zval result;
+
+ if (zend_optimizer_eval_cast(&result, opline->extended_value, &ZEND_OP1_LITERAL(opline)) == SUCCESS) {
+ literal_dtor(&ZEND_OP1_LITERAL(opline));
+ if (zend_optimizer_replace_by_const(op_array, opline + 1, opline->result_type, opline->result.var, &result)) {
+ MAKE_NOP(opline);
+ } else {
+ opline->opcode = ZEND_QM_ASSIGN;
+ opline->extended_value = 0;
+ zend_optimizer_update_op1_const(op_array, opline, &result);
+ }
+ break;
+ }
+ }
+ break;
+
+ case ZEND_BW_NOT:
+ case ZEND_BOOL_NOT:
+ if (opline->op1_type == IS_CONST) {
+ /* unary operation on constant operand */
+ zval result;
+
+ if (zend_optimizer_eval_unary_op(&result, opline->opcode, &ZEND_OP1_LITERAL(opline)) == SUCCESS) {
+ literal_dtor(&ZEND_OP1_LITERAL(opline));
+ if (zend_optimizer_replace_by_const(op_array, opline + 1, IS_TMP_VAR, opline->result.var, &result)) {
+ MAKE_NOP(opline);
+ } else {
+ opline->opcode = ZEND_QM_ASSIGN;
+ zend_optimizer_update_op1_const(op_array, opline, &result);
+ }
+ }
+ }
+ break;
+
+ case ZEND_FETCH_CONSTANT:
+ if (opline->op2_type == IS_CONST &&
+ Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING &&
+ Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("__COMPILER_HALT_OFFSET__") - 1 &&
+ memcmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)), "__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__") - 1) == 0) {
+ /* substitute __COMPILER_HALT_OFFSET__ constant */
+ zend_execute_data *orig_execute_data = EG(current_execute_data);
+ zend_execute_data fake_execute_data;
+ zval *offset;
+
+ memset(&fake_execute_data, 0, sizeof(zend_execute_data));
+ fake_execute_data.func = (zend_function*)op_array;
+ EG(current_execute_data) = &fake_execute_data;
+ if ((offset = zend_get_constant_str("__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__") - 1)) != NULL) {
+
+ literal_dtor(&ZEND_OP2_LITERAL(opline));
+ if (zend_optimizer_replace_by_const(op_array, opline, IS_TMP_VAR, opline->result.var, offset)) {
+ MAKE_NOP(opline);
+ } else {
+ opline->opcode = ZEND_QM_ASSIGN;
+ opline->extended_value = 0;
+ SET_UNUSED(opline->op2);
+ zend_optimizer_update_op1_const(op_array, opline, offset);
+ }
+ }
+ EG(current_execute_data) = orig_execute_data;
+ break;
+ }
+
+ if (opline->op2_type == IS_CONST &&
+ Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING) {
+ /* substitute persistent constants */
+ zval c;
+
+ if (!zend_optimizer_get_persistent_constant(Z_STR(ZEND_OP2_LITERAL(opline)), &c, 1)) {
+ if (!ctx->constants || !zend_optimizer_get_collected_constant(ctx->constants, &ZEND_OP2_LITERAL(opline), &c)) {
+ break;
+ }
+ }
+ if (Z_TYPE(c) == IS_CONSTANT_AST) {
+ break;
+ }
+ literal_dtor(&ZEND_OP2_LITERAL(opline));
+ if (zend_optimizer_replace_by_const(op_array, opline, IS_TMP_VAR, opline->result.var, &c)) {
+ MAKE_NOP(opline);
+ } else {
+ opline->opcode = ZEND_QM_ASSIGN;
+ opline->extended_value = 0;
+ SET_UNUSED(opline->op2);
+ zend_optimizer_update_op1_const(op_array, opline, &c);
+ }
+ }
+ break;
+
+ case ZEND_FETCH_CLASS_CONSTANT:
+ if (opline->op2_type == IS_CONST &&
+ Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING) {
+
+ zend_class_entry *ce = NULL;
+
+ if (opline->op1_type == IS_CONST &&
+ Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_STRING) {
+ /* for A::B */
+ if (op_array->scope &&
+ !strncasecmp(Z_STRVAL(ZEND_OP1_LITERAL(opline)),
+ ZSTR_VAL(op_array->scope->name), Z_STRLEN(ZEND_OP1_LITERAL(opline)) + 1)) {
+ ce = op_array->scope;
+ } else {
+ if ((ce = zend_hash_find_ptr(EG(class_table),
+ Z_STR(op_array->literals[opline->op1.constant + 1]))) == NULL ||
+ (ce->type == ZEND_INTERNAL_CLASS &&
+ ce->info.internal.module->type != MODULE_PERSISTENT) ||
+ (ce->type == ZEND_USER_CLASS &&
+ ce->info.user.filename != op_array->filename)) {
+ break;
+ }
+ }
+ } else if (op_array->scope &&
+ opline->op1_type == IS_UNUSED &&
+ (opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_SELF) {
+ /* for self::B */
+ ce = op_array->scope;
+ } else if (op_array->scope &&
+ opline->op1_type == IS_VAR &&
+ (opline - 1)->opcode == ZEND_FETCH_CLASS &&
+ ((opline - 1)->op2_type == IS_UNUSED &&
+ ((opline - 1)->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_SELF) &&
+ (opline - 1)->result.var == opline->op1.var) {
+ /* for self::B */
+ ce = op_array->scope;
+ }
+
+ if (ce) {
+ zend_class_constant *cc;
+ zval *c, t;
+
+ if ((cc = zend_hash_find_ptr(&ce->constants_table,
+ Z_STR(ZEND_OP2_LITERAL(opline)))) != NULL &&
+ (Z_ACCESS_FLAGS(cc->value) & ZEND_ACC_PPP_MASK) == ZEND_ACC_PUBLIC) {
+ c = &cc->value;
+ if (Z_TYPE_P(c) == IS_CONSTANT_AST) {
+ zend_ast *ast = Z_ASTVAL_P(c);
+ if (ast->kind != ZEND_AST_CONSTANT
+ || !zend_optimizer_get_persistent_constant(zend_ast_get_constant_name(ast), &t, 1)
+ || Z_TYPE(t) == IS_CONSTANT_AST) {
+ break;
+ }
+ } else {
+ ZVAL_COPY_OR_DUP(&t, c);
+ }
+
+ if (opline->op1_type == IS_CONST) {
+ literal_dtor(&ZEND_OP1_LITERAL(opline));
+ } else if (opline->op1_type == IS_VAR) {
+ MAKE_NOP((opline - 1));
+ }
+ literal_dtor(&ZEND_OP2_LITERAL(opline));
+
+ if (zend_optimizer_replace_by_const(op_array, opline, IS_TMP_VAR, opline->result.var, &t)) {
+ MAKE_NOP(opline);
+ } else {
+ opline->opcode = ZEND_QM_ASSIGN;
+ opline->extended_value = 0;
+ SET_UNUSED(opline->op2);
+ zend_optimizer_update_op1_const(op_array, opline, &t);
+ }
+ }
+ }
+ }
+ break;
+
+ case ZEND_DO_ICALL: {
+ zend_op *send1_opline = opline - 1;
+ zend_op *send2_opline = NULL;
+ zend_op *init_opline = NULL;
+
+ while (send1_opline->opcode == ZEND_NOP) {
+ send1_opline--;
+ }
+ if (send1_opline->opcode != ZEND_SEND_VAL ||
+ send1_opline->op1_type != IS_CONST) {
+ /* don't colllect constants after unknown function call */
+ collect_constants = 0;
+ break;
+ }
+ if (send1_opline->op2.num == 2) {
+ send2_opline = send1_opline;
+ send1_opline--;
+ while (send1_opline->opcode == ZEND_NOP) {
+ send1_opline--;
+ }
+ if (send1_opline->opcode != ZEND_SEND_VAL ||
+ send1_opline->op1_type != IS_CONST) {
+ /* don't colllect constants after unknown function call */
+ collect_constants = 0;
+ break;
+ }
+ }
+ init_opline = send1_opline - 1;
+ while (init_opline->opcode == ZEND_NOP) {
+ init_opline--;
+ }
+ if (init_opline->opcode != ZEND_INIT_FCALL ||
+ init_opline->op2_type != IS_CONST ||
+ Z_TYPE(ZEND_OP2_LITERAL(init_opline)) != IS_STRING) {
+ /* don't colllect constants after unknown function call */
+ collect_constants = 0;
+ break;
+ }
+
+ /* define("name", scalar); */
+ if (Z_STRLEN(ZEND_OP2_LITERAL(init_opline)) == sizeof("define")-1 &&
+ zend_binary_strcasecmp(Z_STRVAL(ZEND_OP2_LITERAL(init_opline)), Z_STRLEN(ZEND_OP2_LITERAL(init_opline)), "define", sizeof("define")-1) == 0) {
+
+ if (Z_TYPE(ZEND_OP1_LITERAL(send1_opline)) == IS_STRING &&
+ send2_opline &&
+ Z_TYPE(ZEND_OP1_LITERAL(send2_opline)) <= IS_STRING) {
+
+ if (collect_constants) {
+ zend_optimizer_collect_constant(ctx, &ZEND_OP1_LITERAL(send1_opline), &ZEND_OP1_LITERAL(send2_opline));
+ }
+
+ if (RESULT_UNUSED(opline) &&
+ !zend_memnstr(Z_STRVAL(ZEND_OP1_LITERAL(send1_opline)), "::", sizeof("::") - 1, Z_STRVAL(ZEND_OP1_LITERAL(send1_opline)) + Z_STRLEN(ZEND_OP1_LITERAL(send1_opline)))) {
+
+ opline->opcode = ZEND_DECLARE_CONST;
+ opline->op1_type = IS_CONST;
+ opline->op2_type = IS_CONST;
+ opline->result_type = IS_UNUSED;
+ opline->op1.constant = send1_opline->op1.constant;
+ opline->op2.constant = send2_opline->op1.constant;
+ opline->result.num = 0;
+
+ literal_dtor(&ZEND_OP2_LITERAL(init_opline));
+ MAKE_NOP(init_opline);
+ MAKE_NOP(send1_opline);
+ MAKE_NOP(send2_opline);
+ }
+ break;
+ }
+ }
+
+ /* pre-evaluate constant functions:
+ constant(x)
+ function_exists(x)
+ is_callable(x)
+ extension_loaded(x)
+ */
+ if (!send2_opline &&
+ Z_TYPE(ZEND_OP1_LITERAL(send1_opline)) == IS_STRING) {
+ if ((Z_STRLEN(ZEND_OP2_LITERAL(init_opline)) == sizeof("function_exists")-1 &&
+ !memcmp(Z_STRVAL(ZEND_OP2_LITERAL(init_opline)),
+ "function_exists", sizeof("function_exists")-1) &&
+ !zend_optimizer_is_disabled_func("function_exists", sizeof("function_exists") - 1)) ||
+ (Z_STRLEN(ZEND_OP2_LITERAL(init_opline)) == sizeof("is_callable")-1 &&
+ !memcmp(Z_STRVAL(ZEND_OP2_LITERAL(init_opline)),
+ "is_callable", sizeof("is_callable")) &&
+ !zend_optimizer_is_disabled_func("is_callable", sizeof("is_callable") - 1))) {
+ zend_internal_function *func;
+ zend_string *lc_name = zend_string_tolower(
+ Z_STR(ZEND_OP1_LITERAL(send1_opline)));
+
+ if ((func = zend_hash_find_ptr(EG(function_table), lc_name)) != NULL
+ && func->type == ZEND_INTERNAL_FUNCTION
+ && func->module->type == MODULE_PERSISTENT
+#ifdef ZEND_WIN32
+ && func->module->handle == NULL
+#endif
+ ) {
+ zval t;
+ if (Z_STRLEN(ZEND_OP2_LITERAL(init_opline)) == sizeof("is_callable") - 1 ||
+ func->handler != ZEND_FN(display_disabled_function)) {
+ ZVAL_TRUE(&t);
+ } else {
+ ZVAL_FALSE(&t);
+ }
+ literal_dtor(&ZEND_OP2_LITERAL(init_opline));
+ MAKE_NOP(init_opline);
+ literal_dtor(&ZEND_OP1_LITERAL(send1_opline));
+ MAKE_NOP(send1_opline);
+ if (zend_optimizer_replace_by_const(op_array, opline + 1, IS_VAR, opline->result.var, &t)) {
+ MAKE_NOP(opline);
+ } else {
+ opline->opcode = ZEND_QM_ASSIGN;
+ opline->extended_value = 0;
+ SET_UNUSED(opline->op2);
+ zend_optimizer_update_op1_const(op_array, opline, &t);
+ }
+ }
+ zend_string_release_ex(lc_name, 0);
+ break;
+ } else if (Z_STRLEN(ZEND_OP2_LITERAL(init_opline)) == sizeof("extension_loaded")-1 &&
+ !memcmp(Z_STRVAL(ZEND_OP2_LITERAL(init_opline)),
+ "extension_loaded", sizeof("extension_loaded")-1) &&
+ !zend_optimizer_is_disabled_func("extension_loaded", sizeof("extension_loaded") - 1)) {
+ zval t;
+ zend_string *lc_name = zend_string_tolower(
+ Z_STR(ZEND_OP1_LITERAL(send1_opline)));
+ zend_module_entry *m = zend_hash_find_ptr(&module_registry,
+ lc_name);
+
+ zend_string_release_ex(lc_name, 0);
+ if (!m) {
+ if (PG(enable_dl)) {
+ break;
+ } else {
+ ZVAL_FALSE(&t);
+ }
+ } else {
+ if (m->type == MODULE_PERSISTENT
+#ifdef ZEND_WIN32
+ && m->handle == NULL
+#endif
+ ) {
+ ZVAL_TRUE(&t);
+ } else {
+ break;
+ }
+ }
+
+ literal_dtor(&ZEND_OP2_LITERAL(init_opline));
+ MAKE_NOP(init_opline);
+ literal_dtor(&ZEND_OP1_LITERAL(send1_opline));
+ MAKE_NOP(send1_opline);
+ if (zend_optimizer_replace_by_const(op_array, opline + 1, IS_VAR, opline->result.var, &t)) {
+ MAKE_NOP(opline);
+ } else {
+ opline->opcode = ZEND_QM_ASSIGN;
+ opline->extended_value = 0;
+ SET_UNUSED(opline->op2);
+ zend_optimizer_update_op1_const(op_array, opline, &t);
+ }
+ break;
+ } else if (Z_STRLEN(ZEND_OP2_LITERAL(init_opline)) == sizeof("constant")-1 &&
+ !memcmp(Z_STRVAL(ZEND_OP2_LITERAL(init_opline)),
+ "constant", sizeof("constant")-1) &&
+ !zend_optimizer_is_disabled_func("constant", sizeof("constant") - 1)) {
+ zval t;
+
+ if (zend_optimizer_get_persistent_constant(Z_STR(ZEND_OP1_LITERAL(send1_opline)), &t, 1)) {
+ literal_dtor(&ZEND_OP2_LITERAL(init_opline));
+ MAKE_NOP(init_opline);
+ literal_dtor(&ZEND_OP1_LITERAL(send1_opline));
+ MAKE_NOP(send1_opline);
+ if (zend_optimizer_replace_by_const(op_array, opline + 1, IS_VAR, opline->result.var, &t)) {
+ MAKE_NOP(opline);
+ } else {
+ opline->opcode = ZEND_QM_ASSIGN;
+ opline->extended_value = 0;
+ SET_UNUSED(opline->op2);
+ zend_optimizer_update_op1_const(op_array, opline, &t);
+ }
+ }
+ break;
+ /* dirname(IS_CONST/IS_STRING) -> IS_CONST/IS_STRING */
+ } else if (Z_STRLEN(ZEND_OP2_LITERAL(init_opline)) == sizeof("dirname")-1 &&
+ !memcmp(Z_STRVAL(ZEND_OP2_LITERAL(init_opline)),
+ "dirname", sizeof("dirname") - 1) &&
+ !zend_optimizer_is_disabled_func("dirname", sizeof("dirname") - 1) &&
+ IS_ABSOLUTE_PATH(Z_STRVAL(ZEND_OP1_LITERAL(send1_opline)), Z_STRLEN(ZEND_OP1_LITERAL(send1_opline)))) {
+ zend_string *dirname = zend_string_init(Z_STRVAL(ZEND_OP1_LITERAL(send1_opline)), Z_STRLEN(ZEND_OP1_LITERAL(send1_opline)), 0);
+ ZSTR_LEN(dirname) = zend_dirname(ZSTR_VAL(dirname), ZSTR_LEN(dirname));
+ if (IS_ABSOLUTE_PATH(ZSTR_VAL(dirname), ZSTR_LEN(dirname))) {
+ zval t;
+
+ ZVAL_STR(&t, dirname);
+ literal_dtor(&ZEND_OP2_LITERAL(init_opline));
+ MAKE_NOP(init_opline);
+ literal_dtor(&ZEND_OP1_LITERAL(send1_opline));
+ MAKE_NOP(send1_opline);
+ if (zend_optimizer_replace_by_const(op_array, opline + 1, IS_VAR, opline->result.var, &t)) {
+ MAKE_NOP(opline);
+ } else {
+ opline->opcode = ZEND_QM_ASSIGN;
+ opline->extended_value = 0;
+ SET_UNUSED(opline->op2);
+ zend_optimizer_update_op1_const(op_array, opline, &t);
+ }
+ } else {
+ zend_string_release_ex(dirname, 0);
+ }
+ break;
+ }
+ }
+ /* don't colllect constants after any other function call */
+ collect_constants = 0;
+ break;
+ }
+ case ZEND_STRLEN:
+ if (opline->op1_type == IS_CONST) {
+ zval t;
+
+ if (zend_optimizer_eval_strlen(&t, &ZEND_OP1_LITERAL(opline)) == SUCCESS) {
+ literal_dtor(&ZEND_OP1_LITERAL(opline));
+ if (zend_optimizer_replace_by_const(op_array, opline + 1, IS_TMP_VAR, opline->result.var, &t)) {
+ MAKE_NOP(opline);
+ } else {
+ opline->opcode = ZEND_QM_ASSIGN;
+ zend_optimizer_update_op1_const(op_array, opline, &t);
+ }
+ }
+ }
+ break;
+ case ZEND_DEFINED:
+ {
+ zval c;
+ if (!zend_optimizer_get_persistent_constant(Z_STR(ZEND_OP1_LITERAL(opline)), &c, 0)) {
+ break;
+ }
+ ZVAL_TRUE(&c);
+ literal_dtor(&ZEND_OP1_LITERAL(opline));
+ if (zend_optimizer_replace_by_const(op_array, opline, IS_TMP_VAR, opline->result.var, &c)) {
+ MAKE_NOP(opline);
+ } else {
+ opline->opcode = ZEND_QM_ASSIGN;
+ zend_optimizer_update_op1_const(op_array, opline, &c);
+ }
+ }
+ break;
+ case ZEND_DECLARE_CONST:
+ if (collect_constants &&
+ Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_STRING &&
+ Z_TYPE(ZEND_OP2_LITERAL(opline)) <= IS_STRING) {
+ zend_optimizer_collect_constant(ctx, &ZEND_OP1_LITERAL(opline), &ZEND_OP2_LITERAL(opline));
+ }
+ break;
+#if 0
+ /* see ext/opcache/tests/bug78961.phpt */
+// case ZEND_FETCH_R:
+ case ZEND_FETCH_W:
+// case ZEND_FETCH_RW:
+ case ZEND_FETCH_IS:
+// case ZEND_FETCH_FUNC_ARG:
+ case ZEND_FETCH_UNSET:
+ /* convert FETCH $GLOBALS (global), FETCH_DIM $x into FETCH $x (global) */
+ if ((opline->extended_value & ZEND_FETCH_GLOBAL) != 0 &&
+ opline->op1_type == IS_CONST &&
+ Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_STRING &&
+ zend_string_equals_literal(Z_STR(ZEND_OP1_LITERAL(opline)), "GLOBALS") &&
+ ((opline + 1)->opcode == opline->opcode + 1 ||
+ ((opline + 1)->opcode == ZEND_UNSET_DIM &&
+ opline->opcode == ZEND_FETCH_UNSET) ||
+ ((opline + 1)->opcode == ZEND_ISSET_ISEMPTY_DIM_OBJ &&
+ opline->opcode == ZEND_FETCH_IS)) &&
+ (opline + 1)->op1_type == opline->result_type &&
+ (opline + 1)->op1.var == opline->result.var &&
+ ((opline + 1)->op2_type != IS_CONST ||
+ Z_TYPE(ZEND_OP2_LITERAL(opline + 1)) < IS_ARRAY)) {
+
+ if ((opline + 1)->opcode == ZEND_UNSET_DIM) {
+ (opline + 1)->opcode = ZEND_UNSET_VAR;
+ (opline + 1)->extended_value = ZEND_FETCH_GLOBAL;
+ } else if ((opline + 1)->opcode == ZEND_ISSET_ISEMPTY_DIM_OBJ) {
+ (opline + 1)->opcode = ZEND_ISSET_ISEMPTY_VAR;
+ (opline + 1)->extended_value |= ZEND_FETCH_GLOBAL;
+ } else {
+ (opline + 1)->opcode = opline->opcode;
+ (opline + 1)->extended_value = ZEND_FETCH_GLOBAL;
+ }
+ (opline + 1)->op1_type = (opline + 1)->op2_type;
+ (opline + 1)->op1 = (opline + 1)->op2;
+ if ((opline + 1)->op1_type == IS_CONST &&
+ Z_TYPE(ZEND_OP1_LITERAL(opline + 1)) != IS_STRING) {
+
+ convert_to_string(&ZEND_OP1_LITERAL(opline + 1));
+ zend_string_hash_val(Z_STR(ZEND_OP1_LITERAL(opline + 1)));
+ }
+ SET_UNUSED((opline + 1)->op2);
+ MAKE_NOP(opline);
+ }
+ break;
+#endif
+
+ case ZEND_JMPZ_EX:
+ case ZEND_JMPNZ_EX:
+ /* convert Ti = JMPZ_EX(C, L) => Ti = QM_ASSIGN(C)
+ in case we know it wouldn't jump */
+ if (opline->op1_type == IS_CONST) {
+ if (zend_is_true(&ZEND_OP1_LITERAL(opline))) {
+ if (opline->opcode == ZEND_JMPZ_EX) {
+ opline->opcode = ZEND_QM_ASSIGN;
+ zval_ptr_dtor_nogc(&ZEND_OP1_LITERAL(opline));
+ ZVAL_TRUE(&ZEND_OP1_LITERAL(opline));
+ opline->op2.num = 0;
+ break;
+ }
+ } else {
+ if (opline->opcode == ZEND_JMPNZ_EX) {
+ opline->opcode = ZEND_QM_ASSIGN;
+ zval_ptr_dtor_nogc(&ZEND_OP1_LITERAL(opline));
+ ZVAL_FALSE(&ZEND_OP1_LITERAL(opline));
+ opline->op2.num = 0;
+ break;
+ }
+ }
+ }
+ collect_constants = 0;
+ break;
+
+ case ZEND_JMPZ:
+ case ZEND_JMPNZ:
+ if (opline->op1_type == IS_CONST) {
+ int should_jmp = zend_is_true(&ZEND_OP1_LITERAL(opline));
+
+ if (opline->opcode == ZEND_JMPZ) {
+ should_jmp = !should_jmp;
+ }
+ literal_dtor(&ZEND_OP1_LITERAL(opline));
+ opline->op1_type = IS_UNUSED;
+ if (should_jmp) {
+ opline->opcode = ZEND_JMP;
+ COPY_NODE(opline->op1, opline->op2);
+ opline->op2.num = 0;
+ } else {
+ MAKE_NOP(opline);
+ break;
+ }
+ }
+ collect_constants = 0;
+ break;
+
+ case ZEND_JMPZNZ:
+ if (opline->op1_type == IS_CONST) {
+ zend_op *target_opline;
+
+ if (zend_is_true(&ZEND_OP1_LITERAL(opline))) {
+ target_opline = ZEND_OFFSET_TO_OPLINE(opline, opline->extended_value); /* JMPNZ */
+ } else {
+ target_opline = ZEND_OP2_JMP_ADDR(opline); /* JMPZ */
+ }
+ literal_dtor(&ZEND_OP1_LITERAL(opline));
+ ZEND_SET_OP_JMP_ADDR(opline, opline->op1, target_opline);
+ opline->op1_type = IS_UNUSED;
+ opline->opcode = ZEND_JMP;
+ }
+ collect_constants = 0;
+ break;
+
+ case ZEND_RETURN:
+ case ZEND_RETURN_BY_REF:
+ case ZEND_GENERATOR_RETURN:
+ case ZEND_EXIT:
+ case ZEND_THROW:
+ case ZEND_CATCH:
+ case ZEND_FAST_CALL:
+ case ZEND_FAST_RET:
+ case ZEND_JMP:
+ case ZEND_FE_RESET_R:
+ case ZEND_FE_RESET_RW:
+ case ZEND_FE_FETCH_R:
+ case ZEND_FE_FETCH_RW:
+ case ZEND_JMP_SET:
+ case ZEND_COALESCE:
+ case ZEND_ASSERT_CHECK:
+ collect_constants = 0;
+ break;
+ }
+ opline++;
+ }
+}
diff --git a/ext/opcache/Optimizer/pass1_5.c b/ext/opcache/Optimizer/pass1_5.c
deleted file mode 100644
index 8f41730114..0000000000
--- a/ext/opcache/Optimizer/pass1_5.c
+++ /dev/null
@@ -1,592 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend OPcache |
- +----------------------------------------------------------------------+
- | Copyright (c) The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@php.net> |
- | Zeev Suraski <zeev@php.net> |
- | Stanislav Malyshev <stas@zend.com> |
- | Dmitry Stogov <dmitry@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* pass 1
- * - substitute persistent constants (true, false, null, etc)
- * - perform compile-time evaluation of constant binary and unary operations
- * - convert CAST(IS_BOOL,x) into BOOL(x)
- * - pre-evaluate constant function calls
- * - eliminate FETCH $GLOBALS followed by FETCH_DIM/UNSET_DIM/ISSET_ISEMPTY_DIM
- */
-
-#include "php.h"
-#include "Optimizer/zend_optimizer.h"
-#include "Optimizer/zend_optimizer_internal.h"
-#include "zend_API.h"
-#include "zend_constants.h"
-#include "zend_execute.h"
-#include "zend_vm.h"
-
-void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx)
-{
- int i = 0;
- zend_op *opline = op_array->opcodes;
- zend_op *end = opline + op_array->last;
- zend_bool collect_constants = (ZEND_OPTIMIZER_PASS_15 & ctx->optimization_level)?
- (op_array == &ctx->script->main_op_array) : 0;
-
- while (opline < end) {
- switch (opline->opcode) {
- case ZEND_ADD:
- case ZEND_SUB:
- case ZEND_MUL:
- case ZEND_DIV:
- case ZEND_MOD:
- case ZEND_POW:
- case ZEND_SL:
- case ZEND_SR:
- case ZEND_CONCAT:
- case ZEND_FAST_CONCAT:
- case ZEND_IS_EQUAL:
- case ZEND_IS_NOT_EQUAL:
- case ZEND_IS_SMALLER:
- case ZEND_IS_SMALLER_OR_EQUAL:
- case ZEND_IS_IDENTICAL:
- case ZEND_IS_NOT_IDENTICAL:
- case ZEND_BW_OR:
- case ZEND_BW_AND:
- case ZEND_BW_XOR:
- case ZEND_BOOL_XOR:
- case ZEND_SPACESHIP:
- case ZEND_CASE:
- if (opline->op1_type == IS_CONST &&
- opline->op2_type == IS_CONST) {
- /* binary operation with constant operands */
- zval result;
-
- if (zend_optimizer_eval_binary_op(&result, opline->opcode, &ZEND_OP1_LITERAL(opline), &ZEND_OP2_LITERAL(opline)) == SUCCESS) {
- literal_dtor(&ZEND_OP1_LITERAL(opline));
- literal_dtor(&ZEND_OP2_LITERAL(opline));
- if (zend_optimizer_replace_by_const(op_array, opline + 1, IS_TMP_VAR, opline->result.var, &result)) {
- MAKE_NOP(opline);
- } else {
- opline->opcode = ZEND_QM_ASSIGN;
- SET_UNUSED(opline->op2);
- zend_optimizer_update_op1_const(op_array, opline, &result);
- }
- }
- }
- break;
-
- case ZEND_CAST:
- if (opline->op1_type == IS_CONST) {
- /* cast of constant operand */
- zval result;
-
- if (zend_optimizer_eval_cast(&result, opline->extended_value, &ZEND_OP1_LITERAL(opline)) == SUCCESS) {
- literal_dtor(&ZEND_OP1_LITERAL(opline));
- if (zend_optimizer_replace_by_const(op_array, opline + 1, opline->result_type, opline->result.var, &result)) {
- MAKE_NOP(opline);
- } else {
- opline->opcode = ZEND_QM_ASSIGN;
- opline->extended_value = 0;
- zend_optimizer_update_op1_const(op_array, opline, &result);
- }
- break;
- }
- }
-
- if (opline->extended_value == _IS_BOOL) {
- /* T = CAST(X, IS_BOOL) => T = BOOL(X) */
- opline->opcode = ZEND_BOOL;
- opline->extended_value = 0;
- }
- break;
-
- case ZEND_BW_NOT:
- case ZEND_BOOL_NOT:
- if (opline->op1_type == IS_CONST) {
- /* unary operation on constant operand */
- zval result;
-
- if (zend_optimizer_eval_unary_op(&result, opline->opcode, &ZEND_OP1_LITERAL(opline)) == SUCCESS) {
- literal_dtor(&ZEND_OP1_LITERAL(opline));
- if (zend_optimizer_replace_by_const(op_array, opline + 1, IS_TMP_VAR, opline->result.var, &result)) {
- MAKE_NOP(opline);
- } else {
- opline->opcode = ZEND_QM_ASSIGN;
- zend_optimizer_update_op1_const(op_array, opline, &result);
- }
- }
- }
- break;
-
- case ZEND_FETCH_CONSTANT:
- if (opline->op2_type == IS_CONST &&
- Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING &&
- Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("__COMPILER_HALT_OFFSET__") - 1 &&
- memcmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)), "__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__") - 1) == 0) {
- /* substitute __COMPILER_HALT_OFFSET__ constant */
- zend_execute_data *orig_execute_data = EG(current_execute_data);
- zend_execute_data fake_execute_data;
- zval *offset;
-
- memset(&fake_execute_data, 0, sizeof(zend_execute_data));
- fake_execute_data.func = (zend_function*)op_array;
- EG(current_execute_data) = &fake_execute_data;
- if ((offset = zend_get_constant_str("__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__") - 1)) != NULL) {
-
- literal_dtor(&ZEND_OP2_LITERAL(opline));
- if (zend_optimizer_replace_by_const(op_array, opline, IS_TMP_VAR, opline->result.var, offset)) {
- MAKE_NOP(opline);
- } else {
- opline->opcode = ZEND_QM_ASSIGN;
- opline->extended_value = 0;
- SET_UNUSED(opline->op2);
- zend_optimizer_update_op1_const(op_array, opline, offset);
- }
- }
- EG(current_execute_data) = orig_execute_data;
- break;
- }
-
- if (opline->op2_type == IS_CONST &&
- Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING) {
- /* substitute persistent constants */
- zval c;
-
- if (!zend_optimizer_get_persistent_constant(Z_STR(ZEND_OP2_LITERAL(opline)), &c, 1)) {
- if (!ctx->constants || !zend_optimizer_get_collected_constant(ctx->constants, &ZEND_OP2_LITERAL(opline), &c)) {
- break;
- }
- }
- if (Z_TYPE(c) == IS_CONSTANT_AST) {
- break;
- }
- literal_dtor(&ZEND_OP2_LITERAL(opline));
- if (zend_optimizer_replace_by_const(op_array, opline, IS_TMP_VAR, opline->result.var, &c)) {
- MAKE_NOP(opline);
- } else {
- opline->opcode = ZEND_QM_ASSIGN;
- opline->extended_value = 0;
- SET_UNUSED(opline->op2);
- zend_optimizer_update_op1_const(op_array, opline, &c);
- }
- }
- break;
-
- case ZEND_FETCH_CLASS_CONSTANT:
- if (opline->op2_type == IS_CONST &&
- Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING) {
-
- zend_class_entry *ce = NULL;
-
- if (opline->op1_type == IS_CONST &&
- Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_STRING) {
- /* for A::B */
- if (op_array->scope &&
- !strncasecmp(Z_STRVAL(ZEND_OP1_LITERAL(opline)),
- ZSTR_VAL(op_array->scope->name), Z_STRLEN(ZEND_OP1_LITERAL(opline)) + 1)) {
- ce = op_array->scope;
- } else {
- if ((ce = zend_hash_find_ptr(EG(class_table),
- Z_STR(op_array->literals[opline->op1.constant + 1]))) == NULL ||
- (ce->type == ZEND_INTERNAL_CLASS &&
- ce->info.internal.module->type != MODULE_PERSISTENT) ||
- (ce->type == ZEND_USER_CLASS &&
- ce->info.user.filename != op_array->filename)) {
- break;
- }
- }
- } else if (op_array->scope &&
- opline->op1_type == IS_UNUSED &&
- (opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_SELF) {
- /* for self::B */
- ce = op_array->scope;
- } else if (op_array->scope &&
- opline->op1_type == IS_VAR &&
- (opline - 1)->opcode == ZEND_FETCH_CLASS &&
- ((opline - 1)->op2_type == IS_UNUSED &&
- ((opline - 1)->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_SELF) &&
- (opline - 1)->result.var == opline->op1.var) {
- /* for self::B */
- ce = op_array->scope;
- }
-
- if (ce) {
- zend_class_constant *cc;
- zval *c, t;
-
- if ((cc = zend_hash_find_ptr(&ce->constants_table,
- Z_STR(ZEND_OP2_LITERAL(opline)))) != NULL &&
- (Z_ACCESS_FLAGS(cc->value) & ZEND_ACC_PPP_MASK) == ZEND_ACC_PUBLIC) {
- c = &cc->value;
- if (Z_TYPE_P(c) == IS_CONSTANT_AST) {
- zend_ast *ast = Z_ASTVAL_P(c);
- if (ast->kind != ZEND_AST_CONSTANT
- || !zend_optimizer_get_persistent_constant(zend_ast_get_constant_name(ast), &t, 1)
- || Z_TYPE(t) == IS_CONSTANT_AST) {
- break;
- }
- } else {
- ZVAL_COPY_OR_DUP(&t, c);
- }
-
- if (opline->op1_type == IS_CONST) {
- literal_dtor(&ZEND_OP1_LITERAL(opline));
- } else if (opline->op1_type == IS_VAR) {
- MAKE_NOP((opline - 1));
- }
- literal_dtor(&ZEND_OP2_LITERAL(opline));
-
- if (zend_optimizer_replace_by_const(op_array, opline, IS_TMP_VAR, opline->result.var, &t)) {
- MAKE_NOP(opline);
- } else {
- opline->opcode = ZEND_QM_ASSIGN;
- opline->extended_value = 0;
- SET_UNUSED(opline->op2);
- zend_optimizer_update_op1_const(op_array, opline, &t);
- }
- }
- }
- }
- break;
-
- case ZEND_DO_ICALL: {
- zend_op *send1_opline = opline - 1;
- zend_op *send2_opline = NULL;
- zend_op *init_opline = NULL;
-
- while (send1_opline->opcode == ZEND_NOP) {
- send1_opline--;
- }
- if (send1_opline->opcode != ZEND_SEND_VAL ||
- send1_opline->op1_type != IS_CONST) {
- /* don't colllect constants after unknown function call */
- collect_constants = 0;
- break;
- }
- if (send1_opline->op2.num == 2) {
- send2_opline = send1_opline;
- send1_opline--;
- while (send1_opline->opcode == ZEND_NOP) {
- send1_opline--;
- }
- if (send1_opline->opcode != ZEND_SEND_VAL ||
- send1_opline->op1_type != IS_CONST) {
- /* don't colllect constants after unknown function call */
- collect_constants = 0;
- break;
- }
- }
- init_opline = send1_opline - 1;
- while (init_opline->opcode == ZEND_NOP) {
- init_opline--;
- }
- if (init_opline->opcode != ZEND_INIT_FCALL ||
- init_opline->op2_type != IS_CONST ||
- Z_TYPE(ZEND_OP2_LITERAL(init_opline)) != IS_STRING) {
- /* don't colllect constants after unknown function call */
- collect_constants = 0;
- break;
- }
-
- /* define("name", scalar); */
- if (Z_STRLEN(ZEND_OP2_LITERAL(init_opline)) == sizeof("define")-1 &&
- zend_binary_strcasecmp(Z_STRVAL(ZEND_OP2_LITERAL(init_opline)), Z_STRLEN(ZEND_OP2_LITERAL(init_opline)), "define", sizeof("define")-1) == 0) {
-
- if (Z_TYPE(ZEND_OP1_LITERAL(send1_opline)) == IS_STRING &&
- send2_opline &&
- Z_TYPE(ZEND_OP1_LITERAL(send2_opline)) <= IS_STRING) {
-
- if (collect_constants) {
- zend_optimizer_collect_constant(ctx, &ZEND_OP1_LITERAL(send1_opline), &ZEND_OP1_LITERAL(send2_opline));
- }
-
- if (RESULT_UNUSED(opline) &&
- !zend_memnstr(Z_STRVAL(ZEND_OP1_LITERAL(send1_opline)), "::", sizeof("::") - 1, Z_STRVAL(ZEND_OP1_LITERAL(send1_opline)) + Z_STRLEN(ZEND_OP1_LITERAL(send1_opline)))) {
-
- opline->opcode = ZEND_DECLARE_CONST;
- opline->op1_type = IS_CONST;
- opline->op2_type = IS_CONST;
- opline->result_type = IS_UNUSED;
- opline->op1.constant = send1_opline->op1.constant;
- opline->op2.constant = send2_opline->op1.constant;
- opline->result.num = 0;
-
- literal_dtor(&ZEND_OP2_LITERAL(init_opline));
- MAKE_NOP(init_opline);
- MAKE_NOP(send1_opline);
- MAKE_NOP(send2_opline);
- }
- break;
- }
- }
-
- /* pre-evaluate constant functions:
- constant(x)
- function_exists(x)
- is_callable(x)
- extension_loaded(x)
- */
- if (!send2_opline &&
- Z_TYPE(ZEND_OP1_LITERAL(send1_opline)) == IS_STRING) {
- if ((Z_STRLEN(ZEND_OP2_LITERAL(init_opline)) == sizeof("function_exists")-1 &&
- !memcmp(Z_STRVAL(ZEND_OP2_LITERAL(init_opline)),
- "function_exists", sizeof("function_exists")-1) &&
- !zend_optimizer_is_disabled_func("function_exists", sizeof("function_exists") - 1)) ||
- (Z_STRLEN(ZEND_OP2_LITERAL(init_opline)) == sizeof("is_callable")-1 &&
- !memcmp(Z_STRVAL(ZEND_OP2_LITERAL(init_opline)),
- "is_callable", sizeof("is_callable")) &&
- !zend_optimizer_is_disabled_func("is_callable", sizeof("is_callable") - 1))) {
- zend_internal_function *func;
- zend_string *lc_name = zend_string_tolower(
- Z_STR(ZEND_OP1_LITERAL(send1_opline)));
-
- if ((func = zend_hash_find_ptr(EG(function_table), lc_name)) != NULL
- && func->type == ZEND_INTERNAL_FUNCTION
- && func->module->type == MODULE_PERSISTENT
-#ifdef ZEND_WIN32
- && func->module->handle == NULL
-#endif
- ) {
- zval t;
- if (Z_STRLEN(ZEND_OP2_LITERAL(init_opline)) == sizeof("is_callable") - 1 ||
- func->handler != ZEND_FN(display_disabled_function)) {
- ZVAL_TRUE(&t);
- } else {
- ZVAL_FALSE(&t);
- }
- literal_dtor(&ZEND_OP2_LITERAL(init_opline));
- MAKE_NOP(init_opline);
- literal_dtor(&ZEND_OP1_LITERAL(send1_opline));
- MAKE_NOP(send1_opline);
- if (zend_optimizer_replace_by_const(op_array, opline + 1, IS_VAR, opline->result.var, &t)) {
- MAKE_NOP(opline);
- } else {
- opline->opcode = ZEND_QM_ASSIGN;
- opline->extended_value = 0;
- SET_UNUSED(opline->op2);
- zend_optimizer_update_op1_const(op_array, opline, &t);
- }
- }
- zend_string_release_ex(lc_name, 0);
- break;
- } else if (Z_STRLEN(ZEND_OP2_LITERAL(init_opline)) == sizeof("extension_loaded")-1 &&
- !memcmp(Z_STRVAL(ZEND_OP2_LITERAL(init_opline)),
- "extension_loaded", sizeof("extension_loaded")-1) &&
- !zend_optimizer_is_disabled_func("extension_loaded", sizeof("extension_loaded") - 1)) {
- zval t;
- zend_string *lc_name = zend_string_tolower(
- Z_STR(ZEND_OP1_LITERAL(send1_opline)));
- zend_module_entry *m = zend_hash_find_ptr(&module_registry,
- lc_name);
-
- zend_string_release_ex(lc_name, 0);
- if (!m) {
- if (PG(enable_dl)) {
- break;
- } else {
- ZVAL_FALSE(&t);
- }
- } else {
- if (m->type == MODULE_PERSISTENT
-#ifdef ZEND_WIN32
- && m->handle == NULL
-#endif
- ) {
- ZVAL_TRUE(&t);
- } else {
- break;
- }
- }
-
- literal_dtor(&ZEND_OP2_LITERAL(init_opline));
- MAKE_NOP(init_opline);
- literal_dtor(&ZEND_OP1_LITERAL(send1_opline));
- MAKE_NOP(send1_opline);
- if (zend_optimizer_replace_by_const(op_array, opline + 1, IS_VAR, opline->result.var, &t)) {
- MAKE_NOP(opline);
- } else {
- opline->opcode = ZEND_QM_ASSIGN;
- opline->extended_value = 0;
- SET_UNUSED(opline->op2);
- zend_optimizer_update_op1_const(op_array, opline, &t);
- }
- break;
- } else if (Z_STRLEN(ZEND_OP2_LITERAL(init_opline)) == sizeof("constant")-1 &&
- !memcmp(Z_STRVAL(ZEND_OP2_LITERAL(init_opline)),
- "constant", sizeof("constant")-1) &&
- !zend_optimizer_is_disabled_func("constant", sizeof("constant") - 1)) {
- zval t;
-
- if (zend_optimizer_get_persistent_constant(Z_STR(ZEND_OP1_LITERAL(send1_opline)), &t, 1)) {
- literal_dtor(&ZEND_OP2_LITERAL(init_opline));
- MAKE_NOP(init_opline);
- literal_dtor(&ZEND_OP1_LITERAL(send1_opline));
- MAKE_NOP(send1_opline);
- if (zend_optimizer_replace_by_const(op_array, opline + 1, IS_VAR, opline->result.var, &t)) {
- MAKE_NOP(opline);
- } else {
- opline->opcode = ZEND_QM_ASSIGN;
- opline->extended_value = 0;
- SET_UNUSED(opline->op2);
- zend_optimizer_update_op1_const(op_array, opline, &t);
- }
- }
- break;
- /* dirname(IS_CONST/IS_STRING) -> IS_CONST/IS_STRING */
- } else if (Z_STRLEN(ZEND_OP2_LITERAL(init_opline)) == sizeof("dirname")-1 &&
- !memcmp(Z_STRVAL(ZEND_OP2_LITERAL(init_opline)),
- "dirname", sizeof("dirname") - 1) &&
- !zend_optimizer_is_disabled_func("dirname", sizeof("dirname") - 1) &&
- IS_ABSOLUTE_PATH(Z_STRVAL(ZEND_OP1_LITERAL(send1_opline)), Z_STRLEN(ZEND_OP1_LITERAL(send1_opline)))) {
- zend_string *dirname = zend_string_init(Z_STRVAL(ZEND_OP1_LITERAL(send1_opline)), Z_STRLEN(ZEND_OP1_LITERAL(send1_opline)), 0);
- ZSTR_LEN(dirname) = zend_dirname(ZSTR_VAL(dirname), ZSTR_LEN(dirname));
- if (IS_ABSOLUTE_PATH(ZSTR_VAL(dirname), ZSTR_LEN(dirname))) {
- zval t;
-
- ZVAL_STR(&t, dirname);
- literal_dtor(&ZEND_OP2_LITERAL(init_opline));
- MAKE_NOP(init_opline);
- literal_dtor(&ZEND_OP1_LITERAL(send1_opline));
- MAKE_NOP(send1_opline);
- if (zend_optimizer_replace_by_const(op_array, opline + 1, IS_VAR, opline->result.var, &t)) {
- MAKE_NOP(opline);
- } else {
- opline->opcode = ZEND_QM_ASSIGN;
- opline->extended_value = 0;
- SET_UNUSED(opline->op2);
- zend_optimizer_update_op1_const(op_array, opline, &t);
- }
- } else {
- zend_string_release_ex(dirname, 0);
- }
- break;
- }
- }
- /* don't colllect constants after any other function call */
- collect_constants = 0;
- break;
- }
- case ZEND_STRLEN:
- if (opline->op1_type == IS_CONST) {
- zval t;
-
- if (zend_optimizer_eval_strlen(&t, &ZEND_OP1_LITERAL(opline)) == SUCCESS) {
- literal_dtor(&ZEND_OP1_LITERAL(opline));
- if (zend_optimizer_replace_by_const(op_array, opline + 1, IS_TMP_VAR, opline->result.var, &t)) {
- MAKE_NOP(opline);
- } else {
- opline->opcode = ZEND_QM_ASSIGN;
- zend_optimizer_update_op1_const(op_array, opline, &t);
- }
- }
- }
- break;
- case ZEND_DEFINED:
- {
- zval c;
- if (!zend_optimizer_get_persistent_constant(Z_STR(ZEND_OP1_LITERAL(opline)), &c, 0)) {
- break;
- }
- ZVAL_TRUE(&c);
- literal_dtor(&ZEND_OP1_LITERAL(opline));
- if (zend_optimizer_replace_by_const(op_array, opline, IS_TMP_VAR, opline->result.var, &c)) {
- MAKE_NOP(opline);
- } else {
- opline->opcode = ZEND_QM_ASSIGN;
- zend_optimizer_update_op1_const(op_array, opline, &c);
- }
- }
- break;
- case ZEND_DECLARE_CONST:
- if (collect_constants &&
- Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_STRING &&
- Z_TYPE(ZEND_OP2_LITERAL(opline)) <= IS_STRING) {
- zend_optimizer_collect_constant(ctx, &ZEND_OP1_LITERAL(opline), &ZEND_OP2_LITERAL(opline));
- }
- break;
-#if 0
- /* see ext/opcache/tests/bug78961.phpt */
-// case ZEND_FETCH_R:
- case ZEND_FETCH_W:
-// case ZEND_FETCH_RW:
- case ZEND_FETCH_IS:
-// case ZEND_FETCH_FUNC_ARG:
- case ZEND_FETCH_UNSET:
- /* convert FETCH $GLOBALS (global), FETCH_DIM $x into FETCH $x (global) */
- if ((opline->extended_value & ZEND_FETCH_GLOBAL) != 0 &&
- opline->op1_type == IS_CONST &&
- Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_STRING &&
- zend_string_equals_literal(Z_STR(ZEND_OP1_LITERAL(opline)), "GLOBALS") &&
- ((opline + 1)->opcode == opline->opcode + 1 ||
- ((opline + 1)->opcode == ZEND_UNSET_DIM &&
- opline->opcode == ZEND_FETCH_UNSET) ||
- ((opline + 1)->opcode == ZEND_ISSET_ISEMPTY_DIM_OBJ &&
- opline->opcode == ZEND_FETCH_IS)) &&
- (opline + 1)->op1_type == opline->result_type &&
- (opline + 1)->op1.var == opline->result.var &&
- ((opline + 1)->op2_type != IS_CONST ||
- Z_TYPE(ZEND_OP2_LITERAL(opline + 1)) < IS_ARRAY)) {
-
- if ((opline + 1)->opcode == ZEND_UNSET_DIM) {
- (opline + 1)->opcode = ZEND_UNSET_VAR;
- (opline + 1)->extended_value = ZEND_FETCH_GLOBAL;
- } else if ((opline + 1)->opcode == ZEND_ISSET_ISEMPTY_DIM_OBJ) {
- (opline + 1)->opcode = ZEND_ISSET_ISEMPTY_VAR;
- (opline + 1)->extended_value |= ZEND_FETCH_GLOBAL;
- } else {
- (opline + 1)->opcode = opline->opcode;
- (opline + 1)->extended_value = ZEND_FETCH_GLOBAL;
- }
- (opline + 1)->op1_type = (opline + 1)->op2_type;
- (opline + 1)->op1 = (opline + 1)->op2;
- if ((opline + 1)->op1_type == IS_CONST &&
- Z_TYPE(ZEND_OP1_LITERAL(opline + 1)) != IS_STRING) {
-
- convert_to_string(&ZEND_OP1_LITERAL(opline + 1));
- zend_string_hash_val(Z_STR(ZEND_OP1_LITERAL(opline + 1)));
- }
- SET_UNUSED((opline + 1)->op2);
- MAKE_NOP(opline);
- }
- break;
-#endif
-
- case ZEND_RETURN:
- case ZEND_RETURN_BY_REF:
- case ZEND_GENERATOR_RETURN:
- case ZEND_EXIT:
- case ZEND_THROW:
- case ZEND_CATCH:
- case ZEND_FAST_CALL:
- case ZEND_FAST_RET:
- case ZEND_JMP:
- case ZEND_JMPZNZ:
- case ZEND_JMPZ:
- case ZEND_JMPNZ:
- case ZEND_JMPZ_EX:
- case ZEND_JMPNZ_EX:
- case ZEND_FE_RESET_R:
- case ZEND_FE_RESET_RW:
- case ZEND_FE_FETCH_R:
- case ZEND_FE_FETCH_RW:
- case ZEND_JMP_SET:
- case ZEND_COALESCE:
- case ZEND_ASSERT_CHECK:
- collect_constants = 0;
- break;
- }
- opline++;
- i++;
- }
-}
diff --git a/ext/opcache/Optimizer/pass2.c b/ext/opcache/Optimizer/pass2.c
deleted file mode 100644
index 01e118e7e3..0000000000
--- a/ext/opcache/Optimizer/pass2.c
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend OPcache |
- +----------------------------------------------------------------------+
- | Copyright (c) The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@php.net> |
- | Zeev Suraski <zeev@php.net> |
- | Stanislav Malyshev <stas@zend.com> |
- | Dmitry Stogov <dmitry@php.net> |
- +----------------------------------------------------------------------+
-*/
-
-/* pass 2:
- * - convert non-numeric constants to numeric constants in numeric operators
- * - optimize constant conditional JMPs
- */
-
-#include "php.h"
-#include "Optimizer/zend_optimizer.h"
-#include "Optimizer/zend_optimizer_internal.h"
-#include "zend_API.h"
-#include "zend_constants.h"
-#include "zend_execute.h"
-#include "zend_vm.h"
-
-void zend_optimizer_pass2(zend_op_array *op_array)
-{
- zend_op *opline;
- zend_op *end = op_array->opcodes + op_array->last;
-
- opline = op_array->opcodes;
- while (opline < end) {
- switch (opline->opcode) {
- case ZEND_ADD:
- case ZEND_SUB:
- case ZEND_MUL:
- case ZEND_DIV:
- case ZEND_POW:
- if (opline->op1_type == IS_CONST) {
- if (Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_STRING) {
- /* don't optimise if it should produce a runtime numeric string error */
- if (is_numeric_string(Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline)), NULL, NULL, 0)) {
- convert_scalar_to_number(&ZEND_OP1_LITERAL(opline));
- }
- }
- }
- if (opline->op2_type == IS_CONST) {
- if (Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING) {
- /* don't optimise if it should produce a runtime numeric string error */
- if (is_numeric_string(Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline)), NULL, NULL, 0)) {
- convert_scalar_to_number(&ZEND_OP2_LITERAL(opline));
- }
- }
- }
- break;
-
- case ZEND_MOD:
- case ZEND_SL:
- case ZEND_SR:
- if (opline->op1_type == IS_CONST) {
- if (Z_TYPE(ZEND_OP1_LITERAL(opline)) != IS_LONG) {
- /* don't optimise if it should produce a runtime numeric string error */
- if (!(Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_STRING
- && !is_numeric_string(Z_STRVAL(ZEND_OP1_LITERAL(opline)), Z_STRLEN(ZEND_OP1_LITERAL(opline)), NULL, NULL, 0))) {
- convert_to_long(&ZEND_OP1_LITERAL(opline));
- }
- }
- }
- if (opline->op2_type == IS_CONST) {
- if (Z_TYPE(ZEND_OP2_LITERAL(opline)) != IS_LONG) {
- /* don't optimise if it should produce a runtime numeric string error */
- if (!(Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING
- && !is_numeric_string(Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline)), NULL, NULL, 0))) {
- convert_to_long(&ZEND_OP2_LITERAL(opline));
- }
- }
- }
- break;
-
- case ZEND_CONCAT:
- case ZEND_FAST_CONCAT:
- if (opline->op1_type == IS_CONST) {
- if (Z_TYPE(ZEND_OP1_LITERAL(opline)) != IS_STRING) {
- convert_to_string(&ZEND_OP1_LITERAL(opline));
- }
- }
- if (opline->op2_type == IS_CONST) {
- if (Z_TYPE(ZEND_OP2_LITERAL(opline)) != IS_STRING) {
- convert_to_string(&ZEND_OP2_LITERAL(opline));
- }
- }
- break;
-
- case ZEND_ASSIGN_OP:
- if (opline->op2_type == IS_CONST) {
- if (opline->extended_value == ZEND_ADD
- || opline->extended_value == ZEND_SUB
- || opline->extended_value == ZEND_MUL
- || opline->extended_value == ZEND_DIV
- || opline->extended_value == ZEND_POW) {
- if (Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING) {
- /* don't optimise if it should produce a runtime numeric string error */
- if (is_numeric_string(Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline)), NULL, NULL, 0)) {
- convert_scalar_to_number(&ZEND_OP2_LITERAL(opline));
- }
- }
- } else if (opline->extended_value == ZEND_MOD
- || opline->extended_value == ZEND_SL
- || opline->extended_value == ZEND_SR) {
- if (Z_TYPE(ZEND_OP2_LITERAL(opline)) != IS_LONG) {
- /* don't optimise if it should produce a runtime numeric string error */
- if (!(Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING
- && !is_numeric_string(Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline)), NULL, NULL, 0))) {
- convert_to_long(&ZEND_OP2_LITERAL(opline));
- }
- }
- } else if (opline->extended_value == ZEND_CONCAT) {
- if (Z_TYPE(ZEND_OP2_LITERAL(opline)) != IS_STRING) {
- convert_to_string(&ZEND_OP2_LITERAL(opline));
- }
- }
- }
- break;
-
- case ZEND_JMPZ_EX:
- case ZEND_JMPNZ_EX:
- /* convert Ti = JMPZ_EX(Ti, L) to JMPZ(Ti, L) */
-#if 0
- /* Disabled unsafe pattern: in conjunction with
- * ZEND_VM_SMART_BRANCH() this may improperly eliminate
- * assignment to Ti.
- */
- if (opline->op1_type == IS_TMP_VAR &&
- opline->result_type == IS_TMP_VAR &&
- opline->op1.var == opline->result.var) {
- opline->opcode -= 3;
- SET_UNUSED(opline->result);
- } else
-#endif
- /* convert Ti = JMPZ_EX(C, L) => Ti = QM_ASSIGN(C)
- in case we know it wouldn't jump */
- if (opline->op1_type == IS_CONST) {
- int should_jmp = zend_is_true(&ZEND_OP1_LITERAL(opline));
- if (opline->opcode == ZEND_JMPZ_EX) {
- should_jmp = !should_jmp;
- }
- if (!should_jmp) {
- opline->opcode = ZEND_QM_ASSIGN;
- SET_UNUSED(opline->op2);
- }
- }
- break;
-
- case ZEND_JMPZ:
- case ZEND_JMPNZ:
- if (opline->op1_type == IS_CONST) {
- int should_jmp = zend_is_true(&ZEND_OP1_LITERAL(opline));
-
- if (opline->opcode == ZEND_JMPZ) {
- should_jmp = !should_jmp;
- }
- literal_dtor(&ZEND_OP1_LITERAL(opline));
- opline->op1_type = IS_UNUSED;
- if (should_jmp) {
- opline->opcode = ZEND_JMP;
- COPY_NODE(opline->op1, opline->op2);
- } else {
- MAKE_NOP(opline);
- }
- break;
- }
- if ((opline + 1)->opcode == ZEND_JMP) {
- /* JMPZ(X, L1), JMP(L2) => JMPZNZ(X, L1, L2) */
- /* JMPNZ(X, L1), JMP(L2) => JMPZNZ(X, L2, L1) */
- if (ZEND_OP2_JMP_ADDR(opline) == ZEND_OP1_JMP_ADDR(opline + 1)) {
- /* JMPZ(X, L1), JMP(L1) => NOP, JMP(L1) */
- if (opline->op1_type == IS_CV) {
- opline->opcode = ZEND_CHECK_VAR;
- opline->op2.num = 0;
- } else if (opline->op1_type & (IS_TMP_VAR|IS_VAR)) {
- opline->opcode = ZEND_FREE;
- opline->op2.num = 0;
- } else {
- MAKE_NOP(opline);
- }
- } else {
- if (opline->opcode == ZEND_JMPZ) {
- opline->extended_value = ZEND_OPLINE_TO_OFFSET(opline, ZEND_OP1_JMP_ADDR(opline + 1));
- } else {
- opline->extended_value = ZEND_OPLINE_TO_OFFSET(opline, ZEND_OP2_JMP_ADDR(opline));
- ZEND_SET_OP_JMP_ADDR(opline, opline->op2, ZEND_OP1_JMP_ADDR(opline + 1));
- }
- opline->opcode = ZEND_JMPZNZ;
- }
- }
- break;
-
- case ZEND_JMPZNZ:
- if (opline->op1_type == IS_CONST) {
- zend_op *target_opline;
-
- if (zend_is_true(&ZEND_OP1_LITERAL(opline))) {
- target_opline = ZEND_OFFSET_TO_OPLINE(opline, opline->extended_value); /* JMPNZ */
- } else {
- target_opline = ZEND_OP2_JMP_ADDR(opline); /* JMPZ */
- }
- literal_dtor(&ZEND_OP1_LITERAL(opline));
- ZEND_SET_OP_JMP_ADDR(opline, opline->op1, target_opline);
- opline->op1_type = IS_UNUSED;
- opline->opcode = ZEND_JMP;
- }
- break;
- }
- opline++;
- }
-}
diff --git a/ext/opcache/Optimizer/pass3.c b/ext/opcache/Optimizer/pass3.c
index 5bbb2b0854..f98c41848c 100644
--- a/ext/opcache/Optimizer/pass3.c
+++ b/ext/opcache/Optimizer/pass3.c
@@ -19,10 +19,8 @@
+----------------------------------------------------------------------+
*/
-/* pass 3:
- * - optimize $i = $i+expr to $i+=expr
+/* pass 3: (Jump optimization)
* - optimize series of JMPs
- * - change $i++ to ++$i where possible
*/
#include "php.h"
@@ -34,388 +32,325 @@
#include "zend_vm.h"
/* we use "jmp_hitlist" to avoid infinity loops during jmp optimization */
-#define CHECK_JMP(target, label) \
- for (i=0; i<jmp_hitlist_count; i++) { \
- if (jmp_hitlist[i] == ZEND_OP1_JMP_ADDR(target)) { \
- goto label; \
- } \
- } \
- jmp_hitlist[jmp_hitlist_count++] = ZEND_OP1_JMP_ADDR(target);
+static zend_always_inline int in_hitlist(zend_op *target, zend_op **jmp_hitlist, int jmp_hitlist_count)
+{
+ int i;
-#define CHECK_JMP2(target, label) \
- for (i=0; i<jmp_hitlist_count; i++) { \
- if (jmp_hitlist[i] == ZEND_OP2_JMP_ADDR(target)) { \
- goto label; \
- } \
- } \
- jmp_hitlist[jmp_hitlist_count++] = ZEND_OP2_JMP_ADDR(target);
+ for (i = 0; i < jmp_hitlist_count; i++) {
+ if (jmp_hitlist[i] == target) {
+ return 1;
+ }
+ }
+ return 0;
+}
+
+#define CHECK_LOOP(target) \
+ if (EXPECTED(!in_hitlist(target, jmp_hitlist, jmp_hitlist_count))) { \
+ jmp_hitlist[jmp_hitlist_count++] = target; \
+ } else { \
+ break; \
+ }
void zend_optimizer_pass3(zend_op_array *op_array, zend_optimizer_ctx *ctx)
{
zend_op *opline;
- zend_op *end = op_array->opcodes + op_array->last;
+ zend_op *end;
+ zend_op *target;
zend_op **jmp_hitlist;
int jmp_hitlist_count;
- int i;
- uint32_t opline_num = 0;
ALLOCA_FLAG(use_heap);
jmp_hitlist = (zend_op**)do_alloca(sizeof(zend_op*)*op_array->last, use_heap);
opline = op_array->opcodes;
+ end = opline + op_array->last;
while (opline < end) {
- jmp_hitlist_count = 0;
switch (opline->opcode) {
- case ZEND_ADD:
- case ZEND_SUB:
- case ZEND_MUL:
- case ZEND_DIV:
- case ZEND_MOD:
- case ZEND_POW:
- case ZEND_CONCAT:
- case ZEND_SL:
- case ZEND_SR:
- case ZEND_BW_OR:
- case ZEND_BW_AND:
- case ZEND_BW_XOR:
- {
- zend_op *next_opline = opline + 1;
-
- while (next_opline < end && next_opline->opcode == ZEND_NOP) {
- ++next_opline;
- }
+ case ZEND_JMP:
+ jmp_hitlist_count = 0;
- if (next_opline >= end || next_opline->opcode != ZEND_ASSIGN) {
+ target = ZEND_OP1_JMP_ADDR(opline);
+ while (1) {
+ if (target->opcode == ZEND_JMP) {
+ /* convert JMP L1 ... L1: JMP L2 to JMP L2 .. L1: JMP L2 */
+ target = ZEND_OP1_JMP_ADDR(target);
+ CHECK_LOOP(target);
+ } else if (target->opcode == ZEND_NOP) {
+ target = target + 1;
+ } else {
break;
}
-
- /* change $i=expr+$i to $i=$i+expr so that the following optimization
- * works on it. Only do this if we are ignoring operator overloading,
- * as operand order might be significant otherwise. */
- if ((ctx->optimization_level & ZEND_OPTIMIZER_IGNORE_OVERLOADING)
- && (opline->op2_type & (IS_VAR | IS_CV))
- && opline->op2.var == next_opline->op1.var &&
- (opline->opcode == ZEND_ADD ||
- opline->opcode == ZEND_MUL ||
- opline->opcode == ZEND_BW_OR ||
- opline->opcode == ZEND_BW_AND ||
- opline->opcode == ZEND_BW_XOR)) {
- zend_uchar tmp_type = opline->op1_type;
- znode_op tmp = opline->op1;
-
- if (opline->opcode != ZEND_ADD
- || (opline->op1_type == IS_CONST
- && Z_TYPE(ZEND_OP1_LITERAL(opline)) != IS_ARRAY)) {
- /* protection from array add: $a = array + $a is not commutative! */
- COPY_NODE(opline->op1, opline->op2);
- COPY_NODE(opline->op2, tmp);
- }
- }
-
- if (ZEND_IS_BINARY_ASSIGN_OP_OPCODE(opline->opcode)
- && (opline->op1_type & (IS_VAR | IS_CV))
- && opline->op1.var == next_opline->op1.var
- && opline->op1_type == next_opline->op1_type) {
- opline->extended_value = opline->opcode;
- opline->opcode = ZEND_ASSIGN_OP;
- COPY_NODE(opline->result, next_opline->result);
- MAKE_NOP(next_opline);
- opline++;
- opline_num++;
- }
+ ZEND_SET_OP_JMP_ADDR(opline, opline->op1, target);
}
- break;
- case ZEND_JMP:
- if (op_array->fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK) {
- break;
- }
-
- /* convert L: JMP L+1 to NOP */
- if (ZEND_OP1_JMP_ADDR(opline) == opline + 1) {
+ if (target == opline + 1) {
+ /* convert L: JMP L+1 to NOP */
MAKE_NOP(opline);
- goto done_jmp_optimization;
- }
-
- /* convert JMP L1 ... L1: JMP L2 to JMP L2 .. L1: JMP L2 */
- while (ZEND_OP1_JMP_ADDR(opline) < end
- && ZEND_OP1_JMP_ADDR(opline)->opcode == ZEND_JMP) {
- zend_op *target = ZEND_OP1_JMP_ADDR(opline);
- CHECK_JMP(target, done_jmp_optimization);
- ZEND_SET_OP_JMP_ADDR(opline, opline->op1, ZEND_OP1_JMP_ADDR(target));
+ } else if (target->opcode == ZEND_JMPZNZ) {
+ /* JMP L, L: JMPZNZ L1,L2 -> JMPZNZ L1,L2 */
+ *opline = *target;
+ if (opline->op1_type == IS_CONST) {
+ zval zv;
+ ZVAL_COPY(&zv, &ZEND_OP1_LITERAL(opline));
+ opline->op1.constant = zend_optimizer_add_literal(op_array, &zv);
+ }
+ goto optimize_jmpznz;
+ } else if ((target->opcode == ZEND_RETURN ||
+ target->opcode == ZEND_RETURN_BY_REF ||
+ target->opcode == ZEND_GENERATOR_RETURN ||
+ target->opcode == ZEND_EXIT) &&
+ !(op_array->fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK)) {
+ /* JMP L, L: RETURN to immediate RETURN */
+ *opline = *target;
+ if (opline->op1_type == IS_CONST) {
+ zval zv;
+ ZVAL_COPY(&zv, &ZEND_OP1_LITERAL(opline));
+ opline->op1.constant = zend_optimizer_add_literal(op_array, &zv);
+ }
+ } else if (opline > op_array->opcodes &&
+ ((opline-1)->opcode == ZEND_JMPZ ||
+ (opline-1)->opcode == ZEND_JMPNZ)) {
+ if (ZEND_OP2_JMP_ADDR(opline-1) == target) {
+ /* JMPZ(X,L1), JMP(L1) -> NOP, JMP(L1) */
+ if ((opline-1)->op1_type == IS_CV) {
+ (opline-1)->opcode = ZEND_CHECK_VAR;
+ (opline-1)->op2.num = 0;
+ } else if ((opline-1)->op1_type & (IS_TMP_VAR|IS_VAR)) {
+ (opline-1)->opcode = ZEND_FREE;
+ (opline-1)->op2.num = 0;
+ } else {
+ MAKE_NOP(opline-1);
+ }
+ } else {
+ /* JMPZ(X,L1), JMP(L2) -> JMPZNZ(X,L1,L2) */
+ if ((opline-1)->opcode == ZEND_JMPZ) {
+ (opline-1)->extended_value = ZEND_OPLINE_TO_OFFSET((opline-1), target);
+ } else {
+ (opline-1)->extended_value = ZEND_OPLINE_TO_OFFSET((opline-1), ZEND_OP2_JMP_ADDR(opline-1));
+ ZEND_SET_OP_JMP_ADDR((opline-1), (opline-1)->op2, target);
+ }
+ (opline-1)->opcode = ZEND_JMPZNZ;
+ }
}
break;
case ZEND_JMP_SET:
case ZEND_COALESCE:
- if (op_array->fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK) {
- break;
- }
+ jmp_hitlist_count = 0;
- while (ZEND_OP2_JMP_ADDR(opline) < end) {
- zend_op *target = ZEND_OP2_JMP_ADDR(opline);
+ target = ZEND_OP2_JMP_ADDR(opline);
+ while (1) {
if (target->opcode == ZEND_JMP) {
- ZEND_SET_OP_JMP_ADDR(opline, opline->op2, ZEND_OP1_JMP_ADDR(target));
+ target = ZEND_OP1_JMP_ADDR(target);
+ CHECK_LOOP(target);
+ } else if (target->opcode == ZEND_NOP) {
+ target = target + 1;
} else {
break;
}
+ ZEND_SET_OP_JMP_ADDR(opline, opline->op2, target);
}
break;
+
case ZEND_JMPZ:
case ZEND_JMPNZ:
- if (op_array->fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK) {
- break;
- }
-
- while (ZEND_OP2_JMP_ADDR(opline) < end) {
- zend_op *target = ZEND_OP2_JMP_ADDR(opline);
+ jmp_hitlist_count = 0;
+ target = ZEND_OP2_JMP_ADDR(opline);
+ while (1) {
if (target->opcode == ZEND_JMP) {
/* plain JMP */
/* JMPZ(X,L1), L1: JMP(L2) => JMPZ(X,L2), L1: JMP(L2) */
- CHECK_JMP(target, done_jmp_optimization);
- ZEND_SET_OP_JMP_ADDR(opline, opline->op2, ZEND_OP1_JMP_ADDR(target));
+ target = ZEND_OP1_JMP_ADDR(target);
+ CHECK_LOOP(target);
} else if (target->opcode == opline->opcode &&
SAME_VAR(opline->op1, target->op1)) {
/* same opcode and same var as this opcode */
/* JMPZ(X,L1), L1: JMPZ(X,L2) => JMPZ(X,L2), L1: JMPZ(X,L2) */
- CHECK_JMP2(target, done_jmp_optimization);
- ZEND_SET_OP_JMP_ADDR(opline, opline->op2, ZEND_OP2_JMP_ADDR(target));
- } else if (target->opcode == opline->opcode + 3 &&
- SAME_VAR(opline->op1, target->op1)) {
- /* convert JMPZ(X,L1), L1: T JMPZ_EX(X,L2) to
- T = JMPZ_EX(X, L2) */
- ZEND_SET_OP_JMP_ADDR(opline, opline->op2, ZEND_OP2_JMP_ADDR(target));
- opline->opcode += 3;
- COPY_NODE(opline->result, target->result);
- break;
+ target = ZEND_OP2_JMP_ADDR(target);
+ CHECK_LOOP(target);
} else if (target->opcode == INV_COND(opline->opcode) &&
SAME_VAR(opline->op1, target->op1)) {
/* convert JMPZ(X,L1), L1: JMPNZ(X,L2) to
JMPZ(X,L1+1) */
- ZEND_SET_OP_JMP_ADDR(opline, opline->op2, target + 1);
- break;
- } else if (target->opcode == INV_COND_EX(opline->opcode) &&
+ target = target + 1;
+ } else if (target->opcode == ZEND_JMPZNZ &&
SAME_VAR(opline->op1, target->op1)) {
- /* convert JMPZ(X,L1), L1: T = JMPNZ_EX(X,L2) to
- T = JMPZ_EX(X,L1+1) */
- ZEND_SET_OP_JMP_ADDR(opline, opline->op2, target + 1);
- opline->opcode += 3;
- COPY_NODE(opline->result, target->result);
- break;
+ target = (opline->opcode == ZEND_JMPZ) ?
+ ZEND_OP2_JMP_ADDR(target) :
+ ZEND_OFFSET_TO_OPLINE(target, target->extended_value);
+ CHECK_LOOP(target);
+ } else if (target->opcode == ZEND_NOP) {
+ target = target + 1;
} else {
break;
}
+ ZEND_SET_OP_JMP_ADDR(opline, opline->op2, target);
+ }
+
+ /* convert L: JMPZ L+1 to NOP */
+ if (target == opline + 1) {
+ if (opline->op1_type == IS_CV) {
+ opline->opcode = ZEND_CHECK_VAR;
+ opline->op2.num = 0;
+ } else if (opline->op1_type & (IS_TMP_VAR|IS_VAR)) {
+ opline->opcode = ZEND_FREE;
+ opline->op2.num = 0;
+ } else {
+ MAKE_NOP(opline);
+ }
}
break;
case ZEND_JMPZ_EX:
- case ZEND_JMPNZ_EX: {
- zend_uchar T_type = opline->result_type;
- znode_op T = opline->result;
+ case ZEND_JMPNZ_EX:
+ jmp_hitlist_count = 0;
- if (op_array->fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK) {
+ target = ZEND_OP2_JMP_ADDR(opline);
+ while (1) {
+ if (target->opcode == ZEND_JMP) {
+ /* plain JMP */
+ /* JMPZ_EX(X,L1), L1: JMP(L2) => JMPZ_EX(X,L2), L1: JMP(L2) */
+ target = ZEND_OP1_JMP_ADDR(target);
+ CHECK_LOOP(target);
+ } else if (target->opcode == opline->opcode-3 &&
+ (SAME_VAR(target->op1, opline->result) ||
+ SAME_VAR(target->op1, opline->op1))) {
+ /* convert T=JMPZ_EX(X,L1), L1: JMPZ(T,L2) to
+ JMPZ_EX(X,L2) */
+ target = ZEND_OP2_JMP_ADDR(target);
+ CHECK_LOOP(target);
+ } else if (target->opcode == opline->opcode &&
+ target->result.var == opline->result.var &&
+ (SAME_VAR(target->op1, opline->result) ||
+ SAME_VAR(target->op1, opline->op1))) {
+ /* convert T=JMPZ_EX(X,L1), L1: T=JMPZ_EX(T,L2) to
+ JMPZ_EX(X,L2) */
+ target = ZEND_OP2_JMP_ADDR(target);
+ CHECK_LOOP(target);
+ } else if (target->opcode == ZEND_JMPZNZ &&
+ (SAME_VAR(target->op1, opline->result) ||
+ SAME_VAR(target->op1, opline->op1))) {
+ /* Check for JMPZNZ with same cond variable */
+ target = (opline->opcode == ZEND_JMPZ_EX) ?
+ ZEND_OP2_JMP_ADDR(target) :
+ ZEND_OFFSET_TO_OPLINE(target, target->extended_value);
+ CHECK_LOOP(target);
+ } else if (target->opcode == INV_EX_COND(opline->opcode) &&
+ (SAME_VAR(target->op1, opline->result) ||
+ SAME_VAR(target->op1, opline->op1))) {
+ /* convert T=JMPZ_EX(X,L1), L1: JMPNZ(T,L2) to
+ JMPZ_EX(X,L1+1) */
+ target = target + 1;
+ } else if (target->opcode == INV_EX_COND_EX(opline->opcode) &&
+ target->result.var == opline->result.var &&
+ (SAME_VAR(target->op1, opline->result) ||
+ SAME_VAR(target->op1, opline->op1))) {
+ /* convert T=JMPZ_EX(X,L1), L1: T=JMPNZ_EX(T,L2) to
+ JMPZ_EX(X,L1+1) */
+ target = target + 1;
+ } else if (target->opcode == ZEND_BOOL &&
+ (SAME_VAR(target->op1, opline->result) ||
+ SAME_VAR(target->op1, opline->op1))) {
+ /* convert Y = JMPZ_EX(X,L1), L1: Z = BOOL(Y) to
+ Z = JMPZ_EX(X,L1+1) */
+
+ /* NOTE: This optimization pattern is not safe, but works, */
+ /* because result of JMPZ_EX instruction */
+ /* is not used on the following path and */
+ /* should be used once on the branch path. */
+ /* */
+ /* The pattern works well only if jums processed in */
+ /* direct order, otherwise it breaks JMPZ_EX */
+ /* sequences too early. */
+ opline->result.var = target->result.var;
+ target = target + 1;
+ CHECK_LOOP(target);
+ } else if (target->opcode == ZEND_NOP) {
+ target = target + 1;
+ } else {
break;
}
+ ZEND_SET_OP_JMP_ADDR(opline, opline->op2, target);
+ }
- /* convert L: T = JMPZ_EX X,L+1 to T = BOOL(X) */
- /* convert L: T = JMPZ_EX T,L+1 to NOP */
- if (ZEND_OP2_JMP_ADDR(opline) == opline + 1) {
- if (opline->op1.var == opline->result.var) {
- MAKE_NOP(opline);
- } else {
- opline->opcode = ZEND_BOOL;
- SET_UNUSED(opline->op2);
- }
- goto done_jmp_optimization;
- }
-
- while (ZEND_OP2_JMP_ADDR(opline) < end) {
- zend_op *target = ZEND_OP2_JMP_ADDR(opline);
-
- if (target->opcode == opline->opcode-3 &&
- SAME_VAR(target->op1, T)) {
- /* convert T=JMPZ_EX(X,L1), L1: JMPZ(T,L2) to
- JMPZ_EX(X,L2) */
- CHECK_JMP2(target, continue_jmp_ex_optimization);
- ZEND_SET_OP_JMP_ADDR(opline, opline->op2, ZEND_OP2_JMP_ADDR(target));
- } else if (target->opcode == opline->opcode &&
- SAME_VAR(target->op1, T) &&
- SAME_VAR(target->result, T)) {
- /* convert T=JMPZ_EX(X,L1), L1: T=JMPZ_EX(T,L2) to
- JMPZ_EX(X,L2) */
- CHECK_JMP2(target, continue_jmp_ex_optimization);
- ZEND_SET_OP_JMP_ADDR(opline, opline->op2, ZEND_OP2_JMP_ADDR(target));
- } else if (target->opcode == ZEND_JMPZNZ &&
- SAME_VAR(target->op1, T)) {
- /* Check for JMPZNZ with same cond variable */
- zend_op *new_target;
-
- CHECK_JMP2(target, continue_jmp_ex_optimization);
- if (opline->opcode == ZEND_JMPZ_EX) {
- new_target = ZEND_OP2_JMP_ADDR(target);
- } else {
- /* JMPNZ_EX */
- new_target = ZEND_OFFSET_TO_OPLINE(target, target->extended_value);
- }
- ZEND_SET_OP_JMP_ADDR(opline, opline->op2, new_target);
- } else if ((target->opcode == INV_EX_COND_EX(opline->opcode) ||
- target->opcode == INV_EX_COND(opline->opcode)) &&
- SAME_VAR(opline->op1, target->op1)) {
- /* convert JMPZ_EX(X,L1), L1: JMPNZ_EX(X,L2) to
- JMPZ_EX(X,L1+1) */
- ZEND_SET_OP_JMP_ADDR(opline, opline->op2, target + 1);
- break;
- } else if (target->opcode == INV_EX_COND(opline->opcode) &&
- SAME_VAR(target->op1, T)) {
- /* convert T=JMPZ_EX(X,L1), L1: JMPNZ(T,L2) to
- JMPZ_EX(X,L1+1) */
- ZEND_SET_OP_JMP_ADDR(opline, opline->op2, target + 1);
- break;
- } else if (target->opcode == INV_EX_COND_EX(opline->opcode) &&
- SAME_VAR(target->op1, T) &&
- SAME_VAR(target->result, T)) {
- /* convert T=JMPZ_EX(X,L1), L1: T=JMPNZ_EX(T,L2) to
- JMPZ_EX(X,L1+1) */
- ZEND_SET_OP_JMP_ADDR(opline, opline->op2, target + 1);
- break;
- } else if (target->opcode == ZEND_BOOL &&
- SAME_VAR(opline->result, target->op1)) {
- /* convert Y = JMPZ_EX(X,L1), L1: Z = BOOL(Y) to
- Z = JMPZ_EX(X,L1+1) */
- opline->result.var = target->result.var;
- ZEND_SET_OP_JMP_ADDR(opline, opline->op2, target + 1);
- break;
- } else {
- break;
- }
- } /* while */
-continue_jmp_ex_optimization:
- break;
-#if 0
- /* If Ti = JMPZ_EX(X, L) and Ti is not used, convert to JMPZ(X, L) */
- {
- zend_op *op;
- for(op = opline+1; op<end; op++) {
- if(op->result_type == IS_TMP_VAR &&
- op->result.var == opline->result.var) {
- break; /* can pass to part 2 */
- }
-
- if(op->opcode == ZEND_JMP ||
- op->opcode == ZEND_JMPZ ||
- op->opcode == ZEND_JMPZ_EX ||
- op->opcode == ZEND_JMPNZ ||
- op->opcode == ZEND_JMPNZ_EX ||
- op->opcode == ZEND_JMPZNZ ||
- op->opcode == ZEND_CASE ||
- op->opcode == ZEND_RETURN ||
- op->opcode == ZEND_RETURN_BY_REF ||
- op->opcode == ZEND_FAST_RET ||
- op->opcode == ZEND_FE_FETCH_R ||
- op->opcode == ZEND_FE_FETCH_RW ||
- op->opcode == ZEND_EXIT) {
- break;
- }
-
- if(op->op1_type == IS_TMP_VAR &&
- op->op1.var == opline->result.var) {
- goto done_jmp_optimization;
- }
-
- if(op->op2_type == IS_TMP_VAR &&
- op->op2.var == opline->result.var) {
- goto done_jmp_optimization;
- }
- } /* for */
-
- for(op = &op_array->opcodes[opline->op2.opline_num]; op<end; op++) {
-
- if(op->result_type == IS_TMP_VAR &&
- op->result.var == opline->result.var) {
- break; /* can pass to optimization */
- }
-
- if(op->opcode == ZEND_JMP ||
- op->opcode == ZEND_JMPZ ||
- op->opcode == ZEND_JMPZ_EX ||
- op->opcode == ZEND_JMPNZ ||
- op->opcode == ZEND_JMPNZ_EX ||
- op->opcode == ZEND_JMPZNZ ||
- op->opcode == ZEND_CASE ||
- op->opcode == ZEND_RETURN ||
- op->opcode == ZEND_RETURN_BY_REF ||
- op->opcode == ZEND_FAST_RET ||
- op->opcode == ZEND_FE_FETCH_R ||
- op->opcode == ZEND_FE_FETCH_RW ||
- op->opcode == ZEND_EXIT) {
- break;
- }
-
- if(op->op1_type == IS_TMP_VAR &&
- op->op1.var == opline->result.var) {
- goto done_jmp_optimization;
- }
-
- if(op->op2_type == IS_TMP_VAR &&
- op->op2.var == opline->result.var) {
- goto done_jmp_optimization;
- }
- }
-
- opline->opcode = opline->opcode-3; /* JMP_EX -> JMP */
- SET_UNUSED(opline->result);
- break;
- }
-#endif
+ /* convert L: T = JMPZ_EX X,L+1 to T = BOOL(X) */
+ if (target == opline + 1) {
+ opline->opcode = ZEND_BOOL;
+ opline->op2.num = 0;
}
break;
case ZEND_JMPZNZ:
- if (op_array->fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK) {
- break;
- }
-
- /* JMPZNZ(X,L1,L2), L1: JMP(L3) => JMPZNZ(X,L3,L2), L1: JMP(L3) */
- while (ZEND_OP2_JMP_ADDR(opline) < end
- && ZEND_OP2_JMP_ADDR(opline)->opcode == ZEND_JMP) {
- zend_op *target = ZEND_OP2_JMP_ADDR(opline);
- CHECK_JMP(target, continue_jmpznz_optimization);
- ZEND_SET_OP_JMP_ADDR(opline, opline->op2, ZEND_OP1_JMP_ADDR(target));
- }
-continue_jmpznz_optimization:
- /* JMPZNZ(X,L1,L2), L2: JMP(L3) => JMPZNZ(X,L1,L3), L2: JMP(L3) */
- while (ZEND_OFFSET_TO_OPLINE(opline, opline->extended_value) < end
- && ZEND_OFFSET_TO_OPLINE(opline, opline->extended_value)->opcode == ZEND_JMP) {
- zend_op *target = ZEND_OFFSET_TO_OPLINE(opline, opline->extended_value);
- CHECK_JMP(target, done_jmp_optimization);
- opline->extended_value = ZEND_OPLINE_TO_OFFSET(opline, ZEND_OP1_JMP_ADDR(target));
+optimize_jmpznz:
+ jmp_hitlist_count = 0;
+ target = ZEND_OP2_JMP_ADDR(opline);
+ while (1) {
+ if (target->opcode == ZEND_JMP) {
+ /* JMPZNZ(X,L1,L2), L1: JMP(L3) => JMPZNZ(X,L3,L2), L1: JMP(L3) */
+ target = ZEND_OP1_JMP_ADDR(target);
+ CHECK_LOOP(target);
+ } else if ((target->opcode == ZEND_JMPZ || target->opcode == ZEND_JMPZNZ) &&
+ SAME_VAR(target->op1, opline->op1)) {
+ /* JMPZNZ(X, L1, L2), L1: JMPZ(X, L3) -> JMPZNZ(X, L3, L2) */
+ target = ZEND_OP2_JMP_ADDR(target);
+ CHECK_LOOP(target);
+ } else if (target->opcode == ZEND_JMPNZ &&
+ SAME_VAR(target->op1, opline->op1)) {
+ /* JMPZNZ(X, L1, L2), L1: X = JMPNZ(X, L3) -> JMPZNZ(X, L1+1, L2) */
+ target = target + 1;
+ } else if (target->opcode == ZEND_NOP) {
+ target = target + 1;
+ } else {
+ break;
+ }
+ ZEND_SET_OP_JMP_ADDR(opline, opline->op2, target);
}
- break;
-
- case ZEND_POST_INC_OBJ:
- case ZEND_POST_DEC_OBJ:
- case ZEND_POST_INC:
- case ZEND_POST_DEC: {
- /* POST_INC, FREE => PRE_INC */
- zend_op *next_op = opline + 1;
- if (next_op >= end) {
+ jmp_hitlist_count = 0;
+ target = ZEND_OFFSET_TO_OPLINE(opline, opline->extended_value);
+ while (1) {
+ if (target->opcode == ZEND_JMP) {
+ /* JMPZNZ(X,L1,L2), L2: JMP(L3) => JMPZNZ(X,L1,L3), L2: JMP(L3) */
+ target = ZEND_OP1_JMP_ADDR(target);
+ CHECK_LOOP(target);
+ } else if (target->opcode == ZEND_JMPNZ &&
+ SAME_VAR(target->op1, opline->op1)) {
+ /* JMPZNZ(X, L1, L2), L1: X = JMPNZ(X, L3) -> JMPZNZ(X, L1+1, L2) */
+ target = ZEND_OP2_JMP_ADDR(target);
+ CHECK_LOOP(target);
+ } else if (target->opcode == ZEND_JMPZ &&
+ SAME_VAR(target->op1, opline->op1)) {
+ /* JMPZNZ(X, L1, L2), L1: JMPZ(X, L3) -> JMPZNZ(X, L3, L2) */
+ target = target + 1;
+ } else if (target->opcode == ZEND_JMPZNZ &&
+ SAME_VAR(target->op1, opline->op1)) {
+ /* JMPZNZ(X, L1, L2), L1: JMPZ(X, L3) -> JMPZNZ(X, L3, L2) */
+ target = ZEND_OFFSET_TO_OPLINE(target, target->extended_value);
+ CHECK_LOOP(target);
+ } else if (target->opcode == ZEND_NOP) {
+ target = target + 1;
+ } else {
break;
}
- if (next_op->opcode == ZEND_FREE &&
- next_op->op1.var == opline->result.var) {
- MAKE_NOP(next_op);
- opline->opcode -= 2;
- opline->result_type = IS_UNUSED;
- }
+ opline->extended_value = ZEND_OPLINE_TO_OFFSET(opline, target);
+ }
+
+ if (ZEND_OP2_JMP_ADDR(opline) == target &&
+ !(opline->op1_type & (IS_VAR|IS_TMP_VAR))) {
+ /* JMPZNZ(?,L,L) -> JMP(L) */
+ opline->opcode = ZEND_JMP;
+ ZEND_SET_OP_JMP_ADDR(opline, opline->op1, target);
+ SET_UNUSED(opline->op1);
+ SET_UNUSED(opline->op2);
+ opline->extended_value = 0;
}
+ /* Don't convert JMPZNZ back to JMPZ/JMPNZ, because the
+ following JMP is not removed yet. */
break;
}
-done_jmp_optimization:
opline++;
- opline_num++;
}
free_alloca(jmp_hitlist, use_heap);
}
diff --git a/ext/opcache/Optimizer/sccp.c b/ext/opcache/Optimizer/sccp.c
index 6f8de3d43f..0c62e1bd0d 100644
--- a/ext/opcache/Optimizer/sccp.c
+++ b/ext/opcache/Optimizer/sccp.c
@@ -740,13 +740,12 @@ static inline int ct_eval_in_array(zval *result, uint32_t extended_value, zval *
res = zend_hash_exists(ht, ZSTR_EMPTY_ALLOC());
} else {
zend_string *key;
- zval key_tmp, result_tmp;
+ zval key_tmp;
res = 0;
ZEND_HASH_FOREACH_STR_KEY(ht, key) {
ZVAL_STR(&key_tmp, key);
- compare_function(&result_tmp, op1, &key_tmp);
- if (Z_LVAL(result_tmp) == 0) {
+ if (zend_compare(op1, &key_tmp) == 0) {
res = 1;
break;
}
@@ -787,9 +786,7 @@ static inline int ct_eval_func_call(
int overflow;
if (num_args == 0) {
- if (zend_string_equals_literal(name, "get_magic_quotes_gpc")
- || zend_string_equals_literal(name, "get_magic_quotes_gpc_runtime")
- || zend_string_equals_literal(name, "php_sapi_name")
+ if (zend_string_equals_literal(name, "php_sapi_name")
|| zend_string_equals_literal(name, "imagetypes")
|| zend_string_equals_literal(name, "phpversion")) {
/* pass */
@@ -892,8 +889,7 @@ static inline int ct_eval_func_call(
} else if (zend_string_equals_literal(name, "strpos")) {
if (Z_TYPE_P(args[0]) != IS_STRING
|| Z_TYPE_P(args[1]) != IS_STRING
- || !Z_STRLEN_P(args[1])
- || (CG(compiler_options) & ZEND_COMPILE_NO_BUILTIN_STRLEN)) {
+ || !Z_STRLEN_P(args[1])) {
return FAILURE;
}
/* pass */
@@ -972,8 +968,7 @@ static inline int ct_eval_func_call(
/* pass */
} else if (zend_string_equals_literal(name, "substr")) {
if (Z_TYPE_P(args[0]) != IS_STRING
- || Z_TYPE_P(args[1]) != IS_LONG
- || (CG(compiler_options) & ZEND_COMPILE_NO_BUILTIN_STRLEN)) {
+ || Z_TYPE_P(args[1]) != IS_LONG) {
return FAILURE;
}
/* pass */
@@ -1017,8 +1012,7 @@ static inline int ct_eval_func_call(
} else if (zend_string_equals_literal(name, "substr")) {
if (Z_TYPE_P(args[0]) != IS_STRING
|| Z_TYPE_P(args[1]) != IS_LONG
- || Z_TYPE_P(args[2]) != IS_LONG
- || (CG(compiler_options) & ZEND_COMPILE_NO_BUILTIN_STRLEN)) {
+ || Z_TYPE_P(args[2]) != IS_LONG) {
return FAILURE;
}
/* pass */
@@ -2170,11 +2164,6 @@ static zval *value_from_type_and_range(sccp_ctx *ctx, int var_num, zval *tmp) {
zend_ssa *ssa = ctx->scdf.ssa;
zend_ssa_var_info *info = &ssa->var_info[var_num];
- if (ssa->vars[var_num].var >= ctx->scdf.op_array->last_var) {
- // TODO Non-CVs may cause issues with FREEs
- return NULL;
- }
-
if (info->type & MAY_BE_UNDEF) {
return NULL;
}
diff --git a/ext/opcache/Optimizer/ssa_integrity.c b/ext/opcache/Optimizer/ssa_integrity.c
index ede40be59a..4f042cae74 100644
--- a/ext/opcache/Optimizer/ssa_integrity.c
+++ b/ext/opcache/Optimizer/ssa_integrity.c
@@ -87,7 +87,7 @@ static inline zend_bool is_in_successors(zend_basic_block *block, int check) {
}
static inline zend_bool is_var_type(zend_uchar type) {
- return type == IS_CV || type == IS_VAR || type == IS_TMP_VAR;
+ return (type & (IS_CV|IS_VAR|IS_TMP_VAR)) != 0;
}
#define FAIL(...) do { \
diff --git a/ext/opcache/Optimizer/zend_call_graph.c b/ext/opcache/Optimizer/zend_call_graph.c
index 8d677c1b86..28b20d10b8 100644
--- a/ext/opcache/Optimizer/zend_call_graph.c
+++ b/ext/opcache/Optimizer/zend_call_graph.c
@@ -103,7 +103,7 @@ int zend_analyze_calls(zend_arena **arena, zend_script *script, uint32_t build_f
case ZEND_INIT_STATIC_METHOD_CALL:
call_stack[call] = call_info;
func = zend_optimizer_get_called_func(
- script, op_array, opline, (build_flags & ZEND_RT_CONSTANTS) != 0);
+ script, op_array, opline);
if (func) {
call_info = zend_arena_calloc(arena, 1, sizeof(zend_call_info) + (sizeof(zend_send_arg_info) * ((int)opline->extended_value - 1)));
call_info->caller_op_array = op_array;
@@ -250,10 +250,8 @@ static void zend_sort_op_arrays(zend_call_graph *call_graph)
// TODO: perform topological sort of cyclic call graph
}
-int zend_build_call_graph(zend_arena **arena, zend_script *script, uint32_t build_flags, zend_call_graph *call_graph) /* {{{ */
+int zend_build_call_graph(zend_arena **arena, zend_script *script, zend_call_graph *call_graph) /* {{{ */
{
- int i;
-
call_graph->op_arrays_count = 0;
if (zend_foreach_op_array(call_graph, script, zend_op_array_calc) != SUCCESS) {
return FAILURE;
@@ -264,13 +262,20 @@ int zend_build_call_graph(zend_arena **arena, zend_script *script, uint32_t buil
if (zend_foreach_op_array(call_graph, script, zend_op_array_collect) != SUCCESS) {
return FAILURE;
}
+
+ return SUCCESS;
+}
+/* }}} */
+
+void zend_analyze_call_graph(zend_arena **arena, zend_script *script, zend_call_graph *call_graph) /* {{{ */
+{
+ int i;
+
for (i = 0; i < call_graph->op_arrays_count; i++) {
- zend_analyze_calls(arena, script, build_flags, call_graph->op_arrays[i], call_graph->func_infos + i);
+ zend_analyze_calls(arena, script, 0, call_graph->op_arrays[i], call_graph->func_infos + i);
}
zend_analyze_recursion(call_graph);
zend_sort_op_arrays(call_graph);
-
- return SUCCESS;
}
/* }}} */
diff --git a/ext/opcache/Optimizer/zend_call_graph.h b/ext/opcache/Optimizer/zend_call_graph.h
index 033c675b63..8d2b866fd0 100644
--- a/ext/opcache/Optimizer/zend_call_graph.h
+++ b/ext/opcache/Optimizer/zend_call_graph.h
@@ -69,7 +69,8 @@ typedef struct _zend_call_graph {
BEGIN_EXTERN_C()
-int zend_build_call_graph(zend_arena **arena, zend_script *script, uint32_t build_flags, zend_call_graph *call_graph);
+int zend_build_call_graph(zend_arena **arena, zend_script *script, zend_call_graph *call_graph);
+void zend_analyze_call_graph(zend_arena **arena, zend_script *script, zend_call_graph *call_graph);
zend_call_info **zend_build_call_map(zend_arena **arena, zend_func_info *info, zend_op_array *op_array);
int zend_analyze_calls(zend_arena **arena, zend_script *script, uint32_t build_flags, zend_op_array *op_array, zend_func_info *func_info);
diff --git a/ext/opcache/Optimizer/zend_cfg.c b/ext/opcache/Optimizer/zend_cfg.c
index 66c15be311..c5b1b53a0e 100644
--- a/ext/opcache/Optimizer/zend_cfg.c
+++ b/ext/opcache/Optimizer/zend_cfg.c
@@ -93,7 +93,7 @@ static void zend_mark_reachable(zend_op *opcodes, zend_cfg *cfg, zend_basic_bloc
b = succ;
break;
} else {
- /* Recusively check reachability */
+ /* Recursively check reachability */
if (!(succ->flags & ZEND_BB_REACHABLE)) {
zend_mark_reachable(opcodes, cfg, succ);
}
diff --git a/ext/opcache/Optimizer/zend_cfg.h b/ext/opcache/Optimizer/zend_cfg.h
index 7d6ef25eee..51e2e63b4b 100644
--- a/ext/opcache/Optimizer/zend_cfg.h
+++ b/ext/opcache/Optimizer/zend_cfg.h
@@ -22,7 +22,7 @@
/* zend_basic_bloc.flags */
#define ZEND_BB_START (1<<0) /* fist block */
#define ZEND_BB_FOLLOW (1<<1) /* follows the next block */
-#define ZEND_BB_TARGET (1<<2) /* jump taget */
+#define ZEND_BB_TARGET (1<<2) /* jump target */
#define ZEND_BB_EXIT (1<<3) /* without successors */
#define ZEND_BB_ENTRY (1<<4) /* stackless entry */
#define ZEND_BB_TRY (1<<5) /* start of try block */
@@ -92,7 +92,6 @@ typedef struct _zend_cfg {
} zend_cfg;
/* Build Flags */
-#define ZEND_RT_CONSTANTS (1U<<31)
#define ZEND_CFG_STACKLESS (1<<30)
#define ZEND_SSA_DEBUG_LIVENESS (1<<29)
#define ZEND_SSA_DEBUG_PHI_PLACEMENT (1<<28)
@@ -102,15 +101,15 @@ typedef struct _zend_cfg {
#define ZEND_CALL_TREE (1<<23)
#define ZEND_SSA_USE_CV_RESULTS (1<<22)
-#define CRT_CONSTANT_EX(op_array, opline, node, rt_constants) \
- ((rt_constants) ? \
+#define CRT_CONSTANT_EX(op_array, opline, node) \
+ (((op_array)->fn_flags & ZEND_ACC_DONE_PASS_TWO) ? \
RT_CONSTANT(opline, (node)) \
: \
CT_CONSTANT_EX(op_array, (node).constant) \
)
#define CRT_CONSTANT(node) \
- CRT_CONSTANT_EX(op_array, opline, node, (build_flags & ZEND_RT_CONSTANTS))
+ CRT_CONSTANT_EX(op_array, opline, node)
#define RETURN_VALUE_USED(opline) \
((opline)->result_type != IS_UNUSED)
diff --git a/ext/opcache/Optimizer/zend_dfg.c b/ext/opcache/Optimizer/zend_dfg.c
index e995b673b7..3bb76fb05c 100644
--- a/ext/opcache/Optimizer/zend_dfg.c
+++ b/ext/opcache/Optimizer/zend_dfg.c
@@ -123,10 +123,6 @@ int zend_build_dfg(const zend_op_array *op_array, const zend_cfg *cfg, zend_dfg
case ZEND_FETCH_DIM_RW:
case ZEND_FETCH_DIM_FUNC_ARG:
case ZEND_FETCH_DIM_UNSET:
- case ZEND_FETCH_OBJ_W:
- case ZEND_FETCH_OBJ_RW:
- case ZEND_FETCH_OBJ_FUNC_ARG:
- case ZEND_FETCH_OBJ_UNSET:
case ZEND_FETCH_LIST_W:
case ZEND_VERIFY_RETURN_TYPE:
case ZEND_PRE_INC_OBJ:
diff --git a/ext/opcache/Optimizer/zend_dump.c b/ext/opcache/Optimizer/zend_dump.c
index d6ef63415a..59288fabdd 100644
--- a/ext/opcache/Optimizer/zend_dump.c
+++ b/ext/opcache/Optimizer/zend_dump.c
@@ -127,11 +127,8 @@ static void zend_dump_unused_op(const zend_op *opline, znode_op op, uint32_t fla
} else if (ZEND_VM_OP_CONSTRUCTOR == (flags & ZEND_VM_OP_MASK)) {
fprintf(stderr, " CONSTRUCTOR");
} else if (ZEND_VM_OP_CONST_FETCH == (flags & ZEND_VM_OP_MASK)) {
- if (op.num & IS_CONSTANT_UNQUALIFIED) {
- fprintf(stderr, " (unqualified)");
- }
- if (op.num & IS_CONSTANT_IN_NAMESPACE) {
- fprintf(stderr, " (in-namespace)");
+ if (op.num & IS_CONSTANT_UNQUALIFIED_IN_NAMESPACE) {
+ fprintf(stderr, " (unqualified-in-namespace)");
}
}
}
@@ -142,7 +139,7 @@ void zend_dump_var(const zend_op_array *op_array, zend_uchar var_type, int var_n
fprintf(stderr, "CV%d($%s)", var_num, op_array->vars[var_num]->val);
} else if (var_type == IS_VAR) {
fprintf(stderr, "V%d", var_num);
- } else if (var_type == IS_TMP_VAR) {
+ } else if ((var_type & (IS_VAR|IS_TMP_VAR)) == IS_TMP_VAR) {
fprintf(stderr, "T%d", var_num);
} else {
fprintf(stderr, "X%d", var_num);
@@ -314,10 +311,6 @@ static void zend_dump_type_info(uint32_t info, zend_class_entry *ce, int is_inst
fprintf(stderr, "resource");
}
}
- if (info & MAY_BE_ERROR) {
- if (first) first = 0; else fprintf(stderr, ", ");
- fprintf(stderr, "error");
- }
//TODO: this is useful only for JIT???
if (info & MAY_BE_IN_REG) {
if (first) first = 0; else fprintf(stderr, ", ");
@@ -409,23 +402,17 @@ static void zend_dump_range_constraint(const zend_op_array *op_array, const zend
}
}
-static void zend_dump_op(const zend_op_array *op_array, const zend_basic_block *b, const zend_op *opline, uint32_t dump_flags, const void *data)
+void zend_dump_op(const zend_op_array *op_array, const zend_basic_block *b, const zend_op *opline, uint32_t dump_flags, const void *data)
{
const char *name = zend_get_opcode_name(opline->opcode);
uint32_t flags = zend_get_opcode_flags(opline->opcode);
uint32_t n = 0;
- int len = 0;
const zend_ssa *ssa = NULL;
if (dump_flags & ZEND_DUMP_SSA) {
ssa = (const zend_ssa*)data;
}
- if (!b) {
- len = fprintf(stderr, "L%u (%u):", (uint32_t)(opline - op_array->opcodes), opline->lineno);
- }
- fprintf(stderr, "%*c", 12-len, ' ');
-
if (!ssa || !ssa->ops || ssa->ops[opline - op_array->opcodes].result_use < 0) {
if (opline->result_type & (IS_CV|IS_VAR|IS_TMP_VAR)) {
if (ssa && ssa->ops && ssa->ops[opline - op_array->opcodes].result_def >= 0) {
@@ -523,7 +510,8 @@ static void zend_dump_op(const zend_op_array *op_array, const zend_basic_block *
fprintf(stderr, " (bool)");
break;
default:
- fprintf(stderr, " (\?\?\?)");
+ fprintf(stderr, " TYPE");
+ zend_dump_type_info(opline->extended_value, NULL, 0, dump_flags);
break;
}
} else if (ZEND_VM_EXT_EVAL == (flags & ZEND_VM_EXT_MASK)) {
@@ -581,20 +569,18 @@ static void zend_dump_op(const zend_op_array *op_array, const zend_basic_block *
fprintf(stderr, " (ref)");
}
}
- if ((ZEND_VM_EXT_DIM_OBJ_WRITE|ZEND_VM_EXT_FETCH_REF) & flags) {
+ if ((ZEND_VM_EXT_DIM_WRITE|ZEND_VM_EXT_FETCH_REF) & flags) {
uint32_t obj_flags = opline->extended_value & ZEND_FETCH_OBJ_FLAGS;
if (obj_flags == ZEND_FETCH_REF) {
fprintf(stderr, " (ref)");
} else if (obj_flags == ZEND_FETCH_DIM_WRITE) {
fprintf(stderr, " (dim write)");
- } else if (obj_flags == ZEND_FETCH_OBJ_WRITE) {
- fprintf(stderr, " (obj write)");
}
}
}
if (opline->op1_type == IS_CONST) {
- zend_dump_const(CRT_CONSTANT_EX(op_array, opline, opline->op1, (dump_flags & ZEND_DUMP_RT_CONSTANTS)));
+ zend_dump_const(CRT_CONSTANT(opline->op1));
} else if (opline->op1_type & (IS_CV|IS_VAR|IS_TMP_VAR)) {
if (ssa && ssa->ops) {
int ssa_var_num = ssa->ops[opline - op_array->opcodes].op1_use;
@@ -619,7 +605,9 @@ static void zend_dump_op(const zend_op_array *op_array, const zend_basic_block *
} else {
uint32_t op1_flags = ZEND_VM_OP1_FLAGS(flags);
if (ZEND_VM_OP_JMP_ADDR == (op1_flags & ZEND_VM_OP_MASK)) {
- if (b) {
+ if (dump_flags & ZEND_DUMP_NUMERIC_OPLINES) {
+ fprintf(stderr, " %04u", (uint32_t)(OP_JMP_ADDR(opline, opline->op1) - op_array->opcodes));
+ } else if (b) {
fprintf(stderr, " BB%d", b->successors[n++]);
} else {
fprintf(stderr, " L%u", (uint32_t)(OP_JMP_ADDR(opline, opline->op1) - op_array->opcodes));
@@ -630,7 +618,7 @@ static void zend_dump_op(const zend_op_array *op_array, const zend_basic_block *
}
if (opline->op2_type == IS_CONST) {
- zval *op = CRT_CONSTANT_EX(op_array, opline, opline->op2, (dump_flags & ZEND_DUMP_RT_CONSTANTS));
+ zval *op = CRT_CONSTANT(opline->op2);
if (opline->opcode == ZEND_SWITCH_LONG || opline->opcode == ZEND_SWITCH_STRING) {
HashTable *jumptable = Z_ARRVAL_P(op);
zend_string *key;
@@ -642,7 +630,9 @@ static void zend_dump_op(const zend_op_array *op_array, const zend_basic_block *
} else {
fprintf(stderr, " " ZEND_LONG_FMT ":", num_key);
}
- if (b) {
+ if (dump_flags & ZEND_DUMP_NUMERIC_OPLINES) {
+ fprintf(stderr, " %04u,", (uint32_t)ZEND_OFFSET_TO_OPLINE_NUM(op_array, opline, Z_LVAL_P(zv)));
+ } else if (b) {
fprintf(stderr, " BB%d,", b->successors[n++]);
} else {
fprintf(stderr, " L%u,", (uint32_t)ZEND_OFFSET_TO_OPLINE_NUM(op_array, opline, Z_LVAL_P(zv)));
@@ -677,7 +667,9 @@ static void zend_dump_op(const zend_op_array *op_array, const zend_basic_block *
uint32_t op2_flags = ZEND_VM_OP2_FLAGS(flags);
if (ZEND_VM_OP_JMP_ADDR == (op2_flags & ZEND_VM_OP_MASK)) {
if (opline->opcode != ZEND_CATCH || !(opline->extended_value & ZEND_LAST_CATCH)) {
- if (b) {
+ if (dump_flags & ZEND_DUMP_NUMERIC_OPLINES) {
+ fprintf(stderr, " %04u", (uint32_t)(OP_JMP_ADDR(opline, opline->op2) - op_array->opcodes));
+ } else if (b) {
fprintf(stderr, " BB%d", b->successors[n++]);
} else {
fprintf(stderr, " L%u", (uint32_t)(OP_JMP_ADDR(opline, opline->op2) - op_array->opcodes));
@@ -689,14 +681,22 @@ static void zend_dump_op(const zend_op_array *op_array, const zend_basic_block *
}
if (ZEND_VM_EXT_JMP_ADDR == (flags & ZEND_VM_EXT_MASK)) {
- if (b) {
+ if (dump_flags & ZEND_DUMP_NUMERIC_OPLINES) {
+ fprintf(stderr, " %04u", (uint32_t)ZEND_OFFSET_TO_OPLINE_NUM(op_array, opline, opline->extended_value));
+ } else if (b) {
fprintf(stderr, " BB%d", b->successors[n++]);
} else {
fprintf(stderr, " L%u", (uint32_t)ZEND_OFFSET_TO_OPLINE_NUM(op_array, opline, opline->extended_value));
}
}
if (opline->result_type == IS_CONST) {
- zend_dump_const(CRT_CONSTANT_EX(op_array, opline, opline->result, (dump_flags & ZEND_DUMP_RT_CONSTANTS)));
+ zend_dump_const(CRT_CONSTANT(opline->result));
+#if 0
+ } else if (opline->result_type & IS_SMART_BRANCH_JMPZ) {
+ fprintf(stderr, " jmpz");
+ } else if (opline->result_type & IS_SMART_BRANCH_JMPNZ) {
+ fprintf(stderr, " jmpnz");
+#endif
} else if (ssa && ssa->ops && ssa->ops[opline - op_array->opcodes].result_use >= 0) {
if (opline->result_type & (IS_CV|IS_VAR|IS_TMP_VAR)) {
if (ssa && ssa->ops) {
@@ -718,6 +718,20 @@ static void zend_dump_op(const zend_op_array *op_array, const zend_basic_block *
}
}
}
+}
+
+static void zend_dump_op_line(const zend_op_array *op_array, const zend_basic_block *b, const zend_op *opline, uint32_t dump_flags, const void *data)
+{
+ int len = 0;
+
+ if (dump_flags & ZEND_DUMP_NUMERIC_OPLINES) {
+ len = fprintf(stderr, "%04u:", (uint32_t)(opline - op_array->opcodes));
+ } else if (!b) {
+ len = fprintf(stderr, "L%u (%u):", (uint32_t)(opline - op_array->opcodes), opline->lineno);
+ }
+ fprintf(stderr, "%*c", 12-len, ' ');
+
+ zend_dump_op(op_array, b, opline, dump_flags, data);
fprintf(stderr, "\n");
}
@@ -729,6 +743,9 @@ static void zend_dump_block_info(const zend_cfg *cfg, int n, uint32_t dump_flags
if (b->flags & ZEND_BB_START) {
fprintf(stderr, " start");
}
+ if (b->flags & ZEND_BB_RECV_ENTRY) {
+ fprintf(stderr, " recv");
+ }
if (b->flags & ZEND_BB_FOLLOW) {
fprintf(stderr, " follow");
}
@@ -996,7 +1013,7 @@ void zend_dump_op_array(const zend_op_array *op_array, uint32_t dump_flags, cons
opline = op_array->opcodes + b->start;
end = opline + b->len;
while (opline < end) {
- zend_dump_op(op_array, b, opline, dump_flags, data);
+ zend_dump_op_line(op_array, b, opline, dump_flags, data);
opline++;
}
}
@@ -1004,7 +1021,10 @@ void zend_dump_op_array(const zend_op_array *op_array, uint32_t dump_flags, cons
if (op_array->last_live_range && (dump_flags & ZEND_DUMP_LIVE_RANGES)) {
fprintf(stderr, "LIVE RANGES:\n");
for (i = 0; i < op_array->last_live_range; i++) {
- fprintf(stderr, " %u: L%u - L%u ",
+ fprintf(stderr,
+ (dump_flags & ZEND_DUMP_NUMERIC_OPLINES) ?
+ " %u: %04u - %04u " :
+ " %u: L%u - L%u ",
EX_VAR_TO_NUM(op_array->live_range[i].var & ~ZEND_LIVE_MASK),
op_array->live_range[i].start,
op_array->live_range[i].end);
@@ -1057,13 +1077,16 @@ void zend_dump_op_array(const zend_op_array *op_array, uint32_t dump_flags, cons
const zend_op *end = opline + op_array->last;
while (opline < end) {
- zend_dump_op(op_array, NULL, opline, dump_flags, data);
+ zend_dump_op_line(op_array, NULL, opline, dump_flags, data);
opline++;
}
if (op_array->last_live_range && (dump_flags & ZEND_DUMP_LIVE_RANGES)) {
fprintf(stderr, "LIVE RANGES:\n");
for (i = 0; i < op_array->last_live_range; i++) {
- fprintf(stderr, " %u: L%u - L%u ",
+ fprintf(stderr,
+ (dump_flags & ZEND_DUMP_NUMERIC_OPLINES) ?
+ " %u: %04u - %04u " :
+ " %u: L%u - L%u ",
EX_VAR_TO_NUM(op_array->live_range[i].var & ~ZEND_LIVE_MASK),
op_array->live_range[i].start,
op_array->live_range[i].end);
@@ -1089,22 +1112,35 @@ void zend_dump_op_array(const zend_op_array *op_array, uint32_t dump_flags, cons
if (op_array->last_try_catch) {
fprintf(stderr, "EXCEPTION TABLE:\n");
for (i = 0; i < op_array->last_try_catch; i++) {
- fprintf(stderr, " L%u",
+ fprintf(stderr,
+ (dump_flags & ZEND_DUMP_NUMERIC_OPLINES) ?
+ " %04u" :
+ " L%u",
op_array->try_catch_array[i].try_op);
+
if (op_array->try_catch_array[i].catch_op) {
- fprintf(stderr, ", L%u",
+ fprintf(stderr,
+ (dump_flags & ZEND_DUMP_NUMERIC_OPLINES) ?
+ ", %04u" :
+ ", L%u",
op_array->try_catch_array[i].catch_op);
} else {
fprintf(stderr, ", -");
}
if (op_array->try_catch_array[i].finally_op) {
- fprintf(stderr, ", L%u",
+ fprintf(stderr,
+ (dump_flags & ZEND_DUMP_NUMERIC_OPLINES) ?
+ ", %04u" :
+ ", L%u",
op_array->try_catch_array[i].finally_op);
} else {
fprintf(stderr, ", -");
}
if (op_array->try_catch_array[i].finally_end) {
- fprintf(stderr, ", L%u\n",
+ fprintf(stderr,
+ (dump_flags & ZEND_DUMP_NUMERIC_OPLINES) ?
+ ", %04u" :
+ ", L%u\n",
op_array->try_catch_array[i].finally_end);
} else {
fprintf(stderr, ", -\n");
diff --git a/ext/opcache/Optimizer/zend_dump.h b/ext/opcache/Optimizer/zend_dump.h
index 820f3daf19..5f1968fd23 100644
--- a/ext/opcache/Optimizer/zend_dump.h
+++ b/ext/opcache/Optimizer/zend_dump.h
@@ -27,11 +27,12 @@
#define ZEND_DUMP_CFG (1<<2)
#define ZEND_DUMP_SSA (1<<3)
#define ZEND_DUMP_LIVE_RANGES (1<<4)
-#define ZEND_DUMP_RT_CONSTANTS ZEND_RT_CONSTANTS
+#define ZEND_DUMP_NUMERIC_OPLINES (1<<5)
BEGIN_EXTERN_C()
void zend_dump_op_array(const zend_op_array *op_array, uint32_t dump_flags, const char *msg, const void *data);
+void zend_dump_op(const zend_op_array *op_array, const zend_basic_block *b, const zend_op *opline, uint32_t dump_flags, const void *data);
void zend_dump_dominators(const zend_op_array *op_array, const zend_cfg *cfg);
void zend_dump_dfg(const zend_op_array *op_array, const zend_cfg *cfg, const zend_dfg *dfg);
void zend_dump_phi_placement(const zend_op_array *op_array, const zend_ssa *ssa);
diff --git a/ext/opcache/Optimizer/zend_func_info.c b/ext/opcache/Optimizer/zend_func_info.c
index ce23207de9..b57e5e65ef 100644
--- a/ext/opcache/Optimizer/zend_func_info.c
+++ b/ext/opcache/Optimizer/zend_func_info.c
@@ -39,66 +39,19 @@ typedef struct _func_info_t {
info_func_t info_func;
} func_info_t;
-/* MSVC defines its own IN macro, undefine it here */
-#undef IN
-
#define F0(name, info) \
- {name, sizeof(name)-1, (FUNC_MAY_WARN | (info)), NULL}
+ {name, sizeof(name)-1, (info), NULL}
#define F1(name, info) \
- {name, sizeof(name)-1, (FUNC_MAY_WARN | MAY_BE_RC1 | (info)), NULL}
+ {name, sizeof(name)-1, (MAY_BE_RC1 | (info)), NULL}
#define FN(name, info) \
- {name, sizeof(name)-1, (FUNC_MAY_WARN | MAY_BE_RC1 | MAY_BE_RCN | (info)), NULL}
+ {name, sizeof(name)-1, (MAY_BE_RC1 | MAY_BE_RCN | (info)), NULL}
#define FR(name, info) \
- {name, sizeof(name)-1, (FUNC_MAY_WARN | MAY_BE_REF | (info)), NULL}
+ {name, sizeof(name)-1, (MAY_BE_REF | (info)), NULL}
#define FX(name, info) \
- {name, sizeof(name)-1, (FUNC_MAY_WARN | MAY_BE_RC1 | MAY_BE_RCN | MAY_BE_REF | (info)), NULL}
-#define I0(name, info) \
- {name, sizeof(name)-1, (info), NULL}
-#define I1(name, info) \
- {name, sizeof(name)-1, (MAY_BE_RC1 | (info)), NULL}
-#define IN(name, info) \
- {name, sizeof(name)-1, (MAY_BE_RC1 | MAY_BE_RCN | (info)), NULL}
+ {name, sizeof(name)-1, (MAY_BE_RC1 | MAY_BE_RCN | MAY_BE_REF | (info)), NULL}
#define FC(name, callback) \
{name, sizeof(name)-1, 0, callback}
-static uint32_t zend_strlen_info(const zend_call_info *call_info, const zend_ssa *ssa)
-{
- if (call_info->num_args == 1) {
- uint32_t tmp = 0;
- if (call_info->arg_info[0].opline) {
- uint32_t arg_info = _ssa_op1_info(call_info->caller_op_array, ssa, call_info->arg_info[0].opline);
-
- if (arg_info & (MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_STRING|MAY_BE_OBJECT)) {
- tmp |= MAY_BE_LONG;
- }
- if (arg_info & (MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) {
- /* warning, and returns NULL */
- tmp |= FUNC_MAY_WARN | MAY_BE_NULL;
- }
- } else {
- tmp |= MAY_BE_LONG | FUNC_MAY_WARN | MAY_BE_NULL;
- }
- return tmp;
- } else if (call_info->num_args != -1) {
- /* warning, and returns NULL */
- return FUNC_MAY_WARN | MAY_BE_NULL;
- } else {
- return MAY_BE_LONG | FUNC_MAY_WARN | MAY_BE_NULL;
- }
-}
-
-static uint32_t zend_dechex_info(const zend_call_info *call_info, const zend_ssa *ssa)
-{
- if (call_info->num_args == 1) {
- return MAY_BE_RC1 | MAY_BE_STRING;
- } else if (call_info->num_args != -1) {
- /* warning, and returns NULL */
- return FUNC_MAY_WARN | MAY_BE_NULL;
- } else {
- return FUNC_MAY_WARN | MAY_BE_RC1 | MAY_BE_STRING | MAY_BE_NULL;
- }
-}
-
static uint32_t zend_range_info(const zend_call_info *call_info, const zend_ssa *ssa)
{
if (call_info->num_args == 2 || call_info->num_args == 3) {
@@ -106,7 +59,7 @@ static uint32_t zend_range_info(const zend_call_info *call_info, const zend_ssa
uint32_t t1 = _ssa_op1_info(call_info->caller_op_array, ssa, call_info->arg_info[0].opline);
uint32_t t2 = _ssa_op1_info(call_info->caller_op_array, ssa, call_info->arg_info[1].opline);
uint32_t t3 = 0;
- uint32_t tmp = FUNC_MAY_WARN | MAY_BE_RC1 | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG;
+ uint32_t tmp = MAY_BE_RC1 | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG;
if (call_info->num_args == 3) {
t3 = _ssa_op1_info(call_info->caller_op_array, ssa, call_info->arg_info[2].opline);
@@ -127,87 +80,7 @@ static uint32_t zend_range_info(const zend_call_info *call_info, const zend_ssa
return tmp;
} else {
/* may warning, and return FALSE */
- return FUNC_MAY_WARN | MAY_BE_RC1 | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_DOUBLE | MAY_BE_ARRAY_OF_STRING;
- }
-}
-
-static uint32_t zend_is_type_info(const zend_call_info *call_info, const zend_ssa *ssa)
-{
- if (call_info->num_args == 1) {
- return MAY_BE_FALSE | MAY_BE_TRUE;
- } else {
- return MAY_BE_FALSE | MAY_BE_TRUE | FUNC_MAY_WARN;
- }
-}
-
-static uint32_t zend_l_ss_info(const zend_call_info *call_info, const zend_ssa *ssa)
-{
- if (call_info->num_args == 2) {
-
- uint32_t arg1_info = _ssa_op1_info(call_info->caller_op_array, ssa, call_info->arg_info[0].opline);
- uint32_t arg2_info = _ssa_op1_info(call_info->caller_op_array, ssa, call_info->arg_info[1].opline);
- uint32_t tmp = 0;
-
- if ((arg1_info & (MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_STRING|MAY_BE_OBJECT)) &&
- (arg2_info & (MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_STRING|MAY_BE_OBJECT))) {
- tmp |= MAY_BE_LONG;
- }
- if ((arg1_info & (MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) ||
- (arg2_info & (MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
- /* warning, and returns NULL */
- tmp |= FUNC_MAY_WARN | MAY_BE_NULL;
- }
- return tmp;
- } else {
- /* warning, and returns NULL */
- return FUNC_MAY_WARN | MAY_BE_NULL | MAY_BE_LONG;
- }
-}
-
-static uint32_t zend_lb_ssn_info(const zend_call_info *call_info, const zend_ssa *ssa)
-{
- if (call_info->num_args == 3) {
- uint32_t arg1_info = _ssa_op1_info(call_info->caller_op_array, ssa, call_info->arg_info[0].opline);
- uint32_t arg2_info = _ssa_op1_info(call_info->caller_op_array, ssa, call_info->arg_info[1].opline);
- uint32_t arg3_info = _ssa_op1_info(call_info->caller_op_array, ssa, call_info->arg_info[2].opline);
- uint32_t tmp = 0;
-
- if ((arg1_info & (MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_STRING|MAY_BE_OBJECT)) &&
- (arg2_info & (MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_STRING|MAY_BE_OBJECT)) &&
- (arg3_info & (MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_STRING|MAY_BE_OBJECT))) {
- tmp |= MAY_BE_LONG | MAY_BE_FALSE;
- }
- if ((arg1_info & (MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) ||
- (arg2_info & (MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) ||
- (arg3_info & (MAY_BE_STRING|MAY_BE_RESOURCE|MAY_BE_ARRAY|MAY_BE_OBJECT))) {
- /* warning, and returns NULL */
- tmp |= FUNC_MAY_WARN | MAY_BE_NULL;
- }
- return tmp;
- } else {
- /* warning, and returns NULL */
- return FUNC_MAY_WARN | MAY_BE_NULL | MAY_BE_LONG;
- }
-}
-
-static uint32_t zend_b_s_info(const zend_call_info *call_info, const zend_ssa *ssa)
-{
- if (call_info->num_args == 1) {
-
- uint32_t arg1_info = _ssa_op1_info(call_info->caller_op_array, ssa, call_info->arg_info[0].opline);
- uint32_t tmp = 0;
-
- if (arg1_info & (MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_STRING|MAY_BE_OBJECT)) {
- tmp |= MAY_BE_FALSE | MAY_BE_TRUE;
- }
- if (arg1_info & (MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) {
- /* warning, and returns NULL */
- tmp |= FUNC_MAY_WARN | MAY_BE_NULL;
- }
- return tmp;
- } else {
- /* warning, and returns NULL */
- return FUNC_MAY_WARN | MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE;
+ return MAY_BE_RC1 | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_DOUBLE | MAY_BE_ARRAY_OF_STRING;
}
}
@@ -215,729 +88,379 @@ static uint32_t zend_b_s_info(const zend_call_info *call_info, const zend_ssa *s
static const func_info_t func_infos[] = {
/* zend */
- I1("zend_version", MAY_BE_STRING),
- I0("gc_collect_cycles", MAY_BE_LONG),
- I0("gc_enabled", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("gc_enable", MAY_BE_NULL),
- F0("gc_disable", MAY_BE_NULL),
- F0("func_num_args", MAY_BE_LONG),
+ F1("zend_version", MAY_BE_STRING),
FN("func_get_arg", UNKNOWN_INFO),
F1("func_get_args", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ANY),
- FC("strlen", zend_strlen_info),
- FC("strcmp", zend_l_ss_info),
- FC("strncmp", zend_lb_ssn_info),
- FC("strcasecmp", zend_l_ss_info),
- FC("strncasecmp", zend_lb_ssn_info),
- F1("each", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_KEY_ANY),
- F0("error_reporting", MAY_BE_NULL | MAY_BE_LONG),
- F0("define", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_NULL), // TODO: inline
- FC("defined", zend_b_s_info), // TODO: inline
- FN("get_class", MAY_BE_FALSE | MAY_BE_STRING),
- FN("get_called_class", MAY_BE_FALSE | MAY_BE_STRING),
- FN("get_parent_class", MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_NULL),
- F0("is_subclass_of", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), // TODO: inline
- F0("is_a", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE), // TODO: inline
- F1("get_class_vars", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF),
- FN("get_object_vars", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF),
- FN("get_mangled_object_vars", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF),
- F1("get_class_methods", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
- F0("method_exists", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("property_exists", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("class_exists", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("interface_exists", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("trait_exists", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- FC("function_exists", zend_b_s_info), // TODO: inline
- F0("class_alias", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- I1("get_included_files", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
- F0("trigger_error", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("user_error", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
+ F1("get_class_vars", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF),
+ FN("get_object_vars", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF),
+ FN("get_mangled_object_vars", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF),
+ F1("get_class_methods", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
+ F1("get_included_files", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
FN("set_error_handler", MAY_BE_NULL | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_OBJECT | MAY_BE_OBJECT),
- I0("restore_error_handler", MAY_BE_TRUE),
- I0("restore_exception_handler", MAY_BE_TRUE),
- I1("get_declared_traits", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
- I1("get_declared_classes", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
- I1("get_declared_interfaces", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
- F1("get_defined_functions", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ARRAY),
- I1("get_defined_vars", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF),
- FN("create_function", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING),
- F1("get_resource_type", MAY_BE_NULL | MAY_BE_STRING),
- F1("get_defined_constants", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_DOUBLE | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_RESOURCE | MAY_BE_ARRAY_OF_ARRAY),
- F0("debug_print_backtrace", MAY_BE_NULL),
- F1("debug_backtrace", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ARRAY),
- F1("get_loaded_extensions", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
- FC("extension_loaded", zend_b_s_info),
- F1("get_extension_funcs", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
+ F0("restore_error_handler", MAY_BE_TRUE),
+ F0("restore_exception_handler", MAY_BE_TRUE),
+ F1("get_declared_traits", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
+ F1("get_declared_classes", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
+ F1("get_declared_interfaces", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
+ F1("get_defined_functions", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ARRAY),
+ F1("get_defined_vars", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF),
+ F1("get_resource_type", MAY_BE_STRING),
+ F1("get_defined_constants", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_DOUBLE | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_RESOURCE | MAY_BE_ARRAY_OF_ARRAY),
+ F1("debug_backtrace", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ARRAY),
+ F1("get_loaded_extensions", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
+ F1("get_extension_funcs", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
/* ext/standard */
FN("constant", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_LONG | MAY_BE_DOUBLE | MAY_BE_STRING | MAY_BE_RESOURCE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
- F1("bin2hex", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("hex2bin", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F0("sleep", MAY_BE_FALSE | MAY_BE_LONG),
- F0("usleep", MAY_BE_NULL | MAY_BE_FALSE),
+ F1("bin2hex", MAY_BE_STRING),
+ F1("hex2bin", MAY_BE_FALSE | MAY_BE_STRING),
#if HAVE_NANOSLEEP
- F0("time_nanosleep", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG),
- F0("time_sleep_until", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
+ F1("time_nanosleep", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG),
#endif
#if HAVE_STRPTIME
- F1("strptime", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
+ F1("strptime", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
#endif
- F0("flush", MAY_BE_NULL),
- F1("wordwrap", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("htmlspecialchars", MAY_BE_NULL | MAY_BE_STRING),
- F1("htmlentities", MAY_BE_NULL | MAY_BE_STRING),
- FN("html_entity_decode", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- FN("htmlspecialchars_decode", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("get_html_translation_table", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING),
- F1("sha1", MAY_BE_NULL | MAY_BE_STRING),
- F1("sha1_file", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("md5", MAY_BE_NULL | MAY_BE_STRING),
- F1("md5_file", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F0("crc32", MAY_BE_NULL | MAY_BE_LONG),
- F1("iptcparse", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ARRAY),
- F1("iptcembed", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("getimagesize", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
- F1("getimagesizefromstring", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
- F1("image_type_to_mime_type", MAY_BE_NULL | MAY_BE_STRING),
+ F1("wordwrap", MAY_BE_STRING),
+ F1("htmlspecialchars", MAY_BE_STRING),
+ F1("htmlentities", MAY_BE_STRING),
+ F1("get_html_translation_table", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING),
+ F1("sha1", MAY_BE_STRING),
+ F1("sha1_file", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("md5", MAY_BE_STRING),
+ F1("md5_file", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("iptcparse", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ARRAY),
+ F1("iptcembed", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("getimagesize", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
+ F1("getimagesizefromstring", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
+ F1("image_type_to_mime_type", MAY_BE_STRING),
F1("image_type_to_extension", MAY_BE_FALSE | MAY_BE_STRING),
- F0("phpinfo", MAY_BE_NULL | MAY_BE_TRUE),
- F1("phpversion", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F0("phpcredits", MAY_BE_NULL | MAY_BE_TRUE),
- I1("php_sapi_name", MAY_BE_FALSE | MAY_BE_STRING),
- F1("php_uname", MAY_BE_NULL | MAY_BE_STRING),
- I1("php_ini_scanned_files", MAY_BE_FALSE | MAY_BE_STRING),
- I1("php_ini_loaded_file", MAY_BE_FALSE | MAY_BE_STRING),
- F0("strnatcmp", MAY_BE_NULL | MAY_BE_LONG),
- F0("strnatcasecmp", MAY_BE_NULL | MAY_BE_LONG),
- F0("substr_count", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("strspn", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("strcspn", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F1("strtok", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- FN("strtoupper", MAY_BE_NULL | MAY_BE_STRING),
- FN("strtolower", MAY_BE_NULL | MAY_BE_STRING),
- F0("strpos", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("stripos", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("strrpos", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("strripos", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F1("strrev", MAY_BE_NULL | MAY_BE_STRING),
- F1("hebrev", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("hebrevc", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("nl2br", MAY_BE_NULL | MAY_BE_STRING),
- F1("basename", MAY_BE_NULL | MAY_BE_STRING),
- F1("dirname", MAY_BE_NULL | MAY_BE_STRING),
- F1("pathinfo", MAY_BE_NULL | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING),
- F1("stripslashes", MAY_BE_NULL | MAY_BE_STRING),
- F1("stripcslashes", MAY_BE_NULL | MAY_BE_STRING),
- F1("strstr", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("stristr", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("strrchr", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("str_shuffle", MAY_BE_NULL | MAY_BE_STRING),
- F1("str_word_count", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
- F1("str_split", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
+ F0("phpinfo", MAY_BE_TRUE),
+ F1("phpversion", MAY_BE_FALSE | MAY_BE_STRING),
+ F0("phpcredits", MAY_BE_TRUE),
+ F1("php_sapi_name", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("php_uname", MAY_BE_STRING),
+ F1("php_ini_scanned_files", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("php_ini_loaded_file", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("strtok", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("strrev", MAY_BE_STRING),
+ F1("hebrev", MAY_BE_STRING),
+ F1("basename", MAY_BE_STRING),
+ F1("dirname", MAY_BE_STRING),
+ F1("pathinfo", MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING),
+ F1("stripslashes", MAY_BE_STRING),
+ F1("stripcslashes", MAY_BE_STRING),
+ F1("strstr", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("stristr", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("strrchr", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("str_shuffle", MAY_BE_STRING),
+ F1("str_word_count", MAY_BE_LONG | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
+ F1("str_split", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
F1("strpbrk", MAY_BE_FALSE | MAY_BE_STRING),
- F0("substr_compare", MAY_BE_FALSE | MAY_BE_LONG),
- F0("strcoll", MAY_BE_NULL | MAY_BE_LONG),
-#ifdef HAVE_STRFMON
- F1("money_format", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
-#endif
- FN("substr", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- FN("substr_replace", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING),
- F1("quotemeta", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- FN("ucfirst", MAY_BE_NULL | MAY_BE_STRING),
- FN("lcfirst", MAY_BE_NULL | MAY_BE_STRING),
- F1("ucwords", MAY_BE_NULL | MAY_BE_STRING),
- FN("strtr", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- FN("addslashes", MAY_BE_NULL | MAY_BE_STRING),
- F1("addcslashes", MAY_BE_NULL | MAY_BE_STRING),
- FN("rtrim", MAY_BE_NULL | MAY_BE_STRING),
- FN("str_replace", MAY_BE_NULL | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY | MAY_BE_ARRAY_OF_OBJECT),
- FN("str_ireplace", MAY_BE_NULL | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY | MAY_BE_ARRAY_OF_OBJECT),
- F1("str_repeat", MAY_BE_NULL | MAY_BE_STRING),
- F1("count_chars", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG),
- F1("chunk_split", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- FN("trim", MAY_BE_NULL | MAY_BE_STRING),
- FN("ltrim", MAY_BE_NULL | MAY_BE_STRING),
- F1("strip_tags", MAY_BE_NULL | MAY_BE_STRING),
- F0("similar_text", MAY_BE_NULL | MAY_BE_LONG),
- F1("explode", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
- FN("implode", MAY_BE_NULL | MAY_BE_STRING),
- FN("join", MAY_BE_NULL | MAY_BE_STRING),
- FN("setlocale", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
+ FN("substr_replace", MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING),
+ F1("quotemeta", MAY_BE_STRING),
+ F1("ucwords", MAY_BE_STRING),
+ F1("addcslashes", MAY_BE_STRING),
+ FN("str_replace", MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY | MAY_BE_ARRAY_OF_OBJECT),
+ FN("str_ireplace", MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY | MAY_BE_ARRAY_OF_OBJECT),
+ F1("str_repeat", MAY_BE_STRING),
+ F1("count_chars", MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG),
+ F1("chunk_split", MAY_BE_STRING),
+ F1("strip_tags", MAY_BE_STRING),
+ F1("explode", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
F1("localeconv", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
#if HAVE_NL_LANGINFO
- F1("nl_langinfo", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
+ F1("nl_langinfo", MAY_BE_FALSE | MAY_BE_STRING),
#endif
- F1("soundex", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F0("levenshtein", MAY_BE_NULL | MAY_BE_LONG),
- F1("chr", MAY_BE_NULL | MAY_BE_STRING),
- F0("ord", MAY_BE_NULL | MAY_BE_LONG),
- F0("parse_str", MAY_BE_NULL),
- F1("str_getcsv", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_STRING),
- F1("str_pad", MAY_BE_NULL | MAY_BE_STRING),
- F1("chop", MAY_BE_NULL | MAY_BE_STRING),
- F1("strchr", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("sprintf", MAY_BE_FALSE | MAY_BE_STRING),
- F0("printf", MAY_BE_FALSE | MAY_BE_LONG),
- F0("vprintf", MAY_BE_FALSE | MAY_BE_LONG),
- F1("vsprintf", MAY_BE_FALSE | MAY_BE_STRING),
- F0("fprintf", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("vfprintf", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
+ F1("soundex", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("chr", MAY_BE_STRING),
+ F1("str_getcsv", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_STRING),
+ F1("strchr", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("sprintf", MAY_BE_STRING),
+ F1("vsprintf", MAY_BE_STRING),
F1("sscanf", MAY_BE_NULL | MAY_BE_LONG | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ANY),
F1("fscanf", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ANY),
F1("parse_url", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_LONG),
- F1("urlencode", MAY_BE_NULL | MAY_BE_STRING),
- F1("urldecode", MAY_BE_NULL | MAY_BE_STRING),
- F1("rawurlencode", MAY_BE_NULL | MAY_BE_STRING),
- F1("rawurldecode", MAY_BE_NULL | MAY_BE_STRING),
+ F1("urlencode", MAY_BE_STRING),
+ F1("urldecode", MAY_BE_STRING),
+ F1("rawurlencode", MAY_BE_STRING),
+ F1("rawurldecode", MAY_BE_STRING),
F1("http_build_query", MAY_BE_FALSE | MAY_BE_STRING),
#if defined(HAVE_SYMLINK) || defined(PHP_WIN32)
- F1("readlink", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F0("linkinfo", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("symlink", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("link", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
+ F1("readlink", MAY_BE_FALSE | MAY_BE_STRING),
#endif
- F0("unlink", MAY_BE_FALSE | MAY_BE_TRUE),
F1("exec", MAY_BE_FALSE | MAY_BE_STRING),
F1("system", MAY_BE_FALSE | MAY_BE_STRING),
- F1("escapeshellcmd", MAY_BE_NULL | MAY_BE_STRING),
- F1("escapeshellarg", MAY_BE_NULL | MAY_BE_STRING),
+ F1("escapeshellcmd", MAY_BE_STRING),
+ F1("escapeshellarg", MAY_BE_STRING),
F1("passthru", MAY_BE_NULL | MAY_BE_FALSE),
F1("shell_exec", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
#ifdef PHP_CAN_SUPPORT_PROC_OPEN
F1("proc_open", MAY_BE_FALSE | MAY_BE_RESOURCE),
- F0("proc_close", MAY_BE_FALSE | MAY_BE_LONG),
- F0("proc_terminate", MAY_BE_FALSE | MAY_BE_TRUE),
- F1("proc_get_status", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
-#endif
-#ifdef HAVE_NICE
- F0("proc_nice", MAY_BE_FALSE | MAY_BE_TRUE),
+ F1("proc_get_status", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
#endif
- F0("rand", MAY_BE_NULL | MAY_BE_LONG),
F1("random_bytes", MAY_BE_STRING),
- F1("random_int", MAY_BE_LONG),
- F0("srand", MAY_BE_NULL),
- F0("getrandmax", MAY_BE_NULL | MAY_BE_LONG),
- F0("mt_rand", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("mt_srand", MAY_BE_NULL),
- I0("mt_getrandmax", MAY_BE_LONG),
-#if HAVE_GETSERVBYNAME
- F0("getservbyname", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
-#endif
#if HAVE_GETSERVBYPORT
- F1("getservbyport", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
-#endif
-#if HAVE_GETPROTOBYNAME
- F0("getprotobyname", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
+ F1("getservbyport", MAY_BE_FALSE | MAY_BE_STRING),
#endif
#if HAVE_GETPROTOBYNUMBER
- F1("getprotobynumber", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
+ F1("getprotobynumber", MAY_BE_FALSE | MAY_BE_STRING),
#endif
- F0("getmyuid", MAY_BE_FALSE | MAY_BE_LONG),
- F0("getmygid", MAY_BE_FALSE | MAY_BE_LONG),
- F0("getmypid", MAY_BE_FALSE | MAY_BE_LONG),
- F0("getmyinode", MAY_BE_FALSE | MAY_BE_LONG),
- F0("getlastmod", MAY_BE_FALSE | MAY_BE_LONG),
- F1("base64_decode", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("base64_encode", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("password_hash", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("password_get_info", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
- F0("password_needs_rehash", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("password_verify", MAY_BE_FALSE | MAY_BE_TRUE),
+ F1("base64_decode", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("base64_encode", MAY_BE_STRING),
+ F1("password_hash", MAY_BE_STRING),
+ F1("password_get_info", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
F1("convert_uuencode", MAY_BE_FALSE | MAY_BE_STRING),
F1("convert_uudecode", MAY_BE_FALSE | MAY_BE_STRING),
- F0("abs", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_DOUBLE),
- F0("ceil", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_DOUBLE),
- F0("floor", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_DOUBLE),
- F0("round", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_DOUBLE),
- F0("sin", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("cos", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("tan", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("asin", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("acos", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("atan", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("atanh", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("atan2", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("sinh", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("cosh", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("tanh", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("asinh", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("acosh", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("expm1", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("log1p", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("pi", MAY_BE_DOUBLE),
- F0("is_finite", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("is_nan", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("is_infinite", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("pow", MAY_BE_NULL | MAY_BE_LONG | MAY_BE_DOUBLE),
- F0("exp", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("log", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_DOUBLE),
- F0("log10", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("sqrt", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("hypot", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("deg2rad", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("rad2deg", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("bindec", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_DOUBLE),
- F0("hexdec", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_DOUBLE),
- F0("octdec", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_DOUBLE),
- F1("decbin", MAY_BE_NULL | MAY_BE_STRING),
- F1("decoct", MAY_BE_NULL | MAY_BE_STRING),
- FC("dechex", zend_dechex_info),
- F1("base_convert", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("number_format", MAY_BE_NULL | MAY_BE_STRING),
- F0("fmod", MAY_BE_NULL | MAY_BE_DOUBLE),
+ F1("pow", MAY_BE_NULL | MAY_BE_LONG | MAY_BE_DOUBLE | MAY_BE_OBJECT),
+ F1("decbin", MAY_BE_STRING),
+ F1("decoct", MAY_BE_STRING),
+ F1("dechex", MAY_BE_STRING),
+ F1("base_convert", MAY_BE_STRING),
+ F1("number_format", MAY_BE_STRING),
#ifdef HAVE_INET_NTOP
F1("inet_ntop", MAY_BE_FALSE | MAY_BE_STRING),
#endif
#ifdef HAVE_INET_PTON
F1("inet_pton", MAY_BE_FALSE | MAY_BE_STRING),
#endif
- F0("ip2long", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F1("long2ip", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
+ F1("long2ip", MAY_BE_FALSE | MAY_BE_STRING),
F1("getenv", MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING),
#ifdef HAVE_PUTENV
- F0("putenv", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
#endif
F1("getopt", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
#ifdef HAVE_GETLOADAVG
F1("sys_getloadavg", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_DOUBLE),
#endif
#ifdef HAVE_GETTIMEOFDAY
- F1("microtime", MAY_BE_NULL | MAY_BE_DOUBLE | MAY_BE_STRING),
- F1("gettimeofday", MAY_BE_NULL | MAY_BE_DOUBLE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG),
+ F1("microtime", MAY_BE_DOUBLE | MAY_BE_STRING),
+ F1("gettimeofday", MAY_BE_DOUBLE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG),
#endif
#ifdef HAVE_GETRUSAGE
- F1("getrusage", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG),
+ F1("getrusage", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG),
#endif
#ifdef HAVE_GETTIMEOFDAY
- F1("uniqid", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
+ F1("uniqid", MAY_BE_STRING),
#endif
- F1("quoted_printable_decode", MAY_BE_NULL | MAY_BE_STRING),
- F1("quoted_printable_encode", MAY_BE_NULL | MAY_BE_STRING),
- F1("convert_cyr_string", MAY_BE_NULL | MAY_BE_STRING),
- I1("get_current_user", MAY_BE_STRING),
- F0("set_time_limit", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("header_register_callback", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F1("get_cfg_var", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
- I0("magic_quotes_runtime", MAY_BE_FALSE),
- I0("set_magic_quotes_runtime", MAY_BE_FALSE),
- I0("get_magic_quotes_gpc", MAY_BE_FALSE),
- I0("get_magic_quotes_runtime", MAY_BE_FALSE),
- F0("error_log", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- I1("error_get_last", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
+ F1("quoted_printable_decode", MAY_BE_STRING),
+ F1("quoted_printable_encode", MAY_BE_STRING),
+ F1("get_current_user", MAY_BE_STRING),
+ F1("get_cfg_var", MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
+ F1("error_get_last", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
FN("call_user_func", UNKNOWN_INFO),
FN("call_user_func_array", UNKNOWN_INFO),
FN("call_user_method", UNKNOWN_INFO),
FN("call_user_method_array", UNKNOWN_INFO),
FN("forward_static_call", UNKNOWN_INFO),
FN("forward_static_call_array", UNKNOWN_INFO),
- F1("serialize", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
+ F1("serialize", MAY_BE_STRING),
FN("unserialize", UNKNOWN_INFO),
- F0("var_dump", MAY_BE_NULL),
F1("var_export", MAY_BE_NULL | MAY_BE_STRING),
- F0("debug_zval_dump", MAY_BE_NULL),
F1("print_r", MAY_BE_TRUE | MAY_BE_STRING),
- F0("memory_get_usage", MAY_BE_FALSE | MAY_BE_LONG),
- F0("memory_get_peak_usage", MAY_BE_FALSE | MAY_BE_LONG),
F0("register_shutdown_function", MAY_BE_NULL | MAY_BE_FALSE),
- F0("register_tick_function", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("unregister_tick_function", MAY_BE_NULL),
- F1("highlight_file", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING),
- F1("show_source", MAY_BE_FALSE | MAY_BE_STRING),
- F1("highlight_string", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING),
- F1("php_strip_whitespace", MAY_BE_FALSE | MAY_BE_STRING),
- FN("ini_get", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("ini_get_all", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
- FN("ini_set", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("ini_alter", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F0("ini_restore", MAY_BE_NULL),
- I1("get_include_path", MAY_BE_FALSE | MAY_BE_STRING),
- F1("set_include_path", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F0("restore_include_path", MAY_BE_NULL),
- F0("setcookie", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("setrawcookie", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("header", MAY_BE_NULL),
- F0("header_remove", MAY_BE_NULL),
- F0("headers_sent", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
+ F1("highlight_file", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING),
+ F1("show_source", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
+ F1("highlight_string", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING),
+ F1("php_strip_whitespace", MAY_BE_STRING),
+ F1("ini_get_all", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
+ F1("ini_alter", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("get_include_path", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("set_include_path", MAY_BE_FALSE | MAY_BE_STRING),
F1("headers_list", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
- F0("http_response_code", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("connection_aborted", MAY_BE_LONG),
- F0("connection_status", MAY_BE_LONG),
- F0("ignore_user_abort", MAY_BE_NULL | MAY_BE_LONG),
F1("parse_ini_file", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_DOUBLE | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
F1("parse_ini_string", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_DOUBLE | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
#if ZEND_DEBUG
F1("config_get_hash", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
#endif
- F0("is_uploaded_file", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("move_uploaded_file", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F1("gethostbyaddr", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("gethostbyname", MAY_BE_NULL | MAY_BE_STRING),
- F1("gethostbynamel", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
+ F1("gethostbyaddr", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("gethostbyname", MAY_BE_STRING),
+ F1("gethostbynamel", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
#ifdef HAVE_GETHOSTNAME
F1("gethostname", MAY_BE_FALSE | MAY_BE_STRING),
#endif
#if defined(PHP_WIN32) || HAVE_DNS_SEARCH_FUNC
- F0("dns_check_record", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("checkdnsrr", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
# if defined(PHP_WIN32) || HAVE_FULL_DNS_FUNCS
- F0("dns_get_mx", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("getmxrr", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F1("dns_get_record", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ARRAY),
+ F1("dns_get_record", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ARRAY),
# endif
#endif
- F0("intval", MAY_BE_NULL | MAY_BE_LONG),
- F0("floatval", MAY_BE_NULL | MAY_BE_DOUBLE),
- F0("doubleval", MAY_BE_NULL | MAY_BE_DOUBLE),
- FN("strval", MAY_BE_NULL | MAY_BE_STRING),
- F0("boolval", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- FN("gettype", MAY_BE_NULL | MAY_BE_STRING),
- F0("settype", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- FC("is_null", zend_is_type_info),
- F0("is_resource", MAY_BE_FALSE | MAY_BE_TRUE), // TODO: inline with support for closed resources
- FC("is_bool", zend_is_type_info),
- FC("is_long", zend_is_type_info),
- FC("is_float", zend_is_type_info),
- FC("is_int", zend_is_type_info),
- FC("is_integer", zend_is_type_info),
- FC("is_double", zend_is_type_info),
- FC("is_real", zend_is_type_info),
- F0("is_numeric", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- FC("is_string", zend_is_type_info),
- FC("is_array", zend_is_type_info),
- F0("is_object", MAY_BE_FALSE | MAY_BE_TRUE), // TODO: inline with support for incomplete class
- F0("is_scalar", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("is_callable", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("is_countable", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("is_iterable", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("pclose", MAY_BE_FALSE | MAY_BE_LONG),
- F1("popen", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE),
- F0("readfile", MAY_BE_FALSE | MAY_BE_LONG),
- F0("rewind", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("rmdir", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("umask", MAY_BE_FALSE | MAY_BE_LONG),
- F0("fclose", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("feof", MAY_BE_FALSE | MAY_BE_TRUE),
+ F1("popen", MAY_BE_FALSE | MAY_BE_RESOURCE),
F1("fgetc", MAY_BE_FALSE | MAY_BE_STRING),
F1("fgets", MAY_BE_FALSE | MAY_BE_STRING),
- F1("fgetss", MAY_BE_FALSE | MAY_BE_STRING),
F1("fread", MAY_BE_FALSE | MAY_BE_STRING),
F1("fopen", MAY_BE_FALSE | MAY_BE_RESOURCE),
- F0("fpassthru", MAY_BE_FALSE | MAY_BE_LONG),
- F0("ftruncate", MAY_BE_FALSE | MAY_BE_TRUE),
F1("fstat", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_LONG),
- F0("fseek", MAY_BE_FALSE | MAY_BE_LONG),
- F0("ftell", MAY_BE_FALSE | MAY_BE_LONG),
- F0("fflush", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("fwrite", MAY_BE_FALSE | MAY_BE_LONG),
- F0("fputs", MAY_BE_FALSE | MAY_BE_LONG),
- F0("mkdir", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("rename", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("copy", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F1("tempnam", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
+ F1("tempnam", MAY_BE_FALSE | MAY_BE_STRING),
F1("tmpfile", MAY_BE_FALSE | MAY_BE_RESOURCE),
- F1("file", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
- F1("file_get_contents", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F0("file_put_contents", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("stream_select", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F1("stream_context_create", MAY_BE_FALSE | MAY_BE_RESOURCE),
+ F1("file", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
+ F1("file_get_contents", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("stream_context_create", MAY_BE_RESOURCE),
F0("stream_context_set_params", MAY_BE_FALSE | MAY_BE_TRUE),
F1("stream_context_get_params", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
- F0("stream_context_set_option", MAY_BE_FALSE | MAY_BE_TRUE),
FN("stream_context_get_options", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
FN("stream_context_get_default", MAY_BE_FALSE | MAY_BE_RESOURCE),
FN("stream_context_set_default", MAY_BE_FALSE | MAY_BE_RESOURCE),
FN("stream_filter_prepend", MAY_BE_FALSE | MAY_BE_RESOURCE),
FN("stream_filter_append", MAY_BE_FALSE | MAY_BE_RESOURCE),
- F0("stream_filter_remove", MAY_BE_FALSE | MAY_BE_TRUE),
F1("stream_socket_client", MAY_BE_FALSE | MAY_BE_RESOURCE),
F1("stream_socket_server", MAY_BE_FALSE | MAY_BE_RESOURCE),
F1("stream_socket_accept", MAY_BE_FALSE | MAY_BE_RESOURCE),
F1("stream_socket_get_name", MAY_BE_FALSE | MAY_BE_STRING),
F1("stream_socket_recvfrom", MAY_BE_FALSE | MAY_BE_STRING),
- F0("stream_socket_sendto", MAY_BE_FALSE | MAY_BE_LONG),
- F0("stream_socket_enable_crypto", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_LONG),
-#ifdef HAVE_SHUTDOWN
- F0("stream_socket_shutdown", MAY_BE_FALSE | MAY_BE_TRUE),
-#endif
#if HAVE_SOCKETPAIR
F1("stream_socket_pair", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_RESOURCE),
#endif
- F0("stream_copy_to_stream", MAY_BE_FALSE | MAY_BE_LONG),
F1("stream_get_contents", MAY_BE_FALSE | MAY_BE_STRING),
- F0("stream_supports_lock", MAY_BE_FALSE | MAY_BE_TRUE),
F1("fgetcsv", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_STRING),
- F0("fputcsv", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("flock", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F1("get_meta_tags", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING),
- F0("stream_set_read_buffer", MAY_BE_FALSE | MAY_BE_LONG),
- F0("stream_set_write_buffer", MAY_BE_FALSE | MAY_BE_LONG),
- F0("set_file_buffer", MAY_BE_FALSE | MAY_BE_LONG),
- F0("stream_set_chunk_size", MAY_BE_FALSE | MAY_BE_LONG),
- F0("stream_set_blocking", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("socket_set_blocking", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F1("stream_get_meta_data", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
+ F1("get_meta_tags", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING),
+ F1("stream_get_meta_data", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
F1("stream_get_line", MAY_BE_FALSE | MAY_BE_STRING),
- F0("stream_wrapper_register", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("stream_register_wrapper", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("stream_wrapper_unregister", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("stream_wrapper_restore", MAY_BE_FALSE | MAY_BE_TRUE),
F1("stream_get_wrappers", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
F1("stream_get_transports", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
- F1("stream_resolve_include_path", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F0("stream_is_local", MAY_BE_FALSE | MAY_BE_TRUE),
- F1("get_headers", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
-#if HAVE_SYS_TIME_H || defined(PHP_WIN32)
- F0("stream_set_timeout", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("socket_set_timeout", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
-#endif
- F1("socket_get_status", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
+ F1("stream_resolve_include_path", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("get_headers", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
+ F1("socket_get_status", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
#if HAVE_REALPATH || defined(ZTS)
- F1("realpath", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
-#endif
-#ifdef HAVE_FNMATCH
- F0("fnmatch", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
+ F1("realpath", MAY_BE_FALSE | MAY_BE_STRING),
#endif
F1("fsockopen", MAY_BE_FALSE | MAY_BE_RESOURCE),
FN("pfsockopen", MAY_BE_FALSE | MAY_BE_RESOURCE),
F1("pack", MAY_BE_FALSE | MAY_BE_STRING),
- F1("unpack", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
+ F1("unpack", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
F1("get_browser", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_OBJECT | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
- F1("crypt", MAY_BE_NULL | MAY_BE_STRING),
- FN("opendir", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE),
- F0("closedir", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("chdir", MAY_BE_FALSE | MAY_BE_TRUE),
-#if defined(HAVE_CHROOT) && !defined(ZTS) && ENABLE_CHROOT_FUNC
- F0("chroot", MAY_BE_FALSE | MAY_BE_TRUE),
-#endif
+ F1("crypt", MAY_BE_STRING),
+ FN("opendir", MAY_BE_FALSE | MAY_BE_RESOURCE),
F1("getcwd", MAY_BE_FALSE | MAY_BE_STRING),
- F0("rewinddir", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F1("readdir", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("dir", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_OBJECT),
- F1("scandir", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
+ F1("readdir", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("dir", MAY_BE_FALSE | MAY_BE_OBJECT),
+ F1("scandir", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
#ifdef HAVE_GLOB
- F1("glob", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
-#endif
- F0("fileatime", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("filectime", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("filegroup", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("fileinode", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("filemtime", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("fileowner", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("fileperms", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("filesize", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F1("filetype", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F0("file_exists", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("is_writable", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("is_writeable", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("is_readable", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("is_executable", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("is_file", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("is_dir", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("is_link", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F1("stat", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
- F1("lstat", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
- F0("chown", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("chgrp", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
-#if HAVE_LCHOWN
- F0("lchown", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
-#endif
-#if HAVE_LCHOWN
- F0("lchgrp", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
+ F1("glob", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
#endif
- F0("chmod", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
-#if HAVE_UTIME
- F0("touch", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
-#endif
- F0("clearstatcache", MAY_BE_NULL),
- F0("disk_total_space", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_DOUBLE),
- F0("disk_free_space", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_DOUBLE),
- F0("diskfreespace", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_DOUBLE),
- I0("realpath_cache_size", MAY_BE_LONG),
- I1("realpath_cache_get", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ARRAY),
- F0("mail", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("ezmlm_hash", MAY_BE_NULL | MAY_BE_LONG),
+ F1("filetype", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("stat", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
+ F1("lstat", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
+ F1("realpath_cache_get", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ARRAY),
#ifdef HAVE_SYSLOG_H
- F0("openlog", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("syslog", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
+ F0("syslog", MAY_BE_TRUE),
F0("closelog", MAY_BE_TRUE),
#endif
- F0("lcg_value", MAY_BE_DOUBLE),
- F1("metaphone", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F0("ob_start", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("ob_flush", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("ob_clean", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("ob_end_flush", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("ob_end_clean", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F1("ob_get_flush", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("ob_get_clean", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F0("ob_get_length", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("ob_get_level", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F1("ob_get_status", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
- FN("ob_get_contents", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F0("ob_implicit_flush", MAY_BE_NULL),
- F1("ob_list_handlers", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
- F0("ksort", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("krsort", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("natsort", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("natcasesort", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("asort", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("arsort", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("sort", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("rsort", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("usort", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("uasort", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("uksort", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("shuffle", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("array_walk", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("array_walk_recursive", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("count", MAY_BE_NULL | MAY_BE_LONG),
+ F1("metaphone", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("ob_get_flush", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("ob_get_clean", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("ob_get_status", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
+ F1("ob_list_handlers", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
+ F0("array_walk", MAY_BE_TRUE),
+ F0("array_walk_recursive", MAY_BE_TRUE),
+ F0("arsort", MAY_BE_TRUE),
+ F0("asort", MAY_BE_TRUE),
+ F0("krsort", MAY_BE_TRUE),
+ F0("ksort", MAY_BE_TRUE),
+ F0("shuffle", MAY_BE_TRUE),
+ F0("sort", MAY_BE_TRUE),
+ F0("usort", MAY_BE_TRUE),
+ F0("uasort", MAY_BE_TRUE),
+ F0("uksort", MAY_BE_TRUE),
FN("end", UNKNOWN_INFO),
FN("prev", UNKNOWN_INFO),
FN("next", UNKNOWN_INFO),
FN("reset", UNKNOWN_INFO),
FN("current", UNKNOWN_INFO),
- FN("key", MAY_BE_NULL | MAY_BE_LONG | MAY_BE_STRING),
FN("min", UNKNOWN_INFO),
FN("max", UNKNOWN_INFO),
- F0("in_array", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- FN("array_search", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_STRING),
- F0("extract", MAY_BE_NULL | MAY_BE_LONG),
- F1("compact", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_fill", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ANY),
- F1("array_fill_keys", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("compact", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_fill", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ANY),
+ F1("array_fill_keys", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
FC("range", zend_range_info),
- F0("array_multisort", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("array_push", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
FN("array_pop", UNKNOWN_INFO),
FN("array_shift", UNKNOWN_INFO),
- F0("array_unshift", MAY_BE_NULL | MAY_BE_LONG),
- F1("array_splice", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_slice", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- FN("array_merge", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_merge_recursive", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_replace", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_replace_recursive", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- FN("array_keys", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
- FN("array_values", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_count_values", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_LONG),
- F1("array_column", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_reverse", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_splice", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_slice", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ FN("array_merge", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_merge_recursive", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_replace", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_replace_recursive", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ FN("array_keys", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
+ FN("array_values", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_count_values", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_LONG),
+ F1("array_column", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_reverse", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
F1("array_reduce", UNKNOWN_INFO),
- FN("array_pad", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_flip", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
- F1("array_change_key_case", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ FN("array_pad", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_flip", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
+ F1("array_change_key_case", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
F1("array_rand", UNKNOWN_INFO),
- FN("array_unique", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_intersect", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_intersect_key", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_intersect_ukey", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_uintersect", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_intersect_assoc", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_uintersect_assoc", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_intersect_uassoc", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_uintersect_uassoc", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- FN("array_diff", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_diff_key", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_diff_ukey", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_udiff", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_diff_assoc", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_udiff_assoc", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_diff_uassoc", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_udiff_uassoc", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F0("array_sum", MAY_BE_NULL | MAY_BE_LONG | MAY_BE_DOUBLE),
- F0("array_product", MAY_BE_NULL | MAY_BE_LONG | MAY_BE_DOUBLE),
- F1("array_filter", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- FN("array_map", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_chunk", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("array_combine", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F0("array_key_exists", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- FN("array_key_first", MAY_BE_NULL | MAY_BE_LONG | MAY_BE_STRING),
- FN("array_key_last", MAY_BE_NULL | MAY_BE_LONG | MAY_BE_STRING),
+ FN("array_unique", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_intersect", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_intersect_key", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_intersect_ukey", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_uintersect", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_intersect_assoc", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_uintersect_assoc", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_intersect_uassoc", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_uintersect_uassoc", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ FN("array_diff", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_diff_key", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_diff_ukey", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_udiff", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_diff_assoc", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_udiff_assoc", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_diff_uassoc", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_udiff_uassoc", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_filter", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ FN("array_map", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_chunk", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("array_combine", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
F1("pos", UNKNOWN_INFO),
- F0("sizeof", MAY_BE_NULL | MAY_BE_LONG),
- F0("key_exists", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("assert", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
F1("assert_options", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_OBJECT | MAY_BE_OBJECT),
- F0("version_compare", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_LONG),
-#if HAVE_FTOK
- F0("ftok", MAY_BE_NULL | MAY_BE_LONG),
-#endif
- F1("str_rot13", MAY_BE_NULL | MAY_BE_STRING),
- I1("stream_get_filters", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
- F0("stream_filter_register", MAY_BE_FALSE | MAY_BE_TRUE),
- F1("stream_bucket_make_writeable", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_OBJECT),
- F1("stream_bucket_prepend", MAY_BE_FALSE | MAY_BE_OBJECT),
- F1("stream_bucket_append", MAY_BE_FALSE | MAY_BE_OBJECT),
+ F1("str_rot13", MAY_BE_STRING),
+ F1("stream_get_filters", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
+ F1("stream_bucket_make_writeable", MAY_BE_NULL | MAY_BE_OBJECT),
F1("stream_bucket_new", MAY_BE_FALSE | MAY_BE_OBJECT),
- F0("output_add_rewrite_var", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("output_reset_rewrite_vars", MAY_BE_FALSE),
- I1("sys_get_temp_dir", MAY_BE_STRING),
+ F1("sys_get_temp_dir", MAY_BE_STRING),
/* ext/date */
- F0("strtotime", MAY_BE_FALSE | MAY_BE_LONG),
- F1("date", MAY_BE_FALSE | MAY_BE_STRING),
- F0("idate", MAY_BE_FALSE | MAY_BE_LONG),
- F1("gmdate", MAY_BE_FALSE | MAY_BE_STRING),
- F0("mktime", MAY_BE_FALSE | MAY_BE_LONG),
- F0("gmmktime", MAY_BE_FALSE | MAY_BE_LONG),
- F0("checkdate", MAY_BE_FALSE | MAY_BE_TRUE),
+ F1("date", MAY_BE_STRING),
+ F1("gmdate", MAY_BE_STRING),
F1("strftime", MAY_BE_FALSE | MAY_BE_STRING),
F1("gmstrftime", MAY_BE_FALSE | MAY_BE_STRING),
- F0("time", MAY_BE_LONG),
- F1("localtime", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_LONG),
- F1("getdate", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
+ F1("localtime", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_LONG),
+ F1("getdate", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
F1("date_create", MAY_BE_FALSE | MAY_BE_OBJECT),
F1("date_create_immutable", MAY_BE_FALSE | MAY_BE_OBJECT),
F1("date_create_from_format", MAY_BE_FALSE | MAY_BE_OBJECT),
F1("date_create_immutable_from_format", MAY_BE_FALSE | MAY_BE_OBJECT),
- F1("date_parse", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
- F1("date_parse_from_format", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
+ F1("date_parse", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
+ F1("date_parse_from_format", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
F1("date_get_last_errors", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_ARRAY),
- F1("date_format", MAY_BE_FALSE | MAY_BE_STRING),
- FN("date_modify", MAY_BE_FALSE | MAY_BE_OBJECT),
- FN("date_add", MAY_BE_FALSE | MAY_BE_OBJECT),
- FN("date_sub", MAY_BE_FALSE | MAY_BE_OBJECT),
+ F1("date_format", MAY_BE_STRING),
F1("date_timezone_get", MAY_BE_FALSE | MAY_BE_OBJECT),
- FN("date_timezone_set", MAY_BE_FALSE | MAY_BE_OBJECT),
- F0("date_offset_get", MAY_BE_FALSE | MAY_BE_LONG),
- F1("date_diff", MAY_BE_FALSE | MAY_BE_OBJECT),
- FN("date_time_set", MAY_BE_FALSE | MAY_BE_OBJECT),
- FN("date_date_set", MAY_BE_FALSE | MAY_BE_OBJECT),
- FN("date_isodate_set", MAY_BE_FALSE | MAY_BE_OBJECT),
- FN("date_timestamp_set", MAY_BE_FALSE | MAY_BE_OBJECT),
- F0("date_timestamp_get", MAY_BE_FALSE | MAY_BE_LONG),
+ F1("date_diff", MAY_BE_OBJECT),
F1("timezone_open", MAY_BE_FALSE | MAY_BE_OBJECT),
- F1("timezone_name_get", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("timezone_name_get", MAY_BE_STRING),
F1("timezone_name_from_abbr", MAY_BE_FALSE | MAY_BE_STRING),
- F0("timezone_offset_get", MAY_BE_FALSE | MAY_BE_LONG),
F1("timezone_transitions_get", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
F1("timezone_location_get", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_DOUBLE | MAY_BE_ARRAY_OF_STRING),
F1("timezone_identifiers_list", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
F1("timezone_abbreviations_list", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ARRAY),
F1("timezone_version_get", MAY_BE_STRING),
F1("date_interval_create_from_date_string", MAY_BE_FALSE | MAY_BE_OBJECT),
- F1("date_interval_format", MAY_BE_FALSE | MAY_BE_STRING),
- F0("date_default_timezone_set", MAY_BE_FALSE | MAY_BE_TRUE),
+ F1("date_interval_format", MAY_BE_STRING),
F1("date_default_timezone_get", MAY_BE_STRING),
F1("date_sunrise", MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_DOUBLE | MAY_BE_STRING),
F1("date_sunset", MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_DOUBLE | MAY_BE_STRING),
- F1("date_sun_info", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE | MAY_BE_ARRAY_OF_LONG),
+ F1("date_sun_info", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE | MAY_BE_ARRAY_OF_LONG),
/* ext/preg */
- F0("preg_match", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("preg_match_all", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- FN("preg_replace", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING),
- FN("preg_replace_callback", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING),
- F1("preg_filter", MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING),
- F1("preg_split", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
- FN("preg_quote", MAY_BE_NULL | MAY_BE_STRING),
- F1("preg_grep", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F0("preg_last_error", MAY_BE_NULL | MAY_BE_LONG),
+ FN("preg_replace", MAY_BE_NULL | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING),
+ FN("preg_replace_callback", MAY_BE_NULL | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING),
+ F1("preg_filter", MAY_BE_NULL | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING),
+ F1("preg_split", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
+ F1("preg_grep", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
/* ext/mysqli */
F1("mysqli_connect", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_OBJECT),
F0("mysqli_close", MAY_BE_NULL | MAY_BE_TRUE),
- I1("mysqli_connect_error", MAY_BE_NULL | MAY_BE_STRING),
- I0("mysqli_connect_errno", MAY_BE_LONG),
+ F1("mysqli_connect_error", MAY_BE_NULL | MAY_BE_STRING),
+ F0("mysqli_connect_errno", MAY_BE_LONG),
F1("mysqli_get_client_stats", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING),
F1("mysqli_error_list", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ARRAY),
F1("mysqli_get_links_stats", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG),
@@ -981,8 +504,8 @@ static const func_info_t func_infos[] = {
F0("mysqli_field_count", MAY_BE_NULL | MAY_BE_LONG),
F0("mysqli_field_seek", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
F0("mysqli_field_tell", MAY_BE_NULL | MAY_BE_LONG),
- I1("mysqli_get_client_info", MAY_BE_STRING),
- I0("mysqli_get_client_version", MAY_BE_LONG),
+ F1("mysqli_get_client_info", MAY_BE_STRING),
+ F0("mysqli_get_client_version", MAY_BE_LONG),
F1("mysqli_get_host_info", MAY_BE_NULL | MAY_BE_STRING),
F0("mysqli_get_proto_info", MAY_BE_NULL | MAY_BE_LONG),
F1("mysqli_get_server_info", MAY_BE_NULL | MAY_BE_STRING),
@@ -1030,254 +553,157 @@ static const func_info_t func_infos[] = {
F1("mysqli_stmt_sqlstate", MAY_BE_NULL | MAY_BE_STRING),
F1("mysqli_store_result", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_OBJECT),
F0("mysqli_thread_id", MAY_BE_NULL | MAY_BE_LONG),
- I0("mysqli_thread_safe", MAY_BE_FALSE | MAY_BE_TRUE),
+ F0("mysqli_thread_safe", MAY_BE_FALSE | MAY_BE_TRUE),
F1("mysqli_use_result", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_OBJECT),
F0("mysqli_warning_count", MAY_BE_NULL | MAY_BE_LONG),
/* ext/curl */
- F1("curl_init", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE),
- F1("curl_copy_handle", MAY_BE_NULL | MAY_BE_RESOURCE),
- F1("curl_version", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
- F0("curl_setopt", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("curl_setopt_array", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- FN("curl_exec", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
+ F1("curl_init", MAY_BE_FALSE | MAY_BE_RESOURCE),
+ F1("curl_copy_handle", MAY_BE_FALSE | MAY_BE_RESOURCE),
+ F1("curl_version", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
F1("curl_getinfo", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_LONG | MAY_BE_DOUBLE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
- F1("curl_error", MAY_BE_NULL | MAY_BE_STRING),
- F0("curl_errno", MAY_BE_NULL | MAY_BE_LONG),
- F0("curl_close", MAY_BE_NULL),
+ F1("curl_error", MAY_BE_STRING),
F1("curl_strerror", MAY_BE_NULL | MAY_BE_STRING),
F1("curl_multi_strerror", MAY_BE_NULL | MAY_BE_STRING),
- F0("curl_reset", MAY_BE_NULL),
- F1("curl_escape", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("curl_unescape", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F0("curl_pause", MAY_BE_NULL | MAY_BE_LONG),
+ F1("curl_escape", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("curl_unescape", MAY_BE_FALSE | MAY_BE_STRING),
F1("curl_multi_init", MAY_BE_RESOURCE),
- F0("curl_multi_add_handle", MAY_BE_NULL | MAY_BE_LONG),
- F0("curl_multi_remove_handle", MAY_BE_NULL | MAY_BE_LONG),
- F0("curl_multi_select", MAY_BE_NULL | MAY_BE_LONG),
- F0("curl_multi_exec", MAY_BE_NULL | MAY_BE_LONG),
- FN("curl_multi_getcontent", MAY_BE_NULL | MAY_BE_STRING),
- F1("curl_multi_info_read", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_RESOURCE),
- F0("curl_multi_close", MAY_BE_NULL | MAY_BE_FALSE),
- F0("curl_multi_setopt", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- I1("curl_share_init", MAY_BE_RESOURCE),
- F0("curl_share_close", MAY_BE_NULL),
- F0("curl_share_setopt", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
+ F1("curl_multi_info_read", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_RESOURCE),
+ F1("curl_share_init", MAY_BE_RESOURCE),
F1("curl_file_create", MAY_BE_OBJECT),
/* ext/mbstring */
F1("mb_convert_case", MAY_BE_FALSE | MAY_BE_STRING),
- F1("mb_strtoupper", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("mb_strtolower", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("mb_language", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING),
- F1("mb_internal_encoding", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING),
- F1("mb_http_input", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("mb_http_output", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING),
- F1("mb_detect_order", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
- F1("mb_substitute_character", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_LONG | MAY_BE_STRING),
- F0("mb_parse_str", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F1("mb_output_handler", MAY_BE_NULL | MAY_BE_STRING),
- F1("mb_preferred_mime_name", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F0("mb_strlen", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("mb_strpos", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("mb_strrpos", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("mb_stripos", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("mb_strripos", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F1("mb_strstr", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("mb_strrchr", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("mb_stristr", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("mb_strrichr", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F0("mb_substr_count", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F1("mb_substr", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("mb_strcut", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F0("mb_strwidth", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F1("mb_strimwidth", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("mb_convert_encoding", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
- F1("mb_detect_encoding", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- I1("mb_list_encodings", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
+ F1("mb_strtoupper", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("mb_strtolower", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("mb_language", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING),
+ F1("mb_internal_encoding", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING),
+ F1("mb_http_input", MAY_BE_FALSE | MAY_BE_STRING| MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
+ F1("mb_http_output", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING),
+ F1("mb_detect_order", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
+ F1("mb_substitute_character", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_LONG | MAY_BE_STRING),
+ F1("mb_output_handler", MAY_BE_STRING),
+ F1("mb_preferred_mime_name", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("mb_strstr", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("mb_strrchr", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("mb_stristr", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("mb_strrichr", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("mb_substr", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("mb_strcut", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("mb_strimwidth", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("mb_convert_encoding", MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
+ F1("mb_detect_encoding", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("mb_list_encodings", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
F1("mb_encoding_aliases", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
- F1("mb_convert_kana", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("mb_encode_mimeheader", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("mb_decode_mimeheader", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("mb_convert_variables", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("mb_encode_numericentity", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("mb_decode_numericentity", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F0("mb_send_mail", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
+ F1("mb_convert_kana", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("mb_encode_mimeheader", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("mb_decode_mimeheader", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("mb_convert_variables", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("mb_encode_numericentity", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("mb_decode_numericentity", MAY_BE_FALSE | MAY_BE_STRING),
F1("mb_get_info", MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
- F0("mb_check_encoding", MAY_BE_FALSE | MAY_BE_TRUE),
- F1("mb_regex_encoding", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING),
- F1("mb_regex_set_options", MAY_BE_FALSE | MAY_BE_STRING),
- F0("mb_ereg", MAY_BE_FALSE | MAY_BE_LONG),
- F0("mb_eregi", MAY_BE_FALSE | MAY_BE_LONG),
+ F1("mb_regex_encoding", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING),
+ F1("mb_regex_set_options", MAY_BE_STRING),
F1("mb_ereg_replace", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
F1("mb_eregi_replace", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
F1("mb_ereg_replace_callback", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
F1("mb_split", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
- F0("mb_ereg_match", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("mb_ereg_search", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F1("mb_ereg_search_pos", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG),
- F1("mb_ereg_search_regs", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE | MAY_BE_ARRAY_OF_STRING),
- F0("mb_ereg_search_init", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
+ F1("mb_ereg_search_pos", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG),
+ F1("mb_ereg_search_regs", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE | MAY_BE_ARRAY_OF_STRING),
F1("mb_ereg_search_getregs", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE | MAY_BE_ARRAY_OF_STRING),
- F0("mb_ereg_search_getpos", MAY_BE_LONG),
- F0("mb_ereg_search_setpos", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
-
- F0("mbregex_encoding", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("mbereg", MAY_BE_FALSE | MAY_BE_LONG),
- F0("mberegi", MAY_BE_FALSE | MAY_BE_LONG),
- F1("mbereg_replace", MAY_BE_FALSE | MAY_BE_STRING),
- F1("mberegi_replace", MAY_BE_FALSE | MAY_BE_STRING),
- F1("mbsplit", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
- F0("mbereg_match", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("mbereg_search", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F1("mbereg_search_pos", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG),
- F1("mbereg_search_regs", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE | MAY_BE_ARRAY_OF_STRING),
- F0("mbereg_search_init", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F1("mbereg_search_getregs", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE | MAY_BE_ARRAY_OF_STRING),
- F0("mbereg_search_getpos", MAY_BE_LONG),
- F0("mbereg_search_setpos", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
/* ext/iconv */
- F1("iconv", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("iconv_get_encoding", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING),
- F0("iconv_set_encoding", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("iconv_strlen", MAY_BE_FALSE | MAY_BE_LONG),
+ F1("iconv", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("iconv_get_encoding", MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING),
F1("iconv_substr", MAY_BE_FALSE | MAY_BE_STRING),
- F0("iconv_strpos", MAY_BE_FALSE | MAY_BE_LONG),
- F0("iconv_strrpos", MAY_BE_FALSE | MAY_BE_LONG),
F1("iconv_mime_encode", MAY_BE_FALSE | MAY_BE_STRING),
F1("iconv_mime_decode", MAY_BE_FALSE | MAY_BE_STRING),
F1("iconv_mime_decode_headers", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
/* ext/json */
- F1("json_encode", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
+ F1("json_encode", MAY_BE_FALSE | MAY_BE_STRING),
F1("json_decode", MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
- I0("json_last_error", MAY_BE_LONG),
- I1("json_last_error_msg", MAY_BE_STRING),
+ F1("json_last_error_msg", MAY_BE_STRING),
/* ext/xml */
- FN("xml_parser_create", MAY_BE_FALSE | MAY_BE_RESOURCE),
- FN("xml_parser_create_ns", MAY_BE_FALSE | MAY_BE_RESOURCE),
- F0("xml_set_object", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("xml_set_element_handler", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("xml_set_character_data_handler", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("xml_set_processing_instruction_handler",MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("xml_set_default_handler", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("xml_set_unparsed_entity_decl_handler", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("xml_set_notation_decl_handler", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("xml_set_external_entity_ref_handler", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("xml_set_start_namespace_decl_handler", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("xml_set_end_namespace_decl_handler", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("xml_parse", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("xml_parse_into_struct", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("xml_get_error_code", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
F1("xml_error_string", MAY_BE_NULL | MAY_BE_STRING),
- F0("xml_get_current_line_number", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("xml_get_current_column_number", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("xml_get_current_byte_index", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("xml_parser_free", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("xml_parser_set_option", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
F1("xml_parser_get_option", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_STRING),
- F1("utf8_encode", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("utf8_decode", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
+ F1("utf8_encode", MAY_BE_STRING),
+ F1("utf8_decode", MAY_BE_STRING),
/* ext/zlib */
- F0("readgzfile", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("gzrewind", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("gzclose", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("gzeof", MAY_BE_FALSE | MAY_BE_TRUE),
F1("gzgetc", MAY_BE_FALSE | MAY_BE_STRING),
F1("gzgets", MAY_BE_FALSE | MAY_BE_STRING),
- F1("gzgetss", MAY_BE_FALSE | MAY_BE_STRING),
F1("gzread", MAY_BE_FALSE | MAY_BE_STRING),
F1("gzopen", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE),
- F0("gzpassthru", MAY_BE_FALSE | MAY_BE_LONG),
- F0("gzseek", MAY_BE_FALSE | MAY_BE_LONG),
- F0("gztell", MAY_BE_FALSE | MAY_BE_LONG),
- F0("gzwrite", MAY_BE_FALSE | MAY_BE_LONG),
- F0("gzputs", MAY_BE_FALSE | MAY_BE_LONG),
- F1("gzfile", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
- F1("gzcompress", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("gzuncompress", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("gzdeflate", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("gzinflate", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("gzencode", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("gzdecode", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("zlib_encode", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("zlib_decode", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- I1("zlib_get_coding_type", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("gzfile", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
+ F1("gzcompress", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("gzuncompress", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("gzdeflate", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("gzinflate", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("gzencode", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("gzdecode", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("zlib_encode", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("zlib_decode", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("zlib_get_coding_type", MAY_BE_FALSE | MAY_BE_STRING),
F1("ob_gzhandler", MAY_BE_FALSE | MAY_BE_STRING),
/* ext/hash */
- F1("hash", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F0("hash_equals", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F1("hash_file", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("hash_hmac", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
+ F1("hash", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("hash_file", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("hash_hmac", MAY_BE_FALSE | MAY_BE_STRING),
F1("hash_hmac_algos", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
- F1("hash_hmac_file", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("hash_hkdf", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("hash_init", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_OBJECT),
- F0("hash_update", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("hash_update_stream", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("hash_update_file", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F1("hash_final", MAY_BE_NULL | MAY_BE_STRING),
- F1("hash_copy", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_OBJECT),
+ F1("hash_hmac_file", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("hash_hkdf", MAY_BE_STRING),
+ F1("hash_init", MAY_BE_OBJECT),
+ F1("hash_final", MAY_BE_STRING),
+ F1("hash_copy", MAY_BE_OBJECT),
F1("hash_algos", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
- F1("hash_pbkdf2", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
+ F1("hash_pbkdf2", MAY_BE_STRING),
F1("mhash_keygen_s2k", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F0("mhash_get_block_size", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
F1("mhash_get_hash_name", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- I0("mhash_count", MAY_BE_LONG),
- F1("mhash", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
+ F1("mhash", MAY_BE_FALSE | MAY_BE_FALSE | MAY_BE_STRING),
/* ext/sodium */
- F0("sodium_memzero", MAY_BE_NULL),
- F0("sodium_increment", MAY_BE_NULL),
- F0("sodium_add", MAY_BE_NULL),
- F0("sodium_memcmp", MAY_BE_NULL | MAY_BE_LONG),
- F1("sodium_crypto_shorthash", MAY_BE_NULL | MAY_BE_STRING),
- F1("sodium_crypto_secretbox", MAY_BE_NULL | MAY_BE_STRING),
- F1("sodium_crypto_secretbox_open", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("sodium_crypto_generichash", MAY_BE_NULL | MAY_BE_STRING),
- F1("sodium_crypto_generichash_init", MAY_BE_NULL | MAY_BE_STRING),
- F0("sodium_crypto_generichash_update", MAY_BE_NULL | MAY_BE_TRUE),
- F1("sodium_crypto_generichash_final", MAY_BE_NULL | MAY_BE_STRING),
+ F1("sodium_crypto_shorthash", MAY_BE_STRING),
+ F1("sodium_crypto_secretbox", MAY_BE_STRING),
+ F1("sodium_crypto_secretbox_open", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("sodium_crypto_generichash", MAY_BE_STRING),
+ F1("sodium_crypto_generichash_init", MAY_BE_STRING),
+ F0("sodium_crypto_generichash_update", MAY_BE_TRUE),
+ F1("sodium_crypto_generichash_final", MAY_BE_STRING),
F1("sodium_crypto_box_keypair", MAY_BE_STRING),
- F1("sodium_crypto_box_seed_keypair", MAY_BE_NULL | MAY_BE_STRING),
- F1("sodium_crypto_box_secretkey", MAY_BE_NULL | MAY_BE_STRING),
- F1("sodium_crypto_box_publickey", MAY_BE_NULL | MAY_BE_STRING),
- F1("sodium_crypto_box", MAY_BE_NULL | MAY_BE_STRING),
- F1("sodium_crypto_box_open", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("sodium_crypto_box_seal", MAY_BE_NULL | MAY_BE_STRING),
- F1("sodium_crypto_box_seal_open", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
+ F1("sodium_crypto_box_seed_keypair", MAY_BE_STRING),
+ F1("sodium_crypto_box_secretkey", MAY_BE_STRING),
+ F1("sodium_crypto_box_publickey", MAY_BE_STRING),
+ F1("sodium_crypto_box", MAY_BE_STRING),
+ F1("sodium_crypto_box_open", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("sodium_crypto_box_seal", MAY_BE_STRING),
+ F1("sodium_crypto_box_seal_open", MAY_BE_FALSE | MAY_BE_STRING),
F1("sodium_crypto_sign_keypair", MAY_BE_STRING),
- F1("sodium_crypto_sign_seed_keypair", MAY_BE_NULL | MAY_BE_STRING),
- F1("sodium_crypto_sign_secretkey", MAY_BE_NULL | MAY_BE_STRING),
- F1("sodium_crypto_sign_publickey", MAY_BE_NULL | MAY_BE_STRING),
- F1("sodium_crypto_sign", MAY_BE_NULL | MAY_BE_STRING),
- F1("sodium_crypto_sign_open", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("sodium_crypto_sign_detached", MAY_BE_NULL | MAY_BE_STRING),
- F0("sodium_crypto_sign_verify_detached", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F1("sodium_crypto_stream", MAY_BE_NULL | MAY_BE_STRING),
- F1("sodium_crypto_stream_xor", MAY_BE_NULL | MAY_BE_STRING),
- F1("sodium_crypto_pwhash", MAY_BE_NULL | MAY_BE_STRING),
- F1("sodium_crypto_pwhash_str", MAY_BE_NULL | MAY_BE_STRING),
- F0("sodium_crypto_pwhash_str_verify", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F1("sodium_crypto_aead_aes256gcm_encrypt", MAY_BE_NULL | MAY_BE_STRING),
- F1("sodium_crypto_aead_aes256gcm_decrypt", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("sodium_bin2hex", MAY_BE_NULL | MAY_BE_STRING),
- F1("sodium_hex2bin", MAY_BE_NULL | MAY_BE_STRING),
- F1("sodium_crypto_scalarmult", MAY_BE_NULL | MAY_BE_STRING),
- F1("sodium_crypto_kx_seed_keypair", MAY_BE_NULL | MAY_BE_STRING),
+ F1("sodium_crypto_sign_seed_keypair", MAY_BE_STRING),
+ F1("sodium_crypto_sign_secretkey", MAY_BE_STRING),
+ F1("sodium_crypto_sign_publickey", MAY_BE_STRING),
+ F1("sodium_crypto_sign", MAY_BE_STRING),
+ F1("sodium_crypto_sign_open", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("sodium_crypto_sign_detached", MAY_BE_STRING),
+ F1("sodium_crypto_stream", MAY_BE_STRING),
+ F1("sodium_crypto_stream_xor", MAY_BE_STRING),
+ F1("sodium_crypto_pwhash", MAY_BE_STRING),
+ F1("sodium_crypto_pwhash_str", MAY_BE_STRING),
+ F1("sodium_crypto_aead_aes256gcm_encrypt", MAY_BE_STRING),
+ F1("sodium_crypto_aead_aes256gcm_decrypt", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("sodium_bin2hex", MAY_BE_STRING),
+ F1("sodium_hex2bin", MAY_BE_STRING),
+ F1("sodium_crypto_scalarmult", MAY_BE_STRING),
+ F1("sodium_crypto_kx_seed_keypair", MAY_BE_STRING),
F1("sodium_crypto_kx_keypair", MAY_BE_STRING),
F1("sodium_crypto_kx_secretkey", MAY_BE_NULL | MAY_BE_STRING),
F1("sodium_crypto_kx_publickey", MAY_BE_NULL | MAY_BE_STRING),
F1("sodium_crypto_kx_client_session_keys", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
F1("sodium_crypto_kx_server_session_keys", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
F1("sodium_crypto_auth", MAY_BE_NULL | MAY_BE_STRING),
- F0("sodium_crypto_auth_verify", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("sodium_compare", MAY_BE_NULL | MAY_BE_LONG),
F1("sodium_crypto_aead_aes256gcm_keygen", MAY_BE_STRING),
F1("sodium_crypto_auth_keygen", MAY_BE_STRING),
F1("sodium_crypto_generichash_keygen", MAY_BE_STRING),
@@ -1285,53 +711,36 @@ static const func_info_t func_infos[] = {
F1("sodium_crypto_secretbox_keygen", MAY_BE_STRING),
F1("sodium_crypto_shorthash_keygen", MAY_BE_STRING),
F1("sodium_crypto_stream_keygen", MAY_BE_STRING),
- F1("sodium_crypto_kdf_derive_from_key", MAY_BE_NULL | MAY_BE_STRING),
- F1("sodium_pad", MAY_BE_NULL | MAY_BE_STRING),
- F1("sodium_unpad", MAY_BE_NULL | MAY_BE_STRING),
+ F1("sodium_crypto_kdf_derive_from_key", MAY_BE_STRING),
+ F1("sodium_pad", MAY_BE_STRING),
+ F1("sodium_unpad", MAY_BE_STRING),
- F1("sodium_crypto_box_keypair_from_secretkey_and_publickey", MAY_BE_NULL | MAY_BE_STRING),
- F1("sodium_crypto_box_publickey_from_secretkey", MAY_BE_NULL | MAY_BE_STRING),
- F1("sodium_crypto_sign_keypair_from_secretkey_and_publickey", MAY_BE_NULL | MAY_BE_STRING),
- F1("sodium_crypto_sign_publickey_from_secretkey", MAY_BE_NULL | MAY_BE_STRING),
- F1("sodium_crypto_pwhash_scryptsalsa208sha256", MAY_BE_NULL | MAY_BE_STRING),
- F1("sodium_crypto_pwhash_scryptsalsa208sha256_str", MAY_BE_NULL | MAY_BE_STRING),
- F0("sodium_crypto_pwhash_scryptsalsa208sha256_str_verify", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("sodium_crypto_aead_aes256gcm_is_available", MAY_BE_FALSE | MAY_BE_TRUE),
- F1("sodium_crypto_sign_ed25519_sk_to_curve25519", MAY_BE_NULL | MAY_BE_STRING),
- F1("sodium_crypto_sign_ed25519_pk_to_curve25519", MAY_BE_NULL | MAY_BE_STRING),
- F1("sodium_crypto_aead_chacha20poly1305_encrypt", MAY_BE_NULL | MAY_BE_STRING),
- F1("sodium_crypto_aead_chacha20poly1305_decrypt", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("sodium_crypto_aead_chacha20poly1305_ietf_encrypt", MAY_BE_NULL | MAY_BE_STRING),
- F1("sodium_crypto_aead_chacha20poly1305_ietf_decrypt", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("sodium_crypto_aead_xchacha20poly1305_ietf_encrypt", MAY_BE_NULL | MAY_BE_STRING),
+ F1("sodium_crypto_box_keypair_from_secretkey_and_publickey", MAY_BE_STRING),
+ F1("sodium_crypto_box_publickey_from_secretkey", MAY_BE_STRING),
+ F1("sodium_crypto_sign_keypair_from_secretkey_and_publickey", MAY_BE_STRING),
+ F1("sodium_crypto_sign_publickey_from_secretkey", MAY_BE_STRING),
+ F1("sodium_crypto_pwhash_scryptsalsa208sha256", MAY_BE_STRING),
+ F1("sodium_crypto_pwhash_scryptsalsa208sha256_str", MAY_BE_STRING),
+ F1("sodium_crypto_sign_ed25519_sk_to_curve25519", MAY_BE_STRING),
+ F1("sodium_crypto_sign_ed25519_pk_to_curve25519", MAY_BE_STRING),
+ F1("sodium_crypto_aead_chacha20poly1305_encrypt", MAY_BE_STRING),
+ F1("sodium_crypto_aead_chacha20poly1305_decrypt", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("sodium_crypto_aead_chacha20poly1305_ietf_encrypt", MAY_BE_STRING),
+ F1("sodium_crypto_aead_chacha20poly1305_ietf_decrypt", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("sodium_crypto_aead_xchacha20poly1305_ietf_encrypt", MAY_BE_STRING),
F1("sodium_crypto_aead_xchacha20poly1305_ietf_decrypt", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
F1("sodium_crypto_aead_chacha20poly1305_keygen", MAY_BE_STRING),
F1("sodium_crypto_aead_chacha20poly1305_ietf_keygen", MAY_BE_STRING),
F1("sodium_crypto_aead_xchacha20poly1305_ietf_keygen", MAY_BE_STRING),
/* ext/session */
- F0("session_set_cookie_params", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- I1("session_get_cookie_params", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
- F1("session_name", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("session_module_name", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F0("session_set_save_handler", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F1("session_save_path", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- FN("session_id", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F0("session_regenerate_id", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F1("session_create_id", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("session_cache_limiter", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F0("session_cache_expire", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- I1("session_encode", MAY_BE_FALSE | MAY_BE_STRING),
- F0("session_decode", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("session_start", MAY_BE_FALSE | MAY_BE_TRUE),
- I0("session_destroy", MAY_BE_FALSE | MAY_BE_TRUE),
- I0("session_unset", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("session_gc", MAY_BE_FALSE | MAY_BE_LONG),
- F0("session_write_close", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("session_abort", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("session_reset", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("session_status", MAY_BE_NULL | MAY_BE_LONG),
- I0("session_register_shutdown", MAY_BE_NULL),
+ F1("session_get_cookie_params", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
+ F1("session_name", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("session_module_name", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("session_save_path", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("session_create_id", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("session_cache_limiter", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("session_encode", MAY_BE_FALSE | MAY_BE_STRING),
/* ext/pgsql */
F1("pg_connect", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE),
@@ -1423,201 +832,103 @@ static const func_info_t func_infos[] = {
F1("pg_select", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING),
/* ext/bcmath */
- F1("bcadd", MAY_BE_NULL | MAY_BE_STRING),
- F1("bcsub", MAY_BE_NULL | MAY_BE_STRING),
- F1("bcmul", MAY_BE_NULL | MAY_BE_STRING),
- F1("bcdiv", MAY_BE_NULL | MAY_BE_STRING),
- F1("bcmod", MAY_BE_NULL | MAY_BE_STRING),
- F1("bcpowmod", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("bcpow", MAY_BE_NULL | MAY_BE_STRING),
- F1("bcsqrt", MAY_BE_NULL | MAY_BE_STRING),
- F0("bccomp", MAY_BE_NULL | MAY_BE_LONG),
- F0("bcscale", MAY_BE_NULL | MAY_BE_LONG),
+ F1("bcadd", MAY_BE_STRING),
+ F1("bcsub", MAY_BE_STRING),
+ F1("bcmul", MAY_BE_STRING),
+ F1("bcdiv", MAY_BE_STRING),
+ F1("bcmod", MAY_BE_STRING),
+ F1("bcpowmod", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("bcpow", MAY_BE_STRING),
+ F1("bcsqrt", MAY_BE_STRING),
/* ext/exif */
- F1("exif_tagname", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("exif_read_data", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
- F1("exif_thumbnail", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F0("exif_imagetype", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
+ F1("exif_tagname", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("exif_read_data", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
+ F1("exif_thumbnail", MAY_BE_FALSE | MAY_BE_STRING),
/* ext/filter */
- F0("filter_has_var", MAY_BE_FALSE | MAY_BE_TRUE),
FN("filter_input", UNKNOWN_INFO),
FN("filter_var", UNKNOWN_INFO),
F1("filter_input_array", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
F1("filter_var_array", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
- I1("filter_list", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
- F0("filter_id", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
+ F1("filter_list", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
/* ext/gettext */
- F1("textdomain", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("gettext", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("_", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("dgettext", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("dcgettext", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("bindtextdomain", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
+ F1("textdomain", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("gettext", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("_", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("dgettext", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("dcgettext", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("bindtextdomain", MAY_BE_FALSE | MAY_BE_STRING),
#if HAVE_NGETTEXT
- F1("ngettext", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
+ F1("ngettext", MAY_BE_FALSE | MAY_BE_STRING),
#endif
#if HAVE_DNGETTEXT
- F1("dcngettext", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
+ F1("dcngettext", MAY_BE_FALSE | MAY_BE_STRING),
#endif
#if HAVE_BIND_TEXTDOMAIN_CODESET
- F1("bind_textdomain_codeset", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
+ F1("bind_textdomain_codeset", MAY_BE_FALSE | MAY_BE_STRING),
#endif
- /* ext/ctype */
- F0("ctype_alnum", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("ctype_alpha", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("ctype_cntrl", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("ctype_digit", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("ctype_lower", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("ctype_graph", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("ctype_print", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("ctype_punct", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("ctype_space", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("ctype_upper", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("ctype_xdigit", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
-
/* ext/fileinfo */
F1("finfo_open", MAY_BE_FALSE | MAY_BE_RESOURCE),
- F0("finfo_close", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("finfo_set_flags", MAY_BE_FALSE | MAY_BE_TRUE),
- F1("finfo_file", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("finfo_buffer", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
- F1("mime_content_type", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
+ F1("finfo_file", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("finfo_buffer", MAY_BE_FALSE | MAY_BE_STRING),
+ F1("mime_content_type", MAY_BE_FALSE | MAY_BE_STRING),
/* ext/gd */
F1("gd_info", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_FALSE | MAY_BE_ARRAY_OF_TRUE),
- F0("imageloadfont", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("imagesetstyle", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F1("imagecreatetruecolor", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE),
- F0("imageistruecolor", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagetruecolortopalette", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagepalettetotruecolor", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagecolormatch", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagesetthickness", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagefilledellipse", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagefilledarc", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagealphablending", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagesavealpha", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagelayereffect", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagecolorallocatealpha", MAY_BE_FALSE | MAY_BE_LONG),
- F0("imagecolorresolvealpha", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("imagecolorclosestalpha", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("imagecolorexactalpha", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("imagecopyresampled", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
+ F1("imagecreatetruecolor", MAY_BE_FALSE | MAY_BE_OBJECT),
#ifdef PHP_WIN32
- F1("imagegrabwindow", MAY_BE_FALSE | MAY_BE_RESOURCE),
- F1("imagegrabscreen", MAY_BE_FALSE | MAY_BE_RESOURCE),
+ F1("imagegrabwindow", MAY_BE_FALSE | MAY_BE_OBJECT),
+ F1("imagegrabscreen", MAY_BE_FALSE | MAY_BE_OBJECT),
#endif
- F1("imagerotate", MAY_BE_FALSE | MAY_BE_RESOURCE),
- F0("imagesettile", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagesetbrush", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F1("imagecreate", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE),
- I0("imagetypes", MAY_BE_LONG),
- F1("imagecreatefromstring", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE),
- F1("imagecreatefromgif", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE),
+ F1("imagerotate", MAY_BE_FALSE | MAY_BE_OBJECT),
+ F1("imagecreate", MAY_BE_FALSE | MAY_BE_OBJECT),
+ F1("imagecreatefromstring", MAY_BE_FALSE | MAY_BE_OBJECT),
+ F1("imagecreatefromgif", MAY_BE_FALSE | MAY_BE_OBJECT),
#ifdef HAVE_GD_JPG
- F1("imagecreatefromjpeg", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE),
- F0("imagejpeg", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("jpeg2wbmp", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
+ F1("imagecreatefromjpeg", MAY_BE_FALSE | MAY_BE_OBJECT),
#endif
#ifdef HAVE_GD_PNG
- F1("imagecreatefrompng", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE),
- F0("imagepng", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("png2wbmp", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
+ F1("imagecreatefrompng", MAY_BE_FALSE | MAY_BE_OBJECT),
#endif
#ifdef HAVE_GD_WEBP
- F1("imagecreatefromwebp", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE),
- F0("imagewebp", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
+ F1("imagecreatefromwebp", MAY_BE_FALSE | MAY_BE_OBJECT),
#endif
- F1("imagecreatefromxbm", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE),
+ F1("imagecreatefromxbm", MAY_BE_FALSE | MAY_BE_OBJECT),
#if defined(HAVE_GD_XPM)
- F1("imagecreatefromxpm", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE),
+ F1("imagecreatefromxpm", MAY_BE_FALSE | MAY_BE_OBJECT),
#endif
- F1("imagecreatefromwbmp", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE),
- F1("imagecreatefromgd", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE),
- F1("imagecreatefromgd2", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE),
- F1("imagecreatefromgd2part", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE),
+ F1("imagecreatefromwbmp", MAY_BE_FALSE | MAY_BE_OBJECT),
+ F1("imagecreatefromgd", MAY_BE_FALSE | MAY_BE_OBJECT),
+ F1("imagecreatefromgd2", MAY_BE_FALSE | MAY_BE_OBJECT),
+ F1("imagecreatefromgd2part", MAY_BE_FALSE | MAY_BE_OBJECT),
#if defined(HAVE_GD_BMP)
- F1("imagecreatefrombmp", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE),
- F0("imagebmp", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
+ F1("imagecreatefrombmp", MAY_BE_FALSE | MAY_BE_OBJECT),
#endif
- F0("imagexbm", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagegif", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagewbmp", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagegd", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagegd2", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagedestroy", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagecolorallocate", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("imagepalettecopy", MAY_BE_NULL | MAY_BE_FALSE),
- F0("imagecolorat", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("imagecolorclosest", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("imagecolorclosesthwb", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("imagecolordeallocate", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagecolorresolve", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("imagecolorexact", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
F0("imagecolorset", MAY_BE_NULL | MAY_BE_FALSE),
- F1("imagecolorsforindex", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG),
- F0("imagegammacorrect", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagesetpixel", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imageline", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagedashedline", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagerectangle", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagefilledrectangle", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagearc", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imageellipse", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagefilltoborder", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagefill", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagecolorstotal", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("imagecolortransparent", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("imageinterlace", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("imagepolygon", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imageopenpolygon", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagefilledpolygon", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagefontwidth", MAY_BE_NULL | MAY_BE_LONG),
- F0("imagefontheight", MAY_BE_NULL | MAY_BE_LONG),
- F0("imagechar", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagecharup", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagestring", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagestringup", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagecopy", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagecopymerge", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagecopymergegray", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagecopyresized", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagesx", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("imagesy", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_LONG),
- F0("imagesetclip", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F1("imagegetclip", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG),
- F1("imageftbbox", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG),
- F1("imagefttext", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG),
- F1("imagettfbbox", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG),
- F1("imagettftext", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG),
- F0("image2wbmp", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imagefilter", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imageconvolution", MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imageflip", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F0("imageantialias", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F1("imagecrop", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE),
- F1("imagecropauto", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE),
- F1("imagescale", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE),
- F1("imageaffine", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_RESOURCE),
- F1("imageaffinematrixget", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_DOUBLE),
- F1("imageaffinematrixconcat", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_DOUBLE),
- F0("imagesetinterpolation", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE),
- F1("imageresolution", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG),
+ F1("imagecolorsforindex", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG),
+ F1("imagegetclip", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG),
+ F1("imageftbbox", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG),
+ F1("imagefttext", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG),
+ F1("imagettfbbox", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG),
+ F1("imagettftext", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG),
+ F1("imagecrop", MAY_BE_FALSE | MAY_BE_OBJECT),
+ F1("imagecropauto", MAY_BE_FALSE | MAY_BE_OBJECT),
+ F1("imagescale", MAY_BE_FALSE | MAY_BE_OBJECT),
+ F1("imageaffine", MAY_BE_FALSE | MAY_BE_OBJECT),
+ F1("imageaffinematrixget", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_DOUBLE),
+ F1("imageaffinematrixconcat", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_DOUBLE),
+ F1("imageresolution", MAY_BE_TRUE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG),
/* ext/spl */
F1("class_implements", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING),
F1("class_parents", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING),
F1("class_uses", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING),
- F0("iterator_apply", MAY_BE_NULL | MAY_BE_LONG),
- F0("iterator_count", MAY_BE_FALSE | MAY_BE_LONG),
- F1("iterator_to_array", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
- F1("spl_classes", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING),
- F1("spl_object_hash", MAY_BE_NULL | MAY_BE_STRING),
- F0("spl_object_id", MAY_BE_NULL | MAY_BE_LONG),
+ F1("iterator_to_array", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
+ F1("spl_classes", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING),
+ F1("spl_object_hash", MAY_BE_STRING),
};
@@ -1631,30 +942,33 @@ uint32_t zend_get_func_info(const zend_call_info *call_info, const zend_ssa *ssa
if (callee_func->type == ZEND_INTERNAL_FUNCTION) {
zval *zv;
- func_info_t *info;
+ zend_string *lcname = Z_STR_P(CRT_CONSTANT_EX(call_info->caller_op_array, call_info->caller_init_opline, call_info->caller_init_opline->op2));
- if (!call_info->callee_func->common.scope && (zv = zend_hash_find_ex(&func_info, Z_STR_P(CRT_CONSTANT_EX(call_info->caller_op_array, call_info->caller_init_opline, call_info->caller_init_opline->op2, ssa->rt_constants)), 1))) {
- info = Z_PTR_P(zv);
+ if (!call_info->callee_func->common.scope
+ && (zv = zend_hash_find_ex(&func_info, lcname, 1))) {
+ func_info_t *info = Z_PTR_P(zv);
if (UNEXPECTED(zend_optimizer_is_disabled_func(info->name, info->name_len))) {
ret = MAY_BE_NULL;
} else if (info->info_func) {
ret = info->info_func(call_info, ssa);
- } else if (/*callee_func->common.arg_info && */
- callee_func->common.num_args == 0 &&
- callee_func->common.required_num_args == 0 &&
- !(callee_func->common.fn_flags & ZEND_ACC_VARIADIC)) {
- if (call_info->num_args == 0) {
- ret = info->info;
- } else {
- ret = FUNC_MAY_WARN | MAY_BE_NULL;
- }
} else {
ret = info->info;
}
-#if 0
+ return ret;
+ }
+
+ if (callee_func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) {
+ zend_class_entry *ce; // TODO: Use the CE.
+ ret = zend_fetch_arg_info_type(NULL, callee_func->common.arg_info - 1, &ce);
} else {
+#if 0
fprintf(stderr, "Unknown internal function '%s'\n", func->common.function_name);
#endif
+ ret = MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF
+ | MAY_BE_RC1 | MAY_BE_RCN;
+ }
+ if (callee_func->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) {
+ ret |= MAY_BE_REF;
}
} else {
// FIXME: the order of functions matters!!!
@@ -1662,18 +976,14 @@ uint32_t zend_get_func_info(const zend_call_info *call_info, const zend_ssa *ssa
if (info) {
ret = info->return_info.type;
}
- }
- if (!ret) {
- ret = MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF;
- if (callee_func->type == ZEND_INTERNAL_FUNCTION) {
- ret |= FUNC_MAY_WARN;
- }
- if (callee_func->common.fn_flags & ZEND_ACC_GENERATOR) {
- ret = MAY_BE_RC1 | MAY_BE_RCN | MAY_BE_OBJECT;
- } else if (callee_func->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) {
- ret |= MAY_BE_REF;
- } else {
- ret |= MAY_BE_RC1 | MAY_BE_RCN;
+ if (!ret) {
+ ret = MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF
+ | MAY_BE_RC1 | MAY_BE_RCN;
+ /* For generators RETURN_REFERENCE refers to the yielded values. */
+ if ((callee_func->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)
+ && !(callee_func->common.fn_flags & ZEND_ACC_GENERATOR)) {
+ ret |= MAY_BE_REF;
+ }
}
}
return ret;
diff --git a/ext/opcache/Optimizer/zend_func_info.h b/ext/opcache/Optimizer/zend_func_info.h
index 7eeb363da5..0f4fcea092 100644
--- a/ext/opcache/Optimizer/zend_func_info.h
+++ b/ext/opcache/Optimizer/zend_func_info.h
@@ -34,11 +34,6 @@
#define ZEND_FUNC_HAS_EXTENDED_FCALL (1<<10)
#define ZEND_FUNC_HAS_EXTENDED_STMT (1<<11)
-/* The following flags are valid only for return values of internal functions
- * returned by zend_get_func_info()
- */
-#define FUNC_MAY_WARN (1<<30)
-
typedef struct _zend_func_info zend_func_info;
typedef struct _zend_call_info zend_call_info;
diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c
index 7accf73a5d..90273e2ffd 100644
--- a/ext/opcache/Optimizer/zend_inference.c
+++ b/ext/opcache/Optimizer/zend_inference.c
@@ -1030,23 +1030,7 @@ int zend_inference_calc_range(const zend_op_array *op_array, zend_ssa *ssa, int
}
}
} else if (ssa->ops[line].result_def == var) {
- if (opline->extended_value == IS_NULL) {
- tmp->min = 0;
- tmp->max = 0;
- return 1;
- } else if (opline->extended_value == _IS_BOOL) {
- if (OP1_HAS_RANGE()) {
- op1_min = OP1_MIN_RANGE();
- op1_max = OP1_MAX_RANGE();
- tmp->min = (op1_min > 0 || op1_max < 0);
- tmp->max = (op1_min != 0 || op1_max != 0);
- return 1;
- } else {
- tmp->min = 0;
- tmp->max = 1;
- return 1;
- }
- } else if (opline->extended_value == IS_LONG) {
+ if (opline->extended_value == IS_LONG) {
if (OP1_HAS_RANGE()) {
tmp->min = OP1_MIN_RANGE();
tmp->max = OP1_MAX_RANGE();
@@ -1419,13 +1403,15 @@ int zend_inference_calc_range(const zend_op_array *op_array, zend_ssa *ssa, int
return 1;
} else if (op_array->arg_info &&
opline->op1.num <= op_array->num_args) {
- if (ZEND_TYPE_CODE(op_array->arg_info[opline->op1.num-1].type) == IS_LONG) {
+ zend_type type = op_array->arg_info[opline->op1.num-1].type;
+ uint32_t mask = ZEND_TYPE_PURE_MASK_WITHOUT_NULL(type);
+ if (mask == MAY_BE_LONG) {
tmp->underflow = 0;
tmp->min = ZEND_LONG_MIN;
tmp->max = ZEND_LONG_MAX;
tmp->overflow = 0;
return 1;
- } else if (ZEND_TYPE_CODE(op_array->arg_info[opline->op1.num-1].type) == _IS_BOOL) {
+ } else if (mask == MAY_BE_BOOL) {
tmp->underflow = 0;
tmp->min = 0;
tmp->max = 1;
@@ -1833,9 +1819,7 @@ static int zend_infer_ranges(const zend_op_array *op_array, zend_ssa *ssa) /* {{
/* }}} */
static uint32_t get_ssa_alias_types(zend_ssa_alias_kind alias) {
- if (alias == PHP_ERRORMSG_ALIAS) {
- return MAY_BE_STRING | MAY_BE_RC1 | MAY_BE_RCN;
- } else if (alias == HTTP_RESPONSE_HEADER_ALIAS) {
+ if (alias == HTTP_RESPONSE_HEADER_ALIAS) {
return MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_RC1 | MAY_BE_RCN;
} else {
return MAY_BE_UNDEF | MAY_BE_RC1 | MAY_BE_RCN | MAY_BE_REF | MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF;
@@ -2063,16 +2047,10 @@ uint32_t zend_array_element_type(uint32_t t1, int write, int insert)
}
if (t1 & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE)) {
tmp |= MAY_BE_NULL;
- if (t1 & MAY_BE_ERROR) {
- if (write) {
- tmp |= MAY_BE_ERROR;
- }
- }
}
if (t1 & (MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_RESOURCE)) {
- tmp |= MAY_BE_NULL;
- if (write) {
- tmp |= MAY_BE_ERROR;
+ if (!write) {
+ tmp |= MAY_BE_NULL;
}
}
return tmp;
@@ -2234,42 +2212,43 @@ static inline zend_class_entry *get_class_entry(const zend_script *script, zend_
return NULL;
}
-static uint32_t zend_convert_type_code_to_may_be(zend_uchar type_code) {
- switch (type_code) {
- case IS_VOID:
- return MAY_BE_NULL;
- case IS_CALLABLE:
- return MAY_BE_STRING|MAY_BE_OBJECT|MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_ANY|MAY_BE_ARRAY_OF_ANY|MAY_BE_ARRAY_OF_REF;
- case IS_ITERABLE:
- return MAY_BE_OBJECT|MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_ANY|MAY_BE_ARRAY_OF_ANY|MAY_BE_ARRAY_OF_REF;
- case IS_ARRAY:
- return MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_ANY|MAY_BE_ARRAY_OF_ANY|MAY_BE_ARRAY_OF_REF;
- case _IS_BOOL:
- return MAY_BE_TRUE|MAY_BE_FALSE;
- default:
- ZEND_ASSERT(type_code < IS_REFERENCE);
- return 1 << type_code;
+static uint32_t zend_convert_type_declaration_mask(uint32_t type_mask) {
+ uint32_t result_mask = type_mask & MAY_BE_ANY;
+ if (type_mask & MAY_BE_VOID) {
+ result_mask |= MAY_BE_NULL;
+ }
+ if (type_mask & MAY_BE_CALLABLE) {
+ result_mask |= MAY_BE_STRING|MAY_BE_OBJECT|MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_ANY|MAY_BE_ARRAY_OF_ANY|MAY_BE_ARRAY_OF_REF;
}
+ if (type_mask & MAY_BE_ITERABLE) {
+ result_mask |= MAY_BE_OBJECT|MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_ANY|MAY_BE_ARRAY_OF_ANY|MAY_BE_ARRAY_OF_REF;
+ }
+ if (type_mask & MAY_BE_ARRAY) {
+ result_mask |= MAY_BE_ARRAY_KEY_ANY|MAY_BE_ARRAY_OF_ANY|MAY_BE_ARRAY_OF_REF;
+ }
+ return result_mask;
}
-static uint32_t zend_fetch_arg_info(const zend_script *script, zend_arg_info *arg_info, zend_class_entry **pce)
+uint32_t zend_fetch_arg_info_type(const zend_script *script, zend_arg_info *arg_info, zend_class_entry **pce)
{
- uint32_t tmp = 0;
+ uint32_t tmp;
+ if (!ZEND_TYPE_IS_SET(arg_info->type)) {
+ return MAY_BE_ANY|MAY_BE_ARRAY_KEY_ANY|MAY_BE_ARRAY_OF_ANY|MAY_BE_ARRAY_OF_REF|MAY_BE_RC1|MAY_BE_RCN;
+ }
+ tmp = zend_convert_type_declaration_mask(ZEND_TYPE_PURE_MASK(arg_info->type));
*pce = NULL;
- if (ZEND_TYPE_IS_CLASS(arg_info->type)) {
- // class type hinting...
- zend_string *lcname = zend_string_tolower(ZEND_TYPE_NAME(arg_info->type));
+ if (ZEND_TYPE_HAS_CLASS(arg_info->type)) {
tmp |= MAY_BE_OBJECT;
- *pce = get_class_entry(script, lcname);
- zend_string_release_ex(lcname, 0);
- } else if (ZEND_TYPE_IS_CODE(arg_info->type)) {
- tmp |= zend_convert_type_code_to_may_be(ZEND_TYPE_CODE(arg_info->type));
- } else {
- tmp |= MAY_BE_ANY|MAY_BE_ARRAY_KEY_ANY|MAY_BE_ARRAY_OF_ANY|MAY_BE_ARRAY_OF_REF;
+ /* As we only have space to store one CE, we use a plain object type for class unions. */
+ if (ZEND_TYPE_HAS_NAME(arg_info->type)) {
+ zend_string *lcname = zend_string_tolower(ZEND_TYPE_NAME(arg_info->type));
+ *pce = get_class_entry(script, lcname);
+ zend_string_release_ex(lcname, 0);
+ }
}
- if (ZEND_TYPE_ALLOW_NULL(arg_info->type)) {
- tmp |= MAY_BE_NULL;
+ if (tmp & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) {
+ tmp |= MAY_BE_RC1 | MAY_BE_RCN;
}
return tmp;
}
@@ -2314,7 +2293,7 @@ static zend_property_info *zend_fetch_prop_info(const zend_op_array *op_array, z
}
if (ce) {
prop_info = lookup_prop_info(ce,
- Z_STR_P(CRT_CONSTANT_EX(op_array, opline, opline->op2, ssa->rt_constants)),
+ Z_STR_P(CRT_CONSTANT(opline->op2)),
op_array->scope);
if (prop_info && (prop_info->flags & ZEND_ACC_STATIC)) {
prop_info = NULL;
@@ -2345,12 +2324,12 @@ static zend_property_info *zend_fetch_static_prop_info(const zend_script *script
break;
}
} else if (opline->op2_type == IS_CONST) {
- zval *zv = CRT_CONSTANT_EX(op_array, opline, opline->op2, ssa->rt_constants);
+ zval *zv = CRT_CONSTANT(opline->op2);
ce = get_class_entry(script, Z_STR_P(zv + 1));
}
if (ce) {
- zval *zv = CRT_CONSTANT_EX(op_array, opline, opline->op1, ssa->rt_constants);
+ zval *zv = CRT_CONSTANT(opline->op1);
prop_info = lookup_prop_info(ce, Z_STR_P(zv), op_array->scope);
if (prop_info && !(prop_info->flags & ZEND_ACC_STATIC)) {
prop_info = NULL;
@@ -2362,33 +2341,29 @@ static zend_property_info *zend_fetch_static_prop_info(const zend_script *script
static uint32_t zend_fetch_prop_type(const zend_script *script, zend_property_info *prop_info, zend_class_entry **pce)
{
+ if (pce) {
+ *pce = NULL;
+ }
if (prop_info && ZEND_TYPE_IS_SET(prop_info->type)) {
- uint32_t type = ZEND_TYPE_IS_CLASS(prop_info->type)
- ? MAY_BE_OBJECT
- : zend_convert_type_code_to_may_be(ZEND_TYPE_CODE(prop_info->type));
+ uint32_t type = zend_convert_type_declaration_mask(ZEND_TYPE_PURE_MASK(prop_info->type));
- if (ZEND_TYPE_ALLOW_NULL(prop_info->type)) {
- type |= MAY_BE_NULL;
- }
if (type & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) {
type |= MAY_BE_RC1 | MAY_BE_RCN;
}
- if (pce) {
- if (ZEND_TYPE_IS_CE(prop_info->type)) {
- *pce = ZEND_TYPE_CE(prop_info->type);
- } else if (ZEND_TYPE_IS_NAME(prop_info->type)) {
- zend_string *lcname = zend_string_tolower(ZEND_TYPE_NAME(prop_info->type));
- *pce = get_class_entry(script, lcname);
- zend_string_release(lcname);
- } else {
- *pce = NULL;
+ if (ZEND_TYPE_HAS_CLASS(prop_info->type)) {
+ type |= MAY_BE_OBJECT;
+ if (pce) {
+ if (ZEND_TYPE_HAS_CE(prop_info->type)) {
+ *pce = ZEND_TYPE_CE(prop_info->type);
+ } else if (ZEND_TYPE_HAS_NAME(prop_info->type)) {
+ zend_string *lcname = zend_string_tolower(ZEND_TYPE_NAME(prop_info->type));
+ *pce = get_class_entry(script, lcname);
+ zend_string_release(lcname);
+ }
}
}
return type;
}
- if (pce) {
- *pce = NULL;
- }
return MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_RC1 | MAY_BE_RCN;
}
@@ -2419,8 +2394,8 @@ static int zend_update_type_info(const zend_op_array *op_array,
/* If one of the operands cannot have any type, this means the operand derives from
* unreachable code. Propagate the empty result early, so that that the following
* code may assume that operands have at least one type. */
- if (!(t1 & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_CLASS|MAY_BE_ERROR))
- || !(t2 & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_CLASS|MAY_BE_ERROR))) {
+ if (!(t1 & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_CLASS))
+ || !(t2 & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_CLASS))) {
tmp = 0;
if (ssa_ops[i].result_def >= 0) {
UPDATE_SSA_TYPE(tmp, ssa_ops[i].result_def);
@@ -2489,14 +2464,8 @@ static int zend_update_type_info(const zend_op_array *op_array,
case ZEND_ISSET_ISEMPTY_STATIC_PROP:
case ZEND_ASSERT_CHECK:
case ZEND_IN_ARRAY:
- UPDATE_SSA_TYPE(MAY_BE_FALSE|MAY_BE_TRUE, ssa_ops[i].result_def);
- break;
case ZEND_ARRAY_KEY_EXISTS:
- tmp = MAY_BE_FALSE|MAY_BE_TRUE;
- if (t2 & ((MAY_BE_ANY|MAY_BE_UNDEF) - (MAY_BE_ARRAY|MAY_BE_OBJECT))) {
- tmp |= MAY_BE_NULL;
- }
- UPDATE_SSA_TYPE(tmp, ssa_ops[i].result_def);
+ UPDATE_SSA_TYPE(MAY_BE_FALSE|MAY_BE_TRUE, ssa_ops[i].result_def);
break;
case ZEND_CAST:
if (ssa_ops[i].op1_def >= 0) {
@@ -2514,24 +2483,19 @@ static int zend_update_type_info(const zend_op_array *op_array,
UPDATE_SSA_TYPE(tmp, ssa_ops[i].op1_def);
COPY_SSA_OBJ_TYPE(ssa_ops[i].op1_use, ssa_ops[i].op1_def);
}
- tmp = 0;
- if (opline->extended_value == _IS_BOOL) {
- tmp |= MAY_BE_TRUE|MAY_BE_FALSE;
- } else {
- tmp |= 1 << opline->extended_value;
- if (tmp & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) {
- if ((tmp & MAY_BE_ANY) == (t1 & MAY_BE_ANY)) {
- tmp |= (t1 & MAY_BE_RC1) | MAY_BE_RCN;
- } else if ((opline->extended_value == IS_ARRAY ||
- opline->extended_value == IS_OBJECT) &&
- (t1 & (MAY_BE_ARRAY|MAY_BE_OBJECT))) {
- tmp |= MAY_BE_RC1 | MAY_BE_RCN;
- } else if (opline->extended_value == IS_STRING &&
- (t1 & (MAY_BE_STRING|MAY_BE_OBJECT))) {
+ tmp = 1 << opline->extended_value;
+ if (tmp & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) {
+ if ((tmp & MAY_BE_ANY) == (t1 & MAY_BE_ANY)) {
+ tmp |= (t1 & MAY_BE_RC1) | MAY_BE_RCN;
+ } else if ((opline->extended_value == IS_ARRAY ||
+ opline->extended_value == IS_OBJECT) &&
+ (t1 & (MAY_BE_ARRAY|MAY_BE_OBJECT))) {
tmp |= MAY_BE_RC1 | MAY_BE_RCN;
- } else {
- tmp |= MAY_BE_RC1;
- }
+ } else if (opline->extended_value == IS_STRING &&
+ (t1 & (MAY_BE_STRING|MAY_BE_OBJECT))) {
+ tmp |= MAY_BE_RC1 | MAY_BE_RCN;
+ } else {
+ tmp |= MAY_BE_RC1;
}
}
if (opline->extended_value == IS_ARRAY) {
@@ -2711,9 +2675,6 @@ static int zend_update_type_info(const zend_op_array *op_array,
tmp |= MAY_BE_LONG;
}
} else {
- if (t1 & MAY_BE_ERROR) {
- tmp |= MAY_BE_NULL;
- }
if (t1 & (MAY_BE_UNDEF | MAY_BE_NULL)) {
if (opline->opcode == ZEND_PRE_INC) {
tmp |= MAY_BE_LONG;
@@ -2746,7 +2707,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
if (t1 & (MAY_BE_RC1|MAY_BE_RCN)) {
tmp |= MAY_BE_RC1|MAY_BE_RCN;
}
- tmp |= t1 & ~(MAY_BE_UNDEF|MAY_BE_ERROR|MAY_BE_REF|MAY_BE_RCN);
+ tmp |= t1 & ~(MAY_BE_UNDEF|MAY_BE_REF|MAY_BE_RCN);
if (t1 & MAY_BE_UNDEF) {
tmp |= MAY_BE_NULL;
}
@@ -2773,9 +2734,6 @@ static int zend_update_type_info(const zend_op_array *op_array,
tmp |= MAY_BE_LONG;
}
} else {
- if (t1 & MAY_BE_ERROR) {
- tmp |= MAY_BE_NULL;
- }
if (t1 & (MAY_BE_UNDEF | MAY_BE_NULL)) {
if (opline->opcode == ZEND_POST_INC) {
tmp |= MAY_BE_LONG;
@@ -2953,7 +2911,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
if (opline->op2_type == IS_VAR && opline->extended_value == ZEND_RETURNS_FUNCTION) {
tmp = (MAY_BE_REF | MAY_BE_RCN | MAY_BE_RC1 | t2) & ~MAY_BE_UNDEF;
} else {
- tmp = (MAY_BE_REF | t2) & ~(MAY_BE_UNDEF|MAY_BE_ERROR|MAY_BE_RC1|MAY_BE_RCN);
+ tmp = (MAY_BE_REF | t2) & ~(MAY_BE_UNDEF|MAY_BE_RC1|MAY_BE_RCN);
}
if (t2 & MAY_BE_UNDEF) {
tmp |= MAY_BE_NULL;
@@ -2981,7 +2939,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
if ((opline+1)->op1_type == IS_VAR && (opline->extended_value & ZEND_RETURNS_FUNCTION)) {
tmp = (MAY_BE_REF | MAY_BE_RCN | MAY_BE_RC1 | t2) & ~MAY_BE_UNDEF;
} else {
- tmp = (MAY_BE_REF | t2) & ~(MAY_BE_UNDEF|MAY_BE_ERROR|MAY_BE_RC1|MAY_BE_RCN);
+ tmp = (MAY_BE_REF | t2) & ~(MAY_BE_UNDEF|MAY_BE_RC1|MAY_BE_RCN);
}
if (t2 & MAY_BE_UNDEF) {
tmp |= MAY_BE_NULL;
@@ -3109,16 +3067,9 @@ static int zend_update_type_info(const zend_op_array *op_array,
ce = NULL;
if (arg_info) {
- tmp = zend_fetch_arg_info(script, arg_info, &ce);
- if (opline->opcode == ZEND_RECV_INIT &&
- Z_TYPE_P(CRT_CONSTANT_EX(op_array, opline, opline->op2, ssa->rt_constants)) == IS_CONSTANT_AST) {
- /* The constant may resolve to NULL */
- tmp |= MAY_BE_NULL;
- }
- if (arg_info->pass_by_reference) {
+ tmp = zend_fetch_arg_info_type(script, arg_info, &ce);
+ if (ZEND_ARG_SEND_MODE(arg_info)) {
tmp |= MAY_BE_REF;
- } else if (tmp & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) {
- tmp |= MAY_BE_RC1|MAY_BE_RCN;
}
} else {
tmp = MAY_BE_REF|MAY_BE_RC1|MAY_BE_RCN|MAY_BE_ANY|MAY_BE_ARRAY_KEY_ANY|MAY_BE_ARRAY_OF_ANY|MAY_BE_ARRAY_OF_REF;
@@ -3156,7 +3107,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
}
case ZEND_DECLARE_ANON_CLASS:
UPDATE_SSA_TYPE(MAY_BE_CLASS, ssa_ops[i].result_def);
- if (script && (ce = zend_hash_find_ptr(&script->class_table, Z_STR_P(CRT_CONSTANT_EX(op_array, opline, opline->op1, ssa->rt_constants)))) != NULL) {
+ if (script && (ce = zend_hash_find_ptr(&script->class_table, Z_STR_P(CRT_CONSTANT(opline->op1)))) != NULL) {
UPDATE_SSA_OBJ_TYPE(ce, 0, ssa_ops[i].result_def);
}
break;
@@ -3184,7 +3135,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
break;
}
} else if (opline->op2_type == IS_CONST) {
- zval *zv = CRT_CONSTANT_EX(op_array, opline, opline->op2, ssa->rt_constants);
+ zval *zv = CRT_CONSTANT(opline->op2);
if (Z_TYPE_P(zv) == IS_STRING) {
ce = get_class_entry(script, Z_STR_P(zv+1));
UPDATE_SSA_OBJ_TYPE(ce, 0, ssa_ops[i].result_def);
@@ -3198,7 +3149,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
case ZEND_NEW:
tmp = MAY_BE_RC1|MAY_BE_RCN|MAY_BE_OBJECT;
if (opline->op1_type == IS_CONST &&
- (ce = get_class_entry(script, Z_STR_P(CRT_CONSTANT_EX(op_array, opline, opline->op1, ssa->rt_constants)+1))) != NULL) {
+ (ce = get_class_entry(script, Z_STR_P(CRT_CONSTANT(opline->op1)+1))) != NULL) {
UPDATE_SSA_OBJ_TYPE(ce, 0, ssa_ops[i].result_def);
} else if ((t1 & MAY_BE_CLASS) && ssa_ops[i].op1_use >= 0 && ssa_var_info[ssa_ops[i].op1_use].ce) {
UPDATE_SSA_OBJ_TYPE(ssa_var_info[ssa_ops[i].op1_use].ce, ssa_var_info[ssa_ops[i].op1_use].is_instanceof, ssa_ops[i].result_def);
@@ -3320,7 +3271,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
break;
case ZEND_FE_FETCH_R:
case ZEND_FE_FETCH_RW:
- tmp = t2;
+ tmp = t2 & MAY_BE_REF;
if (t1 & MAY_BE_OBJECT) {
if (opline->opcode == ZEND_FE_FETCH_RW) {
tmp |= MAY_BE_REF | MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF;
@@ -3369,6 +3320,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
case ZEND_FETCH_LIST_R:
case ZEND_FETCH_LIST_W:
if (ssa_ops[i].op1_def >= 0) {
+ uint32_t key_type = 0;
tmp = t1 & ~(MAY_BE_RC1|MAY_BE_RCN);
if (opline->opcode == ZEND_FETCH_DIM_W ||
opline->opcode == ZEND_FETCH_DIM_RW ||
@@ -3390,20 +3342,20 @@ static int zend_update_type_info(const zend_op_array *op_array,
tmp |= t1 & (MAY_BE_RC1|MAY_BE_RCN);
}
if (opline->op2_type == IS_UNUSED) {
- tmp |= MAY_BE_ARRAY_KEY_LONG;
+ key_type |= MAY_BE_ARRAY_KEY_LONG;
} else {
if (t2 & (MAY_BE_LONG|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_RESOURCE|MAY_BE_DOUBLE)) {
- tmp |= MAY_BE_ARRAY_KEY_LONG;
+ key_type |= MAY_BE_ARRAY_KEY_LONG;
}
if (t2 & MAY_BE_STRING) {
- tmp |= MAY_BE_ARRAY_KEY_STRING;
+ key_type |= MAY_BE_ARRAY_KEY_STRING;
if (opline->op2_type != IS_CONST) {
// FIXME: numeric string
- tmp |= MAY_BE_ARRAY_KEY_LONG;
+ key_type |= MAY_BE_ARRAY_KEY_LONG;
}
}
if (t2 & (MAY_BE_UNDEF | MAY_BE_NULL)) {
- tmp |= MAY_BE_ARRAY_KEY_STRING;
+ key_type |= MAY_BE_ARRAY_KEY_STRING;
}
}
} else if (opline->opcode == ZEND_FETCH_DIM_UNSET) {
@@ -3427,19 +3379,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
case ZEND_FETCH_LIST_W:
case ZEND_ASSIGN_DIM:
case ZEND_ASSIGN_DIM_OP:
- tmp |= MAY_BE_ARRAY | MAY_BE_ARRAY_OF_ARRAY;
- break;
- case ZEND_FETCH_OBJ_W:
- case ZEND_FETCH_OBJ_RW:
- case ZEND_FETCH_OBJ_FUNC_ARG:
- case ZEND_ASSIGN_OBJ:
- case ZEND_ASSIGN_OBJ_OP:
- case ZEND_ASSIGN_OBJ_REF:
- case ZEND_PRE_INC_OBJ:
- case ZEND_PRE_DEC_OBJ:
- case ZEND_POST_INC_OBJ:
- case ZEND_POST_DEC_OBJ:
- tmp |= MAY_BE_ARRAY_OF_OBJECT;
+ tmp |= key_type | MAY_BE_ARRAY | MAY_BE_ARRAY_OF_ARRAY;
break;
case ZEND_SEND_VAR_EX:
case ZEND_SEND_FUNC_ARG:
@@ -3454,7 +3394,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
case ZEND_VERIFY_RETURN_TYPE:
case ZEND_MAKE_REF:
case ZEND_FE_RESET_RW:
- tmp |= MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF;
+ tmp |= key_type | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF;
break;
case ZEND_PRE_INC:
case ZEND_PRE_DEC:
@@ -3462,11 +3402,24 @@ static int zend_update_type_info(const zend_op_array *op_array,
case ZEND_POST_DEC:
if (tmp & MAY_BE_ARRAY_OF_LONG) {
/* may overflow */
- tmp |= MAY_BE_ARRAY_OF_DOUBLE;
+ tmp |= key_type | MAY_BE_ARRAY_OF_DOUBLE;
} else if (!(tmp & (MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_DOUBLE))) {
- tmp |= MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_DOUBLE;
+ tmp |= key_type | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_DOUBLE;
}
break;
+ case ZEND_FETCH_OBJ_W:
+ case ZEND_FETCH_OBJ_RW:
+ case ZEND_FETCH_OBJ_FUNC_ARG:
+ case ZEND_ASSIGN_OBJ:
+ case ZEND_ASSIGN_OBJ_OP:
+ case ZEND_ASSIGN_OBJ_REF:
+ case ZEND_PRE_INC_OBJ:
+ case ZEND_PRE_DEC_OBJ:
+ case ZEND_POST_INC_OBJ:
+ case ZEND_POST_DEC_OBJ:
+ /* These will result in an error exception, unless the element
+ * is already an object. */
+ break;
case ZEND_SEND_VAR:
/* This can occur if a DIM_FETCH_FUNC_ARG with UNUSED op2 is left
* behind, because it can't be converted to DIM_FETCH_R. */
@@ -3490,18 +3443,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
opline->opcode != ZEND_FETCH_LIST_R ? t1 : ((t1 & ~MAY_BE_STRING) | MAY_BE_NULL),
opline->result_type == IS_VAR,
opline->op2_type == IS_UNUSED);
- if (opline->opcode == ZEND_FETCH_DIM_W ||
- opline->opcode == ZEND_FETCH_DIM_RW ||
- opline->opcode == ZEND_FETCH_DIM_FUNC_ARG ||
- opline->opcode == ZEND_FETCH_LIST_W) {
- if (t1 & (MAY_BE_ERROR|MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_RESOURCE|MAY_BE_OBJECT)) {
- tmp |= MAY_BE_ERROR;
- } else if (opline->op2_type == IS_UNUSED) {
- tmp |= MAY_BE_ERROR;
- } else if (t2 & (MAY_BE_ARRAY|MAY_BE_OBJECT)) {
- tmp |= MAY_BE_ERROR;
- }
- } else if (opline->opcode == ZEND_FETCH_DIM_IS && (t1 & MAY_BE_STRING)) {
+ if (opline->opcode == ZEND_FETCH_DIM_IS && (t1 & MAY_BE_STRING)) {
tmp |= MAY_BE_NULL;
}
UPDATE_SSA_TYPE(tmp, ssa_ops[i].result_def);
@@ -3516,26 +3458,11 @@ static int zend_update_type_info(const zend_op_array *op_array,
case ZEND_FETCH_OBJ_W:
case ZEND_FETCH_OBJ_UNSET:
case ZEND_FETCH_OBJ_FUNC_ARG:
- if (ssa_ops[i].op1_def >= 0) {
- tmp = t1;
- if (opline->opcode == ZEND_FETCH_OBJ_W ||
- opline->opcode == ZEND_FETCH_OBJ_RW ||
- opline->opcode == ZEND_FETCH_OBJ_FUNC_ARG) {
- if (opline->opcode != ZEND_FETCH_DIM_FUNC_ARG) {
- if (t1 & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE)) {
- tmp &= ~(MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE);
- tmp |= MAY_BE_OBJECT | MAY_BE_RC1 | MAY_BE_RCN;
- }
- }
- }
- UPDATE_SSA_TYPE(tmp, ssa_ops[i].op1_def);
- COPY_SSA_OBJ_TYPE(ssa_ops[i].op1_use, ssa_ops[i].op1_def);
- }
if (ssa_ops[i].result_def >= 0) {
tmp = zend_fetch_prop_type(script,
zend_fetch_prop_info(op_array, ssa, opline, i), &ce);
if (opline->result_type != IS_TMP_VAR) {
- tmp |= MAY_BE_REF | MAY_BE_ERROR;
+ tmp |= MAY_BE_REF;
}
UPDATE_SSA_TYPE(tmp, ssa_ops[i].result_def);
if (ce) {
@@ -3552,7 +3479,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
tmp = zend_fetch_prop_type(script,
zend_fetch_static_prop_info(script, op_array, ssa, opline), &ce);
if (opline->result_type != IS_TMP_VAR) {
- tmp |= MAY_BE_REF | MAY_BE_ERROR;
+ tmp |= MAY_BE_REF;
}
UPDATE_SSA_TYPE(tmp, ssa_ops[i].result_def);
if (ce) {
@@ -3574,7 +3501,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
if (!call_info) {
goto unknown_opcode;
}
- tmp = zend_get_func_info(call_info, ssa) & ~FUNC_MAY_WARN;
+ tmp = zend_get_func_info(call_info, ssa);
UPDATE_SSA_TYPE(tmp, ssa_ops[i].result_def);
if (call_info->callee_func->type == ZEND_USER_FUNCTION) {
func_info = ZEND_FUNC_INFO(&call_info->callee_func->op_array);
@@ -3622,11 +3549,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
ce = NULL;
} else {
zend_arg_info *ret_info = op_array->arg_info - 1;
-
- tmp = zend_fetch_arg_info(script, ret_info, &ce);
- if (tmp & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) {
- tmp |= MAY_BE_RC1 | MAY_BE_RCN;
- }
+ tmp = zend_fetch_arg_info_type(script, ret_info, &ce);
}
if (opline->op1_type & (IS_TMP_VAR|IS_VAR|IS_CV)) {
UPDATE_SSA_TYPE(tmp, ssa_ops[i].op1_def);
@@ -3893,7 +3816,7 @@ static zend_bool can_convert_to_double(
ZVAL_COPY_VALUE(&orig_op1, value);
ZVAL_DOUBLE(&dval_op1, (double) Z_LVAL_P(value));
} else if (opline->op1_type == IS_CONST) {
- zval *zv = CRT_CONSTANT_EX(op_array, opline, opline->op1, ssa->rt_constants);
+ zval *zv = CRT_CONSTANT(opline->op1);
if (Z_TYPE_P(zv) == IS_LONG || Z_TYPE_P(zv) == IS_DOUBLE) {
ZVAL_COPY_VALUE(&orig_op1, zv);
ZVAL_COPY_VALUE(&dval_op1, zv);
@@ -3906,7 +3829,7 @@ static zend_bool can_convert_to_double(
ZVAL_COPY_VALUE(&orig_op2, value);
ZVAL_DOUBLE(&dval_op2, (double) Z_LVAL_P(value));
} else if (opline->op2_type == IS_CONST) {
- zval *zv = CRT_CONSTANT_EX(op_array, opline, opline->op2, ssa->rt_constants);
+ zval *zv = CRT_CONSTANT(opline->op2);
if (Z_TYPE_P(zv) == IS_LONG || Z_TYPE_P(zv) == IS_DOUBLE) {
ZVAL_COPY_VALUE(&orig_op2, zv);
ZVAL_COPY_VALUE(&dval_op2, zv);
@@ -3994,7 +3917,7 @@ static int zend_type_narrowing(const zend_op_array *op_array, const zend_script
* doubles instead, in the hope that we'll narrow long|double to double. */
if (opline->opcode == ZEND_ASSIGN && opline->result_type == IS_UNUSED &&
opline->op1_type == IS_CV && opline->op2_type == IS_CONST) {
- zval *value = CRT_CONSTANT_EX(op_array, opline, opline->op2, ssa->rt_constants);
+ zval *value = CRT_CONSTANT(opline->op2);
zend_bitset_clear(visited, bitset_len);
if (can_convert_to_double(op_array, ssa, v, value, visited)) {
@@ -4053,11 +3976,9 @@ void zend_init_func_return_info(const zend_op_array *op_array,
zend_arg_info *ret_info = op_array->arg_info - 1;
zend_ssa_range tmp_range = {0, 0, 0, 0};
- ret->type = zend_fetch_arg_info(script, ret_info, &ret->ce);
+ ret->type = zend_fetch_arg_info_type(script, ret_info, &ret->ce);
if (op_array->fn_flags & ZEND_ACC_RETURN_REFERENCE) {
ret->type |= MAY_BE_REF;
- } else if (ret->type & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) {
- ret->type |= MAY_BE_RC1|MAY_BE_RCN;
}
ret->is_instanceof = (ret->ce) ? 1 : 0;
ret->range = tmp_range;
@@ -4148,7 +4069,7 @@ void zend_func_return_info(const zend_op_array *op_array,
}
if (opline->op1_type == IS_CONST) {
- zval *zv = CRT_CONSTANT_EX(op_array, opline, opline->op1, info->ssa.rt_constants);
+ zval *zv = CRT_CONSTANT(opline->op1);
if (Z_TYPE_P(zv) == IS_NULL) {
if (tmp_has_range < 0) {
@@ -4370,7 +4291,7 @@ void zend_inference_check_recursive_dependencies(zend_op_array *op_array)
free_alloca(worklist, use_heap);
}
-int zend_may_throw(const zend_op *opline, zend_op_array *op_array, zend_ssa *ssa)
+int zend_may_throw(const zend_op *opline, const zend_op_array *op_array, zend_ssa *ssa)
{
uint32_t t1 = OP1_INFO();
uint32_t t2 = OP2_INFO();
@@ -4617,8 +4538,7 @@ int zend_may_throw(const zend_op *opline, zend_op_array *op_array, zend_ssa *ssa
zend_class_entry *ce = var_info->ce;
if (var_info->is_instanceof ||
- !ce || ce->create_object || ce->__get || ce->__set ||
- (ce->ce_flags & ZEND_ACC_INHERITED)) {
+ !ce || ce->create_object || ce->__get || ce->__set || ce->parent) {
return 1;
}
@@ -4627,7 +4547,7 @@ int zend_may_throw(const zend_op *opline, zend_op_array *op_array, zend_ssa *ssa
if (opline->op2_type == IS_CONST) {
prop_info = zend_hash_find_ptr(&ce->properties_info,
- Z_STR_P(CRT_CONSTANT_EX(op_array, opline, opline->op2, ssa->rt_constants)));
+ Z_STR_P(CRT_CONSTANT(opline->op2)));
if (prop_info && !(prop_info->flags & ZEND_ACC_PUBLIC)) {
return 1;
}
@@ -4657,7 +4577,7 @@ int zend_may_throw(const zend_op *opline, zend_op_array *op_array, zend_ssa *ssa
case ZEND_COUNT:
return (t1 & MAY_BE_ANY) != MAY_BE_ARRAY;
case ZEND_RECV_INIT:
- if (Z_TYPE_P(CRT_CONSTANT_EX(op_array, opline, opline->op2, ssa->rt_constants)) == IS_CONSTANT_AST) {
+ if (Z_TYPE_P(CRT_CONSTANT(opline->op2)) == IS_CONSTANT_AST) {
return 1;
}
if (op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS) {
@@ -4683,10 +4603,6 @@ int zend_may_throw(const zend_op *opline, zend_op_array *op_array, zend_ssa *ssa
return (t1 & MAY_BE_OBJECT) || (t2 & (MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE));
case ZEND_CAST:
switch (opline->extended_value) {
- case IS_NULL:
- return 0;
- case _IS_BOOL:
- return (t1 & MAY_BE_OBJECT);
case IS_LONG:
case IS_DOUBLE:
return (t1 & MAY_BE_OBJECT);
@@ -4695,10 +4611,17 @@ int zend_may_throw(const zend_op *opline, zend_op_array *op_array, zend_ssa *ssa
case IS_ARRAY:
return (t1 & MAY_BE_OBJECT);
case IS_OBJECT:
- return (t1 & MAY_BE_ARRAY);
- default:
- return 1;
+ return 0;
+ EMPTY_SWITCH_DEFAULT_CASE()
}
+ case ZEND_ARRAY_KEY_EXISTS:
+ if ((t2 & MAY_BE_ANY) != MAY_BE_ARRAY) {
+ return 1;
+ }
+ if ((t1 & (MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
+ return 1;
+ }
+ return 0;
default:
return 1;
}
diff --git a/ext/opcache/Optimizer/zend_inference.h b/ext/opcache/Optimizer/zend_inference.h
index ec98fcbef9..f01f6cc786 100644
--- a/ext/opcache/Optimizer/zend_inference.h
+++ b/ext/opcache/Optimizer/zend_inference.h
@@ -26,11 +26,11 @@
/* Bitmask for type inference (zend_ssa_var_info.type) */
#include "zend_type_info.h"
-#define MAY_BE_IN_REG (1<<25) /* value allocated in CPU register */
+#define MAY_BE_IN_REG (1<<29) /* value allocated in CPU register */
//TODO: remome MAY_BE_RC1, MAY_BE_RCN???
-#define MAY_BE_RC1 (1<<27) /* may be non-reference with refcount == 1 */
-#define MAY_BE_RCN (1<<28) /* may be non-reference with refcount > 1 */
+#define MAY_BE_RC1 (1<<30) /* may be non-reference with refcount == 1 */
+#define MAY_BE_RCN (1u<<31) /* may be non-reference with refcount > 1 */
#define MAY_HAVE_DTOR \
(MAY_BE_OBJECT|MAY_BE_RESOURCE \
@@ -40,7 +40,7 @@
static zend_always_inline zend_bool _ssa_##opN##_has_range(const zend_op_array *op_array, const zend_ssa *ssa, const zend_op *opline) \
{ \
if (opline->opN##_type == IS_CONST) { \
- zval *zv = CRT_CONSTANT_EX(op_array, opline, opline->opN, ssa->rt_constants); \
+ zval *zv = CRT_CONSTANT(opline->opN); \
return (Z_TYPE_P(zv) == IS_LONG || Z_TYPE_P(zv) == IS_TRUE || Z_TYPE_P(zv) == IS_FALSE || Z_TYPE_P(zv) == IS_NULL); \
} else { \
return (opline->opN##_type != IS_UNUSED && \
@@ -56,7 +56,7 @@
static zend_always_inline zend_long _ssa_##opN##_min_range(const zend_op_array *op_array, const zend_ssa *ssa, const zend_op *opline) \
{ \
if (opline->opN##_type == IS_CONST) { \
- zval *zv = CRT_CONSTANT_EX(op_array, opline, opline->opN, ssa->rt_constants); \
+ zval *zv = CRT_CONSTANT(opline->opN); \
if (Z_TYPE_P(zv) == IS_LONG) { \
return Z_LVAL_P(zv); \
} else if (Z_TYPE_P(zv) == IS_TRUE) { \
@@ -80,7 +80,7 @@
static zend_always_inline zend_long _ssa_##opN##_max_range(const zend_op_array *op_array, const zend_ssa *ssa, const zend_op *opline) \
{ \
if (opline->opN##_type == IS_CONST) { \
- zval *zv = CRT_CONSTANT_EX(op_array, opline, opline->opN, ssa->rt_constants); \
+ zval *zv = CRT_CONSTANT(opline->opN); \
if (Z_TYPE_P(zv) == IS_LONG) { \
return Z_LVAL_P(zv); \
} else if (Z_TYPE_P(zv) == IS_TRUE) { \
@@ -104,7 +104,7 @@
static zend_always_inline char _ssa_##opN##_range_underflow(const zend_op_array *op_array, const zend_ssa *ssa, const zend_op *opline) \
{ \
if (opline->opN##_type == IS_CONST) { \
- zval *zv = CRT_CONSTANT_EX(op_array, opline, opline->opN, ssa->rt_constants); \
+ zval *zv = CRT_CONSTANT(opline->opN); \
if (Z_TYPE_P(zv) == IS_LONG || Z_TYPE_P(zv) == IS_TRUE || Z_TYPE_P(zv) == IS_FALSE || Z_TYPE_P(zv) == IS_NULL) { \
return 0; \
} \
@@ -122,7 +122,7 @@
static zend_always_inline char _ssa_##opN##_range_overflow(const zend_op_array *op_array, const zend_ssa *ssa, const zend_op *opline) \
{ \
if (opline->opN##_type == IS_CONST) { \
- zval *zv = CRT_CONSTANT_EX(op_array, opline, opline->opN, ssa->rt_constants); \
+ zval *zv = CRT_CONSTANT(opline->opN); \
if (Z_TYPE_P(zv) == IS_LONG || Z_TYPE_P(zv) == IS_TRUE || Z_TYPE_P(zv) == IS_FALSE || Z_TYPE_P(zv) == IS_NULL) { \
return 0; \
} \
@@ -199,7 +199,7 @@ static zend_always_inline uint32_t get_ssa_var_info(const zend_ssa *ssa, int ssa
if (ssa->var_info && ssa_var_num >= 0) {
return ssa->var_info[ssa_var_num].type;
} else {
- return MAY_BE_UNDEF | MAY_BE_RC1 | MAY_BE_RCN | MAY_BE_REF | MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ERROR;
+ return MAY_BE_UNDEF | MAY_BE_RC1 | MAY_BE_RCN | MAY_BE_REF | MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF;
}
}
@@ -207,7 +207,7 @@ static zend_always_inline uint32_t get_ssa_var_info(const zend_ssa *ssa, int ssa
static zend_always_inline uint32_t _ssa_##opN##_info(const zend_op_array *op_array, const zend_ssa *ssa, const zend_op *opline) \
{ \
if (opline->opN##_type == IS_CONST) { \
- return _const_op_type(CRT_CONSTANT_EX(op_array, opline, opline->opN, ssa->rt_constants)); \
+ return _const_op_type(CRT_CONSTANT(opline->opN)); \
} else { \
return get_ssa_var_info(ssa, ssa->ops ? ssa->ops[opline - op_array->opcodes].opN##_use : -1); \
} \
@@ -263,6 +263,8 @@ void zend_inference_check_recursive_dependencies(zend_op_array *op_array);
int zend_infer_types_ex(const zend_op_array *op_array, const zend_script *script, zend_ssa *ssa, zend_bitset worklist, zend_long optimization_level);
+uint32_t zend_fetch_arg_info_type(
+ const zend_script *script, zend_arg_info *arg_info, zend_class_entry **pce);
void zend_init_func_return_info(const zend_op_array *op_array,
const zend_script *script,
zend_ssa_var_info *ret);
@@ -272,7 +274,7 @@ void zend_func_return_info(const zend_op_array *op_array,
int widening,
zend_ssa_var_info *ret);
-int zend_may_throw(const zend_op *opline, zend_op_array *op_array, zend_ssa *ssa);
+int zend_may_throw(const zend_op *opline, const zend_op_array *op_array, zend_ssa *ssa);
END_EXTERN_C()
diff --git a/ext/opcache/Optimizer/zend_optimizer.c b/ext/opcache/Optimizer/zend_optimizer.c
index 0b4181c051..05221b1587 100644
--- a/ext/opcache/Optimizer/zend_optimizer.c
+++ b/ext/opcache/Optimizer/zend_optimizer.c
@@ -32,10 +32,6 @@
#include "zend_inference.h"
#include "zend_dump.h"
-#ifndef HAVE_DFA_PASS
-# define HAVE_DFA_PASS 1
-#endif
-
static void zend_optimizer_zval_dtor_wrapper(zval *zvalue)
{
zval_ptr_dtor_nogc(zvalue);
@@ -343,7 +339,23 @@ int zend_optimizer_update_op1_const(zend_op_array *op_array,
case ZEND_CASE:
case ZEND_FETCH_LIST_R:
case ZEND_COPY_TMP:
+ case ZEND_FETCH_CLASS_NAME:
return 0;
+ case ZEND_ECHO:
+ {
+ zval zv;
+ if (Z_TYPE_P(val) != IS_STRING && zend_optimizer_eval_cast(&zv, IS_STRING, val) == SUCCESS) {
+ zval_ptr_dtor_nogc(val);
+ val = &zv;
+ }
+ opline->op1.constant = zend_optimizer_add_literal(op_array, val);
+ if (Z_TYPE_P(val) == IS_STRING && Z_STRLEN_P(val) == 0) {
+ MAKE_NOP(opline);
+ }
+ /* TODO: In a subsequent pass, *after* this step and compacting nops, combine consecutive ZEND_ECHOs using the block information from ssa->cfg */
+ /* (e.g. for ext/opcache/tests/opt/sccp_010.phpt) */
+ break;
+ }
case ZEND_CONCAT:
case ZEND_FAST_CONCAT:
case ZEND_FETCH_R:
@@ -656,9 +668,7 @@ int zend_optimizer_replace_by_const(zend_op_array *op_array,
}
case ZEND_VERIFY_RETURN_TYPE: {
zend_arg_info *ret_info = op_array->arg_info - 1;
- if (ZEND_TYPE_IS_CLASS(ret_info->type)
- || ZEND_TYPE_CODE(ret_info->type) == IS_CALLABLE
- || !ZEND_SAME_FAKE_TYPE(ZEND_TYPE_CODE(ret_info->type), Z_TYPE_P(val))
+ if (!ZEND_TYPE_CONTAINS_CODE(ret_info->type, Z_TYPE_P(val))
|| (op_array->fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
return 0;
}
@@ -777,9 +787,9 @@ void zend_optimizer_shift_jump(zend_op_array *op_array, zend_op *opline, uint32_
}
static zend_class_entry *get_class_entry_from_op1(
- zend_script *script, zend_op_array *op_array, zend_op *opline, zend_bool rt_constants) {
+ zend_script *script, zend_op_array *op_array, zend_op *opline) {
if (opline->op1_type == IS_CONST) {
- zval *op1 = CRT_CONSTANT_EX(op_array, opline, opline->op1, rt_constants);
+ zval *op1 = CRT_CONSTANT(opline->op1);
if (Z_TYPE_P(op1) == IS_STRING) {
zend_string *class_name = Z_STR_P(op1 + 1);
zend_class_entry *ce;
@@ -804,13 +814,12 @@ static zend_class_entry *get_class_entry_from_op1(
}
zend_function *zend_optimizer_get_called_func(
- zend_script *script, zend_op_array *op_array, zend_op *opline, zend_bool rt_constants)
+ zend_script *script, zend_op_array *op_array, zend_op *opline)
{
-#define GET_OP(op) CRT_CONSTANT_EX(op_array, opline, opline->op, rt_constants)
switch (opline->opcode) {
case ZEND_INIT_FCALL:
{
- zend_string *function_name = Z_STR_P(GET_OP(op2));
+ zend_string *function_name = Z_STR_P(CRT_CONSTANT(opline->op2));
zend_function *func;
if (script && (func = zend_hash_find_ptr(&script->function_table, function_name)) != NULL) {
return func;
@@ -827,8 +836,8 @@ zend_function *zend_optimizer_get_called_func(
}
case ZEND_INIT_FCALL_BY_NAME:
case ZEND_INIT_NS_FCALL_BY_NAME:
- if (opline->op2_type == IS_CONST && Z_TYPE_P(GET_OP(op2)) == IS_STRING) {
- zval *function_name = GET_OP(op2) + 1;
+ if (opline->op2_type == IS_CONST && Z_TYPE_P(CRT_CONSTANT(opline->op2)) == IS_STRING) {
+ zval *function_name = CRT_CONSTANT(opline->op2) + 1;
zend_function *func;
if (script && (func = zend_hash_find_ptr(&script->function_table, Z_STR_P(function_name)))) {
return func;
@@ -844,11 +853,11 @@ zend_function *zend_optimizer_get_called_func(
}
break;
case ZEND_INIT_STATIC_METHOD_CALL:
- if (opline->op2_type == IS_CONST && Z_TYPE_P(GET_OP(op2)) == IS_STRING) {
+ if (opline->op2_type == IS_CONST && Z_TYPE_P(CRT_CONSTANT(opline->op2)) == IS_STRING) {
zend_class_entry *ce = get_class_entry_from_op1(
- script, op_array, opline, rt_constants);
+ script, op_array, opline);
if (ce) {
- zend_string *func_name = Z_STR_P(GET_OP(op2) + 1);
+ zend_string *func_name = Z_STR_P(CRT_CONSTANT(opline->op2) + 1);
zend_function *fbc = zend_hash_find_ptr(&ce->function_table, func_name);
if (fbc) {
zend_bool is_public = (fbc->common.fn_flags & ZEND_ACC_PUBLIC) != 0;
@@ -862,9 +871,9 @@ zend_function *zend_optimizer_get_called_func(
break;
case ZEND_INIT_METHOD_CALL:
if (opline->op1_type == IS_UNUSED
- && opline->op2_type == IS_CONST && Z_TYPE_P(GET_OP(op2)) == IS_STRING
+ && opline->op2_type == IS_CONST && Z_TYPE_P(CRT_CONSTANT(opline->op2)) == IS_STRING
&& op_array->scope && !(op_array->scope->ce_flags & ZEND_ACC_TRAIT)) {
- zend_string *method_name = Z_STR_P(GET_OP(op2) + 1);
+ zend_string *method_name = Z_STR_P(CRT_CONSTANT(opline->op2) + 1);
zend_function *fbc = zend_hash_find_ptr(
&op_array->scope->function_table, method_name);
if (fbc) {
@@ -881,7 +890,7 @@ zend_function *zend_optimizer_get_called_func(
case ZEND_NEW:
{
zend_class_entry *ce = get_class_entry_from_op1(
- script, op_array, opline, rt_constants);
+ script, op_array, opline);
if (ce && ce->type == ZEND_USER_CLASS) {
return ce->constructor;
}
@@ -889,7 +898,6 @@ zend_function *zend_optimizer_get_called_func(
}
}
return NULL;
-#undef GET_OP
}
uint32_t zend_optimizer_classify_function(zend_string *name, uint32_t num_args) {
@@ -897,14 +905,8 @@ uint32_t zend_optimizer_classify_function(zend_string *name, uint32_t num_args)
return ZEND_FUNC_INDIRECT_VAR_ACCESS;
} else if (zend_string_equals_literal(name, "compact")) {
return ZEND_FUNC_INDIRECT_VAR_ACCESS;
- } else if (zend_string_equals_literal(name, "parse_str") && num_args <= 1) {
- return ZEND_FUNC_INDIRECT_VAR_ACCESS;
- } else if (zend_string_equals_literal(name, "mb_parse_str") && num_args <= 1) {
- return ZEND_FUNC_INDIRECT_VAR_ACCESS;
} else if (zend_string_equals_literal(name, "get_defined_vars")) {
return ZEND_FUNC_INDIRECT_VAR_ACCESS;
- } else if (zend_string_equals_literal(name, "assert")) {
- return ZEND_FUNC_INDIRECT_VAR_ACCESS;
} else if (zend_string_equals_literal(name, "func_num_args")) {
return ZEND_FUNC_VARARG;
} else if (zend_string_equals_literal(name, "func_get_arg")) {
@@ -939,12 +941,13 @@ static void zend_optimize(zend_op_array *op_array,
zend_dump_op_array(op_array, ZEND_DUMP_LIVE_RANGES, "before optimizer", NULL);
}
- /* pass 1
- * - substitute persistent constants (true, false, null, etc)
- * - perform compile-time evaluation of constant binary and unary operations
- * - optimize series of ADD_STRING and/or ADD_CHAR
- * - convert CAST(IS_BOOL,x) into BOOL(x)
- * - pre-evaluate constant function calls
+ /* pass 1 (Simple local optimizations)
+ * - persistent constant substitution (true, false, null, etc)
+ * - constant casting (ADD expects numbers, CONCAT strings, etc)
+ * - constant expression evaluation
+ * - optimize constant conditional JMPs
+ * - pre-evaluate constant function calls
+ * - eliminate FETCH $GLOBALS followed by FETCH_DIM/UNSET_DIM/ISSET_ISEMPTY_DIM
*/
if (ZEND_OPTIMIZER_PASS_1 & ctx->optimization_level) {
zend_optimizer_pass1(op_array, ctx);
@@ -953,21 +956,8 @@ static void zend_optimize(zend_op_array *op_array,
}
}
- /* pass 2:
- * - convert non-numeric constants to numeric constants in numeric operators
- * - optimize constant conditional JMPs
- */
- if (ZEND_OPTIMIZER_PASS_2 & ctx->optimization_level) {
- zend_optimizer_pass2(op_array);
- if (ctx->debug_level & ZEND_DUMP_AFTER_PASS_2) {
- zend_dump_op_array(op_array, 0, "after pass 2", NULL);
- }
- }
-
- /* pass 3:
- * - optimize $i = $i+expr to $i+=expr
+ /* pass 3: (Jump optimization)
* - optimize series of JMPs
- * - change $i++ to ++$i where possible
*/
if (ZEND_OPTIMIZER_PASS_3 & ctx->optimization_level) {
zend_optimizer_pass3(op_array, ctx);
@@ -996,7 +986,6 @@ static void zend_optimize(zend_op_array *op_array,
}
}
-#if HAVE_DFA_PASS
/* pass 6:
* - DFA optimization
*/
@@ -1007,7 +996,6 @@ static void zend_optimize(zend_op_array *op_array,
zend_dump_op_array(op_array, 0, "after pass 6", NULL);
}
}
-#endif
/* pass 9:
* - Optimize temp variables usage
@@ -1063,6 +1051,8 @@ static void zend_revert_pass_two(zend_op_array *op_array)
{
zend_op *opline, *end;
+ ZEND_ASSERT((op_array->fn_flags & ZEND_ACC_DONE_PASS_TWO) != 0);
+
opline = op_array->opcodes;
end = opline + op_array->last;
while (opline < end) {
@@ -1072,6 +1062,8 @@ static void zend_revert_pass_two(zend_op_array *op_array)
if (opline->op2_type == IS_CONST) {
ZEND_PASS_TWO_UNDO_CONSTANT(op_array, opline, opline->op2);
}
+ /* reset smart branch flags IS_SMART_BRANCH_JMP[N]Z */
+ opline->result_type &= (IS_TMP_VAR|IS_VAR|IS_CV|IS_CONST);
opline++;
}
#if !ZEND_USE_ABS_CONST_ADDR
@@ -1081,6 +1073,8 @@ static void zend_revert_pass_two(zend_op_array *op_array)
op_array->literals = literals;
}
#endif
+
+ op_array->fn_flags &= ~ZEND_ACC_DONE_PASS_TWO;
}
static void zend_redo_pass_two(zend_op_array *op_array)
@@ -1090,6 +1084,8 @@ static void zend_redo_pass_two(zend_op_array *op_array)
zend_op *old_opcodes = op_array->opcodes;
#endif
+ ZEND_ASSERT((op_array->fn_flags & ZEND_ACC_DONE_PASS_TWO) == 0);
+
#if !ZEND_USE_ABS_CONST_ADDR
if (op_array->last_literal) {
op_array->opcodes = (zend_op *) erealloc(op_array->opcodes,
@@ -1116,48 +1112,79 @@ static void zend_redo_pass_two(zend_op_array *op_array)
if (opline->op2_type == IS_CONST) {
ZEND_PASS_TWO_UPDATE_CONSTANT(op_array, opline, opline->op2);
}
+ /* fix jumps to point to new array */
+ switch (opline->opcode) {
#if ZEND_USE_ABS_JMP_ADDR && !ZEND_USE_ABS_CONST_ADDR
- if (op_array->fn_flags & ZEND_ACC_DONE_PASS_TWO) {
- /* fix jumps to point to new array */
- switch (opline->opcode) {
- case ZEND_JMP:
- case ZEND_FAST_CALL:
- opline->op1.jmp_addr = &op_array->opcodes[opline->op1.jmp_addr - old_opcodes];
- break;
- case ZEND_JMPZNZ:
- /* relative extended_value don't have to be changed */
- /* break omitted intentionally */
- case ZEND_JMPZ:
- case ZEND_JMPNZ:
- case ZEND_JMPZ_EX:
- case ZEND_JMPNZ_EX:
- case ZEND_JMP_SET:
- case ZEND_COALESCE:
- case ZEND_FE_RESET_R:
- case ZEND_FE_RESET_RW:
- case ZEND_ASSERT_CHECK:
+ case ZEND_JMP:
+ case ZEND_FAST_CALL:
+ opline->op1.jmp_addr = &op_array->opcodes[opline->op1.jmp_addr - old_opcodes];
+ break;
+ case ZEND_JMPZNZ:
+ /* relative extended_value don't have to be changed */
+ /* break omitted intentionally */
+ case ZEND_JMPZ:
+ case ZEND_JMPNZ:
+ case ZEND_JMPZ_EX:
+ case ZEND_JMPNZ_EX:
+ case ZEND_JMP_SET:
+ case ZEND_COALESCE:
+ case ZEND_FE_RESET_R:
+ case ZEND_FE_RESET_RW:
+ case ZEND_ASSERT_CHECK:
+ opline->op2.jmp_addr = &op_array->opcodes[opline->op2.jmp_addr - old_opcodes];
+ break;
+ case ZEND_CATCH:
+ if (!(opline->extended_value & ZEND_LAST_CATCH)) {
opline->op2.jmp_addr = &op_array->opcodes[opline->op2.jmp_addr - old_opcodes];
- break;
- case ZEND_CATCH:
- if (!(opline->extended_value & ZEND_LAST_CATCH)) {
- opline->op2.jmp_addr = &op_array->opcodes[opline->op2.jmp_addr - old_opcodes];
+ }
+ break;
+ case ZEND_FE_FETCH_R:
+ case ZEND_FE_FETCH_RW:
+ case ZEND_SWITCH_LONG:
+ case ZEND_SWITCH_STRING:
+ /* relative extended_value don't have to be changed */
+ break;
+#endif
+ case ZEND_IS_IDENTICAL:
+ case ZEND_IS_NOT_IDENTICAL:
+ case ZEND_IS_EQUAL:
+ case ZEND_IS_NOT_EQUAL:
+ case ZEND_IS_SMALLER:
+ case ZEND_IS_SMALLER_OR_EQUAL:
+ case ZEND_CASE:
+ case ZEND_ISSET_ISEMPTY_CV:
+ case ZEND_ISSET_ISEMPTY_VAR:
+ case ZEND_ISSET_ISEMPTY_DIM_OBJ:
+ case ZEND_ISSET_ISEMPTY_PROP_OBJ:
+ case ZEND_ISSET_ISEMPTY_STATIC_PROP:
+ case ZEND_INSTANCEOF:
+ case ZEND_TYPE_CHECK:
+ case ZEND_DEFINED:
+ case ZEND_IN_ARRAY:
+ case ZEND_ARRAY_KEY_EXISTS:
+ if (opline->result_type & IS_TMP_VAR) {
+ /* reinitialize result_type of smart branch instructions */
+ if (opline + 1 < end) {
+ if ((opline+1)->opcode == ZEND_JMPZ
+ && (opline+1)->op1_type == IS_TMP_VAR
+ && (opline+1)->op1.var == opline->result.var) {
+ opline->result_type = IS_SMART_BRANCH_JMPZ | IS_TMP_VAR;
+ } else if ((opline+1)->opcode == ZEND_JMPNZ
+ && (opline+1)->op1_type == IS_TMP_VAR
+ && (opline+1)->op1.var == opline->result.var) {
+ opline->result_type = IS_SMART_BRANCH_JMPNZ | IS_TMP_VAR;
+ }
}
- break;
- case ZEND_FE_FETCH_R:
- case ZEND_FE_FETCH_RW:
- case ZEND_SWITCH_LONG:
- case ZEND_SWITCH_STRING:
- /* relative extended_value don't have to be changed */
- break;
- }
+ }
+ break;
}
-#endif
ZEND_VM_SET_OPCODE_HANDLER(opline);
opline++;
}
+
+ op_array->fn_flags |= ZEND_ACC_DONE_PASS_TWO;
}
-#if HAVE_DFA_PASS
static void zend_redo_pass_two_ex(zend_op_array *op_array, zend_ssa *ssa)
{
zend_op *opline, *end;
@@ -1165,6 +1192,8 @@ static void zend_redo_pass_two_ex(zend_op_array *op_array, zend_ssa *ssa)
zend_op *old_opcodes = op_array->opcodes;
#endif
+ ZEND_ASSERT((op_array->fn_flags & ZEND_ACC_DONE_PASS_TWO) == 0);
+
#if !ZEND_USE_ABS_CONST_ADDR
if (op_array->last_literal) {
op_array->opcodes = (zend_op *) erealloc(op_array->opcodes,
@@ -1202,47 +1231,78 @@ static void zend_redo_pass_two_ex(zend_op_array *op_array, zend_ssa *ssa)
ZEND_PASS_TWO_UPDATE_CONSTANT(op_array, opline, opline->op2);
}
- zend_vm_set_opcode_handler_ex(opline, op1_info, op2_info, res_info);
+ /* fix jumps to point to new array */
+ switch (opline->opcode) {
#if ZEND_USE_ABS_JMP_ADDR && !ZEND_USE_ABS_CONST_ADDR
- if (op_array->fn_flags & ZEND_ACC_DONE_PASS_TWO) {
- /* fix jumps to point to new array */
- switch (opline->opcode) {
- case ZEND_JMP:
- case ZEND_FAST_CALL:
- opline->op1.jmp_addr = &op_array->opcodes[opline->op1.jmp_addr - old_opcodes];
- break;
- case ZEND_JMPZNZ:
- /* relative extended_value don't have to be changed */
- /* break omitted intentionally */
- case ZEND_JMPZ:
- case ZEND_JMPNZ:
- case ZEND_JMPZ_EX:
- case ZEND_JMPNZ_EX:
- case ZEND_JMP_SET:
- case ZEND_COALESCE:
- case ZEND_FE_RESET_R:
- case ZEND_FE_RESET_RW:
- case ZEND_ASSERT_CHECK:
+ case ZEND_JMP:
+ case ZEND_FAST_CALL:
+ opline->op1.jmp_addr = &op_array->opcodes[opline->op1.jmp_addr - old_opcodes];
+ break;
+ case ZEND_JMPZNZ:
+ /* relative extended_value don't have to be changed */
+ /* break omitted intentionally */
+ case ZEND_JMPZ:
+ case ZEND_JMPNZ:
+ case ZEND_JMPZ_EX:
+ case ZEND_JMPNZ_EX:
+ case ZEND_JMP_SET:
+ case ZEND_COALESCE:
+ case ZEND_FE_RESET_R:
+ case ZEND_FE_RESET_RW:
+ case ZEND_ASSERT_CHECK:
+ opline->op2.jmp_addr = &op_array->opcodes[opline->op2.jmp_addr - old_opcodes];
+ break;
+ case ZEND_CATCH:
+ if (!(opline->extended_value & ZEND_LAST_CATCH)) {
opline->op2.jmp_addr = &op_array->opcodes[opline->op2.jmp_addr - old_opcodes];
- break;
- case ZEND_CATCH:
- if (!(opline->extended_value & ZEND_LAST_CATCH)) {
- opline->op2.jmp_addr = &op_array->opcodes[opline->op2.jmp_addr - old_opcodes];
+ }
+ break;
+ case ZEND_FE_FETCH_R:
+ case ZEND_FE_FETCH_RW:
+ case ZEND_SWITCH_LONG:
+ case ZEND_SWITCH_STRING:
+ /* relative extended_value don't have to be changed */
+ break;
+#endif
+ case ZEND_IS_IDENTICAL:
+ case ZEND_IS_NOT_IDENTICAL:
+ case ZEND_IS_EQUAL:
+ case ZEND_IS_NOT_EQUAL:
+ case ZEND_IS_SMALLER:
+ case ZEND_IS_SMALLER_OR_EQUAL:
+ case ZEND_CASE:
+ case ZEND_ISSET_ISEMPTY_CV:
+ case ZEND_ISSET_ISEMPTY_VAR:
+ case ZEND_ISSET_ISEMPTY_DIM_OBJ:
+ case ZEND_ISSET_ISEMPTY_PROP_OBJ:
+ case ZEND_ISSET_ISEMPTY_STATIC_PROP:
+ case ZEND_INSTANCEOF:
+ case ZEND_TYPE_CHECK:
+ case ZEND_DEFINED:
+ case ZEND_IN_ARRAY:
+ case ZEND_ARRAY_KEY_EXISTS:
+ if (opline->result_type & IS_TMP_VAR) {
+ /* reinitialize result_type of smart branch instructions */
+ if (opline + 1 < end) {
+ if ((opline+1)->opcode == ZEND_JMPZ
+ && (opline+1)->op1_type == IS_TMP_VAR
+ && (opline+1)->op1.var == opline->result.var) {
+ opline->result_type = IS_SMART_BRANCH_JMPZ | IS_TMP_VAR;
+ } else if ((opline+1)->opcode == ZEND_JMPNZ
+ && (opline+1)->op1_type == IS_TMP_VAR
+ && (opline+1)->op1.var == opline->result.var) {
+ opline->result_type = IS_SMART_BRANCH_JMPNZ | IS_TMP_VAR;
+ }
}
- break;
- case ZEND_FE_FETCH_R:
- case ZEND_FE_FETCH_RW:
- case ZEND_SWITCH_LONG:
- case ZEND_SWITCH_STRING:
- /* relative extended_value don't have to be changed */
- break;
- }
+ }
+ break;
}
-#endif
+ zend_vm_set_opcode_handler_ex(opline, op1_info, op2_info, res_info);
opline++;
}
+
+ op_array->fn_flags |= ZEND_ACC_DONE_PASS_TWO;
}
-#endif
static void zend_optimize_op_array(zend_op_array *op_array,
zend_optimizer_ctx *ctx)
@@ -1257,12 +1317,6 @@ static void zend_optimize_op_array(zend_op_array *op_array,
zend_redo_pass_two(op_array);
if (op_array->live_range) {
-#if HAVE_DFA_PASS
- if ((ZEND_OPTIMIZER_PASS_6 & ctx->optimization_level) &&
- (ZEND_OPTIMIZER_PASS_7 & ctx->optimization_level)) {
- return;
- }
-#endif
zend_recalc_live_ranges(op_array, NULL);
}
}
@@ -1287,7 +1341,6 @@ static void zend_adjust_fcall_stack_size(zend_op_array *op_array, zend_optimizer
}
}
-#if HAVE_DFA_PASS
static void zend_adjust_fcall_stack_size_graph(zend_op_array *op_array)
{
zend_func_info *func_info = ZEND_FUNC_INFO(op_array);
@@ -1315,7 +1368,6 @@ static zend_bool needs_live_range(zend_op_array *op_array, zend_op *def_opline)
}
return 1;
}
-#endif
int zend_optimize_script(zend_script *script, zend_long optimization_level, zend_long debug_level)
{
@@ -1324,9 +1376,7 @@ int zend_optimize_script(zend_script *script, zend_long optimization_level, zend
zend_op_array *op_array;
zend_string *name;
zend_optimizer_ctx ctx;
-#if HAVE_DFA_PASS
zend_call_graph call_graph;
-#endif
ctx.arena = zend_arena_create(64 * 1024);
ctx.script = script;
@@ -1334,38 +1384,20 @@ int zend_optimize_script(zend_script *script, zend_long optimization_level, zend
ctx.optimization_level = optimization_level;
ctx.debug_level = debug_level;
- zend_optimize_op_array(&script->main_op_array, &ctx);
-
- ZEND_HASH_FOREACH_PTR(&script->function_table, op_array) {
- zend_optimize_op_array(op_array, &ctx);
- } ZEND_HASH_FOREACH_END();
-
- ZEND_HASH_FOREACH_STR_KEY_PTR(&script->class_table, key, ce) {
- if (ce->refcount > 1 && !zend_string_equals_ci(key, ce->name)) {
- continue;
- }
- ZEND_HASH_FOREACH_STR_KEY_PTR(&ce->function_table, name, op_array) {
- if (op_array->scope == ce
- && op_array->type == ZEND_USER_FUNCTION
- && !(op_array->fn_flags & ZEND_ACC_TRAIT_CLONE)) {
- zend_optimize_op_array(op_array, &ctx);
- }
- } ZEND_HASH_FOREACH_END();
- } ZEND_HASH_FOREACH_END();
-
-#if HAVE_DFA_PASS
if ((ZEND_OPTIMIZER_PASS_6 & optimization_level) &&
(ZEND_OPTIMIZER_PASS_7 & optimization_level) &&
- zend_build_call_graph(&ctx.arena, script, ZEND_RT_CONSTANTS, &call_graph) == SUCCESS) {
+ zend_build_call_graph(&ctx.arena, script, &call_graph) == SUCCESS) {
/* Optimize using call-graph */
- void *checkpoint = zend_arena_checkpoint(ctx.arena);
int i;
zend_func_info *func_info;
for (i = 0; i < call_graph.op_arrays_count; i++) {
zend_revert_pass_two(call_graph.op_arrays[i]);
+ zend_optimize(call_graph.op_arrays[i], &ctx);
}
+ zend_analyze_call_graph(&ctx.arena, script, &call_graph);
+
for (i = 0; i < call_graph.op_arrays_count; i++) {
func_info = ZEND_FUNC_INFO(call_graph.op_arrays[i]);
if (func_info) {
@@ -1444,16 +1476,11 @@ int zend_optimize_script(zend_script *script, zend_long optimization_level, zend
for (i = 0; i < call_graph.op_arrays_count; i++) {
ZEND_SET_FUNC_INFO(call_graph.op_arrays[i], NULL);
}
-
- zend_arena_release(&ctx.arena, checkpoint);
- } else
-#endif
-
- if (ZEND_OPTIMIZER_PASS_12 & optimization_level) {
- zend_adjust_fcall_stack_size(&script->main_op_array, &ctx);
+ } else {
+ zend_optimize_op_array(&script->main_op_array, &ctx);
ZEND_HASH_FOREACH_PTR(&script->function_table, op_array) {
- zend_adjust_fcall_stack_size(op_array, &ctx);
+ zend_optimize_op_array(op_array, &ctx);
} ZEND_HASH_FOREACH_END();
ZEND_HASH_FOREACH_STR_KEY_PTR(&script->class_table, key, ce) {
@@ -1464,10 +1491,31 @@ int zend_optimize_script(zend_script *script, zend_long optimization_level, zend
if (op_array->scope == ce
&& op_array->type == ZEND_USER_FUNCTION
&& !(op_array->fn_flags & ZEND_ACC_TRAIT_CLONE)) {
- zend_adjust_fcall_stack_size(op_array, &ctx);
+ zend_optimize_op_array(op_array, &ctx);
}
} ZEND_HASH_FOREACH_END();
} ZEND_HASH_FOREACH_END();
+
+ if (ZEND_OPTIMIZER_PASS_12 & optimization_level) {
+ zend_adjust_fcall_stack_size(&script->main_op_array, &ctx);
+
+ ZEND_HASH_FOREACH_PTR(&script->function_table, op_array) {
+ zend_adjust_fcall_stack_size(op_array, &ctx);
+ } ZEND_HASH_FOREACH_END();
+
+ ZEND_HASH_FOREACH_STR_KEY_PTR(&script->class_table, key, ce) {
+ if (ce->refcount > 1 && !zend_string_equals_ci(key, ce->name)) {
+ continue;
+ }
+ ZEND_HASH_FOREACH_STR_KEY_PTR(&ce->function_table, name, op_array) {
+ if (op_array->scope == ce
+ && op_array->type == ZEND_USER_FUNCTION
+ && !(op_array->fn_flags & ZEND_ACC_TRAIT_CLONE)) {
+ zend_adjust_fcall_stack_size(op_array, &ctx);
+ }
+ } ZEND_HASH_FOREACH_END();
+ } ZEND_HASH_FOREACH_END();
+ }
}
ZEND_HASH_FOREACH_STR_KEY_PTR(&script->class_table, key, ce) {
@@ -1497,11 +1545,11 @@ int zend_optimize_script(zend_script *script, zend_long optimization_level, zend
if ((debug_level & ZEND_DUMP_AFTER_OPTIMIZER) &&
(ZEND_OPTIMIZER_PASS_7 & optimization_level)) {
zend_dump_op_array(&script->main_op_array,
- ZEND_DUMP_RT_CONSTANTS | ZEND_DUMP_LIVE_RANGES, "after optimizer", NULL);
+ ZEND_DUMP_LIVE_RANGES, "after optimizer", NULL);
ZEND_HASH_FOREACH_PTR(&script->function_table, op_array) {
zend_dump_op_array(op_array,
- ZEND_DUMP_RT_CONSTANTS | ZEND_DUMP_LIVE_RANGES, "after optimizer", NULL);
+ ZEND_DUMP_LIVE_RANGES, "after optimizer", NULL);
} ZEND_HASH_FOREACH_END();
ZEND_HASH_FOREACH_PTR(&script->class_table, ce) {
@@ -1510,7 +1558,7 @@ int zend_optimize_script(zend_script *script, zend_long optimization_level, zend
&& op_array->type == ZEND_USER_FUNCTION
&& !(op_array->fn_flags & ZEND_ACC_TRAIT_CLONE)) {
zend_dump_op_array(op_array,
- ZEND_DUMP_RT_CONSTANTS | ZEND_DUMP_LIVE_RANGES, "after optimizer", NULL);
+ ZEND_DUMP_LIVE_RANGES, "after optimizer", NULL);
}
} ZEND_HASH_FOREACH_END();
} ZEND_HASH_FOREACH_END();
diff --git a/ext/opcache/Optimizer/zend_optimizer.h b/ext/opcache/Optimizer/zend_optimizer.h
index 2841d018a5..04528d33e2 100644
--- a/ext/opcache/Optimizer/zend_optimizer.h
+++ b/ext/opcache/Optimizer/zend_optimizer.h
@@ -25,9 +25,9 @@
#include "zend.h"
#include "zend_compile.h"
-#define ZEND_OPTIMIZER_PASS_1 (1<<0) /* CSE, STRING construction */
-#define ZEND_OPTIMIZER_PASS_2 (1<<1) /* Constant conversion and jumps */
-#define ZEND_OPTIMIZER_PASS_3 (1<<2) /* ++, +=, series of jumps */
+#define ZEND_OPTIMIZER_PASS_1 (1<<0) /* Simple local optimizations */
+#define ZEND_OPTIMIZER_PASS_2 (1<<1) /* */
+#define ZEND_OPTIMIZER_PASS_3 (1<<2) /* Jump optimization */
#define ZEND_OPTIMIZER_PASS_4 (1<<3) /* INIT_FCALL_BY_NAME -> DO_FCALL */
#define ZEND_OPTIMIZER_PASS_5 (1<<4) /* CFG based optimization */
#define ZEND_OPTIMIZER_PASS_6 (1<<5) /* DFA based optimization */
diff --git a/ext/opcache/Optimizer/zend_optimizer_internal.h b/ext/opcache/Optimizer/zend_optimizer_internal.h
index df7be73d4f..270a85c89a 100644
--- a/ext/opcache/Optimizer/zend_optimizer_internal.h
+++ b/ext/opcache/Optimizer/zend_optimizer_internal.h
@@ -98,7 +98,6 @@ int zend_optimizer_replace_by_const(zend_op_array *op_array,
zend_op *zend_optimizer_get_loop_var_def(const zend_op_array *op_array, zend_op *free_opline);
void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx);
-void zend_optimizer_pass2(zend_op_array *op_array);
void zend_optimizer_pass3(zend_op_array *op_array, zend_optimizer_ctx *ctx);
void zend_optimize_func_calls(zend_op_array *op_array, zend_optimizer_ctx *ctx);
void zend_optimize_cfg(zend_op_array *op_array, zend_optimizer_ctx *ctx);
@@ -111,7 +110,7 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx
void zend_optimizer_compact_vars(zend_op_array *op_array);
int zend_optimizer_is_disabled_func(const char *name, size_t len);
zend_function *zend_optimizer_get_called_func(
- zend_script *script, zend_op_array *op_array, zend_op *opline, zend_bool rt_constants);
+ zend_script *script, zend_op_array *op_array, zend_op *opline);
uint32_t zend_optimizer_classify_function(zend_string *name, uint32_t num_args);
void zend_optimizer_migrate_jump(zend_op_array *op_array, zend_op *new_opline, zend_op *opline);
void zend_optimizer_shift_jump(zend_op_array *op_array, zend_op *opline, uint32_t *shiftlist);
diff --git a/ext/opcache/Optimizer/zend_ssa.c b/ext/opcache/Optimizer/zend_ssa.c
index fdc383128b..41a5f10372 100644
--- a/ext/opcache/Optimizer/zend_ssa.c
+++ b/ext/opcache/Optimizer/zend_ssa.c
@@ -54,7 +54,7 @@ static zend_bool needs_pi(const zend_op_array *op_array, zend_dfg *dfg, zend_ssa
return 0;
}
- /* Make sure that both sucessors of the from block aren't the same. Pi nodes are associated
+ /* Make sure that both successors of the from block aren't the same. Pi nodes are associated
* with predecessor blocks, so we can't distinguish which edge the pi belongs to. */
from_block = &ssa->cfg.blocks[from];
ZEND_ASSERT(from_block->successors_count == 2);
@@ -161,7 +161,7 @@ static inline void pi_not_type_mask(zend_ssa_phi *phi, uint32_t type_mask) {
}
static inline uint32_t mask_for_type_check(uint32_t type) {
if (type & MAY_BE_ARRAY) {
- return MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_ANY|MAY_BE_ARRAY_OF_ANY|MAY_BE_ARRAY_OF_REF;
+ return type | (MAY_BE_ARRAY_KEY_ANY|MAY_BE_ARRAY_OF_ANY|MAY_BE_ARRAY_OF_REF);
} else {
return type;
}
@@ -192,14 +192,14 @@ static int find_adjusted_tmp_var(const zend_op_array *op_array, uint32_t build_f
}
} else if (op->opcode == ZEND_ADD) {
if (op->op1_type == IS_CV && op->op2_type == IS_CONST) {
- zv = CRT_CONSTANT_EX(op_array, op, op->op2, (build_flags & ZEND_RT_CONSTANTS));
+ zv = CRT_CONSTANT_EX(op_array, op, op->op2);
if (Z_TYPE_P(zv) == IS_LONG
&& Z_LVAL_P(zv) != ZEND_LONG_MIN) {
*adjustment = -Z_LVAL_P(zv);
return EX_VAR_TO_NUM(op->op1.var);
}
} else if (op->op2_type == IS_CV && op->op1_type == IS_CONST) {
- zv = CRT_CONSTANT_EX(op_array, op, op->op1, (build_flags & ZEND_RT_CONSTANTS));
+ zv = CRT_CONSTANT_EX(op_array, op, op->op1);
if (Z_TYPE_P(zv) == IS_LONG
&& Z_LVAL_P(zv) != ZEND_LONG_MIN) {
*adjustment = -Z_LVAL_P(zv);
@@ -208,7 +208,7 @@ static int find_adjusted_tmp_var(const zend_op_array *op_array, uint32_t build_f
}
} else if (op->opcode == ZEND_SUB) {
if (op->op1_type == IS_CV && op->op2_type == IS_CONST) {
- zv = CRT_CONSTANT_EX(op_array, op, op->op2, (build_flags & ZEND_RT_CONSTANTS));
+ zv = CRT_CONSTANT_EX(op_array, op, op->op2);
if (Z_TYPE_P(zv) == IS_LONG) {
*adjustment = Z_LVAL_P(zv);
return EX_VAR_TO_NUM(op->op1.var);
@@ -223,7 +223,7 @@ static int find_adjusted_tmp_var(const zend_op_array *op_array, uint32_t build_f
/* e-SSA construction: Pi placement (Pi is actually a Phi with single
* source and constraint).
- * Order of Phis is importent, Pis must be placed before Phis
+ * Order of Phis is important, Pis must be placed before Phis
*/
static void place_essa_pis(
zend_arena **arena, const zend_script *script, const zend_op_array *op_array,
@@ -293,7 +293,7 @@ static void place_essa_pis(
} else if (var1 >= 0 && var2 < 0) {
zend_long add_val2 = 0;
if ((opline-1)->op2_type == IS_CONST) {
- zval *zv = CRT_CONSTANT_EX(op_array, (opline-1), (opline-1)->op2, (build_flags & ZEND_RT_CONSTANTS));
+ zval *zv = CRT_CONSTANT_EX(op_array, (opline-1), (opline-1)->op2);
if (Z_TYPE_P(zv) == IS_LONG) {
add_val2 = Z_LVAL_P(zv);
@@ -315,9 +315,9 @@ static void place_essa_pis(
} else if (var1 < 0 && var2 >= 0) {
zend_long add_val1 = 0;
if ((opline-1)->op1_type == IS_CONST) {
- zval *zv = CRT_CONSTANT_EX(op_array, (opline-1), (opline-1)->op1, (build_flags & ZEND_RT_CONSTANTS));
+ zval *zv = CRT_CONSTANT_EX(op_array, (opline-1), (opline-1)->op1);
if (Z_TYPE_P(zv) == IS_LONG) {
- add_val1 = Z_LVAL_P(CRT_CONSTANT_EX(op_array, (opline-1), (opline-1)->op1, (build_flags & ZEND_RT_CONSTANTS)));
+ add_val1 = Z_LVAL_P(CRT_CONSTANT_EX(op_array, (opline-1), (opline-1)->op1));
} else if (Z_TYPE_P(zv) == IS_FALSE) {
add_val1 = 0;
} else if (Z_TYPE_P(zv) == IS_TRUE) {
@@ -427,7 +427,7 @@ static void place_essa_pis(
pi_range_not_equals(pi, -1, 1);
}
}
- } else if (opline->op1_type == IS_VAR &&
+ } else if (opline->op1_type == IS_TMP_VAR &&
((opline-1)->opcode == ZEND_PRE_INC ||
(opline-1)->opcode == ZEND_PRE_DEC) &&
opline->op1.var == (opline-1)->result.var &&
@@ -463,10 +463,10 @@ static void place_essa_pis(
uint32_t type_mask;
if ((opline-1)->op1_type == IS_CV && (opline-1)->op2_type == IS_CONST) {
var = EX_VAR_TO_NUM((opline-1)->op1.var);
- val = CRT_CONSTANT_EX(op_array, (opline-1), (opline-1)->op2, (build_flags & ZEND_RT_CONSTANTS));
+ val = CRT_CONSTANT_EX(op_array, (opline-1), (opline-1)->op2);
} else if ((opline-1)->op1_type == IS_CONST && (opline-1)->op2_type == IS_CV) {
var = EX_VAR_TO_NUM((opline-1)->op2.var);
- val = CRT_CONSTANT_EX(op_array, (opline-1), (opline-1)->op1, (build_flags & ZEND_RT_CONSTANTS));
+ val = CRT_CONSTANT_EX(op_array, (opline-1), (opline-1)->op1);
} else {
continue;
}
@@ -497,7 +497,7 @@ static void place_essa_pis(
opline->op1.var == (opline-1)->result.var && (opline-1)->op1_type == IS_CV &&
(opline-1)->op2_type == IS_CONST) {
int var = EX_VAR_TO_NUM((opline-1)->op1.var);
- zend_string *lcname = Z_STR_P(CRT_CONSTANT_EX(op_array, (opline-1), (opline-1)->op2, (build_flags & ZEND_RT_CONSTANTS)) + 1);
+ zend_string *lcname = Z_STR_P(CRT_CONSTANT_EX(op_array, (opline-1), (opline-1)->op2) + 1);
zend_class_entry *ce = script ? zend_hash_find_ptr(&script->class_table, lcname) : NULL;
if (!ce) {
ce = zend_hash_find_ptr(CG(class_table), lcname);
@@ -522,7 +522,7 @@ static int zend_ssa_rename(const zend_op_array *op_array, uint32_t build_flags,
zend_ssa_op *ssa_ops = ssa->ops;
int ssa_vars_count = ssa->vars_count;
int i, j;
- zend_op *opline, *end;
+ zend_op *opline, *end, *next;
int *tmp = NULL;
ALLOCA_FLAG(use_heap = 0);
@@ -552,39 +552,22 @@ static int zend_ssa_rename(const zend_op_array *op_array, uint32_t build_flags,
for (; opline < end; opline++) {
uint32_t k = opline - op_array->opcodes;
if (opline->opcode != ZEND_OP_DATA) {
- zend_op *next = opline + 1;
- if (next < end && next->opcode == ZEND_OP_DATA) {
- if (next->op1_type == IS_CV) {
- ssa_ops[k + 1].op1_use = var[EX_VAR_TO_NUM(next->op1.var)];
- //USE_SSA_VAR(next->op1.var);
- } else if (next->op1_type & (IS_VAR|IS_TMP_VAR)) {
- ssa_ops[k + 1].op1_use = var[EX_VAR_TO_NUM(next->op1.var)];
- //USE_SSA_VAR(op_array->last_var + next->op1.var);
- }
- if (next->op2_type == IS_CV) {
- ssa_ops[k + 1].op2_use = var[EX_VAR_TO_NUM(next->op2.var)];
- //USE_SSA_VAR(next->op2.var);
- } else if (next->op2_type & (IS_VAR|IS_TMP_VAR)) {
- ssa_ops[k + 1].op2_use = var[EX_VAR_TO_NUM(next->op2.var)];
- //USE_SSA_VAR(op_array->last_var + next->op2.var);
- }
- }
+
if (opline->op1_type & (IS_CV|IS_VAR|IS_TMP_VAR)) {
ssa_ops[k].op1_use = var[EX_VAR_TO_NUM(opline->op1.var)];
//USE_SSA_VAR(op_array->last_var + opline->op1.var)
}
- if (opline->opcode == ZEND_FE_FETCH_R || opline->opcode == ZEND_FE_FETCH_RW) {
- if (opline->op2_type == IS_CV) {
- ssa_ops[k].op2_use = var[EX_VAR_TO_NUM(opline->op2.var)];
- }
- ssa_ops[k].op2_def = ssa_vars_count;
- var[EX_VAR_TO_NUM(opline->op2.var)] = ssa_vars_count;
- ssa_vars_count++;
- //NEW_SSA_VAR(opline->op2.var)
- } else if (opline->op2_type & (IS_CV|IS_VAR|IS_TMP_VAR)) {
+ if (opline->op2_type & (IS_CV|IS_VAR|IS_TMP_VAR)) {
ssa_ops[k].op2_use = var[EX_VAR_TO_NUM(opline->op2.var)];
//USE_SSA_VAR(op_array->last_var + opline->op2.var)
}
+ if ((build_flags & ZEND_SSA_USE_CV_RESULTS)
+ && opline->result_type == IS_CV
+ && opline->opcode != ZEND_RECV) {
+ ssa_ops[k].result_use = var[EX_VAR_TO_NUM(opline->result.var)];
+ //USE_SSA_VAR(op_array->last_var + opline->result.var)
+ }
+
switch (opline->opcode) {
case ZEND_ASSIGN:
if ((build_flags & ZEND_SSA_RC_INFERENCE) && opline->op2_type == IS_CV) {
@@ -594,6 +577,7 @@ static int zend_ssa_rename(const zend_op_array *op_array, uint32_t build_flags,
//NEW_SSA_VAR(opline->op2.var)
}
if (opline->op1_type == IS_CV) {
+add_op1_def:
ssa_ops[k].op1_def = ssa_vars_count;
var[EX_VAR_TO_NUM(opline->op1.var)] = ssa_vars_count;
ssa_vars_count++;
@@ -601,7 +585,6 @@ static int zend_ssa_rename(const zend_op_array *op_array, uint32_t build_flags,
}
break;
case ZEND_ASSIGN_REF:
-//TODO: ???
if (opline->op2_type == IS_CV) {
ssa_ops[k].op2_def = ssa_vars_count;
var[EX_VAR_TO_NUM(opline->op2.var)] = ssa_vars_count;
@@ -609,90 +592,95 @@ static int zend_ssa_rename(const zend_op_array *op_array, uint32_t build_flags,
//NEW_SSA_VAR(opline->op2.var)
}
if (opline->op1_type == IS_CV) {
- ssa_ops[k].op1_def = ssa_vars_count;
- var[EX_VAR_TO_NUM(opline->op1.var)] = ssa_vars_count;
- ssa_vars_count++;
- //NEW_SSA_VAR(opline->op1.var)
- }
- break;
- case ZEND_BIND_GLOBAL:
- case ZEND_BIND_STATIC:
- if (opline->op1_type == IS_CV) {
- ssa_ops[k].op1_def = ssa_vars_count;
- var[EX_VAR_TO_NUM(opline->op1.var)] = ssa_vars_count;
- ssa_vars_count++;
- //NEW_SSA_VAR(opline->op1.var)
+ goto add_op1_def;
}
break;
case ZEND_ASSIGN_DIM:
case ZEND_ASSIGN_OBJ:
- if (opline->op1_type == IS_CV) {
- ssa_ops[k].op1_def = ssa_vars_count;
- var[EX_VAR_TO_NUM(opline->op1.var)] = ssa_vars_count;
- ssa_vars_count++;
- //NEW_SSA_VAR(opline->op1.var)
+ next = opline + 1;
+ if (next->op1_type & (IS_CV|IS_VAR|IS_TMP_VAR)) {
+ ssa_ops[k + 1].op1_use = var[EX_VAR_TO_NUM(next->op1.var)];
+ //USE_SSA_VAR(op_array->last_var + next->op1.var);
+ if (build_flags & ZEND_SSA_RC_INFERENCE && next->op1_type == IS_CV) {
+ ssa_ops[k + 1].op1_def = ssa_vars_count;
+ var[EX_VAR_TO_NUM(next->op1.var)] = ssa_vars_count;
+ ssa_vars_count++;
+ //NEW_SSA_VAR(next->op1.var)
+ }
}
- if ((build_flags & ZEND_SSA_RC_INFERENCE) && next->op1_type == IS_CV) {
- ssa_ops[k + 1].op1_def = ssa_vars_count;
- var[EX_VAR_TO_NUM(next->op1.var)] = ssa_vars_count;
- ssa_vars_count++;
- //NEW_SSA_VAR(next->op1.var)
+ if (opline->op1_type == IS_CV) {
+ goto add_op1_def;
}
break;
case ZEND_ASSIGN_OBJ_REF:
- if (opline->op1_type == IS_CV) {
- ssa_ops[k].op1_def = ssa_vars_count;
- var[EX_VAR_TO_NUM(opline->op1.var)] = ssa_vars_count;
- ssa_vars_count++;
- //NEW_SSA_VAR(opline->op1.var)
+ next = opline + 1;
+ if (next->op1_type & (IS_CV|IS_VAR|IS_TMP_VAR)) {
+ ssa_ops[k + 1].op1_use = var[EX_VAR_TO_NUM(next->op1.var)];
+ //USE_SSA_VAR(op_array->last_var + next->op1.var);
+ if (next->op1_type == IS_CV) {
+ ssa_ops[k + 1].op1_def = ssa_vars_count;
+ var[EX_VAR_TO_NUM(next->op1.var)] = ssa_vars_count;
+ ssa_vars_count++;
+ //NEW_SSA_VAR(next->op1.var)
+ }
}
- /* break missing intentionally */
- case ZEND_ASSIGN_STATIC_PROP_REF:
- if (next->op1_type == IS_CV) {
- ssa_ops[k + 1].op1_def = ssa_vars_count;
- var[EX_VAR_TO_NUM(next->op1.var)] = ssa_vars_count;
- ssa_vars_count++;
- //NEW_SSA_VAR(next->op1.var)
+ if (opline->op1_type == IS_CV) {
+ goto add_op1_def;
}
break;
- case ZEND_PRE_INC_OBJ:
- case ZEND_PRE_DEC_OBJ:
- case ZEND_POST_INC_OBJ:
- case ZEND_POST_DEC_OBJ:
- if (opline->op1_type == IS_CV) {
- ssa_ops[k].op1_def = ssa_vars_count;
- var[EX_VAR_TO_NUM(opline->op1.var)] = ssa_vars_count;
- ssa_vars_count++;
- //NEW_SSA_VAR(opline->op1.var)
+ case ZEND_ASSIGN_STATIC_PROP:
+ next = opline + 1;
+ if (next->op1_type & (IS_CV|IS_VAR|IS_TMP_VAR)) {
+ ssa_ops[k + 1].op1_use = var[EX_VAR_TO_NUM(next->op1.var)];
+ //USE_SSA_VAR(op_array->last_var + next->op1.var);
+#if 0
+ if ((build_flags & ZEND_SSA_RC_INFERENCE) && next->op1_type == IS_CV) {
+ ssa_ops[k + 1].op1_def = ssa_vars_count;
+ var[EX_VAR_TO_NUM(next->op1.var)] = ssa_vars_count;
+ ssa_vars_count++;
+ //NEW_SSA_VAR(next->op1.var)
+ }
+#endif
}
break;
- case ZEND_ADD_ARRAY_ELEMENT:
- ssa_ops[k].result_use = var[EX_VAR_TO_NUM(opline->result.var)];
- case ZEND_INIT_ARRAY:
- if (((build_flags & ZEND_SSA_RC_INFERENCE)
- || (opline->extended_value & ZEND_ARRAY_ELEMENT_REF))
- && opline->op1_type == IS_CV) {
- ssa_ops[k].op1_def = ssa_vars_count;
- var[EX_VAR_TO_NUM(opline->op1.var)] = ssa_vars_count;
- ssa_vars_count++;
- //NEW_SSA_VAR(opline+->op1.var)
+ case ZEND_ASSIGN_STATIC_PROP_REF:
+ next = opline + 1;
+ if (next->op1_type & (IS_CV|IS_VAR|IS_TMP_VAR)) {
+ ssa_ops[k + 1].op1_use = var[EX_VAR_TO_NUM(next->op1.var)];
+ //USE_SSA_VAR(op_array->last_var + next->op1.var);
+ if (next->op1_type == IS_CV) {
+ ssa_ops[k + 1].op1_def = ssa_vars_count;
+ var[EX_VAR_TO_NUM(next->op1.var)] = ssa_vars_count;
+ ssa_vars_count++;
+ //NEW_SSA_VAR(next->op1.var)
+ }
}
break;
- case ZEND_ADD_ARRAY_UNPACK:
- ssa_ops[k].result_use = var[EX_VAR_TO_NUM(opline->result.var)];
+ case ZEND_ASSIGN_STATIC_PROP_OP:
+ next = opline + 1;
+ if (next->op1_type & (IS_CV|IS_VAR|IS_TMP_VAR)) {
+ ssa_ops[k + 1].op1_use = var[EX_VAR_TO_NUM(next->op1.var)];
+ //USE_SSA_VAR(op_array->last_var + next->op1.var);
+ }
break;
- case ZEND_SEND_VAR:
- case ZEND_CAST:
- case ZEND_QM_ASSIGN:
- case ZEND_JMP_SET:
- case ZEND_COALESCE:
- if ((build_flags & ZEND_SSA_RC_INFERENCE) && opline->op1_type == IS_CV) {
- ssa_ops[k].op1_def = ssa_vars_count;
- var[EX_VAR_TO_NUM(opline->op1.var)] = ssa_vars_count;
- ssa_vars_count++;
- //NEW_SSA_VAR(opline->op1.var)
+ case ZEND_ASSIGN_DIM_OP:
+ case ZEND_ASSIGN_OBJ_OP:
+ next = opline + 1;
+ if (next->op1_type & (IS_CV|IS_VAR|IS_TMP_VAR)) {
+ ssa_ops[k + 1].op1_use = var[EX_VAR_TO_NUM(next->op1.var)];
+ //USE_SSA_VAR(op_array->last_var + next->op1.var);
+ }
+ if (opline->op1_type == IS_CV) {
+ goto add_op1_def;
}
break;
+ case ZEND_ASSIGN_OP:
+ case ZEND_PRE_INC:
+ case ZEND_PRE_DEC:
+ case ZEND_POST_INC:
+ case ZEND_POST_DEC:
+ case ZEND_BIND_GLOBAL:
+ case ZEND_BIND_STATIC:
case ZEND_SEND_VAR_NO_REF:
case ZEND_SEND_VAR_NO_REF_EX:
case ZEND_SEND_VAR_EX:
@@ -701,96 +689,81 @@ static int zend_ssa_rename(const zend_op_array *op_array, uint32_t build_flags,
case ZEND_SEND_UNPACK:
case ZEND_FE_RESET_RW:
case ZEND_MAKE_REF:
- if (opline->op1_type == IS_CV) {
- ssa_ops[k].op1_def = ssa_vars_count;
- var[EX_VAR_TO_NUM(opline->op1.var)] = ssa_vars_count;
- ssa_vars_count++;
- //NEW_SSA_VAR(opline->op1.var)
- }
- break;
- case ZEND_FE_RESET_R:
- if ((build_flags & ZEND_SSA_RC_INFERENCE) && opline->op1_type == IS_CV) {
- ssa_ops[k].op1_def = ssa_vars_count;
- var[EX_VAR_TO_NUM(opline->op1.var)] = ssa_vars_count;
- ssa_vars_count++;
- //NEW_SSA_VAR(opline->op1.var)
- }
- break;
- case ZEND_ASSIGN_OP:
- case ZEND_ASSIGN_DIM_OP:
- case ZEND_ASSIGN_OBJ_OP:
- case ZEND_ASSIGN_STATIC_PROP_OP:
- case ZEND_PRE_INC:
- case ZEND_PRE_DEC:
- case ZEND_POST_INC:
- case ZEND_POST_DEC:
- if (opline->op1_type == IS_CV) {
- ssa_ops[k].op1_def = ssa_vars_count;
- var[EX_VAR_TO_NUM(opline->op1.var)] = ssa_vars_count;
- ssa_vars_count++;
- //NEW_SSA_VAR(opline->op1.var)
- }
- break;
- case ZEND_UNSET_CV:
- ssa_ops[k].op1_def = ssa_vars_count;
- var[EX_VAR_TO_NUM(opline->op1.var)] = ssa_vars_count;
- ssa_vars_count++;
- break;
+ case ZEND_PRE_INC_OBJ:
+ case ZEND_PRE_DEC_OBJ:
+ case ZEND_POST_INC_OBJ:
+ case ZEND_POST_DEC_OBJ:
case ZEND_UNSET_DIM:
case ZEND_UNSET_OBJ:
case ZEND_FETCH_DIM_W:
case ZEND_FETCH_DIM_RW:
case ZEND_FETCH_DIM_FUNC_ARG:
case ZEND_FETCH_DIM_UNSET:
- case ZEND_FETCH_OBJ_W:
- case ZEND_FETCH_OBJ_RW:
- case ZEND_FETCH_OBJ_FUNC_ARG:
- case ZEND_FETCH_OBJ_UNSET:
case ZEND_FETCH_LIST_W:
if (opline->op1_type == IS_CV) {
- ssa_ops[k].op1_def = ssa_vars_count;
- var[EX_VAR_TO_NUM(opline->op1.var)] = ssa_vars_count;
- ssa_vars_count++;
- //NEW_SSA_VAR(opline->op1.var)
+ goto add_op1_def;
}
break;
- case ZEND_BIND_LEXICAL:
- if ((opline->extended_value & ZEND_BIND_REF) || (build_flags & ZEND_SSA_RC_INFERENCE)) {
- ssa_ops[k].op2_def = ssa_vars_count;
- var[EX_VAR_TO_NUM(opline->op2.var)] = ssa_vars_count;
- ssa_vars_count++;
+ case ZEND_SEND_VAR:
+ case ZEND_CAST:
+ case ZEND_QM_ASSIGN:
+ case ZEND_JMP_SET:
+ case ZEND_COALESCE:
+ case ZEND_FE_RESET_R:
+ if ((build_flags & ZEND_SSA_RC_INFERENCE) && opline->op1_type == IS_CV) {
+ goto add_op1_def;
+ }
+ break;
+ case ZEND_ADD_ARRAY_UNPACK:
+ ssa_ops[k].result_use = var[EX_VAR_TO_NUM(opline->result.var)];
+ break;
+ case ZEND_ADD_ARRAY_ELEMENT:
+ ssa_ops[k].result_use = var[EX_VAR_TO_NUM(opline->result.var)];
+ /* break missing intentionally */
+ case ZEND_INIT_ARRAY:
+ if (((build_flags & ZEND_SSA_RC_INFERENCE)
+ || (opline->extended_value & ZEND_ARRAY_ELEMENT_REF))
+ && opline->op1_type == IS_CV) {
+ goto add_op1_def;
}
break;
case ZEND_YIELD:
if (opline->op1_type == IS_CV
&& ((op_array->fn_flags & ZEND_ACC_RETURN_REFERENCE)
|| (build_flags & ZEND_SSA_RC_INFERENCE))) {
- ssa_ops[k].op1_def = ssa_vars_count;
- var[EX_VAR_TO_NUM(opline->op1.var)] = ssa_vars_count;
- ssa_vars_count++;
+ goto add_op1_def;
}
break;
+ case ZEND_UNSET_CV:
+ goto add_op1_def;
case ZEND_VERIFY_RETURN_TYPE:
if (opline->op1_type & (IS_TMP_VAR|IS_VAR|IS_CV)) {
- ssa_ops[k].op1_def = ssa_vars_count;
- var[EX_VAR_TO_NUM(opline->op1.var)] = ssa_vars_count;
+ goto add_op1_def;
+ }
+ break;
+ case ZEND_FE_FETCH_R:
+ case ZEND_FE_FETCH_RW:
+ if (opline->op2_type != IS_CV) {
+ ssa_ops[k].op2_use = -1; /* not used */
+ }
+ ssa_ops[k].op2_def = ssa_vars_count;
+ var[EX_VAR_TO_NUM(opline->op2.var)] = ssa_vars_count;
+ ssa_vars_count++;
+ //NEW_SSA_VAR(opline->op2.var)
+ break;
+ case ZEND_BIND_LEXICAL:
+ if ((opline->extended_value & ZEND_BIND_REF) || (build_flags & ZEND_SSA_RC_INFERENCE)) {
+ ssa_ops[k].op2_def = ssa_vars_count;
+ var[EX_VAR_TO_NUM(opline->op2.var)] = ssa_vars_count;
ssa_vars_count++;
- //NEW_SSA_VAR(opline->op1.var)
+ //NEW_SSA_VAR(opline->op2.var)
}
break;
default:
break;
}
- if (opline->result_type == IS_CV) {
- if ((build_flags & ZEND_SSA_USE_CV_RESULTS)
- && opline->opcode != ZEND_RECV) {
- ssa_ops[k].result_use = var[EX_VAR_TO_NUM(opline->result.var)];
- }
- ssa_ops[k].result_def = ssa_vars_count;
- var[EX_VAR_TO_NUM(opline->result.var)] = ssa_vars_count;
- ssa_vars_count++;
- //NEW_SSA_VAR(opline->result.var)
- } else if (opline->result_type & (IS_VAR|IS_TMP_VAR)) {
+
+ if (opline->result_type & (IS_CV|IS_VAR|IS_TMP_VAR)) {
ssa_ops[k].result_def = ssa_vars_count;
var[EX_VAR_TO_NUM(opline->result.var)] = ssa_vars_count;
ssa_vars_count++;
@@ -799,6 +772,10 @@ static int zend_ssa_rename(const zend_op_array *op_array, uint32_t build_flags,
}
}
+ zend_ssa_op *fe_fetch_ssa_op = blocks[n].len != 0
+ && ((end-1)->opcode == ZEND_FE_FETCH_R || (end-1)->opcode == ZEND_FE_FETCH_RW)
+ && (end-1)->op2_type == IS_CV
+ ? &ssa_ops[blocks[n].start + blocks[n].len - 1] : NULL;
for (i = 0; i < blocks[n].successors_count; i++) {
int succ = blocks[n].successors[i];
zend_ssa_phi *p;
@@ -828,6 +805,10 @@ static int zend_ssa_rename(const zend_op_array *op_array, uint32_t build_flags,
}
ZEND_ASSERT(j < blocks[succ].predecessors_count);
p->sources[j] = var[p->var];
+ if (fe_fetch_ssa_op && i == 0 && p->sources[j] == fe_fetch_ssa_op->op2_def) {
+ /* On the exit edge of an FE_FETCH, use the pre-modification value instead. */
+ p->sources[j] = fe_fetch_ssa_op->op2_use;
+ }
}
}
for (p = ssa_blocks[succ].phis; p && (p->pi >= 0); p = p->next) {
@@ -881,11 +862,10 @@ int zend_build_ssa(zend_arena **arena, const zend_script *script, const zend_op_
ALLOCA_FLAG(var_use_heap)
if ((blocks_count * (op_array->last_var + op_array->T)) > 4 * 1024 * 1024) {
- /* Don't buld SSA for very big functions */
+ /* Don't build SSA for very big functions */
return FAILURE;
}
- ssa->rt_constants = (build_flags & ZEND_RT_CONSTANTS);
ssa_blocks = zend_arena_calloc(arena, blocks_count, sizeof(zend_ssa_block));
ssa->blocks = ssa_blocks;
@@ -1125,8 +1105,6 @@ int zend_ssa_compute_use_def_chains(zend_arena **arena, const zend_op_array *op_
for (i = 0; i < op_array->last_var; i++) {
if ((ssa->cfg.flags & ZEND_FUNC_INDIRECT_VAR_ACCESS)) {
ssa_vars[i].alias = SYMTABLE_ALIAS;
- } else if (zend_string_equals_literal(op_array->vars[i], "php_errormsg")) {
- ssa_vars[i].alias = PHP_ERRORMSG_ALIAS;
} else if (zend_string_equals_literal(op_array->vars[i], "http_response_header")) {
ssa_vars[i].alias = HTTP_RESPONSE_HEADER_ALIAS;
}
diff --git a/ext/opcache/Optimizer/zend_ssa.h b/ext/opcache/Optimizer/zend_ssa.h
index 0dbbf40efd..5abe44c93d 100644
--- a/ext/opcache/Optimizer/zend_ssa.h
+++ b/ext/opcache/Optimizer/zend_ssa.h
@@ -95,7 +95,6 @@ typedef struct _zend_ssa_op {
typedef enum _zend_ssa_alias_kind {
NO_ALIAS,
SYMTABLE_ALIAS,
- PHP_ERRORMSG_ALIAS,
HTTP_RESPONSE_HEADER_ALIAS
} zend_ssa_alias_kind;
@@ -114,7 +113,7 @@ typedef struct _zend_ssa_var {
int use_chain; /* uses of this value, linked through opN_use_chain */
zend_ssa_phi *phi_use_chain; /* uses of this value in Phi, linked through use_chain */
zend_ssa_phi *sym_use_chain; /* uses of this value in Pi constraints */
- unsigned int no_val : 1; /* value doesn't mater (used as op1 in ZEND_ASSIGN) */
+ unsigned int no_val : 1; /* value doesn't matter (used as op1 in ZEND_ASSIGN) */
unsigned int scc_entry : 1;
unsigned int alias : 2; /* value may be changed indirectly */
unsigned int escape_state : 2;
@@ -132,12 +131,11 @@ typedef struct _zend_ssa_var_info {
typedef struct _zend_ssa {
zend_cfg cfg; /* control flow graph */
- int rt_constants; /* run-time or compile-time */
int vars_count; /* number of SSA variables */
+ int sccs; /* number of SCCs */
zend_ssa_block *blocks; /* array of SSA blocks */
zend_ssa_op *ops; /* array of SSA instructions */
zend_ssa_var *vars; /* use/def chain of SSA variables */
- int sccs; /* number of SCCs */
zend_ssa_var_info *var_info;
} zend_ssa;
@@ -217,10 +215,9 @@ static zend_always_inline zend_bool zend_ssa_is_no_val_use(const zend_op *opline
if (opline->opcode == ZEND_ASSIGN || opline->opcode == ZEND_UNSET_CV) {
return ssa_op->op1_use == var && ssa_op->op2_use != var;
}
- // TODO: Reenable this after changing the SSA structure.
- /*if (opline->opcode == ZEND_FE_FETCH_R) {
+ if (opline->opcode == ZEND_FE_FETCH_R || opline->opcode == ZEND_FE_FETCH_RW) {
return ssa_op->op2_use == var && ssa_op->op1_use != var;
- }*/
+ }
if (ssa_op->result_use == var
&& opline->opcode != ZEND_ADD_ARRAY_ELEMENT
&& opline->opcode != ZEND_ADD_ARRAY_UNPACK) {
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index c7d73a999a..938f524ff5 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -31,6 +31,7 @@
#include "zend_accelerator_blacklist.h"
#include "zend_list.h"
#include "zend_execute.h"
+#include "zend_vm.h"
#include "zend_inheritance.h"
#include "zend_exceptions.h"
#include "main/php_main.h"
@@ -47,6 +48,10 @@
#include "ext/standard/md5.h"
#include "ext/hash/php_hash.h"
+#ifdef HAVE_JIT
+# include "jit/zend_jit.h"
+#endif
+
#ifndef ZEND_WIN32
#include <netdb.h>
#endif
@@ -86,19 +91,6 @@ typedef int gid_t;
#include <immintrin.h>
#endif
-#define SHM_PROTECT() \
- do { \
- if (ZCG(accel_directives).protect_memory) { \
- zend_accel_shared_protect(1); \
- } \
- } while (0)
-#define SHM_UNPROTECT() \
- do { \
- if (ZCG(accel_directives).protect_memory) { \
- zend_accel_shared_protect(0); \
- } \
- } while (0)
-
ZEND_EXTENSION();
#ifndef ZTS
@@ -610,10 +602,13 @@ static void accel_copy_permanent_strings(zend_new_interned_string_func_t new_int
num_args++;
}
for (i = 0 ; i < num_args; i++) {
- if (ZEND_TYPE_IS_CLASS(arg_info[i].type)) {
- zend_bool allow_null = ZEND_TYPE_ALLOW_NULL(arg_info[i].type);
- arg_info[i].type = ZEND_TYPE_ENCODE_CLASS(new_interned_string(ZEND_TYPE_NAME(arg_info[i].type)), allow_null);
- }
+ zend_type *single_type;
+ ZEND_TYPE_FOREACH(arg_info[i].type, single_type) {
+ if (ZEND_TYPE_HAS_NAME(*single_type)) {
+ ZEND_TYPE_SET_PTR(*single_type,
+ new_interned_string(ZEND_TYPE_NAME(*single_type)));
+ }
+ } ZEND_TYPE_FOREACH_END();
}
}
} ZEND_HASH_FOREACH_END();
@@ -786,6 +781,8 @@ static inline void kill_all_lockers(struct flock *mem_usage_check)
/* Process died before the signal was sent */
success = 1;
zend_accel_error(ACCEL_LOG_WARNING, "Process %d died before SIGKILL was sent", mem_usage_check->l_pid);
+ } else if (errno != 0) {
+ zend_accel_error(ACCEL_LOG_WARNING, "Failed to send SIGKILL to locker %d: %s", mem_usage_check->l_pid, strerror(errno));
}
break;
}
@@ -796,6 +793,8 @@ static inline void kill_all_lockers(struct flock *mem_usage_check)
/* successfully killed locker, process no longer exists */
success = 1;
zend_accel_error(ACCEL_LOG_WARNING, "Killed locker %d", mem_usage_check->l_pid);
+ } else if (errno != 0) {
+ zend_accel_error(ACCEL_LOG_WARNING, "Failed to check locker %d: %s", mem_usage_check->l_pid, strerror(errno));
}
break;
}
@@ -805,7 +804,7 @@ static inline void kill_all_lockers(struct flock *mem_usage_check)
/* errno is not ESRCH or we ran out of tries to kill the locker */
ZCSG(force_restart_time) = time(NULL); /* restore forced restart request */
/* cannot kill the locker, bail out with error */
- zend_accel_error(ACCEL_LOG_ERROR, "Cannot kill process %d: %s!", mem_usage_check->l_pid, strerror(errno));
+ zend_accel_error(ACCEL_LOG_ERROR, "Cannot kill process %d!", mem_usage_check->l_pid);
}
mem_usage_check->l_type = F_WRLCK;
@@ -2479,6 +2478,11 @@ int accel_activate(INIT_FUNC_ARGS)
ZCG(pcre_reseted) = 1;
}
+
+#ifdef HAVE_JIT
+ zend_jit_activate();
+#endif
+
if (ZCSG(preload_script)) {
preload_activate();
}
@@ -2486,6 +2490,13 @@ int accel_activate(INIT_FUNC_ARGS)
return SUCCESS;
}
+#ifdef HAVE_JIT
+void accel_deactivate(void)
+{
+ zend_jit_deactivate();
+}
+#endif
+
int accel_post_deactivate(void)
{
if (ZCG(cwd)) {
@@ -2913,12 +2924,46 @@ static int accel_post_startup(void)
}
}
+ /* Initialize zend_func_info_rid */
+ zend_optimizer_startup();
+
/********************************************/
/* End of non-SHM dependent initializations */
/********************************************/
file_cache_only = ZCG(accel_directives).file_cache_only;
if (!file_cache_only) {
- switch (zend_shared_alloc_startup(ZCG(accel_directives).memory_consumption)) {
+ size_t shm_size = ZCG(accel_directives).memory_consumption;
+#ifdef HAVE_JIT
+ size_t jit_size = 0;
+ zend_bool reattached = 0;
+
+ if (ZCG(accel_directives).jit &&
+ ZCG(accel_directives).jit_buffer_size) {
+ size_t page_size;
+
+# ifdef _WIN32
+ SYSTEM_INFO system_info;
+ GetSystemInfo(&system_info);
+ page_size = system_info.dwPageSize;
+# else
+ page_size = getpagesize();
+# endif
+ if (!page_size || (page_size & (page_size - 1))) {
+ zend_accel_error(ACCEL_LOG_FATAL, "Failure to initialize shared memory structures - can't get page size.");
+ abort();
+ }
+ jit_size = ZCG(accel_directives).jit_buffer_size;
+ jit_size = ZEND_MM_ALIGNED_SIZE_EX(jit_size, page_size);
+ shm_size += jit_size;
+ } else {
+ ZCG(accel_directives).jit = 0;
+ ZCG(accel_directives).jit_buffer_size = 0;
+ }
+
+ switch (zend_shared_alloc_startup(shm_size, jit_size)) {
+#else
+ switch (zend_shared_alloc_startup(shm_size, 0)) {
+#endif
case ALLOC_SUCCESS:
if (zend_accel_init_shm() == FAILURE) {
accel_startup_ok = 0;
@@ -2930,6 +2975,9 @@ static int accel_post_startup(void)
zend_accel_error(ACCEL_LOG_FATAL, "Failure to initialize shared memory structures - probably not enough shared memory.");
return SUCCESS;
case SUCCESSFULLY_REATTACHED:
+#ifdef HAVE_JIT
+ reattached = 1;
+#endif
zend_shared_alloc_lock();
accel_shared_globals = (zend_accel_shared_globals *) ZSMMG(app_shared_globals);
zend_interned_strings_set_request_storage_handlers(accel_new_interned_string_for_php, accel_init_interned_string_for_php);
@@ -2961,6 +3009,16 @@ static int accel_post_startup(void)
zend_accel_init_auto_globals();
zend_shared_alloc_lock();
+#ifdef HAVE_JIT
+ if (ZCG(accel_directives).jit &&
+ ZCG(accel_directives).jit_buffer_size &&
+ ZSMMG(reserved) &&
+ zend_jit_startup(ZCG(accel_directives).jit, ZSMMG(reserved), jit_size, reattached) == SUCCESS) {
+ ZCG(jit_enabled) = 1;
+ } else {
+ ZCG(jit_enabled) = 0;
+ }
+#endif
zend_shared_alloc_save_state();
zend_shared_alloc_unlock();
@@ -3044,6 +3102,10 @@ void accel_shutdown(void)
zend_ini_entry *ini_entry;
zend_bool _file_cache_only = 0;
+#ifdef HAVE_JIT
+ zend_jit_shutdown();
+#endif
+
zend_optimizer_shutdown();
zend_accel_blacklist_shutdown(&accel_blacklist);
@@ -3068,7 +3130,7 @@ void accel_shutdown(void)
#endif
if (!_file_cache_only) {
- /* Delay SHM dettach */
+ /* Delay SHM detach */
orig_post_shutdown_cb = zend_post_shutdown_cb;
zend_post_shutdown_cb = accel_post_shutdown;
}
@@ -3515,67 +3577,72 @@ static zend_bool preload_try_resolve_constants(zend_class_entry *ce)
return ok;
}
+static zend_class_entry *preload_fetch_resolved_ce(zend_string *name, zend_class_entry *self_ce) {
+ zend_string *lcname = zend_string_tolower(name);
+ zend_class_entry *ce = zend_hash_find_ptr(EG(class_table), lcname);
+ zend_string_release(lcname);
+ if (!ce) {
+ return NULL;
+ }
+ if (ce == self_ce) {
+ /* Ignore the following requirements if this is the class referring to itself */
+ return ce;
+ }
+ if (!(ce->ce_flags & ZEND_ACC_CONSTANTS_UPDATED)) {
+ return NULL;
+ }
+ if (!(ce->ce_flags & ZEND_ACC_PROPERTY_TYPES_RESOLVED)) {
+ return NULL;
+ }
+ return ce;
+}
+
static zend_bool preload_try_resolve_property_types(zend_class_entry *ce)
{
zend_bool ok = 1;
- zend_property_info *prop;
- zend_class_entry *p;
-
if (ce->ce_flags & ZEND_ACC_HAS_TYPE_HINTS) {
+ zend_property_info *prop;
ZEND_HASH_FOREACH_PTR(&ce->properties_info, prop) {
- zend_string *name, *lcname;
-
- if (!ZEND_TYPE_IS_NAME(prop->type)) {
- continue;
- }
-
- name = ZEND_TYPE_NAME(prop->type);
- lcname = zend_string_tolower(name);
- p = zend_hash_find_ptr(EG(class_table), lcname);
- zend_string_release(lcname);
- if (!p) {
- ok = 0;
- continue;
- }
- if (p != ce) {
- if (!(p->ce_flags & ZEND_ACC_CONSTANTS_UPDATED)) {
- ok = 0;
- continue;
- }
- if (!(p->ce_flags & ZEND_ACC_PROPERTY_TYPES_RESOLVED)) {
+ zend_type *single_type;
+ ZEND_TYPE_FOREACH(prop->type, single_type) {
+ zend_class_entry *p = preload_fetch_resolved_ce(ZEND_TYPE_NAME(*single_type), ce);
+ if (!p) {
ok = 0;
continue;
}
- }
-
- zend_string_release(name);
- prop->type = ZEND_TYPE_ENCODE_CE(p, ZEND_TYPE_ALLOW_NULL(prop->type));
+ ZEND_TYPE_SET_CE(*single_type, p);
+ } ZEND_TYPE_FOREACH_END();
} ZEND_HASH_FOREACH_END();
}
return ok;
}
-static zend_bool preload_is_type_known(zend_class_entry *ce, zend_type type) {
- zend_string *name, *lcname;
- zend_bool known;
- if (!ZEND_TYPE_IS_NAME(type)) {
- return 1;
- }
-
- name = ZEND_TYPE_NAME(type);
+static zend_bool preload_is_class_type_known(zend_class_entry *ce, zend_string *name) {
if (zend_string_equals_literal_ci(name, "self") ||
zend_string_equals_literal_ci(name, "parent") ||
zend_string_equals_ci(name, ce->name)) {
return 1;
}
- lcname = zend_string_tolower(name);
- known = zend_hash_exists(EG(class_table), lcname);
+ zend_string *lcname = zend_string_tolower(name);
+ zend_bool known = zend_hash_exists(EG(class_table), lcname);
zend_string_release(lcname);
return known;
}
+static zend_bool preload_is_type_known(zend_class_entry *ce, zend_type *type) {
+ zend_type *single_type;
+ ZEND_TYPE_FOREACH(*type, single_type) {
+ if (ZEND_TYPE_HAS_NAME(*single_type)) {
+ if (!preload_is_class_type_known(ce, ZEND_TYPE_NAME(*single_type))) {
+ return 0;
+ }
+ }
+ } ZEND_TYPE_FOREACH_END();
+ return 1;
+}
+
static zend_bool preload_is_method_maybe_override(zend_class_entry *ce, zend_string *lcname) {
zend_class_entry *p;
if (ce->trait_aliases || ce->trait_precedences) {
@@ -3620,13 +3687,13 @@ static zend_bool preload_needed_types_known(zend_class_entry *ce) {
ZEND_HASH_FOREACH_STR_KEY_PTR(&ce->function_table, lcname, fptr) {
uint32_t i;
if (fptr->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) {
- if (!preload_is_type_known(ce, fptr->common.arg_info[-1].type) &&
+ if (!preload_is_type_known(ce, &fptr->common.arg_info[-1].type) &&
preload_is_method_maybe_override(ce, lcname)) {
return 0;
}
}
for (i = 0; i < fptr->common.num_args; i++) {
- if (!preload_is_type_known(ce, fptr->common.arg_info[i].type) &&
+ if (!preload_is_type_known(ce, &fptr->common.arg_info[i].type) &&
preload_is_method_maybe_override(ce, lcname)) {
return 0;
}
@@ -3916,11 +3983,14 @@ static void preload_ensure_classes_loadable() {
if (ce->ce_flags & ZEND_ACC_HAS_TYPE_HINTS) {
zend_property_info *prop;
ZEND_HASH_FOREACH_PTR(&ce->properties_info, prop) {
- if (ZEND_TYPE_IS_NAME(prop->type)) {
- zend_class_entry *ce =
- preload_load_prop_type(prop, ZEND_TYPE_NAME(prop->type));
- prop->type = ZEND_TYPE_ENCODE_CE(ce, ZEND_TYPE_ALLOW_NULL(prop->type));
- }
+ zend_type *single_type;
+ ZEND_TYPE_FOREACH(prop->type, single_type) {
+ if (ZEND_TYPE_HAS_NAME(*single_type)) {
+ zend_class_entry *ce = preload_load_prop_type(
+ prop, ZEND_TYPE_NAME(*single_type));
+ ZEND_TYPE_SET_CE(*single_type, ce);
+ }
+ } ZEND_TYPE_FOREACH_END();
} ZEND_HASH_FOREACH_END();
}
ce->ce_flags |= ZEND_ACC_PROPERTY_TYPES_RESOLVED;
@@ -4080,14 +4150,14 @@ static int preload_optimize(zend_persistent_script *script)
}
ZEND_HASH_FOREACH_PTR(&script->script.class_table, ce) {
- if (ce->ce_flags & ZEND_ACC_IMPLEMENT_TRAITS) {
+ if (ce->num_traits) {
preload_fix_trait_methods(ce);
}
} ZEND_HASH_FOREACH_END();
ZEND_HASH_FOREACH_PTR(preload_scripts, script) {
ZEND_HASH_FOREACH_PTR(&script->script.class_table, ce) {
- if (ce->ce_flags & ZEND_ACC_IMPLEMENT_TRAITS) {
+ if (ce->num_traits) {
preload_fix_trait_methods(ce);
}
} ZEND_HASH_FOREACH_END();
@@ -4235,7 +4305,7 @@ static void preload_load(void)
if (CG(map_ptr_last) != ZCSG(map_ptr_last)) {
CG(map_ptr_last) = ZCSG(map_ptr_last);
CG(map_ptr_size) = ZEND_MM_ALIGNED_SIZE_EX(CG(map_ptr_last) + 1, 4096);
- CG(map_ptr_base) = perealloc(CG(map_ptr_base), CG(map_ptr_size) * sizeof(void*), 1);
+ ZEND_MAP_PTR_SET_REAL_BASE(CG(map_ptr_base), perealloc(ZEND_MAP_PTR_REAL_BASE(CG(map_ptr_base)), CG(map_ptr_size) * sizeof(void*), 1));
}
}
@@ -4452,6 +4522,7 @@ static int accel_preload(const char *config)
#else
init_op_array(&script->script.main_op_array, ZEND_USER_FUNCTION, 2);
#endif
+ script->script.main_op_array.fn_flags |= ZEND_ACC_DONE_PASS_TWO;
script->script.main_op_array.last = 1;
script->script.main_op_array.last_literal = 1;
#if ZEND_USE_ABS_CONST_ADDR
@@ -4465,6 +4536,7 @@ static int accel_preload(const char *config)
script->script.main_op_array.opcodes[0].op1_type = IS_CONST;
script->script.main_op_array.opcodes[0].op1.constant = 0;
ZEND_PASS_TWO_UPDATE_CONSTANT(&script->script.main_op_array, script->script.main_op_array.opcodes, script->script.main_op_array.opcodes[0].op1);
+ zend_vm_set_opcode_handler(script->script.main_op_array.opcodes);
script->script.main_op_array.filename = filename;
script->script.filename = zend_string_copy(filename);
@@ -4583,13 +4655,13 @@ static int accel_finish_startup(void)
int rc;
int orig_error_reporting;
- int (*orig_activate)(TSRMLS_D) = sapi_module.activate;
- int (*orig_deactivate)(TSRMLS_D) = sapi_module.deactivate;
- void (*orig_register_server_variables)(zval *track_vars_array TSRMLS_DC) = sapi_module.register_server_variables;
- int (*orig_header_handler)(sapi_header_struct *sapi_header, sapi_header_op_enum op, sapi_headers_struct *sapi_headers TSRMLS_DC) = sapi_module.header_handler;
- int (*orig_send_headers)(sapi_headers_struct *sapi_headers TSRMLS_DC) = sapi_module.send_headers;
- void (*orig_send_header)(sapi_header_struct *sapi_header, void *server_context TSRMLS_DC)= sapi_module.send_header;
- char *(*orig_getenv)(char *name, size_t name_len TSRMLS_DC) = sapi_module.getenv;
+ int (*orig_activate)() = sapi_module.activate;
+ int (*orig_deactivate)() = sapi_module.deactivate;
+ void (*orig_register_server_variables)(zval *track_vars_array) = sapi_module.register_server_variables;
+ int (*orig_header_handler)(sapi_header_struct *sapi_header, sapi_header_op_enum op, sapi_headers_struct *sapi_headers) = sapi_module.header_handler;
+ int (*orig_send_headers)(sapi_headers_struct *sapi_headers) = sapi_module.send_headers;
+ void (*orig_send_header)(sapi_header_struct *sapi_header, void *server_context)= sapi_module.send_header;
+ char *(*orig_getenv)(char *name, size_t name_len) = sapi_module.getenv;
size_t (*orig_ub_write)(const char *str, size_t str_length) = sapi_module.ub_write;
void (*orig_flush)(void *server_context) = sapi_module.flush;
uint32_t orig_compiler_options = CG(compiler_options);
@@ -4787,7 +4859,11 @@ ZEND_EXT_API zend_extension zend_extension_entry = {
accel_startup, /* startup */
NULL, /* shutdown */
NULL, /* per-script activation */
+#ifdef HAVE_JIT
+ accel_deactivate, /* per-script deactivation */
+#else
NULL, /* per-script deactivation */
+#endif
NULL, /* message handler */
NULL, /* op_array handler */
NULL, /* extended statement handler */
diff --git a/ext/opcache/ZendAccelerator.h b/ext/opcache/ZendAccelerator.h
index c2f95d7c41..bb884d9cc9 100644
--- a/ext/opcache/ZendAccelerator.h
+++ b/ext/opcache/ZendAccelerator.h
@@ -191,6 +191,12 @@ typedef struct _zend_accel_directives {
#ifdef ZEND_WIN32
char *cache_id;
#endif
+#ifdef HAVE_JIT
+ zend_long jit;
+ zend_long jit_buffer_size;
+ zend_long jit_debug;
+ zend_long jit_bisect_limit;
+#endif
} zend_accel_directives;
typedef struct _zend_accel_globals {
@@ -221,6 +227,9 @@ typedef struct _zend_accel_globals {
void *arena_mem;
zend_persistent_script *current_persistent_script;
zend_bool is_immutable_class;
+#ifdef HAVE_JIT
+ zend_bool jit_enabled;
+#endif
/* cache to save hash lookup on the same INCLUDE opcode */
const zend_op *cache_opline;
zend_persistent_script *cache_persistent_script;
@@ -321,4 +330,19 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type);
zend_string* ZEND_FASTCALL accel_new_interned_string(zend_string *str);
+/* memory write protection */
+#define SHM_PROTECT() \
+ do { \
+ if (ZCG(accel_directives).protect_memory) { \
+ zend_accel_shared_protect(1); \
+ } \
+ } while (0)
+
+#define SHM_UNPROTECT() \
+ do { \
+ if (ZCG(accel_directives).protect_memory) { \
+ zend_accel_shared_protect(0); \
+ } \
+ } while (0)
+
#endif /* ZEND_ACCELERATOR_H */
diff --git a/ext/opcache/config.m4 b/ext/opcache/config.m4
index 6c40cafc1c..5e61575d48 100644
--- a/ext/opcache/config.m4
+++ b/ext/opcache/config.m4
@@ -11,6 +11,13 @@ PHP_ARG_ENABLE([huge-code-pages],
[yes],
[no])
+PHP_ARG_ENABLE([opcache-jit],
+ [whether to enable JIT],
+ [AS_HELP_STRING([--disable-opcache-jit],
+ [Disable JIT])],
+ [yes],
+ [no])
+
if test "$PHP_OPCACHE" != "no"; then
dnl Always build as shared extension
@@ -20,6 +27,67 @@ if test "$PHP_OPCACHE" != "no"; then
AC_DEFINE(HAVE_HUGE_CODE_PAGES, 1, [Define to enable copying PHP CODE pages into HUGE PAGES (experimental)])
fi
+ if test "$PHP_OPCACHE_JIT" = "yes"; then
+ case $host_cpu in
+ x86*)
+ ;;
+ *)
+ AC_MSG_WARN([JIT not supported by host architecture])
+ PHP_OPCACHE_JIT=no
+ ;;
+ esac
+ fi
+
+ if test "$PHP_OPCACHE_JIT" = "yes"; then
+ AC_DEFINE(HAVE_JIT, 1, [Define to enable JIT])
+ ZEND_JIT_SRC="jit/zend_jit.c jit/zend_jit_vm_helpers.c"
+
+ dnl Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case `/usr/bin/file conftest.o` in
+ *"Mach-O 64-bit"*)
+ DASM_FLAGS="-D X64APPLE=1 -D X64=1"
+ ;;
+ *64-bit*)
+ DASM_FLAGS="-D X64=1"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+
+ if test "$enable_zts" = "yes"; then
+ DASM_FLAGS="$DASM_FLAGS -D ZTS=1"
+ fi
+
+ PHP_SUBST(DASM_FLAGS)
+
+ AC_MSG_CHECKING(for opagent in default path)
+ for i in /usr/local /usr; do
+ if test -r $i/include/opagent.h; then
+ OPAGENT_DIR=$i
+ AC_MSG_RESULT(found in $i)
+ break
+ fi
+ done
+ if test -z "$OPAGENT_DIR"; then
+ AC_MSG_RESULT(not found)
+ else
+ PHP_CHECK_LIBRARY(opagent, op_write_native_code,
+ [
+ AC_DEFINE(HAVE_OPROFILE,1,[ ])
+ PHP_ADD_INCLUDE($OPAGENT_DIR/include)
+ PHP_ADD_LIBRARY_WITH_PATH(opagent, $OPAGENT_DIR/$PHP_LIBDIR/oprofile, OPCACHE_SHARED_LIBADD)
+ PHP_SUBST(OPCACHE_SHARED_LIBADD)
+ ],[
+ AC_MSG_RESULT(not found)
+ ],[
+ -L$OPAGENT_DIR/$PHP_LIBDIR/oprofile
+ ])
+ fi
+
+ fi
+
AC_CHECK_FUNCS([mprotect])
AC_MSG_CHECKING(for sysvipc shared memory support)
@@ -234,8 +302,7 @@ int main() {
shared_alloc_mmap.c \
shared_alloc_posix.c \
Optimizer/zend_optimizer.c \
- Optimizer/pass1_5.c \
- Optimizer/pass2.c \
+ Optimizer/pass1.c \
Optimizer/pass3.c \
Optimizer/optimize_func_calls.c \
Optimizer/block_pass.c \
@@ -254,10 +321,16 @@ int main() {
Optimizer/dce.c \
Optimizer/escape_analysis.c \
Optimizer/compact_vars.c \
- Optimizer/zend_dump.c,
+ Optimizer/zend_dump.c \
+ $ZEND_JIT_SRC,
shared,,-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1,,yes)
PHP_ADD_BUILD_DIR([$ext_builddir/Optimizer], 1)
PHP_ADD_EXTENSION_DEP(opcache, pcre)
+
+ if test "$PHP_OPCACHE_JIT" = "yes"; then
+ PHP_ADD_BUILD_DIR([$ext_builddir/jit], 1)
+ PHP_ADD_MAKEFILE_FRAGMENT($ext_srcdir/jit/Makefile.frag)
+ fi
PHP_SUBST(OPCACHE_SHARED_LIBADD)
fi
diff --git a/ext/opcache/config.w32 b/ext/opcache/config.w32
index fba1b1bef1..7c67ccf0f6 100644
--- a/ext/opcache/config.w32
+++ b/ext/opcache/config.w32
@@ -1,9 +1,10 @@
ARG_ENABLE("opcache", "whether to enable Zend OPcache support", "yes");
-/* var PHP_OPCACHE_PGO = false; */
if (PHP_OPCACHE != "no") {
+ ARG_ENABLE("opcache-jit", "whether to enable JIT", "yes");
+
ZEND_EXTENSION('opcache', "\
ZendAccelerator.c \
zend_accelerator_blacklist.c \
@@ -17,9 +18,29 @@ if (PHP_OPCACHE != "no") {
zend_shared_alloc.c \
shared_alloc_win32.c", true, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
- ADD_SOURCES(configure_module_dirname + "/Optimizer", "zend_optimizer.c pass1_5.c pass2.c pass3.c optimize_func_calls.c block_pass.c optimize_temp_vars_5.c nop_removal.c compact_literals.c zend_cfg.c zend_dfg.c dfa_pass.c zend_ssa.c zend_inference.c zend_func_info.c zend_call_graph.c sccp.c scdf.c dce.c escape_analysis.c compact_vars.c zend_dump.c", "opcache", "OptimizerObj");
+ if (PHP_OPCACHE_JIT == "yes") {
+ if (CHECK_HEADER_ADD_INCLUDE("dynasm/dasm_x86.h", "CFLAGS_OPCACHE", PHP_OPCACHE + ";ext\\opcache\\jit")) {
+ var dasm_flags = (X64 ? "-D X64=1" : "") + (X64 ? " -D X64WIN=1" : "") + " -D WIN=1";
+ if (PHP_ZTS == "yes") {
+ dasm_flags += " -D ZTS=1";
+ }
+ DEFINE("DASM_FLAGS", dasm_flags);
+
+ AC_DEFINE('HAVE_JIT', 1, 'Define to enable JIT');
+ /* XXX read this dynamically */
+ /*ADD_FLAG("CFLAGS_OPCACHE", "/D DASM_VERSION=10400");*/
+
+ ADD_MAKEFILE_FRAGMENT(configure_module_dirname + "\\jit\\Makefile.frag.w32");
+ ADD_SOURCES(configure_module_dirname + "\\jit", "zend_jit.c zend_jit_vm_helpers.c", "opcache", "opcache_jit");
+ } else {
+ WARNING("JIT not enabled, headers not found");
+ }
+ }
+
+ ADD_SOURCES(configure_module_dirname + "/Optimizer", "zend_optimizer.c pass1.c pass3.c optimize_func_calls.c block_pass.c optimize_temp_vars_5.c nop_removal.c compact_literals.c zend_cfg.c zend_dfg.c dfa_pass.c zend_ssa.c zend_inference.c zend_func_info.c zend_call_graph.c zend_dump.c escape_analysis.c compact_vars.c dce.c sccp.c scdf.c", "opcache", "OptimizerObj");
ADD_FLAG('CFLAGS_OPCACHE', "/I " + configure_module_dirname);
}
+
diff --git a/ext/opcache/jit/Makefile.frag b/ext/opcache/jit/Makefile.frag
new file mode 100644
index 0000000000..02e44c2654
--- /dev/null
+++ b/ext/opcache/jit/Makefile.frag
@@ -0,0 +1,17 @@
+
+$(builddir)/minilua: $(srcdir)/jit/dynasm/minilua.c
+ $(CC) $(srcdir)/jit/dynasm/minilua.c -lm -o $@
+
+$(builddir)/jit/zend_jit_x86.c: $(srcdir)/jit/zend_jit_x86.dasc $(srcdir)/jit/dynasm/*.lua $(builddir)/minilua
+ $(builddir)/minilua $(srcdir)/jit/dynasm/dynasm.lua $(DASM_FLAGS) -o $@ $(srcdir)/jit/zend_jit_x86.dasc
+
+$(builddir)/jit/zend_jit.lo: \
+ $(builddir)/jit/zend_jit_x86.c \
+ $(srcdir)/jit/zend_jit_helpers.c \
+ $(srcdir)/jit/zend_jit_disasm_x86.c \
+ $(srcdir)/jit/zend_jit_gdb.c \
+ $(srcdir)/jit/zend_jit_perf_dump.c \
+ $(srcdir)/jit/zend_jit_oprofile.c \
+ $(srcdir)/jit/zend_jit_vtune.c \
+ $(srcdir)/jit/zend_elf.c
+
diff --git a/ext/opcache/jit/Makefile.frag.w32 b/ext/opcache/jit/Makefile.frag.w32
new file mode 100644
index 0000000000..282f81bb74
--- /dev/null
+++ b/ext/opcache/jit/Makefile.frag.w32
@@ -0,0 +1,16 @@
+$(BUILD_DIR)\\minilua.exe: ext\opcache\jit\dynasm\minilua.c
+ @if exist $(BUILD_DIR)\\minilua.exe del $(BUILD_DIR)\\minilua.exe
+ $(PHP_CL) /Fo$(BUILD_DIR)\ /Fd$(BUILD_DIR)\ /Fp$(BUILD_DIR)\ /FR$(BUILD_DIR) /Fe$(BUILD_DIR)\minilua.exe ext\opcache\jit\dynasm\minilua.c
+
+ext\opcache\jit\zend_jit_x86.c: ext\opcache\jit\zend_jit_x86.dasc $(BUILD_DIR)\\minilua.exe
+ @if exist ext\opcache\jit\zend_jit_x86.c del ext\opcache\jit\zend_jit_x86.c
+ $(BUILD_DIR)\\minilua.exe ext/opcache/jit/dynasm/dynasm.lua $(DASM_FLAGS) -o $@ ext/opcache/jit/zend_jit_x86.dasc
+
+$(BUILD_DIR)\opcache_jit\zend_jit.obj: \
+ ext/opcache/jit/zend_jit_x86.c \
+ ext/opcache/jit/zend_jit_helpers.c \
+ ext/opcache/jit/zend_jit_disasm_x86.c \
+ ext/opcache/jit/zend_jit_gdb.c \
+ ext/opcache/jit/zend_jit_perf_dump.c \
+ ext/opcache/jit/zend_jit_oprofile.c \
+ ext/opcache/jit/zend_jit_vtune.c
diff --git a/ext/opcache/jit/dynasm/dasm_arm.h b/ext/opcache/jit/dynasm/dasm_arm.h
new file mode 100644
index 0000000000..0fa69ac06f
--- /dev/null
+++ b/ext/opcache/jit/dynasm/dasm_arm.h
@@ -0,0 +1,456 @@
+/*
+** DynASM ARM encoding engine.
+** Copyright (C) 2005-2016 Mike Pall. All rights reserved.
+** Released under the MIT license. See dynasm.lua for full copyright notice.
+*/
+
+#include <stddef.h>
+#include <stdarg.h>
+#include <string.h>
+#include <stdlib.h>
+
+#define DASM_ARCH "arm"
+
+#ifndef DASM_EXTERN
+#define DASM_EXTERN(a,b,c,d) 0
+#endif
+
+/* Action definitions. */
+enum {
+ DASM_STOP, DASM_SECTION, DASM_ESC, DASM_REL_EXT,
+ /* The following actions need a buffer position. */
+ DASM_ALIGN, DASM_REL_LG, DASM_LABEL_LG,
+ /* The following actions also have an argument. */
+ DASM_REL_PC, DASM_LABEL_PC,
+ DASM_IMM, DASM_IMM12, DASM_IMM16, DASM_IMML8, DASM_IMML12, DASM_IMMV8,
+ DASM__MAX
+};
+
+/* Maximum number of section buffer positions for a single dasm_put() call. */
+#define DASM_MAXSECPOS 25
+
+/* DynASM encoder status codes. Action list offset or number are or'ed in. */
+#define DASM_S_OK 0x00000000
+#define DASM_S_NOMEM 0x01000000
+#define DASM_S_PHASE 0x02000000
+#define DASM_S_MATCH_SEC 0x03000000
+#define DASM_S_RANGE_I 0x11000000
+#define DASM_S_RANGE_SEC 0x12000000
+#define DASM_S_RANGE_LG 0x13000000
+#define DASM_S_RANGE_PC 0x14000000
+#define DASM_S_RANGE_REL 0x15000000
+#define DASM_S_UNDEF_LG 0x21000000
+#define DASM_S_UNDEF_PC 0x22000000
+
+/* Macros to convert positions (8 bit section + 24 bit index). */
+#define DASM_POS2IDX(pos) ((pos)&0x00ffffff)
+#define DASM_POS2BIAS(pos) ((pos)&0xff000000)
+#define DASM_SEC2POS(sec) ((sec)<<24)
+#define DASM_POS2SEC(pos) ((pos)>>24)
+#define DASM_POS2PTR(D, pos) (D->sections[DASM_POS2SEC(pos)].rbuf + (pos))
+
+/* Action list type. */
+typedef const unsigned int *dasm_ActList;
+
+/* Per-section structure. */
+typedef struct dasm_Section {
+ int *rbuf; /* Biased buffer pointer (negative section bias). */
+ int *buf; /* True buffer pointer. */
+ size_t bsize; /* Buffer size in bytes. */
+ int pos; /* Biased buffer position. */
+ int epos; /* End of biased buffer position - max single put. */
+ int ofs; /* Byte offset into section. */
+} dasm_Section;
+
+/* Core structure holding the DynASM encoding state. */
+struct dasm_State {
+ size_t psize; /* Allocated size of this structure. */
+ dasm_ActList actionlist; /* Current actionlist pointer. */
+ int *lglabels; /* Local/global chain/pos ptrs. */
+ size_t lgsize;
+ int *pclabels; /* PC label chains/pos ptrs. */
+ size_t pcsize;
+ void **globals; /* Array of globals (bias -10). */
+ dasm_Section *section; /* Pointer to active section. */
+ size_t codesize; /* Total size of all code sections. */
+ int maxsection; /* 0 <= sectionidx < maxsection. */
+ int status; /* Status code. */
+ dasm_Section sections[1]; /* All sections. Alloc-extended. */
+};
+
+/* The size of the core structure depends on the max. number of sections. */
+#define DASM_PSZ(ms) (sizeof(dasm_State)+(ms-1)*sizeof(dasm_Section))
+
+
+/* Initialize DynASM state. */
+void dasm_init(Dst_DECL, int maxsection)
+{
+ dasm_State *D;
+ size_t psz = 0;
+ int i;
+ Dst_REF = NULL;
+ DASM_M_GROW(Dst, struct dasm_State, Dst_REF, psz, DASM_PSZ(maxsection));
+ D = Dst_REF;
+ D->psize = psz;
+ D->lglabels = NULL;
+ D->lgsize = 0;
+ D->pclabels = NULL;
+ D->pcsize = 0;
+ D->globals = NULL;
+ D->maxsection = maxsection;
+ for (i = 0; i < maxsection; i++) {
+ D->sections[i].buf = NULL; /* Need this for pass3. */
+ D->sections[i].rbuf = D->sections[i].buf - DASM_SEC2POS(i);
+ D->sections[i].bsize = 0;
+ D->sections[i].epos = 0; /* Wrong, but is recalculated after resize. */
+ }
+}
+
+/* Free DynASM state. */
+void dasm_free(Dst_DECL)
+{
+ dasm_State *D = Dst_REF;
+ int i;
+ for (i = 0; i < D->maxsection; i++)
+ if (D->sections[i].buf)
+ DASM_M_FREE(Dst, D->sections[i].buf, D->sections[i].bsize);
+ if (D->pclabels) DASM_M_FREE(Dst, D->pclabels, D->pcsize);
+ if (D->lglabels) DASM_M_FREE(Dst, D->lglabels, D->lgsize);
+ DASM_M_FREE(Dst, D, D->psize);
+}
+
+/* Setup global label array. Must be called before dasm_setup(). */
+void dasm_setupglobal(Dst_DECL, void **gl, unsigned int maxgl)
+{
+ dasm_State *D = Dst_REF;
+ D->globals = gl - 10; /* Negative bias to compensate for locals. */
+ DASM_M_GROW(Dst, int, D->lglabels, D->lgsize, (10+maxgl)*sizeof(int));
+}
+
+/* Grow PC label array. Can be called after dasm_setup(), too. */
+void dasm_growpc(Dst_DECL, unsigned int maxpc)
+{
+ dasm_State *D = Dst_REF;
+ size_t osz = D->pcsize;
+ DASM_M_GROW(Dst, int, D->pclabels, D->pcsize, maxpc*sizeof(int));
+ memset((void *)(((unsigned char *)D->pclabels)+osz), 0, D->pcsize-osz);
+}
+
+/* Setup encoder. */
+void dasm_setup(Dst_DECL, const void *actionlist)
+{
+ dasm_State *D = Dst_REF;
+ int i;
+ D->actionlist = (dasm_ActList)actionlist;
+ D->status = DASM_S_OK;
+ D->section = &D->sections[0];
+ memset((void *)D->lglabels, 0, D->lgsize);
+ if (D->pclabels) memset((void *)D->pclabels, 0, D->pcsize);
+ for (i = 0; i < D->maxsection; i++) {
+ D->sections[i].pos = DASM_SEC2POS(i);
+ D->sections[i].ofs = 0;
+ }
+}
+
+
+#ifdef DASM_CHECKS
+#define CK(x, st) \
+ do { if (!(x)) { \
+ D->status = DASM_S_##st|(p-D->actionlist-1); return; } } while (0)
+#define CKPL(kind, st) \
+ do { if ((size_t)((char *)pl-(char *)D->kind##labels) >= D->kind##size) { \
+ D->status = DASM_S_RANGE_##st|(p-D->actionlist-1); return; } } while (0)
+#else
+#define CK(x, st) ((void)0)
+#define CKPL(kind, st) ((void)0)
+#endif
+
+static int dasm_imm12(unsigned int n)
+{
+ int i;
+ for (i = 0; i < 16; i++, n = (n << 2) | (n >> 30))
+ if (n <= 255) return (int)(n + (i << 8));
+ return -1;
+}
+
+/* Pass 1: Store actions and args, link branches/labels, estimate offsets. */
+void dasm_put(Dst_DECL, int start, ...)
+{
+ va_list ap;
+ dasm_State *D = Dst_REF;
+ dasm_ActList p = D->actionlist + start;
+ dasm_Section *sec = D->section;
+ int pos = sec->pos, ofs = sec->ofs;
+ int *b;
+
+ if (pos >= sec->epos) {
+ DASM_M_GROW(Dst, int, sec->buf, sec->bsize,
+ sec->bsize + 2*DASM_MAXSECPOS*sizeof(int));
+ sec->rbuf = sec->buf - DASM_POS2BIAS(pos);
+ sec->epos = (int)sec->bsize/sizeof(int) - DASM_MAXSECPOS+DASM_POS2BIAS(pos);
+ }
+
+ b = sec->rbuf;
+ b[pos++] = start;
+
+ va_start(ap, start);
+ while (1) {
+ unsigned int ins = *p++;
+ unsigned int action = (ins >> 16);
+ if (action >= DASM__MAX) {
+ ofs += 4;
+ } else {
+ int *pl, n = action >= DASM_REL_PC ? va_arg(ap, int) : 0;
+ switch (action) {
+ case DASM_STOP: goto stop;
+ case DASM_SECTION:
+ n = (ins & 255); CK(n < D->maxsection, RANGE_SEC);
+ D->section = &D->sections[n]; goto stop;
+ case DASM_ESC: p++; ofs += 4; break;
+ case DASM_REL_EXT: break;
+ case DASM_ALIGN: ofs += (ins & 255); b[pos++] = ofs; break;
+ case DASM_REL_LG:
+ n = (ins & 2047) - 10; pl = D->lglabels + n;
+ /* Bkwd rel or global. */
+ if (n >= 0) { CK(n>=10||*pl<0, RANGE_LG); CKPL(lg, LG); goto putrel; }
+ pl += 10; n = *pl;
+ if (n < 0) n = 0; /* Start new chain for fwd rel if label exists. */
+ goto linkrel;
+ case DASM_REL_PC:
+ pl = D->pclabels + n; CKPL(pc, PC);
+ putrel:
+ n = *pl;
+ if (n < 0) { /* Label exists. Get label pos and store it. */
+ b[pos] = -n;
+ } else {
+ linkrel:
+ b[pos] = n; /* Else link to rel chain, anchored at label. */
+ *pl = pos;
+ }
+ pos++;
+ break;
+ case DASM_LABEL_LG:
+ pl = D->lglabels + (ins & 2047) - 10; CKPL(lg, LG); goto putlabel;
+ case DASM_LABEL_PC:
+ pl = D->pclabels + n; CKPL(pc, PC);
+ putlabel:
+ n = *pl; /* n > 0: Collapse rel chain and replace with label pos. */
+ while (n > 0) { int *pb = DASM_POS2PTR(D, n); n = *pb; *pb = pos;
+ }
+ *pl = -pos; /* Label exists now. */
+ b[pos++] = ofs; /* Store pass1 offset estimate. */
+ break;
+ case DASM_IMM:
+ case DASM_IMM16:
+#ifdef DASM_CHECKS
+ CK((n & ((1<<((ins>>10)&31))-1)) == 0, RANGE_I);
+ if ((ins & 0x8000))
+ CK(((n + (1<<(((ins>>5)&31)-1)))>>((ins>>5)&31)) == 0, RANGE_I);
+ else
+ CK((n>>((ins>>5)&31)) == 0, RANGE_I);
+#endif
+ b[pos++] = n;
+ break;
+ case DASM_IMMV8:
+ CK((n & 3) == 0, RANGE_I);
+ n >>= 2;
+ case DASM_IMML8:
+ case DASM_IMML12:
+ CK(n >= 0 ? ((n>>((ins>>5)&31)) == 0) :
+ (((-n)>>((ins>>5)&31)) == 0), RANGE_I);
+ b[pos++] = n;
+ break;
+ case DASM_IMM12:
+ CK(dasm_imm12((unsigned int)n) != -1, RANGE_I);
+ b[pos++] = n;
+ break;
+ }
+ }
+ }
+stop:
+ va_end(ap);
+ sec->pos = pos;
+ sec->ofs = ofs;
+}
+#undef CK
+
+/* Pass 2: Link sections, shrink aligns, fix label offsets. */
+int dasm_link(Dst_DECL, size_t *szp)
+{
+ dasm_State *D = Dst_REF;
+ int secnum;
+ int ofs = 0;
+
+#ifdef DASM_CHECKS
+ *szp = 0;
+ if (D->status != DASM_S_OK) return D->status;
+ {
+ int pc;
+ for (pc = 0; pc*sizeof(int) < D->pcsize; pc++)
+ if (D->pclabels[pc] > 0) return DASM_S_UNDEF_PC|pc;
+ }
+#endif
+
+ { /* Handle globals not defined in this translation unit. */
+ int idx;
+ for (idx = 20; idx*sizeof(int) < D->lgsize; idx++) {
+ int n = D->lglabels[idx];
+ /* Undefined label: Collapse rel chain and replace with marker (< 0). */
+ while (n > 0) { int *pb = DASM_POS2PTR(D, n); n = *pb; *pb = -idx; }
+ }
+ }
+
+ /* Combine all code sections. No support for data sections (yet). */
+ for (secnum = 0; secnum < D->maxsection; secnum++) {
+ dasm_Section *sec = D->sections + secnum;
+ int *b = sec->rbuf;
+ int pos = DASM_SEC2POS(secnum);
+ int lastpos = sec->pos;
+
+ while (pos != lastpos) {
+ dasm_ActList p = D->actionlist + b[pos++];
+ while (1) {
+ unsigned int ins = *p++;
+ unsigned int action = (ins >> 16);
+ switch (action) {
+ case DASM_STOP: case DASM_SECTION: goto stop;
+ case DASM_ESC: p++; break;
+ case DASM_REL_EXT: break;
+ case DASM_ALIGN: ofs -= (b[pos++] + ofs) & (ins & 255); break;
+ case DASM_REL_LG: case DASM_REL_PC: pos++; break;
+ case DASM_LABEL_LG: case DASM_LABEL_PC: b[pos++] += ofs; break;
+ case DASM_IMM: case DASM_IMM12: case DASM_IMM16:
+ case DASM_IMML8: case DASM_IMML12: case DASM_IMMV8: pos++; break;
+ }
+ }
+ stop: (void)0;
+ }
+ ofs += sec->ofs; /* Next section starts right after current section. */
+ }
+
+ D->codesize = ofs; /* Total size of all code sections */
+ *szp = ofs;
+ return DASM_S_OK;
+}
+
+#ifdef DASM_CHECKS
+#define CK(x, st) \
+ do { if (!(x)) return DASM_S_##st|(p-D->actionlist-1); } while (0)
+#else
+#define CK(x, st) ((void)0)
+#endif
+
+/* Pass 3: Encode sections. */
+int dasm_encode(Dst_DECL, void *buffer)
+{
+ dasm_State *D = Dst_REF;
+ char *base = (char *)buffer;
+ unsigned int *cp = (unsigned int *)buffer;
+ int secnum;
+
+ /* Encode all code sections. No support for data sections (yet). */
+ for (secnum = 0; secnum < D->maxsection; secnum++) {
+ dasm_Section *sec = D->sections + secnum;
+ int *b = sec->buf;
+ int *endb = sec->rbuf + sec->pos;
+
+ while (b != endb) {
+ dasm_ActList p = D->actionlist + *b++;
+ while (1) {
+ unsigned int ins = *p++;
+ unsigned int action = (ins >> 16);
+ int n = (action >= DASM_ALIGN && action < DASM__MAX) ? *b++ : 0;
+ switch (action) {
+ case DASM_STOP: case DASM_SECTION: goto stop;
+ case DASM_ESC: *cp++ = *p++; break;
+ case DASM_REL_EXT:
+ n = DASM_EXTERN(Dst, (unsigned char *)cp, (ins&2047), !(ins&2048));
+ goto patchrel;
+ case DASM_ALIGN:
+ ins &= 255; while ((((char *)cp - base) & ins)) *cp++ = 0xe1a00000;
+ break;
+ case DASM_REL_LG:
+ CK(n >= 0, UNDEF_LG);
+ case DASM_REL_PC:
+ CK(n >= 0, UNDEF_PC);
+ n = *DASM_POS2PTR(D, n) - (int)((char *)cp - base) - 4;
+ patchrel:
+ if ((ins & 0x800) == 0) {
+ CK((n & 3) == 0 && ((n+0x02000000) >> 26) == 0, RANGE_REL);
+ cp[-1] |= ((n >> 2) & 0x00ffffff);
+ } else if ((ins & 0x1000)) {
+ CK((n & 3) == 0 && -256 <= n && n <= 256, RANGE_REL);
+ goto patchimml8;
+ } else if ((ins & 0x2000) == 0) {
+ CK((n & 3) == 0 && -4096 <= n && n <= 4096, RANGE_REL);
+ goto patchimml;
+ } else {
+ CK((n & 3) == 0 && -1020 <= n && n <= 1020, RANGE_REL);
+ n >>= 2;
+ goto patchimml;
+ }
+ break;
+ case DASM_LABEL_LG:
+ ins &= 2047; if (ins >= 20) D->globals[ins-10] = (void *)(base + n);
+ break;
+ case DASM_LABEL_PC: break;
+ case DASM_IMM:
+ cp[-1] |= ((n>>((ins>>10)&31)) & ((1<<((ins>>5)&31))-1)) << (ins&31);
+ break;
+ case DASM_IMM12:
+ cp[-1] |= dasm_imm12((unsigned int)n);
+ break;
+ case DASM_IMM16:
+ cp[-1] |= ((n & 0xf000) << 4) | (n & 0x0fff);
+ break;
+ case DASM_IMML8: patchimml8:
+ cp[-1] |= n >= 0 ? (0x00800000 | (n & 0x0f) | ((n & 0xf0) << 4)) :
+ ((-n & 0x0f) | ((-n & 0xf0) << 4));
+ break;
+ case DASM_IMML12: case DASM_IMMV8: patchimml:
+ cp[-1] |= n >= 0 ? (0x00800000 | n) : (-n);
+ break;
+ default: *cp++ = ins; break;
+ }
+ }
+ stop: (void)0;
+ }
+ }
+
+ if (base + D->codesize != (char *)cp) /* Check for phase errors. */
+ return DASM_S_PHASE;
+ return DASM_S_OK;
+}
+#undef CK
+
+/* Get PC label offset. */
+int dasm_getpclabel(Dst_DECL, unsigned int pc)
+{
+ dasm_State *D = Dst_REF;
+ if (pc*sizeof(int) < D->pcsize) {
+ int pos = D->pclabels[pc];
+ if (pos < 0) return *DASM_POS2PTR(D, -pos);
+ if (pos > 0) return -1; /* Undefined. */
+ }
+ return -2; /* Unused or out of range. */
+}
+
+#ifdef DASM_CHECKS
+/* Optional sanity checker to call between isolated encoding steps. */
+int dasm_checkstep(Dst_DECL, int secmatch)
+{
+ dasm_State *D = Dst_REF;
+ if (D->status == DASM_S_OK) {
+ int i;
+ for (i = 1; i <= 9; i++) {
+ if (D->lglabels[i] > 0) { D->status = DASM_S_UNDEF_LG|i; break; }
+ D->lglabels[i] = 0;
+ }
+ }
+ if (D->status == DASM_S_OK && secmatch >= 0 &&
+ D->section != &D->sections[secmatch])
+ D->status = DASM_S_MATCH_SEC|(D->section-D->sections);
+ return D->status;
+}
+#endif
+
diff --git a/ext/opcache/jit/dynasm/dasm_arm.lua b/ext/opcache/jit/dynasm/dasm_arm.lua
new file mode 100644
index 0000000000..e2ed922a3c
--- /dev/null
+++ b/ext/opcache/jit/dynasm/dasm_arm.lua
@@ -0,0 +1,1125 @@
+------------------------------------------------------------------------------
+-- DynASM ARM module.
+--
+-- Copyright (C) 2005-2016 Mike Pall. All rights reserved.
+-- See dynasm.lua for full copyright notice.
+------------------------------------------------------------------------------
+
+-- Module information:
+local _info = {
+ arch = "arm",
+ description = "DynASM ARM module",
+ version = "1.4.0",
+ vernum = 10400,
+ release = "2015-10-18",
+ author = "Mike Pall",
+ license = "MIT",
+}
+
+-- Exported glue functions for the arch-specific module.
+local _M = { _info = _info }
+
+-- Cache library functions.
+local type, tonumber, pairs, ipairs = type, tonumber, pairs, ipairs
+local assert, setmetatable, rawget = assert, setmetatable, rawget
+local _s = string
+local sub, format, byte, char = _s.sub, _s.format, _s.byte, _s.char
+local match, gmatch, gsub = _s.match, _s.gmatch, _s.gsub
+local concat, sort, insert = table.concat, table.sort, table.insert
+local bit = bit or require("bit")
+local band, shl, shr, sar = bit.band, bit.lshift, bit.rshift, bit.arshift
+local ror, tohex = bit.ror, bit.tohex
+
+-- Inherited tables and callbacks.
+local g_opt, g_arch
+local wline, werror, wfatal, wwarn
+
+-- Action name list.
+-- CHECK: Keep this in sync with the C code!
+local action_names = {
+ "STOP", "SECTION", "ESC", "REL_EXT",
+ "ALIGN", "REL_LG", "LABEL_LG",
+ "REL_PC", "LABEL_PC", "IMM", "IMM12", "IMM16", "IMML8", "IMML12", "IMMV8",
+}
+
+-- Maximum number of section buffer positions for dasm_put().
+-- CHECK: Keep this in sync with the C code!
+local maxsecpos = 25 -- Keep this low, to avoid excessively long C lines.
+
+-- Action name -> action number.
+local map_action = {}
+for n,name in ipairs(action_names) do
+ map_action[name] = n-1
+end
+
+-- Action list buffer.
+local actlist = {}
+
+-- Argument list for next dasm_put(). Start with offset 0 into action list.
+local actargs = { 0 }
+
+-- Current number of section buffer positions for dasm_put().
+local secpos = 1
+
+------------------------------------------------------------------------------
+
+-- Dump action names and numbers.
+local function dumpactions(out)
+ out:write("DynASM encoding engine action codes:\n")
+ for n,name in ipairs(action_names) do
+ local num = map_action[name]
+ out:write(format(" %-10s %02X %d\n", name, num, num))
+ end
+ out:write("\n")
+end
+
+-- Write action list buffer as a huge static C array.
+local function writeactions(out, name)
+ local nn = #actlist
+ if nn == 0 then nn = 1; actlist[0] = map_action.STOP end
+ out:write("static const unsigned int ", name, "[", nn, "] = {\n")
+ for i = 1,nn-1 do
+ assert(out:write("0x", tohex(actlist[i]), ",\n"))
+ end
+ assert(out:write("0x", tohex(actlist[nn]), "\n};\n\n"))
+end
+
+------------------------------------------------------------------------------
+
+-- Add word to action list.
+local function wputxw(n)
+ assert(n >= 0 and n <= 0xffffffff and n % 1 == 0, "word out of range")
+ actlist[#actlist+1] = n
+end
+
+-- Add action to list with optional arg. Advance buffer pos, too.
+local function waction(action, val, a, num)
+ local w = assert(map_action[action], "bad action name `"..action.."'")
+ wputxw(w * 0x10000 + (val or 0))
+ if a then actargs[#actargs+1] = a end
+ if a or num then secpos = secpos + (num or 1) end
+end
+
+-- Flush action list (intervening C code or buffer pos overflow).
+local function wflush(term)
+ if #actlist == actargs[1] then return end -- Nothing to flush.
+ if not term then waction("STOP") end -- Terminate action list.
+ wline(format("dasm_put(Dst, %s);", concat(actargs, ", ")), true)
+ actargs = { #actlist } -- Actionlist offset is 1st arg to next dasm_put().
+ secpos = 1 -- The actionlist offset occupies a buffer position, too.
+end
+
+-- Put escaped word.
+local function wputw(n)
+ if n <= 0x000fffff then waction("ESC") end
+ wputxw(n)
+end
+
+-- Reserve position for word.
+local function wpos()
+ local pos = #actlist+1
+ actlist[pos] = ""
+ return pos
+end
+
+-- Store word to reserved position.
+local function wputpos(pos, n)
+ assert(n >= 0 and n <= 0xffffffff and n % 1 == 0, "word out of range")
+ if n <= 0x000fffff then
+ insert(actlist, pos+1, n)
+ n = map_action.ESC * 0x10000
+ end
+ actlist[pos] = n
+end
+
+------------------------------------------------------------------------------
+
+-- Global label name -> global label number. With auto assignment on 1st use.
+local next_global = 20
+local map_global = setmetatable({}, { __index = function(t, name)
+ if not match(name, "^[%a_][%w_]*$") then werror("bad global label") end
+ local n = next_global
+ if n > 2047 then werror("too many global labels") end
+ next_global = n + 1
+ t[name] = n
+ return n
+end})
+
+-- Dump global labels.
+local function dumpglobals(out, lvl)
+ local t = {}
+ for name, n in pairs(map_global) do t[n] = name end
+ out:write("Global labels:\n")
+ for i=20,next_global-1 do
+ out:write(format(" %s\n", t[i]))
+ end
+ out:write("\n")
+end
+
+-- Write global label enum.
+local function writeglobals(out, prefix)
+ local t = {}
+ for name, n in pairs(map_global) do t[n] = name end
+ out:write("enum {\n")
+ for i=20,next_global-1 do
+ out:write(" ", prefix, t[i], ",\n")
+ end
+ out:write(" ", prefix, "_MAX\n};\n")
+end
+
+-- Write global label names.
+local function writeglobalnames(out, name)
+ local t = {}
+ for name, n in pairs(map_global) do t[n] = name end
+ out:write("static const char *const ", name, "[] = {\n")
+ for i=20,next_global-1 do
+ out:write(" \"", t[i], "\",\n")
+ end
+ out:write(" (const char *)0\n};\n")
+end
+
+------------------------------------------------------------------------------
+
+-- Extern label name -> extern label number. With auto assignment on 1st use.
+local next_extern = 0
+local map_extern_ = {}
+local map_extern = setmetatable({}, { __index = function(t, name)
+ -- No restrictions on the name for now.
+ local n = next_extern
+ if n > 2047 then werror("too many extern labels") end
+ next_extern = n + 1
+ t[name] = n
+ map_extern_[n] = name
+ return n
+end})
+
+-- Dump extern labels.
+local function dumpexterns(out, lvl)
+ out:write("Extern labels:\n")
+ for i=0,next_extern-1 do
+ out:write(format(" %s\n", map_extern_[i]))
+ end
+ out:write("\n")
+end
+
+-- Write extern label names.
+local function writeexternnames(out, name)
+ out:write("static const char *const ", name, "[] = {\n")
+ for i=0,next_extern-1 do
+ out:write(" \"", map_extern_[i], "\",\n")
+ end
+ out:write(" (const char *)0\n};\n")
+end
+
+------------------------------------------------------------------------------
+
+-- Arch-specific maps.
+
+-- Ext. register name -> int. name.
+local map_archdef = { sp = "r13", lr = "r14", pc = "r15", }
+
+-- Int. register name -> ext. name.
+local map_reg_rev = { r13 = "sp", r14 = "lr", r15 = "pc", }
+
+local map_type = {} -- Type name -> { ctype, reg }
+local ctypenum = 0 -- Type number (for Dt... macros).
+
+-- Reverse defines for registers.
+function _M.revdef(s)
+ return map_reg_rev[s] or s
+end
+
+local map_shift = { lsl = 0, lsr = 1, asr = 2, ror = 3, }
+
+local map_cond = {
+ eq = 0, ne = 1, cs = 2, cc = 3, mi = 4, pl = 5, vs = 6, vc = 7,
+ hi = 8, ls = 9, ge = 10, lt = 11, gt = 12, le = 13, al = 14,
+ hs = 2, lo = 3,
+}
+
+------------------------------------------------------------------------------
+
+-- Template strings for ARM instructions.
+local map_op = {
+ -- Basic data processing instructions.
+ and_3 = "e0000000DNPs",
+ eor_3 = "e0200000DNPs",
+ sub_3 = "e0400000DNPs",
+ rsb_3 = "e0600000DNPs",
+ add_3 = "e0800000DNPs",
+ adc_3 = "e0a00000DNPs",
+ sbc_3 = "e0c00000DNPs",
+ rsc_3 = "e0e00000DNPs",
+ tst_2 = "e1100000NP",
+ teq_2 = "e1300000NP",
+ cmp_2 = "e1500000NP",
+ cmn_2 = "e1700000NP",
+ orr_3 = "e1800000DNPs",
+ mov_2 = "e1a00000DPs",
+ bic_3 = "e1c00000DNPs",
+ mvn_2 = "e1e00000DPs",
+
+ and_4 = "e0000000DNMps",
+ eor_4 = "e0200000DNMps",
+ sub_4 = "e0400000DNMps",
+ rsb_4 = "e0600000DNMps",
+ add_4 = "e0800000DNMps",
+ adc_4 = "e0a00000DNMps",
+ sbc_4 = "e0c00000DNMps",
+ rsc_4 = "e0e00000DNMps",
+ tst_3 = "e1100000NMp",
+ teq_3 = "e1300000NMp",
+ cmp_3 = "e1500000NMp",
+ cmn_3 = "e1700000NMp",
+ orr_4 = "e1800000DNMps",
+ mov_3 = "e1a00000DMps",
+ bic_4 = "e1c00000DNMps",
+ mvn_3 = "e1e00000DMps",
+
+ lsl_3 = "e1a00000DMws",
+ lsr_3 = "e1a00020DMws",
+ asr_3 = "e1a00040DMws",
+ ror_3 = "e1a00060DMws",
+ rrx_2 = "e1a00060DMs",
+
+ -- Multiply and multiply-accumulate.
+ mul_3 = "e0000090NMSs",
+ mla_4 = "e0200090NMSDs",
+ umaal_4 = "e0400090DNMSs", -- v6
+ mls_4 = "e0600090DNMSs", -- v6T2
+ umull_4 = "e0800090DNMSs",
+ umlal_4 = "e0a00090DNMSs",
+ smull_4 = "e0c00090DNMSs",
+ smlal_4 = "e0e00090DNMSs",
+
+ -- Halfword multiply and multiply-accumulate.
+ smlabb_4 = "e1000080NMSD", -- v5TE
+ smlatb_4 = "e10000a0NMSD", -- v5TE
+ smlabt_4 = "e10000c0NMSD", -- v5TE
+ smlatt_4 = "e10000e0NMSD", -- v5TE
+ smlawb_4 = "e1200080NMSD", -- v5TE
+ smulwb_3 = "e12000a0NMS", -- v5TE
+ smlawt_4 = "e12000c0NMSD", -- v5TE
+ smulwt_3 = "e12000e0NMS", -- v5TE
+ smlalbb_4 = "e1400080NMSD", -- v5TE
+ smlaltb_4 = "e14000a0NMSD", -- v5TE
+ smlalbt_4 = "e14000c0NMSD", -- v5TE
+ smlaltt_4 = "e14000e0NMSD", -- v5TE
+ smulbb_3 = "e1600080NMS", -- v5TE
+ smultb_3 = "e16000a0NMS", -- v5TE
+ smulbt_3 = "e16000c0NMS", -- v5TE
+ smultt_3 = "e16000e0NMS", -- v5TE
+
+ -- Miscellaneous data processing instructions.
+ clz_2 = "e16f0f10DM", -- v5T
+ rev_2 = "e6bf0f30DM", -- v6
+ rev16_2 = "e6bf0fb0DM", -- v6
+ revsh_2 = "e6ff0fb0DM", -- v6
+ sel_3 = "e6800fb0DNM", -- v6
+ usad8_3 = "e780f010NMS", -- v6
+ usada8_4 = "e7800010NMSD", -- v6
+ rbit_2 = "e6ff0f30DM", -- v6T2
+ movw_2 = "e3000000DW", -- v6T2
+ movt_2 = "e3400000DW", -- v6T2
+ -- Note: the X encodes width-1, not width.
+ sbfx_4 = "e7a00050DMvX", -- v6T2
+ ubfx_4 = "e7e00050DMvX", -- v6T2
+ -- Note: the X encodes the msb field, not the width.
+ bfc_3 = "e7c0001fDvX", -- v6T2
+ bfi_4 = "e7c00010DMvX", -- v6T2
+
+ -- Packing and unpacking instructions.
+ pkhbt_3 = "e6800010DNM", pkhbt_4 = "e6800010DNMv", -- v6
+ pkhtb_3 = "e6800050DNM", pkhtb_4 = "e6800050DNMv", -- v6
+ sxtab_3 = "e6a00070DNM", sxtab_4 = "e6a00070DNMv", -- v6
+ sxtab16_3 = "e6800070DNM", sxtab16_4 = "e6800070DNMv", -- v6
+ sxtah_3 = "e6b00070DNM", sxtah_4 = "e6b00070DNMv", -- v6
+ sxtb_2 = "e6af0070DM", sxtb_3 = "e6af0070DMv", -- v6
+ sxtb16_2 = "e68f0070DM", sxtb16_3 = "e68f0070DMv", -- v6
+ sxth_2 = "e6bf0070DM", sxth_3 = "e6bf0070DMv", -- v6
+ uxtab_3 = "e6e00070DNM", uxtab_4 = "e6e00070DNMv", -- v6
+ uxtab16_3 = "e6c00070DNM", uxtab16_4 = "e6c00070DNMv", -- v6
+ uxtah_3 = "e6f00070DNM", uxtah_4 = "e6f00070DNMv", -- v6
+ uxtb_2 = "e6ef0070DM", uxtb_3 = "e6ef0070DMv", -- v6
+ uxtb16_2 = "e6cf0070DM", uxtb16_3 = "e6cf0070DMv", -- v6
+ uxth_2 = "e6ff0070DM", uxth_3 = "e6ff0070DMv", -- v6
+
+ -- Saturating instructions.
+ qadd_3 = "e1000050DMN", -- v5TE
+ qsub_3 = "e1200050DMN", -- v5TE
+ qdadd_3 = "e1400050DMN", -- v5TE
+ qdsub_3 = "e1600050DMN", -- v5TE
+ -- Note: the X for ssat* encodes sat_imm-1, not sat_imm.
+ ssat_3 = "e6a00010DXM", ssat_4 = "e6a00010DXMp", -- v6
+ usat_3 = "e6e00010DXM", usat_4 = "e6e00010DXMp", -- v6
+ ssat16_3 = "e6a00f30DXM", -- v6
+ usat16_3 = "e6e00f30DXM", -- v6
+
+ -- Parallel addition and subtraction.
+ sadd16_3 = "e6100f10DNM", -- v6
+ sasx_3 = "e6100f30DNM", -- v6
+ ssax_3 = "e6100f50DNM", -- v6
+ ssub16_3 = "e6100f70DNM", -- v6
+ sadd8_3 = "e6100f90DNM", -- v6
+ ssub8_3 = "e6100ff0DNM", -- v6
+ qadd16_3 = "e6200f10DNM", -- v6
+ qasx_3 = "e6200f30DNM", -- v6
+ qsax_3 = "e6200f50DNM", -- v6
+ qsub16_3 = "e6200f70DNM", -- v6
+ qadd8_3 = "e6200f90DNM", -- v6
+ qsub8_3 = "e6200ff0DNM", -- v6
+ shadd16_3 = "e6300f10DNM", -- v6
+ shasx_3 = "e6300f30DNM", -- v6
+ shsax_3 = "e6300f50DNM", -- v6
+ shsub16_3 = "e6300f70DNM", -- v6
+ shadd8_3 = "e6300f90DNM", -- v6
+ shsub8_3 = "e6300ff0DNM", -- v6
+ uadd16_3 = "e6500f10DNM", -- v6
+ uasx_3 = "e6500f30DNM", -- v6
+ usax_3 = "e6500f50DNM", -- v6
+ usub16_3 = "e6500f70DNM", -- v6
+ uadd8_3 = "e6500f90DNM", -- v6
+ usub8_3 = "e6500ff0DNM", -- v6
+ uqadd16_3 = "e6600f10DNM", -- v6
+ uqasx_3 = "e6600f30DNM", -- v6
+ uqsax_3 = "e6600f50DNM", -- v6
+ uqsub16_3 = "e6600f70DNM", -- v6
+ uqadd8_3 = "e6600f90DNM", -- v6
+ uqsub8_3 = "e6600ff0DNM", -- v6
+ uhadd16_3 = "e6700f10DNM", -- v6
+ uhasx_3 = "e6700f30DNM", -- v6
+ uhsax_3 = "e6700f50DNM", -- v6
+ uhsub16_3 = "e6700f70DNM", -- v6
+ uhadd8_3 = "e6700f90DNM", -- v6
+ uhsub8_3 = "e6700ff0DNM", -- v6
+
+ -- Load/store instructions.
+ str_2 = "e4000000DL", str_3 = "e4000000DL", str_4 = "e4000000DL",
+ strb_2 = "e4400000DL", strb_3 = "e4400000DL", strb_4 = "e4400000DL",
+ ldr_2 = "e4100000DL", ldr_3 = "e4100000DL", ldr_4 = "e4100000DL",
+ ldrb_2 = "e4500000DL", ldrb_3 = "e4500000DL", ldrb_4 = "e4500000DL",
+ strh_2 = "e00000b0DL", strh_3 = "e00000b0DL",
+ ldrh_2 = "e01000b0DL", ldrh_3 = "e01000b0DL",
+ ldrd_2 = "e00000d0DL", ldrd_3 = "e00000d0DL", -- v5TE
+ ldrsb_2 = "e01000d0DL", ldrsb_3 = "e01000d0DL",
+ strd_2 = "e00000f0DL", strd_3 = "e00000f0DL", -- v5TE
+ ldrsh_2 = "e01000f0DL", ldrsh_3 = "e01000f0DL",
+
+ ldm_2 = "e8900000oR", ldmia_2 = "e8900000oR", ldmfd_2 = "e8900000oR",
+ ldmda_2 = "e8100000oR", ldmfa_2 = "e8100000oR",
+ ldmdb_2 = "e9100000oR", ldmea_2 = "e9100000oR",
+ ldmib_2 = "e9900000oR", ldmed_2 = "e9900000oR",
+ stm_2 = "e8800000oR", stmia_2 = "e8800000oR", stmfd_2 = "e8800000oR",
+ stmda_2 = "e8000000oR", stmfa_2 = "e8000000oR",
+ stmdb_2 = "e9000000oR", stmea_2 = "e9000000oR",
+ stmib_2 = "e9800000oR", stmed_2 = "e9800000oR",
+ pop_1 = "e8bd0000R", push_1 = "e92d0000R",
+
+ -- Branch instructions.
+ b_1 = "ea000000B",
+ bl_1 = "eb000000B",
+ blx_1 = "e12fff30C",
+ bx_1 = "e12fff10M",
+
+ -- Miscellaneous instructions.
+ nop_0 = "e1a00000",
+ mrs_1 = "e10f0000D",
+ bkpt_1 = "e1200070K", -- v5T
+ svc_1 = "ef000000T", swi_1 = "ef000000T",
+ ud_0 = "e7f001f0",
+
+ -- VFP instructions.
+ ["vadd.f32_3"] = "ee300a00dnm",
+ ["vadd.f64_3"] = "ee300b00Gdnm",
+ ["vsub.f32_3"] = "ee300a40dnm",
+ ["vsub.f64_3"] = "ee300b40Gdnm",
+ ["vmul.f32_3"] = "ee200a00dnm",
+ ["vmul.f64_3"] = "ee200b00Gdnm",
+ ["vnmul.f32_3"] = "ee200a40dnm",
+ ["vnmul.f64_3"] = "ee200b40Gdnm",
+ ["vmla.f32_3"] = "ee000a00dnm",
+ ["vmla.f64_3"] = "ee000b00Gdnm",
+ ["vmls.f32_3"] = "ee000a40dnm",
+ ["vmls.f64_3"] = "ee000b40Gdnm",
+ ["vnmla.f32_3"] = "ee100a40dnm",
+ ["vnmla.f64_3"] = "ee100b40Gdnm",
+ ["vnmls.f32_3"] = "ee100a00dnm",
+ ["vnmls.f64_3"] = "ee100b00Gdnm",
+ ["vdiv.f32_3"] = "ee800a00dnm",
+ ["vdiv.f64_3"] = "ee800b00Gdnm",
+
+ ["vabs.f32_2"] = "eeb00ac0dm",
+ ["vabs.f64_2"] = "eeb00bc0Gdm",
+ ["vneg.f32_2"] = "eeb10a40dm",
+ ["vneg.f64_2"] = "eeb10b40Gdm",
+ ["vsqrt.f32_2"] = "eeb10ac0dm",
+ ["vsqrt.f64_2"] = "eeb10bc0Gdm",
+ ["vcmp.f32_2"] = "eeb40a40dm",
+ ["vcmp.f64_2"] = "eeb40b40Gdm",
+ ["vcmpe.f32_2"] = "eeb40ac0dm",
+ ["vcmpe.f64_2"] = "eeb40bc0Gdm",
+ ["vcmpz.f32_1"] = "eeb50a40d",
+ ["vcmpz.f64_1"] = "eeb50b40Gd",
+ ["vcmpze.f32_1"] = "eeb50ac0d",
+ ["vcmpze.f64_1"] = "eeb50bc0Gd",
+
+ vldr_2 = "ed100a00dl|ed100b00Gdl",
+ vstr_2 = "ed000a00dl|ed000b00Gdl",
+ vldm_2 = "ec900a00or",
+ vldmia_2 = "ec900a00or",
+ vldmdb_2 = "ed100a00or",
+ vpop_1 = "ecbd0a00r",
+ vstm_2 = "ec800a00or",
+ vstmia_2 = "ec800a00or",
+ vstmdb_2 = "ed000a00or",
+ vpush_1 = "ed2d0a00r",
+
+ ["vmov.f32_2"] = "eeb00a40dm|eeb00a00dY", -- #imm is VFPv3 only
+ ["vmov.f64_2"] = "eeb00b40Gdm|eeb00b00GdY", -- #imm is VFPv3 only
+ vmov_2 = "ee100a10Dn|ee000a10nD",
+ vmov_3 = "ec500a10DNm|ec400a10mDN|ec500b10GDNm|ec400b10GmDN",
+
+ vmrs_0 = "eef1fa10",
+ vmrs_1 = "eef10a10D",
+ vmsr_1 = "eee10a10D",
+
+ ["vcvt.s32.f32_2"] = "eebd0ac0dm",
+ ["vcvt.s32.f64_2"] = "eebd0bc0dGm",
+ ["vcvt.u32.f32_2"] = "eebc0ac0dm",
+ ["vcvt.u32.f64_2"] = "eebc0bc0dGm",
+ ["vcvtr.s32.f32_2"] = "eebd0a40dm",
+ ["vcvtr.s32.f64_2"] = "eebd0b40dGm",
+ ["vcvtr.u32.f32_2"] = "eebc0a40dm",
+ ["vcvtr.u32.f64_2"] = "eebc0b40dGm",
+ ["vcvt.f32.s32_2"] = "eeb80ac0dm",
+ ["vcvt.f64.s32_2"] = "eeb80bc0GdFm",
+ ["vcvt.f32.u32_2"] = "eeb80a40dm",
+ ["vcvt.f64.u32_2"] = "eeb80b40GdFm",
+ ["vcvt.f32.f64_2"] = "eeb70bc0dGm",
+ ["vcvt.f64.f32_2"] = "eeb70ac0GdFm",
+
+ -- VFPv4 only:
+ ["vfma.f32_3"] = "eea00a00dnm",
+ ["vfma.f64_3"] = "eea00b00Gdnm",
+ ["vfms.f32_3"] = "eea00a40dnm",
+ ["vfms.f64_3"] = "eea00b40Gdnm",
+ ["vfnma.f32_3"] = "ee900a40dnm",
+ ["vfnma.f64_3"] = "ee900b40Gdnm",
+ ["vfnms.f32_3"] = "ee900a00dnm",
+ ["vfnms.f64_3"] = "ee900b00Gdnm",
+
+ -- NYI: Advanced SIMD instructions.
+
+ -- NYI: I have no need for these instructions right now:
+ -- swp, swpb, strex, ldrex, strexd, ldrexd, strexb, ldrexb, strexh, ldrexh
+ -- msr, nopv6, yield, wfe, wfi, sev, dbg, bxj, smc, srs, rfe
+ -- cps, setend, pli, pld, pldw, clrex, dsb, dmb, isb
+ -- stc, ldc, mcr, mcr2, mrc, mrc2, mcrr, mcrr2, mrrc, mrrc2, cdp, cdp2
+}
+
+-- Add mnemonics for "s" variants.
+do
+ local t = {}
+ for k,v in pairs(map_op) do
+ if sub(v, -1) == "s" then
+ local v2 = sub(v, 1, 2)..char(byte(v, 3)+1)..sub(v, 4, -2)
+ t[sub(k, 1, -3).."s"..sub(k, -2)] = v2
+ end
+ end
+ for k,v in pairs(t) do
+ map_op[k] = v
+ end
+end
+
+------------------------------------------------------------------------------
+
+local function parse_gpr(expr)
+ local tname, ovreg = match(expr, "^([%w_]+):(r1?[0-9])$")
+ local tp = map_type[tname or expr]
+ if tp then
+ local reg = ovreg or tp.reg
+ if not reg then
+ werror("type `"..(tname or expr).."' needs a register override")
+ end
+ expr = reg
+ end
+ local r = match(expr, "^r(1?[0-9])$")
+ if r then
+ r = tonumber(r)
+ if r <= 15 then return r, tp end
+ end
+ werror("bad register name `"..expr.."'")
+end
+
+local function parse_gpr_pm(expr)
+ local pm, expr2 = match(expr, "^([+-]?)(.*)$")
+ return parse_gpr(expr2), (pm == "-")
+end
+
+local function parse_vr(expr, tp)
+ local t, r = match(expr, "^([sd])([0-9]+)$")
+ if t == tp then
+ r = tonumber(r)
+ if r <= 31 then
+ if t == "s" then return shr(r, 1), band(r, 1) end
+ return band(r, 15), shr(r, 4)
+ end
+ end
+ werror("bad register name `"..expr.."'")
+end
+
+local function parse_reglist(reglist)
+ reglist = match(reglist, "^{%s*([^}]*)}$")
+ if not reglist then werror("register list expected") end
+ local rr = 0
+ for p in gmatch(reglist..",", "%s*([^,]*),") do
+ local rbit = shl(1, parse_gpr(gsub(p, "%s+$", "")))
+ if band(rr, rbit) ~= 0 then
+ werror("duplicate register `"..p.."'")
+ end
+ rr = rr + rbit
+ end
+ return rr
+end
+
+local function parse_vrlist(reglist)
+ local ta, ra, tb, rb = match(reglist,
+ "^{%s*([sd])([0-9]+)%s*%-%s*([sd])([0-9]+)%s*}$")
+ ra, rb = tonumber(ra), tonumber(rb)
+ if ta and ta == tb and ra and rb and ra <= 31 and rb <= 31 and ra <= rb then
+ local nr = rb+1 - ra
+ if ta == "s" then
+ return shl(shr(ra,1),12)+shl(band(ra,1),22) + nr
+ else
+ return shl(band(ra,15),12)+shl(shr(ra,4),22) + nr*2 + 0x100
+ end
+ end
+ werror("register list expected")
+end
+
+local function parse_imm(imm, bits, shift, scale, signed)
+ imm = match(imm, "^#(.*)$")
+ if not imm then werror("expected immediate operand") end
+ local n = tonumber(imm)
+ if n then
+ local m = sar(n, scale)
+ if shl(m, scale) == n then
+ if signed then
+ local s = sar(m, bits-1)
+ if s == 0 then return shl(m, shift)
+ elseif s == -1 then return shl(m + shl(1, bits), shift) end
+ else
+ if sar(m, bits) == 0 then return shl(m, shift) end
+ end
+ end
+ werror("out of range immediate `"..imm.."'")
+ else
+ waction("IMM", (signed and 32768 or 0)+scale*1024+bits*32+shift, imm)
+ return 0
+ end
+end
+
+local function parse_imm12(imm)
+ local n = tonumber(imm)
+ if n then
+ local m = band(n)
+ for i=0,-15,-1 do
+ if shr(m, 8) == 0 then return m + shl(band(i, 15), 8) end
+ m = ror(m, 2)
+ end
+ werror("out of range immediate `"..imm.."'")
+ else
+ waction("IMM12", 0, imm)
+ return 0
+ end
+end
+
+local function parse_imm16(imm)
+ imm = match(imm, "^#(.*)$")
+ if not imm then werror("expected immediate operand") end
+ local n = tonumber(imm)
+ if n then
+ if shr(n, 16) == 0 then return band(n, 0x0fff) + shl(band(n, 0xf000), 4) end
+ werror("out of range immediate `"..imm.."'")
+ else
+ waction("IMM16", 32*16, imm)
+ return 0
+ end
+end
+
+local function parse_imm_load(imm, ext)
+ local n = tonumber(imm)
+ if n then
+ if ext then
+ if n >= -255 and n <= 255 then
+ local up = 0x00800000
+ if n < 0 then n = -n; up = 0 end
+ return shl(band(n, 0xf0), 4) + band(n, 0x0f) + up
+ end
+ else
+ if n >= -4095 and n <= 4095 then
+ if n >= 0 then return n+0x00800000 end
+ return -n
+ end
+ end
+ werror("out of range immediate `"..imm.."'")
+ else
+ waction(ext and "IMML8" or "IMML12", 32768 + shl(ext and 8 or 12, 5), imm)
+ return 0
+ end
+end
+
+local function parse_shift(shift, gprok)
+ if shift == "rrx" then
+ return 3 * 32
+ else
+ local s, s2 = match(shift, "^(%S+)%s*(.*)$")
+ s = map_shift[s]
+ if not s then werror("expected shift operand") end
+ if sub(s2, 1, 1) == "#" then
+ return parse_imm(s2, 5, 7, 0, false) + shl(s, 5)
+ else
+ if not gprok then werror("expected immediate shift operand") end
+ return shl(parse_gpr(s2), 8) + shl(s, 5) + 16
+ end
+ end
+end
+
+local function parse_label(label, def)
+ local prefix = sub(label, 1, 2)
+ -- =>label (pc label reference)
+ if prefix == "=>" then
+ return "PC", 0, sub(label, 3)
+ end
+ -- ->name (global label reference)
+ if prefix == "->" then
+ return "LG", map_global[sub(label, 3)]
+ end
+ if def then
+ -- [1-9] (local label definition)
+ if match(label, "^[1-9]$") then
+ return "LG", 10+tonumber(label)
+ end
+ else
+ -- [<>][1-9] (local label reference)
+ local dir, lnum = match(label, "^([<>])([1-9])$")
+ if dir then -- Fwd: 1-9, Bkwd: 11-19.
+ return "LG", lnum + (dir == ">" and 0 or 10)
+ end
+ -- extern label (extern label reference)
+ local extname = match(label, "^extern%s+(%S+)$")
+ if extname then
+ return "EXT", map_extern[extname]
+ end
+ end
+ werror("bad label `"..label.."'")
+end
+
+local function parse_load(params, nparams, n, op)
+ local oplo = band(op, 255)
+ local ext, ldrd = (oplo ~= 0), (oplo == 208)
+ local d
+ if (ldrd or oplo == 240) then
+ d = band(shr(op, 12), 15)
+ if band(d, 1) ~= 0 then werror("odd destination register") end
+ end
+ local pn = params[n]
+ local p1, wb = match(pn, "^%[%s*(.-)%s*%](!?)$")
+ local p2 = params[n+1]
+ if not p1 then
+ if not p2 then
+ if match(pn, "^[<>=%-]") or match(pn, "^extern%s+") then
+ local mode, n, s = parse_label(pn, false)
+ waction("REL_"..mode, n + (ext and 0x1800 or 0x0800), s, 1)
+ return op + 15 * 65536 + 0x01000000 + (ext and 0x00400000 or 0)
+ end
+ local reg, tailr = match(pn, "^([%w_:]+)%s*(.*)$")
+ if reg and tailr ~= "" then
+ local d, tp = parse_gpr(reg)
+ if tp then
+ waction(ext and "IMML8" or "IMML12", 32768 + 32*(ext and 8 or 12),
+ format(tp.ctypefmt, tailr))
+ return op + shl(d, 16) + 0x01000000 + (ext and 0x00400000 or 0)
+ end
+ end
+ end
+ werror("expected address operand")
+ end
+ if wb == "!" then op = op + 0x00200000 end
+ if p2 then
+ if wb == "!" then werror("bad use of '!'") end
+ local p3 = params[n+2]
+ op = op + shl(parse_gpr(p1), 16)
+ local imm = match(p2, "^#(.*)$")
+ if imm then
+ local m = parse_imm_load(imm, ext)
+ if p3 then werror("too many parameters") end
+ op = op + m + (ext and 0x00400000 or 0)
+ else
+ local m, neg = parse_gpr_pm(p2)
+ if ldrd and (m == d or m-1 == d) then werror("register conflict") end
+ op = op + m + (neg and 0 or 0x00800000) + (ext and 0 or 0x02000000)
+ if p3 then op = op + parse_shift(p3) end
+ end
+ else
+ local p1a, p2 = match(p1, "^([^,%s]*)%s*(.*)$")
+ op = op + shl(parse_gpr(p1a), 16) + 0x01000000
+ if p2 ~= "" then
+ local imm = match(p2, "^,%s*#(.*)$")
+ if imm then
+ local m = parse_imm_load(imm, ext)
+ op = op + m + (ext and 0x00400000 or 0)
+ else
+ local p2a, p3 = match(p2, "^,%s*([^,%s]*)%s*,?%s*(.*)$")
+ local m, neg = parse_gpr_pm(p2a)
+ if ldrd and (m == d or m-1 == d) then werror("register conflict") end
+ op = op + m + (neg and 0 or 0x00800000) + (ext and 0 or 0x02000000)
+ if p3 ~= "" then
+ if ext then werror("too many parameters") end
+ op = op + parse_shift(p3)
+ end
+ end
+ else
+ if wb == "!" then werror("bad use of '!'") end
+ op = op + (ext and 0x00c00000 or 0x00800000)
+ end
+ end
+ return op
+end
+
+local function parse_vload(q)
+ local reg, imm = match(q, "^%[%s*([^,%s]*)%s*(.*)%]$")
+ if reg then
+ local d = shl(parse_gpr(reg), 16)
+ if imm == "" then return d end
+ imm = match(imm, "^,%s*#(.*)$")
+ if imm then
+ local n = tonumber(imm)
+ if n then
+ if n >= -1020 and n <= 1020 and n%4 == 0 then
+ return d + (n >= 0 and n/4+0x00800000 or -n/4)
+ end
+ werror("out of range immediate `"..imm.."'")
+ else
+ waction("IMMV8", 32768 + 32*8, imm)
+ return d
+ end
+ end
+ else
+ if match(q, "^[<>=%-]") or match(q, "^extern%s+") then
+ local mode, n, s = parse_label(q, false)
+ waction("REL_"..mode, n + 0x2800, s, 1)
+ return 15 * 65536
+ end
+ local reg, tailr = match(q, "^([%w_:]+)%s*(.*)$")
+ if reg and tailr ~= "" then
+ local d, tp = parse_gpr(reg)
+ if tp then
+ waction("IMMV8", 32768 + 32*8, format(tp.ctypefmt, tailr))
+ return shl(d, 16)
+ end
+ end
+ end
+ werror("expected address operand")
+end
+
+------------------------------------------------------------------------------
+
+-- Handle opcodes defined with template strings.
+local function parse_template(params, template, nparams, pos)
+ local op = tonumber(sub(template, 1, 8), 16)
+ local n = 1
+ local vr = "s"
+
+ -- Process each character.
+ for p in gmatch(sub(template, 9), ".") do
+ local q = params[n]
+ if p == "D" then
+ op = op + shl(parse_gpr(q), 12); n = n + 1
+ elseif p == "N" then
+ op = op + shl(parse_gpr(q), 16); n = n + 1
+ elseif p == "S" then
+ op = op + shl(parse_gpr(q), 8); n = n + 1
+ elseif p == "M" then
+ op = op + parse_gpr(q); n = n + 1
+ elseif p == "d" then
+ local r,h = parse_vr(q, vr); op = op+shl(r,12)+shl(h,22); n = n + 1
+ elseif p == "n" then
+ local r,h = parse_vr(q, vr); op = op+shl(r,16)+shl(h,7); n = n + 1
+ elseif p == "m" then
+ local r,h = parse_vr(q, vr); op = op+r+shl(h,5); n = n + 1
+ elseif p == "P" then
+ local imm = match(q, "^#(.*)$")
+ if imm then
+ op = op + parse_imm12(imm) + 0x02000000
+ else
+ op = op + parse_gpr(q)
+ end
+ n = n + 1
+ elseif p == "p" then
+ op = op + parse_shift(q, true); n = n + 1
+ elseif p == "L" then
+ op = parse_load(params, nparams, n, op)
+ elseif p == "l" then
+ op = op + parse_vload(q)
+ elseif p == "B" then
+ local mode, n, s = parse_label(q, false)
+ waction("REL_"..mode, n, s, 1)
+ elseif p == "C" then -- blx gpr vs. blx label.
+ if match(q, "^([%w_]+):(r1?[0-9])$") or match(q, "^r(1?[0-9])$") then
+ op = op + parse_gpr(q)
+ else
+ if op < 0xe0000000 then werror("unconditional instruction") end
+ local mode, n, s = parse_label(q, false)
+ waction("REL_"..mode, n, s, 1)
+ op = 0xfa000000
+ end
+ elseif p == "F" then
+ vr = "s"
+ elseif p == "G" then
+ vr = "d"
+ elseif p == "o" then
+ local r, wb = match(q, "^([^!]*)(!?)$")
+ op = op + shl(parse_gpr(r), 16) + (wb == "!" and 0x00200000 or 0)
+ n = n + 1
+ elseif p == "R" then
+ op = op + parse_reglist(q); n = n + 1
+ elseif p == "r" then
+ op = op + parse_vrlist(q); n = n + 1
+ elseif p == "W" then
+ op = op + parse_imm16(q); n = n + 1
+ elseif p == "v" then
+ op = op + parse_imm(q, 5, 7, 0, false); n = n + 1
+ elseif p == "w" then
+ local imm = match(q, "^#(.*)$")
+ if imm then
+ op = op + parse_imm(q, 5, 7, 0, false); n = n + 1
+ else
+ op = op + shl(parse_gpr(q), 8) + 16
+ end
+ elseif p == "X" then
+ op = op + parse_imm(q, 5, 16, 0, false); n = n + 1
+ elseif p == "Y" then
+ local imm = tonumber(match(q, "^#(.*)$")); n = n + 1
+ if not imm or shr(imm, 8) ~= 0 then
+ werror("bad immediate operand")
+ end
+ op = op + shl(band(imm, 0xf0), 12) + band(imm, 0x0f)
+ elseif p == "K" then
+ local imm = tonumber(match(q, "^#(.*)$")); n = n + 1
+ if not imm or shr(imm, 16) ~= 0 then
+ werror("bad immediate operand")
+ end
+ op = op + shl(band(imm, 0xfff0), 4) + band(imm, 0x000f)
+ elseif p == "T" then
+ op = op + parse_imm(q, 24, 0, 0, false); n = n + 1
+ elseif p == "s" then
+ -- Ignored.
+ else
+ assert(false)
+ end
+ end
+ wputpos(pos, op)
+end
+
+map_op[".template__"] = function(params, template, nparams)
+ if not params then return template:gsub("%x%x%x%x%x%x%x%x", "") end
+
+ -- Limit number of section buffer positions used by a single dasm_put().
+ -- A single opcode needs a maximum of 3 positions.
+ if secpos+3 > maxsecpos then wflush() end
+ local pos = wpos()
+ local lpos, apos, spos = #actlist, #actargs, secpos
+
+ local ok, err
+ for t in gmatch(template, "[^|]+") do
+ ok, err = pcall(parse_template, params, t, nparams, pos)
+ if ok then return end
+ secpos = spos
+ actlist[lpos+1] = nil
+ actlist[lpos+2] = nil
+ actlist[lpos+3] = nil
+ actargs[apos+1] = nil
+ actargs[apos+2] = nil
+ actargs[apos+3] = nil
+ end
+ error(err, 0)
+end
+
+------------------------------------------------------------------------------
+
+-- Pseudo-opcode to mark the position where the action list is to be emitted.
+map_op[".actionlist_1"] = function(params)
+ if not params then return "cvar" end
+ local name = params[1] -- No syntax check. You get to keep the pieces.
+ wline(function(out) writeactions(out, name) end)
+end
+
+-- Pseudo-opcode to mark the position where the global enum is to be emitted.
+map_op[".globals_1"] = function(params)
+ if not params then return "prefix" end
+ local prefix = params[1] -- No syntax check. You get to keep the pieces.
+ wline(function(out) writeglobals(out, prefix) end)
+end
+
+-- Pseudo-opcode to mark the position where the global names are to be emitted.
+map_op[".globalnames_1"] = function(params)
+ if not params then return "cvar" end
+ local name = params[1] -- No syntax check. You get to keep the pieces.
+ wline(function(out) writeglobalnames(out, name) end)
+end
+
+-- Pseudo-opcode to mark the position where the extern names are to be emitted.
+map_op[".externnames_1"] = function(params)
+ if not params then return "cvar" end
+ local name = params[1] -- No syntax check. You get to keep the pieces.
+ wline(function(out) writeexternnames(out, name) end)
+end
+
+------------------------------------------------------------------------------
+
+-- Label pseudo-opcode (converted from trailing colon form).
+map_op[".label_1"] = function(params)
+ if not params then return "[1-9] | ->global | =>pcexpr" end
+ if secpos+1 > maxsecpos then wflush() end
+ local mode, n, s = parse_label(params[1], true)
+ if mode == "EXT" then werror("bad label definition") end
+ waction("LABEL_"..mode, n, s, 1)
+end
+
+------------------------------------------------------------------------------
+
+-- Pseudo-opcodes for data storage.
+map_op[".long_*"] = function(params)
+ if not params then return "imm..." end
+ for _,p in ipairs(params) do
+ local n = tonumber(p)
+ if not n then werror("bad immediate `"..p.."'") end
+ if n < 0 then n = n + 2^32 end
+ wputw(n)
+ if secpos+2 > maxsecpos then wflush() end
+ end
+end
+
+-- Alignment pseudo-opcode.
+map_op[".align_1"] = function(params)
+ if not params then return "numpow2" end
+ if secpos+1 > maxsecpos then wflush() end
+ local align = tonumber(params[1])
+ if align then
+ local x = align
+ -- Must be a power of 2 in the range (2 ... 256).
+ for i=1,8 do
+ x = x / 2
+ if x == 1 then
+ waction("ALIGN", align-1, nil, 1) -- Action byte is 2**n-1.
+ return
+ end
+ end
+ end
+ werror("bad alignment")
+end
+
+------------------------------------------------------------------------------
+
+-- Pseudo-opcode for (primitive) type definitions (map to C types).
+map_op[".type_3"] = function(params, nparams)
+ if not params then
+ return nparams == 2 and "name, ctype" or "name, ctype, reg"
+ end
+ local name, ctype, reg = params[1], params[2], params[3]
+ if not match(name, "^[%a_][%w_]*$") then
+ werror("bad type name `"..name.."'")
+ end
+ local tp = map_type[name]
+ if tp then
+ werror("duplicate type `"..name.."'")
+ end
+ -- Add #type to defines. A bit unclean to put it in map_archdef.
+ map_archdef["#"..name] = "sizeof("..ctype..")"
+ -- Add new type and emit shortcut define.
+ local num = ctypenum + 1
+ map_type[name] = {
+ ctype = ctype,
+ ctypefmt = format("Dt%X(%%s)", num),
+ reg = reg,
+ }
+ wline(format("#define Dt%X(_V) (int)(ptrdiff_t)&(((%s *)0)_V)", num, ctype))
+ ctypenum = num
+end
+map_op[".type_2"] = map_op[".type_3"]
+
+-- Dump type definitions.
+local function dumptypes(out, lvl)
+ local t = {}
+ for name in pairs(map_type) do t[#t+1] = name end
+ sort(t)
+ out:write("Type definitions:\n")
+ for _,name in ipairs(t) do
+ local tp = map_type[name]
+ local reg = tp.reg or ""
+ out:write(format(" %-20s %-20s %s\n", name, tp.ctype, reg))
+ end
+ out:write("\n")
+end
+
+------------------------------------------------------------------------------
+
+-- Set the current section.
+function _M.section(num)
+ waction("SECTION", num)
+ wflush(true) -- SECTION is a terminal action.
+end
+
+------------------------------------------------------------------------------
+
+-- Dump architecture description.
+function _M.dumparch(out)
+ out:write(format("DynASM %s version %s, released %s\n\n",
+ _info.arch, _info.version, _info.release))
+ dumpactions(out)
+end
+
+-- Dump all user defined elements.
+function _M.dumpdef(out, lvl)
+ dumptypes(out, lvl)
+ dumpglobals(out, lvl)
+ dumpexterns(out, lvl)
+end
+
+------------------------------------------------------------------------------
+
+-- Pass callbacks from/to the DynASM core.
+function _M.passcb(wl, we, wf, ww)
+ wline, werror, wfatal, wwarn = wl, we, wf, ww
+ return wflush
+end
+
+-- Setup the arch-specific module.
+function _M.setup(arch, opt)
+ g_arch, g_opt = arch, opt
+end
+
+-- Merge the core maps and the arch-specific maps.
+function _M.mergemaps(map_coreop, map_def)
+ setmetatable(map_op, { __index = function(t, k)
+ local v = map_coreop[k]
+ if v then return v end
+ local k1, cc, k2 = match(k, "^(.-)(..)([._].*)$")
+ local cv = map_cond[cc]
+ if cv then
+ local v = rawget(t, k1..k2)
+ if type(v) == "string" then
+ local scv = format("%x", cv)
+ return gsub(scv..sub(v, 2), "|e", "|"..scv)
+ end
+ end
+ end })
+ setmetatable(map_def, { __index = map_archdef })
+ return map_op, map_def
+end
+
+return _M
+
+------------------------------------------------------------------------------
+
diff --git a/ext/opcache/jit/dynasm/dasm_arm64.h b/ext/opcache/jit/dynasm/dasm_arm64.h
new file mode 100644
index 0000000000..d64e60a3e6
--- /dev/null
+++ b/ext/opcache/jit/dynasm/dasm_arm64.h
@@ -0,0 +1,518 @@
+/*
+** DynASM ARM64 encoding engine.
+** Copyright (C) 2005-2016 Mike Pall. All rights reserved.
+** Released under the MIT license. See dynasm.lua for full copyright notice.
+*/
+
+#include <stddef.h>
+#include <stdarg.h>
+#include <string.h>
+#include <stdlib.h>
+
+#define DASM_ARCH "arm64"
+
+#ifndef DASM_EXTERN
+#define DASM_EXTERN(a,b,c,d) 0
+#endif
+
+/* Action definitions. */
+enum {
+ DASM_STOP, DASM_SECTION, DASM_ESC, DASM_REL_EXT,
+ /* The following actions need a buffer position. */
+ DASM_ALIGN, DASM_REL_LG, DASM_LABEL_LG,
+ /* The following actions also have an argument. */
+ DASM_REL_PC, DASM_LABEL_PC,
+ DASM_IMM, DASM_IMM6, DASM_IMM12, DASM_IMM13W, DASM_IMM13X, DASM_IMML,
+ DASM__MAX
+};
+
+/* Maximum number of section buffer positions for a single dasm_put() call. */
+#define DASM_MAXSECPOS 25
+
+/* DynASM encoder status codes. Action list offset or number are or'ed in. */
+#define DASM_S_OK 0x00000000
+#define DASM_S_NOMEM 0x01000000
+#define DASM_S_PHASE 0x02000000
+#define DASM_S_MATCH_SEC 0x03000000
+#define DASM_S_RANGE_I 0x11000000
+#define DASM_S_RANGE_SEC 0x12000000
+#define DASM_S_RANGE_LG 0x13000000
+#define DASM_S_RANGE_PC 0x14000000
+#define DASM_S_RANGE_REL 0x15000000
+#define DASM_S_UNDEF_LG 0x21000000
+#define DASM_S_UNDEF_PC 0x22000000
+
+/* Macros to convert positions (8 bit section + 24 bit index). */
+#define DASM_POS2IDX(pos) ((pos)&0x00ffffff)
+#define DASM_POS2BIAS(pos) ((pos)&0xff000000)
+#define DASM_SEC2POS(sec) ((sec)<<24)
+#define DASM_POS2SEC(pos) ((pos)>>24)
+#define DASM_POS2PTR(D, pos) (D->sections[DASM_POS2SEC(pos)].rbuf + (pos))
+
+/* Action list type. */
+typedef const unsigned int *dasm_ActList;
+
+/* Per-section structure. */
+typedef struct dasm_Section {
+ int *rbuf; /* Biased buffer pointer (negative section bias). */
+ int *buf; /* True buffer pointer. */
+ size_t bsize; /* Buffer size in bytes. */
+ int pos; /* Biased buffer position. */
+ int epos; /* End of biased buffer position - max single put. */
+ int ofs; /* Byte offset into section. */
+} dasm_Section;
+
+/* Core structure holding the DynASM encoding state. */
+struct dasm_State {
+ size_t psize; /* Allocated size of this structure. */
+ dasm_ActList actionlist; /* Current actionlist pointer. */
+ int *lglabels; /* Local/global chain/pos ptrs. */
+ size_t lgsize;
+ int *pclabels; /* PC label chains/pos ptrs. */
+ size_t pcsize;
+ void **globals; /* Array of globals (bias -10). */
+ dasm_Section *section; /* Pointer to active section. */
+ size_t codesize; /* Total size of all code sections. */
+ int maxsection; /* 0 <= sectionidx < maxsection. */
+ int status; /* Status code. */
+ dasm_Section sections[1]; /* All sections. Alloc-extended. */
+};
+
+/* The size of the core structure depends on the max. number of sections. */
+#define DASM_PSZ(ms) (sizeof(dasm_State)+(ms-1)*sizeof(dasm_Section))
+
+
+/* Initialize DynASM state. */
+void dasm_init(Dst_DECL, int maxsection)
+{
+ dasm_State *D;
+ size_t psz = 0;
+ int i;
+ Dst_REF = NULL;
+ DASM_M_GROW(Dst, struct dasm_State, Dst_REF, psz, DASM_PSZ(maxsection));
+ D = Dst_REF;
+ D->psize = psz;
+ D->lglabels = NULL;
+ D->lgsize = 0;
+ D->pclabels = NULL;
+ D->pcsize = 0;
+ D->globals = NULL;
+ D->maxsection = maxsection;
+ for (i = 0; i < maxsection; i++) {
+ D->sections[i].buf = NULL; /* Need this for pass3. */
+ D->sections[i].rbuf = D->sections[i].buf - DASM_SEC2POS(i);
+ D->sections[i].bsize = 0;
+ D->sections[i].epos = 0; /* Wrong, but is recalculated after resize. */
+ }
+}
+
+/* Free DynASM state. */
+void dasm_free(Dst_DECL)
+{
+ dasm_State *D = Dst_REF;
+ int i;
+ for (i = 0; i < D->maxsection; i++)
+ if (D->sections[i].buf)
+ DASM_M_FREE(Dst, D->sections[i].buf, D->sections[i].bsize);
+ if (D->pclabels) DASM_M_FREE(Dst, D->pclabels, D->pcsize);
+ if (D->lglabels) DASM_M_FREE(Dst, D->lglabels, D->lgsize);
+ DASM_M_FREE(Dst, D, D->psize);
+}
+
+/* Setup global label array. Must be called before dasm_setup(). */
+void dasm_setupglobal(Dst_DECL, void **gl, unsigned int maxgl)
+{
+ dasm_State *D = Dst_REF;
+ D->globals = gl - 10; /* Negative bias to compensate for locals. */
+ DASM_M_GROW(Dst, int, D->lglabels, D->lgsize, (10+maxgl)*sizeof(int));
+}
+
+/* Grow PC label array. Can be called after dasm_setup(), too. */
+void dasm_growpc(Dst_DECL, unsigned int maxpc)
+{
+ dasm_State *D = Dst_REF;
+ size_t osz = D->pcsize;
+ DASM_M_GROW(Dst, int, D->pclabels, D->pcsize, maxpc*sizeof(int));
+ memset((void *)(((unsigned char *)D->pclabels)+osz), 0, D->pcsize-osz);
+}
+
+/* Setup encoder. */
+void dasm_setup(Dst_DECL, const void *actionlist)
+{
+ dasm_State *D = Dst_REF;
+ int i;
+ D->actionlist = (dasm_ActList)actionlist;
+ D->status = DASM_S_OK;
+ D->section = &D->sections[0];
+ memset((void *)D->lglabels, 0, D->lgsize);
+ if (D->pclabels) memset((void *)D->pclabels, 0, D->pcsize);
+ for (i = 0; i < D->maxsection; i++) {
+ D->sections[i].pos = DASM_SEC2POS(i);
+ D->sections[i].ofs = 0;
+ }
+}
+
+
+#ifdef DASM_CHECKS
+#define CK(x, st) \
+ do { if (!(x)) { \
+ D->status = DASM_S_##st|(p-D->actionlist-1); return; } } while (0)
+#define CKPL(kind, st) \
+ do { if ((size_t)((char *)pl-(char *)D->kind##labels) >= D->kind##size) { \
+ D->status = DASM_S_RANGE_##st|(p-D->actionlist-1); return; } } while (0)
+#else
+#define CK(x, st) ((void)0)
+#define CKPL(kind, st) ((void)0)
+#endif
+
+static int dasm_imm12(unsigned int n)
+{
+ if ((n >> 12) == 0)
+ return n;
+ else if ((n & 0xff000fff) == 0)
+ return (n >> 12) | 0x1000;
+ else
+ return -1;
+}
+
+static int dasm_ffs(unsigned long long x)
+{
+ int n = -1;
+ while (x) { x >>= 1; n++; }
+ return n;
+}
+
+static int dasm_imm13(int lo, int hi)
+{
+ int inv = 0, w = 64, s = 0xfff, xa, xb;
+ unsigned long long n = (((unsigned long long)hi) << 32) | (unsigned int)lo;
+ unsigned long long m = 1ULL, a, b, c;
+ if (n & 1) { n = ~n; inv = 1; }
+ a = n & -n; b = (n+a)&-(n+a); c = (n+a-b)&-(n+a-b);
+ xa = dasm_ffs(a); xb = dasm_ffs(b);
+ if (c) {
+ w = dasm_ffs(c) - xa;
+ if (w == 32) m = 0x0000000100000001UL;
+ else if (w == 16) m = 0x0001000100010001UL;
+ else if (w == 8) m = 0x0101010101010101UL;
+ else if (w == 4) m = 0x1111111111111111UL;
+ else if (w == 2) m = 0x5555555555555555UL;
+ else return -1;
+ s = (-2*w & 0x3f) - 1;
+ } else if (!a) {
+ return -1;
+ } else if (xb == -1) {
+ xb = 64;
+ }
+ if ((b-a) * m != n) return -1;
+ if (inv) {
+ return ((w - xb) << 6) | (s+w+xa-xb);
+ } else {
+ return ((w - xa) << 6) | (s+xb-xa);
+ }
+ return -1;
+}
+
+/* Pass 1: Store actions and args, link branches/labels, estimate offsets. */
+void dasm_put(Dst_DECL, int start, ...)
+{
+ va_list ap;
+ dasm_State *D = Dst_REF;
+ dasm_ActList p = D->actionlist + start;
+ dasm_Section *sec = D->section;
+ int pos = sec->pos, ofs = sec->ofs;
+ int *b;
+
+ if (pos >= sec->epos) {
+ DASM_M_GROW(Dst, int, sec->buf, sec->bsize,
+ sec->bsize + 2*DASM_MAXSECPOS*sizeof(int));
+ sec->rbuf = sec->buf - DASM_POS2BIAS(pos);
+ sec->epos = (int)sec->bsize/sizeof(int) - DASM_MAXSECPOS+DASM_POS2BIAS(pos);
+ }
+
+ b = sec->rbuf;
+ b[pos++] = start;
+
+ va_start(ap, start);
+ while (1) {
+ unsigned int ins = *p++;
+ unsigned int action = (ins >> 16);
+ if (action >= DASM__MAX) {
+ ofs += 4;
+ } else {
+ int *pl, n = action >= DASM_REL_PC ? va_arg(ap, int) : 0;
+ switch (action) {
+ case DASM_STOP: goto stop;
+ case DASM_SECTION:
+ n = (ins & 255); CK(n < D->maxsection, RANGE_SEC);
+ D->section = &D->sections[n]; goto stop;
+ case DASM_ESC: p++; ofs += 4; break;
+ case DASM_REL_EXT: break;
+ case DASM_ALIGN: ofs += (ins & 255); b[pos++] = ofs; break;
+ case DASM_REL_LG:
+ n = (ins & 2047) - 10; pl = D->lglabels + n;
+ /* Bkwd rel or global. */
+ if (n >= 0) { CK(n>=10||*pl<0, RANGE_LG); CKPL(lg, LG); goto putrel; }
+ pl += 10; n = *pl;
+ if (n < 0) n = 0; /* Start new chain for fwd rel if label exists. */
+ goto linkrel;
+ case DASM_REL_PC:
+ pl = D->pclabels + n; CKPL(pc, PC);
+ putrel:
+ n = *pl;
+ if (n < 0) { /* Label exists. Get label pos and store it. */
+ b[pos] = -n;
+ } else {
+ linkrel:
+ b[pos] = n; /* Else link to rel chain, anchored at label. */
+ *pl = pos;
+ }
+ pos++;
+ break;
+ case DASM_LABEL_LG:
+ pl = D->lglabels + (ins & 2047) - 10; CKPL(lg, LG); goto putlabel;
+ case DASM_LABEL_PC:
+ pl = D->pclabels + n; CKPL(pc, PC);
+ putlabel:
+ n = *pl; /* n > 0: Collapse rel chain and replace with label pos. */
+ while (n > 0) { int *pb = DASM_POS2PTR(D, n); n = *pb; *pb = pos;
+ }
+ *pl = -pos; /* Label exists now. */
+ b[pos++] = ofs; /* Store pass1 offset estimate. */
+ break;
+ case DASM_IMM:
+ CK((n & ((1<<((ins>>10)&31))-1)) == 0, RANGE_I);
+ n >>= ((ins>>10)&31);
+#ifdef DASM_CHECKS
+ if ((ins & 0x8000))
+ CK(((n + (1<<(((ins>>5)&31)-1)))>>((ins>>5)&31)) == 0, RANGE_I);
+ else
+ CK((n>>((ins>>5)&31)) == 0, RANGE_I);
+#endif
+ b[pos++] = n;
+ break;
+ case DASM_IMM6:
+ CK((n >> 6) == 0, RANGE_I);
+ b[pos++] = n;
+ break;
+ case DASM_IMM12:
+ CK(dasm_imm12((unsigned int)n) != -1, RANGE_I);
+ b[pos++] = n;
+ break;
+ case DASM_IMM13W:
+ CK(dasm_imm13(n, n) != -1, RANGE_I);
+ b[pos++] = n;
+ break;
+ case DASM_IMM13X: {
+ int m = va_arg(ap, int);
+ CK(dasm_imm13(n, m) != -1, RANGE_I);
+ b[pos++] = n;
+ b[pos++] = m;
+ break;
+ }
+ case DASM_IMML: {
+#ifdef DASM_CHECKS
+ int scale = (p[-2] >> 30);
+ CK((!(n & ((1<<scale)-1)) && (unsigned int)(n>>scale) < 4096) ||
+ (unsigned int)(n+256) < 512, RANGE_I);
+#endif
+ b[pos++] = n;
+ break;
+ }
+ }
+ }
+ }
+stop:
+ va_end(ap);
+ sec->pos = pos;
+ sec->ofs = ofs;
+}
+#undef CK
+
+/* Pass 2: Link sections, shrink aligns, fix label offsets. */
+int dasm_link(Dst_DECL, size_t *szp)
+{
+ dasm_State *D = Dst_REF;
+ int secnum;
+ int ofs = 0;
+
+#ifdef DASM_CHECKS
+ *szp = 0;
+ if (D->status != DASM_S_OK) return D->status;
+ {
+ int pc;
+ for (pc = 0; pc*sizeof(int) < D->pcsize; pc++)
+ if (D->pclabels[pc] > 0) return DASM_S_UNDEF_PC|pc;
+ }
+#endif
+
+ { /* Handle globals not defined in this translation unit. */
+ int idx;
+ for (idx = 20; idx*sizeof(int) < D->lgsize; idx++) {
+ int n = D->lglabels[idx];
+ /* Undefined label: Collapse rel chain and replace with marker (< 0). */
+ while (n > 0) { int *pb = DASM_POS2PTR(D, n); n = *pb; *pb = -idx; }
+ }
+ }
+
+ /* Combine all code sections. No support for data sections (yet). */
+ for (secnum = 0; secnum < D->maxsection; secnum++) {
+ dasm_Section *sec = D->sections + secnum;
+ int *b = sec->rbuf;
+ int pos = DASM_SEC2POS(secnum);
+ int lastpos = sec->pos;
+
+ while (pos != lastpos) {
+ dasm_ActList p = D->actionlist + b[pos++];
+ while (1) {
+ unsigned int ins = *p++;
+ unsigned int action = (ins >> 16);
+ switch (action) {
+ case DASM_STOP: case DASM_SECTION: goto stop;
+ case DASM_ESC: p++; break;
+ case DASM_REL_EXT: break;
+ case DASM_ALIGN: ofs -= (b[pos++] + ofs) & (ins & 255); break;
+ case DASM_REL_LG: case DASM_REL_PC: pos++; break;
+ case DASM_LABEL_LG: case DASM_LABEL_PC: b[pos++] += ofs; break;
+ case DASM_IMM: case DASM_IMM6: case DASM_IMM12: case DASM_IMM13W:
+ case DASM_IMML: pos++; break;
+ case DASM_IMM13X: pos += 2; break;
+ }
+ }
+ stop: (void)0;
+ }
+ ofs += sec->ofs; /* Next section starts right after current section. */
+ }
+
+ D->codesize = ofs; /* Total size of all code sections */
+ *szp = ofs;
+ return DASM_S_OK;
+}
+
+#ifdef DASM_CHECKS
+#define CK(x, st) \
+ do { if (!(x)) return DASM_S_##st|(p-D->actionlist-1); } while (0)
+#else
+#define CK(x, st) ((void)0)
+#endif
+
+/* Pass 3: Encode sections. */
+int dasm_encode(Dst_DECL, void *buffer)
+{
+ dasm_State *D = Dst_REF;
+ char *base = (char *)buffer;
+ unsigned int *cp = (unsigned int *)buffer;
+ int secnum;
+
+ /* Encode all code sections. No support for data sections (yet). */
+ for (secnum = 0; secnum < D->maxsection; secnum++) {
+ dasm_Section *sec = D->sections + secnum;
+ int *b = sec->buf;
+ int *endb = sec->rbuf + sec->pos;
+
+ while (b != endb) {
+ dasm_ActList p = D->actionlist + *b++;
+ while (1) {
+ unsigned int ins = *p++;
+ unsigned int action = (ins >> 16);
+ int n = (action >= DASM_ALIGN && action < DASM__MAX) ? *b++ : 0;
+ switch (action) {
+ case DASM_STOP: case DASM_SECTION: goto stop;
+ case DASM_ESC: *cp++ = *p++; break;
+ case DASM_REL_EXT:
+ n = DASM_EXTERN(Dst, (unsigned char *)cp, (ins&2047), !(ins&2048));
+ goto patchrel;
+ case DASM_ALIGN:
+ ins &= 255; while ((((char *)cp - base) & ins)) *cp++ = 0xe1a00000;
+ break;
+ case DASM_REL_LG:
+ CK(n >= 0, UNDEF_LG);
+ case DASM_REL_PC:
+ CK(n >= 0, UNDEF_PC);
+ n = *DASM_POS2PTR(D, n) - (int)((char *)cp - base) + 4;
+ patchrel:
+ if (!(ins & 0xf800)) { /* B, BL */
+ CK((n & 3) == 0 && ((n+0x08000000) >> 28) == 0, RANGE_REL);
+ cp[-1] |= ((n >> 2) & 0x03ffffff);
+ } else if ((ins & 0x800)) { /* B.cond, CBZ, CBNZ, LDR* literal */
+ CK((n & 3) == 0 && ((n+0x00100000) >> 21) == 0, RANGE_REL);
+ cp[-1] |= ((n << 3) & 0x00ffffe0);
+ } else if ((ins & 0x3000) == 0x2000) { /* ADR */
+ CK(((n+0x00100000) >> 21) == 0, RANGE_REL);
+ cp[-1] |= ((n << 3) & 0x00ffffe0) | ((n & 3) << 29);
+ } else if ((ins & 0x3000) == 0x3000) { /* ADRP */
+ cp[-1] |= ((n >> 9) & 0x00ffffe0) | (((n >> 12) & 3) << 29);
+ } else if ((ins & 0x1000)) { /* TBZ, TBNZ */
+ CK((n & 3) == 0 && ((n+0x00008000) >> 16) == 0, RANGE_REL);
+ cp[-1] |= ((n << 3) & 0x0007ffe0);
+ }
+ break;
+ case DASM_LABEL_LG:
+ ins &= 2047; if (ins >= 20) D->globals[ins-10] = (void *)(base + n);
+ break;
+ case DASM_LABEL_PC: break;
+ case DASM_IMM:
+ cp[-1] |= (n & ((1<<((ins>>5)&31))-1)) << (ins&31);
+ break;
+ case DASM_IMM6:
+ cp[-1] |= ((n&31) << 19) | ((n&32) << 26);
+ break;
+ case DASM_IMM12:
+ cp[-1] |= (dasm_imm12((unsigned int)n) << 10);
+ break;
+ case DASM_IMM13W:
+ cp[-1] |= (dasm_imm13(n, n) << 10);
+ break;
+ case DASM_IMM13X:
+ cp[-1] |= (dasm_imm13(n, *b++) << 10);
+ break;
+ case DASM_IMML: {
+ int scale = (p[-2] >> 30);
+ cp[-1] |= (!(n & ((1<<scale)-1)) && (unsigned int)(n>>scale) < 4096) ?
+ ((n << (10-scale)) | 0x01000000) : ((n & 511) << 12);
+ break;
+ }
+ default: *cp++ = ins; break;
+ }
+ }
+ stop: (void)0;
+ }
+ }
+
+ if (base + D->codesize != (char *)cp) /* Check for phase errors. */
+ return DASM_S_PHASE;
+ return DASM_S_OK;
+}
+#undef CK
+
+/* Get PC label offset. */
+int dasm_getpclabel(Dst_DECL, unsigned int pc)
+{
+ dasm_State *D = Dst_REF;
+ if (pc*sizeof(int) < D->pcsize) {
+ int pos = D->pclabels[pc];
+ if (pos < 0) return *DASM_POS2PTR(D, -pos);
+ if (pos > 0) return -1; /* Undefined. */
+ }
+ return -2; /* Unused or out of range. */
+}
+
+#ifdef DASM_CHECKS
+/* Optional sanity checker to call between isolated encoding steps. */
+int dasm_checkstep(Dst_DECL, int secmatch)
+{
+ dasm_State *D = Dst_REF;
+ if (D->status == DASM_S_OK) {
+ int i;
+ for (i = 1; i <= 9; i++) {
+ if (D->lglabels[i] > 0) { D->status = DASM_S_UNDEF_LG|i; break; }
+ D->lglabels[i] = 0;
+ }
+ }
+ if (D->status == DASM_S_OK && secmatch >= 0 &&
+ D->section != &D->sections[secmatch])
+ D->status = DASM_S_MATCH_SEC|(D->section-D->sections);
+ return D->status;
+}
+#endif
+
diff --git a/ext/opcache/jit/dynasm/dasm_arm64.lua b/ext/opcache/jit/dynasm/dasm_arm64.lua
new file mode 100644
index 0000000000..4a7d8dfeeb
--- /dev/null
+++ b/ext/opcache/jit/dynasm/dasm_arm64.lua
@@ -0,0 +1,1166 @@
+------------------------------------------------------------------------------
+-- DynASM ARM64 module.
+--
+-- Copyright (C) 2005-2016 Mike Pall. All rights reserved.
+-- See dynasm.lua for full copyright notice.
+------------------------------------------------------------------------------
+
+-- Module information:
+local _info = {
+ arch = "arm",
+ description = "DynASM ARM64 module",
+ version = "1.4.0",
+ vernum = 10400,
+ release = "2015-10-18",
+ author = "Mike Pall",
+ license = "MIT",
+}
+
+-- Exported glue functions for the arch-specific module.
+local _M = { _info = _info }
+
+-- Cache library functions.
+local type, tonumber, pairs, ipairs = type, tonumber, pairs, ipairs
+local assert, setmetatable, rawget = assert, setmetatable, rawget
+local _s = string
+local sub, format, byte, char = _s.sub, _s.format, _s.byte, _s.char
+local match, gmatch, gsub = _s.match, _s.gmatch, _s.gsub
+local concat, sort, insert = table.concat, table.sort, table.insert
+local bit = bit or require("bit")
+local band, shl, shr, sar = bit.band, bit.lshift, bit.rshift, bit.arshift
+local ror, tohex = bit.ror, bit.tohex
+
+-- Inherited tables and callbacks.
+local g_opt, g_arch
+local wline, werror, wfatal, wwarn
+
+-- Action name list.
+-- CHECK: Keep this in sync with the C code!
+local action_names = {
+ "STOP", "SECTION", "ESC", "REL_EXT",
+ "ALIGN", "REL_LG", "LABEL_LG",
+ "REL_PC", "LABEL_PC", "IMM", "IMM6", "IMM12", "IMM13W", "IMM13X", "IMML",
+}
+
+-- Maximum number of section buffer positions for dasm_put().
+-- CHECK: Keep this in sync with the C code!
+local maxsecpos = 25 -- Keep this low, to avoid excessively long C lines.
+
+-- Action name -> action number.
+local map_action = {}
+for n,name in ipairs(action_names) do
+ map_action[name] = n-1
+end
+
+-- Action list buffer.
+local actlist = {}
+
+-- Argument list for next dasm_put(). Start with offset 0 into action list.
+local actargs = { 0 }
+
+-- Current number of section buffer positions for dasm_put().
+local secpos = 1
+
+------------------------------------------------------------------------------
+
+-- Dump action names and numbers.
+local function dumpactions(out)
+ out:write("DynASM encoding engine action codes:\n")
+ for n,name in ipairs(action_names) do
+ local num = map_action[name]
+ out:write(format(" %-10s %02X %d\n", name, num, num))
+ end
+ out:write("\n")
+end
+
+-- Write action list buffer as a huge static C array.
+local function writeactions(out, name)
+ local nn = #actlist
+ if nn == 0 then nn = 1; actlist[0] = map_action.STOP end
+ out:write("static const unsigned int ", name, "[", nn, "] = {\n")
+ for i = 1,nn-1 do
+ assert(out:write("0x", tohex(actlist[i]), ",\n"))
+ end
+ assert(out:write("0x", tohex(actlist[nn]), "\n};\n\n"))
+end
+
+------------------------------------------------------------------------------
+
+-- Add word to action list.
+local function wputxw(n)
+ assert(n >= 0 and n <= 0xffffffff and n % 1 == 0, "word out of range")
+ actlist[#actlist+1] = n
+end
+
+-- Add action to list with optional arg. Advance buffer pos, too.
+local function waction(action, val, a, num)
+ local w = assert(map_action[action], "bad action name `"..action.."'")
+ wputxw(w * 0x10000 + (val or 0))
+ if a then actargs[#actargs+1] = a end
+ if a or num then secpos = secpos + (num or 1) end
+end
+
+-- Flush action list (intervening C code or buffer pos overflow).
+local function wflush(term)
+ if #actlist == actargs[1] then return end -- Nothing to flush.
+ if not term then waction("STOP") end -- Terminate action list.
+ wline(format("dasm_put(Dst, %s);", concat(actargs, ", ")), true)
+ actargs = { #actlist } -- Actionlist offset is 1st arg to next dasm_put().
+ secpos = 1 -- The actionlist offset occupies a buffer position, too.
+end
+
+-- Put escaped word.
+local function wputw(n)
+ if n <= 0x000fffff then waction("ESC") end
+ wputxw(n)
+end
+
+-- Reserve position for word.
+local function wpos()
+ local pos = #actlist+1
+ actlist[pos] = ""
+ return pos
+end
+
+-- Store word to reserved position.
+local function wputpos(pos, n)
+ assert(n >= 0 and n <= 0xffffffff and n % 1 == 0, "word out of range")
+ if n <= 0x000fffff then
+ insert(actlist, pos+1, n)
+ n = map_action.ESC * 0x10000
+ end
+ actlist[pos] = n
+end
+
+------------------------------------------------------------------------------
+
+-- Global label name -> global label number. With auto assignment on 1st use.
+local next_global = 20
+local map_global = setmetatable({}, { __index = function(t, name)
+ if not match(name, "^[%a_][%w_]*$") then werror("bad global label") end
+ local n = next_global
+ if n > 2047 then werror("too many global labels") end
+ next_global = n + 1
+ t[name] = n
+ return n
+end})
+
+-- Dump global labels.
+local function dumpglobals(out, lvl)
+ local t = {}
+ for name, n in pairs(map_global) do t[n] = name end
+ out:write("Global labels:\n")
+ for i=20,next_global-1 do
+ out:write(format(" %s\n", t[i]))
+ end
+ out:write("\n")
+end
+
+-- Write global label enum.
+local function writeglobals(out, prefix)
+ local t = {}
+ for name, n in pairs(map_global) do t[n] = name end
+ out:write("enum {\n")
+ for i=20,next_global-1 do
+ out:write(" ", prefix, t[i], ",\n")
+ end
+ out:write(" ", prefix, "_MAX\n};\n")
+end
+
+-- Write global label names.
+local function writeglobalnames(out, name)
+ local t = {}
+ for name, n in pairs(map_global) do t[n] = name end
+ out:write("static const char *const ", name, "[] = {\n")
+ for i=20,next_global-1 do
+ out:write(" \"", t[i], "\",\n")
+ end
+ out:write(" (const char *)0\n};\n")
+end
+
+------------------------------------------------------------------------------
+
+-- Extern label name -> extern label number. With auto assignment on 1st use.
+local next_extern = 0
+local map_extern_ = {}
+local map_extern = setmetatable({}, { __index = function(t, name)
+ -- No restrictions on the name for now.
+ local n = next_extern
+ if n > 2047 then werror("too many extern labels") end
+ next_extern = n + 1
+ t[name] = n
+ map_extern_[n] = name
+ return n
+end})
+
+-- Dump extern labels.
+local function dumpexterns(out, lvl)
+ out:write("Extern labels:\n")
+ for i=0,next_extern-1 do
+ out:write(format(" %s\n", map_extern_[i]))
+ end
+ out:write("\n")
+end
+
+-- Write extern label names.
+local function writeexternnames(out, name)
+ out:write("static const char *const ", name, "[] = {\n")
+ for i=0,next_extern-1 do
+ out:write(" \"", map_extern_[i], "\",\n")
+ end
+ out:write(" (const char *)0\n};\n")
+end
+
+------------------------------------------------------------------------------
+
+-- Arch-specific maps.
+
+-- Ext. register name -> int. name.
+local map_archdef = { xzr = "@x31", wzr = "@w31", lr = "x30", }
+
+-- Int. register name -> ext. name.
+local map_reg_rev = { ["@x31"] = "xzr", ["@w31"] = "wzr", x30 = "lr", }
+
+local map_type = {} -- Type name -> { ctype, reg }
+local ctypenum = 0 -- Type number (for Dt... macros).
+
+-- Reverse defines for registers.
+function _M.revdef(s)
+ return map_reg_rev[s] or s
+end
+
+local map_shift = { lsl = 0, lsr = 1, asr = 2, }
+
+local map_extend = {
+ uxtb = 0, uxth = 1, uxtw = 2, uxtx = 3,
+ sxtb = 4, sxth = 5, sxtw = 6, sxtx = 7,
+}
+
+local map_cond = {
+ eq = 0, ne = 1, cs = 2, cc = 3, mi = 4, pl = 5, vs = 6, vc = 7,
+ hi = 8, ls = 9, ge = 10, lt = 11, gt = 12, le = 13, al = 14,
+ hs = 2, lo = 3,
+}
+
+------------------------------------------------------------------------------
+
+local parse_reg_type
+
+local function parse_reg(expr)
+ if not expr then werror("expected register name") end
+ local tname, ovreg = match(expr, "^([%w_]+):(@?%l%d+)$")
+ local tp = map_type[tname or expr]
+ if tp then
+ local reg = ovreg or tp.reg
+ if not reg then
+ werror("type `"..(tname or expr).."' needs a register override")
+ end
+ expr = reg
+ end
+ local ok31, rt, r = match(expr, "^(@?)([xwqdshb])([123]?[0-9])$")
+ if r then
+ r = tonumber(r)
+ if r <= 30 or (r == 31 and ok31 ~= "" or (rt ~= "w" and rt ~= "x")) then
+ if not parse_reg_type then
+ parse_reg_type = rt
+ elseif parse_reg_type ~= rt then
+ werror("register size mismatch")
+ end
+ return r, tp
+ end
+ end
+ werror("bad register name `"..expr.."'")
+end
+
+local function parse_reg_base(expr)
+ if expr == "sp" then return 0x3e0 end
+ local base, tp = parse_reg(expr)
+ if parse_reg_type ~= "x" then werror("bad register type") end
+ parse_reg_type = false
+ return shl(base, 5), tp
+end
+
+local parse_ctx = {}
+
+local loadenv = setfenv and function(s)
+ local code = loadstring(s, "")
+ if code then setfenv(code, parse_ctx) end
+ return code
+end or function(s)
+ return load(s, "", nil, parse_ctx)
+end
+
+-- Try to parse simple arithmetic, too, since some basic ops are aliases.
+local function parse_number(n)
+ local x = tonumber(n)
+ if x then return x end
+ local code = loadenv("return "..n)
+ if code then
+ local ok, y = pcall(code)
+ if ok then return y end
+ end
+ return nil
+end
+
+local function parse_imm(imm, bits, shift, scale, signed)
+ imm = match(imm, "^#(.*)$")
+ if not imm then werror("expected immediate operand") end
+ local n = parse_number(imm)
+ if n then
+ local m = sar(n, scale)
+ if shl(m, scale) == n then
+ if signed then
+ local s = sar(m, bits-1)
+ if s == 0 then return shl(m, shift)
+ elseif s == -1 then return shl(m + shl(1, bits), shift) end
+ else
+ if sar(m, bits) == 0 then return shl(m, shift) end
+ end
+ end
+ werror("out of range immediate `"..imm.."'")
+ else
+ waction("IMM", (signed and 32768 or 0)+scale*1024+bits*32+shift, imm)
+ return 0
+ end
+end
+
+local function parse_imm12(imm)
+ imm = match(imm, "^#(.*)$")
+ if not imm then werror("expected immediate operand") end
+ local n = parse_number(imm)
+ if n then
+ if shr(n, 12) == 0 then
+ return shl(n, 10)
+ elseif band(n, 0xff000fff) == 0 then
+ return shr(n, 2) + 0x00400000
+ end
+ werror("out of range immediate `"..imm.."'")
+ else
+ waction("IMM12", 0, imm)
+ return 0
+ end
+end
+
+local function parse_imm13(imm)
+ imm = match(imm, "^#(.*)$")
+ if not imm then werror("expected immediate operand") end
+ local n = parse_number(imm)
+ local r64 = parse_reg_type == "x"
+ if n and n % 1 == 0 and n >= 0 and n <= 0xffffffff then
+ local inv = false
+ if band(n, 1) == 1 then n = bit.bnot(n); inv = true end
+ local t = {}
+ for i=1,32 do t[i] = band(n, 1); n = shr(n, 1) end
+ local b = table.concat(t)
+ b = b..(r64 and (inv and "1" or "0"):rep(32) or b)
+ local p0, p1, p0a, p1a = b:match("^(0+)(1+)(0*)(1*)")
+ if p0 then
+ local w = p1a == "" and (r64 and 64 or 32) or #p1+#p0a
+ if band(w, w-1) == 0 and b == b:sub(1, w):rep(64/w) then
+ local s = band(-2*w, 0x3f) - 1
+ if w == 64 then s = s + 0x1000 end
+ if inv then
+ return shl(w-#p1-#p0, 16) + shl(s+w-#p1, 10)
+ else
+ return shl(w-#p0, 16) + shl(s+#p1, 10)
+ end
+ end
+ end
+ werror("out of range immediate `"..imm.."'")
+ elseif r64 then
+ waction("IMM13X", 0, format("(unsigned int)(%s)", imm))
+ actargs[#actargs+1] = format("(unsigned int)((unsigned long long)(%s)>>32)", imm)
+ return 0
+ else
+ waction("IMM13W", 0, imm)
+ return 0
+ end
+end
+
+local function parse_imm6(imm)
+ imm = match(imm, "^#(.*)$")
+ if not imm then werror("expected immediate operand") end
+ local n = parse_number(imm)
+ if n then
+ if n >= 0 and n <= 63 then
+ return shl(band(n, 0x1f), 19) + (n >= 32 and 0x80000000 or 0)
+ end
+ werror("out of range immediate `"..imm.."'")
+ else
+ waction("IMM6", 0, imm)
+ return 0
+ end
+end
+
+local function parse_imm_load(imm, scale)
+ local n = parse_number(imm)
+ if n then
+ local m = sar(n, scale)
+ if shl(m, scale) == n and m >= 0 and m < 0x1000 then
+ return shl(m, 10) + 0x01000000 -- Scaled, unsigned 12 bit offset.
+ elseif n >= -256 and n < 256 then
+ return shl(band(n, 511), 12) -- Unscaled, signed 9 bit offset.
+ end
+ werror("out of range immediate `"..imm.."'")
+ else
+ waction("IMML", 0, imm)
+ return 0
+ end
+end
+
+local function parse_fpimm(imm)
+ imm = match(imm, "^#(.*)$")
+ if not imm then werror("expected immediate operand") end
+ local n = parse_number(imm)
+ if n then
+ local m, e = math.frexp(n)
+ local s, e2 = 0, band(e-2, 7)
+ if m < 0 then m = -m; s = 0x00100000 end
+ m = m*32-16
+ if m % 1 == 0 and m >= 0 and m <= 15 and sar(shl(e2, 29), 29)+2 == e then
+ return s + shl(e2, 17) + shl(m, 13)
+ end
+ werror("out of range immediate `"..imm.."'")
+ else
+ werror("NYI fpimm action")
+ end
+end
+
+local function parse_shift(expr)
+ local s, s2 = match(expr, "^(%S+)%s*(.*)$")
+ s = map_shift[s]
+ if not s then werror("expected shift operand") end
+ return parse_imm(s2, 6, 10, 0, false) + shl(s, 22)
+end
+
+local function parse_lslx16(expr)
+ local n = match(expr, "^lsl%s*#(%d+)$")
+ n = tonumber(n)
+ if not n then werror("expected shift operand") end
+ if band(n, parse_reg_type == "x" and 0xffffffcf or 0xffffffef) ~= 0 then
+ werror("bad shift amount")
+ end
+ return shl(n, 17)
+end
+
+local function parse_extend(expr)
+ local s, s2 = match(expr, "^(%S+)%s*(.*)$")
+ if s == "lsl" then
+ s = parse_reg_type == "x" and 3 or 2
+ else
+ s = map_extend[s]
+ end
+ if not s then werror("expected extend operand") end
+ return (s2 == "" and 0 or parse_imm(s2, 3, 10, 0, false)) + shl(s, 13)
+end
+
+local function parse_cond(expr, inv)
+ local c = map_cond[expr]
+ if not c then werror("expected condition operand") end
+ return shl(bit.bxor(c, inv), 12)
+end
+
+local function parse_load(params, nparams, n, op)
+ if params[n+2] then werror("too many operands") end
+ local pn, p2 = params[n], params[n+1]
+ local p1, wb = match(pn, "^%[%s*(.-)%s*%](!?)$")
+ if not p1 then
+ if not p2 then
+ local reg, tailr = match(pn, "^([%w_:]+)%s*(.*)$")
+ if reg and tailr ~= "" then
+ local base, tp = parse_reg_base(reg)
+ if tp then
+ waction("IMML", 0, format(tp.ctypefmt, tailr))
+ return op + base
+ end
+ end
+ end
+ werror("expected address operand")
+ end
+ local scale = shr(op, 30)
+ if p2 then
+ if wb == "!" then werror("bad use of '!'") end
+ op = op + parse_reg_base(p1) + parse_imm(p2, 9, 12, 0, true) + 0x400
+ elseif wb == "!" then
+ local p1a, p2a = match(p1, "^([^,%s]*)%s*,%s*(.*)$")
+ if not p1a then werror("bad use of '!'") end
+ op = op + parse_reg_base(p1a) + parse_imm(p2a, 9, 12, 0, true) + 0xc00
+ else
+ local p1a, p2a = match(p1, "^([^,%s]*)%s*(.*)$")
+ op = op + parse_reg_base(p1a)
+ if p2a ~= "" then
+ local imm = match(p2a, "^,%s*#(.*)$")
+ if imm then
+ op = op + parse_imm_load(imm, scale)
+ else
+ local p2b, p3b, p3s = match(p2a, "^,%s*([^,%s]*)%s*,?%s*(%S*)%s*(.*)$")
+ op = op + shl(parse_reg(p2b), 16) + 0x00200800
+ if parse_reg_type ~= "x" and parse_reg_type ~= "w" then
+ werror("bad index register type")
+ end
+ if p3b == "" then
+ if parse_reg_type ~= "x" then werror("bad index register type") end
+ op = op + 0x6000
+ else
+ if p3s == "" or p3s == "#0" then
+ elseif p3s == "#"..scale then
+ op = op + 0x1000
+ else
+ werror("bad scale")
+ end
+ if parse_reg_type == "x" then
+ if p3b == "lsl" and p3s ~= "" then op = op + 0x6000
+ elseif p3b == "sxtx" then op = op + 0xe000
+ else
+ werror("bad extend/shift specifier")
+ end
+ else
+ if p3b == "uxtw" then op = op + 0x4000
+ elseif p3b == "sxtw" then op = op + 0xc000
+ else
+ werror("bad extend/shift specifier")
+ end
+ end
+ end
+ end
+ else
+ if wb == "!" then werror("bad use of '!'") end
+ op = op + 0x01000000
+ end
+ end
+ return op
+end
+
+local function parse_load_pair(params, nparams, n, op)
+ if params[n+2] then werror("too many operands") end
+ local pn, p2 = params[n], params[n+1]
+ local scale = shr(op, 30) == 0 and 2 or 3
+ local p1, wb = match(pn, "^%[%s*(.-)%s*%](!?)$")
+ if not p1 then
+ if not p2 then
+ local reg, tailr = match(pn, "^([%w_:]+)%s*(.*)$")
+ if reg and tailr ~= "" then
+ local base, tp = parse_reg_base(reg)
+ if tp then
+ waction("IMM", 32768+7*32+15+scale*1024, format(tp.ctypefmt, tailr))
+ return op + base + 0x01000000
+ end
+ end
+ end
+ werror("expected address operand")
+ end
+ if p2 then
+ if wb == "!" then werror("bad use of '!'") end
+ op = op + 0x00800000
+ else
+ local p1a, p2a = match(p1, "^([^,%s]*)%s*,%s*(.*)$")
+ if p1a then p1, p2 = p1a, p2a else p2 = "#0" end
+ op = op + (wb == "!" and 0x01800000 or 0x01000000)
+ end
+ return op + parse_reg_base(p1) + parse_imm(p2, 7, 15, scale, true)
+end
+
+local function parse_label(label, def)
+ local prefix = sub(label, 1, 2)
+ -- =>label (pc label reference)
+ if prefix == "=>" then
+ return "PC", 0, sub(label, 3)
+ end
+ -- ->name (global label reference)
+ if prefix == "->" then
+ return "LG", map_global[sub(label, 3)]
+ end
+ if def then
+ -- [1-9] (local label definition)
+ if match(label, "^[1-9]$") then
+ return "LG", 10+tonumber(label)
+ end
+ else
+ -- [<>][1-9] (local label reference)
+ local dir, lnum = match(label, "^([<>])([1-9])$")
+ if dir then -- Fwd: 1-9, Bkwd: 11-19.
+ return "LG", lnum + (dir == ">" and 0 or 10)
+ end
+ -- extern label (extern label reference)
+ local extname = match(label, "^extern%s+(%S+)$")
+ if extname then
+ return "EXT", map_extern[extname]
+ end
+ end
+ werror("bad label `"..label.."'")
+end
+
+local function branch_type(op)
+ if band(op, 0x7c000000) == 0x14000000 then return 0 -- B, BL
+ elseif shr(op, 24) == 0x54 or band(op, 0x7e000000) == 0x34000000 or
+ band(op, 0x3b000000) == 0x18000000 then
+ return 0x800 -- B.cond, CBZ, CBNZ, LDR* literal
+ elseif band(op, 0x7e000000) == 0x36000000 then return 0x1000 -- TBZ, TBNZ
+ elseif band(op, 0x9f000000) == 0x10000000 then return 0x2000 -- ADR
+ elseif band(op, 0x9f000000) == band(0x90000000) then return 0x3000 -- ADRP
+ else
+ assert(false, "unknown branch type")
+ end
+end
+
+------------------------------------------------------------------------------
+
+local map_op, op_template
+
+local function op_alias(opname, f)
+ return function(params, nparams)
+ if not params then return "-> "..opname:sub(1, -3) end
+ f(params, nparams)
+ op_template(params, map_op[opname], nparams)
+ end
+end
+
+local function alias_bfx(p)
+ p[4] = "#("..p[3]:sub(2)..")+("..p[4]:sub(2)..")-1"
+end
+
+local function alias_bfiz(p)
+ parse_reg(p[1])
+ if parse_reg_type == "w" then
+ p[3] = "#-("..p[3]:sub(2)..")%32"
+ p[4] = "#("..p[4]:sub(2)..")-1"
+ else
+ p[3] = "#-("..p[3]:sub(2)..")%64"
+ p[4] = "#("..p[4]:sub(2)..")-1"
+ end
+end
+
+local alias_lslimm = op_alias("ubfm_4", function(p)
+ parse_reg(p[1])
+ local sh = p[3]:sub(2)
+ if parse_reg_type == "w" then
+ p[3] = "#-("..sh..")%32"
+ p[4] = "#31-("..sh..")"
+ else
+ p[3] = "#-("..sh..")%64"
+ p[4] = "#63-("..sh..")"
+ end
+end)
+
+-- Template strings for ARM instructions.
+map_op = {
+ -- Basic data processing instructions.
+ add_3 = "0b000000DNMg|11000000pDpNIg|8b206000pDpNMx",
+ add_4 = "0b000000DNMSg|0b200000DNMXg|8b200000pDpNMXx|8b200000pDpNxMwX",
+ adds_3 = "2b000000DNMg|31000000DpNIg|ab206000DpNMx",
+ adds_4 = "2b000000DNMSg|2b200000DNMXg|ab200000DpNMXx|ab200000DpNxMwX",
+ cmn_2 = "2b00001fNMg|3100001fpNIg|ab20601fpNMx",
+ cmn_3 = "2b00001fNMSg|2b20001fNMXg|ab20001fpNMXx|ab20001fpNxMwX",
+
+ sub_3 = "4b000000DNMg|51000000pDpNIg|cb206000pDpNMx",
+ sub_4 = "4b000000DNMSg|4b200000DNMXg|cb200000pDpNMXx|cb200000pDpNxMwX",
+ subs_3 = "6b000000DNMg|71000000DpNIg|eb206000DpNMx",
+ subs_4 = "6b000000DNMSg|6b200000DNMXg|eb200000DpNMXx|eb200000DpNxMwX",
+ cmp_2 = "6b00001fNMg|7100001fpNIg|eb20601fpNMx",
+ cmp_3 = "6b00001fNMSg|6b20001fNMXg|eb20001fpNMXx|eb20001fpNxMwX",
+
+ neg_2 = "4b0003e0DMg",
+ neg_3 = "4b0003e0DMSg",
+ negs_2 = "6b0003e0DMg",
+ negs_3 = "6b0003e0DMSg",
+
+ adc_3 = "1a000000DNMg",
+ adcs_3 = "3a000000DNMg",
+ sbc_3 = "5a000000DNMg",
+ sbcs_3 = "7a000000DNMg",
+ ngc_2 = "5a0003e0DMg",
+ ngcs_2 = "7a0003e0DMg",
+
+ and_3 = "0a000000DNMg|12000000pDNig",
+ and_4 = "0a000000DNMSg",
+ orr_3 = "2a000000DNMg|32000000pDNig",
+ orr_4 = "2a000000DNMSg",
+ eor_3 = "4a000000DNMg|52000000pDNig",
+ eor_4 = "4a000000DNMSg",
+ ands_3 = "6a000000DNMg|72000000DNig",
+ ands_4 = "6a000000DNMSg",
+ tst_2 = "6a00001fNMg|7200001fNig",
+ tst_3 = "6a00001fNMSg",
+
+ bic_3 = "0a200000DNMg",
+ bic_4 = "0a200000DNMSg",
+ orn_3 = "2a200000DNMg",
+ orn_4 = "2a200000DNMSg",
+ eon_3 = "4a200000DNMg",
+ eon_4 = "4a200000DNMSg",
+ bics_3 = "6a200000DNMg",
+ bics_4 = "6a200000DNMSg",
+
+ movn_2 = "12800000DWg",
+ movn_3 = "12800000DWRg",
+ movz_2 = "52800000DWg",
+ movz_3 = "52800000DWRg",
+ movk_2 = "72800000DWg",
+ movk_3 = "72800000DWRg",
+
+ -- TODO: this doesn't cover all valid immediates for mov reg, #imm.
+ mov_2 = "2a0003e0DMg|52800000DW|320003e0pDig|11000000pDpNg",
+ mov_3 = "2a0003e0DMSg",
+ mvn_2 = "2a2003e0DMg",
+ mvn_3 = "2a2003e0DMSg",
+
+ adr_2 = "10000000DBx",
+ adrp_2 = "90000000DBx",
+
+ csel_4 = "1a800000DNMCg",
+ csinc_4 = "1a800400DNMCg",
+ csinv_4 = "5a800000DNMCg",
+ csneg_4 = "5a800400DNMCg",
+ cset_2 = "1a9f07e0Dcg",
+ csetm_2 = "5a9f03e0Dcg",
+ cinc_3 = "1a800400DNmcg",
+ cinv_3 = "5a800000DNmcg",
+ cneg_3 = "5a800400DNmcg",
+
+ ccmn_4 = "3a400000NMVCg|3a400800N5VCg",
+ ccmp_4 = "7a400000NMVCg|7a400800N5VCg",
+
+ madd_4 = "1b000000DNMAg",
+ msub_4 = "1b008000DNMAg",
+ mul_3 = "1b007c00DNMg",
+ mneg_3 = "1b00fc00DNMg",
+
+ smaddl_4 = "9b200000DxNMwAx",
+ smsubl_4 = "9b208000DxNMwAx",
+ smull_3 = "9b207c00DxNMw",
+ smnegl_3 = "9b20fc00DxNMw",
+ smulh_3 = "9b407c00DNMx",
+ umaddl_4 = "9ba00000DxNMwAx",
+ umsubl_4 = "9ba08000DxNMwAx",
+ umull_3 = "9ba07c00DxNMw",
+ umnegl_3 = "9ba0fc00DxNMw",
+ umulh_3 = "9bc07c00DNMx",
+
+ udiv_3 = "1ac00800DNMg",
+ sdiv_3 = "1ac00c00DNMg",
+
+ -- Bit operations.
+ sbfm_4 = "13000000DN12w|93400000DN12x",
+ bfm_4 = "33000000DN12w|b3400000DN12x",
+ ubfm_4 = "53000000DN12w|d3400000DN12x",
+ extr_4 = "13800000DNM2w|93c00000DNM2x",
+
+ sxtb_2 = "13001c00DNw|93401c00DNx",
+ sxth_2 = "13003c00DNw|93403c00DNx",
+ sxtw_2 = "93407c00DxNw",
+ uxtb_2 = "53001c00DNw",
+ uxth_2 = "53003c00DNw",
+
+ sbfx_4 = op_alias("sbfm_4", alias_bfx),
+ bfxil_4 = op_alias("bfm_4", alias_bfx),
+ ubfx_4 = op_alias("ubfm_4", alias_bfx),
+ sbfiz_4 = op_alias("sbfm_4", alias_bfiz),
+ bfi_4 = op_alias("bfm_4", alias_bfiz),
+ ubfiz_4 = op_alias("ubfm_4", alias_bfiz),
+
+ lsl_3 = function(params, nparams)
+ if params and params[3]:byte() == 35 then
+ return alias_lslimm(params, nparams)
+ else
+ return op_template(params, "1ac02000DNMg", nparams)
+ end
+ end,
+ lsr_3 = "1ac02400DNMg|53007c00DN1w|d340fc00DN1x",
+ asr_3 = "1ac02800DNMg|13007c00DN1w|9340fc00DN1x",
+ ror_3 = "1ac02c00DNMg|13800000DNm2w|93c00000DNm2x",
+
+ clz_2 = "5ac01000DNg",
+ cls_2 = "5ac01400DNg",
+ rbit_2 = "5ac00000DNg",
+ rev_2 = "5ac00800DNw|dac00c00DNx",
+ rev16_2 = "5ac00400DNg",
+ rev32_2 = "dac00800DNx",
+
+ -- Loads and stores.
+ ["strb_*"] = "38000000DwL",
+ ["ldrb_*"] = "38400000DwL",
+ ["ldrsb_*"] = "38c00000DwL|38800000DxL",
+ ["strh_*"] = "78000000DwL",
+ ["ldrh_*"] = "78400000DwL",
+ ["ldrsh_*"] = "78c00000DwL|78800000DxL",
+ ["str_*"] = "b8000000DwL|f8000000DxL|bc000000DsL|fc000000DdL",
+ ["ldr_*"] = "18000000DwB|58000000DxB|1c000000DsB|5c000000DdB|b8400000DwL|f8400000DxL|bc400000DsL|fc400000DdL",
+ ["ldrsw_*"] = "98000000DxB|b8800000DxL",
+ -- NOTE: ldur etc. are handled by ldr et al.
+
+ ["stp_*"] = "28000000DAwP|a8000000DAxP|2c000000DAsP|6c000000DAdP",
+ ["ldp_*"] = "28400000DAwP|a8400000DAxP|2c400000DAsP|6c400000DAdP",
+ ["ldpsw_*"] = "68400000DAxP",
+
+ -- Branches.
+ b_1 = "14000000B",
+ bl_1 = "94000000B",
+ blr_1 = "d63f0000Nx",
+ br_1 = "d61f0000Nx",
+ ret_0 = "d65f03c0",
+ ret_1 = "d65f0000Nx",
+ -- b.cond is added below.
+ cbz_2 = "34000000DBg",
+ cbnz_2 = "35000000DBg",
+ tbz_3 = "36000000DTBw|36000000DTBx",
+ tbnz_3 = "37000000DTBw|37000000DTBx",
+
+ -- Miscellaneous instructions.
+ -- TODO: hlt, hvc, smc, svc, eret, dcps[123], drps, mrs, msr
+ -- TODO: sys, sysl, ic, dc, at, tlbi
+ -- TODO: hint, yield, wfe, wfi, sev, sevl
+ -- TODO: clrex, dsb, dmb, isb
+ nop_0 = "d503201f",
+ brk_0 = "d4200000",
+ brk_1 = "d4200000W",
+
+ -- Floating point instructions.
+ fmov_2 = "1e204000DNf|1e260000DwNs|1e270000DsNw|9e660000DxNd|9e670000DdNx|1e201000DFf",
+ fabs_2 = "1e20c000DNf",
+ fneg_2 = "1e214000DNf",
+ fsqrt_2 = "1e21c000DNf",
+
+ fcvt_2 = "1e22c000DdNs|1e624000DsNd",
+
+ -- TODO: half-precision and fixed-point conversions.
+ fcvtas_2 = "1e240000DwNs|9e240000DxNs|1e640000DwNd|9e640000DxNd",
+ fcvtau_2 = "1e250000DwNs|9e250000DxNs|1e650000DwNd|9e650000DxNd",
+ fcvtms_2 = "1e300000DwNs|9e300000DxNs|1e700000DwNd|9e700000DxNd",
+ fcvtmu_2 = "1e310000DwNs|9e310000DxNs|1e710000DwNd|9e710000DxNd",
+ fcvtns_2 = "1e200000DwNs|9e200000DxNs|1e600000DwNd|9e600000DxNd",
+ fcvtnu_2 = "1e210000DwNs|9e210000DxNs|1e610000DwNd|9e610000DxNd",
+ fcvtps_2 = "1e280000DwNs|9e280000DxNs|1e680000DwNd|9e680000DxNd",
+ fcvtpu_2 = "1e290000DwNs|9e290000DxNs|1e690000DwNd|9e690000DxNd",
+ fcvtzs_2 = "1e380000DwNs|9e380000DxNs|1e780000DwNd|9e780000DxNd",
+ fcvtzu_2 = "1e390000DwNs|9e390000DxNs|1e790000DwNd|9e790000DxNd",
+
+ scvtf_2 = "1e220000DsNw|9e220000DsNx|1e620000DdNw|9e620000DdNx",
+ ucvtf_2 = "1e230000DsNw|9e230000DsNx|1e630000DdNw|9e630000DdNx",
+
+ frintn_2 = "1e244000DNf",
+ frintp_2 = "1e24c000DNf",
+ frintm_2 = "1e254000DNf",
+ frintz_2 = "1e25c000DNf",
+ frinta_2 = "1e264000DNf",
+ frintx_2 = "1e274000DNf",
+ frinti_2 = "1e27c000DNf",
+
+ fadd_3 = "1e202800DNMf",
+ fsub_3 = "1e203800DNMf",
+ fmul_3 = "1e200800DNMf",
+ fnmul_3 = "1e208800DNMf",
+ fdiv_3 = "1e201800DNMf",
+
+ fmadd_4 = "1f000000DNMAf",
+ fmsub_4 = "1f008000DNMAf",
+ fnmadd_4 = "1f200000DNMAf",
+ fnmsub_4 = "1f208000DNMAf",
+
+ fmax_3 = "1e204800DNMf",
+ fmaxnm_3 = "1e206800DNMf",
+ fmin_3 = "1e205800DNMf",
+ fminnm_3 = "1e207800DNMf",
+
+ fcmp_2 = "1e202000NMf|1e202008NZf",
+ fcmpe_2 = "1e202010NMf|1e202018NZf",
+
+ fccmp_4 = "1e200400NMVCf",
+ fccmpe_4 = "1e200410NMVCf",
+
+ fcsel_4 = "1e200c00DNMCf",
+
+ -- TODO: crc32*, aes*, sha*, pmull
+ -- TODO: SIMD instructions.
+}
+
+for cond,c in pairs(map_cond) do
+ map_op["b"..cond.."_1"] = tohex(0x54000000+c).."B"
+end
+
+------------------------------------------------------------------------------
+
+-- Handle opcodes defined with template strings.
+local function parse_template(params, template, nparams, pos)
+ local op = tonumber(sub(template, 1, 8), 16)
+ local n = 1
+ local rtt = {}
+
+ parse_reg_type = false
+
+ -- Process each character.
+ for p in gmatch(sub(template, 9), ".") do
+ local q = params[n]
+ if p == "D" then
+ op = op + parse_reg(q); n = n + 1
+ elseif p == "N" then
+ op = op + shl(parse_reg(q), 5); n = n + 1
+ elseif p == "M" then
+ op = op + shl(parse_reg(q), 16); n = n + 1
+ elseif p == "A" then
+ op = op + shl(parse_reg(q), 10); n = n + 1
+ elseif p == "m" then
+ op = op + shl(parse_reg(params[n-1]), 16)
+
+ elseif p == "p" then
+ if q == "sp" then params[n] = "@x31" end
+ elseif p == "g" then
+ if parse_reg_type == "x" then
+ op = op + 0x80000000
+ elseif parse_reg_type ~= "w" then
+ werror("bad register type")
+ end
+ parse_reg_type = false
+ elseif p == "f" then
+ if parse_reg_type == "d" then
+ op = op + 0x00400000
+ elseif parse_reg_type ~= "s" then
+ werror("bad register type")
+ end
+ parse_reg_type = false
+ elseif p == "x" or p == "w" or p == "d" or p == "s" then
+ if parse_reg_type ~= p then
+ werror("register size mismatch")
+ end
+ parse_reg_type = false
+
+ elseif p == "L" then
+ op = parse_load(params, nparams, n, op)
+ elseif p == "P" then
+ op = parse_load_pair(params, nparams, n, op)
+
+ elseif p == "B" then
+ local mode, v, s = parse_label(q, false); n = n + 1
+ local m = branch_type(op)
+ waction("REL_"..mode, v+m, s, 1)
+
+ elseif p == "I" then
+ op = op + parse_imm12(q); n = n + 1
+ elseif p == "i" then
+ op = op + parse_imm13(q); n = n + 1
+ elseif p == "W" then
+ op = op + parse_imm(q, 16, 5, 0, false); n = n + 1
+ elseif p == "T" then
+ op = op + parse_imm6(q); n = n + 1
+ elseif p == "1" then
+ op = op + parse_imm(q, 6, 16, 0, false); n = n + 1
+ elseif p == "2" then
+ op = op + parse_imm(q, 6, 10, 0, false); n = n + 1
+ elseif p == "5" then
+ op = op + parse_imm(q, 5, 16, 0, false); n = n + 1
+ elseif p == "V" then
+ op = op + parse_imm(q, 4, 0, 0, false); n = n + 1
+ elseif p == "F" then
+ op = op + parse_fpimm(q); n = n + 1
+ elseif p == "Z" then
+ if q ~= "#0" and q ~= "#0.0" then werror("expected zero immediate") end
+ n = n + 1
+
+ elseif p == "S" then
+ op = op + parse_shift(q); n = n + 1
+ elseif p == "X" then
+ op = op + parse_extend(q); n = n + 1
+ elseif p == "R" then
+ op = op + parse_lslx16(q); n = n + 1
+ elseif p == "C" then
+ op = op + parse_cond(q, 0); n = n + 1
+ elseif p == "c" then
+ op = op + parse_cond(q, 1); n = n + 1
+
+ else
+ assert(false)
+ end
+ end
+ wputpos(pos, op)
+end
+
+function op_template(params, template, nparams)
+ if not params then return template:gsub("%x%x%x%x%x%x%x%x", "") end
+
+ -- Limit number of section buffer positions used by a single dasm_put().
+ -- A single opcode needs a maximum of 3 positions.
+ if secpos+3 > maxsecpos then wflush() end
+ local pos = wpos()
+ local lpos, apos, spos = #actlist, #actargs, secpos
+
+ local ok, err
+ for t in gmatch(template, "[^|]+") do
+ ok, err = pcall(parse_template, params, t, nparams, pos)
+ if ok then return end
+ secpos = spos
+ actlist[lpos+1] = nil
+ actlist[lpos+2] = nil
+ actlist[lpos+3] = nil
+ actargs[apos+1] = nil
+ actargs[apos+2] = nil
+ actargs[apos+3] = nil
+ end
+ error(err, 0)
+end
+
+map_op[".template__"] = op_template
+
+------------------------------------------------------------------------------
+
+-- Pseudo-opcode to mark the position where the action list is to be emitted.
+map_op[".actionlist_1"] = function(params)
+ if not params then return "cvar" end
+ local name = params[1] -- No syntax check. You get to keep the pieces.
+ wline(function(out) writeactions(out, name) end)
+end
+
+-- Pseudo-opcode to mark the position where the global enum is to be emitted.
+map_op[".globals_1"] = function(params)
+ if not params then return "prefix" end
+ local prefix = params[1] -- No syntax check. You get to keep the pieces.
+ wline(function(out) writeglobals(out, prefix) end)
+end
+
+-- Pseudo-opcode to mark the position where the global names are to be emitted.
+map_op[".globalnames_1"] = function(params)
+ if not params then return "cvar" end
+ local name = params[1] -- No syntax check. You get to keep the pieces.
+ wline(function(out) writeglobalnames(out, name) end)
+end
+
+-- Pseudo-opcode to mark the position where the extern names are to be emitted.
+map_op[".externnames_1"] = function(params)
+ if not params then return "cvar" end
+ local name = params[1] -- No syntax check. You get to keep the pieces.
+ wline(function(out) writeexternnames(out, name) end)
+end
+
+------------------------------------------------------------------------------
+
+-- Label pseudo-opcode (converted from trailing colon form).
+map_op[".label_1"] = function(params)
+ if not params then return "[1-9] | ->global | =>pcexpr" end
+ if secpos+1 > maxsecpos then wflush() end
+ local mode, n, s = parse_label(params[1], true)
+ if mode == "EXT" then werror("bad label definition") end
+ waction("LABEL_"..mode, n, s, 1)
+end
+
+------------------------------------------------------------------------------
+
+-- Pseudo-opcodes for data storage.
+map_op[".long_*"] = function(params)
+ if not params then return "imm..." end
+ for _,p in ipairs(params) do
+ local n = tonumber(p)
+ if not n then werror("bad immediate `"..p.."'") end
+ if n < 0 then n = n + 2^32 end
+ wputw(n)
+ if secpos+2 > maxsecpos then wflush() end
+ end
+end
+
+-- Alignment pseudo-opcode.
+map_op[".align_1"] = function(params)
+ if not params then return "numpow2" end
+ if secpos+1 > maxsecpos then wflush() end
+ local align = tonumber(params[1])
+ if align then
+ local x = align
+ -- Must be a power of 2 in the range (2 ... 256).
+ for i=1,8 do
+ x = x / 2
+ if x == 1 then
+ waction("ALIGN", align-1, nil, 1) -- Action byte is 2**n-1.
+ return
+ end
+ end
+ end
+ werror("bad alignment")
+end
+
+------------------------------------------------------------------------------
+
+-- Pseudo-opcode for (primitive) type definitions (map to C types).
+map_op[".type_3"] = function(params, nparams)
+ if not params then
+ return nparams == 2 and "name, ctype" or "name, ctype, reg"
+ end
+ local name, ctype, reg = params[1], params[2], params[3]
+ if not match(name, "^[%a_][%w_]*$") then
+ werror("bad type name `"..name.."'")
+ end
+ local tp = map_type[name]
+ if tp then
+ werror("duplicate type `"..name.."'")
+ end
+ -- Add #type to defines. A bit unclean to put it in map_archdef.
+ map_archdef["#"..name] = "sizeof("..ctype..")"
+ -- Add new type and emit shortcut define.
+ local num = ctypenum + 1
+ map_type[name] = {
+ ctype = ctype,
+ ctypefmt = format("Dt%X(%%s)", num),
+ reg = reg,
+ }
+ wline(format("#define Dt%X(_V) (int)(ptrdiff_t)&(((%s *)0)_V)", num, ctype))
+ ctypenum = num
+end
+map_op[".type_2"] = map_op[".type_3"]
+
+-- Dump type definitions.
+local function dumptypes(out, lvl)
+ local t = {}
+ for name in pairs(map_type) do t[#t+1] = name end
+ sort(t)
+ out:write("Type definitions:\n")
+ for _,name in ipairs(t) do
+ local tp = map_type[name]
+ local reg = tp.reg or ""
+ out:write(format(" %-20s %-20s %s\n", name, tp.ctype, reg))
+ end
+ out:write("\n")
+end
+
+------------------------------------------------------------------------------
+
+-- Set the current section.
+function _M.section(num)
+ waction("SECTION", num)
+ wflush(true) -- SECTION is a terminal action.
+end
+
+------------------------------------------------------------------------------
+
+-- Dump architecture description.
+function _M.dumparch(out)
+ out:write(format("DynASM %s version %s, released %s\n\n",
+ _info.arch, _info.version, _info.release))
+ dumpactions(out)
+end
+
+-- Dump all user defined elements.
+function _M.dumpdef(out, lvl)
+ dumptypes(out, lvl)
+ dumpglobals(out, lvl)
+ dumpexterns(out, lvl)
+end
+
+------------------------------------------------------------------------------
+
+-- Pass callbacks from/to the DynASM core.
+function _M.passcb(wl, we, wf, ww)
+ wline, werror, wfatal, wwarn = wl, we, wf, ww
+ return wflush
+end
+
+-- Setup the arch-specific module.
+function _M.setup(arch, opt)
+ g_arch, g_opt = arch, opt
+end
+
+-- Merge the core maps and the arch-specific maps.
+function _M.mergemaps(map_coreop, map_def)
+ setmetatable(map_op, { __index = map_coreop })
+ setmetatable(map_def, { __index = map_archdef })
+ return map_op, map_def
+end
+
+return _M
+
+------------------------------------------------------------------------------
+
diff --git a/ext/opcache/jit/dynasm/dasm_mips.h b/ext/opcache/jit/dynasm/dasm_mips.h
new file mode 100644
index 0000000000..f3b43211de
--- /dev/null
+++ b/ext/opcache/jit/dynasm/dasm_mips.h
@@ -0,0 +1,419 @@
+/*
+** DynASM MIPS encoding engine.
+** Copyright (C) 2005-2016 Mike Pall. All rights reserved.
+** Released under the MIT license. See dynasm.lua for full copyright notice.
+*/
+
+#include <stddef.h>
+#include <stdarg.h>
+#include <string.h>
+#include <stdlib.h>
+
+#define DASM_ARCH "mips"
+
+#ifndef DASM_EXTERN
+#define DASM_EXTERN(a,b,c,d) 0
+#endif
+
+/* Action definitions. */
+enum {
+ DASM_STOP, DASM_SECTION, DASM_ESC, DASM_REL_EXT,
+ /* The following actions need a buffer position. */
+ DASM_ALIGN, DASM_REL_LG, DASM_LABEL_LG,
+ /* The following actions also have an argument. */
+ DASM_REL_PC, DASM_LABEL_PC, DASM_IMM, DASM_IMMS,
+ DASM__MAX
+};
+
+/* Maximum number of section buffer positions for a single dasm_put() call. */
+#define DASM_MAXSECPOS 25
+
+/* DynASM encoder status codes. Action list offset or number are or'ed in. */
+#define DASM_S_OK 0x00000000
+#define DASM_S_NOMEM 0x01000000
+#define DASM_S_PHASE 0x02000000
+#define DASM_S_MATCH_SEC 0x03000000
+#define DASM_S_RANGE_I 0x11000000
+#define DASM_S_RANGE_SEC 0x12000000
+#define DASM_S_RANGE_LG 0x13000000
+#define DASM_S_RANGE_PC 0x14000000
+#define DASM_S_RANGE_REL 0x15000000
+#define DASM_S_UNDEF_LG 0x21000000
+#define DASM_S_UNDEF_PC 0x22000000
+
+/* Macros to convert positions (8 bit section + 24 bit index). */
+#define DASM_POS2IDX(pos) ((pos)&0x00ffffff)
+#define DASM_POS2BIAS(pos) ((pos)&0xff000000)
+#define DASM_SEC2POS(sec) ((sec)<<24)
+#define DASM_POS2SEC(pos) ((pos)>>24)
+#define DASM_POS2PTR(D, pos) (D->sections[DASM_POS2SEC(pos)].rbuf + (pos))
+
+/* Action list type. */
+typedef const unsigned int *dasm_ActList;
+
+/* Per-section structure. */
+typedef struct dasm_Section {
+ int *rbuf; /* Biased buffer pointer (negative section bias). */
+ int *buf; /* True buffer pointer. */
+ size_t bsize; /* Buffer size in bytes. */
+ int pos; /* Biased buffer position. */
+ int epos; /* End of biased buffer position - max single put. */
+ int ofs; /* Byte offset into section. */
+} dasm_Section;
+
+/* Core structure holding the DynASM encoding state. */
+struct dasm_State {
+ size_t psize; /* Allocated size of this structure. */
+ dasm_ActList actionlist; /* Current actionlist pointer. */
+ int *lglabels; /* Local/global chain/pos ptrs. */
+ size_t lgsize;
+ int *pclabels; /* PC label chains/pos ptrs. */
+ size_t pcsize;
+ void **globals; /* Array of globals (bias -10). */
+ dasm_Section *section; /* Pointer to active section. */
+ size_t codesize; /* Total size of all code sections. */
+ int maxsection; /* 0 <= sectionidx < maxsection. */
+ int status; /* Status code. */
+ dasm_Section sections[1]; /* All sections. Alloc-extended. */
+};
+
+/* The size of the core structure depends on the max. number of sections. */
+#define DASM_PSZ(ms) (sizeof(dasm_State)+(ms-1)*sizeof(dasm_Section))
+
+
+/* Initialize DynASM state. */
+void dasm_init(Dst_DECL, int maxsection)
+{
+ dasm_State *D;
+ size_t psz = 0;
+ int i;
+ Dst_REF = NULL;
+ DASM_M_GROW(Dst, struct dasm_State, Dst_REF, psz, DASM_PSZ(maxsection));
+ D = Dst_REF;
+ D->psize = psz;
+ D->lglabels = NULL;
+ D->lgsize = 0;
+ D->pclabels = NULL;
+ D->pcsize = 0;
+ D->globals = NULL;
+ D->maxsection = maxsection;
+ for (i = 0; i < maxsection; i++) {
+ D->sections[i].buf = NULL; /* Need this for pass3. */
+ D->sections[i].rbuf = D->sections[i].buf - DASM_SEC2POS(i);
+ D->sections[i].bsize = 0;
+ D->sections[i].epos = 0; /* Wrong, but is recalculated after resize. */
+ }
+}
+
+/* Free DynASM state. */
+void dasm_free(Dst_DECL)
+{
+ dasm_State *D = Dst_REF;
+ int i;
+ for (i = 0; i < D->maxsection; i++)
+ if (D->sections[i].buf)
+ DASM_M_FREE(Dst, D->sections[i].buf, D->sections[i].bsize);
+ if (D->pclabels) DASM_M_FREE(Dst, D->pclabels, D->pcsize);
+ if (D->lglabels) DASM_M_FREE(Dst, D->lglabels, D->lgsize);
+ DASM_M_FREE(Dst, D, D->psize);
+}
+
+/* Setup global label array. Must be called before dasm_setup(). */
+void dasm_setupglobal(Dst_DECL, void **gl, unsigned int maxgl)
+{
+ dasm_State *D = Dst_REF;
+ D->globals = gl - 10; /* Negative bias to compensate for locals. */
+ DASM_M_GROW(Dst, int, D->lglabels, D->lgsize, (10+maxgl)*sizeof(int));
+}
+
+/* Grow PC label array. Can be called after dasm_setup(), too. */
+void dasm_growpc(Dst_DECL, unsigned int maxpc)
+{
+ dasm_State *D = Dst_REF;
+ size_t osz = D->pcsize;
+ DASM_M_GROW(Dst, int, D->pclabels, D->pcsize, maxpc*sizeof(int));
+ memset((void *)(((unsigned char *)D->pclabels)+osz), 0, D->pcsize-osz);
+}
+
+/* Setup encoder. */
+void dasm_setup(Dst_DECL, const void *actionlist)
+{
+ dasm_State *D = Dst_REF;
+ int i;
+ D->actionlist = (dasm_ActList)actionlist;
+ D->status = DASM_S_OK;
+ D->section = &D->sections[0];
+ memset((void *)D->lglabels, 0, D->lgsize);
+ if (D->pclabels) memset((void *)D->pclabels, 0, D->pcsize);
+ for (i = 0; i < D->maxsection; i++) {
+ D->sections[i].pos = DASM_SEC2POS(i);
+ D->sections[i].ofs = 0;
+ }
+}
+
+
+#ifdef DASM_CHECKS
+#define CK(x, st) \
+ do { if (!(x)) { \
+ D->status = DASM_S_##st|(p-D->actionlist-1); return; } } while (0)
+#define CKPL(kind, st) \
+ do { if ((size_t)((char *)pl-(char *)D->kind##labels) >= D->kind##size) { \
+ D->status = DASM_S_RANGE_##st|(p-D->actionlist-1); return; } } while (0)
+#else
+#define CK(x, st) ((void)0)
+#define CKPL(kind, st) ((void)0)
+#endif
+
+/* Pass 1: Store actions and args, link branches/labels, estimate offsets. */
+void dasm_put(Dst_DECL, int start, ...)
+{
+ va_list ap;
+ dasm_State *D = Dst_REF;
+ dasm_ActList p = D->actionlist + start;
+ dasm_Section *sec = D->section;
+ int pos = sec->pos, ofs = sec->ofs;
+ int *b;
+
+ if (pos >= sec->epos) {
+ DASM_M_GROW(Dst, int, sec->buf, sec->bsize,
+ sec->bsize + 2*DASM_MAXSECPOS*sizeof(int));
+ sec->rbuf = sec->buf - DASM_POS2BIAS(pos);
+ sec->epos = (int)sec->bsize/sizeof(int) - DASM_MAXSECPOS+DASM_POS2BIAS(pos);
+ }
+
+ b = sec->rbuf;
+ b[pos++] = start;
+
+ va_start(ap, start);
+ while (1) {
+ unsigned int ins = *p++;
+ unsigned int action = (ins >> 16) - 0xff00;
+ if (action >= DASM__MAX) {
+ ofs += 4;
+ } else {
+ int *pl, n = action >= DASM_REL_PC ? va_arg(ap, int) : 0;
+ switch (action) {
+ case DASM_STOP: goto stop;
+ case DASM_SECTION:
+ n = (ins & 255); CK(n < D->maxsection, RANGE_SEC);
+ D->section = &D->sections[n]; goto stop;
+ case DASM_ESC: p++; ofs += 4; break;
+ case DASM_REL_EXT: break;
+ case DASM_ALIGN: ofs += (ins & 255); b[pos++] = ofs; break;
+ case DASM_REL_LG:
+ n = (ins & 2047) - 10; pl = D->lglabels + n;
+ /* Bkwd rel or global. */
+ if (n >= 0) { CK(n>=10||*pl<0, RANGE_LG); CKPL(lg, LG); goto putrel; }
+ pl += 10; n = *pl;
+ if (n < 0) n = 0; /* Start new chain for fwd rel if label exists. */
+ goto linkrel;
+ case DASM_REL_PC:
+ pl = D->pclabels + n; CKPL(pc, PC);
+ putrel:
+ n = *pl;
+ if (n < 0) { /* Label exists. Get label pos and store it. */
+ b[pos] = -n;
+ } else {
+ linkrel:
+ b[pos] = n; /* Else link to rel chain, anchored at label. */
+ *pl = pos;
+ }
+ pos++;
+ break;
+ case DASM_LABEL_LG:
+ pl = D->lglabels + (ins & 2047) - 10; CKPL(lg, LG); goto putlabel;
+ case DASM_LABEL_PC:
+ pl = D->pclabels + n; CKPL(pc, PC);
+ putlabel:
+ n = *pl; /* n > 0: Collapse rel chain and replace with label pos. */
+ while (n > 0) { int *pb = DASM_POS2PTR(D, n); n = *pb; *pb = pos;
+ }
+ *pl = -pos; /* Label exists now. */
+ b[pos++] = ofs; /* Store pass1 offset estimate. */
+ break;
+ case DASM_IMM: case DASM_IMMS:
+#ifdef DASM_CHECKS
+ CK((n & ((1<<((ins>>10)&31))-1)) == 0, RANGE_I);
+#endif
+ n >>= ((ins>>10)&31);
+#ifdef DASM_CHECKS
+ if (ins & 0x8000)
+ CK(((n + (1<<(((ins>>5)&31)-1)))>>((ins>>5)&31)) == 0, RANGE_I);
+ else
+ CK((n>>((ins>>5)&31)) == 0, RANGE_I);
+#endif
+ b[pos++] = n;
+ break;
+ }
+ }
+ }
+stop:
+ va_end(ap);
+ sec->pos = pos;
+ sec->ofs = ofs;
+}
+#undef CK
+
+/* Pass 2: Link sections, shrink aligns, fix label offsets. */
+int dasm_link(Dst_DECL, size_t *szp)
+{
+ dasm_State *D = Dst_REF;
+ int secnum;
+ int ofs = 0;
+
+#ifdef DASM_CHECKS
+ *szp = 0;
+ if (D->status != DASM_S_OK) return D->status;
+ {
+ int pc;
+ for (pc = 0; pc*sizeof(int) < D->pcsize; pc++)
+ if (D->pclabels[pc] > 0) return DASM_S_UNDEF_PC|pc;
+ }
+#endif
+
+ { /* Handle globals not defined in this translation unit. */
+ int idx;
+ for (idx = 20; idx*sizeof(int) < D->lgsize; idx++) {
+ int n = D->lglabels[idx];
+ /* Undefined label: Collapse rel chain and replace with marker (< 0). */
+ while (n > 0) { int *pb = DASM_POS2PTR(D, n); n = *pb; *pb = -idx; }
+ }
+ }
+
+ /* Combine all code sections. No support for data sections (yet). */
+ for (secnum = 0; secnum < D->maxsection; secnum++) {
+ dasm_Section *sec = D->sections + secnum;
+ int *b = sec->rbuf;
+ int pos = DASM_SEC2POS(secnum);
+ int lastpos = sec->pos;
+
+ while (pos != lastpos) {
+ dasm_ActList p = D->actionlist + b[pos++];
+ while (1) {
+ unsigned int ins = *p++;
+ unsigned int action = (ins >> 16) - 0xff00;
+ switch (action) {
+ case DASM_STOP: case DASM_SECTION: goto stop;
+ case DASM_ESC: p++; break;
+ case DASM_REL_EXT: break;
+ case DASM_ALIGN: ofs -= (b[pos++] + ofs) & (ins & 255); break;
+ case DASM_REL_LG: case DASM_REL_PC: pos++; break;
+ case DASM_LABEL_LG: case DASM_LABEL_PC: b[pos++] += ofs; break;
+ case DASM_IMM: case DASM_IMMS: pos++; break;
+ }
+ }
+ stop: (void)0;
+ }
+ ofs += sec->ofs; /* Next section starts right after current section. */
+ }
+
+ D->codesize = ofs; /* Total size of all code sections */
+ *szp = ofs;
+ return DASM_S_OK;
+}
+
+#ifdef DASM_CHECKS
+#define CK(x, st) \
+ do { if (!(x)) return DASM_S_##st|(p-D->actionlist-1); } while (0)
+#else
+#define CK(x, st) ((void)0)
+#endif
+
+/* Pass 3: Encode sections. */
+int dasm_encode(Dst_DECL, void *buffer)
+{
+ dasm_State *D = Dst_REF;
+ char *base = (char *)buffer;
+ unsigned int *cp = (unsigned int *)buffer;
+ int secnum;
+
+ /* Encode all code sections. No support for data sections (yet). */
+ for (secnum = 0; secnum < D->maxsection; secnum++) {
+ dasm_Section *sec = D->sections + secnum;
+ int *b = sec->buf;
+ int *endb = sec->rbuf + sec->pos;
+
+ while (b != endb) {
+ dasm_ActList p = D->actionlist + *b++;
+ while (1) {
+ unsigned int ins = *p++;
+ unsigned int action = (ins >> 16) - 0xff00;
+ int n = (action >= DASM_ALIGN && action < DASM__MAX) ? *b++ : 0;
+ switch (action) {
+ case DASM_STOP: case DASM_SECTION: goto stop;
+ case DASM_ESC: *cp++ = *p++; break;
+ case DASM_REL_EXT:
+ n = DASM_EXTERN(Dst, (unsigned char *)cp, (ins & 2047), 1);
+ goto patchrel;
+ case DASM_ALIGN:
+ ins &= 255; while ((((char *)cp - base) & ins)) *cp++ = 0x60000000;
+ break;
+ case DASM_REL_LG:
+ CK(n >= 0, UNDEF_LG);
+ case DASM_REL_PC:
+ CK(n >= 0, UNDEF_PC);
+ n = *DASM_POS2PTR(D, n);
+ if (ins & 2048)
+ n = n - (int)((char *)cp - base);
+ else
+ n = (n + (int)(size_t)base) & 0x0fffffff;
+ patchrel:
+ CK((n & 3) == 0 &&
+ ((n + ((ins & 2048) ? 0x00020000 : 0)) >>
+ ((ins & 2048) ? 18 : 28)) == 0, RANGE_REL);
+ cp[-1] |= ((n>>2) & ((ins & 2048) ? 0x0000ffff: 0x03ffffff));
+ break;
+ case DASM_LABEL_LG:
+ ins &= 2047; if (ins >= 20) D->globals[ins-10] = (void *)(base + n);
+ break;
+ case DASM_LABEL_PC: break;
+ case DASM_IMMS:
+ cp[-1] |= ((n>>3) & 4); n &= 0x1f;
+ /* fallthrough */
+ case DASM_IMM:
+ cp[-1] |= (n & ((1<<((ins>>5)&31))-1)) << (ins&31);
+ break;
+ default: *cp++ = ins; break;
+ }
+ }
+ stop: (void)0;
+ }
+ }
+
+ if (base + D->codesize != (char *)cp) /* Check for phase errors. */
+ return DASM_S_PHASE;
+ return DASM_S_OK;
+}
+#undef CK
+
+/* Get PC label offset. */
+int dasm_getpclabel(Dst_DECL, unsigned int pc)
+{
+ dasm_State *D = Dst_REF;
+ if (pc*sizeof(int) < D->pcsize) {
+ int pos = D->pclabels[pc];
+ if (pos < 0) return *DASM_POS2PTR(D, -pos);
+ if (pos > 0) return -1; /* Undefined. */
+ }
+ return -2; /* Unused or out of range. */
+}
+
+#ifdef DASM_CHECKS
+/* Optional sanity checker to call between isolated encoding steps. */
+int dasm_checkstep(Dst_DECL, int secmatch)
+{
+ dasm_State *D = Dst_REF;
+ if (D->status == DASM_S_OK) {
+ int i;
+ for (i = 1; i <= 9; i++) {
+ if (D->lglabels[i] > 0) { D->status = DASM_S_UNDEF_LG|i; break; }
+ D->lglabels[i] = 0;
+ }
+ }
+ if (D->status == DASM_S_OK && secmatch >= 0 &&
+ D->section != &D->sections[secmatch])
+ D->status = DASM_S_MATCH_SEC|(D->section-D->sections);
+ return D->status;
+}
+#endif
+
diff --git a/ext/opcache/jit/dynasm/dasm_mips.lua b/ext/opcache/jit/dynasm/dasm_mips.lua
new file mode 100644
index 0000000000..c8010561db
--- /dev/null
+++ b/ext/opcache/jit/dynasm/dasm_mips.lua
@@ -0,0 +1,1008 @@
+------------------------------------------------------------------------------
+-- DynASM MIPS32/MIPS64 module.
+--
+-- Copyright (C) 2005-2016 Mike Pall. All rights reserved.
+-- See dynasm.lua for full copyright notice.
+------------------------------------------------------------------------------
+
+local mips64 = mips64
+
+-- Module information:
+local _info = {
+ arch = mips64 and "mips64" or "mips",
+ description = "DynASM MIPS32/MIPS64 module",
+ version = "1.4.0",
+ vernum = 10400,
+ release = "2016-05-24",
+ author = "Mike Pall",
+ license = "MIT",
+}
+
+-- Exported glue functions for the arch-specific module.
+local _M = { _info = _info }
+
+-- Cache library functions.
+local type, tonumber, pairs, ipairs = type, tonumber, pairs, ipairs
+local assert, setmetatable = assert, setmetatable
+local _s = string
+local sub, format, byte, char = _s.sub, _s.format, _s.byte, _s.char
+local match, gmatch = _s.match, _s.gmatch
+local concat, sort = table.concat, table.sort
+local bit = bit or require("bit")
+local band, shl, shr, sar = bit.band, bit.lshift, bit.rshift, bit.arshift
+local tohex = bit.tohex
+
+-- Inherited tables and callbacks.
+local g_opt, g_arch
+local wline, werror, wfatal, wwarn
+
+-- Action name list.
+-- CHECK: Keep this in sync with the C code!
+local action_names = {
+ "STOP", "SECTION", "ESC", "REL_EXT",
+ "ALIGN", "REL_LG", "LABEL_LG",
+ "REL_PC", "LABEL_PC", "IMM", "IMMS",
+}
+
+-- Maximum number of section buffer positions for dasm_put().
+-- CHECK: Keep this in sync with the C code!
+local maxsecpos = 25 -- Keep this low, to avoid excessively long C lines.
+
+-- Action name -> action number.
+local map_action = {}
+for n,name in ipairs(action_names) do
+ map_action[name] = n-1
+end
+
+-- Action list buffer.
+local actlist = {}
+
+-- Argument list for next dasm_put(). Start with offset 0 into action list.
+local actargs = { 0 }
+
+-- Current number of section buffer positions for dasm_put().
+local secpos = 1
+
+------------------------------------------------------------------------------
+
+-- Dump action names and numbers.
+local function dumpactions(out)
+ out:write("DynASM encoding engine action codes:\n")
+ for n,name in ipairs(action_names) do
+ local num = map_action[name]
+ out:write(format(" %-10s %02X %d\n", name, num, num))
+ end
+ out:write("\n")
+end
+
+-- Write action list buffer as a huge static C array.
+local function writeactions(out, name)
+ local nn = #actlist
+ if nn == 0 then nn = 1; actlist[0] = map_action.STOP end
+ out:write("static const unsigned int ", name, "[", nn, "] = {\n")
+ for i = 1,nn-1 do
+ assert(out:write("0x", tohex(actlist[i]), ",\n"))
+ end
+ assert(out:write("0x", tohex(actlist[nn]), "\n};\n\n"))
+end
+
+------------------------------------------------------------------------------
+
+-- Add word to action list.
+local function wputxw(n)
+ assert(n >= 0 and n <= 0xffffffff and n % 1 == 0, "word out of range")
+ actlist[#actlist+1] = n
+end
+
+-- Add action to list with optional arg. Advance buffer pos, too.
+local function waction(action, val, a, num)
+ local w = assert(map_action[action], "bad action name `"..action.."'")
+ wputxw(0xff000000 + w * 0x10000 + (val or 0))
+ if a then actargs[#actargs+1] = a end
+ if a or num then secpos = secpos + (num or 1) end
+end
+
+-- Flush action list (intervening C code or buffer pos overflow).
+local function wflush(term)
+ if #actlist == actargs[1] then return end -- Nothing to flush.
+ if not term then waction("STOP") end -- Terminate action list.
+ wline(format("dasm_put(Dst, %s);", concat(actargs, ", ")), true)
+ actargs = { #actlist } -- Actionlist offset is 1st arg to next dasm_put().
+ secpos = 1 -- The actionlist offset occupies a buffer position, too.
+end
+
+-- Put escaped word.
+local function wputw(n)
+ if n >= 0xff000000 then waction("ESC") end
+ wputxw(n)
+end
+
+-- Reserve position for word.
+local function wpos()
+ local pos = #actlist+1
+ actlist[pos] = ""
+ return pos
+end
+
+-- Store word to reserved position.
+local function wputpos(pos, n)
+ assert(n >= 0 and n <= 0xffffffff and n % 1 == 0, "word out of range")
+ actlist[pos] = n
+end
+
+------------------------------------------------------------------------------
+
+-- Global label name -> global label number. With auto assignment on 1st use.
+local next_global = 20
+local map_global = setmetatable({}, { __index = function(t, name)
+ if not match(name, "^[%a_][%w_]*$") then werror("bad global label") end
+ local n = next_global
+ if n > 2047 then werror("too many global labels") end
+ next_global = n + 1
+ t[name] = n
+ return n
+end})
+
+-- Dump global labels.
+local function dumpglobals(out, lvl)
+ local t = {}
+ for name, n in pairs(map_global) do t[n] = name end
+ out:write("Global labels:\n")
+ for i=20,next_global-1 do
+ out:write(format(" %s\n", t[i]))
+ end
+ out:write("\n")
+end
+
+-- Write global label enum.
+local function writeglobals(out, prefix)
+ local t = {}
+ for name, n in pairs(map_global) do t[n] = name end
+ out:write("enum {\n")
+ for i=20,next_global-1 do
+ out:write(" ", prefix, t[i], ",\n")
+ end
+ out:write(" ", prefix, "_MAX\n};\n")
+end
+
+-- Write global label names.
+local function writeglobalnames(out, name)
+ local t = {}
+ for name, n in pairs(map_global) do t[n] = name end
+ out:write("static const char *const ", name, "[] = {\n")
+ for i=20,next_global-1 do
+ out:write(" \"", t[i], "\",\n")
+ end
+ out:write(" (const char *)0\n};\n")
+end
+
+------------------------------------------------------------------------------
+
+-- Extern label name -> extern label number. With auto assignment on 1st use.
+local next_extern = 0
+local map_extern_ = {}
+local map_extern = setmetatable({}, { __index = function(t, name)
+ -- No restrictions on the name for now.
+ local n = next_extern
+ if n > 2047 then werror("too many extern labels") end
+ next_extern = n + 1
+ t[name] = n
+ map_extern_[n] = name
+ return n
+end})
+
+-- Dump extern labels.
+local function dumpexterns(out, lvl)
+ out:write("Extern labels:\n")
+ for i=0,next_extern-1 do
+ out:write(format(" %s\n", map_extern_[i]))
+ end
+ out:write("\n")
+end
+
+-- Write extern label names.
+local function writeexternnames(out, name)
+ out:write("static const char *const ", name, "[] = {\n")
+ for i=0,next_extern-1 do
+ out:write(" \"", map_extern_[i], "\",\n")
+ end
+ out:write(" (const char *)0\n};\n")
+end
+
+------------------------------------------------------------------------------
+
+-- Arch-specific maps.
+local map_archdef = { sp="r29", ra="r31" } -- Ext. register name -> int. name.
+
+local map_type = {} -- Type name -> { ctype, reg }
+local ctypenum = 0 -- Type number (for Dt... macros).
+
+-- Reverse defines for registers.
+function _M.revdef(s)
+ if s == "r29" then return "sp"
+ elseif s == "r31" then return "ra" end
+ return s
+end
+
+------------------------------------------------------------------------------
+
+-- Template strings for MIPS instructions.
+local map_op = {
+ -- First-level opcodes.
+ j_1 = "08000000J",
+ jal_1 = "0c000000J",
+ b_1 = "10000000B",
+ beqz_2 = "10000000SB",
+ beq_3 = "10000000STB",
+ bnez_2 = "14000000SB",
+ bne_3 = "14000000STB",
+ blez_2 = "18000000SB",
+ bgtz_2 = "1c000000SB",
+ addi_3 = "20000000TSI",
+ li_2 = "24000000TI",
+ addiu_3 = "24000000TSI",
+ slti_3 = "28000000TSI",
+ sltiu_3 = "2c000000TSI",
+ andi_3 = "30000000TSU",
+ lu_2 = "34000000TU",
+ ori_3 = "34000000TSU",
+ xori_3 = "38000000TSU",
+ lui_2 = "3c000000TU",
+ beqzl_2 = "50000000SB",
+ beql_3 = "50000000STB",
+ bnezl_2 = "54000000SB",
+ bnel_3 = "54000000STB",
+ blezl_2 = "58000000SB",
+ bgtzl_2 = "5c000000SB",
+ daddi_3 = mips64 and "60000000TSI",
+ daddiu_3 = mips64 and "64000000TSI",
+ ldl_2 = mips64 and "68000000TO",
+ ldr_2 = mips64 and "6c000000TO",
+ lb_2 = "80000000TO",
+ lh_2 = "84000000TO",
+ lwl_2 = "88000000TO",
+ lw_2 = "8c000000TO",
+ lbu_2 = "90000000TO",
+ lhu_2 = "94000000TO",
+ lwr_2 = "98000000TO",
+ lwu_2 = mips64 and "9c000000TO",
+ sb_2 = "a0000000TO",
+ sh_2 = "a4000000TO",
+ swl_2 = "a8000000TO",
+ sw_2 = "ac000000TO",
+ sdl_2 = mips64 and "b0000000TO",
+ sdr_2 = mips64 and "b1000000TO",
+ swr_2 = "b8000000TO",
+ cache_2 = "bc000000NO",
+ ll_2 = "c0000000TO",
+ lwc1_2 = "c4000000HO",
+ pref_2 = "cc000000NO",
+ ldc1_2 = "d4000000HO",
+ ld_2 = mips64 and "dc000000TO",
+ sc_2 = "e0000000TO",
+ swc1_2 = "e4000000HO",
+ scd_2 = mips64 and "f0000000TO",
+ sdc1_2 = "f4000000HO",
+ sd_2 = mips64 and "fc000000TO",
+
+ -- Opcode SPECIAL.
+ nop_0 = "00000000",
+ sll_3 = "00000000DTA",
+ sextw_2 = "00000000DT",
+ movf_2 = "00000001DS",
+ movf_3 = "00000001DSC",
+ movt_2 = "00010001DS",
+ movt_3 = "00010001DSC",
+ srl_3 = "00000002DTA",
+ rotr_3 = "00200002DTA",
+ sra_3 = "00000003DTA",
+ sllv_3 = "00000004DTS",
+ srlv_3 = "00000006DTS",
+ rotrv_3 = "00000046DTS",
+ drotrv_3 = mips64 and "00000056DTS",
+ srav_3 = "00000007DTS",
+ jr_1 = "00000008S",
+ jalr_1 = "0000f809S",
+ jalr_2 = "00000009DS",
+ movz_3 = "0000000aDST",
+ movn_3 = "0000000bDST",
+ syscall_0 = "0000000c",
+ syscall_1 = "0000000cY",
+ break_0 = "0000000d",
+ break_1 = "0000000dY",
+ sync_0 = "0000000f",
+ mfhi_1 = "00000010D",
+ mthi_1 = "00000011S",
+ mflo_1 = "00000012D",
+ mtlo_1 = "00000013S",
+ dsllv_3 = mips64 and "00000014DTS",
+ dsrlv_3 = mips64 and "00000016DTS",
+ dsrav_3 = mips64 and "00000017DTS",
+ mult_2 = "00000018ST",
+ multu_2 = "00000019ST",
+ div_2 = "0000001aST",
+ divu_2 = "0000001bST",
+ dmult_2 = mips64 and "0000001cST",
+ dmultu_2 = mips64 and "0000001dST",
+ ddiv_2 = mips64 and "0000001eST",
+ ddivu_2 = mips64 and "0000001fST",
+ add_3 = "00000020DST",
+ move_2 = mips64 and "00000025DS" or "00000021DS",
+ addu_3 = "00000021DST",
+ sub_3 = "00000022DST",
+ negu_2 = mips64 and "0000002fDT" or "00000023DT",
+ subu_3 = "00000023DST",
+ and_3 = "00000024DST",
+ or_3 = "00000025DST",
+ xor_3 = "00000026DST",
+ not_2 = "00000027DS",
+ nor_3 = "00000027DST",
+ slt_3 = "0000002aDST",
+ sltu_3 = "0000002bDST",
+ dadd_3 = mips64 and "0000002cDST",
+ daddu_3 = mips64 and "0000002dDST",
+ dsub_3 = mips64 and "0000002eDST",
+ dsubu_3 = mips64 and "0000002fDST",
+ tge_2 = "00000030ST",
+ tge_3 = "00000030STZ",
+ tgeu_2 = "00000031ST",
+ tgeu_3 = "00000031STZ",
+ tlt_2 = "00000032ST",
+ tlt_3 = "00000032STZ",
+ tltu_2 = "00000033ST",
+ tltu_3 = "00000033STZ",
+ teq_2 = "00000034ST",
+ teq_3 = "00000034STZ",
+ tne_2 = "00000036ST",
+ tne_3 = "00000036STZ",
+ dsll_3 = mips64 and "00000038DTa",
+ dsrl_3 = mips64 and "0000003aDTa",
+ drotr_3 = mips64 and "0020003aDTa",
+ dsra_3 = mips64 and "0000003bDTa",
+ dsll32_3 = mips64 and "0000003cDTA",
+ dsrl32_3 = mips64 and "0000003eDTA",
+ drotr32_3 = mips64 and "0020003eDTA",
+ dsra32_3 = mips64 and "0000003fDTA",
+
+ -- Opcode REGIMM.
+ bltz_2 = "04000000SB",
+ bgez_2 = "04010000SB",
+ bltzl_2 = "04020000SB",
+ bgezl_2 = "04030000SB",
+ tgei_2 = "04080000SI",
+ tgeiu_2 = "04090000SI",
+ tlti_2 = "040a0000SI",
+ tltiu_2 = "040b0000SI",
+ teqi_2 = "040c0000SI",
+ tnei_2 = "040e0000SI",
+ bltzal_2 = "04100000SB",
+ bal_1 = "04110000B",
+ bgezal_2 = "04110000SB",
+ bltzall_2 = "04120000SB",
+ bgezall_2 = "04130000SB",
+ synci_1 = "041f0000O",
+
+ -- Opcode SPECIAL2.
+ madd_2 = "70000000ST",
+ maddu_2 = "70000001ST",
+ mul_3 = "70000002DST",
+ msub_2 = "70000004ST",
+ msubu_2 = "70000005ST",
+ clz_2 = "70000020DS=",
+ clo_2 = "70000021DS=",
+ dclz_2 = mips64 and "70000024DS=",
+ dclo_2 = mips64 and "70000025DS=",
+ sdbbp_0 = "7000003f",
+ sdbbp_1 = "7000003fY",
+
+ -- Opcode SPECIAL3.
+ ext_4 = "7c000000TSAM", -- Note: last arg is msbd = size-1
+ dextm_4 = mips64 and "7c000001TSAM", -- Args: pos | size-1-32
+ dextu_4 = mips64 and "7c000002TSAM", -- Args: pos-32 | size-1
+ dext_4 = mips64 and "7c000003TSAM", -- Args: pos | size-1
+ zextw_2 = mips64 and "7c00f803TS",
+ ins_4 = "7c000004TSAM", -- Note: last arg is msb = pos+size-1
+ dinsm_4 = mips64 and "7c000005TSAM", -- Args: pos | pos+size-33
+ dinsu_4 = mips64 and "7c000006TSAM", -- Args: pos-32 | pos+size-33
+ dins_4 = mips64 and "7c000007TSAM", -- Args: pos | pos+size-1
+ wsbh_2 = "7c0000a0DT",
+ dsbh_2 = mips64 and "7c0000a4DT",
+ dshd_2 = mips64 and "7c000164DT",
+ seb_2 = "7c000420DT",
+ seh_2 = "7c000620DT",
+ rdhwr_2 = "7c00003bTD",
+
+ -- Opcode COP0.
+ mfc0_2 = "40000000TD",
+ mfc0_3 = "40000000TDW",
+ dmfc0_2 = mips64 and "40200000TD",
+ dmfc0_3 = mips64 and "40200000TDW",
+ mtc0_2 = "40800000TD",
+ mtc0_3 = "40800000TDW",
+ dmtc0_2 = mips64 and "40a00000TD",
+ dmtc0_3 = mips64 and "40a00000TDW",
+ rdpgpr_2 = "41400000DT",
+ di_0 = "41606000",
+ di_1 = "41606000T",
+ ei_0 = "41606020",
+ ei_1 = "41606020T",
+ wrpgpr_2 = "41c00000DT",
+ tlbr_0 = "42000001",
+ tlbwi_0 = "42000002",
+ tlbwr_0 = "42000006",
+ tlbp_0 = "42000008",
+ eret_0 = "42000018",
+ deret_0 = "4200001f",
+ wait_0 = "42000020",
+
+ -- Opcode COP1.
+ mfc1_2 = "44000000TG",
+ dmfc1_2 = mips64 and "44200000TG",
+ cfc1_2 = "44400000TG",
+ mfhc1_2 = "44600000TG",
+ mtc1_2 = "44800000TG",
+ dmtc1_2 = mips64 and "44a00000TG",
+ ctc1_2 = "44c00000TG",
+ mthc1_2 = "44e00000TG",
+
+ bc1f_1 = "45000000B",
+ bc1f_2 = "45000000CB",
+ bc1t_1 = "45010000B",
+ bc1t_2 = "45010000CB",
+ bc1fl_1 = "45020000B",
+ bc1fl_2 = "45020000CB",
+ bc1tl_1 = "45030000B",
+ bc1tl_2 = "45030000CB",
+
+ ["add.s_3"] = "46000000FGH",
+ ["sub.s_3"] = "46000001FGH",
+ ["mul.s_3"] = "46000002FGH",
+ ["div.s_3"] = "46000003FGH",
+ ["sqrt.s_2"] = "46000004FG",
+ ["abs.s_2"] = "46000005FG",
+ ["mov.s_2"] = "46000006FG",
+ ["neg.s_2"] = "46000007FG",
+ ["round.l.s_2"] = "46000008FG",
+ ["trunc.l.s_2"] = "46000009FG",
+ ["ceil.l.s_2"] = "4600000aFG",
+ ["floor.l.s_2"] = "4600000bFG",
+ ["round.w.s_2"] = "4600000cFG",
+ ["trunc.w.s_2"] = "4600000dFG",
+ ["ceil.w.s_2"] = "4600000eFG",
+ ["floor.w.s_2"] = "4600000fFG",
+ ["movf.s_2"] = "46000011FG",
+ ["movf.s_3"] = "46000011FGC",
+ ["movt.s_2"] = "46010011FG",
+ ["movt.s_3"] = "46010011FGC",
+ ["movz.s_3"] = "46000012FGT",
+ ["movn.s_3"] = "46000013FGT",
+ ["recip.s_2"] = "46000015FG",
+ ["rsqrt.s_2"] = "46000016FG",
+ ["cvt.d.s_2"] = "46000021FG",
+ ["cvt.w.s_2"] = "46000024FG",
+ ["cvt.l.s_2"] = "46000025FG",
+ ["cvt.ps.s_3"] = "46000026FGH",
+ ["c.f.s_2"] = "46000030GH",
+ ["c.f.s_3"] = "46000030VGH",
+ ["c.un.s_2"] = "46000031GH",
+ ["c.un.s_3"] = "46000031VGH",
+ ["c.eq.s_2"] = "46000032GH",
+ ["c.eq.s_3"] = "46000032VGH",
+ ["c.ueq.s_2"] = "46000033GH",
+ ["c.ueq.s_3"] = "46000033VGH",
+ ["c.olt.s_2"] = "46000034GH",
+ ["c.olt.s_3"] = "46000034VGH",
+ ["c.ult.s_2"] = "46000035GH",
+ ["c.ult.s_3"] = "46000035VGH",
+ ["c.ole.s_2"] = "46000036GH",
+ ["c.ole.s_3"] = "46000036VGH",
+ ["c.ule.s_2"] = "46000037GH",
+ ["c.ule.s_3"] = "46000037VGH",
+ ["c.sf.s_2"] = "46000038GH",
+ ["c.sf.s_3"] = "46000038VGH",
+ ["c.ngle.s_2"] = "46000039GH",
+ ["c.ngle.s_3"] = "46000039VGH",
+ ["c.seq.s_2"] = "4600003aGH",
+ ["c.seq.s_3"] = "4600003aVGH",
+ ["c.ngl.s_2"] = "4600003bGH",
+ ["c.ngl.s_3"] = "4600003bVGH",
+ ["c.lt.s_2"] = "4600003cGH",
+ ["c.lt.s_3"] = "4600003cVGH",
+ ["c.nge.s_2"] = "4600003dGH",
+ ["c.nge.s_3"] = "4600003dVGH",
+ ["c.le.s_2"] = "4600003eGH",
+ ["c.le.s_3"] = "4600003eVGH",
+ ["c.ngt.s_2"] = "4600003fGH",
+ ["c.ngt.s_3"] = "4600003fVGH",
+
+ ["add.d_3"] = "46200000FGH",
+ ["sub.d_3"] = "46200001FGH",
+ ["mul.d_3"] = "46200002FGH",
+ ["div.d_3"] = "46200003FGH",
+ ["sqrt.d_2"] = "46200004FG",
+ ["abs.d_2"] = "46200005FG",
+ ["mov.d_2"] = "46200006FG",
+ ["neg.d_2"] = "46200007FG",
+ ["round.l.d_2"] = "46200008FG",
+ ["trunc.l.d_2"] = "46200009FG",
+ ["ceil.l.d_2"] = "4620000aFG",
+ ["floor.l.d_2"] = "4620000bFG",
+ ["round.w.d_2"] = "4620000cFG",
+ ["trunc.w.d_2"] = "4620000dFG",
+ ["ceil.w.d_2"] = "4620000eFG",
+ ["floor.w.d_2"] = "4620000fFG",
+ ["movf.d_2"] = "46200011FG",
+ ["movf.d_3"] = "46200011FGC",
+ ["movt.d_2"] = "46210011FG",
+ ["movt.d_3"] = "46210011FGC",
+ ["movz.d_3"] = "46200012FGT",
+ ["movn.d_3"] = "46200013FGT",
+ ["recip.d_2"] = "46200015FG",
+ ["rsqrt.d_2"] = "46200016FG",
+ ["cvt.s.d_2"] = "46200020FG",
+ ["cvt.w.d_2"] = "46200024FG",
+ ["cvt.l.d_2"] = "46200025FG",
+ ["c.f.d_2"] = "46200030GH",
+ ["c.f.d_3"] = "46200030VGH",
+ ["c.un.d_2"] = "46200031GH",
+ ["c.un.d_3"] = "46200031VGH",
+ ["c.eq.d_2"] = "46200032GH",
+ ["c.eq.d_3"] = "46200032VGH",
+ ["c.ueq.d_2"] = "46200033GH",
+ ["c.ueq.d_3"] = "46200033VGH",
+ ["c.olt.d_2"] = "46200034GH",
+ ["c.olt.d_3"] = "46200034VGH",
+ ["c.ult.d_2"] = "46200035GH",
+ ["c.ult.d_3"] = "46200035VGH",
+ ["c.ole.d_2"] = "46200036GH",
+ ["c.ole.d_3"] = "46200036VGH",
+ ["c.ule.d_2"] = "46200037GH",
+ ["c.ule.d_3"] = "46200037VGH",
+ ["c.sf.d_2"] = "46200038GH",
+ ["c.sf.d_3"] = "46200038VGH",
+ ["c.ngle.d_2"] = "46200039GH",
+ ["c.ngle.d_3"] = "46200039VGH",
+ ["c.seq.d_2"] = "4620003aGH",
+ ["c.seq.d_3"] = "4620003aVGH",
+ ["c.ngl.d_2"] = "4620003bGH",
+ ["c.ngl.d_3"] = "4620003bVGH",
+ ["c.lt.d_2"] = "4620003cGH",
+ ["c.lt.d_3"] = "4620003cVGH",
+ ["c.nge.d_2"] = "4620003dGH",
+ ["c.nge.d_3"] = "4620003dVGH",
+ ["c.le.d_2"] = "4620003eGH",
+ ["c.le.d_3"] = "4620003eVGH",
+ ["c.ngt.d_2"] = "4620003fGH",
+ ["c.ngt.d_3"] = "4620003fVGH",
+
+ ["add.ps_3"] = "46c00000FGH",
+ ["sub.ps_3"] = "46c00001FGH",
+ ["mul.ps_3"] = "46c00002FGH",
+ ["abs.ps_2"] = "46c00005FG",
+ ["mov.ps_2"] = "46c00006FG",
+ ["neg.ps_2"] = "46c00007FG",
+ ["movf.ps_2"] = "46c00011FG",
+ ["movf.ps_3"] = "46c00011FGC",
+ ["movt.ps_2"] = "46c10011FG",
+ ["movt.ps_3"] = "46c10011FGC",
+ ["movz.ps_3"] = "46c00012FGT",
+ ["movn.ps_3"] = "46c00013FGT",
+ ["cvt.s.pu_2"] = "46c00020FG",
+ ["cvt.s.pl_2"] = "46c00028FG",
+ ["pll.ps_3"] = "46c0002cFGH",
+ ["plu.ps_3"] = "46c0002dFGH",
+ ["pul.ps_3"] = "46c0002eFGH",
+ ["puu.ps_3"] = "46c0002fFGH",
+ ["c.f.ps_2"] = "46c00030GH",
+ ["c.f.ps_3"] = "46c00030VGH",
+ ["c.un.ps_2"] = "46c00031GH",
+ ["c.un.ps_3"] = "46c00031VGH",
+ ["c.eq.ps_2"] = "46c00032GH",
+ ["c.eq.ps_3"] = "46c00032VGH",
+ ["c.ueq.ps_2"] = "46c00033GH",
+ ["c.ueq.ps_3"] = "46c00033VGH",
+ ["c.olt.ps_2"] = "46c00034GH",
+ ["c.olt.ps_3"] = "46c00034VGH",
+ ["c.ult.ps_2"] = "46c00035GH",
+ ["c.ult.ps_3"] = "46c00035VGH",
+ ["c.ole.ps_2"] = "46c00036GH",
+ ["c.ole.ps_3"] = "46c00036VGH",
+ ["c.ule.ps_2"] = "46c00037GH",
+ ["c.ule.ps_3"] = "46c00037VGH",
+ ["c.sf.ps_2"] = "46c00038GH",
+ ["c.sf.ps_3"] = "46c00038VGH",
+ ["c.ngle.ps_2"] = "46c00039GH",
+ ["c.ngle.ps_3"] = "46c00039VGH",
+ ["c.seq.ps_2"] = "46c0003aGH",
+ ["c.seq.ps_3"] = "46c0003aVGH",
+ ["c.ngl.ps_2"] = "46c0003bGH",
+ ["c.ngl.ps_3"] = "46c0003bVGH",
+ ["c.lt.ps_2"] = "46c0003cGH",
+ ["c.lt.ps_3"] = "46c0003cVGH",
+ ["c.nge.ps_2"] = "46c0003dGH",
+ ["c.nge.ps_3"] = "46c0003dVGH",
+ ["c.le.ps_2"] = "46c0003eGH",
+ ["c.le.ps_3"] = "46c0003eVGH",
+ ["c.ngt.ps_2"] = "46c0003fGH",
+ ["c.ngt.ps_3"] = "46c0003fVGH",
+
+ ["cvt.s.w_2"] = "46800020FG",
+ ["cvt.d.w_2"] = "46800021FG",
+
+ ["cvt.s.l_2"] = "46a00020FG",
+ ["cvt.d.l_2"] = "46a00021FG",
+
+ -- Opcode COP1X.
+ lwxc1_2 = "4c000000FX",
+ ldxc1_2 = "4c000001FX",
+ luxc1_2 = "4c000005FX",
+ swxc1_2 = "4c000008FX",
+ sdxc1_2 = "4c000009FX",
+ suxc1_2 = "4c00000dFX",
+ prefx_2 = "4c00000fMX",
+ ["alnv.ps_4"] = "4c00001eFGHS",
+ ["madd.s_4"] = "4c000020FRGH",
+ ["madd.d_4"] = "4c000021FRGH",
+ ["madd.ps_4"] = "4c000026FRGH",
+ ["msub.s_4"] = "4c000028FRGH",
+ ["msub.d_4"] = "4c000029FRGH",
+ ["msub.ps_4"] = "4c00002eFRGH",
+ ["nmadd.s_4"] = "4c000030FRGH",
+ ["nmadd.d_4"] = "4c000031FRGH",
+ ["nmadd.ps_4"] = "4c000036FRGH",
+ ["nmsub.s_4"] = "4c000038FRGH",
+ ["nmsub.d_4"] = "4c000039FRGH",
+ ["nmsub.ps_4"] = "4c00003eFRGH",
+}
+
+------------------------------------------------------------------------------
+
+local function parse_gpr(expr)
+ local tname, ovreg = match(expr, "^([%w_]+):(r[1-3]?[0-9])$")
+ local tp = map_type[tname or expr]
+ if tp then
+ local reg = ovreg or tp.reg
+ if not reg then
+ werror("type `"..(tname or expr).."' needs a register override")
+ end
+ expr = reg
+ end
+ local r = match(expr, "^r([1-3]?[0-9])$")
+ if r then
+ r = tonumber(r)
+ if r <= 31 then return r, tp end
+ end
+ werror("bad register name `"..expr.."'")
+end
+
+local function parse_fpr(expr)
+ local r = match(expr, "^f([1-3]?[0-9])$")
+ if r then
+ r = tonumber(r)
+ if r <= 31 then return r end
+ end
+ werror("bad register name `"..expr.."'")
+end
+
+local function parse_imm(imm, bits, shift, scale, signed, action)
+ local n = tonumber(imm)
+ if n then
+ local m = sar(n, scale)
+ if shl(m, scale) == n then
+ if signed then
+ local s = sar(m, bits-1)
+ if s == 0 then return shl(m, shift)
+ elseif s == -1 then return shl(m + shl(1, bits), shift) end
+ else
+ if sar(m, bits) == 0 then return shl(m, shift) end
+ end
+ end
+ werror("out of range immediate `"..imm.."'")
+ elseif match(imm, "^[rf]([1-3]?[0-9])$") or
+ match(imm, "^([%w_]+):([rf][1-3]?[0-9])$") then
+ werror("expected immediate operand, got register")
+ else
+ waction(action or "IMM",
+ (signed and 32768 or 0)+shl(scale, 10)+shl(bits, 5)+shift, imm)
+ return 0
+ end
+end
+
+local function parse_disp(disp)
+ local imm, reg = match(disp, "^(.*)%(([%w_:]+)%)$")
+ if imm then
+ local r = shl(parse_gpr(reg), 21)
+ local extname = match(imm, "^extern%s+(%S+)$")
+ if extname then
+ waction("REL_EXT", map_extern[extname], nil, 1)
+ return r
+ else
+ return r + parse_imm(imm, 16, 0, 0, true)
+ end
+ end
+ local reg, tailr = match(disp, "^([%w_:]+)%s*(.*)$")
+ if reg and tailr ~= "" then
+ local r, tp = parse_gpr(reg)
+ if tp then
+ waction("IMM", 32768+16*32, format(tp.ctypefmt, tailr))
+ return shl(r, 21)
+ end
+ end
+ werror("bad displacement `"..disp.."'")
+end
+
+local function parse_index(idx)
+ local rt, rs = match(idx, "^(.*)%(([%w_:]+)%)$")
+ if rt then
+ rt = parse_gpr(rt)
+ rs = parse_gpr(rs)
+ return shl(rt, 16) + shl(rs, 21)
+ end
+ werror("bad index `"..idx.."'")
+end
+
+local function parse_label(label, def)
+ local prefix = sub(label, 1, 2)
+ -- =>label (pc label reference)
+ if prefix == "=>" then
+ return "PC", 0, sub(label, 3)
+ end
+ -- ->name (global label reference)
+ if prefix == "->" then
+ return "LG", map_global[sub(label, 3)]
+ end
+ if def then
+ -- [1-9] (local label definition)
+ if match(label, "^[1-9]$") then
+ return "LG", 10+tonumber(label)
+ end
+ else
+ -- [<>][1-9] (local label reference)
+ local dir, lnum = match(label, "^([<>])([1-9])$")
+ if dir then -- Fwd: 1-9, Bkwd: 11-19.
+ return "LG", lnum + (dir == ">" and 0 or 10)
+ end
+ -- extern label (extern label reference)
+ local extname = match(label, "^extern%s+(%S+)$")
+ if extname then
+ return "EXT", map_extern[extname]
+ end
+ end
+ werror("bad label `"..label.."'")
+end
+
+------------------------------------------------------------------------------
+
+-- Handle opcodes defined with template strings.
+map_op[".template__"] = function(params, template, nparams)
+ if not params then return sub(template, 9) end
+ local op = tonumber(sub(template, 1, 8), 16)
+ local n = 1
+
+ -- Limit number of section buffer positions used by a single dasm_put().
+ -- A single opcode needs a maximum of 2 positions (ins/ext).
+ if secpos+2 > maxsecpos then wflush() end
+ local pos = wpos()
+
+ -- Process each character.
+ for p in gmatch(sub(template, 9), ".") do
+ if p == "D" then
+ op = op + shl(parse_gpr(params[n]), 11); n = n + 1
+ elseif p == "T" then
+ op = op + shl(parse_gpr(params[n]), 16); n = n + 1
+ elseif p == "S" then
+ op = op + shl(parse_gpr(params[n]), 21); n = n + 1
+ elseif p == "F" then
+ op = op + shl(parse_fpr(params[n]), 6); n = n + 1
+ elseif p == "G" then
+ op = op + shl(parse_fpr(params[n]), 11); n = n + 1
+ elseif p == "H" then
+ op = op + shl(parse_fpr(params[n]), 16); n = n + 1
+ elseif p == "R" then
+ op = op + shl(parse_fpr(params[n]), 21); n = n + 1
+ elseif p == "I" then
+ op = op + parse_imm(params[n], 16, 0, 0, true); n = n + 1
+ elseif p == "U" then
+ op = op + parse_imm(params[n], 16, 0, 0, false); n = n + 1
+ elseif p == "O" then
+ op = op + parse_disp(params[n]); n = n + 1
+ elseif p == "X" then
+ op = op + parse_index(params[n]); n = n + 1
+ elseif p == "B" or p == "J" then
+ local mode, n, s = parse_label(params[n], false)
+ if p == "B" then n = n + 2048 end
+ waction("REL_"..mode, n, s, 1)
+ n = n + 1
+ elseif p == "A" then
+ op = op + parse_imm(params[n], 5, 6, 0, false); n = n + 1
+ elseif p == "a" then
+ local m = parse_imm(params[n], 6, 6, 0, false, "IMMS"); n = n + 1
+ op = op + band(m, 0x7c0) + band(shr(m, 9), 4)
+ elseif p == "M" then
+ op = op + parse_imm(params[n], 5, 11, 0, false); n = n + 1
+ elseif p == "N" then
+ op = op + parse_imm(params[n], 5, 16, 0, false); n = n + 1
+ elseif p == "C" then
+ op = op + parse_imm(params[n], 3, 18, 0, false); n = n + 1
+ elseif p == "V" then
+ op = op + parse_imm(params[n], 3, 8, 0, false); n = n + 1
+ elseif p == "W" then
+ op = op + parse_imm(params[n], 3, 0, 0, false); n = n + 1
+ elseif p == "Y" then
+ op = op + parse_imm(params[n], 20, 6, 0, false); n = n + 1
+ elseif p == "Z" then
+ op = op + parse_imm(params[n], 10, 6, 0, false); n = n + 1
+ elseif p == "=" then
+ op = op + shl(band(op, 0xf800), 5) -- Copy D to T for clz, clo.
+ else
+ assert(false)
+ end
+ end
+ wputpos(pos, op)
+end
+
+------------------------------------------------------------------------------
+
+-- Pseudo-opcode to mark the position where the action list is to be emitted.
+map_op[".actionlist_1"] = function(params)
+ if not params then return "cvar" end
+ local name = params[1] -- No syntax check. You get to keep the pieces.
+ wline(function(out) writeactions(out, name) end)
+end
+
+-- Pseudo-opcode to mark the position where the global enum is to be emitted.
+map_op[".globals_1"] = function(params)
+ if not params then return "prefix" end
+ local prefix = params[1] -- No syntax check. You get to keep the pieces.
+ wline(function(out) writeglobals(out, prefix) end)
+end
+
+-- Pseudo-opcode to mark the position where the global names are to be emitted.
+map_op[".globalnames_1"] = function(params)
+ if not params then return "cvar" end
+ local name = params[1] -- No syntax check. You get to keep the pieces.
+ wline(function(out) writeglobalnames(out, name) end)
+end
+
+-- Pseudo-opcode to mark the position where the extern names are to be emitted.
+map_op[".externnames_1"] = function(params)
+ if not params then return "cvar" end
+ local name = params[1] -- No syntax check. You get to keep the pieces.
+ wline(function(out) writeexternnames(out, name) end)
+end
+
+------------------------------------------------------------------------------
+
+-- Label pseudo-opcode (converted from trailing colon form).
+map_op[".label_1"] = function(params)
+ if not params then return "[1-9] | ->global | =>pcexpr" end
+ if secpos+1 > maxsecpos then wflush() end
+ local mode, n, s = parse_label(params[1], true)
+ if mode == "EXT" then werror("bad label definition") end
+ waction("LABEL_"..mode, n, s, 1)
+end
+
+------------------------------------------------------------------------------
+
+-- Pseudo-opcodes for data storage.
+map_op[".long_*"] = function(params)
+ if not params then return "imm..." end
+ for _,p in ipairs(params) do
+ local n = tonumber(p)
+ if not n then werror("bad immediate `"..p.."'") end
+ if n < 0 then n = n + 2^32 end
+ wputw(n)
+ if secpos+2 > maxsecpos then wflush() end
+ end
+end
+
+-- Alignment pseudo-opcode.
+map_op[".align_1"] = function(params)
+ if not params then return "numpow2" end
+ if secpos+1 > maxsecpos then wflush() end
+ local align = tonumber(params[1])
+ if align then
+ local x = align
+ -- Must be a power of 2 in the range (2 ... 256).
+ for i=1,8 do
+ x = x / 2
+ if x == 1 then
+ waction("ALIGN", align-1, nil, 1) -- Action byte is 2**n-1.
+ return
+ end
+ end
+ end
+ werror("bad alignment")
+end
+
+------------------------------------------------------------------------------
+
+-- Pseudo-opcode for (primitive) type definitions (map to C types).
+map_op[".type_3"] = function(params, nparams)
+ if not params then
+ return nparams == 2 and "name, ctype" or "name, ctype, reg"
+ end
+ local name, ctype, reg = params[1], params[2], params[3]
+ if not match(name, "^[%a_][%w_]*$") then
+ werror("bad type name `"..name.."'")
+ end
+ local tp = map_type[name]
+ if tp then
+ werror("duplicate type `"..name.."'")
+ end
+ -- Add #type to defines. A bit unclean to put it in map_archdef.
+ map_archdef["#"..name] = "sizeof("..ctype..")"
+ -- Add new type and emit shortcut define.
+ local num = ctypenum + 1
+ map_type[name] = {
+ ctype = ctype,
+ ctypefmt = format("Dt%X(%%s)", num),
+ reg = reg,
+ }
+ wline(format("#define Dt%X(_V) (int)(ptrdiff_t)&(((%s *)0)_V)", num, ctype))
+ ctypenum = num
+end
+map_op[".type_2"] = map_op[".type_3"]
+
+-- Dump type definitions.
+local function dumptypes(out, lvl)
+ local t = {}
+ for name in pairs(map_type) do t[#t+1] = name end
+ sort(t)
+ out:write("Type definitions:\n")
+ for _,name in ipairs(t) do
+ local tp = map_type[name]
+ local reg = tp.reg or ""
+ out:write(format(" %-20s %-20s %s\n", name, tp.ctype, reg))
+ end
+ out:write("\n")
+end
+
+------------------------------------------------------------------------------
+
+-- Set the current section.
+function _M.section(num)
+ waction("SECTION", num)
+ wflush(true) -- SECTION is a terminal action.
+end
+
+------------------------------------------------------------------------------
+
+-- Dump architecture description.
+function _M.dumparch(out)
+ out:write(format("DynASM %s version %s, released %s\n\n",
+ _info.arch, _info.version, _info.release))
+ dumpactions(out)
+end
+
+-- Dump all user defined elements.
+function _M.dumpdef(out, lvl)
+ dumptypes(out, lvl)
+ dumpglobals(out, lvl)
+ dumpexterns(out, lvl)
+end
+
+------------------------------------------------------------------------------
+
+-- Pass callbacks from/to the DynASM core.
+function _M.passcb(wl, we, wf, ww)
+ wline, werror, wfatal, wwarn = wl, we, wf, ww
+ return wflush
+end
+
+-- Setup the arch-specific module.
+function _M.setup(arch, opt)
+ g_arch, g_opt = arch, opt
+end
+
+-- Merge the core maps and the arch-specific maps.
+function _M.mergemaps(map_coreop, map_def)
+ setmetatable(map_op, { __index = map_coreop })
+ setmetatable(map_def, { __index = map_archdef })
+ return map_op, map_def
+end
+
+return _M
+
+------------------------------------------------------------------------------
+
diff --git a/ext/opcache/jit/dynasm/dasm_mips64.lua b/ext/opcache/jit/dynasm/dasm_mips64.lua
new file mode 100644
index 0000000000..94f21921fc
--- /dev/null
+++ b/ext/opcache/jit/dynasm/dasm_mips64.lua
@@ -0,0 +1,12 @@
+------------------------------------------------------------------------------
+-- DynASM MIPS64 module.
+--
+-- Copyright (C) 2005-2016 Mike Pall. All rights reserved.
+-- See dynasm.lua for full copyright notice.
+------------------------------------------------------------------------------
+-- This module just sets 64 bit mode for the combined MIPS/MIPS64 module.
+-- All the interesting stuff is there.
+------------------------------------------------------------------------------
+
+mips64 = true -- Using a global is an ugly, but effective solution.
+return require("dasm_mips")
diff --git a/ext/opcache/jit/dynasm/dasm_ppc.h b/ext/opcache/jit/dynasm/dasm_ppc.h
new file mode 100644
index 0000000000..3f267fb824
--- /dev/null
+++ b/ext/opcache/jit/dynasm/dasm_ppc.h
@@ -0,0 +1,419 @@
+/*
+** DynASM PPC/PPC64 encoding engine.
+** Copyright (C) 2005-2016 Mike Pall. All rights reserved.
+** Released under the MIT license. See dynasm.lua for full copyright notice.
+*/
+
+#include <stddef.h>
+#include <stdarg.h>
+#include <string.h>
+#include <stdlib.h>
+
+#define DASM_ARCH "ppc"
+
+#ifndef DASM_EXTERN
+#define DASM_EXTERN(a,b,c,d) 0
+#endif
+
+/* Action definitions. */
+enum {
+ DASM_STOP, DASM_SECTION, DASM_ESC, DASM_REL_EXT,
+ /* The following actions need a buffer position. */
+ DASM_ALIGN, DASM_REL_LG, DASM_LABEL_LG,
+ /* The following actions also have an argument. */
+ DASM_REL_PC, DASM_LABEL_PC, DASM_IMM, DASM_IMMSH,
+ DASM__MAX
+};
+
+/* Maximum number of section buffer positions for a single dasm_put() call. */
+#define DASM_MAXSECPOS 25
+
+/* DynASM encoder status codes. Action list offset or number are or'ed in. */
+#define DASM_S_OK 0x00000000
+#define DASM_S_NOMEM 0x01000000
+#define DASM_S_PHASE 0x02000000
+#define DASM_S_MATCH_SEC 0x03000000
+#define DASM_S_RANGE_I 0x11000000
+#define DASM_S_RANGE_SEC 0x12000000
+#define DASM_S_RANGE_LG 0x13000000
+#define DASM_S_RANGE_PC 0x14000000
+#define DASM_S_RANGE_REL 0x15000000
+#define DASM_S_UNDEF_LG 0x21000000
+#define DASM_S_UNDEF_PC 0x22000000
+
+/* Macros to convert positions (8 bit section + 24 bit index). */
+#define DASM_POS2IDX(pos) ((pos)&0x00ffffff)
+#define DASM_POS2BIAS(pos) ((pos)&0xff000000)
+#define DASM_SEC2POS(sec) ((sec)<<24)
+#define DASM_POS2SEC(pos) ((pos)>>24)
+#define DASM_POS2PTR(D, pos) (D->sections[DASM_POS2SEC(pos)].rbuf + (pos))
+
+/* Action list type. */
+typedef const unsigned int *dasm_ActList;
+
+/* Per-section structure. */
+typedef struct dasm_Section {
+ int *rbuf; /* Biased buffer pointer (negative section bias). */
+ int *buf; /* True buffer pointer. */
+ size_t bsize; /* Buffer size in bytes. */
+ int pos; /* Biased buffer position. */
+ int epos; /* End of biased buffer position - max single put. */
+ int ofs; /* Byte offset into section. */
+} dasm_Section;
+
+/* Core structure holding the DynASM encoding state. */
+struct dasm_State {
+ size_t psize; /* Allocated size of this structure. */
+ dasm_ActList actionlist; /* Current actionlist pointer. */
+ int *lglabels; /* Local/global chain/pos ptrs. */
+ size_t lgsize;
+ int *pclabels; /* PC label chains/pos ptrs. */
+ size_t pcsize;
+ void **globals; /* Array of globals (bias -10). */
+ dasm_Section *section; /* Pointer to active section. */
+ size_t codesize; /* Total size of all code sections. */
+ int maxsection; /* 0 <= sectionidx < maxsection. */
+ int status; /* Status code. */
+ dasm_Section sections[1]; /* All sections. Alloc-extended. */
+};
+
+/* The size of the core structure depends on the max. number of sections. */
+#define DASM_PSZ(ms) (sizeof(dasm_State)+(ms-1)*sizeof(dasm_Section))
+
+
+/* Initialize DynASM state. */
+void dasm_init(Dst_DECL, int maxsection)
+{
+ dasm_State *D;
+ size_t psz = 0;
+ int i;
+ Dst_REF = NULL;
+ DASM_M_GROW(Dst, struct dasm_State, Dst_REF, psz, DASM_PSZ(maxsection));
+ D = Dst_REF;
+ D->psize = psz;
+ D->lglabels = NULL;
+ D->lgsize = 0;
+ D->pclabels = NULL;
+ D->pcsize = 0;
+ D->globals = NULL;
+ D->maxsection = maxsection;
+ for (i = 0; i < maxsection; i++) {
+ D->sections[i].buf = NULL; /* Need this for pass3. */
+ D->sections[i].rbuf = D->sections[i].buf - DASM_SEC2POS(i);
+ D->sections[i].bsize = 0;
+ D->sections[i].epos = 0; /* Wrong, but is recalculated after resize. */
+ }
+}
+
+/* Free DynASM state. */
+void dasm_free(Dst_DECL)
+{
+ dasm_State *D = Dst_REF;
+ int i;
+ for (i = 0; i < D->maxsection; i++)
+ if (D->sections[i].buf)
+ DASM_M_FREE(Dst, D->sections[i].buf, D->sections[i].bsize);
+ if (D->pclabels) DASM_M_FREE(Dst, D->pclabels, D->pcsize);
+ if (D->lglabels) DASM_M_FREE(Dst, D->lglabels, D->lgsize);
+ DASM_M_FREE(Dst, D, D->psize);
+}
+
+/* Setup global label array. Must be called before dasm_setup(). */
+void dasm_setupglobal(Dst_DECL, void **gl, unsigned int maxgl)
+{
+ dasm_State *D = Dst_REF;
+ D->globals = gl - 10; /* Negative bias to compensate for locals. */
+ DASM_M_GROW(Dst, int, D->lglabels, D->lgsize, (10+maxgl)*sizeof(int));
+}
+
+/* Grow PC label array. Can be called after dasm_setup(), too. */
+void dasm_growpc(Dst_DECL, unsigned int maxpc)
+{
+ dasm_State *D = Dst_REF;
+ size_t osz = D->pcsize;
+ DASM_M_GROW(Dst, int, D->pclabels, D->pcsize, maxpc*sizeof(int));
+ memset((void *)(((unsigned char *)D->pclabels)+osz), 0, D->pcsize-osz);
+}
+
+/* Setup encoder. */
+void dasm_setup(Dst_DECL, const void *actionlist)
+{
+ dasm_State *D = Dst_REF;
+ int i;
+ D->actionlist = (dasm_ActList)actionlist;
+ D->status = DASM_S_OK;
+ D->section = &D->sections[0];
+ memset((void *)D->lglabels, 0, D->lgsize);
+ if (D->pclabels) memset((void *)D->pclabels, 0, D->pcsize);
+ for (i = 0; i < D->maxsection; i++) {
+ D->sections[i].pos = DASM_SEC2POS(i);
+ D->sections[i].ofs = 0;
+ }
+}
+
+
+#ifdef DASM_CHECKS
+#define CK(x, st) \
+ do { if (!(x)) { \
+ D->status = DASM_S_##st|(p-D->actionlist-1); return; } } while (0)
+#define CKPL(kind, st) \
+ do { if ((size_t)((char *)pl-(char *)D->kind##labels) >= D->kind##size) { \
+ D->status = DASM_S_RANGE_##st|(p-D->actionlist-1); return; } } while (0)
+#else
+#define CK(x, st) ((void)0)
+#define CKPL(kind, st) ((void)0)
+#endif
+
+/* Pass 1: Store actions and args, link branches/labels, estimate offsets. */
+void dasm_put(Dst_DECL, int start, ...)
+{
+ va_list ap;
+ dasm_State *D = Dst_REF;
+ dasm_ActList p = D->actionlist + start;
+ dasm_Section *sec = D->section;
+ int pos = sec->pos, ofs = sec->ofs;
+ int *b;
+
+ if (pos >= sec->epos) {
+ DASM_M_GROW(Dst, int, sec->buf, sec->bsize,
+ sec->bsize + 2*DASM_MAXSECPOS*sizeof(int));
+ sec->rbuf = sec->buf - DASM_POS2BIAS(pos);
+ sec->epos = (int)sec->bsize/sizeof(int) - DASM_MAXSECPOS+DASM_POS2BIAS(pos);
+ }
+
+ b = sec->rbuf;
+ b[pos++] = start;
+
+ va_start(ap, start);
+ while (1) {
+ unsigned int ins = *p++;
+ unsigned int action = (ins >> 16);
+ if (action >= DASM__MAX) {
+ ofs += 4;
+ } else {
+ int *pl, n = action >= DASM_REL_PC ? va_arg(ap, int) : 0;
+ switch (action) {
+ case DASM_STOP: goto stop;
+ case DASM_SECTION:
+ n = (ins & 255); CK(n < D->maxsection, RANGE_SEC);
+ D->section = &D->sections[n]; goto stop;
+ case DASM_ESC: p++; ofs += 4; break;
+ case DASM_REL_EXT: break;
+ case DASM_ALIGN: ofs += (ins & 255); b[pos++] = ofs; break;
+ case DASM_REL_LG:
+ n = (ins & 2047) - 10; pl = D->lglabels + n;
+ /* Bkwd rel or global. */
+ if (n >= 0) { CK(n>=10||*pl<0, RANGE_LG); CKPL(lg, LG); goto putrel; }
+ pl += 10; n = *pl;
+ if (n < 0) n = 0; /* Start new chain for fwd rel if label exists. */
+ goto linkrel;
+ case DASM_REL_PC:
+ pl = D->pclabels + n; CKPL(pc, PC);
+ putrel:
+ n = *pl;
+ if (n < 0) { /* Label exists. Get label pos and store it. */
+ b[pos] = -n;
+ } else {
+ linkrel:
+ b[pos] = n; /* Else link to rel chain, anchored at label. */
+ *pl = pos;
+ }
+ pos++;
+ break;
+ case DASM_LABEL_LG:
+ pl = D->lglabels + (ins & 2047) - 10; CKPL(lg, LG); goto putlabel;
+ case DASM_LABEL_PC:
+ pl = D->pclabels + n; CKPL(pc, PC);
+ putlabel:
+ n = *pl; /* n > 0: Collapse rel chain and replace with label pos. */
+ while (n > 0) { int *pb = DASM_POS2PTR(D, n); n = *pb; *pb = pos;
+ }
+ *pl = -pos; /* Label exists now. */
+ b[pos++] = ofs; /* Store pass1 offset estimate. */
+ break;
+ case DASM_IMM:
+#ifdef DASM_CHECKS
+ CK((n & ((1<<((ins>>10)&31))-1)) == 0, RANGE_I);
+#endif
+ n >>= ((ins>>10)&31);
+#ifdef DASM_CHECKS
+ if (ins & 0x8000)
+ CK(((n + (1<<(((ins>>5)&31)-1)))>>((ins>>5)&31)) == 0, RANGE_I);
+ else
+ CK((n>>((ins>>5)&31)) == 0, RANGE_I);
+#endif
+ b[pos++] = n;
+ break;
+ case DASM_IMMSH:
+ CK((n >> 6) == 0, RANGE_I);
+ b[pos++] = n;
+ break;
+ }
+ }
+ }
+stop:
+ va_end(ap);
+ sec->pos = pos;
+ sec->ofs = ofs;
+}
+#undef CK
+
+/* Pass 2: Link sections, shrink aligns, fix label offsets. */
+int dasm_link(Dst_DECL, size_t *szp)
+{
+ dasm_State *D = Dst_REF;
+ int secnum;
+ int ofs = 0;
+
+#ifdef DASM_CHECKS
+ *szp = 0;
+ if (D->status != DASM_S_OK) return D->status;
+ {
+ int pc;
+ for (pc = 0; pc*sizeof(int) < D->pcsize; pc++)
+ if (D->pclabels[pc] > 0) return DASM_S_UNDEF_PC|pc;
+ }
+#endif
+
+ { /* Handle globals not defined in this translation unit. */
+ int idx;
+ for (idx = 20; idx*sizeof(int) < D->lgsize; idx++) {
+ int n = D->lglabels[idx];
+ /* Undefined label: Collapse rel chain and replace with marker (< 0). */
+ while (n > 0) { int *pb = DASM_POS2PTR(D, n); n = *pb; *pb = -idx; }
+ }
+ }
+
+ /* Combine all code sections. No support for data sections (yet). */
+ for (secnum = 0; secnum < D->maxsection; secnum++) {
+ dasm_Section *sec = D->sections + secnum;
+ int *b = sec->rbuf;
+ int pos = DASM_SEC2POS(secnum);
+ int lastpos = sec->pos;
+
+ while (pos != lastpos) {
+ dasm_ActList p = D->actionlist + b[pos++];
+ while (1) {
+ unsigned int ins = *p++;
+ unsigned int action = (ins >> 16);
+ switch (action) {
+ case DASM_STOP: case DASM_SECTION: goto stop;
+ case DASM_ESC: p++; break;
+ case DASM_REL_EXT: break;
+ case DASM_ALIGN: ofs -= (b[pos++] + ofs) & (ins & 255); break;
+ case DASM_REL_LG: case DASM_REL_PC: pos++; break;
+ case DASM_LABEL_LG: case DASM_LABEL_PC: b[pos++] += ofs; break;
+ case DASM_IMM: case DASM_IMMSH: pos++; break;
+ }
+ }
+ stop: (void)0;
+ }
+ ofs += sec->ofs; /* Next section starts right after current section. */
+ }
+
+ D->codesize = ofs; /* Total size of all code sections */
+ *szp = ofs;
+ return DASM_S_OK;
+}
+
+#ifdef DASM_CHECKS
+#define CK(x, st) \
+ do { if (!(x)) return DASM_S_##st|(p-D->actionlist-1); } while (0)
+#else
+#define CK(x, st) ((void)0)
+#endif
+
+/* Pass 3: Encode sections. */
+int dasm_encode(Dst_DECL, void *buffer)
+{
+ dasm_State *D = Dst_REF;
+ char *base = (char *)buffer;
+ unsigned int *cp = (unsigned int *)buffer;
+ int secnum;
+
+ /* Encode all code sections. No support for data sections (yet). */
+ for (secnum = 0; secnum < D->maxsection; secnum++) {
+ dasm_Section *sec = D->sections + secnum;
+ int *b = sec->buf;
+ int *endb = sec->rbuf + sec->pos;
+
+ while (b != endb) {
+ dasm_ActList p = D->actionlist + *b++;
+ while (1) {
+ unsigned int ins = *p++;
+ unsigned int action = (ins >> 16);
+ int n = (action >= DASM_ALIGN && action < DASM__MAX) ? *b++ : 0;
+ switch (action) {
+ case DASM_STOP: case DASM_SECTION: goto stop;
+ case DASM_ESC: *cp++ = *p++; break;
+ case DASM_REL_EXT:
+ n = DASM_EXTERN(Dst, (unsigned char *)cp, (ins & 2047), 1) - 4;
+ goto patchrel;
+ case DASM_ALIGN:
+ ins &= 255; while ((((char *)cp - base) & ins)) *cp++ = 0x60000000;
+ break;
+ case DASM_REL_LG:
+ CK(n >= 0, UNDEF_LG);
+ case DASM_REL_PC:
+ CK(n >= 0, UNDEF_PC);
+ n = *DASM_POS2PTR(D, n) - (int)((char *)cp - base);
+ patchrel:
+ CK((n & 3) == 0 &&
+ (((n+4) + ((ins & 2048) ? 0x00008000 : 0x02000000)) >>
+ ((ins & 2048) ? 16 : 26)) == 0, RANGE_REL);
+ cp[-1] |= ((n+4) & ((ins & 2048) ? 0x0000fffc: 0x03fffffc));
+ break;
+ case DASM_LABEL_LG:
+ ins &= 2047; if (ins >= 20) D->globals[ins-10] = (void *)(base + n);
+ break;
+ case DASM_LABEL_PC: break;
+ case DASM_IMM:
+ cp[-1] |= (n & ((1<<((ins>>5)&31))-1)) << (ins&31);
+ break;
+ case DASM_IMMSH:
+ cp[-1] |= (ins & 1) ? ((n&31)<<11)|((n&32)>>4) : ((n&31)<<6)|(n&32);
+ break;
+ default: *cp++ = ins; break;
+ }
+ }
+ stop: (void)0;
+ }
+ }
+
+ if (base + D->codesize != (char *)cp) /* Check for phase errors. */
+ return DASM_S_PHASE;
+ return DASM_S_OK;
+}
+#undef CK
+
+/* Get PC label offset. */
+int dasm_getpclabel(Dst_DECL, unsigned int pc)
+{
+ dasm_State *D = Dst_REF;
+ if (pc*sizeof(int) < D->pcsize) {
+ int pos = D->pclabels[pc];
+ if (pos < 0) return *DASM_POS2PTR(D, -pos);
+ if (pos > 0) return -1; /* Undefined. */
+ }
+ return -2; /* Unused or out of range. */
+}
+
+#ifdef DASM_CHECKS
+/* Optional sanity checker to call between isolated encoding steps. */
+int dasm_checkstep(Dst_DECL, int secmatch)
+{
+ dasm_State *D = Dst_REF;
+ if (D->status == DASM_S_OK) {
+ int i;
+ for (i = 1; i <= 9; i++) {
+ if (D->lglabels[i] > 0) { D->status = DASM_S_UNDEF_LG|i; break; }
+ D->lglabels[i] = 0;
+ }
+ }
+ if (D->status == DASM_S_OK && secmatch >= 0 &&
+ D->section != &D->sections[secmatch])
+ D->status = DASM_S_MATCH_SEC|(D->section-D->sections);
+ return D->status;
+}
+#endif
+
diff --git a/ext/opcache/jit/dynasm/dasm_ppc.lua b/ext/opcache/jit/dynasm/dasm_ppc.lua
new file mode 100644
index 0000000000..e2f704ec18
--- /dev/null
+++ b/ext/opcache/jit/dynasm/dasm_ppc.lua
@@ -0,0 +1,1919 @@
+------------------------------------------------------------------------------
+-- DynASM PPC/PPC64 module.
+--
+-- Copyright (C) 2005-2016 Mike Pall. All rights reserved.
+-- See dynasm.lua for full copyright notice.
+--
+-- Support for various extensions contributed by Caio Souza Oliveira.
+------------------------------------------------------------------------------
+
+-- Module information:
+local _info = {
+ arch = "ppc",
+ description = "DynASM PPC module",
+ version = "1.4.0",
+ vernum = 10400,
+ release = "2015-10-18",
+ author = "Mike Pall",
+ license = "MIT",
+}
+
+-- Exported glue functions for the arch-specific module.
+local _M = { _info = _info }
+
+-- Cache library functions.
+local type, tonumber, pairs, ipairs = type, tonumber, pairs, ipairs
+local assert, setmetatable = assert, setmetatable
+local _s = string
+local sub, format, byte, char = _s.sub, _s.format, _s.byte, _s.char
+local match, gmatch = _s.match, _s.gmatch
+local concat, sort = table.concat, table.sort
+local bit = bit or require("bit")
+local band, shl, shr, sar = bit.band, bit.lshift, bit.rshift, bit.arshift
+local tohex = bit.tohex
+
+-- Inherited tables and callbacks.
+local g_opt, g_arch
+local wline, werror, wfatal, wwarn
+
+-- Action name list.
+-- CHECK: Keep this in sync with the C code!
+local action_names = {
+ "STOP", "SECTION", "ESC", "REL_EXT",
+ "ALIGN", "REL_LG", "LABEL_LG",
+ "REL_PC", "LABEL_PC", "IMM", "IMMSH"
+}
+
+-- Maximum number of section buffer positions for dasm_put().
+-- CHECK: Keep this in sync with the C code!
+local maxsecpos = 25 -- Keep this low, to avoid excessively long C lines.
+
+-- Action name -> action number.
+local map_action = {}
+for n,name in ipairs(action_names) do
+ map_action[name] = n-1
+end
+
+-- Action list buffer.
+local actlist = {}
+
+-- Argument list for next dasm_put(). Start with offset 0 into action list.
+local actargs = { 0 }
+
+-- Current number of section buffer positions for dasm_put().
+local secpos = 1
+
+------------------------------------------------------------------------------
+
+-- Dump action names and numbers.
+local function dumpactions(out)
+ out:write("DynASM encoding engine action codes:\n")
+ for n,name in ipairs(action_names) do
+ local num = map_action[name]
+ out:write(format(" %-10s %02X %d\n", name, num, num))
+ end
+ out:write("\n")
+end
+
+-- Write action list buffer as a huge static C array.
+local function writeactions(out, name)
+ local nn = #actlist
+ if nn == 0 then nn = 1; actlist[0] = map_action.STOP end
+ out:write("static const unsigned int ", name, "[", nn, "] = {\n")
+ for i = 1,nn-1 do
+ assert(out:write("0x", tohex(actlist[i]), ",\n"))
+ end
+ assert(out:write("0x", tohex(actlist[nn]), "\n};\n\n"))
+end
+
+------------------------------------------------------------------------------
+
+-- Add word to action list.
+local function wputxw(n)
+ assert(n >= 0 and n <= 0xffffffff and n % 1 == 0, "word out of range")
+ actlist[#actlist+1] = n
+end
+
+-- Add action to list with optional arg. Advance buffer pos, too.
+local function waction(action, val, a, num)
+ local w = assert(map_action[action], "bad action name `"..action.."'")
+ wputxw(w * 0x10000 + (val or 0))
+ if a then actargs[#actargs+1] = a end
+ if a or num then secpos = secpos + (num or 1) end
+end
+
+-- Flush action list (intervening C code or buffer pos overflow).
+local function wflush(term)
+ if #actlist == actargs[1] then return end -- Nothing to flush.
+ if not term then waction("STOP") end -- Terminate action list.
+ wline(format("dasm_put(Dst, %s);", concat(actargs, ", ")), true)
+ actargs = { #actlist } -- Actionlist offset is 1st arg to next dasm_put().
+ secpos = 1 -- The actionlist offset occupies a buffer position, too.
+end
+
+-- Put escaped word.
+local function wputw(n)
+ if n <= 0xffffff then waction("ESC") end
+ wputxw(n)
+end
+
+-- Reserve position for word.
+local function wpos()
+ local pos = #actlist+1
+ actlist[pos] = ""
+ return pos
+end
+
+-- Store word to reserved position.
+local function wputpos(pos, n)
+ assert(n >= 0 and n <= 0xffffffff and n % 1 == 0, "word out of range")
+ actlist[pos] = n
+end
+
+------------------------------------------------------------------------------
+
+-- Global label name -> global label number. With auto assignment on 1st use.
+local next_global = 20
+local map_global = setmetatable({}, { __index = function(t, name)
+ if not match(name, "^[%a_][%w_]*$") then werror("bad global label") end
+ local n = next_global
+ if n > 2047 then werror("too many global labels") end
+ next_global = n + 1
+ t[name] = n
+ return n
+end})
+
+-- Dump global labels.
+local function dumpglobals(out, lvl)
+ local t = {}
+ for name, n in pairs(map_global) do t[n] = name end
+ out:write("Global labels:\n")
+ for i=20,next_global-1 do
+ out:write(format(" %s\n", t[i]))
+ end
+ out:write("\n")
+end
+
+-- Write global label enum.
+local function writeglobals(out, prefix)
+ local t = {}
+ for name, n in pairs(map_global) do t[n] = name end
+ out:write("enum {\n")
+ for i=20,next_global-1 do
+ out:write(" ", prefix, t[i], ",\n")
+ end
+ out:write(" ", prefix, "_MAX\n};\n")
+end
+
+-- Write global label names.
+local function writeglobalnames(out, name)
+ local t = {}
+ for name, n in pairs(map_global) do t[n] = name end
+ out:write("static const char *const ", name, "[] = {\n")
+ for i=20,next_global-1 do
+ out:write(" \"", t[i], "\",\n")
+ end
+ out:write(" (const char *)0\n};\n")
+end
+
+------------------------------------------------------------------------------
+
+-- Extern label name -> extern label number. With auto assignment on 1st use.
+local next_extern = 0
+local map_extern_ = {}
+local map_extern = setmetatable({}, { __index = function(t, name)
+ -- No restrictions on the name for now.
+ local n = next_extern
+ if n > 2047 then werror("too many extern labels") end
+ next_extern = n + 1
+ t[name] = n
+ map_extern_[n] = name
+ return n
+end})
+
+-- Dump extern labels.
+local function dumpexterns(out, lvl)
+ out:write("Extern labels:\n")
+ for i=0,next_extern-1 do
+ out:write(format(" %s\n", map_extern_[i]))
+ end
+ out:write("\n")
+end
+
+-- Write extern label names.
+local function writeexternnames(out, name)
+ out:write("static const char *const ", name, "[] = {\n")
+ for i=0,next_extern-1 do
+ out:write(" \"", map_extern_[i], "\",\n")
+ end
+ out:write(" (const char *)0\n};\n")
+end
+
+------------------------------------------------------------------------------
+
+-- Arch-specific maps.
+local map_archdef = { sp = "r1" } -- Ext. register name -> int. name.
+
+local map_type = {} -- Type name -> { ctype, reg }
+local ctypenum = 0 -- Type number (for Dt... macros).
+
+-- Reverse defines for registers.
+function _M.revdef(s)
+ if s == "r1" then return "sp" end
+ return s
+end
+
+local map_cond = {
+ lt = 0, gt = 1, eq = 2, so = 3,
+ ge = 4, le = 5, ne = 6, ns = 7,
+}
+
+------------------------------------------------------------------------------
+
+local map_op, op_template
+
+local function op_alias(opname, f)
+ return function(params, nparams)
+ if not params then return "-> "..opname:sub(1, -3) end
+ f(params, nparams)
+ op_template(params, map_op[opname], nparams)
+ end
+end
+
+-- Template strings for PPC instructions.
+map_op = {
+ tdi_3 = "08000000ARI",
+ twi_3 = "0c000000ARI",
+ mulli_3 = "1c000000RRI",
+ subfic_3 = "20000000RRI",
+ cmplwi_3 = "28000000XRU",
+ cmplwi_2 = "28000000-RU",
+ cmpldi_3 = "28200000XRU",
+ cmpldi_2 = "28200000-RU",
+ cmpwi_3 = "2c000000XRI",
+ cmpwi_2 = "2c000000-RI",
+ cmpdi_3 = "2c200000XRI",
+ cmpdi_2 = "2c200000-RI",
+ addic_3 = "30000000RRI",
+ ["addic._3"] = "34000000RRI",
+ addi_3 = "38000000RR0I",
+ li_2 = "38000000RI",
+ la_2 = "38000000RD",
+ addis_3 = "3c000000RR0I",
+ lis_2 = "3c000000RI",
+ lus_2 = "3c000000RU",
+ bc_3 = "40000000AAK",
+ bcl_3 = "40000001AAK",
+ bdnz_1 = "42000000K",
+ bdz_1 = "42400000K",
+ sc_0 = "44000000",
+ b_1 = "48000000J",
+ bl_1 = "48000001J",
+ rlwimi_5 = "50000000RR~AAA.",
+ rlwinm_5 = "54000000RR~AAA.",
+ rlwnm_5 = "5c000000RR~RAA.",
+ ori_3 = "60000000RR~U",
+ nop_0 = "60000000",
+ oris_3 = "64000000RR~U",
+ xori_3 = "68000000RR~U",
+ xoris_3 = "6c000000RR~U",
+ ["andi._3"] = "70000000RR~U",
+ ["andis._3"] = "74000000RR~U",
+ lwz_2 = "80000000RD",
+ lwzu_2 = "84000000RD",
+ lbz_2 = "88000000RD",
+ lbzu_2 = "8c000000RD",
+ stw_2 = "90000000RD",
+ stwu_2 = "94000000RD",
+ stb_2 = "98000000RD",
+ stbu_2 = "9c000000RD",
+ lhz_2 = "a0000000RD",
+ lhzu_2 = "a4000000RD",
+ lha_2 = "a8000000RD",
+ lhau_2 = "ac000000RD",
+ sth_2 = "b0000000RD",
+ sthu_2 = "b4000000RD",
+ lmw_2 = "b8000000RD",
+ stmw_2 = "bc000000RD",
+ lfs_2 = "c0000000FD",
+ lfsu_2 = "c4000000FD",
+ lfd_2 = "c8000000FD",
+ lfdu_2 = "cc000000FD",
+ stfs_2 = "d0000000FD",
+ stfsu_2 = "d4000000FD",
+ stfd_2 = "d8000000FD",
+ stfdu_2 = "dc000000FD",
+ ld_2 = "e8000000RD", -- NYI: displacement must be divisible by 4.
+ ldu_2 = "e8000001RD",
+ lwa_2 = "e8000002RD",
+ std_2 = "f8000000RD",
+ stdu_2 = "f8000001RD",
+
+ subi_3 = op_alias("addi_3", function(p) p[3] = "-("..p[3]..")" end),
+ subis_3 = op_alias("addis_3", function(p) p[3] = "-("..p[3]..")" end),
+ subic_3 = op_alias("addic_3", function(p) p[3] = "-("..p[3]..")" end),
+ ["subic._3"] = op_alias("addic._3", function(p) p[3] = "-("..p[3]..")" end),
+
+ rotlwi_3 = op_alias("rlwinm_5", function(p)
+ p[4] = "0"; p[5] = "31"
+ end),
+ rotrwi_3 = op_alias("rlwinm_5", function(p)
+ p[3] = "32-("..p[3]..")"; p[4] = "0"; p[5] = "31"
+ end),
+ rotlw_3 = op_alias("rlwnm_5", function(p)
+ p[4] = "0"; p[5] = "31"
+ end),
+ slwi_3 = op_alias("rlwinm_5", function(p)
+ p[5] = "31-("..p[3]..")"; p[4] = "0"
+ end),
+ srwi_3 = op_alias("rlwinm_5", function(p)
+ p[4] = p[3]; p[3] = "32-("..p[3]..")"; p[5] = "31"
+ end),
+ clrlwi_3 = op_alias("rlwinm_5", function(p)
+ p[4] = p[3]; p[3] = "0"; p[5] = "31"
+ end),
+ clrrwi_3 = op_alias("rlwinm_5", function(p)
+ p[5] = "31-("..p[3]..")"; p[3] = "0"; p[4] = "0"
+ end),
+
+ -- Primary opcode 4:
+ mulhhwu_3 = "10000010RRR.",
+ machhwu_3 = "10000018RRR.",
+ mulhhw_3 = "10000050RRR.",
+ nmachhw_3 = "1000005cRRR.",
+ machhwsu_3 = "10000098RRR.",
+ machhws_3 = "100000d8RRR.",
+ nmachhws_3 = "100000dcRRR.",
+ mulchwu_3 = "10000110RRR.",
+ macchwu_3 = "10000118RRR.",
+ mulchw_3 = "10000150RRR.",
+ macchw_3 = "10000158RRR.",
+ nmacchw_3 = "1000015cRRR.",
+ macchwsu_3 = "10000198RRR.",
+ macchws_3 = "100001d8RRR.",
+ nmacchws_3 = "100001dcRRR.",
+ mullhw_3 = "10000350RRR.",
+ maclhw_3 = "10000358RRR.",
+ nmaclhw_3 = "1000035cRRR.",
+ maclhwsu_3 = "10000398RRR.",
+ maclhws_3 = "100003d8RRR.",
+ nmaclhws_3 = "100003dcRRR.",
+ machhwuo_3 = "10000418RRR.",
+ nmachhwo_3 = "1000045cRRR.",
+ machhwsuo_3 = "10000498RRR.",
+ machhwso_3 = "100004d8RRR.",
+ nmachhwso_3 = "100004dcRRR.",
+ macchwuo_3 = "10000518RRR.",
+ macchwo_3 = "10000558RRR.",
+ nmacchwo_3 = "1000055cRRR.",
+ macchwsuo_3 = "10000598RRR.",
+ macchwso_3 = "100005d8RRR.",
+ nmacchwso_3 = "100005dcRRR.",
+ maclhwo_3 = "10000758RRR.",
+ nmaclhwo_3 = "1000075cRRR.",
+ maclhwsuo_3 = "10000798RRR.",
+ maclhwso_3 = "100007d8RRR.",
+ nmaclhwso_3 = "100007dcRRR.",
+
+ vaddubm_3 = "10000000VVV",
+ vmaxub_3 = "10000002VVV",
+ vrlb_3 = "10000004VVV",
+ vcmpequb_3 = "10000006VVV",
+ vmuloub_3 = "10000008VVV",
+ vaddfp_3 = "1000000aVVV",
+ vmrghb_3 = "1000000cVVV",
+ vpkuhum_3 = "1000000eVVV",
+ vmhaddshs_4 = "10000020VVVV",
+ vmhraddshs_4 = "10000021VVVV",
+ vmladduhm_4 = "10000022VVVV",
+ vmsumubm_4 = "10000024VVVV",
+ vmsummbm_4 = "10000025VVVV",
+ vmsumuhm_4 = "10000026VVVV",
+ vmsumuhs_4 = "10000027VVVV",
+ vmsumshm_4 = "10000028VVVV",
+ vmsumshs_4 = "10000029VVVV",
+ vsel_4 = "1000002aVVVV",
+ vperm_4 = "1000002bVVVV",
+ vsldoi_4 = "1000002cVVVP",
+ vpermxor_4 = "1000002dVVVV",
+ vmaddfp_4 = "1000002eVVVV~",
+ vnmsubfp_4 = "1000002fVVVV~",
+ vaddeuqm_4 = "1000003cVVVV",
+ vaddecuq_4 = "1000003dVVVV",
+ vsubeuqm_4 = "1000003eVVVV",
+ vsubecuq_4 = "1000003fVVVV",
+ vadduhm_3 = "10000040VVV",
+ vmaxuh_3 = "10000042VVV",
+ vrlh_3 = "10000044VVV",
+ vcmpequh_3 = "10000046VVV",
+ vmulouh_3 = "10000048VVV",
+ vsubfp_3 = "1000004aVVV",
+ vmrghh_3 = "1000004cVVV",
+ vpkuwum_3 = "1000004eVVV",
+ vadduwm_3 = "10000080VVV",
+ vmaxuw_3 = "10000082VVV",
+ vrlw_3 = "10000084VVV",
+ vcmpequw_3 = "10000086VVV",
+ vmulouw_3 = "10000088VVV",
+ vmuluwm_3 = "10000089VVV",
+ vmrghw_3 = "1000008cVVV",
+ vpkuhus_3 = "1000008eVVV",
+ vaddudm_3 = "100000c0VVV",
+ vmaxud_3 = "100000c2VVV",
+ vrld_3 = "100000c4VVV",
+ vcmpeqfp_3 = "100000c6VVV",
+ vcmpequd_3 = "100000c7VVV",
+ vpkuwus_3 = "100000ceVVV",
+ vadduqm_3 = "10000100VVV",
+ vmaxsb_3 = "10000102VVV",
+ vslb_3 = "10000104VVV",
+ vmulosb_3 = "10000108VVV",
+ vrefp_2 = "1000010aV-V",
+ vmrglb_3 = "1000010cVVV",
+ vpkshus_3 = "1000010eVVV",
+ vaddcuq_3 = "10000140VVV",
+ vmaxsh_3 = "10000142VVV",
+ vslh_3 = "10000144VVV",
+ vmulosh_3 = "10000148VVV",
+ vrsqrtefp_2 = "1000014aV-V",
+ vmrglh_3 = "1000014cVVV",
+ vpkswus_3 = "1000014eVVV",
+ vaddcuw_3 = "10000180VVV",
+ vmaxsw_3 = "10000182VVV",
+ vslw_3 = "10000184VVV",
+ vmulosw_3 = "10000188VVV",
+ vexptefp_2 = "1000018aV-V",
+ vmrglw_3 = "1000018cVVV",
+ vpkshss_3 = "1000018eVVV",
+ vmaxsd_3 = "100001c2VVV",
+ vsl_3 = "100001c4VVV",
+ vcmpgefp_3 = "100001c6VVV",
+ vlogefp_2 = "100001caV-V",
+ vpkswss_3 = "100001ceVVV",
+ vadduhs_3 = "10000240VVV",
+ vminuh_3 = "10000242VVV",
+ vsrh_3 = "10000244VVV",
+ vcmpgtuh_3 = "10000246VVV",
+ vmuleuh_3 = "10000248VVV",
+ vrfiz_2 = "1000024aV-V",
+ vsplth_3 = "1000024cVV3",
+ vupkhsh_2 = "1000024eV-V",
+ vminuw_3 = "10000282VVV",
+ vminud_3 = "100002c2VVV",
+ vcmpgtud_3 = "100002c7VVV",
+ vrfim_2 = "100002caV-V",
+ vcmpgtsb_3 = "10000306VVV",
+ vcfux_3 = "1000030aVVA~",
+ vaddshs_3 = "10000340VVV",
+ vminsh_3 = "10000342VVV",
+ vsrah_3 = "10000344VVV",
+ vcmpgtsh_3 = "10000346VVV",
+ vmulesh_3 = "10000348VVV",
+ vcfsx_3 = "1000034aVVA~",
+ vspltish_2 = "1000034cVS",
+ vupkhpx_2 = "1000034eV-V",
+ vaddsws_3 = "10000380VVV",
+ vminsw_3 = "10000382VVV",
+ vsraw_3 = "10000384VVV",
+ vcmpgtsw_3 = "10000386VVV",
+ vmulesw_3 = "10000388VVV",
+ vctuxs_3 = "1000038aVVA~",
+ vspltisw_2 = "1000038cVS",
+ vminsd_3 = "100003c2VVV",
+ vsrad_3 = "100003c4VVV",
+ vcmpbfp_3 = "100003c6VVV",
+ vcmpgtsd_3 = "100003c7VVV",
+ vctsxs_3 = "100003caVVA~",
+ vupklpx_2 = "100003ceV-V",
+ vsububm_3 = "10000400VVV",
+ ["bcdadd._4"] = "10000401VVVy.",
+ vavgub_3 = "10000402VVV",
+ vand_3 = "10000404VVV",
+ ["vcmpequb._3"] = "10000406VVV",
+ vmaxfp_3 = "1000040aVVV",
+ vsubuhm_3 = "10000440VVV",
+ ["bcdsub._4"] = "10000441VVVy.",
+ vavguh_3 = "10000442VVV",
+ vandc_3 = "10000444VVV",
+ ["vcmpequh._3"] = "10000446VVV",
+ vminfp_3 = "1000044aVVV",
+ vpkudum_3 = "1000044eVVV",
+ vsubuwm_3 = "10000480VVV",
+ vavguw_3 = "10000482VVV",
+ vor_3 = "10000484VVV",
+ ["vcmpequw._3"] = "10000486VVV",
+ vpmsumw_3 = "10000488VVV",
+ ["vcmpeqfp._3"] = "100004c6VVV",
+ ["vcmpequd._3"] = "100004c7VVV",
+ vpkudus_3 = "100004ceVVV",
+ vavgsb_3 = "10000502VVV",
+ vavgsh_3 = "10000542VVV",
+ vorc_3 = "10000544VVV",
+ vbpermq_3 = "1000054cVVV",
+ vpksdus_3 = "1000054eVVV",
+ vavgsw_3 = "10000582VVV",
+ vsld_3 = "100005c4VVV",
+ ["vcmpgefp._3"] = "100005c6VVV",
+ vpksdss_3 = "100005ceVVV",
+ vsububs_3 = "10000600VVV",
+ mfvscr_1 = "10000604V--",
+ vsum4ubs_3 = "10000608VVV",
+ vsubuhs_3 = "10000640VVV",
+ mtvscr_1 = "10000644--V",
+ ["vcmpgtuh._3"] = "10000646VVV",
+ vsum4shs_3 = "10000648VVV",
+ vupkhsw_2 = "1000064eV-V",
+ vsubuws_3 = "10000680VVV",
+ vshasigmaw_4 = "10000682VVYp",
+ veqv_3 = "10000684VVV",
+ vsum2sws_3 = "10000688VVV",
+ vmrgow_3 = "1000068cVVV",
+ vshasigmad_4 = "100006c2VVYp",
+ vsrd_3 = "100006c4VVV",
+ ["vcmpgtud._3"] = "100006c7VVV",
+ vupklsw_2 = "100006ceV-V",
+ vupkslw_2 = "100006ceV-V",
+ vsubsbs_3 = "10000700VVV",
+ vclzb_2 = "10000702V-V",
+ vpopcntb_2 = "10000703V-V",
+ ["vcmpgtsb._3"] = "10000706VVV",
+ vsum4sbs_3 = "10000708VVV",
+ vsubshs_3 = "10000740VVV",
+ vclzh_2 = "10000742V-V",
+ vpopcnth_2 = "10000743V-V",
+ ["vcmpgtsh._3"] = "10000746VVV",
+ vsubsws_3 = "10000780VVV",
+ vclzw_2 = "10000782V-V",
+ vpopcntw_2 = "10000783V-V",
+ ["vcmpgtsw._3"] = "10000786VVV",
+ vsumsws_3 = "10000788VVV",
+ vmrgew_3 = "1000078cVVV",
+ vclzd_2 = "100007c2V-V",
+ vpopcntd_2 = "100007c3V-V",
+ ["vcmpbfp._3"] = "100007c6VVV",
+ ["vcmpgtsd._3"] = "100007c7VVV",
+
+ -- Primary opcode 19:
+ mcrf_2 = "4c000000XX",
+ isync_0 = "4c00012c",
+ crnor_3 = "4c000042CCC",
+ crnot_2 = "4c000042CC=",
+ crandc_3 = "4c000102CCC",
+ crxor_3 = "4c000182CCC",
+ crclr_1 = "4c000182C==",
+ crnand_3 = "4c0001c2CCC",
+ crand_3 = "4c000202CCC",
+ creqv_3 = "4c000242CCC",
+ crset_1 = "4c000242C==",
+ crorc_3 = "4c000342CCC",
+ cror_3 = "4c000382CCC",
+ crmove_2 = "4c000382CC=",
+ bclr_2 = "4c000020AA",
+ bclrl_2 = "4c000021AA",
+ bcctr_2 = "4c000420AA",
+ bcctrl_2 = "4c000421AA",
+ bctar_2 = "4c000460AA",
+ bctarl_2 = "4c000461AA",
+ blr_0 = "4e800020",
+ blrl_0 = "4e800021",
+ bctr_0 = "4e800420",
+ bctrl_0 = "4e800421",
+
+ -- Primary opcode 31:
+ cmpw_3 = "7c000000XRR",
+ cmpw_2 = "7c000000-RR",
+ cmpd_3 = "7c200000XRR",
+ cmpd_2 = "7c200000-RR",
+ tw_3 = "7c000008ARR",
+ lvsl_3 = "7c00000cVRR",
+ subfc_3 = "7c000010RRR.",
+ subc_3 = "7c000010RRR~.",
+ mulhdu_3 = "7c000012RRR.",
+ addc_3 = "7c000014RRR.",
+ mulhwu_3 = "7c000016RRR.",
+ isel_4 = "7c00001eRRRC",
+ isellt_3 = "7c00001eRRR",
+ iselgt_3 = "7c00005eRRR",
+ iseleq_3 = "7c00009eRRR",
+ mfcr_1 = "7c000026R",
+ mfocrf_2 = "7c100026RG",
+ mtcrf_2 = "7c000120GR",
+ mtocrf_2 = "7c100120GR",
+ lwarx_3 = "7c000028RR0R",
+ ldx_3 = "7c00002aRR0R",
+ lwzx_3 = "7c00002eRR0R",
+ slw_3 = "7c000030RR~R.",
+ cntlzw_2 = "7c000034RR~",
+ sld_3 = "7c000036RR~R.",
+ and_3 = "7c000038RR~R.",
+ cmplw_3 = "7c000040XRR",
+ cmplw_2 = "7c000040-RR",
+ cmpld_3 = "7c200040XRR",
+ cmpld_2 = "7c200040-RR",
+ lvsr_3 = "7c00004cVRR",
+ subf_3 = "7c000050RRR.",
+ sub_3 = "7c000050RRR~.",
+ lbarx_3 = "7c000068RR0R",
+ ldux_3 = "7c00006aRR0R",
+ dcbst_2 = "7c00006c-RR",
+ lwzux_3 = "7c00006eRR0R",
+ cntlzd_2 = "7c000074RR~",
+ andc_3 = "7c000078RR~R.",
+ td_3 = "7c000088ARR",
+ lvewx_3 = "7c00008eVRR",
+ mulhd_3 = "7c000092RRR.",
+ addg6s_3 = "7c000094RRR",
+ mulhw_3 = "7c000096RRR.",
+ dlmzb_3 = "7c00009cRR~R.",
+ ldarx_3 = "7c0000a8RR0R",
+ dcbf_2 = "7c0000ac-RR",
+ lbzx_3 = "7c0000aeRR0R",
+ lvx_3 = "7c0000ceVRR",
+ neg_2 = "7c0000d0RR.",
+ lharx_3 = "7c0000e8RR0R",
+ lbzux_3 = "7c0000eeRR0R",
+ popcntb_2 = "7c0000f4RR~",
+ not_2 = "7c0000f8RR~%.",
+ nor_3 = "7c0000f8RR~R.",
+ stvebx_3 = "7c00010eVRR",
+ subfe_3 = "7c000110RRR.",
+ sube_3 = "7c000110RRR~.",
+ adde_3 = "7c000114RRR.",
+ stdx_3 = "7c00012aRR0R",
+ ["stwcx._3"] = "7c00012dRR0R.",
+ stwx_3 = "7c00012eRR0R",
+ prtyw_2 = "7c000134RR~",
+ stvehx_3 = "7c00014eVRR",
+ stdux_3 = "7c00016aRR0R",
+ ["stqcx._3"] = "7c00016dR:R0R.",
+ stwux_3 = "7c00016eRR0R",
+ prtyd_2 = "7c000174RR~",
+ stvewx_3 = "7c00018eVRR",
+ subfze_2 = "7c000190RR.",
+ addze_2 = "7c000194RR.",
+ ["stdcx._3"] = "7c0001adRR0R.",
+ stbx_3 = "7c0001aeRR0R",
+ stvx_3 = "7c0001ceVRR",
+ subfme_2 = "7c0001d0RR.",
+ mulld_3 = "7c0001d2RRR.",
+ addme_2 = "7c0001d4RR.",
+ mullw_3 = "7c0001d6RRR.",
+ dcbtst_2 = "7c0001ec-RR",
+ stbux_3 = "7c0001eeRR0R",
+ bpermd_3 = "7c0001f8RR~R",
+ lvepxl_3 = "7c00020eVRR",
+ add_3 = "7c000214RRR.",
+ lqarx_3 = "7c000228R:R0R",
+ dcbt_2 = "7c00022c-RR",
+ lhzx_3 = "7c00022eRR0R",
+ cdtbcd_2 = "7c000234RR~",
+ eqv_3 = "7c000238RR~R.",
+ lvepx_3 = "7c00024eVRR",
+ eciwx_3 = "7c00026cRR0R",
+ lhzux_3 = "7c00026eRR0R",
+ cbcdtd_2 = "7c000274RR~",
+ xor_3 = "7c000278RR~R.",
+ mfspefscr_1 = "7c0082a6R",
+ mfxer_1 = "7c0102a6R",
+ mflr_1 = "7c0802a6R",
+ mfctr_1 = "7c0902a6R",
+ lwax_3 = "7c0002aaRR0R",
+ lhax_3 = "7c0002aeRR0R",
+ mftb_1 = "7c0c42e6R",
+ mftbu_1 = "7c0d42e6R",
+ lvxl_3 = "7c0002ceVRR",
+ lwaux_3 = "7c0002eaRR0R",
+ lhaux_3 = "7c0002eeRR0R",
+ popcntw_2 = "7c0002f4RR~",
+ divdeu_3 = "7c000312RRR.",
+ divweu_3 = "7c000316RRR.",
+ sthx_3 = "7c00032eRR0R",
+ orc_3 = "7c000338RR~R.",
+ ecowx_3 = "7c00036cRR0R",
+ sthux_3 = "7c00036eRR0R",
+ or_3 = "7c000378RR~R.",
+ mr_2 = "7c000378RR~%.",
+ divdu_3 = "7c000392RRR.",
+ divwu_3 = "7c000396RRR.",
+ mtspefscr_1 = "7c0083a6R",
+ mtxer_1 = "7c0103a6R",
+ mtlr_1 = "7c0803a6R",
+ mtctr_1 = "7c0903a6R",
+ dcbi_2 = "7c0003ac-RR",
+ nand_3 = "7c0003b8RR~R.",
+ dsn_2 = "7c0003c6-RR",
+ stvxl_3 = "7c0003ceVRR",
+ divd_3 = "7c0003d2RRR.",
+ divw_3 = "7c0003d6RRR.",
+ popcntd_2 = "7c0003f4RR~",
+ cmpb_3 = "7c0003f8RR~R.",
+ mcrxr_1 = "7c000400X",
+ lbdx_3 = "7c000406RRR",
+ subfco_3 = "7c000410RRR.",
+ subco_3 = "7c000410RRR~.",
+ addco_3 = "7c000414RRR.",
+ ldbrx_3 = "7c000428RR0R",
+ lswx_3 = "7c00042aRR0R",
+ lwbrx_3 = "7c00042cRR0R",
+ lfsx_3 = "7c00042eFR0R",
+ srw_3 = "7c000430RR~R.",
+ srd_3 = "7c000436RR~R.",
+ lhdx_3 = "7c000446RRR",
+ subfo_3 = "7c000450RRR.",
+ subo_3 = "7c000450RRR~.",
+ lfsux_3 = "7c00046eFR0R",
+ lwdx_3 = "7c000486RRR",
+ lswi_3 = "7c0004aaRR0A",
+ sync_0 = "7c0004ac",
+ lwsync_0 = "7c2004ac",
+ ptesync_0 = "7c4004ac",
+ lfdx_3 = "7c0004aeFR0R",
+ lddx_3 = "7c0004c6RRR",
+ nego_2 = "7c0004d0RR.",
+ lfdux_3 = "7c0004eeFR0R",
+ stbdx_3 = "7c000506RRR",
+ subfeo_3 = "7c000510RRR.",
+ subeo_3 = "7c000510RRR~.",
+ addeo_3 = "7c000514RRR.",
+ stdbrx_3 = "7c000528RR0R",
+ stswx_3 = "7c00052aRR0R",
+ stwbrx_3 = "7c00052cRR0R",
+ stfsx_3 = "7c00052eFR0R",
+ sthdx_3 = "7c000546RRR",
+ ["stbcx._3"] = "7c00056dRRR",
+ stfsux_3 = "7c00056eFR0R",
+ stwdx_3 = "7c000586RRR",
+ subfzeo_2 = "7c000590RR.",
+ addzeo_2 = "7c000594RR.",
+ stswi_3 = "7c0005aaRR0A",
+ ["sthcx._3"] = "7c0005adRRR",
+ stfdx_3 = "7c0005aeFR0R",
+ stddx_3 = "7c0005c6RRR",
+ subfmeo_2 = "7c0005d0RR.",
+ mulldo_3 = "7c0005d2RRR.",
+ addmeo_2 = "7c0005d4RR.",
+ mullwo_3 = "7c0005d6RRR.",
+ dcba_2 = "7c0005ec-RR",
+ stfdux_3 = "7c0005eeFR0R",
+ stvepxl_3 = "7c00060eVRR",
+ addo_3 = "7c000614RRR.",
+ lhbrx_3 = "7c00062cRR0R",
+ lfdpx_3 = "7c00062eF:RR",
+ sraw_3 = "7c000630RR~R.",
+ srad_3 = "7c000634RR~R.",
+ lfddx_3 = "7c000646FRR",
+ stvepx_3 = "7c00064eVRR",
+ srawi_3 = "7c000670RR~A.",
+ sradi_3 = "7c000674RR~H.",
+ eieio_0 = "7c0006ac",
+ lfiwax_3 = "7c0006aeFR0R",
+ divdeuo_3 = "7c000712RRR.",
+ divweuo_3 = "7c000716RRR.",
+ sthbrx_3 = "7c00072cRR0R",
+ stfdpx_3 = "7c00072eF:RR",
+ extsh_2 = "7c000734RR~.",
+ stfddx_3 = "7c000746FRR",
+ divdeo_3 = "7c000752RRR.",
+ divweo_3 = "7c000756RRR.",
+ extsb_2 = "7c000774RR~.",
+ divduo_3 = "7c000792RRR.",
+ divwou_3 = "7c000796RRR.",
+ icbi_2 = "7c0007ac-RR",
+ stfiwx_3 = "7c0007aeFR0R",
+ extsw_2 = "7c0007b4RR~.",
+ divdo_3 = "7c0007d2RRR.",
+ divwo_3 = "7c0007d6RRR.",
+ dcbz_2 = "7c0007ec-RR",
+
+ ["tbegin._1"] = "7c00051d1",
+ ["tbegin._0"] = "7c00051d",
+ ["tend._1"] = "7c00055dY",
+ ["tend._0"] = "7c00055d",
+ ["tendall._0"] = "7e00055d",
+ tcheck_1 = "7c00059cX",
+ ["tsr._1"] = "7c0005dd1",
+ ["tsuspend._0"] = "7c0005dd",
+ ["tresume._0"] = "7c2005dd",
+ ["tabortwc._3"] = "7c00061dARR",
+ ["tabortdc._3"] = "7c00065dARR",
+ ["tabortwci._3"] = "7c00069dARS",
+ ["tabortdci._3"] = "7c0006ddARS",
+ ["tabort._1"] = "7c00071d-R-",
+ ["treclaim._1"] = "7c00075d-R",
+ ["trechkpt._0"] = "7c0007dd",
+
+ lxsiwzx_3 = "7c000018QRR",
+ lxsiwax_3 = "7c000098QRR",
+ mfvsrd_2 = "7c000066-Rq",
+ mfvsrwz_2 = "7c0000e6-Rq",
+ stxsiwx_3 = "7c000118QRR",
+ mtvsrd_2 = "7c000166QR",
+ mtvsrwa_2 = "7c0001a6QR",
+ lxvdsx_3 = "7c000298QRR",
+ lxsspx_3 = "7c000418QRR",
+ lxsdx_3 = "7c000498QRR",
+ stxsspx_3 = "7c000518QRR",
+ stxsdx_3 = "7c000598QRR",
+ lxvw4x_3 = "7c000618QRR",
+ lxvd2x_3 = "7c000698QRR",
+ stxvw4x_3 = "7c000718QRR",
+ stxvd2x_3 = "7c000798QRR",
+
+ -- Primary opcode 30:
+ rldicl_4 = "78000000RR~HM.",
+ rldicr_4 = "78000004RR~HM.",
+ rldic_4 = "78000008RR~HM.",
+ rldimi_4 = "7800000cRR~HM.",
+ rldcl_4 = "78000010RR~RM.",
+ rldcr_4 = "78000012RR~RM.",
+
+ rotldi_3 = op_alias("rldicl_4", function(p)
+ p[4] = "0"
+ end),
+ rotrdi_3 = op_alias("rldicl_4", function(p)
+ p[3] = "64-("..p[3]..")"; p[4] = "0"
+ end),
+ rotld_3 = op_alias("rldcl_4", function(p)
+ p[4] = "0"
+ end),
+ sldi_3 = op_alias("rldicr_4", function(p)
+ p[4] = "63-("..p[3]..")"
+ end),
+ srdi_3 = op_alias("rldicl_4", function(p)
+ p[4] = p[3]; p[3] = "64-("..p[3]..")"
+ end),
+ clrldi_3 = op_alias("rldicl_4", function(p)
+ p[4] = p[3]; p[3] = "0"
+ end),
+ clrrdi_3 = op_alias("rldicr_4", function(p)
+ p[4] = "63-("..p[3]..")"; p[3] = "0"
+ end),
+
+ -- Primary opcode 56:
+ lq_2 = "e0000000R:D", -- NYI: displacement must be divisible by 8.
+
+ -- Primary opcode 57:
+ lfdp_2 = "e4000000F:D", -- NYI: displacement must be divisible by 4.
+
+ -- Primary opcode 59:
+ fdivs_3 = "ec000024FFF.",
+ fsubs_3 = "ec000028FFF.",
+ fadds_3 = "ec00002aFFF.",
+ fsqrts_2 = "ec00002cF-F.",
+ fres_2 = "ec000030F-F.",
+ fmuls_3 = "ec000032FF-F.",
+ frsqrtes_2 = "ec000034F-F.",
+ fmsubs_4 = "ec000038FFFF~.",
+ fmadds_4 = "ec00003aFFFF~.",
+ fnmsubs_4 = "ec00003cFFFF~.",
+ fnmadds_4 = "ec00003eFFFF~.",
+ fcfids_2 = "ec00069cF-F.",
+ fcfidus_2 = "ec00079cF-F.",
+
+ dadd_3 = "ec000004FFF.",
+ dqua_4 = "ec000006FFFZ.",
+ dmul_3 = "ec000044FFF.",
+ drrnd_4 = "ec000046FFFZ.",
+ dscli_3 = "ec000084FF6.",
+ dquai_4 = "ec000086SF~FZ.",
+ dscri_3 = "ec0000c4FF6.",
+ drintx_4 = "ec0000c61F~FZ.",
+ dcmpo_3 = "ec000104XFF",
+ dtstex_3 = "ec000144XFF",
+ dtstdc_3 = "ec000184XF6",
+ dtstdg_3 = "ec0001c4XF6",
+ drintn_4 = "ec0001c61F~FZ.",
+ dctdp_2 = "ec000204F-F.",
+ dctfix_2 = "ec000244F-F.",
+ ddedpd_3 = "ec000284ZF~F.",
+ dxex_2 = "ec0002c4F-F.",
+ dsub_3 = "ec000404FFF.",
+ ddiv_3 = "ec000444FFF.",
+ dcmpu_3 = "ec000504XFF",
+ dtstsf_3 = "ec000544XFF",
+ drsp_2 = "ec000604F-F.",
+ dcffix_2 = "ec000644F-F.",
+ denbcd_3 = "ec000684YF~F.",
+ diex_3 = "ec0006c4FFF.",
+
+ -- Primary opcode 60:
+ xsaddsp_3 = "f0000000QQQ",
+ xsmaddasp_3 = "f0000008QQQ",
+ xxsldwi_4 = "f0000010QQQz",
+ xsrsqrtesp_2 = "f0000028Q-Q",
+ xssqrtsp_2 = "f000002cQ-Q",
+ xxsel_4 = "f0000030QQQQ",
+ xssubsp_3 = "f0000040QQQ",
+ xsmaddmsp_3 = "f0000048QQQ",
+ xxpermdi_4 = "f0000050QQQz",
+ xsresp_2 = "f0000068Q-Q",
+ xsmulsp_3 = "f0000080QQQ",
+ xsmsubasp_3 = "f0000088QQQ",
+ xxmrghw_3 = "f0000090QQQ",
+ xsdivsp_3 = "f00000c0QQQ",
+ xsmsubmsp_3 = "f00000c8QQQ",
+ xsadddp_3 = "f0000100QQQ",
+ xsmaddadp_3 = "f0000108QQQ",
+ xscmpudp_3 = "f0000118XQQ",
+ xscvdpuxws_2 = "f0000120Q-Q",
+ xsrdpi_2 = "f0000124Q-Q",
+ xsrsqrtedp_2 = "f0000128Q-Q",
+ xssqrtdp_2 = "f000012cQ-Q",
+ xssubdp_3 = "f0000140QQQ",
+ xsmaddmdp_3 = "f0000148QQQ",
+ xscmpodp_3 = "f0000158XQQ",
+ xscvdpsxws_2 = "f0000160Q-Q",
+ xsrdpiz_2 = "f0000164Q-Q",
+ xsredp_2 = "f0000168Q-Q",
+ xsmuldp_3 = "f0000180QQQ",
+ xsmsubadp_3 = "f0000188QQQ",
+ xxmrglw_3 = "f0000190QQQ",
+ xsrdpip_2 = "f00001a4Q-Q",
+ xstsqrtdp_2 = "f00001a8X-Q",
+ xsrdpic_2 = "f00001acQ-Q",
+ xsdivdp_3 = "f00001c0QQQ",
+ xsmsubmdp_3 = "f00001c8QQQ",
+ xsrdpim_2 = "f00001e4Q-Q",
+ xstdivdp_3 = "f00001e8XQQ",
+ xvaddsp_3 = "f0000200QQQ",
+ xvmaddasp_3 = "f0000208QQQ",
+ xvcmpeqsp_3 = "f0000218QQQ",
+ xvcvspuxws_2 = "f0000220Q-Q",
+ xvrspi_2 = "f0000224Q-Q",
+ xvrsqrtesp_2 = "f0000228Q-Q",
+ xvsqrtsp_2 = "f000022cQ-Q",
+ xvsubsp_3 = "f0000240QQQ",
+ xvmaddmsp_3 = "f0000248QQQ",
+ xvcmpgtsp_3 = "f0000258QQQ",
+ xvcvspsxws_2 = "f0000260Q-Q",
+ xvrspiz_2 = "f0000264Q-Q",
+ xvresp_2 = "f0000268Q-Q",
+ xvmulsp_3 = "f0000280QQQ",
+ xvmsubasp_3 = "f0000288QQQ",
+ xxspltw_3 = "f0000290QQg~",
+ xvcmpgesp_3 = "f0000298QQQ",
+ xvcvuxwsp_2 = "f00002a0Q-Q",
+ xvrspip_2 = "f00002a4Q-Q",
+ xvtsqrtsp_2 = "f00002a8X-Q",
+ xvrspic_2 = "f00002acQ-Q",
+ xvdivsp_3 = "f00002c0QQQ",
+ xvmsubmsp_3 = "f00002c8QQQ",
+ xvcvsxwsp_2 = "f00002e0Q-Q",
+ xvrspim_2 = "f00002e4Q-Q",
+ xvtdivsp_3 = "f00002e8XQQ",
+ xvadddp_3 = "f0000300QQQ",
+ xvmaddadp_3 = "f0000308QQQ",
+ xvcmpeqdp_3 = "f0000318QQQ",
+ xvcvdpuxws_2 = "f0000320Q-Q",
+ xvrdpi_2 = "f0000324Q-Q",
+ xvrsqrtedp_2 = "f0000328Q-Q",
+ xvsqrtdp_2 = "f000032cQ-Q",
+ xvsubdp_3 = "f0000340QQQ",
+ xvmaddmdp_3 = "f0000348QQQ",
+ xvcmpgtdp_3 = "f0000358QQQ",
+ xvcvdpsxws_2 = "f0000360Q-Q",
+ xvrdpiz_2 = "f0000364Q-Q",
+ xvredp_2 = "f0000368Q-Q",
+ xvmuldp_3 = "f0000380QQQ",
+ xvmsubadp_3 = "f0000388QQQ",
+ xvcmpgedp_3 = "f0000398QQQ",
+ xvcvuxwdp_2 = "f00003a0Q-Q",
+ xvrdpip_2 = "f00003a4Q-Q",
+ xvtsqrtdp_2 = "f00003a8X-Q",
+ xvrdpic_2 = "f00003acQ-Q",
+ xvdivdp_3 = "f00003c0QQQ",
+ xvmsubmdp_3 = "f00003c8QQQ",
+ xvcvsxwdp_2 = "f00003e0Q-Q",
+ xvrdpim_2 = "f00003e4Q-Q",
+ xvtdivdp_3 = "f00003e8XQQ",
+ xsnmaddasp_3 = "f0000408QQQ",
+ xxland_3 = "f0000410QQQ",
+ xscvdpsp_2 = "f0000424Q-Q",
+ xscvdpspn_2 = "f000042cQ-Q",
+ xsnmaddmsp_3 = "f0000448QQQ",
+ xxlandc_3 = "f0000450QQQ",
+ xsrsp_2 = "f0000464Q-Q",
+ xsnmsubasp_3 = "f0000488QQQ",
+ xxlor_3 = "f0000490QQQ",
+ xscvuxdsp_2 = "f00004a0Q-Q",
+ xsnmsubmsp_3 = "f00004c8QQQ",
+ xxlxor_3 = "f00004d0QQQ",
+ xscvsxdsp_2 = "f00004e0Q-Q",
+ xsmaxdp_3 = "f0000500QQQ",
+ xsnmaddadp_3 = "f0000508QQQ",
+ xxlnor_3 = "f0000510QQQ",
+ xscvdpuxds_2 = "f0000520Q-Q",
+ xscvspdp_2 = "f0000524Q-Q",
+ xscvspdpn_2 = "f000052cQ-Q",
+ xsmindp_3 = "f0000540QQQ",
+ xsnmaddmdp_3 = "f0000548QQQ",
+ xxlorc_3 = "f0000550QQQ",
+ xscvdpsxds_2 = "f0000560Q-Q",
+ xsabsdp_2 = "f0000564Q-Q",
+ xscpsgndp_3 = "f0000580QQQ",
+ xsnmsubadp_3 = "f0000588QQQ",
+ xxlnand_3 = "f0000590QQQ",
+ xscvuxddp_2 = "f00005a0Q-Q",
+ xsnabsdp_2 = "f00005a4Q-Q",
+ xsnmsubmdp_3 = "f00005c8QQQ",
+ xxleqv_3 = "f00005d0QQQ",
+ xscvsxddp_2 = "f00005e0Q-Q",
+ xsnegdp_2 = "f00005e4Q-Q",
+ xvmaxsp_3 = "f0000600QQQ",
+ xvnmaddasp_3 = "f0000608QQQ",
+ ["xvcmpeqsp._3"] = "f0000618QQQ",
+ xvcvspuxds_2 = "f0000620Q-Q",
+ xvcvdpsp_2 = "f0000624Q-Q",
+ xvminsp_3 = "f0000640QQQ",
+ xvnmaddmsp_3 = "f0000648QQQ",
+ ["xvcmpgtsp._3"] = "f0000658QQQ",
+ xvcvspsxds_2 = "f0000660Q-Q",
+ xvabssp_2 = "f0000664Q-Q",
+ xvcpsgnsp_3 = "f0000680QQQ",
+ xvnmsubasp_3 = "f0000688QQQ",
+ ["xvcmpgesp._3"] = "f0000698QQQ",
+ xvcvuxdsp_2 = "f00006a0Q-Q",
+ xvnabssp_2 = "f00006a4Q-Q",
+ xvnmsubmsp_3 = "f00006c8QQQ",
+ xvcvsxdsp_2 = "f00006e0Q-Q",
+ xvnegsp_2 = "f00006e4Q-Q",
+ xvmaxdp_3 = "f0000700QQQ",
+ xvnmaddadp_3 = "f0000708QQQ",
+ ["xvcmpeqdp._3"] = "f0000718QQQ",
+ xvcvdpuxds_2 = "f0000720Q-Q",
+ xvcvspdp_2 = "f0000724Q-Q",
+ xvmindp_3 = "f0000740QQQ",
+ xvnmaddmdp_3 = "f0000748QQQ",
+ ["xvcmpgtdp._3"] = "f0000758QQQ",
+ xvcvdpsxds_2 = "f0000760Q-Q",
+ xvabsdp_2 = "f0000764Q-Q",
+ xvcpsgndp_3 = "f0000780QQQ",
+ xvnmsubadp_3 = "f0000788QQQ",
+ ["xvcmpgedp._3"] = "f0000798QQQ",
+ xvcvuxddp_2 = "f00007a0Q-Q",
+ xvnabsdp_2 = "f00007a4Q-Q",
+ xvnmsubmdp_3 = "f00007c8QQQ",
+ xvcvsxddp_2 = "f00007e0Q-Q",
+ xvnegdp_2 = "f00007e4Q-Q",
+
+ -- Primary opcode 61:
+ stfdp_2 = "f4000000F:D", -- NYI: displacement must be divisible by 4.
+
+ -- Primary opcode 62:
+ stq_2 = "f8000002R:D", -- NYI: displacement must be divisible by 8.
+
+ -- Primary opcode 63:
+ fdiv_3 = "fc000024FFF.",
+ fsub_3 = "fc000028FFF.",
+ fadd_3 = "fc00002aFFF.",
+ fsqrt_2 = "fc00002cF-F.",
+ fsel_4 = "fc00002eFFFF~.",
+ fre_2 = "fc000030F-F.",
+ fmul_3 = "fc000032FF-F.",
+ frsqrte_2 = "fc000034F-F.",
+ fmsub_4 = "fc000038FFFF~.",
+ fmadd_4 = "fc00003aFFFF~.",
+ fnmsub_4 = "fc00003cFFFF~.",
+ fnmadd_4 = "fc00003eFFFF~.",
+ fcmpu_3 = "fc000000XFF",
+ fcpsgn_3 = "fc000010FFF.",
+ fcmpo_3 = "fc000040XFF",
+ mtfsb1_1 = "fc00004cA",
+ fneg_2 = "fc000050F-F.",
+ mcrfs_2 = "fc000080XX",
+ mtfsb0_1 = "fc00008cA",
+ fmr_2 = "fc000090F-F.",
+ frsp_2 = "fc000018F-F.",
+ fctiw_2 = "fc00001cF-F.",
+ fctiwz_2 = "fc00001eF-F.",
+ ftdiv_2 = "fc000100X-F.",
+ fctiwu_2 = "fc00011cF-F.",
+ fctiwuz_2 = "fc00011eF-F.",
+ mtfsfi_2 = "fc00010cAA", -- NYI: upshift.
+ fnabs_2 = "fc000110F-F.",
+ ftsqrt_2 = "fc000140X-F.",
+ fabs_2 = "fc000210F-F.",
+ frin_2 = "fc000310F-F.",
+ friz_2 = "fc000350F-F.",
+ frip_2 = "fc000390F-F.",
+ frim_2 = "fc0003d0F-F.",
+ mffs_1 = "fc00048eF.",
+ -- NYI: mtfsf, mtfsb0, mtfsb1.
+ fctid_2 = "fc00065cF-F.",
+ fctidz_2 = "fc00065eF-F.",
+ fmrgow_3 = "fc00068cFFF",
+ fcfid_2 = "fc00069cF-F.",
+ fctidu_2 = "fc00075cF-F.",
+ fctiduz_2 = "fc00075eF-F.",
+ fmrgew_3 = "fc00078cFFF",
+ fcfidu_2 = "fc00079cF-F.",
+
+ daddq_3 = "fc000004F:F:F:.",
+ dquaq_4 = "fc000006F:F:F:Z.",
+ dmulq_3 = "fc000044F:F:F:.",
+ drrndq_4 = "fc000046F:F:F:Z.",
+ dscliq_3 = "fc000084F:F:6.",
+ dquaiq_4 = "fc000086SF:~F:Z.",
+ dscriq_3 = "fc0000c4F:F:6.",
+ drintxq_4 = "fc0000c61F:~F:Z.",
+ dcmpoq_3 = "fc000104XF:F:",
+ dtstexq_3 = "fc000144XF:F:",
+ dtstdcq_3 = "fc000184XF:6",
+ dtstdgq_3 = "fc0001c4XF:6",
+ drintnq_4 = "fc0001c61F:~F:Z.",
+ dctqpq_2 = "fc000204F:-F:.",
+ dctfixq_2 = "fc000244F:-F:.",
+ ddedpdq_3 = "fc000284ZF:~F:.",
+ dxexq_2 = "fc0002c4F:-F:.",
+ dsubq_3 = "fc000404F:F:F:.",
+ ddivq_3 = "fc000444F:F:F:.",
+ dcmpuq_3 = "fc000504XF:F:",
+ dtstsfq_3 = "fc000544XF:F:",
+ drdpq_2 = "fc000604F:-F:.",
+ dcffixq_2 = "fc000644F:-F:.",
+ denbcdq_3 = "fc000684YF:~F:.",
+ diexq_3 = "fc0006c4F:FF:.",
+
+ -- Primary opcode 4, SPE APU extension:
+ evaddw_3 = "10000200RRR",
+ evaddiw_3 = "10000202RAR~",
+ evsubw_3 = "10000204RRR~",
+ evsubiw_3 = "10000206RAR~",
+ evabs_2 = "10000208RR",
+ evneg_2 = "10000209RR",
+ evextsb_2 = "1000020aRR",
+ evextsh_2 = "1000020bRR",
+ evrndw_2 = "1000020cRR",
+ evcntlzw_2 = "1000020dRR",
+ evcntlsw_2 = "1000020eRR",
+ brinc_3 = "1000020fRRR",
+ evand_3 = "10000211RRR",
+ evandc_3 = "10000212RRR",
+ evxor_3 = "10000216RRR",
+ evor_3 = "10000217RRR",
+ evmr_2 = "10000217RR=",
+ evnor_3 = "10000218RRR",
+ evnot_2 = "10000218RR=",
+ eveqv_3 = "10000219RRR",
+ evorc_3 = "1000021bRRR",
+ evnand_3 = "1000021eRRR",
+ evsrwu_3 = "10000220RRR",
+ evsrws_3 = "10000221RRR",
+ evsrwiu_3 = "10000222RRA",
+ evsrwis_3 = "10000223RRA",
+ evslw_3 = "10000224RRR",
+ evslwi_3 = "10000226RRA",
+ evrlw_3 = "10000228RRR",
+ evsplati_2 = "10000229RS",
+ evrlwi_3 = "1000022aRRA",
+ evsplatfi_2 = "1000022bRS",
+ evmergehi_3 = "1000022cRRR",
+ evmergelo_3 = "1000022dRRR",
+ evcmpgtu_3 = "10000230XRR",
+ evcmpgtu_2 = "10000230-RR",
+ evcmpgts_3 = "10000231XRR",
+ evcmpgts_2 = "10000231-RR",
+ evcmpltu_3 = "10000232XRR",
+ evcmpltu_2 = "10000232-RR",
+ evcmplts_3 = "10000233XRR",
+ evcmplts_2 = "10000233-RR",
+ evcmpeq_3 = "10000234XRR",
+ evcmpeq_2 = "10000234-RR",
+ evsel_4 = "10000278RRRW",
+ evsel_3 = "10000278RRR",
+ evfsadd_3 = "10000280RRR",
+ evfssub_3 = "10000281RRR",
+ evfsabs_2 = "10000284RR",
+ evfsnabs_2 = "10000285RR",
+ evfsneg_2 = "10000286RR",
+ evfsmul_3 = "10000288RRR",
+ evfsdiv_3 = "10000289RRR",
+ evfscmpgt_3 = "1000028cXRR",
+ evfscmpgt_2 = "1000028c-RR",
+ evfscmplt_3 = "1000028dXRR",
+ evfscmplt_2 = "1000028d-RR",
+ evfscmpeq_3 = "1000028eXRR",
+ evfscmpeq_2 = "1000028e-RR",
+ evfscfui_2 = "10000290R-R",
+ evfscfsi_2 = "10000291R-R",
+ evfscfuf_2 = "10000292R-R",
+ evfscfsf_2 = "10000293R-R",
+ evfsctui_2 = "10000294R-R",
+ evfsctsi_2 = "10000295R-R",
+ evfsctuf_2 = "10000296R-R",
+ evfsctsf_2 = "10000297R-R",
+ evfsctuiz_2 = "10000298R-R",
+ evfsctsiz_2 = "1000029aR-R",
+ evfststgt_3 = "1000029cXRR",
+ evfststgt_2 = "1000029c-RR",
+ evfststlt_3 = "1000029dXRR",
+ evfststlt_2 = "1000029d-RR",
+ evfststeq_3 = "1000029eXRR",
+ evfststeq_2 = "1000029e-RR",
+ efsadd_3 = "100002c0RRR",
+ efssub_3 = "100002c1RRR",
+ efsabs_2 = "100002c4RR",
+ efsnabs_2 = "100002c5RR",
+ efsneg_2 = "100002c6RR",
+ efsmul_3 = "100002c8RRR",
+ efsdiv_3 = "100002c9RRR",
+ efscmpgt_3 = "100002ccXRR",
+ efscmpgt_2 = "100002cc-RR",
+ efscmplt_3 = "100002cdXRR",
+ efscmplt_2 = "100002cd-RR",
+ efscmpeq_3 = "100002ceXRR",
+ efscmpeq_2 = "100002ce-RR",
+ efscfd_2 = "100002cfR-R",
+ efscfui_2 = "100002d0R-R",
+ efscfsi_2 = "100002d1R-R",
+ efscfuf_2 = "100002d2R-R",
+ efscfsf_2 = "100002d3R-R",
+ efsctui_2 = "100002d4R-R",
+ efsctsi_2 = "100002d5R-R",
+ efsctuf_2 = "100002d6R-R",
+ efsctsf_2 = "100002d7R-R",
+ efsctuiz_2 = "100002d8R-R",
+ efsctsiz_2 = "100002daR-R",
+ efststgt_3 = "100002dcXRR",
+ efststgt_2 = "100002dc-RR",
+ efststlt_3 = "100002ddXRR",
+ efststlt_2 = "100002dd-RR",
+ efststeq_3 = "100002deXRR",
+ efststeq_2 = "100002de-RR",
+ efdadd_3 = "100002e0RRR",
+ efdsub_3 = "100002e1RRR",
+ efdcfuid_2 = "100002e2R-R",
+ efdcfsid_2 = "100002e3R-R",
+ efdabs_2 = "100002e4RR",
+ efdnabs_2 = "100002e5RR",
+ efdneg_2 = "100002e6RR",
+ efdmul_3 = "100002e8RRR",
+ efddiv_3 = "100002e9RRR",
+ efdctuidz_2 = "100002eaR-R",
+ efdctsidz_2 = "100002ebR-R",
+ efdcmpgt_3 = "100002ecXRR",
+ efdcmpgt_2 = "100002ec-RR",
+ efdcmplt_3 = "100002edXRR",
+ efdcmplt_2 = "100002ed-RR",
+ efdcmpeq_3 = "100002eeXRR",
+ efdcmpeq_2 = "100002ee-RR",
+ efdcfs_2 = "100002efR-R",
+ efdcfui_2 = "100002f0R-R",
+ efdcfsi_2 = "100002f1R-R",
+ efdcfuf_2 = "100002f2R-R",
+ efdcfsf_2 = "100002f3R-R",
+ efdctui_2 = "100002f4R-R",
+ efdctsi_2 = "100002f5R-R",
+ efdctuf_2 = "100002f6R-R",
+ efdctsf_2 = "100002f7R-R",
+ efdctuiz_2 = "100002f8R-R",
+ efdctsiz_2 = "100002faR-R",
+ efdtstgt_3 = "100002fcXRR",
+ efdtstgt_2 = "100002fc-RR",
+ efdtstlt_3 = "100002fdXRR",
+ efdtstlt_2 = "100002fd-RR",
+ efdtsteq_3 = "100002feXRR",
+ efdtsteq_2 = "100002fe-RR",
+ evlddx_3 = "10000300RR0R",
+ evldd_2 = "10000301R8",
+ evldwx_3 = "10000302RR0R",
+ evldw_2 = "10000303R8",
+ evldhx_3 = "10000304RR0R",
+ evldh_2 = "10000305R8",
+ evlwhex_3 = "10000310RR0R",
+ evlwhe_2 = "10000311R4",
+ evlwhoux_3 = "10000314RR0R",
+ evlwhou_2 = "10000315R4",
+ evlwhosx_3 = "10000316RR0R",
+ evlwhos_2 = "10000317R4",
+ evstddx_3 = "10000320RR0R",
+ evstdd_2 = "10000321R8",
+ evstdwx_3 = "10000322RR0R",
+ evstdw_2 = "10000323R8",
+ evstdhx_3 = "10000324RR0R",
+ evstdh_2 = "10000325R8",
+ evstwhex_3 = "10000330RR0R",
+ evstwhe_2 = "10000331R4",
+ evstwhox_3 = "10000334RR0R",
+ evstwho_2 = "10000335R4",
+ evstwwex_3 = "10000338RR0R",
+ evstwwe_2 = "10000339R4",
+ evstwwox_3 = "1000033cRR0R",
+ evstwwo_2 = "1000033dR4",
+ evmhessf_3 = "10000403RRR",
+ evmhossf_3 = "10000407RRR",
+ evmheumi_3 = "10000408RRR",
+ evmhesmi_3 = "10000409RRR",
+ evmhesmf_3 = "1000040bRRR",
+ evmhoumi_3 = "1000040cRRR",
+ evmhosmi_3 = "1000040dRRR",
+ evmhosmf_3 = "1000040fRRR",
+ evmhessfa_3 = "10000423RRR",
+ evmhossfa_3 = "10000427RRR",
+ evmheumia_3 = "10000428RRR",
+ evmhesmia_3 = "10000429RRR",
+ evmhesmfa_3 = "1000042bRRR",
+ evmhoumia_3 = "1000042cRRR",
+ evmhosmia_3 = "1000042dRRR",
+ evmhosmfa_3 = "1000042fRRR",
+ evmwhssf_3 = "10000447RRR",
+ evmwlumi_3 = "10000448RRR",
+ evmwhumi_3 = "1000044cRRR",
+ evmwhsmi_3 = "1000044dRRR",
+ evmwhsmf_3 = "1000044fRRR",
+ evmwssf_3 = "10000453RRR",
+ evmwumi_3 = "10000458RRR",
+ evmwsmi_3 = "10000459RRR",
+ evmwsmf_3 = "1000045bRRR",
+ evmwhssfa_3 = "10000467RRR",
+ evmwlumia_3 = "10000468RRR",
+ evmwhumia_3 = "1000046cRRR",
+ evmwhsmia_3 = "1000046dRRR",
+ evmwhsmfa_3 = "1000046fRRR",
+ evmwssfa_3 = "10000473RRR",
+ evmwumia_3 = "10000478RRR",
+ evmwsmia_3 = "10000479RRR",
+ evmwsmfa_3 = "1000047bRRR",
+ evmra_2 = "100004c4RR",
+ evdivws_3 = "100004c6RRR",
+ evdivwu_3 = "100004c7RRR",
+ evmwssfaa_3 = "10000553RRR",
+ evmwumiaa_3 = "10000558RRR",
+ evmwsmiaa_3 = "10000559RRR",
+ evmwsmfaa_3 = "1000055bRRR",
+ evmwssfan_3 = "100005d3RRR",
+ evmwumian_3 = "100005d8RRR",
+ evmwsmian_3 = "100005d9RRR",
+ evmwsmfan_3 = "100005dbRRR",
+ evmergehilo_3 = "1000022eRRR",
+ evmergelohi_3 = "1000022fRRR",
+ evlhhesplatx_3 = "10000308RR0R",
+ evlhhesplat_2 = "10000309R2",
+ evlhhousplatx_3 = "1000030cRR0R",
+ evlhhousplat_2 = "1000030dR2",
+ evlhhossplatx_3 = "1000030eRR0R",
+ evlhhossplat_2 = "1000030fR2",
+ evlwwsplatx_3 = "10000318RR0R",
+ evlwwsplat_2 = "10000319R4",
+ evlwhsplatx_3 = "1000031cRR0R",
+ evlwhsplat_2 = "1000031dR4",
+ evaddusiaaw_2 = "100004c0RR",
+ evaddssiaaw_2 = "100004c1RR",
+ evsubfusiaaw_2 = "100004c2RR",
+ evsubfssiaaw_2 = "100004c3RR",
+ evaddumiaaw_2 = "100004c8RR",
+ evaddsmiaaw_2 = "100004c9RR",
+ evsubfumiaaw_2 = "100004caRR",
+ evsubfsmiaaw_2 = "100004cbRR",
+ evmheusiaaw_3 = "10000500RRR",
+ evmhessiaaw_3 = "10000501RRR",
+ evmhessfaaw_3 = "10000503RRR",
+ evmhousiaaw_3 = "10000504RRR",
+ evmhossiaaw_3 = "10000505RRR",
+ evmhossfaaw_3 = "10000507RRR",
+ evmheumiaaw_3 = "10000508RRR",
+ evmhesmiaaw_3 = "10000509RRR",
+ evmhesmfaaw_3 = "1000050bRRR",
+ evmhoumiaaw_3 = "1000050cRRR",
+ evmhosmiaaw_3 = "1000050dRRR",
+ evmhosmfaaw_3 = "1000050fRRR",
+ evmhegumiaa_3 = "10000528RRR",
+ evmhegsmiaa_3 = "10000529RRR",
+ evmhegsmfaa_3 = "1000052bRRR",
+ evmhogumiaa_3 = "1000052cRRR",
+ evmhogsmiaa_3 = "1000052dRRR",
+ evmhogsmfaa_3 = "1000052fRRR",
+ evmwlusiaaw_3 = "10000540RRR",
+ evmwlssiaaw_3 = "10000541RRR",
+ evmwlumiaaw_3 = "10000548RRR",
+ evmwlsmiaaw_3 = "10000549RRR",
+ evmheusianw_3 = "10000580RRR",
+ evmhessianw_3 = "10000581RRR",
+ evmhessfanw_3 = "10000583RRR",
+ evmhousianw_3 = "10000584RRR",
+ evmhossianw_3 = "10000585RRR",
+ evmhossfanw_3 = "10000587RRR",
+ evmheumianw_3 = "10000588RRR",
+ evmhesmianw_3 = "10000589RRR",
+ evmhesmfanw_3 = "1000058bRRR",
+ evmhoumianw_3 = "1000058cRRR",
+ evmhosmianw_3 = "1000058dRRR",
+ evmhosmfanw_3 = "1000058fRRR",
+ evmhegumian_3 = "100005a8RRR",
+ evmhegsmian_3 = "100005a9RRR",
+ evmhegsmfan_3 = "100005abRRR",
+ evmhogumian_3 = "100005acRRR",
+ evmhogsmian_3 = "100005adRRR",
+ evmhogsmfan_3 = "100005afRRR",
+ evmwlusianw_3 = "100005c0RRR",
+ evmwlssianw_3 = "100005c1RRR",
+ evmwlumianw_3 = "100005c8RRR",
+ evmwlsmianw_3 = "100005c9RRR",
+
+ -- NYI: Book E instructions.
+}
+
+-- Add mnemonics for "." variants.
+do
+ local t = {}
+ for k,v in pairs(map_op) do
+ if type(v) == "string" and sub(v, -1) == "." then
+ local v2 = sub(v, 1, 7)..char(byte(v, 8)+1)..sub(v, 9, -2)
+ t[sub(k, 1, -3).."."..sub(k, -2)] = v2
+ end
+ end
+ for k,v in pairs(t) do
+ map_op[k] = v
+ end
+end
+
+-- Add more branch mnemonics.
+for cond,c in pairs(map_cond) do
+ local b1 = "b"..cond
+ local c1 = shl(band(c, 3), 16) + (c < 4 and 0x01000000 or 0)
+ -- bX[l]
+ map_op[b1.."_1"] = tohex(0x40800000 + c1).."K"
+ map_op[b1.."y_1"] = tohex(0x40a00000 + c1).."K"
+ map_op[b1.."l_1"] = tohex(0x40800001 + c1).."K"
+ map_op[b1.."_2"] = tohex(0x40800000 + c1).."-XK"
+ map_op[b1.."y_2"] = tohex(0x40a00000 + c1).."-XK"
+ map_op[b1.."l_2"] = tohex(0x40800001 + c1).."-XK"
+ -- bXlr[l]
+ map_op[b1.."lr_0"] = tohex(0x4c800020 + c1)
+ map_op[b1.."lrl_0"] = tohex(0x4c800021 + c1)
+ map_op[b1.."ctr_0"] = tohex(0x4c800420 + c1)
+ map_op[b1.."ctrl_0"] = tohex(0x4c800421 + c1)
+ -- bXctr[l]
+ map_op[b1.."lr_1"] = tohex(0x4c800020 + c1).."-X"
+ map_op[b1.."lrl_1"] = tohex(0x4c800021 + c1).."-X"
+ map_op[b1.."ctr_1"] = tohex(0x4c800420 + c1).."-X"
+ map_op[b1.."ctrl_1"] = tohex(0x4c800421 + c1).."-X"
+end
+
+------------------------------------------------------------------------------
+
+local function parse_gpr(expr)
+ local tname, ovreg = match(expr, "^([%w_]+):(r[1-3]?[0-9])$")
+ local tp = map_type[tname or expr]
+ if tp then
+ local reg = ovreg or tp.reg
+ if not reg then
+ werror("type `"..(tname or expr).."' needs a register override")
+ end
+ expr = reg
+ end
+ local r = match(expr, "^r([1-3]?[0-9])$")
+ if r then
+ r = tonumber(r)
+ if r <= 31 then return r, tp end
+ end
+ werror("bad register name `"..expr.."'")
+end
+
+local function parse_fpr(expr)
+ local r = match(expr, "^f([1-3]?[0-9])$")
+ if r then
+ r = tonumber(r)
+ if r <= 31 then return r end
+ end
+ werror("bad register name `"..expr.."'")
+end
+
+local function parse_vr(expr)
+ local r = match(expr, "^v([1-3]?[0-9])$")
+ if r then
+ r = tonumber(r)
+ if r <= 31 then return r end
+ end
+ werror("bad register name `"..expr.."'")
+end
+
+local function parse_vs(expr)
+ local r = match(expr, "^vs([1-6]?[0-9])$")
+ if r then
+ r = tonumber(r)
+ if r <= 63 then return r end
+ end
+ werror("bad register name `"..expr.."'")
+end
+
+local function parse_cr(expr)
+ local r = match(expr, "^cr([0-7])$")
+ if r then return tonumber(r) end
+ werror("bad condition register name `"..expr.."'")
+end
+
+local function parse_cond(expr)
+ local r, cond = match(expr, "^4%*cr([0-7])%+(%w%w)$")
+ if r then
+ r = tonumber(r)
+ local c = map_cond[cond]
+ if c and c < 4 then return r*4+c end
+ end
+ werror("bad condition bit name `"..expr.."'")
+end
+
+local parse_ctx = {}
+
+local loadenv = setfenv and function(s)
+ local code = loadstring(s, "")
+ if code then setfenv(code, parse_ctx) end
+ return code
+end or function(s)
+ return load(s, "", nil, parse_ctx)
+end
+
+-- Try to parse simple arithmetic, too, since some basic ops are aliases.
+local function parse_number(n)
+ local x = tonumber(n)
+ if x then return x end
+ local code = loadenv("return "..n)
+ if code then
+ local ok, y = pcall(code)
+ if ok then return y end
+ end
+ return nil
+end
+
+local function parse_imm(imm, bits, shift, scale, signed)
+ local n = parse_number(imm)
+ if n then
+ local m = sar(n, scale)
+ if shl(m, scale) == n then
+ if signed then
+ local s = sar(m, bits-1)
+ if s == 0 then return shl(m, shift)
+ elseif s == -1 then return shl(m + shl(1, bits), shift) end
+ else
+ if sar(m, bits) == 0 then return shl(m, shift) end
+ end
+ end
+ werror("out of range immediate `"..imm.."'")
+ elseif match(imm, "^[rfv]([1-3]?[0-9])$") or
+ match(imm, "^vs([1-6]?[0-9])$") or
+ match(imm, "^([%w_]+):(r[1-3]?[0-9])$") then
+ werror("expected immediate operand, got register")
+ else
+ waction("IMM", (signed and 32768 or 0)+scale*1024+bits*32+shift, imm)
+ return 0
+ end
+end
+
+local function parse_shiftmask(imm, isshift)
+ local n = parse_number(imm)
+ if n then
+ if shr(n, 6) == 0 then
+ local lsb = band(n, 31)
+ local msb = n - lsb
+ return isshift and (shl(lsb, 11)+shr(msb, 4)) or (shl(lsb, 6)+msb)
+ end
+ werror("out of range immediate `"..imm.."'")
+ elseif match(imm, "^r([1-3]?[0-9])$") or
+ match(imm, "^([%w_]+):(r[1-3]?[0-9])$") then
+ werror("expected immediate operand, got register")
+ else
+ waction("IMMSH", isshift and 1 or 0, imm)
+ return 0;
+ end
+end
+
+local function parse_disp(disp)
+ local imm, reg = match(disp, "^(.*)%(([%w_:]+)%)$")
+ if imm then
+ local r = parse_gpr(reg)
+ if r == 0 then werror("cannot use r0 in displacement") end
+ return shl(r, 16) + parse_imm(imm, 16, 0, 0, true)
+ end
+ local reg, tailr = match(disp, "^([%w_:]+)%s*(.*)$")
+ if reg and tailr ~= "" then
+ local r, tp = parse_gpr(reg)
+ if r == 0 then werror("cannot use r0 in displacement") end
+ if tp then
+ waction("IMM", 32768+16*32, format(tp.ctypefmt, tailr))
+ return shl(r, 16)
+ end
+ end
+ werror("bad displacement `"..disp.."'")
+end
+
+local function parse_u5disp(disp, scale)
+ local imm, reg = match(disp, "^(.*)%(([%w_:]+)%)$")
+ if imm then
+ local r = parse_gpr(reg)
+ if r == 0 then werror("cannot use r0 in displacement") end
+ return shl(r, 16) + parse_imm(imm, 5, 11, scale, false)
+ end
+ local reg, tailr = match(disp, "^([%w_:]+)%s*(.*)$")
+ if reg and tailr ~= "" then
+ local r, tp = parse_gpr(reg)
+ if r == 0 then werror("cannot use r0 in displacement") end
+ if tp then
+ waction("IMM", scale*1024+5*32+11, format(tp.ctypefmt, tailr))
+ return shl(r, 16)
+ end
+ end
+ werror("bad displacement `"..disp.."'")
+end
+
+local function parse_label(label, def)
+ local prefix = sub(label, 1, 2)
+ -- =>label (pc label reference)
+ if prefix == "=>" then
+ return "PC", 0, sub(label, 3)
+ end
+ -- ->name (global label reference)
+ if prefix == "->" then
+ return "LG", map_global[sub(label, 3)]
+ end
+ if def then
+ -- [1-9] (local label definition)
+ if match(label, "^[1-9]$") then
+ return "LG", 10+tonumber(label)
+ end
+ else
+ -- [<>][1-9] (local label reference)
+ local dir, lnum = match(label, "^([<>])([1-9])$")
+ if dir then -- Fwd: 1-9, Bkwd: 11-19.
+ return "LG", lnum + (dir == ">" and 0 or 10)
+ end
+ -- extern label (extern label reference)
+ local extname = match(label, "^extern%s+(%S+)$")
+ if extname then
+ return "EXT", map_extern[extname]
+ end
+ end
+ werror("bad label `"..label.."'")
+end
+
+------------------------------------------------------------------------------
+
+-- Handle opcodes defined with template strings.
+op_template = function(params, template, nparams)
+ if not params then return sub(template, 9) end
+ local op = tonumber(sub(template, 1, 8), 16)
+ local n, rs = 1, 26
+
+ -- Limit number of section buffer positions used by a single dasm_put().
+ -- A single opcode needs a maximum of 3 positions (rlwinm).
+ if secpos+3 > maxsecpos then wflush() end
+ local pos = wpos()
+
+ -- Process each character.
+ for p in gmatch(sub(template, 9), ".") do
+ if p == "R" then
+ rs = rs - 5; op = op + shl(parse_gpr(params[n]), rs); n = n + 1
+ elseif p == "F" then
+ rs = rs - 5; op = op + shl(parse_fpr(params[n]), rs); n = n + 1
+ elseif p == "V" then
+ rs = rs - 5; op = op + shl(parse_vr(params[n]), rs); n = n + 1
+ elseif p == "Q" then
+ local vs = parse_vs(params[n]); n = n + 1; rs = rs - 5
+ local sh = rs == 6 and 2 or 3 + band(shr(rs, 1), 3)
+ op = op + shl(band(vs, 31), rs) + shr(band(vs, 32), sh)
+ elseif p == "q" then
+ local vs = parse_vs(params[n]); n = n + 1
+ op = op + shl(band(vs, 31), 21) + shr(band(vs, 32), 5)
+ elseif p == "A" then
+ rs = rs - 5; op = op + parse_imm(params[n], 5, rs, 0, false); n = n + 1
+ elseif p == "S" then
+ rs = rs - 5; op = op + parse_imm(params[n], 5, rs, 0, true); n = n + 1
+ elseif p == "I" then
+ op = op + parse_imm(params[n], 16, 0, 0, true); n = n + 1
+ elseif p == "U" then
+ op = op + parse_imm(params[n], 16, 0, 0, false); n = n + 1
+ elseif p == "D" then
+ op = op + parse_disp(params[n]); n = n + 1
+ elseif p == "2" then
+ op = op + parse_u5disp(params[n], 1); n = n + 1
+ elseif p == "4" then
+ op = op + parse_u5disp(params[n], 2); n = n + 1
+ elseif p == "8" then
+ op = op + parse_u5disp(params[n], 3); n = n + 1
+ elseif p == "C" then
+ rs = rs - 5; op = op + shl(parse_cond(params[n]), rs); n = n + 1
+ elseif p == "X" then
+ rs = rs - 5; op = op + shl(parse_cr(params[n]), rs+2); n = n + 1
+ elseif p == "1" then
+ rs = rs - 5; op = op + parse_imm(params[n], 1, rs, 0, false); n = n + 1
+ elseif p == "g" then
+ rs = rs - 5; op = op + parse_imm(params[n], 2, rs, 0, false); n = n + 1
+ elseif p == "3" then
+ rs = rs - 5; op = op + parse_imm(params[n], 3, rs, 0, false); n = n + 1
+ elseif p == "P" then
+ rs = rs - 5; op = op + parse_imm(params[n], 4, rs, 0, false); n = n + 1
+ elseif p == "p" then
+ op = op + parse_imm(params[n], 4, rs, 0, false); n = n + 1
+ elseif p == "6" then
+ rs = rs - 6; op = op + parse_imm(params[n], 6, rs, 0, false); n = n + 1
+ elseif p == "Y" then
+ rs = rs - 5; op = op + parse_imm(params[n], 1, rs+4, 0, false); n = n + 1
+ elseif p == "y" then
+ rs = rs - 5; op = op + parse_imm(params[n], 1, rs+3, 0, false); n = n + 1
+ elseif p == "Z" then
+ rs = rs - 5; op = op + parse_imm(params[n], 2, rs+3, 0, false); n = n + 1
+ elseif p == "z" then
+ rs = rs - 5; op = op + parse_imm(params[n], 2, rs+2, 0, false); n = n + 1
+ elseif p == "W" then
+ op = op + parse_cr(params[n]); n = n + 1
+ elseif p == "G" then
+ op = op + parse_imm(params[n], 8, 12, 0, false); n = n + 1
+ elseif p == "H" then
+ op = op + parse_shiftmask(params[n], true); n = n + 1
+ elseif p == "M" then
+ op = op + parse_shiftmask(params[n], false); n = n + 1
+ elseif p == "J" or p == "K" then
+ local mode, n, s = parse_label(params[n], false)
+ if p == "K" then n = n + 2048 end
+ waction("REL_"..mode, n, s, 1)
+ n = n + 1
+ elseif p == "0" then
+ if band(shr(op, rs), 31) == 0 then werror("cannot use r0") end
+ elseif p == "=" or p == "%" then
+ local t = band(shr(op, p == "%" and rs+5 or rs), 31)
+ rs = rs - 5
+ op = op + shl(t, rs)
+ elseif p == "~" then
+ local mm = shl(31, rs)
+ local lo = band(op, mm)
+ local hi = band(op, shl(mm, 5))
+ op = op - lo - hi + shl(lo, 5) + shr(hi, 5)
+ elseif p == ":" then
+ if band(shr(op, rs), 1) ~= 0 then werror("register pair expected") end
+ elseif p == "-" then
+ rs = rs - 5
+ elseif p == "." then
+ -- Ignored.
+ else
+ assert(false)
+ end
+ end
+ wputpos(pos, op)
+end
+
+map_op[".template__"] = op_template
+
+------------------------------------------------------------------------------
+
+-- Pseudo-opcode to mark the position where the action list is to be emitted.
+map_op[".actionlist_1"] = function(params)
+ if not params then return "cvar" end
+ local name = params[1] -- No syntax check. You get to keep the pieces.
+ wline(function(out) writeactions(out, name) end)
+end
+
+-- Pseudo-opcode to mark the position where the global enum is to be emitted.
+map_op[".globals_1"] = function(params)
+ if not params then return "prefix" end
+ local prefix = params[1] -- No syntax check. You get to keep the pieces.
+ wline(function(out) writeglobals(out, prefix) end)
+end
+
+-- Pseudo-opcode to mark the position where the global names are to be emitted.
+map_op[".globalnames_1"] = function(params)
+ if not params then return "cvar" end
+ local name = params[1] -- No syntax check. You get to keep the pieces.
+ wline(function(out) writeglobalnames(out, name) end)
+end
+
+-- Pseudo-opcode to mark the position where the extern names are to be emitted.
+map_op[".externnames_1"] = function(params)
+ if not params then return "cvar" end
+ local name = params[1] -- No syntax check. You get to keep the pieces.
+ wline(function(out) writeexternnames(out, name) end)
+end
+
+------------------------------------------------------------------------------
+
+-- Label pseudo-opcode (converted from trailing colon form).
+map_op[".label_1"] = function(params)
+ if not params then return "[1-9] | ->global | =>pcexpr" end
+ if secpos+1 > maxsecpos then wflush() end
+ local mode, n, s = parse_label(params[1], true)
+ if mode == "EXT" then werror("bad label definition") end
+ waction("LABEL_"..mode, n, s, 1)
+end
+
+------------------------------------------------------------------------------
+
+-- Pseudo-opcodes for data storage.
+map_op[".long_*"] = function(params)
+ if not params then return "imm..." end
+ for _,p in ipairs(params) do
+ local n = tonumber(p)
+ if not n then werror("bad immediate `"..p.."'") end
+ if n < 0 then n = n + 2^32 end
+ wputw(n)
+ if secpos+2 > maxsecpos then wflush() end
+ end
+end
+
+-- Alignment pseudo-opcode.
+map_op[".align_1"] = function(params)
+ if not params then return "numpow2" end
+ if secpos+1 > maxsecpos then wflush() end
+ local align = tonumber(params[1])
+ if align then
+ local x = align
+ -- Must be a power of 2 in the range (2 ... 256).
+ for i=1,8 do
+ x = x / 2
+ if x == 1 then
+ waction("ALIGN", align-1, nil, 1) -- Action byte is 2**n-1.
+ return
+ end
+ end
+ end
+ werror("bad alignment")
+end
+
+------------------------------------------------------------------------------
+
+-- Pseudo-opcode for (primitive) type definitions (map to C types).
+map_op[".type_3"] = function(params, nparams)
+ if not params then
+ return nparams == 2 and "name, ctype" or "name, ctype, reg"
+ end
+ local name, ctype, reg = params[1], params[2], params[3]
+ if not match(name, "^[%a_][%w_]*$") then
+ werror("bad type name `"..name.."'")
+ end
+ local tp = map_type[name]
+ if tp then
+ werror("duplicate type `"..name.."'")
+ end
+ -- Add #type to defines. A bit unclean to put it in map_archdef.
+ map_archdef["#"..name] = "sizeof("..ctype..")"
+ -- Add new type and emit shortcut define.
+ local num = ctypenum + 1
+ map_type[name] = {
+ ctype = ctype,
+ ctypefmt = format("Dt%X(%%s)", num),
+ reg = reg,
+ }
+ wline(format("#define Dt%X(_V) (int)(ptrdiff_t)&(((%s *)0)_V)", num, ctype))
+ ctypenum = num
+end
+map_op[".type_2"] = map_op[".type_3"]
+
+-- Dump type definitions.
+local function dumptypes(out, lvl)
+ local t = {}
+ for name in pairs(map_type) do t[#t+1] = name end
+ sort(t)
+ out:write("Type definitions:\n")
+ for _,name in ipairs(t) do
+ local tp = map_type[name]
+ local reg = tp.reg or ""
+ out:write(format(" %-20s %-20s %s\n", name, tp.ctype, reg))
+ end
+ out:write("\n")
+end
+
+------------------------------------------------------------------------------
+
+-- Set the current section.
+function _M.section(num)
+ waction("SECTION", num)
+ wflush(true) -- SECTION is a terminal action.
+end
+
+------------------------------------------------------------------------------
+
+-- Dump architecture description.
+function _M.dumparch(out)
+ out:write(format("DynASM %s version %s, released %s\n\n",
+ _info.arch, _info.version, _info.release))
+ dumpactions(out)
+end
+
+-- Dump all user defined elements.
+function _M.dumpdef(out, lvl)
+ dumptypes(out, lvl)
+ dumpglobals(out, lvl)
+ dumpexterns(out, lvl)
+end
+
+------------------------------------------------------------------------------
+
+-- Pass callbacks from/to the DynASM core.
+function _M.passcb(wl, we, wf, ww)
+ wline, werror, wfatal, wwarn = wl, we, wf, ww
+ return wflush
+end
+
+-- Setup the arch-specific module.
+function _M.setup(arch, opt)
+ g_arch, g_opt = arch, opt
+end
+
+-- Merge the core maps and the arch-specific maps.
+function _M.mergemaps(map_coreop, map_def)
+ setmetatable(map_op, { __index = map_coreop })
+ setmetatable(map_def, { __index = map_archdef })
+ return map_op, map_def
+end
+
+return _M
+
+------------------------------------------------------------------------------
+
diff --git a/ext/opcache/jit/dynasm/dasm_proto.h b/ext/opcache/jit/dynasm/dasm_proto.h
new file mode 100644
index 0000000000..22a654cbfd
--- /dev/null
+++ b/ext/opcache/jit/dynasm/dasm_proto.h
@@ -0,0 +1,83 @@
+/*
+** DynASM encoding engine prototypes.
+** Copyright (C) 2005-2016 Mike Pall. All rights reserved.
+** Released under the MIT license. See dynasm.lua for full copyright notice.
+*/
+
+#ifndef _DASM_PROTO_H
+#define _DASM_PROTO_H
+
+#include <stddef.h>
+#include <stdarg.h>
+
+#define DASM_IDENT "DynASM 1.4.0"
+#define DASM_VERSION 10400 /* 1.4.0 */
+
+#ifndef Dst_DECL
+#define Dst_DECL dasm_State **Dst
+#endif
+
+#ifndef Dst_REF
+#define Dst_REF (*Dst)
+#endif
+
+#ifndef DASM_FDEF
+#define DASM_FDEF extern
+#endif
+
+#ifndef DASM_M_GROW
+#define DASM_M_GROW(ctx, t, p, sz, need) \
+ do { \
+ size_t _sz = (sz), _need = (need); \
+ if (_sz < _need) { \
+ if (_sz < 16) _sz = 16; \
+ while (_sz < _need) _sz += _sz; \
+ (p) = (t *)realloc((p), _sz); \
+ if ((p) == NULL) exit(1); \
+ (sz) = _sz; \
+ } \
+ } while(0)
+#endif
+
+#ifndef DASM_M_FREE
+#define DASM_M_FREE(ctx, p, sz) free(p)
+#endif
+
+/* Internal DynASM encoder state. */
+typedef struct dasm_State dasm_State;
+
+
+/* Initialize and free DynASM state. */
+DASM_FDEF void dasm_init(Dst_DECL, int maxsection);
+DASM_FDEF void dasm_free(Dst_DECL);
+
+/* Setup global array. Must be called before dasm_setup(). */
+DASM_FDEF void dasm_setupglobal(Dst_DECL, void **gl, unsigned int maxgl);
+
+/* Grow PC label array. Can be called after dasm_setup(), too. */
+DASM_FDEF void dasm_growpc(Dst_DECL, unsigned int maxpc);
+
+/* Setup encoder. */
+DASM_FDEF void dasm_setup(Dst_DECL, const void *actionlist);
+
+/* Feed encoder with actions. Calls are generated by pre-processor. */
+DASM_FDEF void dasm_put(Dst_DECL, int start, ...);
+
+/* Link sections and return the resulting size. */
+DASM_FDEF int dasm_link(Dst_DECL, size_t *szp);
+
+/* Encode sections into buffer. */
+DASM_FDEF int dasm_encode(Dst_DECL, void *buffer);
+
+/* Get PC label offset. */
+DASM_FDEF int dasm_getpclabel(Dst_DECL, unsigned int pc);
+
+#ifdef DASM_CHECKS
+/* Optional sanity checker to call between isolated encoding steps. */
+DASM_FDEF int dasm_checkstep(Dst_DECL, int secmatch);
+#else
+#define dasm_checkstep(a, b) 0
+#endif
+
+
+#endif /* _DASM_PROTO_H */
diff --git a/ext/opcache/jit/dynasm/dasm_x64.lua b/ext/opcache/jit/dynasm/dasm_x64.lua
new file mode 100644
index 0000000000..2133355644
--- /dev/null
+++ b/ext/opcache/jit/dynasm/dasm_x64.lua
@@ -0,0 +1,12 @@
+------------------------------------------------------------------------------
+-- DynASM x64 module.
+--
+-- Copyright (C) 2005-2016 Mike Pall. All rights reserved.
+-- See dynasm.lua for full copyright notice.
+------------------------------------------------------------------------------
+-- This module just sets 64 bit mode for the combined x86/x64 module.
+-- All the interesting stuff is there.
+------------------------------------------------------------------------------
+
+x64 = true -- Using a global is an ugly, but effective solution.
+return require("dasm_x86")
diff --git a/ext/opcache/jit/dynasm/dasm_x86.h b/ext/opcache/jit/dynasm/dasm_x86.h
new file mode 100644
index 0000000000..32874b40b9
--- /dev/null
+++ b/ext/opcache/jit/dynasm/dasm_x86.h
@@ -0,0 +1,500 @@
+/*
+** DynASM x86 encoding engine.
+** Copyright (C) 2005-2016 Mike Pall. All rights reserved.
+** Released under the MIT license. See dynasm.lua for full copyright notice.
+*/
+
+#include <stddef.h>
+#include <stdarg.h>
+#include <string.h>
+#include <stdlib.h>
+
+#define DASM_ARCH "x86"
+
+#ifndef DASM_EXTERN
+#define DASM_EXTERN(a,b,c,d) 0
+#endif
+
+/* Action definitions. DASM_STOP must be 255. */
+enum {
+ DASM_DISP = 233,
+ DASM_IMM_S, DASM_IMM_B, DASM_IMM_W, DASM_IMM_D, DASM_IMM_WB, DASM_IMM_DB,
+ DASM_VREG, DASM_SPACE, DASM_SETLABEL, DASM_REL_A, DASM_REL_LG, DASM_REL_PC,
+ DASM_IMM_LG, DASM_IMM_PC, DASM_LABEL_LG, DASM_LABEL_PC, DASM_ALIGN,
+ DASM_EXTERN, DASM_ESC, DASM_MARK, DASM_SECTION, DASM_STOP
+};
+
+/* Maximum number of section buffer positions for a single dasm_put() call. */
+#define DASM_MAXSECPOS 25
+
+/* DynASM encoder status codes. Action list offset or number are or'ed in. */
+#define DASM_S_OK 0x00000000
+#define DASM_S_NOMEM 0x01000000
+#define DASM_S_PHASE 0x02000000
+#define DASM_S_MATCH_SEC 0x03000000
+#define DASM_S_RANGE_I 0x11000000
+#define DASM_S_RANGE_SEC 0x12000000
+#define DASM_S_RANGE_LG 0x13000000
+#define DASM_S_RANGE_PC 0x14000000
+#define DASM_S_RANGE_VREG 0x15000000
+#define DASM_S_UNDEF_L 0x21000000
+#define DASM_S_UNDEF_PC 0x22000000
+
+/* Macros to convert positions (8 bit section + 24 bit index). */
+#define DASM_POS2IDX(pos) ((pos)&0x00ffffff)
+#define DASM_POS2BIAS(pos) ((pos)&0xff000000)
+#define DASM_SEC2POS(sec) ((sec)<<24)
+#define DASM_POS2SEC(pos) ((pos)>>24)
+#define DASM_POS2PTR(D, pos) (D->sections[DASM_POS2SEC(pos)].rbuf + (pos))
+
+/* Action list type. */
+typedef const unsigned char *dasm_ActList;
+
+/* Per-section structure. */
+typedef struct dasm_Section {
+ int *rbuf; /* Biased buffer pointer (negative section bias). */
+ int *buf; /* True buffer pointer. */
+ size_t bsize; /* Buffer size in bytes. */
+ int pos; /* Biased buffer position. */
+ int epos; /* End of biased buffer position - max single put. */
+ int ofs; /* Byte offset into section. */
+} dasm_Section;
+
+/* Core structure holding the DynASM encoding state. */
+struct dasm_State {
+ size_t psize; /* Allocated size of this structure. */
+ dasm_ActList actionlist; /* Current actionlist pointer. */
+ int *lglabels; /* Local/global chain/pos ptrs. */
+ size_t lgsize;
+ int *pclabels; /* PC label chains/pos ptrs. */
+ size_t pcsize;
+ void **globals; /* Array of globals (bias -10). */
+ dasm_Section *section; /* Pointer to active section. */
+ size_t codesize; /* Total size of all code sections. */
+ int maxsection; /* 0 <= sectionidx < maxsection. */
+ int status; /* Status code. */
+ dasm_Section sections[1]; /* All sections. Alloc-extended. */
+};
+
+/* The size of the core structure depends on the max. number of sections. */
+#define DASM_PSZ(ms) (sizeof(dasm_State)+(ms-1)*sizeof(dasm_Section))
+
+
+/* Initialize DynASM state. */
+void dasm_init(Dst_DECL, int maxsection)
+{
+ dasm_State *D;
+ size_t psz = 0;
+ int i;
+ Dst_REF = NULL;
+ DASM_M_GROW(Dst, struct dasm_State, Dst_REF, psz, DASM_PSZ(maxsection));
+ D = Dst_REF;
+ D->psize = psz;
+ D->lglabels = NULL;
+ D->lgsize = 0;
+ D->pclabels = NULL;
+ D->pcsize = 0;
+ D->globals = NULL;
+ D->maxsection = maxsection;
+ for (i = 0; i < maxsection; i++) {
+ D->sections[i].buf = NULL; /* Need this for pass3. */
+ D->sections[i].rbuf = D->sections[i].buf - DASM_SEC2POS(i);
+ D->sections[i].bsize = 0;
+ D->sections[i].epos = 0; /* Wrong, but is recalculated after resize. */
+ }
+}
+
+/* Free DynASM state. */
+void dasm_free(Dst_DECL)
+{
+ dasm_State *D = Dst_REF;
+ int i;
+ for (i = 0; i < D->maxsection; i++)
+ if (D->sections[i].buf)
+ DASM_M_FREE(Dst, D->sections[i].buf, D->sections[i].bsize);
+ if (D->pclabels) DASM_M_FREE(Dst, D->pclabels, D->pcsize);
+ if (D->lglabels) DASM_M_FREE(Dst, D->lglabels, D->lgsize);
+ DASM_M_FREE(Dst, D, D->psize);
+}
+
+/* Setup global label array. Must be called before dasm_setup(). */
+void dasm_setupglobal(Dst_DECL, void **gl, unsigned int maxgl)
+{
+ dasm_State *D = Dst_REF;
+ D->globals = gl - 10; /* Negative bias to compensate for locals. */
+ DASM_M_GROW(Dst, int, D->lglabels, D->lgsize, (10+maxgl)*sizeof(int));
+}
+
+/* Grow PC label array. Can be called after dasm_setup(), too. */
+void dasm_growpc(Dst_DECL, unsigned int maxpc)
+{
+ dasm_State *D = Dst_REF;
+ size_t osz = D->pcsize;
+ DASM_M_GROW(Dst, int, D->pclabels, D->pcsize, maxpc*sizeof(int));
+ memset((void *)(((unsigned char *)D->pclabels)+osz), 0, D->pcsize-osz);
+}
+
+/* Setup encoder. */
+void dasm_setup(Dst_DECL, const void *actionlist)
+{
+ dasm_State *D = Dst_REF;
+ int i;
+ D->actionlist = (dasm_ActList)actionlist;
+ D->status = DASM_S_OK;
+ D->section = &D->sections[0];
+ memset((void *)D->lglabels, 0, D->lgsize);
+ if (D->pclabels) memset((void *)D->pclabels, 0, D->pcsize);
+ for (i = 0; i < D->maxsection; i++) {
+ D->sections[i].pos = DASM_SEC2POS(i);
+ D->sections[i].ofs = 0;
+ }
+}
+
+
+#ifdef DASM_CHECKS
+#define CK(x, st) \
+ do { if (!(x)) { \
+ D->status = DASM_S_##st|(int)(p-D->actionlist-1); return; } } while (0)
+#define CKPL(kind, st) \
+ do { if ((size_t)((char *)pl-(char *)D->kind##labels) >= D->kind##size) { \
+ D->status=DASM_S_RANGE_##st|(int)(p-D->actionlist-1); return; } } while (0)
+#else
+#define CK(x, st) ((void)0)
+#define CKPL(kind, st) ((void)0)
+#endif
+
+/* Pass 1: Store actions and args, link branches/labels, estimate offsets. */
+void dasm_put(Dst_DECL, int start, ...)
+{
+ va_list ap;
+ dasm_State *D = Dst_REF;
+ dasm_ActList p = D->actionlist + start;
+ dasm_Section *sec = D->section;
+ int pos = sec->pos, ofs = sec->ofs, mrm = -1;
+ int *b;
+
+ if (pos >= sec->epos) {
+ DASM_M_GROW(Dst, int, sec->buf, sec->bsize,
+ sec->bsize + 2*DASM_MAXSECPOS*sizeof(int));
+ sec->rbuf = sec->buf - DASM_POS2BIAS(pos);
+ sec->epos = (int)sec->bsize/sizeof(int) - DASM_MAXSECPOS+DASM_POS2BIAS(pos);
+ }
+
+ b = sec->rbuf;
+ b[pos++] = start;
+
+ va_start(ap, start);
+ while (1) {
+ int action = *p++;
+ if (action < DASM_DISP) {
+ ofs++;
+ } else if (action <= DASM_REL_A) {
+ int n = va_arg(ap, int);
+ b[pos++] = n;
+ switch (action) {
+ case DASM_DISP:
+ if (n == 0) { if (mrm < 0) mrm = p[-2]; if ((mrm&7) != 5) break; }
+ case DASM_IMM_DB: if (((n+128)&-256) == 0) goto ob;
+ case DASM_REL_A: /* Assumes ptrdiff_t is int. !x64 */
+ case DASM_IMM_D: ofs += 4; break;
+ case DASM_IMM_S: CK(((n+128)&-256) == 0, RANGE_I); goto ob;
+ case DASM_IMM_B: CK((n&-256) == 0, RANGE_I); ob: ofs++; break;
+ case DASM_IMM_WB: if (((n+128)&-256) == 0) goto ob;
+ case DASM_IMM_W: CK((n&-65536) == 0, RANGE_I); ofs += 2; break;
+ case DASM_SPACE: p++; ofs += n; break;
+ case DASM_SETLABEL: b[pos-2] = -0x40000000; break; /* Neg. label ofs. */
+ case DASM_VREG: CK((n&-16) == 0 && (n != 4 || (*p>>5) != 2), RANGE_VREG);
+ if (*p < 0x40 && p[1] == DASM_DISP) mrm = n;
+ if (*p < 0x20 && (n&7) == 4) ofs++;
+ switch ((*p++ >> 3) & 3) {
+ case 3: n |= b[pos-3];
+ case 2: n |= b[pos-2];
+ case 1: if (n <= 7) { b[pos-1] |= 0x10; ofs--; }
+ }
+ continue;
+ }
+ mrm = -1;
+ } else {
+ int *pl, n;
+ switch (action) {
+ case DASM_REL_LG:
+ case DASM_IMM_LG:
+ n = *p++; pl = D->lglabels + n;
+ /* Bkwd rel or global. */
+ if (n <= 246) { CK(n>=10||*pl<0, RANGE_LG); CKPL(lg, LG); goto putrel; }
+ pl -= 246; n = *pl;
+ if (n < 0) n = 0; /* Start new chain for fwd rel if label exists. */
+ goto linkrel;
+ case DASM_REL_PC:
+ case DASM_IMM_PC: pl = D->pclabels + va_arg(ap, int); CKPL(pc, PC);
+ putrel:
+ n = *pl;
+ if (n < 0) { /* Label exists. Get label pos and store it. */
+ b[pos] = -n;
+ } else {
+ linkrel:
+ b[pos] = n; /* Else link to rel chain, anchored at label. */
+ *pl = pos;
+ }
+ pos++;
+ ofs += 4; /* Maximum offset needed. */
+ if (action == DASM_REL_LG || action == DASM_REL_PC)
+ b[pos++] = ofs; /* Store pass1 offset estimate. */
+ break;
+ case DASM_LABEL_LG: pl = D->lglabels + *p++; CKPL(lg, LG); goto putlabel;
+ case DASM_LABEL_PC: pl = D->pclabels + va_arg(ap, int); CKPL(pc, PC);
+ putlabel:
+ n = *pl; /* n > 0: Collapse rel chain and replace with label pos. */
+ while (n > 0) { int *pb = DASM_POS2PTR(D, n); n = *pb; *pb = pos; }
+ *pl = -pos; /* Label exists now. */
+ b[pos++] = ofs; /* Store pass1 offset estimate. */
+ break;
+ case DASM_ALIGN:
+ ofs += *p++; /* Maximum alignment needed (arg is 2**n-1). */
+ b[pos++] = ofs; /* Store pass1 offset estimate. */
+ break;
+ case DASM_EXTERN: p += 2; ofs += 4; break;
+ case DASM_ESC: p++; ofs++; break;
+ case DASM_MARK: mrm = p[-2]; break;
+ case DASM_SECTION:
+ n = *p; CK(n < D->maxsection, RANGE_SEC); D->section = &D->sections[n];
+ case DASM_STOP: goto stop;
+ }
+ }
+ }
+stop:
+ va_end(ap);
+ sec->pos = pos;
+ sec->ofs = ofs;
+}
+#undef CK
+
+/* Pass 2: Link sections, shrink branches/aligns, fix label offsets. */
+int dasm_link(Dst_DECL, size_t *szp)
+{
+ dasm_State *D = Dst_REF;
+ int secnum;
+ int ofs = 0;
+
+#ifdef DASM_CHECKS
+ *szp = 0;
+ if (D->status != DASM_S_OK) return D->status;
+ {
+ int pc;
+ for (pc = 0; pc*sizeof(int) < D->pcsize; pc++)
+ if (D->pclabels[pc] > 0) return DASM_S_UNDEF_PC|pc;
+ }
+#endif
+
+ { /* Handle globals not defined in this translation unit. */
+ int idx;
+ for (idx = 10; idx*sizeof(int) < D->lgsize; idx++) {
+ int n = D->lglabels[idx];
+ /* Undefined label: Collapse rel chain and replace with marker (< 0). */
+ while (n > 0) { int *pb = DASM_POS2PTR(D, n); n = *pb; *pb = -idx; }
+ }
+ }
+
+ /* Combine all code sections. No support for data sections (yet). */
+ for (secnum = 0; secnum < D->maxsection; secnum++) {
+ dasm_Section *sec = D->sections + secnum;
+ int *b = sec->rbuf;
+ int pos = DASM_SEC2POS(secnum);
+ int lastpos = sec->pos;
+
+ while (pos != lastpos) {
+ dasm_ActList p = D->actionlist + b[pos++];
+ while (1) {
+ int op, action = *p++;
+ switch (action) {
+ case DASM_REL_LG: p++; op = p[-3]; goto rel_pc;
+ case DASM_REL_PC: op = p[-2]; rel_pc: {
+ int shrink = op == 0xe9 ? 3 : ((op&0xf0) == 0x80 ? 4 : 0);
+ if (shrink) { /* Shrinkable branch opcode? */
+ int lofs, lpos = b[pos];
+ if (lpos < 0) goto noshrink; /* Ext global? */
+ lofs = *DASM_POS2PTR(D, lpos);
+ if (lpos > pos) { /* Fwd label: add cumulative section offsets. */
+ int i;
+ for (i = secnum; i < DASM_POS2SEC(lpos); i++)
+ lofs += D->sections[i].ofs;
+ } else {
+ lofs -= ofs; /* Bkwd label: unfix offset. */
+ }
+ lofs -= b[pos+1]; /* Short branch ok? */
+ if (lofs >= -128-shrink && lofs <= 127) ofs -= shrink; /* Yes. */
+ else { noshrink: shrink = 0; } /* No, cannot shrink op. */
+ }
+ b[pos+1] = shrink;
+ pos += 2;
+ break;
+ }
+ case DASM_SPACE: case DASM_IMM_LG: case DASM_VREG: p++;
+ case DASM_DISP: case DASM_IMM_S: case DASM_IMM_B: case DASM_IMM_W:
+ case DASM_IMM_D: case DASM_IMM_WB: case DASM_IMM_DB:
+ case DASM_SETLABEL: case DASM_REL_A: case DASM_IMM_PC: pos++; break;
+ case DASM_LABEL_LG: p++;
+ case DASM_LABEL_PC: b[pos++] += ofs; break; /* Fix label offset. */
+ case DASM_ALIGN: ofs -= (b[pos++]+ofs)&*p++; break; /* Adjust ofs. */
+ case DASM_EXTERN: p += 2; break;
+ case DASM_ESC: p++; break;
+ case DASM_MARK: break;
+ case DASM_SECTION: case DASM_STOP: goto stop;
+ }
+ }
+ stop: (void)0;
+ }
+ ofs += sec->ofs; /* Next section starts right after current section. */
+ }
+
+ D->codesize = ofs; /* Total size of all code sections */
+ *szp = ofs;
+ return DASM_S_OK;
+}
+
+#define dasmb(x) *cp++ = (unsigned char)(x)
+#ifndef DASM_ALIGNED_WRITES
+typedef ZEND_SET_ALIGNED(1, unsigned short unaligned_short);
+typedef ZEND_SET_ALIGNED(1, unsigned int unaligned_int);
+#define dasmw(x) \
+ do { *((unaligned_short *)cp) = (unsigned short)(x); cp+=2; } while (0)
+#define dasmd(x) \
+ do { *((unaligned_int *)cp) = (unsigned int)(x); cp+=4; } while (0)
+#else
+#define dasmw(x) do { dasmb(x); dasmb((x)>>8); } while (0)
+#define dasmd(x) do { dasmw(x); dasmw((x)>>16); } while (0)
+#endif
+
+/* Pass 3: Encode sections. */
+int dasm_encode(Dst_DECL, void *buffer)
+{
+ dasm_State *D = Dst_REF;
+ unsigned char *base = (unsigned char *)buffer;
+ unsigned char *cp = base;
+ int secnum;
+
+ /* Encode all code sections. No support for data sections (yet). */
+ for (secnum = 0; secnum < D->maxsection; secnum++) {
+ dasm_Section *sec = D->sections + secnum;
+ int *b = sec->buf;
+ int *endb = sec->rbuf + sec->pos;
+
+ while (b != endb) {
+ dasm_ActList p = D->actionlist + *b++;
+ unsigned char *mark = NULL;
+ while (1) {
+ int action = *p++;
+ int n = (action >= DASM_DISP && action <= DASM_ALIGN) ? *b++ : 0;
+ switch (action) {
+ case DASM_DISP: if (!mark) mark = cp; {
+ unsigned char *mm = mark;
+ if (*p != DASM_IMM_DB && *p != DASM_IMM_WB) mark = NULL;
+ if (n == 0) { int mrm = mm[-1]&7; if (mrm == 4) mrm = mm[0]&7;
+ if (mrm != 5) { mm[-1] -= 0x80; break; } }
+ if (((n+128) & -256) != 0) goto wd; else mm[-1] -= 0x40;
+ }
+ case DASM_IMM_S: case DASM_IMM_B: wb: dasmb(n); break;
+ case DASM_IMM_DB: if (((n+128)&-256) == 0) {
+ db: if (!mark) mark = cp; mark[-2] += 2; mark = NULL; goto wb;
+ } else mark = NULL;
+ case DASM_IMM_D: wd: dasmd(n); break;
+ case DASM_IMM_WB: if (((n+128)&-256) == 0) goto db; else mark = NULL;
+ case DASM_IMM_W: dasmw(n); break;
+ case DASM_VREG: {
+ int t = *p++;
+ unsigned char *ex = cp - (t&7);
+ if ((n & 8) && t < 0xa0) {
+ if (*ex & 0x80) ex[1] ^= 0x20 << (t>>6); else *ex ^= 1 << (t>>6);
+ n &= 7;
+ } else if (n & 0x10) {
+ if (*ex & 0x80) {
+ *ex = 0xc5; ex[1] = (ex[1] & 0x80) | ex[2]; ex += 2;
+ }
+ while (++ex < cp) ex[-1] = *ex;
+ if (mark) mark--;
+ cp--;
+ n &= 7;
+ }
+ if (t >= 0xc0) n <<= 4;
+ else if (t >= 0x40) n <<= 3;
+ else if (n == 4 && t < 0x20) { cp[-1] ^= n; *cp++ = 0x20; }
+ cp[-1] ^= n;
+ break;
+ }
+ case DASM_REL_LG: p++; if (n >= 0) goto rel_pc;
+ b++; n = (int)(ptrdiff_t)D->globals[-n];
+ case DASM_REL_A: rel_a: n -= (int)(ptrdiff_t)(cp+4); goto wd; /* !x64 */
+ case DASM_REL_PC: rel_pc: {
+ int shrink = *b++;
+ int *pb = DASM_POS2PTR(D, n); if (*pb < 0) { n = pb[1]; goto rel_a; }
+ n = *pb - ((int)(cp-base) + 4-shrink);
+ if (shrink == 0) goto wd;
+ if (shrink == 4) { cp--; cp[-1] = *cp-0x10; } else cp[-1] = 0xeb;
+ goto wb;
+ }
+ case DASM_IMM_LG:
+ p++; if (n < 0) { n = (int)(ptrdiff_t)D->globals[-n]; goto wd; }
+ case DASM_IMM_PC: {
+ int *pb = DASM_POS2PTR(D, n);
+ n = *pb < 0 ? pb[1] : (*pb + (int)(ptrdiff_t)base);
+ goto wd;
+ }
+ case DASM_LABEL_LG: {
+ int idx = *p++;
+ if (idx >= 10)
+ D->globals[idx] = (void *)(base + (*p == DASM_SETLABEL ? *b : n));
+ break;
+ }
+ case DASM_LABEL_PC: case DASM_SETLABEL: break;
+ case DASM_SPACE: { int fill = *p++; while (n--) *cp++ = fill; break; }
+ case DASM_ALIGN:
+ n = *p++;
+ while (((cp-base) & n)) *cp++ = 0x90; /* nop */
+ break;
+ case DASM_EXTERN: n = DASM_EXTERN(Dst, cp, p[1], *p); p += 2; goto wd;
+ case DASM_MARK: mark = cp; break;
+ case DASM_ESC: action = *p++;
+ default: *cp++ = action; break;
+ case DASM_SECTION: case DASM_STOP: goto stop;
+ }
+ }
+ stop: (void)0;
+ }
+ }
+
+ if (base + D->codesize != cp) /* Check for phase errors. */
+ return DASM_S_PHASE;
+ return DASM_S_OK;
+}
+
+/* Get PC label offset. */
+int dasm_getpclabel(Dst_DECL, unsigned int pc)
+{
+ dasm_State *D = Dst_REF;
+ if (pc*sizeof(int) < D->pcsize) {
+ int pos = D->pclabels[pc];
+ if (pos < 0) return *DASM_POS2PTR(D, -pos);
+ if (pos > 0) return -1; /* Undefined. */
+ }
+ return -2; /* Unused or out of range. */
+}
+
+#ifdef DASM_CHECKS
+/* Optional sanity checker to call between isolated encoding steps. */
+int dasm_checkstep(Dst_DECL, int secmatch)
+{
+ dasm_State *D = Dst_REF;
+ if (D->status == DASM_S_OK) {
+ int i;
+ for (i = 1; i <= 9; i++) {
+ if (D->lglabels[i] > 0) { D->status = DASM_S_UNDEF_L|i; break; }
+ D->lglabels[i] = 0;
+ }
+ }
+ if (D->status == DASM_S_OK && secmatch >= 0 &&
+ D->section != &D->sections[secmatch])
+ D->status = DASM_S_MATCH_SEC|(int)(D->section-D->sections);
+ return D->status;
+}
+#endif
+
diff --git a/ext/opcache/jit/dynasm/dasm_x86.lua b/ext/opcache/jit/dynasm/dasm_x86.lua
new file mode 100644
index 0000000000..a5efd98fb5
--- /dev/null
+++ b/ext/opcache/jit/dynasm/dasm_x86.lua
@@ -0,0 +1,2274 @@
+------------------------------------------------------------------------------
+-- DynASM x86/x64 module.
+--
+-- Copyright (C) 2005-2016 Mike Pall. All rights reserved.
+-- See dynasm.lua for full copyright notice.
+------------------------------------------------------------------------------
+
+local x64 = x64
+
+-- Module information:
+local _info = {
+ arch = x64 and "x64" or "x86",
+ description = "DynASM x86/x64 module",
+ version = "1.4.0",
+ vernum = 10400,
+ release = "2015-10-18",
+ author = "Mike Pall",
+ license = "MIT",
+}
+
+-- Exported glue functions for the arch-specific module.
+local _M = { _info = _info }
+
+-- Cache library functions.
+local type, tonumber, pairs, ipairs = type, tonumber, pairs, ipairs
+local assert, unpack, setmetatable = assert, unpack or table.unpack, setmetatable
+local _s = string
+local sub, format, byte, char = _s.sub, _s.format, _s.byte, _s.char
+local find, match, gmatch, gsub = _s.find, _s.match, _s.gmatch, _s.gsub
+local concat, sort, remove = table.concat, table.sort, table.remove
+local bit = bit or require("bit")
+local band, bxor, shl, shr = bit.band, bit.bxor, bit.lshift, bit.rshift
+
+-- Inherited tables and callbacks.
+local g_opt, g_arch
+local wline, werror, wfatal, wwarn
+
+-- Action name list.
+-- CHECK: Keep this in sync with the C code!
+local action_names = {
+ -- int arg, 1 buffer pos:
+ "DISP", "IMM_S", "IMM_B", "IMM_W", "IMM_D", "IMM_WB", "IMM_DB",
+ -- action arg (1 byte), int arg, 1 buffer pos (reg/num):
+ "VREG", "SPACE",
+ -- ptrdiff_t arg, 1 buffer pos (address): !x64
+ "SETLABEL", "REL_A",
+ -- action arg (1 byte) or int arg, 2 buffer pos (link, offset):
+ "REL_LG", "REL_PC",
+ -- action arg (1 byte) or int arg, 1 buffer pos (link):
+ "IMM_LG", "IMM_PC",
+ -- action arg (1 byte) or int arg, 1 buffer pos (offset):
+ "LABEL_LG", "LABEL_PC",
+ -- action arg (1 byte), 1 buffer pos (offset):
+ "ALIGN",
+ -- action args (2 bytes), no buffer pos.
+ "EXTERN",
+ -- action arg (1 byte), no buffer pos.
+ "ESC",
+ -- no action arg, no buffer pos.
+ "MARK",
+ -- action arg (1 byte), no buffer pos, terminal action:
+ "SECTION",
+ -- no args, no buffer pos, terminal action:
+ "STOP"
+}
+
+-- Maximum number of section buffer positions for dasm_put().
+-- CHECK: Keep this in sync with the C code!
+local maxsecpos = 25 -- Keep this low, to avoid excessively long C lines.
+
+-- Action name -> action number (dynamically generated below).
+local map_action = {}
+-- First action number. Everything below does not need to be escaped.
+local actfirst = 256-#action_names
+
+-- Action list buffer and string (only used to remove dupes).
+local actlist = {}
+local actstr = ""
+
+-- Argument list for next dasm_put(). Start with offset 0 into action list.
+local actargs = { 0 }
+
+-- Current number of section buffer positions for dasm_put().
+local secpos = 1
+
+-- VREG kind encodings, pre-shifted by 5 bits.
+local map_vreg = {
+ ["modrm.rm.m"] = 0x00,
+ ["modrm.rm.r"] = 0x20,
+ ["opcode"] = 0x20,
+ ["sib.base"] = 0x20,
+ ["sib.index"] = 0x40,
+ ["modrm.reg"] = 0x80,
+ ["vex.v"] = 0xa0,
+ ["imm.hi"] = 0xc0,
+}
+
+-- Current number of VREG actions contributing to REX/VEX shrinkage.
+local vreg_shrink_count = 0
+
+------------------------------------------------------------------------------
+
+-- Compute action numbers for action names.
+for n,name in ipairs(action_names) do
+ local num = actfirst + n - 1
+ map_action[name] = num
+end
+
+-- Dump action names and numbers.
+local function dumpactions(out)
+ out:write("DynASM encoding engine action codes:\n")
+ for n,name in ipairs(action_names) do
+ local num = map_action[name]
+ out:write(format(" %-10s %02X %d\n", name, num, num))
+ end
+ out:write("\n")
+end
+
+-- Write action list buffer as a huge static C array.
+local function writeactions(out, name)
+ local nn = #actlist
+ local last = actlist[nn] or 255
+ actlist[nn] = nil -- Remove last byte.
+ if nn == 0 then nn = 1 end
+ out:write("static const unsigned char ", name, "[", nn, "] = {\n")
+ local s = " "
+ for n,b in ipairs(actlist) do
+ s = s..b..","
+ if #s >= 75 then
+ assert(out:write(s, "\n"))
+ s = " "
+ end
+ end
+ out:write(s, last, "\n};\n\n") -- Add last byte back.
+end
+
+------------------------------------------------------------------------------
+
+-- Add byte to action list.
+local function wputxb(n)
+ assert(n >= 0 and n <= 255 and n % 1 == 0, "byte out of range")
+ actlist[#actlist+1] = n
+end
+
+-- Add action to list with optional arg. Advance buffer pos, too.
+local function waction(action, a, num)
+ wputxb(assert(map_action[action], "bad action name `"..action.."'"))
+ if a then actargs[#actargs+1] = a end
+ if a or num then secpos = secpos + (num or 1) end
+end
+
+-- Optionally add a VREG action.
+local function wvreg(kind, vreg, psz, sk, defer)
+ if not vreg then return end
+ waction("VREG", vreg)
+ local b = assert(map_vreg[kind], "bad vreg kind `"..vreg.."'")
+ if b < (sk or 0) then
+ vreg_shrink_count = vreg_shrink_count + 1
+ end
+ if not defer then
+ b = b + vreg_shrink_count * 8
+ vreg_shrink_count = 0
+ end
+ wputxb(b + (psz or 0))
+end
+
+-- Add call to embedded DynASM C code.
+local function wcall(func, args)
+ wline(format("dasm_%s(Dst, %s);", func, concat(args, ", ")), true)
+end
+
+-- Delete duplicate action list chunks. A tad slow, but so what.
+local function dedupechunk(offset)
+ local al, as = actlist, actstr
+ local chunk = char(unpack(al, offset+1, #al))
+ local orig = find(as, chunk, 1, true)
+ if orig then
+ actargs[1] = orig-1 -- Replace with original offset.
+ for i=offset+1,#al do al[i] = nil end -- Kill dupe.
+ else
+ actstr = as..chunk
+ end
+end
+
+-- Flush action list (intervening C code or buffer pos overflow).
+local function wflush(term)
+ local offset = actargs[1]
+ if #actlist == offset then return end -- Nothing to flush.
+ if not term then waction("STOP") end -- Terminate action list.
+ dedupechunk(offset)
+ wcall("put", actargs) -- Add call to dasm_put().
+ actargs = { #actlist } -- Actionlist offset is 1st arg to next dasm_put().
+ secpos = 1 -- The actionlist offset occupies a buffer position, too.
+end
+
+-- Put escaped byte.
+local function wputb(n)
+ if n >= actfirst then waction("ESC") end -- Need to escape byte.
+ wputxb(n)
+end
+
+------------------------------------------------------------------------------
+
+-- Global label name -> global label number. With auto assignment on 1st use.
+local next_global = 10
+local map_global = setmetatable({}, { __index = function(t, name)
+ if not match(name, "^[%a_][%w_@]*$") then werror("bad global label") end
+ local n = next_global
+ if n > 246 then werror("too many global labels") end
+ next_global = n + 1
+ t[name] = n
+ return n
+end})
+
+-- Dump global labels.
+local function dumpglobals(out, lvl)
+ local t = {}
+ for name, n in pairs(map_global) do t[n] = name end
+ out:write("Global labels:\n")
+ for i=10,next_global-1 do
+ out:write(format(" %s\n", t[i]))
+ end
+ out:write("\n")
+end
+
+-- Write global label enum.
+local function writeglobals(out, prefix)
+ local t = {}
+ for name, n in pairs(map_global) do t[n] = name end
+ out:write("enum {\n")
+ for i=10,next_global-1 do
+ out:write(" ", prefix, gsub(t[i], "@.*", ""), ",\n")
+ end
+ out:write(" ", prefix, "_MAX\n};\n")
+end
+
+-- Write global label names.
+local function writeglobalnames(out, name)
+ local t = {}
+ for name, n in pairs(map_global) do t[n] = name end
+ out:write("static const char *const ", name, "[] = {\n")
+ for i=10,next_global-1 do
+ out:write(" \"", t[i], "\",\n")
+ end
+ out:write(" (const char *)0\n};\n")
+end
+
+------------------------------------------------------------------------------
+
+-- Extern label name -> extern label number. With auto assignment on 1st use.
+local next_extern = -1
+local map_extern = setmetatable({}, { __index = function(t, name)
+ -- No restrictions on the name for now.
+ local n = next_extern
+ if n < -256 then werror("too many extern labels") end
+ next_extern = n - 1
+ t[name] = n
+ return n
+end})
+
+-- Dump extern labels.
+local function dumpexterns(out, lvl)
+ local t = {}
+ for name, n in pairs(map_extern) do t[-n] = name end
+ out:write("Extern labels:\n")
+ for i=1,-next_extern-1 do
+ out:write(format(" %s\n", t[i]))
+ end
+ out:write("\n")
+end
+
+-- Write extern label names.
+local function writeexternnames(out, name)
+ local t = {}
+ for name, n in pairs(map_extern) do t[-n] = name end
+ out:write("static const char *const ", name, "[] = {\n")
+ for i=1,-next_extern-1 do
+ out:write(" \"", t[i], "\",\n")
+ end
+ out:write(" (const char *)0\n};\n")
+end
+
+------------------------------------------------------------------------------
+
+-- Arch-specific maps.
+local map_archdef = {} -- Ext. register name -> int. name.
+local map_reg_rev = {} -- Int. register name -> ext. name.
+local map_reg_num = {} -- Int. register name -> register number.
+local map_reg_opsize = {} -- Int. register name -> operand size.
+local map_reg_valid_base = {} -- Int. register name -> valid base register?
+local map_reg_valid_index = {} -- Int. register name -> valid index register?
+local map_reg_needrex = {} -- Int. register name -> need rex vs. no rex.
+local reg_list = {} -- Canonical list of int. register names.
+
+local map_type = {} -- Type name -> { ctype, reg }
+local ctypenum = 0 -- Type number (for _PTx macros).
+
+local addrsize = x64 and "q" or "d" -- Size for address operands.
+
+-- Helper functions to fill register maps.
+local function mkrmap(sz, cl, names)
+ local cname = format("@%s", sz)
+ reg_list[#reg_list+1] = cname
+ map_archdef[cl] = cname
+ map_reg_rev[cname] = cl
+ map_reg_num[cname] = -1
+ map_reg_opsize[cname] = sz
+ if sz == addrsize or sz == "d" then
+ map_reg_valid_base[cname] = true
+ map_reg_valid_index[cname] = true
+ end
+ if names then
+ for n,name in ipairs(names) do
+ local iname = format("@%s%x", sz, n-1)
+ reg_list[#reg_list+1] = iname
+ map_archdef[name] = iname
+ map_reg_rev[iname] = name
+ map_reg_num[iname] = n-1
+ map_reg_opsize[iname] = sz
+ if sz == "b" and n > 4 then map_reg_needrex[iname] = false end
+ if sz == addrsize or sz == "d" then
+ map_reg_valid_base[iname] = true
+ map_reg_valid_index[iname] = true
+ end
+ end
+ end
+ for i=0,(x64 and sz ~= "f") and 15 or 7 do
+ local needrex = sz == "b" and i > 3
+ local iname = format("@%s%x%s", sz, i, needrex and "R" or "")
+ if needrex then map_reg_needrex[iname] = true end
+ local name
+ if sz == "o" or sz == "y" then name = format("%s%d", cl, i)
+ elseif sz == "f" then name = format("st%d", i)
+ else name = format("r%d%s", i, sz == addrsize and "" or sz) end
+ map_archdef[name] = iname
+ if not map_reg_rev[iname] then
+ reg_list[#reg_list+1] = iname
+ map_reg_rev[iname] = name
+ map_reg_num[iname] = i
+ map_reg_opsize[iname] = sz
+ if sz == addrsize or sz == "d" then
+ map_reg_valid_base[iname] = true
+ map_reg_valid_index[iname] = true
+ end
+ end
+ end
+ reg_list[#reg_list+1] = ""
+end
+
+-- Integer registers (qword, dword, word and byte sized).
+if x64 then
+ mkrmap("q", "Rq", {"rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi"})
+end
+mkrmap("d", "Rd", {"eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi"})
+mkrmap("w", "Rw", {"ax", "cx", "dx", "bx", "sp", "bp", "si", "di"})
+mkrmap("b", "Rb", {"al", "cl", "dl", "bl", "ah", "ch", "dh", "bh"})
+map_reg_valid_index[map_archdef.esp] = false
+if x64 then map_reg_valid_index[map_archdef.rsp] = false end
+if x64 then map_reg_needrex[map_archdef.Rb] = true end
+map_archdef["Ra"] = "@"..addrsize
+
+-- FP registers (internally tword sized, but use "f" as operand size).
+mkrmap("f", "Rf")
+
+-- SSE registers (oword sized, but qword and dword accessible).
+mkrmap("o", "xmm")
+
+-- AVX registers (yword sized, but oword, qword and dword accessible).
+mkrmap("y", "ymm")
+
+-- Operand size prefixes to codes.
+local map_opsize = {
+ byte = "b", word = "w", dword = "d", qword = "q", oword = "o", yword = "y",
+ tword = "t", aword = addrsize,
+}
+
+-- Operand size code to number.
+local map_opsizenum = {
+ b = 1, w = 2, d = 4, q = 8, o = 16, y = 32, t = 10,
+}
+
+-- Operand size code to name.
+local map_opsizename = {
+ b = "byte", w = "word", d = "dword", q = "qword", o = "oword", y = "yword",
+ t = "tword", f = "fpword",
+}
+
+-- Valid index register scale factors.
+local map_xsc = {
+ ["1"] = 0, ["2"] = 1, ["4"] = 2, ["8"] = 3,
+}
+
+-- Condition codes.
+local map_cc = {
+ o = 0, no = 1, b = 2, nb = 3, e = 4, ne = 5, be = 6, nbe = 7,
+ s = 8, ns = 9, p = 10, np = 11, l = 12, nl = 13, le = 14, nle = 15,
+ c = 2, nae = 2, nc = 3, ae = 3, z = 4, nz = 5, na = 6, a = 7,
+ pe = 10, po = 11, nge = 12, ge = 13, ng = 14, g = 15,
+}
+
+
+-- Reverse defines for registers.
+function _M.revdef(s)
+ return gsub(s, "@%w+", map_reg_rev)
+end
+
+-- Dump register names and numbers
+local function dumpregs(out)
+ out:write("Register names, sizes and internal numbers:\n")
+ for _,reg in ipairs(reg_list) do
+ if reg == "" then
+ out:write("\n")
+ else
+ local name = map_reg_rev[reg]
+ local num = map_reg_num[reg]
+ local opsize = map_opsizename[map_reg_opsize[reg]]
+ out:write(format(" %-5s %-8s %s\n", name, opsize,
+ num < 0 and "(variable)" or num))
+ end
+ end
+end
+
+------------------------------------------------------------------------------
+
+-- Put action for label arg (IMM_LG, IMM_PC, REL_LG, REL_PC).
+local function wputlabel(aprefix, imm, num)
+ if type(imm) == "number" then
+ if imm < 0 then
+ waction("EXTERN")
+ wputxb(aprefix == "IMM_" and 0 or 1)
+ imm = -imm-1
+ else
+ waction(aprefix.."LG", nil, num);
+ end
+ wputxb(imm)
+ else
+ waction(aprefix.."PC", imm, num)
+ end
+end
+
+-- Put signed byte or arg.
+local function wputsbarg(n)
+ if type(n) == "number" then
+ if n < -128 or n > 127 then
+ werror("signed immediate byte out of range")
+ end
+ if n < 0 then n = n + 256 end
+ wputb(n)
+ else waction("IMM_S", n) end
+end
+
+-- Put unsigned byte or arg.
+local function wputbarg(n)
+ if type(n) == "number" then
+ if n < 0 or n > 255 then
+ werror("unsigned immediate byte out of range")
+ end
+ wputb(n)
+ else waction("IMM_B", n) end
+end
+
+-- Put unsigned word or arg.
+local function wputwarg(n)
+ if type(n) == "number" then
+ if shr(n, 16) ~= 0 then
+ werror("unsigned immediate word out of range")
+ end
+ wputb(band(n, 255)); wputb(shr(n, 8));
+ else waction("IMM_W", n) end
+end
+
+-- Put signed or unsigned dword or arg.
+local function wputdarg(n)
+ local tn = type(n)
+ if tn == "number" then
+ wputb(band(n, 255))
+ wputb(band(shr(n, 8), 255))
+ wputb(band(shr(n, 16), 255))
+ wputb(shr(n, 24))
+ elseif tn == "table" then
+ wputlabel("IMM_", n[1], 1)
+ else
+ waction("IMM_D", n)
+ end
+end
+
+-- Put operand-size dependent number or arg (defaults to dword).
+local function wputszarg(sz, n)
+ if not sz or sz == "d" or sz == "q" then wputdarg(n)
+ elseif sz == "w" then wputwarg(n)
+ elseif sz == "b" then wputbarg(n)
+ elseif sz == "s" then wputsbarg(n)
+ else werror("bad operand size") end
+end
+
+-- Put multi-byte opcode with operand-size dependent modifications.
+local function wputop(sz, op, rex, vex, vregr, vregxb)
+ local psz, sk = 0, nil
+ if vex then
+ local tail
+ if vex.m == 1 and band(rex, 11) == 0 then
+ if x64 and vregxb then
+ sk = map_vreg["modrm.reg"]
+ else
+ wputb(0xc5)
+ tail = shl(bxor(band(rex, 4), 4), 5)
+ psz = 3
+ end
+ end
+ if not tail then
+ wputb(0xc4)
+ wputb(shl(bxor(band(rex, 7), 7), 5) + vex.m)
+ tail = shl(band(rex, 8), 4)
+ psz = 4
+ end
+ local reg, vreg = 0, nil
+ if vex.v then
+ reg = vex.v.reg
+ if not reg then werror("bad vex operand") end
+ if reg < 0 then reg = 0; vreg = vex.v.vreg end
+ end
+ if sz == "y" or vex.l then tail = tail + 4 end
+ wputb(tail + shl(bxor(reg, 15), 3) + vex.p)
+ wvreg("vex.v", vreg)
+ rex = 0
+ if op >= 256 then werror("bad vex opcode") end
+ else
+ if rex ~= 0 then
+ if not x64 then werror("bad operand size") end
+ elseif (vregr or vregxb) and x64 then
+ rex = 0x10
+ sk = map_vreg["vex.v"]
+ end
+ end
+ local r
+ if sz == "w" then wputb(102) end
+ -- Needs >32 bit numbers, but only for crc32 eax, word [ebx]
+ if op >= 4294967296 then r = op%4294967296 wputb((op-r)/4294967296) op = r end
+ if op >= 16777216 then wputb(shr(op, 24)); op = band(op, 0xffffff) end
+ if op >= 65536 then
+ if rex ~= 0 then
+ local opc3 = band(op, 0xffff00)
+ if opc3 == 0x0f3a00 or opc3 == 0x0f3800 then
+ wputb(64 + band(rex, 15)); rex = 0; psz = 2
+ end
+ end
+ wputb(shr(op, 16)); op = band(op, 0xffff); psz = psz + 1
+ end
+ if op >= 256 then
+ local b = shr(op, 8)
+ if b == 15 and rex ~= 0 then wputb(64 + band(rex, 15)); rex = 0; psz = 2 end
+ wputb(b); op = band(op, 255); psz = psz + 1
+ end
+ if rex ~= 0 then wputb(64 + band(rex, 15)); psz = 2 end
+ if sz == "b" then op = op - 1 end
+ wputb(op)
+ return psz, sk
+end
+
+-- Put ModRM or SIB formatted byte.
+local function wputmodrm(m, s, rm, vs, vrm)
+ assert(m < 4 and s < 16 and rm < 16, "bad modrm operands")
+ wputb(shl(m, 6) + shl(band(s, 7), 3) + band(rm, 7))
+end
+
+-- Put ModRM/SIB plus optional displacement.
+local function wputmrmsib(t, imark, s, vsreg, psz, sk)
+ local vreg, vxreg
+ local reg, xreg = t.reg, t.xreg
+ if reg and reg < 0 then reg = 0; vreg = t.vreg end
+ if xreg and xreg < 0 then xreg = 0; vxreg = t.vxreg end
+ if s < 0 then s = 0 end
+
+ -- Register mode.
+ if sub(t.mode, 1, 1) == "r" then
+ wputmodrm(3, s, reg)
+ wvreg("modrm.reg", vsreg, psz+1, sk, vreg)
+ wvreg("modrm.rm.r", vreg, psz+1, sk)
+ return
+ end
+
+ local disp = t.disp
+ local tdisp = type(disp)
+ -- No base register?
+ if not reg then
+ local riprel = false
+ if xreg then
+ -- Indexed mode with index register only.
+ -- [xreg*xsc+disp] -> (0, s, esp) (xsc, xreg, ebp)
+ wputmodrm(0, s, 4)
+ if imark == "I" then waction("MARK") end
+ wvreg("modrm.reg", vsreg, psz+1, sk, vxreg)
+ wputmodrm(t.xsc, xreg, 5)
+ wvreg("sib.index", vxreg, psz+2, sk)
+ else
+ -- Pure 32 bit displacement.
+ if x64 and tdisp ~= "table" then
+ wputmodrm(0, s, 4) -- [disp] -> (0, s, esp) (0, esp, ebp)
+ wvreg("modrm.reg", vsreg, psz+1, sk)
+ if imark == "I" then waction("MARK") end
+ wputmodrm(0, 4, 5)
+ else
+ riprel = x64
+ wputmodrm(0, s, 5) -- [disp|rip-label] -> (0, s, ebp)
+ wvreg("modrm.reg", vsreg, psz+1, sk)
+ if imark == "I" then waction("MARK") end
+ end
+ end
+ if riprel then -- Emit rip-relative displacement.
+ if match("UWSiI", imark) then
+ werror("NYI: rip-relative displacement followed by immediate")
+ end
+ -- The previous byte in the action buffer cannot be 0xe9 or 0x80-0x8f.
+ wputlabel("REL_", disp[1], 2)
+ else
+ wputdarg(disp)
+ end
+ return
+ end
+
+ local m
+ if tdisp == "number" then -- Check displacement size at assembly time.
+ if disp == 0 and band(reg, 7) ~= 5 then -- [ebp] -> [ebp+0] (in SIB, too)
+ if not vreg then m = 0 end -- Force DISP to allow [Rd(5)] -> [ebp+0]
+ elseif disp >= -128 and disp <= 127 then m = 1
+ else m = 2 end
+ elseif tdisp == "table" then
+ m = 2
+ end
+
+ -- Index register present or esp as base register: need SIB encoding.
+ if xreg or band(reg, 7) == 4 then
+ wputmodrm(m or 2, s, 4) -- ModRM.
+ if m == nil or imark == "I" then waction("MARK") end
+ wvreg("modrm.reg", vsreg, psz+1, sk, vxreg or vreg)
+ wputmodrm(t.xsc or 0, xreg or 4, reg) -- SIB.
+ wvreg("sib.index", vxreg, psz+2, sk, vreg)
+ wvreg("sib.base", vreg, psz+2, sk)
+ else
+ wputmodrm(m or 2, s, reg) -- ModRM.
+ if (imark == "I" and (m == 1 or m == 2)) or
+ (m == nil and (vsreg or vreg)) then waction("MARK") end
+ wvreg("modrm.reg", vsreg, psz+1, sk, vreg)
+ wvreg("modrm.rm.m", vreg, psz+1, sk)
+ end
+
+ -- Put displacement.
+ if m == 1 then wputsbarg(disp)
+ elseif m == 2 then wputdarg(disp)
+ elseif m == nil then waction("DISP", disp) end
+end
+
+------------------------------------------------------------------------------
+
+-- Return human-readable operand mode string.
+local function opmodestr(op, args)
+ local m = {}
+ for i=1,#args do
+ local a = args[i]
+ m[#m+1] = sub(a.mode, 1, 1)..(a.opsize or "?")
+ end
+ return op.." "..concat(m, ",")
+end
+
+-- Convert number to valid integer or nil.
+local function toint(expr)
+ local n = tonumber(expr)
+ if n then
+ if n % 1 ~= 0 or n < -2147483648 or n > 4294967295 then
+ werror("bad integer number `"..expr.."'")
+ end
+ return n
+ end
+end
+
+-- Parse immediate expression.
+local function immexpr(expr)
+ -- &expr (pointer)
+ if sub(expr, 1, 1) == "&" then
+ return "iPJ", format("(ptrdiff_t)(%s)", sub(expr,2))
+ end
+
+ local prefix = sub(expr, 1, 2)
+ -- =>expr (pc label reference)
+ if prefix == "=>" then
+ return "iJ", sub(expr, 3)
+ end
+ -- ->name (global label reference)
+ if prefix == "->" then
+ return "iJ", map_global[sub(expr, 3)]
+ end
+
+ -- [<>][1-9] (local label reference)
+ local dir, lnum = match(expr, "^([<>])([1-9])$")
+ if dir then -- Fwd: 247-255, Bkwd: 1-9.
+ return "iJ", lnum + (dir == ">" and 246 or 0)
+ end
+
+ local extname = match(expr, "^extern%s+(%S+)$")
+ if extname then
+ return "iJ", map_extern[extname]
+ end
+
+ -- expr (interpreted as immediate)
+ return "iI", expr
+end
+
+-- Parse displacement expression: +-num, +-expr, +-opsize*num
+local function dispexpr(expr)
+ local disp = expr == "" and 0 or toint(expr)
+ if disp then return disp end
+ local c, dispt = match(expr, "^([+-])%s*(.+)$")
+ if c == "+" then
+ expr = dispt
+ elseif not c then
+ werror("bad displacement expression `"..expr.."'")
+ end
+ local opsize, tailops = match(dispt, "^(%w+)%s*%*%s*(.+)$")
+ local ops, imm = map_opsize[opsize], toint(tailops)
+ if ops and imm then
+ if c == "-" then imm = -imm end
+ return imm*map_opsizenum[ops]
+ end
+ local mode, iexpr = immexpr(dispt)
+ if mode == "iJ" then
+ if c == "-" then werror("cannot invert label reference") end
+ return { iexpr }
+ end
+ return expr -- Need to return original signed expression.
+end
+
+-- Parse register or type expression.
+local function rtexpr(expr)
+ if not expr then return end
+ local tname, ovreg = match(expr, "^([%w_]+):(@[%w_]+)$")
+ local tp = map_type[tname or expr]
+ if tp then
+ local reg = ovreg or tp.reg
+ local rnum = map_reg_num[reg]
+ if not rnum then
+ werror("type `"..(tname or expr).."' needs a register override")
+ end
+ if not map_reg_valid_base[reg] then
+ werror("bad base register override `"..(map_reg_rev[reg] or reg).."'")
+ end
+ return reg, rnum, tp
+ end
+ return expr, map_reg_num[expr]
+end
+
+-- Parse operand and return { mode, opsize, reg, xreg, xsc, disp, imm }.
+local function parseoperand(param)
+ local t = {}
+
+ local expr = param
+ local opsize, tailops = match(param, "^(%w+)%s*(.+)$")
+ if opsize then
+ t.opsize = map_opsize[opsize]
+ if t.opsize then expr = tailops end
+ end
+
+ local br = match(expr, "^%[%s*(.-)%s*%]$")
+ repeat
+ if br then
+ t.mode = "xm"
+
+ -- [disp]
+ t.disp = toint(br)
+ if t.disp then
+ t.mode = x64 and "xm" or "xmO"
+ break
+ end
+
+ -- [reg...]
+ local tp
+ local reg, tailr = match(br, "^([@%w_:]+)%s*(.*)$")
+ reg, t.reg, tp = rtexpr(reg)
+ if not t.reg then
+ -- [expr]
+ t.mode = x64 and "xm" or "xmO"
+ t.disp = dispexpr("+"..br)
+ break
+ end
+
+ if t.reg == -1 then
+ t.vreg, tailr = match(tailr, "^(%b())(.*)$")
+ if not t.vreg then werror("bad variable register expression") end
+ end
+
+ -- [xreg*xsc] or [xreg*xsc+-disp] or [xreg*xsc+-expr]
+ local xsc, tailsc = match(tailr, "^%*%s*([1248])%s*(.*)$")
+ if xsc then
+ if not map_reg_valid_index[reg] then
+ werror("bad index register `"..map_reg_rev[reg].."'")
+ end
+ t.xsc = map_xsc[xsc]
+ t.xreg = t.reg
+ t.vxreg = t.vreg
+ t.reg = nil
+ t.vreg = nil
+ t.disp = dispexpr(tailsc)
+ break
+ end
+ if not map_reg_valid_base[reg] then
+ werror("bad base register `"..map_reg_rev[reg].."'")
+ end
+
+ -- [reg] or [reg+-disp]
+ t.disp = toint(tailr) or (tailr == "" and 0)
+ if t.disp then break end
+
+ -- [reg+xreg...]
+ local xreg, tailx = match(tailr, "^+%s*([@%w_:]+)%s*(.*)$")
+ xreg, t.xreg, tp = rtexpr(xreg)
+ if not t.xreg then
+ -- [reg+-expr]
+ t.disp = dispexpr(tailr)
+ break
+ end
+ if not map_reg_valid_index[xreg] then
+ werror("bad index register `"..map_reg_rev[xreg].."'")
+ end
+
+ if t.xreg == -1 then
+ t.vxreg, tailx = match(tailx, "^(%b())(.*)$")
+ if not t.vxreg then werror("bad variable register expression") end
+ end
+
+ -- [reg+xreg*xsc...]
+ local xsc, tailsc = match(tailx, "^%*%s*([1248])%s*(.*)$")
+ if xsc then
+ t.xsc = map_xsc[xsc]
+ tailx = tailsc
+ end
+
+ -- [...] or [...+-disp] or [...+-expr]
+ t.disp = dispexpr(tailx)
+ else
+ -- imm or opsize*imm
+ local imm = toint(expr)
+ if not imm and sub(expr, 1, 1) == "*" and t.opsize then
+ imm = toint(sub(expr, 2))
+ if imm then
+ imm = imm * map_opsizenum[t.opsize]
+ t.opsize = nil
+ end
+ end
+ if imm then
+ if t.opsize then werror("bad operand size override") end
+ local m = "i"
+ if imm == 1 then m = m.."1" end
+ if imm >= 4294967168 and imm <= 4294967295 then imm = imm-4294967296 end
+ if imm >= -128 and imm <= 127 then m = m.."S" end
+ t.imm = imm
+ t.mode = m
+ break
+ end
+
+ local tp
+ local reg, tailr = match(expr, "^([@%w_:]+)%s*(.*)$")
+ reg, t.reg, tp = rtexpr(reg)
+ if t.reg then
+ if t.reg == -1 then
+ t.vreg, tailr = match(tailr, "^(%b())(.*)$")
+ if not t.vreg then werror("bad variable register expression") end
+ end
+ -- reg
+ if tailr == "" then
+ if t.opsize then werror("bad operand size override") end
+ t.opsize = map_reg_opsize[reg]
+ if t.opsize == "f" then
+ t.mode = t.reg == 0 and "fF" or "f"
+ else
+ if reg == "@w4" or (x64 and reg == "@d4") then
+ wwarn("bad idea, try again with `"..(x64 and "rsp'" or "esp'"))
+ end
+ t.mode = t.reg == 0 and "rmR" or (reg == "@b1" and "rmC" or "rm")
+ end
+ t.needrex = map_reg_needrex[reg]
+ break
+ end
+
+ -- type[idx], type[idx].field, type->field -> [reg+offset_expr]
+ if not tp then werror("bad operand `"..param.."'") end
+ t.mode = "xm"
+ t.disp = format(tp.ctypefmt, tailr)
+ else
+ t.mode, t.imm = immexpr(expr)
+ if sub(t.mode, -1) == "J" then
+ if t.opsize and t.opsize ~= addrsize then
+ werror("bad operand size override")
+ end
+ t.opsize = addrsize
+ end
+ end
+ end
+ until true
+ return t
+end
+
+------------------------------------------------------------------------------
+-- x86 Template String Description
+-- ===============================
+--
+-- Each template string is a list of [match:]pattern pairs,
+-- separated by "|". The first match wins. No match means a
+-- bad or unsupported combination of operand modes or sizes.
+--
+-- The match part and the ":" is omitted if the operation has
+-- no operands. Otherwise the first N characters are matched
+-- against the mode strings of each of the N operands.
+--
+-- The mode string for each operand type is (see parseoperand()):
+-- Integer register: "rm", +"R" for eax, ax, al, +"C" for cl
+-- FP register: "f", +"F" for st0
+-- Index operand: "xm", +"O" for [disp] (pure offset)
+-- Immediate: "i", +"S" for signed 8 bit, +"1" for 1,
+-- +"I" for arg, +"P" for pointer
+-- Any: +"J" for valid jump targets
+--
+-- So a match character "m" (mixed) matches both an integer register
+-- and an index operand (to be encoded with the ModRM/SIB scheme).
+-- But "r" matches only a register and "x" only an index operand
+-- (e.g. for FP memory access operations).
+--
+-- The operand size match string starts right after the mode match
+-- characters and ends before the ":". "dwb" or "qdwb" is assumed, if empty.
+-- The effective data size of the operation is matched against this list.
+--
+-- If only the regular "b", "w", "d", "q", "t" operand sizes are
+-- present, then all operands must be the same size. Unspecified sizes
+-- are ignored, but at least one operand must have a size or the pattern
+-- won't match (use the "byte", "word", "dword", "qword", "tword"
+-- operand size overrides. E.g.: mov dword [eax], 1).
+--
+-- If the list has a "1" or "2" prefix, the operand size is taken
+-- from the respective operand and any other operand sizes are ignored.
+-- If the list contains only ".", all operand sizes are ignored.
+-- If the list has a "/" prefix, the concatenated (mixed) operand sizes
+-- are compared to the match.
+--
+-- E.g. "rrdw" matches for either two dword registers or two word
+-- registers. "Fx2dq" matches an st0 operand plus an index operand
+-- pointing to a dword (float) or qword (double).
+--
+-- Every character after the ":" is part of the pattern string:
+-- Hex chars are accumulated to form the opcode (left to right).
+-- "n" disables the standard opcode mods
+-- (otherwise: -1 for "b", o16 prefix for "w", rex.w for "q")
+-- "X" Force REX.W.
+-- "r"/"R" adds the reg. number from the 1st/2nd operand to the opcode.
+-- "m"/"M" generates ModRM/SIB from the 1st/2nd operand.
+-- The spare 3 bits are either filled with the last hex digit or
+-- the result from a previous "r"/"R". The opcode is restored.
+-- "u" Use VEX encoding, vvvv unused.
+-- "v"/"V" Use VEX encoding, vvvv from 1st/2nd operand (the operand is
+-- removed from the list used by future characters).
+-- "L" Force VEX.L
+--
+-- All of the following characters force a flush of the opcode:
+-- "o"/"O" stores a pure 32 bit disp (offset) from the 1st/2nd operand.
+-- "s" stores a 4 bit immediate from the last register operand,
+-- followed by 4 zero bits.
+-- "S" stores a signed 8 bit immediate from the last operand.
+-- "U" stores an unsigned 8 bit immediate from the last operand.
+-- "W" stores an unsigned 16 bit immediate from the last operand.
+-- "i" stores an operand sized immediate from the last operand.
+-- "I" dito, but generates an action code to optionally modify
+-- the opcode (+2) for a signed 8 bit immediate.
+-- "J" generates one of the REL action codes from the last operand.
+--
+------------------------------------------------------------------------------
+
+-- Template strings for x86 instructions. Ordered by first opcode byte.
+-- Unimplemented opcodes (deliberate omissions) are marked with *.
+local map_op = {
+ -- 00-05: add...
+ -- 06: *push es
+ -- 07: *pop es
+ -- 08-0D: or...
+ -- 0E: *push cs
+ -- 0F: two byte opcode prefix
+ -- 10-15: adc...
+ -- 16: *push ss
+ -- 17: *pop ss
+ -- 18-1D: sbb...
+ -- 1E: *push ds
+ -- 1F: *pop ds
+ -- 20-25: and...
+ es_0 = "26",
+ -- 27: *daa
+ -- 28-2D: sub...
+ cs_0 = "2E",
+ -- 2F: *das
+ -- 30-35: xor...
+ ss_0 = "36",
+ -- 37: *aaa
+ -- 38-3D: cmp...
+ ds_0 = "3E",
+ -- 3F: *aas
+ inc_1 = x64 and "m:FF0m" or "rdw:40r|m:FF0m",
+ dec_1 = x64 and "m:FF1m" or "rdw:48r|m:FF1m",
+ push_1 = (x64 and "rq:n50r|rw:50r|mq:nFF6m|mw:FF6m" or
+ "rdw:50r|mdw:FF6m").."|S.:6AS|ib:n6Ai|i.:68i",
+ pop_1 = x64 and "rq:n58r|rw:58r|mq:n8F0m|mw:8F0m" or "rdw:58r|mdw:8F0m",
+ -- 60: *pusha, *pushad, *pushaw
+ -- 61: *popa, *popad, *popaw
+ -- 62: *bound rdw,x
+ -- 63: x86: *arpl mw,rw
+ movsxd_2 = x64 and "rm/qd:63rM",
+ fs_0 = "64",
+ gs_0 = "65",
+ o16_0 = "66",
+ a16_0 = not x64 and "67" or nil,
+ a32_0 = x64 and "67",
+ -- 68: push idw
+ -- 69: imul rdw,mdw,idw
+ -- 6A: push ib
+ -- 6B: imul rdw,mdw,S
+ -- 6C: *insb
+ -- 6D: *insd, *insw
+ -- 6E: *outsb
+ -- 6F: *outsd, *outsw
+ -- 70-7F: jcc lb
+ -- 80: add... mb,i
+ -- 81: add... mdw,i
+ -- 82: *undefined
+ -- 83: add... mdw,S
+ test_2 = "mr:85Rm|rm:85rM|Ri:A9ri|mi:F70mi",
+ -- 86: xchg rb,mb
+ -- 87: xchg rdw,mdw
+ -- 88: mov mb,r
+ -- 89: mov mdw,r
+ -- 8A: mov r,mb
+ -- 8B: mov r,mdw
+ -- 8C: *mov mdw,seg
+ lea_2 = "rx1dq:8DrM",
+ -- 8E: *mov seg,mdw
+ -- 8F: pop mdw
+ nop_0 = "90",
+ xchg_2 = "Rrqdw:90R|rRqdw:90r|rm:87rM|mr:87Rm",
+ cbw_0 = "6698",
+ cwde_0 = "98",
+ cdqe_0 = "4898",
+ cwd_0 = "6699",
+ cdq_0 = "99",
+ cqo_0 = "4899",
+ -- 9A: *call iw:idw
+ wait_0 = "9B",
+ fwait_0 = "9B",
+ pushf_0 = "9C",
+ pushfd_0 = not x64 and "9C",
+ pushfq_0 = x64 and "9C",
+ popf_0 = "9D",
+ popfd_0 = not x64 and "9D",
+ popfq_0 = x64 and "9D",
+ sahf_0 = "9E",
+ lahf_0 = "9F",
+ mov_2 = "OR:A3o|RO:A1O|mr:89Rm|rm:8BrM|rib:nB0ri|ridw:B8ri|mi:C70mi",
+ movsb_0 = "A4",
+ movsw_0 = "66A5",
+ movsd_0 = "A5",
+ cmpsb_0 = "A6",
+ cmpsw_0 = "66A7",
+ cmpsd_0 = "A7",
+ -- A8: test Rb,i
+ -- A9: test Rdw,i
+ stosb_0 = "AA",
+ stosw_0 = "66AB",
+ stosd_0 = "AB",
+ lodsb_0 = "AC",
+ lodsw_0 = "66AD",
+ lodsd_0 = "AD",
+ scasb_0 = "AE",
+ scasw_0 = "66AF",
+ scasd_0 = "AF",
+ -- B0-B7: mov rb,i
+ -- B8-BF: mov rdw,i
+ -- C0: rol... mb,i
+ -- C1: rol... mdw,i
+ ret_1 = "i.:nC2W",
+ ret_0 = "C3",
+ -- C4: *les rdw,mq
+ -- C5: *lds rdw,mq
+ -- C6: mov mb,i
+ -- C7: mov mdw,i
+ -- C8: *enter iw,ib
+ leave_0 = "C9",
+ -- CA: *retf iw
+ -- CB: *retf
+ int3_0 = "CC",
+ int_1 = "i.:nCDU",
+ into_0 = "CE",
+ -- CF: *iret
+ -- D0: rol... mb,1
+ -- D1: rol... mdw,1
+ -- D2: rol... mb,cl
+ -- D3: rol... mb,cl
+ -- D4: *aam ib
+ -- D5: *aad ib
+ -- D6: *salc
+ -- D7: *xlat
+ -- D8-DF: floating point ops
+ -- E0: *loopne
+ -- E1: *loope
+ -- E2: *loop
+ -- E3: *jcxz, *jecxz
+ -- E4: *in Rb,ib
+ -- E5: *in Rdw,ib
+ -- E6: *out ib,Rb
+ -- E7: *out ib,Rdw
+ call_1 = x64 and "mq:nFF2m|J.:E8nJ" or "md:FF2m|J.:E8J",
+ jmp_1 = x64 and "mq:nFF4m|J.:E9nJ" or "md:FF4m|J.:E9J", -- short: EB
+ -- EA: *jmp iw:idw
+ -- EB: jmp ib
+ -- EC: *in Rb,dx
+ -- ED: *in Rdw,dx
+ -- EE: *out dx,Rb
+ -- EF: *out dx,Rdw
+ lock_0 = "F0",
+ int1_0 = "F1",
+ repne_0 = "F2",
+ repnz_0 = "F2",
+ rep_0 = "F3",
+ repe_0 = "F3",
+ repz_0 = "F3",
+ -- F4: *hlt
+ cmc_0 = "F5",
+ -- F6: test... mb,i; div... mb
+ -- F7: test... mdw,i; div... mdw
+ clc_0 = "F8",
+ stc_0 = "F9",
+ -- FA: *cli
+ cld_0 = "FC",
+ std_0 = "FD",
+ -- FE: inc... mb
+ -- FF: inc... mdw
+
+ -- misc ops
+ not_1 = "m:F72m",
+ neg_1 = "m:F73m",
+ mul_1 = "m:F74m",
+ imul_1 = "m:F75m",
+ div_1 = "m:F76m",
+ idiv_1 = "m:F77m",
+
+ imul_2 = "rmqdw:0FAFrM|rIqdw:69rmI|rSqdw:6BrmS|riqdw:69rmi",
+ imul_3 = "rmIqdw:69rMI|rmSqdw:6BrMS|rmiqdw:69rMi",
+
+ movzx_2 = "rm/db:0FB6rM|rm/qb:|rm/wb:0FB6rM|rm/dw:0FB7rM|rm/qw:",
+ movsx_2 = "rm/db:0FBErM|rm/qb:|rm/wb:0FBErM|rm/dw:0FBFrM|rm/qw:",
+
+ bswap_1 = "rqd:0FC8r",
+ bsf_2 = "rmqdw:0FBCrM",
+ bsr_2 = "rmqdw:0FBDrM",
+ bt_2 = "mrqdw:0FA3Rm|miqdw:0FBA4mU",
+ btc_2 = "mrqdw:0FBBRm|miqdw:0FBA7mU",
+ btr_2 = "mrqdw:0FB3Rm|miqdw:0FBA6mU",
+ bts_2 = "mrqdw:0FABRm|miqdw:0FBA5mU",
+
+ shld_3 = "mriqdw:0FA4RmU|mrC/qq:0FA5Rm|mrC/dd:|mrC/ww:",
+ shrd_3 = "mriqdw:0FACRmU|mrC/qq:0FADRm|mrC/dd:|mrC/ww:",
+
+ rdtsc_0 = "0F31", -- P1+
+ rdpmc_0 = "0F33", -- P6+
+ cpuid_0 = "0FA2", -- P1+
+
+ -- floating point ops
+ fst_1 = "ff:DDD0r|xd:D92m|xq:nDD2m",
+ fstp_1 = "ff:DDD8r|xd:D93m|xq:nDD3m|xt:DB7m",
+ fld_1 = "ff:D9C0r|xd:D90m|xq:nDD0m|xt:DB5m",
+
+ fpop_0 = "DDD8", -- Alias for fstp st0.
+
+ fist_1 = "xw:nDF2m|xd:DB2m",
+ fistp_1 = "xw:nDF3m|xd:DB3m|xq:nDF7m",
+ fild_1 = "xw:nDF0m|xd:DB0m|xq:nDF5m",
+
+ fxch_0 = "D9C9",
+ fxch_1 = "ff:D9C8r",
+ fxch_2 = "fFf:D9C8r|Fff:D9C8R",
+
+ fucom_1 = "ff:DDE0r",
+ fucom_2 = "Fff:DDE0R",
+ fucomp_1 = "ff:DDE8r",
+ fucomp_2 = "Fff:DDE8R",
+ fucomi_1 = "ff:DBE8r", -- P6+
+ fucomi_2 = "Fff:DBE8R", -- P6+
+ fucomip_1 = "ff:DFE8r", -- P6+
+ fucomip_2 = "Fff:DFE8R", -- P6+
+ fcomi_1 = "ff:DBF0r", -- P6+
+ fcomi_2 = "Fff:DBF0R", -- P6+
+ fcomip_1 = "ff:DFF0r", -- P6+
+ fcomip_2 = "Fff:DFF0R", -- P6+
+ fucompp_0 = "DAE9",
+ fcompp_0 = "DED9",
+
+ fldenv_1 = "x.:D94m",
+ fnstenv_1 = "x.:D96m",
+ fstenv_1 = "x.:9BD96m",
+ fldcw_1 = "xw:nD95m",
+ fstcw_1 = "xw:n9BD97m",
+ fnstcw_1 = "xw:nD97m",
+ fstsw_1 = "Rw:n9BDFE0|xw:n9BDD7m",
+ fnstsw_1 = "Rw:nDFE0|xw:nDD7m",
+ fclex_0 = "9BDBE2",
+ fnclex_0 = "DBE2",
+
+ fnop_0 = "D9D0",
+ -- D9D1-D9DF: unassigned
+
+ fchs_0 = "D9E0",
+ fabs_0 = "D9E1",
+ -- D9E2: unassigned
+ -- D9E3: unassigned
+ ftst_0 = "D9E4",
+ fxam_0 = "D9E5",
+ -- D9E6: unassigned
+ -- D9E7: unassigned
+ fld1_0 = "D9E8",
+ fldl2t_0 = "D9E9",
+ fldl2e_0 = "D9EA",
+ fldpi_0 = "D9EB",
+ fldlg2_0 = "D9EC",
+ fldln2_0 = "D9ED",
+ fldz_0 = "D9EE",
+ -- D9EF: unassigned
+
+ f2xm1_0 = "D9F0",
+ fyl2x_0 = "D9F1",
+ fptan_0 = "D9F2",
+ fpatan_0 = "D9F3",
+ fxtract_0 = "D9F4",
+ fprem1_0 = "D9F5",
+ fdecstp_0 = "D9F6",
+ fincstp_0 = "D9F7",
+ fprem_0 = "D9F8",
+ fyl2xp1_0 = "D9F9",
+ fsqrt_0 = "D9FA",
+ fsincos_0 = "D9FB",
+ frndint_0 = "D9FC",
+ fscale_0 = "D9FD",
+ fsin_0 = "D9FE",
+ fcos_0 = "D9FF",
+
+ -- SSE, SSE2
+ andnpd_2 = "rmo:660F55rM",
+ andnps_2 = "rmo:0F55rM",
+ andpd_2 = "rmo:660F54rM",
+ andps_2 = "rmo:0F54rM",
+ clflush_1 = "x.:0FAE7m",
+ cmppd_3 = "rmio:660FC2rMU",
+ cmpps_3 = "rmio:0FC2rMU",
+ cmpsd_3 = "rrio:F20FC2rMU|rxi/oq:",
+ cmpss_3 = "rrio:F30FC2rMU|rxi/od:",
+ comisd_2 = "rro:660F2FrM|rx/oq:",
+ comiss_2 = "rro:0F2FrM|rx/od:",
+ cvtdq2pd_2 = "rro:F30FE6rM|rx/oq:",
+ cvtdq2ps_2 = "rmo:0F5BrM",
+ cvtpd2dq_2 = "rmo:F20FE6rM",
+ cvtpd2ps_2 = "rmo:660F5ArM",
+ cvtpi2pd_2 = "rx/oq:660F2ArM",
+ cvtpi2ps_2 = "rx/oq:0F2ArM",
+ cvtps2dq_2 = "rmo:660F5BrM",
+ cvtps2pd_2 = "rro:0F5ArM|rx/oq:",
+ cvtsd2si_2 = "rr/do:F20F2DrM|rr/qo:|rx/dq:|rxq:",
+ cvtsd2ss_2 = "rro:F20F5ArM|rx/oq:",
+ cvtsi2sd_2 = "rm/od:F20F2ArM|rm/oq:F20F2ArXM",
+ cvtsi2ss_2 = "rm/od:F30F2ArM|rm/oq:F30F2ArXM",
+ cvtss2sd_2 = "rro:F30F5ArM|rx/od:",
+ cvtss2si_2 = "rr/do:F30F2DrM|rr/qo:|rxd:|rx/qd:",
+ cvttpd2dq_2 = "rmo:660FE6rM",
+ cvttps2dq_2 = "rmo:F30F5BrM",
+ cvttsd2si_2 = "rr/do:F20F2CrM|rr/qo:|rx/dq:|rxq:",
+ cvttss2si_2 = "rr/do:F30F2CrM|rr/qo:|rxd:|rx/qd:",
+ fxsave_1 = "x.:0FAE0m",
+ fxrstor_1 = "x.:0FAE1m",
+ ldmxcsr_1 = "xd:0FAE2m",
+ lfence_0 = "0FAEE8",
+ maskmovdqu_2 = "rro:660FF7rM",
+ mfence_0 = "0FAEF0",
+ movapd_2 = "rmo:660F28rM|mro:660F29Rm",
+ movaps_2 = "rmo:0F28rM|mro:0F29Rm",
+ movd_2 = "rm/od:660F6ErM|rm/oq:660F6ErXM|mr/do:660F7ERm|mr/qo:",
+ movdqa_2 = "rmo:660F6FrM|mro:660F7FRm",
+ movdqu_2 = "rmo:F30F6FrM|mro:F30F7FRm",
+ movhlps_2 = "rro:0F12rM",
+ movhpd_2 = "rx/oq:660F16rM|xr/qo:n660F17Rm",
+ movhps_2 = "rx/oq:0F16rM|xr/qo:n0F17Rm",
+ movlhps_2 = "rro:0F16rM",
+ movlpd_2 = "rx/oq:660F12rM|xr/qo:n660F13Rm",
+ movlps_2 = "rx/oq:0F12rM|xr/qo:n0F13Rm",
+ movmskpd_2 = "rr/do:660F50rM",
+ movmskps_2 = "rr/do:0F50rM",
+ movntdq_2 = "xro:660FE7Rm",
+ movnti_2 = "xrqd:0FC3Rm",
+ movntpd_2 = "xro:660F2BRm",
+ movntps_2 = "xro:0F2BRm",
+ movq_2 = "rro:F30F7ErM|rx/oq:|xr/qo:n660FD6Rm",
+ movsd_2 = "rro:F20F10rM|rx/oq:|xr/qo:nF20F11Rm",
+ movss_2 = "rro:F30F10rM|rx/od:|xr/do:F30F11Rm",
+ movupd_2 = "rmo:660F10rM|mro:660F11Rm",
+ movups_2 = "rmo:0F10rM|mro:0F11Rm",
+ orpd_2 = "rmo:660F56rM",
+ orps_2 = "rmo:0F56rM",
+ pause_0 = "F390",
+ pextrw_3 = "rri/do:660FC5rMU|xri/wo:660F3A15nRmU", -- Mem op: SSE4.1 only.
+ pinsrw_3 = "rri/od:660FC4rMU|rxi/ow:",
+ pmovmskb_2 = "rr/do:660FD7rM",
+ prefetchnta_1 = "xb:n0F180m",
+ prefetcht0_1 = "xb:n0F181m",
+ prefetcht1_1 = "xb:n0F182m",
+ prefetcht2_1 = "xb:n0F183m",
+ pshufd_3 = "rmio:660F70rMU",
+ pshufhw_3 = "rmio:F30F70rMU",
+ pshuflw_3 = "rmio:F20F70rMU",
+ pslld_2 = "rmo:660FF2rM|rio:660F726mU",
+ pslldq_2 = "rio:660F737mU",
+ psllq_2 = "rmo:660FF3rM|rio:660F736mU",
+ psllw_2 = "rmo:660FF1rM|rio:660F716mU",
+ psrad_2 = "rmo:660FE2rM|rio:660F724mU",
+ psraw_2 = "rmo:660FE1rM|rio:660F714mU",
+ psrld_2 = "rmo:660FD2rM|rio:660F722mU",
+ psrldq_2 = "rio:660F733mU",
+ psrlq_2 = "rmo:660FD3rM|rio:660F732mU",
+ psrlw_2 = "rmo:660FD1rM|rio:660F712mU",
+ rcpps_2 = "rmo:0F53rM",
+ rcpss_2 = "rro:F30F53rM|rx/od:",
+ rsqrtps_2 = "rmo:0F52rM",
+ rsqrtss_2 = "rmo:F30F52rM",
+ sfence_0 = "0FAEF8",
+ shufpd_3 = "rmio:660FC6rMU",
+ shufps_3 = "rmio:0FC6rMU",
+ stmxcsr_1 = "xd:0FAE3m",
+ ucomisd_2 = "rro:660F2ErM|rx/oq:",
+ ucomiss_2 = "rro:0F2ErM|rx/od:",
+ unpckhpd_2 = "rmo:660F15rM",
+ unpckhps_2 = "rmo:0F15rM",
+ unpcklpd_2 = "rmo:660F14rM",
+ unpcklps_2 = "rmo:0F14rM",
+ xorpd_2 = "rmo:660F57rM",
+ xorps_2 = "rmo:0F57rM",
+
+ -- SSE3 ops
+ fisttp_1 = "xw:nDF1m|xd:DB1m|xq:nDD1m",
+ addsubpd_2 = "rmo:660FD0rM",
+ addsubps_2 = "rmo:F20FD0rM",
+ haddpd_2 = "rmo:660F7CrM",
+ haddps_2 = "rmo:F20F7CrM",
+ hsubpd_2 = "rmo:660F7DrM",
+ hsubps_2 = "rmo:F20F7DrM",
+ lddqu_2 = "rxo:F20FF0rM",
+ movddup_2 = "rmo:F20F12rM",
+ movshdup_2 = "rmo:F30F16rM",
+ movsldup_2 = "rmo:F30F12rM",
+
+ -- SSSE3 ops
+ pabsb_2 = "rmo:660F381CrM",
+ pabsd_2 = "rmo:660F381ErM",
+ pabsw_2 = "rmo:660F381DrM",
+ palignr_3 = "rmio:660F3A0FrMU",
+ phaddd_2 = "rmo:660F3802rM",
+ phaddsw_2 = "rmo:660F3803rM",
+ phaddw_2 = "rmo:660F3801rM",
+ phsubd_2 = "rmo:660F3806rM",
+ phsubsw_2 = "rmo:660F3807rM",
+ phsubw_2 = "rmo:660F3805rM",
+ pmaddubsw_2 = "rmo:660F3804rM",
+ pmulhrsw_2 = "rmo:660F380BrM",
+ pshufb_2 = "rmo:660F3800rM",
+ psignb_2 = "rmo:660F3808rM",
+ psignd_2 = "rmo:660F380ArM",
+ psignw_2 = "rmo:660F3809rM",
+
+ -- SSE4.1 ops
+ blendpd_3 = "rmio:660F3A0DrMU",
+ blendps_3 = "rmio:660F3A0CrMU",
+ blendvpd_3 = "rmRo:660F3815rM",
+ blendvps_3 = "rmRo:660F3814rM",
+ dppd_3 = "rmio:660F3A41rMU",
+ dpps_3 = "rmio:660F3A40rMU",
+ extractps_3 = "mri/do:660F3A17RmU|rri/qo:660F3A17RXmU",
+ insertps_3 = "rrio:660F3A41rMU|rxi/od:",
+ movntdqa_2 = "rxo:660F382ArM",
+ mpsadbw_3 = "rmio:660F3A42rMU",
+ packusdw_2 = "rmo:660F382BrM",
+ pblendvb_3 = "rmRo:660F3810rM",
+ pblendw_3 = "rmio:660F3A0ErMU",
+ pcmpeqq_2 = "rmo:660F3829rM",
+ pextrb_3 = "rri/do:660F3A14nRmU|rri/qo:|xri/bo:",
+ pextrd_3 = "mri/do:660F3A16RmU",
+ pextrq_3 = "mri/qo:660F3A16RmU",
+ -- pextrw is SSE2, mem operand is SSE4.1 only
+ phminposuw_2 = "rmo:660F3841rM",
+ pinsrb_3 = "rri/od:660F3A20nrMU|rxi/ob:",
+ pinsrd_3 = "rmi/od:660F3A22rMU",
+ pinsrq_3 = "rmi/oq:660F3A22rXMU",
+ pmaxsb_2 = "rmo:660F383CrM",
+ pmaxsd_2 = "rmo:660F383DrM",
+ pmaxud_2 = "rmo:660F383FrM",
+ pmaxuw_2 = "rmo:660F383ErM",
+ pminsb_2 = "rmo:660F3838rM",
+ pminsd_2 = "rmo:660F3839rM",
+ pminud_2 = "rmo:660F383BrM",
+ pminuw_2 = "rmo:660F383ArM",
+ pmovsxbd_2 = "rro:660F3821rM|rx/od:",
+ pmovsxbq_2 = "rro:660F3822rM|rx/ow:",
+ pmovsxbw_2 = "rro:660F3820rM|rx/oq:",
+ pmovsxdq_2 = "rro:660F3825rM|rx/oq:",
+ pmovsxwd_2 = "rro:660F3823rM|rx/oq:",
+ pmovsxwq_2 = "rro:660F3824rM|rx/od:",
+ pmovzxbd_2 = "rro:660F3831rM|rx/od:",
+ pmovzxbq_2 = "rro:660F3832rM|rx/ow:",
+ pmovzxbw_2 = "rro:660F3830rM|rx/oq:",
+ pmovzxdq_2 = "rro:660F3835rM|rx/oq:",
+ pmovzxwd_2 = "rro:660F3833rM|rx/oq:",
+ pmovzxwq_2 = "rro:660F3834rM|rx/od:",
+ pmuldq_2 = "rmo:660F3828rM",
+ pmulld_2 = "rmo:660F3840rM",
+ ptest_2 = "rmo:660F3817rM",
+ roundpd_3 = "rmio:660F3A09rMU",
+ roundps_3 = "rmio:660F3A08rMU",
+ roundsd_3 = "rrio:660F3A0BrMU|rxi/oq:",
+ roundss_3 = "rrio:660F3A0ArMU|rxi/od:",
+
+ -- SSE4.2 ops
+ crc32_2 = "rmqd:F20F38F1rM|rm/dw:66F20F38F1rM|rm/db:F20F38F0rM|rm/qb:",
+ pcmpestri_3 = "rmio:660F3A61rMU",
+ pcmpestrm_3 = "rmio:660F3A60rMU",
+ pcmpgtq_2 = "rmo:660F3837rM",
+ pcmpistri_3 = "rmio:660F3A63rMU",
+ pcmpistrm_3 = "rmio:660F3A62rMU",
+ popcnt_2 = "rmqdw:F30FB8rM",
+
+ -- SSE4a
+ extrq_2 = "rro:660F79rM",
+ extrq_3 = "riio:660F780mUU",
+ insertq_2 = "rro:F20F79rM",
+ insertq_4 = "rriio:F20F78rMUU",
+ lzcnt_2 = "rmqdw:F30FBDrM",
+ movntsd_2 = "xr/qo:nF20F2BRm",
+ movntss_2 = "xr/do:F30F2BRm",
+ -- popcnt is also in SSE4.2
+
+ -- AES-NI
+ aesdec_2 = "rmo:660F38DErM",
+ aesdeclast_2 = "rmo:660F38DFrM",
+ aesenc_2 = "rmo:660F38DCrM",
+ aesenclast_2 = "rmo:660F38DDrM",
+ aesimc_2 = "rmo:660F38DBrM",
+ aeskeygenassist_3 = "rmio:660F3ADFrMU",
+ pclmulqdq_3 = "rmio:660F3A44rMU",
+
+ -- AVX FP ops
+ vaddsubpd_3 = "rrmoy:660FVD0rM",
+ vaddsubps_3 = "rrmoy:F20FVD0rM",
+ vandpd_3 = "rrmoy:660FV54rM",
+ vandps_3 = "rrmoy:0FV54rM",
+ vandnpd_3 = "rrmoy:660FV55rM",
+ vandnps_3 = "rrmoy:0FV55rM",
+ vblendpd_4 = "rrmioy:660F3AV0DrMU",
+ vblendps_4 = "rrmioy:660F3AV0CrMU",
+ vblendvpd_4 = "rrmroy:660F3AV4BrMs",
+ vblendvps_4 = "rrmroy:660F3AV4ArMs",
+ vbroadcastf128_2 = "rx/yo:660F38u1ArM",
+ vcmppd_4 = "rrmioy:660FVC2rMU",
+ vcmpps_4 = "rrmioy:0FVC2rMU",
+ vcmpsd_4 = "rrrio:F20FVC2rMU|rrxi/ooq:",
+ vcmpss_4 = "rrrio:F30FVC2rMU|rrxi/ood:",
+ vcomisd_2 = "rro:660Fu2FrM|rx/oq:",
+ vcomiss_2 = "rro:0Fu2FrM|rx/od:",
+ vcvtdq2pd_2 = "rro:F30FuE6rM|rx/oq:|rm/yo:",
+ vcvtdq2ps_2 = "rmoy:0Fu5BrM",
+ vcvtpd2dq_2 = "rmoy:F20FuE6rM",
+ vcvtpd2ps_2 = "rmoy:660Fu5ArM",
+ vcvtps2dq_2 = "rmoy:660Fu5BrM",
+ vcvtps2pd_2 = "rro:0Fu5ArM|rx/oq:|rm/yo:",
+ vcvtsd2si_2 = "rr/do:F20Fu2DrM|rx/dq:|rr/qo:|rxq:",
+ vcvtsd2ss_3 = "rrro:F20FV5ArM|rrx/ooq:",
+ vcvtsi2sd_3 = "rrm/ood:F20FV2ArM|rrm/ooq:F20FVX2ArM",
+ vcvtsi2ss_3 = "rrm/ood:F30FV2ArM|rrm/ooq:F30FVX2ArM",
+ vcvtss2sd_3 = "rrro:F30FV5ArM|rrx/ood:",
+ vcvtss2si_2 = "rr/do:F30Fu2DrM|rxd:|rr/qo:|rx/qd:",
+ vcvttpd2dq_2 = "rmo:660FuE6rM|rm/oy:660FuLE6rM",
+ vcvttps2dq_2 = "rmoy:F30Fu5BrM",
+ vcvttsd2si_2 = "rr/do:F20Fu2CrM|rx/dq:|rr/qo:|rxq:",
+ vcvttss2si_2 = "rr/do:F30Fu2CrM|rxd:|rr/qo:|rx/qd:",
+ vdppd_4 = "rrmio:660F3AV41rMU",
+ vdpps_4 = "rrmioy:660F3AV40rMU",
+ vextractf128_3 = "mri/oy:660F3AuL19RmU",
+ vextractps_3 = "mri/do:660F3Au17RmU",
+ vhaddpd_3 = "rrmoy:660FV7CrM",
+ vhaddps_3 = "rrmoy:F20FV7CrM",
+ vhsubpd_3 = "rrmoy:660FV7DrM",
+ vhsubps_3 = "rrmoy:F20FV7DrM",
+ vinsertf128_4 = "rrmi/yyo:660F3AV18rMU",
+ vinsertps_4 = "rrrio:660F3AV21rMU|rrxi/ood:",
+ vldmxcsr_1 = "xd:0FuAE2m",
+ vmaskmovps_3 = "rrxoy:660F38V2CrM|xrroy:660F38V2ERm",
+ vmaskmovpd_3 = "rrxoy:660F38V2DrM|xrroy:660F38V2FRm",
+ vmovapd_2 = "rmoy:660Fu28rM|mroy:660Fu29Rm",
+ vmovaps_2 = "rmoy:0Fu28rM|mroy:0Fu29Rm",
+ vmovd_2 = "rm/od:660Fu6ErM|rm/oq:660FuX6ErM|mr/do:660Fu7ERm|mr/qo:",
+ vmovq_2 = "rro:F30Fu7ErM|rx/oq:|xr/qo:660FuD6Rm",
+ vmovddup_2 = "rmy:F20Fu12rM|rro:|rx/oq:",
+ vmovhlps_3 = "rrro:0FV12rM",
+ vmovhpd_2 = "xr/qo:660Fu17Rm",
+ vmovhpd_3 = "rrx/ooq:660FV16rM",
+ vmovhps_2 = "xr/qo:0Fu17Rm",
+ vmovhps_3 = "rrx/ooq:0FV16rM",
+ vmovlhps_3 = "rrro:0FV16rM",
+ vmovlpd_2 = "xr/qo:660Fu13Rm",
+ vmovlpd_3 = "rrx/ooq:660FV12rM",
+ vmovlps_2 = "xr/qo:0Fu13Rm",
+ vmovlps_3 = "rrx/ooq:0FV12rM",
+ vmovmskpd_2 = "rr/do:660Fu50rM|rr/dy:660FuL50rM",
+ vmovmskps_2 = "rr/do:0Fu50rM|rr/dy:0FuL50rM",
+ vmovntpd_2 = "xroy:660Fu2BRm",
+ vmovntps_2 = "xroy:0Fu2BRm",
+ vmovsd_2 = "rx/oq:F20Fu10rM|xr/qo:F20Fu11Rm",
+ vmovsd_3 = "rrro:F20FV10rM",
+ vmovshdup_2 = "rmoy:F30Fu16rM",
+ vmovsldup_2 = "rmoy:F30Fu12rM",
+ vmovss_2 = "rx/od:F30Fu10rM|xr/do:F30Fu11Rm",
+ vmovss_3 = "rrro:F30FV10rM",
+ vmovupd_2 = "rmoy:660Fu10rM|mroy:660Fu11Rm",
+ vmovups_2 = "rmoy:0Fu10rM|mroy:0Fu11Rm",
+ vorpd_3 = "rrmoy:660FV56rM",
+ vorps_3 = "rrmoy:0FV56rM",
+ vpermilpd_3 = "rrmoy:660F38V0DrM|rmioy:660F3Au05rMU",
+ vpermilps_3 = "rrmoy:660F38V0CrM|rmioy:660F3Au04rMU",
+ vperm2f128_4 = "rrmiy:660F3AV06rMU",
+ vptestpd_2 = "rmoy:660F38u0FrM",
+ vptestps_2 = "rmoy:660F38u0ErM",
+ vrcpps_2 = "rmoy:0Fu53rM",
+ vrcpss_3 = "rrro:F30FV53rM|rrx/ood:",
+ vrsqrtps_2 = "rmoy:0Fu52rM",
+ vrsqrtss_3 = "rrro:F30FV52rM|rrx/ood:",
+ vroundpd_3 = "rmioy:660F3AV09rMU",
+ vroundps_3 = "rmioy:660F3AV08rMU",
+ vroundsd_4 = "rrrio:660F3AV0BrMU|rrxi/ooq:",
+ vroundss_4 = "rrrio:660F3AV0ArMU|rrxi/ood:",
+ vshufpd_4 = "rrmioy:660FVC6rMU",
+ vshufps_4 = "rrmioy:0FVC6rMU",
+ vsqrtps_2 = "rmoy:0Fu51rM",
+ vsqrtss_2 = "rro:F30Fu51rM|rx/od:",
+ vsqrtpd_2 = "rmoy:660Fu51rM",
+ vsqrtsd_2 = "rro:F20Fu51rM|rx/oq:",
+ vstmxcsr_1 = "xd:0FuAE3m",
+ vucomisd_2 = "rro:660Fu2ErM|rx/oq:",
+ vucomiss_2 = "rro:0Fu2ErM|rx/od:",
+ vunpckhpd_3 = "rrmoy:660FV15rM",
+ vunpckhps_3 = "rrmoy:0FV15rM",
+ vunpcklpd_3 = "rrmoy:660FV14rM",
+ vunpcklps_3 = "rrmoy:0FV14rM",
+ vxorpd_3 = "rrmoy:660FV57rM",
+ vxorps_3 = "rrmoy:0FV57rM",
+ vzeroall_0 = "0FuL77",
+ vzeroupper_0 = "0Fu77",
+
+ -- AVX2 FP ops
+ vbroadcastss_2 = "rx/od:660F38u18rM|rx/yd:|rro:|rr/yo:",
+ vbroadcastsd_2 = "rx/yq:660F38u19rM|rr/yo:",
+ -- *vgather* (!vsib)
+ vpermpd_3 = "rmiy:660F3AuX01rMU",
+ vpermps_3 = "rrmy:660F38V16rM",
+
+ -- AVX, AVX2 integer ops
+ -- In general, xmm requires AVX, ymm requires AVX2.
+ vaesdec_3 = "rrmo:660F38VDErM",
+ vaesdeclast_3 = "rrmo:660F38VDFrM",
+ vaesenc_3 = "rrmo:660F38VDCrM",
+ vaesenclast_3 = "rrmo:660F38VDDrM",
+ vaesimc_2 = "rmo:660F38uDBrM",
+ vaeskeygenassist_3 = "rmio:660F3AuDFrMU",
+ vlddqu_2 = "rxoy:F20FuF0rM",
+ vmaskmovdqu_2 = "rro:660FuF7rM",
+ vmovdqa_2 = "rmoy:660Fu6FrM|mroy:660Fu7FRm",
+ vmovdqu_2 = "rmoy:F30Fu6FrM|mroy:F30Fu7FRm",
+ vmovntdq_2 = "xroy:660FuE7Rm",
+ vmovntdqa_2 = "rxoy:660F38u2ArM",
+ vmpsadbw_4 = "rrmioy:660F3AV42rMU",
+ vpabsb_2 = "rmoy:660F38u1CrM",
+ vpabsd_2 = "rmoy:660F38u1ErM",
+ vpabsw_2 = "rmoy:660F38u1DrM",
+ vpackusdw_3 = "rrmoy:660F38V2BrM",
+ vpalignr_4 = "rrmioy:660F3AV0FrMU",
+ vpblendvb_4 = "rrmroy:660F3AV4CrMs",
+ vpblendw_4 = "rrmioy:660F3AV0ErMU",
+ vpclmulqdq_4 = "rrmio:660F3AV44rMU",
+ vpcmpeqq_3 = "rrmoy:660F38V29rM",
+ vpcmpestri_3 = "rmio:660F3Au61rMU",
+ vpcmpestrm_3 = "rmio:660F3Au60rMU",
+ vpcmpgtq_3 = "rrmoy:660F38V37rM",
+ vpcmpistri_3 = "rmio:660F3Au63rMU",
+ vpcmpistrm_3 = "rmio:660F3Au62rMU",
+ vpextrb_3 = "rri/do:660F3Au14nRmU|rri/qo:|xri/bo:",
+ vpextrw_3 = "rri/do:660FuC5rMU|xri/wo:660F3Au15nRmU",
+ vpextrd_3 = "mri/do:660F3Au16RmU",
+ vpextrq_3 = "mri/qo:660F3Au16RmU",
+ vphaddw_3 = "rrmoy:660F38V01rM",
+ vphaddd_3 = "rrmoy:660F38V02rM",
+ vphaddsw_3 = "rrmoy:660F38V03rM",
+ vphminposuw_2 = "rmo:660F38u41rM",
+ vphsubw_3 = "rrmoy:660F38V05rM",
+ vphsubd_3 = "rrmoy:660F38V06rM",
+ vphsubsw_3 = "rrmoy:660F38V07rM",
+ vpinsrb_4 = "rrri/ood:660F3AV20rMU|rrxi/oob:",
+ vpinsrw_4 = "rrri/ood:660FVC4rMU|rrxi/oow:",
+ vpinsrd_4 = "rrmi/ood:660F3AV22rMU",
+ vpinsrq_4 = "rrmi/ooq:660F3AVX22rMU",
+ vpmaddubsw_3 = "rrmoy:660F38V04rM",
+ vpmaxsb_3 = "rrmoy:660F38V3CrM",
+ vpmaxsd_3 = "rrmoy:660F38V3DrM",
+ vpmaxuw_3 = "rrmoy:660F38V3ErM",
+ vpmaxud_3 = "rrmoy:660F38V3FrM",
+ vpminsb_3 = "rrmoy:660F38V38rM",
+ vpminsd_3 = "rrmoy:660F38V39rM",
+ vpminuw_3 = "rrmoy:660F38V3ArM",
+ vpminud_3 = "rrmoy:660F38V3BrM",
+ vpmovmskb_2 = "rr/do:660FuD7rM|rr/dy:660FuLD7rM",
+ vpmovsxbw_2 = "rroy:660F38u20rM|rx/oq:|rx/yo:",
+ vpmovsxbd_2 = "rroy:660F38u21rM|rx/od:|rx/yq:",
+ vpmovsxbq_2 = "rroy:660F38u22rM|rx/ow:|rx/yd:",
+ vpmovsxwd_2 = "rroy:660F38u23rM|rx/oq:|rx/yo:",
+ vpmovsxwq_2 = "rroy:660F38u24rM|rx/od:|rx/yq:",
+ vpmovsxdq_2 = "rroy:660F38u25rM|rx/oq:|rx/yo:",
+ vpmovzxbw_2 = "rroy:660F38u30rM|rx/oq:|rx/yo:",
+ vpmovzxbd_2 = "rroy:660F38u31rM|rx/od:|rx/yq:",
+ vpmovzxbq_2 = "rroy:660F38u32rM|rx/ow:|rx/yd:",
+ vpmovzxwd_2 = "rroy:660F38u33rM|rx/oq:|rx/yo:",
+ vpmovzxwq_2 = "rroy:660F38u34rM|rx/od:|rx/yq:",
+ vpmovzxdq_2 = "rroy:660F38u35rM|rx/oq:|rx/yo:",
+ vpmuldq_3 = "rrmoy:660F38V28rM",
+ vpmulhrsw_3 = "rrmoy:660F38V0BrM",
+ vpmulld_3 = "rrmoy:660F38V40rM",
+ vpshufb_3 = "rrmoy:660F38V00rM",
+ vpshufd_3 = "rmioy:660Fu70rMU",
+ vpshufhw_3 = "rmioy:F30Fu70rMU",
+ vpshuflw_3 = "rmioy:F20Fu70rMU",
+ vpsignb_3 = "rrmoy:660F38V08rM",
+ vpsignw_3 = "rrmoy:660F38V09rM",
+ vpsignd_3 = "rrmoy:660F38V0ArM",
+ vpslldq_3 = "rrioy:660Fv737mU",
+ vpsllw_3 = "rrmoy:660FVF1rM|rrioy:660Fv716mU",
+ vpslld_3 = "rrmoy:660FVF2rM|rrioy:660Fv726mU",
+ vpsllq_3 = "rrmoy:660FVF3rM|rrioy:660Fv736mU",
+ vpsraw_3 = "rrmoy:660FVE1rM|rrioy:660Fv714mU",
+ vpsrad_3 = "rrmoy:660FVE2rM|rrioy:660Fv724mU",
+ vpsrldq_3 = "rrioy:660Fv733mU",
+ vpsrlw_3 = "rrmoy:660FVD1rM|rrioy:660Fv712mU",
+ vpsrld_3 = "rrmoy:660FVD2rM|rrioy:660Fv722mU",
+ vpsrlq_3 = "rrmoy:660FVD3rM|rrioy:660Fv732mU",
+ vptest_2 = "rmoy:660F38u17rM",
+
+ -- AVX2 integer ops
+ vbroadcasti128_2 = "rx/yo:660F38u5ArM",
+ vinserti128_4 = "rrmi/yyo:660F3AV38rMU",
+ vextracti128_3 = "mri/oy:660F3AuL39RmU",
+ vpblendd_4 = "rrmioy:660F3AV02rMU",
+ vpbroadcastb_2 = "rro:660F38u78rM|rx/ob:|rr/yo:|rx/yb:",
+ vpbroadcastw_2 = "rro:660F38u79rM|rx/ow:|rr/yo:|rx/yw:",
+ vpbroadcastd_2 = "rro:660F38u58rM|rx/od:|rr/yo:|rx/yd:",
+ vpbroadcastq_2 = "rro:660F38u59rM|rx/oq:|rr/yo:|rx/yq:",
+ vpermd_3 = "rrmy:660F38V36rM",
+ vpermq_3 = "rmiy:660F3AuX00rMU",
+ -- *vpgather* (!vsib)
+ vperm2i128_4 = "rrmiy:660F3AV46rMU",
+ vpmaskmovd_3 = "rrxoy:660F38V8CrM|xrroy:660F38V8ERm",
+ vpmaskmovq_3 = "rrxoy:660F38VX8CrM|xrroy:660F38VX8ERm",
+ vpsllvd_3 = "rrmoy:660F38V47rM",
+ vpsllvq_3 = "rrmoy:660F38VX47rM",
+ vpsravd_3 = "rrmoy:660F38V46rM",
+ vpsrlvd_3 = "rrmoy:660F38V45rM",
+ vpsrlvq_3 = "rrmoy:660F38VX45rM",
+
+ -- Intel ADX
+ adcx_2 = "rmqd:660F38F6rM",
+ adox_2 = "rmqd:F30F38F6rM",
+}
+
+------------------------------------------------------------------------------
+
+-- Arithmetic ops.
+for name,n in pairs{ add = 0, ["or"] = 1, adc = 2, sbb = 3,
+ ["and"] = 4, sub = 5, xor = 6, cmp = 7 } do
+ local n8 = shl(n, 3)
+ map_op[name.."_2"] = format(
+ "mr:%02XRm|rm:%02XrM|mI1qdw:81%XmI|mS1qdw:83%XmS|Ri1qdwb:%02Xri|mi1qdwb:81%Xmi",
+ 1+n8, 3+n8, n, n, 5+n8, n)
+end
+
+-- Shift ops.
+for name,n in pairs{ rol = 0, ror = 1, rcl = 2, rcr = 3,
+ shl = 4, shr = 5, sar = 7, sal = 4 } do
+ map_op[name.."_2"] = format("m1:D1%Xm|mC1qdwb:D3%Xm|mi:C1%XmU", n, n, n)
+end
+
+-- Conditional ops.
+for cc,n in pairs(map_cc) do
+ map_op["j"..cc.."_1"] = format("J.:n0F8%XJ", n) -- short: 7%X
+ map_op["set"..cc.."_1"] = format("mb:n0F9%X2m", n)
+ map_op["cmov"..cc.."_2"] = format("rmqdw:0F4%XrM", n) -- P6+
+end
+
+-- FP arithmetic ops.
+for name,n in pairs{ add = 0, mul = 1, com = 2, comp = 3,
+ sub = 4, subr = 5, div = 6, divr = 7 } do
+ local nc = 0xc0 + shl(n, 3)
+ local nr = nc + (n < 4 and 0 or (n % 2 == 0 and 8 or -8))
+ local fn = "f"..name
+ map_op[fn.."_1"] = format("ff:D8%02Xr|xd:D8%Xm|xq:nDC%Xm", nc, n, n)
+ if n == 2 or n == 3 then
+ map_op[fn.."_2"] = format("Fff:D8%02XR|Fx2d:D8%XM|Fx2q:nDC%XM", nc, n, n)
+ else
+ map_op[fn.."_2"] = format("Fff:D8%02XR|fFf:DC%02Xr|Fx2d:D8%XM|Fx2q:nDC%XM", nc, nr, n, n)
+ map_op[fn.."p_1"] = format("ff:DE%02Xr", nr)
+ map_op[fn.."p_2"] = format("fFf:DE%02Xr", nr)
+ end
+ map_op["fi"..name.."_1"] = format("xd:DA%Xm|xw:nDE%Xm", n, n)
+end
+
+-- FP conditional moves.
+for cc,n in pairs{ b=0, e=1, be=2, u=3, nb=4, ne=5, nbe=6, nu=7 } do
+ local nc = 0xdac0 + shl(band(n, 3), 3) + shl(band(n, 4), 6)
+ map_op["fcmov"..cc.."_1"] = format("ff:%04Xr", nc) -- P6+
+ map_op["fcmov"..cc.."_2"] = format("Fff:%04XR", nc) -- P6+
+end
+
+-- SSE / AVX FP arithmetic ops.
+for name,n in pairs{ sqrt = 1, add = 8, mul = 9,
+ sub = 12, min = 13, div = 14, max = 15 } do
+ map_op[name.."ps_2"] = format("rmo:0F5%XrM", n)
+ map_op[name.."ss_2"] = format("rro:F30F5%XrM|rx/od:", n)
+ map_op[name.."pd_2"] = format("rmo:660F5%XrM", n)
+ map_op[name.."sd_2"] = format("rro:F20F5%XrM|rx/oq:", n)
+ if n ~= 1 then
+ map_op["v"..name.."ps_3"] = format("rrmoy:0FV5%XrM", n)
+ map_op["v"..name.."ss_3"] = format("rrro:F30FV5%XrM|rrx/ood:", n)
+ map_op["v"..name.."pd_3"] = format("rrmoy:660FV5%XrM", n)
+ map_op["v"..name.."sd_3"] = format("rrro:F20FV5%XrM|rrx/ooq:", n)
+ end
+end
+
+-- SSE2 / AVX / AVX2 integer arithmetic ops (66 0F leaf).
+for name,n in pairs{
+ paddb = 0xFC, paddw = 0xFD, paddd = 0xFE, paddq = 0xD4,
+ paddsb = 0xEC, paddsw = 0xED, packssdw = 0x6B,
+ packsswb = 0x63, packuswb = 0x67, paddusb = 0xDC,
+ paddusw = 0xDD, pand = 0xDB, pandn = 0xDF, pavgb = 0xE0,
+ pavgw = 0xE3, pcmpeqb = 0x74, pcmpeqd = 0x76,
+ pcmpeqw = 0x75, pcmpgtb = 0x64, pcmpgtd = 0x66,
+ pcmpgtw = 0x65, pmaddwd = 0xF5, pmaxsw = 0xEE,
+ pmaxub = 0xDE, pminsw = 0xEA, pminub = 0xDA,
+ pmulhuw = 0xE4, pmulhw = 0xE5, pmullw = 0xD5,
+ pmuludq = 0xF4, por = 0xEB, psadbw = 0xF6, psubb = 0xF8,
+ psubw = 0xF9, psubd = 0xFA, psubq = 0xFB, psubsb = 0xE8,
+ psubsw = 0xE9, psubusb = 0xD8, psubusw = 0xD9,
+ punpckhbw = 0x68, punpckhwd = 0x69, punpckhdq = 0x6A,
+ punpckhqdq = 0x6D, punpcklbw = 0x60, punpcklwd = 0x61,
+ punpckldq = 0x62, punpcklqdq = 0x6C, pxor = 0xEF
+} do
+ map_op[name.."_2"] = format("rmo:660F%02XrM", n)
+ map_op["v"..name.."_3"] = format("rrmoy:660FV%02XrM", n)
+end
+
+------------------------------------------------------------------------------
+
+local map_vexarg = { u = false, v = 1, V = 2 }
+
+-- Process pattern string.
+local function dopattern(pat, args, sz, op, needrex)
+ local digit, addin, vex
+ local opcode = 0
+ local szov = sz
+ local narg = 1
+ local rex = 0
+
+ -- Limit number of section buffer positions used by a single dasm_put().
+ -- A single opcode needs a maximum of 6 positions.
+ if secpos+6 > maxsecpos then wflush() end
+
+ -- Process each character.
+ for c in gmatch(pat.."|", ".") do
+ if match(c, "%x") then -- Hex digit.
+ digit = byte(c) - 48
+ if digit > 48 then digit = digit - 39
+ elseif digit > 16 then digit = digit - 7 end
+ opcode = opcode*16 + digit
+ addin = nil
+ elseif c == "n" then -- Disable operand size mods for opcode.
+ szov = nil
+ elseif c == "X" then -- Force REX.W.
+ rex = 8
+ elseif c == "L" then -- Force VEX.L.
+ vex.l = true
+ elseif c == "r" then -- Merge 1st operand regno. into opcode.
+ addin = args[1]; opcode = opcode + (addin.reg % 8)
+ if narg < 2 then narg = 2 end
+ elseif c == "R" then -- Merge 2nd operand regno. into opcode.
+ addin = args[2]; opcode = opcode + (addin.reg % 8)
+ narg = 3
+ elseif c == "m" or c == "M" then -- Encode ModRM/SIB.
+ local s
+ if addin then
+ s = addin.reg
+ opcode = opcode - band(s, 7) -- Undo regno opcode merge.
+ else
+ s = band(opcode, 15) -- Undo last digit.
+ opcode = shr(opcode, 4)
+ end
+ local nn = c == "m" and 1 or 2
+ local t = args[nn]
+ if narg <= nn then narg = nn + 1 end
+ if szov == "q" and rex == 0 then rex = rex + 8 end
+ if t.reg and t.reg > 7 then rex = rex + 1 end
+ if t.xreg and t.xreg > 7 then rex = rex + 2 end
+ if s > 7 then rex = rex + 4 end
+ if needrex then rex = rex + 16 end
+ local psz, sk = wputop(szov, opcode, rex, vex, s < 0, t.vreg or t.vxreg)
+ opcode = nil
+ local imark = sub(pat, -1) -- Force a mark (ugly).
+ -- Put ModRM/SIB with regno/last digit as spare.
+ wputmrmsib(t, imark, s, addin and addin.vreg, psz, sk)
+ addin = nil
+ elseif map_vexarg[c] ~= nil then -- Encode using VEX prefix
+ local b = band(opcode, 255); opcode = shr(opcode, 8)
+ local m = 1
+ if b == 0x38 then m = 2
+ elseif b == 0x3a then m = 3 end
+ if m ~= 1 then b = band(opcode, 255); opcode = shr(opcode, 8) end
+ if b ~= 0x0f then
+ werror("expected `0F', `0F38', or `0F3A' to precede `"..c..
+ "' in pattern `"..pat.."' for `"..op.."'")
+ end
+ local v = map_vexarg[c]
+ if v then v = remove(args, v) end
+ b = band(opcode, 255)
+ local p = 0
+ if b == 0x66 then p = 1
+ elseif b == 0xf3 then p = 2
+ elseif b == 0xf2 then p = 3 end
+ if p ~= 0 then opcode = shr(opcode, 8) end
+ if opcode ~= 0 then wputop(nil, opcode, 0); opcode = 0 end
+ vex = { m = m, p = p, v = v }
+ else
+ if opcode then -- Flush opcode.
+ if szov == "q" and rex == 0 then rex = rex + 8 end
+ if needrex then rex = rex + 16 end
+ if addin and addin.reg == -1 then
+ local psz, sk = wputop(szov, opcode - 7, rex, vex, true)
+ wvreg("opcode", addin.vreg, psz, sk)
+ else
+ if addin and addin.reg > 7 then rex = rex + 1 end
+ wputop(szov, opcode, rex, vex)
+ end
+ opcode = nil
+ end
+ if c == "|" then break end
+ if c == "o" then -- Offset (pure 32 bit displacement).
+ wputdarg(args[1].disp); if narg < 2 then narg = 2 end
+ elseif c == "O" then
+ wputdarg(args[2].disp); narg = 3
+ else
+ -- Anything else is an immediate operand.
+ local a = args[narg]
+ narg = narg + 1
+ local mode, imm = a.mode, a.imm
+ if mode == "iJ" and not match("iIJ", c) then
+ werror("bad operand size for label")
+ end
+ if c == "S" then
+ wputsbarg(imm)
+ elseif c == "U" then
+ wputbarg(imm)
+ elseif c == "W" then
+ wputwarg(imm)
+ elseif c == "i" or c == "I" then
+ if mode == "iJ" then
+ wputlabel("IMM_", imm, 1)
+ elseif mode == "iI" and c == "I" then
+ waction(sz == "w" and "IMM_WB" or "IMM_DB", imm)
+ else
+ wputszarg(sz, imm)
+ end
+ elseif c == "J" then
+ if mode == "iPJ" then
+ waction("REL_A", imm) -- !x64 (secpos)
+ else
+ wputlabel("REL_", imm, 2)
+ end
+ elseif c == "s" then
+ local reg = a.reg
+ if reg < 0 then
+ wputb(0)
+ wvreg("imm.hi", a.vreg)
+ else
+ wputb(shl(reg, 4))
+ end
+ else
+ werror("bad char `"..c.."' in pattern `"..pat.."' for `"..op.."'")
+ end
+ end
+ end
+ end
+end
+
+------------------------------------------------------------------------------
+
+-- Mapping of operand modes to short names. Suppress output with '#'.
+local map_modename = {
+ r = "reg", R = "eax", C = "cl", x = "mem", m = "mrm", i = "imm",
+ f = "stx", F = "st0", J = "lbl", ["1"] = "1",
+ I = "#", S = "#", O = "#",
+}
+
+-- Return a table/string showing all possible operand modes.
+local function templatehelp(template, nparams)
+ if nparams == 0 then return "" end
+ local t = {}
+ for tm in gmatch(template, "[^%|]+") do
+ local s = map_modename[sub(tm, 1, 1)]
+ s = s..gsub(sub(tm, 2, nparams), ".", function(c)
+ return ", "..map_modename[c]
+ end)
+ if not match(s, "#") then t[#t+1] = s end
+ end
+ return t
+end
+
+-- Match operand modes against mode match part of template.
+local function matchtm(tm, args)
+ for i=1,#args do
+ if not match(args[i].mode, sub(tm, i, i)) then return end
+ end
+ return true
+end
+
+-- Handle opcodes defined with template strings.
+map_op[".template__"] = function(params, template, nparams)
+ if not params then return templatehelp(template, nparams) end
+ local args = {}
+
+ -- Zero-operand opcodes have no match part.
+ if #params == 0 then
+ dopattern(template, args, "d", params.op, nil)
+ return
+ end
+
+ -- Determine common operand size (coerce undefined size) or flag as mixed.
+ local sz, szmix, needrex
+ for i,p in ipairs(params) do
+ args[i] = parseoperand(p)
+ local nsz = args[i].opsize
+ if nsz then
+ if sz and sz ~= nsz then szmix = true else sz = nsz end
+ end
+ local nrex = args[i].needrex
+ if nrex ~= nil then
+ if needrex == nil then
+ needrex = nrex
+ elseif needrex ~= nrex then
+ werror("bad mix of byte-addressable registers")
+ end
+ end
+ end
+
+ -- Try all match:pattern pairs (separated by '|').
+ local gotmatch, lastpat
+ for tm in gmatch(template, "[^%|]+") do
+ -- Split off size match (starts after mode match) and pattern string.
+ local szm, pat = match(tm, "^(.-):(.*)$", #args+1)
+ if pat == "" then pat = lastpat else lastpat = pat end
+ if matchtm(tm, args) then
+ local prefix = sub(szm, 1, 1)
+ if prefix == "/" then -- Exactly match leading operand sizes.
+ for i = #szm,1,-1 do
+ if i == 1 then
+ dopattern(pat, args, sz, params.op, needrex) -- Process pattern.
+ return
+ elseif args[i-1].opsize ~= sub(szm, i, i) then
+ break
+ end
+ end
+ else -- Match common operand size.
+ local szp = sz
+ if szm == "" then szm = x64 and "qdwb" or "dwb" end -- Default sizes.
+ if prefix == "1" then szp = args[1].opsize; szmix = nil
+ elseif prefix == "2" then szp = args[2].opsize; szmix = nil end
+ if not szmix and (prefix == "." or match(szm, szp or "#")) then
+ dopattern(pat, args, szp, params.op, needrex) -- Process pattern.
+ return
+ end
+ end
+ gotmatch = true
+ end
+ end
+
+ local msg = "bad operand mode"
+ if gotmatch then
+ if szmix then
+ msg = "mixed operand size"
+ else
+ msg = sz and "bad operand size" or "missing operand size"
+ end
+ end
+
+ werror(msg.." in `"..opmodestr(params.op, args).."'")
+end
+
+------------------------------------------------------------------------------
+
+-- x64-specific opcode for 64 bit immediates and displacements.
+if x64 then
+ function map_op.mov64_2(params)
+ if not params then return { "reg, imm", "reg, [disp]", "[disp], reg" } end
+ if secpos+2 > maxsecpos then wflush() end
+ local opcode, op64, sz, rex, vreg
+ local op64 = match(params[1], "^%[%s*(.-)%s*%]$")
+ if op64 then
+ local a = parseoperand(params[2])
+ if a.mode ~= "rmR" then werror("bad operand mode") end
+ sz = a.opsize
+ rex = sz == "q" and 8 or 0
+ opcode = 0xa3
+ else
+ op64 = match(params[2], "^%[%s*(.-)%s*%]$")
+ local a = parseoperand(params[1])
+ if op64 then
+ if a.mode ~= "rmR" then werror("bad operand mode") end
+ sz = a.opsize
+ rex = sz == "q" and 8 or 0
+ opcode = 0xa1
+ else
+ if sub(a.mode, 1, 1) ~= "r" or a.opsize ~= "q" then
+ werror("bad operand mode")
+ end
+ op64 = params[2]
+ if a.reg == -1 then
+ vreg = a.vreg
+ opcode = 0xb8
+ else
+ opcode = 0xb8 + band(a.reg, 7)
+ end
+ rex = a.reg > 7 and 9 or 8
+ end
+ end
+ local psz, sk = wputop(sz, opcode, rex, nil, vreg)
+ wvreg("opcode", vreg, psz, sk)
+ waction("IMM_D", format("(unsigned int)(%s)", op64))
+ waction("IMM_D", format("(unsigned int)((%s)>>32)", op64))
+ end
+end
+
+------------------------------------------------------------------------------
+
+-- Pseudo-opcodes for data storage.
+local function op_data(params)
+ if not params then return "imm..." end
+ local sz = sub(params.op, 2, 2)
+ if sz == "a" then sz = addrsize end
+ for _,p in ipairs(params) do
+ local a = parseoperand(p)
+ if sub(a.mode, 1, 1) ~= "i" or (a.opsize and a.opsize ~= sz) then
+ werror("bad mode or size in `"..p.."'")
+ end
+ if a.mode == "iJ" then
+ wputlabel("IMM_", a.imm, 1)
+ else
+ wputszarg(sz, a.imm)
+ end
+ if secpos+2 > maxsecpos then wflush() end
+ end
+end
+
+map_op[".byte_*"] = op_data
+map_op[".sbyte_*"] = op_data
+map_op[".word_*"] = op_data
+map_op[".dword_*"] = op_data
+map_op[".aword_*"] = op_data
+
+------------------------------------------------------------------------------
+
+-- Pseudo-opcode to mark the position where the action list is to be emitted.
+map_op[".actionlist_1"] = function(params)
+ if not params then return "cvar" end
+ local name = params[1] -- No syntax check. You get to keep the pieces.
+ wline(function(out) writeactions(out, name) end)
+end
+
+-- Pseudo-opcode to mark the position where the global enum is to be emitted.
+map_op[".globals_1"] = function(params)
+ if not params then return "prefix" end
+ local prefix = params[1] -- No syntax check. You get to keep the pieces.
+ wline(function(out) writeglobals(out, prefix) end)
+end
+
+-- Pseudo-opcode to mark the position where the global names are to be emitted.
+map_op[".globalnames_1"] = function(params)
+ if not params then return "cvar" end
+ local name = params[1] -- No syntax check. You get to keep the pieces.
+ wline(function(out) writeglobalnames(out, name) end)
+end
+
+-- Pseudo-opcode to mark the position where the extern names are to be emitted.
+map_op[".externnames_1"] = function(params)
+ if not params then return "cvar" end
+ local name = params[1] -- No syntax check. You get to keep the pieces.
+ wline(function(out) writeexternnames(out, name) end)
+end
+
+------------------------------------------------------------------------------
+
+-- Label pseudo-opcode (converted from trailing colon form).
+map_op[".label_2"] = function(params)
+ if not params then return "[1-9] | ->global | =>pcexpr [, addr]" end
+ if secpos+2 > maxsecpos then wflush() end
+ local a = parseoperand(params[1])
+ local mode, imm = a.mode, a.imm
+ if type(imm) == "number" and (mode == "iJ" or (imm >= 1 and imm <= 9)) then
+ -- Local label (1: ... 9:) or global label (->global:).
+ waction("LABEL_LG", nil, 1)
+ wputxb(imm)
+ elseif mode == "iJ" then
+ -- PC label (=>pcexpr:).
+ waction("LABEL_PC", imm)
+ else
+ werror("bad label definition")
+ end
+ -- SETLABEL must immediately follow LABEL_LG/LABEL_PC.
+ local addr = params[2]
+ if addr then
+ local a = parseoperand(addr)
+ if a.mode == "iPJ" then
+ waction("SETLABEL", a.imm)
+ else
+ werror("bad label assignment")
+ end
+ end
+end
+map_op[".label_1"] = map_op[".label_2"]
+
+------------------------------------------------------------------------------
+
+-- Alignment pseudo-opcode.
+map_op[".align_1"] = function(params)
+ if not params then return "numpow2" end
+ if secpos+1 > maxsecpos then wflush() end
+ local align = tonumber(params[1]) or map_opsizenum[map_opsize[params[1]]]
+ if align then
+ local x = align
+ -- Must be a power of 2 in the range (2 ... 256).
+ for i=1,8 do
+ x = x / 2
+ if x == 1 then
+ waction("ALIGN", nil, 1)
+ wputxb(align-1) -- Action byte is 2**n-1.
+ return
+ end
+ end
+ end
+ werror("bad alignment")
+end
+
+-- Spacing pseudo-opcode.
+map_op[".space_2"] = function(params)
+ if not params then return "num [, filler]" end
+ if secpos+1 > maxsecpos then wflush() end
+ waction("SPACE", params[1])
+ local fill = params[2]
+ if fill then
+ fill = tonumber(fill)
+ if not fill or fill < 0 or fill > 255 then werror("bad filler") end
+ end
+ wputxb(fill or 0)
+end
+map_op[".space_1"] = map_op[".space_2"]
+
+------------------------------------------------------------------------------
+
+-- Pseudo-opcode for (primitive) type definitions (map to C types).
+map_op[".type_3"] = function(params, nparams)
+ if not params then
+ return nparams == 2 and "name, ctype" or "name, ctype, reg"
+ end
+ local name, ctype, reg = params[1], params[2], params[3]
+ if not match(name, "^[%a_][%w_]*$") then
+ werror("bad type name `"..name.."'")
+ end
+ local tp = map_type[name]
+ if tp then
+ werror("duplicate type `"..name.."'")
+ end
+ if reg and not map_reg_valid_base[reg] then
+ werror("bad base register `"..(map_reg_rev[reg] or reg).."'")
+ end
+ -- Add #type to defines. A bit unclean to put it in map_archdef.
+ map_archdef["#"..name] = "sizeof("..ctype..")"
+ -- Add new type and emit shortcut define.
+ local num = ctypenum + 1
+ map_type[name] = {
+ ctype = ctype,
+ ctypefmt = format("Dt%X(%%s)", num),
+ reg = reg,
+ }
+ wline(format("#define Dt%X(_V) (int)(ptrdiff_t)&(((%s *)0)_V)", num, ctype))
+ ctypenum = num
+end
+map_op[".type_2"] = map_op[".type_3"]
+
+-- Dump type definitions.
+local function dumptypes(out, lvl)
+ local t = {}
+ for name in pairs(map_type) do t[#t+1] = name end
+ sort(t)
+ out:write("Type definitions:\n")
+ for _,name in ipairs(t) do
+ local tp = map_type[name]
+ local reg = tp.reg and map_reg_rev[tp.reg] or ""
+ out:write(format(" %-20s %-20s %s\n", name, tp.ctype, reg))
+ end
+ out:write("\n")
+end
+
+------------------------------------------------------------------------------
+
+-- Set the current section.
+function _M.section(num)
+ waction("SECTION")
+ wputxb(num)
+ wflush(true) -- SECTION is a terminal action.
+end
+
+------------------------------------------------------------------------------
+
+-- Dump architecture description.
+function _M.dumparch(out)
+ out:write(format("DynASM %s version %s, released %s\n\n",
+ _info.arch, _info.version, _info.release))
+ dumpregs(out)
+ dumpactions(out)
+end
+
+-- Dump all user defined elements.
+function _M.dumpdef(out, lvl)
+ dumptypes(out, lvl)
+ dumpglobals(out, lvl)
+ dumpexterns(out, lvl)
+end
+
+------------------------------------------------------------------------------
+
+-- Pass callbacks from/to the DynASM core.
+function _M.passcb(wl, we, wf, ww)
+ wline, werror, wfatal, wwarn = wl, we, wf, ww
+ return wflush
+end
+
+-- Setup the arch-specific module.
+function _M.setup(arch, opt)
+ g_arch, g_opt = arch, opt
+end
+
+-- Merge the core maps and the arch-specific maps.
+function _M.mergemaps(map_coreop, map_def)
+ setmetatable(map_op, { __index = map_coreop })
+ setmetatable(map_def, { __index = map_archdef })
+ return map_op, map_def
+end
+
+return _M
+
+------------------------------------------------------------------------------
+
diff --git a/ext/opcache/jit/dynasm/dynasm.lua b/ext/opcache/jit/dynasm/dynasm.lua
new file mode 100644
index 0000000000..b7ac453cbd
--- /dev/null
+++ b/ext/opcache/jit/dynasm/dynasm.lua
@@ -0,0 +1,1094 @@
+------------------------------------------------------------------------------
+-- DynASM. A dynamic assembler for code generation engines.
+-- Originally designed and implemented for LuaJIT.
+--
+-- Copyright (C) 2005-2016 Mike Pall. All rights reserved.
+-- See below for full copyright notice.
+------------------------------------------------------------------------------
+
+-- Application information.
+local _info = {
+ name = "DynASM",
+ description = "A dynamic assembler for code generation engines",
+ version = "1.4.0",
+ vernum = 10400,
+ release = "2015-10-18",
+ author = "Mike Pall",
+ url = "http://luajit.org/dynasm.html",
+ license = "MIT",
+ copyright = [[
+Copyright (C) 2005-2016 Mike Pall. All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+[ MIT license: http://www.opensource.org/licenses/mit-license.php ]
+]],
+}
+
+-- Cache library functions.
+local type, pairs, ipairs = type, pairs, ipairs
+local pcall, error, assert = pcall, error, assert
+local _s = string
+local sub, match, gmatch, gsub = _s.sub, _s.match, _s.gmatch, _s.gsub
+local format, rep, upper = _s.format, _s.rep, _s.upper
+local _t = table
+local insert, remove, concat, sort = _t.insert, _t.remove, _t.concat, _t.sort
+local exit = os.exit
+local io = io
+local stdin, stdout, stderr = io.stdin, io.stdout, io.stderr
+
+------------------------------------------------------------------------------
+
+-- Program options.
+local g_opt = {}
+
+-- Global state for current file.
+local g_fname, g_curline, g_indent, g_lineno, g_synclineno, g_arch
+local g_errcount = 0
+
+-- Write buffer for output file.
+local g_wbuffer, g_capbuffer
+
+------------------------------------------------------------------------------
+
+-- Write an output line (or callback function) to the buffer.
+local function wline(line, needindent)
+ local buf = g_capbuffer or g_wbuffer
+ buf[#buf+1] = needindent and g_indent..line or line
+ g_synclineno = g_synclineno + 1
+end
+
+-- Write assembler line as a comment, if requested.
+local function wcomment(aline)
+ if g_opt.comment then
+ wline(g_opt.comment..aline..g_opt.endcomment, true)
+ end
+end
+
+-- Resync CPP line numbers.
+local function wsync()
+ if g_synclineno ~= g_lineno and g_opt.cpp then
+ wline("#line "..g_lineno..' "'..g_fname..'"')
+ g_synclineno = g_lineno
+ end
+end
+
+-- Dummy action flush function. Replaced with arch-specific function later.
+local function wflush(term)
+end
+
+-- Dump all buffered output lines.
+local function wdumplines(out, buf)
+ for _,line in ipairs(buf) do
+ if type(line) == "string" then
+ assert(out:write(line, "\n"))
+ else
+ -- Special callback to dynamically insert lines after end of processing.
+ line(out)
+ end
+ end
+end
+
+------------------------------------------------------------------------------
+
+-- Emit an error. Processing continues with next statement.
+local function werror(msg)
+ error(format("%s:%s: error: %s:\n%s", g_fname, g_lineno, msg, g_curline), 0)
+end
+
+-- Emit a fatal error. Processing stops.
+local function wfatal(msg)
+ g_errcount = "fatal"
+ werror(msg)
+end
+
+-- Print a warning. Processing continues.
+local function wwarn(msg)
+ stderr:write(format("%s:%s: warning: %s:\n%s\n",
+ g_fname, g_lineno, msg, g_curline))
+end
+
+-- Print caught error message. But suppress excessive errors.
+local function wprinterr(...)
+ if type(g_errcount) == "number" then
+ -- Regular error.
+ g_errcount = g_errcount + 1
+ if g_errcount < 21 then -- Seems to be a reasonable limit.
+ stderr:write(...)
+ elseif g_errcount == 21 then
+ stderr:write(g_fname,
+ ":*: warning: too many errors (suppressed further messages).\n")
+ end
+ else
+ -- Fatal error.
+ stderr:write(...)
+ return true -- Stop processing.
+ end
+end
+
+------------------------------------------------------------------------------
+
+-- Map holding all option handlers.
+local opt_map = {}
+local opt_current
+
+-- Print error and exit with error status.
+local function opterror(...)
+ stderr:write("dynasm.lua: ERROR: ", ...)
+ stderr:write("\n")
+ exit(1)
+end
+
+-- Get option parameter.
+local function optparam(args)
+ local argn = args.argn
+ local p = args[argn]
+ if not p then
+ opterror("missing parameter for option `", opt_current, "'.")
+ end
+ args.argn = argn + 1
+ return p
+end
+
+------------------------------------------------------------------------------
+
+-- Core pseudo-opcodes.
+local map_coreop = {}
+-- Dummy opcode map. Replaced by arch-specific map.
+local map_op = {}
+
+-- Forward declarations.
+local dostmt
+local readfile
+
+------------------------------------------------------------------------------
+
+-- Map for defines (initially empty, chains to arch-specific map).
+local map_def = {}
+
+-- Pseudo-opcode to define a substitution.
+map_coreop[".define_2"] = function(params, nparams)
+ if not params then return nparams == 1 and "name" or "name, subst" end
+ local name, def = params[1], params[2] or "1"
+ if not match(name, "^[%a_][%w_]*$") then werror("bad or duplicate define") end
+ map_def[name] = def
+end
+map_coreop[".define_1"] = map_coreop[".define_2"]
+
+-- Define a substitution on the command line.
+function opt_map.D(args)
+ local namesubst = optparam(args)
+ local name, subst = match(namesubst, "^([%a_][%w_]*)=(.*)$")
+ if name then
+ map_def[name] = subst
+ elseif match(namesubst, "^[%a_][%w_]*$") then
+ map_def[namesubst] = "1"
+ else
+ opterror("bad define")
+ end
+end
+
+-- Undefine a substitution on the command line.
+function opt_map.U(args)
+ local name = optparam(args)
+ if match(name, "^[%a_][%w_]*$") then
+ map_def[name] = nil
+ else
+ opterror("bad define")
+ end
+end
+
+-- Helper for definesubst.
+local gotsubst
+
+local function definesubst_one(word)
+ local subst = map_def[word]
+ if subst then gotsubst = word; return subst else return word end
+end
+
+-- Iteratively substitute defines.
+local function definesubst(stmt)
+ -- Limit number of iterations.
+ for i=1,100 do
+ gotsubst = false
+ stmt = gsub(stmt, "#?[%w_]+", definesubst_one)
+ if not gotsubst then break end
+ end
+ if gotsubst then wfatal("recursive define involving `"..gotsubst.."'") end
+ return stmt
+end
+
+-- Dump all defines.
+local function dumpdefines(out, lvl)
+ local t = {}
+ for name in pairs(map_def) do
+ t[#t+1] = name
+ end
+ sort(t)
+ out:write("Defines:\n")
+ for _,name in ipairs(t) do
+ local subst = map_def[name]
+ if g_arch then subst = g_arch.revdef(subst) end
+ out:write(format(" %-20s %s\n", name, subst))
+ end
+ out:write("\n")
+end
+
+------------------------------------------------------------------------------
+
+-- Support variables for conditional assembly.
+local condlevel = 0
+local condstack = {}
+
+-- Evaluate condition with a Lua expression. Substitutions already performed.
+local function cond_eval(cond)
+ local func, err
+ if setfenv then
+ func, err = loadstring("return "..cond, "=expr")
+ else
+ -- No globals. All unknown identifiers evaluate to nil.
+ func, err = load("return "..cond, "=expr", "t", {})
+ end
+ if func then
+ if setfenv then
+ setfenv(func, {}) -- No globals. All unknown identifiers evaluate to nil.
+ end
+ local ok, res = pcall(func)
+ if ok then
+ if res == 0 then return false end -- Oh well.
+ return not not res
+ end
+ err = res
+ end
+ wfatal("bad condition: "..err)
+end
+
+-- Skip statements until next conditional pseudo-opcode at the same level.
+local function stmtskip()
+ local dostmt_save = dostmt
+ local lvl = 0
+ dostmt = function(stmt)
+ local op = match(stmt, "^%s*(%S+)")
+ if op == ".if" then
+ lvl = lvl + 1
+ elseif lvl ~= 0 then
+ if op == ".endif" then lvl = lvl - 1 end
+ elseif op == ".elif" or op == ".else" or op == ".endif" then
+ dostmt = dostmt_save
+ dostmt(stmt)
+ end
+ end
+end
+
+-- Pseudo-opcodes for conditional assembly.
+map_coreop[".if_1"] = function(params)
+ if not params then return "condition" end
+ local lvl = condlevel + 1
+ local res = cond_eval(params[1])
+ condlevel = lvl
+ condstack[lvl] = res
+ if not res then stmtskip() end
+end
+
+map_coreop[".elif_1"] = function(params)
+ if not params then return "condition" end
+ if condlevel == 0 then wfatal(".elif without .if") end
+ local lvl = condlevel
+ local res = condstack[lvl]
+ if res then
+ if res == "else" then wfatal(".elif after .else") end
+ else
+ res = cond_eval(params[1])
+ if res then
+ condstack[lvl] = res
+ return
+ end
+ end
+ stmtskip()
+end
+
+map_coreop[".else_0"] = function(params)
+ if condlevel == 0 then wfatal(".else without .if") end
+ local lvl = condlevel
+ local res = condstack[lvl]
+ condstack[lvl] = "else"
+ if res then
+ if res == "else" then wfatal(".else after .else") end
+ stmtskip()
+ end
+end
+
+map_coreop[".endif_0"] = function(params)
+ local lvl = condlevel
+ if lvl == 0 then wfatal(".endif without .if") end
+ condlevel = lvl - 1
+end
+
+-- Check for unfinished conditionals.
+local function checkconds()
+ if g_errcount ~= "fatal" and condlevel ~= 0 then
+ wprinterr(g_fname, ":*: error: unbalanced conditional\n")
+ end
+end
+
+------------------------------------------------------------------------------
+
+-- Search for a file in the given path and open it for reading.
+local function pathopen(path, name)
+ local dirsep = package and match(package.path, "\\") and "\\" or "/"
+ for _,p in ipairs(path) do
+ local fullname = p == "" and name or p..dirsep..name
+ local fin = io.open(fullname, "r")
+ if fin then
+ g_fname = fullname
+ return fin
+ end
+ end
+end
+
+-- Include a file.
+map_coreop[".include_1"] = function(params)
+ if not params then return "filename" end
+ local name = params[1]
+ -- Save state. Ugly, I know. but upvalues are fast.
+ local gf, gl, gcl, gi = g_fname, g_lineno, g_curline, g_indent
+ -- Read the included file.
+ local fatal = readfile(pathopen(g_opt.include, name) or
+ wfatal("include file `"..name.."' not found"))
+ -- Restore state.
+ g_synclineno = -1
+ g_fname, g_lineno, g_curline, g_indent = gf, gl, gcl, gi
+ if fatal then wfatal("in include file") end
+end
+
+-- Make .include and conditionals initially available, too.
+map_op[".include_1"] = map_coreop[".include_1"]
+map_op[".if_1"] = map_coreop[".if_1"]
+map_op[".elif_1"] = map_coreop[".elif_1"]
+map_op[".else_0"] = map_coreop[".else_0"]
+map_op[".endif_0"] = map_coreop[".endif_0"]
+
+------------------------------------------------------------------------------
+
+-- Support variables for macros.
+local mac_capture, mac_lineno, mac_name
+local mac_active = {}
+local mac_list = {}
+
+-- Pseudo-opcode to define a macro.
+map_coreop[".macro_*"] = function(mparams)
+ if not mparams then return "name [, params...]" end
+ -- Split off and validate macro name.
+ local name = remove(mparams, 1)
+ if not name then werror("missing macro name") end
+ if not (match(name, "^[%a_][%w_%.]*$") or match(name, "^%.[%w_%.]*$")) then
+ wfatal("bad macro name `"..name.."'")
+ end
+ -- Validate macro parameter names.
+ local mdup = {}
+ for _,mp in ipairs(mparams) do
+ if not match(mp, "^[%a_][%w_]*$") then
+ wfatal("bad macro parameter name `"..mp.."'")
+ end
+ if mdup[mp] then wfatal("duplicate macro parameter name `"..mp.."'") end
+ mdup[mp] = true
+ end
+ -- Check for duplicate or recursive macro definitions.
+ local opname = name.."_"..#mparams
+ if map_op[opname] or map_op[name.."_*"] then
+ wfatal("duplicate macro `"..name.."' ("..#mparams.." parameters)")
+ end
+ if mac_capture then wfatal("recursive macro definition") end
+
+ -- Enable statement capture.
+ local lines = {}
+ mac_lineno = g_lineno
+ mac_name = name
+ mac_capture = function(stmt) -- Statement capture function.
+ -- Stop macro definition with .endmacro pseudo-opcode.
+ if not match(stmt, "^%s*.endmacro%s*$") then
+ lines[#lines+1] = stmt
+ return
+ end
+ mac_capture = nil
+ mac_lineno = nil
+ mac_name = nil
+ mac_list[#mac_list+1] = opname
+ -- Add macro-op definition.
+ map_op[opname] = function(params)
+ if not params then return mparams, lines end
+ -- Protect against recursive macro invocation.
+ if mac_active[opname] then wfatal("recursive macro invocation") end
+ mac_active[opname] = true
+ -- Setup substitution map.
+ local subst = {}
+ for i,mp in ipairs(mparams) do subst[mp] = params[i] end
+ local mcom
+ if g_opt.maccomment and g_opt.comment then
+ mcom = " MACRO "..name.." ("..#mparams..")"
+ wcomment("{"..mcom)
+ end
+ -- Loop through all captured statements
+ for _,stmt in ipairs(lines) do
+ -- Substitute macro parameters.
+ local st = gsub(stmt, "[%w_]+", subst)
+ st = definesubst(st)
+ st = gsub(st, "%s*%.%.%s*", "") -- Token paste a..b.
+ if mcom and sub(st, 1, 1) ~= "|" then wcomment(st) end
+ -- Emit statement. Use a protected call for better diagnostics.
+ local ok, err = pcall(dostmt, st)
+ if not ok then
+ -- Add the captured statement to the error.
+ wprinterr(err, "\n", g_indent, "| ", stmt,
+ "\t[MACRO ", name, " (", #mparams, ")]\n")
+ end
+ end
+ if mcom then wcomment("}"..mcom) end
+ mac_active[opname] = nil
+ end
+ end
+end
+
+-- An .endmacro pseudo-opcode outside of a macro definition is an error.
+map_coreop[".endmacro_0"] = function(params)
+ wfatal(".endmacro without .macro")
+end
+
+-- Dump all macros and their contents (with -PP only).
+local function dumpmacros(out, lvl)
+ sort(mac_list)
+ out:write("Macros:\n")
+ for _,opname in ipairs(mac_list) do
+ local name = sub(opname, 1, -3)
+ local params, lines = map_op[opname]()
+ out:write(format(" %-20s %s\n", name, concat(params, ", ")))
+ if lvl > 1 then
+ for _,line in ipairs(lines) do
+ out:write(" |", line, "\n")
+ end
+ out:write("\n")
+ end
+ end
+ out:write("\n")
+end
+
+-- Check for unfinished macro definitions.
+local function checkmacros()
+ if mac_capture then
+ wprinterr(g_fname, ":", mac_lineno,
+ ": error: unfinished .macro `", mac_name ,"'\n")
+ end
+end
+
+------------------------------------------------------------------------------
+
+-- Support variables for captures.
+local cap_lineno, cap_name
+local cap_buffers = {}
+local cap_used = {}
+
+-- Start a capture.
+map_coreop[".capture_1"] = function(params)
+ if not params then return "name" end
+ wflush()
+ local name = params[1]
+ if not match(name, "^[%a_][%w_]*$") then
+ wfatal("bad capture name `"..name.."'")
+ end
+ if cap_name then
+ wfatal("already capturing to `"..cap_name.."' since line "..cap_lineno)
+ end
+ cap_name = name
+ cap_lineno = g_lineno
+ -- Create or continue a capture buffer and start the output line capture.
+ local buf = cap_buffers[name]
+ if not buf then buf = {}; cap_buffers[name] = buf end
+ g_capbuffer = buf
+ g_synclineno = 0
+end
+
+-- Stop a capture.
+map_coreop[".endcapture_0"] = function(params)
+ wflush()
+ if not cap_name then wfatal(".endcapture without a valid .capture") end
+ cap_name = nil
+ cap_lineno = nil
+ g_capbuffer = nil
+ g_synclineno = 0
+end
+
+-- Dump a capture buffer.
+map_coreop[".dumpcapture_1"] = function(params)
+ if not params then return "name" end
+ wflush()
+ local name = params[1]
+ if not match(name, "^[%a_][%w_]*$") then
+ wfatal("bad capture name `"..name.."'")
+ end
+ cap_used[name] = true
+ wline(function(out)
+ local buf = cap_buffers[name]
+ if buf then wdumplines(out, buf) end
+ end)
+ g_synclineno = 0
+end
+
+-- Dump all captures and their buffers (with -PP only).
+local function dumpcaptures(out, lvl)
+ out:write("Captures:\n")
+ for name,buf in pairs(cap_buffers) do
+ out:write(format(" %-20s %4s)\n", name, "("..#buf))
+ if lvl > 1 then
+ local bar = rep("=", 76)
+ out:write(" ", bar, "\n")
+ for _,line in ipairs(buf) do
+ out:write(" ", line, "\n")
+ end
+ out:write(" ", bar, "\n\n")
+ end
+ end
+ out:write("\n")
+end
+
+-- Check for unfinished or unused captures.
+local function checkcaptures()
+ if cap_name then
+ wprinterr(g_fname, ":", cap_lineno,
+ ": error: unfinished .capture `", cap_name,"'\n")
+ return
+ end
+ for name in pairs(cap_buffers) do
+ if not cap_used[name] then
+ wprinterr(g_fname, ":*: error: missing .dumpcapture ", name ,"\n")
+ end
+ end
+end
+
+------------------------------------------------------------------------------
+
+-- Sections names.
+local map_sections = {}
+
+-- Pseudo-opcode to define code sections.
+-- TODO: Data sections, BSS sections. Needs extra C code and API.
+map_coreop[".section_*"] = function(params)
+ if not params then return "name..." end
+ if #map_sections > 0 then werror("duplicate section definition") end
+ wflush()
+ for sn,name in ipairs(params) do
+ local opname = "."..name.."_0"
+ if not match(name, "^[%a][%w_]*$") or
+ map_op[opname] or map_op["."..name.."_*"] then
+ werror("bad section name `"..name.."'")
+ end
+ map_sections[#map_sections+1] = name
+ wline(format("#define DASM_SECTION_%s\t%d", upper(name), sn-1))
+ map_op[opname] = function(params) g_arch.section(sn-1) end
+ end
+ wline(format("#define DASM_MAXSECTION\t\t%d", #map_sections))
+end
+
+-- Dump all sections.
+local function dumpsections(out, lvl)
+ out:write("Sections:\n")
+ for _,name in ipairs(map_sections) do
+ out:write(format(" %s\n", name))
+ end
+ out:write("\n")
+end
+
+------------------------------------------------------------------------------
+
+-- Replacement for customized Lua, which lacks the package library.
+local prefix = ""
+if not require then
+ function require(name)
+ local fp = assert(io.open(prefix..name..".lua"))
+ local s = fp:read("*a")
+ assert(fp:close())
+ return assert(loadstring(s, "@"..name..".lua"))()
+ end
+end
+
+-- Load architecture-specific module.
+local function loadarch(arch)
+ if not match(arch, "^[%w_]+$") then return "bad arch name" end
+ local ok, m_arch = pcall(require, "dasm_"..arch)
+ if not ok then return "cannot load module: "..m_arch end
+ g_arch = m_arch
+ wflush = m_arch.passcb(wline, werror, wfatal, wwarn)
+ m_arch.setup(arch, g_opt)
+ map_op, map_def = m_arch.mergemaps(map_coreop, map_def)
+end
+
+-- Dump architecture description.
+function opt_map.dumparch(args)
+ local name = optparam(args)
+ if not g_arch then
+ local err = loadarch(name)
+ if err then opterror(err) end
+ end
+
+ local t = {}
+ for name in pairs(map_coreop) do t[#t+1] = name end
+ for name in pairs(map_op) do t[#t+1] = name end
+ sort(t)
+
+ local out = stdout
+ local _arch = g_arch._info
+ out:write(format("%s version %s, released %s, %s\n",
+ _info.name, _info.version, _info.release, _info.url))
+ g_arch.dumparch(out)
+
+ local pseudo = true
+ out:write("Pseudo-Opcodes:\n")
+ for _,sname in ipairs(t) do
+ local name, nparam = match(sname, "^(.+)_([0-9%*])$")
+ if name then
+ if pseudo and sub(name, 1, 1) ~= "." then
+ out:write("\nOpcodes:\n")
+ pseudo = false
+ end
+ local f = map_op[sname]
+ local s
+ if nparam ~= "*" then nparam = nparam + 0 end
+ if nparam == 0 then
+ s = ""
+ elseif type(f) == "string" then
+ s = map_op[".template__"](nil, f, nparam)
+ else
+ s = f(nil, nparam)
+ end
+ if type(s) == "table" then
+ for _,s2 in ipairs(s) do
+ out:write(format(" %-12s %s\n", name, s2))
+ end
+ else
+ out:write(format(" %-12s %s\n", name, s))
+ end
+ end
+ end
+ out:write("\n")
+ exit(0)
+end
+
+-- Pseudo-opcode to set the architecture.
+-- Only initially available (map_op is replaced when called).
+map_op[".arch_1"] = function(params)
+ if not params then return "name" end
+ local err = loadarch(params[1])
+ if err then wfatal(err) end
+ wline(format("#if DASM_VERSION != %d", _info.vernum))
+ wline('#error "Version mismatch between DynASM and included encoding engine"')
+ wline("#endif")
+end
+
+-- Dummy .arch pseudo-opcode to improve the error report.
+map_coreop[".arch_1"] = function(params)
+ if not params then return "name" end
+ wfatal("duplicate .arch statement")
+end
+
+------------------------------------------------------------------------------
+
+-- Dummy pseudo-opcode. Don't confuse '.nop' with 'nop'.
+map_coreop[".nop_*"] = function(params)
+ if not params then return "[ignored...]" end
+end
+
+-- Pseudo-opcodes to raise errors.
+map_coreop[".error_1"] = function(params)
+ if not params then return "message" end
+ werror(params[1])
+end
+
+map_coreop[".fatal_1"] = function(params)
+ if not params then return "message" end
+ wfatal(params[1])
+end
+
+-- Dump all user defined elements.
+local function dumpdef(out)
+ local lvl = g_opt.dumpdef
+ if lvl == 0 then return end
+ dumpsections(out, lvl)
+ dumpdefines(out, lvl)
+ if g_arch then g_arch.dumpdef(out, lvl) end
+ dumpmacros(out, lvl)
+ dumpcaptures(out, lvl)
+end
+
+------------------------------------------------------------------------------
+
+-- Helper for splitstmt.
+local splitlvl
+
+local function splitstmt_one(c)
+ if c == "(" then
+ splitlvl = ")"..splitlvl
+ elseif c == "[" then
+ splitlvl = "]"..splitlvl
+ elseif c == "{" then
+ splitlvl = "}"..splitlvl
+ elseif c == ")" or c == "]" or c == "}" then
+ if sub(splitlvl, 1, 1) ~= c then werror("unbalanced (), [] or {}") end
+ splitlvl = sub(splitlvl, 2)
+ elseif splitlvl == "" then
+ return " \0 "
+ end
+ return c
+end
+
+-- Split statement into (pseudo-)opcode and params.
+local function splitstmt(stmt)
+ -- Convert label with trailing-colon into .label statement.
+ local label = match(stmt, "^%s*(.+):%s*$")
+ if label then return ".label", {label} end
+
+ -- Split at commas and equal signs, but obey parentheses and brackets.
+ splitlvl = ""
+ stmt = gsub(stmt, "[,%(%)%[%]{}]", splitstmt_one)
+ if splitlvl ~= "" then werror("unbalanced () or []") end
+
+ -- Split off opcode.
+ local op, other = match(stmt, "^%s*([^%s%z]+)%s*(.*)$")
+ if not op then werror("bad statement syntax") end
+
+ -- Split parameters.
+ local params = {}
+ for p in gmatch(other, "%s*(%Z+)%z?") do
+ params[#params+1] = gsub(p, "%s+$", "")
+ end
+ if #params > 16 then werror("too many parameters") end
+
+ params.op = op
+ return op, params
+end
+
+-- Process a single statement.
+dostmt = function(stmt)
+ -- Ignore empty statements.
+ if match(stmt, "^%s*$") then return end
+
+ -- Capture macro defs before substitution.
+ if mac_capture then return mac_capture(stmt) end
+ stmt = definesubst(stmt)
+
+ -- Emit C code without parsing the line.
+ if sub(stmt, 1, 1) == "|" then
+ local tail = sub(stmt, 2)
+ wflush()
+ if sub(tail, 1, 2) == "//" then wcomment(tail) else wline(tail, true) end
+ return
+ end
+
+ -- Split into (pseudo-)opcode and params.
+ local op, params = splitstmt(stmt)
+
+ -- Get opcode handler (matching # of parameters or generic handler).
+ local f = map_op[op.."_"..#params] or map_op[op.."_*"]
+ if not f then
+ if not g_arch then wfatal("first statement must be .arch") end
+ -- Improve error report.
+ for i=0,9 do
+ if map_op[op.."_"..i] then
+ werror("wrong number of parameters for `"..op.."'")
+ end
+ end
+ werror("unknown statement `"..op.."'")
+ end
+
+ -- Call opcode handler or special handler for template strings.
+ if type(f) == "string" then
+ map_op[".template__"](params, f)
+ else
+ f(params)
+ end
+end
+
+-- Process a single line.
+local function doline(line)
+ if g_opt.flushline then wflush() end
+
+ -- Assembler line?
+ local indent, aline = match(line, "^(%s*)%|(.*)$")
+ if not aline then
+ -- No, plain C code line, need to flush first.
+ wflush()
+ wsync()
+ wline(line, false)
+ return
+ end
+
+ g_indent = indent -- Remember current line indentation.
+
+ -- Emit C code (even from macros). Avoids echo and line parsing.
+ if sub(aline, 1, 1) == "|" then
+ if not mac_capture then
+ wsync()
+ elseif g_opt.comment then
+ wsync()
+ wcomment(aline)
+ end
+ dostmt(aline)
+ return
+ end
+
+ -- Echo assembler line as a comment.
+ if g_opt.comment then
+ wsync()
+ wcomment(aline)
+ end
+
+ -- Strip assembler comments.
+ aline = gsub(aline, "//.*$", "")
+
+ -- Split line into statements at semicolons.
+ if match(aline, ";") then
+ for stmt in gmatch(aline, "[^;]+") do dostmt(stmt) end
+ else
+ dostmt(aline)
+ end
+end
+
+------------------------------------------------------------------------------
+
+-- Write DynASM header.
+local function dasmhead(out)
+ out:write(format([[
+/*
+** This file has been pre-processed with DynASM.
+** %s
+** DynASM version %s, DynASM %s version %s
+** DO NOT EDIT! The original file is in "%s".
+*/
+
+]], _info.url,
+ _info.version, g_arch._info.arch, g_arch._info.version,
+ g_fname))
+end
+
+-- Read input file.
+readfile = function(fin)
+ g_indent = ""
+ g_lineno = 0
+ g_synclineno = -1
+
+ -- Process all lines.
+ for line in fin:lines() do
+ g_lineno = g_lineno + 1
+ g_curline = line
+ local ok, err = pcall(doline, line)
+ if not ok and wprinterr(err, "\n") then return true end
+ end
+ wflush()
+
+ -- Close input file.
+ assert(fin == stdin or fin:close())
+end
+
+-- Write output file.
+local function writefile(outfile)
+ local fout
+
+ -- Open output file.
+ if outfile == nil or outfile == "-" then
+ fout = stdout
+ else
+ fout = assert(io.open(outfile, "w"))
+ end
+
+ -- Write all buffered lines
+ wdumplines(fout, g_wbuffer)
+
+ -- Close output file.
+ assert(fout == stdout or fout:close())
+
+ -- Optionally dump definitions.
+ dumpdef(fout == stdout and stderr or stdout)
+end
+
+-- Translate an input file to an output file.
+local function translate(infile, outfile)
+ g_wbuffer = {}
+ g_indent = ""
+ g_lineno = 0
+ g_synclineno = -1
+
+ -- Put header.
+ wline(dasmhead)
+
+ -- Read input file.
+ local fin
+ if infile == "-" then
+ g_fname = "(stdin)"
+ fin = stdin
+ else
+ g_fname = infile
+ fin = assert(io.open(infile, "r"))
+ end
+ readfile(fin)
+
+ -- Check for errors.
+ if not g_arch then
+ wprinterr(g_fname, ":*: error: missing .arch directive\n")
+ end
+ checkconds()
+ checkmacros()
+ checkcaptures()
+
+ if g_errcount ~= 0 then
+ stderr:write(g_fname, ":*: info: ", g_errcount, " error",
+ (type(g_errcount) == "number" and g_errcount > 1) and "s" or "",
+ " in input file -- no output file generated.\n")
+ dumpdef(stderr)
+ exit(1)
+ end
+
+ -- Write output file.
+ writefile(outfile)
+end
+
+------------------------------------------------------------------------------
+
+-- Print help text.
+function opt_map.help()
+ stdout:write("DynASM -- ", _info.description, ".\n")
+ stdout:write("DynASM ", _info.version, " ", _info.release, " ", _info.url, "\n")
+ stdout:write[[
+
+Usage: dynasm [OPTION]... INFILE.dasc|-
+
+ -h, --help Display this help text.
+ -V, --version Display version and copyright information.
+
+ -o, --outfile FILE Output file name (default is stdout).
+ -I, --include DIR Add directory to the include search path.
+
+ -c, --ccomment Use /* */ comments for assembler lines.
+ -C, --cppcomment Use // comments for assembler lines (default).
+ -N, --nocomment Suppress assembler lines in output.
+ -M, --maccomment Show macro expansions as comments (default off).
+
+ -L, --nolineno Suppress CPP line number information in output.
+ -F, --flushline Flush action list for every line.
+
+ -D NAME[=SUBST] Define a substitution.
+ -U NAME Undefine a substitution.
+
+ -P, --dumpdef Dump defines, macros, etc. Repeat for more output.
+ -A, --dumparch ARCH Load architecture ARCH and dump description.
+]]
+ exit(0)
+end
+
+-- Print version information.
+function opt_map.version()
+ stdout:write(format("%s version %s, released %s\n%s\n\n%s",
+ _info.name, _info.version, _info.release, _info.url, _info.copyright))
+ exit(0)
+end
+
+-- Misc. options.
+function opt_map.outfile(args) g_opt.outfile = optparam(args) end
+function opt_map.include(args) insert(g_opt.include, 1, optparam(args)) end
+function opt_map.ccomment() g_opt.comment = "/*|"; g_opt.endcomment = " */" end
+function opt_map.cppcomment() g_opt.comment = "//|"; g_opt.endcomment = "" end
+function opt_map.nocomment() g_opt.comment = false end
+function opt_map.maccomment() g_opt.maccomment = true end
+function opt_map.nolineno() g_opt.cpp = false end
+function opt_map.flushline() g_opt.flushline = true end
+function opt_map.dumpdef() g_opt.dumpdef = g_opt.dumpdef + 1 end
+
+------------------------------------------------------------------------------
+
+-- Short aliases for long options.
+local opt_alias = {
+ h = "help", ["?"] = "help", V = "version",
+ o = "outfile", I = "include",
+ c = "ccomment", C = "cppcomment", N = "nocomment", M = "maccomment",
+ L = "nolineno", F = "flushline",
+ P = "dumpdef", A = "dumparch",
+}
+
+-- Parse single option.
+local function parseopt(opt, args)
+ opt_current = #opt == 1 and "-"..opt or "--"..opt
+ local f = opt_map[opt] or opt_map[opt_alias[opt]]
+ if not f then
+ opterror("unrecognized option `", opt_current, "'. Try `--help'.\n")
+ end
+ f(args)
+end
+
+-- Parse arguments.
+local function parseargs(args)
+ -- Default options.
+ g_opt.comment = "//|"
+ g_opt.endcomment = ""
+ g_opt.cpp = true
+ g_opt.dumpdef = 0
+ g_opt.include = { "" }
+
+ -- Process all option arguments.
+ args.argn = 1
+ repeat
+ local a = args[args.argn]
+ if not a then break end
+ local lopt, opt = match(a, "^%-(%-?)(.+)")
+ if not opt then break end
+ args.argn = args.argn + 1
+ if lopt == "" then
+ -- Loop through short options.
+ for o in gmatch(opt, ".") do parseopt(o, args) end
+ else
+ -- Long option.
+ parseopt(opt, args)
+ end
+ until false
+
+ -- Check for proper number of arguments.
+ local nargs = #args - args.argn + 1
+ if nargs ~= 1 then
+ if nargs == 0 then
+ if g_opt.dumpdef > 0 then return dumpdef(stdout) end
+ end
+ opt_map.help()
+ end
+
+ -- Translate a single input file to a single output file
+ -- TODO: Handle multiple files?
+ translate(args[args.argn], g_opt.outfile)
+end
+
+------------------------------------------------------------------------------
+
+-- Add the directory dynasm.lua resides in to the Lua module search path.
+local arg = arg
+if arg and arg[0] then
+ prefix = match(arg[0], "^(.*[/\\])")
+ if package and prefix then package.path = prefix.."?.lua;"..package.path end
+end
+
+-- Start DynASM.
+parseargs{...}
+
+------------------------------------------------------------------------------
+
diff --git a/ext/opcache/jit/dynasm/minilua.c b/ext/opcache/jit/dynasm/minilua.c
new file mode 100644
index 0000000000..a8d7c305e1
--- /dev/null
+++ b/ext/opcache/jit/dynasm/minilua.c
@@ -0,0 +1,7770 @@
+/* This is a heavily customized and minimized copy of Lua 5.1.5. */
+/* It's only used to build LuaJIT. It does NOT have all standard functions! */
+/******************************************************************************
+* Copyright (C) 1994-2012 Lua.org, PUC-Rio. All rights reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining
+* a copy of this software and associated documentation files (the
+* "Software"), to deal in the Software without restriction, including
+* without limitation the rights to use, copy, modify, merge, publish,
+* distribute, sublicense, and/or sell copies of the Software, and to
+* permit persons to whom the Software is furnished to do so, subject to
+* the following conditions:
+*
+* The above copyright notice and this permission notice shall be
+* included in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+******************************************************************************/
+#ifdef _MSC_VER
+typedef unsigned __int64 U64;
+#else
+typedef unsigned long long U64;
+#endif
+int _CRT_glob = 0;
+#include <stddef.h>
+#include <stdarg.h>
+#include <limits.h>
+#include <math.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <setjmp.h>
+#include <errno.h>
+#include <time.h>
+typedef enum{
+TM_INDEX,
+TM_NEWINDEX,
+TM_GC,
+TM_MODE,
+TM_EQ,
+TM_ADD,
+TM_SUB,
+TM_MUL,
+TM_DIV,
+TM_MOD,
+TM_POW,
+TM_UNM,
+TM_LEN,
+TM_LT,
+TM_LE,
+TM_CONCAT,
+TM_CALL,
+TM_N
+}TMS;
+enum OpMode{iABC,iABx,iAsBx};
+typedef enum{
+OP_MOVE,
+OP_LOADK,
+OP_LOADBOOL,
+OP_LOADNIL,
+OP_GETUPVAL,
+OP_GETGLOBAL,
+OP_GETTABLE,
+OP_SETGLOBAL,
+OP_SETUPVAL,
+OP_SETTABLE,
+OP_NEWTABLE,
+OP_SELF,
+OP_ADD,
+OP_SUB,
+OP_MUL,
+OP_DIV,
+OP_MOD,
+OP_POW,
+OP_UNM,
+OP_NOT,
+OP_LEN,
+OP_CONCAT,
+OP_JMP,
+OP_EQ,
+OP_LT,
+OP_LE,
+OP_TEST,
+OP_TESTSET,
+OP_CALL,
+OP_TAILCALL,
+OP_RETURN,
+OP_FORLOOP,
+OP_FORPREP,
+OP_TFORLOOP,
+OP_SETLIST,
+OP_CLOSE,
+OP_CLOSURE,
+OP_VARARG
+}OpCode;
+enum OpArgMask{
+OpArgN,
+OpArgU,
+OpArgR,
+OpArgK
+};
+typedef enum{
+VVOID,
+VNIL,
+VTRUE,
+VFALSE,
+VK,
+VKNUM,
+VLOCAL,
+VUPVAL,
+VGLOBAL,
+VINDEXED,
+VJMP,
+VRELOCABLE,
+VNONRELOC,
+VCALL,
+VVARARG
+}expkind;
+enum RESERVED{
+TK_AND=257,TK_BREAK,
+TK_DO,TK_ELSE,TK_ELSEIF,TK_END,TK_FALSE,TK_FOR,TK_FUNCTION,
+TK_IF,TK_IN,TK_LOCAL,TK_NIL,TK_NOT,TK_OR,TK_REPEAT,
+TK_RETURN,TK_THEN,TK_TRUE,TK_UNTIL,TK_WHILE,
+TK_CONCAT,TK_DOTS,TK_EQ,TK_GE,TK_LE,TK_NE,TK_NUMBER,
+TK_NAME,TK_STRING,TK_EOS
+};
+typedef enum BinOpr{
+OPR_ADD,OPR_SUB,OPR_MUL,OPR_DIV,OPR_MOD,OPR_POW,
+OPR_CONCAT,
+OPR_NE,OPR_EQ,
+OPR_LT,OPR_LE,OPR_GT,OPR_GE,
+OPR_AND,OPR_OR,
+OPR_NOBINOPR
+}BinOpr;
+typedef enum UnOpr{OPR_MINUS,OPR_NOT,OPR_LEN,OPR_NOUNOPR}UnOpr;
+#define LUA_QL(x)"'"x"'"
+#define luai_apicheck(L,o){(void)L;}
+#define lua_number2str(s,n)sprintf((s),"%.14g",(n))
+#define lua_str2number(s,p)strtod((s),(p))
+#define luai_numadd(a,b)((a)+(b))
+#define luai_numsub(a,b)((a)-(b))
+#define luai_nummul(a,b)((a)*(b))
+#define luai_numdiv(a,b)((a)/(b))
+#define luai_nummod(a,b)((a)-floor((a)/(b))*(b))
+#define luai_numpow(a,b)(pow(a,b))
+#define luai_numunm(a)(-(a))
+#define luai_numeq(a,b)((a)==(b))
+#define luai_numlt(a,b)((a)<(b))
+#define luai_numle(a,b)((a)<=(b))
+#define luai_numisnan(a)(!luai_numeq((a),(a)))
+#define lua_number2int(i,d)((i)=(int)(d))
+#define lua_number2integer(i,d)((i)=(lua_Integer)(d))
+#define LUAI_THROW(L,c)longjmp((c)->b,1)
+#define LUAI_TRY(L,c,a)if(setjmp((c)->b)==0){a}
+#define lua_pclose(L,file)((void)((void)L,file),0)
+#define lua_upvalueindex(i)((-10002)-(i))
+typedef struct lua_State lua_State;
+typedef int(*lua_CFunction)(lua_State*L);
+typedef const char*(*lua_Reader)(lua_State*L,void*ud,size_t*sz);
+typedef void*(*lua_Alloc)(void*ud,void*ptr,size_t osize,size_t nsize);
+typedef double lua_Number;
+typedef ptrdiff_t lua_Integer;
+static void lua_settop(lua_State*L,int idx);
+static int lua_type(lua_State*L,int idx);
+static const char* lua_tolstring(lua_State*L,int idx,size_t*len);
+static size_t lua_objlen(lua_State*L,int idx);
+static void lua_pushlstring(lua_State*L,const char*s,size_t l);
+static void lua_pushcclosure(lua_State*L,lua_CFunction fn,int n);
+static void lua_createtable(lua_State*L,int narr,int nrec);
+static void lua_setfield(lua_State*L,int idx,const char*k);
+#define lua_pop(L,n)lua_settop(L,-(n)-1)
+#define lua_newtable(L)lua_createtable(L,0,0)
+#define lua_pushcfunction(L,f)lua_pushcclosure(L,(f),0)
+#define lua_strlen(L,i)lua_objlen(L,(i))
+#define lua_isfunction(L,n)(lua_type(L,(n))==6)
+#define lua_istable(L,n)(lua_type(L,(n))==5)
+#define lua_isnil(L,n)(lua_type(L,(n))==0)
+#define lua_isboolean(L,n)(lua_type(L,(n))==1)
+#define lua_isnone(L,n)(lua_type(L,(n))==(-1))
+#define lua_isnoneornil(L,n)(lua_type(L,(n))<=0)
+#define lua_pushliteral(L,s)lua_pushlstring(L,""s,(sizeof(s)/sizeof(char))-1)
+#define lua_setglobal(L,s)lua_setfield(L,(-10002),(s))
+#define lua_tostring(L,i)lua_tolstring(L,(i),NULL)
+typedef struct lua_Debug lua_Debug;
+typedef void(*lua_Hook)(lua_State*L,lua_Debug*ar);
+struct lua_Debug{
+int event;
+const char*name;
+const char*namewhat;
+const char*what;
+const char*source;
+int currentline;
+int nups;
+int linedefined;
+int lastlinedefined;
+char short_src[60];
+int i_ci;
+};
+typedef unsigned int lu_int32;
+typedef size_t lu_mem;
+typedef ptrdiff_t l_mem;
+typedef unsigned char lu_byte;
+#define IntPoint(p)((unsigned int)(lu_mem)(p))
+typedef union{double u;void*s;long l;}L_Umaxalign;
+typedef double l_uacNumber;
+#define check_exp(c,e)(e)
+#define UNUSED(x)((void)(x))
+#define cast(t,exp)((t)(exp))
+#define cast_byte(i)cast(lu_byte,(i))
+#define cast_num(i)cast(lua_Number,(i))
+#define cast_int(i)cast(int,(i))
+typedef lu_int32 Instruction;
+#define condhardstacktests(x)((void)0)
+typedef union GCObject GCObject;
+typedef struct GCheader{
+GCObject*next;lu_byte tt;lu_byte marked;
+}GCheader;
+typedef union{
+GCObject*gc;
+void*p;
+lua_Number n;
+int b;
+}Value;
+typedef struct lua_TValue{
+Value value;int tt;
+}TValue;
+#define ttisnil(o)(ttype(o)==0)
+#define ttisnumber(o)(ttype(o)==3)
+#define ttisstring(o)(ttype(o)==4)
+#define ttistable(o)(ttype(o)==5)
+#define ttisfunction(o)(ttype(o)==6)
+#define ttisboolean(o)(ttype(o)==1)
+#define ttisuserdata(o)(ttype(o)==7)
+#define ttisthread(o)(ttype(o)==8)
+#define ttislightuserdata(o)(ttype(o)==2)
+#define ttype(o)((o)->tt)
+#define gcvalue(o)check_exp(iscollectable(o),(o)->value.gc)
+#define pvalue(o)check_exp(ttislightuserdata(o),(o)->value.p)
+#define nvalue(o)check_exp(ttisnumber(o),(o)->value.n)
+#define rawtsvalue(o)check_exp(ttisstring(o),&(o)->value.gc->ts)
+#define tsvalue(o)(&rawtsvalue(o)->tsv)
+#define rawuvalue(o)check_exp(ttisuserdata(o),&(o)->value.gc->u)
+#define uvalue(o)(&rawuvalue(o)->uv)
+#define clvalue(o)check_exp(ttisfunction(o),&(o)->value.gc->cl)
+#define hvalue(o)check_exp(ttistable(o),&(o)->value.gc->h)
+#define bvalue(o)check_exp(ttisboolean(o),(o)->value.b)
+#define thvalue(o)check_exp(ttisthread(o),&(o)->value.gc->th)
+#define l_isfalse(o)(ttisnil(o)||(ttisboolean(o)&&bvalue(o)==0))
+#define checkconsistency(obj)
+#define checkliveness(g,obj)
+#define setnilvalue(obj)((obj)->tt=0)
+#define setnvalue(obj,x){TValue*i_o=(obj);i_o->value.n=(x);i_o->tt=3;}
+#define setbvalue(obj,x){TValue*i_o=(obj);i_o->value.b=(x);i_o->tt=1;}
+#define setsvalue(L,obj,x){TValue*i_o=(obj);i_o->value.gc=cast(GCObject*,(x));i_o->tt=4;checkliveness(G(L),i_o);}
+#define setuvalue(L,obj,x){TValue*i_o=(obj);i_o->value.gc=cast(GCObject*,(x));i_o->tt=7;checkliveness(G(L),i_o);}
+#define setthvalue(L,obj,x){TValue*i_o=(obj);i_o->value.gc=cast(GCObject*,(x));i_o->tt=8;checkliveness(G(L),i_o);}
+#define setclvalue(L,obj,x){TValue*i_o=(obj);i_o->value.gc=cast(GCObject*,(x));i_o->tt=6;checkliveness(G(L),i_o);}
+#define sethvalue(L,obj,x){TValue*i_o=(obj);i_o->value.gc=cast(GCObject*,(x));i_o->tt=5;checkliveness(G(L),i_o);}
+#define setptvalue(L,obj,x){TValue*i_o=(obj);i_o->value.gc=cast(GCObject*,(x));i_o->tt=(8+1);checkliveness(G(L),i_o);}
+#define setobj(L,obj1,obj2){const TValue*o2=(obj2);TValue*o1=(obj1);o1->value=o2->value;o1->tt=o2->tt;checkliveness(G(L),o1);}
+#define setttype(obj,tt)(ttype(obj)=(tt))
+#define iscollectable(o)(ttype(o)>=4)
+typedef TValue*StkId;
+typedef union TString{
+L_Umaxalign dummy;
+struct{
+GCObject*next;lu_byte tt;lu_byte marked;
+lu_byte reserved;
+unsigned int hash;
+size_t len;
+}tsv;
+}TString;
+#define getstr(ts)cast(const char*,(ts)+1)
+#define svalue(o)getstr(rawtsvalue(o))
+typedef union Udata{
+L_Umaxalign dummy;
+struct{
+GCObject*next;lu_byte tt;lu_byte marked;
+struct Table*metatable;
+struct Table*env;
+size_t len;
+}uv;
+}Udata;
+typedef struct Proto{
+GCObject*next;lu_byte tt;lu_byte marked;
+TValue*k;
+Instruction*code;
+struct Proto**p;
+int*lineinfo;
+struct LocVar*locvars;
+TString**upvalues;
+TString*source;
+int sizeupvalues;
+int sizek;
+int sizecode;
+int sizelineinfo;
+int sizep;
+int sizelocvars;
+int linedefined;
+int lastlinedefined;
+GCObject*gclist;
+lu_byte nups;
+lu_byte numparams;
+lu_byte is_vararg;
+lu_byte maxstacksize;
+}Proto;
+typedef struct LocVar{
+TString*varname;
+int startpc;
+int endpc;
+}LocVar;
+typedef struct UpVal{
+GCObject*next;lu_byte tt;lu_byte marked;
+TValue*v;
+union{
+TValue value;
+struct{
+struct UpVal*prev;
+struct UpVal*next;
+}l;
+}u;
+}UpVal;
+typedef struct CClosure{
+GCObject*next;lu_byte tt;lu_byte marked;lu_byte isC;lu_byte nupvalues;GCObject*gclist;struct Table*env;
+lua_CFunction f;
+TValue upvalue[1];
+}CClosure;
+typedef struct LClosure{
+GCObject*next;lu_byte tt;lu_byte marked;lu_byte isC;lu_byte nupvalues;GCObject*gclist;struct Table*env;
+struct Proto*p;
+UpVal*upvals[1];
+}LClosure;
+typedef union Closure{
+CClosure c;
+LClosure l;
+}Closure;
+#define iscfunction(o)(ttype(o)==6&&clvalue(o)->c.isC)
+typedef union TKey{
+struct{
+Value value;int tt;
+struct Node*next;
+}nk;
+TValue tvk;
+}TKey;
+typedef struct Node{
+TValue i_val;
+TKey i_key;
+}Node;
+typedef struct Table{
+GCObject*next;lu_byte tt;lu_byte marked;
+lu_byte flags;
+lu_byte lsizenode;
+struct Table*metatable;
+TValue*array;
+Node*node;
+Node*lastfree;
+GCObject*gclist;
+int sizearray;
+}Table;
+#define lmod(s,size)(check_exp((size&(size-1))==0,(cast(int,(s)&((size)-1)))))
+#define twoto(x)((size_t)1<<(x))
+#define sizenode(t)(twoto((t)->lsizenode))
+static const TValue luaO_nilobject_;
+#define ceillog2(x)(luaO_log2((x)-1)+1)
+static int luaO_log2(unsigned int x);
+#define gfasttm(g,et,e)((et)==NULL?NULL:((et)->flags&(1u<<(e)))?NULL:luaT_gettm(et,e,(g)->tmname[e]))
+#define fasttm(l,et,e)gfasttm(G(l),et,e)
+static const TValue*luaT_gettm(Table*events,TMS event,TString*ename);
+#define luaM_reallocv(L,b,on,n,e)((cast(size_t,(n)+1)<=((size_t)(~(size_t)0)-2)/(e))?luaM_realloc_(L,(b),(on)*(e),(n)*(e)):luaM_toobig(L))
+#define luaM_freemem(L,b,s)luaM_realloc_(L,(b),(s),0)
+#define luaM_free(L,b)luaM_realloc_(L,(b),sizeof(*(b)),0)
+#define luaM_freearray(L,b,n,t)luaM_reallocv(L,(b),n,0,sizeof(t))
+#define luaM_malloc(L,t)luaM_realloc_(L,NULL,0,(t))
+#define luaM_new(L,t)cast(t*,luaM_malloc(L,sizeof(t)))
+#define luaM_newvector(L,n,t)cast(t*,luaM_reallocv(L,NULL,0,n,sizeof(t)))
+#define luaM_growvector(L,v,nelems,size,t,limit,e)if((nelems)+1>(size))((v)=cast(t*,luaM_growaux_(L,v,&(size),sizeof(t),limit,e)))
+#define luaM_reallocvector(L,v,oldn,n,t)((v)=cast(t*,luaM_reallocv(L,v,oldn,n,sizeof(t))))
+static void*luaM_realloc_(lua_State*L,void*block,size_t oldsize,
+size_t size);
+static void*luaM_toobig(lua_State*L);
+static void*luaM_growaux_(lua_State*L,void*block,int*size,
+size_t size_elem,int limit,
+const char*errormsg);
+typedef struct Zio ZIO;
+#define char2int(c)cast(int,cast(unsigned char,(c)))
+#define zgetc(z)(((z)->n--)>0?char2int(*(z)->p++):luaZ_fill(z))
+typedef struct Mbuffer{
+char*buffer;
+size_t n;
+size_t buffsize;
+}Mbuffer;
+#define luaZ_initbuffer(L,buff)((buff)->buffer=NULL,(buff)->buffsize=0)
+#define luaZ_buffer(buff)((buff)->buffer)
+#define luaZ_sizebuffer(buff)((buff)->buffsize)
+#define luaZ_bufflen(buff)((buff)->n)
+#define luaZ_resetbuffer(buff)((buff)->n=0)
+#define luaZ_resizebuffer(L,buff,size)(luaM_reallocvector(L,(buff)->buffer,(buff)->buffsize,size,char),(buff)->buffsize=size)
+#define luaZ_freebuffer(L,buff)luaZ_resizebuffer(L,buff,0)
+struct Zio{
+size_t n;
+const char*p;
+lua_Reader reader;
+void*data;
+lua_State*L;
+};
+static int luaZ_fill(ZIO*z);
+struct lua_longjmp;
+#define gt(L)(&L->l_gt)
+#define registry(L)(&G(L)->l_registry)
+typedef struct stringtable{
+GCObject**hash;
+lu_int32 nuse;
+int size;
+}stringtable;
+typedef struct CallInfo{
+StkId base;
+StkId func;
+StkId top;
+const Instruction*savedpc;
+int nresults;
+int tailcalls;
+}CallInfo;
+#define curr_func(L)(clvalue(L->ci->func))
+#define ci_func(ci)(clvalue((ci)->func))
+#define f_isLua(ci)(!ci_func(ci)->c.isC)
+#define isLua(ci)(ttisfunction((ci)->func)&&f_isLua(ci))
+typedef struct global_State{
+stringtable strt;
+lua_Alloc frealloc;
+void*ud;
+lu_byte currentwhite;
+lu_byte gcstate;
+int sweepstrgc;
+GCObject*rootgc;
+GCObject**sweepgc;
+GCObject*gray;
+GCObject*grayagain;
+GCObject*weak;
+GCObject*tmudata;
+Mbuffer buff;
+lu_mem GCthreshold;
+lu_mem totalbytes;
+lu_mem estimate;
+lu_mem gcdept;
+int gcpause;
+int gcstepmul;
+lua_CFunction panic;
+TValue l_registry;
+struct lua_State*mainthread;
+UpVal uvhead;
+struct Table*mt[(8+1)];
+TString*tmname[TM_N];
+}global_State;
+struct lua_State{
+GCObject*next;lu_byte tt;lu_byte marked;
+lu_byte status;
+StkId top;
+StkId base;
+global_State*l_G;
+CallInfo*ci;
+const Instruction*savedpc;
+StkId stack_last;
+StkId stack;
+CallInfo*end_ci;
+CallInfo*base_ci;
+int stacksize;
+int size_ci;
+unsigned short nCcalls;
+unsigned short baseCcalls;
+lu_byte hookmask;
+lu_byte allowhook;
+int basehookcount;
+int hookcount;
+lua_Hook hook;
+TValue l_gt;
+TValue env;
+GCObject*openupval;
+GCObject*gclist;
+struct lua_longjmp*errorJmp;
+ptrdiff_t errfunc;
+};
+#define G(L)(L->l_G)
+union GCObject{
+GCheader gch;
+union TString ts;
+union Udata u;
+union Closure cl;
+struct Table h;
+struct Proto p;
+struct UpVal uv;
+struct lua_State th;
+};
+#define rawgco2ts(o)check_exp((o)->gch.tt==4,&((o)->ts))
+#define gco2ts(o)(&rawgco2ts(o)->tsv)
+#define rawgco2u(o)check_exp((o)->gch.tt==7,&((o)->u))
+#define gco2u(o)(&rawgco2u(o)->uv)
+#define gco2cl(o)check_exp((o)->gch.tt==6,&((o)->cl))
+#define gco2h(o)check_exp((o)->gch.tt==5,&((o)->h))
+#define gco2p(o)check_exp((o)->gch.tt==(8+1),&((o)->p))
+#define gco2uv(o)check_exp((o)->gch.tt==(8+2),&((o)->uv))
+#define ngcotouv(o)check_exp((o)==NULL||(o)->gch.tt==(8+2),&((o)->uv))
+#define gco2th(o)check_exp((o)->gch.tt==8,&((o)->th))
+#define obj2gco(v)(cast(GCObject*,(v)))
+static void luaE_freethread(lua_State*L,lua_State*L1);
+#define pcRel(pc,p)(cast(int,(pc)-(p)->code)-1)
+#define getline_(f,pc)(((f)->lineinfo)?(f)->lineinfo[pc]:0)
+#define resethookcount(L)(L->hookcount=L->basehookcount)
+static void luaG_typeerror(lua_State*L,const TValue*o,
+const char*opname);
+static void luaG_runerror(lua_State*L,const char*fmt,...);
+#define luaD_checkstack(L,n)if((char*)L->stack_last-(char*)L->top<=(n)*(int)sizeof(TValue))luaD_growstack(L,n);else condhardstacktests(luaD_reallocstack(L,L->stacksize-5-1));
+#define incr_top(L){luaD_checkstack(L,1);L->top++;}
+#define savestack(L,p)((char*)(p)-(char*)L->stack)
+#define restorestack(L,n)((TValue*)((char*)L->stack+(n)))
+#define saveci(L,p)((char*)(p)-(char*)L->base_ci)
+#define restoreci(L,n)((CallInfo*)((char*)L->base_ci+(n)))
+typedef void(*Pfunc)(lua_State*L,void*ud);
+static int luaD_poscall(lua_State*L,StkId firstResult);
+static void luaD_reallocCI(lua_State*L,int newsize);
+static void luaD_reallocstack(lua_State*L,int newsize);
+static void luaD_growstack(lua_State*L,int n);
+static void luaD_throw(lua_State*L,int errcode);
+static void*luaM_growaux_(lua_State*L,void*block,int*size,size_t size_elems,
+int limit,const char*errormsg){
+void*newblock;
+int newsize;
+if(*size>=limit/2){
+if(*size>=limit)
+luaG_runerror(L,errormsg);
+newsize=limit;
+}
+else{
+newsize=(*size)*2;
+if(newsize<4)
+newsize=4;
+}
+newblock=luaM_reallocv(L,block,*size,newsize,size_elems);
+*size=newsize;
+return newblock;
+}
+static void*luaM_toobig(lua_State*L){
+luaG_runerror(L,"memory allocation error: block too big");
+return NULL;
+}
+static void*luaM_realloc_(lua_State*L,void*block,size_t osize,size_t nsize){
+global_State*g=G(L);
+block=(*g->frealloc)(g->ud,block,osize,nsize);
+if(block==NULL&&nsize>0)
+luaD_throw(L,4);
+g->totalbytes=(g->totalbytes-osize)+nsize;
+return block;
+}
+#define resetbits(x,m)((x)&=cast(lu_byte,~(m)))
+#define setbits(x,m)((x)|=(m))
+#define testbits(x,m)((x)&(m))
+#define bitmask(b)(1<<(b))
+#define bit2mask(b1,b2)(bitmask(b1)|bitmask(b2))
+#define l_setbit(x,b)setbits(x,bitmask(b))
+#define resetbit(x,b)resetbits(x,bitmask(b))
+#define testbit(x,b)testbits(x,bitmask(b))
+#define set2bits(x,b1,b2)setbits(x,(bit2mask(b1,b2)))
+#define reset2bits(x,b1,b2)resetbits(x,(bit2mask(b1,b2)))
+#define test2bits(x,b1,b2)testbits(x,(bit2mask(b1,b2)))
+#define iswhite(x)test2bits((x)->gch.marked,0,1)
+#define isblack(x)testbit((x)->gch.marked,2)
+#define isgray(x)(!isblack(x)&&!iswhite(x))
+#define otherwhite(g)(g->currentwhite^bit2mask(0,1))
+#define isdead(g,v)((v)->gch.marked&otherwhite(g)&bit2mask(0,1))
+#define changewhite(x)((x)->gch.marked^=bit2mask(0,1))
+#define gray2black(x)l_setbit((x)->gch.marked,2)
+#define valiswhite(x)(iscollectable(x)&&iswhite(gcvalue(x)))
+#define luaC_white(g)cast(lu_byte,(g)->currentwhite&bit2mask(0,1))
+#define luaC_checkGC(L){condhardstacktests(luaD_reallocstack(L,L->stacksize-5-1));if(G(L)->totalbytes>=G(L)->GCthreshold)luaC_step(L);}
+#define luaC_barrier(L,p,v){if(valiswhite(v)&&isblack(obj2gco(p)))luaC_barrierf(L,obj2gco(p),gcvalue(v));}
+#define luaC_barriert(L,t,v){if(valiswhite(v)&&isblack(obj2gco(t)))luaC_barrierback(L,t);}
+#define luaC_objbarrier(L,p,o){if(iswhite(obj2gco(o))&&isblack(obj2gco(p)))luaC_barrierf(L,obj2gco(p),obj2gco(o));}
+#define luaC_objbarriert(L,t,o){if(iswhite(obj2gco(o))&&isblack(obj2gco(t)))luaC_barrierback(L,t);}
+static void luaC_step(lua_State*L);
+static void luaC_link(lua_State*L,GCObject*o,lu_byte tt);
+static void luaC_linkupval(lua_State*L,UpVal*uv);
+static void luaC_barrierf(lua_State*L,GCObject*o,GCObject*v);
+static void luaC_barrierback(lua_State*L,Table*t);
+#define sizestring(s)(sizeof(union TString)+((s)->len+1)*sizeof(char))
+#define sizeudata(u)(sizeof(union Udata)+(u)->len)
+#define luaS_new(L,s)(luaS_newlstr(L,s,strlen(s)))
+#define luaS_newliteral(L,s)(luaS_newlstr(L,""s,(sizeof(s)/sizeof(char))-1))
+#define luaS_fix(s)l_setbit((s)->tsv.marked,5)
+static TString*luaS_newlstr(lua_State*L,const char*str,size_t l);
+#define tostring(L,o)((ttype(o)==4)||(luaV_tostring(L,o)))
+#define tonumber(o,n)(ttype(o)==3||(((o)=luaV_tonumber(o,n))!=NULL))
+#define equalobj(L,o1,o2)(ttype(o1)==ttype(o2)&&luaV_equalval(L,o1,o2))
+static int luaV_equalval(lua_State*L,const TValue*t1,const TValue*t2);
+static const TValue*luaV_tonumber(const TValue*obj,TValue*n);
+static int luaV_tostring(lua_State*L,StkId obj);
+static void luaV_execute(lua_State*L,int nexeccalls);
+static void luaV_concat(lua_State*L,int total,int last);
+static const TValue luaO_nilobject_={{NULL},0};
+static int luaO_int2fb(unsigned int x){
+int e=0;
+while(x>=16){
+x=(x+1)>>1;
+e++;
+}
+if(x<8)return x;
+else return((e+1)<<3)|(cast_int(x)-8);
+}
+static int luaO_fb2int(int x){
+int e=(x>>3)&31;
+if(e==0)return x;
+else return((x&7)+8)<<(e-1);
+}
+static int luaO_log2(unsigned int x){
+static const lu_byte log_2[256]={
+0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
+8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
+8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
+8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8
+};
+int l=-1;
+while(x>=256){l+=8;x>>=8;}
+return l+log_2[x];
+}
+static int luaO_rawequalObj(const TValue*t1,const TValue*t2){
+if(ttype(t1)!=ttype(t2))return 0;
+else switch(ttype(t1)){
+case 0:
+return 1;
+case 3:
+return luai_numeq(nvalue(t1),nvalue(t2));
+case 1:
+return bvalue(t1)==bvalue(t2);
+case 2:
+return pvalue(t1)==pvalue(t2);
+default:
+return gcvalue(t1)==gcvalue(t2);
+}
+}
+static int luaO_str2d(const char*s,lua_Number*result){
+char*endptr;
+*result=lua_str2number(s,&endptr);
+if(endptr==s)return 0;
+if(*endptr=='x'||*endptr=='X')
+*result=cast_num(strtoul(s,&endptr,16));
+if(*endptr=='\0')return 1;
+while(isspace(cast(unsigned char,*endptr)))endptr++;
+if(*endptr!='\0')return 0;
+return 1;
+}
+static void pushstr(lua_State*L,const char*str){
+setsvalue(L,L->top,luaS_new(L,str));
+incr_top(L);
+}
+static const char*luaO_pushvfstring(lua_State*L,const char*fmt,va_list argp){
+int n=1;
+pushstr(L,"");
+for(;;){
+const char*e=strchr(fmt,'%');
+if(e==NULL)break;
+setsvalue(L,L->top,luaS_newlstr(L,fmt,e-fmt));
+incr_top(L);
+switch(*(e+1)){
+case's':{
+const char*s=va_arg(argp,char*);
+if(s==NULL)s="(null)";
+pushstr(L,s);
+break;
+}
+case'c':{
+char buff[2];
+buff[0]=cast(char,va_arg(argp,int));
+buff[1]='\0';
+pushstr(L,buff);
+break;
+}
+case'd':{
+setnvalue(L->top,cast_num(va_arg(argp,int)));
+incr_top(L);
+break;
+}
+case'f':{
+setnvalue(L->top,cast_num(va_arg(argp,l_uacNumber)));
+incr_top(L);
+break;
+}
+case'p':{
+char buff[4*sizeof(void*)+8];
+sprintf(buff,"%p",va_arg(argp,void*));
+pushstr(L,buff);
+break;
+}
+case'%':{
+pushstr(L,"%");
+break;
+}
+default:{
+char buff[3];
+buff[0]='%';
+buff[1]=*(e+1);
+buff[2]='\0';
+pushstr(L,buff);
+break;
+}
+}
+n+=2;
+fmt=e+2;
+}
+pushstr(L,fmt);
+luaV_concat(L,n+1,cast_int(L->top-L->base)-1);
+L->top-=n;
+return svalue(L->top-1);
+}
+static const char*luaO_pushfstring(lua_State*L,const char*fmt,...){
+const char*msg;
+va_list argp;
+va_start(argp,fmt);
+msg=luaO_pushvfstring(L,fmt,argp);
+va_end(argp);
+return msg;
+}
+static void luaO_chunkid(char*out,const char*source,size_t bufflen){
+if(*source=='='){
+strncpy(out,source+1,bufflen);
+out[bufflen-1]='\0';
+}
+else{
+if(*source=='@'){
+size_t l;
+source++;
+bufflen-=sizeof(" '...' ");
+l=strlen(source);
+strcpy(out,"");
+if(l>bufflen){
+source+=(l-bufflen);
+strcat(out,"...");
+}
+strcat(out,source);
+}
+else{
+size_t len=strcspn(source,"\n\r");
+bufflen-=sizeof(" [string \"...\"] ");
+if(len>bufflen)len=bufflen;
+strcpy(out,"[string \"");
+if(source[len]!='\0'){
+strncat(out,source,len);
+strcat(out,"...");
+}
+else
+strcat(out,source);
+strcat(out,"\"]");
+}
+}
+}
+#define gnode(t,i)(&(t)->node[i])
+#define gkey(n)(&(n)->i_key.nk)
+#define gval(n)(&(n)->i_val)
+#define gnext(n)((n)->i_key.nk.next)
+#define key2tval(n)(&(n)->i_key.tvk)
+static TValue*luaH_setnum(lua_State*L,Table*t,int key);
+static const TValue*luaH_getstr(Table*t,TString*key);
+static TValue*luaH_set(lua_State*L,Table*t,const TValue*key);
+static const char*const luaT_typenames[]={
+"nil","boolean","userdata","number",
+"string","table","function","userdata","thread",
+"proto","upval"
+};
+static void luaT_init(lua_State*L){
+static const char*const luaT_eventname[]={
+"__index","__newindex",
+"__gc","__mode","__eq",
+"__add","__sub","__mul","__div","__mod",
+"__pow","__unm","__len","__lt","__le",
+"__concat","__call"
+};
+int i;
+for(i=0;i<TM_N;i++){
+G(L)->tmname[i]=luaS_new(L,luaT_eventname[i]);
+luaS_fix(G(L)->tmname[i]);
+}
+}
+static const TValue*luaT_gettm(Table*events,TMS event,TString*ename){
+const TValue*tm=luaH_getstr(events,ename);
+if(ttisnil(tm)){
+events->flags|=cast_byte(1u<<event);
+return NULL;
+}
+else return tm;
+}
+static const TValue*luaT_gettmbyobj(lua_State*L,const TValue*o,TMS event){
+Table*mt;
+switch(ttype(o)){
+case 5:
+mt=hvalue(o)->metatable;
+break;
+case 7:
+mt=uvalue(o)->metatable;
+break;
+default:
+mt=G(L)->mt[ttype(o)];
+}
+return(mt?luaH_getstr(mt,G(L)->tmname[event]):(&luaO_nilobject_));
+}
+#define sizeCclosure(n)(cast(int,sizeof(CClosure))+cast(int,sizeof(TValue)*((n)-1)))
+#define sizeLclosure(n)(cast(int,sizeof(LClosure))+cast(int,sizeof(TValue*)*((n)-1)))
+static Closure*luaF_newCclosure(lua_State*L,int nelems,Table*e){
+Closure*c=cast(Closure*,luaM_malloc(L,sizeCclosure(nelems)));
+luaC_link(L,obj2gco(c),6);
+c->c.isC=1;
+c->c.env=e;
+c->c.nupvalues=cast_byte(nelems);
+return c;
+}
+static Closure*luaF_newLclosure(lua_State*L,int nelems,Table*e){
+Closure*c=cast(Closure*,luaM_malloc(L,sizeLclosure(nelems)));
+luaC_link(L,obj2gco(c),6);
+c->l.isC=0;
+c->l.env=e;
+c->l.nupvalues=cast_byte(nelems);
+while(nelems--)c->l.upvals[nelems]=NULL;
+return c;
+}
+static UpVal*luaF_newupval(lua_State*L){
+UpVal*uv=luaM_new(L,UpVal);
+luaC_link(L,obj2gco(uv),(8+2));
+uv->v=&uv->u.value;
+setnilvalue(uv->v);
+return uv;
+}
+static UpVal*luaF_findupval(lua_State*L,StkId level){
+global_State*g=G(L);
+GCObject**pp=&L->openupval;
+UpVal*p;
+UpVal*uv;
+while(*pp!=NULL&&(p=ngcotouv(*pp))->v>=level){
+if(p->v==level){
+if(isdead(g,obj2gco(p)))
+changewhite(obj2gco(p));
+return p;
+}
+pp=&p->next;
+}
+uv=luaM_new(L,UpVal);
+uv->tt=(8+2);
+uv->marked=luaC_white(g);
+uv->v=level;
+uv->next=*pp;
+*pp=obj2gco(uv);
+uv->u.l.prev=&g->uvhead;
+uv->u.l.next=g->uvhead.u.l.next;
+uv->u.l.next->u.l.prev=uv;
+g->uvhead.u.l.next=uv;
+return uv;
+}
+static void unlinkupval(UpVal*uv){
+uv->u.l.next->u.l.prev=uv->u.l.prev;
+uv->u.l.prev->u.l.next=uv->u.l.next;
+}
+static void luaF_freeupval(lua_State*L,UpVal*uv){
+if(uv->v!=&uv->u.value)
+unlinkupval(uv);
+luaM_free(L,uv);
+}
+static void luaF_close(lua_State*L,StkId level){
+UpVal*uv;
+global_State*g=G(L);
+while(L->openupval!=NULL&&(uv=ngcotouv(L->openupval))->v>=level){
+GCObject*o=obj2gco(uv);
+L->openupval=uv->next;
+if(isdead(g,o))
+luaF_freeupval(L,uv);
+else{
+unlinkupval(uv);
+setobj(L,&uv->u.value,uv->v);
+uv->v=&uv->u.value;
+luaC_linkupval(L,uv);
+}
+}
+}
+static Proto*luaF_newproto(lua_State*L){
+Proto*f=luaM_new(L,Proto);
+luaC_link(L,obj2gco(f),(8+1));
+f->k=NULL;
+f->sizek=0;
+f->p=NULL;
+f->sizep=0;
+f->code=NULL;
+f->sizecode=0;
+f->sizelineinfo=0;
+f->sizeupvalues=0;
+f->nups=0;
+f->upvalues=NULL;
+f->numparams=0;
+f->is_vararg=0;
+f->maxstacksize=0;
+f->lineinfo=NULL;
+f->sizelocvars=0;
+f->locvars=NULL;
+f->linedefined=0;
+f->lastlinedefined=0;
+f->source=NULL;
+return f;
+}
+static void luaF_freeproto(lua_State*L,Proto*f){
+luaM_freearray(L,f->code,f->sizecode,Instruction);
+luaM_freearray(L,f->p,f->sizep,Proto*);
+luaM_freearray(L,f->k,f->sizek,TValue);
+luaM_freearray(L,f->lineinfo,f->sizelineinfo,int);
+luaM_freearray(L,f->locvars,f->sizelocvars,struct LocVar);
+luaM_freearray(L,f->upvalues,f->sizeupvalues,TString*);
+luaM_free(L,f);
+}
+static void luaF_freeclosure(lua_State*L,Closure*c){
+int size=(c->c.isC)?sizeCclosure(c->c.nupvalues):
+sizeLclosure(c->l.nupvalues);
+luaM_freemem(L,c,size);
+}
+#define MASK1(n,p)((~((~(Instruction)0)<<n))<<p)
+#define MASK0(n,p)(~MASK1(n,p))
+#define GET_OPCODE(i)(cast(OpCode,((i)>>0)&MASK1(6,0)))
+#define SET_OPCODE(i,o)((i)=(((i)&MASK0(6,0))|((cast(Instruction,o)<<0)&MASK1(6,0))))
+#define GETARG_A(i)(cast(int,((i)>>(0+6))&MASK1(8,0)))
+#define SETARG_A(i,u)((i)=(((i)&MASK0(8,(0+6)))|((cast(Instruction,u)<<(0+6))&MASK1(8,(0+6)))))
+#define GETARG_B(i)(cast(int,((i)>>(((0+6)+8)+9))&MASK1(9,0)))
+#define SETARG_B(i,b)((i)=(((i)&MASK0(9,(((0+6)+8)+9)))|((cast(Instruction,b)<<(((0+6)+8)+9))&MASK1(9,(((0+6)+8)+9)))))
+#define GETARG_C(i)(cast(int,((i)>>((0+6)+8))&MASK1(9,0)))
+#define SETARG_C(i,b)((i)=(((i)&MASK0(9,((0+6)+8)))|((cast(Instruction,b)<<((0+6)+8))&MASK1(9,((0+6)+8)))))
+#define GETARG_Bx(i)(cast(int,((i)>>((0+6)+8))&MASK1((9+9),0)))
+#define SETARG_Bx(i,b)((i)=(((i)&MASK0((9+9),((0+6)+8)))|((cast(Instruction,b)<<((0+6)+8))&MASK1((9+9),((0+6)+8)))))
+#define GETARG_sBx(i)(GETARG_Bx(i)-(((1<<(9+9))-1)>>1))
+#define SETARG_sBx(i,b)SETARG_Bx((i),cast(unsigned int,(b)+(((1<<(9+9))-1)>>1)))
+#define CREATE_ABC(o,a,b,c)((cast(Instruction,o)<<0)|(cast(Instruction,a)<<(0+6))|(cast(Instruction,b)<<(((0+6)+8)+9))|(cast(Instruction,c)<<((0+6)+8)))
+#define CREATE_ABx(o,a,bc)((cast(Instruction,o)<<0)|(cast(Instruction,a)<<(0+6))|(cast(Instruction,bc)<<((0+6)+8)))
+#define ISK(x)((x)&(1<<(9-1)))
+#define INDEXK(r)((int)(r)&~(1<<(9-1)))
+#define RKASK(x)((x)|(1<<(9-1)))
+static const lu_byte luaP_opmodes[(cast(int,OP_VARARG)+1)];
+#define getBMode(m)(cast(enum OpArgMask,(luaP_opmodes[m]>>4)&3))
+#define getCMode(m)(cast(enum OpArgMask,(luaP_opmodes[m]>>2)&3))
+#define testTMode(m)(luaP_opmodes[m]&(1<<7))
+typedef struct expdesc{
+expkind k;
+union{
+struct{int info,aux;}s;
+lua_Number nval;
+}u;
+int t;
+int f;
+}expdesc;
+typedef struct upvaldesc{
+lu_byte k;
+lu_byte info;
+}upvaldesc;
+struct BlockCnt;
+typedef struct FuncState{
+Proto*f;
+Table*h;
+struct FuncState*prev;
+struct LexState*ls;
+struct lua_State*L;
+struct BlockCnt*bl;
+int pc;
+int lasttarget;
+int jpc;
+int freereg;
+int nk;
+int np;
+short nlocvars;
+lu_byte nactvar;
+upvaldesc upvalues[60];
+unsigned short actvar[200];
+}FuncState;
+static Proto*luaY_parser(lua_State*L,ZIO*z,Mbuffer*buff,
+const char*name);
+struct lua_longjmp{
+struct lua_longjmp*previous;
+jmp_buf b;
+volatile int status;
+};
+static void luaD_seterrorobj(lua_State*L,int errcode,StkId oldtop){
+switch(errcode){
+case 4:{
+setsvalue(L,oldtop,luaS_newliteral(L,"not enough memory"));
+break;
+}
+case 5:{
+setsvalue(L,oldtop,luaS_newliteral(L,"error in error handling"));
+break;
+}
+case 3:
+case 2:{
+setobj(L,oldtop,L->top-1);
+break;
+}
+}
+L->top=oldtop+1;
+}
+static void restore_stack_limit(lua_State*L){
+if(L->size_ci>20000){
+int inuse=cast_int(L->ci-L->base_ci);
+if(inuse+1<20000)
+luaD_reallocCI(L,20000);
+}
+}
+static void resetstack(lua_State*L,int status){
+L->ci=L->base_ci;
+L->base=L->ci->base;
+luaF_close(L,L->base);
+luaD_seterrorobj(L,status,L->base);
+L->nCcalls=L->baseCcalls;
+L->allowhook=1;
+restore_stack_limit(L);
+L->errfunc=0;
+L->errorJmp=NULL;
+}
+static void luaD_throw(lua_State*L,int errcode){
+if(L->errorJmp){
+L->errorJmp->status=errcode;
+LUAI_THROW(L,L->errorJmp);
+}
+else{
+L->status=cast_byte(errcode);
+if(G(L)->panic){
+resetstack(L,errcode);
+G(L)->panic(L);
+}
+exit(EXIT_FAILURE);
+}
+}
+static int luaD_rawrunprotected(lua_State*L,Pfunc f,void*ud){
+struct lua_longjmp lj;
+lj.status=0;
+lj.previous=L->errorJmp;
+L->errorJmp=&lj;
+LUAI_TRY(L,&lj,
+(*f)(L,ud);
+);
+L->errorJmp=lj.previous;
+return lj.status;
+}
+static void correctstack(lua_State*L,TValue*oldstack){
+CallInfo*ci;
+GCObject*up;
+L->top=(L->top-oldstack)+L->stack;
+for(up=L->openupval;up!=NULL;up=up->gch.next)
+gco2uv(up)->v=(gco2uv(up)->v-oldstack)+L->stack;
+for(ci=L->base_ci;ci<=L->ci;ci++){
+ci->top=(ci->top-oldstack)+L->stack;
+ci->base=(ci->base-oldstack)+L->stack;
+ci->func=(ci->func-oldstack)+L->stack;
+}
+L->base=(L->base-oldstack)+L->stack;
+}
+static void luaD_reallocstack(lua_State*L,int newsize){
+TValue*oldstack=L->stack;
+int realsize=newsize+1+5;
+luaM_reallocvector(L,L->stack,L->stacksize,realsize,TValue);
+L->stacksize=realsize;
+L->stack_last=L->stack+newsize;
+correctstack(L,oldstack);
+}
+static void luaD_reallocCI(lua_State*L,int newsize){
+CallInfo*oldci=L->base_ci;
+luaM_reallocvector(L,L->base_ci,L->size_ci,newsize,CallInfo);
+L->size_ci=newsize;
+L->ci=(L->ci-oldci)+L->base_ci;
+L->end_ci=L->base_ci+L->size_ci-1;
+}
+static void luaD_growstack(lua_State*L,int n){
+if(n<=L->stacksize)
+luaD_reallocstack(L,2*L->stacksize);
+else
+luaD_reallocstack(L,L->stacksize+n);
+}
+static CallInfo*growCI(lua_State*L){
+if(L->size_ci>20000)
+luaD_throw(L,5);
+else{
+luaD_reallocCI(L,2*L->size_ci);
+if(L->size_ci>20000)
+luaG_runerror(L,"stack overflow");
+}
+return++L->ci;
+}
+static StkId adjust_varargs(lua_State*L,Proto*p,int actual){
+int i;
+int nfixargs=p->numparams;
+Table*htab=NULL;
+StkId base,fixed;
+for(;actual<nfixargs;++actual)
+setnilvalue(L->top++);
+fixed=L->top-actual;
+base=L->top;
+for(i=0;i<nfixargs;i++){
+setobj(L,L->top++,fixed+i);
+setnilvalue(fixed+i);
+}
+if(htab){
+sethvalue(L,L->top++,htab);
+}
+return base;
+}
+static StkId tryfuncTM(lua_State*L,StkId func){
+const TValue*tm=luaT_gettmbyobj(L,func,TM_CALL);
+StkId p;
+ptrdiff_t funcr=savestack(L,func);
+if(!ttisfunction(tm))
+luaG_typeerror(L,func,"call");
+for(p=L->top;p>func;p--)setobj(L,p,p-1);
+incr_top(L);
+func=restorestack(L,funcr);
+setobj(L,func,tm);
+return func;
+}
+#define inc_ci(L)((L->ci==L->end_ci)?growCI(L):(condhardstacktests(luaD_reallocCI(L,L->size_ci)),++L->ci))
+static int luaD_precall(lua_State*L,StkId func,int nresults){
+LClosure*cl;
+ptrdiff_t funcr;
+if(!ttisfunction(func))
+func=tryfuncTM(L,func);
+funcr=savestack(L,func);
+cl=&clvalue(func)->l;
+L->ci->savedpc=L->savedpc;
+if(!cl->isC){
+CallInfo*ci;
+StkId st,base;
+Proto*p=cl->p;
+luaD_checkstack(L,p->maxstacksize);
+func=restorestack(L,funcr);
+if(!p->is_vararg){
+base=func+1;
+if(L->top>base+p->numparams)
+L->top=base+p->numparams;
+}
+else{
+int nargs=cast_int(L->top-func)-1;
+base=adjust_varargs(L,p,nargs);
+func=restorestack(L,funcr);
+}
+ci=inc_ci(L);
+ci->func=func;
+L->base=ci->base=base;
+ci->top=L->base+p->maxstacksize;
+L->savedpc=p->code;
+ci->tailcalls=0;
+ci->nresults=nresults;
+for(st=L->top;st<ci->top;st++)
+setnilvalue(st);
+L->top=ci->top;
+return 0;
+}
+else{
+CallInfo*ci;
+int n;
+luaD_checkstack(L,20);
+ci=inc_ci(L);
+ci->func=restorestack(L,funcr);
+L->base=ci->base=ci->func+1;
+ci->top=L->top+20;
+ci->nresults=nresults;
+n=(*curr_func(L)->c.f)(L);
+if(n<0)
+return 2;
+else{
+luaD_poscall(L,L->top-n);
+return 1;
+}
+}
+}
+static int luaD_poscall(lua_State*L,StkId firstResult){
+StkId res;
+int wanted,i;
+CallInfo*ci;
+ci=L->ci--;
+res=ci->func;
+wanted=ci->nresults;
+L->base=(ci-1)->base;
+L->savedpc=(ci-1)->savedpc;
+for(i=wanted;i!=0&&firstResult<L->top;i--)
+setobj(L,res++,firstResult++);
+while(i-->0)
+setnilvalue(res++);
+L->top=res;
+return(wanted-(-1));
+}
+static void luaD_call(lua_State*L,StkId func,int nResults){
+if(++L->nCcalls>=200){
+if(L->nCcalls==200)
+luaG_runerror(L,"C stack overflow");
+else if(L->nCcalls>=(200+(200>>3)))
+luaD_throw(L,5);
+}
+if(luaD_precall(L,func,nResults)==0)
+luaV_execute(L,1);
+L->nCcalls--;
+luaC_checkGC(L);
+}
+static int luaD_pcall(lua_State*L,Pfunc func,void*u,
+ptrdiff_t old_top,ptrdiff_t ef){
+int status;
+unsigned short oldnCcalls=L->nCcalls;
+ptrdiff_t old_ci=saveci(L,L->ci);
+lu_byte old_allowhooks=L->allowhook;
+ptrdiff_t old_errfunc=L->errfunc;
+L->errfunc=ef;
+status=luaD_rawrunprotected(L,func,u);
+if(status!=0){
+StkId oldtop=restorestack(L,old_top);
+luaF_close(L,oldtop);
+luaD_seterrorobj(L,status,oldtop);
+L->nCcalls=oldnCcalls;
+L->ci=restoreci(L,old_ci);
+L->base=L->ci->base;
+L->savedpc=L->ci->savedpc;
+L->allowhook=old_allowhooks;
+restore_stack_limit(L);
+}
+L->errfunc=old_errfunc;
+return status;
+}
+struct SParser{
+ZIO*z;
+Mbuffer buff;
+const char*name;
+};
+static void f_parser(lua_State*L,void*ud){
+int i;
+Proto*tf;
+Closure*cl;
+struct SParser*p=cast(struct SParser*,ud);
+luaC_checkGC(L);
+tf=luaY_parser(L,p->z,
+&p->buff,p->name);
+cl=luaF_newLclosure(L,tf->nups,hvalue(gt(L)));
+cl->l.p=tf;
+for(i=0;i<tf->nups;i++)
+cl->l.upvals[i]=luaF_newupval(L);
+setclvalue(L,L->top,cl);
+incr_top(L);
+}
+static int luaD_protectedparser(lua_State*L,ZIO*z,const char*name){
+struct SParser p;
+int status;
+p.z=z;p.name=name;
+luaZ_initbuffer(L,&p.buff);
+status=luaD_pcall(L,f_parser,&p,savestack(L,L->top),L->errfunc);
+luaZ_freebuffer(L,&p.buff);
+return status;
+}
+static void luaS_resize(lua_State*L,int newsize){
+GCObject**newhash;
+stringtable*tb;
+int i;
+if(G(L)->gcstate==2)
+return;
+newhash=luaM_newvector(L,newsize,GCObject*);
+tb=&G(L)->strt;
+for(i=0;i<newsize;i++)newhash[i]=NULL;
+for(i=0;i<tb->size;i++){
+GCObject*p=tb->hash[i];
+while(p){
+GCObject*next=p->gch.next;
+unsigned int h=gco2ts(p)->hash;
+int h1=lmod(h,newsize);
+p->gch.next=newhash[h1];
+newhash[h1]=p;
+p=next;
+}
+}
+luaM_freearray(L,tb->hash,tb->size,TString*);
+tb->size=newsize;
+tb->hash=newhash;
+}
+static TString*newlstr(lua_State*L,const char*str,size_t l,
+unsigned int h){
+TString*ts;
+stringtable*tb;
+if(l+1>(((size_t)(~(size_t)0)-2)-sizeof(TString))/sizeof(char))
+luaM_toobig(L);
+ts=cast(TString*,luaM_malloc(L,(l+1)*sizeof(char)+sizeof(TString)));
+ts->tsv.len=l;
+ts->tsv.hash=h;
+ts->tsv.marked=luaC_white(G(L));
+ts->tsv.tt=4;
+ts->tsv.reserved=0;
+memcpy(ts+1,str,l*sizeof(char));
+((char*)(ts+1))[l]='\0';
+tb=&G(L)->strt;
+h=lmod(h,tb->size);
+ts->tsv.next=tb->hash[h];
+tb->hash[h]=obj2gco(ts);
+tb->nuse++;
+if(tb->nuse>cast(lu_int32,tb->size)&&tb->size<=(INT_MAX-2)/2)
+luaS_resize(L,tb->size*2);
+return ts;
+}
+static TString*luaS_newlstr(lua_State*L,const char*str,size_t l){
+GCObject*o;
+unsigned int h=cast(unsigned int,l);
+size_t step=(l>>5)+1;
+size_t l1;
+for(l1=l;l1>=step;l1-=step)
+h=h^((h<<5)+(h>>2)+cast(unsigned char,str[l1-1]));
+for(o=G(L)->strt.hash[lmod(h,G(L)->strt.size)];
+o!=NULL;
+o=o->gch.next){
+TString*ts=rawgco2ts(o);
+if(ts->tsv.len==l&&(memcmp(str,getstr(ts),l)==0)){
+if(isdead(G(L),o))changewhite(o);
+return ts;
+}
+}
+return newlstr(L,str,l,h);
+}
+static Udata*luaS_newudata(lua_State*L,size_t s,Table*e){
+Udata*u;
+if(s>((size_t)(~(size_t)0)-2)-sizeof(Udata))
+luaM_toobig(L);
+u=cast(Udata*,luaM_malloc(L,s+sizeof(Udata)));
+u->uv.marked=luaC_white(G(L));
+u->uv.tt=7;
+u->uv.len=s;
+u->uv.metatable=NULL;
+u->uv.env=e;
+u->uv.next=G(L)->mainthread->next;
+G(L)->mainthread->next=obj2gco(u);
+return u;
+}
+#define hashpow2(t,n)(gnode(t,lmod((n),sizenode(t))))
+#define hashstr(t,str)hashpow2(t,(str)->tsv.hash)
+#define hashboolean(t,p)hashpow2(t,p)
+#define hashmod(t,n)(gnode(t,((n)%((sizenode(t)-1)|1))))
+#define hashpointer(t,p)hashmod(t,IntPoint(p))
+static const Node dummynode_={
+{{NULL},0},
+{{{NULL},0,NULL}}
+};
+static Node*hashnum(const Table*t,lua_Number n){
+unsigned int a[cast_int(sizeof(lua_Number)/sizeof(int))];
+int i;
+if(luai_numeq(n,0))
+return gnode(t,0);
+memcpy(a,&n,sizeof(a));
+for(i=1;i<cast_int(sizeof(lua_Number)/sizeof(int));i++)a[0]+=a[i];
+return hashmod(t,a[0]);
+}
+static Node*mainposition(const Table*t,const TValue*key){
+switch(ttype(key)){
+case 3:
+return hashnum(t,nvalue(key));
+case 4:
+return hashstr(t,rawtsvalue(key));
+case 1:
+return hashboolean(t,bvalue(key));
+case 2:
+return hashpointer(t,pvalue(key));
+default:
+return hashpointer(t,gcvalue(key));
+}
+}
+static int arrayindex(const TValue*key){
+if(ttisnumber(key)){
+lua_Number n=nvalue(key);
+int k;
+lua_number2int(k,n);
+if(luai_numeq(cast_num(k),n))
+return k;
+}
+return-1;
+}
+static int findindex(lua_State*L,Table*t,StkId key){
+int i;
+if(ttisnil(key))return-1;
+i=arrayindex(key);
+if(0<i&&i<=t->sizearray)
+return i-1;
+else{
+Node*n=mainposition(t,key);
+do{
+if(luaO_rawequalObj(key2tval(n),key)||
+(ttype(gkey(n))==(8+3)&&iscollectable(key)&&
+gcvalue(gkey(n))==gcvalue(key))){
+i=cast_int(n-gnode(t,0));
+return i+t->sizearray;
+}
+else n=gnext(n);
+}while(n);
+luaG_runerror(L,"invalid key to "LUA_QL("next"));
+return 0;
+}
+}
+static int luaH_next(lua_State*L,Table*t,StkId key){
+int i=findindex(L,t,key);
+for(i++;i<t->sizearray;i++){
+if(!ttisnil(&t->array[i])){
+setnvalue(key,cast_num(i+1));
+setobj(L,key+1,&t->array[i]);
+return 1;
+}
+}
+for(i-=t->sizearray;i<(int)sizenode(t);i++){
+if(!ttisnil(gval(gnode(t,i)))){
+setobj(L,key,key2tval(gnode(t,i)));
+setobj(L,key+1,gval(gnode(t,i)));
+return 1;
+}
+}
+return 0;
+}
+static int computesizes(int nums[],int*narray){
+int i;
+int twotoi;
+int a=0;
+int na=0;
+int n=0;
+for(i=0,twotoi=1;twotoi/2<*narray;i++,twotoi*=2){
+if(nums[i]>0){
+a+=nums[i];
+if(a>twotoi/2){
+n=twotoi;
+na=a;
+}
+}
+if(a==*narray)break;
+}
+*narray=n;
+return na;
+}
+static int countint(const TValue*key,int*nums){
+int k=arrayindex(key);
+if(0<k&&k<=(1<<(32-2))){
+nums[ceillog2(k)]++;
+return 1;
+}
+else
+return 0;
+}
+static int numusearray(const Table*t,int*nums){
+int lg;
+int ttlg;
+int ause=0;
+int i=1;
+for(lg=0,ttlg=1;lg<=(32-2);lg++,ttlg*=2){
+int lc=0;
+int lim=ttlg;
+if(lim>t->sizearray){
+lim=t->sizearray;
+if(i>lim)
+break;
+}
+for(;i<=lim;i++){
+if(!ttisnil(&t->array[i-1]))
+lc++;
+}
+nums[lg]+=lc;
+ause+=lc;
+}
+return ause;
+}
+static int numusehash(const Table*t,int*nums,int*pnasize){
+int totaluse=0;
+int ause=0;
+int i=sizenode(t);
+while(i--){
+Node*n=&t->node[i];
+if(!ttisnil(gval(n))){
+ause+=countint(key2tval(n),nums);
+totaluse++;
+}
+}
+*pnasize+=ause;
+return totaluse;
+}
+static void setarrayvector(lua_State*L,Table*t,int size){
+int i;
+luaM_reallocvector(L,t->array,t->sizearray,size,TValue);
+for(i=t->sizearray;i<size;i++)
+setnilvalue(&t->array[i]);
+t->sizearray=size;
+}
+static void setnodevector(lua_State*L,Table*t,int size){
+int lsize;
+if(size==0){
+t->node=cast(Node*,(&dummynode_));
+lsize=0;
+}
+else{
+int i;
+lsize=ceillog2(size);
+if(lsize>(32-2))
+luaG_runerror(L,"table overflow");
+size=twoto(lsize);
+t->node=luaM_newvector(L,size,Node);
+for(i=0;i<size;i++){
+Node*n=gnode(t,i);
+gnext(n)=NULL;
+setnilvalue(gkey(n));
+setnilvalue(gval(n));
+}
+}
+t->lsizenode=cast_byte(lsize);
+t->lastfree=gnode(t,size);
+}
+static void resize(lua_State*L,Table*t,int nasize,int nhsize){
+int i;
+int oldasize=t->sizearray;
+int oldhsize=t->lsizenode;
+Node*nold=t->node;
+if(nasize>oldasize)
+setarrayvector(L,t,nasize);
+setnodevector(L,t,nhsize);
+if(nasize<oldasize){
+t->sizearray=nasize;
+for(i=nasize;i<oldasize;i++){
+if(!ttisnil(&t->array[i]))
+setobj(L,luaH_setnum(L,t,i+1),&t->array[i]);
+}
+luaM_reallocvector(L,t->array,oldasize,nasize,TValue);
+}
+for(i=twoto(oldhsize)-1;i>=0;i--){
+Node*old=nold+i;
+if(!ttisnil(gval(old)))
+setobj(L,luaH_set(L,t,key2tval(old)),gval(old));
+}
+if(nold!=(&dummynode_))
+luaM_freearray(L,nold,twoto(oldhsize),Node);
+}
+static void luaH_resizearray(lua_State*L,Table*t,int nasize){
+int nsize=(t->node==(&dummynode_))?0:sizenode(t);
+resize(L,t,nasize,nsize);
+}
+static void rehash(lua_State*L,Table*t,const TValue*ek){
+int nasize,na;
+int nums[(32-2)+1];
+int i;
+int totaluse;
+for(i=0;i<=(32-2);i++)nums[i]=0;
+nasize=numusearray(t,nums);
+totaluse=nasize;
+totaluse+=numusehash(t,nums,&nasize);
+nasize+=countint(ek,nums);
+totaluse++;
+na=computesizes(nums,&nasize);
+resize(L,t,nasize,totaluse-na);
+}
+static Table*luaH_new(lua_State*L,int narray,int nhash){
+Table*t=luaM_new(L,Table);
+luaC_link(L,obj2gco(t),5);
+t->metatable=NULL;
+t->flags=cast_byte(~0);
+t->array=NULL;
+t->sizearray=0;
+t->lsizenode=0;
+t->node=cast(Node*,(&dummynode_));
+setarrayvector(L,t,narray);
+setnodevector(L,t,nhash);
+return t;
+}
+static void luaH_free(lua_State*L,Table*t){
+if(t->node!=(&dummynode_))
+luaM_freearray(L,t->node,sizenode(t),Node);
+luaM_freearray(L,t->array,t->sizearray,TValue);
+luaM_free(L,t);
+}
+static Node*getfreepos(Table*t){
+while(t->lastfree-->t->node){
+if(ttisnil(gkey(t->lastfree)))
+return t->lastfree;
+}
+return NULL;
+}
+static TValue*newkey(lua_State*L,Table*t,const TValue*key){
+Node*mp=mainposition(t,key);
+if(!ttisnil(gval(mp))||mp==(&dummynode_)){
+Node*othern;
+Node*n=getfreepos(t);
+if(n==NULL){
+rehash(L,t,key);
+return luaH_set(L,t,key);
+}
+othern=mainposition(t,key2tval(mp));
+if(othern!=mp){
+while(gnext(othern)!=mp)othern=gnext(othern);
+gnext(othern)=n;
+*n=*mp;
+gnext(mp)=NULL;
+setnilvalue(gval(mp));
+}
+else{
+gnext(n)=gnext(mp);
+gnext(mp)=n;
+mp=n;
+}
+}
+gkey(mp)->value=key->value;gkey(mp)->tt=key->tt;
+luaC_barriert(L,t,key);
+return gval(mp);
+}
+static const TValue*luaH_getnum(Table*t,int key){
+if(cast(unsigned int,key)-1<cast(unsigned int,t->sizearray))
+return&t->array[key-1];
+else{
+lua_Number nk=cast_num(key);
+Node*n=hashnum(t,nk);
+do{
+if(ttisnumber(gkey(n))&&luai_numeq(nvalue(gkey(n)),nk))
+return gval(n);
+else n=gnext(n);
+}while(n);
+return(&luaO_nilobject_);
+}
+}
+static const TValue*luaH_getstr(Table*t,TString*key){
+Node*n=hashstr(t,key);
+do{
+if(ttisstring(gkey(n))&&rawtsvalue(gkey(n))==key)
+return gval(n);
+else n=gnext(n);
+}while(n);
+return(&luaO_nilobject_);
+}
+static const TValue*luaH_get(Table*t,const TValue*key){
+switch(ttype(key)){
+case 0:return(&luaO_nilobject_);
+case 4:return luaH_getstr(t,rawtsvalue(key));
+case 3:{
+int k;
+lua_Number n=nvalue(key);
+lua_number2int(k,n);
+if(luai_numeq(cast_num(k),nvalue(key)))
+return luaH_getnum(t,k);
+}
+default:{
+Node*n=mainposition(t,key);
+do{
+if(luaO_rawequalObj(key2tval(n),key))
+return gval(n);
+else n=gnext(n);
+}while(n);
+return(&luaO_nilobject_);
+}
+}
+}
+static TValue*luaH_set(lua_State*L,Table*t,const TValue*key){
+const TValue*p=luaH_get(t,key);
+t->flags=0;
+if(p!=(&luaO_nilobject_))
+return cast(TValue*,p);
+else{
+if(ttisnil(key))luaG_runerror(L,"table index is nil");
+else if(ttisnumber(key)&&luai_numisnan(nvalue(key)))
+luaG_runerror(L,"table index is NaN");
+return newkey(L,t,key);
+}
+}
+static TValue*luaH_setnum(lua_State*L,Table*t,int key){
+const TValue*p=luaH_getnum(t,key);
+if(p!=(&luaO_nilobject_))
+return cast(TValue*,p);
+else{
+TValue k;
+setnvalue(&k,cast_num(key));
+return newkey(L,t,&k);
+}
+}
+static TValue*luaH_setstr(lua_State*L,Table*t,TString*key){
+const TValue*p=luaH_getstr(t,key);
+if(p!=(&luaO_nilobject_))
+return cast(TValue*,p);
+else{
+TValue k;
+setsvalue(L,&k,key);
+return newkey(L,t,&k);
+}
+}
+static int unbound_search(Table*t,unsigned int j){
+unsigned int i=j;
+j++;
+while(!ttisnil(luaH_getnum(t,j))){
+i=j;
+j*=2;
+if(j>cast(unsigned int,(INT_MAX-2))){
+i=1;
+while(!ttisnil(luaH_getnum(t,i)))i++;
+return i-1;
+}
+}
+while(j-i>1){
+unsigned int m=(i+j)/2;
+if(ttisnil(luaH_getnum(t,m)))j=m;
+else i=m;
+}
+return i;
+}
+static int luaH_getn(Table*t){
+unsigned int j=t->sizearray;
+if(j>0&&ttisnil(&t->array[j-1])){
+unsigned int i=0;
+while(j-i>1){
+unsigned int m=(i+j)/2;
+if(ttisnil(&t->array[m-1]))j=m;
+else i=m;
+}
+return i;
+}
+else if(t->node==(&dummynode_))
+return j;
+else return unbound_search(t,j);
+}
+#define makewhite(g,x)((x)->gch.marked=cast_byte(((x)->gch.marked&cast_byte(~(bitmask(2)|bit2mask(0,1))))|luaC_white(g)))
+#define white2gray(x)reset2bits((x)->gch.marked,0,1)
+#define black2gray(x)resetbit((x)->gch.marked,2)
+#define stringmark(s)reset2bits((s)->tsv.marked,0,1)
+#define isfinalized(u)testbit((u)->marked,3)
+#define markfinalized(u)l_setbit((u)->marked,3)
+#define markvalue(g,o){checkconsistency(o);if(iscollectable(o)&&iswhite(gcvalue(o)))reallymarkobject(g,gcvalue(o));}
+#define markobject(g,t){if(iswhite(obj2gco(t)))reallymarkobject(g,obj2gco(t));}
+#define setthreshold(g)(g->GCthreshold=(g->estimate/100)*g->gcpause)
+static void removeentry(Node*n){
+if(iscollectable(gkey(n)))
+setttype(gkey(n),(8+3));
+}
+static void reallymarkobject(global_State*g,GCObject*o){
+white2gray(o);
+switch(o->gch.tt){
+case 4:{
+return;
+}
+case 7:{
+Table*mt=gco2u(o)->metatable;
+gray2black(o);
+if(mt)markobject(g,mt);
+markobject(g,gco2u(o)->env);
+return;
+}
+case(8+2):{
+UpVal*uv=gco2uv(o);
+markvalue(g,uv->v);
+if(uv->v==&uv->u.value)
+gray2black(o);
+return;
+}
+case 6:{
+gco2cl(o)->c.gclist=g->gray;
+g->gray=o;
+break;
+}
+case 5:{
+gco2h(o)->gclist=g->gray;
+g->gray=o;
+break;
+}
+case 8:{
+gco2th(o)->gclist=g->gray;
+g->gray=o;
+break;
+}
+case(8+1):{
+gco2p(o)->gclist=g->gray;
+g->gray=o;
+break;
+}
+default:;
+}
+}
+static void marktmu(global_State*g){
+GCObject*u=g->tmudata;
+if(u){
+do{
+u=u->gch.next;
+makewhite(g,u);
+reallymarkobject(g,u);
+}while(u!=g->tmudata);
+}
+}
+static size_t luaC_separateudata(lua_State*L,int all){
+global_State*g=G(L);
+size_t deadmem=0;
+GCObject**p=&g->mainthread->next;
+GCObject*curr;
+while((curr=*p)!=NULL){
+if(!(iswhite(curr)||all)||isfinalized(gco2u(curr)))
+p=&curr->gch.next;
+else if(fasttm(L,gco2u(curr)->metatable,TM_GC)==NULL){
+markfinalized(gco2u(curr));
+p=&curr->gch.next;
+}
+else{
+deadmem+=sizeudata(gco2u(curr));
+markfinalized(gco2u(curr));
+*p=curr->gch.next;
+if(g->tmudata==NULL)
+g->tmudata=curr->gch.next=curr;
+else{
+curr->gch.next=g->tmudata->gch.next;
+g->tmudata->gch.next=curr;
+g->tmudata=curr;
+}
+}
+}
+return deadmem;
+}
+static int traversetable(global_State*g,Table*h){
+int i;
+int weakkey=0;
+int weakvalue=0;
+const TValue*mode;
+if(h->metatable)
+markobject(g,h->metatable);
+mode=gfasttm(g,h->metatable,TM_MODE);
+if(mode&&ttisstring(mode)){
+weakkey=(strchr(svalue(mode),'k')!=NULL);
+weakvalue=(strchr(svalue(mode),'v')!=NULL);
+if(weakkey||weakvalue){
+h->marked&=~(bitmask(3)|bitmask(4));
+h->marked|=cast_byte((weakkey<<3)|
+(weakvalue<<4));
+h->gclist=g->weak;
+g->weak=obj2gco(h);
+}
+}
+if(weakkey&&weakvalue)return 1;
+if(!weakvalue){
+i=h->sizearray;
+while(i--)
+markvalue(g,&h->array[i]);
+}
+i=sizenode(h);
+while(i--){
+Node*n=gnode(h,i);
+if(ttisnil(gval(n)))
+removeentry(n);
+else{
+if(!weakkey)markvalue(g,gkey(n));
+if(!weakvalue)markvalue(g,gval(n));
+}
+}
+return weakkey||weakvalue;
+}
+static void traverseproto(global_State*g,Proto*f){
+int i;
+if(f->source)stringmark(f->source);
+for(i=0;i<f->sizek;i++)
+markvalue(g,&f->k[i]);
+for(i=0;i<f->sizeupvalues;i++){
+if(f->upvalues[i])
+stringmark(f->upvalues[i]);
+}
+for(i=0;i<f->sizep;i++){
+if(f->p[i])
+markobject(g,f->p[i]);
+}
+for(i=0;i<f->sizelocvars;i++){
+if(f->locvars[i].varname)
+stringmark(f->locvars[i].varname);
+}
+}
+static void traverseclosure(global_State*g,Closure*cl){
+markobject(g,cl->c.env);
+if(cl->c.isC){
+int i;
+for(i=0;i<cl->c.nupvalues;i++)
+markvalue(g,&cl->c.upvalue[i]);
+}
+else{
+int i;
+markobject(g,cl->l.p);
+for(i=0;i<cl->l.nupvalues;i++)
+markobject(g,cl->l.upvals[i]);
+}
+}
+static void checkstacksizes(lua_State*L,StkId max){
+int ci_used=cast_int(L->ci-L->base_ci);
+int s_used=cast_int(max-L->stack);
+if(L->size_ci>20000)
+return;
+if(4*ci_used<L->size_ci&&2*8<L->size_ci)
+luaD_reallocCI(L,L->size_ci/2);
+condhardstacktests(luaD_reallocCI(L,ci_used+1));
+if(4*s_used<L->stacksize&&
+2*((2*20)+5)<L->stacksize)
+luaD_reallocstack(L,L->stacksize/2);
+condhardstacktests(luaD_reallocstack(L,s_used));
+}
+static void traversestack(global_State*g,lua_State*l){
+StkId o,lim;
+CallInfo*ci;
+markvalue(g,gt(l));
+lim=l->top;
+for(ci=l->base_ci;ci<=l->ci;ci++){
+if(lim<ci->top)lim=ci->top;
+}
+for(o=l->stack;o<l->top;o++)
+markvalue(g,o);
+for(;o<=lim;o++)
+setnilvalue(o);
+checkstacksizes(l,lim);
+}
+static l_mem propagatemark(global_State*g){
+GCObject*o=g->gray;
+gray2black(o);
+switch(o->gch.tt){
+case 5:{
+Table*h=gco2h(o);
+g->gray=h->gclist;
+if(traversetable(g,h))
+black2gray(o);
+return sizeof(Table)+sizeof(TValue)*h->sizearray+
+sizeof(Node)*sizenode(h);
+}
+case 6:{
+Closure*cl=gco2cl(o);
+g->gray=cl->c.gclist;
+traverseclosure(g,cl);
+return(cl->c.isC)?sizeCclosure(cl->c.nupvalues):
+sizeLclosure(cl->l.nupvalues);
+}
+case 8:{
+lua_State*th=gco2th(o);
+g->gray=th->gclist;
+th->gclist=g->grayagain;
+g->grayagain=o;
+black2gray(o);
+traversestack(g,th);
+return sizeof(lua_State)+sizeof(TValue)*th->stacksize+
+sizeof(CallInfo)*th->size_ci;
+}
+case(8+1):{
+Proto*p=gco2p(o);
+g->gray=p->gclist;
+traverseproto(g,p);
+return sizeof(Proto)+sizeof(Instruction)*p->sizecode+
+sizeof(Proto*)*p->sizep+
+sizeof(TValue)*p->sizek+
+sizeof(int)*p->sizelineinfo+
+sizeof(LocVar)*p->sizelocvars+
+sizeof(TString*)*p->sizeupvalues;
+}
+default:return 0;
+}
+}
+static size_t propagateall(global_State*g){
+size_t m=0;
+while(g->gray)m+=propagatemark(g);
+return m;
+}
+static int iscleared(const TValue*o,int iskey){
+if(!iscollectable(o))return 0;
+if(ttisstring(o)){
+stringmark(rawtsvalue(o));
+return 0;
+}
+return iswhite(gcvalue(o))||
+(ttisuserdata(o)&&(!iskey&&isfinalized(uvalue(o))));
+}
+static void cleartable(GCObject*l){
+while(l){
+Table*h=gco2h(l);
+int i=h->sizearray;
+if(testbit(h->marked,4)){
+while(i--){
+TValue*o=&h->array[i];
+if(iscleared(o,0))
+setnilvalue(o);
+}
+}
+i=sizenode(h);
+while(i--){
+Node*n=gnode(h,i);
+if(!ttisnil(gval(n))&&
+(iscleared(key2tval(n),1)||iscleared(gval(n),0))){
+setnilvalue(gval(n));
+removeentry(n);
+}
+}
+l=h->gclist;
+}
+}
+static void freeobj(lua_State*L,GCObject*o){
+switch(o->gch.tt){
+case(8+1):luaF_freeproto(L,gco2p(o));break;
+case 6:luaF_freeclosure(L,gco2cl(o));break;
+case(8+2):luaF_freeupval(L,gco2uv(o));break;
+case 5:luaH_free(L,gco2h(o));break;
+case 8:{
+luaE_freethread(L,gco2th(o));
+break;
+}
+case 4:{
+G(L)->strt.nuse--;
+luaM_freemem(L,o,sizestring(gco2ts(o)));
+break;
+}
+case 7:{
+luaM_freemem(L,o,sizeudata(gco2u(o)));
+break;
+}
+default:;
+}
+}
+#define sweepwholelist(L,p)sweeplist(L,p,((lu_mem)(~(lu_mem)0)-2))
+static GCObject**sweeplist(lua_State*L,GCObject**p,lu_mem count){
+GCObject*curr;
+global_State*g=G(L);
+int deadmask=otherwhite(g);
+while((curr=*p)!=NULL&&count-->0){
+if(curr->gch.tt==8)
+sweepwholelist(L,&gco2th(curr)->openupval);
+if((curr->gch.marked^bit2mask(0,1))&deadmask){
+makewhite(g,curr);
+p=&curr->gch.next;
+}
+else{
+*p=curr->gch.next;
+if(curr==g->rootgc)
+g->rootgc=curr->gch.next;
+freeobj(L,curr);
+}
+}
+return p;
+}
+static void checkSizes(lua_State*L){
+global_State*g=G(L);
+if(g->strt.nuse<cast(lu_int32,g->strt.size/4)&&
+g->strt.size>32*2)
+luaS_resize(L,g->strt.size/2);
+if(luaZ_sizebuffer(&g->buff)>32*2){
+size_t newsize=luaZ_sizebuffer(&g->buff)/2;
+luaZ_resizebuffer(L,&g->buff,newsize);
+}
+}
+static void GCTM(lua_State*L){
+global_State*g=G(L);
+GCObject*o=g->tmudata->gch.next;
+Udata*udata=rawgco2u(o);
+const TValue*tm;
+if(o==g->tmudata)
+g->tmudata=NULL;
+else
+g->tmudata->gch.next=udata->uv.next;
+udata->uv.next=g->mainthread->next;
+g->mainthread->next=o;
+makewhite(g,o);
+tm=fasttm(L,udata->uv.metatable,TM_GC);
+if(tm!=NULL){
+lu_byte oldah=L->allowhook;
+lu_mem oldt=g->GCthreshold;
+L->allowhook=0;
+g->GCthreshold=2*g->totalbytes;
+setobj(L,L->top,tm);
+setuvalue(L,L->top+1,udata);
+L->top+=2;
+luaD_call(L,L->top-2,0);
+L->allowhook=oldah;
+g->GCthreshold=oldt;
+}
+}
+static void luaC_callGCTM(lua_State*L){
+while(G(L)->tmudata)
+GCTM(L);
+}
+static void luaC_freeall(lua_State*L){
+global_State*g=G(L);
+int i;
+g->currentwhite=bit2mask(0,1)|bitmask(6);
+sweepwholelist(L,&g->rootgc);
+for(i=0;i<g->strt.size;i++)
+sweepwholelist(L,&g->strt.hash[i]);
+}
+static void markmt(global_State*g){
+int i;
+for(i=0;i<(8+1);i++)
+if(g->mt[i])markobject(g,g->mt[i]);
+}
+static void markroot(lua_State*L){
+global_State*g=G(L);
+g->gray=NULL;
+g->grayagain=NULL;
+g->weak=NULL;
+markobject(g,g->mainthread);
+markvalue(g,gt(g->mainthread));
+markvalue(g,registry(L));
+markmt(g);
+g->gcstate=1;
+}
+static void remarkupvals(global_State*g){
+UpVal*uv;
+for(uv=g->uvhead.u.l.next;uv!=&g->uvhead;uv=uv->u.l.next){
+if(isgray(obj2gco(uv)))
+markvalue(g,uv->v);
+}
+}
+static void atomic(lua_State*L){
+global_State*g=G(L);
+size_t udsize;
+remarkupvals(g);
+propagateall(g);
+g->gray=g->weak;
+g->weak=NULL;
+markobject(g,L);
+markmt(g);
+propagateall(g);
+g->gray=g->grayagain;
+g->grayagain=NULL;
+propagateall(g);
+udsize=luaC_separateudata(L,0);
+marktmu(g);
+udsize+=propagateall(g);
+cleartable(g->weak);
+g->currentwhite=cast_byte(otherwhite(g));
+g->sweepstrgc=0;
+g->sweepgc=&g->rootgc;
+g->gcstate=2;
+g->estimate=g->totalbytes-udsize;
+}
+static l_mem singlestep(lua_State*L){
+global_State*g=G(L);
+switch(g->gcstate){
+case 0:{
+markroot(L);
+return 0;
+}
+case 1:{
+if(g->gray)
+return propagatemark(g);
+else{
+atomic(L);
+return 0;
+}
+}
+case 2:{
+lu_mem old=g->totalbytes;
+sweepwholelist(L,&g->strt.hash[g->sweepstrgc++]);
+if(g->sweepstrgc>=g->strt.size)
+g->gcstate=3;
+g->estimate-=old-g->totalbytes;
+return 10;
+}
+case 3:{
+lu_mem old=g->totalbytes;
+g->sweepgc=sweeplist(L,g->sweepgc,40);
+if(*g->sweepgc==NULL){
+checkSizes(L);
+g->gcstate=4;
+}
+g->estimate-=old-g->totalbytes;
+return 40*10;
+}
+case 4:{
+if(g->tmudata){
+GCTM(L);
+if(g->estimate>100)
+g->estimate-=100;
+return 100;
+}
+else{
+g->gcstate=0;
+g->gcdept=0;
+return 0;
+}
+}
+default:return 0;
+}
+}
+static void luaC_step(lua_State*L){
+global_State*g=G(L);
+l_mem lim=(1024u/100)*g->gcstepmul;
+if(lim==0)
+lim=(((lu_mem)(~(lu_mem)0)-2)-1)/2;
+g->gcdept+=g->totalbytes-g->GCthreshold;
+do{
+lim-=singlestep(L);
+if(g->gcstate==0)
+break;
+}while(lim>0);
+if(g->gcstate!=0){
+if(g->gcdept<1024u)
+g->GCthreshold=g->totalbytes+1024u;
+else{
+g->gcdept-=1024u;
+g->GCthreshold=g->totalbytes;
+}
+}
+else{
+setthreshold(g);
+}
+}
+static void luaC_barrierf(lua_State*L,GCObject*o,GCObject*v){
+global_State*g=G(L);
+if(g->gcstate==1)
+reallymarkobject(g,v);
+else
+makewhite(g,o);
+}
+static void luaC_barrierback(lua_State*L,Table*t){
+global_State*g=G(L);
+GCObject*o=obj2gco(t);
+black2gray(o);
+t->gclist=g->grayagain;
+g->grayagain=o;
+}
+static void luaC_link(lua_State*L,GCObject*o,lu_byte tt){
+global_State*g=G(L);
+o->gch.next=g->rootgc;
+g->rootgc=o;
+o->gch.marked=luaC_white(g);
+o->gch.tt=tt;
+}
+static void luaC_linkupval(lua_State*L,UpVal*uv){
+global_State*g=G(L);
+GCObject*o=obj2gco(uv);
+o->gch.next=g->rootgc;
+g->rootgc=o;
+if(isgray(o)){
+if(g->gcstate==1){
+gray2black(o);
+luaC_barrier(L,uv,uv->v);
+}
+else{
+makewhite(g,o);
+}
+}
+}
+typedef union{
+lua_Number r;
+TString*ts;
+}SemInfo;
+typedef struct Token{
+int token;
+SemInfo seminfo;
+}Token;
+typedef struct LexState{
+int current;
+int linenumber;
+int lastline;
+Token t;
+Token lookahead;
+struct FuncState*fs;
+struct lua_State*L;
+ZIO*z;
+Mbuffer*buff;
+TString*source;
+char decpoint;
+}LexState;
+static void luaX_init(lua_State*L);
+static void luaX_lexerror(LexState*ls,const char*msg,int token);
+#define state_size(x)(sizeof(x)+0)
+#define fromstate(l)(cast(lu_byte*,(l))-0)
+#define tostate(l)(cast(lua_State*,cast(lu_byte*,l)+0))
+typedef struct LG{
+lua_State l;
+global_State g;
+}LG;
+static void stack_init(lua_State*L1,lua_State*L){
+L1->base_ci=luaM_newvector(L,8,CallInfo);
+L1->ci=L1->base_ci;
+L1->size_ci=8;
+L1->end_ci=L1->base_ci+L1->size_ci-1;
+L1->stack=luaM_newvector(L,(2*20)+5,TValue);
+L1->stacksize=(2*20)+5;
+L1->top=L1->stack;
+L1->stack_last=L1->stack+(L1->stacksize-5)-1;
+L1->ci->func=L1->top;
+setnilvalue(L1->top++);
+L1->base=L1->ci->base=L1->top;
+L1->ci->top=L1->top+20;
+}
+static void freestack(lua_State*L,lua_State*L1){
+luaM_freearray(L,L1->base_ci,L1->size_ci,CallInfo);
+luaM_freearray(L,L1->stack,L1->stacksize,TValue);
+}
+static void f_luaopen(lua_State*L,void*ud){
+global_State*g=G(L);
+UNUSED(ud);
+stack_init(L,L);
+sethvalue(L,gt(L),luaH_new(L,0,2));
+sethvalue(L,registry(L),luaH_new(L,0,2));
+luaS_resize(L,32);
+luaT_init(L);
+luaX_init(L);
+luaS_fix(luaS_newliteral(L,"not enough memory"));
+g->GCthreshold=4*g->totalbytes;
+}
+static void preinit_state(lua_State*L,global_State*g){
+G(L)=g;
+L->stack=NULL;
+L->stacksize=0;
+L->errorJmp=NULL;
+L->hook=NULL;
+L->hookmask=0;
+L->basehookcount=0;
+L->allowhook=1;
+resethookcount(L);
+L->openupval=NULL;
+L->size_ci=0;
+L->nCcalls=L->baseCcalls=0;
+L->status=0;
+L->base_ci=L->ci=NULL;
+L->savedpc=NULL;
+L->errfunc=0;
+setnilvalue(gt(L));
+}
+static void close_state(lua_State*L){
+global_State*g=G(L);
+luaF_close(L,L->stack);
+luaC_freeall(L);
+luaM_freearray(L,G(L)->strt.hash,G(L)->strt.size,TString*);
+luaZ_freebuffer(L,&g->buff);
+freestack(L,L);
+(*g->frealloc)(g->ud,fromstate(L),state_size(LG),0);
+}
+static void luaE_freethread(lua_State*L,lua_State*L1){
+luaF_close(L1,L1->stack);
+freestack(L,L1);
+luaM_freemem(L,fromstate(L1),state_size(lua_State));
+}
+static lua_State*lua_newstate(lua_Alloc f,void*ud){
+int i;
+lua_State*L;
+global_State*g;
+void*l=(*f)(ud,NULL,0,state_size(LG));
+if(l==NULL)return NULL;
+L=tostate(l);
+g=&((LG*)L)->g;
+L->next=NULL;
+L->tt=8;
+g->currentwhite=bit2mask(0,5);
+L->marked=luaC_white(g);
+set2bits(L->marked,5,6);
+preinit_state(L,g);
+g->frealloc=f;
+g->ud=ud;
+g->mainthread=L;
+g->uvhead.u.l.prev=&g->uvhead;
+g->uvhead.u.l.next=&g->uvhead;
+g->GCthreshold=0;
+g->strt.size=0;
+g->strt.nuse=0;
+g->strt.hash=NULL;
+setnilvalue(registry(L));
+luaZ_initbuffer(L,&g->buff);
+g->panic=NULL;
+g->gcstate=0;
+g->rootgc=obj2gco(L);
+g->sweepstrgc=0;
+g->sweepgc=&g->rootgc;
+g->gray=NULL;
+g->grayagain=NULL;
+g->weak=NULL;
+g->tmudata=NULL;
+g->totalbytes=sizeof(LG);
+g->gcpause=200;
+g->gcstepmul=200;
+g->gcdept=0;
+for(i=0;i<(8+1);i++)g->mt[i]=NULL;
+if(luaD_rawrunprotected(L,f_luaopen,NULL)!=0){
+close_state(L);
+L=NULL;
+}
+else
+{}
+return L;
+}
+static void callallgcTM(lua_State*L,void*ud){
+UNUSED(ud);
+luaC_callGCTM(L);
+}
+static void lua_close(lua_State*L){
+L=G(L)->mainthread;
+luaF_close(L,L->stack);
+luaC_separateudata(L,1);
+L->errfunc=0;
+do{
+L->ci=L->base_ci;
+L->base=L->top=L->ci->base;
+L->nCcalls=L->baseCcalls=0;
+}while(luaD_rawrunprotected(L,callallgcTM,NULL)!=0);
+close_state(L);
+}
+#define getcode(fs,e)((fs)->f->code[(e)->u.s.info])
+#define luaK_codeAsBx(fs,o,A,sBx)luaK_codeABx(fs,o,A,(sBx)+(((1<<(9+9))-1)>>1))
+#define luaK_setmultret(fs,e)luaK_setreturns(fs,e,(-1))
+static int luaK_codeABx(FuncState*fs,OpCode o,int A,unsigned int Bx);
+static int luaK_codeABC(FuncState*fs,OpCode o,int A,int B,int C);
+static void luaK_setreturns(FuncState*fs,expdesc*e,int nresults);
+static void luaK_patchtohere(FuncState*fs,int list);
+static void luaK_concat(FuncState*fs,int*l1,int l2);
+static int currentpc(lua_State*L,CallInfo*ci){
+if(!isLua(ci))return-1;
+if(ci==L->ci)
+ci->savedpc=L->savedpc;
+return pcRel(ci->savedpc,ci_func(ci)->l.p);
+}
+static int currentline(lua_State*L,CallInfo*ci){
+int pc=currentpc(L,ci);
+if(pc<0)
+return-1;
+else
+return getline_(ci_func(ci)->l.p,pc);
+}
+static int lua_getstack(lua_State*L,int level,lua_Debug*ar){
+int status;
+CallInfo*ci;
+for(ci=L->ci;level>0&&ci>L->base_ci;ci--){
+level--;
+if(f_isLua(ci))
+level-=ci->tailcalls;
+}
+if(level==0&&ci>L->base_ci){
+status=1;
+ar->i_ci=cast_int(ci-L->base_ci);
+}
+else if(level<0){
+status=1;
+ar->i_ci=0;
+}
+else status=0;
+return status;
+}
+static Proto*getluaproto(CallInfo*ci){
+return(isLua(ci)?ci_func(ci)->l.p:NULL);
+}
+static void funcinfo(lua_Debug*ar,Closure*cl){
+if(cl->c.isC){
+ar->source="=[C]";
+ar->linedefined=-1;
+ar->lastlinedefined=-1;
+ar->what="C";
+}
+else{
+ar->source=getstr(cl->l.p->source);
+ar->linedefined=cl->l.p->linedefined;
+ar->lastlinedefined=cl->l.p->lastlinedefined;
+ar->what=(ar->linedefined==0)?"main":"Lua";
+}
+luaO_chunkid(ar->short_src,ar->source,60);
+}
+static void info_tailcall(lua_Debug*ar){
+ar->name=ar->namewhat="";
+ar->what="tail";
+ar->lastlinedefined=ar->linedefined=ar->currentline=-1;
+ar->source="=(tail call)";
+luaO_chunkid(ar->short_src,ar->source,60);
+ar->nups=0;
+}
+static void collectvalidlines(lua_State*L,Closure*f){
+if(f==NULL||f->c.isC){
+setnilvalue(L->top);
+}
+else{
+Table*t=luaH_new(L,0,0);
+int*lineinfo=f->l.p->lineinfo;
+int i;
+for(i=0;i<f->l.p->sizelineinfo;i++)
+setbvalue(luaH_setnum(L,t,lineinfo[i]),1);
+sethvalue(L,L->top,t);
+}
+incr_top(L);
+}
+static int auxgetinfo(lua_State*L,const char*what,lua_Debug*ar,
+Closure*f,CallInfo*ci){
+int status=1;
+if(f==NULL){
+info_tailcall(ar);
+return status;
+}
+for(;*what;what++){
+switch(*what){
+case'S':{
+funcinfo(ar,f);
+break;
+}
+case'l':{
+ar->currentline=(ci)?currentline(L,ci):-1;
+break;
+}
+case'u':{
+ar->nups=f->c.nupvalues;
+break;
+}
+case'n':{
+ar->namewhat=(ci)?NULL:NULL;
+if(ar->namewhat==NULL){
+ar->namewhat="";
+ar->name=NULL;
+}
+break;
+}
+case'L':
+case'f':
+break;
+default:status=0;
+}
+}
+return status;
+}
+static int lua_getinfo(lua_State*L,const char*what,lua_Debug*ar){
+int status;
+Closure*f=NULL;
+CallInfo*ci=NULL;
+if(*what=='>'){
+StkId func=L->top-1;
+luai_apicheck(L,ttisfunction(func));
+what++;
+f=clvalue(func);
+L->top--;
+}
+else if(ar->i_ci!=0){
+ci=L->base_ci+ar->i_ci;
+f=clvalue(ci->func);
+}
+status=auxgetinfo(L,what,ar,f,ci);
+if(strchr(what,'f')){
+if(f==NULL)setnilvalue(L->top);
+else setclvalue(L,L->top,f);
+incr_top(L);
+}
+if(strchr(what,'L'))
+collectvalidlines(L,f);
+return status;
+}
+static int isinstack(CallInfo*ci,const TValue*o){
+StkId p;
+for(p=ci->base;p<ci->top;p++)
+if(o==p)return 1;
+return 0;
+}
+static void luaG_typeerror(lua_State*L,const TValue*o,const char*op){
+const char*name=NULL;
+const char*t=luaT_typenames[ttype(o)];
+const char*kind=(isinstack(L->ci,o))?
+NULL:
+NULL;
+if(kind)
+luaG_runerror(L,"attempt to %s %s "LUA_QL("%s")" (a %s value)",
+op,kind,name,t);
+else
+luaG_runerror(L,"attempt to %s a %s value",op,t);
+}
+static void luaG_concaterror(lua_State*L,StkId p1,StkId p2){
+if(ttisstring(p1)||ttisnumber(p1))p1=p2;
+luaG_typeerror(L,p1,"concatenate");
+}
+static void luaG_aritherror(lua_State*L,const TValue*p1,const TValue*p2){
+TValue temp;
+if(luaV_tonumber(p1,&temp)==NULL)
+p2=p1;
+luaG_typeerror(L,p2,"perform arithmetic on");
+}
+static int luaG_ordererror(lua_State*L,const TValue*p1,const TValue*p2){
+const char*t1=luaT_typenames[ttype(p1)];
+const char*t2=luaT_typenames[ttype(p2)];
+if(t1[2]==t2[2])
+luaG_runerror(L,"attempt to compare two %s values",t1);
+else
+luaG_runerror(L,"attempt to compare %s with %s",t1,t2);
+return 0;
+}
+static void addinfo(lua_State*L,const char*msg){
+CallInfo*ci=L->ci;
+if(isLua(ci)){
+char buff[60];
+int line=currentline(L,ci);
+luaO_chunkid(buff,getstr(getluaproto(ci)->source),60);
+luaO_pushfstring(L,"%s:%d: %s",buff,line,msg);
+}
+}
+static void luaG_errormsg(lua_State*L){
+if(L->errfunc!=0){
+StkId errfunc=restorestack(L,L->errfunc);
+if(!ttisfunction(errfunc))luaD_throw(L,5);
+setobj(L,L->top,L->top-1);
+setobj(L,L->top-1,errfunc);
+incr_top(L);
+luaD_call(L,L->top-2,1);
+}
+luaD_throw(L,2);
+}
+static void luaG_runerror(lua_State*L,const char*fmt,...){
+va_list argp;
+va_start(argp,fmt);
+addinfo(L,luaO_pushvfstring(L,fmt,argp));
+va_end(argp);
+luaG_errormsg(L);
+}
+static int luaZ_fill(ZIO*z){
+size_t size;
+lua_State*L=z->L;
+const char*buff;
+buff=z->reader(L,z->data,&size);
+if(buff==NULL||size==0)return(-1);
+z->n=size-1;
+z->p=buff;
+return char2int(*(z->p++));
+}
+static void luaZ_init(lua_State*L,ZIO*z,lua_Reader reader,void*data){
+z->L=L;
+z->reader=reader;
+z->data=data;
+z->n=0;
+z->p=NULL;
+}
+static char*luaZ_openspace(lua_State*L,Mbuffer*buff,size_t n){
+if(n>buff->buffsize){
+if(n<32)n=32;
+luaZ_resizebuffer(L,buff,n);
+}
+return buff->buffer;
+}
+#define opmode(t,a,b,c,m)(((t)<<7)|((a)<<6)|((b)<<4)|((c)<<2)|(m))
+static const lu_byte luaP_opmodes[(cast(int,OP_VARARG)+1)]={
+opmode(0,1,OpArgR,OpArgN,iABC)
+,opmode(0,1,OpArgK,OpArgN,iABx)
+,opmode(0,1,OpArgU,OpArgU,iABC)
+,opmode(0,1,OpArgR,OpArgN,iABC)
+,opmode(0,1,OpArgU,OpArgN,iABC)
+,opmode(0,1,OpArgK,OpArgN,iABx)
+,opmode(0,1,OpArgR,OpArgK,iABC)
+,opmode(0,0,OpArgK,OpArgN,iABx)
+,opmode(0,0,OpArgU,OpArgN,iABC)
+,opmode(0,0,OpArgK,OpArgK,iABC)
+,opmode(0,1,OpArgU,OpArgU,iABC)
+,opmode(0,1,OpArgR,OpArgK,iABC)
+,opmode(0,1,OpArgK,OpArgK,iABC)
+,opmode(0,1,OpArgK,OpArgK,iABC)
+,opmode(0,1,OpArgK,OpArgK,iABC)
+,opmode(0,1,OpArgK,OpArgK,iABC)
+,opmode(0,1,OpArgK,OpArgK,iABC)
+,opmode(0,1,OpArgK,OpArgK,iABC)
+,opmode(0,1,OpArgR,OpArgN,iABC)
+,opmode(0,1,OpArgR,OpArgN,iABC)
+,opmode(0,1,OpArgR,OpArgN,iABC)
+,opmode(0,1,OpArgR,OpArgR,iABC)
+,opmode(0,0,OpArgR,OpArgN,iAsBx)
+,opmode(1,0,OpArgK,OpArgK,iABC)
+,opmode(1,0,OpArgK,OpArgK,iABC)
+,opmode(1,0,OpArgK,OpArgK,iABC)
+,opmode(1,1,OpArgR,OpArgU,iABC)
+,opmode(1,1,OpArgR,OpArgU,iABC)
+,opmode(0,1,OpArgU,OpArgU,iABC)
+,opmode(0,1,OpArgU,OpArgU,iABC)
+,opmode(0,0,OpArgU,OpArgN,iABC)
+,opmode(0,1,OpArgR,OpArgN,iAsBx)
+,opmode(0,1,OpArgR,OpArgN,iAsBx)
+,opmode(1,0,OpArgN,OpArgU,iABC)
+,opmode(0,0,OpArgU,OpArgU,iABC)
+,opmode(0,0,OpArgN,OpArgN,iABC)
+,opmode(0,1,OpArgU,OpArgN,iABx)
+,opmode(0,1,OpArgU,OpArgN,iABC)
+};
+#define next(ls)(ls->current=zgetc(ls->z))
+#define currIsNewline(ls)(ls->current=='\n'||ls->current=='\r')
+static const char*const luaX_tokens[]={
+"and","break","do","else","elseif",
+"end","false","for","function","if",
+"in","local","nil","not","or","repeat",
+"return","then","true","until","while",
+"..","...","==",">=","<=","~=",
+"<number>","<name>","<string>","<eof>",
+NULL
+};
+#define save_and_next(ls)(save(ls,ls->current),next(ls))
+static void save(LexState*ls,int c){
+Mbuffer*b=ls->buff;
+if(b->n+1>b->buffsize){
+size_t newsize;
+if(b->buffsize>=((size_t)(~(size_t)0)-2)/2)
+luaX_lexerror(ls,"lexical element too long",0);
+newsize=b->buffsize*2;
+luaZ_resizebuffer(ls->L,b,newsize);
+}
+b->buffer[b->n++]=cast(char,c);
+}
+static void luaX_init(lua_State*L){
+int i;
+for(i=0;i<(cast(int,TK_WHILE-257+1));i++){
+TString*ts=luaS_new(L,luaX_tokens[i]);
+luaS_fix(ts);
+ts->tsv.reserved=cast_byte(i+1);
+}
+}
+static const char*luaX_token2str(LexState*ls,int token){
+if(token<257){
+return(iscntrl(token))?luaO_pushfstring(ls->L,"char(%d)",token):
+luaO_pushfstring(ls->L,"%c",token);
+}
+else
+return luaX_tokens[token-257];
+}
+static const char*txtToken(LexState*ls,int token){
+switch(token){
+case TK_NAME:
+case TK_STRING:
+case TK_NUMBER:
+save(ls,'\0');
+return luaZ_buffer(ls->buff);
+default:
+return luaX_token2str(ls,token);
+}
+}
+static void luaX_lexerror(LexState*ls,const char*msg,int token){
+char buff[80];
+luaO_chunkid(buff,getstr(ls->source),80);
+msg=luaO_pushfstring(ls->L,"%s:%d: %s",buff,ls->linenumber,msg);
+if(token)
+luaO_pushfstring(ls->L,"%s near "LUA_QL("%s"),msg,txtToken(ls,token));
+luaD_throw(ls->L,3);
+}
+static void luaX_syntaxerror(LexState*ls,const char*msg){
+luaX_lexerror(ls,msg,ls->t.token);
+}
+static TString*luaX_newstring(LexState*ls,const char*str,size_t l){
+lua_State*L=ls->L;
+TString*ts=luaS_newlstr(L,str,l);
+TValue*o=luaH_setstr(L,ls->fs->h,ts);
+if(ttisnil(o)){
+setbvalue(o,1);
+luaC_checkGC(L);
+}
+return ts;
+}
+static void inclinenumber(LexState*ls){
+int old=ls->current;
+next(ls);
+if(currIsNewline(ls)&&ls->current!=old)
+next(ls);
+if(++ls->linenumber>=(INT_MAX-2))
+luaX_syntaxerror(ls,"chunk has too many lines");
+}
+static void luaX_setinput(lua_State*L,LexState*ls,ZIO*z,TString*source){
+ls->decpoint='.';
+ls->L=L;
+ls->lookahead.token=TK_EOS;
+ls->z=z;
+ls->fs=NULL;
+ls->linenumber=1;
+ls->lastline=1;
+ls->source=source;
+luaZ_resizebuffer(ls->L,ls->buff,32);
+next(ls);
+}
+static int check_next(LexState*ls,const char*set){
+if(!strchr(set,ls->current))
+return 0;
+save_and_next(ls);
+return 1;
+}
+static void buffreplace(LexState*ls,char from,char to){
+size_t n=luaZ_bufflen(ls->buff);
+char*p=luaZ_buffer(ls->buff);
+while(n--)
+if(p[n]==from)p[n]=to;
+}
+static void read_numeral(LexState*ls,SemInfo*seminfo){
+do{
+save_and_next(ls);
+}while(isdigit(ls->current)||ls->current=='.');
+if(check_next(ls,"Ee"))
+check_next(ls,"+-");
+while(isalnum(ls->current)||ls->current=='_')
+save_and_next(ls);
+save(ls,'\0');
+buffreplace(ls,'.',ls->decpoint);
+if(!luaO_str2d(luaZ_buffer(ls->buff),&seminfo->r))
+luaX_lexerror(ls,"malformed number",TK_NUMBER);
+}
+static int skip_sep(LexState*ls){
+int count=0;
+int s=ls->current;
+save_and_next(ls);
+while(ls->current=='='){
+save_and_next(ls);
+count++;
+}
+return(ls->current==s)?count:(-count)-1;
+}
+static void read_long_string(LexState*ls,SemInfo*seminfo,int sep){
+int cont=0;
+(void)(cont);
+save_and_next(ls);
+if(currIsNewline(ls))
+inclinenumber(ls);
+for(;;){
+switch(ls->current){
+case(-1):
+luaX_lexerror(ls,(seminfo)?"unfinished long string":
+"unfinished long comment",TK_EOS);
+break;
+case']':{
+if(skip_sep(ls)==sep){
+save_and_next(ls);
+goto endloop;
+}
+break;
+}
+case'\n':
+case'\r':{
+save(ls,'\n');
+inclinenumber(ls);
+if(!seminfo)luaZ_resetbuffer(ls->buff);
+break;
+}
+default:{
+if(seminfo)save_and_next(ls);
+else next(ls);
+}
+}
+}endloop:
+if(seminfo)
+seminfo->ts=luaX_newstring(ls,luaZ_buffer(ls->buff)+(2+sep),
+luaZ_bufflen(ls->buff)-2*(2+sep));
+}
+static void read_string(LexState*ls,int del,SemInfo*seminfo){
+save_and_next(ls);
+while(ls->current!=del){
+switch(ls->current){
+case(-1):
+luaX_lexerror(ls,"unfinished string",TK_EOS);
+continue;
+case'\n':
+case'\r':
+luaX_lexerror(ls,"unfinished string",TK_STRING);
+continue;
+case'\\':{
+int c;
+next(ls);
+switch(ls->current){
+case'a':c='\a';break;
+case'b':c='\b';break;
+case'f':c='\f';break;
+case'n':c='\n';break;
+case'r':c='\r';break;
+case't':c='\t';break;
+case'v':c='\v';break;
+case'\n':
+case'\r':save(ls,'\n');inclinenumber(ls);continue;
+case(-1):continue;
+default:{
+if(!isdigit(ls->current))
+save_and_next(ls);
+else{
+int i=0;
+c=0;
+do{
+c=10*c+(ls->current-'0');
+next(ls);
+}while(++i<3&&isdigit(ls->current));
+if(c>UCHAR_MAX)
+luaX_lexerror(ls,"escape sequence too large",TK_STRING);
+save(ls,c);
+}
+continue;
+}
+}
+save(ls,c);
+next(ls);
+continue;
+}
+default:
+save_and_next(ls);
+}
+}
+save_and_next(ls);
+seminfo->ts=luaX_newstring(ls,luaZ_buffer(ls->buff)+1,
+luaZ_bufflen(ls->buff)-2);
+}
+static int llex(LexState*ls,SemInfo*seminfo){
+luaZ_resetbuffer(ls->buff);
+for(;;){
+switch(ls->current){
+case'\n':
+case'\r':{
+inclinenumber(ls);
+continue;
+}
+case'-':{
+next(ls);
+if(ls->current!='-')return'-';
+next(ls);
+if(ls->current=='['){
+int sep=skip_sep(ls);
+luaZ_resetbuffer(ls->buff);
+if(sep>=0){
+read_long_string(ls,NULL,sep);
+luaZ_resetbuffer(ls->buff);
+continue;
+}
+}
+while(!currIsNewline(ls)&&ls->current!=(-1))
+next(ls);
+continue;
+}
+case'[':{
+int sep=skip_sep(ls);
+if(sep>=0){
+read_long_string(ls,seminfo,sep);
+return TK_STRING;
+}
+else if(sep==-1)return'[';
+else luaX_lexerror(ls,"invalid long string delimiter",TK_STRING);
+}
+case'=':{
+next(ls);
+if(ls->current!='=')return'=';
+else{next(ls);return TK_EQ;}
+}
+case'<':{
+next(ls);
+if(ls->current!='=')return'<';
+else{next(ls);return TK_LE;}
+}
+case'>':{
+next(ls);
+if(ls->current!='=')return'>';
+else{next(ls);return TK_GE;}
+}
+case'~':{
+next(ls);
+if(ls->current!='=')return'~';
+else{next(ls);return TK_NE;}
+}
+case'"':
+case'\'':{
+read_string(ls,ls->current,seminfo);
+return TK_STRING;
+}
+case'.':{
+save_and_next(ls);
+if(check_next(ls,".")){
+if(check_next(ls,"."))
+return TK_DOTS;
+else return TK_CONCAT;
+}
+else if(!isdigit(ls->current))return'.';
+else{
+read_numeral(ls,seminfo);
+return TK_NUMBER;
+}
+}
+case(-1):{
+return TK_EOS;
+}
+default:{
+if(isspace(ls->current)){
+next(ls);
+continue;
+}
+else if(isdigit(ls->current)){
+read_numeral(ls,seminfo);
+return TK_NUMBER;
+}
+else if(isalpha(ls->current)||ls->current=='_'){
+TString*ts;
+do{
+save_and_next(ls);
+}while(isalnum(ls->current)||ls->current=='_');
+ts=luaX_newstring(ls,luaZ_buffer(ls->buff),
+luaZ_bufflen(ls->buff));
+if(ts->tsv.reserved>0)
+return ts->tsv.reserved-1+257;
+else{
+seminfo->ts=ts;
+return TK_NAME;
+}
+}
+else{
+int c=ls->current;
+next(ls);
+return c;
+}
+}
+}
+}
+}
+static void luaX_next(LexState*ls){
+ls->lastline=ls->linenumber;
+if(ls->lookahead.token!=TK_EOS){
+ls->t=ls->lookahead;
+ls->lookahead.token=TK_EOS;
+}
+else
+ls->t.token=llex(ls,&ls->t.seminfo);
+}
+static void luaX_lookahead(LexState*ls){
+ls->lookahead.token=llex(ls,&ls->lookahead.seminfo);
+}
+#define hasjumps(e)((e)->t!=(e)->f)
+static int isnumeral(expdesc*e){
+return(e->k==VKNUM&&e->t==(-1)&&e->f==(-1));
+}
+static void luaK_nil(FuncState*fs,int from,int n){
+Instruction*previous;
+if(fs->pc>fs->lasttarget){
+if(fs->pc==0){
+if(from>=fs->nactvar)
+return;
+}
+else{
+previous=&fs->f->code[fs->pc-1];
+if(GET_OPCODE(*previous)==OP_LOADNIL){
+int pfrom=GETARG_A(*previous);
+int pto=GETARG_B(*previous);
+if(pfrom<=from&&from<=pto+1){
+if(from+n-1>pto)
+SETARG_B(*previous,from+n-1);
+return;
+}
+}
+}
+}
+luaK_codeABC(fs,OP_LOADNIL,from,from+n-1,0);
+}
+static int luaK_jump(FuncState*fs){
+int jpc=fs->jpc;
+int j;
+fs->jpc=(-1);
+j=luaK_codeAsBx(fs,OP_JMP,0,(-1));
+luaK_concat(fs,&j,jpc);
+return j;
+}
+static void luaK_ret(FuncState*fs,int first,int nret){
+luaK_codeABC(fs,OP_RETURN,first,nret+1,0);
+}
+static int condjump(FuncState*fs,OpCode op,int A,int B,int C){
+luaK_codeABC(fs,op,A,B,C);
+return luaK_jump(fs);
+}
+static void fixjump(FuncState*fs,int pc,int dest){
+Instruction*jmp=&fs->f->code[pc];
+int offset=dest-(pc+1);
+if(abs(offset)>(((1<<(9+9))-1)>>1))
+luaX_syntaxerror(fs->ls,"control structure too long");
+SETARG_sBx(*jmp,offset);
+}
+static int luaK_getlabel(FuncState*fs){
+fs->lasttarget=fs->pc;
+return fs->pc;
+}
+static int getjump(FuncState*fs,int pc){
+int offset=GETARG_sBx(fs->f->code[pc]);
+if(offset==(-1))
+return(-1);
+else
+return(pc+1)+offset;
+}
+static Instruction*getjumpcontrol(FuncState*fs,int pc){
+Instruction*pi=&fs->f->code[pc];
+if(pc>=1&&testTMode(GET_OPCODE(*(pi-1))))
+return pi-1;
+else
+return pi;
+}
+static int need_value(FuncState*fs,int list){
+for(;list!=(-1);list=getjump(fs,list)){
+Instruction i=*getjumpcontrol(fs,list);
+if(GET_OPCODE(i)!=OP_TESTSET)return 1;
+}
+return 0;
+}
+static int patchtestreg(FuncState*fs,int node,int reg){
+Instruction*i=getjumpcontrol(fs,node);
+if(GET_OPCODE(*i)!=OP_TESTSET)
+return 0;
+if(reg!=((1<<8)-1)&&reg!=GETARG_B(*i))
+SETARG_A(*i,reg);
+else
+*i=CREATE_ABC(OP_TEST,GETARG_B(*i),0,GETARG_C(*i));
+return 1;
+}
+static void removevalues(FuncState*fs,int list){
+for(;list!=(-1);list=getjump(fs,list))
+patchtestreg(fs,list,((1<<8)-1));
+}
+static void patchlistaux(FuncState*fs,int list,int vtarget,int reg,
+int dtarget){
+while(list!=(-1)){
+int next=getjump(fs,list);
+if(patchtestreg(fs,list,reg))
+fixjump(fs,list,vtarget);
+else
+fixjump(fs,list,dtarget);
+list=next;
+}
+}
+static void dischargejpc(FuncState*fs){
+patchlistaux(fs,fs->jpc,fs->pc,((1<<8)-1),fs->pc);
+fs->jpc=(-1);
+}
+static void luaK_patchlist(FuncState*fs,int list,int target){
+if(target==fs->pc)
+luaK_patchtohere(fs,list);
+else{
+patchlistaux(fs,list,target,((1<<8)-1),target);
+}
+}
+static void luaK_patchtohere(FuncState*fs,int list){
+luaK_getlabel(fs);
+luaK_concat(fs,&fs->jpc,list);
+}
+static void luaK_concat(FuncState*fs,int*l1,int l2){
+if(l2==(-1))return;
+else if(*l1==(-1))
+*l1=l2;
+else{
+int list=*l1;
+int next;
+while((next=getjump(fs,list))!=(-1))
+list=next;
+fixjump(fs,list,l2);
+}
+}
+static void luaK_checkstack(FuncState*fs,int n){
+int newstack=fs->freereg+n;
+if(newstack>fs->f->maxstacksize){
+if(newstack>=250)
+luaX_syntaxerror(fs->ls,"function or expression too complex");
+fs->f->maxstacksize=cast_byte(newstack);
+}
+}
+static void luaK_reserveregs(FuncState*fs,int n){
+luaK_checkstack(fs,n);
+fs->freereg+=n;
+}
+static void freereg(FuncState*fs,int reg){
+if(!ISK(reg)&&reg>=fs->nactvar){
+fs->freereg--;
+}
+}
+static void freeexp(FuncState*fs,expdesc*e){
+if(e->k==VNONRELOC)
+freereg(fs,e->u.s.info);
+}
+static int addk(FuncState*fs,TValue*k,TValue*v){
+lua_State*L=fs->L;
+TValue*idx=luaH_set(L,fs->h,k);
+Proto*f=fs->f;
+int oldsize=f->sizek;
+if(ttisnumber(idx)){
+return cast_int(nvalue(idx));
+}
+else{
+setnvalue(idx,cast_num(fs->nk));
+luaM_growvector(L,f->k,fs->nk,f->sizek,TValue,
+((1<<(9+9))-1),"constant table overflow");
+while(oldsize<f->sizek)setnilvalue(&f->k[oldsize++]);
+setobj(L,&f->k[fs->nk],v);
+luaC_barrier(L,f,v);
+return fs->nk++;
+}
+}
+static int luaK_stringK(FuncState*fs,TString*s){
+TValue o;
+setsvalue(fs->L,&o,s);
+return addk(fs,&o,&o);
+}
+static int luaK_numberK(FuncState*fs,lua_Number r){
+TValue o;
+setnvalue(&o,r);
+return addk(fs,&o,&o);
+}
+static int boolK(FuncState*fs,int b){
+TValue o;
+setbvalue(&o,b);
+return addk(fs,&o,&o);
+}
+static int nilK(FuncState*fs){
+TValue k,v;
+setnilvalue(&v);
+sethvalue(fs->L,&k,fs->h);
+return addk(fs,&k,&v);
+}
+static void luaK_setreturns(FuncState*fs,expdesc*e,int nresults){
+if(e->k==VCALL){
+SETARG_C(getcode(fs,e),nresults+1);
+}
+else if(e->k==VVARARG){
+SETARG_B(getcode(fs,e),nresults+1);
+SETARG_A(getcode(fs,e),fs->freereg);
+luaK_reserveregs(fs,1);
+}
+}
+static void luaK_setoneret(FuncState*fs,expdesc*e){
+if(e->k==VCALL){
+e->k=VNONRELOC;
+e->u.s.info=GETARG_A(getcode(fs,e));
+}
+else if(e->k==VVARARG){
+SETARG_B(getcode(fs,e),2);
+e->k=VRELOCABLE;
+}
+}
+static void luaK_dischargevars(FuncState*fs,expdesc*e){
+switch(e->k){
+case VLOCAL:{
+e->k=VNONRELOC;
+break;
+}
+case VUPVAL:{
+e->u.s.info=luaK_codeABC(fs,OP_GETUPVAL,0,e->u.s.info,0);
+e->k=VRELOCABLE;
+break;
+}
+case VGLOBAL:{
+e->u.s.info=luaK_codeABx(fs,OP_GETGLOBAL,0,e->u.s.info);
+e->k=VRELOCABLE;
+break;
+}
+case VINDEXED:{
+freereg(fs,e->u.s.aux);
+freereg(fs,e->u.s.info);
+e->u.s.info=luaK_codeABC(fs,OP_GETTABLE,0,e->u.s.info,e->u.s.aux);
+e->k=VRELOCABLE;
+break;
+}
+case VVARARG:
+case VCALL:{
+luaK_setoneret(fs,e);
+break;
+}
+default:break;
+}
+}
+static int code_label(FuncState*fs,int A,int b,int jump){
+luaK_getlabel(fs);
+return luaK_codeABC(fs,OP_LOADBOOL,A,b,jump);
+}
+static void discharge2reg(FuncState*fs,expdesc*e,int reg){
+luaK_dischargevars(fs,e);
+switch(e->k){
+case VNIL:{
+luaK_nil(fs,reg,1);
+break;
+}
+case VFALSE:case VTRUE:{
+luaK_codeABC(fs,OP_LOADBOOL,reg,e->k==VTRUE,0);
+break;
+}
+case VK:{
+luaK_codeABx(fs,OP_LOADK,reg,e->u.s.info);
+break;
+}
+case VKNUM:{
+luaK_codeABx(fs,OP_LOADK,reg,luaK_numberK(fs,e->u.nval));
+break;
+}
+case VRELOCABLE:{
+Instruction*pc=&getcode(fs,e);
+SETARG_A(*pc,reg);
+break;
+}
+case VNONRELOC:{
+if(reg!=e->u.s.info)
+luaK_codeABC(fs,OP_MOVE,reg,e->u.s.info,0);
+break;
+}
+default:{
+return;
+}
+}
+e->u.s.info=reg;
+e->k=VNONRELOC;
+}
+static void discharge2anyreg(FuncState*fs,expdesc*e){
+if(e->k!=VNONRELOC){
+luaK_reserveregs(fs,1);
+discharge2reg(fs,e,fs->freereg-1);
+}
+}
+static void exp2reg(FuncState*fs,expdesc*e,int reg){
+discharge2reg(fs,e,reg);
+if(e->k==VJMP)
+luaK_concat(fs,&e->t,e->u.s.info);
+if(hasjumps(e)){
+int final;
+int p_f=(-1);
+int p_t=(-1);
+if(need_value(fs,e->t)||need_value(fs,e->f)){
+int fj=(e->k==VJMP)?(-1):luaK_jump(fs);
+p_f=code_label(fs,reg,0,1);
+p_t=code_label(fs,reg,1,0);
+luaK_patchtohere(fs,fj);
+}
+final=luaK_getlabel(fs);
+patchlistaux(fs,e->f,final,reg,p_f);
+patchlistaux(fs,e->t,final,reg,p_t);
+}
+e->f=e->t=(-1);
+e->u.s.info=reg;
+e->k=VNONRELOC;
+}
+static void luaK_exp2nextreg(FuncState*fs,expdesc*e){
+luaK_dischargevars(fs,e);
+freeexp(fs,e);
+luaK_reserveregs(fs,1);
+exp2reg(fs,e,fs->freereg-1);
+}
+static int luaK_exp2anyreg(FuncState*fs,expdesc*e){
+luaK_dischargevars(fs,e);
+if(e->k==VNONRELOC){
+if(!hasjumps(e))return e->u.s.info;
+if(e->u.s.info>=fs->nactvar){
+exp2reg(fs,e,e->u.s.info);
+return e->u.s.info;
+}
+}
+luaK_exp2nextreg(fs,e);
+return e->u.s.info;
+}
+static void luaK_exp2val(FuncState*fs,expdesc*e){
+if(hasjumps(e))
+luaK_exp2anyreg(fs,e);
+else
+luaK_dischargevars(fs,e);
+}
+static int luaK_exp2RK(FuncState*fs,expdesc*e){
+luaK_exp2val(fs,e);
+switch(e->k){
+case VKNUM:
+case VTRUE:
+case VFALSE:
+case VNIL:{
+if(fs->nk<=((1<<(9-1))-1)){
+e->u.s.info=(e->k==VNIL)?nilK(fs):
+(e->k==VKNUM)?luaK_numberK(fs,e->u.nval):
+boolK(fs,(e->k==VTRUE));
+e->k=VK;
+return RKASK(e->u.s.info);
+}
+else break;
+}
+case VK:{
+if(e->u.s.info<=((1<<(9-1))-1))
+return RKASK(e->u.s.info);
+else break;
+}
+default:break;
+}
+return luaK_exp2anyreg(fs,e);
+}
+static void luaK_storevar(FuncState*fs,expdesc*var,expdesc*ex){
+switch(var->k){
+case VLOCAL:{
+freeexp(fs,ex);
+exp2reg(fs,ex,var->u.s.info);
+return;
+}
+case VUPVAL:{
+int e=luaK_exp2anyreg(fs,ex);
+luaK_codeABC(fs,OP_SETUPVAL,e,var->u.s.info,0);
+break;
+}
+case VGLOBAL:{
+int e=luaK_exp2anyreg(fs,ex);
+luaK_codeABx(fs,OP_SETGLOBAL,e,var->u.s.info);
+break;
+}
+case VINDEXED:{
+int e=luaK_exp2RK(fs,ex);
+luaK_codeABC(fs,OP_SETTABLE,var->u.s.info,var->u.s.aux,e);
+break;
+}
+default:{
+break;
+}
+}
+freeexp(fs,ex);
+}
+static void luaK_self(FuncState*fs,expdesc*e,expdesc*key){
+int func;
+luaK_exp2anyreg(fs,e);
+freeexp(fs,e);
+func=fs->freereg;
+luaK_reserveregs(fs,2);
+luaK_codeABC(fs,OP_SELF,func,e->u.s.info,luaK_exp2RK(fs,key));
+freeexp(fs,key);
+e->u.s.info=func;
+e->k=VNONRELOC;
+}
+static void invertjump(FuncState*fs,expdesc*e){
+Instruction*pc=getjumpcontrol(fs,e->u.s.info);
+SETARG_A(*pc,!(GETARG_A(*pc)));
+}
+static int jumponcond(FuncState*fs,expdesc*e,int cond){
+if(e->k==VRELOCABLE){
+Instruction ie=getcode(fs,e);
+if(GET_OPCODE(ie)==OP_NOT){
+fs->pc--;
+return condjump(fs,OP_TEST,GETARG_B(ie),0,!cond);
+}
+}
+discharge2anyreg(fs,e);
+freeexp(fs,e);
+return condjump(fs,OP_TESTSET,((1<<8)-1),e->u.s.info,cond);
+}
+static void luaK_goiftrue(FuncState*fs,expdesc*e){
+int pc;
+luaK_dischargevars(fs,e);
+switch(e->k){
+case VK:case VKNUM:case VTRUE:{
+pc=(-1);
+break;
+}
+case VJMP:{
+invertjump(fs,e);
+pc=e->u.s.info;
+break;
+}
+default:{
+pc=jumponcond(fs,e,0);
+break;
+}
+}
+luaK_concat(fs,&e->f,pc);
+luaK_patchtohere(fs,e->t);
+e->t=(-1);
+}
+static void luaK_goiffalse(FuncState*fs,expdesc*e){
+int pc;
+luaK_dischargevars(fs,e);
+switch(e->k){
+case VNIL:case VFALSE:{
+pc=(-1);
+break;
+}
+case VJMP:{
+pc=e->u.s.info;
+break;
+}
+default:{
+pc=jumponcond(fs,e,1);
+break;
+}
+}
+luaK_concat(fs,&e->t,pc);
+luaK_patchtohere(fs,e->f);
+e->f=(-1);
+}
+static void codenot(FuncState*fs,expdesc*e){
+luaK_dischargevars(fs,e);
+switch(e->k){
+case VNIL:case VFALSE:{
+e->k=VTRUE;
+break;
+}
+case VK:case VKNUM:case VTRUE:{
+e->k=VFALSE;
+break;
+}
+case VJMP:{
+invertjump(fs,e);
+break;
+}
+case VRELOCABLE:
+case VNONRELOC:{
+discharge2anyreg(fs,e);
+freeexp(fs,e);
+e->u.s.info=luaK_codeABC(fs,OP_NOT,0,e->u.s.info,0);
+e->k=VRELOCABLE;
+break;
+}
+default:{
+break;
+}
+}
+{int temp=e->f;e->f=e->t;e->t=temp;}
+removevalues(fs,e->f);
+removevalues(fs,e->t);
+}
+static void luaK_indexed(FuncState*fs,expdesc*t,expdesc*k){
+t->u.s.aux=luaK_exp2RK(fs,k);
+t->k=VINDEXED;
+}
+static int constfolding(OpCode op,expdesc*e1,expdesc*e2){
+lua_Number v1,v2,r;
+if(!isnumeral(e1)||!isnumeral(e2))return 0;
+v1=e1->u.nval;
+v2=e2->u.nval;
+switch(op){
+case OP_ADD:r=luai_numadd(v1,v2);break;
+case OP_SUB:r=luai_numsub(v1,v2);break;
+case OP_MUL:r=luai_nummul(v1,v2);break;
+case OP_DIV:
+if(v2==0)return 0;
+r=luai_numdiv(v1,v2);break;
+case OP_MOD:
+if(v2==0)return 0;
+r=luai_nummod(v1,v2);break;
+case OP_POW:r=luai_numpow(v1,v2);break;
+case OP_UNM:r=luai_numunm(v1);break;
+case OP_LEN:return 0;
+default:r=0;break;
+}
+if(luai_numisnan(r))return 0;
+e1->u.nval=r;
+return 1;
+}
+static void codearith(FuncState*fs,OpCode op,expdesc*e1,expdesc*e2){
+if(constfolding(op,e1,e2))
+return;
+else{
+int o2=(op!=OP_UNM&&op!=OP_LEN)?luaK_exp2RK(fs,e2):0;
+int o1=luaK_exp2RK(fs,e1);
+if(o1>o2){
+freeexp(fs,e1);
+freeexp(fs,e2);
+}
+else{
+freeexp(fs,e2);
+freeexp(fs,e1);
+}
+e1->u.s.info=luaK_codeABC(fs,op,0,o1,o2);
+e1->k=VRELOCABLE;
+}
+}
+static void codecomp(FuncState*fs,OpCode op,int cond,expdesc*e1,
+expdesc*e2){
+int o1=luaK_exp2RK(fs,e1);
+int o2=luaK_exp2RK(fs,e2);
+freeexp(fs,e2);
+freeexp(fs,e1);
+if(cond==0&&op!=OP_EQ){
+int temp;
+temp=o1;o1=o2;o2=temp;
+cond=1;
+}
+e1->u.s.info=condjump(fs,op,cond,o1,o2);
+e1->k=VJMP;
+}
+static void luaK_prefix(FuncState*fs,UnOpr op,expdesc*e){
+expdesc e2;
+e2.t=e2.f=(-1);e2.k=VKNUM;e2.u.nval=0;
+switch(op){
+case OPR_MINUS:{
+if(!isnumeral(e))
+luaK_exp2anyreg(fs,e);
+codearith(fs,OP_UNM,e,&e2);
+break;
+}
+case OPR_NOT:codenot(fs,e);break;
+case OPR_LEN:{
+luaK_exp2anyreg(fs,e);
+codearith(fs,OP_LEN,e,&e2);
+break;
+}
+default:;
+}
+}
+static void luaK_infix(FuncState*fs,BinOpr op,expdesc*v){
+switch(op){
+case OPR_AND:{
+luaK_goiftrue(fs,v);
+break;
+}
+case OPR_OR:{
+luaK_goiffalse(fs,v);
+break;
+}
+case OPR_CONCAT:{
+luaK_exp2nextreg(fs,v);
+break;
+}
+case OPR_ADD:case OPR_SUB:case OPR_MUL:case OPR_DIV:
+case OPR_MOD:case OPR_POW:{
+if(!isnumeral(v))luaK_exp2RK(fs,v);
+break;
+}
+default:{
+luaK_exp2RK(fs,v);
+break;
+}
+}
+}
+static void luaK_posfix(FuncState*fs,BinOpr op,expdesc*e1,expdesc*e2){
+switch(op){
+case OPR_AND:{
+luaK_dischargevars(fs,e2);
+luaK_concat(fs,&e2->f,e1->f);
+*e1=*e2;
+break;
+}
+case OPR_OR:{
+luaK_dischargevars(fs,e2);
+luaK_concat(fs,&e2->t,e1->t);
+*e1=*e2;
+break;
+}
+case OPR_CONCAT:{
+luaK_exp2val(fs,e2);
+if(e2->k==VRELOCABLE&&GET_OPCODE(getcode(fs,e2))==OP_CONCAT){
+freeexp(fs,e1);
+SETARG_B(getcode(fs,e2),e1->u.s.info);
+e1->k=VRELOCABLE;e1->u.s.info=e2->u.s.info;
+}
+else{
+luaK_exp2nextreg(fs,e2);
+codearith(fs,OP_CONCAT,e1,e2);
+}
+break;
+}
+case OPR_ADD:codearith(fs,OP_ADD,e1,e2);break;
+case OPR_SUB:codearith(fs,OP_SUB,e1,e2);break;
+case OPR_MUL:codearith(fs,OP_MUL,e1,e2);break;
+case OPR_DIV:codearith(fs,OP_DIV,e1,e2);break;
+case OPR_MOD:codearith(fs,OP_MOD,e1,e2);break;
+case OPR_POW:codearith(fs,OP_POW,e1,e2);break;
+case OPR_EQ:codecomp(fs,OP_EQ,1,e1,e2);break;
+case OPR_NE:codecomp(fs,OP_EQ,0,e1,e2);break;
+case OPR_LT:codecomp(fs,OP_LT,1,e1,e2);break;
+case OPR_LE:codecomp(fs,OP_LE,1,e1,e2);break;
+case OPR_GT:codecomp(fs,OP_LT,0,e1,e2);break;
+case OPR_GE:codecomp(fs,OP_LE,0,e1,e2);break;
+default:;
+}
+}
+static void luaK_fixline(FuncState*fs,int line){
+fs->f->lineinfo[fs->pc-1]=line;
+}
+static int luaK_code(FuncState*fs,Instruction i,int line){
+Proto*f=fs->f;
+dischargejpc(fs);
+luaM_growvector(fs->L,f->code,fs->pc,f->sizecode,Instruction,
+(INT_MAX-2),"code size overflow");
+f->code[fs->pc]=i;
+luaM_growvector(fs->L,f->lineinfo,fs->pc,f->sizelineinfo,int,
+(INT_MAX-2),"code size overflow");
+f->lineinfo[fs->pc]=line;
+return fs->pc++;
+}
+static int luaK_codeABC(FuncState*fs,OpCode o,int a,int b,int c){
+return luaK_code(fs,CREATE_ABC(o,a,b,c),fs->ls->lastline);
+}
+static int luaK_codeABx(FuncState*fs,OpCode o,int a,unsigned int bc){
+return luaK_code(fs,CREATE_ABx(o,a,bc),fs->ls->lastline);
+}
+static void luaK_setlist(FuncState*fs,int base,int nelems,int tostore){
+int c=(nelems-1)/50+1;
+int b=(tostore==(-1))?0:tostore;
+if(c<=((1<<9)-1))
+luaK_codeABC(fs,OP_SETLIST,base,b,c);
+else{
+luaK_codeABC(fs,OP_SETLIST,base,b,0);
+luaK_code(fs,cast(Instruction,c),fs->ls->lastline);
+}
+fs->freereg=base+1;
+}
+#define hasmultret(k)((k)==VCALL||(k)==VVARARG)
+#define getlocvar(fs,i)((fs)->f->locvars[(fs)->actvar[i]])
+#define luaY_checklimit(fs,v,l,m)if((v)>(l))errorlimit(fs,l,m)
+typedef struct BlockCnt{
+struct BlockCnt*previous;
+int breaklist;
+lu_byte nactvar;
+lu_byte upval;
+lu_byte isbreakable;
+}BlockCnt;
+static void chunk(LexState*ls);
+static void expr(LexState*ls,expdesc*v);
+static void anchor_token(LexState*ls){
+if(ls->t.token==TK_NAME||ls->t.token==TK_STRING){
+TString*ts=ls->t.seminfo.ts;
+luaX_newstring(ls,getstr(ts),ts->tsv.len);
+}
+}
+static void error_expected(LexState*ls,int token){
+luaX_syntaxerror(ls,
+luaO_pushfstring(ls->L,LUA_QL("%s")" expected",luaX_token2str(ls,token)));
+}
+static void errorlimit(FuncState*fs,int limit,const char*what){
+const char*msg=(fs->f->linedefined==0)?
+luaO_pushfstring(fs->L,"main function has more than %d %s",limit,what):
+luaO_pushfstring(fs->L,"function at line %d has more than %d %s",
+fs->f->linedefined,limit,what);
+luaX_lexerror(fs->ls,msg,0);
+}
+static int testnext(LexState*ls,int c){
+if(ls->t.token==c){
+luaX_next(ls);
+return 1;
+}
+else return 0;
+}
+static void check(LexState*ls,int c){
+if(ls->t.token!=c)
+error_expected(ls,c);
+}
+static void checknext(LexState*ls,int c){
+check(ls,c);
+luaX_next(ls);
+}
+#define check_condition(ls,c,msg){if(!(c))luaX_syntaxerror(ls,msg);}
+static void check_match(LexState*ls,int what,int who,int where){
+if(!testnext(ls,what)){
+if(where==ls->linenumber)
+error_expected(ls,what);
+else{
+luaX_syntaxerror(ls,luaO_pushfstring(ls->L,
+LUA_QL("%s")" expected (to close "LUA_QL("%s")" at line %d)",
+luaX_token2str(ls,what),luaX_token2str(ls,who),where));
+}
+}
+}
+static TString*str_checkname(LexState*ls){
+TString*ts;
+check(ls,TK_NAME);
+ts=ls->t.seminfo.ts;
+luaX_next(ls);
+return ts;
+}
+static void init_exp(expdesc*e,expkind k,int i){
+e->f=e->t=(-1);
+e->k=k;
+e->u.s.info=i;
+}
+static void codestring(LexState*ls,expdesc*e,TString*s){
+init_exp(e,VK,luaK_stringK(ls->fs,s));
+}
+static void checkname(LexState*ls,expdesc*e){
+codestring(ls,e,str_checkname(ls));
+}
+static int registerlocalvar(LexState*ls,TString*varname){
+FuncState*fs=ls->fs;
+Proto*f=fs->f;
+int oldsize=f->sizelocvars;
+luaM_growvector(ls->L,f->locvars,fs->nlocvars,f->sizelocvars,
+LocVar,SHRT_MAX,"too many local variables");
+while(oldsize<f->sizelocvars)f->locvars[oldsize++].varname=NULL;
+f->locvars[fs->nlocvars].varname=varname;
+luaC_objbarrier(ls->L,f,varname);
+return fs->nlocvars++;
+}
+#define new_localvarliteral(ls,v,n)new_localvar(ls,luaX_newstring(ls,""v,(sizeof(v)/sizeof(char))-1),n)
+static void new_localvar(LexState*ls,TString*name,int n){
+FuncState*fs=ls->fs;
+luaY_checklimit(fs,fs->nactvar+n+1,200,"local variables");
+fs->actvar[fs->nactvar+n]=cast(unsigned short,registerlocalvar(ls,name));
+}
+static void adjustlocalvars(LexState*ls,int nvars){
+FuncState*fs=ls->fs;
+fs->nactvar=cast_byte(fs->nactvar+nvars);
+for(;nvars;nvars--){
+getlocvar(fs,fs->nactvar-nvars).startpc=fs->pc;
+}
+}
+static void removevars(LexState*ls,int tolevel){
+FuncState*fs=ls->fs;
+while(fs->nactvar>tolevel)
+getlocvar(fs,--fs->nactvar).endpc=fs->pc;
+}
+static int indexupvalue(FuncState*fs,TString*name,expdesc*v){
+int i;
+Proto*f=fs->f;
+int oldsize=f->sizeupvalues;
+for(i=0;i<f->nups;i++){
+if(fs->upvalues[i].k==v->k&&fs->upvalues[i].info==v->u.s.info){
+return i;
+}
+}
+luaY_checklimit(fs,f->nups+1,60,"upvalues");
+luaM_growvector(fs->L,f->upvalues,f->nups,f->sizeupvalues,
+TString*,(INT_MAX-2),"");
+while(oldsize<f->sizeupvalues)f->upvalues[oldsize++]=NULL;
+f->upvalues[f->nups]=name;
+luaC_objbarrier(fs->L,f,name);
+fs->upvalues[f->nups].k=cast_byte(v->k);
+fs->upvalues[f->nups].info=cast_byte(v->u.s.info);
+return f->nups++;
+}
+static int searchvar(FuncState*fs,TString*n){
+int i;
+for(i=fs->nactvar-1;i>=0;i--){
+if(n==getlocvar(fs,i).varname)
+return i;
+}
+return-1;
+}
+static void markupval(FuncState*fs,int level){
+BlockCnt*bl=fs->bl;
+while(bl&&bl->nactvar>level)bl=bl->previous;
+if(bl)bl->upval=1;
+}
+static int singlevaraux(FuncState*fs,TString*n,expdesc*var,int base){
+if(fs==NULL){
+init_exp(var,VGLOBAL,((1<<8)-1));
+return VGLOBAL;
+}
+else{
+int v=searchvar(fs,n);
+if(v>=0){
+init_exp(var,VLOCAL,v);
+if(!base)
+markupval(fs,v);
+return VLOCAL;
+}
+else{
+if(singlevaraux(fs->prev,n,var,0)==VGLOBAL)
+return VGLOBAL;
+var->u.s.info=indexupvalue(fs,n,var);
+var->k=VUPVAL;
+return VUPVAL;
+}
+}
+}
+static void singlevar(LexState*ls,expdesc*var){
+TString*varname=str_checkname(ls);
+FuncState*fs=ls->fs;
+if(singlevaraux(fs,varname,var,1)==VGLOBAL)
+var->u.s.info=luaK_stringK(fs,varname);
+}
+static void adjust_assign(LexState*ls,int nvars,int nexps,expdesc*e){
+FuncState*fs=ls->fs;
+int extra=nvars-nexps;
+if(hasmultret(e->k)){
+extra++;
+if(extra<0)extra=0;
+luaK_setreturns(fs,e,extra);
+if(extra>1)luaK_reserveregs(fs,extra-1);
+}
+else{
+if(e->k!=VVOID)luaK_exp2nextreg(fs,e);
+if(extra>0){
+int reg=fs->freereg;
+luaK_reserveregs(fs,extra);
+luaK_nil(fs,reg,extra);
+}
+}
+}
+static void enterlevel(LexState*ls){
+if(++ls->L->nCcalls>200)
+luaX_lexerror(ls,"chunk has too many syntax levels",0);
+}
+#define leavelevel(ls)((ls)->L->nCcalls--)
+static void enterblock(FuncState*fs,BlockCnt*bl,lu_byte isbreakable){
+bl->breaklist=(-1);
+bl->isbreakable=isbreakable;
+bl->nactvar=fs->nactvar;
+bl->upval=0;
+bl->previous=fs->bl;
+fs->bl=bl;
+}
+static void leaveblock(FuncState*fs){
+BlockCnt*bl=fs->bl;
+fs->bl=bl->previous;
+removevars(fs->ls,bl->nactvar);
+if(bl->upval)
+luaK_codeABC(fs,OP_CLOSE,bl->nactvar,0,0);
+fs->freereg=fs->nactvar;
+luaK_patchtohere(fs,bl->breaklist);
+}
+static void pushclosure(LexState*ls,FuncState*func,expdesc*v){
+FuncState*fs=ls->fs;
+Proto*f=fs->f;
+int oldsize=f->sizep;
+int i;
+luaM_growvector(ls->L,f->p,fs->np,f->sizep,Proto*,
+((1<<(9+9))-1),"constant table overflow");
+while(oldsize<f->sizep)f->p[oldsize++]=NULL;
+f->p[fs->np++]=func->f;
+luaC_objbarrier(ls->L,f,func->f);
+init_exp(v,VRELOCABLE,luaK_codeABx(fs,OP_CLOSURE,0,fs->np-1));
+for(i=0;i<func->f->nups;i++){
+OpCode o=(func->upvalues[i].k==VLOCAL)?OP_MOVE:OP_GETUPVAL;
+luaK_codeABC(fs,o,0,func->upvalues[i].info,0);
+}
+}
+static void open_func(LexState*ls,FuncState*fs){
+lua_State*L=ls->L;
+Proto*f=luaF_newproto(L);
+fs->f=f;
+fs->prev=ls->fs;
+fs->ls=ls;
+fs->L=L;
+ls->fs=fs;
+fs->pc=0;
+fs->lasttarget=-1;
+fs->jpc=(-1);
+fs->freereg=0;
+fs->nk=0;
+fs->np=0;
+fs->nlocvars=0;
+fs->nactvar=0;
+fs->bl=NULL;
+f->source=ls->source;
+f->maxstacksize=2;
+fs->h=luaH_new(L,0,0);
+sethvalue(L,L->top,fs->h);
+incr_top(L);
+setptvalue(L,L->top,f);
+incr_top(L);
+}
+static void close_func(LexState*ls){
+lua_State*L=ls->L;
+FuncState*fs=ls->fs;
+Proto*f=fs->f;
+removevars(ls,0);
+luaK_ret(fs,0,0);
+luaM_reallocvector(L,f->code,f->sizecode,fs->pc,Instruction);
+f->sizecode=fs->pc;
+luaM_reallocvector(L,f->lineinfo,f->sizelineinfo,fs->pc,int);
+f->sizelineinfo=fs->pc;
+luaM_reallocvector(L,f->k,f->sizek,fs->nk,TValue);
+f->sizek=fs->nk;
+luaM_reallocvector(L,f->p,f->sizep,fs->np,Proto*);
+f->sizep=fs->np;
+luaM_reallocvector(L,f->locvars,f->sizelocvars,fs->nlocvars,LocVar);
+f->sizelocvars=fs->nlocvars;
+luaM_reallocvector(L,f->upvalues,f->sizeupvalues,f->nups,TString*);
+f->sizeupvalues=f->nups;
+ls->fs=fs->prev;
+if(fs)anchor_token(ls);
+L->top-=2;
+}
+static Proto*luaY_parser(lua_State*L,ZIO*z,Mbuffer*buff,const char*name){
+struct LexState lexstate;
+struct FuncState funcstate;
+lexstate.buff=buff;
+luaX_setinput(L,&lexstate,z,luaS_new(L,name));
+open_func(&lexstate,&funcstate);
+funcstate.f->is_vararg=2;
+luaX_next(&lexstate);
+chunk(&lexstate);
+check(&lexstate,TK_EOS);
+close_func(&lexstate);
+return funcstate.f;
+}
+static void field(LexState*ls,expdesc*v){
+FuncState*fs=ls->fs;
+expdesc key;
+luaK_exp2anyreg(fs,v);
+luaX_next(ls);
+checkname(ls,&key);
+luaK_indexed(fs,v,&key);
+}
+static void yindex(LexState*ls,expdesc*v){
+luaX_next(ls);
+expr(ls,v);
+luaK_exp2val(ls->fs,v);
+checknext(ls,']');
+}
+struct ConsControl{
+expdesc v;
+expdesc*t;
+int nh;
+int na;
+int tostore;
+};
+static void recfield(LexState*ls,struct ConsControl*cc){
+FuncState*fs=ls->fs;
+int reg=ls->fs->freereg;
+expdesc key,val;
+int rkkey;
+if(ls->t.token==TK_NAME){
+luaY_checklimit(fs,cc->nh,(INT_MAX-2),"items in a constructor");
+checkname(ls,&key);
+}
+else
+yindex(ls,&key);
+cc->nh++;
+checknext(ls,'=');
+rkkey=luaK_exp2RK(fs,&key);
+expr(ls,&val);
+luaK_codeABC(fs,OP_SETTABLE,cc->t->u.s.info,rkkey,luaK_exp2RK(fs,&val));
+fs->freereg=reg;
+}
+static void closelistfield(FuncState*fs,struct ConsControl*cc){
+if(cc->v.k==VVOID)return;
+luaK_exp2nextreg(fs,&cc->v);
+cc->v.k=VVOID;
+if(cc->tostore==50){
+luaK_setlist(fs,cc->t->u.s.info,cc->na,cc->tostore);
+cc->tostore=0;
+}
+}
+static void lastlistfield(FuncState*fs,struct ConsControl*cc){
+if(cc->tostore==0)return;
+if(hasmultret(cc->v.k)){
+luaK_setmultret(fs,&cc->v);
+luaK_setlist(fs,cc->t->u.s.info,cc->na,(-1));
+cc->na--;
+}
+else{
+if(cc->v.k!=VVOID)
+luaK_exp2nextreg(fs,&cc->v);
+luaK_setlist(fs,cc->t->u.s.info,cc->na,cc->tostore);
+}
+}
+static void listfield(LexState*ls,struct ConsControl*cc){
+expr(ls,&cc->v);
+luaY_checklimit(ls->fs,cc->na,(INT_MAX-2),"items in a constructor");
+cc->na++;
+cc->tostore++;
+}
+static void constructor(LexState*ls,expdesc*t){
+FuncState*fs=ls->fs;
+int line=ls->linenumber;
+int pc=luaK_codeABC(fs,OP_NEWTABLE,0,0,0);
+struct ConsControl cc;
+cc.na=cc.nh=cc.tostore=0;
+cc.t=t;
+init_exp(t,VRELOCABLE,pc);
+init_exp(&cc.v,VVOID,0);
+luaK_exp2nextreg(ls->fs,t);
+checknext(ls,'{');
+do{
+if(ls->t.token=='}')break;
+closelistfield(fs,&cc);
+switch(ls->t.token){
+case TK_NAME:{
+luaX_lookahead(ls);
+if(ls->lookahead.token!='=')
+listfield(ls,&cc);
+else
+recfield(ls,&cc);
+break;
+}
+case'[':{
+recfield(ls,&cc);
+break;
+}
+default:{
+listfield(ls,&cc);
+break;
+}
+}
+}while(testnext(ls,',')||testnext(ls,';'));
+check_match(ls,'}','{',line);
+lastlistfield(fs,&cc);
+SETARG_B(fs->f->code[pc],luaO_int2fb(cc.na));
+SETARG_C(fs->f->code[pc],luaO_int2fb(cc.nh));
+}
+static void parlist(LexState*ls){
+FuncState*fs=ls->fs;
+Proto*f=fs->f;
+int nparams=0;
+f->is_vararg=0;
+if(ls->t.token!=')'){
+do{
+switch(ls->t.token){
+case TK_NAME:{
+new_localvar(ls,str_checkname(ls),nparams++);
+break;
+}
+case TK_DOTS:{
+luaX_next(ls);
+f->is_vararg|=2;
+break;
+}
+default:luaX_syntaxerror(ls,"<name> or "LUA_QL("...")" expected");
+}
+}while(!f->is_vararg&&testnext(ls,','));
+}
+adjustlocalvars(ls,nparams);
+f->numparams=cast_byte(fs->nactvar-(f->is_vararg&1));
+luaK_reserveregs(fs,fs->nactvar);
+}
+static void body(LexState*ls,expdesc*e,int needself,int line){
+FuncState new_fs;
+open_func(ls,&new_fs);
+new_fs.f->linedefined=line;
+checknext(ls,'(');
+if(needself){
+new_localvarliteral(ls,"self",0);
+adjustlocalvars(ls,1);
+}
+parlist(ls);
+checknext(ls,')');
+chunk(ls);
+new_fs.f->lastlinedefined=ls->linenumber;
+check_match(ls,TK_END,TK_FUNCTION,line);
+close_func(ls);
+pushclosure(ls,&new_fs,e);
+}
+static int explist1(LexState*ls,expdesc*v){
+int n=1;
+expr(ls,v);
+while(testnext(ls,',')){
+luaK_exp2nextreg(ls->fs,v);
+expr(ls,v);
+n++;
+}
+return n;
+}
+static void funcargs(LexState*ls,expdesc*f){
+FuncState*fs=ls->fs;
+expdesc args;
+int base,nparams;
+int line=ls->linenumber;
+switch(ls->t.token){
+case'(':{
+if(line!=ls->lastline)
+luaX_syntaxerror(ls,"ambiguous syntax (function call x new statement)");
+luaX_next(ls);
+if(ls->t.token==')')
+args.k=VVOID;
+else{
+explist1(ls,&args);
+luaK_setmultret(fs,&args);
+}
+check_match(ls,')','(',line);
+break;
+}
+case'{':{
+constructor(ls,&args);
+break;
+}
+case TK_STRING:{
+codestring(ls,&args,ls->t.seminfo.ts);
+luaX_next(ls);
+break;
+}
+default:{
+luaX_syntaxerror(ls,"function arguments expected");
+return;
+}
+}
+base=f->u.s.info;
+if(hasmultret(args.k))
+nparams=(-1);
+else{
+if(args.k!=VVOID)
+luaK_exp2nextreg(fs,&args);
+nparams=fs->freereg-(base+1);
+}
+init_exp(f,VCALL,luaK_codeABC(fs,OP_CALL,base,nparams+1,2));
+luaK_fixline(fs,line);
+fs->freereg=base+1;
+}
+static void prefixexp(LexState*ls,expdesc*v){
+switch(ls->t.token){
+case'(':{
+int line=ls->linenumber;
+luaX_next(ls);
+expr(ls,v);
+check_match(ls,')','(',line);
+luaK_dischargevars(ls->fs,v);
+return;
+}
+case TK_NAME:{
+singlevar(ls,v);
+return;
+}
+default:{
+luaX_syntaxerror(ls,"unexpected symbol");
+return;
+}
+}
+}
+static void primaryexp(LexState*ls,expdesc*v){
+FuncState*fs=ls->fs;
+prefixexp(ls,v);
+for(;;){
+switch(ls->t.token){
+case'.':{
+field(ls,v);
+break;
+}
+case'[':{
+expdesc key;
+luaK_exp2anyreg(fs,v);
+yindex(ls,&key);
+luaK_indexed(fs,v,&key);
+break;
+}
+case':':{
+expdesc key;
+luaX_next(ls);
+checkname(ls,&key);
+luaK_self(fs,v,&key);
+funcargs(ls,v);
+break;
+}
+case'(':case TK_STRING:case'{':{
+luaK_exp2nextreg(fs,v);
+funcargs(ls,v);
+break;
+}
+default:return;
+}
+}
+}
+static void simpleexp(LexState*ls,expdesc*v){
+switch(ls->t.token){
+case TK_NUMBER:{
+init_exp(v,VKNUM,0);
+v->u.nval=ls->t.seminfo.r;
+break;
+}
+case TK_STRING:{
+codestring(ls,v,ls->t.seminfo.ts);
+break;
+}
+case TK_NIL:{
+init_exp(v,VNIL,0);
+break;
+}
+case TK_TRUE:{
+init_exp(v,VTRUE,0);
+break;
+}
+case TK_FALSE:{
+init_exp(v,VFALSE,0);
+break;
+}
+case TK_DOTS:{
+FuncState*fs=ls->fs;
+check_condition(ls,fs->f->is_vararg,
+"cannot use "LUA_QL("...")" outside a vararg function");
+fs->f->is_vararg&=~4;
+init_exp(v,VVARARG,luaK_codeABC(fs,OP_VARARG,0,1,0));
+break;
+}
+case'{':{
+constructor(ls,v);
+return;
+}
+case TK_FUNCTION:{
+luaX_next(ls);
+body(ls,v,0,ls->linenumber);
+return;
+}
+default:{
+primaryexp(ls,v);
+return;
+}
+}
+luaX_next(ls);
+}
+static UnOpr getunopr(int op){
+switch(op){
+case TK_NOT:return OPR_NOT;
+case'-':return OPR_MINUS;
+case'#':return OPR_LEN;
+default:return OPR_NOUNOPR;
+}
+}
+static BinOpr getbinopr(int op){
+switch(op){
+case'+':return OPR_ADD;
+case'-':return OPR_SUB;
+case'*':return OPR_MUL;
+case'/':return OPR_DIV;
+case'%':return OPR_MOD;
+case'^':return OPR_POW;
+case TK_CONCAT:return OPR_CONCAT;
+case TK_NE:return OPR_NE;
+case TK_EQ:return OPR_EQ;
+case'<':return OPR_LT;
+case TK_LE:return OPR_LE;
+case'>':return OPR_GT;
+case TK_GE:return OPR_GE;
+case TK_AND:return OPR_AND;
+case TK_OR:return OPR_OR;
+default:return OPR_NOBINOPR;
+}
+}
+static const struct{
+lu_byte left;
+lu_byte right;
+}priority[]={
+{6,6},{6,6},{7,7},{7,7},{7,7},
+{10,9},{5,4},
+{3,3},{3,3},
+{3,3},{3,3},{3,3},{3,3},
+{2,2},{1,1}
+};
+static BinOpr subexpr(LexState*ls,expdesc*v,unsigned int limit){
+BinOpr op;
+UnOpr uop;
+enterlevel(ls);
+uop=getunopr(ls->t.token);
+if(uop!=OPR_NOUNOPR){
+luaX_next(ls);
+subexpr(ls,v,8);
+luaK_prefix(ls->fs,uop,v);
+}
+else simpleexp(ls,v);
+op=getbinopr(ls->t.token);
+while(op!=OPR_NOBINOPR&&priority[op].left>limit){
+expdesc v2;
+BinOpr nextop;
+luaX_next(ls);
+luaK_infix(ls->fs,op,v);
+nextop=subexpr(ls,&v2,priority[op].right);
+luaK_posfix(ls->fs,op,v,&v2);
+op=nextop;
+}
+leavelevel(ls);
+return op;
+}
+static void expr(LexState*ls,expdesc*v){
+subexpr(ls,v,0);
+}
+static int block_follow(int token){
+switch(token){
+case TK_ELSE:case TK_ELSEIF:case TK_END:
+case TK_UNTIL:case TK_EOS:
+return 1;
+default:return 0;
+}
+}
+static void block(LexState*ls){
+FuncState*fs=ls->fs;
+BlockCnt bl;
+enterblock(fs,&bl,0);
+chunk(ls);
+leaveblock(fs);
+}
+struct LHS_assign{
+struct LHS_assign*prev;
+expdesc v;
+};
+static void check_conflict(LexState*ls,struct LHS_assign*lh,expdesc*v){
+FuncState*fs=ls->fs;
+int extra=fs->freereg;
+int conflict=0;
+for(;lh;lh=lh->prev){
+if(lh->v.k==VINDEXED){
+if(lh->v.u.s.info==v->u.s.info){
+conflict=1;
+lh->v.u.s.info=extra;
+}
+if(lh->v.u.s.aux==v->u.s.info){
+conflict=1;
+lh->v.u.s.aux=extra;
+}
+}
+}
+if(conflict){
+luaK_codeABC(fs,OP_MOVE,fs->freereg,v->u.s.info,0);
+luaK_reserveregs(fs,1);
+}
+}
+static void assignment(LexState*ls,struct LHS_assign*lh,int nvars){
+expdesc e;
+check_condition(ls,VLOCAL<=lh->v.k&&lh->v.k<=VINDEXED,
+"syntax error");
+if(testnext(ls,',')){
+struct LHS_assign nv;
+nv.prev=lh;
+primaryexp(ls,&nv.v);
+if(nv.v.k==VLOCAL)
+check_conflict(ls,lh,&nv.v);
+luaY_checklimit(ls->fs,nvars,200-ls->L->nCcalls,
+"variables in assignment");
+assignment(ls,&nv,nvars+1);
+}
+else{
+int nexps;
+checknext(ls,'=');
+nexps=explist1(ls,&e);
+if(nexps!=nvars){
+adjust_assign(ls,nvars,nexps,&e);
+if(nexps>nvars)
+ls->fs->freereg-=nexps-nvars;
+}
+else{
+luaK_setoneret(ls->fs,&e);
+luaK_storevar(ls->fs,&lh->v,&e);
+return;
+}
+}
+init_exp(&e,VNONRELOC,ls->fs->freereg-1);
+luaK_storevar(ls->fs,&lh->v,&e);
+}
+static int cond(LexState*ls){
+expdesc v;
+expr(ls,&v);
+if(v.k==VNIL)v.k=VFALSE;
+luaK_goiftrue(ls->fs,&v);
+return v.f;
+}
+static void breakstat(LexState*ls){
+FuncState*fs=ls->fs;
+BlockCnt*bl=fs->bl;
+int upval=0;
+while(bl&&!bl->isbreakable){
+upval|=bl->upval;
+bl=bl->previous;
+}
+if(!bl)
+luaX_syntaxerror(ls,"no loop to break");
+if(upval)
+luaK_codeABC(fs,OP_CLOSE,bl->nactvar,0,0);
+luaK_concat(fs,&bl->breaklist,luaK_jump(fs));
+}
+static void whilestat(LexState*ls,int line){
+FuncState*fs=ls->fs;
+int whileinit;
+int condexit;
+BlockCnt bl;
+luaX_next(ls);
+whileinit=luaK_getlabel(fs);
+condexit=cond(ls);
+enterblock(fs,&bl,1);
+checknext(ls,TK_DO);
+block(ls);
+luaK_patchlist(fs,luaK_jump(fs),whileinit);
+check_match(ls,TK_END,TK_WHILE,line);
+leaveblock(fs);
+luaK_patchtohere(fs,condexit);
+}
+static void repeatstat(LexState*ls,int line){
+int condexit;
+FuncState*fs=ls->fs;
+int repeat_init=luaK_getlabel(fs);
+BlockCnt bl1,bl2;
+enterblock(fs,&bl1,1);
+enterblock(fs,&bl2,0);
+luaX_next(ls);
+chunk(ls);
+check_match(ls,TK_UNTIL,TK_REPEAT,line);
+condexit=cond(ls);
+if(!bl2.upval){
+leaveblock(fs);
+luaK_patchlist(ls->fs,condexit,repeat_init);
+}
+else{
+breakstat(ls);
+luaK_patchtohere(ls->fs,condexit);
+leaveblock(fs);
+luaK_patchlist(ls->fs,luaK_jump(fs),repeat_init);
+}
+leaveblock(fs);
+}
+static int exp1(LexState*ls){
+expdesc e;
+int k;
+expr(ls,&e);
+k=e.k;
+luaK_exp2nextreg(ls->fs,&e);
+return k;
+}
+static void forbody(LexState*ls,int base,int line,int nvars,int isnum){
+BlockCnt bl;
+FuncState*fs=ls->fs;
+int prep,endfor;
+adjustlocalvars(ls,3);
+checknext(ls,TK_DO);
+prep=isnum?luaK_codeAsBx(fs,OP_FORPREP,base,(-1)):luaK_jump(fs);
+enterblock(fs,&bl,0);
+adjustlocalvars(ls,nvars);
+luaK_reserveregs(fs,nvars);
+block(ls);
+leaveblock(fs);
+luaK_patchtohere(fs,prep);
+endfor=(isnum)?luaK_codeAsBx(fs,OP_FORLOOP,base,(-1)):
+luaK_codeABC(fs,OP_TFORLOOP,base,0,nvars);
+luaK_fixline(fs,line);
+luaK_patchlist(fs,(isnum?endfor:luaK_jump(fs)),prep+1);
+}
+static void fornum(LexState*ls,TString*varname,int line){
+FuncState*fs=ls->fs;
+int base=fs->freereg;
+new_localvarliteral(ls,"(for index)",0);
+new_localvarliteral(ls,"(for limit)",1);
+new_localvarliteral(ls,"(for step)",2);
+new_localvar(ls,varname,3);
+checknext(ls,'=');
+exp1(ls);
+checknext(ls,',');
+exp1(ls);
+if(testnext(ls,','))
+exp1(ls);
+else{
+luaK_codeABx(fs,OP_LOADK,fs->freereg,luaK_numberK(fs,1));
+luaK_reserveregs(fs,1);
+}
+forbody(ls,base,line,1,1);
+}
+static void forlist(LexState*ls,TString*indexname){
+FuncState*fs=ls->fs;
+expdesc e;
+int nvars=0;
+int line;
+int base=fs->freereg;
+new_localvarliteral(ls,"(for generator)",nvars++);
+new_localvarliteral(ls,"(for state)",nvars++);
+new_localvarliteral(ls,"(for control)",nvars++);
+new_localvar(ls,indexname,nvars++);
+while(testnext(ls,','))
+new_localvar(ls,str_checkname(ls),nvars++);
+checknext(ls,TK_IN);
+line=ls->linenumber;
+adjust_assign(ls,3,explist1(ls,&e),&e);
+luaK_checkstack(fs,3);
+forbody(ls,base,line,nvars-3,0);
+}
+static void forstat(LexState*ls,int line){
+FuncState*fs=ls->fs;
+TString*varname;
+BlockCnt bl;
+enterblock(fs,&bl,1);
+luaX_next(ls);
+varname=str_checkname(ls);
+switch(ls->t.token){
+case'=':fornum(ls,varname,line);break;
+case',':case TK_IN:forlist(ls,varname);break;
+default:luaX_syntaxerror(ls,LUA_QL("=")" or "LUA_QL("in")" expected");
+}
+check_match(ls,TK_END,TK_FOR,line);
+leaveblock(fs);
+}
+static int test_then_block(LexState*ls){
+int condexit;
+luaX_next(ls);
+condexit=cond(ls);
+checknext(ls,TK_THEN);
+block(ls);
+return condexit;
+}
+static void ifstat(LexState*ls,int line){
+FuncState*fs=ls->fs;
+int flist;
+int escapelist=(-1);
+flist=test_then_block(ls);
+while(ls->t.token==TK_ELSEIF){
+luaK_concat(fs,&escapelist,luaK_jump(fs));
+luaK_patchtohere(fs,flist);
+flist=test_then_block(ls);
+}
+if(ls->t.token==TK_ELSE){
+luaK_concat(fs,&escapelist,luaK_jump(fs));
+luaK_patchtohere(fs,flist);
+luaX_next(ls);
+block(ls);
+}
+else
+luaK_concat(fs,&escapelist,flist);
+luaK_patchtohere(fs,escapelist);
+check_match(ls,TK_END,TK_IF,line);
+}
+static void localfunc(LexState*ls){
+expdesc v,b;
+FuncState*fs=ls->fs;
+new_localvar(ls,str_checkname(ls),0);
+init_exp(&v,VLOCAL,fs->freereg);
+luaK_reserveregs(fs,1);
+adjustlocalvars(ls,1);
+body(ls,&b,0,ls->linenumber);
+luaK_storevar(fs,&v,&b);
+getlocvar(fs,fs->nactvar-1).startpc=fs->pc;
+}
+static void localstat(LexState*ls){
+int nvars=0;
+int nexps;
+expdesc e;
+do{
+new_localvar(ls,str_checkname(ls),nvars++);
+}while(testnext(ls,','));
+if(testnext(ls,'='))
+nexps=explist1(ls,&e);
+else{
+e.k=VVOID;
+nexps=0;
+}
+adjust_assign(ls,nvars,nexps,&e);
+adjustlocalvars(ls,nvars);
+}
+static int funcname(LexState*ls,expdesc*v){
+int needself=0;
+singlevar(ls,v);
+while(ls->t.token=='.')
+field(ls,v);
+if(ls->t.token==':'){
+needself=1;
+field(ls,v);
+}
+return needself;
+}
+static void funcstat(LexState*ls,int line){
+int needself;
+expdesc v,b;
+luaX_next(ls);
+needself=funcname(ls,&v);
+body(ls,&b,needself,line);
+luaK_storevar(ls->fs,&v,&b);
+luaK_fixline(ls->fs,line);
+}
+static void exprstat(LexState*ls){
+FuncState*fs=ls->fs;
+struct LHS_assign v;
+primaryexp(ls,&v.v);
+if(v.v.k==VCALL)
+SETARG_C(getcode(fs,&v.v),1);
+else{
+v.prev=NULL;
+assignment(ls,&v,1);
+}
+}
+static void retstat(LexState*ls){
+FuncState*fs=ls->fs;
+expdesc e;
+int first,nret;
+luaX_next(ls);
+if(block_follow(ls->t.token)||ls->t.token==';')
+first=nret=0;
+else{
+nret=explist1(ls,&e);
+if(hasmultret(e.k)){
+luaK_setmultret(fs,&e);
+if(e.k==VCALL&&nret==1){
+SET_OPCODE(getcode(fs,&e),OP_TAILCALL);
+}
+first=fs->nactvar;
+nret=(-1);
+}
+else{
+if(nret==1)
+first=luaK_exp2anyreg(fs,&e);
+else{
+luaK_exp2nextreg(fs,&e);
+first=fs->nactvar;
+}
+}
+}
+luaK_ret(fs,first,nret);
+}
+static int statement(LexState*ls){
+int line=ls->linenumber;
+switch(ls->t.token){
+case TK_IF:{
+ifstat(ls,line);
+return 0;
+}
+case TK_WHILE:{
+whilestat(ls,line);
+return 0;
+}
+case TK_DO:{
+luaX_next(ls);
+block(ls);
+check_match(ls,TK_END,TK_DO,line);
+return 0;
+}
+case TK_FOR:{
+forstat(ls,line);
+return 0;
+}
+case TK_REPEAT:{
+repeatstat(ls,line);
+return 0;
+}
+case TK_FUNCTION:{
+funcstat(ls,line);
+return 0;
+}
+case TK_LOCAL:{
+luaX_next(ls);
+if(testnext(ls,TK_FUNCTION))
+localfunc(ls);
+else
+localstat(ls);
+return 0;
+}
+case TK_RETURN:{
+retstat(ls);
+return 1;
+}
+case TK_BREAK:{
+luaX_next(ls);
+breakstat(ls);
+return 1;
+}
+default:{
+exprstat(ls);
+return 0;
+}
+}
+}
+static void chunk(LexState*ls){
+int islast=0;
+enterlevel(ls);
+while(!islast&&!block_follow(ls->t.token)){
+islast=statement(ls);
+testnext(ls,';');
+ls->fs->freereg=ls->fs->nactvar;
+}
+leavelevel(ls);
+}
+static const TValue*luaV_tonumber(const TValue*obj,TValue*n){
+lua_Number num;
+if(ttisnumber(obj))return obj;
+if(ttisstring(obj)&&luaO_str2d(svalue(obj),&num)){
+setnvalue(n,num);
+return n;
+}
+else
+return NULL;
+}
+static int luaV_tostring(lua_State*L,StkId obj){
+if(!ttisnumber(obj))
+return 0;
+else{
+char s[32];
+lua_Number n=nvalue(obj);
+lua_number2str(s,n);
+setsvalue(L,obj,luaS_new(L,s));
+return 1;
+}
+}
+static void callTMres(lua_State*L,StkId res,const TValue*f,
+const TValue*p1,const TValue*p2){
+ptrdiff_t result=savestack(L,res);
+setobj(L,L->top,f);
+setobj(L,L->top+1,p1);
+setobj(L,L->top+2,p2);
+luaD_checkstack(L,3);
+L->top+=3;
+luaD_call(L,L->top-3,1);
+res=restorestack(L,result);
+L->top--;
+setobj(L,res,L->top);
+}
+static void callTM(lua_State*L,const TValue*f,const TValue*p1,
+const TValue*p2,const TValue*p3){
+setobj(L,L->top,f);
+setobj(L,L->top+1,p1);
+setobj(L,L->top+2,p2);
+setobj(L,L->top+3,p3);
+luaD_checkstack(L,4);
+L->top+=4;
+luaD_call(L,L->top-4,0);
+}
+static void luaV_gettable(lua_State*L,const TValue*t,TValue*key,StkId val){
+int loop;
+for(loop=0;loop<100;loop++){
+const TValue*tm;
+if(ttistable(t)){
+Table*h=hvalue(t);
+const TValue*res=luaH_get(h,key);
+if(!ttisnil(res)||
+(tm=fasttm(L,h->metatable,TM_INDEX))==NULL){
+setobj(L,val,res);
+return;
+}
+}
+else if(ttisnil(tm=luaT_gettmbyobj(L,t,TM_INDEX)))
+luaG_typeerror(L,t,"index");
+if(ttisfunction(tm)){
+callTMres(L,val,tm,t,key);
+return;
+}
+t=tm;
+}
+luaG_runerror(L,"loop in gettable");
+}
+static void luaV_settable(lua_State*L,const TValue*t,TValue*key,StkId val){
+int loop;
+TValue temp;
+for(loop=0;loop<100;loop++){
+const TValue*tm;
+if(ttistable(t)){
+Table*h=hvalue(t);
+TValue*oldval=luaH_set(L,h,key);
+if(!ttisnil(oldval)||
+(tm=fasttm(L,h->metatable,TM_NEWINDEX))==NULL){
+setobj(L,oldval,val);
+h->flags=0;
+luaC_barriert(L,h,val);
+return;
+}
+}
+else if(ttisnil(tm=luaT_gettmbyobj(L,t,TM_NEWINDEX)))
+luaG_typeerror(L,t,"index");
+if(ttisfunction(tm)){
+callTM(L,tm,t,key,val);
+return;
+}
+setobj(L,&temp,tm);
+t=&temp;
+}
+luaG_runerror(L,"loop in settable");
+}
+static int call_binTM(lua_State*L,const TValue*p1,const TValue*p2,
+StkId res,TMS event){
+const TValue*tm=luaT_gettmbyobj(L,p1,event);
+if(ttisnil(tm))
+tm=luaT_gettmbyobj(L,p2,event);
+if(ttisnil(tm))return 0;
+callTMres(L,res,tm,p1,p2);
+return 1;
+}
+static const TValue*get_compTM(lua_State*L,Table*mt1,Table*mt2,
+TMS event){
+const TValue*tm1=fasttm(L,mt1,event);
+const TValue*tm2;
+if(tm1==NULL)return NULL;
+if(mt1==mt2)return tm1;
+tm2=fasttm(L,mt2,event);
+if(tm2==NULL)return NULL;
+if(luaO_rawequalObj(tm1,tm2))
+return tm1;
+return NULL;
+}
+static int call_orderTM(lua_State*L,const TValue*p1,const TValue*p2,
+TMS event){
+const TValue*tm1=luaT_gettmbyobj(L,p1,event);
+const TValue*tm2;
+if(ttisnil(tm1))return-1;
+tm2=luaT_gettmbyobj(L,p2,event);
+if(!luaO_rawequalObj(tm1,tm2))
+return-1;
+callTMres(L,L->top,tm1,p1,p2);
+return!l_isfalse(L->top);
+}
+static int l_strcmp(const TString*ls,const TString*rs){
+const char*l=getstr(ls);
+size_t ll=ls->tsv.len;
+const char*r=getstr(rs);
+size_t lr=rs->tsv.len;
+for(;;){
+int temp=strcoll(l,r);
+if(temp!=0)return temp;
+else{
+size_t len=strlen(l);
+if(len==lr)
+return(len==ll)?0:1;
+else if(len==ll)
+return-1;
+len++;
+l+=len;ll-=len;r+=len;lr-=len;
+}
+}
+}
+static int luaV_lessthan(lua_State*L,const TValue*l,const TValue*r){
+int res;
+if(ttype(l)!=ttype(r))
+return luaG_ordererror(L,l,r);
+else if(ttisnumber(l))
+return luai_numlt(nvalue(l),nvalue(r));
+else if(ttisstring(l))
+return l_strcmp(rawtsvalue(l),rawtsvalue(r))<0;
+else if((res=call_orderTM(L,l,r,TM_LT))!=-1)
+return res;
+return luaG_ordererror(L,l,r);
+}
+static int lessequal(lua_State*L,const TValue*l,const TValue*r){
+int res;
+if(ttype(l)!=ttype(r))
+return luaG_ordererror(L,l,r);
+else if(ttisnumber(l))
+return luai_numle(nvalue(l),nvalue(r));
+else if(ttisstring(l))
+return l_strcmp(rawtsvalue(l),rawtsvalue(r))<=0;
+else if((res=call_orderTM(L,l,r,TM_LE))!=-1)
+return res;
+else if((res=call_orderTM(L,r,l,TM_LT))!=-1)
+return!res;
+return luaG_ordererror(L,l,r);
+}
+static int luaV_equalval(lua_State*L,const TValue*t1,const TValue*t2){
+const TValue*tm;
+switch(ttype(t1)){
+case 0:return 1;
+case 3:return luai_numeq(nvalue(t1),nvalue(t2));
+case 1:return bvalue(t1)==bvalue(t2);
+case 2:return pvalue(t1)==pvalue(t2);
+case 7:{
+if(uvalue(t1)==uvalue(t2))return 1;
+tm=get_compTM(L,uvalue(t1)->metatable,uvalue(t2)->metatable,
+TM_EQ);
+break;
+}
+case 5:{
+if(hvalue(t1)==hvalue(t2))return 1;
+tm=get_compTM(L,hvalue(t1)->metatable,hvalue(t2)->metatable,TM_EQ);
+break;
+}
+default:return gcvalue(t1)==gcvalue(t2);
+}
+if(tm==NULL)return 0;
+callTMres(L,L->top,tm,t1,t2);
+return!l_isfalse(L->top);
+}
+static void luaV_concat(lua_State*L,int total,int last){
+do{
+StkId top=L->base+last+1;
+int n=2;
+if(!(ttisstring(top-2)||ttisnumber(top-2))||!tostring(L,top-1)){
+if(!call_binTM(L,top-2,top-1,top-2,TM_CONCAT))
+luaG_concaterror(L,top-2,top-1);
+}else if(tsvalue(top-1)->len==0)
+(void)tostring(L,top-2);
+else{
+size_t tl=tsvalue(top-1)->len;
+char*buffer;
+int i;
+for(n=1;n<total&&tostring(L,top-n-1);n++){
+size_t l=tsvalue(top-n-1)->len;
+if(l>=((size_t)(~(size_t)0)-2)-tl)luaG_runerror(L,"string length overflow");
+tl+=l;
+}
+buffer=luaZ_openspace(L,&G(L)->buff,tl);
+tl=0;
+for(i=n;i>0;i--){
+size_t l=tsvalue(top-i)->len;
+memcpy(buffer+tl,svalue(top-i),l);
+tl+=l;
+}
+setsvalue(L,top-n,luaS_newlstr(L,buffer,tl));
+}
+total-=n-1;
+last-=n-1;
+}while(total>1);
+}
+static void Arith(lua_State*L,StkId ra,const TValue*rb,
+const TValue*rc,TMS op){
+TValue tempb,tempc;
+const TValue*b,*c;
+if((b=luaV_tonumber(rb,&tempb))!=NULL&&
+(c=luaV_tonumber(rc,&tempc))!=NULL){
+lua_Number nb=nvalue(b),nc=nvalue(c);
+switch(op){
+case TM_ADD:setnvalue(ra,luai_numadd(nb,nc));break;
+case TM_SUB:setnvalue(ra,luai_numsub(nb,nc));break;
+case TM_MUL:setnvalue(ra,luai_nummul(nb,nc));break;
+case TM_DIV:setnvalue(ra,luai_numdiv(nb,nc));break;
+case TM_MOD:setnvalue(ra,luai_nummod(nb,nc));break;
+case TM_POW:setnvalue(ra,luai_numpow(nb,nc));break;
+case TM_UNM:setnvalue(ra,luai_numunm(nb));break;
+default:break;
+}
+}
+else if(!call_binTM(L,rb,rc,ra,op))
+luaG_aritherror(L,rb,rc);
+}
+#define runtime_check(L,c){if(!(c))break;}
+#define RA(i)(base+GETARG_A(i))
+#define RB(i)check_exp(getBMode(GET_OPCODE(i))==OpArgR,base+GETARG_B(i))
+#define RKB(i)check_exp(getBMode(GET_OPCODE(i))==OpArgK,ISK(GETARG_B(i))?k+INDEXK(GETARG_B(i)):base+GETARG_B(i))
+#define RKC(i)check_exp(getCMode(GET_OPCODE(i))==OpArgK,ISK(GETARG_C(i))?k+INDEXK(GETARG_C(i)):base+GETARG_C(i))
+#define KBx(i)check_exp(getBMode(GET_OPCODE(i))==OpArgK,k+GETARG_Bx(i))
+#define dojump(L,pc,i){(pc)+=(i);}
+#define Protect(x){L->savedpc=pc;{x;};base=L->base;}
+#define arith_op(op,tm){TValue*rb=RKB(i);TValue*rc=RKC(i);if(ttisnumber(rb)&&ttisnumber(rc)){lua_Number nb=nvalue(rb),nc=nvalue(rc);setnvalue(ra,op(nb,nc));}else Protect(Arith(L,ra,rb,rc,tm));}
+static void luaV_execute(lua_State*L,int nexeccalls){
+LClosure*cl;
+StkId base;
+TValue*k;
+const Instruction*pc;
+reentry:
+pc=L->savedpc;
+cl=&clvalue(L->ci->func)->l;
+base=L->base;
+k=cl->p->k;
+for(;;){
+const Instruction i=*pc++;
+StkId ra;
+ra=RA(i);
+switch(GET_OPCODE(i)){
+case OP_MOVE:{
+setobj(L,ra,RB(i));
+continue;
+}
+case OP_LOADK:{
+setobj(L,ra,KBx(i));
+continue;
+}
+case OP_LOADBOOL:{
+setbvalue(ra,GETARG_B(i));
+if(GETARG_C(i))pc++;
+continue;
+}
+case OP_LOADNIL:{
+TValue*rb=RB(i);
+do{
+setnilvalue(rb--);
+}while(rb>=ra);
+continue;
+}
+case OP_GETUPVAL:{
+int b=GETARG_B(i);
+setobj(L,ra,cl->upvals[b]->v);
+continue;
+}
+case OP_GETGLOBAL:{
+TValue g;
+TValue*rb=KBx(i);
+sethvalue(L,&g,cl->env);
+Protect(luaV_gettable(L,&g,rb,ra));
+continue;
+}
+case OP_GETTABLE:{
+Protect(luaV_gettable(L,RB(i),RKC(i),ra));
+continue;
+}
+case OP_SETGLOBAL:{
+TValue g;
+sethvalue(L,&g,cl->env);
+Protect(luaV_settable(L,&g,KBx(i),ra));
+continue;
+}
+case OP_SETUPVAL:{
+UpVal*uv=cl->upvals[GETARG_B(i)];
+setobj(L,uv->v,ra);
+luaC_barrier(L,uv,ra);
+continue;
+}
+case OP_SETTABLE:{
+Protect(luaV_settable(L,ra,RKB(i),RKC(i)));
+continue;
+}
+case OP_NEWTABLE:{
+int b=GETARG_B(i);
+int c=GETARG_C(i);
+sethvalue(L,ra,luaH_new(L,luaO_fb2int(b),luaO_fb2int(c)));
+Protect(luaC_checkGC(L));
+continue;
+}
+case OP_SELF:{
+StkId rb=RB(i);
+setobj(L,ra+1,rb);
+Protect(luaV_gettable(L,rb,RKC(i),ra));
+continue;
+}
+case OP_ADD:{
+arith_op(luai_numadd,TM_ADD);
+continue;
+}
+case OP_SUB:{
+arith_op(luai_numsub,TM_SUB);
+continue;
+}
+case OP_MUL:{
+arith_op(luai_nummul,TM_MUL);
+continue;
+}
+case OP_DIV:{
+arith_op(luai_numdiv,TM_DIV);
+continue;
+}
+case OP_MOD:{
+arith_op(luai_nummod,TM_MOD);
+continue;
+}
+case OP_POW:{
+arith_op(luai_numpow,TM_POW);
+continue;
+}
+case OP_UNM:{
+TValue*rb=RB(i);
+if(ttisnumber(rb)){
+lua_Number nb=nvalue(rb);
+setnvalue(ra,luai_numunm(nb));
+}
+else{
+Protect(Arith(L,ra,rb,rb,TM_UNM));
+}
+continue;
+}
+case OP_NOT:{
+int res=l_isfalse(RB(i));
+setbvalue(ra,res);
+continue;
+}
+case OP_LEN:{
+const TValue*rb=RB(i);
+switch(ttype(rb)){
+case 5:{
+setnvalue(ra,cast_num(luaH_getn(hvalue(rb))));
+break;
+}
+case 4:{
+setnvalue(ra,cast_num(tsvalue(rb)->len));
+break;
+}
+default:{
+Protect(
+if(!call_binTM(L,rb,(&luaO_nilobject_),ra,TM_LEN))
+luaG_typeerror(L,rb,"get length of");
+)
+}
+}
+continue;
+}
+case OP_CONCAT:{
+int b=GETARG_B(i);
+int c=GETARG_C(i);
+Protect(luaV_concat(L,c-b+1,c);luaC_checkGC(L));
+setobj(L,RA(i),base+b);
+continue;
+}
+case OP_JMP:{
+dojump(L,pc,GETARG_sBx(i));
+continue;
+}
+case OP_EQ:{
+TValue*rb=RKB(i);
+TValue*rc=RKC(i);
+Protect(
+if(equalobj(L,rb,rc)==GETARG_A(i))
+dojump(L,pc,GETARG_sBx(*pc));
+)
+pc++;
+continue;
+}
+case OP_LT:{
+Protect(
+if(luaV_lessthan(L,RKB(i),RKC(i))==GETARG_A(i))
+dojump(L,pc,GETARG_sBx(*pc));
+)
+pc++;
+continue;
+}
+case OP_LE:{
+Protect(
+if(lessequal(L,RKB(i),RKC(i))==GETARG_A(i))
+dojump(L,pc,GETARG_sBx(*pc));
+)
+pc++;
+continue;
+}
+case OP_TEST:{
+if(l_isfalse(ra)!=GETARG_C(i))
+dojump(L,pc,GETARG_sBx(*pc));
+pc++;
+continue;
+}
+case OP_TESTSET:{
+TValue*rb=RB(i);
+if(l_isfalse(rb)!=GETARG_C(i)){
+setobj(L,ra,rb);
+dojump(L,pc,GETARG_sBx(*pc));
+}
+pc++;
+continue;
+}
+case OP_CALL:{
+int b=GETARG_B(i);
+int nresults=GETARG_C(i)-1;
+if(b!=0)L->top=ra+b;
+L->savedpc=pc;
+switch(luaD_precall(L,ra,nresults)){
+case 0:{
+nexeccalls++;
+goto reentry;
+}
+case 1:{
+if(nresults>=0)L->top=L->ci->top;
+base=L->base;
+continue;
+}
+default:{
+return;
+}
+}
+}
+case OP_TAILCALL:{
+int b=GETARG_B(i);
+if(b!=0)L->top=ra+b;
+L->savedpc=pc;
+switch(luaD_precall(L,ra,(-1))){
+case 0:{
+CallInfo*ci=L->ci-1;
+int aux;
+StkId func=ci->func;
+StkId pfunc=(ci+1)->func;
+if(L->openupval)luaF_close(L,ci->base);
+L->base=ci->base=ci->func+((ci+1)->base-pfunc);
+for(aux=0;pfunc+aux<L->top;aux++)
+setobj(L,func+aux,pfunc+aux);
+ci->top=L->top=func+aux;
+ci->savedpc=L->savedpc;
+ci->tailcalls++;
+L->ci--;
+goto reentry;
+}
+case 1:{
+base=L->base;
+continue;
+}
+default:{
+return;
+}
+}
+}
+case OP_RETURN:{
+int b=GETARG_B(i);
+if(b!=0)L->top=ra+b-1;
+if(L->openupval)luaF_close(L,base);
+L->savedpc=pc;
+b=luaD_poscall(L,ra);
+if(--nexeccalls==0)
+return;
+else{
+if(b)L->top=L->ci->top;
+goto reentry;
+}
+}
+case OP_FORLOOP:{
+lua_Number step=nvalue(ra+2);
+lua_Number idx=luai_numadd(nvalue(ra),step);
+lua_Number limit=nvalue(ra+1);
+if(luai_numlt(0,step)?luai_numle(idx,limit)
+:luai_numle(limit,idx)){
+dojump(L,pc,GETARG_sBx(i));
+setnvalue(ra,idx);
+setnvalue(ra+3,idx);
+}
+continue;
+}
+case OP_FORPREP:{
+const TValue*init=ra;
+const TValue*plimit=ra+1;
+const TValue*pstep=ra+2;
+L->savedpc=pc;
+if(!tonumber(init,ra))
+luaG_runerror(L,LUA_QL("for")" initial value must be a number");
+else if(!tonumber(plimit,ra+1))
+luaG_runerror(L,LUA_QL("for")" limit must be a number");
+else if(!tonumber(pstep,ra+2))
+luaG_runerror(L,LUA_QL("for")" step must be a number");
+setnvalue(ra,luai_numsub(nvalue(ra),nvalue(pstep)));
+dojump(L,pc,GETARG_sBx(i));
+continue;
+}
+case OP_TFORLOOP:{
+StkId cb=ra+3;
+setobj(L,cb+2,ra+2);
+setobj(L,cb+1,ra+1);
+setobj(L,cb,ra);
+L->top=cb+3;
+Protect(luaD_call(L,cb,GETARG_C(i)));
+L->top=L->ci->top;
+cb=RA(i)+3;
+if(!ttisnil(cb)){
+setobj(L,cb-1,cb);
+dojump(L,pc,GETARG_sBx(*pc));
+}
+pc++;
+continue;
+}
+case OP_SETLIST:{
+int n=GETARG_B(i);
+int c=GETARG_C(i);
+int last;
+Table*h;
+if(n==0){
+n=cast_int(L->top-ra)-1;
+L->top=L->ci->top;
+}
+if(c==0)c=cast_int(*pc++);
+runtime_check(L,ttistable(ra));
+h=hvalue(ra);
+last=((c-1)*50)+n;
+if(last>h->sizearray)
+luaH_resizearray(L,h,last);
+for(;n>0;n--){
+TValue*val=ra+n;
+setobj(L,luaH_setnum(L,h,last--),val);
+luaC_barriert(L,h,val);
+}
+continue;
+}
+case OP_CLOSE:{
+luaF_close(L,ra);
+continue;
+}
+case OP_CLOSURE:{
+Proto*p;
+Closure*ncl;
+int nup,j;
+p=cl->p->p[GETARG_Bx(i)];
+nup=p->nups;
+ncl=luaF_newLclosure(L,nup,cl->env);
+ncl->l.p=p;
+for(j=0;j<nup;j++,pc++){
+if(GET_OPCODE(*pc)==OP_GETUPVAL)
+ncl->l.upvals[j]=cl->upvals[GETARG_B(*pc)];
+else{
+ncl->l.upvals[j]=luaF_findupval(L,base+GETARG_B(*pc));
+}
+}
+setclvalue(L,ra,ncl);
+Protect(luaC_checkGC(L));
+continue;
+}
+case OP_VARARG:{
+int b=GETARG_B(i)-1;
+int j;
+CallInfo*ci=L->ci;
+int n=cast_int(ci->base-ci->func)-cl->p->numparams-1;
+if(b==(-1)){
+Protect(luaD_checkstack(L,n));
+ra=RA(i);
+b=n;
+L->top=ra+n;
+}
+for(j=0;j<b;j++){
+if(j<n){
+setobj(L,ra+j,ci->base-n+j);
+}
+else{
+setnilvalue(ra+j);
+}
+}
+continue;
+}
+}
+}
+}
+#define api_checknelems(L,n)luai_apicheck(L,(n)<=(L->top-L->base))
+#define api_checkvalidindex(L,i)luai_apicheck(L,(i)!=(&luaO_nilobject_))
+#define api_incr_top(L){luai_apicheck(L,L->top<L->ci->top);L->top++;}
+static TValue*index2adr(lua_State*L,int idx){
+if(idx>0){
+TValue*o=L->base+(idx-1);
+luai_apicheck(L,idx<=L->ci->top-L->base);
+if(o>=L->top)return cast(TValue*,(&luaO_nilobject_));
+else return o;
+}
+else if(idx>(-10000)){
+luai_apicheck(L,idx!=0&&-idx<=L->top-L->base);
+return L->top+idx;
+}
+else switch(idx){
+case(-10000):return registry(L);
+case(-10001):{
+Closure*func=curr_func(L);
+sethvalue(L,&L->env,func->c.env);
+return&L->env;
+}
+case(-10002):return gt(L);
+default:{
+Closure*func=curr_func(L);
+idx=(-10002)-idx;
+return(idx<=func->c.nupvalues)
+?&func->c.upvalue[idx-1]
+:cast(TValue*,(&luaO_nilobject_));
+}
+}
+}
+static Table*getcurrenv(lua_State*L){
+if(L->ci==L->base_ci)
+return hvalue(gt(L));
+else{
+Closure*func=curr_func(L);
+return func->c.env;
+}
+}
+static int lua_checkstack(lua_State*L,int size){
+int res=1;
+if(size>8000||(L->top-L->base+size)>8000)
+res=0;
+else if(size>0){
+luaD_checkstack(L,size);
+if(L->ci->top<L->top+size)
+L->ci->top=L->top+size;
+}
+return res;
+}
+static lua_CFunction lua_atpanic(lua_State*L,lua_CFunction panicf){
+lua_CFunction old;
+old=G(L)->panic;
+G(L)->panic=panicf;
+return old;
+}
+static int lua_gettop(lua_State*L){
+return cast_int(L->top-L->base);
+}
+static void lua_settop(lua_State*L,int idx){
+if(idx>=0){
+luai_apicheck(L,idx<=L->stack_last-L->base);
+while(L->top<L->base+idx)
+setnilvalue(L->top++);
+L->top=L->base+idx;
+}
+else{
+luai_apicheck(L,-(idx+1)<=(L->top-L->base));
+L->top+=idx+1;
+}
+}
+static void lua_remove(lua_State*L,int idx){
+StkId p;
+p=index2adr(L,idx);
+api_checkvalidindex(L,p);
+while(++p<L->top)setobj(L,p-1,p);
+L->top--;
+}
+static void lua_insert(lua_State*L,int idx){
+StkId p;
+StkId q;
+p=index2adr(L,idx);
+api_checkvalidindex(L,p);
+for(q=L->top;q>p;q--)setobj(L,q,q-1);
+setobj(L,p,L->top);
+}
+static void lua_replace(lua_State*L,int idx){
+StkId o;
+if(idx==(-10001)&&L->ci==L->base_ci)
+luaG_runerror(L,"no calling environment");
+api_checknelems(L,1);
+o=index2adr(L,idx);
+api_checkvalidindex(L,o);
+if(idx==(-10001)){
+Closure*func=curr_func(L);
+luai_apicheck(L,ttistable(L->top-1));
+func->c.env=hvalue(L->top-1);
+luaC_barrier(L,func,L->top-1);
+}
+else{
+setobj(L,o,L->top-1);
+if(idx<(-10002))
+luaC_barrier(L,curr_func(L),L->top-1);
+}
+L->top--;
+}
+static void lua_pushvalue(lua_State*L,int idx){
+setobj(L,L->top,index2adr(L,idx));
+api_incr_top(L);
+}
+static int lua_type(lua_State*L,int idx){
+StkId o=index2adr(L,idx);
+return(o==(&luaO_nilobject_))?(-1):ttype(o);
+}
+static const char*lua_typename(lua_State*L,int t){
+UNUSED(L);
+return(t==(-1))?"no value":luaT_typenames[t];
+}
+static int lua_iscfunction(lua_State*L,int idx){
+StkId o=index2adr(L,idx);
+return iscfunction(o);
+}
+static int lua_isnumber(lua_State*L,int idx){
+TValue n;
+const TValue*o=index2adr(L,idx);
+return tonumber(o,&n);
+}
+static int lua_isstring(lua_State*L,int idx){
+int t=lua_type(L,idx);
+return(t==4||t==3);
+}
+static int lua_rawequal(lua_State*L,int index1,int index2){
+StkId o1=index2adr(L,index1);
+StkId o2=index2adr(L,index2);
+return(o1==(&luaO_nilobject_)||o2==(&luaO_nilobject_))?0
+:luaO_rawequalObj(o1,o2);
+}
+static int lua_lessthan(lua_State*L,int index1,int index2){
+StkId o1,o2;
+int i;
+o1=index2adr(L,index1);
+o2=index2adr(L,index2);
+i=(o1==(&luaO_nilobject_)||o2==(&luaO_nilobject_))?0
+:luaV_lessthan(L,o1,o2);
+return i;
+}
+static lua_Number lua_tonumber(lua_State*L,int idx){
+TValue n;
+const TValue*o=index2adr(L,idx);
+if(tonumber(o,&n))
+return nvalue(o);
+else
+return 0;
+}
+static lua_Integer lua_tointeger(lua_State*L,int idx){
+TValue n;
+const TValue*o=index2adr(L,idx);
+if(tonumber(o,&n)){
+lua_Integer res;
+lua_Number num=nvalue(o);
+lua_number2integer(res,num);
+return res;
+}
+else
+return 0;
+}
+static int lua_toboolean(lua_State*L,int idx){
+const TValue*o=index2adr(L,idx);
+return!l_isfalse(o);
+}
+static const char*lua_tolstring(lua_State*L,int idx,size_t*len){
+StkId o=index2adr(L,idx);
+if(!ttisstring(o)){
+if(!luaV_tostring(L,o)){
+if(len!=NULL)*len=0;
+return NULL;
+}
+luaC_checkGC(L);
+o=index2adr(L,idx);
+}
+if(len!=NULL)*len=tsvalue(o)->len;
+return svalue(o);
+}
+static size_t lua_objlen(lua_State*L,int idx){
+StkId o=index2adr(L,idx);
+switch(ttype(o)){
+case 4:return tsvalue(o)->len;
+case 7:return uvalue(o)->len;
+case 5:return luaH_getn(hvalue(o));
+case 3:{
+size_t l;
+l=(luaV_tostring(L,o)?tsvalue(o)->len:0);
+return l;
+}
+default:return 0;
+}
+}
+static lua_CFunction lua_tocfunction(lua_State*L,int idx){
+StkId o=index2adr(L,idx);
+return(!iscfunction(o))?NULL:clvalue(o)->c.f;
+}
+static void*lua_touserdata(lua_State*L,int idx){
+StkId o=index2adr(L,idx);
+switch(ttype(o)){
+case 7:return(rawuvalue(o)+1);
+case 2:return pvalue(o);
+default:return NULL;
+}
+}
+static void lua_pushnil(lua_State*L){
+setnilvalue(L->top);
+api_incr_top(L);
+}
+static void lua_pushnumber(lua_State*L,lua_Number n){
+setnvalue(L->top,n);
+api_incr_top(L);
+}
+static void lua_pushinteger(lua_State*L,lua_Integer n){
+setnvalue(L->top,cast_num(n));
+api_incr_top(L);
+}
+static void lua_pushlstring(lua_State*L,const char*s,size_t len){
+luaC_checkGC(L);
+setsvalue(L,L->top,luaS_newlstr(L,s,len));
+api_incr_top(L);
+}
+static void lua_pushstring(lua_State*L,const char*s){
+if(s==NULL)
+lua_pushnil(L);
+else
+lua_pushlstring(L,s,strlen(s));
+}
+static const char*lua_pushvfstring(lua_State*L,const char*fmt,
+va_list argp){
+const char*ret;
+luaC_checkGC(L);
+ret=luaO_pushvfstring(L,fmt,argp);
+return ret;
+}
+static const char*lua_pushfstring(lua_State*L,const char*fmt,...){
+const char*ret;
+va_list argp;
+luaC_checkGC(L);
+va_start(argp,fmt);
+ret=luaO_pushvfstring(L,fmt,argp);
+va_end(argp);
+return ret;
+}
+static void lua_pushcclosure(lua_State*L,lua_CFunction fn,int n){
+Closure*cl;
+luaC_checkGC(L);
+api_checknelems(L,n);
+cl=luaF_newCclosure(L,n,getcurrenv(L));
+cl->c.f=fn;
+L->top-=n;
+while(n--)
+setobj(L,&cl->c.upvalue[n],L->top+n);
+setclvalue(L,L->top,cl);
+api_incr_top(L);
+}
+static void lua_pushboolean(lua_State*L,int b){
+setbvalue(L->top,(b!=0));
+api_incr_top(L);
+}
+static int lua_pushthread(lua_State*L){
+setthvalue(L,L->top,L);
+api_incr_top(L);
+return(G(L)->mainthread==L);
+}
+static void lua_gettable(lua_State*L,int idx){
+StkId t;
+t=index2adr(L,idx);
+api_checkvalidindex(L,t);
+luaV_gettable(L,t,L->top-1,L->top-1);
+}
+static void lua_getfield(lua_State*L,int idx,const char*k){
+StkId t;
+TValue key;
+t=index2adr(L,idx);
+api_checkvalidindex(L,t);
+setsvalue(L,&key,luaS_new(L,k));
+luaV_gettable(L,t,&key,L->top);
+api_incr_top(L);
+}
+static void lua_rawget(lua_State*L,int idx){
+StkId t;
+t=index2adr(L,idx);
+luai_apicheck(L,ttistable(t));
+setobj(L,L->top-1,luaH_get(hvalue(t),L->top-1));
+}
+static void lua_rawgeti(lua_State*L,int idx,int n){
+StkId o;
+o=index2adr(L,idx);
+luai_apicheck(L,ttistable(o));
+setobj(L,L->top,luaH_getnum(hvalue(o),n));
+api_incr_top(L);
+}
+static void lua_createtable(lua_State*L,int narray,int nrec){
+luaC_checkGC(L);
+sethvalue(L,L->top,luaH_new(L,narray,nrec));
+api_incr_top(L);
+}
+static int lua_getmetatable(lua_State*L,int objindex){
+const TValue*obj;
+Table*mt=NULL;
+int res;
+obj=index2adr(L,objindex);
+switch(ttype(obj)){
+case 5:
+mt=hvalue(obj)->metatable;
+break;
+case 7:
+mt=uvalue(obj)->metatable;
+break;
+default:
+mt=G(L)->mt[ttype(obj)];
+break;
+}
+if(mt==NULL)
+res=0;
+else{
+sethvalue(L,L->top,mt);
+api_incr_top(L);
+res=1;
+}
+return res;
+}
+static void lua_getfenv(lua_State*L,int idx){
+StkId o;
+o=index2adr(L,idx);
+api_checkvalidindex(L,o);
+switch(ttype(o)){
+case 6:
+sethvalue(L,L->top,clvalue(o)->c.env);
+break;
+case 7:
+sethvalue(L,L->top,uvalue(o)->env);
+break;
+case 8:
+setobj(L,L->top,gt(thvalue(o)));
+break;
+default:
+setnilvalue(L->top);
+break;
+}
+api_incr_top(L);
+}
+static void lua_settable(lua_State*L,int idx){
+StkId t;
+api_checknelems(L,2);
+t=index2adr(L,idx);
+api_checkvalidindex(L,t);
+luaV_settable(L,t,L->top-2,L->top-1);
+L->top-=2;
+}
+static void lua_setfield(lua_State*L,int idx,const char*k){
+StkId t;
+TValue key;
+api_checknelems(L,1);
+t=index2adr(L,idx);
+api_checkvalidindex(L,t);
+setsvalue(L,&key,luaS_new(L,k));
+luaV_settable(L,t,&key,L->top-1);
+L->top--;
+}
+static void lua_rawset(lua_State*L,int idx){
+StkId t;
+api_checknelems(L,2);
+t=index2adr(L,idx);
+luai_apicheck(L,ttistable(t));
+setobj(L,luaH_set(L,hvalue(t),L->top-2),L->top-1);
+luaC_barriert(L,hvalue(t),L->top-1);
+L->top-=2;
+}
+static void lua_rawseti(lua_State*L,int idx,int n){
+StkId o;
+api_checknelems(L,1);
+o=index2adr(L,idx);
+luai_apicheck(L,ttistable(o));
+setobj(L,luaH_setnum(L,hvalue(o),n),L->top-1);
+luaC_barriert(L,hvalue(o),L->top-1);
+L->top--;
+}
+static int lua_setmetatable(lua_State*L,int objindex){
+TValue*obj;
+Table*mt;
+api_checknelems(L,1);
+obj=index2adr(L,objindex);
+api_checkvalidindex(L,obj);
+if(ttisnil(L->top-1))
+mt=NULL;
+else{
+luai_apicheck(L,ttistable(L->top-1));
+mt=hvalue(L->top-1);
+}
+switch(ttype(obj)){
+case 5:{
+hvalue(obj)->metatable=mt;
+if(mt)
+luaC_objbarriert(L,hvalue(obj),mt);
+break;
+}
+case 7:{
+uvalue(obj)->metatable=mt;
+if(mt)
+luaC_objbarrier(L,rawuvalue(obj),mt);
+break;
+}
+default:{
+G(L)->mt[ttype(obj)]=mt;
+break;
+}
+}
+L->top--;
+return 1;
+}
+static int lua_setfenv(lua_State*L,int idx){
+StkId o;
+int res=1;
+api_checknelems(L,1);
+o=index2adr(L,idx);
+api_checkvalidindex(L,o);
+luai_apicheck(L,ttistable(L->top-1));
+switch(ttype(o)){
+case 6:
+clvalue(o)->c.env=hvalue(L->top-1);
+break;
+case 7:
+uvalue(o)->env=hvalue(L->top-1);
+break;
+case 8:
+sethvalue(L,gt(thvalue(o)),hvalue(L->top-1));
+break;
+default:
+res=0;
+break;
+}
+if(res)luaC_objbarrier(L,gcvalue(o),hvalue(L->top-1));
+L->top--;
+return res;
+}
+#define adjustresults(L,nres){if(nres==(-1)&&L->top>=L->ci->top)L->ci->top=L->top;}
+#define checkresults(L,na,nr)luai_apicheck(L,(nr)==(-1)||(L->ci->top-L->top>=(nr)-(na)))
+static void lua_call(lua_State*L,int nargs,int nresults){
+StkId func;
+api_checknelems(L,nargs+1);
+checkresults(L,nargs,nresults);
+func=L->top-(nargs+1);
+luaD_call(L,func,nresults);
+adjustresults(L,nresults);
+}
+struct CallS{
+StkId func;
+int nresults;
+};
+static void f_call(lua_State*L,void*ud){
+struct CallS*c=cast(struct CallS*,ud);
+luaD_call(L,c->func,c->nresults);
+}
+static int lua_pcall(lua_State*L,int nargs,int nresults,int errfunc){
+struct CallS c;
+int status;
+ptrdiff_t func;
+api_checknelems(L,nargs+1);
+checkresults(L,nargs,nresults);
+if(errfunc==0)
+func=0;
+else{
+StkId o=index2adr(L,errfunc);
+api_checkvalidindex(L,o);
+func=savestack(L,o);
+}
+c.func=L->top-(nargs+1);
+c.nresults=nresults;
+status=luaD_pcall(L,f_call,&c,savestack(L,c.func),func);
+adjustresults(L,nresults);
+return status;
+}
+static int lua_load(lua_State*L,lua_Reader reader,void*data,
+const char*chunkname){
+ZIO z;
+int status;
+if(!chunkname)chunkname="?";
+luaZ_init(L,&z,reader,data);
+status=luaD_protectedparser(L,&z,chunkname);
+return status;
+}
+static int lua_error(lua_State*L){
+api_checknelems(L,1);
+luaG_errormsg(L);
+return 0;
+}
+static int lua_next(lua_State*L,int idx){
+StkId t;
+int more;
+t=index2adr(L,idx);
+luai_apicheck(L,ttistable(t));
+more=luaH_next(L,hvalue(t),L->top-1);
+if(more){
+api_incr_top(L);
+}
+else
+L->top-=1;
+return more;
+}
+static void lua_concat(lua_State*L,int n){
+api_checknelems(L,n);
+if(n>=2){
+luaC_checkGC(L);
+luaV_concat(L,n,cast_int(L->top-L->base)-1);
+L->top-=(n-1);
+}
+else if(n==0){
+setsvalue(L,L->top,luaS_newlstr(L,"",0));
+api_incr_top(L);
+}
+}
+static void*lua_newuserdata(lua_State*L,size_t size){
+Udata*u;
+luaC_checkGC(L);
+u=luaS_newudata(L,size,getcurrenv(L));
+setuvalue(L,L->top,u);
+api_incr_top(L);
+return u+1;
+}
+#define luaL_getn(L,i)((int)lua_objlen(L,i))
+#define luaL_setn(L,i,j)((void)0)
+typedef struct luaL_Reg{
+const char*name;
+lua_CFunction func;
+}luaL_Reg;
+static void luaI_openlib(lua_State*L,const char*libname,
+const luaL_Reg*l,int nup);
+static int luaL_argerror(lua_State*L,int numarg,const char*extramsg);
+static const char* luaL_checklstring(lua_State*L,int numArg,
+size_t*l);
+static const char* luaL_optlstring(lua_State*L,int numArg,
+const char*def,size_t*l);
+static lua_Integer luaL_checkinteger(lua_State*L,int numArg);
+static lua_Integer luaL_optinteger(lua_State*L,int nArg,
+lua_Integer def);
+static int luaL_error(lua_State*L,const char*fmt,...);
+static const char* luaL_findtable(lua_State*L,int idx,
+const char*fname,int szhint);
+#define luaL_argcheck(L,cond,numarg,extramsg)((void)((cond)||luaL_argerror(L,(numarg),(extramsg))))
+#define luaL_checkstring(L,n)(luaL_checklstring(L,(n),NULL))
+#define luaL_optstring(L,n,d)(luaL_optlstring(L,(n),(d),NULL))
+#define luaL_checkint(L,n)((int)luaL_checkinteger(L,(n)))
+#define luaL_optint(L,n,d)((int)luaL_optinteger(L,(n),(d)))
+#define luaL_typename(L,i)lua_typename(L,lua_type(L,(i)))
+#define luaL_getmetatable(L,n)(lua_getfield(L,(-10000),(n)))
+#define luaL_opt(L,f,n,d)(lua_isnoneornil(L,(n))?(d):f(L,(n)))
+typedef struct luaL_Buffer{
+char*p;
+int lvl;
+lua_State*L;
+char buffer[BUFSIZ];
+}luaL_Buffer;
+#define luaL_addchar(B,c)((void)((B)->p<((B)->buffer+BUFSIZ)||luaL_prepbuffer(B)),(*(B)->p++=(char)(c)))
+#define luaL_addsize(B,n)((B)->p+=(n))
+static char* luaL_prepbuffer(luaL_Buffer*B);
+static int luaL_argerror(lua_State*L,int narg,const char*extramsg){
+lua_Debug ar;
+if(!lua_getstack(L,0,&ar))
+return luaL_error(L,"bad argument #%d (%s)",narg,extramsg);
+lua_getinfo(L,"n",&ar);
+if(strcmp(ar.namewhat,"method")==0){
+narg--;
+if(narg==0)
+return luaL_error(L,"calling "LUA_QL("%s")" on bad self (%s)",
+ar.name,extramsg);
+}
+if(ar.name==NULL)
+ar.name="?";
+return luaL_error(L,"bad argument #%d to "LUA_QL("%s")" (%s)",
+narg,ar.name,extramsg);
+}
+static int luaL_typerror(lua_State*L,int narg,const char*tname){
+const char*msg=lua_pushfstring(L,"%s expected, got %s",
+tname,luaL_typename(L,narg));
+return luaL_argerror(L,narg,msg);
+}
+static void tag_error(lua_State*L,int narg,int tag){
+luaL_typerror(L,narg,lua_typename(L,tag));
+}
+static void luaL_where(lua_State*L,int level){
+lua_Debug ar;
+if(lua_getstack(L,level,&ar)){
+lua_getinfo(L,"Sl",&ar);
+if(ar.currentline>0){
+lua_pushfstring(L,"%s:%d: ",ar.short_src,ar.currentline);
+return;
+}
+}
+lua_pushliteral(L,"");
+}
+static int luaL_error(lua_State*L,const char*fmt,...){
+va_list argp;
+va_start(argp,fmt);
+luaL_where(L,1);
+lua_pushvfstring(L,fmt,argp);
+va_end(argp);
+lua_concat(L,2);
+return lua_error(L);
+}
+static int luaL_newmetatable(lua_State*L,const char*tname){
+lua_getfield(L,(-10000),tname);
+if(!lua_isnil(L,-1))
+return 0;
+lua_pop(L,1);
+lua_newtable(L);
+lua_pushvalue(L,-1);
+lua_setfield(L,(-10000),tname);
+return 1;
+}
+static void*luaL_checkudata(lua_State*L,int ud,const char*tname){
+void*p=lua_touserdata(L,ud);
+if(p!=NULL){
+if(lua_getmetatable(L,ud)){
+lua_getfield(L,(-10000),tname);
+if(lua_rawequal(L,-1,-2)){
+lua_pop(L,2);
+return p;
+}
+}
+}
+luaL_typerror(L,ud,tname);
+return NULL;
+}
+static void luaL_checkstack(lua_State*L,int space,const char*mes){
+if(!lua_checkstack(L,space))
+luaL_error(L,"stack overflow (%s)",mes);
+}
+static void luaL_checktype(lua_State*L,int narg,int t){
+if(lua_type(L,narg)!=t)
+tag_error(L,narg,t);
+}
+static void luaL_checkany(lua_State*L,int narg){
+if(lua_type(L,narg)==(-1))
+luaL_argerror(L,narg,"value expected");
+}
+static const char*luaL_checklstring(lua_State*L,int narg,size_t*len){
+const char*s=lua_tolstring(L,narg,len);
+if(!s)tag_error(L,narg,4);
+return s;
+}
+static const char*luaL_optlstring(lua_State*L,int narg,
+const char*def,size_t*len){
+if(lua_isnoneornil(L,narg)){
+if(len)
+*len=(def?strlen(def):0);
+return def;
+}
+else return luaL_checklstring(L,narg,len);
+}
+static lua_Number luaL_checknumber(lua_State*L,int narg){
+lua_Number d=lua_tonumber(L,narg);
+if(d==0&&!lua_isnumber(L,narg))
+tag_error(L,narg,3);
+return d;
+}
+static lua_Integer luaL_checkinteger(lua_State*L,int narg){
+lua_Integer d=lua_tointeger(L,narg);
+if(d==0&&!lua_isnumber(L,narg))
+tag_error(L,narg,3);
+return d;
+}
+static lua_Integer luaL_optinteger(lua_State*L,int narg,
+lua_Integer def){
+return luaL_opt(L,luaL_checkinteger,narg,def);
+}
+static int luaL_getmetafield(lua_State*L,int obj,const char*event){
+if(!lua_getmetatable(L,obj))
+return 0;
+lua_pushstring(L,event);
+lua_rawget(L,-2);
+if(lua_isnil(L,-1)){
+lua_pop(L,2);
+return 0;
+}
+else{
+lua_remove(L,-2);
+return 1;
+}
+}
+static void luaL_register(lua_State*L,const char*libname,
+const luaL_Reg*l){
+luaI_openlib(L,libname,l,0);
+}
+static int libsize(const luaL_Reg*l){
+int size=0;
+for(;l->name;l++)size++;
+return size;
+}
+static void luaI_openlib(lua_State*L,const char*libname,
+const luaL_Reg*l,int nup){
+if(libname){
+int size=libsize(l);
+luaL_findtable(L,(-10000),"_LOADED",1);
+lua_getfield(L,-1,libname);
+if(!lua_istable(L,-1)){
+lua_pop(L,1);
+if(luaL_findtable(L,(-10002),libname,size)!=NULL)
+luaL_error(L,"name conflict for module "LUA_QL("%s"),libname);
+lua_pushvalue(L,-1);
+lua_setfield(L,-3,libname);
+}
+lua_remove(L,-2);
+lua_insert(L,-(nup+1));
+}
+for(;l->name;l++){
+int i;
+for(i=0;i<nup;i++)
+lua_pushvalue(L,-nup);
+lua_pushcclosure(L,l->func,nup);
+lua_setfield(L,-(nup+2),l->name);
+}
+lua_pop(L,nup);
+}
+static const char*luaL_findtable(lua_State*L,int idx,
+const char*fname,int szhint){
+const char*e;
+lua_pushvalue(L,idx);
+do{
+e=strchr(fname,'.');
+if(e==NULL)e=fname+strlen(fname);
+lua_pushlstring(L,fname,e-fname);
+lua_rawget(L,-2);
+if(lua_isnil(L,-1)){
+lua_pop(L,1);
+lua_createtable(L,0,(*e=='.'?1:szhint));
+lua_pushlstring(L,fname,e-fname);
+lua_pushvalue(L,-2);
+lua_settable(L,-4);
+}
+else if(!lua_istable(L,-1)){
+lua_pop(L,2);
+return fname;
+}
+lua_remove(L,-2);
+fname=e+1;
+}while(*e=='.');
+return NULL;
+}
+#define bufflen(B)((B)->p-(B)->buffer)
+#define bufffree(B)((size_t)(BUFSIZ-bufflen(B)))
+static int emptybuffer(luaL_Buffer*B){
+size_t l=bufflen(B);
+if(l==0)return 0;
+else{
+lua_pushlstring(B->L,B->buffer,l);
+B->p=B->buffer;
+B->lvl++;
+return 1;
+}
+}
+static void adjuststack(luaL_Buffer*B){
+if(B->lvl>1){
+lua_State*L=B->L;
+int toget=1;
+size_t toplen=lua_strlen(L,-1);
+do{
+size_t l=lua_strlen(L,-(toget+1));
+if(B->lvl-toget+1>=(20/2)||toplen>l){
+toplen+=l;
+toget++;
+}
+else break;
+}while(toget<B->lvl);
+lua_concat(L,toget);
+B->lvl=B->lvl-toget+1;
+}
+}
+static char*luaL_prepbuffer(luaL_Buffer*B){
+if(emptybuffer(B))
+adjuststack(B);
+return B->buffer;
+}
+static void luaL_addlstring(luaL_Buffer*B,const char*s,size_t l){
+while(l--)
+luaL_addchar(B,*s++);
+}
+static void luaL_pushresult(luaL_Buffer*B){
+emptybuffer(B);
+lua_concat(B->L,B->lvl);
+B->lvl=1;
+}
+static void luaL_addvalue(luaL_Buffer*B){
+lua_State*L=B->L;
+size_t vl;
+const char*s=lua_tolstring(L,-1,&vl);
+if(vl<=bufffree(B)){
+memcpy(B->p,s,vl);
+B->p+=vl;
+lua_pop(L,1);
+}
+else{
+if(emptybuffer(B))
+lua_insert(L,-2);
+B->lvl++;
+adjuststack(B);
+}
+}
+static void luaL_buffinit(lua_State*L,luaL_Buffer*B){
+B->L=L;
+B->p=B->buffer;
+B->lvl=0;
+}
+typedef struct LoadF{
+int extraline;
+FILE*f;
+char buff[BUFSIZ];
+}LoadF;
+static const char*getF(lua_State*L,void*ud,size_t*size){
+LoadF*lf=(LoadF*)ud;
+(void)L;
+if(lf->extraline){
+lf->extraline=0;
+*size=1;
+return"\n";
+}
+if(feof(lf->f))return NULL;
+*size=fread(lf->buff,1,sizeof(lf->buff),lf->f);
+return(*size>0)?lf->buff:NULL;
+}
+static int errfile(lua_State*L,const char*what,int fnameindex){
+const char*serr=strerror(errno);
+const char*filename=lua_tostring(L,fnameindex)+1;
+lua_pushfstring(L,"cannot %s %s: %s",what,filename,serr);
+lua_remove(L,fnameindex);
+return(5+1);
+}
+static int luaL_loadfile(lua_State*L,const char*filename){
+LoadF lf;
+int status,readstatus;
+int c;
+int fnameindex=lua_gettop(L)+1;
+lf.extraline=0;
+if(filename==NULL){
+lua_pushliteral(L,"=stdin");
+lf.f=stdin;
+}
+else{
+lua_pushfstring(L,"@%s",filename);
+lf.f=fopen(filename,"r");
+if(lf.f==NULL)return errfile(L,"open",fnameindex);
+}
+c=getc(lf.f);
+if(c=='#'){
+lf.extraline=1;
+while((c=getc(lf.f))!=EOF&&c!='\n');
+if(c=='\n')c=getc(lf.f);
+}
+if(c=="\033Lua"[0]&&filename){
+lf.f=freopen(filename,"rb",lf.f);
+if(lf.f==NULL)return errfile(L,"reopen",fnameindex);
+while((c=getc(lf.f))!=EOF&&c!="\033Lua"[0]);
+lf.extraline=0;
+}
+ungetc(c,lf.f);
+status=lua_load(L,getF,&lf,lua_tostring(L,-1));
+readstatus=ferror(lf.f);
+if(filename)fclose(lf.f);
+if(readstatus){
+lua_settop(L,fnameindex);
+return errfile(L,"read",fnameindex);
+}
+lua_remove(L,fnameindex);
+return status;
+}
+typedef struct LoadS{
+const char*s;
+size_t size;
+}LoadS;
+static const char*getS(lua_State*L,void*ud,size_t*size){
+LoadS*ls=(LoadS*)ud;
+(void)L;
+if(ls->size==0)return NULL;
+*size=ls->size;
+ls->size=0;
+return ls->s;
+}
+static int luaL_loadbuffer(lua_State*L,const char*buff,size_t size,
+const char*name){
+LoadS ls;
+ls.s=buff;
+ls.size=size;
+return lua_load(L,getS,&ls,name);
+}
+static void*l_alloc(void*ud,void*ptr,size_t osize,size_t nsize){
+(void)ud;
+(void)osize;
+if(nsize==0){
+free(ptr);
+return NULL;
+}
+else
+return realloc(ptr,nsize);
+}
+static int panic(lua_State*L){
+(void)L;
+fprintf(stderr,"PANIC: unprotected error in call to Lua API (%s)\n",
+lua_tostring(L,-1));
+return 0;
+}
+static lua_State*luaL_newstate(void){
+lua_State*L=lua_newstate(l_alloc,NULL);
+if(L)lua_atpanic(L,&panic);
+return L;
+}
+static int luaB_tonumber(lua_State*L){
+int base=luaL_optint(L,2,10);
+if(base==10){
+luaL_checkany(L,1);
+if(lua_isnumber(L,1)){
+lua_pushnumber(L,lua_tonumber(L,1));
+return 1;
+}
+}
+else{
+const char*s1=luaL_checkstring(L,1);
+char*s2;
+unsigned long n;
+luaL_argcheck(L,2<=base&&base<=36,2,"base out of range");
+n=strtoul(s1,&s2,base);
+if(s1!=s2){
+while(isspace((unsigned char)(*s2)))s2++;
+if(*s2=='\0'){
+lua_pushnumber(L,(lua_Number)n);
+return 1;
+}
+}
+}
+lua_pushnil(L);
+return 1;
+}
+static int luaB_error(lua_State*L){
+int level=luaL_optint(L,2,1);
+lua_settop(L,1);
+if(lua_isstring(L,1)&&level>0){
+luaL_where(L,level);
+lua_pushvalue(L,1);
+lua_concat(L,2);
+}
+return lua_error(L);
+}
+static int luaB_setmetatable(lua_State*L){
+int t=lua_type(L,2);
+luaL_checktype(L,1,5);
+luaL_argcheck(L,t==0||t==5,2,
+"nil or table expected");
+if(luaL_getmetafield(L,1,"__metatable"))
+luaL_error(L,"cannot change a protected metatable");
+lua_settop(L,2);
+lua_setmetatable(L,1);
+return 1;
+}
+static void getfunc(lua_State*L,int opt){
+if(lua_isfunction(L,1))lua_pushvalue(L,1);
+else{
+lua_Debug ar;
+int level=opt?luaL_optint(L,1,1):luaL_checkint(L,1);
+luaL_argcheck(L,level>=0,1,"level must be non-negative");
+if(lua_getstack(L,level,&ar)==0)
+luaL_argerror(L,1,"invalid level");
+lua_getinfo(L,"f",&ar);
+if(lua_isnil(L,-1))
+luaL_error(L,"no function environment for tail call at level %d",
+level);
+}
+}
+static int luaB_setfenv(lua_State*L){
+luaL_checktype(L,2,5);
+getfunc(L,0);
+lua_pushvalue(L,2);
+if(lua_isnumber(L,1)&&lua_tonumber(L,1)==0){
+lua_pushthread(L);
+lua_insert(L,-2);
+lua_setfenv(L,-2);
+return 0;
+}
+else if(lua_iscfunction(L,-2)||lua_setfenv(L,-2)==0)
+luaL_error(L,
+LUA_QL("setfenv")" cannot change environment of given object");
+return 1;
+}
+static int luaB_rawget(lua_State*L){
+luaL_checktype(L,1,5);
+luaL_checkany(L,2);
+lua_settop(L,2);
+lua_rawget(L,1);
+return 1;
+}
+static int luaB_type(lua_State*L){
+luaL_checkany(L,1);
+lua_pushstring(L,luaL_typename(L,1));
+return 1;
+}
+static int luaB_next(lua_State*L){
+luaL_checktype(L,1,5);
+lua_settop(L,2);
+if(lua_next(L,1))
+return 2;
+else{
+lua_pushnil(L);
+return 1;
+}
+}
+static int luaB_pairs(lua_State*L){
+luaL_checktype(L,1,5);
+lua_pushvalue(L,lua_upvalueindex(1));
+lua_pushvalue(L,1);
+lua_pushnil(L);
+return 3;
+}
+static int ipairsaux(lua_State*L){
+int i=luaL_checkint(L,2);
+luaL_checktype(L,1,5);
+i++;
+lua_pushinteger(L,i);
+lua_rawgeti(L,1,i);
+return(lua_isnil(L,-1))?0:2;
+}
+static int luaB_ipairs(lua_State*L){
+luaL_checktype(L,1,5);
+lua_pushvalue(L,lua_upvalueindex(1));
+lua_pushvalue(L,1);
+lua_pushinteger(L,0);
+return 3;
+}
+static int load_aux(lua_State*L,int status){
+if(status==0)
+return 1;
+else{
+lua_pushnil(L);
+lua_insert(L,-2);
+return 2;
+}
+}
+static int luaB_loadstring(lua_State*L){
+size_t l;
+const char*s=luaL_checklstring(L,1,&l);
+const char*chunkname=luaL_optstring(L,2,s);
+return load_aux(L,luaL_loadbuffer(L,s,l,chunkname));
+}
+static int luaB_loadfile(lua_State*L){
+const char*fname=luaL_optstring(L,1,NULL);
+return load_aux(L,luaL_loadfile(L,fname));
+}
+static int luaB_assert(lua_State*L){
+luaL_checkany(L,1);
+if(!lua_toboolean(L,1))
+return luaL_error(L,"%s",luaL_optstring(L,2,"assertion failed!"));
+return lua_gettop(L);
+}
+static int luaB_unpack(lua_State*L){
+int i,e,n;
+luaL_checktype(L,1,5);
+i=luaL_optint(L,2,1);
+e=luaL_opt(L,luaL_checkint,3,luaL_getn(L,1));
+if(i>e)return 0;
+n=e-i+1;
+if(n<=0||!lua_checkstack(L,n))
+return luaL_error(L,"too many results to unpack");
+lua_rawgeti(L,1,i);
+while(i++<e)
+lua_rawgeti(L,1,i);
+return n;
+}
+static int luaB_pcall(lua_State*L){
+int status;
+luaL_checkany(L,1);
+status=lua_pcall(L,lua_gettop(L)-1,(-1),0);
+lua_pushboolean(L,(status==0));
+lua_insert(L,1);
+return lua_gettop(L);
+}
+static int luaB_newproxy(lua_State*L){
+lua_settop(L,1);
+lua_newuserdata(L,0);
+if(lua_toboolean(L,1)==0)
+return 1;
+else if(lua_isboolean(L,1)){
+lua_newtable(L);
+lua_pushvalue(L,-1);
+lua_pushboolean(L,1);
+lua_rawset(L,lua_upvalueindex(1));
+}
+else{
+int validproxy=0;
+if(lua_getmetatable(L,1)){
+lua_rawget(L,lua_upvalueindex(1));
+validproxy=lua_toboolean(L,-1);
+lua_pop(L,1);
+}
+luaL_argcheck(L,validproxy,1,"boolean or proxy expected");
+lua_getmetatable(L,1);
+}
+lua_setmetatable(L,2);
+return 1;
+}
+static const luaL_Reg base_funcs[]={
+{"assert",luaB_assert},
+{"error",luaB_error},
+{"loadfile",luaB_loadfile},
+{"loadstring",luaB_loadstring},
+{"next",luaB_next},
+{"pcall",luaB_pcall},
+{"rawget",luaB_rawget},
+{"setfenv",luaB_setfenv},
+{"setmetatable",luaB_setmetatable},
+{"tonumber",luaB_tonumber},
+{"type",luaB_type},
+{"unpack",luaB_unpack},
+{NULL,NULL}
+};
+static void auxopen(lua_State*L,const char*name,
+lua_CFunction f,lua_CFunction u){
+lua_pushcfunction(L,u);
+lua_pushcclosure(L,f,1);
+lua_setfield(L,-2,name);
+}
+static void base_open(lua_State*L){
+lua_pushvalue(L,(-10002));
+lua_setglobal(L,"_G");
+luaL_register(L,"_G",base_funcs);
+lua_pushliteral(L,"Lua 5.1");
+lua_setglobal(L,"_VERSION");
+auxopen(L,"ipairs",luaB_ipairs,ipairsaux);
+auxopen(L,"pairs",luaB_pairs,luaB_next);
+lua_createtable(L,0,1);
+lua_pushvalue(L,-1);
+lua_setmetatable(L,-2);
+lua_pushliteral(L,"kv");
+lua_setfield(L,-2,"__mode");
+lua_pushcclosure(L,luaB_newproxy,1);
+lua_setglobal(L,"newproxy");
+}
+static int luaopen_base(lua_State*L){
+base_open(L);
+return 1;
+}
+#define aux_getn(L,n)(luaL_checktype(L,n,5),luaL_getn(L,n))
+static int tinsert(lua_State*L){
+int e=aux_getn(L,1)+1;
+int pos;
+switch(lua_gettop(L)){
+case 2:{
+pos=e;
+break;
+}
+case 3:{
+int i;
+pos=luaL_checkint(L,2);
+if(pos>e)e=pos;
+for(i=e;i>pos;i--){
+lua_rawgeti(L,1,i-1);
+lua_rawseti(L,1,i);
+}
+break;
+}
+default:{
+return luaL_error(L,"wrong number of arguments to "LUA_QL("insert"));
+}
+}
+luaL_setn(L,1,e);
+lua_rawseti(L,1,pos);
+return 0;
+}
+static int tremove(lua_State*L){
+int e=aux_getn(L,1);
+int pos=luaL_optint(L,2,e);
+if(!(1<=pos&&pos<=e))
+return 0;
+luaL_setn(L,1,e-1);
+lua_rawgeti(L,1,pos);
+for(;pos<e;pos++){
+lua_rawgeti(L,1,pos+1);
+lua_rawseti(L,1,pos);
+}
+lua_pushnil(L);
+lua_rawseti(L,1,e);
+return 1;
+}
+static void addfield(lua_State*L,luaL_Buffer*b,int i){
+lua_rawgeti(L,1,i);
+if(!lua_isstring(L,-1))
+luaL_error(L,"invalid value (%s) at index %d in table for "
+LUA_QL("concat"),luaL_typename(L,-1),i);
+luaL_addvalue(b);
+}
+static int tconcat(lua_State*L){
+luaL_Buffer b;
+size_t lsep;
+int i,last;
+const char*sep=luaL_optlstring(L,2,"",&lsep);
+luaL_checktype(L,1,5);
+i=luaL_optint(L,3,1);
+last=luaL_opt(L,luaL_checkint,4,luaL_getn(L,1));
+luaL_buffinit(L,&b);
+for(;i<last;i++){
+addfield(L,&b,i);
+luaL_addlstring(&b,sep,lsep);
+}
+if(i==last)
+addfield(L,&b,i);
+luaL_pushresult(&b);
+return 1;
+}
+static void set2(lua_State*L,int i,int j){
+lua_rawseti(L,1,i);
+lua_rawseti(L,1,j);
+}
+static int sort_comp(lua_State*L,int a,int b){
+if(!lua_isnil(L,2)){
+int res;
+lua_pushvalue(L,2);
+lua_pushvalue(L,a-1);
+lua_pushvalue(L,b-2);
+lua_call(L,2,1);
+res=lua_toboolean(L,-1);
+lua_pop(L,1);
+return res;
+}
+else
+return lua_lessthan(L,a,b);
+}
+static void auxsort(lua_State*L,int l,int u){
+while(l<u){
+int i,j;
+lua_rawgeti(L,1,l);
+lua_rawgeti(L,1,u);
+if(sort_comp(L,-1,-2))
+set2(L,l,u);
+else
+lua_pop(L,2);
+if(u-l==1)break;
+i=(l+u)/2;
+lua_rawgeti(L,1,i);
+lua_rawgeti(L,1,l);
+if(sort_comp(L,-2,-1))
+set2(L,i,l);
+else{
+lua_pop(L,1);
+lua_rawgeti(L,1,u);
+if(sort_comp(L,-1,-2))
+set2(L,i,u);
+else
+lua_pop(L,2);
+}
+if(u-l==2)break;
+lua_rawgeti(L,1,i);
+lua_pushvalue(L,-1);
+lua_rawgeti(L,1,u-1);
+set2(L,i,u-1);
+i=l;j=u-1;
+for(;;){
+while(lua_rawgeti(L,1,++i),sort_comp(L,-1,-2)){
+if(i>u)luaL_error(L,"invalid order function for sorting");
+lua_pop(L,1);
+}
+while(lua_rawgeti(L,1,--j),sort_comp(L,-3,-1)){
+if(j<l)luaL_error(L,"invalid order function for sorting");
+lua_pop(L,1);
+}
+if(j<i){
+lua_pop(L,3);
+break;
+}
+set2(L,i,j);
+}
+lua_rawgeti(L,1,u-1);
+lua_rawgeti(L,1,i);
+set2(L,u-1,i);
+if(i-l<u-i){
+j=l;i=i-1;l=i+2;
+}
+else{
+j=i+1;i=u;u=j-2;
+}
+auxsort(L,j,i);
+}
+}
+static int sort(lua_State*L){
+int n=aux_getn(L,1);
+luaL_checkstack(L,40,"");
+if(!lua_isnoneornil(L,2))
+luaL_checktype(L,2,6);
+lua_settop(L,2);
+auxsort(L,1,n);
+return 0;
+}
+static const luaL_Reg tab_funcs[]={
+{"concat",tconcat},
+{"insert",tinsert},
+{"remove",tremove},
+{"sort",sort},
+{NULL,NULL}
+};
+static int luaopen_table(lua_State*L){
+luaL_register(L,"table",tab_funcs);
+return 1;
+}
+static const char*const fnames[]={"input","output"};
+static int pushresult(lua_State*L,int i,const char*filename){
+int en=errno;
+if(i){
+lua_pushboolean(L,1);
+return 1;
+}
+else{
+lua_pushnil(L);
+if(filename)
+lua_pushfstring(L,"%s: %s",filename,strerror(en));
+else
+lua_pushfstring(L,"%s",strerror(en));
+lua_pushinteger(L,en);
+return 3;
+}
+}
+static void fileerror(lua_State*L,int arg,const char*filename){
+lua_pushfstring(L,"%s: %s",filename,strerror(errno));
+luaL_argerror(L,arg,lua_tostring(L,-1));
+}
+#define tofilep(L)((FILE**)luaL_checkudata(L,1,"FILE*"))
+static int io_type(lua_State*L){
+void*ud;
+luaL_checkany(L,1);
+ud=lua_touserdata(L,1);
+lua_getfield(L,(-10000),"FILE*");
+if(ud==NULL||!lua_getmetatable(L,1)||!lua_rawequal(L,-2,-1))
+lua_pushnil(L);
+else if(*((FILE**)ud)==NULL)
+lua_pushliteral(L,"closed file");
+else
+lua_pushliteral(L,"file");
+return 1;
+}
+static FILE*tofile(lua_State*L){
+FILE**f=tofilep(L);
+if(*f==NULL)
+luaL_error(L,"attempt to use a closed file");
+return*f;
+}
+static FILE**newfile(lua_State*L){
+FILE**pf=(FILE**)lua_newuserdata(L,sizeof(FILE*));
+*pf=NULL;
+luaL_getmetatable(L,"FILE*");
+lua_setmetatable(L,-2);
+return pf;
+}
+static int io_noclose(lua_State*L){
+lua_pushnil(L);
+lua_pushliteral(L,"cannot close standard file");
+return 2;
+}
+static int io_pclose(lua_State*L){
+FILE**p=tofilep(L);
+int ok=lua_pclose(L,*p);
+*p=NULL;
+return pushresult(L,ok,NULL);
+}
+static int io_fclose(lua_State*L){
+FILE**p=tofilep(L);
+int ok=(fclose(*p)==0);
+*p=NULL;
+return pushresult(L,ok,NULL);
+}
+static int aux_close(lua_State*L){
+lua_getfenv(L,1);
+lua_getfield(L,-1,"__close");
+return(lua_tocfunction(L,-1))(L);
+}
+static int io_close(lua_State*L){
+if(lua_isnone(L,1))
+lua_rawgeti(L,(-10001),2);
+tofile(L);
+return aux_close(L);
+}
+static int io_gc(lua_State*L){
+FILE*f=*tofilep(L);
+if(f!=NULL)
+aux_close(L);
+return 0;
+}
+static int io_open(lua_State*L){
+const char*filename=luaL_checkstring(L,1);
+const char*mode=luaL_optstring(L,2,"r");
+FILE**pf=newfile(L);
+*pf=fopen(filename,mode);
+return(*pf==NULL)?pushresult(L,0,filename):1;
+}
+static FILE*getiofile(lua_State*L,int findex){
+FILE*f;
+lua_rawgeti(L,(-10001),findex);
+f=*(FILE**)lua_touserdata(L,-1);
+if(f==NULL)
+luaL_error(L,"standard %s file is closed",fnames[findex-1]);
+return f;
+}
+static int g_iofile(lua_State*L,int f,const char*mode){
+if(!lua_isnoneornil(L,1)){
+const char*filename=lua_tostring(L,1);
+if(filename){
+FILE**pf=newfile(L);
+*pf=fopen(filename,mode);
+if(*pf==NULL)
+fileerror(L,1,filename);
+}
+else{
+tofile(L);
+lua_pushvalue(L,1);
+}
+lua_rawseti(L,(-10001),f);
+}
+lua_rawgeti(L,(-10001),f);
+return 1;
+}
+static int io_input(lua_State*L){
+return g_iofile(L,1,"r");
+}
+static int io_output(lua_State*L){
+return g_iofile(L,2,"w");
+}
+static int io_readline(lua_State*L);
+static void aux_lines(lua_State*L,int idx,int toclose){
+lua_pushvalue(L,idx);
+lua_pushboolean(L,toclose);
+lua_pushcclosure(L,io_readline,2);
+}
+static int f_lines(lua_State*L){
+tofile(L);
+aux_lines(L,1,0);
+return 1;
+}
+static int io_lines(lua_State*L){
+if(lua_isnoneornil(L,1)){
+lua_rawgeti(L,(-10001),1);
+return f_lines(L);
+}
+else{
+const char*filename=luaL_checkstring(L,1);
+FILE**pf=newfile(L);
+*pf=fopen(filename,"r");
+if(*pf==NULL)
+fileerror(L,1,filename);
+aux_lines(L,lua_gettop(L),1);
+return 1;
+}
+}
+static int read_number(lua_State*L,FILE*f){
+lua_Number d;
+if(fscanf(f,"%lf",&d)==1){
+lua_pushnumber(L,d);
+return 1;
+}
+else{
+lua_pushnil(L);
+return 0;
+}
+}
+static int test_eof(lua_State*L,FILE*f){
+int c=getc(f);
+ungetc(c,f);
+lua_pushlstring(L,NULL,0);
+return(c!=EOF);
+}
+static int read_line(lua_State*L,FILE*f){
+luaL_Buffer b;
+luaL_buffinit(L,&b);
+for(;;){
+size_t l;
+char*p=luaL_prepbuffer(&b);
+if(fgets(p,BUFSIZ,f)==NULL){
+luaL_pushresult(&b);
+return(lua_objlen(L,-1)>0);
+}
+l=strlen(p);
+if(l==0||p[l-1]!='\n')
+luaL_addsize(&b,l);
+else{
+luaL_addsize(&b,l-1);
+luaL_pushresult(&b);
+return 1;
+}
+}
+}
+static int read_chars(lua_State*L,FILE*f,size_t n){
+size_t rlen;
+size_t nr;
+luaL_Buffer b;
+luaL_buffinit(L,&b);
+rlen=BUFSIZ;
+do{
+char*p=luaL_prepbuffer(&b);
+if(rlen>n)rlen=n;
+nr=fread(p,sizeof(char),rlen,f);
+luaL_addsize(&b,nr);
+n-=nr;
+}while(n>0&&nr==rlen);
+luaL_pushresult(&b);
+return(n==0||lua_objlen(L,-1)>0);
+}
+static int g_read(lua_State*L,FILE*f,int first){
+int nargs=lua_gettop(L)-1;
+int success;
+int n;
+clearerr(f);
+if(nargs==0){
+success=read_line(L,f);
+n=first+1;
+}
+else{
+luaL_checkstack(L,nargs+20,"too many arguments");
+success=1;
+for(n=first;nargs--&&success;n++){
+if(lua_type(L,n)==3){
+size_t l=(size_t)lua_tointeger(L,n);
+success=(l==0)?test_eof(L,f):read_chars(L,f,l);
+}
+else{
+const char*p=lua_tostring(L,n);
+luaL_argcheck(L,p&&p[0]=='*',n,"invalid option");
+switch(p[1]){
+case'n':
+success=read_number(L,f);
+break;
+case'l':
+success=read_line(L,f);
+break;
+case'a':
+read_chars(L,f,~((size_t)0));
+success=1;
+break;
+default:
+return luaL_argerror(L,n,"invalid format");
+}
+}
+}
+}
+if(ferror(f))
+return pushresult(L,0,NULL);
+if(!success){
+lua_pop(L,1);
+lua_pushnil(L);
+}
+return n-first;
+}
+static int io_read(lua_State*L){
+return g_read(L,getiofile(L,1),1);
+}
+static int f_read(lua_State*L){
+return g_read(L,tofile(L),2);
+}
+static int io_readline(lua_State*L){
+FILE*f=*(FILE**)lua_touserdata(L,lua_upvalueindex(1));
+int success;
+if(f==NULL)
+luaL_error(L,"file is already closed");
+success=read_line(L,f);
+if(ferror(f))
+return luaL_error(L,"%s",strerror(errno));
+if(success)return 1;
+else{
+if(lua_toboolean(L,lua_upvalueindex(2))){
+lua_settop(L,0);
+lua_pushvalue(L,lua_upvalueindex(1));
+aux_close(L);
+}
+return 0;
+}
+}
+static int g_write(lua_State*L,FILE*f,int arg){
+int nargs=lua_gettop(L)-1;
+int status=1;
+for(;nargs--;arg++){
+if(lua_type(L,arg)==3){
+status=status&&
+fprintf(f,"%.14g",lua_tonumber(L,arg))>0;
+}
+else{
+size_t l;
+const char*s=luaL_checklstring(L,arg,&l);
+status=status&&(fwrite(s,sizeof(char),l,f)==l);
+}
+}
+return pushresult(L,status,NULL);
+}
+static int io_write(lua_State*L){
+return g_write(L,getiofile(L,2),1);
+}
+static int f_write(lua_State*L){
+return g_write(L,tofile(L),2);
+}
+static int io_flush(lua_State*L){
+return pushresult(L,fflush(getiofile(L,2))==0,NULL);
+}
+static int f_flush(lua_State*L){
+return pushresult(L,fflush(tofile(L))==0,NULL);
+}
+static const luaL_Reg iolib[]={
+{"close",io_close},
+{"flush",io_flush},
+{"input",io_input},
+{"lines",io_lines},
+{"open",io_open},
+{"output",io_output},
+{"read",io_read},
+{"type",io_type},
+{"write",io_write},
+{NULL,NULL}
+};
+static const luaL_Reg flib[]={
+{"close",io_close},
+{"flush",f_flush},
+{"lines",f_lines},
+{"read",f_read},
+{"write",f_write},
+{"__gc",io_gc},
+{NULL,NULL}
+};
+static void createmeta(lua_State*L){
+luaL_newmetatable(L,"FILE*");
+lua_pushvalue(L,-1);
+lua_setfield(L,-2,"__index");
+luaL_register(L,NULL,flib);
+}
+static void createstdfile(lua_State*L,FILE*f,int k,const char*fname){
+*newfile(L)=f;
+if(k>0){
+lua_pushvalue(L,-1);
+lua_rawseti(L,(-10001),k);
+}
+lua_pushvalue(L,-2);
+lua_setfenv(L,-2);
+lua_setfield(L,-3,fname);
+}
+static void newfenv(lua_State*L,lua_CFunction cls){
+lua_createtable(L,0,1);
+lua_pushcfunction(L,cls);
+lua_setfield(L,-2,"__close");
+}
+static int luaopen_io(lua_State*L){
+createmeta(L);
+newfenv(L,io_fclose);
+lua_replace(L,(-10001));
+luaL_register(L,"io",iolib);
+newfenv(L,io_noclose);
+createstdfile(L,stdin,1,"stdin");
+createstdfile(L,stdout,2,"stdout");
+createstdfile(L,stderr,0,"stderr");
+lua_pop(L,1);
+lua_getfield(L,-1,"popen");
+newfenv(L,io_pclose);
+lua_setfenv(L,-2);
+lua_pop(L,1);
+return 1;
+}
+static int os_pushresult(lua_State*L,int i,const char*filename){
+int en=errno;
+if(i){
+lua_pushboolean(L,1);
+return 1;
+}
+else{
+lua_pushnil(L);
+lua_pushfstring(L,"%s: %s",filename,strerror(en));
+lua_pushinteger(L,en);
+return 3;
+}
+}
+static int os_remove(lua_State*L){
+const char*filename=luaL_checkstring(L,1);
+return os_pushresult(L,remove(filename)==0,filename);
+}
+static int os_exit(lua_State*L){
+exit(luaL_optint(L,1,EXIT_SUCCESS));
+}
+static const luaL_Reg syslib[]={
+{"exit",os_exit},
+{"remove",os_remove},
+{NULL,NULL}
+};
+static int luaopen_os(lua_State*L){
+luaL_register(L,"os",syslib);
+return 1;
+}
+#define uchar(c)((unsigned char)(c))
+static ptrdiff_t posrelat(ptrdiff_t pos,size_t len){
+if(pos<0)pos+=(ptrdiff_t)len+1;
+return(pos>=0)?pos:0;
+}
+static int str_sub(lua_State*L){
+size_t l;
+const char*s=luaL_checklstring(L,1,&l);
+ptrdiff_t start=posrelat(luaL_checkinteger(L,2),l);
+ptrdiff_t end=posrelat(luaL_optinteger(L,3,-1),l);
+if(start<1)start=1;
+if(end>(ptrdiff_t)l)end=(ptrdiff_t)l;
+if(start<=end)
+lua_pushlstring(L,s+start-1,end-start+1);
+else lua_pushliteral(L,"");
+return 1;
+}
+static int str_lower(lua_State*L){
+size_t l;
+size_t i;
+luaL_Buffer b;
+const char*s=luaL_checklstring(L,1,&l);
+luaL_buffinit(L,&b);
+for(i=0;i<l;i++)
+luaL_addchar(&b,tolower(uchar(s[i])));
+luaL_pushresult(&b);
+return 1;
+}
+static int str_upper(lua_State*L){
+size_t l;
+size_t i;
+luaL_Buffer b;
+const char*s=luaL_checklstring(L,1,&l);
+luaL_buffinit(L,&b);
+for(i=0;i<l;i++)
+luaL_addchar(&b,toupper(uchar(s[i])));
+luaL_pushresult(&b);
+return 1;
+}
+static int str_rep(lua_State*L){
+size_t l;
+luaL_Buffer b;
+const char*s=luaL_checklstring(L,1,&l);
+int n=luaL_checkint(L,2);
+luaL_buffinit(L,&b);
+while(n-->0)
+luaL_addlstring(&b,s,l);
+luaL_pushresult(&b);
+return 1;
+}
+static int str_byte(lua_State*L){
+size_t l;
+const char*s=luaL_checklstring(L,1,&l);
+ptrdiff_t posi=posrelat(luaL_optinteger(L,2,1),l);
+ptrdiff_t pose=posrelat(luaL_optinteger(L,3,posi),l);
+int n,i;
+if(posi<=0)posi=1;
+if((size_t)pose>l)pose=l;
+if(posi>pose)return 0;
+n=(int)(pose-posi+1);
+if(posi+n<=pose)
+luaL_error(L,"string slice too long");
+luaL_checkstack(L,n,"string slice too long");
+for(i=0;i<n;i++)
+lua_pushinteger(L,uchar(s[posi+i-1]));
+return n;
+}
+static int str_char(lua_State*L){
+int n=lua_gettop(L);
+int i;
+luaL_Buffer b;
+luaL_buffinit(L,&b);
+for(i=1;i<=n;i++){
+int c=luaL_checkint(L,i);
+luaL_argcheck(L,uchar(c)==c,i,"invalid value");
+luaL_addchar(&b,uchar(c));
+}
+luaL_pushresult(&b);
+return 1;
+}
+typedef struct MatchState{
+const char*src_init;
+const char*src_end;
+lua_State*L;
+int level;
+struct{
+const char*init;
+ptrdiff_t len;
+}capture[32];
+}MatchState;
+static int check_capture(MatchState*ms,int l){
+l-='1';
+if(l<0||l>=ms->level||ms->capture[l].len==(-1))
+return luaL_error(ms->L,"invalid capture index");
+return l;
+}
+static int capture_to_close(MatchState*ms){
+int level=ms->level;
+for(level--;level>=0;level--)
+if(ms->capture[level].len==(-1))return level;
+return luaL_error(ms->L,"invalid pattern capture");
+}
+static const char*classend(MatchState*ms,const char*p){
+switch(*p++){
+case'%':{
+if(*p=='\0')
+luaL_error(ms->L,"malformed pattern (ends with "LUA_QL("%%")")");
+return p+1;
+}
+case'[':{
+if(*p=='^')p++;
+do{
+if(*p=='\0')
+luaL_error(ms->L,"malformed pattern (missing "LUA_QL("]")")");
+if(*(p++)=='%'&&*p!='\0')
+p++;
+}while(*p!=']');
+return p+1;
+}
+default:{
+return p;
+}
+}
+}
+static int match_class(int c,int cl){
+int res;
+switch(tolower(cl)){
+case'a':res=isalpha(c);break;
+case'c':res=iscntrl(c);break;
+case'd':res=isdigit(c);break;
+case'l':res=islower(c);break;
+case'p':res=ispunct(c);break;
+case's':res=isspace(c);break;
+case'u':res=isupper(c);break;
+case'w':res=isalnum(c);break;
+case'x':res=isxdigit(c);break;
+case'z':res=(c==0);break;
+default:return(cl==c);
+}
+return(islower(cl)?res:!res);
+}
+static int matchbracketclass(int c,const char*p,const char*ec){
+int sig=1;
+if(*(p+1)=='^'){
+sig=0;
+p++;
+}
+while(++p<ec){
+if(*p=='%'){
+p++;
+if(match_class(c,uchar(*p)))
+return sig;
+}
+else if((*(p+1)=='-')&&(p+2<ec)){
+p+=2;
+if(uchar(*(p-2))<=c&&c<=uchar(*p))
+return sig;
+}
+else if(uchar(*p)==c)return sig;
+}
+return!sig;
+}
+static int singlematch(int c,const char*p,const char*ep){
+switch(*p){
+case'.':return 1;
+case'%':return match_class(c,uchar(*(p+1)));
+case'[':return matchbracketclass(c,p,ep-1);
+default:return(uchar(*p)==c);
+}
+}
+static const char*match(MatchState*ms,const char*s,const char*p);
+static const char*matchbalance(MatchState*ms,const char*s,
+const char*p){
+if(*p==0||*(p+1)==0)
+luaL_error(ms->L,"unbalanced pattern");
+if(*s!=*p)return NULL;
+else{
+int b=*p;
+int e=*(p+1);
+int cont=1;
+while(++s<ms->src_end){
+if(*s==e){
+if(--cont==0)return s+1;
+}
+else if(*s==b)cont++;
+}
+}
+return NULL;
+}
+static const char*max_expand(MatchState*ms,const char*s,
+const char*p,const char*ep){
+ptrdiff_t i=0;
+while((s+i)<ms->src_end&&singlematch(uchar(*(s+i)),p,ep))
+i++;
+while(i>=0){
+const char*res=match(ms,(s+i),ep+1);
+if(res)return res;
+i--;
+}
+return NULL;
+}
+static const char*min_expand(MatchState*ms,const char*s,
+const char*p,const char*ep){
+for(;;){
+const char*res=match(ms,s,ep+1);
+if(res!=NULL)
+return res;
+else if(s<ms->src_end&&singlematch(uchar(*s),p,ep))
+s++;
+else return NULL;
+}
+}
+static const char*start_capture(MatchState*ms,const char*s,
+const char*p,int what){
+const char*res;
+int level=ms->level;
+if(level>=32)luaL_error(ms->L,"too many captures");
+ms->capture[level].init=s;
+ms->capture[level].len=what;
+ms->level=level+1;
+if((res=match(ms,s,p))==NULL)
+ms->level--;
+return res;
+}
+static const char*end_capture(MatchState*ms,const char*s,
+const char*p){
+int l=capture_to_close(ms);
+const char*res;
+ms->capture[l].len=s-ms->capture[l].init;
+if((res=match(ms,s,p))==NULL)
+ms->capture[l].len=(-1);
+return res;
+}
+static const char*match_capture(MatchState*ms,const char*s,int l){
+size_t len;
+l=check_capture(ms,l);
+len=ms->capture[l].len;
+if((size_t)(ms->src_end-s)>=len&&
+memcmp(ms->capture[l].init,s,len)==0)
+return s+len;
+else return NULL;
+}
+static const char*match(MatchState*ms,const char*s,const char*p){
+init:
+switch(*p){
+case'(':{
+if(*(p+1)==')')
+return start_capture(ms,s,p+2,(-2));
+else
+return start_capture(ms,s,p+1,(-1));
+}
+case')':{
+return end_capture(ms,s,p+1);
+}
+case'%':{
+switch(*(p+1)){
+case'b':{
+s=matchbalance(ms,s,p+2);
+if(s==NULL)return NULL;
+p+=4;goto init;
+}
+case'f':{
+const char*ep;char previous;
+p+=2;
+if(*p!='[')
+luaL_error(ms->L,"missing "LUA_QL("[")" after "
+LUA_QL("%%f")" in pattern");
+ep=classend(ms,p);
+previous=(s==ms->src_init)?'\0':*(s-1);
+if(matchbracketclass(uchar(previous),p,ep-1)||
+!matchbracketclass(uchar(*s),p,ep-1))return NULL;
+p=ep;goto init;
+}
+default:{
+if(isdigit(uchar(*(p+1)))){
+s=match_capture(ms,s,uchar(*(p+1)));
+if(s==NULL)return NULL;
+p+=2;goto init;
+}
+goto dflt;
+}
+}
+}
+case'\0':{
+return s;
+}
+case'$':{
+if(*(p+1)=='\0')
+return(s==ms->src_end)?s:NULL;
+else goto dflt;
+}
+default:dflt:{
+const char*ep=classend(ms,p);
+int m=s<ms->src_end&&singlematch(uchar(*s),p,ep);
+switch(*ep){
+case'?':{
+const char*res;
+if(m&&((res=match(ms,s+1,ep+1))!=NULL))
+return res;
+p=ep+1;goto init;
+}
+case'*':{
+return max_expand(ms,s,p,ep);
+}
+case'+':{
+return(m?max_expand(ms,s+1,p,ep):NULL);
+}
+case'-':{
+return min_expand(ms,s,p,ep);
+}
+default:{
+if(!m)return NULL;
+s++;p=ep;goto init;
+}
+}
+}
+}
+}
+static const char*lmemfind(const char*s1,size_t l1,
+const char*s2,size_t l2){
+if(l2==0)return s1;
+else if(l2>l1)return NULL;
+else{
+const char*init;
+l2--;
+l1=l1-l2;
+while(l1>0&&(init=(const char*)memchr(s1,*s2,l1))!=NULL){
+init++;
+if(memcmp(init,s2+1,l2)==0)
+return init-1;
+else{
+l1-=init-s1;
+s1=init;
+}
+}
+return NULL;
+}
+}
+static void push_onecapture(MatchState*ms,int i,const char*s,
+const char*e){
+if(i>=ms->level){
+if(i==0)
+lua_pushlstring(ms->L,s,e-s);
+else
+luaL_error(ms->L,"invalid capture index");
+}
+else{
+ptrdiff_t l=ms->capture[i].len;
+if(l==(-1))luaL_error(ms->L,"unfinished capture");
+if(l==(-2))
+lua_pushinteger(ms->L,ms->capture[i].init-ms->src_init+1);
+else
+lua_pushlstring(ms->L,ms->capture[i].init,l);
+}
+}
+static int push_captures(MatchState*ms,const char*s,const char*e){
+int i;
+int nlevels=(ms->level==0&&s)?1:ms->level;
+luaL_checkstack(ms->L,nlevels,"too many captures");
+for(i=0;i<nlevels;i++)
+push_onecapture(ms,i,s,e);
+return nlevels;
+}
+static int str_find_aux(lua_State*L,int find){
+size_t l1,l2;
+const char*s=luaL_checklstring(L,1,&l1);
+const char*p=luaL_checklstring(L,2,&l2);
+ptrdiff_t init=posrelat(luaL_optinteger(L,3,1),l1)-1;
+if(init<0)init=0;
+else if((size_t)(init)>l1)init=(ptrdiff_t)l1;
+if(find&&(lua_toboolean(L,4)||
+strpbrk(p,"^$*+?.([%-")==NULL)){
+const char*s2=lmemfind(s+init,l1-init,p,l2);
+if(s2){
+lua_pushinteger(L,s2-s+1);
+lua_pushinteger(L,s2-s+l2);
+return 2;
+}
+}
+else{
+MatchState ms;
+int anchor=(*p=='^')?(p++,1):0;
+const char*s1=s+init;
+ms.L=L;
+ms.src_init=s;
+ms.src_end=s+l1;
+do{
+const char*res;
+ms.level=0;
+if((res=match(&ms,s1,p))!=NULL){
+if(find){
+lua_pushinteger(L,s1-s+1);
+lua_pushinteger(L,res-s);
+return push_captures(&ms,NULL,0)+2;
+}
+else
+return push_captures(&ms,s1,res);
+}
+}while(s1++<ms.src_end&&!anchor);
+}
+lua_pushnil(L);
+return 1;
+}
+static int str_find(lua_State*L){
+return str_find_aux(L,1);
+}
+static int str_match(lua_State*L){
+return str_find_aux(L,0);
+}
+static int gmatch_aux(lua_State*L){
+MatchState ms;
+size_t ls;
+const char*s=lua_tolstring(L,lua_upvalueindex(1),&ls);
+const char*p=lua_tostring(L,lua_upvalueindex(2));
+const char*src;
+ms.L=L;
+ms.src_init=s;
+ms.src_end=s+ls;
+for(src=s+(size_t)lua_tointeger(L,lua_upvalueindex(3));
+src<=ms.src_end;
+src++){
+const char*e;
+ms.level=0;
+if((e=match(&ms,src,p))!=NULL){
+lua_Integer newstart=e-s;
+if(e==src)newstart++;
+lua_pushinteger(L,newstart);
+lua_replace(L,lua_upvalueindex(3));
+return push_captures(&ms,src,e);
+}
+}
+return 0;
+}
+static int gmatch(lua_State*L){
+luaL_checkstring(L,1);
+luaL_checkstring(L,2);
+lua_settop(L,2);
+lua_pushinteger(L,0);
+lua_pushcclosure(L,gmatch_aux,3);
+return 1;
+}
+static void add_s(MatchState*ms,luaL_Buffer*b,const char*s,
+const char*e){
+size_t l,i;
+const char*news=lua_tolstring(ms->L,3,&l);
+for(i=0;i<l;i++){
+if(news[i]!='%')
+luaL_addchar(b,news[i]);
+else{
+i++;
+if(!isdigit(uchar(news[i])))
+luaL_addchar(b,news[i]);
+else if(news[i]=='0')
+luaL_addlstring(b,s,e-s);
+else{
+push_onecapture(ms,news[i]-'1',s,e);
+luaL_addvalue(b);
+}
+}
+}
+}
+static void add_value(MatchState*ms,luaL_Buffer*b,const char*s,
+const char*e){
+lua_State*L=ms->L;
+switch(lua_type(L,3)){
+case 3:
+case 4:{
+add_s(ms,b,s,e);
+return;
+}
+case 6:{
+int n;
+lua_pushvalue(L,3);
+n=push_captures(ms,s,e);
+lua_call(L,n,1);
+break;
+}
+case 5:{
+push_onecapture(ms,0,s,e);
+lua_gettable(L,3);
+break;
+}
+}
+if(!lua_toboolean(L,-1)){
+lua_pop(L,1);
+lua_pushlstring(L,s,e-s);
+}
+else if(!lua_isstring(L,-1))
+luaL_error(L,"invalid replacement value (a %s)",luaL_typename(L,-1));
+luaL_addvalue(b);
+}
+static int str_gsub(lua_State*L){
+size_t srcl;
+const char*src=luaL_checklstring(L,1,&srcl);
+const char*p=luaL_checkstring(L,2);
+int tr=lua_type(L,3);
+int max_s=luaL_optint(L,4,srcl+1);
+int anchor=(*p=='^')?(p++,1):0;
+int n=0;
+MatchState ms;
+luaL_Buffer b;
+luaL_argcheck(L,tr==3||tr==4||
+tr==6||tr==5,3,
+"string/function/table expected");
+luaL_buffinit(L,&b);
+ms.L=L;
+ms.src_init=src;
+ms.src_end=src+srcl;
+while(n<max_s){
+const char*e;
+ms.level=0;
+e=match(&ms,src,p);
+if(e){
+n++;
+add_value(&ms,&b,src,e);
+}
+if(e&&e>src)
+src=e;
+else if(src<ms.src_end)
+luaL_addchar(&b,*src++);
+else break;
+if(anchor)break;
+}
+luaL_addlstring(&b,src,ms.src_end-src);
+luaL_pushresult(&b);
+lua_pushinteger(L,n);
+return 2;
+}
+static void addquoted(lua_State*L,luaL_Buffer*b,int arg){
+size_t l;
+const char*s=luaL_checklstring(L,arg,&l);
+luaL_addchar(b,'"');
+while(l--){
+switch(*s){
+case'"':case'\\':case'\n':{
+luaL_addchar(b,'\\');
+luaL_addchar(b,*s);
+break;
+}
+case'\r':{
+luaL_addlstring(b,"\\r",2);
+break;
+}
+case'\0':{
+luaL_addlstring(b,"\\000",4);
+break;
+}
+default:{
+luaL_addchar(b,*s);
+break;
+}
+}
+s++;
+}
+luaL_addchar(b,'"');
+}
+static const char*scanformat(lua_State*L,const char*strfrmt,char*form){
+const char*p=strfrmt;
+while(*p!='\0'&&strchr("-+ #0",*p)!=NULL)p++;
+if((size_t)(p-strfrmt)>=sizeof("-+ #0"))
+luaL_error(L,"invalid format (repeated flags)");
+if(isdigit(uchar(*p)))p++;
+if(isdigit(uchar(*p)))p++;
+if(*p=='.'){
+p++;
+if(isdigit(uchar(*p)))p++;
+if(isdigit(uchar(*p)))p++;
+}
+if(isdigit(uchar(*p)))
+luaL_error(L,"invalid format (width or precision too long)");
+*(form++)='%';
+strncpy(form,strfrmt,p-strfrmt+1);
+form+=p-strfrmt+1;
+*form='\0';
+return p;
+}
+static void addintlen(char*form){
+size_t l=strlen(form);
+char spec=form[l-1];
+strcpy(form+l-1,"l");
+form[l+sizeof("l")-2]=spec;
+form[l+sizeof("l")-1]='\0';
+}
+static int str_format(lua_State*L){
+int top=lua_gettop(L);
+int arg=1;
+size_t sfl;
+const char*strfrmt=luaL_checklstring(L,arg,&sfl);
+const char*strfrmt_end=strfrmt+sfl;
+luaL_Buffer b;
+luaL_buffinit(L,&b);
+while(strfrmt<strfrmt_end){
+if(*strfrmt!='%')
+luaL_addchar(&b,*strfrmt++);
+else if(*++strfrmt=='%')
+luaL_addchar(&b,*strfrmt++);
+else{
+char form[(sizeof("-+ #0")+sizeof("l")+10)];
+char buff[512];
+if(++arg>top)
+luaL_argerror(L,arg,"no value");
+strfrmt=scanformat(L,strfrmt,form);
+switch(*strfrmt++){
+case'c':{
+sprintf(buff,form,(int)luaL_checknumber(L,arg));
+break;
+}
+case'd':case'i':{
+addintlen(form);
+sprintf(buff,form,(long)luaL_checknumber(L,arg));
+break;
+}
+case'o':case'u':case'x':case'X':{
+addintlen(form);
+sprintf(buff,form,(unsigned long)luaL_checknumber(L,arg));
+break;
+}
+case'e':case'E':case'f':
+case'g':case'G':{
+sprintf(buff,form,(double)luaL_checknumber(L,arg));
+break;
+}
+case'q':{
+addquoted(L,&b,arg);
+continue;
+}
+case's':{
+size_t l;
+const char*s=luaL_checklstring(L,arg,&l);
+if(!strchr(form,'.')&&l>=100){
+lua_pushvalue(L,arg);
+luaL_addvalue(&b);
+continue;
+}
+else{
+sprintf(buff,form,s);
+break;
+}
+}
+default:{
+return luaL_error(L,"invalid option "LUA_QL("%%%c")" to "
+LUA_QL("format"),*(strfrmt-1));
+}
+}
+luaL_addlstring(&b,buff,strlen(buff));
+}
+}
+luaL_pushresult(&b);
+return 1;
+}
+static const luaL_Reg strlib[]={
+{"byte",str_byte},
+{"char",str_char},
+{"find",str_find},
+{"format",str_format},
+{"gmatch",gmatch},
+{"gsub",str_gsub},
+{"lower",str_lower},
+{"match",str_match},
+{"rep",str_rep},
+{"sub",str_sub},
+{"upper",str_upper},
+{NULL,NULL}
+};
+static void createmetatable(lua_State*L){
+lua_createtable(L,0,1);
+lua_pushliteral(L,"");
+lua_pushvalue(L,-2);
+lua_setmetatable(L,-2);
+lua_pop(L,1);
+lua_pushvalue(L,-2);
+lua_setfield(L,-2,"__index");
+lua_pop(L,1);
+}
+static int luaopen_string(lua_State*L){
+luaL_register(L,"string",strlib);
+createmetatable(L);
+return 1;
+}
+static const luaL_Reg lualibs[]={
+{"",luaopen_base},
+{"table",luaopen_table},
+{"io",luaopen_io},
+{"os",luaopen_os},
+{"string",luaopen_string},
+{NULL,NULL}
+};
+static void luaL_openlibs(lua_State*L){
+const luaL_Reg*lib=lualibs;
+for(;lib->func;lib++){
+lua_pushcfunction(L,lib->func);
+lua_pushstring(L,lib->name);
+lua_call(L,1,0);
+}
+}
+typedef unsigned int UB;
+static UB barg(lua_State*L,int idx){
+union{lua_Number n;U64 b;}bn;
+bn.n=lua_tonumber(L,idx)+6755399441055744.0;
+if(bn.n==0.0&&!lua_isnumber(L,idx))luaL_typerror(L,idx,"number");
+return(UB)bn.b;
+}
+#define BRET(b)lua_pushnumber(L,(lua_Number)(int)(b));return 1;
+static int tobit(lua_State*L){
+BRET(barg(L,1))}
+static int bnot(lua_State*L){
+BRET(~barg(L,1))}
+static int band(lua_State*L){
+int i;UB b=barg(L,1);for(i=lua_gettop(L);i>1;i--)b&=barg(L,i);BRET(b)}
+static int bor(lua_State*L){
+int i;UB b=barg(L,1);for(i=lua_gettop(L);i>1;i--)b|=barg(L,i);BRET(b)}
+static int bxor(lua_State*L){
+int i;UB b=barg(L,1);for(i=lua_gettop(L);i>1;i--)b^=barg(L,i);BRET(b)}
+static int lshift(lua_State*L){
+UB b=barg(L,1),n=barg(L,2)&31;BRET(b<<n)}
+static int rshift(lua_State*L){
+UB b=barg(L,1),n=barg(L,2)&31;BRET(b>>n)}
+static int arshift(lua_State*L){
+UB b=barg(L,1),n=barg(L,2)&31;BRET((int)b>>n)}
+static int rol(lua_State*L){
+UB b=barg(L,1),n=barg(L,2)&31;BRET((b<<n)|(b>>(32-n)))}
+static int ror(lua_State*L){
+UB b=barg(L,1),n=barg(L,2)&31;BRET((b>>n)|(b<<(32-n)))}
+static int bswap(lua_State*L){
+UB b=barg(L,1);b=(b>>24)|((b>>8)&0xff00)|((b&0xff00)<<8)|(b<<24);BRET(b)}
+static int tohex(lua_State*L){
+UB b=barg(L,1);
+int n=lua_isnone(L,2)?8:(int)barg(L,2);
+const char*hexdigits="0123456789abcdef";
+char buf[8];
+int i;
+if(n<0){n=-n;hexdigits="0123456789ABCDEF";}
+if(n>8)n=8;
+for(i=(int)n;--i>=0;){buf[i]=hexdigits[b&15];b>>=4;}
+lua_pushlstring(L,buf,(size_t)n);
+return 1;
+}
+static const struct luaL_Reg bitlib[]={
+{"tobit",tobit},
+{"bnot",bnot},
+{"band",band},
+{"bor",bor},
+{"bxor",bxor},
+{"lshift",lshift},
+{"rshift",rshift},
+{"arshift",arshift},
+{"rol",rol},
+{"ror",ror},
+{"bswap",bswap},
+{"tohex",tohex},
+{NULL,NULL}
+};
+int main(int argc,char**argv){
+lua_State*L=luaL_newstate();
+int i;
+luaL_openlibs(L);
+luaL_register(L,"bit",bitlib);
+if(argc<2)return sizeof(void*);
+lua_createtable(L,0,1);
+lua_pushstring(L,argv[1]);
+lua_rawseti(L,-2,0);
+lua_setglobal(L,"arg");
+if(luaL_loadfile(L,argv[1]))
+goto err;
+for(i=2;i<argc;i++)
+lua_pushstring(L,argv[i]);
+if(lua_pcall(L,argc-2,0,0)){
+err:
+fprintf(stderr,"Error: %s\n",lua_tostring(L,-1));
+return 1;
+}
+lua_close(L);
+return 0;
+}
diff --git a/ext/opcache/jit/libudis86/LICENSE b/ext/opcache/jit/libudis86/LICENSE
new file mode 100644
index 0000000000..580f35987f
--- /dev/null
+++ b/ext/opcache/jit/libudis86/LICENSE
@@ -0,0 +1,22 @@
+Copyright (c) 2002-2012, Vivek Thampi <vivek.mt@gmail.com>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/ext/opcache/jit/libudis86/decode.c b/ext/opcache/jit/libudis86/decode.c
new file mode 100644
index 0000000000..1c97d280d9
--- /dev/null
+++ b/ext/opcache/jit/libudis86/decode.c
@@ -0,0 +1,1266 @@
+/* udis86 - libudis86/decode.c
+ *
+ * Copyright (c) 2002-2009 Vivek Thampi
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "udint.h"
+#include "types.h"
+#include "extern.h"
+#include "decode.h"
+
+#ifndef __UD_STANDALONE__
+# include <string.h>
+#endif /* __UD_STANDALONE__ */
+
+/* The max number of prefixes to an instruction */
+#define MAX_PREFIXES 15
+
+/* rex prefix bits */
+#define REX_W(r) ( ( 0xF & ( r ) ) >> 3 )
+#define REX_R(r) ( ( 0x7 & ( r ) ) >> 2 )
+#define REX_X(r) ( ( 0x3 & ( r ) ) >> 1 )
+#define REX_B(r) ( ( 0x1 & ( r ) ) >> 0 )
+#define REX_PFX_MASK(n) ( ( P_REXW(n) << 3 ) | \
+ ( P_REXR(n) << 2 ) | \
+ ( P_REXX(n) << 1 ) | \
+ ( P_REXB(n) << 0 ) )
+
+/* scable-index-base bits */
+#define SIB_S(b) ( ( b ) >> 6 )
+#define SIB_I(b) ( ( ( b ) >> 3 ) & 7 )
+#define SIB_B(b) ( ( b ) & 7 )
+
+/* modrm bits */
+#define MODRM_REG(b) ( ( ( b ) >> 3 ) & 7 )
+#define MODRM_NNN(b) ( ( ( b ) >> 3 ) & 7 )
+#define MODRM_MOD(b) ( ( ( b ) >> 6 ) & 3 )
+#define MODRM_RM(b) ( ( b ) & 7 )
+
+static int decode_ext(struct ud *u, uint16_t ptr);
+static int decode_opcode(struct ud *u);
+
+enum reg_class { /* register classes */
+ REGCLASS_GPR,
+ REGCLASS_MMX,
+ REGCLASS_CR,
+ REGCLASS_DB,
+ REGCLASS_SEG,
+ REGCLASS_XMM
+};
+
+ /*
+ * inp_start
+ * Should be called before each de-code operation.
+ */
+static void
+inp_start(struct ud *u)
+{
+ u->inp_ctr = 0;
+}
+
+static uint8_t
+inp_peek(struct ud *u)
+{
+ if (u->inp_end == 0) {
+ if (u->inp_buf != NULL) {
+ if (u->inp_buf_index < u->inp_buf_size) {
+ return u->inp_buf[u->inp_buf_index];
+ }
+ } else if (u->inp_peek != UD_EOI) {
+ return u->inp_peek;
+ } else {
+ int c;
+ if ((c = u->inp_hook(u)) != UD_EOI) {
+ u->inp_peek = c;
+ return u->inp_peek;
+ }
+ }
+ }
+ u->inp_end = 1;
+ UDERR(u, "byte expected, eoi received\n");
+ return 0;
+}
+
+static uint8_t
+inp_next(struct ud *u)
+{
+ if (u->inp_end == 0) {
+ if (u->inp_buf != NULL) {
+ if (u->inp_buf_index < u->inp_buf_size) {
+ u->inp_ctr++;
+ return (u->inp_curr = u->inp_buf[u->inp_buf_index++]);
+ }
+ } else {
+ int c = u->inp_peek;
+ if (c != UD_EOI || (c = u->inp_hook(u)) != UD_EOI) {
+ u->inp_peek = UD_EOI;
+ u->inp_curr = c;
+ u->inp_sess[u->inp_ctr++] = u->inp_curr;
+ return u->inp_curr;
+ }
+ }
+ }
+ u->inp_end = 1;
+ UDERR(u, "byte expected, eoi received\n");
+ return 0;
+}
+
+static uint8_t
+inp_curr(struct ud *u)
+{
+ return u->inp_curr;
+}
+
+
+/*
+ * inp_uint8
+ * int_uint16
+ * int_uint32
+ * int_uint64
+ * Load little-endian values from input
+ */
+static uint8_t
+inp_uint8(struct ud* u)
+{
+ return inp_next(u);
+}
+
+static uint16_t
+inp_uint16(struct ud* u)
+{
+ uint16_t r, ret;
+
+ ret = inp_next(u);
+ r = inp_next(u);
+ return ret | (r << 8);
+}
+
+static uint32_t
+inp_uint32(struct ud* u)
+{
+ uint32_t r, ret;
+
+ ret = inp_next(u);
+ r = inp_next(u);
+ ret = ret | (r << 8);
+ r = inp_next(u);
+ ret = ret | (r << 16);
+ r = inp_next(u);
+ return ret | (r << 24);
+}
+
+static uint64_t
+inp_uint64(struct ud* u)
+{
+ uint64_t r, ret;
+
+ ret = inp_next(u);
+ r = inp_next(u);
+ ret = ret | (r << 8);
+ r = inp_next(u);
+ ret = ret | (r << 16);
+ r = inp_next(u);
+ ret = ret | (r << 24);
+ r = inp_next(u);
+ ret = ret | (r << 32);
+ r = inp_next(u);
+ ret = ret | (r << 40);
+ r = inp_next(u);
+ ret = ret | (r << 48);
+ r = inp_next(u);
+ return ret | (r << 56);
+}
+
+
+static UD_INLINE int
+eff_opr_mode(int dis_mode, int rex_w, int pfx_opr)
+{
+ if (dis_mode == 64) {
+ return rex_w ? 64 : (pfx_opr ? 16 : 32);
+ } else if (dis_mode == 32) {
+ return pfx_opr ? 16 : 32;
+ } else {
+ UD_ASSERT(dis_mode == 16);
+ return pfx_opr ? 32 : 16;
+ }
+}
+
+
+static UD_INLINE int
+eff_adr_mode(int dis_mode, int pfx_adr)
+{
+ if (dis_mode == 64) {
+ return pfx_adr ? 32 : 64;
+ } else if (dis_mode == 32) {
+ return pfx_adr ? 16 : 32;
+ } else {
+ UD_ASSERT(dis_mode == 16);
+ return pfx_adr ? 32 : 16;
+ }
+}
+
+
+/*
+ * decode_prefixes
+ *
+ * Extracts instruction prefixes.
+ */
+static int
+decode_prefixes(struct ud *u)
+{
+ int done = 0;
+ uint8_t curr = 0, last = 0;
+ UD_RETURN_ON_ERROR(u);
+
+ do {
+ last = curr;
+ curr = inp_next(u);
+ UD_RETURN_ON_ERROR(u);
+ if (u->inp_ctr == MAX_INSN_LENGTH) {
+ UD_RETURN_WITH_ERROR(u, "max instruction length");
+ }
+
+ switch (curr)
+ {
+ case 0x2E:
+ u->pfx_seg = UD_R_CS;
+ break;
+ case 0x36:
+ u->pfx_seg = UD_R_SS;
+ break;
+ case 0x3E:
+ u->pfx_seg = UD_R_DS;
+ break;
+ case 0x26:
+ u->pfx_seg = UD_R_ES;
+ break;
+ case 0x64:
+ u->pfx_seg = UD_R_FS;
+ break;
+ case 0x65:
+ u->pfx_seg = UD_R_GS;
+ break;
+ case 0x67: /* adress-size override prefix */
+ u->pfx_adr = 0x67;
+ break;
+ case 0xF0:
+ u->pfx_lock = 0xF0;
+ break;
+ case 0x66:
+ u->pfx_opr = 0x66;
+ break;
+ case 0xF2:
+ u->pfx_str = 0xf2;
+ break;
+ case 0xF3:
+ u->pfx_str = 0xf3;
+ break;
+ default:
+ /* consume if rex */
+ done = (u->dis_mode == 64 && (curr & 0xF0) == 0x40) ? 0 : 1;
+ break;
+ }
+ } while (!done);
+ /* rex prefixes in 64bit mode, must be the last prefix */
+ if (u->dis_mode == 64 && (last & 0xF0) == 0x40) {
+ u->pfx_rex = last;
+ }
+ return 0;
+}
+
+
+/*
+ * vex_l, vex_w
+ * Return the vex.L and vex.W bits
+ */
+static UD_INLINE uint8_t
+vex_l(const struct ud *u)
+{
+ UD_ASSERT(u->vex_op != 0);
+ return ((u->vex_op == 0xc4 ? u->vex_b2 : u->vex_b1) >> 2) & 1;
+}
+
+static UD_INLINE uint8_t
+vex_w(const struct ud *u)
+{
+ UD_ASSERT(u->vex_op != 0);
+ return u->vex_op == 0xc4 ? ((u->vex_b2 >> 7) & 1) : 0;
+}
+
+
+static UD_INLINE uint8_t
+modrm(struct ud * u)
+{
+ if ( !u->have_modrm ) {
+ u->modrm = inp_next( u );
+ u->modrm_offset = (uint8_t) (u->inp_ctr - 1);
+ u->have_modrm = 1;
+ }
+ return u->modrm;
+}
+
+
+static unsigned int
+resolve_operand_size(const struct ud* u, ud_operand_size_t osize)
+{
+ switch (osize) {
+ case SZ_V:
+ return u->opr_mode;
+ case SZ_Z:
+ return u->opr_mode == 16 ? 16 : 32;
+ case SZ_Y:
+ return u->opr_mode == 16 ? 32 : u->opr_mode;
+ case SZ_RDQ:
+ return u->dis_mode == 64 ? 64 : 32;
+ case SZ_X:
+ UD_ASSERT(u->vex_op != 0);
+ return (P_VEXL(u->itab_entry->prefix) && vex_l(u)) ? SZ_QQ : SZ_DQ;
+ default:
+ return osize;
+ }
+}
+
+
+static int resolve_mnemonic( struct ud* u )
+{
+ /* resolve 3dnow weirdness. */
+ if ( u->mnemonic == UD_I3dnow ) {
+ u->mnemonic = ud_itab[ u->le->table[ inp_curr( u ) ] ].mnemonic;
+ }
+ /* SWAPGS is only valid in 64bits mode */
+ if ( u->mnemonic == UD_Iswapgs && u->dis_mode != 64 ) {
+ UDERR(u, "swapgs invalid in 64bits mode\n");
+ return -1;
+ }
+
+ if (u->mnemonic == UD_Ixchg) {
+ if ((u->operand[0].type == UD_OP_REG && u->operand[0].base == UD_R_AX &&
+ u->operand[1].type == UD_OP_REG && u->operand[1].base == UD_R_AX) ||
+ (u->operand[0].type == UD_OP_REG && u->operand[0].base == UD_R_EAX &&
+ u->operand[1].type == UD_OP_REG && u->operand[1].base == UD_R_EAX)) {
+ u->operand[0].type = UD_NONE;
+ u->operand[1].type = UD_NONE;
+ u->mnemonic = UD_Inop;
+ }
+ }
+
+ if (u->mnemonic == UD_Inop && u->pfx_repe) {
+ u->pfx_repe = 0;
+ u->mnemonic = UD_Ipause;
+ }
+ return 0;
+}
+
+
+/* -----------------------------------------------------------------------------
+ * decode_a()- Decodes operands of the type seg:offset
+ * -----------------------------------------------------------------------------
+ */
+static void
+decode_a(struct ud* u, struct ud_operand *op)
+{
+ if (u->opr_mode == 16) {
+ /* seg16:off16 */
+ op->type = UD_OP_PTR;
+ op->size = 32;
+ op->lval.ptr.off = inp_uint16(u);
+ op->lval.ptr.seg = inp_uint16(u);
+ } else {
+ /* seg16:off32 */
+ op->type = UD_OP_PTR;
+ op->size = 48;
+ op->lval.ptr.off = inp_uint32(u);
+ op->lval.ptr.seg = inp_uint16(u);
+ }
+}
+
+/* -----------------------------------------------------------------------------
+ * decode_gpr() - Returns decoded General Purpose Register
+ * -----------------------------------------------------------------------------
+ */
+static enum ud_type
+decode_gpr(register struct ud* u, unsigned int s, unsigned char rm)
+{
+ switch (s) {
+ case 64:
+ return UD_R_RAX + rm;
+ case 32:
+ return UD_R_EAX + rm;
+ case 16:
+ return UD_R_AX + rm;
+ case 8:
+ if (u->dis_mode == 64 && u->pfx_rex) {
+ if (rm >= 4)
+ return UD_R_SPL + (rm-4);
+ return UD_R_AL + rm;
+ } else return UD_R_AL + rm;
+ case 0:
+ /* invalid size in case of a decode error */
+ UD_ASSERT(u->error);
+ return UD_NONE;
+ default:
+ UD_ASSERT(!"invalid operand size");
+ return UD_NONE;
+ }
+}
+
+static void
+decode_reg(struct ud *u,
+ struct ud_operand *opr,
+ int type,
+ int num,
+ int size)
+{
+ int reg;
+ size = resolve_operand_size(u, size);
+ switch (type) {
+ case REGCLASS_GPR : reg = decode_gpr(u, size, num); break;
+ case REGCLASS_MMX : reg = UD_R_MM0 + (num & 7); break;
+ case REGCLASS_XMM :
+ reg = num + (size == SZ_QQ ? UD_R_YMM0 : UD_R_XMM0);
+ break;
+ case REGCLASS_CR : reg = UD_R_CR0 + num; break;
+ case REGCLASS_DB : reg = UD_R_DR0 + num; break;
+ case REGCLASS_SEG : {
+ /*
+ * Only 6 segment registers, anything else is an error.
+ */
+ if ((num & 7) > 5) {
+ UDERR(u, "invalid segment register value\n");
+ return;
+ } else {
+ reg = UD_R_ES + (num & 7);
+ }
+ break;
+ }
+ default:
+ UD_ASSERT(!"invalid register type");
+ return;
+ }
+ opr->type = UD_OP_REG;
+ opr->base = reg;
+ opr->size = size;
+}
+
+
+/*
+ * decode_imm
+ *
+ * Decode Immediate values.
+ */
+static void
+decode_imm(struct ud* u, unsigned int size, struct ud_operand *op)
+{
+ op->size = resolve_operand_size(u, size);
+ op->type = UD_OP_IMM;
+
+ switch (op->size) {
+ case 8: op->lval.sbyte = inp_uint8(u); break;
+ case 16: op->lval.uword = inp_uint16(u); break;
+ case 32: op->lval.udword = inp_uint32(u); break;
+ case 64: op->lval.uqword = inp_uint64(u); break;
+ default: return;
+ }
+}
+
+
+/*
+ * decode_mem_disp
+ *
+ * Decode mem address displacement.
+ */
+static void
+decode_mem_disp(struct ud* u, unsigned int size, struct ud_operand *op)
+{
+ switch (size) {
+ case 8:
+ op->offset = 8;
+ op->lval.ubyte = inp_uint8(u);
+ break;
+ case 16:
+ op->offset = 16;
+ op->lval.uword = inp_uint16(u);
+ break;
+ case 32:
+ op->offset = 32;
+ op->lval.udword = inp_uint32(u);
+ break;
+ case 64:
+ op->offset = 64;
+ op->lval.uqword = inp_uint64(u);
+ break;
+ default:
+ return;
+ }
+}
+
+
+/*
+ * decode_modrm_reg
+ *
+ * Decodes reg field of mod/rm byte
+ *
+ */
+static UD_INLINE void
+decode_modrm_reg(struct ud *u,
+ struct ud_operand *operand,
+ unsigned int type,
+ unsigned int size)
+{
+ uint8_t reg = (REX_R(u->_rex) << 3) | MODRM_REG(modrm(u));
+ decode_reg(u, operand, type, reg, size);
+}
+
+
+/*
+ * decode_modrm_rm
+ *
+ * Decodes rm field of mod/rm byte
+ *
+ */
+static void
+decode_modrm_rm(struct ud *u,
+ struct ud_operand *op,
+ unsigned char type, /* register type */
+ unsigned int size) /* operand size */
+
+{
+ size_t offset = 0;
+ unsigned char mod, rm;
+
+ /* get mod, r/m and reg fields */
+ mod = MODRM_MOD(modrm(u));
+ rm = (REX_B(u->_rex) << 3) | MODRM_RM(modrm(u));
+
+ /*
+ * If mod is 11b, then the modrm.rm specifies a register.
+ *
+ */
+ if (mod == 3) {
+ decode_reg(u, op, type, rm, size);
+ return;
+ }
+
+ /*
+ * !11b => Memory Address
+ */
+ op->type = UD_OP_MEM;
+ op->size = resolve_operand_size(u, size);
+
+ if (u->adr_mode == 64) {
+ op->base = UD_R_RAX + rm;
+ if (mod == 1) {
+ offset = 8;
+ } else if (mod == 2) {
+ offset = 32;
+ } else if (mod == 0 && (rm & 7) == 5) {
+ op->base = UD_R_RIP;
+ offset = 32;
+ } else {
+ offset = 0;
+ }
+ /*
+ * Scale-Index-Base (SIB)
+ */
+ if ((rm & 7) == 4) {
+ inp_next(u);
+
+ op->base = UD_R_RAX + (SIB_B(inp_curr(u)) | (REX_B(u->_rex) << 3));
+ op->index = UD_R_RAX + (SIB_I(inp_curr(u)) | (REX_X(u->_rex) << 3));
+ /* special conditions for base reference */
+ if (op->index == UD_R_RSP) {
+ op->index = UD_NONE;
+ op->scale = UD_NONE;
+ } else {
+ op->scale = (1 << SIB_S(inp_curr(u))) & ~1;
+ }
+
+ if (op->base == UD_R_RBP || op->base == UD_R_R13) {
+ if (mod == 0) {
+ op->base = UD_NONE;
+ }
+ if (mod == 1) {
+ offset = 8;
+ } else {
+ offset = 32;
+ }
+ }
+ } else {
+ op->scale = UD_NONE;
+ op->index = UD_NONE;
+ }
+ } else if (u->adr_mode == 32) {
+ op->base = UD_R_EAX + rm;
+ if (mod == 1) {
+ offset = 8;
+ } else if (mod == 2) {
+ offset = 32;
+ } else if (mod == 0 && rm == 5) {
+ op->base = UD_NONE;
+ offset = 32;
+ } else {
+ offset = 0;
+ }
+
+ /* Scale-Index-Base (SIB) */
+ if ((rm & 7) == 4) {
+ inp_next(u);
+
+ op->scale = (1 << SIB_S(inp_curr(u))) & ~1;
+ op->index = UD_R_EAX + (SIB_I(inp_curr(u)) | (REX_X(u->pfx_rex) << 3));
+ op->base = UD_R_EAX + (SIB_B(inp_curr(u)) | (REX_B(u->pfx_rex) << 3));
+
+ if (op->index == UD_R_ESP) {
+ op->index = UD_NONE;
+ op->scale = UD_NONE;
+ }
+
+ /* special condition for base reference */
+ if (op->base == UD_R_EBP) {
+ if (mod == 0) {
+ op->base = UD_NONE;
+ }
+ if (mod == 1) {
+ offset = 8;
+ } else {
+ offset = 32;
+ }
+ }
+ } else {
+ op->scale = UD_NONE;
+ op->index = UD_NONE;
+ }
+ } else {
+ const unsigned int bases[] = { UD_R_BX, UD_R_BX, UD_R_BP, UD_R_BP,
+ UD_R_SI, UD_R_DI, UD_R_BP, UD_R_BX };
+ const unsigned int indices[] = { UD_R_SI, UD_R_DI, UD_R_SI, UD_R_DI,
+ UD_NONE, UD_NONE, UD_NONE, UD_NONE };
+ op->base = bases[rm & 7];
+ op->index = indices[rm & 7];
+ op->scale = UD_NONE;
+ if (mod == 0 && rm == 6) {
+ offset = 16;
+ op->base = UD_NONE;
+ } else if (mod == 1) {
+ offset = 8;
+ } else if (mod == 2) {
+ offset = 16;
+ }
+ }
+
+ if (offset) {
+ decode_mem_disp(u, offset, op);
+ } else {
+ op->offset = 0;
+ }
+}
+
+
+/*
+ * decode_moffset
+ * Decode offset-only memory operand
+ */
+static void
+decode_moffset(struct ud *u, unsigned int size, struct ud_operand *opr)
+{
+ opr->type = UD_OP_MEM;
+ opr->base = UD_NONE;
+ opr->index = UD_NONE;
+ opr->scale = UD_NONE;
+ opr->size = resolve_operand_size(u, size);
+ decode_mem_disp(u, u->adr_mode, opr);
+}
+
+
+static void
+decode_vex_vvvv(struct ud *u, struct ud_operand *opr, unsigned size)
+{
+ uint8_t vvvv;
+ UD_ASSERT(u->vex_op != 0);
+ vvvv = ((u->vex_op == 0xc4 ? u->vex_b2 : u->vex_b1) >> 3) & 0xf;
+ decode_reg(u, opr, REGCLASS_XMM, (0xf & ~vvvv), size);
+}
+
+
+/*
+ * decode_vex_immreg
+ * Decode source operand encoded in immediate byte [7:4]
+ */
+static int
+decode_vex_immreg(struct ud *u, struct ud_operand *opr, unsigned size)
+{
+ uint8_t imm = inp_next(u);
+ uint8_t mask = u->dis_mode == 64 ? 0xf : 0x7;
+ UD_RETURN_ON_ERROR(u);
+ UD_ASSERT(u->vex_op != 0);
+ decode_reg(u, opr, REGCLASS_XMM, mask & (imm >> 4), size);
+ return 0;
+}
+
+
+/*
+ * decode_operand
+ *
+ * Decodes a single operand.
+ * Returns the type of the operand (UD_NONE if none)
+ */
+static int
+decode_operand(struct ud *u,
+ struct ud_operand *operand,
+ enum ud_operand_code type,
+ unsigned int size)
+{
+ operand->type = UD_NONE;
+ operand->_oprcode = type;
+
+ switch (type) {
+ case OP_A :
+ decode_a(u, operand);
+ break;
+ case OP_MR:
+ decode_modrm_rm(u, operand, REGCLASS_GPR,
+ MODRM_MOD(modrm(u)) == 3 ?
+ Mx_reg_size(size) : Mx_mem_size(size));
+ break;
+ case OP_F:
+ u->br_far = 1;
+ /* intended fall through */
+ case OP_M:
+ if (MODRM_MOD(modrm(u)) == 3) {
+ UDERR(u, "expected modrm.mod != 3\n");
+ }
+ /* intended fall through */
+ case OP_E:
+ decode_modrm_rm(u, operand, REGCLASS_GPR, size);
+ break;
+ case OP_G:
+ decode_modrm_reg(u, operand, REGCLASS_GPR, size);
+ break;
+ case OP_sI:
+ case OP_I:
+ decode_imm(u, size, operand);
+ break;
+ case OP_I1:
+ operand->type = UD_OP_CONST;
+ operand->lval.udword = 1;
+ break;
+ case OP_N:
+ if (MODRM_MOD(modrm(u)) != 3) {
+ UDERR(u, "expected modrm.mod == 3\n");
+ }
+ /* intended fall through */
+ case OP_Q:
+ decode_modrm_rm(u, operand, REGCLASS_MMX, size);
+ break;
+ case OP_P:
+ decode_modrm_reg(u, operand, REGCLASS_MMX, size);
+ break;
+ case OP_U:
+ if (MODRM_MOD(modrm(u)) != 3) {
+ UDERR(u, "expected modrm.mod == 3\n");
+ }
+ /* intended fall through */
+ case OP_W:
+ decode_modrm_rm(u, operand, REGCLASS_XMM, size);
+ break;
+ case OP_V:
+ decode_modrm_reg(u, operand, REGCLASS_XMM, size);
+ break;
+ case OP_H:
+ decode_vex_vvvv(u, operand, size);
+ break;
+ case OP_MU:
+ decode_modrm_rm(u, operand, REGCLASS_XMM,
+ MODRM_MOD(modrm(u)) == 3 ?
+ Mx_reg_size(size) : Mx_mem_size(size));
+ break;
+ case OP_S:
+ decode_modrm_reg(u, operand, REGCLASS_SEG, size);
+ break;
+ case OP_O:
+ decode_moffset(u, size, operand);
+ break;
+ case OP_R0:
+ case OP_R1:
+ case OP_R2:
+ case OP_R3:
+ case OP_R4:
+ case OP_R5:
+ case OP_R6:
+ case OP_R7:
+ decode_reg(u, operand, REGCLASS_GPR,
+ (REX_B(u->_rex) << 3) | (type - OP_R0), size);
+ break;
+ case OP_AL:
+ case OP_AX:
+ case OP_eAX:
+ case OP_rAX:
+ decode_reg(u, operand, REGCLASS_GPR, 0, size);
+ break;
+ case OP_CL:
+ case OP_CX:
+ case OP_eCX:
+ decode_reg(u, operand, REGCLASS_GPR, 1, size);
+ break;
+ case OP_DL:
+ case OP_DX:
+ case OP_eDX:
+ decode_reg(u, operand, REGCLASS_GPR, 2, size);
+ break;
+ case OP_ES:
+ case OP_CS:
+ case OP_DS:
+ case OP_SS:
+ case OP_FS:
+ case OP_GS:
+ /* in 64bits mode, only fs and gs are allowed */
+ if (u->dis_mode == 64) {
+ if (type != OP_FS && type != OP_GS) {
+ UDERR(u, "invalid segment register in 64bits\n");
+ }
+ }
+ operand->type = UD_OP_REG;
+ operand->base = (type - OP_ES) + UD_R_ES;
+ operand->size = 16;
+ break;
+ case OP_J :
+ decode_imm(u, size, operand);
+ operand->type = UD_OP_JIMM;
+ break ;
+ case OP_R :
+ if (MODRM_MOD(modrm(u)) != 3) {
+ UDERR(u, "expected modrm.mod == 3\n");
+ }
+ decode_modrm_rm(u, operand, REGCLASS_GPR, size);
+ break;
+ case OP_C:
+ decode_modrm_reg(u, operand, REGCLASS_CR, size);
+ break;
+ case OP_D:
+ decode_modrm_reg(u, operand, REGCLASS_DB, size);
+ break;
+ case OP_I3 :
+ operand->type = UD_OP_CONST;
+ operand->lval.sbyte = 3;
+ break;
+ case OP_ST0:
+ case OP_ST1:
+ case OP_ST2:
+ case OP_ST3:
+ case OP_ST4:
+ case OP_ST5:
+ case OP_ST6:
+ case OP_ST7:
+ operand->type = UD_OP_REG;
+ operand->base = (type - OP_ST0) + UD_R_ST0;
+ operand->size = 80;
+ break;
+ case OP_L:
+ decode_vex_immreg(u, operand, size);
+ break;
+ default :
+ operand->type = UD_NONE;
+ break;
+ }
+ return operand->type;
+}
+
+
+/*
+ * decode_operands
+ *
+ * Disassemble up to 3 operands of the current instruction being
+ * disassembled. By the end of the function, the operand fields
+ * of the ud structure will have been filled.
+ */
+static int
+decode_operands(struct ud* u)
+{
+ decode_operand(u, &u->operand[0],
+ u->itab_entry->operand1.type,
+ u->itab_entry->operand1.size);
+ if (u->operand[0].type != UD_NONE) {
+ decode_operand(u, &u->operand[1],
+ u->itab_entry->operand2.type,
+ u->itab_entry->operand2.size);
+ }
+ if (u->operand[1].type != UD_NONE) {
+ decode_operand(u, &u->operand[2],
+ u->itab_entry->operand3.type,
+ u->itab_entry->operand3.size);
+ }
+ if (u->operand[2].type != UD_NONE) {
+ decode_operand(u, &u->operand[3],
+ u->itab_entry->operand4.type,
+ u->itab_entry->operand4.size);
+ }
+ return 0;
+}
+
+/* -----------------------------------------------------------------------------
+ * clear_insn() - clear instruction structure
+ * -----------------------------------------------------------------------------
+ */
+static void
+clear_insn(register struct ud* u)
+{
+ u->error = 0;
+ u->pfx_seg = 0;
+ u->pfx_opr = 0;
+ u->pfx_adr = 0;
+ u->pfx_lock = 0;
+ u->pfx_repne = 0;
+ u->pfx_rep = 0;
+ u->pfx_repe = 0;
+ u->pfx_rex = 0;
+ u->pfx_str = 0;
+ u->mnemonic = UD_Inone;
+ u->itab_entry = NULL;
+ u->have_modrm = 0;
+ u->br_far = 0;
+ u->vex_op = 0;
+ u->_rex = 0;
+ u->operand[0].type = UD_NONE;
+ u->operand[1].type = UD_NONE;
+ u->operand[2].type = UD_NONE;
+ u->operand[3].type = UD_NONE;
+}
+
+
+static UD_INLINE int
+resolve_pfx_str(struct ud* u)
+{
+ if (u->pfx_str == 0xf3) {
+ if (P_STR(u->itab_entry->prefix)) {
+ u->pfx_rep = 0xf3;
+ } else {
+ u->pfx_repe = 0xf3;
+ }
+ } else if (u->pfx_str == 0xf2) {
+ u->pfx_repne = 0xf3;
+ }
+ return 0;
+}
+
+
+static int
+resolve_mode( struct ud* u )
+{
+ int default64;
+ /* if in error state, bail out */
+ if ( u->error ) return -1;
+
+ /* propagate prefix effects */
+ if ( u->dis_mode == 64 ) { /* set 64bit-mode flags */
+
+ /* Check validity of instruction m64 */
+ if ( P_INV64( u->itab_entry->prefix ) ) {
+ UDERR(u, "instruction invalid in 64bits\n");
+ return -1;
+ }
+
+ /* compute effective rex based on,
+ * - vex prefix (if any)
+ * - rex prefix (if any, and not vex)
+ * - allowed prefixes specified by the opcode map
+ */
+ if (u->vex_op == 0xc4) {
+ /* vex has rex.rxb in 1's complement */
+ u->_rex = ((~(u->vex_b1 >> 5) & 0x7) /* rex.0rxb */ |
+ ((u->vex_b2 >> 4) & 0x8) /* rex.w000 */);
+ } else if (u->vex_op == 0xc5) {
+ /* vex has rex.r in 1's complement */
+ u->_rex = (~(u->vex_b1 >> 5)) & 4;
+ } else {
+ UD_ASSERT(u->vex_op == 0);
+ u->_rex = u->pfx_rex;
+ }
+ u->_rex &= REX_PFX_MASK(u->itab_entry->prefix);
+
+ /* whether this instruction has a default operand size of
+ * 64bit, also hardcoded into the opcode map.
+ */
+ default64 = P_DEF64( u->itab_entry->prefix );
+ /* calculate effective operand size */
+ if (REX_W(u->_rex)) {
+ u->opr_mode = 64;
+ } else if ( u->pfx_opr ) {
+ u->opr_mode = 16;
+ } else {
+ /* unless the default opr size of instruction is 64,
+ * the effective operand size in the absence of rex.w
+ * prefix is 32.
+ */
+ u->opr_mode = default64 ? 64 : 32;
+ }
+
+ /* calculate effective address size */
+ u->adr_mode = (u->pfx_adr) ? 32 : 64;
+ } else if ( u->dis_mode == 32 ) { /* set 32bit-mode flags */
+ u->opr_mode = ( u->pfx_opr ) ? 16 : 32;
+ u->adr_mode = ( u->pfx_adr ) ? 16 : 32;
+ } else if ( u->dis_mode == 16 ) { /* set 16bit-mode flags */
+ u->opr_mode = ( u->pfx_opr ) ? 32 : 16;
+ u->adr_mode = ( u->pfx_adr ) ? 32 : 16;
+ }
+
+ return 0;
+}
+
+
+static UD_INLINE int
+decode_insn(struct ud *u, uint16_t ptr)
+{
+ UD_ASSERT((ptr & 0x8000) == 0);
+ u->itab_entry = &ud_itab[ ptr ];
+ u->mnemonic = u->itab_entry->mnemonic;
+ return (resolve_pfx_str(u) == 0 &&
+ resolve_mode(u) == 0 &&
+ decode_operands(u) == 0 &&
+ resolve_mnemonic(u) == 0) ? 0 : -1;
+}
+
+
+/*
+ * decode_3dnow()
+ *
+ * Decoding 3dnow is a little tricky because of its strange opcode
+ * structure. The final opcode disambiguation depends on the last
+ * byte that comes after the operands have been decoded. Fortunately,
+ * all 3dnow instructions have the same set of operand types. So we
+ * go ahead and decode the instruction by picking an arbitrarily chosen
+ * valid entry in the table, decode the operands, and read the final
+ * byte to resolve the menmonic.
+ */
+static UD_INLINE int
+decode_3dnow(struct ud* u)
+{
+ uint16_t ptr;
+ UD_ASSERT(u->le->type == UD_TAB__OPC_3DNOW);
+ UD_ASSERT(u->le->table[0xc] != 0);
+ decode_insn(u, u->le->table[0xc]);
+ inp_next(u);
+ if (u->error) {
+ return -1;
+ }
+ ptr = u->le->table[inp_curr(u)];
+ UD_ASSERT((ptr & 0x8000) == 0);
+ u->mnemonic = ud_itab[ptr].mnemonic;
+ return 0;
+}
+
+
+static int
+decode_ssepfx(struct ud *u)
+{
+ uint8_t idx;
+ uint8_t pfx;
+
+ /*
+ * String prefixes (f2, f3) take precedence over operand
+ * size prefix (66).
+ */
+ pfx = u->pfx_str;
+ if (pfx == 0) {
+ pfx = u->pfx_opr;
+ }
+ idx = ((pfx & 0xf) + 1) / 2;
+ if (u->le->table[idx] == 0) {
+ idx = 0;
+ }
+ if (idx && u->le->table[idx] != 0) {
+ /*
+ * "Consume" the prefix as a part of the opcode, so it is no
+ * longer exported as an instruction prefix.
+ */
+ u->pfx_str = 0;
+ if (pfx == 0x66) {
+ /*
+ * consume "66" only if it was used for decoding, leaving
+ * it to be used as an operands size override for some
+ * simd instructions.
+ */
+ u->pfx_opr = 0;
+ }
+ }
+ return decode_ext(u, u->le->table[idx]);
+}
+
+
+static int
+decode_vex(struct ud *u)
+{
+ uint8_t index;
+ if (u->dis_mode != 64 && MODRM_MOD(inp_peek(u)) != 0x3) {
+ index = 0;
+ } else {
+ u->vex_op = inp_curr(u);
+ u->vex_b1 = inp_next(u);
+ if (u->vex_op == 0xc4) {
+ uint8_t pp, m;
+ /* 3-byte vex */
+ u->vex_b2 = inp_next(u);
+ UD_RETURN_ON_ERROR(u);
+ m = u->vex_b1 & 0x1f;
+ if (m == 0 || m > 3) {
+ UD_RETURN_WITH_ERROR(u, "reserved vex.m-mmmm value");
+ }
+ pp = u->vex_b2 & 0x3;
+ index = (pp << 2) | m;
+ } else {
+ /* 2-byte vex */
+ UD_ASSERT(u->vex_op == 0xc5);
+ index = 0x1 | ((u->vex_b1 & 0x3) << 2);
+ }
+ }
+ return decode_ext(u, u->le->table[index]);
+}
+
+
+/*
+ * decode_ext()
+ *
+ * Decode opcode extensions (if any)
+ */
+static int
+decode_ext(struct ud *u, uint16_t ptr)
+{
+ uint8_t idx = 0;
+ if ((ptr & 0x8000) == 0) {
+ return decode_insn(u, ptr);
+ }
+ u->le = &ud_lookup_table_list[(~0x8000 & ptr)];
+ if (u->le->type == UD_TAB__OPC_3DNOW) {
+ return decode_3dnow(u);
+ }
+
+ switch (u->le->type) {
+ case UD_TAB__OPC_MOD:
+ /* !11 = 0, 11 = 1 */
+ idx = (MODRM_MOD(modrm(u)) + 1) / 4;
+ break;
+ /* disassembly mode/operand size/address size based tables.
+ * 16 = 0,, 32 = 1, 64 = 2
+ */
+ case UD_TAB__OPC_MODE:
+ idx = u->dis_mode != 64 ? 0 : 1;
+ break;
+ case UD_TAB__OPC_OSIZE:
+ idx = eff_opr_mode(u->dis_mode, REX_W(u->pfx_rex), u->pfx_opr) / 32;
+ break;
+ case UD_TAB__OPC_ASIZE:
+ idx = eff_adr_mode(u->dis_mode, u->pfx_adr) / 32;
+ break;
+ case UD_TAB__OPC_X87:
+ idx = modrm(u) - 0xC0;
+ break;
+ case UD_TAB__OPC_VENDOR:
+ if (u->vendor == UD_VENDOR_ANY) {
+ /* choose a valid entry */
+ idx = (u->le->table[idx] != 0) ? 0 : 1;
+ } else if (u->vendor == UD_VENDOR_AMD) {
+ idx = 0;
+ } else {
+ idx = 1;
+ }
+ break;
+ case UD_TAB__OPC_RM:
+ idx = MODRM_RM(modrm(u));
+ break;
+ case UD_TAB__OPC_REG:
+ idx = MODRM_REG(modrm(u));
+ break;
+ case UD_TAB__OPC_SSE:
+ return decode_ssepfx(u);
+ case UD_TAB__OPC_VEX:
+ return decode_vex(u);
+ case UD_TAB__OPC_VEX_W:
+ idx = vex_w(u);
+ break;
+ case UD_TAB__OPC_VEX_L:
+ idx = vex_l(u);
+ break;
+ case UD_TAB__OPC_TABLE:
+ inp_next(u);
+ return decode_opcode(u);
+ default:
+ UD_ASSERT(!"not reached");
+ break;
+ }
+
+ return decode_ext(u, u->le->table[idx]);
+}
+
+
+static int
+decode_opcode(struct ud *u)
+{
+ uint16_t ptr;
+ UD_ASSERT(u->le->type == UD_TAB__OPC_TABLE);
+ UD_RETURN_ON_ERROR(u);
+ ptr = u->le->table[inp_curr(u)];
+ return decode_ext(u, ptr);
+}
+
+
+/* =============================================================================
+ * ud_decode() - Instruction decoder. Returns the number of bytes decoded.
+ * =============================================================================
+ */
+unsigned int
+ud_decode(struct ud *u)
+{
+ inp_start(u);
+ clear_insn(u);
+ u->le = &ud_lookup_table_list[0];
+ u->error = decode_prefixes(u) == -1 ||
+ decode_opcode(u) == -1 ||
+ u->error;
+ /* Handle decode error. */
+ if (u->error) {
+ /* clear out the decode data. */
+ clear_insn(u);
+ /* mark the sequence of bytes as invalid. */
+ u->itab_entry = &ud_itab[0]; /* entry 0 is invalid */
+ u->mnemonic = u->itab_entry->mnemonic;
+ }
+
+ /* maybe this stray segment override byte
+ * should be spewed out?
+ */
+ if ( !P_SEG( u->itab_entry->prefix ) &&
+ u->operand[0].type != UD_OP_MEM &&
+ u->operand[1].type != UD_OP_MEM )
+ u->pfx_seg = 0;
+
+ u->insn_offset = u->pc; /* set offset of instruction */
+ u->asm_buf_fill = 0; /* set translation buffer index to 0 */
+ u->pc += u->inp_ctr; /* move program counter by bytes decoded */
+
+ /* return number of bytes disassembled. */
+ return u->inp_ctr;
+}
+
+/*
+vim: set ts=2 sw=2 expandtab
+*/
diff --git a/ext/opcache/jit/libudis86/decode.h b/ext/opcache/jit/libudis86/decode.h
new file mode 100644
index 0000000000..3949c4e269
--- /dev/null
+++ b/ext/opcache/jit/libudis86/decode.h
@@ -0,0 +1,197 @@
+/* udis86 - libudis86/decode.h
+ *
+ * Copyright (c) 2002-2009 Vivek Thampi
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef UD_DECODE_H
+#define UD_DECODE_H
+
+#include "types.h"
+#include "udint.h"
+#include "itab.h"
+
+#define MAX_INSN_LENGTH 15
+
+/* itab prefix bits */
+#define P_none ( 0 )
+
+#define P_inv64 ( 1 << 0 )
+#define P_INV64(n) ( ( n >> 0 ) & 1 )
+#define P_def64 ( 1 << 1 )
+#define P_DEF64(n) ( ( n >> 1 ) & 1 )
+
+#define P_oso ( 1 << 2 )
+#define P_OSO(n) ( ( n >> 2 ) & 1 )
+#define P_aso ( 1 << 3 )
+#define P_ASO(n) ( ( n >> 3 ) & 1 )
+
+#define P_rexb ( 1 << 4 )
+#define P_REXB(n) ( ( n >> 4 ) & 1 )
+#define P_rexw ( 1 << 5 )
+#define P_REXW(n) ( ( n >> 5 ) & 1 )
+#define P_rexr ( 1 << 6 )
+#define P_REXR(n) ( ( n >> 6 ) & 1 )
+#define P_rexx ( 1 << 7 )
+#define P_REXX(n) ( ( n >> 7 ) & 1 )
+
+#define P_seg ( 1 << 8 )
+#define P_SEG(n) ( ( n >> 8 ) & 1 )
+
+#define P_vexl ( 1 << 9 )
+#define P_VEXL(n) ( ( n >> 9 ) & 1 )
+#define P_vexw ( 1 << 10 )
+#define P_VEXW(n) ( ( n >> 10 ) & 1 )
+
+#define P_str ( 1 << 11 )
+#define P_STR(n) ( ( n >> 11 ) & 1 )
+#define P_strz ( 1 << 12 )
+#define P_STR_ZF(n) ( ( n >> 12 ) & 1 )
+
+/* operand type constants -- order is important! */
+
+enum ud_operand_code {
+ OP_NONE,
+
+ OP_A, OP_E, OP_M, OP_G,
+ OP_I, OP_F,
+
+ OP_R0, OP_R1, OP_R2, OP_R3,
+ OP_R4, OP_R5, OP_R6, OP_R7,
+
+ OP_AL, OP_CL, OP_DL,
+ OP_AX, OP_CX, OP_DX,
+ OP_eAX, OP_eCX, OP_eDX,
+ OP_rAX, OP_rCX, OP_rDX,
+
+ OP_ES, OP_CS, OP_SS, OP_DS,
+ OP_FS, OP_GS,
+
+ OP_ST0, OP_ST1, OP_ST2, OP_ST3,
+ OP_ST4, OP_ST5, OP_ST6, OP_ST7,
+
+ OP_J, OP_S, OP_O,
+ OP_I1, OP_I3, OP_sI,
+
+ OP_V, OP_W, OP_Q, OP_P,
+ OP_U, OP_N, OP_MU, OP_H,
+ OP_L,
+
+ OP_R, OP_C, OP_D,
+
+ OP_MR
+} UD_ATTR_PACKED;
+
+
+/*
+ * Operand size constants
+ *
+ * Symbolic constants for various operand sizes. Some of these constants
+ * are given a value equal to the width of the data (SZ_B == 8), such
+ * that they maybe used interchangeably in the internals. Modifying them
+ * will most certainly break things!
+ */
+typedef uint16_t ud_operand_size_t;
+
+#define SZ_NA 0
+#define SZ_Z 1
+#define SZ_V 2
+#define SZ_Y 3
+#define SZ_X 4
+#define SZ_RDQ 7
+#define SZ_B 8
+#define SZ_W 16
+#define SZ_D 32
+#define SZ_Q 64
+#define SZ_T 80
+#define SZ_O 12
+#define SZ_DQ 128 /* double quad */
+#define SZ_QQ 256 /* quad quad */
+
+/*
+ * Complex size types; that encode sizes for operands of type MR (memory or
+ * register); for internal use only. Id space above 256.
+ */
+#define SZ_BD ((SZ_B << 8) | SZ_D)
+#define SZ_BV ((SZ_B << 8) | SZ_V)
+#define SZ_WD ((SZ_W << 8) | SZ_D)
+#define SZ_WV ((SZ_W << 8) | SZ_V)
+#define SZ_WY ((SZ_W << 8) | SZ_Y)
+#define SZ_DY ((SZ_D << 8) | SZ_Y)
+#define SZ_WO ((SZ_W << 8) | SZ_O)
+#define SZ_DO ((SZ_D << 8) | SZ_O)
+#define SZ_QO ((SZ_Q << 8) | SZ_O)
+
+
+/* resolve complex size type.
+ */
+static UD_INLINE ud_operand_size_t
+Mx_mem_size(ud_operand_size_t size)
+{
+ return (size >> 8) & 0xff;
+}
+
+static UD_INLINE ud_operand_size_t
+Mx_reg_size(ud_operand_size_t size)
+{
+ return size & 0xff;
+}
+
+/* A single operand of an entry in the instruction table.
+ * (internal use only)
+ */
+struct ud_itab_entry_operand
+{
+ enum ud_operand_code type;
+ ud_operand_size_t size;
+};
+
+
+/* A single entry in an instruction table.
+ *(internal use only)
+ */
+struct ud_itab_entry
+{
+ enum ud_mnemonic_code mnemonic;
+ struct ud_itab_entry_operand operand1;
+ struct ud_itab_entry_operand operand2;
+ struct ud_itab_entry_operand operand3;
+ struct ud_itab_entry_operand operand4;
+ uint32_t prefix;
+};
+
+struct ud_lookup_table_list_entry {
+ const uint16_t *table;
+ enum ud_table_type type;
+ const char *meta;
+};
+
+extern struct ud_itab_entry ud_itab[];
+extern struct ud_lookup_table_list_entry ud_lookup_table_list[];
+
+#endif /* UD_DECODE_H */
+
+/* vim:cindent
+ * vim:expandtab
+ * vim:ts=4
+ * vim:sw=4
+ */
diff --git a/ext/opcache/jit/libudis86/extern.h b/ext/opcache/jit/libudis86/extern.h
new file mode 100644
index 0000000000..71a01fd9b4
--- /dev/null
+++ b/ext/opcache/jit/libudis86/extern.h
@@ -0,0 +1,113 @@
+/* udis86 - libudis86/extern.h
+ *
+ * Copyright (c) 2002-2009, 2013 Vivek Thampi
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef UD_EXTERN_H
+#define UD_EXTERN_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "types.h"
+
+#if defined(_MSC_VER) && defined(_USRDLL)
+# ifdef LIBUDIS86_EXPORTS
+# define LIBUDIS86_DLLEXTERN __declspec(dllexport)
+# else
+# define LIBUDIS86_DLLEXTERN __declspec(dllimport)
+# endif
+#else
+# define LIBUDIS86_DLLEXTERN
+#endif
+
+/* ============================= PUBLIC API ================================= */
+
+extern LIBUDIS86_DLLEXTERN void ud_init(struct ud*);
+
+extern LIBUDIS86_DLLEXTERN void ud_set_mode(struct ud*, uint8_t);
+
+extern LIBUDIS86_DLLEXTERN void ud_set_pc(struct ud*, uint64_t);
+
+extern LIBUDIS86_DLLEXTERN void ud_set_input_hook(struct ud*, int (*)(struct ud*));
+
+extern LIBUDIS86_DLLEXTERN void ud_set_input_buffer(struct ud*, const uint8_t*, size_t);
+
+#ifndef __UD_STANDALONE__
+extern LIBUDIS86_DLLEXTERN void ud_set_input_file(struct ud*, FILE*);
+#endif /* __UD_STANDALONE__ */
+
+extern LIBUDIS86_DLLEXTERN void ud_set_vendor(struct ud*, unsigned);
+
+extern LIBUDIS86_DLLEXTERN void ud_set_syntax(struct ud*, void (*)(struct ud*));
+
+extern LIBUDIS86_DLLEXTERN void ud_input_skip(struct ud*, size_t);
+
+extern LIBUDIS86_DLLEXTERN int ud_input_end(const struct ud*);
+
+extern LIBUDIS86_DLLEXTERN unsigned int ud_decode(struct ud*);
+
+extern LIBUDIS86_DLLEXTERN unsigned int ud_disassemble(struct ud*);
+
+extern LIBUDIS86_DLLEXTERN void ud_translate_intel(struct ud*);
+
+extern LIBUDIS86_DLLEXTERN void ud_translate_att(struct ud*);
+
+extern LIBUDIS86_DLLEXTERN const char* ud_insn_asm(const struct ud* u);
+
+extern LIBUDIS86_DLLEXTERN const uint8_t* ud_insn_ptr(const struct ud* u);
+
+extern LIBUDIS86_DLLEXTERN uint64_t ud_insn_off(const struct ud*);
+
+extern LIBUDIS86_DLLEXTERN const char* ud_insn_hex(struct ud*);
+
+extern LIBUDIS86_DLLEXTERN unsigned int ud_insn_len(const struct ud* u);
+
+extern LIBUDIS86_DLLEXTERN const struct ud_operand* ud_insn_opr(const struct ud *u, unsigned int n);
+
+extern LIBUDIS86_DLLEXTERN int ud_opr_is_sreg(const struct ud_operand *opr);
+
+extern LIBUDIS86_DLLEXTERN int ud_opr_is_gpr(const struct ud_operand *opr);
+
+extern LIBUDIS86_DLLEXTERN enum ud_mnemonic_code ud_insn_mnemonic(const struct ud *u);
+
+extern LIBUDIS86_DLLEXTERN const char* ud_lookup_mnemonic(enum ud_mnemonic_code c);
+
+extern LIBUDIS86_DLLEXTERN void ud_set_user_opaque_data(struct ud*, void*);
+
+extern LIBUDIS86_DLLEXTERN void* ud_get_user_opaque_data(const struct ud*);
+
+extern LIBUDIS86_DLLEXTERN void ud_set_asm_buffer(struct ud *u, char *buf, size_t size);
+
+extern LIBUDIS86_DLLEXTERN void ud_set_sym_resolver(struct ud *u,
+ const char* (*resolver)(struct ud*,
+ uint64_t addr,
+ int64_t *offset));
+
+/* ========================================================================== */
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* UD_EXTERN_H */
diff --git a/ext/opcache/jit/libudis86/itab.c b/ext/opcache/jit/libudis86/itab.c
new file mode 100644
index 0000000000..953f3e5227
--- /dev/null
+++ b/ext/opcache/jit/libudis86/itab.c
@@ -0,0 +1,5946 @@
+/* itab.c -- generated by udis86:scripts/ud_itab.py, do no edit */
+#include "decode.h"
+
+#define GROUP(n) (0x8000 | (n))
+#define INVALID 0
+
+
+const uint16_t ud_itab__0[] = {
+ /* 0 */ 15, 16, 17, 18,
+ /* 4 */ 19, 20, GROUP(1), GROUP(2),
+ /* 8 */ 964, 965, 966, 967,
+ /* c */ 968, 969, GROUP(3), GROUP(4),
+ /* 10 */ 5, 6, 7, 8,
+ /* 14 */ 9, 10, GROUP(284), GROUP(285),
+ /* 18 */ 1336, 1337, 1338, 1339,
+ /* 1c */ 1340, 1341, GROUP(286), GROUP(287),
+ /* 20 */ 49, 50, 51, 52,
+ /* 24 */ 53, 54, INVALID, GROUP(288),
+ /* 28 */ 1407, 1408, 1409, 1410,
+ /* 2c */ 1411, 1412, INVALID, GROUP(289),
+ /* 30 */ 1487, 1488, 1489, 1490,
+ /* 34 */ 1491, 1492, INVALID, GROUP(290),
+ /* 38 */ 100, 101, 102, 103,
+ /* 3c */ 104, 105, INVALID, GROUP(291),
+ /* 40 */ 699, 700, 701, 702,
+ /* 44 */ 703, 704, 705, 706,
+ /* 48 */ 175, 176, 177, 178,
+ /* 4c */ 179, 180, 181, 182,
+ /* 50 */ 1246, 1247, 1248, 1249,
+ /* 54 */ 1250, 1251, 1252, 1253,
+ /* 58 */ 1101, 1102, 1103, 1104,
+ /* 5c */ 1105, 1106, 1107, 1108,
+ /* 60 */ GROUP(292), GROUP(295), GROUP(298), GROUP(299),
+ /* 64 */ INVALID, INVALID, INVALID, INVALID,
+ /* 68 */ 1254, 697, 1256, 698,
+ /* 6c */ 709, GROUP(300), 982, GROUP(301),
+ /* 70 */ 726, 728, 730, 732,
+ /* 74 */ 734, 736, 738, 740,
+ /* 78 */ 742, 744, 746, 748,
+ /* 7c */ 750, 752, 754, 756,
+ /* 80 */ GROUP(302), GROUP(303), GROUP(304), GROUP(313),
+ /* 84 */ 1433, 1434, 1475, 1476,
+ /* 88 */ 828, 829, 830, 831,
+ /* 8c */ 832, 770, 833, GROUP(314),
+ /* 90 */ 1477, 1478, 1479, 1480,
+ /* 94 */ 1481, 1482, 1483, 1484,
+ /* 98 */ GROUP(315), GROUP(316), GROUP(317), 1470,
+ /* 9c */ GROUP(318), GROUP(322), 1310, 766,
+ /* a0 */ 834, 835, 836, 837,
+ /* a4 */ 922, GROUP(326), 114, GROUP(327),
+ /* a8 */ 1435, 1436, 1402, GROUP(328),
+ /* ac */ 790, GROUP(329), 1346, GROUP(330),
+ /* b0 */ 838, 839, 840, 841,
+ /* b4 */ 842, 843, 844, 845,
+ /* b8 */ 846, 847, 848, 849,
+ /* bc */ 850, 851, 852, 853,
+ /* c0 */ GROUP(331), GROUP(332), 1301, 1302,
+ /* c4 */ GROUP(333), GROUP(403), GROUP(405), GROUP(406),
+ /* c8 */ 200, 776, 1303, 1304,
+ /* cc */ 713, 714, GROUP(407), GROUP(408),
+ /* d0 */ GROUP(409), GROUP(410), GROUP(411), GROUP(412),
+ /* d4 */ GROUP(413), GROUP(414), GROUP(415), 1486,
+ /* d8 */ GROUP(416), GROUP(419), GROUP(422), GROUP(425),
+ /* dc */ GROUP(428), GROUP(431), GROUP(434), GROUP(437),
+ /* e0 */ 794, 795, 796, GROUP(440),
+ /* e4 */ 690, 691, 978, 979,
+ /* e8 */ 72, 763, GROUP(441), 765,
+ /* ec */ 692, 693, 980, 981,
+ /* f0 */ 789, 712, 1299, 1300,
+ /* f4 */ 687, 83, GROUP(442), GROUP(443),
+ /* f8 */ 77, 1395, 81, 1398,
+ /* fc */ 78, 1396, GROUP(444), GROUP(445),
+};
+
+static const uint16_t ud_itab__1[] = {
+ /* 0 */ 1240, INVALID,
+};
+
+static const uint16_t ud_itab__2[] = {
+ /* 0 */ 1096, INVALID,
+};
+
+static const uint16_t ud_itab__3[] = {
+ /* 0 */ 1241, INVALID,
+};
+
+static const uint16_t ud_itab__4[] = {
+ /* 0 */ GROUP(5), GROUP(6), 767, 797,
+ /* 4 */ INVALID, 1426, 82, 1431,
+ /* 8 */ 716, 1471, INVALID, 1444,
+ /* c */ INVALID, GROUP(27), 430, GROUP(28),
+ /* 10 */ GROUP(29), GROUP(30), GROUP(31), GROUP(34),
+ /* 14 */ GROUP(35), GROUP(36), GROUP(37), GROUP(40),
+ /* 18 */ GROUP(41), 955, 956, 957,
+ /* 1c */ 958, 959, 960, 961,
+ /* 20 */ 854, 855, 856, 857,
+ /* 24 */ INVALID, INVALID, INVALID, INVALID,
+ /* 28 */ GROUP(42), GROUP(43), GROUP(44), GROUP(45),
+ /* 2c */ GROUP(46), GROUP(47), GROUP(48), GROUP(49),
+ /* 30 */ 1472, 1297, 1295, 1296,
+ /* 34 */ GROUP(50), GROUP(52), INVALID, 1514,
+ /* 38 */ GROUP(54), INVALID, GROUP(116), INVALID,
+ /* 3c */ INVALID, INVALID, INVALID, INVALID,
+ /* 40 */ 84, 85, 86, 87,
+ /* 44 */ 88, 89, 90, 91,
+ /* 48 */ 92, 93, 94, 95,
+ /* 4c */ 96, 97, 98, 99,
+ /* 50 */ GROUP(143), GROUP(144), GROUP(145), GROUP(146),
+ /* 54 */ GROUP(147), GROUP(148), GROUP(149), GROUP(150),
+ /* 58 */ GROUP(151), GROUP(152), GROUP(153), GROUP(154),
+ /* 5c */ GROUP(155), GROUP(156), GROUP(157), GROUP(158),
+ /* 60 */ GROUP(159), GROUP(160), GROUP(161), GROUP(162),
+ /* 64 */ GROUP(163), GROUP(164), GROUP(165), GROUP(166),
+ /* 68 */ GROUP(167), GROUP(168), GROUP(169), GROUP(170),
+ /* 6c */ GROUP(171), GROUP(172), GROUP(173), GROUP(176),
+ /* 70 */ GROUP(177), GROUP(178), GROUP(182), GROUP(186),
+ /* 74 */ GROUP(191), GROUP(192), GROUP(193), 199,
+ /* 78 */ GROUP(194), GROUP(195), INVALID, INVALID,
+ /* 7c */ GROUP(196), GROUP(197), GROUP(198), GROUP(201),
+ /* 80 */ 727, 729, 731, 733,
+ /* 84 */ 735, 737, 739, 741,
+ /* 88 */ 743, 745, 747, 749,
+ /* 8c */ 751, 753, 755, 757,
+ /* 90 */ 1350, 1351, 1352, 1353,
+ /* 94 */ 1354, 1355, 1356, 1357,
+ /* 98 */ 1358, 1359, 1360, 1361,
+ /* 9c */ 1362, 1363, 1364, 1365,
+ /* a0 */ 1245, 1100, 131, 1670,
+ /* a4 */ 1375, 1376, GROUP(202), GROUP(207),
+ /* a8 */ 1244, 1099, 1305, 1675,
+ /* ac */ 1377, 1378, GROUP(215), 694,
+ /* b0 */ 122, 123, 775, 1673,
+ /* b4 */ 772, 773, 940, 941,
+ /* b8 */ GROUP(221), INVALID, GROUP(222), 1671,
+ /* bc */ 1659, 1660, 930, 931,
+ /* c0 */ 1473, 1474, GROUP(223), 904,
+ /* c4 */ GROUP(224), GROUP(225), GROUP(226), GROUP(227),
+ /* c8 */ 1661, 1662, 1663, 1664,
+ /* cc */ 1665, 1666, 1667, 1668,
+ /* d0 */ GROUP(236), GROUP(237), GROUP(238), GROUP(239),
+ /* d4 */ GROUP(240), GROUP(241), GROUP(242), GROUP(243),
+ /* d8 */ GROUP(244), GROUP(245), GROUP(246), GROUP(247),
+ /* dc */ GROUP(248), GROUP(249), GROUP(250), GROUP(251),
+ /* e0 */ GROUP(252), GROUP(253), GROUP(254), GROUP(255),
+ /* e4 */ GROUP(256), GROUP(257), GROUP(258), GROUP(259),
+ /* e8 */ GROUP(260), GROUP(261), GROUP(262), GROUP(263),
+ /* ec */ GROUP(264), GROUP(265), GROUP(266), GROUP(267),
+ /* f0 */ GROUP(268), GROUP(269), GROUP(270), GROUP(271),
+ /* f4 */ GROUP(272), GROUP(273), GROUP(274), GROUP(275),
+ /* f8 */ GROUP(277), GROUP(278), GROUP(279), GROUP(280),
+ /* fc */ GROUP(281), GROUP(282), GROUP(283), INVALID,
+};
+
+static const uint16_t ud_itab__5[] = {
+ /* 0 */ 1384, 1406, 786, 798,
+ /* 4 */ 1453, 1454, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__6[] = {
+ /* 0 */ GROUP(7), GROUP(8),
+};
+
+static const uint16_t ud_itab__7[] = {
+ /* 0 */ 1374, 1383, 785, 774,
+ /* 4 */ 1385, INVALID, 787, 719,
+};
+
+static const uint16_t ud_itab__8[] = {
+ /* 0 */ GROUP(9), GROUP(14), GROUP(15), GROUP(16),
+ /* 4 */ 1386, INVALID, 788, GROUP(25),
+};
+
+static const uint16_t ud_itab__9[] = {
+ /* 0 */ INVALID, GROUP(10), GROUP(11), GROUP(12),
+ /* 4 */ GROUP(13), INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__10[] = {
+ /* 0 */ INVALID, 1455, INVALID,
+};
+
+static const uint16_t ud_itab__11[] = {
+ /* 0 */ INVALID, 1461, INVALID,
+};
+
+static const uint16_t ud_itab__12[] = {
+ /* 0 */ INVALID, 1462, INVALID,
+};
+
+static const uint16_t ud_itab__13[] = {
+ /* 0 */ INVALID, 1463, INVALID,
+};
+
+static const uint16_t ud_itab__14[] = {
+ /* 0 */ 824, 952, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__15[] = {
+ /* 0 */ 1485, 1508, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__16[] = {
+ /* 0 */ GROUP(17), GROUP(18), GROUP(19), GROUP(20),
+ /* 4 */ GROUP(21), GROUP(22), GROUP(23), GROUP(24),
+};
+
+static const uint16_t ud_itab__17[] = {
+ /* 0 */ 1466, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__18[] = {
+ /* 0 */ 1467, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__19[] = {
+ /* 0 */ 1468, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__20[] = {
+ /* 0 */ 1469, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__21[] = {
+ /* 0 */ 1397, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__22[] = {
+ /* 0 */ 80, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__23[] = {
+ /* 0 */ 1399, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__24[] = {
+ /* 0 */ 720, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__25[] = {
+ /* 0 */ 1425, GROUP(26), INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__26[] = {
+ /* 0 */ 1298, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__27[] = {
+ /* 0 */ 1119, 1120, 1121, 1122,
+ /* 4 */ 1123, 1124, 1125, 1126,
+};
+
+static const uint16_t ud_itab__28[] = {
+ /* 0 */ INVALID, INVALID, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+ /* 8 */ INVALID, INVALID, INVALID, INVALID,
+ /* c */ 1216, 1217, INVALID, INVALID,
+ /* 10 */ INVALID, INVALID, INVALID, INVALID,
+ /* 14 */ INVALID, INVALID, INVALID, INVALID,
+ /* 18 */ INVALID, INVALID, INVALID, INVALID,
+ /* 1c */ 1218, 1219, INVALID, INVALID,
+ /* 20 */ INVALID, INVALID, INVALID, INVALID,
+ /* 24 */ INVALID, INVALID, INVALID, INVALID,
+ /* 28 */ INVALID, INVALID, INVALID, INVALID,
+ /* 2c */ INVALID, INVALID, INVALID, INVALID,
+ /* 30 */ INVALID, INVALID, INVALID, INVALID,
+ /* 34 */ INVALID, INVALID, INVALID, INVALID,
+ /* 38 */ INVALID, INVALID, INVALID, INVALID,
+ /* 3c */ INVALID, INVALID, INVALID, INVALID,
+ /* 40 */ INVALID, INVALID, INVALID, INVALID,
+ /* 44 */ INVALID, INVALID, INVALID, INVALID,
+ /* 48 */ INVALID, INVALID, INVALID, INVALID,
+ /* 4c */ INVALID, INVALID, INVALID, INVALID,
+ /* 50 */ INVALID, INVALID, INVALID, INVALID,
+ /* 54 */ INVALID, INVALID, INVALID, INVALID,
+ /* 58 */ INVALID, INVALID, INVALID, INVALID,
+ /* 5c */ INVALID, INVALID, INVALID, INVALID,
+ /* 60 */ INVALID, INVALID, INVALID, INVALID,
+ /* 64 */ INVALID, INVALID, INVALID, INVALID,
+ /* 68 */ INVALID, INVALID, INVALID, INVALID,
+ /* 6c */ INVALID, INVALID, INVALID, INVALID,
+ /* 70 */ INVALID, INVALID, INVALID, INVALID,
+ /* 74 */ INVALID, INVALID, INVALID, INVALID,
+ /* 78 */ INVALID, INVALID, INVALID, INVALID,
+ /* 7c */ INVALID, INVALID, INVALID, INVALID,
+ /* 80 */ INVALID, INVALID, INVALID, INVALID,
+ /* 84 */ INVALID, INVALID, INVALID, INVALID,
+ /* 88 */ INVALID, INVALID, 1220, INVALID,
+ /* 8c */ INVALID, INVALID, 1221, INVALID,
+ /* 90 */ 1222, INVALID, INVALID, INVALID,
+ /* 94 */ 1223, INVALID, 1224, 1225,
+ /* 98 */ INVALID, INVALID, 1226, INVALID,
+ /* 9c */ INVALID, INVALID, 1227, INVALID,
+ /* a0 */ 1228, INVALID, INVALID, INVALID,
+ /* a4 */ 1229, INVALID, 1230, 1231,
+ /* a8 */ INVALID, INVALID, 1232, INVALID,
+ /* ac */ INVALID, INVALID, 1233, INVALID,
+ /* b0 */ 1234, INVALID, INVALID, INVALID,
+ /* b4 */ 1235, INVALID, 1236, 1237,
+ /* b8 */ INVALID, INVALID, INVALID, 1238,
+ /* bc */ INVALID, INVALID, INVALID, 1239,
+ /* c0 */ INVALID, INVALID, INVALID, INVALID,
+ /* c4 */ INVALID, INVALID, INVALID, INVALID,
+ /* c8 */ INVALID, INVALID, INVALID, INVALID,
+ /* cc */ INVALID, INVALID, INVALID, INVALID,
+ /* d0 */ INVALID, INVALID, INVALID, INVALID,
+ /* d4 */ INVALID, INVALID, INVALID, INVALID,
+ /* d8 */ INVALID, INVALID, INVALID, INVALID,
+ /* dc */ INVALID, INVALID, INVALID, INVALID,
+ /* e0 */ INVALID, INVALID, INVALID, INVALID,
+ /* e4 */ INVALID, INVALID, INVALID, INVALID,
+ /* e8 */ INVALID, INVALID, INVALID, INVALID,
+ /* ec */ INVALID, INVALID, INVALID, INVALID,
+ /* f0 */ INVALID, INVALID, INVALID, INVALID,
+ /* f4 */ INVALID, INVALID, INVALID, INVALID,
+ /* f8 */ INVALID, INVALID, INVALID, INVALID,
+ /* fc */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__29[] = {
+ /* 0 */ 936, 925, 928, 932,
+};
+
+static const uint16_t ud_itab__30[] = {
+ /* 0 */ 938, 926, 929, 934,
+};
+
+static const uint16_t ud_itab__31[] = {
+ /* 0 */ GROUP(32), GROUP(33),
+};
+
+static const uint16_t ud_itab__32[] = {
+ /* 0 */ 892, 1563, 1571, 888,
+};
+
+static const uint16_t ud_itab__33[] = {
+ /* 0 */ 896, 1561, 1569, INVALID,
+};
+
+static const uint16_t ud_itab__34[] = {
+ /* 0 */ 894, INVALID, INVALID, 890,
+};
+
+static const uint16_t ud_itab__35[] = {
+ /* 0 */ 1449, INVALID, INVALID, 1451,
+};
+
+static const uint16_t ud_itab__36[] = {
+ /* 0 */ 1447, INVALID, INVALID, 1445,
+};
+
+static const uint16_t ud_itab__37[] = {
+ /* 0 */ GROUP(38), GROUP(39),
+};
+
+static const uint16_t ud_itab__38[] = {
+ /* 0 */ 882, INVALID, 1567, 878,
+};
+
+static const uint16_t ud_itab__39[] = {
+ /* 0 */ 886, INVALID, 1565, INVALID,
+};
+
+static const uint16_t ud_itab__40[] = {
+ /* 0 */ 884, INVALID, INVALID, 880,
+};
+
+static const uint16_t ud_itab__41[] = {
+ /* 0 */ 1127, 1128, 1129, 1130,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__42[] = {
+ /* 0 */ 862, INVALID, INVALID, 858,
+};
+
+static const uint16_t ud_itab__43[] = {
+ /* 0 */ 864, INVALID, INVALID, 860,
+};
+
+static const uint16_t ud_itab__44[] = {
+ /* 0 */ 141, 152, 154, 142,
+};
+
+static const uint16_t ud_itab__45[] = {
+ /* 0 */ 907, INVALID, INVALID, 905,
+};
+
+static const uint16_t ud_itab__46[] = {
+ /* 0 */ 165, 166, 168, 162,
+};
+
+static const uint16_t ud_itab__47[] = {
+ /* 0 */ 147, 148, 158, 138,
+};
+
+static const uint16_t ud_itab__48[] = {
+ /* 0 */ 1442, INVALID, INVALID, 1440,
+};
+
+static const uint16_t ud_itab__49[] = {
+ /* 0 */ 129, INVALID, INVALID, 127,
+};
+
+static const uint16_t ud_itab__50[] = {
+ /* 0 */ 1427, GROUP(51),
+};
+
+static const uint16_t ud_itab__51[] = {
+ /* 0 */ INVALID, 1428, INVALID,
+};
+
+static const uint16_t ud_itab__52[] = {
+ /* 0 */ 1429, GROUP(53),
+};
+
+static const uint16_t ud_itab__53[] = {
+ /* 0 */ INVALID, 1430, INVALID,
+};
+
+static const uint16_t ud_itab__54[] = {
+ /* 0 */ GROUP(67), GROUP(68), GROUP(63), GROUP(64),
+ /* 4 */ GROUP(65), GROUP(66), GROUP(86), GROUP(90),
+ /* 8 */ GROUP(69), GROUP(70), GROUP(71), GROUP(72),
+ /* c */ INVALID, INVALID, INVALID, INVALID,
+ /* 10 */ GROUP(73), INVALID, INVALID, INVALID,
+ /* 14 */ GROUP(75), GROUP(76), INVALID, GROUP(77),
+ /* 18 */ INVALID, INVALID, INVALID, INVALID,
+ /* 1c */ GROUP(78), GROUP(79), GROUP(80), INVALID,
+ /* 20 */ GROUP(81), GROUP(82), GROUP(83), GROUP(84),
+ /* 24 */ GROUP(85), GROUP(108), INVALID, INVALID,
+ /* 28 */ GROUP(87), GROUP(88), GROUP(89), GROUP(74),
+ /* 2c */ INVALID, INVALID, INVALID, INVALID,
+ /* 30 */ GROUP(91), GROUP(92), GROUP(93), GROUP(94),
+ /* 34 */ GROUP(95), GROUP(96), INVALID, GROUP(97),
+ /* 38 */ GROUP(98), GROUP(99), GROUP(100), GROUP(101),
+ /* 3c */ GROUP(102), GROUP(103), GROUP(104), GROUP(105),
+ /* 40 */ GROUP(106), GROUP(107), INVALID, INVALID,
+ /* 44 */ INVALID, INVALID, INVALID, INVALID,
+ /* 48 */ INVALID, INVALID, INVALID, INVALID,
+ /* 4c */ INVALID, INVALID, INVALID, INVALID,
+ /* 50 */ INVALID, INVALID, INVALID, INVALID,
+ /* 54 */ INVALID, INVALID, INVALID, INVALID,
+ /* 58 */ INVALID, INVALID, INVALID, INVALID,
+ /* 5c */ INVALID, INVALID, INVALID, INVALID,
+ /* 60 */ INVALID, INVALID, INVALID, INVALID,
+ /* 64 */ INVALID, INVALID, INVALID, INVALID,
+ /* 68 */ INVALID, INVALID, INVALID, INVALID,
+ /* 6c */ INVALID, INVALID, INVALID, INVALID,
+ /* 70 */ INVALID, INVALID, INVALID, INVALID,
+ /* 74 */ INVALID, INVALID, INVALID, INVALID,
+ /* 78 */ INVALID, INVALID, INVALID, INVALID,
+ /* 7c */ INVALID, INVALID, INVALID, INVALID,
+ /* 80 */ GROUP(55), GROUP(59), INVALID, INVALID,
+ /* 84 */ INVALID, INVALID, INVALID, INVALID,
+ /* 88 */ INVALID, INVALID, INVALID, INVALID,
+ /* 8c */ INVALID, INVALID, INVALID, INVALID,
+ /* 90 */ INVALID, INVALID, INVALID, INVALID,
+ /* 94 */ INVALID, INVALID, INVALID, INVALID,
+ /* 98 */ INVALID, INVALID, INVALID, INVALID,
+ /* 9c */ INVALID, INVALID, INVALID, INVALID,
+ /* a0 */ INVALID, INVALID, INVALID, INVALID,
+ /* a4 */ INVALID, INVALID, INVALID, INVALID,
+ /* a8 */ INVALID, INVALID, INVALID, INVALID,
+ /* ac */ INVALID, INVALID, INVALID, INVALID,
+ /* b0 */ INVALID, INVALID, INVALID, INVALID,
+ /* b4 */ INVALID, INVALID, INVALID, INVALID,
+ /* b8 */ INVALID, INVALID, INVALID, INVALID,
+ /* bc */ INVALID, INVALID, INVALID, INVALID,
+ /* c0 */ INVALID, INVALID, INVALID, INVALID,
+ /* c4 */ INVALID, INVALID, INVALID, INVALID,
+ /* c8 */ INVALID, INVALID, INVALID, INVALID,
+ /* cc */ INVALID, INVALID, INVALID, INVALID,
+ /* d0 */ INVALID, INVALID, INVALID, INVALID,
+ /* d4 */ INVALID, INVALID, INVALID, INVALID,
+ /* d8 */ INVALID, INVALID, INVALID, GROUP(109),
+ /* dc */ GROUP(110), GROUP(111), GROUP(112), GROUP(113),
+ /* e0 */ INVALID, INVALID, INVALID, INVALID,
+ /* e4 */ INVALID, INVALID, INVALID, INVALID,
+ /* e8 */ INVALID, INVALID, INVALID, INVALID,
+ /* ec */ INVALID, INVALID, INVALID, INVALID,
+ /* f0 */ GROUP(114), GROUP(115), INVALID, INVALID,
+ /* f4 */ INVALID, INVALID, INVALID, INVALID,
+ /* f8 */ INVALID, INVALID, INVALID, INVALID,
+ /* fc */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__55[] = {
+ /* 0 */ INVALID, INVALID, INVALID, GROUP(56),
+};
+
+static const uint16_t ud_itab__56[] = {
+ /* 0 */ GROUP(57), GROUP(58),
+};
+
+static const uint16_t ud_itab__57[] = {
+ /* 0 */ INVALID, 717, INVALID,
+};
+
+static const uint16_t ud_itab__58[] = {
+ /* 0 */ INVALID, 718, INVALID,
+};
+
+static const uint16_t ud_itab__59[] = {
+ /* 0 */ INVALID, INVALID, INVALID, GROUP(60),
+};
+
+static const uint16_t ud_itab__60[] = {
+ /* 0 */ GROUP(61), GROUP(62),
+};
+
+static const uint16_t ud_itab__61[] = {
+ /* 0 */ INVALID, 721, INVALID,
+};
+
+static const uint16_t ud_itab__62[] = {
+ /* 0 */ INVALID, 722, INVALID,
+};
+
+static const uint16_t ud_itab__63[] = {
+ /* 0 */ 1588, INVALID, INVALID, 1589,
+};
+
+static const uint16_t ud_itab__64[] = {
+ /* 0 */ 1591, INVALID, INVALID, 1592,
+};
+
+static const uint16_t ud_itab__65[] = {
+ /* 0 */ 1594, INVALID, INVALID, 1595,
+};
+
+static const uint16_t ud_itab__66[] = {
+ /* 0 */ 1597, INVALID, INVALID, 1598,
+};
+
+static const uint16_t ud_itab__67[] = {
+ /* 0 */ 1582, INVALID, INVALID, 1583,
+};
+
+static const uint16_t ud_itab__68[] = {
+ /* 0 */ 1585, INVALID, INVALID, 1586,
+};
+
+static const uint16_t ud_itab__69[] = {
+ /* 0 */ 1606, INVALID, INVALID, 1607,
+};
+
+static const uint16_t ud_itab__70[] = {
+ /* 0 */ 1612, INVALID, INVALID, 1613,
+};
+
+static const uint16_t ud_itab__71[] = {
+ /* 0 */ 1609, INVALID, INVALID, 1610,
+};
+
+static const uint16_t ud_itab__72[] = {
+ /* 0 */ 1615, INVALID, INVALID, 1616,
+};
+
+static const uint16_t ud_itab__73[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1621,
+};
+
+static const uint16_t ud_itab__74[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1683,
+};
+
+static const uint16_t ud_itab__75[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1657,
+};
+
+static const uint16_t ud_itab__76[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1656,
+};
+
+static const uint16_t ud_itab__77[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1711,
+};
+
+static const uint16_t ud_itab__78[] = {
+ /* 0 */ 1573, INVALID, INVALID, 1574,
+};
+
+static const uint16_t ud_itab__79[] = {
+ /* 0 */ 1576, INVALID, INVALID, 1577,
+};
+
+static const uint16_t ud_itab__80[] = {
+ /* 0 */ 1579, INVALID, INVALID, 1580,
+};
+
+static const uint16_t ud_itab__81[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1685,
+};
+
+static const uint16_t ud_itab__82[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1687,
+};
+
+static const uint16_t ud_itab__83[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1689,
+};
+
+static const uint16_t ud_itab__84[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1691,
+};
+
+static const uint16_t ud_itab__85[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1693,
+};
+
+static const uint16_t ud_itab__86[] = {
+ /* 0 */ 1600, INVALID, INVALID, 1601,
+};
+
+static const uint16_t ud_itab__87[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1622,
+};
+
+static const uint16_t ud_itab__88[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1708,
+};
+
+static const uint16_t ud_itab__89[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1681,
+};
+
+static const uint16_t ud_itab__90[] = {
+ /* 0 */ 1603, INVALID, INVALID, 1604,
+};
+
+static const uint16_t ud_itab__91[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1696,
+};
+
+static const uint16_t ud_itab__92[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1698,
+};
+
+static const uint16_t ud_itab__93[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1700,
+};
+
+static const uint16_t ud_itab__94[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1702,
+};
+
+static const uint16_t ud_itab__95[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1704,
+};
+
+static const uint16_t ud_itab__96[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1706,
+};
+
+static const uint16_t ud_itab__97[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1717,
+};
+
+static const uint16_t ud_itab__98[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1624,
+};
+
+static const uint16_t ud_itab__99[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1626,
+};
+
+static const uint16_t ud_itab__100[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1628,
+};
+
+static const uint16_t ud_itab__101[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1630,
+};
+
+static const uint16_t ud_itab__102[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1632,
+};
+
+static const uint16_t ud_itab__103[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1634,
+};
+
+static const uint16_t ud_itab__104[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1638,
+};
+
+static const uint16_t ud_itab__105[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1636,
+};
+
+static const uint16_t ud_itab__106[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1640,
+};
+
+static const uint16_t ud_itab__107[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1642,
+};
+
+static const uint16_t ud_itab__108[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1695,
+};
+
+static const uint16_t ud_itab__109[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 45,
+};
+
+static const uint16_t ud_itab__110[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 41,
+};
+
+static const uint16_t ud_itab__111[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 43,
+};
+
+static const uint16_t ud_itab__112[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 37,
+};
+
+static const uint16_t ud_itab__113[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 39,
+};
+
+static const uint16_t ud_itab__114[] = {
+ /* 0 */ 1723, 1725, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__115[] = {
+ /* 0 */ 1724, 1726, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__116[] = {
+ /* 0 */ INVALID, INVALID, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+ /* 8 */ GROUP(117), GROUP(118), GROUP(119), GROUP(120),
+ /* c */ GROUP(121), GROUP(122), GROUP(123), GROUP(124),
+ /* 10 */ INVALID, INVALID, INVALID, INVALID,
+ /* 14 */ GROUP(125), GROUP(126), GROUP(127), GROUP(129),
+ /* 18 */ INVALID, INVALID, INVALID, INVALID,
+ /* 1c */ INVALID, INVALID, INVALID, INVALID,
+ /* 20 */ GROUP(130), GROUP(131), GROUP(132), INVALID,
+ /* 24 */ INVALID, INVALID, INVALID, INVALID,
+ /* 28 */ INVALID, INVALID, INVALID, INVALID,
+ /* 2c */ INVALID, INVALID, INVALID, INVALID,
+ /* 30 */ INVALID, INVALID, INVALID, INVALID,
+ /* 34 */ INVALID, INVALID, INVALID, INVALID,
+ /* 38 */ INVALID, INVALID, INVALID, INVALID,
+ /* 3c */ INVALID, INVALID, INVALID, INVALID,
+ /* 40 */ GROUP(134), GROUP(135), GROUP(136), INVALID,
+ /* 44 */ GROUP(137), INVALID, INVALID, INVALID,
+ /* 48 */ INVALID, INVALID, INVALID, INVALID,
+ /* 4c */ INVALID, INVALID, INVALID, INVALID,
+ /* 50 */ INVALID, INVALID, INVALID, INVALID,
+ /* 54 */ INVALID, INVALID, INVALID, INVALID,
+ /* 58 */ INVALID, INVALID, INVALID, INVALID,
+ /* 5c */ INVALID, INVALID, INVALID, INVALID,
+ /* 60 */ GROUP(139), GROUP(140), GROUP(141), GROUP(142),
+ /* 64 */ INVALID, INVALID, INVALID, INVALID,
+ /* 68 */ INVALID, INVALID, INVALID, INVALID,
+ /* 6c */ INVALID, INVALID, INVALID, INVALID,
+ /* 70 */ INVALID, INVALID, INVALID, INVALID,
+ /* 74 */ INVALID, INVALID, INVALID, INVALID,
+ /* 78 */ INVALID, INVALID, INVALID, INVALID,
+ /* 7c */ INVALID, INVALID, INVALID, INVALID,
+ /* 80 */ INVALID, INVALID, INVALID, INVALID,
+ /* 84 */ INVALID, INVALID, INVALID, INVALID,
+ /* 88 */ INVALID, INVALID, INVALID, INVALID,
+ /* 8c */ INVALID, INVALID, INVALID, INVALID,
+ /* 90 */ INVALID, INVALID, INVALID, INVALID,
+ /* 94 */ INVALID, INVALID, INVALID, INVALID,
+ /* 98 */ INVALID, INVALID, INVALID, INVALID,
+ /* 9c */ INVALID, INVALID, INVALID, INVALID,
+ /* a0 */ INVALID, INVALID, INVALID, INVALID,
+ /* a4 */ INVALID, INVALID, INVALID, INVALID,
+ /* a8 */ INVALID, INVALID, INVALID, INVALID,
+ /* ac */ INVALID, INVALID, INVALID, INVALID,
+ /* b0 */ INVALID, INVALID, INVALID, INVALID,
+ /* b4 */ INVALID, INVALID, INVALID, INVALID,
+ /* b8 */ INVALID, INVALID, INVALID, INVALID,
+ /* bc */ INVALID, INVALID, INVALID, INVALID,
+ /* c0 */ INVALID, INVALID, INVALID, INVALID,
+ /* c4 */ INVALID, INVALID, INVALID, INVALID,
+ /* c8 */ INVALID, INVALID, INVALID, INVALID,
+ /* cc */ INVALID, INVALID, INVALID, INVALID,
+ /* d0 */ INVALID, INVALID, INVALID, INVALID,
+ /* d4 */ INVALID, INVALID, INVALID, INVALID,
+ /* d8 */ INVALID, INVALID, INVALID, INVALID,
+ /* dc */ INVALID, INVALID, INVALID, GROUP(138),
+ /* e0 */ INVALID, INVALID, INVALID, INVALID,
+ /* e4 */ INVALID, INVALID, INVALID, INVALID,
+ /* e8 */ INVALID, INVALID, INVALID, INVALID,
+ /* ec */ INVALID, INVALID, INVALID, INVALID,
+ /* f0 */ INVALID, INVALID, INVALID, INVALID,
+ /* f4 */ INVALID, INVALID, INVALID, INVALID,
+ /* f8 */ INVALID, INVALID, INVALID, INVALID,
+ /* fc */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__117[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1644,
+};
+
+static const uint16_t ud_itab__118[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1646,
+};
+
+static const uint16_t ud_itab__119[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1648,
+};
+
+static const uint16_t ud_itab__120[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1650,
+};
+
+static const uint16_t ud_itab__121[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1654,
+};
+
+static const uint16_t ud_itab__122[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1652,
+};
+
+static const uint16_t ud_itab__123[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1677,
+};
+
+static const uint16_t ud_itab__124[] = {
+ /* 0 */ 1618, INVALID, INVALID, 1619,
+};
+
+static const uint16_t ud_itab__125[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1045,
+};
+
+static const uint16_t ud_itab__126[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1056,
+};
+
+static const uint16_t ud_itab__127[] = {
+ /* 0 */ INVALID, INVALID, INVALID, GROUP(128),
+};
+
+static const uint16_t ud_itab__128[] = {
+ /* 0 */ 1047, 1049, 1051,
+};
+
+static const uint16_t ud_itab__129[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 201,
+};
+
+static const uint16_t ud_itab__130[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1058,
+};
+
+static const uint16_t ud_itab__131[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1557,
+};
+
+static const uint16_t ud_itab__132[] = {
+ /* 0 */ INVALID, INVALID, INVALID, GROUP(133),
+};
+
+static const uint16_t ud_itab__133[] = {
+ /* 0 */ 1062, 1063, 1064,
+};
+
+static const uint16_t ud_itab__134[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 197,
+};
+
+static const uint16_t ud_itab__135[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 195,
+};
+
+static const uint16_t ud_itab__136[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1679,
+};
+
+static const uint16_t ud_itab__137[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1512,
+};
+
+static const uint16_t ud_itab__138[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 47,
+};
+
+static const uint16_t ud_itab__139[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1715,
+};
+
+static const uint16_t ud_itab__140[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1713,
+};
+
+static const uint16_t ud_itab__141[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1721,
+};
+
+static const uint16_t ud_itab__142[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1719,
+};
+
+static const uint16_t ud_itab__143[] = {
+ /* 0 */ 900, INVALID, INVALID, 898,
+};
+
+static const uint16_t ud_itab__144[] = {
+ /* 0 */ 1387, 1391, 1393, 1389,
+};
+
+static const uint16_t ud_itab__145[] = {
+ /* 0 */ 1306, INVALID, 1308, INVALID,
+};
+
+static const uint16_t ud_itab__146[] = {
+ /* 0 */ 1291, INVALID, 1293, INVALID,
+};
+
+static const uint16_t ud_itab__147[] = {
+ /* 0 */ 61, INVALID, INVALID, 59,
+};
+
+static const uint16_t ud_itab__148[] = {
+ /* 0 */ 65, INVALID, INVALID, 63,
+};
+
+static const uint16_t ud_itab__149[] = {
+ /* 0 */ 976, INVALID, INVALID, 974,
+};
+
+static const uint16_t ud_itab__150[] = {
+ /* 0 */ 1499, INVALID, INVALID, 1497,
+};
+
+static const uint16_t ud_itab__151[] = {
+ /* 0 */ 27, 29, 31, 25,
+};
+
+static const uint16_t ud_itab__152[] = {
+ /* 0 */ 946, 948, 950, 944,
+};
+
+static const uint16_t ud_itab__153[] = {
+ /* 0 */ 145, 150, 156, 139,
+};
+
+static const uint16_t ud_itab__154[] = {
+ /* 0 */ 134, INVALID, 163, 143,
+};
+
+static const uint16_t ud_itab__155[] = {
+ /* 0 */ 1419, 1421, 1423, 1417,
+};
+
+static const uint16_t ud_itab__156[] = {
+ /* 0 */ 818, 820, 822, 816,
+};
+
+static const uint16_t ud_itab__157[] = {
+ /* 0 */ 189, 191, 193, 187,
+};
+
+static const uint16_t ud_itab__158[] = {
+ /* 0 */ 802, 804, 806, 800,
+};
+
+static const uint16_t ud_itab__159[] = {
+ /* 0 */ 1209, INVALID, INVALID, 1207,
+};
+
+static const uint16_t ud_itab__160[] = {
+ /* 0 */ 1212, INVALID, INVALID, 1210,
+};
+
+static const uint16_t ud_itab__161[] = {
+ /* 0 */ 1215, INVALID, INVALID, 1213,
+};
+
+static const uint16_t ud_itab__162[] = {
+ /* 0 */ 987, INVALID, INVALID, 985,
+};
+
+static const uint16_t ud_itab__163[] = {
+ /* 0 */ 1038, INVALID, INVALID, 1036,
+};
+
+static const uint16_t ud_itab__164[] = {
+ /* 0 */ 1041, INVALID, INVALID, 1039,
+};
+
+static const uint16_t ud_itab__165[] = {
+ /* 0 */ 1044, INVALID, INVALID, 1042,
+};
+
+static const uint16_t ud_itab__166[] = {
+ /* 0 */ 993, INVALID, INVALID, 991,
+};
+
+static const uint16_t ud_itab__167[] = {
+ /* 0 */ 1200, INVALID, INVALID, 1198,
+};
+
+static const uint16_t ud_itab__168[] = {
+ /* 0 */ 1203, INVALID, INVALID, 1201,
+};
+
+static const uint16_t ud_itab__169[] = {
+ /* 0 */ 1206, INVALID, INVALID, 1204,
+};
+
+static const uint16_t ud_itab__170[] = {
+ /* 0 */ 990, INVALID, INVALID, 988,
+};
+
+static const uint16_t ud_itab__171[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1547,
+};
+
+static const uint16_t ud_itab__172[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1545,
+};
+
+static const uint16_t ud_itab__173[] = {
+ /* 0 */ GROUP(174), INVALID, INVALID, GROUP(175),
+};
+
+static const uint16_t ud_itab__174[] = {
+ /* 0 */ 866, 867, 910,
+};
+
+static const uint16_t ud_itab__175[] = {
+ /* 0 */ 868, 870, 911,
+};
+
+static const uint16_t ud_itab__176[] = {
+ /* 0 */ 920, INVALID, 1522, 1517,
+};
+
+static const uint16_t ud_itab__177[] = {
+ /* 0 */ 1134, 1537, 1535, 1539,
+};
+
+static const uint16_t ud_itab__178[] = {
+ /* 0 */ INVALID, INVALID, GROUP(179), INVALID,
+ /* 4 */ GROUP(180), INVALID, GROUP(181), INVALID,
+};
+
+static const uint16_t ud_itab__179[] = {
+ /* 0 */ 1159, INVALID, INVALID, 1163,
+};
+
+static const uint16_t ud_itab__180[] = {
+ /* 0 */ 1152, INVALID, INVALID, 1150,
+};
+
+static const uint16_t ud_itab__181[] = {
+ /* 0 */ 1138, INVALID, INVALID, 1137,
+};
+
+static const uint16_t ud_itab__182[] = {
+ /* 0 */ INVALID, INVALID, GROUP(183), INVALID,
+ /* 4 */ GROUP(184), INVALID, GROUP(185), INVALID,
+};
+
+static const uint16_t ud_itab__183[] = {
+ /* 0 */ 1165, INVALID, INVALID, 1169,
+};
+
+static const uint16_t ud_itab__184[] = {
+ /* 0 */ 1153, INVALID, INVALID, 1157,
+};
+
+static const uint16_t ud_itab__185[] = {
+ /* 0 */ 1142, INVALID, INVALID, 1141,
+};
+
+static const uint16_t ud_itab__186[] = {
+ /* 0 */ INVALID, INVALID, GROUP(187), GROUP(188),
+ /* 4 */ INVALID, INVALID, GROUP(189), GROUP(190),
+};
+
+static const uint16_t ud_itab__187[] = {
+ /* 0 */ 1171, INVALID, INVALID, 1175,
+};
+
+static const uint16_t ud_itab__188[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1543,
+};
+
+static const uint16_t ud_itab__189[] = {
+ /* 0 */ 1146, INVALID, INVALID, 1145,
+};
+
+static const uint16_t ud_itab__190[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1541,
+};
+
+static const uint16_t ud_itab__191[] = {
+ /* 0 */ 1027, INVALID, INVALID, 1028,
+};
+
+static const uint16_t ud_itab__192[] = {
+ /* 0 */ 1030, INVALID, INVALID, 1031,
+};
+
+static const uint16_t ud_itab__193[] = {
+ /* 0 */ 1033, INVALID, INVALID, 1034,
+};
+
+static const uint16_t ud_itab__194[] = {
+ /* 0 */ INVALID, 1464, INVALID,
+};
+
+static const uint16_t ud_itab__195[] = {
+ /* 0 */ INVALID, 1465, INVALID,
+};
+
+static const uint16_t ud_itab__196[] = {
+ /* 0 */ INVALID, 1551, INVALID, 1549,
+};
+
+static const uint16_t ud_itab__197[] = {
+ /* 0 */ INVALID, 1555, INVALID, 1553,
+};
+
+static const uint16_t ud_itab__198[] = {
+ /* 0 */ GROUP(199), INVALID, 916, GROUP(200),
+};
+
+static const uint16_t ud_itab__199[] = {
+ /* 0 */ 872, 873, 913,
+};
+
+static const uint16_t ud_itab__200[] = {
+ /* 0 */ 874, 876, 914,
+};
+
+static const uint16_t ud_itab__201[] = {
+ /* 0 */ 921, INVALID, 1524, 1515,
+};
+
+static const uint16_t ud_itab__202[] = {
+ /* 0 */ INVALID, GROUP(203),
+};
+
+static const uint16_t ud_itab__203[] = {
+ /* 0 */ GROUP(204), GROUP(205), GROUP(206), INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__204[] = {
+ /* 0 */ 825, INVALID, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__205[] = {
+ /* 0 */ 1509, INVALID, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__206[] = {
+ /* 0 */ 1510, INVALID, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__207[] = {
+ /* 0 */ INVALID, GROUP(208),
+};
+
+static const uint16_t ud_itab__208[] = {
+ /* 0 */ GROUP(209), GROUP(210), GROUP(211), GROUP(212),
+ /* 4 */ GROUP(213), GROUP(214), INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__209[] = {
+ /* 0 */ 1511, INVALID, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__210[] = {
+ /* 0 */ 1501, INVALID, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__211[] = {
+ /* 0 */ 1502, INVALID, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__212[] = {
+ /* 0 */ 1503, INVALID, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__213[] = {
+ /* 0 */ 1504, INVALID, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__214[] = {
+ /* 0 */ 1505, INVALID, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__215[] = {
+ /* 0 */ GROUP(216), GROUP(217),
+};
+
+static const uint16_t ud_itab__216[] = {
+ /* 0 */ 683, 682, 768, 1400,
+ /* 4 */ 1507, 1506, INVALID, 79,
+};
+
+static const uint16_t ud_itab__217[] = {
+ /* 0 */ INVALID, INVALID, INVALID, INVALID,
+ /* 4 */ INVALID, GROUP(218), GROUP(219), GROUP(220),
+};
+
+static const uint16_t ud_itab__218[] = {
+ /* 0 */ 777, 778, 779, 780,
+ /* 4 */ 781, 782, 783, 784,
+};
+
+static const uint16_t ud_itab__219[] = {
+ /* 0 */ 808, 809, 810, 811,
+ /* 4 */ 812, 813, 814, 815,
+};
+
+static const uint16_t ud_itab__220[] = {
+ /* 0 */ 1366, 1367, 1368, 1369,
+ /* 4 */ 1370, 1371, 1372, 1373,
+};
+
+static const uint16_t ud_itab__221[] = {
+ /* 0 */ INVALID, INVALID, 1710, INVALID,
+};
+
+static const uint16_t ud_itab__222[] = {
+ /* 0 */ INVALID, INVALID, INVALID, INVALID,
+ /* 4 */ 1669, 1676, 1674, 1672,
+};
+
+static const uint16_t ud_itab__223[] = {
+ /* 0 */ 112, 117, 120, 110,
+};
+
+static const uint16_t ud_itab__224[] = {
+ /* 0 */ 1059, INVALID, INVALID, 1060,
+};
+
+static const uint16_t ud_itab__225[] = {
+ /* 0 */ 1055, INVALID, INVALID, 1053,
+};
+
+static const uint16_t ud_itab__226[] = {
+ /* 0 */ 1381, INVALID, INVALID, 1379,
+};
+
+static const uint16_t ud_itab__227[] = {
+ /* 0 */ GROUP(228), GROUP(235),
+};
+
+static const uint16_t ud_itab__228[] = {
+ /* 0 */ INVALID, GROUP(229), INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, GROUP(230), GROUP(234),
+};
+
+static const uint16_t ud_itab__229[] = {
+ /* 0 */ 124, 125, 126,
+};
+
+static const uint16_t ud_itab__230[] = {
+ /* 0 */ GROUP(231), INVALID, GROUP(232), GROUP(233),
+};
+
+static const uint16_t ud_itab__231[] = {
+ /* 0 */ INVALID, 1459, INVALID,
+};
+
+static const uint16_t ud_itab__232[] = {
+ /* 0 */ INVALID, 1458, INVALID,
+};
+
+static const uint16_t ud_itab__233[] = {
+ /* 0 */ INVALID, 1457, INVALID,
+};
+
+static const uint16_t ud_itab__234[] = {
+ /* 0 */ INVALID, 1460, INVALID,
+};
+
+static const uint16_t ud_itab__235[] = {
+ /* 0 */ INVALID, INVALID, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, 1456, INVALID,
+};
+
+static const uint16_t ud_itab__236[] = {
+ /* 0 */ INVALID, 35, INVALID, 33,
+};
+
+static const uint16_t ud_itab__237[] = {
+ /* 0 */ 1160, INVALID, INVALID, 1161,
+};
+
+static const uint16_t ud_itab__238[] = {
+ /* 0 */ 1166, INVALID, INVALID, 1167,
+};
+
+static const uint16_t ud_itab__239[] = {
+ /* 0 */ 1172, INVALID, INVALID, 1173,
+};
+
+static const uint16_t ud_itab__240[] = {
+ /* 0 */ 1527, INVALID, INVALID, 1528,
+};
+
+static const uint16_t ud_itab__241[] = {
+ /* 0 */ 1093, INVALID, INVALID, 1094,
+};
+
+static const uint16_t ud_itab__242[] = {
+ /* 0 */ INVALID, 1521, 1526, 918,
+};
+
+static const uint16_t ud_itab__243[] = {
+ /* 0 */ 1086, INVALID, INVALID, 1084,
+};
+
+static const uint16_t ud_itab__244[] = {
+ /* 0 */ 1192, INVALID, INVALID, 1193,
+};
+
+static const uint16_t ud_itab__245[] = {
+ /* 0 */ 1195, INVALID, INVALID, 1196,
+};
+
+static const uint16_t ud_itab__246[] = {
+ /* 0 */ 1083, INVALID, INVALID, 1081,
+};
+
+static const uint16_t ud_itab__247[] = {
+ /* 0 */ 1017, INVALID, INVALID, 1015,
+};
+
+static const uint16_t ud_itab__248[] = {
+ /* 0 */ 1009, INVALID, INVALID, 1010,
+};
+
+static const uint16_t ud_itab__249[] = {
+ /* 0 */ 1012, INVALID, INVALID, 1013,
+};
+
+static const uint16_t ud_itab__250[] = {
+ /* 0 */ 1075, INVALID, INVALID, 1076,
+};
+
+static const uint16_t ud_itab__251[] = {
+ /* 0 */ 1020, INVALID, INVALID, 1018,
+};
+
+static const uint16_t ud_itab__252[] = {
+ /* 0 */ 1023, INVALID, INVALID, 1021,
+};
+
+static const uint16_t ud_itab__253[] = {
+ /* 0 */ 1147, INVALID, INVALID, 1148,
+};
+
+static const uint16_t ud_itab__254[] = {
+ /* 0 */ 1156, INVALID, INVALID, 1154,
+};
+
+static const uint16_t ud_itab__255[] = {
+ /* 0 */ 1026, INVALID, INVALID, 1024,
+};
+
+static const uint16_t ud_itab__256[] = {
+ /* 0 */ 1087, INVALID, INVALID, 1088,
+};
+
+static const uint16_t ud_itab__257[] = {
+ /* 0 */ 1092, INVALID, INVALID, 1090,
+};
+
+static const uint16_t ud_itab__258[] = {
+ /* 0 */ INVALID, 136, 132, 160,
+};
+
+static const uint16_t ud_itab__259[] = {
+ /* 0 */ 909, INVALID, INVALID, 902,
+};
+
+static const uint16_t ud_itab__260[] = {
+ /* 0 */ 1186, INVALID, INVALID, 1187,
+};
+
+static const uint16_t ud_itab__261[] = {
+ /* 0 */ 1189, INVALID, INVALID, 1190,
+};
+
+static const uint16_t ud_itab__262[] = {
+ /* 0 */ 1080, INVALID, INVALID, 1078,
+};
+
+static const uint16_t ud_itab__263[] = {
+ /* 0 */ 1118, INVALID, INVALID, 1116,
+};
+
+static const uint16_t ud_itab__264[] = {
+ /* 0 */ 1003, INVALID, INVALID, 1004,
+};
+
+static const uint16_t ud_itab__265[] = {
+ /* 0 */ 1006, INVALID, INVALID, 1007,
+};
+
+static const uint16_t ud_itab__266[] = {
+ /* 0 */ 1074, INVALID, INVALID, 1072,
+};
+
+static const uint16_t ud_itab__267[] = {
+ /* 0 */ 1266, INVALID, INVALID, 1264,
+};
+
+static const uint16_t ud_itab__268[] = {
+ /* 0 */ INVALID, 1559, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__269[] = {
+ /* 0 */ 1136, INVALID, INVALID, 1135,
+};
+
+static const uint16_t ud_itab__270[] = {
+ /* 0 */ 1140, INVALID, INVALID, 1139,
+};
+
+static const uint16_t ud_itab__271[] = {
+ /* 0 */ 1144, INVALID, INVALID, 1143,
+};
+
+static const uint16_t ud_itab__272[] = {
+ /* 0 */ 1533, INVALID, INVALID, 1534,
+};
+
+static const uint16_t ud_itab__273[] = {
+ /* 0 */ 1069, INVALID, INVALID, 1070,
+};
+
+static const uint16_t ud_itab__274[] = {
+ /* 0 */ 1133, INVALID, INVALID, 1131,
+};
+
+static const uint16_t ud_itab__275[] = {
+ /* 0 */ INVALID, GROUP(276),
+};
+
+static const uint16_t ud_itab__276[] = {
+ /* 0 */ 799, INVALID, INVALID, 1519,
+};
+
+static const uint16_t ud_itab__277[] = {
+ /* 0 */ 1179, INVALID, INVALID, 1177,
+};
+
+static const uint16_t ud_itab__278[] = {
+ /* 0 */ 1182, INVALID, INVALID, 1180,
+};
+
+static const uint16_t ud_itab__279[] = {
+ /* 0 */ 1183, INVALID, INVALID, 1184,
+};
+
+static const uint16_t ud_itab__280[] = {
+ /* 0 */ 1532, INVALID, INVALID, 1530,
+};
+
+static const uint16_t ud_itab__281[] = {
+ /* 0 */ 996, INVALID, INVALID, 994,
+};
+
+static const uint16_t ud_itab__282[] = {
+ /* 0 */ 997, INVALID, INVALID, 998,
+};
+
+static const uint16_t ud_itab__283[] = {
+ /* 0 */ 1000, INVALID, INVALID, 1001,
+};
+
+static const uint16_t ud_itab__284[] = {
+ /* 0 */ 1242, INVALID,
+};
+
+static const uint16_t ud_itab__285[] = {
+ /* 0 */ 1097, INVALID,
+};
+
+static const uint16_t ud_itab__286[] = {
+ /* 0 */ 1243, INVALID,
+};
+
+static const uint16_t ud_itab__287[] = {
+ /* 0 */ 1098, INVALID,
+};
+
+static const uint16_t ud_itab__288[] = {
+ /* 0 */ 173, INVALID,
+};
+
+static const uint16_t ud_itab__289[] = {
+ /* 0 */ 174, INVALID,
+};
+
+static const uint16_t ud_itab__290[] = {
+ /* 0 */ 1, INVALID,
+};
+
+static const uint16_t ud_itab__291[] = {
+ /* 0 */ 4, INVALID,
+};
+
+static const uint16_t ud_itab__292[] = {
+ /* 0 */ GROUP(293), GROUP(294), INVALID,
+};
+
+static const uint16_t ud_itab__293[] = {
+ /* 0 */ 1257, INVALID,
+};
+
+static const uint16_t ud_itab__294[] = {
+ /* 0 */ 1258, INVALID,
+};
+
+static const uint16_t ud_itab__295[] = {
+ /* 0 */ GROUP(296), GROUP(297), INVALID,
+};
+
+static const uint16_t ud_itab__296[] = {
+ /* 0 */ 1110, INVALID,
+};
+
+static const uint16_t ud_itab__297[] = {
+ /* 0 */ 1111, INVALID,
+};
+
+static const uint16_t ud_itab__298[] = {
+ /* 0 */ 1658, INVALID,
+};
+
+static const uint16_t ud_itab__299[] = {
+ /* 0 */ 67, 68,
+};
+
+static const uint16_t ud_itab__300[] = {
+ /* 0 */ 710, 711, INVALID,
+};
+
+static const uint16_t ud_itab__301[] = {
+ /* 0 */ 983, 984, INVALID,
+};
+
+static const uint16_t ud_itab__302[] = {
+ /* 0 */ 21, 970, 11, 1342,
+ /* 4 */ 55, 1413, 1493, 106,
+};
+
+static const uint16_t ud_itab__303[] = {
+ /* 0 */ 23, 971, 13, 1343,
+ /* 4 */ 57, 1414, 1494, 108,
+};
+
+static const uint16_t ud_itab__304[] = {
+ /* 0 */ GROUP(305), GROUP(306), GROUP(307), GROUP(308),
+ /* 4 */ GROUP(309), GROUP(310), GROUP(311), GROUP(312),
+};
+
+static const uint16_t ud_itab__305[] = {
+ /* 0 */ 22, INVALID,
+};
+
+static const uint16_t ud_itab__306[] = {
+ /* 0 */ 972, INVALID,
+};
+
+static const uint16_t ud_itab__307[] = {
+ /* 0 */ 12, INVALID,
+};
+
+static const uint16_t ud_itab__308[] = {
+ /* 0 */ 1344, INVALID,
+};
+
+static const uint16_t ud_itab__309[] = {
+ /* 0 */ 56, INVALID,
+};
+
+static const uint16_t ud_itab__310[] = {
+ /* 0 */ 1415, INVALID,
+};
+
+static const uint16_t ud_itab__311[] = {
+ /* 0 */ 1495, INVALID,
+};
+
+static const uint16_t ud_itab__312[] = {
+ /* 0 */ 107, INVALID,
+};
+
+static const uint16_t ud_itab__313[] = {
+ /* 0 */ 24, 973, 14, 1345,
+ /* 4 */ 58, 1416, 1496, 109,
+};
+
+static const uint16_t ud_itab__314[] = {
+ /* 0 */ 1109, INVALID, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__315[] = {
+ /* 0 */ 74, 75, 76,
+};
+
+static const uint16_t ud_itab__316[] = {
+ /* 0 */ 170, 171, 172,
+};
+
+static const uint16_t ud_itab__317[] = {
+ /* 0 */ 73, INVALID,
+};
+
+static const uint16_t ud_itab__318[] = {
+ /* 0 */ GROUP(319), GROUP(320), GROUP(321),
+};
+
+static const uint16_t ud_itab__319[] = {
+ /* 0 */ 1259, 1260,
+};
+
+static const uint16_t ud_itab__320[] = {
+ /* 0 */ 1261, 1262,
+};
+
+static const uint16_t ud_itab__321[] = {
+ /* 0 */ INVALID, 1263,
+};
+
+static const uint16_t ud_itab__322[] = {
+ /* 0 */ GROUP(323), GROUP(324), GROUP(325),
+};
+
+static const uint16_t ud_itab__323[] = {
+ /* 0 */ 1112, INVALID,
+};
+
+static const uint16_t ud_itab__324[] = {
+ /* 0 */ 1113, 1114,
+};
+
+static const uint16_t ud_itab__325[] = {
+ /* 0 */ INVALID, 1115,
+};
+
+static const uint16_t ud_itab__326[] = {
+ /* 0 */ 923, 924, 927,
+};
+
+static const uint16_t ud_itab__327[] = {
+ /* 0 */ 115, 116, 119,
+};
+
+static const uint16_t ud_itab__328[] = {
+ /* 0 */ 1403, 1404, 1405,
+};
+
+static const uint16_t ud_itab__329[] = {
+ /* 0 */ 791, 792, 793,
+};
+
+static const uint16_t ud_itab__330[] = {
+ /* 0 */ 1347, 1348, 1349,
+};
+
+static const uint16_t ud_itab__331[] = {
+ /* 0 */ 1279, 1286, 1267, 1275,
+ /* 4 */ 1327, 1334, 1318, 1313,
+};
+
+static const uint16_t ud_itab__332[] = {
+ /* 0 */ 1284, 1287, 1268, 1274,
+ /* 4 */ 1323, 1330, 1319, 1315,
+};
+
+static const uint16_t ud_itab__333[] = {
+ /* 0 */ GROUP(334), GROUP(335), INVALID, INVALID,
+ /* 4 */ INVALID, GROUP(341), GROUP(357), GROUP(369),
+ /* 8 */ INVALID, GROUP(394), INVALID, INVALID,
+ /* c */ INVALID, GROUP(399), INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__334[] = {
+ /* 0 */ 771, INVALID,
+};
+
+static const uint16_t ud_itab__335[] = {
+ /* 0 */ INVALID, INVALID, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+ /* 8 */ INVALID, INVALID, INVALID, INVALID,
+ /* c */ INVALID, INVALID, INVALID, INVALID,
+ /* 10 */ 937, 939, GROUP(336), 895,
+ /* 14 */ 1450, 1448, GROUP(337), 885,
+ /* 18 */ INVALID, INVALID, INVALID, INVALID,
+ /* 1c */ INVALID, INVALID, INVALID, INVALID,
+ /* 20 */ INVALID, INVALID, INVALID, INVALID,
+ /* 24 */ INVALID, INVALID, INVALID, INVALID,
+ /* 28 */ 863, 865, INVALID, 908,
+ /* 2c */ INVALID, INVALID, 1443, 130,
+ /* 30 */ INVALID, INVALID, INVALID, INVALID,
+ /* 34 */ INVALID, INVALID, INVALID, INVALID,
+ /* 38 */ INVALID, INVALID, INVALID, INVALID,
+ /* 3c */ INVALID, INVALID, INVALID, INVALID,
+ /* 40 */ INVALID, INVALID, INVALID, INVALID,
+ /* 44 */ INVALID, INVALID, INVALID, INVALID,
+ /* 48 */ INVALID, INVALID, INVALID, INVALID,
+ /* 4c */ INVALID, INVALID, INVALID, INVALID,
+ /* 50 */ 901, 1388, 1307, 1292,
+ /* 54 */ 62, 66, 977, 1500,
+ /* 58 */ 28, 947, 146, 135,
+ /* 5c */ 1420, 819, 190, 803,
+ /* 60 */ INVALID, INVALID, INVALID, INVALID,
+ /* 64 */ INVALID, INVALID, INVALID, INVALID,
+ /* 68 */ INVALID, INVALID, INVALID, INVALID,
+ /* 6c */ INVALID, INVALID, INVALID, INVALID,
+ /* 70 */ INVALID, INVALID, INVALID, INVALID,
+ /* 74 */ INVALID, INVALID, INVALID, GROUP(340),
+ /* 78 */ INVALID, INVALID, INVALID, INVALID,
+ /* 7c */ INVALID, INVALID, INVALID, INVALID,
+ /* 80 */ INVALID, INVALID, INVALID, INVALID,
+ /* 84 */ INVALID, INVALID, INVALID, INVALID,
+ /* 88 */ INVALID, INVALID, INVALID, INVALID,
+ /* 8c */ INVALID, INVALID, INVALID, INVALID,
+ /* 90 */ INVALID, INVALID, INVALID, INVALID,
+ /* 94 */ INVALID, INVALID, INVALID, INVALID,
+ /* 98 */ INVALID, INVALID, INVALID, INVALID,
+ /* 9c */ INVALID, INVALID, INVALID, INVALID,
+ /* a0 */ INVALID, INVALID, INVALID, INVALID,
+ /* a4 */ INVALID, INVALID, INVALID, INVALID,
+ /* a8 */ INVALID, INVALID, INVALID, INVALID,
+ /* ac */ INVALID, INVALID, GROUP(338), INVALID,
+ /* b0 */ INVALID, INVALID, INVALID, INVALID,
+ /* b4 */ INVALID, INVALID, INVALID, INVALID,
+ /* b8 */ INVALID, INVALID, INVALID, INVALID,
+ /* bc */ INVALID, INVALID, INVALID, INVALID,
+ /* c0 */ INVALID, INVALID, 113, INVALID,
+ /* c4 */ INVALID, INVALID, 1382, INVALID,
+ /* c8 */ INVALID, INVALID, INVALID, INVALID,
+ /* cc */ INVALID, INVALID, INVALID, INVALID,
+ /* d0 */ INVALID, INVALID, INVALID, INVALID,
+ /* d4 */ INVALID, INVALID, INVALID, INVALID,
+ /* d8 */ INVALID, INVALID, INVALID, INVALID,
+ /* dc */ INVALID, INVALID, INVALID, INVALID,
+ /* e0 */ INVALID, INVALID, INVALID, INVALID,
+ /* e4 */ INVALID, INVALID, INVALID, INVALID,
+ /* e8 */ INVALID, INVALID, INVALID, INVALID,
+ /* ec */ INVALID, INVALID, INVALID, INVALID,
+ /* f0 */ INVALID, INVALID, INVALID, INVALID,
+ /* f4 */ INVALID, INVALID, INVALID, INVALID,
+ /* f8 */ INVALID, INVALID, INVALID, INVALID,
+ /* fc */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__336[] = {
+ /* 0 */ 893, 897,
+};
+
+static const uint16_t ud_itab__337[] = {
+ /* 0 */ 883, 887,
+};
+
+static const uint16_t ud_itab__338[] = {
+ /* 0 */ GROUP(339), INVALID,
+};
+
+static const uint16_t ud_itab__339[] = {
+ /* 0 */ INVALID, INVALID, INVALID, 1401,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__340[] = {
+ /* 0 */ 1742, 1743,
+};
+
+static const uint16_t ud_itab__341[] = {
+ /* 0 */ INVALID, INVALID, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+ /* 8 */ INVALID, INVALID, INVALID, INVALID,
+ /* c */ INVALID, INVALID, INVALID, INVALID,
+ /* 10 */ 933, 935, GROUP(342), 891,
+ /* 14 */ 1452, 1446, GROUP(343), 881,
+ /* 18 */ INVALID, INVALID, INVALID, INVALID,
+ /* 1c */ INVALID, INVALID, INVALID, INVALID,
+ /* 20 */ INVALID, INVALID, INVALID, INVALID,
+ /* 24 */ INVALID, INVALID, INVALID, INVALID,
+ /* 28 */ 859, 861, INVALID, 906,
+ /* 2c */ INVALID, INVALID, 1441, 128,
+ /* 30 */ INVALID, INVALID, INVALID, INVALID,
+ /* 34 */ INVALID, INVALID, INVALID, INVALID,
+ /* 38 */ INVALID, INVALID, INVALID, INVALID,
+ /* 3c */ INVALID, INVALID, INVALID, INVALID,
+ /* 40 */ INVALID, INVALID, INVALID, INVALID,
+ /* 44 */ INVALID, INVALID, INVALID, INVALID,
+ /* 48 */ INVALID, INVALID, INVALID, INVALID,
+ /* 4c */ INVALID, INVALID, INVALID, INVALID,
+ /* 50 */ 899, 1390, INVALID, INVALID,
+ /* 54 */ 60, 64, 975, 1498,
+ /* 58 */ 26, 945, 140, 144,
+ /* 5c */ 1418, 817, 188, 801,
+ /* 60 */ 1208, 1211, 1214, 986,
+ /* 64 */ 1037, 1040, 1043, 992,
+ /* 68 */ 1199, 1202, 1205, 989,
+ /* 6c */ 1548, 1546, GROUP(344), 1518,
+ /* 70 */ 1540, GROUP(345), GROUP(347), GROUP(349),
+ /* 74 */ 1029, 1032, 1035, INVALID,
+ /* 78 */ INVALID, INVALID, INVALID, INVALID,
+ /* 7c */ 1550, 1554, GROUP(351), 1516,
+ /* 80 */ INVALID, INVALID, INVALID, INVALID,
+ /* 84 */ INVALID, INVALID, INVALID, INVALID,
+ /* 88 */ INVALID, INVALID, INVALID, INVALID,
+ /* 8c */ INVALID, INVALID, INVALID, INVALID,
+ /* 90 */ INVALID, INVALID, INVALID, INVALID,
+ /* 94 */ INVALID, INVALID, INVALID, INVALID,
+ /* 98 */ INVALID, INVALID, INVALID, INVALID,
+ /* 9c */ INVALID, INVALID, INVALID, INVALID,
+ /* a0 */ INVALID, INVALID, INVALID, INVALID,
+ /* a4 */ INVALID, INVALID, INVALID, INVALID,
+ /* a8 */ INVALID, INVALID, INVALID, INVALID,
+ /* ac */ INVALID, INVALID, INVALID, INVALID,
+ /* b0 */ INVALID, INVALID, INVALID, INVALID,
+ /* b4 */ INVALID, INVALID, INVALID, INVALID,
+ /* b8 */ INVALID, INVALID, INVALID, INVALID,
+ /* bc */ INVALID, INVALID, INVALID, INVALID,
+ /* c0 */ INVALID, INVALID, 111, INVALID,
+ /* c4 */ 1061, 1054, 1380, INVALID,
+ /* c8 */ INVALID, INVALID, INVALID, INVALID,
+ /* cc */ INVALID, INVALID, INVALID, INVALID,
+ /* d0 */ 34, 1162, 1168, 1174,
+ /* d4 */ 1529, 1095, 919, GROUP(352),
+ /* d8 */ 1194, 1197, 1082, 1016,
+ /* dc */ 1011, 1014, 1077, 1019,
+ /* e0 */ 1022, 1149, 1155, 1025,
+ /* e4 */ 1089, 1091, 161, 903,
+ /* e8 */ 1188, 1191, 1079, 1117,
+ /* ec */ 1005, 1008, 1073, 1265,
+ /* f0 */ INVALID, GROUP(353), GROUP(354), GROUP(355),
+ /* f4 */ INVALID, 1071, 1132, GROUP(356),
+ /* f8 */ 1178, 1181, 1185, 1531,
+ /* fc */ 995, 999, 1002, INVALID,
+};
+
+static const uint16_t ud_itab__342[] = {
+ /* 0 */ 889, INVALID,
+};
+
+static const uint16_t ud_itab__343[] = {
+ /* 0 */ 879, INVALID,
+};
+
+static const uint16_t ud_itab__344[] = {
+ /* 0 */ 869, 871, 912,
+};
+
+static const uint16_t ud_itab__345[] = {
+ /* 0 */ INVALID, INVALID, 1164, INVALID,
+ /* 4 */ 1151, INVALID, GROUP(346), INVALID,
+};
+
+static const uint16_t ud_itab__346[] = {
+ /* 0 */ 1756, INVALID,
+};
+
+static const uint16_t ud_itab__347[] = {
+ /* 0 */ INVALID, INVALID, 1170, INVALID,
+ /* 4 */ 1158, INVALID, GROUP(348), INVALID,
+};
+
+static const uint16_t ud_itab__348[] = {
+ /* 0 */ 1758, INVALID,
+};
+
+static const uint16_t ud_itab__349[] = {
+ /* 0 */ INVALID, INVALID, 1176, 1544,
+ /* 4 */ INVALID, INVALID, GROUP(350), 1542,
+};
+
+static const uint16_t ud_itab__350[] = {
+ /* 0 */ 1760, INVALID,
+};
+
+static const uint16_t ud_itab__351[] = {
+ /* 0 */ 875, 877, 915,
+};
+
+static const uint16_t ud_itab__352[] = {
+ /* 0 */ 1085, INVALID,
+};
+
+static const uint16_t ud_itab__353[] = {
+ /* 0 */ 1755, INVALID,
+};
+
+static const uint16_t ud_itab__354[] = {
+ /* 0 */ 1757, INVALID,
+};
+
+static const uint16_t ud_itab__355[] = {
+ /* 0 */ 1759, INVALID,
+};
+
+static const uint16_t ud_itab__356[] = {
+ /* 0 */ INVALID, 1520,
+};
+
+static const uint16_t ud_itab__357[] = {
+ /* 0 */ 1584, 1587, 1590, 1593,
+ /* 4 */ 1596, 1599, 1602, 1605,
+ /* 8 */ 1608, 1614, 1611, 1617,
+ /* c */ GROUP(358), GROUP(359), GROUP(360), GROUP(361),
+ /* 10 */ INVALID, INVALID, INVALID, INVALID,
+ /* 14 */ INVALID, INVALID, INVALID, 1712,
+ /* 18 */ GROUP(362), GROUP(363), INVALID, INVALID,
+ /* 1c */ 1575, 1578, 1581, INVALID,
+ /* 20 */ 1686, 1688, 1690, 1692,
+ /* 24 */ 1694, INVALID, INVALID, INVALID,
+ /* 28 */ 1623, 1709, 1682, 1684,
+ /* 2c */ GROUP(365), GROUP(366), GROUP(367), GROUP(368),
+ /* 30 */ 1697, 1699, 1701, 1703,
+ /* 34 */ 1705, 1707, INVALID, 1718,
+ /* 38 */ 1625, 1627, 1629, 1631,
+ /* 3c */ 1633, 1635, 1639, 1637,
+ /* 40 */ 1641, 1643, INVALID, INVALID,
+ /* 44 */ INVALID, INVALID, INVALID, INVALID,
+ /* 48 */ INVALID, INVALID, INVALID, INVALID,
+ /* 4c */ INVALID, INVALID, INVALID, INVALID,
+ /* 50 */ INVALID, INVALID, INVALID, INVALID,
+ /* 54 */ INVALID, INVALID, INVALID, INVALID,
+ /* 58 */ INVALID, INVALID, INVALID, INVALID,
+ /* 5c */ INVALID, INVALID, INVALID, INVALID,
+ /* 60 */ INVALID, INVALID, INVALID, INVALID,
+ /* 64 */ INVALID, INVALID, INVALID, INVALID,
+ /* 68 */ INVALID, INVALID, INVALID, INVALID,
+ /* 6c */ INVALID, INVALID, INVALID, INVALID,
+ /* 70 */ INVALID, INVALID, INVALID, INVALID,
+ /* 74 */ INVALID, INVALID, INVALID, INVALID,
+ /* 78 */ INVALID, INVALID, INVALID, INVALID,
+ /* 7c */ INVALID, INVALID, INVALID, INVALID,
+ /* 80 */ INVALID, INVALID, INVALID, INVALID,
+ /* 84 */ INVALID, INVALID, INVALID, INVALID,
+ /* 88 */ INVALID, INVALID, INVALID, INVALID,
+ /* 8c */ INVALID, INVALID, INVALID, INVALID,
+ /* 90 */ INVALID, INVALID, INVALID, INVALID,
+ /* 94 */ INVALID, INVALID, INVALID, INVALID,
+ /* 98 */ INVALID, INVALID, INVALID, INVALID,
+ /* 9c */ INVALID, INVALID, INVALID, INVALID,
+ /* a0 */ INVALID, INVALID, INVALID, INVALID,
+ /* a4 */ INVALID, INVALID, INVALID, INVALID,
+ /* a8 */ INVALID, INVALID, INVALID, INVALID,
+ /* ac */ INVALID, INVALID, INVALID, INVALID,
+ /* b0 */ INVALID, INVALID, INVALID, INVALID,
+ /* b4 */ INVALID, INVALID, INVALID, INVALID,
+ /* b8 */ INVALID, INVALID, INVALID, INVALID,
+ /* bc */ INVALID, INVALID, INVALID, INVALID,
+ /* c0 */ INVALID, INVALID, INVALID, INVALID,
+ /* c4 */ INVALID, INVALID, INVALID, INVALID,
+ /* c8 */ INVALID, INVALID, INVALID, INVALID,
+ /* cc */ INVALID, INVALID, INVALID, INVALID,
+ /* d0 */ INVALID, INVALID, INVALID, INVALID,
+ /* d4 */ INVALID, INVALID, INVALID, INVALID,
+ /* d8 */ INVALID, INVALID, INVALID, 46,
+ /* dc */ 42, 44, 38, 40,
+ /* e0 */ INVALID, INVALID, INVALID, INVALID,
+ /* e4 */ INVALID, INVALID, INVALID, INVALID,
+ /* e8 */ INVALID, INVALID, INVALID, INVALID,
+ /* ec */ INVALID, INVALID, INVALID, INVALID,
+ /* f0 */ INVALID, INVALID, INVALID, INVALID,
+ /* f4 */ INVALID, INVALID, INVALID, INVALID,
+ /* f8 */ INVALID, INVALID, INVALID, INVALID,
+ /* fc */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__358[] = {
+ /* 0 */ 1737, INVALID,
+};
+
+static const uint16_t ud_itab__359[] = {
+ /* 0 */ 1735, INVALID,
+};
+
+static const uint16_t ud_itab__360[] = {
+ /* 0 */ 1740, INVALID,
+};
+
+static const uint16_t ud_itab__361[] = {
+ /* 0 */ 1741, INVALID,
+};
+
+static const uint16_t ud_itab__362[] = {
+ /* 0 */ 1727, INVALID,
+};
+
+static const uint16_t ud_itab__363[] = {
+ /* 0 */ GROUP(364), INVALID,
+};
+
+static const uint16_t ud_itab__364[] = {
+ /* 0 */ INVALID, 1728,
+};
+
+static const uint16_t ud_itab__365[] = {
+ /* 0 */ 1731, INVALID,
+};
+
+static const uint16_t ud_itab__366[] = {
+ /* 0 */ 1733, INVALID,
+};
+
+static const uint16_t ud_itab__367[] = {
+ /* 0 */ 1732, INVALID,
+};
+
+static const uint16_t ud_itab__368[] = {
+ /* 0 */ 1734, INVALID,
+};
+
+static const uint16_t ud_itab__369[] = {
+ /* 0 */ INVALID, INVALID, INVALID, INVALID,
+ /* 4 */ GROUP(370), GROUP(371), GROUP(372), INVALID,
+ /* 8 */ 1645, 1647, 1649, 1651,
+ /* c */ 1655, 1653, 1678, 1620,
+ /* 10 */ INVALID, INVALID, INVALID, INVALID,
+ /* 14 */ GROUP(374), 1057, GROUP(375), 202,
+ /* 18 */ GROUP(379), GROUP(381), INVALID, INVALID,
+ /* 1c */ INVALID, INVALID, INVALID, INVALID,
+ /* 20 */ GROUP(383), 1558, GROUP(385), INVALID,
+ /* 24 */ INVALID, INVALID, INVALID, INVALID,
+ /* 28 */ INVALID, INVALID, INVALID, INVALID,
+ /* 2c */ INVALID, INVALID, INVALID, INVALID,
+ /* 30 */ INVALID, INVALID, INVALID, INVALID,
+ /* 34 */ INVALID, INVALID, INVALID, INVALID,
+ /* 38 */ INVALID, INVALID, INVALID, INVALID,
+ /* 3c */ INVALID, INVALID, INVALID, INVALID,
+ /* 40 */ 198, 196, 1680, INVALID,
+ /* 44 */ 1513, INVALID, INVALID, INVALID,
+ /* 48 */ INVALID, INVALID, GROUP(391), GROUP(392),
+ /* 4c */ GROUP(393), INVALID, INVALID, INVALID,
+ /* 50 */ INVALID, INVALID, INVALID, INVALID,
+ /* 54 */ INVALID, INVALID, INVALID, INVALID,
+ /* 58 */ INVALID, INVALID, INVALID, INVALID,
+ /* 5c */ INVALID, INVALID, INVALID, INVALID,
+ /* 60 */ 1716, 1714, 1722, 1720,
+ /* 64 */ INVALID, INVALID, INVALID, INVALID,
+ /* 68 */ INVALID, INVALID, INVALID, INVALID,
+ /* 6c */ INVALID, INVALID, INVALID, INVALID,
+ /* 70 */ INVALID, INVALID, INVALID, INVALID,
+ /* 74 */ INVALID, INVALID, INVALID, INVALID,
+ /* 78 */ INVALID, INVALID, INVALID, INVALID,
+ /* 7c */ INVALID, INVALID, INVALID, INVALID,
+ /* 80 */ INVALID, INVALID, INVALID, INVALID,
+ /* 84 */ INVALID, INVALID, INVALID, INVALID,
+ /* 88 */ INVALID, INVALID, INVALID, INVALID,
+ /* 8c */ INVALID, INVALID, INVALID, INVALID,
+ /* 90 */ INVALID, INVALID, INVALID, INVALID,
+ /* 94 */ INVALID, INVALID, INVALID, INVALID,
+ /* 98 */ INVALID, INVALID, INVALID, INVALID,
+ /* 9c */ INVALID, INVALID, INVALID, INVALID,
+ /* a0 */ INVALID, INVALID, INVALID, INVALID,
+ /* a4 */ INVALID, INVALID, INVALID, INVALID,
+ /* a8 */ INVALID, INVALID, INVALID, INVALID,
+ /* ac */ INVALID, INVALID, INVALID, INVALID,
+ /* b0 */ INVALID, INVALID, INVALID, INVALID,
+ /* b4 */ INVALID, INVALID, INVALID, INVALID,
+ /* b8 */ INVALID, INVALID, INVALID, INVALID,
+ /* bc */ INVALID, INVALID, INVALID, INVALID,
+ /* c0 */ INVALID, INVALID, INVALID, INVALID,
+ /* c4 */ INVALID, INVALID, INVALID, INVALID,
+ /* c8 */ INVALID, INVALID, INVALID, INVALID,
+ /* cc */ INVALID, INVALID, INVALID, INVALID,
+ /* d0 */ INVALID, INVALID, INVALID, INVALID,
+ /* d4 */ INVALID, INVALID, INVALID, INVALID,
+ /* d8 */ INVALID, INVALID, INVALID, INVALID,
+ /* dc */ INVALID, INVALID, INVALID, 48,
+ /* e0 */ INVALID, INVALID, INVALID, INVALID,
+ /* e4 */ INVALID, INVALID, INVALID, INVALID,
+ /* e8 */ INVALID, INVALID, INVALID, INVALID,
+ /* ec */ INVALID, INVALID, INVALID, INVALID,
+ /* f0 */ INVALID, INVALID, INVALID, INVALID,
+ /* f4 */ INVALID, INVALID, INVALID, INVALID,
+ /* f8 */ INVALID, INVALID, INVALID, INVALID,
+ /* fc */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__370[] = {
+ /* 0 */ 1738, INVALID,
+};
+
+static const uint16_t ud_itab__371[] = {
+ /* 0 */ 1736, INVALID,
+};
+
+static const uint16_t ud_itab__372[] = {
+ /* 0 */ GROUP(373), INVALID,
+};
+
+static const uint16_t ud_itab__373[] = {
+ /* 0 */ INVALID, 1739,
+};
+
+static const uint16_t ud_itab__374[] = {
+ /* 0 */ 1046, INVALID,
+};
+
+static const uint16_t ud_itab__375[] = {
+ /* 0 */ GROUP(376), GROUP(377), GROUP(378),
+};
+
+static const uint16_t ud_itab__376[] = {
+ /* 0 */ 1048, INVALID,
+};
+
+static const uint16_t ud_itab__377[] = {
+ /* 0 */ 1050, INVALID,
+};
+
+static const uint16_t ud_itab__378[] = {
+ /* 0 */ INVALID, 1052,
+};
+
+static const uint16_t ud_itab__379[] = {
+ /* 0 */ GROUP(380), INVALID,
+};
+
+static const uint16_t ud_itab__380[] = {
+ /* 0 */ INVALID, 1730,
+};
+
+static const uint16_t ud_itab__381[] = {
+ /* 0 */ GROUP(382), INVALID,
+};
+
+static const uint16_t ud_itab__382[] = {
+ /* 0 */ INVALID, 1729,
+};
+
+static const uint16_t ud_itab__383[] = {
+ /* 0 */ GROUP(384), INVALID,
+};
+
+static const uint16_t ud_itab__384[] = {
+ /* 0 */ 1065, INVALID,
+};
+
+static const uint16_t ud_itab__385[] = {
+ /* 0 */ GROUP(386), GROUP(388),
+};
+
+static const uint16_t ud_itab__386[] = {
+ /* 0 */ GROUP(387), INVALID,
+};
+
+static const uint16_t ud_itab__387[] = {
+ /* 0 */ 1066, INVALID,
+};
+
+static const uint16_t ud_itab__388[] = {
+ /* 0 */ GROUP(389), GROUP(390),
+};
+
+static const uint16_t ud_itab__389[] = {
+ /* 0 */ 1067, INVALID,
+};
+
+static const uint16_t ud_itab__390[] = {
+ /* 0 */ 1068, INVALID,
+};
+
+static const uint16_t ud_itab__391[] = {
+ /* 0 */ 1745, INVALID,
+};
+
+static const uint16_t ud_itab__392[] = {
+ /* 0 */ 1744, INVALID,
+};
+
+static const uint16_t ud_itab__393[] = {
+ /* 0 */ 1754, INVALID,
+};
+
+static const uint16_t ud_itab__394[] = {
+ /* 0 */ INVALID, INVALID, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+ /* 8 */ INVALID, INVALID, INVALID, INVALID,
+ /* c */ INVALID, INVALID, INVALID, INVALID,
+ /* 10 */ GROUP(395), GROUP(396), GROUP(397), INVALID,
+ /* 14 */ INVALID, INVALID, GROUP(398), INVALID,
+ /* 18 */ INVALID, INVALID, INVALID, INVALID,
+ /* 1c */ INVALID, INVALID, INVALID, INVALID,
+ /* 20 */ INVALID, INVALID, INVALID, INVALID,
+ /* 24 */ INVALID, INVALID, INVALID, INVALID,
+ /* 28 */ INVALID, INVALID, 155, INVALID,
+ /* 2c */ 169, 159, INVALID, INVALID,
+ /* 30 */ INVALID, INVALID, INVALID, INVALID,
+ /* 34 */ INVALID, INVALID, INVALID, INVALID,
+ /* 38 */ INVALID, INVALID, INVALID, INVALID,
+ /* 3c */ INVALID, INVALID, INVALID, INVALID,
+ /* 40 */ INVALID, INVALID, INVALID, INVALID,
+ /* 44 */ INVALID, INVALID, INVALID, INVALID,
+ /* 48 */ INVALID, INVALID, INVALID, INVALID,
+ /* 4c */ INVALID, INVALID, INVALID, INVALID,
+ /* 50 */ INVALID, 1394, 1309, 1294,
+ /* 54 */ INVALID, INVALID, INVALID, INVALID,
+ /* 58 */ 32, 951, 157, 164,
+ /* 5c */ 1424, 823, 194, 807,
+ /* 60 */ INVALID, INVALID, INVALID, INVALID,
+ /* 64 */ INVALID, INVALID, INVALID, INVALID,
+ /* 68 */ INVALID, INVALID, INVALID, INVALID,
+ /* 6c */ INVALID, INVALID, INVALID, 1523,
+ /* 70 */ 1536, INVALID, INVALID, INVALID,
+ /* 74 */ INVALID, INVALID, INVALID, INVALID,
+ /* 78 */ INVALID, INVALID, INVALID, INVALID,
+ /* 7c */ INVALID, INVALID, 917, 1525,
+ /* 80 */ INVALID, INVALID, INVALID, INVALID,
+ /* 84 */ INVALID, INVALID, INVALID, INVALID,
+ /* 88 */ INVALID, INVALID, INVALID, INVALID,
+ /* 8c */ INVALID, INVALID, INVALID, INVALID,
+ /* 90 */ INVALID, INVALID, INVALID, INVALID,
+ /* 94 */ INVALID, INVALID, INVALID, INVALID,
+ /* 98 */ INVALID, INVALID, INVALID, INVALID,
+ /* 9c */ INVALID, INVALID, INVALID, INVALID,
+ /* a0 */ INVALID, INVALID, INVALID, INVALID,
+ /* a4 */ INVALID, INVALID, INVALID, INVALID,
+ /* a8 */ INVALID, INVALID, INVALID, INVALID,
+ /* ac */ INVALID, INVALID, INVALID, INVALID,
+ /* b0 */ INVALID, INVALID, INVALID, INVALID,
+ /* b4 */ INVALID, INVALID, INVALID, INVALID,
+ /* b8 */ INVALID, INVALID, INVALID, INVALID,
+ /* bc */ INVALID, INVALID, INVALID, INVALID,
+ /* c0 */ INVALID, INVALID, 121, INVALID,
+ /* c4 */ INVALID, INVALID, INVALID, INVALID,
+ /* c8 */ INVALID, INVALID, INVALID, INVALID,
+ /* cc */ INVALID, INVALID, INVALID, INVALID,
+ /* d0 */ INVALID, INVALID, INVALID, INVALID,
+ /* d4 */ INVALID, INVALID, INVALID, INVALID,
+ /* d8 */ INVALID, INVALID, INVALID, INVALID,
+ /* dc */ INVALID, INVALID, INVALID, INVALID,
+ /* e0 */ INVALID, INVALID, INVALID, INVALID,
+ /* e4 */ INVALID, INVALID, 133, INVALID,
+ /* e8 */ INVALID, INVALID, INVALID, INVALID,
+ /* ec */ INVALID, INVALID, INVALID, INVALID,
+ /* f0 */ INVALID, INVALID, INVALID, INVALID,
+ /* f4 */ INVALID, INVALID, INVALID, INVALID,
+ /* f8 */ INVALID, INVALID, INVALID, INVALID,
+ /* fc */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__395[] = {
+ /* 0 */ 1751, 1750,
+};
+
+static const uint16_t ud_itab__396[] = {
+ /* 0 */ 1753, 1752,
+};
+
+static const uint16_t ud_itab__397[] = {
+ /* 0 */ 1572, 1570,
+};
+
+static const uint16_t ud_itab__398[] = {
+ /* 0 */ 1568, 1566,
+};
+
+static const uint16_t ud_itab__399[] = {
+ /* 0 */ INVALID, INVALID, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+ /* 8 */ INVALID, INVALID, INVALID, INVALID,
+ /* c */ INVALID, INVALID, INVALID, INVALID,
+ /* 10 */ GROUP(402), GROUP(400), GROUP(401), INVALID,
+ /* 14 */ INVALID, INVALID, INVALID, INVALID,
+ /* 18 */ INVALID, INVALID, INVALID, INVALID,
+ /* 1c */ INVALID, INVALID, INVALID, INVALID,
+ /* 20 */ INVALID, INVALID, INVALID, INVALID,
+ /* 24 */ INVALID, INVALID, INVALID, INVALID,
+ /* 28 */ INVALID, INVALID, 153, INVALID,
+ /* 2c */ 167, 149, INVALID, INVALID,
+ /* 30 */ INVALID, INVALID, INVALID, INVALID,
+ /* 34 */ INVALID, INVALID, INVALID, INVALID,
+ /* 38 */ INVALID, INVALID, INVALID, INVALID,
+ /* 3c */ INVALID, INVALID, INVALID, INVALID,
+ /* 40 */ INVALID, INVALID, INVALID, INVALID,
+ /* 44 */ INVALID, INVALID, INVALID, INVALID,
+ /* 48 */ INVALID, INVALID, INVALID, INVALID,
+ /* 4c */ INVALID, INVALID, INVALID, INVALID,
+ /* 50 */ INVALID, 1392, INVALID, INVALID,
+ /* 54 */ INVALID, INVALID, INVALID, INVALID,
+ /* 58 */ 30, 949, 151, INVALID,
+ /* 5c */ 1422, 821, 192, 805,
+ /* 60 */ INVALID, INVALID, INVALID, INVALID,
+ /* 64 */ INVALID, INVALID, INVALID, INVALID,
+ /* 68 */ INVALID, INVALID, INVALID, INVALID,
+ /* 6c */ INVALID, INVALID, INVALID, INVALID,
+ /* 70 */ 1538, INVALID, INVALID, INVALID,
+ /* 74 */ INVALID, INVALID, INVALID, INVALID,
+ /* 78 */ INVALID, INVALID, INVALID, INVALID,
+ /* 7c */ 1552, 1556, INVALID, INVALID,
+ /* 80 */ INVALID, INVALID, INVALID, INVALID,
+ /* 84 */ INVALID, INVALID, INVALID, INVALID,
+ /* 88 */ INVALID, INVALID, INVALID, INVALID,
+ /* 8c */ INVALID, INVALID, INVALID, INVALID,
+ /* 90 */ INVALID, INVALID, INVALID, INVALID,
+ /* 94 */ INVALID, INVALID, INVALID, INVALID,
+ /* 98 */ INVALID, INVALID, INVALID, INVALID,
+ /* 9c */ INVALID, INVALID, INVALID, INVALID,
+ /* a0 */ INVALID, INVALID, INVALID, INVALID,
+ /* a4 */ INVALID, INVALID, INVALID, INVALID,
+ /* a8 */ INVALID, INVALID, INVALID, INVALID,
+ /* ac */ INVALID, INVALID, INVALID, INVALID,
+ /* b0 */ INVALID, INVALID, INVALID, INVALID,
+ /* b4 */ INVALID, INVALID, INVALID, INVALID,
+ /* b8 */ INVALID, INVALID, INVALID, INVALID,
+ /* bc */ INVALID, INVALID, INVALID, INVALID,
+ /* c0 */ INVALID, INVALID, 118, INVALID,
+ /* c4 */ INVALID, INVALID, INVALID, INVALID,
+ /* c8 */ INVALID, INVALID, INVALID, INVALID,
+ /* cc */ INVALID, INVALID, INVALID, INVALID,
+ /* d0 */ 36, INVALID, INVALID, INVALID,
+ /* d4 */ INVALID, INVALID, INVALID, INVALID,
+ /* d8 */ INVALID, INVALID, INVALID, INVALID,
+ /* dc */ INVALID, INVALID, INVALID, INVALID,
+ /* e0 */ INVALID, INVALID, INVALID, INVALID,
+ /* e4 */ INVALID, INVALID, 137, INVALID,
+ /* e8 */ INVALID, INVALID, INVALID, INVALID,
+ /* ec */ INVALID, INVALID, INVALID, INVALID,
+ /* f0 */ 1560, INVALID, INVALID, INVALID,
+ /* f4 */ INVALID, INVALID, INVALID, INVALID,
+ /* f8 */ INVALID, INVALID, INVALID, INVALID,
+ /* fc */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__400[] = {
+ /* 0 */ 1749, 1748,
+};
+
+static const uint16_t ud_itab__401[] = {
+ /* 0 */ 1564, 1562,
+};
+
+static const uint16_t ud_itab__402[] = {
+ /* 0 */ 1747, 1746,
+};
+
+static const uint16_t ud_itab__403[] = {
+ /* 0 */ GROUP(404), GROUP(335), INVALID, INVALID,
+ /* 4 */ INVALID, GROUP(341), GROUP(357), GROUP(369),
+ /* 8 */ INVALID, GROUP(394), INVALID, INVALID,
+ /* c */ INVALID, GROUP(399), INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__404[] = {
+ /* 0 */ 769, INVALID,
+};
+
+static const uint16_t ud_itab__405[] = {
+ /* 0 */ 826, INVALID, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__406[] = {
+ /* 0 */ 827, INVALID, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__407[] = {
+ /* 0 */ 715, INVALID,
+};
+
+static const uint16_t ud_itab__408[] = {
+ /* 0 */ 723, 724, 725,
+};
+
+static const uint16_t ud_itab__409[] = {
+ /* 0 */ 1280, 1285, 1269, 1273,
+ /* 4 */ 1326, 1333, 1320, 1314,
+};
+
+static const uint16_t ud_itab__410[] = {
+ /* 0 */ 1281, 1288, 1272, 1276,
+ /* 4 */ 1325, 1332, 1329, 1312,
+};
+
+static const uint16_t ud_itab__411[] = {
+ /* 0 */ 1282, 1289, 1270, 1277,
+ /* 4 */ 1324, 1331, 1321, 1316,
+};
+
+static const uint16_t ud_itab__412[] = {
+ /* 0 */ 1283, 1290, 1271, 1278,
+ /* 4 */ 1328, 1335, 1322, 1317,
+};
+
+static const uint16_t ud_itab__413[] = {
+ /* 0 */ 3, INVALID,
+};
+
+static const uint16_t ud_itab__414[] = {
+ /* 0 */ 2, INVALID,
+};
+
+static const uint16_t ud_itab__415[] = {
+ /* 0 */ 1311, INVALID,
+};
+
+static const uint16_t ud_itab__416[] = {
+ /* 0 */ GROUP(417), GROUP(418),
+};
+
+static const uint16_t ud_itab__417[] = {
+ /* 0 */ 206, 503, 307, 357,
+ /* 4 */ 587, 630, 387, 413,
+};
+
+static const uint16_t ud_itab__418[] = {
+ /* 0 */ 215, 216, 217, 218,
+ /* 4 */ 219, 220, 221, 222,
+ /* 8 */ 504, 505, 506, 507,
+ /* c */ 508, 509, 510, 511,
+ /* 10 */ 309, 310, 311, 312,
+ /* 14 */ 313, 314, 315, 316,
+ /* 18 */ 359, 360, 361, 362,
+ /* 1c */ 363, 364, 365, 366,
+ /* 20 */ 589, 590, 591, 592,
+ /* 24 */ 593, 594, 595, 596,
+ /* 28 */ 614, 615, 616, 617,
+ /* 2c */ 618, 619, 620, 621,
+ /* 30 */ 388, 389, 390, 391,
+ /* 34 */ 392, 393, 394, 395,
+ /* 38 */ 414, 415, 416, 417,
+ /* 3c */ 418, 419, 420, 421,
+};
+
+static const uint16_t ud_itab__419[] = {
+ /* 0 */ GROUP(420), GROUP(421),
+};
+
+static const uint16_t ud_itab__420[] = {
+ /* 0 */ 476, INVALID, 573, 540,
+ /* 4 */ 493, 492, 584, 583,
+};
+
+static const uint16_t ud_itab__421[] = {
+ /* 0 */ 477, 478, 479, 480,
+ /* 4 */ 481, 482, 483, 484,
+ /* 8 */ 658, 659, 660, 661,
+ /* c */ 662, 663, 664, 665,
+ /* 10 */ 522, INVALID, INVALID, INVALID,
+ /* 14 */ INVALID, INVALID, INVALID, INVALID,
+ /* 18 */ 549, 550, 551, 552,
+ /* 1c */ 553, 554, 555, 556,
+ /* 20 */ 233, 204, INVALID, INVALID,
+ /* 24 */ 639, 657, INVALID, INVALID,
+ /* 28 */ 485, 486, 487, 488,
+ /* 2c */ 489, 490, 491, INVALID,
+ /* 30 */ 203, 685, 529, 526,
+ /* 34 */ 684, 528, 377, 454,
+ /* 38 */ 527, 686, 537, 536,
+ /* 3c */ 530, 534, 535, 376,
+};
+
+static const uint16_t ud_itab__422[] = {
+ /* 0 */ GROUP(423), GROUP(424),
+};
+
+static const uint16_t ud_itab__423[] = {
+ /* 0 */ 456, 520, 448, 450,
+ /* 4 */ 462, 464, 460, 458,
+};
+
+static const uint16_t ud_itab__424[] = {
+ /* 0 */ 235, 236, 237, 238,
+ /* 4 */ 239, 240, 241, 242,
+ /* 8 */ 243, 244, 245, 246,
+ /* c */ 247, 248, 249, 250,
+ /* 10 */ 251, 252, 253, 254,
+ /* 14 */ 255, 256, 257, 258,
+ /* 18 */ 259, 260, 261, 262,
+ /* 1c */ 263, 264, 265, 266,
+ /* 20 */ INVALID, INVALID, INVALID, INVALID,
+ /* 24 */ INVALID, INVALID, INVALID, INVALID,
+ /* 28 */ INVALID, 656, INVALID, INVALID,
+ /* 2c */ INVALID, INVALID, INVALID, INVALID,
+ /* 30 */ INVALID, INVALID, INVALID, INVALID,
+ /* 34 */ INVALID, INVALID, INVALID, INVALID,
+ /* 38 */ INVALID, INVALID, INVALID, INVALID,
+ /* 3c */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__425[] = {
+ /* 0 */ GROUP(426), GROUP(427),
+};
+
+static const uint16_t ud_itab__426[] = {
+ /* 0 */ 453, 471, 467, 470,
+ /* 4 */ INVALID, 474, INVALID, 538,
+};
+
+static const uint16_t ud_itab__427[] = {
+ /* 0 */ 267, 268, 269, 270,
+ /* 4 */ 271, 272, 273, 274,
+ /* 8 */ 275, 276, 277, 278,
+ /* c */ 279, 280, 281, 282,
+ /* 10 */ 283, 284, 285, 286,
+ /* 14 */ 287, 288, 289, 290,
+ /* 18 */ 291, 292, 293, 294,
+ /* 1c */ 295, 296, 297, 298,
+ /* 20 */ 524, 523, 234, 455,
+ /* 24 */ 525, 532, INVALID, INVALID,
+ /* 28 */ 299, 300, 301, 302,
+ /* 2c */ 303, 304, 305, 306,
+ /* 30 */ 333, 334, 335, 336,
+ /* 34 */ 337, 338, 339, 340,
+ /* 38 */ INVALID, INVALID, INVALID, INVALID,
+ /* 3c */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__428[] = {
+ /* 0 */ GROUP(429), GROUP(430),
+};
+
+static const uint16_t ud_itab__429[] = {
+ /* 0 */ 205, 494, 308, 358,
+ /* 4 */ 588, 613, 378, 404,
+};
+
+static const uint16_t ud_itab__430[] = {
+ /* 0 */ 207, 208, 209, 210,
+ /* 4 */ 211, 212, 213, 214,
+ /* 8 */ 495, 496, 497, 498,
+ /* c */ 499, 500, 501, 502,
+ /* 10 */ 317, 318, 319, 320,
+ /* 14 */ 321, 322, 323, 324,
+ /* 18 */ 325, 326, 327, 328,
+ /* 1c */ 329, 330, 331, 332,
+ /* 20 */ 622, 623, 624, 625,
+ /* 24 */ 626, 627, 628, 629,
+ /* 28 */ 597, 598, 599, 600,
+ /* 2c */ 601, 602, 603, 604,
+ /* 30 */ 405, 406, 407, 408,
+ /* 34 */ 409, 410, 411, 412,
+ /* 38 */ 379, 380, 381, 382,
+ /* 3c */ 383, 384, 385, 386,
+};
+
+static const uint16_t ud_itab__431[] = {
+ /* 0 */ GROUP(432), GROUP(433),
+};
+
+static const uint16_t ud_itab__432[] = {
+ /* 0 */ 475, 472, 574, 539,
+ /* 4 */ 531, INVALID, 533, 585,
+};
+
+static const uint16_t ud_itab__433[] = {
+ /* 0 */ 431, 432, 433, 434,
+ /* 4 */ 435, 436, 437, 438,
+ /* 8 */ 666, 667, 668, 669,
+ /* c */ 670, 671, 672, 673,
+ /* 10 */ 575, 576, 577, 578,
+ /* 14 */ 579, 580, 581, 582,
+ /* 18 */ 541, 542, 543, 544,
+ /* 1c */ 545, 546, 547, 548,
+ /* 20 */ 640, 641, 642, 643,
+ /* 24 */ 644, 645, 646, 647,
+ /* 28 */ 648, 649, 650, 651,
+ /* 2c */ 652, 653, 654, 655,
+ /* 30 */ INVALID, INVALID, INVALID, INVALID,
+ /* 34 */ INVALID, INVALID, INVALID, INVALID,
+ /* 38 */ INVALID, INVALID, INVALID, INVALID,
+ /* 3c */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__434[] = {
+ /* 0 */ GROUP(435), GROUP(436),
+};
+
+static const uint16_t ud_itab__435[] = {
+ /* 0 */ 457, 521, 447, 449,
+ /* 4 */ 463, 465, 461, 459,
+};
+
+static const uint16_t ud_itab__436[] = {
+ /* 0 */ 223, 224, 225, 226,
+ /* 4 */ 227, 228, 229, 230,
+ /* 8 */ 512, 513, 514, 515,
+ /* c */ 516, 517, 518, 519,
+ /* 10 */ 367, 368, 369, 370,
+ /* 14 */ 371, 372, 373, 374,
+ /* 18 */ INVALID, 375, INVALID, INVALID,
+ /* 1c */ INVALID, INVALID, INVALID, INVALID,
+ /* 20 */ 631, 632, 633, 634,
+ /* 24 */ 635, 636, 637, 638,
+ /* 28 */ 605, 606, 607, 608,
+ /* 2c */ 609, 610, 611, 612,
+ /* 30 */ 422, 423, 424, 425,
+ /* 34 */ 426, 427, 428, 429,
+ /* 38 */ 396, 397, 398, 399,
+ /* 3c */ 400, 401, 402, 403,
+};
+
+static const uint16_t ud_itab__437[] = {
+ /* 0 */ GROUP(438), GROUP(439),
+};
+
+static const uint16_t ud_itab__438[] = {
+ /* 0 */ 451, 473, 466, 468,
+ /* 4 */ 231, 452, 232, 469,
+};
+
+static const uint16_t ud_itab__439[] = {
+ /* 0 */ 439, 440, 441, 442,
+ /* 4 */ 443, 444, 445, 446,
+ /* 8 */ 674, 675, 676, 677,
+ /* c */ 678, 679, 680, 681,
+ /* 10 */ 557, 558, 559, 560,
+ /* 14 */ 561, 562, 563, 564,
+ /* 18 */ 565, 566, 567, 568,
+ /* 1c */ 569, 570, 571, 572,
+ /* 20 */ 586, INVALID, INVALID, INVALID,
+ /* 24 */ INVALID, INVALID, INVALID, INVALID,
+ /* 28 */ 341, 342, 343, 344,
+ /* 2c */ 345, 346, 347, 348,
+ /* 30 */ 349, 350, 351, 352,
+ /* 34 */ 353, 354, 355, 356,
+ /* 38 */ INVALID, INVALID, INVALID, INVALID,
+ /* 3c */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__440[] = {
+ /* 0 */ 758, 759, 760,
+};
+
+static const uint16_t ud_itab__441[] = {
+ /* 0 */ 764, INVALID,
+};
+
+static const uint16_t ud_itab__442[] = {
+ /* 0 */ 1432, 1437, 962, 953,
+ /* 4 */ 942, 695, 186, 689,
+};
+
+static const uint16_t ud_itab__443[] = {
+ /* 0 */ 1438, 1439, 963, 954,
+ /* 4 */ 943, 696, 185, 688,
+};
+
+static const uint16_t ud_itab__444[] = {
+ /* 0 */ 708, 183, INVALID, INVALID,
+ /* 4 */ INVALID, INVALID, INVALID, INVALID,
+};
+
+static const uint16_t ud_itab__445[] = {
+ /* 0 */ 707, 184, GROUP(446), 71,
+ /* 4 */ 761, 762, 1255, INVALID,
+};
+
+static const uint16_t ud_itab__446[] = {
+ /* 0 */ 69, 70,
+};
+
+
+struct ud_lookup_table_list_entry ud_lookup_table_list[] = {
+ /* 000 */ { ud_itab__0, UD_TAB__OPC_TABLE, "opctbl" },
+ /* 001 */ { ud_itab__1, UD_TAB__OPC_MODE, "/m" },
+ /* 002 */ { ud_itab__2, UD_TAB__OPC_MODE, "/m" },
+ /* 003 */ { ud_itab__3, UD_TAB__OPC_MODE, "/m" },
+ /* 004 */ { ud_itab__4, UD_TAB__OPC_TABLE, "opctbl" },
+ /* 005 */ { ud_itab__5, UD_TAB__OPC_REG, "/reg" },
+ /* 006 */ { ud_itab__6, UD_TAB__OPC_MOD, "/mod" },
+ /* 007 */ { ud_itab__7, UD_TAB__OPC_REG, "/reg" },
+ /* 008 */ { ud_itab__8, UD_TAB__OPC_REG, "/reg" },
+ /* 009 */ { ud_itab__9, UD_TAB__OPC_RM, "/rm" },
+ /* 010 */ { ud_itab__10, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 011 */ { ud_itab__11, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 012 */ { ud_itab__12, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 013 */ { ud_itab__13, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 014 */ { ud_itab__14, UD_TAB__OPC_RM, "/rm" },
+ /* 015 */ { ud_itab__15, UD_TAB__OPC_RM, "/rm" },
+ /* 016 */ { ud_itab__16, UD_TAB__OPC_RM, "/rm" },
+ /* 017 */ { ud_itab__17, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 018 */ { ud_itab__18, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 019 */ { ud_itab__19, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 020 */ { ud_itab__20, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 021 */ { ud_itab__21, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 022 */ { ud_itab__22, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 023 */ { ud_itab__23, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 024 */ { ud_itab__24, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 025 */ { ud_itab__25, UD_TAB__OPC_RM, "/rm" },
+ /* 026 */ { ud_itab__26, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 027 */ { ud_itab__27, UD_TAB__OPC_REG, "/reg" },
+ /* 028 */ { ud_itab__28, UD_TAB__OPC_3DNOW, "/3dnow" },
+ /* 029 */ { ud_itab__29, UD_TAB__OPC_SSE, "/sse" },
+ /* 030 */ { ud_itab__30, UD_TAB__OPC_SSE, "/sse" },
+ /* 031 */ { ud_itab__31, UD_TAB__OPC_MOD, "/mod" },
+ /* 032 */ { ud_itab__32, UD_TAB__OPC_SSE, "/sse" },
+ /* 033 */ { ud_itab__33, UD_TAB__OPC_SSE, "/sse" },
+ /* 034 */ { ud_itab__34, UD_TAB__OPC_SSE, "/sse" },
+ /* 035 */ { ud_itab__35, UD_TAB__OPC_SSE, "/sse" },
+ /* 036 */ { ud_itab__36, UD_TAB__OPC_SSE, "/sse" },
+ /* 037 */ { ud_itab__37, UD_TAB__OPC_MOD, "/mod" },
+ /* 038 */ { ud_itab__38, UD_TAB__OPC_SSE, "/sse" },
+ /* 039 */ { ud_itab__39, UD_TAB__OPC_SSE, "/sse" },
+ /* 040 */ { ud_itab__40, UD_TAB__OPC_SSE, "/sse" },
+ /* 041 */ { ud_itab__41, UD_TAB__OPC_REG, "/reg" },
+ /* 042 */ { ud_itab__42, UD_TAB__OPC_SSE, "/sse" },
+ /* 043 */ { ud_itab__43, UD_TAB__OPC_SSE, "/sse" },
+ /* 044 */ { ud_itab__44, UD_TAB__OPC_SSE, "/sse" },
+ /* 045 */ { ud_itab__45, UD_TAB__OPC_SSE, "/sse" },
+ /* 046 */ { ud_itab__46, UD_TAB__OPC_SSE, "/sse" },
+ /* 047 */ { ud_itab__47, UD_TAB__OPC_SSE, "/sse" },
+ /* 048 */ { ud_itab__48, UD_TAB__OPC_SSE, "/sse" },
+ /* 049 */ { ud_itab__49, UD_TAB__OPC_SSE, "/sse" },
+ /* 050 */ { ud_itab__50, UD_TAB__OPC_MODE, "/m" },
+ /* 051 */ { ud_itab__51, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 052 */ { ud_itab__52, UD_TAB__OPC_MODE, "/m" },
+ /* 053 */ { ud_itab__53, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 054 */ { ud_itab__54, UD_TAB__OPC_TABLE, "opctbl" },
+ /* 055 */ { ud_itab__55, UD_TAB__OPC_SSE, "/sse" },
+ /* 056 */ { ud_itab__56, UD_TAB__OPC_MODE, "/m" },
+ /* 057 */ { ud_itab__57, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 058 */ { ud_itab__58, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 059 */ { ud_itab__59, UD_TAB__OPC_SSE, "/sse" },
+ /* 060 */ { ud_itab__60, UD_TAB__OPC_MODE, "/m" },
+ /* 061 */ { ud_itab__61, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 062 */ { ud_itab__62, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 063 */ { ud_itab__63, UD_TAB__OPC_SSE, "/sse" },
+ /* 064 */ { ud_itab__64, UD_TAB__OPC_SSE, "/sse" },
+ /* 065 */ { ud_itab__65, UD_TAB__OPC_SSE, "/sse" },
+ /* 066 */ { ud_itab__66, UD_TAB__OPC_SSE, "/sse" },
+ /* 067 */ { ud_itab__67, UD_TAB__OPC_SSE, "/sse" },
+ /* 068 */ { ud_itab__68, UD_TAB__OPC_SSE, "/sse" },
+ /* 069 */ { ud_itab__69, UD_TAB__OPC_SSE, "/sse" },
+ /* 070 */ { ud_itab__70, UD_TAB__OPC_SSE, "/sse" },
+ /* 071 */ { ud_itab__71, UD_TAB__OPC_SSE, "/sse" },
+ /* 072 */ { ud_itab__72, UD_TAB__OPC_SSE, "/sse" },
+ /* 073 */ { ud_itab__73, UD_TAB__OPC_SSE, "/sse" },
+ /* 074 */ { ud_itab__74, UD_TAB__OPC_SSE, "/sse" },
+ /* 075 */ { ud_itab__75, UD_TAB__OPC_SSE, "/sse" },
+ /* 076 */ { ud_itab__76, UD_TAB__OPC_SSE, "/sse" },
+ /* 077 */ { ud_itab__77, UD_TAB__OPC_SSE, "/sse" },
+ /* 078 */ { ud_itab__78, UD_TAB__OPC_SSE, "/sse" },
+ /* 079 */ { ud_itab__79, UD_TAB__OPC_SSE, "/sse" },
+ /* 080 */ { ud_itab__80, UD_TAB__OPC_SSE, "/sse" },
+ /* 081 */ { ud_itab__81, UD_TAB__OPC_SSE, "/sse" },
+ /* 082 */ { ud_itab__82, UD_TAB__OPC_SSE, "/sse" },
+ /* 083 */ { ud_itab__83, UD_TAB__OPC_SSE, "/sse" },
+ /* 084 */ { ud_itab__84, UD_TAB__OPC_SSE, "/sse" },
+ /* 085 */ { ud_itab__85, UD_TAB__OPC_SSE, "/sse" },
+ /* 086 */ { ud_itab__86, UD_TAB__OPC_SSE, "/sse" },
+ /* 087 */ { ud_itab__87, UD_TAB__OPC_SSE, "/sse" },
+ /* 088 */ { ud_itab__88, UD_TAB__OPC_SSE, "/sse" },
+ /* 089 */ { ud_itab__89, UD_TAB__OPC_SSE, "/sse" },
+ /* 090 */ { ud_itab__90, UD_TAB__OPC_SSE, "/sse" },
+ /* 091 */ { ud_itab__91, UD_TAB__OPC_SSE, "/sse" },
+ /* 092 */ { ud_itab__92, UD_TAB__OPC_SSE, "/sse" },
+ /* 093 */ { ud_itab__93, UD_TAB__OPC_SSE, "/sse" },
+ /* 094 */ { ud_itab__94, UD_TAB__OPC_SSE, "/sse" },
+ /* 095 */ { ud_itab__95, UD_TAB__OPC_SSE, "/sse" },
+ /* 096 */ { ud_itab__96, UD_TAB__OPC_SSE, "/sse" },
+ /* 097 */ { ud_itab__97, UD_TAB__OPC_SSE, "/sse" },
+ /* 098 */ { ud_itab__98, UD_TAB__OPC_SSE, "/sse" },
+ /* 099 */ { ud_itab__99, UD_TAB__OPC_SSE, "/sse" },
+ /* 100 */ { ud_itab__100, UD_TAB__OPC_SSE, "/sse" },
+ /* 101 */ { ud_itab__101, UD_TAB__OPC_SSE, "/sse" },
+ /* 102 */ { ud_itab__102, UD_TAB__OPC_SSE, "/sse" },
+ /* 103 */ { ud_itab__103, UD_TAB__OPC_SSE, "/sse" },
+ /* 104 */ { ud_itab__104, UD_TAB__OPC_SSE, "/sse" },
+ /* 105 */ { ud_itab__105, UD_TAB__OPC_SSE, "/sse" },
+ /* 106 */ { ud_itab__106, UD_TAB__OPC_SSE, "/sse" },
+ /* 107 */ { ud_itab__107, UD_TAB__OPC_SSE, "/sse" },
+ /* 108 */ { ud_itab__108, UD_TAB__OPC_SSE, "/sse" },
+ /* 109 */ { ud_itab__109, UD_TAB__OPC_SSE, "/sse" },
+ /* 110 */ { ud_itab__110, UD_TAB__OPC_SSE, "/sse" },
+ /* 111 */ { ud_itab__111, UD_TAB__OPC_SSE, "/sse" },
+ /* 112 */ { ud_itab__112, UD_TAB__OPC_SSE, "/sse" },
+ /* 113 */ { ud_itab__113, UD_TAB__OPC_SSE, "/sse" },
+ /* 114 */ { ud_itab__114, UD_TAB__OPC_SSE, "/sse" },
+ /* 115 */ { ud_itab__115, UD_TAB__OPC_SSE, "/sse" },
+ /* 116 */ { ud_itab__116, UD_TAB__OPC_TABLE, "opctbl" },
+ /* 117 */ { ud_itab__117, UD_TAB__OPC_SSE, "/sse" },
+ /* 118 */ { ud_itab__118, UD_TAB__OPC_SSE, "/sse" },
+ /* 119 */ { ud_itab__119, UD_TAB__OPC_SSE, "/sse" },
+ /* 120 */ { ud_itab__120, UD_TAB__OPC_SSE, "/sse" },
+ /* 121 */ { ud_itab__121, UD_TAB__OPC_SSE, "/sse" },
+ /* 122 */ { ud_itab__122, UD_TAB__OPC_SSE, "/sse" },
+ /* 123 */ { ud_itab__123, UD_TAB__OPC_SSE, "/sse" },
+ /* 124 */ { ud_itab__124, UD_TAB__OPC_SSE, "/sse" },
+ /* 125 */ { ud_itab__125, UD_TAB__OPC_SSE, "/sse" },
+ /* 126 */ { ud_itab__126, UD_TAB__OPC_SSE, "/sse" },
+ /* 127 */ { ud_itab__127, UD_TAB__OPC_SSE, "/sse" },
+ /* 128 */ { ud_itab__128, UD_TAB__OPC_OSIZE, "/o" },
+ /* 129 */ { ud_itab__129, UD_TAB__OPC_SSE, "/sse" },
+ /* 130 */ { ud_itab__130, UD_TAB__OPC_SSE, "/sse" },
+ /* 131 */ { ud_itab__131, UD_TAB__OPC_SSE, "/sse" },
+ /* 132 */ { ud_itab__132, UD_TAB__OPC_SSE, "/sse" },
+ /* 133 */ { ud_itab__133, UD_TAB__OPC_OSIZE, "/o" },
+ /* 134 */ { ud_itab__134, UD_TAB__OPC_SSE, "/sse" },
+ /* 135 */ { ud_itab__135, UD_TAB__OPC_SSE, "/sse" },
+ /* 136 */ { ud_itab__136, UD_TAB__OPC_SSE, "/sse" },
+ /* 137 */ { ud_itab__137, UD_TAB__OPC_SSE, "/sse" },
+ /* 138 */ { ud_itab__138, UD_TAB__OPC_SSE, "/sse" },
+ /* 139 */ { ud_itab__139, UD_TAB__OPC_SSE, "/sse" },
+ /* 140 */ { ud_itab__140, UD_TAB__OPC_SSE, "/sse" },
+ /* 141 */ { ud_itab__141, UD_TAB__OPC_SSE, "/sse" },
+ /* 142 */ { ud_itab__142, UD_TAB__OPC_SSE, "/sse" },
+ /* 143 */ { ud_itab__143, UD_TAB__OPC_SSE, "/sse" },
+ /* 144 */ { ud_itab__144, UD_TAB__OPC_SSE, "/sse" },
+ /* 145 */ { ud_itab__145, UD_TAB__OPC_SSE, "/sse" },
+ /* 146 */ { ud_itab__146, UD_TAB__OPC_SSE, "/sse" },
+ /* 147 */ { ud_itab__147, UD_TAB__OPC_SSE, "/sse" },
+ /* 148 */ { ud_itab__148, UD_TAB__OPC_SSE, "/sse" },
+ /* 149 */ { ud_itab__149, UD_TAB__OPC_SSE, "/sse" },
+ /* 150 */ { ud_itab__150, UD_TAB__OPC_SSE, "/sse" },
+ /* 151 */ { ud_itab__151, UD_TAB__OPC_SSE, "/sse" },
+ /* 152 */ { ud_itab__152, UD_TAB__OPC_SSE, "/sse" },
+ /* 153 */ { ud_itab__153, UD_TAB__OPC_SSE, "/sse" },
+ /* 154 */ { ud_itab__154, UD_TAB__OPC_SSE, "/sse" },
+ /* 155 */ { ud_itab__155, UD_TAB__OPC_SSE, "/sse" },
+ /* 156 */ { ud_itab__156, UD_TAB__OPC_SSE, "/sse" },
+ /* 157 */ { ud_itab__157, UD_TAB__OPC_SSE, "/sse" },
+ /* 158 */ { ud_itab__158, UD_TAB__OPC_SSE, "/sse" },
+ /* 159 */ { ud_itab__159, UD_TAB__OPC_SSE, "/sse" },
+ /* 160 */ { ud_itab__160, UD_TAB__OPC_SSE, "/sse" },
+ /* 161 */ { ud_itab__161, UD_TAB__OPC_SSE, "/sse" },
+ /* 162 */ { ud_itab__162, UD_TAB__OPC_SSE, "/sse" },
+ /* 163 */ { ud_itab__163, UD_TAB__OPC_SSE, "/sse" },
+ /* 164 */ { ud_itab__164, UD_TAB__OPC_SSE, "/sse" },
+ /* 165 */ { ud_itab__165, UD_TAB__OPC_SSE, "/sse" },
+ /* 166 */ { ud_itab__166, UD_TAB__OPC_SSE, "/sse" },
+ /* 167 */ { ud_itab__167, UD_TAB__OPC_SSE, "/sse" },
+ /* 168 */ { ud_itab__168, UD_TAB__OPC_SSE, "/sse" },
+ /* 169 */ { ud_itab__169, UD_TAB__OPC_SSE, "/sse" },
+ /* 170 */ { ud_itab__170, UD_TAB__OPC_SSE, "/sse" },
+ /* 171 */ { ud_itab__171, UD_TAB__OPC_SSE, "/sse" },
+ /* 172 */ { ud_itab__172, UD_TAB__OPC_SSE, "/sse" },
+ /* 173 */ { ud_itab__173, UD_TAB__OPC_SSE, "/sse" },
+ /* 174 */ { ud_itab__174, UD_TAB__OPC_OSIZE, "/o" },
+ /* 175 */ { ud_itab__175, UD_TAB__OPC_OSIZE, "/o" },
+ /* 176 */ { ud_itab__176, UD_TAB__OPC_SSE, "/sse" },
+ /* 177 */ { ud_itab__177, UD_TAB__OPC_SSE, "/sse" },
+ /* 178 */ { ud_itab__178, UD_TAB__OPC_REG, "/reg" },
+ /* 179 */ { ud_itab__179, UD_TAB__OPC_SSE, "/sse" },
+ /* 180 */ { ud_itab__180, UD_TAB__OPC_SSE, "/sse" },
+ /* 181 */ { ud_itab__181, UD_TAB__OPC_SSE, "/sse" },
+ /* 182 */ { ud_itab__182, UD_TAB__OPC_REG, "/reg" },
+ /* 183 */ { ud_itab__183, UD_TAB__OPC_SSE, "/sse" },
+ /* 184 */ { ud_itab__184, UD_TAB__OPC_SSE, "/sse" },
+ /* 185 */ { ud_itab__185, UD_TAB__OPC_SSE, "/sse" },
+ /* 186 */ { ud_itab__186, UD_TAB__OPC_REG, "/reg" },
+ /* 187 */ { ud_itab__187, UD_TAB__OPC_SSE, "/sse" },
+ /* 188 */ { ud_itab__188, UD_TAB__OPC_SSE, "/sse" },
+ /* 189 */ { ud_itab__189, UD_TAB__OPC_SSE, "/sse" },
+ /* 190 */ { ud_itab__190, UD_TAB__OPC_SSE, "/sse" },
+ /* 191 */ { ud_itab__191, UD_TAB__OPC_SSE, "/sse" },
+ /* 192 */ { ud_itab__192, UD_TAB__OPC_SSE, "/sse" },
+ /* 193 */ { ud_itab__193, UD_TAB__OPC_SSE, "/sse" },
+ /* 194 */ { ud_itab__194, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 195 */ { ud_itab__195, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 196 */ { ud_itab__196, UD_TAB__OPC_SSE, "/sse" },
+ /* 197 */ { ud_itab__197, UD_TAB__OPC_SSE, "/sse" },
+ /* 198 */ { ud_itab__198, UD_TAB__OPC_SSE, "/sse" },
+ /* 199 */ { ud_itab__199, UD_TAB__OPC_OSIZE, "/o" },
+ /* 200 */ { ud_itab__200, UD_TAB__OPC_OSIZE, "/o" },
+ /* 201 */ { ud_itab__201, UD_TAB__OPC_SSE, "/sse" },
+ /* 202 */ { ud_itab__202, UD_TAB__OPC_MOD, "/mod" },
+ /* 203 */ { ud_itab__203, UD_TAB__OPC_REG, "/reg" },
+ /* 204 */ { ud_itab__204, UD_TAB__OPC_RM, "/rm" },
+ /* 205 */ { ud_itab__205, UD_TAB__OPC_RM, "/rm" },
+ /* 206 */ { ud_itab__206, UD_TAB__OPC_RM, "/rm" },
+ /* 207 */ { ud_itab__207, UD_TAB__OPC_MOD, "/mod" },
+ /* 208 */ { ud_itab__208, UD_TAB__OPC_REG, "/reg" },
+ /* 209 */ { ud_itab__209, UD_TAB__OPC_RM, "/rm" },
+ /* 210 */ { ud_itab__210, UD_TAB__OPC_RM, "/rm" },
+ /* 211 */ { ud_itab__211, UD_TAB__OPC_RM, "/rm" },
+ /* 212 */ { ud_itab__212, UD_TAB__OPC_RM, "/rm" },
+ /* 213 */ { ud_itab__213, UD_TAB__OPC_RM, "/rm" },
+ /* 214 */ { ud_itab__214, UD_TAB__OPC_RM, "/rm" },
+ /* 215 */ { ud_itab__215, UD_TAB__OPC_MOD, "/mod" },
+ /* 216 */ { ud_itab__216, UD_TAB__OPC_REG, "/reg" },
+ /* 217 */ { ud_itab__217, UD_TAB__OPC_REG, "/reg" },
+ /* 218 */ { ud_itab__218, UD_TAB__OPC_RM, "/rm" },
+ /* 219 */ { ud_itab__219, UD_TAB__OPC_RM, "/rm" },
+ /* 220 */ { ud_itab__220, UD_TAB__OPC_RM, "/rm" },
+ /* 221 */ { ud_itab__221, UD_TAB__OPC_SSE, "/sse" },
+ /* 222 */ { ud_itab__222, UD_TAB__OPC_REG, "/reg" },
+ /* 223 */ { ud_itab__223, UD_TAB__OPC_SSE, "/sse" },
+ /* 224 */ { ud_itab__224, UD_TAB__OPC_SSE, "/sse" },
+ /* 225 */ { ud_itab__225, UD_TAB__OPC_SSE, "/sse" },
+ /* 226 */ { ud_itab__226, UD_TAB__OPC_SSE, "/sse" },
+ /* 227 */ { ud_itab__227, UD_TAB__OPC_MOD, "/mod" },
+ /* 228 */ { ud_itab__228, UD_TAB__OPC_REG, "/reg" },
+ /* 229 */ { ud_itab__229, UD_TAB__OPC_OSIZE, "/o" },
+ /* 230 */ { ud_itab__230, UD_TAB__OPC_SSE, "/sse" },
+ /* 231 */ { ud_itab__231, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 232 */ { ud_itab__232, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 233 */ { ud_itab__233, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 234 */ { ud_itab__234, UD_TAB__OPC_VENDOR, "/vendor" },
+ /* 235 */ { ud_itab__235, UD_TAB__OPC_REG, "/reg" },
+ /* 236 */ { ud_itab__236, UD_TAB__OPC_SSE, "/sse" },
+ /* 237 */ { ud_itab__237, UD_TAB__OPC_SSE, "/sse" },
+ /* 238 */ { ud_itab__238, UD_TAB__OPC_SSE, "/sse" },
+ /* 239 */ { ud_itab__239, UD_TAB__OPC_SSE, "/sse" },
+ /* 240 */ { ud_itab__240, UD_TAB__OPC_SSE, "/sse" },
+ /* 241 */ { ud_itab__241, UD_TAB__OPC_SSE, "/sse" },
+ /* 242 */ { ud_itab__242, UD_TAB__OPC_SSE, "/sse" },
+ /* 243 */ { ud_itab__243, UD_TAB__OPC_SSE, "/sse" },
+ /* 244 */ { ud_itab__244, UD_TAB__OPC_SSE, "/sse" },
+ /* 245 */ { ud_itab__245, UD_TAB__OPC_SSE, "/sse" },
+ /* 246 */ { ud_itab__246, UD_TAB__OPC_SSE, "/sse" },
+ /* 247 */ { ud_itab__247, UD_TAB__OPC_SSE, "/sse" },
+ /* 248 */ { ud_itab__248, UD_TAB__OPC_SSE, "/sse" },
+ /* 249 */ { ud_itab__249, UD_TAB__OPC_SSE, "/sse" },
+ /* 250 */ { ud_itab__250, UD_TAB__OPC_SSE, "/sse" },
+ /* 251 */ { ud_itab__251, UD_TAB__OPC_SSE, "/sse" },
+ /* 252 */ { ud_itab__252, UD_TAB__OPC_SSE, "/sse" },
+ /* 253 */ { ud_itab__253, UD_TAB__OPC_SSE, "/sse" },
+ /* 254 */ { ud_itab__254, UD_TAB__OPC_SSE, "/sse" },
+ /* 255 */ { ud_itab__255, UD_TAB__OPC_SSE, "/sse" },
+ /* 256 */ { ud_itab__256, UD_TAB__OPC_SSE, "/sse" },
+ /* 257 */ { ud_itab__257, UD_TAB__OPC_SSE, "/sse" },
+ /* 258 */ { ud_itab__258, UD_TAB__OPC_SSE, "/sse" },
+ /* 259 */ { ud_itab__259, UD_TAB__OPC_SSE, "/sse" },
+ /* 260 */ { ud_itab__260, UD_TAB__OPC_SSE, "/sse" },
+ /* 261 */ { ud_itab__261, UD_TAB__OPC_SSE, "/sse" },
+ /* 262 */ { ud_itab__262, UD_TAB__OPC_SSE, "/sse" },
+ /* 263 */ { ud_itab__263, UD_TAB__OPC_SSE, "/sse" },
+ /* 264 */ { ud_itab__264, UD_TAB__OPC_SSE, "/sse" },
+ /* 265 */ { ud_itab__265, UD_TAB__OPC_SSE, "/sse" },
+ /* 266 */ { ud_itab__266, UD_TAB__OPC_SSE, "/sse" },
+ /* 267 */ { ud_itab__267, UD_TAB__OPC_SSE, "/sse" },
+ /* 268 */ { ud_itab__268, UD_TAB__OPC_SSE, "/sse" },
+ /* 269 */ { ud_itab__269, UD_TAB__OPC_SSE, "/sse" },
+ /* 270 */ { ud_itab__270, UD_TAB__OPC_SSE, "/sse" },
+ /* 271 */ { ud_itab__271, UD_TAB__OPC_SSE, "/sse" },
+ /* 272 */ { ud_itab__272, UD_TAB__OPC_SSE, "/sse" },
+ /* 273 */ { ud_itab__273, UD_TAB__OPC_SSE, "/sse" },
+ /* 274 */ { ud_itab__274, UD_TAB__OPC_SSE, "/sse" },
+ /* 275 */ { ud_itab__275, UD_TAB__OPC_MOD, "/mod" },
+ /* 276 */ { ud_itab__276, UD_TAB__OPC_SSE, "/sse" },
+ /* 277 */ { ud_itab__277, UD_TAB__OPC_SSE, "/sse" },
+ /* 278 */ { ud_itab__278, UD_TAB__OPC_SSE, "/sse" },
+ /* 279 */ { ud_itab__279, UD_TAB__OPC_SSE, "/sse" },
+ /* 280 */ { ud_itab__280, UD_TAB__OPC_SSE, "/sse" },
+ /* 281 */ { ud_itab__281, UD_TAB__OPC_SSE, "/sse" },
+ /* 282 */ { ud_itab__282, UD_TAB__OPC_SSE, "/sse" },
+ /* 283 */ { ud_itab__283, UD_TAB__OPC_SSE, "/sse" },
+ /* 284 */ { ud_itab__284, UD_TAB__OPC_MODE, "/m" },
+ /* 285 */ { ud_itab__285, UD_TAB__OPC_MODE, "/m" },
+ /* 286 */ { ud_itab__286, UD_TAB__OPC_MODE, "/m" },
+ /* 287 */ { ud_itab__287, UD_TAB__OPC_MODE, "/m" },
+ /* 288 */ { ud_itab__288, UD_TAB__OPC_MODE, "/m" },
+ /* 289 */ { ud_itab__289, UD_TAB__OPC_MODE, "/m" },
+ /* 290 */ { ud_itab__290, UD_TAB__OPC_MODE, "/m" },
+ /* 291 */ { ud_itab__291, UD_TAB__OPC_MODE, "/m" },
+ /* 292 */ { ud_itab__292, UD_TAB__OPC_OSIZE, "/o" },
+ /* 293 */ { ud_itab__293, UD_TAB__OPC_MODE, "/m" },
+ /* 294 */ { ud_itab__294, UD_TAB__OPC_MODE, "/m" },
+ /* 295 */ { ud_itab__295, UD_TAB__OPC_OSIZE, "/o" },
+ /* 296 */ { ud_itab__296, UD_TAB__OPC_MODE, "/m" },
+ /* 297 */ { ud_itab__297, UD_TAB__OPC_MODE, "/m" },
+ /* 298 */ { ud_itab__298, UD_TAB__OPC_MODE, "/m" },
+ /* 299 */ { ud_itab__299, UD_TAB__OPC_MODE, "/m" },
+ /* 300 */ { ud_itab__300, UD_TAB__OPC_OSIZE, "/o" },
+ /* 301 */ { ud_itab__301, UD_TAB__OPC_OSIZE, "/o" },
+ /* 302 */ { ud_itab__302, UD_TAB__OPC_REG, "/reg" },
+ /* 303 */ { ud_itab__303, UD_TAB__OPC_REG, "/reg" },
+ /* 304 */ { ud_itab__304, UD_TAB__OPC_REG, "/reg" },
+ /* 305 */ { ud_itab__305, UD_TAB__OPC_MODE, "/m" },
+ /* 306 */ { ud_itab__306, UD_TAB__OPC_MODE, "/m" },
+ /* 307 */ { ud_itab__307, UD_TAB__OPC_MODE, "/m" },
+ /* 308 */ { ud_itab__308, UD_TAB__OPC_MODE, "/m" },
+ /* 309 */ { ud_itab__309, UD_TAB__OPC_MODE, "/m" },
+ /* 310 */ { ud_itab__310, UD_TAB__OPC_MODE, "/m" },
+ /* 311 */ { ud_itab__311, UD_TAB__OPC_MODE, "/m" },
+ /* 312 */ { ud_itab__312, UD_TAB__OPC_MODE, "/m" },
+ /* 313 */ { ud_itab__313, UD_TAB__OPC_REG, "/reg" },
+ /* 314 */ { ud_itab__314, UD_TAB__OPC_REG, "/reg" },
+ /* 315 */ { ud_itab__315, UD_TAB__OPC_OSIZE, "/o" },
+ /* 316 */ { ud_itab__316, UD_TAB__OPC_OSIZE, "/o" },
+ /* 317 */ { ud_itab__317, UD_TAB__OPC_MODE, "/m" },
+ /* 318 */ { ud_itab__318, UD_TAB__OPC_OSIZE, "/o" },
+ /* 319 */ { ud_itab__319, UD_TAB__OPC_MODE, "/m" },
+ /* 320 */ { ud_itab__320, UD_TAB__OPC_MODE, "/m" },
+ /* 321 */ { ud_itab__321, UD_TAB__OPC_MODE, "/m" },
+ /* 322 */ { ud_itab__322, UD_TAB__OPC_OSIZE, "/o" },
+ /* 323 */ { ud_itab__323, UD_TAB__OPC_MODE, "/m" },
+ /* 324 */ { ud_itab__324, UD_TAB__OPC_MODE, "/m" },
+ /* 325 */ { ud_itab__325, UD_TAB__OPC_MODE, "/m" },
+ /* 326 */ { ud_itab__326, UD_TAB__OPC_OSIZE, "/o" },
+ /* 327 */ { ud_itab__327, UD_TAB__OPC_OSIZE, "/o" },
+ /* 328 */ { ud_itab__328, UD_TAB__OPC_OSIZE, "/o" },
+ /* 329 */ { ud_itab__329, UD_TAB__OPC_OSIZE, "/o" },
+ /* 330 */ { ud_itab__330, UD_TAB__OPC_OSIZE, "/o" },
+ /* 331 */ { ud_itab__331, UD_TAB__OPC_REG, "/reg" },
+ /* 332 */ { ud_itab__332, UD_TAB__OPC_REG, "/reg" },
+ /* 333 */ { ud_itab__333, UD_TAB__OPC_VEX, "/vex" },
+ /* 334 */ { ud_itab__334, UD_TAB__OPC_MODE, "/m" },
+ /* 335 */ { ud_itab__335, UD_TAB__OPC_TABLE, "opctbl" },
+ /* 336 */ { ud_itab__336, UD_TAB__OPC_MOD, "/mod" },
+ /* 337 */ { ud_itab__337, UD_TAB__OPC_MOD, "/mod" },
+ /* 338 */ { ud_itab__338, UD_TAB__OPC_MOD, "/mod" },
+ /* 339 */ { ud_itab__339, UD_TAB__OPC_REG, "/reg" },
+ /* 340 */ { ud_itab__340, UD_TAB__OPC_VEX_L, "/vexl" },
+ /* 341 */ { ud_itab__341, UD_TAB__OPC_TABLE, "opctbl" },
+ /* 342 */ { ud_itab__342, UD_TAB__OPC_MOD, "/mod" },
+ /* 343 */ { ud_itab__343, UD_TAB__OPC_MOD, "/mod" },
+ /* 344 */ { ud_itab__344, UD_TAB__OPC_OSIZE, "/o" },
+ /* 345 */ { ud_itab__345, UD_TAB__OPC_REG, "/reg" },
+ /* 346 */ { ud_itab__346, UD_TAB__OPC_VEX_L, "/vexl" },
+ /* 347 */ { ud_itab__347, UD_TAB__OPC_REG, "/reg" },
+ /* 348 */ { ud_itab__348, UD_TAB__OPC_VEX_L, "/vexl" },
+ /* 349 */ { ud_itab__349, UD_TAB__OPC_REG, "/reg" },
+ /* 350 */ { ud_itab__350, UD_TAB__OPC_VEX_L, "/vexl" },
+ /* 351 */ { ud_itab__351, UD_TAB__OPC_OSIZE, "/o" },
+ /* 352 */ { ud_itab__352, UD_TAB__OPC_VEX_L, "/vexl" },
+ /* 353 */ { ud_itab__353, UD_TAB__OPC_VEX_L, "/vexl" },
+ /* 354 */ { ud_itab__354, UD_TAB__OPC_VEX_L, "/vexl" },
+ /* 355 */ { ud_itab__355, UD_TAB__OPC_VEX_L, "/vexl" },
+ /* 356 */ { ud_itab__356, UD_TAB__OPC_MOD, "/mod" },
+ /* 357 */ { ud_itab__357, UD_TAB__OPC_TABLE, "opctbl" },
+ /* 358 */ { ud_itab__358, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 359 */ { ud_itab__359, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 360 */ { ud_itab__360, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 361 */ { ud_itab__361, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 362 */ { ud_itab__362, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 363 */ { ud_itab__363, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 364 */ { ud_itab__364, UD_TAB__OPC_VEX_L, "/vexl" },
+ /* 365 */ { ud_itab__365, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 366 */ { ud_itab__366, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 367 */ { ud_itab__367, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 368 */ { ud_itab__368, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 369 */ { ud_itab__369, UD_TAB__OPC_TABLE, "opctbl" },
+ /* 370 */ { ud_itab__370, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 371 */ { ud_itab__371, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 372 */ { ud_itab__372, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 373 */ { ud_itab__373, UD_TAB__OPC_VEX_L, "/vexl" },
+ /* 374 */ { ud_itab__374, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 375 */ { ud_itab__375, UD_TAB__OPC_OSIZE, "/o" },
+ /* 376 */ { ud_itab__376, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 377 */ { ud_itab__377, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 378 */ { ud_itab__378, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 379 */ { ud_itab__379, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 380 */ { ud_itab__380, UD_TAB__OPC_VEX_L, "/vexl" },
+ /* 381 */ { ud_itab__381, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 382 */ { ud_itab__382, UD_TAB__OPC_VEX_L, "/vexl" },
+ /* 383 */ { ud_itab__383, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 384 */ { ud_itab__384, UD_TAB__OPC_VEX_L, "/vexl" },
+ /* 385 */ { ud_itab__385, UD_TAB__OPC_MODE, "/m" },
+ /* 386 */ { ud_itab__386, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 387 */ { ud_itab__387, UD_TAB__OPC_VEX_L, "/vexl" },
+ /* 388 */ { ud_itab__388, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 389 */ { ud_itab__389, UD_TAB__OPC_VEX_L, "/vexl" },
+ /* 390 */ { ud_itab__390, UD_TAB__OPC_VEX_L, "/vexl" },
+ /* 391 */ { ud_itab__391, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 392 */ { ud_itab__392, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 393 */ { ud_itab__393, UD_TAB__OPC_VEX_W, "/vexw" },
+ /* 394 */ { ud_itab__394, UD_TAB__OPC_TABLE, "opctbl" },
+ /* 395 */ { ud_itab__395, UD_TAB__OPC_MOD, "/mod" },
+ /* 396 */ { ud_itab__396, UD_TAB__OPC_MOD, "/mod" },
+ /* 397 */ { ud_itab__397, UD_TAB__OPC_MOD, "/mod" },
+ /* 398 */ { ud_itab__398, UD_TAB__OPC_MOD, "/mod" },
+ /* 399 */ { ud_itab__399, UD_TAB__OPC_TABLE, "opctbl" },
+ /* 400 */ { ud_itab__400, UD_TAB__OPC_MOD, "/mod" },
+ /* 401 */ { ud_itab__401, UD_TAB__OPC_MOD, "/mod" },
+ /* 402 */ { ud_itab__402, UD_TAB__OPC_MOD, "/mod" },
+ /* 403 */ { ud_itab__403, UD_TAB__OPC_VEX, "/vex" },
+ /* 404 */ { ud_itab__404, UD_TAB__OPC_MODE, "/m" },
+ /* 405 */ { ud_itab__405, UD_TAB__OPC_REG, "/reg" },
+ /* 406 */ { ud_itab__406, UD_TAB__OPC_REG, "/reg" },
+ /* 407 */ { ud_itab__407, UD_TAB__OPC_MODE, "/m" },
+ /* 408 */ { ud_itab__408, UD_TAB__OPC_OSIZE, "/o" },
+ /* 409 */ { ud_itab__409, UD_TAB__OPC_REG, "/reg" },
+ /* 410 */ { ud_itab__410, UD_TAB__OPC_REG, "/reg" },
+ /* 411 */ { ud_itab__411, UD_TAB__OPC_REG, "/reg" },
+ /* 412 */ { ud_itab__412, UD_TAB__OPC_REG, "/reg" },
+ /* 413 */ { ud_itab__413, UD_TAB__OPC_MODE, "/m" },
+ /* 414 */ { ud_itab__414, UD_TAB__OPC_MODE, "/m" },
+ /* 415 */ { ud_itab__415, UD_TAB__OPC_MODE, "/m" },
+ /* 416 */ { ud_itab__416, UD_TAB__OPC_MOD, "/mod" },
+ /* 417 */ { ud_itab__417, UD_TAB__OPC_REG, "/reg" },
+ /* 418 */ { ud_itab__418, UD_TAB__OPC_X87, "/x87" },
+ /* 419 */ { ud_itab__419, UD_TAB__OPC_MOD, "/mod" },
+ /* 420 */ { ud_itab__420, UD_TAB__OPC_REG, "/reg" },
+ /* 421 */ { ud_itab__421, UD_TAB__OPC_X87, "/x87" },
+ /* 422 */ { ud_itab__422, UD_TAB__OPC_MOD, "/mod" },
+ /* 423 */ { ud_itab__423, UD_TAB__OPC_REG, "/reg" },
+ /* 424 */ { ud_itab__424, UD_TAB__OPC_X87, "/x87" },
+ /* 425 */ { ud_itab__425, UD_TAB__OPC_MOD, "/mod" },
+ /* 426 */ { ud_itab__426, UD_TAB__OPC_REG, "/reg" },
+ /* 427 */ { ud_itab__427, UD_TAB__OPC_X87, "/x87" },
+ /* 428 */ { ud_itab__428, UD_TAB__OPC_MOD, "/mod" },
+ /* 429 */ { ud_itab__429, UD_TAB__OPC_REG, "/reg" },
+ /* 430 */ { ud_itab__430, UD_TAB__OPC_X87, "/x87" },
+ /* 431 */ { ud_itab__431, UD_TAB__OPC_MOD, "/mod" },
+ /* 432 */ { ud_itab__432, UD_TAB__OPC_REG, "/reg" },
+ /* 433 */ { ud_itab__433, UD_TAB__OPC_X87, "/x87" },
+ /* 434 */ { ud_itab__434, UD_TAB__OPC_MOD, "/mod" },
+ /* 435 */ { ud_itab__435, UD_TAB__OPC_REG, "/reg" },
+ /* 436 */ { ud_itab__436, UD_TAB__OPC_X87, "/x87" },
+ /* 437 */ { ud_itab__437, UD_TAB__OPC_MOD, "/mod" },
+ /* 438 */ { ud_itab__438, UD_TAB__OPC_REG, "/reg" },
+ /* 439 */ { ud_itab__439, UD_TAB__OPC_X87, "/x87" },
+ /* 440 */ { ud_itab__440, UD_TAB__OPC_ASIZE, "/a" },
+ /* 441 */ { ud_itab__441, UD_TAB__OPC_MODE, "/m" },
+ /* 442 */ { ud_itab__442, UD_TAB__OPC_REG, "/reg" },
+ /* 443 */ { ud_itab__443, UD_TAB__OPC_REG, "/reg" },
+ /* 444 */ { ud_itab__444, UD_TAB__OPC_REG, "/reg" },
+ /* 445 */ { ud_itab__445, UD_TAB__OPC_REG, "/reg" },
+ /* 446 */ { ud_itab__446, UD_TAB__OPC_MODE, "/m" },
+};
+
+/* itab entry operand definitions (for readability) */
+#define O_AL { OP_AL, SZ_B }
+#define O_AX { OP_AX, SZ_W }
+#define O_Av { OP_A, SZ_V }
+#define O_C { OP_C, SZ_NA }
+#define O_CL { OP_CL, SZ_B }
+#define O_CS { OP_CS, SZ_NA }
+#define O_CX { OP_CX, SZ_W }
+#define O_D { OP_D, SZ_NA }
+#define O_DL { OP_DL, SZ_B }
+#define O_DS { OP_DS, SZ_NA }
+#define O_DX { OP_DX, SZ_W }
+#define O_E { OP_E, SZ_NA }
+#define O_ES { OP_ES, SZ_NA }
+#define O_Eb { OP_E, SZ_B }
+#define O_Ed { OP_E, SZ_D }
+#define O_Eq { OP_E, SZ_Q }
+#define O_Ev { OP_E, SZ_V }
+#define O_Ew { OP_E, SZ_W }
+#define O_Ey { OP_E, SZ_Y }
+#define O_Ez { OP_E, SZ_Z }
+#define O_FS { OP_FS, SZ_NA }
+#define O_Fv { OP_F, SZ_V }
+#define O_G { OP_G, SZ_NA }
+#define O_GS { OP_GS, SZ_NA }
+#define O_Gb { OP_G, SZ_B }
+#define O_Gd { OP_G, SZ_D }
+#define O_Gq { OP_G, SZ_Q }
+#define O_Gv { OP_G, SZ_V }
+#define O_Gw { OP_G, SZ_W }
+#define O_Gy { OP_G, SZ_Y }
+#define O_Gz { OP_G, SZ_Z }
+#define O_H { OP_H, SZ_X }
+#define O_Hqq { OP_H, SZ_QQ }
+#define O_Hx { OP_H, SZ_X }
+#define O_I1 { OP_I1, SZ_NA }
+#define O_I3 { OP_I3, SZ_NA }
+#define O_Ib { OP_I, SZ_B }
+#define O_Iv { OP_I, SZ_V }
+#define O_Iw { OP_I, SZ_W }
+#define O_Iz { OP_I, SZ_Z }
+#define O_Jb { OP_J, SZ_B }
+#define O_Jv { OP_J, SZ_V }
+#define O_Jz { OP_J, SZ_Z }
+#define O_L { OP_L, SZ_O }
+#define O_Lx { OP_L, SZ_X }
+#define O_M { OP_M, SZ_NA }
+#define O_Mb { OP_M, SZ_B }
+#define O_MbRd { OP_MR, SZ_BD }
+#define O_MbRv { OP_MR, SZ_BV }
+#define O_Md { OP_M, SZ_D }
+#define O_MdRy { OP_MR, SZ_DY }
+#define O_MdU { OP_MU, SZ_DO }
+#define O_Mdq { OP_M, SZ_DQ }
+#define O_Mo { OP_M, SZ_O }
+#define O_Mq { OP_M, SZ_Q }
+#define O_MqU { OP_MU, SZ_QO }
+#define O_Ms { OP_M, SZ_W }
+#define O_Mt { OP_M, SZ_T }
+#define O_Mv { OP_M, SZ_V }
+#define O_Mw { OP_M, SZ_W }
+#define O_MwRd { OP_MR, SZ_WD }
+#define O_MwRv { OP_MR, SZ_WV }
+#define O_MwRy { OP_MR, SZ_WY }
+#define O_MwU { OP_MU, SZ_WO }
+#define O_N { OP_N, SZ_Q }
+#define O_NONE { OP_NONE, SZ_NA }
+#define O_Ob { OP_O, SZ_B }
+#define O_Ov { OP_O, SZ_V }
+#define O_Ow { OP_O, SZ_W }
+#define O_P { OP_P, SZ_Q }
+#define O_Q { OP_Q, SZ_Q }
+#define O_R { OP_R, SZ_RDQ }
+#define O_R0b { OP_R0, SZ_B }
+#define O_R0v { OP_R0, SZ_V }
+#define O_R0w { OP_R0, SZ_W }
+#define O_R0y { OP_R0, SZ_Y }
+#define O_R0z { OP_R0, SZ_Z }
+#define O_R1b { OP_R1, SZ_B }
+#define O_R1v { OP_R1, SZ_V }
+#define O_R1w { OP_R1, SZ_W }
+#define O_R1y { OP_R1, SZ_Y }
+#define O_R1z { OP_R1, SZ_Z }
+#define O_R2b { OP_R2, SZ_B }
+#define O_R2v { OP_R2, SZ_V }
+#define O_R2w { OP_R2, SZ_W }
+#define O_R2y { OP_R2, SZ_Y }
+#define O_R2z { OP_R2, SZ_Z }
+#define O_R3b { OP_R3, SZ_B }
+#define O_R3v { OP_R3, SZ_V }
+#define O_R3w { OP_R3, SZ_W }
+#define O_R3y { OP_R3, SZ_Y }
+#define O_R3z { OP_R3, SZ_Z }
+#define O_R4b { OP_R4, SZ_B }
+#define O_R4v { OP_R4, SZ_V }
+#define O_R4w { OP_R4, SZ_W }
+#define O_R4y { OP_R4, SZ_Y }
+#define O_R4z { OP_R4, SZ_Z }
+#define O_R5b { OP_R5, SZ_B }
+#define O_R5v { OP_R5, SZ_V }
+#define O_R5w { OP_R5, SZ_W }
+#define O_R5y { OP_R5, SZ_Y }
+#define O_R5z { OP_R5, SZ_Z }
+#define O_R6b { OP_R6, SZ_B }
+#define O_R6v { OP_R6, SZ_V }
+#define O_R6w { OP_R6, SZ_W }
+#define O_R6y { OP_R6, SZ_Y }
+#define O_R6z { OP_R6, SZ_Z }
+#define O_R7b { OP_R7, SZ_B }
+#define O_R7v { OP_R7, SZ_V }
+#define O_R7w { OP_R7, SZ_W }
+#define O_R7y { OP_R7, SZ_Y }
+#define O_R7z { OP_R7, SZ_Z }
+#define O_S { OP_S, SZ_W }
+#define O_SS { OP_SS, SZ_NA }
+#define O_ST0 { OP_ST0, SZ_NA }
+#define O_ST1 { OP_ST1, SZ_NA }
+#define O_ST2 { OP_ST2, SZ_NA }
+#define O_ST3 { OP_ST3, SZ_NA }
+#define O_ST4 { OP_ST4, SZ_NA }
+#define O_ST5 { OP_ST5, SZ_NA }
+#define O_ST6 { OP_ST6, SZ_NA }
+#define O_ST7 { OP_ST7, SZ_NA }
+#define O_U { OP_U, SZ_O }
+#define O_Ux { OP_U, SZ_X }
+#define O_V { OP_V, SZ_DQ }
+#define O_Vdq { OP_V, SZ_DQ }
+#define O_Vqq { OP_V, SZ_QQ }
+#define O_Vsd { OP_V, SZ_Q }
+#define O_Vx { OP_V, SZ_X }
+#define O_W { OP_W, SZ_DQ }
+#define O_Wdq { OP_W, SZ_DQ }
+#define O_Wqq { OP_W, SZ_QQ }
+#define O_Wsd { OP_W, SZ_Q }
+#define O_Wx { OP_W, SZ_X }
+#define O_eAX { OP_eAX, SZ_Z }
+#define O_eCX { OP_eCX, SZ_Z }
+#define O_eDX { OP_eDX, SZ_Z }
+#define O_rAX { OP_rAX, SZ_V }
+#define O_rCX { OP_rCX, SZ_V }
+#define O_rDX { OP_rDX, SZ_V }
+#define O_sIb { OP_sI, SZ_B }
+#define O_sIv { OP_sI, SZ_V }
+#define O_sIz { OP_sI, SZ_Z }
+
+struct ud_itab_entry ud_itab[] = {
+ /* 0000 */ { UD_Iinvalid, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0001 */ { UD_Iaaa, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0002 */ { UD_Iaad, O_Ib, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0003 */ { UD_Iaam, O_Ib, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0004 */ { UD_Iaas, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0005 */ { UD_Iadc, O_Eb, O_Gb, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0006 */ { UD_Iadc, O_Ev, O_Gv, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0007 */ { UD_Iadc, O_Gb, O_Eb, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0008 */ { UD_Iadc, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0009 */ { UD_Iadc, O_AL, O_Ib, O_NONE, O_NONE, P_none },
+ /* 0010 */ { UD_Iadc, O_rAX, O_sIz, O_NONE, O_NONE, P_oso|P_rexw },
+ /* 0011 */ { UD_Iadc, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0012 */ { UD_Iadc, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_inv64 },
+ /* 0013 */ { UD_Iadc, O_Ev, O_sIz, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0014 */ { UD_Iadc, O_Ev, O_sIb, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0015 */ { UD_Iadd, O_Eb, O_Gb, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0016 */ { UD_Iadd, O_Ev, O_Gv, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0017 */ { UD_Iadd, O_Gb, O_Eb, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0018 */ { UD_Iadd, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0019 */ { UD_Iadd, O_AL, O_Ib, O_NONE, O_NONE, P_none },
+ /* 0020 */ { UD_Iadd, O_rAX, O_sIz, O_NONE, O_NONE, P_oso|P_rexw },
+ /* 0021 */ { UD_Iadd, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0022 */ { UD_Iadd, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_inv64 },
+ /* 0023 */ { UD_Iadd, O_Ev, O_sIz, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0024 */ { UD_Iadd, O_Ev, O_sIb, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0025 */ { UD_Iaddpd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0026 */ { UD_Ivaddpd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0027 */ { UD_Iaddps, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0028 */ { UD_Ivaddps, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0029 */ { UD_Iaddsd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0030 */ { UD_Ivaddsd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0031 */ { UD_Iaddss, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0032 */ { UD_Ivaddss, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0033 */ { UD_Iaddsubpd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0034 */ { UD_Ivaddsubpd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0035 */ { UD_Iaddsubps, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0036 */ { UD_Ivaddsubps, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0037 */ { UD_Iaesdec, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0038 */ { UD_Ivaesdec, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0039 */ { UD_Iaesdeclast, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0040 */ { UD_Ivaesdeclast, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0041 */ { UD_Iaesenc, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0042 */ { UD_Ivaesenc, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0043 */ { UD_Iaesenclast, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0044 */ { UD_Ivaesenclast, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0045 */ { UD_Iaesimc, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0046 */ { UD_Ivaesimc, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0047 */ { UD_Iaeskeygenassist, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0048 */ { UD_Ivaeskeygenassist, O_Vx, O_Wx, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0049 */ { UD_Iand, O_Eb, O_Gb, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0050 */ { UD_Iand, O_Ev, O_Gv, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0051 */ { UD_Iand, O_Gb, O_Eb, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0052 */ { UD_Iand, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0053 */ { UD_Iand, O_AL, O_Ib, O_NONE, O_NONE, P_none },
+ /* 0054 */ { UD_Iand, O_rAX, O_sIz, O_NONE, O_NONE, P_oso|P_rexw },
+ /* 0055 */ { UD_Iand, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0056 */ { UD_Iand, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_inv64 },
+ /* 0057 */ { UD_Iand, O_Ev, O_sIz, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0058 */ { UD_Iand, O_Ev, O_sIb, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0059 */ { UD_Iandpd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0060 */ { UD_Ivandpd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0061 */ { UD_Iandps, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0062 */ { UD_Ivandps, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0063 */ { UD_Iandnpd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0064 */ { UD_Ivandnpd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0065 */ { UD_Iandnps, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0066 */ { UD_Ivandnps, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0067 */ { UD_Iarpl, O_Ew, O_Gw, O_NONE, O_NONE, P_aso },
+ /* 0068 */ { UD_Imovsxd, O_Gq, O_Ed, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexx|P_rexr|P_rexb },
+ /* 0069 */ { UD_Icall, O_Ev, O_NONE, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0070 */ { UD_Icall, O_Eq, O_NONE, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb|P_def64 },
+ /* 0071 */ { UD_Icall, O_Fv, O_NONE, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0072 */ { UD_Icall, O_Jz, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 0073 */ { UD_Icall, O_Av, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 0074 */ { UD_Icbw, O_NONE, O_NONE, O_NONE, O_NONE, P_oso|P_rexw },
+ /* 0075 */ { UD_Icwde, O_NONE, O_NONE, O_NONE, O_NONE, P_oso|P_rexw },
+ /* 0076 */ { UD_Icdqe, O_NONE, O_NONE, O_NONE, O_NONE, P_oso|P_rexw },
+ /* 0077 */ { UD_Iclc, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0078 */ { UD_Icld, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0079 */ { UD_Iclflush, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0080 */ { UD_Iclgi, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0081 */ { UD_Icli, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0082 */ { UD_Iclts, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0083 */ { UD_Icmc, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0084 */ { UD_Icmovo, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0085 */ { UD_Icmovno, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0086 */ { UD_Icmovb, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0087 */ { UD_Icmovae, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0088 */ { UD_Icmovz, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0089 */ { UD_Icmovnz, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0090 */ { UD_Icmovbe, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0091 */ { UD_Icmova, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0092 */ { UD_Icmovs, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0093 */ { UD_Icmovns, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0094 */ { UD_Icmovp, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0095 */ { UD_Icmovnp, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0096 */ { UD_Icmovl, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0097 */ { UD_Icmovge, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0098 */ { UD_Icmovle, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0099 */ { UD_Icmovg, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0100 */ { UD_Icmp, O_Eb, O_Gb, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0101 */ { UD_Icmp, O_Ev, O_Gv, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0102 */ { UD_Icmp, O_Gb, O_Eb, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0103 */ { UD_Icmp, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0104 */ { UD_Icmp, O_AL, O_Ib, O_NONE, O_NONE, P_none },
+ /* 0105 */ { UD_Icmp, O_rAX, O_sIz, O_NONE, O_NONE, P_oso|P_rexw },
+ /* 0106 */ { UD_Icmp, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0107 */ { UD_Icmp, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_inv64 },
+ /* 0108 */ { UD_Icmp, O_Ev, O_sIz, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0109 */ { UD_Icmp, O_Ev, O_sIb, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0110 */ { UD_Icmppd, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0111 */ { UD_Ivcmppd, O_Vx, O_Hx, O_Wx, O_Ib, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0112 */ { UD_Icmpps, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0113 */ { UD_Ivcmpps, O_Vx, O_Hx, O_Wx, O_Ib, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0114 */ { UD_Icmpsb, O_NONE, O_NONE, O_NONE, O_NONE, P_strz|P_seg },
+ /* 0115 */ { UD_Icmpsw, O_NONE, O_NONE, O_NONE, O_NONE, P_strz|P_oso|P_rexw|P_seg },
+ /* 0116 */ { UD_Icmpsd, O_NONE, O_NONE, O_NONE, O_NONE, P_strz|P_oso|P_rexw|P_seg },
+ /* 0117 */ { UD_Icmpsd, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0118 */ { UD_Ivcmpsd, O_Vx, O_Hx, O_Wx, O_Ib, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0119 */ { UD_Icmpsq, O_NONE, O_NONE, O_NONE, O_NONE, P_strz|P_oso|P_rexw|P_seg },
+ /* 0120 */ { UD_Icmpss, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0121 */ { UD_Ivcmpss, O_Vx, O_Hx, O_Wx, O_Ib, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0122 */ { UD_Icmpxchg, O_Eb, O_Gb, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0123 */ { UD_Icmpxchg, O_Ev, O_Gv, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0124 */ { UD_Icmpxchg8b, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0125 */ { UD_Icmpxchg8b, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0126 */ { UD_Icmpxchg16b, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0127 */ { UD_Icomisd, O_Vsd, O_Wsd, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0128 */ { UD_Ivcomisd, O_Vsd, O_Wsd, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0129 */ { UD_Icomiss, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0130 */ { UD_Ivcomiss, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0131 */ { UD_Icpuid, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0132 */ { UD_Icvtdq2pd, O_V, O_Wdq, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0133 */ { UD_Ivcvtdq2pd, O_Vx, O_Wdq, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0134 */ { UD_Icvtdq2ps, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0135 */ { UD_Ivcvtdq2ps, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0136 */ { UD_Icvtpd2dq, O_Vdq, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0137 */ { UD_Ivcvtpd2dq, O_Vdq, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0138 */ { UD_Icvtpd2pi, O_P, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0139 */ { UD_Icvtpd2ps, O_Vdq, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0140 */ { UD_Ivcvtpd2ps, O_Vdq, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0141 */ { UD_Icvtpi2ps, O_V, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0142 */ { UD_Icvtpi2pd, O_V, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0143 */ { UD_Icvtps2dq, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0144 */ { UD_Ivcvtps2dq, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0145 */ { UD_Icvtps2pd, O_V, O_Wdq, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0146 */ { UD_Ivcvtps2pd, O_Vx, O_Wdq, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0147 */ { UD_Icvtps2pi, O_P, O_MqU, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0148 */ { UD_Icvtsd2si, O_Gy, O_MqU, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0149 */ { UD_Ivcvtsd2si, O_Gy, O_MqU, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0150 */ { UD_Icvtsd2ss, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0151 */ { UD_Ivcvtsd2ss, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0152 */ { UD_Icvtsi2sd, O_V, O_Ey, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0153 */ { UD_Ivcvtsi2sd, O_Vx, O_Hx, O_Ey, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0154 */ { UD_Icvtsi2ss, O_V, O_Ey, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0155 */ { UD_Ivcvtsi2ss, O_Vx, O_Hx, O_Ey, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0156 */ { UD_Icvtss2sd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0157 */ { UD_Ivcvtss2sd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0158 */ { UD_Icvtss2si, O_Gy, O_MdU, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0159 */ { UD_Ivcvtss2si, O_Gy, O_MdU, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0160 */ { UD_Icvttpd2dq, O_Vdq, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0161 */ { UD_Ivcvttpd2dq, O_Vdq, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0162 */ { UD_Icvttpd2pi, O_P, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0163 */ { UD_Icvttps2dq, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0164 */ { UD_Ivcvttps2dq, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0165 */ { UD_Icvttps2pi, O_P, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0166 */ { UD_Icvttsd2si, O_Gy, O_MqU, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0167 */ { UD_Ivcvttsd2si, O_Gy, O_MqU, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0168 */ { UD_Icvttss2si, O_Gy, O_MdU, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0169 */ { UD_Ivcvttss2si, O_Gy, O_MdU, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0170 */ { UD_Icwd, O_NONE, O_NONE, O_NONE, O_NONE, P_oso|P_rexw },
+ /* 0171 */ { UD_Icdq, O_NONE, O_NONE, O_NONE, O_NONE, P_oso|P_rexw },
+ /* 0172 */ { UD_Icqo, O_NONE, O_NONE, O_NONE, O_NONE, P_oso|P_rexw },
+ /* 0173 */ { UD_Idaa, O_NONE, O_NONE, O_NONE, O_NONE, P_inv64 },
+ /* 0174 */ { UD_Idas, O_NONE, O_NONE, O_NONE, O_NONE, P_inv64 },
+ /* 0175 */ { UD_Idec, O_R0z, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 0176 */ { UD_Idec, O_R1z, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 0177 */ { UD_Idec, O_R2z, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 0178 */ { UD_Idec, O_R3z, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 0179 */ { UD_Idec, O_R4z, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 0180 */ { UD_Idec, O_R5z, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 0181 */ { UD_Idec, O_R6z, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 0182 */ { UD_Idec, O_R7z, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 0183 */ { UD_Idec, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0184 */ { UD_Idec, O_Ev, O_NONE, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0185 */ { UD_Idiv, O_Ev, O_NONE, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0186 */ { UD_Idiv, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0187 */ { UD_Idivpd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0188 */ { UD_Ivdivpd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0189 */ { UD_Idivps, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0190 */ { UD_Ivdivps, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0191 */ { UD_Idivsd, O_V, O_MqU, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0192 */ { UD_Ivdivsd, O_Vx, O_Hx, O_MqU, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0193 */ { UD_Idivss, O_V, O_MdU, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0194 */ { UD_Ivdivss, O_Vx, O_Hx, O_MdU, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0195 */ { UD_Idppd, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0196 */ { UD_Ivdppd, O_Vx, O_Hx, O_Wx, O_Ib, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0197 */ { UD_Idpps, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0198 */ { UD_Ivdpps, O_Vx, O_Hx, O_Wx, O_Ib, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0199 */ { UD_Iemms, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0200 */ { UD_Ienter, O_Iw, O_Ib, O_NONE, O_NONE, P_def64 },
+ /* 0201 */ { UD_Iextractps, O_MdRy, O_V, O_Ib, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 0202 */ { UD_Ivextractps, O_MdRy, O_Vx, O_Ib, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 0203 */ { UD_If2xm1, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0204 */ { UD_Ifabs, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0205 */ { UD_Ifadd, O_Mq, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0206 */ { UD_Ifadd, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0207 */ { UD_Ifadd, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0208 */ { UD_Ifadd, O_ST1, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0209 */ { UD_Ifadd, O_ST2, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0210 */ { UD_Ifadd, O_ST3, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0211 */ { UD_Ifadd, O_ST4, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0212 */ { UD_Ifadd, O_ST5, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0213 */ { UD_Ifadd, O_ST6, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0214 */ { UD_Ifadd, O_ST7, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0215 */ { UD_Ifadd, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0216 */ { UD_Ifadd, O_ST0, O_ST1, O_NONE, O_NONE, P_none },
+ /* 0217 */ { UD_Ifadd, O_ST0, O_ST2, O_NONE, O_NONE, P_none },
+ /* 0218 */ { UD_Ifadd, O_ST0, O_ST3, O_NONE, O_NONE, P_none },
+ /* 0219 */ { UD_Ifadd, O_ST0, O_ST4, O_NONE, O_NONE, P_none },
+ /* 0220 */ { UD_Ifadd, O_ST0, O_ST5, O_NONE, O_NONE, P_none },
+ /* 0221 */ { UD_Ifadd, O_ST0, O_ST6, O_NONE, O_NONE, P_none },
+ /* 0222 */ { UD_Ifadd, O_ST0, O_ST7, O_NONE, O_NONE, P_none },
+ /* 0223 */ { UD_Ifaddp, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0224 */ { UD_Ifaddp, O_ST1, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0225 */ { UD_Ifaddp, O_ST2, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0226 */ { UD_Ifaddp, O_ST3, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0227 */ { UD_Ifaddp, O_ST4, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0228 */ { UD_Ifaddp, O_ST5, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0229 */ { UD_Ifaddp, O_ST6, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0230 */ { UD_Ifaddp, O_ST7, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0231 */ { UD_Ifbld, O_Mt, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0232 */ { UD_Ifbstp, O_Mt, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0233 */ { UD_Ifchs, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0234 */ { UD_Ifclex, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0235 */ { UD_Ifcmovb, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0236 */ { UD_Ifcmovb, O_ST0, O_ST1, O_NONE, O_NONE, P_none },
+ /* 0237 */ { UD_Ifcmovb, O_ST0, O_ST2, O_NONE, O_NONE, P_none },
+ /* 0238 */ { UD_Ifcmovb, O_ST0, O_ST3, O_NONE, O_NONE, P_none },
+ /* 0239 */ { UD_Ifcmovb, O_ST0, O_ST4, O_NONE, O_NONE, P_none },
+ /* 0240 */ { UD_Ifcmovb, O_ST0, O_ST5, O_NONE, O_NONE, P_none },
+ /* 0241 */ { UD_Ifcmovb, O_ST0, O_ST6, O_NONE, O_NONE, P_none },
+ /* 0242 */ { UD_Ifcmovb, O_ST0, O_ST7, O_NONE, O_NONE, P_none },
+ /* 0243 */ { UD_Ifcmove, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0244 */ { UD_Ifcmove, O_ST0, O_ST1, O_NONE, O_NONE, P_none },
+ /* 0245 */ { UD_Ifcmove, O_ST0, O_ST2, O_NONE, O_NONE, P_none },
+ /* 0246 */ { UD_Ifcmove, O_ST0, O_ST3, O_NONE, O_NONE, P_none },
+ /* 0247 */ { UD_Ifcmove, O_ST0, O_ST4, O_NONE, O_NONE, P_none },
+ /* 0248 */ { UD_Ifcmove, O_ST0, O_ST5, O_NONE, O_NONE, P_none },
+ /* 0249 */ { UD_Ifcmove, O_ST0, O_ST6, O_NONE, O_NONE, P_none },
+ /* 0250 */ { UD_Ifcmove, O_ST0, O_ST7, O_NONE, O_NONE, P_none },
+ /* 0251 */ { UD_Ifcmovbe, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0252 */ { UD_Ifcmovbe, O_ST0, O_ST1, O_NONE, O_NONE, P_none },
+ /* 0253 */ { UD_Ifcmovbe, O_ST0, O_ST2, O_NONE, O_NONE, P_none },
+ /* 0254 */ { UD_Ifcmovbe, O_ST0, O_ST3, O_NONE, O_NONE, P_none },
+ /* 0255 */ { UD_Ifcmovbe, O_ST0, O_ST4, O_NONE, O_NONE, P_none },
+ /* 0256 */ { UD_Ifcmovbe, O_ST0, O_ST5, O_NONE, O_NONE, P_none },
+ /* 0257 */ { UD_Ifcmovbe, O_ST0, O_ST6, O_NONE, O_NONE, P_none },
+ /* 0258 */ { UD_Ifcmovbe, O_ST0, O_ST7, O_NONE, O_NONE, P_none },
+ /* 0259 */ { UD_Ifcmovu, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0260 */ { UD_Ifcmovu, O_ST0, O_ST1, O_NONE, O_NONE, P_none },
+ /* 0261 */ { UD_Ifcmovu, O_ST0, O_ST2, O_NONE, O_NONE, P_none },
+ /* 0262 */ { UD_Ifcmovu, O_ST0, O_ST3, O_NONE, O_NONE, P_none },
+ /* 0263 */ { UD_Ifcmovu, O_ST0, O_ST4, O_NONE, O_NONE, P_none },
+ /* 0264 */ { UD_Ifcmovu, O_ST0, O_ST5, O_NONE, O_NONE, P_none },
+ /* 0265 */ { UD_Ifcmovu, O_ST0, O_ST6, O_NONE, O_NONE, P_none },
+ /* 0266 */ { UD_Ifcmovu, O_ST0, O_ST7, O_NONE, O_NONE, P_none },
+ /* 0267 */ { UD_Ifcmovnb, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0268 */ { UD_Ifcmovnb, O_ST0, O_ST1, O_NONE, O_NONE, P_none },
+ /* 0269 */ { UD_Ifcmovnb, O_ST0, O_ST2, O_NONE, O_NONE, P_none },
+ /* 0270 */ { UD_Ifcmovnb, O_ST0, O_ST3, O_NONE, O_NONE, P_none },
+ /* 0271 */ { UD_Ifcmovnb, O_ST0, O_ST4, O_NONE, O_NONE, P_none },
+ /* 0272 */ { UD_Ifcmovnb, O_ST0, O_ST5, O_NONE, O_NONE, P_none },
+ /* 0273 */ { UD_Ifcmovnb, O_ST0, O_ST6, O_NONE, O_NONE, P_none },
+ /* 0274 */ { UD_Ifcmovnb, O_ST0, O_ST7, O_NONE, O_NONE, P_none },
+ /* 0275 */ { UD_Ifcmovne, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0276 */ { UD_Ifcmovne, O_ST0, O_ST1, O_NONE, O_NONE, P_none },
+ /* 0277 */ { UD_Ifcmovne, O_ST0, O_ST2, O_NONE, O_NONE, P_none },
+ /* 0278 */ { UD_Ifcmovne, O_ST0, O_ST3, O_NONE, O_NONE, P_none },
+ /* 0279 */ { UD_Ifcmovne, O_ST0, O_ST4, O_NONE, O_NONE, P_none },
+ /* 0280 */ { UD_Ifcmovne, O_ST0, O_ST5, O_NONE, O_NONE, P_none },
+ /* 0281 */ { UD_Ifcmovne, O_ST0, O_ST6, O_NONE, O_NONE, P_none },
+ /* 0282 */ { UD_Ifcmovne, O_ST0, O_ST7, O_NONE, O_NONE, P_none },
+ /* 0283 */ { UD_Ifcmovnbe, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0284 */ { UD_Ifcmovnbe, O_ST0, O_ST1, O_NONE, O_NONE, P_none },
+ /* 0285 */ { UD_Ifcmovnbe, O_ST0, O_ST2, O_NONE, O_NONE, P_none },
+ /* 0286 */ { UD_Ifcmovnbe, O_ST0, O_ST3, O_NONE, O_NONE, P_none },
+ /* 0287 */ { UD_Ifcmovnbe, O_ST0, O_ST4, O_NONE, O_NONE, P_none },
+ /* 0288 */ { UD_Ifcmovnbe, O_ST0, O_ST5, O_NONE, O_NONE, P_none },
+ /* 0289 */ { UD_Ifcmovnbe, O_ST0, O_ST6, O_NONE, O_NONE, P_none },
+ /* 0290 */ { UD_Ifcmovnbe, O_ST0, O_ST7, O_NONE, O_NONE, P_none },
+ /* 0291 */ { UD_Ifcmovnu, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0292 */ { UD_Ifcmovnu, O_ST0, O_ST1, O_NONE, O_NONE, P_none },
+ /* 0293 */ { UD_Ifcmovnu, O_ST0, O_ST2, O_NONE, O_NONE, P_none },
+ /* 0294 */ { UD_Ifcmovnu, O_ST0, O_ST3, O_NONE, O_NONE, P_none },
+ /* 0295 */ { UD_Ifcmovnu, O_ST0, O_ST4, O_NONE, O_NONE, P_none },
+ /* 0296 */ { UD_Ifcmovnu, O_ST0, O_ST5, O_NONE, O_NONE, P_none },
+ /* 0297 */ { UD_Ifcmovnu, O_ST0, O_ST6, O_NONE, O_NONE, P_none },
+ /* 0298 */ { UD_Ifcmovnu, O_ST0, O_ST7, O_NONE, O_NONE, P_none },
+ /* 0299 */ { UD_Ifucomi, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0300 */ { UD_Ifucomi, O_ST0, O_ST1, O_NONE, O_NONE, P_none },
+ /* 0301 */ { UD_Ifucomi, O_ST0, O_ST2, O_NONE, O_NONE, P_none },
+ /* 0302 */ { UD_Ifucomi, O_ST0, O_ST3, O_NONE, O_NONE, P_none },
+ /* 0303 */ { UD_Ifucomi, O_ST0, O_ST4, O_NONE, O_NONE, P_none },
+ /* 0304 */ { UD_Ifucomi, O_ST0, O_ST5, O_NONE, O_NONE, P_none },
+ /* 0305 */ { UD_Ifucomi, O_ST0, O_ST6, O_NONE, O_NONE, P_none },
+ /* 0306 */ { UD_Ifucomi, O_ST0, O_ST7, O_NONE, O_NONE, P_none },
+ /* 0307 */ { UD_Ifcom, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0308 */ { UD_Ifcom, O_Mq, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0309 */ { UD_Ifcom, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0310 */ { UD_Ifcom, O_ST0, O_ST1, O_NONE, O_NONE, P_none },
+ /* 0311 */ { UD_Ifcom, O_ST0, O_ST2, O_NONE, O_NONE, P_none },
+ /* 0312 */ { UD_Ifcom, O_ST0, O_ST3, O_NONE, O_NONE, P_none },
+ /* 0313 */ { UD_Ifcom, O_ST0, O_ST4, O_NONE, O_NONE, P_none },
+ /* 0314 */ { UD_Ifcom, O_ST0, O_ST5, O_NONE, O_NONE, P_none },
+ /* 0315 */ { UD_Ifcom, O_ST0, O_ST6, O_NONE, O_NONE, P_none },
+ /* 0316 */ { UD_Ifcom, O_ST0, O_ST7, O_NONE, O_NONE, P_none },
+ /* 0317 */ { UD_Ifcom2, O_ST0, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0318 */ { UD_Ifcom2, O_ST1, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0319 */ { UD_Ifcom2, O_ST2, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0320 */ { UD_Ifcom2, O_ST3, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0321 */ { UD_Ifcom2, O_ST4, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0322 */ { UD_Ifcom2, O_ST5, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0323 */ { UD_Ifcom2, O_ST6, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0324 */ { UD_Ifcom2, O_ST7, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0325 */ { UD_Ifcomp3, O_ST0, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0326 */ { UD_Ifcomp3, O_ST1, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0327 */ { UD_Ifcomp3, O_ST2, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0328 */ { UD_Ifcomp3, O_ST3, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0329 */ { UD_Ifcomp3, O_ST4, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0330 */ { UD_Ifcomp3, O_ST5, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0331 */ { UD_Ifcomp3, O_ST6, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0332 */ { UD_Ifcomp3, O_ST7, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0333 */ { UD_Ifcomi, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0334 */ { UD_Ifcomi, O_ST0, O_ST1, O_NONE, O_NONE, P_none },
+ /* 0335 */ { UD_Ifcomi, O_ST0, O_ST2, O_NONE, O_NONE, P_none },
+ /* 0336 */ { UD_Ifcomi, O_ST0, O_ST3, O_NONE, O_NONE, P_none },
+ /* 0337 */ { UD_Ifcomi, O_ST0, O_ST4, O_NONE, O_NONE, P_none },
+ /* 0338 */ { UD_Ifcomi, O_ST0, O_ST5, O_NONE, O_NONE, P_none },
+ /* 0339 */ { UD_Ifcomi, O_ST0, O_ST6, O_NONE, O_NONE, P_none },
+ /* 0340 */ { UD_Ifcomi, O_ST0, O_ST7, O_NONE, O_NONE, P_none },
+ /* 0341 */ { UD_Ifucomip, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0342 */ { UD_Ifucomip, O_ST0, O_ST1, O_NONE, O_NONE, P_none },
+ /* 0343 */ { UD_Ifucomip, O_ST0, O_ST2, O_NONE, O_NONE, P_none },
+ /* 0344 */ { UD_Ifucomip, O_ST0, O_ST3, O_NONE, O_NONE, P_none },
+ /* 0345 */ { UD_Ifucomip, O_ST0, O_ST4, O_NONE, O_NONE, P_none },
+ /* 0346 */ { UD_Ifucomip, O_ST0, O_ST5, O_NONE, O_NONE, P_none },
+ /* 0347 */ { UD_Ifucomip, O_ST0, O_ST6, O_NONE, O_NONE, P_none },
+ /* 0348 */ { UD_Ifucomip, O_ST0, O_ST7, O_NONE, O_NONE, P_none },
+ /* 0349 */ { UD_Ifcomip, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0350 */ { UD_Ifcomip, O_ST0, O_ST1, O_NONE, O_NONE, P_none },
+ /* 0351 */ { UD_Ifcomip, O_ST0, O_ST2, O_NONE, O_NONE, P_none },
+ /* 0352 */ { UD_Ifcomip, O_ST0, O_ST3, O_NONE, O_NONE, P_none },
+ /* 0353 */ { UD_Ifcomip, O_ST0, O_ST4, O_NONE, O_NONE, P_none },
+ /* 0354 */ { UD_Ifcomip, O_ST0, O_ST5, O_NONE, O_NONE, P_none },
+ /* 0355 */ { UD_Ifcomip, O_ST0, O_ST6, O_NONE, O_NONE, P_none },
+ /* 0356 */ { UD_Ifcomip, O_ST0, O_ST7, O_NONE, O_NONE, P_none },
+ /* 0357 */ { UD_Ifcomp, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0358 */ { UD_Ifcomp, O_Mq, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0359 */ { UD_Ifcomp, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0360 */ { UD_Ifcomp, O_ST0, O_ST1, O_NONE, O_NONE, P_none },
+ /* 0361 */ { UD_Ifcomp, O_ST0, O_ST2, O_NONE, O_NONE, P_none },
+ /* 0362 */ { UD_Ifcomp, O_ST0, O_ST3, O_NONE, O_NONE, P_none },
+ /* 0363 */ { UD_Ifcomp, O_ST0, O_ST4, O_NONE, O_NONE, P_none },
+ /* 0364 */ { UD_Ifcomp, O_ST0, O_ST5, O_NONE, O_NONE, P_none },
+ /* 0365 */ { UD_Ifcomp, O_ST0, O_ST6, O_NONE, O_NONE, P_none },
+ /* 0366 */ { UD_Ifcomp, O_ST0, O_ST7, O_NONE, O_NONE, P_none },
+ /* 0367 */ { UD_Ifcomp5, O_ST0, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0368 */ { UD_Ifcomp5, O_ST1, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0369 */ { UD_Ifcomp5, O_ST2, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0370 */ { UD_Ifcomp5, O_ST3, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0371 */ { UD_Ifcomp5, O_ST4, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0372 */ { UD_Ifcomp5, O_ST5, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0373 */ { UD_Ifcomp5, O_ST6, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0374 */ { UD_Ifcomp5, O_ST7, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0375 */ { UD_Ifcompp, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0376 */ { UD_Ifcos, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0377 */ { UD_Ifdecstp, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0378 */ { UD_Ifdiv, O_Mq, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0379 */ { UD_Ifdiv, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0380 */ { UD_Ifdiv, O_ST1, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0381 */ { UD_Ifdiv, O_ST2, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0382 */ { UD_Ifdiv, O_ST3, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0383 */ { UD_Ifdiv, O_ST4, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0384 */ { UD_Ifdiv, O_ST5, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0385 */ { UD_Ifdiv, O_ST6, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0386 */ { UD_Ifdiv, O_ST7, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0387 */ { UD_Ifdiv, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0388 */ { UD_Ifdiv, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0389 */ { UD_Ifdiv, O_ST0, O_ST1, O_NONE, O_NONE, P_none },
+ /* 0390 */ { UD_Ifdiv, O_ST0, O_ST2, O_NONE, O_NONE, P_none },
+ /* 0391 */ { UD_Ifdiv, O_ST0, O_ST3, O_NONE, O_NONE, P_none },
+ /* 0392 */ { UD_Ifdiv, O_ST0, O_ST4, O_NONE, O_NONE, P_none },
+ /* 0393 */ { UD_Ifdiv, O_ST0, O_ST5, O_NONE, O_NONE, P_none },
+ /* 0394 */ { UD_Ifdiv, O_ST0, O_ST6, O_NONE, O_NONE, P_none },
+ /* 0395 */ { UD_Ifdiv, O_ST0, O_ST7, O_NONE, O_NONE, P_none },
+ /* 0396 */ { UD_Ifdivp, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0397 */ { UD_Ifdivp, O_ST1, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0398 */ { UD_Ifdivp, O_ST2, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0399 */ { UD_Ifdivp, O_ST3, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0400 */ { UD_Ifdivp, O_ST4, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0401 */ { UD_Ifdivp, O_ST5, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0402 */ { UD_Ifdivp, O_ST6, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0403 */ { UD_Ifdivp, O_ST7, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0404 */ { UD_Ifdivr, O_Mq, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0405 */ { UD_Ifdivr, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0406 */ { UD_Ifdivr, O_ST1, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0407 */ { UD_Ifdivr, O_ST2, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0408 */ { UD_Ifdivr, O_ST3, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0409 */ { UD_Ifdivr, O_ST4, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0410 */ { UD_Ifdivr, O_ST5, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0411 */ { UD_Ifdivr, O_ST6, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0412 */ { UD_Ifdivr, O_ST7, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0413 */ { UD_Ifdivr, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0414 */ { UD_Ifdivr, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0415 */ { UD_Ifdivr, O_ST0, O_ST1, O_NONE, O_NONE, P_none },
+ /* 0416 */ { UD_Ifdivr, O_ST0, O_ST2, O_NONE, O_NONE, P_none },
+ /* 0417 */ { UD_Ifdivr, O_ST0, O_ST3, O_NONE, O_NONE, P_none },
+ /* 0418 */ { UD_Ifdivr, O_ST0, O_ST4, O_NONE, O_NONE, P_none },
+ /* 0419 */ { UD_Ifdivr, O_ST0, O_ST5, O_NONE, O_NONE, P_none },
+ /* 0420 */ { UD_Ifdivr, O_ST0, O_ST6, O_NONE, O_NONE, P_none },
+ /* 0421 */ { UD_Ifdivr, O_ST0, O_ST7, O_NONE, O_NONE, P_none },
+ /* 0422 */ { UD_Ifdivrp, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0423 */ { UD_Ifdivrp, O_ST1, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0424 */ { UD_Ifdivrp, O_ST2, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0425 */ { UD_Ifdivrp, O_ST3, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0426 */ { UD_Ifdivrp, O_ST4, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0427 */ { UD_Ifdivrp, O_ST5, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0428 */ { UD_Ifdivrp, O_ST6, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0429 */ { UD_Ifdivrp, O_ST7, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0430 */ { UD_Ifemms, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0431 */ { UD_Iffree, O_ST0, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0432 */ { UD_Iffree, O_ST1, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0433 */ { UD_Iffree, O_ST2, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0434 */ { UD_Iffree, O_ST3, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0435 */ { UD_Iffree, O_ST4, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0436 */ { UD_Iffree, O_ST5, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0437 */ { UD_Iffree, O_ST6, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0438 */ { UD_Iffree, O_ST7, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0439 */ { UD_Iffreep, O_ST0, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0440 */ { UD_Iffreep, O_ST1, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0441 */ { UD_Iffreep, O_ST2, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0442 */ { UD_Iffreep, O_ST3, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0443 */ { UD_Iffreep, O_ST4, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0444 */ { UD_Iffreep, O_ST5, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0445 */ { UD_Iffreep, O_ST6, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0446 */ { UD_Iffreep, O_ST7, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0447 */ { UD_Ificom, O_Mw, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0448 */ { UD_Ificom, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0449 */ { UD_Ificomp, O_Mw, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0450 */ { UD_Ificomp, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0451 */ { UD_Ifild, O_Mw, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0452 */ { UD_Ifild, O_Mq, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0453 */ { UD_Ifild, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0454 */ { UD_Ifincstp, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0455 */ { UD_Ifninit, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0456 */ { UD_Ifiadd, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0457 */ { UD_Ifiadd, O_Mw, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0458 */ { UD_Ifidivr, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0459 */ { UD_Ifidivr, O_Mw, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0460 */ { UD_Ifidiv, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0461 */ { UD_Ifidiv, O_Mw, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0462 */ { UD_Ifisub, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0463 */ { UD_Ifisub, O_Mw, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0464 */ { UD_Ifisubr, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0465 */ { UD_Ifisubr, O_Mw, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0466 */ { UD_Ifist, O_Mw, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0467 */ { UD_Ifist, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0468 */ { UD_Ifistp, O_Mw, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0469 */ { UD_Ifistp, O_Mq, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0470 */ { UD_Ifistp, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0471 */ { UD_Ifisttp, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0472 */ { UD_Ifisttp, O_Mq, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0473 */ { UD_Ifisttp, O_Mw, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0474 */ { UD_Ifld, O_Mt, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0475 */ { UD_Ifld, O_Mq, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0476 */ { UD_Ifld, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0477 */ { UD_Ifld, O_ST0, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0478 */ { UD_Ifld, O_ST1, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0479 */ { UD_Ifld, O_ST2, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0480 */ { UD_Ifld, O_ST3, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0481 */ { UD_Ifld, O_ST4, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0482 */ { UD_Ifld, O_ST5, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0483 */ { UD_Ifld, O_ST6, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0484 */ { UD_Ifld, O_ST7, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0485 */ { UD_Ifld1, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0486 */ { UD_Ifldl2t, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0487 */ { UD_Ifldl2e, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0488 */ { UD_Ifldpi, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0489 */ { UD_Ifldlg2, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0490 */ { UD_Ifldln2, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0491 */ { UD_Ifldz, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0492 */ { UD_Ifldcw, O_Mw, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0493 */ { UD_Ifldenv, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0494 */ { UD_Ifmul, O_Mq, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0495 */ { UD_Ifmul, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0496 */ { UD_Ifmul, O_ST1, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0497 */ { UD_Ifmul, O_ST2, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0498 */ { UD_Ifmul, O_ST3, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0499 */ { UD_Ifmul, O_ST4, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0500 */ { UD_Ifmul, O_ST5, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0501 */ { UD_Ifmul, O_ST6, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0502 */ { UD_Ifmul, O_ST7, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0503 */ { UD_Ifmul, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0504 */ { UD_Ifmul, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0505 */ { UD_Ifmul, O_ST0, O_ST1, O_NONE, O_NONE, P_none },
+ /* 0506 */ { UD_Ifmul, O_ST0, O_ST2, O_NONE, O_NONE, P_none },
+ /* 0507 */ { UD_Ifmul, O_ST0, O_ST3, O_NONE, O_NONE, P_none },
+ /* 0508 */ { UD_Ifmul, O_ST0, O_ST4, O_NONE, O_NONE, P_none },
+ /* 0509 */ { UD_Ifmul, O_ST0, O_ST5, O_NONE, O_NONE, P_none },
+ /* 0510 */ { UD_Ifmul, O_ST0, O_ST6, O_NONE, O_NONE, P_none },
+ /* 0511 */ { UD_Ifmul, O_ST0, O_ST7, O_NONE, O_NONE, P_none },
+ /* 0512 */ { UD_Ifmulp, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0513 */ { UD_Ifmulp, O_ST1, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0514 */ { UD_Ifmulp, O_ST2, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0515 */ { UD_Ifmulp, O_ST3, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0516 */ { UD_Ifmulp, O_ST4, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0517 */ { UD_Ifmulp, O_ST5, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0518 */ { UD_Ifmulp, O_ST6, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0519 */ { UD_Ifmulp, O_ST7, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0520 */ { UD_Ifimul, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0521 */ { UD_Ifimul, O_Mw, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0522 */ { UD_Ifnop, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0523 */ { UD_Ifndisi, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0524 */ { UD_Ifneni, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0525 */ { UD_Ifnsetpm, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0526 */ { UD_Ifpatan, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0527 */ { UD_Ifprem, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0528 */ { UD_Ifprem1, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0529 */ { UD_Ifptan, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0530 */ { UD_Ifrndint, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0531 */ { UD_Ifrstor, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0532 */ { UD_Ifrstpm, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0533 */ { UD_Ifnsave, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0534 */ { UD_Ifscale, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0535 */ { UD_Ifsin, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0536 */ { UD_Ifsincos, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0537 */ { UD_Ifsqrt, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0538 */ { UD_Ifstp, O_Mt, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0539 */ { UD_Ifstp, O_Mq, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0540 */ { UD_Ifstp, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0541 */ { UD_Ifstp, O_ST0, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0542 */ { UD_Ifstp, O_ST1, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0543 */ { UD_Ifstp, O_ST2, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0544 */ { UD_Ifstp, O_ST3, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0545 */ { UD_Ifstp, O_ST4, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0546 */ { UD_Ifstp, O_ST5, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0547 */ { UD_Ifstp, O_ST6, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0548 */ { UD_Ifstp, O_ST7, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0549 */ { UD_Ifstp1, O_ST0, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0550 */ { UD_Ifstp1, O_ST1, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0551 */ { UD_Ifstp1, O_ST2, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0552 */ { UD_Ifstp1, O_ST3, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0553 */ { UD_Ifstp1, O_ST4, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0554 */ { UD_Ifstp1, O_ST5, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0555 */ { UD_Ifstp1, O_ST6, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0556 */ { UD_Ifstp1, O_ST7, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0557 */ { UD_Ifstp8, O_ST0, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0558 */ { UD_Ifstp8, O_ST1, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0559 */ { UD_Ifstp8, O_ST2, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0560 */ { UD_Ifstp8, O_ST3, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0561 */ { UD_Ifstp8, O_ST4, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0562 */ { UD_Ifstp8, O_ST5, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0563 */ { UD_Ifstp8, O_ST6, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0564 */ { UD_Ifstp8, O_ST7, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0565 */ { UD_Ifstp9, O_ST0, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0566 */ { UD_Ifstp9, O_ST1, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0567 */ { UD_Ifstp9, O_ST2, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0568 */ { UD_Ifstp9, O_ST3, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0569 */ { UD_Ifstp9, O_ST4, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0570 */ { UD_Ifstp9, O_ST5, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0571 */ { UD_Ifstp9, O_ST6, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0572 */ { UD_Ifstp9, O_ST7, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0573 */ { UD_Ifst, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0574 */ { UD_Ifst, O_Mq, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0575 */ { UD_Ifst, O_ST0, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0576 */ { UD_Ifst, O_ST1, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0577 */ { UD_Ifst, O_ST2, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0578 */ { UD_Ifst, O_ST3, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0579 */ { UD_Ifst, O_ST4, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0580 */ { UD_Ifst, O_ST5, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0581 */ { UD_Ifst, O_ST6, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0582 */ { UD_Ifst, O_ST7, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0583 */ { UD_Ifnstcw, O_Mw, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0584 */ { UD_Ifnstenv, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0585 */ { UD_Ifnstsw, O_Mw, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0586 */ { UD_Ifnstsw, O_AX, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0587 */ { UD_Ifsub, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0588 */ { UD_Ifsub, O_Mq, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0589 */ { UD_Ifsub, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0590 */ { UD_Ifsub, O_ST0, O_ST1, O_NONE, O_NONE, P_none },
+ /* 0591 */ { UD_Ifsub, O_ST0, O_ST2, O_NONE, O_NONE, P_none },
+ /* 0592 */ { UD_Ifsub, O_ST0, O_ST3, O_NONE, O_NONE, P_none },
+ /* 0593 */ { UD_Ifsub, O_ST0, O_ST4, O_NONE, O_NONE, P_none },
+ /* 0594 */ { UD_Ifsub, O_ST0, O_ST5, O_NONE, O_NONE, P_none },
+ /* 0595 */ { UD_Ifsub, O_ST0, O_ST6, O_NONE, O_NONE, P_none },
+ /* 0596 */ { UD_Ifsub, O_ST0, O_ST7, O_NONE, O_NONE, P_none },
+ /* 0597 */ { UD_Ifsub, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0598 */ { UD_Ifsub, O_ST1, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0599 */ { UD_Ifsub, O_ST2, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0600 */ { UD_Ifsub, O_ST3, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0601 */ { UD_Ifsub, O_ST4, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0602 */ { UD_Ifsub, O_ST5, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0603 */ { UD_Ifsub, O_ST6, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0604 */ { UD_Ifsub, O_ST7, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0605 */ { UD_Ifsubp, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0606 */ { UD_Ifsubp, O_ST1, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0607 */ { UD_Ifsubp, O_ST2, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0608 */ { UD_Ifsubp, O_ST3, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0609 */ { UD_Ifsubp, O_ST4, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0610 */ { UD_Ifsubp, O_ST5, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0611 */ { UD_Ifsubp, O_ST6, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0612 */ { UD_Ifsubp, O_ST7, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0613 */ { UD_Ifsubr, O_Mq, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0614 */ { UD_Ifsubr, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0615 */ { UD_Ifsubr, O_ST0, O_ST1, O_NONE, O_NONE, P_none },
+ /* 0616 */ { UD_Ifsubr, O_ST0, O_ST2, O_NONE, O_NONE, P_none },
+ /* 0617 */ { UD_Ifsubr, O_ST0, O_ST3, O_NONE, O_NONE, P_none },
+ /* 0618 */ { UD_Ifsubr, O_ST0, O_ST4, O_NONE, O_NONE, P_none },
+ /* 0619 */ { UD_Ifsubr, O_ST0, O_ST5, O_NONE, O_NONE, P_none },
+ /* 0620 */ { UD_Ifsubr, O_ST0, O_ST6, O_NONE, O_NONE, P_none },
+ /* 0621 */ { UD_Ifsubr, O_ST0, O_ST7, O_NONE, O_NONE, P_none },
+ /* 0622 */ { UD_Ifsubr, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0623 */ { UD_Ifsubr, O_ST1, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0624 */ { UD_Ifsubr, O_ST2, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0625 */ { UD_Ifsubr, O_ST3, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0626 */ { UD_Ifsubr, O_ST4, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0627 */ { UD_Ifsubr, O_ST5, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0628 */ { UD_Ifsubr, O_ST6, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0629 */ { UD_Ifsubr, O_ST7, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0630 */ { UD_Ifsubr, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0631 */ { UD_Ifsubrp, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0632 */ { UD_Ifsubrp, O_ST1, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0633 */ { UD_Ifsubrp, O_ST2, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0634 */ { UD_Ifsubrp, O_ST3, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0635 */ { UD_Ifsubrp, O_ST4, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0636 */ { UD_Ifsubrp, O_ST5, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0637 */ { UD_Ifsubrp, O_ST6, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0638 */ { UD_Ifsubrp, O_ST7, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0639 */ { UD_Iftst, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0640 */ { UD_Ifucom, O_ST0, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0641 */ { UD_Ifucom, O_ST1, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0642 */ { UD_Ifucom, O_ST2, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0643 */ { UD_Ifucom, O_ST3, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0644 */ { UD_Ifucom, O_ST4, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0645 */ { UD_Ifucom, O_ST5, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0646 */ { UD_Ifucom, O_ST6, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0647 */ { UD_Ifucom, O_ST7, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0648 */ { UD_Ifucomp, O_ST0, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0649 */ { UD_Ifucomp, O_ST1, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0650 */ { UD_Ifucomp, O_ST2, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0651 */ { UD_Ifucomp, O_ST3, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0652 */ { UD_Ifucomp, O_ST4, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0653 */ { UD_Ifucomp, O_ST5, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0654 */ { UD_Ifucomp, O_ST6, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0655 */ { UD_Ifucomp, O_ST7, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0656 */ { UD_Ifucompp, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0657 */ { UD_Ifxam, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0658 */ { UD_Ifxch, O_ST0, O_ST0, O_NONE, O_NONE, P_none },
+ /* 0659 */ { UD_Ifxch, O_ST0, O_ST1, O_NONE, O_NONE, P_none },
+ /* 0660 */ { UD_Ifxch, O_ST0, O_ST2, O_NONE, O_NONE, P_none },
+ /* 0661 */ { UD_Ifxch, O_ST0, O_ST3, O_NONE, O_NONE, P_none },
+ /* 0662 */ { UD_Ifxch, O_ST0, O_ST4, O_NONE, O_NONE, P_none },
+ /* 0663 */ { UD_Ifxch, O_ST0, O_ST5, O_NONE, O_NONE, P_none },
+ /* 0664 */ { UD_Ifxch, O_ST0, O_ST6, O_NONE, O_NONE, P_none },
+ /* 0665 */ { UD_Ifxch, O_ST0, O_ST7, O_NONE, O_NONE, P_none },
+ /* 0666 */ { UD_Ifxch4, O_ST0, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0667 */ { UD_Ifxch4, O_ST1, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0668 */ { UD_Ifxch4, O_ST2, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0669 */ { UD_Ifxch4, O_ST3, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0670 */ { UD_Ifxch4, O_ST4, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0671 */ { UD_Ifxch4, O_ST5, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0672 */ { UD_Ifxch4, O_ST6, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0673 */ { UD_Ifxch4, O_ST7, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0674 */ { UD_Ifxch7, O_ST0, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0675 */ { UD_Ifxch7, O_ST1, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0676 */ { UD_Ifxch7, O_ST2, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0677 */ { UD_Ifxch7, O_ST3, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0678 */ { UD_Ifxch7, O_ST4, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0679 */ { UD_Ifxch7, O_ST5, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0680 */ { UD_Ifxch7, O_ST6, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0681 */ { UD_Ifxch7, O_ST7, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0682 */ { UD_Ifxrstor, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0683 */ { UD_Ifxsave, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0684 */ { UD_Ifxtract, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0685 */ { UD_Ifyl2x, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0686 */ { UD_Ifyl2xp1, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0687 */ { UD_Ihlt, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0688 */ { UD_Iidiv, O_Ev, O_NONE, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0689 */ { UD_Iidiv, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0690 */ { UD_Iin, O_AL, O_Ib, O_NONE, O_NONE, P_none },
+ /* 0691 */ { UD_Iin, O_eAX, O_Ib, O_NONE, O_NONE, P_oso },
+ /* 0692 */ { UD_Iin, O_AL, O_DX, O_NONE, O_NONE, P_none },
+ /* 0693 */ { UD_Iin, O_eAX, O_DX, O_NONE, O_NONE, P_oso },
+ /* 0694 */ { UD_Iimul, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0695 */ { UD_Iimul, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0696 */ { UD_Iimul, O_Ev, O_NONE, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0697 */ { UD_Iimul, O_Gv, O_Ev, O_Iz, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0698 */ { UD_Iimul, O_Gv, O_Ev, O_sIb, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0699 */ { UD_Iinc, O_R0z, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 0700 */ { UD_Iinc, O_R1z, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 0701 */ { UD_Iinc, O_R2z, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 0702 */ { UD_Iinc, O_R3z, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 0703 */ { UD_Iinc, O_R4z, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 0704 */ { UD_Iinc, O_R5z, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 0705 */ { UD_Iinc, O_R6z, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 0706 */ { UD_Iinc, O_R7z, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 0707 */ { UD_Iinc, O_Ev, O_NONE, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0708 */ { UD_Iinc, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0709 */ { UD_Iinsb, O_NONE, O_NONE, O_NONE, O_NONE, P_str|P_seg },
+ /* 0710 */ { UD_Iinsw, O_NONE, O_NONE, O_NONE, O_NONE, P_str|P_oso|P_seg },
+ /* 0711 */ { UD_Iinsd, O_NONE, O_NONE, O_NONE, O_NONE, P_str|P_oso|P_seg },
+ /* 0712 */ { UD_Iint1, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0713 */ { UD_Iint3, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0714 */ { UD_Iint, O_Ib, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0715 */ { UD_Iinto, O_NONE, O_NONE, O_NONE, O_NONE, P_inv64 },
+ /* 0716 */ { UD_Iinvd, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0717 */ { UD_Iinvept, O_Gd, O_Mo, O_NONE, O_NONE, P_none },
+ /* 0718 */ { UD_Iinvept, O_Gq, O_Mo, O_NONE, O_NONE, P_none },
+ /* 0719 */ { UD_Iinvlpg, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0720 */ { UD_Iinvlpga, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0721 */ { UD_Iinvvpid, O_Gd, O_Mo, O_NONE, O_NONE, P_none },
+ /* 0722 */ { UD_Iinvvpid, O_Gq, O_Mo, O_NONE, O_NONE, P_none },
+ /* 0723 */ { UD_Iiretw, O_NONE, O_NONE, O_NONE, O_NONE, P_oso|P_rexw },
+ /* 0724 */ { UD_Iiretd, O_NONE, O_NONE, O_NONE, O_NONE, P_oso|P_rexw },
+ /* 0725 */ { UD_Iiretq, O_NONE, O_NONE, O_NONE, O_NONE, P_oso|P_rexw },
+ /* 0726 */ { UD_Ijo, O_Jb, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0727 */ { UD_Ijo, O_Jz, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 0728 */ { UD_Ijno, O_Jb, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0729 */ { UD_Ijno, O_Jz, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 0730 */ { UD_Ijb, O_Jb, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0731 */ { UD_Ijb, O_Jz, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 0732 */ { UD_Ijae, O_Jb, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0733 */ { UD_Ijae, O_Jz, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 0734 */ { UD_Ijz, O_Jb, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0735 */ { UD_Ijz, O_Jz, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 0736 */ { UD_Ijnz, O_Jb, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0737 */ { UD_Ijnz, O_Jz, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 0738 */ { UD_Ijbe, O_Jb, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0739 */ { UD_Ijbe, O_Jz, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 0740 */ { UD_Ija, O_Jb, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0741 */ { UD_Ija, O_Jz, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 0742 */ { UD_Ijs, O_Jb, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0743 */ { UD_Ijs, O_Jz, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 0744 */ { UD_Ijns, O_Jb, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0745 */ { UD_Ijns, O_Jz, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 0746 */ { UD_Ijp, O_Jb, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0747 */ { UD_Ijp, O_Jz, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 0748 */ { UD_Ijnp, O_Jb, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0749 */ { UD_Ijnp, O_Jz, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 0750 */ { UD_Ijl, O_Jb, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0751 */ { UD_Ijl, O_Jz, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 0752 */ { UD_Ijge, O_Jb, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0753 */ { UD_Ijge, O_Jz, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 0754 */ { UD_Ijle, O_Jb, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0755 */ { UD_Ijle, O_Jz, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 0756 */ { UD_Ijg, O_Jb, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0757 */ { UD_Ijg, O_Jz, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 0758 */ { UD_Ijcxz, O_Jb, O_NONE, O_NONE, O_NONE, P_aso },
+ /* 0759 */ { UD_Ijecxz, O_Jb, O_NONE, O_NONE, O_NONE, P_aso },
+ /* 0760 */ { UD_Ijrcxz, O_Jb, O_NONE, O_NONE, O_NONE, P_aso },
+ /* 0761 */ { UD_Ijmp, O_Ev, O_NONE, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb|P_def64 },
+ /* 0762 */ { UD_Ijmp, O_Fv, O_NONE, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0763 */ { UD_Ijmp, O_Jz, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 0764 */ { UD_Ijmp, O_Av, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 0765 */ { UD_Ijmp, O_Jb, O_NONE, O_NONE, O_NONE, P_def64 },
+ /* 0766 */ { UD_Ilahf, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0767 */ { UD_Ilar, O_Gv, O_Ew, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0768 */ { UD_Ildmxcsr, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0769 */ { UD_Ilds, O_Gv, O_M, O_NONE, O_NONE, P_aso|P_oso },
+ /* 0770 */ { UD_Ilea, O_Gv, O_M, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0771 */ { UD_Iles, O_Gv, O_M, O_NONE, O_NONE, P_aso|P_oso },
+ /* 0772 */ { UD_Ilfs, O_Gz, O_M, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0773 */ { UD_Ilgs, O_Gz, O_M, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0774 */ { UD_Ilidt, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0775 */ { UD_Ilss, O_Gv, O_M, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0776 */ { UD_Ileave, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0777 */ { UD_Ilfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0778 */ { UD_Ilfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0779 */ { UD_Ilfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0780 */ { UD_Ilfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0781 */ { UD_Ilfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0782 */ { UD_Ilfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0783 */ { UD_Ilfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0784 */ { UD_Ilfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0785 */ { UD_Ilgdt, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0786 */ { UD_Illdt, O_Ew, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0787 */ { UD_Ilmsw, O_Ew, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0788 */ { UD_Ilmsw, O_Ew, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0789 */ { UD_Ilock, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0790 */ { UD_Ilodsb, O_NONE, O_NONE, O_NONE, O_NONE, P_str|P_seg },
+ /* 0791 */ { UD_Ilodsw, O_NONE, O_NONE, O_NONE, O_NONE, P_str|P_seg|P_oso|P_rexw },
+ /* 0792 */ { UD_Ilodsd, O_NONE, O_NONE, O_NONE, O_NONE, P_str|P_seg|P_oso|P_rexw },
+ /* 0793 */ { UD_Ilodsq, O_NONE, O_NONE, O_NONE, O_NONE, P_str|P_seg|P_oso|P_rexw },
+ /* 0794 */ { UD_Iloopne, O_Jb, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0795 */ { UD_Iloope, O_Jb, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0796 */ { UD_Iloop, O_Jb, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0797 */ { UD_Ilsl, O_Gv, O_Ew, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0798 */ { UD_Iltr, O_Ew, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0799 */ { UD_Imaskmovq, O_P, O_N, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0800 */ { UD_Imaxpd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0801 */ { UD_Ivmaxpd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0802 */ { UD_Imaxps, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0803 */ { UD_Ivmaxps, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0804 */ { UD_Imaxsd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0805 */ { UD_Ivmaxsd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0806 */ { UD_Imaxss, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0807 */ { UD_Ivmaxss, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0808 */ { UD_Imfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0809 */ { UD_Imfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0810 */ { UD_Imfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0811 */ { UD_Imfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0812 */ { UD_Imfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0813 */ { UD_Imfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0814 */ { UD_Imfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0815 */ { UD_Imfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0816 */ { UD_Iminpd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0817 */ { UD_Ivminpd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0818 */ { UD_Iminps, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0819 */ { UD_Ivminps, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0820 */ { UD_Iminsd, O_V, O_MqU, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0821 */ { UD_Ivminsd, O_Vx, O_Hx, O_MqU, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0822 */ { UD_Iminss, O_V, O_MdU, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0823 */ { UD_Ivminss, O_Vx, O_Hx, O_MdU, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0824 */ { UD_Imonitor, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0825 */ { UD_Imontmul, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0826 */ { UD_Imov, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0827 */ { UD_Imov, O_Ev, O_sIz, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0828 */ { UD_Imov, O_Eb, O_Gb, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0829 */ { UD_Imov, O_Ev, O_Gv, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0830 */ { UD_Imov, O_Gb, O_Eb, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0831 */ { UD_Imov, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0832 */ { UD_Imov, O_MwRv, O_S, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0833 */ { UD_Imov, O_S, O_MwRv, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0834 */ { UD_Imov, O_AL, O_Ob, O_NONE, O_NONE, P_none },
+ /* 0835 */ { UD_Imov, O_rAX, O_Ov, O_NONE, O_NONE, P_aso|P_oso|P_rexw },
+ /* 0836 */ { UD_Imov, O_Ob, O_AL, O_NONE, O_NONE, P_none },
+ /* 0837 */ { UD_Imov, O_Ov, O_rAX, O_NONE, O_NONE, P_aso|P_oso|P_rexw },
+ /* 0838 */ { UD_Imov, O_R0b, O_Ib, O_NONE, O_NONE, P_rexb },
+ /* 0839 */ { UD_Imov, O_R1b, O_Ib, O_NONE, O_NONE, P_rexb },
+ /* 0840 */ { UD_Imov, O_R2b, O_Ib, O_NONE, O_NONE, P_rexb },
+ /* 0841 */ { UD_Imov, O_R3b, O_Ib, O_NONE, O_NONE, P_rexb },
+ /* 0842 */ { UD_Imov, O_R4b, O_Ib, O_NONE, O_NONE, P_rexb },
+ /* 0843 */ { UD_Imov, O_R5b, O_Ib, O_NONE, O_NONE, P_rexb },
+ /* 0844 */ { UD_Imov, O_R6b, O_Ib, O_NONE, O_NONE, P_rexb },
+ /* 0845 */ { UD_Imov, O_R7b, O_Ib, O_NONE, O_NONE, P_rexb },
+ /* 0846 */ { UD_Imov, O_R0v, O_Iv, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 0847 */ { UD_Imov, O_R1v, O_Iv, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 0848 */ { UD_Imov, O_R2v, O_Iv, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 0849 */ { UD_Imov, O_R3v, O_Iv, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 0850 */ { UD_Imov, O_R4v, O_Iv, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 0851 */ { UD_Imov, O_R5v, O_Iv, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 0852 */ { UD_Imov, O_R6v, O_Iv, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 0853 */ { UD_Imov, O_R7v, O_Iv, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 0854 */ { UD_Imov, O_R, O_C, O_NONE, O_NONE, P_rexr|P_rexw|P_rexb },
+ /* 0855 */ { UD_Imov, O_R, O_D, O_NONE, O_NONE, P_rexr|P_rexw|P_rexb },
+ /* 0856 */ { UD_Imov, O_C, O_R, O_NONE, O_NONE, P_rexr|P_rexw|P_rexb },
+ /* 0857 */ { UD_Imov, O_D, O_R, O_NONE, O_NONE, P_rexr|P_rexw|P_rexb },
+ /* 0858 */ { UD_Imovapd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0859 */ { UD_Ivmovapd, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0860 */ { UD_Imovapd, O_W, O_V, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0861 */ { UD_Ivmovapd, O_Wx, O_Vx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0862 */ { UD_Imovaps, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0863 */ { UD_Ivmovaps, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0864 */ { UD_Imovaps, O_W, O_V, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0865 */ { UD_Ivmovaps, O_Wx, O_Vx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0866 */ { UD_Imovd, O_P, O_Ey, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0867 */ { UD_Imovd, O_P, O_Ey, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0868 */ { UD_Imovd, O_V, O_Ey, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0869 */ { UD_Ivmovd, O_Vx, O_Ey, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0870 */ { UD_Imovd, O_V, O_Ey, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0871 */ { UD_Ivmovd, O_Vx, O_Ey, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0872 */ { UD_Imovd, O_Ey, O_P, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0873 */ { UD_Imovd, O_Ey, O_P, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0874 */ { UD_Imovd, O_Ey, O_V, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0875 */ { UD_Ivmovd, O_Ey, O_Vx, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0876 */ { UD_Imovd, O_Ey, O_V, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0877 */ { UD_Ivmovd, O_Ey, O_Vx, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0878 */ { UD_Imovhpd, O_V, O_M, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0879 */ { UD_Ivmovhpd, O_Vx, O_Hx, O_M, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0880 */ { UD_Imovhpd, O_M, O_V, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0881 */ { UD_Ivmovhpd, O_M, O_Vx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0882 */ { UD_Imovhps, O_V, O_M, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0883 */ { UD_Ivmovhps, O_Vx, O_Hx, O_M, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0884 */ { UD_Imovhps, O_M, O_V, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0885 */ { UD_Ivmovhps, O_M, O_Vx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0886 */ { UD_Imovlhps, O_V, O_U, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0887 */ { UD_Ivmovlhps, O_Vx, O_Hx, O_Ux, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0888 */ { UD_Imovlpd, O_V, O_M, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0889 */ { UD_Ivmovlpd, O_Vx, O_M, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0890 */ { UD_Imovlpd, O_M, O_V, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0891 */ { UD_Ivmovlpd, O_M, O_Vx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0892 */ { UD_Imovlps, O_V, O_M, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0893 */ { UD_Ivmovlps, O_Vx, O_M, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0894 */ { UD_Imovlps, O_M, O_V, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0895 */ { UD_Ivmovlps, O_M, O_Vx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0896 */ { UD_Imovhlps, O_V, O_U, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0897 */ { UD_Ivmovhlps, O_Vx, O_Ux, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0898 */ { UD_Imovmskpd, O_Gd, O_U, O_NONE, O_NONE, P_oso|P_rexr|P_rexb },
+ /* 0899 */ { UD_Ivmovmskpd, O_Gd, O_Ux, O_NONE, O_NONE, P_oso|P_rexr|P_rexb|P_vexl },
+ /* 0900 */ { UD_Imovmskps, O_Gd, O_U, O_NONE, O_NONE, P_oso|P_rexr|P_rexb },
+ /* 0901 */ { UD_Ivmovmskps, O_Gd, O_Ux, O_NONE, O_NONE, P_oso|P_rexr|P_rexb },
+ /* 0902 */ { UD_Imovntdq, O_M, O_V, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0903 */ { UD_Ivmovntdq, O_M, O_Vx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0904 */ { UD_Imovnti, O_M, O_Gy, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0905 */ { UD_Imovntpd, O_M, O_V, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0906 */ { UD_Ivmovntpd, O_M, O_Vx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0907 */ { UD_Imovntps, O_M, O_V, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0908 */ { UD_Ivmovntps, O_M, O_Vx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0909 */ { UD_Imovntq, O_M, O_P, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0910 */ { UD_Imovq, O_P, O_Eq, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0911 */ { UD_Imovq, O_V, O_Eq, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0912 */ { UD_Ivmovq, O_Vx, O_Eq, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0913 */ { UD_Imovq, O_Eq, O_P, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0914 */ { UD_Imovq, O_Eq, O_V, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0915 */ { UD_Ivmovq, O_Eq, O_Vx, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0916 */ { UD_Imovq, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0917 */ { UD_Ivmovq, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0918 */ { UD_Imovq, O_W, O_V, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0919 */ { UD_Ivmovq, O_Wx, O_Vx, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0920 */ { UD_Imovq, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0921 */ { UD_Imovq, O_Q, O_P, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0922 */ { UD_Imovsb, O_NONE, O_NONE, O_NONE, O_NONE, P_str|P_seg },
+ /* 0923 */ { UD_Imovsw, O_NONE, O_NONE, O_NONE, O_NONE, P_str|P_seg|P_oso|P_rexw },
+ /* 0924 */ { UD_Imovsd, O_NONE, O_NONE, O_NONE, O_NONE, P_str|P_seg|P_oso|P_rexw },
+ /* 0925 */ { UD_Imovsd, O_V, O_MqU, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0926 */ { UD_Imovsd, O_W, O_V, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0927 */ { UD_Imovsq, O_NONE, O_NONE, O_NONE, O_NONE, P_str|P_seg|P_oso|P_rexw },
+ /* 0928 */ { UD_Imovss, O_V, O_MdU, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0929 */ { UD_Imovss, O_W, O_V, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0930 */ { UD_Imovsx, O_Gv, O_Eb, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0931 */ { UD_Imovsx, O_Gy, O_Ew, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0932 */ { UD_Imovupd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0933 */ { UD_Ivmovupd, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0934 */ { UD_Imovupd, O_W, O_V, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0935 */ { UD_Ivmovupd, O_Wx, O_Vx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0936 */ { UD_Imovups, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0937 */ { UD_Ivmovups, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0938 */ { UD_Imovups, O_W, O_V, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0939 */ { UD_Ivmovups, O_Wx, O_Vx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0940 */ { UD_Imovzx, O_Gv, O_Eb, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0941 */ { UD_Imovzx, O_Gy, O_Ew, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0942 */ { UD_Imul, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0943 */ { UD_Imul, O_Ev, O_NONE, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0944 */ { UD_Imulpd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0945 */ { UD_Ivmulpd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0946 */ { UD_Imulps, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0947 */ { UD_Ivmulps, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0948 */ { UD_Imulsd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0949 */ { UD_Ivmulsd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0950 */ { UD_Imulss, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0951 */ { UD_Ivmulss, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0952 */ { UD_Imwait, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 0953 */ { UD_Ineg, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0954 */ { UD_Ineg, O_Ev, O_NONE, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0955 */ { UD_Inop, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0956 */ { UD_Inop, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0957 */ { UD_Inop, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0958 */ { UD_Inop, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0959 */ { UD_Inop, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0960 */ { UD_Inop, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0961 */ { UD_Inop, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0962 */ { UD_Inot, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0963 */ { UD_Inot, O_Ev, O_NONE, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0964 */ { UD_Ior, O_Eb, O_Gb, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0965 */ { UD_Ior, O_Ev, O_Gv, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0966 */ { UD_Ior, O_Gb, O_Eb, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0967 */ { UD_Ior, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0968 */ { UD_Ior, O_AL, O_Ib, O_NONE, O_NONE, P_none },
+ /* 0969 */ { UD_Ior, O_rAX, O_sIz, O_NONE, O_NONE, P_oso|P_rexw },
+ /* 0970 */ { UD_Ior, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0971 */ { UD_Ior, O_Ev, O_sIz, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0972 */ { UD_Ior, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0973 */ { UD_Ior, O_Ev, O_sIb, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 0974 */ { UD_Iorpd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0975 */ { UD_Ivorpd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0976 */ { UD_Iorps, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0977 */ { UD_Ivorps, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0978 */ { UD_Iout, O_Ib, O_AL, O_NONE, O_NONE, P_none },
+ /* 0979 */ { UD_Iout, O_Ib, O_eAX, O_NONE, O_NONE, P_oso },
+ /* 0980 */ { UD_Iout, O_DX, O_AL, O_NONE, O_NONE, P_none },
+ /* 0981 */ { UD_Iout, O_DX, O_eAX, O_NONE, O_NONE, P_oso },
+ /* 0982 */ { UD_Ioutsb, O_NONE, O_NONE, O_NONE, O_NONE, P_str|P_seg },
+ /* 0983 */ { UD_Ioutsw, O_NONE, O_NONE, O_NONE, O_NONE, P_str|P_oso|P_seg },
+ /* 0984 */ { UD_Ioutsd, O_NONE, O_NONE, O_NONE, O_NONE, P_str|P_oso|P_seg },
+ /* 0985 */ { UD_Ipacksswb, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0986 */ { UD_Ivpacksswb, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0987 */ { UD_Ipacksswb, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0988 */ { UD_Ipackssdw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0989 */ { UD_Ivpackssdw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0990 */ { UD_Ipackssdw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0991 */ { UD_Ipackuswb, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0992 */ { UD_Ivpackuswb, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0993 */ { UD_Ipackuswb, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0994 */ { UD_Ipaddb, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0995 */ { UD_Ivpaddb, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 0996 */ { UD_Ipaddb, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0997 */ { UD_Ipaddw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0998 */ { UD_Ipaddw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 0999 */ { UD_Ivpaddw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1000 */ { UD_Ipaddd, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1001 */ { UD_Ipaddd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1002 */ { UD_Ivpaddd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1003 */ { UD_Ipaddsb, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1004 */ { UD_Ipaddsb, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1005 */ { UD_Ivpaddsb, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1006 */ { UD_Ipaddsw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1007 */ { UD_Ipaddsw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1008 */ { UD_Ivpaddsw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1009 */ { UD_Ipaddusb, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1010 */ { UD_Ipaddusb, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1011 */ { UD_Ivpaddusb, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1012 */ { UD_Ipaddusw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1013 */ { UD_Ipaddusw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1014 */ { UD_Ivpaddusw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1015 */ { UD_Ipand, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1016 */ { UD_Ivpand, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1017 */ { UD_Ipand, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1018 */ { UD_Ipandn, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1019 */ { UD_Ivpandn, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1020 */ { UD_Ipandn, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1021 */ { UD_Ipavgb, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1022 */ { UD_Ivpavgb, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1023 */ { UD_Ipavgb, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1024 */ { UD_Ipavgw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1025 */ { UD_Ivpavgw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1026 */ { UD_Ipavgw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1027 */ { UD_Ipcmpeqb, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1028 */ { UD_Ipcmpeqb, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1029 */ { UD_Ivpcmpeqb, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1030 */ { UD_Ipcmpeqw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1031 */ { UD_Ipcmpeqw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1032 */ { UD_Ivpcmpeqw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1033 */ { UD_Ipcmpeqd, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1034 */ { UD_Ipcmpeqd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1035 */ { UD_Ivpcmpeqd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1036 */ { UD_Ipcmpgtb, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1037 */ { UD_Ivpcmpgtb, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1038 */ { UD_Ipcmpgtb, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1039 */ { UD_Ipcmpgtw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1040 */ { UD_Ivpcmpgtw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1041 */ { UD_Ipcmpgtw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1042 */ { UD_Ipcmpgtd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1043 */ { UD_Ivpcmpgtd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1044 */ { UD_Ipcmpgtd, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1045 */ { UD_Ipextrb, O_MbRv, O_V, O_Ib, O_NONE, P_aso|P_rexx|P_rexr|P_rexb|P_def64 },
+ /* 1046 */ { UD_Ivpextrb, O_MbRv, O_Vx, O_Ib, O_NONE, P_aso|P_rexx|P_rexr|P_rexb|P_def64 },
+ /* 1047 */ { UD_Ipextrd, O_Ed, O_V, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexw|P_rexb },
+ /* 1048 */ { UD_Ivpextrd, O_Ed, O_Vx, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexw|P_rexb },
+ /* 1049 */ { UD_Ipextrd, O_Ed, O_V, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexw|P_rexb },
+ /* 1050 */ { UD_Ivpextrd, O_Ed, O_Vx, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexw|P_rexb },
+ /* 1051 */ { UD_Ipextrq, O_Eq, O_V, O_Ib, O_NONE, P_aso|P_rexr|P_rexw|P_rexb|P_def64 },
+ /* 1052 */ { UD_Ivpextrq, O_Eq, O_Vx, O_Ib, O_NONE, P_aso|P_rexr|P_rexw|P_rexb|P_def64 },
+ /* 1053 */ { UD_Ipextrw, O_Gd, O_U, O_Ib, O_NONE, P_aso|P_rexw|P_rexr|P_rexb },
+ /* 1054 */ { UD_Ivpextrw, O_Gd, O_Ux, O_Ib, O_NONE, P_aso|P_rexw|P_rexr|P_rexb },
+ /* 1055 */ { UD_Ipextrw, O_Gd, O_N, O_Ib, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1056 */ { UD_Ipextrw, O_MwRd, O_V, O_Ib, O_NONE, P_aso|P_rexw|P_rexx|P_rexr|P_rexb },
+ /* 1057 */ { UD_Ivpextrw, O_MwRd, O_Vx, O_Ib, O_NONE, P_aso|P_rexw|P_rexx|P_rexr|P_rexb },
+ /* 1058 */ { UD_Ipinsrb, O_V, O_MbRd, O_Ib, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1059 */ { UD_Ipinsrw, O_P, O_MwRy, O_Ib, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb|P_def64 },
+ /* 1060 */ { UD_Ipinsrw, O_V, O_MwRy, O_Ib, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb|P_def64 },
+ /* 1061 */ { UD_Ivpinsrw, O_Vx, O_MwRy, O_Ib, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb|P_def64 },
+ /* 1062 */ { UD_Ipinsrd, O_V, O_Ed, O_Ib, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1063 */ { UD_Ipinsrd, O_V, O_Ed, O_Ib, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1064 */ { UD_Ipinsrq, O_V, O_Eq, O_Ib, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1065 */ { UD_Ivpinsrb, O_V, O_H, O_MbRd, O_Ib, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1066 */ { UD_Ivpinsrd, O_V, O_H, O_Ed, O_Ib, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1067 */ { UD_Ivpinsrd, O_V, O_H, O_Ed, O_Ib, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1068 */ { UD_Ivpinsrq, O_V, O_H, O_Eq, O_Ib, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1069 */ { UD_Ipmaddwd, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1070 */ { UD_Ipmaddwd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1071 */ { UD_Ivpmaddwd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1072 */ { UD_Ipmaxsw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1073 */ { UD_Ivpmaxsw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1074 */ { UD_Ipmaxsw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1075 */ { UD_Ipmaxub, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1076 */ { UD_Ipmaxub, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1077 */ { UD_Ivpmaxub, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1078 */ { UD_Ipminsw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1079 */ { UD_Ivpminsw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1080 */ { UD_Ipminsw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1081 */ { UD_Ipminub, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1082 */ { UD_Ivpminub, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1083 */ { UD_Ipminub, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1084 */ { UD_Ipmovmskb, O_Gd, O_U, O_NONE, O_NONE, P_oso|P_rexr|P_rexw|P_rexb },
+ /* 1085 */ { UD_Ivpmovmskb, O_Gd, O_Ux, O_NONE, O_NONE, P_oso|P_rexr|P_rexw|P_rexb },
+ /* 1086 */ { UD_Ipmovmskb, O_Gd, O_N, O_NONE, O_NONE, P_oso|P_rexr|P_rexw|P_rexb },
+ /* 1087 */ { UD_Ipmulhuw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1088 */ { UD_Ipmulhuw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1089 */ { UD_Ivpmulhuw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1090 */ { UD_Ipmulhw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1091 */ { UD_Ivpmulhw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1092 */ { UD_Ipmulhw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1093 */ { UD_Ipmullw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1094 */ { UD_Ipmullw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1095 */ { UD_Ivpmullw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1096 */ { UD_Ipop, O_ES, O_NONE, O_NONE, O_NONE, P_inv64 },
+ /* 1097 */ { UD_Ipop, O_SS, O_NONE, O_NONE, O_NONE, P_inv64 },
+ /* 1098 */ { UD_Ipop, O_DS, O_NONE, O_NONE, O_NONE, P_inv64 },
+ /* 1099 */ { UD_Ipop, O_GS, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1100 */ { UD_Ipop, O_FS, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1101 */ { UD_Ipop, O_R0v, O_NONE, O_NONE, O_NONE, P_oso|P_rexb|P_def64 },
+ /* 1102 */ { UD_Ipop, O_R1v, O_NONE, O_NONE, O_NONE, P_oso|P_rexb|P_def64 },
+ /* 1103 */ { UD_Ipop, O_R2v, O_NONE, O_NONE, O_NONE, P_oso|P_rexb|P_def64 },
+ /* 1104 */ { UD_Ipop, O_R3v, O_NONE, O_NONE, O_NONE, P_oso|P_rexb|P_def64 },
+ /* 1105 */ { UD_Ipop, O_R4v, O_NONE, O_NONE, O_NONE, P_oso|P_rexb|P_def64 },
+ /* 1106 */ { UD_Ipop, O_R5v, O_NONE, O_NONE, O_NONE, P_oso|P_rexb|P_def64 },
+ /* 1107 */ { UD_Ipop, O_R6v, O_NONE, O_NONE, O_NONE, P_oso|P_rexb|P_def64 },
+ /* 1108 */ { UD_Ipop, O_R7v, O_NONE, O_NONE, O_NONE, P_oso|P_rexb|P_def64 },
+ /* 1109 */ { UD_Ipop, O_Ev, O_NONE, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb|P_def64 },
+ /* 1110 */ { UD_Ipopa, O_NONE, O_NONE, O_NONE, O_NONE, P_oso|P_inv64 },
+ /* 1111 */ { UD_Ipopad, O_NONE, O_NONE, O_NONE, O_NONE, P_oso|P_inv64 },
+ /* 1112 */ { UD_Ipopfw, O_NONE, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 1113 */ { UD_Ipopfd, O_NONE, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 1114 */ { UD_Ipopfq, O_NONE, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 1115 */ { UD_Ipopfq, O_NONE, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 1116 */ { UD_Ipor, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1117 */ { UD_Ivpor, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1118 */ { UD_Ipor, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1119 */ { UD_Iprefetch, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1120 */ { UD_Iprefetch, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1121 */ { UD_Iprefetch, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1122 */ { UD_Iprefetch, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1123 */ { UD_Iprefetch, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1124 */ { UD_Iprefetch, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1125 */ { UD_Iprefetch, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1126 */ { UD_Iprefetch, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1127 */ { UD_Iprefetchnta, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1128 */ { UD_Iprefetcht0, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1129 */ { UD_Iprefetcht1, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1130 */ { UD_Iprefetcht2, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1131 */ { UD_Ipsadbw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1132 */ { UD_Ivpsadbw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1133 */ { UD_Ipsadbw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1134 */ { UD_Ipshufw, O_P, O_Q, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1135 */ { UD_Ipsllw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1136 */ { UD_Ipsllw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1137 */ { UD_Ipsllw, O_U, O_Ib, O_NONE, O_NONE, P_rexb },
+ /* 1138 */ { UD_Ipsllw, O_N, O_Ib, O_NONE, O_NONE, P_none },
+ /* 1139 */ { UD_Ipslld, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1140 */ { UD_Ipslld, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1141 */ { UD_Ipslld, O_U, O_Ib, O_NONE, O_NONE, P_rexb },
+ /* 1142 */ { UD_Ipslld, O_N, O_Ib, O_NONE, O_NONE, P_none },
+ /* 1143 */ { UD_Ipsllq, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1144 */ { UD_Ipsllq, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1145 */ { UD_Ipsllq, O_U, O_Ib, O_NONE, O_NONE, P_rexb },
+ /* 1146 */ { UD_Ipsllq, O_N, O_Ib, O_NONE, O_NONE, P_none },
+ /* 1147 */ { UD_Ipsraw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1148 */ { UD_Ipsraw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1149 */ { UD_Ivpsraw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1150 */ { UD_Ipsraw, O_U, O_Ib, O_NONE, O_NONE, P_rexb },
+ /* 1151 */ { UD_Ivpsraw, O_Hx, O_Ux, O_Ib, O_NONE, P_rexb },
+ /* 1152 */ { UD_Ipsraw, O_N, O_Ib, O_NONE, O_NONE, P_none },
+ /* 1153 */ { UD_Ipsrad, O_N, O_Ib, O_NONE, O_NONE, P_none },
+ /* 1154 */ { UD_Ipsrad, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1155 */ { UD_Ivpsrad, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1156 */ { UD_Ipsrad, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1157 */ { UD_Ipsrad, O_U, O_Ib, O_NONE, O_NONE, P_rexb },
+ /* 1158 */ { UD_Ivpsrad, O_Hx, O_Ux, O_Ib, O_NONE, P_rexb },
+ /* 1159 */ { UD_Ipsrlw, O_N, O_Ib, O_NONE, O_NONE, P_none },
+ /* 1160 */ { UD_Ipsrlw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1161 */ { UD_Ipsrlw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1162 */ { UD_Ivpsrlw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1163 */ { UD_Ipsrlw, O_U, O_Ib, O_NONE, O_NONE, P_rexb },
+ /* 1164 */ { UD_Ivpsrlw, O_Hx, O_Ux, O_Ib, O_NONE, P_rexb },
+ /* 1165 */ { UD_Ipsrld, O_N, O_Ib, O_NONE, O_NONE, P_none },
+ /* 1166 */ { UD_Ipsrld, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1167 */ { UD_Ipsrld, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1168 */ { UD_Ivpsrld, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1169 */ { UD_Ipsrld, O_U, O_Ib, O_NONE, O_NONE, P_rexb },
+ /* 1170 */ { UD_Ivpsrld, O_Hx, O_Ux, O_Ib, O_NONE, P_rexb },
+ /* 1171 */ { UD_Ipsrlq, O_N, O_Ib, O_NONE, O_NONE, P_none },
+ /* 1172 */ { UD_Ipsrlq, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1173 */ { UD_Ipsrlq, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1174 */ { UD_Ivpsrlq, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1175 */ { UD_Ipsrlq, O_U, O_Ib, O_NONE, O_NONE, P_rexb },
+ /* 1176 */ { UD_Ivpsrlq, O_Hx, O_Ux, O_Ib, O_NONE, P_rexb },
+ /* 1177 */ { UD_Ipsubb, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1178 */ { UD_Ivpsubb, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1179 */ { UD_Ipsubb, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1180 */ { UD_Ipsubw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1181 */ { UD_Ivpsubw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1182 */ { UD_Ipsubw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1183 */ { UD_Ipsubd, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1184 */ { UD_Ipsubd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1185 */ { UD_Ivpsubd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1186 */ { UD_Ipsubsb, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1187 */ { UD_Ipsubsb, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1188 */ { UD_Ivpsubsb, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1189 */ { UD_Ipsubsw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1190 */ { UD_Ipsubsw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1191 */ { UD_Ivpsubsw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1192 */ { UD_Ipsubusb, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1193 */ { UD_Ipsubusb, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1194 */ { UD_Ivpsubusb, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1195 */ { UD_Ipsubusw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1196 */ { UD_Ipsubusw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1197 */ { UD_Ivpsubusw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1198 */ { UD_Ipunpckhbw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1199 */ { UD_Ivpunpckhbw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1200 */ { UD_Ipunpckhbw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1201 */ { UD_Ipunpckhwd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1202 */ { UD_Ivpunpckhwd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1203 */ { UD_Ipunpckhwd, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1204 */ { UD_Ipunpckhdq, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1205 */ { UD_Ivpunpckhdq, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1206 */ { UD_Ipunpckhdq, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1207 */ { UD_Ipunpcklbw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1208 */ { UD_Ivpunpcklbw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1209 */ { UD_Ipunpcklbw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1210 */ { UD_Ipunpcklwd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1211 */ { UD_Ivpunpcklwd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1212 */ { UD_Ipunpcklwd, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1213 */ { UD_Ipunpckldq, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1214 */ { UD_Ivpunpckldq, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1215 */ { UD_Ipunpckldq, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1216 */ { UD_Ipi2fw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1217 */ { UD_Ipi2fd, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1218 */ { UD_Ipf2iw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1219 */ { UD_Ipf2id, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1220 */ { UD_Ipfnacc, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1221 */ { UD_Ipfpnacc, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1222 */ { UD_Ipfcmpge, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1223 */ { UD_Ipfmin, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1224 */ { UD_Ipfrcp, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1225 */ { UD_Ipfrsqrt, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1226 */ { UD_Ipfsub, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1227 */ { UD_Ipfadd, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1228 */ { UD_Ipfcmpgt, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1229 */ { UD_Ipfmax, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1230 */ { UD_Ipfrcpit1, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1231 */ { UD_Ipfrsqit1, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1232 */ { UD_Ipfsubr, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1233 */ { UD_Ipfacc, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1234 */ { UD_Ipfcmpeq, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1235 */ { UD_Ipfmul, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1236 */ { UD_Ipfrcpit2, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1237 */ { UD_Ipmulhrw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1238 */ { UD_Ipswapd, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1239 */ { UD_Ipavgusb, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1240 */ { UD_Ipush, O_ES, O_NONE, O_NONE, O_NONE, P_inv64 },
+ /* 1241 */ { UD_Ipush, O_CS, O_NONE, O_NONE, O_NONE, P_inv64 },
+ /* 1242 */ { UD_Ipush, O_SS, O_NONE, O_NONE, O_NONE, P_inv64 },
+ /* 1243 */ { UD_Ipush, O_DS, O_NONE, O_NONE, O_NONE, P_inv64 },
+ /* 1244 */ { UD_Ipush, O_GS, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1245 */ { UD_Ipush, O_FS, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1246 */ { UD_Ipush, O_R0v, O_NONE, O_NONE, O_NONE, P_oso|P_rexb|P_def64 },
+ /* 1247 */ { UD_Ipush, O_R1v, O_NONE, O_NONE, O_NONE, P_oso|P_rexb|P_def64 },
+ /* 1248 */ { UD_Ipush, O_R2v, O_NONE, O_NONE, O_NONE, P_oso|P_rexb|P_def64 },
+ /* 1249 */ { UD_Ipush, O_R3v, O_NONE, O_NONE, O_NONE, P_oso|P_rexb|P_def64 },
+ /* 1250 */ { UD_Ipush, O_R4v, O_NONE, O_NONE, O_NONE, P_oso|P_rexb|P_def64 },
+ /* 1251 */ { UD_Ipush, O_R5v, O_NONE, O_NONE, O_NONE, P_oso|P_rexb|P_def64 },
+ /* 1252 */ { UD_Ipush, O_R6v, O_NONE, O_NONE, O_NONE, P_oso|P_rexb|P_def64 },
+ /* 1253 */ { UD_Ipush, O_R7v, O_NONE, O_NONE, O_NONE, P_oso|P_rexb|P_def64 },
+ /* 1254 */ { UD_Ipush, O_sIz, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 1255 */ { UD_Ipush, O_Ev, O_NONE, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb|P_def64 },
+ /* 1256 */ { UD_Ipush, O_sIb, O_NONE, O_NONE, O_NONE, P_oso|P_def64 },
+ /* 1257 */ { UD_Ipusha, O_NONE, O_NONE, O_NONE, O_NONE, P_oso|P_inv64 },
+ /* 1258 */ { UD_Ipushad, O_NONE, O_NONE, O_NONE, O_NONE, P_oso|P_inv64 },
+ /* 1259 */ { UD_Ipushfw, O_NONE, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 1260 */ { UD_Ipushfw, O_NONE, O_NONE, O_NONE, O_NONE, P_oso|P_rexw|P_def64 },
+ /* 1261 */ { UD_Ipushfd, O_NONE, O_NONE, O_NONE, O_NONE, P_oso },
+ /* 1262 */ { UD_Ipushfq, O_NONE, O_NONE, O_NONE, O_NONE, P_oso|P_rexw|P_def64 },
+ /* 1263 */ { UD_Ipushfq, O_NONE, O_NONE, O_NONE, O_NONE, P_oso|P_rexw|P_def64 },
+ /* 1264 */ { UD_Ipxor, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1265 */ { UD_Ivpxor, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1266 */ { UD_Ipxor, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1267 */ { UD_Ircl, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1268 */ { UD_Ircl, O_Ev, O_Ib, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1269 */ { UD_Ircl, O_Eb, O_I1, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1270 */ { UD_Ircl, O_Eb, O_CL, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1271 */ { UD_Ircl, O_Ev, O_CL, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1272 */ { UD_Ircl, O_Ev, O_I1, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1273 */ { UD_Ircr, O_Eb, O_I1, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1274 */ { UD_Ircr, O_Ev, O_Ib, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1275 */ { UD_Ircr, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1276 */ { UD_Ircr, O_Ev, O_I1, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1277 */ { UD_Ircr, O_Eb, O_CL, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1278 */ { UD_Ircr, O_Ev, O_CL, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1279 */ { UD_Irol, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1280 */ { UD_Irol, O_Eb, O_I1, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1281 */ { UD_Irol, O_Ev, O_I1, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1282 */ { UD_Irol, O_Eb, O_CL, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1283 */ { UD_Irol, O_Ev, O_CL, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1284 */ { UD_Irol, O_Ev, O_Ib, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1285 */ { UD_Iror, O_Eb, O_I1, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1286 */ { UD_Iror, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1287 */ { UD_Iror, O_Ev, O_Ib, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1288 */ { UD_Iror, O_Ev, O_I1, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1289 */ { UD_Iror, O_Eb, O_CL, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1290 */ { UD_Iror, O_Ev, O_CL, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1291 */ { UD_Ircpps, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1292 */ { UD_Ivrcpps, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1293 */ { UD_Ircpss, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1294 */ { UD_Ivrcpss, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1295 */ { UD_Irdmsr, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1296 */ { UD_Irdpmc, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1297 */ { UD_Irdtsc, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1298 */ { UD_Irdtscp, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1299 */ { UD_Irepne, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1300 */ { UD_Irep, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1301 */ { UD_Iret, O_Iw, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1302 */ { UD_Iret, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1303 */ { UD_Iretf, O_Iw, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1304 */ { UD_Iretf, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1305 */ { UD_Irsm, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1306 */ { UD_Irsqrtps, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1307 */ { UD_Ivrsqrtps, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1308 */ { UD_Irsqrtss, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1309 */ { UD_Ivrsqrtss, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1310 */ { UD_Isahf, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1311 */ { UD_Isalc, O_NONE, O_NONE, O_NONE, O_NONE, P_inv64 },
+ /* 1312 */ { UD_Isar, O_Ev, O_I1, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1313 */ { UD_Isar, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1314 */ { UD_Isar, O_Eb, O_I1, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1315 */ { UD_Isar, O_Ev, O_Ib, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1316 */ { UD_Isar, O_Eb, O_CL, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1317 */ { UD_Isar, O_Ev, O_CL, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1318 */ { UD_Ishl, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1319 */ { UD_Ishl, O_Ev, O_Ib, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1320 */ { UD_Ishl, O_Eb, O_I1, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1321 */ { UD_Ishl, O_Eb, O_CL, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1322 */ { UD_Ishl, O_Ev, O_CL, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1323 */ { UD_Ishl, O_Ev, O_Ib, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1324 */ { UD_Ishl, O_Eb, O_CL, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1325 */ { UD_Ishl, O_Ev, O_I1, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1326 */ { UD_Ishl, O_Eb, O_I1, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1327 */ { UD_Ishl, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1328 */ { UD_Ishl, O_Ev, O_CL, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1329 */ { UD_Ishl, O_Ev, O_I1, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1330 */ { UD_Ishr, O_Ev, O_Ib, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1331 */ { UD_Ishr, O_Eb, O_CL, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1332 */ { UD_Ishr, O_Ev, O_I1, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1333 */ { UD_Ishr, O_Eb, O_I1, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1334 */ { UD_Ishr, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1335 */ { UD_Ishr, O_Ev, O_CL, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1336 */ { UD_Isbb, O_Eb, O_Gb, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1337 */ { UD_Isbb, O_Ev, O_Gv, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1338 */ { UD_Isbb, O_Gb, O_Eb, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1339 */ { UD_Isbb, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1340 */ { UD_Isbb, O_AL, O_Ib, O_NONE, O_NONE, P_none },
+ /* 1341 */ { UD_Isbb, O_rAX, O_sIz, O_NONE, O_NONE, P_oso|P_rexw },
+ /* 1342 */ { UD_Isbb, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1343 */ { UD_Isbb, O_Ev, O_sIz, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1344 */ { UD_Isbb, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_inv64 },
+ /* 1345 */ { UD_Isbb, O_Ev, O_sIb, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1346 */ { UD_Iscasb, O_NONE, O_NONE, O_NONE, O_NONE, P_strz },
+ /* 1347 */ { UD_Iscasw, O_NONE, O_NONE, O_NONE, O_NONE, P_strz|P_oso|P_rexw },
+ /* 1348 */ { UD_Iscasd, O_NONE, O_NONE, O_NONE, O_NONE, P_strz|P_oso|P_rexw },
+ /* 1349 */ { UD_Iscasq, O_NONE, O_NONE, O_NONE, O_NONE, P_strz|P_oso|P_rexw },
+ /* 1350 */ { UD_Iseto, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1351 */ { UD_Isetno, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1352 */ { UD_Isetb, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1353 */ { UD_Isetae, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1354 */ { UD_Isetz, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1355 */ { UD_Isetnz, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1356 */ { UD_Isetbe, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1357 */ { UD_Iseta, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1358 */ { UD_Isets, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1359 */ { UD_Isetns, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1360 */ { UD_Isetp, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1361 */ { UD_Isetnp, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1362 */ { UD_Isetl, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1363 */ { UD_Isetge, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1364 */ { UD_Isetle, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1365 */ { UD_Isetg, O_Eb, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1366 */ { UD_Isfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1367 */ { UD_Isfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1368 */ { UD_Isfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1369 */ { UD_Isfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1370 */ { UD_Isfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1371 */ { UD_Isfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1372 */ { UD_Isfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1373 */ { UD_Isfence, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1374 */ { UD_Isgdt, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1375 */ { UD_Ishld, O_Ev, O_Gv, O_Ib, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1376 */ { UD_Ishld, O_Ev, O_Gv, O_CL, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1377 */ { UD_Ishrd, O_Ev, O_Gv, O_Ib, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1378 */ { UD_Ishrd, O_Ev, O_Gv, O_CL, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1379 */ { UD_Ishufpd, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1380 */ { UD_Ivshufpd, O_Vx, O_Hx, O_Wx, O_Ib, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1381 */ { UD_Ishufps, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1382 */ { UD_Ivshufps, O_Vx, O_Hx, O_Wx, O_Ib, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1383 */ { UD_Isidt, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1384 */ { UD_Isldt, O_MwRv, O_NONE, O_NONE, O_NONE, P_aso|P_oso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1385 */ { UD_Ismsw, O_MwRv, O_NONE, O_NONE, O_NONE, P_aso|P_oso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1386 */ { UD_Ismsw, O_MwRv, O_NONE, O_NONE, O_NONE, P_aso|P_oso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1387 */ { UD_Isqrtps, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1388 */ { UD_Ivsqrtps, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1389 */ { UD_Isqrtpd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1390 */ { UD_Ivsqrtpd, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1391 */ { UD_Isqrtsd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1392 */ { UD_Ivsqrtsd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1393 */ { UD_Isqrtss, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1394 */ { UD_Ivsqrtss, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1395 */ { UD_Istc, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1396 */ { UD_Istd, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1397 */ { UD_Istgi, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1398 */ { UD_Isti, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1399 */ { UD_Iskinit, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1400 */ { UD_Istmxcsr, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1401 */ { UD_Ivstmxcsr, O_Md, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1402 */ { UD_Istosb, O_NONE, O_NONE, O_NONE, O_NONE, P_str|P_seg },
+ /* 1403 */ { UD_Istosw, O_NONE, O_NONE, O_NONE, O_NONE, P_str|P_seg|P_oso|P_rexw },
+ /* 1404 */ { UD_Istosd, O_NONE, O_NONE, O_NONE, O_NONE, P_str|P_seg|P_oso|P_rexw },
+ /* 1405 */ { UD_Istosq, O_NONE, O_NONE, O_NONE, O_NONE, P_str|P_seg|P_oso|P_rexw },
+ /* 1406 */ { UD_Istr, O_MwRv, O_NONE, O_NONE, O_NONE, P_aso|P_oso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1407 */ { UD_Isub, O_Eb, O_Gb, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1408 */ { UD_Isub, O_Ev, O_Gv, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1409 */ { UD_Isub, O_Gb, O_Eb, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1410 */ { UD_Isub, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1411 */ { UD_Isub, O_AL, O_Ib, O_NONE, O_NONE, P_none },
+ /* 1412 */ { UD_Isub, O_rAX, O_sIz, O_NONE, O_NONE, P_oso|P_rexw },
+ /* 1413 */ { UD_Isub, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1414 */ { UD_Isub, O_Ev, O_sIz, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1415 */ { UD_Isub, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_inv64 },
+ /* 1416 */ { UD_Isub, O_Ev, O_sIb, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1417 */ { UD_Isubpd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1418 */ { UD_Ivsubpd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1419 */ { UD_Isubps, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1420 */ { UD_Ivsubps, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1421 */ { UD_Isubsd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1422 */ { UD_Ivsubsd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1423 */ { UD_Isubss, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1424 */ { UD_Ivsubss, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1425 */ { UD_Iswapgs, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1426 */ { UD_Isyscall, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1427 */ { UD_Isysenter, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1428 */ { UD_Isysenter, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1429 */ { UD_Isysexit, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1430 */ { UD_Isysexit, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1431 */ { UD_Isysret, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1432 */ { UD_Itest, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1433 */ { UD_Itest, O_Eb, O_Gb, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1434 */ { UD_Itest, O_Ev, O_Gv, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1435 */ { UD_Itest, O_AL, O_Ib, O_NONE, O_NONE, P_none },
+ /* 1436 */ { UD_Itest, O_rAX, O_sIz, O_NONE, O_NONE, P_oso|P_rexw },
+ /* 1437 */ { UD_Itest, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1438 */ { UD_Itest, O_Ev, O_sIz, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1439 */ { UD_Itest, O_Ev, O_Iz, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1440 */ { UD_Iucomisd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1441 */ { UD_Ivucomisd, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1442 */ { UD_Iucomiss, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1443 */ { UD_Ivucomiss, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1444 */ { UD_Iud2, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1445 */ { UD_Iunpckhpd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1446 */ { UD_Ivunpckhpd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1447 */ { UD_Iunpckhps, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1448 */ { UD_Ivunpckhps, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1449 */ { UD_Iunpcklps, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1450 */ { UD_Ivunpcklps, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1451 */ { UD_Iunpcklpd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1452 */ { UD_Ivunpcklpd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1453 */ { UD_Iverr, O_Ew, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1454 */ { UD_Iverw, O_Ew, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1455 */ { UD_Ivmcall, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1456 */ { UD_Irdrand, O_R, O_NONE, O_NONE, O_NONE, P_oso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1457 */ { UD_Ivmclear, O_Mq, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1458 */ { UD_Ivmxon, O_Mq, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1459 */ { UD_Ivmptrld, O_Mq, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1460 */ { UD_Ivmptrst, O_Mq, O_NONE, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1461 */ { UD_Ivmlaunch, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1462 */ { UD_Ivmresume, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1463 */ { UD_Ivmxoff, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1464 */ { UD_Ivmread, O_Ey, O_Gy, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_def64 },
+ /* 1465 */ { UD_Ivmwrite, O_Gy, O_Ey, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_def64 },
+ /* 1466 */ { UD_Ivmrun, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1467 */ { UD_Ivmmcall, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1468 */ { UD_Ivmload, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1469 */ { UD_Ivmsave, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1470 */ { UD_Iwait, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1471 */ { UD_Iwbinvd, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1472 */ { UD_Iwrmsr, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1473 */ { UD_Ixadd, O_Eb, O_Gb, O_NONE, O_NONE, P_aso|P_oso|P_rexr|P_rexx|P_rexb },
+ /* 1474 */ { UD_Ixadd, O_Ev, O_Gv, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1475 */ { UD_Ixchg, O_Eb, O_Gb, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1476 */ { UD_Ixchg, O_Ev, O_Gv, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1477 */ { UD_Ixchg, O_R0v, O_rAX, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 1478 */ { UD_Ixchg, O_R1v, O_rAX, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 1479 */ { UD_Ixchg, O_R2v, O_rAX, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 1480 */ { UD_Ixchg, O_R3v, O_rAX, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 1481 */ { UD_Ixchg, O_R4v, O_rAX, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 1482 */ { UD_Ixchg, O_R5v, O_rAX, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 1483 */ { UD_Ixchg, O_R6v, O_rAX, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 1484 */ { UD_Ixchg, O_R7v, O_rAX, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 1485 */ { UD_Ixgetbv, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1486 */ { UD_Ixlatb, O_NONE, O_NONE, O_NONE, O_NONE, P_rexw|P_seg },
+ /* 1487 */ { UD_Ixor, O_Eb, O_Gb, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1488 */ { UD_Ixor, O_Ev, O_Gv, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1489 */ { UD_Ixor, O_Gb, O_Eb, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1490 */ { UD_Ixor, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1491 */ { UD_Ixor, O_AL, O_Ib, O_NONE, O_NONE, P_none },
+ /* 1492 */ { UD_Ixor, O_rAX, O_sIz, O_NONE, O_NONE, P_oso|P_rexw },
+ /* 1493 */ { UD_Ixor, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1494 */ { UD_Ixor, O_Ev, O_sIz, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1495 */ { UD_Ixor, O_Eb, O_Ib, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_inv64 },
+ /* 1496 */ { UD_Ixor, O_Ev, O_sIb, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1497 */ { UD_Ixorpd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1498 */ { UD_Ivxorpd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1499 */ { UD_Ixorps, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1500 */ { UD_Ivxorps, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1501 */ { UD_Ixcryptecb, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1502 */ { UD_Ixcryptcbc, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1503 */ { UD_Ixcryptctr, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1504 */ { UD_Ixcryptcfb, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1505 */ { UD_Ixcryptofb, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1506 */ { UD_Ixrstor, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1507 */ { UD_Ixsave, O_M, O_NONE, O_NONE, O_NONE, P_aso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1508 */ { UD_Ixsetbv, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1509 */ { UD_Ixsha1, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1510 */ { UD_Ixsha256, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1511 */ { UD_Ixstore, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1512 */ { UD_Ipclmulqdq, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1513 */ { UD_Ivpclmulqdq, O_Vx, O_Hx, O_Wx, O_Ib, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1514 */ { UD_Igetsec, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1515 */ { UD_Imovdqa, O_W, O_V, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1516 */ { UD_Ivmovdqa, O_Wx, O_Vx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1517 */ { UD_Imovdqa, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1518 */ { UD_Ivmovdqa, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1519 */ { UD_Imaskmovdqu, O_V, O_U, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1520 */ { UD_Ivmaskmovdqu, O_Vx, O_Ux, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1521 */ { UD_Imovdq2q, O_P, O_U, O_NONE, O_NONE, P_aso|P_rexb },
+ /* 1522 */ { UD_Imovdqu, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1523 */ { UD_Ivmovdqu, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1524 */ { UD_Imovdqu, O_W, O_V, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1525 */ { UD_Ivmovdqu, O_Wx, O_Vx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1526 */ { UD_Imovq2dq, O_V, O_N, O_NONE, O_NONE, P_aso|P_rexr },
+ /* 1527 */ { UD_Ipaddq, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1528 */ { UD_Ipaddq, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1529 */ { UD_Ivpaddq, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1530 */ { UD_Ipsubq, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1531 */ { UD_Ivpsubq, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1532 */ { UD_Ipsubq, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1533 */ { UD_Ipmuludq, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1534 */ { UD_Ipmuludq, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1535 */ { UD_Ipshufhw, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1536 */ { UD_Ivpshufhw, O_Vx, O_Wx, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1537 */ { UD_Ipshuflw, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1538 */ { UD_Ivpshuflw, O_Vx, O_Wx, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1539 */ { UD_Ipshufd, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1540 */ { UD_Ivpshufd, O_Vx, O_Wx, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1541 */ { UD_Ipslldq, O_U, O_Ib, O_NONE, O_NONE, P_rexb },
+ /* 1542 */ { UD_Ivpslldq, O_Hx, O_Ux, O_Ib, O_NONE, P_rexb },
+ /* 1543 */ { UD_Ipsrldq, O_U, O_Ib, O_NONE, O_NONE, P_rexb },
+ /* 1544 */ { UD_Ivpsrldq, O_Hx, O_Ux, O_Ib, O_NONE, P_rexb },
+ /* 1545 */ { UD_Ipunpckhqdq, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1546 */ { UD_Ivpunpckhqdq, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1547 */ { UD_Ipunpcklqdq, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1548 */ { UD_Ivpunpcklqdq, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1549 */ { UD_Ihaddpd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1550 */ { UD_Ivhaddpd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1551 */ { UD_Ihaddps, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1552 */ { UD_Ivhaddps, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1553 */ { UD_Ihsubpd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1554 */ { UD_Ivhsubpd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1555 */ { UD_Ihsubps, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1556 */ { UD_Ivhsubps, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1557 */ { UD_Iinsertps, O_V, O_Md, O_Ib, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1558 */ { UD_Ivinsertps, O_Vx, O_Hx, O_Md, O_Ib, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1559 */ { UD_Ilddqu, O_V, O_M, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1560 */ { UD_Ivlddqu, O_Vx, O_M, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1561 */ { UD_Imovddup, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1562 */ { UD_Ivmovddup, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1563 */ { UD_Imovddup, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1564 */ { UD_Ivmovddup, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1565 */ { UD_Imovshdup, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1566 */ { UD_Ivmovshdup, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1567 */ { UD_Imovshdup, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1568 */ { UD_Ivmovshdup, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1569 */ { UD_Imovsldup, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1570 */ { UD_Ivmovsldup, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1571 */ { UD_Imovsldup, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1572 */ { UD_Ivmovsldup, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1573 */ { UD_Ipabsb, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1574 */ { UD_Ipabsb, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1575 */ { UD_Ivpabsb, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1576 */ { UD_Ipabsw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1577 */ { UD_Ipabsw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1578 */ { UD_Ivpabsw, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1579 */ { UD_Ipabsd, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1580 */ { UD_Ipabsd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1581 */ { UD_Ivpabsd, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1582 */ { UD_Ipshufb, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1583 */ { UD_Ipshufb, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1584 */ { UD_Ivpshufb, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1585 */ { UD_Iphaddw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1586 */ { UD_Iphaddw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1587 */ { UD_Ivphaddw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1588 */ { UD_Iphaddd, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1589 */ { UD_Iphaddd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1590 */ { UD_Ivphaddd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1591 */ { UD_Iphaddsw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1592 */ { UD_Iphaddsw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1593 */ { UD_Ivphaddsw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1594 */ { UD_Ipmaddubsw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1595 */ { UD_Ipmaddubsw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1596 */ { UD_Ivpmaddubsw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1597 */ { UD_Iphsubw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1598 */ { UD_Iphsubw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1599 */ { UD_Ivphsubw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1600 */ { UD_Iphsubd, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1601 */ { UD_Iphsubd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1602 */ { UD_Ivphsubd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1603 */ { UD_Iphsubsw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1604 */ { UD_Iphsubsw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1605 */ { UD_Ivphsubsw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1606 */ { UD_Ipsignb, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1607 */ { UD_Ipsignb, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1608 */ { UD_Ivpsignb, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1609 */ { UD_Ipsignd, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1610 */ { UD_Ipsignd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1611 */ { UD_Ivpsignd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1612 */ { UD_Ipsignw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1613 */ { UD_Ipsignw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1614 */ { UD_Ivpsignw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1615 */ { UD_Ipmulhrsw, O_P, O_Q, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1616 */ { UD_Ipmulhrsw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1617 */ { UD_Ivpmulhrsw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1618 */ { UD_Ipalignr, O_P, O_Q, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1619 */ { UD_Ipalignr, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1620 */ { UD_Ivpalignr, O_Vx, O_Hx, O_Wx, O_Ib, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1621 */ { UD_Ipblendvb, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1622 */ { UD_Ipmuldq, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1623 */ { UD_Ivpmuldq, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1624 */ { UD_Ipminsb, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1625 */ { UD_Ivpminsb, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1626 */ { UD_Ipminsd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1627 */ { UD_Ivpminsd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1628 */ { UD_Ipminuw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1629 */ { UD_Ivpminuw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1630 */ { UD_Ipminud, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1631 */ { UD_Ivpminud, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1632 */ { UD_Ipmaxsb, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1633 */ { UD_Ivpmaxsb, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1634 */ { UD_Ipmaxsd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1635 */ { UD_Ivpmaxsd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1636 */ { UD_Ipmaxud, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1637 */ { UD_Ivpmaxud, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1638 */ { UD_Ipmaxuw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1639 */ { UD_Ivpmaxuw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1640 */ { UD_Ipmulld, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1641 */ { UD_Ivpmulld, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1642 */ { UD_Iphminposuw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1643 */ { UD_Ivphminposuw, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1644 */ { UD_Iroundps, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1645 */ { UD_Ivroundps, O_Vx, O_Wx, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1646 */ { UD_Iroundpd, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1647 */ { UD_Ivroundpd, O_Vx, O_Wx, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1648 */ { UD_Iroundss, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1649 */ { UD_Ivroundss, O_Vx, O_Hx, O_Wx, O_Ib, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1650 */ { UD_Iroundsd, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1651 */ { UD_Ivroundsd, O_Vx, O_Hx, O_Wx, O_Ib, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1652 */ { UD_Iblendpd, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1653 */ { UD_Ivblendpd, O_Vx, O_Hx, O_Wx, O_Ib, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1654 */ { UD_Iblendps, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1655 */ { UD_Ivblendps, O_Vx, O_Hx, O_Wx, O_Ib, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1656 */ { UD_Iblendvpd, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1657 */ { UD_Iblendvps, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1658 */ { UD_Ibound, O_Gv, O_M, O_NONE, O_NONE, P_aso|P_oso },
+ /* 1659 */ { UD_Ibsf, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1660 */ { UD_Ibsr, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1661 */ { UD_Ibswap, O_R0y, O_NONE, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 1662 */ { UD_Ibswap, O_R1y, O_NONE, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 1663 */ { UD_Ibswap, O_R2y, O_NONE, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 1664 */ { UD_Ibswap, O_R3y, O_NONE, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 1665 */ { UD_Ibswap, O_R4y, O_NONE, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 1666 */ { UD_Ibswap, O_R5y, O_NONE, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 1667 */ { UD_Ibswap, O_R6y, O_NONE, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 1668 */ { UD_Ibswap, O_R7y, O_NONE, O_NONE, O_NONE, P_oso|P_rexw|P_rexb },
+ /* 1669 */ { UD_Ibt, O_Ev, O_Ib, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1670 */ { UD_Ibt, O_Ev, O_Gv, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1671 */ { UD_Ibtc, O_Ev, O_Gv, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1672 */ { UD_Ibtc, O_Ev, O_Ib, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1673 */ { UD_Ibtr, O_Ev, O_Gv, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1674 */ { UD_Ibtr, O_Ev, O_Ib, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1675 */ { UD_Ibts, O_Ev, O_Gv, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1676 */ { UD_Ibts, O_Ev, O_Ib, O_NONE, O_NONE, P_aso|P_oso|P_rexw|P_rexr|P_rexx|P_rexb },
+ /* 1677 */ { UD_Ipblendw, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1678 */ { UD_Ivpblendw, O_Vx, O_Hx, O_Wx, O_Ib, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1679 */ { UD_Impsadbw, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1680 */ { UD_Ivmpsadbw, O_Vx, O_Hx, O_Wx, O_Ib, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1681 */ { UD_Imovntdqa, O_V, O_M, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1682 */ { UD_Ivmovntdqa, O_Vx, O_M, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb|P_vexl },
+ /* 1683 */ { UD_Ipackusdw, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1684 */ { UD_Ivpackusdw, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb|P_vexl },
+ /* 1685 */ { UD_Ipmovsxbw, O_V, O_MqU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1686 */ { UD_Ivpmovsxbw, O_Vx, O_MqU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1687 */ { UD_Ipmovsxbd, O_V, O_MdU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1688 */ { UD_Ivpmovsxbd, O_Vx, O_MdU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1689 */ { UD_Ipmovsxbq, O_V, O_MwU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1690 */ { UD_Ivpmovsxbq, O_Vx, O_MwU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1691 */ { UD_Ipmovsxwd, O_V, O_MqU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1692 */ { UD_Ivpmovsxwd, O_Vx, O_MqU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1693 */ { UD_Ipmovsxwq, O_V, O_MdU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1694 */ { UD_Ivpmovsxwq, O_Vx, O_MdU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1695 */ { UD_Ipmovsxdq, O_V, O_MqU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1696 */ { UD_Ipmovzxbw, O_V, O_MqU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1697 */ { UD_Ivpmovzxbw, O_Vx, O_MqU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1698 */ { UD_Ipmovzxbd, O_V, O_MdU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1699 */ { UD_Ivpmovzxbd, O_Vx, O_MdU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1700 */ { UD_Ipmovzxbq, O_V, O_MwU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1701 */ { UD_Ivpmovzxbq, O_Vx, O_MwU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1702 */ { UD_Ipmovzxwd, O_V, O_MqU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1703 */ { UD_Ivpmovzxwd, O_Vx, O_MqU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1704 */ { UD_Ipmovzxwq, O_V, O_MdU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1705 */ { UD_Ivpmovzxwq, O_Vx, O_MdU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1706 */ { UD_Ipmovzxdq, O_V, O_MqU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1707 */ { UD_Ivpmovzxdq, O_Vx, O_MqU, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1708 */ { UD_Ipcmpeqq, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1709 */ { UD_Ivpcmpeqq, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1710 */ { UD_Ipopcnt, O_Gv, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1711 */ { UD_Iptest, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1712 */ { UD_Ivptest, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb|P_vexl },
+ /* 1713 */ { UD_Ipcmpestri, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1714 */ { UD_Ivpcmpestri, O_Vx, O_Wx, O_Ib, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1715 */ { UD_Ipcmpestrm, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1716 */ { UD_Ivpcmpestrm, O_Vx, O_Wx, O_Ib, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1717 */ { UD_Ipcmpgtq, O_V, O_W, O_NONE, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1718 */ { UD_Ivpcmpgtq, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1719 */ { UD_Ipcmpistri, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1720 */ { UD_Ivpcmpistri, O_Vx, O_Wx, O_Ib, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1721 */ { UD_Ipcmpistrm, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1722 */ { UD_Ivpcmpistrm, O_Vx, O_Wx, O_Ib, O_NONE, P_aso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1723 */ { UD_Imovbe, O_Gv, O_Mv, O_NONE, O_NONE, P_aso|P_oso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1724 */ { UD_Imovbe, O_Mv, O_Gv, O_NONE, O_NONE, P_aso|P_oso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1725 */ { UD_Icrc32, O_Gy, O_Eb, O_NONE, O_NONE, P_aso|P_oso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1726 */ { UD_Icrc32, O_Gy, O_Ev, O_NONE, O_NONE, P_aso|P_oso|P_rexr|P_rexw|P_rexx|P_rexb },
+ /* 1727 */ { UD_Ivbroadcastss, O_V, O_Md, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1728 */ { UD_Ivbroadcastsd, O_Vqq, O_Mq, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1729 */ { UD_Ivextractf128, O_Wdq, O_Vqq, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1730 */ { UD_Ivinsertf128, O_Vqq, O_Hqq, O_Wdq, O_Ib, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1731 */ { UD_Ivmaskmovps, O_V, O_H, O_M, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1732 */ { UD_Ivmaskmovps, O_M, O_H, O_V, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1733 */ { UD_Ivmaskmovpd, O_V, O_H, O_M, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1734 */ { UD_Ivmaskmovpd, O_M, O_H, O_V, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1735 */ { UD_Ivpermilpd, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1736 */ { UD_Ivpermilpd, O_V, O_W, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1737 */ { UD_Ivpermilps, O_Vx, O_Hx, O_Wx, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1738 */ { UD_Ivpermilps, O_Vx, O_Wx, O_Ib, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1739 */ { UD_Ivperm2f128, O_Vqq, O_Hqq, O_Wqq, O_Ib, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1740 */ { UD_Ivtestps, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1741 */ { UD_Ivtestpd, O_Vx, O_Wx, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1742 */ { UD_Ivzeroupper, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1743 */ { UD_Ivzeroall, O_NONE, O_NONE, O_NONE, O_NONE, P_none },
+ /* 1744 */ { UD_Ivblendvpd, O_Vx, O_Hx, O_Wx, O_Lx, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1745 */ { UD_Ivblendvps, O_Vx, O_Hx, O_Wx, O_Lx, P_aso|P_rexr|P_rexx|P_rexb|P_vexl },
+ /* 1746 */ { UD_Ivmovsd, O_V, O_H, O_U, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1747 */ { UD_Ivmovsd, O_V, O_Mq, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1748 */ { UD_Ivmovsd, O_U, O_H, O_V, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1749 */ { UD_Ivmovsd, O_Mq, O_V, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1750 */ { UD_Ivmovss, O_V, O_H, O_U, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1751 */ { UD_Ivmovss, O_V, O_Md, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1752 */ { UD_Ivmovss, O_U, O_H, O_V, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1753 */ { UD_Ivmovss, O_Md, O_V, O_NONE, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1754 */ { UD_Ivpblendvb, O_V, O_H, O_W, O_L, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1755 */ { UD_Ivpsllw, O_V, O_H, O_W, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1756 */ { UD_Ivpsllw, O_H, O_V, O_W, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1757 */ { UD_Ivpslld, O_V, O_H, O_W, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1758 */ { UD_Ivpslld, O_H, O_V, O_W, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1759 */ { UD_Ivpsllq, O_V, O_H, O_W, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+ /* 1760 */ { UD_Ivpsllq, O_H, O_V, O_W, O_NONE, P_aso|P_rexr|P_rexx|P_rexb },
+};
+
+
+const char* ud_mnemonics_str[] = {
+ "aaa",
+ "aad",
+ "aam",
+ "aas",
+ "adc",
+ "add",
+ "addpd",
+ "addps",
+ "addsd",
+ "addss",
+ "addsubpd",
+ "addsubps",
+ "aesdec",
+ "aesdeclast",
+ "aesenc",
+ "aesenclast",
+ "aesimc",
+ "aeskeygenassist",
+ "and",
+ "andnpd",
+ "andnps",
+ "andpd",
+ "andps",
+ "arpl",
+ "blendpd",
+ "blendps",
+ "blendvpd",
+ "blendvps",
+ "bound",
+ "bsf",
+ "bsr",
+ "bswap",
+ "bt",
+ "btc",
+ "btr",
+ "bts",
+ "call",
+ "cbw",
+ "cdq",
+ "cdqe",
+ "clc",
+ "cld",
+ "clflush",
+ "clgi",
+ "cli",
+ "clts",
+ "cmc",
+ "cmova",
+ "cmovae",
+ "cmovb",
+ "cmovbe",
+ "cmovg",
+ "cmovge",
+ "cmovl",
+ "cmovle",
+ "cmovno",
+ "cmovnp",
+ "cmovns",
+ "cmovnz",
+ "cmovo",
+ "cmovp",
+ "cmovs",
+ "cmovz",
+ "cmp",
+ "cmppd",
+ "cmpps",
+ "cmpsb",
+ "cmpsd",
+ "cmpsq",
+ "cmpss",
+ "cmpsw",
+ "cmpxchg",
+ "cmpxchg16b",
+ "cmpxchg8b",
+ "comisd",
+ "comiss",
+ "cpuid",
+ "cqo",
+ "crc32",
+ "cvtdq2pd",
+ "cvtdq2ps",
+ "cvtpd2dq",
+ "cvtpd2pi",
+ "cvtpd2ps",
+ "cvtpi2pd",
+ "cvtpi2ps",
+ "cvtps2dq",
+ "cvtps2pd",
+ "cvtps2pi",
+ "cvtsd2si",
+ "cvtsd2ss",
+ "cvtsi2sd",
+ "cvtsi2ss",
+ "cvtss2sd",
+ "cvtss2si",
+ "cvttpd2dq",
+ "cvttpd2pi",
+ "cvttps2dq",
+ "cvttps2pi",
+ "cvttsd2si",
+ "cvttss2si",
+ "cwd",
+ "cwde",
+ "daa",
+ "das",
+ "dec",
+ "div",
+ "divpd",
+ "divps",
+ "divsd",
+ "divss",
+ "dppd",
+ "dpps",
+ "emms",
+ "enter",
+ "extractps",
+ "f2xm1",
+ "fabs",
+ "fadd",
+ "faddp",
+ "fbld",
+ "fbstp",
+ "fchs",
+ "fclex",
+ "fcmovb",
+ "fcmovbe",
+ "fcmove",
+ "fcmovnb",
+ "fcmovnbe",
+ "fcmovne",
+ "fcmovnu",
+ "fcmovu",
+ "fcom",
+ "fcom2",
+ "fcomi",
+ "fcomip",
+ "fcomp",
+ "fcomp3",
+ "fcomp5",
+ "fcompp",
+ "fcos",
+ "fdecstp",
+ "fdiv",
+ "fdivp",
+ "fdivr",
+ "fdivrp",
+ "femms",
+ "ffree",
+ "ffreep",
+ "fiadd",
+ "ficom",
+ "ficomp",
+ "fidiv",
+ "fidivr",
+ "fild",
+ "fimul",
+ "fincstp",
+ "fist",
+ "fistp",
+ "fisttp",
+ "fisub",
+ "fisubr",
+ "fld",
+ "fld1",
+ "fldcw",
+ "fldenv",
+ "fldl2e",
+ "fldl2t",
+ "fldlg2",
+ "fldln2",
+ "fldpi",
+ "fldz",
+ "fmul",
+ "fmulp",
+ "fndisi",
+ "fneni",
+ "fninit",
+ "fnop",
+ "fnsave",
+ "fnsetpm",
+ "fnstcw",
+ "fnstenv",
+ "fnstsw",
+ "fpatan",
+ "fprem",
+ "fprem1",
+ "fptan",
+ "frndint",
+ "frstor",
+ "frstpm",
+ "fscale",
+ "fsin",
+ "fsincos",
+ "fsqrt",
+ "fst",
+ "fstp",
+ "fstp1",
+ "fstp8",
+ "fstp9",
+ "fsub",
+ "fsubp",
+ "fsubr",
+ "fsubrp",
+ "ftst",
+ "fucom",
+ "fucomi",
+ "fucomip",
+ "fucomp",
+ "fucompp",
+ "fxam",
+ "fxch",
+ "fxch4",
+ "fxch7",
+ "fxrstor",
+ "fxsave",
+ "fxtract",
+ "fyl2x",
+ "fyl2xp1",
+ "getsec",
+ "haddpd",
+ "haddps",
+ "hlt",
+ "hsubpd",
+ "hsubps",
+ "idiv",
+ "imul",
+ "in",
+ "inc",
+ "insb",
+ "insd",
+ "insertps",
+ "insw",
+ "int",
+ "int1",
+ "int3",
+ "into",
+ "invd",
+ "invept",
+ "invlpg",
+ "invlpga",
+ "invvpid",
+ "iretd",
+ "iretq",
+ "iretw",
+ "ja",
+ "jae",
+ "jb",
+ "jbe",
+ "jcxz",
+ "jecxz",
+ "jg",
+ "jge",
+ "jl",
+ "jle",
+ "jmp",
+ "jno",
+ "jnp",
+ "jns",
+ "jnz",
+ "jo",
+ "jp",
+ "jrcxz",
+ "js",
+ "jz",
+ "lahf",
+ "lar",
+ "lddqu",
+ "ldmxcsr",
+ "lds",
+ "lea",
+ "leave",
+ "les",
+ "lfence",
+ "lfs",
+ "lgdt",
+ "lgs",
+ "lidt",
+ "lldt",
+ "lmsw",
+ "lock",
+ "lodsb",
+ "lodsd",
+ "lodsq",
+ "lodsw",
+ "loop",
+ "loope",
+ "loopne",
+ "lsl",
+ "lss",
+ "ltr",
+ "maskmovdqu",
+ "maskmovq",
+ "maxpd",
+ "maxps",
+ "maxsd",
+ "maxss",
+ "mfence",
+ "minpd",
+ "minps",
+ "minsd",
+ "minss",
+ "monitor",
+ "montmul",
+ "mov",
+ "movapd",
+ "movaps",
+ "movbe",
+ "movd",
+ "movddup",
+ "movdq2q",
+ "movdqa",
+ "movdqu",
+ "movhlps",
+ "movhpd",
+ "movhps",
+ "movlhps",
+ "movlpd",
+ "movlps",
+ "movmskpd",
+ "movmskps",
+ "movntdq",
+ "movntdqa",
+ "movnti",
+ "movntpd",
+ "movntps",
+ "movntq",
+ "movq",
+ "movq2dq",
+ "movsb",
+ "movsd",
+ "movshdup",
+ "movsldup",
+ "movsq",
+ "movss",
+ "movsw",
+ "movsx",
+ "movsxd",
+ "movupd",
+ "movups",
+ "movzx",
+ "mpsadbw",
+ "mul",
+ "mulpd",
+ "mulps",
+ "mulsd",
+ "mulss",
+ "mwait",
+ "neg",
+ "nop",
+ "not",
+ "or",
+ "orpd",
+ "orps",
+ "out",
+ "outsb",
+ "outsd",
+ "outsw",
+ "pabsb",
+ "pabsd",
+ "pabsw",
+ "packssdw",
+ "packsswb",
+ "packusdw",
+ "packuswb",
+ "paddb",
+ "paddd",
+ "paddq",
+ "paddsb",
+ "paddsw",
+ "paddusb",
+ "paddusw",
+ "paddw",
+ "palignr",
+ "pand",
+ "pandn",
+ "pavgb",
+ "pavgusb",
+ "pavgw",
+ "pblendvb",
+ "pblendw",
+ "pclmulqdq",
+ "pcmpeqb",
+ "pcmpeqd",
+ "pcmpeqq",
+ "pcmpeqw",
+ "pcmpestri",
+ "pcmpestrm",
+ "pcmpgtb",
+ "pcmpgtd",
+ "pcmpgtq",
+ "pcmpgtw",
+ "pcmpistri",
+ "pcmpistrm",
+ "pextrb",
+ "pextrd",
+ "pextrq",
+ "pextrw",
+ "pf2id",
+ "pf2iw",
+ "pfacc",
+ "pfadd",
+ "pfcmpeq",
+ "pfcmpge",
+ "pfcmpgt",
+ "pfmax",
+ "pfmin",
+ "pfmul",
+ "pfnacc",
+ "pfpnacc",
+ "pfrcp",
+ "pfrcpit1",
+ "pfrcpit2",
+ "pfrsqit1",
+ "pfrsqrt",
+ "pfsub",
+ "pfsubr",
+ "phaddd",
+ "phaddsw",
+ "phaddw",
+ "phminposuw",
+ "phsubd",
+ "phsubsw",
+ "phsubw",
+ "pi2fd",
+ "pi2fw",
+ "pinsrb",
+ "pinsrd",
+ "pinsrq",
+ "pinsrw",
+ "pmaddubsw",
+ "pmaddwd",
+ "pmaxsb",
+ "pmaxsd",
+ "pmaxsw",
+ "pmaxub",
+ "pmaxud",
+ "pmaxuw",
+ "pminsb",
+ "pminsd",
+ "pminsw",
+ "pminub",
+ "pminud",
+ "pminuw",
+ "pmovmskb",
+ "pmovsxbd",
+ "pmovsxbq",
+ "pmovsxbw",
+ "pmovsxdq",
+ "pmovsxwd",
+ "pmovsxwq",
+ "pmovzxbd",
+ "pmovzxbq",
+ "pmovzxbw",
+ "pmovzxdq",
+ "pmovzxwd",
+ "pmovzxwq",
+ "pmuldq",
+ "pmulhrsw",
+ "pmulhrw",
+ "pmulhuw",
+ "pmulhw",
+ "pmulld",
+ "pmullw",
+ "pmuludq",
+ "pop",
+ "popa",
+ "popad",
+ "popcnt",
+ "popfd",
+ "popfq",
+ "popfw",
+ "por",
+ "prefetch",
+ "prefetchnta",
+ "prefetcht0",
+ "prefetcht1",
+ "prefetcht2",
+ "psadbw",
+ "pshufb",
+ "pshufd",
+ "pshufhw",
+ "pshuflw",
+ "pshufw",
+ "psignb",
+ "psignd",
+ "psignw",
+ "pslld",
+ "pslldq",
+ "psllq",
+ "psllw",
+ "psrad",
+ "psraw",
+ "psrld",
+ "psrldq",
+ "psrlq",
+ "psrlw",
+ "psubb",
+ "psubd",
+ "psubq",
+ "psubsb",
+ "psubsw",
+ "psubusb",
+ "psubusw",
+ "psubw",
+ "pswapd",
+ "ptest",
+ "punpckhbw",
+ "punpckhdq",
+ "punpckhqdq",
+ "punpckhwd",
+ "punpcklbw",
+ "punpckldq",
+ "punpcklqdq",
+ "punpcklwd",
+ "push",
+ "pusha",
+ "pushad",
+ "pushfd",
+ "pushfq",
+ "pushfw",
+ "pxor",
+ "rcl",
+ "rcpps",
+ "rcpss",
+ "rcr",
+ "rdmsr",
+ "rdpmc",
+ "rdrand",
+ "rdtsc",
+ "rdtscp",
+ "rep",
+ "repne",
+ "ret",
+ "retf",
+ "rol",
+ "ror",
+ "roundpd",
+ "roundps",
+ "roundsd",
+ "roundss",
+ "rsm",
+ "rsqrtps",
+ "rsqrtss",
+ "sahf",
+ "salc",
+ "sar",
+ "sbb",
+ "scasb",
+ "scasd",
+ "scasq",
+ "scasw",
+ "seta",
+ "setae",
+ "setb",
+ "setbe",
+ "setg",
+ "setge",
+ "setl",
+ "setle",
+ "setno",
+ "setnp",
+ "setns",
+ "setnz",
+ "seto",
+ "setp",
+ "sets",
+ "setz",
+ "sfence",
+ "sgdt",
+ "shl",
+ "shld",
+ "shr",
+ "shrd",
+ "shufpd",
+ "shufps",
+ "sidt",
+ "skinit",
+ "sldt",
+ "smsw",
+ "sqrtpd",
+ "sqrtps",
+ "sqrtsd",
+ "sqrtss",
+ "stc",
+ "std",
+ "stgi",
+ "sti",
+ "stmxcsr",
+ "stosb",
+ "stosd",
+ "stosq",
+ "stosw",
+ "str",
+ "sub",
+ "subpd",
+ "subps",
+ "subsd",
+ "subss",
+ "swapgs",
+ "syscall",
+ "sysenter",
+ "sysexit",
+ "sysret",
+ "test",
+ "ucomisd",
+ "ucomiss",
+ "ud2",
+ "unpckhpd",
+ "unpckhps",
+ "unpcklpd",
+ "unpcklps",
+ "vaddpd",
+ "vaddps",
+ "vaddsd",
+ "vaddss",
+ "vaddsubpd",
+ "vaddsubps",
+ "vaesdec",
+ "vaesdeclast",
+ "vaesenc",
+ "vaesenclast",
+ "vaesimc",
+ "vaeskeygenassist",
+ "vandnpd",
+ "vandnps",
+ "vandpd",
+ "vandps",
+ "vblendpd",
+ "vblendps",
+ "vblendvpd",
+ "vblendvps",
+ "vbroadcastsd",
+ "vbroadcastss",
+ "vcmppd",
+ "vcmpps",
+ "vcmpsd",
+ "vcmpss",
+ "vcomisd",
+ "vcomiss",
+ "vcvtdq2pd",
+ "vcvtdq2ps",
+ "vcvtpd2dq",
+ "vcvtpd2ps",
+ "vcvtps2dq",
+ "vcvtps2pd",
+ "vcvtsd2si",
+ "vcvtsd2ss",
+ "vcvtsi2sd",
+ "vcvtsi2ss",
+ "vcvtss2sd",
+ "vcvtss2si",
+ "vcvttpd2dq",
+ "vcvttps2dq",
+ "vcvttsd2si",
+ "vcvttss2si",
+ "vdivpd",
+ "vdivps",
+ "vdivsd",
+ "vdivss",
+ "vdppd",
+ "vdpps",
+ "verr",
+ "verw",
+ "vextractf128",
+ "vextractps",
+ "vhaddpd",
+ "vhaddps",
+ "vhsubpd",
+ "vhsubps",
+ "vinsertf128",
+ "vinsertps",
+ "vlddqu",
+ "vmaskmovdqu",
+ "vmaskmovpd",
+ "vmaskmovps",
+ "vmaxpd",
+ "vmaxps",
+ "vmaxsd",
+ "vmaxss",
+ "vmcall",
+ "vmclear",
+ "vminpd",
+ "vminps",
+ "vminsd",
+ "vminss",
+ "vmlaunch",
+ "vmload",
+ "vmmcall",
+ "vmovapd",
+ "vmovaps",
+ "vmovd",
+ "vmovddup",
+ "vmovdqa",
+ "vmovdqu",
+ "vmovhlps",
+ "vmovhpd",
+ "vmovhps",
+ "vmovlhps",
+ "vmovlpd",
+ "vmovlps",
+ "vmovmskpd",
+ "vmovmskps",
+ "vmovntdq",
+ "vmovntdqa",
+ "vmovntpd",
+ "vmovntps",
+ "vmovq",
+ "vmovsd",
+ "vmovshdup",
+ "vmovsldup",
+ "vmovss",
+ "vmovupd",
+ "vmovups",
+ "vmpsadbw",
+ "vmptrld",
+ "vmptrst",
+ "vmread",
+ "vmresume",
+ "vmrun",
+ "vmsave",
+ "vmulpd",
+ "vmulps",
+ "vmulsd",
+ "vmulss",
+ "vmwrite",
+ "vmxoff",
+ "vmxon",
+ "vorpd",
+ "vorps",
+ "vpabsb",
+ "vpabsd",
+ "vpabsw",
+ "vpackssdw",
+ "vpacksswb",
+ "vpackusdw",
+ "vpackuswb",
+ "vpaddb",
+ "vpaddd",
+ "vpaddq",
+ "vpaddsb",
+ "vpaddsw",
+ "vpaddusb",
+ "vpaddusw",
+ "vpaddw",
+ "vpalignr",
+ "vpand",
+ "vpandn",
+ "vpavgb",
+ "vpavgw",
+ "vpblendvb",
+ "vpblendw",
+ "vpclmulqdq",
+ "vpcmpeqb",
+ "vpcmpeqd",
+ "vpcmpeqq",
+ "vpcmpeqw",
+ "vpcmpestri",
+ "vpcmpestrm",
+ "vpcmpgtb",
+ "vpcmpgtd",
+ "vpcmpgtq",
+ "vpcmpgtw",
+ "vpcmpistri",
+ "vpcmpistrm",
+ "vperm2f128",
+ "vpermilpd",
+ "vpermilps",
+ "vpextrb",
+ "vpextrd",
+ "vpextrq",
+ "vpextrw",
+ "vphaddd",
+ "vphaddsw",
+ "vphaddw",
+ "vphminposuw",
+ "vphsubd",
+ "vphsubsw",
+ "vphsubw",
+ "vpinsrb",
+ "vpinsrd",
+ "vpinsrq",
+ "vpinsrw",
+ "vpmaddubsw",
+ "vpmaddwd",
+ "vpmaxsb",
+ "vpmaxsd",
+ "vpmaxsw",
+ "vpmaxub",
+ "vpmaxud",
+ "vpmaxuw",
+ "vpminsb",
+ "vpminsd",
+ "vpminsw",
+ "vpminub",
+ "vpminud",
+ "vpminuw",
+ "vpmovmskb",
+ "vpmovsxbd",
+ "vpmovsxbq",
+ "vpmovsxbw",
+ "vpmovsxwd",
+ "vpmovsxwq",
+ "vpmovzxbd",
+ "vpmovzxbq",
+ "vpmovzxbw",
+ "vpmovzxdq",
+ "vpmovzxwd",
+ "vpmovzxwq",
+ "vpmuldq",
+ "vpmulhrsw",
+ "vpmulhuw",
+ "vpmulhw",
+ "vpmulld",
+ "vpmullw",
+ "vpor",
+ "vpsadbw",
+ "vpshufb",
+ "vpshufd",
+ "vpshufhw",
+ "vpshuflw",
+ "vpsignb",
+ "vpsignd",
+ "vpsignw",
+ "vpslld",
+ "vpslldq",
+ "vpsllq",
+ "vpsllw",
+ "vpsrad",
+ "vpsraw",
+ "vpsrld",
+ "vpsrldq",
+ "vpsrlq",
+ "vpsrlw",
+ "vpsubb",
+ "vpsubd",
+ "vpsubq",
+ "vpsubsb",
+ "vpsubsw",
+ "vpsubusb",
+ "vpsubusw",
+ "vpsubw",
+ "vptest",
+ "vpunpckhbw",
+ "vpunpckhdq",
+ "vpunpckhqdq",
+ "vpunpckhwd",
+ "vpunpcklbw",
+ "vpunpckldq",
+ "vpunpcklqdq",
+ "vpunpcklwd",
+ "vpxor",
+ "vrcpps",
+ "vrcpss",
+ "vroundpd",
+ "vroundps",
+ "vroundsd",
+ "vroundss",
+ "vrsqrtps",
+ "vrsqrtss",
+ "vshufpd",
+ "vshufps",
+ "vsqrtpd",
+ "vsqrtps",
+ "vsqrtsd",
+ "vsqrtss",
+ "vstmxcsr",
+ "vsubpd",
+ "vsubps",
+ "vsubsd",
+ "vsubss",
+ "vtestpd",
+ "vtestps",
+ "vucomisd",
+ "vucomiss",
+ "vunpckhpd",
+ "vunpckhps",
+ "vunpcklpd",
+ "vunpcklps",
+ "vxorpd",
+ "vxorps",
+ "vzeroall",
+ "vzeroupper",
+ "wait",
+ "wbinvd",
+ "wrmsr",
+ "xadd",
+ "xchg",
+ "xcryptcbc",
+ "xcryptcfb",
+ "xcryptctr",
+ "xcryptecb",
+ "xcryptofb",
+ "xgetbv",
+ "xlatb",
+ "xor",
+ "xorpd",
+ "xorps",
+ "xrstor",
+ "xsave",
+ "xsetbv",
+ "xsha1",
+ "xsha256",
+ "xstore",
+ "invalid",
+ "3dnow",
+ "none",
+ "db",
+ "pause"
+};
diff --git a/ext/opcache/jit/libudis86/itab.h b/ext/opcache/jit/libudis86/itab.h
new file mode 100644
index 0000000000..3d54c43546
--- /dev/null
+++ b/ext/opcache/jit/libudis86/itab.h
@@ -0,0 +1,939 @@
+#ifndef UD_ITAB_H
+#define UD_ITAB_H
+
+/* itab.h -- generated by udis86:scripts/ud_itab.py, do no edit */
+
+/* ud_table_type -- lookup table types (see decode.c) */
+enum ud_table_type {
+ UD_TAB__OPC_VEX,
+ UD_TAB__OPC_TABLE,
+ UD_TAB__OPC_X87,
+ UD_TAB__OPC_MOD,
+ UD_TAB__OPC_RM,
+ UD_TAB__OPC_OSIZE,
+ UD_TAB__OPC_MODE,
+ UD_TAB__OPC_VEX_L,
+ UD_TAB__OPC_3DNOW,
+ UD_TAB__OPC_REG,
+ UD_TAB__OPC_ASIZE,
+ UD_TAB__OPC_VEX_W,
+ UD_TAB__OPC_SSE,
+ UD_TAB__OPC_VENDOR
+};
+
+/* ud_mnemonic -- mnemonic constants */
+enum ud_mnemonic_code {
+ UD_Iaaa,
+ UD_Iaad,
+ UD_Iaam,
+ UD_Iaas,
+ UD_Iadc,
+ UD_Iadd,
+ UD_Iaddpd,
+ UD_Iaddps,
+ UD_Iaddsd,
+ UD_Iaddss,
+ UD_Iaddsubpd,
+ UD_Iaddsubps,
+ UD_Iaesdec,
+ UD_Iaesdeclast,
+ UD_Iaesenc,
+ UD_Iaesenclast,
+ UD_Iaesimc,
+ UD_Iaeskeygenassist,
+ UD_Iand,
+ UD_Iandnpd,
+ UD_Iandnps,
+ UD_Iandpd,
+ UD_Iandps,
+ UD_Iarpl,
+ UD_Iblendpd,
+ UD_Iblendps,
+ UD_Iblendvpd,
+ UD_Iblendvps,
+ UD_Ibound,
+ UD_Ibsf,
+ UD_Ibsr,
+ UD_Ibswap,
+ UD_Ibt,
+ UD_Ibtc,
+ UD_Ibtr,
+ UD_Ibts,
+ UD_Icall,
+ UD_Icbw,
+ UD_Icdq,
+ UD_Icdqe,
+ UD_Iclc,
+ UD_Icld,
+ UD_Iclflush,
+ UD_Iclgi,
+ UD_Icli,
+ UD_Iclts,
+ UD_Icmc,
+ UD_Icmova,
+ UD_Icmovae,
+ UD_Icmovb,
+ UD_Icmovbe,
+ UD_Icmovg,
+ UD_Icmovge,
+ UD_Icmovl,
+ UD_Icmovle,
+ UD_Icmovno,
+ UD_Icmovnp,
+ UD_Icmovns,
+ UD_Icmovnz,
+ UD_Icmovo,
+ UD_Icmovp,
+ UD_Icmovs,
+ UD_Icmovz,
+ UD_Icmp,
+ UD_Icmppd,
+ UD_Icmpps,
+ UD_Icmpsb,
+ UD_Icmpsd,
+ UD_Icmpsq,
+ UD_Icmpss,
+ UD_Icmpsw,
+ UD_Icmpxchg,
+ UD_Icmpxchg16b,
+ UD_Icmpxchg8b,
+ UD_Icomisd,
+ UD_Icomiss,
+ UD_Icpuid,
+ UD_Icqo,
+ UD_Icrc32,
+ UD_Icvtdq2pd,
+ UD_Icvtdq2ps,
+ UD_Icvtpd2dq,
+ UD_Icvtpd2pi,
+ UD_Icvtpd2ps,
+ UD_Icvtpi2pd,
+ UD_Icvtpi2ps,
+ UD_Icvtps2dq,
+ UD_Icvtps2pd,
+ UD_Icvtps2pi,
+ UD_Icvtsd2si,
+ UD_Icvtsd2ss,
+ UD_Icvtsi2sd,
+ UD_Icvtsi2ss,
+ UD_Icvtss2sd,
+ UD_Icvtss2si,
+ UD_Icvttpd2dq,
+ UD_Icvttpd2pi,
+ UD_Icvttps2dq,
+ UD_Icvttps2pi,
+ UD_Icvttsd2si,
+ UD_Icvttss2si,
+ UD_Icwd,
+ UD_Icwde,
+ UD_Idaa,
+ UD_Idas,
+ UD_Idec,
+ UD_Idiv,
+ UD_Idivpd,
+ UD_Idivps,
+ UD_Idivsd,
+ UD_Idivss,
+ UD_Idppd,
+ UD_Idpps,
+ UD_Iemms,
+ UD_Ienter,
+ UD_Iextractps,
+ UD_If2xm1,
+ UD_Ifabs,
+ UD_Ifadd,
+ UD_Ifaddp,
+ UD_Ifbld,
+ UD_Ifbstp,
+ UD_Ifchs,
+ UD_Ifclex,
+ UD_Ifcmovb,
+ UD_Ifcmovbe,
+ UD_Ifcmove,
+ UD_Ifcmovnb,
+ UD_Ifcmovnbe,
+ UD_Ifcmovne,
+ UD_Ifcmovnu,
+ UD_Ifcmovu,
+ UD_Ifcom,
+ UD_Ifcom2,
+ UD_Ifcomi,
+ UD_Ifcomip,
+ UD_Ifcomp,
+ UD_Ifcomp3,
+ UD_Ifcomp5,
+ UD_Ifcompp,
+ UD_Ifcos,
+ UD_Ifdecstp,
+ UD_Ifdiv,
+ UD_Ifdivp,
+ UD_Ifdivr,
+ UD_Ifdivrp,
+ UD_Ifemms,
+ UD_Iffree,
+ UD_Iffreep,
+ UD_Ifiadd,
+ UD_Ificom,
+ UD_Ificomp,
+ UD_Ifidiv,
+ UD_Ifidivr,
+ UD_Ifild,
+ UD_Ifimul,
+ UD_Ifincstp,
+ UD_Ifist,
+ UD_Ifistp,
+ UD_Ifisttp,
+ UD_Ifisub,
+ UD_Ifisubr,
+ UD_Ifld,
+ UD_Ifld1,
+ UD_Ifldcw,
+ UD_Ifldenv,
+ UD_Ifldl2e,
+ UD_Ifldl2t,
+ UD_Ifldlg2,
+ UD_Ifldln2,
+ UD_Ifldpi,
+ UD_Ifldz,
+ UD_Ifmul,
+ UD_Ifmulp,
+ UD_Ifndisi,
+ UD_Ifneni,
+ UD_Ifninit,
+ UD_Ifnop,
+ UD_Ifnsave,
+ UD_Ifnsetpm,
+ UD_Ifnstcw,
+ UD_Ifnstenv,
+ UD_Ifnstsw,
+ UD_Ifpatan,
+ UD_Ifprem,
+ UD_Ifprem1,
+ UD_Ifptan,
+ UD_Ifrndint,
+ UD_Ifrstor,
+ UD_Ifrstpm,
+ UD_Ifscale,
+ UD_Ifsin,
+ UD_Ifsincos,
+ UD_Ifsqrt,
+ UD_Ifst,
+ UD_Ifstp,
+ UD_Ifstp1,
+ UD_Ifstp8,
+ UD_Ifstp9,
+ UD_Ifsub,
+ UD_Ifsubp,
+ UD_Ifsubr,
+ UD_Ifsubrp,
+ UD_Iftst,
+ UD_Ifucom,
+ UD_Ifucomi,
+ UD_Ifucomip,
+ UD_Ifucomp,
+ UD_Ifucompp,
+ UD_Ifxam,
+ UD_Ifxch,
+ UD_Ifxch4,
+ UD_Ifxch7,
+ UD_Ifxrstor,
+ UD_Ifxsave,
+ UD_Ifxtract,
+ UD_Ifyl2x,
+ UD_Ifyl2xp1,
+ UD_Igetsec,
+ UD_Ihaddpd,
+ UD_Ihaddps,
+ UD_Ihlt,
+ UD_Ihsubpd,
+ UD_Ihsubps,
+ UD_Iidiv,
+ UD_Iimul,
+ UD_Iin,
+ UD_Iinc,
+ UD_Iinsb,
+ UD_Iinsd,
+ UD_Iinsertps,
+ UD_Iinsw,
+ UD_Iint,
+ UD_Iint1,
+ UD_Iint3,
+ UD_Iinto,
+ UD_Iinvd,
+ UD_Iinvept,
+ UD_Iinvlpg,
+ UD_Iinvlpga,
+ UD_Iinvvpid,
+ UD_Iiretd,
+ UD_Iiretq,
+ UD_Iiretw,
+ UD_Ija,
+ UD_Ijae,
+ UD_Ijb,
+ UD_Ijbe,
+ UD_Ijcxz,
+ UD_Ijecxz,
+ UD_Ijg,
+ UD_Ijge,
+ UD_Ijl,
+ UD_Ijle,
+ UD_Ijmp,
+ UD_Ijno,
+ UD_Ijnp,
+ UD_Ijns,
+ UD_Ijnz,
+ UD_Ijo,
+ UD_Ijp,
+ UD_Ijrcxz,
+ UD_Ijs,
+ UD_Ijz,
+ UD_Ilahf,
+ UD_Ilar,
+ UD_Ilddqu,
+ UD_Ildmxcsr,
+ UD_Ilds,
+ UD_Ilea,
+ UD_Ileave,
+ UD_Iles,
+ UD_Ilfence,
+ UD_Ilfs,
+ UD_Ilgdt,
+ UD_Ilgs,
+ UD_Ilidt,
+ UD_Illdt,
+ UD_Ilmsw,
+ UD_Ilock,
+ UD_Ilodsb,
+ UD_Ilodsd,
+ UD_Ilodsq,
+ UD_Ilodsw,
+ UD_Iloop,
+ UD_Iloope,
+ UD_Iloopne,
+ UD_Ilsl,
+ UD_Ilss,
+ UD_Iltr,
+ UD_Imaskmovdqu,
+ UD_Imaskmovq,
+ UD_Imaxpd,
+ UD_Imaxps,
+ UD_Imaxsd,
+ UD_Imaxss,
+ UD_Imfence,
+ UD_Iminpd,
+ UD_Iminps,
+ UD_Iminsd,
+ UD_Iminss,
+ UD_Imonitor,
+ UD_Imontmul,
+ UD_Imov,
+ UD_Imovapd,
+ UD_Imovaps,
+ UD_Imovbe,
+ UD_Imovd,
+ UD_Imovddup,
+ UD_Imovdq2q,
+ UD_Imovdqa,
+ UD_Imovdqu,
+ UD_Imovhlps,
+ UD_Imovhpd,
+ UD_Imovhps,
+ UD_Imovlhps,
+ UD_Imovlpd,
+ UD_Imovlps,
+ UD_Imovmskpd,
+ UD_Imovmskps,
+ UD_Imovntdq,
+ UD_Imovntdqa,
+ UD_Imovnti,
+ UD_Imovntpd,
+ UD_Imovntps,
+ UD_Imovntq,
+ UD_Imovq,
+ UD_Imovq2dq,
+ UD_Imovsb,
+ UD_Imovsd,
+ UD_Imovshdup,
+ UD_Imovsldup,
+ UD_Imovsq,
+ UD_Imovss,
+ UD_Imovsw,
+ UD_Imovsx,
+ UD_Imovsxd,
+ UD_Imovupd,
+ UD_Imovups,
+ UD_Imovzx,
+ UD_Impsadbw,
+ UD_Imul,
+ UD_Imulpd,
+ UD_Imulps,
+ UD_Imulsd,
+ UD_Imulss,
+ UD_Imwait,
+ UD_Ineg,
+ UD_Inop,
+ UD_Inot,
+ UD_Ior,
+ UD_Iorpd,
+ UD_Iorps,
+ UD_Iout,
+ UD_Ioutsb,
+ UD_Ioutsd,
+ UD_Ioutsw,
+ UD_Ipabsb,
+ UD_Ipabsd,
+ UD_Ipabsw,
+ UD_Ipackssdw,
+ UD_Ipacksswb,
+ UD_Ipackusdw,
+ UD_Ipackuswb,
+ UD_Ipaddb,
+ UD_Ipaddd,
+ UD_Ipaddq,
+ UD_Ipaddsb,
+ UD_Ipaddsw,
+ UD_Ipaddusb,
+ UD_Ipaddusw,
+ UD_Ipaddw,
+ UD_Ipalignr,
+ UD_Ipand,
+ UD_Ipandn,
+ UD_Ipavgb,
+ UD_Ipavgusb,
+ UD_Ipavgw,
+ UD_Ipblendvb,
+ UD_Ipblendw,
+ UD_Ipclmulqdq,
+ UD_Ipcmpeqb,
+ UD_Ipcmpeqd,
+ UD_Ipcmpeqq,
+ UD_Ipcmpeqw,
+ UD_Ipcmpestri,
+ UD_Ipcmpestrm,
+ UD_Ipcmpgtb,
+ UD_Ipcmpgtd,
+ UD_Ipcmpgtq,
+ UD_Ipcmpgtw,
+ UD_Ipcmpistri,
+ UD_Ipcmpistrm,
+ UD_Ipextrb,
+ UD_Ipextrd,
+ UD_Ipextrq,
+ UD_Ipextrw,
+ UD_Ipf2id,
+ UD_Ipf2iw,
+ UD_Ipfacc,
+ UD_Ipfadd,
+ UD_Ipfcmpeq,
+ UD_Ipfcmpge,
+ UD_Ipfcmpgt,
+ UD_Ipfmax,
+ UD_Ipfmin,
+ UD_Ipfmul,
+ UD_Ipfnacc,
+ UD_Ipfpnacc,
+ UD_Ipfrcp,
+ UD_Ipfrcpit1,
+ UD_Ipfrcpit2,
+ UD_Ipfrsqit1,
+ UD_Ipfrsqrt,
+ UD_Ipfsub,
+ UD_Ipfsubr,
+ UD_Iphaddd,
+ UD_Iphaddsw,
+ UD_Iphaddw,
+ UD_Iphminposuw,
+ UD_Iphsubd,
+ UD_Iphsubsw,
+ UD_Iphsubw,
+ UD_Ipi2fd,
+ UD_Ipi2fw,
+ UD_Ipinsrb,
+ UD_Ipinsrd,
+ UD_Ipinsrq,
+ UD_Ipinsrw,
+ UD_Ipmaddubsw,
+ UD_Ipmaddwd,
+ UD_Ipmaxsb,
+ UD_Ipmaxsd,
+ UD_Ipmaxsw,
+ UD_Ipmaxub,
+ UD_Ipmaxud,
+ UD_Ipmaxuw,
+ UD_Ipminsb,
+ UD_Ipminsd,
+ UD_Ipminsw,
+ UD_Ipminub,
+ UD_Ipminud,
+ UD_Ipminuw,
+ UD_Ipmovmskb,
+ UD_Ipmovsxbd,
+ UD_Ipmovsxbq,
+ UD_Ipmovsxbw,
+ UD_Ipmovsxdq,
+ UD_Ipmovsxwd,
+ UD_Ipmovsxwq,
+ UD_Ipmovzxbd,
+ UD_Ipmovzxbq,
+ UD_Ipmovzxbw,
+ UD_Ipmovzxdq,
+ UD_Ipmovzxwd,
+ UD_Ipmovzxwq,
+ UD_Ipmuldq,
+ UD_Ipmulhrsw,
+ UD_Ipmulhrw,
+ UD_Ipmulhuw,
+ UD_Ipmulhw,
+ UD_Ipmulld,
+ UD_Ipmullw,
+ UD_Ipmuludq,
+ UD_Ipop,
+ UD_Ipopa,
+ UD_Ipopad,
+ UD_Ipopcnt,
+ UD_Ipopfd,
+ UD_Ipopfq,
+ UD_Ipopfw,
+ UD_Ipor,
+ UD_Iprefetch,
+ UD_Iprefetchnta,
+ UD_Iprefetcht0,
+ UD_Iprefetcht1,
+ UD_Iprefetcht2,
+ UD_Ipsadbw,
+ UD_Ipshufb,
+ UD_Ipshufd,
+ UD_Ipshufhw,
+ UD_Ipshuflw,
+ UD_Ipshufw,
+ UD_Ipsignb,
+ UD_Ipsignd,
+ UD_Ipsignw,
+ UD_Ipslld,
+ UD_Ipslldq,
+ UD_Ipsllq,
+ UD_Ipsllw,
+ UD_Ipsrad,
+ UD_Ipsraw,
+ UD_Ipsrld,
+ UD_Ipsrldq,
+ UD_Ipsrlq,
+ UD_Ipsrlw,
+ UD_Ipsubb,
+ UD_Ipsubd,
+ UD_Ipsubq,
+ UD_Ipsubsb,
+ UD_Ipsubsw,
+ UD_Ipsubusb,
+ UD_Ipsubusw,
+ UD_Ipsubw,
+ UD_Ipswapd,
+ UD_Iptest,
+ UD_Ipunpckhbw,
+ UD_Ipunpckhdq,
+ UD_Ipunpckhqdq,
+ UD_Ipunpckhwd,
+ UD_Ipunpcklbw,
+ UD_Ipunpckldq,
+ UD_Ipunpcklqdq,
+ UD_Ipunpcklwd,
+ UD_Ipush,
+ UD_Ipusha,
+ UD_Ipushad,
+ UD_Ipushfd,
+ UD_Ipushfq,
+ UD_Ipushfw,
+ UD_Ipxor,
+ UD_Ircl,
+ UD_Ircpps,
+ UD_Ircpss,
+ UD_Ircr,
+ UD_Irdmsr,
+ UD_Irdpmc,
+ UD_Irdrand,
+ UD_Irdtsc,
+ UD_Irdtscp,
+ UD_Irep,
+ UD_Irepne,
+ UD_Iret,
+ UD_Iretf,
+ UD_Irol,
+ UD_Iror,
+ UD_Iroundpd,
+ UD_Iroundps,
+ UD_Iroundsd,
+ UD_Iroundss,
+ UD_Irsm,
+ UD_Irsqrtps,
+ UD_Irsqrtss,
+ UD_Isahf,
+ UD_Isalc,
+ UD_Isar,
+ UD_Isbb,
+ UD_Iscasb,
+ UD_Iscasd,
+ UD_Iscasq,
+ UD_Iscasw,
+ UD_Iseta,
+ UD_Isetae,
+ UD_Isetb,
+ UD_Isetbe,
+ UD_Isetg,
+ UD_Isetge,
+ UD_Isetl,
+ UD_Isetle,
+ UD_Isetno,
+ UD_Isetnp,
+ UD_Isetns,
+ UD_Isetnz,
+ UD_Iseto,
+ UD_Isetp,
+ UD_Isets,
+ UD_Isetz,
+ UD_Isfence,
+ UD_Isgdt,
+ UD_Ishl,
+ UD_Ishld,
+ UD_Ishr,
+ UD_Ishrd,
+ UD_Ishufpd,
+ UD_Ishufps,
+ UD_Isidt,
+ UD_Iskinit,
+ UD_Isldt,
+ UD_Ismsw,
+ UD_Isqrtpd,
+ UD_Isqrtps,
+ UD_Isqrtsd,
+ UD_Isqrtss,
+ UD_Istc,
+ UD_Istd,
+ UD_Istgi,
+ UD_Isti,
+ UD_Istmxcsr,
+ UD_Istosb,
+ UD_Istosd,
+ UD_Istosq,
+ UD_Istosw,
+ UD_Istr,
+ UD_Isub,
+ UD_Isubpd,
+ UD_Isubps,
+ UD_Isubsd,
+ UD_Isubss,
+ UD_Iswapgs,
+ UD_Isyscall,
+ UD_Isysenter,
+ UD_Isysexit,
+ UD_Isysret,
+ UD_Itest,
+ UD_Iucomisd,
+ UD_Iucomiss,
+ UD_Iud2,
+ UD_Iunpckhpd,
+ UD_Iunpckhps,
+ UD_Iunpcklpd,
+ UD_Iunpcklps,
+ UD_Ivaddpd,
+ UD_Ivaddps,
+ UD_Ivaddsd,
+ UD_Ivaddss,
+ UD_Ivaddsubpd,
+ UD_Ivaddsubps,
+ UD_Ivaesdec,
+ UD_Ivaesdeclast,
+ UD_Ivaesenc,
+ UD_Ivaesenclast,
+ UD_Ivaesimc,
+ UD_Ivaeskeygenassist,
+ UD_Ivandnpd,
+ UD_Ivandnps,
+ UD_Ivandpd,
+ UD_Ivandps,
+ UD_Ivblendpd,
+ UD_Ivblendps,
+ UD_Ivblendvpd,
+ UD_Ivblendvps,
+ UD_Ivbroadcastsd,
+ UD_Ivbroadcastss,
+ UD_Ivcmppd,
+ UD_Ivcmpps,
+ UD_Ivcmpsd,
+ UD_Ivcmpss,
+ UD_Ivcomisd,
+ UD_Ivcomiss,
+ UD_Ivcvtdq2pd,
+ UD_Ivcvtdq2ps,
+ UD_Ivcvtpd2dq,
+ UD_Ivcvtpd2ps,
+ UD_Ivcvtps2dq,
+ UD_Ivcvtps2pd,
+ UD_Ivcvtsd2si,
+ UD_Ivcvtsd2ss,
+ UD_Ivcvtsi2sd,
+ UD_Ivcvtsi2ss,
+ UD_Ivcvtss2sd,
+ UD_Ivcvtss2si,
+ UD_Ivcvttpd2dq,
+ UD_Ivcvttps2dq,
+ UD_Ivcvttsd2si,
+ UD_Ivcvttss2si,
+ UD_Ivdivpd,
+ UD_Ivdivps,
+ UD_Ivdivsd,
+ UD_Ivdivss,
+ UD_Ivdppd,
+ UD_Ivdpps,
+ UD_Iverr,
+ UD_Iverw,
+ UD_Ivextractf128,
+ UD_Ivextractps,
+ UD_Ivhaddpd,
+ UD_Ivhaddps,
+ UD_Ivhsubpd,
+ UD_Ivhsubps,
+ UD_Ivinsertf128,
+ UD_Ivinsertps,
+ UD_Ivlddqu,
+ UD_Ivmaskmovdqu,
+ UD_Ivmaskmovpd,
+ UD_Ivmaskmovps,
+ UD_Ivmaxpd,
+ UD_Ivmaxps,
+ UD_Ivmaxsd,
+ UD_Ivmaxss,
+ UD_Ivmcall,
+ UD_Ivmclear,
+ UD_Ivminpd,
+ UD_Ivminps,
+ UD_Ivminsd,
+ UD_Ivminss,
+ UD_Ivmlaunch,
+ UD_Ivmload,
+ UD_Ivmmcall,
+ UD_Ivmovapd,
+ UD_Ivmovaps,
+ UD_Ivmovd,
+ UD_Ivmovddup,
+ UD_Ivmovdqa,
+ UD_Ivmovdqu,
+ UD_Ivmovhlps,
+ UD_Ivmovhpd,
+ UD_Ivmovhps,
+ UD_Ivmovlhps,
+ UD_Ivmovlpd,
+ UD_Ivmovlps,
+ UD_Ivmovmskpd,
+ UD_Ivmovmskps,
+ UD_Ivmovntdq,
+ UD_Ivmovntdqa,
+ UD_Ivmovntpd,
+ UD_Ivmovntps,
+ UD_Ivmovq,
+ UD_Ivmovsd,
+ UD_Ivmovshdup,
+ UD_Ivmovsldup,
+ UD_Ivmovss,
+ UD_Ivmovupd,
+ UD_Ivmovups,
+ UD_Ivmpsadbw,
+ UD_Ivmptrld,
+ UD_Ivmptrst,
+ UD_Ivmread,
+ UD_Ivmresume,
+ UD_Ivmrun,
+ UD_Ivmsave,
+ UD_Ivmulpd,
+ UD_Ivmulps,
+ UD_Ivmulsd,
+ UD_Ivmulss,
+ UD_Ivmwrite,
+ UD_Ivmxoff,
+ UD_Ivmxon,
+ UD_Ivorpd,
+ UD_Ivorps,
+ UD_Ivpabsb,
+ UD_Ivpabsd,
+ UD_Ivpabsw,
+ UD_Ivpackssdw,
+ UD_Ivpacksswb,
+ UD_Ivpackusdw,
+ UD_Ivpackuswb,
+ UD_Ivpaddb,
+ UD_Ivpaddd,
+ UD_Ivpaddq,
+ UD_Ivpaddsb,
+ UD_Ivpaddsw,
+ UD_Ivpaddusb,
+ UD_Ivpaddusw,
+ UD_Ivpaddw,
+ UD_Ivpalignr,
+ UD_Ivpand,
+ UD_Ivpandn,
+ UD_Ivpavgb,
+ UD_Ivpavgw,
+ UD_Ivpblendvb,
+ UD_Ivpblendw,
+ UD_Ivpclmulqdq,
+ UD_Ivpcmpeqb,
+ UD_Ivpcmpeqd,
+ UD_Ivpcmpeqq,
+ UD_Ivpcmpeqw,
+ UD_Ivpcmpestri,
+ UD_Ivpcmpestrm,
+ UD_Ivpcmpgtb,
+ UD_Ivpcmpgtd,
+ UD_Ivpcmpgtq,
+ UD_Ivpcmpgtw,
+ UD_Ivpcmpistri,
+ UD_Ivpcmpistrm,
+ UD_Ivperm2f128,
+ UD_Ivpermilpd,
+ UD_Ivpermilps,
+ UD_Ivpextrb,
+ UD_Ivpextrd,
+ UD_Ivpextrq,
+ UD_Ivpextrw,
+ UD_Ivphaddd,
+ UD_Ivphaddsw,
+ UD_Ivphaddw,
+ UD_Ivphminposuw,
+ UD_Ivphsubd,
+ UD_Ivphsubsw,
+ UD_Ivphsubw,
+ UD_Ivpinsrb,
+ UD_Ivpinsrd,
+ UD_Ivpinsrq,
+ UD_Ivpinsrw,
+ UD_Ivpmaddubsw,
+ UD_Ivpmaddwd,
+ UD_Ivpmaxsb,
+ UD_Ivpmaxsd,
+ UD_Ivpmaxsw,
+ UD_Ivpmaxub,
+ UD_Ivpmaxud,
+ UD_Ivpmaxuw,
+ UD_Ivpminsb,
+ UD_Ivpminsd,
+ UD_Ivpminsw,
+ UD_Ivpminub,
+ UD_Ivpminud,
+ UD_Ivpminuw,
+ UD_Ivpmovmskb,
+ UD_Ivpmovsxbd,
+ UD_Ivpmovsxbq,
+ UD_Ivpmovsxbw,
+ UD_Ivpmovsxwd,
+ UD_Ivpmovsxwq,
+ UD_Ivpmovzxbd,
+ UD_Ivpmovzxbq,
+ UD_Ivpmovzxbw,
+ UD_Ivpmovzxdq,
+ UD_Ivpmovzxwd,
+ UD_Ivpmovzxwq,
+ UD_Ivpmuldq,
+ UD_Ivpmulhrsw,
+ UD_Ivpmulhuw,
+ UD_Ivpmulhw,
+ UD_Ivpmulld,
+ UD_Ivpmullw,
+ UD_Ivpor,
+ UD_Ivpsadbw,
+ UD_Ivpshufb,
+ UD_Ivpshufd,
+ UD_Ivpshufhw,
+ UD_Ivpshuflw,
+ UD_Ivpsignb,
+ UD_Ivpsignd,
+ UD_Ivpsignw,
+ UD_Ivpslld,
+ UD_Ivpslldq,
+ UD_Ivpsllq,
+ UD_Ivpsllw,
+ UD_Ivpsrad,
+ UD_Ivpsraw,
+ UD_Ivpsrld,
+ UD_Ivpsrldq,
+ UD_Ivpsrlq,
+ UD_Ivpsrlw,
+ UD_Ivpsubb,
+ UD_Ivpsubd,
+ UD_Ivpsubq,
+ UD_Ivpsubsb,
+ UD_Ivpsubsw,
+ UD_Ivpsubusb,
+ UD_Ivpsubusw,
+ UD_Ivpsubw,
+ UD_Ivptest,
+ UD_Ivpunpckhbw,
+ UD_Ivpunpckhdq,
+ UD_Ivpunpckhqdq,
+ UD_Ivpunpckhwd,
+ UD_Ivpunpcklbw,
+ UD_Ivpunpckldq,
+ UD_Ivpunpcklqdq,
+ UD_Ivpunpcklwd,
+ UD_Ivpxor,
+ UD_Ivrcpps,
+ UD_Ivrcpss,
+ UD_Ivroundpd,
+ UD_Ivroundps,
+ UD_Ivroundsd,
+ UD_Ivroundss,
+ UD_Ivrsqrtps,
+ UD_Ivrsqrtss,
+ UD_Ivshufpd,
+ UD_Ivshufps,
+ UD_Ivsqrtpd,
+ UD_Ivsqrtps,
+ UD_Ivsqrtsd,
+ UD_Ivsqrtss,
+ UD_Ivstmxcsr,
+ UD_Ivsubpd,
+ UD_Ivsubps,
+ UD_Ivsubsd,
+ UD_Ivsubss,
+ UD_Ivtestpd,
+ UD_Ivtestps,
+ UD_Ivucomisd,
+ UD_Ivucomiss,
+ UD_Ivunpckhpd,
+ UD_Ivunpckhps,
+ UD_Ivunpcklpd,
+ UD_Ivunpcklps,
+ UD_Ivxorpd,
+ UD_Ivxorps,
+ UD_Ivzeroall,
+ UD_Ivzeroupper,
+ UD_Iwait,
+ UD_Iwbinvd,
+ UD_Iwrmsr,
+ UD_Ixadd,
+ UD_Ixchg,
+ UD_Ixcryptcbc,
+ UD_Ixcryptcfb,
+ UD_Ixcryptctr,
+ UD_Ixcryptecb,
+ UD_Ixcryptofb,
+ UD_Ixgetbv,
+ UD_Ixlatb,
+ UD_Ixor,
+ UD_Ixorpd,
+ UD_Ixorps,
+ UD_Ixrstor,
+ UD_Ixsave,
+ UD_Ixsetbv,
+ UD_Ixsha1,
+ UD_Ixsha256,
+ UD_Ixstore,
+ UD_Iinvalid,
+ UD_I3dnow,
+ UD_Inone,
+ UD_Idb,
+ UD_Ipause,
+ UD_MAX_MNEMONIC_CODE
+};
+
+extern const char * ud_mnemonics_str[];
+
+#endif /* UD_ITAB_H */
diff --git a/ext/opcache/jit/libudis86/syn-att.c b/ext/opcache/jit/libudis86/syn-att.c
new file mode 100644
index 0000000000..d1ba89b7ae
--- /dev/null
+++ b/ext/opcache/jit/libudis86/syn-att.c
@@ -0,0 +1,228 @@
+/* udis86 - libudis86/syn-att.c
+ *
+ * Copyright (c) 2002-2009 Vivek Thampi
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "types.h"
+#include "extern.h"
+#include "decode.h"
+#include "itab.h"
+#include "syn.h"
+#include "udint.h"
+
+/* -----------------------------------------------------------------------------
+ * opr_cast() - Prints an operand cast.
+ * -----------------------------------------------------------------------------
+ */
+static void
+opr_cast(struct ud* u, struct ud_operand* op)
+{
+ switch(op->size) {
+ case 16 : case 32 :
+ ud_asmprintf(u, "*"); break;
+ default: break;
+ }
+}
+
+/* -----------------------------------------------------------------------------
+ * gen_operand() - Generates assembly output for each operand.
+ * -----------------------------------------------------------------------------
+ */
+static void
+gen_operand(struct ud* u, struct ud_operand* op)
+{
+ switch(op->type) {
+ case UD_OP_CONST:
+ ud_asmprintf(u, "$0x%x", op->lval.udword);
+ break;
+
+ case UD_OP_REG:
+ ud_asmprintf(u, "%%%s", ud_reg_tab[op->base - UD_R_AL]);
+ break;
+
+ case UD_OP_MEM:
+ if (u->br_far) {
+ opr_cast(u, op);
+ }
+ if (u->pfx_seg) {
+ ud_asmprintf(u, "%%%s:", ud_reg_tab[u->pfx_seg - UD_R_AL]);
+ }
+ if (op->offset != 0) {
+ ud_syn_print_mem_disp(u, op, 0);
+ }
+ if (op->base) {
+ ud_asmprintf(u, "(%%%s", ud_reg_tab[op->base - UD_R_AL]);
+ }
+ if (op->index) {
+ if (op->base) {
+ ud_asmprintf(u, ",");
+ } else {
+ ud_asmprintf(u, "(");
+ }
+ ud_asmprintf(u, "%%%s", ud_reg_tab[op->index - UD_R_AL]);
+ }
+ if (op->scale) {
+ ud_asmprintf(u, ",%d", op->scale);
+ }
+ if (op->base || op->index) {
+ ud_asmprintf(u, ")");
+ }
+ break;
+
+ case UD_OP_IMM:
+ ud_asmprintf(u, "$");
+ ud_syn_print_imm(u, op);
+ break;
+
+ case UD_OP_JIMM:
+ ud_syn_print_addr(u, ud_syn_rel_target(u, op));
+ break;
+
+ case UD_OP_PTR:
+ switch (op->size) {
+ case 32:
+ ud_asmprintf(u, "$0x%x, $0x%x", op->lval.ptr.seg,
+ op->lval.ptr.off & 0xFFFF);
+ break;
+ case 48:
+ ud_asmprintf(u, "$0x%x, $0x%x", op->lval.ptr.seg,
+ op->lval.ptr.off);
+ break;
+ }
+ break;
+
+ default: return;
+ }
+}
+
+/* =============================================================================
+ * translates to AT&T syntax
+ * =============================================================================
+ */
+extern void
+ud_translate_att(struct ud *u)
+{
+ int size = 0;
+ int star = 0;
+
+ /* check if P_OSO prefix is used */
+ if (! P_OSO(u->itab_entry->prefix) && u->pfx_opr) {
+ switch (u->dis_mode) {
+ case 16:
+ ud_asmprintf(u, "o32 ");
+ break;
+ case 32:
+ case 64:
+ ud_asmprintf(u, "o16 ");
+ break;
+ }
+ }
+
+ /* check if P_ASO prefix was used */
+ if (! P_ASO(u->itab_entry->prefix) && u->pfx_adr) {
+ switch (u->dis_mode) {
+ case 16:
+ ud_asmprintf(u, "a32 ");
+ break;
+ case 32:
+ ud_asmprintf(u, "a16 ");
+ break;
+ case 64:
+ ud_asmprintf(u, "a32 ");
+ break;
+ }
+ }
+
+ if (u->pfx_lock)
+ ud_asmprintf(u, "lock ");
+ if (u->pfx_rep) {
+ ud_asmprintf(u, "rep ");
+ } else if (u->pfx_repe) {
+ ud_asmprintf(u, "repe ");
+ } else if (u->pfx_repne) {
+ ud_asmprintf(u, "repne ");
+ }
+
+ /* special instructions */
+ switch (u->mnemonic) {
+ case UD_Iretf:
+ ud_asmprintf(u, "lret ");
+ break;
+ case UD_Idb:
+ ud_asmprintf(u, ".byte 0x%x", u->operand[0].lval.ubyte);
+ return;
+ case UD_Ijmp:
+ case UD_Icall:
+ if (u->br_far) ud_asmprintf(u, "l");
+ if (u->operand[0].type == UD_OP_REG) {
+ star = 1;
+ }
+ ud_asmprintf(u, "%s", ud_lookup_mnemonic(u->mnemonic));
+ break;
+ case UD_Ibound:
+ case UD_Ienter:
+ if (u->operand[0].type != UD_NONE)
+ gen_operand(u, &u->operand[0]);
+ if (u->operand[1].type != UD_NONE) {
+ ud_asmprintf(u, ",");
+ gen_operand(u, &u->operand[1]);
+ }
+ return;
+ default:
+ ud_asmprintf(u, "%s", ud_lookup_mnemonic(u->mnemonic));
+ }
+
+ if (size == 8) {
+ ud_asmprintf(u, "b");
+ } else if (size == 16) {
+ ud_asmprintf(u, "w");
+ } else if (size == 64) {
+ ud_asmprintf(u, "q");
+ }
+
+ if (star) {
+ ud_asmprintf(u, " *");
+ } else {
+ ud_asmprintf(u, " ");
+ }
+
+ if (u->operand[3].type != UD_NONE) {
+ gen_operand(u, &u->operand[3]);
+ ud_asmprintf(u, ", ");
+ }
+ if (u->operand[2].type != UD_NONE) {
+ gen_operand(u, &u->operand[2]);
+ ud_asmprintf(u, ", ");
+ }
+ if (u->operand[1].type != UD_NONE) {
+ gen_operand(u, &u->operand[1]);
+ ud_asmprintf(u, ", ");
+ }
+ if (u->operand[0].type != UD_NONE) {
+ gen_operand(u, &u->operand[0]);
+ }
+}
+
+/*
+vim: set ts=2 sw=2 expandtab
+*/
diff --git a/ext/opcache/jit/libudis86/syn-intel.c b/ext/opcache/jit/libudis86/syn-intel.c
new file mode 100644
index 0000000000..0664fea092
--- /dev/null
+++ b/ext/opcache/jit/libudis86/syn-intel.c
@@ -0,0 +1,224 @@
+/* udis86 - libudis86/syn-intel.c
+ *
+ * Copyright (c) 2002-2013 Vivek Thampi
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "types.h"
+#include "extern.h"
+#include "decode.h"
+#include "itab.h"
+#include "syn.h"
+#include "udint.h"
+
+/* -----------------------------------------------------------------------------
+ * opr_cast() - Prints an operand cast.
+ * -----------------------------------------------------------------------------
+ */
+static void
+opr_cast(struct ud* u, struct ud_operand* op)
+{
+ if (u->br_far) {
+ ud_asmprintf(u, "far ");
+ }
+ switch(op->size) {
+ case 8: ud_asmprintf(u, "byte " ); break;
+ case 16: ud_asmprintf(u, "word " ); break;
+ case 32: ud_asmprintf(u, "dword "); break;
+ case 64: ud_asmprintf(u, "qword "); break;
+ case 80: ud_asmprintf(u, "tword "); break;
+ case 128: ud_asmprintf(u, "oword "); break;
+ case 256: ud_asmprintf(u, "yword "); break;
+ default: break;
+ }
+}
+
+/* -----------------------------------------------------------------------------
+ * gen_operand() - Generates assembly output for each operand.
+ * -----------------------------------------------------------------------------
+ */
+static void gen_operand(struct ud* u, struct ud_operand* op, int syn_cast)
+{
+ switch(op->type) {
+ case UD_OP_REG:
+ ud_asmprintf(u, "%s", ud_reg_tab[op->base - UD_R_AL]);
+ break;
+
+ case UD_OP_MEM:
+ if (syn_cast) {
+ opr_cast(u, op);
+ }
+ ud_asmprintf(u, "[");
+ if (u->pfx_seg) {
+ ud_asmprintf(u, "%s:", ud_reg_tab[u->pfx_seg - UD_R_AL]);
+ }
+ if (op->base) {
+ ud_asmprintf(u, "%s", ud_reg_tab[op->base - UD_R_AL]);
+ }
+ if (op->index) {
+ ud_asmprintf(u, "%s%s", op->base != UD_NONE? "+" : "",
+ ud_reg_tab[op->index - UD_R_AL]);
+ if (op->scale) {
+ ud_asmprintf(u, "*%d", op->scale);
+ }
+ }
+ if (op->offset != 0) {
+ ud_syn_print_mem_disp(u, op, (op->base != UD_NONE ||
+ op->index != UD_NONE) ? 1 : 0);
+ }
+ ud_asmprintf(u, "]");
+ break;
+
+ case UD_OP_IMM:
+ ud_syn_print_imm(u, op);
+ break;
+
+
+ case UD_OP_JIMM:
+ ud_syn_print_addr(u, ud_syn_rel_target(u, op));
+ break;
+
+ case UD_OP_PTR:
+ switch (op->size) {
+ case 32:
+ ud_asmprintf(u, "word 0x%x:0x%x", op->lval.ptr.seg,
+ op->lval.ptr.off & 0xFFFF);
+ break;
+ case 48:
+ ud_asmprintf(u, "dword 0x%x:0x%x", op->lval.ptr.seg,
+ op->lval.ptr.off);
+ break;
+ }
+ break;
+
+ case UD_OP_CONST:
+ if (syn_cast) opr_cast(u, op);
+ ud_asmprintf(u, "%d", op->lval.udword);
+ break;
+
+ default: return;
+ }
+}
+
+/* =============================================================================
+ * translates to intel syntax
+ * =============================================================================
+ */
+extern void
+ud_translate_intel(struct ud* u)
+{
+ /* check if P_OSO prefix is used */
+ if (!P_OSO(u->itab_entry->prefix) && u->pfx_opr) {
+ switch (u->dis_mode) {
+ case 16: ud_asmprintf(u, "o32 "); break;
+ case 32:
+ case 64: ud_asmprintf(u, "o16 "); break;
+ }
+ }
+
+ /* check if P_ASO prefix was used */
+ if (!P_ASO(u->itab_entry->prefix) && u->pfx_adr) {
+ switch (u->dis_mode) {
+ case 16: ud_asmprintf(u, "a32 "); break;
+ case 32: ud_asmprintf(u, "a16 "); break;
+ case 64: ud_asmprintf(u, "a32 "); break;
+ }
+ }
+
+ if (u->pfx_seg &&
+ u->operand[0].type != UD_OP_MEM &&
+ u->operand[1].type != UD_OP_MEM ) {
+ ud_asmprintf(u, "%s ", ud_reg_tab[u->pfx_seg - UD_R_AL]);
+ }
+
+ if (u->pfx_lock) {
+ ud_asmprintf(u, "lock ");
+ }
+ if (u->pfx_rep) {
+ ud_asmprintf(u, "rep ");
+ } else if (u->pfx_repe) {
+ ud_asmprintf(u, "repe ");
+ } else if (u->pfx_repne) {
+ ud_asmprintf(u, "repne ");
+ }
+
+ /* print the instruction mnemonic */
+ ud_asmprintf(u, "%s", ud_lookup_mnemonic(u->mnemonic));
+
+ if (u->operand[0].type != UD_NONE) {
+ int cast = 0;
+ ud_asmprintf(u, " ");
+ if (u->operand[0].type == UD_OP_MEM) {
+ if (u->operand[1].type == UD_OP_IMM ||
+ u->operand[1].type == UD_OP_CONST ||
+ u->operand[1].type == UD_NONE ||
+ (u->operand[0].size != u->operand[1].size)) {
+ cast = 1;
+ } else if (u->operand[1].type == UD_OP_REG &&
+ u->operand[1].base == UD_R_CL) {
+ switch (u->mnemonic) {
+ case UD_Ircl:
+ case UD_Irol:
+ case UD_Iror:
+ case UD_Ircr:
+ case UD_Ishl:
+ case UD_Ishr:
+ case UD_Isar:
+ cast = 1;
+ break;
+ default: break;
+ }
+ }
+ }
+ gen_operand(u, &u->operand[0], cast);
+ }
+
+ if (u->operand[1].type != UD_NONE) {
+ int cast = 0;
+ ud_asmprintf(u, ", ");
+ if (u->operand[1].type == UD_OP_MEM &&
+ u->operand[0].size != u->operand[1].size &&
+ !ud_opr_is_sreg(&u->operand[0])) {
+ cast = 1;
+ }
+ gen_operand(u, &u->operand[1], cast);
+ }
+
+ if (u->operand[2].type != UD_NONE) {
+ int cast = 0;
+ ud_asmprintf(u, ", ");
+ if (u->operand[2].type == UD_OP_MEM &&
+ u->operand[2].size != u->operand[1].size) {
+ cast = 1;
+ }
+ gen_operand(u, &u->operand[2], cast);
+ }
+
+ if (u->operand[3].type != UD_NONE) {
+ ud_asmprintf(u, ", ");
+ gen_operand(u, &u->operand[3], 0);
+ }
+}
+
+/*
+vim: set ts=2 sw=2 expandtab
+*/
diff --git a/ext/opcache/jit/libudis86/syn.c b/ext/opcache/jit/libudis86/syn.c
new file mode 100644
index 0000000000..c7453d63b7
--- /dev/null
+++ b/ext/opcache/jit/libudis86/syn.c
@@ -0,0 +1,258 @@
+/* udis86 - libudis86/syn.c
+ *
+ * Copyright (c) 2002-2013 Vivek Thampi
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "types.h"
+#include "decode.h"
+#include "syn.h"
+#include "udint.h"
+
+/*
+ * Register Table - Order Matters (types.h)!
+ *
+ */
+const char* ud_reg_tab[] =
+{
+ "al", "cl", "dl", "bl",
+ "ah", "ch", "dh", "bh",
+ "spl", "bpl", "sil", "dil",
+ "r8b", "r9b", "r10b", "r11b",
+ "r12b", "r13b", "r14b", "r15b",
+
+ "ax", "cx", "dx", "bx",
+ "sp", "bp", "si", "di",
+ "r8w", "r9w", "r10w", "r11w",
+ "r12w", "r13w", "r14w", "r15w",
+
+ "eax", "ecx", "edx", "ebx",
+ "esp", "ebp", "esi", "edi",
+ "r8d", "r9d", "r10d", "r11d",
+ "r12d", "r13d", "r14d", "r15d",
+
+ "rax", "rcx", "rdx", "rbx",
+ "rsp", "rbp", "rsi", "rdi",
+ "r8", "r9", "r10", "r11",
+ "r12", "r13", "r14", "r15",
+
+ "es", "cs", "ss", "ds",
+ "fs", "gs",
+
+ "cr0", "cr1", "cr2", "cr3",
+ "cr4", "cr5", "cr6", "cr7",
+ "cr8", "cr9", "cr10", "cr11",
+ "cr12", "cr13", "cr14", "cr15",
+
+ "dr0", "dr1", "dr2", "dr3",
+ "dr4", "dr5", "dr6", "dr7",
+ "dr8", "dr9", "dr10", "dr11",
+ "dr12", "dr13", "dr14", "dr15",
+
+ "mm0", "mm1", "mm2", "mm3",
+ "mm4", "mm5", "mm6", "mm7",
+
+ "st0", "st1", "st2", "st3",
+ "st4", "st5", "st6", "st7",
+
+ "xmm0", "xmm1", "xmm2", "xmm3",
+ "xmm4", "xmm5", "xmm6", "xmm7",
+ "xmm8", "xmm9", "xmm10", "xmm11",
+ "xmm12", "xmm13", "xmm14", "xmm15",
+
+ "ymm0", "ymm1", "ymm2", "ymm3",
+ "ymm4", "ymm5", "ymm6", "ymm7",
+ "ymm8", "ymm9", "ymm10", "ymm11",
+ "ymm12", "ymm13", "ymm14", "ymm15",
+
+ "rip"
+};
+
+
+uint64_t
+ud_syn_rel_target(struct ud *u, struct ud_operand *opr)
+{
+#if 1
+ const uint64_t trunc_mask = 0xffffffffffffffffull >> (64 - u->adr_mode);
+#else
+ const uint64_t trunc_mask = 0xffffffffffffffffull >> (64 - u->opr_mode);
+#endif
+ switch (opr->size) {
+ case 8 : return (u->pc + opr->lval.sbyte) & trunc_mask;
+ case 16: return (u->pc + opr->lval.sword) & trunc_mask;
+ case 32: return (u->pc + opr->lval.sdword) & trunc_mask;
+ default: UD_ASSERT(!"invalid relative offset size.");
+ return 0ull;
+ }
+}
+
+
+/*
+ * asmprintf
+ * Printf style function for printing translated assembly
+ * output. Returns the number of characters written and
+ * moves the buffer pointer forward. On an overflow,
+ * returns a negative number and truncates the output.
+ */
+int
+ud_asmprintf(struct ud *u, const char *fmt, ...)
+{
+ int ret;
+ int avail;
+ va_list ap;
+ va_start(ap, fmt);
+ avail = u->asm_buf_size - u->asm_buf_fill - 1 /* nullchar */;
+ ret = vsnprintf((char*) u->asm_buf + u->asm_buf_fill, avail, fmt, ap);
+ if (ret < 0 || ret > avail) {
+ u->asm_buf_fill = u->asm_buf_size - 1;
+ } else {
+ u->asm_buf_fill += ret;
+ }
+ va_end(ap);
+ return ret;
+}
+
+
+void
+ud_syn_print_addr(struct ud *u, uint64_t addr)
+{
+ const char *name = NULL;
+ if (u->sym_resolver) {
+ int64_t offset = 0;
+ name = u->sym_resolver(u, addr, &offset);
+ if (name) {
+ if (offset) {
+ ud_asmprintf(u, "%s%+" FMT64 "d", name, offset);
+ } else {
+ ud_asmprintf(u, "%s", name);
+ }
+ return;
+ }
+ }
+ ud_asmprintf(u, "0x%" FMT64 "x", addr);
+}
+
+
+void
+ud_syn_print_imm(struct ud* u, const struct ud_operand *op)
+{
+ uint64_t v;
+ if (op->_oprcode == OP_sI && op->size != u->opr_mode) {
+ if (op->size == 8) {
+ v = (int64_t)op->lval.sbyte;
+ } else {
+ UD_ASSERT(op->size == 32);
+ v = (int64_t)op->lval.sdword;
+ }
+ if (u->opr_mode < 64) {
+ v = v & ((1ull << u->opr_mode) - 1ull);
+ }
+ } else {
+ switch (op->size) {
+ case 8 : v = op->lval.ubyte; break;
+ case 16: v = op->lval.uword; break;
+ case 32: v = op->lval.udword; break;
+ case 64: v = op->lval.uqword; break;
+ default: UD_ASSERT(!"invalid offset"); v = 0; /* keep cc happy */
+ }
+ }
+#if 1
+ if (u->sym_resolver) {
+ int64_t offset = 0;
+ const char *name = u->sym_resolver(u, v, &offset);
+ if (name) {
+ if (offset) {
+ ud_asmprintf(u, "%s%+" FMT64 "d", name, offset);
+ } else {
+ ud_asmprintf(u, "%s", name);
+ }
+ return;
+ }
+ }
+#endif
+ ud_asmprintf(u, "0x%" FMT64 "x", v);
+}
+
+
+void
+ud_syn_print_mem_disp(struct ud* u, const struct ud_operand *op, int sign)
+{
+ UD_ASSERT(op->offset != 0);
+ if (op->base == UD_NONE && op->index == UD_NONE) {
+ uint64_t v;
+ UD_ASSERT(op->scale == UD_NONE && op->offset != 8);
+ /* unsigned mem-offset */
+ switch (op->offset) {
+ case 16: v = op->lval.uword; break;
+ case 32: v = op->lval.udword; break;
+ case 64: v = op->lval.uqword; break;
+ default: UD_ASSERT(!"invalid offset"); v = 0; /* keep cc happy */
+ }
+#if 1
+ if (u->sym_resolver) {
+ int64_t offset = 0;
+ const char *name = u->sym_resolver(u, v, &offset);
+ if (name) {
+ if (offset) {
+ ud_asmprintf(u, "%s%+" FMT64 "d", name, offset);
+ } else {
+ ud_asmprintf(u, "%s", name);
+ }
+ return;
+ }
+ }
+#endif
+ ud_asmprintf(u, "0x%" FMT64 "x", v);
+ } else {
+ int64_t v;
+ UD_ASSERT(op->offset != 64);
+ switch (op->offset) {
+ case 8 : v = op->lval.sbyte; break;
+ case 16: v = op->lval.sword; break;
+ case 32: v = op->lval.sdword; break;
+ default: UD_ASSERT(!"invalid offset"); v = 0; /* keep cc happy */
+ }
+#if 1
+ if (u->sym_resolver) {
+ int64_t offset = 0;
+ const char *name = u->sym_resolver(u, v, &offset);
+ if (name) {
+ if (offset) {
+ ud_asmprintf(u, "%s%+" FMT64 "d", name, offset);
+ } else {
+ ud_asmprintf(u, "%s", name);
+ }
+ return;
+ }
+ }
+#endif
+ if (v < 0) {
+ ud_asmprintf(u, "-0x%" FMT64 "x", -v);
+ } else if (v > 0) {
+ ud_asmprintf(u, "%s0x%" FMT64 "x", sign? "+" : "", v);
+ }
+ }
+}
+
+/*
+vim: set ts=2 sw=2 expandtab
+*/
diff --git a/ext/opcache/jit/libudis86/syn.h b/ext/opcache/jit/libudis86/syn.h
new file mode 100644
index 0000000000..d3b1e3fe04
--- /dev/null
+++ b/ext/opcache/jit/libudis86/syn.h
@@ -0,0 +1,53 @@
+/* udis86 - libudis86/syn.h
+ *
+ * Copyright (c) 2002-2009
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef UD_SYN_H
+#define UD_SYN_H
+
+#include "types.h"
+#ifndef __UD_STANDALONE__
+# include <stdarg.h>
+#endif /* __UD_STANDALONE__ */
+
+extern const char* ud_reg_tab[];
+
+uint64_t ud_syn_rel_target(struct ud*, struct ud_operand*);
+
+#ifdef __GNUC__
+int ud_asmprintf(struct ud *u, const char *fmt, ...)
+ __attribute__ ((format (printf, 2, 3)));
+#else
+int ud_asmprintf(struct ud *u, const char *fmt, ...);
+#endif
+
+void ud_syn_print_addr(struct ud *u, uint64_t addr);
+void ud_syn_print_imm(struct ud* u, const struct ud_operand *op);
+void ud_syn_print_mem_disp(struct ud* u, const struct ud_operand *, int sign);
+
+#endif /* UD_SYN_H */
+
+/*
+vim: set ts=2 sw=2 expandtab
+*/
diff --git a/ext/opcache/jit/libudis86/types.h b/ext/opcache/jit/libudis86/types.h
new file mode 100644
index 0000000000..69072ca480
--- /dev/null
+++ b/ext/opcache/jit/libudis86/types.h
@@ -0,0 +1,260 @@
+/* udis86 - libudis86/types.h
+ *
+ * Copyright (c) 2002-2013 Vivek Thampi
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef UD_TYPES_H
+#define UD_TYPES_H
+
+#ifdef __KERNEL__
+ /*
+ * -D__KERNEL__ is automatically passed on the command line when
+ * building something as part of the Linux kernel. Assume standalone
+ * mode.
+ */
+# include <linux/kernel.h>
+# include <linux/string.h>
+# ifndef __UD_STANDALONE__
+# define __UD_STANDALONE__ 1
+# endif
+#endif /* __KERNEL__ */
+
+#if !defined(__UD_STANDALONE__)
+# include <stdint.h>
+# include <stdio.h>
+#endif
+
+/* gcc specific extensions */
+#ifdef __GNUC__
+# define UD_ATTR_PACKED __attribute__((packed))
+#else
+# define UD_ATTR_PACKED
+#endif /* UD_ATTR_PACKED */
+
+
+/* -----------------------------------------------------------------------------
+ * All possible "types" of objects in udis86. Order is Important!
+ * -----------------------------------------------------------------------------
+ */
+enum ud_type
+{
+ UD_NONE,
+
+ /* 8 bit GPRs */
+ UD_R_AL, UD_R_CL, UD_R_DL, UD_R_BL,
+ UD_R_AH, UD_R_CH, UD_R_DH, UD_R_BH,
+ UD_R_SPL, UD_R_BPL, UD_R_SIL, UD_R_DIL,
+ UD_R_R8B, UD_R_R9B, UD_R_R10B, UD_R_R11B,
+ UD_R_R12B, UD_R_R13B, UD_R_R14B, UD_R_R15B,
+
+ /* 16 bit GPRs */
+ UD_R_AX, UD_R_CX, UD_R_DX, UD_R_BX,
+ UD_R_SP, UD_R_BP, UD_R_SI, UD_R_DI,
+ UD_R_R8W, UD_R_R9W, UD_R_R10W, UD_R_R11W,
+ UD_R_R12W, UD_R_R13W, UD_R_R14W, UD_R_R15W,
+
+ /* 32 bit GPRs */
+ UD_R_EAX, UD_R_ECX, UD_R_EDX, UD_R_EBX,
+ UD_R_ESP, UD_R_EBP, UD_R_ESI, UD_R_EDI,
+ UD_R_R8D, UD_R_R9D, UD_R_R10D, UD_R_R11D,
+ UD_R_R12D, UD_R_R13D, UD_R_R14D, UD_R_R15D,
+
+ /* 64 bit GPRs */
+ UD_R_RAX, UD_R_RCX, UD_R_RDX, UD_R_RBX,
+ UD_R_RSP, UD_R_RBP, UD_R_RSI, UD_R_RDI,
+ UD_R_R8, UD_R_R9, UD_R_R10, UD_R_R11,
+ UD_R_R12, UD_R_R13, UD_R_R14, UD_R_R15,
+
+ /* segment registers */
+ UD_R_ES, UD_R_CS, UD_R_SS, UD_R_DS,
+ UD_R_FS, UD_R_GS,
+
+ /* control registers*/
+ UD_R_CR0, UD_R_CR1, UD_R_CR2, UD_R_CR3,
+ UD_R_CR4, UD_R_CR5, UD_R_CR6, UD_R_CR7,
+ UD_R_CR8, UD_R_CR9, UD_R_CR10, UD_R_CR11,
+ UD_R_CR12, UD_R_CR13, UD_R_CR14, UD_R_CR15,
+
+ /* debug registers */
+ UD_R_DR0, UD_R_DR1, UD_R_DR2, UD_R_DR3,
+ UD_R_DR4, UD_R_DR5, UD_R_DR6, UD_R_DR7,
+ UD_R_DR8, UD_R_DR9, UD_R_DR10, UD_R_DR11,
+ UD_R_DR12, UD_R_DR13, UD_R_DR14, UD_R_DR15,
+
+ /* mmx registers */
+ UD_R_MM0, UD_R_MM1, UD_R_MM2, UD_R_MM3,
+ UD_R_MM4, UD_R_MM5, UD_R_MM6, UD_R_MM7,
+
+ /* x87 registers */
+ UD_R_ST0, UD_R_ST1, UD_R_ST2, UD_R_ST3,
+ UD_R_ST4, UD_R_ST5, UD_R_ST6, UD_R_ST7,
+
+ /* extended multimedia registers */
+ UD_R_XMM0, UD_R_XMM1, UD_R_XMM2, UD_R_XMM3,
+ UD_R_XMM4, UD_R_XMM5, UD_R_XMM6, UD_R_XMM7,
+ UD_R_XMM8, UD_R_XMM9, UD_R_XMM10, UD_R_XMM11,
+ UD_R_XMM12, UD_R_XMM13, UD_R_XMM14, UD_R_XMM15,
+
+ /* 256B multimedia registers */
+ UD_R_YMM0, UD_R_YMM1, UD_R_YMM2, UD_R_YMM3,
+ UD_R_YMM4, UD_R_YMM5, UD_R_YMM6, UD_R_YMM7,
+ UD_R_YMM8, UD_R_YMM9, UD_R_YMM10, UD_R_YMM11,
+ UD_R_YMM12, UD_R_YMM13, UD_R_YMM14, UD_R_YMM15,
+
+ UD_R_RIP,
+
+ /* Operand Types */
+ UD_OP_REG, UD_OP_MEM, UD_OP_PTR, UD_OP_IMM,
+ UD_OP_JIMM, UD_OP_CONST
+};
+
+#include "itab.h"
+
+union ud_lval {
+ int8_t sbyte;
+ uint8_t ubyte;
+ int16_t sword;
+ uint16_t uword;
+ int32_t sdword;
+ uint32_t udword;
+ int64_t sqword;
+ uint64_t uqword;
+ struct {
+ uint16_t seg;
+ uint32_t off;
+ } ptr;
+};
+
+/* -----------------------------------------------------------------------------
+ * struct ud_operand - Disassembled instruction Operand.
+ * -----------------------------------------------------------------------------
+ */
+struct ud_operand {
+ enum ud_type type;
+ uint16_t size;
+ enum ud_type base;
+ enum ud_type index;
+ uint8_t scale;
+ uint8_t offset;
+ union ud_lval lval;
+ /*
+ * internal use only
+ */
+ uint64_t _legacy; /* this will be removed in 1.8 */
+ uint8_t _oprcode;
+};
+
+/* -----------------------------------------------------------------------------
+ * struct ud - The udis86 object.
+ * -----------------------------------------------------------------------------
+ */
+struct ud
+{
+ /*
+ * input buffering
+ */
+ int (*inp_hook) (struct ud*);
+#ifndef __UD_STANDALONE__
+ FILE* inp_file;
+#endif
+ const uint8_t* inp_buf;
+ size_t inp_buf_size;
+ size_t inp_buf_index;
+ uint8_t inp_curr;
+ size_t inp_ctr;
+ uint8_t inp_sess[64];
+ int inp_end;
+ int inp_peek;
+
+ void (*translator)(struct ud*);
+ uint64_t insn_offset;
+ char insn_hexcode[64];
+
+ /*
+ * Assembly output buffer
+ */
+ char *asm_buf;
+ size_t asm_buf_size;
+ size_t asm_buf_fill;
+ char asm_buf_int[128];
+
+ /*
+ * Symbol resolver for use in the translation phase.
+ */
+ const char* (*sym_resolver)(struct ud*, uint64_t addr, int64_t *offset);
+
+ uint8_t dis_mode;
+ uint64_t pc;
+ uint8_t vendor;
+ enum ud_mnemonic_code mnemonic;
+ struct ud_operand operand[4];
+ uint8_t error;
+ uint8_t _rex;
+ uint8_t pfx_rex;
+ uint8_t pfx_seg;
+ uint8_t pfx_opr;
+ uint8_t pfx_adr;
+ uint8_t pfx_lock;
+ uint8_t pfx_str;
+ uint8_t pfx_rep;
+ uint8_t pfx_repe;
+ uint8_t pfx_repne;
+ uint8_t opr_mode;
+ uint8_t adr_mode;
+ uint8_t br_far;
+ uint8_t br_near;
+ uint8_t have_modrm;
+ uint8_t modrm;
+ uint8_t modrm_offset;
+ uint8_t vex_op;
+ uint8_t vex_b1;
+ uint8_t vex_b2;
+ uint8_t primary_opcode;
+ void * user_opaque_data;
+ struct ud_itab_entry * itab_entry;
+ struct ud_lookup_table_list_entry *le;
+};
+
+/* -----------------------------------------------------------------------------
+ * Type-definitions
+ * -----------------------------------------------------------------------------
+ */
+typedef enum ud_type ud_type_t;
+typedef enum ud_mnemonic_code ud_mnemonic_code_t;
+
+typedef struct ud ud_t;
+typedef struct ud_operand ud_operand_t;
+
+#define UD_SYN_INTEL ud_translate_intel
+#define UD_SYN_ATT ud_translate_att
+#define UD_EOI (-1)
+#define UD_INP_CACHE_SZ 32
+#define UD_VENDOR_AMD 0
+#define UD_VENDOR_INTEL 1
+#define UD_VENDOR_ANY 2
+
+#endif
+
+/*
+vim: set ts=2 sw=2 expandtab
+*/
diff --git a/ext/opcache/jit/libudis86/udint.h b/ext/opcache/jit/libudis86/udint.h
new file mode 100644
index 0000000000..734f0eaa82
--- /dev/null
+++ b/ext/opcache/jit/libudis86/udint.h
@@ -0,0 +1,99 @@
+/* udis86 - libudis86/udint.h -- definitions for internal use only
+ *
+ * Copyright (c) 2002-2009 Vivek Thampi
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef _UDINT_H_
+#define _UDINT_H_
+
+#include "types.h"
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif /* HAVE_CONFIG_H */
+
+#if defined(UD_DEBUG) && HAVE_ASSERT_H
+# include <assert.h>
+# define UD_ASSERT(_x) assert(_x)
+#else
+# define UD_ASSERT(_x)
+#endif /* !HAVE_ASSERT_H */
+
+#if defined(UD_DEBUG)
+ #define UDERR(u, msg) \
+ do { \
+ (u)->error = 1; \
+ fprintf(stderr, "decode-error: %s:%d: %s", \
+ __FILE__, __LINE__, (msg)); \
+ } while (0)
+#else
+ #define UDERR(u, m) \
+ do { \
+ (u)->error = 1; \
+ } while (0)
+#endif /* !LOGERR */
+
+#define UD_RETURN_ON_ERROR(u) \
+ do { \
+ if ((u)->error != 0) { \
+ return (u)->error; \
+ } \
+ } while (0)
+
+#define UD_RETURN_WITH_ERROR(u, m) \
+ do { \
+ UDERR(u, m); \
+ return (u)->error; \
+ } while (0)
+
+#ifndef __UD_STANDALONE__
+# define UD_NON_STANDALONE(x) x
+#else
+# define UD_NON_STANDALONE(x)
+#endif
+
+/* printf formatting int64 specifier */
+#ifdef FMT64
+# undef FMT64
+#endif
+#if defined(_MSC_VER) || defined(__BORLANDC__)
+# define FMT64 "I64"
+#else
+# if defined(__APPLE__)
+# define FMT64 "ll"
+# elif defined(__amd64__) || defined(__x86_64__)
+# define FMT64 "l"
+# else
+# define FMT64 "ll"
+# endif /* !x64 */
+#endif
+
+/* define an inline macro */
+#if defined(_MSC_VER) || defined(__BORLANDC__)
+# define UD_INLINE __inline /* MS Visual Studio requires __inline
+ instead of inline for C code */
+#else
+# define UD_INLINE inline
+#endif
+
+#endif /* _UDINT_H_ */
diff --git a/ext/opcache/jit/libudis86/udis86.c b/ext/opcache/jit/libudis86/udis86.c
new file mode 100644
index 0000000000..0e00729feb
--- /dev/null
+++ b/ext/opcache/jit/libudis86/udis86.c
@@ -0,0 +1,458 @@
+/* udis86 - libudis86/udis86.c
+ *
+ * Copyright (c) 2002-2013 Vivek Thampi
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "udint.h"
+#include "extern.h"
+#include "decode.h"
+
+#if !defined(__UD_STANDALONE__)
+# if HAVE_STRING_H
+# include <string.h>
+# endif
+#endif /* !__UD_STANDALONE__ */
+
+static void ud_inp_init(struct ud *u);
+
+/* =============================================================================
+ * ud_init
+ * Initializes ud_t object.
+ * =============================================================================
+ */
+extern void
+ud_init(struct ud* u)
+{
+ memset((void*)u, 0, sizeof(struct ud));
+ ud_set_mode(u, 16);
+ u->mnemonic = UD_Iinvalid;
+ ud_set_pc(u, 0);
+#ifndef __UD_STANDALONE__
+ ud_set_input_file(u, stdin);
+#endif /* __UD_STANDALONE__ */
+
+ ud_set_asm_buffer(u, u->asm_buf_int, sizeof(u->asm_buf_int));
+}
+
+
+/* =============================================================================
+ * ud_disassemble
+ * Disassembles one instruction and returns the number of
+ * bytes disassembled. A zero means end of disassembly.
+ * =============================================================================
+ */
+extern unsigned int
+ud_disassemble(struct ud* u)
+{
+ int len;
+ if (u->inp_end) {
+ return 0;
+ }
+ if ((len = ud_decode(u)) > 0) {
+ if (u->translator != NULL) {
+ u->asm_buf[0] = '\0';
+ u->translator(u);
+ }
+ }
+ return len;
+}
+
+
+/* =============================================================================
+ * ud_set_mode() - Set Disassemly Mode.
+ * =============================================================================
+ */
+extern void
+ud_set_mode(struct ud* u, uint8_t m)
+{
+ switch(m) {
+ case 16:
+ case 32:
+ case 64: u->dis_mode = m ; return;
+ default: u->dis_mode = 16; return;
+ }
+}
+
+/* =============================================================================
+ * ud_set_vendor() - Set vendor.
+ * =============================================================================
+ */
+extern void
+ud_set_vendor(struct ud* u, unsigned v)
+{
+ switch(v) {
+ case UD_VENDOR_INTEL:
+ u->vendor = v;
+ break;
+ case UD_VENDOR_ANY:
+ u->vendor = v;
+ break;
+ default:
+ u->vendor = UD_VENDOR_AMD;
+ }
+}
+
+/* =============================================================================
+ * ud_set_pc() - Sets code origin.
+ * =============================================================================
+ */
+extern void
+ud_set_pc(struct ud* u, uint64_t o)
+{
+ u->pc = o;
+}
+
+/* =============================================================================
+ * ud_set_syntax() - Sets the output syntax.
+ * =============================================================================
+ */
+extern void
+ud_set_syntax(struct ud* u, void (*t)(struct ud*))
+{
+ u->translator = t;
+}
+
+/* =============================================================================
+ * ud_insn() - returns the disassembled instruction
+ * =============================================================================
+ */
+const char*
+ud_insn_asm(const struct ud* u)
+{
+ return u->asm_buf;
+}
+
+/* =============================================================================
+ * ud_insn_offset() - Returns the offset.
+ * =============================================================================
+ */
+uint64_t
+ud_insn_off(const struct ud* u)
+{
+ return u->insn_offset;
+}
+
+
+/* =============================================================================
+ * ud_insn_hex() - Returns hex form of disassembled instruction.
+ * =============================================================================
+ */
+const char*
+ud_insn_hex(struct ud* u)
+{
+ u->insn_hexcode[0] = 0;
+ if (!u->error) {
+ unsigned int i;
+ const unsigned char *src_ptr = ud_insn_ptr(u);
+ char* src_hex;
+ src_hex = (char*) u->insn_hexcode;
+ /* for each byte used to decode instruction */
+ for (i = 0; i < ud_insn_len(u) && i < sizeof(u->insn_hexcode) / 2;
+ ++i, ++src_ptr) {
+ sprintf(src_hex, "%02x", *src_ptr & 0xFF);
+ src_hex += 2;
+ }
+ }
+ return u->insn_hexcode;
+}
+
+
+/* =============================================================================
+ * ud_insn_ptr
+ * Returns a pointer to buffer containing the bytes that were
+ * disassembled.
+ * =============================================================================
+ */
+extern const uint8_t*
+ud_insn_ptr(const struct ud* u)
+{
+ return (u->inp_buf == NULL) ?
+ u->inp_sess : u->inp_buf + (u->inp_buf_index - u->inp_ctr);
+}
+
+
+/* =============================================================================
+ * ud_insn_len
+ * Returns the count of bytes disassembled.
+ * =============================================================================
+ */
+extern unsigned int
+ud_insn_len(const struct ud* u)
+{
+ return u->inp_ctr;
+}
+
+
+/* =============================================================================
+ * ud_insn_get_opr
+ * Return the operand struct representing the nth operand of
+ * the currently disassembled instruction. Returns NULL if
+ * there's no such operand.
+ * =============================================================================
+ */
+const struct ud_operand*
+ud_insn_opr(const struct ud *u, unsigned int n)
+{
+ if (n > 3 || u->operand[n].type == UD_NONE) {
+ return NULL;
+ } else {
+ return &u->operand[n];
+ }
+}
+
+
+/* =============================================================================
+ * ud_opr_is_sreg
+ * Returns non-zero if the given operand is of a segment register type.
+ * =============================================================================
+ */
+int
+ud_opr_is_sreg(const struct ud_operand *opr)
+{
+ return opr->type == UD_OP_REG &&
+ opr->base >= UD_R_ES &&
+ opr->base <= UD_R_GS;
+}
+
+
+/* =============================================================================
+ * ud_opr_is_sreg
+ * Returns non-zero if the given operand is of a general purpose
+ * register type.
+ * =============================================================================
+ */
+int
+ud_opr_is_gpr(const struct ud_operand *opr)
+{
+ return opr->type == UD_OP_REG &&
+ opr->base >= UD_R_AL &&
+ opr->base <= UD_R_R15;
+}
+
+
+/* =============================================================================
+ * ud_set_user_opaque_data
+ * ud_get_user_opaque_data
+ * Get/set user opaqute data pointer
+ * =============================================================================
+ */
+void
+ud_set_user_opaque_data(struct ud * u, void* opaque)
+{
+ u->user_opaque_data = opaque;
+}
+
+void*
+ud_get_user_opaque_data(const struct ud *u)
+{
+ return u->user_opaque_data;
+}
+
+
+/* =============================================================================
+ * ud_set_asm_buffer
+ * Allow the user to set an assembler output buffer. If `buf` is NULL,
+ * we switch back to the internal buffer.
+ * =============================================================================
+ */
+void
+ud_set_asm_buffer(struct ud *u, char *buf, size_t size)
+{
+ if (buf == NULL) {
+ ud_set_asm_buffer(u, u->asm_buf_int, sizeof(u->asm_buf_int));
+ } else {
+ u->asm_buf = buf;
+ u->asm_buf_size = size;
+ }
+}
+
+
+/* =============================================================================
+ * ud_set_sym_resolver
+ * Set symbol resolver for relative targets used in the translation
+ * phase.
+ *
+ * The resolver is a function that takes a uint64_t address and returns a
+ * symbolic name for the that address. The function also takes a second
+ * argument pointing to an integer that the client can optionally set to a
+ * non-zero value for offsetted targets. (symbol+offset) The function may
+ * also return NULL, in which case the translator only prints the target
+ * address.
+ *
+ * The function pointer maybe NULL which resets symbol resolution.
+ * =============================================================================
+ */
+void
+ud_set_sym_resolver(struct ud *u, const char* (*resolver)(struct ud*,
+ uint64_t addr,
+ int64_t *offset))
+{
+ u->sym_resolver = resolver;
+}
+
+
+/* =============================================================================
+ * ud_insn_mnemonic
+ * Return the current instruction mnemonic.
+ * =============================================================================
+ */
+enum ud_mnemonic_code
+ud_insn_mnemonic(const struct ud *u)
+{
+ return u->mnemonic;
+}
+
+
+/* =============================================================================
+ * ud_lookup_mnemonic
+ * Looks up mnemonic code in the mnemonic string table.
+ * Returns NULL if the mnemonic code is invalid.
+ * =============================================================================
+ */
+const char*
+ud_lookup_mnemonic(enum ud_mnemonic_code c)
+{
+ if (c < UD_MAX_MNEMONIC_CODE) {
+ return ud_mnemonics_str[c];
+ } else {
+ return "???";
+ }
+}
+
+
+/*
+ * ud_inp_init
+ * Initializes the input system.
+ */
+static void
+ud_inp_init(struct ud *u)
+{
+ u->inp_hook = NULL;
+ u->inp_buf = NULL;
+ u->inp_buf_size = 0;
+ u->inp_buf_index = 0;
+ u->inp_curr = 0;
+ u->inp_ctr = 0;
+ u->inp_end = 0;
+ u->inp_peek = UD_EOI;
+ UD_NON_STANDALONE(u->inp_file = NULL);
+}
+
+
+/* =============================================================================
+ * ud_inp_set_hook
+ * Sets input hook.
+ * =============================================================================
+ */
+void
+ud_set_input_hook(register struct ud* u, int (*hook)(struct ud*))
+{
+ ud_inp_init(u);
+ u->inp_hook = hook;
+}
+
+/* =============================================================================
+ * ud_inp_set_buffer
+ * Set buffer as input.
+ * =============================================================================
+ */
+void
+ud_set_input_buffer(register struct ud* u, const uint8_t* buf, size_t len)
+{
+ ud_inp_init(u);
+ u->inp_buf = buf;
+ u->inp_buf_size = len;
+ u->inp_buf_index = 0;
+}
+
+
+#ifndef __UD_STANDALONE__
+/* =============================================================================
+ * ud_input_set_file
+ * Set FILE as input.
+ * =============================================================================
+ */
+static int
+inp_file_hook(struct ud* u)
+{
+ return fgetc(u->inp_file);
+}
+
+void
+ud_set_input_file(register struct ud* u, FILE* f)
+{
+ ud_inp_init(u);
+ u->inp_hook = inp_file_hook;
+ u->inp_file = f;
+}
+#endif /* __UD_STANDALONE__ */
+
+
+/* =============================================================================
+ * ud_input_skip
+ * Skip n input bytes.
+ * ============================================================================
+ */
+void
+ud_input_skip(struct ud* u, size_t n)
+{
+ if (u->inp_end) {
+ return;
+ }
+ if (u->inp_buf == NULL) {
+ while (n--) {
+ int c = u->inp_hook(u);
+ if (c == UD_EOI) {
+ goto eoi;
+ }
+ }
+ return;
+ } else {
+ if (n > u->inp_buf_size ||
+ u->inp_buf_index > u->inp_buf_size - n) {
+ u->inp_buf_index = u->inp_buf_size;
+ goto eoi;
+ }
+ u->inp_buf_index += n;
+ return;
+ }
+eoi:
+ u->inp_end = 1;
+ UDERR(u, "cannot skip, eoi received\b");
+ return;
+}
+
+
+/* =============================================================================
+ * ud_input_end
+ * Returns non-zero on end-of-input.
+ * =============================================================================
+ */
+int
+ud_input_end(const struct ud *u)
+{
+ return u->inp_end;
+}
+
+/* vim:set ts=2 sw=2 expandtab */
diff --git a/ext/opcache/jit/vtune/ittnotify_config.h b/ext/opcache/jit/vtune/ittnotify_config.h
new file mode 100644
index 0000000000..fc3a476cdd
--- /dev/null
+++ b/ext/opcache/jit/vtune/ittnotify_config.h
@@ -0,0 +1,596 @@
+/* <copyright>
+ This file is provided under a dual BSD/GPLv2 license. When using or
+ redistributing this file, you may do so under either license.
+
+ GPL LICENSE SUMMARY
+
+ Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of version 2 of the GNU General Public License as
+ published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
+ The full GNU General Public License is included in this distribution
+ in the file called LICENSE.GPL.
+
+ Contact Information:
+ http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/
+
+ BSD LICENSE
+
+ Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+</copyright> */
+#ifndef _ITTNOTIFY_CONFIG_H_
+#define _ITTNOTIFY_CONFIG_H_
+
+/** @cond exclude_from_documentation */
+#ifndef ITT_OS_WIN
+# define ITT_OS_WIN 1
+#endif /* ITT_OS_WIN */
+
+#ifndef ITT_OS_LINUX
+# define ITT_OS_LINUX 2
+#endif /* ITT_OS_LINUX */
+
+#ifndef ITT_OS_MAC
+# define ITT_OS_MAC 3
+#endif /* ITT_OS_MAC */
+
+#ifndef ITT_OS_FREEBSD
+# define ITT_OS_FREEBSD 4
+#endif /* ITT_OS_FREEBSD */
+
+#ifndef ITT_OS
+# if defined WIN32 || defined _WIN32
+# define ITT_OS ITT_OS_WIN
+# elif defined( __APPLE__ ) && defined( __MACH__ )
+# define ITT_OS ITT_OS_MAC
+# elif defined( __FreeBSD__ )
+# define ITT_OS ITT_OS_FREEBSD
+# else
+# define ITT_OS ITT_OS_LINUX
+# endif
+#endif /* ITT_OS */
+
+#ifndef ITT_PLATFORM_WIN
+# define ITT_PLATFORM_WIN 1
+#endif /* ITT_PLATFORM_WIN */
+
+#ifndef ITT_PLATFORM_POSIX
+# define ITT_PLATFORM_POSIX 2
+#endif /* ITT_PLATFORM_POSIX */
+
+#ifndef ITT_PLATFORM_MAC
+# define ITT_PLATFORM_MAC 3
+#endif /* ITT_PLATFORM_MAC */
+
+#ifndef ITT_PLATFORM_FREEBSD
+# define ITT_PLATFORM_FREEBSD 4
+#endif /* ITT_PLATFORM_FREEBSD */
+
+#ifndef ITT_PLATFORM
+# if ITT_OS==ITT_OS_WIN
+# define ITT_PLATFORM ITT_PLATFORM_WIN
+# elif ITT_OS==ITT_OS_MAC
+# define ITT_PLATFORM ITT_PLATFORM_MAC
+# elif ITT_OS==ITT_OS_FREEBSD
+# define ITT_PLATFORM ITT_PLATFORM_FREEBSD
+# else
+# define ITT_PLATFORM ITT_PLATFORM_POSIX
+# endif
+#endif /* ITT_PLATFORM */
+
+#if defined(_UNICODE) && !defined(UNICODE)
+#define UNICODE
+#endif
+
+#include <stddef.h>
+#if ITT_PLATFORM==ITT_PLATFORM_WIN
+#include <tchar.h>
+#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+#include <stdint.h>
+#if defined(UNICODE) || defined(_UNICODE)
+#include <wchar.h>
+#endif /* UNICODE || _UNICODE */
+#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+
+#ifndef ITTAPI_CDECL
+# if ITT_PLATFORM==ITT_PLATFORM_WIN
+# define ITTAPI_CDECL __cdecl
+# else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+# if defined _M_IX86 || defined __i386__
+# define ITTAPI_CDECL __attribute__ ((cdecl))
+# else /* _M_IX86 || __i386__ */
+# define ITTAPI_CDECL /* actual only on x86 platform */
+# endif /* _M_IX86 || __i386__ */
+# endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+#endif /* ITTAPI_CDECL */
+
+#ifndef STDCALL
+# if ITT_PLATFORM==ITT_PLATFORM_WIN
+# define STDCALL __stdcall
+# else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+# if defined _M_IX86 || defined __i386__
+# define STDCALL __attribute__ ((stdcall))
+# else /* _M_IX86 || __i386__ */
+# define STDCALL /* supported only on x86 platform */
+# endif /* _M_IX86 || __i386__ */
+# endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+#endif /* STDCALL */
+
+#define ITTAPI ITTAPI_CDECL
+#define LIBITTAPI ITTAPI_CDECL
+
+/* TODO: Temporary for compatibility! */
+#define ITTAPI_CALL ITTAPI_CDECL
+#define LIBITTAPI_CALL ITTAPI_CDECL
+
+#if ITT_PLATFORM==ITT_PLATFORM_WIN
+/* use __forceinline (VC++ specific) */
+#define ITT_INLINE __forceinline
+#define ITT_INLINE_ATTRIBUTE /* nothing */
+#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+/*
+ * Generally, functions are not inlined unless optimization is specified.
+ * For functions declared inline, this attribute inlines the function even
+ * if no optimization level was specified.
+ */
+#ifdef __STRICT_ANSI__
+#define ITT_INLINE static
+#define ITT_INLINE_ATTRIBUTE __attribute__((unused))
+#else /* __STRICT_ANSI__ */
+#define ITT_INLINE static inline
+#define ITT_INLINE_ATTRIBUTE __attribute__((always_inline, unused))
+#endif /* __STRICT_ANSI__ */
+#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+/** @endcond */
+
+#ifndef ITT_ARCH_IA32
+# define ITT_ARCH_IA32 1
+#endif /* ITT_ARCH_IA32 */
+
+#ifndef ITT_ARCH_IA32E
+# define ITT_ARCH_IA32E 2
+#endif /* ITT_ARCH_IA32E */
+
+#ifndef ITT_ARCH_ARM
+# define ITT_ARCH_ARM 4
+#endif /* ITT_ARCH_ARM */
+
+#ifndef ITT_ARCH_PPC64
+# define ITT_ARCH_PPC64 5
+#endif /* ITT_ARCH_PPC64 */
+
+#ifndef ITT_ARCH
+# if defined _M_IX86 || defined __i386__
+# define ITT_ARCH ITT_ARCH_IA32
+# elif defined _M_X64 || defined _M_AMD64 || defined __x86_64__
+# define ITT_ARCH ITT_ARCH_IA32E
+# elif defined _M_IA64 || defined __ia64__
+# define ITT_ARCH ITT_ARCH_IA64
+# elif defined _M_ARM || defined __arm__
+# define ITT_ARCH ITT_ARCH_ARM
+# elif defined __powerpc64__
+# define ITT_ARCH ITT_ARCH_PPC64
+# endif
+#endif
+
+#ifdef __cplusplus
+# define ITT_EXTERN_C extern "C"
+# define ITT_EXTERN_C_BEGIN extern "C" {
+# define ITT_EXTERN_C_END }
+#else
+# define ITT_EXTERN_C /* nothing */
+# define ITT_EXTERN_C_BEGIN /* nothing */
+# define ITT_EXTERN_C_END /* nothing */
+#endif /* __cplusplus */
+
+#define ITT_TO_STR_AUX(x) #x
+#define ITT_TO_STR(x) ITT_TO_STR_AUX(x)
+
+#define __ITT_BUILD_ASSERT(expr, suffix) do { \
+ static char __itt_build_check_##suffix[(expr) ? 1 : -1]; \
+ __itt_build_check_##suffix[0] = 0; \
+} while(0)
+#define _ITT_BUILD_ASSERT(expr, suffix) __ITT_BUILD_ASSERT((expr), suffix)
+#define ITT_BUILD_ASSERT(expr) _ITT_BUILD_ASSERT((expr), __LINE__)
+
+#define ITT_MAGIC { 0xED, 0xAB, 0xAB, 0xEC, 0x0D, 0xEE, 0xDA, 0x30 }
+
+/* Replace with snapshot date YYYYMMDD for promotion build. */
+#define API_VERSION_BUILD 20151119
+
+#ifndef API_VERSION_NUM
+#define API_VERSION_NUM 0.0.0
+#endif /* API_VERSION_NUM */
+
+#define API_VERSION "ITT-API-Version " ITT_TO_STR(API_VERSION_NUM) \
+ " (" ITT_TO_STR(API_VERSION_BUILD) ")"
+
+/* OS communication functions */
+#if ITT_PLATFORM==ITT_PLATFORM_WIN
+#include <windows.h>
+typedef HMODULE lib_t;
+typedef DWORD TIDT;
+typedef CRITICAL_SECTION mutex_t;
+#define MUTEX_INITIALIZER { 0 }
+#define strong_alias(name, aliasname) /* empty for Windows */
+#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+#include <dlfcn.h>
+#if defined(UNICODE) || defined(_UNICODE)
+#include <wchar.h>
+#endif /* UNICODE */
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1 /* need for PTHREAD_MUTEX_RECURSIVE */
+#endif /* _GNU_SOURCE */
+#ifndef __USE_UNIX98
+#define __USE_UNIX98 1 /* need for PTHREAD_MUTEX_RECURSIVE, on SLES11.1 with gcc 4.3.4 wherein pthread.h missing dependency on __USE_XOPEN2K8 */
+#endif /*__USE_UNIX98*/
+#include <pthread.h>
+typedef void* lib_t;
+typedef pthread_t TIDT;
+typedef pthread_mutex_t mutex_t;
+#define MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
+#define _strong_alias(name, aliasname) \
+ extern __typeof (name) aliasname __attribute__ ((alias (#name)));
+#define strong_alias(name, aliasname) _strong_alias(name, aliasname)
+#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+
+#if ITT_PLATFORM==ITT_PLATFORM_WIN
+#define __itt_get_proc(lib, name) GetProcAddress(lib, name)
+#define __itt_mutex_init(mutex) InitializeCriticalSection(mutex)
+#define __itt_mutex_lock(mutex) EnterCriticalSection(mutex)
+#define __itt_mutex_unlock(mutex) LeaveCriticalSection(mutex)
+#define __itt_load_lib(name) LoadLibraryA(name)
+#define __itt_unload_lib(handle) FreeLibrary(handle)
+#define __itt_system_error() (int)GetLastError()
+#define __itt_fstrcmp(s1, s2) lstrcmpA(s1, s2)
+#define __itt_fstrnlen(s, l) strnlen_s(s, l)
+#define __itt_fstrcpyn(s1, b, s2, l) strncpy_s(s1, b, s2, l)
+#define __itt_fstrdup(s) _strdup(s)
+#define __itt_thread_id() GetCurrentThreadId()
+#define __itt_thread_yield() SwitchToThread()
+#ifndef ITT_SIMPLE_INIT
+ITT_INLINE long
+__itt_interlocked_increment(volatile long* ptr) ITT_INLINE_ATTRIBUTE;
+ITT_INLINE long __itt_interlocked_increment(volatile long* ptr)
+{
+ return InterlockedIncrement(ptr);
+}
+#endif /* ITT_SIMPLE_INIT */
+#else /* ITT_PLATFORM!=ITT_PLATFORM_WIN */
+#define __itt_get_proc(lib, name) dlsym(lib, name)
+#define __itt_mutex_init(mutex) {\
+ pthread_mutexattr_t mutex_attr; \
+ int error_code = pthread_mutexattr_init(&mutex_attr); \
+ if (error_code) \
+ __itt_report_error(__itt_error_system, "pthread_mutexattr_init", \
+ error_code); \
+ error_code = pthread_mutexattr_settype(&mutex_attr, \
+ PTHREAD_MUTEX_RECURSIVE); \
+ if (error_code) \
+ __itt_report_error(__itt_error_system, "pthread_mutexattr_settype", \
+ error_code); \
+ error_code = pthread_mutex_init(mutex, &mutex_attr); \
+ if (error_code) \
+ __itt_report_error(__itt_error_system, "pthread_mutex_init", \
+ error_code); \
+ error_code = pthread_mutexattr_destroy(&mutex_attr); \
+ if (error_code) \
+ __itt_report_error(__itt_error_system, "pthread_mutexattr_destroy", \
+ error_code); \
+}
+#define __itt_mutex_lock(mutex) pthread_mutex_lock(mutex)
+#define __itt_mutex_unlock(mutex) pthread_mutex_unlock(mutex)
+#define __itt_load_lib(name) dlopen(name, RTLD_LAZY)
+#define __itt_unload_lib(handle) dlclose(handle)
+#define __itt_system_error() errno
+#define __itt_fstrcmp(s1, s2) strcmp(s1, s2)
+
+/* makes customer code define safe APIs for SDL_STRNLEN_S and SDL_STRNCPY_S */
+#ifdef SDL_STRNLEN_S
+#define __itt_fstrnlen(s, l) SDL_STRNLEN_S(s, l)
+#else
+#define __itt_fstrnlen(s, l) strlen(s)
+#endif /* SDL_STRNLEN_S */
+#ifdef SDL_STRNCPY_S
+#define __itt_fstrcpyn(s1, b, s2, l) SDL_STRNCPY_S(s1, b, s2, l)
+#else
+#define __itt_fstrcpyn(s1, b, s2, l) strncpy(s1, s2, l)
+#endif /* SDL_STRNCPY_S */
+
+#define __itt_fstrdup(s) strdup(s)
+#define __itt_thread_id() pthread_self()
+#define __itt_thread_yield() sched_yield()
+#if ITT_ARCH==ITT_ARCH_IA64
+#ifdef __INTEL_COMPILER
+#define __TBB_machine_fetchadd4(addr, val) __fetchadd4_acq((void *)addr, val)
+#else /* __INTEL_COMPILER */
+/* TODO: Add Support for not Intel compilers for IA-64 architecture */
+#endif /* __INTEL_COMPILER */
+#elif ITT_ARCH==ITT_ARCH_IA32 || ITT_ARCH==ITT_ARCH_IA32E /* ITT_ARCH!=ITT_ARCH_IA64 */
+ITT_INLINE long
+__TBB_machine_fetchadd4(volatile void* ptr, long addend) ITT_INLINE_ATTRIBUTE;
+ITT_INLINE long __TBB_machine_fetchadd4(volatile void* ptr, long addend)
+{
+ long result;
+ __asm__ __volatile__("lock\nxadd %0,%1"
+ : "=r"(result),"=m"(*(int*)ptr)
+ : "0"(addend), "m"(*(int*)ptr)
+ : "memory");
+ return result;
+}
+#elif ITT_ARCH==ITT_ARCH_ARM || ITT_ARCH==ITT_ARCH_PPC64
+#define __TBB_machine_fetchadd4(addr, val) __sync_fetch_and_add(addr, val)
+#endif /* ITT_ARCH==ITT_ARCH_IA64 */
+#ifndef ITT_SIMPLE_INIT
+ITT_INLINE long
+__itt_interlocked_increment(volatile long* ptr) ITT_INLINE_ATTRIBUTE;
+ITT_INLINE long __itt_interlocked_increment(volatile long* ptr)
+{
+ return __TBB_machine_fetchadd4(ptr, 1) + 1L;
+}
+#endif /* ITT_SIMPLE_INIT */
+#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+
+typedef enum {
+ __itt_collection_normal = 0,
+ __itt_collection_paused = 1
+} __itt_collection_state;
+
+typedef enum {
+ __itt_thread_normal = 0,
+ __itt_thread_ignored = 1
+} __itt_thread_state;
+
+#pragma pack(push, 8)
+
+typedef struct ___itt_thread_info
+{
+ const char* nameA; /*!< Copy of original name in ASCII. */
+#if defined(UNICODE) || defined(_UNICODE)
+ const wchar_t* nameW; /*!< Copy of original name in UNICODE. */
+#else /* UNICODE || _UNICODE */
+ void* nameW;
+#endif /* UNICODE || _UNICODE */
+ TIDT tid;
+ __itt_thread_state state; /*!< Thread state (paused or normal) */
+ int extra1; /*!< Reserved to the runtime */
+ void* extra2; /*!< Reserved to the runtime */
+ struct ___itt_thread_info* next;
+} __itt_thread_info;
+
+#include "ittnotify_types.h" /* For __itt_group_id definition */
+
+typedef struct ___itt_api_info_20101001
+{
+ const char* name;
+ void** func_ptr;
+ void* init_func;
+ __itt_group_id group;
+} __itt_api_info_20101001;
+
+typedef struct ___itt_api_info
+{
+ const char* name;
+ void** func_ptr;
+ void* init_func;
+ void* null_func;
+ __itt_group_id group;
+} __itt_api_info;
+
+typedef struct __itt_counter_info
+{
+ const char* nameA; /*!< Copy of original name in ASCII. */
+#if defined(UNICODE) || defined(_UNICODE)
+ const wchar_t* nameW; /*!< Copy of original name in UNICODE. */
+#else /* UNICODE || _UNICODE */
+ void* nameW;
+#endif /* UNICODE || _UNICODE */
+ const char* domainA; /*!< Copy of original name in ASCII. */
+#if defined(UNICODE) || defined(_UNICODE)
+ const wchar_t* domainW; /*!< Copy of original name in UNICODE. */
+#else /* UNICODE || _UNICODE */
+ void* domainW;
+#endif /* UNICODE || _UNICODE */
+ int type;
+ long index;
+ int extra1; /*!< Reserved to the runtime */
+ void* extra2; /*!< Reserved to the runtime */
+ struct __itt_counter_info* next;
+} __itt_counter_info_t;
+
+struct ___itt_domain;
+struct ___itt_string_handle;
+
+typedef struct ___itt_global
+{
+ unsigned char magic[8];
+ unsigned long version_major;
+ unsigned long version_minor;
+ unsigned long version_build;
+ volatile long api_initialized;
+ volatile long mutex_initialized;
+ volatile long atomic_counter;
+ mutex_t mutex;
+ lib_t lib;
+ void* error_handler;
+ const char** dll_path_ptr;
+ __itt_api_info* api_list_ptr;
+ struct ___itt_global* next;
+ /* Joinable structures below */
+ __itt_thread_info* thread_list;
+ struct ___itt_domain* domain_list;
+ struct ___itt_string_handle* string_list;
+ __itt_collection_state state;
+ __itt_counter_info_t* counter_list;
+} __itt_global;
+
+#pragma pack(pop)
+
+#define NEW_THREAD_INFO_W(gptr,h,h_tail,t,s,n) { \
+ h = (__itt_thread_info*)malloc(sizeof(__itt_thread_info)); \
+ if (h != NULL) { \
+ h->tid = t; \
+ h->nameA = NULL; \
+ h->nameW = n ? _wcsdup(n) : NULL; \
+ h->state = s; \
+ h->extra1 = 0; /* reserved */ \
+ h->extra2 = NULL; /* reserved */ \
+ h->next = NULL; \
+ if (h_tail == NULL) \
+ (gptr)->thread_list = h; \
+ else \
+ h_tail->next = h; \
+ } \
+}
+
+#define NEW_THREAD_INFO_A(gptr,h,h_tail,t,s,n) { \
+ h = (__itt_thread_info*)malloc(sizeof(__itt_thread_info)); \
+ if (h != NULL) { \
+ h->tid = t; \
+ h->nameA = n ? __itt_fstrdup(n) : NULL; \
+ h->nameW = NULL; \
+ h->state = s; \
+ h->extra1 = 0; /* reserved */ \
+ h->extra2 = NULL; /* reserved */ \
+ h->next = NULL; \
+ if (h_tail == NULL) \
+ (gptr)->thread_list = h; \
+ else \
+ h_tail->next = h; \
+ } \
+}
+
+#define NEW_DOMAIN_W(gptr,h,h_tail,name) { \
+ h = (__itt_domain*)malloc(sizeof(__itt_domain)); \
+ if (h != NULL) { \
+ h->flags = 1; /* domain is enabled by default */ \
+ h->nameA = NULL; \
+ h->nameW = name ? _wcsdup(name) : NULL; \
+ h->extra1 = 0; /* reserved */ \
+ h->extra2 = NULL; /* reserved */ \
+ h->next = NULL; \
+ if (h_tail == NULL) \
+ (gptr)->domain_list = h; \
+ else \
+ h_tail->next = h; \
+ } \
+}
+
+#define NEW_DOMAIN_A(gptr,h,h_tail,name) { \
+ h = (__itt_domain*)malloc(sizeof(__itt_domain)); \
+ if (h != NULL) { \
+ h->flags = 1; /* domain is enabled by default */ \
+ h->nameA = name ? __itt_fstrdup(name) : NULL; \
+ h->nameW = NULL; \
+ h->extra1 = 0; /* reserved */ \
+ h->extra2 = NULL; /* reserved */ \
+ h->next = NULL; \
+ if (h_tail == NULL) \
+ (gptr)->domain_list = h; \
+ else \
+ h_tail->next = h; \
+ } \
+}
+
+#define NEW_STRING_HANDLE_W(gptr,h,h_tail,name) { \
+ h = (__itt_string_handle*)malloc(sizeof(__itt_string_handle)); \
+ if (h != NULL) { \
+ h->strA = NULL; \
+ h->strW = name ? _wcsdup(name) : NULL; \
+ h->extra1 = 0; /* reserved */ \
+ h->extra2 = NULL; /* reserved */ \
+ h->next = NULL; \
+ if (h_tail == NULL) \
+ (gptr)->string_list = h; \
+ else \
+ h_tail->next = h; \
+ } \
+}
+
+#define NEW_STRING_HANDLE_A(gptr,h,h_tail,name) { \
+ h = (__itt_string_handle*)malloc(sizeof(__itt_string_handle)); \
+ if (h != NULL) { \
+ h->strA = name ? __itt_fstrdup(name) : NULL; \
+ h->strW = NULL; \
+ h->extra1 = 0; /* reserved */ \
+ h->extra2 = NULL; /* reserved */ \
+ h->next = NULL; \
+ if (h_tail == NULL) \
+ (gptr)->string_list = h; \
+ else \
+ h_tail->next = h; \
+ } \
+}
+
+#define NEW_COUNTER_W(gptr,h,h_tail,name,domain,type) { \
+ h = (__itt_counter_info_t*)malloc(sizeof(__itt_counter_info_t)); \
+ if (h != NULL) { \
+ h->nameA = NULL; \
+ h->nameW = name ? _wcsdup(name) : NULL; \
+ h->domainA = NULL; \
+ h->domainW = name ? _wcsdup(domain) : NULL; \
+ h->type = type; \
+ h->index = 0; \
+ h->next = NULL; \
+ if (h_tail == NULL) \
+ (gptr)->counter_list = h; \
+ else \
+ h_tail->next = h; \
+ } \
+}
+
+#define NEW_COUNTER_A(gptr,h,h_tail,name,domain,type) { \
+ h = (__itt_counter_info_t*)malloc(sizeof(__itt_counter_info_t)); \
+ if (h != NULL) { \
+ h->nameA = name ? __itt_fstrdup(name) : NULL; \
+ h->nameW = NULL; \
+ h->domainA = domain ? __itt_fstrdup(domain) : NULL; \
+ h->domainW = NULL; \
+ h->type = type; \
+ h->index = 0; \
+ h->next = NULL; \
+ if (h_tail == NULL) \
+ (gptr)->counter_list = h; \
+ else \
+ h_tail->next = h; \
+ } \
+}
+
+#endif /* _ITTNOTIFY_CONFIG_H_ */
diff --git a/ext/opcache/jit/vtune/ittnotify_types.h b/ext/opcache/jit/vtune/ittnotify_types.h
new file mode 100644
index 0000000000..e10250bd63
--- /dev/null
+++ b/ext/opcache/jit/vtune/ittnotify_types.h
@@ -0,0 +1,115 @@
+/* <copyright>
+ This file is provided under a dual BSD/GPLv2 license. When using or
+ redistributing this file, you may do so under either license.
+
+ GPL LICENSE SUMMARY
+
+ Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of version 2 of the GNU General Public License as
+ published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
+ The full GNU General Public License is included in this distribution
+ in the file called LICENSE.GPL.
+
+ Contact Information:
+ http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/
+
+ BSD LICENSE
+
+ Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+</copyright> */
+
+#ifndef _ITTNOTIFY_TYPES_H_
+#define _ITTNOTIFY_TYPES_H_
+
+typedef enum ___itt_group_id
+{
+ __itt_group_none = 0,
+ __itt_group_legacy = 1<<0,
+ __itt_group_control = 1<<1,
+ __itt_group_thread = 1<<2,
+ __itt_group_mark = 1<<3,
+ __itt_group_sync = 1<<4,
+ __itt_group_fsync = 1<<5,
+ __itt_group_jit = 1<<6,
+ __itt_group_model = 1<<7,
+ __itt_group_splitter_min = 1<<7,
+ __itt_group_counter = 1<<8,
+ __itt_group_frame = 1<<9,
+ __itt_group_stitch = 1<<10,
+ __itt_group_heap = 1<<11,
+ __itt_group_splitter_max = 1<<12,
+ __itt_group_structure = 1<<12,
+ __itt_group_suppress = 1<<13,
+ __itt_group_arrays = 1<<14,
+ __itt_group_all = -1
+} __itt_group_id;
+
+#pragma pack(push, 8)
+
+typedef struct ___itt_group_list
+{
+ __itt_group_id id;
+ const char* name;
+} __itt_group_list;
+
+#pragma pack(pop)
+
+#define ITT_GROUP_LIST(varname) \
+ static __itt_group_list varname[] = { \
+ { __itt_group_all, "all" }, \
+ { __itt_group_control, "control" }, \
+ { __itt_group_thread, "thread" }, \
+ { __itt_group_mark, "mark" }, \
+ { __itt_group_sync, "sync" }, \
+ { __itt_group_fsync, "fsync" }, \
+ { __itt_group_jit, "jit" }, \
+ { __itt_group_model, "model" }, \
+ { __itt_group_counter, "counter" }, \
+ { __itt_group_frame, "frame" }, \
+ { __itt_group_stitch, "stitch" }, \
+ { __itt_group_heap, "heap" }, \
+ { __itt_group_structure, "structure" }, \
+ { __itt_group_suppress, "suppress" }, \
+ { __itt_group_arrays, "arrays" }, \
+ { __itt_group_none, NULL } \
+ }
+
+#endif /* _ITTNOTIFY_TYPES_H_ */
diff --git a/ext/opcache/jit/vtune/jitprofiling.c b/ext/opcache/jit/vtune/jitprofiling.c
new file mode 100644
index 0000000000..86efe047c4
--- /dev/null
+++ b/ext/opcache/jit/vtune/jitprofiling.c
@@ -0,0 +1,312 @@
+/* <copyright>
+ This file is provided under a dual BSD/GPLv2 license. When using or
+ redistributing this file, you may do so under either license.
+
+ GPL LICENSE SUMMARY
+
+ Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of version 2 of the GNU General Public License as
+ published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
+ The full GNU General Public License is included in this distribution
+ in the file called LICENSE.GPL.
+
+ Contact Information:
+ http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/
+
+ BSD LICENSE
+
+ Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+</copyright> */
+
+#include "ittnotify_config.h"
+
+#if ITT_PLATFORM==ITT_PLATFORM_WIN
+#include <windows.h>
+#pragma optimize("", off)
+#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+#include <stdlib.h>
+
+#include "jitprofiling.h"
+
+static const char rcsid[] = "\n@(#) $Revision: 463960 $\n";
+
+#define DLL_ENVIRONMENT_VAR "VS_PROFILER"
+
+#ifndef NEW_DLL_ENVIRONMENT_VAR
+#if ITT_ARCH==ITT_ARCH_IA32
+#define NEW_DLL_ENVIRONMENT_VAR "INTEL_JIT_PROFILER32"
+#else
+#define NEW_DLL_ENVIRONMENT_VAR "INTEL_JIT_PROFILER64"
+#endif
+#endif /* NEW_DLL_ENVIRONMENT_VAR */
+
+#if ITT_PLATFORM==ITT_PLATFORM_WIN
+#define DEFAULT_DLLNAME "JitPI.dll"
+HINSTANCE m_libHandle = NULL;
+#elif ITT_PLATFORM==ITT_PLATFORM_MAC
+#define DEFAULT_DLLNAME "libJitPI.dylib"
+void* m_libHandle = NULL;
+#else
+#define DEFAULT_DLLNAME "libJitPI.so"
+void* m_libHandle = NULL;
+#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+
+/* default location of JIT profiling agent on Android */
+#define ANDROID_JIT_AGENT_PATH "/data/intel/libittnotify.so"
+
+/* the function pointers */
+typedef unsigned int(JITAPI *TPInitialize)(void);
+static TPInitialize FUNC_Initialize=NULL;
+
+typedef unsigned int(JITAPI *TPNotify)(unsigned int, void*);
+static TPNotify FUNC_NotifyEvent=NULL;
+
+static iJIT_IsProfilingActiveFlags executionMode = iJIT_NOTHING_RUNNING;
+
+/* end collector dll part. */
+
+/* loadiJIT_Funcs() : this function is called just in the beginning
+ * and is responsible to load the functions from BistroJavaCollector.dll
+ * result:
+ * on success: the functions loads, iJIT_DLL_is_missing=0, return value = 1
+ * on failure: the functions are NULL, iJIT_DLL_is_missing=1, return value = 0
+ */
+static int loadiJIT_Funcs(void);
+
+/* global representing whether the collector can't be loaded */
+static int iJIT_DLL_is_missing = 0;
+
+ITT_EXTERN_C int JITAPI
+iJIT_NotifyEvent(iJIT_JVM_EVENT event_type, void *EventSpecificData)
+{
+ int ReturnValue;
+
+ /* initialization part - the collector has not been loaded yet. */
+ if (!FUNC_NotifyEvent)
+ {
+ if (iJIT_DLL_is_missing)
+ return 0;
+
+ if (!loadiJIT_Funcs())
+ return 0;
+ }
+
+ if (event_type == iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED ||
+ event_type == iJVM_EVENT_TYPE_METHOD_UPDATE)
+ {
+ if (((piJIT_Method_Load)EventSpecificData)->method_id == 0)
+ return 0;
+ }
+ else if (event_type == iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED_V2)
+ {
+ if (((piJIT_Method_Load_V2)EventSpecificData)->method_id == 0)
+ return 0;
+ }
+ else if (event_type == iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED_V3)
+ {
+ if (((piJIT_Method_Load_V3)EventSpecificData)->method_id == 0)
+ return 0;
+ }
+ else if (event_type == iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED)
+ {
+ if (((piJIT_Method_Inline_Load)EventSpecificData)->method_id == 0 ||
+ ((piJIT_Method_Inline_Load)EventSpecificData)->parent_method_id == 0)
+ return 0;
+ }
+
+ ReturnValue = (int)FUNC_NotifyEvent(event_type, EventSpecificData);
+
+ return ReturnValue;
+}
+
+ITT_EXTERN_C iJIT_IsProfilingActiveFlags JITAPI iJIT_IsProfilingActive()
+{
+ if (!iJIT_DLL_is_missing)
+ {
+ loadiJIT_Funcs();
+ }
+
+ return executionMode;
+}
+
+/* This function loads the collector dll and the relevant functions.
+ * on success: all functions load, iJIT_DLL_is_missing = 0, return value = 1
+ * on failure: all functions are NULL, iJIT_DLL_is_missing = 1, return value = 0
+ */
+static int loadiJIT_Funcs()
+{
+ static int bDllWasLoaded = 0;
+ char *dllName = (char*)rcsid; /* !! Just to avoid unused code elimination */
+#if ITT_PLATFORM==ITT_PLATFORM_WIN
+ DWORD dNameLength = 0;
+#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+
+ if(bDllWasLoaded)
+ {
+ /* dll was already loaded, no need to do it for the second time */
+ return 1;
+ }
+
+ /* Assumes that the DLL will not be found */
+ iJIT_DLL_is_missing = 1;
+ FUNC_NotifyEvent = NULL;
+
+ if (m_libHandle)
+ {
+#if ITT_PLATFORM==ITT_PLATFORM_WIN
+ FreeLibrary(m_libHandle);
+#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+ dlclose(m_libHandle);
+#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+ m_libHandle = NULL;
+ }
+
+ /* Try to get the dll name from the environment */
+#if ITT_PLATFORM==ITT_PLATFORM_WIN
+ dNameLength = GetEnvironmentVariableA(NEW_DLL_ENVIRONMENT_VAR, NULL, 0);
+ if (dNameLength)
+ {
+ DWORD envret = 0;
+ dllName = (char*)malloc(sizeof(char) * (dNameLength + 1));
+ if(dllName != NULL)
+ {
+ envret = GetEnvironmentVariableA(NEW_DLL_ENVIRONMENT_VAR,
+ dllName, dNameLength);
+ if (envret)
+ {
+ /* Try to load the dll from the PATH... */
+ m_libHandle = LoadLibraryExA(dllName,
+ NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
+ }
+ free(dllName);
+ }
+ } else {
+ /* Try to use old VS_PROFILER variable */
+ dNameLength = GetEnvironmentVariableA(DLL_ENVIRONMENT_VAR, NULL, 0);
+ if (dNameLength)
+ {
+ DWORD envret = 0;
+ dllName = (char*)malloc(sizeof(char) * (dNameLength + 1));
+ if(dllName != NULL)
+ {
+ envret = GetEnvironmentVariableA(DLL_ENVIRONMENT_VAR,
+ dllName, dNameLength);
+ if (envret)
+ {
+ /* Try to load the dll from the PATH... */
+ m_libHandle = LoadLibraryA(dllName);
+ }
+ free(dllName);
+ }
+ }
+ }
+#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+ dllName = getenv(NEW_DLL_ENVIRONMENT_VAR);
+ if (!dllName)
+ dllName = getenv(DLL_ENVIRONMENT_VAR);
+#if defined(__ANDROID__) || defined(ANDROID)
+ if (!dllName)
+ dllName = ANDROID_JIT_AGENT_PATH;
+#endif
+ if (dllName)
+ {
+ /* Try to load the dll from the PATH... */
+ m_libHandle = dlopen(dllName, RTLD_LAZY);
+ }
+#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+
+ if (!m_libHandle)
+ {
+#if ITT_PLATFORM==ITT_PLATFORM_WIN
+ m_libHandle = LoadLibraryA(DEFAULT_DLLNAME);
+#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+ m_libHandle = dlopen(DEFAULT_DLLNAME, RTLD_LAZY);
+#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+ }
+
+ /* if the dll wasn't loaded - exit. */
+ if (!m_libHandle)
+ {
+ iJIT_DLL_is_missing = 1; /* don't try to initialize
+ * JIT agent the second time
+ */
+ return 0;
+ }
+
+#if ITT_PLATFORM==ITT_PLATFORM_WIN
+ FUNC_NotifyEvent = (TPNotify)GetProcAddress(m_libHandle, "NotifyEvent");
+#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+ FUNC_NotifyEvent = (TPNotify)dlsym(m_libHandle, "NotifyEvent");
+#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+ if (!FUNC_NotifyEvent)
+ {
+ FUNC_Initialize = NULL;
+ return 0;
+ }
+
+#if ITT_PLATFORM==ITT_PLATFORM_WIN
+ FUNC_Initialize = (TPInitialize)GetProcAddress(m_libHandle, "Initialize");
+#else /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+ FUNC_Initialize = (TPInitialize)dlsym(m_libHandle, "Initialize");
+#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
+ if (!FUNC_Initialize)
+ {
+ FUNC_NotifyEvent = NULL;
+ return 0;
+ }
+
+ executionMode = (iJIT_IsProfilingActiveFlags)FUNC_Initialize();
+
+ bDllWasLoaded = 1;
+ iJIT_DLL_is_missing = 0; /* DLL is ok. */
+
+ return 1;
+}
+
+ITT_EXTERN_C unsigned int JITAPI iJIT_GetNewMethodID()
+{
+ static unsigned int methodID = 1;
+
+ if (methodID == 0)
+ return 0; /* ERROR : this is not a valid value */
+
+ return methodID++;
+}
diff --git a/ext/opcache/jit/vtune/jitprofiling.h b/ext/opcache/jit/vtune/jitprofiling.h
new file mode 100644
index 0000000000..3e166c04d4
--- /dev/null
+++ b/ext/opcache/jit/vtune/jitprofiling.h
@@ -0,0 +1,694 @@
+/* <copyright>
+ This file is provided under a dual BSD/GPLv2 license. When using or
+ redistributing this file, you may do so under either license.
+
+ GPL LICENSE SUMMARY
+
+ Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of version 2 of the GNU General Public License as
+ published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
+ The full GNU General Public License is included in this distribution
+ in the file called LICENSE.GPL.
+
+ Contact Information:
+ http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/
+
+ BSD LICENSE
+
+ Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+</copyright> */
+
+#ifndef __JITPROFILING_H__
+#define __JITPROFILING_H__
+
+/**
+ * @brief JIT Profiling APIs
+ *
+ * The JIT Profiling API is used to report information about just-in-time
+ * generated code that can be used by performance tools. The user inserts
+ * calls in the code generator to report information before JIT-compiled
+ * code goes to execution. This information is collected at runtime and used
+ * by tools like Intel(R) VTune(TM) Amplifier to display performance metrics
+ * associated with JIT-compiled code.
+ *
+ * These APIs can be used to\n
+ * - **Profile trace-based and method-based JIT-compiled
+ * code**. Some examples of environments that you can profile with these APIs:
+ * dynamic JIT compilation of JavaScript code traces, JIT execution in OpenCL(TM)
+ * software technology, Java/.NET managed execution environments, and custom
+ * ISV JIT engines.
+ * @code
+ * #include <jitprofiling.h>
+ *
+ * if (iJIT_IsProfilingActive != iJIT_SAMPLING_ON) {
+ * return;
+ * }
+ *
+ * iJIT_Method_Load jmethod = {0};
+ * jmethod.method_id = iJIT_GetNewMethodID();
+ * jmethod.method_name = "method_name";
+ * jmethod.class_file_name = "class_name";
+ * jmethod.source_file_name = "source_file_name";
+ * jmethod.method_load_address = code_addr;
+ * jmethod.method_size = code_size;
+ *
+ * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, (void*)&jmethod);
+ * iJIT_NotifyEvent(iJVM_EVENT_TYPE_SHUTDOWN, NULL);
+ * @endcode
+ *
+ * * Expected behavior:
+ * * If any iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED event overwrites an
+ * already reported method, then such a method becomes invalid and its
+ * memory region is treated as unloaded. VTune Amplifier displays the metrics
+ * collected by the method until it is overwritten.
+ * * If supplied line number information contains multiple source lines for
+ * the same assembly instruction (code location), then VTune Amplifier picks up
+ * the first line number.
+ * * Dynamically generated code can be associated with a module name.
+ * Use the iJIT_Method_Load_V2 structure.\n
+ * Clarification of some cases:
+ * * If you register a function with the same method ID multiple times,
+ * specifying different module names, then the VTune Amplifier picks up
+ * the module name registered first. If you want to distinguish the same
+ * function between different JIT engines, supply different method IDs for
+ * each function. Other symbolic information (for example, source file)
+ * can be identical.
+ *
+ * - **Analyze split functions** (multiple joint or disjoint code regions
+ * belonging to the same function) **including re-JIT**
+ * with potential overlapping of code regions in time, which is common in
+ * resource-limited environments.
+ * @code
+ * #include <jitprofiling.h>
+ *
+ * unsigned int method_id = iJIT_GetNewMethodID();
+ *
+ * iJIT_Method_Load a = {0};
+ * a.method_id = method_id;
+ * a.method_load_address = 0x100;
+ * a.method_size = 0x20;
+ *
+ * iJIT_Method_Load b = {0};
+ * b.method_id = method_id;
+ * b.method_load_address = 0x200;
+ * b.method_size = 0x30;
+ *
+ * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, (void*)&a);
+ * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, (void*)&b);
+ * @endcode
+ *
+ * * Expected behaviour:
+ * * If a iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED event overwrites an
+ * already reported method, then such a method becomes invalid and
+ * its memory region is treated as unloaded.
+ * * All code regions reported with the same method ID are considered as
+ * belonging to the same method. Symbolic information (method name,
+ * source file name) will be taken from the first notification, and all
+ * subsequent notifications with the same method ID will be processed
+ * only for line number table information. So, the VTune Amplifier will map
+ * samples to a source line using the line number table from the current
+ * notification while taking the source file name from the very first one.\n
+ * Clarification of some cases:\n
+ * * If you register a second code region with a different source file
+ * name and the same method ID, then this information will be saved and
+ * will not be considered as an extension of the first code region, but
+ * VTune Amplifier will use the source file of the first code region and map
+ * performance metrics incorrectly.
+ * * If you register a second code region with the same source file as
+ * for the first region and the same method ID, then the source file will be
+ * discarded but VTune Amplifier will map metrics to the source file correctly.
+ * * If you register a second code region with a null source file and
+ * the same method ID, then provided line number info will be associated
+ * with the source file of the first code region.
+ *
+ * - **Explore inline functions** including multi-level hierarchy of
+ * nested inline methods which shows how performance metrics are distributed through them.
+ * @code
+ * #include <jitprofiling.h>
+ *
+ * // method_id parent_id
+ * // [-- c --] 3000 2000
+ * // [---- d -----] 2001 1000
+ * // [---- b ----] 2000 1000
+ * // [------------ a ----------------] 1000 n/a
+ *
+ * iJIT_Method_Load a = {0};
+ * a.method_id = 1000;
+ *
+ * iJIT_Method_Inline_Load b = {0};
+ * b.method_id = 2000;
+ * b.parent_method_id = 1000;
+ *
+ * iJIT_Method_Inline_Load c = {0};
+ * c.method_id = 3000;
+ * c.parent_method_id = 2000;
+ *
+ * iJIT_Method_Inline_Load d = {0};
+ * d.method_id = 2001;
+ * d.parent_method_id = 1000;
+ *
+ * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, (void*)&a);
+ * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED, (void*)&b);
+ * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED, (void*)&c);
+ * iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED, (void*)&d);
+ * @endcode
+ *
+ * * Requirements:
+ * * Each inline (iJIT_Method_Inline_Load) method should be associated
+ * with two method IDs: one for itself; one for its immediate parent.
+ * * Address regions of inline methods of the same parent method cannot
+ * overlap each other.
+ * * Execution of the parent method must not be started until it and all
+ * its inline methods are reported.
+ * * Expected behaviour:
+ * * In case of nested inline methods an order of
+ * iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED events is not important.
+ * * If any event overwrites either inline method or top parent method,
+ * then the parent, including inline methods, becomes invalid and its memory
+ * region is treated as unloaded.
+ *
+ * **Life time of allocated data**\n
+ * The client sends an event notification to the agent with event-specific
+ * data, which is a structure. The pointers in the structure refer to memory
+ * allocated by the client, which responsible for releasing it. The pointers are
+ * used by the iJIT_NotifyEvent method to copy client's data in a trace file,
+ * and they are not used after the iJIT_NotifyEvent method returns.
+ */
+
+/**
+ * @defgroup jitapi JIT Profiling
+ * @ingroup internal
+ * @{
+ */
+
+/**
+ * @brief Enumerator for the types of notifications
+ */
+typedef enum iJIT_jvm_event
+{
+ iJVM_EVENT_TYPE_SHUTDOWN = 2, /**<\brief Send this to shutdown the agent.
+ * Use NULL for event data. */
+
+ iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED = 13, /**<\brief Send when dynamic code is
+ * JIT compiled and loaded into
+ * memory by the JIT engine, but
+ * before the code is executed.
+ * Use iJIT_Method_Load as event
+ * data. */
+/** @cond exclude_from_documentation */
+ iJVM_EVENT_TYPE_METHOD_UNLOAD_START, /**<\brief Send when compiled dynamic
+ * code is being unloaded from memory.
+ * Use iJIT_Method_Load as event data.*/
+/** @endcond */
+
+ iJVM_EVENT_TYPE_METHOD_UPDATE, /**<\brief Send to provide new content for
+ * a previously reported dynamic code.
+ * The previous content will be invalidated
+ * starting from the time of the notification.
+ * Use iJIT_Method_Load as event data but
+ * required fields are following:
+ * - method_id identify the code to update.
+ * - method_load_address specify start address
+ * within identified code range
+ * where update should be started.
+ * - method_size specify length of updated code
+ * range. */
+
+
+ iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED, /**<\brief Send when an inline dynamic
+ * code is JIT compiled and loaded
+ * into memory by the JIT engine,
+ * but before the parent code region
+ * starts executing.
+ * Use iJIT_Method_Inline_Load as event data.*/
+
+/** @cond exclude_from_documentation */
+ iJVM_EVENT_TYPE_METHOD_UPDATE_V2,
+/** @endcond */
+
+ iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED_V2 = 21, /**<\brief Send when a dynamic code is
+ * JIT compiled and loaded into
+ * memory by the JIT engine, but
+ * before the code is executed.
+ * Use iJIT_Method_Load_V2 as event data. */
+
+ iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED_V3 /**<\brief Send when a dynamic code is
+ * JIT compiled and loaded into
+ * memory by the JIT engine, but
+ * before the code is executed.
+ * Use iJIT_Method_Load_V3 as event data. */
+} iJIT_JVM_EVENT;
+
+/**
+ * @brief Enumerator for the agent's mode
+ */
+typedef enum _iJIT_IsProfilingActiveFlags
+{
+ iJIT_NOTHING_RUNNING = 0x0000, /**<\brief The agent is not running;
+ * iJIT_NotifyEvent calls will
+ * not be processed. */
+ iJIT_SAMPLING_ON = 0x0001, /**<\brief The agent is running and
+ * ready to process notifications. */
+} iJIT_IsProfilingActiveFlags;
+
+/**
+ * @brief Description of a single entry in the line number information of a code region.
+ * @details A table of line number entries gives information about how the reported code region
+ * is mapped to source file.
+ * Intel(R) VTune(TM) Amplifier uses line number information to attribute
+ * the samples (virtual address) to a line number. \n
+ * It is acceptable to report different code addresses for the same source line:
+ * @code
+ * Offset LineNumber
+ * 1 2
+ * 12 4
+ * 15 2
+ * 18 1
+ * 21 30
+ *
+ * VTune Amplifier constructs the following table using the client data
+ *
+ * Code subrange Line number
+ * 0-1 2
+ * 1-12 4
+ * 12-15 2
+ * 15-18 1
+ * 18-21 30
+ * @endcode
+ */
+typedef struct _LineNumberInfo
+{
+ unsigned int Offset; /**<\brief Offset from the begining of the code region. */
+ unsigned int LineNumber; /**<\brief Matching source line number offset (from beginning of source file). */
+
+} *pLineNumberInfo, LineNumberInfo;
+
+/**
+ * @brief Enumerator for the code architecture.
+ */
+typedef enum _iJIT_CodeArchitecture
+{
+ iJIT_CA_NATIVE = 0, /**<\brief Native to the process architecture that is calling it. */
+
+ iJIT_CA_32, /**<\brief 32-bit machine code. */
+
+ iJIT_CA_64 /**<\brief 64-bit machine code. */
+
+} iJIT_CodeArchitecture;
+
+#pragma pack(push, 8)
+
+/**
+ * @brief Description of a JIT-compiled method
+ * @details When you use the iJIT_Method_Load structure to describe
+ * the JIT compiled method, use iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED
+ * as an event type to report it.
+ */
+typedef struct _iJIT_Method_Load
+{
+ unsigned int method_id; /**<\brief Unique method ID. Cannot be 0.
+ * You must either use the API function
+ * iJIT_GetNewMethodID to get a valid and unique
+ * method ID, or else manage ID uniqueness
+ * and correct range by yourself.\n
+ * You must use the same method ID for all code
+ * regions of the same method, otherwise different
+ * method IDs specify different methods. */
+
+ char* method_name; /**<\brief The name of the method. It can be optionally
+ * prefixed with its class name and appended with
+ * its complete signature. Can't be NULL. */
+
+ void* method_load_address; /**<\brief The start virtual address of the method code
+ * region. If NULL, data provided with
+ * event are not accepted. */
+
+ unsigned int method_size; /**<\brief The code size of the method in memory.
+ * If 0, then data provided with the event are not
+ * accepted. */
+
+ unsigned int line_number_size; /**<\brief The number of entries in the line number
+ * table.0 if none. */
+
+ pLineNumberInfo line_number_table; /**<\brief Pointer to the line numbers info
+ * array. Can be NULL if
+ * line_number_size is 0. See
+ * LineNumberInfo Structure for a
+ * description of a single entry in
+ * the line number info array */
+
+ unsigned int class_id; /**<\brief This field is obsolete. */
+
+ char* class_file_name; /**<\brief Class name. Can be NULL.*/
+
+ char* source_file_name; /**<\brief Source file name. Can be NULL.*/
+
+} *piJIT_Method_Load, iJIT_Method_Load;
+
+/**
+ * @brief Description of a JIT-compiled method
+ * @details When you use the iJIT_Method_Load_V2 structure to describe
+ * the JIT compiled method, use iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED_V2
+ * as an event type to report it.
+ */
+typedef struct _iJIT_Method_Load_V2
+{
+ unsigned int method_id; /**<\brief Unique method ID. Cannot be 0.
+ * You must either use the API function
+ * iJIT_GetNewMethodID to get a valid and unique
+ * method ID, or else manage ID uniqueness
+ * and correct range by yourself.\n
+ * You must use the same method ID for all code
+ * regions of the same method, otherwise different
+ * method IDs specify different methods. */
+
+ char* method_name; /**<\brief The name of the method. It can be optionally
+ * prefixed with its class name and appended with
+ * its complete signature. Can't be NULL. */
+
+ void* method_load_address; /**<\brief The start virtual address of the method code
+ * region. If NULL, then data provided with the
+ * event are not accepted. */
+
+ unsigned int method_size; /**<\brief The code size of the method in memory.
+ * If 0, then data provided with the event are not
+ * accepted. */
+
+ unsigned int line_number_size; /**<\brief The number of entries in the line number
+ * table. 0 if none. */
+
+ pLineNumberInfo line_number_table; /**<\brief Pointer to the line numbers info
+ * array. Can be NULL if
+ * line_number_size is 0. See
+ * LineNumberInfo Structure for a
+ * description of a single entry in
+ * the line number info array. */
+
+ char* class_file_name; /**<\brief Class name. Can be NULL. */
+
+ char* source_file_name; /**<\brief Source file name. Can be NULL. */
+
+ char* module_name; /**<\brief Module name. Can be NULL.
+ The module name can be useful for distinguishing among
+ different JIT engines. VTune Amplifier will display
+ reported methods grouped by specific module. */
+
+} *piJIT_Method_Load_V2, iJIT_Method_Load_V2;
+
+/**
+ * @brief Description of a JIT-compiled method
+ * @details The iJIT_Method_Load_V3 structure is the same as iJIT_Method_Load_V2
+ * with a newly introduced 'arch' field that specifies architecture of the code region.
+ * When you use the iJIT_Method_Load_V3 structure to describe
+ * the JIT compiled method, use iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED_V3
+ * as an event type to report it.
+ */
+typedef struct _iJIT_Method_Load_V3
+{
+ unsigned int method_id; /**<\brief Unique method ID. Cannot be 0.
+ * You must either use the API function
+ * iJIT_GetNewMethodID to get a valid and unique
+ * method ID, or manage ID uniqueness
+ * and correct range by yourself.\n
+ * You must use the same method ID for all code
+ * regions of the same method, otherwise they are
+ * treated as regions of different methods. */
+
+ char* method_name; /**<\brief The name of the method. It can be optionally
+ * prefixed with its class name and appended with
+ * its complete signature. Cannot be NULL. */
+
+ void* method_load_address; /**<\brief The start virtual address of the method code
+ * region. If NULL, then data provided with the
+ * event are not accepted. */
+
+ unsigned int method_size; /**<\brief The code size of the method in memory.
+ * If 0, then data provided with the event are not
+ * accepted. */
+
+ unsigned int line_number_size; /**<\brief The number of entries in the line number
+ * table. 0 if none. */
+
+ pLineNumberInfo line_number_table; /**<\brief Pointer to the line numbers info
+ * array. Can be NULL if
+ * line_number_size is 0. See
+ * LineNumberInfo Structure for a
+ * description of a single entry in
+ * the line number info array. */
+
+ char* class_file_name; /**<\brief Class name. Can be NULL. */
+
+ char* source_file_name; /**<\brief Source file name. Can be NULL. */
+
+ char* module_name; /**<\brief Module name. Can be NULL.
+ * The module name can be useful for distinguishing among
+ * different JIT engines. VTune Amplifier will display
+ * reported methods grouped by specific module. */
+
+ iJIT_CodeArchitecture module_arch; /**<\brief Architecture of the method's code region.
+ * By default, it is the same as the process
+ * architecture that is calling it.
+ * For example, you can use it if your 32-bit JIT
+ * engine generates 64-bit code.
+ *
+ * If JIT engine reports both 32-bit and 64-bit types
+ * of methods then VTune Amplifier splits the methods
+ * with the same module name but with different
+ * architectures in two different modules. VTune Amplifier
+ * modifies the original name provided with a 64-bit method
+ * version by ending it with '(64)' */
+
+} *piJIT_Method_Load_V3, iJIT_Method_Load_V3;
+
+/**
+ * @brief Description of an inline JIT-compiled method
+ * @details When you use the_iJIT_Method_Inline_Load structure to describe
+ * the JIT compiled method, use iJVM_EVENT_TYPE_METHOD_INLINE_LOAD_FINISHED
+ * as an event type to report it.
+ */
+typedef struct _iJIT_Method_Inline_Load
+{
+ unsigned int method_id; /**<\brief Unique method ID. Cannot be 0.
+ * You must either use the API function
+ * iJIT_GetNewMethodID to get a valid and unique
+ * method ID, or else manage ID uniqueness
+ * and correct range by yourself. */
+
+ unsigned int parent_method_id; /**<\brief Unique immediate parent's method ID.
+ * Cannot be 0.
+ * You must either use the API function
+ * iJIT_GetNewMethodID to get a valid and unique
+ * method ID, or else manage ID uniqueness
+ * and correct range by yourself. */
+
+ char* method_name; /**<\brief The name of the method. It can be optionally
+ * prefixed with its class name and appended with
+ * its complete signature. Can't be NULL. */
+
+ void* method_load_address; /** <\brief The virtual address on which the method
+ * is inlined. If NULL, then data provided with
+ * the event are not accepted. */
+
+ unsigned int method_size; /**<\brief The code size of the method in memory.
+ * If 0, then data provided with the event are not
+ * accepted. */
+
+ unsigned int line_number_size; /**<\brief The number of entries in the line number
+ * table. 0 if none. */
+
+ pLineNumberInfo line_number_table; /**<\brief Pointer to the line numbers info
+ * array. Can be NULL if
+ * line_number_size is 0. See
+ * LineNumberInfo Structure for a
+ * description of a single entry in
+ * the line number info array */
+
+ char* class_file_name; /**<\brief Class name. Can be NULL.*/
+
+ char* source_file_name; /**<\brief Source file name. Can be NULL.*/
+
+} *piJIT_Method_Inline_Load, iJIT_Method_Inline_Load;
+
+/** @cond exclude_from_documentation */
+/**
+ * @brief Description of a segment type
+ * @details Use the segment type to specify a type of data supplied
+ * with the iJVM_EVENT_TYPE_METHOD_UPDATE_V2 event to be applied to
+ * a certain code trace.
+ */
+typedef enum _iJIT_SegmentType
+{
+ iJIT_CT_UNKNOWN = 0,
+
+ iJIT_CT_CODE, /**<\brief Executable code. */
+
+ iJIT_CT_DATA, /**<\brief Data (not executable code).
+ * VTune Amplifier uses the format string
+ * (see iJIT_Method_Update) to represent
+ * this data in the VTune Amplifier GUI */
+
+ iJIT_CT_KEEP, /**<\brief Use the previous markup for the trace.
+ * Can be used for the following
+ * iJVM_EVENT_TYPE_METHOD_UPDATE_V2 events,
+ * if the type of the previously reported segment
+ * type is the same. */
+ iJIT_CT_EOF
+} iJIT_SegmentType;
+
+/**
+ * @brief Description of a dynamic update of the content within JIT-compiled method
+ * @details The JIT engine may generate the methods that are updated at runtime
+ * partially by mixed (data + executable code) content. When you use the iJIT_Method_Update
+ * structure to describe the update of the content within a JIT-compiled method,
+ * use iJVM_EVENT_TYPE_METHOD_UPDATE_V2 as an event type to report it.
+ *
+ * On the first Update event, VTune Amplifier copies the original code range reported by
+ * the iJVM_EVENT_TYPE_METHOD_LOAD event, then modifies it with the supplied bytes and
+ * adds the modified range to the original method. For next update events, VTune Amplifier
+ * does the same but it uses the latest modified version of a code region for update.
+ * Eventually, VTune Amplifier GUI displays multiple code ranges for the method reported by
+ * the iJVM_EVENT_TYPE_METHOD_LOAD event.
+ * Notes:
+ * - Multiple update events with different types for the same trace are allowed
+ * but they must be reported for the same code ranges.
+ * Example,
+ * @code
+ * [-- data---] Allowed
+ * [-- code --] Allowed
+ * [code] Ignored
+ * [-- data---] Allowed
+ * [-- code --] Allowed
+ * [------------ trace ---------]
+ * @endcode
+ * - The types of previously reported events can be changed but they must be reported
+ * for the same code ranges.
+ * Example,
+ * @code
+ * [-- data---] Allowed
+ * [-- code --] Allowed
+ * [-- data---] Allowed
+ * [-- code --] Allowed
+ * [------------ trace ---------]
+ * @endcode
+ */
+
+typedef struct _iJIT_Method_Update
+{
+ void* load_address; /**<\brief Start address of the update within a method */
+
+ unsigned int size; /**<\brief The update size */
+
+ iJIT_SegmentType type; /**<\brief Type of the update */
+
+ const char* data_format; /**<\brief C string that contains a format string
+ * that follows the same specifications as format in printf.
+ * The format string is used for iJIT_CT_CODE only
+ * and cannot be NULL.
+ * Format can be changed on the fly. */
+} *piJIT_Method_Update, iJIT_Method_Update;
+
+/** @endcond */
+
+#pragma pack(pop)
+
+/** @cond exclude_from_documentation */
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#ifndef JITAPI_CDECL
+# if defined WIN32 || defined _WIN32
+# define JITAPI_CDECL __cdecl
+# else /* defined WIN32 || defined _WIN32 */
+# if defined _M_IX86 || defined __i386__
+# define JITAPI_CDECL __attribute__ ((cdecl))
+# else /* _M_IX86 || __i386__ */
+# define JITAPI_CDECL /* actual only on x86_64 platform */
+# endif /* _M_IX86 || __i386__ */
+# endif /* defined WIN32 || defined _WIN32 */
+#endif /* JITAPI_CDECL */
+
+#define JITAPI JITAPI_CDECL
+/** @endcond */
+
+/**
+ * @brief Generates a new unique method ID.
+ *
+ * You must use this API to obtain unique and valid method IDs for methods or
+ * traces reported to the agent if you don't have your own mechanism to generate
+ * unique method IDs.
+ *
+ * @return a new unique method ID. When out of unique method IDs, this API
+ * returns 0, which is not an accepted value.
+ */
+unsigned int JITAPI iJIT_GetNewMethodID(void);
+
+/**
+ * @brief Returns the current mode of the agent.
+ *
+ * @return iJIT_SAMPLING_ON, indicating that agent is running, or
+ * iJIT_NOTHING_RUNNING if no agent is running.
+ */
+iJIT_IsProfilingActiveFlags JITAPI iJIT_IsProfilingActive(void);
+
+/**
+ * @brief Reports infomation about JIT-compiled code to the agent.
+ *
+ * The reported information is used to attribute samples obtained from any
+ * Intel(R) VTune(TM) Amplifier collector. This API needs to be called
+ * after JIT compilation and before the first entry into the JIT-compiled
+ * code.
+ *
+ * @param[in] event_type - type of the data sent to the agent
+ * @param[in] EventSpecificData - pointer to event-specific data
+ *
+ * @returns 1 on success, otherwise 0.
+ */
+int JITAPI iJIT_NotifyEvent(iJIT_JVM_EVENT event_type, void *EventSpecificData);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+/** @endcond */
+
+/** @} jitapi group */
+
+#endif /* __JITPROFILING_H__ */
diff --git a/ext/opcache/jit/zend_elf.c b/ext/opcache/jit/zend_elf.c
new file mode 100644
index 0000000000..f5180e0a96
--- /dev/null
+++ b/ext/opcache/jit/zend_elf.c
@@ -0,0 +1,109 @@
+/*
+ +----------------------------------------------------------------------+
+ | Zend JIT |
+ +----------------------------------------------------------------------+
+ | Copyright (c) The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Dmitry Stogov <dmitry@php.net> |
+ | Xinchen Hui <laruence@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#if defined(__FreeBSD__)
+#include <sys/sysctl.h>
+#endif
+#include <fcntl.h>
+#include <unistd.h>
+
+#include "zend_API.h"
+#include "zend_elf.h"
+
+static void* zend_elf_read_sect(int fd, zend_elf_sectheader *sect)
+{
+ void *s = emalloc(sect->size);
+
+ if (lseek(fd, sect->ofs, SEEK_SET) < 0) {
+ efree(s);
+ return NULL;
+ }
+ if (read(fd, s, sect->size) != (ssize_t)sect->size) {
+ efree(s);
+ return NULL;
+ }
+
+ return s;
+}
+
+void zend_elf_load_symbols(void)
+{
+ zend_elf_header hdr;
+ zend_elf_sectheader sect;
+ int i;
+#if defined(__linux__)
+ int fd = open("/proc/self/exe", O_RDONLY);
+#elif defined(__NetBSD__)
+ int fd = open("/proc/curproc/exe", O_RDONLY);
+#elif defined(__FreeBSD__)
+ char path[PATH_MAX];
+ size_t pathlen = sizeof(path);
+ int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1};
+ if (sysctl(mib, 4, path, &pathlen, NULL, 0) == -1) {
+ return;
+ }
+ int fd = open(path, O_RDONLY);
+#else
+ // To complete eventually for other ELF platforms.
+ // Otherwise APPLE is Mach-O
+ int fd = -1;
+#endif
+
+ if (fd >= 0) {
+ if (read(fd, &hdr, sizeof(hdr)) == sizeof(hdr)
+ && hdr.emagic[0] == '\177'
+ && hdr.emagic[1] == 'E'
+ && hdr.emagic[2] == 'L'
+ && hdr.emagic[3] == 'F'
+ && lseek(fd, hdr.shofs, SEEK_SET) >= 0) {
+ for (i = 0; i < hdr.shnum; i++) {
+ if (read(fd, &sect, sizeof(sect)) == sizeof(sect)
+ && sect.type == ELFSECT_TYPE_SYMTAB) {
+ uint32_t n, count = sect.size / sizeof(zend_elf_symbol);
+ zend_elf_symbol *syms = zend_elf_read_sect(fd, &sect);
+ char *str_tbl;
+
+ if (syms) {
+ if (lseek(fd, hdr.shofs + sect.link * sizeof(sect), SEEK_SET) >= 0
+ && read(fd, &sect, sizeof(sect)) == sizeof(sect)
+ && (str_tbl = (char*)zend_elf_read_sect(fd, &sect)) != NULL) {
+ for (n = 0; n < count; n++) {
+ if (syms[n].name
+ && (ELFSYM_TYPE(syms[n].info) == ELFSYM_TYPE_FUNC
+ /*|| ELFSYM_TYPE(syms[n].info) == ELFSYM_TYPE_DATA*/)
+ && (ELFSYM_BIND(syms[n].info) == ELFSYM_BIND_LOCAL
+ /*|| ELFSYM_BIND(syms[n].info) == ELFSYM_BIND_GLOBAL*/)) {
+ zend_jit_disasm_add_symbol(str_tbl + syms[n].name, syms[n].value, syms[n].size);
+ }
+ }
+ efree(str_tbl);
+ }
+ efree(syms);
+ }
+ if (lseek(fd, hdr.shofs + (i + 1) * sizeof(sect), SEEK_SET) < 0) {
+ break;
+ }
+ }
+ }
+ }
+ close(fd);
+ }
+}
diff --git a/ext/opcache/jit/zend_elf.h b/ext/opcache/jit/zend_elf.h
new file mode 100644
index 0000000000..305e08708d
--- /dev/null
+++ b/ext/opcache/jit/zend_elf.h
@@ -0,0 +1,115 @@
+/*
+ +----------------------------------------------------------------------+
+ | Zend JIT |
+ +----------------------------------------------------------------------+
+ | Copyright (c) The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Dmitry Stogov <dmitry@php.net> |
+ | Xinchen Hui <laruence@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+#ifndef ZEND_ELF
+#define ZEND_ELF
+
+#if SIZEOF_SIZE_T == 8
+# define ELF64
+#else
+# undef ELF64
+#endif
+
+typedef struct _zend_elf_header {
+ uint8_t emagic[4];
+ uint8_t eclass;
+ uint8_t eendian;
+ uint8_t eversion;
+ uint8_t eosabi;
+ uint8_t eabiversion;
+ uint8_t epad[7];
+ uint16_t type;
+ uint16_t machine;
+ uint32_t version;
+ uintptr_t entry;
+ uintptr_t phofs;
+ uintptr_t shofs;
+ uint32_t flags;
+ uint16_t ehsize;
+ uint16_t phentsize;
+ uint16_t phnum;
+ uint16_t shentsize;
+ uint16_t shnum;
+ uint16_t shstridx;
+} zend_elf_header;
+
+typedef struct zend_elf_sectheader {
+ uint32_t name;
+ uint32_t type;
+ uintptr_t flags;
+ uintptr_t addr;
+ uintptr_t ofs;
+ uintptr_t size;
+ uint32_t link;
+ uint32_t info;
+ uintptr_t align;
+ uintptr_t entsize;
+} zend_elf_sectheader;
+
+#define ELFSECT_IDX_ABS 0xfff1
+
+enum {
+ ELFSECT_TYPE_PROGBITS = 1,
+ ELFSECT_TYPE_SYMTAB = 2,
+ ELFSECT_TYPE_STRTAB = 3,
+ ELFSECT_TYPE_NOBITS = 8,
+ ELFSECT_TYPE_DYNSYM = 11,
+};
+
+#define ELFSECT_FLAGS_WRITE (1 << 0)
+#define ELFSECT_FLAGS_ALLOC (1 << 1)
+#define ELFSECT_FLAGS_EXEC (1 << 2)
+#define ELFSECT_FLAGS_TLS (1 << 10)
+
+typedef struct zend_elf_symbol {
+#ifdef ELF64
+ uint32_t name;
+ uint8_t info;
+ uint8_t other;
+ uint16_t sectidx;
+ uintptr_t value;
+ uint64_t size;
+#else
+ uint32_t name;
+ uintptr_t value;
+ uint32_t size;
+ uint8_t info;
+ uint8_t other;
+ uint16_t sectidx;
+#endif
+} zend_elf_symbol;
+
+#define ELFSYM_BIND(info) ((info) >> 4)
+#define ELFSYM_TYPE(info) ((info) & 0xf)
+#define ELFSYM_INFO(bind, type) (((bind) << 4) | (type))
+
+enum {
+ ELFSYM_TYPE_DATA = 2,
+ ELFSYM_TYPE_FUNC = 2,
+ ELFSYM_TYPE_FILE = 4,
+};
+
+enum {
+ ELFSYM_BIND_LOCAL = 0,
+ ELFSYM_BIND_GLOBAL = 1,
+};
+
+void zend_elf_load_symbols(void);
+
+#endif
diff --git a/ext/opcache/jit/zend_jit.c b/ext/opcache/jit/zend_jit.c
new file mode 100644
index 0000000000..07d82b89de
--- /dev/null
+++ b/ext/opcache/jit/zend_jit.c
@@ -0,0 +1,3652 @@
+/*
+ +----------------------------------------------------------------------+
+ | Zend JIT |
+ +----------------------------------------------------------------------+
+ | Copyright (c) The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Dmitry Stogov <dmitry@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+#include <ZendAccelerator.h>
+#include "zend_shared_alloc.h"
+#include "Zend/zend_execute.h"
+#include "Zend/zend_vm.h"
+#include "Zend/zend_exceptions.h"
+#include "Zend/zend_constants.h"
+#include "zend_smart_str.h"
+#include "jit/zend_jit.h"
+#include "jit/zend_jit_internal.h"
+
+#ifdef HAVE_JIT
+
+#include "Optimizer/zend_func_info.h"
+#include "Optimizer/zend_ssa.h"
+#include "Optimizer/zend_inference.h"
+#include "Optimizer/zend_call_graph.h"
+#include "Optimizer/zend_dump.h"
+
+//#define CONTEXT_THREADED_JIT
+#define ZEND_JIT_USE_RC_INFERENCE
+
+#ifdef ZEND_JIT_USE_RC_INFERENCE
+# define ZEND_SSA_RC_INFERENCE_FLAG ZEND_SSA_RC_INFERENCE
+# define RC_MAY_BE_1(info) (((info) & (MAY_BE_RC1|MAY_BE_REF)) != 0)
+# define RC_MAY_BE_N(info) (((info) & (MAY_BE_RCN|MAY_BE_REF)) != 0)
+#else
+# define ZEND_SSA_RC_INFERENCE_FLAG 0
+# define RC_MAY_BE_1(info) 1
+# define RC_MAY_BE_N(info) 1
+#endif
+
+#define JIT_PREFIX "JIT$"
+#define JIT_STUB_PREFIX "JIT$$"
+
+#define DASM_M_GROW(ctx, t, p, sz, need) \
+ do { \
+ size_t _sz = (sz), _need = (need); \
+ if (_sz < _need) { \
+ if (_sz < 16) _sz = 16; \
+ while (_sz < _need) _sz += _sz; \
+ (p) = (t *)erealloc((p), _sz); \
+ (sz) = _sz; \
+ } \
+ } while(0)
+
+#define DASM_M_FREE(ctx, p, sz) efree(p)
+
+#include "dynasm/dasm_proto.h"
+
+typedef struct _zend_jit_stub {
+ const char *name;
+ int (*stub)(dasm_State **Dst);
+} zend_jit_stub;
+
+#define JIT_STUB(name) \
+ {JIT_STUB_PREFIX #name, zend_jit_ ## name ## _stub}
+
+static zend_uchar zend_jit_level = 0;
+static zend_uchar zend_jit_trigger = 0;
+static zend_uchar zend_jit_reg_alloc = 0;
+static zend_uchar zend_jit_cpu_flags = 0;
+
+zend_ulong zend_jit_profile_counter = 0;
+int zend_jit_profile_counter_rid = -1;
+
+int16_t zend_jit_hot_counters[ZEND_HOT_COUNTERS_COUNT];
+
+const zend_op *zend_jit_halt_op = NULL;
+static int zend_jit_vm_kind = 0;
+
+static void *dasm_buf = NULL;
+static void *dasm_end = NULL;
+static void **dasm_ptr = NULL;
+
+static size_t dasm_size = 0;
+
+static zend_long jit_bisect_pos = 0;
+
+static const void *zend_jit_runtime_jit_handler = NULL;
+static const void *zend_jit_profile_jit_handler = NULL;
+static const void *zend_jit_func_counter_handler = NULL;
+static const void *zend_jit_loop_counter_handler = NULL;
+
+static int zend_may_overflow(const zend_op *opline, const zend_op_array *op_array, zend_ssa *ssa);
+static void ZEND_FASTCALL zend_runtime_jit(void);
+
+static zend_bool zend_ssa_is_last_use(const zend_op_array *op_array, const zend_ssa *ssa, int var, int use)
+{
+ if (ssa->vars[var].phi_use_chain) {
+ zend_ssa_phi *phi = ssa->vars[var].phi_use_chain;
+ do {
+ if (!ssa->vars[phi->ssa_var].no_val) {
+ return 0;
+ }
+ phi = zend_ssa_next_use_phi(ssa, var, phi);
+ } while (phi);
+ }
+
+ use = zend_ssa_next_use(ssa->ops, var, use);
+ return use < 0 || zend_ssa_is_no_val_use(op_array->opcodes + use, ssa->ops + use, var);
+}
+
+static zend_bool zend_is_commutative(zend_uchar opcode)
+{
+ return
+ opcode == ZEND_ADD ||
+ opcode == ZEND_MUL ||
+ opcode == ZEND_BW_OR ||
+ opcode == ZEND_BW_AND ||
+ opcode == ZEND_BW_XOR;
+}
+
+static zend_bool zend_long_is_power_of_two(zend_long x)
+{
+ return (x > 0) && !(x & (x - 1));
+}
+
+#define OP_RANGE(line, opN) \
+ (((opline->opN##_type & (IS_TMP_VAR|IS_VAR|IS_CV)) && \
+ ssa->ops && \
+ ssa->var_info && \
+ ssa->ops[line].opN##_use >= 0 && \
+ ssa->var_info[ssa->ops[line].opN##_use].has_range) ? \
+ &ssa->var_info[ssa->ops[line].opN##_use].range : NULL)
+
+#define OP1_RANGE() OP_RANGE(opline - op_array->opcodes, op1)
+#define OP2_RANGE() OP_RANGE(opline - op_array->opcodes, op2)
+#define OP1_DATA_RANGE() OP_RANGE(opline - op_array->opcodes + 1, op1)
+
+#include "dynasm/dasm_x86.h"
+#include "jit/zend_jit_x86.h"
+#include "jit/zend_jit_helpers.c"
+#include "jit/zend_jit_x86.c"
+#include "jit/zend_jit_disasm_x86.c"
+#ifndef _WIN32
+#include "jit/zend_jit_gdb.c"
+#include "jit/zend_jit_perf_dump.c"
+#endif
+#ifdef HAVE_OPROFILE
+# include "jit/zend_jit_oprofile.c"
+#endif
+#include "jit/zend_jit_vtune.c"
+
+#if _WIN32
+# include <Windows.h>
+#else
+# include <sys/mman.h>
+# if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
+# define MAP_ANONYMOUS MAP_ANON
+# endif
+#endif
+
+#define DASM_ALIGNMENT 16
+
+ZEND_EXT_API void zend_jit_status(zval *ret)
+{
+ zval stats;
+ array_init(&stats);
+ add_assoc_long(&stats, "level", zend_jit_level);
+ add_assoc_long(&stats, "trigger", zend_jit_trigger);
+ add_assoc_long(&stats, "reg-alloc", zend_jit_reg_alloc);
+ if (dasm_buf) {
+ add_assoc_long(&stats, "buffer_size", (char*)dasm_end - (char*)dasm_buf);
+ add_assoc_long(&stats, "buffer_free", (char*)dasm_end - (char*)*dasm_ptr);
+ } else {
+ add_assoc_long(&stats, "buffer_size", 0);
+ add_assoc_long(&stats, "buffer_free", 0);
+ }
+ add_assoc_zval(ret, "jit", &stats);
+}
+
+static zend_string *zend_jit_func_name(const zend_op_array *op_array)
+{
+ smart_str buf = {0};
+
+ if (op_array->function_name) {
+ if (op_array->scope) {
+ smart_str_appends(&buf, JIT_PREFIX);
+ smart_str_appendl(&buf, ZSTR_VAL(op_array->scope->name), ZSTR_LEN(op_array->scope->name));
+ smart_str_appends(&buf, "::");
+ smart_str_appendl(&buf, ZSTR_VAL(op_array->function_name), ZSTR_LEN(op_array->function_name));
+ smart_str_0(&buf);
+ return buf.s;
+ } else {
+ smart_str_appends(&buf, JIT_PREFIX);
+ smart_str_appendl(&buf, ZSTR_VAL(op_array->function_name), ZSTR_LEN(op_array->function_name));
+ smart_str_0(&buf);
+ return buf.s;
+ }
+ } else if (op_array->filename) {
+ smart_str_appends(&buf, JIT_PREFIX);
+ smart_str_appendl(&buf, ZSTR_VAL(op_array->filename), ZSTR_LEN(op_array->filename));
+ smart_str_0(&buf);
+ return buf.s;
+ } else {
+ return NULL;
+ }
+}
+
+static void *dasm_link_and_encode(dasm_State **dasm_state,
+ const zend_op_array *op_array,
+ zend_ssa *ssa,
+ const zend_op *rt_opline,
+ zend_lifetime_interval **ra,
+ const char *name)
+{
+ size_t size;
+ int ret;
+ void *entry;
+#if defined(HAVE_DISASM) || defined(HAVE_GDB) || defined(HAVE_OPROFILE) || defined(HAVE_PERFTOOLS) || defined(HAVE_VTUNE)
+ zend_string *str = NULL;
+#endif
+
+ if (rt_opline && ssa && ssa->cfg.map) {
+ /* Create additional entry point, to switch from interpreter to JIT-ed
+ * code at run-time.
+ */
+ int b = ssa->cfg.map[rt_opline - op_array->opcodes];
+
+//#ifdef CONTEXT_THREADED_JIT
+// if (!(ssa->cfg.blocks[b].flags & (ZEND_BB_START|ZEND_BB_RECV_ENTRY))) {
+//#else
+ if (!(ssa->cfg.blocks[b].flags & (ZEND_BB_START|ZEND_BB_ENTRY|ZEND_BB_RECV_ENTRY))) {
+//#endif
+ zend_jit_label(dasm_state, ssa->cfg.blocks_count + b);
+ zend_jit_prologue(dasm_state);
+ if (ra) {
+ int i;
+ zend_lifetime_interval *ival;
+ zend_life_range *range;
+ uint32_t pos = rt_opline - op_array->opcodes;
+
+ for (i = 0; i < ssa->vars_count; i++) {
+ ival = ra[i];
+
+ if (ival && ival->reg != ZREG_NONE) {
+ range = &ival->range;
+
+ if (pos >= range->start && pos <= range->end) {
+ if (!zend_jit_load_var(dasm_state, ssa->var_info[i].type, ssa->vars[i].var, ival->reg)) {
+ return NULL;
+ }
+ break;
+ }
+ range = range->next;
+ }
+ }
+ }
+ zend_jit_jmp(dasm_state, b);
+ }
+ }
+
+ if (dasm_link(dasm_state, &size) != DASM_S_OK) {
+ // TODO: dasm_link() failed ???
+ return NULL;
+ }
+
+ if ((void*)((char*)*dasm_ptr + size) > dasm_end) {
+ *dasm_ptr = dasm_end; //prevent further try
+ // TODO: jit_buffer_size overflow ???
+ return NULL;
+ }
+
+ ret = dasm_encode(dasm_state, *dasm_ptr);
+
+ if (ret != DASM_S_OK) {
+ // TODO: dasm_encode() failed ???
+ return NULL;
+ }
+
+ entry = *dasm_ptr;
+ *dasm_ptr = (void*)((char*)*dasm_ptr + ZEND_MM_ALIGNED_SIZE_EX(size, DASM_ALIGNMENT));
+
+ if (op_array && ssa) {
+ int b;
+
+ for (b = 0; b < ssa->cfg.blocks_count; b++) {
+//#ifdef CONTEXT_THREADED_JIT
+// if (ssa->cfg.blocks[b].flags & (ZEND_BB_START|ZEND_BB_RECV_ENTRY)) {
+//#else
+ if (ssa->cfg.blocks[b].flags & (ZEND_BB_START|ZEND_BB_ENTRY|ZEND_BB_RECV_ENTRY)) {
+//#endif
+ zend_op *opline = op_array->opcodes + ssa->cfg.blocks[b].start;
+ int offset = dasm_getpclabel(dasm_state, ssa->cfg.blocks_count + b);
+
+ if (offset >= 0) {
+ opline->handler = (void*)(((char*)entry) + offset);
+ }
+ }
+ }
+ if (rt_opline && ssa && ssa->cfg.map) {
+ int b = ssa->cfg.map[rt_opline - op_array->opcodes];
+ zend_op *opline = (zend_op*)rt_opline;
+ int offset = dasm_getpclabel(dasm_state, ssa->cfg.blocks_count + b);
+
+ if (offset >= 0) {
+ opline->handler = (void*)(((char*)entry) + offset);
+ }
+ }
+ }
+
+#if defined(HAVE_DISASM) || defined(HAVE_GDB) || defined(HAVE_OPROFILE) || defined(HAVE_PERFTOOLS) || defined(HAVE_VTUNE)
+ if (!name) {
+ if (ZCG(accel_directives).jit_debug & (ZEND_JIT_DEBUG_ASM|ZEND_JIT_DEBUG_GDB|ZEND_JIT_DEBUG_OPROFILE|ZEND_JIT_DEBUG_PERF|ZEND_JIT_DEBUG_VTUNE|ZEND_JIT_DEBUG_PERF_DUMP)) {
+ str = zend_jit_func_name(op_array);
+ if (str) {
+ name = ZSTR_VAL(str);
+ }
+ }
+#ifdef HAVE_DISASM
+ if (ZCG(accel_directives).jit_debug & ZEND_JIT_DEBUG_ASM) {
+ zend_jit_disasm_add_symbol(name, (uintptr_t)entry, size);
+ zend_jit_disasm(
+ name,
+ (op_array && op_array->filename) ? ZSTR_VAL(op_array->filename) : NULL,
+ op_array,
+ &ssa->cfg,
+ entry,
+ size);
+ }
+ } else {
+ if (ZCG(accel_directives).jit_debug & (ZEND_JIT_DEBUG_ASM_STUBS|ZEND_JIT_DEBUG_ASM)) {
+ zend_jit_disasm_add_symbol(name, (uintptr_t)entry, size);
+ if (ZCG(accel_directives).jit_debug & ZEND_JIT_DEBUG_ASM_STUBS) {
+ zend_jit_disasm(
+ name,
+ (op_array && op_array->filename) ? ZSTR_VAL(op_array->filename) : NULL,
+ op_array,
+ &ssa->cfg,
+ entry,
+ size);
+ }
+ }
+# endif
+ }
+#endif
+
+#ifdef HAVE_GDB
+ if (ZCG(accel_directives).jit_debug & ZEND_JIT_DEBUG_GDB) {
+ if (name) {
+ zend_jit_gdb_register(
+ name,
+ op_array,
+ entry,
+ size);
+ }
+ }
+#endif
+
+#ifdef HAVE_OPROFILE
+ if (ZCG(accel_directives).jit_debug & ZEND_JIT_DEBUG_OPROFILE) {
+ zend_jit_oprofile_register(
+ name,
+ entry,
+ size);
+ }
+#endif
+
+#ifdef HAVE_PERFTOOLS
+ if (ZCG(accel_directives).jit_debug & (ZEND_JIT_DEBUG_PERF|ZEND_JIT_DEBUG_PERF_DUMP)) {
+ if (name) {
+ zend_jit_perf_map_register(
+ name,
+ entry,
+ size);
+ if (ZCG(accel_directives).jit_debug & ZEND_JIT_DEBUG_PERF_DUMP) {
+ zend_jit_perf_jitdump_register(
+ name,
+ entry,
+ size);
+ }
+ }
+ }
+#endif
+
+#ifdef HAVE_VTUNE
+ if (ZCG(accel_directives).jit_debug & ZEND_JIT_DEBUG_VTUNE) {
+ if (name) {
+ zend_jit_vtune_register(
+ name,
+ entry,
+ size);
+ }
+ }
+#endif
+
+#if defined(HAVE_DISASM) || defined(HAVE_GDB) || defined(HAVE_OPROFILE) || defined(HAVE_PERFTOOLS) || defined(HAVE_VTUNE)
+ if (str) {
+ zend_string_release(str);
+ }
+#endif
+
+ return entry;
+}
+
+static int zend_may_overflow(const zend_op *opline, const zend_op_array *op_array, zend_ssa *ssa)
+{
+ uint32_t num;
+ int res;
+
+ if (!ssa->ops || !ssa->var_info) {
+ return 1;
+ }
+ switch (opline->opcode) {
+ case ZEND_PRE_INC:
+ case ZEND_POST_INC:
+ num = opline - op_array->opcodes;
+ res = ssa->ops[num].op1_def;
+ return (res < 0 ||
+ !ssa->var_info[res].has_range ||
+ ssa->var_info[res].range.overflow);
+ case ZEND_PRE_DEC:
+ case ZEND_POST_DEC:
+ num = opline - op_array->opcodes;
+ res = ssa->ops[num].op1_def;
+ return (res < 0 ||
+ !ssa->var_info[res].has_range ||
+ ssa->var_info[res].range.underflow);
+ case ZEND_ADD:
+ num = opline - op_array->opcodes;
+ res = ssa->ops[num].result_def;
+ if (res < 0 ||
+ !ssa->var_info[res].has_range) {
+ return 1;
+ }
+ if (ssa->var_info[res].range.underflow) {
+ zend_long op1_min, op2_min;
+
+ if (!OP1_HAS_RANGE() || !OP2_HAS_RANGE()) {
+ return 1;
+ }
+ op1_min = OP1_MIN_RANGE();
+ op2_min = OP2_MIN_RANGE();
+ if (zend_add_will_overflow(op1_min, op2_min)) {
+ return 1;
+ }
+ }
+ if (ssa->var_info[res].range.overflow) {
+ zend_long op1_max, op2_max;
+
+ if (!OP1_HAS_RANGE() || !OP2_HAS_RANGE()) {
+ return 1;
+ }
+ op1_max = OP1_MAX_RANGE();
+ op2_max = OP2_MAX_RANGE();
+ if (zend_add_will_overflow(op1_max, op2_max)) {
+ return 1;
+ }
+ }
+ return 0;
+ case ZEND_SUB:
+ num = opline - op_array->opcodes;
+ res = ssa->ops[num].result_def;
+ if (res < 0 ||
+ !ssa->var_info[res].has_range) {
+ return 1;
+ }
+ if (ssa->var_info[res].range.underflow) {
+ zend_long op1_min, op2_max;
+
+ if (!OP1_HAS_RANGE() || !OP2_HAS_RANGE()) {
+ return 1;
+ }
+ op1_min = OP1_MIN_RANGE();
+ op2_max = OP2_MAX_RANGE();
+ if (zend_sub_will_overflow(op1_min, op2_max)) {
+ return 1;
+ }
+ }
+ if (ssa->var_info[res].range.overflow) {
+ zend_long op1_max, op2_min;
+
+ if (!OP1_HAS_RANGE() || !OP2_HAS_RANGE()) {
+ return 1;
+ }
+ op1_max = OP1_MAX_RANGE();
+ op2_min = OP2_MIN_RANGE();
+ if (zend_sub_will_overflow(op1_max, op2_min)) {
+ return 1;
+ }
+ }
+ return 0;
+ case ZEND_MUL:
+ num = opline - op_array->opcodes;
+ res = ssa->ops[num].result_def;
+ return (res < 0 ||
+ !ssa->var_info[res].has_range ||
+ ssa->var_info[res].range.underflow ||
+ ssa->var_info[res].range.overflow);
+ case ZEND_ASSIGN_OP:
+ if (opline->extended_value == ZEND_ADD) {
+ num = opline - op_array->opcodes;
+ res = ssa->ops[num].op1_def;
+ if (res < 0 ||
+ !ssa->var_info[res].has_range) {
+ return 1;
+ }
+ if (ssa->var_info[res].range.underflow) {
+ zend_long op1_min, op2_min;
+
+ if (!OP1_HAS_RANGE() || !OP2_HAS_RANGE()) {
+ return 1;
+ }
+ op1_min = OP1_MIN_RANGE();
+ op2_min = OP2_MIN_RANGE();
+ if (zend_add_will_overflow(op1_min, op2_min)) {
+ return 1;
+ }
+ }
+ if (ssa->var_info[res].range.overflow) {
+ zend_long op1_max, op2_max;
+
+ if (!OP1_HAS_RANGE() || !OP2_HAS_RANGE()) {
+ return 1;
+ }
+ op1_max = OP1_MAX_RANGE();
+ op2_max = OP2_MAX_RANGE();
+ if (zend_add_will_overflow(op1_max, op2_max)) {
+ return 1;
+ }
+ }
+ return 0;
+ } else if (opline->extended_value == ZEND_SUB) {
+ num = opline - op_array->opcodes;
+ res = ssa->ops[num].op1_def;
+ if (res < 0 ||
+ !ssa->var_info[res].has_range) {
+ return 1;
+ }
+ if (ssa->var_info[res].range.underflow) {
+ zend_long op1_min, op2_max;
+
+ if (!OP1_HAS_RANGE() || !OP2_HAS_RANGE()) {
+ return 1;
+ }
+ op1_min = OP1_MIN_RANGE();
+ op2_max = OP2_MAX_RANGE();
+ if (zend_sub_will_overflow(op1_min, op2_max)) {
+ return 1;
+ }
+ }
+ if (ssa->var_info[res].range.overflow) {
+ zend_long op1_max, op2_min;
+
+ if (!OP1_HAS_RANGE() || !OP2_HAS_RANGE()) {
+ return 1;
+ }
+ op1_max = OP1_MAX_RANGE();
+ op2_min = OP2_MIN_RANGE();
+ if (zend_sub_will_overflow(op1_max, op2_min)) {
+ return 1;
+ }
+ }
+ return 0;
+ } else if (opline->extended_value == ZEND_MUL) {
+ num = opline - op_array->opcodes;
+ res = ssa->ops[num].op1_def;
+ return (res < 0 ||
+ !ssa->var_info[res].has_range ||
+ ssa->var_info[res].range.underflow ||
+ ssa->var_info[res].range.overflow);
+ }
+ default:
+ return 1;
+ }
+}
+
+static int zend_jit_build_cfg(const zend_op_array *op_array, zend_cfg *cfg)
+{
+ uint32_t flags;
+
+ flags = ZEND_CFG_STACKLESS | ZEND_CFG_NO_ENTRY_PREDECESSORS | ZEND_SSA_RC_INFERENCE_FLAG | ZEND_SSA_USE_CV_RESULTS | ZEND_CFG_RECV_ENTRY;
+
+ if (zend_build_cfg(&CG(arena), op_array, flags, cfg) != SUCCESS) {
+ return FAILURE;
+ }
+
+ /* Don't JIT huge functions. Apart from likely being detrimental due to the amount of
+ * generated code, some of our analysis is recursive and will stack overflow with many
+ * blocks. */
+ if (cfg->blocks_count > 100000) {
+ return FAILURE;
+ }
+
+ if (zend_cfg_build_predecessors(&CG(arena), cfg) != SUCCESS) {
+ return FAILURE;
+ }
+
+ /* Compute Dominators Tree */
+ if (zend_cfg_compute_dominators_tree(op_array, cfg) != SUCCESS) {
+ return FAILURE;
+ }
+
+ /* Identify reducible and irreducible loops */
+ if (zend_cfg_identify_loops(op_array, cfg) != SUCCESS) {
+ return FAILURE;
+ }
+
+ return SUCCESS;
+}
+
+static int zend_jit_op_array_analyze1(const zend_op_array *op_array, zend_script *script, zend_ssa *ssa)
+{
+ if (zend_jit_build_cfg(op_array, &ssa->cfg) != SUCCESS) {
+ return FAILURE;
+ }
+
+#if 0
+ /* TODO: debugger and profiler supports? */
+ if ((ssa->cfg.flags & ZEND_FUNC_HAS_EXTENDED_INFO)) {
+ return FAILURE;
+ }
+#endif
+
+ if ((zend_jit_level >= ZEND_JIT_LEVEL_OPT_FUNC)
+ && ssa->cfg.blocks
+ && op_array->last_try_catch == 0
+ && !(op_array->fn_flags & ZEND_ACC_GENERATOR)
+ && !(ssa->cfg.flags & ZEND_FUNC_INDIRECT_VAR_ACCESS)) {
+ if (zend_build_ssa(&CG(arena), script, op_array, ZEND_SSA_RC_INFERENCE | ZEND_SSA_USE_CV_RESULTS, ssa) != SUCCESS) {
+ return FAILURE;
+ }
+
+ if (zend_ssa_compute_use_def_chains(&CG(arena), op_array, ssa) != SUCCESS) {
+ return FAILURE;
+ }
+
+ if (zend_ssa_find_false_dependencies(op_array, ssa) != SUCCESS) {
+ return FAILURE;
+ }
+
+ if (zend_ssa_find_sccs(op_array, ssa) != SUCCESS){
+ return FAILURE;
+ }
+ }
+
+ return SUCCESS;
+}
+
+static int zend_jit_op_array_analyze2(const zend_op_array *op_array, zend_script *script, zend_ssa *ssa)
+{
+ if ((zend_jit_level >= ZEND_JIT_LEVEL_OPT_FUNC)
+ && ssa->cfg.blocks
+ && op_array->last_try_catch == 0
+ && !(op_array->fn_flags & ZEND_ACC_GENERATOR)
+ && !(ssa->cfg.flags & ZEND_FUNC_INDIRECT_VAR_ACCESS)) {
+
+ uint32_t optimization_level = ZCG(accel_directives).optimization_level;
+ if (zend_ssa_inference(&CG(arena), op_array, script, ssa, optimization_level) != SUCCESS) {
+ return FAILURE;
+ }
+ }
+
+ return SUCCESS;
+}
+
+static int zend_jit_add_range(zend_lifetime_interval **intervals, int var, uint32_t from, uint32_t to)
+{
+ zend_lifetime_interval *ival = intervals[var];
+
+ if (!ival) {
+ ival = zend_arena_alloc(&CG(arena), sizeof(zend_lifetime_interval));
+ if (!ival) {
+ return FAILURE;
+ }
+ ival->ssa_var = var;
+ ival->reg = ZREG_NONE;
+ ival->split = 0;
+ ival->store = 0;
+ ival->load = 0;
+ ival->range.start = from;
+ ival->range.end = to;
+ ival->range.next = NULL;
+ ival->hint = NULL;
+ ival->used_as_hint = NULL;
+ intervals[var] = ival;
+ } else if (ival->range.start > to + 1) {
+ zend_life_range *range = zend_arena_alloc(&CG(arena), sizeof(zend_life_range));
+
+ if (!range) {
+ return FAILURE;
+ }
+ range->start = ival->range.start;
+ range->end = ival->range.end;
+ range->next = ival->range.next;
+ ival->range.start = from;
+ ival->range.end = to;
+ ival->range.next = range;
+ } else if (ival->range.start == to + 1) {
+ ival->range.start = from;
+ } else {
+ zend_life_range *range = &ival->range;
+ zend_life_range *last = NULL;
+
+ do {
+ if (range->start > to + 1) {
+ break;
+ } else if (range->end + 1 >= from) {
+ if (range->start > from) {
+ range->start = from;
+ }
+ last = range;
+ range = range->next;
+ while (range) {
+ if (range->start > to + 1) {
+ break;
+ }
+ last->end = range->end;
+ range = range->next;
+ last->next = range;
+ }
+ if (to > last->end) {
+ last->end = to;
+ }
+ return SUCCESS;
+ }
+ last = range;
+ range = range->next;
+ } while (range);
+
+ range = zend_arena_alloc(&CG(arena), sizeof(zend_life_range));
+ if (!range) {
+ return FAILURE;
+ }
+ range->start = from;
+ range->end = to;
+ range->next = last->next;
+ last->next = range;
+ }
+
+ return SUCCESS;
+}
+
+static int zend_jit_begin_range(zend_lifetime_interval **intervals, int var, uint32_t block_start, uint32_t from)
+{
+ if (block_start != from && intervals[var]) {
+ zend_life_range *range = &intervals[var]->range;
+
+ do {
+ if (from >= range->start && from <= range->end) {
+ if (range->start == block_start) {
+ range->start = from;
+ } else {
+ zend_life_range *r = zend_arena_alloc(&CG(arena), sizeof(zend_life_range));
+ if (!r) {
+ return FAILURE;
+ }
+ r->start = from;
+ r->end = range->end;
+ r->next = range->next;
+ range->end = block_start - 1;
+ range->next = r;
+ }
+ return SUCCESS;
+ }
+ range = range->next;
+ } while (range);
+ }
+
+ // dead store
+ return zend_jit_add_range(intervals, var, from, from);
+}
+
+static void zend_jit_insert_interval(zend_lifetime_interval **list, zend_lifetime_interval *ival)
+{
+ while (1) {
+ if (*list == NULL) {
+ *list = ival;
+ ival->list_next = NULL;
+ return;
+ } else if (ival->range.start < (*list)->range.start) {
+ ival->list_next = *list;
+ *list = ival;
+ return;
+ }
+ list = &(*list)->list_next;
+ }
+}
+
+static int zend_jit_split_interval(zend_lifetime_interval *current, uint32_t pos, zend_lifetime_interval **list, zend_lifetime_interval **free)
+{
+ zend_lifetime_interval *ival;
+ zend_life_range *range = &current->range;
+ zend_life_range *prev = NULL;
+
+ if (*free) {
+ ival = *free;
+ *free = ival->list_next;
+ } else {
+ ival = zend_arena_alloc(&CG(arena), sizeof(zend_lifetime_interval));
+
+ if (!ival) {
+ return FAILURE;
+ }
+ }
+
+ current->store = 1;
+
+ ival->ssa_var = current->ssa_var;
+ ival->reg = ZREG_NONE;
+ ival->split = 1;
+ ival->store = 0;
+ ival->load = 1;
+ ival->hint = NULL;
+
+ do {
+ if (pos >= range->start && pos <= range->end) {
+ break;
+ }
+ prev = range;
+ range = range->next;
+ } while(range);
+
+ ZEND_ASSERT(range != NULL);
+
+ ival->range.start = pos;
+ ival->range.end = range->end;
+ ival->range.next = range->next;
+
+ if (pos == range->start) {
+ ZEND_ASSERT(prev != NULL);
+ prev->next = NULL;
+ } else {
+ range->end = pos - 1;
+ }
+
+ zend_jit_insert_interval(list, ival);
+
+ return SUCCESS;
+}
+
+static zend_lifetime_interval *zend_jit_sort_intervals(zend_lifetime_interval **intervals, int count)
+{
+ zend_lifetime_interval *list, *last;
+ int i;
+
+ list = NULL;
+ i = 0;
+ while (i < count) {
+ list = intervals[i];
+ i++;
+ if (list) {
+ last = list;
+ last->list_next = NULL;
+ break;
+ }
+ }
+
+ while (i < count) {
+ zend_lifetime_interval *ival = intervals[i];
+
+ i++;
+ if (ival) {
+ if ((ival->range.start > last->range.start) ||
+ (ival->range.start == last->range.start &&
+ ival->range.end > last->range.end)) {
+ last->list_next = ival;
+ last = ival;
+ ival->list_next = NULL;
+ } else {
+ zend_lifetime_interval **p = &list;
+
+ while (1) {
+ if (*p == NULL) {
+ *p = last = ival;
+ ival->list_next = NULL;
+ break;
+ } else if ((ival->range.start < (*p)->range.start) ||
+ (ival->range.start == (*p)->range.start &&
+ ival->range.end < (*p)->range.end)) {
+ ival->list_next = *p;
+ *p = ival;
+ break;
+ }
+ p = &(*p)->list_next;
+ }
+ }
+ }
+ }
+
+ return list;
+}
+
+static ZEND_ATTRIBUTE_UNUSED void zend_jit_print_regset(zend_regset regset)
+{
+ zend_reg reg;
+ int first = 1;
+
+ ZEND_REGSET_FOREACH(regset, reg) {
+ if (first) {
+ first = 0;
+ fprintf(stderr, "%s", zend_reg_name[reg]);
+ } else {
+ fprintf(stderr, ", %s", zend_reg_name[reg]);
+ }
+ } ZEND_REGSET_FOREACH_END();
+}
+
+static int *zend_jit_compute_block_order_int(zend_ssa *ssa, int n, int *block_order)
+{
+ zend_basic_block *b = ssa->cfg.blocks + n;
+
+tail_call:
+ *block_order = n;
+ block_order++;
+
+ n = b->children;
+ while (n >= 0) {
+ b = ssa->cfg.blocks + n;
+ if (b->next_child < 0) {
+ goto tail_call;
+ }
+ block_order = zend_jit_compute_block_order_int(ssa, n, block_order);
+ n = b->next_child;
+ }
+
+ return block_order;
+}
+
+static int zend_jit_compute_block_order(zend_ssa *ssa, int *block_order)
+{
+ int *end = zend_jit_compute_block_order_int(ssa, 0, block_order);
+
+ return end - block_order;
+}
+
+static zend_bool zend_jit_in_loop(zend_ssa *ssa, int header, zend_basic_block *b)
+{
+ while (b->loop_header >= 0) {
+ if (b->loop_header == header) {
+ return 1;
+ }
+ b = ssa->cfg.blocks + b->loop_header;
+ }
+ return 0;
+}
+
+static void zend_jit_compute_loop_body(zend_ssa *ssa, int header, int n, zend_bitset loop_body)
+{
+ zend_basic_block *b = ssa->cfg.blocks + n;
+ uint32_t i;
+
+tail_call:
+ if (b->len) {
+ for (i = b->start; i < b->start + b->len; i++) {
+ zend_bitset_incl(loop_body, i);
+ }
+ }
+
+ n = b->children;
+ while (n >= 0) {
+ b = ssa->cfg.blocks + n;
+ if (zend_jit_in_loop(ssa, header, b)) {
+ if (b->next_child < 0) {
+ goto tail_call;
+ }
+ zend_jit_compute_loop_body(ssa, header, n, loop_body);
+ }
+ n = b->next_child;
+ }
+}
+
+static void zend_jit_add_hint(zend_lifetime_interval **intervals, int dst, int src)
+{
+ if (intervals[dst]->range.start < intervals[src]->range.start) {
+ int tmp = src;
+ src = dst;
+ dst = tmp;
+ }
+ while (1) {
+ if (intervals[dst]->hint) {
+ if (intervals[dst]->hint->range.start < intervals[src]->range.start) {
+ int tmp = src;
+ src = intervals[dst]->hint->ssa_var;
+ dst = tmp;
+ } else {
+ dst = intervals[dst]->hint->ssa_var;
+ }
+ } else {
+ if (dst != src) {
+ intervals[dst]->hint = intervals[src];
+ }
+ return;
+ }
+ }
+}
+
+/* See "Linear Scan Register Allocation on SSA Form", Christian Wimmer and
+ Michael Franz, CGO'10 (2010), Figure 4. */
+static int zend_jit_compute_liveness(const zend_op_array *op_array, zend_ssa *ssa, zend_bitset candidates, zend_lifetime_interval **list)
+{
+ int set_size, i, j, k, l;
+ uint32_t n;
+ zend_bitset live, live_in, pi_vars, loop_body;
+ int *block_order;
+ zend_ssa_phi *phi;
+ zend_lifetime_interval **intervals;
+ size_t mem_size;
+ ALLOCA_FLAG(use_heap);
+
+ set_size = zend_bitset_len(ssa->vars_count);
+ mem_size =
+ ZEND_MM_ALIGNED_SIZE(ssa->vars_count * sizeof(zend_lifetime_interval*)) +
+ ZEND_MM_ALIGNED_SIZE((set_size * ssa->cfg.blocks_count) * ZEND_BITSET_ELM_SIZE) +
+ ZEND_MM_ALIGNED_SIZE(set_size * ZEND_BITSET_ELM_SIZE) +
+ ZEND_MM_ALIGNED_SIZE(set_size * ZEND_BITSET_ELM_SIZE) +
+ ZEND_MM_ALIGNED_SIZE(zend_bitset_len(op_array->last) * ZEND_BITSET_ELM_SIZE) +
+ ZEND_MM_ALIGNED_SIZE(ssa->cfg.blocks_count * sizeof(int));
+ intervals = do_alloca(mem_size, use_heap);
+ if (!intervals) {
+ *list = NULL;
+ return FAILURE;
+ }
+
+ live_in = (zend_bitset)((char*)intervals + ZEND_MM_ALIGNED_SIZE(ssa->vars_count * sizeof(zend_lifetime_interval*)));
+ live = (zend_bitset)((char*)live_in + ZEND_MM_ALIGNED_SIZE((set_size * ssa->cfg.blocks_count) * ZEND_BITSET_ELM_SIZE));
+ pi_vars = (zend_bitset)((char*)live + ZEND_MM_ALIGNED_SIZE(set_size * ZEND_BITSET_ELM_SIZE));
+ loop_body = (zend_bitset)((char*)pi_vars + ZEND_MM_ALIGNED_SIZE(set_size * ZEND_BITSET_ELM_SIZE));
+ block_order = (int*)((char*)loop_body + ZEND_MM_ALIGNED_SIZE(zend_bitset_len(op_array->last) * ZEND_BITSET_ELM_SIZE));
+
+ memset(intervals, 0, ssa->vars_count * sizeof(zend_lifetime_interval*));
+ zend_bitset_clear(live_in, set_size * ssa->cfg.blocks_count);
+
+ /* TODO: Provide a linear block order where all dominators of a block
+ * are before this block, and where all blocks belonging to the same loop
+ * are contiguous ???
+ */
+ for (l = zend_jit_compute_block_order(ssa, block_order) - 1; l >= 0; l--) {
+ zend_basic_block *b;
+
+ i = block_order[l];
+ b = ssa->cfg.blocks + i;
+
+ /* live = UNION of successor.liveIn for each successor of b */
+ /* live.add(phi.inputOf(b)) for each phi of successors of b */
+ zend_bitset_clear(live, set_size);
+ for (j = 0; j < b->successors_count; j++) {
+ int succ = b->successors[j];
+
+ zend_bitset_union(live, live_in + set_size * succ, set_size);
+ zend_bitset_clear(pi_vars, set_size);
+ for (phi = ssa->blocks[succ].phis; phi; phi = phi->next) {
+ if (ssa->vars[phi->ssa_var].no_val) {
+ /* skip */
+ } else if (phi->pi >= 0) {
+ if (phi->pi == i && phi->sources[0] >= 0) {
+ if (zend_bitset_in(candidates, phi->sources[0])) {
+ zend_bitset_incl(live, phi->sources[0]);
+ }
+ zend_bitset_incl(pi_vars, phi->var);
+ }
+ } else if (!zend_bitset_in(pi_vars, phi->var)) {
+ for (k = 0; k < ssa->cfg.blocks[succ].predecessors_count; k++) {
+ if (ssa->cfg.predecessors[ssa->cfg.blocks[succ].predecessor_offset + k] == i) {
+ if (phi->sources[k] >= 0 && zend_bitset_in(candidates, phi->sources[k])) {
+ zend_bitset_incl(live, phi->sources[k]);
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ /* addRange(var, b.from, b.to) for each var in live */
+ ZEND_BITSET_FOREACH(live, set_size, j) {
+ if (zend_bitset_in(candidates, j)) {
+ if (zend_jit_add_range(intervals, j, b->start, b->start + b->len - 1) != SUCCESS) {
+ goto failure;
+ }
+ }
+ } ZEND_BITSET_FOREACH_END();
+
+ /* for each operation op of b in reverse order */
+ for (n = b->start + b->len; n > b->start;) {
+ zend_ssa_op *op;
+ const zend_op *opline;
+ uint32_t num;
+
+ n--;
+ op = ssa->ops + n;
+ opline = op_array->opcodes + n;
+
+ if (UNEXPECTED(opline->opcode == ZEND_OP_DATA)) {
+ num = n - 1;
+ } else {
+ num = n;
+ }
+
+ /* for each output operand opd of op do */
+ /* setFrom(opd, op) */
+ /* live.remove(opd) */
+ if (op->op1_def >= 0 && zend_bitset_in(candidates, op->op1_def)) {
+ if (zend_jit_begin_range(intervals, op->op1_def, b->start, num) != SUCCESS) {
+ goto failure;
+ }
+ zend_bitset_excl(live, op->op1_def);
+ }
+ if (op->op2_def >= 0 && zend_bitset_in(candidates, op->op2_def)) {
+ if (zend_jit_begin_range(intervals, op->op2_def, b->start, num) != SUCCESS) {
+ goto failure;
+ }
+ zend_bitset_excl(live, op->op2_def);
+ }
+ if (op->result_def >= 0 && zend_bitset_in(candidates, op->result_def)) {
+ if (zend_jit_begin_range(intervals, op->result_def, b->start, num) != SUCCESS) {
+ goto failure;
+ }
+ zend_bitset_excl(live, op->result_def);
+ }
+
+ /* for each input operand opd of op do */
+ /* live.add(opd) */
+ /* addRange(opd, b.from, op) */
+ if (op->op1_use >= 0
+ && zend_bitset_in(candidates, op->op1_use)
+ && !zend_ssa_is_no_val_use(opline, op, op->op1_use)) {
+ zend_bitset_incl(live, op->op1_use);
+ if (zend_jit_add_range(intervals, op->op1_use, b->start, num) != SUCCESS) {
+ goto failure;
+ }
+ }
+ if (op->op2_use >= 0
+ && zend_bitset_in(candidates, op->op2_use)
+ && !zend_ssa_is_no_val_use(opline, op, op->op2_use)) {
+ zend_bitset_incl(live, op->op2_use);
+ if (zend_jit_add_range(intervals, op->op2_use, b->start, num) != SUCCESS) {
+ goto failure;
+ }
+ }
+ if (op->result_use >= 0
+ && zend_bitset_in(candidates, op->result_use)
+ && !zend_ssa_is_no_val_use(opline, op, op->result_use)) {
+ zend_bitset_incl(live, op->result_use);
+ if (zend_jit_add_range(intervals, op->result_use, b->start, num) != SUCCESS) {
+ goto failure;
+ }
+ }
+ }
+
+ /* live.remove(phi.output) for each phi of b */
+ for (phi = ssa->blocks[i].phis; phi; phi = phi->next) {
+ zend_bitset_excl(live, phi->ssa_var);
+ }
+
+ /* b.liveIn = live */
+ zend_bitset_copy(live_in + set_size * i, live, set_size);
+ }
+
+ for (i = ssa->cfg.blocks_count - 1; i >= 0; i--) {
+ zend_basic_block *b = ssa->cfg.blocks + i;
+
+ /* if b is loop header */
+ if ((b->flags & ZEND_BB_LOOP_HEADER)) {
+ live = live_in + set_size * i;
+
+ if (!zend_bitset_empty(live, set_size)) {
+ uint32_t set_size2 = zend_bitset_len(op_array->last);
+
+ zend_bitset_clear(loop_body, set_size2);
+ zend_jit_compute_loop_body(ssa, i, i, loop_body);
+ while (!zend_bitset_empty(loop_body, set_size2)) {
+ uint32_t from = zend_bitset_first(loop_body, set_size2);
+ uint32_t to = from;
+
+ do {
+ zend_bitset_excl(loop_body, to);
+ to++;
+ } while (zend_bitset_in(loop_body, to));
+ to--;
+
+ ZEND_BITSET_FOREACH(live, set_size, j) {
+ if (zend_jit_add_range(intervals, j, from, to) != SUCCESS) {
+ goto failure;
+ }
+ } ZEND_BITSET_FOREACH_END();
+ }
+ }
+ }
+
+ }
+
+ if (zend_jit_reg_alloc >= ZEND_JIT_REG_ALLOC_GLOBAL) {
+ /* Register hinting (a cheap way for register coalescing) */
+ for (i = 0; i < ssa->vars_count; i++) {
+ if (intervals[i]) {
+ int var = intervals[i]->ssa_var;
+ int src;
+
+ if (ssa->vars[var].definition_phi) {
+ zend_ssa_phi *phi = ssa->vars[var].definition_phi;
+
+ if (phi->pi >= 0) {
+ src = phi->sources[0];
+ if (intervals[src]) {
+ zend_jit_add_hint(intervals, i, src);
+ }
+ } else {
+ for (k = 0; k < ssa->cfg.blocks[phi->block].predecessors_count; k++) {
+ src = phi->sources[k];
+ if (src >= 0) {
+ if (ssa->vars[src].definition_phi
+ && ssa->vars[src].definition_phi->pi >= 0
+ && phi->block == ssa->vars[src].definition_phi->block) {
+ /* Skip zero-lenght interval for Pi variable */
+ src = ssa->vars[src].definition_phi->sources[0];
+ }
+ if (intervals[src]) {
+ zend_jit_add_hint(intervals, i, src);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ for (i = 0; i < ssa->vars_count; i++) {
+ if (intervals[i] && !intervals[i]->hint) {
+ int var = intervals[i]->ssa_var;
+
+ if (ssa->vars[var].definition >= 0) {
+ uint32_t line = ssa->vars[var].definition;
+ const zend_op *opline = op_array->opcodes + line;
+
+ switch (opline->opcode) {
+ case ZEND_QM_ASSIGN:
+ case ZEND_POST_INC:
+ case ZEND_POST_DEC:
+ if (ssa->ops[line].op1_use >= 0 &&
+ intervals[ssa->ops[line].op1_use] &&
+ (var == ssa->ops[line].op1_def ||
+ (var == ssa->ops[line].result_def &&
+ (ssa->ops[line].op1_def < 0 ||
+ !intervals[ssa->ops[line].op1_def])))) {
+ zend_jit_add_hint(intervals, i, ssa->ops[line].op1_use);
+ }
+ break;
+ case ZEND_SEND_VAR:
+ case ZEND_PRE_INC:
+ case ZEND_PRE_DEC:
+ if (var == ssa->ops[line].op1_def &&
+ ssa->ops[line].op1_use >= 0 &&
+ intervals[ssa->ops[line].op1_use]) {
+ zend_jit_add_hint(intervals, i, ssa->ops[line].op1_use);
+ }
+ break;
+ case ZEND_ASSIGN:
+ if (ssa->ops[line].op2_use >= 0 &&
+ intervals[ssa->ops[line].op2_use] &&
+ (var == ssa->ops[line].op2_def ||
+ (var == ssa->ops[line].op1_def &&
+ (ssa->ops[line].op2_def < 0 ||
+ !intervals[ssa->ops[line].op2_def])) ||
+ (var == ssa->ops[line].result_def &&
+ (ssa->ops[line].op2_def < 0 ||
+ !intervals[ssa->ops[line].op2_def]) &&
+ (ssa->ops[line].op1_def < 0 ||
+ !intervals[ssa->ops[line].op1_def])))) {
+ zend_jit_add_hint(intervals, i, ssa->ops[line].op2_use);
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ *list = zend_jit_sort_intervals(intervals, ssa->vars_count);
+
+ if (*list) {
+ zend_lifetime_interval *ival = *list;
+ while (ival) {
+ if (ival->hint) {
+ ival->hint->used_as_hint = ival;
+ }
+ ival = ival->list_next;
+ }
+ }
+
+ free_alloca(intervals, use_heap);
+ return SUCCESS;
+
+failure:
+ *list = NULL;
+ free_alloca(intervals, use_heap);
+ return FAILURE;
+}
+
+static uint32_t zend_interval_end(zend_lifetime_interval *ival)
+{
+ zend_life_range *range = &ival->range;
+
+ while (range->next) {
+ range = range->next;
+ }
+ return range->end;
+}
+
+static zend_bool zend_interval_covers(zend_lifetime_interval *ival, uint32_t position)
+{
+ zend_life_range *range = &ival->range;
+
+ do {
+ if (position >= range->start && position <= range->end) {
+ return 1;
+ }
+ range = range->next;
+ } while (range);
+
+ return 0;
+}
+
+static uint32_t zend_interval_intersection(zend_lifetime_interval *ival1, zend_lifetime_interval *ival2)
+{
+ zend_life_range *r1 = &ival1->range;
+ zend_life_range *r2 = &ival2->range;
+
+ do {
+ if (r1->start <= r2->end) {
+ if (r2->start <= r1->end) {
+ return MAX(r1->start, r2->start);
+ } else {
+ r2 = r2->next;
+ }
+ } else {
+ r1 = r1->next;
+ }
+ } while (r1 && r2);
+
+ return 0xffffffff;
+}
+
+/* See "Optimized Interval Splitting in a Linear Scan Register Allocator",
+ Christian Wimmer VEE'05 (2005), Figure 4. Allocation without spilling */
+static int zend_jit_try_allocate_free_reg(const zend_op_array *op_array, zend_ssa *ssa, zend_lifetime_interval *current, zend_regset available, zend_regset *hints, zend_lifetime_interval *active, zend_lifetime_interval *inactive, zend_lifetime_interval **list, zend_lifetime_interval **free)
+{
+ zend_lifetime_interval *it;
+ uint32_t freeUntilPos[ZREG_NUM];
+ uint32_t pos, pos2;
+ zend_reg i, reg, reg2;
+ zend_reg hint = ZREG_NONE;
+ zend_regset low_priority_regs;
+ zend_life_range *range;
+
+ if ((ssa->var_info[current->ssa_var].type & MAY_BE_ANY) == MAY_BE_DOUBLE) {
+ available = ZEND_REGSET_INTERSECTION(available, ZEND_REGSET_FP);
+ } else {
+ available = ZEND_REGSET_INTERSECTION(available, ZEND_REGSET_GP);
+ }
+
+ /* TODO: Allow usage of preserved registers ???
+ * Their values have to be stored in prologuee and restored in epilogue
+ */
+ available = ZEND_REGSET_DIFFERENCE(available, ZEND_REGSET_PRESERVED);
+
+ if (ZEND_REGSET_IS_EMPTY(available)) {
+ return 0;
+ }
+
+ /* Set freeUntilPos of all physical registers to maxInt */
+ for (i = 0; i < ZREG_NUM; i++) {
+ freeUntilPos[i] = 0xffffffff;
+ }
+
+ /* for each interval it in active do */
+ /* freeUntilPos[it.reg] = 0 */
+ it = active;
+ if (ssa->vars[current->ssa_var].definition == current->range.start) {
+ while (it) {
+ if (current->range.start != zend_interval_end(it)) {
+ freeUntilPos[it->reg] = 0;
+ } else if (zend_jit_may_reuse_reg(op_array, ssa, current->range.start, current->ssa_var, it->ssa_var)) {
+ if (!ZEND_REGSET_IN(*hints, it->reg) &&
+ /* TODO: Avoid most often scratch registers. Find a better way ??? */
+ (!current->used_as_hint ||
+ (it->reg != ZREG_R0 && it->reg != ZREG_R1 && it->reg != ZREG_XMM0 && it->reg != ZREG_XMM1))) {
+ hint = it->reg;
+ }
+ } else {
+ freeUntilPos[it->reg] = 0;
+ }
+ it = it->list_next;
+ }
+ } else {
+ while (it) {
+ freeUntilPos[it->reg] = 0;
+ it = it->list_next;
+ }
+ }
+ if (current->hint) {
+ hint = current->hint->reg;
+ if (hint != ZREG_NONE && current->hint->used_as_hint == current) {
+ ZEND_REGSET_EXCL(*hints, hint);
+ }
+ }
+
+ /* See "Linear Scan Register Allocation on SSA Form", Christian Wimmer and
+ Michael Franz, CGO'10 (2010), Figure 6. */
+ if (current->split) {
+ /* for each interval it in inactive intersecting with current do */
+ /* freeUntilPos[it.reg] = next intersection of it with current */
+ it = inactive;
+ while (it) {
+ uint32_t next = zend_interval_intersection(current, it);
+
+ //ZEND_ASSERT(next != 0xffffffff && !current->split);
+ if (next < freeUntilPos[it->reg]) {
+ freeUntilPos[it->reg] = next;
+ }
+ it = it->list_next;
+ }
+ }
+
+ /* Handle Scratch Registers */
+ /* TODO: Optimize ??? */
+ range = &current->range;
+ do {
+ uint32_t line = range->start;
+ zend_regset regset;
+ zend_reg reg;
+
+ if (ssa->ops[line].op1_def == current->ssa_var ||
+ ssa->ops[line].op2_def == current->ssa_var ||
+ ssa->ops[line].result_def == current->ssa_var) {
+ line++;
+ }
+ while (line <= range->end) {
+ regset = zend_jit_get_scratch_regset(op_array, ssa, line, current->ssa_var);
+ ZEND_REGSET_FOREACH(regset, reg) {
+ if (line < freeUntilPos[reg]) {
+ freeUntilPos[reg] = line;
+ }
+ } ZEND_REGSET_FOREACH_END();
+ line++;
+ }
+ range = range->next;
+ } while (range);
+
+#if 0
+ /* Coalesing */
+ if (ssa->vars[current->ssa_var].definition == current->start) {
+ zend_op *opline = op_array->opcodes + current->start;
+ int hint = -1;
+
+ switch (opline->opcode) {
+ case ZEND_ASSIGN:
+ hint = ssa->ops[current->start].op2_use;
+ case ZEND_QM_ASSIGN:
+ hint = ssa->ops[current->start].op1_use;
+ break;
+ case ZEND_ADD:
+ case ZEND_SUB:
+ case ZEND_MUL:
+ hint = ssa->ops[current->start].op1_use;
+ break;
+ case ZEND_ASSIGN_OP:
+ if (opline->extended_value == ZEND_ADD
+ || opline->extended_value == ZEND_SUB
+ || opline->extended_value == ZEND_MUL) {
+ hint = ssa->ops[current->start].op1_use;
+ }
+ break;
+ }
+ if (hint >= 0) {
+ }
+ }
+#endif
+
+ if (hint != ZREG_NONE && freeUntilPos[hint] > zend_interval_end(current)) {
+ current->reg = hint;
+ if (current->used_as_hint) {
+ ZEND_REGSET_INCL(*hints, hint);
+ }
+ return 1;
+ }
+
+ pos = 0; reg = ZREG_NONE;
+ pos2 = 0; reg2 = ZREG_NONE;
+ low_priority_regs = *hints;
+ if (current->used_as_hint) {
+ /* TODO: Avoid most often scratch registers. Find a better way ??? */
+ ZEND_REGSET_INCL(low_priority_regs, ZREG_R0);
+ ZEND_REGSET_INCL(low_priority_regs, ZREG_R1);
+ ZEND_REGSET_INCL(low_priority_regs, ZREG_XMM0);
+ ZEND_REGSET_INCL(low_priority_regs, ZREG_XMM1);
+ }
+
+ ZEND_REGSET_FOREACH(available, i) {
+ if (ZEND_REGSET_IN(low_priority_regs, i)) {
+ if (freeUntilPos[i] > pos2) {
+ reg2 = i;
+ pos2 = freeUntilPos[i];
+ }
+ } else if (freeUntilPos[i] > pos) {
+ reg = i;
+ pos = freeUntilPos[i];
+ }
+ } ZEND_REGSET_FOREACH_END();
+
+ if (reg == ZREG_NONE) {
+ if (reg2 != ZREG_NONE) {
+ reg = reg2;
+ pos = pos2;
+ reg2 = ZREG_NONE;
+ }
+ }
+
+ if (reg == ZREG_NONE) {
+ /* no register available without spilling */
+ return 0;
+ } else if (zend_interval_end(current) < pos) {
+ /* register available for the whole interval */
+ current->reg = reg;
+ if (current->used_as_hint) {
+ ZEND_REGSET_INCL(*hints, reg);
+ }
+ return 1;
+#if 0
+ // TODO: allow low prioirity register usage
+ } else if (reg2 != ZREG_NONE && zend_interval_end(current) < pos2) {
+ /* register available for the whole interval */
+ current->reg = reg2;
+ if (current->used_as_hint) {
+ ZEND_REGSET_INCL(*hints, reg2);
+ }
+ return 1;
+#endif
+ } else {
+ /* TODO: enable interval splitting ??? */
+ /* register available for the first part of the interval */
+ if (1 || zend_jit_split_interval(current, pos, list, free) != SUCCESS) {
+ return 0;
+ }
+ current->reg = reg;
+ if (current->used_as_hint) {
+ ZEND_REGSET_INCL(*hints, reg);
+ }
+ return 1;
+ }
+}
+
+/* See "Optimized Interval Splitting in a Linear Scan Register Allocator",
+ Christian Wimmer VEE'05 (2005), Figure 5. Allocation with spilling.
+ and "Linear Scan Register Allocation on SSA Form", Christian Wimmer and
+ Michael Franz, CGO'10 (2010), Figure 6. */
+static int zend_jit_allocate_blocked_reg(void)
+{
+ /* TODO: ??? */
+ return 0;
+}
+
+/* See "Optimized Interval Splitting in a Linear Scan Register Allocator",
+ Christian Wimmer VEE'10 (2005), Figure 2. */
+static zend_lifetime_interval* zend_jit_linear_scan(const zend_op_array *op_array, zend_ssa *ssa, zend_lifetime_interval *list)
+{
+ zend_lifetime_interval *unhandled, *active, *inactive, *handled, *free;
+ zend_lifetime_interval *current, **p, *q;
+ uint32_t position;
+ zend_regset available = ZEND_REGSET_UNION(ZEND_REGSET_GP, ZEND_REGSET_FP);
+ zend_regset hints = ZEND_REGSET_EMPTY;
+
+ unhandled = list;
+ /* active = inactive = handled = free = {} */
+ active = inactive = handled = free = NULL;
+ while (unhandled != NULL) {
+ current = unhandled;
+ unhandled = unhandled->list_next;
+ position = current->range.start;
+
+ p = &active;
+ while (*p) {
+ uint32_t end = zend_interval_end(*p);
+
+ q = *p;
+ if (end < position) {
+ /* move ival from active to handled */
+ ZEND_REGSET_INCL(available, q->reg);
+ *p = q->list_next;
+ q->list_next = handled;
+ handled = q;
+ } else if (!zend_interval_covers(q, position)) {
+ /* move ival from active to inactive */
+ ZEND_REGSET_INCL(available, q->reg);
+ *p = q->list_next;
+ q->list_next = inactive;
+ inactive = q;
+ } else {
+ p = &q->list_next;
+ }
+ }
+
+ p = &inactive;
+ while (*p) {
+ uint32_t end = zend_interval_end(*p);
+
+ q = *p;
+ if (end < position) {
+ /* move ival from inactive to handled */
+ *p = q->list_next;
+ q->list_next = handled;
+ handled = q;
+ } else if (zend_interval_covers(q, position)) {
+ /* move ival from inactive to active */
+ ZEND_REGSET_EXCL(available, q->reg);
+ *p = q->list_next;
+ q->list_next = active;
+ active = q;
+ } else {
+ p = &q->list_next;
+ }
+ }
+
+ if (zend_jit_try_allocate_free_reg(op_array, ssa, current, available, &hints, active, inactive, &unhandled, &free) ||
+ zend_jit_allocate_blocked_reg()) {
+ ZEND_REGSET_EXCL(available, current->reg);
+ current->list_next = active;
+ active = current;
+ } else {
+ current->list_next = free;
+ free = current;
+ }
+ }
+
+ /* move active to handled */
+ while (active) {
+ current = active;
+ active = active->list_next;
+ current->list_next = handled;
+ handled = current;
+ }
+
+ /* move inactive to handled */
+ while (inactive) {
+ current = inactive;
+ inactive = inactive->list_next;
+ current->list_next = handled;
+ handled = current;
+ }
+
+ return handled;
+}
+
+static zend_lifetime_interval** zend_jit_allocate_registers(const zend_op_array *op_array, zend_ssa *ssa)
+{
+ void *checkpoint;
+ int set_size, candidates_count, i;
+ zend_bitset candidates = NULL;
+ zend_lifetime_interval *list, *ival;
+ zend_lifetime_interval **intervals;
+ ALLOCA_FLAG(use_heap);
+
+ if (!ssa->var_info) {
+ return NULL;
+ }
+
+ /* Identify SSA variables suitable for register allocation */
+ set_size = zend_bitset_len(ssa->vars_count);
+ candidates = ZEND_BITSET_ALLOCA(set_size, use_heap);
+ if (!candidates) {
+ return NULL;
+ }
+ candidates_count = 0;
+ zend_bitset_clear(candidates, set_size);
+ for (i = 0; i < ssa->vars_count; i++) {
+ if (zend_jit_may_be_in_reg(op_array, ssa, i)) {
+ zend_bitset_incl(candidates, i);
+ candidates_count++;
+ }
+ }
+ if (!candidates_count) {
+ free_alloca(candidates, use_heap);
+ return NULL;
+ }
+
+ checkpoint = zend_arena_checkpoint(CG(arena));
+
+ /* Find life-time intervals */
+ if (zend_jit_compute_liveness(op_array, ssa, candidates, &list) != SUCCESS) {
+ goto failure;
+ }
+
+ if (list) {
+ if (ZCG(accel_directives).jit_debug & ZEND_JIT_DEBUG_REG_ALLOC) {
+ fprintf(stderr, "Live Ranges \"%s\"\n", op_array->function_name ? ZSTR_VAL(op_array->function_name) : "[main]");
+ ival = list;
+ while (ival) {
+ zend_life_range *range;
+ int var_num = ssa->vars[ival->ssa_var].var;
+
+ fprintf(stderr, "#%d.", ival->ssa_var);
+ zend_dump_var(op_array, (var_num < op_array->last_var ? IS_CV : 0), var_num);
+ fprintf(stderr, ": %u-%u", ival->range.start, ival->range.end);
+ range = ival->range.next;
+ while (range) {
+ fprintf(stderr, ", %u-%u", range->start, range->end);
+ range = range->next;
+ }
+ if (ival->load) {
+ fprintf(stderr, " load");
+ }
+ if (ival->store) {
+ fprintf(stderr, " store");
+ }
+ if (ival->hint) {
+ var_num = ssa->vars[ival->hint->ssa_var].var;
+ fprintf(stderr, " hint=#%d.", ival->hint->ssa_var);
+ zend_dump_var(op_array, (var_num < op_array->last_var ? IS_CV : 0), var_num);
+ }
+ fprintf(stderr, "\n");
+ ival = ival->list_next;
+ }
+ fprintf(stderr, "\n");
+ }
+
+ /* Linear Scan Register Allocation */
+ list = zend_jit_linear_scan(op_array, ssa, list);
+
+ if (list) {
+ intervals = zend_arena_calloc(&CG(arena), ssa->vars_count, sizeof(zend_lifetime_interval*));
+ if (!intervals) {
+ goto failure;
+ }
+
+ ival = list;
+ while (ival != NULL) {
+ zend_lifetime_interval *next = ival->list_next;
+
+ ival->list_next = intervals[ival->ssa_var];
+ intervals[ival->ssa_var] = ival;
+ ival = next;
+ }
+
+ if (zend_jit_reg_alloc >= ZEND_JIT_REG_ALLOC_GLOBAL) {
+ /* Naive SSA resolution */
+ for (i = 0; i < ssa->vars_count; i++) {
+ if (ssa->vars[i].definition_phi && !ssa->vars[i].no_val) {
+ zend_ssa_phi *phi = ssa->vars[i].definition_phi;
+ int k, src;
+
+ if (phi->pi >= 0) {
+ if (!ssa->vars[i].phi_use_chain
+ || ssa->vars[i].phi_use_chain->block != phi->block) {
+ src = phi->sources[0];
+ if (intervals[i]) {
+ if (!intervals[src]) {
+ intervals[i]->load = 1;
+ } else if (intervals[i]->reg != intervals[src]->reg) {
+ intervals[i]->load = 1;
+ intervals[src]->store = 1;
+ }
+ } else if (intervals[src]) {
+ intervals[src]->store = 1;
+ }
+ }
+ } else {
+ int need_move = 0;
+
+ for (k = 0; k < ssa->cfg.blocks[phi->block].predecessors_count; k++) {
+ src = phi->sources[k];
+ if (src >= 0) {
+ if (ssa->vars[src].definition_phi
+ && ssa->vars[src].definition_phi->pi >= 0
+ && phi->block == ssa->vars[src].definition_phi->block) {
+ /* Skip zero-lenght interval for Pi variable */
+ src = ssa->vars[src].definition_phi->sources[0];
+ }
+ if (intervals[i]) {
+ if (!intervals[src]) {
+ need_move = 1;
+ } else if (intervals[i]->reg != intervals[src]->reg) {
+ need_move = 1;
+ }
+ } else if (intervals[src]) {
+ need_move = 1;
+ }
+ }
+ }
+ if (need_move) {
+ if (intervals[i]) {
+ intervals[i]->load = 1;
+ }
+ for (k = 0; k < ssa->cfg.blocks[phi->block].predecessors_count; k++) {
+ src = phi->sources[k];
+ if (src >= 0) {
+ if (ssa->vars[src].definition_phi
+ && ssa->vars[src].definition_phi->pi >= 0
+ && phi->block == ssa->vars[src].definition_phi->block) {
+ /* Skip zero-lenght interval for Pi variable */
+ src = ssa->vars[src].definition_phi->sources[0];
+ }
+ if (intervals[src]) {
+ intervals[src]->store = 1;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ /* Remove useless register allocation */
+ for (i = 0; i < ssa->vars_count; i++) {
+ if (intervals[i] &&
+ (intervals[i]->load ||
+ (intervals[i]->store && ssa->vars[i].definition >= 0)) &&
+ ssa->vars[i].use_chain < 0) {
+ zend_bool may_remove = 1;
+ zend_ssa_phi *phi = ssa->vars[i].phi_use_chain;
+
+ while (phi) {
+ if (intervals[phi->ssa_var] &&
+ !intervals[phi->ssa_var]->load) {
+ may_remove = 0;
+ break;
+ }
+ phi = zend_ssa_next_use_phi(ssa, i, phi);
+ }
+ if (may_remove) {
+ intervals[i] = NULL;
+ }
+ }
+ }
+ /* Remove intervals used once */
+ for (i = 0; i < ssa->vars_count; i++) {
+ if (intervals[i] &&
+ intervals[i]->load &&
+ intervals[i]->store &&
+ (ssa->vars[i].use_chain < 0 ||
+ zend_ssa_next_use(ssa->ops, i, ssa->vars[i].use_chain) < 0)) {
+ zend_bool may_remove = 1;
+ zend_ssa_phi *phi = ssa->vars[i].phi_use_chain;
+
+ while (phi) {
+ if (intervals[phi->ssa_var] &&
+ !intervals[phi->ssa_var]->load) {
+ may_remove = 0;
+ break;
+ }
+ phi = zend_ssa_next_use_phi(ssa, i, phi);
+ }
+ if (may_remove) {
+ intervals[i] = NULL;
+ }
+ }
+ }
+ }
+
+ if (ZCG(accel_directives).jit_debug & ZEND_JIT_DEBUG_REG_ALLOC) {
+ fprintf(stderr, "Allocated Live Ranges \"%s\"\n", op_array->function_name ? ZSTR_VAL(op_array->function_name) : "[main]");
+ for (i = 0; i < ssa->vars_count; i++) {
+ ival = intervals[i];
+ while (ival) {
+ zend_life_range *range;
+ int var_num = ssa->vars[ival->ssa_var].var;
+
+ fprintf(stderr, "#%d.", ival->ssa_var);
+ zend_dump_var(op_array, (var_num < op_array->last_var ? IS_CV : 0), var_num);
+ fprintf(stderr, ": %u-%u", ival->range.start, ival->range.end);
+ range = ival->range.next;
+ while (range) {
+ fprintf(stderr, ", %u-%u", range->start, range->end);
+ range = range->next;
+ }
+ fprintf(stderr, " (%s)", zend_reg_name[ival->reg]);
+ if (ival->load) {
+ fprintf(stderr, " load");
+ }
+ if (ival->store) {
+ fprintf(stderr, " store");
+ }
+ if (ival->hint) {
+ var_num = ssa->vars[ival->hint->ssa_var].var;
+ fprintf(stderr, " hint=#%d.", ival->hint->ssa_var);
+ zend_dump_var(op_array, (var_num < op_array->last_var ? IS_CV : 0), var_num);
+ if (ival->hint->reg != ZREG_NONE) {
+ fprintf(stderr, " (%s)", zend_reg_name[ival->hint->reg]);
+ }
+ }
+ fprintf(stderr, "\n");
+ ival = ival->list_next;
+ }
+ }
+ fprintf(stderr, "\n");
+ }
+
+ free_alloca(candidates, use_heap);
+ return intervals;
+ }
+ }
+
+failure:
+ zend_arena_release(&CG(arena), checkpoint);
+ free_alloca(candidates, use_heap);
+ return NULL;
+}
+
+static int zend_jit(const zend_op_array *op_array, zend_ssa *ssa, const zend_op *rt_opline)
+{
+ int b, i, end;
+ zend_op *opline;
+ dasm_State* dasm_state = NULL;
+ void *handler;
+ int call_level = 0;
+ void *checkpoint = NULL;
+ zend_lifetime_interval **ra = NULL;
+ zend_bool is_terminated = 1; /* previous basic block is terminated by jump */
+ zend_bool recv_emitted = 0; /* emitted at least one RECV opcode */
+ zend_uchar smart_branch_opcode;
+ uint32_t target_label, target_label2;
+ uint32_t op1_info, op1_def_info, op2_info, res_info, res_use_info;
+ zend_bool send_result;
+ zend_jit_addr op1_addr, op1_def_addr, op2_addr, op2_def_addr, res_addr;
+ zend_class_entry *ce;
+
+ if (ZCG(accel_directives).jit_bisect_limit) {
+ jit_bisect_pos++;
+ if (jit_bisect_pos >= ZCG(accel_directives).jit_bisect_limit) {
+ if (jit_bisect_pos == ZCG(accel_directives).jit_bisect_limit) {
+ fprintf(stderr, "Not JITing %s%s%s in %s:%d and after due to jit_bisect_limit\n",
+ op_array->scope ? ZSTR_VAL(op_array->scope->name) : "",
+ op_array->scope ? "::" : "",
+ op_array->function_name ? ZSTR_VAL(op_array->function_name) : "{main}",
+ ZSTR_VAL(op_array->filename), op_array->line_start);
+ }
+ return FAILURE;
+ }
+ }
+
+ if (zend_jit_reg_alloc) {
+ checkpoint = zend_arena_checkpoint(CG(arena));
+ ra = zend_jit_allocate_registers(op_array, ssa);
+ }
+
+ /* mark hidden branch targets */
+ for (b = 0; b < ssa->cfg.blocks_count; b++) {
+ if (ssa->cfg.blocks[b].flags & ZEND_BB_REACHABLE &&
+ ssa->cfg.blocks[b].len > 1) {
+
+ opline = op_array->opcodes + ssa->cfg.blocks[b].start + ssa->cfg.blocks[b].len - 1;
+ if (opline->opcode == ZEND_DO_FCALL &&
+ (opline-1)->opcode == ZEND_NEW) {
+ ssa->cfg.blocks[ssa->cfg.blocks[b].successors[0]].flags |= ZEND_BB_TARGET;
+ }
+ }
+ }
+
+ dasm_init(&dasm_state, DASM_MAXSECTION);
+ dasm_setupglobal(&dasm_state, dasm_labels, zend_lb_MAX);
+ dasm_setup(&dasm_state, dasm_actions);
+
+ dasm_growpc(&dasm_state, ssa->cfg.blocks_count * 2 + 1);
+
+ zend_jit_align_func(&dasm_state);
+ for (b = 0; b < ssa->cfg.blocks_count; b++) {
+ if ((ssa->cfg.blocks[b].flags & ZEND_BB_REACHABLE) == 0) {
+ continue;
+ }
+//#ifndef CONTEXT_THREADED_JIT
+ if (ssa->cfg.blocks[b].flags & ZEND_BB_ENTRY) {
+ if (ssa->cfg.blocks[b].flags & ZEND_BB_TARGET) {
+ /* pass */
+ } else if (zend_jit_level < ZEND_JIT_LEVEL_INLINE &&
+ ssa->cfg.blocks[b].len == 1 &&
+ (ssa->cfg.blocks[b].flags & ZEND_BB_EXIT) &&
+ op_array->opcodes[ssa->cfg.blocks[b].start].opcode != ZEND_JMP) {
+ /* don't generate code for BB with single opcode */
+ continue;
+ }
+ if (ssa->cfg.blocks[b].flags & ZEND_BB_FOLLOW) {
+ if (!is_terminated) {
+ zend_jit_jmp(&dasm_state, b);
+ }
+ }
+ zend_jit_label(&dasm_state, ssa->cfg.blocks_count + b);
+ zend_jit_prologue(&dasm_state);
+ } else
+//#endif
+ if (ssa->cfg.blocks[b].flags & (ZEND_BB_START|ZEND_BB_RECV_ENTRY)) {
+ opline = op_array->opcodes + ssa->cfg.blocks[b].start;
+ if (ssa->cfg.flags & ZEND_CFG_RECV_ENTRY) {
+ if (opline->opcode == ZEND_RECV_INIT) {
+ if (opline == op_array->opcodes ||
+ (opline-1)->opcode != ZEND_RECV_INIT) {
+ if (recv_emitted) {
+ zend_jit_jmp(&dasm_state, b);
+ }
+ zend_jit_label(&dasm_state, ssa->cfg.blocks_count + b);
+ for (i = 1; (opline+i)->opcode == ZEND_RECV_INIT; i++) {
+ zend_jit_label(&dasm_state, ssa->cfg.blocks_count + b + i);
+ }
+ zend_jit_prologue(&dasm_state);
+ }
+ recv_emitted = 1;
+ } else if (opline->opcode == ZEND_RECV) {
+ if (!(op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS)) {
+ /* skip */
+ continue;
+ } else if (recv_emitted) {
+ zend_jit_jmp(&dasm_state, b);
+ zend_jit_label(&dasm_state, ssa->cfg.blocks_count + b);
+ zend_jit_prologue(&dasm_state);
+ } else {
+ zend_arg_info *arg_info;
+
+ if (opline->op1.num <= op_array->num_args) {
+ arg_info = &op_array->arg_info[opline->op1.num - 1];
+ } else if (op_array->fn_flags & ZEND_ACC_VARIADIC) {
+ arg_info = &op_array->arg_info[op_array->num_args];
+ } else {
+ /* skip */
+ continue;
+ }
+ if (!ZEND_TYPE_IS_SET(arg_info->type)) {
+ /* skip */
+ continue;
+ }
+ zend_jit_label(&dasm_state, ssa->cfg.blocks_count + b);
+ zend_jit_prologue(&dasm_state);
+ recv_emitted = 1;
+ }
+ } else {
+ if (recv_emitted) {
+ zend_jit_jmp(&dasm_state, b);
+ } else if (zend_jit_level < ZEND_JIT_LEVEL_INLINE &&
+ ssa->cfg.blocks[b].len == 1 &&
+ (ssa->cfg.blocks[b].flags & ZEND_BB_EXIT)) {
+ /* don't generate code for BB with single opcode */
+ dasm_free(&dasm_state);
+
+ if (zend_jit_reg_alloc) {
+ zend_arena_release(&CG(arena), checkpoint);
+ }
+ return SUCCESS;
+ }
+ zend_jit_label(&dasm_state, ssa->cfg.blocks_count + b);
+ zend_jit_prologue(&dasm_state);
+ recv_emitted = 1;
+ }
+ } else if (zend_jit_level < ZEND_JIT_LEVEL_INLINE &&
+ ssa->cfg.blocks[b].len == 1 &&
+ (ssa->cfg.blocks[b].flags & ZEND_BB_EXIT)) {
+ /* don't generate code for BB with single opcode */
+ dasm_free(&dasm_state);
+
+ if (zend_jit_reg_alloc) {
+ zend_arena_release(&CG(arena), checkpoint);
+ }
+ return SUCCESS;
+ } else {
+ zend_jit_label(&dasm_state, ssa->cfg.blocks_count + b);
+ zend_jit_prologue(&dasm_state);
+ }
+ }
+
+ is_terminated = 0;
+
+ zend_jit_label(&dasm_state, b);
+ if (zend_jit_level < ZEND_JIT_LEVEL_INLINE) {
+ if ((ssa->cfg.blocks[b].flags & ZEND_BB_FOLLOW)
+ && ssa->cfg.blocks[b].start != 0
+ && (op_array->opcodes[ssa->cfg.blocks[b].start - 1].opcode == ZEND_NOP
+ || op_array->opcodes[ssa->cfg.blocks[b].start - 1].opcode == ZEND_SWITCH_LONG
+ || op_array->opcodes[ssa->cfg.blocks[b].start - 1].opcode == ZEND_SWITCH_STRING)) {
+ if (!zend_jit_reset_opline(&dasm_state, op_array->opcodes + ssa->cfg.blocks[b].start)
+ || !zend_jit_set_valid_ip(&dasm_state, op_array->opcodes + ssa->cfg.blocks[b].start)) {
+ goto jit_failure;
+ }
+ } else {
+ if (!zend_jit_set_opline(&dasm_state, op_array->opcodes + ssa->cfg.blocks[b].start)) {
+ goto jit_failure;
+ }
+ }
+ } else if (ssa->cfg.blocks[b].flags & ZEND_BB_TARGET) {
+ if (!zend_jit_reset_opline(&dasm_state, op_array->opcodes + ssa->cfg.blocks[b].start)) {
+ goto jit_failure;
+ }
+ } else if (ssa->cfg.blocks[b].flags & (ZEND_BB_START|ZEND_BB_RECV_ENTRY|ZEND_BB_ENTRY)) {
+ if (!zend_jit_set_opline(&dasm_state, op_array->opcodes + ssa->cfg.blocks[b].start)) {
+ goto jit_failure;
+ }
+ }
+ if (ssa->cfg.blocks[b].flags & ZEND_BB_LOOP_HEADER) {
+ if (!zend_jit_check_timeout(&dasm_state, op_array->opcodes + ssa->cfg.blocks[b].start)) {
+ goto jit_failure;
+ }
+ }
+ if (!ssa->cfg.blocks[b].len) {
+ continue;
+ }
+ if ((zend_jit_reg_alloc >= ZEND_JIT_REG_ALLOC_GLOBAL) && ra) {
+ zend_ssa_phi *phi = ssa->blocks[b].phis;
+
+ while (phi) {
+ zend_lifetime_interval *ival = ra[phi->ssa_var];
+
+ if (ival) {
+ if (ival->load) {
+ ZEND_ASSERT(ival->reg != ZREG_NONE);
+
+ if (!zend_jit_load_var(&dasm_state, ssa->var_info[phi->ssa_var].type, ssa->vars[phi->ssa_var].var, ival->reg)) {
+ goto jit_failure;
+ }
+ } else if (ival->store) {
+ ZEND_ASSERT(ival->reg != ZREG_NONE);
+
+ if (!zend_jit_store_var(&dasm_state, ssa->var_info[phi->ssa_var].type, ssa->vars[phi->ssa_var].var, ival->reg)) {
+ goto jit_failure;
+ }
+ }
+ }
+ phi = phi->next;
+ }
+ }
+ end = ssa->cfg.blocks[b].start + ssa->cfg.blocks[b].len - 1;
+ for (i = ssa->cfg.blocks[b].start; i <= end; i++) {
+ opline = op_array->opcodes + i;
+ switch (opline->opcode) {
+ case ZEND_INIT_FCALL:
+ case ZEND_INIT_FCALL_BY_NAME:
+ case ZEND_INIT_NS_FCALL_BY_NAME:
+ case ZEND_INIT_METHOD_CALL:
+ case ZEND_INIT_DYNAMIC_CALL:
+ case ZEND_INIT_STATIC_METHOD_CALL:
+ case ZEND_INIT_USER_CALL:
+ case ZEND_NEW:
+ call_level++;
+ }
+
+ if (zend_jit_level >= ZEND_JIT_LEVEL_INLINE) {
+ switch (opline->opcode) {
+ case ZEND_PRE_INC:
+ case ZEND_PRE_DEC:
+ case ZEND_POST_INC:
+ case ZEND_POST_DEC:
+ if (opline->op1_type != IS_CV) {
+ break;
+ }
+ op1_info = OP1_INFO();
+ if (!(op1_info & MAY_BE_LONG)) {
+ break;
+ }
+ if (opline->result_type != IS_UNUSED) {
+ res_use_info = RES_USE_INFO();
+ res_info = RES_INFO();
+ res_addr = RES_REG_ADDR();
+ } else {
+ res_use_info = -1;
+ res_info = -1;
+ res_addr = 0;
+ }
+ op1_def_info = OP1_DEF_INFO();
+ if (!zend_jit_inc_dec(&dasm_state, opline, op_array,
+ op1_info, OP1_REG_ADDR(),
+ op1_def_info, OP1_DEF_REG_ADDR(),
+ res_use_info, res_info,
+ res_addr,
+ (op1_def_info & MAY_BE_LONG) && (op1_def_info & MAY_BE_DOUBLE) && zend_may_overflow(opline, op_array, ssa))) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_BW_OR:
+ case ZEND_BW_AND:
+ case ZEND_BW_XOR:
+ case ZEND_SL:
+ case ZEND_SR:
+ case ZEND_MOD:
+ if (PROFITABILITY_CHECKS && (!ssa->ops || !ssa->var_info)) {
+ break;
+ }
+ op1_info = OP1_INFO();
+ op2_info = OP2_INFO();
+ if ((op1_info & MAY_BE_UNDEF) || (op2_info & MAY_BE_UNDEF)) {
+ break;
+ }
+ if (!(op1_info & MAY_BE_LONG)
+ || !(op2_info & MAY_BE_LONG)) {
+ break;
+ }
+ if (opline->result_type == IS_TMP_VAR
+ && (i + 1) <= end
+ && (opline+1)->opcode == ZEND_SEND_VAL
+ && (opline+1)->op1_type == IS_TMP_VAR
+ && (opline+1)->op1.var == opline->result.var) {
+ i++;
+ send_result = 1;
+ res_use_info = -1;
+ res_addr = 0; /* set inside backend */
+ } else {
+ send_result = 0;
+ res_use_info = RES_USE_INFO();
+ res_addr = RES_REG_ADDR();
+ }
+ if (!zend_jit_long_math(&dasm_state, opline, op_array,
+ op1_info, OP1_RANGE(), OP1_REG_ADDR(),
+ op2_info, OP2_RANGE(), OP2_REG_ADDR(),
+ res_use_info, RES_INFO(), res_addr,
+ send_result,
+ zend_may_throw(opline, op_array, ssa))) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_ADD:
+ case ZEND_SUB:
+ case ZEND_MUL:
+// case ZEND_DIV: // TODO: check for division by zero ???
+ if (PROFITABILITY_CHECKS && (!ssa->ops || !ssa->var_info)) {
+ break;
+ }
+ op1_info = OP1_INFO();
+ op2_info = OP2_INFO();
+ if ((op1_info & MAY_BE_UNDEF) || (op2_info & MAY_BE_UNDEF)) {
+ break;
+ }
+ if (!(op1_info & (MAY_BE_LONG|MAY_BE_DOUBLE)) ||
+ !(op2_info & (MAY_BE_LONG|MAY_BE_DOUBLE))) {
+ break;
+ }
+ if (opline->result_type == IS_TMP_VAR
+ && (i + 1) <= end
+ && (opline+1)->opcode == ZEND_SEND_VAL
+ && (opline+1)->op1_type == IS_TMP_VAR
+ && (opline+1)->op1.var == opline->result.var) {
+ i++;
+ send_result = 1;
+ res_use_info = -1;
+ res_addr = 0; /* set inside backend */
+ } else {
+ send_result = 0;
+ res_use_info = RES_USE_INFO();
+ res_addr = RES_REG_ADDR();
+ }
+ res_info = RES_INFO();
+ if (!zend_jit_math(&dasm_state, opline, op_array,
+ op1_info, OP1_REG_ADDR(),
+ op2_info, OP2_REG_ADDR(),
+ res_use_info, res_info, res_addr,
+ send_result,
+ (res_info & MAY_BE_LONG) && (res_info & MAY_BE_DOUBLE) && zend_may_overflow(opline, op_array, ssa),
+ zend_may_throw(opline, op_array, ssa))) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_CONCAT:
+ case ZEND_FAST_CONCAT:
+ if (PROFITABILITY_CHECKS && (!ssa->ops || !ssa->var_info)) {
+ break;
+ }
+ op1_info = OP1_INFO();
+ op2_info = OP2_INFO();
+ if ((op1_info & MAY_BE_UNDEF) || (op2_info & MAY_BE_UNDEF)) {
+ break;
+ }
+ if (!(op1_info & MAY_BE_STRING) ||
+ !(op2_info & MAY_BE_STRING)) {
+ break;
+ }
+ if (opline->result_type == IS_TMP_VAR
+ && (i + 1) <= end
+ && (opline+1)->opcode == ZEND_SEND_VAL
+ && (opline+1)->op1_type == IS_TMP_VAR
+ && (opline+1)->op1.var == opline->result.var) {
+ i++;
+ send_result = 1;
+ } else {
+ send_result = 0;
+ }
+ if (!zend_jit_concat(&dasm_state, opline, op_array,
+ op1_info, op2_info, RES_INFO(), send_result,
+ zend_may_throw(opline, op_array, ssa))) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_ASSIGN_OP:
+ if (opline->extended_value == ZEND_POW
+ || opline->extended_value == ZEND_DIV) {
+ // TODO: check for division by zero ???
+ break;
+ }
+ if (opline->op1_type != IS_CV || opline->result_type != IS_UNUSED) {
+ break;
+ }
+ if (PROFITABILITY_CHECKS && (!ssa->ops || !ssa->var_info)) {
+ break;
+ }
+ op1_info = OP1_INFO();
+ op2_info = OP2_INFO();
+ if ((op1_info & MAY_BE_UNDEF) || (op2_info & MAY_BE_UNDEF)) {
+ break;
+ }
+ if (opline->extended_value == ZEND_ADD
+ || opline->extended_value == ZEND_SUB
+ || opline->extended_value == ZEND_MUL
+ || opline->extended_value == ZEND_DIV) {
+ if (!(op1_info & (MAY_BE_LONG|MAY_BE_DOUBLE))
+ || !(op2_info & (MAY_BE_LONG|MAY_BE_DOUBLE))) {
+ break;
+ }
+ } else if (opline->extended_value == ZEND_BW_OR
+ || opline->extended_value == ZEND_BW_AND
+ || opline->extended_value == ZEND_BW_XOR
+ || opline->extended_value == ZEND_SL
+ || opline->extended_value == ZEND_SR
+ || opline->extended_value == ZEND_MOD) {
+ if (!(op1_info & MAY_BE_LONG)
+ || !(op2_info & MAY_BE_LONG)) {
+ break;
+ }
+ } else if (opline->extended_value == ZEND_CONCAT) {
+ if (!(op1_info & MAY_BE_STRING)
+ || !(op2_info & MAY_BE_STRING)) {
+ break;
+ }
+ }
+ op1_def_info = OP1_DEF_INFO();
+ if (!zend_jit_assign_op(&dasm_state, opline, op_array,
+ op1_info, op1_def_info, OP1_RANGE(),
+ op2_info, OP2_RANGE(),
+ (op1_def_info & MAY_BE_LONG) && (op1_def_info & MAY_BE_DOUBLE) && zend_may_overflow(opline, op_array, ssa),
+ zend_may_throw(opline, op_array, ssa))) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_ASSIGN_DIM_OP:
+ if (opline->extended_value == ZEND_POW
+ || opline->extended_value == ZEND_DIV) {
+ // TODO: check for division by zero ???
+ break;
+ }
+ if (opline->op1_type != IS_CV || opline->result_type != IS_UNUSED) {
+ break;
+ }
+ if (PROFITABILITY_CHECKS && (!ssa->ops || !ssa->var_info)) {
+ break;
+ }
+ if (!zend_jit_assign_dim_op(&dasm_state, opline, op_array,
+ OP1_INFO(), OP1_DEF_INFO(), OP2_INFO(),
+ OP1_DATA_INFO(), OP1_DATA_RANGE(),
+ zend_may_throw(opline, op_array, ssa))) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_ASSIGN_DIM:
+ if (opline->op1_type != IS_CV) {
+ break;
+ }
+ if (PROFITABILITY_CHECKS && (!ssa->ops || !ssa->var_info)) {
+ break;
+ }
+ if (!zend_jit_assign_dim(&dasm_state, opline, op_array,
+ OP1_INFO(), OP2_INFO(), OP1_DATA_INFO(),
+ zend_may_throw(opline, op_array, ssa))) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_ASSIGN:
+ if (opline->op1_type != IS_CV) {
+ break;
+ }
+ if (PROFITABILITY_CHECKS && (!ssa->ops || !ssa->var_info)) {
+ break;
+ }
+ if (opline->result_type == IS_UNUSED) {
+ res_addr = 0;
+ res_info = -1;
+ } else {
+ res_addr = RES_REG_ADDR();
+ res_info = RES_INFO();
+ }
+ op2_addr = OP2_REG_ADDR();
+ if (ra
+ && ssa->ops[opline - op_array->opcodes].op2_def >= 0
+ && !ssa->vars[ssa->ops[opline - op_array->opcodes].op2_def].no_val) {
+ op2_def_addr = OP2_DEF_REG_ADDR();
+ } else {
+ op2_def_addr = op2_addr;
+ }
+ if (!zend_jit_assign(&dasm_state, opline, op_array,
+ OP1_INFO(), OP1_REG_ADDR(),
+ OP1_DEF_INFO(), OP1_DEF_REG_ADDR(),
+ OP2_INFO(), op2_addr, op2_def_addr,
+ res_info, res_addr,
+ zend_may_throw(opline, op_array, ssa))) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_QM_ASSIGN:
+ op1_addr = OP1_REG_ADDR();
+ if (ra
+ && ssa->ops[opline - op_array->opcodes].op1_def >= 0
+ && !ssa->vars[ssa->ops[opline - op_array->opcodes].op1_def].no_val) {
+ op1_def_addr = OP1_DEF_REG_ADDR();
+ } else {
+ op1_def_addr = op1_addr;
+ }
+ if (!zend_jit_qm_assign(&dasm_state, opline, op_array,
+ OP1_INFO(), op1_addr, op1_def_addr,
+ RES_INFO(), RES_REG_ADDR())) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_INIT_FCALL:
+ case ZEND_INIT_FCALL_BY_NAME:
+ if (!zend_jit_init_fcall(&dasm_state, opline, b, op_array, ssa, call_level)) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_SEND_VAL:
+ case ZEND_SEND_VAL_EX:
+ if (opline->opcode == ZEND_SEND_VAL_EX
+ && opline->op2.num > MAX_ARG_FLAG_NUM) {
+ break;
+ }
+ if (!zend_jit_send_val(&dasm_state, opline, op_array,
+ OP1_INFO(), OP1_REG_ADDR())) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_SEND_REF:
+ if (!zend_jit_send_ref(&dasm_state, opline, op_array,
+ OP1_INFO(), 0)) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_SEND_VAR:
+ case ZEND_SEND_VAR_EX:
+ case ZEND_SEND_VAR_NO_REF:
+ case ZEND_SEND_VAR_NO_REF_EX:
+ if ((opline->opcode == ZEND_SEND_VAR_EX
+ || opline->opcode == ZEND_SEND_VAR_NO_REF_EX)
+ && opline->op2.num > MAX_ARG_FLAG_NUM) {
+ break;
+ }
+ op1_addr = OP1_REG_ADDR();
+ if (ra
+ && ssa->ops[opline - op_array->opcodes].op1_def >= 0
+ && !ssa->vars[ssa->ops[opline - op_array->opcodes].op1_def].no_val) {
+ op1_def_addr = OP1_DEF_REG_ADDR();
+ } else {
+ op1_def_addr = op1_addr;
+ }
+ if (!zend_jit_send_var(&dasm_state, opline, op_array,
+ OP1_INFO(), op1_addr, op1_def_addr)) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_DO_UCALL:
+ is_terminated = 1;
+ /* break missing intentionally */
+ case ZEND_DO_ICALL:
+ case ZEND_DO_FCALL_BY_NAME:
+ case ZEND_DO_FCALL:
+ if (!zend_jit_do_fcall(&dasm_state, opline, op_array, ssa, call_level, b + 1)) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_IS_EQUAL:
+ case ZEND_IS_NOT_EQUAL:
+ case ZEND_IS_SMALLER:
+ case ZEND_IS_SMALLER_OR_EQUAL:
+ case ZEND_CASE:
+ if ((opline->result_type & IS_TMP_VAR)
+ && (i + 1) <= end
+ && ((opline+1)->opcode == ZEND_JMPZ
+ || (opline+1)->opcode == ZEND_JMPNZ
+ || (opline+1)->opcode == ZEND_JMPZ_EX
+ || (opline+1)->opcode == ZEND_JMPNZ_EX
+ || (opline+1)->opcode == ZEND_JMPZNZ)
+ && (opline+1)->op1_type == IS_TMP_VAR
+ && (opline+1)->op1.var == opline->result.var) {
+ i++;
+ smart_branch_opcode = (opline+1)->opcode;
+ target_label = ssa->cfg.blocks[b].successors[0];
+ target_label2 = ssa->cfg.blocks[b].successors[1];
+ } else {
+ smart_branch_opcode = 0;
+ target_label = target_label2 = (uint32_t)-1;
+ }
+ if (!zend_jit_cmp(&dasm_state, opline, op_array,
+ OP1_INFO(), OP1_REG_ADDR(),
+ OP2_INFO(), OP2_REG_ADDR(),
+ RES_REG_ADDR(),
+ zend_may_throw(opline, op_array, ssa),
+ smart_branch_opcode, target_label, target_label2)) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_IS_IDENTICAL:
+ case ZEND_IS_NOT_IDENTICAL:
+ if ((opline->result_type & IS_TMP_VAR)
+ && (i + 1) <= end
+ && ((opline+1)->opcode == ZEND_JMPZ
+ || (opline+1)->opcode == ZEND_JMPNZ
+ || (opline+1)->opcode == ZEND_JMPZNZ)
+ && (opline+1)->op1_type == IS_TMP_VAR
+ && (opline+1)->op1.var == opline->result.var) {
+ i++;
+ smart_branch_opcode = (opline+1)->opcode;
+ target_label = ssa->cfg.blocks[b].successors[0];
+ target_label2 = ssa->cfg.blocks[b].successors[1];
+ } else {
+ smart_branch_opcode = 0;
+ target_label = target_label2 = (uint32_t)-1;
+ }
+ if (!zend_jit_identical(&dasm_state, opline, op_array,
+ OP1_INFO(), OP1_REG_ADDR(),
+ OP2_INFO(), OP2_REG_ADDR(),
+ RES_REG_ADDR(),
+ zend_may_throw(opline, op_array, ssa),
+ smart_branch_opcode, target_label, target_label2)) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_DEFINED:
+ if ((opline->result_type & IS_TMP_VAR)
+ && (i + 1) <= end
+ && ((opline+1)->opcode == ZEND_JMPZ
+ || (opline+1)->opcode == ZEND_JMPNZ
+ || (opline+1)->opcode == ZEND_JMPZNZ)
+ && (opline+1)->op1_type == IS_TMP_VAR
+ && (opline+1)->op1.var == opline->result.var) {
+ i++;
+ smart_branch_opcode = (opline+1)->opcode;
+ target_label = ssa->cfg.blocks[b].successors[0];
+ target_label2 = ssa->cfg.blocks[b].successors[1];
+ } else {
+ smart_branch_opcode = 0;
+ target_label = target_label2 = (uint32_t)-1;
+ }
+ if (!zend_jit_defined(&dasm_state, opline, op_array, smart_branch_opcode, target_label, target_label2)) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_TYPE_CHECK:
+ if (opline->extended_value == MAY_BE_RESOURCE) {
+ // TODO: support for is_resource() ???
+ break;
+ }
+ if ((opline->result_type & IS_TMP_VAR)
+ && (i + 1) <= end
+ && ((opline+1)->opcode == ZEND_JMPZ
+ || (opline+1)->opcode == ZEND_JMPNZ
+ || (opline+1)->opcode == ZEND_JMPZNZ)
+ && (opline+1)->op1_type == IS_TMP_VAR
+ && (opline+1)->op1.var == opline->result.var) {
+ i++;
+ smart_branch_opcode = (opline+1)->opcode;
+ target_label = ssa->cfg.blocks[b].successors[0];
+ target_label2 = ssa->cfg.blocks[b].successors[1];
+ } else {
+ smart_branch_opcode = 0;
+ target_label = target_label2 = (uint32_t)-1;
+ }
+ if (!zend_jit_type_check(&dasm_state, opline, op_array, OP1_INFO(), smart_branch_opcode, target_label, target_label2)) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_RETURN:
+ op1_info = OP1_INFO();
+ if ((PROFITABILITY_CHECKS && (!ssa->ops || !ssa->var_info))
+ || op_array->type == ZEND_EVAL_CODE
+ // TODO: support for top-level code
+ || !op_array->function_name
+ // TODO: support for IS_UNDEF ???
+ || (op1_info & MAY_BE_UNDEF)) {
+ if (!zend_jit_tail_handler(&dasm_state, opline)) {
+ goto jit_failure;
+ }
+ } else if (!zend_jit_return(&dasm_state, opline, op_array, ssa,
+ op1_info, OP1_REG_ADDR())) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_BOOL:
+ case ZEND_BOOL_NOT:
+ if (!zend_jit_bool_jmpznz(&dasm_state, opline, op_array,
+ OP1_INFO(), OP1_REG_ADDR(), RES_REG_ADDR(),
+ -1, -1,
+ zend_may_throw(opline, op_array, ssa))) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_JMPZ:
+ case ZEND_JMPNZ:
+ if (opline > op_array->opcodes + ssa->cfg.blocks[b].start &&
+ ((opline-1)->result_type & (IS_SMART_BRANCH_JMPZ|IS_SMART_BRANCH_JMPNZ)) != 0) {
+ /* smart branch */
+ if (!zend_jit_cond_jmp(&dasm_state, opline + 1, ssa->cfg.blocks[b].successors[0])) {
+ goto jit_failure;
+ }
+ goto done;
+ }
+ /* break missing intentionally */
+ case ZEND_JMPZNZ:
+ case ZEND_JMPZ_EX:
+ case ZEND_JMPNZ_EX:
+ if (opline->result_type == IS_UNDEF) {
+ res_addr = 0;
+ } else {
+ res_addr = RES_REG_ADDR();
+ }
+ if (!zend_jit_bool_jmpznz(&dasm_state, opline, op_array,
+ OP1_INFO(), OP1_REG_ADDR(), res_addr,
+ ssa->cfg.blocks[b].successors[0], ssa->cfg.blocks[b].successors[1],
+ zend_may_throw(opline, op_array, ssa))) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_FETCH_DIM_R:
+ case ZEND_FETCH_DIM_IS:
+ if (PROFITABILITY_CHECKS && (!ssa->ops || !ssa->var_info)) {
+ break;
+ }
+ if (!zend_jit_fetch_dim_read(&dasm_state, opline, op_array,
+ OP1_INFO(), OP2_INFO(), RES_INFO(),
+ zend_may_throw(opline, op_array, ssa))) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_ISSET_ISEMPTY_DIM_OBJ:
+ if ((opline->extended_value & ZEND_ISEMPTY)) {
+ // TODO: support for empty() ???
+ break;
+ }
+ if (PROFITABILITY_CHECKS && (!ssa->ops || !ssa->var_info)) {
+ break;
+ }
+ if ((opline->result_type & IS_TMP_VAR)
+ && (i + 1) <= end
+ && ((opline+1)->opcode == ZEND_JMPZ
+ || (opline+1)->opcode == ZEND_JMPNZ
+ || (opline+1)->opcode == ZEND_JMPZNZ)
+ && (opline+1)->op1_type == IS_TMP_VAR
+ && (opline+1)->op1.var == opline->result.var) {
+ i++;
+ smart_branch_opcode = (opline+1)->opcode;
+ target_label = ssa->cfg.blocks[b].successors[0];
+ target_label2 = ssa->cfg.blocks[b].successors[1];
+ } else {
+ smart_branch_opcode = 0;
+ target_label = target_label2 = (uint32_t)-1;
+ }
+ if (!zend_jit_isset_isempty_dim(&dasm_state, opline, op_array,
+ OP1_INFO(), OP2_INFO(),
+ zend_may_throw(opline, op_array, ssa),
+ smart_branch_opcode, target_label, target_label2)) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_FETCH_OBJ_R:
+ case ZEND_FETCH_OBJ_IS:
+ if (opline->op2_type != IS_CONST
+ || Z_TYPE_P(RT_CONSTANT(opline, opline->op2)) != IS_STRING
+ || Z_STRVAL_P(RT_CONSTANT(opline, opline->op2))[0] == '\0') {
+ break;
+ }
+ ce = NULL;
+ if (opline->op1_type == IS_UNUSED) {
+ op1_info = MAY_BE_OBJECT|MAY_BE_RC1|MAY_BE_RCN;
+ ce = op_array->scope;
+ } else {
+ op1_info = OP1_INFO();
+ if (ssa->var_info && ssa->ops) {
+ zend_ssa_op *ssa_op = &ssa->ops[opline - op_array->opcodes];
+ if (ssa_op->op1_use >= 0) {
+ zend_ssa_var_info *op1_ssa = ssa->var_info + ssa_op->op1_use;
+ if (op1_ssa->ce && !op1_ssa->is_instanceof && !op1_ssa->ce->create_object) {
+ ce = op1_ssa->ce;
+ }
+ }
+ }
+ }
+ if (!(op1_info & MAY_BE_OBJECT)) {
+ break;
+ }
+ if (!zend_jit_fetch_obj_read(&dasm_state, opline, op_array,
+ op1_info, ce,
+ zend_may_throw(opline, op_array, ssa))) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_BIND_GLOBAL:
+ if (!ssa->ops || !ssa->var_info) {
+ op1_info = MAY_BE_ANY|MAY_BE_REF;
+ } else {
+ op1_info = OP1_INFO();
+ }
+ if (!zend_jit_bind_global(&dasm_state, opline, op_array, op1_info)) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_RECV:
+ if (!zend_jit_recv(&dasm_state, opline, op_array)) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_RECV_INIT:
+ if (!zend_jit_recv_init(&dasm_state, opline, op_array,
+ (opline + 1)->opcode != ZEND_RECV_INIT,
+ zend_may_throw(opline, op_array, ssa))) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_FREE:
+ case ZEND_FE_FREE:
+ if (!zend_jit_free(&dasm_state, opline, op_array, OP1_INFO(),
+ zend_may_throw(opline, op_array, ssa))) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_ECHO:
+ if (opline->op1_type != IS_CONST
+ || Z_TYPE_P(RT_CONSTANT(opline, opline->op1)) != IS_STRING) {
+ break;
+ }
+ if (!zend_jit_echo(&dasm_state, opline, op_array)) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_SWITCH_LONG:
+ case ZEND_SWITCH_STRING:
+ if (!zend_jit_switch(&dasm_state, opline, op_array, ssa)) {
+ goto jit_failure;
+ }
+ goto done;
+ case ZEND_VERIFY_RETURN_TYPE:
+ if (opline->op1_type == IS_UNUSED) {
+ /* Always throws */
+ break;
+ }
+ if (opline->op1_type == IS_CONST) {
+ /* TODO Different instruction format, has return value */
+ break;
+ }
+ if (op_array->fn_flags & ZEND_ACC_RETURN_REFERENCE) {
+ /* Not worth bothering with */
+ break;
+ }
+ if (OP1_INFO() & MAY_BE_REF) {
+ /* TODO May need reference unwrapping. */
+ break;
+ }
+ if (!zend_jit_verify_return_type(&dasm_state, opline, op_array, OP1_INFO())) {
+ goto jit_failure;
+ }
+ goto done;
+ default:
+ break;
+ }
+ }
+
+ switch (opline->opcode) {
+ case ZEND_RECV_INIT:
+ case ZEND_BIND_GLOBAL:
+ if (opline == op_array->opcodes ||
+ opline->opcode != op_array->opcodes[i-1].opcode) {
+ /* repeatable opcodes */
+ if (!zend_jit_handler(&dasm_state, opline, zend_may_throw(opline, op_array, ssa))) {
+ goto jit_failure;
+ }
+ }
+ zend_jit_set_opline(&dasm_state, opline+1);
+ break;
+ case ZEND_NOP:
+ case ZEND_OP_DATA:
+ case ZEND_SWITCH_LONG:
+ case ZEND_SWITCH_STRING:
+ break;
+ case ZEND_JMP:
+ if (zend_jit_level < ZEND_JIT_LEVEL_INLINE) {
+ const zend_op *target = OP_JMP_ADDR(opline, opline->op1);
+
+ if (!zend_jit_set_ip(&dasm_state, target)) {
+ goto jit_failure;
+ }
+ }
+ if (!zend_jit_jmp(&dasm_state, ssa->cfg.blocks[b].successors[0])) {
+ goto jit_failure;
+ }
+ is_terminated = 1;
+ break;
+ case ZEND_CATCH:
+ case ZEND_FAST_CALL:
+ case ZEND_FAST_RET:
+ case ZEND_GENERATOR_CREATE:
+ case ZEND_GENERATOR_RETURN:
+ case ZEND_RETURN_BY_REF:
+ case ZEND_RETURN:
+ case ZEND_EXIT:
+ /* switch through trampoline */
+ case ZEND_YIELD:
+ case ZEND_YIELD_FROM:
+ if (!zend_jit_tail_handler(&dasm_state, opline)) {
+ goto jit_failure;
+ }
+ is_terminated = 1;
+ break;
+ /* stackless execution */
+ case ZEND_INCLUDE_OR_EVAL:
+ case ZEND_DO_FCALL:
+ case ZEND_DO_UCALL:
+ case ZEND_DO_FCALL_BY_NAME:
+ if (!zend_jit_call(&dasm_state, opline, b + 1)) {
+ goto jit_failure;
+ }
+ is_terminated = 1;
+ break;
+ case ZEND_JMPZNZ:
+ if (!zend_jit_handler(&dasm_state, opline, zend_may_throw(opline, op_array, ssa)) ||
+ !zend_jit_cond_jmp(&dasm_state, OP_JMP_ADDR(opline, opline->op2), ssa->cfg.blocks[b].successors[1]) ||
+ !zend_jit_jmp(&dasm_state, ssa->cfg.blocks[b].successors[0])) {
+ goto jit_failure;
+ }
+ is_terminated = 1;
+ break;
+ case ZEND_JMPZ:
+ case ZEND_JMPNZ:
+ if (opline > op_array->opcodes &&
+ ((opline-1)->result_type & (IS_SMART_BRANCH_JMPZ|IS_SMART_BRANCH_JMPNZ)) != 0) {
+ /* smart branch */
+ if (!zend_jit_cond_jmp(&dasm_state, opline + 1, ssa->cfg.blocks[b].successors[0])) {
+ goto jit_failure;
+ }
+ goto done;
+ }
+ /* break missing intentionally */
+ case ZEND_JMPZ_EX:
+ case ZEND_JMPNZ_EX:
+ case ZEND_JMP_SET:
+ case ZEND_COALESCE:
+ case ZEND_FE_RESET_R:
+ case ZEND_FE_RESET_RW:
+ case ZEND_ASSERT_CHECK:
+ case ZEND_FE_FETCH_R:
+ case ZEND_FE_FETCH_RW:
+ if (!zend_jit_handler(&dasm_state, opline, zend_may_throw(opline, op_array, ssa)) ||
+ !zend_jit_cond_jmp(&dasm_state, opline + 1, ssa->cfg.blocks[b].successors[0])) {
+ goto jit_failure;
+ }
+ break;
+ case ZEND_NEW:
+ if (!zend_jit_handler(&dasm_state, opline, 1)) {
+ return 0;
+ }
+ if (opline->extended_value == 0 && (opline+1)->opcode == ZEND_DO_FCALL) {
+ zend_class_entry *ce = NULL;
+
+ if (zend_jit_level >= ZEND_JIT_LEVEL_OPT_FUNC) {
+ if (ssa->ops && ssa->var_info) {
+ zend_ssa_var_info *res_ssa = &ssa->var_info[ssa->ops[opline - op_array->opcodes].result_def];
+ if (res_ssa->ce && !res_ssa->is_instanceof) {
+ ce = res_ssa->ce;
+ }
+ }
+ } else {
+ if (opline->op1_type == IS_CONST) {
+ zval *zv = RT_CONSTANT(opline, opline->op1);
+ if (Z_TYPE_P(zv) == IS_STRING) {
+ zval *lc = zv + 1;
+ ce = (zend_class_entry*)zend_hash_find_ptr(EG(class_table), Z_STR_P(lc));
+ }
+ }
+ }
+
+ i++;
+
+ if (!ce || !(ce->ce_flags & ZEND_ACC_LINKED) || ce->constructor) {
+ const zend_op *next_opline = opline + 1;
+
+ zend_jit_cond_jmp(&dasm_state, next_opline, ssa->cfg.blocks[b].successors[0]);
+ if (zend_jit_level < ZEND_JIT_LEVEL_INLINE) {
+ zend_jit_call(&dasm_state, next_opline, b + 1);
+ is_terminated = 1;
+ } else {
+ zend_jit_do_fcall(&dasm_state, next_opline, op_array, ssa, call_level, b + 1);
+ }
+ }
+ }
+ break;
+ default:
+ if (!zend_jit_handler(&dasm_state, opline, zend_may_throw(opline, op_array, ssa))) {
+ goto jit_failure;
+ }
+ }
+done:
+ switch (opline->opcode) {
+ case ZEND_DO_FCALL:
+ case ZEND_DO_ICALL:
+ case ZEND_DO_UCALL:
+ case ZEND_DO_FCALL_BY_NAME:
+ call_level--;
+ }
+ }
+ }
+
+ handler = dasm_link_and_encode(&dasm_state, op_array, ssa, rt_opline, ra, NULL);
+ if (!handler) {
+ goto jit_failure;
+ }
+ dasm_free(&dasm_state);
+
+ if (zend_jit_reg_alloc) {
+ zend_arena_release(&CG(arena), checkpoint);
+ }
+ return SUCCESS;
+
+jit_failure:
+ if (dasm_state) {
+ dasm_free(&dasm_state);
+ }
+ if (zend_jit_reg_alloc) {
+ zend_arena_release(&CG(arena), checkpoint);
+ }
+ return FAILURE;
+}
+
+static int zend_jit_collect_calls(zend_op_array *op_array, zend_script *script)
+{
+ zend_func_info *func_info =
+ zend_arena_calloc(&CG(arena), 1, sizeof(zend_func_info));
+
+ ZEND_SET_FUNC_INFO(op_array, func_info);
+ func_info->num_args = -1;
+ func_info->return_value_used = -1;
+ return zend_analyze_calls(&CG(arena), script, ZEND_CALL_TREE, op_array, func_info);
+}
+
+static int zend_real_jit_func(zend_op_array *op_array, zend_script *script, const zend_op *rt_opline)
+{
+ zend_ssa ssa;
+ void *checkpoint;
+ zend_func_info *func_info;
+
+ if (*dasm_ptr == dasm_end) {
+ return FAILURE;
+ }
+
+ checkpoint = zend_arena_checkpoint(CG(arena));
+
+ /* Build SSA */
+ memset(&ssa, 0, sizeof(zend_ssa));
+
+ if (zend_jit_op_array_analyze1(op_array, script, &ssa) != SUCCESS) {
+ goto jit_failure;
+ }
+
+ if (zend_jit_level >= ZEND_JIT_LEVEL_OPT_FUNCS) {
+ if (zend_jit_collect_calls(op_array, script) != SUCCESS) {
+ ZEND_SET_FUNC_INFO(op_array, NULL);
+ goto jit_failure;
+ }
+ func_info = ZEND_FUNC_INFO(op_array);
+ func_info->call_map = zend_build_call_map(&CG(arena), func_info, op_array);
+ if (op_array->fn_flags & ZEND_ACC_HAS_RETURN_TYPE) {
+ zend_init_func_return_info(op_array, script, &func_info->return_info);
+ }
+ }
+
+ if (zend_jit_op_array_analyze2(op_array, script, &ssa) != SUCCESS) {
+ goto jit_failure;
+ }
+
+ if (ZCG(accel_directives).jit_debug & ZEND_JIT_DEBUG_SSA) {
+ zend_dump_op_array(op_array, ZEND_DUMP_HIDE_UNREACHABLE|ZEND_DUMP_RC_INFERENCE|ZEND_DUMP_SSA, "JIT", &ssa);
+ }
+
+ if (zend_jit(op_array, &ssa, rt_opline) != SUCCESS) {
+ goto jit_failure;
+ }
+
+ if (zend_jit_level >= ZEND_JIT_LEVEL_OPT_FUNCS) {
+ ZEND_SET_FUNC_INFO(op_array, NULL);
+ }
+
+ zend_arena_release(&CG(arena), checkpoint);
+ return SUCCESS;
+
+jit_failure:
+ zend_arena_release(&CG(arena), checkpoint);
+ return FAILURE;
+}
+
+/* Run-time JIT handler */
+static void ZEND_FASTCALL zend_runtime_jit(void)
+{
+ zend_execute_data *execute_data = EG(current_execute_data);
+ zend_op_array *op_array = &EX(func)->op_array;
+ zend_op *opline = op_array->opcodes;
+
+ zend_shared_alloc_lock();
+
+ if (ZEND_FUNC_INFO(op_array)) {
+ SHM_UNPROTECT();
+ zend_jit_unprotect();
+
+ /* restore original opcode handlers */
+ if (!(op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS)) {
+ while (opline->opcode == ZEND_RECV || opline->opcode == ZEND_RECV_INIT) {
+ opline++;
+ }
+ }
+ opline->handler = ZEND_FUNC_INFO(op_array);
+ ZEND_SET_FUNC_INFO(op_array, NULL);
+
+ /* perform real JIT for this function */
+ zend_real_jit_func(op_array, NULL, NULL);
+
+ zend_jit_protect();
+ SHM_PROTECT();
+ }
+
+ zend_shared_alloc_unlock();
+
+ /* JIT-ed code is going to be called by VM */
+}
+
+void zend_jit_check_funcs(HashTable *function_table, zend_bool is_method) {
+ zend_op *opline;
+ zend_function *func;
+ zend_op_array *op_array;
+ uintptr_t counter;
+
+ ZEND_HASH_REVERSE_FOREACH_PTR(function_table, func) {
+ if (func->type == ZEND_INTERNAL_FUNCTION) {
+ break;
+ }
+ op_array = &func->op_array;
+ opline = op_array->opcodes;
+ if (!(op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS)) {
+ while (opline->opcode == ZEND_RECV || opline->opcode == ZEND_RECV_INIT) {
+ opline++;
+ }
+ }
+ if (opline->handler == zend_jit_profile_jit_handler) {
+ if (!RUN_TIME_CACHE(op_array)) {
+ continue;
+ }
+ counter = (uintptr_t)ZEND_COUNTER_INFO(op_array);
+ ZEND_COUNTER_INFO(op_array) = 0;
+ opline->handler = ZEND_FUNC_INFO(op_array);
+ ZEND_SET_FUNC_INFO(op_array, NULL);
+ if (((double)counter / (double)zend_jit_profile_counter) > ZEND_JIT_PROF_THRESHOLD) {
+ zend_real_jit_func(op_array, NULL, NULL);
+ }
+ }
+ } ZEND_HASH_FOREACH_END();
+}
+
+void ZEND_FASTCALL zend_jit_hot_func(zend_execute_data *execute_data, const zend_op *opline)
+{
+ zend_op_array *op_array = &EX(func)->op_array;
+ zend_jit_op_array_extension *jit_extension;
+ uint32_t i;
+
+ zend_shared_alloc_lock();
+ jit_extension = (zend_jit_op_array_extension*)ZEND_FUNC_INFO(op_array);
+
+ if (jit_extension) {
+ SHM_UNPROTECT();
+ zend_jit_unprotect();
+
+ *(jit_extension->counter) = ZEND_JIT_HOT_COUNTER_INIT;
+ for (i = 0; i < op_array->last; i++) {
+ op_array->opcodes[i].handler = jit_extension->orig_handlers[i];
+ }
+ ZEND_SET_FUNC_INFO(op_array, NULL);
+
+ /* perform real JIT for this function */
+ zend_real_jit_func(op_array, NULL, opline);
+
+ zend_jit_protect();
+ SHM_PROTECT();
+ }
+
+ zend_shared_alloc_unlock();
+
+ /* JIT-ed code is going to be called by VM */
+}
+
+static int zend_jit_setup_hot_counters(zend_op_array *op_array)
+{
+ zend_op *opline = op_array->opcodes;
+ zend_jit_op_array_extension *jit_extension;
+ zend_cfg cfg;
+ uint32_t i;
+
+ ZEND_ASSERT(zend_jit_func_counter_handler != NULL);
+ ZEND_ASSERT(zend_jit_loop_counter_handler != NULL);
+
+ if (zend_jit_build_cfg(op_array, &cfg) != SUCCESS) {
+ return FAILURE;
+ }
+
+ jit_extension = (zend_jit_op_array_extension*)zend_shared_alloc(sizeof(zend_jit_op_array_extension) + (op_array->last - 1) * sizeof(void*));
+ jit_extension->counter = &zend_jit_hot_counters[zend_jit_op_array_hash(op_array) & (ZEND_HOT_COUNTERS_COUNT - 1)];
+ for (i = 0; i < op_array->last; i++) {
+ jit_extension->orig_handlers[i] = op_array->opcodes[i].handler;
+ }
+ ZEND_SET_FUNC_INFO(op_array, (void*)jit_extension);
+
+ if (!(op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS)) {
+ while (opline->opcode == ZEND_RECV || opline->opcode == ZEND_RECV_INIT) {
+ opline++;
+ }
+ }
+
+ opline->handler = (const void*)zend_jit_func_counter_handler;
+
+ for (i = 0; i < cfg.blocks_count; i++) {
+ if ((cfg.blocks[i].flags & ZEND_BB_REACHABLE) &&
+ (cfg.blocks[i].flags & ZEND_BB_LOOP_HEADER)) {
+ op_array->opcodes[cfg.blocks[i].start].handler =
+ (const void*)zend_jit_loop_counter_handler;
+ }
+ }
+
+ return SUCCESS;
+}
+
+static int zend_needs_manual_jit(const zend_op_array *op_array)
+{
+ if (op_array->doc_comment) {
+ const char *s = ZSTR_VAL(op_array->doc_comment);
+ const char *p = strstr(s, "@jit");
+
+ if (p) {
+ size_t l = ZSTR_LEN(op_array->doc_comment);
+
+ if ((p == s + 3 || *(p-1) <= ' ') &&
+ (p + 6 == s + l || *(p+4) <= ' ')) {
+ return 1;
+ }
+ }
+ }
+ return 0;
+}
+
+ZEND_EXT_API int zend_jit_op_array(zend_op_array *op_array, zend_script *script)
+{
+ if (dasm_ptr == NULL) {
+ return FAILURE;
+ }
+
+ if (zend_jit_trigger == ZEND_JIT_ON_FIRST_EXEC) {
+ zend_op *opline = op_array->opcodes;
+
+ /* Set run-time JIT handler */
+ ZEND_ASSERT(zend_jit_runtime_jit_handler != NULL);
+ if (!(op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS)) {
+ while (opline->opcode == ZEND_RECV || opline->opcode == ZEND_RECV_INIT) {
+ opline++;
+ }
+ }
+ ZEND_SET_FUNC_INFO(op_array, (void*)opline->handler);
+ opline->handler = (const void*)zend_jit_runtime_jit_handler;
+
+ return SUCCESS;
+ } else if (zend_jit_trigger == ZEND_JIT_ON_PROF_REQUEST) {
+ zend_op *opline = op_array->opcodes;
+
+ ZEND_ASSERT(zend_jit_profile_jit_handler != NULL);
+ if (op_array->function_name) {
+ if (!(op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS)) {
+ while (opline->opcode == ZEND_RECV || opline->opcode == ZEND_RECV_INIT) {
+ opline++;
+ }
+ }
+ ZEND_SET_FUNC_INFO(op_array, (void*)opline->handler);
+ opline->handler = (const void*)zend_jit_profile_jit_handler;
+ }
+
+ return SUCCESS;
+ } else if (zend_jit_trigger == ZEND_JIT_ON_HOT_COUNTERS) {
+ return zend_jit_setup_hot_counters(op_array);
+ } else if (zend_jit_trigger == ZEND_JIT_ON_SCRIPT_LOAD) {
+ return zend_real_jit_func(op_array, script, NULL);
+ } else if (zend_jit_trigger == ZEND_JIT_ON_DOC_COMMENT) {
+ if (zend_needs_manual_jit(op_array)) {
+ return zend_real_jit_func(op_array, script, NULL);
+ } else {
+ return SUCCESS;
+ }
+ } else {
+ ZEND_ASSERT(0);
+ }
+}
+
+ZEND_EXT_API int zend_jit_script(zend_script *script)
+{
+ void *checkpoint;
+ zend_call_graph call_graph;
+ zend_func_info *info;
+ int i;
+
+ if (dasm_ptr == NULL || *dasm_ptr == dasm_end) {
+ return FAILURE;
+ }
+
+ checkpoint = zend_arena_checkpoint(CG(arena));
+
+ call_graph.op_arrays_count = 0;
+ if (zend_build_call_graph(&CG(arena), script, &call_graph) != SUCCESS) {
+ goto jit_failure;
+ }
+
+ zend_analyze_call_graph(&CG(arena), script, &call_graph);
+
+ if (zend_jit_trigger == ZEND_JIT_ON_FIRST_EXEC ||
+ zend_jit_trigger == ZEND_JIT_ON_PROF_REQUEST ||
+ zend_jit_trigger == ZEND_JIT_ON_HOT_COUNTERS) {
+ for (i = 0; i < call_graph.op_arrays_count; i++) {
+ ZEND_SET_FUNC_INFO(call_graph.op_arrays[i], NULL);
+ if (zend_jit_op_array(call_graph.op_arrays[i], script) != SUCCESS) {
+ goto jit_failure;
+ }
+ }
+ } else if (zend_jit_trigger == ZEND_JIT_ON_SCRIPT_LOAD ||
+ zend_jit_trigger == ZEND_JIT_ON_DOC_COMMENT) {
+
+ if (zend_jit_trigger == ZEND_JIT_ON_DOC_COMMENT) {
+ int do_jit = 0;
+ for (i = 0; i < call_graph.op_arrays_count; i++) {
+ if (zend_needs_manual_jit(call_graph.op_arrays[i])) {
+ do_jit = 1;
+ break;
+ }
+ }
+ if (!do_jit) {
+ goto jit_failure;
+ }
+ }
+ for (i = 0; i < call_graph.op_arrays_count; i++) {
+ info = ZEND_FUNC_INFO(call_graph.op_arrays[i]);
+ if (info) {
+ if (zend_jit_op_array_analyze1(call_graph.op_arrays[i], script, &info->ssa) != SUCCESS) {
+ goto jit_failure;
+ }
+ info->flags = info->ssa.cfg.flags;
+ }
+ }
+
+ for (i = 0; i < call_graph.op_arrays_count; i++) {
+ info = ZEND_FUNC_INFO(call_graph.op_arrays[i]);
+ if (info) {
+ info->call_map = zend_build_call_map(&CG(arena), info, call_graph.op_arrays[i]);
+ if (call_graph.op_arrays[i]->fn_flags & ZEND_ACC_HAS_RETURN_TYPE) {
+ zend_init_func_return_info(call_graph.op_arrays[i], script, &info->return_info);
+ }
+ }
+ }
+
+ for (i = 0; i < call_graph.op_arrays_count; i++) {
+ if (zend_jit_trigger == ZEND_JIT_ON_DOC_COMMENT &&
+ !zend_needs_manual_jit(call_graph.op_arrays[i])) {
+ continue;
+ }
+ info = ZEND_FUNC_INFO(call_graph.op_arrays[i]);
+ if (info) {
+ if (zend_jit_op_array_analyze2(call_graph.op_arrays[i], script, &info->ssa) != SUCCESS) {
+ goto jit_failure;
+ }
+ info->flags = info->ssa.cfg.flags;
+ }
+ }
+
+ if (ZCG(accel_directives).jit_debug & ZEND_JIT_DEBUG_SSA) {
+ for (i = 0; i < call_graph.op_arrays_count; i++) {
+ if (zend_jit_trigger == ZEND_JIT_ON_DOC_COMMENT &&
+ !zend_needs_manual_jit(call_graph.op_arrays[i])) {
+ continue;
+ }
+ info = ZEND_FUNC_INFO(call_graph.op_arrays[i]);
+ if (info) {
+ zend_dump_op_array(call_graph.op_arrays[i], ZEND_DUMP_HIDE_UNREACHABLE|ZEND_DUMP_RC_INFERENCE|ZEND_DUMP_SSA, "JIT", &info->ssa);
+ }
+ }
+ }
+
+ for (i = 0; i < call_graph.op_arrays_count; i++) {
+ if (zend_jit_trigger == ZEND_JIT_ON_DOC_COMMENT &&
+ !zend_needs_manual_jit(call_graph.op_arrays[i])) {
+ continue;
+ }
+ info = ZEND_FUNC_INFO(call_graph.op_arrays[i]);
+ if (info) {
+ if (zend_jit(call_graph.op_arrays[i], &info->ssa, NULL) != SUCCESS) {
+ goto jit_failure;
+ }
+ }
+ }
+
+ for (i = 0; i < call_graph.op_arrays_count; i++) {
+ ZEND_SET_FUNC_INFO(call_graph.op_arrays[i], NULL);
+ }
+ } else {
+ ZEND_ASSERT(0);
+ }
+
+ zend_arena_release(&CG(arena), checkpoint);
+ return SUCCESS;
+
+jit_failure:
+ for (i = 0; i < call_graph.op_arrays_count; i++) {
+ ZEND_SET_FUNC_INFO(call_graph.op_arrays[i], NULL);
+ }
+ zend_arena_release(&CG(arena), checkpoint);
+ return FAILURE;
+}
+
+ZEND_EXT_API void zend_jit_unprotect(void)
+{
+#ifdef HAVE_MPROTECT
+ if (!(ZCG(accel_directives).jit_debug & (ZEND_JIT_DEBUG_GDB|ZEND_JIT_DEBUG_PERF_DUMP))) {
+ if (mprotect(dasm_buf, dasm_size, PROT_READ | PROT_WRITE) != 0) {
+ fprintf(stderr, "mprotect() failed [%d] %s\n", errno, strerror(errno));
+ }
+ }
+#elif _WIN32
+ if (!(ZCG(accel_directives).jit_debug & (ZEND_JIT_DEBUG_GDB|ZEND_JIT_DEBUG_PERF_DUMP))) {
+ DWORD old;
+
+ if (!VirtualProtect(dasm_buf, dasm_size, PAGE_READWRITE, &old)) {
+ fprintf(stderr, "VirtualProtect() failed\n");
+ }
+ }
+#endif
+}
+
+ZEND_EXT_API void zend_jit_protect(void)
+{
+#ifdef HAVE_MPROTECT
+ if (!(ZCG(accel_directives).jit_debug & (ZEND_JIT_DEBUG_GDB|ZEND_JIT_DEBUG_PERF_DUMP))) {
+ if (mprotect(dasm_buf, dasm_size, PROT_READ | PROT_EXEC) != 0) {
+ fprintf(stderr, "mprotect() failed [%d] %s\n", errno, strerror(errno));
+ }
+ }
+#elif _WIN32
+ if (!(ZCG(accel_directives).jit_debug & (ZEND_JIT_DEBUG_GDB|ZEND_JIT_DEBUG_PERF_DUMP))) {
+ DWORD old;
+
+ if (!VirtualProtect(dasm_buf, dasm_size, PAGE_EXECUTE_READ, &old)) {
+ fprintf(stderr, "VirtualProtect() failed\n");
+ }
+ }
+#endif
+}
+
+static int zend_jit_make_stubs(void)
+{
+ dasm_State* dasm_state = NULL;
+ uint32_t i;
+
+ dasm_init(&dasm_state, DASM_MAXSECTION);
+ dasm_setupglobal(&dasm_state, dasm_labels, zend_lb_MAX);
+
+ for (i = 0; i < sizeof(zend_jit_stubs)/sizeof(zend_jit_stubs[0]); i++) {
+ dasm_setup(&dasm_state, dasm_actions);
+ if (!zend_jit_stubs[i].stub(&dasm_state)) {
+ return 0;
+ }
+ if (!dasm_link_and_encode(&dasm_state, NULL, NULL, NULL, NULL, zend_jit_stubs[i].name)) {
+ return 0;
+ }
+ }
+
+ if (zend_jit_vm_kind == ZEND_VM_KIND_HYBRID) {
+ if (zend_jit_trigger == ZEND_JIT_ON_FIRST_EXEC) {
+ dasm_setup(&dasm_state, dasm_actions);
+ if (!zend_jit_hybrid_runtime_jit_stub(&dasm_state)) {
+ return 0;
+ }
+ zend_jit_runtime_jit_handler = dasm_link_and_encode(&dasm_state, NULL, NULL, NULL, NULL, "JIT$$hybrid_runtime_jit");
+ if (!zend_jit_runtime_jit_handler) {
+ return 0;
+ }
+ } else if (zend_jit_trigger == ZEND_JIT_ON_PROF_REQUEST) {
+ dasm_setup(&dasm_state, dasm_actions);
+ if (!zend_jit_hybrid_profile_jit_stub(&dasm_state)) {
+ return 0;
+ }
+ zend_jit_profile_jit_handler = dasm_link_and_encode(&dasm_state, NULL, NULL, NULL, NULL, "JIT$$hybrid_profile_jit");
+ if (!zend_jit_profile_jit_handler) {
+ return 0;
+ }
+ } else if (zend_jit_trigger == ZEND_JIT_ON_HOT_COUNTERS) {
+ dasm_setup(&dasm_state, dasm_actions);
+ if (!zend_jit_hybrid_func_counter_stub(&dasm_state)) {
+ return 0;
+ }
+ zend_jit_func_counter_handler = dasm_link_and_encode(&dasm_state, NULL, NULL, NULL, NULL, "JIT$$hybrid_func_counter");
+ if (!zend_jit_func_counter_handler) {
+ return 0;
+ }
+
+ dasm_setup(&dasm_state, dasm_actions);
+ if (!zend_jit_hybrid_loop_counter_stub(&dasm_state)) {
+ return 0;
+ }
+ zend_jit_loop_counter_handler = dasm_link_and_encode(&dasm_state, NULL, NULL, NULL, NULL, "JIT$$hybrid_loop_counter");
+ if (!zend_jit_loop_counter_handler) {
+ return 0;
+ }
+ }
+ } else {
+ zend_jit_runtime_jit_handler = (const void*)zend_runtime_jit;
+ zend_jit_profile_jit_handler = (const void*)zend_jit_profile_helper;
+ zend_jit_func_counter_handler = (const void*)zend_jit_func_counter_helper;
+ zend_jit_loop_counter_handler = (const void*)zend_jit_loop_counter_helper;
+ }
+
+ dasm_free(&dasm_state);
+ return 1;
+}
+
+ZEND_EXT_API int zend_jit_startup(zend_long jit, void *buf, size_t size, zend_bool reattached)
+{
+ int ret;
+
+ zend_jit_level = ZEND_JIT_LEVEL(jit);
+ zend_jit_trigger = ZEND_JIT_TRIGGER(jit);
+ zend_jit_reg_alloc = ZEND_JIT_REG_ALLOC(jit);
+ zend_jit_cpu_flags = ZEND_JIT_CPU_FLAGS(jit);
+
+ zend_jit_vm_kind = zend_vm_kind();
+ if (zend_jit_vm_kind != ZEND_VM_KIND_CALL &&
+ zend_jit_vm_kind != ZEND_VM_KIND_HYBRID) {
+ // TODO: error reporting and cleanup ???
+ return FAILURE;
+ }
+
+ zend_jit_halt_op = zend_get_halt_op();
+
+ if (zend_jit_setup() != SUCCESS) {
+ // TODO: error reporting and cleanup ???
+ return FAILURE;
+ }
+
+ if (zend_jit_trigger == ZEND_JIT_ON_PROF_REQUEST) {
+ zend_jit_profile_counter_rid = zend_get_op_array_extension_handle();
+ }
+
+#ifdef HAVE_GDB
+ zend_jit_gdb_init();
+#endif
+
+#ifdef HAVE_OPROFILE
+ if (ZCG(accel_directives).jit_debug & ZEND_JIT_DEBUG_OPROFILE) {
+ if (!zend_jit_oprofile_startup()) {
+ // TODO: error reporting and cleanup ???
+ return FAILURE;
+ }
+ }
+#endif
+
+ dasm_buf = buf;
+ dasm_size = size;
+
+#ifdef HAVE_MPROTECT
+ if (ZCG(accel_directives).jit_debug & (ZEND_JIT_DEBUG_GDB|ZEND_JIT_DEBUG_PERF_DUMP)) {
+ if (mprotect(dasm_buf, dasm_size, PROT_READ | PROT_WRITE | PROT_EXEC) != 0) {
+ fprintf(stderr, "mprotect() failed [%d] %s\n", errno, strerror(errno));
+ }
+ } else {
+ if (mprotect(dasm_buf, dasm_size, PROT_READ | PROT_EXEC) != 0) {
+ fprintf(stderr, "mprotect() failed [%d] %s\n", errno, strerror(errno));
+ }
+ }
+#elif _WIN32
+ if (ZCG(accel_directives).jit_debug & (ZEND_JIT_DEBUG_GDB|ZEND_JIT_DEBUG_PERF_DUMP)) {
+ DWORD old;
+
+ if (!VirtualProtect(dasm_buf, dasm_size, PAGE_EXECUTE_READWRITE, &old)) {
+ fprintf(stderr, "VirtualProtect() failed\n");
+ }
+ } else {
+ DWORD old;
+
+ if (!VirtualProtect(dasm_buf, dasm_size, PAGE_EXECUTE_READ, &old)) {
+ fprintf(stderr, "VirtualProtect() failed\n");
+ }
+ }
+#endif
+
+ dasm_ptr = dasm_end = (void*)(((char*)dasm_buf) + size - sizeof(*dasm_ptr));
+ if (!reattached) {
+ zend_jit_unprotect();
+ *dasm_ptr = dasm_buf;
+#if _WIN32
+ /* reserve space for global labels */
+ *dasm_ptr = (void**)*dasm_ptr + zend_lb_MAX;
+#endif
+ zend_jit_protect();
+ }
+
+#ifdef HAVE_DISASM
+ if (ZCG(accel_directives).jit_debug & (ZEND_JIT_DEBUG_ASM|ZEND_JIT_DEBUG_ASM_STUBS)) {
+ if (!zend_jit_disasm_init()) {
+ // TODO: error reporting and cleanup ???
+ return FAILURE;
+ }
+ }
+#endif
+
+#ifdef HAVE_PERFTOOLS
+ if (ZCG(accel_directives).jit_debug & ZEND_JIT_DEBUG_PERF_DUMP) {
+ zend_jit_perf_jitdump_open();
+ }
+#endif
+
+ if (!reattached) {
+ zend_jit_unprotect();
+ ret = zend_jit_make_stubs();
+#if _WIN32
+ /* save global labels */
+ memcpy(dasm_buf, dasm_labels, sizeof(void*) * zend_lb_MAX);
+#endif
+ zend_jit_protect();
+ if (!ret) {
+ // TODO: error reporting and cleanup ???
+ return FAILURE;
+ }
+ } else {
+#if _WIN32
+ /* restore global labels */
+ memcpy(dasm_labels, dasm_buf, sizeof(void*) * zend_lb_MAX);
+#endif
+ }
+
+ return SUCCESS;
+}
+
+ZEND_EXT_API void zend_jit_shutdown(void)
+{
+#ifdef HAVE_OPROFILE
+ if (ZCG(accel_directives).jit_debug & ZEND_JIT_DEBUG_OPROFILE) {
+ zend_jit_oprofile_shutdown();
+ }
+#endif
+
+#ifdef HAVE_GDB
+ if (ZCG(accel_directives).jit_debug & ZEND_JIT_DEBUG_GDB) {
+ zend_jit_gdb_unregister();
+ }
+#endif
+
+#ifdef HAVE_DISASM
+ if (ZCG(accel_directives).jit_debug & (ZEND_JIT_DEBUG_ASM|ZEND_JIT_DEBUG_ASM_STUBS)) {
+ zend_jit_disasm_shutdown();
+ }
+#endif
+
+#ifdef HAVE_PERFTOOLS
+ if (ZCG(accel_directives).jit_debug & ZEND_JIT_DEBUG_PERF_DUMP) {
+ zend_jit_perf_jitdump_close();
+ }
+#endif
+}
+
+ZEND_EXT_API void zend_jit_activate(void)
+{
+ if (zend_jit_trigger == ZEND_JIT_ON_HOT_COUNTERS) {
+ int i;
+
+ for (i = 0; i < ZEND_HOT_COUNTERS_COUNT; i++) {
+ zend_jit_hot_counters[i] = ZEND_JIT_HOT_COUNTER_INIT;
+ }
+ }
+}
+
+ZEND_EXT_API void zend_jit_deactivate(void)
+{
+ if (zend_jit_trigger == ZEND_JIT_ON_PROF_REQUEST) {
+ if (!zend_jit_profile_counter) {
+ return;
+ } else {
+ zend_class_entry *ce;
+
+ zend_shared_alloc_lock();
+ SHM_UNPROTECT();
+ zend_jit_unprotect();
+
+ zend_jit_check_funcs(EG(function_table), 0);
+ ZEND_HASH_REVERSE_FOREACH_PTR(EG(class_table), ce) {
+ if (ce->type == ZEND_INTERNAL_CLASS) {
+ break;
+ }
+ zend_jit_check_funcs(&ce->function_table, 1);
+ } ZEND_HASH_FOREACH_END();
+
+ zend_jit_protect();
+ SHM_PROTECT();
+ zend_shared_alloc_unlock();
+
+ zend_jit_profile_counter = 0;
+ }
+ }
+}
+
+#else /* HAVE_JIT */
+
+ZEND_EXT_API int zend_jit_op_array(const zend_op_array *op_array, zend_script *script)
+{
+ return FAILURE;
+}
+
+ZEND_EXT_API int zend_jit_script(zend_script *script)
+{
+ return FAILURE;
+}
+
+ZEND_EXT_API void zend_jit_unprotect(void)
+{
+}
+
+ZEND_EXT_API void zend_jit_protect(void)
+{
+}
+
+ZEND_EXT_API int zend_jit_startup(zend_long jit, size_t size)
+{
+ return FAILURE;
+}
+
+ZEND_EXT_API void zend_jit_shutdown(void)
+{
+}
+
+ZEND_EXT_API void zend_jit_activate(void)
+{
+}
+
+ZEND_EXT_API void zend_jit_deactivate(void)
+{
+}
+
+#endif /* HAVE_JIT */
diff --git a/ext/opcache/jit/zend_jit.h b/ext/opcache/jit/zend_jit.h
new file mode 100644
index 0000000000..5234660398
--- /dev/null
+++ b/ext/opcache/jit/zend_jit.h
@@ -0,0 +1,109 @@
+/*
+ +----------------------------------------------------------------------+
+ | Zend JIT |
+ +----------------------------------------------------------------------+
+ | Copyright (c) The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Dmitry Stogov <dmitry@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+#ifndef HAVE_JIT_H
+#define HAVE_JIT_H
+
+#define ZEND_JIT_LEVEL_NONE 0 /* no JIT */
+#define ZEND_JIT_LEVEL_MINIMAL 1 /* minimal JIT (subroutine threading) */
+#define ZEND_JIT_LEVEL_INLINE 2 /* selective inline threading */
+#define ZEND_JIT_LEVEL_OPT_FUNC 3 /* optimized JIT based on Type-Inference */
+#define ZEND_JIT_LEVEL_OPT_FUNCS 4 /* optimized JIT based on Type-Inference and call-tree */
+#define ZEND_JIT_LEVEL_OPT_SCRIPT 5 /* optimized JIT based on Type-Inference and inner-procedure analysis */
+
+#define ZEND_JIT_LEVEL(n) ((n) % 10)
+
+#define ZEND_JIT_ON_SCRIPT_LOAD 0
+#define ZEND_JIT_ON_FIRST_EXEC 1
+#define ZEND_JIT_ON_PROF_REQUEST 2 /* compile the most frequently caled on first request functions */
+#define ZEND_JIT_ON_HOT_COUNTERS 3 /* compile functions after N calls or loop iterations */
+#define ZEND_JIT_ON_DOC_COMMENT 4 /* compile functions with "@jit" tag in doc-comments */
+
+#define ZEND_JIT_TRIGGER(n) (((n) / 10) % 10)
+
+#define ZEND_JIT_REG_ALLOC_NONE 0 /* no register allocation */
+#define ZEND_JIT_REG_ALLOC_ENABLED 1 /* local linear scan register allocation */
+#define ZEND_JIT_REG_ALLOC_GLOBAL 2 /* global linear scan register allocation */
+
+#define ZEND_JIT_REG_ALLOC(n) (((n) / 100) % 10)
+
+#define ZEND_JIT_CPU_AVX 1 /* use AVX instructions, if available */
+
+#define ZEND_JIT_CPU_FLAGS(n) (((n) / 1000) % 10)
+
+
+#define ZEND_JIT_DEFAULT "1205"
+
+
+/* Makes profile based JIT (opcache.jit=2*) to generate code only for most
+ * often called functions (above the threshold).
+ * TODO: this setting should be configurable
+ */
+#define ZEND_JIT_PROF_THRESHOLD 0.005
+
+/* Hot Counters based JIT parameters.
+ * TODO: this setting should be configurable
+ */
+#define ZEND_JIT_HOT_FUNC_COST 1
+#define ZEND_JIT_HOT_LOOP_COST 2
+#define ZEND_JIT_HOT_COUNTER_INIT 127
+
+#define ZEND_JIT_DEBUG_ASM (1<<0)
+#define ZEND_JIT_DEBUG_SSA (1<<1)
+#define ZEND_JIT_DEBUG_REG_ALLOC (1<<2)
+#define ZEND_JIT_DEBUG_ASM_STUBS (1<<3)
+
+#define ZEND_JIT_DEBUG_PERF (1<<4)
+#define ZEND_JIT_DEBUG_PERF_DUMP (1<<5)
+#define ZEND_JIT_DEBUG_OPROFILE (1<<6)
+#define ZEND_JIT_DEBUG_VTUNE (1<<7)
+
+#define ZEND_JIT_DEBUG_GDB (1<<8)
+
+ZEND_EXT_API int zend_jit_op_array(zend_op_array *op_array, zend_script *script);
+ZEND_EXT_API int zend_jit_script(zend_script *script);
+ZEND_EXT_API void zend_jit_unprotect(void);
+ZEND_EXT_API void zend_jit_protect(void);
+ZEND_EXT_API int zend_jit_startup(zend_long jit, void *jit_buffer, size_t size, zend_bool reattached);
+ZEND_EXT_API void zend_jit_shutdown(void);
+ZEND_EXT_API void zend_jit_activate(void);
+ZEND_EXT_API void zend_jit_deactivate(void);
+ZEND_EXT_API void zend_jit_status(zval *ret);
+
+typedef struct _zend_lifetime_interval zend_lifetime_interval;
+typedef struct _zend_life_range zend_life_range;
+
+struct _zend_life_range {
+ uint32_t start;
+ uint32_t end;
+ zend_life_range *next;
+};
+
+struct _zend_lifetime_interval {
+ int ssa_var;
+ int8_t reg;
+ zend_bool split;
+ zend_bool store;
+ zend_bool load;
+ zend_life_range range;
+ zend_lifetime_interval *hint;
+ zend_lifetime_interval *used_as_hint;
+ zend_lifetime_interval *list_next;
+};
+
+#endif /* HAVE_JIT_H */
diff --git a/ext/opcache/jit/zend_jit_disasm_x86.c b/ext/opcache/jit/zend_jit_disasm_x86.c
new file mode 100644
index 0000000000..4ee7f2277c
--- /dev/null
+++ b/ext/opcache/jit/zend_jit_disasm_x86.c
@@ -0,0 +1,519 @@
+/*
+ +----------------------------------------------------------------------+
+ | Zend JIT |
+ +----------------------------------------------------------------------+
+ | Copyright (c) The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Dmitry Stogov <dmitry@php.net> |
+ | Xinchen Hui <laruence@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+#define HAVE_DISASM 1
+#define DISASM_INTEL_SYNTAX 0
+
+#include "jit/libudis86/itab.c"
+#include "jit/libudis86/decode.c"
+#include "jit/libudis86/syn.c"
+#if DISASM_INTEL_SYNTAX
+# include "jit/libudis86/syn-intel.c"
+#else
+# include "jit/libudis86/syn-att.c"
+#endif
+#include "jit/libudis86/udis86.c"
+
+static void zend_jit_disasm_add_symbol(const char *name,
+ uint64_t addr,
+ uint64_t size);
+
+#ifndef _WIN32
+# include "jit/zend_elf.c"
+#endif
+
+#include "zend_sort.h"
+
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE
+#endif
+
+#ifndef _WIN32
+#include <dlfcn.h>
+#endif
+
+static struct ud ud;
+
+typedef struct _sym_node {
+ uint64_t addr;
+ uint64_t end;
+ struct _sym_node *parent;
+ struct _sym_node *child[2];
+ unsigned char info;
+ char name[1];
+} zend_sym_node;
+
+static zend_sym_node *symbols = NULL;
+
+static void zend_syms_rotateleft(zend_sym_node *p) {
+ zend_sym_node *r = p->child[1];
+ p->child[1] = r->child[0];
+ if (r->child[0]) {
+ r->child[0]->parent = p;
+ }
+ r->parent = p->parent;
+ if (p->parent == NULL) {
+ symbols = r;
+ } else if (p->parent->child[0] == p) {
+ p->parent->child[0] = r;
+ } else {
+ p->parent->child[1] = r;
+ }
+ r->child[0] = p;
+ p->parent = r;
+}
+
+static void zend_syms_rotateright(zend_sym_node *p) {
+ zend_sym_node *l = p->child[0];
+ p->child[0] = l->child[1];
+ if (l->child[1]) {
+ l->child[1]->parent = p;
+ }
+ l->parent = p->parent;
+ if (p->parent == NULL) {
+ symbols = l;
+ } else if (p->parent->child[1] == p) {
+ p->parent->child[1] = l;
+ } else {
+ p->parent->child[0] = l;
+ }
+ l->child[1] = p;
+ p->parent = l;
+}
+
+static void zend_jit_disasm_add_symbol(const char *name,
+ uint64_t addr,
+ uint64_t size)
+{
+ zend_sym_node *sym;
+ size_t len = strlen(name);
+
+ sym = malloc(sizeof(zend_sym_node) + len + 1);
+ if (!sym) {
+ return;
+ }
+ sym->addr = addr;
+ sym->end = (addr + size - 1);
+ memcpy((char*)&sym->name, name, len + 1);
+ sym->parent = sym->child[0] = sym->child[1] = NULL;
+ sym->info = 1;
+ if (symbols) {
+ zend_sym_node *node = symbols;
+
+ /* insert it into rbtree */
+ do {
+ if (sym->addr > node->addr) {
+ ZEND_ASSERT(sym->addr > (node->end));
+ if (node->child[1]) {
+ node = node->child[1];
+ } else {
+ node->child[1] = sym;
+ sym->parent = node;
+ break;
+ }
+ } else if (sym->addr < node->addr) {
+ if (node->child[0]) {
+ node = node->child[0];
+ } else {
+ node->child[0] = sym;
+ sym->parent = node;
+ break;
+ }
+ } else {
+ ZEND_ASSERT(sym->addr == node->addr);
+ free(sym);
+ return;
+ }
+ } while (1);
+
+ /* fix rbtree after instering */
+ while (sym && sym != symbols && sym->parent->info == 1) {
+ if (sym->parent == sym->parent->parent->child[0]) {
+ node = sym->parent->parent->child[1];
+ if (node && node->info == 1) {
+ sym->parent->info = 0;
+ node->info = 0;
+ sym->parent->parent->info = 1;
+ sym = sym->parent->parent;
+ } else {
+ if (sym == sym->parent->child[1]) {
+ sym = sym->parent;
+ zend_syms_rotateleft(sym);
+ }
+ sym->parent->info = 0;
+ sym->parent->parent->info = 1;
+ zend_syms_rotateright(sym->parent->parent);
+ }
+ } else {
+ node = sym->parent->parent->child[0];
+ if (node && node->info == 1) {
+ sym->parent->info = 0;
+ node->info = 0;
+ sym->parent->parent->info = 1;
+ sym = sym->parent->parent;
+ } else {
+ if (sym == sym->parent->child[0]) {
+ sym = sym->parent;
+ zend_syms_rotateright(sym);
+ }
+ sym->parent->info = 0;
+ sym->parent->parent->info = 1;
+ zend_syms_rotateleft(sym->parent->parent);
+ }
+ }
+ }
+ } else {
+ symbols = sym;
+ }
+ symbols->info = 0;
+}
+
+static void zend_jit_disasm_destroy_symbols(zend_sym_node *n) {
+ if (n) {
+ if (n->child[0]) {
+ zend_jit_disasm_destroy_symbols(n->child[0]);
+ } else if (n->child[1]) {
+ zend_jit_disasm_destroy_symbols(n->child[1]);
+ }
+ free(n);
+ }
+}
+
+static const char* zend_jit_disasm_find_symbol(uint64_t addr,
+ int64_t *offset) {
+ zend_sym_node *node = symbols;
+ while (node) {
+ if (addr < node->addr) {
+ node = node->child[0];
+ } else if (addr > node->end) {
+ node = node->child[1];
+ } else {
+ *offset = addr - node->addr;
+ return node->name;
+ }
+ }
+ return NULL;
+}
+
+static const char* zend_jit_disasm_resolver(struct ud *ud,
+ uint64_t addr,
+ int64_t *offset)
+{
+#ifndef _WIN32
+ ((void)ud);
+ const char *name;
+ void *a = (void*)(zend_uintptr_t)(addr);
+ Dl_info info;
+
+ name = zend_jit_disasm_find_symbol(addr, offset);
+ if (name) {
+ return name;
+ }
+
+ if (dladdr(a, &info)
+ && info.dli_sname != NULL
+ && info.dli_saddr == a) {
+ return info.dli_sname;
+ }
+#else
+ const char *name;
+ name = zend_jit_disasm_find_symbol(addr, offset);
+ if (name) {
+ return name;
+ }
+#endif
+
+ return NULL;
+}
+
+static int zend_jit_cmp_labels(Bucket *b1, Bucket *b2)
+{
+ return ((b1->h > b2->h) > 0) ? 1 : -1;
+}
+
+static int zend_jit_disasm(const char *name,
+ const char *filename,
+ const zend_op_array *op_array,
+ zend_cfg *cfg,
+ const void *start,
+ size_t size)
+{
+ const void *end = (void *)((char *)start + size);
+ zval zv, *z;
+ zend_long n, m;
+ HashTable labels;
+ const struct ud_operand *op;
+ uint64_t addr;
+ int b;
+
+ if (name) {
+ fprintf(stderr, "%s: ; (%s)\n", name, filename ? filename : "unknown");
+ }
+
+ ud_set_input_buffer(&ud, (uint8_t*)start, (uint8_t*)end - (uint8_t*)start);
+ ud_set_pc(&ud, (uint64_t)(uintptr_t)start);
+
+ zend_hash_init(&labels, 8, NULL, NULL, 0);
+ if (op_array && cfg) {
+ ZVAL_FALSE(&zv);
+ for (b = 0; b < cfg->blocks_count; b++) {
+ if (cfg->blocks[b].flags & (ZEND_BB_ENTRY|ZEND_BB_RECV_ENTRY)) {
+ addr = (uint64_t)(uintptr_t)op_array->opcodes[cfg->blocks[b].start].handler;
+ if (addr >= (uint64_t)(uintptr_t)start && addr < (uint64_t)(uintptr_t)end) {
+ zend_hash_index_add(&labels, addr, &zv);
+ }
+ }
+ }
+ }
+ ZVAL_TRUE(&zv);
+ while (ud_disassemble(&ud)) {
+ op = ud_insn_opr(&ud, 0);
+ if (op && op->type == UD_OP_JIMM) {
+ addr = ud_syn_rel_target(&ud, (struct ud_operand*)op);
+ if (addr >= (uint64_t)(uintptr_t)start && addr < (uint64_t)(uintptr_t)end) {
+ zend_hash_index_add(&labels, addr, &zv);
+ }
+ }
+ }
+
+ zend_hash_sort(&labels, (compare_func_t)zend_jit_cmp_labels, 0);
+
+ /* label numbering */
+ n = 0; m = 0;
+ ZEND_HASH_FOREACH_VAL(&labels, z) {
+ if (Z_TYPE_P(z) == IS_FALSE) {
+ m--;
+ ZVAL_LONG(z, m);
+ } else {
+ n++;
+ ZVAL_LONG(z, n);
+ }
+ } ZEND_HASH_FOREACH_END();
+
+ ud_set_input_buffer(&ud, (uint8_t*)start, (uint8_t*)end - (uint8_t*)start);
+ ud_set_pc(&ud, (uint64_t)(uintptr_t)start);
+
+ while (ud_disassemble(&ud)) {
+ addr = ud_insn_off(&ud);
+ z = zend_hash_index_find(&labels, addr);
+ if (z) {
+ if (Z_LVAL_P(z) < 0) {
+ fprintf(stderr, ".ENTRY" ZEND_LONG_FMT ":\n", -Z_LVAL_P(z));
+ } else {
+ fprintf(stderr, ".L" ZEND_LONG_FMT ":\n", Z_LVAL_P(z));
+ }
+ }
+ op = ud_insn_opr(&ud, 0);
+ if (op && op->type == UD_OP_JIMM) {
+ addr = ud_syn_rel_target(&ud, (struct ud_operand*)op);
+ if (addr >= (uint64_t)(uintptr_t)start && addr < (uint64_t)(uintptr_t)end) {
+ z = zend_hash_index_find(&labels, addr);
+ if (z) {
+ const char *str = ud_insn_asm(&ud);
+ int len;
+
+ len = 0;
+ while (str[len] != 0 && str[len] != ' ' && str[len] != '\t') {
+ len++;
+ }
+ if (str[len] != 0) {
+ while (str[len] == ' ' || str[len] == '\t') {
+ len++;
+ }
+ if (Z_LVAL_P(z) < 0) {
+ fprintf(stderr, "\t%.*s.ENTRY" ZEND_LONG_FMT "\n", len, str, -Z_LVAL_P(z));
+ } else {
+ fprintf(stderr, "\t%.*s.L" ZEND_LONG_FMT "\n", len, str, Z_LVAL_P(z));
+ }
+ continue;
+ }
+ }
+ }
+ }
+ fprintf(stderr, "\t%s\n", ud_insn_asm(&ud));
+ }
+ fprintf(stderr, "\n");
+
+ zend_hash_destroy(&labels);
+
+ return 1;
+}
+
+static int zend_jit_disasm_init(void)
+{
+ ud_init(&ud);
+#if defined(__x86_64__) || defined(_WIN64)
+ ud_set_mode(&ud, 64);
+#else
+ ud_set_mode(&ud, 32);
+#endif
+#if DISASM_INTEL_SYNTAX
+ ud_set_syntax(&ud, UD_SYN_INTEL);
+#else
+ ud_set_syntax(&ud, UD_SYN_ATT);
+#endif
+ ud_set_sym_resolver(&ud, zend_jit_disasm_resolver);
+
+#ifndef ZTS
+#define REGISTER_EG(n) \
+ zend_jit_disasm_add_symbol("EG("#n")", \
+ (uint64_t)(uintptr_t)&executor_globals.n, sizeof(executor_globals.n))
+ REGISTER_EG(uninitialized_zval);
+ REGISTER_EG(exception);
+ REGISTER_EG(vm_interrupt);
+ REGISTER_EG(exception_op);
+ REGISTER_EG(timed_out);
+ REGISTER_EG(current_execute_data);
+ REGISTER_EG(vm_stack_top);
+ REGISTER_EG(vm_stack_end);
+ REGISTER_EG(symbol_table);
+#undef REGISTER_EG
+#endif
+
+ /* Register JIT helper functions */
+#define REGISTER_HELPER(n) \
+ zend_jit_disasm_add_symbol(#n, \
+ (uint64_t)(uintptr_t)n, sizeof(void*));
+ REGISTER_HELPER(memcmp);
+ REGISTER_HELPER(zend_jit_init_func_run_time_cache_helper);
+ REGISTER_HELPER(zend_jit_find_func_helper);
+ REGISTER_HELPER(zend_jit_extend_stack_helper);
+ REGISTER_HELPER(zend_jit_int_extend_stack_helper);
+ REGISTER_HELPER(zend_jit_leave_nested_func_helper);
+ REGISTER_HELPER(zend_jit_leave_top_func_helper);
+ REGISTER_HELPER(zend_jit_symtable_find);
+ REGISTER_HELPER(zend_jit_hash_index_lookup_rw);
+ REGISTER_HELPER(zend_jit_hash_index_lookup_w);
+ REGISTER_HELPER(zend_jit_hash_lookup_rw);
+ REGISTER_HELPER(zend_jit_hash_lookup_w);
+ REGISTER_HELPER(zend_jit_symtable_lookup_rw);
+ REGISTER_HELPER(zend_jit_symtable_lookup_w);
+ REGISTER_HELPER(zend_jit_fetch_dimension_rw_long_helper);
+ REGISTER_HELPER(zend_jit_undefined_op_helper);
+ REGISTER_HELPER(zend_jit_fetch_dim_r_helper);
+ REGISTER_HELPER(zend_jit_fetch_dim_is_helper);
+ REGISTER_HELPER(zend_jit_fetch_dim_isset_helper);
+ REGISTER_HELPER(zend_jit_fetch_dim_str_r_helper);
+ REGISTER_HELPER(zend_jit_fetch_dim_str_is_helper);
+ REGISTER_HELPER(zend_jit_fetch_dim_obj_r_helper);
+ REGISTER_HELPER(zend_jit_fetch_dim_obj_is_helper);
+ REGISTER_HELPER(zend_jit_fetch_dim_rw_helper);
+ REGISTER_HELPER(zend_jit_fetch_dim_w_helper);
+ REGISTER_HELPER(zend_jit_assign_dim_helper);
+ REGISTER_HELPER(zend_jit_assign_dim_op_helper);
+ REGISTER_HELPER(zend_jit_fast_assign_concat_helper);
+ REGISTER_HELPER(zend_jit_fast_concat_helper);
+ REGISTER_HELPER(zend_jit_isset_dim_helper);
+ REGISTER_HELPER(zend_jit_free_call_frame);
+ REGISTER_HELPER(zend_jit_zval_copy_deref_helper)
+ REGISTER_HELPER(zend_jit_new_ref_helper);
+ REGISTER_HELPER(zend_jit_fetch_global_helper);
+ REGISTER_HELPER(zend_jit_verify_arg_slow);
+ REGISTER_HELPER(zend_jit_fetch_obj_r_slow);
+ REGISTER_HELPER(zend_jit_fetch_obj_r_dynamic);
+ REGISTER_HELPER(zend_jit_fetch_obj_is_slow);
+ REGISTER_HELPER(zend_jit_fetch_obj_is_dynamic);
+ REGISTER_HELPER(zend_jit_vm_stack_free_args_helper);
+ REGISTER_HELPER(zend_jit_copy_extra_args_helper);
+ REGISTER_HELPER(zend_jit_deprecated_helper);
+ REGISTER_HELPER(zend_jit_assign_const_to_typed_ref);
+ REGISTER_HELPER(zend_jit_assign_tmp_to_typed_ref);
+ REGISTER_HELPER(zend_jit_assign_var_to_typed_ref);
+ REGISTER_HELPER(zend_jit_assign_cv_to_typed_ref);
+ REGISTER_HELPER(zend_jit_pre_inc_typed_ref);
+ REGISTER_HELPER(zend_jit_pre_dec_typed_ref);
+ REGISTER_HELPER(zend_jit_post_inc_typed_ref);
+ REGISTER_HELPER(zend_jit_post_dec_typed_ref);
+ REGISTER_HELPER(zend_jit_assign_op_to_typed_ref);
+ REGISTER_HELPER(zend_jit_only_vars_by_reference);
+ REGISTER_HELPER(zend_jit_invalid_array_access);
+ REGISTER_HELPER(zend_jit_prepare_assign_dim_ref);
+ REGISTER_HELPER(zend_jit_pre_inc);
+ REGISTER_HELPER(zend_jit_pre_dec);
+ REGISTER_HELPER(zend_runtime_jit);
+ REGISTER_HELPER(zend_jit_hot_func);
+#undef REGISTER_HELPER
+
+#ifndef _WIN32
+ zend_elf_load_symbols();
+#endif
+
+ if (zend_vm_kind() == ZEND_VM_KIND_HYBRID) {
+ zend_op opline;
+
+ memset(&opline, 0, sizeof(opline));
+
+ opline.opcode = ZEND_DO_UCALL;
+ opline.result_type = IS_UNUSED;
+ zend_vm_set_opcode_handler(&opline);
+ zend_jit_disasm_add_symbol("ZEND_DO_UCALL_SPEC_RETVAL_UNUSED_LABEL", (uint64_t)(uintptr_t)opline.handler, sizeof(void*));
+
+ opline.opcode = ZEND_DO_UCALL;
+ opline.result_type = IS_VAR;
+ zend_vm_set_opcode_handler(&opline);
+ zend_jit_disasm_add_symbol("ZEND_DO_UCALL_SPEC_RETVAL_USED_LABEL", (uint64_t)(uintptr_t)opline.handler, sizeof(void*));
+
+ opline.opcode = ZEND_DO_FCALL_BY_NAME;
+ opline.result_type = IS_UNUSED;
+ zend_vm_set_opcode_handler(&opline);
+ zend_jit_disasm_add_symbol("ZEND_DO_FCALL_BY_NAME_SPEC_RETVAL_UNUSED_LABEL", (uint64_t)(uintptr_t)opline.handler, sizeof(void*));
+
+ opline.opcode = ZEND_DO_FCALL_BY_NAME;
+ opline.result_type = IS_VAR;
+ zend_vm_set_opcode_handler(&opline);
+ zend_jit_disasm_add_symbol("ZEND_DO_FCALL_BY_NAME_SPEC_RETVAL_USED_LABEL", (uint64_t)(uintptr_t)opline.handler, sizeof(void*));
+
+ opline.opcode = ZEND_DO_FCALL;
+ opline.result_type = IS_UNUSED;
+ zend_vm_set_opcode_handler(&opline);
+ zend_jit_disasm_add_symbol("ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_LABEL", (uint64_t)(uintptr_t)opline.handler, sizeof(void*));
+
+ opline.opcode = ZEND_DO_FCALL;
+ opline.result_type = IS_VAR;
+ zend_vm_set_opcode_handler(&opline);
+ zend_jit_disasm_add_symbol("ZEND_DO_FCALL_SPEC_RETVAL_USED_LABEL", (uint64_t)(uintptr_t)opline.handler, sizeof(void*));
+
+ opline.opcode = ZEND_RETURN;
+ opline.op1_type = IS_CONST;
+ zend_vm_set_opcode_handler(&opline);
+ zend_jit_disasm_add_symbol("ZEND_RETURN_SPEC_CONST_LABEL", (uint64_t)(uintptr_t)opline.handler, sizeof(void*));
+
+ opline.opcode = ZEND_RETURN;
+ opline.op1_type = IS_TMP_VAR;
+ zend_vm_set_opcode_handler(&opline);
+ zend_jit_disasm_add_symbol("ZEND_RETURN_SPEC_TMP_LABEL", (uint64_t)(uintptr_t)opline.handler, sizeof(void*));
+
+ opline.opcode = ZEND_RETURN;
+ opline.op1_type = IS_VAR;
+ zend_vm_set_opcode_handler(&opline);
+ zend_jit_disasm_add_symbol("ZEND_RETURN_SPEC_VAR_LABEL", (uint64_t)(uintptr_t)opline.handler, sizeof(void*));
+
+ opline.opcode = ZEND_RETURN;
+ opline.op1_type = IS_CV;
+ zend_vm_set_opcode_handler(&opline);
+ zend_jit_disasm_add_symbol("ZEND_RETURN_SPEC_CV_LABEL", (uint64_t)(uintptr_t)opline.handler, sizeof(void*));
+ }
+
+ return 1;
+}
+
+static void zend_jit_disasm_shutdown(void)
+{
+ zend_jit_disasm_destroy_symbols(symbols);
+}
diff --git a/ext/opcache/jit/zend_jit_gdb.c b/ext/opcache/jit/zend_jit_gdb.c
new file mode 100644
index 0000000000..58b075ea8c
--- /dev/null
+++ b/ext/opcache/jit/zend_jit_gdb.c
@@ -0,0 +1,493 @@
+/*
+ +----------------------------------------------------------------------+
+ | Zend JIT |
+ +----------------------------------------------------------------------+
+ | Copyright (c) The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Dmitry Stogov <dmitry@php.net> |
+ | Xinchen Hui <laruence@php.net> |
+ +----------------------------------------------------------------------+
+ | Based on Mike Pall's implementation of GDB interface for LuaJIT. |
+ | LuaJIT -- a Just-In-Time Compiler for Lua. http://luajit.org/ |
+ +----------------------------------------------------------------------+
+*/
+
+#define HAVE_GDB
+
+#ifdef HAVE_GDB
+
+#include "zend_elf.h"
+#include "zend_gdb.h"
+
+/* DWARF definitions. */
+#define DW_CIE_VERSION 1
+
+/* CFA (Canonical frame address) */
+enum {
+ DW_CFA_nop = 0x0,
+ DW_CFA_offset_extended = 0x5,
+ DW_CFA_def_cfa = 0xc,
+ DW_CFA_def_cfa_offset = 0xe,
+ DW_CFA_offset_extended_sf = 0x11,
+ DW_CFA_advance_loc = 0x40,
+ DW_CFA_offset = 0x80
+};
+
+enum {
+ DW_EH_PE_udata4 = 0x03,
+ DW_EH_PE_textrel = 0x20
+};
+
+enum {
+ DW_TAG_compile_unit = 0x11
+};
+
+enum {
+ DW_children_no = 0,
+ DW_children_yes = 1
+};
+
+enum {
+ DW_AT_name = 0x03,
+ DW_AT_stmt_list = 0x10,
+ DW_AT_low_pc = 0x11,
+ DW_AT_high_pc = 0x12
+};
+
+enum {
+ DW_FORM_addr = 0x01,
+ DW_FORM_data4 = 0x06,
+ DW_FORM_string = 0x08
+};
+
+enum {
+ DW_LNS_extended_op = 0,
+ DW_LNS_copy = 1,
+ DW_LNS_advance_pc = 2,
+ DW_LNS_advance_line = 3
+};
+
+enum {
+ DW_LNE_end_sequence = 1,
+ DW_LNE_set_address = 2
+};
+
+enum {
+#if defined(__i386__)
+ DW_REG_AX, DW_REG_CX, DW_REG_DX, DW_REG_BX,
+ DW_REG_SP, DW_REG_BP, DW_REG_SI, DW_REG_DI,
+ DW_REG_RA,
+#elif defined(__x86_64__)
+ /* Yes, the order is strange, but correct. */
+ DW_REG_AX, DW_REG_DX, DW_REG_CX, DW_REG_BX,
+ DW_REG_SI, DW_REG_DI, DW_REG_BP, DW_REG_SP,
+ DW_REG_8, DW_REG_9, DW_REG_10, DW_REG_11,
+ DW_REG_12, DW_REG_13, DW_REG_14, DW_REG_15,
+ DW_REG_RA,
+ /* TODO: ARM supports? */
+#else
+#error "Unsupported target architecture"
+#endif
+};
+
+enum {
+ GDBJIT_SECT_NULL,
+ GDBJIT_SECT_text,
+ GDBJIT_SECT_eh_frame,
+ GDBJIT_SECT_shstrtab,
+ GDBJIT_SECT_strtab,
+ GDBJIT_SECT_symtab,
+ GDBJIT_SECT_debug_info,
+ GDBJIT_SECT_debug_abbrev,
+ GDBJIT_SECT_debug_line,
+ GDBJIT_SECT__MAX
+};
+
+enum {
+ GDBJIT_SYM_UNDEF,
+ GDBJIT_SYM_FILE,
+ GDBJIT_SYM_FUNC,
+ GDBJIT_SYM__MAX
+};
+
+typedef struct _zend_gdbjit_obj {
+ zend_elf_header hdr;
+ zend_elf_sectheader sect[GDBJIT_SECT__MAX];
+ zend_elf_symbol sym[GDBJIT_SYM__MAX];
+ uint8_t space[4096];
+} zend_gdbjit_obj;
+
+static const zend_elf_header zend_elfhdr_template = {
+ .emagic = { 0x7f, 'E', 'L', 'F' },
+#ifdef ELF64
+ .eclass = 2,
+#else
+ .eclass = 1,
+#endif
+#ifdef WORDS_BIGENDIAN
+ .eendian = 2,
+#else
+ .eendian = 1,
+#endif
+ .eversion = 1,
+#if defined(Linux)
+ .eosabi = 0, /* Nope, it's not 3. ??? */
+#elif defined(__FreeBSD__)
+ .eosabi = 9,
+#elif defined(__OpenBSD__)
+ .eosabi = 12,
+#elif defined(__DragonFly__)
+ .eosabi = 0,
+#elif (defined(__sun__) && defined(__svr4__))
+ .eosabi = 6,
+#else
+ .eosabi = 0,
+#endif
+ .eabiversion = 0,
+ .epad = { 0, 0, 0, 0, 0, 0, 0 },
+ .type = 1,
+#if defined(__i386__)
+ .machine = 3,
+#elif defined(__x86_64__)
+ .machine = 62,
+#else
+# error "Unsupported target architecture"
+#endif
+ .version = 1,
+ .entry = 0,
+ .phofs = 0,
+ .shofs = offsetof(zend_gdbjit_obj, sect),
+ .flags = 0,
+ .ehsize = sizeof(zend_elf_header),
+ .phentsize = 0,
+ .phnum = 0,
+ .shentsize = sizeof(zend_elf_sectheader),
+ .shnum = GDBJIT_SECT__MAX,
+ .shstridx = GDBJIT_SECT_shstrtab
+};
+
+/* Context for generating the ELF object for the GDB JIT API. */
+typedef struct _zend_gdbjit_ctx {
+ uint8_t *p; /* Pointer to next address in obj.space. */
+ uint8_t *startp; /* Pointer to start address in obj.space. */
+ uintptr_t mcaddr; /* Machine code address. */
+ uint32_t szmcode; /* Size of machine code. */
+ int32_t lineno; /* Starting line number. */
+ const char *name; /* JIT function name */
+ const char *filename; /* Starting file name. */
+ size_t objsize; /* Final size of ELF object. */
+ zend_gdbjit_obj obj; /* In-memory ELF object. */
+} zend_gdbjit_ctx;
+
+/* Add a zero-terminated string */
+static uint32_t zend_gdbjit_strz(zend_gdbjit_ctx *ctx, const char *str)
+{
+ uint8_t *p = ctx->p;
+ uint32_t ofs = (uint32_t)(p - ctx->startp);
+ do {
+ *p++ = (uint8_t)*str;
+ } while (*str++);
+ ctx->p = p;
+ return ofs;
+}
+
+/* Add a ULEB128 value */
+static void zend_gdbjit_uleb128(zend_gdbjit_ctx *ctx, uint32_t v)
+{
+ uint8_t *p = ctx->p;
+ for (; v >= 0x80; v >>= 7)
+ *p++ = (uint8_t)((v & 0x7f) | 0x80);
+ *p++ = (uint8_t)v;
+ ctx->p = p;
+}
+
+/* Add a SLEB128 value */
+static void zend_gdbjit_sleb128(zend_gdbjit_ctx *ctx, int32_t v)
+{
+ uint8_t *p = ctx->p;
+ for (; (uint32_t)(v+0x40) >= 0x80; v >>= 7)
+ *p++ = (uint8_t)((v & 0x7f) | 0x80);
+ *p++ = (uint8_t)(v & 0x7f);
+ ctx->p = p;
+}
+
+static void zend_gdbjit_secthdr(zend_gdbjit_ctx *ctx)
+{
+ zend_elf_sectheader *sect;
+
+ *ctx->p++ = '\0';
+
+#define SECTDEF(id, tp, al) \
+ sect = &ctx->obj.sect[GDBJIT_SECT_##id]; \
+ sect->name = zend_gdbjit_strz(ctx, "." #id); \
+ sect->type = ELFSECT_TYPE_##tp; \
+ sect->align = (al)
+
+ SECTDEF(text, NOBITS, 16);
+ sect->flags = ELFSECT_FLAGS_ALLOC|ELFSECT_FLAGS_EXEC;
+ sect->addr = ctx->mcaddr;
+ sect->ofs = 0;
+ sect->size = ctx->szmcode;
+
+ SECTDEF(eh_frame, PROGBITS, sizeof(uintptr_t));
+ sect->flags = ELFSECT_FLAGS_ALLOC;
+
+ SECTDEF(shstrtab, STRTAB, 1);
+ SECTDEF(strtab, STRTAB, 1);
+
+ SECTDEF(symtab, SYMTAB, sizeof(uintptr_t));
+ sect->ofs = offsetof(zend_gdbjit_obj, sym);
+ sect->size = sizeof(ctx->obj.sym);
+ sect->link = GDBJIT_SECT_strtab;
+ sect->entsize = sizeof(zend_elf_symbol);
+ sect->info = GDBJIT_SYM_FUNC;
+
+ SECTDEF(debug_info, PROGBITS, 1);
+ SECTDEF(debug_abbrev, PROGBITS, 1);
+ SECTDEF(debug_line, PROGBITS, 1);
+
+#undef SECTDEF
+}
+
+static void zend_gdbjit_symtab(zend_gdbjit_ctx *ctx)
+{
+ zend_elf_symbol *sym;
+
+ *ctx->p++ = '\0';
+
+ sym = &ctx->obj.sym[GDBJIT_SYM_FILE];
+ sym->name = zend_gdbjit_strz(ctx, "JIT code");
+ sym->sectidx = ELFSECT_IDX_ABS;
+ sym->info = ELFSYM_INFO(ELFSYM_BIND_LOCAL, ELFSYM_TYPE_FILE);
+
+ sym = &ctx->obj.sym[GDBJIT_SYM_FUNC];
+ sym->name = zend_gdbjit_strz(ctx, ctx->name);
+ sym->sectidx = GDBJIT_SECT_text;
+ sym->value = 0;
+ sym->size = ctx->szmcode;
+ sym->info = ELFSYM_INFO(ELFSYM_BIND_GLOBAL, ELFSYM_TYPE_FUNC);
+}
+
+#define SECTALIGN(p, a) \
+ ((p) = (uint8_t *)(((uintptr_t)(p) + ((a)-1)) & ~(uintptr_t)((a)-1)))
+
+/* Shortcuts to generate DWARF structures. */
+#define DB(x) (*p++ = (x))
+#define DI8(x) (*(int8_t *)p = (x), p++)
+#define DU16(x) (*(uint16_t *)p = (x), p += 2)
+#define DU32(x) (*(uint32_t *)p = (x), p += 4)
+#define DADDR(x) (*(uintptr_t *)p = (x), p += sizeof(uintptr_t))
+#define DUV(x) (ctx->p = p, zend_gdbjit_uleb128(ctx, (x)), p = ctx->p)
+#define DSV(x) (ctx->p = p, zend_gdbjit_sleb128(ctx, (x)), p = ctx->p)
+#define DSTR(str) (ctx->p = p, zend_gdbjit_strz(ctx, (str)), p = ctx->p)
+#define DALIGNNOP(s) while ((uintptr_t)p & ((s)-1)) *p++ = DW_CFA_nop
+#define DSECT(name, stmt) \
+ { uint32_t *szp_##name = (uint32_t *)p; p += 4; stmt \
+ *szp_##name = (uint32_t)((p-(uint8_t *)szp_##name)-4); }
+
+static void zend_gdbjit_ehframe(zend_gdbjit_ctx *ctx)
+{
+ uint8_t *p = ctx->p;
+ uint8_t *framep = p;
+
+ /* DWARF EH CIE (Common Information Entry) */
+ DSECT(CIE,
+ DU32(0); /* CIE ID. */
+ DB(DW_CIE_VERSION); /* Version */
+ DSTR("zR"); /* Augmentation String. */
+ DUV(1); /* Code alignment factor. */
+ DSV(-(int32_t)sizeof(uintptr_t)); /* Data alignment factor. */
+ DB(DW_REG_RA); /* Return address register. */
+ DB(1); DB(DW_EH_PE_textrel|DW_EH_PE_udata4); /* Augmentation data. */
+ DB(DW_CFA_def_cfa); DUV(DW_REG_SP); DUV(sizeof(uintptr_t));
+ DB(DW_CFA_offset|DW_REG_RA); DUV(1);
+ DALIGNNOP(sizeof(uintptr_t));
+ )
+
+ /* DWARF EH FDE (Frame Description Entry). */
+ DSECT(FDE,
+ DU32((uint32_t)(p-framep)); /* Offset to CIE Pointer. */
+ DU32(0); /* Machine code offset relative to .text. */
+ DU32(ctx->szmcode); /* Machine code length. */
+ DB(0); /* Augmentation data. */
+ DB(DW_CFA_def_cfa_offset); DUV(sizeof(uintptr_t));
+#if defined(__i386__)
+ DB(DW_CFA_advance_loc|3); /* sub $0xc,%esp */
+ DB(DW_CFA_def_cfa_offset); DUV(16); /* Aligned stack frame size. */
+#elif defined(__x86_64__)
+ DB(DW_CFA_advance_loc|4); /* sub $0x8,%rsp */
+ DB(DW_CFA_def_cfa_offset); DUV(16); /* Aligned stack frame size. */
+#else
+# error "Unsupported target architecture"
+#endif
+ DALIGNNOP(sizeof(uintptr_t));
+ )
+
+ ctx->p = p;
+}
+
+static void zend_gdbjit_debuginfo(zend_gdbjit_ctx *ctx)
+{
+ uint8_t *p = ctx->p;
+
+ DSECT(info,
+ DU16(2); /* DWARF version. */
+ DU32(0); /* Abbrev offset. */
+ DB(sizeof(uintptr_t)); /* Pointer size. */
+
+ DUV(1); /* Abbrev #1: DW_TAG_compile_unit. */
+ DSTR(ctx->filename); /* DW_AT_name. */
+ DADDR(ctx->mcaddr); /* DW_AT_low_pc. */
+ DADDR(ctx->mcaddr + ctx->szmcode); /* DW_AT_high_pc. */
+ DU32(0); /* DW_AT_stmt_list. */
+ );
+
+ ctx->p = p;
+}
+
+static void zend_gdbjit_debugabbrev(zend_gdbjit_ctx *ctx)
+{
+ uint8_t *p = ctx->p;
+
+ /* Abbrev #1: DW_TAG_compile_unit. */
+ DUV(1);
+ DUV(DW_TAG_compile_unit);
+ DB(DW_children_no);
+ DUV(DW_AT_name);
+ DUV(DW_FORM_string);
+ DUV(DW_AT_low_pc);
+ DUV(DW_FORM_addr);
+ DUV(DW_AT_high_pc);
+ DUV(DW_FORM_addr);
+ DUV(DW_AT_stmt_list);
+ DUV(DW_FORM_data4);
+ DB(0);
+ DB(0);
+
+ ctx->p = p;
+}
+
+#define DLNE(op, s) (DB(DW_LNS_extended_op), DUV(1+(s)), DB((op)))
+
+static void zend_gdbjit_debugline(zend_gdbjit_ctx *ctx)
+{
+ uint8_t *p = ctx->p;
+
+ DSECT(line,
+ DU16(2); /* DWARF version. */
+ DSECT(header,
+ DB(1); /* Minimum instruction length. */
+ DB(1); /* is_stmt. */
+ DI8(0); /* Line base for special opcodes. */
+ DB(2); /* Line range for special opcodes. */
+ DB(3+1); /* Opcode base at DW_LNS_advance_line+1. */
+ DB(0); DB(1); DB(1); /* Standard opcode lengths. */
+ /* Directory table. */
+ DB(0);
+ /* File name table. */
+ DSTR(ctx->filename); DUV(0); DUV(0); DUV(0);
+ DB(0);
+ );
+ DLNE(DW_LNE_set_address, sizeof(uintptr_t));
+ DADDR(ctx->mcaddr);
+ if (ctx->lineno) (DB(DW_LNS_advance_line), DSV(ctx->lineno-1));
+ DB(DW_LNS_copy);
+ DB(DW_LNS_advance_pc); DUV(ctx->szmcode);
+ DLNE(DW_LNE_end_sequence, 0);
+ );
+
+ ctx->p = p;
+}
+
+
+#undef DLNE
+
+/* Undef shortcuts. */
+#undef DB
+#undef DI8
+#undef DU16
+#undef DU32
+#undef DADDR
+#undef DUV
+#undef DSV
+#undef DSTR
+#undef DALIGNNOP
+#undef DSECT
+
+typedef void (*zend_gdbjit_initf) (zend_gdbjit_ctx *ctx);
+
+static void zend_gdbjit_initsect(zend_gdbjit_ctx *ctx, int sect, zend_gdbjit_initf initf)
+{
+ ctx->startp = ctx->p;
+ ctx->obj.sect[sect].ofs = (uintptr_t)((char *)ctx->p - (char *)&ctx->obj);
+ initf(ctx);
+ ctx->obj.sect[sect].size = (uintptr_t)(ctx->p - ctx->startp);
+}
+
+static void zend_gdbjit_buildobj(zend_gdbjit_ctx *ctx)
+{
+ zend_gdbjit_obj *obj = &ctx->obj;
+
+ /* Fill in ELF header and clear structures. */
+ memcpy(&obj->hdr, &zend_elfhdr_template, sizeof(zend_elf_header));
+ memset(&obj->sect, 0, sizeof(zend_elf_sectheader) * GDBJIT_SECT__MAX);
+ memset(&obj->sym, 0, sizeof(zend_elf_symbol) * GDBJIT_SYM__MAX);
+
+ /* Initialize sections. */
+ ctx->p = obj->space;
+ zend_gdbjit_initsect(ctx, GDBJIT_SECT_shstrtab, zend_gdbjit_secthdr);
+ zend_gdbjit_initsect(ctx, GDBJIT_SECT_strtab, zend_gdbjit_symtab);
+ zend_gdbjit_initsect(ctx, GDBJIT_SECT_debug_info, zend_gdbjit_debuginfo);
+ zend_gdbjit_initsect(ctx, GDBJIT_SECT_debug_abbrev, zend_gdbjit_debugabbrev);
+ zend_gdbjit_initsect(ctx, GDBJIT_SECT_debug_line, zend_gdbjit_debugline);
+ SECTALIGN(ctx->p, sizeof(uintptr_t));
+ zend_gdbjit_initsect(ctx, GDBJIT_SECT_eh_frame, zend_gdbjit_ehframe);
+ ctx->objsize = (size_t)((char *)ctx->p - (char *)obj);
+
+ ZEND_ASSERT(ctx->objsize < sizeof(zend_gdbjit_obj));
+}
+
+static int zend_jit_gdb_register(const char *name,
+ const zend_op_array *op_array,
+ const void *start,
+ size_t size)
+{
+ zend_gdbjit_ctx ctx;
+
+ ctx.mcaddr = (uintptr_t)start;
+ ctx.szmcode = (uint32_t)size;
+ ctx.name = name;
+ ctx.filename = op_array ? ZSTR_VAL(op_array->filename) : "unknown";
+ ctx.lineno = op_array ? op_array->line_start : 0;
+
+ zend_gdbjit_buildobj(&ctx);
+
+ return zend_gdb_register_code(&ctx.obj, ctx.objsize);
+}
+
+static int zend_jit_gdb_unregister(void)
+{
+ zend_gdb_unregister_all();
+ return 1;
+}
+
+static void zend_jit_gdb_init(void)
+{
+#if 0
+ /* This might enable registration of all JIT-ed code, but unfortunately,
+ * in case of many functions, this takes enormous time. */
+ if (zend_gdb_present()) {
+ ZCG(accel_directives).jit_debug |= ZEND_JIT_DEBUG_GDB;
+ }
+#endif
+}
+
+#endif
diff --git a/ext/opcache/jit/zend_jit_helpers.c b/ext/opcache/jit/zend_jit_helpers.c
new file mode 100644
index 0000000000..d0caabe5da
--- /dev/null
+++ b/ext/opcache/jit/zend_jit_helpers.c
@@ -0,0 +1,1504 @@
+/*
+ +----------------------------------------------------------------------+
+ | Zend JIT |
+ +----------------------------------------------------------------------+
+ | Copyright (c) The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Dmitry Stogov <dmitry@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+#include "Zend/zend_API.h"
+
+static ZEND_COLD void undef_result_after_exception() {
+ const zend_op *opline = EG(opline_before_exception);
+ ZEND_ASSERT(EG(exception));
+ if (opline->result_type & (IS_VAR | IS_TMP_VAR)) {
+ zend_execute_data *execute_data = EG(current_execute_data);
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ }
+}
+
+static zend_never_inline zend_function* ZEND_FASTCALL _zend_jit_init_func_run_time_cache(const zend_op_array *op_array) /* {{{ */
+{
+ void **run_time_cache;
+
+ run_time_cache = zend_arena_alloc(&CG(arena), op_array->cache_size);
+ memset(run_time_cache, 0, op_array->cache_size);
+ ZEND_MAP_PTR_SET(op_array->run_time_cache, run_time_cache);
+ return (zend_function*)op_array;
+}
+/* }}} */
+
+static zend_never_inline zend_op_array* ZEND_FASTCALL zend_jit_init_func_run_time_cache_helper(zend_op_array *op_array) /* {{{ */
+{
+ void **run_time_cache;
+
+ if (!RUN_TIME_CACHE(op_array)) {
+ run_time_cache = zend_arena_alloc(&CG(arena), op_array->cache_size);
+ memset(run_time_cache, 0, op_array->cache_size);
+ ZEND_MAP_PTR_SET(op_array->run_time_cache, run_time_cache);
+ }
+ return op_array;
+}
+/* }}} */
+
+static zend_function* ZEND_FASTCALL zend_jit_find_func_helper(zend_string *name)
+{
+ zval *func = zend_hash_find_ex(EG(function_table), name, 1);
+ zend_function *fbc;
+
+ if (UNEXPECTED(func == NULL)) {
+ return NULL;
+ }
+ fbc = Z_FUNC_P(func);
+ if (EXPECTED(fbc->type == ZEND_USER_FUNCTION) && UNEXPECTED(!RUN_TIME_CACHE(&fbc->op_array))) {
+ fbc = _zend_jit_init_func_run_time_cache(&fbc->op_array);
+ }
+ return fbc;
+}
+
+static zend_execute_data* ZEND_FASTCALL zend_jit_extend_stack_helper(uint32_t used_stack, zend_function *fbc)
+{
+ zend_execute_data *call = (zend_execute_data*)zend_vm_stack_extend(used_stack);
+ call->func = fbc;
+ ZEND_CALL_INFO(call) = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_ALLOCATED;
+ return call;
+}
+
+static zend_execute_data* ZEND_FASTCALL zend_jit_int_extend_stack_helper(uint32_t used_stack)
+{
+ zend_execute_data *call = (zend_execute_data*)zend_vm_stack_extend(used_stack);
+ ZEND_CALL_INFO(call) = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_ALLOCATED;
+ return call;
+}
+
+static zval* ZEND_FASTCALL zend_jit_symtable_find(HashTable *ht, zend_string *str)
+{
+ zend_ulong idx;
+ register const char *tmp = str->val;
+
+ do {
+ if (*tmp > '9') {
+ break;
+ } else if (*tmp < '0') {
+ if (*tmp != '-') {
+ break;
+ }
+ tmp++;
+ if (*tmp > '9' || *tmp < '0') {
+ break;
+ }
+ }
+ if (_zend_handle_numeric_str_ex(str->val, str->len, &idx)) {
+ return zend_hash_index_find(ht, idx);
+ }
+ } while (0);
+
+ return zend_hash_find(ht, str);
+}
+
+static zval* ZEND_FASTCALL zend_jit_hash_index_lookup_rw(HashTable *ht, zend_long idx)
+{
+ zval *retval = zend_hash_index_find(ht, idx);
+
+ if (!retval) {
+ zend_error(E_NOTICE,"Undefined offset: " ZEND_LONG_FMT, idx);
+ retval = zend_hash_index_update(ht, idx, &EG(uninitialized_zval));
+ }
+ return retval;
+}
+
+static zval* ZEND_FASTCALL zend_jit_hash_index_lookup_w(HashTable *ht, zend_long idx)
+{
+ zval *retval = zend_hash_index_find(ht, idx);
+
+ if (!retval) {
+ retval = zend_hash_index_add_new(ht, idx, &EG(uninitialized_zval));
+ }
+ return retval;
+}
+
+static zval* ZEND_FASTCALL zend_jit_hash_lookup_rw(HashTable *ht, zend_string *str)
+{
+ zval *retval = zend_hash_find(ht, str);
+
+ if (retval) {
+ if (UNEXPECTED(Z_TYPE_P(retval) == IS_INDIRECT)) {
+ retval = Z_INDIRECT_P(retval);
+ if (UNEXPECTED(Z_TYPE_P(retval) == IS_UNDEF)) {
+ zend_error(E_NOTICE,"Undefined index: %s", ZSTR_VAL(str));
+ ZVAL_NULL(retval);
+ }
+ }
+ } else {
+ zend_error(E_NOTICE,"Undefined index: %s", ZSTR_VAL(str));
+ retval = zend_hash_update(ht, str, &EG(uninitialized_zval));
+ }
+ return retval;
+}
+
+static zval* ZEND_FASTCALL zend_jit_hash_lookup_w(HashTable *ht, zend_string *str)
+{
+ zval *retval = zend_hash_find(ht, str);
+
+ if (retval) {
+ if (UNEXPECTED(Z_TYPE_P(retval) == IS_INDIRECT)) {
+ retval = Z_INDIRECT_P(retval);
+ if (UNEXPECTED(Z_TYPE_P(retval) == IS_UNDEF)) {
+ ZVAL_NULL(retval);
+ }
+ }
+ } else {
+ retval = zend_hash_add_new(ht, str, &EG(uninitialized_zval));
+ }
+ return retval;
+}
+
+static zval* ZEND_FASTCALL zend_jit_symtable_lookup_rw(HashTable *ht, zend_string *str)
+{
+ zend_ulong idx;
+ register const char *tmp = str->val;
+
+ do {
+ if (*tmp > '9') {
+ break;
+ } else if (*tmp < '0') {
+ if (*tmp != '-') {
+ break;
+ }
+ tmp++;
+ if (*tmp > '9' || *tmp < '0') {
+ break;
+ }
+ }
+ if (_zend_handle_numeric_str_ex(str->val, str->len, &idx)) {
+ zval *retval = zend_hash_index_find(ht, idx);
+
+ if (!retval) {
+ zend_error(E_NOTICE,"Undefined index: %s", ZSTR_VAL(str));
+ retval = zend_hash_index_update(ht, idx, &EG(uninitialized_zval));
+ }
+ return retval;
+ }
+ } while (0);
+
+ return zend_jit_hash_lookup_rw(ht, str);
+}
+
+static zval* ZEND_FASTCALL zend_jit_symtable_lookup_w(HashTable *ht, zend_string *str)
+{
+ zend_ulong idx;
+ register const char *tmp = str->val;
+
+ do {
+ if (*tmp > '9') {
+ break;
+ } else if (*tmp < '0') {
+ if (*tmp != '-') {
+ break;
+ }
+ tmp++;
+ if (*tmp > '9' || *tmp < '0') {
+ break;
+ }
+ }
+ if (_zend_handle_numeric_str_ex(str->val, str->len, &idx)) {
+ zval *retval = zend_hash_index_find(ht, idx);
+
+ if (!retval) {
+ retval = zend_hash_index_add_new(ht, idx, &EG(uninitialized_zval));
+ }
+ return retval;
+ }
+ } while (0);
+
+ return zend_jit_hash_lookup_w(ht, str);
+}
+
+static void ZEND_FASTCALL zend_jit_undefined_op_helper(uint32_t var)
+{
+ const zend_execute_data *execute_data = EG(current_execute_data);
+ zend_string *cv = EX(func)->op_array.vars[EX_VAR_TO_NUM(var)];
+
+ zend_error(E_WARNING, "Undefined variable: %s", ZSTR_VAL(cv));
+}
+
+static void ZEND_FASTCALL zend_jit_fetch_dim_r_helper(zend_array *ht, zval *dim, zval *result)
+{
+ zend_long hval;
+ zend_string *offset_key;
+ zval *retval;
+
+ if (Z_TYPE_P(dim) == IS_REFERENCE) {
+ dim = Z_REFVAL_P(dim);
+ }
+
+ switch (Z_TYPE_P(dim)) {
+ case IS_LONG:
+ hval = Z_LVAL_P(dim);
+ goto num_index;
+ case IS_STRING:
+ offset_key = Z_STR_P(dim);
+ goto str_index;
+ case IS_UNDEF:
+ zend_jit_undefined_op_helper(EG(current_execute_data)->opline->op2.var);
+ /* break missing intentionally */
+ case IS_NULL:
+ offset_key = ZSTR_EMPTY_ALLOC();
+ goto str_index;
+ case IS_DOUBLE:
+ hval = zend_dval_to_lval(Z_DVAL_P(dim));
+ goto num_index;
+ case IS_RESOURCE:
+ zend_error(E_WARNING, "Resource ID#%d used as offset, casting to integer (%d)", Z_RES_HANDLE_P(dim), Z_RES_HANDLE_P(dim));
+ hval = Z_RES_HANDLE_P(dim);
+ goto num_index;
+ case IS_FALSE:
+ hval = 0;
+ goto num_index;
+ case IS_TRUE:
+ hval = 1;
+ goto num_index;
+ default:
+ zend_type_error("Illegal offset type");
+ ZVAL_NULL(result);
+ return;
+ }
+
+str_index:
+ retval = zend_hash_find(ht, offset_key);
+ if (retval) {
+ /* support for $GLOBALS[...] */
+ if (UNEXPECTED(Z_TYPE_P(retval) == IS_INDIRECT)) {
+ retval = Z_INDIRECT_P(retval);
+ if (UNEXPECTED(Z_TYPE_P(retval) == IS_UNDEF)) {
+ zend_error(E_NOTICE, "Undefined index: %s", ZSTR_VAL(offset_key));
+ ZVAL_NULL(result);
+ return;
+ }
+ }
+ } else {
+ zend_error(E_NOTICE, "Undefined index: %s", ZSTR_VAL(offset_key));
+ ZVAL_NULL(result);
+ return;
+ }
+ ZVAL_COPY_DEREF(result, retval);
+ return;
+
+num_index:
+ ZEND_HASH_INDEX_FIND(ht, hval, retval, num_undef);
+ ZVAL_COPY_DEREF(result, retval);
+ return;
+
+num_undef:
+ zend_error(E_NOTICE,"Undefined offset: " ZEND_LONG_FMT, hval);
+ ZVAL_NULL(result);
+}
+
+static void ZEND_FASTCALL zend_jit_fetch_dim_is_helper(zend_array *ht, zval *dim, zval *result)
+{
+ zend_long hval;
+ zend_string *offset_key;
+ zval *retval;
+
+ if (Z_TYPE_P(dim) == IS_REFERENCE) {
+ dim = Z_REFVAL_P(dim);
+ }
+
+ switch (Z_TYPE_P(dim)) {
+ case IS_LONG:
+ hval = Z_LVAL_P(dim);
+ goto num_index;
+ case IS_STRING:
+ offset_key = Z_STR_P(dim);
+ goto str_index;
+ case IS_UNDEF:
+ zend_jit_undefined_op_helper(EG(current_execute_data)->opline->op2.var);
+ /* break missing intentionally */
+ case IS_NULL:
+ offset_key = ZSTR_EMPTY_ALLOC();
+ goto str_index;
+ case IS_DOUBLE:
+ hval = zend_dval_to_lval(Z_DVAL_P(dim));
+ goto num_index;
+ case IS_RESOURCE:
+ zend_error(E_WARNING, "Resource ID#%d used as offset, casting to integer (%d)", Z_RES_HANDLE_P(dim), Z_RES_HANDLE_P(dim));
+ hval = Z_RES_HANDLE_P(dim);
+ goto num_index;
+ case IS_FALSE:
+ hval = 0;
+ goto num_index;
+ case IS_TRUE:
+ hval = 1;
+ goto num_index;
+ default:
+ zend_type_error("Illegal offset type");
+ ZVAL_NULL(result);
+ return;
+ }
+
+str_index:
+ retval = zend_hash_find(ht, offset_key);
+ if (retval) {
+ /* support for $GLOBALS[...] */
+ if (UNEXPECTED(Z_TYPE_P(retval) == IS_INDIRECT)) {
+ retval = Z_INDIRECT_P(retval);
+ if (UNEXPECTED(Z_TYPE_P(retval) == IS_UNDEF)) {
+ ZVAL_NULL(result);
+ return;
+ }
+ }
+ } else {
+ ZVAL_NULL(result);
+ return;
+ }
+ ZVAL_COPY_DEREF(result, retval);
+ return;
+
+num_index:
+ ZEND_HASH_INDEX_FIND(ht, hval, retval, num_undef);
+ ZVAL_COPY_DEREF(result, retval);
+ return;
+
+num_undef:
+ ZVAL_NULL(result);
+}
+
+static int ZEND_FASTCALL zend_jit_fetch_dim_isset_helper(zend_array *ht, zval *dim)
+{
+ zend_long hval;
+ zend_string *offset_key;
+ zval *retval;
+
+ if (Z_TYPE_P(dim) == IS_REFERENCE) {
+ dim = Z_REFVAL_P(dim);
+ }
+
+ switch (Z_TYPE_P(dim)) {
+ case IS_LONG:
+ hval = Z_LVAL_P(dim);
+ goto num_index;
+ case IS_STRING:
+ offset_key = Z_STR_P(dim);
+ goto str_index;
+ case IS_UNDEF:
+ zend_jit_undefined_op_helper(EG(current_execute_data)->opline->op2.var);
+ /* break missing intentionally */
+ case IS_NULL:
+ offset_key = ZSTR_EMPTY_ALLOC();
+ goto str_index;
+ case IS_DOUBLE:
+ hval = zend_dval_to_lval(Z_DVAL_P(dim));
+ goto num_index;
+ case IS_RESOURCE:
+ zend_error(E_WARNING, "Resource ID#%d used as offset, casting to integer (%d)", Z_RES_HANDLE_P(dim), Z_RES_HANDLE_P(dim));
+ hval = Z_RES_HANDLE_P(dim);
+ goto num_index;
+ case IS_FALSE:
+ hval = 0;
+ goto num_index;
+ case IS_TRUE:
+ hval = 1;
+ goto num_index;
+ default:
+ zend_type_error("Illegal offset type in isset or empty");
+ return 0;
+ }
+
+str_index:
+ retval = zend_hash_find(ht, offset_key);
+ if (retval) {
+ /* support for $GLOBALS[...] */
+ if (UNEXPECTED(Z_TYPE_P(retval) == IS_INDIRECT)) {
+ retval = Z_INDIRECT_P(retval);
+ }
+ if (UNEXPECTED(Z_TYPE_P(retval) == IS_REFERENCE)) {
+ retval = Z_REFVAL_P(retval);
+ }
+ return (Z_TYPE_P(retval) > IS_NULL);
+ } else {
+ return 0;
+ }
+
+num_index:
+ ZEND_HASH_INDEX_FIND(ht, hval, retval, num_undef);
+ if (UNEXPECTED(Z_TYPE_P(retval) == IS_REFERENCE)) {
+ retval = Z_REFVAL_P(retval);
+ }
+ return (Z_TYPE_P(retval) > IS_NULL);
+
+num_undef:
+ return 0;
+}
+
+static zval* ZEND_FASTCALL zend_jit_fetch_dim_rw_helper(zend_array *ht, zval *dim)
+{
+ zend_long hval;
+ zend_string *offset_key;
+ zval *retval;
+
+ if (Z_TYPE_P(dim) == IS_REFERENCE) {
+ dim = Z_REFVAL_P(dim);
+ }
+
+ switch (Z_TYPE_P(dim)) {
+ case IS_LONG:
+ hval = Z_LVAL_P(dim);
+ goto num_index;
+ case IS_STRING:
+ offset_key = Z_STR_P(dim);
+ goto str_index;
+ case IS_UNDEF:
+ zend_jit_undefined_op_helper(EG(current_execute_data)->opline->op2.var);
+ /* break missing intentionally */
+ case IS_NULL:
+ offset_key = ZSTR_EMPTY_ALLOC();
+ goto str_index;
+ case IS_DOUBLE:
+ hval = zend_dval_to_lval(Z_DVAL_P(dim));
+ goto num_index;
+ case IS_RESOURCE:
+ zend_error(E_WARNING, "Resource ID#%d used as offset, casting to integer (%d)", Z_RES_HANDLE_P(dim), Z_RES_HANDLE_P(dim));
+ hval = Z_RES_HANDLE_P(dim);
+ goto num_index;
+ case IS_FALSE:
+ hval = 0;
+ goto num_index;
+ case IS_TRUE:
+ hval = 1;
+ goto num_index;
+ default:
+ zend_type_error("Illegal offset type");
+ undef_result_after_exception();
+ return NULL;
+ }
+
+str_index:
+ retval = zend_hash_find(ht, offset_key);
+ if (retval) {
+ /* support for $GLOBALS[...] */
+ if (UNEXPECTED(Z_TYPE_P(retval) == IS_INDIRECT)) {
+ retval = Z_INDIRECT_P(retval);
+ if (UNEXPECTED(Z_TYPE_P(retval) == IS_UNDEF)) {
+ zend_error(E_NOTICE, "Undefined index: %s", ZSTR_VAL(offset_key));
+ ZVAL_NULL(retval);
+ }
+ }
+ } else {
+ zend_error(E_NOTICE, "Undefined index: %s", ZSTR_VAL(offset_key));
+ retval = zend_hash_update(ht, offset_key, &EG(uninitialized_zval));
+ }
+ return retval;
+
+num_index:
+ ZEND_HASH_INDEX_FIND(ht, hval, retval, num_undef);
+ return retval;
+
+num_undef:
+ zend_error(E_NOTICE,"Undefined offset: " ZEND_LONG_FMT, hval);
+ retval = zend_hash_index_update(ht, hval, &EG(uninitialized_zval));
+ return retval;
+}
+
+static zval* ZEND_FASTCALL zend_jit_fetch_dim_w_helper(zend_array *ht, zval *dim)
+{
+ zend_long hval;
+ zend_string *offset_key;
+ zval *retval;
+
+ if (Z_TYPE_P(dim) == IS_REFERENCE) {
+ dim = Z_REFVAL_P(dim);
+ }
+
+ switch (Z_TYPE_P(dim)) {
+ case IS_LONG:
+ hval = Z_LVAL_P(dim);
+ goto num_index;
+ case IS_STRING:
+ offset_key = Z_STR_P(dim);
+ goto str_index;
+ case IS_UNDEF:
+ zend_jit_undefined_op_helper(EG(current_execute_data)->opline->op2.var);
+ /* break missing intentionally */
+ case IS_NULL:
+ offset_key = ZSTR_EMPTY_ALLOC();
+ goto str_index;
+ case IS_DOUBLE:
+ hval = zend_dval_to_lval(Z_DVAL_P(dim));
+ goto num_index;
+ case IS_RESOURCE:
+ zend_error(E_WARNING, "Resource ID#%d used as offset, casting to integer (%d)", Z_RES_HANDLE_P(dim), Z_RES_HANDLE_P(dim));
+ hval = Z_RES_HANDLE_P(dim);
+ goto num_index;
+ case IS_FALSE:
+ hval = 0;
+ goto num_index;
+ case IS_TRUE:
+ hval = 1;
+ goto num_index;
+ default:
+ zend_type_error("Illegal offset type");
+ undef_result_after_exception();
+ return NULL;
+ }
+
+str_index:
+ retval = zend_hash_find(ht, offset_key);
+ if (retval) {
+ /* support for $GLOBALS[...] */
+ if (UNEXPECTED(Z_TYPE_P(retval) == IS_INDIRECT)) {
+ retval = Z_INDIRECT_P(retval);
+ if (UNEXPECTED(Z_TYPE_P(retval) == IS_UNDEF)) {
+ ZVAL_NULL(retval);
+ }
+ }
+ } else {
+ retval = zend_hash_add_new(ht, offset_key, &EG(uninitialized_zval));
+ }
+ return retval;
+
+num_index:
+ ZEND_HASH_INDEX_FIND(ht, hval, retval, num_undef);
+ return retval;
+
+num_undef:
+ retval = zend_hash_index_add_new(ht, hval, &EG(uninitialized_zval));
+ return retval;
+}
+
+static void ZEND_FASTCALL zend_jit_fetch_dim_str_r_helper(zval *container, zval *dim, zval *result)
+{
+ zend_long offset;
+
+try_string_offset:
+ if (UNEXPECTED(Z_TYPE_P(dim) != IS_LONG)) {
+ switch (Z_TYPE_P(dim)) {
+ /* case IS_LONG: */
+ case IS_STRING:
+ if (IS_LONG == is_numeric_string(Z_STRVAL_P(dim), Z_STRLEN_P(dim), NULL, NULL, -1)) {
+ break;
+ }
+ zend_error(E_WARNING, "Illegal string offset '%s'", Z_STRVAL_P(dim));
+ break;
+ case IS_UNDEF:
+ zend_jit_undefined_op_helper(EG(current_execute_data)->opline->op2.var);
+ case IS_DOUBLE:
+ case IS_NULL:
+ case IS_FALSE:
+ case IS_TRUE:
+ zend_error(E_WARNING, "String offset cast occurred");
+ break;
+ case IS_REFERENCE:
+ dim = Z_REFVAL_P(dim);
+ goto try_string_offset;
+ default:
+ zend_type_error("Illegal offset type");
+ break;
+ }
+
+ offset = _zval_get_long_func(dim);
+ } else {
+ offset = Z_LVAL_P(dim);
+ }
+
+ if (UNEXPECTED(Z_STRLEN_P(container) < ((offset < 0) ? -(size_t)offset : ((size_t)offset + 1)))) {
+ zend_error(E_WARNING, "Uninitialized string offset: " ZEND_LONG_FMT, offset);
+ ZVAL_EMPTY_STRING(result);
+ } else {
+ zend_uchar c;
+ zend_long real_offset;
+
+ real_offset = (UNEXPECTED(offset < 0)) /* Handle negative offset */
+ ? (zend_long)Z_STRLEN_P(container) + offset : offset;
+ c = (zend_uchar)Z_STRVAL_P(container)[real_offset];
+ ZVAL_INTERNED_STR(result, ZSTR_CHAR(c));
+ }
+}
+
+static void ZEND_FASTCALL zend_jit_fetch_dim_str_is_helper(zval *container, zval *dim, zval *result)
+{
+ zend_long offset;
+
+try_string_offset:
+ if (UNEXPECTED(Z_TYPE_P(dim) != IS_LONG)) {
+ switch (Z_TYPE_P(dim)) {
+ /* case IS_LONG: */
+ case IS_STRING:
+ if (IS_LONG == is_numeric_string(Z_STRVAL_P(dim), Z_STRLEN_P(dim), NULL, NULL, -1)) {
+ break;
+ }
+ ZVAL_NULL(result);
+ return;
+ case IS_UNDEF:
+ zend_jit_undefined_op_helper(EG(current_execute_data)->opline->op2.var);
+ case IS_DOUBLE:
+ case IS_NULL:
+ case IS_FALSE:
+ case IS_TRUE:
+ break;
+ case IS_REFERENCE:
+ dim = Z_REFVAL_P(dim);
+ goto try_string_offset;
+ default:
+ zend_type_error("Illegal offset type");
+ break;
+ }
+
+ offset = _zval_get_long_func(dim);
+ } else {
+ offset = Z_LVAL_P(dim);
+ }
+
+ if (UNEXPECTED(Z_STRLEN_P(container) < ((offset < 0) ? -(size_t)offset : ((size_t)offset + 1)))) {
+ ZVAL_NULL(result);
+ } else {
+ zend_uchar c;
+ zend_long real_offset;
+
+ real_offset = (UNEXPECTED(offset < 0)) /* Handle negative offset */
+ ? (zend_long)Z_STRLEN_P(container) + offset : offset;
+ c = (zend_uchar)Z_STRVAL_P(container)[real_offset];
+ ZVAL_INTERNED_STR(result, ZSTR_CHAR(c));
+ }
+}
+
+static void ZEND_FASTCALL zend_jit_fetch_dim_obj_r_helper(zval *container, zval *dim, zval *result)
+{
+ zval *retval;
+
+ if (UNEXPECTED(Z_TYPE_P(dim) == IS_UNDEF)) {
+ zend_jit_undefined_op_helper(EG(current_execute_data)->opline->op2.var);
+ dim = &EG(uninitialized_zval);
+ }
+
+ retval = Z_OBJ_HT_P(container)->read_dimension(Z_OBJ_P(container), dim, BP_VAR_R, result);
+
+ if (retval) {
+ if (result != retval) {
+ ZVAL_COPY_DEREF(result, retval);
+ } else if (UNEXPECTED(Z_ISREF_P(retval))) {
+ zend_unwrap_reference(retval);
+ }
+ } else {
+ ZVAL_NULL(result);
+ }
+}
+
+static void ZEND_FASTCALL zend_jit_fetch_dim_obj_is_helper(zval *container, zval *dim, zval *result)
+{
+ zval *retval;
+
+ if (UNEXPECTED(Z_TYPE_P(dim) == IS_UNDEF)) {
+ zend_jit_undefined_op_helper(EG(current_execute_data)->opline->op2.var);
+ dim = &EG(uninitialized_zval);
+ }
+
+ retval = Z_OBJ_HT_P(container)->read_dimension(Z_OBJ_P(container), dim, BP_VAR_IS, result);
+
+ if (retval) {
+ if (result != retval) {
+ ZVAL_COPY_DEREF(result, retval);
+ } else if (UNEXPECTED(Z_ISREF_P(retval))) {
+ zend_unwrap_reference(result);
+ }
+ } else {
+ ZVAL_NULL(result);
+ }
+}
+
+static zval* ZEND_FASTCALL zend_jit_fetch_dimension_rw_long_helper(HashTable *ht, zend_long hval)
+{
+ zend_error(E_NOTICE,"Undefined offset: " ZEND_LONG_FMT, hval);
+ return zend_hash_index_update(ht, hval, &EG(uninitialized_zval));
+}
+
+static zend_never_inline zend_long zend_check_string_offset(zval *dim, int type)
+{
+ zend_long offset;
+
+try_again:
+ if (UNEXPECTED(Z_TYPE_P(dim) != IS_LONG)) {
+ switch(Z_TYPE_P(dim)) {
+ case IS_STRING:
+ if (IS_LONG == is_numeric_string(Z_STRVAL_P(dim), Z_STRLEN_P(dim), NULL, NULL, -1)) {
+ break;
+ }
+ if (type != BP_VAR_UNSET) {
+ zend_error(E_WARNING, "Illegal string offset '%s'", Z_STRVAL_P(dim));
+ }
+ break;
+ case IS_UNDEF:
+ zend_jit_undefined_op_helper(EG(current_execute_data)->opline->op2.var);
+ case IS_DOUBLE:
+ case IS_NULL:
+ case IS_FALSE:
+ case IS_TRUE:
+ zend_error(E_WARNING, "String offset cast occurred");
+ break;
+ case IS_REFERENCE:
+ dim = Z_REFVAL_P(dim);
+ goto try_again;
+ default:
+ zend_type_error("Illegal offset type");
+ break;
+ }
+
+ offset = _zval_get_long_func(dim);
+ } else {
+ offset = Z_LVAL_P(dim);
+ }
+
+ return offset;
+}
+
+static zend_never_inline ZEND_COLD void zend_wrong_string_offset(void)
+{
+ const char *msg = NULL;
+ const zend_op *opline = EG(current_execute_data)->opline;
+ const zend_op *end;
+ uint32_t var;
+
+ switch (opline->opcode) {
+ case ZEND_ASSIGN_OP:
+ case ZEND_ASSIGN_DIM_OP:
+ case ZEND_ASSIGN_OBJ_OP:
+ case ZEND_ASSIGN_STATIC_PROP_OP:
+ msg = "Cannot use assign-op operators with string offsets";
+ break;
+ case ZEND_FETCH_DIM_W:
+ case ZEND_FETCH_DIM_RW:
+ case ZEND_FETCH_DIM_FUNC_ARG:
+ case ZEND_FETCH_DIM_UNSET:
+ /* TODO: Encode the "reason" into opline->extended_value??? */
+ var = opline->result.var;
+ opline++;
+ end = EG(current_execute_data)->func->op_array.opcodes +
+ EG(current_execute_data)->func->op_array.last;
+ while (opline < end) {
+ if (opline->op1_type == IS_VAR && opline->op1.var == var) {
+ switch (opline->opcode) {
+ case ZEND_ASSIGN_OBJ_OP:
+ msg = "Cannot use string offset as an object";
+ break;
+ case ZEND_ASSIGN_DIM_OP:
+ msg = "Cannot use string offset as an array";
+ break;
+ case ZEND_ASSIGN_OP:
+ case ZEND_ASSIGN_STATIC_PROP_OP:
+ msg = "Cannot use assign-op operators with string offsets";
+ break;
+ case ZEND_PRE_INC_OBJ:
+ case ZEND_PRE_DEC_OBJ:
+ case ZEND_POST_INC_OBJ:
+ case ZEND_POST_DEC_OBJ:
+ case ZEND_PRE_INC:
+ case ZEND_PRE_DEC:
+ case ZEND_POST_INC:
+ case ZEND_POST_DEC:
+ msg = "Cannot increment/decrement string offsets";
+ break;
+ case ZEND_FETCH_DIM_W:
+ case ZEND_FETCH_DIM_RW:
+ case ZEND_FETCH_DIM_FUNC_ARG:
+ case ZEND_FETCH_DIM_UNSET:
+ case ZEND_ASSIGN_DIM:
+ msg = "Cannot use string offset as an array";
+ break;
+ case ZEND_FETCH_OBJ_W:
+ case ZEND_FETCH_OBJ_RW:
+ case ZEND_FETCH_OBJ_FUNC_ARG:
+ case ZEND_FETCH_OBJ_UNSET:
+ case ZEND_ASSIGN_OBJ:
+ msg = "Cannot use string offset as an object";
+ break;
+ case ZEND_ASSIGN_REF:
+ case ZEND_ADD_ARRAY_ELEMENT:
+ case ZEND_INIT_ARRAY:
+ case ZEND_MAKE_REF:
+ msg = "Cannot create references to/from string offsets";
+ break;
+ case ZEND_RETURN_BY_REF:
+ case ZEND_VERIFY_RETURN_TYPE:
+ msg = "Cannot return string offsets by reference";
+ break;
+ case ZEND_UNSET_DIM:
+ case ZEND_UNSET_OBJ:
+ msg = "Cannot unset string offsets";
+ break;
+ case ZEND_YIELD:
+ msg = "Cannot yield string offsets by reference";
+ break;
+ case ZEND_SEND_REF:
+ case ZEND_SEND_VAR_EX:
+ case ZEND_SEND_FUNC_ARG:
+ msg = "Only variables can be passed by reference";
+ break;
+ EMPTY_SWITCH_DEFAULT_CASE();
+ }
+ break;
+ }
+ if (opline->op2_type == IS_VAR && opline->op2.var == var) {
+ ZEND_ASSERT(opline->opcode == ZEND_ASSIGN_REF);
+ msg = "Cannot create references to/from string offsets";
+ break;
+ }
+ }
+ break;
+ EMPTY_SWITCH_DEFAULT_CASE();
+ }
+ ZEND_ASSERT(msg != NULL);
+ zend_throw_error(NULL, "%s", msg);
+}
+
+static zend_never_inline void zend_assign_to_string_offset(zval *str, zval *dim, zval *value, zval *result)
+{
+ zend_string *old_str;
+ zend_uchar c;
+ size_t string_len;
+ zend_long offset;
+
+ offset = zend_check_string_offset(dim, BP_VAR_W);
+ if (offset < -(zend_long)Z_STRLEN_P(str)) {
+ /* Error on negative offset */
+ zend_error(E_WARNING, "Illegal string offset: " ZEND_LONG_FMT, offset);
+ if (result) {
+ ZVAL_NULL(result);
+ }
+ return;
+ }
+
+ if (Z_TYPE_P(value) != IS_STRING) {
+ /* Convert to string, just the time to pick the 1st byte */
+ zend_string *tmp = zval_try_get_string_func(value);
+
+ if (UNEXPECTED(!tmp)) {
+ if (result) {
+ ZVAL_UNDEF(result);
+ }
+ return;
+ }
+
+ string_len = ZSTR_LEN(tmp);
+ c = (zend_uchar)ZSTR_VAL(tmp)[0];
+ zend_string_release(tmp);
+ } else {
+ string_len = Z_STRLEN_P(value);
+ c = (zend_uchar)Z_STRVAL_P(value)[0];
+ }
+
+
+ if (string_len != 1) {
+ if (string_len == 0) {
+ /* Error on empty input string */
+ zend_throw_error(NULL, "Cannot assign an empty string to a string offset");
+ if (result) {
+ ZVAL_NULL(result);
+ }
+ return;
+ }
+
+ zend_error(E_WARNING, "Only the first byte will be assigned to the string offset");
+ }
+
+ if (offset < 0) { /* Handle negative offset */
+ offset += (zend_long)Z_STRLEN_P(str);
+ }
+
+ if ((size_t)offset >= Z_STRLEN_P(str)) {
+ /* Extend string if needed */
+ zend_long old_len = Z_STRLEN_P(str);
+ Z_STR_P(str) = zend_string_extend(Z_STR_P(str), offset + 1, 0);
+ Z_TYPE_INFO_P(str) = IS_STRING_EX;
+ memset(Z_STRVAL_P(str) + old_len, ' ', offset - old_len);
+ Z_STRVAL_P(str)[offset+1] = 0;
+ } else if (!Z_REFCOUNTED_P(str)) {
+ old_str = Z_STR_P(str);
+ Z_STR_P(str) = zend_string_init(Z_STRVAL_P(str), Z_STRLEN_P(str), 0);
+ Z_TYPE_INFO_P(str) = IS_STRING_EX;
+ zend_string_release(old_str);
+ } else {
+ SEPARATE_STRING(str);
+ zend_string_forget_hash_val(Z_STR_P(str));
+ }
+
+ Z_STRVAL_P(str)[offset] = c;
+
+ if (result) {
+ /* Return the new character */
+ ZVAL_INTERNED_STR(result, ZSTR_CHAR(c));
+ }
+}
+
+static void ZEND_FASTCALL zend_jit_assign_dim_helper(zval *object_ptr, zval *dim, zval *value, zval *result)
+{
+ if (EXPECTED(Z_TYPE_P(object_ptr) == IS_OBJECT)) {
+ ZVAL_DEREF(value);
+ Z_OBJ_HT_P(object_ptr)->write_dimension(Z_OBJ_P(object_ptr), dim, value);
+ if (result) {
+ if (EXPECTED(!EG(exception))) {
+ ZVAL_COPY(result, value);
+ } else {
+ ZVAL_UNDEF(result);
+ }
+ }
+ } else if (EXPECTED(Z_TYPE_P(object_ptr) == IS_STRING)) {
+ if (!dim) {
+ zend_throw_error(NULL, "[] operator not supported for strings");
+ if (result) {
+ ZVAL_UNDEF(result);
+ }
+ } else {
+ zend_assign_to_string_offset(object_ptr, dim, value, result);
+ }
+ } else {
+ zend_throw_error(NULL, "Cannot use a scalar value as an array");
+ if (result) {
+ ZVAL_UNDEF(result);
+ }
+ }
+}
+
+static void ZEND_FASTCALL zend_jit_assign_dim_op_helper(zval *container, zval *dim, zval *value, binary_op_type binary_op)
+{
+ if (EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ zval *object = container;
+ zval *property = dim;
+ zval *z;
+ zval rv, res;
+
+ z = Z_OBJ_HT_P(object)->read_dimension(Z_OBJ_P(object), property, BP_VAR_R, &rv);
+ if (z != NULL) {
+
+ if (binary_op(&res, Z_ISREF_P(z) ? Z_REFVAL_P(z) : z, value) == SUCCESS) {
+ Z_OBJ_HT_P(object)->write_dimension(Z_OBJ_P(object), property, &res);
+ }
+ if (z == &rv) {
+ zval_ptr_dtor(&rv);
+ }
+//??? if (retval) {
+//??? ZVAL_COPY(retval, &res);
+//??? }
+ zval_ptr_dtor(&res);
+ } else {
+ zend_error(E_WARNING, "Attempt to assign property of non-object");
+//??? if (retval) {
+//??? ZVAL_NULL(retval);
+//??? }
+ }
+ } else {
+ if (UNEXPECTED(Z_TYPE_P(container) == IS_STRING)) {
+ if (!dim) {
+ zend_throw_error(NULL, "[] operator not supported for strings");
+ } else {
+ zend_check_string_offset(dim, BP_VAR_RW);
+ zend_wrong_string_offset();
+ }
+//??? } else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
+//??? ZEND_VM_C_GOTO(assign_dim_op_convert_to_array);
+ } else {
+ zend_throw_error(NULL, "Cannot use a scalar value as an array");
+//??? if (retval) {
+//??? ZVAL_NULL(retval);
+//??? }
+ }
+ }
+}
+
+static void ZEND_FASTCALL zend_jit_fast_assign_concat_helper(zval *op1, zval *op2)
+{
+ size_t op1_len = Z_STRLEN_P(op1);
+ size_t op2_len = Z_STRLEN_P(op2);
+ size_t result_len = op1_len + op2_len;
+ zend_string *result_str;
+
+ if (UNEXPECTED(op1_len > SIZE_MAX - op2_len)) {
+ zend_throw_error(NULL, "String size overflow");
+ return;
+ }
+
+ if (Z_REFCOUNTED_P(op1)) {
+ result_str = zend_string_extend(Z_STR_P(op1), result_len, 0);
+ } else {
+ result_str = zend_string_alloc(result_len, 0);
+ memcpy(ZSTR_VAL(result_str), Z_STRVAL_P(op1), op1_len);
+ }
+
+ ZVAL_NEW_STR(op1, result_str);
+
+ memcpy(ZSTR_VAL(result_str) + op1_len, Z_STRVAL_P(op2), op2_len);
+ ZSTR_VAL(result_str)[result_len] = '\0';
+}
+
+static void ZEND_FASTCALL zend_jit_fast_concat_helper(zval *result, zval *op1, zval *op2)
+{
+ size_t op1_len = Z_STRLEN_P(op1);
+ size_t op2_len = Z_STRLEN_P(op2);
+ size_t result_len = op1_len + op2_len;
+ zend_string *result_str;
+
+ if (UNEXPECTED(op1_len > SIZE_MAX - op2_len)) {
+ zend_throw_error(NULL, "String size overflow");
+ return;
+ }
+
+ result_str = zend_string_alloc(result_len, 0);
+ memcpy(ZSTR_VAL(result_str), Z_STRVAL_P(op1), op1_len);
+
+ ZVAL_NEW_STR(result, result_str);
+
+ memcpy(ZSTR_VAL(result_str) + op1_len, Z_STRVAL_P(op2), op2_len);
+ ZSTR_VAL(result_str)[result_len] = '\0';
+}
+
+static int ZEND_FASTCALL zend_jit_isset_dim_helper(zval *container, zval *offset)
+{
+ if (UNEXPECTED(Z_TYPE_P(offset) == IS_UNDEF)) {
+ zend_jit_undefined_op_helper(EG(current_execute_data)->opline->op2.var);
+ offset = &EG(uninitialized_zval);
+ }
+
+ if (EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+ return Z_OBJ_HT_P(container)->has_dimension(Z_OBJ_P(container), offset, 0);
+ } else if (EXPECTED(Z_TYPE_P(container) == IS_STRING)) { /* string offsets */
+ zend_long lval;
+
+ if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
+ lval = Z_LVAL_P(offset);
+isset_str_offset:
+ if (UNEXPECTED(lval < 0)) { /* Handle negative offset */
+ lval += (zend_long)Z_STRLEN_P(container);
+ }
+ if (EXPECTED(lval >= 0) && (size_t)lval < Z_STRLEN_P(container)) {
+ return 1;
+ }
+ } else {
+ ZVAL_DEREF(offset);
+ if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */
+ || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
+ && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
+ lval = zval_get_long(offset);
+ goto isset_str_offset;
+ }
+ }
+ }
+ return 0;
+}
+
+static void ZEND_FASTCALL zend_jit_free_call_frame(zend_execute_data *call)
+{
+ zend_vm_stack_free_call_frame(call);
+}
+
+static zval* ZEND_FASTCALL zend_jit_new_ref_helper(zval *value)
+{
+ zend_reference *ref = (zend_reference*)emalloc(sizeof(zend_reference));
+ GC_SET_REFCOUNT(ref, 1);
+ GC_TYPE_INFO(ref) = IS_REFERENCE;
+ ref->sources.ptr = NULL;
+ ZVAL_COPY_VALUE(&ref->val, value);
+ Z_REF_P(value) = ref;
+ Z_TYPE_INFO_P(value) = IS_REFERENCE_EX;
+
+ return value;
+}
+
+static zval* ZEND_FASTCALL zend_jit_fetch_global_helper(zend_execute_data *execute_data, zval *varname, uint32_t cache_slot)
+{
+ uint32_t idx;
+ zval *value = zend_hash_find(&EG(symbol_table), Z_STR_P(varname));
+
+ if (UNEXPECTED(value == NULL)) {
+ value = zend_hash_add_new(&EG(symbol_table), Z_STR_P(varname), &EG(uninitialized_zval));
+ idx = (char*)value - (char*)EG(symbol_table).arData;
+ /* Store "hash slot index" + 1 (NULL is a mark of uninitialized cache slot) */
+ CACHE_PTR(cache_slot, (void*)(uintptr_t)(idx + 1));
+ } else {
+ idx = (char*)value - (char*)EG(symbol_table).arData;
+ /* Store "hash slot index" + 1 (NULL is a mark of uninitialized cache slot) */
+ CACHE_PTR(cache_slot, (void*)(uintptr_t)(idx + 1));
+ /* GLOBAL variable may be an INDIRECT pointer to CV */
+ if (UNEXPECTED(Z_TYPE_P(value) == IS_INDIRECT)) {
+ value = Z_INDIRECT_P(value);
+ if (UNEXPECTED(Z_TYPE_P(value) == IS_UNDEF)) {
+ ZVAL_NULL(value);
+ }
+ }
+ }
+
+ if (UNEXPECTED(!Z_ISREF_P(value))) {
+ return zend_jit_new_ref_helper(value);
+ }
+
+ return value;
+}
+
+static zend_always_inline zend_bool zend_jit_verify_type_common(zval *arg, const zend_op_array *op_array, zend_arg_info *arg_info, void **cache_slot)
+{
+ uint32_t type_mask;
+
+ if (ZEND_TYPE_HAS_CLASS(arg_info->type) && Z_TYPE_P(arg) == IS_OBJECT) {
+ zend_class_entry *ce;
+ if (ZEND_TYPE_HAS_LIST(arg_info->type)) {
+ zend_type *list_type;
+ ZEND_TYPE_LIST_FOREACH(ZEND_TYPE_LIST(arg_info->type), list_type) {
+ if (*cache_slot) {
+ ce = *cache_slot;
+ } else {
+ ce = zend_fetch_class(ZEND_TYPE_NAME(*list_type),
+ (ZEND_FETCH_CLASS_AUTO | ZEND_FETCH_CLASS_NO_AUTOLOAD));
+ if (!ce) {
+ cache_slot++;
+ continue;
+ }
+ *cache_slot = ce;
+ }
+ if (instanceof_function(Z_OBJCE_P(arg), ce)) {
+ return 1;
+ }
+ cache_slot++;
+ } ZEND_TYPE_LIST_FOREACH_END();
+ } else {
+ if (EXPECTED(*cache_slot)) {
+ ce = (zend_class_entry *) *cache_slot;
+ } else {
+ ce = zend_fetch_class(ZEND_TYPE_NAME(arg_info->type), (ZEND_FETCH_CLASS_AUTO | ZEND_FETCH_CLASS_NO_AUTOLOAD));
+ if (UNEXPECTED(!ce)) {
+ goto builtin_types;
+ }
+ *cache_slot = (void *) ce;
+ }
+ if (instanceof_function(Z_OBJCE_P(arg), ce)) {
+ return 1;
+ }
+ }
+ }
+
+builtin_types:
+ type_mask = ZEND_TYPE_FULL_MASK(arg_info->type);
+ if ((type_mask & MAY_BE_CALLABLE) && zend_is_callable(arg, IS_CALLABLE_CHECK_SILENT, NULL)) {
+ return 1;
+ }
+ if ((type_mask & MAY_BE_ITERABLE) && zend_is_iterable(arg)) {
+ return 1;
+ }
+ if (zend_verify_scalar_type_hint(type_mask, arg, ZEND_ARG_USES_STRICT_TYPES(), /* is_internal */ 0)) {
+ return 1;
+ }
+ return 0;
+}
+
+static void ZEND_FASTCALL zend_jit_verify_arg_slow(zval *arg, const zend_op_array *op_array, uint32_t arg_num, zend_arg_info *arg_info, void **cache_slot)
+{
+ if (UNEXPECTED(!zend_jit_verify_type_common(arg, op_array, arg_info, cache_slot))) {
+ zend_verify_arg_error((zend_function*)op_array, arg_info, arg_num, cache_slot, arg);
+ }
+}
+
+static void ZEND_FASTCALL zend_jit_verify_return_slow(zval *arg, const zend_op_array *op_array, zend_arg_info *arg_info, void **cache_slot)
+{
+ if (UNEXPECTED(!zend_jit_verify_type_common(arg, op_array, arg_info, cache_slot))) {
+ zend_verify_return_error((zend_function*)op_array, cache_slot, arg);
+ }
+}
+
+static void ZEND_FASTCALL zend_jit_zval_copy_deref_helper(zval *dst, zval *src)
+{
+ ZVAL_DEREF(src);
+ ZVAL_COPY(dst, src);
+}
+
+static void ZEND_FASTCALL zend_jit_fetch_obj_r_slow(zend_object *zobj, zval *offset, zval *result, uint32_t cache_slot)
+{
+ zval *retval;
+ zend_execute_data *execute_data = EG(current_execute_data);
+ zend_string *name, *tmp_name;
+
+ name = zval_get_tmp_string(offset, &tmp_name);
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_R, CACHE_ADDR(cache_slot), result);
+ zend_tmp_string_release(tmp_name);
+ if (retval != result) {
+ ZVAL_COPY_DEREF(result, retval);
+ } else if (UNEXPECTED(Z_ISREF_P(retval))) {
+ zend_unwrap_reference(retval);
+ }
+}
+
+static void ZEND_FASTCALL zend_jit_fetch_obj_r_dynamic(zend_object *zobj, intptr_t prop_offset, zval *offset, zval *result, uint32_t cache_slot)
+{
+ if (zobj->properties) {
+ zval *retval;
+
+ if (!IS_UNKNOWN_DYNAMIC_PROPERTY_OFFSET(prop_offset)) {
+ intptr_t idx = ZEND_DECODE_DYN_PROP_OFFSET(prop_offset);
+
+ if (EXPECTED(idx < zobj->properties->nNumUsed * sizeof(Bucket))) {
+ Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
+
+ if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
+ (EXPECTED(p->key == Z_STR_P(offset)) ||
+ (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ EXPECTED(p->key != NULL) &&
+ EXPECTED(ZSTR_LEN(p->key) == Z_STRLEN_P(offset)) &&
+ EXPECTED(memcmp(ZSTR_VAL(p->key), Z_STRVAL_P(offset), Z_STRLEN_P(offset)) == 0)))) {
+ ZVAL_COPY_DEREF(result, &p->val);
+ return;
+ }
+ }
+ CACHE_PTR_EX((void**)((char*)EG(current_execute_data)->run_time_cache + cache_slot) + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
+ }
+
+ retval = zend_hash_find(zobj->properties, Z_STR_P(offset));
+
+ if (EXPECTED(retval)) {
+ intptr_t idx = (char*)retval - (char*)zobj->properties->arData;
+ CACHE_PTR_EX((void**)((char*)EG(current_execute_data)->run_time_cache + cache_slot) + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
+ ZVAL_COPY_DEREF(result, retval);
+ return;
+ }
+ }
+ zend_jit_fetch_obj_r_slow(zobj, offset, result, cache_slot);
+}
+
+static void ZEND_FASTCALL zend_jit_fetch_obj_is_slow(zend_object *zobj, zval *offset, zval *result, uint32_t cache_slot)
+{
+ zval *retval;
+ zend_execute_data *execute_data = EG(current_execute_data);
+ zend_string *name, *tmp_name;
+
+ name = zval_get_tmp_string(offset, &tmp_name);
+ retval = zobj->handlers->read_property(zobj, name, BP_VAR_IS, CACHE_ADDR(cache_slot), result);
+ zend_tmp_string_release(tmp_name);
+ if (retval != result) {
+ ZVAL_COPY_DEREF(result, retval);
+ } else if (UNEXPECTED(Z_ISREF_P(retval))) {
+ zend_unwrap_reference(retval);
+ }
+}
+
+static void ZEND_FASTCALL zend_jit_fetch_obj_is_dynamic(zend_object *zobj, intptr_t prop_offset, zval *offset, zval *result, uint32_t cache_slot)
+{
+ if (zobj->properties) {
+ zval *retval;
+
+ if (!IS_UNKNOWN_DYNAMIC_PROPERTY_OFFSET(prop_offset)) {
+ intptr_t idx = ZEND_DECODE_DYN_PROP_OFFSET(prop_offset);
+
+ if (EXPECTED(idx < zobj->properties->nNumUsed * sizeof(Bucket))) {
+ Bucket *p = (Bucket*)((char*)zobj->properties->arData + idx);
+
+ if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
+ (EXPECTED(p->key == Z_STR_P(offset)) ||
+ (EXPECTED(p->h == ZSTR_H(Z_STR_P(offset))) &&
+ EXPECTED(p->key != NULL) &&
+ EXPECTED(ZSTR_LEN(p->key) == Z_STRLEN_P(offset)) &&
+ EXPECTED(memcmp(ZSTR_VAL(p->key), Z_STRVAL_P(offset), Z_STRLEN_P(offset)) == 0)))) {
+ ZVAL_COPY_DEREF(result, &p->val);
+ return;
+ }
+ }
+ CACHE_PTR_EX((void**)((char*)EG(current_execute_data)->run_time_cache + cache_slot) + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
+ }
+
+ retval = zend_hash_find(zobj->properties, Z_STR_P(offset));
+
+ if (EXPECTED(retval)) {
+ intptr_t idx = (char*)retval - (char*)zobj->properties->arData;
+ CACHE_PTR_EX((void**)((char*)EG(current_execute_data)->run_time_cache + cache_slot) + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
+ ZVAL_COPY(result, retval);
+ return;
+ }
+ }
+ zend_jit_fetch_obj_is_slow(zobj, offset, result, cache_slot);
+}
+
+static void ZEND_FASTCALL zend_jit_vm_stack_free_args_helper(zend_execute_data *call)
+{
+ zend_vm_stack_free_args(call);
+}
+
+static zend_always_inline void zend_jit_assign_to_typed_ref(zend_reference *ref, zval *value, zend_uchar value_type)
+{
+ zval variable;
+
+ ZVAL_REF(&variable, ref);
+ zend_assign_to_variable(&variable, value, value_type, ZEND_CALL_USES_STRICT_TYPES(EG(current_execute_data)));
+}
+
+static void ZEND_FASTCALL zend_jit_assign_const_to_typed_ref(zend_reference *ref, zval *value)
+{
+ zend_jit_assign_to_typed_ref(ref, value, IS_CONST);
+}
+
+static void ZEND_FASTCALL zend_jit_assign_tmp_to_typed_ref(zend_reference *ref, zval *value)
+{
+ zend_jit_assign_to_typed_ref(ref, value, IS_TMP_VAR);
+}
+
+static void ZEND_FASTCALL zend_jit_assign_var_to_typed_ref(zend_reference *ref, zval *value)
+{
+ zend_jit_assign_to_typed_ref(ref, value, IS_VAR);
+}
+
+static void ZEND_FASTCALL zend_jit_assign_cv_to_typed_ref(zend_reference *ref, zval *value)
+{
+ zend_jit_assign_to_typed_ref(ref, value, IS_CV);
+}
+
+
+static zend_property_info *zend_jit_get_prop_not_accepting_double(zend_reference *ref)
+{
+ zend_property_info *prop;
+ ZEND_REF_FOREACH_TYPE_SOURCES(ref, prop) {
+ if (!(ZEND_TYPE_FULL_MASK(prop->type) & MAY_BE_DOUBLE)) {
+ return prop;
+ }
+ } ZEND_REF_FOREACH_TYPE_SOURCES_END();
+ return NULL;
+}
+
+static ZEND_COLD void zend_jit_throw_incdec_ref_error(zend_reference *ref, zend_bool inc)
+{
+ zend_property_info *error_prop = zend_jit_get_prop_not_accepting_double(ref);
+ /* Currently there should be no way for a typed reference to accept both int and double.
+ * Generalize this and the related property code once this becomes possible. */
+ ZEND_ASSERT(error_prop);
+ zend_type_error(
+ "Cannot %s a reference held by property %s::$%s of type %sint past its %simal value",
+ inc ? "increment" : "decrement",
+ ZSTR_VAL(error_prop->ce->name),
+ zend_get_unmangled_property_name(error_prop->name),
+ ZEND_TYPE_ALLOW_NULL(error_prop->type) ? "?" : "",
+ inc ? "max" : "min");
+}
+
+static void ZEND_FASTCALL zend_jit_pre_inc_typed_ref(zval *var_ptr, zend_reference *ref, zval *ret)
+{
+ zval tmp;
+
+ ZVAL_COPY(&tmp, var_ptr);
+
+ increment_function(var_ptr);
+
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_DOUBLE) && Z_TYPE(tmp) == IS_LONG) {
+ zend_jit_throw_incdec_ref_error(ref, 1);
+ ZVAL_COPY_VALUE(var_ptr, &tmp);
+ } else if (UNEXPECTED(!zend_verify_ref_assignable_zval(ref, var_ptr, ZEND_CALL_USES_STRICT_TYPES(EG(current_execute_data))))) {
+ zval_ptr_dtor(var_ptr);
+ ZVAL_COPY_VALUE(var_ptr, &tmp);
+ } else {
+ zval_ptr_dtor(&tmp);
+ }
+ if (ret) {
+ ZVAL_COPY(ret, var_ptr);
+ }
+}
+
+static void ZEND_FASTCALL zend_jit_pre_dec_typed_ref(zval *var_ptr, zend_reference *ref, zval *ret)
+{
+ zval tmp;
+
+ ZVAL_COPY(&tmp, var_ptr);
+
+ decrement_function(var_ptr);
+
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_DOUBLE) && Z_TYPE(tmp) == IS_LONG) {
+ zend_jit_throw_incdec_ref_error(ref, 0);
+ ZVAL_COPY_VALUE(var_ptr, &tmp);
+ } else if (UNEXPECTED(!zend_verify_ref_assignable_zval(ref, var_ptr, ZEND_CALL_USES_STRICT_TYPES(EG(current_execute_data))))) {
+ zval_ptr_dtor(var_ptr);
+ ZVAL_COPY_VALUE(var_ptr, &tmp);
+ } else {
+ zval_ptr_dtor(&tmp);
+ }
+ if (ret) {
+ ZVAL_COPY(ret, var_ptr);
+ }
+}
+
+static void ZEND_FASTCALL zend_jit_post_inc_typed_ref(zval *var_ptr, zend_reference *ref, zval *ret)
+{
+ ZVAL_COPY(ret, var_ptr);
+
+ increment_function(var_ptr);
+
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_DOUBLE) && Z_TYPE_P(ret) == IS_LONG) {
+ zend_jit_throw_incdec_ref_error(ref, 1);
+ ZVAL_COPY_VALUE(var_ptr, ret);
+ } else if (UNEXPECTED(!zend_verify_ref_assignable_zval(ref, var_ptr, ZEND_CALL_USES_STRICT_TYPES(EG(current_execute_data))))) {
+ zval_ptr_dtor(var_ptr);
+ ZVAL_COPY_VALUE(var_ptr, ret);
+ }
+}
+
+static void ZEND_FASTCALL zend_jit_post_dec_typed_ref(zval *var_ptr, zend_reference *ref, zval *ret)
+{
+ ZVAL_COPY(ret, var_ptr);
+
+ decrement_function(var_ptr);
+
+ if (UNEXPECTED(Z_TYPE_P(var_ptr) == IS_DOUBLE) && Z_TYPE_P(ret) == IS_LONG) {
+ zend_jit_throw_incdec_ref_error(ref, 0);
+ ZVAL_COPY_VALUE(var_ptr, ret);
+ } else if (UNEXPECTED(!zend_verify_ref_assignable_zval(ref, var_ptr, ZEND_CALL_USES_STRICT_TYPES(EG(current_execute_data))))) {
+ zval_ptr_dtor(var_ptr);
+ ZVAL_COPY_VALUE(var_ptr, ret);
+ }
+}
+
+static void ZEND_FASTCALL zend_jit_assign_op_to_typed_ref(zend_reference *ref, zval *val, binary_op_type binary_op)
+{
+ zval z_copy;
+
+ binary_op(&z_copy, &ref->val, val);
+ if (EXPECTED(zend_verify_ref_assignable_zval(ref, &z_copy, ZEND_CALL_USES_STRICT_TYPES(EG(current_execute_data))))) {
+ zval_ptr_dtor(&ref->val);
+ ZVAL_COPY_VALUE(&ref->val, &z_copy);
+ } else {
+ zval_ptr_dtor(&z_copy);
+ }
+}
+
+static void ZEND_FASTCALL zend_jit_only_vars_by_reference(zval *arg)
+{
+ ZVAL_NEW_REF(arg, arg);
+ zend_error(E_NOTICE, "Only variables should be passed by reference");
+}
+
+static void ZEND_FASTCALL zend_jit_invalid_array_access(zval *container)
+{
+ const char *type = Z_ISUNDEF_P(container) ? "null" : zend_zval_type_name(container);
+ zend_error(E_WARNING, "Trying to access array offset on value of type %s", type);
+}
+
+static zval * ZEND_FASTCALL zend_jit_prepare_assign_dim_ref(zval *ref) {
+ zval *val = Z_REFVAL_P(ref);
+ if (Z_TYPE_P(val) <= IS_FALSE) {
+ if (ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(ref))
+ && !zend_verify_ref_array_assignable(Z_REF_P(ref))) {
+ return NULL;
+ }
+ ZVAL_ARR(val, zend_new_array(8));
+ }
+ return val;
+}
+
+static void ZEND_FASTCALL zend_jit_pre_inc(zval *var_ptr, zval *ret)
+{
+ increment_function(var_ptr);
+ ZVAL_COPY(ret, var_ptr);
+}
+
+static void ZEND_FASTCALL zend_jit_pre_dec(zval *var_ptr, zval *ret)
+{
+ decrement_function(var_ptr);
+ ZVAL_COPY(ret, var_ptr);
+}
diff --git a/ext/opcache/jit/zend_jit_internal.h b/ext/opcache/jit/zend_jit_internal.h
new file mode 100644
index 0000000000..f327fd5128
--- /dev/null
+++ b/ext/opcache/jit/zend_jit_internal.h
@@ -0,0 +1,119 @@
+/*
+ +----------------------------------------------------------------------+
+ | Zend JIT |
+ +----------------------------------------------------------------------+
+ | Copyright (c) The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Dmitry Stogov <dmitry@php.net> |
+ | Xinchen Hui <laruence@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+#ifndef ZEND_JIT_INTERNAL_H
+#define ZEND_JIT_INTERNAL_H
+
+/* Profiler */
+extern zend_ulong zend_jit_profile_counter;
+extern int zend_jit_profile_counter_rid;
+
+#define ZEND_COUNTER_INFO(op_array) \
+ ZEND_OP_ARRAY_EXTENSION(op_array, zend_jit_profile_counter_rid)
+
+/* Hot Counters */
+
+#define ZEND_HOT_COUNTERS_COUNT 128
+
+extern int16_t zend_jit_hot_counters[ZEND_HOT_COUNTERS_COUNT];
+
+void ZEND_FASTCALL zend_jit_hot_func(zend_execute_data *execute_data, const zend_op *opline);
+
+typedef struct _zend_jit_op_array_extension {
+ int16_t *counter;
+ const void *orig_handlers[1];
+} zend_jit_op_array_extension;
+
+static zend_always_inline zend_long zend_jit_op_array_hash(const zend_op_array *op_array)
+{
+ uintptr_t x;
+
+ x = (uintptr_t)op_array->opcodes >> 3;
+#if SIZEOF_SIZE_T == 4
+ x = ((x >> 16) ^ x) * 0x45d9f3b;
+ x = ((x >> 16) ^ x) * 0x45d9f3b;
+ x = (x >> 16) ^ x;
+#elif SIZEOF_SIZE_T == 8
+ x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
+ x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
+ x = x ^ (x >> 31);
+#endif
+ return x;
+}
+
+extern const zend_op *zend_jit_halt_op;
+
+#ifdef HAVE_GCC_GLOBAL_REGS
+# define EXECUTE_DATA_D void
+# define EXECUTE_DATA_C
+# define EXECUTE_DATA_DC
+# define EXECUTE_DATA_CC
+# define OPLINE_D void
+# define OPLINE_C
+# define OPLINE_DC
+# define OPLINE_CC
+# define ZEND_OPCODE_HANDLER_RET void
+# define ZEND_OPCODE_HANDLER_ARGS EXECUTE_DATA_D
+# define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU
+# define ZEND_OPCODE_HANDLER_ARGS_DC
+# define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC
+# define ZEND_OPCODE_RETURN() return
+# define ZEND_OPCODE_TAIL_CALL(handler) do { \
+ handler(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); \
+ return; \
+ } while(0)
+#else
+# define EXECUTE_DATA_D zend_execute_data* execute_data
+# define EXECUTE_DATA_C execute_data
+# define EXECUTE_DATA_DC , EXECUTE_DATA_D
+# define EXECUTE_DATA_CC , EXECUTE_DATA_C
+# define OPLINE_D const zend_op* opline
+# define OPLINE_C opline
+# define OPLINE_DC , OPLINE_D
+# define OPLINE_CC , OPLINE_C
+# define ZEND_OPCODE_HANDLER_RET int
+# define ZEND_OPCODE_HANDLER_ARGS EXECUTE_DATA_D
+# define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU EXECUTE_DATA_C
+# define ZEND_OPCODE_HANDLER_ARGS_DC EXECUTE_DATA_DC
+# define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC EXECUTE_DATA_CC
+# define ZEND_OPCODE_RETURN() return 0
+# define ZEND_OPCODE_TAIL_CALL(handler) do { \
+ return handler(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); \
+ } while(0)
+#endif
+
+/* VM handlers */
+typedef ZEND_OPCODE_HANDLER_RET (ZEND_FASTCALL *zend_vm_opcode_handler_t)(ZEND_OPCODE_HANDLER_ARGS);
+
+/* VM helpers */
+ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_jit_leave_nested_func_helper(uint32_t call_info EXECUTE_DATA_DC);
+ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_jit_leave_top_func_helper(uint32_t call_info EXECUTE_DATA_DC);
+
+ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_jit_profile_helper(ZEND_OPCODE_HANDLER_ARGS);
+
+ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_jit_func_counter_helper(ZEND_OPCODE_HANDLER_ARGS);
+ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_jit_loop_counter_helper(ZEND_OPCODE_HANDLER_ARGS);
+
+void ZEND_FASTCALL zend_jit_copy_extra_args_helper(EXECUTE_DATA_D);
+void ZEND_FASTCALL zend_jit_deprecated_helper(OPLINE_D);
+
+void ZEND_FASTCALL zend_jit_get_constant(const zval *key, uint32_t flags);
+int ZEND_FASTCALL zend_jit_check_constant(const zval *key);
+
+#endif /* ZEND_JIT_INTERNAL_H */
diff --git a/ext/opcache/jit/zend_jit_oprofile.c b/ext/opcache/jit/zend_jit_oprofile.c
new file mode 100644
index 0000000000..50dd027279
--- /dev/null
+++ b/ext/opcache/jit/zend_jit_oprofile.c
@@ -0,0 +1,50 @@
+/*
+ +----------------------------------------------------------------------+
+ | Zend JIT |
+ +----------------------------------------------------------------------+
+ | Copyright (c) The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Dmitry Stogov <dmitry@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+#define HAVE_OPROFILE 1
+
+#include <opagent.h>
+
+static op_agent_t op_agent = NULL;
+
+static void zend_jit_oprofile_register(const char *name,
+ const void *start,
+ size_t size)
+{
+ if (op_agent) {
+ op_write_native_code(op_agent, name, (uint64_t)(zend_uintptr_t)start, start, size);
+ }
+}
+
+static int zend_jit_oprofile_startup(void)
+{
+ op_agent = op_open_agent();
+ if (!op_agent) {
+ fprintf(stderr, "OpAgent initialization failed [%d]!\n", errno);
+ return 0;
+ }
+ return 1;
+}
+
+static void zend_jit_oprofile_shutdown(void)
+{
+ if (op_agent) {
+//??? sleep(60);
+ op_close_agent(op_agent);
+ }
+}
diff --git a/ext/opcache/jit/zend_jit_perf_dump.c b/ext/opcache/jit/zend_jit_perf_dump.c
new file mode 100644
index 0000000000..94b1e4b859
--- /dev/null
+++ b/ext/opcache/jit/zend_jit_perf_dump.c
@@ -0,0 +1,246 @@
+/*
+ +----------------------------------------------------------------------+
+ | Zend JIT |
+ +----------------------------------------------------------------------+
+ | Copyright (c) The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Dmitry Stogov <dmitry@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+#define HAVE_PERFTOOLS 1
+
+#include <stdio.h>
+#include <unistd.h>
+#include <time.h>
+#include <sys/mman.h>
+#include <sys/syscall.h>
+
+#if defined(__darwin__)
+# include <pthread.h>
+#elif defined(__FreeBSD__)
+# include <sys/thr.h>
+# include <sys/sysctl.h>
+#elif defined(__NetBSD__)
+# include <lwp.h>
+#endif
+
+#include "zend_elf.h"
+
+/*
+ * 1) Profile using perf-<pid>.map
+ *
+ * perf record php -d opcache.huge_code_pages=0 -d opcache.jit_debug=0x10 bench.php
+ * perf report
+ *
+ * 2) Profile using jit-<pid>.dump
+ *
+ * perf record -k 1 php -d opcache.huge_code_pages=0 -d opcache.jit_debug=0x20 bench.php
+ * perf inject -j -i perf.data -o perf.data.jitted
+ * perf report -i perf.data.jitted
+ *
+ */
+
+
+#define ZEND_PERF_JITDUMP_HEADER_MAGIC 0x4A695444
+#define ZEND_PERF_JITDUMP_HEADER_VERSION 1
+
+#define ZEND_PERF_JITDUMP_RECORD_LOAD 0
+#define ZEND_PERF_JITDUMP_RECORD_MOVE 1
+#define ZEND_PERF_JITDUMP_RECORD_DEBUG_INFO 2
+#define ZEND_PERF_JITDUMP_RECORD_CLOSE 3
+#define ZEND_PERF_JITDUMP_UNWINDING_UNFO 4
+
+#define ALIGN8(size) (((size) + 7) & ~7)
+#define PADDING8(size) (ALIGN8(size) - (size))
+
+typedef struct zend_perf_jitdump_header {
+ uint32_t magic;
+ uint32_t version;
+ uint32_t size;
+ uint32_t elf_mach_target;
+ uint32_t reserved;
+ uint32_t process_id;
+ uint64_t time_stamp;
+ uint64_t flags;
+} zend_perf_jitdump_header;
+
+typedef struct _zend_perf_jitdump_record {
+ uint32_t event;
+ uint32_t size;
+ uint64_t time_stamp;
+} zend_perf_jitdump_record;
+
+typedef struct _zend_perf_jitdump_load_record {
+ zend_perf_jitdump_record hdr;
+ uint32_t process_id;
+ uint32_t thread_id;
+ uint64_t vma;
+ uint64_t code_address;
+ uint64_t code_size;
+ uint64_t code_id;
+} zend_perf_jitdump_load_record;
+
+static int jitdump_fd = -1;
+static void *jitdump_mem = MAP_FAILED;
+
+static uint64_t zend_perf_timestamp(void)
+{
+ struct timespec ts;
+
+ if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) {
+ return 0;
+ }
+ return ((uint64_t)ts.tv_sec * 1000000000) + ts.tv_nsec;
+}
+
+static void zend_jit_perf_jitdump_open(void)
+{
+ char filename[64];
+ int fd, ret;
+ zend_elf_header elf_hdr;
+ zend_perf_jitdump_header jit_hdr;
+
+ sprintf(filename, "/tmp/jit-%d.dump", getpid());
+ if (!zend_perf_timestamp()) {
+ return;
+ }
+
+#if defined(__linux__)
+ fd = open("/proc/self/exe", O_RDONLY);
+#elif defined(__NetBSD__)
+ fd = open("/proc/curproc/exe", O_RDONLY);
+#elif defined(__FreeBSD__)
+ char path[PATH_MAX];
+ size_t pathlen = sizeof(path);
+ int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1};
+ if (sysctl(mib, 4, path, &pathlen, NULL, 0) == -1) {
+ return;
+ }
+ fd = open(path, O_RDONLY);
+#else
+ fd = -1;
+#endif
+ if (fd < 0) {
+ return;
+ }
+
+ ret = read(fd, &elf_hdr, sizeof(elf_hdr));
+ close(fd);
+
+ if (ret != sizeof(elf_hdr) ||
+ elf_hdr.emagic[0] != 0x7f ||
+ elf_hdr.emagic[1] != 'E' ||
+ elf_hdr.emagic[2] != 'L' ||
+ elf_hdr.emagic[3] != 'F') {
+ return;
+ }
+
+ jitdump_fd = open(filename, O_CREAT | O_TRUNC | O_RDWR, 0666);
+ if (jitdump_fd < 0) {
+ return;
+ }
+
+ jitdump_mem = mmap(NULL,
+ sysconf(_SC_PAGESIZE),
+ PROT_READ|PROT_EXEC,
+ MAP_PRIVATE, jitdump_fd, 0);
+
+ if (jitdump_mem == MAP_FAILED) {
+ close(jitdump_fd);
+ jitdump_fd = -1;
+ return;
+ }
+
+ memset(&jit_hdr, 0, sizeof(jit_hdr));
+ jit_hdr.magic = ZEND_PERF_JITDUMP_HEADER_MAGIC;
+ jit_hdr.version = ZEND_PERF_JITDUMP_HEADER_VERSION;
+ jit_hdr.size = sizeof(jit_hdr);
+ jit_hdr.elf_mach_target = elf_hdr.machine;
+ jit_hdr.process_id = getpid();
+ jit_hdr.time_stamp = zend_perf_timestamp();
+ jit_hdr.flags = 0;
+ zend_quiet_write(jitdump_fd, &jit_hdr, sizeof(jit_hdr));
+}
+
+static void zend_jit_perf_jitdump_close(void)
+{
+ if (jitdump_fd >= 0) {
+ zend_perf_jitdump_record rec;
+
+ rec.event = ZEND_PERF_JITDUMP_RECORD_CLOSE;
+ rec.size = sizeof(rec);
+ rec.time_stamp = zend_perf_timestamp();
+ zend_quiet_write(jitdump_fd, &rec, sizeof(rec));
+ close(jitdump_fd);
+
+ if (jitdump_mem != MAP_FAILED) {
+ munmap(jitdump_mem, sysconf(_SC_PAGESIZE));
+ }
+ }
+}
+
+static void zend_jit_perf_jitdump_register(const char *name, void *start, size_t size)
+{
+ if (jitdump_fd >= 0) {
+ static uint64_t id = 1;
+ zend_perf_jitdump_load_record rec;
+ size_t len = strlen(name);
+ uint32_t thread_id = 0;
+#if defined(__linux__)
+ thread_id = syscall(SYS_gettid);
+#elif defined(__darwin__)
+ uint64_t thread_id_u64;
+ pthread_threadid_np(NULL, &thread_id_u64);
+ thread_id = (uint32_t) thread_id_u64;
+#elif defined(__FreeBSD__)
+ long tid;
+ thr_self(&tid);
+ thread_id = (uint32_t)tid;
+#elif defined(__OpenBSD__)
+ thread_id = getthrid();
+#elif defined(__NetBSD__)
+ thread_id = _lwp_self();
+#endif
+
+ memset(&rec, 0, sizeof(rec));
+ rec.hdr.event = ZEND_PERF_JITDUMP_RECORD_LOAD;
+ rec.hdr.size = sizeof(rec) + len + 1 + size;
+ rec.hdr.time_stamp = zend_perf_timestamp();
+ rec.process_id = getpid();
+ rec.thread_id = thread_id;
+ rec.vma = (uint64_t)(uintptr_t)start;
+ rec.code_address = (uint64_t)(uintptr_t)start;
+ rec.code_size = (uint64_t)size;
+ rec.code_id = id++;
+
+ zend_quiet_write(jitdump_fd, &rec, sizeof(rec));
+ zend_quiet_write(jitdump_fd, name, len + 1);
+ zend_quiet_write(jitdump_fd, start, size);
+ }
+}
+
+static void zend_jit_perf_map_register(const char *name, void *start, size_t size)
+{
+ static FILE *fp = NULL;
+
+ if (!fp) {
+ char filename[64];
+
+ sprintf(filename, "/tmp/perf-%d.map", getpid());
+ fp = fopen(filename, "w");
+ if (!fp) {
+ return;
+ }
+ setlinebuf(fp);
+ }
+ fprintf(fp, "%zx %zx %s\n", (size_t)(uintptr_t)start, size, name);
+}
diff --git a/ext/opcache/jit/zend_jit_vm_helpers.c b/ext/opcache/jit/zend_jit_vm_helpers.c
new file mode 100644
index 0000000000..9862fd1b42
--- /dev/null
+++ b/ext/opcache/jit/zend_jit_vm_helpers.c
@@ -0,0 +1,268 @@
+/*
+ +----------------------------------------------------------------------+
+ | Zend JIT |
+ +----------------------------------------------------------------------+
+ | Copyright (c) The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Dmitry Stogov <dmitry@php.net> |
+ | Xinchen Hui <laruence@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+#include "Zend/zend_execute.h"
+#include "Zend/zend_exceptions.h"
+#include "Zend/zend_vm.h"
+#include "Zend/zend_closures.h"
+#include "Zend/zend_constants.h"
+#include "Zend/zend_API.h"
+
+#include <ZendAccelerator.h>
+#include "Optimizer/zend_func_info.h"
+#include "zend_jit.h"
+#include "zend_jit_internal.h"
+
+#ifdef HAVE_GCC_GLOBAL_REGS
+# pragma GCC diagnostic ignored "-Wvolatile-register-var"
+# if defined(__x86_64__)
+register zend_execute_data* volatile execute_data __asm__("%r14");
+register const zend_op* volatile opline __asm__("%r15");
+# else
+register zend_execute_data* volatile execute_data __asm__("%esi");
+register const zend_op* volatile opline __asm__("%edi");
+# endif
+# pragma GCC diagnostic warning "-Wvolatile-register-var"
+#endif
+
+ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_jit_leave_nested_func_helper(uint32_t call_info EXECUTE_DATA_DC)
+{
+ zend_execute_data *old_execute_data;
+
+ if (UNEXPECTED(call_info & ZEND_CALL_HAS_SYMBOL_TABLE)) {
+ zend_clean_and_cache_symbol_table(EX(symbol_table));
+ }
+
+ zend_vm_stack_free_extra_args_ex(call_info, execute_data);
+ if (UNEXPECTED(call_info & ZEND_CALL_RELEASE_THIS)) {
+ OBJ_RELEASE(Z_OBJ(execute_data->This));
+ } else if (UNEXPECTED(call_info & ZEND_CALL_CLOSURE)) {
+ OBJ_RELEASE(ZEND_CLOSURE_OBJECT(EX(func)));
+ }
+
+ old_execute_data = execute_data;
+ execute_data = EX(prev_execute_data);
+ zend_vm_stack_free_call_frame_ex(call_info, old_execute_data);
+
+ if (UNEXPECTED(EG(exception) != NULL)) {
+ const zend_op *old_opline = EX(opline);
+ zend_throw_exception_internal(NULL);
+ if (old_opline->result_type != IS_UNDEF) {
+ zval_ptr_dtor(EX_VAR(old_opline->result.var));
+ }
+#ifndef HAVE_GCC_GLOBAL_REGS
+ return 2; // ZEND_VM_LEAVE
+#endif
+ } else {
+ EX(opline)++;
+#ifdef HAVE_GCC_GLOBAL_REGS
+ opline = EX(opline);
+#else
+ return 2; // ZEND_VM_LEAVE
+#endif
+ }
+}
+
+ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_jit_leave_top_func_helper(uint32_t call_info EXECUTE_DATA_DC)
+{
+ if (UNEXPECTED(call_info & (ZEND_CALL_HAS_SYMBOL_TABLE|ZEND_CALL_FREE_EXTRA_ARGS))) {
+ if (UNEXPECTED(call_info & ZEND_CALL_HAS_SYMBOL_TABLE)) {
+ zend_clean_and_cache_symbol_table(EX(symbol_table));
+ }
+ zend_vm_stack_free_extra_args_ex(call_info, execute_data);
+ }
+ if (UNEXPECTED(call_info & ZEND_CALL_CLOSURE)) {
+ OBJ_RELEASE(ZEND_CLOSURE_OBJECT(EX(func)));
+ }
+ execute_data = EG(current_execute_data);
+#ifdef HAVE_GCC_GLOBAL_REGS
+ opline = zend_jit_halt_op;
+#else
+ return -1; // ZEND_VM_RETURN
+#endif
+}
+
+void ZEND_FASTCALL zend_jit_copy_extra_args_helper(EXECUTE_DATA_D)
+{
+ zend_op_array *op_array = &EX(func)->op_array;
+
+ if (EXPECTED(!(op_array->fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE))) {
+ uint32_t first_extra_arg = op_array->num_args;
+ uint32_t num_args = EX_NUM_ARGS();
+ zval *end, *src, *dst;
+ uint32_t type_flags = 0;
+
+ if (EXPECTED((op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS) == 0)) {
+ /* Skip useless ZEND_RECV and ZEND_RECV_INIT opcodes */
+#ifdef HAVE_GCC_GLOBAL_REGS
+ opline += first_extra_arg;
+#endif
+ }
+
+ /* move extra args into separate array after all CV and TMP vars */
+ end = EX_VAR_NUM(first_extra_arg - 1);
+ src = end + (num_args - first_extra_arg);
+ dst = src + (op_array->last_var + op_array->T - first_extra_arg);
+ if (EXPECTED(src != dst)) {
+ do {
+ type_flags |= Z_TYPE_INFO_P(src);
+ ZVAL_COPY_VALUE(dst, src);
+ ZVAL_UNDEF(src);
+ src--;
+ dst--;
+ } while (src != end);
+ if (type_flags & (IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT)) {
+ ZEND_ADD_CALL_FLAG(execute_data, ZEND_CALL_FREE_EXTRA_ARGS);
+ }
+ } else {
+ do {
+ if (Z_REFCOUNTED_P(src)) {
+ ZEND_ADD_CALL_FLAG(execute_data, ZEND_CALL_FREE_EXTRA_ARGS);
+ break;
+ }
+ src--;
+ } while (src != end);
+ }
+ }
+}
+
+void ZEND_FASTCALL zend_jit_deprecated_helper(OPLINE_D)
+{
+ zend_execute_data *call = (zend_execute_data *) opline;
+ zend_function *fbc = call->func;
+ zend_error(E_DEPRECATED, "Function %s%s%s() is deprecated",
+ fbc->common.scope ? ZSTR_VAL(fbc->common.scope->name) : "",
+ fbc->common.scope ? "::" : "",
+ ZSTR_VAL(fbc->common.function_name));
+ if (EG(exception)) {
+#ifndef HAVE_GCC_GLOBAL_REGS
+ zend_execute_data *execute_data = EG(current_execute_data);
+#endif
+ const zend_op *opline = EG(opline_before_exception);
+ if (RETURN_VALUE_USED(opline)) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ }
+
+ zend_vm_stack_free_args(call);
+
+ if (UNEXPECTED(ZEND_CALL_INFO(call) & ZEND_CALL_RELEASE_THIS)) {
+ OBJ_RELEASE(Z_OBJ(call->This));
+ }
+
+ zend_vm_stack_free_call_frame(call);
+ }
+}
+
+ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_jit_profile_helper(ZEND_OPCODE_HANDLER_ARGS)
+{
+ zend_op_array *op_array = (zend_op_array*)EX(func);
+ zend_vm_opcode_handler_t handler = (zend_vm_opcode_handler_t)ZEND_FUNC_INFO(op_array);
+ uintptr_t counter = (uintptr_t)ZEND_COUNTER_INFO(op_array);
+
+ ZEND_COUNTER_INFO(op_array) = (void*)(counter + 1);
+ ++zend_jit_profile_counter;
+ ZEND_OPCODE_TAIL_CALL(handler);
+}
+
+ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_jit_func_counter_helper(ZEND_OPCODE_HANDLER_ARGS)
+{
+ zend_jit_op_array_extension *jit_extension =
+ (zend_jit_op_array_extension*)ZEND_FUNC_INFO(&EX(func)->op_array);
+#ifndef HAVE_GCC_GLOBAL_REGS
+ const zend_op *opline = EX(opline);
+#endif
+
+ *(jit_extension->counter) -= ZEND_JIT_HOT_FUNC_COST;
+
+ if (UNEXPECTED(*(jit_extension->counter) <= 0)) {
+ zend_jit_hot_func(execute_data, opline);
+ ZEND_OPCODE_RETURN();
+ } else {
+ zend_vm_opcode_handler_t handler = (zend_vm_opcode_handler_t)jit_extension->orig_handlers[opline - EX(func)->op_array.opcodes];
+ ZEND_OPCODE_TAIL_CALL(handler);
+ }
+}
+
+ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_jit_loop_counter_helper(ZEND_OPCODE_HANDLER_ARGS)
+{
+ zend_jit_op_array_extension *jit_extension =
+ (zend_jit_op_array_extension*)ZEND_FUNC_INFO(&EX(func)->op_array);
+#ifndef HAVE_GCC_GLOBAL_REGS
+ const zend_op *opline = EX(opline);
+#endif
+
+ *(jit_extension->counter) -= ZEND_JIT_HOT_LOOP_COST;
+
+ if (UNEXPECTED(*(jit_extension->counter) <= 0)) {
+ zend_jit_hot_func(execute_data, opline);
+ ZEND_OPCODE_RETURN();
+ } else {
+ zend_vm_opcode_handler_t handler = (zend_vm_opcode_handler_t)jit_extension->orig_handlers[opline - EX(func)->op_array.opcodes];
+ ZEND_OPCODE_TAIL_CALL(handler);
+ }
+}
+
+static zend_always_inline int _zend_quick_get_constant(
+ const zval *key, uint32_t flags, int check_defined_only)
+{
+#ifndef HAVE_GCC_GLOBAL_REGS
+ zend_execute_data *execute_data = EG(current_execute_data);
+#endif
+ const zend_op *opline = EX(opline);
+ zval *zv;
+ zend_constant *c = NULL;
+
+ /* null/true/false are resolved during compilation, so don't check for them here. */
+ zv = zend_hash_find_ex(EG(zend_constants), Z_STR_P(key), 1);
+ if (zv) {
+ c = (zend_constant*)Z_PTR_P(zv);
+ } else if (flags & IS_CONSTANT_UNQUALIFIED_IN_NAMESPACE) {
+ key++;
+ zv = zend_hash_find_ex(EG(zend_constants), Z_STR_P(key), 1);
+ if (zv) {
+ c = (zend_constant*)Z_PTR_P(zv);
+ }
+ }
+
+ if (!c) {
+ if (!check_defined_only) {
+ zend_throw_error(NULL, "Undefined constant '%s'", Z_STRVAL_P(RT_CONSTANT(opline, opline->op2)));
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ }
+ CACHE_PTR(opline->extended_value, ENCODE_SPECIAL_CACHE_NUM(zend_hash_num_elements(EG(zend_constants))));
+ return FAILURE;
+ }
+
+ if (!check_defined_only) {
+ ZVAL_COPY_OR_DUP(EX_VAR(opline->result.var), &c->value);
+ }
+
+ CACHE_PTR(opline->extended_value, c);
+ return SUCCESS;
+}
+
+void ZEND_FASTCALL zend_jit_get_constant(const zval *key, uint32_t flags)
+{
+ _zend_quick_get_constant(key, flags, 0);
+}
+
+int ZEND_FASTCALL zend_jit_check_constant(const zval *key)
+{
+ return _zend_quick_get_constant(key, 0, 1);
+}
diff --git a/ext/opcache/jit/zend_jit_vtune.c b/ext/opcache/jit/zend_jit_vtune.c
new file mode 100644
index 0000000000..877afa8606
--- /dev/null
+++ b/ext/opcache/jit/zend_jit_vtune.c
@@ -0,0 +1,42 @@
+/*
+ +----------------------------------------------------------------------+
+ | Zend JIT |
+ +----------------------------------------------------------------------+
+ | Copyright (c) The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Dmitry Stogov <dmitry@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+#define HAVE_VTUNE 1
+
+#include "jit/vtune/jitprofiling.h"
+#include "jit/vtune/jitprofiling.c"
+
+static void zend_jit_vtune_register(const char *name,
+ const void *start,
+ size_t size)
+{
+ iJIT_Method_Load jmethod = {0};
+
+ if (iJIT_IsProfilingActive() != iJIT_SAMPLING_ON) {
+ return;
+ }
+
+ jmethod.method_id = iJIT_GetNewMethodID();
+ jmethod.method_name = (char*)name;
+ jmethod.class_file_name = NULL;
+ jmethod.source_file_name = NULL;
+ jmethod.method_load_address = (void*)start;
+ jmethod.method_size = size;
+
+ iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, (void*)&jmethod);
+}
diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc
new file mode 100644
index 0000000000..3b6e3b26f5
--- /dev/null
+++ b/ext/opcache/jit/zend_jit_x86.dasc
@@ -0,0 +1,9827 @@
+/*
+ * +----------------------------------------------------------------------+
+ * | Zend JIT |
+ * +----------------------------------------------------------------------+
+ * | Copyright (c) The PHP Group |
+ * +----------------------------------------------------------------------+
+ * | This source file is subject to version 3.01 of the PHP license, |
+ * | that is bundled with this package in the file LICENSE, and is |
+ * | available through the world-wide-web at the following url: |
+ * | http://www.php.net/license/3_01.txt |
+ * | If you did not receive a copy of the PHP license and are unable to |
+ * | obtain it through the world-wide-web, please send a note to |
+ * | license@php.net so we can mail you a copy immediately. |
+ * +----------------------------------------------------------------------+
+ * | Authors: Dmitry Stogov <dmitry@php.net> |
+ * | Xinchen Hui <laruence@php.net> |
+ * +----------------------------------------------------------------------+
+ */
+
+|.if X64
+ |.arch x64
+|.else
+ |.arch x86
+|.endif
+
+|.if X64WIN
+ |.define FP, r14
+ |.define IP, r15
+ |.define IPl, r15d
+ |.define RX, r15 // the same as VM IP reused as a general purpos reg
+ |.define CARG1, rcx // x64/POSIX C call arguments.
+ |.define CARG2, rdx
+ |.define CARG3, r8
+ |.define CARG4, r9
+ |.define CARG1d, ecx
+ |.define CARG2d, edx
+ |.define CARG3d, r8d
+ |.define CARG4d, r9d
+ |.define FCARG1a, CARG1 // Simulate x86 fastcall.
+ |.define FCARG2a, CARG2
+ |.define FCARG1d, CARG1d
+ |.define FCARG2d, CARG2d
+ |.define SPAD, 0x08 // padding for CPU stack alignment
+ |.define NR_SPAD, 0x58 // padding for CPU stack alignment
+ |.define T3, [r4+0x50] // Used to store old value of IP
+ |.define T2, [r4+0x48] // Used to store old value of FP
+ |.define T1, [r4+0x40]
+ |.define A6, [r4+0x28] // preallocated slot for 6-th argument
+ |.define A5, [r4+0x20] // preallocated slot for 5-th argument
+|.elif X64
+ |.define FP, r14
+ |.define IP, r15
+ |.define IPl, r15d
+ |.define RX, r15 // the same as VM IP reused as a general purpos reg
+ |.define CARG1, rdi // x64/POSIX C call arguments.
+ |.define CARG2, rsi
+ |.define CARG3, rdx
+ |.define CARG4, rcx
+ |.define CARG5, r8
+ |.define CARG6, r9
+ |.define CARG1d, edi
+ |.define CARG2d, esi
+ |.define CARG3d, edx
+ |.define CARG4d, ecx
+ |.define CARG5d, r8d
+ |.define CARG6d, r9d
+ |.define FCARG1a, CARG1 // Simulate x86 fastcall.
+ |.define FCARG2a, CARG2
+ |.define FCARG1d, CARG1d
+ |.define FCARG2d, CARG2d
+ |.define SPAD, 0x08 // padding for CPU stack alignment
+ |.define NR_SPAD, 0x18 // padding for CPU stack alignment
+ |.define T3, [r4+0x10] // Used to store old value of IP (CALL VM only)
+ |.define T2, [r4+0x08] // Used to store old value of FP (CALL VM only)
+ |.define T1, [r4]
+|.else
+ |.define FP, esi
+ |.define IP, edi
+ |.define IPl, edi
+ |.define RX, edi // the same as VM IP reused as a general purpos reg
+ |.define FCARG1a, ecx // x86 fastcall arguments.
+ |.define FCARG2a, edx
+ |.define FCARG1d, ecx
+ |.define FCARG2d, edx
+ |.define SPAD, 12 // padding for CPU stack alignment
+ |.define NR_SPAD, 12 // padding for CPU stack alignment
+ |.define T3, [r4+0x10] // Used to store old value of IP (CALL VM only)
+ |.define T2, [r4+0x08] // Used to store old value of FP (CALL VM only)
+ |.define T1, [r4]
+|.endif
+
+|.define HYBRID_SPAD, 16 // padding for stack alignment
+
+/* According to x86 and x86_64 ABI, CPU stack has to be 16 byte aligned to
+ * guarantee proper alignment of 128-bit SSE data allocated on stack.
+ * With broken alignment any execution of SSE code, including calls to
+ * memcpy() and others, may lead to crash.
+ */
+
+#include "Zend/zend_cpuinfo.h"
+#include "jit/zend_jit_x86.h"
+
+/* The generated code may contain tautological comparisons, ignore them. */
+#if defined(__clang__)
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wtautological-compare"
+#endif
+
+const char* zend_reg_name[] = {
+#if defined(__x86_64__) || defined(_M_X64)
+ "rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi",
+ "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
+ "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7",
+ "xmm8", "xmm9", "xmm10", "xmm11", "xmm12", "xmm13", "xmm14", "xmm15"
+#else
+ "rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi",
+ "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7"
+#endif
+};
+
+#ifdef HAVE_GCC_GLOBAL_REGS
+# define GCC_GLOBAL_REGS 1
+#else
+# define GCC_GLOBAL_REGS 0
+#endif
+
+static uint32_t zend_jit_x86_flags = 0;
+
+#if ZTS
+static size_t tsrm_ls_cache_tcb_offset = 0;
+static size_t tsrm_tls_index;
+static size_t tsrm_tls_offset;
+#endif
+
+/* By default avoid JITing inline handlers if it does not seem profitable due to lack of
+ * type information. Disabling this option allows testing some JIT handlers in the
+ * presence of try/catch blocks, which prevent SSA construction. */
+#ifndef PROFITABILITY_CHECKS
+# define PROFITABILITY_CHECKS 1
+#endif
+
+|.type EX, zend_execute_data, FP
+|.type OP, zend_op
+|.type ZVAL, zval
+
+|.actionlist dasm_actions
+
+|.globals zend_lb
+static void* dasm_labels[zend_lb_MAX];
+
+|.section code, cold_code
+
+#define IS_32BIT(addr) (((uintptr_t)(addr)) <= 0xffffffff)
+
+#define IS_SIGNED_32BIT(val) ((((intptr_t)(val)) <= 0x7fffffff) && (((intptr_t)(val)) >= (-2147483647 - 1)))
+
+#define BP_JIT_IS 6
+
+|.macro LOAD_ADDR, reg, addr
+| .if X64
+|| if (IS_32BIT(addr)) {
+| mov reg, ((ptrdiff_t)addr) // 0x48 0xc7 0xc0 <imm-32-bit>
+|| } else {
+| mov64 reg, ((ptrdiff_t)addr) // 0x48 0xb8 <imm-64-bit>
+|| }
+| .else
+| mov reg, ((ptrdiff_t)addr)
+| .endif
+|.endmacro
+
+|.macro LOAD_TSRM_CACHE, reg
+| .if X64WIN
+| gs
+| mov reg, aword [0x58]
+| mov reg, aword [reg + tsrm_tls_index]
+| mov reg, aword [reg + tsrm_tls_offset]
+| .elif WIN
+| fs
+| mov reg, aword [0x2c]
+| mov reg, aword [reg + tsrm_tls_index]
+| mov reg, aword [reg + tsrm_tls_offset]
+| .elif X64APPLE
+| gs
+|| if (tsrm_ls_cache_tcb_offset) {
+| mov reg, aword [tsrm_ls_cache_tcb_offset]
+|| } else {
+| mov reg, aword [tsrm_tls_index]
+| mov reg, aword [reg + tsrm_tls_offset]
+|| }
+| .elif X64
+| fs
+|| if (tsrm_ls_cache_tcb_offset) {
+| mov reg, aword [tsrm_ls_cache_tcb_offset]
+|| } else {
+| mov reg, [0x8]
+| mov reg, aword [reg + tsrm_tls_index]
+| mov reg, aword [reg + tsrm_tls_offset]
+|| }
+| .else
+| gs
+|| if (tsrm_ls_cache_tcb_offset) {
+| mov reg, aword [tsrm_ls_cache_tcb_offset]
+|| } else {
+| mov reg, [0x4]
+| mov reg, aword [reg + tsrm_tls_index]
+| mov reg, aword [reg + tsrm_tls_offset]
+|| }
+| .endif
+|.endmacro
+
+|.macro LOAD_ADDR_ZTS, reg, struct, field
+| .if ZTS
+| LOAD_TSRM_CACHE reg
+| lea reg, aword [reg + (struct.._offset + offsetof(zend_..struct, field))]
+| .else
+| LOAD_ADDR reg, &struct.field
+| .endif
+|.endmacro
+
+|.macro SAVE_OPLINE
+|| if (GCC_GLOBAL_REGS) {
+| mov aword EX->opline, IP
+|| }
+|.endmacro
+
+|.macro LOAD_OPLINE
+|| if (GCC_GLOBAL_REGS) {
+| mov IP, aword EX->opline
+|| }
+|.endmacro
+
+|.macro LOAD_IP_ADDR, addr
+|| if (GCC_GLOBAL_REGS) {
+| LOAD_ADDR IP, addr
+|| } else {
+| LOAD_ADDR RX, addr
+| mov aword EX->opline, RX
+|| }
+|.endmacro
+
+|.macro LOAD_IP_ADDR_ZTS, struct, field
+| .if ZTS
+|| if (GCC_GLOBAL_REGS) {
+| LOAD_TSRM_CACHE IP
+| mov IP, aword [IP + (struct.._offset + offsetof(zend_..struct, field))]
+|| } else {
+| LOAD_TSRM_CACHE RX
+| lea RX, aword [RX + (struct.._offset + offsetof(zend_..struct, field))]
+| mov aword EX->opline, RX
+|| }
+| .else
+| LOAD_IP_ADDR &struct.field
+| .endif
+|.endmacro
+
+|.macro GET_IP, reg
+|| if (GCC_GLOBAL_REGS) {
+| mov reg, IP
+|| } else {
+| mov reg, aword EX->opline
+|| }
+|.endmacro
+
+|.macro ADD_IP, val
+|| if (GCC_GLOBAL_REGS) {
+| add IP, val
+|| } else {
+| add aword EX->opline, val
+|| }
+|.endmacro
+
+|.macro JMP_IP
+|| if (GCC_GLOBAL_REGS) {
+| jmp aword [IP]
+|| } else {
+| mov r0, aword EX:FCARG1a->opline
+| jmp aword [r0]
+|| }
+|.endmacro
+
+/* In 64-bit build we compare only low 32-bits.
+ * x86_64 cmp instruction doesn't support immediate 64-bit operand, and full
+ * comparison would require additinal load of 64-bit address into register.
+ * This is not a problem at all, while JIT buffer size is less than 4GB.
+ */
+|.macro CMP_IP, addr
+|| if (GCC_GLOBAL_REGS) {
+| cmp IPl, addr
+|| } else {
+| cmp dword EX->opline, addr
+|| }
+|.endmacro
+
+|.macro ADDR_OP1, addr_ins, addr, tmp_reg
+| .if X64
+|| if (IS_32BIT(addr)) {
+| addr_ins ((ptrdiff_t)addr)
+|| } else {
+| mov64 tmp_reg, ((ptrdiff_t)addr)
+| addr_ins tmp_reg
+|| }
+| .else
+| addr_ins ((ptrdiff_t)addr)
+| .endif
+|.endmacro
+
+|.macro ADDR_OP2_2, addr_ins, op1, addr, tmp_reg
+| .if X64
+|| if (IS_32BIT(addr)) {
+| addr_ins op1, ((ptrdiff_t)addr)
+|| } else {
+| mov64 tmp_reg, ((ptrdiff_t)addr)
+| addr_ins op1, tmp_reg
+|| }
+| .else
+| addr_ins op1, ((ptrdiff_t)addr)
+| .endif
+|.endmacro
+
+|.macro PUSH_ADDR, addr, tmp_reg
+| ADDR_OP1 push, addr, tmp_reg
+|.endmacro
+
+|.macro PUSH_ADDR_ZTS, struct, field, tmp_reg
+| .if ZTS
+| LOAD_TSRM_CACHE tmp_reg
+| lea tmp_reg, aword [tmp_reg + (struct.._offset + offsetof(zend_..struct, field))]
+| push tmp_reg
+| .else
+| ADDR_OP1 push, &struct.field, tmp_reg
+| .endif
+|.endmacro
+
+|.macro MEM_OP1, mem_ins, prefix, addr, tmp_reg
+| .if X64
+|| if (IS_32BIT(addr)) {
+| mem_ins prefix [addr]
+|| } else {
+| mov64 tmp_reg, ((ptrdiff_t)addr)
+| mem_ins prefix [tmp_reg]
+|| }
+| .else
+| mem_ins prefix [addr]
+| .endif
+|.endmacro
+
+|.macro MEM_OP2_1, mem_ins, prefix, addr, op2, tmp_reg
+| .if X64
+|| if (IS_32BIT(addr)) {
+| mem_ins prefix [addr], op2
+|| } else {
+| mov64 tmp_reg, ((ptrdiff_t)addr)
+| mem_ins prefix [tmp_reg], op2
+|| }
+| .else
+| mem_ins prefix [addr], op2
+| .endif
+|.endmacro
+
+|.macro MEM_OP2_2, mem_ins, op1, prefix, addr, tmp_reg
+| .if X64
+|| if (IS_32BIT(addr)) {
+| mem_ins op1, prefix [addr]
+|| } else {
+| mov64 tmp_reg, ((ptrdiff_t)addr)
+| mem_ins op1, prefix [tmp_reg]
+|| }
+| .else
+| mem_ins op1, prefix [addr]
+| .endif
+|.endmacro
+
+|.macro MEM_OP2_1_ZTS, mem_ins, prefix, struct, field, op2, tmp_reg
+| .if ZTS
+| LOAD_TSRM_CACHE tmp_reg
+| mem_ins prefix [tmp_reg + (struct.._offset + offsetof(zend_..struct, field))], op2
+| .else
+| MEM_OP2_1 mem_ins, prefix, &struct.field, op2, tmp_reg
+| .endif
+|.endmacro
+
+|.macro MEM_OP2_2_ZTS, mem_ins, op1, prefix, struct, field, tmp_reg
+| .if ZTS
+| LOAD_TSRM_CACHE tmp_reg
+| mem_ins op1, prefix [tmp_reg + (struct.._offset + offsetof(zend_..struct, field))]
+| .else
+| MEM_OP2_2 mem_ins, op1, prefix, &struct.field, tmp_reg
+| .endif
+|.endmacro
+
+|.macro MEM_OP3_3, mem_ins, op1, op2, prefix, addr, tmp_reg
+| .if X64
+|| if (IS_32BIT(addr)) {
+| mem_ins op1, op2, prefix [addr]
+|| } else {
+| mov64 tmp_reg, ((ptrdiff_t)addr)
+| mem_ins op1, op2, prefix [tmp_reg]
+|| }
+| .else
+| mem_ins op1, op2, prefix [addr]
+| .endif
+|.endmacro
+
+|.macro LOAD_BASE_ADDR, reg, base, offset
+|| if (offset) {
+| lea reg, qword [Ra(base)+offset]
+|| } else {
+| mov reg, Ra(base)
+|| }
+|.endmacro
+
+|.macro PUSH_BASE_ADDR, base, offset, tmp_reg
+|| if (offset) {
+| lea tmp_reg, qword [Ra(base)+offset]
+| push tmp_reg
+|| } else {
+| push Ra(base)
+|| }
+|.endmacro
+
+|.macro EXT_CALL, func, tmp_reg
+| .if X64
+|| if (IS_32BIT(dasm_end) && IS_32BIT(func)) {
+| call qword &func
+|| } else {
+| LOAD_ADDR tmp_reg, func
+| call tmp_reg
+|| }
+| .else
+| call dword &func
+| .endif
+|.endmacro
+
+|.macro EXT_JMP, func, tmp_reg
+| .if X64
+|| if (IS_32BIT(dasm_end) && IS_32BIT(func)) {
+| jmp qword &func
+|| } else {
+| LOAD_ADDR tmp_reg, func
+| jmp tmp_reg
+|| }
+| .else
+| jmp dword &func
+| .endif
+|.endmacro
+
+|.macro LOAD_ZVAL_ADDR, reg, addr
+|| if (Z_MODE(addr) == IS_CONST_ZVAL) {
+| LOAD_ADDR reg, Z_ZV(addr)
+|| } else if (Z_MODE(addr) == IS_MEM_ZVAL) {
+| LOAD_BASE_ADDR reg, Z_REG(addr), Z_OFFSET(addr)
+|| } else {
+|| ZEND_ASSERT(0);
+|| }
+|.endmacro
+
+|.macro PUSH_ZVAL_ADDR, addr, tmp_reg
+|| if (Z_MODE(addr) == IS_CONST_ZVAL) {
+| PUSH_ADDR Z_ZV(addr), tmp_reg
+|| } else if (Z_MODE(addr) == IS_MEM_ZVAL) {
+| PUSH_BASE_ADDR Z_REG(addr), Z_OFFSET(addr), tmp_reg
+|| } else {
+|| ZEND_ASSERT(0);
+|| }
+|.endmacro
+
+|.macro GET_Z_TYPE_INFO, reg, zv
+| mov reg, dword [zv+offsetof(zval,u1.type_info)]
+|.endmacro
+
+|.macro SET_Z_TYPE_INFO, zv, type
+| mov dword [zv+offsetof(zval,u1.type_info)], type
+|.endmacro
+
+|.macro GET_ZVAL_TYPE_INFO, reg, addr
+|| ZEND_ASSERT(Z_MODE(addr) == IS_MEM_ZVAL);
+| mov reg, dword [Ra(Z_REG(addr))+Z_OFFSET(addr)+offsetof(zval,u1.type_info)]
+|.endmacro
+
+|.macro SET_ZVAL_TYPE_INFO, addr, type
+|| ZEND_ASSERT(Z_MODE(addr) == IS_MEM_ZVAL);
+| mov dword [Ra(Z_REG(addr))+Z_OFFSET(addr)+offsetof(zval,u1.type_info)], type
+|.endmacro
+
+|.macro GET_Z_PTR, reg, zv
+| mov reg, aword [zv]
+|.endmacro
+
+|.macro SET_Z_PTR, zv, val
+| mov aword [zv], val
+|.endmacro
+
+|.macro GET_ZVAL_PTR, reg, addr
+|| ZEND_ASSERT(Z_MODE(addr) == IS_MEM_ZVAL);
+| mov reg, aword [Ra(Z_REG(addr))+Z_OFFSET(addr)]
+|.endmacro
+
+|.macro SET_ZVAL_PTR, addr, val
+|| ZEND_ASSERT(Z_MODE(addr) == IS_MEM_ZVAL);
+| mov aword [Ra(Z_REG(addr))+Z_OFFSET(addr)], val
+|.endmacro
+
+|.macro GET_ZVAL_W2, reg, addr
+|| ZEND_ASSERT(Z_MODE(addr) == IS_MEM_ZVAL);
+| mov reg, dword [Ra(Z_REG(addr))+Z_OFFSET(addr)+4]
+|.endmacro
+
+|.macro SET_ZVAL_W2, addr, val
+|| ZEND_ASSERT(Z_MODE(addr) == IS_MEM_ZVAL);
+| mov dword [Ra(Z_REG(addr))+Z_OFFSET(addr)+4], val
+|.endmacro
+
+|.macro UNDEF_OPLINE_RESULT
+| mov r0, EX->opline
+|.if X64
+ | movsxd r0, dword OP:r0->result.var
+|.else
+ | mov r0, OP:r0->result.var
+|.endif
+| SET_Z_TYPE_INFO FP + r0, IS_UNDEF
+|.endmacro
+
+|.macro SSE_AVX_INS, sse_ins, avx_ins, op1, op2
+|| if (zend_jit_x86_flags & ZEND_JIT_CPU_AVX) {
+| avx_ins op1, op2
+|| } else {
+| sse_ins op1, op2
+|| }
+|.endmacro
+
+|.macro SSE_OP, sse_ins, reg, addr
+|| if (Z_MODE(addr) == IS_CONST_ZVAL) {
+| MEM_OP2_2 sse_ins, xmm(reg-ZREG_XMM0), qword, Z_ZV(addr), r0
+|| } else if (Z_MODE(addr) == IS_MEM_ZVAL) {
+| sse_ins xmm(reg-ZREG_XMM0), qword [Ra(Z_REG(addr))+Z_OFFSET(addr)]
+|| } else if (Z_MODE(addr) == IS_REG) {
+| sse_ins xmm(reg-ZREG_XMM0), xmm(Z_REG(addr)-ZREG_XMM0)
+|| } else {
+|| ZEND_ASSERT(0);
+|| }
+|.endmacro
+
+|.macro SSE_AVX_OP, sse_ins, avx_ins, reg, addr
+|| if (Z_MODE(addr) == IS_CONST_ZVAL) {
+| .if X64
+|| if (IS_32BIT(Z_ZV(addr))) {
+| SSE_AVX_INS sse_ins, avx_ins, xmm(reg-ZREG_XMM0), qword [Z_ZV(addr)]
+|| } else {
+| LOAD_ADDR r0, Z_ZV(addr)
+| SSE_AVX_INS sse_ins, avx_ins, xmm(reg-ZREG_XMM0), qword [r0]
+|| }
+| .else
+| SSE_AVX_INS sse_ins, avx_ins, xmm(reg-ZREG_XMM0), qword [Z_ZV(addr)]
+| .endif
+|| } else if (Z_MODE(addr) == IS_MEM_ZVAL) {
+| SSE_AVX_INS sse_ins, avx_ins, xmm(reg-ZREG_XMM0), qword [Ra(Z_REG(addr))+Z_OFFSET(addr)]
+|| } else if (Z_MODE(addr) == IS_REG) {
+| SSE_AVX_INS sse_ins, avx_ins, xmm(reg-ZREG_XMM0), xmm(Z_REG(addr)-ZREG_XMM0)
+|| } else {
+|| ZEND_ASSERT(0);
+|| }
+|.endmacro
+
+|.macro SSE_GET_LONG, reg, lval
+|| if (lval == 0) {
+|| if (zend_jit_x86_flags & ZEND_JIT_CPU_AVX) {
+| vxorps xmm(reg-ZREG_XMM0), xmm(reg-ZREG_XMM0), xmm(reg-ZREG_XMM0)
+|| } else {
+| xorps xmm(reg-ZREG_XMM0), xmm(reg-ZREG_XMM0)
+|| }
+|| } else {
+|.if X64
+|| if (!IS_SIGNED_32BIT(lval)) {
+| mov64 r0, lval
+|| } else {
+| mov r0, lval
+|| }
+|.else
+| mov r0, lval
+|.endif
+|| if (zend_jit_x86_flags & ZEND_JIT_CPU_AVX) {
+| vcvtsi2sd, xmm(reg-ZREG_XMM0), xmm(reg-ZREG_XMM0), r0
+|| } else {
+| cvtsi2sd, xmm(reg-ZREG_XMM0), r0
+|| }
+|| }
+|.endmacro
+
+|.macro SSE_GET_ZVAL_LVAL, reg, addr
+|| if (Z_MODE(addr) == IS_CONST_ZVAL) {
+| SSE_GET_LONG reg, Z_LVAL_P(Z_ZV(addr))
+|| } else if (Z_MODE(addr) == IS_MEM_ZVAL) {
+|| if (zend_jit_x86_flags & ZEND_JIT_CPU_AVX) {
+| vcvtsi2sd xmm(reg-ZREG_XMM0), xmm(reg-ZREG_XMM0), aword [Ra(Z_REG(addr))+Z_OFFSET(addr)]
+|| } else {
+| cvtsi2sd xmm(reg-ZREG_XMM0), aword [Ra(Z_REG(addr))+Z_OFFSET(addr)]
+|| }
+|| } else if (Z_MODE(addr) == IS_REG) {
+|| if (zend_jit_x86_flags & ZEND_JIT_CPU_AVX) {
+| vcvtsi2sd xmm(reg-ZREG_XMM0), xmm(reg-ZREG_XMM0), Ra(Z_REG(addr))
+|| } else {
+| cvtsi2sd xmm(reg-ZREG_XMM0), Ra(Z_REG(addr))
+|| }
+|| } else {
+|| ZEND_ASSERT(0);
+|| }
+|.endmacro
+
+|.macro SSE_GET_ZVAL_DVAL, reg, addr
+|| if (Z_MODE(addr) != IS_REG || reg != Z_REG(addr)) {
+|| if (Z_MODE(addr) == IS_CONST_ZVAL) {
+| .if X64
+|| if (IS_32BIT(Z_ZV(addr))) {
+| SSE_AVX_INS movsd, vmovsd, xmm(reg-ZREG_XMM0), qword [Z_ZV(addr)]
+|| } else {
+| LOAD_ADDR r0, Z_ZV(addr)
+| SSE_AVX_INS movsd, vmovsd, xmm(reg-ZREG_XMM0), qword [r0]
+|| }
+| .else
+| SSE_AVX_INS movsd, vmovsd, xmm(reg-ZREG_XMM0), qword [Z_ZV(addr)]
+| .endif
+|| } else if (Z_MODE(addr) == IS_MEM_ZVAL) {
+| SSE_AVX_INS movsd, vmovsd, xmm(reg-ZREG_XMM0), qword [Ra(Z_REG(addr))+Z_OFFSET(addr)]
+|| } else if (Z_MODE(addr) == IS_REG) {
+| SSE_AVX_INS movsd, vmovaps, xmm(reg-ZREG_XMM0), xmm(Z_REG(addr)-ZREG_XMM0)
+|| } else {
+|| ZEND_ASSERT(0);
+|| }
+|| }
+|.endmacro
+
+|.macro SSE_MATH, opcode, reg, addr
+|| switch (opcode) {
+|| case ZEND_ADD:
+| SSE_OP addsd, reg, addr
+|| break;
+|| case ZEND_SUB:
+| SSE_OP subsd, reg, addr
+|| break;
+|| case ZEND_MUL:
+| SSE_OP mulsd, reg, addr
+|| break;
+|| case ZEND_DIV:
+| SSE_OP divsd, reg, addr
+|| break;
+|| }
+|.endmacro
+
+|.macro SSE_MATH_REG, opcode, dst_reg, src_reg
+|| switch (opcode) {
+|| case ZEND_ADD:
+| addsd xmm(dst_reg-ZREG_XMM0), xmm(src_reg-ZREG_XMM0)
+|| break;
+|| case ZEND_SUB:
+| subsd xmm(dst_reg-ZREG_XMM0), xmm(src_reg-ZREG_XMM0)
+|| break;
+|| case ZEND_MUL:
+| mulsd xmm(dst_reg-ZREG_XMM0), xmm(src_reg-ZREG_XMM0)
+|| break;
+|| case ZEND_DIV:
+| divsd xmm(dst_reg-ZREG_XMM0), xmm(src_reg-ZREG_XMM0)
+|| break;
+|| }
+|.endmacro
+
+|.macro SSE_SET_ZVAL_DVAL, addr, reg
+|| if (Z_MODE(addr) == IS_REG) {
+|| if (reg != Z_REG(addr)) {
+| SSE_AVX_INS movsd, vmovaps, xmm(Z_REG(addr)-ZREG_XMM0), xmm(reg-ZREG_XMM0)
+|| }
+|| } else {
+|| ZEND_ASSERT(Z_MODE(addr) == IS_MEM_ZVAL);
+| SSE_AVX_INS movsd, vmovsd, qword [Ra(Z_REG(addr))+Z_OFFSET(addr)], xmm(reg-ZREG_XMM0)
+|| }
+|.endmacro
+
+|.macro AVX_OP, avx_ins, reg, op1_reg, addr
+|| if (Z_MODE(addr) == IS_CONST_ZVAL) {
+| MEM_OP3_3 avx_ins, xmm(reg-ZREG_XMM0), xmm(op1_reg-ZREG_XMM0), qword, Z_ZV(addr), r0
+|| } else if (Z_MODE(addr) == IS_MEM_ZVAL) {
+| avx_ins xmm(reg-ZREG_XMM0), xmm(op1_reg-ZREG_XMM0), qword [Ra(Z_REG(addr))+Z_OFFSET(addr)]
+|| } else if (Z_MODE(addr) == IS_REG) {
+| avx_ins xmm(reg-ZREG_XMM0), xmm(op1_reg-ZREG_XMM0), xmm(Z_REG(addr)-ZREG_XMM0)
+|| } else {
+|| ZEND_ASSERT(0);
+|| }
+|.endmacro
+
+|.macro AVX_MATH, opcode, reg, op1_reg, addr
+|| switch (opcode) {
+|| case ZEND_ADD:
+| AVX_OP vaddsd, reg, op1_reg, addr
+|| break;
+|| case ZEND_SUB:
+| AVX_OP vsubsd, reg, op1_reg, addr
+|| break;
+|| case ZEND_MUL:
+| AVX_OP vmulsd, reg, op1_reg, addr
+|| break;
+|| case ZEND_DIV:
+| AVX_OP vdivsd, reg, op1_reg, addr
+|| break;
+|| }
+|.endmacro
+
+|.macro AVX_MATH_REG, opcode, dst_reg, op1_reg, src_reg
+|| switch (opcode) {
+|| case ZEND_ADD:
+| vaddsd xmm(dst_reg-ZREG_XMM0), xmm(op1_reg-ZREG_XMM0), xmm(src_reg-ZREG_XMM0)
+|| break;
+|| case ZEND_SUB:
+| vsubsd xmm(dst_reg-ZREG_XMM0), xmm(op1_reg-ZREG_XMM0), xmm(src_reg-ZREG_XMM0)
+|| break;
+|| case ZEND_MUL:
+| vmulsd xmm(dst_reg-ZREG_XMM0), xmm(op1_reg-ZREG_XMM0), xmm(src_reg-ZREG_XMM0)
+|| break;
+|| case ZEND_DIV:
+| vdivsd xmm(dst_reg-ZREG_XMM0), xmm(op1_reg-ZREG_XMM0), xmm(src_reg-ZREG_XMM0)
+|| break;
+|| }
+|.endmacro
+
+|.macro LONG_OP, long_ins, reg, addr
+|| if (Z_MODE(addr) == IS_CONST_ZVAL) {
+| .if X64
+|| if (!IS_SIGNED_32BIT(Z_LVAL_P(Z_ZV(addr)))) {
+|| if (reg != ZREG_R0) {
+| mov64 r0, Z_LVAL_P(Z_ZV(addr))
+| long_ins Ra(reg), r0
+|| } else {
+| mov64 r1, Z_LVAL_P(Z_ZV(addr))
+| long_ins Ra(reg), r1
+|| }
+|| } else {
+| long_ins Ra(reg), Z_LVAL_P(Z_ZV(addr))
+|| }
+| .else
+| long_ins Ra(reg), Z_LVAL_P(Z_ZV(addr))
+| .endif
+|| } else if (Z_MODE(addr) == IS_MEM_ZVAL) {
+| long_ins Ra(reg), aword [Ra(Z_REG(addr))+Z_OFFSET(addr)]
+|| } else if (Z_MODE(addr) == IS_REG) {
+| long_ins Ra(reg), Ra(Z_REG(addr))
+|| } else {
+|| ZEND_ASSERT(0);
+|| }
+|.endmacro
+
+|.macro LONG_OP_WITH_CONST, long_ins, op1_addr, lval
+|| if (Z_MODE(op1_addr) == IS_MEM_ZVAL) {
+| .if X64
+|| if (!IS_SIGNED_32BIT(lval)) {
+| mov64 r0, lval
+| long_ins aword [Ra(Z_REG(op1_addr))+Z_OFFSET(op1_addr)], r0
+|| } else {
+| long_ins aword [Ra(Z_REG(op1_addr))+Z_OFFSET(op1_addr)], lval
+|| }
+| .else
+| long_ins aword [Ra(Z_REG(op1_addr))+Z_OFFSET(op1_addr)], lval
+| .endif
+|| } else if (Z_MODE(op1_addr) == IS_REG) {
+| .if X64
+|| if (!IS_SIGNED_32BIT(lval)) {
+| mov64 r0, lval
+| long_ins Ra(Z_REG(op1_addr)), r0
+|| } else {
+| long_ins Ra(Z_REG(op1_addr)), lval
+|| }
+| .else
+| long_ins Ra(Z_REG(op1_addr)), lval
+| .endif
+|| } else {
+|| ZEND_ASSERT(0);
+|| }
+|.endmacro
+
+|.macro GET_ZVAL_LVAL, reg, addr
+|| if (Z_MODE(addr) == IS_CONST_ZVAL) {
+|| if (Z_LVAL_P(Z_ZV(addr)) == 0) {
+| xor Ra(reg), Ra(reg)
+|| } else {
+| .if X64
+|| if (!IS_SIGNED_32BIT(Z_LVAL_P(Z_ZV(addr)))) {
+| mov64 Ra(reg), Z_LVAL_P(Z_ZV(addr))
+|| } else {
+| mov Ra(reg), Z_LVAL_P(Z_ZV(addr))
+|| }
+| .else
+| mov Ra(reg), Z_LVAL_P(Z_ZV(addr))
+| .endif
+|| }
+|| } else if (Z_MODE(addr) == IS_MEM_ZVAL) {
+| mov Ra(reg), aword [Ra(Z_REG(addr))+Z_OFFSET(addr)]
+|| } else if (Z_MODE(addr) == IS_REG) {
+|| if (reg != Z_REG(addr)) {
+| mov Ra(reg), Ra(Z_REG(addr))
+|| }
+|| } else {
+|| ZEND_ASSERT(0);
+|| }
+|.endmacro
+
+|.macro LONG_MATH, opcode, reg, addr
+|| switch (opcode) {
+|| case ZEND_ADD:
+| LONG_OP add, reg, addr
+|| break;
+|| case ZEND_SUB:
+| LONG_OP sub, reg, addr
+|| break;
+|| case ZEND_MUL:
+| LONG_OP imul, reg, addr
+|| break;
+|| case ZEND_BW_OR:
+| LONG_OP or, reg, addr
+|| break;
+|| case ZEND_BW_AND:
+| LONG_OP and, reg, addr
+|| break;
+|| case ZEND_BW_XOR:
+| LONG_OP xor, reg, addr
+|| break;
+|| default:
+|| ZEND_ASSERT(0);
+|| }
+|.endmacro
+
+|.macro LONG_MATH_REG, opcode, dst_reg, src_reg
+|| switch (opcode) {
+|| case ZEND_ADD:
+| add dst_reg, src_reg
+|| break;
+|| case ZEND_SUB:
+| sub dst_reg, src_reg
+|| break;
+|| case ZEND_MUL:
+| imul dst_reg, src_reg
+|| break;
+|| case ZEND_BW_OR:
+| or dst_reg, src_reg
+|| break;
+|| case ZEND_BW_AND:
+| and dst_reg, src_reg
+|| break;
+|| case ZEND_BW_XOR:
+| xor dst_reg, src_reg
+|| break;
+|| default:
+|| ZEND_ASSERT(0);
+|| }
+|.endmacro
+
+|.macro SET_ZVAL_LVAL, addr, lval
+|| if (Z_MODE(addr) == IS_REG) {
+| mov Ra(Z_REG(addr)), lval
+|| } else {
+|| ZEND_ASSERT(Z_MODE(addr) == IS_MEM_ZVAL);
+| mov aword [Ra(Z_REG(addr))+Z_OFFSET(addr)], lval
+|| }
+|.endmacro
+
+|.macro ZVAL_COPY_CONST, dst_addr, dst_info, dst_def_info, zv, tmp_reg
+|| if (Z_TYPE_P(zv) > IS_TRUE) {
+|| if (Z_TYPE_P(zv) == IS_DOUBLE) {
+|| zend_reg dst_reg = (Z_MODE(dst_addr) == IS_REG) ? Z_REG(dst_addr) : ZREG_XMM0;
+|| if (Z_DVAL_P(zv) == 0.0 && !is_signed(Z_DVAL_P(zv))) {
+|| if (zend_jit_x86_flags & ZEND_JIT_CPU_AVX) {
+| vxorps xmm(dst_reg-ZREG_XMM0), xmm(dst_reg-ZREG_XMM0), xmm(dst_reg-ZREG_XMM0)
+|| } else {
+| xorps xmm(dst_reg-ZREG_XMM0), xmm(dst_reg-ZREG_XMM0)
+|| }
+| .if X64
+|| } else if (!IS_32BIT(zv)) {
+| mov64 tmp_reg, ((uintptr_t)zv)
+| SSE_AVX_INS movsd, vmovsd, xmm(dst_reg-ZREG_XMM0), qword [tmp_reg]
+| .endif
+|| } else {
+| SSE_AVX_INS movsd, vmovsd, xmm(dst_reg-ZREG_XMM0), qword [((uint32_t)(uintptr_t)zv)]
+|| }
+| SSE_SET_ZVAL_DVAL dst_addr, dst_reg
+|| } else if (Z_TYPE_P(zv) == IS_LONG && dst_def_info == MAY_BE_DOUBLE) {
+|| zend_reg dst_reg = (Z_MODE(dst_addr) == IS_REG) ? Z_REG(dst_addr) : ZREG_XMM0;
+| SSE_GET_LONG dst_reg, Z_LVAL_P(zv)
+| SSE_SET_ZVAL_DVAL dst_addr, dst_reg
+|| } else if (Z_LVAL_P(zv) == 0 && Z_MODE(dst_addr) == IS_REG) {
+| xor Ra(Z_REG(dst_addr)), Ra(Z_REG(dst_addr))
+|| } else {
+| .if X64
+|| if (!IS_SIGNED_32BIT(Z_LVAL_P(zv))) {
+|| if (Z_MODE(dst_addr) == IS_REG) {
+| mov64 Ra(Z_REG(dst_addr)), ((uintptr_t)Z_LVAL_P(zv))
+|| } else {
+| mov64 tmp_reg, ((uintptr_t)Z_LVAL_P(zv))
+| SET_ZVAL_LVAL dst_addr, tmp_reg
+|| }
+|| } else {
+| SET_ZVAL_LVAL dst_addr, Z_LVAL_P(zv)
+|| }
+| .else
+| SET_ZVAL_LVAL dst_addr, Z_LVAL_P(zv)
+| .endif
+|| }
+|| }
+|| if (Z_MODE(dst_addr) == IS_MEM_ZVAL) {
+|| if (dst_def_info == MAY_BE_DOUBLE) {
+|| if ((dst_info & (MAY_BE_ANY|MAY_BE_UNDEF)) != MAY_BE_DOUBLE) {
+| SET_ZVAL_TYPE_INFO dst_addr, IS_DOUBLE
+|| }
+|| } else if (((dst_info & (MAY_BE_ANY|MAY_BE_UNDEF)) != (1<<Z_TYPE_P(zv))) || (dst_info & (MAY_BE_STRING|MAY_BE_ARRAY)) != 0) {
+| SET_ZVAL_TYPE_INFO dst_addr, Z_TYPE_INFO_P(zv)
+|| }
+|| }
+|.endmacro
+
+|.macro ZVAL_COPY_CONST_2, dst_addr, res_addr, dst_info, dst_def_info, zv, tmp_reg
+|| if (Z_TYPE_P(zv) > IS_TRUE) {
+|| if (Z_TYPE_P(zv) == IS_DOUBLE) {
+|| zend_reg dst_reg = (Z_MODE(dst_addr) == IS_REG) ?
+|| Z_REG(dst_addr) : ((Z_MODE(res_addr) == IS_REG) ? Z_MODE(res_addr) : ZREG_XMM0);
+|| if (Z_DVAL_P(zv) == 0.0 && !is_signed(Z_DVAL_P(zv))) {
+|| if (zend_jit_x86_flags & ZEND_JIT_CPU_AVX) {
+| vxorps xmm(dst_reg-ZREG_XMM0), xmm(dst_reg-ZREG_XMM0), xmm(dst_reg-ZREG_XMM0)
+|| } else {
+| xorps xmm(dst_reg-ZREG_XMM0), xmm(dst_reg-ZREG_XMM0)
+|| }
+| .if X64
+|| } else if (!IS_32BIT(zv)) {
+| mov64 tmp_reg, ((uintptr_t)zv)
+| SSE_AVX_INS movsd, vmovsd, xmm(dst_reg-ZREG_XMM0), qword [tmp_reg]
+| .endif
+|| } else {
+| SSE_AVX_INS movsd, vmovsd, xmm(dst_reg-ZREG_XMM0), qword [((uint32_t)(uintptr_t)zv)]
+|| }
+| SSE_SET_ZVAL_DVAL dst_addr, ZREG_XMM0
+| SSE_SET_ZVAL_DVAL res_addr, ZREG_XMM0
+|| } else if (Z_TYPE_P(zv) == IS_LONG && dst_def_info == MAY_BE_DOUBLE) {
+|| if (Z_MODE(dst_addr) == IS_REG) {
+| SSE_GET_LONG Z_REG(dst_addr), Z_LVAL_P(zv)
+| SSE_SET_ZVAL_DVAL res_addr, Z_REG(dst_addr)
+|| } else if (Z_MODE(res_addr) == IS_REG) {
+| SSE_GET_LONG Z_REG(res_addr), Z_LVAL_P(zv)
+| SSE_SET_ZVAL_DVAL dst_addr, Z_REG(res_addr)
+|| } else {
+| SSE_GET_LONG ZREG_XMM0, Z_LVAL_P(zv)
+| SSE_SET_ZVAL_DVAL dst_addr, ZREG_XMM0
+| SSE_SET_ZVAL_DVAL res_addr, ZREG_XMM0
+|| }
+|| } else if (Z_LVAL_P(zv) == 0 && (Z_MODE(dst_addr) == IS_REG || Z_MODE(res_addr) == IS_REG)) {
+|| if (Z_MODE(dst_addr) == IS_REG) {
+| xor Ra(Z_REG(dst_addr)), Ra(Z_REG(dst_addr))
+| SET_ZVAL_LVAL res_addr, Ra(Z_REG(dst_addr))
+|| } else {
+| xor Ra(Z_REG(res_addr)), Ra(Z_REG(res_addr))
+| SET_ZVAL_LVAL dst_addr, Ra(Z_REG(res_addr))
+|| }
+|| } else {
+| .if X64
+|| if (!IS_SIGNED_32BIT(Z_LVAL_P(zv))) {
+|| if (Z_MODE(dst_addr) == IS_REG) {
+| mov64 Ra(Z_REG(dst_addr)), ((uintptr_t)Z_LVAL_P(zv))
+| SET_ZVAL_LVAL res_addr, Ra(Z_REG(dst_addr))
+|| } else if (Z_MODE(res_addr) == IS_REG) {
+| mov64 Ra(Z_REG(res_addr)), ((uintptr_t)Z_LVAL_P(zv))
+| SET_ZVAL_LVAL dst_addr, Ra(Z_REG(res_addr))
+|| } else {
+| mov64 tmp_reg, ((uintptr_t)Z_LVAL_P(zv))
+| SET_ZVAL_LVAL dst_addr, tmp_reg
+| SET_ZVAL_LVAL res_addr, tmp_reg
+|| }
+|| } else if (Z_MODE(dst_addr) == IS_REG) {
+| SET_ZVAL_LVAL dst_addr, Z_LVAL_P(zv)
+| SET_ZVAL_LVAL res_addr, Ra(Z_REG(dst_addr))
+|| } else if (Z_MODE(res_addr) == IS_REG) {
+| SET_ZVAL_LVAL res_addr, Z_LVAL_P(zv)
+| SET_ZVAL_LVAL dst_addr, Ra(Z_REG(res_addr))
+|| } else {
+| SET_ZVAL_LVAL dst_addr, Z_LVAL_P(zv)
+| SET_ZVAL_LVAL res_addr, Z_LVAL_P(zv)
+|| }
+| .else
+|| if (Z_MODE(dst_addr) == IS_REG) {
+| SET_ZVAL_LVAL dst_addr, Z_LVAL_P(zv)
+| SET_ZVAL_LVAL res_addr, Ra(Z_REG(dst_addr))
+|| } else if (Z_MODE(res_addr) == IS_REG) {
+| SET_ZVAL_LVAL res_addr, Z_LVAL_P(zv)
+| SET_ZVAL_LVAL dst_addr, Ra(Z_REG(res_addr))
+|| } else {
+| SET_ZVAL_LVAL dst_addr, Z_LVAL_P(zv)
+| SET_ZVAL_LVAL res_addr, Z_LVAL_P(zv)
+|| }
+| .endif
+|| }
+|| }
+|| if (Z_MODE(dst_addr) == IS_MEM_ZVAL) {
+|| if (dst_def_info == MAY_BE_DOUBLE) {
+|| if ((dst_info & (MAY_BE_ANY|MAY_BE_UNDEF)) != MAY_BE_DOUBLE) {
+| SET_ZVAL_TYPE_INFO dst_addr, IS_DOUBLE
+|| }
+|| } else if (((dst_info & (MAY_BE_ANY|MAY_BE_UNDEF)) != (1<<Z_TYPE_P(zv))) || (dst_info & (MAY_BE_STRING|MAY_BE_ARRAY)) != 0) {
+| SET_ZVAL_TYPE_INFO dst_addr, Z_TYPE_INFO_P(zv)
+|| }
+|| }
+|| if (Z_MODE(res_addr) == IS_MEM_ZVAL) {
+|| if (dst_def_info == MAY_BE_DOUBLE) {
+| SET_ZVAL_TYPE_INFO res_addr, IS_DOUBLE
+|| } else {
+| SET_ZVAL_TYPE_INFO res_addr, Z_TYPE_INFO_P(zv)
+|| }
+|| }
+|.endmacro
+
+/* the same as above, but "src" may overlap with "tmp_reg1" */
+|.macro ZVAL_COPY_VALUE, dst_addr, dst_info, src_addr, src_info, tmp_reg1, tmp_reg2
+|| if (src_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE))) {
+|| if ((src_info & MAY_BE_ANY) == MAY_BE_LONG) {
+|| if (Z_MODE(src_addr) == IS_REG) {
+|| if (Z_MODE(dst_addr) != IS_REG || Z_REG(dst_addr) != Z_REG(src_addr)) {
+| SET_ZVAL_LVAL dst_addr, Ra(Z_REG(src_addr))
+|| }
+|| } else if (Z_MODE(dst_addr) == IS_REG) {
+| GET_ZVAL_LVAL Z_REG(dst_addr), src_addr
+|| } else {
+| GET_ZVAL_LVAL tmp_reg2, src_addr
+| SET_ZVAL_LVAL dst_addr, Ra(tmp_reg2)
+|| }
+|| } else if ((src_info & MAY_BE_ANY) == MAY_BE_DOUBLE) {
+|| if (Z_MODE(src_addr) == IS_REG) {
+| SSE_SET_ZVAL_DVAL dst_addr, Z_REG(src_addr)
+|| } else if (Z_MODE(dst_addr) == IS_REG) {
+| SSE_GET_ZVAL_DVAL Z_REG(dst_addr), src_addr
+|| } else {
+| SSE_GET_ZVAL_DVAL ZREG_XMM0, src_addr
+| SSE_SET_ZVAL_DVAL dst_addr, ZREG_XMM0
+|| }
+|| } else if (!(src_info & MAY_BE_DOUBLE)) {
+| GET_ZVAL_PTR Ra(tmp_reg2), src_addr
+| SET_ZVAL_PTR dst_addr, Ra(tmp_reg2)
+|| } else {
+| .if X64
+| GET_ZVAL_PTR Ra(tmp_reg2), src_addr
+| SET_ZVAL_PTR dst_addr, Ra(tmp_reg2)
+| .else
+|| if (tmp_reg1 == tmp_reg2 || tmp_reg1 == Z_REG(src_addr)) {
+| GET_ZVAL_W2 Ra(tmp_reg2), src_addr
+| SET_ZVAL_W2 dst_addr, Ra(tmp_reg2)
+| GET_ZVAL_PTR Ra(tmp_reg2), src_addr
+| SET_ZVAL_PTR dst_addr, Ra(tmp_reg2)
+|| } else {
+| GET_ZVAL_PTR Ra(tmp_reg2), src_addr
+| GET_ZVAL_W2 Ra(tmp_reg1), src_addr
+| SET_ZVAL_PTR dst_addr, Ra(tmp_reg2)
+| SET_ZVAL_W2 dst_addr, Ra(tmp_reg1)
+|| }
+| .endif
+|| }
+|| }
+|| if ((src_info & (MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE)) &&
+|| has_concrete_type(src_info & MAY_BE_ANY)) {
+|| if (Z_MODE(dst_addr) == IS_MEM_ZVAL) {
+|| if ((dst_info & (MAY_BE_ANY|MAY_BE_UNDEF)) != (src_info & (MAY_BE_ANY|MAY_BE_UNDEF))) {
+|| zend_uchar type = concrete_type(src_info);
+| SET_ZVAL_TYPE_INFO dst_addr, type
+|| }
+|| }
+|| } else {
+| GET_ZVAL_TYPE_INFO Rd(tmp_reg1), src_addr
+| SET_ZVAL_TYPE_INFO dst_addr, Rd(tmp_reg1)
+|| }
+|.endmacro
+
+|.macro ZVAL_COPY_VALUE_2, dst_addr, dst_info, res_addr, src_addr, src_info, tmp_reg1, tmp_reg2
+|| if (src_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE))) {
+|| if ((src_info & MAY_BE_ANY) == MAY_BE_LONG) {
+|| if (Z_MODE(src_addr) == IS_REG) {
+|| if (Z_MODE(dst_addr) != IS_REG || Z_REG(dst_addr) != Z_REG(src_addr)) {
+| SET_ZVAL_LVAL dst_addr, Ra(Z_REG(src_addr))
+|| }
+|| if (Z_MODE(res_addr) != IS_REG || Z_REG(res_addr) != Z_REG(src_addr)) {
+| SET_ZVAL_LVAL res_addr, Ra(Z_REG(src_addr))
+|| }
+|| } else if (Z_MODE(dst_addr) == IS_REG) {
+| GET_ZVAL_LVAL Z_REG(dst_addr), src_addr
+|| if (Z_MODE(res_addr) != IS_REG || Z_REG(res_addr) != Z_REG(dst_addr)) {
+| SET_ZVAL_LVAL res_addr, Ra(Z_REG(dst_addr))
+|| }
+|| } else if (Z_MODE(res_addr) == IS_REG) {
+| GET_ZVAL_LVAL Z_REG(res_addr), src_addr
+| SET_ZVAL_LVAL dst_addr, Ra(Z_REG(res_addr))
+|| } else {
+| GET_ZVAL_LVAL tmp_reg2, src_addr
+| SET_ZVAL_LVAL dst_addr, Ra(tmp_reg2)
+| SET_ZVAL_LVAL res_addr, Ra(tmp_reg2)
+|| }
+|| } else if ((src_info & MAY_BE_ANY) == MAY_BE_DOUBLE) {
+|| if (Z_MODE(src_addr) == IS_REG) {
+| SSE_SET_ZVAL_DVAL dst_addr, Z_REG(src_addr)
+| SSE_SET_ZVAL_DVAL res_addr, Z_REG(src_addr)
+|| } else if (Z_MODE(dst_addr) == IS_REG) {
+| SSE_GET_ZVAL_DVAL Z_REG(dst_addr), src_addr
+| SSE_SET_ZVAL_DVAL res_addr, Z_REG(dst_addr)
+|| } else if (Z_MODE(res_addr) == IS_REG) {
+| SSE_GET_ZVAL_DVAL Z_REG(res_addr), src_addr
+| SSE_SET_ZVAL_DVAL dst_addr, Z_REG(res_addr)
+|| } else {
+| SSE_GET_ZVAL_DVAL ZREG_XMM0, src_addr
+| SSE_SET_ZVAL_DVAL dst_addr, ZREG_XMM0
+| SSE_SET_ZVAL_DVAL res_addr, ZREG_XMM0
+|| }
+|| } else if (!(src_info & MAY_BE_DOUBLE)) {
+| GET_ZVAL_PTR Ra(tmp_reg2), src_addr
+| SET_ZVAL_PTR dst_addr, Ra(tmp_reg2)
+| SET_ZVAL_PTR res_addr, Ra(tmp_reg2)
+|| } else {
+| .if X64
+| GET_ZVAL_PTR Ra(tmp_reg2), src_addr
+| SET_ZVAL_PTR dst_addr, Ra(tmp_reg2)
+| SET_ZVAL_PTR res_addr, Ra(tmp_reg2)
+| .else
+|| if (tmp_reg1 == tmp_reg2 || tmp_reg1 == Z_REG(src_addr)) {
+| GET_ZVAL_W2 Ra(tmp_reg2), src_addr
+| SET_ZVAL_W2 dst_addr, Ra(tmp_reg2)
+| SET_ZVAL_W2 res_addr, Ra(tmp_reg2)
+| GET_ZVAL_PTR Ra(tmp_reg2), src_addr
+| SET_ZVAL_PTR dst_addr, Ra(tmp_reg2)
+| SET_ZVAL_PTR res_addr, Ra(tmp_reg2)
+|| } else {
+| GET_ZVAL_PTR Ra(tmp_reg2), src_addr
+| GET_ZVAL_W2 Ra(tmp_reg1), src_addr
+| SET_ZVAL_PTR dst_addr, Ra(tmp_reg2)
+| SET_ZVAL_PTR res_addr, Ra(tmp_reg2)
+| SET_ZVAL_W2 dst_addr, Ra(tmp_reg1)
+| SET_ZVAL_W2 res_addr, Ra(tmp_reg1)
+|| }
+| .endif
+|| }
+|| }
+|| if ((src_info & (MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE)) &&
+|| has_concrete_type(src_info & MAY_BE_ANY)) {
+|| zend_uchar type = concrete_type(src_info);
+|| if (Z_MODE(dst_addr) == IS_MEM_ZVAL) {
+|| if ((dst_info & (MAY_BE_ANY|MAY_BE_UNDEF)) != (src_info & (MAY_BE_ANY|MAY_BE_UNDEF))) {
+| SET_ZVAL_TYPE_INFO dst_addr, type
+|| }
+|| }
+|| if (Z_MODE(res_addr) == IS_MEM_ZVAL) {
+| SET_ZVAL_TYPE_INFO res_addr, type
+|| }
+|| } else {
+| GET_ZVAL_TYPE_INFO Rd(tmp_reg1), src_addr
+| SET_ZVAL_TYPE_INFO dst_addr, Rd(tmp_reg1)
+| SET_ZVAL_TYPE_INFO res_addr, Rd(tmp_reg1)
+|| }
+|.endmacro
+
+|.macro IF_TYPE, type, val, label
+| cmp type, val
+| je label
+|.endmacro
+
+|.macro IF_NOT_TYPE, type, val, label
+| cmp type, val
+| jne label
+|.endmacro
+
+|.macro IF_Z_TYPE, zv, val, label
+| IF_TYPE byte [zv + offsetof(zval, u1.v.type)], val, label
+|.endmacro
+
+|.macro IF_NOT_Z_TYPE, zv, val, label
+| IF_NOT_TYPE byte [zv + offsetof(zval, u1.v.type)], val, label
+|.endmacro
+
+|.macro CMP_ZVAL_TYPE, addr, val
+|| ZEND_ASSERT(Z_MODE(addr) == IS_MEM_ZVAL);
+| cmp byte [Ra(Z_REG(addr))+Z_OFFSET(addr)+offsetof(zval, u1.v.type)], val
+|.endmacro
+
+|.macro IF_ZVAL_TYPE, addr, val, label
+|| ZEND_ASSERT(Z_MODE(addr) == IS_MEM_ZVAL);
+| IF_TYPE byte [Ra(Z_REG(addr))+Z_OFFSET(addr)+offsetof(zval, u1.v.type)], val, label
+|.endmacro
+
+|.macro IF_NOT_ZVAL_TYPE, addr, val, label
+|| ZEND_ASSERT(Z_MODE(addr) == IS_MEM_ZVAL);
+| IF_NOT_TYPE byte [Ra(Z_REG(addr))+Z_OFFSET(addr)+offsetof(zval, u1.v.type)], val, label
+|.endmacro
+
+|.macro IF_FLAGS, type_flags, mask, label
+| test type_flags, mask
+| jnz label
+|.endmacro
+
+|.macro IF_NOT_FLAGS, type_flags, mask, label
+| test type_flags, mask
+| jz label
+|.endmacro
+
+|.macro IF_REFCOUNTED, type_flags, label
+| IF_FLAGS type_flags, IS_TYPE_REFCOUNTED, label
+|.endmacro
+
+|.macro IF_NOT_REFCOUNTED, type_flags, label
+| IF_NOT_FLAGS type_flags, IS_TYPE_REFCOUNTED, label
+|.endmacro
+
+|.macro IF_ZVAL_FLAGS, addr, mask, label
+|| ZEND_ASSERT(Z_MODE(addr) == IS_MEM_ZVAL);
+| IF_FLAGS byte [Ra(Z_REG(addr))+Z_OFFSET(addr)+offsetof(zval, u1.v.type_flags)], mask, label
+|.endmacro
+
+|.macro IF_NOT_ZVAL_FLAGS, addr, mask, label
+|| ZEND_ASSERT(Z_MODE(addr) == IS_MEM_ZVAL);
+| IF_NOT_FLAGS byte [Ra(Z_REG(addr))+Z_OFFSET(addr)+offsetof(zval, u1.v.type_flags)], mask, label
+|.endmacro
+
+|.macro IF_ZVAL_REFCOUNTED, addr, label
+| IF_ZVAL_FLAGS addr, IS_TYPE_REFCOUNTED, label
+|.endmacro
+
+|.macro IF_NOT_ZVAL_REFCOUNTED, addr, label
+| IF_NOT_ZVAL_FLAGS addr, IS_TYPE_REFCOUNTED, label
+|.endmacro
+
+|.macro IF_NOT_ZVAL_COLLECTABLE, addr, label
+| IF_NOT_ZVAL_FLAGS addr, IS_TYPE_COLLECTABLE, label
+|.endmacro
+
+|.macro GC_ADDREF, zv
+| add dword [zv], 1
+|.endmacro
+
+|.macro GC_DELREF, zv
+| sub dword [zv], 1
+|.endmacro
+
+|.macro IF_GC_MAY_NOT_LEAK, ptr, tmp_reg, label
+| mov tmp_reg, dword [ptr + 4]
+| and tmp_reg, (GC_INFO_MASK | (GC_COLLECTABLE << GC_FLAGS_SHIFT))
+| cmp tmp_reg, (GC_COLLECTABLE << GC_FLAGS_SHIFT)
+| jne label
+|.endmacro
+
+|.macro ADDREF_CONST, zv, tmp_reg
+| .if X64
+|| if (!IS_SIGNED_32BIT(Z_LVAL_P(zv))) {
+| mov64 tmp_reg, ((uintptr_t)Z_LVAL_P(zv))
+| add dword [tmp_reg], 1
+|| } else {
+| add dword [Z_LVAL_P(zv)], 1
+|| }
+| .else
+| add dword [Z_LVAL_P(zv)], 1
+| .endif
+|.endmacro
+
+|.macro ADDREF_CONST_2, zv, tmp_reg
+| .if X64
+|| if (!IS_SIGNED_32BIT(Z_LVAL_P(zv))) {
+| mov64 tmp_reg, ((uintptr_t)Z_LVAL_P(zv))
+| add dword [tmp_reg], 2
+|| } else {
+| add dword [Z_LVAL_P(zv)], 2
+|| }
+| .else
+| add dword [Z_LVAL_P(zv)], 2
+| .endif
+|.endmacro
+
+|.macro TRY_ADDREF, val_info, type_flags_reg, value_ptr_reg
+|| if (val_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) {
+|| if (val_info & (MAY_BE_ANY-(MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
+| IF_NOT_REFCOUNTED type_flags_reg, >1
+|| }
+| GC_ADDREF value_ptr_reg
+|1:
+|| }
+|.endmacro
+
+|.macro TRY_ADDREF_2, val_info, type_flags_reg, value_ptr_reg
+|| if (val_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) {
+|| if (val_info & (MAY_BE_ANY-(MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
+| IF_NOT_REFCOUNTED type_flags_reg, >1
+|| }
+| add dword [value_ptr_reg], 2
+|1:
+|| }
+|.endmacro
+
+|.macro ZVAL_DEREF, reg, info
+|| if (info & MAY_BE_REF) {
+| IF_NOT_Z_TYPE, reg, IS_REFERENCE, >1
+| GET_Z_PTR reg, reg
+| add reg, offsetof(zend_reference, val)
+|1:
+|| }
+|.endmacro
+
+|.macro SAVE_VALID_OPLINE, op
+|| if (op == last_valid_opline) {
+| SAVE_OPLINE
+|| } else {
+| ADDR_OP2_2 mov, aword EX->opline, op, r0
+|| }
+|.endmacro
+
+// zval should be in FCARG1a
+|.macro ZVAL_DTOR_FUNC, var_info, opline // arg1 must be in FCARG1a
+|| do {
+|| if (has_concrete_type((var_info) & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
+|| zend_uchar type = concrete_type((var_info) & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE));
+|| if (type == IS_STRING && !ZEND_DEBUG) {
+| EXT_CALL _efree, r0
+|| break;
+|| } else if (type == IS_ARRAY) {
+|| if (opline) {
+| SAVE_VALID_OPLINE opline
+|| }
+| EXT_CALL zend_array_destroy, r0
+|| break;
+|| } else if (type == IS_OBJECT) {
+|| if (opline) {
+| SAVE_VALID_OPLINE opline
+|| }
+| EXT_CALL zend_objects_store_del, r0
+|| break;
+|| }
+|| }
+|| if (opline) {
+| SAVE_VALID_OPLINE opline
+|| }
+| EXT_CALL rc_dtor_func, r0
+|| } while(0);
+|.endmacro
+
+|.macro ZVAL_PTR_DTOR, addr, op_info, gc, cold, safe, opline
+|| if ((op_info) & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF)) {
+|| if ((op_info) & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
+| // if (Z_REFCOUNTED_P(cv)) {
+|| if (cold) {
+| IF_ZVAL_REFCOUNTED addr, >1
+|.cold_code
+|1:
+|| } else {
+| IF_NOT_ZVAL_REFCOUNTED addr, >4
+|| }
+|| }
+| // if (!Z_DELREF_P(cv)) {
+| GET_ZVAL_PTR FCARG1a, addr
+| GC_DELREF FCARG1a
+|| if (RC_MAY_BE_1(op_info)) {
+|| if (RC_MAY_BE_N(op_info)) {
+|| if (gc && RC_MAY_BE_N(op_info) && ((op_info) & (MAY_BE_REF|MAY_BE_ARRAY|MAY_BE_OBJECT)) != 0) {
+| jnz >3
+|| } else {
+| jnz >4
+|| }
+|| }
+|| if (safe) {
+| // ZVAL_NULL(cv);
+| SET_ZVAL_TYPE_INFO addr, IS_NULL
+|| }
+| // zval_dtor_func(r);
+| ZVAL_DTOR_FUNC op_info, opline
+|| if (gc && RC_MAY_BE_N(op_info) && ((op_info) & (MAY_BE_REF|MAY_BE_ARRAY|MAY_BE_OBJECT)) != 0) {
+| jmp >4
+|| }
+|3:
+|| }
+|| if (gc && RC_MAY_BE_N(op_info) && ((op_info) & (MAY_BE_REF|MAY_BE_ARRAY|MAY_BE_OBJECT)) != 0) {
+|| if ((op_info) & MAY_BE_REF) {
+|| zend_jit_addr ref_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, offsetof(zend_reference, val));
+| IF_NOT_ZVAL_TYPE addr, IS_REFERENCE, >1
+| IF_NOT_ZVAL_COLLECTABLE ref_addr, >4
+| GET_ZVAL_PTR FCARG1a, ref_addr
+|1:
+|| }
+| IF_GC_MAY_NOT_LEAK FCARG1a, eax, >4
+| // gc_possible_root(Z_COUNTED_P(z))
+| EXT_CALL gc_possible_root, r0
+|| if (cold && ((op_info) & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_OBJECT|MAY_BE_RESOURCE))) != 0) {
+| jmp >4
+|.code
+|| }
+|| } else if (cold && ((op_info) & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_OBJECT|MAY_BE_RESOURCE))) != 0) {
+| jmp >4
+|.code
+|| }
+|4:
+|| }
+|.endmacro
+
+|.macro FREE_OP, op_type, op, op_info, cold, op_array, opline
+|| if (op_type & (IS_VAR|IS_TMP_VAR)) {
+| ZVAL_PTR_DTOR ZEND_ADDR_MEM_ZVAL(ZREG_FP, op.var), op_info, 0, cold, 0, opline
+|| }
+|.endmacro
+
+|.macro SEPARATE_ARRAY, addr, op_info, cold
+|| if (RC_MAY_BE_N(op_info)) {
+|| zend_reg tmp_reg;
+||
+|| tmp_reg = (Z_REG(addr) == ZREG_FCARG1a) ? ZREG_R0 : ZREG_FCARG1a;
+| GET_ZVAL_LVAL tmp_reg, addr
+|| if (RC_MAY_BE_1(op_info)) {
+| cmp dword [Ra(tmp_reg)], 1 // if (GC_REFCOUNTED() > 1)
+|| if (cold) {
+| ja >1
+|.cold_code
+|1:
+|| } else {
+| jbe >2
+|| }
+|| }
+| IF_NOT_ZVAL_REFCOUNTED addr, >1
+| GC_DELREF Ra(tmp_reg)
+|1:
+|| if (Z_REG(addr) == ZREG_FCARG1a) {
+| mov aword T1, FCARG1a // save
+|| } else {
+| LOAD_ZVAL_ADDR FCARG1a, addr
+|| }
+| EXT_CALL zval_copy_ctor_func, r0
+|| if (Z_REG(addr) == ZREG_FCARG1a) {
+| mov FCARG1a, aword T1 // restore
+|| }
+|| if (RC_MAY_BE_1(op_info)) {
+|| if (cold) {
+| jmp >2
+|.code
+|| }
+|| }
+|2:
+|| }
+| GET_ZVAL_LVAL ZREG_FCARG1a, addr
+|.endmacro
+
+|.macro EFREE_REG_24, op_array, opline
+||#if ZEND_DEBUG
+|| const char *filename = op_array->filename ? op_array->filename->val : NULL;
+| LOAD_ADDR FCARG2a, filename
+| .if X64WIN
+| mov CARG3d, opline->lineno
+| xor CARG4, CARG4
+| mov aword A5, 0
+| EXT_CALL _efree, r0
+| .elif X64
+| mov CARG3d, opline->lineno
+| xor CARG4, CARG4
+| xor CARG5, CARG5
+| EXT_CALL _efree, r0
+| .else
+| sub r4, 4
+| push 0
+| push 0
+| push opline->lineno
+| EXT_CALL _efree, r0
+| add r4, 4
+| .endif
+||#else
+||#ifdef HAVE_BUILTIN_CONSTANT_P
+| EXT_CALL _efree_24, r0
+||#else
+| EXT_CALL _efree, r0
+||#endif
+||#endif
+|.endmacro
+
+|.macro EFREE_24, ptr, op_array, opline
+| mov FCARG1a, ptr
+| EFREE_REG_24 op_array, opline
+|.endmacro
+
+|.macro EMALLOC, size, op_array, opline
+||#if ZEND_DEBUG
+|| const char *filename = op_array->filename ? op_array->filename->val : NULL;
+| mov FCARG1a, size
+| LOAD_ADDR FCARG2a, filename
+| .if X64WIN
+| mov CARG3d, opline->lineno
+| xor CARG4, CARG4
+| mov aword A5, 0
+| EXT_CALL _emalloc, r0
+| .elif X64
+| mov CARG3d, opline->lineno
+| xor CARG4, CARG4
+| xor CARG5, CARG5
+| EXT_CALL _emalloc, r0
+| .else
+| sub r4, 4
+| push 0
+| push 0
+| push opline->lineno
+| EXT_CALL _emalloc, r0
+| add r4, 4
+| .endif
+||#else
+||#ifdef HAVE_BUILTIN_CONSTANT_P
+|| if (size == 24) {
+| EXT_CALL _emalloc_24, r0
+|| } else {
+| mov FCARG1a, size
+| EXT_CALL _emalloc, r0
+|| }
+||#else
+| mov FCARG1a, size
+| EXT_CALL _emalloc, r0
+||#endif
+||#endif
+|.endmacro
+
+|.macro OBJ_RELEASE, reg, tmp_reg, exit_label
+| GC_DELREF reg
+| jne >1
+| // zend_objects_store_del(obj);
+| mov FCARG1a, reg
+| EXT_CALL zend_objects_store_del, r0
+| jmp exit_label
+|1:
+| IF_GC_MAY_NOT_LEAK reg, tmp_reg, >1
+| // gc_possible_root(obj)
+| mov FCARG1a, reg
+| EXT_CALL gc_possible_root, r0
+|1:
+|.endmacro
+
+|.macro UNDEFINED_OFFSET, opline
+|| if (opline == last_valid_opline) {
+| call ->undefined_offset_ex
+|| } else {
+| SAVE_VALID_OPLINE, opline
+| call ->undefined_offset
+|| }
+|.endmacro
+
+|.macro UNDEFINED_INDEX, opline
+|| if (opline == last_valid_opline) {
+| call ->undefined_index_ex
+|| } else {
+| SAVE_VALID_OPLINE, opline
+| call ->undefined_index
+|| }
+|.endmacro
+
+|.macro CANNOT_ADD_ELEMENT, opline
+|| if (opline == last_valid_opline) {
+| call ->cannot_add_element_ex
+|| } else {
+| SAVE_VALID_OPLINE, opline
+| call ->cannot_add_element
+|| }
+|.endmacro
+
+static zend_bool reuse_ip;
+static zend_bool delayed_call_chain;
+static uint32_t delayed_call_level;
+static const zend_op *last_valid_opline;
+static int jit_return_label;
+
+/* bit helpers */
+
+/* from http://aggregate.org/MAGIC/ */
+static uint32_t ones32(uint32_t x)
+{
+ x -= ((x >> 1) & 0x55555555);
+ x = (((x >> 2) & 0x33333333) + (x & 0x33333333));
+ x = (((x >> 4) + x) & 0x0f0f0f0f);
+ x += (x >> 8);
+ x += (x >> 16);
+ return x & 0x0000003f;
+}
+
+static uint32_t floor_log2(uint32_t x)
+{
+ x |= (x >> 1);
+ x |= (x >> 2);
+ x |= (x >> 4);
+ x |= (x >> 8);
+ x |= (x >> 16);
+ return ones32(x) - 1;
+}
+
+static zend_bool is_power_of_two(uint32_t x)
+{
+ return !(x & (x - 1));
+}
+
+static zend_bool has_concrete_type(uint32_t value_type)
+{
+ if (value_type & MAY_BE_UNDEF) {
+ value_type |= MAY_BE_NULL;
+ }
+ value_type &= MAY_BE_ANY;
+ return is_power_of_two (value_type);
+}
+
+static uint32_t concrete_type(uint32_t value_type)
+{
+ return floor_log2(value_type & MAY_BE_ANY);
+}
+
+static inline zend_bool is_signed(double d)
+{
+ return (((unsigned char*)&d)[sizeof(double)-1] & 0x80) != 0;
+}
+
+static int zend_jit_interrupt_handler_stub(dasm_State **Dst)
+{
+ |->interrupt_handler:
+ | //EG(vm_interrupt) = 0;
+ | MEM_OP2_1_ZTS mov, byte, executor_globals, vm_interrupt, 0, r0
+ | //if (EG(timed_out)) {
+ | MEM_OP2_1_ZTS cmp, byte, executor_globals, timed_out, 0, r0
+ | je >1
+ | //zend_timeout(0);
+ | xor FCARG1d, FCARG1d
+ | EXT_CALL zend_timeout, r0
+ |1:
+ | //} else if (zend_interrupt_function) {
+ if (zend_interrupt_function) {
+ | SAVE_OPLINE
+ | //zend_interrupt_function(execute_data);
+ |.if X64
+ | mov CARG1, FP
+ | EXT_CALL zend_interrupt_function, r0
+ |.else
+ | sub r4, 12
+ | push FP
+ | EXT_CALL zend_interrupt_function, r0
+ | add r4, 16
+ |.endif
+ | //ZEND_VM_ENTER();
+ | //execute_data = EG(current_execute_data);
+ | MEM_OP2_2_ZTS mov, FP, aword, executor_globals, current_execute_data, r0
+ | LOAD_OPLINE
+ }
+ | //ZEND_VM_CONTINUE()
+ if (zend_jit_vm_kind == ZEND_VM_KIND_HYBRID) {
+ | add r4, HYBRID_SPAD
+ | JMP_IP
+ } else if (GCC_GLOBAL_REGS) {
+ | add r4, SPAD // stack alignment
+ | JMP_IP
+ } else {
+ | mov FP, aword T2 // restore FP
+ | mov RX, aword T3 // restore IP
+ | add r4, NR_SPAD // stack alignment
+ | mov r0, 1 // ZEND_VM_ENTER
+ | ret
+ }
+
+ return 1;
+}
+
+static int zend_jit_exception_handler_stub(dasm_State **Dst)
+{
+ |->exception_handler:
+ if (zend_jit_vm_kind == ZEND_VM_KIND_HYBRID) {
+ const void *handler = zend_get_opcode_handler_func(EG(exception_op));
+
+ | add r4, HYBRID_SPAD
+ | EXT_CALL handler, r0
+ | JMP_IP
+ } else {
+ const void *handler = EG(exception_op)->handler;
+
+ if (GCC_GLOBAL_REGS) {
+ | add r4, SPAD // stack alignment
+ } else {
+ | mov FCARG1a, FP
+ | mov FP, aword T2 // restore FP
+ | mov RX, aword T3 // restore IP
+ | add r4, NR_SPAD // stack alignment
+ }
+ | EXT_JMP handler, r0
+ }
+
+ return 1;
+}
+
+static int zend_jit_exception_handler_undef_stub(dasm_State **Dst)
+{
+ |->exception_handler_undef:
+ | MEM_OP2_2_ZTS mov, r0, aword, executor_globals, opline_before_exception, r0
+ | test byte OP:r0->result_type, (IS_TMP_VAR|IS_VAR)
+ | jnz >1
+ | .if X64
+ | movsxd r0, dword OP:r0->result.var
+ | .else
+ | mov r0, aword OP:r0->result.var
+ | .endif
+ | SET_Z_TYPE_INFO FP + r0, IS_UNDEF
+ |1:
+ | jmp ->exception_handler
+
+ return 1;
+}
+
+static int zend_jit_leave_function_stub(dasm_State **Dst)
+{
+ |->leave_function_handler:
+ if (zend_jit_vm_kind == ZEND_VM_KIND_HYBRID) {
+ | test FCARG1d, ZEND_CALL_TOP
+ | jnz >1
+ | EXT_CALL zend_jit_leave_nested_func_helper, r0
+ | add r4, HYBRID_SPAD // stack alignment
+ | JMP_IP
+ |1:
+ | EXT_CALL zend_jit_leave_top_func_helper, r0
+ | add r4, HYBRID_SPAD // stack alignment
+ | JMP_IP
+ } else {
+ if (GCC_GLOBAL_REGS) {
+ | add r4, SPAD
+ } else {
+ | mov FCARG2a, FP
+ | mov FP, aword T2 // restore FP
+ | mov RX, aword T3 // restore IP
+ | add r4, NR_SPAD
+ }
+ | test FCARG1d, ZEND_CALL_TOP
+ | jnz >1
+ | EXT_JMP zend_jit_leave_nested_func_helper, r0
+ |1:
+ | EXT_JMP zend_jit_leave_top_func_helper, r0
+ }
+
+ return 1;
+}
+
+static int zend_jit_leave_throw_stub(dasm_State **Dst)
+{
+ |->leave_throw_handler:
+ | // if (opline->opcode != ZEND_HANDLE_EXCEPTION) {
+ if (GCC_GLOBAL_REGS) {
+ | cmp byte OP:IP->opcode, ZEND_HANDLE_EXCEPTION
+ | je >5
+ | // EG(opline_before_exception) = opline;
+ | MEM_OP2_1_ZTS mov, aword, executor_globals, opline_before_exception, IP, r0
+ |5:
+ | // opline = EG(exception_op);
+ | LOAD_IP_ADDR_ZTS executor_globals, exception_op
+ | // HANDLE_EXCEPTION()
+ | jmp ->exception_handler
+ } else {
+ | GET_IP FCARG1a
+ | cmp byte OP:FCARG1a->opcode, ZEND_HANDLE_EXCEPTION
+ | je >5
+ | // EG(opline_before_exception) = opline;
+ | MEM_OP2_1_ZTS mov, aword, executor_globals, opline_before_exception, FCARG1a, r0
+ |5:
+ | // opline = EG(exception_op);
+ | LOAD_IP_ADDR_ZTS executor_globals, exception_op
+ | mov FP, aword T2 // restore FP
+ | mov RX, aword T3 // restore IP
+ | add r4, NR_SPAD // stack alignment
+ | mov r0, 2 // ZEND_VM_LEAVE
+ | ret
+ }
+
+ return 1;
+}
+
+static int zend_jit_icall_throw_stub(dasm_State **Dst)
+{
+ |->icall_throw_handler:
+ | // zend_throw_exception_internal(NULL);
+ |.if X64
+ | xor CARG1, CARG1
+ | EXT_CALL zend_throw_exception_internal, r0
+ |.else
+ | sub r4, 12
+ | push 0
+ | EXT_CALL zend_throw_exception_internal, r0
+ | add r4, 16
+ |.endif
+ | // HANDLE_EXCEPTION()
+ | jmp ->exception_handler
+
+ return 1;
+}
+
+static int zend_jit_throw_cannot_pass_by_ref_stub(dasm_State **Dst)
+{
+ |->throw_cannot_pass_by_ref:
+ | mov r0, EX->opline
+ |.if X64
+ | movsxd r1, dword OP:r0->result.var
+ |.else
+ | mov r1, OP:r0->result.var
+ |.endif
+ | SET_Z_TYPE_INFO RX+r1, IS_UNDEF
+ | // last EX(call) frame may be delayed
+ | cmp RX, EX->call
+ | je >1
+ | mov r1, EX->call
+ | mov EX:RX->prev_execute_data, r1
+ | mov EX->call, RX
+ |1:
+ | mov RX, r0
+ |.if X64
+ | xor CARG1, CARG1
+ | LOAD_ADDR CARG2, "Cannot pass parameter %d by reference"
+ | mov CARG3d, dword OP:r0->op2.num
+ | EXT_CALL zend_throw_error, r0
+ |.else
+ | mov r1, dword OP:r0->op2.num
+ | sub r4, 4
+ | push r1
+ | push "Cannot pass parameter %d by reference"
+ | push 0
+ | EXT_CALL zend_throw_error, r0
+ | add r4, 16
+ |.endif
+ | cmp byte OP:RX->op1_type, IS_TMP_VAR
+ | jne >9
+ |.if X64
+ | movsxd r0, dword OP:RX->op1.var
+ |.else
+ | mov r0, OP:RX->op1.var
+ |.endif
+ | add r0, FP
+ | ZVAL_PTR_DTOR ZEND_ADDR_MEM_ZVAL(ZREG_R0, 0), MAY_BE_ANY|MAY_BE_RC1|MAY_BE_RCN|MAY_BE_REF, 0, 0, 0, NULL
+ |9:
+ | jmp ->exception_handler
+
+ return 1;
+}
+
+static int zend_jit_undefined_offset_ex_stub(dasm_State **Dst)
+{
+ |->undefined_offset_ex:
+ | SAVE_OPLINE
+ | jmp ->undefined_offset
+
+ return 1;
+}
+
+static int zend_jit_undefined_offset_stub(dasm_State **Dst)
+{
+ |->undefined_offset:
+ |.if X64WIN
+ | sub r4, 0x28
+ |.elif X64
+ | sub r4, 8
+ |.else
+ | sub r4, 12
+ |.endif
+ | mov r0, EX->opline
+ |.if X64
+ | movsxd r1, dword OP:r0->result.var
+ |.else
+ | mov r1, OP:r0->result.var
+ |.endif
+ | cmp byte OP:r0->op2_type, IS_CONST
+ | SET_Z_TYPE_INFO FP + r1, IS_NULL
+ | jne >2
+ |.if X64
+ | movsxd r1, dword OP:r0->op2.constant
+ | add r0, r1
+ |.else
+ | mov r0, aword OP:r0->op2.zv
+ |.endif
+ | jmp >3
+ |2:
+ |.if X64
+ | movsxd r0, dword OP:r0->op2.var
+ |.else
+ | mov r0, OP:r0->op2.var
+ |.endif
+ | add r0, FP
+ |3:
+ |.if X64WIN
+ | mov CARG1, E_NOTICE
+ | LOAD_ADDR CARG2, "Undefined offset: " ZEND_LONG_FMT
+ | mov CARG3, aword [r0]
+ | EXT_CALL zend_error, r0
+ | add r4, 0x28 // stack alignment
+ |.elif X64
+ | mov CARG1, E_NOTICE
+ | LOAD_ADDR CARG2, "Undefined offset: " ZEND_LONG_FMT
+ | mov CARG3, aword [r0]
+ | EXT_CALL zend_error, r0
+ | add r4, 8 // stack alignment
+ |.else
+ | sub r4, 4
+ | push aword [r0]
+ | push "Undefined offset: " ZEND_LONG_FMT
+ | push E_NOTICE
+ | EXT_CALL zend_error, r0
+ | add r4, 28
+ |.endif
+ | ret
+
+ return 1;
+}
+
+static int zend_jit_undefined_index_ex_stub(dasm_State **Dst)
+{
+ |->undefined_index_ex:
+ | SAVE_OPLINE
+ | jmp ->undefined_index
+
+ return 1;
+}
+
+static int zend_jit_undefined_index_stub(dasm_State **Dst)
+{
+ |->undefined_index:
+ |.if X64WIN
+ | sub r4, 0x28
+ |.elif X64
+ | sub r4, 8
+ |.else
+ | sub r4, 12
+ |.endif
+ | mov r0, EX->opline
+ |.if X64
+ | movsxd r1, dword OP:r0->result.var
+ |.else
+ | mov r1, OP:r0->result.var
+ |.endif
+ | cmp byte OP:r0->op2_type, IS_CONST
+ | SET_Z_TYPE_INFO FP + r1, IS_NULL
+ | jne >2
+ |.if X64
+ | movsxd r1, dword OP:r0->op2.constant
+ | add r0, r1
+ |.else
+ | mov r0, aword OP:r0->op2.zv
+ |.endif
+ | jmp >3
+ |2:
+ |.if X64
+ | movsxd r0, dword OP:r0->op2.var
+ |.else
+ | mov r0, OP:r0->op2.var
+ |.endif
+ | add r0, FP
+ |3:
+ |.if X64WIN
+ | mov CARG1, E_NOTICE
+ | LOAD_ADDR CARG2, "Undefined index: %s"
+ | mov CARG3, aword [r0]
+ | add CARG3, offsetof(zend_string, val)
+ | EXT_CALL zend_error, r0
+ | add r4, 0x28
+ |.elif X64
+ | mov CARG1, E_NOTICE
+ | LOAD_ADDR CARG2, "Undefined index: %s"
+ | mov CARG3, aword [r0]
+ | add CARG3, offsetof(zend_string, val)
+ | EXT_CALL zend_error, r0
+ | add r4, 8
+ |.else
+ | sub r4, 4
+ | mov r0, aword [r0]
+ | add r0, offsetof(zend_string, val)
+ | push r0
+ | push "Undefined index: %s"
+ | push E_NOTICE
+ | EXT_CALL zend_error, r0
+ | add r4, 28
+ |.endif
+ | ret
+
+ return 1;
+}
+
+static int zend_jit_cannot_add_element_ex_stub(dasm_State **Dst)
+{
+ |->cannot_add_element_ex:
+ | SAVE_OPLINE
+ | jmp ->cannot_add_element
+
+ return 1;
+}
+
+static int zend_jit_cannot_add_element_stub(dasm_State **Dst)
+{
+ |->cannot_add_element:
+ |.if X64WIN
+ | sub r4, 0x28
+ |.elif X64
+ | sub r4, 8
+ |.else
+ | sub r4, 12
+ |.endif
+ | mov r0, EX->opline
+ | cmp byte OP:r0->result_type, IS_UNUSED
+ | jz >1
+ |.if X64
+ | movsxd r0, dword OP:r0->result.var
+ |.else
+ | mov r0, OP:r0->result.var
+ |.endif
+ | SET_Z_TYPE_INFO FP + r0, IS_NULL
+ |1:
+ |.if X64WIN
+ | xor CARG1, CARG1
+ | LOAD_ADDR CARG2, "Cannot add element to the array as the next element is already occupied"
+ | EXT_CALL zend_throw_error, r0
+ | add r4, 0x28
+ |.elif X64
+ | xor CARG1, CARG1
+ | LOAD_ADDR CARG2, "Cannot add element to the array as the next element is already occupied"
+ | EXT_CALL zend_throw_error, r0
+ | add r4, 8
+ |.else
+ | sub r4, 8
+ | push "Cannot add element to the array as the next element is already occupied"
+ | push 0
+ | EXT_CALL zend_throw_error, r0
+ | add r4, 28
+ |.endif
+ | ret
+
+ return 1;
+}
+
+static int zend_jit_undefined_function_stub(dasm_State **Dst)
+{
+ |->undefined_function:
+ | mov r0, aword EX->opline
+ |.if X64
+ | xor CARG1, CARG1
+ | LOAD_ADDR CARG2, "Call to undefined function %s()"
+ | movsxd CARG3, dword [r0 + offsetof(zend_op, op2.constant)]
+ | mov CARG3, aword [r0 + CARG3]
+ | add CARG3, offsetof(zend_string, val)
+ | EXT_CALL zend_throw_error, r0
+ |.else
+ | sub r4, 4
+ | mov r0, aword [r0 + offsetof(zend_op, op2.zv)]
+ | mov r0, aword [r0]
+ | add r0, offsetof(zend_string, val)
+ | push r0
+ | push "Call to undefined function %s()"
+ | push 0
+ | EXT_CALL zend_throw_error, r0
+ | add r4, 16
+ |.endif
+ | jmp ->exception_handler
+ return 1;
+}
+
+static int zend_jit_negative_shift_stub(dasm_State **Dst)
+{
+ |->negative_shift:
+ | UNDEF_OPLINE_RESULT
+ |.if X64
+ |.if WIN
+ | LOAD_ADDR CARG1, &zend_ce_arithmetic_error
+ | mov CARG1, aword [CARG1]
+ |.else
+ | LOAD_ADDR CARG1, zend_ce_arithmetic_error
+ |.endif
+ | LOAD_ADDR CARG2, "Bit shift by negative number"
+ | EXT_CALL zend_throw_error, r0
+ |.else
+ | sub r4, 8
+ | push "Bit shift by negative number"
+ |.if WIN
+ | LOAD_ADDR r0, &zend_ce_arithmetic_error
+ | push aword [r0]
+ |.else
+ | PUSH_ADDR zend_ce_arithmetic_error, r0
+ |.endif
+ | EXT_CALL zend_throw_error, r0
+ | add r4, 16
+ |.endif
+ | jmp ->exception_handler
+ return 1;
+}
+
+static int zend_jit_mod_by_zero_stub(dasm_State **Dst)
+{
+ |->mod_by_zero:
+ | UNDEF_OPLINE_RESULT
+ |.if X64
+ |.if WIN
+ | LOAD_ADDR CARG1, &zend_ce_division_by_zero_error
+ | mov CARG1, aword [CARG1]
+ |.else
+ | LOAD_ADDR CARG1, zend_ce_division_by_zero_error
+ |.endif
+ | LOAD_ADDR CARG2, "Modulo by zero"
+ | EXT_CALL zend_throw_error, r0
+ |.else
+ | sub r4, 8
+ | push "Modulo by zero"
+ |.if WIN
+ | LOAD_ADDR r0, &zend_ce_division_by_zero_error
+ | push aword [r0]
+ |.else
+ | PUSH_ADDR zend_ce_division_by_zero_error, r0
+ |.endif
+ | EXT_CALL zend_throw_error, r0
+ | add r4, 16
+ |.endif
+ | jmp ->exception_handler
+ return 1;
+}
+
+static int zend_jit_double_one_stub(dasm_State **Dst)
+{
+ |->one:
+ |.dword 0, 0x3ff00000
+ return 1;
+}
+
+static int zend_jit_hybrid_runtime_jit_stub(dasm_State **Dst)
+{
+ |->hybrid_runtime_jit:
+ | EXT_CALL zend_runtime_jit, r0
+ | JMP_IP
+ return 1;
+}
+
+static int zend_jit_hybrid_profile_jit_stub(dasm_State **Dst)
+{
+ |->hybrid_profile_jit:
+ | // ++zend_jit_profile_counter;
+ | .if X64
+ | LOAD_ADDR r0, &zend_jit_profile_counter
+ | inc aword [r0]
+ | .else
+ | inc aword [&zend_jit_profile_counter]
+ | .endif
+ | // op_array = (zend_op_array*)EX(func);
+ | mov r0, EX->func
+ | // ++ZEND_COUNTER_INFO(op_array)
+ | mov r2, aword [r0 + offsetof(zend_op_array, run_time_cache__ptr)]
+#if ZEND_MAP_PTR_KIND == ZEND_MAP_PTR_KIND_PTR
+ | mov r2, aword [r2]
+#elif ZEND_MAP_PTR_KIND == ZEND_MAP_PTR_KIND_PTR_OR_OFFSET
+ | test r2, 1
+ | jz >1
+ | MEM_OP2_2_ZTS add, r2, aword, compiler_globals, map_ptr_base, r1
+ |1:
+ | mov r2, aword [r2]
+#else
+# error "Unknown ZEND_MAP_PTR_KIND"
+#endif
+ | inc aword [r2 + zend_jit_profile_counter_rid * sizeof(void*)]
+ | // handler = (const void*)ZEND_FUNC_INFO(op_array);
+ | mov r0, aword [r0 + offsetof(zend_op_array, reserved[zend_func_info_rid])]
+ | // return ((zend_vm_opcode_handler_t)handler)();
+ | jmp r0
+ return 1;
+}
+
+/*
+ * This code is based Mike Pall's "Hashed profile counters" idea, implemented
+ * in LuaJIT. The full description may be found in "LuaJIT 2.0 intellectual
+ * property disclosure and research opportunities" email
+ * at http://lua-users.org/lists/lua-l/2009-11/msg00089.html
+ *
+ * In addition we use a variation of Knuth's multiplicative hash function
+ * described at https://code.i-harness.com/en/q/a21ce
+ *
+ * uint64_t hash(uint64_t x) {
+ * x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
+ * x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
+ * x = x ^ (x >> 31);
+ * return x;
+ * }
+ *
+ * uint_32_t hash(uint32_t x) {
+ * x = ((x >> 16) ^ x) * 0x45d9f3b;
+ * x = ((x >> 16) ^ x) * 0x45d9f3b;
+ * x = (x >> 16) ^ x;
+ * return x;
+ * }
+ *
+ */
+static int zend_jit_hybrid_func_counter_stub(dasm_State **Dst)
+{
+ |->hybrid_func_counter:
+ | mov r0, EX->func
+ | mov r1, aword [r0 + offsetof(zend_op_array, reserved[zend_func_info_rid])]
+ | mov r2, aword [r1]
+ | sub word [r2], ZEND_JIT_HOT_FUNC_COST
+ | jle >1
+ | GET_IP r2
+ | sub r2, aword [r0 + offsetof(zend_op_array, opcodes)]
+ | // divide by sizeof(zend_op)
+ | .if X64
+ || ZEND_ASSERT(sizeof(zend_op) == 32);
+ | sar r2, 5
+ | .else
+ || ZEND_ASSERT(sizeof(zend_op) == 28);
+ | sar r2, 2
+ | imul r2, 0xb6db6db7
+ | .endif
+ | .if X64
+ | jmp aword [r1+r2*8+8]
+ | .else
+ | jmp aword [r1+r2*4+4]
+ | .endif
+ |1:
+ | mov FCARG1a, FP
+ | GET_IP FCARG2a
+ | EXT_CALL zend_jit_hot_func, r0
+ | JMP_IP
+ return 1;
+}
+
+static int zend_jit_hybrid_loop_counter_stub(dasm_State **Dst)
+{
+ |->hybrid_loop_counter:
+ | mov r0, EX->func
+ | mov r1, aword [r0 + offsetof(zend_op_array, reserved[zend_func_info_rid])]
+ | mov r2, aword [r1]
+ | sub word [r2], ZEND_JIT_HOT_LOOP_COST
+ | jle >1
+ | GET_IP r2
+ | sub r2, aword [r0 + offsetof(zend_op_array, opcodes)]
+ | // divide by sizeof(zend_op)
+ | .if X64
+ || ZEND_ASSERT(sizeof(zend_op) == 32);
+ | sar r2, 5
+ | .else
+ || ZEND_ASSERT(sizeof(zend_op) == 28);
+ | sar r2, 2
+ | imul r2, 0xb6db6db7
+ | .endif
+ | .if X64
+ | jmp aword [r1+r2*8+8]
+ | .else
+ | jmp aword [r1+r2*4+4]
+ | .endif
+ |1:
+ | mov FCARG1a, FP
+ | GET_IP FCARG2a
+ | EXT_CALL zend_jit_hot_func, r0
+ | JMP_IP
+ return 1;
+}
+
+#ifdef CONTEXT_THREADED_JIT
+static int zend_jit_context_threaded_call_stub(dasm_State **Dst)
+{
+ |->context_threaded_call:
+ | pop r0
+ if (zend_jit_vm_kind == ZEND_VM_KIND_HYBRID) {
+ | add r4, HYBRID_SPAD
+ | jmp aword [IP]
+ } else if (GCC_GLOBAL_REGS) {
+ | add r4, SPAD // stack alignment
+ | jmp aword [IP]
+ } else {
+ ZEND_ASSERT(0);
+ // TODO: context threading can't work without GLOBAL REGS because we have to change
+ // the value of execute_data in execute_ex()
+ | mov FCARG1a, FP
+ | mov r0, aword [FP]
+ | mov FP, aword T2 // restore FP
+ | mov RX, aword T3 // restore IP
+ | add r4, NR_SPAD // stack alignment
+ | jmp aword [r0]
+ }
+ return 1;
+}
+#endif
+
+static const zend_jit_stub zend_jit_stubs[] = {
+ JIT_STUB(interrupt_handler),
+ JIT_STUB(exception_handler),
+ JIT_STUB(exception_handler_undef),
+ JIT_STUB(leave_function),
+ JIT_STUB(leave_throw),
+ JIT_STUB(icall_throw),
+ JIT_STUB(throw_cannot_pass_by_ref),
+ JIT_STUB(undefined_offset),
+ JIT_STUB(undefined_index),
+ JIT_STUB(cannot_add_element),
+ JIT_STUB(undefined_offset_ex),
+ JIT_STUB(undefined_index_ex),
+ JIT_STUB(cannot_add_element_ex),
+ JIT_STUB(undefined_function),
+ JIT_STUB(negative_shift),
+ JIT_STUB(mod_by_zero),
+ JIT_STUB(double_one),
+#ifdef CONTEXT_THREADED_JIT
+ JIT_STUB(context_threaded_call),
+#endif
+};
+
+#if ZTS && defined(ZEND_WIN32)
+extern uint32_t _tls_index;
+extern char *_tls_start;
+extern char *_tls_end;
+#endif
+
+static int zend_jit_setup(void)
+{
+ if (!zend_cpu_supports(ZEND_CPU_FEATURE_SSE2)) {
+ zend_error(E_CORE_ERROR, "CPU doesn't support SSE2");
+ return FAILURE;
+ }
+ if (zend_jit_cpu_flags & ZEND_JIT_CPU_AVX) {
+ if (zend_cpu_supports(ZEND_CPU_FEATURE_AVX)) {
+ zend_jit_x86_flags |= ZEND_JIT_CPU_AVX;
+ }
+ }
+
+#if ZTS
+# ifdef _WIN64
+ tsrm_tls_index = _tls_index * sizeof(void*);
+
+ /* To find offset of "_tsrm_ls_cache" in TLS segment we perform a linear scan of local TLS memory */
+ /* Probably, it might be better solution */
+ do {
+ void ***tls_mem = ((void***)__readgsqword(0x58))[_tls_index];
+ void *val = _tsrm_ls_cache;
+ size_t offset = 0;
+ size_t size = (char*)&_tls_end - (char*)&_tls_start;
+
+ while (offset < size) {
+ if (*tls_mem == val) {
+ tsrm_tls_offset = offset;
+ break;
+ }
+ tls_mem++;
+ offset += sizeof(void*);
+ }
+ if (offset >= size) {
+ // TODO: error message ???
+ return FAILURE;
+ }
+ } while(0);
+# elif ZEND_WIN32
+ tsrm_tls_index = _tls_index * sizeof(void*);
+
+ /* To find offset of "_tsrm_ls_cache" in TLS segment we perform a linear scan of local TLS memory */
+ /* Probably, it might be better solution */
+ do {
+ void ***tls_mem = ((void***)__readfsdword(0x2c))[_tls_index];
+ void *val = _tsrm_ls_cache;
+ size_t offset = 0;
+ size_t size = (char*)&_tls_end - (char*)&_tls_start;
+
+ while (offset < size) {
+ if (*tls_mem == val) {
+ tsrm_tls_offset = offset;
+ break;
+ }
+ tls_mem++;
+ offset += sizeof(void*);
+ }
+ if (offset >= size) {
+ // TODO: error message ???
+ return FAILURE;
+ }
+ } while(0);
+# elif defined(__APPLE__) && defined(__x86_64__)
+ tsrm_ls_cache_tcb_offset = tsrm_get_ls_cache_tcb_offset();
+ if (tsrm_ls_cache_tcb_offset == 0) {
+ size_t *ti;
+ __asm__(
+ "leaq __tsrm_ls_cache(%%rip),%0"
+ : "=r" (ti));
+ tsrm_tls_offset = ti[2];
+ tsrm_tls_index = ti[1] * 8;
+ }
+# elif defined(__GNUC__) && defined(__x86_64__)
+ tsrm_ls_cache_tcb_offset = tsrm_get_ls_cache_tcb_offset();
+ if (tsrm_ls_cache_tcb_offset == 0) {
+#if defined(__has_attribute) && __has_attribute(tls_model)
+ size_t ret;
+
+ asm ("movq _tsrm_ls_cache@gottpoff(%%rip),%0"
+ : "=r" (ret));
+ tsrm_ls_cache_tcb_offset = ret;
+#else
+ size_t *ti;
+
+ __asm__(
+ "leaq _tsrm_ls_cache@tlsgd(%%rip), %0\n"
+ : "=a" (ti));
+ tsrm_tls_offset = ti[1];
+ tsrm_tls_index = ti[0] * 16;
+#endif
+ }
+# elif defined(__GNUC__) && defined(__i386__)
+ tsrm_ls_cache_tcb_offset = tsrm_get_ls_cache_tcb_offset();
+ if (tsrm_ls_cache_tcb_offset == 0) {
+#if 1
+ size_t ret;
+
+ asm ("leal _tsrm_ls_cache@ntpoff,%0\n"
+ : "=a" (ret));
+ tsrm_ls_cache_tcb_offset = ret;
+#else
+ size_t *ti, _ebx, _ecx, _edx;
+
+ __asm__(
+ "call 1f\n"
+ ".subsection 1\n"
+ "1:\tmovl (%%esp), %%ebx\n\t"
+ "ret\n"
+ ".previous\n\t"
+ "addl $_GLOBAL_OFFSET_TABLE_, %%ebx\n\t"
+ "leal _tsrm_ls_cache@tlsldm(%%ebx), %0\n\t"
+ "call ___tls_get_addr@plt\n\t"
+ "leal _tsrm_ls_cache@tlsldm(%%ebx), %0\n"
+ : "=a" (ti), "=&b" (_ebx), "=&c" (_ecx), "=&d" (_edx));
+ tsrm_tls_offset = ti[1];
+ tsrm_tls_index = ti[0] * 8;
+#endif
+ }
+# endif
+#endif
+
+ return SUCCESS;
+}
+
+static int zend_jit_align_func(dasm_State **Dst)
+{
+ reuse_ip = 0;
+ delayed_call_chain = 0;
+ last_valid_opline = NULL;
+ jit_return_label = -1;
+ |.align 16
+ return 1;
+}
+
+static int zend_jit_prologue(dasm_State **Dst)
+{
+ if (zend_jit_vm_kind == ZEND_VM_KIND_HYBRID) {
+ | sub r4, HYBRID_SPAD
+ } else if (GCC_GLOBAL_REGS) {
+ | sub r4, SPAD // stack alignment
+ } else {
+ | sub r4, NR_SPAD // stack alignment
+ | mov aword T2, FP // save FP
+ | mov aword T3, RX // save IP
+ | mov FP, FCARG1a
+ }
+ return 1;
+}
+
+static int zend_jit_label(dasm_State **Dst, unsigned int label)
+{
+ |=>label:
+ return 1;
+}
+
+static int zend_jit_save_call_chain(dasm_State **Dst, uint32_t call_level)
+{
+ | // call->prev_execute_data = EX(call);
+ if (call_level == 1) {
+ | mov aword EX:RX->prev_execute_data, 0
+ } else {
+ | mov r0, EX->call
+ | mov EX:RX->prev_execute_data, r0
+ }
+ | // EX(call) = call;
+ | mov EX->call, RX
+
+ delayed_call_chain = 0;
+
+ return 1;
+}
+
+static int zend_jit_set_ip(dasm_State **Dst, const zend_op *opline)
+{
+ if (!last_valid_opline) {
+ | LOAD_IP_ADDR opline
+ } else if (last_valid_opline != opline) {
+ if (GCC_GLOBAL_REGS) {
+ | ADD_IP (opline - last_valid_opline) * sizeof(zend_op);
+ } else {
+ | LOAD_IP_ADDR opline
+ }
+ }
+ return 1;
+}
+
+static int zend_jit_set_valid_ip(dasm_State **Dst, const zend_op *opline)
+{
+ if (delayed_call_chain) {
+ if (!zend_jit_save_call_chain(Dst, delayed_call_level)) {
+ return 0;
+ }
+ }
+ if (!zend_jit_set_ip(Dst, opline)) {
+ return 0;
+ }
+ last_valid_opline = opline;
+ reuse_ip = 0;
+ return 1;
+}
+
+static int zend_jit_check_timeout(dasm_State **Dst, const zend_op *opline)
+{
+#if 0
+ if (!zend_jit_set_valid_ip(Dst, opline)) {
+ return 0;
+ }
+ | MEM_OP2_1_ZTS cmp, byte, executor_globals, vm_interrupt, 0, r0
+ | jne ->interrupt_handler
+#else
+ | MEM_OP2_1_ZTS cmp, byte, executor_globals, vm_interrupt, 0, r0
+ if (last_valid_opline == opline) {
+ | jne ->interrupt_handler
+ } else {
+ | jne >1
+ |.cold_code
+ |1:
+ | LOAD_IP_ADDR opline
+ | jmp ->interrupt_handler
+ |.code
+ }
+#endif
+ return 1;
+}
+
+static int zend_jit_check_exception(dasm_State **Dst)
+{
+ | MEM_OP2_1_ZTS cmp, aword, executor_globals, exception, 0, r0
+ | jne ->exception_handler
+ return 1;
+}
+
+static int zend_jit_check_exception_undef_result(dasm_State **Dst, const zend_op *opline)
+{
+ if (opline->result_type & (IS_TMP_VAR|IS_VAR)) {
+ | MEM_OP2_1_ZTS cmp, aword, executor_globals, exception, 0, r0
+ | jne ->exception_handler_undef
+ return 1;
+ }
+ return zend_jit_check_exception(Dst);
+}
+
+static int zend_jit_handler(dasm_State **Dst, const zend_op *opline, int may_throw)
+{
+ const void *handler;
+
+ if (zend_jit_vm_kind == ZEND_VM_KIND_HYBRID) {
+ handler = zend_get_opcode_handler_func(opline);
+ } else {
+ handler = opline->handler;
+ }
+
+ if (!zend_jit_set_valid_ip(Dst, opline)) {
+ return 0;
+ }
+ if (!GCC_GLOBAL_REGS) {
+ | mov FCARG1a, FP
+ }
+ | EXT_CALL handler, r0
+ if (may_throw) {
+ zend_jit_check_exception(Dst);
+ }
+ last_valid_opline++;
+
+ /* Skip the following OP_DATA */
+ switch (opline->opcode) {
+ case ZEND_ASSIGN_DIM:
+ case ZEND_ASSIGN_OBJ:
+ case ZEND_ASSIGN_STATIC_PROP:
+ case ZEND_ASSIGN_DIM_OP:
+ case ZEND_ASSIGN_OBJ_OP:
+ case ZEND_ASSIGN_STATIC_PROP_OP:
+ case ZEND_ASSIGN_STATIC_PROP_REF:
+ case ZEND_ASSIGN_OBJ_REF:
+ last_valid_opline++;
+ break;
+ default:
+ break;
+ }
+
+ return 1;
+}
+
+static int zend_jit_tail_handler(dasm_State **Dst, const zend_op *opline)
+{
+ if (!zend_jit_set_valid_ip(Dst, opline)) {
+ return 0;
+ }
+ if (zend_jit_vm_kind == ZEND_VM_KIND_HYBRID) {
+ if (opline->opcode == ZEND_DO_UCALL ||
+ opline->opcode == ZEND_DO_FCALL_BY_NAME ||
+ opline->opcode == ZEND_DO_FCALL ||
+ opline->opcode == ZEND_RETURN) {
+
+ /* Use inlined HYBRID VM handler */
+ const void *handler = opline->handler;
+
+ | add r4, HYBRID_SPAD
+ | EXT_JMP handler, r0
+ } else {
+ const void *handler = zend_get_opcode_handler_func(opline);
+
+ | EXT_CALL handler, r0
+ | add r4, HYBRID_SPAD
+ | JMP_IP
+ }
+ } else {
+ const void *handler = opline->handler;
+
+ if (GCC_GLOBAL_REGS) {
+ | add r4, SPAD // stack alignment
+ } else {
+ | mov FCARG1a, FP
+ | mov FP, aword T2 // restore FP
+ | mov RX, aword T3 // restore IP
+ | add r4, NR_SPAD // stack alignment
+ }
+ | EXT_JMP handler, r0
+ }
+ last_valid_opline = NULL;
+ return 1;
+}
+
+static int zend_jit_set_opline(dasm_State **Dst, const zend_op *target_opline)
+{
+ if (!reuse_ip) {
+ last_valid_opline = target_opline;
+ }
+ return 1;
+}
+
+static int zend_jit_reset_opline(dasm_State **Dst, const zend_op *target_opline)
+{
+ last_valid_opline = NULL;
+ return 1;
+}
+
+static void zend_jit_start_reuse_ip(void) {
+ last_valid_opline = NULL;
+ reuse_ip = 1;
+}
+
+static void zend_jit_stop_reuse_ip(void) {
+ reuse_ip = 0;
+}
+
+static int zend_jit_jmp(dasm_State **Dst, unsigned int target_label)
+{
+ | jmp =>target_label
+ return 1;
+}
+
+static int zend_jit_cond_jmp(dasm_State **Dst, const zend_op *next_opline, unsigned int target_label)
+{
+ | CMP_IP next_opline
+ | jne =>target_label
+
+ last_valid_opline = next_opline;
+
+ return 1;
+}
+
+#ifdef CONTEXT_THREADED_JIT
+static int zend_jit_context_threaded_call(dasm_State **Dst, const zend_op *opline, unsigned int next_block)
+{
+ if (!zend_jit_handler(Dst, opline, 1)) return 0;
+ if (opline->opcode == ZEND_DO_UCALL) {
+ | call ->context_threaded_call
+ } else {
+ const zend_op *next_opline = opline + 1;
+
+ | CMP_IP next_opline
+ | je =>next_block
+ | call ->context_threaded_call
+ }
+ return 1;
+}
+#endif
+
+static int zend_jit_call(dasm_State **Dst, const zend_op *opline, unsigned int next_block)
+{
+#ifdef CONTEXT_THREADED_JIT
+ return zend_jit_context_threaded_call(Dst, opline, next_block);
+#else
+ return zend_jit_tail_handler(Dst, opline);
+#endif
+}
+
+static int zend_jit_spill_store(dasm_State **Dst, zend_jit_addr src, zend_jit_addr dst, uint32_t info, zend_bool set_type)
+{
+ ZEND_ASSERT(Z_MODE(src) == IS_REG);
+ ZEND_ASSERT(Z_MODE(dst) == IS_MEM_ZVAL);
+
+ if ((info & MAY_BE_ANY) == MAY_BE_LONG) {
+ | SET_ZVAL_LVAL dst, Ra(Z_REG(src))
+ if (set_type) {
+ | SET_ZVAL_TYPE_INFO dst, IS_LONG
+ }
+ } else if ((info & MAY_BE_ANY) == MAY_BE_DOUBLE) {
+ | SSE_SET_ZVAL_DVAL dst, Z_REG(src)
+ if (set_type) {
+ | SET_ZVAL_TYPE_INFO dst, IS_DOUBLE
+ }
+ } else {
+ ZEND_ASSERT(0);
+ }
+ return 1;
+}
+
+static int zend_jit_load_reg(dasm_State **Dst, zend_jit_addr src, zend_jit_addr dst, uint32_t info)
+{
+ ZEND_ASSERT(Z_MODE(src) == IS_MEM_ZVAL);
+ ZEND_ASSERT(Z_MODE(dst) == IS_REG);
+
+ if ((info & MAY_BE_ANY) == MAY_BE_LONG) {
+ | GET_ZVAL_LVAL Z_REG(dst), src
+ } else if ((info & MAY_BE_ANY) == MAY_BE_DOUBLE) {
+ | SSE_GET_ZVAL_DVAL Z_REG(dst), src
+ } else {
+ ZEND_ASSERT(0);
+ }
+ return 1;
+}
+
+static int zend_jit_store_var(dasm_State **Dst, uint32_t info, int var, zend_reg reg)
+{
+ zend_jit_addr src = ZEND_ADDR_REG(reg);
+ zend_jit_addr dst = ZEND_ADDR_MEM_ZVAL(ZREG_FP, (uint32_t)(uintptr_t)ZEND_CALL_VAR_NUM(NULL, var));
+
+ return zend_jit_spill_store(Dst, src, dst, info, 1);
+}
+
+static int zend_jit_store_var_if_necessary(dasm_State **Dst, int var, zend_jit_addr src, uint32_t info)
+{
+ if (Z_MODE(src) == IS_REG && Z_STORE(src)) {
+ zend_jit_addr dst = ZEND_ADDR_MEM_ZVAL(ZREG_FP, (uint32_t)(uintptr_t)ZEND_CALL_VAR(NULL, var));
+ return zend_jit_spill_store(Dst, src, dst, info, 1);
+ }
+ return 1;
+}
+
+static int zend_jit_store_var_if_necessary_ex(dasm_State **Dst, int var, zend_jit_addr src, uint32_t info, zend_jit_addr old, uint32_t old_info)
+{
+ if (Z_MODE(src) == IS_REG && Z_STORE(src)) {
+ zend_jit_addr dst = ZEND_ADDR_MEM_ZVAL(ZREG_FP, (uint32_t)(uintptr_t)ZEND_CALL_VAR(NULL, var));
+ zend_bool set_type = 1;
+
+ if ((info & (MAY_BE_ANY|MAY_BE_REF|MAY_BE_UNDEF)) ==
+ (old_info & (MAY_BE_ANY|MAY_BE_REF|MAY_BE_UNDEF))) {
+ if (Z_MODE(old) != IS_REG || Z_LOAD(old) || Z_STORE(old)) {
+ set_type = 0;
+ }
+ }
+ return zend_jit_spill_store(Dst, src, dst, info, set_type);
+ }
+ return 1;
+}
+
+static int zend_jit_load_var(dasm_State **Dst, uint32_t info, int var, zend_reg reg)
+{
+ zend_jit_addr src = ZEND_ADDR_MEM_ZVAL(ZREG_FP, (uint32_t)(uintptr_t)ZEND_CALL_VAR_NUM(NULL, var));
+ zend_jit_addr dst = ZEND_ADDR_REG(reg);
+
+ return zend_jit_load_reg(Dst, src, dst, info);
+}
+
+static int zend_jit_update_regs(dasm_State **Dst, zend_jit_addr src, zend_jit_addr dst, uint32_t info)
+{
+ if (!zend_jit_same_addr(src, dst)) {
+ if (Z_MODE(src) == IS_REG) {
+ if (Z_MODE(dst) == IS_REG) {
+ if ((info & MAY_BE_ANY) == MAY_BE_LONG) {
+ | mov Ra(Z_REG(dst)), Ra(Z_REG(src))
+ } else if ((info & MAY_BE_ANY) == MAY_BE_DOUBLE) {
+ | SSE_AVX_INS movsd, vmovaps, xmm(Z_REG(dst)-ZREG_XMM0), xmm(Z_REG(src)-ZREG_XMM0)
+ } else {
+ ZEND_ASSERT(0);
+ }
+ } else if (Z_MODE(dst) == IS_MEM_ZVAL) {
+ if (!Z_LOAD(src) && !Z_STORE(src)) {
+ if (!zend_jit_spill_store(Dst, src, dst, info, 1)) {
+ return 0;
+ }
+ }
+ } else {
+ ZEND_ASSERT(0);
+ }
+ } else if (Z_MODE(src) == IS_MEM_ZVAL) {
+ if (Z_MODE(dst) == IS_REG) {
+ if (!zend_jit_load_reg(Dst, src, dst, info)) {
+ return 0;
+ }
+ } else {
+ ZEND_ASSERT(0);
+ }
+ } else {
+ ZEND_ASSERT(0);
+ }
+ }
+ return 1;
+}
+
+static int zend_jit_inc_dec(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, uint32_t op1_info, zend_jit_addr op1_addr, uint32_t op1_def_info, zend_jit_addr op1_def_addr, uint32_t res_use_info, uint32_t res_info, zend_jit_addr res_addr, int may_overflow)
+{
+ if (op1_info & ((MAY_BE_UNDEF|MAY_BE_ANY)-MAY_BE_LONG)) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_LONG, >2
+ }
+ if (opline->opcode == ZEND_POST_INC || opline->opcode == ZEND_POST_DEC) {
+ | ZVAL_COPY_VALUE res_addr, res_use_info, op1_addr, MAY_BE_LONG, ZREG_R0, ZREG_R1
+ }
+ if (!zend_jit_update_regs(Dst, op1_addr, op1_def_addr, MAY_BE_LONG)) {
+ return 0;
+ }
+ if (opline->opcode == ZEND_PRE_INC || opline->opcode == ZEND_POST_INC) {
+ | LONG_OP_WITH_CONST add, op1_def_addr, Z_L(1)
+ } else {
+ | LONG_OP_WITH_CONST sub, op1_def_addr, Z_L(1)
+ }
+
+ if (may_overflow) {
+ | jo >1
+ if ((opline->opcode == ZEND_PRE_INC || opline->opcode == ZEND_PRE_DEC) &&
+ opline->result_type != IS_UNUSED) {
+ | ZVAL_COPY_VALUE res_addr, res_use_info, op1_def_addr, MAY_BE_LONG, ZREG_R0, ZREG_R1
+ }
+ |.cold_code
+ |1:
+ if (opline->opcode == ZEND_PRE_INC || opline->opcode == ZEND_POST_INC) {
+ |.if X64
+ | mov64 rax, 0x43e0000000000000
+ | SET_ZVAL_LVAL op1_def_addr, rax
+ |.else
+ | SET_ZVAL_LVAL op1_def_addr, 0
+ | SET_ZVAL_W2 op1_def_addr, 0x41e00000
+ |.endif
+ } else {
+ |.if X64
+ | mov64 rax, 0xc3e0000000000000
+ | SET_ZVAL_LVAL op1_def_addr, rax
+ |.else
+ | SET_ZVAL_LVAL op1_def_addr, 0x00200000
+ | SET_ZVAL_W2 op1_def_addr, 0xc1e00000
+ |.endif
+ }
+ | SET_ZVAL_TYPE_INFO op1_def_addr, IS_DOUBLE
+ if ((opline->opcode == ZEND_PRE_INC || opline->opcode == ZEND_PRE_DEC) &&
+ opline->result_type != IS_UNUSED) {
+ | ZVAL_COPY_VALUE res_addr, res_use_info, op1_def_addr, MAY_BE_DOUBLE, ZREG_R0, ZREG_R1
+ }
+ | jmp >3
+ |.code
+ } else {
+ if ((opline->opcode == ZEND_PRE_INC || opline->opcode == ZEND_PRE_DEC) &&
+ opline->result_type != IS_UNUSED) {
+ | ZVAL_COPY_VALUE res_addr, res_use_info, op1_def_addr, MAY_BE_LONG, ZREG_R0, ZREG_R1
+ }
+ }
+ if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_LONG)) {
+ |.cold_code
+ |2:
+ if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_LONG|MAY_BE_DOUBLE))) {
+ | SAVE_VALID_OPLINE opline
+ if (op1_info & MAY_BE_UNDEF) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_UNDEF, >2
+ | // zend_error(E_WARNING, "Undefined variable: %s", ZSTR_VAL(CV_DEF_OF(EX_VAR_TO_NUM(opline->op1.var))));
+ | mov FCARG1d, opline->op1.var
+ | EXT_CALL zend_jit_undefined_op_helper, r0
+ | SET_ZVAL_TYPE_INFO op1_addr, IS_NULL
+ op1_info |= MAY_BE_NULL;
+ }
+ |2:
+ | LOAD_ZVAL_ADDR FCARG1a, op1_addr
+
+ | // ZVAL_DEREF(var_ptr);
+ if (op1_info & MAY_BE_REF) {
+ | IF_NOT_Z_TYPE, FCARG1a, IS_REFERENCE, >2
+ | GET_Z_PTR FCARG2a, FCARG1a
+ | cmp aword [FCARG2a + offsetof(zend_reference, sources.ptr)], 0
+ | lea FCARG1a, [FCARG2a + offsetof(zend_reference, val)]
+ | jz >2
+ |.if X64
+ if (RETURN_VALUE_USED(opline)) {
+ | LOAD_ZVAL_ADDR CARG3, res_addr
+ } else {
+ | mov CARG3, 0
+ }
+ |.else
+ | sub r4, 12
+ if (RETURN_VALUE_USED(opline)) {
+ | PUSH_ZVAL_ADDR res_addr, r0
+ } else {
+ | push 0
+ }
+ |.endif
+ if (opline->opcode == ZEND_PRE_INC) {
+ | EXT_CALL zend_jit_pre_inc_typed_ref, r0
+ } else if (opline->opcode == ZEND_PRE_DEC) {
+ | EXT_CALL zend_jit_pre_dec_typed_ref, r0
+ } else if (opline->opcode == ZEND_POST_INC) {
+ | EXT_CALL zend_jit_post_inc_typed_ref, r0
+ } else if (opline->opcode == ZEND_POST_DEC) {
+ | EXT_CALL zend_jit_post_dec_typed_ref, r0
+ } else {
+ ZEND_ASSERT(0);
+ }
+ |.if not(X64)
+ | add r4, 12
+ |.endif
+ zend_jit_check_exception(Dst);
+ | jmp >3
+ |2:
+ }
+
+ if (opline->opcode == ZEND_POST_INC || opline->opcode == ZEND_POST_DEC) {
+ zend_jit_addr val_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 0);
+
+ | ZVAL_COPY_VALUE res_addr, res_use_info, val_addr, op1_info, ZREG_R0, ZREG_R2
+ | TRY_ADDREF op1_info, ah, r2
+ }
+ if (opline->opcode == ZEND_PRE_INC || opline->opcode == ZEND_POST_INC) {
+ if (opline->opcode == ZEND_PRE_INC && opline->result_type != IS_UNUSED) {
+ | LOAD_ZVAL_ADDR FCARG2a, res_addr
+ | EXT_CALL zend_jit_pre_inc, r0
+ } else {
+ | EXT_CALL increment_function, r0
+ }
+ } else {
+ if (opline->opcode == ZEND_PRE_DEC && opline->result_type != IS_UNUSED) {
+ | LOAD_ZVAL_ADDR FCARG2a, res_addr
+ | EXT_CALL zend_jit_pre_dec, r0
+ } else {
+ | EXT_CALL decrement_function, r0
+ }
+ }
+ } else {
+ zend_reg tmp_reg;
+
+ if (opline->opcode == ZEND_POST_INC || opline->opcode == ZEND_POST_DEC) {
+ | ZVAL_COPY_VALUE res_addr, res_use_info, op1_addr, MAY_BE_DOUBLE, ZREG_R0, ZREG_R2
+ }
+ if (Z_MODE(op1_def_addr) == IS_REG) {
+ tmp_reg = Z_REG(op1_def_addr);
+ } else if (Z_MODE(op1_addr) == IS_REG && Z_LAST_USE(op1_addr)) {
+ tmp_reg = Z_REG(op1_addr);
+ } else {
+ tmp_reg = ZREG_XMM0;
+ }
+ | SSE_GET_ZVAL_DVAL tmp_reg, op1_addr
+ if (opline->opcode == ZEND_PRE_INC || opline->opcode == ZEND_POST_INC) {
+ if (zend_jit_x86_flags & ZEND_JIT_CPU_AVX) {
+ | vaddsd xmm(tmp_reg-ZREG_XMM0), xmm(tmp_reg-ZREG_XMM0), qword [->one]
+ } else {
+ | addsd xmm(tmp_reg-ZREG_XMM0), qword [->one]
+ }
+ } else {
+ if (zend_jit_x86_flags & ZEND_JIT_CPU_AVX) {
+ | vsubsd xmm(tmp_reg-ZREG_XMM0), xmm(tmp_reg-ZREG_XMM0), qword [->one]
+ } else {
+ | subsd xmm(tmp_reg-ZREG_XMM0), qword [->one]
+ }
+ }
+ | SSE_SET_ZVAL_DVAL op1_def_addr, tmp_reg
+ if ((opline->opcode == ZEND_PRE_INC || opline->opcode == ZEND_PRE_DEC) &&
+ opline->result_type != IS_UNUSED) {
+ | ZVAL_COPY_VALUE res_addr, res_use_info, op1_addr, op1_def_info, ZREG_R0, ZREG_R1
+ | TRY_ADDREF op1_def_info, ah, r1
+ }
+ }
+ | jmp >3
+ |.code
+ }
+ |3:
+ if (!zend_jit_store_var_if_necessary_ex(Dst, opline->op1.var, op1_def_addr, op1_def_info, op1_addr, op1_info)) {
+ return 0;
+ }
+ if (opline->result_type != IS_UNUSED) {
+ if (!zend_jit_store_var_if_necessary(Dst, opline->result.var, res_addr, res_info)) {
+ return 0;
+ }
+ }
+ return 1;
+}
+
+static int zend_jit_math_long_long(dasm_State **Dst,
+ const zend_op_array *op_array,
+ const zend_op *opline,
+ zend_uchar opcode,
+ zend_jit_addr op1_addr,
+ zend_jit_addr op2_addr,
+ zend_jit_addr res_addr,
+ uint32_t res_info,
+ uint32_t res_use_info,
+ int may_overflow)
+{
+ zend_bool same_ops = zend_jit_same_addr(op1_addr, op2_addr);
+ zend_reg result_reg;
+
+ if (Z_MODE(res_addr) == IS_REG) {
+ result_reg = Z_REG(res_addr);
+ } else if (Z_MODE(op1_addr) == IS_REG && Z_LAST_USE(op1_addr)) {
+ result_reg = Z_REG(op1_addr);
+ } else {
+ result_reg = ZREG_R0;
+ }
+
+ if (opcode == ZEND_MUL &&
+ ((Z_MODE(op2_addr) == IS_CONST_ZVAL &&
+ IS_SIGNED_32BIT(Z_LVAL_P(Z_ZV(op2_addr))) &&
+ is_power_of_two(Z_LVAL_P(Z_ZV(op2_addr)))) ||
+ (Z_MODE(op1_addr) == IS_CONST_ZVAL &&
+ IS_SIGNED_32BIT(Z_LVAL_P(Z_ZV(op1_addr))) &&
+ is_power_of_two(Z_LVAL_P(Z_ZV(op1_addr)))))) {
+ if (Z_MODE(op2_addr) == IS_CONST_ZVAL) {
+ | GET_ZVAL_LVAL result_reg, op1_addr
+ | shl Ra(result_reg), floor_log2(Z_LVAL_P(Z_ZV(op2_addr)))
+ } else {
+ | GET_ZVAL_LVAL result_reg, op2_addr
+ | shl Ra(result_reg), floor_log2(Z_LVAL_P(Z_ZV(op1_addr)))
+ }
+ } else if (opcode == ZEND_DIV &&
+ (Z_MODE(op2_addr) == IS_CONST_ZVAL &&
+ is_power_of_two(Z_LVAL_P(Z_ZV(op2_addr))))) {
+ | GET_ZVAL_LVAL result_reg, op1_addr
+ | shr Ra(result_reg), floor_log2(Z_LVAL_P(Z_ZV(op2_addr)))
+ } else {
+ | GET_ZVAL_LVAL result_reg, op1_addr
+ if (same_ops && opcode != ZEND_DIV) {
+ | LONG_MATH_REG opcode, Ra(result_reg), Ra(result_reg)
+ } else {
+ | LONG_MATH opcode, result_reg, op2_addr
+ }
+ }
+ if (may_overflow) {
+ | jo >1
+ }
+
+ if (Z_MODE(res_addr) == IS_MEM_ZVAL) {
+ | SET_ZVAL_LVAL res_addr, Ra(result_reg)
+ if (Z_MODE(op1_addr) != IS_MEM_ZVAL || Z_REG(op1_addr) != Z_REG(res_addr) || Z_OFFSET(op1_addr) != Z_OFFSET(res_addr)) {
+ if ((res_use_info & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_REF)) != MAY_BE_LONG) {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_LONG
+ }
+ }
+ }
+
+ if (may_overflow) {
+ zend_reg tmp_reg1 = ZREG_XMM0;
+ zend_reg tmp_reg2 = ZREG_XMM1;
+
+ |.cold_code
+ |1:
+
+ do {
+ if ((Z_MODE(op1_addr) == IS_CONST_ZVAL && Z_LVAL_P(Z_ZV(op1_addr)) == 1) ||
+ (Z_MODE(op2_addr) == IS_CONST_ZVAL && Z_LVAL_P(Z_ZV(op2_addr)) == 1)) {
+ if (opcode == ZEND_ADD) {
+ |.if X64
+ | mov64 rax, 0x43e0000000000000
+ | SET_ZVAL_LVAL res_addr, rax
+ |.else
+ | SET_ZVAL_LVAL res_addr, 0
+ | SET_ZVAL_W2 res_addr, 0x41e00000
+ |.endif
+ break;
+ } else if (opcode == ZEND_SUB) {
+ |.if X64
+ | mov64 rax, 0xc3e0000000000000
+ | SET_ZVAL_LVAL res_addr, rax
+ |.else
+ | SET_ZVAL_LVAL res_addr, 0x00200000
+ | SET_ZVAL_W2 res_addr, 0xc1e00000
+ |.endif
+ break;
+ }
+ }
+
+ | SSE_GET_ZVAL_LVAL tmp_reg1, op1_addr
+ | SSE_GET_ZVAL_LVAL tmp_reg2, op2_addr
+ if (zend_jit_x86_flags & ZEND_JIT_CPU_AVX) {
+ | AVX_MATH_REG opcode, tmp_reg1, tmp_reg1, tmp_reg2
+ } else {
+ | SSE_MATH_REG opcode, tmp_reg1, tmp_reg2
+ }
+ | SSE_SET_ZVAL_DVAL res_addr, tmp_reg1
+ } while (0);
+
+ if ((res_use_info & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_REF)) != MAY_BE_DOUBLE) {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_DOUBLE
+ }
+ | jmp >2
+ |.code
+ |2:
+ }
+
+ return 1;
+}
+
+static int zend_jit_math_long_double(dasm_State **Dst,
+ zend_uchar opcode,
+ zend_jit_addr op1_addr,
+ zend_jit_addr op2_addr,
+ zend_jit_addr res_addr,
+ uint32_t res_use_info)
+{
+ zend_reg result_reg =
+ (Z_MODE(res_addr) == IS_REG) ? Z_REG(res_addr) : ZREG_XMM0;
+
+ | SSE_GET_ZVAL_LVAL result_reg, op1_addr
+ if (zend_jit_x86_flags & ZEND_JIT_CPU_AVX) {
+ | AVX_MATH opcode, result_reg, result_reg, op2_addr
+ } else {
+ | SSE_MATH opcode, result_reg, op2_addr
+ }
+ | SSE_SET_ZVAL_DVAL res_addr, result_reg
+
+ if (Z_MODE(res_addr) == IS_MEM_ZVAL) {
+ if ((res_use_info & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_REF)) != MAY_BE_DOUBLE) {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_DOUBLE
+ }
+ }
+
+ return 1;
+}
+
+static int zend_jit_math_double_long(dasm_State **Dst,
+ zend_uchar opcode,
+ zend_jit_addr op1_addr,
+ zend_jit_addr op2_addr,
+ zend_jit_addr res_addr,
+ uint32_t res_use_info)
+{
+ zend_reg result_reg;
+
+ if (zend_is_commutative(opcode)) {
+ if (Z_MODE(res_addr) == IS_REG) {
+ result_reg = Z_REG(res_addr);
+ } else {
+ result_reg = ZREG_XMM0;
+ }
+ | SSE_GET_ZVAL_LVAL result_reg, op2_addr
+ if (zend_jit_x86_flags & ZEND_JIT_CPU_AVX) {
+ | AVX_MATH opcode, result_reg, result_reg, op1_addr
+ } else {
+ | SSE_MATH opcode, result_reg, op1_addr
+ }
+ } else {
+ zend_reg tmp_reg;
+
+ if (Z_MODE(res_addr) == IS_REG) {
+ result_reg = Z_REG(res_addr);
+ tmp_reg = ZREG_XMM0;
+ } else if (Z_MODE(op1_addr) == IS_REG && Z_LAST_USE(op1_addr)) {
+ result_reg = Z_REG(op1_addr);
+ tmp_reg = ZREG_XMM0;
+ } else {
+ result_reg = ZREG_XMM0;
+ tmp_reg = ZREG_XMM1;
+ }
+ if (zend_jit_x86_flags & ZEND_JIT_CPU_AVX) {
+ zend_reg op1_reg;
+
+ if (Z_MODE(op1_addr) == IS_REG) {
+ op1_reg = Z_REG(op1_addr);
+ } else {
+ | SSE_GET_ZVAL_DVAL result_reg, op1_addr
+ op1_reg = result_reg;
+ }
+ | SSE_GET_ZVAL_LVAL tmp_reg, op2_addr
+ | AVX_MATH_REG opcode, result_reg, op1_reg, tmp_reg
+ } else {
+ | SSE_GET_ZVAL_DVAL result_reg, op1_addr
+ | SSE_GET_ZVAL_LVAL tmp_reg, op2_addr
+ | SSE_MATH_REG opcode, result_reg, tmp_reg
+ }
+ }
+ | SSE_SET_ZVAL_DVAL res_addr, result_reg
+
+ if (Z_MODE(res_addr) == IS_MEM_ZVAL) {
+ if (Z_MODE(op1_addr) != IS_MEM_ZVAL || Z_REG(op1_addr) != Z_REG(res_addr) || Z_OFFSET(op1_addr) != Z_OFFSET(res_addr)) {
+ if ((res_use_info & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_REF)) != MAY_BE_DOUBLE) {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_DOUBLE
+ }
+ }
+ }
+
+ return 1;
+}
+
+static int zend_jit_math_double_double(dasm_State **Dst,
+ zend_uchar opcode,
+ zend_jit_addr op1_addr,
+ zend_jit_addr op2_addr,
+ zend_jit_addr res_addr,
+ uint32_t res_use_info)
+{
+ zend_bool same_ops = zend_jit_same_addr(op1_addr, op2_addr);
+ zend_reg result_reg;
+
+ if (Z_MODE(res_addr) == IS_REG) {
+ result_reg = Z_REG(res_addr);
+ } else if (Z_MODE(op1_addr) == IS_REG && Z_LAST_USE(op1_addr)) {
+ result_reg = Z_REG(op1_addr);
+ } else {
+ result_reg = ZREG_XMM0;
+ }
+
+ if (zend_jit_x86_flags & ZEND_JIT_CPU_AVX) {
+ zend_reg op1_reg;
+ zend_jit_addr val_addr;
+
+ if (Z_MODE(op1_addr) == IS_REG) {
+ op1_reg = Z_REG(op1_addr);
+ val_addr = op2_addr;
+ } else if (Z_MODE(op2_addr) == IS_REG && zend_is_commutative(opcode)) {
+ op1_reg = Z_REG(op2_addr);
+ val_addr = op1_addr;
+ } else {
+ | SSE_GET_ZVAL_DVAL result_reg, op1_addr
+ op1_reg = result_reg;
+ val_addr = op2_addr;
+ }
+ if ((opcode == ZEND_MUL) &&
+ Z_MODE(val_addr) == IS_CONST_ZVAL && Z_DVAL_P(Z_ZV(val_addr)) == 2.0) {
+ | AVX_MATH_REG ZEND_ADD, result_reg, op1_reg, op1_reg
+ } else {
+ | AVX_MATH opcode, result_reg, op1_reg, val_addr
+ }
+ } else {
+ zend_jit_addr val_addr;
+
+ if (Z_MODE(op1_addr) != IS_REG && Z_MODE(op2_addr) == IS_REG && zend_is_commutative(opcode)) {
+ | SSE_GET_ZVAL_DVAL result_reg, op2_addr
+ val_addr = op1_addr;
+ } else {
+ | SSE_GET_ZVAL_DVAL result_reg, op1_addr
+ val_addr = op2_addr;
+ }
+ if (same_ops) {
+ | SSE_MATH_REG opcode, result_reg, result_reg
+ } else if ((opcode == ZEND_MUL) &&
+ Z_MODE(val_addr) == IS_CONST_ZVAL && Z_DVAL_P(Z_ZV(val_addr)) == 2.0) {
+ | SSE_MATH_REG ZEND_ADD, result_reg, result_reg
+ } else {
+ | SSE_MATH opcode, result_reg, val_addr
+ }
+ }
+ | SSE_SET_ZVAL_DVAL res_addr, result_reg
+
+ if (Z_MODE(res_addr) == IS_MEM_ZVAL) {
+ if (Z_MODE(op1_addr) != IS_MEM_ZVAL || Z_REG(op1_addr) != Z_REG(res_addr) || Z_OFFSET(op1_addr) != Z_OFFSET(res_addr)) {
+ if ((res_use_info & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_REF)) != MAY_BE_DOUBLE) {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_DOUBLE
+ }
+ }
+ }
+
+ return 1;
+}
+
+static int zend_jit_math_helper(dasm_State **Dst,
+ const zend_op *opline,
+ zend_uchar opcode,
+ const zend_op_array *op_array,
+ zend_uchar op1_type,
+ znode_op op1,
+ zend_jit_addr op1_addr,
+ uint32_t op1_info,
+ zend_uchar op2_type,
+ znode_op op2,
+ zend_jit_addr op2_addr,
+ uint32_t op2_info,
+ uint32_t res_var,
+ zend_jit_addr res_addr,
+ uint32_t res_info,
+ uint32_t res_use_info,
+ int may_overflow,
+ int may_throw)
+/* Labels: 1,2,3,4,5,6 */
+{
+ zend_bool same_ops = zend_jit_same_addr(op1_addr, op2_addr);
+
+ if ((op1_info & MAY_BE_LONG) && (op2_info & MAY_BE_LONG)) {
+ if (op1_info & (MAY_BE_ANY-MAY_BE_LONG)) {
+ if (op1_info & MAY_BE_DOUBLE) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_LONG, >3
+ } else {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_LONG, >6
+ }
+ }
+ if (!same_ops && (op2_info & (MAY_BE_ANY-MAY_BE_LONG))) {
+ if (op2_info & MAY_BE_DOUBLE) {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_LONG, >1
+ |.cold_code
+ |1:
+ if (op2_info & (MAY_BE_ANY-(MAY_BE_LONG|MAY_BE_DOUBLE))) {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_DOUBLE, >6
+ }
+ if (!zend_jit_math_long_double(Dst, opcode, op1_addr, op2_addr, res_addr, res_use_info)) {
+ return 0;
+ }
+ | jmp >5
+ |.code
+ } else {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_LONG, >6
+ }
+ }
+ if (!zend_jit_math_long_long(Dst, op_array, opline, opcode, op1_addr, op2_addr, res_addr, res_info, res_use_info, may_overflow)) {
+ return 0;
+ }
+ if (op1_info & MAY_BE_DOUBLE) {
+ |.cold_code
+ |3:
+ if (op1_info & (MAY_BE_ANY-(MAY_BE_LONG|MAY_BE_DOUBLE))) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_DOUBLE, >6
+ }
+ if (op2_info & MAY_BE_DOUBLE) {
+ if (!same_ops && (op2_info & (MAY_BE_ANY-MAY_BE_DOUBLE))) {
+ if (!same_ops) {
+ | IF_NOT_ZVAL_TYPE, op2_addr, IS_DOUBLE, >1
+ } else {
+ | IF_NOT_ZVAL_TYPE, op2_addr, IS_DOUBLE, >6
+ }
+ }
+ if (!zend_jit_math_double_double(Dst, opcode, op1_addr, op2_addr, res_addr, res_use_info)) {
+ return 0;
+ }
+ | jmp >5
+ }
+ if (!same_ops) {
+ |1:
+ if (op2_info & (MAY_BE_ANY-(MAY_BE_LONG|MAY_BE_DOUBLE))) {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_LONG, >6
+ }
+ if (!zend_jit_math_double_long(Dst, opcode, op1_addr, op2_addr, res_addr, res_use_info)) {
+ return 0;
+ }
+ | jmp >5
+ }
+ |.code
+ }
+ } else if ((op1_info & MAY_BE_DOUBLE) &&
+ !(op1_info & MAY_BE_LONG) &&
+ (op2_info & (MAY_BE_LONG|MAY_BE_DOUBLE))) {
+ if (op1_info & (MAY_BE_ANY-MAY_BE_DOUBLE)) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_DOUBLE, >6
+ }
+ if (op2_info & MAY_BE_DOUBLE) {
+ if (!same_ops && (op2_info & (MAY_BE_ANY-MAY_BE_DOUBLE))) {
+ if (!same_ops && (op2_info & MAY_BE_LONG)) {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_DOUBLE, >1
+ } else {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_DOUBLE, >6
+ }
+ }
+ if (!zend_jit_math_double_double(Dst, opcode, op1_addr, op2_addr, res_addr, res_use_info)) {
+ return 0;
+ }
+ }
+ if (!same_ops && (op2_info & MAY_BE_LONG)) {
+ if (op2_info & MAY_BE_DOUBLE) {
+ |.cold_code
+ }
+ |1:
+ if (op2_info & (MAY_BE_ANY-(MAY_BE_DOUBLE|MAY_BE_LONG))) {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_LONG, >6
+ }
+ if (!zend_jit_math_double_long(Dst, opcode, op1_addr, op2_addr, res_addr, res_use_info)) {
+ return 0;
+ }
+ if (op2_info & MAY_BE_DOUBLE) {
+ | jmp >5
+ |.code
+ }
+ }
+ } else if ((op2_info & MAY_BE_DOUBLE) &&
+ !(op2_info & MAY_BE_LONG) &&
+ (op1_info & (MAY_BE_LONG|MAY_BE_DOUBLE))) {
+ if (op2_info & (MAY_BE_ANY-MAY_BE_DOUBLE)) {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_DOUBLE, >6
+ }
+ if (op1_info & MAY_BE_DOUBLE) {
+ if (!same_ops && (op1_info & (MAY_BE_ANY-MAY_BE_DOUBLE))) {
+ if (!same_ops && (op1_info & MAY_BE_LONG)) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_DOUBLE, >1
+ } else {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_DOUBLE, >6
+ }
+ }
+ if (!zend_jit_math_double_double(Dst, opcode, op1_addr, op2_addr, res_addr, res_use_info)) {
+ return 0;
+ }
+ }
+ if (!same_ops && (op1_info & MAY_BE_LONG)) {
+ if (op1_info & MAY_BE_DOUBLE) {
+ |.cold_code
+ }
+ |1:
+ if (op1_info & (MAY_BE_ANY-(MAY_BE_DOUBLE|MAY_BE_LONG))) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_LONG, >6
+ }
+ if (!zend_jit_math_long_double(Dst, opcode, op1_addr, op2_addr, res_addr, res_use_info)) {
+ return 0;
+ }
+ if (op1_info & MAY_BE_DOUBLE) {
+ | jmp >5
+ |.code
+ }
+ }
+ }
+
+ |5:
+
+ if ((op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_LONG|MAY_BE_DOUBLE))) ||
+ (op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_LONG|MAY_BE_DOUBLE)))) {
+ if ((op1_info & (MAY_BE_LONG|MAY_BE_DOUBLE)) &&
+ (op2_info & (MAY_BE_LONG|MAY_BE_DOUBLE))) {
+ |.cold_code
+ }
+ |6:
+ | SAVE_VALID_OPLINE opline
+ if (Z_MODE(res_addr) == IS_REG) {
+ zend_jit_addr real_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, res_var);
+ | LOAD_ZVAL_ADDR FCARG1a, real_addr
+ } else if (Z_REG(res_addr) != ZREG_FCARG1a || Z_OFFSET(res_addr) != 0) {
+ | LOAD_ZVAL_ADDR FCARG1a, res_addr
+ }
+ if (Z_MODE(op1_addr) == IS_REG) {
+ zend_jit_addr real_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, op1.var);
+ if (!zend_jit_spill_store(Dst, op1_addr, real_addr, op1_info, 1)) {
+ return 0;
+ }
+ op1_addr = real_addr;
+ }
+ | LOAD_ZVAL_ADDR FCARG2a, op1_addr
+ if (Z_MODE(op2_addr) == IS_REG) {
+ zend_jit_addr real_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, op2.var);
+ if (!zend_jit_spill_store(Dst, op2_addr, real_addr, op2_info, 1)) {
+ return 0;
+ }
+ op2_addr = real_addr;
+ }
+ |.if X64
+ | LOAD_ZVAL_ADDR CARG3, op2_addr
+ |.else
+ | sub r4, 12
+ | PUSH_ZVAL_ADDR op2_addr, r0
+ |.endif
+ if (opcode == ZEND_ADD) {
+ | EXT_CALL add_function, r0
+ } else if (opcode == ZEND_SUB) {
+ | EXT_CALL sub_function, r0
+ } else if (opcode == ZEND_MUL) {
+ | EXT_CALL mul_function, r0
+ } else if (opcode == ZEND_DIV) {
+ | EXT_CALL div_function, r0
+ } else {
+ ZEND_ASSERT(0);
+ }
+ |.if not(X64)
+ | add r4, 12
+ |.endif
+ | FREE_OP op1_type, op1, op1_info, 0, op_array, opline
+ | FREE_OP op2_type, op2, op2_info, 0, op_array, opline
+ if (may_throw) {
+ zend_jit_check_exception(Dst);
+ }
+ if (Z_MODE(res_addr) == IS_REG) {
+ zend_jit_addr real_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, res_var);
+ if (!zend_jit_load_reg(Dst, real_addr, res_addr, res_info)) {
+ return 0;
+ }
+ }
+ if ((op1_info & (MAY_BE_LONG|MAY_BE_DOUBLE)) &&
+ (op2_info & (MAY_BE_LONG|MAY_BE_DOUBLE))) {
+ | jmp <5
+ |.code
+ }
+ }
+
+ return 1;
+}
+
+static int zend_jit_math(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, uint32_t op1_info, zend_jit_addr op1_addr, uint32_t op2_info, zend_jit_addr op2_addr, uint32_t res_use_info, uint32_t res_info, zend_jit_addr res_addr, zend_bool send_result, int may_overflow, int may_throw)
+{
+ ZEND_ASSERT(!(op1_info & MAY_BE_UNDEF) && !(op2_info & MAY_BE_UNDEF));
+ ZEND_ASSERT((op1_info & (MAY_BE_LONG|MAY_BE_DOUBLE)) &&
+ (op2_info & (MAY_BE_LONG|MAY_BE_DOUBLE)));
+
+ if (send_result) {
+ if (!reuse_ip) {
+ zend_jit_start_reuse_ip();
+ | // call = EX(call);
+ | mov RX, EX->call
+ }
+ res_addr = ZEND_ADDR_MEM_ZVAL(ZREG_RX, (opline+1)->result.var);
+ }
+
+ if (!zend_jit_math_helper(Dst, opline, opline->opcode, op_array, opline->op1_type, opline->op1, op1_addr, op1_info, opline->op2_type, opline->op2, op2_addr, op2_info, opline->result.var, res_addr, res_info, res_use_info, may_overflow, may_throw)) {
+ return 0;
+ }
+ if (!zend_jit_store_var_if_necessary(Dst, opline->result.var, res_addr, res_info)) {
+ return 0;
+ }
+ return 1;
+}
+
+static int zend_jit_long_math_helper(dasm_State **Dst,
+ const zend_op *opline,
+ zend_uchar opcode,
+ const zend_op_array *op_array,
+ zend_uchar op1_type,
+ znode_op op1,
+ zend_jit_addr op1_addr,
+ uint32_t op1_info,
+ zend_ssa_range *op1_range,
+ zend_uchar op2_type,
+ znode_op op2,
+ zend_jit_addr op2_addr,
+ uint32_t op2_info,
+ zend_ssa_range *op2_range,
+ uint32_t res_var,
+ zend_jit_addr res_addr,
+ uint32_t res_info,
+ uint32_t res_use_info,
+ int may_throw)
+/* Labels: 6 */
+{
+ zend_bool same_ops = zend_jit_same_addr(op1_addr, op2_addr);
+ zend_reg result_reg;
+ zval tmp;
+
+ if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_LONG)) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_LONG, >6
+ }
+ if (!same_ops && (op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_LONG))) {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_LONG, >6
+ }
+
+ if (opcode == ZEND_MOD && Z_MODE(op2_addr) == IS_CONST_ZVAL &&
+ op1_range &&
+ op1_range->min >= 0) {
+ zend_long l = Z_LVAL_P(Z_ZV(op2_addr));
+
+ if (zend_long_is_power_of_two(l)) {
+ /* Optimisation for mod of power of 2 */
+ opcode = ZEND_BW_AND;
+ ZVAL_LONG(&tmp, l - 1);
+ op2_addr = ZEND_ADDR_CONST_ZVAL(&tmp);
+ }
+ }
+
+ if (opcode == ZEND_MOD) {
+ result_reg = ZREG_RAX;
+ } else if (Z_MODE(res_addr) == IS_REG) {
+ result_reg = Z_REG(res_addr);
+ } else if (Z_MODE(op1_addr) == IS_REG && Z_LAST_USE(op1_addr)) {
+ result_reg = Z_REG(op1_addr);
+ } else {
+ result_reg = ZREG_R0;
+ }
+
+ if (opcode == ZEND_SL) {
+ if (Z_MODE(op2_addr) == IS_CONST_ZVAL) {
+ zend_long op2_lval = Z_LVAL_P(Z_ZV(op2_addr));
+
+ if (UNEXPECTED((zend_ulong)op2_lval >= SIZEOF_ZEND_LONG * 8)) {
+ if (EXPECTED(op2_lval > 0)) {
+ | xor Ra(result_reg), Ra(result_reg)
+ } else {
+ | SAVE_VALID_OPLINE opline
+ | jmp ->negative_shift
+ }
+ } else {
+ | GET_ZVAL_LVAL result_reg, op1_addr
+ | shl Ra(result_reg), op2_lval
+ }
+ } else {
+ if (Z_MODE(op2_addr) != IS_REG || Z_REG(op2_addr) != ZREG_RCX) {
+ | GET_ZVAL_LVAL ZREG_RCX, op2_addr
+ }
+ if (!op2_range ||
+ op2_range->min < 0 ||
+ op2_range->max >= SIZEOF_ZEND_LONG * 8) {
+ | cmp r1, (SIZEOF_ZEND_LONG*8)
+ | jae >1
+ |.cold_code
+ |1:
+ | cmp r1, 0
+ | mov Ra(result_reg), 0
+ | jg >1
+ | SAVE_VALID_OPLINE opline
+ | jmp ->negative_shift
+ |.code
+ }
+ | GET_ZVAL_LVAL result_reg, op1_addr
+ | shl Ra(result_reg), cl
+ |1:
+ }
+ } else if (opcode == ZEND_SR) {
+ | GET_ZVAL_LVAL result_reg, op1_addr
+ if (Z_MODE(op2_addr) == IS_CONST_ZVAL) {
+ zend_long op2_lval = Z_LVAL_P(Z_ZV(op2_addr));
+
+ if (UNEXPECTED((zend_ulong)op2_lval >= SIZEOF_ZEND_LONG * 8)) {
+ if (EXPECTED(op2_lval > 0)) {
+ | sar Ra(result_reg), (SIZEOF_ZEND_LONG * 8) - 1
+ } else {
+ | SAVE_VALID_OPLINE opline
+ | jmp ->negative_shift
+ }
+ } else {
+ | sar Ra(result_reg), op2_lval
+ }
+ } else {
+ if (Z_MODE(op2_addr) != IS_REG || Z_REG(op2_addr) != ZREG_RCX) {
+ | GET_ZVAL_LVAL ZREG_RCX, op2_addr
+ }
+ if (!op2_range ||
+ op2_range->min < 0 ||
+ op2_range->max >= SIZEOF_ZEND_LONG * 8) {
+ | cmp r1, (SIZEOF_ZEND_LONG*8)
+ | jae >1
+ |.cold_code
+ |1:
+ | cmp r1, 0
+ | mov r1, (SIZEOF_ZEND_LONG * 8) - 1
+ | jg >1
+ | SAVE_VALID_OPLINE opline
+ | jmp ->negative_shift
+ |.code
+ }
+ |1:
+ | sar Ra(result_reg), cl
+ }
+ } else if (opcode == ZEND_MOD) {
+ if (Z_MODE(op2_addr) == IS_CONST_ZVAL) {
+ zend_long op2_lval = Z_LVAL_P(Z_ZV(op2_addr));
+
+ if (op2_lval == 0) {
+ | SAVE_VALID_OPLINE opline
+ | jmp ->mod_by_zero
+ } else if (op2_lval == -1) {
+ | xor Ra(result_reg), Ra(result_reg)
+ } else {
+ result_reg = ZREG_RDX;
+ | GET_ZVAL_LVAL ZREG_RAX, op1_addr
+ | GET_ZVAL_LVAL ZREG_RCX, op2_addr
+ |.if X64
+ | cqo
+ |.else
+ | cdq
+ |.endif
+ | idiv Ra(ZREG_RCX)
+ }
+ } else {
+ if (!op2_range || (op2_range->min <= 0 && op2_range->max >= 0)) {
+ if (Z_MODE(op2_addr) == IS_MEM_ZVAL) {
+ | cmp aword [Ra(Z_REG(op2_addr))+Z_OFFSET(op2_addr)], 0
+ } else if (Z_MODE(op2_addr) == IS_REG) {
+ | test Ra(Z_REG(op2_addr)), Ra(Z_REG(op2_addr))
+ }
+ | jz >1
+ |.cold_code
+ |1:
+ | SAVE_VALID_OPLINE opline
+ | jmp ->mod_by_zero
+ |.code
+ }
+
+ //TODO: add check for -1 ???
+
+ result_reg = ZREG_RDX;
+ | GET_ZVAL_LVAL ZREG_RAX, op1_addr
+ |.if X64
+ | cqo
+ |.else
+ | cdq
+ |.endif
+ if (Z_MODE(op2_addr) == IS_MEM_ZVAL) {
+ | idiv aword [Ra(Z_REG(op2_addr))+Z_OFFSET(op2_addr)]
+ } else if (Z_MODE(op2_addr) == IS_REG) {
+ | idiv Ra(Z_REG(op2_addr))
+ }
+ }
+ } else if (same_ops) {
+ | GET_ZVAL_LVAL result_reg, op1_addr
+ | LONG_MATH_REG opcode, Ra(result_reg), Ra(result_reg)
+ } else {
+ | GET_ZVAL_LVAL result_reg, op1_addr
+ | LONG_MATH opcode, result_reg, op2_addr
+ }
+
+ | SET_ZVAL_LVAL res_addr, Ra(result_reg)
+ if (Z_MODE(res_addr) == IS_MEM_ZVAL) {
+ if (Z_MODE(op1_addr) != IS_MEM_ZVAL || Z_REG(op1_addr) != Z_REG(res_addr) || Z_OFFSET(op1_addr) != Z_OFFSET(res_addr)) {
+ if ((res_use_info & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_REF)) != MAY_BE_LONG) {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_LONG
+ }
+ }
+ }
+
+ if ((op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_LONG)) ||
+ (op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_LONG))) {
+ if ((op1_info & MAY_BE_LONG) &&
+ (op2_info & MAY_BE_LONG)) {
+ |5:
+ |.cold_code
+ }
+ |6:
+ | SAVE_VALID_OPLINE opline
+ if (Z_MODE(res_addr) == IS_REG) {
+ zend_jit_addr real_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, res_var);
+ | LOAD_ZVAL_ADDR FCARG1a, real_addr
+ } else if (Z_REG(res_addr) != ZREG_FCARG1a || Z_OFFSET(res_addr) != 0) {
+ | LOAD_ZVAL_ADDR FCARG1a, res_addr
+ }
+ if (Z_MODE(op1_addr) == IS_REG) {
+ zend_jit_addr real_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, op1.var);
+ if (!zend_jit_spill_store(Dst, op1_addr, real_addr, op1_info, 1)) {
+ return 0;
+ }
+ op1_addr = real_addr;
+ }
+ | LOAD_ZVAL_ADDR FCARG2a, op1_addr
+ if (Z_MODE(op2_addr) == IS_REG) {
+ zend_jit_addr real_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, op2.var);
+ if (!zend_jit_spill_store(Dst, op2_addr, real_addr, op2_info, 1)) {
+ return 0;
+ }
+ op2_addr = real_addr;
+ }
+ |.if X64
+ | LOAD_ZVAL_ADDR CARG3, op2_addr
+ |.else
+ | sub r4, 12
+ | PUSH_ZVAL_ADDR op2_addr, r0
+ |.endif
+ if (opcode == ZEND_BW_OR) {
+ | EXT_CALL bitwise_or_function, r0
+ } else if (opcode == ZEND_BW_AND) {
+ | EXT_CALL bitwise_and_function, r0
+ } else if (opcode == ZEND_BW_XOR) {
+ | EXT_CALL bitwise_xor_function, r0
+ } else if (opcode == ZEND_SL) {
+ | EXT_CALL shift_left_function, r0
+ } else if (opcode == ZEND_SR) {
+ | EXT_CALL shift_right_function, r0
+ } else if (opcode == ZEND_MOD) {
+ | EXT_CALL mod_function, r0
+ } else {
+ ZEND_ASSERT(0);
+ }
+ |.if not(X64)
+ | add r4, 12
+ |.endif
+ | FREE_OP op1_type, op1, op1_info, 0, op_array, opline
+ | FREE_OP op2_type, op2, op2_info, 0, op_array, opline
+ if (may_throw) {
+ zend_jit_check_exception(Dst);
+ }
+ if (Z_MODE(res_addr) == IS_REG) {
+ zend_jit_addr real_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, res_var);
+ if (!zend_jit_load_reg(Dst, real_addr, res_addr, res_info)) {
+ return 0;
+ }
+ }
+ if ((op1_info & MAY_BE_LONG) &&
+ (op2_info & MAY_BE_LONG)) {
+ | jmp <5
+ |.code
+ }
+ }
+
+ return 1;
+}
+
+static int zend_jit_long_math(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, uint32_t op1_info, zend_ssa_range *op1_range, zend_jit_addr op1_addr, uint32_t op2_info, zend_ssa_range *op2_range, zend_jit_addr op2_addr, uint32_t res_use_info, uint32_t res_info, zend_jit_addr res_addr, zend_bool send_result, int may_throw)
+{
+ ZEND_ASSERT(!(op1_info & MAY_BE_UNDEF) && !(op2_info & MAY_BE_UNDEF));
+ ZEND_ASSERT((op1_info & MAY_BE_LONG) && (op2_info & MAY_BE_LONG));
+
+ if (send_result) {
+ if (!reuse_ip) {
+ zend_jit_start_reuse_ip();
+ | // call = EX(call);
+ | mov RX, EX->call
+ }
+ res_addr = ZEND_ADDR_MEM_ZVAL(ZREG_RX, (opline+1)->result.var);
+ }
+
+ if (!zend_jit_long_math_helper(Dst, opline, opline->opcode, op_array,
+ opline->op1_type, opline->op1, op1_addr, op1_info, op1_range,
+ opline->op2_type, opline->op2, op2_addr, op2_info, op2_range,
+ opline->result.var, res_addr, res_info, res_use_info, may_throw)) {
+ return 0;
+ }
+ if (!zend_jit_store_var_if_necessary(Dst, opline->result.var, res_addr, res_info)) {
+ return 0;
+ }
+ return 1;
+}
+
+static int zend_jit_concat_helper(dasm_State **Dst,
+ const zend_op *opline,
+ const zend_op_array *op_array,
+ zend_uchar op1_type,
+ znode_op op1,
+ zend_jit_addr op1_addr,
+ uint32_t op1_info,
+ zend_uchar op2_type,
+ znode_op op2,
+ zend_jit_addr op2_addr,
+ uint32_t op2_info,
+ zend_jit_addr res_addr,
+ uint32_t res_info,
+ int may_throw)
+{
+#if 1
+ if ((op1_info & MAY_BE_STRING) && (op2_info & MAY_BE_STRING)) {
+ if (op1_info & ((MAY_BE_UNDEF|MAY_BE_ANY|MAY_BE_REF) - MAY_BE_STRING)) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_STRING, >6
+ }
+ if (op2_info & ((MAY_BE_UNDEF|MAY_BE_ANY|MAY_BE_REF) - MAY_BE_STRING)) {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_STRING, >6
+ }
+ if (Z_MODE(op1_addr) == IS_MEM_ZVAL && Z_REG(op1_addr) == Z_REG(res_addr) && Z_OFFSET(op1_addr) == Z_OFFSET(res_addr)) {
+ if (Z_REG(res_addr) != ZREG_FCARG1a || Z_OFFSET(res_addr) != 0) {
+ | LOAD_ZVAL_ADDR FCARG1a, res_addr
+ }
+ | LOAD_ZVAL_ADDR FCARG2a, op2_addr
+ | EXT_CALL zend_jit_fast_assign_concat_helper, r0
+ } else {
+ if (Z_REG(res_addr) != ZREG_FCARG1a || Z_OFFSET(res_addr) != 0) {
+ | LOAD_ZVAL_ADDR FCARG1a, res_addr
+ }
+ | LOAD_ZVAL_ADDR FCARG2a, op1_addr
+ |.if X64
+ | LOAD_ZVAL_ADDR CARG3, op2_addr
+ |.else
+ | sub r4, 12
+ | PUSH_ZVAL_ADDR op2_addr, r0
+ |.endif
+ | EXT_CALL zend_jit_fast_concat_helper, r0
+ |.if not(X64)
+ | add r4, 12
+ |.endif
+ }
+ | FREE_OP op1_type, op1, op1_info, 0, op_array, opline
+ | FREE_OP op2_type, op2, op2_info, 0, op_array, opline
+ |5:
+ }
+ if ((op1_info & ((MAY_BE_UNDEF|MAY_BE_ANY|MAY_BE_REF) - MAY_BE_STRING)) ||
+ (op2_info & ((MAY_BE_UNDEF|MAY_BE_ANY|MAY_BE_REF) - MAY_BE_STRING))) {
+ if ((op1_info & MAY_BE_STRING) && (op2_info & MAY_BE_STRING)) {
+ |.cold_code
+ |6:
+ }
+#endif
+ | SAVE_VALID_OPLINE opline
+ if (Z_REG(res_addr) != ZREG_FCARG1a || Z_OFFSET(res_addr) != 0) {
+ | LOAD_ZVAL_ADDR FCARG1a, res_addr
+ }
+ | LOAD_ZVAL_ADDR FCARG2a, op1_addr
+ |.if X64
+ | LOAD_ZVAL_ADDR CARG3, op2_addr
+ |.else
+ | sub r4, 12
+ | PUSH_ZVAL_ADDR op2_addr, r0
+ |.endif
+ | EXT_CALL concat_function, r0
+ |.if not(X64)
+ | add r4, 12
+ |.endif
+ | FREE_OP op1_type, op1, op1_info, 0, op_array, opline
+ | FREE_OP op2_type, op2, op2_info, 0, op_array, opline
+ if (may_throw) {
+ zend_jit_check_exception(Dst);
+ }
+#if 1
+ if ((op1_info & MAY_BE_STRING) && (op2_info & MAY_BE_STRING)) {
+ | jmp <5
+ |.code
+ }
+ }
+#endif
+
+ return 1;
+}
+
+static int zend_jit_concat(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, uint32_t op1_info, uint32_t op2_info, uint32_t res_info, zend_bool send_result, int may_throw)
+{
+ zend_jit_addr op1_addr, op2_addr, res_addr;
+
+ ZEND_ASSERT(!(op1_info & MAY_BE_UNDEF) && !(op2_info & MAY_BE_UNDEF));
+ ZEND_ASSERT((op1_info & MAY_BE_STRING) && (op2_info & MAY_BE_STRING));
+
+ op1_addr = OP1_ADDR();
+ op2_addr = OP2_ADDR();
+
+ if (send_result) {
+ if (!reuse_ip) {
+ zend_jit_start_reuse_ip();
+ | // call = EX(call);
+ | mov RX, EX->call
+ }
+ res_addr = ZEND_ADDR_MEM_ZVAL(ZREG_RX, (opline+1)->result.var);
+ } else {
+ res_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->result.var);
+ }
+ return zend_jit_concat_helper(Dst, opline, op_array, opline->op1_type, opline->op1, op1_addr, op1_info, opline->op2_type, opline->op2, op2_addr, op2_info, res_addr, res_info, may_throw);
+}
+
+static int zend_jit_fetch_dimension_address_inner(dasm_State **Dst, const zend_op *opline, uint32_t type, uint32_t op1_info, uint32_t op2_info, uint32_t found, uint32_t not_found)
+/* Labels: 1,2,3,4,5 */
+{
+ zend_jit_addr op2_addr = OP2_ADDR();
+ zend_jit_addr res_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->result.var);
+
+ if (op2_info & MAY_BE_LONG) {
+ if (op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF) - MAY_BE_LONG)) {
+ | // if (EXPECTED(Z_TYPE_P(dim) == IS_LONG))
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_LONG, >3
+ }
+ | // hval = Z_LVAL_P(dim);
+ | GET_ZVAL_LVAL ZREG_FCARG2a, op2_addr
+ if (op1_info & MAY_BE_ARRAY_KEY_LONG) {
+ if (Z_MODE(op2_addr) == IS_CONST_ZVAL) {
+ zend_long val = Z_LVAL_P(Z_ZV(op2_addr));
+ if (val >= 0 && val < HT_MAX_SIZE) {
+ | // ZEND_HASH_INDEX_FIND(ht, hval, retval, num_undef);
+ | test dword [FCARG1a + offsetof(zend_array, u.flags)], HASH_FLAG_PACKED
+ | jz >4 // HASH_FIND
+ | // if (EXPECTED((zend_ulong)(_h) < (zend_ulong)(_ht)->nNumUsed))
+ |.if X64
+ | movsxd r0, dword [FCARG1a + offsetof(zend_array, nNumUsed)]
+ if (val == 0) {
+ | test r0, r0
+ } else {
+ | cmp r0, val
+ }
+ |.else
+ | cmp dword [FCARG1a + offsetof(zend_array, nNumUsed)], val
+ |.endif
+ if (type == BP_JIT_IS) {
+ | jbe >9 // NOT_FOUND
+ } else {
+ | jbe >2 // NOT_FOUND
+ }
+ | // _ret = &_ht->arData[_h].val;
+ | mov r0, aword [FCARG1a + offsetof(zend_array, arData)]
+ if (val != 0) {
+ | add r0, val * sizeof(Bucket)
+ }
+ if (type == BP_JIT_IS) {
+ | jmp >5
+ } else {
+ | IF_NOT_Z_TYPE r0, IS_UNDEF, >8
+ }
+ }
+ } else {
+ | // ZEND_HASH_INDEX_FIND(ht, hval, retval, num_undef);
+ | test dword [FCARG1a + offsetof(zend_array, u.flags)], HASH_FLAG_PACKED
+ | jz >4 // HASH_FIND
+ | // if (EXPECTED((zend_ulong)(_h) < (zend_ulong)(_ht)->nNumUsed))
+ |.if X64
+ | movsxd r0, dword [FCARG1a + offsetof(zend_array, nNumUsed)]
+ | cmp r0, FCARG2a
+ |.else
+ | cmp dword [FCARG1a + offsetof(zend_array, nNumUsed)], FCARG2a
+ |.endif
+ if (type == BP_JIT_IS) {
+ | jbe >9 // NOT_FOUND
+ } else {
+ | jbe >2 // NOT_FOUND
+ }
+ | // _ret = &_ht->arData[_h].val;
+ |.if X64
+ | mov r0, FCARG2a
+ | shl r0, 5
+ |.else
+ | imul r0, FCARG2a, sizeof(Bucket)
+ |.endif
+ | add r0, aword [FCARG1a + offsetof(zend_array, arData)]
+ if (type == BP_JIT_IS) {
+ | jmp >5
+ } else {
+ | IF_NOT_Z_TYPE r0, IS_UNDEF, >8
+ }
+ }
+ }
+ switch (type) {
+ case BP_JIT_IS:
+ if (op1_info & MAY_BE_ARRAY_KEY_LONG) {
+ |4:
+ }
+ | EXT_CALL zend_hash_index_find, r0
+ | test r0, r0
+ | jz >9 // NOT_FOUND
+ if (op2_info & MAY_BE_STRING) {
+ | jmp >5
+ }
+ break;
+ case BP_VAR_R:
+ case BP_VAR_IS:
+ case BP_VAR_UNSET:
+ if (op1_info & MAY_BE_ARRAY_KEY_LONG) {
+ if (Z_MODE(op2_addr) == IS_CONST_ZVAL) {
+ zend_long val = Z_LVAL_P(Z_ZV(op2_addr));
+ if (val >= 0 && val < HT_MAX_SIZE) {
+ | jmp >2 // NOT_FOUND
+ }
+ } else {
+ | jmp >2 // NOT_FOUND
+ }
+ |4:
+ }
+ | EXT_CALL zend_hash_index_find, r0
+ | test r0, r0
+ | jz >2 // NOT_FOUND
+ |.cold_code
+ |2:
+ switch (type) {
+ case BP_VAR_R:
+ | // zend_error(E_NOTICE,"Undefined offset: " ZEND_LONG_FMT, hval);
+ | // retval = &EG(uninitialized_zval);
+ | UNDEFINED_OFFSET opline
+ | jmp >9
+ break;
+ case BP_VAR_IS:
+ case BP_VAR_UNSET:
+ | // retval = &EG(uninitialized_zval);
+ | SET_ZVAL_TYPE_INFO res_addr, IS_NULL
+ | jmp >9
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ |.code
+ break;
+ case BP_VAR_RW:
+ |2:
+ | SAVE_VALID_OPLINE opline
+ | // zend_error(E_NOTICE,"Undefined offset: " ZEND_LONG_FMT, hval);
+ | //retval = zend_hash_index_update(ht, hval, &EG(uninitialized_zval));
+ | EXT_CALL zend_jit_fetch_dimension_rw_long_helper, r0
+ if (op1_info & MAY_BE_ARRAY_KEY_LONG) {
+ | jmp >8
+ |4:
+ | SAVE_VALID_OPLINE opline
+ | EXT_CALL zend_jit_hash_index_lookup_rw, r0
+ }
+ break;
+ case BP_VAR_W:
+ |2:
+ | //retval = zend_hash_index_add_new(ht, hval, &EG(uninitialized_zval));
+ |.if X64
+ | LOAD_ADDR_ZTS CARG3, executor_globals, uninitialized_zval
+ |.else
+ | sub r4, 12
+ | PUSH_ADDR_ZTS executor_globals, uninitialized_zval, r0
+ |.endif
+ | EXT_CALL zend_hash_index_add_new, r0
+ |.if not(X64)
+ | add r4, 12
+ |.endif
+ if (op1_info & MAY_BE_ARRAY_KEY_LONG) {
+ | jmp >8
+ |4:
+ | EXT_CALL zend_jit_hash_index_lookup_w, r0
+ }
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+
+ if (type != BP_JIT_IS && (op2_info & MAY_BE_STRING)) {
+ | jmp >8
+ }
+ }
+
+ if (op2_info & MAY_BE_STRING) {
+ |3:
+ if (op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF) - (MAY_BE_LONG|MAY_BE_STRING))) {
+ | // if (EXPECTED(Z_TYPE_P(dim) == IS_STRING))
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_STRING, >3
+ }
+ | // offset_key = Z_STR_P(dim);
+ | GET_ZVAL_LVAL ZREG_FCARG2a, op2_addr
+ | // retval = zend_hash_find(ht, offset_key);
+ switch (type) {
+ case BP_JIT_IS:
+ if (opline->op2_type != IS_CONST) {
+ | cmp byte [FCARG2a + offsetof(zend_string, val)], '9'
+ | jle >1
+ |.cold_code
+ |1:
+ | EXT_CALL zend_jit_symtable_find, r0
+ | jmp >1
+ |.code
+ | EXT_CALL zend_hash_find, r0
+ |1:
+ } else {
+ | EXT_CALL _zend_hash_find_known_hash, r0
+ }
+ | test r0, r0
+ | jz >9 // NOT_FOUND
+ | // if (UNEXPECTED(Z_TYPE_P(retval) == IS_INDIRECT))
+ | IF_NOT_Z_TYPE r0, IS_INDIRECT, >1
+ | GET_Z_PTR r0, r0
+ |1:
+ break;
+ case BP_VAR_R:
+ case BP_VAR_IS:
+ case BP_VAR_UNSET:
+ if (opline->op2_type != IS_CONST) {
+ | cmp byte [FCARG2a + offsetof(zend_string, val)], '9'
+ | jle >1
+ |.cold_code
+ |1:
+ | EXT_CALL zend_jit_symtable_find, r0
+ | jmp >1
+ |.code
+ | EXT_CALL zend_hash_find, r0
+ |1:
+ } else {
+ | EXT_CALL _zend_hash_find_known_hash, r0
+ }
+ | test r0, r0
+ | jz >2 // NOT_FOUND
+ | // if (UNEXPECTED(Z_TYPE_P(retval) == IS_INDIRECT))
+ | IF_Z_TYPE r0, IS_INDIRECT, >1 // SLOW
+ |.cold_code
+ |1:
+ | // retval = Z_INDIRECT_P(retval);
+ | GET_Z_PTR r0, r0
+ | IF_NOT_Z_TYPE r0, IS_UNDEF, >8
+ |2:
+ switch (type) {
+ case BP_VAR_R:
+ // zend_error(E_NOTICE, "Undefined index: %s", ZSTR_VAL(offset_key));
+ | UNDEFINED_INDEX opline
+ | jmp >9
+ break;
+ case BP_VAR_IS:
+ case BP_VAR_UNSET:
+ | // retval = &EG(uninitialized_zval);
+ | SET_ZVAL_TYPE_INFO res_addr, IS_NULL
+ | jmp >9
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ |.code
+ break;
+ case BP_VAR_RW:
+ | SAVE_VALID_OPLINE opline
+ if (opline->op2_type != IS_CONST) {
+ | EXT_CALL zend_jit_symtable_lookup_rw, r0
+ } else {
+ | EXT_CALL zend_jit_hash_lookup_rw, r0
+ }
+ break;
+ case BP_VAR_W:
+ if (opline->op2_type != IS_CONST) {
+ | EXT_CALL zend_jit_symtable_lookup_w, r0
+ } else {
+ | EXT_CALL zend_jit_hash_lookup_w, r0
+ }
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ }
+
+ if (type == BP_JIT_IS && (op2_info & (MAY_BE_LONG|MAY_BE_STRING))) {
+ |5:
+ if (op1_info & MAY_BE_ARRAY_OF_REF) {
+ | ZVAL_DEREF r0, MAY_BE_REF
+ }
+ | cmp byte [r0 + 8], IS_NULL
+ | jle >9 // NOT FOUND
+ }
+
+ if (op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF) - (MAY_BE_LONG|MAY_BE_STRING))) {
+ if (op2_info & (MAY_BE_LONG|MAY_BE_STRING)) {
+ |.cold_code
+ |3:
+ }
+ | SAVE_VALID_OPLINE opline
+ | LOAD_ZVAL_ADDR FCARG2a, op2_addr
+ switch (type) {
+ case BP_VAR_R:
+ |.if X64
+ | LOAD_ZVAL_ADDR CARG3, res_addr
+ |.else
+ | sub r4, 12
+ | PUSH_ZVAL_ADDR res_addr, r0
+ |.endif
+ | EXT_CALL zend_jit_fetch_dim_r_helper, r0
+ |.if not(X64)
+ | add r4, 12
+ |.endif
+ | jmp >9
+ break;
+ case BP_JIT_IS:
+ | EXT_CALL zend_jit_fetch_dim_isset_helper, r0
+ | test r0, r0
+ | jne >8
+ | jmp >9
+ break;
+ case BP_VAR_IS:
+ case BP_VAR_UNSET:
+ |.if X64
+ | LOAD_ZVAL_ADDR CARG3, res_addr
+ |.else
+ | sub r4, 12
+ | PUSH_ZVAL_ADDR res_addr, r0
+ |.endif
+ | EXT_CALL zend_jit_fetch_dim_is_helper, r0
+ |.if not(X64)
+ | add r4, 12
+ |.endif
+ | jmp >9
+ break;
+ case BP_VAR_RW:
+ | EXT_CALL zend_jit_fetch_dim_rw_helper, r0
+ | test r0, r0
+ | jne >8
+ | jmp >9
+ break;
+ case BP_VAR_W:
+ | EXT_CALL zend_jit_fetch_dim_w_helper, r0
+ | test r0, r0
+ | jne >8
+ | jmp >9
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ if (op2_info & (MAY_BE_LONG|MAY_BE_STRING)) {
+ |.code
+ }
+ }
+
+ return 1;
+}
+
+static int zend_jit_simple_assign(dasm_State **Dst,
+ const zend_op *opline,
+ const zend_op_array *op_array,
+ zend_jit_addr var_addr,
+ uint32_t var_info,
+ uint32_t var_def_info,
+ zend_uchar val_type,
+ znode_op val,
+ zend_jit_addr val_addr,
+ uint32_t val_info,
+ zend_jit_addr res_addr,
+ int in_cold)
+/* Labels: 1,2,3 */
+{
+ ZEND_ASSERT(Z_MODE(var_addr) == IS_REG || Z_REG(var_addr) != ZREG_R0);
+ if (Z_MODE(val_addr) == IS_CONST_ZVAL) {
+ zval *zv = Z_ZV(val_addr);
+
+ if (!res_addr) {
+ | ZVAL_COPY_CONST var_addr, var_info, var_def_info, zv, r0
+ } else {
+ | ZVAL_COPY_CONST_2 var_addr, res_addr, var_info, var_def_info, zv, r0
+ }
+ if (Z_REFCOUNTED_P(zv)) {
+ if (!res_addr) {
+ | ADDREF_CONST zv, r0
+ } else {
+ | ADDREF_CONST_2 zv, r0
+ }
+ }
+ } else {
+ if (val_info & MAY_BE_UNDEF) {
+ if (in_cold) {
+ | IF_NOT_ZVAL_TYPE val_addr, IS_UNDEF, >2
+ } else {
+ | IF_ZVAL_TYPE val_addr, IS_UNDEF, >1
+ |.cold_code
+ |1:
+ }
+ | // zend_error(E_WARNING, "Undefined variable: %s", ZSTR_VAL(CV_DEF_OF(EX_VAR_TO_NUM(opline->op1.var))));
+ if (Z_REG(var_addr) != ZREG_FP) {
+ | mov aword T1, Ra(Z_REG(var_addr)) // save
+ }
+ | SAVE_VALID_OPLINE opline
+ | mov FCARG1d, val.var
+ | EXT_CALL zend_jit_undefined_op_helper, r0
+ if (Z_REG(var_addr) != ZREG_FP) {
+ | mov Ra(Z_REG(var_addr)), aword T1 // restore
+ }
+ | SET_ZVAL_TYPE_INFO var_addr, IS_NULL
+ if (res_addr) {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_NULL
+ }
+ | jmp >3
+ if (in_cold) {
+ |2:
+ } else {
+ |.code
+ }
+ }
+ if (val_info & MAY_BE_REF) {
+ if (val_type == IS_CV) {
+ ZEND_ASSERT(Z_REG(var_addr) != ZREG_R2);
+ | LOAD_ZVAL_ADDR r2, val_addr
+ | ZVAL_DEREF r2, val_info
+ val_addr = ZEND_ADDR_MEM_ZVAL(ZREG_R2, 0);
+ } else {
+ zend_jit_addr ref_addr;
+
+ if (in_cold) {
+ | IF_NOT_ZVAL_TYPE val_addr, IS_REFERENCE, >1
+ } else {
+ | IF_ZVAL_TYPE val_addr, IS_REFERENCE, >1
+ |.cold_code
+ |1:
+ }
+ | // zend_refcounted *ref = Z_COUNTED_P(retval_ptr);
+ | GET_ZVAL_PTR r2, val_addr
+ | GC_DELREF r2
+ | // ZVAL_COPY_VALUE(return_value, &ref->value);
+ ref_addr = ZEND_ADDR_MEM_ZVAL(ZREG_R2, 8);
+ if (!res_addr) {
+ | ZVAL_COPY_VALUE var_addr, var_info, ref_addr, val_info, ZREG_R2, ZREG_R0
+ } else {
+ | ZVAL_COPY_VALUE_2 var_addr, var_info, res_addr, ref_addr, val_info, ZREG_R2, ZREG_R0
+ }
+ | je >2
+ | IF_NOT_REFCOUNTED dh, >3
+ if (!res_addr) {
+ | GC_ADDREF r0
+ } else {
+ | add dword [r0], 2
+ }
+ | jmp >3
+ |2:
+ if (res_addr) {
+ | IF_NOT_REFCOUNTED dh, >2
+ | GC_ADDREF r0
+ |2:
+ }
+ | EFREE_24 aword [Ra(Z_REG(val_addr))+Z_OFFSET(val_addr)], op_array, opline
+ | jmp >3
+ if (in_cold) {
+ |1:
+ } else {
+ |.code
+ }
+ }
+ }
+
+ if (!res_addr) {
+ | ZVAL_COPY_VALUE var_addr, var_info, val_addr, val_info, ZREG_R2, ZREG_R0
+ } else {
+ | ZVAL_COPY_VALUE_2 var_addr, var_info, res_addr, val_addr, val_info, ZREG_R2, ZREG_R0
+ }
+
+ if (val_type == IS_CV) {
+ if (!res_addr) {
+ | TRY_ADDREF val_info, dh, r0
+ } else {
+ | TRY_ADDREF_2 val_info, dh, r0
+ }
+ } else {
+ if (res_addr) {
+ | TRY_ADDREF val_info, dh, r0
+ }
+ }
+ |3:
+ }
+ return 1;
+}
+
+static int zend_jit_assign_to_variable(dasm_State **Dst,
+ const zend_op *opline,
+ const zend_op_array *op_array,
+ zend_jit_addr var_addr,
+ uint32_t var_info,
+ uint32_t var_def_info,
+ zend_uchar val_type,
+ znode_op val,
+ zend_jit_addr val_addr,
+ uint32_t val_info,
+ zend_jit_addr res_addr)
+/* Labels: 1,2,3,4,5,8 */
+{
+ //ZEND_ASSERT(Z_MODE(var_addr) == IS_MEM_ZVAL);
+ if (var_info & MAY_BE_REF) {
+ if (Z_MODE(var_addr) != IS_REG || Z_REG(var_addr) != ZREG_FCARG1a) {
+ | LOAD_ZVAL_ADDR FCARG1a, var_addr
+ var_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 0);
+ }
+ | // if (Z_ISREF_P(variable_ptr)) {
+ | IF_NOT_Z_TYPE, FCARG1a, IS_REFERENCE, >1
+ | // if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(variable_ptr)))) {
+ | GET_Z_PTR FCARG1a, FCARG1a
+ | cmp aword [FCARG1a + offsetof(zend_reference, sources.ptr)], 0
+ | jnz >2
+ | add FCARG1a, offsetof(zend_reference, val)
+ |.cold_code
+ |2:
+ | LOAD_ZVAL_ADDR FCARG2a, val_addr
+ | SAVE_VALID_OPLINE opline
+ if (val_type == IS_CONST) {
+ | EXT_CALL zend_jit_assign_const_to_typed_ref, r0
+ } else if (val_type == IS_TMP_VAR) {
+ | EXT_CALL zend_jit_assign_tmp_to_typed_ref, r0
+ } else if (val_type == IS_VAR) {
+ | EXT_CALL zend_jit_assign_var_to_typed_ref, r0
+ } else if (val_type == IS_CV) {
+ | EXT_CALL zend_jit_assign_cv_to_typed_ref, r0
+ } else {
+ ZEND_ASSERT(0);
+ }
+ | jmp >8
+ |.code
+ |1:
+ }
+ if (var_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) {
+ int in_cold = 0;
+
+ ZEND_ASSERT(Z_REG(var_addr) != ZREG_R0);
+ if (var_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
+ | IF_ZVAL_REFCOUNTED var_addr, >1
+ |.cold_code
+ |1:
+ in_cold = 1;
+ }
+ | // TODO: support for object->set
+ | // TODO: support for assignment to itself
+ | GET_ZVAL_PTR r0, var_addr
+ | GC_DELREF r0
+ if (RC_MAY_BE_1(var_info)) {
+ if (RC_MAY_BE_N(var_info)) {
+ | jnz >4
+ }
+ | mov aword T1, r0 // save
+ if (!zend_jit_simple_assign(Dst, opline, op_array, var_addr, var_info, var_def_info, val_type, val, val_addr, val_info, res_addr, in_cold)) {
+ return 0;
+ }
+ | mov FCARG1a, aword T1 // restore
+ if (val_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) {
+ | cmp dword [FCARG1a], 0
+ | jnz >8
+ }
+ | ZVAL_DTOR_FUNC var_info, opline
+ | jmp >8
+ |4:
+ }
+ if (RC_MAY_BE_N(var_info)) {
+ if (Z_REG(var_addr) == ZREG_FP) {
+ | GET_ZVAL_PTR FCARG1a, var_addr
+ | IF_GC_MAY_NOT_LEAK FCARG1a, eax, >5
+ } else if (Z_REG(var_addr) != ZREG_FCARG1a) {
+ | GET_ZVAL_PTR FCARG1a, var_addr
+ | IF_GC_MAY_NOT_LEAK FCARG1a, eax, >5
+ | mov T1, Ra(Z_REG(var_addr)) // save
+ } else {
+ | GET_ZVAL_PTR r0, var_addr
+ | IF_GC_MAY_NOT_LEAK r0, eax, >5
+ | mov T1, Ra(Z_REG(var_addr)) // save
+ | GET_ZVAL_PTR FCARG1a, var_addr
+ }
+ | EXT_CALL gc_possible_root, r0
+ if (Z_REG(var_addr) != ZREG_FP) {
+ | mov Ra(Z_REG(var_addr)), T1 // restore
+ }
+ if (in_cold) {
+ | jmp >5
+ |.code
+ }
+ } else if (in_cold) {
+ ZEND_ASSERT(RC_MAY_BE_1(var_info));
+ |.code
+ }
+ |5:
+ }
+
+ if (!zend_jit_simple_assign(Dst, opline, op_array, var_addr, var_info, var_def_info, val_type, val, val_addr, val_info, res_addr, 0)) {
+ return 0;
+ }
+ |8:
+
+ return 1;
+}
+
+static int zend_jit_assign_dim(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, uint32_t op1_info, uint32_t op2_info, uint32_t val_info, int may_throw)
+{
+ zend_jit_addr op1_addr, op2_addr, op3_addr, res_addr;
+
+ ZEND_ASSERT(opline->op1_type == IS_CV);
+
+ op1_addr = OP1_ADDR();
+ op2_addr = (opline->op2_type != IS_UNUSED) ? OP2_ADDR() : 0;
+ op3_addr = OP1_DATA_ADDR();
+ if (opline->result_type == IS_UNUSED) {
+ res_addr = 0;
+ } else {
+ res_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->result.var);
+ }
+
+ if (op1_info & MAY_BE_REF) {
+ | LOAD_ZVAL_ADDR FCARG1a, op1_addr
+ | IF_NOT_Z_TYPE FCARG1a, IS_REFERENCE, >1
+ | GET_Z_PTR FCARG2a, FCARG1a
+ | IF_NOT_TYPE byte [FCARG2a + offsetof(zend_reference, val) + offsetof(zval, u1.v.type)], IS_ARRAY, >2
+ | lea FCARG1a, [FCARG2a + offsetof(zend_reference, val)]
+ | jmp >3
+ |.cold_code
+ |2:
+ | SAVE_VALID_OPLINE opline
+ | EXT_CALL zend_jit_prepare_assign_dim_ref, r0
+ | test r0, r0
+ | jz ->exception_handler_undef
+ | mov FCARG1a, r0
+ | jmp >1
+ |.code
+ |1:
+ op1_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 0);
+ }
+
+ if (op1_info & MAY_BE_ARRAY) {
+ if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF) - MAY_BE_ARRAY)) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_ARRAY, >7
+ }
+ |3:
+ | SEPARATE_ARRAY op1_addr, op1_info, 1
+ } else if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE)) {
+ if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY))) {
+ | CMP_ZVAL_TYPE op1_addr, IS_FALSE
+ | jg >7
+ }
+ | // ZVAL_ARR(container, zend_new_array(8));
+ if (Z_REG(op1_addr) != ZREG_FP) {
+ | mov T1, Ra(Z_REG(op1_addr)) // save
+ }
+ | EXT_CALL _zend_new_array_0, r0
+ if (Z_REG(op1_addr) != ZREG_FP) {
+ | mov Ra(Z_REG(op1_addr)), T1 // restore
+ }
+ | SET_ZVAL_LVAL op1_addr, r0
+ | SET_ZVAL_TYPE_INFO op1_addr, IS_ARRAY_EX
+ | mov FCARG1a, r0
+ }
+
+ if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)) {
+ |6:
+ if (opline->op2_type == IS_UNUSED) {
+ uint32_t var_info = MAY_BE_NULL;
+ zend_jit_addr var_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 0);
+
+ | // var_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(container), &EG(uninitialized_zval));
+ | LOAD_ADDR_ZTS FCARG2a, executor_globals, uninitialized_zval
+ | EXT_CALL zend_hash_next_index_insert, r0
+ | // if (UNEXPECTED(!var_ptr)) {
+ | test r0, r0
+ | jz >1
+ |.cold_code
+ |1:
+ | // zend_throw_error(NULL, "Cannot add element to the array as the next element is already occupied");
+ | CANNOT_ADD_ELEMENT opline
+ | //ZEND_VM_C_GOTO(assign_dim_op_ret_null);
+ | jmp >9
+ |.code
+ | mov FCARG1a, r0
+
+ if (!zend_jit_simple_assign(Dst, opline, op_array, var_addr, var_info, -1, (opline+1)->op1_type, (opline+1)->op1, op3_addr, val_info, res_addr, 0)) {
+ return 0;
+ }
+ } else {
+ uint32_t var_info = zend_array_element_type(op1_info, 0, 0);
+ zend_jit_addr var_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 0);
+
+ if (!zend_jit_fetch_dimension_address_inner(Dst, opline, BP_VAR_W, op1_info, op2_info, 8, 8)) {
+ return 0;
+ }
+
+ |8:
+ | mov FCARG1a, r0
+
+ if (op1_info & (MAY_BE_ARRAY_OF_REF|MAY_BE_OBJECT)) {
+ var_info |= MAY_BE_REF;
+ }
+ | // value = zend_assign_to_variable(variable_ptr, value, OP_DATA_TYPE);
+ if (!zend_jit_assign_to_variable(Dst, opline, op_array, var_addr, var_info, -1, (opline+1)->op1_type, (opline+1)->op1, op3_addr, val_info, res_addr)) {
+ return 0;
+ }
+ }
+ }
+
+ if (((op1_info & MAY_BE_ARRAY) &&
+ (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE))) ||
+ (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)))) {
+ if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)) {
+ |.cold_code
+ |7:
+ }
+
+ if ((op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE)) &&
+ (op1_info & MAY_BE_ARRAY)) {
+ if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY))) {
+ | CMP_ZVAL_TYPE op1_addr, IS_FALSE
+ | jg >2
+ }
+ | // ZVAL_ARR(container, zend_new_array(8));
+ if (Z_REG(op1_addr) != ZREG_FP) {
+ | mov T1, Ra(Z_REG(op1_addr)) // save
+ }
+ | EXT_CALL _zend_new_array_0, r0
+ if (Z_REG(op1_addr) != ZREG_FP) {
+ | mov Ra(Z_REG(op1_addr)), T1 // restore
+ }
+ | SET_ZVAL_LVAL op1_addr, r0
+ | SET_ZVAL_TYPE_INFO op1_addr, IS_ARRAY_EX
+ | mov FCARG1a, r0
+ | // ZEND_VM_C_GOTO(assign_dim_op_new_array);
+ | jmp <6
+ |2:
+ }
+
+ if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY))) {
+ | SAVE_VALID_OPLINE opline
+ if (Z_REG(op1_addr) != ZREG_FCARG1a) {
+ | LOAD_ZVAL_ADDR FCARG1a, op1_addr
+ }
+ if (opline->op2_type == IS_UNUSED) {
+ | xor FCARG2a, FCARG2a
+ } else if (opline->op2_type == IS_CONST && Z_EXTRA_P(RT_CONSTANT(opline, opline->op2)) == ZEND_EXTRA_VALUE) {
+ ZEND_ASSERT(Z_MODE(op2_addr) == IS_CONST_ZVAL);
+ | LOAD_ADDR FCARG2a, (Z_ZV(op2_addr) + 1)
+ } else {
+ | LOAD_ZVAL_ADDR FCARG2a, op2_addr
+ }
+ |.if not(X64)
+ | sub r4, 8
+ |.endif
+ if (opline->result_type == IS_UNUSED) {
+ |.if X64
+ | xor CARG4, CARG4
+ |.else
+ | push 0
+ |.endif
+ } else {
+ |.if X64
+ | LOAD_ZVAL_ADDR CARG4, res_addr
+ |.else
+ | PUSH_ZVAL_ADDR res_addr, r0
+ |.endif
+ }
+ |.if X64
+ | LOAD_ZVAL_ADDR CARG3, op3_addr
+ |.else
+ | PUSH_ZVAL_ADDR op3_addr, r0
+ |.endif
+ | EXT_CALL zend_jit_assign_dim_helper, r0
+ |.if not(X64)
+ | add r4, 8
+ |.endif
+
+#ifdef ZEND_JIT_USE_RC_INFERENCE
+ if (((opline+1)->op1_type & (IS_TMP_VAR|IS_VAR)) && (val_info & MAY_BE_RC1)) {
+ /* ASSIGN_DIM may increase refcount of the value */
+ val_info |= MAY_BE_RCN;
+ }
+#endif
+
+ | FREE_OP (opline+1)->op1_type, (opline+1)->op1, val_info, 0, op_array, opline
+ }
+
+ if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)) {
+ if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY))) {
+ | jmp >9 // END
+ }
+ |.code
+ }
+ }
+
+#ifdef ZEND_JIT_USE_RC_INFERENCE
+ if ((opline->op2_type & (IS_TMP_VAR|IS_VAR)) && (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY|MAY_BE_OBJECT))) {
+ /* ASSIGN_DIM may increase refcount of the key */
+ op2_info |= MAY_BE_RCN;
+ }
+#endif
+
+ |9:
+ | FREE_OP opline->op2_type, opline->op2, op2_info, 0, op_array, opline
+
+ if (may_throw) {
+ zend_jit_check_exception(Dst);
+ }
+
+ return 1;
+}
+
+static int zend_jit_assign_dim_op(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, uint32_t op1_info, uint32_t op1_def_info, uint32_t op2_info, uint32_t op1_data_info, zend_ssa_range *op1_data_range, int may_throw)
+{
+ zend_jit_addr op1_addr, op2_addr, op3_addr, var_addr;
+
+ ZEND_ASSERT(opline->op1_type == IS_CV && opline->result_type == IS_UNUSED);
+
+ op1_addr = OP1_ADDR();
+ op2_addr = (opline->op2_type != IS_UNUSED) ? OP2_ADDR() : 0;
+ op3_addr = OP1_DATA_ADDR();
+
+ if (op1_info & MAY_BE_REF) {
+ | LOAD_ZVAL_ADDR FCARG1a, op1_addr
+ | IF_NOT_Z_TYPE FCARG1a, IS_REFERENCE, >1
+ | GET_Z_PTR FCARG2a, FCARG1a
+ | IF_NOT_TYPE byte [FCARG2a + offsetof(zend_reference, val) + offsetof(zval, u1.v.type)], IS_ARRAY, >2
+ | lea FCARG1a, [FCARG2a + offsetof(zend_reference, val)]
+ | jmp >3
+ |.cold_code
+ |2:
+ | SAVE_VALID_OPLINE opline
+ | EXT_CALL zend_jit_prepare_assign_dim_ref, r0
+ | test r0, r0
+ | jz ->exception_handler_undef
+ | mov FCARG1a, r0
+ | jmp >1
+ |.code
+ |1:
+ op1_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 0);
+ }
+
+ if (op1_info & MAY_BE_ARRAY) {
+ if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF) - MAY_BE_ARRAY)) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_ARRAY, >7
+ }
+ |3:
+ | SEPARATE_ARRAY op1_addr, op1_info, 1
+ }
+ if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE)) {
+ if (op1_info & MAY_BE_ARRAY) {
+ |.cold_code
+ |7:
+ }
+ if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY))) {
+ | CMP_ZVAL_TYPE op1_addr, IS_FALSE
+ | jg >7
+ }
+ if (op1_info & MAY_BE_UNDEF) {
+ if (op1_info & (MAY_BE_NULL|MAY_BE_FALSE)) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_UNDEF, >1
+ }
+ | SAVE_VALID_OPLINE opline
+ | mov FCARG1a, opline->op1.var
+ | EXT_CALL zend_jit_undefined_op_helper, r0
+ |1:
+ }
+ | // ZVAL_ARR(container, zend_new_array(8));
+ if (Z_REG(op1_addr) != ZREG_FP) {
+ | mov T1, Ra(Z_REG(op1_addr)) // save
+ }
+ | EXT_CALL _zend_new_array_0, r0
+ if (Z_REG(op1_addr) != ZREG_FP) {
+ | mov Ra(Z_REG(op1_addr)), T1 // restore
+ }
+ | SET_ZVAL_LVAL op1_addr, r0
+ | SET_ZVAL_TYPE_INFO op1_addr, IS_ARRAY_EX
+ | mov FCARG1a, r0
+ if (op1_info & MAY_BE_ARRAY) {
+ | jmp >1
+ |.code
+ |1:
+ }
+ }
+
+ if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)) {
+ uint32_t var_info;
+ uint32_t var_def_info = zend_array_element_type(op1_def_info, 1, 0);
+
+ |6:
+ if (opline->op2_type == IS_UNUSED) {
+ var_info = MAY_BE_NULL;
+
+ | // var_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(container), &EG(uninitialized_zval));
+ | LOAD_ADDR_ZTS FCARG2a, executor_globals, uninitialized_zval
+ | EXT_CALL zend_hash_next_index_insert, r0
+ | // if (UNEXPECTED(!var_ptr)) {
+ | test r0, r0
+ | jz >1
+ |.cold_code
+ |1:
+ | // zend_throw_error(NULL, "Cannot add element to the array as the next element is already occupied");
+ | CANNOT_ADD_ELEMENT opline
+ | //ZEND_VM_C_GOTO(assign_dim_op_ret_null);
+ | jmp >9
+ |.code
+ | mov FCARG1a, r0
+ } else {
+ var_info = zend_array_element_type(op1_info, 0, 0);
+ if (op1_info & (MAY_BE_ARRAY_OF_REF|MAY_BE_OBJECT)) {
+ var_info |= MAY_BE_REF;
+ }
+
+ if (!zend_jit_fetch_dimension_address_inner(Dst, opline, BP_VAR_RW, op1_info, op2_info, 8, 8)) {
+ return 0;
+ }
+
+ |8:
+ | mov FCARG1a, r0
+ if (op1_info & (MAY_BE_ARRAY_OF_REF)) {
+ binary_op_type binary_op = get_binary_op(opline->extended_value);
+ | IF_NOT_Z_TYPE, FCARG1a, IS_REFERENCE, >1
+ | GET_Z_PTR FCARG1a, FCARG1a
+ | cmp aword [FCARG1a + offsetof(zend_reference, sources.ptr)], 0
+ | jnz >2
+ | add FCARG1a, offsetof(zend_reference, val)
+ |.cold_code
+ |2:
+ | LOAD_ZVAL_ADDR FCARG2a, op3_addr
+ |.if X64
+ | LOAD_ADDR CARG3, binary_op
+ |.else
+ | sub r4, 12
+ | PUSH_ADDR binary_op, r0
+ |.endif
+ | SAVE_VALID_OPLINE opline
+ | EXT_CALL zend_jit_assign_op_to_typed_ref, r0
+ |.if not(X64)
+ | add r4, 12
+ |.endif
+ zend_jit_check_exception(Dst);
+ | jmp >9
+ |.code
+ |1:
+ }
+ }
+
+ var_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 0);
+ switch (opline->extended_value) {
+ case ZEND_ADD:
+ case ZEND_SUB:
+ case ZEND_MUL:
+ case ZEND_DIV:
+ if (!zend_jit_math_helper(Dst, opline, opline->extended_value, op_array, IS_CV, opline->op1, var_addr, var_info, (opline+1)->op1_type, (opline+1)->op1, op3_addr, op1_data_info, 0, var_addr, var_def_info, var_info,
+ 1 /* may overflow */, may_throw)) {
+ return 0;
+ }
+ break;
+ case ZEND_BW_OR:
+ case ZEND_BW_AND:
+ case ZEND_BW_XOR:
+ case ZEND_SL:
+ case ZEND_SR:
+ case ZEND_MOD:
+ if (!zend_jit_long_math_helper(Dst, opline, opline->extended_value, op_array,
+ IS_CV, opline->op1, var_addr, var_info, NULL,
+ (opline+1)->op1_type, (opline+1)->op1, op3_addr, op1_data_info,
+ op1_data_range,
+ 0, var_addr, op1_def_info, var_info, may_throw)) {
+ return 0;
+ }
+ break;
+ case ZEND_CONCAT:
+ if (!zend_jit_concat_helper(Dst, opline, op_array, IS_CV, opline->op1, var_addr, var_info, (opline+1)->op1_type, (opline+1)->op1, op3_addr, op1_data_info, var_addr, op1_def_info,
+ may_throw)) {
+ return 0;
+ }
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ }
+
+ if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY))) {
+ binary_op_type binary_op;
+
+ if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)) {
+ |.cold_code
+ |7:
+ }
+
+ | SAVE_VALID_OPLINE opline
+ if (Z_REG(op1_addr) != ZREG_FCARG1a) {
+ | LOAD_ZVAL_ADDR FCARG1a, op1_addr
+ }
+ if (opline->op2_type == IS_UNUSED) {
+ | xor FCARG2a, FCARG2a
+ } else if (opline->op2_type == IS_CONST && Z_EXTRA_P(RT_CONSTANT(opline, opline->op2)) == ZEND_EXTRA_VALUE) {
+ ZEND_ASSERT(Z_MODE(op2_addr) == IS_CONST_ZVAL);
+ | LOAD_ADDR FCARG2a, (Z_ZV(op2_addr) + 1)
+ } else {
+ | LOAD_ZVAL_ADDR FCARG2a, op2_addr
+ }
+ binary_op = get_binary_op(opline->extended_value);
+ |.if X64
+ | LOAD_ZVAL_ADDR CARG3, op3_addr
+ | LOAD_ADDR CARG4, binary_op
+ |.else
+ | sub r4, 8
+ | PUSH_ADDR binary_op, r0
+ | PUSH_ZVAL_ADDR op3_addr, r0
+ |.endif
+ | EXT_CALL zend_jit_assign_dim_op_helper, r0
+ |.if not(X64)
+ | add r4, 8
+ |.endif
+ if (!zend_jit_check_exception(Dst)) {
+ return 0;
+ }
+
+ if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)) {
+ | jmp >9 // END
+ |.code
+ }
+ }
+
+ |9:
+
+ return 1;
+}
+
+static int zend_jit_assign_op(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, uint32_t op1_info, uint32_t op1_def_info, zend_ssa_range *op1_range, uint32_t op2_info, zend_ssa_range *op2_range, int may_overflow, int may_throw)
+{
+ zend_jit_addr op1_addr, op2_addr;
+
+ ZEND_ASSERT(opline->op1_type == IS_CV && opline->result_type == IS_UNUSED);
+ ZEND_ASSERT(!(op1_info & MAY_BE_UNDEF) && !(op2_info & MAY_BE_UNDEF));
+
+ op1_addr = OP1_ADDR();
+ op2_addr = OP2_ADDR();
+
+ if (op1_info & MAY_BE_REF) {
+ binary_op_type binary_op = get_binary_op(opline->extended_value);
+ | LOAD_ZVAL_ADDR FCARG1a, op1_addr
+ | IF_NOT_Z_TYPE, FCARG1a, IS_REFERENCE, >1
+ | GET_Z_PTR FCARG1a, FCARG1a
+ | cmp aword [FCARG1a + offsetof(zend_reference, sources.ptr)], 0
+ | jnz >2
+ | add FCARG1a, offsetof(zend_reference, val)
+ |.cold_code
+ |2:
+ | LOAD_ZVAL_ADDR FCARG2a, op2_addr
+ |.if X64
+ | LOAD_ADDR CARG3, binary_op
+ |.else
+ | sub r4, 12
+ | PUSH_ADDR binary_op, r0
+ |.endif
+ | SAVE_VALID_OPLINE opline
+ | EXT_CALL zend_jit_assign_op_to_typed_ref, r0
+ |.if not(X64)
+ | add r4, 12
+ |.endif
+ zend_jit_check_exception(Dst);
+ | jmp >9
+ |.code
+ |1:
+ op1_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 0);
+ }
+
+ int result;
+ switch (opline->extended_value) {
+ case ZEND_ADD:
+ case ZEND_SUB:
+ case ZEND_MUL:
+ case ZEND_DIV:
+ result = zend_jit_math_helper(Dst, opline, opline->extended_value, op_array, opline->op1_type, opline->op1, op1_addr, op1_info, opline->op2_type, opline->op2, op2_addr, op2_info, opline->op1.var, op1_addr, op1_def_info, op1_info, may_overflow, may_throw);
+ break;
+ case ZEND_BW_OR:
+ case ZEND_BW_AND:
+ case ZEND_BW_XOR:
+ case ZEND_SL:
+ case ZEND_SR:
+ case ZEND_MOD:
+ result = zend_jit_long_math_helper(Dst, opline, opline->extended_value, op_array,
+ opline->op1_type, opline->op1, op1_addr, op1_info, op1_range,
+ opline->op2_type, opline->op2, op2_addr, op2_info, op2_range,
+ opline->op1.var, op1_addr, op1_def_info, op1_info, may_throw);
+ break;
+ case ZEND_CONCAT:
+ result = zend_jit_concat_helper(Dst, opline, op_array, opline->op1_type, opline->op1, op1_addr, op1_info, opline->op2_type, opline->op2, op2_addr, op2_info, op1_addr, op1_def_info, may_throw);
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ |9:
+ return result;
+}
+
+static int zend_jit_cmp_long_long(dasm_State **Dst, const zend_op *opline, zend_jit_addr op1_addr, zend_jit_addr op2_addr, zend_jit_addr res_addr, zend_uchar smart_branch_opcode, uint32_t target_label, uint32_t target_label2)
+{
+ zend_bool swap = 0;
+
+ if (Z_MODE(op1_addr) == IS_REG) {
+ if (Z_MODE(op2_addr) == IS_CONST_ZVAL && Z_LVAL_P(Z_ZV(op2_addr)) == 0) {
+ | test Ra(Z_REG(op1_addr)), Ra(Z_REG(op1_addr))
+ } else {
+ | LONG_OP cmp, Z_REG(op1_addr), op2_addr
+ }
+ } else if (Z_MODE(op2_addr) == IS_REG) {
+ if (Z_MODE(op1_addr) == IS_CONST_ZVAL && Z_LVAL_P(Z_ZV(op1_addr)) == 0) {
+ | test Ra(Z_REG(op2_addr)), Ra(Z_REG(op2_addr))
+ } else {
+ | LONG_OP cmp, Z_REG(op2_addr), op1_addr
+ }
+ swap = 1;
+ } else if (Z_MODE(op1_addr) == IS_CONST_ZVAL && Z_MODE(op2_addr) != IS_CONST_ZVAL) {
+ | LONG_OP_WITH_CONST cmp, op2_addr, Z_LVAL_P(Z_ZV(op1_addr))
+ swap = 1;
+ } else if (Z_MODE(op2_addr) == IS_CONST_ZVAL && Z_MODE(op1_addr) != IS_CONST_ZVAL) {
+ | LONG_OP_WITH_CONST cmp, op1_addr, Z_LVAL_P(Z_ZV(op2_addr))
+ } else {
+ | GET_ZVAL_LVAL ZREG_R0, op1_addr
+ if (Z_MODE(op2_addr) == IS_CONST_ZVAL && Z_LVAL_P(Z_ZV(op2_addr)) == 0) {
+ | test r0, r0
+ } else {
+ | LONG_OP cmp, ZREG_R0, op2_addr
+ }
+ }
+
+ if (smart_branch_opcode) {
+ if (smart_branch_opcode == ZEND_JMPZ_EX ||
+ smart_branch_opcode == ZEND_JMPNZ_EX) {
+
+ switch (opline->opcode) {
+ case ZEND_IS_EQUAL:
+ case ZEND_IS_IDENTICAL:
+ case ZEND_CASE:
+ | sete al
+ break;
+ case ZEND_IS_NOT_EQUAL:
+ case ZEND_IS_NOT_IDENTICAL:
+ | setne al
+ break;
+ case ZEND_IS_SMALLER:
+ if (swap) {
+ | setg al
+ } else {
+ | setl al
+ }
+ break;
+ case ZEND_IS_SMALLER_OR_EQUAL:
+ if (swap) {
+ | setge al
+ } else {
+ | setle al
+ }
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ | movzx eax, al
+ | lea eax, [eax + 2]
+ | SET_ZVAL_TYPE_INFO res_addr, eax
+ }
+ if (smart_branch_opcode == ZEND_JMPZ ||
+ smart_branch_opcode == ZEND_JMPZ_EX) {
+ switch (opline->opcode) {
+ case ZEND_IS_EQUAL:
+ case ZEND_IS_IDENTICAL:
+ case ZEND_CASE:
+ | jne => target_label
+ break;
+ case ZEND_IS_NOT_EQUAL:
+ case ZEND_IS_NOT_IDENTICAL:
+ | je => target_label
+ break;
+ case ZEND_IS_SMALLER:
+ if (swap) {
+ | jle => target_label
+ } else {
+ | jge => target_label
+ }
+ break;
+ case ZEND_IS_SMALLER_OR_EQUAL:
+ if (swap) {
+ | jl => target_label
+ } else {
+ | jg => target_label
+ }
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ } else if (smart_branch_opcode == ZEND_JMPNZ ||
+ smart_branch_opcode == ZEND_JMPNZ_EX) {
+ switch (opline->opcode) {
+ case ZEND_IS_EQUAL:
+ case ZEND_IS_IDENTICAL:
+ case ZEND_CASE:
+ | je => target_label
+ break;
+ case ZEND_IS_NOT_EQUAL:
+ case ZEND_IS_NOT_IDENTICAL:
+ | jne => target_label
+ break;
+ case ZEND_IS_SMALLER:
+ if (swap) {
+ | jg => target_label
+ } else {
+ | jl => target_label
+ }
+ break;
+ case ZEND_IS_SMALLER_OR_EQUAL:
+ if (swap) {
+ | jge => target_label
+ } else {
+ | jle => target_label
+ }
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ } else if (smart_branch_opcode == ZEND_JMPZNZ) {
+ switch (opline->opcode) {
+ case ZEND_IS_EQUAL:
+ case ZEND_IS_IDENTICAL:
+ case ZEND_CASE:
+ | jne => target_label
+ break;
+ case ZEND_IS_NOT_EQUAL:
+ case ZEND_IS_NOT_IDENTICAL:
+ | je => target_label
+ break;
+ case ZEND_IS_SMALLER:
+ if (swap) {
+ | jle => target_label
+ } else {
+ | jge => target_label
+ }
+ break;
+ case ZEND_IS_SMALLER_OR_EQUAL:
+ if (swap) {
+ | jl => target_label
+ } else {
+ | jg => target_label
+ }
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ | jmp => target_label2
+ } else {
+ ZEND_ASSERT(0);
+ }
+ } else {
+ switch (opline->opcode) {
+ case ZEND_IS_EQUAL:
+ case ZEND_IS_IDENTICAL:
+ case ZEND_CASE:
+ | sete al
+ break;
+ case ZEND_IS_NOT_EQUAL:
+ case ZEND_IS_NOT_IDENTICAL:
+ | setne al
+ break;
+ case ZEND_IS_SMALLER:
+ if (swap) {
+ | setg al
+ } else {
+ | setl al
+ }
+ break;
+ case ZEND_IS_SMALLER_OR_EQUAL:
+ if (swap) {
+ | setge al
+ } else {
+ | setle al
+ }
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ | movzx eax, al
+ | add eax, 2
+ | SET_ZVAL_TYPE_INFO res_addr, eax
+ }
+
+ return 1;
+}
+
+static int zend_jit_cmp_double_common(dasm_State **Dst, const zend_op *opline, zend_jit_addr res_addr, zend_bool swap, zend_uchar smart_branch_opcode, uint32_t target_label, uint32_t target_label2)
+{
+ if (smart_branch_opcode) {
+ if (smart_branch_opcode == ZEND_JMPZ) {
+ switch (opline->opcode) {
+ case ZEND_IS_EQUAL:
+ case ZEND_IS_IDENTICAL:
+ case ZEND_CASE:
+ | jne => target_label
+ | jp => target_label
+ break;
+ case ZEND_IS_NOT_EQUAL:
+ case ZEND_IS_NOT_IDENTICAL:
+ | jp >1
+ | je => target_label
+ |1:
+ break;
+ case ZEND_IS_SMALLER:
+ if (swap) {
+ | jbe => target_label
+ } else {
+ | jae => target_label
+ | jp => target_label
+ }
+ break;
+ case ZEND_IS_SMALLER_OR_EQUAL:
+ if (swap) {
+ | jb => target_label
+ } else {
+ | ja => target_label
+ | jp => target_label
+ }
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ } else if (smart_branch_opcode == ZEND_JMPNZ) {
+ switch (opline->opcode) {
+ case ZEND_IS_EQUAL:
+ case ZEND_IS_IDENTICAL:
+ case ZEND_CASE:
+ | jp >1
+ | je => target_label
+ |1:
+ break;
+ case ZEND_IS_NOT_EQUAL:
+ case ZEND_IS_NOT_IDENTICAL:
+ | jne => target_label
+ | jp => target_label
+ break;
+ case ZEND_IS_SMALLER:
+ if (swap) {
+ | ja => target_label
+ } else {
+ | jp >1
+ | jb => target_label
+ |1:
+ }
+ break;
+ case ZEND_IS_SMALLER_OR_EQUAL:
+ if (swap) {
+ | jae => target_label
+ } else {
+ | jp >1
+ | jbe => target_label
+ |1:
+ }
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ } else if (smart_branch_opcode == ZEND_JMPZNZ) {
+ switch (opline->opcode) {
+ case ZEND_IS_EQUAL:
+ case ZEND_IS_IDENTICAL:
+ case ZEND_CASE:
+ | jne => target_label
+ | jp => target_label
+ break;
+ case ZEND_IS_NOT_EQUAL:
+ case ZEND_IS_NOT_IDENTICAL:
+ | jp => target_label2
+ | je => target_label
+ break;
+ case ZEND_IS_SMALLER:
+ if (swap) {
+ | jbe => target_label
+ } else {
+ | jae => target_label
+ | jp => target_label
+ }
+ break;
+ case ZEND_IS_SMALLER_OR_EQUAL:
+ if (swap) {
+ | jb => target_label
+ } else {
+ | ja => target_label
+ | jp => target_label
+ }
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ | jmp => target_label2
+ } else if (smart_branch_opcode == ZEND_JMPZ_EX) {
+ switch (opline->opcode) {
+ case ZEND_IS_EQUAL:
+ case ZEND_IS_IDENTICAL:
+ case ZEND_CASE:
+ | SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
+ | jne => target_label
+ | jp => target_label
+ | SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
+ break;
+ case ZEND_IS_NOT_EQUAL:
+ case ZEND_IS_NOT_IDENTICAL:
+ | jp >1
+ | SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
+ | je => target_label
+ |1:
+ | SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
+ break;
+ case ZEND_IS_SMALLER:
+ if (swap) {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
+ | jbe => target_label
+ | SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
+ } else {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
+ | jae => target_label
+ | jp => target_label
+ | SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
+ }
+ break;
+ case ZEND_IS_SMALLER_OR_EQUAL:
+ if (swap) {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
+ | jb => target_label
+ | SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
+ } else {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
+ | ja => target_label
+ | jp => target_label
+ | SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
+ }
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ } else if (smart_branch_opcode == ZEND_JMPNZ_EX) {
+ switch (opline->opcode) {
+ case ZEND_IS_EQUAL:
+ case ZEND_IS_IDENTICAL:
+ case ZEND_CASE:
+ | jp >1
+ | SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
+ | je => target_label
+ |1:
+ | SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
+ break;
+ case ZEND_IS_NOT_EQUAL:
+ case ZEND_IS_NOT_IDENTICAL:
+ | SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
+ | jne => target_label
+ | jp => target_label
+ | SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
+ break;
+ case ZEND_IS_SMALLER:
+ if (swap) {
+ | seta al
+ | movzx eax, al
+ | lea eax, [eax + 2]
+ | SET_ZVAL_TYPE_INFO res_addr, eax
+ | ja => target_label
+ } else {
+ | jp >1
+ | SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
+ | jb => target_label
+ |1:
+ | SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
+ }
+ break;
+ case ZEND_IS_SMALLER_OR_EQUAL:
+ if (swap) {
+ | setae al
+ | movzx eax, al
+ | lea eax, [eax + 2]
+ | SET_ZVAL_TYPE_INFO res_addr, eax
+ | jae => target_label
+ } else {
+ | jp >1
+ | SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
+ | jbe => target_label
+ |1:
+ | SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
+ }
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ } else {
+ ZEND_ASSERT(0);
+ }
+ } else {
+ switch (opline->opcode) {
+ case ZEND_IS_EQUAL:
+ case ZEND_IS_IDENTICAL:
+ case ZEND_CASE:
+ | jp >1
+ | mov eax, IS_TRUE
+ | je >2
+ |1:
+ | mov eax, IS_FALSE
+ |2:
+ break;
+ case ZEND_IS_NOT_EQUAL:
+ case ZEND_IS_NOT_IDENTICAL:
+ | jp >1
+ | mov eax, IS_FALSE
+ | je >2
+ |1:
+ | mov eax, IS_TRUE
+ |2:
+ break;
+ case ZEND_IS_SMALLER:
+ if (swap) {
+ | seta al
+ | movzx eax, al
+ | add eax, 2
+ } else {
+ | jp >1
+ | mov eax, IS_TRUE
+ | jb >2
+ |1:
+ | mov eax, IS_FALSE
+ |2:
+ }
+ break;
+ case ZEND_IS_SMALLER_OR_EQUAL:
+ if (swap) {
+ | setae al
+ | movzx eax, al
+ | add eax, 2
+ } else {
+ | jp >1
+ | mov eax, IS_TRUE
+ | jbe >2
+ |1:
+ | mov eax, IS_FALSE
+ |2:
+ }
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ | SET_ZVAL_TYPE_INFO res_addr, eax
+ }
+
+ return 1;
+}
+
+static int zend_jit_cmp_long_double(dasm_State **Dst, const zend_op *opline, zend_jit_addr op1_addr, zend_jit_addr op2_addr, zend_jit_addr res_addr, zend_uchar smart_branch_opcode, uint32_t target_label, uint32_t target_label2)
+{
+ zend_reg tmp_reg = ZREG_XMM0;
+
+ | SSE_GET_ZVAL_LVAL tmp_reg, op1_addr
+ | SSE_AVX_OP ucomisd, vucomisd, tmp_reg, op2_addr
+
+ return zend_jit_cmp_double_common(Dst, opline, res_addr, 0, smart_branch_opcode, target_label, target_label2);
+}
+
+static int zend_jit_cmp_double_long(dasm_State **Dst, const zend_op *opline, zend_jit_addr op1_addr, zend_jit_addr op2_addr, zend_jit_addr res_addr, zend_uchar smart_branch_opcode, uint32_t target_label, uint32_t target_label2)
+{
+ zend_reg tmp_reg = ZREG_XMM0;
+
+ | SSE_GET_ZVAL_LVAL tmp_reg, op2_addr
+ | SSE_AVX_OP ucomisd, vucomisd, tmp_reg, op1_addr
+
+ return zend_jit_cmp_double_common(Dst, opline, res_addr, /* swap */ 1, smart_branch_opcode, target_label, target_label2);
+}
+
+static int zend_jit_cmp_double_double(dasm_State **Dst, const zend_op *opline, zend_jit_addr op1_addr, zend_jit_addr op2_addr, zend_jit_addr res_addr, zend_uchar smart_branch_opcode, uint32_t target_label, uint32_t target_label2)
+{
+ zend_bool swap = 0;
+
+ if (Z_MODE(op1_addr) == IS_REG) {
+ | SSE_AVX_OP ucomisd, vucomisd, Z_REG(op1_addr), op2_addr
+ } else if (Z_MODE(op2_addr) == IS_REG) {
+ | SSE_AVX_OP ucomisd, vucomisd, Z_REG(op2_addr), op1_addr
+ swap = 1;
+ } else {
+ zend_reg tmp_reg = ZREG_XMM0;
+
+ | SSE_GET_ZVAL_DVAL tmp_reg, op1_addr
+ | SSE_AVX_OP ucomisd, vucomisd, tmp_reg, op2_addr
+ }
+
+ return zend_jit_cmp_double_common(Dst, opline, res_addr, swap, smart_branch_opcode, target_label, target_label2);
+}
+
+static int zend_jit_cmp_slow(dasm_State **Dst, const zend_op *opline, zend_jit_addr res_addr, zend_uchar smart_branch_opcode, uint32_t target_label, uint32_t target_label2)
+{
+ | LONG_OP_WITH_CONST cmp, res_addr, Z_L(0)
+ if (smart_branch_opcode) {
+ if (smart_branch_opcode == ZEND_JMPZ_EX ||
+ smart_branch_opcode == ZEND_JMPNZ_EX) {
+ switch (opline->opcode) {
+ case ZEND_IS_EQUAL:
+ case ZEND_CASE:
+ | sete al
+ break;
+ case ZEND_IS_NOT_EQUAL:
+ | setne al
+ break;
+ case ZEND_IS_SMALLER:
+ | setl al
+ break;
+ case ZEND_IS_SMALLER_OR_EQUAL:
+ | setle al
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ | movzx eax, al
+ | lea eax, [eax + 2]
+ | SET_ZVAL_TYPE_INFO res_addr, eax
+ }
+ if (smart_branch_opcode == ZEND_JMPZ ||
+ smart_branch_opcode == ZEND_JMPZ_EX) {
+ switch (opline->opcode) {
+ case ZEND_IS_EQUAL:
+ case ZEND_CASE:
+ | jne => target_label
+ break;
+ case ZEND_IS_NOT_EQUAL:
+ | je => target_label
+ break;
+ case ZEND_IS_SMALLER:
+ | jge => target_label
+ break;
+ case ZEND_IS_SMALLER_OR_EQUAL:
+ | jg => target_label
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ } else if (smart_branch_opcode == ZEND_JMPNZ ||
+ smart_branch_opcode == ZEND_JMPNZ_EX) {
+ switch (opline->opcode) {
+ case ZEND_IS_EQUAL:
+ case ZEND_CASE:
+ | je => target_label
+ break;
+ case ZEND_IS_NOT_EQUAL:
+ | jne => target_label
+ break;
+ case ZEND_IS_SMALLER:
+ | jl => target_label
+ break;
+ case ZEND_IS_SMALLER_OR_EQUAL:
+ | jle => target_label
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ } else if (smart_branch_opcode == ZEND_JMPZNZ) {
+ switch (opline->opcode) {
+ case ZEND_IS_EQUAL:
+ case ZEND_CASE:
+ | jne => target_label
+ break;
+ case ZEND_IS_NOT_EQUAL:
+ | je => target_label
+ break;
+ case ZEND_IS_SMALLER:
+ | jge => target_label
+ break;
+ case ZEND_IS_SMALLER_OR_EQUAL:
+ | jg => target_label
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ | jmp => target_label2
+ } else {
+ ZEND_ASSERT(0);
+ }
+ } else {
+ switch (opline->opcode) {
+ case ZEND_IS_EQUAL:
+ case ZEND_CASE:
+ | sete al
+ break;
+ case ZEND_IS_NOT_EQUAL:
+ | setne al
+ break;
+ case ZEND_IS_SMALLER:
+ | setl al
+ break;
+ case ZEND_IS_SMALLER_OR_EQUAL:
+ | setle al
+ break;
+ default:
+ ZEND_ASSERT(0);
+ }
+ | movzx eax, al
+ | add eax, 2
+ | SET_ZVAL_TYPE_INFO res_addr, eax
+ }
+
+ return 1;
+}
+
+static int zend_jit_cmp(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, uint32_t op1_info, zend_jit_addr op1_addr, uint32_t op2_info, zend_jit_addr op2_addr, zend_jit_addr res_addr, int may_throw, zend_uchar smart_branch_opcode, uint32_t target_label, uint32_t target_label2)
+{
+ zend_bool same_ops = (opline->op1_type == opline->op2_type) && (opline->op1.var == opline->op2.var);
+ zend_bool has_slow;
+
+ has_slow =
+ (op1_info & (MAY_BE_LONG|MAY_BE_DOUBLE)) &&
+ (op2_info & (MAY_BE_LONG|MAY_BE_DOUBLE)) &&
+ ((op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_LONG|MAY_BE_DOUBLE))) ||
+ (op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_LONG|MAY_BE_DOUBLE))));
+
+ if ((op1_info & MAY_BE_LONG) && (op2_info & MAY_BE_LONG)) {
+ if (op1_info & (MAY_BE_ANY-MAY_BE_LONG)) {
+ if (op1_info & MAY_BE_DOUBLE) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_LONG, >4
+ } else {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_LONG, >9
+ }
+ }
+ if (!same_ops && (op2_info & (MAY_BE_ANY-MAY_BE_LONG))) {
+ if (op2_info & MAY_BE_DOUBLE) {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_LONG, >3
+ |.cold_code
+ |3:
+ if (op2_info & (MAY_BE_ANY-(MAY_BE_LONG|MAY_BE_DOUBLE))) {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_DOUBLE, >9
+ }
+ if (!zend_jit_cmp_long_double(Dst, opline, op1_addr, op2_addr, res_addr, smart_branch_opcode, target_label, target_label2)) {
+ return 0;
+ }
+ | jmp >6
+ |.code
+ } else {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_LONG, >9
+ }
+ }
+ if (!zend_jit_cmp_long_long(Dst, opline, op1_addr, op2_addr, res_addr, smart_branch_opcode, target_label, target_label2)) {
+ return 0;
+ }
+ if (op1_info & MAY_BE_DOUBLE) {
+ |.cold_code
+ |4:
+ if (op1_info & (MAY_BE_ANY-(MAY_BE_LONG|MAY_BE_DOUBLE))) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_DOUBLE, >9
+ }
+ if (op2_info & MAY_BE_DOUBLE) {
+ if (!same_ops && (op2_info & (MAY_BE_ANY-MAY_BE_DOUBLE))) {
+ if (!same_ops) {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_DOUBLE, >5
+ } else {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_DOUBLE, >9
+ }
+ }
+ if (!zend_jit_cmp_double_double(Dst, opline, op1_addr, op2_addr, res_addr, smart_branch_opcode, target_label, target_label2)) {
+ return 0;
+ }
+ | jmp >6
+ }
+ if (!same_ops) {
+ |5:
+ if (op2_info & (MAY_BE_ANY-(MAY_BE_LONG|MAY_BE_DOUBLE))) {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_LONG, >9
+ }
+ if (!zend_jit_cmp_double_long(Dst, opline, op1_addr, op2_addr, res_addr, smart_branch_opcode, target_label, target_label2)) {
+ return 0;
+ }
+ | jmp >6
+ }
+ |.code
+ }
+ } else if ((op1_info & MAY_BE_DOUBLE) &&
+ !(op1_info & MAY_BE_LONG) &&
+ (op2_info & (MAY_BE_LONG|MAY_BE_DOUBLE))) {
+ if (op1_info & (MAY_BE_ANY-MAY_BE_DOUBLE)) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_DOUBLE, >9
+ }
+ if (op2_info & MAY_BE_DOUBLE) {
+ if (!same_ops && (op2_info & (MAY_BE_ANY-MAY_BE_DOUBLE))) {
+ if (!same_ops && (op2_info & MAY_BE_LONG)) {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_DOUBLE, >3
+ } else {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_DOUBLE, >9
+ }
+ }
+ if (!zend_jit_cmp_double_double(Dst, opline, op1_addr, op2_addr, res_addr, smart_branch_opcode, target_label, target_label2)) {
+ return 0;
+ }
+ }
+ if (!same_ops && (op2_info & MAY_BE_LONG)) {
+ if (op2_info & MAY_BE_DOUBLE) {
+ |.cold_code
+ }
+ |3:
+ if (op2_info & (MAY_BE_ANY-(MAY_BE_DOUBLE|MAY_BE_LONG))) {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_LONG, >9
+ }
+ if (!zend_jit_cmp_double_long(Dst, opline, op1_addr, op2_addr, res_addr, smart_branch_opcode, target_label, target_label2)) {
+ return 0;
+ }
+ if (op2_info & MAY_BE_DOUBLE) {
+ | jmp >6
+ |.code
+ }
+ }
+ } else if ((op2_info & MAY_BE_DOUBLE) &&
+ !(op2_info & MAY_BE_LONG) &&
+ (op1_info & (MAY_BE_LONG|MAY_BE_DOUBLE))) {
+ if (op2_info & (MAY_BE_ANY-MAY_BE_DOUBLE)) {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_DOUBLE, >9
+ }
+ if (op1_info & MAY_BE_DOUBLE) {
+ if (!same_ops && (op1_info & (MAY_BE_ANY-MAY_BE_DOUBLE))) {
+ if (!same_ops && (op1_info & MAY_BE_LONG)) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_DOUBLE, >3
+ } else {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_DOUBLE, >9
+ }
+ }
+ if (!zend_jit_cmp_double_double(Dst, opline, op1_addr, op2_addr, res_addr, smart_branch_opcode, target_label, target_label2)) {
+ return 0;
+ }
+ }
+ if (!same_ops && (op1_info & MAY_BE_LONG)) {
+ if (op1_info & MAY_BE_DOUBLE) {
+ |.cold_code
+ }
+ |3:
+ if (op1_info & (MAY_BE_ANY-(MAY_BE_DOUBLE|MAY_BE_LONG))) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_LONG, >9
+ }
+ if (!zend_jit_cmp_long_double(Dst, opline, op1_addr, op2_addr, res_addr, smart_branch_opcode, target_label, target_label2)) {
+ return 0;
+ }
+ if (op1_info & MAY_BE_DOUBLE) {
+ | jmp >6
+ |.code
+ }
+ }
+ }
+
+ if (has_slow ||
+ (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_LONG|MAY_BE_DOUBLE))) ||
+ (op2_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_LONG|MAY_BE_DOUBLE)))) {
+ if (has_slow) {
+ |.cold_code
+ |9:
+ }
+ | SAVE_VALID_OPLINE opline
+ if (Z_MODE(op1_addr) == IS_REG) {
+ zend_jit_addr real_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->op1.var);
+ if (!zend_jit_spill_store(Dst, op1_addr, real_addr, op1_info, 1)) {
+ return 0;
+ }
+ op1_addr = real_addr;
+ }
+ if (Z_MODE(op2_addr) == IS_REG) {
+ zend_jit_addr real_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->op2.var);
+ if (!zend_jit_spill_store(Dst, op2_addr, real_addr, op2_info, 1)) {
+ return 0;
+ }
+ op2_addr = real_addr;
+ }
+ | LOAD_ZVAL_ADDR FCARG2a, op1_addr
+ if (opline->op1_type == IS_CV && (op1_info & MAY_BE_UNDEF)) {
+ | IF_NOT_Z_TYPE FCARG2a, IS_UNDEF, >1
+ | mov FCARG1a, opline->op1.var
+ | EXT_CALL zend_jit_undefined_op_helper, r0
+ | LOAD_ADDR_ZTS FCARG2a, executor_globals, uninitialized_zval
+ |1:
+ }
+ if (opline->op2_type == IS_CV && (op2_info & MAY_BE_UNDEF)) {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_UNDEF, >1
+ | mov T1, FCARG2a // save
+ | mov FCARG1a, opline->op2.var
+ | EXT_CALL zend_jit_undefined_op_helper, r0
+ | mov FCARG2a, T1 // restore
+ |.if X64
+ | LOAD_ADDR_ZTS CARG3, executor_globals, uninitialized_zval
+ |.else
+ | sub r4, 12
+ | PUSH_ADDR_ZTS executor_globals, uninitialized_zval, r0
+ |.endif
+ | jmp >2
+ |1:
+ |.if X64
+ | LOAD_ZVAL_ADDR CARG3, op2_addr
+ |.else
+ | sub r4, 12
+ | PUSH_ZVAL_ADDR op2_addr, r0
+ |.endif
+ |2:
+ } else {
+ |.if X64
+ | LOAD_ZVAL_ADDR CARG3, op2_addr
+ |.else
+ | sub r4, 12
+ | PUSH_ZVAL_ADDR op2_addr, r0
+ |.endif
+ }
+ | LOAD_ZVAL_ADDR FCARG1a, res_addr
+ | EXT_CALL compare_function, r0
+ |.if not(X64)
+ | add r4, 12
+ |.endif
+ if (opline->opcode != ZEND_CASE) {
+ | FREE_OP opline->op1_type, opline->op1, op1_info, 0, op_array, opline
+ }
+ | FREE_OP opline->op2_type, opline->op2, op2_info, 0, op_array, opline
+ if (may_throw) {
+ zend_jit_check_exception_undef_result(Dst, opline);
+ }
+ if (!zend_jit_cmp_slow(Dst, opline, res_addr, smart_branch_opcode, target_label, target_label2)) {
+ return 0;
+ }
+ if (has_slow) {
+ | jmp >6
+ |.code
+ }
+ }
+
+ |6:
+
+ return 1;
+}
+
+static int zend_jit_identical(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, uint32_t op1_info, zend_jit_addr op1_addr, uint32_t op2_info, zend_jit_addr op2_addr, zend_jit_addr res_addr, int may_throw, zend_uchar smart_branch_opcode, uint32_t target_label, uint32_t target_label2)
+{
+ uint32_t identical_label = (uint32_t)-1;
+ uint32_t not_identical_label = (uint32_t)-1;
+
+ if (smart_branch_opcode) {
+ if (opline->opcode == ZEND_IS_IDENTICAL) {
+ if (smart_branch_opcode == ZEND_JMPZ) {
+ not_identical_label = target_label;
+ } else if (smart_branch_opcode == ZEND_JMPNZ) {
+ identical_label = target_label;
+ } else if (smart_branch_opcode == ZEND_JMPZNZ) {
+ not_identical_label = target_label;
+ identical_label = target_label2;
+ } else {
+ ZEND_ASSERT(0);
+ }
+ } else if (opline->opcode == ZEND_IS_NOT_IDENTICAL) {
+ if (smart_branch_opcode == ZEND_JMPZ) {
+ identical_label = target_label;
+ } else if (smart_branch_opcode == ZEND_JMPNZ) {
+ not_identical_label = target_label;
+ } else if (smart_branch_opcode == ZEND_JMPZNZ) {
+ identical_label = target_label;
+ not_identical_label = target_label2;
+ } else {
+ ZEND_ASSERT(0);
+ }
+ } else {
+ ZEND_ASSERT(0);
+ }
+ }
+
+ if ((op1_info & MAY_BE_UNDEF) && (op2_info & MAY_BE_UNDEF)) {
+ op1_info |= MAY_BE_NULL;
+ op2_info |= MAY_BE_NULL;
+ | LOAD_ZVAL_ADDR FCARG1a, op1_addr
+ | IF_Z_TYPE FCARG1a, IS_UNDEF, >1
+ |.cold_code
+ |1:
+ | // zend_error(E_WARNING, "Undefined variable: %s", ZSTR_VAL(CV_DEF_OF(EX_VAR_TO_NUM(opline->op1.var))));
+ | SAVE_VALID_OPLINE opline
+ | mov FCARG1d, opline->op1.var
+ | EXT_CALL zend_jit_undefined_op_helper, r0
+ if (may_throw) {
+ zend_jit_check_exception_undef_result(Dst, opline);
+ }
+ | LOAD_ADDR_ZTS FCARG1a, executor_globals, uninitialized_zval
+ | jmp >1
+ |.code
+ |1:
+ | LOAD_ZVAL_ADDR FCARG2a, op2_addr
+ | IF_Z_TYPE FCARG2a, IS_UNDEF, >1
+ |.cold_code
+ |1:
+ | // zend_error(E_WARNING, "Undefined variable: %s", ZSTR_VAL(CV_DEF_OF(EX_VAR_TO_NUM(opline->op1.var))));
+ | SAVE_VALID_OPLINE opline
+ | mov aword T1, FCARG1a // save
+ | mov FCARG1d, opline->op2.var
+ | EXT_CALL zend_jit_undefined_op_helper, r0
+ if (may_throw) {
+ zend_jit_check_exception_undef_result(Dst, opline);
+ }
+ | mov FCARG1a, aword T1 // restore
+ | LOAD_ADDR_ZTS FCARG2a, executor_globals, uninitialized_zval
+ | jmp >1
+ |.code
+ |1:
+ } else if (op1_info & MAY_BE_UNDEF) {
+ op1_info |= MAY_BE_NULL;
+ | LOAD_ZVAL_ADDR FCARG1a, op1_addr
+ | IF_Z_TYPE FCARG1a, IS_UNDEF, >1
+ |.cold_code
+ |1:
+ | // zend_error(E_WARNING, "Undefined variable: %s", ZSTR_VAL(CV_DEF_OF(EX_VAR_TO_NUM(opline->op1.var))));
+ | SAVE_VALID_OPLINE opline
+ | mov FCARG1d, opline->op1.var
+ | EXT_CALL zend_jit_undefined_op_helper, r0
+ if (may_throw) {
+ zend_jit_check_exception_undef_result(Dst, opline);
+ }
+ | LOAD_ADDR_ZTS FCARG1a, executor_globals, uninitialized_zval
+ | jmp >1
+ |.code
+ |1:
+ if (opline->op2_type != IS_CONST) {
+ | LOAD_ZVAL_ADDR FCARG2a, op2_addr
+ }
+ } else if (op2_info & MAY_BE_UNDEF) {
+ op2_info |= MAY_BE_NULL;
+ | LOAD_ZVAL_ADDR FCARG2a, op2_addr
+ | IF_Z_TYPE FCARG2a, IS_UNDEF, >1
+ |.cold_code
+ |1:
+ | // zend_error(E_WARNING, "Undefined variable: %s", ZSTR_VAL(CV_DEF_OF(EX_VAR_TO_NUM(opline->op1.var))));
+ | SAVE_VALID_OPLINE opline
+ | mov FCARG1d, opline->op2.var
+ | EXT_CALL zend_jit_undefined_op_helper, r0
+ if (may_throw) {
+ zend_jit_check_exception_undef_result(Dst, opline);
+ }
+ | LOAD_ADDR_ZTS FCARG2a, executor_globals, uninitialized_zval
+ | jmp >1
+ |.code
+ |1:
+ if (opline->op1_type != IS_CONST) {
+ | LOAD_ZVAL_ADDR FCARG1a, op1_addr
+ }
+ } else {
+ if (opline->op1_type != IS_CONST) {
+ if (Z_MODE(op1_addr) == IS_REG) {
+ zend_jit_addr real_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->op1.var);
+ if (!zend_jit_spill_store(Dst, op1_addr, real_addr, op1_info, 1)) {
+ return 0;
+ }
+ op1_addr = real_addr;
+ }
+ | LOAD_ZVAL_ADDR FCARG1a, op1_addr
+ }
+ if (opline->op2_type != IS_CONST) {
+ if (Z_MODE(op2_addr) == IS_REG) {
+ zend_jit_addr real_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->op2.var);
+ if (!zend_jit_spill_store(Dst, op2_addr, real_addr, op2_info, 1)) {
+ return 0;
+ }
+ op2_addr = real_addr;
+ }
+ | LOAD_ZVAL_ADDR FCARG2a, op2_addr
+ }
+ }
+ if (opline->op1_type & (IS_CV|IS_VAR)) {
+ | ZVAL_DEREF FCARG1a, op1_info
+ }
+ if (opline->op2_type & (IS_CV|IS_VAR)) {
+ | ZVAL_DEREF FCARG2a, op2_info
+ }
+
+ if ((op1_info & op2_info & MAY_BE_ANY) == 0) {
+ if (((opline->op1_type & (IS_VAR|IS_TMP_VAR)) &&
+ (op1_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF))) ||
+ ((opline->op2_type & (IS_VAR|IS_TMP_VAR)) &&
+ (op2_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF)))) {
+ | SAVE_VALID_OPLINE opline
+ | FREE_OP opline->op1_type, opline->op1, op1_info, 1, op_array, opline
+ | FREE_OP opline->op2_type, opline->op2, op2_info, 1, op_array, opline
+ }
+ if (smart_branch_opcode) {
+ zend_jit_check_exception_undef_result(Dst, opline);
+ if (not_identical_label != (uint32_t)-1) {
+ | jmp =>not_identical_label
+ }
+ } else {
+ | SET_ZVAL_TYPE_INFO res_addr, (opline->opcode == ZEND_IS_IDENTICAL ? IS_FALSE : IS_TRUE)
+ zend_jit_check_exception(Dst);
+ }
+ } else if (has_concrete_type(op1_info) &&
+ has_concrete_type(op2_info) &&
+ concrete_type(op1_info) == concrete_type(op2_info) &&
+ concrete_type(op1_info) <= IS_TRUE) {
+ if (smart_branch_opcode) {
+ if (identical_label != (uint32_t)-1) {
+ | jmp =>identical_label
+ }
+ } else {
+ | SET_ZVAL_TYPE_INFO res_addr, (opline->opcode == ZEND_IS_IDENTICAL ? IS_TRUE : IS_FALSE)
+ }
+ } else if (Z_MODE(op1_addr) == IS_CONST_ZVAL && Z_MODE(op2_addr) == IS_CONST_ZVAL) {
+ if (zend_is_identical(Z_ZV(op1_addr), Z_ZV(op2_addr))) {
+ if (smart_branch_opcode) {
+ if (identical_label != (uint32_t)-1) {
+ | jmp =>identical_label
+ }
+ } else {
+ | SET_ZVAL_TYPE_INFO res_addr, (opline->opcode == ZEND_IS_IDENTICAL ? IS_TRUE : IS_FALSE)
+ }
+ } else {
+ if (smart_branch_opcode) {
+ if (not_identical_label != (uint32_t)-1) {
+ | jmp =>not_identical_label
+ }
+ } else {
+ | SET_ZVAL_TYPE_INFO res_addr, (opline->opcode == ZEND_IS_IDENTICAL ? IS_FALSE : IS_TRUE)
+ }
+ }
+ } else if (Z_MODE(op1_addr) == IS_CONST_ZVAL && Z_TYPE_P(Z_ZV(op1_addr)) <= IS_TRUE) {
+ zval *val = Z_ZV(op1_addr);
+
+ | cmp byte [FCARG2a + offsetof(zval, u1.v.type)], Z_TYPE_P(val)
+ if (smart_branch_opcode) {
+ if (opline->op2_type == IS_VAR && (op2_info & MAY_BE_REF)) {
+ | jne >8
+ | SAVE_VALID_OPLINE opline
+ | FREE_OP opline->op2_type, opline->op2, op2_info, 1, op_array, opline
+ zend_jit_check_exception_undef_result(Dst, opline);
+ if (identical_label != (uint32_t)-1) {
+ | jmp =>identical_label
+ } else {
+ | jmp >9
+ }
+ |8:
+ } else if (identical_label != (uint32_t)-1) {
+ | je =>identical_label
+ } else {
+ | je >9
+ }
+ } else {
+ if (opline->opcode == ZEND_IS_IDENTICAL) {
+ | sete al
+ } else {
+ | setne al
+ }
+ | movzx eax, al
+ | lea eax, [eax + 2]
+ | SET_ZVAL_TYPE_INFO res_addr, eax
+ }
+ if ((opline->op2_type & (IS_VAR|IS_TMP_VAR)) &&
+ (op2_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF))) {
+ | SAVE_VALID_OPLINE opline
+ | FREE_OP opline->op2_type, opline->op2, op2_info, 1, op_array, opline
+ zend_jit_check_exception_undef_result(Dst, opline);
+ }
+ if (smart_branch_opcode && not_identical_label != (uint32_t)-1) {
+ | jmp =>not_identical_label
+ }
+ } else if (Z_MODE(op2_addr) == IS_CONST_ZVAL && Z_TYPE_P(Z_ZV(op2_addr)) <= IS_TRUE) {
+ zval *val = Z_ZV(op2_addr);
+
+ | cmp byte [FCARG1a + offsetof(zval, u1.v.type)], Z_TYPE_P(val)
+ if (smart_branch_opcode) {
+ if (opline->op1_type == IS_VAR && (op1_info & MAY_BE_REF)) {
+ | jne >8
+ | SAVE_VALID_OPLINE opline
+ | FREE_OP opline->op1_type, opline->op1, op1_info, 1, op_array, opline
+ zend_jit_check_exception_undef_result(Dst, opline);
+ if (identical_label != (uint32_t)-1) {
+ | jmp =>identical_label
+ } else {
+ | jmp >9
+ }
+ |8:
+ } else if (identical_label != (uint32_t)-1) {
+ | je =>identical_label
+ } else {
+ | je >9
+ }
+ } else {
+ if (opline->opcode == ZEND_IS_IDENTICAL) {
+ | sete al
+ } else {
+ | setne al
+ }
+ | movzx eax, al
+ | lea eax, [eax + 2]
+ | SET_ZVAL_TYPE_INFO res_addr, eax
+ }
+ if ((opline->op1_type & (IS_VAR|IS_TMP_VAR)) &&
+ (op1_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF))) {
+ | SAVE_VALID_OPLINE opline
+ | FREE_OP opline->op1_type, opline->op1, op1_info, 1, op_array, opline
+ zend_jit_check_exception_undef_result(Dst, opline);
+ }
+ if (smart_branch_opcode && not_identical_label != (uint32_t)-1) {
+ | jmp =>not_identical_label
+ }
+ } else if ((op1_info & MAY_BE_ANY) == MAY_BE_LONG &&
+ (op2_info & MAY_BE_ANY) == MAY_BE_LONG) {
+ if (!zend_jit_cmp_long_long(Dst, opline, op1_addr, op2_addr, res_addr, smart_branch_opcode, target_label, target_label2)) {
+ return 0;
+ }
+ } else if ((op1_info & MAY_BE_ANY) == MAY_BE_DOUBLE &&
+ (op2_info & MAY_BE_ANY) == MAY_BE_DOUBLE) {
+ if (!zend_jit_cmp_double_double(Dst, opline, op1_addr, op2_addr, res_addr, smart_branch_opcode, target_label, target_label2)) {
+ return 0;
+ }
+ } else {
+ if (opline->op1_type == IS_CONST) {
+ | LOAD_ZVAL_ADDR FCARG1a, op1_addr
+ }
+ if (opline->op2_type == IS_CONST) {
+ | LOAD_ZVAL_ADDR FCARG2a, op2_addr
+ }
+ | EXT_CALL zend_is_identical, r0
+ if (((opline->op1_type & (IS_VAR|IS_TMP_VAR)) &&
+ (op1_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF))) ||
+ ((opline->op2_type & (IS_VAR|IS_TMP_VAR)) &&
+ (op2_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF)))) {
+ | mov aword T1, r0 // save
+ | SAVE_VALID_OPLINE opline
+ | FREE_OP opline->op1_type, opline->op1, op1_info, 1, op_array, opline
+ | FREE_OP opline->op2_type, opline->op2, op2_info, 1, op_array, opline
+ zend_jit_check_exception_undef_result(Dst, opline);
+ | mov r0, aword T1 // restore
+ }
+ if (smart_branch_opcode) {
+ | test al, al
+ if (not_identical_label != (uint32_t)-1) {
+ | jz =>not_identical_label
+ if (identical_label != (uint32_t)-1) {
+ | jmp =>identical_label
+ }
+ } else if (identical_label != (uint32_t)-1) {
+ | jnz =>identical_label
+ }
+ } else {
+ | movzx eax, al
+ if (opline->opcode == ZEND_IS_IDENTICAL) {
+ | lea eax, [eax + 2]
+ } else {
+ | neg eax
+ | lea eax, [eax + 3]
+ }
+ | SET_ZVAL_TYPE_INFO res_addr, eax
+ }
+ }
+
+ |9:
+ if (may_throw) {
+ zend_jit_check_exception(Dst);
+ }
+
+ return 1;
+}
+
+static int zend_jit_bool_jmpznz(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, uint32_t op1_info, zend_jit_addr op1_addr, zend_jit_addr res_addr, uint32_t target_label, uint32_t target_label2, int may_throw)
+{
+ uint32_t true_label = -1;
+ uint32_t false_label = -1;
+ zend_bool set_bool = 0;
+ zend_bool set_bool_not = 0;
+ zend_bool jmp_done = 0;
+
+ if (opline->opcode == ZEND_JMPZ) {
+ false_label = target_label;
+ } else if (opline->opcode == ZEND_JMPNZ) {
+ true_label = target_label;
+ } else if (opline->opcode == ZEND_JMPZNZ) {
+ true_label = target_label2;
+ false_label = target_label;
+ } else if (opline->opcode == ZEND_BOOL) {
+ set_bool = 1;
+ } else if (opline->opcode == ZEND_BOOL_NOT) {
+ set_bool = 1;
+ set_bool_not = 1;
+ } else if (opline->opcode == ZEND_JMPZ_EX) {
+ set_bool = 1;
+ false_label = target_label;
+ } else if (opline->opcode == ZEND_JMPNZ_EX) {
+ set_bool = 1;
+ true_label = target_label;
+ } else {
+ ZEND_ASSERT(0);
+ }
+
+ if (Z_MODE(op1_addr) == IS_CONST_ZVAL) {
+ if (zend_is_true(Z_ZV(op1_addr))) {
+ /* Always TRUE */
+ if (set_bool) {
+ if (set_bool_not) {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
+ } else {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
+ }
+ }
+ if (true_label != (uint32_t)-1) {
+ | jmp =>true_label;
+ }
+ } else {
+ /* Always FALSE */
+ if (set_bool) {
+ if (set_bool_not) {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
+ } else {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
+ }
+ }
+ if (false_label != (uint32_t)-1) {
+ | jmp =>false_label;
+ }
+ }
+ return 1;
+ }
+
+ if (op1_info & MAY_BE_REF) {
+ | LOAD_ZVAL_ADDR FCARG1a, op1_addr
+ | ZVAL_DEREF FCARG1a, op1_info
+ op1_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 0);
+ }
+
+ if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE)) {
+ if (!(op1_info & ((MAY_BE_UNDEF|MAY_BE_ANY)-MAY_BE_TRUE))) {
+ /* Always TRUE */
+ if (set_bool) {
+ if (set_bool_not) {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
+ } else {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
+ }
+ }
+ if (true_label != (uint32_t)-1) {
+ | jmp =>true_label;
+ }
+ } else {
+ if (!(op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE)))) {
+ /* Always FALSE */
+ if (set_bool) {
+ if (set_bool_not) {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
+ } else {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
+ }
+ }
+ } else {
+ | CMP_ZVAL_TYPE op1_addr, IS_TRUE
+ if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE))) {
+ if ((op1_info & MAY_BE_LONG) &&
+ !(op1_info & MAY_BE_UNDEF) &&
+ !set_bool) {
+ if (false_label != (uint32_t)-1) {
+ | jl =>false_label
+ } else {
+ | jl >9
+ }
+ jmp_done = 1;
+ } else {
+ | jg >2
+ }
+ }
+ if (!(op1_info & MAY_BE_TRUE)) {
+ /* It's FALSE */
+ if (set_bool) {
+ if (set_bool_not) {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
+ } else {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
+ }
+ }
+ } else {
+ if (true_label != (uint32_t)-1 || false_label != (uint32_t)-1) {
+ if (set_bool) {
+ | jne >1
+ | SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
+ if (true_label != (uint32_t)-1) {
+ | jmp =>true_label
+ } else {
+ | jmp >9
+ }
+ |1:
+ | SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
+ } else {
+ if (true_label != (uint32_t)-1) {
+ | je =>true_label
+ } else if (!(op1_info & (MAY_BE_UNDEF|MAY_BE_LONG))) {
+ | jne =>false_label
+ jmp_done = 1;
+ } else {
+ | je >9
+ }
+ }
+ } else if (set_bool) {
+ | sete al
+ | movzx eax, al
+ if (set_bool_not) {
+ | neg eax
+ | add eax, 3
+ } else {
+ | add eax, 2
+ }
+ | SET_ZVAL_TYPE_INFO res_addr, eax
+ }
+ }
+ }
+
+ /* It's FALSE, but may be UNDEF */
+ if (op1_info & MAY_BE_UNDEF) {
+ if (op1_info & MAY_BE_ANY) {
+ | IF_ZVAL_TYPE op1_addr, IS_UNDEF, >1
+ |.cold_code
+ |1:
+ }
+ | mov FCARG1d, opline->op1.var
+ | SAVE_VALID_OPLINE opline
+ | EXT_CALL zend_jit_undefined_op_helper, r0
+
+ if (may_throw) {
+ if (!zend_jit_check_exception_undef_result(Dst, opline)) {
+ return 0;
+ }
+ }
+
+ if (false_label != (uint32_t)-1) {
+ | jmp =>false_label
+ }
+ if (op1_info & MAY_BE_ANY) {
+ if (false_label == (uint32_t)-1) {
+ | jmp >9
+ }
+ |.code
+ }
+ }
+
+ if (!jmp_done) {
+ if (false_label != (uint32_t)-1) {
+ | jmp =>false_label
+ } else if (op1_info & MAY_BE_LONG) {
+ | jmp >9
+ }
+ }
+ }
+ }
+
+ if (op1_info & MAY_BE_LONG) {
+ |2:
+ if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG))) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_LONG, >2
+ }
+ if (Z_MODE(op1_addr) == IS_REG) {
+ | test Ra(Z_REG(op1_addr)), Ra(Z_REG(op1_addr))
+ } else {
+ | LONG_OP_WITH_CONST, cmp, op1_addr, Z_L(0)
+ }
+ if (set_bool) {
+ | setne al
+ | movzx eax, al
+ if (set_bool_not) {
+ | neg eax
+ | add eax, 3
+ } else {
+ | lea eax, [eax + 2]
+ }
+ | SET_ZVAL_TYPE_INFO res_addr, eax
+ }
+ if (true_label != (uint32_t)-1 || false_label != (uint32_t)-1) {
+ if (true_label != (uint32_t)-1) {
+ | jne =>true_label
+ if (false_label != (uint32_t)-1) {
+ | jmp =>false_label
+ }
+ } else {
+ | je =>false_label
+ }
+ }
+ }
+
+ if ((op1_info & MAY_BE_ANY) == MAY_BE_DOUBLE) {
+ if (zend_jit_x86_flags & ZEND_JIT_CPU_AVX) {
+ | vxorps xmm0, xmm0, xmm0
+ } else {
+ | xorps xmm0, xmm0
+ }
+ | SSE_AVX_OP ucomisd, vucomisd, ZREG_XMM0, op1_addr
+
+ if (set_bool) {
+ if (false_label != (uint32_t)-1) { // JMPZ_EX
+ | SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
+ | jp >1
+ | je => false_label
+ | SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
+ |1:
+ } else if (true_label != (uint32_t)-1) { // JMPNZ_EX
+ | jp >1
+ | SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
+ | jne => true_label
+ |1:
+ | SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
+ } else if (set_bool_not) { // BOOL_NOT
+ | jp >1
+ | mov eax, IS_TRUE
+ | je >2
+ |1:
+ | mov eax, IS_FALSE
+ |2:
+ | SET_ZVAL_TYPE_INFO res_addr, eax
+ } else { // BOOL
+ | jp >1
+ | mov eax, IS_TRUE
+ | jne >2
+ |1:
+ | mov eax, IS_FALSE
+ |2:
+ | SET_ZVAL_TYPE_INFO res_addr, eax
+ }
+ } else {
+ ZEND_ASSERT(true_label != (uint32_t)-1 || false_label != (uint32_t)-1);
+ if (false_label != (uint32_t)-1) {
+ | jp =>false_label
+ } else {
+ | jp >1
+ }
+ if (true_label != (uint32_t)-1) {
+ | jne =>true_label
+ if (false_label != (uint32_t)-1) {
+ | jmp =>false_label
+ }
+ } else {
+ | je =>false_label
+ }
+ |1:
+ }
+ } else if (op1_info & (MAY_BE_ANY - (MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG))) {
+ if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG)) {
+ |.cold_code
+ |2:
+ }
+ if (Z_REG(op1_addr) != ZREG_FCARG1a) {
+ | LOAD_ZVAL_ADDR FCARG1a, op1_addr
+ }
+ | SAVE_VALID_OPLINE opline
+ | EXT_CALL zend_is_true, r0
+
+ if ((opline->op1_type & (IS_VAR|IS_TMP_VAR)) &&
+ (op1_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
+ op1_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->op1.var);
+
+ | IF_NOT_ZVAL_REFCOUNTED op1_addr, >3
+ | GET_ZVAL_PTR FCARG1a, op1_addr
+ | GC_DELREF FCARG1a
+ | jnz >3
+ | mov aword T1, r0 // save
+ | ZVAL_DTOR_FUNC op1_info, opline
+ | mov r0, aword T1 // restore
+ |3:
+ }
+ if (may_throw) {
+ | MEM_OP2_1_ZTS cmp, aword, executor_globals, exception, 0, r1
+ | jne ->exception_handler_undef
+ }
+
+ if (set_bool) {
+ if (set_bool_not) {
+ | neg eax
+ | add eax, 3
+ } else {
+ | add eax, 2
+ }
+ | SET_ZVAL_TYPE_INFO res_addr, eax
+ if (true_label != (uint32_t)-1 || false_label != (uint32_t)-1) {
+ | CMP_ZVAL_TYPE res_addr, IS_FALSE
+ if (true_label != (uint32_t)-1) {
+ | jne =>true_label
+ if (false_label != (uint32_t)-1) {
+ | jmp =>false_label
+ } else if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG)) {
+ | jmp >9
+ }
+ } else {
+ | je =>false_label
+ }
+ }
+ if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG)) {
+ | jmp >9
+ |.code
+ }
+ } else {
+ | test r0, r0
+ if (true_label != (uint32_t)-1) {
+ | jne =>true_label
+ if (false_label != (uint32_t)-1) {
+ | jmp =>false_label
+ } else if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG)) {
+ | jmp >9
+ }
+ } else {
+ | je =>false_label
+ if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG)) {
+ | jmp >9
+ }
+ }
+
+ if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG)) {
+ |.code
+ }
+ }
+ }
+
+ |9:
+
+ return 1;
+}
+
+static int zend_jit_qm_assign(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, uint32_t op1_info, zend_jit_addr op1_addr, zend_jit_addr op1_def_addr, uint32_t res_info, zend_jit_addr res_addr)
+{
+ if (op1_addr != op1_def_addr) {
+ if (!zend_jit_update_regs(Dst, op1_addr, op1_def_addr, op1_info)) {
+ return 0;
+ }
+ }
+
+ if (!zend_jit_simple_assign(Dst, opline, op_array, res_addr, -1, -1, opline->op1_type, opline->op1, op1_addr, op1_info, 0, 0)) {
+ return 0;
+ }
+ if (!zend_jit_store_var_if_necessary(Dst, opline->result.var, res_addr, res_info)) {
+ return 0;
+ }
+ return 1;
+}
+
+static int zend_jit_assign(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, uint32_t op1_info, zend_jit_addr op1_use_addr, uint32_t op1_def_info, zend_jit_addr op1_addr, uint32_t op2_info, zend_jit_addr op2_addr, zend_jit_addr op2_def_addr, uint32_t res_info, zend_jit_addr res_addr, int may_throw)
+{
+ ZEND_ASSERT(opline->op1_type == IS_CV);
+
+ if (op2_addr != op2_def_addr) {
+ if (!zend_jit_update_regs(Dst, op2_addr, op2_def_addr, op2_info)) {
+ return 0;
+ }
+ }
+
+ if (!zend_jit_assign_to_variable(Dst, opline, op_array, op1_addr, op1_info, op1_def_info, opline->op2_type, opline->op2, op2_addr, op2_info, res_addr)) {
+ return 0;
+ }
+ if (!zend_jit_store_var_if_necessary_ex(Dst, opline->op1.var, op1_addr, op1_def_info, op1_use_addr, op1_info)) {
+ return 0;
+ }
+ if (opline->result_type != IS_UNUSED) {
+ if (!zend_jit_store_var_if_necessary(Dst, opline->result.var, res_addr, res_info)) {
+ return 0;
+ }
+ }
+
+ if (may_throw) {
+ zend_jit_check_exception(Dst);
+ }
+
+ return 1;
+}
+
+static int zend_jit_push_call_frame(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, zend_function *func)
+{
+ uint32_t used_stack;
+
+ if (func) {
+ used_stack = zend_vm_calc_used_stack(opline->extended_value, func);
+ } else {
+ used_stack = (ZEND_CALL_FRAME_SLOT + opline->extended_value) * sizeof(zval);
+
+ | // if (EXPECTED(ZEND_USER_CODE(func->type))) {
+ | test byte [r0 + offsetof(zend_function, type)], 1
+ | mov FCARG1a, used_stack
+ | jnz >1
+ | // used_stack += (func->op_array.last_var + func->op_array.T - MIN(func->op_array.num_args, num_args)) * sizeof(zval);
+ | mov edx, opline->extended_value
+ | cmp edx, dword [r0 + offsetof(zend_function, op_array.num_args)]
+ | cmova edx, dword [r0 + offsetof(zend_function, op_array.num_args)]
+ | sub edx, dword [r0 + offsetof(zend_function, op_array.last_var)]
+ | sub edx, dword [r0 + offsetof(zend_function, op_array.T)]
+ | shl edx, 5
+ |.if X64
+ | movsxd r2, edx
+ |.endif
+ | sub FCARG1a, r2
+ |1:
+ }
+
+ zend_jit_start_reuse_ip();
+
+ | // if (UNEXPECTED(used_stack > (size_t)(((char*)EG(vm_stack_end)) - (char*)call))) {
+ | MEM_OP2_2_ZTS mov, RX, aword, executor_globals, vm_stack_top, RX
+ | // Check Stack Overflow
+ | MEM_OP2_2_ZTS mov, r2, aword, executor_globals, vm_stack_end, r2
+ | sub r2, RX
+ if (func) {
+ | cmp r2, used_stack
+ } else {
+ | cmp r2, FCARG1a
+ }
+ | jb >1
+ | // EG(vm_stack_top) = (zval*)((char*)call + used_stack);
+ |.cold_code
+ |1:
+ | SAVE_VALID_OPLINE opline
+ if (func) {
+ | mov FCARG1d, used_stack
+ }
+#ifdef _WIN32
+ if (0) {
+#else
+ if (func && func->type == ZEND_INTERNAL_FUNCTION) {
+#endif
+ | EXT_CALL zend_jit_int_extend_stack_helper, r0
+ } else {
+ | mov FCARG2a, r0
+ | EXT_CALL zend_jit_extend_stack_helper, r0
+ }
+ | mov RX, r0
+ | jmp >1
+ |.code
+
+ if (func) {
+ | MEM_OP2_1_ZTS add, aword, executor_globals, vm_stack_top, used_stack, r2
+ } else {
+ | MEM_OP2_1_ZTS add, aword, executor_globals, vm_stack_top, FCARG1a, r2
+ }
+ | // zend_vm_init_call_frame(call, call_info, func, num_args, called_scope, object);
+ | // ZEND_SET_CALL_INFO(call, 0, call_info);
+ | mov dword EX:RX->This.u1.type_info, (IS_UNDEF | ZEND_CALL_NESTED_FUNCTION)
+ | // call->func = func;
+#ifdef _WIN32
+ if (0) {
+#else
+ if (func && func->type == ZEND_INTERNAL_FUNCTION) {
+#endif
+ |1:
+ | ADDR_OP2_2 mov, aword EX:RX->func, func, r1
+ } else {
+ | mov aword EX:RX->func, r0
+ |1:
+ }
+ | // Z_CE(call->This) = called_scope;
+ | mov aword EX:RX->This.value.ptr, 0
+ | // ZEND_CALL_NUM_ARGS(call) = num_args;
+ | mov dword EX:RX->This.u2.num_args, opline->extended_value
+ return 1;
+}
+
+static int zend_jit_needs_call_chain(zend_call_info *call_info, uint32_t b, const zend_op_array *op_array, zend_ssa *ssa, const zend_op *opline)
+{
+ int skip;
+
+ if (!call_info) {
+ const zend_op *end = op_array->opcodes + op_array->last;
+
+ opline++;
+ skip = 1;
+ while (opline != end) {
+ if (!skip) {
+ if (zend_may_throw(opline, op_array, ssa)) {
+ return 1;
+ }
+ }
+ switch (opline->opcode) {
+ case ZEND_SEND_VAL:
+ case ZEND_SEND_VAR:
+ case ZEND_SEND_VAL_EX:
+ case ZEND_SEND_VAR_EX:
+ case ZEND_SEND_FUNC_ARG:
+ case ZEND_SEND_REF:
+ case ZEND_SEND_VAR_NO_REF:
+ case ZEND_SEND_VAR_NO_REF_EX:
+ skip = 0;
+ break;
+ case ZEND_SEND_ARRAY:
+ case ZEND_SEND_USER:
+ case ZEND_SEND_UNPACK:
+ case ZEND_INIT_FCALL:
+ case ZEND_INIT_METHOD_CALL:
+ case ZEND_INIT_STATIC_METHOD_CALL:
+ case ZEND_INIT_FCALL_BY_NAME:
+ case ZEND_INIT_NS_FCALL_BY_NAME:
+ case ZEND_INIT_DYNAMIC_CALL:
+ case ZEND_NEW:
+ case ZEND_INIT_USER_CALL:
+ case ZEND_FAST_CALL:
+ case ZEND_JMP:
+ case ZEND_JMPZNZ:
+ case ZEND_JMPZ:
+ case ZEND_JMPNZ:
+ case ZEND_JMPZ_EX:
+ case ZEND_JMPNZ_EX:
+ case ZEND_FE_RESET_R:
+ case ZEND_FE_RESET_RW:
+ case ZEND_JMP_SET:
+ case ZEND_COALESCE:
+ case ZEND_ASSERT_CHECK:
+ case ZEND_CATCH:
+ case ZEND_DECLARE_ANON_CLASS:
+ case ZEND_FE_FETCH_R:
+ case ZEND_FE_FETCH_RW:
+ return 1;
+ case ZEND_DO_ICALL:
+ case ZEND_DO_UCALL:
+ case ZEND_DO_FCALL_BY_NAME:
+ case ZEND_DO_FCALL:
+ end = opline;
+ if (end - op_array->opcodes >= ssa->cfg.blocks[b].start + ssa->cfg.blocks[b].len) {
+ /* INIT_FCALL and DO_FCALL in different BasicBlocks */
+ return 1;
+ }
+ return 0;
+ }
+ opline++;
+ }
+
+ return 1;
+ } else {
+ const zend_op *end = call_info->caller_call_opline;
+
+ if (end - op_array->opcodes >= ssa->cfg.blocks[b].start + ssa->cfg.blocks[b].len) {
+ /* INIT_FCALL and DO_FCALL in different BasicBlocks */
+ return 1;
+ }
+
+ opline++;
+ skip = 1;
+ while (opline != end) {
+ if (skip) {
+ switch (opline->opcode) {
+ case ZEND_SEND_VAL:
+ case ZEND_SEND_VAR:
+ case ZEND_SEND_VAL_EX:
+ case ZEND_SEND_VAR_EX:
+ case ZEND_SEND_FUNC_ARG:
+ case ZEND_SEND_REF:
+ case ZEND_SEND_VAR_NO_REF:
+ case ZEND_SEND_VAR_NO_REF_EX:
+ skip = 0;
+ break;
+ case ZEND_SEND_ARRAY:
+ case ZEND_SEND_USER:
+ case ZEND_SEND_UNPACK:
+ return 1;
+ }
+ } else {
+ if (zend_may_throw(opline, op_array, ssa)) {
+ return 1;
+ }
+ }
+ opline++;
+ }
+
+ return 0;
+ }
+}
+
+static int zend_jit_init_fcall(dasm_State **Dst, const zend_op *opline, uint32_t b, const zend_op_array *op_array, zend_ssa *ssa, int call_level)
+{
+ zend_func_info *info = ZEND_FUNC_INFO(op_array);
+ zend_call_info *call_info = NULL;
+ zend_function *func = NULL;
+
+ if (delayed_call_chain) {
+ if (!zend_jit_save_call_chain(Dst, delayed_call_level)) {
+ return 0;
+ }
+ }
+
+ if (info) {
+ call_info = info->callee_info;
+ while (call_info && call_info->caller_init_opline != opline) {
+ call_info = call_info->next_callee;
+ }
+ if (call_info && call_info->callee_func) {
+ func = call_info->callee_func;
+ }
+ }
+
+#ifdef _WIN32
+ if (0) {
+#else
+ if (func && func->type == ZEND_INTERNAL_FUNCTION) {
+#endif
+ /* load constant address later */
+ } else if (func && op_array == &func->op_array) {
+ /* recursive call */
+ | mov r0, EX->func
+ } else {
+ | // if (CACHED_PTR(opline->result.num))
+ | mov r0, EX->run_time_cache
+ | mov r0, aword [r0 + opline->result.num]
+ | test r0, r0
+ | jz >1
+ |.cold_code
+ |1:
+ if (func && func->type == ZEND_USER_FUNCTION && (func->op_array.fn_flags & ZEND_ACC_IMMUTABLE)) {
+ | LOAD_ADDR FCARG1a, func
+ | EXT_CALL zend_jit_init_func_run_time_cache_helper, r0
+ | mov r1, EX->run_time_cache
+ | mov aword [r1 + opline->result.num], r0
+ | jmp >3
+ } else {
+ zval *zv = RT_CONSTANT(opline, opline->op2);
+
+ if (opline->opcode == ZEND_INIT_FCALL) {
+ | LOAD_ADDR FCARG1a, Z_STR_P(zv);
+ } else if (opline->opcode == ZEND_INIT_FCALL_BY_NAME) {
+ | LOAD_ADDR FCARG1a, Z_STR_P(zv + 1);
+ } else {
+ ZEND_ASSERT(0);
+ }
+ | EXT_CALL zend_jit_find_func_helper, r0
+ | // CACHE_PTR(opline->result.num, fbc);
+ | mov r1, EX->run_time_cache
+ | mov aword [r1 + opline->result.num], r0
+ | test r0, r0
+ | jnz >3
+ | // SAVE_OPLINE();
+ | SAVE_VALID_OPLINE opline
+ | jmp ->undefined_function
+ }
+ |.code
+ |3:
+ }
+
+ if (!zend_jit_push_call_frame(Dst, opline, op_array, func)) {
+ return 0;
+ }
+
+ if (zend_jit_needs_call_chain(call_info, b, op_array, ssa, opline)) {
+ if (!zend_jit_save_call_chain(Dst, call_level)) {
+ return 0;
+ }
+ } else {
+ delayed_call_chain = 1;
+ delayed_call_level = call_level;
+ }
+
+ return 1;
+}
+
+static uint32_t skip_valid_arguments(const zend_op_array *op_array, zend_ssa *ssa, zend_call_info *call_info)
+{
+ uint32_t num_args = 0;
+ zend_function *func = call_info->callee_func;
+
+ while (num_args < call_info->num_args) {
+ zend_arg_info *arg_info = func->op_array.arg_info + num_args;
+
+ if (ZEND_TYPE_IS_SET(arg_info->type)) {
+ if (ZEND_TYPE_IS_ONLY_MASK(arg_info->type)) {
+ uint32_t type_mask = ZEND_TYPE_PURE_MASK(arg_info->type);
+ uint32_t info = _ssa_op1_info(op_array, ssa, call_info->arg_info[num_args].opline);
+ if ((info & (MAY_BE_ANY|MAY_BE_UNDEF)) & ~type_mask) {
+ break;
+ }
+ } else {
+ break;
+ }
+ }
+ num_args++;
+ }
+ return num_args;
+}
+
+static int zend_jit_do_fcall(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, zend_ssa *ssa, int call_level, unsigned int next_block)
+{
+ zend_func_info *info = ZEND_FUNC_INFO(op_array);
+ zend_call_info *call_info = NULL;
+ zend_function *func = NULL;
+ uint32_t i;
+ zend_jit_addr res_addr;
+
+ if (RETURN_VALUE_USED(opline)) {
+ res_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->result.var);
+ } else {
+#ifdef _WIN64
+ /* Reuse reserved arguments stack */
+ res_addr = ZEND_ADDR_MEM_ZVAL(ZREG_R4, 0x20);
+#else
+ /* CPU stack allocated temporary zval */
+ res_addr = ZEND_ADDR_MEM_ZVAL(ZREG_R4, 8);
+#endif
+ }
+
+ if (info) {
+ call_info = info->callee_info;
+ while (call_info && call_info->caller_call_opline != opline) {
+ call_info = call_info->next_callee;
+ }
+ if (call_info && call_info->callee_func) {
+ func = call_info->callee_func;
+ }
+ }
+ if (!func) {
+ /* resolve function ar run time */
+ } else if (func->type == ZEND_USER_FUNCTION) {
+ ZEND_ASSERT(opline->opcode != ZEND_DO_ICALL);
+ if (call_info->num_args > func->op_array.num_args ||
+ (opline-1)->opcode == ZEND_SEND_UNPACK ||
+ (opline-1)->opcode == ZEND_SEND_ARRAY) {
+ goto fallback;
+ }
+ } else if (func->type == ZEND_INTERNAL_FUNCTION) {
+ ZEND_ASSERT(opline->opcode != ZEND_DO_UCALL);
+#if ZEND_DEBUG
+ if (func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) {
+ goto fallback;
+ }
+#endif
+ if ((opline-1)->opcode == ZEND_SEND_UNPACK || (opline-1)->opcode == ZEND_SEND_ARRAY) {
+ goto fallback;
+ }
+ } else {
+ ZEND_ASSERT(0);
+ }
+
+ if (!reuse_ip) {
+ zend_jit_start_reuse_ip();
+ | // call = EX(call);
+ | mov RX, EX->call
+ }
+ zend_jit_stop_reuse_ip();
+
+ | // fbc = call->func;
+ | // mov r2, EX:RX->func ???
+ | // SAVE_OPLINE();
+ | SAVE_VALID_OPLINE opline
+
+ if (!delayed_call_chain) {
+ if (call_level == 1) {
+ | mov aword EX->call, 0
+ } else {
+ | //EX(call) = call->prev_execute_data;
+ | mov r0, EX:RX->prev_execute_data
+ | mov EX->call, r0
+ }
+ }
+ delayed_call_chain = 0;
+
+ | //call->prev_execute_data = execute_data;
+ | mov EX:RX->prev_execute_data, EX
+
+ if (!func) {
+ | mov r0, EX:RX->func
+ }
+
+ if (opline->opcode == ZEND_DO_FCALL) {
+ if (!func) {
+ | test dword [r0 + offsetof(zend_op_array, fn_flags)], ZEND_ACC_DEPRECATED
+ | jnz >1
+ |.cold_code
+ |1:
+ if (!GCC_GLOBAL_REGS) {
+ | mov FCARG1a, RX
+ }
+ | EXT_CALL zend_jit_deprecated_helper, r0
+ | MEM_OP2_1_ZTS cmp, aword, executor_globals, exception, 0, r0
+ | jne ->exception_handler
+ | mov r0, EX:RX->func // reload
+ | jmp >1
+ |.code
+ |1:
+ } else if (func->common.fn_flags & ZEND_ACC_DEPRECATED) {
+ if (!GCC_GLOBAL_REGS) {
+ | mov FCARG1a, RX
+ }
+ | EXT_CALL zend_jit_deprecated_helper, r0
+ | MEM_OP2_1_ZTS cmp, aword, executor_globals, exception, 0, r0
+ | jne ->exception_handler
+ | mov r0, EX:RX->func // reload
+ }
+ }
+
+ if (!func
+ && opline->opcode != ZEND_DO_UCALL
+ && opline->opcode != ZEND_DO_ICALL) {
+ | cmp byte [r0 + offsetof(zend_function, type)], ZEND_USER_FUNCTION
+ | jne >8
+ }
+
+ if ((!func || func->type == ZEND_USER_FUNCTION)
+ && opline->opcode != ZEND_DO_ICALL) {
+ | // EX(call) = NULL;
+ | mov aword EX:RX->call, 0
+
+ if (RETURN_VALUE_USED(opline)) {
+ | // EX(return_value) = EX_VAR(opline->result.var);
+ | LOAD_ZVAL_ADDR r2, res_addr
+ | mov aword EX:RX->return_value, r2
+ } else {
+ | // EX(return_value) = 0;
+ | mov aword EX:RX->return_value, 0
+ }
+
+ if (func) {
+ for (i = call_info->num_args; i < func->op_array.last_var; i++) {
+ uint32_t n = (uint32_t)(uintptr_t)ZEND_CALL_VAR_NUM(NULL, i);
+ | SET_Z_TYPE_INFO RX + n, IS_UNDEF
+ }
+ }
+
+ //EX_LOAD_RUN_TIME_CACHE(op_array);
+ if (!func || func->op_array.cache_size) {
+ if (func && op_array == &func->op_array) {
+ /* recursive call */
+ if (func->op_array.cache_size > sizeof(void*)) {
+ | mov r2, EX->run_time_cache
+ | mov EX:RX->run_time_cache, r2
+ }
+ } else {
+ if (func) {
+ | mov r0, EX:RX->func
+ }
+ | mov r2, aword [r0 + offsetof(zend_op_array, run_time_cache__ptr)]
+#if ZEND_MAP_PTR_KIND == ZEND_MAP_PTR_KIND_PTR
+ | mov r2, aword [r2]
+#elif ZEND_MAP_PTR_KIND == ZEND_MAP_PTR_KIND_PTR_OR_OFFSET
+ | test r2, 1
+ | jz >1
+ | MEM_OP2_2_ZTS add, r2, aword, compiler_globals, map_ptr_base, r1
+ |1:
+ | mov r2, aword [r2]
+#else
+# error "Unknown ZEND_MAP_PTR_KIND"
+#endif
+ | mov EX:RX->run_time_cache, r2
+ }
+ }
+
+ | // EG(current_execute_data) = execute_data;
+ | MEM_OP2_1_ZTS mov, aword, executor_globals, current_execute_data, RX, r1
+ | mov FP, RX
+
+ | // opline = op_array->opcodes;
+ if (func) {
+ uint32_t num_args;
+
+ if (func->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) {
+ num_args = skip_valid_arguments(op_array, ssa, call_info);
+ } else {
+ num_args = call_info->num_args;
+ }
+ if (func && zend_accel_in_shm(func->op_array.opcodes)) {
+ | LOAD_IP_ADDR (func->op_array.opcodes + num_args)
+ } else {
+ if (func) {
+ | mov r0, EX->func
+ }
+ if (GCC_GLOBAL_REGS) {
+ | mov IP, aword [r0 + offsetof(zend_op_array, opcodes)]
+ if (num_args) {
+ | add IP, (num_args * sizeof(zend_op))
+ }
+ } else {
+ | mov FCARG1a, aword [r0 + offsetof(zend_op_array, opcodes)]
+ if (num_args) {
+ | add FCARG1a, (num_args * sizeof(zend_op))
+ }
+ | mov aword EX->opline, FCARG1a
+ }
+ }
+
+ if (op_array == &func->op_array) {
+ /* recursive call */
+#ifdef CONTEXT_THREADED_JIT
+ | call >1
+ |.cold_code
+ |1:
+ | pop r0
+ | jmp =>num_args
+ |.code
+#else
+ | jmp =>num_args
+#endif
+ return 1;
+ }
+ } else {
+ | // opline = op_array->opcodes
+ if (GCC_GLOBAL_REGS) {
+ | mov IP, aword [r0 + offsetof(zend_op_array, opcodes)]
+ } else {
+ | mov FCARG1a, aword [r0 + offsetof(zend_op_array, opcodes)]
+ | mov aword EX->opline, FCARG1a
+ }
+ | // first_extra_arg = op_array->num_args;
+ | mov edx, dword [r0 + offsetof(zend_op_array, num_args)]
+ | // num_args = EX_NUM_ARGS();
+ | mov ecx, dword [FP + offsetof(zend_execute_data, This.u2.num_args)]
+ | // if (UNEXPECTED(num_args > first_extra_arg))
+ | cmp edx, ecx
+ | jl >1
+ |.cold_code
+ |1:
+ if (!GCC_GLOBAL_REGS) {
+ | mov FCARG1a, FP
+ }
+ | EXT_CALL zend_jit_copy_extra_args_helper, r0
+ | mov r0, EX->func // reload
+ | mov ecx, dword [FP + offsetof(zend_execute_data, This.u2.num_args)] // reload
+ | jmp >1
+ |.code
+ | // if (EXPECTED((op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS) == 0))
+ | test dword [r0 + offsetof(zend_op_array, fn_flags)], ZEND_ACC_HAS_TYPE_HINTS
+ | jnz >1
+ | // opline += num_args;
+ |.if X64
+ | movsxd r2, ecx
+ | imul r2, r2, sizeof(zend_op)
+ |.else
+ | imul r2, ecx, sizeof(zend_op)
+ |.endif
+ | ADD_IP r2
+ |1:
+ | // if (EXPECTED((int)num_args < op_array->last_var)) {
+ | mov edx, dword [r0 + offsetof(zend_op_array, last_var)]
+ | sub edx, ecx
+ | jle >3 //???
+ | // zval *var = EX_VAR_NUM(num_args);
+ |.if X64
+ | movsxd r1, ecx
+ |.endif
+ | shl r1, 4
+ | lea r1, [FP + r1 + (ZEND_CALL_FRAME_SLOT * sizeof(zval))]
+ |2:
+ | SET_Z_TYPE_INFO r1, IS_UNDEF
+ | sub edx, 1
+ | lea r1, [r1 + 16]
+ | jne <2
+ |3:
+ }
+
+#ifdef CONTEXT_THREADED_JIT
+ | call ->context_threaded_call
+ if (!func && (opline->opcode != ZEND_DO_UCALL)) {
+ | jmp >9
+ }
+#else
+ if (zend_jit_vm_kind == ZEND_VM_KIND_HYBRID) {
+ | add r4, HYBRID_SPAD
+ | JMP_IP
+ } else if (GCC_GLOBAL_REGS) {
+ | add r4, SPAD // stack alignment
+ | JMP_IP
+ } else {
+ | mov FP, aword T2 // restore FP
+ | mov RX, aword T3 // restore IP
+ | add r4, NR_SPAD // stack alignment
+ | mov r0, 1 // ZEND_VM_ENTER
+ | ret
+ }
+#endif
+ }
+
+ if ((!func || func->type == ZEND_INTERNAL_FUNCTION)
+ && (opline->opcode != ZEND_DO_UCALL)) {
+ if (!func && (opline->opcode != ZEND_DO_ICALL)) {
+ |8:
+ }
+ if (opline->opcode == ZEND_DO_FCALL_BY_NAME) {
+ if (!func) {
+ | test dword [r0 + offsetof(zend_op_array, fn_flags)], ZEND_ACC_DEPRECATED
+ | jnz >1
+ |.cold_code
+ |1:
+ if (!GCC_GLOBAL_REGS) {
+ | mov FCARG1a, RX
+ }
+ | EXT_CALL zend_jit_deprecated_helper, r0
+ | MEM_OP2_1_ZTS cmp, aword, executor_globals, exception, 0, r0
+ | jne ->exception_handler
+ | mov r0, EX:RX->func // reload
+ | jmp >1
+ |.code
+ |1:
+ } else if (func->common.fn_flags & ZEND_ACC_DEPRECATED) {
+ if (!GCC_GLOBAL_REGS) {
+ | mov FCARG1a, RX
+ }
+ | EXT_CALL zend_jit_deprecated_helper, r0
+ | MEM_OP2_1_ZTS cmp, aword, executor_globals, exception, 0, r0
+ | jne ->exception_handler
+ | mov r0, EX:RX->func // reload
+ }
+ }
+
+ if (!RETURN_VALUE_USED(opline)) {
+ |.if not(X64WIN)
+ | sub r4, 16 /* alloca() */
+ |.endif
+ }
+
+ | // ZVAL_NULL(EX_VAR(opline->result.var));
+ | LOAD_ZVAL_ADDR FCARG2a, res_addr
+ | SET_Z_TYPE_INFO FCARG2a, IS_NULL
+
+ | // EG(current_execute_data) = execute_data;
+ | MEM_OP2_1_ZTS mov, aword, executor_globals, current_execute_data, RX, r1
+
+ zend_jit_reset_opline(Dst, NULL);
+
+ | // fbc->internal_function.handler(call, ret);
+ | mov FCARG1a, RX
+ if (func) {
+ | EXT_CALL func->internal_function.handler, r0
+ } else {
+ | call aword [r0 + offsetof(zend_internal_function, handler)]
+ }
+
+ | // EG(current_execute_data) = execute_data;
+ | MEM_OP2_1_ZTS mov, aword, executor_globals, current_execute_data, FP, r0
+
+ | // zend_vm_stack_free_args(call);
+ if (func) {
+ for (i = 0; i < call_info->num_args; i++ ) {
+ uint32_t offset = (uint32_t)(uintptr_t)ZEND_CALL_VAR_NUM(NULL, i);
+ | ZVAL_PTR_DTOR ZEND_ADDR_MEM_ZVAL(ZREG_RX, offset), MAY_BE_ANY|MAY_BE_RC1|MAY_BE_RCN, 0, 1, 0, opline
+ }
+ } else {
+ | mov FCARG1a, RX
+ | EXT_CALL zend_jit_vm_stack_free_args_helper, r0
+ }
+
+ |8:
+ if (opline->opcode == ZEND_DO_FCALL) {
+ // TODO: optimize ???
+ | // if (UNEXPECTED(ZEND_CALL_INFO(call) & ZEND_CALL_RELEASE_THIS))
+ | test byte [RX + offsetof(zend_execute_data, This.u1.type_info) + 2], (ZEND_CALL_RELEASE_THIS >> 16)
+ | jnz >1
+ |.cold_code
+ |1:
+ | GET_Z_PTR r0, RX + offsetof(zend_execute_data, This)
+ | // OBJ_RELEASE(object);
+ | OBJ_RELEASE r0, ecx, >2
+ | jmp >2
+ |.code
+ |2:
+ }
+
+ | // zend_vm_stack_free_call_frame(call);
+ | test byte [RX + offsetof(zend_execute_data, This.u1.type_info) + 2], (ZEND_CALL_ALLOCATED >> 16)
+ | jnz >1
+ |.cold_code
+ |1:
+ | mov FCARG1a, RX
+ | EXT_CALL zend_jit_free_call_frame, r0
+ | jmp >1
+ |.code
+ | MEM_OP2_1_ZTS mov, aword, executor_globals, vm_stack_top, RX, r0
+ |1:
+
+ if (!RETURN_VALUE_USED(opline)) {
+ uint32_t func_info = call_info ?
+ zend_get_func_info(call_info, ssa) :
+ (MAY_BE_ANY|MAY_BE_REF|MAY_BE_RC1|MAY_BE_RCN);
+
+ if (func_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF)) {
+ | ZVAL_PTR_DTOR res_addr, func_info, 1, 1, 0, opline
+ }
+ |.if not(X64WIN)
+ | add r4, 16 /* revert alloca() */
+ |.endif
+ }
+
+ | // if (UNEXPECTED(EG(exception) != NULL)) {
+ | MEM_OP2_1_ZTS cmp, aword, executor_globals, exception, 0, r0
+ | jne >1
+ |.cold_code
+ |1:
+ | LOAD_IP_ADDR opline
+ | jmp ->icall_throw_handler
+ |.code
+
+ // TODO: Can we avoid checking for interrupts after each call ???
+ if (!zend_jit_check_timeout(Dst, opline + 1)) {
+ return 0;
+ }
+ if (opline->opcode != ZEND_DO_ICALL) {
+ | LOAD_IP_ADDR (opline + 1)
+ }
+ }
+
+ if (!func) {
+ |9:
+ }
+
+ return 1;
+
+fallback:
+ /* fallback to subroutine threading */
+ if (opline->opcode == ZEND_DO_FCALL ||
+ opline->opcode == ZEND_DO_UCALL ||
+ opline->opcode == ZEND_DO_FCALL_BY_NAME ){
+ return zend_jit_call(Dst, opline, next_block);
+ } else {
+ return zend_jit_handler(Dst, opline, zend_may_throw(opline, op_array, ssa));
+ }
+}
+
+static int zend_jit_send_val(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, uint32_t op1_info, zend_jit_addr op1_addr)
+{
+ uint32_t arg_num = opline->op2.num;
+ zend_jit_addr arg_addr;
+
+ ZEND_ASSERT(opline->opcode == ZEND_SEND_VAL || arg_num <= MAX_ARG_FLAG_NUM);
+
+ if (!reuse_ip) {
+ zend_jit_start_reuse_ip();
+ | // call = EX(call);
+ | mov RX, EX->call
+ }
+
+ if (opline->opcode == ZEND_SEND_VAL_EX) {
+ uint32_t mask = ZEND_SEND_BY_REF << ((arg_num + 3) * 2);
+
+ | mov r0, EX:RX->func
+ if (arg_num <= MAX_ARG_FLAG_NUM) {
+ | test dword [r0 + offsetof(zend_function, quick_arg_flags)], mask
+ | jnz >1
+ } else {
+ ZEND_ASSERT(0);
+ }
+ |.cold_code
+ |1:
+ | SAVE_VALID_OPLINE opline
+ | jmp ->throw_cannot_pass_by_ref
+ |.code
+ }
+
+ arg_addr = ZEND_ADDR_MEM_ZVAL(ZREG_RX, opline->result.var);
+
+ if (opline->op1_type == IS_CONST) {
+ zval *zv = RT_CONSTANT(opline, opline->op1);
+
+ | ZVAL_COPY_CONST arg_addr, -1, -1, zv, r0
+ if (Z_REFCOUNTED_P(zv)) {
+ | ADDREF_CONST zv, r0
+ }
+ } else {
+ | ZVAL_COPY_VALUE arg_addr, -1, op1_addr, op1_info, ZREG_R0, ZREG_R2
+ }
+
+ return 1;
+}
+
+static int zend_jit_send_ref(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, uint32_t op1_info, int cold)
+{
+ zend_jit_addr op1_addr, arg_addr, ref_addr;
+
+ op1_addr = OP1_ADDR();
+ arg_addr = ZEND_ADDR_MEM_ZVAL(ZREG_RX, opline->result.var);
+
+ if (!reuse_ip) {
+ zend_jit_start_reuse_ip();
+ | // call = EX(call);
+ | mov RX, EX->call
+ }
+
+ if (opline->op1_type == IS_VAR) {
+ | LOAD_ZVAL_ADDR r0, op1_addr
+ | // if (EXPECTED(Z_TYPE_P(ret) == IS_INDIRECT)) {
+ | IF_NOT_Z_TYPE r0, IS_INDIRECT, >1
+ | // ret = Z_INDIRECT_P(ret);
+ | GET_Z_PTR r0, r0
+ |1:
+ } else if (opline->op1_type == IS_CV) {
+ if (op1_info & MAY_BE_UNDEF) {
+ if (op1_info & (MAY_BE_ANY|MAY_BE_REF)) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_UNDEF, >1
+ | SET_ZVAL_TYPE_INFO op1_addr, IS_NULL
+ | jmp >2
+ |1:
+ }
+ op1_info &= ~MAY_BE_UNDEF;
+ op1_info |= MAY_BE_NULL;
+ }
+ } else {
+ ZEND_ASSERT(0);
+ }
+
+ if (op1_info & (MAY_BE_UNDEF|MAY_BE_ANY|MAY_BE_REF)) {
+ if (op1_info & MAY_BE_REF) {
+ if (opline->op1_type == IS_VAR) {
+ | IF_NOT_Z_TYPE r0, IS_REFERENCE, >2
+ | GET_Z_PTR r1, r0
+ } else {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_REFERENCE, >2
+ | GET_ZVAL_PTR r1, op1_addr
+ }
+ | GC_ADDREF r1
+ | SET_ZVAL_PTR arg_addr, r1
+ | SET_ZVAL_TYPE_INFO arg_addr, IS_REFERENCE_EX
+ | jmp >6
+ }
+ |2:
+ | // ZVAL_NEW_REF(arg, varptr);
+ if (opline->op1_type == IS_VAR) {
+ | mov aword T1, r0 // save
+ }
+ | EMALLOC sizeof(zend_reference), op_array, opline
+ | mov dword [r0], 2
+ | mov dword [r0 + offsetof(zend_reference, gc.u.type_info)], IS_REFERENCE
+ | mov aword [r0 + offsetof(zend_reference, sources.ptr)], 0
+ ref_addr = ZEND_ADDR_MEM_ZVAL(ZREG_R0, 8);
+ if (opline->op1_type == IS_VAR) {
+ zend_jit_addr val_addr = ZEND_ADDR_MEM_ZVAL(ZREG_R1, 0);
+
+ | mov r1, aword T1 // restore
+ | ZVAL_COPY_VALUE ref_addr, -1, val_addr, op1_info, ZREG_R2, ZREG_R2
+ | SET_ZVAL_PTR val_addr, r0
+ | SET_ZVAL_TYPE_INFO val_addr, IS_REFERENCE_EX
+ } else {
+ | ZVAL_COPY_VALUE ref_addr, -1, op1_addr, op1_info, ZREG_R1, ZREG_R2
+ | SET_ZVAL_PTR op1_addr, r0
+ | SET_ZVAL_TYPE_INFO op1_addr, IS_REFERENCE_EX
+ }
+ | SET_ZVAL_PTR arg_addr, r0
+ | SET_ZVAL_TYPE_INFO arg_addr, IS_REFERENCE_EX
+ }
+
+ |6:
+ | FREE_OP opline->op1_type, opline->op1, op1_info, !cold, op_array, opline
+ |7:
+
+ return 1;
+}
+
+static int zend_jit_send_var(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, uint32_t op1_info, zend_jit_addr op1_addr, zend_jit_addr op1_def_addr)
+{
+ uint32_t arg_num = opline->op2.num;
+ zend_jit_addr arg_addr;
+
+ ZEND_ASSERT((opline->opcode != ZEND_SEND_VAR_EX &&
+ opline->opcode != ZEND_SEND_VAR_NO_REF_EX) ||
+ arg_num <= MAX_ARG_FLAG_NUM);
+
+ arg_addr = ZEND_ADDR_MEM_ZVAL(ZREG_RX, opline->result.var);
+
+ if (!reuse_ip) {
+ zend_jit_start_reuse_ip();
+ | // call = EX(call);
+ | mov RX, EX->call
+ }
+
+ if (opline->opcode == ZEND_SEND_VAR_EX || opline->opcode == ZEND_SEND_VAR_NO_REF_EX) {
+ uint32_t mask = (ZEND_SEND_BY_REF|ZEND_SEND_PREFER_REF) << ((arg_num + 3) * 2);
+
+ | mov r0, EX:RX->func
+ if (arg_num <= MAX_ARG_FLAG_NUM) {
+ | test dword [r0 + offsetof(zend_function, quick_arg_flags)], mask
+ | jnz >1
+ } else {
+ ZEND_ASSERT(0);
+ }
+
+ |.cold_code
+ |1:
+
+ if (opline->opcode == ZEND_SEND_VAR_EX) {
+ if (!zend_jit_send_ref(Dst, opline, op_array, op1_info, 1)) {
+ return 0;
+ }
+ } else if (opline->opcode == ZEND_SEND_VAR_NO_REF_EX) {
+ mask = ZEND_SEND_PREFER_REF << ((arg_num + 3) * 2);
+
+ | ZVAL_COPY_VALUE arg_addr, -1, op1_addr, op1_info, ZREG_R1, ZREG_R2
+ if (op1_info & MAY_BE_REF) {
+ | cmp cl, IS_REFERENCE
+ | je >7
+ }
+ | test dword [r0 + offsetof(zend_function, quick_arg_flags)], mask
+ | jnz >7
+ | SAVE_VALID_OPLINE opline
+ | LOAD_ZVAL_ADDR FCARG1a, arg_addr
+ | EXT_CALL zend_jit_only_vars_by_reference, r0
+ if (!zend_jit_check_exception(Dst)) {
+ return 0;
+ }
+ } else {
+ ZEND_ASSERT(0);
+ }
+
+ | jmp >7
+ |.code
+ }
+
+ if (op1_info & MAY_BE_UNDEF) {
+ if (op1_info & (MAY_BE_ANY|MAY_BE_REF)) {
+ | IF_ZVAL_TYPE op1_addr, IS_UNDEF, >1
+ |.cold_code
+ |1:
+ }
+
+ | SAVE_VALID_OPLINE opline
+ | mov FCARG1d, opline->op1.var
+ | EXT_CALL zend_jit_undefined_op_helper, r0
+ | SET_ZVAL_TYPE_INFO arg_addr, IS_NULL
+
+ if (op1_info & (MAY_BE_ANY|MAY_BE_REF)) {
+ | jmp >7
+ |.code
+ }
+ }
+
+ if (opline->opcode == ZEND_SEND_VAR_NO_REF) {
+ | ZVAL_COPY_VALUE arg_addr, -1, op1_addr, op1_info, ZREG_R1, ZREG_R2
+ if (op1_info & MAY_BE_REF) {
+ | cmp cl, IS_REFERENCE
+ | je >7
+ }
+ | SAVE_VALID_OPLINE opline
+ | LOAD_ZVAL_ADDR FCARG1a, arg_addr
+ | EXT_CALL zend_jit_only_vars_by_reference, r0
+ if (!zend_jit_check_exception(Dst)) {
+ return 0;
+ }
+ } else if (op1_info & (MAY_BE_ANY|MAY_BE_REF)) {
+ if (op1_info & MAY_BE_REF) {
+ if (opline->op1_type == IS_CV) {
+ zend_jit_addr val_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 0);
+
+ | LOAD_ZVAL_ADDR FCARG1a, op1_addr
+ | ZVAL_DEREF FCARG1a, op1_info
+ | ZVAL_COPY_VALUE arg_addr, -1, val_addr, op1_info, ZREG_R0, ZREG_R2
+ | TRY_ADDREF op1_info, ah, r2
+ } else {
+ zend_jit_addr ref_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 8);
+
+ | IF_ZVAL_TYPE op1_addr, IS_REFERENCE, >1
+ |.cold_code
+ |1:
+ | // zend_refcounted *ref = Z_COUNTED_P(retval_ptr);
+ | GET_ZVAL_PTR FCARG1a, op1_addr
+ | // ZVAL_COPY_VALUE(return_value, &ref->value);
+ | ZVAL_COPY_VALUE arg_addr, -1, ref_addr, op1_info, ZREG_R0, ZREG_R2
+ | GC_DELREF FCARG1a
+ | je >1
+ | IF_NOT_REFCOUNTED ah, >2
+ | GC_ADDREF r2
+ | jmp >2
+ |1:
+ | EFREE_REG_24 op_array, opline
+ | jmp >2
+ |.code
+ | ZVAL_COPY_VALUE arg_addr, -1, op1_addr, op1_info, ZREG_R0, ZREG_R2
+ |2:
+ }
+ } else {
+ if (op1_addr != op1_def_addr) {
+ if (!zend_jit_update_regs(Dst, op1_addr, op1_def_addr, op1_info)) {
+ return 0;
+ }
+ if (Z_MODE(op1_def_addr) == IS_REG && Z_MODE(op1_addr) != IS_REG) {
+ op1_addr= op1_def_addr;
+ }
+ }
+ | ZVAL_COPY_VALUE arg_addr, -1, op1_addr, op1_info, ZREG_R0, ZREG_R2
+ if (opline->op1_type == IS_CV) {
+ | TRY_ADDREF op1_info, ah, r2
+ }
+ }
+ }
+ |7:
+
+ return 1;
+}
+
+static int zend_jit_smart_true(dasm_State **Dst, const zend_op *opline, int jmp, zend_uchar smart_branch_opcode, uint32_t target_label, uint32_t target_label2)
+{
+ if (smart_branch_opcode) {
+ if (smart_branch_opcode == ZEND_JMPZ) {
+ if (jmp) {
+ | jmp >7
+ }
+ } else if (smart_branch_opcode == ZEND_JMPNZ) {
+ | jmp =>target_label
+ } else if (smart_branch_opcode == ZEND_JMPZNZ) {
+ | jmp =>target_label2
+ } else {
+ ZEND_ASSERT(0);
+ }
+ } else {
+ zend_jit_addr res_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->result.var);
+
+ | SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
+ if (jmp) {
+ | jmp >7
+ }
+ }
+
+ return 1;
+}
+
+static int zend_jit_smart_false(dasm_State **Dst, const zend_op *opline, int jmp, zend_uchar smart_branch_opcode, uint32_t target_label)
+{
+ if (smart_branch_opcode) {
+ if (smart_branch_opcode == ZEND_JMPZ) {
+ | jmp =>target_label
+ } else if (smart_branch_opcode == ZEND_JMPNZ) {
+ if (jmp) {
+ | jmp >7
+ }
+ } else if (smart_branch_opcode == ZEND_JMPZNZ) {
+ | jmp =>target_label
+ } else {
+ ZEND_ASSERT(0);
+ }
+ } else {
+ zend_jit_addr res_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->result.var);
+
+ | SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
+ if (jmp) {
+ | jmp >7
+ }
+ }
+
+ return 1;
+}
+
+static int zend_jit_defined(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, zend_uchar smart_branch_opcode, uint32_t target_label, uint32_t target_label2)
+{
+ uint32_t defined_label = (uint32_t)-1;
+ uint32_t undefined_label = (uint32_t)-1;
+ zval *zv = RT_CONSTANT(opline, opline->op1);
+ zend_jit_addr res_addr;
+
+ if (smart_branch_opcode) {
+ if (smart_branch_opcode == ZEND_JMPZ) {
+ undefined_label = target_label;
+ } else if (smart_branch_opcode == ZEND_JMPNZ) {
+ defined_label = target_label;
+ } else if (smart_branch_opcode == ZEND_JMPZNZ) {
+ undefined_label = target_label;
+ defined_label = target_label2;
+ } else {
+ ZEND_ASSERT(0);
+ }
+ }
+
+ | // if (CACHED_PTR(opline->extended_value)) {
+ | mov r0, EX->run_time_cache
+ | mov r0, aword [r0 + opline->extended_value]
+ | test r0, r0
+ | jz >1
+ | test r0, 0x1
+ | jnz >4
+ |.cold_code
+ |4:
+ | MEM_OP2_2_ZTS mov, FCARG1a, aword, executor_globals, zend_constants, FCARG1a
+ | shr r0, 1
+ | cmp dword [FCARG1a + offsetof(HashTable, nNumOfElements)], eax
+ if (smart_branch_opcode) {
+ if (undefined_label != (uint32_t)-1) {
+ | jz =>undefined_label
+ } else {
+ | jz >3
+ }
+ } else {
+ | jz >2
+ }
+ |1:
+ | SAVE_VALID_OPLINE opline
+ | LOAD_ADDR FCARG1a, zv
+ | EXT_CALL zend_jit_check_constant, r0
+ | test r0, r0
+ if (smart_branch_opcode) {
+ if (undefined_label != (uint32_t)-1) {
+ | jnz =>undefined_label
+ } else {
+ | jnz >3
+ }
+ if (defined_label != (uint32_t)-1) {
+ | jmp =>defined_label
+ } else {
+ | jmp >3
+ }
+ } else {
+ res_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->result.var);
+ | jz >1
+ |2:
+ | SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
+ | jmp >3
+ }
+ |.code
+ if (smart_branch_opcode) {
+ if (defined_label != (uint32_t)-1) {
+ | jmp =>defined_label
+ }
+ } else {
+ |1:
+ | SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
+ }
+ |3:
+
+ return 1;
+}
+
+static int zend_jit_type_check(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, uint32_t op1_info, zend_uchar smart_branch_opcode, uint32_t target_label, uint32_t target_label2)
+{
+ uint32_t mask;
+ zend_uchar type;
+ zend_jit_addr op1_addr = OP1_ADDR();
+
+ // TODO: support for is_resource() ???
+ ZEND_ASSERT(opline->extended_value != MAY_BE_RESOURCE);
+
+ if (op1_info & MAY_BE_UNDEF) {
+ if (op1_info & (MAY_BE_ANY|MAY_BE_REF)) {
+ | IF_ZVAL_TYPE op1_addr, IS_UNDEF, >1
+ |.cold_code
+ |1:
+ }
+ | SAVE_VALID_OPLINE opline
+ | mov FCARG1d, opline->op1.var
+ | EXT_CALL zend_jit_undefined_op_helper, r0
+ zend_jit_check_exception_undef_result(Dst, opline);
+ if (opline->extended_value & MAY_BE_NULL) {
+ if (!zend_jit_smart_true(Dst, opline, (op1_info & (MAY_BE_ANY|MAY_BE_REF)) != 0, smart_branch_opcode, target_label, target_label2)) {
+ return 0;
+ }
+ } else {
+ if (!zend_jit_smart_false(Dst, opline, (op1_info & (MAY_BE_ANY|MAY_BE_REF)) != 0, smart_branch_opcode, target_label)) {
+ return 0;
+ }
+ }
+ if (op1_info & (MAY_BE_ANY|MAY_BE_REF)) {
+ |.code
+ }
+ }
+
+ if (op1_info & (MAY_BE_ANY|MAY_BE_REF)) {
+ mask = opline->extended_value;
+ switch (mask) {
+ case MAY_BE_NULL: type = IS_NULL; break;
+ case MAY_BE_FALSE: type = IS_FALSE; break;
+ case MAY_BE_TRUE: type = IS_TRUE; break;
+ case MAY_BE_LONG: type = IS_LONG; break;
+ case MAY_BE_DOUBLE: type = IS_DOUBLE; break;
+ case MAY_BE_STRING: type = IS_STRING; break;
+ case MAY_BE_ARRAY: type = IS_ARRAY; break;
+ case MAY_BE_OBJECT: type = IS_OBJECT; break;
+ default:
+ type = 0;
+ }
+
+ if (!(op1_info & (MAY_BE_ANY - mask))) {
+ | FREE_OP opline->op1_type, opline->op1, op1_info, 1, op_array, opline
+ if (!zend_jit_smart_true(Dst, opline, 0, smart_branch_opcode, target_label, target_label2)) {
+ return 0;
+ }
+ } else if (!(op1_info & mask)) {
+ | FREE_OP opline->op1_type, opline->op1, op1_info, 1, op_array, opline
+ if (!zend_jit_smart_false(Dst, opline, 0, smart_branch_opcode, target_label)) {
+ return 0;
+ }
+ } else {
+ if (op1_info & MAY_BE_REF) {
+ | LOAD_ZVAL_ADDR r0, op1_addr
+ | ZVAL_DEREF r0, op1_info
+ }
+ if (type == 0) {
+ if (smart_branch_opcode &&
+ (opline->op1_type & (IS_VAR|IS_TMP_VAR)) &&
+ (op1_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
+ if ((op1_info) & (MAY_BE_ANY-(MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
+ | // if (Z_REFCOUNTED_P(cv)) {
+ | IF_ZVAL_REFCOUNTED op1_addr, >1
+ |.cold_code
+ |1:
+ }
+ | // if (!Z_DELREF_P(cv)) {
+ | GET_ZVAL_PTR FCARG1a, op1_addr
+ | GC_DELREF FCARG1a
+ if (RC_MAY_BE_1(op1_info)) {
+ if (RC_MAY_BE_N(op1_info)) {
+ | jnz >3
+ }
+ if (op1_info & MAY_BE_REF) {
+ | mov al, byte [r0 + 8]
+ } else {
+ | mov al, byte [FP + opline->op1.var + 8]
+ }
+ | mov byte T1, al // save
+ | // zval_dtor_func(r);
+ | ZVAL_DTOR_FUNC op1_info, opline
+ | mov cl, byte T1 // restore
+ |jmp >2
+ }
+ if ((op1_info) & (MAY_BE_ANY-(MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
+ if (!RC_MAY_BE_1(op1_info)) {
+ | jmp >3
+ }
+ |.code
+ }
+ |3:
+ if (op1_info & MAY_BE_REF) {
+ | mov cl, byte [r0 + 8]
+ } else {
+ | mov cl, byte [FP + opline->op1.var + 8]
+ }
+ |2:
+ } else {
+ if (op1_info & MAY_BE_REF) {
+ | mov cl, byte [r0 + 8]
+ } else {
+ | mov cl, byte [FP + opline->op1.var + 8]
+ }
+ }
+ | mov eax, 1
+ | shl eax, cl
+ | test eax, mask
+ if (smart_branch_opcode) {
+ if (smart_branch_opcode == ZEND_JMPZ) {
+ | je =>target_label
+ } else if (smart_branch_opcode == ZEND_JMPNZ) {
+ | jne =>target_label
+ } else if (smart_branch_opcode == ZEND_JMPZNZ) {
+ | je =>target_label
+ | jmp =>target_label2
+ } else {
+ ZEND_ASSERT(0);
+ }
+ } else {
+ zend_jit_addr res_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->result.var);
+
+ | setne al
+ | movzx eax, al
+ | add eax, 2
+ | SET_ZVAL_TYPE_INFO res_addr, eax
+ | FREE_OP opline->op1_type, opline->op1, op1_info, 1, op_array, opline
+ }
+ } else {
+ if (smart_branch_opcode &&
+ (opline->op1_type & (IS_VAR|IS_TMP_VAR)) &&
+ (op1_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
+ if ((op1_info) & (MAY_BE_ANY-(MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
+ | // if (Z_REFCOUNTED_P(cv)) {
+ | IF_ZVAL_REFCOUNTED op1_addr, >1
+ |.cold_code
+ |1:
+ }
+ | // if (!Z_DELREF_P(cv)) {
+ | GET_ZVAL_PTR FCARG1a, op1_addr
+ | GC_DELREF FCARG1a
+ if (RC_MAY_BE_1(op1_info)) {
+ if (RC_MAY_BE_N(op1_info)) {
+ | jnz >3
+ }
+ if (op1_info & MAY_BE_REF) {
+ | mov al, byte [r0 + 8]
+ } else {
+ | mov al, byte [FP + opline->op1.var + 8]
+ }
+ | mov byte T1, al // save
+ | // zval_dtor_func(r);
+ | ZVAL_DTOR_FUNC op1_info, opline
+ | mov cl, byte T1 // restore
+ |jmp >2
+ }
+ if ((op1_info) & (MAY_BE_ANY-(MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
+ if (!RC_MAY_BE_1(op1_info)) {
+ | jmp >3
+ }
+ |.code
+ }
+ |3:
+ if (op1_info & MAY_BE_REF) {
+ | mov cl, byte [r0 + 8]
+ } else {
+ | mov cl, byte [FP + opline->op1.var + 8]
+ }
+ |2:
+ | cmp cl, type
+ } else {
+ if (op1_info & MAY_BE_REF) {
+ | cmp byte [r0 + 8], type
+ } else {
+ | cmp byte [FP + opline->op1.var + 8], type
+ }
+ }
+ if (smart_branch_opcode) {
+ if (smart_branch_opcode == ZEND_JMPZ) {
+ | jne =>target_label
+ } else if (smart_branch_opcode == ZEND_JMPNZ) {
+ | je =>target_label
+ } else if (smart_branch_opcode == ZEND_JMPZNZ) {
+ | jne =>target_label
+ | jmp =>target_label2
+ } else {
+ ZEND_ASSERT(0);
+ }
+ } else {
+ zend_jit_addr res_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->result.var);
+
+ | sete al
+ | movzx eax, al
+ | add eax, 2
+ | SET_ZVAL_TYPE_INFO res_addr, eax
+ | FREE_OP opline->op1_type, opline->op1, op1_info, 1, op_array, opline
+ }
+ }
+ }
+ }
+
+ |7:
+
+ return 1;
+}
+
+static int zend_jit_free_compiled_variables(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, zend_ssa *ssa)
+{
+ uint32_t i, j, info;
+
+ // Use type inference to avoid useless zval_ptr_dtor()
+ for (i = 0 ; i < op_array->last_var; i++) {
+ if (ssa->vars && ssa->var_info) {
+ info = ssa->var_info[i].type;
+ for (j = op_array->last_var; j < ssa->vars_count; j++) {
+ if (ssa->vars[j].var == i) {
+ info |= ssa->var_info[j].type;
+ }
+ }
+ } else {
+ info = MAY_BE_RC1 | MAY_BE_RCN | MAY_BE_REF | MAY_BE_ANY | MAY_BE_UNDEF;
+ }
+
+#ifdef ZEND_JIT_USE_RC_INFERENCE
+ /* Refcount may be increased by RETURN opcode */
+ if ((info & MAY_BE_RC1) && !(info & MAY_BE_RCN)) {
+ for (j = 0; j < ssa->cfg.blocks_count; j++) {
+ if ((ssa->cfg.blocks[j].flags & ZEND_BB_REACHABLE) &&
+ ssa->cfg.blocks[j].len > 0) {
+ const zend_op *opline = op_array->opcodes + ssa->cfg.blocks[j].start + ssa->cfg.blocks[j].len - 1;
+
+ if (opline->opcode == ZEND_RETURN) {
+ if (opline->op1_type == IS_CV &&
+ opline->op1.var == (uint32_t)(uintptr_t)(ZEND_CALL_VAR_NUM(NULL, i))) {
+ info |= MAY_BE_RCN;
+ break;
+ }
+ }
+ }
+ }
+ }
+#endif
+
+ if (info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF)) {
+ uint32_t offset = (uint32_t)(uintptr_t)ZEND_CALL_VAR_NUM(NULL, i);
+ | ZVAL_PTR_DTOR ZEND_ADDR_MEM_ZVAL(ZREG_FP, offset), info, 1, 1, 0, opline
+ }
+ }
+ return 1;
+}
+
+static int zend_jit_leave_func(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, zend_ssa *ssa)
+{
+ // Avoid multiple leave sequences
+ if (jit_return_label >= 0) {
+ | jmp =>jit_return_label
+ return 1;
+ }
+
+ jit_return_label = ssa->cfg.blocks_count * 2;
+
+ |=>jit_return_label:
+
+ | // EG(current_execute_data) = EX(prev_execute_data);
+ | mov r0, EX->prev_execute_data
+ | MEM_OP2_1_ZTS mov, aword, executor_globals, current_execute_data, r0, r2
+
+ // i_free_compiled_variables(execute_data);
+ if (!zend_jit_free_compiled_variables(Dst, opline, op_array, ssa)) {
+ return 0;
+ }
+
+ /* ZEND_CALL_FAKE_CLOSURE handled on slow path to eliminate check for ZEND_CALL_CLOSURE on fast path */
+ | mov FCARG1d, dword [FP + offsetof(zend_execute_data, This.u1.type_info)]
+ | test FCARG1d, (ZEND_CALL_TOP|ZEND_CALL_HAS_SYMBOL_TABLE|ZEND_CALL_FREE_EXTRA_ARGS|ZEND_CALL_ALLOCATED|ZEND_CALL_FAKE_CLOSURE)
+ | jnz ->leave_function_handler
+
+ if ((op_array->scope && !(op_array->fn_flags & ZEND_ACC_STATIC)) ||
+ (op_array->fn_flags & ZEND_ACC_CLOSURE)) {
+ if (op_array->fn_flags & ZEND_ACC_CLOSURE) {
+ | // OBJ_RELEASE(ZEND_CLOSURE_OBJECT(EX(func)));
+ | mov r0, EX->func
+ | sub r0, sizeof(zend_object)
+ | OBJ_RELEASE r0, ecx, >4
+ } else if (op_array->scope && !(op_array->fn_flags & ZEND_ACC_STATIC)) {
+ | // if (call_info & ZEND_CALL_RELEASE_THIS)
+ | test FCARG1d, ZEND_CALL_RELEASE_THIS
+ | je >4
+ | // zend_object *object = Z_OBJ(execute_data->This);
+ | mov r0, EX->This.value.obj
+ | // OBJ_RELEASE(object);
+ | OBJ_RELEASE r0, ecx, >4
+ }
+ |4:
+ }
+ | // EG(vm_stack_top) = (zval*)execute_data;
+ | MEM_OP2_1_ZTS mov, aword, executor_globals, vm_stack_top, FP, r0
+ | // execute_data = EX(prev_execute_data);
+ | mov FP, EX->prev_execute_data
+ | // if (EG(exception))
+ | MEM_OP2_1_ZTS cmp, aword, executor_globals, exception, 0, r0
+ | LOAD_OPLINE
+ | jne ->leave_throw_handler
+ | // opline = EX(opline) + 1
+ | ADD_IP sizeof(zend_op)
+ if (zend_jit_vm_kind == ZEND_VM_KIND_HYBRID) {
+ | add r4, HYBRID_SPAD
+#ifdef CONTEXT_THREADED_JIT
+ | push aword [IP]
+ | ret
+#else
+ | JMP_IP
+#endif
+ } else if (GCC_GLOBAL_REGS) {
+ | add r4, SPAD // stack alignment
+#ifdef CONTEXT_THREADED_JIT
+ | push aword [IP]
+ | ret
+#else
+ | JMP_IP
+#endif
+ } else {
+#ifdef CONTEXT_THREADED_JIT
+ ZEND_ASSERT(0);
+ // TODO: context threading can't work without GLOBAL REGS because we have to change
+ // the value of execute_data in execute_ex()
+ | mov FCARG1a, FP
+ | mov r0, aword [FP]
+ | mov FP, aword T2 // restore FP
+ | mov RX, aword T3 // restore IP
+ | add r4, NR_SPAD // stack alignment
+ | push aword [r0]
+ | ret
+#else
+ | mov FP, aword T2 // restore FP
+ | mov RX, aword T3 // restore IP
+ | add r4, NR_SPAD // stack alignment
+ | mov r0, 2 // ZEND_VM_LEAVE
+ | ret
+#endif
+ }
+
+ return 1;
+}
+
+static int zend_jit_return(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, zend_ssa *ssa, uint32_t op1_info, zend_jit_addr op1_addr)
+{
+ zend_jit_addr ret_addr;
+
+ ZEND_ASSERT(op_array->type != ZEND_EVAL_CODE && op_array->function_name);
+ ZEND_ASSERT(!(op1_info & MAY_BE_UNDEF));
+
+ // if (!EX(return_value))
+ if (Z_MODE(op1_addr) == IS_REG && Z_REG(op1_addr) == ZREG_R1) {
+ | mov r2, EX->return_value
+ | test r2, r2
+ ret_addr = ZEND_ADDR_MEM_ZVAL(ZREG_R2, 0);
+ } else {
+ | mov r1, EX->return_value
+ | test r1, r1
+ ret_addr = ZEND_ADDR_MEM_ZVAL(ZREG_R1, 0);
+ }
+ if ((opline->op1_type & (IS_VAR|IS_TMP_VAR)) &&
+ (op1_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
+ | jz >1
+ |.cold_code
+ |1:
+ if (op1_info & ((MAY_BE_UNDEF|MAY_BE_ANY|MAY_BE_REF)-(MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
+ if (jit_return_label >= 0) {
+ | IF_NOT_ZVAL_REFCOUNTED op1_addr, =>jit_return_label
+ } else {
+ | IF_NOT_ZVAL_REFCOUNTED op1_addr, >9
+ }
+ }
+ | GET_ZVAL_PTR FCARG1a, op1_addr
+ | GC_DELREF FCARG1a
+ if (RC_MAY_BE_1(op1_info)) {
+ if (RC_MAY_BE_N(op1_info)) {
+ if (jit_return_label >= 0) {
+ | jnz =>jit_return_label
+ } else {
+ | jnz >9
+ }
+ }
+ | //SAVE_OPLINE()
+ | ZVAL_DTOR_FUNC op1_info, opline
+ | //????mov r1, EX->return_value // reload ???
+ }
+ if (jit_return_label >= 0) {
+ | jmp =>jit_return_label
+ } else {
+ | jmp >9
+ }
+ |.code
+ } else {
+ if (jit_return_label >= 0) {
+ | jz =>jit_return_label
+ } else {
+ | jz >9
+ }
+ }
+
+ if (opline->op1_type == IS_CONST) {
+ zval *zv = RT_CONSTANT(opline, opline->op1);
+ | ZVAL_COPY_CONST ret_addr, -1, -1, zv, r0
+ if (Z_REFCOUNTED_P(zv)) {
+ | ADDREF_CONST zv, r0
+ }
+ } else if (opline->op1_type == IS_TMP_VAR) {
+ | ZVAL_COPY_VALUE ret_addr, -1, op1_addr, op1_info, ZREG_R0, ZREG_R2
+ } else if (opline->op1_type == IS_CV) {
+ if (op1_info & MAY_BE_REF) {
+ | LOAD_ZVAL_ADDR r0, op1_addr
+ | ZVAL_DEREF r0, op1_info
+ op1_addr = ZEND_ADDR_MEM_ZVAL(ZREG_R0, 0);
+ }
+ | ZVAL_COPY_VALUE ret_addr, -1, op1_addr, op1_info, ZREG_R0, ZREG_R2
+ | // TODO: JIT: if (EXPECTED(!(EX_CALL_INFO() & ZEND_CALL_CODE))) ZVAL_NULL(retval_ptr); ???
+ | TRY_ADDREF op1_info, ah, r2
+ } else {
+ if (op1_info & MAY_BE_REF) {
+ zend_jit_addr ref_addr = ZEND_ADDR_MEM_ZVAL(ZREG_R0, offsetof(zend_reference, val));
+
+ | IF_ZVAL_TYPE op1_addr, IS_REFERENCE, >1
+ |.cold_code
+ |1:
+ | // zend_refcounted *ref = Z_COUNTED_P(retval_ptr);
+ | GET_ZVAL_PTR r0, op1_addr
+ | // ZVAL_COPY_VALUE(return_value, &ref->value);
+ | ZVAL_COPY_VALUE ret_addr, -1, ref_addr, op1_info, ZREG_R2, ZREG_R2
+ | GC_DELREF r0
+ | je >2
+ | // if (IS_REFCOUNTED())
+ if (jit_return_label >= 0) {
+ | IF_NOT_REFCOUNTED dh, =>jit_return_label
+ } else {
+ | IF_NOT_REFCOUNTED dh, >9
+ }
+ | // ADDREF
+ | GET_ZVAL_PTR r2, ret_addr // reload
+ | GC_ADDREF r2
+ if (jit_return_label >= 0) {
+ | jmp =>jit_return_label
+ } else {
+ | jmp >9
+ }
+ |2:
+ | EFREE_24 r0, op_array, opline
+ if (jit_return_label >= 0) {
+ | jmp =>jit_return_label
+ } else {
+ | jmp >9
+ }
+ |.code
+ }
+ | ZVAL_COPY_VALUE ret_addr, -1, op1_addr, op1_info, ZREG_R0, ZREG_R2
+ }
+
+ |9:
+ //JIT: ZEND_VM_DISPATCH_TO_HELPER(zend_leave_helper);
+ return zend_jit_leave_func(Dst, opline, op_array, ssa);
+}
+
+static int zend_jit_fetch_dim_read(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, uint32_t op1_info, uint32_t op2_info, uint32_t res_info, int may_throw)
+{
+ zend_jit_addr op1_addr, orig_op1_addr, op2_addr, res_addr;
+
+ op1_addr = orig_op1_addr = OP1_ADDR();
+ op2_addr = OP2_ADDR();
+ res_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->result.var);
+
+ if (op1_info & MAY_BE_REF) {
+ | LOAD_ZVAL_ADDR FCARG1a, op1_addr
+ | ZVAL_DEREF FCARG1a, op1_info
+ op1_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 0);
+ }
+
+ if (op1_info & MAY_BE_ARRAY) {
+ if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF) - MAY_BE_ARRAY)) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_ARRAY, >7
+ }
+ | GET_ZVAL_LVAL ZREG_FCARG1a, op1_addr
+ if (!zend_jit_fetch_dimension_address_inner(Dst, opline, (opline->opcode == ZEND_FETCH_DIM_R) ? BP_VAR_R : BP_VAR_IS, op1_info, op2_info, 8, 9)) {
+ return 0;
+ }
+ }
+
+ if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_ARRAY)) {
+ if (op1_info & MAY_BE_ARRAY) {
+ |.cold_code
+ |7:
+ }
+
+ if (op1_info & MAY_BE_STRING) {
+ if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_ARRAY|MAY_BE_STRING))) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_STRING, >6
+ }
+ | SAVE_VALID_OPLINE opline
+ if (Z_REG(op1_addr) != ZREG_FCARG1a) {
+ | LOAD_ZVAL_ADDR FCARG1a, op1_addr
+ }
+ | LOAD_ZVAL_ADDR FCARG2a, op2_addr
+ |.if X64
+ | LOAD_ZVAL_ADDR CARG3, res_addr
+ |.else
+ | sub r4, 12
+ | PUSH_ZVAL_ADDR res_addr, r0
+ |.endif
+ if (opline->opcode == ZEND_FETCH_DIM_R) {
+ | EXT_CALL zend_jit_fetch_dim_str_r_helper, r0
+ } else if (opline->opcode == ZEND_FETCH_DIM_IS) {
+ | EXT_CALL zend_jit_fetch_dim_str_is_helper, r0
+ } else {
+ ZEND_ASSERT(0);
+ }
+ |.if not(X64)
+ | add r4, 12
+ |.endif
+ if ((op1_info & MAY_BE_ARRAY) ||
+ (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_ARRAY|MAY_BE_STRING)))) {
+ | jmp >9 // END
+ }
+ |6:
+ }
+
+ if (op1_info & MAY_BE_OBJECT) {
+ if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_OBJECT))) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_OBJECT, >6
+ }
+ | SAVE_VALID_OPLINE opline
+ if (Z_REG(op1_addr) != ZREG_FCARG1a) {
+ | LOAD_ZVAL_ADDR FCARG1a, op1_addr
+ }
+ if (opline->op2_type == IS_CONST && Z_EXTRA_P(RT_CONSTANT(opline, opline->op2)) == ZEND_EXTRA_VALUE) {
+ ZEND_ASSERT(Z_MODE(op2_addr) == IS_CONST_ZVAL);
+ | LOAD_ADDR FCARG2a, (Z_ZV(op2_addr) + 1)
+ } else {
+ | LOAD_ZVAL_ADDR FCARG2a, op2_addr
+ }
+ |.if X64
+ | LOAD_ZVAL_ADDR CARG3, res_addr
+ |.else
+ | sub r4, 12
+ | PUSH_ZVAL_ADDR res_addr, r0
+ |.endif
+ if (opline->opcode == ZEND_FETCH_DIM_R) {
+ | EXT_CALL zend_jit_fetch_dim_obj_r_helper, r0
+ } else if (opline->opcode == ZEND_FETCH_DIM_IS) {
+ | EXT_CALL zend_jit_fetch_dim_obj_is_helper, r0
+ } else {
+ ZEND_ASSERT(0);
+ }
+ |.if not(X64)
+ | add r4, 12
+ |.endif
+ if ((op1_info & MAY_BE_ARRAY) ||
+ (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_OBJECT)))) {
+ | jmp >9 // END
+ }
+ |6:
+ }
+
+ if ((opline->opcode != ZEND_FETCH_DIM_IS && (op1_info & MAY_BE_UNDEF)) || (op2_info & MAY_BE_UNDEF)) {
+ | SAVE_VALID_OPLINE opline
+ if (opline->opcode != ZEND_FETCH_DIM_IS && (op1_info & MAY_BE_UNDEF)) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_UNDEF, >1
+ | // zend_error(E_WARNING, "Undefined variable: %s", ZSTR_VAL(CV_DEF_OF(EX_VAR_TO_NUM(opline->op1.var))));
+ | mov FCARG1d, opline->op1.var
+ | EXT_CALL zend_jit_undefined_op_helper, r0
+ |1:
+ }
+
+ if (op2_info & MAY_BE_UNDEF) {
+ | IF_NOT_ZVAL_TYPE op2_addr, IS_UNDEF, >1
+ | mov FCARG1d, opline->op2.var
+ | EXT_CALL zend_jit_undefined_op_helper, r0
+ |1:
+ }
+ }
+
+ if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-(MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_OBJECT))) {
+ if (opline->opcode != ZEND_FETCH_DIM_IS) {
+ | SAVE_VALID_OPLINE opline
+ | LOAD_ZVAL_ADDR FCARG1a, orig_op1_addr
+ | EXT_CALL zend_jit_invalid_array_access, r0
+ }
+ | SET_ZVAL_TYPE_INFO res_addr, IS_NULL
+ if (op1_info & MAY_BE_ARRAY) {
+ | jmp >9 // END
+ }
+ }
+
+ if (op1_info & MAY_BE_ARRAY) {
+ |.code
+ }
+ }
+
+ if (op1_info & MAY_BE_ARRAY) {
+ zend_jit_addr val_addr = ZEND_ADDR_MEM_ZVAL(ZREG_R0, 0);
+
+ |8:
+ if (op1_info & MAY_BE_ARRAY_OF_REF) {
+ | // ZVAL_COPY_DEREF
+ | IF_NOT_ZVAL_REFCOUNTED val_addr, >2
+ | IF_NOT_ZVAL_TYPE val_addr, IS_REFERENCE, >1
+ | GET_Z_PTR r0, r0
+ | add r0, offsetof(zend_reference, val)
+ | IF_NOT_ZVAL_REFCOUNTED val_addr, >2
+ |1:
+ | GET_Z_PTR r1, r0
+ | GC_ADDREF r1
+ |2:
+ | ZVAL_COPY_VALUE res_addr, -1, val_addr, MAY_BE_ANY, ZREG_R1, ZREG_R2
+ } else {
+ | // ZVAL_COPY
+ | ZVAL_COPY_VALUE res_addr, -1, val_addr, MAY_BE_ANY, ZREG_R1, ZREG_R2
+ | TRY_ADDREF res_info, ch, r2
+ }
+ }
+ |9: // END
+
+#ifdef ZEND_JIT_USE_RC_INFERENCE
+ if ((opline->op2_type & (IS_TMP_VAR|IS_VAR)) && (op1_info & MAY_BE_OBJECT)) {
+ /* Magic offsetGet() may increase refcount of the key */
+ op2_info |= MAY_BE_RCN;
+ }
+#endif
+
+ | FREE_OP opline->op2_type, opline->op2, op2_info, 0, op_array, opline
+ | FREE_OP opline->op1_type, opline->op1, op1_info, 0, op_array, opline
+
+ if (may_throw) {
+ if (!zend_jit_check_exception(Dst)) {
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+static int zend_jit_isset_isempty_dim(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, uint32_t op1_info, uint32_t op2_info, int may_throw, zend_uchar smart_branch_opcode, uint32_t target_label, uint32_t target_label2)
+{
+ zend_jit_addr op1_addr, op2_addr, res_addr;
+
+ // TODO: support for empty() ???
+ ZEND_ASSERT(!(opline->extended_value & ZEND_ISEMPTY));
+
+ op1_addr = OP1_ADDR();
+ op2_addr = OP2_ADDR();
+ res_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->result.var);
+
+ if (op1_info & MAY_BE_REF) {
+ | LOAD_ZVAL_ADDR FCARG1a, op1_addr
+ | ZVAL_DEREF FCARG1a, op1_info
+ op1_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 0);
+ }
+
+ if (op1_info & MAY_BE_ARRAY) {
+ if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF) - MAY_BE_ARRAY)) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_ARRAY, >7
+ }
+ | GET_ZVAL_LVAL ZREG_FCARG1a, op1_addr
+ if (!zend_jit_fetch_dimension_address_inner(Dst, opline, BP_JIT_IS, op1_info, op2_info, 8, 9)) {
+ return 0;
+ }
+ }
+
+ if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_ARRAY)) {
+ if (op1_info & MAY_BE_ARRAY) {
+ |.cold_code
+ |7:
+ }
+
+ | SAVE_VALID_OPLINE opline
+ if (Z_REG(op1_addr) != ZREG_FCARG1a) {
+ | LOAD_ZVAL_ADDR FCARG1a, op1_addr
+ }
+ if (opline->op2_type == IS_CONST && Z_EXTRA_P(RT_CONSTANT(opline, opline->op2)) == ZEND_EXTRA_VALUE) {
+ ZEND_ASSERT(Z_MODE(op2_addr) == IS_CONST_ZVAL);
+ | LOAD_ADDR FCARG2a, (Z_ZV(op2_addr) + 1)
+ } else {
+ | LOAD_ZVAL_ADDR FCARG2a, op2_addr
+ }
+ | EXT_CALL zend_jit_isset_dim_helper, r0
+ | test r0, r0
+ | jz >9
+ | jmp >8
+
+ if (op1_info & MAY_BE_ARRAY) {
+ |.code
+ }
+ }
+
+#ifdef ZEND_JIT_USE_RC_INFERENCE
+ if ((opline->op2_type & (IS_TMP_VAR|IS_VAR)) && (op1_info & MAY_BE_OBJECT)) {
+ /* Magic offsetExists() may increase refcount of the key */
+ op2_info |= MAY_BE_RCN;
+ }
+#endif
+
+ |8:
+ | FREE_OP opline->op2_type, opline->op2, op2_info, 0, op_array, opline
+ | FREE_OP opline->op1_type, opline->op1, op1_info, 0, op_array, opline
+ if (may_throw) {
+ if (!zend_jit_check_exception_undef_result(Dst, opline)) {
+ return 0;
+ }
+ }
+ if (!(opline->extended_value & ZEND_ISEMPTY)) {
+ if (smart_branch_opcode) {
+ if (smart_branch_opcode == ZEND_JMPZ) {
+ | jmp =>target_label2
+ } else if (smart_branch_opcode == ZEND_JMPNZ) {
+ | jmp =>target_label
+ } else if (smart_branch_opcode == ZEND_JMPZNZ) {
+ | jmp =>target_label2
+ } else {
+ ZEND_ASSERT(0);
+ }
+ } else {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
+ | jmp >8
+ }
+ } else {
+ | //????
+ | int3
+ }
+
+ |9: // not found
+ | FREE_OP opline->op2_type, opline->op2, op2_info, 0, op_array, opline
+ | FREE_OP opline->op1_type, opline->op1, op1_info, 0, op_array, opline
+ if (may_throw) {
+ if (!zend_jit_check_exception_undef_result(Dst, opline)) {
+ return 0;
+ }
+ }
+ if (!(opline->extended_value & ZEND_ISEMPTY)) {
+ if (smart_branch_opcode) {
+ if (smart_branch_opcode == ZEND_JMPZ) {
+ | jmp =>target_label
+ } else if (smart_branch_opcode == ZEND_JMPNZ) {
+ } else if (smart_branch_opcode == ZEND_JMPZNZ) {
+ | jmp =>target_label
+ } else {
+ ZEND_ASSERT(0);
+ }
+ } else {
+ | SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
+ }
+ } else {
+ | //????
+ | int3
+ }
+
+ |8:
+
+ return 1;
+}
+
+static int zend_jit_bind_global(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, uint32_t op1_info)
+{
+ zend_jit_addr op1_addr = OP1_ADDR();
+ zval *varname = RT_CONSTANT(opline, opline->op2);
+
+ //idx = (uint32_t)(uintptr_t)CACHED_PTR(opline->extended_value) - 1;
+ | mov r0, EX->run_time_cache
+ | mov r0, aword [r0 + opline->extended_value]
+ | sub r0, 1
+ //if (EXPECTED(idx < EG(symbol_table).nNumUsed * sizeof(Bucket)))
+ |.if X64
+ | MEM_OP2_2_ZTS movsxd, r1, dword, executor_globals, symbol_table.nNumUsed, r1
+ | shl r1, 5
+ |.else
+ | MEM_OP2_2_ZTS mov, r1, dword, executor_globals, symbol_table.nNumUsed, r1
+ | imul r1, sizeof(Bucket)
+ |.endif
+ | cmp r0, r1
+ | jae >9
+ //Bucket *p = (Bucket*)((char*)EG(symbol_table).arData + idx);
+ | MEM_OP2_2_ZTS add, r0, aword, executor_globals, symbol_table.arData, r1
+ | IF_Z_TYPE r0, IS_UNDEF, >9
+ // (EXPECTED(p->key == Z_STR_P(varname))
+ | ADDR_OP2_2 cmp, aword [r0 + offsetof(Bucket, key)], Z_PTR_P(varname), r1
+ | jne >1
+ |.cold_code
+ |1:
+ //(EXPECTED(p->h == ZSTR_H(Z_STR_P(varname)))
+ | ADDR_OP2_2 cmp, aword [r0 + offsetof(Bucket, h)], ZSTR_H(Z_STR_P(varname)), r1
+ | jne >9
+ //EXPECTED(p->key != NULL)
+ | mov r1, [r0 + offsetof(Bucket, key)]
+ | test r1, r1
+ | jz >9
+ //EXPECTED(ZSTR_LEN(p->key) == Z_STRLEN_P(varname))
+ | ADDR_OP2_2 cmp, aword [r1 + offsetof(zend_string, len)], Z_STRLEN_P(varname), r2
+ | jne >9
+ //EXPECTED(memcmp(ZSTR_VAL(p->key), Z_STRVAL_P(varname), Z_STRLEN_P(varname)) == 0)
+ | add r1, offsetof(zend_string, val)
+ | mov T1, r0
+ |.if X64
+ | mov CARG1, r1
+ | LOAD_ADDR CARG2, Z_STRVAL_P(varname)
+ | mov CARG3, Z_STRLEN_P(varname)
+ | EXT_CALL memcmp, r0
+ |.else
+ | sub r4, 4
+ | push Z_STRLEN_P(varname)
+ | push Z_STRVAL_P(varname)
+ | push r1
+ | call &memcmp
+ | add r4, 16
+ |.endif
+ | test al, al
+ | mov r0, aword T1
+ | jnz >9
+ | jmp >2
+ |.code
+ |2:
+ // if (UNEXPECTED(Z_TYPE_P(value) == IS_INDIRECT))
+ | mov cl, byte [r0 + 8]
+ | cmp cl, IS_INDIRECT
+ | je >1
+ |.cold_code
+ |1:
+ //value = Z_INDIRECT_P(value)
+ | mov r0, [r0]
+ | mov cl, byte [r0 + 8]
+ | test cl, cl // cmp cl, IS_UNDEF
+ | jne >2
+ | SET_Z_TYPE_INFO r0, IS_NULL
+ |.code
+ |2:
+ | cmp cl, IS_REFERENCE
+ | jne >8
+ |1:
+ if (op1_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF)) {
+ //stash this for later use
+ | mov r2, r0
+ }
+ | GET_Z_PTR r0, r0
+ | GC_ADDREF r0
+ //if (UNEXPECTED(Z_REFCOUNTED_P(variable_ptr)))
+ if (op1_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF)) {
+ if (op1_info & (MAY_BE_ANY - (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
+ | IF_ZVAL_REFCOUNTED op1_addr, >2
+ }
+ |.cold_code
+ //zval_dtor_func(Z_COUNTED_P(variable_ptr))
+ |2:
+ //if (EXPECTED(variable_ptr != value))
+ | LOAD_ZVAL_ADDR FCARG1a, op1_addr
+ | cmp FCARG1a, r2
+ | je >4
+ | GET_Z_PTR FCARG1a, FCARG1a
+ | GC_DELREF FCARG1a
+ if (op1_info & (MAY_BE_ARRAY|MAY_BE_OBJECT)) {
+ | jnz >3
+ }
+ | mov aword T1, r0 // save
+ | ZVAL_DTOR_FUNC op1_info, opline
+ | mov r0, aword T1 // restore
+ | jmp >5
+ if (op1_info & (MAY_BE_ARRAY|MAY_BE_OBJECT)) {
+ |3:
+ // GC_ZVAL_CHECK_POSSIBLE_ROOT(variable_ptr)
+ | IF_GC_MAY_NOT_LEAK FCARG1a, edx, >5
+ | mov aword T1, r0 //save
+ | EXT_CALL gc_possible_root, r1
+ | mov r0, aword T1 // restore
+ | jmp >5
+ }
+ |4:
+ | GET_Z_PTR FCARG1a, FCARG1a
+ | GC_DELREF FCARG1a
+ | jmp >5
+ |.code
+ }
+ |5:
+ //ZVAL_REF(variable_ptr, ref)
+ | SET_ZVAL_PTR op1_addr, r0
+ | SET_ZVAL_TYPE_INFO op1_addr, IS_REFERENCE_EX
+ //END of handler
+
+ |.cold_code
+ |8:
+ | mov FCARG1a, r0
+ | EXT_CALL zend_jit_new_ref_helper, r0
+ | jmp <1
+ |9:
+ | mov FCARG1a, FP
+ | LOAD_ADDR FCARG2a, (ptrdiff_t)varname
+ |.if X64
+ | mov CARG3, opline->extended_value
+ |.else
+ | sub r4, 12
+ | push opline->extended_value
+ |.endif
+ | EXT_CALL zend_jit_fetch_global_helper, r0
+ |.if not(X64)
+ | add r4, 12
+ |.endif
+ | jmp <1
+ |.code
+
+ return 1;
+}
+
+static int zend_jit_recv(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array)
+{
+ uint32_t arg_num = opline->op1.num;
+
+ | cmp dword EX->This.u2.num_args, arg_num
+ | jb >1
+ |.cold_code
+ |1:
+ | SAVE_VALID_OPLINE opline
+ | mov FCARG1a, FP
+ | EXT_CALL zend_missing_arg_error, r0
+ | jmp ->exception_handler
+ |.code
+
+ if (op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS) {
+ zend_arg_info *arg_info = NULL;
+
+ if (EXPECTED(arg_num <= op_array->num_args)) {
+ arg_info = &op_array->arg_info[arg_num-1];
+ } else if (UNEXPECTED(op_array->fn_flags & ZEND_ACC_VARIADIC)) {
+ arg_info = &op_array->arg_info[op_array->num_args];
+ }
+ if (arg_info) {
+ zend_type type = arg_info->type;
+
+ if (ZEND_TYPE_IS_SET(type)) {
+ // Type check
+ zend_jit_addr res_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->result.var);
+
+ | LOAD_ZVAL_ADDR r0, res_addr
+ if (ZEND_ARG_SEND_MODE(arg_info)) {
+ | GET_Z_PTR r0, r0
+ | add r0, offsetof(zend_reference, val)
+ }
+
+ uint32_t type_mask = ZEND_TYPE_PURE_MASK(type);
+ if (type_mask == 0) {
+ | jmp >8
+ } else if (is_power_of_two(type_mask)) {
+ uint32_t type_code = concrete_type(type_mask);
+ | cmp byte [r0 + 8], type_code
+ | jne >8
+ } else {
+ | mov edx, 1
+ | mov cl, byte [r0 + 8]
+ | shl edx, cl
+ | test edx, type_mask
+ | je >8
+ }
+
+ |.cold_code
+ |8:
+ | SAVE_VALID_OPLINE opline
+ | mov FCARG1a, r0
+ | mov r0, EX->run_time_cache
+ | add r0, opline->extended_value
+ | mov FCARG2a, EX->func
+ |.if X64WIN
+ | mov CARG3, arg_num
+ | LOAD_ADDR CARG4, (ptrdiff_t)arg_info
+ | mov aword A5, r0
+ | EXT_CALL zend_jit_verify_arg_slow, r0
+ |.elif X64
+ | mov CARG3, arg_num
+ | LOAD_ADDR CARG4, (ptrdiff_t)arg_info
+ | mov CARG5, r0
+ | EXT_CALL zend_jit_verify_arg_slow, r0
+ |.else
+ | sub r4, 4
+ | push r0
+ | push (ptrdiff_t)arg_info
+ | push arg_num
+ | EXT_CALL zend_jit_verify_arg_slow, r0
+ | add r4, 4
+ |.endif
+ if (!zend_jit_check_exception(Dst)) {
+ return 0;
+ }
+ | jmp >1
+ |.code
+ |1:
+
+ if ((opline+1)->opcode != ZEND_RECV && (opline+1)->opcode != ZEND_RECV_INIT) {
+ last_valid_opline = NULL;
+ if (!zend_jit_set_valid_ip(Dst, opline + 1)) {
+ return 0;
+ }
+ }
+
+ return 1;
+ }
+ }
+ }
+
+ if ((opline+1)->opcode != ZEND_RECV && (opline+1)->opcode != ZEND_RECV_INIT) {
+ last_valid_opline = NULL;
+ if (!zend_jit_set_valid_ip(Dst, opline + 1)) {
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+static int zend_jit_recv_init(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, zend_bool is_last, int may_throw)
+{
+ zend_arg_info *arg_info = NULL;
+ zend_bool has_slow = 0;
+ uint32_t arg_num = opline->op1.num;
+ zval *zv = RT_CONSTANT(opline, opline->op2);
+ zend_jit_addr res_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->result.var);
+
+ | cmp dword EX->This.u2.num_args, arg_num
+ | jae >5
+ | ZVAL_COPY_CONST res_addr, -1, -1, zv, r0
+ if (Z_REFCOUNTED_P(zv)) {
+ | ADDREF_CONST zv, r0
+ }
+ if (Z_CONSTANT_P(zv)) {
+ has_slow = 1;
+ | SAVE_VALID_OPLINE opline
+ |.if X64
+ | LOAD_ZVAL_ADDR CARG1, res_addr
+ | mov r0, EX->func
+ | mov CARG2, [r0 + offsetof(zend_op_array, scope)]
+ | EXT_CALL zval_update_constant_ex, r0
+ |.else
+ | sub r4, 8
+ | mov r0, EX->func
+ | push dword [r0 + offsetof(zend_op_array, scope)]
+ | LOAD_ZVAL_ADDR r0, res_addr
+ | push r0
+ | EXT_CALL zval_update_constant_ex, r0
+ | add r4, 16
+ |.endif
+ | test al, al
+ | jnz >7
+ }
+ |5:
+ if (op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS) {
+ do {
+ if (arg_num <= op_array->num_args) {
+ arg_info = &op_array->arg_info[arg_num-1];
+ } else if (op_array->fn_flags & ZEND_ACC_VARIADIC) {
+ arg_info = &op_array->arg_info[op_array->num_args];
+ } else {
+ break;
+ }
+ if (!ZEND_TYPE_IS_SET(arg_info->type)) {
+ break;
+ }
+ has_slow += 2;
+ | LOAD_ZVAL_ADDR r0, res_addr
+ | ZVAL_DEREF r0, MAY_BE_REF
+
+ uint32_t type_mask = ZEND_TYPE_PURE_MASK(arg_info->type);
+ if (type_mask == 0) {
+ | jmp >8
+ } else if (is_power_of_two(type_mask)) {
+ uint32_t type_code = concrete_type(type_mask);
+ | cmp byte [r0 + 8], type_code
+ | jne >8
+ } else {
+ | mov edx, 1
+ | mov cl, byte [r0 + 8]
+ | shl edx, cl
+ | test edx, type_mask
+ | je >8
+ }
+ } while (0);
+ }
+ |9:
+ if (may_throw) {
+ if (!zend_jit_check_exception(Dst)) {
+ return 0;
+ }
+ }
+ if (is_last) {
+ | LOAD_IP_ADDR (opline + 1)
+ last_valid_opline = (opline + 1);
+ }
+
+ if (has_slow) {
+ |.cold_code
+ if (has_slow & 1) {
+ |7:
+ | ZVAL_PTR_DTOR res_addr, MAY_BE_ANY|MAY_BE_RC1|MAY_BE_RCN, 1, 0, 0, opline
+ | SET_ZVAL_TYPE_INFO res_addr, IS_UNDEF
+ if (may_throw) {
+ if (!zend_jit_check_exception(Dst)) {
+ return 0;
+ }
+ }
+ | jmp <5
+ }
+ if (has_slow & 2) {
+ |8:
+ | mov FCARG1a, r0
+ | mov r0, EX->run_time_cache
+ | lea r0, [r0 + opline->extended_value]
+ | mov FCARG2a, EX->func
+ |.if X64WIN
+ | mov CARG3, arg_num
+ | LOAD_ADDR CARG4, (ptrdiff_t)arg_info
+ | mov aword A5, r0
+ | SAVE_VALID_OPLINE opline
+ | EXT_CALL zend_jit_verify_arg_slow, r0
+ |.elif X64
+ | mov CARG3, arg_num
+ | LOAD_ADDR CARG4, (ptrdiff_t)arg_info
+ | mov CARG5, r0
+ | SAVE_VALID_OPLINE opline
+ | EXT_CALL zend_jit_verify_arg_slow, r0
+ |.else
+ | sub r4, 4
+ | push r0
+ | push (ptrdiff_t)arg_info
+ | push arg_num
+ | SAVE_VALID_OPLINE opline
+ | EXT_CALL zend_jit_verify_arg_slow, r0
+ | add r4, 4
+ |.endif
+ | jmp <9
+ }
+ |.code
+ }
+
+ return 1;
+}
+
+#define ZEND_WRONG_PROPERTY_OFFSET 0
+
+static uint32_t zend_get_known_property_offset(zend_class_entry *ce, zend_string *member, zend_bool on_this, zend_string *filename)
+{
+ zend_property_info *info;
+
+ if (!ce || !(ce->ce_flags & ZEND_ACC_LINKED) || (ce->ce_flags & ZEND_ACC_TRAIT)) {
+ return ZEND_WRONG_PROPERTY_OFFSET;
+ }
+
+ if (ce->info.user.filename != filename) {
+ /* class declaration might be changed infdependently */
+ return ZEND_WRONG_PROPERTY_OFFSET;
+ }
+
+ if (ce->parent) {
+ zend_class_entry *parent = ce->parent;
+
+ do {
+ if (parent->type == ZEND_INTERNAL_CLASS) {
+ break;
+ } else if (parent->info.user.filename != filename) {
+ /* some of parents class declarations might be changed infdependently */
+ /* TODO: this check may be not enough, because even
+ * in the same it's possible to conditionally define
+ * few classes with the same name, and "parent" may
+ * change from request to request.
+ */
+ return ZEND_WRONG_PROPERTY_OFFSET;
+ }
+ parent = parent->parent;
+ } while (parent);
+ }
+
+ info = (zend_property_info*)zend_hash_find_ptr(&ce->properties_info, member);
+ if (info == NULL ||
+ info->offset == ZEND_WRONG_PROPERTY_OFFSET ||
+ (info->flags & ZEND_ACC_STATIC)) {
+ return ZEND_WRONG_PROPERTY_OFFSET;
+ }
+
+ if (!(info->flags & ZEND_ACC_PUBLIC) &&
+ (!on_this || info->ce != ce)) {
+ return ZEND_WRONG_PROPERTY_OFFSET;
+ }
+
+ return info->offset;
+}
+
+static zend_bool zend_may_be_dynamic_property(zend_class_entry *ce, zend_string *member, zend_bool on_this, zend_string *filename)
+{
+ zend_property_info *info;
+
+ if (!ce || (ce->ce_flags & ZEND_ACC_TRAIT)) {
+ return 1;
+ }
+
+ if (ce->info.user.filename != filename) {
+ /* class declaration might be changed infdependently */
+ return 1;
+ }
+
+ info = (zend_property_info*)zend_hash_find_ptr(&ce->properties_info, member);
+ if (info == NULL ||
+ info->offset == ZEND_WRONG_PROPERTY_OFFSET ||
+ (info->flags & ZEND_ACC_STATIC)) {
+ return 1;
+ }
+
+ if (!(info->flags & ZEND_ACC_PUBLIC) &&
+ (!on_this || info->ce != ce)) {
+ return 1;
+ }
+
+ return 0;
+}
+
+static int zend_jit_fetch_obj_read(dasm_State **Dst, zend_op *opline, const zend_op_array *op_array, uint32_t op1_info, zend_class_entry *ce, int may_throw)
+{
+ zval *member;
+ uint32_t offset;
+ zend_bool may_be_dynamic = 1;
+ zend_jit_addr op1_addr = 0;
+ zend_jit_addr res_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->result.var);
+ zend_jit_addr this_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, offsetof(zend_execute_data, This));
+ zend_jit_addr prop_addr;
+
+ ZEND_ASSERT(opline->op2_type == IS_CONST);
+ ZEND_ASSERT(op1_info & MAY_BE_OBJECT);
+
+ member = RT_CONSTANT(opline, opline->op2);
+ ZEND_ASSERT(Z_TYPE_P(member) == IS_STRING && Z_STRVAL_P(member)[0] != '\0');
+ offset = zend_get_known_property_offset(ce, Z_STR_P(member), opline->op1_type == IS_UNUSED, op_array->filename);
+
+ if (opline->op1_type == IS_UNUSED) {
+ | GET_ZVAL_PTR FCARG1a, this_addr
+ } else {
+ op1_addr = OP1_ADDR();
+ if (op1_info & MAY_BE_REF) {
+ | LOAD_ZVAL_ADDR r0, op1_addr
+ | ZVAL_DEREF r0, op1_info
+ op1_addr = ZEND_ADDR_MEM_ZVAL(ZREG_R0, 0);
+ }
+ if (op1_info & ((MAY_BE_UNDEF|MAY_BE_ANY)- MAY_BE_OBJECT)) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_OBJECT, >7
+ }
+ | GET_ZVAL_PTR FCARG1a, op1_addr
+ }
+
+ if (offset == ZEND_WRONG_PROPERTY_OFFSET) {
+ | mov r0, EX->run_time_cache
+ | mov r2, aword [r0 + (opline->extended_value & ~ZEND_FETCH_OBJ_FLAGS)]
+ | cmp r2, aword [FCARG1a + offsetof(zend_object, ce)]
+ | jne >5
+ | mov r0, aword [r0 + (opline->extended_value & ~ZEND_FETCH_OBJ_FLAGS) + sizeof(void*)]
+ may_be_dynamic = zend_may_be_dynamic_property(ce, Z_STR_P(member), opline->op1_type == IS_UNUSED, op_array->filename);
+ if (may_be_dynamic) {
+ | test r0, r0
+ | jl >8 // dynamic property
+ }
+ | mov edx, dword [FCARG1a + r0 + 8]
+ | IF_TYPE dl, IS_UNDEF, >5
+ | add FCARG1a, r0
+ prop_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 0);
+ } else {
+ prop_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, offset);
+ | mov edx, dword [FCARG1a + offset + 8]
+ | IF_TYPE dl, IS_UNDEF, >5
+ }
+ | GET_ZVAL_PTR r0, prop_addr
+ | IF_NOT_REFCOUNTED dh, >2
+ if (opline->opcode == ZEND_FETCH_OBJ_R || opline->opcode == ZEND_FETCH_OBJ_IS) {
+ | IF_TYPE dl, IS_REFERENCE, >6
+ }
+ |1:
+ | GC_ADDREF r0
+ |2:
+ |.if X64
+ | SET_ZVAL_PTR res_addr, r0
+ |.else
+ | SET_ZVAL_PTR res_addr, r0
+ | GET_ZVAL_W2 r0, prop_addr
+ | SET_ZVAL_W2 res_addr, r0
+ |.endif
+ | SET_ZVAL_TYPE_INFO res_addr, edx
+
+ |.cold_code
+ |5:
+ | LOAD_ADDR FCARG2a, member
+ |.if X64
+ | LOAD_ZVAL_ADDR CARG3, res_addr
+ | mov CARG4, (opline->extended_value & ~ZEND_FETCH_OBJ_FLAGS)
+ |.else
+ | sub r4, 8
+ | push (opline->extended_value & ~ZEND_FETCH_OBJ_FLAGS)
+ | PUSH_ZVAL_ADDR res_addr, r0
+ |.endif
+ | SAVE_VALID_OPLINE opline
+ if (opline->opcode == ZEND_FETCH_OBJ_R) {
+ | EXT_CALL zend_jit_fetch_obj_r_slow, r0
+ } else if (opline->opcode == ZEND_FETCH_OBJ_IS) {
+ | EXT_CALL zend_jit_fetch_obj_is_slow, r0
+ } else {
+ ZEND_ASSERT(0);
+ }
+ |.if not(X64)
+ | add r4, 8
+ |.endif
+ | jmp >9
+
+ if (opline->opcode == ZEND_FETCH_OBJ_R || opline->opcode == ZEND_FETCH_OBJ_IS) {
+ |6:
+ if (offset == ZEND_WRONG_PROPERTY_OFFSET) {
+ | mov FCARG2a, FCARG1a
+ } else {
+ | lea FCARG2a, [FCARG1a + offset]
+ }
+ | LOAD_ZVAL_ADDR FCARG1a, res_addr
+ | EXT_CALL zend_jit_zval_copy_deref_helper, r0
+ | jmp >9
+ }
+
+ if (op1_info & ((MAY_BE_UNDEF|MAY_BE_ANY|MAY_BE_REF)- MAY_BE_OBJECT)) {
+ |7:
+ if (opline->opcode == ZEND_FETCH_OBJ_R) {
+ | SAVE_VALID_OPLINE opline
+ if (op1_info & MAY_BE_UNDEF) {
+ if (op1_info & MAY_BE_ANY) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_UNDEF, >1
+ }
+ | mov FCARG1d, opline->op1.var
+ | EXT_CALL zend_jit_undefined_op_helper, r0
+ |1:
+ }
+ |.if X64
+ | mov CARG1, E_WARNING
+ | LOAD_ADDR CARG2, "Trying to get property '%s' of non-object"
+ | LOAD_ADDR CARG3, Z_STRVAL_P(member)
+ | EXT_CALL zend_error, r0
+ |.else
+ | sub r4, 4
+ | push Z_STRVAL_P(member)
+ | push "Trying to get property '%s' of non-object"
+ | push E_WARNING
+ | EXT_CALL zend_error, r0
+ | add r4, 16
+ |.endif
+ }
+ | SET_ZVAL_TYPE_INFO res_addr, IS_NULL
+ | jmp >9
+ }
+
+ if (offset == ZEND_WRONG_PROPERTY_OFFSET && may_be_dynamic) {
+ |8:
+ | mov FCARG2a, r0
+ |.if X64WIN
+ | LOAD_ADDR CARG3, member
+ | LOAD_ZVAL_ADDR CARG4, res_addr
+ | mov aword A5, (opline->extended_value & ~ZEND_FETCH_OBJ_FLAGS)
+ |.elif X64
+ | LOAD_ADDR CARG3, member
+ | LOAD_ZVAL_ADDR CARG4, res_addr
+ | mov CARG5, (opline->extended_value & ~ZEND_FETCH_OBJ_FLAGS)
+ |.else
+ | sub r4, 4
+ | push (opline->extended_value & ~ZEND_FETCH_OBJ_FLAGS)
+ | PUSH_ZVAL_ADDR res_addr, r0
+ | PUSH_ADDR member, r0
+ |.endif
+ | SAVE_VALID_OPLINE opline
+ if (opline->opcode == ZEND_FETCH_OBJ_R) {
+ | EXT_CALL zend_jit_fetch_obj_r_dynamic, r0
+ } else if (opline->opcode == ZEND_FETCH_OBJ_IS) {
+ | EXT_CALL zend_jit_fetch_obj_is_dynamic, r0
+ }
+ |.if not(X64)
+ | add r4, 4
+ |.endif
+ | jmp >9
+ }
+
+ |.code;
+ |9: // END
+ | FREE_OP opline->op1_type, opline->op1, op1_info, 1, op_array, opline
+
+ if (may_throw) {
+ if (!zend_jit_check_exception(Dst)) {
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+static int zend_jit_free(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, uint32_t op1_info, int may_throw)
+{
+ zend_jit_addr op1_addr = OP1_ADDR();
+
+ if (op1_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF)) {
+ if (may_throw) {
+ | SAVE_VALID_OPLINE, opline
+ }
+ if (opline->opcode == ZEND_FE_FREE && (op1_info & (MAY_BE_OBJECT|MAY_BE_REF))) {
+ if (op1_info & MAY_BE_ARRAY) {
+ | IF_ZVAL_TYPE op1_addr, IS_ARRAY, >7
+ }
+ | mov FCARG1d, dword [FP + opline->op1.var + offsetof(zval, u2.fe_iter_idx)]
+ | cmp FCARG1d, -1
+ | je >7
+ | EXT_CALL zend_hash_iterator_del, r0
+ |7:
+ }
+ | ZVAL_PTR_DTOR op1_addr, op1_info, 0, 0, 0, opline
+ if (may_throw) {
+ if (!zend_jit_check_exception(Dst)) {
+ return 0;
+ }
+ }
+ }
+
+ return 1;
+}
+
+static int zend_jit_echo(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array)
+{
+ zval *zv;
+ size_t len;
+
+ ZEND_ASSERT(opline->op1_type == IS_CONST);
+ zv = RT_CONSTANT(opline, opline->op1);
+ ZEND_ASSERT(Z_TYPE_P(zv) == IS_STRING);
+ len = Z_STRLEN_P(zv);
+
+ if (len > 0) {
+ const char *str = Z_STRVAL_P(zv);
+
+ | SAVE_VALID_OPLINE opline
+ |.if X64
+ | LOAD_ADDR CARG1, str
+ | LOAD_ADDR CARG2, len
+ | EXT_CALL zend_write, r0
+ |.else
+ | sub r4, 8
+ | push len
+ | push str
+ | EXT_CALL zend_write, r0
+ | add r4, 16
+ |.endif
+ if (!zend_jit_check_exception(Dst)) {
+ return 0;
+ }
+ }
+ return 1;
+}
+
+static int zend_jit_switch(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, zend_ssa *ssa)
+{
+ HashTable *jumptable = Z_ARRVAL_P(RT_CONSTANT(opline, opline->op2));
+
+ if (sizeof(void*) == 8 && !IS_32BIT(dasm_end)) {
+ // TODO: DynASM stores .aword as 4-bytes even in 64-bit mode ???
+ return 1;
+ }
+ if (opline->op1_type == IS_CONST) {
+ zval *zv = RT_CONSTANT(opline, opline->op1);
+ zval *jump_zv;
+ int b;
+
+ if (opline->opcode == ZEND_SWITCH_LONG) {
+ if (Z_TYPE_P(zv) == IS_LONG) {
+ jump_zv = zend_hash_index_find(jumptable, Z_LVAL_P(zv));
+ if (jump_zv != NULL) {
+ b = ssa->cfg.map[ZEND_OFFSET_TO_OPLINE(opline, Z_LVAL_P(jump_zv)) - op_array->opcodes];
+ } else {
+ b = ssa->cfg.map[ZEND_OFFSET_TO_OPLINE(opline, opline->extended_value) - op_array->opcodes];
+ }
+ | jmp =>b
+ }
+ } else if (opline->opcode == ZEND_SWITCH_STRING) {
+ if (Z_TYPE_P(zv) == IS_STRING) {
+ jump_zv = zend_hash_find_ex(jumptable, Z_STR_P(zv), 1);
+ if (jump_zv != NULL) {
+ b = ssa->cfg.map[ZEND_OFFSET_TO_OPLINE(opline, Z_LVAL_P(jump_zv)) - op_array->opcodes];
+ } else {
+ b = ssa->cfg.map[ZEND_OFFSET_TO_OPLINE(opline, opline->extended_value) - op_array->opcodes];
+ }
+ | jmp =>b
+ }
+ } else {
+ ZEND_ASSERT(0);
+ }
+ } else {
+ uint32_t op1_info = OP1_INFO();
+ zend_jit_addr op1_addr = OP1_ADDR();
+ int b = ssa->cfg.map[ZEND_OFFSET_TO_OPLINE(opline, opline->extended_value) - op_array->opcodes];
+ zval *val;
+
+ if (opline->opcode == ZEND_SWITCH_LONG) {
+ if (op1_info & MAY_BE_LONG) {
+ if (op1_info & MAY_BE_REF) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_LONG, >1
+ | GET_ZVAL_LVAL ZREG_FCARG2a, op1_addr
+ |.cold_code
+ |1:
+ | // ZVAL_DEREF(op)
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_REFERENCE, >3
+ | GET_ZVAL_PTR FCARG2a, op1_addr
+ | IF_NOT_Z_TYPE FCARG2a + offsetof(zend_reference, val), IS_LONG, >3
+ | mov FCARG2a, aword [FCARG2a + offsetof(zend_reference, val.value.lval)]
+ | jmp >2
+ |.code
+ |2:
+ } else {
+ if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_LONG)) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_LONG, >3
+ }
+ | GET_ZVAL_LVAL ZREG_FCARG2a, op1_addr
+ }
+ if (HT_IS_PACKED(jumptable)) {
+ uint32_t count = jumptable->nNumUsed;
+ Bucket *p = jumptable->arData;
+
+ | cmp FCARG2a, jumptable->nNumUsed
+ | jae >3
+ |.if X64
+ | // TODO: DynASM stores .aword as 4-bytes even in 64-bit mode ???
+ | movsxd r0, dword [FCARG2a * 4 + >4]
+ | jmp r0
+ |.else
+ | jmp aword [FCARG2a * 4 + >4]
+ |.endif
+ |3:
+ |.cold_code
+ |4:
+ p = jumptable->arData;
+ do {
+ if (Z_TYPE(p->val) == IS_UNDEF) {
+ | // TODO: DynASM stores .aword as 4-bytes even in 64-bit mode ???
+ | .aword =>b
+ } else {
+ int b = ssa->cfg.map[ZEND_OFFSET_TO_OPLINE(opline, Z_LVAL(p->val)) - op_array->opcodes];
+ | // TODO: DynASM stores .aword as 4-bytes even in 64-bit mode ???
+ | .aword =>b
+ }
+ p++;
+ count--;
+ } while (count);
+ |.code
+ } else {
+ | LOAD_ADDR FCARG1a, jumptable
+ | EXT_CALL zend_hash_index_find, r0
+ | test r0, r0
+ | jz =>b
+ | LOAD_ADDR FCARG1a, jumptable
+ | sub r0, aword [FCARG1a + offsetof(HashTable, arData)]
+ | // TODO: DynASM stores .aword as 4-bytes even in 64-bit mode ???
+ | mov FCARG1a, (sizeof(Bucket) / sizeof(uint32_t))
+ |.if X64
+ | cqo
+ |.else
+ | cdq
+ |.endif
+ | idiv FCARG1a
+ |.if X64
+ | // TODO: DynASM stores .aword as 4-bytes even in 64-bit mode ???
+ | movsxd r0, dword [r0 + >4]
+ | jmp r0
+ |.else
+ | jmp dword [r0 + >4]
+ |.endif
+ |3:
+ |.cold_code
+ |4:
+ ZEND_HASH_FOREACH_VAL(jumptable, val) {
+ b = ssa->cfg.map[ZEND_OFFSET_TO_OPLINE(opline, Z_LVAL_P(val)) - op_array->opcodes];
+ | // TODO: DynASM stores .aword as 4-bytes even in 64-bit mode ???
+ | .aword =>b
+ } ZEND_HASH_FOREACH_END();
+ |.code
+ }
+ }
+ } else if (opline->opcode == ZEND_SWITCH_STRING) {
+ if (op1_info & MAY_BE_STRING) {
+ if (op1_info & MAY_BE_REF) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_STRING, >1
+ | GET_ZVAL_PTR FCARG2a, op1_addr
+ |.cold_code
+ |1:
+ | // ZVAL_DEREF(op)
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_REFERENCE, >3
+ | GET_ZVAL_PTR FCARG2a, op1_addr
+ | IF_NOT_Z_TYPE FCARG2a + offsetof(zend_reference, val), IS_STRING, >3
+ | mov FCARG2a, aword [FCARG2a + offsetof(zend_reference, val.value.ptr)]
+ | jmp >2
+ |.code
+ |2:
+ } else {
+ if (op1_info & ((MAY_BE_ANY|MAY_BE_UNDEF)-MAY_BE_STRING)) {
+ | IF_NOT_ZVAL_TYPE op1_addr, IS_STRING, >3
+ }
+ | GET_ZVAL_PTR FCARG2a, op1_addr
+ }
+ | LOAD_ADDR FCARG1a, jumptable
+ | EXT_CALL zend_hash_find, r0
+ | test r0, r0
+ | jz =>b
+ | LOAD_ADDR FCARG1a, jumptable
+ | sub r0, aword [FCARG1a + offsetof(HashTable, arData)]
+ | // TODO: DynASM stores .aword as 4-bytes even in 64-bit mode ???
+ | mov FCARG1a, (sizeof(Bucket) / sizeof(uint32_t))
+ |.if X64
+ | cqo
+ |.else
+ | cdq
+ |.endif
+ | idiv FCARG1a
+ |.if X64
+ | // TODO: DynASM stores .aword as 4-bytes even in 64-bit mode ???
+ | movsxd r0, dword [r0 + >4]
+ | jmp r0
+ |.else
+ | jmp dword [r0 + >4]
+ |.endif
+ |3:
+ |.cold_code
+ |4:
+ ZEND_HASH_FOREACH_VAL(jumptable, val) {
+ b = ssa->cfg.map[ZEND_OFFSET_TO_OPLINE(opline, Z_LVAL_P(val)) - op_array->opcodes];
+ | // TODO: DynASM stores .aword as 4-bytes even in 64-bit mode ???
+ |.if X64
+ | .aword =>b
+ |.else
+ | .aword =>b
+ |.endif
+ } ZEND_HASH_FOREACH_END();
+ |.code
+ }
+ } else {
+ ZEND_ASSERT(0);
+ }
+ }
+ return 1;
+}
+
+static zend_bool zend_jit_verify_return_type(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, uint32_t op1_info)
+{
+ zend_arg_info *arg_info = &op_array->arg_info[-1];
+ ZEND_ASSERT(ZEND_TYPE_IS_SET(arg_info->type));
+ zend_jit_addr op1_addr = OP1_ADDR();
+
+ | LOAD_ZVAL_ADDR r0, op1_addr
+
+ uint32_t type_mask = ZEND_TYPE_PURE_MASK(arg_info->type);
+ if (type_mask == 0) {
+ | jmp >8
+ } else if (is_power_of_two(type_mask)) {
+ uint32_t type_code = concrete_type(type_mask);
+ | cmp byte [r0 + 8], type_code
+ | jne >8
+ } else {
+ | mov edx, 1
+ | mov cl, byte [r0 + 8]
+ | shl edx, cl
+ | test edx, type_mask
+ | je >8
+ }
+ |.cold_code
+ |8:
+ | mov FCARG1a, r0
+ | mov r0, EX->run_time_cache
+ | add r0, opline->op2.num
+ | mov FCARG2a, EX->func
+ |.if X64
+ | LOAD_ADDR CARG3, (ptrdiff_t)arg_info
+ | mov CARG4, r0
+ | SAVE_VALID_OPLINE opline
+ | EXT_CALL zend_jit_verify_return_slow, r0
+ |.else
+ | sub r4, 8
+ | push r0
+ | push (ptrdiff_t)arg_info
+ | SAVE_VALID_OPLINE opline
+ | EXT_CALL zend_jit_verify_return_slow, r0
+ | add r4, 8
+ |.endif
+ if (!zend_jit_check_exception(Dst)) {
+ return 0;
+ }
+ | jmp >9
+ |.code
+ |9:
+ return 1;
+}
+
+static zend_bool zend_jit_may_reuse_reg(const zend_op_array *op_array, zend_ssa *ssa, uint32_t position, int def_var, int use_var)
+{
+ if (ssa->var_info[def_var].type != ssa->var_info[use_var].type) {
+ return 0;
+ }
+
+ switch (op_array->opcodes[position].opcode) {
+ case ZEND_QM_ASSIGN:
+ case ZEND_SEND_VAR:
+ case ZEND_ASSIGN:
+ case ZEND_PRE_INC:
+ case ZEND_PRE_DEC:
+ case ZEND_POST_INC:
+ case ZEND_POST_DEC:
+ return 1;
+ case ZEND_ADD:
+ case ZEND_SUB:
+ case ZEND_MUL:
+ case ZEND_BW_OR:
+ case ZEND_BW_AND:
+ case ZEND_BW_XOR:
+ if (def_var == ssa->ops[position].result_def &&
+ use_var == ssa->ops[position].op1_use) {
+ return 1;
+ }
+ break;
+ default:
+ break;
+ }
+ return 0;
+}
+
+static zend_bool zend_jit_opline_supports_reg(const zend_op_array *op_array, zend_ssa *ssa, zend_op *opline, int var)
+{
+ uint32_t op1_info, op2_info;
+
+ switch (opline->opcode) {
+ case ZEND_QM_ASSIGN:
+ case ZEND_SEND_VAR:
+ case ZEND_SEND_VAL:
+ case ZEND_SEND_VAL_EX:
+ case ZEND_IS_SMALLER:
+ case ZEND_IS_SMALLER_OR_EQUAL:
+ case ZEND_IS_EQUAL:
+ case ZEND_IS_NOT_EQUAL:
+ case ZEND_IS_IDENTICAL:
+ case ZEND_IS_NOT_IDENTICAL:
+ case ZEND_CASE:
+ case ZEND_RETURN:
+ return 1;
+ case ZEND_ASSIGN:
+ op1_info = OP1_INFO();
+ op2_info = OP2_INFO();
+ return
+ opline->op1_type == IS_CV &&
+ !(op1_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_RESOURCE|MAY_BE_REF)) &&
+ !(op2_info & ((MAY_BE_ANY|MAY_BE_REF|MAY_BE_UNDEF)-(MAY_BE_LONG|MAY_BE_DOUBLE)));
+ case ZEND_ADD:
+ case ZEND_SUB:
+ case ZEND_MUL:
+ op1_info = OP1_INFO();
+ op2_info = OP2_INFO();
+ if ((op1_info | op2_info) & MAY_BE_UNDEF) {
+ return 0;
+ }
+ return (op1_info & op2_info & (MAY_BE_LONG|MAY_BE_DOUBLE)) != 0;
+ case ZEND_BW_OR:
+ case ZEND_BW_AND:
+ case ZEND_BW_XOR:
+ case ZEND_SL:
+ case ZEND_SR:
+ case ZEND_MOD:
+ op1_info = OP1_INFO();
+ op2_info = OP2_INFO();
+ if ((op1_info | op2_info) & MAY_BE_UNDEF) {
+ return 0;
+ }
+ return (op1_info & op2_info & MAY_BE_LONG) != 0;
+ case ZEND_PRE_INC:
+ case ZEND_PRE_DEC:
+ case ZEND_POST_INC:
+ case ZEND_POST_DEC:
+ op1_info = OP1_INFO();
+ return
+ opline->op1_type == IS_CV &&
+ (op1_info & MAY_BE_LONG);
+ case ZEND_BOOL:
+ case ZEND_BOOL_NOT:
+ case ZEND_JMPZ:
+ case ZEND_JMPNZ:
+ case ZEND_JMPZNZ:
+ case ZEND_JMPZ_EX:
+ case ZEND_JMPNZ_EX:
+ return 1;
+ }
+ return 0;
+}
+
+static zend_bool zend_jit_may_be_in_reg(const zend_op_array *op_array, zend_ssa *ssa, int var)
+{
+ if (ssa->vars[var].no_val) {
+ /* we don't need the value */
+ return 0;
+ }
+
+ if (zend_jit_reg_alloc < ZEND_JIT_REG_ALLOC_GLOBAL) {
+ /* Disable global register allocation,
+ * register allocation forSAA variables connected through Phi functions
+ */
+ if (ssa->vars[var].definition_phi) {
+ return 0;
+ }
+ if (ssa->vars[var].phi_use_chain) {
+ zend_ssa_phi *phi = ssa->vars[var].phi_use_chain;
+ do {
+ if (!ssa->vars[phi->ssa_var].no_val) {
+ return 0;
+ }
+ phi = zend_ssa_next_use_phi(ssa, var, phi);
+ } while (phi);
+ }
+ }
+
+ if (((ssa->var_info[var].type & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_REF)) != MAY_BE_DOUBLE) &&
+ ((ssa->var_info[var].type & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_REF)) != MAY_BE_LONG)) {
+ /* bad type */
+ return 0;
+ }
+
+ if (ssa->vars[var].definition >= 0) {
+ if (!zend_jit_opline_supports_reg(op_array, ssa, op_array->opcodes + ssa->vars[var].definition, var)) {
+ return 0;
+ }
+ }
+
+ if (ssa->vars[var].use_chain >= 0) {
+ int use = ssa->vars[var].use_chain;
+
+ do {
+ if (!zend_ssa_is_no_val_use(op_array->opcodes + use, ssa->ops + use, var) &&
+ !zend_jit_opline_supports_reg(op_array, ssa, op_array->opcodes + use, var)) {
+ return 0;
+ }
+ use = zend_ssa_next_use(ssa->ops, var, use);
+ } while (use >= 0);
+ }
+
+ return 1;
+}
+
+static zend_bool zend_needs_extra_reg_for_const(const zend_op_array *op_array, const zend_op *opline, zend_uchar op_type, znode_op op)
+{
+|.if X64
+|| if (op_type == IS_CONST) {
+|| zval *zv = RT_CONSTANT(opline, op);
+|| if (Z_TYPE_P(zv) == IS_DOUBLE && Z_DVAL_P(zv) != 0 && !IS_32BIT(zv)) {
+|| return 1;
+|| }
+|| }
+|.endif
+ return 0;
+}
+
+static zend_regset zend_jit_get_scratch_regset(const zend_op_array *op_array, zend_ssa *ssa, uint32_t line, int current_var)
+{
+ const zend_op *opline = op_array->opcodes + line;
+ uint32_t op1_info, op2_info, res_info;
+ zend_regset regset = ZEND_REGSET_SCRATCH;
+
+ switch (opline->opcode) {
+ case ZEND_NOP:
+ case ZEND_OP_DATA:
+ case ZEND_JMP:
+ case ZEND_RETURN:
+ regset = ZEND_REGSET_EMPTY;
+ break;
+ case ZEND_QM_ASSIGN:
+ if (ssa->ops[line].op1_def == current_var ||
+ ssa->ops[line].result_def == current_var) {
+ regset = ZEND_REGSET_EMPTY;
+ break;
+ }
+ /* break missing intentionally */
+ case ZEND_SEND_VAL:
+ case ZEND_SEND_VAL_EX:
+ if (ssa->ops[line].op1_use == current_var) {
+ regset = ZEND_REGSET(ZREG_R0);
+ break;
+ }
+ op1_info = OP1_INFO();
+ if (!(op1_info & MAY_BE_UNDEF)) {
+ if ((op1_info & (MAY_BE_ANY|MAY_BE_REF)) == MAY_BE_DOUBLE) {
+ regset = ZEND_REGSET(ZREG_XMM0);
+ } else if ((op1_info & (MAY_BE_ANY|MAY_BE_REF)) == MAY_BE_LONG) {
+ regset = ZEND_REGSET(ZREG_R0);
+ } else {
+ regset = ZEND_REGSET_UNION(ZEND_REGSET(ZREG_R0), ZEND_REGSET(ZREG_R2));
+ }
+ }
+ break;
+ case ZEND_SEND_VAR:
+ if (ssa->ops[line].op1_use == current_var ||
+ ssa->ops[line].op1_def == current_var) {
+ regset = ZEND_REGSET_EMPTY;
+ break;
+ }
+ op1_info = OP1_INFO();
+ if (!(op1_info & MAY_BE_UNDEF)) {
+ if ((op1_info & (MAY_BE_ANY|MAY_BE_REF)) == MAY_BE_DOUBLE) {
+ regset = ZEND_REGSET(ZREG_XMM0);
+ } else if ((op1_info & (MAY_BE_ANY|MAY_BE_REF)) == MAY_BE_LONG) {
+ } else {
+ regset = ZEND_REGSET_UNION(ZEND_REGSET(ZREG_R0), ZEND_REGSET(ZREG_R2));
+ if (op1_info & MAY_BE_REF) {
+ ZEND_REGSET_INCL(regset, ZREG_R1);
+ }
+ }
+ }
+ break;
+ case ZEND_ASSIGN:
+ if (ssa->ops[line].op2_use == current_var ||
+ ssa->ops[line].op2_def == current_var ||
+ ssa->ops[line].op1_def == current_var ||
+ ssa->ops[line].result_def == current_var) {
+ regset = ZEND_REGSET_EMPTY;
+ break;
+ }
+ op1_info = OP1_INFO();
+ op2_info = OP2_INFO();
+ if (opline->op1_type == IS_CV
+ && !(op2_info & MAY_BE_UNDEF)
+ && !(op1_info & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_RESOURCE|MAY_BE_REF))) {
+ if ((op2_info & (MAY_BE_ANY|MAY_BE_REF)) == MAY_BE_DOUBLE) {
+ regset = ZEND_REGSET(ZREG_XMM0);
+ } else if ((op2_info & (MAY_BE_ANY|MAY_BE_REF)) == MAY_BE_LONG) {
+ regset = ZEND_REGSET(ZREG_R0);
+ } else {
+ regset = ZEND_REGSET_UNION(ZEND_REGSET(ZREG_R0), ZEND_REGSET(ZREG_R2));
+ }
+ }
+ break;
+ case ZEND_PRE_INC:
+ case ZEND_PRE_DEC:
+ case ZEND_POST_INC:
+ case ZEND_POST_DEC:
+ if (ssa->ops[line].op1_use == current_var ||
+ ssa->ops[line].op1_def == current_var ||
+ ssa->ops[line].result_def == current_var) {
+ regset = ZEND_REGSET_EMPTY;
+ break;
+ }
+ op1_info = OP1_INFO();
+ if (opline->op1_type == IS_CV
+ && (op1_info & MAY_BE_LONG)
+ && !(op1_info & ((MAY_BE_ANY|MAY_BE_REF|MAY_BE_UNDEF)-(MAY_BE_LONG|MAY_BE_DOUBLE)))) {
+ regset = ZEND_REGSET_EMPTY;
+ if (op1_info & MAY_BE_DOUBLE) {
+ regset = ZEND_REGSET(ZREG_XMM0);
+ }
+ }
+ break;
+ case ZEND_ADD:
+ case ZEND_SUB:
+ case ZEND_MUL:
+ op1_info = OP1_INFO();
+ op2_info = OP2_INFO();
+ if (!(op1_info & ((MAY_BE_ANY|MAY_BE_REF|MAY_BE_UNDEF)-(MAY_BE_LONG|MAY_BE_DOUBLE))) &&
+ !(op2_info & ((MAY_BE_ANY|MAY_BE_REF|MAY_BE_UNDEF)-(MAY_BE_LONG|MAY_BE_DOUBLE)))) {
+
+ regset = ZEND_REGSET_EMPTY;
+ if ((op1_info & MAY_BE_LONG) && (op2_info & MAY_BE_LONG)) {
+ if (ssa->ops[line].result_def != current_var &&
+ (ssa->ops[line].op1_use != current_var || !zend_ssa_is_last_use(op_array, ssa, current_var, opline-op_array->opcodes))) {
+ ZEND_REGSET_INCL(regset, ZREG_R0);
+ }
+ res_info = OP1_INFO();
+ if (res_info & MAY_BE_DOUBLE) {
+ ZEND_REGSET_INCL(regset, ZREG_XMM0);
+ ZEND_REGSET_INCL(regset, ZREG_XMM1);
+ }
+ }
+ if ((op1_info & MAY_BE_LONG) && (op2_info & MAY_BE_DOUBLE)) {
+ if (ssa->ops[line].result_def != current_var) {
+ ZEND_REGSET_INCL(regset, ZREG_XMM0);
+ }
+ }
+ if ((op1_info & MAY_BE_DOUBLE) && (op2_info & MAY_BE_LONG)) {
+ if (zend_is_commutative(opline->opcode)) {
+ if (ssa->ops[line].result_def != current_var) {
+ ZEND_REGSET_INCL(regset, ZREG_XMM0);
+ }
+ } else {
+ ZEND_REGSET_INCL(regset, ZREG_XMM0);
+ if (ssa->ops[line].result_def != current_var &&
+ (ssa->ops[line].op1_use != current_var || !zend_ssa_is_last_use(op_array, ssa, current_var, opline-op_array->opcodes))) {
+ ZEND_REGSET_INCL(regset, ZREG_XMM1);
+ }
+ }
+ }
+ if ((op1_info & MAY_BE_DOUBLE) && (op2_info & MAY_BE_DOUBLE)) {
+ if (ssa->ops[line].result_def != current_var &&
+ (ssa->ops[line].op1_use != current_var || !zend_ssa_is_last_use(op_array, ssa, current_var, opline-op_array->opcodes))) {
+ ZEND_REGSET_INCL(regset, ZREG_XMM0);
+ }
+ }
+ if (zend_needs_extra_reg_for_const(op_array, opline, opline->op1_type, opline->op1) ||
+ zend_needs_extra_reg_for_const(op_array, opline, opline->op1_type, opline->op2)) {
+ ZEND_REGSET_INCL(regset, ZREG_R0);
+ }
+ }
+ break;
+ case ZEND_BW_OR:
+ case ZEND_BW_AND:
+ case ZEND_BW_XOR:
+ op1_info = OP1_INFO();
+ op2_info = OP2_INFO();
+ if (!(op1_info & ((MAY_BE_ANY|MAY_BE_REF|MAY_BE_UNDEF)-MAY_BE_LONG)) &&
+ !(op2_info & ((MAY_BE_ANY|MAY_BE_REF|MAY_BE_UNDEF)-MAY_BE_LONG))) {
+ regset = ZEND_REGSET_EMPTY;
+ if (ssa->ops[line].result_def != current_var &&
+ (ssa->ops[line].op1_use != current_var || !zend_ssa_is_last_use(op_array, ssa, current_var, opline-op_array->opcodes))) {
+ ZEND_REGSET_INCL(regset, ZREG_R0);
+ }
+ }
+ break;
+ case ZEND_SL:
+ case ZEND_SR:
+ op1_info = OP1_INFO();
+ op2_info = OP2_INFO();
+ if (!(op1_info & ((MAY_BE_ANY|MAY_BE_REF|MAY_BE_UNDEF)-MAY_BE_LONG)) &&
+ !(op2_info & ((MAY_BE_ANY|MAY_BE_REF|MAY_BE_UNDEF)-MAY_BE_LONG))) {
+ regset = ZEND_REGSET_EMPTY;
+ if (ssa->ops[line].result_def != current_var &&
+ (ssa->ops[line].op1_use != current_var || !zend_ssa_is_last_use(op_array, ssa, current_var, opline-op_array->opcodes))) {
+ ZEND_REGSET_INCL(regset, ZREG_R0);
+ }
+ if (opline->op2_type != IS_CONST && ssa->ops[line].op2_use != current_var) {
+ ZEND_REGSET_INCL(regset, ZREG_R1);
+ }
+ }
+ break;
+ case ZEND_MOD:
+ op1_info = OP1_INFO();
+ op2_info = OP2_INFO();
+ if (!(op1_info & ((MAY_BE_ANY|MAY_BE_REF|MAY_BE_UNDEF)-MAY_BE_LONG)) &&
+ !(op2_info & ((MAY_BE_ANY|MAY_BE_REF|MAY_BE_UNDEF)-MAY_BE_LONG))) {
+ regset = ZEND_REGSET_EMPTY;
+ if (opline->op2_type == IS_CONST &&
+ Z_TYPE_P(RT_CONSTANT(opline, opline->op2)) == IS_LONG &&
+ zend_long_is_power_of_two(Z_LVAL_P(RT_CONSTANT(opline, opline->op2)))) {
+ if (ssa->ops[line].result_def != current_var &&
+ (ssa->ops[line].op1_use != current_var || !zend_ssa_is_last_use(op_array, ssa, current_var, opline-op_array->opcodes))) {
+ ZEND_REGSET_INCL(regset, ZREG_R0);
+ }
+ } else {
+ ZEND_REGSET_INCL(regset, ZREG_R0);
+ ZEND_REGSET_INCL(regset, ZREG_R1);
+ }
+ }
+ break;
+ case ZEND_IS_SMALLER:
+ case ZEND_IS_SMALLER_OR_EQUAL:
+ case ZEND_IS_EQUAL:
+ case ZEND_IS_NOT_EQUAL:
+ case ZEND_IS_IDENTICAL:
+ case ZEND_IS_NOT_IDENTICAL:
+ case ZEND_CASE:
+ op1_info = OP1_INFO();
+ op2_info = OP2_INFO();
+ if (!(op1_info & ((MAY_BE_ANY|MAY_BE_REF|MAY_BE_UNDEF)-(MAY_BE_LONG|MAY_BE_DOUBLE))) &&
+ !(op2_info & ((MAY_BE_ANY|MAY_BE_REF|MAY_BE_UNDEF)-(MAY_BE_LONG|MAY_BE_DOUBLE)))) {
+ regset = ZEND_REGSET_EMPTY;
+ if ((op1_info & MAY_BE_LONG) && (op2_info & MAY_BE_LONG) &&
+ opline->op1_type != IS_CONST && opline->op2_type != IS_CONST) {
+ if (ssa->ops[line].op1_use != current_var &&
+ ssa->ops[line].op2_use != current_var) {
+ ZEND_REGSET_INCL(regset, ZREG_R0);
+ }
+ }
+ if ((op1_info & MAY_BE_LONG) && (op2_info & MAY_BE_DOUBLE)) {
+ ZEND_REGSET_INCL(regset, ZREG_XMM0);
+ }
+ if ((op1_info & MAY_BE_DOUBLE) && (op2_info & MAY_BE_LONG)) {
+ ZEND_REGSET_INCL(regset, ZREG_XMM0);
+ }
+ if ((op1_info & MAY_BE_DOUBLE) && (op2_info & MAY_BE_DOUBLE)) {
+ if (ssa->ops[line].op1_use != current_var &&
+ ssa->ops[line].op2_use != current_var) {
+ ZEND_REGSET_INCL(regset, ZREG_XMM0);
+ }
+ }
+ if (zend_needs_extra_reg_for_const(op_array, opline, opline->op1_type, opline->op1) ||
+ zend_needs_extra_reg_for_const(op_array, opline, opline->op1_type, opline->op2)) {
+ ZEND_REGSET_INCL(regset, ZREG_R0);
+ }
+ }
+ break;
+ case ZEND_BOOL:
+ case ZEND_BOOL_NOT:
+ case ZEND_JMPZ:
+ case ZEND_JMPNZ:
+ case ZEND_JMPZNZ:
+ case ZEND_JMPZ_EX:
+ case ZEND_JMPNZ_EX:
+ op1_info = OP1_INFO();
+ if (!(op1_info & ((MAY_BE_ANY|MAY_BE_REF|MAY_BE_UNDEF)-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE)))) {
+ regset = ZEND_REGSET_EMPTY;
+ if (op1_info & MAY_BE_DOUBLE) {
+ ZEND_REGSET_INCL(regset, ZREG_XMM0);
+ }
+ if (opline->opcode == ZEND_BOOL ||
+ opline->opcode == ZEND_BOOL_NOT ||
+ opline->opcode == ZEND_JMPZ_EX ||
+ opline->opcode == ZEND_JMPNZ_EX) {
+ ZEND_REGSET_INCL(regset, ZREG_R0);
+ }
+ }
+ break;
+ case ZEND_DO_UCALL:
+ case ZEND_DO_FCALL:
+ case ZEND_DO_FCALL_BY_NAME:
+ case ZEND_INCLUDE_OR_EVAL:
+ case ZEND_GENERATOR_CREATE:
+ case ZEND_YIELD:
+ case ZEND_YIELD_FROM:
+ regset = ZEND_REGSET_UNION(ZEND_REGSET_GP, ZEND_REGSET_FP);
+ break;
+ default:
+ break;
+ }
+
+#if ZTS
+ /* %r0 is used to check EG(vm_interrupt) */
+ {
+ uint32_t b = ssa->cfg.map[line];
+
+ if ((ssa->cfg.blocks[b].flags & ZEND_BB_LOOP_HEADER) != 0
+ && ssa->cfg.blocks[b].start == line) {
+ ZEND_REGSET_INCL(regset, ZREG_R0);
+ }
+ }
+#endif
+
+ return regset;
+}
+
+#if defined(__clang__)
+# pragma clang diagnostic pop
+#endif
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * indent-tabs-mode: t
+ * End:
+ */
diff --git a/ext/opcache/jit/zend_jit_x86.h b/ext/opcache/jit/zend_jit_x86.h
new file mode 100644
index 0000000000..b3806036f6
--- /dev/null
+++ b/ext/opcache/jit/zend_jit_x86.h
@@ -0,0 +1,309 @@
+/*
+ +----------------------------------------------------------------------+
+ | Zend JIT |
+ +----------------------------------------------------------------------+
+ | Copyright (c) The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Dmitry Stogov <dmitry@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+#ifndef HAVE_JIT_X86_H
+#define HAVE_JIT_X86_H
+
+typedef enum _zend_reg {
+ ZREG_NONE = -1,
+
+ ZREG_R0,
+ ZREG_R1,
+ ZREG_R2,
+ ZREG_R3,
+ ZREG_R4,
+ ZREG_R5,
+ ZREG_R6,
+ ZREG_R7,
+
+#if defined(__x86_64__) || defined(_WIN64)
+ ZREG_R8,
+ ZREG_R9,
+ ZREG_R10,
+ ZREG_R11,
+ ZREG_R12,
+ ZREG_R13,
+ ZREG_R14,
+ ZREG_R15,
+#endif
+
+ ZREG_XMM0,
+ ZREG_XMM1,
+ ZREG_XMM2,
+ ZREG_XMM3,
+ ZREG_XMM4,
+ ZREG_XMM5,
+ ZREG_XMM6,
+ ZREG_XMM7,
+
+#if defined(__x86_64__) || defined(_WIN64)
+ ZREG_XMM8,
+ ZREG_XMM9,
+ ZREG_XMM10,
+ ZREG_XMM11,
+ ZREG_XMM12,
+ ZREG_XMM13,
+ ZREG_XMM14,
+ ZREG_XMM15,
+#endif
+
+ ZREG_NUM
+} zend_reg;
+
+#define ZREG_RAX ZREG_R0
+#define ZREG_RCX ZREG_R1
+#define ZREG_RDX ZREG_R2
+#define ZREG_RBX ZREG_R3
+#define ZREG_RSP ZREG_R4
+#define ZREG_RBP ZREG_R5
+#define ZREG_RSI ZREG_R6
+#define ZREG_RDI ZREG_R7
+
+#ifdef _WIN64
+# define ZREG_FP ZREG_R14
+# define ZREG_IP ZREG_R15
+# define ZREG_RX ZREG_IP
+# define ZREG_FCARG1a ZREG_RCX
+# define ZREG_FCARG2a ZREG_RDX
+#elif defined(__x86_64__)
+# define ZREG_FP ZREG_R14
+# define ZREG_IP ZREG_R15
+# define ZREG_RX ZREG_IP
+# define ZREG_FCARG1a ZREG_RDI
+# define ZREG_FCARG2a ZREG_RSI
+#else
+# define ZREG_FP ZREG_RSI
+# define ZREG_IP ZREG_RDI
+# define ZREG_RX ZREG_IP
+# define ZREG_FCARG1a ZREG_RCX
+# define ZREG_FCARG2a ZREG_RDX
+#endif
+
+extern const char *zend_reg_name[];
+
+typedef uint32_t zend_regset;
+
+#define ZEND_REGSET_EMPTY 0
+
+#define ZEND_REGSET_IS_EMPTY(regset) \
+ (regset == ZEND_REGSET_EMPTY)
+
+#define ZEND_REGSET(reg) \
+ (1u << (reg))
+
+#define ZEND_REGSET_INTERVAL(reg1, reg2) \
+ (((1u << ((reg2) - (reg1) + 1)) - 1) << (reg1))
+
+#define ZEND_REGSET_IN(regset, reg) \
+ (((regset) & ZEND_REGSET(reg)) != 0)
+
+#define ZEND_REGSET_INCL(regset, reg) \
+ (regset) |= ZEND_REGSET(reg)
+
+#define ZEND_REGSET_EXCL(regset, reg) \
+ (regset) &= ~ZEND_REGSET(reg)
+
+#define ZEND_REGSET_UNION(set1, set2) \
+ ((set1) | (set2))
+
+#define ZEND_REGSET_INTERSECTION(set1, set2) \
+ ((set1) & (set2))
+
+#define ZEND_REGSET_DIFFERENCE(set1, set2) \
+ ((set1) & ~(set2))
+
+#ifdef _WIN64
+# define ZEND_REGSET_FIXED \
+ (ZEND_REGSET(ZREG_RSP) | ZEND_REGSET(ZREG_R14) | ZEND_REGSET(ZREG_R15))
+# define ZEND_REGSET_GP \
+ ZEND_REGSET_DIFFERENCE(ZEND_REGSET_INTERVAL(ZREG_R0, ZREG_R15), ZEND_REGSET_FIXED)
+# define ZEND_REGSET_FP \
+ ZEND_REGSET_DIFFERENCE(ZEND_REGSET_INTERVAL(ZREG_XMM0, ZREG_XMM15), ZEND_REGSET_FIXED)
+# define ZEND_REGSET_SCRATCH \
+ (ZEND_REGSET(ZREG_RAX) | ZEND_REGSET(ZREG_RDX) | ZEND_REGSET(ZREG_RCX) | ZEND_REGSET_INTERVAL(ZREG_R8, ZREG_R11) | ZEND_REGSET_FP)
+# define ZEND_REGSET_PRESERVED \
+ (ZEND_REGSET(ZREG_RBX) | ZEND_REGSET(ZREG_RBP) | ZEND_REGSET(ZREG_R12) | ZEND_REGSET(ZREG_R13) | ZEND_REGSET(ZREG_RDI) | ZEND_REGSET(ZREG_RSI))
+#elif defined(__x86_64__)
+# define ZEND_REGSET_FIXED \
+ (ZEND_REGSET(ZREG_RSP) | ZEND_REGSET(ZREG_R14) | ZEND_REGSET(ZREG_R15))
+# define ZEND_REGSET_GP \
+ ZEND_REGSET_DIFFERENCE(ZEND_REGSET_INTERVAL(ZREG_R0, ZREG_R15), ZEND_REGSET_FIXED)
+# define ZEND_REGSET_FP \
+ ZEND_REGSET_DIFFERENCE(ZEND_REGSET_INTERVAL(ZREG_XMM0, ZREG_XMM15), ZEND_REGSET_FIXED)
+# define ZEND_REGSET_SCRATCH \
+ (ZEND_REGSET(ZREG_RAX) | ZEND_REGSET(ZREG_RDI) | ZEND_REGSET(ZREG_RSI) | ZEND_REGSET(ZREG_RDX) | ZEND_REGSET(ZREG_RCX) | ZEND_REGSET_INTERVAL(ZREG_R8, ZREG_R11) | ZEND_REGSET_FP)
+# define ZEND_REGSET_PRESERVED \
+ (ZEND_REGSET(ZREG_RBX) | ZEND_REGSET(ZREG_RBP) | ZEND_REGSET(ZREG_R12) | ZEND_REGSET(ZREG_R13))
+#else
+# define ZEND_REGSET_FIXED \
+ (ZEND_REGSET(ZREG_RSP) | ZEND_REGSET(ZREG_RSI) | ZEND_REGSET(ZREG_RDI))
+# define ZEND_REGSET_GP \
+ ZEND_REGSET_DIFFERENCE(ZEND_REGSET_INTERVAL(ZREG_R0, ZREG_R7), ZEND_REGSET_FIXED)
+# define ZEND_REGSET_FP \
+ ZEND_REGSET_DIFFERENCE(ZEND_REGSET_INTERVAL(ZREG_XMM0, ZREG_XMM7), ZEND_REGSET_FIXED)
+# define ZEND_REGSET_SCRATCH \
+ (ZEND_REGSET(ZREG_RAX) | ZEND_REGSET(ZREG_RCX) | ZEND_REGSET(ZREG_RDX) | ZEND_REGSET_FP)
+# define ZEND_REGSET_PRESERVED \
+ (ZEND_REGSET(ZREG_RBX) | ZEND_REGSET(ZREG_RBP))
+#endif
+
+#ifndef _WIN32
+#define ZEND_REGSET_FIRST(set) ((zend_reg)__builtin_ctz(set))
+#define ZEND_REGSET_LAST(set) ((zend_reg)(__builtin_clz(set)^31)))
+#else
+#include <intrin.h>
+uint32_t __inline __zend_jit_ctz( uint32_t value ) {
+ DWORD trailing_zero = 0;
+ if (_BitScanForward(&trailing_zero, value)) {
+ return trailing_zero;
+ }
+ return 32;
+}
+uint32_t __inline __zend_jit_clz(uint32_t value) {
+ DWORD leading_zero = 0;
+ if (_BitScanReverse(&leading_zero, value)) {
+ return 31 - leading_zero;
+ }
+ return 32;
+}
+#define ZEND_REGSET_FIRST(set) ((zend_reg)__zend_jit_ctz(set))
+#define ZEND_REGSET_LAST(set) ((zend_reg)(__zend_jit_clz(set)^31)))
+#endif
+
+#define ZEND_REGSET_FOREACH(set, reg) \
+ do { \
+ zend_regset _tmp = (set); \
+ while (!ZEND_REGSET_IS_EMPTY(_tmp)) { \
+ zend_reg _reg = ZEND_REGSET_FIRST(_tmp); \
+ ZEND_REGSET_EXCL(_tmp, _reg); \
+ reg = _reg; \
+
+#define ZEND_REGSET_FOREACH_END() \
+ } \
+ } while (0)
+
+typedef uintptr_t zend_jit_addr;
+
+#define IS_CONST_ZVAL 0
+#define IS_MEM_ZVAL 1
+#define IS_REG 2
+
+#define _ZEND_ADDR_MODE_MASK 0x3
+#define _ZEND_ADDR_REG_SHIFT 2
+#define _ZEND_ADDR_REG_MASK 0x3f
+#define _ZEND_ADDR_OFFSET_SHIFT 8
+#define _ZEND_ADDR_REG_STORE_BIT 8
+#define _ZEND_ADDR_REG_LOAD_BIT 9
+#define _ZEND_ADDR_REG_LAST_USE_BIT 10
+
+#define ZEND_ADDR_CONST_ZVAL(zv) \
+ (((zend_jit_addr)(uintptr_t)(zv)) | IS_CONST_ZVAL)
+#define ZEND_ADDR_MEM_ZVAL(reg, offset) \
+ ((((zend_jit_addr)(uintptr_t)(offset)) << _ZEND_ADDR_OFFSET_SHIFT) | \
+ (((zend_jit_addr)(uintptr_t)(reg)) << _ZEND_ADDR_REG_SHIFT) | \
+ IS_MEM_ZVAL)
+#define ZEND_ADDR_REG(reg) \
+ ((((zend_jit_addr)(uintptr_t)(reg)) << _ZEND_ADDR_REG_SHIFT) | \
+ IS_REG)
+
+#define Z_MODE(addr) (((addr) & _ZEND_ADDR_MODE_MASK))
+#define Z_ZV(addr) ((zval*)(addr))
+#define Z_OFFSET(addr) ((uint32_t)((addr)>>_ZEND_ADDR_OFFSET_SHIFT))
+#define Z_REG(addr) ((zend_reg)(((addr)>>_ZEND_ADDR_REG_SHIFT) & _ZEND_ADDR_REG_MASK))
+#define Z_STORE(addr) ((zend_reg)(((addr)>>_ZEND_ADDR_REG_STORE_BIT) & 1))
+#define Z_LOAD(addr) ((zend_reg)(((addr)>>_ZEND_ADDR_REG_LOAD_BIT) & 1))
+#define Z_LAST_USE(addr) ((zend_reg)(((addr)>>_ZEND_ADDR_REG_LAST_USE_BIT) & 1))
+
+#define OP_REG_EX(reg, store, load, last_use) \
+ ((reg) | \
+ ((store) ? (1 << (_ZEND_ADDR_REG_STORE_BIT-_ZEND_ADDR_REG_SHIFT)) : 0) | \
+ ((load) ? (1 << (_ZEND_ADDR_REG_LOAD_BIT-_ZEND_ADDR_REG_SHIFT)) : 0) | \
+ ((last_use) ? (1 << (_ZEND_ADDR_REG_LAST_USE_BIT-_ZEND_ADDR_REG_SHIFT)) : 0) \
+ )
+
+#define OP_REG(line, op) \
+ (ra && ssa->ops[line].op >= 0 && ra[ssa->ops[line].op] ? \
+ OP_REG_EX(ra[ssa->ops[line].op]->reg, \
+ ra[ssa->ops[line].op]->store, \
+ ra[ssa->ops[line].op]->load, \
+ zend_ssa_is_last_use(op_array, ssa, ssa->ops[line].op, line) \
+ ) : ZREG_NONE)
+
+static zend_always_inline zend_jit_addr _zend_jit_decode_op(zend_uchar op_type, znode_op op, const zend_op *opline, zend_reg reg)
+{
+ if (op_type == IS_CONST) {
+#if ZEND_USE_ABS_CONST_ADDR
+ return ZEND_ADDR_CONST_ZVAL(op.zv);
+#else
+ return ZEND_ADDR_CONST_ZVAL(RT_CONSTANT(opline, op));
+#endif
+ } else {
+ ZEND_ASSERT(op_type & (IS_CV|IS_TMP_VAR|IS_VAR));
+ if (reg != ZREG_NONE) {
+ return ZEND_ADDR_REG(reg);
+ } else {
+ return ZEND_ADDR_MEM_ZVAL(ZREG_FP, op.var);
+ }
+ }
+}
+
+#define OP_ADDR(opline, type, op) \
+ _zend_jit_decode_op((opline)->type, (opline)->op, opline, ZREG_NONE)
+
+#define OP1_ADDR() \
+ OP_ADDR(opline, op1_type, op1)
+#define OP2_ADDR() \
+ OP_ADDR(opline, op2_type, op2)
+#define RES_ADDR() \
+ OP_ADDR(opline, op2_type, op2)
+#define OP1_DATA_ADDR() \
+ OP_ADDR(opline + 1, op1_type, op1)
+
+#define OP_REG_ADDR(opline, type, op, ssa_op) \
+ _zend_jit_decode_op((opline)->type, (opline)->op, opline, \
+ OP_REG((opline) - op_array->opcodes, ssa_op))
+
+#define OP1_REG_ADDR() \
+ OP_REG_ADDR(opline, op1_type, op1, op1_use)
+#define OP2_REG_ADDR() \
+ OP_REG_ADDR(opline, op2_type, op2, op2_use)
+#define RES_REG_ADDR() \
+ OP_REG_ADDR(opline, result_type, result, result_def)
+#define OP1_DATA_REG_ADDR() \
+ OP_REG_ADDR(opline + 1, op1_type, op1, op1_use)
+
+#define OP1_DEF_REG_ADDR() \
+ OP_REG_ADDR(opline, op1_type, op1, op1_def)
+#define OP2_DEF_REG_ADDR() \
+ OP_REG_ADDR(opline, op2_type, op2, op2_def)
+#define RES_USE_REG_ADDR() \
+ OP_REG_ADDR(opline, result_type, result, result_use)
+#define OP1_DATA_DEF_REG_ADDR() \
+ OP_REG_ADDR(opline + 1, op1_type, op1, op1_def)
+
+static zend_always_inline zend_bool zend_jit_same_addr(zend_jit_addr addr1, zend_jit_addr addr2)
+{
+ if (addr1 == addr2) {
+ return 1;
+ } else if (Z_MODE(addr1) == IS_REG && Z_MODE(addr2) == IS_REG) {
+ return Z_REG(addr1) == Z_REG(addr2);
+ }
+ return 0;
+}
+
+#endif /* ZEND_JIT_X86_H */
diff --git a/ext/opcache/opcache.stub.php b/ext/opcache/opcache.stub.php
new file mode 100644
index 0000000000..a60f237642
--- /dev/null
+++ b/ext/opcache/opcache.stub.php
@@ -0,0 +1,13 @@
+<?php
+
+function opcache_reset(): bool {}
+
+function opcache_get_status(bool $fetch_scripts = true): array|false {}
+
+function opcache_compile_file(string $file): bool {}
+
+function opcache_invalidate(string $script, bool $force = false): bool {}
+
+function opcache_get_configuration(): array|false {}
+
+function opcache_is_script_cached(string $script): bool {}
diff --git a/ext/opcache/opcache_arginfo.h b/ext/opcache/opcache_arginfo.h
new file mode 100644
index 0000000000..1b6ff24283
--- /dev/null
+++ b/ext/opcache/opcache_arginfo.h
@@ -0,0 +1,24 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_opcache_reset, 0, 0, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_opcache_get_status, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, fetch_scripts, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_opcache_compile_file, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, file, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_opcache_invalidate, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, script, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, force, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_opcache_get_configuration, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_opcache_is_script_cached, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, script, IS_STRING, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/opcache/shared_alloc_mmap.c b/ext/opcache/shared_alloc_mmap.c
index dc02d038f5..8f900c1590 100644
--- a/ext/opcache/shared_alloc_mmap.c
+++ b/ext/opcache/shared_alloc_mmap.c
@@ -39,17 +39,10 @@
static int create_segments(size_t requested_size, zend_shared_segment ***shared_segments_p, int *shared_segments_count, char **error_in)
{
zend_shared_segment *shared_segment;
-
- *shared_segments_count = 1;
- *shared_segments_p = (zend_shared_segment **) calloc(1, sizeof(zend_shared_segment) + sizeof(void *));
- if (!*shared_segments_p) {
- *error_in = "calloc";
- return ALLOC_FAILURE;
- }
- shared_segment = (zend_shared_segment *)((char *)(*shared_segments_p) + sizeof(void *));
- (*shared_segments_p)[0] = shared_segment;
-
+ void *p;
#ifdef MAP_HUGETLB
+ size_t huge_page_size = 2 * 1024 * 1024;
+
/* Try to allocate huge pages first to reduce dTLB misses.
* OSes has to be configured properly
* on Linux
@@ -60,21 +53,56 @@ static int create_segments(size_t requested_size, zend_shared_segment ***shared_
* sysctl vm.pmap.pg_ps_enabled entry
* (boot time config only, but enabled by default on most arches).
*/
- shared_segment->p = mmap(0, requested_size, PROT_READ | PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS|MAP_HUGETLB, -1, 0);
- if (shared_segment->p != MAP_FAILED) {
- shared_segment->pos = 0;
- shared_segment->size = requested_size;
+ if (requested_size >= huge_page_size && requested_size % huge_page_size == 0) {
+# if defined(__x86_64__) && defined(MAP_32BIT)
+ /* to got HUGE PAGES in low 32-bit address we have to reserve address
+ space and then remap it using MAP_HUGETLB */
- return ALLOC_SUCCESS;
+ p = mmap(NULL, requested_size, PROT_READ | PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS|MAP_32BIT, -1, 0);
+ if (p != MAP_FAILED) {
+ munmap(p, requested_size);
+ p = (void*)(ZEND_MM_ALIGNED_SIZE_EX((ptrdiff_t)p, huge_page_size));
+ p = mmap(p, requested_size, PROT_READ | PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS|MAP_32BIT|MAP_HUGETLB|MAP_FIXED, -1, 0);
+ if (p != MAP_FAILED) {
+ goto success;
+ } else {
+ p = mmap(NULL, requested_size, PROT_READ | PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS|MAP_32BIT, -1, 0);
+ if (p != MAP_FAILED) {
+ goto success;
+ }
+ }
+ }
+# endif
+ p = mmap(0, requested_size, PROT_READ | PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS|MAP_HUGETLB, -1, 0);
+ if (p != MAP_FAILED) {
+ goto success;
+ }
+ }
+#elif defined(PREFER_MAP_32BIT) && defined(__x86_64__) && defined(MAP_32BIT)
+ p = mmap(NULL, requested_size, PROT_READ | PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS|MAP_32BIT, -1, 0);
+ if (p != MAP_FAILED) {
+ goto success;
}
#endif
- shared_segment->p = mmap(0, requested_size, PROT_READ | PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, -1, 0);
- if (shared_segment->p == MAP_FAILED) {
+ p = mmap(0, requested_size, PROT_READ | PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, -1, 0);
+ if (p == MAP_FAILED) {
*error_in = "mmap";
return ALLOC_FAILURE;
}
+success: ZEND_ATTRIBUTE_UNUSED;
+ *shared_segments_count = 1;
+ *shared_segments_p = (zend_shared_segment **) calloc(1, sizeof(zend_shared_segment) + sizeof(void *));
+ if (!*shared_segments_p) {
+ munmap(p, requested_size);
+ *error_in = "calloc";
+ return ALLOC_FAILURE;
+ }
+ shared_segment = (zend_shared_segment *)((char *)(*shared_segments_p) + sizeof(void *));
+ (*shared_segments_p)[0] = shared_segment;
+
+ shared_segment->p = p;
shared_segment->pos = 0;
shared_segment->size = requested_size;
diff --git a/ext/opcache/shared_alloc_win32.c b/ext/opcache/shared_alloc_win32.c
index d2c31dd63b..856e33696a 100644
--- a/ext/opcache/shared_alloc_win32.c
+++ b/ext/opcache/shared_alloc_win32.c
@@ -197,7 +197,7 @@ static int zend_shared_alloc_reattach(size_t requested_size, char **error_in)
return ALLOC_FAILURE;
}
- mapping_base = MapViewOfFileEx(memfile, FILE_MAP_ALL_ACCESS, 0, 0, 0, wanted_mapping_base);
+ mapping_base = MapViewOfFileEx(memfile, FILE_MAP_ALL_ACCESS|FILE_MAP_EXECUTE, 0, 0, 0, wanted_mapping_base);
if (mapping_base == NULL) {
err = GetLastError();
@@ -206,7 +206,16 @@ static int zend_shared_alloc_reattach(size_t requested_size, char **error_in)
return ALLOC_FAILURE;
}
return ALLOC_FAIL_MAPPING;
+ } else {
+ DWORD old;
+
+ if (!VirtualProtect(mapping_base, requested_size, PAGE_READWRITE, &old)) {
+ err = GetLastError();
+ zend_win_error_message(ACCEL_LOG_FATAL, "VirtualProtect() failed", err);
+ return ALLOC_FAIL_MAPPING;
+ }
}
+
smm_shared_globals = (zend_smm_shared_globals *) mapping_base;
return SUCCESSFULLY_REATTACHED;
@@ -237,7 +246,7 @@ static int create_segments(size_t requested_size, zend_shared_segment ***shared_
can be called before the child process is killed. In this case, the map will fail
and we have to sleep some time (until the child releases the mapping object) and retry.*/
do {
- memfile = OpenFileMapping(FILE_MAP_WRITE, 0, create_name_with_username(ACCEL_FILEMAP_NAME));
+ memfile = OpenFileMapping(FILE_MAP_READ|FILE_MAP_WRITE|FILE_MAP_EXECUTE, 0, create_name_with_username(ACCEL_FILEMAP_NAME));
if (memfile == NULL) {
err = GetLastError();
break;
@@ -281,7 +290,7 @@ static int create_segments(size_t requested_size, zend_shared_segment ***shared_
shared_segment = (zend_shared_segment *)((char *)(*shared_segments_p) + sizeof(void *));
(*shared_segments_p)[0] = shared_segment;
- memfile = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, size_high, size_low,
+ memfile = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_EXECUTE_READWRITE | SEC_COMMIT, size_high, size_low,
create_name_with_username(ACCEL_FILEMAP_NAME));
if (memfile == NULL) {
err = GetLastError();
@@ -311,7 +320,7 @@ static int create_segments(size_t requested_size, zend_shared_segment ***shared_
}
do {
- shared_segment->p = mapping_base = MapViewOfFileEx(memfile, FILE_MAP_ALL_ACCESS, 0, 0, 0, *wanted_mapping_base);
+ shared_segment->p = mapping_base = MapViewOfFileEx(memfile, FILE_MAP_ALL_ACCESS|FILE_MAP_EXECUTE, 0, 0, 0, *wanted_mapping_base);
if (*wanted_mapping_base == NULL) { /* Auto address (NULL) is the last option on the array */
break;
}
@@ -325,9 +334,18 @@ static int create_segments(size_t requested_size, zend_shared_segment ***shared_
*error_in = "MapViewOfFile";
return ALLOC_FAILURE;
} else {
- char *mmap_base_file = get_mmap_base_file();
+ char *mmap_base_file;
void *execute_ex_base = (void *)execute_ex;
- FILE *fp = fopen(mmap_base_file, "w");
+ FILE *fp;
+ DWORD old;
+
+ if (!VirtualProtect(mapping_base, requested_size, PAGE_READWRITE, &old)) {
+ err = GetLastError();
+ zend_win_error_message(ACCEL_LOG_FATAL, "VirtualProtect() failed", err);
+ return ALLOC_FAILURE;
+ }
+ mmap_base_file = get_mmap_base_file();
+ fp = fopen(mmap_base_file, "w");
if (!fp) {
err = GetLastError();
zend_shared_alloc_unlock_win32();
diff --git a/ext/opcache/tests/assign_obj_op_of_fetch_dim.phpt b/ext/opcache/tests/assign_obj_op_of_fetch_dim.phpt
index c89d0bea62..2c07051778 100644
--- a/ext/opcache/tests/assign_obj_op_of_fetch_dim.phpt
+++ b/ext/opcache/tests/assign_obj_op_of_fetch_dim.phpt
@@ -8,13 +8,13 @@ function test() {
$ary[0]->y += 2;
var_dump(is_object($ary[0]));
}
-test();
+try {
+ test();
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
?>
--EXPECTF--
Notice: Undefined offset: 0 in %s on line %d
-
-Warning: Creating default object from empty value in %s on line %d
-
-Notice: Undefined property: stdClass::$y in %s on line %d
-bool(true)
+Attempt to assign property 'y' of non-object
diff --git a/ext/opcache/tests/blacklist.inc b/ext/opcache/tests/blacklist.inc
index a9db751419..65adb91ced 100644
--- a/ext/opcache/tests/blacklist.inc
+++ b/ext/opcache/tests/blacklist.inc
@@ -1,3 +1,3 @@
<?php
- echo "ok\n";
+ echo "ok\n";
?>
diff --git a/ext/opcache/tests/block_pass_001.phpt b/ext/opcache/tests/block_pass_001.phpt
index c024b81ce8..7fab78bbe8 100644
--- a/ext/opcache/tests/block_pass_001.phpt
+++ b/ext/opcache/tests/block_pass_001.phpt
@@ -9,4 +9,4 @@ Block pass: Bugs in BOOL/QM_ASSIGN elision
(bool) new stdClass;
?>
--EXPECTF--
-Notice: Undefined variable: x in %s on line %d
+Warning: Undefined variable: x in %s on line %d
diff --git a/ext/opcache/tests/bool_not_cv.phpt b/ext/opcache/tests/bool_not_cv.phpt
index ed3cf83514..cc28edcc01 100644
--- a/ext/opcache/tests/bool_not_cv.phpt
+++ b/ext/opcache/tests/bool_not_cv.phpt
@@ -26,9 +26,9 @@ undef_bool_cast();
--EXPECTF--
In undef_negation
-Notice: Undefined variable: v in %s on line 4
+Warning: Undefined variable: v in %s on line 4
true
In undef_bool_cast
-Notice: Undefined variable: v in %s on line 10
+Warning: Undefined variable: v in %s on line 10
false
diff --git a/ext/opcache/tests/bug64353.phpt b/ext/opcache/tests/bug64353.phpt
index 42cb45c915..bfb332e26e 100644
--- a/ext/opcache/tests/bug64353.phpt
+++ b/ext/opcache/tests/bug64353.phpt
@@ -9,16 +9,16 @@ opcache.enable_cli=1
--FILE--
<?php
class BugLoader extends php_user_filter {
- public function filter($in, $out, &$consumed, $closing) {
- if (!class_exists("Test")) {
- eval("class Test extends ArrayObject {}");
- }
- while ($bucket = stream_bucket_make_writeable($in)) {
- $consumed += $bucket->datalen;
- stream_bucket_append($out, $bucket);
- }
- return PSFS_PASS_ON;
- }
+ public function filter($in, $out, &$consumed, $closing) {
+ if (!class_exists("Test")) {
+ eval("class Test extends ArrayObject {}");
+ }
+ while ($bucket = stream_bucket_make_writeable($in)) {
+ $consumed += $bucket->datalen;
+ stream_bucket_append($out, $bucket);
+ }
+ return PSFS_PASS_ON;
+ }
}
stream_filter_register('bug.test', 'BugLoader');
diff --git a/ext/opcache/tests/bug65665.phpt b/ext/opcache/tests/bug65665.phpt
index ac5c18dd83..bcdd0e6da1 100644
--- a/ext/opcache/tests/bug65665.phpt
+++ b/ext/opcache/tests/bug65665.phpt
@@ -8,108 +8,108 @@ opcache.enable_cli=1
--FILE--
<?php
function foo() {
- try
- {
- switch (1)
- {
- case 0:
- try
- {
+ try
+ {
+ switch (1)
+ {
+ case 0:
+ try
+ {
- }
- catch (Exception $e)
- {
+ }
+ catch (Exception $e)
+ {
- }
+ }
- break;
+ break;
- case 1:
- try
- {
- throw new Exception('aaa');
- }
- catch (Exception $e)
- {
- echo "correct\n";
- }
+ case 1:
+ try
+ {
+ throw new Exception('aaa');
+ }
+ catch (Exception $e)
+ {
+ echo "correct\n";
+ }
- break;
- }
- }
- catch (Exception $e)
- {
- echo "wrong\n";
- }
- return;
+ break;
+ }
+ }
+ catch (Exception $e)
+ {
+ echo "wrong\n";
+ }
+ return;
}
function foo1() {
- try
- {
- switch (1)
- {
- case 0:
- try
- {
+ try
+ {
+ switch (1)
+ {
+ case 0:
+ try
+ {
- }
- catch (Exception $e)
- {
+ }
+ catch (Exception $e)
+ {
dummy:
- echo "ect\n";
- }
+ echo "ect\n";
+ }
- break;
+ break;
- case 1:
- try
- {
- throw new Exception('aaa');
- }
- catch (Exception $e)
- {
- echo "corr";
- goto dummy;
- }
- break;
- }
- }
- catch (Exception $e)
- {
- echo "wrong\n";
- }
- return;
+ case 1:
+ try
+ {
+ throw new Exception('aaa');
+ }
+ catch (Exception $e)
+ {
+ echo "corr";
+ goto dummy;
+ }
+ break;
+ }
+ }
+ catch (Exception $e)
+ {
+ echo "wrong\n";
+ }
+ return;
}
function foo2() {
- try
- {
- switch (1)
- {
- case 0:
- try
- {
+ try
+ {
+ switch (1)
+ {
+ case 0:
+ try
+ {
dummy:
- throw new Exception('aaa');
- }
- catch (Exception $e)
- {
- echo "correct\n";
- }
+ throw new Exception('aaa');
+ }
+ catch (Exception $e)
+ {
+ echo "correct\n";
+ }
- break;
+ break;
- case 1:
- goto dummy;
- break;
- }
- }
- catch (Exception $e)
- {
- echo "wrong\n";
- }
- return;
+ case 1:
+ goto dummy;
+ break;
+ }
+ }
+ catch (Exception $e)
+ {
+ echo "wrong\n";
+ }
+ return;
}
foo();foo1();foo2();
--EXPECT--
diff --git a/ext/opcache/tests/bug66176.phpt b/ext/opcache/tests/bug66176.phpt
index a91024a616..a7c53c1690 100644
--- a/ext/opcache/tests/bug66176.phpt
+++ b/ext/opcache/tests/bug66176.phpt
@@ -10,8 +10,8 @@ opcache.file_update_protection=0
--FILE--
<?php
function foo($v) {
- global $a;
- return $a[$v];
+ global $a;
+ return $a[$v];
}
$a = array(PHP_VERSION => 1);
var_dump(foo(PHP_VERSION));
diff --git a/ext/opcache/tests/bug66251.phpt b/ext/opcache/tests/bug66251.phpt
index daa5a89bb2..42c6e2f606 100644
--- a/ext/opcache/tests/bug66251.phpt
+++ b/ext/opcache/tests/bug66251.phpt
@@ -5,7 +5,7 @@ opcache.enable=1
opcache.enable_cli=1
opcache.optimization_level=-1
--SKIPIF--
-<?php if (!extension_loaded('Zend OPcache') || php_sapi_name() != "cli") die("skip CLI only"); ?>
+<?php if (!extension_loaded('Zend OPcache')) die("skip Zend OPcache extension not loaded"); ?>
--FILE--
<?php
printf ("A=%s\n", getA());
@@ -13,5 +13,8 @@ const A="hello";
function getA() {return A;}
?>
--EXPECTF--
-Warning: Use of undefined constant A - assumed 'A' (this will throw an Error in a future version of PHP) in %sbug66251.php on line 4
-A=A
+Fatal error: Uncaught Error: Undefined constant 'A' in %s:%d
+Stack trace:
+#0 %s(%d): getA()
+#1 {main}
+ thrown in %s on line %d
diff --git a/ext/opcache/tests/bug66334.phpt b/ext/opcache/tests/bug66334.phpt
index b2c6d7b92c..33e3847e34 100644
--- a/ext/opcache/tests/bug66334.phpt
+++ b/ext/opcache/tests/bug66334.phpt
@@ -11,9 +11,9 @@ enable_dl=0
--FILE--
<?php
if (extension_loaded("unknown_extension")) {
- var_dump(1);
+ var_dump(1);
} else {
- var_dump(2);
+ var_dump(2);
}
--EXPECT--
int(2)
diff --git a/ext/opcache/tests/bug66338.phpt b/ext/opcache/tests/bug66338.phpt
index 5cd9693793..1473481561 100644
--- a/ext/opcache/tests/bug66338.phpt
+++ b/ext/opcache/tests/bug66338.phpt
@@ -3,7 +3,7 @@ Bug #66338 (Optimization binding of class constants is not safely opcacheable)
--INI--
opcache.enable=0
--SKIPIF--
-<?php if (!extension_loaded('Zend OPcache') || php_sapi_name() != "cli") die("skip CLI only"); ?>
+<?php if (!extension_loaded('Zend OPcache')) die("skip Zend OPcache extension not loaded"); ?>
--CONFLICTS--
server
--FILE--
@@ -12,20 +12,20 @@ $root = str_replace('.php', "", __FILE__);
$base = basename( $root );
file_put_contents( "$root-Officials.inc", '<?php
- class Officials { static function getLeader() { return LocalTerms::GOV_LEADER; } }
- ' );
+ class Officials { static function getLeader() { return LocalTerms::GOV_LEADER; } }
+ ' );
file_put_contents( "$root-clientUS.php", '<?php
- class LocalTerms { const GOV_LEADER = "Barack Hussein Obama II"; }
- require \''.$root.'-Officials.inc\';
- printf( "The President of the USA is %s\n", Officials::getLeader() );
- ' );
+ class LocalTerms { const GOV_LEADER = "Barack Hussein Obama II"; }
+ require \''.$root.'-Officials.inc\';
+ printf( "The President of the USA is %s\n", Officials::getLeader() );
+ ' );
file_put_contents( "$root-clientUK.php", '<?php
- class LocalTerms { const GOV_LEADER = "David William Donald Cameron"; }
- require \''.$root.'-Officials.inc\';
- printf( "The Prime Minister of the UK is %s\n", Officials::getLeader() );
- ' );
+ class LocalTerms { const GOV_LEADER = "David William Donald Cameron"; }
+ require \''.$root.'-Officials.inc\';
+ printf( "The Prime Minister of the UK is %s\n", Officials::getLeader() );
+ ' );
include "php_cli_server.inc";
$uri = sprintf("http://%s/%s", PHP_CLI_SERVER_ADDRESS, basename(__FILE__));
diff --git a/ext/opcache/tests/bug66440.phpt b/ext/opcache/tests/bug66440.phpt
index b546e32b3c..539b0ce7aa 100644
--- a/ext/opcache/tests/bug66440.phpt
+++ b/ext/opcache/tests/bug66440.phpt
@@ -10,7 +10,7 @@ opcache.file_update_protection=0
--FILE--
<?php
if(constant('PHP_BINARY')) {
- echo "OK\n";
+ echo "OK\n";
}
--EXPECT--
OK
diff --git a/ext/opcache/tests/bug66474.phpt b/ext/opcache/tests/bug66474.phpt
index 3bd038c0de..10d54a7fa5 100644
--- a/ext/opcache/tests/bug66474.phpt
+++ b/ext/opcache/tests/bug66474.phpt
@@ -10,7 +10,7 @@ opcache.file_update_protection=0
--FILE--
<?php
function foo() {
- $speed = 'slow' || 'fast';
+ $speed = 'slow' || 'fast';
}
foo();
echo "ok\n";
diff --git a/ext/opcache/tests/bug68252.phpt b/ext/opcache/tests/bug68252.phpt
deleted file mode 100644
index bc2e5a0fb6..0000000000
--- a/ext/opcache/tests/bug68252.phpt
+++ /dev/null
@@ -1,21 +0,0 @@
---TEST--
-Bug #68252 (segfault in Zend/zend_hash.c in function _zend_hash_del_el)
---INI--
-opcache.enable=1
-opcache.enable_cli=1
-opcache.fast_shutdown=1
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-/* run this test script with valgrind */
-function a() {
- echo "okey";
-}
-
-create_function('', 'var_dump("22");');
-
-a();
---EXPECTF--
-Deprecated: Function create_function() is deprecated in %s on line %d
-okey
diff --git a/ext/opcache/tests/bug68644.phpt b/ext/opcache/tests/bug68644.phpt
deleted file mode 100644
index 1a967facaf..0000000000
--- a/ext/opcache/tests/bug68644.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-Bug #68644 strlen incorrect : mbstring + func_overload=2 + UTF-8 + Opcache
---INI--
-opcache.enable=1
-opcache.enable_cli=1
-mbstring.func_overload=2
---SKIPIF--
-<?php if (!extension_loaded('Zend OPcache') || !extension_loaded("mbstring")) die("skip"); ?>
---FILE--
-<?php
-var_dump(strlen("中国, 北京"));
-var_dump(mb_strlen("中国, 北京"));
-?>
---EXPECT--
-Deprecated: The mbstring.func_overload directive is deprecated in Unknown on line 0
-int(6)
-int(6)
diff --git a/ext/opcache/tests/bug69038.phpt b/ext/opcache/tests/bug69038.phpt
index 1670a9eca6..09b9af4077 100644
--- a/ext/opcache/tests/bug69038.phpt
+++ b/ext/opcache/tests/bug69038.phpt
@@ -10,50 +10,50 @@ opcache.optimization_level=-1
<?php
function a($a = "bad") {
- switch (PHP_OS) {
- case "LALALALA" : return "LALALAL";
- case PHP_OS: return "okey";
- default: break;
- }
+ switch (PHP_OS) {
+ case "LALALALA" : return "LALALAL";
+ case PHP_OS: return "okey";
+ default: break;
+ }
- return $a;
+ return $a;
}
var_dump(a());
function b($b = "bad") {
- switch (PHP_OS) {
- case "LALALAL": return "bad";
- case PHP_OS:
- switch (PHP_OS) {
- case "FOO": break;
- case PHP_OS: return "okey";
- default :
- break;
- }
- break;
- default:
- break;
- }
- return $b;
+ switch (PHP_OS) {
+ case "LALALAL": return "bad";
+ case PHP_OS:
+ switch (PHP_OS) {
+ case "FOO": break;
+ case PHP_OS: return "okey";
+ default :
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+ return $b;
}
var_dump(b());
function c($b = "bad") {
- switch (extension_loaded("standard")) {
- case 0 : return "LALALAL";
- case 1 : return "okey";
- default : return "bad";
- }
+ switch (extension_loaded("standard")) {
+ case 0 : return "LALALAL";
+ case 1 : return "okey";
+ default : return "bad";
+ }
}
var_dump(c());
function d() {
- switch (PHP_OS) {
- default: return "bad";
- case PHP_OS: return "okey";
- }
+ switch (PHP_OS) {
+ default: return "bad";
+ case PHP_OS: return "okey";
+ }
}
var_dump(d());
diff --git a/ext/opcache/tests/bug69159.phpt b/ext/opcache/tests/bug69159.phpt
index d8b953a1aa..158f242b3f 100644
--- a/ext/opcache/tests/bug69159.phpt
+++ b/ext/opcache/tests/bug69159.phpt
@@ -12,7 +12,7 @@ $x1 = "okey";
myFunction(${"x$i"});
function myFunction($x) {
- var_dump($x);
+ var_dump($x);
}
?>
diff --git a/ext/opcache/tests/bug70207.phpt b/ext/opcache/tests/bug70207.phpt
index c684ee6d33..a73b7a6916 100644
--- a/ext/opcache/tests/bug70207.phpt
+++ b/ext/opcache/tests/bug70207.phpt
@@ -10,11 +10,13 @@ opcache.file_update_protection=0
--FILE--
<?php
function bar() {
- return "bar";
+ return "bar";
}
function foo() {
try { return bar(); }
- finally { @fclose(null); }
+ finally {
+ @fopen("non-existent", 'r');
+ }
}
var_dump(foo());
diff --git a/ext/opcache/tests/bug71843.phpt b/ext/opcache/tests/bug71843.phpt
index 924fb873fe..0a193425dd 100644
--- a/ext/opcache/tests/bug71843.phpt
+++ b/ext/opcache/tests/bug71843.phpt
@@ -8,18 +8,15 @@ opcache.optimization_level=0xFFFFBFFF
<?php if (!extension_loaded('Zend OPcache')) die("skip"); ?>
--FILE--
<?php
+define('E', 'E');
+define('R', 'R');
+define('See', 'See');
0 & ~E & ~R;
6 && ~See
?>
okey
--EXPECTF--
-Warning: Use of undefined constant E - assumed 'E' (this will throw an Error in a future version of PHP) in %sbug71843.php on line %d
-
Warning: A non-numeric value encountered in %s on line %d
-Warning: Use of undefined constant R - assumed 'R' (this will throw an Error in a future version of PHP) in %sbug71843.php on line %d
-
Warning: A non-numeric value encountered in %s on line %d
-
-Warning: Use of undefined constant See - assumed 'See' (this will throw an Error in a future version of PHP) in %sbug71843.php on line %d
okey
diff --git a/ext/opcache/tests/bug73402.phpt b/ext/opcache/tests/bug73402.phpt
index f325b798e5..d245d58969 100644
--- a/ext/opcache/tests/bug73402.phpt
+++ b/ext/opcache/tests/bug73402.phpt
@@ -8,19 +8,19 @@ opcache.enable_cli=1
--FILE--
<?php
class Logger {
- public function info($msg) {
- echo $msg;
- }
+ public function info($msg) {
+ echo $msg;
+ }
}
class B
{
- const LOG_LEVEL = 'Info';
- public function test()
- {
- $logger = new \Logger();
- $logger->{self::LOG_LEVEL}('test');
- }
+ const LOG_LEVEL = 'Info';
+ public function test()
+ {
+ $logger = new \Logger();
+ $logger->{self::LOG_LEVEL}('test');
+ }
}
$b = new B;
diff --git a/ext/opcache/tests/bug73583.phpt b/ext/opcache/tests/bug73583.phpt
index e947b451c9..f533e9caf5 100644
--- a/ext/opcache/tests/bug73583.phpt
+++ b/ext/opcache/tests/bug73583.phpt
@@ -10,9 +10,9 @@ opcache.file_update_protection=0
--FILE--
<?php
if (true) {
- class A { }
- function A() { }
- function A() { }
+ class A { }
+ function A() { }
+ function A() { }
}
?>
--EXPECTF--
diff --git a/ext/opcache/tests/bug73668.phpt b/ext/opcache/tests/bug73668.phpt
index 379ba4a5ac..b2a0508aa5 100644
--- a/ext/opcache/tests/bug73668.phpt
+++ b/ext/opcache/tests/bug73668.phpt
@@ -7,4 +7,4 @@ Bug #73668: "SIGFPE Arithmetic exception" in opcache when divide by minus 1
$a/-1;
?>
--EXPECTF--
-Notice: Undefined variable: a in %s on line %d
+Warning: Undefined variable: a in %s on line %d
diff --git a/ext/opcache/tests/bug73746.phpt b/ext/opcache/tests/bug73746.phpt
index 4f115575cf..c95aed8076 100644
--- a/ext/opcache/tests/bug73746.phpt
+++ b/ext/opcache/tests/bug73746.phpt
@@ -8,19 +8,19 @@ namespace Core\Bundle\Service\Property\Room\Rooms;
class CountryMapping
{
- const CZ = 'CZ';
- const EN = 'EN';
+ const CZ = 'CZ';
+ const EN = 'EN';
- public function get(string $countryIsoCode = null) : string // Works correctly if return type is removed
- {
- switch (strtoupper($countryIsoCode)) {
- case 'CZ':
- case 'SK':
- return self::CZ; // Works correctly if changed to CountryMapping::CZ
- default:
- return self::EN; // Works correctly if changed to CountryMapping::EN
- }
- }
+ public function get(string $countryIsoCode = null) : string // Works correctly if return type is removed
+ {
+ switch (strtoupper($countryIsoCode)) {
+ case 'CZ':
+ case 'SK':
+ return self::CZ; // Works correctly if changed to CountryMapping::CZ
+ default:
+ return self::EN; // Works correctly if changed to CountryMapping::EN
+ }
+ }
}
$mapping = new CountryMapping();
diff --git a/ext/opcache/tests/bug73789.phpt b/ext/opcache/tests/bug73789.phpt
index d5efeb403d..5d5cb92f20 100644
--- a/ext/opcache/tests/bug73789.phpt
+++ b/ext/opcache/tests/bug73789.phpt
@@ -7,26 +7,26 @@ Bug #73789 (Strange behavior of class constants in switch/case block)
<?php
class Lexer
{
- const T_NONE = 1;
- const T_STRING = 2;
- const T_DOT = 8;
- public function getType($value): int
- {
- $type = self::T_NONE;
- switch (true) {
- case ctype_alpha($value[0]):
- $name = 'Lexer::T_' . strtoupper($value);
- $type = constant($name);
- if ($type > 100) {
- return $type;
- }
- return self::T_STRING;
- case $value === '.':
- return self::T_DOT;
- default:
- }
- return $type;
- }
+ const T_NONE = 1;
+ const T_STRING = 2;
+ const T_DOT = 8;
+ public function getType($value): int
+ {
+ $type = self::T_NONE;
+ switch (true) {
+ case ctype_alpha($value[0]):
+ $name = 'Lexer::T_' . strtoupper($value);
+ $type = constant($name);
+ if ($type > 100) {
+ return $type;
+ }
+ return self::T_STRING;
+ case $value === '.':
+ return self::T_DOT;
+ default:
+ }
+ return $type;
+ }
}
var_dump((new Lexer())->getType("dot"));
?>
diff --git a/ext/opcache/tests/bug74019.phpt b/ext/opcache/tests/bug74019.phpt
index 210e223c82..0392963a8b 100644
--- a/ext/opcache/tests/bug74019.phpt
+++ b/ext/opcache/tests/bug74019.phpt
@@ -9,12 +9,12 @@ opcache.enable_cli=1
<?php
class A {
- public function seg() {
- list($a, $b) = A::CONSTS;
- var_dump($a, $b);
- return;
- }
- const CONSTS = [1, 2];
+ public function seg() {
+ list($a, $b) = A::CONSTS;
+ var_dump($a, $b);
+ return;
+ }
+ const CONSTS = [1, 2];
}
$a = new A;
diff --git a/ext/opcache/tests/bug74152.phpt b/ext/opcache/tests/bug74152.phpt
index f51c26b621..b991365927 100644
--- a/ext/opcache/tests/bug74152.phpt
+++ b/ext/opcache/tests/bug74152.phpt
@@ -16,11 +16,11 @@ $bar = null;
switch ($foo) {
default:
case 'foo':
- if ($bar) {
- echo 'true';
- } else {
- echo 'false';
- }
+ if ($bar) {
+ echo 'true';
+ } else {
+ echo 'false';
+ }
}
?>
--EXPECT--
diff --git a/ext/opcache/tests/bug74456.phpt b/ext/opcache/tests/bug74456.phpt
index 9c9a286e2f..10f9b04058 100644
--- a/ext/opcache/tests/bug74456.phpt
+++ b/ext/opcache/tests/bug74456.phpt
@@ -11,7 +11,7 @@ opcache.optimization_level=-1
function small_numbers() {
- return [0,1,2];
+ return [0,1,2];
}
list ($zero, $one, $two) = small_numbers();
diff --git a/ext/opcache/tests/bug74596.phpt b/ext/opcache/tests/bug74596.phpt
index ed1c1b4504..8a1dc17189 100644
--- a/ext/opcache/tests/bug74596.phpt
+++ b/ext/opcache/tests/bug74596.phpt
@@ -15,14 +15,14 @@ opcache.revalidate_path=1
file_put_contents(__DIR__ . "/bug74596_1.php", <<<CODE
<?php
class A {
- public function __construct() {
- \$a = true;
- if (\$a) {
- echo 1 + 2;
- } else {
- echo 2 + 3;
- }
- }
+ public function __construct() {
+ \$a = true;
+ if (\$a) {
+ echo 1 + 2;
+ } else {
+ echo 2 + 3;
+ }
+ }
}
?>
CODE
@@ -32,14 +32,14 @@ file_put_contents(__DIR__ . "/bug74596_2.php", "ok\n");
class ufilter extends php_user_filter
{
- function filter($in, $out, &$consumed, $closing)
- {
- include_once __DIR__ . "/bug74596_1.php";
- while ($bucket = stream_bucket_make_writeable($in)) {
- stream_bucket_append($out, $bucket);
- }
- return PSFS_PASS_ON;
- }
+ function filter($in, $out, &$consumed, $closing)
+ {
+ include_once __DIR__ . "/bug74596_1.php";
+ while ($bucket = stream_bucket_make_writeable($in)) {
+ stream_bucket_append($out, $bucket);
+ }
+ return PSFS_PASS_ON;
+ }
}
stream_filter_register("ufilter", "ufilter");
diff --git a/ext/opcache/tests/bug74980.phpt b/ext/opcache/tests/bug74980.phpt
index e82e234bdd..df77206d7b 100644
--- a/ext/opcache/tests/bug74980.phpt
+++ b/ext/opcache/tests/bug74980.phpt
@@ -11,16 +11,16 @@ opcache.enable_cli=1
class A
{
- static function foo()
- {
- while ($undef) {
- $arr[][] = NULL;
- }
+ static function foo()
+ {
+ while ($undef) {
+ $arr[][] = NULL;
+ }
- foreach ($arr as $a) {
- bar($a + []);
- }
- }
+ foreach ($arr as $a) {
+ bar($a + []);
+ }
+ }
}
diff --git a/ext/opcache/tests/bug75230.phpt b/ext/opcache/tests/bug75230.phpt
index 13100b3679..ce67bb06b9 100644
--- a/ext/opcache/tests/bug75230.phpt
+++ b/ext/opcache/tests/bug75230.phpt
@@ -9,8 +9,8 @@ opcache.optimization_level=-1
--FILE--
<?php
function f() {
- $retval = false;
- if ($retval) { }
+ $retval = false;
+ if ($retval) { }
}
f();
exit("OK");
diff --git a/ext/opcache/tests/bug75357.phpt b/ext/opcache/tests/bug75357.phpt
index 359f6160c2..99537ed097 100644
--- a/ext/opcache/tests/bug75357.phpt
+++ b/ext/opcache/tests/bug75357.phpt
@@ -10,23 +10,23 @@ opcache.optimization_level=-1
<?php
function wp_slash( $value ) {
- if ( is_array( $value ) ) {
- foreach ( $value as $k => $v ) {
- if ( is_array( $v ) ) {
- $value[$k] = wp_slash( $v );
- } else {
- $value[$k] = addslashes( $v );
- }
- }
- } else {
- $value = addslashes( $value );
- }
+ if ( is_array( $value ) ) {
+ foreach ( $value as $k => $v ) {
+ if ( is_array( $v ) ) {
+ $value[$k] = wp_slash( $v );
+ } else {
+ $value[$k] = addslashes( $v );
+ }
+ }
+ } else {
+ $value = addslashes( $value );
+ }
- return $value;
+ return $value;
}
function addslashes_gpc($gpc) {
- return wp_slash($gpc);
+ return wp_slash($gpc);
}
var_dump(addslashes_gpc(array(array("test"))));
diff --git a/ext/opcache/tests/bug75370.phpt b/ext/opcache/tests/bug75370.phpt
index d576f592d4..5cc344e3f6 100644
--- a/ext/opcache/tests/bug75370.phpt
+++ b/ext/opcache/tests/bug75370.phpt
@@ -10,9 +10,9 @@ opcache.optimization_level=-1
<?php
function test()
{
- $success = true;
- $success = $success AND true;
- return $success;
+ $success = true;
+ $success = $success AND true;
+ return $success;
}
var_dump(test());
diff --git a/ext/opcache/tests/bug75556.phpt b/ext/opcache/tests/bug75556.phpt
index 1b2511c580..c1faa5e15a 100644
--- a/ext/opcache/tests/bug75556.phpt
+++ b/ext/opcache/tests/bug75556.phpt
@@ -10,14 +10,14 @@ opcache.optimization_level=-1
<?php
function createFromFormat($format, $date, ?\DateTimeZone $tz = null): ?\DateTimeInterface
{
- if ($tz !== null
- || ($tz instanceof \DateTimeZone && !in_array($tz->getName(), ['UTC', 'Z'], true))
- ) {
- $msg = 'Date objects must have UTC as their timezone';
- throw new \UnexpectedValueException($msg);
- }
+ if ($tz !== null
+ || ($tz instanceof \DateTimeZone && !in_array($tz->getName(), ['UTC', 'Z'], true))
+ ) {
+ $msg = 'Date objects must have UTC as their timezone';
+ throw new \UnexpectedValueException($msg);
+ }
- return null;
+ return null;
}
var_dump(createFromFormat('m/d/Y', '12/07/2017', null));
diff --git a/ext/opcache/tests/bug75687.phpt b/ext/opcache/tests/bug75687.phpt
index 67cf8288a9..1d9c55f96c 100644
--- a/ext/opcache/tests/bug75687.phpt
+++ b/ext/opcache/tests/bug75687.phpt
@@ -11,9 +11,9 @@ opcache.optimization_level=-1
function x($y)
{
- if (is_array($y)) {
- $z = is_array($y) ? array() : array($y);
- }
+ if (is_array($y)) {
+ $z = is_array($y) ? array() : array($y);
+ }
}
?>
okey
diff --git a/ext/opcache/tests/bug75729.phpt b/ext/opcache/tests/bug75729.phpt
deleted file mode 100644
index 52b004c75a..0000000000
--- a/ext/opcache/tests/bug75729.phpt
+++ /dev/null
@@ -1,21 +0,0 @@
---TEST--
-Bug #75729: opcache segfault when installing Bitrix
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
-<?php if (!extension_loaded('mbstring')) die('skip mbstring not loaded'); ?>
---INI--
-opcache.enable_cli=1
-mbstring.func_overload=2
---FILE--
-<?php
-
-var_dump(strpos("foo", "o"));
-var_dump(substr("foo", 1));
-var_dump(substr("foo", 1, 1));
-
-?>
---EXPECT--
-Deprecated: The mbstring.func_overload directive is deprecated in Unknown on line 0
-int(1)
-string(2) "oo"
-string(1) "o"
diff --git a/ext/opcache/tests/bug75893.phpt b/ext/opcache/tests/bug75893.phpt
deleted file mode 100644
index 9ca713b121..0000000000
--- a/ext/opcache/tests/bug75893.phpt
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-Bug #75893: file_get_contents $http_response_header variable bugged with opcache
---INI--
-opcache.enable_cli=1
-track_errors=1
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
---FILE--
-<?php
-
-function test() {
- echo $undef;
- $foo = $php_errormsg;
- var_dump($foo[0]);
-}
-
-test();
-
-?>
---EXPECTF--
-Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0
-
-Notice: Undefined variable: undef in %s on line %d
-string(1) "U"
diff --git a/ext/opcache/tests/bug75938.phpt b/ext/opcache/tests/bug75938.phpt
index cfe6a65503..7fba940e97 100644
--- a/ext/opcache/tests/bug75938.phpt
+++ b/ext/opcache/tests/bug75938.phpt
@@ -5,11 +5,11 @@ Bug #75938: Modulus value not stored in variable
--FILE--
<?php
function borken($columns) {
- $columns = (int) $columns;
- if ($columns < 1) return 0;
- $count = count([1,2,3,4,5]);
- var_dump($mod = ($count % $columns));
- var_dump($mod);
+ $columns = (int) $columns;
+ if ($columns < 1) return 0;
+ $count = count([1,2,3,4,5]);
+ var_dump($mod = ($count % $columns));
+ var_dump($mod);
}
borken(2);
?>
diff --git a/ext/opcache/tests/bug76074.phpt b/ext/opcache/tests/bug76074.phpt
index d12ebb26fa..94c79beff6 100644
--- a/ext/opcache/tests/bug76074.phpt
+++ b/ext/opcache/tests/bug76074.phpt
@@ -6,8 +6,8 @@ Bug #76074 (opcache corrupts variable in for-loop)
<?php
function test(int $nr) {
- for ($i = $nr; $i <= $nr + 1; $i++)
- var_dump($i);
+ for ($i = $nr; $i <= $nr + 1; $i++)
+ var_dump($i);
}
test(1);
diff --git a/ext/opcache/tests/bug76094.phpt b/ext/opcache/tests/bug76094.phpt
index 4f5e037ead..35f8d321de 100644
--- a/ext/opcache/tests/bug76094.phpt
+++ b/ext/opcache/tests/bug76094.phpt
@@ -11,13 +11,13 @@ opcache.optimization_level=-1
function MetaType($t)
{
- switch (strtoupper($t)) {
- case PHP_INT_MAX :
- return 1;
- case 0:
- default:
- return 0;
- }
+ switch (strtoupper($t)) {
+ case PHP_INT_MAX :
+ return 1;
+ case 0:
+ default:
+ return 0;
+ }
}
var_dump(MetaType("aa"));
diff --git a/ext/opcache/tests/bug76446.phpt b/ext/opcache/tests/bug76446.phpt
index dfb676f4ba..a2b02de032 100644
--- a/ext/opcache/tests/bug76446.phpt
+++ b/ext/opcache/tests/bug76446.phpt
@@ -10,13 +10,13 @@ opcache.optimization_level=-1
<?php
function test()
{
- $openmenu = '';
- $openstr2 = "&amp;openmenu={$openmenu}{$addlang}\"";
- return 0;
+ $openmenu = '';
+ $openstr2 = "&amp;openmenu={$openmenu}{$addlang}\"";
+ return 0;
}
var_dump(test());
?>
--EXPECTF--
-Notice: Undefined variable: addlang in %sbug76446.php on line %d
+Warning: Undefined variable: addlang in %s on line %d
int(0)
diff --git a/ext/opcache/tests/bug76463.phpt b/ext/opcache/tests/bug76463.phpt
index 0fa9be990c..e3dacb691c 100644
--- a/ext/opcache/tests/bug76463.phpt
+++ b/ext/opcache/tests/bug76463.phpt
@@ -10,7 +10,7 @@ opcache.optimization_level=-1
<?php
function test() {
- $old_data = isset($old_data) ? (array)$old_data : [];
+ $old_data = isset($old_data) ? (array)$old_data : [];
}
?>
diff --git a/ext/opcache/tests/bug76477.phpt b/ext/opcache/tests/bug76477.phpt
index 39bff0d46c..7978ce4d7b 100644
--- a/ext/opcache/tests/bug76477.phpt
+++ b/ext/opcache/tests/bug76477.phpt
@@ -11,9 +11,9 @@ opcache.optimization_level=-1
testString();
function testString()
{
- $token = "ABC";
- $lengthBytes = strlenb($token);
- var_dump($lengthBytes == 0);
+ $token = "ABC";
+ $lengthBytes = strlenb($token);
+ var_dump($lengthBytes == 0);
}
function strlenb() { return call_user_func_array("strlen", func_get_args()); }
diff --git a/ext/opcache/tests/bug77058.phpt b/ext/opcache/tests/bug77058.phpt
index a1962b7ade..18d510bbde 100644
--- a/ext/opcache/tests/bug77058.phpt
+++ b/ext/opcache/tests/bug77058.phpt
@@ -3,7 +3,7 @@ Bug #77058: Type inference in opcache causes side effects
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
-<?php
+<?php
function myfunc(){
$Nr = 0;
@@ -18,5 +18,5 @@ myfunc();
?>
--EXPECTF--
-Notice: Undefined variable: x in %s on line %d
+Warning: Undefined variable: x in %s on line %d
'2' is expected to be 2
diff --git a/ext/opcache/tests/bug77191.phpt b/ext/opcache/tests/bug77191.phpt
index ca04b4aadd..ffbc90700c 100644
--- a/ext/opcache/tests/bug77191.phpt
+++ b/ext/opcache/tests/bug77191.phpt
@@ -3,13 +3,13 @@ Bug #77191: Assertion failure in dce_live_ranges() when silencing is used
--FILE--
<?php
function test($x) {
- switch (@$x['y']) {
- case 1: return 'a';
- case 2: return 'b';
- case 3: return 'c';
- case 4: return 'd';
- }
- return 'e';
+ switch (@$x['y']) {
+ case 1: return 'a';
+ case 2: return 'b';
+ case 3: return 'c';
+ case 4: return 'd';
+ }
+ return 'e';
}
var_dump(test([]));
?>
diff --git a/ext/opcache/tests/bug77266.phpt b/ext/opcache/tests/bug77266.phpt
index 8e225b8480..08fc74f96d 100644
--- a/ext/opcache/tests/bug77266.phpt
+++ b/ext/opcache/tests/bug77266.phpt
@@ -10,21 +10,21 @@ opcache.optimization_level=-1
<?php
final class Lock
{
- private static function clearOrphanedLocks()
- {
- $lockList = [];
+ private static function clearOrphanedLocks()
+ {
+ $lockList = [];
- $serverMonitors = array();
- $listCount = count($lockList);
- if ( is_array($lockList) && $listCount > 0 ) {
- $v = explode(':', $value);
- if (!$serverMonitors[$v[0]]['m']) {
- $serverMonitors[$v[0]]['m'] = new ServerMonitor($v[0]);
- }
+ $serverMonitors = array();
+ $listCount = count($lockList);
+ if ( is_array($lockList) && $listCount > 0 ) {
+ $v = explode(':', $value);
+ if (!$serverMonitors[$v[0]]['m']) {
+ $serverMonitors[$v[0]]['m'] = new ServerMonitor($v[0]);
+ }
- }
+ }
- }
+ }
}
?>
diff --git a/ext/opcache/tests/bug77743.phpt b/ext/opcache/tests/bug77743.phpt
index b73da2baaf..f9075a3a7f 100644
--- a/ext/opcache/tests/bug77743.phpt
+++ b/ext/opcache/tests/bug77743.phpt
@@ -6,12 +6,12 @@ Bug #77743: Incorrect pi node insertion for jmpznz with identical successors
<?php
function buggy($a) {
- $id_country = $a;
- if ($id_country === false) {
- if (true) {
- }
- }
- var_dump($id_country);
+ $id_country = $a;
+ if ($id_country === false) {
+ if (true) {
+ }
+ }
+ var_dump($id_country);
}
buggy(42);
diff --git a/ext/opcache/tests/bug78014.inc b/ext/opcache/tests/bug78014.inc
index 51a1196476..aed61ab743 100644
--- a/ext/opcache/tests/bug78014.inc
+++ b/ext/opcache/tests/bug78014.inc
@@ -1,4 +1,4 @@
-<?php
+<?php
class A {
function foo() { return 0; }
}
diff --git a/ext/opcache/tests/bug78015.phpt b/ext/opcache/tests/bug78015.phpt
index 0a03c9834f..aa4ba4db4b 100644
--- a/ext/opcache/tests/bug78015.phpt
+++ b/ext/opcache/tests/bug78015.phpt
@@ -103,7 +103,7 @@ array(1) {
}
bool(true)
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
string(11) "Arrayfoobar"
int(2)
array(2) {
diff --git a/ext/opcache/tests/bug78185.phpt b/ext/opcache/tests/bug78185.phpt
index 51a89f98d3..926bb96404 100644
--- a/ext/opcache/tests/bug78185.phpt
+++ b/ext/opcache/tests/bug78185.phpt
@@ -10,12 +10,12 @@ opcache.file_cache_only=1
--FILE--
<?php
if (substr(PHP_OS, 0, 3) !== 'WIN') {
- $pattern = __DIR__ . '/*/' . __DIR__ . '/*78185.php.bin';
+ $pattern = __DIR__ . '/*/' . __DIR__ . '/*78185.php.bin';
} else {
- $pattern = __DIR__ . '/*/*/' . str_replace(':', '', __DIR__) . '/*78185.php.bin';
+ $pattern = __DIR__ . '/*/*/' . str_replace(':', '', __DIR__) . '/*78185.php.bin';
}
foreach (glob($pattern) as $p) {
- var_dump($p);
+ var_dump($p);
}
?>
--CLEAN--
diff --git a/ext/opcache/tests/bug78986.phpt b/ext/opcache/tests/bug78986.phpt
index 9479460f76..420c828aa4 100644
--- a/ext/opcache/tests/bug78986.phpt
+++ b/ext/opcache/tests/bug78986.phpt
@@ -11,7 +11,7 @@ class TestClass2 {
class TestClass extends TestClass2 {
var $test = [
- TEST_TEST => 'test'
+ TEST_TEST => 'test'
];
}
diff --git a/ext/opcache/tests/compact_literals.phpt b/ext/opcache/tests/compact_literals.phpt
index 0aabb22b50..0963c27705 100644
--- a/ext/opcache/tests/compact_literals.phpt
+++ b/ext/opcache/tests/compact_literals.phpt
@@ -11,10 +11,10 @@ opcache.optimization_level=-1
echo "array key hash" . ":" . PHP_EOL;
$array = array(
- "1" => "one",
- "2" => "two",
- "one" => 1,
- "two" => 2,
+ "1" => "one",
+ "2" => "two",
+ "one" => 1,
+ "two" => 2,
);
unset($array["one"]);
@@ -24,9 +24,9 @@ print_r($array);
echo "function define" . ":" . PHP_EOL;
if (!function_exists("dummy")) {
- function dummy() {
- var_dump(__FUNCTION__);
- }
+ function dummy() {
+ var_dump(__FUNCTION__);
+ }
}
dummy();
@@ -35,22 +35,22 @@ $dummy = function () { var_dump("lambda" . "dummy"); };
$dummy();
if (!class_exists("A")) {
- class A {
- public static $name = "A";
- public static function say($n = "name") {
- var_dump(static::$name);
- }
- }
+ class A {
+ public static $name = "A";
+ public static function say($n = "name") {
+ var_dump(static::$name);
+ }
+ }
}
class B extends A {
- public static $name = "B";
+ public static $name = "B";
}
if (!class_exists("C")) {
- class C extends B {
- public static $name = "C";
- }
+ class C extends B {
+ public static $name = "C";
+ }
}
A::say();
@@ -60,7 +60,7 @@ B::say();
C::say();
function get_eol_define() {
- define("MY_EOL", PHP_EOL);
+ define("MY_EOL", PHP_EOL);
}
get_eol_define();
define("EOL", MY_EOL);
@@ -71,17 +71,17 @@ echo "define " . "TEST" . EOL;
define("TEST", "TEST");
class E {
- public static $E="EP";
- const E="E";
- const TEST="NULL";
+ public static $E="EP";
+ const E="E";
+ const TEST="NULL";
}
class F {
- const F="F";
- public static $E="FEP";
- const E="FE";
- const TEST="FALSE";
- public static $F = "FP";
+ const F="F";
+ public static $E="FEP";
+ const E="FE";
+ const TEST="FALSE";
+ public static $F = "FP";
}
var_dump(TEST); //"TEST"
@@ -97,25 +97,25 @@ var_dumP(F::$E); //"FEP"
echo "propertes and methods" . EOL;
class CH {
- const H = "H";
- public function h() {
- var_dump(self::H);
- }
+ const H = "H";
+ public function h() {
+ var_dump(self::H);
+ }
}
class CI {
- const H = "I";
- public function h() {
- var_dump(self::H);
- }
+ const H = "I";
+ public function h() {
+ var_dump(self::H);
+ }
}
function change(&$obj) {
- $obj = new CH;
+ $obj = new CH;
}
function geti() {
- return new CI;
+ return new CI;
}
$h = new CH;
diff --git a/ext/opcache/tests/issue0115.phpt b/ext/opcache/tests/issue0115.phpt
index bc86d0f4fc..b8df30a164 100644
--- a/ext/opcache/tests/issue0115.phpt
+++ b/ext/opcache/tests/issue0115.phpt
@@ -7,7 +7,6 @@ phar.readonly=0
--SKIPIF--
<?php require_once('skipif.inc'); ?>
<?php if (!extension_loaded("phar")) die("skip"); ?>
-<?php if (php_sapi_name() != "cli") die("skip CLI only"); ?>
--CONFLICTS--
server
--FILE--
diff --git a/ext/opcache/tests/issue0140.phpt b/ext/opcache/tests/issue0140.phpt
index 3ca9b50d3c..78f711fce9 100644
--- a/ext/opcache/tests/issue0140.phpt
+++ b/ext/opcache/tests/issue0140.phpt
@@ -7,7 +7,6 @@ opcache.revalidate_freq=0
opcache.file_update_protection=0
--SKIPIF--
<?php require_once('skipif.inc'); ?>
-<?php if (php_sapi_name() != "cli") die("skip CLI only"); ?>
<?php if (getenv("SKIP_SLOW_TESTS")) die("skip slow tests excluded by request") ?>
--FILE--
<?php
diff --git a/ext/opcache/tests/issue0149.phpt b/ext/opcache/tests/issue0149.phpt
index da3b778ef5..0896e39d0c 100644
--- a/ext/opcache/tests/issue0149.phpt
+++ b/ext/opcache/tests/issue0149.phpt
@@ -7,7 +7,6 @@ phar.readonly=0
--SKIPIF--
<?php require_once('skipif.inc'); ?>
<?php if (!extension_loaded("phar")) die("skip"); ?>
-<?php if (php_sapi_name() != "cli") die("skip CLI only"); ?>
--CONFLICTS--
server
--FILE--
diff --git a/ext/opcache/tests/issue0183.phpt b/ext/opcache/tests/issue0183.phpt
index 9e18f6d2e8..26da4d97cc 100644
--- a/ext/opcache/tests/issue0183.phpt
+++ b/ext/opcache/tests/issue0183.phpt
@@ -11,15 +11,15 @@ opcache.optimization_level=-1
<?php
switch (PHP_OS) {
- case "Windows":
- break;
- case "Darwin":
- break;
- case "Linux":
- echo "okey";
- break;
- default:
- break;
+ case "Windows":
+ break;
+ case "Darwin":
+ break;
+ case "Linux":
+ echo "okey";
+ break;
+ default:
+ break;
}
--EXPECT--
okey
diff --git a/ext/opcache/tests/jit/array_elem.phpt b/ext/opcache/tests/jit/array_elem.phpt
new file mode 100644
index 0000000000..542a872543
--- /dev/null
+++ b/ext/opcache/tests/jit/array_elem.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Refcount inference when adding array elements
+--FILE--
+<?php
+
+function test($a) {
+ $ary = [$a];
+ $ary2 = [0, $ary, $ary];
+ return $ary2;
+}
+var_dump(test(1));
+
+?>
+--EXPECT--
+array(3) {
+ [0]=>
+ int(0)
+ [1]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+ [2]=>
+ array(1) {
+ [0]=>
+ int(1)
+ }
+}
diff --git a/ext/opcache/tests/jit/assign_001.phpt b/ext/opcache/tests/jit/assign_001.phpt
new file mode 100644
index 0000000000..959659cff1
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_001.phpt
@@ -0,0 +1,27 @@
+--TEST--
+JIT ASSIGN: 001
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = array();
+ $b = $a;
+ $c = $a;
+ $a = 1;
+ $x = $a;
+ var_dump($x, $b, $c);
+}
+foo();
+--EXPECT--
+int(1)
+array(0) {
+}
+array(0) {
+}
diff --git a/ext/opcache/tests/jit/assign_002.phpt b/ext/opcache/tests/jit/assign_002.phpt
new file mode 100644
index 0000000000..355fdd4472
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_002.phpt
@@ -0,0 +1,29 @@
+--TEST--
+JIT ASSIGN: 002
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $ref1 = 2.3;
+ $ref2 =& $ref1;
+ $a = array();
+ $b = $a;
+ $c = $a;
+ $a = $ref1;
+ $x = $a;
+ var_dump($x, $b, $c);
+}
+foo();
+--EXPECT--
+float(2.3)
+array(0) {
+}
+array(0) {
+}
diff --git a/ext/opcache/tests/jit/assign_003.phpt b/ext/opcache/tests/jit/assign_003.phpt
new file mode 100644
index 0000000000..7e885d38aa
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_003.phpt
@@ -0,0 +1,21 @@
+--TEST--
+JIT ASSIGN: 003
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = array(); // [rc1, array]
+ $a = 1; // [rc1, long, reg]
+ $x = $a;
+ var_dump($x);
+}
+foo();
+--EXPECT--
+int(1)
diff --git a/ext/opcache/tests/jit/assign_004.phpt b/ext/opcache/tests/jit/assign_004.phpt
new file mode 100644
index 0000000000..70c25bc888
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_004.phpt
@@ -0,0 +1,24 @@
+--TEST--
+JIT ASSIGN: 004
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = null;
+ $b = $a;
+ $c = null;
+ $d = $c;
+ $a = 1;
+ $c = $a;
+ return $c;
+}
+var_dump(foo());
+--EXPECT--
+int(1)
diff --git a/ext/opcache/tests/jit/assign_005.phpt b/ext/opcache/tests/jit/assign_005.phpt
new file mode 100644
index 0000000000..d3f9dca61c
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_005.phpt
@@ -0,0 +1,24 @@
+--TEST--
+JIT ASSIGN: 005
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = array();
+ $b = $a;
+ $c = array();
+ $d = $c;
+ $a = 1;
+ $c = $a;
+ return $c;
+}
+var_dump(foo());
+--EXPECT--
+int(1)
diff --git a/ext/opcache/tests/jit/assign_006.phpt b/ext/opcache/tests/jit/assign_006.phpt
new file mode 100644
index 0000000000..6efc98fe0f
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_006.phpt
@@ -0,0 +1,22 @@
+--TEST--
+JIT ASSIGN: 006
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = array();
+ $c = array();
+ $a = 1;
+ $c = $a;
+ return $c;
+}
+var_dump(foo());
+--EXPECT--
+int(1)
diff --git a/ext/opcache/tests/jit/assign_007.phpt b/ext/opcache/tests/jit/assign_007.phpt
new file mode 100644
index 0000000000..f54ede5ec5
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_007.phpt
@@ -0,0 +1,21 @@
+--TEST--
+JIT ASSIGN: 007
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = 1.0;
+ $c = 2.0;
+ $a = 1;
+ var_dump($a);
+}
+foo();
+--EXPECT--
+int(1)
diff --git a/ext/opcache/tests/jit/assign_008.phpt b/ext/opcache/tests/jit/assign_008.phpt
new file mode 100644
index 0000000000..22b6a465f5
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_008.phpt
@@ -0,0 +1,21 @@
+--TEST--
+JIT ASSIGN: 008
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = 1.0;
+ $c = 2.0;
+ $c = $a;
+ var_dump($a);
+}
+foo();
+--EXPECT--
+float(1)
diff --git a/ext/opcache/tests/jit/assign_009.phpt b/ext/opcache/tests/jit/assign_009.phpt
new file mode 100644
index 0000000000..6772e9028f
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_009.phpt
@@ -0,0 +1,21 @@
+--TEST--
+JIT ASSIGN: 009
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = array();
+ $b = $a;
+ $a = $b;
+}
+foo();
+echo "ok\n";
+--EXPECT--
+ok
diff --git a/ext/opcache/tests/jit/assign_010.phpt b/ext/opcache/tests/jit/assign_010.phpt
new file mode 100644
index 0000000000..77886de67a
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_010.phpt
@@ -0,0 +1,21 @@
+--TEST--
+JIT ASSIGN: 010
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = array();
+ $b =& $a;
+ $a = $b;
+}
+foo();
+echo "ok\n";
+--EXPECT--
+ok
diff --git a/ext/opcache/tests/jit/assign_011.phpt b/ext/opcache/tests/jit/assign_011.phpt
new file mode 100644
index 0000000000..dc9b5e756c
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_011.phpt
@@ -0,0 +1,28 @@
+--TEST--
+JIT ASSIGN: 011
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = 1;
+ $c = 2;
+ $d = 3;
+ if ($a) {
+ $b = array();
+ } else {
+ $b =& $c;
+ }
+ $b = $d;
+ var_dump($b, $c);
+}
+foo();
+--EXPECT--
+int(3)
+int(2)
diff --git a/ext/opcache/tests/jit/assign_012.phpt b/ext/opcache/tests/jit/assign_012.phpt
new file mode 100644
index 0000000000..82d42d9b46
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_012.phpt
@@ -0,0 +1,28 @@
+--TEST--
+JIT ASSIGN: 012
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = 0;
+ $c = 2;
+ $d = 3;
+ if ($a) {
+ $b = array();
+ } else {
+ $b =& $c;
+ }
+ $b = $d;
+ var_dump($b, $c);
+}
+foo();
+--EXPECT--
+int(3)
+int(3)
diff --git a/ext/opcache/tests/jit/assign_013.phpt b/ext/opcache/tests/jit/assign_013.phpt
new file mode 100644
index 0000000000..a2da0b34d8
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_013.phpt
@@ -0,0 +1,21 @@
+--TEST--
+JIT ASSIGN: 013
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = array();
+ $b = 2;
+ $c = $a = $b;
+ var_dump($c);
+}
+foo();
+--EXPECT--
+int(2)
diff --git a/ext/opcache/tests/jit/assign_014.phpt b/ext/opcache/tests/jit/assign_014.phpt
new file mode 100644
index 0000000000..0313753aff
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_014.phpt
@@ -0,0 +1,22 @@
+--TEST--
+JIT ASSIGN: 014
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = 1;
+ $b = array();
+ $c = $a = $b;
+ var_dump($c);
+}
+foo();
+--EXPECT--
+array(0) {
+}
diff --git a/ext/opcache/tests/jit/assign_015.phpt b/ext/opcache/tests/jit/assign_015.phpt
new file mode 100644
index 0000000000..248259e328
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_015.phpt
@@ -0,0 +1,21 @@
+--TEST--
+JIT ASSIGN: 015
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = 1;
+ $b = 2;
+ $c = $a = $b;
+ var_dump($c);
+}
+foo();
+--EXPECT--
+int(2)
diff --git a/ext/opcache/tests/jit/assign_016.phpt b/ext/opcache/tests/jit/assign_016.phpt
new file mode 100644
index 0000000000..a2ba0e0a7f
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_016.phpt
@@ -0,0 +1,21 @@
+--TEST--
+JIT ASSIGN: 016
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = 1;
+ $b = 2;
+ $c = $a = $b;
+ return $c;
+}
+var_dump(foo());
+--EXPECT--
+int(2)
diff --git a/ext/opcache/tests/jit/assign_017.phpt b/ext/opcache/tests/jit/assign_017.phpt
new file mode 100644
index 0000000000..7aafdefd70
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_017.phpt
@@ -0,0 +1,21 @@
+--TEST--
+JIT ASSIGN: 017
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = array();
+ $b = 2;
+ $c = $a = $b;
+ return $c;
+}
+var_dump(foo());
+--EXPECT--
+int(2)
diff --git a/ext/opcache/tests/jit/assign_018.phpt b/ext/opcache/tests/jit/assign_018.phpt
new file mode 100644
index 0000000000..8b19921e28
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_018.phpt
@@ -0,0 +1,26 @@
+--TEST--
+JIT ASSIGN: 018
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $c = array();
+ $d = $c;
+ $a = 1;
+ $b = 2;
+ $c = $a = $b;
+ var_dump($c, $d);
+}
+foo();
+--EXPECT--
+int(2)
+array(0) {
+}
+
diff --git a/ext/opcache/tests/jit/assign_019.phpt b/ext/opcache/tests/jit/assign_019.phpt
new file mode 100644
index 0000000000..6c84c4fbad
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_019.phpt
@@ -0,0 +1,24 @@
+--TEST--
+JIT ASSIGN: 019
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $c = array();
+ $d =& $c;
+ $a = 1;
+ $b = 2;
+ $c = $a = $b;
+ var_dump($c, $d);
+}
+foo();
+--EXPECT--
+int(2)
+int(2)
diff --git a/ext/opcache/tests/jit/assign_020.phpt b/ext/opcache/tests/jit/assign_020.phpt
new file mode 100644
index 0000000000..6d1ccc89b2
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_020.phpt
@@ -0,0 +1,22 @@
+--TEST--
+JIT ASSIGN: 020
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $c = array();
+ $a = 1;
+ $b = 2;
+ $c = $a = $b;
+ var_dump($c);
+}
+foo();
+--EXPECT--
+int(2)
diff --git a/ext/opcache/tests/jit/assign_021.phpt b/ext/opcache/tests/jit/assign_021.phpt
new file mode 100644
index 0000000000..caad315d3e
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_021.phpt
@@ -0,0 +1,24 @@
+--TEST--
+JIT ASSIGN: 021
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = array();
+ $b = $a;
+ $c = 1;
+ $d = $a = $c;
+ var_dump($b, $d);
+}
+foo();
+--EXPECT--
+array(0) {
+}
+int(1)
diff --git a/ext/opcache/tests/jit/assign_022.phpt b/ext/opcache/tests/jit/assign_022.phpt
new file mode 100644
index 0000000000..8298c28b22
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_022.phpt
@@ -0,0 +1,24 @@
+--TEST--
+JIT ASSIGN: 022
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = array(1);
+ $a[0] = $undef;
+ for($i=0; $i<6; $i++) {
+ $undef = 1;
+ }
+}
+foo();
+echo "ok\n";
+--EXPECTF--
+Warning: Undefined variable: undef in %s on line %d
+ok
diff --git a/ext/opcache/tests/jit/assign_023.phpt b/ext/opcache/tests/jit/assign_023.phpt
new file mode 100644
index 0000000000..e1211f5569
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_023.phpt
@@ -0,0 +1,24 @@
+--TEST--
+JIT ASSIGN: 023
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = array(1);
+ $a = $undef;
+ for($i=0; $i<6; $i++) {
+ $undef = 1;
+ }
+}
+foo();
+echo "ok\n";
+--EXPECTF--
+Warning: Undefined variable: undef in %s on line %d
+ok
diff --git a/ext/opcache/tests/jit/assign_024.phpt b/ext/opcache/tests/jit/assign_024.phpt
new file mode 100644
index 0000000000..f77296f84d
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_024.phpt
@@ -0,0 +1,23 @@
+--TEST--
+JIT ASSIGN: 024
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = $undef;
+ for($i=0; $i<6; $i++) {
+ $undef = 1;
+ }
+}
+foo();
+echo "ok\n";
+--EXPECTF--
+Warning: Undefined variable: undef in %s on line %d
+ok
diff --git a/ext/opcache/tests/jit/assign_025.phpt b/ext/opcache/tests/jit/assign_025.phpt
new file mode 100644
index 0000000000..9bafa43cb6
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_025.phpt
@@ -0,0 +1,24 @@
+--TEST--
+JIT ASSIGN: 025
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $arr[0][0] = $ref;
+ for($cnt=0;$cnt<6;$cnt++) {
+ $ref = 1;
+ $arr[0][0] = $ref;
+ }
+}
+foo();
+echo "ok\n";
+--EXPECTF--
+Warning: Undefined variable: ref in %s on line %d
+ok
diff --git a/ext/opcache/tests/jit/assign_026.phpt b/ext/opcache/tests/jit/assign_026.phpt
new file mode 100644
index 0000000000..160d066b51
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_026.phpt
@@ -0,0 +1,25 @@
+--TEST--
+JIT ASSIGN: 026
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = array(1,2,3);
+ $b=&$a;
+ $b=1;
+ $a = new stdClass;
+ $a->a=1;
+ $a->b=2;
+ $b=&$a;
+}
+foo();
+echo "ok\n";
+--EXPECT--
+ok
diff --git a/ext/opcache/tests/jit/assign_027.phpt b/ext/opcache/tests/jit/assign_027.phpt
new file mode 100644
index 0000000000..a704e3cdd6
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_027.phpt
@@ -0,0 +1,22 @@
+--TEST--
+JIT ASSIGN: 027
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $persons = 2;
+ for ($i=0; $i<$persons; $i++) {
+ $children = 2;
+ }
+}
+foo();
+echo "ok\n";
+--EXPECT--
+ok
diff --git a/ext/opcache/tests/jit/assign_028.phpt b/ext/opcache/tests/jit/assign_028.phpt
new file mode 100644
index 0000000000..95f076b206
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_028.phpt
@@ -0,0 +1,21 @@
+--TEST--
+JIT ASSIGN: 028
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ var_dump($i=1);
+ return $i;
+}
+var_dump(foo());
+--EXPECT--
+int(1)
+int(1)
diff --git a/ext/opcache/tests/jit/assign_029.phpt b/ext/opcache/tests/jit/assign_029.phpt
new file mode 100644
index 0000000000..d79d235c7f
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_029.phpt
@@ -0,0 +1,22 @@
+--TEST--
+JIT ASSIGN: 029
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $i = 1;
+ var_dump($i=2);
+ return $i;
+}
+var_dump(foo());
+--EXPECT--
+int(2)
+int(2)
diff --git a/ext/opcache/tests/jit/assign_030.phpt b/ext/opcache/tests/jit/assign_030.phpt
new file mode 100644
index 0000000000..4f87b10f11
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_030.phpt
@@ -0,0 +1,23 @@
+--TEST--
+JIT ASSIGN: 030
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $i = 1;
+ $x = 2;
+ var_dump($i=$x);
+ return $i;
+}
+var_dump(foo());
+--EXPECT--
+int(2)
+int(2)
diff --git a/ext/opcache/tests/jit/assign_031.phpt b/ext/opcache/tests/jit/assign_031.phpt
new file mode 100644
index 0000000000..7a2b3ad582
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_031.phpt
@@ -0,0 +1,19 @@
+--TEST--
+JIT ASSIGN: 031
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$c =& $a;
+$b = $a;
+echo "ok\n";
+?>
+--EXPECT--
+ok
diff --git a/ext/opcache/tests/jit/assign_032.phpt b/ext/opcache/tests/jit/assign_032.phpt
new file mode 100644
index 0000000000..448f924aed
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_032.phpt
@@ -0,0 +1,27 @@
+--TEST--
+JIT ASSIGN: 032
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$var = "intergalactic";
+$var1 = "space";
+$var2 = &$var1;
+$var = $var2;
+var_dump($var);
+var_dump($var1);
+var_dump($var2);
+echo "Done\n";
+?>
+--EXPECT--
+string(5) "space"
+string(5) "space"
+string(5) "space"
+Done
diff --git a/ext/opcache/tests/jit/assign_033.phpt b/ext/opcache/tests/jit/assign_033.phpt
new file mode 100644
index 0000000000..918f3b6b57
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_033.phpt
@@ -0,0 +1,24 @@
+--TEST--
+JIT ASSIGN: 033
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo()
+{
+ $mode = 0;
+ $working = 0;
+ while ($mode == 0) {
+ $working = $mode = 1;
+ }
+}
+echo "ok\n";
+--EXPECT--
+ok
diff --git a/ext/opcache/tests/jit/assign_034.phpt b/ext/opcache/tests/jit/assign_034.phpt
new file mode 100644
index 0000000000..4fa7af3e9f
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_034.phpt
@@ -0,0 +1,21 @@
+--TEST--
+JIT ASSIGN: 034
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function bar() {
+ $a = strlen("a");
+ $a++;
+ return $a;
+}
+var_dump(bar());
+--EXPECT--
+int(2)
diff --git a/ext/opcache/tests/jit/assign_035.phpt b/ext/opcache/tests/jit/assign_035.phpt
new file mode 100644
index 0000000000..aebefc4391
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_035.phpt
@@ -0,0 +1,39 @@
+--TEST--
+JIT ASSIGN: Segfault & memleak if no RC info
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+class A {
+
+ public function test() {
+ $closure = function() { return "string"; };
+
+ $arr = [
+ 'a' => $closure(),
+ 'b' => [$closure() => [],],
+ ];
+
+ $x = $arr;
+ unset($x['b'][$closure()]['d']);
+
+ $x = $arr;
+ $x['a'] = $closure();
+
+ return "okey";
+ }
+}
+
+$a = new A();
+echo $a->test();
+?>
+--EXPECT--
+okey
diff --git a/ext/opcache/tests/jit/assign_036.phpt b/ext/opcache/tests/jit/assign_036.phpt
new file mode 100644
index 0000000000..f7065f0d5e
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_036.phpt
@@ -0,0 +1,43 @@
+--TEST--
+JIT ASSIGN: Assign with INTERNED string(no RC)
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+class A {
+ public $result = "string";
+ function __set($propName, $propValue)
+ {
+ $oldType = \gettype($this->$propName);
+ $newType = \gettype($propValue);
+ if ($propValue === 'false')
+ {
+ $newType = 'boolean';
+ $propValue = \false;
+ }
+ elseif ($propValue === 'true')
+ {
+ $newType = 'boolean';
+ $propValue = \true;
+ }
+ if ($oldType !== $newType)
+ {
+ $tmp = $propValue;
+ \settype($tmp, $newType);
+ }
+ $this->propName = $propValue;
+ }
+}
+$a = new A;
+$a->result = "okey";
+echo $a->result;
+?>
+--EXPECT--
+okey
diff --git a/ext/opcache/tests/jit/assign_dim_002.phpt b/ext/opcache/tests/jit/assign_dim_002.phpt
new file mode 100644
index 0000000000..135df92123
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_dim_002.phpt
@@ -0,0 +1,137 @@
+--TEST--
+JIT ASSIGN_DIM: 002
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $var[] = 1;
+ var_dump($var);
+}
+foo();
+
+function foo1() {
+ $var1[] = true;
+ var_dump($var1);
+}
+foo1();
+
+function foo2() {
+ $var2[] = array();
+ var_dump($var2);
+}
+foo2();
+
+function foo3() {
+ $array = array(PHP_INT_MAX => "dummy");
+ try {
+ $array[] = array();
+ } catch (Error $e) {
+ echo $e->getMessage(), "\n";
+ }
+
+ $array = new ArrayObject();
+ $array[index()] = 1;
+ $array[offset()] = 2;
+
+ var_dump($array);
+}
+foo3();
+
+function index() {
+ return 2;
+}
+
+function offset() {
+ return "a";
+}
+
+function foo4() {
+ $array = array();
+ $array[] = array();
+ $array[0][] = 1;
+ $array[0][1] = 1;
+ var_dump($array);
+
+ try {
+ $array[function() {}] = 2;
+ } catch (Error $e) {
+ echo $e->getMessage(), "\n";
+ }
+ var_dump($array);
+
+ $array2[][] = 3;
+ var_dump($array);
+}
+foo4();
+
+function foo5() {
+ $a = 1;
+ try {
+ $a[2] = 1;
+ } catch (Error $e) {
+ echo $e->getMessage(), "\n";
+ }
+ return $a;
+}
+var_dump(foo5());
+
+--EXPECTF--
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ bool(true)
+}
+array(1) {
+ [0]=>
+ array(0) {
+ }
+}
+Cannot add element to the array as the next element is already occupied
+object(ArrayObject)#%d (1) {
+ ["storage":"ArrayObject":private]=>
+ array(2) {
+ [2]=>
+ int(1)
+ ["a"]=>
+ int(2)
+ }
+}
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ }
+}
+Illegal offset type
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ }
+}
+array(1) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ }
+}
+Cannot use a scalar value as an array
+int(1)
diff --git a/ext/opcache/tests/jit/bug77857.phpt b/ext/opcache/tests/jit/bug77857.phpt
new file mode 100644
index 0000000000..9b9a80f533
--- /dev/null
+++ b/ext/opcache/tests/jit/bug77857.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Bug #77857 (Wrong result if executed with JIT)
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=64
+opcache.jit=1205
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function test() {
+ $arr = array_fill(0, 1, 1.0);
+ $y = 0.0;
+ foreach ($arr as $v) {
+ $tmp = 1.0 * $v;
+ var_dump($tmp);
+ $y = $tmp/1.0;
+ }
+ return $y;
+}
+var_dump(test());
+?>
+--EXPECTF--
+float(1)
+float(1)
diff --git a/ext/opcache/tests/jit/cmp_001.phpt b/ext/opcache/tests/jit/cmp_001.phpt
new file mode 100644
index 0000000000..7cbe312ca1
--- /dev/null
+++ b/ext/opcache/tests/jit/cmp_001.phpt
@@ -0,0 +1,24 @@
+--TEST--
+JIT CMP: 001
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$a = 0;
+$b = 0.0;
+var_dump($a < $b);
+var_dump($a > $b);
+var_dump($a <= $b);
+var_dump($a >= $b);
+?>
+--EXPECT--
+bool(false)
+bool(false)
+bool(true)
+bool(true)
diff --git a/ext/opcache/tests/jit/cmp_002.phpt b/ext/opcache/tests/jit/cmp_002.phpt
new file mode 100644
index 0000000000..8b02c975cd
--- /dev/null
+++ b/ext/opcache/tests/jit/cmp_002.phpt
@@ -0,0 +1,24 @@
+--TEST--
+JIT CMP: 001
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$a = 0;
+$b = 0.0;
+var_dump($a < $b ? 1 : 0);
+var_dump($a > $b ? 1 : 0);
+var_dump($a <= $b ? 1 : 0);
+var_dump($a >= $b ? 1 : 0);
+?>
+--EXPECT--
+int(0)
+int(0)
+int(1)
+int(1)
diff --git a/ext/opcache/tests/jit/cmp_003.phpt b/ext/opcache/tests/jit/cmp_003.phpt
new file mode 100644
index 0000000000..60698dea04
--- /dev/null
+++ b/ext/opcache/tests/jit/cmp_003.phpt
@@ -0,0 +1,194 @@
+--TEST--
+JIT CMP: 003 Comparisoin with NaN
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function t() {
+ echo "!";
+ return true;
+}
+function f() {
+ echo "!";
+ return false;
+}
+$a = 0.0;
+$i = 0;
+$b = NAN;
+$c = true;
+$d = false;
+var_dump($a == $b);
+var_dump($a != $b);
+var_dump($a < $b);
+var_dump($a > $b);
+var_dump($a <= $b);
+var_dump($a >= $b);
+var_dump($a == $b ? 1 : 0);
+var_dump($a != $b ? 1 : 0);
+var_dump($a < $b ? 1 : 0);
+var_dump($a > $b ? 1 : 0);
+var_dump($a <= $b ? 1 : 0);
+var_dump($a >= $b ? 1 : 0);
+if ($a == $b) {
+} else {
+ echo "1\n";
+}
+if ($a != $b) {
+} else {
+ echo "2\n";
+}
+if ($a < $b) {
+} else {
+ echo "3\n";
+}
+if ($a > $b) {
+} else {
+ echo "4\n";
+}
+if ($a <= $b) {
+} else {
+ echo "5\n";
+}
+if ($a >= $b) {
+} else {
+ echo "6\n";
+}
+var_dump($i == $b ? 1 : 0);
+var_dump($i != $b ? 1 : 0);
+var_dump($i < $b ? 1 : 0);
+var_dump($i > $b ? 1 : 0);
+var_dump($i <= $b ? 1 : 0);
+var_dump($i >= $b ? 1 : 0);
+if ($i == $b) {
+} else {
+ echo "1\n";
+}
+if ($i != $b) {
+} else {
+ echo "2\n";
+}
+if ($i < $b) {
+} else {
+ echo "3\n";
+}
+if ($i > $b) {
+} else {
+ echo "4\n";
+}
+if ($i <= $b) {
+} else {
+ echo "5\n";
+}
+if ($i >= $b) {
+} else {
+ echo "6\n";
+}
+var_dump($a == $b && t());
+var_dump($a != $b && t());
+var_dump($a < $b && t());
+var_dump($a > $b && t());
+var_dump($a <= $b && t());
+var_dump($a >= $b && t());
+var_dump($a == $b || f());
+var_dump($a != $b || f());
+var_dump($a < $b || f());
+var_dump($a > $b || f());
+var_dump($a <= $b || f());
+var_dump($a >= $b || f());
+var_dump($i == $b && t());
+var_dump($i != $b && t());
+var_dump($i < $b && t());
+var_dump($i > $b && t());
+var_dump($i <= $b && t());
+var_dump($i >= $b && t());
+var_dump($i == $b || f());
+var_dump($i != $b || f());
+var_dump($i < $b || f());
+var_dump($i > $b || f());
+var_dump($i <= $b || f());
+var_dump($i >= $b || f());
+$a=NAN;
+var_dump($a == $b);
+var_dump($a != $b);
+var_dump($a < $b);
+var_dump($a > $b);
+var_dump($a <= $b);
+var_dump($a >= $b);
+var_dump($a == $b ? 1 : 0);
+var_dump($a != $b ? 1 : 0);
+var_dump($a < $b ? 1 : 0);
+var_dump($a > $b ? 1 : 0);
+var_dump($a <= $b ? 1 : 0);
+var_dump($a >= $b ? 1 : 0);
+?>
+--EXPECT--
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+1
+3
+4
+5
+6
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
+1
+3
+4
+5
+6
+bool(false)
+!bool(true)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+!bool(false)
+bool(true)
+!bool(false)
+!bool(false)
+!bool(false)
+!bool(false)
+bool(false)
+!bool(true)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+!bool(false)
+bool(true)
+!bool(false)
+!bool(false)
+!bool(false)
+!bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+int(0)
+int(1)
+int(0)
+int(0)
+int(0)
+int(0)
diff --git a/ext/opcache/tests/jit/cmp_004.phpt b/ext/opcache/tests/jit/cmp_004.phpt
new file mode 100644
index 0000000000..9a5772e378
--- /dev/null
+++ b/ext/opcache/tests/jit/cmp_004.phpt
@@ -0,0 +1,22 @@
+--TEST--
+JIT CMP: 004 Comparisons inside conditional statement
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo(bool $test, int $x) {
+ if (($test ? $x >= 1 : $x > 1)) {
+ return 1;
+ }
+ return 0;
+}
+var_dump(foo(true, 9));
+?>
+--EXPECT--
+int(1)
diff --git a/ext/opcache/tests/jit/const_001.phpt b/ext/opcache/tests/jit/const_001.phpt
new file mode 100644
index 0000000000..67c9a0d121
--- /dev/null
+++ b/ext/opcache/tests/jit/const_001.phpt
@@ -0,0 +1,26 @@
+--TEST--
+JIT CONST: defined
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function define_const() {
+ define("CUSTOM_CONSTANT", 1);
+}
+function test_defined() {
+ var_dump(defined("CUSTOM_CONSTANT"));
+ define_const();
+ var_dump(defined("CUSTOM_CONSTANT"));
+}
+
+test_defined();
+?>
+--EXPECT--
+bool(false)
+bool(true)
diff --git a/ext/opcache/tests/jit/defined_001.phpt b/ext/opcache/tests/jit/defined_001.phpt
new file mode 100644
index 0000000000..76da7760c6
--- /dev/null
+++ b/ext/opcache/tests/jit/defined_001.phpt
@@ -0,0 +1,38 @@
+--TEST--
+JIT DEFINED: 001
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.jit=1235
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo($i) {
+ $a = defined("X");
+ $b = defined("X");
+ if (defined("X")) {
+ $c = 1;
+ } else {
+ $c = 0;
+ }
+ if (!defined("X")) {
+ $d = 0;
+ } else {
+ $d = 1;
+ }
+ if ($a || $b || $c || $d) {
+
+ die("Error on $i-th iteration\n");
+ }
+
+}
+for ($i = 0; $i < 10000; $i++) {
+ foo($i);
+}
+echo "ok\n";
+?>
+--EXPECT--
+ok
diff --git a/ext/opcache/tests/jit/fetch_dim_func_args_001.phpt b/ext/opcache/tests/jit/fetch_dim_func_args_001.phpt
new file mode 100644
index 0000000000..b2e58c44b4
--- /dev/null
+++ b/ext/opcache/tests/jit/fetch_dim_func_args_001.phpt
@@ -0,0 +1,26 @@
+--TEST--
+JIT FETCH_DIM_FUNC_ARG: 001
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+namespace A;
+
+class A {
+ public function change(array $config) {
+ $config['keys'] = array_keys($config["a"]);;
+ }
+}
+
+$a = new A();
+
+$a->change($a = array("a" => range(1, 5)));
+?>
+okey
+--EXPECT--
+okey
diff --git a/ext/opcache/tests/jit/fetch_dim_r_001.phpt b/ext/opcache/tests/jit/fetch_dim_r_001.phpt
new file mode 100644
index 0000000000..232f62cf75
--- /dev/null
+++ b/ext/opcache/tests/jit/fetch_dim_r_001.phpt
@@ -0,0 +1,45 @@
+--TEST--
+JIT FETCH_DIM_R: 001
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = array(1,2,3,""=>4,"ab"=>5,"2x"=>6);
+ var_dump($a[0]);
+ var_dump($a[2]);
+ var_dump($a[1.0]);
+ var_dump($a["0"]);
+ var_dump($a["2"]);
+ var_dump($a[false]);
+ var_dump($a[true]);
+ var_dump($a[null]);
+ var_dump($a["ab"]);
+ $x = "a";
+ $y = "b";
+ var_dump($a[$x . $y]);
+ var_dump($a["2x"]);
+ $x = "2";
+ $y = "x";
+ var_dump($a[$x . $y]);
+}
+foo();
+--EXPECT--
+int(1)
+int(3)
+int(2)
+int(1)
+int(3)
+int(1)
+int(2)
+int(4)
+int(5)
+int(5)
+int(6)
+int(6)
diff --git a/ext/opcache/tests/jit/fetch_dim_r_002.phpt b/ext/opcache/tests/jit/fetch_dim_r_002.phpt
new file mode 100644
index 0000000000..178071b115
--- /dev/null
+++ b/ext/opcache/tests/jit/fetch_dim_r_002.phpt
@@ -0,0 +1,45 @@
+--TEST--
+JIT FETCH_DIM_R: 002
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo($n) {
+ $a = array(1,2,3,""=>4,"ab"=>5,"2x"=>6);
+ var_dump($a[$n]);
+}
+foo(0);
+foo(2);
+foo(1.0);
+foo("0");
+foo("2");
+foo(false);
+foo(true);
+foo(null);
+foo("ab");
+$x="a";
+$y="b";
+foo($x.$y);
+foo("2x");
+$x=2;
+$y="x";
+foo($x.$y);
+--EXPECT--
+int(1)
+int(3)
+int(2)
+int(1)
+int(3)
+int(1)
+int(2)
+int(4)
+int(5)
+int(5)
+int(6)
+int(6)
diff --git a/ext/opcache/tests/jit/fetch_dim_r_003.phpt b/ext/opcache/tests/jit/fetch_dim_r_003.phpt
new file mode 100644
index 0000000000..2638715236
--- /dev/null
+++ b/ext/opcache/tests/jit/fetch_dim_r_003.phpt
@@ -0,0 +1,61 @@
+--TEST--
+JIT FETCH_DIM_R: 003
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a = "ABCDEF";
+ var_dump($a[0]);
+ var_dump($a[2]);
+ var_dump($a[1.0]);
+ var_dump($a["0"]);
+ var_dump($a["2"]);
+ var_dump($a[false]);
+ var_dump($a[true]);
+ var_dump($a[null]);
+ var_dump($a["ab"]);
+ $x = "a";
+ $y = "b";
+ var_dump($a[$x . $y]);
+ var_dump($a["2x"]);
+ $x = "2";
+ $y = "x";
+ var_dump($a[$x . $y]);
+}
+foo();
+--EXPECTF--
+string(1) "A"
+string(1) "C"
+
+Warning: String offset cast occurred in %s on line %d
+string(1) "B"
+string(1) "A"
+string(1) "C"
+
+Warning: String offset cast occurred in %s on line %d
+string(1) "A"
+
+Warning: String offset cast occurred in %s on line %d
+string(1) "B"
+
+Warning: String offset cast occurred in %s on line %d
+string(1) "A"
+
+Warning: Illegal string offset 'ab' in %sfetch_dim_r_003.php on line 12
+string(1) "A"
+
+Warning: Illegal string offset 'ab' in %sfetch_dim_r_003.php on line 15
+string(1) "A"
+
+Notice: A non well formed numeric value encountered in %sfetch_dim_r_003.php on line 16
+string(1) "C"
+
+Notice: A non well formed numeric value encountered in %sfetch_dim_r_003.php on line 19
+string(1) "C"
diff --git a/ext/opcache/tests/jit/fetch_dim_r_004.phpt b/ext/opcache/tests/jit/fetch_dim_r_004.phpt
new file mode 100644
index 0000000000..0fd705942e
--- /dev/null
+++ b/ext/opcache/tests/jit/fetch_dim_r_004.phpt
@@ -0,0 +1,61 @@
+--TEST--
+JIT FETCH_DIM_R: 004
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo($n) {
+ $a = "ABCDEF";
+ var_dump($a[$n]);
+}
+foo(0);
+foo(2);
+foo(1.0);
+foo("0");
+foo("2");
+foo(false);
+foo(true);
+foo(null);
+foo("ab");
+$x="a";
+$y="b";
+foo($x.$y);
+foo("2x");
+$x=2;
+$y="x";
+foo($x.$y);
+--EXPECTF--
+string(1) "A"
+string(1) "C"
+
+Warning: String offset cast occurred in %s on line %d
+string(1) "B"
+string(1) "A"
+string(1) "C"
+
+Warning: String offset cast occurred in %s on line %d
+string(1) "A"
+
+Warning: String offset cast occurred in %s on line %d
+string(1) "B"
+
+Warning: String offset cast occurred in %s on line %d
+string(1) "A"
+
+Warning: Illegal string offset 'ab' in %sfetch_dim_r_004.php on line 4
+string(1) "A"
+
+Warning: Illegal string offset 'ab' in %sfetch_dim_r_004.php on line 4
+string(1) "A"
+
+Notice: A non well formed numeric value encountered in %sfetch_dim_r_004.php on line 4
+string(1) "C"
+
+Notice: A non well formed numeric value encountered in %sfetch_dim_r_004.php on line 4
+string(1) "C"
diff --git a/ext/opcache/tests/jit/fetch_dim_rw_001.phpt b/ext/opcache/tests/jit/fetch_dim_rw_001.phpt
new file mode 100644
index 0000000000..39b9fd33ff
--- /dev/null
+++ b/ext/opcache/tests/jit/fetch_dim_rw_001.phpt
@@ -0,0 +1,27 @@
+--TEST--
+JIT FETCH_DIM_RW: 001
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $a[0][0] += 2;
+ return $a[0];
+}
+var_dump(foo());
+--EXPECTF--
+Warning: Undefined variable: a in %s on line %d
+
+Notice: Undefined offset: 0 in %sfetch_dim_rw_001.php on line 3
+
+Notice: Undefined offset: 0 in %sfetch_dim_rw_001.php on line 3
+array(1) {
+ [0]=>
+ int(2)
+}
diff --git a/ext/opcache/tests/jit/fetch_obj_001.phpt b/ext/opcache/tests/jit/fetch_obj_001.phpt
new file mode 100644
index 0000000000..d309442187
--- /dev/null
+++ b/ext/opcache/tests/jit/fetch_obj_001.phpt
@@ -0,0 +1,137 @@
+--TEST--
+JIT: FETCH_OBJ
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo(&$a) {
+ $a = 2;
+}
+
+function foo2(&$a) {
+ $a = array();
+}
+
+function foo3(&$a, $var) {
+ $a = $var;
+}
+
+$obj = new stdClass;
+foo($obj->a);
+var_dump($obj);
+foo2($obj->b);
+var_dump($obj);
+foo3($obj->a, "2" . "3");
+foo3($obj->a, $obj->b);
+var_dump($obj);
+
+$a = &$obj->a;
+$a = fopen(__FILE__, "r");
+var_dump($obj);
+
+function bar() {
+ $obj = new stdClass;
+ foo($obj->a);
+ var_dump($obj);
+ foo2($obj->b);
+ var_dump($obj);
+ foo3($obj->a, "2" . "3");
+ foo3($obj->a, $obj->b);
+ var_dump($obj);
+
+ $a = &$obj->a;
+ $a = fopen(__FILE__, "r");
+ var_dump($obj);
+
+ $d = array();
+ try {
+ foo($d->{"ab" ."c"});
+ } catch (Error $err) {
+ echo $err->getMessage(), "\n";
+ }
+ var_dump($d);
+
+ $e = NULL;
+ try {
+ foo($e->{"ab" ."c"});
+ } catch (Error $err) {
+ echo $err->getMessage(), "\n";
+ }
+ var_dump($e);
+
+ $f = "";
+ try {
+ foo($f->{"ab" ."c"});
+ } catch (Error $err) {
+ echo $err->getMessage(), "\n";
+ }
+ var_dump($f);
+}
+
+bar();
+?>
+--EXPECTF--
+object(stdClass)#%d (1) {
+ ["a"]=>
+ int(2)
+}
+object(stdClass)#%d (2) {
+ ["a"]=>
+ int(2)
+ ["b"]=>
+ array(0) {
+ }
+}
+object(stdClass)#%d (2) {
+ ["a"]=>
+ array(0) {
+ }
+ ["b"]=>
+ array(0) {
+ }
+}
+object(stdClass)#%d (2) {
+ ["a"]=>
+ &resource(5) of type (stream)
+ ["b"]=>
+ array(0) {
+ }
+}
+object(stdClass)#%d (1) {
+ ["a"]=>
+ int(2)
+}
+object(stdClass)#%d (2) {
+ ["a"]=>
+ int(2)
+ ["b"]=>
+ array(0) {
+ }
+}
+object(stdClass)#%d (2) {
+ ["a"]=>
+ array(0) {
+ }
+ ["b"]=>
+ array(0) {
+ }
+}
+object(stdClass)#%d (2) {
+ ["a"]=>
+ &resource(6) of type (stream)
+ ["b"]=>
+ array(0) {
+ }
+}
+Attempt to modify property 'abc' of non-object
+array(0) {
+}
+Attempt to modify property 'abc' of non-object
+NULL
+Attempt to modify property 'abc' of non-object
+string(0) ""
diff --git a/ext/opcache/tests/jit/fetch_obj_002.phpt b/ext/opcache/tests/jit/fetch_obj_002.phpt
new file mode 100644
index 0000000000..463ff01b26
--- /dev/null
+++ b/ext/opcache/tests/jit/fetch_obj_002.phpt
@@ -0,0 +1,41 @@
+--TEST--
+JIT: FETCH_OBJ 002
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+class A {
+ public $x = 2;
+}
+
+class B {
+ public $x = 3;
+ public function __get($name) {
+ var_dump("__get");
+ }
+}
+
+function bar() {
+ $a = new A();
+ var_dump($a->x);
+ var_dump($a->y);
+ $b = new B();
+ var_dump($b->x);
+ unset($b->x);
+ $b->x;
+}
+
+bar();
+?>
+--EXPECTF--
+int(2)
+
+Warning: Undefined property: A::$y in %s on line %d
+NULL
+int(3)
+string(5) "__get"
diff --git a/ext/opcache/tests/jit/fetch_obj_003.phpt b/ext/opcache/tests/jit/fetch_obj_003.phpt
new file mode 100644
index 0000000000..de51b45fa7
--- /dev/null
+++ b/ext/opcache/tests/jit/fetch_obj_003.phpt
@@ -0,0 +1,46 @@
+--TEST--
+JIT: FETCH_OBJ 003
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+class C {
+ var $a = 0;
+}
+function foo() {
+ $x = new C;
+ $x->a = 1;
+ unset($x->a);
+ $x->a += 2;
+ var_dump($x);
+}
+function bar() {
+ $x = new C;
+ $x->a = 1;
+ $x->b = 2;
+ unset($x->a);
+ $x->a += 2;
+ var_dump($x);
+}
+foo();
+bar();
+?>
+--EXPECTF--
+Warning: Undefined property: C::$a in %s on line %d
+object(C)#1 (1) {
+ ["a"]=>
+ int(2)
+}
+
+Warning: Undefined property: C::$a in %s on line %d
+object(C)#1 (2) {
+ ["a"]=>
+ int(2)
+ ["b"]=>
+ int(2)
+}
diff --git a/ext/opcache/tests/jit/fetch_obj_004.phpt b/ext/opcache/tests/jit/fetch_obj_004.phpt
new file mode 100644
index 0000000000..ec4d74f0e6
--- /dev/null
+++ b/ext/opcache/tests/jit/fetch_obj_004.phpt
@@ -0,0 +1,43 @@
+--TEST--
+JIT: FETCH_OBJ 004
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+class C {
+ var $a = 0;
+}
+function foo() {
+ $x = new C;
+ $x->a = 1;
+ unset($x->a);
+ $x->a = 3;
+ var_dump($x);
+}
+function bar() {
+ $x = new C;
+ $x->a = 1;
+ $x->b = 2;
+ unset($x->a);
+ $x->a = 3;
+ var_dump($x);
+}
+foo();
+bar();
+?>
+--EXPECT--
+object(C)#1 (1) {
+ ["a"]=>
+ int(3)
+}
+object(C)#1 (2) {
+ ["a"]=>
+ int(3)
+ ["b"]=>
+ int(2)
+}
diff --git a/ext/opcache/tests/jit/inc_001.phpt b/ext/opcache/tests/jit/inc_001.phpt
new file mode 100644
index 0000000000..c3807303e7
--- /dev/null
+++ b/ext/opcache/tests/jit/inc_001.phpt
@@ -0,0 +1,22 @@
+--TEST--
+JIT INC: 001
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $x = 1;
+ $x += 0;
+ ++$x; // mem -> mem
+ var_dump($x);
+}
+foo();
+--EXPECT--
+int(2)
diff --git a/ext/opcache/tests/jit/inc_002.phpt b/ext/opcache/tests/jit/inc_002.phpt
new file mode 100644
index 0000000000..4d2757ca75
--- /dev/null
+++ b/ext/opcache/tests/jit/inc_002.phpt
@@ -0,0 +1,21 @@
+--TEST--
+JIT INC: 002
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $x = 1;
+ ++$x; // reg -> mem
+ var_dump($x);
+}
+foo();
+--EXPECT--
+int(2)
diff --git a/ext/opcache/tests/jit/inc_003.phpt b/ext/opcache/tests/jit/inc_003.phpt
new file mode 100644
index 0000000000..9842527be7
--- /dev/null
+++ b/ext/opcache/tests/jit/inc_003.phpt
@@ -0,0 +1,22 @@
+--TEST--
+JIT INC: 003
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $x = 1;
+ $x += 0;
+ ++$x; // mem -> reg
+ return $x;
+}
+var_dump(foo());
+--EXPECT--
+int(2)
diff --git a/ext/opcache/tests/jit/inc_004.phpt b/ext/opcache/tests/jit/inc_004.phpt
new file mode 100644
index 0000000000..6431020537
--- /dev/null
+++ b/ext/opcache/tests/jit/inc_004.phpt
@@ -0,0 +1,21 @@
+--TEST--
+JIT INC: 004
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $x = 1;
+ ++$x; // reg -> reg
+ return $x;
+}
+var_dump(foo());
+--EXPECT--
+int(2)
diff --git a/ext/opcache/tests/jit/inc_005.phpt b/ext/opcache/tests/jit/inc_005.phpt
new file mode 100644
index 0000000000..d784b092e9
--- /dev/null
+++ b/ext/opcache/tests/jit/inc_005.phpt
@@ -0,0 +1,23 @@
+--TEST--
+JIT INC: 005
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $x = 1;
+ $x += 0;
+ var_dump(++$x); // mem -> mem, mem
+ var_dump($x);
+}
+foo();
+--EXPECT--
+int(2)
+int(2)
diff --git a/ext/opcache/tests/jit/inc_006.phpt b/ext/opcache/tests/jit/inc_006.phpt
new file mode 100644
index 0000000000..3ecff9e13d
--- /dev/null
+++ b/ext/opcache/tests/jit/inc_006.phpt
@@ -0,0 +1,22 @@
+--TEST--
+JIT INC: 006
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $x = 1;
+ var_dump(++$x); // reg -> mem, mem
+ var_dump($x);
+}
+foo();
+--EXPECT--
+int(2)
+int(2)
diff --git a/ext/opcache/tests/jit/inc_007.phpt b/ext/opcache/tests/jit/inc_007.phpt
new file mode 100644
index 0000000000..bb1634d731
--- /dev/null
+++ b/ext/opcache/tests/jit/inc_007.phpt
@@ -0,0 +1,21 @@
+--TEST--
+JIT INC: 007
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $x = 1;
+ $x += 0;
+ return ++$x; // mem -> reg, reg
+}
+var_dump(foo());
+--EXPECT--
+int(2)
diff --git a/ext/opcache/tests/jit/inc_008.phpt b/ext/opcache/tests/jit/inc_008.phpt
new file mode 100644
index 0000000000..d008cb094d
--- /dev/null
+++ b/ext/opcache/tests/jit/inc_008.phpt
@@ -0,0 +1,20 @@
+--TEST--
+JIT INC: 008
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $x = 1;
+ return ++$x; // reg -> reg, reg
+}
+var_dump(foo());
+--EXPECT--
+int(2)
diff --git a/ext/opcache/tests/jit/inc_009.phpt b/ext/opcache/tests/jit/inc_009.phpt
new file mode 100644
index 0000000000..e600cba7ad
--- /dev/null
+++ b/ext/opcache/tests/jit/inc_009.phpt
@@ -0,0 +1,22 @@
+--TEST--
+JIT INC: 009
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $x = 1.0;
+ $x += 0;
+ ++$x; // mem -> mem
+ var_dump($x);
+}
+foo();
+--EXPECT--
+float(2)
diff --git a/ext/opcache/tests/jit/inc_010.phpt b/ext/opcache/tests/jit/inc_010.phpt
new file mode 100644
index 0000000000..105387d924
--- /dev/null
+++ b/ext/opcache/tests/jit/inc_010.phpt
@@ -0,0 +1,21 @@
+--TEST--
+JIT INC: 010
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $x = 1.0;
+ ++$x; // reg -> mem
+ var_dump($x);
+}
+foo();
+--EXPECT--
+float(2)
diff --git a/ext/opcache/tests/jit/inc_011.phpt b/ext/opcache/tests/jit/inc_011.phpt
new file mode 100644
index 0000000000..d91c487965
--- /dev/null
+++ b/ext/opcache/tests/jit/inc_011.phpt
@@ -0,0 +1,22 @@
+--TEST--
+JIT INC: 011
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $x = 1.0;
+ $x += 0;
+ ++$x; // mem -> reg
+ return $x;
+}
+var_dump(foo());
+--EXPECT--
+float(2)
diff --git a/ext/opcache/tests/jit/inc_012.phpt b/ext/opcache/tests/jit/inc_012.phpt
new file mode 100644
index 0000000000..14fb5c1b90
--- /dev/null
+++ b/ext/opcache/tests/jit/inc_012.phpt
@@ -0,0 +1,21 @@
+--TEST--
+JIT INC: 012
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $x = 1.0;
+ ++$x; // reg -> reg
+ return $x;
+}
+var_dump(foo());
+--EXPECT--
+float(2)
diff --git a/ext/opcache/tests/jit/inc_013.phpt b/ext/opcache/tests/jit/inc_013.phpt
new file mode 100644
index 0000000000..2c2e5f0920
--- /dev/null
+++ b/ext/opcache/tests/jit/inc_013.phpt
@@ -0,0 +1,23 @@
+--TEST--
+JIT INC: 013
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $x = 1.0;
+ $x += 0;
+ var_dump(++$x); // mem -> mem, mem
+ var_dump($x);
+}
+foo();
+--EXPECT--
+float(2)
+float(2)
diff --git a/ext/opcache/tests/jit/inc_014.phpt b/ext/opcache/tests/jit/inc_014.phpt
new file mode 100644
index 0000000000..e6f31f32f3
--- /dev/null
+++ b/ext/opcache/tests/jit/inc_014.phpt
@@ -0,0 +1,22 @@
+--TEST--
+JIT INC: 014
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $x = 1.0;
+ var_dump(++$x); // reg -> mem, mem
+ var_dump($x);
+}
+foo();
+--EXPECT--
+float(2)
+float(2)
diff --git a/ext/opcache/tests/jit/inc_015.phpt b/ext/opcache/tests/jit/inc_015.phpt
new file mode 100644
index 0000000000..d841dc0c9c
--- /dev/null
+++ b/ext/opcache/tests/jit/inc_015.phpt
@@ -0,0 +1,21 @@
+--TEST--
+JIT INC: 015
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $x = 1.0;
+ $x += 0;
+ return ++$x; // mem -> reg, reg
+}
+var_dump(foo());
+--EXPECT--
+float(2)
diff --git a/ext/opcache/tests/jit/inc_016.phpt b/ext/opcache/tests/jit/inc_016.phpt
new file mode 100644
index 0000000000..c1a6302e92
--- /dev/null
+++ b/ext/opcache/tests/jit/inc_016.phpt
@@ -0,0 +1,20 @@
+--TEST--
+JIT INC: 016
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $x = 1.0;
+ return ++$x; // reg -> reg, reg
+}
+var_dump(foo());
+--EXPECT--
+float(2)
diff --git a/ext/opcache/tests/jit/inc_017.phpt b/ext/opcache/tests/jit/inc_017.phpt
new file mode 100644
index 0000000000..c52e018048
--- /dev/null
+++ b/ext/opcache/tests/jit/inc_017.phpt
@@ -0,0 +1,20 @@
+--TEST--
+JIT INC: 017
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $x = true;
+ return ++$x; // reg -> reg, reg
+}
+var_dump(foo());
+--EXPECT--
+bool(true)
diff --git a/ext/opcache/tests/jit/inc_018.phpt b/ext/opcache/tests/jit/inc_018.phpt
new file mode 100644
index 0000000000..c992fa528d
--- /dev/null
+++ b/ext/opcache/tests/jit/inc_018.phpt
@@ -0,0 +1,20 @@
+--TEST--
+JIT INC: 018
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $x = false;
+ return ++$x; // reg -> reg, reg
+}
+var_dump(foo());
+--EXPECT--
+bool(false)
diff --git a/ext/opcache/tests/jit/inc_019.phpt b/ext/opcache/tests/jit/inc_019.phpt
new file mode 100644
index 0000000000..e147ef6f2f
--- /dev/null
+++ b/ext/opcache/tests/jit/inc_019.phpt
@@ -0,0 +1,27 @@
+--TEST--
+JIT INC: 019
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function bar($b) {
+ if ($b) {
+ $a = 1;
+ } else {
+ $a = 2;
+ }
+ isset($a);
+ var_dump($a++);
+ return $a;
+}
+var_dump(bar(0));
+--EXPECT--
+int(2)
+int(3)
diff --git a/ext/opcache/tests/jit/inc_020.phpt b/ext/opcache/tests/jit/inc_020.phpt
new file mode 100644
index 0000000000..5b3530d6e1
--- /dev/null
+++ b/ext/opcache/tests/jit/inc_020.phpt
@@ -0,0 +1,28 @@
+--TEST--
+JIT INC: 020
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo($row) {
+ foreach ($row as $key => $value) {
+ if (is_int($key)) {
+ $key++;
+ }
+ if (isset($row[$key])) {
+ return false;
+ }
+ }
+ return true;
+}
+?>
+OK
+--EXPECT--
+OK \ No newline at end of file
diff --git a/ext/opcache/tests/jit/jmpz_001.phpt b/ext/opcache/tests/jit/jmpz_001.phpt
new file mode 100644
index 0000000000..2772942f39
--- /dev/null
+++ b/ext/opcache/tests/jit/jmpz_001.phpt
@@ -0,0 +1,26 @@
+--TEST--
+JIT JMPZ: JMPZ may require code for "smart branch" and at the same time be a target of another JMP.
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+namespace A;
+
+function test() {
+
+ $modelData = array();
+ $ret = false ||
+ ((is_array($modelData) || $modelData instanceof \Countable) && true) || false;
+ return $ret;
+}
+
+var_dump(test());
+?>
+--EXPECT--
+bool(true)
diff --git a/ext/opcache/tests/jit/jmpz_ex_001.phpt b/ext/opcache/tests/jit/jmpz_ex_001.phpt
new file mode 100644
index 0000000000..c001fb9b69
--- /dev/null
+++ b/ext/opcache/tests/jit/jmpz_ex_001.phpt
@@ -0,0 +1,32 @@
+--TEST--
+JIT JMPZ_EX: Operand needs to be freed even if same as result
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+class Test {
+ public $prop;
+ public function method() {
+ return $this->prop && $this->prop->method2();
+ }
+}
+
+class Test2 {
+ public function method2() {
+ return true;
+ }
+};
+
+$test = new Test;
+$test->prop = new Test2;
+var_dump($test->method());
+
+?>
+--EXPECT--
+bool(true)
diff --git a/ext/opcache/tests/jit/mod_001.phpt b/ext/opcache/tests/jit/mod_001.phpt
new file mode 100644
index 0000000000..d9dd638f63
--- /dev/null
+++ b/ext/opcache/tests/jit/mod_001.phpt
@@ -0,0 +1,41 @@
+--TEST--
+JIT MOD: 001
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function mod(int $a, int $b) {
+ return $a % $b;
+}
+var_dump(mod(125, 33));
+var_dump(mod(125, 32));
+var_dump(mod(-125, 33));
+var_dump(mod(-125, 32));
+var_dump(mod(125, -33));
+var_dump(mod(-125, -33));
+try {
+ var_dump(mod(125, -1));
+} catch (Throwable $e) {
+ echo "Exception " . $e->getMessage() . "\n";
+}
+try {
+ var_dump(mod(125, 0));
+} catch (Throwable $e) {
+ echo "Exception (" . get_class($e) . "): " . $e->getMessage() . "\n";
+}
+?>
+--EXPECT--
+int(26)
+int(29)
+int(-26)
+int(-29)
+int(26)
+int(-26)
+int(0)
+Exception (DivisionByZeroError): Modulo by zero
diff --git a/ext/opcache/tests/jit/mod_002.phpt b/ext/opcache/tests/jit/mod_002.phpt
new file mode 100644
index 0000000000..9dada5e400
--- /dev/null
+++ b/ext/opcache/tests/jit/mod_002.phpt
@@ -0,0 +1,53 @@
+--TEST--
+JIT MOD: 002
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function mod33(int $a) {
+ return $a % 33;
+}
+function mod32(int $a) {
+ return $a % 32;
+}
+function modNeg33(int $a) {
+ return $a % -33;
+}
+function modNeg1(int $a) {
+ return $a % -1;
+}
+function mod0(int $a) {
+ return $a % 0;
+}
+var_dump(mod33(125));
+var_dump(mod32(125));
+var_dump(mod33(-125));
+var_dump(mod32(-125));
+var_dump(modNeg33(125));
+var_dump(modNeg33(-125));
+try {
+ var_dump(modNeg1(125));
+} catch (Throwable $e) {
+ echo "Exception " . $e->getMessage() . "\n";
+}
+try {
+ var_dump(mod0(125));
+} catch (Throwable $e) {
+ echo "Exception (" . get_class($e) . "): " . $e->getMessage() . "\n";
+}
+?>
+--EXPECT--
+int(26)
+int(29)
+int(-26)
+int(-29)
+int(26)
+int(-26)
+int(0)
+Exception (DivisionByZeroError): Modulo by zero
diff --git a/ext/opcache/tests/jit/noval_001.phpt b/ext/opcache/tests/jit/noval_001.phpt
new file mode 100644
index 0000000000..f3aa4a0d0e
--- /dev/null
+++ b/ext/opcache/tests/jit/noval_001.phpt
@@ -0,0 +1,34 @@
+--TEST--
+JIT NOVAL: 001 (bug in zend_jit_compute_false_dependencies())
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+class Foo {
+ const X = false;
+
+ static function bar() {
+ $count = 0;
+ if (self::X) {
+ $count = intval(9223372036854775807);
+ }
+ if (self::X) {
+ $count = 2;
+ }
+ if ($count != 0) {
+ return "bug";
+ }
+ return "ok";
+ }
+}
+var_dump(Foo::bar());
+--EXPECT--
+string(2) "ok"
+
diff --git a/ext/opcache/tests/jit/recv_001.phpt b/ext/opcache/tests/jit/recv_001.phpt
new file mode 100644
index 0000000000..2213da5f57
--- /dev/null
+++ b/ext/opcache/tests/jit/recv_001.phpt
@@ -0,0 +1,23 @@
+--TEST--
+JIT RECV: infinite loop
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+function test(array $args, $short_options, $long_options = null)
+{
+ echo "okey";
+}
+
+test(array(), "d:e", 222, 3434);
+
+--EXPECT--
+okey
diff --git a/ext/opcache/tests/jit/reg_alloc_001.phpt b/ext/opcache/tests/jit/reg_alloc_001.phpt
new file mode 100644
index 0000000000..609ed8e27f
--- /dev/null
+++ b/ext/opcache/tests/jit/reg_alloc_001.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Register Alloction 001: Spilling in "identical" code
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+class Caster
+{
+ const EXCLUDE_PUBLIC = 8;
+ const EXCLUDE_PRIVATE = 32;
+ const EXCLUDE_STRICT = 512;
+
+ public static function filter(array $a, $filter)
+ {
+ foreach ($a as $k => $v) {
+ if (!isset($k[1])) {
+ $type |= self::EXCLUDE_PUBLIC;
+ } else {
+ $type |= self::EXCLUDE_PRIVATE;
+ }
+
+ if ((self::EXCLUDE_STRICT & $filter) ? $type === $filter : $type) {
+ }
+ }
+
+ return $a;
+ }
+
+}
+?>
+OK
+--EXPECT--
+OK
diff --git a/ext/opcache/tests/jit/reg_alloc_002.phpt b/ext/opcache/tests/jit/reg_alloc_002.phpt
new file mode 100644
index 0000000000..5593156188
--- /dev/null
+++ b/ext/opcache/tests/jit/reg_alloc_002.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Register Alloction 002: SEND_VAL_EX uses %r0 as a temporary register
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+class A {
+ public function process($call) {
+ $i = 0;
+ foreach (array("a", "b", "c") as $attr) {
+ $call($i++, "xxx");
+ }
+ }
+}
+
+$a = new A();
+$a->process(function($i, $v) { var_dump($i); });
+?>
+--EXPECT--
+int(0)
+int(1)
+int(2)
diff --git a/ext/opcache/tests/jit/reg_alloc_003.phpt b/ext/opcache/tests/jit/reg_alloc_003.phpt
new file mode 100644
index 0000000000..f1a90dcec4
--- /dev/null
+++ b/ext/opcache/tests/jit/reg_alloc_003.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Register Alloction 003: Reuse temporary register
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function test($char_code) {
+ if ($char_code == !($char_code & 0xffffff80)) {
+ return "correct";
+ } else {
+ return "wrong";
+ }
+}
+echo test(65), "\n";
+?>
+--EXPECT--
+correct
diff --git a/ext/opcache/tests/jit/send_val_001.phpt b/ext/opcache/tests/jit/send_val_001.phpt
new file mode 100644
index 0000000000..8220b36f1a
--- /dev/null
+++ b/ext/opcache/tests/jit/send_val_001.phpt
@@ -0,0 +1,23 @@
+--TEST--
+JIT SEND_VAL: 001
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo($type) {
+ $key = md5(
+ is_array($type) ? \implode('_', $type) : $type .
+ "ops"
+ );
+ return $key;
+}
+var_dump(foo("int"));
+var_dump(foo(["int"]));
+--EXPECT--
+string(32) "253a948ecc9192cb47e492f692aa63a8"
+string(32) "fa7153f7ed1cb6c0fcf2ffb2fac21748"
diff --git a/ext/opcache/tests/jit/send_var_ex_001.phpt b/ext/opcache/tests/jit/send_var_ex_001.phpt
new file mode 100644
index 0000000000..176f7502f5
--- /dev/null
+++ b/ext/opcache/tests/jit/send_var_ex_001.phpt
@@ -0,0 +1,30 @@
+--TEST--
+JIT SEND_VAR_EX fails on SHOULD_SEND_BY_REF checking
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+;opcache.jit_debug=257
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+namespace A;
+
+class A {
+ private $evalParameters;
+ public function evaluate() {
+ $this->evalParameters = array("a" => "okey");
+ extract($this->evalParameters, EXTR_SKIP);
+ echo $a;
+ return false;
+ }
+}
+
+$a = new A();
+
+$a->evaluate();
+?>
+--EXPECT--
+okey
diff --git a/ext/opcache/tests/jit/shift_left_001.phpt b/ext/opcache/tests/jit/shift_left_001.phpt
new file mode 100644
index 0000000000..4447d0943e
--- /dev/null
+++ b/ext/opcache/tests/jit/shift_left_001.phpt
@@ -0,0 +1,37 @@
+--TEST--
+JIT Shift Left: 001
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function shl(int $a, int $b) {
+ return $a << $b;
+}
+var_dump(shl(1, 0));
+var_dump(shl(1, 1));
+var_dump(shl(1, 2));
+var_dump(shl(-1, 2));
+try {
+ var_dump(shl(1, 64));
+} catch (Throwable $e) {
+ echo "Exception " . $e->getMessage() . "\n";
+}
+try {
+ var_dump(shl(1, -1));
+} catch (Throwable $e) {
+ echo "Exception (" . get_class($e) . "): " . $e->getMessage() . "\n";
+}
+?>
+--EXPECT--
+int(1)
+int(2)
+int(4)
+int(-4)
+int(0)
+Exception (ArithmeticError): Bit shift by negative number
diff --git a/ext/opcache/tests/jit/shift_left_002.phpt b/ext/opcache/tests/jit/shift_left_002.phpt
new file mode 100644
index 0000000000..a6478373b9
--- /dev/null
+++ b/ext/opcache/tests/jit/shift_left_002.phpt
@@ -0,0 +1,49 @@
+--TEST--
+JIT Shift Left: 002
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function shl0(int $a) {
+ return $a << 0;
+}
+function shl1(int $a) {
+ return $a << 1;
+}
+function shl2(int $a) {
+ return $a << 2;
+}
+function shl64(int $a) {
+ return $a << 64;
+}
+function shlNEG(int $a) {
+ return $a << -1;
+}
+var_dump(shl0(1));
+var_dump(shl1(1));
+var_dump(shl2(1));
+var_dump(shl2(-1));
+try {
+ var_dump(shl64(1));
+} catch (Throwable $e) {
+ echo "Exception " . $e->getMessage() . "\n";
+}
+try {
+ var_dump(shlNEG(1));
+} catch (Throwable $e) {
+ echo "Exception (" . get_class($e) . "): " . $e->getMessage() . "\n";
+}
+?>
+--EXPECT--
+int(1)
+int(2)
+int(4)
+int(-4)
+int(0)
+Exception (ArithmeticError): Bit shift by negative number
diff --git a/ext/opcache/tests/jit/shift_right_001.phpt b/ext/opcache/tests/jit/shift_right_001.phpt
new file mode 100644
index 0000000000..01a547b9ea
--- /dev/null
+++ b/ext/opcache/tests/jit/shift_right_001.phpt
@@ -0,0 +1,43 @@
+--TEST--
+JIT Shift Right: 001
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function shr(int $a, int $b) {
+ return $a >> $b;
+}
+var_dump(shr(256, 0));
+var_dump(shr(256, 1));
+var_dump(shr(256, 2));
+var_dump(shr(-8, 2));
+try {
+ var_dump(shr(1, 64));
+} catch (Throwable $e) {
+ echo "Exception " . $e->getMessage() . "\n";
+}
+try {
+ var_dump(shr(-1, 64));
+} catch (Throwable $e) {
+ echo "Exception " . $e->getMessage() . "\n";
+}
+try {
+ var_dump(shr(1, -1));
+} catch (Throwable $e) {
+ echo "Exception (" . get_class($e) . "): " . $e->getMessage() . "\n";
+}
+?>
+--EXPECT--
+int(256)
+int(128)
+int(64)
+int(-2)
+int(0)
+int(-1)
+Exception (ArithmeticError): Bit shift by negative number
diff --git a/ext/opcache/tests/jit/shift_right_002.phpt b/ext/opcache/tests/jit/shift_right_002.phpt
new file mode 100644
index 0000000000..3d86a08116
--- /dev/null
+++ b/ext/opcache/tests/jit/shift_right_002.phpt
@@ -0,0 +1,55 @@
+--TEST--
+JIT Shift Right: 002
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function shr0(int $a) {
+ return $a >> 0;
+}
+function shr1(int $a) {
+ return $a >> 1;
+}
+function shr2(int $a) {
+ return $a >> 2;
+}
+function shr64(int $a) {
+ return $a >> 64;
+}
+function shrNEG(int $a) {
+ return $a >> -1;
+}
+var_dump(shr0(256));
+var_dump(shr1(256));
+var_dump(shr2(256));
+var_dump(shr2(-8));
+try {
+ var_dump(shr64(1));
+} catch (Throwable $e) {
+ echo "Exception " . $e->getMessage() . "\n";
+}
+try {
+ var_dump(shr64(-1));
+} catch (Throwable $e) {
+ echo "Exception " . $e->getMessage() . "\n";
+}
+try {
+ var_dump(shrNEG(1));
+} catch (Throwable $e) {
+ echo "Exception (" . get_class($e) . "): " . $e->getMessage() . "\n";
+}
+?>
+--EXPECT--
+int(256)
+int(128)
+int(64)
+int(-2)
+int(0)
+int(-1)
+Exception (ArithmeticError): Bit shift by negative number
diff --git a/ext/opcache/tests/jit/shift_right_003.phpt b/ext/opcache/tests/jit/shift_right_003.phpt
new file mode 100644
index 0000000000..7fdf601d64
--- /dev/null
+++ b/ext/opcache/tests/jit/shift_right_003.phpt
@@ -0,0 +1,26 @@
+--TEST--
+JIT Shift Right: 003
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function encodeDynamicInteger(int $int): string {
+ $out = "";
+ for ($i = 0; ($int >> $i) > 0x80; $i += 7) {
+ $out .= \chr(0x80 | (($int >> $i) & 0x7f));
+ }
+ return $out . \chr($int >> $i);
+}
+$s = encodeDynamicInteger(235);
+var_dump(strlen($s), ord($s[0]), ord($s[1]));
+?>
+--EXPECT--
+int(2)
+int(235)
+int(1)
diff --git a/ext/opcache/tests/jit/skipif.inc b/ext/opcache/tests/jit/skipif.inc
new file mode 100644
index 0000000000..c5a8181039
--- /dev/null
+++ b/ext/opcache/tests/jit/skipif.inc
@@ -0,0 +1,3 @@
+<?php
+ if (!extension_loaded('Zend OPcache')) die('skip Zend OPcache extension not available');
+?>
diff --git a/ext/opcache/tests/jit/switch_jumptable.phpt b/ext/opcache/tests/jit/switch_jumptable.phpt
new file mode 100644
index 0000000000..df59a48c14
--- /dev/null
+++ b/ext/opcache/tests/jit/switch_jumptable.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Switch jumptable generation
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+function test1(string $val) {
+ switch ($val) {
+ case 'str1':
+ case 'str2':
+ echo "correct\n";
+ return;
+ }
+ echo "wrong\n";
+}
+function test2(int $val) {
+ switch ($val) {
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ echo "correct\n";
+ return;
+ }
+ echo "wrong\n";
+}
+test1("str1");
+test2(1);
+
+?>
+--EXPECT--
+correct
+correct
diff --git a/ext/opcache/tests/jit/type_check_001.phpt b/ext/opcache/tests/jit/type_check_001.phpt
new file mode 100644
index 0000000000..6573f0ebdc
--- /dev/null
+++ b/ext/opcache/tests/jit/type_check_001.phpt
@@ -0,0 +1,25 @@
+--TEST--
+JIT TYPE_CHECK: 001 exception handling
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+set_error_handler(function($no, $msg) {
+ throw new Exception($msg);
+});
+
+try {
+ if (!is_scalar($a)) {
+ undefined_function('Null');
+ }
+} catch (Exception $e) {
+ echo "Exception: " . $e->getMessage() . "\n";
+}
+?>
+--EXPECT--
+Exception: Undefined variable: a
diff --git a/ext/opcache/tests/jit/unreachable_block.phpt b/ext/opcache/tests/jit/unreachable_block.phpt
new file mode 100644
index 0000000000..cf60efaef3
--- /dev/null
+++ b/ext/opcache/tests/jit/unreachable_block.phpt
@@ -0,0 +1,25 @@
+--TEST--
+JIT unreachable_block with block order
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+class A {
+ public function Value()
+ {
+ switch ($this->returnType) {
+ case 'float': return $this->returnTypeNullable ? null : 0;
+ default: return;
+ }
+ }
+}
+?>
+okey
+--EXPECT--
+okey
diff --git a/ext/opcache/tests/jmpz_jmp_elim.phpt b/ext/opcache/tests/jmpz_jmp_elim.phpt
index 8a343512dd..434897bf80 100644
--- a/ext/opcache/tests/jmpz_jmp_elim.phpt
+++ b/ext/opcache/tests/jmpz_jmp_elim.phpt
@@ -14,5 +14,5 @@ echo "done\n";
?>
--EXPECTF--
-Notice: Undefined variable: undef in %s on line %d
+Warning: Undefined variable: undef in %s on line %d
done
diff --git a/ext/opcache/tests/opt/block_pass_001.phpt b/ext/opcache/tests/opt/block_pass_001.phpt
new file mode 100644
index 0000000000..788994ea4e
--- /dev/null
+++ b/ext/opcache/tests/opt/block_pass_001.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Block Pass 001: QM_ASSIGN and DECLARE_LAMBDA_FUNCTION
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.optimization_level=-1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+abstract class Broadcaster {
+ protected function normalizeChannelHandlerToCallable($callback)
+ {
+ return is_callable($callback) ? $callback : function (...$args) use ($callback) {
+ return Container::getInstance()
+ ->make($callback)
+ ->join(...$args);
+ };
+ }
+}
+?>
+OK
+--EXPECT--
+OK
diff --git a/ext/opcache/tests/opt/block_pass_002.phpt b/ext/opcache/tests/opt/block_pass_002.phpt
new file mode 100644
index 0000000000..38722ea49b
--- /dev/null
+++ b/ext/opcache/tests/opt/block_pass_002.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Block Pass 002: QM_ASSIGN and INIT_ARRAY
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.optimization_level=-1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo($key, $value, array $attributes) {
+ return is_array($value)
+ ? [$key, array_merge($value, $attributes)]
+ : [$value, $attributes];
+}
+?>
+OK
+--EXPECT--
+OK
diff --git a/ext/opcache/tests/opt/dce_001.phpt b/ext/opcache/tests/opt/dce_001.phpt
index 1afc3eba06..77a3da6809 100644
--- a/ext/opcache/tests/opt/dce_001.phpt
+++ b/ext/opcache/tests/opt/dce_001.phpt
@@ -11,9 +11,9 @@ opcache.preload=
--FILE--
<?php
function foo(string $s1, string $s2, string $s3, string $s4) {
- $x = ($s1 . $s2) . ($s3 . $s4);
- $x = 0;
- return $x;
+ $x = ($s1 . $s2) . ($s3 . $s4);
+ $x = 0;
+ return $x;
}
?>
--EXPECTF--
diff --git a/ext/opcache/tests/opt/dce_002.phpt b/ext/opcache/tests/opt/dce_002.phpt
index fb1c070b35..002ada627d 100644
--- a/ext/opcache/tests/opt/dce_002.phpt
+++ b/ext/opcache/tests/opt/dce_002.phpt
@@ -11,12 +11,12 @@ opcache.preload=
--FILE--
<?php
function foo(int $a) {
- $a = 10;
- $b = 20;
- $x = func_get_args();
- $a = 30;
- $b = 40;
- return $x;
+ $a = 10;
+ $b = 20;
+ $x = func_get_args();
+ $a = 30;
+ $b = 40;
+ return $x;
}
?>
--EXPECTF--
diff --git a/ext/opcache/tests/opt/dce_003.phpt b/ext/opcache/tests/opt/dce_003.phpt
index 0de39c042c..a60e982b95 100644
--- a/ext/opcache/tests/opt/dce_003.phpt
+++ b/ext/opcache/tests/opt/dce_003.phpt
@@ -11,8 +11,8 @@ opcache.preload=
--FILE--
<?php
function foo(int $a) {
- $b = $a += 3;
- return $a;
+ $b = $a += 3;
+ return $a;
}
?>
--EXPECTF--
diff --git a/ext/opcache/tests/opt/dce_004.phpt b/ext/opcache/tests/opt/dce_004.phpt
index 90bfc52d97..d595c17acb 100644
--- a/ext/opcache/tests/opt/dce_004.phpt
+++ b/ext/opcache/tests/opt/dce_004.phpt
@@ -11,10 +11,10 @@ opcache.preload=
--FILE--
<?php
function foo(int $x, int $y) {
- $a = [$x];
- $a[1] = $y;
- $a = $y;
- return $a;
+ $a = [$x];
+ $a[1] = $y;
+ $a = $y;
+ return $a;
}
--EXPECTF--
$_main: ; (lines=1, args=0, vars=0, tmps=0)
diff --git a/ext/opcache/tests/opt/dce_005.phpt b/ext/opcache/tests/opt/dce_005.phpt
index 3888ccd53f..294cf92b33 100644
--- a/ext/opcache/tests/opt/dce_005.phpt
+++ b/ext/opcache/tests/opt/dce_005.phpt
@@ -13,8 +13,8 @@ opcache.preload=
class A {
}
function foo(int $x) {
- $a = new A;
- $a->foo = $x;
+ $a = new A;
+ $a->foo = $x;
}
--EXPECTF--
$_main: ; (lines=1, args=0, vars=0, tmps=0)
diff --git a/ext/opcache/tests/opt/dce_006.phpt b/ext/opcache/tests/opt/dce_006.phpt
index c84805247a..c595f9088d 100644
--- a/ext/opcache/tests/opt/dce_006.phpt
+++ b/ext/opcache/tests/opt/dce_006.phpt
@@ -11,11 +11,11 @@ opcache.preload=
--FILE--
<?php
class A {
- function __destruct() {}
+ function __destruct() {}
}
function foo(int $x) {
- $a = new A;
- $a->foo = $x;
+ $a = new A;
+ $a->foo = $x;
}
--EXPECTF--
$_main: ; (lines=1, args=0, vars=0, tmps=0)
diff --git a/ext/opcache/tests/opt/sccp_001.phpt b/ext/opcache/tests/opt/sccp_001.phpt
index 1f67f985e3..d7cb8c700a 100644
--- a/ext/opcache/tests/opt/sccp_001.phpt
+++ b/ext/opcache/tests/opt/sccp_001.phpt
@@ -11,10 +11,10 @@ opcache.preload=
--FILE--
<?php
function foo() {
- $a = 1;
- $b = $a + 2;
- $a += $b;
- return $a;
+ $a = 1;
+ $b = $a + 2;
+ $a += $b;
+ return $a;
}
?>
--EXPECTF--
diff --git a/ext/opcache/tests/opt/sccp_002.phpt b/ext/opcache/tests/opt/sccp_002.phpt
index 0fd10f2ac5..ff00281a03 100644
--- a/ext/opcache/tests/opt/sccp_002.phpt
+++ b/ext/opcache/tests/opt/sccp_002.phpt
@@ -11,15 +11,15 @@ opcache.preload=
--FILE--
<?php
function foo(int $x) {
- $a = [$x];
- $i = 1;
- $c = $i < 2;
- if ($c) {
- $k = 2 * $i;
- $a[$k] = $i;
- echo $a[$k];
- }
- echo $a[2];
+ $a = [$x];
+ $i = 1;
+ $c = $i < 2;
+ if ($c) {
+ $k = 2 * $i;
+ $a[$k] = $i;
+ echo $a[$k];
+ }
+ echo $a[2];
}
?>
--EXPECTF--
@@ -32,6 +32,6 @@ foo: ; (lines=4, args=1, vars=1, tmps=0)
; (after optimizer)
; %ssccp_002.php:2-12
L0 (2): CV0($x) = RECV 1
-L1 (9): ECHO int(1)
-L2 (11): ECHO int(1)
+L1 (9): ECHO string("1")
+L2 (11): ECHO string("1")
L3 (12): RETURN null
diff --git a/ext/opcache/tests/opt/sccp_003.phpt b/ext/opcache/tests/opt/sccp_003.phpt
index 282a5788e6..a0ac2e0236 100644
--- a/ext/opcache/tests/opt/sccp_003.phpt
+++ b/ext/opcache/tests/opt/sccp_003.phpt
@@ -11,15 +11,15 @@ opcache.preload=
--FILE--
<?php
function foo() {
- $a = [1,2,3];
- $i = 1;
- $c = $i < 2;
- if ($c) {
- $k = 2 * $i;
- $a[$k] = $i;
- echo $a[$k];
- }
- echo $a[2];
+ $a = [1,2,3];
+ $i = 1;
+ $c = $i < 2;
+ if ($c) {
+ $k = 2 * $i;
+ $a[$k] = $i;
+ echo $a[$k];
+ }
+ echo $a[2];
}
?>
--EXPECTF--
@@ -31,6 +31,6 @@ L0 (14): RETURN int(1)
foo: ; (lines=3, args=0, vars=0, tmps=0)
; (after optimizer)
; %ssccp_003.php:2-12
-L0 (9): ECHO int(1)
-L1 (11): ECHO int(1)
+L0 (9): ECHO string("1")
+L1 (11): ECHO string("1")
L2 (12): RETURN null
diff --git a/ext/opcache/tests/opt/sccp_004.phpt b/ext/opcache/tests/opt/sccp_004.phpt
index d82212e0ef..659e3488c1 100644
--- a/ext/opcache/tests/opt/sccp_004.phpt
+++ b/ext/opcache/tests/opt/sccp_004.phpt
@@ -11,18 +11,18 @@ opcache.preload=
--FILE--
<?php
function foo(int $x) {
- $a = [1,2,3];
- $a[2] = $x;
- $i = 1;
- $c = $i < 2;
- if ($c) {
- $k = 2 * $i;
- $a[$k] = $i;
+ $a = [1,2,3];
+ $a[2] = $x;
+ $i = 1;
+ $c = $i < 2;
+ if ($c) {
+ $k = 2 * $i;
+ $a[$k] = $i;
// $a[$k]++;
- echo isset($a[$k]);
+ echo isset($a[$k]);
// $a[$k] += 5;
- }
- echo $a[2];
+ }
+ echo $a[2];
}
?>
--EXPECTF--
@@ -35,6 +35,6 @@ foo: ; (lines=4, args=1, vars=1, tmps=0)
; (after optimizer)
; %ssccp_004.php:2-15
L0 (2): CV0($x) = RECV 1
-L1 (11): ECHO bool(true)
-L2 (14): ECHO int(1)
+L1 (11): ECHO string("1")
+L2 (14): ECHO string("1")
L3 (15): RETURN null
diff --git a/ext/opcache/tests/opt/sccp_005.phpt b/ext/opcache/tests/opt/sccp_005.phpt
index 7fbb062922..4fb86eacc0 100644
--- a/ext/opcache/tests/opt/sccp_005.phpt
+++ b/ext/opcache/tests/opt/sccp_005.phpt
@@ -11,8 +11,8 @@ opcache.preload=
--FILE--
<?php
function foo(int $x) {
- $a = [1,2,$x];
- echo $a[1];
+ $a = [1,2,$x];
+ echo $a[1];
}
?>
--EXPECTF--
@@ -25,5 +25,5 @@ foo: ; (lines=3, args=1, vars=1, tmps=0)
; (after optimizer)
; %ssccp_005.php:2-5
L0 (2): CV0($x) = RECV 1
-L1 (4): ECHO int(2)
+L1 (4): ECHO string("2")
L2 (5): RETURN null
diff --git a/ext/opcache/tests/opt/sccp_006.phpt b/ext/opcache/tests/opt/sccp_006.phpt
index 60fa5f2f01..bc24ebbfb2 100644
--- a/ext/opcache/tests/opt/sccp_006.phpt
+++ b/ext/opcache/tests/opt/sccp_006.phpt
@@ -11,8 +11,8 @@ opcache.preload=
--FILE--
<?php
function foo(int $x) {
- $a = ["a"=>1,"a"=>2,"a"=>$x];
- echo $a["a"];
+ $a = ["a"=>1,"a"=>2,"a"=>$x];
+ echo $a["a"];
}
?>
--EXPECTF--
diff --git a/ext/opcache/tests/opt/sccp_007.phpt b/ext/opcache/tests/opt/sccp_007.phpt
index 82feb04e22..44ff01e640 100644
--- a/ext/opcache/tests/opt/sccp_007.phpt
+++ b/ext/opcache/tests/opt/sccp_007.phpt
@@ -11,12 +11,12 @@ opcache.preload=
--FILE--
<?php
function foo(int $x) {
- if ($x) {
- $a = [0,1];
- } else {
- $a = [0,2];
- }
- echo $a[0];
+ if ($x) {
+ $a = [0,1];
+ } else {
+ $a = [0,2];
+ }
+ echo $a[0];
}
?>
--EXPECTF--
@@ -29,5 +29,5 @@ foo: ; (lines=3, args=1, vars=1, tmps=0)
; (after optimizer)
; %ssccp_007.php:2-9
L0 (2): CV0($x) = RECV 1
-L1 (8): ECHO int(0)
+L1 (8): ECHO string("0")
L2 (9): RETURN null
diff --git a/ext/opcache/tests/opt/sccp_008.phpt b/ext/opcache/tests/opt/sccp_008.phpt
index d652964a66..a5ba8a7d22 100644
--- a/ext/opcache/tests/opt/sccp_008.phpt
+++ b/ext/opcache/tests/opt/sccp_008.phpt
@@ -11,12 +11,12 @@ opcache.preload=
--FILE--
<?php
function foo(int $x) {
- if ($x) {
- $a = [0,1];
- } else {
- $a = [0,2];
- }
- echo $a[1];
+ if ($x) {
+ $a = [0,1];
+ } else {
+ $a = [0,2];
+ }
+ echo $a[1];
}
?>
--EXPECTF--
diff --git a/ext/opcache/tests/opt/sccp_009.phpt b/ext/opcache/tests/opt/sccp_009.phpt
index 1b049810c1..601586fd64 100644
--- a/ext/opcache/tests/opt/sccp_009.phpt
+++ b/ext/opcache/tests/opt/sccp_009.phpt
@@ -11,9 +11,9 @@ opcache.preload=
--FILE--
<?php
function foo(int $x) {
- $a[0] = $x;
- $a[1] = 2;
- echo $a[1];
+ $a[0] = $x;
+ $a[1] = 2;
+ echo $a[1];
}
?>
--EXPECTF--
@@ -26,5 +26,5 @@ foo: ; (lines=3, args=1, vars=1, tmps=0)
; (after optimizer)
; %ssccp_009.php:2-6
L0 (2): CV0($x) = RECV 1
-L1 (5): ECHO int(2)
+L1 (5): ECHO string("2")
L2 (6): RETURN null
diff --git a/ext/opcache/tests/opt/sccp_010.phpt b/ext/opcache/tests/opt/sccp_010.phpt
index e88bf579f7..8943b179e3 100644
--- a/ext/opcache/tests/opt/sccp_010.phpt
+++ b/ext/opcache/tests/opt/sccp_010.phpt
@@ -13,14 +13,14 @@ opcache.preload=
function foo() {
$o = new stdClass();
$o->foo = 0;
- $i = 1;
- $c = $i < 2;
- if ($c) {
- $k = 2 * $i;
- $o->foo = $i;
- echo $o->foo;
- }
- echo $o->foo;
+ $i = 1;
+ $c = $i < 2;
+ if ($c) {
+ $k = 2 * $i;
+ $o->foo = $i;
+ echo $o->foo;
+ }
+ echo $o->foo;
}
?>
--EXPECTF--
@@ -32,6 +32,6 @@ L0 (15): RETURN int(1)
foo: ; (lines=3, args=0, vars=0, tmps=0)
; (after optimizer)
; %ssccp_010.php:2-13
-L0 (10): ECHO int(1)
-L1 (12): ECHO int(1)
+L0 (10): ECHO string("1")
+L1 (12): ECHO string("1")
L2 (13): RETURN null
diff --git a/ext/opcache/tests/opt/sccp_011.phpt b/ext/opcache/tests/opt/sccp_011.phpt
index 281e3dca2e..4bd90b18e6 100644
--- a/ext/opcache/tests/opt/sccp_011.phpt
+++ b/ext/opcache/tests/opt/sccp_011.phpt
@@ -11,15 +11,15 @@ opcache.preload=
--FILE--
<?php
function foo(int $x) {
- $o = new stdClass;
- if ($x) {
- $o->foo = 0;
- $o->bar = 1;
- } else {
- $o->foo = 0;
- $o->bar = 2;
- }
- echo $o->foo;
+ $o = new stdClass;
+ if ($x) {
+ $o->foo = 0;
+ $o->bar = 1;
+ } else {
+ $o->foo = 0;
+ $o->bar = 2;
+ }
+ echo $o->foo;
}
?>
--EXPECTF--
@@ -32,5 +32,5 @@ foo: ; (lines=3, args=1, vars=1, tmps=0)
; (after optimizer)
; %ssccp_011.php:2-12
L0 (2): CV0($x) = RECV 1
-L1 (11): ECHO int(0)
+L1 (11): ECHO string("0")
L2 (12): RETURN null
diff --git a/ext/opcache/tests/opt/sccp_012.phpt b/ext/opcache/tests/opt/sccp_012.phpt
index 5d2f3e9a01..1ad1ed3b4c 100644
--- a/ext/opcache/tests/opt/sccp_012.phpt
+++ b/ext/opcache/tests/opt/sccp_012.phpt
@@ -13,16 +13,16 @@ opcache.preload=
function foo() {
$o = new stdClass();
$o->foo = 0;
- $i = 1;
- $c = $i < 2;
- if ($c) {
- $k = 2 * $i;
- $o->foo = $i;
- echo $o->foo;
- }
- $o->foo += 2;
- $o->foo++;
- echo $o->foo;
+ $i = 1;
+ $c = $i < 2;
+ if ($c) {
+ $k = 2 * $i;
+ $o->foo = $i;
+ echo $o->foo;
+ }
+ $o->foo += 2;
+ $o->foo++;
+ echo $o->foo;
}
?>
--EXPECTF--
@@ -34,6 +34,6 @@ L0 (17): RETURN int(1)
foo: ; (lines=3, args=0, vars=0, tmps=0)
; (after optimizer)
; %ssccp_012.php:2-15
-L0 (10): ECHO int(1)
-L1 (14): ECHO int(4)
+L0 (10): ECHO string("1")
+L1 (14): ECHO string("4")
L2 (15): RETURN null
diff --git a/ext/opcache/tests/opt/sccp_013.phpt b/ext/opcache/tests/opt/sccp_013.phpt
index 18b57a4185..1ed9c7703b 100644
--- a/ext/opcache/tests/opt/sccp_013.phpt
+++ b/ext/opcache/tests/opt/sccp_013.phpt
@@ -9,11 +9,11 @@ opcache.optimization_level=-1
--FILE--
<?php
function loadEntities($entity_information) {
- $entity_types = [];
- foreach ($entity_information as $info) {
- $entity_types[$info] = 1;
- }
- var_dump((bool)($entity_types[$info]));
+ $entity_types = [];
+ foreach ($entity_information as $info) {
+ $entity_types[$info] = 1;
+ }
+ var_dump((bool)($entity_types[$info]));
}
loadEntities(array("first", "second"));
diff --git a/ext/opcache/tests/opt/sccp_014.phpt b/ext/opcache/tests/opt/sccp_014.phpt
index 2898239e7c..81f21a4ab0 100644
--- a/ext/opcache/tests/opt/sccp_014.phpt
+++ b/ext/opcache/tests/opt/sccp_014.phpt
@@ -9,12 +9,12 @@ opcache.optimization_level=-1
--FILE--
<?php
function loadEntities($entity_information) {
- $entity_types = new StdClass();
- $entity_types->a = 1;
- foreach ($entity_information as $info) {
- $entity_types->a = 0;
- }
- var_dump((bool)($entity_types->a));
+ $entity_types = new StdClass();
+ $entity_types->a = 1;
+ foreach ($entity_information as $info) {
+ $entity_types->a = 0;
+ }
+ var_dump((bool)($entity_types->a));
}
loadEntities(array("first", "second"));
diff --git a/ext/opcache/tests/opt/sccp_015.phpt b/ext/opcache/tests/opt/sccp_015.phpt
index b31f4edc15..d11bd6c9e0 100644
--- a/ext/opcache/tests/opt/sccp_015.phpt
+++ b/ext/opcache/tests/opt/sccp_015.phpt
@@ -9,14 +9,14 @@ opcache.optimization_level=-1
--FILE--
<?php
function loadEntities($entity_information) {
- $entity_types = new StdClass();
- $entity_types->b = 0;
- foreach ($entity_information as $ex) {
- var_dump((bool)$entity_types->b);
- foreach ($entity_information as $info) {
- $entity_types->b = 1;
- }
- }
+ $entity_types = new StdClass();
+ $entity_types->b = 0;
+ foreach ($entity_information as $ex) {
+ var_dump((bool)$entity_types->b);
+ foreach ($entity_information as $info) {
+ $entity_types->b = 1;
+ }
+ }
}
loadEntities(array("first", "second"));
diff --git a/ext/opcache/tests/opt/sccp_017.phpt b/ext/opcache/tests/opt/sccp_017.phpt
index c2bc6f35fb..e72d892bdc 100644
--- a/ext/opcache/tests/opt/sccp_017.phpt
+++ b/ext/opcache/tests/opt/sccp_017.phpt
@@ -1,5 +1,5 @@
--TEST--
-SCCP 017: Array assignemnt
+SCCP 017: Array assignment
--INI--
opcache.enable=1
opcache.enable_cli=1
@@ -11,11 +11,11 @@ opcache.preload=
--FILE--
<?php
function foo(int $x) {
- $a[0] = 5;
- $a[1] = $x;
- $b = $a;
- $b[0] = 42;
- return $a[0];
+ $a[0] = 5;
+ $a[1] = $x;
+ $b = $a;
+ $b[0] = 42;
+ return $a[0];
}
?>
--EXPECTF--
diff --git a/ext/opcache/tests/opt/sccp_018.phpt b/ext/opcache/tests/opt/sccp_018.phpt
index 66a4b6ca15..e7a78ef50d 100644
--- a/ext/opcache/tests/opt/sccp_018.phpt
+++ b/ext/opcache/tests/opt/sccp_018.phpt
@@ -1,5 +1,5 @@
--TEST--
-SCCP 018: Object assignemnt
+SCCP 018: Object assignment
--INI--
opcache.enable=1
opcache.enable_cli=1
@@ -10,12 +10,12 @@ opcache.optimization_level=-1
--FILE--
<?php
function foo() {
- $a = new stdClass;
- $b = $a;
- $a->x = 5;
- $b->x = 42;
- echo $a->x;
- echo "\n";
+ $a = new stdClass;
+ $b = $a;
+ $a->x = 5;
+ $b->x = 42;
+ echo $a->x;
+ echo "\n";
}
foo();
?>
diff --git a/ext/opcache/tests/opt/sccp_019.phpt b/ext/opcache/tests/opt/sccp_019.phpt
index 5a32bd2205..3ed2d6bd81 100644
--- a/ext/opcache/tests/opt/sccp_019.phpt
+++ b/ext/opcache/tests/opt/sccp_019.phpt
@@ -1,5 +1,5 @@
--TEST--
-SCCP 019: Array assignemnt
+SCCP 019: Array assignment
--INI--
opcache.enable=1
opcache.enable_cli=1
@@ -11,10 +11,10 @@ opcache.preload=
--FILE--
<?php
function foo(int $x) {
- $a[0] = 5;
- $a[1] = $x;
- $b = $a;
- return $b[0];
+ $a[0] = 5;
+ $a[1] = $x;
+ $b = $a;
+ return $b[0];
}
?>
--EXPECTF--
diff --git a/ext/opcache/tests/opt/sccp_020.phpt b/ext/opcache/tests/opt/sccp_020.phpt
index 41c694a591..be972f4fdf 100644
--- a/ext/opcache/tests/opt/sccp_020.phpt
+++ b/ext/opcache/tests/opt/sccp_020.phpt
@@ -1,5 +1,5 @@
--TEST--
-SCCP 020: Object assignemnt
+SCCP 020: Object assignment
--INI--
opcache.enable=1
opcache.enable_cli=1
@@ -10,11 +10,11 @@ opcache.optimization_level=-1
--FILE--
<?php
function foo() {
- $b = $a = new stdClass;
- $a->x = 5;
- $b->x = 42;
- echo $a->x;
- echo "\n";
+ $b = $a = new stdClass;
+ $a->x = 5;
+ $b->x = 42;
+ echo $a->x;
+ echo "\n";
}
foo();
?>
diff --git a/ext/opcache/tests/opt/sccp_021.phpt b/ext/opcache/tests/opt/sccp_021.phpt
index 327cbc9a91..1eb8de4516 100644
--- a/ext/opcache/tests/opt/sccp_021.phpt
+++ b/ext/opcache/tests/opt/sccp_021.phpt
@@ -10,19 +10,19 @@ opcache.optimization_level=-1
--FILE--
<?php
class A {
- public function memleak($num_tokens) {
- $queries = array();
- for ( $i = 0; $i < $num_tokens; ++$i ) {
- if ( 0 < $i )
- $queries[$i] = $queries[$i - 1] . '&';
- else
- $queries[$i] = '';
+ public function memleak($num_tokens) {
+ $queries = array();
+ for ( $i = 0; $i < $num_tokens; ++$i ) {
+ if ( 0 < $i )
+ $queries[$i] = $queries[$i - 1] . '&';
+ else
+ $queries[$i] = '';
- $queries[$i] .= $query_token;
- }
+ $queries[$i] .= $query_token;
+ }
- return;
- }
+ return;
+ }
}
?>
okey
diff --git a/ext/opcache/tests/opt/sccp_022.phpt b/ext/opcache/tests/opt/sccp_022.phpt
index 03a8d565f2..000b1ab8b3 100644
--- a/ext/opcache/tests/opt/sccp_022.phpt
+++ b/ext/opcache/tests/opt/sccp_022.phpt
@@ -1,5 +1,5 @@
--TEST--
-SCCP 022: Invailid types
+SCCP 022: Invalid types
--INI--
opcache.enable=1
opcache.enable_cli=1
@@ -11,11 +11,11 @@ opcache.preload=
--FILE--
<?php
function foo(int $x) {
- $a[0] = $x;
- $a[1] = 5;
- echo $a[1];
- $a->foo = 5;
- echo $a[1];
+ $a[0] = $x;
+ $a[1] = 5;
+ echo $a[1];
+ $a->foo = 5;
+ echo $a[1];
}
?>
--EXPECTF--
@@ -32,7 +32,7 @@ L1 (3): ASSIGN_DIM CV1($a) int(0)
L2 (3): OP_DATA CV0($x)
L3 (4): ASSIGN_DIM CV1($a) int(1)
L4 (4): OP_DATA int(5)
-L5 (5): ECHO int(5)
+L5 (5): ECHO string("5")
L6 (6): ASSIGN_OBJ CV1($a) string("foo")
L7 (6): OP_DATA int(5)
L8 (7): T2 = FETCH_DIM_R CV1($a) int(1)
diff --git a/ext/opcache/tests/opt/sccp_023.phpt b/ext/opcache/tests/opt/sccp_023.phpt
index d327d6279e..efa7d6b013 100644
--- a/ext/opcache/tests/opt/sccp_023.phpt
+++ b/ext/opcache/tests/opt/sccp_023.phpt
@@ -10,13 +10,13 @@ opcache.opt_debug_level=0
--FILE--
<?php
function a ($field_type, $allowed_values) {
- $settings = [
- 'list_string' => [
- 'allowed_values' => $allowed_values,
- ],
- ];
+ $settings = [
+ 'list_string' => [
+ 'allowed_values' => $allowed_values,
+ ],
+ ];
- return $settings[$field_type];
+ return $settings[$field_type];
}
var_dump(a("list_string", ["xxx"]));
diff --git a/ext/opcache/tests/opt/sccp_024.phpt b/ext/opcache/tests/opt/sccp_024.phpt
index e6e2e311ef..bd9a2fed67 100644
--- a/ext/opcache/tests/opt/sccp_024.phpt
+++ b/ext/opcache/tests/opt/sccp_024.phpt
@@ -11,14 +11,14 @@ opcache.preload=
--FILE--
<?php
class A {
- function t($obj) {
- $a = "A";
+ function t($obj) {
+ $a = "A";
$b = "self";
$c = 1;
echo ($obj instanceof $a);
echo ($obj instanceof $b);
echo ($obj instanceof $c);
- }
+ }
}
?>
--EXPECTF--
diff --git a/ext/opcache/tests/opt/sccp_025.phpt b/ext/opcache/tests/opt/sccp_025.phpt
index 8f46dab830..f78e8822d7 100644
--- a/ext/opcache/tests/opt/sccp_025.phpt
+++ b/ext/opcache/tests/opt/sccp_025.phpt
@@ -11,31 +11,31 @@ opcache.opt_debug_level=0
<?php
function test($phpEx)
{
- $expected_data_sets = array(
- 1 => array(
- 'id' => 1,
- ),
- 6 => array(
- 'viewtopic' => strval("phpBB/viewtopic.$phpEx"),
+ $expected_data_sets = array(
+ 1 => array(
+ 'id' => 1,
+ ),
+ 6 => array(
+ 'viewtopic' => strval("phpBB/viewtopic.$phpEx"),
- ),
- );
+ ),
+ );
- $test_cases = array(
- array(
- 'expected' => array(6),
- ),
- );
+ $test_cases = array(
+ array(
+ 'expected' => array(6),
+ ),
+ );
- foreach ($test_cases as $case => $case_data)
- {
- foreach ($case_data['expected'] as $data_set => $expected)
- {
- $test_cases[$case]['expected'][$data_set] = $expected_data_sets[$expected];
- }
- }
+ foreach ($test_cases as $case => $case_data)
+ {
+ foreach ($case_data['expected'] as $data_set => $expected)
+ {
+ $test_cases[$case]['expected'][$data_set] = $expected_data_sets[$expected];
+ }
+ }
- return $test_cases;
+ return $test_cases;
}
var_dump(test("xxx"));
?>
diff --git a/ext/opcache/tests/opt/sccp_026.phpt b/ext/opcache/tests/opt/sccp_026.phpt
index 132c9ddef3..6f02a57a5a 100644
--- a/ext/opcache/tests/opt/sccp_026.phpt
+++ b/ext/opcache/tests/opt/sccp_026.phpt
@@ -15,7 +15,7 @@ function test($var) {
return;
}
- var_dump($username);
+ var_dump($username);
}
?>
--EXPECTF--
diff --git a/ext/opcache/tests/opt/sccp_027.phpt b/ext/opcache/tests/opt/sccp_027.phpt
index 38189592b0..5c13111d1c 100644
--- a/ext/opcache/tests/opt/sccp_027.phpt
+++ b/ext/opcache/tests/opt/sccp_027.phpt
@@ -10,15 +10,15 @@ opcache.preload=
--FILE--
<?php
class Foo {
- protected $arr;
- public function init($a) {
- $this->arr =& $a;
- if (isset($a[0])) {
- return 1;
- } else {
- return 2;
- }
- }
+ protected $arr;
+ public function init($a) {
+ $this->arr =& $a;
+ if (isset($a[0])) {
+ return 1;
+ } else {
+ return 2;
+ }
+ }
}
$x = new Foo();
var_dump($x->init([1]));
diff --git a/ext/opcache/tests/opt/sccp_029.phpt b/ext/opcache/tests/opt/sccp_029.phpt
index 3a16477711..99459f74af 100644
--- a/ext/opcache/tests/opt/sccp_029.phpt
+++ b/ext/opcache/tests/opt/sccp_029.phpt
@@ -10,7 +10,7 @@ opcache.preload=
--FILE--
<?php
-class Test {
+class Test {
public string $x = "x";
}
function test() {
diff --git a/ext/opcache/tests/opt/sccp_031.phpt b/ext/opcache/tests/opt/sccp_031.phpt
new file mode 100644
index 0000000000..b787e7c979
--- /dev/null
+++ b/ext/opcache/tests/opt/sccp_031.phpt
@@ -0,0 +1,36 @@
+--TEST--
+SCCP 031: Echo optimizations
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.optimization_level=-1
+opcache.opt_debug_level=0x20000
+opcache.preload=
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $k = 0;
+ $a = [null];
+ echo isset($a[$k]);
+ echo "b";
+ echo isset($a[$k+1]);
+ echo "c";
+ echo $a[$k];
+ echo $a; // Should not be optimized
+}
+?>
+--EXPECTF--
+$_main: ; (lines=1, args=0, vars=0, tmps=0)
+ ; (after optimizer)
+ ; %ssccp_031.php:1-13
+L0 (13): RETURN int(1)
+
+foo: ; (lines=4, args=0, vars=0, tmps=0)
+ ; (after optimizer)
+ ; %s_031.php:2-11
+L0 (6): ECHO string("b")
+L1 (8): ECHO string("c")
+L2 (10): ECHO array(...)
+L3 (11): RETURN null
diff --git a/ext/opcache/tests/optimize_func_calls.phpt b/ext/opcache/tests/optimize_func_calls.phpt
index eb1a6b38b4..3e2a8dd8f4 100644
--- a/ext/opcache/tests/optimize_func_calls.phpt
+++ b/ext/opcache/tests/optimize_func_calls.phpt
@@ -10,14 +10,14 @@ opcache.optimization_level=-1
<?php
class A {
- public $obj;
- public function test($a) {
- }
+ public $obj;
+ public function test($a) {
+ }
}
function a(&$b) {
- $b = "changed";
- return "done";
+ $b = "changed";
+ return "done";
}
$a = "a";
@@ -78,16 +78,16 @@ var_dump($b);
ref("xxx");
function retarray() {
- return array("retarray");
+ return array("retarray");
}
function foo($a) {
- print_r(func_get_args());
+ print_r(func_get_args());
}
function ref(&$b) {
- $b = "changed";
- return "ref";
+ $b = "changed";
+ return "ref";
}
--EXPECTF--
Array
diff --git a/ext/opcache/tests/optimize_static_001.phpt b/ext/opcache/tests/optimize_static_001.phpt
index d4e2c58062..aac2d71907 100644
--- a/ext/opcache/tests/optimize_static_001.phpt
+++ b/ext/opcache/tests/optimize_static_001.phpt
@@ -9,11 +9,15 @@ opcache.optimization_level=-1
--FILE--
<?php
function foo() {
- static $a = UNDEFINED_CONST;
+ static $a = UNDEFINED_CONST;
+}
+try {
+ foo();
+} catch (Throwable $e) {
+ echo "Exception: " . $e->getMessage() . "\n";
}
-foo();
?>
OK
---EXPECTF--
-Warning: Use of undefined constant UNDEFINED_CONST - assumed 'UNDEFINED_CONST' (this will throw an Error in a future version of PHP) in %s on line %d
+--EXPECT--
+Exception: Undefined constant 'UNDEFINED_CONST'
OK \ No newline at end of file
diff --git a/ext/opcache/tests/phi_remove_001.phpt b/ext/opcache/tests/phi_remove_001.phpt
index 3a76a9da5c..d8c1a64eec 100644
--- a/ext/opcache/tests/phi_remove_001.phpt
+++ b/ext/opcache/tests/phi_remove_001.phpt
@@ -9,58 +9,58 @@ opcache.optimization_level=-1
--FILE--
<?php
function getOnlyMPEGaudioInfoBruteForce($info) {
- $Distribution['bitrate'] = array();
- $Distribution['frequency'] = array();
- $Distribution['layer'] = array();
- $Distribution['version'] = array();
- $Distribution['padding'] = array();
+ $Distribution['bitrate'] = array();
+ $Distribution['frequency'] = array();
+ $Distribution['layer'] = array();
+ $Distribution['version'] = array();
+ $Distribution['padding'] = array();
- $max_frames_scan = 5000;
- $frames_scanned = 0;
+ $max_frames_scan = 5000;
+ $frames_scanned = 0;
- $previousvalidframe = $info['avdataoffset'];
- while ($info) {
- if (!isset($MPEGaudioHeaderDecodeCache[$head4])) {
- $MPEGaudioHeaderDecodeCache[$head4] = MPEGaudioHeaderDecode($head4);
- }
- if (!isset($MPEGaudioHeaderValidCache[$head4])) {
- $MPEGaudioHeaderValidCache[$head4] = MPEGaudioHeaderValid($MPEGaudioHeaderDecodeCache[$head4], false, false);
- }
- if ($MPEGaudioHeaderValidCache[$head4]) {
+ $previousvalidframe = $info['avdataoffset'];
+ while ($info) {
+ if (!isset($MPEGaudioHeaderDecodeCache[$head4])) {
+ $MPEGaudioHeaderDecodeCache[$head4] = MPEGaudioHeaderDecode($head4);
+ }
+ if (!isset($MPEGaudioHeaderValidCache[$head4])) {
+ $MPEGaudioHeaderValidCache[$head4] = MPEGaudioHeaderValid($MPEGaudioHeaderDecodeCache[$head4], false, false);
+ }
+ if ($MPEGaudioHeaderValidCache[$head4]) {
- if ($MPEGaudioHeaderLengthCache[$head4] > 4) {
- $WhereWeWere = mftell();
- $next4 = test(4);
- if ($next4[0] == "\xFF") {
- if (!isset($MPEGaudioHeaderDecodeCache[$next4])) {
- $MPEGaudioHeaderDecodeCache[$next4] = MPEGaudioHeaderDecode($next4);
- }
- if (!isset($MPEGaudioHeaderValidCache[$next4])) {
- $MPEGaudioHeaderValidCache[$next4] = MPEGaudioHeaderValid($MPEGaudioHeaderDecodeCache[$next4], false, false);
- }
- if ($MPEGaudioHeaderValidCache[$next4]) {
- getid3_lib::safe_inc($Distribution['bitrate'][$LongMPEGbitrateLookup[$head4]]);
- getid3_lib::safe_inc($Distribution['layer'][$LongMPEGlayerLookup[$head4]]);
- getid3_lib::safe_inc($Distribution['version'][$LongMPEGversionLookup[$head4]]);
- getid3_lib::safe_inc($Distribution['padding'][intval($LongMPEGpaddingLookup[$head4])]);
- getid3_lib::safe_inc($Distribution['frequency'][$LongMPEGfrequencyLookup[$head4]]);
- if ($max_frames_scan && (++$frames_scanned >= $max_frames_scan)) {
- foreach ($Distribution as $key1 => $value1) {
- foreach ($value1 as $key2 => $value2) {
- $Distribution[$key1][$key2] = round($value2 / $pct_data_scanned);
- }
- }
- break;
- }
- continue;
- }
- }
- unset($next4);
- }
+ if ($MPEGaudioHeaderLengthCache[$head4] > 4) {
+ $WhereWeWere = mftell();
+ $next4 = test(4);
+ if ($next4[0] == "\xFF") {
+ if (!isset($MPEGaudioHeaderDecodeCache[$next4])) {
+ $MPEGaudioHeaderDecodeCache[$next4] = MPEGaudioHeaderDecode($next4);
+ }
+ if (!isset($MPEGaudioHeaderValidCache[$next4])) {
+ $MPEGaudioHeaderValidCache[$next4] = MPEGaudioHeaderValid($MPEGaudioHeaderDecodeCache[$next4], false, false);
+ }
+ if ($MPEGaudioHeaderValidCache[$next4]) {
+ getid3_lib::safe_inc($Distribution['bitrate'][$LongMPEGbitrateLookup[$head4]]);
+ getid3_lib::safe_inc($Distribution['layer'][$LongMPEGlayerLookup[$head4]]);
+ getid3_lib::safe_inc($Distribution['version'][$LongMPEGversionLookup[$head4]]);
+ getid3_lib::safe_inc($Distribution['padding'][intval($LongMPEGpaddingLookup[$head4])]);
+ getid3_lib::safe_inc($Distribution['frequency'][$LongMPEGfrequencyLookup[$head4]]);
+ if ($max_frames_scan && (++$frames_scanned >= $max_frames_scan)) {
+ foreach ($Distribution as $key1 => $value1) {
+ foreach ($value1 as $key2 => $value2) {
+ $Distribution[$key1][$key2] = round($value2 / $pct_data_scanned);
+ }
+ }
+ break;
+ }
+ continue;
+ }
+ }
+ unset($next4);
+ }
- }
- }
- return true;
+ }
+ }
+ return true;
}
?>
okey
diff --git a/ext/opcache/tests/phi_remove_002.phpt b/ext/opcache/tests/phi_remove_002.phpt
index 3b0c429d50..7e8b64bdf3 100644
--- a/ext/opcache/tests/phi_remove_002.phpt
+++ b/ext/opcache/tests/phi_remove_002.phpt
@@ -9,13 +9,13 @@ opcache.optimization_level=-1
--FILE--
<?php
function func($blogname, $user = '' ) {
- if (! is_object( $user ) || ( is_object($user) && ( $user->login != $blogname )) ) {
- test();
- }
+ if (! is_object( $user ) || ( is_object($user) && ( $user->login != $blogname )) ) {
+ test();
+ }
- $result = array('user' => $user);
+ $result = array('user' => $user);
- return true;
+ return true;
}
?>
okey
diff --git a/ext/opcache/tests/php_cli_server.inc b/ext/opcache/tests/php_cli_server.inc
index e32cf9f97f..8d15b81c79 100644
--- a/ext/opcache/tests/php_cli_server.inc
+++ b/ext/opcache/tests/php_cli_server.inc
@@ -4,64 +4,64 @@ define ("PHP_CLI_SERVER_PORT", 8964);
define ("PHP_CLI_SERVER_ADDRESS", PHP_CLI_SERVER_HOSTNAME.":".PHP_CLI_SERVER_PORT);
function php_cli_server_start($ini = "") {
- $php_executable = getenv('TEST_PHP_EXECUTABLE');
- $doc_root = __DIR__;
+ $php_executable = getenv('TEST_PHP_EXECUTABLE');
+ $doc_root = __DIR__;
- $ini_array = preg_split('/\s+/', trim($ini));
- $ini_array = array_map(function($arg) {
- return trim($arg, '\'"');
- }, $ini_array);
- $cmd = [$php_executable, '-t', $doc_root, '-n', ...$ini_array, '-S', PHP_CLI_SERVER_ADDRESS];
- $descriptorspec = array(
- 0 => STDIN,
- 1 => STDOUT,
- 2 => array("null"),
- );
- $handle = proc_open($cmd, $descriptorspec, $pipes, $doc_root, null, array("suppress_errors" => true));
+ $ini_array = preg_split('/\s+/', trim($ini));
+ $ini_array = array_map(function($arg) {
+ return trim($arg, '\'"');
+ }, $ini_array);
+ $cmd = [$php_executable, '-t', $doc_root, '-n', ...$ini_array, '-S', PHP_CLI_SERVER_ADDRESS];
+ $descriptorspec = array(
+ 0 => STDIN,
+ 1 => STDOUT,
+ 2 => array("null"),
+ );
+ $handle = proc_open($cmd, $descriptorspec, $pipes, $doc_root, null, array("suppress_errors" => true));
- // note: even when server prints 'Listening on localhost:8964...Press Ctrl-C to quit.'
- // it might not be listening yet...need to wait until fsockopen() call returns
- $error = "Unable to connect to server\n";
- for ($i=0; $i < 60; $i++) {
- usleep(50000); // 50ms per try
- $status = proc_get_status($handle);
- $fp = @fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT);
- // Failure, the server is no longer running
- if (!($status && $status['running'])) {
- $error = "Server is not running\n";
- break;
- }
- // Success, Connected to servers
- if ($fp) {
- $error = '';
- break;
- }
- }
+ // note: even when server prints 'Listening on localhost:8964...Press Ctrl-C to quit.'
+ // it might not be listening yet...need to wait until fsockopen() call returns
+ $error = "Unable to connect to server\n";
+ for ($i=0; $i < 60; $i++) {
+ usleep(50000); // 50ms per try
+ $status = proc_get_status($handle);
+ $fp = @fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT);
+ // Failure, the server is no longer running
+ if (!($status && $status['running'])) {
+ $error = "Server is not running\n";
+ break;
+ }
+ // Success, Connected to servers
+ if ($fp) {
+ $error = '';
+ break;
+ }
+ }
- if ($fp) {
- fclose($fp);
- }
+ if ($fp) {
+ fclose($fp);
+ }
- if ($error) {
- echo $error;
- proc_terminate($handle);
- exit(1);
- }
+ if ($error) {
+ echo $error;
+ proc_terminate($handle);
+ exit(1);
+ }
- register_shutdown_function(
- function($handle) {
- proc_terminate($handle);
- /* Wait for server to shutdown */
- for ($i = 0; $i < 60; $i++) {
- $status = proc_get_status($handle);
- if (!($status && $status['running'])) {
- break;
- }
- usleep(50000);
- }
- },
- $handle
- );
+ register_shutdown_function(
+ function($handle) {
+ proc_terminate($handle);
+ /* Wait for server to shutdown */
+ for ($i = 0; $i < 60; $i++) {
+ $status = proc_get_status($handle);
+ if (!($status && $status['running'])) {
+ break;
+ }
+ usleep(50000);
+ }
+ },
+ $handle
+ );
}
?>
diff --git a/ext/opcache/tests/preload.inc b/ext/opcache/tests/preload.inc
index 10de9390d0..52bb60e348 100644
--- a/ext/opcache/tests/preload.inc
+++ b/ext/opcache/tests/preload.inc
@@ -3,39 +3,39 @@ function f1() {
}
if (isset($rt)) {
- function f2() {
- }
+ function f2() {
+ }
}
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() { }
}
trait T1 {
- static function foo() {
- var_dump(__METHOD__);
- }
+ static function foo() {
+ var_dump(__METHOD__);
+ }
}
trait T2 {
- use T1;
- static function bar() {
- var_dump(__METHOD__);
- }
+ use T1;
+ static function bar() {
+ var_dump(__METHOD__);
+ }
}
class Y {
- use T2;
+ use T2;
}
class Z {
@@ -50,9 +50,9 @@ function get_anon() {
}
if (!isset($rt)) {
- eval("class Foo {}");
+ eval("class Foo {}");
- class Bar extends Foo {}
+ class Bar extends Foo {}
- eval("function f3() {} ");
+ eval("function f3() {} ");
}
diff --git a/ext/opcache/tests/preload_009.phpt b/ext/opcache/tests/preload_009.phpt
index f3a28675e3..9422295814 100644
--- a/ext/opcache/tests/preload_009.phpt
+++ b/ext/opcache/tests/preload_009.phpt
@@ -16,6 +16,6 @@ var_dump(trait_exists('T'));
var_dump(class_exists('Foo'));
?>
--EXPECTF--
-Warning: Use of undefined constant UNDEF - assumed 'UNDEF' (this will throw an Error in a future version of PHP) in Unknown on line 0
-bool(true)
-bool(true)
+Fatal error: Undefined constant 'UNDEF' in Unknown on line 0
+
+Fatal error: Failed to resolve initializers of class Foo during preloading in Unknown on line 0
diff --git a/ext/opcache/tests/preload_011.phpt b/ext/opcache/tests/preload_011.phpt
index 59be0493b4..9beab03082 100644
--- a/ext/opcache/tests/preload_011.phpt
+++ b/ext/opcache/tests/preload_011.phpt
@@ -23,11 +23,9 @@ $f = new F;
$g = new G;
?>
-===DONE===
--EXPECTF--
Warning: Can't preload unlinked class H: Unknown type dependencies in %s on line %d
Warning: Can't preload unlinked class B: Unknown type dependencies in %s on line %d
Warning: Can't preload unlinked class A: Unknown type dependencies in %s on line %d
-===DONE===
diff --git a/ext/opcache/tests/preload_012.phpt b/ext/opcache/tests/preload_012.phpt
index bd3fd81bbd..7c5ad9aa1a 100644
--- a/ext/opcache/tests/preload_012.phpt
+++ b/ext/opcache/tests/preload_012.phpt
@@ -11,7 +11,5 @@ require_once('skipif.inc');
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
?>
--FILE--
-===DONE===
--EXPECTF--
Warning: Can't preload class Test with unresolved initializer for constant C in %s on line %d
-===DONE===
diff --git a/ext/opcache/tests/preload_bug78014.inc b/ext/opcache/tests/preload_bug78014.inc
index 84cc1d90c8..9c469a72b6 100644
--- a/ext/opcache/tests/preload_bug78014.inc
+++ b/ext/opcache/tests/preload_bug78014.inc
@@ -1,2 +1,2 @@
-<?php
+<?php
opcache_compile_file(__DIR__ . "/bug78014.inc");
diff --git a/ext/opcache/tests/preload_bug78175_2.inc b/ext/opcache/tests/preload_bug78175_2.inc
index a960e1b08c..cc99105457 100644
--- a/ext/opcache/tests/preload_bug78175_2.inc
+++ b/ext/opcache/tests/preload_bug78175_2.inc
@@ -1,18 +1,18 @@
<?php
class Loader {
- static private $loader;
+ static private $loader;
- static function getLoader() {
- if (null !== self::$loader) {
- return self::$loader;
- }
- return self::$loader = new Loader();
- }
+ static function getLoader() {
+ if (null !== self::$loader) {
+ return self::$loader;
+ }
+ return self::$loader = new Loader();
+ }
- static function getCounter() {
- static $counter = 0;
- return $counter++;
- }
+ static function getCounter() {
+ static $counter = 0;
+ return $counter++;
+ }
}
class ExtLoader extends Loader {
diff --git a/ext/opcache/tests/preload_bug78376.inc b/ext/opcache/tests/preload_bug78376.inc
index c482e0a821..87145ba3c5 100644
--- a/ext/opcache/tests/preload_bug78376.inc
+++ b/ext/opcache/tests/preload_bug78376.inc
@@ -1,6 +1,6 @@
<?php
const CNST = 'aaaa';
class A {
- public static $a = CNST;
+ public static $a = CNST;
}
$a = \A::$a;
diff --git a/ext/opcache/tests/preload_bug78937.inc b/ext/opcache/tests/preload_bug78937.inc
index 7da2dc3227..49acbb1a66 100644
--- a/ext/opcache/tests/preload_bug78937.inc
+++ b/ext/opcache/tests/preload_bug78937.inc
@@ -3,6 +3,6 @@ function foo() {
return new class extends Bar {};
}
function bar() {
- class Foo extends Bar {
- }
+ class Foo extends Bar {
+ }
}
diff --git a/ext/opcache/tests/preload_globals.inc b/ext/opcache/tests/preload_globals.inc
index 213dc60fab..7ae442dc03 100644
--- a/ext/opcache/tests/preload_globals.inc
+++ b/ext/opcache/tests/preload_globals.inc
@@ -1,5 +1,5 @@
<?php
function get_x() {
- return $GLOBALS["x"];
+ return $GLOBALS["x"];
}
diff --git a/ext/opcache/tests/preload_loadable_classes_2.phpt b/ext/opcache/tests/preload_loadable_classes_2.phpt
index d561837bd0..c1f873ec47 100644
--- a/ext/opcache/tests/preload_loadable_classes_2.phpt
+++ b/ext/opcache/tests/preload_loadable_classes_2.phpt
@@ -13,8 +13,6 @@ if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows
--FILE--
Unreachable
--EXPECTF--
-Warning: Use of undefined constant UNDEF - assumed 'UNDEF' (this will throw an Error in a future version of PHP) in Unknown on line 0
-
-Fatal error: Class 'Foo' not found in Unknown on line 0
+Fatal error: Undefined constant 'UNDEF' in Unknown on line 0
Fatal error: Failed to resolve initializers of class Test during preloading in Unknown on line 0
diff --git a/ext/opcache/tests/revalidate_path_01.phpt b/ext/opcache/tests/revalidate_path_01.phpt
index d982613103..317e872a4c 100644
--- a/ext/opcache/tests/revalidate_path_01.phpt
+++ b/ext/opcache/tests/revalidate_path_01.phpt
@@ -6,7 +6,6 @@ opcache.enable_cli=1
opcache.revalidate_path=1
--SKIPIF--
<?php require_once('skipif.inc'); ?>
-<?php if (php_sapi_name() != "cli") die("skip CLI only"); ?>
--CONFLICTS--
server
--FILE--
@@ -24,17 +23,17 @@ $main = "$dir/main.php";
@file_put_contents($file1, "TEST 1\n");
@file_put_contents($file2, "TEST 2\n");
while (filemtime($file1) != filemtime($file2)) {
- touch($file1);
- touch($file2);
+ touch($file1);
+ touch($file2);
}
if (substr(PHP_OS, 0, 3) == 'WIN') {
- @rmdir($link);
- $ln = str_replace('/', '\\', $link);
- $d1 = realpath($dir1);
- `mklink /j $ln $d1`;
+ @rmdir($link);
+ $ln = str_replace('/', '\\', $link);
+ $d1 = realpath($dir1);
+ `mklink /j $ln $d1`;
} else {
- @unlink($link);
- @symlink($dir1, $link);
+ @unlink($link);
+ @symlink($dir1, $link);
}
include "php_cli_server.inc";
@@ -43,13 +42,13 @@ php_cli_server_start('-d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.rev
echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/main.php');
echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/main.php');
if (substr(PHP_OS, 0, 3) == 'WIN') {
- @rmdir($link);
- $ln = str_replace('/', '\\', $link);
- $d2 = realpath($dir2);
- `mklink /j $ln $d2`;
+ @rmdir($link);
+ $ln = str_replace('/', '\\', $link);
+ $d2 = realpath($dir2);
+ `mklink /j $ln $d2`;
} else {
- @unlink($link);
- @symlink($dir2, $link);
+ @unlink($link);
+ @symlink($dir2, $link);
}
echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/main.php');
echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/main.php');
diff --git a/ext/opcache/tests/ssa_bug_001.phpt b/ext/opcache/tests/ssa_bug_001.phpt
index 62613e6eee..06be60892c 100644
--- a/ext/opcache/tests/ssa_bug_001.phpt
+++ b/ext/opcache/tests/ssa_bug_001.phpt
@@ -1,5 +1,5 @@
--TEST--
-SSA constrution for CFG with unreachable basic blocks
+SSA construction for CFG with unreachable basic blocks
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
diff --git a/ext/opcache/tests/ssa_bug_007.phpt b/ext/opcache/tests/ssa_bug_007.phpt
index e5237687b2..344a05665d 100644
--- a/ext/opcache/tests/ssa_bug_007.phpt
+++ b/ext/opcache/tests/ssa_bug_007.phpt
@@ -5,18 +5,18 @@ Incorrect CFG/SSA construction for SWITCH with few identical successors
--FILE--
<?php
function render($properties) {
- foreach ($properties as $key => $value) {
- switch ($key) {
- case 'Trapped':
- if ($value == null) {
- $docInfo->$key = 1;
- }
- case 'CreationDate':
- case 'ModDate':
- $docInfo->$key = 2;
- break;
- }
- }
+ foreach ($properties as $key => $value) {
+ switch ($key) {
+ case 'Trapped':
+ if ($value == null) {
+ $docInfo->$key = 1;
+ }
+ case 'CreationDate':
+ case 'ModDate':
+ $docInfo->$key = 2;
+ break;
+ }
+ }
}
?>
OK
diff --git a/ext/opcache/tests/ssa_bug_011.phpt b/ext/opcache/tests/ssa_bug_011.phpt
index c25e9c46ab..253bdc78d5 100644
--- a/ext/opcache/tests/ssa_bug_011.phpt
+++ b/ext/opcache/tests/ssa_bug_011.phpt
@@ -5,11 +5,11 @@ Wrong assertion
--FILE--
<?php
function foo($transitions) {
- foreach ($transitions as $transition) {
- if (isEmpty()) {
- continue;
- }
- }
+ foreach ($transitions as $transition) {
+ if (isEmpty()) {
+ continue;
+ }
+ }
}
?>
OK
diff --git a/ext/opcache/tests/wrong_inlining_002.phpt b/ext/opcache/tests/wrong_inlining_002.phpt
index 4e71a96d10..9aaa60c534 100644
--- a/ext/opcache/tests/wrong_inlining_002.phpt
+++ b/ext/opcache/tests/wrong_inlining_002.phpt
@@ -20,10 +20,7 @@ class Foo {
Foo::test();
?>
--EXPECTF--
-Deprecated: Non-static method Foo::test() should not be called statically in %swrong_inlining_002.php on line 11
-
-Fatal error: Uncaught Error: Using $this when not in object context in %swrong_inlining_002.php:7
+Fatal error: Uncaught Error: Non-static method Foo::test() cannot be called statically in %s:%d
Stack trace:
-#0 %swrong_inlining_002.php(11): Foo::test()
-#1 {main}
- thrown in %swrong_inlining_002.php on line 7
+#0 {main}
+ thrown in %s on line %d
diff --git a/ext/opcache/tests/wrong_inlining_003.phpt b/ext/opcache/tests/wrong_inlining_003.phpt
index a7e4a11b76..c83a4efc36 100644
--- a/ext/opcache/tests/wrong_inlining_003.phpt
+++ b/ext/opcache/tests/wrong_inlining_003.phpt
@@ -19,5 +19,5 @@ function test() {
test();
?>
--EXPECTF--
-Notice: Undefined variable: undef in %swrong_inlining_003.php on line 7
+Warning: Undefined variable: undef in %s on line %d
int(42)
diff --git a/ext/opcache/tests/wrong_inlining_004.phpt b/ext/opcache/tests/wrong_inlining_004.phpt
index 8ecb87cd4f..26f8f4b2bf 100644
--- a/ext/opcache/tests/wrong_inlining_004.phpt
+++ b/ext/opcache/tests/wrong_inlining_004.phpt
@@ -1,5 +1,5 @@
--TEST--
-Inlining throgh call_user_func()
+Inlining through call_user_func()
--INI--
opcache.enable=1
opcache.enable_cli=1
diff --git a/ext/opcache/zend_accelerator_debug.c b/ext/opcache/zend_accelerator_debug.c
index 991f2329da..f91c269975 100644
--- a/ext/opcache/zend_accelerator_debug.c
+++ b/ext/opcache/zend_accelerator_debug.c
@@ -47,7 +47,7 @@ void zend_accel_error(int type, const char *format, ...)
fLog = stderr;
} else {
- fLog = fopen(ZCG(accel_directives).error_log, "a+");
+ fLog = fopen(ZCG(accel_directives).error_log, "a");
if (!fLog) {
fLog = stderr;
}
diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c
index 7d04e49f32..c3bb66bdb1 100644
--- a/ext/opcache/zend_accelerator_module.c
+++ b/ext/opcache/zend_accelerator_module.c
@@ -31,6 +31,11 @@
#include "zend_virtual_cwd.h"
#include "ext/standard/info.h"
#include "ext/standard/php_filestat.h"
+#include "opcache_arginfo.h"
+
+#if HAVE_JIT
+#include "jit/zend_jit.h"
+#endif
#define STRING_NOT_NULL(s) (NULL == (s)?"":s)
#define MIN_ACCEL_FILES 200
@@ -41,26 +46,6 @@ static zif_handler orig_file_exists = NULL;
static zif_handler orig_is_file = NULL;
static zif_handler orig_is_readable = NULL;
-ZEND_BEGIN_ARG_INFO(arginfo_opcache_none, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_opcache_get_status, 0, 0, 0)
- ZEND_ARG_INFO(0, fetch_scripts)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_opcache_compile_file, 0, 0, 1)
- ZEND_ARG_INFO(0, file)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_opcache_invalidate, 0, 0, 1)
- ZEND_ARG_INFO(0, script)
- ZEND_ARG_INFO(0, force)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_opcache_is_script_cached, 0, 0, 1)
- ZEND_ARG_INFO(0, script)
-ZEND_END_ARG_INFO()
-
/* User functions */
static ZEND_FUNCTION(opcache_reset);
static ZEND_FUNCTION(opcache_invalidate);
@@ -73,12 +58,12 @@ static ZEND_FUNCTION(opcache_get_configuration);
static const zend_function_entry accel_functions[] = {
/* User functions */
- ZEND_FE(opcache_reset, arginfo_opcache_none)
+ ZEND_FE(opcache_reset, arginfo_opcache_reset)
ZEND_FE(opcache_invalidate, arginfo_opcache_invalidate)
ZEND_FE(opcache_compile_file, arginfo_opcache_compile_file)
ZEND_FE(opcache_is_script_cached, arginfo_opcache_is_script_cached)
/* Private functions */
- ZEND_FE(opcache_get_configuration, arginfo_opcache_none)
+ ZEND_FE(opcache_get_configuration, arginfo_opcache_get_configuration)
ZEND_FE(opcache_get_status, arginfo_opcache_get_status)
ZEND_FE_END
};
@@ -327,6 +312,12 @@ ZEND_INI_BEGIN()
#if ZEND_WIN32
STD_PHP_INI_ENTRY("opcache.cache_id" , "" , PHP_INI_SYSTEM, OnUpdateString, accel_directives.cache_id, zend_accel_globals, accel_globals)
#endif
+#ifdef HAVE_JIT
+ STD_PHP_INI_ENTRY("opcache.jit" , ZEND_JIT_DEFAULT, PHP_INI_SYSTEM, OnUpdateLong, accel_directives.jit, zend_accel_globals, accel_globals)
+ STD_PHP_INI_ENTRY("opcache.jit_buffer_size" , "0" , PHP_INI_SYSTEM, OnUpdateLong, accel_directives.jit_buffer_size, zend_accel_globals, accel_globals)
+ STD_PHP_INI_ENTRY("opcache.jit_debug" , "0" , PHP_INI_SYSTEM, OnUpdateLong, accel_directives.jit_debug, zend_accel_globals, accel_globals)
+ STD_PHP_INI_ENTRY("opcache.jit_bisect_limit" , "0" , PHP_INI_SYSTEM, OnUpdateLong, accel_directives.jit_bisect_limit, zend_accel_globals, accel_globals)
+#endif
ZEND_INI_END()
static int filename_is_in_cache(zend_string *filename)
@@ -457,6 +448,15 @@ void zend_accel_info(ZEND_MODULE_INFO_FUNC_ARGS)
} else {
php_info_print_table_row(2, "File Cache", "Disabled");
}
+#if HAVE_JIT
+ if (ZCG(jit_enabled)) {
+ php_info_print_table_row(2, "JIT", "Enabled");
+ } else {
+ php_info_print_table_row(2, "JIT", "Disabled");
+ }
+#else
+ php_info_print_table_row(2, "JIT", "Not Available");
+#endif
if (file_cache_only) {
if (!accel_startup_ok || zps_api_failure_reason) {
php_info_print_table_row(2, "Startup Failed", zps_api_failure_reason);
@@ -585,7 +585,7 @@ static ZEND_FUNCTION(opcache_get_status)
zend_bool fetch_scripts = 1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &fetch_scripts) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!validate_api_restriction()) {
@@ -699,6 +699,9 @@ static ZEND_FUNCTION(opcache_get_status)
add_assoc_zval(return_value, "scripts", &scripts);
}
}
+#if HAVE_JIT
+ zend_jit_status(return_value);
+#endif
}
static int add_blacklist_path(zend_blacklist_entry *p, zval *return_value)
@@ -714,7 +717,7 @@ static ZEND_FUNCTION(opcache_get_configuration)
zval directives, version, blacklist;
if (zend_parse_parameters_none() == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (!validate_api_restriction()) {
@@ -780,6 +783,12 @@ static ZEND_FUNCTION(opcache_get_configuration)
#if ZEND_WIN32
add_assoc_string(&directives, "opcache.cache_id", STRING_NOT_NULL(ZCG(accel_directives).cache_id));
#endif
+#ifdef HAVE_JIT
+ add_assoc_long(&directives, "opcache.jit", ZCG(accel_directives).jit);
+ add_assoc_long(&directives, "opcache.jit_buffer_size", ZCG(accel_directives).jit_buffer_size);
+ add_assoc_long(&directives, "opcache.jit_debug", ZCG(accel_directives).jit_debug);
+ add_assoc_long(&directives, "opcache.jit_bisect_limit", ZCG(accel_directives).jit_bisect_limit);
+#endif
add_assoc_zval(return_value, "directives", &directives);
@@ -800,7 +809,7 @@ static ZEND_FUNCTION(opcache_get_configuration)
static ZEND_FUNCTION(opcache_reset)
{
if (zend_parse_parameters_none() == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (!validate_api_restriction()) {
@@ -831,7 +840,7 @@ static ZEND_FUNCTION(opcache_invalidate)
zend_bool force = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|b", &script_name, &script_name_len, &force) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!validate_api_restriction()) {
@@ -855,7 +864,7 @@ static ZEND_FUNCTION(opcache_compile_file)
uint32_t orig_compiler_options;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &script_name, &script_name_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!accel_startup_ok) {
@@ -910,7 +919,7 @@ static ZEND_FUNCTION(opcache_is_script_cached)
}
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &script_name) == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_BOOL(filename_is_in_cache(script_name));
diff --git a/ext/opcache/zend_accelerator_util_funcs.c b/ext/opcache/zend_accelerator_util_funcs.c
index 53efa865c7..131fc8495b 100644
--- a/ext/opcache/zend_accelerator_util_funcs.c
+++ b/ext/opcache/zend_accelerator_util_funcs.c
@@ -233,11 +233,28 @@ static void zend_hash_clone_prop_info(HashTable *ht)
prop_info->ce = ARENA_REALLOC(prop_info->ce);
}
- if (ZEND_TYPE_IS_CE(prop_info->type)) {
+ if (ZEND_TYPE_HAS_LIST(prop_info->type)) {
+ zend_type_list *list = ZEND_TYPE_LIST(prop_info->type);
+ if (IN_ARENA(list)) {
+ list = ARENA_REALLOC(list);
+ ZEND_TYPE_SET_PTR(prop_info->type, list);
+
+ zend_type *list_type;
+ ZEND_TYPE_LIST_FOREACH(ZEND_TYPE_LIST(prop_info->type), list_type) {
+ if (ZEND_TYPE_HAS_CE(*list_type)) {
+ zend_class_entry *ce = ZEND_TYPE_CE(*list_type);
+ if (IN_ARENA(ce)) {
+ ce = ARENA_REALLOC(ce);
+ ZEND_TYPE_SET_PTR(*list_type, ce);
+ }
+ }
+ } ZEND_TYPE_LIST_FOREACH_END();
+ }
+ } else if (ZEND_TYPE_HAS_CE(prop_info->type)) {
zend_class_entry *ce = ZEND_TYPE_CE(prop_info->type);
if (IN_ARENA(ce)) {
ce = ARENA_REALLOC(ce);
- prop_info->type = ZEND_TYPE_ENCODE_CE(ce, ZEND_TYPE_ALLOW_NULL(prop_info->type));
+ ZEND_TYPE_SET_PTR(prop_info->type, ce);
}
}
}
diff --git a/ext/opcache/zend_file_cache.c b/ext/opcache/zend_file_cache.c
index 18c69288b3..eb74187e5d 100644
--- a/ext/opcache/zend_file_cache.c
+++ b/ext/opcache/zend_file_cache.c
@@ -371,26 +371,27 @@ static void zend_file_cache_serialize_zval(zval *zv,
}
}
-/* Adjust serialized pointer to conform to zend_type assumptions:
- * Pointer must have low two bits unset and be larger than 0x400. */
-#define ZEND_TYPE_PTR_ENCODE(ptr) \
- (void*)(((uintptr_t)ptr << 2) + 0x400)
-#define ZEND_TYPE_PTR_DECODE(ptr) \
- (void*)(((uintptr_t)ptr - 0x400) >> 2)
-
static void zend_file_cache_serialize_type(
zend_type *type, zend_persistent_script *script, zend_file_cache_metainfo *info, void *buf)
{
- if (ZEND_TYPE_IS_NAME(*type)) {
- zend_string *name = ZEND_TYPE_NAME(*type);
- SERIALIZE_STR(name);
- name = ZEND_TYPE_PTR_ENCODE(name);
- *type = ZEND_TYPE_ENCODE_CLASS(name, ZEND_TYPE_ALLOW_NULL(*type));
- } else if (ZEND_TYPE_IS_CE(*type)) {
+ if (ZEND_TYPE_HAS_LIST(*type)) {
+ zend_type_list *list = ZEND_TYPE_LIST(*type);
+ SERIALIZE_PTR(list);
+ ZEND_TYPE_SET_PTR(*type, list);
+ UNSERIALIZE_PTR(list);
+
+ zend_type *list_type;
+ ZEND_TYPE_LIST_FOREACH(list, list_type) {
+ zend_file_cache_serialize_type(list_type, script, info, buf);
+ } ZEND_TYPE_LIST_FOREACH_END();
+ } else if (ZEND_TYPE_HAS_NAME(*type)) {
+ zend_string *type_name = ZEND_TYPE_NAME(*type);
+ SERIALIZE_STR(type_name);
+ ZEND_TYPE_SET_PTR(*type, type_name);
+ } else if (ZEND_TYPE_HAS_CE(*type)) {
zend_class_entry *ce = ZEND_TYPE_CE(*type);
SERIALIZE_PTR(ce);
- ce = ZEND_TYPE_PTR_ENCODE(ce);
- *type = ZEND_TYPE_ENCODE_CE(ce, ZEND_TYPE_ALLOW_NULL(*type));
+ ZEND_TYPE_SET_PTR(*type, ce);
}
}
@@ -590,8 +591,8 @@ static void zend_file_cache_serialize_prop_info(zval *zv,
if (prop->doc_comment) {
SERIALIZE_STR(prop->doc_comment);
}
+ zend_file_cache_serialize_type(&prop->type, script, info, buf);
}
- zend_file_cache_serialize_type(&prop->type, script, info, buf);
}
}
@@ -889,6 +890,13 @@ int zend_file_cache_script_store(zend_persistent_script *script, int in_shm)
#endif
void *mem, *buf;
+#ifdef HAVE_JIT
+ /* FIXME: dump jited codes out to file cache? */
+ if (ZCG(jit_enabled)) {
+ return FAILURE;
+ }
+#endif
+
filename = zend_file_cache_get_bin_file_path(script->script.filename);
if (zend_file_cache_mkdir(filename, strlen(ZCG(accel_directives).file_cache)) != SUCCESS) {
@@ -1087,16 +1095,23 @@ static void zend_file_cache_unserialize_zval(zval *zv,
static void zend_file_cache_unserialize_type(
zend_type *type, zend_persistent_script *script, void *buf)
{
- if (ZEND_TYPE_IS_NAME(*type)) {
- zend_string *name = ZEND_TYPE_NAME(*type);
- name = ZEND_TYPE_PTR_DECODE(name);
- UNSERIALIZE_STR(name);
- *type = ZEND_TYPE_ENCODE_CLASS(name, ZEND_TYPE_ALLOW_NULL(*type));
- } else if (ZEND_TYPE_IS_CE(*type)) {
+ if (ZEND_TYPE_HAS_LIST(*type)) {
+ zend_type_list *list = ZEND_TYPE_LIST(*type);
+ UNSERIALIZE_PTR(list);
+ ZEND_TYPE_SET_PTR(*type, list);
+
+ zend_type *list_type;
+ ZEND_TYPE_LIST_FOREACH(list, list_type) {
+ zend_file_cache_unserialize_type(list_type, script, buf);
+ } ZEND_TYPE_LIST_FOREACH_END();
+ } else if (ZEND_TYPE_HAS_NAME(*type)) {
+ zend_string *type_name = ZEND_TYPE_NAME(*type);
+ UNSERIALIZE_STR(type_name);
+ ZEND_TYPE_SET_PTR(*type, type_name);
+ } else if (ZEND_TYPE_HAS_CE(*type)) {
zend_class_entry *ce = ZEND_TYPE_CE(*type);
- ce = ZEND_TYPE_PTR_DECODE(ce);
UNSERIALIZE_PTR(ce);
- *type = ZEND_TYPE_ENCODE_CE(ce, ZEND_TYPE_ALLOW_NULL(*type));
+ ZEND_TYPE_SET_PTR(*type, ce);
}
}
@@ -1292,8 +1307,8 @@ static void zend_file_cache_unserialize_prop_info(zval *zv,
if (prop->doc_comment) {
UNSERIALIZE_STR(prop->doc_comment);
}
+ zend_file_cache_unserialize_type(&prop->type, script, buf);
}
- zend_file_cache_unserialize_type(&prop->type, script, buf);
}
}
diff --git a/ext/opcache/zend_persist.c b/ext/opcache/zend_persist.c
index dd4c199ef7..1bcec7caf0 100644
--- a/ext/opcache/zend_persist.c
+++ b/ext/opcache/zend_persist.c
@@ -29,6 +29,10 @@
#include "zend_operators.h"
#include "zend_interfaces.h"
+#ifdef HAVE_JIT
+# include "jit/zend_jit.h"
+#endif
+
#define zend_set_str_gc_flags(str) do { \
if (file_cache_only) { \
GC_TYPE_INFO(str) = IS_STRING | (IS_STR_INTERNED << GC_FLAGS_SHIFT); \
@@ -254,6 +258,35 @@ static void zend_persist_zval(zval *z)
}
}
+static void zend_persist_type(zend_type *type) {
+ if (ZEND_TYPE_HAS_LIST(*type)) {
+ zend_type *list_type;
+ zend_type_list *list = ZEND_TYPE_LIST(*type);
+ if (ZEND_TYPE_USES_ARENA(*type)) {
+ if (!ZCG(is_immutable_class)) {
+ list = zend_shared_memdup_arena_put(list, ZEND_TYPE_LIST_SIZE(list->num_types));
+ } else {
+ /* Moved from arena to SHM because type list was fully resolved. */
+ list = zend_shared_memdup_put(list, ZEND_TYPE_LIST_SIZE(list->num_types));
+ ZEND_TYPE_FULL_MASK(*type) &= ~_ZEND_TYPE_ARENA_BIT;
+ }
+ } else {
+ list = zend_shared_memdup_put_free(list, ZEND_TYPE_LIST_SIZE(list->num_types));
+ }
+ ZEND_TYPE_SET_PTR(*type, list);
+
+ ZEND_TYPE_LIST_FOREACH(list, list_type) {
+ zend_string *type_name = ZEND_TYPE_NAME(*list_type);
+ zend_accel_store_interned_string(type_name);
+ ZEND_TYPE_SET_PTR(*list_type, type_name);
+ } ZEND_TYPE_LIST_FOREACH_END();
+ } else if (ZEND_TYPE_HAS_NAME(*type)) {
+ zend_string *type_name = ZEND_TYPE_NAME(*type);
+ zend_accel_store_interned_string(type_name);
+ ZEND_TYPE_SET_PTR(*type, type_name);
+ }
+}
+
static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_script* main_persistent_script)
{
zend_op *persist_ptr;
@@ -495,13 +528,7 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc
if (arg_info[i].name) {
zend_accel_store_interned_string(arg_info[i].name);
}
- if (ZEND_TYPE_IS_CLASS(arg_info[i].type)) {
- zend_string *type_name = ZEND_TYPE_NAME(arg_info[i].type);
- zend_bool allow_null = ZEND_TYPE_ALLOW_NULL(arg_info[i].type);
-
- zend_accel_store_interned_string(type_name);
- arg_info[i].type = ZEND_TYPE_ENCODE_CLASS(type_name, allow_null);
- }
+ zend_persist_type(&arg_info[i].type);
}
if (op_array->fn_flags & ZEND_ACC_HAS_RETURN_TYPE) {
arg_info++;
@@ -535,6 +562,14 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc
}
ZCG(mem) = (void*)((char*)ZCG(mem) + ZEND_ALIGNED_SIZE(zend_extensions_op_array_persist(op_array, ZCG(mem))));
+
+#ifdef HAVE_JIT
+ if (ZCG(jit_enabled) &&
+ ZEND_JIT_LEVEL(ZCG(accel_directives).jit) <= ZEND_JIT_LEVEL_OPT_FUNCS &&
+ !ZCG(current_persistent_script)->corrupted) {
+ zend_jit_op_array(op_array, ZCG(current_persistent_script) ? &ZCG(current_persistent_script)->script : NULL);
+ }
+#endif
}
static void zend_persist_op_array(zval *zv)
@@ -648,12 +683,7 @@ static void zend_persist_property_info(zval *zv)
prop->doc_comment = NULL;
}
}
-
- if (ZEND_TYPE_IS_NAME(prop->type)) {
- zend_string *class_name = ZEND_TYPE_NAME(prop->type);
- zend_accel_store_interned_string(class_name);
- prop->type = ZEND_TYPE_ENCODE_CLASS(class_name, ZEND_TYPE_ALLOW_NULL(prop->type));
- }
+ zend_persist_type(&prop->type);
}
static void zend_persist_class_constant(zval *zv)
@@ -917,10 +947,10 @@ static void zend_update_parent_ce(zend_class_entry *ce)
if (ce->iterator_funcs_ptr) {
memset(ce->iterator_funcs_ptr, 0, sizeof(zend_class_iterator_funcs));
- if (instanceof_function_ex(ce, zend_ce_aggregate, 1)) {
+ if (zend_class_implements_interface(ce, zend_ce_aggregate)) {
ce->iterator_funcs_ptr->zf_new_iterator = zend_hash_str_find_ptr(&ce->function_table, "getiterator", sizeof("getiterator") - 1);
}
- if (instanceof_function_ex(ce, zend_ce_iterator, 1)) {
+ if (zend_class_implements_interface(ce, zend_ce_iterator)) {
ce->iterator_funcs_ptr->zf_rewind = zend_hash_str_find_ptr(&ce->function_table, "rewind", sizeof("rewind") - 1);
ce->iterator_funcs_ptr->zf_valid = zend_hash_str_find_ptr(&ce->function_table, "valid", sizeof("valid") - 1);
ce->iterator_funcs_ptr->zf_key = zend_hash_str_find_ptr(&ce->function_table, "key", sizeof("key") - 1);
@@ -933,15 +963,18 @@ static void zend_update_parent_ce(zend_class_entry *ce)
if (ce->ce_flags & ZEND_ACC_HAS_TYPE_HINTS) {
zend_property_info *prop;
ZEND_HASH_FOREACH_PTR(&ce->properties_info, prop) {
- if (ZEND_TYPE_IS_CE(prop->type)) {
- zend_class_entry *ce = ZEND_TYPE_CE(prop->type);
- if (ce->type == ZEND_USER_CLASS) {
- ce = zend_shared_alloc_get_xlat_entry(ce);
- if (ce) {
- prop->type = ZEND_TYPE_ENCODE_CE(ce, ZEND_TYPE_ALLOW_NULL(prop->type));
+ zend_type *single_type;
+ ZEND_TYPE_FOREACH(prop->type, single_type) {
+ if (ZEND_TYPE_HAS_CE(*single_type)) {
+ zend_class_entry *ce = ZEND_TYPE_CE(*single_type);
+ if (ce->type == ZEND_USER_CLASS) {
+ ce = zend_shared_alloc_get_xlat_entry(ce);
+ if (ce) {
+ ZEND_TYPE_SET_PTR(*single_type, ce);
+ }
}
}
- }
+ } ZEND_TYPE_FOREACH_END();
} ZEND_HASH_FOREACH_END();
}
@@ -1078,6 +1111,12 @@ zend_persistent_script *zend_accel_script_persist(zend_persistent_script *script
script->arena_mem = ZCG(arena_mem) = ZCG(mem);
ZCG(mem) = (void*)((char*)ZCG(mem) + script->arena_size);
+#ifdef HAVE_JIT
+ if (ZCG(jit_enabled) && for_shm) {
+ zend_jit_unprotect();
+ }
+#endif
+
zend_map_ptr_extend(ZCSG(map_ptr_last));
zend_accel_persist_class_table(&script->script.class_table);
@@ -1093,6 +1132,15 @@ zend_persistent_script *zend_accel_script_persist(zend_persistent_script *script
ZCSG(map_ptr_last) = CG(map_ptr_last);
}
+#ifdef HAVE_JIT
+ if (ZCG(jit_enabled) && for_shm) {
+ if (ZEND_JIT_LEVEL(ZCG(accel_directives).jit) >= ZEND_JIT_LEVEL_OPT_SCRIPT) {
+ zend_jit_script(&script->script);
+ }
+ zend_jit_protect();
+ }
+#endif
+
script->corrupted = 0;
ZCG(current_persistent_script) = NULL;
diff --git a/ext/opcache/zend_persist_calc.c b/ext/opcache/zend_persist_calc.c
index dacc2376e8..293af3b3e6 100644
--- a/ext/opcache/zend_persist_calc.c
+++ b/ext/opcache/zend_persist_calc.c
@@ -148,6 +148,27 @@ static void zend_persist_zval_calc(zval *z)
}
}
+static void zend_persist_type_calc(zend_type *type)
+{
+ if (ZEND_TYPE_HAS_LIST(*type)) {
+ zend_type *list_type;
+ if (ZEND_TYPE_USES_ARENA(*type) && !ZCG(is_immutable_class)) {
+ ADD_ARENA_SIZE(ZEND_TYPE_LIST_SIZE(ZEND_TYPE_LIST(*type)->num_types));
+ } else {
+ ADD_SIZE(ZEND_TYPE_LIST_SIZE(ZEND_TYPE_LIST(*type)->num_types));
+ }
+ ZEND_TYPE_LIST_FOREACH(ZEND_TYPE_LIST(*type), list_type) {
+ zend_string *type_name = ZEND_TYPE_NAME(*list_type);
+ ADD_INTERNED_STRING(type_name);
+ ZEND_TYPE_SET_PTR(*list_type, type_name);
+ } ZEND_TYPE_LIST_FOREACH_END();
+ } else if (ZEND_TYPE_HAS_NAME(*type)) {
+ zend_string *type_name = ZEND_TYPE_NAME(*type);
+ ADD_INTERNED_STRING(type_name);
+ ZEND_TYPE_SET_PTR(*type, type_name);
+ }
+}
+
static void zend_persist_op_array_calc_ex(zend_op_array *op_array)
{
if (op_array->scope && zend_shared_alloc_get_xlat_entry(op_array->opcodes)) {
@@ -222,13 +243,7 @@ static void zend_persist_op_array_calc_ex(zend_op_array *op_array)
if (arg_info[i].name) {
ADD_INTERNED_STRING(arg_info[i].name);
}
- if (ZEND_TYPE_IS_CLASS(arg_info[i].type)) {
- zend_string *type_name = ZEND_TYPE_NAME(arg_info[i].type);
- zend_bool allow_null = ZEND_TYPE_ALLOW_NULL(arg_info[i].type);
-
- ADD_INTERNED_STRING(type_name);
- arg_info[i].type = ZEND_TYPE_ENCODE_CLASS(type_name, allow_null);
- }
+ zend_persist_type_calc(&arg_info[i].type);
}
}
@@ -304,11 +319,7 @@ static void zend_persist_property_info_calc(zval *zv)
zend_shared_alloc_register_xlat_entry(prop, prop);
ADD_SIZE_EX(sizeof(zend_property_info));
ADD_INTERNED_STRING(prop->name);
- if (ZEND_TYPE_IS_NAME(prop->type)) {
- zend_string *class_name = ZEND_TYPE_NAME(prop->type);
- ADD_INTERNED_STRING(class_name);
- prop->type = ZEND_TYPE_ENCODE_CLASS(class_name, ZEND_TYPE_ALLOW_NULL(prop->type));
- }
+ zend_persist_type_calc(&prop->type);
if (ZCG(accel_directives).save_comments && prop->doc_comment) {
ADD_STRING(prop->doc_comment);
}
@@ -338,9 +349,12 @@ static void check_property_type_resolution(zend_class_entry *ce) {
if (ce->ce_flags & ZEND_ACC_HAS_TYPE_HINTS) {
ZEND_HASH_FOREACH_PTR(&ce->properties_info, prop) {
- if (ZEND_TYPE_IS_NAME(prop->type)) {
- return;
- }
+ zend_type *single_type;
+ ZEND_TYPE_FOREACH(prop->type, single_type) {
+ if (ZEND_TYPE_HAS_NAME(*single_type)) {
+ return;
+ }
+ } ZEND_TYPE_FOREACH_END();
} ZEND_HASH_FOREACH_END();
}
ce->ce_flags |= ZEND_ACC_PROPERTY_TYPES_RESOLVED;
diff --git a/ext/opcache/zend_shared_alloc.c b/ext/opcache/zend_shared_alloc.c
index 8e75cda333..d32a70b7e8 100644
--- a/ext/opcache/zend_shared_alloc.c
+++ b/ext/opcache/zend_shared_alloc.c
@@ -145,7 +145,7 @@ static int zend_shared_alloc_try(const zend_shared_memory_handler_entry *he, siz
return ALLOC_FAILURE;
}
-int zend_shared_alloc_startup(size_t requested_size)
+int zend_shared_alloc_startup(size_t requested_size, size_t reserved_size)
{
zend_shared_segment **tmp_shared_segments;
size_t shared_segments_array_size;
@@ -153,13 +153,13 @@ int zend_shared_alloc_startup(size_t requested_size)
char *error_in = NULL;
const zend_shared_memory_handler_entry *he;
int res = ALLOC_FAILURE;
-
+ int i;
/* shared_free must be valid before we call zend_shared_alloc()
* - make it temporarily point to a local variable
*/
smm_shared_globals = &tmp_shared_globals;
- ZSMMG(shared_free) = requested_size; /* goes to tmp_shared_globals.shared_free */
+ ZSMMG(shared_free) = requested_size - reserved_size; /* goes to tmp_shared_globals.shared_free */
#ifndef ZEND_WIN32
zend_shared_alloc_create_lock(ZCG(accel_directives).lockfile_path);
@@ -220,10 +220,15 @@ int zend_shared_alloc_startup(size_t requested_size)
}
#endif
+ for (i = 0; i < ZSMMG(shared_segments_count); i++) {
+ ZSMMG(shared_segments)[i]->end = ZSMMG(shared_segments)[i]->size;
+ }
+
shared_segments_array_size = ZSMMG(shared_segments_count) * S_H(segment_type_size)();
/* move shared_segments and shared_free to shared memory */
ZCG(locked) = 1; /* no need to perform a real lock at this point */
+
p_tmp_shared_globals = (zend_smm_shared_globals *) zend_shared_alloc(sizeof(zend_smm_shared_globals));
if (!p_tmp_shared_globals) {
zend_accel_error(ACCEL_LOG_FATAL, "Insufficient shared memory!");
@@ -251,6 +256,18 @@ int zend_shared_alloc_startup(size_t requested_size)
return ALLOC_FAILURE;
}
+ if (reserved_size) {
+ i = ZSMMG(shared_segments_count) - 1;
+ if (ZSMMG(shared_segments)[i]->size - ZSMMG(shared_segments)[i]->pos >= reserved_size) {
+ ZSMMG(shared_segments)[i]->end = ZSMMG(shared_segments)[i]->size - reserved_size;
+ ZSMMG(reserved) = (char*)ZSMMG(shared_segments)[i]->p + ZSMMG(shared_segments)[i]->end;
+ ZSMMG(reserved_size) = reserved_size;
+ } else {
+ zend_accel_error(ACCEL_LOG_FATAL, "Insufficient shared memory!");
+ return ALLOC_FAILURE;
+ }
+ }
+
ZCG(locked) = 0;
return res;
@@ -298,7 +315,7 @@ static size_t zend_shared_alloc_get_largest_free_block(void)
size_t largest_block_size = 0;
for (i = 0; i < ZSMMG(shared_segments_count); i++) {
- size_t block_size = ZSMMG(shared_segments)[i]->size - ZSMMG(shared_segments)[i]->pos;
+ size_t block_size = ZSMMG(shared_segments)[i]->end - ZSMMG(shared_segments)[i]->pos;
if (block_size>largest_block_size) {
largest_block_size = block_size;
@@ -331,7 +348,7 @@ void *zend_shared_alloc(size_t size)
return NULL;
}
for (i = 0; i < ZSMMG(shared_segments_count); i++) {
- if (ZSMMG(shared_segments)[i]->size - ZSMMG(shared_segments)[i]->pos >= block_size) { /* found a valid block */
+ if (ZSMMG(shared_segments)[i]->end - ZSMMG(shared_segments)[i]->pos >= block_size) { /* found a valid block */
void *retval = (void *) (((char *) ZSMMG(shared_segments)[i]->p) + ZSMMG(shared_segments)[i]->pos);
ZSMMG(shared_segments)[i]->pos += block_size;
@@ -596,7 +613,7 @@ void zend_accel_shared_protect(int mode)
}
for (i = 0; i < ZSMMG(shared_segments_count); i++) {
- mprotect(ZSMMG(shared_segments)[i]->p, ZSMMG(shared_segments)[i]->size, mode);
+ mprotect(ZSMMG(shared_segments)[i]->p, ZSMMG(shared_segments)[i]->end, mode);
}
#elif defined(ZEND_WIN32)
int i;
@@ -613,7 +630,7 @@ void zend_accel_shared_protect(int mode)
for (i = 0; i < ZSMMG(shared_segments_count); i++) {
DWORD oldProtect;
- if (!VirtualProtect(ZSMMG(shared_segments)[i]->p, ZSMMG(shared_segments)[i]->size, mode, &oldProtect)) {
+ if (!VirtualProtect(ZSMMG(shared_segments)[i]->p, ZSMMG(shared_segments)[i]->end, mode, &oldProtect)) {
zend_accel_error(ACCEL_LOG_ERROR, "Failed to protect memory");
}
}
@@ -630,7 +647,7 @@ int zend_accel_in_shm(void *ptr)
for (i = 0; i < ZSMMG(shared_segments_count); i++) {
if ((char*)ptr >= (char*)ZSMMG(shared_segments)[i]->p &&
- (char*)ptr < (char*)ZSMMG(shared_segments)[i]->p + ZSMMG(shared_segments)[i]->size) {
+ (char*)ptr < (char*)ZSMMG(shared_segments)[i]->p + ZSMMG(shared_segments)[i]->end) {
return 1;
}
}
diff --git a/ext/opcache/zend_shared_alloc.h b/ext/opcache/zend_shared_alloc.h
index 2a77dfbef7..1dbc88d42e 100644
--- a/ext/opcache/zend_shared_alloc.h
+++ b/ext/opcache/zend_shared_alloc.h
@@ -75,6 +75,7 @@
typedef struct _zend_shared_segment {
size_t size;
+ size_t end;
size_t pos; /* position for simple stack allocator */
void *p;
} zend_shared_segment;
@@ -113,6 +114,9 @@ typedef struct _zend_smm_shared_globals {
zend_shared_memory_state shared_memory_state;
/* Pointer to the application's shared data structures */
void *app_shared_globals;
+ /* Reserved shared memory */
+ void *reserved;
+ size_t reserved_size;
} zend_smm_shared_globals;
extern zend_smm_shared_globals *smm_shared_globals;
@@ -121,10 +125,11 @@ extern zend_smm_shared_globals *smm_shared_globals;
#define SHARED_ALLOC_REATTACHED (SUCCESS+1)
-int zend_shared_alloc_startup(size_t requested_size);
+int zend_shared_alloc_startup(size_t requested_size, size_t reserved_size);
void zend_shared_alloc_shutdown(void);
/* allocate shared memory block */
+void *zend_shared_alloc_pages(size_t requested_size);
void *zend_shared_alloc(size_t size);
/* copy into shared memory */
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index 04cb9b0f23..bb3880f518 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -85,6 +83,8 @@
#define HAVE_EVP_PKEY_EC 1
#endif
+#include "openssl_arginfo.h"
+
ZEND_DECLARE_MODULE_GLOBALS(openssl)
/* FIXME: Use the openssl constants instead of
@@ -130,344 +130,6 @@ PHP_FUNCTION(openssl_dh_compute_key);
PHP_FUNCTION(openssl_pkey_derive);
PHP_FUNCTION(openssl_random_pseudo_bytes);
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_x509_export_to_file, 0, 0, 2)
- ZEND_ARG_INFO(0, x509)
- ZEND_ARG_INFO(0, outfilename)
- ZEND_ARG_INFO(0, notext)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_x509_export, 0, 0, 2)
- ZEND_ARG_INFO(0, x509)
- ZEND_ARG_INFO(1, out)
- ZEND_ARG_INFO(0, notext)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_x509_fingerprint, 0, 0, 1)
- ZEND_ARG_INFO(0, x509)
- ZEND_ARG_INFO(0, method)
- ZEND_ARG_INFO(0, raw_output)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_openssl_x509_check_private_key, 0)
- ZEND_ARG_INFO(0, cert)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_openssl_x509_verify, 0)
- ZEND_ARG_INFO(0, cert)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_x509_parse, 0, 0, 1)
- ZEND_ARG_INFO(0, x509)
- ZEND_ARG_INFO(0, shortname)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_x509_checkpurpose, 0, 0, 2)
- ZEND_ARG_INFO(0, x509cert)
- ZEND_ARG_INFO(0, purpose)
- ZEND_ARG_INFO(0, cainfo) /* array */
- ZEND_ARG_INFO(0, untrustedfile)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_openssl_x509_read, 0)
- ZEND_ARG_INFO(0, cert)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_openssl_x509_free, 0)
- ZEND_ARG_INFO(0, x509)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_pkcs12_export_to_file, 0, 0, 4)
- ZEND_ARG_INFO(0, x509)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, priv_key)
- ZEND_ARG_INFO(0, pass)
- ZEND_ARG_INFO(0, args) /* array */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_pkcs12_export, 0, 0, 4)
- ZEND_ARG_INFO(0, x509)
- ZEND_ARG_INFO(1, out)
- ZEND_ARG_INFO(0, priv_key)
- ZEND_ARG_INFO(0, pass)
- ZEND_ARG_INFO(0, args) /* array */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_openssl_pkcs12_read, 0)
- ZEND_ARG_INFO(0, PKCS12)
- ZEND_ARG_INFO(1, certs) /* array */
- ZEND_ARG_INFO(0, pass)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_csr_export_to_file, 0, 0, 2)
- ZEND_ARG_INFO(0, csr)
- ZEND_ARG_INFO(0, outfilename)
- ZEND_ARG_INFO(0, notext)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_csr_export, 0, 0, 2)
- ZEND_ARG_INFO(0, csr)
- ZEND_ARG_INFO(1, out)
- ZEND_ARG_INFO(0, notext)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_csr_sign, 0, 0, 4)
- ZEND_ARG_INFO(0, csr)
- ZEND_ARG_INFO(0, x509)
- ZEND_ARG_INFO(0, priv_key)
- ZEND_ARG_INFO(0, days)
- ZEND_ARG_INFO(0, config_args) /* array */
- ZEND_ARG_INFO(0, serial)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_csr_new, 0, 0, 2)
- ZEND_ARG_INFO(0, dn) /* array */
- ZEND_ARG_INFO(1, privkey)
- ZEND_ARG_INFO(0, configargs)
- ZEND_ARG_INFO(0, extraattribs)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_csr_get_subject, 0, 0, 1)
- ZEND_ARG_INFO(0, csr)
- ZEND_ARG_INFO(0, use_shortnames)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_csr_get_public_key, 0, 0, 1)
- ZEND_ARG_INFO(0, csr)
- ZEND_ARG_INFO(0, use_shortnames)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_pkey_new, 0, 0, 0)
- ZEND_ARG_INFO(0, configargs) /* array */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_pkey_export_to_file, 0, 0, 2)
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, outfilename)
- ZEND_ARG_INFO(0, passphrase)
- ZEND_ARG_INFO(0, config_args) /* array */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_pkey_export, 0, 0, 2)
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(1, out)
- ZEND_ARG_INFO(0, passphrase)
- ZEND_ARG_INFO(0, config_args) /* array */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_openssl_pkey_get_public, 0)
- ZEND_ARG_INFO(0, cert)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_openssl_pkey_free, 0)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_pkey_get_private, 0, 0, 1)
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, passphrase)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_openssl_pkey_get_details, 0)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_pbkdf2, 0, 0, 4)
- ZEND_ARG_INFO(0, password)
- ZEND_ARG_INFO(0, salt)
- ZEND_ARG_INFO(0, key_length)
- ZEND_ARG_INFO(0, iterations)
- ZEND_ARG_INFO(0, digest_algorithm)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_pkcs7_verify, 0, 0, 2)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, flags)
- ZEND_ARG_INFO(0, signerscerts)
- ZEND_ARG_INFO(0, cainfo) /* array */
- ZEND_ARG_INFO(0, extracerts)
- ZEND_ARG_INFO(0, content)
- ZEND_ARG_INFO(0, pk7)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_pkcs7_encrypt, 0, 0, 4)
- ZEND_ARG_INFO(0, infile)
- ZEND_ARG_INFO(0, outfile)
- ZEND_ARG_INFO(0, recipcerts)
- ZEND_ARG_INFO(0, headers) /* array */
- ZEND_ARG_INFO(0, flags)
- ZEND_ARG_INFO(0, cipher)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_pkcs7_sign, 0, 0, 5)
- ZEND_ARG_INFO(0, infile)
- ZEND_ARG_INFO(0, outfile)
- ZEND_ARG_INFO(0, signcert)
- ZEND_ARG_INFO(0, signkey)
- ZEND_ARG_INFO(0, headers) /* array */
- ZEND_ARG_INFO(0, flags)
- ZEND_ARG_INFO(0, extracertsfilename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_pkcs7_decrypt, 0, 0, 3)
- ZEND_ARG_INFO(0, infilename)
- ZEND_ARG_INFO(0, outfilename)
- ZEND_ARG_INFO(0, recipcert)
- ZEND_ARG_INFO(0, recipkey)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_pkcs7_read, 0, 0, 2)
- ZEND_ARG_INFO(0, infilename)
- ZEND_ARG_INFO(1, certs)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_private_encrypt, 0, 0, 3)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(1, crypted)
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, padding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_private_decrypt, 0, 0, 3)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(1, crypted)
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, padding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_public_encrypt, 0, 0, 3)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(1, crypted)
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, padding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_public_decrypt, 0, 0, 3)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(1, crypted)
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, padding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_openssl_error_string, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_sign, 0, 0, 3)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(1, signature)
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, method)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_verify, 0, 0, 3)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, signature)
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, method)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_seal, 0, 0, 4)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(1, sealdata)
- ZEND_ARG_INFO(1, ekeys) /* array */
- ZEND_ARG_INFO(0, pubkeys) /* array */
- ZEND_ARG_INFO(0, method)
- ZEND_ARG_INFO(1, iv)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_open, 0, 0, 4)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(1, opendata)
- ZEND_ARG_INFO(0, ekey)
- ZEND_ARG_INFO(0, privkey)
- ZEND_ARG_INFO(0, method)
- ZEND_ARG_INFO(0, iv)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_get_md_methods, 0, 0, 0)
- ZEND_ARG_INFO(0, aliases)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_get_cipher_methods, 0, 0, 0)
- ZEND_ARG_INFO(0, aliases)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_EVP_PKEY_EC
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_get_curve_names, 0, 0, 0)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_digest, 0, 0, 2)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, method)
- ZEND_ARG_INFO(0, raw_output)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_encrypt, 0, 0, 3)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, method)
- ZEND_ARG_INFO(0, password)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, iv)
- ZEND_ARG_INFO(1, tag)
- ZEND_ARG_INFO(0, aad)
- ZEND_ARG_INFO(0, tag_length)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_decrypt, 0, 0, 3)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, method)
- ZEND_ARG_INFO(0, password)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, iv)
- ZEND_ARG_INFO(0, tag)
- ZEND_ARG_INFO(0, aad)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_openssl_cipher_iv_length, 0)
- ZEND_ARG_INFO(0, method)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_openssl_dh_compute_key, 0)
- ZEND_ARG_INFO(0, pub_key)
- ZEND_ARG_INFO(0, dh_key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_pkey_derive, 0, 0, 2)
- ZEND_ARG_INFO(0, peer_pub_key)
- ZEND_ARG_INFO(0, priv_key)
- ZEND_ARG_INFO(0, keylen)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_random_pseudo_bytes, 0, 0, 1)
- ZEND_ARG_INFO(0, length)
- ZEND_ARG_INFO(1, result_is_strong)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_spki_new, 0, 0, 2)
- ZEND_ARG_INFO(0, privkey)
- ZEND_ARG_INFO(0, challenge)
- ZEND_ARG_INFO(0, algo)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_openssl_spki_verify, 0)
- ZEND_ARG_INFO(0, spki)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_openssl_spki_export, 0)
- ZEND_ARG_INFO(0, spki)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_openssl_spki_export_challenge, 0)
- ZEND_ARG_INFO(0, spki)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_openssl_get_cert_locations, 0)
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ openssl_functions[]
*/
static const zend_function_entry openssl_functions[] = {
@@ -964,24 +626,24 @@ static time_t php_openssl_asn1_time_to_time_t(ASN1_UTCTIME * timestr) /* {{{ */
size_t timestr_len;
if (ASN1_STRING_type(timestr) != V_ASN1_UTCTIME && ASN1_STRING_type(timestr) != V_ASN1_GENERALIZEDTIME) {
- php_error_docref(NULL, E_WARNING, "illegal ASN1 data type for timestamp");
+ php_error_docref(NULL, E_WARNING, "Illegal ASN1 data type for timestamp");
return (time_t)-1;
}
timestr_len = (size_t)ASN1_STRING_length(timestr);
if (timestr_len != strlen((const char *)ASN1_STRING_get0_data(timestr))) {
- php_error_docref(NULL, E_WARNING, "illegal length in timestamp");
+ php_error_docref(NULL, E_WARNING, "Illegal length in timestamp");
return (time_t)-1;
}
if (timestr_len < 13 && timestr_len != 11) {
- php_error_docref(NULL, E_WARNING, "unable to parse time string %s correctly", timestr->data);
+ php_error_docref(NULL, E_WARNING, "Unable to parse time string %s correctly", timestr->data);
return (time_t)-1;
}
if (ASN1_STRING_type(timestr) == V_ASN1_GENERALIZEDTIME && timestr_len < 15) {
- php_error_docref(NULL, E_WARNING, "unable to parse time string %s correctly", timestr->data);
+ php_error_docref(NULL, E_WARNING, "Unable to parse time string %s correctly", timestr->data);
return (time_t)-1;
}
@@ -1079,7 +741,7 @@ static int php_openssl_add_oid_section(struct php_x509_request * req) /* {{{ */
sktmp = CONF_get_section(req->req_config, str);
if (sktmp == NULL) {
php_openssl_store_errors();
- php_error_docref(NULL, E_WARNING, "problem loading oid section %s", str);
+ php_error_docref(NULL, E_WARNING, "Problem loading oid section %s", str);
return FAILURE;
}
for (i = 0; i < sk_CONF_VALUE_num(sktmp); i++) {
@@ -1087,7 +749,7 @@ static int php_openssl_add_oid_section(struct php_x509_request * req) /* {{{ */
if (OBJ_sn2nid(cnf->name) == NID_undef && OBJ_ln2nid(cnf->name) == NID_undef &&
OBJ_create(cnf->value, cnf->name, cnf->name) == NID_undef) {
php_openssl_store_errors();
- php_error_docref(NULL, E_WARNING, "problem creating object %s=%s", cnf->name, cnf->value);
+ php_error_docref(NULL, E_WARNING, "Problem creating object %s=%s", cnf->name, cnf->value);
return FAILURE;
}
}
@@ -1189,7 +851,7 @@ static int php_openssl_parse_config(struct php_x509_request * req, zval * option
str = CONF_get_string(req->req_config, req->section_name, "encrypt_rsa_key");
if (str == NULL) {
str = CONF_get_string(req->req_config, req->section_name, "encrypt_key");
- /* it is sure that there are some errrors as str was NULL for encrypt_rsa_key */
+ /* it is sure that there are some errors as str was NULL for encrypt_rsa_key */
php_openssl_store_errors();
}
if (str != NULL && strcmp(str, "no") == 0) {
@@ -1312,7 +974,7 @@ static int php_openssl_load_rand_file(const char * file, int *egdsocket, int *se
if (file == NULL || !RAND_load_file(file, -1)) {
if (RAND_status() == 0) {
php_openssl_store_errors();
- php_error_docref(NULL, E_WARNING, "unable to load random state; not enough random data!");
+ php_error_docref(NULL, E_WARNING, "Unable to load random state; not enough random data!");
return FAILURE;
}
return FAILURE;
@@ -1338,7 +1000,7 @@ static int php_openssl_write_rand_file(const char * file, int egdsocket, int see
PHP_OPENSSL_RAND_ADD_TIME();
if (file == NULL || !RAND_write_file(file)) {
php_openssl_store_errors();
- php_error_docref(NULL, E_WARNING, "unable to write random state");
+ php_error_docref(NULL, E_WARNING, "Unable to write random state");
return FAILURE;
}
return SUCCESS;
@@ -1675,6 +1337,10 @@ PHP_MSHUTDOWN_FUNCTION(openssl)
Retrieve an array mapping available certificate locations */
PHP_FUNCTION(openssl_get_cert_locations)
{
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
array_init(return_value);
add_assoc_string(return_value, "default_cert_file", (char *) X509_get_default_cert_file());
@@ -1791,13 +1457,13 @@ PHP_FUNCTION(openssl_x509_export_to_file)
size_t filename_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zp|b", &zcert, &filename, &filename_len, &notext) == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETVAL_FALSE;
cert = php_openssl_x509_from_zval(zcert, 0, NULL);
if (cert == NULL) {
- php_error_docref(NULL, E_WARNING, "cannot get cert from parameter 1");
+ php_error_docref(NULL, E_WARNING, "Cannot get cert from parameter 1");
return;
}
@@ -1817,7 +1483,7 @@ PHP_FUNCTION(openssl_x509_export_to_file)
RETVAL_TRUE;
} else {
php_openssl_store_errors();
- php_error_docref(NULL, E_WARNING, "error opening file %s", filename);
+ php_error_docref(NULL, E_WARNING, "Error opening file %s", filename);
}
if (Z_TYPE_P(zcert) != IS_RESOURCE) {
X509_free(cert);
@@ -1841,14 +1507,13 @@ PHP_FUNCTION(openssl_spki_new)
const char *spkac = "SPKAC=";
zend_long algo = OPENSSL_ALGO_MD5;
- zval *method = NULL;
zval * zpkey = NULL;
EVP_PKEY * pkey = NULL;
NETSCAPE_SPKI *spki=NULL;
const EVP_MD *mdtype;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|z", &zpkey, &challenge, &challenge_len, &method) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|l", &zpkey, &challenge, &challenge_len, &algo) == FAILURE) {
+ RETURN_THROWS();
}
RETVAL_FALSE;
@@ -1856,18 +1521,12 @@ PHP_FUNCTION(openssl_spki_new)
pkey = php_openssl_evp_from_zval(zpkey, 0, challenge, challenge_len, 1, &keyresource);
if (pkey == NULL) {
- php_error_docref(NULL, E_WARNING, "Unable to use supplied private key");
+ if (!EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "Unable to use supplied private key");
+ }
goto cleanup;
}
- if (method != NULL) {
- if (Z_TYPE_P(method) == IS_LONG) {
- algo = Z_LVAL_P(method);
- } else {
- php_error_docref(NULL, E_WARNING, "Algorithm must be of supported type");
- goto cleanup;
- }
- }
mdtype = php_openssl_get_evp_md_from_algo(algo);
if (!mdtype) {
@@ -1947,7 +1606,7 @@ PHP_FUNCTION(openssl_spki_verify)
NETSCAPE_SPKI *spki = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &spkstr, &spkstr_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETVAL_FALSE;
@@ -2008,7 +1667,7 @@ PHP_FUNCTION(openssl_spki_export)
BIO *out = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &spkstr, &spkstr_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETVAL_FALSE;
@@ -2076,7 +1735,7 @@ PHP_FUNCTION(openssl_spki_export_challenge)
NETSCAPE_SPKI *spki = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &spkstr, &spkstr_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETVAL_FALSE;
@@ -2118,13 +1777,13 @@ PHP_FUNCTION(openssl_x509_export)
BIO * bio_out;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz|b", &zcert, &zout, &notext) == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETVAL_FALSE;
cert = php_openssl_x509_from_zval(zcert, 0, NULL);
if (cert == NULL) {
- php_error_docref(NULL, E_WARNING, "cannot get cert from parameter 1");
+ php_error_docref(NULL, E_WARNING, "Cannot get cert from parameter 1");
return;
}
@@ -2193,12 +1852,12 @@ PHP_FUNCTION(openssl_x509_fingerprint)
zend_string *fingerprint;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|sb", &zcert, &method, &method_len, &raw_output) == FAILURE) {
- return;
+ RETURN_THROWS();
}
cert = php_openssl_x509_from_zval(zcert, 0, NULL);
if (cert == NULL) {
- php_error_docref(NULL, E_WARNING, "cannot get cert from parameter 1");
+ php_error_docref(NULL, E_WARNING, "Cannot get cert from parameter 1");
RETURN_FALSE;
}
@@ -2226,7 +1885,7 @@ PHP_FUNCTION(openssl_x509_check_private_key)
RETVAL_FALSE;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &zcert, &zkey) == FAILURE) {
- return;
+ RETURN_THROWS();
}
cert = php_openssl_x509_from_zval(zcert, 0, NULL);
if (cert == NULL) {
@@ -2257,7 +1916,7 @@ PHP_FUNCTION(openssl_x509_verify)
int err = -1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &zcert, &zkey) == FAILURE) {
- return;
+ RETURN_THROWS();
}
cert = php_openssl_x509_from_zval(zcert, 0, NULL);
if (cert == NULL) {
@@ -2380,7 +2039,7 @@ PHP_FUNCTION(openssl_x509_parse)
char buf[256];
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|b", &zcert, &useshortnames) == FAILURE) {
- return;
+ RETURN_THROWS();
}
cert = php_openssl_x509_from_zval(zcert, 0, NULL);
if (cert == NULL) {
@@ -2530,7 +2189,7 @@ static STACK_OF(X509) *php_openssl_load_all_certs_from_file(char *certfile)
if(!(stack = sk_X509_new_null())) {
php_openssl_store_errors();
- php_error_docref(NULL, E_ERROR, "memory allocation failure");
+ php_error_docref(NULL, E_ERROR, "Memory allocation failure");
goto end;
}
@@ -2541,7 +2200,7 @@ static STACK_OF(X509) *php_openssl_load_all_certs_from_file(char *certfile)
if (!(in=BIO_new_file(certfile, PHP_OPENSSL_BIO_MODE_R(PKCS7_BINARY)))) {
php_openssl_store_errors();
- php_error_docref(NULL, E_WARNING, "error opening the file, %s", certfile);
+ php_error_docref(NULL, E_WARNING, "Error opening the file, %s", certfile);
sk_X509_free(stack);
goto end;
}
@@ -2549,7 +2208,7 @@ static STACK_OF(X509) *php_openssl_load_all_certs_from_file(char *certfile)
/* This loads from a file, a stack of x509/crl/pkey sets */
if (!(sk=PEM_X509_INFO_read_bio(in, NULL, NULL, NULL))) {
php_openssl_store_errors();
- php_error_docref(NULL, E_WARNING, "error reading the file, %s", certfile);
+ php_error_docref(NULL, E_WARNING, "Error reading the file, %s", certfile);
sk_X509_free(stack);
goto end;
}
@@ -2564,7 +2223,7 @@ static STACK_OF(X509) *php_openssl_load_all_certs_from_file(char *certfile)
X509_INFO_free(xi);
}
if (!sk_X509_num(stack)) {
- php_error_docref(NULL, E_WARNING, "no certificates in file, %s", certfile);
+ php_error_docref(NULL, E_WARNING, "No certificates in file, %s", certfile);
sk_X509_free(stack);
goto end;
}
@@ -2586,12 +2245,12 @@ static int check_cert(X509_STORE *ctx, X509 *x, STACK_OF(X509) *untrustedchain,
csc = X509_STORE_CTX_new();
if (csc == NULL) {
php_openssl_store_errors();
- php_error_docref(NULL, E_ERROR, "memory allocation failure");
+ php_error_docref(NULL, E_ERROR, "Memory allocation failure");
return 0;
}
if (!X509_STORE_CTX_init(csc, ctx, x, untrustedchain)) {
php_openssl_store_errors();
- php_error_docref(NULL, E_WARNING, "cert store initialization failed");
+ php_error_docref(NULL, E_WARNING, "Certificate store initialization failed");
return 0;
}
if (purpose >= 0 && !X509_STORE_CTX_set_purpose(csc, purpose)) {
@@ -2621,7 +2280,7 @@ PHP_FUNCTION(openssl_x509_checkpurpose)
int ret;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zl|a!s", &zcert, &purpose, &zcainfo, &untrusted, &untrusted_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETVAL_LONG(-1);
@@ -2688,7 +2347,7 @@ static X509_STORE *php_openssl_setup_verify(zval *calist)
}
if (VCWD_STAT(ZSTR_VAL(str), &sb) == -1) {
- php_error_docref(NULL, E_WARNING, "unable to stat %s", ZSTR_VAL(str));
+ php_error_docref(NULL, E_WARNING, "Unable to stat %s", ZSTR_VAL(str));
zend_string_release(str);
continue;
}
@@ -2697,7 +2356,7 @@ static X509_STORE *php_openssl_setup_verify(zval *calist)
file_lookup = X509_STORE_add_lookup(store, X509_LOOKUP_file());
if (file_lookup == NULL || !X509_LOOKUP_load_file(file_lookup, ZSTR_VAL(str), X509_FILETYPE_PEM)) {
php_openssl_store_errors();
- php_error_docref(NULL, E_WARNING, "error loading file %s", ZSTR_VAL(str));
+ php_error_docref(NULL, E_WARNING, "Error loading file %s", ZSTR_VAL(str));
} else {
nfiles++;
}
@@ -2706,7 +2365,7 @@ static X509_STORE *php_openssl_setup_verify(zval *calist)
dir_lookup = X509_STORE_add_lookup(store, X509_LOOKUP_hash_dir());
if (dir_lookup == NULL || !X509_LOOKUP_add_dir(dir_lookup, ZSTR_VAL(str), X509_FILETYPE_PEM)) {
php_openssl_store_errors();
- php_error_docref(NULL, E_WARNING, "error loading directory %s", ZSTR_VAL(str));
+ php_error_docref(NULL, E_WARNING, "Error loading directory %s", ZSTR_VAL(str));
} else {
ndirs++;
}
@@ -2740,13 +2399,13 @@ PHP_FUNCTION(openssl_x509_read)
zend_resource *res;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &cert) == FAILURE) {
- return;
+ RETURN_THROWS();
}
x509 = php_openssl_x509_from_zval(cert, 1, &res);
ZVAL_RES(return_value, res);
if (x509 == NULL) {
- php_error_docref(NULL, E_WARNING, "supplied parameter cannot be coerced into an X509 certificate!");
+ php_error_docref(NULL, E_WARNING, "Supplied parameter cannot be coerced into an X509 certificate!");
RETURN_FALSE;
}
}
@@ -2760,10 +2419,10 @@ PHP_FUNCTION(openssl_x509_free)
X509 *cert;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &x509) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((cert = (X509 *)zend_fetch_resource(Z_RES_P(x509), "OpenSSL X.509", le_x509)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
zend_list_close(Z_RES_P(x509));
}
@@ -2853,23 +2512,25 @@ PHP_FUNCTION(openssl_pkcs12_export_to_file)
STACK_OF(X509) *ca = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zpzs|a", &zcert, &filename, &filename_len, &zpkey, &pass, &pass_len, &args) == FAILURE)
- return;
+ RETURN_THROWS();
RETVAL_FALSE;
cert = php_openssl_x509_from_zval(zcert, 0, NULL);
if (cert == NULL) {
- php_error_docref(NULL, E_WARNING, "cannot get cert from parameter 1");
+ php_error_docref(NULL, E_WARNING, "Cannot get cert from parameter 1");
return;
}
priv_key = php_openssl_evp_from_zval(zpkey, 0, "", 0, 1, &keyresource);
if (priv_key == NULL) {
- php_error_docref(NULL, E_WARNING, "cannot get private key from parameter 3");
+ if (!EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "Cannot get private key from parameter 3");
+ }
goto cleanup;
}
if (!X509_check_private_key(cert, priv_key)) {
php_openssl_store_errors();
- php_error_docref(NULL, E_WARNING, "private key does not correspond to cert");
+ php_error_docref(NULL, E_WARNING, "Private key does not correspond to cert");
goto cleanup;
}
if (php_openssl_open_base_dir_chk(filename)) {
@@ -2907,7 +2568,7 @@ PHP_FUNCTION(openssl_pkcs12_export_to_file)
RETVAL_TRUE;
} else {
php_openssl_store_errors();
- php_error_docref(NULL, E_WARNING, "error opening file %s", filename);
+ php_error_docref(NULL, E_WARNING, "Error opening file %s", filename);
}
PKCS12_free(p12);
@@ -2945,23 +2606,26 @@ PHP_FUNCTION(openssl_pkcs12_export)
zval * item;
STACK_OF(X509) *ca = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "zzzs|a", &zcert, &zout, &zpkey, &pass, &pass_len, &args) == FAILURE)
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "zzzs|a", &zcert, &zout, &zpkey, &pass, &pass_len, &args) == FAILURE) {
+ RETURN_THROWS();
+ }
RETVAL_FALSE;
cert = php_openssl_x509_from_zval(zcert, 0, NULL);
if (cert == NULL) {
- php_error_docref(NULL, E_WARNING, "cannot get cert from parameter 1");
+ php_error_docref(NULL, E_WARNING, "Cannot get cert from parameter 1");
return;
}
priv_key = php_openssl_evp_from_zval(zpkey, 0, "", 0, 1, &keyresource);
if (priv_key == NULL) {
- php_error_docref(NULL, E_WARNING, "cannot get private key from parameter 3");
+ if (!EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "Cannot get private key from parameter 3");
+ }
goto cleanup;
}
if (!X509_check_private_key(cert, priv_key)) {
- php_error_docref(NULL, E_WARNING, "private key does not correspond to cert");
+ php_error_docref(NULL, E_WARNING, "Private key does not correspond to cert");
goto cleanup;
}
@@ -3025,8 +2689,9 @@ PHP_FUNCTION(openssl_pkcs12_read)
BIO * bio_in = NULL;
int i;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "szs", &zp12, &zp12_len, &zout, &pass, &pass_len) == FAILURE)
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "szs", &zp12, &zp12_len, &zout, &pass, &pass_len) == FAILURE) {
+ RETURN_THROWS();
+ }
RETVAL_FALSE;
@@ -3232,7 +2897,7 @@ static int php_openssl_make_REQ(struct php_x509_request * req, X509_REQ * csr, z
return FAILURE;
}
if (!X509_NAME_entry_count(subj)) {
- php_error_docref(NULL, E_WARNING, "no objects specified in config file");
+ php_error_docref(NULL, E_WARNING, "No objects specified in config file");
return FAILURE;
}
}
@@ -3361,13 +3026,15 @@ PHP_FUNCTION(openssl_csr_export_to_file)
zend_resource *csr_resource;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rp|b", &zcsr, &filename, &filename_len, &notext) == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETVAL_FALSE;
csr = php_openssl_csr_from_zval(zcsr, 0, &csr_resource);
if (csr == NULL) {
- php_error_docref(NULL, E_WARNING, "cannot get CSR from parameter 1");
+ if (!EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "Cannot get CSR from parameter 1");
+ }
return;
}
@@ -3381,7 +3048,7 @@ PHP_FUNCTION(openssl_csr_export_to_file)
php_openssl_store_errors();
}
if (!PEM_write_bio_X509_REQ(bio_out, csr)) {
- php_error_docref(NULL, E_WARNING, "error writing PEM to file %s", filename);
+ php_error_docref(NULL, E_WARNING, "Error writing PEM to file %s", filename);
php_openssl_store_errors();
} else {
RETVAL_TRUE;
@@ -3389,7 +3056,7 @@ PHP_FUNCTION(openssl_csr_export_to_file)
BIO_free(bio_out);
} else {
php_openssl_store_errors();
- php_error_docref(NULL, E_WARNING, "error opening file %s", filename);
+ php_error_docref(NULL, E_WARNING, "Error opening file %s", filename);
}
if (csr_resource == NULL && csr != NULL) {
@@ -3409,14 +3076,16 @@ PHP_FUNCTION(openssl_csr_export)
zend_resource *csr_resource;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz|b", &zcsr, &zout, &notext) == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETVAL_FALSE;
csr = php_openssl_csr_from_zval(zcsr, 0, &csr_resource);
if (csr == NULL) {
- php_error_docref(NULL, E_WARNING, "cannot get CSR from parameter 1");
+ if (!EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "Cannot get CSR from parameter 1");
+ }
return;
}
@@ -3459,32 +3128,37 @@ PHP_FUNCTION(openssl_csr_sign)
int i;
struct php_x509_request req;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz!zl|a!l", &zcsr, &zcert, &zpkey, &num_days, &args, &serial) == FAILURE)
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz!zl|a!l", &zcsr, &zcert, &zpkey, &num_days, &args, &serial) == FAILURE) {
+ RETURN_THROWS();
+ }
RETVAL_FALSE;
PHP_SSL_REQ_INIT(&req);
csr = php_openssl_csr_from_zval(zcsr, 0, &csr_resource);
if (csr == NULL) {
- php_error_docref(NULL, E_WARNING, "cannot get CSR from parameter 1");
+ if (!EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "Cannot get CSR from parameter 1");
+ }
return;
}
if (zcert) {
cert = php_openssl_x509_from_zval(zcert, 0, &certresource);
if (cert == NULL) {
- php_error_docref(NULL, E_WARNING, "cannot get cert from parameter 2");
+ php_error_docref(NULL, E_WARNING, "Cannot get cert from parameter 2");
goto cleanup;
}
}
priv_key = php_openssl_evp_from_zval(zpkey, 0, "", 0, 1, &keyresource);
if (priv_key == NULL) {
- php_error_docref(NULL, E_WARNING, "cannot get private key from parameter 3");
+ if (!EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "Cannot get private key from parameter 3");
+ }
goto cleanup;
}
if (cert && !X509_check_private_key(cert, priv_key)) {
php_openssl_store_errors();
- php_error_docref(NULL, E_WARNING, "private key does not correspond to signing cert");
+ php_error_docref(NULL, E_WARNING, "Private key does not correspond to signing cert");
goto cleanup;
}
@@ -3495,7 +3169,7 @@ PHP_FUNCTION(openssl_csr_sign)
key = X509_REQ_get_pubkey(csr);
if (key == NULL) {
php_openssl_store_errors();
- php_error_docref(NULL, E_WARNING, "error unpacking public key");
+ php_error_docref(NULL, E_WARNING, "Error unpacking public key");
goto cleanup;
}
i = X509_REQ_verify(csr, key);
@@ -3556,7 +3230,7 @@ PHP_FUNCTION(openssl_csr_sign)
/* Now sign it */
if (!X509_sign(new_cert, priv_key, req.digest)) {
php_openssl_store_errors();
- php_error_docref(NULL, E_WARNING, "failed to sign it");
+ php_error_docref(NULL, E_WARNING, "Failed to sign it");
goto cleanup;
}
@@ -3601,7 +3275,7 @@ PHP_FUNCTION(openssl_csr_new)
zend_resource *key_resource;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "az|a!a!", &dn, &out_pkey, &args, &attribs) == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETVAL_FALSE;
@@ -3677,7 +3351,7 @@ PHP_FUNCTION(openssl_csr_new)
}
/* }}} */
-/* {{{ proto mixed openssl_csr_get_subject(mixed csr)
+/* {{{ proto mixed openssl_csr_get_subject(mixed csr [, bool use_shortnames = TRUE])
Returns the subject of a CERT or FALSE on error */
PHP_FUNCTION(openssl_csr_get_subject)
{
@@ -3688,7 +3362,7 @@ PHP_FUNCTION(openssl_csr_get_subject)
X509_REQ * csr;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|b", &zcsr, &use_shortnames) == FAILURE) {
- return;
+ RETURN_THROWS();
}
csr = php_openssl_csr_from_zval(zcsr, 0, &csr_resource);
@@ -3708,7 +3382,7 @@ PHP_FUNCTION(openssl_csr_get_subject)
}
/* }}} */
-/* {{{ proto mixed openssl_csr_get_public_key(mixed csr)
+/* {{{ proto mixed openssl_csr_get_public_key(mixed csr [, bool use_shortnames = TRUE])
Returns the subject of a CERT or FALSE on error */
PHP_FUNCTION(openssl_csr_get_public_key)
{
@@ -3720,7 +3394,7 @@ PHP_FUNCTION(openssl_csr_get_public_key)
EVP_PKEY *tpubkey;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|b", &zcsr, &use_shortnames) == FAILURE) {
- return;
+ RETURN_THROWS();
}
orig_csr = php_openssl_csr_from_zval(zcsr, 0, &csr_resource);
@@ -3828,7 +3502,7 @@ static EVP_PKEY * php_openssl_evp_from_zval(
/* get passphrase */
if ((zphrase = zend_hash_index_find(Z_ARRVAL_P(val), 1)) == NULL) {
- php_error_docref(NULL, E_WARNING, "key array must be of the form array(0 => key, 1 => phrase)");
+ php_error_docref(NULL, E_WARNING, "Key array must be of the form array(0 => key, 1 => phrase)");
return NULL;
}
@@ -3847,7 +3521,7 @@ static EVP_PKEY * php_openssl_evp_from_zval(
/* now set val to be the key param and continue */
if ((val = zend_hash_index_find(Z_ARRVAL_P(val), 0)) == NULL) {
- php_error_docref(NULL, E_WARNING, "key array must be of the form array(0 => key, 1 => phrase)");
+ php_error_docref(NULL, E_WARNING, "Key array must be of the form array(0 => key, 1 => phrase)");
TMP_CLEAN;
}
}
@@ -3875,7 +3549,7 @@ static EVP_PKEY * php_openssl_evp_from_zval(
/* check whether it is actually a private key if requested */
if (!public_key && !is_priv) {
- php_error_docref(NULL, E_WARNING, "supplied key param is a public key");
+ php_error_docref(NULL, E_WARNING, "Supplied key param is a public key");
TMP_CLEAN;
}
@@ -3989,7 +3663,7 @@ static EVP_PKEY * php_openssl_generate_private_key(struct php_x509_request * req
EVP_PKEY * return_val = NULL;
if (req->priv_key_bits < MIN_KEY_LENGTH) {
- php_error_docref(NULL, E_WARNING, "private key length is too short; it needs to be at least %d bits, not %d",
+ php_error_docref(NULL, E_WARNING, "Private key length is too short; it needs to be at least %d bits, not %d",
MIN_KEY_LENGTH, req->priv_key_bits);
return NULL;
}
@@ -4014,7 +3688,7 @@ static EVP_PKEY * php_openssl_generate_private_key(struct php_x509_request * req
BIGNUM *bne = (BIGNUM *)BN_new();
if (BN_set_word(bne, RSA_F4) != 1) {
BN_free(bne);
- php_error_docref(NULL, E_WARNING, "failed setting exponent");
+ php_error_docref(NULL, E_WARNING, "Failed setting exponent");
return NULL;
}
rsaparam = RSA_new();
@@ -4191,7 +3865,7 @@ static int php_openssl_is_private_key(EVP_PKEY* pkey)
break;
#endif
default:
- php_error_docref(NULL, E_WARNING, "key type not supported in this PHP build!");
+ php_error_docref(NULL, E_WARNING, "Key type not supported in this PHP build!");
break;
}
return 1;
@@ -4369,7 +4043,7 @@ static zend_bool php_openssl_pkey_init_dh(DH *dh, zval *data)
}
/* }}} */
-/* {{{ proto resource openssl_pkey_new([array configargs])
+/* {{{ proto mixed openssl_pkey_new([array configargs])
Generates a new private key */
PHP_FUNCTION(openssl_pkey_new)
{
@@ -4378,7 +4052,7 @@ PHP_FUNCTION(openssl_pkey_new)
zval *data;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|a!", &args) == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETVAL_FALSE;
@@ -4582,7 +4256,7 @@ clean_exit:
}
/* }}} */
-/* {{{ proto bool openssl_pkey_export_to_file(mixed key, string outfilename [, string passphrase, array config_args)
+/* {{{ proto bool openssl_pkey_export_to_file(mixed key, string outfilename [, string passphrase [, array config_args]])
Gets an exportable representation of a key into a file */
PHP_FUNCTION(openssl_pkey_export_to_file)
{
@@ -4599,7 +4273,7 @@ PHP_FUNCTION(openssl_pkey_export_to_file)
const EVP_CIPHER * cipher;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zp|s!a!", &zpkey, &filename, &filename_len, &passphrase, &passphrase_len, &args) == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETVAL_FALSE;
@@ -4607,7 +4281,9 @@ PHP_FUNCTION(openssl_pkey_export_to_file)
key = php_openssl_evp_from_zval(zpkey, 0, passphrase, passphrase_len, 0, &key_resource);
if (key == NULL) {
- php_error_docref(NULL, E_WARNING, "cannot get key from parameter 1");
+ if (!EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "Cannot get key from parameter 1");
+ }
RETURN_FALSE;
}
@@ -4684,7 +4360,7 @@ PHP_FUNCTION(openssl_pkey_export)
const EVP_CIPHER * cipher;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz|s!a!", &zpkey, &out, &passphrase, &passphrase_len, &args) == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETVAL_FALSE;
@@ -4692,7 +4368,9 @@ PHP_FUNCTION(openssl_pkey_export)
key = php_openssl_evp_from_zval(zpkey, 0, passphrase, passphrase_len, 0, &key_resource);
if (key == NULL) {
- php_error_docref(NULL, E_WARNING, "cannot get key from parameter 1");
+ if (!EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "Cannot get key from parameter 1");
+ }
RETURN_FALSE;
}
@@ -4751,7 +4429,7 @@ PHP_FUNCTION(openssl_pkey_export)
}
/* }}} */
-/* {{{ proto int openssl_pkey_get_public(mixed cert)
+/* {{{ proto mixed openssl_pkey_get_public(mixed cert)
Gets public key from X.509 certificate */
PHP_FUNCTION(openssl_pkey_get_public)
{
@@ -4760,7 +4438,7 @@ PHP_FUNCTION(openssl_pkey_get_public)
zend_resource *res;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &cert) == FAILURE) {
- return;
+ RETURN_THROWS();
}
pkey = php_openssl_evp_from_zval(cert, 1, NULL, 0, 1, &res);
if (pkey == NULL) {
@@ -4778,16 +4456,16 @@ PHP_FUNCTION(openssl_pkey_free)
EVP_PKEY *pkey;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &key) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((pkey = (EVP_PKEY *)zend_fetch_resource(Z_RES_P(key), "OpenSSL key", le_key)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
zend_list_close(Z_RES_P(key));
}
/* }}} */
-/* {{{ proto int openssl_pkey_get_private(string key [, string passphrase])
+/* {{{ proto mixed openssl_pkey_get_private(string key [, string passphrase])
Gets private keys */
PHP_FUNCTION(openssl_pkey_get_private)
{
@@ -4798,7 +4476,7 @@ PHP_FUNCTION(openssl_pkey_get_private)
zend_resource *res;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|s", &cert, &passphrase, &passphrase_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
PHP_OPENSSL_CHECK_SIZE_T_TO_INT(passphrase_len, passphrase);
@@ -4812,7 +4490,7 @@ PHP_FUNCTION(openssl_pkey_get_private)
/* }}} */
-/* {{{ proto resource openssl_pkey_get_details(resource key)
+/* {{{ proto mixed openssl_pkey_get_details(resource key)
returns an array with the key details (bits, pkey, type)*/
PHP_FUNCTION(openssl_pkey_get_details)
{
@@ -4824,10 +4502,10 @@ PHP_FUNCTION(openssl_pkey_get_details)
zend_long ktype;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &key) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((pkey = (EVP_PKEY *)zend_fetch_resource(Z_RES_P(key), "OpenSSL key", le_key)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
out = BIO_new(BIO_s_mem());
if (!PEM_write_bio_PUBKEY(out, pkey)) {
@@ -5000,10 +4678,10 @@ PHP_FUNCTION(openssl_dh_compute_key)
int len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sr", &pub_str, &pub_len, &key) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((pkey = (EVP_PKEY *)zend_fetch_resource(Z_RES_P(key), "OpenSSL key", le_key)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (EVP_PKEY_base_id(pkey) != EVP_PKEY_DH) {
RETURN_FALSE;
@@ -5046,7 +4724,7 @@ PHP_FUNCTION(openssl_pkey_derive)
zend_string *result;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz|l", &peer_pub_key, &priv_key, &key_len) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (key_len < 0) {
php_error_docref(NULL, E_WARNING, "keylen < 0, assuming NULL");
@@ -5081,7 +4759,7 @@ PHP_FUNCTION(openssl_pkey_derive)
/* }}} */
-/* {{{ proto string openssl_pbkdf2(string password, string salt, int key_length, int iterations [, string digest_method = "sha1"])
+/* {{{ proto mixed openssl_pbkdf2(string password, string salt, int key_length, int iterations [, string digest_method = "sha1"])
Generates a PKCS5 v2 PBKDF2 string, defaults to sha1 */
PHP_FUNCTION(openssl_pbkdf2)
{
@@ -5101,7 +4779,7 @@ PHP_FUNCTION(openssl_pbkdf2)
&salt, &salt_len,
&key_length, &iterations,
&method, &method_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (key_length <= 0) {
@@ -5166,7 +4844,7 @@ PHP_FUNCTION(openssl_pkcs7_verify)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "pl|pappp", &filename, &filename_len,
&flags, &signersfilename, &signersfilename_len, &cainfo,
&extracerts, &extracerts_len, &datafilename, &datafilename_len, &p7bfilename, &p7bfilename_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (extracerts) {
@@ -5251,7 +4929,7 @@ PHP_FUNCTION(openssl_pkcs7_verify)
if (!PEM_write_bio_X509(certout, sk_X509_value(signers, i))) {
php_openssl_store_errors();
RETVAL_LONG(-1);
- php_error_docref(NULL, E_WARNING, "failed to write signer %d", i);
+ php_error_docref(NULL, E_WARNING, "Failed to write signer %d", i);
}
}
@@ -5264,7 +4942,7 @@ PHP_FUNCTION(openssl_pkcs7_verify)
BIO_free(certout);
} else {
php_openssl_store_errors();
- php_error_docref(NULL, E_WARNING, "signature OK, but cannot open %s for writing", signersfilename);
+ php_error_docref(NULL, E_WARNING, "Signature OK, but cannot open %s for writing", signersfilename);
RETVAL_LONG(-1);
}
@@ -5311,8 +4989,9 @@ PHP_FUNCTION(openssl_pkcs7_encrypt)
RETVAL_FALSE;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ppza!|ll", &infilename, &infilename_len,
- &outfilename, &outfilename_len, &zrecipcerts, &zheaders, &flags, &cipherid) == FAILURE)
- return;
+ &outfilename, &outfilename_len, &zrecipcerts, &zheaders, &flags, &cipherid) == FAILURE) {
+ RETURN_THROWS();
+ }
if (php_openssl_open_base_dir_chk(infilename) || php_openssl_open_base_dir_chk(outfilename)) {
@@ -5441,7 +5120,7 @@ PHP_FUNCTION(openssl_pkcs7_read)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sz", &p7b, &p7b_len,
&zout) == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETVAL_FALSE;
@@ -5555,7 +5234,7 @@ PHP_FUNCTION(openssl_pkcs7_sign)
&infilename, &infilename_len, &outfilename, &outfilename_len,
&zcert, &zprivkey, &zheaders, &flags, &extracertsfilename,
&extracertsfilename_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETVAL_FALSE;
@@ -5569,13 +5248,15 @@ PHP_FUNCTION(openssl_pkcs7_sign)
privkey = php_openssl_evp_from_zval(zprivkey, 0, "", 0, 0, &keyresource);
if (privkey == NULL) {
- php_error_docref(NULL, E_WARNING, "error getting private key");
+ if (!EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "Error getting private key");
+ }
goto clean_exit;
}
cert = php_openssl_x509_from_zval(zcert, 0, &certresource);
if (cert == NULL) {
- php_error_docref(NULL, E_WARNING, "error getting cert");
+ php_error_docref(NULL, E_WARNING, "Error getting cert");
goto clean_exit;
}
@@ -5586,21 +5267,21 @@ PHP_FUNCTION(openssl_pkcs7_sign)
infile = BIO_new_file(infilename, PHP_OPENSSL_BIO_MODE_R(flags));
if (infile == NULL) {
php_openssl_store_errors();
- php_error_docref(NULL, E_WARNING, "error opening input file %s!", infilename);
+ php_error_docref(NULL, E_WARNING, "Error opening input file %s!", infilename);
goto clean_exit;
}
outfile = BIO_new_file(outfilename, PHP_OPENSSL_BIO_MODE_W(PKCS7_BINARY));
if (outfile == NULL) {
php_openssl_store_errors();
- php_error_docref(NULL, E_WARNING, "error opening output file %s!", outfilename);
+ php_error_docref(NULL, E_WARNING, "Error opening output file %s!", outfilename);
goto clean_exit;
}
p7 = PKCS7_sign(cert, privkey, others, infile, (int)flags);
if (p7 == NULL) {
php_openssl_store_errors();
- php_error_docref(NULL, E_WARNING, "error creating PKCS7 structure!");
+ php_error_docref(NULL, E_WARNING, "Error creating PKCS7 structure!");
goto clean_exit;
}
@@ -5668,20 +5349,22 @@ PHP_FUNCTION(openssl_pkcs7_decrypt)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ppz|z", &infilename, &infilename_len,
&outfilename, &outfilename_len, &recipcert, &recipkey) == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETVAL_FALSE;
cert = php_openssl_x509_from_zval(recipcert, 0, &certresval);
if (cert == NULL) {
- php_error_docref(NULL, E_WARNING, "unable to coerce parameter 3 to x509 cert");
+ php_error_docref(NULL, E_WARNING, "Unable to coerce parameter 3 to x509 cert");
goto clean_exit;
}
key = php_openssl_evp_from_zval(recipkey ? recipkey : recipcert, 0, "", 0, 0, &keyresval);
if (key == NULL) {
- php_error_docref(NULL, E_WARNING, "unable to get private key");
+ if (!EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "Unable to get private key");
+ }
goto clean_exit;
}
@@ -5742,14 +5425,16 @@ PHP_FUNCTION(openssl_private_encrypt)
zend_long padding = RSA_PKCS1_PADDING;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "szz|l", &data, &data_len, &crypted, &key, &padding) == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETVAL_FALSE;
pkey = php_openssl_evp_from_zval(key, 0, "", 0, 0, &keyresource);
if (pkey == NULL) {
- php_error_docref(NULL, E_WARNING, "key param is not a valid private key");
+ if (!EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "key param is not a valid private key");
+ }
RETURN_FALSE;
}
@@ -5804,13 +5489,15 @@ PHP_FUNCTION(openssl_private_decrypt)
size_t data_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "szz|l", &data, &data_len, &crypted, &key, &padding) == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETVAL_FALSE;
pkey = php_openssl_evp_from_zval(key, 0, "", 0, 0, &keyresource);
if (pkey == NULL) {
- php_error_docref(NULL, E_WARNING, "key parameter is not a valid private key");
+ if (!EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "key parameter is not a valid private key");
+ }
RETURN_FALSE;
}
@@ -5871,13 +5558,16 @@ PHP_FUNCTION(openssl_public_encrypt)
char * data;
size_t data_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "szz|l", &data, &data_len, &crypted, &key, &padding) == FAILURE)
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "szz|l", &data, &data_len, &crypted, &key, &padding) == FAILURE) {
+ RETURN_THROWS();
+ }
RETVAL_FALSE;
pkey = php_openssl_evp_from_zval(key, 1, NULL, 0, 0, &keyresource);
if (pkey == NULL) {
- php_error_docref(NULL, E_WARNING, "key parameter is not a valid public key");
+ if (!EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "key parameter is not a valid public key");
+ }
RETURN_FALSE;
}
@@ -5933,13 +5623,15 @@ PHP_FUNCTION(openssl_public_decrypt)
size_t data_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "szz|l", &data, &data_len, &crypted, &key, &padding) == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETVAL_FALSE;
pkey = php_openssl_evp_from_zval(key, 1, NULL, 0, 0, &keyresource);
if (pkey == NULL) {
- php_error_docref(NULL, E_WARNING, "key parameter is not a valid public key");
+ if (!EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "key parameter is not a valid public key");
+ }
RETURN_FALSE;
}
@@ -5996,7 +5688,7 @@ PHP_FUNCTION(openssl_error_string)
unsigned long val;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
php_openssl_store_errors();
@@ -6034,11 +5726,13 @@ PHP_FUNCTION(openssl_sign)
const EVP_MD *mdtype;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "szz|z", &data, &data_len, &signature, &key, &method) == FAILURE) {
- return;
+ RETURN_THROWS();
}
pkey = php_openssl_evp_from_zval(key, 0, "", 0, 0, &keyresource);
if (pkey == NULL) {
- php_error_docref(NULL, E_WARNING, "supplied key param cannot be coerced into a private key");
+ if (!EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "Supplied key param cannot be coerced into a private key");
+ }
RETURN_FALSE;
}
@@ -6100,7 +5794,7 @@ PHP_FUNCTION(openssl_verify)
zend_long signature_algo = OPENSSL_ALGO_SHA1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ssz|z", &data, &data_len, &signature, &signature_len, &key, &method) == FAILURE) {
- return;
+ RETURN_THROWS();
}
PHP_OPENSSL_CHECK_SIZE_T_TO_UINT(signature_len, signature);
@@ -6123,7 +5817,9 @@ PHP_FUNCTION(openssl_verify)
pkey = php_openssl_evp_from_zval(key, 1, NULL, 0, 0, &keyresource);
if (pkey == NULL) {
- php_error_docref(NULL, E_WARNING, "supplied key param cannot be coerced into a public key");
+ if (!EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "Supplied key param cannot be coerced into a public key");
+ }
RETURN_FALSE;
}
@@ -6162,7 +5858,7 @@ PHP_FUNCTION(openssl_seal)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "szza|sz", &data, &data_len,
&sealdata, &ekeys, &pubkeys, &method, &method_len, &iv) == FAILURE) {
- return;
+ RETURN_THROWS();
}
pubkeysht = Z_ARRVAL_P(pubkeys);
nkeys = pubkeysht ? zend_hash_num_elements(pubkeysht) : 0;
@@ -6203,7 +5899,9 @@ PHP_FUNCTION(openssl_seal)
ZEND_HASH_FOREACH_VAL(pubkeysht, pubkey) {
pkeys[i] = php_openssl_evp_from_zval(pubkey, 1, NULL, 0, 0, &key_resources[i]);
if (pkeys[i] == NULL) {
- php_error_docref(NULL, E_WARNING, "not a public key (%dth member of pubkeys)", i+1);
+ if (!EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "Not a public key (%dth member of pubkeys)", i+1);
+ }
RETVAL_FALSE;
goto clean_exit;
}
@@ -6296,12 +5994,14 @@ PHP_FUNCTION(openssl_open)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "szsz|ss", &data, &data_len, &opendata,
&ekey, &ekey_len, &privkey, &method, &method_len, &iv, &iv_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
pkey = php_openssl_evp_from_zval(privkey, 0, "", 0, 0, &keyresource);
if (pkey == NULL) {
- php_error_docref(NULL, E_WARNING, "unable to coerce parameter 4 into a private key");
+ if (!EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "Unable to coerce parameter 4 into a private key");
+ }
RETURN_FALSE;
}
@@ -6377,7 +6077,7 @@ PHP_FUNCTION(openssl_get_md_methods)
zend_bool aliases = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &aliases) == FAILURE) {
- return;
+ RETURN_THROWS();
}
array_init(return_value);
OBJ_NAME_do_all_sorted(OBJ_NAME_TYPE_MD_METH,
@@ -6393,7 +6093,7 @@ PHP_FUNCTION(openssl_get_cipher_methods)
zend_bool aliases = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &aliases) == FAILURE) {
- return;
+ RETURN_THROWS();
}
array_init(return_value);
OBJ_NAME_do_all_sorted(OBJ_NAME_TYPE_CIPHER_METH,
@@ -6412,6 +6112,10 @@ PHP_FUNCTION(openssl_get_curve_names)
size_t i;
size_t len = EC_get_builtin_curves(NULL, 0);
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
curves = emalloc(sizeof(EC_builtin_curve) * len);
if (!EC_get_builtin_curves(curves, len)) {
RETURN_FALSE;
@@ -6442,7 +6146,7 @@ PHP_FUNCTION(openssl_digest)
zend_string *sigbuf;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|b", &data, &data_len, &method, &method_len, &raw_output) == FAILURE) {
- return;
+ RETURN_THROWS();
}
mdtype = EVP_get_digestbyname(method);
if (!mdtype) {
@@ -6780,7 +6484,7 @@ PHP_FUNCTION(openssl_encrypt)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sss|lszsl", &data, &data_len, &method, &method_len,
&password, &password_len, &options, &iv, &iv_len, &tag, &aad, &aad_len, &tag_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((ret = php_openssl_encrypt(data, data_len, method, method_len, password, password_len, options, iv, iv_len, tag, tag_len, aad, aad_len))) {
@@ -6874,7 +6578,7 @@ PHP_FUNCTION(openssl_decrypt)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sss|lsss", &data, &data_len, &method, &method_len,
&password, &password_len, &options, &iv, &iv_len, &tag, &tag_len, &aad, &aad_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!method_len) {
@@ -6911,7 +6615,7 @@ PHP_FUNCTION(openssl_cipher_iv_length)
zend_long ret;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &method, &method_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!method_len) {
@@ -6973,7 +6677,7 @@ PHP_FUNCTION(openssl_random_pseudo_bytes)
zval *zstrong_result_returned = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|z", &buffer_length, &zstrong_result_returned) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (zstrong_result_returned) {
diff --git a/ext/openssl/openssl.stub.php b/ext/openssl/openssl.stub.php
new file mode 100644
index 0000000000..e75f79c906
--- /dev/null
+++ b/ext/openssl/openssl.stub.php
@@ -0,0 +1,177 @@
+<?php
+
+function openssl_x509_export_to_file($x509, string $outfilename, bool $notext = true): bool {}
+
+function openssl_x509_export($x509 , &$out, bool $notext = true): bool {}
+
+function openssl_x509_fingerprint($x509, string $method = 'sha1', bool $raw_output = false): string|false {}
+
+function openssl_x509_check_private_key($cert, $key): bool {}
+
+function openssl_x509_verify($cert, $key): int {}
+
+function openssl_x509_parse($x509, bool $shortname = true): array|false {}
+
+function openssl_x509_checkpurpose($x509cert, int $purpose, ?array $cainfo = [], string $untrustedfile = UNKNOWN): bool|int {}
+
+/** @return resource|false */
+function openssl_x509_read($cert) {}
+
+function openssl_x509_free($x509): ?bool {}
+
+/**
+ * @param resource|string $x509cert
+ * @param resource|string|array $priv_key
+ */
+function openssl_pkcs12_export_to_file($x509cert, string $filename, $priv_key, string $pass, array $args = UNKNOWN): bool {}
+
+/**
+ * @param resource|string $x509
+ * @param resource|string|array $priv_key
+ */
+function openssl_pkcs12_export($x509 , &$out, $priv_key, string $pass, array $args = UNKNOWN): bool {}
+
+function openssl_pkcs12_read(string $pkcs12, &$certs, string $pass): bool {}
+
+/** @param resource $csr */
+function openssl_csr_export_to_file($csr, string $outfilename, bool $notext = true): bool {}
+
+/** @param resource $csr */
+function openssl_csr_export($csr, &$out, bool $notext = true): bool {}
+
+/**
+ * @param resource|string $csr
+ * @param resource|string $cacert
+ * @param resource|string|array $priv_key
+ * @return resource|false
+ */
+function openssl_csr_sign($csr, $cacert = null, $priv_key, int $days, ?array $config_args = null, int $serial = 0) {}
+
+/** @return resource|false */
+function openssl_csr_new(array $dn, &$privkey, ?array $configargs = null, ?array $extraattribs = null) {}
+
+/** @param resource|string $csr */
+function openssl_csr_get_subject($csr, bool $use_shortnames = true): array|false {}
+
+/**
+ * @param resource|string $csr
+ * @return resource|false
+ */
+function openssl_csr_get_public_key($csr, bool $use_shortnames = true) {}
+
+/** @return resource|false */
+function openssl_pkey_new(?array $configargs = null) {}
+
+/** @param resource|string|array $key */
+function openssl_pkey_export_to_file($key, string $outfilename, ?string $passphrase = null, ?array $configargs = null): bool {}
+
+/** @param resource|string|array $key */
+function openssl_pkey_export($key, &$out, ?string $passphrase = null, ?array $configargs = null): bool {}
+
+/**
+ * @param resource|string|array $cert
+ * @return resource|false
+ */
+function openssl_pkey_get_public($cert) {}
+
+/** @param resource $key */
+function openssl_pkey_free($key): void {}
+
+/**
+ * @param resource|string|array $key
+ * @return resource|false
+ */
+function openssl_pkey_get_private($key, string $passphrase = UNKNOWN) {}
+
+/** @param resource $key */
+function openssl_pkey_get_details($key): array|false {}
+
+function openssl_pbkdf2(string $password, string $salt, int $key_length, int $iterations, string $digest_algorithm = 'sha1'): string|false {}
+
+function openssl_pkcs7_verify(string $filename, int $flags, string $signerscerts = UNKNOWN, array $cainfo = UNKNOWN, string $extracerts = UNKNOWN, string $content = UNKNOWN, string $pk7 = UNKNOWN): bool|int {}
+
+/** @param resource|string|array $recipcerts */
+function openssl_pkcs7_encrypt(string $infile, string $outfile, $recipcerts, ?array $headers, int $flags = 0, int $cipher = OPENSSL_CIPHER_RC2_40): bool {}
+
+/**
+ * @param resource|string $signcert
+ * @param resource|string|array $signkey
+ */
+function openssl_pkcs7_sign(string $infile, string $outfile, $signcert, $signkey, ?array $headers, int $flags = PKCS7_DETACHED, ?string $extracertsfilename = null): bool {}
+
+/**
+ * @param resource|string $recipcert
+ * @param resource|string|array $recipkey
+ */
+function openssl_pkcs7_decrypt(string $infilename, string $outfilename, $recipcert, $recipkey = UNKNOWN): bool {}
+
+function openssl_pkcs7_read(string $infilename, &$certs): bool {}
+
+/** @param resource|string|array $key */
+function openssl_private_encrypt(string $data, &$crypted, $key, int $padding = OPENSSL_PKCS1_PADDING): bool {}
+
+/** @param resource|string|array $key */
+function openssl_private_decrypt(string $data, &$crypted, $key, int $padding = OPENSSL_PKCS1_PADDING): bool {}
+
+/** @param resource|string|array $key */
+function openssl_public_encrypt(string $data, &$crypted, $key, int $padding = OPENSSL_PKCS1_PADDING): bool {}
+
+/** @param resource|string|array $key */
+function openssl_public_decrypt(string $data, &$crypted, $key, int $padding = OPENSSL_PKCS1_PADDING): bool {}
+
+function openssl_error_string(): string|false {}
+
+/**
+ * @param resource|string|array $key
+ * @param int|string $method
+ */
+function openssl_sign(string $data, &$signature, $key, $method = OPENSSL_ALGO_SHA1): bool {}
+
+/**
+ * @param resource|string|array $key
+ * @param int|string $method
+ */
+function openssl_verify(string $data, string $signature, $key, $method = OPENSSL_ALGO_SHA1): int|false {}
+
+function openssl_seal(string $data, &$sealdata, &$ekeys, array $pubkeys, string $method = UNKNOWN, &$iv = UNKNOWN): int|false {}
+
+/** @param resource|string|array $privkey */
+function openssl_open(string $data, &$opendata, string $ekey, $privkey, string $method = UNKNOWN, string $iv = UNKNOWN): bool {}
+
+function openssl_get_md_methods($aliases = false): array {}
+
+function openssl_get_cipher_methods($aliases = false): array {}
+
+#ifdef HAVE_EVP_PKEY_EC
+function openssl_get_curve_names(): array|false {}
+#endif
+
+function openssl_digest(string $data, string $method, bool $raw_output = false): string|false {}
+
+function openssl_encrypt(string $data, string $method, string $password, int $options = 0, string $iv = '', &$tag = UNKNOWN, string $aad = '', int $tag_length = 16): string|false {}
+
+function openssl_decrypt(string $data, string $method, string $password, int $options = 0, string $iv = '', string $tag = UNKNOWN, string $aad = ''): string|false {}
+
+function openssl_cipher_iv_length(string $method): int|false {}
+
+/** @param resource $dh_key */
+function openssl_dh_compute_key(string $pub_key, $dh_key): string|false {}
+
+/**
+ * @param resource|string|array $peer_pub_key
+ * @param resource|string|array $priv_key
+ */
+function openssl_pkey_derive($peer_pub_key, $priv_key, int $keylen = 0): string|false {}
+
+function openssl_random_pseudo_bytes(int $length, &$result_is_strong = UNKNOWN): string {}
+
+/** @param resource $privkey */
+function openssl_spki_new($privkey, string $challenge, int $algo = OPENSSL_ALGO_MD5): string|false {}
+
+function openssl_spki_verify(string $spki): bool {}
+
+function openssl_spki_export(string $spki): string|false {}
+
+function openssl_spki_export_challenge(string $spki): string|false {}
+
+function openssl_get_cert_locations(): array {}
diff --git a/ext/openssl/openssl_arginfo.h b/ext/openssl/openssl_arginfo.h
new file mode 100644
index 0000000000..9f8835ec13
--- /dev/null
+++ b/ext/openssl/openssl_arginfo.h
@@ -0,0 +1,316 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_x509_export_to_file, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, x509)
+ ZEND_ARG_TYPE_INFO(0, outfilename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, notext, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_x509_export, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, x509)
+ ZEND_ARG_INFO(1, out)
+ ZEND_ARG_TYPE_INFO(0, notext, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_x509_fingerprint, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, x509)
+ ZEND_ARG_TYPE_INFO(0, method, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, raw_output, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_x509_check_private_key, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, cert)
+ ZEND_ARG_INFO(0, key)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_x509_verify, 0, 2, IS_LONG, 0)
+ ZEND_ARG_INFO(0, cert)
+ ZEND_ARG_INFO(0, key)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_x509_parse, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, x509)
+ ZEND_ARG_TYPE_INFO(0, shortname, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_x509_checkpurpose, 0, 2, MAY_BE_BOOL|MAY_BE_LONG)
+ ZEND_ARG_INFO(0, x509cert)
+ ZEND_ARG_TYPE_INFO(0, purpose, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, cainfo, IS_ARRAY, 1)
+ ZEND_ARG_TYPE_INFO(0, untrustedfile, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_x509_read, 0, 0, 1)
+ ZEND_ARG_INFO(0, cert)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_x509_free, 0, 1, _IS_BOOL, 1)
+ ZEND_ARG_INFO(0, x509)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_pkcs12_export_to_file, 0, 4, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, x509cert)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_INFO(0, priv_key)
+ ZEND_ARG_TYPE_INFO(0, pass, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, args, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_pkcs12_export, 0, 4, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, x509)
+ ZEND_ARG_INFO(1, out)
+ ZEND_ARG_INFO(0, priv_key)
+ ZEND_ARG_TYPE_INFO(0, pass, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, args, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_pkcs12_read, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, pkcs12, IS_STRING, 0)
+ ZEND_ARG_INFO(1, certs)
+ ZEND_ARG_TYPE_INFO(0, pass, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_csr_export_to_file, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, csr)
+ ZEND_ARG_TYPE_INFO(0, outfilename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, notext, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_csr_export, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, csr)
+ ZEND_ARG_INFO(1, out)
+ ZEND_ARG_TYPE_INFO(0, notext, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_csr_sign, 0, 0, 4)
+ ZEND_ARG_INFO(0, csr)
+ ZEND_ARG_INFO(0, cacert)
+ ZEND_ARG_INFO(0, priv_key)
+ ZEND_ARG_TYPE_INFO(0, days, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, config_args, IS_ARRAY, 1)
+ ZEND_ARG_TYPE_INFO(0, serial, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_csr_new, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, dn, IS_ARRAY, 0)
+ ZEND_ARG_INFO(1, privkey)
+ ZEND_ARG_TYPE_INFO(0, configargs, IS_ARRAY, 1)
+ ZEND_ARG_TYPE_INFO(0, extraattribs, IS_ARRAY, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_csr_get_subject, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, csr)
+ ZEND_ARG_TYPE_INFO(0, use_shortnames, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_csr_get_public_key, 0, 0, 1)
+ ZEND_ARG_INFO(0, csr)
+ ZEND_ARG_TYPE_INFO(0, use_shortnames, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_pkey_new, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, configargs, IS_ARRAY, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_pkey_export_to_file, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, key)
+ ZEND_ARG_TYPE_INFO(0, outfilename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, passphrase, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, configargs, IS_ARRAY, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_pkey_export, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, key)
+ ZEND_ARG_INFO(1, out)
+ ZEND_ARG_TYPE_INFO(0, passphrase, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, configargs, IS_ARRAY, 1)
+ZEND_END_ARG_INFO()
+
+#define arginfo_openssl_pkey_get_public arginfo_openssl_x509_read
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_pkey_free, 0, 1, IS_VOID, 0)
+ ZEND_ARG_INFO(0, key)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_openssl_pkey_get_private, 0, 0, 1)
+ ZEND_ARG_INFO(0, key)
+ ZEND_ARG_TYPE_INFO(0, passphrase, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_pkey_get_details, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, key)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_pbkdf2, 0, 4, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, salt, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, key_length, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, iterations, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, digest_algorithm, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_pkcs7_verify, 0, 2, MAY_BE_BOOL|MAY_BE_LONG)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, signerscerts, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, cainfo, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, extracerts, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, content, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, pk7, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_pkcs7_encrypt, 0, 4, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, infile, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, outfile, IS_STRING, 0)
+ ZEND_ARG_INFO(0, recipcerts)
+ ZEND_ARG_TYPE_INFO(0, headers, IS_ARRAY, 1)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, cipher, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_pkcs7_sign, 0, 5, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, infile, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, outfile, IS_STRING, 0)
+ ZEND_ARG_INFO(0, signcert)
+ ZEND_ARG_INFO(0, signkey)
+ ZEND_ARG_TYPE_INFO(0, headers, IS_ARRAY, 1)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, extracertsfilename, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_pkcs7_decrypt, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, infilename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, outfilename, IS_STRING, 0)
+ ZEND_ARG_INFO(0, recipcert)
+ ZEND_ARG_INFO(0, recipkey)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_pkcs7_read, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, infilename, IS_STRING, 0)
+ ZEND_ARG_INFO(1, certs)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_private_encrypt, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ ZEND_ARG_INFO(1, crypted)
+ ZEND_ARG_INFO(0, key)
+ ZEND_ARG_TYPE_INFO(0, padding, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_openssl_private_decrypt arginfo_openssl_private_encrypt
+
+#define arginfo_openssl_public_encrypt arginfo_openssl_private_encrypt
+
+#define arginfo_openssl_public_decrypt arginfo_openssl_private_encrypt
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_error_string, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_sign, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ ZEND_ARG_INFO(1, signature)
+ ZEND_ARG_INFO(0, key)
+ ZEND_ARG_INFO(0, method)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_verify, 0, 3, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, signature, IS_STRING, 0)
+ ZEND_ARG_INFO(0, key)
+ ZEND_ARG_INFO(0, method)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_seal, 0, 4, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ ZEND_ARG_INFO(1, sealdata)
+ ZEND_ARG_INFO(1, ekeys)
+ ZEND_ARG_TYPE_INFO(0, pubkeys, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, method, IS_STRING, 0)
+ ZEND_ARG_INFO(1, iv)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_open, 0, 4, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ ZEND_ARG_INFO(1, opendata)
+ ZEND_ARG_TYPE_INFO(0, ekey, IS_STRING, 0)
+ ZEND_ARG_INFO(0, privkey)
+ ZEND_ARG_TYPE_INFO(0, method, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, iv, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_get_md_methods, 0, 0, IS_ARRAY, 0)
+ ZEND_ARG_INFO(0, aliases)
+ZEND_END_ARG_INFO()
+
+#define arginfo_openssl_get_cipher_methods arginfo_openssl_get_md_methods
+
+#if defined(HAVE_EVP_PKEY_EC)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_get_curve_names, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_digest, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, method, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, raw_output, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_encrypt, 0, 3, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, method, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, iv, IS_STRING, 0)
+ ZEND_ARG_INFO(1, tag)
+ ZEND_ARG_TYPE_INFO(0, aad, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, tag_length, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_decrypt, 0, 3, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, method, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, iv, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, tag, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, aad, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_cipher_iv_length, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, method, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_dh_compute_key, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, pub_key, IS_STRING, 0)
+ ZEND_ARG_INFO(0, dh_key)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_pkey_derive, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, peer_pub_key)
+ ZEND_ARG_INFO(0, priv_key)
+ ZEND_ARG_TYPE_INFO(0, keylen, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_random_pseudo_bytes, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
+ ZEND_ARG_INFO(1, result_is_strong)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_spki_new, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, privkey)
+ ZEND_ARG_TYPE_INFO(0, challenge, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, algo, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_spki_verify, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, spki, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_openssl_spki_export, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, spki, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_openssl_spki_export_challenge arginfo_openssl_spki_export
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openssl_get_cert_locations, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/openssl/php_openssl.h b/ext/openssl/php_openssl.h
index 7926b475e7..69af414617 100644
--- a/ext/openssl/php_openssl.h
+++ b/ext/openssl/php_openssl.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/openssl/tests/bug28382.phpt b/ext/openssl/tests/bug28382.phpt
index f64e77dbd2..3d8cb528ba 100644
--- a/ext/openssl/tests/bug28382.phpt
+++ b/ext/openssl/tests/bug28382.phpt
@@ -10,9 +10,9 @@ $cert = file_get_contents(__DIR__ . "/bug28382cert.txt");
$ext = openssl_x509_parse($cert);
var_dump($ext['extensions']);
/* openssl 1.0 prepends the string "Full Name:" to the crlDistributionPoints array key.
- For now, as this is the one difference only between 0.9.x and 1.x, it's handled with
- placeholders to not to duplicate the test. When more diffs come, a duplication would
- be probably a better solution.
+ For now, as this is the one difference only between 0.9.x and 1.x, it's handled with
+ placeholders to not to duplicate the test. When more diffs come, a duplication would
+ be probably a better solution.
*/
?>
--EXPECTF--
diff --git a/ext/openssl/tests/bug38255.phpt b/ext/openssl/tests/bug38255.phpt
index f49b77485c..d0e5d542cd 100644
--- a/ext/openssl/tests/bug38255.phpt
+++ b/ext/openssl/tests/bug38255.phpt
@@ -20,36 +20,16 @@ $t = new test;
var_dump(openssl_verify("foo", $signature, $pub_key_id, OPENSSL_ALGO_MD5));
var_dump(openssl_verify("foo", $t, $pub_key_id, OPENSSL_ALGO_MD5));
-var_dump(openssl_verify("foo", new stdClass, $pub_key_id, OPENSSL_ALGO_MD5));
-var_dump(openssl_verify("foo", new stdClass, array(), OPENSSL_ALGO_MD5));
-var_dump(openssl_verify("foo", array(), array(), OPENSSL_ALGO_MD5));
-var_dump(openssl_verify());
-var_dump(openssl_verify(new stdClass, new stdClass, array(), 10000));
echo "Done\n";
?>
--EXPECTF--
-Warning: openssl_verify(): supplied key param cannot be coerced into a public key in %s on line %d
+Warning: openssl_verify(): Supplied key param cannot be coerced into a public key in %s on line %d
-Warning: openssl_verify(): supplied key param cannot be coerced into a public key in %s on line %d
+Warning: openssl_verify(): Supplied key param cannot be coerced into a public key in %s on line %d
bool(false)
-Warning: openssl_verify(): supplied key param cannot be coerced into a public key in %s on line %d
+Warning: openssl_verify(): Supplied key param cannot be coerced into a public key in %s on line %d
bool(false)
-
-Warning: openssl_verify() expects parameter 2 to be string, object given in %s on line %d
-NULL
-
-Warning: openssl_verify() expects parameter 2 to be string, object given in %s on line %d
-NULL
-
-Warning: openssl_verify() expects parameter 2 to be string, array given in %s on line %d
-NULL
-
-Warning: openssl_verify() expects at least 3 parameters, 0 given in %s on line %d
-NULL
-
-Warning: openssl_verify() expects parameter 1 to be string, object given in %s on line %d
-NULL
Done
diff --git a/ext/openssl/tests/bug38261.phpt b/ext/openssl/tests/bug38261.phpt
index e6e345d5ea..b6b3f4c609 100644
--- a/ext/openssl/tests/bug38261.phpt
+++ b/ext/openssl/tests/bug38261.phpt
@@ -17,7 +17,6 @@ $t = new test;
var_dump(openssl_x509_parse("foo"));
var_dump(openssl_x509_parse($t));
var_dump(openssl_x509_parse(array()));
-var_dump(openssl_x509_parse());
var_dump(openssl_x509_parse($cert));
try {
var_dump(openssl_x509_parse(new stdClass));
@@ -30,8 +29,5 @@ try {
bool(false)
bool(false)
bool(false)
-
-Warning: openssl_x509_parse() expects at least 1 parameter, 0 given in %sbug38261.php on line %d
-NULL
bool(false)
Object of class stdClass could not be converted to string
diff --git a/ext/openssl/tests/bug54992.phpt b/ext/openssl/tests/bug54992.phpt
index fdd75680a3..9f559453e7 100644
--- a/ext/openssl/tests/bug54992.phpt
+++ b/ext/openssl/tests/bug54992.phpt
@@ -60,5 +60,5 @@ Warning: stream_socket_client(): Peer certificate CN=`bug54992_actual_peer_name'
Warning: stream_socket_client(): Failed to enable crypto in %s on line %d
-Warning: stream_socket_client(): unable to connect to ssl://127.0.0.1:64321 (Unknown error) in %s on line %d
+Warning: stream_socket_client(): Unable to connect to ssl://127.0.0.1:64321 (Unknown error) in %s on line %d
bool(false)
diff --git a/ext/openssl/tests/bug55646.phpt b/ext/openssl/tests/bug55646.phpt
index a7e4152779..9de5359008 100644
--- a/ext/openssl/tests/bug55646.phpt
+++ b/ext/openssl/tests/bug55646.phpt
@@ -36,7 +36,7 @@ $csr_res = openssl_csr_new(
if (!$csr_res) {
while ($e = openssl_error_string()) {
$err = $e;
- }
+ }
die("Failed; last error: $err");
}
openssl_csr_export($csr_res, $csr);
diff --git a/ext/openssl/tests/bug60632.phpt b/ext/openssl/tests/bug60632.phpt
index eb51276fa5..5993229a00 100644
--- a/ext/openssl/tests/bug60632.phpt
+++ b/ext/openssl/tests/bug60632.phpt
@@ -8,11 +8,11 @@ if (!extension_loaded("openssl")) die("skip openssl not loaded");
<?php
$pkey = openssl_pkey_new(array(
- 'digest_alg' => 'sha256',
- 'private_key_bits' => 1024,
- 'private_key_type' => OPENSSL_KEYTYPE_RSA,
- 'encrypt_key' => false,
- 'config' => __DIR__ . DIRECTORY_SEPARATOR . 'openssl.cnf',
+ 'digest_alg' => 'sha256',
+ 'private_key_bits' => 1024,
+ 'private_key_type' => OPENSSL_KEYTYPE_RSA,
+ 'encrypt_key' => false,
+ 'config' => __DIR__ . DIRECTORY_SEPARATOR . 'openssl.cnf',
));
$details = openssl_pkey_get_details($pkey);
$test_pubkey = $details['key'];
diff --git a/ext/openssl/tests/bug65538_002.phpt b/ext/openssl/tests/bug65538_002.phpt
index 2a06d2d1b6..51d8f46f5b 100644
--- a/ext/openssl/tests/bug65538_002.phpt
+++ b/ext/openssl/tests/bug65538_002.phpt
@@ -22,4 +22,4 @@ Warning: remote cafile streams are disabled for security purposes in %s on line
Warning: file_get_contents(): Failed to enable crypto in %s on line %d
-Warning: file_get_contents(%s): failed to open stream: operation failed in %s on line %d
+Warning: file_get_contents(%s): Failed to open stream: operation failed in %s on line %d
diff --git a/ext/openssl/tests/bug65729.phpt b/ext/openssl/tests/bug65729.phpt
index cffba43dfe..7a516d0be6 100644
--- a/ext/openssl/tests/bug65729.phpt
+++ b/ext/openssl/tests/bug65729.phpt
@@ -49,7 +49,7 @@ Warning: stream_socket_client(): Peer certificate CN=`*.test.com' did not match
Warning: stream_socket_client(): Failed to enable crypto in %s on line %d
-Warning: stream_socket_client(): unable to connect to ssl://127.0.0.1:64321 (Unknown error) in %s on line %d
+Warning: stream_socket_client(): Unable to connect to ssl://127.0.0.1:64321 (Unknown error) in %s on line %d
bool(false)
resource(%d) of type (stream)
resource(%d) of type (stream)
@@ -58,5 +58,5 @@ Warning: stream_socket_client(): Peer certificate CN=`*.test.com' did not match
Warning: stream_socket_client(): Failed to enable crypto in %s on line %d
-Warning: stream_socket_client(): unable to connect to ssl://127.0.0.1:64321 (Unknown error) in %s on line %d
+Warning: stream_socket_client(): Unable to connect to ssl://127.0.0.1:64321 (Unknown error) in %s on line %d
bool(false)
diff --git a/ext/openssl/tests/bug68912.phpt b/ext/openssl/tests/bug68912.phpt
index 724a96017a..0b796b7683 100644
--- a/ext/openssl/tests/bug68912.phpt
+++ b/ext/openssl/tests/bug68912.phpt
@@ -12,9 +12,11 @@ $var1=fopen(__FILE__, 'r');
$var2=2;
$var3=3;
-openssl_spki_new($var1, $var2, $var3);
+try {
+ openssl_spki_new($var1, $var2, $var3);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Warning: openssl_spki_new(): supplied resource is not a valid OpenSSL X.509/key resource in %sbug68912.php on line %d
-
-Warning: openssl_spki_new(): Unable to use supplied private key in %sbug68912.php on line %d
+--EXPECT--
+openssl_spki_new(): supplied resource is not a valid OpenSSL X.509/key resource
diff --git a/ext/openssl/tests/bug68920.phpt b/ext/openssl/tests/bug68920.phpt
index 34e07a4532..3419c06bed 100644
--- a/ext/openssl/tests/bug68920.phpt
+++ b/ext/openssl/tests/bug68920.phpt
@@ -54,14 +54,14 @@ Warning: stream_socket_client(): Expected peer fingerprint must be a string or a
Warning: stream_socket_client(): Failed to enable crypto in %s on line %d
-Warning: stream_socket_client(): unable to connect to %s (Unknown error) in %s on line %d
+Warning: stream_socket_client(): Unable to connect to %s (Unknown error) in %s on line %d
bool(false)
Warning: stream_socket_client(): Expected peer fingerprint must be a string or an array in %s on line %d
Warning: stream_socket_client(): Failed to enable crypto in %s on line %d
-Warning: stream_socket_client(): unable to connect to %s (Unknown error) in %s on line %d
+Warning: stream_socket_client(): Unable to connect to %s (Unknown error) in %s on line %d
bool(false)
Warning: stream_socket_client(): Invalid peer_fingerprint array; [algo => fingerprint] form required in %s on line %d
@@ -70,7 +70,7 @@ Warning: stream_socket_client(): peer_fingerprint match failure in %s on line %d
Warning: stream_socket_client(): Failed to enable crypto in %s on line %d
-Warning: stream_socket_client(): unable to connect to %s (Unknown error) in %s on line %d
+Warning: stream_socket_client(): Unable to connect to %s (Unknown error) in %s on line %d
bool(false)
Warning: stream_socket_client(): Invalid peer_fingerprint array; [algo => fingerprint] form required in %s on line %d
@@ -79,5 +79,5 @@ Warning: stream_socket_client(): peer_fingerprint match failure in %s on line %d
Warning: stream_socket_client(): Failed to enable crypto in %s on line %d
-Warning: stream_socket_client(): unable to connect to %s (Unknown error) in %s on line %d
+Warning: stream_socket_client(): Unable to connect to %s (Unknown error) in %s on line %d
bool(false)
diff --git a/ext/openssl/tests/bug71475.phpt b/ext/openssl/tests/bug71475.phpt
index 5df8ac27c6..6d4ca66580 100644
--- a/ext/openssl/tests/bug71475.phpt
+++ b/ext/openssl/tests/bug71475.phpt
@@ -11,5 +11,5 @@ openssl_seal($_, $_, $_, array_fill(0,64,0));
?>
DONE
--EXPECTF--
-Warning: openssl_seal(): not a public key (1th member of pubkeys) in %s%ebug71475.php on line %d
+Warning: openssl_seal(): Not a public key (1th member of pubkeys) in %s%ebug71475.php on line %d
DONE
diff --git a/ext/openssl/tests/bug72165.phpt b/ext/openssl/tests/bug72165.phpt
index 93b3c3d4a8..50e8b54100 100644
--- a/ext/openssl/tests/bug72165.phpt
+++ b/ext/openssl/tests/bug72165.phpt
@@ -9,9 +9,7 @@ if (!extension_loaded("openssl")) die("skip");
$var0 = array(0 => "hello", 1 => "world");
$var2 = openssl_csr_new(array(0),$var0,null,array(0));
?>
-==DONE==
--EXPECTF--
Warning: openssl_csr_new(): dn: numeric fild names are not supported in %sbug72165.php on line %d
Warning: openssl_csr_new(): add1_attr_by_txt challengePassword_min -> 4 (failed; check error queue and value of string_mask OpenSSL option if illegal characters are reported) in %sbug72165.php on line %d
-==DONE==
diff --git a/ext/openssl/tests/bug74022.phpt b/ext/openssl/tests/bug74022.phpt
index 1bd2116241..77ae6c83cb 100644
--- a/ext/openssl/tests/bug74022.phpt
+++ b/ext/openssl/tests/bug74022.phpt
@@ -12,8 +12,6 @@ $cert_store = file_get_contents($pfx);
var_dump(openssl_pkcs12_read($cert_store, $cert_info, "csos"));
var_dump(openssl_error_string());
?>
-===DONE===
--EXPECT--
bool(true)
bool(false)
-===DONE===
diff --git a/ext/openssl/tests/bug74022_2.phpt b/ext/openssl/tests/bug74022_2.phpt
index 07cb683274..5df37fb3c9 100644
--- a/ext/openssl/tests/bug74022_2.phpt
+++ b/ext/openssl/tests/bug74022_2.phpt
@@ -18,7 +18,5 @@ $p12 = base64_decode($p12_base64);
test($p12, 'qwerty');
?>
-===DONE===
--EXPECT--
int(2)
-===DONE===
diff --git a/ext/openssl/tests/bug74720_0.phpt b/ext/openssl/tests/bug74720_0.phpt
index f85d83860c..1257983110 100644
--- a/ext/openssl/tests/bug74720_0.phpt
+++ b/ext/openssl/tests/bug74720_0.phpt
@@ -82,11 +82,9 @@ unlink($tmpFileOut);
unlink($tmpFileOut2);
?>
-==DONE==
--EXPECT--
bool(true)
bool(true)
int(39)
int(39)
int(39)
-==DONE==
diff --git a/ext/openssl/tests/bug74720_1.phpt b/ext/openssl/tests/bug74720_1.phpt
index 231a083b76..2439868495 100644
--- a/ext/openssl/tests/bug74720_1.phpt
+++ b/ext/openssl/tests/bug74720_1.phpt
@@ -79,7 +79,5 @@ unlink($tmpPath);
unlink($outPath);
?>
-==DONE==
--EXPECT--
bool(true)
-==DONE==
diff --git a/ext/openssl/tests/bug74798.phpt b/ext/openssl/tests/bug74798.phpt
index 93f6ded44d..a262895a6f 100644
--- a/ext/openssl/tests/bug74798.phpt
+++ b/ext/openssl/tests/bug74798.phpt
@@ -82,7 +82,6 @@ unlink($tmpFileOut);
unlink($tmpFileOut2);
?>
-===DONE===
--EXPECT--
bool(true)
bool(true)
@@ -91,4 +90,3 @@ int(40)
int(40)
string(80) "537472696e672077697468200a2077696c6c20656e6420696e206f6e652062797465206d6f72652e"
string(80) "537472696e672077697468200a2077696c6c20656e6420696e206f6e652062797465206d6f72652e"
-===DONE===
diff --git a/ext/openssl/tests/bug74903.phpt b/ext/openssl/tests/bug74903.phpt
index 41f0416fee..2befa09027 100644
--- a/ext/openssl/tests/bug74903.phpt
+++ b/ext/openssl/tests/bug74903.phpt
@@ -75,8 +75,6 @@ unlink($tmpFileIn);
unlink($tmpFileOut);
?>
-==DONE==
--EXPECT--
bool(true)
bool(true)
-==DONE==
diff --git a/ext/openssl/tests/bug75307.phpt b/ext/openssl/tests/bug75307.phpt
index 2b0cae3a97..0b1f4ac210 100644
--- a/ext/openssl/tests/bug75307.phpt
+++ b/ext/openssl/tests/bug75307.phpt
@@ -10,8 +10,6 @@ $rf = new ReflectionFunction('openssl_open');
var_dump($rf->getNumberOfParameters());
var_dump($rf->getNumberOfRequiredParameters());
?>
-===DONE===
--EXPECT--
int(6)
int(4)
-===DONE===
diff --git a/ext/openssl/tests/cve-2013-6420.phpt b/ext/openssl/tests/cve-2013-6420.phpt
index 4a4b28ca74..82cbf47ca8 100644
--- a/ext/openssl/tests/cve-2013-6420.phpt
+++ b/ext/openssl/tests/cve-2013-6420.phpt
@@ -10,7 +10,7 @@ var_dump($info['issuer']['emailAddress'], $info["validFrom_time_t"]);
?>
Done
--EXPECTF--
-%s openssl_x509_parse(): illegal length in timestamp in %s%ecve-2013-6420.php on line 3
+%s openssl_x509_parse(): Illegal length in timestamp in %s%ecve-2013-6420.php on line 3
string(27) "stefan.esser@sektioneins.de"
int(-1)
Done
diff --git a/ext/openssl/tests/openssl_csr_export_bacis.phpt b/ext/openssl/tests/openssl_csr_export_bacis.phpt
index 228a173764..3a252d8a8f 100644
--- a/ext/openssl/tests/openssl_csr_export_bacis.phpt
+++ b/ext/openssl/tests/openssl_csr_export_bacis.phpt
@@ -27,22 +27,20 @@ $args = array(
$privkey = openssl_pkey_new($config_arg);
$csr = openssl_csr_new($dn, $privkey, $args);
var_dump(openssl_csr_export($csr, $output));
-var_dump(openssl_csr_export($wrong, $output));
-var_dump(openssl_csr_export($privkey, $output));
-var_dump(openssl_csr_export(array(), $output));
+try {
+ var_dump(openssl_csr_export($wrong, $output));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(openssl_csr_export($privkey, $output));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump(openssl_csr_export($csr, $output, false));
?>
---EXPECTF--
+--EXPECT--
bool(true)
-
-Warning: openssl_csr_export() expects parameter 1 to be resource, string given in %s on line %d
-NULL
-
-Warning: openssl_csr_export(): supplied resource is not a valid OpenSSL X.509 CSR resource in %s on line %d
-
-Warning: openssl_csr_export(): cannot get CSR from parameter 1 in %s on line %d
-bool(false)
-
-Warning: openssl_csr_export() expects parameter 1 to be resource, array given in %s on line %d
-NULL
+openssl_csr_export() expects parameter 1 to be resource, string given
+openssl_csr_export(): supplied resource is not a valid OpenSSL X.509 CSR resource
bool(true)
diff --git a/ext/openssl/tests/openssl_csr_export_to_file_basic.phpt b/ext/openssl/tests/openssl_csr_export_to_file_basic.phpt
index 7404bd28e3..57092293db 100644
--- a/ext/openssl/tests/openssl_csr_export_to_file_basic.phpt
+++ b/ext/openssl/tests/openssl_csr_export_to_file_basic.phpt
@@ -36,9 +36,16 @@ $privkey_file = 'file://' . __DIR__ . '/private_rsa_2048.key';
$csr = openssl_csr_new($dn, $privkey_file, $args);
var_dump(openssl_csr_export_to_file($csr, $csrfile));
var_dump(file_get_contents($csrfile));
-var_dump(openssl_csr_export_to_file($wrong, $csrfile));
-var_dump(openssl_csr_export_to_file($dh, $csrfile));
-var_dump(openssl_csr_export_to_file(array(), $csrfile));
+try {
+ var_dump(openssl_csr_export_to_file($wrong, $csrfile));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(openssl_csr_export_to_file($dh, $csrfile));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump(openssl_csr_export_to_file($csr, $csrfile, false));
?>
--CLEAN--
@@ -48,7 +55,7 @@ if (file_exists($csrfile)) {
unlink($csrfile);
}
?>
---EXPECTF--
+--EXPECT--
bool(true)
string(1086) "-----BEGIN CERTIFICATE REQUEST-----
MIIC6jCCAdICAQAwgaQxCzAJBgNVBAYTAkJSMRowGAYDVQQIExFSaW8gR3JhbmRl
@@ -69,15 +76,6 @@ sfBgVeqg0P4SWez5fHXqBNcjMdMI5f0bikcDZSIfTHS8FX+PMurLBC8UPB0YNIOl
JViHkCA9x6m8RJXAFvqmgLlWlUzbDv/cRrDfjWjR
-----END CERTIFICATE REQUEST-----
"
-
-Warning: openssl_csr_export_to_file() expects parameter 1 to be resource, string given in %s on line %d
-NULL
-
-Warning: openssl_csr_export_to_file(): supplied resource is not a valid OpenSSL X.509 CSR resource in %s on line %d
-
-Warning: openssl_csr_export_to_file(): cannot get CSR from parameter 1 in %s on line %d
-bool(false)
-
-Warning: openssl_csr_export_to_file() expects parameter 1 to be resource, array given in %s on line %d
-NULL
+openssl_csr_export_to_file() expects parameter 1 to be resource, string given
+openssl_csr_export_to_file(): supplied resource is not a valid OpenSSL X.509 CSR resource
bool(true)
diff --git a/ext/openssl/tests/openssl_csr_get_public_key_basic.phpt b/ext/openssl/tests/openssl_csr_get_public_key_basic.phpt
index 866eeae169..185e46539e 100644
--- a/ext/openssl/tests/openssl_csr_get_public_key_basic.phpt
+++ b/ext/openssl/tests/openssl_csr_get_public_key_basic.phpt
@@ -13,7 +13,7 @@ $phex = 'dcf93a0b883972ec0e19989ac5a2ce310e1d37717e8d9571bb7623731866e61e' .
'6634af1949e5b535cc829a483b8a76223e5d490a257f05bdff16f2fb22c583ab';
$dh_details = array('p' => $phex, 'g' => '2');
$dh = openssl_pkey_new(array(
- 'dh'=> array('p' => hex2bin($phex), 'g' => '2'))
+ 'dh'=> array('p' => hex2bin($phex), 'g' => '2'))
);
$dn = array(
diff --git a/ext/openssl/tests/openssl_csr_get_subject_basic.phpt b/ext/openssl/tests/openssl_csr_get_subject_basic.phpt
index 87ab824f35..8ebc51cc50 100644
--- a/ext/openssl/tests/openssl_csr_get_subject_basic.phpt
+++ b/ext/openssl/tests/openssl_csr_get_subject_basic.phpt
@@ -13,7 +13,7 @@ $phex = 'dcf93a0b883972ec0e19989ac5a2ce310e1d37717e8d9571bb7623731866e61e' .
'6634af1949e5b535cc829a483b8a76223e5d490a257f05bdff16f2fb22c583ab';
$dh_details = array('p' => $phex, 'g' => '2');
$dh = openssl_pkey_new(array(
- 'dh'=> array('p' => hex2bin($phex), 'g' => '2'))
+ 'dh'=> array('p' => hex2bin($phex), 'g' => '2'))
);
$dn = array(
diff --git a/ext/openssl/tests/openssl_csr_new_basic.phpt b/ext/openssl/tests/openssl_csr_new_basic.phpt
index 83a056b061..c18ac2a22e 100644
--- a/ext/openssl/tests/openssl_csr_new_basic.phpt
+++ b/ext/openssl/tests/openssl_csr_new_basic.phpt
@@ -5,9 +5,6 @@ openssl_csr_new() tests
--FILE--
<?php
-$a = 1;
-var_dump(openssl_csr_new(1,$a));
-var_dump(openssl_csr_new(1,$a,1,1));
$a = array();
$conf = array('config' => __DIR__ . DIRECTORY_SEPARATOR . 'openssl.cnf');
@@ -26,13 +23,7 @@ var_dump(openssl_csr_new(["countryName" => "DE"], $x, $conf + ["x509_extensions"
echo "Done\n";
?>
--EXPECTF--
-Warning: openssl_csr_new() expects parameter 1 to be array, int given in %s on line %d
-NULL
-
-Warning: openssl_csr_new() expects parameter 1 to be array, int given in %s on line %d
-NULL
-
-Warning: openssl_csr_new(): key array must be of the form array(0 => key, 1 => phrase) in %s on line %d
+Warning: openssl_csr_new(): Key array must be of the form array(0 => key, 1 => phrase) in %s on line %d
Warning: openssl_csr_new(): add1_attr_by_txt challengePassword_min -> 4 (failed; check error queue and value of string_mask OpenSSL option if illegal characters are reported) in %s on line %d
bool(false)
diff --git a/ext/openssl/tests/openssl_csr_sign_basic.phpt b/ext/openssl/tests/openssl_csr_sign_basic.phpt
index 969a8e1073..03e070e52b 100644
--- a/ext/openssl/tests/openssl_csr_sign_basic.phpt
+++ b/ext/openssl/tests/openssl_csr_sign_basic.phpt
@@ -35,13 +35,10 @@ var_dump(openssl_csr_sign($csr, $cert, $priv, 365, $config_arg));
var_dump(openssl_csr_sign($csr, openssl_x509_read($cert), $priv, 365, $config_arg));
var_dump(openssl_csr_sign($csr, $wrong, $privkey, 365));
var_dump(openssl_csr_sign($csr, null, $wrong, 365));
-var_dump(openssl_csr_sign($csr, null, $privkey, $wrong));
-var_dump(openssl_csr_sign($csr, null, $privkey, 365, $wrong));
var_dump(openssl_csr_sign($wrong, null, $privkey, 365));
var_dump(openssl_csr_sign(array(), null, $privkey, 365));
var_dump(openssl_csr_sign($csr, array(), $privkey, 365));
var_dump(openssl_csr_sign($csr, null, array(), 365));
-var_dump(openssl_csr_sign($csr, null, $privkey, array()));
var_dump(openssl_csr_sign($csr, null, $privkey, 365, $config_arg));
?>
--EXPECTF--
@@ -50,32 +47,23 @@ resource(%d) of type (OpenSSL X.509)
resource(%d) of type (OpenSSL X.509)
resource(%d) of type (OpenSSL X.509)
-Warning: openssl_csr_sign(): cannot get cert from parameter 2 in %s on line %d
+Warning: openssl_csr_sign(): Cannot get cert from parameter 2 in %s on line %d
bool(false)
-Warning: openssl_csr_sign(): cannot get private key from parameter 3 in %s on line %d
+Warning: openssl_csr_sign(): Cannot get private key from parameter 3 in %s on line %d
bool(false)
-Warning: openssl_csr_sign() expects parameter 4 to be int, string given in %s on line %d
-NULL
-
-Warning: openssl_csr_sign() expects parameter 5 to be array, string given in %s on line %d
-NULL
-
-Warning: openssl_csr_sign(): cannot get CSR from parameter 1 in %s on line %d
+Warning: openssl_csr_sign(): Cannot get CSR from parameter 1 in %s on line %d
bool(false)
-Warning: openssl_csr_sign(): cannot get CSR from parameter 1 in %s on line %d
+Warning: openssl_csr_sign(): Cannot get CSR from parameter 1 in %s on line %d
bool(false)
-Warning: openssl_csr_sign(): cannot get cert from parameter 2 in %s on line %d
+Warning: openssl_csr_sign(): Cannot get cert from parameter 2 in %s on line %d
bool(false)
-Warning: openssl_csr_sign(): key array must be of the form array(0 => key, 1 => phrase) in %s on line %d
+Warning: openssl_csr_sign(): Key array must be of the form array(0 => key, 1 => phrase) in %s on line %d
-Warning: openssl_csr_sign(): cannot get private key from parameter 3 in %s on line %d
+Warning: openssl_csr_sign(): Cannot get private key from parameter 3 in %s on line %d
bool(false)
-
-Warning: openssl_csr_sign() expects parameter 4 to be int, array given in %s on line %d
-NULL
resource(%d) of type (OpenSSL X.509)
diff --git a/ext/openssl/tests/openssl_decrypt_ccm.phpt b/ext/openssl/tests/openssl_decrypt_ccm.phpt
index a5f01b87ce..87b6d4b264 100644
--- a/ext/openssl/tests/openssl_decrypt_ccm.phpt
+++ b/ext/openssl/tests/openssl_decrypt_ccm.phpt
@@ -22,13 +22,13 @@ foreach ($tests as $idx => $test) {
// no IV
var_dump(openssl_decrypt($test['ct'], $method, $test['key'], OPENSSL_RAW_DATA,
- NULL, $test['tag'], $test['aad']));
+ NULL, $test['tag'], $test['aad']));
// failed because no AAD
var_dump(openssl_decrypt($test['ct'], $method, $test['key'], OPENSSL_RAW_DATA,
- $test['iv'], $test['tag']));
+ $test['iv'], $test['tag']));
// failed because wrong tag
var_dump(openssl_decrypt($test['ct'], $method, $test['key'], OPENSSL_RAW_DATA,
- $test['iv'], str_repeat('x', 10), $test['aad']));
+ $test['iv'], str_repeat('x', 10), $test['aad']));
?>
--EXPECTF--
diff --git a/ext/openssl/tests/openssl_decrypt_error.phpt b/ext/openssl/tests/openssl_decrypt_error.phpt
index be40f8080f..5f79cd86c2 100644
--- a/ext/openssl/tests/openssl_decrypt_error.phpt
+++ b/ext/openssl/tests/openssl_decrypt_error.phpt
@@ -19,9 +19,6 @@ var_dump(openssl_decrypt($wrong, $method, $password));
var_dump(openssl_decrypt($wrong, $wrong, $password));
var_dump(openssl_decrypt($encrypted, $wrong, $wrong));
var_dump(openssl_decrypt($wrong, $wrong, $wrong));
-var_dump(openssl_decrypt(array(), $method, $password));
-var_dump(openssl_decrypt($encrypted, array(), $password));
-var_dump(openssl_decrypt($encrypted, $method, array()));
// invalid using of an authentication tag
var_dump(openssl_encrypt($data, $method, $password, 0, $iv, $wrong));
@@ -45,14 +42,5 @@ bool(false)
Warning: openssl_decrypt(): Unknown cipher algorithm in %s on line %d
bool(false)
-Warning: openssl_decrypt() expects parameter 1 to be string, array given in %s on line %d
-NULL
-
-Warning: openssl_decrypt() expects parameter 2 to be string, array given in %s on line %d
-NULL
-
-Warning: openssl_decrypt() expects parameter 3 to be string, array given in %s on line %d
-NULL
-
Warning: openssl_encrypt(): The authenticated tag cannot be provided for cipher that doesn not support AEAD in %s on line %d
string(44) "yof6cPPH4mLee6TOc0YQSrh4dvywMqxGUyjp0lV6+aM="
diff --git a/ext/openssl/tests/openssl_decrypt_gcm.phpt b/ext/openssl/tests/openssl_decrypt_gcm.phpt
index f03c4d2468..5c243a8fad 100644
--- a/ext/openssl/tests/openssl_decrypt_gcm.phpt
+++ b/ext/openssl/tests/openssl_decrypt_gcm.phpt
@@ -22,13 +22,13 @@ foreach ($tests as $idx => $test) {
// no IV
var_dump(openssl_decrypt($test['ct'], $method, $test['key'], OPENSSL_RAW_DATA,
- NULL, $test['tag'], $test['aad']));
+ NULL, $test['tag'], $test['aad']));
// failed because no AAD
var_dump(openssl_decrypt($test['ct'], $method, $test['key'], OPENSSL_RAW_DATA,
- $test['iv'], $test['tag']));
+ $test['iv'], $test['tag']));
// failed because wrong tag
var_dump(openssl_decrypt($test['ct'], $method, $test['key'], OPENSSL_RAW_DATA,
- $test['iv'], str_repeat('x', 16), $test['aad']));
+ $test['iv'], str_repeat('x', 16), $test['aad']));
?>
--EXPECTF--
diff --git a/ext/openssl/tests/openssl_encrypt_error.phpt b/ext/openssl/tests/openssl_encrypt_error.phpt
index ea39bff604..53bc371f46 100644
--- a/ext/openssl/tests/openssl_encrypt_error.phpt
+++ b/ext/openssl/tests/openssl_encrypt_error.phpt
@@ -14,12 +14,6 @@ $arr = array(1);
// wrong parameters tests
var_dump(openssl_encrypt($data, $wrong, $password));
-var_dump(openssl_encrypt($object, $method, $password));
-var_dump(openssl_encrypt($data, $object, $password));
-var_dump(openssl_encrypt($data, $method, $object));
-var_dump(openssl_encrypt($arr, $method, $object));
-var_dump(openssl_encrypt($data, $arr, $object));
-var_dump(openssl_encrypt($data, $method, $arr));
// invalid using of an authentication tag
var_dump(openssl_encrypt($data, $method, $password, 0, $iv, $wrong));
@@ -31,24 +25,6 @@ var_dump(openssl_encrypt($data, $method, $password, OPENSSL_DONT_ZERO_PAD_KEY, $
Warning: openssl_encrypt(): Unknown cipher algorithm in %s on line %d
bool(false)
-Warning: openssl_encrypt() expects parameter 1 to be string, object given in %s on line %d
-NULL
-
-Warning: openssl_encrypt() expects parameter 2 to be string, object given in %s on line %d
-NULL
-
-Warning: openssl_encrypt() expects parameter 3 to be string, object given in %s on line %d
-NULL
-
-Warning: openssl_encrypt() expects parameter 1 to be string, array given in %s on line %d
-NULL
-
-Warning: openssl_encrypt() expects parameter 2 to be string, array given in %s on line %d
-NULL
-
-Warning: openssl_encrypt() expects parameter 3 to be string, array given in %s on line %d
-NULL
-
Warning: openssl_encrypt(): The authenticated tag cannot be provided for cipher that doesn not support AEAD in %s on line %d
string(44) "iPR4HulskuaP5Z6me5uImk6BqVyJG73+63tkPauVZYk="
diff --git a/ext/openssl/tests/openssl_error_string_basic.phpt b/ext/openssl/tests/openssl_error_string_basic.phpt
index cdf558e9a5..12875392f4 100644
--- a/ext/openssl/tests/openssl_error_string_basic.phpt
+++ b/ext/openssl/tests/openssl_error_string_basic.phpt
@@ -9,15 +9,15 @@ function expect_openssl_errors($name, $expected_error_codes) {
$expected_errors = array_fill_keys($expected_error_codes, false);
$all_errors = array();
while (($error_string = openssl_error_string()) !== false) {
- if (preg_match(",.+:([0-9A-F]+):.+,", $error_string, $m) > 0) {
+ if (preg_match(",.+:([0-9A-F]+):.+,", $error_string, $m) > 0) {
$error_code = $m[1];
if (isset($expected_errors[$error_code])) {
$expected_errors[$error_code] = true;
}
- $all_errors[$error_code] = $error_string;
+ $all_errors[$error_code] = $error_string;
} else {
- $all_errors[] = $error_string;
- }
+ $all_errors[] = $error_string;
+ }
}
$fail = false;
@@ -31,12 +31,12 @@ function expect_openssl_errors($name, $expected_error_codes) {
if (!$fail) {
echo "$name: ok\n";
} else {
- echo "$name: uncaught errors\n";
- foreach ($all_errors as $code => $str) {
- if (!isset($expected_errors[$code]) || !$expected_errors[$code]) {
- echo "\t", $code, ": ", $str, "\n";
- }
- }
+ echo "$name: uncaught errors\n";
+ foreach ($all_errors as $code => $str) {
+ if (!isset($expected_errors[$code]) || !$expected_errors[$code]) {
+ echo "\t", $code, ": ", $str, "\n";
+ }
+ }
}
}
@@ -52,7 +52,7 @@ function dump_openssl_errors($name) {
$output_file = __DIR__ . "/openssl_error_string_basic_output.tmp";
// invalid file for read is something that does not exist in current directory
$invalid_file_for_read = __DIR__ . "/invalid_file_for_read_operation.txt";
-// invalid file for is the test dir as writting file to existing dir should alway fail
+// invalid file for is the test dir as writing file to existing dir should always fail
$invalid_file_for_write = __DIR__;
// crt file
$crt_file = "file://" . __DIR__ . "/cert.crt";
@@ -78,7 +78,7 @@ var_dump($enc_error);
var_dump(openssl_error_string());
// internally OpenSSL ERR won't save more than 15 (16 - 1) errors so lets test it
for ($i = 0; $i < 20; $i++) {
- openssl_encrypt($data, $method, $enc_key);
+ openssl_encrypt($data, $method, $enc_key);
}
$error_queue_size = 0;
while (($enc_error_new = openssl_error_string()) !== false) {
@@ -145,7 +145,7 @@ expect_openssl_errors('openssl_csr_get_subject open', ['02001002', '2006D080']);
@openssl_csr_get_subject($crt_file);
expect_openssl_errors('openssl_csr_get_subjec pem', [$err_pem_no_start_line]);
-// other possible cuases that are difficult to catch:
+// other possible causes that are difficult to catch:
// - ASN1_STRING_to_UTF8 fails in add_assoc_name_entry
// - invalid php_x509_request field (NULL) would cause error with CONF_get_string
diff --git a/ext/openssl/tests/openssl_open_basic.phpt b/ext/openssl/tests/openssl_open_basic.phpt
index d564bcf8e8..fc41022818 100644
--- a/ext/openssl/tests/openssl_open_basic.phpt
+++ b/ext/openssl/tests/openssl_open_basic.phpt
@@ -22,7 +22,7 @@ var_dump($output4);
--EXPECTF--
string(19) "openssl_open() test"
-Warning: openssl_open(): unable to coerce parameter 4 into a private key in %s on line %d
+Warning: openssl_open(): Unable to coerce parameter 4 into a private key in %s on line %d
NULL
string(19) "openssl_open() test"
NULL
diff --git a/ext/openssl/tests/openssl_peer_fingerprint_basic.phpt b/ext/openssl/tests/openssl_peer_fingerprint_basic.phpt
index 89741f29c4..18fbeb0fd6 100644
--- a/ext/openssl/tests/openssl_peer_fingerprint_basic.phpt
+++ b/ext/openssl/tests/openssl_peer_fingerprint_basic.phpt
@@ -74,6 +74,6 @@ Warning: stream_socket_client(): peer_fingerprint match failure in %s on line %d
Warning: stream_socket_client(): Failed to enable crypto in %s on line %d
-Warning: stream_socket_client(): unable to connect to ssl://127.0.0.1:64321 (Unknown error) in %s on line %d
+Warning: stream_socket_client(): Unable to connect to ssl://127.0.0.1:64321 (Unknown error) in %s on line %d
bool(false)
resource(%d) of type (stream)
diff --git a/ext/openssl/tests/openssl_pkcs12_export_basic.phpt b/ext/openssl/tests/openssl_pkcs12_export_basic.phpt
index 08e56d92a5..41d2fbdedd 100644
--- a/ext/openssl/tests/openssl_pkcs12_export_basic.phpt
+++ b/ext/openssl/tests/openssl_pkcs12_export_basic.phpt
@@ -30,7 +30,11 @@ var_dump(count($opts)); // should be 3 certificates, priv, pub, extra optional c
var_dump(openssl_pkcs12_export($invalid, $output, $invalid, $pass));
var_dump(openssl_pkcs12_export($invalid_path, $output, $invalid_path, $pass));
-var_dump(openssl_pkcs12_export($priv_res, $output, $cert_res, $pass));
+try {
+ var_dump(openssl_pkcs12_export($priv_res, $output, $cert_res, $pass));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
//var_dump(openssl_pkcs12_export($cert, $output, $priv, $pass, array("foo")));
?>
--EXPECTF--
@@ -44,13 +48,11 @@ bool(true)
bool(true)
int(3)
-Warning: openssl_pkcs12_export(): cannot get cert from parameter 1 in %s on line %d
+Warning: openssl_pkcs12_export(): Cannot get cert from parameter 1 in %s on line %d
bool(false)
-Warning: openssl_pkcs12_export(): cannot get cert from parameter 1 in %s on line %d
+Warning: openssl_pkcs12_export(): Cannot get cert from parameter 1 in %s on line %d
bool(false)
-Warning: openssl_pkcs12_export(): supplied resource is not a valid OpenSSL X.509 resource in %s on line %d
-
-Warning: openssl_pkcs12_export(): cannot get cert from parameter 1 in %s on line %d
-bool(false)
+Warning: openssl_pkcs12_export(): Cannot get cert from parameter 1 in %s on line %d
+openssl_pkcs12_export(): supplied resource is not a valid OpenSSL X.509 resource
diff --git a/ext/openssl/tests/openssl_pkcs12_export_to_file_basic.phpt b/ext/openssl/tests/openssl_pkcs12_export_to_file_basic.phpt
index ccc9104d34..994a0f85d5 100644
--- a/ext/openssl/tests/openssl_pkcs12_export_to_file_basic.phpt
+++ b/ext/openssl/tests/openssl_pkcs12_export_to_file_basic.phpt
@@ -30,7 +30,11 @@ var_dump(openssl_pkcs12_read(file_get_contents($pkcsfile), $opts, $pass));
var_dump(openssl_pkcs12_export_to_file($invalid, $pkcsfile, $invalid, $pass));
var_dump(openssl_pkcs12_export_to_file($invalid_path, $pkcsfile, $invalid_path, $pass));
-var_dump(openssl_pkcs12_export_to_file($priv_res, $pkcsfile, $cert_res, $pass));
+try {
+ var_dump(openssl_pkcs12_export_to_file($priv_res, $pkcsfile, $cert_res, $pass));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
--CLEAN--
<?php
@@ -49,13 +53,11 @@ bool(true)
bool(true)
bool(true)
-Warning: openssl_pkcs12_export_to_file(): cannot get cert from parameter 1 in %s on line %d
+Warning: openssl_pkcs12_export_to_file(): Cannot get cert from parameter 1 in %s on line %d
bool(false)
-Warning: openssl_pkcs12_export_to_file(): cannot get cert from parameter 1 in %s on line %d
+Warning: openssl_pkcs12_export_to_file(): Cannot get cert from parameter 1 in %s on line %d
bool(false)
-Warning: openssl_pkcs12_export_to_file(): supplied resource is not a valid OpenSSL X.509 resource in %s on line %d
-
-Warning: openssl_pkcs12_export_to_file(): cannot get cert from parameter 1 in %s on line %d
-bool(false)
+Warning: openssl_pkcs12_export_to_file(): Cannot get cert from parameter 1 in %s on line %d
+openssl_pkcs12_export_to_file(): supplied resource is not a valid OpenSSL X.509 resource
diff --git a/ext/openssl/tests/openssl_pkcs12_export_to_file_error.phpt b/ext/openssl/tests/openssl_pkcs12_export_to_file_error.phpt
index 407eb3aacd..92d7f2789e 100644
--- a/ext/openssl/tests/openssl_pkcs12_export_to_file_error.phpt
+++ b/ext/openssl/tests/openssl_pkcs12_export_to_file_error.phpt
@@ -27,11 +27,11 @@ if (file_exists($pkcsfile)) {
}
?>
--EXPECTF--
-Warning: openssl_pkcs12_export_to_file(): cannot get private key from parameter 3 in %s on line %d
+Warning: openssl_pkcs12_export_to_file(): Cannot get private key from parameter 3 in %s on line %d
bool(false)
-Warning: openssl_pkcs12_export_to_file(): private key does not correspond to cert in %s on line %d
+Warning: openssl_pkcs12_export_to_file(): Private key does not correspond to cert in %s on line %d
bool(false)
-Warning: openssl_pkcs12_export_to_file(): error opening file . in %s on line %d
+Warning: openssl_pkcs12_export_to_file(): Error opening file . in %s on line %d
bool(false)
diff --git a/ext/openssl/tests/openssl_pkcs7_decrypt_basic.phpt b/ext/openssl/tests/openssl_pkcs7_decrypt_basic.phpt
index 937180a22e..f96fd401cd 100644
--- a/ext/openssl/tests/openssl_pkcs7_decrypt_basic.phpt
+++ b/ext/openssl/tests/openssl_pkcs7_decrypt_basic.phpt
@@ -45,22 +45,22 @@ if (file_exists($outfile)) {
bool(true)
bool(true)
-Warning: openssl_pkcs7_decrypt(): unable to get private key in %s on line %d
+Warning: openssl_pkcs7_decrypt(): Unable to get private key in %s on line %d
bool(false)
-Warning: openssl_pkcs7_decrypt(): unable to coerce parameter 3 to x509 cert in %s on line %d
+Warning: openssl_pkcs7_decrypt(): Unable to coerce parameter 3 to x509 cert in %s on line %d
bool(false)
-Warning: openssl_pkcs7_decrypt(): unable to coerce parameter 3 to x509 cert in %s on line %d
+Warning: openssl_pkcs7_decrypt(): Unable to coerce parameter 3 to x509 cert in %s on line %d
bool(false)
bool(false)
bool(false)
bool(false)
-Warning: openssl_pkcs7_decrypt(): unable to coerce parameter 3 to x509 cert in %s on line %d
+Warning: openssl_pkcs7_decrypt(): Unable to coerce parameter 3 to x509 cert in %s on line %d
bool(false)
-Warning: openssl_pkcs7_decrypt(): unable to get private key in %s on line %d
+Warning: openssl_pkcs7_decrypt(): Unable to get private key in %s on line %d
bool(false)
true
true
diff --git a/ext/openssl/tests/openssl_pkcs7_decrypt_error.phpt b/ext/openssl/tests/openssl_pkcs7_decrypt_error.phpt
index 63dabe8f32..d7ae715efb 100644
--- a/ext/openssl/tests/openssl_pkcs7_decrypt_error.phpt
+++ b/ext/openssl/tests/openssl_pkcs7_decrypt_error.phpt
@@ -33,12 +33,12 @@ echo "Done\n";
Object of class stdClass could not be converted to string
object(stdClass)#1 (0) {
}
-string(66) "openssl_pkcs7_decrypt(): unable to coerce parameter 3 to x509 cert"
+string(66) "openssl_pkcs7_decrypt(): Unable to coerce parameter 3 to x509 cert"
bool(false)
-string(66) "openssl_pkcs7_decrypt(): unable to coerce parameter 3 to x509 cert"
+string(66) "openssl_pkcs7_decrypt(): Unable to coerce parameter 3 to x509 cert"
bool(false)
-string(66) "openssl_pkcs7_decrypt(): unable to coerce parameter 3 to x509 cert"
+string(66) "openssl_pkcs7_decrypt(): Unable to coerce parameter 3 to x509 cert"
bool(false)
-string(66) "openssl_pkcs7_decrypt(): unable to coerce parameter 3 to x509 cert"
+string(66) "openssl_pkcs7_decrypt(): Unable to coerce parameter 3 to x509 cert"
bool(false)
Done
diff --git a/ext/openssl/tests/openssl_pkcs7_encrypt_basic.phpt b/ext/openssl/tests/openssl_pkcs7_encrypt_basic.phpt
index f823462f9e..ef9b25e70b 100644
--- a/ext/openssl/tests/openssl_pkcs7_encrypt_basic.phpt
+++ b/ext/openssl/tests/openssl_pkcs7_encrypt_basic.phpt
@@ -26,13 +26,11 @@ var_dump(openssl_pkcs7_encrypt($infile, $outfile, openssl_x509_read($single_cert
var_dump(openssl_pkcs7_decrypt($outfile, $outfile2, $single_cert, $privkey));
var_dump(openssl_pkcs7_encrypt($infile, $outfile, $single_cert, $assoc_headers));
var_dump(openssl_pkcs7_encrypt($infile, $outfile, $single_cert, $empty_headers));
-var_dump(openssl_pkcs7_encrypt($infile, $outfile, $single_cert, $wrong));
var_dump(openssl_pkcs7_encrypt($wrong, $outfile, $single_cert, $headers));
var_dump(openssl_pkcs7_encrypt($empty, $outfile, $single_cert, $headers));
var_dump(openssl_pkcs7_encrypt($infile, $empty, $single_cert, $headers));
var_dump(openssl_pkcs7_encrypt($infile, $outfile, $wrong, $headers));
var_dump(openssl_pkcs7_encrypt($infile, $outfile, $empty, $headers));
-var_dump(openssl_pkcs7_encrypt($infile, $outfile, $single_cert, $empty));
var_dump(openssl_pkcs7_encrypt($infile, $outfile, $multi_certs, $headers));
var_dump(openssl_pkcs7_encrypt($infile, $outfile, array_map('openssl_x509_read', $multi_certs) , $headers));
@@ -45,23 +43,17 @@ if (file_exists($outfile2)) {
unlink($outfile2);
}
?>
---EXPECTF--
+--EXPECT--
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
-
-Warning: openssl_pkcs7_encrypt() expects parameter 4 to be array, string given in %s on line %d
-bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
-
-Warning: openssl_pkcs7_encrypt() expects parameter 4 to be array, string given in %s on line %d
-bool(false)
bool(true)
bool(true)
true
diff --git a/ext/openssl/tests/openssl_pkcs7_read_basic.phpt b/ext/openssl/tests/openssl_pkcs7_read_basic.phpt
index ac3f1ad34f..bd82e2d937 100644
--- a/ext/openssl/tests/openssl_pkcs7_read_basic.phpt
+++ b/ext/openssl/tests/openssl_pkcs7_read_basic.phpt
@@ -8,19 +8,12 @@ $infile = file_get_contents(__DIR__ . "/cert.p7b");
$certfile = file_get_contents(__DIR__ . "/cert.crt");
$result = [];
-var_dump(openssl_pkcs7_read());
-var_dump(openssl_pkcs7_read(""));
var_dump(openssl_pkcs7_read("", $result));
var_dump(openssl_pkcs7_read($certfile, $result));
var_dump(openssl_pkcs7_read($infile, $result));
var_dump($result);
?>
---EXPECTF--
-Warning: openssl_pkcs7_read() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: openssl_pkcs7_read() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
+--EXPECT--
bool(false)
bool(false)
bool(true)
diff --git a/ext/openssl/tests/openssl_pkcs7_sign_basic.phpt b/ext/openssl/tests/openssl_pkcs7_sign_basic.phpt
index c11e5135f9..9b9ff91ddd 100644
--- a/ext/openssl/tests/openssl_pkcs7_sign_basic.phpt
+++ b/ext/openssl/tests/openssl_pkcs7_sign_basic.phpt
@@ -22,13 +22,11 @@ var_dump(openssl_pkcs7_sign($infile, $outfile, openssl_x509_read($single_cert),
var_dump(openssl_pkcs7_sign($infile, $outfile, $single_cert, $privkey, $headers));
var_dump(openssl_pkcs7_sign($infile, $outfile, $single_cert, $privkey, $assoc_headers));
var_dump(openssl_pkcs7_sign($infile, $outfile, $single_cert, $privkey, $empty_headers));
-var_dump(openssl_pkcs7_sign($infile, $outfile, $single_cert, $privkey, $wrong));
var_dump(openssl_pkcs7_sign($wrong, $outfile, $single_cert, $privkey, $headers));
var_dump(openssl_pkcs7_sign($empty, $outfile, $single_cert, $privkey, $headers));
var_dump(openssl_pkcs7_sign($infile, $empty, $single_cert, $privkey, $headers));
var_dump(openssl_pkcs7_sign($infile, $outfile, $wrong, $privkey, $headers));
var_dump(openssl_pkcs7_sign($infile, $outfile, $empty, $privkey, $headers));
-var_dump(openssl_pkcs7_sign($infile, $outfile, $single_cert, $privkey, $empty));
var_dump(openssl_pkcs7_sign($infile, $outfile, $single_cert, $wrong, $headers));
if (file_exists($outfile)) {
@@ -42,27 +40,21 @@ bool(true)
bool(true)
bool(true)
-Warning: openssl_pkcs7_sign() expects parameter 5 to be array, string given in %s on line %d
-NULL
-
-Warning: openssl_pkcs7_sign(): error opening input file %s in %s on line %d
+Warning: openssl_pkcs7_sign(): Error opening input file %s in %s on line %d
bool(false)
-Warning: openssl_pkcs7_sign(): error opening input file %s in %s on line %d
+Warning: openssl_pkcs7_sign(): Error opening input file %s in %s on line %d
bool(false)
-Warning: openssl_pkcs7_sign(): error opening output file %s in %s on line %d
+Warning: openssl_pkcs7_sign(): Error opening output file %s in %s on line %d
bool(false)
-Warning: openssl_pkcs7_sign(): error getting cert in %s on line %d
+Warning: openssl_pkcs7_sign(): Error getting cert in %s on line %d
bool(false)
-Warning: openssl_pkcs7_sign(): error getting cert in %s on line %d
+Warning: openssl_pkcs7_sign(): Error getting cert in %s on line %d
bool(false)
-Warning: openssl_pkcs7_sign() expects parameter 5 to be array, string given in %s on line %d
-NULL
-
-Warning: openssl_pkcs7_sign(): error getting private key in %s on line %d
+Warning: openssl_pkcs7_sign(): Error getting private key in %s on line %d
bool(false)
true
diff --git a/ext/openssl/tests/openssl_pkcs7_verify_basic.phpt b/ext/openssl/tests/openssl_pkcs7_verify_basic.phpt
index 699253f789..63b181e588 100644
--- a/ext/openssl/tests/openssl_pkcs7_verify_basic.phpt
+++ b/ext/openssl/tests/openssl_pkcs7_verify_basic.phpt
@@ -6,12 +6,12 @@ openssl_pkcs7_verify() tests
<?php
$outfile = tempnam(sys_get_temp_dir(), "ssl");
if ($outfile === false) {
- die("failed to get a temporary filename!");
+ die("failed to get a temporary filename!");
}
$contentfile = tempnam(sys_get_temp_dir(), "ssl");
if ($contentfile === false) {
- die("failed to get a temporary filename!");
+ die("failed to get a temporary filename!");
}
$pkcsfile = __DIR__ . "/openssl_pkcs7_verify__pkcsfile.tmp";
@@ -30,13 +30,13 @@ var_dump(openssl_pkcs7_verify($eml, PKCS7_NOVERIFY, $outfile, $cainfo, $outfile,
var_dump(file_get_contents($pkcsfile));
if (file_exists($outfile)) {
- echo "true\n";
- unlink($outfile);
+ echo "true\n";
+ unlink($outfile);
}
if (file_exists($contentfile)) {
- echo "true\n";
- unlink($contentfile);
+ echo "true\n";
+ unlink($contentfile);
}
?>
--CLEAN--
diff --git a/ext/openssl/tests/openssl_pkey_new_basic.phpt b/ext/openssl/tests/openssl_pkey_new_basic.phpt
index 41e67b2a04..b2c37f6a87 100644
--- a/ext/openssl/tests/openssl_pkey_new_basic.phpt
+++ b/ext/openssl/tests/openssl_pkey_new_basic.phpt
@@ -5,7 +5,7 @@ openssl_pkey_new() basic usage tests
--FILE--
<?php
function openssl_pkey_test_cmp($expected, $bin_key) {
- var_dump(strcasecmp(ltrim($expected, '0'), bin2hex($bin_key)));
+ var_dump(strcasecmp(ltrim($expected, '0'), bin2hex($bin_key)));
}
// RSA
diff --git a/ext/openssl/tests/openssl_pkey_new_error.phpt b/ext/openssl/tests/openssl_pkey_new_error.phpt
index c7dc193d53..7fada8239a 100644
--- a/ext/openssl/tests/openssl_pkey_new_error.phpt
+++ b/ext/openssl/tests/openssl_pkey_new_error.phpt
@@ -5,19 +5,29 @@ openssl_pkey_new() error tests
--FILE--
<?php
/* openssl_pkey_get_details() segfaults when getting the information
- from openssl_pkey_new() with an empty sub-array arg */
+ from openssl_pkey_new() with an empty sub-array arg */
$rsa = array("rsa" => array());
$dsa = array("dsa" => array());
$dh = array("dh" => array());
-openssl_pkey_get_details(openssl_pkey_new($rsa));
-openssl_pkey_get_details(openssl_pkey_new($dsa));
-openssl_pkey_get_details(openssl_pkey_new($dh));
+try {
+ openssl_pkey_get_details(openssl_pkey_new($rsa));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ openssl_pkey_get_details(openssl_pkey_new($dsa));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ openssl_pkey_get_details(openssl_pkey_new($dh));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Warning: openssl_pkey_get_details() expects parameter 1 to be resource, bool given in %s on line %d
-
-Warning: openssl_pkey_get_details() expects parameter 1 to be resource, bool given in %s on line %d
-
-Warning: openssl_pkey_get_details() expects parameter 1 to be resource, bool given in %s on line %d
+--EXPECT--
+openssl_pkey_get_details() expects parameter 1 to be resource, bool given
+openssl_pkey_get_details() expects parameter 1 to be resource, bool given
+openssl_pkey_get_details() expects parameter 1 to be resource, bool given
diff --git a/ext/openssl/tests/openssl_private_decrypt_basic.phpt b/ext/openssl/tests/openssl_private_decrypt_basic.phpt
index c318fe89b1..6c1401a99a 100644
--- a/ext/openssl/tests/openssl_private_decrypt_basic.phpt
+++ b/ext/openssl/tests/openssl_private_decrypt_basic.phpt
@@ -31,7 +31,7 @@ NULL
bool(false)
NULL
-Warning: openssl_private_decrypt(): key array must be of the form array(0 => key, 1 => phrase) in %s on line %d
+Warning: openssl_private_decrypt(): Key array must be of the form array(0 => key, 1 => phrase) in %s on line %d
Warning: openssl_private_decrypt(): key parameter is not a valid private key in %s on line %d
bool(false)
diff --git a/ext/openssl/tests/openssl_public_decrypt_basic.phpt b/ext/openssl/tests/openssl_public_decrypt_basic.phpt
index 6c6fdc90f8..f6cd0aa5f0 100644
--- a/ext/openssl/tests/openssl_public_decrypt_basic.phpt
+++ b/ext/openssl/tests/openssl_public_decrypt_basic.phpt
@@ -33,13 +33,13 @@ NULL
bool(false)
NULL
-Warning: openssl_public_decrypt(): key array must be of the form array(0 => key, 1 => phrase) in %s on line %d
+Warning: openssl_public_decrypt(): Key array must be of the form array(0 => key, 1 => phrase) in %s on line %d
Warning: openssl_public_decrypt(): key parameter is not a valid public key in %s on line %d
bool(false)
NULL
-Warning: openssl_public_decrypt(): key array must be of the form array(0 => key, 1 => phrase) in %s on line %d
+Warning: openssl_public_decrypt(): Key array must be of the form array(0 => key, 1 => phrase) in %s on line %d
Warning: openssl_public_decrypt(): key parameter is not a valid public key in %s on line %d
bool(false)
diff --git a/ext/openssl/tests/openssl_seal_basic.phpt b/ext/openssl/tests/openssl_seal_basic.phpt
index 111bf6f094..0914ab6df2 100644
--- a/ext/openssl/tests/openssl_seal_basic.phpt
+++ b/ext/openssl/tests/openssl_seal_basic.phpt
@@ -12,8 +12,6 @@ $d = array(1);
var_dump(openssl_seal($a, $b, $c, $d));
var_dump(openssl_seal($a, $a, $a, array()));
-var_dump(openssl_seal($c, $c, $c, 1));
-var_dump(openssl_seal($b, $b, $b, ""));
// tests with cert
$data = "openssl_open() test";
@@ -23,36 +21,26 @@ $wrong = "wrong";
var_dump(openssl_seal($data, $sealed, $ekeys, array($pub_key))); // no output
var_dump(openssl_seal($data, $sealed, $ekeys, array($pub_key, $pub_key))); // no output
var_dump(openssl_seal($data, $sealed, $ekeys, array($pub_key, $wrong)));
-var_dump(openssl_seal($data, $sealed, $ekeys, $pub_key));
var_dump(openssl_seal($data, $sealed, $ekeys, array()));
var_dump(openssl_seal($data, $sealed, $ekeys, array($wrong)));
echo "Done\n";
?>
--EXPECTF--
-Warning: openssl_seal(): not a public key (1th member of pubkeys) in %s on line %d
+Warning: openssl_seal(): Not a public key (1th member of pubkeys) in %s on line %d
bool(false)
Warning: openssl_seal(): Fourth argument to openssl_seal() must be a non-empty array in %s on line %d
bool(false)
-
-Warning: openssl_seal() expects parameter 1 to be string, array given in %s on line %d
-NULL
-
-Warning: openssl_seal() expects parameter 1 to be string, array given in %s on line %d
-NULL
int(19)
int(19)
-Warning: openssl_seal(): not a public key (2th member of pubkeys) in %s on line %d
+Warning: openssl_seal(): Not a public key (2th member of pubkeys) in %s on line %d
bool(false)
-Warning: openssl_seal() expects parameter 4 to be array, string given in %s on line %d
-NULL
-
Warning: openssl_seal(): Fourth argument to openssl_seal() must be a non-empty array in %s on line %d
bool(false)
-Warning: openssl_seal(): not a public key (1th member of pubkeys) in %s on line %d
+Warning: openssl_seal(): Not a public key (1th member of pubkeys) in %s on line %d
bool(false)
Done
diff --git a/ext/openssl/tests/openssl_sign_basic.phpt b/ext/openssl/tests/openssl_sign_basic.phpt
index bb2c403903..bbccda64a4 100644
--- a/ext/openssl/tests/openssl_sign_basic.phpt
+++ b/ext/openssl/tests/openssl_sign_basic.phpt
@@ -10,13 +10,9 @@ $wrong = "wrong";
var_dump(openssl_sign($data, $sign, $privkey)); // no output
var_dump(openssl_sign($data, $sign, $wrong));
-var_dump(openssl_sign(array(), $sign, $privkey));
?>
--EXPECTF--
bool(true)
-Warning: openssl_sign(): supplied key param cannot be coerced into a private key in %s on line %d
+Warning: openssl_sign(): Supplied key param cannot be coerced into a private key in %s on line %d
bool(false)
-
-Warning: openssl_sign() expects parameter 1 to be string, array given in %s on line %d
-NULL
diff --git a/ext/openssl/tests/openssl_verify_basic.phpt b/ext/openssl/tests/openssl_verify_basic.phpt
index 84d69502bf..99ec78129d 100644
--- a/ext/openssl/tests/openssl_verify_basic.phpt
+++ b/ext/openssl/tests/openssl_verify_basic.phpt
@@ -19,10 +19,10 @@ var_dump(openssl_verify($wrong, $sign, $pubkey));
--EXPECTF--
int(1)
-Warning: openssl_verify(): supplied key param cannot be coerced into a public key in %s on line %d
+Warning: openssl_verify(): Supplied key param cannot be coerced into a public key in %s on line %d
bool(false)
-Warning: openssl_verify(): supplied key param cannot be coerced into a public key in %s on line %d
+Warning: openssl_verify(): Supplied key param cannot be coerced into a public key in %s on line %d
bool(false)
int(0)
int(0)
diff --git a/ext/openssl/tests/openssl_x509_export_basic.phpt b/ext/openssl/tests/openssl_x509_export_basic.phpt
index aecf569489..03baae9266 100644
--- a/ext/openssl/tests/openssl_x509_export_basic.phpt
+++ b/ext/openssl/tests/openssl_x509_export_basic.phpt
@@ -32,11 +32,11 @@ var_dump(strcmp($output, $output5)); // different
bool(true)
bool(true)
-Warning: openssl_x509_export(): cannot get cert from parameter 1 in %s on line %d
+Warning: openssl_x509_export(): Cannot get cert from parameter 1 in %s on line %d
bool(false)
bool(true)
-Warning: openssl_x509_export(): cannot get cert from parameter 1 in %s on line %d
+Warning: openssl_x509_export(): Cannot get cert from parameter 1 in %s on line %d
bool(false)
int(0)
int(0)
diff --git a/ext/openssl/tests/openssl_x509_export_to_file_basic.phpt b/ext/openssl/tests/openssl_x509_export_to_file_basic.phpt
index 7fb6c02168..45037449a9 100644
--- a/ext/openssl/tests/openssl_x509_export_to_file_basic.phpt
+++ b/ext/openssl/tests/openssl_x509_export_to_file_basic.phpt
@@ -32,11 +32,11 @@ if (file_exists($outfilename)) {
bool(true)
bool(true)
-Warning: openssl_x509_export_to_file(): cannot get cert from parameter 1 in %s on line %d
+Warning: openssl_x509_export_to_file(): Cannot get cert from parameter 1 in %s on line %d
bool(false)
bool(true)
-Warning: openssl_x509_export_to_file(): cannot get cert from parameter 1 in %s on line %d
+Warning: openssl_x509_export_to_file(): Cannot get cert from parameter 1 in %s on line %d
bool(false)
---
bool(true)
diff --git a/ext/openssl/tests/openssl_x509_fingerprint_basic.phpt b/ext/openssl/tests/openssl_x509_fingerprint_basic.phpt
index bc6715f375..14f8c0c1ce 100644
--- a/ext/openssl/tests/openssl_x509_fingerprint_basic.phpt
+++ b/ext/openssl/tests/openssl_x509_fingerprint_basic.phpt
@@ -7,9 +7,6 @@ openssl_x509_fingerprint() tests
$cert = "file://" . __DIR__ . "/cert.crt";
-echo "** Testing with no parameters **\n";
-var_dump(openssl_x509_fingerprint());
-
echo "** Testing default functionality **\n";
var_dump(openssl_x509_fingerprint($cert));
@@ -29,10 +26,6 @@ echo "** Testing bad hash method **\n";
var_dump(openssl_x509_fingerprint($cert, 'xx45'));
?>
--EXPECTF--
-** Testing with no parameters **
-
-Warning: openssl_x509_fingerprint() expects at least 1 parameter, 0 given in %s on line %d
-NULL
** Testing default functionality **
string(40) "6e6fd1ea10a5a23071d61c728ee9b40df6dbc33c"
** Testing hash method md5 **
@@ -43,7 +36,7 @@ string(32) "ac77008e172897e06c0b065294487a67"
string(40) "6e6fd1ea10a5a23071d61c728ee9b40df6dbc33c"
** Testing bad certification **
-Warning: openssl_x509_fingerprint(): cannot get cert from parameter 1 in %s on line %d
+Warning: openssl_x509_fingerprint(): Cannot get cert from parameter 1 in %s on line %d
bool(false)
** Testing bad hash method **
diff --git a/ext/openssl/tests/openssl_x509_free_basic.phpt b/ext/openssl/tests/openssl_x509_free_basic.phpt
index 378b0e5e0a..6fc28f1e75 100644
--- a/ext/openssl/tests/openssl_x509_free_basic.phpt
+++ b/ext/openssl/tests/openssl_x509_free_basic.phpt
@@ -7,10 +7,7 @@ openssl_x509_free() tests
var_dump($res = openssl_x509_read("file://" . __DIR__ . "/cert.crt"));
openssl_x509_free($res);
var_dump($res);
-openssl_x509_free(false);
?>
--EXPECTF--
resource(%d) of type (OpenSSL X.509)
resource(%d) of type (Unknown)
-
-Warning: openssl_x509_free() expects parameter 1 to be resource, bool given in %s on line %d
diff --git a/ext/openssl/tests/openssl_x509_read_basic.phpt b/ext/openssl/tests/openssl_x509_read_basic.phpt
index f7579c7e81..d3aeadd29b 100644
--- a/ext/openssl/tests/openssl_x509_read_basic.phpt
+++ b/ext/openssl/tests/openssl_x509_read_basic.phpt
@@ -25,12 +25,12 @@ var_dump(openssl_x509_read($f)); // read an array with the filename
resource(%d) of type (OpenSSL X.509)
resource(%d) of type (OpenSSL X.509)
-Warning: openssl_x509_read(): supplied parameter cannot be coerced into an X509 certificate! in %s on line %d
+Warning: openssl_x509_read(): Supplied parameter cannot be coerced into an X509 certificate! in %s on line %d
bool(false)
resource(%d) of type (OpenSSL X.509)
-Warning: openssl_x509_read(): supplied parameter cannot be coerced into an X509 certificate! in %s on line %d
+Warning: openssl_x509_read(): Supplied parameter cannot be coerced into an X509 certificate! in %s on line %d
bool(false)
-Warning: openssl_x509_read(): supplied parameter cannot be coerced into an X509 certificate! in %s on line %d
+Warning: openssl_x509_read(): Supplied parameter cannot be coerced into an X509 certificate! in %s on line %d
bool(false)
diff --git a/ext/openssl/tests/san_peer_matching.phpt b/ext/openssl/tests/san_peer_matching.phpt
index 87410dd16d..f981141f83 100644
--- a/ext/openssl/tests/san_peer_matching.phpt
+++ b/ext/openssl/tests/san_peer_matching.phpt
@@ -48,5 +48,5 @@ Warning: stream_socket_client(): Unable to locate peer certificate CN in %s on l
Warning: stream_socket_client(): Failed to enable crypto in %s on line %d
-Warning: stream_socket_client(): unable to connect to ssl://127.0.0.1:64321 (Unknown error) in %s on line %d
+Warning: stream_socket_client(): Unable to connect to ssl://127.0.0.1:64321 (Unknown error) in %s on line %d
bool(false)
diff --git a/ext/openssl/tests/sni_server_key_cert.phpt b/ext/openssl/tests/sni_server_key_cert.phpt
index 58cf3d741d..77a9d39f44 100644
--- a/ext/openssl/tests/sni_server_key_cert.phpt
+++ b/ext/openssl/tests/sni_server_key_cert.phpt
@@ -8,31 +8,31 @@ if (!function_exists("proc_open")) die("skip no proc_open");
--FILE--
<?php
$serverCode = <<<'CODE'
- $flags = STREAM_SERVER_BIND|STREAM_SERVER_LISTEN;
- $ctx = stream_context_create(['ssl' => [
- 'local_cert' => __DIR__ . '/domain1.pem',
- 'SNI_server_certs' => [
- "cs.php.net" => [
- 'local_cert' => __DIR__ . "/sni_server_cs_cert.pem",
- 'local_pk' => __DIR__ . "/sni_server_cs_key.pem"
- ],
- "uk.php.net" => [
- 'local_cert' => __DIR__ . "/sni_server_uk_cert.pem",
- 'local_pk' => __DIR__ . "/sni_server_uk_key.pem"
- ],
- "us.php.net" => [
- 'local_cert' => __DIR__ . "/sni_server_us_cert.pem",
- 'local_pk' => __DIR__ . "/sni_server_us_key.pem"
- ],
- ]
- ]]);
+ $flags = STREAM_SERVER_BIND|STREAM_SERVER_LISTEN;
+ $ctx = stream_context_create(['ssl' => [
+ 'local_cert' => __DIR__ . '/domain1.pem',
+ 'SNI_server_certs' => [
+ "cs.php.net" => [
+ 'local_cert' => __DIR__ . "/sni_server_cs_cert.pem",
+ 'local_pk' => __DIR__ . "/sni_server_cs_key.pem"
+ ],
+ "uk.php.net" => [
+ 'local_cert' => __DIR__ . "/sni_server_uk_cert.pem",
+ 'local_pk' => __DIR__ . "/sni_server_uk_key.pem"
+ ],
+ "us.php.net" => [
+ 'local_cert' => __DIR__ . "/sni_server_us_cert.pem",
+ 'local_pk' => __DIR__ . "/sni_server_us_key.pem"
+ ],
+ ]
+ ]]);
- $server = stream_socket_server('tls://127.0.0.1:64321', $errno, $errstr, $flags, $ctx);
- phpt_notify();
+ $server = stream_socket_server('tls://127.0.0.1:64321', $errno, $errstr, $flags, $ctx);
+ phpt_notify();
- for ($i=0; $i < 3; $i++) {
- @stream_socket_accept($server, 3);
- }
+ for ($i=0; $i < 3; $i++) {
+ @stream_socket_accept($server, 3);
+ }
CODE;
$clientCode = <<<'CODE'
diff --git a/ext/openssl/tests/stream_security_level.phpt b/ext/openssl/tests/stream_security_level.phpt
index 8a8131542d..ebb21c5d1a 100644
--- a/ext/openssl/tests/stream_security_level.phpt
+++ b/ext/openssl/tests/stream_security_level.phpt
@@ -18,33 +18,33 @@ $certFile = __DIR__ . DIRECTORY_SEPARATOR . 'stream_security_level.pem.tmp';
$cacertFile = __DIR__ . DIRECTORY_SEPARATOR . 'stream_security_level-ca.pem.tmp';
$serverCode = <<<'CODE'
- $serverUri = "ssl://127.0.0.1:64322";
- $serverFlags = STREAM_SERVER_BIND | STREAM_SERVER_LISTEN;
- $serverCtx = stream_context_create(['ssl' => [
- 'local_cert' => '%s'
- ]]);
+ $serverUri = "ssl://127.0.0.1:64322";
+ $serverFlags = STREAM_SERVER_BIND | STREAM_SERVER_LISTEN;
+ $serverCtx = stream_context_create(['ssl' => [
+ 'local_cert' => '%s'
+ ]]);
- $server = stream_socket_server($serverUri, $errno, $errstr, $serverFlags, $serverCtx);
- phpt_notify();
+ $server = stream_socket_server($serverUri, $errno, $errstr, $serverFlags, $serverCtx);
+ phpt_notify();
- @stream_socket_accept($server, 1);
+ @stream_socket_accept($server, 1);
CODE;
$serverCode = sprintf($serverCode, $certFile);
$clientCode = <<<'CODE'
- $serverUri = "ssl://127.0.0.1:64322";
- $clientFlags = STREAM_CLIENT_CONNECT;
- $clientCtx = stream_context_create(['ssl' => [
- 'security_level' => %d,
- 'verify_peer' => true,
- 'cafile' => '%s',
- 'verify_peer_name' => false
- ]]);
+ $serverUri = "ssl://127.0.0.1:64322";
+ $clientFlags = STREAM_CLIENT_CONNECT;
+ $clientCtx = stream_context_create(['ssl' => [
+ 'security_level' => %d,
+ 'verify_peer' => true,
+ 'cafile' => '%s',
+ 'verify_peer_name' => false
+ ]]);
- phpt_wait();
- $client = stream_socket_client($serverUri, $errno, $errstr, 1, $clientFlags, $clientCtx);
+ phpt_wait();
+ $client = stream_socket_client($serverUri, $errno, $errstr, 1, $clientFlags, $clientCtx);
- var_dump($client);
+ var_dump($client);
CODE;
$clientCode = sprintf($clientCode, $securityLevel, $cacertFile);
@@ -67,5 +67,5 @@ error:1416F086:SSL routines:tls_process_server_certificate:certificate verify fa
Warning: stream_socket_client(): Failed to enable crypto in %s : eval()'d code on line %d
-Warning: stream_socket_client(): unable to connect to ssl://127.0.0.1:64322 (Unknown error) in %s : eval()'d code on line %d
+Warning: stream_socket_client(): Unable to connect to ssl://127.0.0.1:64322 (Unknown error) in %s : eval()'d code on line %d
bool(false)
diff --git a/ext/openssl/tests/stream_verify_peer_name_003.phpt b/ext/openssl/tests/stream_verify_peer_name_003.phpt
index 1770c357bd..a87b161b6a 100644
--- a/ext/openssl/tests/stream_verify_peer_name_003.phpt
+++ b/ext/openssl/tests/stream_verify_peer_name_003.phpt
@@ -58,5 +58,5 @@ Warning: stream_socket_client(): Peer certificate CN=`stream_verify_peer_name_00
Warning: stream_socket_client(): Failed to enable crypto in %s on line %d
-Warning: stream_socket_client(): unable to connect to ssl://127.0.0.1:64321 (Unknown error) in %s on line %d
+Warning: stream_socket_client(): Unable to connect to ssl://127.0.0.1:64321 (Unknown error) in %s on line %d
bool(false)
diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c
index 635bcbf330..da175dcfb9 100644
--- a/ext/openssl/xp_ssl.c
+++ b/ext/openssl/xp_ssl.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -1264,7 +1262,7 @@ static int php_openssl_set_server_dh_param(php_stream * stream, SSL_CTX *ctx) /*
bio = BIO_new_file(Z_STRVAL_P(zdhpath), PHP_OPENSSL_BIO_MODE_R(PKCS7_BINARY));
if (bio == NULL) {
- php_error_docref(NULL, E_WARNING, "invalid dh_param");
+ php_error_docref(NULL, E_WARNING, "Invalid dh_param");
return FAILURE;
}
@@ -1272,12 +1270,12 @@ static int php_openssl_set_server_dh_param(php_stream * stream, SSL_CTX *ctx) /*
BIO_free(bio);
if (dh == NULL) {
- php_error_docref(NULL, E_WARNING, "failed reading DH params");
+ php_error_docref(NULL, E_WARNING, "Failed reading DH params");
return FAILURE;
}
if (SSL_CTX_set_tmp_dh(ctx, dh) < 0) {
- php_error_docref(NULL, E_WARNING, "failed assigning DH params");
+ php_error_docref(NULL, E_WARNING, "Failed assigning DH params");
DH_free(dh);
return FAILURE;
}
@@ -1310,14 +1308,14 @@ static int php_openssl_set_server_ecdh_curve(php_stream *stream, SSL_CTX *ctx) /
curve_nid = OBJ_sn2nid(Z_STRVAL_P(zvcurve));
if (curve_nid == NID_undef) {
- php_error_docref(NULL, E_WARNING, "invalid ecdh_curve specified");
+ php_error_docref(NULL, E_WARNING, "Invalid ecdh_curve specified");
return FAILURE;
}
}
ecdh = EC_KEY_new_by_curve_name(curve_nid);
if (ecdh == NULL) {
- php_error_docref(NULL, E_WARNING, "failed generating ECDH curve");
+ php_error_docref(NULL, E_WARNING, "Failed generating ECDH curve");
return FAILURE;
}
@@ -1405,7 +1403,7 @@ static SSL_CTX *php_openssl_create_sni_server_ctx(char *cert_path, char *key_pat
if (SSL_CTX_use_certificate_chain_file(ctx, cert_path) != 1) {
php_error_docref(NULL, E_WARNING,
- "failed setting local cert chain file `%s'; " \
+ "Failed setting local cert chain file `%s'; " \
"check that your cafile/capath settings include " \
"details of your certificate and its issuer",
cert_path
@@ -1414,7 +1412,7 @@ static SSL_CTX *php_openssl_create_sni_server_ctx(char *cert_path, char *key_pat
return NULL;
} else if (SSL_CTX_use_PrivateKey_file(ctx, key_path, SSL_FILETYPE_PEM) != 1) {
php_error_docref(NULL, E_WARNING,
- "failed setting private key from file `%s'",
+ "Failed setting private key from file `%s'",
key_path
);
SSL_CTX_free(ctx);
@@ -1494,7 +1492,7 @@ static int php_openssl_enable_server_sni(php_stream *stream, php_openssl_netstre
}
if (!VCWD_REALPATH(ZSTR_VAL(local_cert_str), resolved_cert_path_buff)) {
php_error_docref(NULL, E_WARNING,
- "failed setting local cert chain file `%s'; file not found",
+ "Failed setting local cert chain file `%s'; file not found",
ZSTR_VAL(local_cert_str)
);
zend_string_release(local_cert_str);
@@ -1516,7 +1514,7 @@ static int php_openssl_enable_server_sni(php_stream *stream, php_openssl_netstre
}
if (!VCWD_REALPATH(ZSTR_VAL(local_pk_str), resolved_pk_path_buff)) {
php_error_docref(NULL, E_WARNING,
- "failed setting local private key file `%s'; file not found",
+ "Failed setting local private key file `%s'; file not found",
ZSTR_VAL(local_pk_str)
);
zend_string_release(local_pk_str);
@@ -1530,7 +1528,7 @@ static int php_openssl_enable_server_sni(php_stream *stream, php_openssl_netstre
ctx = php_openssl_create_sni_server_ctx(resolved_path_buff, resolved_path_buff);
} else {
php_error_docref(NULL, E_WARNING,
- "failed setting local cert chain file `%s'; file not found",
+ "Failed setting local cert chain file `%s'; file not found",
Z_STRVAL_P(current)
);
return FAILURE;
@@ -1810,9 +1808,9 @@ int php_openssl_setup_crypto(php_stream *stream,
if (cparam->inputs.session) {
if (cparam->inputs.session->ops != &php_openssl_socket_ops) {
- php_error_docref(NULL, E_WARNING, "supplied session stream must be an SSL enabled stream");
+ php_error_docref(NULL, E_WARNING, "Supplied session stream must be an SSL enabled stream");
} else if (((php_openssl_netstream_data_t*)cparam->inputs.session->abstract)->ssl_handle == NULL) {
- php_error_docref(NULL, E_WARNING, "supplied SSL session stream is not initialized");
+ php_error_docref(NULL, E_WARNING, "Supplied SSL session stream is not initialized");
} else {
SSL_copy_session_id(sslsock->ssl_handle, ((php_openssl_netstream_data_t*)cparam->inputs.session->abstract)->ssl_handle);
}
diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c
index 1bb67af6c5..0cf698c9a8 100644
--- a/ext/pcntl/pcntl.c
+++ b/ext/pcntl/pcntl.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -33,6 +31,7 @@
#include "php_ini.h"
#include "ext/standard/info.h"
#include "php_pcntl.h"
+#include "pcntl_arginfo.h"
#include "php_signal.h"
#include "php_ticks.h"
@@ -58,132 +57,13 @@
ZEND_DECLARE_MODULE_GLOBALS(pcntl)
static PHP_GINIT_FUNCTION(pcntl);
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO(arginfo_pcntl_void, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_waitpid, 0, 0, 2)
- ZEND_ARG_INFO(0, pid)
- ZEND_ARG_INFO(1, status)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(1, rusage)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_wait, 0, 0, 1)
- ZEND_ARG_INFO(1, status)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(1, rusage)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_signal, 0, 0, 2)
- ZEND_ARG_INFO(0, signo)
- ZEND_ARG_INFO(0, handler)
- ZEND_ARG_INFO(0, restart_syscalls)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_signal_get_handler, 0, 0, 1)
- ZEND_ARG_INFO(0, signo)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_sigprocmask, 0, 0, 2)
- ZEND_ARG_INFO(0, how)
- ZEND_ARG_INFO(0, set)
- ZEND_ARG_INFO(1, oldset)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_STRUCT_SIGINFO_T
-# if HAVE_SIGWAITINFO && HAVE_SIGTIMEDWAIT
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_sigwaitinfo, 0, 0, 1)
- ZEND_ARG_INFO(0, set)
- ZEND_ARG_INFO(1, info)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_sigtimedwait, 0, 0, 1)
- ZEND_ARG_INFO(0, set)
- ZEND_ARG_INFO(1, info)
- ZEND_ARG_INFO(0, seconds)
- ZEND_ARG_INFO(0, nanoseconds)
-ZEND_END_ARG_INFO()
-# endif
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_wifexited, 0, 0, 1)
- ZEND_ARG_INFO(0, status)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_wifstopped, 0, 0, 1)
- ZEND_ARG_INFO(0, status)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_WCONTINUED
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_wifcontinued, 0, 0, 1)
- ZEND_ARG_INFO(0, status)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_wifsignaled, 0, 0, 1)
- ZEND_ARG_INFO(0, status)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_wifexitstatus, 0, 0, 1)
- ZEND_ARG_INFO(0, status)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_wtermsig, 0, 0, 1)
- ZEND_ARG_INFO(0, status)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_wstopsig, 0, 0, 1)
- ZEND_ARG_INFO(0, status)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_exec, 0, 0, 1)
- ZEND_ARG_INFO(0, path)
- ZEND_ARG_INFO(0, args)
- ZEND_ARG_INFO(0, envs)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_alarm, 0, 0, 1)
- ZEND_ARG_INFO(0, seconds)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_GETPRIORITY
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_getpriority, 0, 0, 0)
- ZEND_ARG_INFO(0, pid)
- ZEND_ARG_INFO(0, process_identifier)
-ZEND_END_ARG_INFO()
-#endif
-
-#ifdef HAVE_SETPRIORITY
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_setpriority, 0, 0, 1)
- ZEND_ARG_INFO(0, priority)
- ZEND_ARG_INFO(0, pid)
- ZEND_ARG_INFO(0, process_identifier)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_strerror, 0, 0, 1)
- ZEND_ARG_INFO(0, errno)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_async_signals, 0, 0, 1)
- ZEND_ARG_INFO(0, on)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_UNSHARE
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_unshare, 0, 0, 1)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-#endif
-/* }}} */
-
static const zend_function_entry pcntl_functions[] = {
- PHP_FE(pcntl_fork, arginfo_pcntl_void)
+ PHP_FE(pcntl_fork, arginfo_pcntl_fork)
PHP_FE(pcntl_waitpid, arginfo_pcntl_waitpid)
PHP_FE(pcntl_wait, arginfo_pcntl_wait)
PHP_FE(pcntl_signal, arginfo_pcntl_signal)
PHP_FE(pcntl_signal_get_handler, arginfo_pcntl_signal_get_handler)
- PHP_FE(pcntl_signal_dispatch, arginfo_pcntl_void)
+ PHP_FE(pcntl_signal_dispatch, arginfo_pcntl_signal_dispatch)
PHP_FE(pcntl_wifexited, arginfo_pcntl_wifexited)
PHP_FE(pcntl_wifstopped, arginfo_pcntl_wifstopped)
PHP_FE(pcntl_wifsignaled, arginfo_pcntl_wifsignaled)
@@ -192,8 +72,8 @@ static const zend_function_entry pcntl_functions[] = {
PHP_FE(pcntl_wstopsig, arginfo_pcntl_wstopsig)
PHP_FE(pcntl_exec, arginfo_pcntl_exec)
PHP_FE(pcntl_alarm, arginfo_pcntl_alarm)
- PHP_FE(pcntl_get_last_error, arginfo_pcntl_void)
- PHP_FALIAS(pcntl_errno, pcntl_get_last_error, NULL)
+ PHP_FE(pcntl_get_last_error, arginfo_pcntl_get_last_error)
+ PHP_FALIAS(pcntl_errno, pcntl_get_last_error, arginfo_pcntl_get_last_error)
PHP_FE(pcntl_strerror, arginfo_pcntl_strerror)
#ifdef HAVE_GETPRIORITY
PHP_FE(pcntl_getpriority, arginfo_pcntl_getpriority)
@@ -642,6 +522,10 @@ PHP_FUNCTION(pcntl_fork)
{
pid_t id;
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
id = fork();
if (id == -1) {
PCNTL_G(last_error) = errno;
@@ -658,10 +542,11 @@ PHP_FUNCTION(pcntl_alarm)
{
zend_long seconds;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &seconds) == FAILURE)
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &seconds) == FAILURE) {
+ RETURN_THROWS();
+ }
- RETURN_LONG ((zend_long) alarm(seconds));
+ RETURN_LONG((zend_long) alarm(seconds));
}
/* }}} */
@@ -711,7 +596,7 @@ PHP_FUNCTION(pcntl_waitpid)
#endif
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lz|lz", &pid, &z_status, &options, &z_rusage) == FAILURE) {
- return;
+ RETURN_THROWS();
}
status = zval_get_long(z_status);
@@ -720,7 +605,7 @@ PHP_FUNCTION(pcntl_waitpid)
if (z_rusage) {
z_rusage = zend_try_array_init(z_rusage);
if (!z_rusage) {
- return;
+ RETURN_THROWS();
}
memset(&rusage, 0, sizeof(struct rusage));
@@ -761,7 +646,7 @@ PHP_FUNCTION(pcntl_wait)
#endif
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|lz", &z_status, &options, &z_rusage) == FAILURE) {
- return;
+ RETURN_THROWS();
}
status = zval_get_long(z_status);
@@ -769,7 +654,7 @@ PHP_FUNCTION(pcntl_wait)
if (z_rusage) {
z_rusage = zend_try_array_init(z_rusage);
if (!z_rusage) {
- return;
+ RETURN_THROWS();
}
memset(&rusage, 0, sizeof(struct rusage));
@@ -807,17 +692,17 @@ PHP_FUNCTION(pcntl_wait)
Returns true if the child status code represents a successful exit */
PHP_FUNCTION(pcntl_wifexited)
{
-#ifdef WIFEXITED
zend_long status_word;
- int int_status_word;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &status_word) == FAILURE) {
- return;
+ RETURN_THROWS();
}
- int_status_word = (int) status_word;
- if (WIFEXITED(int_status_word))
+#ifdef WIFEXITED
+ int int_status_word = (int) status_word;
+ if (WIFEXITED(int_status_word)) {
RETURN_TRUE;
+ }
#endif
RETURN_FALSE;
@@ -828,18 +713,19 @@ PHP_FUNCTION(pcntl_wifexited)
Returns true if the child status code represents a stopped process (WUNTRACED must have been used with waitpid) */
PHP_FUNCTION(pcntl_wifstopped)
{
-#ifdef WIFSTOPPED
zend_long status_word;
- int int_status_word;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &status_word) == FAILURE) {
- return;
+ RETURN_THROWS();
}
- int_status_word = (int) status_word;
- if (WIFSTOPPED(int_status_word))
+#ifdef WIFSTOPPED
+ int int_status_word = (int) status_word;
+ if (WIFSTOPPED(int_status_word)) {
RETURN_TRUE;
+ }
#endif
+
RETURN_FALSE;
}
/* }}} */
@@ -848,18 +734,19 @@ PHP_FUNCTION(pcntl_wifstopped)
Returns true if the child status code represents a process that was terminated due to a signal */
PHP_FUNCTION(pcntl_wifsignaled)
{
-#ifdef WIFSIGNALED
zend_long status_word;
- int int_status_word;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &status_word) == FAILURE) {
- return;
+ RETURN_THROWS();
}
- int_status_word = (int) status_word;
- if (WIFSIGNALED(int_status_word))
+#ifdef WIFSIGNALED
+ int int_status_word = (int) status_word;
+ if (WIFSIGNALED(int_status_word)) {
RETURN_TRUE;
+ }
#endif
+
RETURN_FALSE;
}
/* }}} */
@@ -867,17 +754,17 @@ PHP_FUNCTION(pcntl_wifsignaled)
Returns true if the child status code represents a process that was resumed due to a SIGCONT signal */
PHP_FUNCTION(pcntl_wifcontinued)
{
-#ifdef HAVE_WCONTINUED
zend_long status_word;
- int int_status_word;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &status_word) == FAILURE) {
- return;
+ RETURN_THROWS();
}
- int_status_word = (int) status_word;
- if (WIFCONTINUED(int_status_word))
+#ifdef HAVE_WCONTINUED
+ int int_status_word = (int) status_word;
+ if (WIFCONTINUED(int_status_word)) {
RETURN_TRUE;
+ }
#endif
RETURN_FALSE;
}
@@ -888,15 +775,14 @@ PHP_FUNCTION(pcntl_wifcontinued)
Returns the status code of a child's exit */
PHP_FUNCTION(pcntl_wexitstatus)
{
-#ifdef WEXITSTATUS
zend_long status_word;
- int int_status_word;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &status_word) == FAILURE) {
- return;
+ RETURN_THROWS();
}
- int_status_word = (int) status_word;
+#ifdef WEXITSTATUS
+ int int_status_word = (int) status_word;
RETURN_LONG(WEXITSTATUS(int_status_word));
#else
RETURN_FALSE;
@@ -908,15 +794,14 @@ PHP_FUNCTION(pcntl_wexitstatus)
Returns the number of the signal that terminated the process who's status code is passed */
PHP_FUNCTION(pcntl_wtermsig)
{
-#ifdef WTERMSIG
zend_long status_word;
- int int_status_word;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &status_word) == FAILURE) {
- return;
+ RETURN_THROWS();
}
- int_status_word = (int) status_word;
+#ifdef WTERMSIG
+ int int_status_word = (int) status_word;
RETURN_LONG(WTERMSIG(int_status_word));
#else
RETURN_FALSE;
@@ -928,15 +813,14 @@ PHP_FUNCTION(pcntl_wtermsig)
Returns the number of the signal that caused the process to stop who's status code is passed */
PHP_FUNCTION(pcntl_wstopsig)
{
-#ifdef WSTOPSIG
zend_long status_word;
- int int_status_word;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &status_word) == FAILURE) {
- return;
+ RETURN_THROWS();
}
- int_status_word = (int) status_word;
+#ifdef WSTOPSIG
+ int int_status_word = (int) status_word;
RETURN_LONG(WSTOPSIG(int_status_word));
#else
RETURN_FALSE;
@@ -962,7 +846,7 @@ PHP_FUNCTION(pcntl_exec)
zend_ulong key_num;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|aa", &path, &path_len, &args, &envs) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (ZEND_NUM_ARGS() > 1) {
@@ -978,7 +862,7 @@ PHP_FUNCTION(pcntl_exec)
if (argi >= argc) break;
if (!try_convert_to_string(element)) {
efree(argv);
- return;
+ RETURN_THROWS();
}
*current_arg = Z_STRVAL_P(element);
@@ -1011,7 +895,7 @@ PHP_FUNCTION(pcntl_exec)
zend_string_release(key);
efree(argv);
efree(envp);
- return;
+ RETURN_THROWS();
}
/* Length of element + equal sign + length of key + null */
@@ -1061,7 +945,7 @@ PHP_FUNCTION(pcntl_signal)
char *error = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lz|b!", &signo, &handle, &restart_syscalls, &restart_syscalls_is_null) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (signo < 1 || signo >= NSIG) {
@@ -1135,7 +1019,7 @@ PHP_FUNCTION(pcntl_signal_get_handler)
zend_long signo;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &signo) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (signo < 1 || signo > 32) {
@@ -1144,7 +1028,7 @@ PHP_FUNCTION(pcntl_signal_get_handler)
}
if ((prev_handle = zend_hash_index_find(&PCNTL_G(php_signal_table), signo)) != NULL) {
- RETURN_ZVAL(prev_handle, 1, 0);
+ RETURN_COPY(prev_handle);
} else {
RETURN_LONG((zend_long)SIG_DFL);
}
@@ -1154,6 +1038,10 @@ PHP_FUNCTION(pcntl_signal_get_handler)
Dispatch signals to signal handlers */
PHP_FUNCTION(pcntl_signal_dispatch)
{
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
pcntl_signal_dispatch();
RETURN_TRUE;
}
@@ -1169,7 +1057,7 @@ PHP_FUNCTION(pcntl_sigprocmask)
sigset_t set, oldset;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "la|z", &how, &user_set, &user_oldset) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (sigemptyset(&set) != 0 || sigemptyset(&oldset) != 0) {
@@ -1196,7 +1084,7 @@ PHP_FUNCTION(pcntl_sigprocmask)
if (user_oldset != NULL) {
user_oldset = zend_try_array_init(user_oldset);
if (!user_oldset) {
- return;
+ RETURN_THROWS();
}
for (signo = 1; signo < NSIG; ++signo) {
@@ -1225,11 +1113,11 @@ static void pcntl_sigwaitinfo(INTERNAL_FUNCTION_PARAMETERS, int timedwait) /* {{
if (timedwait) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "a|zll", &user_set, &user_siginfo, &tv_sec, &tv_nsec) == FAILURE) {
- return;
+ RETURN_THROWS();
}
} else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "a|z", &user_set, &user_siginfo) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
@@ -1272,7 +1160,7 @@ static void pcntl_sigwaitinfo(INTERNAL_FUNCTION_PARAMETERS, int timedwait) /* {{
}
/* }}} */
-/* {{{ proto int pcnlt_sigwaitinfo(array set[, array &siginfo])
+/* {{{ proto int pcntl_sigwaitinfo(array set[, array &siginfo])
Synchronously wait for queued signals */
PHP_FUNCTION(pcntl_sigwaitinfo)
{
@@ -1355,7 +1243,7 @@ PHP_FUNCTION(pcntl_getpriority)
int pri;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|ll", &pid, &who) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* needs to be cleared, since any returned value is valid */
@@ -1394,7 +1282,7 @@ PHP_FUNCTION(pcntl_setpriority)
zend_long pri;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|ll", &pri, &pid, &who) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (setpriority(who, pid, pri)) {
@@ -1428,7 +1316,11 @@ PHP_FUNCTION(pcntl_setpriority)
Retrieve the error number set by the last pcntl function which failed. */
PHP_FUNCTION(pcntl_get_last_error)
{
- RETURN_LONG(PCNTL_G(last_error));
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
+ RETURN_LONG(PCNTL_G(last_error));
}
/* }}} */
@@ -1436,13 +1328,13 @@ PHP_FUNCTION(pcntl_get_last_error)
Retrieve the system error message associated with the given errno. */
PHP_FUNCTION(pcntl_strerror)
{
- zend_long error;
+ zend_long error;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &error) == FAILURE) {
- RETURN_FALSE;
- }
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &error) == FAILURE) {
+ RETURN_THROWS();
+ }
- RETURN_STRING(strerror(error));
+ RETURN_STRING(strerror(error));
}
/* }}} */
@@ -1548,7 +1440,7 @@ void pcntl_signal_dispatch()
sigprocmask(SIG_SETMASK, &old_mask, NULL);
}
-/* {{{ proto bool pcntl_async_signals([bool on[)
+/* {{{ proto bool pcntl_async_signals([bool on])
Enable/disable asynchronous signal handling and return the old setting. */
PHP_FUNCTION(pcntl_async_signals)
{
@@ -1558,7 +1450,7 @@ PHP_FUNCTION(pcntl_async_signals)
RETURN_BOOL(PCNTL_G(async_signals));
}
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &on) == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETVAL_BOOL(PCNTL_G(async_signals));
PCNTL_G(async_signals) = on;
diff --git a/ext/pcntl/pcntl.stub.php b/ext/pcntl/pcntl.stub.php
new file mode 100644
index 0000000000..7ca872663a
--- /dev/null
+++ b/ext/pcntl/pcntl.stub.php
@@ -0,0 +1,67 @@
+<?php
+
+function pcntl_fork(): int {}
+
+function pcntl_waitpid(int $pid, &$status, int $options = 0, &$rusage = []): int {}
+
+function pcntl_wait(&$status, int $options = 0, &$rusage = []): int {}
+
+/**
+ * @param callable|int $handler
+ */
+function pcntl_signal(int $signo, $handler, bool $restart_syscalls = true): bool {}
+
+/** @return mixed */
+function pcntl_signal_get_handler(int $signo) {}
+
+function pcntl_signal_dispatch(): bool {}
+
+#ifdef HAVE_SIGPROCMASK
+function pcntl_sigprocmask(int $how, array $set, &$oldset = null): bool {}
+#endif
+
+#ifdef HAVE_STRUCT_SIGINFO_T
+#if HAVE_SIGWAITINFO && HAVE_SIGTIMEDWAIT
+function pcntl_sigwaitinfo(array $set, &$info = []): int|false {}
+
+function pcntl_sigtimedwait(array $set, &$info = [], int $seconds = 0, int $nanoseconds = 0): int|false {}
+#endif
+#endif
+
+function pcntl_wifexited(int $status): bool {}
+
+function pcntl_wifstopped(int $status): bool {}
+
+#ifdef HAVE_WCONTINUED
+function pcntl_wifcontinued(int $status): bool {}
+#endif
+
+function pcntl_wifsignaled(int $status): bool {}
+
+function pcntl_wifexitstatus(int $status): int|false {}
+
+function pcntl_wtermsig(int $status): int|false {}
+
+function pcntl_wstopsig(int $status): int|false {}
+
+function pcntl_exec(string $path, array $args = [], array $envs = []): bool {}
+
+function pcntl_alarm(int $seconds): int {}
+
+function pcntl_get_last_error(): int {}
+
+#ifdef HAVE_GETPRIORITY
+function pcntl_getpriority(int $pid = UNKNOWN, int $process_identifier = PRIO_PROCESS): int|false {}
+#endif
+
+#ifdef HAVE_SETPRIORITY
+function pcntl_setpriority(int $priority, int $pid = UNKNOWN, int $process_identifier = PRIO_PROCESS): bool{}
+#endif
+
+function pcntl_strerror(int $errno): string {}
+
+function pcntl_async_signals(bool $on = UNKNOWN): bool {}
+
+#ifdef HAVE_UNSHARE
+function pcntl_unshare(int $flags): bool {}
+#endif
diff --git a/ext/pcntl/pcntl_arginfo.h b/ext/pcntl/pcntl_arginfo.h
new file mode 100644
index 0000000000..7fc37ab4ec
--- /dev/null
+++ b/ext/pcntl/pcntl_arginfo.h
@@ -0,0 +1,117 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_fork, 0, 0, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_waitpid, 0, 2, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, pid, IS_LONG, 0)
+ ZEND_ARG_INFO(1, status)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ ZEND_ARG_INFO(1, rusage)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_wait, 0, 1, IS_LONG, 0)
+ ZEND_ARG_INFO(1, status)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ ZEND_ARG_INFO(1, rusage)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_signal, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, signo, IS_LONG, 0)
+ ZEND_ARG_INFO(0, handler)
+ ZEND_ARG_TYPE_INFO(0, restart_syscalls, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_signal_get_handler, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, signo, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_signal_dispatch, 0, 0, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_SIGPROCMASK)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_sigprocmask, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, how, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, set, IS_ARRAY, 0)
+ ZEND_ARG_INFO(1, oldset)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_STRUCT_SIGINFO_T) && HAVE_SIGWAITINFO && HAVE_SIGTIMEDWAIT
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pcntl_sigwaitinfo, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, set, IS_ARRAY, 0)
+ ZEND_ARG_INFO(1, info)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_STRUCT_SIGINFO_T) && HAVE_SIGWAITINFO && HAVE_SIGTIMEDWAIT
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pcntl_sigtimedwait, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, set, IS_ARRAY, 0)
+ ZEND_ARG_INFO(1, info)
+ ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, nanoseconds, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_wifexited, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, status, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_pcntl_wifstopped arginfo_pcntl_wifexited
+
+#if defined(HAVE_WCONTINUED)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_wifcontinued, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, status, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#define arginfo_pcntl_wifsignaled arginfo_pcntl_wifexited
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pcntl_wifexitstatus, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, status, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_pcntl_wtermsig arginfo_pcntl_wifexitstatus
+
+#define arginfo_pcntl_wstopsig arginfo_pcntl_wifexitstatus
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_exec, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, args, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, envs, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_alarm, 0, 1, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_pcntl_get_last_error arginfo_pcntl_fork
+
+#if defined(HAVE_GETPRIORITY)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pcntl_getpriority, 0, 0, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, pid, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, process_identifier, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_SETPRIORITY)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_setpriority, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, priority, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, pid, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, process_identifier, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_strerror, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, errno, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_async_signals, 0, 0, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, on, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_UNSHARE)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pcntl_unshare, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
diff --git a/ext/pcntl/php_pcntl.h b/ext/pcntl/php_pcntl.h
index 90ce2aea96..bbb07bc896 100644
--- a/ext/pcntl/php_pcntl.h
+++ b/ext/pcntl/php_pcntl.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/pcntl/php_signal.c b/ext/pcntl/php_signal.c
index 93a42f45d1..44d92dabd0 100644
--- a/ext/pcntl/php_signal.c
+++ b/ext/pcntl/php_signal.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -21,7 +19,7 @@
#include "Zend/zend.h"
#include "Zend/zend_signal.h"
-/* php_signal using sigaction is derived from Advanced Programing
+/* php_signal using sigaction is derived from Advanced Programming
* in the Unix Environment by W. Richard Stevens p 298. */
Sigfunc *php_signal4(int signo, Sigfunc *func, int restart, int mask_all)
{
diff --git a/ext/pcntl/php_signal.h b/ext/pcntl/php_signal.h
index b392b25d6e..21dbf0d254 100644
--- a/ext/pcntl/php_signal.h
+++ b/ext/pcntl/php_signal.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/pcntl/tests/001.phpt b/ext/pcntl/tests/001.phpt
index b9587e1325..cdfdb0733f 100644
--- a/ext/pcntl/tests/001.phpt
+++ b/ext/pcntl/tests/001.phpt
@@ -11,60 +11,60 @@ Test pcntl wait functionality
--FILE--
<?php
function test_exit_waits(){
- print "\n\nTesting pcntl_wifexited and wexitstatus....";
+ print "\n\nTesting pcntl_wifexited and wexitstatus....";
- $pid=pcntl_fork();
- if ($pid==0) {
- sleep(1);
- exit(-1);
- } else {
- $options=0;
- pcntl_waitpid($pid, $status, $options);
- if ( pcntl_wifexited($status) ) print "\nExited With: ". pcntl_wexitstatus($status);
- }
+ $pid=pcntl_fork();
+ if ($pid==0) {
+ sleep(1);
+ exit(-1);
+ } else {
+ $options=0;
+ pcntl_waitpid($pid, $status, $options);
+ if ( pcntl_wifexited($status) ) print "\nExited With: ". pcntl_wexitstatus($status);
+ }
}
function test_exit_signal(){
- print "\n\nTesting pcntl_wifsignaled....";
+ print "\n\nTesting pcntl_wifsignaled....";
- $pid=pcntl_fork();
+ $pid=pcntl_fork();
- if ($pid==0) {
+ if ($pid==0) {
while(1);
- exit;
- } else {
- $options=0;
- posix_kill($pid, SIGTERM);
- pcntl_waitpid($pid, $status, $options);
- if ( pcntl_wifsignaled($status) ) {
- $signal_print=pcntl_wtermsig($status);
- if ($signal_print==SIGTERM) $signal_print="SIGTERM";
- print "\nProcess was terminated by signal : ". $signal_print;
- }
+ exit;
+ } else {
+ $options=0;
+ posix_kill($pid, SIGTERM);
+ pcntl_waitpid($pid, $status, $options);
+ if ( pcntl_wifsignaled($status) ) {
+ $signal_print=pcntl_wtermsig($status);
+ if ($signal_print==SIGTERM) $signal_print="SIGTERM";
+ print "\nProcess was terminated by signal : ". $signal_print;
+ }
- }
+ }
}
function test_stop_signal(){
- print "\n\nTesting pcntl_wifstopped and pcntl_wstopsig....";
+ print "\n\nTesting pcntl_wifstopped and pcntl_wstopsig....";
- $pid=pcntl_fork();
+ $pid=pcntl_fork();
- if ($pid==0) {
- sleep(1);
- exit;
- } else {
- $options=WUNTRACED;
- posix_kill($pid, SIGSTOP);
- pcntl_waitpid($pid, $status, $options);
- if ( pcntl_wifstopped($status) ) {
- $signal_print=pcntl_wstopsig($status);
- if ($signal_print==SIGSTOP) $signal_print="SIGSTOP";
- print "\nProcess was stoped by signal : ". $signal_print;
- }
- posix_kill($pid, SIGCONT);
- }
+ if ($pid==0) {
+ sleep(1);
+ exit;
+ } else {
+ $options=WUNTRACED;
+ posix_kill($pid, SIGSTOP);
+ pcntl_waitpid($pid, $status, $options);
+ if ( pcntl_wifstopped($status) ) {
+ $signal_print=pcntl_wstopsig($status);
+ if ($signal_print==SIGSTOP) $signal_print="SIGSTOP";
+ print "\nProcess was stopped by signal : ". $signal_print;
+ }
+ posix_kill($pid, SIGCONT);
+ }
}
print "Staring wait.h tests....";
@@ -82,4 +82,4 @@ Testing pcntl_wifsignaled....
Process was terminated by signal : SIGTERM
Testing pcntl_wifstopped and pcntl_wstopsig....
-Process was stoped by signal : SIGSTOP
+Process was stopped by signal : SIGSTOP
diff --git a/ext/pcntl/tests/002.phpt b/ext/pcntl/tests/002.phpt
index 7d40735ae5..f93039f412 100644
--- a/ext/pcntl/tests/002.phpt
+++ b/ext/pcntl/tests/002.phpt
@@ -13,64 +13,64 @@ pcntl: pcntl_sigprocmask(), pcntl_sigwaitinfo(), pcntl_sigtimedwait()
$pid = pcntl_fork();
if ($pid == -1) {
- die('failed');
+ die('failed');
} else if ($pid) {
- pcntl_sigprocmask(SIG_BLOCK, array(SIGCHLD,(string)SIGTERM));
- $oldset = array();
- pcntl_sigprocmask(SIG_BLOCK, array(), $oldset);
- var_dump(in_array(SIGCHLD, $oldset));
- var_dump(in_array(SIGTERM, $oldset));
+ pcntl_sigprocmask(SIG_BLOCK, array(SIGCHLD,(string)SIGTERM));
+ $oldset = array();
+ pcntl_sigprocmask(SIG_BLOCK, array(), $oldset);
+ var_dump(in_array(SIGCHLD, $oldset));
+ var_dump(in_array(SIGTERM, $oldset));
- posix_kill(posix_getpid(), SIGTERM);
- $signo = pcntl_sigwaitinfo(array(SIGTERM), $siginfo);
- echo "signo == SIGTERM\n";
- var_dump($signo === SIGTERM && $signo === $siginfo['signo']);
- echo "code === SI_USER || SI_NOINFO\n";
- if (defined('SI_NOINFO')) {
- var_dump(($siginfo['code'] === SI_USER) || ($siginfo['code'] === SI_NOINFO));
- } else {
- var_dump($siginfo['code'] === SI_USER);
- }
+ posix_kill(posix_getpid(), SIGTERM);
+ $signo = pcntl_sigwaitinfo(array(SIGTERM), $siginfo);
+ echo "signo == SIGTERM\n";
+ var_dump($signo === SIGTERM && $signo === $siginfo['signo']);
+ echo "code === SI_USER || SI_NOINFO\n";
+ if (defined('SI_NOINFO')) {
+ var_dump(($siginfo['code'] === SI_USER) || ($siginfo['code'] === SI_NOINFO));
+ } else {
+ var_dump($siginfo['code'] === SI_USER);
+ }
- pcntl_signal(SIGCHLD, function($signo){});
- posix_kill($pid, SIGTERM);
- $signo = pcntl_sigwaitinfo(array((string)SIGCHLD), $siginfo);
- echo "signo == SIGCHLD\n";
- var_dump($signo === SIGCHLD && $signo === $siginfo['signo']);
- echo "code === CLD_KILLED\n";
- var_dump($siginfo['code'] === CLD_KILLED);
- echo "signo === SIGCHLD\n";
- var_dump($siginfo['signo'] === SIGCHLD);
- echo "signo === uid\n";
- var_dump($siginfo['uid'] === posix_getuid());
- echo "signo === pid\n";
- var_dump($siginfo['pid'] === $pid);
- pcntl_waitpid($pid, $status);
+ pcntl_signal(SIGCHLD, function($signo){});
+ posix_kill($pid, SIGTERM);
+ $signo = pcntl_sigwaitinfo(array((string)SIGCHLD), $siginfo);
+ echo "signo == SIGCHLD\n";
+ var_dump($signo === SIGCHLD && $signo === $siginfo['signo']);
+ echo "code === CLD_KILLED\n";
+ var_dump($siginfo['code'] === CLD_KILLED);
+ echo "signo === SIGCHLD\n";
+ var_dump($siginfo['signo'] === SIGCHLD);
+ echo "signo === uid\n";
+ var_dump($siginfo['uid'] === posix_getuid());
+ echo "signo === pid\n";
+ var_dump($siginfo['pid'] === $pid);
+ pcntl_waitpid($pid, $status);
- set_error_handler(function($errno, $errstr) { echo "Error triggered\n"; }, E_WARNING);
+ set_error_handler(function($errno, $errstr) { echo "Error triggered\n"; }, E_WARNING);
- echo "sigprocmask with invalid arguments\n";
+ echo "sigprocmask with invalid arguments\n";
- /* Valgrind expectedly complains about this:
+ /* Valgrind expectedly complains about this:
* "sigprocmask: unknown 'how' field 2147483647"
- * Skip */
- if (getenv("USE_ZEND_ALLOC") !== '0') {
- var_dump(pcntl_sigprocmask(PHP_INT_MAX, array(SIGTERM)));
- } else {
- echo "Error triggered\n";
- echo "bool(false)\n";
- }
- var_dump(pcntl_sigprocmask(SIG_SETMASK, array(0)));
+ * Skip */
+ if (getenv("USE_ZEND_ALLOC") !== '0') {
+ var_dump(pcntl_sigprocmask(PHP_INT_MAX, array(SIGTERM)));
+ } else {
+ echo "Error triggered\n";
+ echo "bool(false)\n";
+ }
+ var_dump(pcntl_sigprocmask(SIG_SETMASK, array(0)));
- echo "sigwaitinfo with invalid arguments\n";
- var_dump(pcntl_sigwaitinfo(array(0)));
+ echo "sigwaitinfo with invalid arguments\n";
+ var_dump(pcntl_sigwaitinfo(array(0)));
- echo "sigtimedwait with invalid arguments\n";
- var_dump(pcntl_sigtimedwait(array(SIGTERM), $signo, PHP_INT_MAX, PHP_INT_MAX));
+ echo "sigtimedwait with invalid arguments\n";
+ var_dump(pcntl_sigtimedwait(array(SIGTERM), $signo, PHP_INT_MAX, PHP_INT_MAX));
} else {
- $siginfo = NULL;
- pcntl_sigtimedwait(array(SIGINT), $siginfo, 3600, 0);
- exit;
+ $siginfo = NULL;
+ pcntl_sigtimedwait(array(SIGINT), $siginfo, 3600, 0);
+ exit;
}
?>
diff --git a/ext/pcntl/tests/pcntl_alarm.phpt b/ext/pcntl/tests/pcntl_alarm.phpt
index a9cae1616b..337ba3ad4b 100644
--- a/ext/pcntl/tests/pcntl_alarm.phpt
+++ b/ext/pcntl/tests/pcntl_alarm.phpt
@@ -8,7 +8,6 @@ max_execution_time=0
<?php
pcntl_signal(SIGALRM, function(){});
-var_dump(pcntl_alarm());
pcntl_alarm(0);
var_dump(pcntl_alarm(60));
var_dump(pcntl_alarm(1) > 0);
@@ -16,8 +15,6 @@ $siginfo = array();
var_dump(pcntl_sigtimedwait(array(SIGALRM),$siginfo,2) === SIGALRM);
?>
--EXPECTF--
-Warning: pcntl_alarm() expects exactly 1 parameter, 0 given in %s
-NULL
int(0)
bool(true)
bool(true)
diff --git a/ext/pcntl/tests/pcntl_exec_2.phpt b/ext/pcntl/tests/pcntl_exec_2.phpt
index 72274ede5f..18a3a6bc24 100644
--- a/ext/pcntl/tests/pcntl_exec_2.phpt
+++ b/ext/pcntl/tests/pcntl_exec_2.phpt
@@ -10,14 +10,14 @@ if (!getenv("TEST_PHP_EXECUTABLE") || !is_executable(getenv("TEST_PHP_EXECUTABLE
--FILE--
<?php
if (getenv("PCNTL_EXEC_TEST_IS_CHILD")) {
- var_dump(getenv("FOO"));
- exit;
+ var_dump(getenv("FOO"));
+ exit;
}
echo "ok\n";
pcntl_exec(getenv("TEST_PHP_EXECUTABLE"), array('-n', __FILE__), array(
- "PCNTL_EXEC_TEST_IS_CHILD" => "1",
- "FOO" => "BAR",
- 1 => "long")
+ "PCNTL_EXEC_TEST_IS_CHILD" => "1",
+ "FOO" => "BAR",
+ 1 => "long")
);
echo "nok\n";
diff --git a/ext/pcntl/tests/pcntl_exec_3.phpt b/ext/pcntl/tests/pcntl_exec_3.phpt
index 5349381d92..7d7f6b5271 100644
--- a/ext/pcntl/tests/pcntl_exec_3.phpt
+++ b/ext/pcntl/tests/pcntl_exec_3.phpt
@@ -4,14 +4,10 @@ pcntl_exec() 3
<?php if (!extension_loaded("pcntl")) print "skip"; ?>
--FILE--
<?php
-var_dump(pcntl_exec());
$file = tempnam(sys_get_temp_dir(),"php");
var_dump(pcntl_exec($file, array("foo","bar"), array("foo" => "bar")));
unlink($file);
?>
--EXPECTF--
-Warning: pcntl_exec() expects at least 1 parameter, 0 given %s
-NULL
-
Warning: pcntl_exec(): Error has occurred: (errno %d) %s
bool(false)
diff --git a/ext/pcntl/tests/pcntl_fork_basic.phpt b/ext/pcntl/tests/pcntl_fork_basic.phpt
index 59931df850..3509e14a7f 100644
--- a/ext/pcntl/tests/pcntl_fork_basic.phpt
+++ b/ext/pcntl/tests/pcntl_fork_basic.phpt
@@ -15,10 +15,10 @@ echo "*** Test by calling method or function with its expected arguments, first
$pid = pcntl_fork();
if ($pid > 0) {
- pcntl_wait($status);
- var_dump($pid);
+ pcntl_wait($status);
+ var_dump($pid);
} else {
- var_dump($pid);
+ var_dump($pid);
}
?>
--EXPECTF--
diff --git a/ext/pcntl/tests/pcntl_signal.phpt b/ext/pcntl/tests/pcntl_signal.phpt
index 953ff54eef..cd55d9ad96 100644
--- a/ext/pcntl/tests/pcntl_signal.phpt
+++ b/ext/pcntl/tests/pcntl_signal.phpt
@@ -6,18 +6,17 @@ pcntl_signal()
--FILE--
<?php
pcntl_signal(SIGTERM, function($signo){
- echo "signal dispatched\n";
+ echo "signal dispatched\n";
});
posix_kill(posix_getpid(), SIGTERM);
pcntl_signal_dispatch();
pcntl_signal(SIGUSR1, function($signo, $siginfo){
- printf("got signal from %s\n", $siginfo['pid'] ?? 'nobody');
+ printf("got signal from %s\n", $siginfo['pid'] ?? 'nobody');
});
posix_kill(posix_getpid(), SIGUSR1);
pcntl_signal_dispatch();
-var_dump(pcntl_signal());
var_dump(pcntl_signal(SIGALRM, SIG_IGN));
var_dump(pcntl_signal(-1, -1));
var_dump(pcntl_signal(-1, function(){}));
@@ -31,9 +30,6 @@ echo "ok\n";
--EXPECTF--
signal dispatched
got signal from %r\d+|nobody%r
-
-Warning: pcntl_signal() expects at least 2 parameters, 0 given in %s
-NULL
bool(true)
Warning: pcntl_signal(): Invalid signal %s
diff --git a/ext/pcntl/tests/pcntl_wait.phpt b/ext/pcntl/tests/pcntl_wait.phpt
index d5ab709b76..346ca019fb 100644
--- a/ext/pcntl/tests/pcntl_wait.phpt
+++ b/ext/pcntl/tests/pcntl_wait.phpt
@@ -7,31 +7,22 @@ pcntl_wait()
<?php
$pid = pcntl_fork();
if ($pid == -1) {
- die("failed");
+ die("failed");
} else if ($pid) {
- $status = 0;
- pcntl_wait($status, WUNTRACED);
- var_dump(pcntl_wifexited($status));
- posix_kill($pid, SIGCONT);
+ $status = 0;
+ pcntl_wait($status, WUNTRACED);
+ var_dump(pcntl_wifexited($status));
+ posix_kill($pid, SIGCONT);
- pcntl_wait($status);
- var_dump(pcntl_wifsignaled($status));
- var_dump(pcntl_wifstopped($status));
- var_dump(pcntl_wexitstatus($status));
+ pcntl_wait($status);
+ var_dump(pcntl_wifsignaled($status));
+ var_dump(pcntl_wifstopped($status));
+ var_dump(pcntl_wexitstatus($status));
- var_dump(pcntl_wait($status, WNOHANG | WUNTRACED));
- var_dump(pcntl_wait());
- var_dump(pcntl_waitpid());
-
- var_dump(pcntl_wifexited());
- var_dump(pcntl_wifstopped());
- var_dump(pcntl_wifsignaled());
- var_dump(pcntl_wexitstatus());
- var_dump(pcntl_wtermsig());
- var_dump(pcntl_wstopsig());
+ var_dump(pcntl_wait($status, WNOHANG | WUNTRACED));
} else {
- posix_kill(posix_getpid(), SIGSTOP);
- exit(42);
+ posix_kill(posix_getpid(), SIGSTOP);
+ exit(42);
}
?>
--EXPECTF--
@@ -40,27 +31,3 @@ bool(false)
bool(false)
int(42)
int(-1)
-
-Warning: pcntl_wait() expects at least 1 parameter, 0 given in %s
-NULL
-
-Warning: pcntl_waitpid() expects at least 2 parameters, 0 given in %s
-NULL
-
-Warning: pcntl_wifexited() expects exactly 1 parameter, 0 given in %s
-NULL
-
-Warning: pcntl_wifstopped() expects exactly 1 parameter, 0 given in %s
-NULL
-
-Warning: pcntl_wifsignaled() expects exactly 1 parameter, 0 given in %s
-NULL
-
-Warning: pcntl_wexitstatus() expects exactly 1 parameter, 0 given in %s
-NULL
-
-Warning: pcntl_wtermsig() expects exactly 1 parameter, 0 given in %s
-NULL
-
-Warning: pcntl_wstopsig() expects exactly 1 parameter, 0 given in %s
-NULL
diff --git a/ext/pcntl/tests/pcntl_wait_rusage1.phpt b/ext/pcntl/tests/pcntl_wait_rusage1.phpt
index b23195f914..106c7088b8 100644
--- a/ext/pcntl/tests/pcntl_wait_rusage1.phpt
+++ b/ext/pcntl/tests/pcntl_wait_rusage1.phpt
@@ -7,34 +7,34 @@ pcntl_wait() and rusage
<?php
$pid = pcntl_fork();
if ($pid == -1) {
- die("failed");
+ die("failed");
} else if ($pid) {
- $status = 0;
- var_dump(pcntl_wait($status, WUNTRACED, $rusage));
- var_dump($rusage['ru_utime.tv_sec']);
- var_dump($rusage['ru_utime.tv_usec']);
+ $status = 0;
+ var_dump(pcntl_wait($status, WUNTRACED, $rusage));
+ var_dump($rusage['ru_utime.tv_sec']);
+ var_dump($rusage['ru_utime.tv_usec']);
- posix_kill($pid, SIGCONT);
+ posix_kill($pid, SIGCONT);
- $rusage = array(1,2,3);
- pcntl_wait($status, WUNTRACED, $rusage);
- var_dump($rusage['ru_utime.tv_sec']);
- var_dump($rusage['ru_utime.tv_usec']);
+ $rusage = array(1,2,3);
+ pcntl_wait($status, WUNTRACED, $rusage);
+ var_dump($rusage['ru_utime.tv_sec']);
+ var_dump($rusage['ru_utime.tv_usec']);
- $rusage = "string";
- pcntl_wait($status, 0, $rusage);
- var_dump(gettype($rusage));
- var_dump(count($rusage));
+ $rusage = "string";
+ pcntl_wait($status, 0, $rusage);
+ var_dump(gettype($rusage));
+ var_dump(count($rusage));
- $rusage = new stdClass;
- pcntl_wait($status, 0, $rusage);
- var_dump(gettype($rusage));
- var_dump(count($rusage));
+ $rusage = new stdClass;
+ pcntl_wait($status, 0, $rusage);
+ var_dump(gettype($rusage));
+ var_dump(count($rusage));
- echo "END\n";
+ echo "END\n";
} else {
- posix_kill(posix_getpid(), SIGSTOP);
- exit(42);
+ posix_kill(posix_getpid(), SIGSTOP);
+ exit(42);
}
?>
--EXPECTF--
diff --git a/ext/pcntl/tests/pcntl_waitpid_rusage1.phpt b/ext/pcntl/tests/pcntl_waitpid_rusage1.phpt
index 393dd59b9c..d9776676a1 100644
--- a/ext/pcntl/tests/pcntl_waitpid_rusage1.phpt
+++ b/ext/pcntl/tests/pcntl_waitpid_rusage1.phpt
@@ -7,34 +7,34 @@ pcntl_waitpid() and rusage
<?php
$pid = pcntl_fork();
if ($pid == -1) {
- die("failed");
+ die("failed");
} else if ($pid) {
- $status = 0;
- var_dump(pcntl_waitpid($pid, $status, WUNTRACED, $rusage));
- var_dump($rusage['ru_utime.tv_sec']);
- var_dump($rusage['ru_utime.tv_usec']);
+ $status = 0;
+ var_dump(pcntl_waitpid($pid, $status, WUNTRACED, $rusage));
+ var_dump($rusage['ru_utime.tv_sec']);
+ var_dump($rusage['ru_utime.tv_usec']);
- posix_kill($pid, SIGCONT);
+ posix_kill($pid, SIGCONT);
- $rusage = array(1,2,3);
- pcntl_waitpid($pid, $status, WUNTRACED, $rusage);
- var_dump($rusage['ru_utime.tv_sec']);
- var_dump($rusage['ru_utime.tv_usec']);
+ $rusage = array(1,2,3);
+ pcntl_waitpid($pid, $status, WUNTRACED, $rusage);
+ var_dump($rusage['ru_utime.tv_sec']);
+ var_dump($rusage['ru_utime.tv_usec']);
- $rusage = "string";
- pcntl_waitpid($pid, $status, 0, $rusage);
- var_dump(gettype($rusage));
- var_dump(count($rusage));
+ $rusage = "string";
+ pcntl_waitpid($pid, $status, 0, $rusage);
+ var_dump(gettype($rusage));
+ var_dump(count($rusage));
- $rusage = new stdClass;
- pcntl_waitpid($pid, $status, 0, $rusage);
- var_dump(gettype($rusage));
- var_dump(count($rusage));
+ $rusage = new stdClass;
+ pcntl_waitpid($pid, $status, 0, $rusage);
+ var_dump(gettype($rusage));
+ var_dump(count($rusage));
- echo "END\n";
+ echo "END\n";
} else {
- posix_kill(posix_getpid(), SIGSTOP);
- exit(42);
+ posix_kill(posix_getpid(), SIGSTOP);
+ exit(42);
}
?>
--EXPECTF--
diff --git a/ext/pcre/config.w32 b/ext/pcre/config.w32
index 86298bbe1b..cbc8cf4517 100644
--- a/ext/pcre/config.w32
+++ b/ext/pcre/config.w32
@@ -6,7 +6,6 @@ ADD_SOURCES("ext/pcre/pcre2lib", "pcre2_auto_possess.c pcre2_chartables.c pcre2_
ADD_DEF_FILE("ext\\pcre\\php_pcre.def");
AC_DEFINE('HAVE_BUNDLED_PCRE', 1, 'Using bundled PCRE library');
-AC_DEFINE('HAVE_PCRE', 1, 'Have PCRE library');
AC_DEFINE('PCRE2_CODE_UNIT_WIDTH', 8, 'Have PCRE library');
AC_DEFINE("PCRE2_STATIC", 1, "");
PHP_PCRE="yes";
diff --git a/ext/pcre/config0.m4 b/ext/pcre/config0.m4
index 714a8d57e8..36f896ad2a 100644
--- a/ext/pcre/config0.m4
+++ b/ext/pcre/config0.m4
@@ -19,7 +19,6 @@ if test "$PHP_EXTERNAL_PCRE" != "no"; then
PHP_EVAL_INCLINE($PCRE2_CFLAGS)
PHP_EVAL_LIBLINE($PCRE2_LIBS)
AC_DEFINE(PCRE2_CODE_UNIT_WIDTH, 8, [ ])
- AC_DEFINE(HAVE_PCRE, 1, [ ])
if test "$PHP_PCRE_JIT" != "no"; then
AC_CACHE_CHECK([for JIT support in PCRE2], ac_cv_have_pcre2_jit, [
diff --git a/ext/pcre/pcre2lib/pcre2.h b/ext/pcre/pcre2lib/pcre2.h
index 102b5d91f1..cb9d61a35b 100644
--- a/ext/pcre/pcre2lib/pcre2.h
+++ b/ext/pcre/pcre2lib/pcre2.h
@@ -5,7 +5,7 @@
/* This is the public header file for the PCRE library, second API, to be
#included by applications that call PCRE2 functions.
- Copyright (c) 2016-2018 University of Cambridge
+ Copyright (c) 2016-2019 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -42,9 +42,9 @@ POSSIBILITY OF SUCH DAMAGE.
/* The current PCRE version information. */
#define PCRE2_MAJOR 10
-#define PCRE2_MINOR 33
+#define PCRE2_MINOR 34
#define PCRE2_PRERELEASE
-#define PCRE2_DATE 2019-04-16
+#define PCRE2_DATE 2019-11-21
/* When an application links to a PCRE DLL in Windows, the symbols that are
imported have to be identified as such. When building PCRE2, the appropriate
@@ -142,6 +142,7 @@ D is inspected during pcre2_dfa_match() execution
#define PCRE2_USE_OFFSET_LIMIT 0x00800000u /* J M D */
#define PCRE2_EXTENDED_MORE 0x01000000u /* C */
#define PCRE2_LITERAL 0x02000000u /* C */
+#define PCRE2_MATCH_INVALID_UTF 0x04000000u /* J M D */
/* An additional compile options word is available in the compile context. */
@@ -305,6 +306,8 @@ pcre2_pattern_convert(). */
#define PCRE2_ERROR_INVALID_HYPHEN_IN_OPTIONS 194
#define PCRE2_ERROR_ALPHA_ASSERTION_UNKNOWN 195
#define PCRE2_ERROR_SCRIPT_RUN_NOT_AVAILABLE 196
+#define PCRE2_ERROR_TOO_MANY_CAPTURES 197
+#define PCRE2_ERROR_CONDITION_ATOMIC_ASSERTION_EXPECTED 198
/* "Expected" matching error codes: no match and partial match. */
@@ -390,6 +393,7 @@ released, the numbers must not be changed. */
#define PCRE2_ERROR_HEAPLIMIT (-63)
#define PCRE2_ERROR_CONVERT_SYNTAX (-64)
#define PCRE2_ERROR_INTERNAL_DUPMATCH (-65)
+#define PCRE2_ERROR_DFA_UINVALID_UTF (-66)
/* Request types for pcre2_pattern_info() */
@@ -580,7 +584,7 @@ PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
pcre2_set_bsr(pcre2_compile_context *, uint32_t); \
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
- pcre2_set_character_tables(pcre2_compile_context *, const unsigned char *); \
+ pcre2_set_character_tables(pcre2_compile_context *, const uint8_t *); \
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
pcre2_set_compile_extra_options(pcre2_compile_context *, uint32_t); \
PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
@@ -675,6 +679,8 @@ PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
pcre2_match_data_free(pcre2_match_data *); \
PCRE2_EXP_DECL PCRE2_SPTR PCRE2_CALL_CONVENTION \
pcre2_get_mark(pcre2_match_data *); \
+PCRE2_EXP_DECL PCRE2_SIZE PCRE2_CALL_CONVENTION \
+ pcre2_get_match_data_size(pcre2_match_data *); \
PCRE2_EXP_DECL uint32_t PCRE2_CALL_CONVENTION \
pcre2_get_ovector_count(pcre2_match_data *); \
PCRE2_EXP_DECL PCRE2_SIZE PCRE2_CALL_CONVENTION \
@@ -773,7 +779,8 @@ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \
pcre2_get_error_message(int, PCRE2_UCHAR *, PCRE2_SIZE); \
PCRE2_EXP_DECL const uint8_t PCRE2_CALL_CONVENTION \
*pcre2_maketables(pcre2_general_context *); \
-
+PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \
+ pcre2_maketables_free(pcre2_general_context *, const uint8_t *);
/* Define macros that generate width-specific names from generic versions. The
three-level macro scheme is necessary to get the macros expanded when we want
@@ -838,6 +845,7 @@ pcre2_compile are called by application code. */
#define pcre2_general_context_free PCRE2_SUFFIX(pcre2_general_context_free_)
#define pcre2_get_error_message PCRE2_SUFFIX(pcre2_get_error_message_)
#define pcre2_get_mark PCRE2_SUFFIX(pcre2_get_mark_)
+#define pcre2_get_match_data_size PCRE2_SUFFIX(pcre2_get_match_data_size_)
#define pcre2_get_ovector_pointer PCRE2_SUFFIX(pcre2_get_ovector_pointer_)
#define pcre2_get_ovector_count PCRE2_SUFFIX(pcre2_get_ovector_count_)
#define pcre2_get_startchar PCRE2_SUFFIX(pcre2_get_startchar_)
@@ -848,6 +856,7 @@ pcre2_compile are called by application code. */
#define pcre2_jit_stack_create PCRE2_SUFFIX(pcre2_jit_stack_create_)
#define pcre2_jit_stack_free PCRE2_SUFFIX(pcre2_jit_stack_free_)
#define pcre2_maketables PCRE2_SUFFIX(pcre2_maketables_)
+#define pcre2_maketables_free PCRE2_SUFFIX(pcre2_maketables_free_)
#define pcre2_match PCRE2_SUFFIX(pcre2_match_)
#define pcre2_match_context_copy PCRE2_SUFFIX(pcre2_match_context_copy_)
#define pcre2_match_context_create PCRE2_SUFFIX(pcre2_match_context_create_)
diff --git a/ext/pcre/pcre2lib/pcre2_auto_possess.c b/ext/pcre/pcre2lib/pcre2_auto_possess.c
index 6d7b7c4a4d..5b95b9b8a8 100644
--- a/ext/pcre/pcre2lib/pcre2_auto_possess.c
+++ b/ext/pcre/pcre2lib/pcre2_auto_possess.c
@@ -624,6 +624,13 @@ for(;;)
case OP_ASSERTBACK_NOT:
case OP_ONCE:
return !entered_a_group;
+
+ /* Non-atomic assertions - don't possessify last iterator. This needs
+ more thought. */
+
+ case OP_ASSERT_NA:
+ case OP_ASSERTBACK_NA:
+ return FALSE;
}
/* Skip over the bracket and inspect what comes next. */
diff --git a/ext/pcre/pcre2lib/pcre2_compile.c b/ext/pcre/pcre2lib/pcre2_compile.c
index 068735ae8e..f2e6b6b5bd 100644
--- a/ext/pcre/pcre2lib/pcre2_compile.c
+++ b/ext/pcre/pcre2lib/pcre2_compile.c
@@ -135,6 +135,9 @@ static BOOL
set_lookbehind_lengths(uint32_t **, int *, int *, parsed_recurse_check *,
compile_block *);
+static int
+ check_lookbehinds(uint32_t *, uint32_t **, parsed_recurse_check *,
+ compile_block *);
/*************************************************
@@ -250,36 +253,41 @@ is present where expected in a conditional group. */
#define META_LOOKBEHIND 0x80250000u /* (?<= */
#define META_LOOKBEHINDNOT 0x80260000u /* (?<! */
+/* These cannot be conditions */
+
+#define META_LOOKAHEAD_NA 0x80270000u /* (*napla: */
+#define META_LOOKBEHIND_NA 0x80280000u /* (*naplb: */
+
/* These must be kept in this order, with consecutive values, and the _ARG
versions of COMMIT, PRUNE, SKIP, and THEN immediately after their non-argument
versions. */
-#define META_MARK 0x80270000u /* (*MARK) */
-#define META_ACCEPT 0x80280000u /* (*ACCEPT) */
-#define META_FAIL 0x80290000u /* (*FAIL) */
-#define META_COMMIT 0x802a0000u /* These */
-#define META_COMMIT_ARG 0x802b0000u /* pairs */
-#define META_PRUNE 0x802c0000u /* must */
-#define META_PRUNE_ARG 0x802d0000u /* be */
-#define META_SKIP 0x802e0000u /* kept */
-#define META_SKIP_ARG 0x802f0000u /* in */
-#define META_THEN 0x80300000u /* this */
-#define META_THEN_ARG 0x80310000u /* order */
+#define META_MARK 0x80290000u /* (*MARK) */
+#define META_ACCEPT 0x802a0000u /* (*ACCEPT) */
+#define META_FAIL 0x802b0000u /* (*FAIL) */
+#define META_COMMIT 0x802c0000u /* These */
+#define META_COMMIT_ARG 0x802d0000u /* pairs */
+#define META_PRUNE 0x802e0000u /* must */
+#define META_PRUNE_ARG 0x802f0000u /* be */
+#define META_SKIP 0x80300000u /* kept */
+#define META_SKIP_ARG 0x80310000u /* in */
+#define META_THEN 0x80320000u /* this */
+#define META_THEN_ARG 0x80330000u /* order */
/* These must be kept in groups of adjacent 3 values, and all together. */
-#define META_ASTERISK 0x80320000u /* * */
-#define META_ASTERISK_PLUS 0x80330000u /* *+ */
-#define META_ASTERISK_QUERY 0x80340000u /* *? */
-#define META_PLUS 0x80350000u /* + */
-#define META_PLUS_PLUS 0x80360000u /* ++ */
-#define META_PLUS_QUERY 0x80370000u /* +? */
-#define META_QUERY 0x80380000u /* ? */
-#define META_QUERY_PLUS 0x80390000u /* ?+ */
-#define META_QUERY_QUERY 0x803a0000u /* ?? */
-#define META_MINMAX 0x803b0000u /* {n,m} repeat */
-#define META_MINMAX_PLUS 0x803c0000u /* {n,m}+ repeat */
-#define META_MINMAX_QUERY 0x803d0000u /* {n,m}? repeat */
+#define META_ASTERISK 0x80340000u /* * */
+#define META_ASTERISK_PLUS 0x80350000u /* *+ */
+#define META_ASTERISK_QUERY 0x80360000u /* *? */
+#define META_PLUS 0x80370000u /* + */
+#define META_PLUS_PLUS 0x80380000u /* ++ */
+#define META_PLUS_QUERY 0x80390000u /* +? */
+#define META_QUERY 0x803a0000u /* ? */
+#define META_QUERY_PLUS 0x803b0000u /* ?+ */
+#define META_QUERY_QUERY 0x803c0000u /* ?? */
+#define META_MINMAX 0x803d0000u /* {n,m} repeat */
+#define META_MINMAX_PLUS 0x803e0000u /* {n,m}+ repeat */
+#define META_MINMAX_QUERY 0x803f0000u /* {n,m}? repeat */
#define META_FIRST_QUANTIFIER META_ASTERISK
#define META_LAST_QUANTIFIER META_MINMAX_QUERY
@@ -335,6 +343,8 @@ static unsigned char meta_extra_lengths[] = {
0, /* META_LOOKAHEADNOT */
SIZEOFFSET, /* META_LOOKBEHIND */
SIZEOFFSET, /* META_LOOKBEHINDNOT */
+ 0, /* META_LOOKAHEAD_NA */
+ SIZEOFFSET, /* META_LOOKBEHIND_NA */
1, /* META_MARK - plus the string length */
0, /* META_ACCEPT */
0, /* META_FAIL */
@@ -634,10 +644,14 @@ typedef struct alasitem {
static const char alasnames[] =
STRING_pla0
STRING_plb0
+ STRING_napla0
+ STRING_naplb0
STRING_nla0
STRING_nlb0
STRING_positive_lookahead0
STRING_positive_lookbehind0
+ STRING_non_atomic_positive_lookahead0
+ STRING_non_atomic_positive_lookbehind0
STRING_negative_lookahead0
STRING_negative_lookbehind0
STRING_atomic0
@@ -649,10 +663,14 @@ static const char alasnames[] =
static const alasitem alasmeta[] = {
{ 3, META_LOOKAHEAD },
{ 3, META_LOOKBEHIND },
+ { 5, META_LOOKAHEAD_NA },
+ { 5, META_LOOKBEHIND_NA },
{ 3, META_LOOKAHEADNOT },
{ 3, META_LOOKBEHINDNOT },
{ 18, META_LOOKAHEAD },
{ 19, META_LOOKBEHIND },
+ { 29, META_LOOKAHEAD_NA },
+ { 30, META_LOOKBEHIND_NA },
{ 18, META_LOOKAHEADNOT },
{ 19, META_LOOKBEHINDNOT },
{ 6, META_ATOMIC },
@@ -746,8 +764,8 @@ are allowed. */
#define PUBLIC_LITERAL_COMPILE_OPTIONS \
(PCRE2_ANCHORED|PCRE2_AUTO_CALLOUT|PCRE2_CASELESS|PCRE2_ENDANCHORED| \
- PCRE2_FIRSTLINE|PCRE2_LITERAL|PCRE2_NO_START_OPTIMIZE| \
- PCRE2_NO_UTF_CHECK|PCRE2_USE_OFFSET_LIMIT|PCRE2_UTF)
+ PCRE2_FIRSTLINE|PCRE2_LITERAL|PCRE2_MATCH_INVALID_UTF| \
+ PCRE2_NO_START_OPTIMIZE|PCRE2_NO_UTF_CHECK|PCRE2_USE_OFFSET_LIMIT|PCRE2_UTF)
#define PUBLIC_COMPILE_OPTIONS \
(PUBLIC_LITERAL_COMPILE_OPTIONS| \
@@ -781,7 +799,7 @@ enum { ERR0 = COMPILE_ERROR_BASE,
ERR61, ERR62, ERR63, ERR64, ERR65, ERR66, ERR67, ERR68, ERR69, ERR70,
ERR71, ERR72, ERR73, ERR74, ERR75, ERR76, ERR77, ERR78, ERR79, ERR80,
ERR81, ERR82, ERR83, ERR84, ERR85, ERR86, ERR87, ERR88, ERR89, ERR90,
- ERR91, ERR92, ERR93, ERR94, ERR95, ERR96 };
+ ERR91, ERR92, ERR93, ERR94, ERR95, ERR96, ERR97, ERR98 };
/* This is a table of start-of-pattern options such as (*UTF) and settings such
as (*LIMIT_MATCH=nnnn) and (*CRLF). For completeness and backward
@@ -1012,6 +1030,7 @@ for (;;)
case META_NOCAPTURE: fprintf(stderr, "META (?:"); break;
case META_LOOKAHEAD: fprintf(stderr, "META (?="); break;
case META_LOOKAHEADNOT: fprintf(stderr, "META (?!"); break;
+ case META_LOOKAHEAD_NA: fprintf(stderr, "META (*napla:"); break;
case META_SCRIPT_RUN: fprintf(stderr, "META (*sr:"); break;
case META_KET: fprintf(stderr, "META )"); break;
case META_ALT: fprintf(stderr, "META | %d", meta_arg); break;
@@ -1043,6 +1062,12 @@ for (;;)
fprintf(stderr, "%zd", offset);
break;
+ case META_LOOKBEHIND_NA:
+ fprintf(stderr, "META (*naplb: %d offset=", meta_arg);
+ GETOFFSET(offset, pptr);
+ fprintf(stderr, "%zd", offset);
+ break;
+
case META_LOOKBEHINDNOT:
fprintf(stderr, "META (?<! %d offset=", meta_arg);
GETOFFSET(offset, pptr);
@@ -1419,9 +1444,6 @@ the result is "not a repeat quantifier". */
EXIT:
if (yield || *errorcodeptr != 0) *ptrptr = p;
return yield;
-
-
-
}
@@ -2450,8 +2472,9 @@ must be last. */
enum { RANGE_NO, RANGE_STARTED, RANGE_OK_ESCAPED, RANGE_OK_LITERAL };
-/* Only in 32-bit mode can there be literals > META_END. A macros encapsulates
-the storing of literal values in the parsed pattern. */
+/* Only in 32-bit mode can there be literals > META_END. A macro encapsulates
+the storing of literal values in the main parsed pattern, where they can always
+be quantified. */
#if PCRE2_CODE_UNIT_WIDTH == 32
#define PARSED_LITERAL(c, p) \
@@ -2474,6 +2497,7 @@ uint32_t delimiter;
uint32_t namelen;
uint32_t class_range_state;
uint32_t *verblengthptr = NULL; /* Value avoids compiler warning */
+uint32_t *verbstartptr = NULL;
uint32_t *previous_callout = NULL;
uint32_t *parsed_pattern = cb->parsed_pattern;
uint32_t *parsed_pattern_end = cb->parsed_pattern_end;
@@ -2600,10 +2624,20 @@ while (ptr < ptrend)
errorcode = ERR28;
goto FAILED;
}
- if (!inverbname && after_manual_callout-- <= 0)
- parsed_pattern = manage_callouts(thisptr, &previous_callout,
- auto_callout, parsed_pattern, cb);
- PARSED_LITERAL(c, parsed_pattern);
+ if (inverbname)
+ { /* Don't use PARSED_LITERAL() because it */
+#if PCRE2_CODE_UNIT_WIDTH == 32 /* sets okquantifier. */
+ if (c >= META_END) *parsed_pattern++ = META_BIGVALUE;
+#endif
+ *parsed_pattern++ = c;
+ }
+ else
+ {
+ if (after_manual_callout-- <= 0)
+ parsed_pattern = manage_callouts(thisptr, &previous_callout,
+ auto_callout, parsed_pattern, cb);
+ PARSED_LITERAL(c, parsed_pattern);
+ }
meta_quantifier = 0;
}
continue; /* Next character */
@@ -2640,13 +2674,15 @@ while (ptr < ptrend)
switch(c)
{
- default:
- PARSED_LITERAL(c, parsed_pattern);
+ default: /* Don't use PARSED_LITERAL() because it */
+#if PCRE2_CODE_UNIT_WIDTH == 32 /* sets okquantifier. */
+ if (c >= META_END) *parsed_pattern++ = META_BIGVALUE;
+#endif
+ *parsed_pattern++ = c;
break;
case CHAR_RIGHT_PARENTHESIS:
inverbname = FALSE;
- okquantifier = FALSE; /* Was probably set by literals */
/* This is the length in characters */
verbnamelength = (PCRE2_SIZE)(parsed_pattern - verblengthptr - 1);
/* But the limit on the length is in code units */
@@ -2680,8 +2716,11 @@ while (ptr < ptrend)
switch(escape)
{
- case 0:
- PARSED_LITERAL(c, parsed_pattern);
+ case 0: /* Don't use PARSED_LITERAL() because it */
+#if PCRE2_CODE_UNIT_WIDTH == 32 /* sets okquantifier. */
+ if (c >= META_END) *parsed_pattern++ = META_BIGVALUE;
+#endif
+ *parsed_pattern++ = c;
break;
case ESC_Q:
@@ -3135,6 +3174,21 @@ while (ptr < ptrend)
goto FAILED_BACK;
}
+ /* Most (*VERB)s are not allowed to be quantified, but an ungreedy
+ quantifier can be useful for (*ACCEPT) - meaning "succeed on backtrack", a
+ sort of negated (*COMMIT). We therefore allow (*ACCEPT) to be quantified by
+ wrapping it in non-capturing brackets, but we have to allow for a preceding
+ (*MARK) for when (*ACCEPT) has an argument. */
+
+ if (parsed_pattern[-1] == META_ACCEPT)
+ {
+ uint32_t *p;
+ for (p = parsed_pattern - 1; p >= verbstartptr; p--) p[1] = p[0];
+ *verbstartptr = META_NOCAPTURE;
+ parsed_pattern[1] = META_KET;
+ parsed_pattern += 2;
+ }
+
/* Now we can put the quantifier into the parsed pattern vector. At this
stage, we have only the basic quantifier. The check for a following + or ?
modifier happens at the top of the loop, after any intervening comments
@@ -3581,6 +3635,8 @@ while (ptr < ptrend)
if (c == CHAR_RIGHT_SQUARE_BRACKET && !inescq) break;
} /* End of class-processing loop */
+ /* -] at the end of a class is a literal '-' */
+
if (class_range_state == RANGE_STARTED)
{
parsed_pattern[-1] = CHAR_MINUS;
@@ -3611,6 +3667,11 @@ while (ptr < ptrend)
nest_depth++;
if ((options & PCRE2_NO_AUTO_CAPTURE) == 0)
{
+ if (cb->bracount >= MAX_GROUP_NUMBER)
+ {
+ errorcode = ERR97;
+ goto FAILED;
+ }
cb->bracount++;
*parsed_pattern++ = META_CAPTURE | cb->bracount;
}
@@ -3658,19 +3719,20 @@ while (ptr < ptrend)
goto FAILED;
}
- /* Check for expecting an assertion condition. If so, only lookaround
- assertions are valid. */
+ /* Check for expecting an assertion condition. If so, only atomic
+ lookaround assertions are valid. */
meta = alasmeta[i].meta;
if (prev_expect_cond_assert > 0 &&
(meta < META_LOOKAHEAD || meta > META_LOOKBEHINDNOT))
{
- errorcode = ERR28; /* Assertion expected */
+ errorcode = (meta == META_LOOKAHEAD_NA || meta == META_LOOKBEHIND_NA)?
+ ERR98 : ERR28; /* (Atomic) assertion expected */
goto FAILED;
}
- /* The lookaround alphabetic synonyms can be almost entirely handled by
- jumping to the code that handles the traditional symbolic forms. */
+ /* The lookaround alphabetic synonyms can mostly be handled by jumping
+ to the code that handles the traditional symbolic forms. */
switch(meta)
{
@@ -3684,11 +3746,17 @@ while (ptr < ptrend)
case META_LOOKAHEAD:
goto POSITIVE_LOOK_AHEAD;
+ case META_LOOKAHEAD_NA:
+ *parsed_pattern++ = meta;
+ ptr++;
+ goto POST_ASSERTION;
+
case META_LOOKAHEADNOT:
goto NEGATIVE_LOOK_AHEAD;
case META_LOOKBEHIND:
case META_LOOKBEHINDNOT:
+ case META_LOOKBEHIND_NA:
*parsed_pattern++ = meta;
ptr--;
goto POST_LOOKBEHIND;
@@ -3770,6 +3838,12 @@ while (ptr < ptrend)
goto FAILED;
}
+ /* Remember where this verb, possibly with a preceding (*MARK), starts,
+ for handling quantified (*ACCEPT). */
+
+ verbstartptr = parsed_pattern;
+ okquantifier = (verbs[i].meta == META_ACCEPT);
+
/* It appears that Perl allows any characters whatsoever, other than a
closing parenthesis, to appear in arguments ("names"), so we no longer
insist on letters, digits, and underscores. Perl does not, however, do
@@ -4386,7 +4460,7 @@ while (ptr < ptrend)
*parsed_pattern++ = (ptr[1] == CHAR_EQUALS_SIGN)?
META_LOOKBEHIND : META_LOOKBEHINDNOT;
- POST_LOOKBEHIND: /* Come from (*plb: and (*nlb: */
+ POST_LOOKBEHIND: /* Come from (*plb: (*naplb: and (*nlb: */
*has_lookbehind = TRUE;
offset = (PCRE2_SIZE)(ptr - cb->start_pattern - 2);
PUTOFFSET(offset, parsed_pattern);
@@ -4435,6 +4509,11 @@ while (ptr < ptrend)
/* We have a name for this capturing group. It is also assigned a number,
which is its primary means of identification. */
+ if (cb->bracount >= MAX_GROUP_NUMBER)
+ {
+ errorcode = ERR97;
+ goto FAILED;
+ }
cb->bracount++;
*parsed_pattern++ = META_CAPTURE | cb->bracount;
nest_depth++;
@@ -4661,6 +4740,7 @@ for (;;)
case OP_ASSERT_NOT:
case OP_ASSERTBACK:
case OP_ASSERTBACK_NOT:
+ case OP_ASSERTBACK_NA:
if (!skipassert) return code;
do code += GET(code, 1); while (*code == OP_ALT);
code += PRIV(OP_lengths)[*code];
@@ -5221,8 +5301,10 @@ PCRE2_UCHAR *tempcode;
PCRE2_UCHAR *previous = NULL;
PCRE2_UCHAR op_previous;
BOOL groupsetfirstcu = FALSE;
+BOOL had_accept = FALSE;
BOOL matched_char = FALSE;
BOOL previous_matched_char = FALSE;
+BOOL reset_caseful = FALSE;
const uint8_t *cbits = cb->cbits;
uint8_t classbits[32];
@@ -5355,7 +5437,7 @@ for (;; pptr++)
if (meta < META_ASTERISK || meta > META_MINMAX_QUERY)
{
previous = code;
- if (matched_char) okreturn = 1;
+ if (matched_char && !had_accept) okreturn = 1;
}
previous_matched_char = matched_char;
@@ -5499,7 +5581,45 @@ for (;; pptr++)
} /* End of 1-char optimization */
/* Handle character classes that contain more than just one literal
- character. */
+ character. If there are exactly two characters in a positive class, see if
+ they are case partners. This can be optimized to generate a caseless single
+ character match (which also sets first/required code units if relevant). */
+
+ if (meta == META_CLASS && pptr[1] < META_END && pptr[2] < META_END &&
+ pptr[3] == META_CLASS_END)
+ {
+ uint32_t c = pptr[1];
+
+#ifdef SUPPORT_UNICODE
+ if (UCD_CASESET(c) == 0)
+#endif
+ {
+ uint32_t d;
+
+#ifdef SUPPORT_UNICODE
+ if (utf && c > 127) d = UCD_OTHERCASE(c); else
+#endif
+ {
+#if PCRE2_CODE_UNIT_WIDTH != 8
+ if (c > 255) d = c; else
+#endif
+ d = TABLE_GET(c, cb->fcc, c);
+ }
+
+ if (c != d && pptr[2] == d)
+ {
+ pptr += 3; /* Move on to class end */
+ meta = c;
+ if ((options & PCRE2_CASELESS) == 0)
+ {
+ reset_caseful = TRUE;
+ options |= PCRE2_CASELESS;
+ req_caseopt = REQ_CASELESS;
+ }
+ goto CLASS_CASELESS_CHAR;
+ }
+ }
+ }
/* If a non-extended class contains a negative special such as \S, we need
to flip the negation flag at the end, so that support for characters > 255
@@ -5994,7 +6114,7 @@ for (;; pptr++)
workspace overflow. Do not set firstcu after *ACCEPT. */
case META_ACCEPT:
- cb->had_accept = TRUE;
+ cb->had_accept = had_accept = TRUE;
for (oc = cb->open_caps;
oc != NULL && oc->assert_depth >= cb->assert_depth;
oc = oc->next)
@@ -6252,6 +6372,11 @@ for (;; pptr++)
cb->assert_depth += 1;
goto GROUP_PROCESS;
+ case META_LOOKAHEAD_NA:
+ bravalue = OP_ASSERT_NA;
+ cb->assert_depth += 1;
+ goto GROUP_PROCESS;
+
/* Optimize (?!) to (*FAIL) unless it is quantified - which is a weird
thing to do, but Perl allows all assertions to be quantified, and when
they contain capturing parentheses there may be a potential use for
@@ -6283,6 +6408,11 @@ for (;; pptr++)
cb->assert_depth += 1;
goto GROUP_PROCESS;
+ case META_LOOKBEHIND_NA:
+ bravalue = OP_ASSERTBACK_NA;
+ cb->assert_depth += 1;
+ goto GROUP_PROCESS;
+
case META_ATOMIC:
bravalue = OP_ONCE;
goto GROUP_PROCESS_NOTE_EMPTY;
@@ -6341,7 +6471,7 @@ for (;; pptr++)
/* If we've just compiled an assertion, pop the assert depth. */
- if (bravalue >= OP_ASSERT && bravalue <= OP_ASSERTBACK_NOT)
+ if (bravalue >= OP_ASSERT && bravalue <= OP_ASSERTBACK_NA)
cb->assert_depth -= 1;
/* At the end of compiling, code is still pointing to the start of the
@@ -6491,8 +6621,8 @@ for (;; pptr++)
we must only take the reqcu when the group also set a firstcu. Otherwise,
in that example, 'X' ends up set for both. */
- else if (bravalue == OP_ASSERT && subreqcuflags >= 0 &&
- subfirstcuflags >= 0)
+ else if ((bravalue == OP_ASSERT || bravalue == OP_ASSERT_NA) &&
+ subreqcuflags >= 0 && subfirstcuflags >= 0)
{
reqcu = subreqcu;
reqcuflags = subreqcuflags;
@@ -6713,10 +6843,6 @@ for (;; pptr++)
reqvary = (repeat_min == repeat_max)? 0 : REQ_VARY;
op_type = 0;
- /* If the repeat is {1} we can ignore it. */
-
- if (repeat_max == 1 && repeat_min == 1) goto END_REPEAT;
-
/* Adjust first and required code units for a zero repeat. */
if (repeat_min == 0)
@@ -6759,7 +6885,10 @@ for (;; pptr++)
tempcode = previous;
op_previous = *previous;
- /* Now handle repetition for the different types of item. */
+ /* Now handle repetition for the different types of item. If the repeat
+ minimum and the repeat maximum are both 1, we can ignore the quantifier for
+ non-parenthesized items, as they have only one alternative. For anything in
+ parentheses, we must not ignore if {1} is possessive. */
switch (op_previous)
{
@@ -6773,6 +6902,7 @@ for (;; pptr++)
case OP_CHARI:
case OP_NOT:
case OP_NOTI:
+ if (repeat_max == 1 && repeat_min == 1) goto END_REPEAT;
op_type = chartypeoffset[op_previous - OP_CHAR];
/* Deal with UTF characters that take up more than one code unit. */
@@ -6819,6 +6949,7 @@ for (;; pptr++)
code = previous;
goto END_REPEAT;
}
+ if (repeat_max == 1 && repeat_min == 1) goto END_REPEAT;
if (repeat_min == 0 && repeat_max == REPEAT_UNLIMITED)
*code++ = OP_CRSTAR + repeat_type;
@@ -6853,6 +6984,8 @@ for (;; pptr++)
repetition. */
case OP_RECURSE:
+ if (repeat_max == 1 && repeat_min == 1 && !possessive_quantifier)
+ goto END_REPEAT;
/* Generate unwrapped repeats for a non-zero minimum, except when the
minimum is 1 and the maximum unlimited, because that can be handled with
@@ -6923,8 +7056,10 @@ for (;; pptr++)
case OP_ASSERT:
case OP_ASSERT_NOT:
+ case OP_ASSERT_NA:
case OP_ASSERTBACK:
case OP_ASSERTBACK_NOT:
+ case OP_ASSERTBACK_NA:
case OP_ONCE:
case OP_SCRIPT_RUN:
case OP_BRA:
@@ -6935,6 +7070,9 @@ for (;; pptr++)
PCRE2_UCHAR *bralink = NULL;
PCRE2_UCHAR *brazeroptr = NULL;
+ if (repeat_max == 1 && repeat_min == 1 && !possessive_quantifier)
+ goto END_REPEAT;
+
/* Repeating a DEFINE group (or any group where the condition is always
FALSE and there is only one branch) is pointless, but Perl allows the
syntax, so we just ignore the repeat. */
@@ -7151,11 +7289,12 @@ for (;; pptr++)
and SCRIPT_RUN groups at runtime, but in a different way.]
Then, if the quantifier was possessive and the bracket is not a
- conditional, we convert the BRA code to the POS form, and the KET code to
- KETRPOS. (It turns out to be convenient at runtime to detect this kind of
- subpattern at both the start and at the end.) The use of special opcodes
- makes it possible to reduce greatly the stack usage in pcre2_match(). If
- the group is preceded by OP_BRAZERO, convert this to OP_BRAPOSZERO.
+ conditional, we convert the BRA code to the POS form, and the KET code
+ to KETRPOS. (It turns out to be convenient at runtime to detect this
+ kind of subpattern at both the start and at the end.) The use of
+ special opcodes makes it possible to reduce greatly the stack usage in
+ pcre2_match(). If the group is preceded by OP_BRAZERO, convert this to
+ OP_BRAPOSZERO.
Then, if the minimum number of matches is 1 or 0, cancel the possessive
flag so that the default action below, of wrapping everything inside
@@ -7256,6 +7395,8 @@ for (;; pptr++)
int prop_type, prop_value;
PCRE2_UCHAR *oldcode;
+ if (repeat_max == 1 && repeat_min == 1) goto END_REPEAT;
+
op_type = OP_TYPESTAR - OP_STAR; /* Use type opcodes */
mclength = 0; /* Not a character */
@@ -7718,9 +7859,15 @@ for (;; pptr++)
}
#endif
- /* Caseful matches, or not one of the multicase characters. Get the
- character's code units into mcbuffer, with the length in mclength. When not
- in UTF mode, the length is always 1. */
+ /* Caseful matches, or caseless and not one of the multicase characters. We
+ come here by goto in the case of a positive class that contains only
+ case-partners of a character with just two cases; matched_char has already
+ been set TRUE and options fudged if necessary. */
+
+ CLASS_CASELESS_CHAR:
+
+ /* Get the character's code units into mcbuffer, with the length in
+ mclength. When not in UTF mode, the length is always 1. */
#ifdef SUPPORT_UNICODE
if (utf) mclength = PRIV(ord2utf)(meta, mcbuffer); else
@@ -7752,8 +7899,9 @@ for (;; pptr++)
zeroreqcu = reqcu;
zeroreqcuflags = reqcuflags;
- /* If the character is more than one code unit long, we can set firstcu
- only if it is not to be matched caselessly. */
+ /* If the character is more than one code unit long, we can set a single
+ firstcu only if it is not to be matched caselessly. Multiple possible
+ starting code units may be picked up later in the studying code. */
if (mclength == 1 || req_caseopt == 0)
{
@@ -7783,7 +7931,17 @@ for (;; pptr++)
reqcuflags = req_caseopt | cb->req_varyopt;
}
}
- break; /* End default meta handling */
+
+ /* If caselessness was temporarily instated, reset it. */
+
+ if (reset_caseful)
+ {
+ options &= ~PCRE2_CASELESS;
+ req_caseopt = 0;
+ reset_caseful = FALSE;
+ }
+
+ break; /* End literal character handling */
} /* End of big switch */
} /* End of big loop */
@@ -7874,7 +8032,10 @@ length = 2 + 2*LINK_SIZE + skipunits;
/* Remember if this is a lookbehind assertion, and if it is, save its length
and skip over the pattern offset. */
-lookbehind = *code == OP_ASSERTBACK || *code == OP_ASSERTBACK_NOT;
+lookbehind = *code == OP_ASSERTBACK ||
+ *code == OP_ASSERTBACK_NOT ||
+ *code == OP_ASSERTBACK_NA;
+
if (lookbehind)
{
lookbehindlength = META_DATA(pptr[-1]);
@@ -7948,7 +8109,7 @@ for (;;)
/* If this is not the first branch, the first char and reqcu have to
match the values from all the previous branches, except that if the
previous value for reqcu didn't have REQ_VARY set, it can still match,
- and we set REQ_VARY for the regex. */
+ and we set REQ_VARY for the group from this branch's value. */
else
{
@@ -7987,7 +8148,7 @@ for (;;)
else
{
reqcu = branchreqcu;
- reqcuflags |= branchreqcuflags; /* To "or" REQ_VARY */
+ reqcuflags |= branchreqcuflags; /* To "or" REQ_VARY if present */
}
}
}
@@ -8167,7 +8328,7 @@ do {
/* Positive forward assertion */
- else if (op == OP_ASSERT)
+ else if (op == OP_ASSERT || op == OP_ASSERT_NA)
{
if (!is_anchored(scode, bracket_map, cb, atomcount, TRUE)) return FALSE;
}
@@ -8305,7 +8466,7 @@ do {
/* Positive forward assertions */
- else if (op == OP_ASSERT)
+ else if (op == OP_ASSERT || op == OP_ASSERT_NA)
{
if (!is_startline(scode, bracket_map, cb, atomcount, TRUE))
return FALSE;
@@ -8547,9 +8708,11 @@ do {
case OP_CBRAPOS:
case OP_SCBRAPOS:
case OP_ASSERT:
+ case OP_ASSERT_NA:
case OP_ONCE:
case OP_SCRIPT_RUN:
- d = find_firstassertedcu(scode, &dflags, inassert + ((op==OP_ASSERT)?1:0));
+ d = find_firstassertedcu(scode, &dflags, inassert +
+ ((op == OP_ASSERT || op == OP_ASSERT_NA)?1:0));
if (dflags < 0)
return 0;
if (cflags < 0) { c = d; cflags = dflags; }
@@ -8578,6 +8741,19 @@ do {
case OP_MINPLUSI:
case OP_POSPLUSI:
if (inassert == 0) return 0;
+
+ /* If the character is more than one code unit long, we cannot set its
+ first code unit when matching caselessly. Later scanning may pick up
+ multiple code units. */
+
+#ifdef SUPPORT_UNICODE
+#if PCRE2_CODE_UNIT_WIDTH == 8
+ if (scode[1] >= 0x80) return 0;
+#elif PCRE2_CODE_UNIT_WIDTH == 16
+ if (scode[1] >= 0xd800 && scode[1] <= 0xdfff) return 0;
+#endif
+#endif
+
if (cflags < 0) { c = scode[1]; cflags = REQ_CASELESS; }
else if (c != scode[1]) return 0;
break;
@@ -8745,8 +8921,10 @@ for (;; pptr++)
case META_COND_VERSION:
case META_LOOKAHEAD:
case META_LOOKAHEADNOT:
+ case META_LOOKAHEAD_NA:
case META_LOOKBEHIND:
case META_LOOKBEHINDNOT:
+ case META_LOOKBEHIND_NA:
case META_NOCAPTURE:
case META_SCRIPT_RUN:
nestlevel++;
@@ -8798,7 +8976,7 @@ Returns: the group length or a negative number
static int
get_grouplength(uint32_t **pptrptr, BOOL isinline, int *errcodeptr, int *lcptr,
- int group, parsed_recurse_check *recurses, compile_block *cb)
+ int group, parsed_recurse_check *recurses, compile_block *cb)
{
int branchlength;
int grouplength = -1;
@@ -8847,8 +9025,7 @@ return -1;
*************************************************/
/* Return a fixed length for a branch in a lookbehind, giving an error if the
-length is not fixed. If any lookbehinds are encountered on the way, they get
-their length set. On entry, *pptrptr points to the first element inside the
+length is not fixed. On entry, *pptrptr points to the first element inside the
branch. On exit it is set to point to the ALT or KET.
Arguments:
@@ -8978,15 +9155,16 @@ for (;; pptr++)
}
break;
- /* Lookaheads can be ignored, but we must start the skip inside the group
- so that it isn't treated as a group within the branch. */
+ /* Lookaheads do not contribute to the length of this branch, but they may
+ contain lookbehinds within them whose lengths need to be set. */
case META_LOOKAHEAD:
case META_LOOKAHEADNOT:
- pptr = parsed_skip(pptr + 1, PSKIP_KET);
- if (pptr == NULL) goto PARSED_SKIP_FAILED;
+ case META_LOOKAHEAD_NA:
+ *errcodeptr = check_lookbehinds(pptr + 1, &pptr, recurses, cb);
+ if (*errcodeptr != 0) return -1;
- /* Also ignore any qualifiers that follow a lookahead assertion. */
+ /* Ignore any qualifiers that follow a lookahead assertion. */
switch (pptr[1])
{
@@ -9013,10 +9191,12 @@ for (;; pptr++)
}
break;
- /* Lookbehinds can be ignored, but must themselves be checked. */
+ /* A nested lookbehind does not contribute any length to this lookbehind,
+ but must itself be checked and have its lengths set. */
case META_LOOKBEHIND:
case META_LOOKBEHINDNOT:
+ case META_LOOKBEHIND_NA:
if (!set_lookbehind_lengths(&pptr, errcodeptr, lcptr, recurses, cb))
return -1;
break;
@@ -9178,8 +9358,26 @@ for (;; pptr++)
case META_MINMAX_QUERY:
if (pptr[1] == pptr[2])
{
- if (pptr[1] == 0) branchlength -= lastitemlength;
- else itemlength = (pptr[1] - 1) * lastitemlength;
+ switch(pptr[1])
+ {
+ case 0:
+ branchlength -= lastitemlength;
+ break;
+
+ case 1:
+ itemlength = 0;
+ break;
+
+ default: /* Check for integer overflow */
+ if (lastitemlength != 0 && /* Should not occur, but just in case */
+ INT_MAX/lastitemlength < pptr[1] - 1)
+ {
+ *errcodeptr = ERR87; /* Integer overflow; lookbehind too big */
+ return -1;
+ }
+ itemlength = (pptr[1] - 1) * lastitemlength;
+ break;
+ }
pptr += 2;
break;
}
@@ -9193,24 +9391,23 @@ for (;; pptr++)
return -1;
}
- /* Add the item length to the branchlength, and save it for use if the next
- thing is a quantifier. */
-
- branchlength += itemlength;
- lastitemlength = itemlength;
-
- /* Ensure that the length does not overflow the limit. */
+ /* Add the item length to the branchlength, checking for integer overflow and
+ for the branch length exceeding the limit. */
- if (branchlength > LOOKBEHIND_MAX)
+ if (INT_MAX - branchlength < (int)itemlength ||
+ (branchlength += itemlength) > LOOKBEHIND_MAX)
{
*errcodeptr = ERR87;
return -1;
}
+
+ /* Save this item length for use if the next item is a quantifier. */
+
+ lastitemlength = itemlength;
}
EXIT:
*pptrptr = pptr;
-if (branchlength > cb->max_lookbehind) cb->max_lookbehind = branchlength;
return branchlength;
PARSED_SKIP_FAILED:
@@ -9229,6 +9426,11 @@ branches. An error occurs if any branch does not have a fixed length that is
less than the maximum (65535). On exit, the pointer must be left on the final
ket.
+The function also maintains the max_lookbehind value. Any lookbehind branch
+that contains a nested lookbehind may actually look further back than the
+length of the branch. The additional amount is passed back from
+get_branchlength() as an "extra" value.
+
Arguments:
pptrptr pointer to pointer in the parsed pattern
errcodeptr pointer to error code
@@ -9262,6 +9464,7 @@ do
if (cb->erroroffset == PCRE2_UNSET) cb->erroroffset = offset;
return FALSE;
}
+ if (branchlength > cb->max_lookbehind) cb->max_lookbehind = branchlength;
*bptr |= branchlength; /* branchlength never more than 65535 */
bptr = *pptrptr;
}
@@ -9282,20 +9485,30 @@ set_lookbehind_lengths() for each one. At the start, the errorcode is zero and
the error offset is marked unset. The enables the functions above not to
override settings from deeper nestings.
-Arguments cb points to the compile block
-Returns: 0 on success, or an errorcode (cb->erroroffset will be set)
+This function is called recursively from get_branchlength() for lookaheads in
+order to process any lookbehinds that they may contain. It stops when it hits a
+non-nested closing parenthesis in this case, returning a pointer to it.
+
+Arguments
+ pptr points to where to start (start of pattern or start of lookahead)
+ retptr if not NULL, return the ket pointer here
+ recurses chain of recurse_check to catch mutual recursion
+ cb points to the compile block
+
+Returns: 0 on success, or an errorcode (cb->erroroffset will be set)
*/
static int
-check_lookbehinds(compile_block *cb)
+check_lookbehinds(uint32_t *pptr, uint32_t **retptr,
+ parsed_recurse_check *recurses, compile_block *cb)
{
-uint32_t *pptr;
int errorcode = 0;
int loopcount = 0;
+int nestlevel = 0;
cb->erroroffset = PCRE2_UNSET;
-for (pptr = cb->parsed_pattern; *pptr != META_END; pptr++)
+for (; *pptr != META_END; pptr++)
{
if (*pptr < META_END) continue; /* Literal */
@@ -9309,14 +9522,31 @@ for (pptr = cb->parsed_pattern; *pptr != META_END; pptr++)
pptr += 1;
break;
+ case META_KET:
+ if (--nestlevel < 0)
+ {
+ if (retptr != NULL) *retptr = pptr;
+ return 0;
+ }
+ break;
+
+ case META_ATOMIC:
+ case META_CAPTURE:
+ case META_COND_ASSERT:
+ case META_LOOKAHEAD:
+ case META_LOOKAHEADNOT:
+ case META_LOOKAHEAD_NA:
+ case META_NOCAPTURE:
+ case META_SCRIPT_RUN:
+ nestlevel++;
+ break;
+
case META_ACCEPT:
case META_ALT:
case META_ASTERISK:
case META_ASTERISK_PLUS:
case META_ASTERISK_QUERY:
- case META_ATOMIC:
case META_BACKREF:
- case META_CAPTURE:
case META_CIRCUMFLEX:
case META_CLASS:
case META_CLASS_EMPTY:
@@ -9324,14 +9554,9 @@ for (pptr = cb->parsed_pattern; *pptr != META_END; pptr++)
case META_CLASS_END:
case META_CLASS_NOT:
case META_COMMIT:
- case META_COND_ASSERT:
case META_DOLLAR:
case META_DOT:
case META_FAIL:
- case META_KET:
- case META_LOOKAHEAD:
- case META_LOOKAHEADNOT:
- case META_NOCAPTURE:
case META_PLUS:
case META_PLUS_PLUS:
case META_PLUS_QUERY:
@@ -9341,7 +9566,6 @@ for (pptr = cb->parsed_pattern; *pptr != META_END; pptr++)
case META_QUERY_QUERY:
case META_RANGE_ESCAPED:
case META_RANGE_LITERAL:
- case META_SCRIPT_RUN:
case META_SKIP:
case META_THEN:
break;
@@ -9351,13 +9575,22 @@ for (pptr = cb->parsed_pattern; *pptr != META_END; pptr++)
break;
case META_BACKREF_BYNAME:
+ case META_RECURSE_BYNAME:
+ pptr += 1 + SIZEOFFSET;
+ break;
+
case META_COND_DEFINE:
case META_COND_NAME:
case META_COND_NUMBER:
case META_COND_RNAME:
case META_COND_RNUMBER:
- case META_RECURSE_BYNAME:
pptr += 1 + SIZEOFFSET;
+ nestlevel++;
+ break;
+
+ case META_COND_VERSION:
+ pptr += 3;
+ nestlevel++;
break;
case META_CALLOUT_STRING:
@@ -9378,7 +9611,6 @@ for (pptr = cb->parsed_pattern; *pptr != META_END; pptr++)
break;
case META_CALLOUT_NUMBER:
- case META_COND_VERSION:
pptr += 3;
break;
@@ -9392,7 +9624,8 @@ for (pptr = cb->parsed_pattern; *pptr != META_END; pptr++)
case META_LOOKBEHIND:
case META_LOOKBEHINDNOT:
- if (!set_lookbehind_lengths(&pptr, &errorcode, &loopcount, NULL, cb))
+ case META_LOOKBEHIND_NA:
+ if (!set_lookbehind_lengths(&pptr, &errorcode, &loopcount, recurses, cb))
return errorcode;
break;
}
@@ -9494,6 +9727,10 @@ if (pattern == NULL)
if (ccontext == NULL)
ccontext = (pcre2_compile_context *)(&PRIV(default_compile_context));
+/* PCRE2_MATCH_INVALID_UTF implies UTF */
+
+if ((options & PCRE2_MATCH_INVALID_UTF) != 0) options |= PCRE2_UTF;
+
/* Check that all undefined public option bits are zero. */
if ((options & ~PUBLIC_COMPILE_OPTIONS) != 0 ||
@@ -9672,7 +9909,7 @@ if ((options & PCRE2_LITERAL) == 0)
ptr += skipatstart;
-/* Can't support UTF or UCP unless PCRE2 has been compiled with UTF support. */
+/* Can't support UTF or UCP if PCRE2 was built without Unicode support. */
#ifndef SUPPORT_UNICODE
if ((cb.external_options & (PCRE2_UTF|PCRE2_UCP)) != 0)
@@ -9842,7 +10079,7 @@ lengths. */
if (has_lookbehind)
{
- errorcode = check_lookbehinds(&cb);
+ errorcode = check_lookbehinds(cb.parsed_pattern, NULL, NULL, &cb);
if (errorcode != 0) goto HAD_CB_ERROR;
}
@@ -9990,8 +10227,9 @@ re->max_lookbehind = cb.max_lookbehind;
if (cb.had_accept)
{
- reqcu = 0; /* Must disable after (*ACCEPT) */
+ reqcu = 0; /* Must disable after (*ACCEPT) */
reqcuflags = REQ_NONE;
+ re->flags |= PCRE2_HASACCEPT; /* Disables minimum length */
}
/* Fill in the final opcode and check for disastrous overflow. If no overflow,
@@ -10112,6 +10350,8 @@ unit. */
if ((re->overall_options & PCRE2_NO_START_OPTIMIZE) == 0)
{
+ int minminlength = 0; /* For minimal minlength from first/required CU */
+
/* If we do not have a first code unit, see if there is one that is asserted
(these are not saved during the compile because they can cause conflicts with
actual literals that follow). */
@@ -10119,12 +10359,14 @@ if ((re->overall_options & PCRE2_NO_START_OPTIMIZE) == 0)
if (firstcuflags < 0)
firstcu = find_firstassertedcu(codestart, &firstcuflags, 0);
- /* Save the data for a first code unit. */
+ /* Save the data for a first code unit. The existence of one means the
+ minimum length must be at least 1. */
if (firstcuflags >= 0)
{
re->first_codeunit = firstcu;
re->flags |= PCRE2_FIRSTSET;
+ minminlength++;
/* Handle caseless first code units. */
@@ -10158,39 +10400,72 @@ if ((re->overall_options & PCRE2_NO_START_OPTIMIZE) == 0)
is_startline(codestart, 0, &cb, 0, FALSE))
re->flags |= PCRE2_STARTLINE;
- /* Handle the "required code unit", if one is set. In the case of an anchored
- pattern, do this only if it follows a variable length item in the pattern. */
+ /* Handle the "required code unit", if one is set. In the UTF case we can
+ increment the minimum minimum length only if we are sure this really is a
+ different character and not a non-starting code unit of the first character,
+ because the minimum length count is in characters, not code units. */
- if (reqcuflags >= 0 &&
- ((re->overall_options & PCRE2_ANCHORED) == 0 ||
- (reqcuflags & REQ_VARY) != 0))
+ if (reqcuflags >= 0)
{
- re->last_codeunit = reqcu;
- re->flags |= PCRE2_LASTSET;
+#if PCRE2_CODE_UNIT_WIDTH == 16
+ if ((re->overall_options & PCRE2_UTF) == 0 || /* Not UTF */
+ firstcuflags < 0 || /* First not set */
+ (firstcu & 0xf800) != 0xd800 || /* First not surrogate */
+ (reqcu & 0xfc00) != 0xdc00) /* Req not low surrogate */
+#elif PCRE2_CODE_UNIT_WIDTH == 8
+ if ((re->overall_options & PCRE2_UTF) == 0 || /* Not UTF */
+ firstcuflags < 0 || /* First not set */
+ (firstcu & 0x80) == 0 || /* First is ASCII */
+ (reqcu & 0x80) == 0) /* Req is ASCII */
+#endif
+ {
+ minminlength++;
+ }
- /* Handle caseless required code units as for first code units (above). */
+ /* In the case of an anchored pattern, set up the value only if it follows
+ a variable length item in the pattern. */
- if ((reqcuflags & REQ_CASELESS) != 0)
+ if ((re->overall_options & PCRE2_ANCHORED) == 0 ||
+ (reqcuflags & REQ_VARY) != 0)
{
- if (reqcu < 128 || (!utf && reqcu < 255))
+ re->last_codeunit = reqcu;
+ re->flags |= PCRE2_LASTSET;
+
+ /* Handle caseless required code units as for first code units (above). */
+
+ if ((reqcuflags & REQ_CASELESS) != 0)
{
- if (cb.fcc[reqcu] != reqcu) re->flags |= PCRE2_LASTCASELESS;
- }
+ if (reqcu < 128 || (!utf && reqcu < 255))
+ {
+ if (cb.fcc[reqcu] != reqcu) re->flags |= PCRE2_LASTCASELESS;
+ }
#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 8
- else if (reqcu <= MAX_UTF_CODE_POINT && UCD_OTHERCASE(reqcu) != reqcu)
- re->flags |= PCRE2_LASTCASELESS;
+ else if (reqcu <= MAX_UTF_CODE_POINT && UCD_OTHERCASE(reqcu) != reqcu)
+ re->flags |= PCRE2_LASTCASELESS;
#endif
+ }
}
}
- /* Finally, study the compiled pattern to set up information such as a bitmap
- of starting code units and a minimum matching length. */
+ /* Study the compiled pattern to set up information such as a bitmap of
+ starting code units and a minimum matching length. */
if (PRIV(study)(re) != 0)
{
errorcode = ERR31;
goto HAD_CB_ERROR;
}
+
+ /* If study() set a bitmap of starting code units, it implies a minimum
+ length of at least one. */
+
+ if ((re->flags & PCRE2_FIRSTMAPSET) != 0 && minminlength == 0)
+ minminlength = 1;
+
+ /* If the minimum length set (or not set) by study() is less than the minimum
+ implied by required code units, override it. */
+
+ if (re->minlength < minminlength) re->minlength = minminlength;
} /* End of start-of-match optimizations. */
/* Control ends up here in all cases. When running under valgrind, make a
diff --git a/ext/pcre/pcre2lib/pcre2_context.c b/ext/pcre/pcre2lib/pcre2_context.c
index 9c2886a6d0..f904a494a0 100644
--- a/ext/pcre/pcre2lib/pcre2_context.c
+++ b/ext/pcre/pcre2lib/pcre2_context.c
@@ -323,7 +323,7 @@ data. */
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_set_character_tables(pcre2_compile_context *ccontext,
- const unsigned char *tables)
+ const uint8_t *tables)
{
ccontext->tables = tables;
return 0;
diff --git a/ext/pcre/pcre2lib/pcre2_dfa_match.c b/ext/pcre/pcre2lib/pcre2_dfa_match.c
index bbf3e21064..7d8ffe8a3e 100644
--- a/ext/pcre/pcre2lib/pcre2_dfa_match.c
+++ b/ext/pcre/pcre2lib/pcre2_dfa_match.c
@@ -173,6 +173,8 @@ static const uint8_t coptable[] = {
0, /* Assert not */
0, /* Assert behind */
0, /* Assert behind not */
+ 0, /* NA assert */
+ 0, /* NA assert behind */
0, /* ONCE */
0, /* SCRIPT_RUN */
0, 0, 0, 0, 0, /* BRA, BRAPOS, CBRA, CBRAPOS, COND */
@@ -248,6 +250,8 @@ static const uint8_t poptable[] = {
0, /* Assert not */
0, /* Assert behind */
0, /* Assert behind not */
+ 0, /* NA assert */
+ 0, /* NA assert behind */
0, /* ONCE */
0, /* SCRIPT_RUN */
0, 0, 0, 0, 0, /* BRA, BRAPOS, CBRA, CBRAPOS, COND */
@@ -962,7 +966,7 @@ for (;;)
if (ptr >= end_subject)
{
if ((mb->moptions & PCRE2_PARTIAL_HARD) != 0)
- could_continue = TRUE;
+ return PCRE2_ERROR_PARTIAL;
else { ADD_ACTIVE(state_offset + 1, 0); }
}
break;
@@ -1011,10 +1015,12 @@ for (;;)
/*-----------------------------------------------------------------*/
case OP_EODN:
- if (clen == 0 && (mb->moptions & PCRE2_PARTIAL_HARD) != 0)
- could_continue = TRUE;
- else if (clen == 0 || (IS_NEWLINE(ptr) && ptr == end_subject - mb->nllen))
- { ADD_ACTIVE(state_offset + 1, 0); }
+ if (clen == 0 || (IS_NEWLINE(ptr) && ptr == end_subject - mb->nllen))
+ {
+ if ((mb->moptions & PCRE2_PARTIAL_HARD) != 0)
+ return PCRE2_ERROR_PARTIAL;
+ ADD_ACTIVE(state_offset + 1, 0);
+ }
break;
/*-----------------------------------------------------------------*/
@@ -3152,8 +3158,8 @@ for (;;)
/* We have finished the processing at the current subject character. If no
new states have been set for the next character, we have found all the
- matches that we are going to find. If we are at the top level and partial
- matching has been requested, check for appropriate conditions.
+ matches that we are going to find. If partial matching has been requested,
+ check for appropriate conditions.
The "forced_ fail" variable counts the number of (*F) encountered for the
character. If it is equal to the original active_count (saved in
@@ -3165,22 +3171,24 @@ for (;;)
if (new_count <= 0)
{
- if (rlevel == 1 && /* Top level, and */
- could_continue && /* Some could go on, and */
+ if (could_continue && /* Some could go on, and */
forced_fail != workspace[1] && /* Not all forced fail & */
( /* either... */
(mb->moptions & PCRE2_PARTIAL_HARD) != 0 /* Hard partial */
|| /* or... */
((mb->moptions & PCRE2_PARTIAL_SOFT) != 0 && /* Soft partial and */
- match_count < 0) /* no matches */
+ match_count < 0) /* no matches */
) && /* And... */
(
- partial_newline || /* Either partial NL */
- ( /* or ... */
- ptr >= end_subject && /* End of subject and */
- ptr > mb->start_used_ptr) /* Inspected non-empty string */
+ partial_newline || /* Either partial NL */
+ ( /* or ... */
+ ptr >= end_subject && /* End of subject and */
+ ( /* either */
+ ptr > mb->start_used_ptr || /* Inspected non-empty string */
+ mb->allowemptypartial /* or pattern has lookbehind */
+ ) /* or could match empty */
)
- )
+ ))
match_count = PCRE2_ERROR_PARTIAL;
break; /* Exit from loop along the subject string */
}
@@ -3246,6 +3254,11 @@ BOOL utf, anchored, startline, firstline;
BOOL has_first_cu = FALSE;
BOOL has_req_cu = FALSE;
+#if PCRE2_CODE_UNIT_WIDTH == 8
+BOOL memchr_not_found_first_cu = FALSE;
+BOOL memchr_not_found_first_cu2 = FALSE;
+#endif
+
PCRE2_UCHAR first_cu = 0;
PCRE2_UCHAR first_cu2 = 0;
PCRE2_UCHAR req_cu = 0;
@@ -3295,6 +3308,11 @@ if ((options & (PCRE2_PARTIAL_HARD|PCRE2_PARTIAL_SOFT)) != 0 &&
((re->overall_options | options) & PCRE2_ENDANCHORED) != 0)
return PCRE2_ERROR_BADOPTION;
+/* Invalid UTF support is not available for DFA matching. */
+
+if ((re->overall_options & PCRE2_MATCH_INVALID_UTF) != 0)
+ return PCRE2_ERROR_DFA_UINVALID_UTF;
+
/* Check that the first field in the block is the magic number. If it is not,
return with PCRE2_ERROR_BADMAGIC. */
@@ -3404,6 +3422,8 @@ mb->tables = re->tables;
mb->start_subject = subject;
mb->end_subject = end_subject;
mb->start_offset = start_offset;
+mb->allowemptypartial = (re->max_lookbehind > 0) ||
+ (re->flags & PCRE2_MATCH_EMPTY) != 0;
mb->moptions = options;
mb->poptions = re->overall_options;
mb->match_call_count = 0;
@@ -3619,7 +3639,10 @@ for (;;)
/* Not anchored. Advance to a unique first code unit if there is one. In
8-bit mode, the use of memchr() gives a big speed up, even though we have
to call it twice in caseless mode, in order to find the earliest occurrence
- of the character in either of its cases. */
+ of the character in either of its cases. If a call to memchr() that
+ searches the rest of the subject fails to find one case, remember that in
+ order not to keep on repeating the search. This can make a huge difference
+ when the strings are very long and only one case is present. */
else
{
@@ -3633,11 +3656,29 @@ for (;;)
(smc = UCHAR21TEST(start_match)) != first_cu &&
smc != first_cu2)
start_match++;
+
#else /* 8-bit code units */
- PCRE2_SPTR pp1 =
- memchr(start_match, first_cu, end_subject-start_match);
- PCRE2_SPTR pp2 =
- memchr(start_match, first_cu2, end_subject-start_match);
+ PCRE2_SPTR pp1 = NULL;
+ PCRE2_SPTR pp2 = NULL;
+ PCRE2_SIZE cu2size = end_subject - start_match;
+
+ if (!memchr_not_found_first_cu)
+ {
+ pp1 = memchr(start_match, first_cu, end_subject - start_match);
+ if (pp1 == NULL) memchr_not_found_first_cu = TRUE;
+ else cu2size = pp1 - start_match;
+ }
+
+ /* If pp1 is not NULL, we have arranged to search only as far as pp1,
+ to see if the other case is earlier, so we can set "not found" only
+ when both searches have returned NULL. */
+
+ if (!memchr_not_found_first_cu2)
+ {
+ pp2 = memchr(start_match, first_cu2, cu2size);
+ memchr_not_found_first_cu2 = (pp2 == NULL && pp1 == NULL);
+ }
+
if (pp1 == NULL)
start_match = (pp2 == NULL)? end_subject : pp2;
else
@@ -3653,7 +3694,7 @@ for (;;)
while (start_match < end_subject && UCHAR21TEST(start_match) !=
first_cu)
start_match++;
-#else
+#else /* 8-bit code units */
start_match = memchr(start_match, first_cu, end_subject - start_match);
if (start_match == NULL) start_match = end_subject;
#endif
@@ -3740,6 +3781,8 @@ for (;;)
if ((mb->moptions & (PCRE2_PARTIAL_HARD|PCRE2_PARTIAL_SOFT)) == 0)
{
+ PCRE2_SPTR p;
+
/* The minimum matching length is a lower bound; no actual string of that
length may actually match the pattern. Although the value is, strictly,
in characters, we treat it as code units to avoid spending too much time
@@ -3753,37 +3796,63 @@ for (;;)
point. This optimization can save a huge amount of backtracking in
patterns with nested unlimited repeats that aren't going to match.
Writing separate code for cased/caseless versions makes it go faster, as
- does using an autoincrement and backing off on a match.
+ does using an autoincrement and backing off on a match. As in the case of
+ the first code unit, using memchr() in the 8-bit library gives a big
+ speed up. Unlike the first_cu check above, we do not need to call
+ memchr() twice in the caseless case because we only need to check for the
+ presence of the character in either case, not find the first occurrence.
+
+ The search can be skipped if the code unit was found later than the
+ current starting point in a previous iteration of the bumpalong loop.
HOWEVER: when the subject string is very, very long, searching to its end
can take a long time, and give bad performance on quite ordinary
patterns. This showed up when somebody was matching something like
/^\d+C/ on a 32-megabyte string... so we don't do this when the string is
- sufficiently long. */
+ sufficiently long, but it's worth searching a lot more for unanchored
+ patterns. */
- if (has_req_cu && end_subject - start_match < REQ_CU_MAX)
+ p = start_match + (has_first_cu? 1:0);
+ if (has_req_cu && p > req_cu_ptr)
{
- PCRE2_SPTR p = start_match + (has_first_cu? 1:0);
-
- /* We don't need to repeat the search if we haven't yet reached the
- place we found it at last time. */
+ PCRE2_SIZE check_length = end_subject - start_match;
- if (p > req_cu_ptr)
+ if (check_length < REQ_CU_MAX ||
+ (!anchored && check_length < REQ_CU_MAX * 1000))
{
- if (req_cu != req_cu2)
+ if (req_cu != req_cu2) /* Caseless */
{
+#if PCRE2_CODE_UNIT_WIDTH != 8
while (p < end_subject)
{
uint32_t pp = UCHAR21INCTEST(p);
if (pp == req_cu || pp == req_cu2) { p--; break; }
}
+#else /* 8-bit code units */
+ PCRE2_SPTR pp = p;
+ p = memchr(pp, req_cu, end_subject - pp);
+ if (p == NULL)
+ {
+ p = memchr(pp, req_cu2, end_subject - pp);
+ if (p == NULL) p = end_subject;
+ }
+#endif /* PCRE2_CODE_UNIT_WIDTH != 8 */
}
+
+ /* The caseful case */
+
else
{
+#if PCRE2_CODE_UNIT_WIDTH != 8
while (p < end_subject)
{
if (UCHAR21INCTEST(p) == req_cu) { p--; break; }
}
+
+#else /* 8-bit code units */
+ p = memchr(p, req_cu, end_subject - p);
+ if (p == NULL) p = end_subject;
+#endif
}
/* If we can't find the required code unit, break the matching loop,
diff --git a/ext/pcre/pcre2lib/pcre2_error.c b/ext/pcre/pcre2lib/pcre2_error.c
index 1d02cf14a3..c61648cb7f 100644
--- a/ext/pcre/pcre2lib/pcre2_error.c
+++ b/ext/pcre/pcre2lib/pcre2_error.c
@@ -184,6 +184,8 @@ static const unsigned char compile_error_texts[] =
/* 95 */
"(*alpha_assertion) not recognized\0"
"script runs require Unicode support, which this version of PCRE2 does not have\0"
+ "too many capturing groups (maximum 65535)\0"
+ "atomic assertion expected after (?( or (?(?C)\0"
;
/* Match-time and UTF error texts are in the same format. */
@@ -268,6 +270,7 @@ static const unsigned char match_error_texts[] =
"invalid syntax\0"
/* 65 */
"internal error - duplicate substitution match\0"
+ "PCRE2_MATCH_INVALID_UTF is not supported for DFA matching\0"
;
diff --git a/ext/pcre/pcre2lib/pcre2_internal.h b/ext/pcre/pcre2lib/pcre2_internal.h
index 814d91bddb..fe8ffe5c80 100644
--- a/ext/pcre/pcre2lib/pcre2_internal.h
+++ b/ext/pcre/pcre2lib/pcre2_internal.h
@@ -517,6 +517,7 @@ bytes in a code unit in that mode. */
#define PCRE2_HASBKPORX 0x00100000 /* contains \P, \p, or \X */
#define PCRE2_DUPCAPUSED 0x00200000 /* contains (?| */
#define PCRE2_HASBKC 0x00400000 /* contains \C */
+#define PCRE2_HASACCEPT 0x00800000 /* contains (*ACCEPT) */
#define PCRE2_MODE_MASK (PCRE2_MODE8 | PCRE2_MODE16 | PCRE2_MODE32)
@@ -535,13 +536,14 @@ enum { PCRE2_MATCHEDBY_INTERPRETER, /* pcre2_match() */
#define MAGIC_NUMBER 0x50435245UL /* 'PCRE' */
/* The maximum remaining length of subject we are prepared to search for a
-req_unit match. In 8-bit mode, memchr() is used and is much faster than the
-search loop that has to be used in 16-bit and 32-bit modes. */
+req_unit match from an anchored pattern. In 8-bit mode, memchr() is used and is
+much faster than the search loop that has to be used in 16-bit and 32-bit
+modes. */
#if PCRE2_CODE_UNIT_WIDTH == 8
-#define REQ_CU_MAX 2000
+#define REQ_CU_MAX 5000
#else
-#define REQ_CU_MAX 1000
+#define REQ_CU_MAX 2000
#endif
/* Offsets for the bitmap tables in the cbits set of tables. Each table
@@ -881,12 +883,16 @@ a positive value. */
#define STRING_atomic0 "atomic\0"
#define STRING_pla0 "pla\0"
#define STRING_plb0 "plb\0"
+#define STRING_napla0 "napla\0"
+#define STRING_naplb0 "naplb\0"
#define STRING_nla0 "nla\0"
#define STRING_nlb0 "nlb\0"
#define STRING_sr0 "sr\0"
#define STRING_asr0 "asr\0"
#define STRING_positive_lookahead0 "positive_lookahead\0"
#define STRING_positive_lookbehind0 "positive_lookbehind\0"
+#define STRING_non_atomic_positive_lookahead0 "non_atomic_positive_lookahead\0"
+#define STRING_non_atomic_positive_lookbehind0 "non_atomic_positive_lookbehind\0"
#define STRING_negative_lookahead0 "negative_lookahead\0"
#define STRING_negative_lookbehind0 "negative_lookbehind\0"
#define STRING_script_run0 "script_run\0"
@@ -1171,12 +1177,16 @@ only. */
#define STRING_atomic0 STR_a STR_t STR_o STR_m STR_i STR_c "\0"
#define STRING_pla0 STR_p STR_l STR_a "\0"
#define STRING_plb0 STR_p STR_l STR_b "\0"
+#define STRING_napla0 STR_n STR_a STR_p STR_l STR_a "\0"
+#define STRING_naplb0 STR_n STR_a STR_p STR_l STR_b "\0"
#define STRING_nla0 STR_n STR_l STR_a "\0"
#define STRING_nlb0 STR_n STR_l STR_b "\0"
#define STRING_sr0 STR_s STR_r "\0"
#define STRING_asr0 STR_a STR_s STR_r "\0"
#define STRING_positive_lookahead0 STR_p STR_o STR_s STR_i STR_t STR_i STR_v STR_e STR_UNDERSCORE STR_l STR_o STR_o STR_k STR_a STR_h STR_e STR_a STR_d "\0"
#define STRING_positive_lookbehind0 STR_p STR_o STR_s STR_i STR_t STR_i STR_v STR_e STR_UNDERSCORE STR_l STR_o STR_o STR_k STR_b STR_e STR_h STR_i STR_n STR_d "\0"
+#define STRING_non_atomic_positive_lookahead0 STR_n STR_o STR_n STR_UNDERSCORE STR_a STR_t STR_o STR_m STR_i STR_c STR_UNDERSCORE STR_p STR_o STR_s STR_i STR_t STR_i STR_v STR_e STR_UNDERSCORE STR_l STR_o STR_o STR_k STR_a STR_h STR_e STR_a STR_d "\0"
+#define STRING_non_atomic_positive_lookbehind0 STR_n STR_o STR_n STR_UNDERSCORE STR_a STR_t STR_o STR_m STR_i STR_c STR_UNDERSCORE STR_p STR_o STR_s STR_i STR_t STR_i STR_v STR_e STR_UNDERSCORE STR_l STR_o STR_o STR_k STR_b STR_e STR_h STR_i STR_n STR_d "\0"
#define STRING_negative_lookahead0 STR_n STR_e STR_g STR_a STR_t STR_i STR_v STR_e STR_UNDERSCORE STR_l STR_o STR_o STR_k STR_a STR_h STR_e STR_a STR_d "\0"
#define STRING_negative_lookbehind0 STR_n STR_e STR_g STR_a STR_t STR_i STR_v STR_e STR_UNDERSCORE STR_l STR_o STR_o STR_k STR_b STR_e STR_h STR_i STR_n STR_d "\0"
#define STRING_script_run0 STR_s STR_c STR_r STR_i STR_p STR_t STR_UNDERSCORE STR_r STR_u STR_n "\0"
@@ -1301,7 +1311,7 @@ enum { ESC_A = 1, ESC_G, ESC_K, ESC_B, ESC_b, ESC_D, ESC_d, ESC_S, ESC_s,
Starting from 1 (i.e. after OP_END), the values up to OP_EOD must correspond in
order to the list of escapes immediately above. Furthermore, values up to
OP_DOLLM must not be changed without adjusting the table called autoposstab in
-pcre2_auto_possess.c
+pcre2_auto_possess.c.
Whenever this list is updated, the two macro definitions that follow must be
updated to match. The possessification table called "opcode_possessify" in
@@ -1499,80 +1509,81 @@ enum {
OP_KETRMIN, /* 123 order. They are for groups the repeat for ever. */
OP_KETRPOS, /* 124 Possessive unlimited repeat. */
- /* The assertions must come before BRA, CBRA, ONCE, and COND, and the four
- asserts must remain in order. */
+ /* The assertions must come before BRA, CBRA, ONCE, and COND. */
OP_REVERSE, /* 125 Move pointer back - used in lookbehind assertions */
OP_ASSERT, /* 126 Positive lookahead */
OP_ASSERT_NOT, /* 127 Negative lookahead */
OP_ASSERTBACK, /* 128 Positive lookbehind */
OP_ASSERTBACK_NOT, /* 129 Negative lookbehind */
+ OP_ASSERT_NA, /* 130 Positive non-atomic lookahead */
+ OP_ASSERTBACK_NA, /* 131 Positive non-atomic lookbehind */
/* ONCE, SCRIPT_RUN, BRA, BRAPOS, CBRA, CBRAPOS, and COND must come
immediately after the assertions, with ONCE first, as there's a test for >=
ONCE for a subpattern that isn't an assertion. The POS versions must
immediately follow the non-POS versions in each case. */
- OP_ONCE, /* 130 Atomic group, contains captures */
- OP_SCRIPT_RUN, /* 131 Non-capture, but check characters' scripts */
- OP_BRA, /* 132 Start of non-capturing bracket */
- OP_BRAPOS, /* 133 Ditto, with unlimited, possessive repeat */
- OP_CBRA, /* 134 Start of capturing bracket */
- OP_CBRAPOS, /* 135 Ditto, with unlimited, possessive repeat */
- OP_COND, /* 136 Conditional group */
+ OP_ONCE, /* 132 Atomic group, contains captures */
+ OP_SCRIPT_RUN, /* 133 Non-capture, but check characters' scripts */
+ OP_BRA, /* 134 Start of non-capturing bracket */
+ OP_BRAPOS, /* 135 Ditto, with unlimited, possessive repeat */
+ OP_CBRA, /* 136 Start of capturing bracket */
+ OP_CBRAPOS, /* 137 Ditto, with unlimited, possessive repeat */
+ OP_COND, /* 138 Conditional group */
/* These five must follow the previous five, in the same order. There's a
check for >= SBRA to distinguish the two sets. */
- OP_SBRA, /* 137 Start of non-capturing bracket, check empty */
- OP_SBRAPOS, /* 138 Ditto, with unlimited, possessive repeat */
- OP_SCBRA, /* 139 Start of capturing bracket, check empty */
- OP_SCBRAPOS, /* 140 Ditto, with unlimited, possessive repeat */
- OP_SCOND, /* 141 Conditional group, check empty */
+ OP_SBRA, /* 139 Start of non-capturing bracket, check empty */
+ OP_SBRAPOS, /* 149 Ditto, with unlimited, possessive repeat */
+ OP_SCBRA, /* 141 Start of capturing bracket, check empty */
+ OP_SCBRAPOS, /* 142 Ditto, with unlimited, possessive repeat */
+ OP_SCOND, /* 143 Conditional group, check empty */
/* The next two pairs must (respectively) be kept together. */
- OP_CREF, /* 142 Used to hold a capture number as condition */
- OP_DNCREF, /* 143 Used to point to duplicate names as a condition */
- OP_RREF, /* 144 Used to hold a recursion number as condition */
- OP_DNRREF, /* 145 Used to point to duplicate names as a condition */
- OP_FALSE, /* 146 Always false (used by DEFINE and VERSION) */
- OP_TRUE, /* 147 Always true (used by VERSION) */
+ OP_CREF, /* 144 Used to hold a capture number as condition */
+ OP_DNCREF, /* 145 Used to point to duplicate names as a condition */
+ OP_RREF, /* 146 Used to hold a recursion number as condition */
+ OP_DNRREF, /* 147 Used to point to duplicate names as a condition */
+ OP_FALSE, /* 148 Always false (used by DEFINE and VERSION) */
+ OP_TRUE, /* 149 Always true (used by VERSION) */
- OP_BRAZERO, /* 148 These two must remain together and in this */
- OP_BRAMINZERO, /* 149 order. */
- OP_BRAPOSZERO, /* 150 */
+ OP_BRAZERO, /* 150 These two must remain together and in this */
+ OP_BRAMINZERO, /* 151 order. */
+ OP_BRAPOSZERO, /* 152 */
/* These are backtracking control verbs */
- OP_MARK, /* 151 always has an argument */
- OP_PRUNE, /* 152 */
- OP_PRUNE_ARG, /* 153 same, but with argument */
- OP_SKIP, /* 154 */
- OP_SKIP_ARG, /* 155 same, but with argument */
- OP_THEN, /* 156 */
- OP_THEN_ARG, /* 157 same, but with argument */
- OP_COMMIT, /* 158 */
- OP_COMMIT_ARG, /* 159 same, but with argument */
+ OP_MARK, /* 153 always has an argument */
+ OP_PRUNE, /* 154 */
+ OP_PRUNE_ARG, /* 155 same, but with argument */
+ OP_SKIP, /* 156 */
+ OP_SKIP_ARG, /* 157 same, but with argument */
+ OP_THEN, /* 158 */
+ OP_THEN_ARG, /* 159 same, but with argument */
+ OP_COMMIT, /* 160 */
+ OP_COMMIT_ARG, /* 161 same, but with argument */
/* These are forced failure and success verbs. FAIL and ACCEPT do accept an
argument, but these cases can be compiled as, for example, (*MARK:X)(*FAIL)
without the need for a special opcode. */
- OP_FAIL, /* 160 */
- OP_ACCEPT, /* 161 */
- OP_ASSERT_ACCEPT, /* 162 Used inside assertions */
- OP_CLOSE, /* 163 Used before OP_ACCEPT to close open captures */
+ OP_FAIL, /* 162 */
+ OP_ACCEPT, /* 163 */
+ OP_ASSERT_ACCEPT, /* 164 Used inside assertions */
+ OP_CLOSE, /* 165 Used before OP_ACCEPT to close open captures */
/* This is used to skip a subpattern with a {0} quantifier */
- OP_SKIPZERO, /* 164 */
+ OP_SKIPZERO, /* 166 */
/* This is used to identify a DEFINE group during compilation so that it can
be checked for having only one branch. It is changed to OP_FALSE before
compilation finishes. */
- OP_DEFINE, /* 165 */
+ OP_DEFINE, /* 167 */
/* This is not an opcode, but is used to check that tables indexed by opcode
are the correct length, in order to catch updating errors - there have been
@@ -1585,7 +1596,7 @@ enum {
/* *** NOTE NOTE NOTE *** Whenever the list above is updated, the two macro
definitions that follow must also be updated to match. There are also tables
called "opcode_possessify" in pcre2_compile.c and "coptable" and "poptable" in
-pcre2_dfa_exec.c that must be updated. */
+pcre2_dfa_match.c that must be updated. */
/* This macro defines textual names for all the opcodes. These are used only
@@ -1618,7 +1629,9 @@ some cases doesn't actually use these names at all). */
"class", "nclass", "xclass", "Ref", "Refi", "DnRef", "DnRefi", \
"Recurse", "Callout", "CalloutStr", \
"Alt", "Ket", "KetRmax", "KetRmin", "KetRpos", \
- "Reverse", "Assert", "Assert not", "AssertB", "AssertB not", \
+ "Reverse", "Assert", "Assert not", \
+ "Assert back", "Assert back not", \
+ "Non-atomic assert", "Non-atomic assert back", \
"Once", \
"Script run", \
"Bra", "BraPos", "CBra", "CBraPos", \
@@ -1703,6 +1716,8 @@ in UTF-8 mode. The code that uses this table must know about such things. */
1+LINK_SIZE, /* Assert not */ \
1+LINK_SIZE, /* Assert behind */ \
1+LINK_SIZE, /* Assert behind not */ \
+ 1+LINK_SIZE, /* NA Assert */ \
+ 1+LINK_SIZE, /* NA Assert behind */ \
1+LINK_SIZE, /* ONCE */ \
1+LINK_SIZE, /* SCRIPT_RUN */ \
1+LINK_SIZE, /* BRA */ \
diff --git a/ext/pcre/pcre2lib/pcre2_intmodedep.h b/ext/pcre/pcre2lib/pcre2_intmodedep.h
index bf3a235984..ea3b3ec698 100644
--- a/ext/pcre/pcre2lib/pcre2_intmodedep.h
+++ b/ext/pcre/pcre2lib/pcre2_intmodedep.h
@@ -205,19 +205,19 @@ whether its argument, which is assumed to be one code unit, is less than 256.
The CHMAX_255 macro does not assume one code unit. The maximum length of a MARK
name must fit in one code unit; currently it is set to 255 or 65535. The
TABLE_GET macro is used to access elements of tables containing exactly 256
-items. When code points can be greater than 255, a check is needed before
-accessing these tables. */
+items. Its argument is a code unit. When code points can be greater than 255, a
+check is needed before accessing these tables. */
#if PCRE2_CODE_UNIT_WIDTH == 8
#define MAX_255(c) TRUE
#define MAX_MARK ((1u << 8) - 1)
+#define TABLE_GET(c, table, default) ((table)[c])
#ifdef SUPPORT_UNICODE
#define SUPPORT_WIDE_CHARS
#define CHMAX_255(c) ((c) <= 255u)
#else
#define CHMAX_255(c) TRUE
#endif /* SUPPORT_UNICODE */
-#define TABLE_GET(c, table, default) ((table)[c])
#else /* Code units are 16 or 32 bits */
#define CHMAX_255(c) ((c) <= 255u)
@@ -228,7 +228,6 @@ accessing these tables. */
#endif
-
/* ----------------- Character-handling macros ----------------- */
/* There is a proposed future special "UTF-21" mode, in which only the lowest
@@ -854,6 +853,7 @@ typedef struct match_block {
uint32_t match_call_count; /* Number of times a new frame is created */
BOOL hitend; /* Hit the end of the subject at some point */
BOOL hasthen; /* Pattern contains (*THEN) */
+ BOOL allowemptypartial; /* Allow empty hard partial */
const uint8_t *lcc; /* Points to lower casing table */
const uint8_t *fcc; /* Points to case-flipping table */
const uint8_t *ctypes; /* Points to table of type maps */
@@ -866,6 +866,7 @@ typedef struct match_block {
PCRE2_SPTR name_table; /* Table of group names */
PCRE2_SPTR start_code; /* For use when recursing */
PCRE2_SPTR start_subject; /* Start of the subject string */
+ PCRE2_SPTR check_subject; /* Where UTF-checked from */
PCRE2_SPTR end_subject; /* End of the subject string */
PCRE2_SPTR end_match_ptr; /* Subject position at end match */
PCRE2_SPTR start_used_ptr; /* Earliest consulted character */
@@ -908,6 +909,7 @@ typedef struct dfa_match_block {
uint32_t poptions; /* Pattern options */
uint32_t nltype; /* Newline type */
uint32_t nllen; /* Newline string length */
+ BOOL allowemptypartial; /* Allow empty hard partial */
PCRE2_UCHAR nl[4]; /* Newline string when fixed */
uint16_t bsr_convention; /* \R interpretation */
pcre2_callout_block *cb; /* Points to a callout block */
diff --git a/ext/pcre/pcre2lib/pcre2_jit_compile.c b/ext/pcre/pcre2lib/pcre2_jit_compile.c
index 8b48cea2c6..f564127c2a 100644
--- a/ext/pcre/pcre2lib/pcre2_jit_compile.c
+++ b/ext/pcre/pcre2lib/pcre2_jit_compile.c
@@ -6,8 +6,9 @@
and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
+ This module by Zoltan Herczeg
Original API code Copyright (c) 1997-2012 University of Cambridge
- New API code Copyright (c) 2016-2018 University of Cambridge
+ New API code Copyright (c) 2016-2019 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -212,12 +213,6 @@ typedef struct stub_list {
struct stub_list *next;
} stub_list;
-typedef struct label_addr_list {
- struct sljit_label *label;
- sljit_uw *update_addr;
- struct label_addr_list *next;
-} label_addr_list;
-
enum frame_types {
no_frame = -1,
no_stack = -2
@@ -271,6 +266,8 @@ typedef struct bracket_backtrack {
assert_backtrack *assert;
/* For OP_ONCE. Less than 0 if not needed. */
int framesize;
+ /* For brackets with >3 alternatives. */
+ struct sljit_put_label *matching_put_label;
} u;
/* Points to our private memory word on the stack. */
int private_data_ptr;
@@ -416,6 +413,8 @@ typedef struct compiler_common {
sljit_sw lcc;
/* Mode can be PCRE2_JIT_COMPLETE and others. */
int mode;
+ /* TRUE, when empty match is accepted for partial matching. */
+ BOOL allow_empty_partial;
/* TRUE, when minlength is greater than 0. */
BOOL might_be_empty;
/* \K is found in the pattern. */
@@ -454,7 +453,6 @@ typedef struct compiler_common {
struct sljit_label *accept_label;
struct sljit_label *ff_newline_shortcut;
stub_list *stubs;
- label_addr_list *label_addrs;
recurse_entry *entries;
recurse_entry *currententry;
jump_list *partialmatch;
@@ -563,6 +561,12 @@ typedef struct compare_context {
#define ARGUMENTS SLJIT_S4
#define RETURN_ADDR SLJIT_R4
+#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
+#define HAS_VIRTUAL_REGISTERS 1
+#else
+#define HAS_VIRTUAL_REGISTERS 0
+#endif
+
/* Local space layout. */
/* These two locals can be used by the current opcode. */
#define LOCALS0 (0 * sizeof(sljit_sw))
@@ -696,11 +700,12 @@ the start pointers when the end of the capturing group has not yet reached. */
#define GETCHARBACK_INVALID(c, ptr, start, invalid_action) \
{ \
- if (ptr[-1] <= 0x7f) \
- c = *ptr--; \
+ c = ptr[-1]; \
+ if (c <= 0x7f) \
+ ptr--; \
else if (ptr - 1 > start && ptr[-1] >= 0x80 && ptr[-1] < 0xc0) \
{ \
- c = ptr[-1] - 0x80; \
+ c -= 0x80; \
\
if (ptr[-2] >= 0xc2 && ptr[-2] <= 0xdf) \
{ \
@@ -775,11 +780,12 @@ the start pointers when the end of the capturing group has not yet reached. */
#define GETCHARBACK_INVALID(c, ptr, start, invalid_action) \
{ \
- if (ptr[-1] < 0xd800 || ptr[-1] >= 0xe000) \
- c = *ptr--; \
- else if (ptr[-1] >= 0xdc00 && ptr - 1 > start && ptr[-2] >= 0xd800 && ptr[-2] < 0xdc00) \
+ c = ptr[-1]; \
+ if (c < 0xd800 || c >= 0xe000) \
+ ptr--; \
+ else if (c >= 0xdc00 && ptr - 1 > start && ptr[-2] >= 0xd800 && ptr[-2] < 0xdc00) \
{ \
- c = (((ptr[-2] - 0xd800) << 10) | (ptr[-1] - 0xdc00)) + 0x10000; \
+ c = (((ptr[-2] - 0xd800) << 10) | (c - 0xdc00)) + 0x10000; \
ptr -= 2; \
} \
else \
@@ -793,7 +799,7 @@ the start pointers when the end of the capturing group has not yet reached. */
#define GETCHARINC_INVALID(c, ptr, end, invalid_action) \
{ \
- if (ptr[0] < 0x110000) \
+ if (ptr[0] < 0xd800 || (ptr[0] >= 0xe000 && ptr[0] < 0x110000)) \
c = *ptr++; \
else \
{ \
@@ -801,6 +807,17 @@ the start pointers when the end of the capturing group has not yet reached. */
} \
}
+#define GETCHARBACK_INVALID(c, ptr, start, invalid_action) \
+ { \
+ c = ptr[-1]; \
+ if (ptr[-1] < 0xd800 || (ptr[-1] >= 0xe000 && ptr[-1] < 0x110000)) \
+ ptr--; \
+ else \
+ { \
+ invalid_action; \
+ } \
+ }
+
#endif /* PCRE2_CODE_UNIT_WIDTH == [8|16|32] */
#endif /* SUPPORT_UNICODE */
@@ -1033,8 +1050,8 @@ switch(*cc)
return cc + 1 + 2 + cc[1];
default:
- /* All opcodes are supported now! */
- SLJIT_UNREACHABLE();
+ /* Unsupported opcodes: OP_ASSERT_NA and OP_ASSERTBACK_NA */
+ /* SLJIT_UNREACHABLE(); */
return NULL;
}
}
@@ -2371,14 +2388,14 @@ if (base_reg != TMP2)
else
{
status.saved_tmp_regs[1] = RETURN_ADDR;
- if (sljit_get_register_index(RETURN_ADDR) == -1)
+ if (HAS_VIRTUAL_REGISTERS)
status.tmp_regs[1] = STR_PTR;
else
status.tmp_regs[1] = RETURN_ADDR;
}
status.saved_tmp_regs[2] = TMP3;
-if (sljit_get_register_index(TMP3) == -1)
+if (HAS_VIRTUAL_REGISTERS)
status.tmp_regs[2] = STR_END;
else
status.tmp_regs[2] = TMP3;
@@ -2829,20 +2846,6 @@ while (list_item)
common->stubs = NULL;
}
-static void add_label_addr(compiler_common *common, sljit_uw *update_addr)
-{
-DEFINE_COMPILER;
-label_addr_list *label_addr;
-
-label_addr = sljit_alloc_memory(compiler, sizeof(label_addr_list));
-if (label_addr == NULL)
- return;
-label_addr->label = LABEL();
-label_addr->update_addr = update_addr;
-label_addr->next = common->label_addrs;
-common->label_addrs = label_addr;
-}
-
static SLJIT_INLINE void count_match(compiler_common *common)
{
DEFINE_COMPILER;
@@ -2985,12 +2988,18 @@ else
}
}
-OP1(SLJIT_MOV, STACK_TOP, 0, ARGUMENTS, 0);
+if (!HAS_VIRTUAL_REGISTERS)
+ OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, stack));
+else
+ OP1(SLJIT_MOV, STACK_TOP, 0, ARGUMENTS, 0);
+
if (common->mark_ptr != 0)
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->mark_ptr, SLJIT_IMM, 0);
if (common->control_head_ptr != 0)
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_IMM, 0);
-OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(STACK_TOP), SLJIT_OFFSETOF(jit_arguments, stack));
+if (HAS_VIRTUAL_REGISTERS)
+ OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(STACK_TOP), SLJIT_OFFSETOF(jit_arguments, stack));
+
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->start_ptr);
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(STACK_TOP), SLJIT_OFFSETOF(struct sljit_stack, end));
}
@@ -3029,21 +3038,36 @@ BOOL has_pre;
OP1(SLJIT_MOV, SLJIT_S2, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(1));
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), OVECTOR(1), STR_PTR, 0);
-OP1(SLJIT_MOV, SLJIT_R0, 0, ARGUMENTS, 0);
-OP1(SLJIT_MOV, SLJIT_S0, 0, SLJIT_MEM1(SLJIT_SP), common->start_ptr);
-if (common->mark_ptr != 0)
- OP1(SLJIT_MOV, SLJIT_R2, 0, SLJIT_MEM1(SLJIT_SP), common->mark_ptr);
-OP1(SLJIT_MOV_U32, SLJIT_R1, 0, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments, oveccount));
-OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments, startchar_ptr), SLJIT_S0, 0);
-if (common->mark_ptr != 0)
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments, mark_ptr), SLJIT_R2, 0);
-OP2(SLJIT_ADD, SLJIT_R2, 0, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments, match_data),
- SLJIT_IMM, SLJIT_OFFSETOF(pcre2_match_data, ovector) - sizeof(PCRE2_SIZE));
+if (HAS_VIRTUAL_REGISTERS)
+ {
+ OP1(SLJIT_MOV, SLJIT_R0, 0, ARGUMENTS, 0);
+ OP1(SLJIT_MOV, SLJIT_S0, 0, SLJIT_MEM1(SLJIT_SP), common->start_ptr);
+ if (common->mark_ptr != 0)
+ OP1(SLJIT_MOV, SLJIT_R2, 0, SLJIT_MEM1(SLJIT_SP), common->mark_ptr);
+ OP1(SLJIT_MOV_U32, SLJIT_R1, 0, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments, oveccount));
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments, startchar_ptr), SLJIT_S0, 0);
+ if (common->mark_ptr != 0)
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments, mark_ptr), SLJIT_R2, 0);
+ OP2(SLJIT_ADD, SLJIT_R2, 0, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments, match_data),
+ SLJIT_IMM, SLJIT_OFFSETOF(pcre2_match_data, ovector) - sizeof(PCRE2_SIZE));
+ }
+else
+ {
+ OP1(SLJIT_MOV, SLJIT_S0, 0, SLJIT_MEM1(SLJIT_SP), common->start_ptr);
+ OP1(SLJIT_MOV, SLJIT_R2, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, match_data));
+ if (common->mark_ptr != 0)
+ OP1(SLJIT_MOV, SLJIT_R0, 0, SLJIT_MEM1(SLJIT_SP), common->mark_ptr);
+ OP1(SLJIT_MOV_U32, SLJIT_R1, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, oveccount));
+ OP1(SLJIT_MOV, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, startchar_ptr), SLJIT_S0, 0);
+ if (common->mark_ptr != 0)
+ OP1(SLJIT_MOV, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, mark_ptr), SLJIT_R0, 0);
+ OP2(SLJIT_ADD, SLJIT_R2, 0, SLJIT_R2, 0, SLJIT_IMM, SLJIT_OFFSETOF(pcre2_match_data, ovector) - sizeof(PCRE2_SIZE));
+ }
has_pre = sljit_emit_mem(compiler, SLJIT_MOV | SLJIT_MEM_SUPP | SLJIT_MEM_PRE, SLJIT_S1, SLJIT_MEM1(SLJIT_S0), sizeof(sljit_sw)) == SLJIT_SUCCESS;
GET_LOCAL_BASE(SLJIT_S0, 0, OVECTOR_START - (has_pre ? sizeof(sljit_sw) : 0));
-OP1(SLJIT_MOV, SLJIT_R0, 0, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments, begin));
+OP1(SLJIT_MOV, SLJIT_R0, 0, SLJIT_MEM1(HAS_VIRTUAL_REGISTERS ? SLJIT_R0 : ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, begin));
loop = LABEL();
@@ -3105,20 +3129,22 @@ static SLJIT_INLINE void return_with_partial_match(compiler_common *common, stru
{
DEFINE_COMPILER;
sljit_s32 mov_opcode;
+sljit_s32 arguments_reg = !HAS_VIRTUAL_REGISTERS ? ARGUMENTS : SLJIT_R1;
SLJIT_COMPILE_ASSERT(STR_END == SLJIT_S0, str_end_must_be_saved_reg0);
SLJIT_ASSERT(common->start_used_ptr != 0 && common->start_ptr != 0
&& (common->mode == PCRE2_JIT_PARTIAL_SOFT ? common->hit_start != 0 : common->hit_start == 0));
-OP1(SLJIT_MOV, SLJIT_R1, 0, ARGUMENTS, 0);
+if (arguments_reg != ARGUMENTS)
+ OP1(SLJIT_MOV, arguments_reg, 0, ARGUMENTS, 0);
OP1(SLJIT_MOV, SLJIT_R2, 0, SLJIT_MEM1(SLJIT_SP),
common->mode == PCRE2_JIT_PARTIAL_SOFT ? common->hit_start : common->start_ptr);
OP1(SLJIT_MOV, SLJIT_RETURN_REG, 0, SLJIT_IMM, PCRE2_ERROR_PARTIAL);
/* Store match begin and end. */
-OP1(SLJIT_MOV, SLJIT_S1, 0, SLJIT_MEM1(SLJIT_R1), SLJIT_OFFSETOF(jit_arguments, begin));
-OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_R1), SLJIT_OFFSETOF(jit_arguments, startchar_ptr), SLJIT_R2, 0);
-OP1(SLJIT_MOV, SLJIT_R1, 0, SLJIT_MEM1(SLJIT_R1), SLJIT_OFFSETOF(jit_arguments, match_data));
+OP1(SLJIT_MOV, SLJIT_S1, 0, SLJIT_MEM1(arguments_reg), SLJIT_OFFSETOF(jit_arguments, begin));
+OP1(SLJIT_MOV, SLJIT_MEM1(arguments_reg), SLJIT_OFFSETOF(jit_arguments, startchar_ptr), SLJIT_R2, 0);
+OP1(SLJIT_MOV, SLJIT_R1, 0, SLJIT_MEM1(arguments_reg), SLJIT_OFFSETOF(jit_arguments, match_data));
mov_opcode = (sizeof(PCRE2_SIZE) == 4) ? SLJIT_MOV_U32 : SLJIT_MOV;
@@ -3279,7 +3305,7 @@ SLJIT_ASSERT(!force || common->mode != PCRE2_JIT_COMPLETE);
if (common->mode == PCRE2_JIT_COMPLETE)
return;
-if (!force)
+if (!force && !common->allow_empty_partial)
jump = CMP(SLJIT_GREATER_EQUAL, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, STR_PTR, 0);
else if (common->mode == PCRE2_JIT_PARTIAL_SOFT)
jump = CMP(SLJIT_EQUAL, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, SLJIT_IMM, -1);
@@ -3341,7 +3367,11 @@ if (common->mode == PCRE2_JIT_COMPLETE)
/* Partial matching mode. */
jump = CMP(SLJIT_LESS, STR_PTR, 0, STR_END, 0);
-add_jump(compiler, backtracks, CMP(SLJIT_GREATER_EQUAL, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, STR_PTR, 0));
+if (!common->allow_empty_partial)
+ add_jump(compiler, backtracks, CMP(SLJIT_GREATER_EQUAL, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, STR_PTR, 0));
+else if (common->mode == PCRE2_JIT_PARTIAL_SOFT)
+ add_jump(compiler, backtracks, CMP(SLJIT_EQUAL, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, SLJIT_IMM, -1));
+
if (common->mode == PCRE2_JIT_PARTIAL_SOFT)
{
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->hit_start, SLJIT_IMM, 0);
@@ -3357,6 +3387,35 @@ else
JUMPHERE(jump);
}
+static void process_partial_match(compiler_common *common)
+{
+DEFINE_COMPILER;
+struct sljit_jump *jump;
+
+/* Partial matching mode. */
+if (common->mode == PCRE2_JIT_PARTIAL_SOFT)
+ {
+ jump = CMP(SLJIT_GREATER_EQUAL, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, STR_PTR, 0);
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->hit_start, SLJIT_IMM, 0);
+ JUMPHERE(jump);
+ }
+else if (common->mode == PCRE2_JIT_PARTIAL_HARD)
+ {
+ if (common->partialmatchlabel != NULL)
+ CMPTO(SLJIT_LESS, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, STR_PTR, 0, common->partialmatchlabel);
+ else
+ add_jump(compiler, &common->partialmatch, CMP(SLJIT_LESS, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, STR_PTR, 0));
+ }
+}
+
+static void detect_partial_match_to(compiler_common *common, struct sljit_label *label)
+{
+DEFINE_COMPILER;
+
+CMPTO(SLJIT_LESS, STR_PTR, 0, STR_END, 0, label);
+process_partial_match(common);
+}
+
static void peek_char(compiler_common *common, sljit_u32 max, sljit_s32 dst, sljit_sw dstw, jump_list **backtracks)
{
/* Reads the character into TMP1, keeps STR_PTR.
@@ -3420,12 +3479,21 @@ if (common->utf)
#elif PCRE2_CODE_UNIT_WIDTH == 32
if (common->invalid_utf)
{
+ if (max < 0xd800) return;
+
if (backtracks != NULL)
+ {
+ OP2(SLJIT_SUB, TMP2, 0, TMP1, 0, SLJIT_IMM, 0xd800);
add_jump(compiler, backtracks, CMP(SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, 0x110000));
+ add_jump(compiler, backtracks, CMP(SLJIT_LESS, TMP2, 0, SLJIT_IMM, 0xe000 - 0xd800));
+ }
else
{
+ OP2(SLJIT_SUB, TMP2, 0, TMP1, 0, SLJIT_IMM, 0xd800);
OP2(SLJIT_SUB | SLJIT_SET_GREATER_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x110000);
CMOV(SLJIT_GREATER_EQUAL, TMP1, SLJIT_IMM, INVALID_UTF_CHAR);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, 0xe000 - 0xd800);
+ CMOV(SLJIT_LESS, TMP1, SLJIT_IMM, INVALID_UTF_CHAR);
}
}
#endif /* PCRE2_CODE_UNIT_WIDTH == [8|16|32] */
@@ -3490,8 +3558,12 @@ if (common->utf)
JUMPHERE(jump);
}
#elif PCRE2_CODE_UNIT_WIDTH == 32
- if (common->invalid_utf)
- add_jump(compiler, backtracks, CMP(SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, 0x110000));
+if (common->invalid_utf)
+ {
+ OP2(SLJIT_SUB, TMP2, 0, TMP1, 0, SLJIT_IMM, 0xd800);
+ add_jump(compiler, backtracks, CMP(SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, 0x110000));
+ add_jump(compiler, backtracks, CMP(SLJIT_LESS, TMP2, 0, SLJIT_IMM, 0xe000 - 0xd800));
+ }
#endif /* PCRE2_CODE_UNIT_WIDTH == [8|16|32] */
#endif /* SUPPORT_UNICODE */
}
@@ -3653,7 +3725,7 @@ if (common->utf)
/* Skip low surrogate if necessary. */
OP2(SLJIT_SUB, TMP2, 0, TMP1, 0, SLJIT_IMM, 0xd800);
- if (sljit_has_cpu_feature(SLJIT_HAS_CMOV) && sljit_get_register_index(RETURN_ADDR) >= 0)
+ if (sljit_has_cpu_feature(SLJIT_HAS_CMOV) && !HAS_VIRTUAL_REGISTERS)
{
if (options & READ_CHAR_UPDATE_STR_PTR)
OP2(SLJIT_ADD, RETURN_ADDR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
@@ -3677,11 +3749,18 @@ if (common->utf)
if (common->invalid_utf)
{
if (backtracks != NULL)
+ {
+ OP2(SLJIT_SUB, TMP2, 0, TMP1, 0, SLJIT_IMM, 0xd800);
add_jump(compiler, backtracks, CMP(SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, 0x110000));
+ add_jump(compiler, backtracks, CMP(SLJIT_LESS, TMP2, 0, SLJIT_IMM, 0xe000 - 0xd800));
+ }
else
{
+ OP2(SLJIT_SUB, TMP2, 0, TMP1, 0, SLJIT_IMM, 0xd800);
OP2(SLJIT_SUB | SLJIT_SET_GREATER_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x110000);
CMOV(SLJIT_GREATER_EQUAL, TMP1, SLJIT_IMM, INVALID_UTF_CHAR);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, 0xe000 - 0xd800);
+ CMOV(SLJIT_LESS, TMP1, SLJIT_IMM, INVALID_UTF_CHAR);
}
}
#endif /* PCRE2_CODE_UNIT_WIDTH == [8|16|32] */
@@ -3832,7 +3911,7 @@ if (common->utf && negated)
{
OP2(SLJIT_SUB, TMP2, 0, TMP2, 0, SLJIT_IMM, 0xd800);
- if (sljit_has_cpu_feature(SLJIT_HAS_CMOV) && sljit_get_register_index(RETURN_ADDR) >= 0)
+ if (sljit_has_cpu_feature(SLJIT_HAS_CMOV) && !HAS_VIRTUAL_REGISTERS)
{
OP2(SLJIT_ADD, RETURN_ADDR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
OP2(SLJIT_SUB | SLJIT_SET_LESS, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, 0x400);
@@ -3865,9 +3944,9 @@ if (common->utf && negated)
static void move_back(compiler_common *common, jump_list **backtracks, BOOL must_be_valid)
{
-/* Goes one character back. TMP2 must contain the start of
-the subject buffer. Affects STR_PTR and TMP1. Does not modify
-STR_PTR for invalid character sequences. */
+/* Goes one character back. Affects STR_PTR and TMP1. If must_be_valid is TRUE,
+TMP2 is not used. Otherwise TMP2 must contain the start of the subject buffer,
+and it is destroyed. Does not modify STR_PTR for invalid character sequences. */
DEFINE_COMPILER;
SLJIT_UNUSED_ARG(backtracks);
@@ -4407,7 +4486,7 @@ sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
static void do_utfpeakcharback(compiler_common *common)
{
-/* Peak a character back. */
+/* Peak a character back. Does not modify STR_PTR. */
DEFINE_COMPILER;
struct sljit_jump *jump[2];
@@ -4444,7 +4523,7 @@ sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
static void do_utfpeakcharback_invalid(compiler_common *common)
{
-/* Peak a character back. */
+/* Peak a character back. Does not modify STR_PTR. */
DEFINE_COMPILER;
sljit_s32 i;
sljit_s32 has_cmov = sljit_has_cpu_feature(SLJIT_HAS_CMOV);
@@ -4672,7 +4751,7 @@ sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
static void do_utfpeakcharback_invalid(compiler_common *common)
{
-/* Peak a character back. */
+/* Peak a character back. Does not modify STR_PTR. */
DEFINE_COMPILER;
struct sljit_jump *jump;
struct sljit_jump *exit_invalid[3];
@@ -4786,18 +4865,12 @@ OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, TMP2, 0);
OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, (sljit_sw)PRIV(ucd_stage2));
OP1(SLJIT_MOV_U16, TMP2, 0, SLJIT_MEM2(TMP2, TMP1), 1);
-// PH hacking
-//fprintf(stderr, "~~A\n");
- OP2(SLJIT_SHL, TMP1, 0, TMP2, 0, SLJIT_IMM, 2);
- OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 3);
- OP2(SLJIT_ADD, TMP2, 0, TMP2, 0, TMP1, 0);
- OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, (sljit_sw)PRIV(ucd_records) + SLJIT_OFFSETOF(ucd_record, chartype));
-
+/* TMP2 is multiplied by 12. Same as (TMP2 << 2) + ((TMP2 << 2) << 1). */
OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, (sljit_sw)PRIV(ucd_records) + SLJIT_OFFSETOF(ucd_record, chartype));
+OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 2);
+OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, TMP2, 0);
+OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM2(TMP1, TMP2), 1);
- OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM2(TMP1, TMP2), 0);
-
-// OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM2(TMP1, TMP2), 3);
sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
}
@@ -4866,15 +4939,27 @@ else if ((overall_options & PCRE2_USE_OFFSET_LIMIT) != 0)
/* Check whether offset limit is set and valid. */
SLJIT_ASSERT(common->match_end_ptr != 0);
- OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
- OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, offset_limit));
+ if (HAS_VIRTUAL_REGISTERS)
+ {
+ OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, offset_limit));
+ }
+ else
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, offset_limit));
+
OP1(SLJIT_MOV, TMP2, 0, STR_END, 0);
end = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, (sljit_sw) PCRE2_UNSET);
- OP1(SLJIT_MOV, TMP2, 0, ARGUMENTS, 0);
+ if (HAS_VIRTUAL_REGISTERS)
+ OP1(SLJIT_MOV, TMP2, 0, ARGUMENTS, 0);
+ else
+ OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, begin));
+
#if PCRE2_CODE_UNIT_WIDTH == 16 || PCRE2_CODE_UNIT_WIDTH == 32
OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, UCHAR_SHIFT);
#endif /* PCRE2_CODE_UNIT_WIDTH == [16|32] */
- OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, begin));
+ if (HAS_VIRTUAL_REGISTERS)
+ OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, begin));
+
OP2(SLJIT_ADD, TMP2, 0, TMP2, 0, TMP1, 0);
end2 = CMP(SLJIT_LESS_EQUAL, TMP2, 0, STR_END, 0);
OP1(SLJIT_MOV, TMP2, 0, STR_END, 0);
@@ -5434,699 +5519,56 @@ CMPTO(SLJIT_EQUAL, reg, 0, SLJIT_IMM, 0xdc00, label);
}
#endif
-#if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86) && !(defined SUPPORT_VALGRIND)
+#include "pcre2_jit_simd_inc.h"
-#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
-static struct sljit_jump *jump_if_utf_char_start(struct sljit_compiler *compiler, sljit_s32 reg)
-{
-#if PCRE2_CODE_UNIT_WIDTH == 8
-OP2(SLJIT_AND, reg, 0, reg, 0, SLJIT_IMM, 0xc0);
-return CMP(SLJIT_NOT_EQUAL, reg, 0, SLJIT_IMM, 0x80);
-#elif PCRE2_CODE_UNIT_WIDTH == 16
-OP2(SLJIT_AND, reg, 0, reg, 0, SLJIT_IMM, 0xfc00);
-return CMP(SLJIT_NOT_EQUAL, reg, 0, SLJIT_IMM, 0xdc00);
-#else
-#error "Unknown code width"
-#endif
-}
-#endif
-
-static sljit_s32 character_to_int32(PCRE2_UCHAR chr)
-{
-sljit_u32 value = chr;
-#if PCRE2_CODE_UNIT_WIDTH == 8
-#define SSE2_COMPARE_TYPE_INDEX 0
-return (sljit_s32)((value << 24) | (value << 16) | (value << 8) | value);
-#elif PCRE2_CODE_UNIT_WIDTH == 16
-#define SSE2_COMPARE_TYPE_INDEX 1
-return (sljit_s32)((value << 16) | value);
-#elif PCRE2_CODE_UNIT_WIDTH == 32
-#define SSE2_COMPARE_TYPE_INDEX 2
-return (sljit_s32)(value);
-#else
-#error "Unsupported unit width"
-#endif
-}
+#ifdef JIT_HAS_FAST_FORWARD_CHAR_PAIR_SIMD
-static void load_from_mem_sse2(struct sljit_compiler *compiler, sljit_s32 dst_xmm_reg, sljit_s32 src_general_reg)
+static BOOL check_fast_forward_char_pair_simd(compiler_common *common, fast_forward_char_data *chars, int max)
{
-#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
-sljit_u8 instruction[5];
-#else
-sljit_u8 instruction[4];
-#endif
-
-SLJIT_ASSERT(dst_xmm_reg < 8);
-
-/* MOVDQA xmm1, xmm2/m128 */
-#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
-if (src_general_reg < 8)
- {
- instruction[0] = 0x66;
- instruction[1] = 0x0f;
- instruction[2] = 0x6f;
- instruction[3] = (dst_xmm_reg << 3) | src_general_reg;
- sljit_emit_op_custom(compiler, instruction, 4);
- }
-else
- {
- instruction[0] = 0x66;
- instruction[1] = 0x41;
- instruction[2] = 0x0f;
- instruction[3] = 0x6f;
- instruction[4] = (dst_xmm_reg << 3) | (src_general_reg & 0x7);
- sljit_emit_op_custom(compiler, instruction, 4);
- }
-#else
-instruction[0] = 0x66;
-instruction[1] = 0x0f;
-instruction[2] = 0x6f;
-instruction[3] = (dst_xmm_reg << 3) | src_general_reg;
-sljit_emit_op_custom(compiler, instruction, 4);
-#endif
-}
-
-static void fast_forward_char_pair_sse2_compare(struct sljit_compiler *compiler, PCRE2_UCHAR char1, PCRE2_UCHAR char2,
- sljit_u32 bit, sljit_s32 dst_ind, sljit_s32 cmp1_ind, sljit_s32 cmp2_ind, sljit_s32 tmp_ind)
-{
-sljit_u8 instruction[4];
-instruction[0] = 0x66;
-instruction[1] = 0x0f;
-
-if (char1 == char2 || bit != 0)
- {
- if (bit != 0)
- {
- /* POR xmm1, xmm2/m128 */
- /* instruction[0] = 0x66; */
- /* instruction[1] = 0x0f; */
- instruction[2] = 0xeb;
- instruction[3] = 0xc0 | (dst_ind << 3) | cmp2_ind;
- sljit_emit_op_custom(compiler, instruction, 4);
- }
-
- /* PCMPEQB/W/D xmm1, xmm2/m128 */
- /* instruction[0] = 0x66; */
- /* instruction[1] = 0x0f; */
- instruction[2] = 0x74 + SSE2_COMPARE_TYPE_INDEX;
- instruction[3] = 0xc0 | (dst_ind << 3) | cmp1_ind;
- sljit_emit_op_custom(compiler, instruction, 4);
- }
-else
- {
- /* MOVDQA xmm1, xmm2/m128 */
- /* instruction[0] = 0x66; */
- /* instruction[1] = 0x0f; */
- instruction[2] = 0x6f;
- instruction[3] = 0xc0 | (tmp_ind << 3) | dst_ind;
- sljit_emit_op_custom(compiler, instruction, 4);
-
- /* PCMPEQB/W/D xmm1, xmm2/m128 */
- /* instruction[0] = 0x66; */
- /* instruction[1] = 0x0f; */
- instruction[2] = 0x74 + SSE2_COMPARE_TYPE_INDEX;
- instruction[3] = 0xc0 | (dst_ind << 3) | cmp1_ind;
- sljit_emit_op_custom(compiler, instruction, 4);
-
- instruction[3] = 0xc0 | (tmp_ind << 3) | cmp2_ind;
- sljit_emit_op_custom(compiler, instruction, 4);
-
- /* POR xmm1, xmm2/m128 */
- /* instruction[0] = 0x66; */
- /* instruction[1] = 0x0f; */
- instruction[2] = 0xeb;
- instruction[3] = 0xc0 | (dst_ind << 3) | tmp_ind;
- sljit_emit_op_custom(compiler, instruction, 4);
- }
-}
-
-static void fast_forward_first_char2_sse2(compiler_common *common, PCRE2_UCHAR char1, PCRE2_UCHAR char2, sljit_s32 offset)
-{
-DEFINE_COMPILER;
-struct sljit_label *start;
-#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
-struct sljit_label *restart;
-#endif
-struct sljit_jump *quit;
-struct sljit_jump *partial_quit[2];
-sljit_u8 instruction[8];
-sljit_s32 tmp1_ind = sljit_get_register_index(TMP1);
-sljit_s32 str_ptr_ind = sljit_get_register_index(STR_PTR);
-sljit_s32 data_ind = 0;
-sljit_s32 tmp_ind = 1;
-sljit_s32 cmp1_ind = 2;
-sljit_s32 cmp2_ind = 3;
-sljit_u32 bit = 0;
-
-SLJIT_UNUSED_ARG(offset);
-
-if (char1 != char2)
- {
- bit = char1 ^ char2;
- if (!is_powerof2(bit))
- bit = 0;
- }
-
-partial_quit[0] = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
-if (common->mode == PCRE2_JIT_COMPLETE)
- add_jump(compiler, &common->failed_match, partial_quit[0]);
-
-/* First part (unaligned start) */
-
-OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, character_to_int32(char1 | bit));
-
-SLJIT_ASSERT(tmp1_ind < 8);
-
-/* MOVD xmm, r/m32 */
-instruction[0] = 0x66;
-instruction[1] = 0x0f;
-instruction[2] = 0x6e;
-instruction[3] = 0xc0 | (cmp1_ind << 3) | tmp1_ind;
-sljit_emit_op_custom(compiler, instruction, 4);
-
-if (char1 != char2)
- {
- OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, character_to_int32(bit != 0 ? bit : char2));
-
- /* MOVD xmm, r/m32 */
- instruction[3] = 0xc0 | (cmp2_ind << 3) | tmp1_ind;
- sljit_emit_op_custom(compiler, instruction, 4);
- }
-
-OP1(SLJIT_MOV, TMP2, 0, STR_PTR, 0);
-
-/* PSHUFD xmm1, xmm2/m128, imm8 */
-/* instruction[0] = 0x66; */
-/* instruction[1] = 0x0f; */
-instruction[2] = 0x70;
-instruction[3] = 0xc0 | (cmp1_ind << 3) | 2;
-instruction[4] = 0;
-sljit_emit_op_custom(compiler, instruction, 5);
-
-if (char1 != char2)
- {
- /* PSHUFD xmm1, xmm2/m128, imm8 */
- instruction[3] = 0xc0 | (cmp2_ind << 3) | 3;
- sljit_emit_op_custom(compiler, instruction, 5);
- }
-
-#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
-restart = LABEL();
-#endif
-OP2(SLJIT_AND, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, ~0xf);
-OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0xf);
-
-load_from_mem_sse2(compiler, data_ind, str_ptr_ind);
-fast_forward_char_pair_sse2_compare(compiler, char1, char2, bit, data_ind, cmp1_ind, cmp2_ind, tmp_ind);
-
-/* PMOVMSKB reg, xmm */
-/* instruction[0] = 0x66; */
-/* instruction[1] = 0x0f; */
-instruction[2] = 0xd7;
-instruction[3] = 0xc0 | (tmp1_ind << 3) | 0;
-sljit_emit_op_custom(compiler, instruction, 4);
-
-OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP2, 0);
-OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, TMP2, 0);
-
-/* BSF r32, r/m32 */
-instruction[0] = 0x0f;
-instruction[1] = 0xbc;
-instruction[2] = 0xc0 | (tmp1_ind << 3) | tmp1_ind;
-sljit_emit_op_custom(compiler, instruction, 3);
-sljit_set_current_flags(compiler, SLJIT_SET_Z);
-
-quit = JUMP(SLJIT_NOT_ZERO);
-
-OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, TMP2, 0);
-
-start = LABEL();
-OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, 16);
-
-partial_quit[1] = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
-if (common->mode == PCRE2_JIT_COMPLETE)
- add_jump(compiler, &common->failed_match, partial_quit[1]);
-
-/* Second part (aligned) */
-
-load_from_mem_sse2(compiler, 0, str_ptr_ind);
-fast_forward_char_pair_sse2_compare(compiler, char1, char2, bit, data_ind, cmp1_ind, cmp2_ind, tmp_ind);
-
-/* PMOVMSKB reg, xmm */
-instruction[0] = 0x66;
-instruction[1] = 0x0f;
-instruction[2] = 0xd7;
-instruction[3] = 0xc0 | (tmp1_ind << 3) | 0;
-sljit_emit_op_custom(compiler, instruction, 4);
-
-/* BSF r32, r/m32 */
-instruction[0] = 0x0f;
-instruction[1] = 0xbc;
-instruction[2] = 0xc0 | (tmp1_ind << 3) | tmp1_ind;
-sljit_emit_op_custom(compiler, instruction, 3);
-sljit_set_current_flags(compiler, SLJIT_SET_Z);
-
-JUMPTO(SLJIT_ZERO, start);
-
-JUMPHERE(quit);
-OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
-
-if (common->mode != PCRE2_JIT_COMPLETE)
- {
- JUMPHERE(partial_quit[0]);
- JUMPHERE(partial_quit[1]);
- OP2(SLJIT_SUB | SLJIT_SET_GREATER, SLJIT_UNUSED, 0, STR_PTR, 0, STR_END, 0);
- CMOV(SLJIT_GREATER, STR_PTR, STR_END, 0);
- }
-else
- add_jump(compiler, &common->failed_match, CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0));
-
-#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
-if (common->utf && offset > 0)
- {
- SLJIT_ASSERT(common->mode == PCRE2_JIT_COMPLETE);
-
- OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(-offset));
-
- quit = jump_if_utf_char_start(compiler, TMP1);
-
- OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
- add_jump(compiler, &common->failed_match, CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0));
- OP1(SLJIT_MOV, TMP2, 0, STR_PTR, 0);
- JUMPTO(SLJIT_JUMP, restart);
-
- JUMPHERE(quit);
- }
-#endif
-}
-
-#ifndef _WIN64
-
-static SLJIT_INLINE sljit_u32 max_fast_forward_char_pair_sse2_offset(void)
-{
-#if PCRE2_CODE_UNIT_WIDTH == 8
-return 15;
-#elif PCRE2_CODE_UNIT_WIDTH == 16
-return 7;
-#elif PCRE2_CODE_UNIT_WIDTH == 32
-return 3;
-#else
-#error "Unsupported unit width"
-#endif
-}
-
-static void fast_forward_char_pair_sse2(compiler_common *common, sljit_s32 offs1,
- PCRE2_UCHAR char1a, PCRE2_UCHAR char1b, sljit_s32 offs2, PCRE2_UCHAR char2a, PCRE2_UCHAR char2b)
-{
-DEFINE_COMPILER;
-sljit_u32 bit1 = 0;
-sljit_u32 bit2 = 0;
-sljit_u32 diff = IN_UCHARS(offs1 - offs2);
-sljit_s32 tmp1_ind = sljit_get_register_index(TMP1);
-sljit_s32 tmp2_ind = sljit_get_register_index(TMP2);
-sljit_s32 str_ptr_ind = sljit_get_register_index(STR_PTR);
-sljit_s32 data1_ind = 0;
-sljit_s32 data2_ind = 1;
-sljit_s32 tmp_ind = 2;
-sljit_s32 cmp1a_ind = 3;
-sljit_s32 cmp1b_ind = 4;
-sljit_s32 cmp2a_ind = 5;
-sljit_s32 cmp2b_ind = 6;
-struct sljit_label *start;
-#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
-struct sljit_label *restart;
-#endif
-struct sljit_jump *jump[2];
-
-sljit_u8 instruction[8];
-
-SLJIT_ASSERT(common->mode == PCRE2_JIT_COMPLETE && offs1 > offs2);
-SLJIT_ASSERT(diff <= IN_UCHARS(max_fast_forward_char_pair_sse2_offset()));
-SLJIT_ASSERT(tmp1_ind < 8 && tmp2_ind == 1);
-
-/* Initialize. */
-if (common->match_end_ptr != 0)
- {
- OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->match_end_ptr);
- OP1(SLJIT_MOV, TMP3, 0, STR_END, 0);
- OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, IN_UCHARS(offs1 + 1));
-
- OP2(SLJIT_SUB | SLJIT_SET_LESS, SLJIT_UNUSED, 0, TMP1, 0, STR_END, 0);
- CMOV(SLJIT_LESS, STR_END, TMP1, 0);
- }
-
-OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(offs1));
-add_jump(compiler, &common->failed_match, CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0));
-
-/* MOVD xmm, r/m32 */
-instruction[0] = 0x66;
-instruction[1] = 0x0f;
-instruction[2] = 0x6e;
-
-if (char1a == char1b)
- OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, character_to_int32(char1a));
-else
- {
- bit1 = char1a ^ char1b;
- if (is_powerof2(bit1))
- {
- OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, character_to_int32(char1a | bit1));
- OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, character_to_int32(bit1));
- }
- else
- {
- bit1 = 0;
- OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, character_to_int32(char1a));
- OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, character_to_int32(char1b));
- }
- }
-
-instruction[3] = 0xc0 | (cmp1a_ind << 3) | tmp1_ind;
-sljit_emit_op_custom(compiler, instruction, 4);
-
-if (char1a != char1b)
- {
- instruction[3] = 0xc0 | (cmp1b_ind << 3) | tmp2_ind;
- sljit_emit_op_custom(compiler, instruction, 4);
- }
-
-if (char2a == char2b)
- OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, character_to_int32(char2a));
-else
- {
- bit2 = char2a ^ char2b;
- if (is_powerof2(bit2))
- {
- OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, character_to_int32(char2a | bit2));
- OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, character_to_int32(bit2));
- }
- else
- {
- bit2 = 0;
- OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, character_to_int32(char2a));
- OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, character_to_int32(char2b));
- }
- }
-
-instruction[3] = 0xc0 | (cmp2a_ind << 3) | tmp1_ind;
-sljit_emit_op_custom(compiler, instruction, 4);
-
-if (char2a != char2b)
- {
- instruction[3] = 0xc0 | (cmp2b_ind << 3) | tmp2_ind;
- sljit_emit_op_custom(compiler, instruction, 4);
- }
-
-/* PSHUFD xmm1, xmm2/m128, imm8 */
-/* instruction[0] = 0x66; */
-/* instruction[1] = 0x0f; */
-instruction[2] = 0x70;
-instruction[4] = 0;
-
-instruction[3] = 0xc0 | (cmp1a_ind << 3) | cmp1a_ind;
-sljit_emit_op_custom(compiler, instruction, 5);
-
-if (char1a != char1b)
- {
- instruction[3] = 0xc0 | (cmp1b_ind << 3) | cmp1b_ind;
- sljit_emit_op_custom(compiler, instruction, 5);
- }
-
-instruction[3] = 0xc0 | (cmp2a_ind << 3) | cmp2a_ind;
-sljit_emit_op_custom(compiler, instruction, 5);
-
-if (char2a != char2b)
- {
- instruction[3] = 0xc0 | (cmp2b_ind << 3) | cmp2b_ind;
- sljit_emit_op_custom(compiler, instruction, 5);
- }
-
-#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
-restart = LABEL();
-#endif
-
-OP2(SLJIT_SUB, TMP1, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(offs1 - offs2));
-OP1(SLJIT_MOV, TMP2, 0, STR_PTR, 0);
-OP2(SLJIT_AND, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, ~0xf);
-OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, ~0xf);
-
-load_from_mem_sse2(compiler, data1_ind, str_ptr_ind);
-
-jump[0] = CMP(SLJIT_EQUAL, STR_PTR, 0, TMP1, 0);
-
-load_from_mem_sse2(compiler, data2_ind, tmp1_ind);
-
-/* MOVDQA xmm1, xmm2/m128 */
-/* instruction[0] = 0x66; */
-/* instruction[1] = 0x0f; */
-instruction[2] = 0x6f;
-instruction[3] = 0xc0 | (tmp_ind << 3) | data1_ind;
-sljit_emit_op_custom(compiler, instruction, 4);
-
-/* PSLLDQ xmm1, xmm2/m128, imm8 */
-/* instruction[0] = 0x66; */
-/* instruction[1] = 0x0f; */
-instruction[2] = 0x73;
-instruction[3] = 0xc0 | (7 << 3) | tmp_ind;
-instruction[4] = diff;
-sljit_emit_op_custom(compiler, instruction, 5);
-
-/* PSRLDQ xmm1, xmm2/m128, imm8 */
-/* instruction[0] = 0x66; */
-/* instruction[1] = 0x0f; */
-/* instruction[2] = 0x73; */
-instruction[3] = 0xc0 | (3 << 3) | data2_ind;
-instruction[4] = 16 - diff;
-sljit_emit_op_custom(compiler, instruction, 5);
-
-/* POR xmm1, xmm2/m128 */
-/* instruction[0] = 0x66; */
-/* instruction[1] = 0x0f; */
-instruction[2] = 0xeb;
-instruction[3] = 0xc0 | (data2_ind << 3) | tmp_ind;
-sljit_emit_op_custom(compiler, instruction, 4);
-
-jump[1] = JUMP(SLJIT_JUMP);
-
-JUMPHERE(jump[0]);
-
-/* MOVDQA xmm1, xmm2/m128 */
-/* instruction[0] = 0x66; */
-/* instruction[1] = 0x0f; */
-instruction[2] = 0x6f;
-instruction[3] = 0xc0 | (data2_ind << 3) | data1_ind;
-sljit_emit_op_custom(compiler, instruction, 4);
-
-/* PSLLDQ xmm1, xmm2/m128, imm8 */
-/* instruction[0] = 0x66; */
-/* instruction[1] = 0x0f; */
-instruction[2] = 0x73;
-instruction[3] = 0xc0 | (7 << 3) | data2_ind;
-instruction[4] = diff;
-sljit_emit_op_custom(compiler, instruction, 5);
-
-JUMPHERE(jump[1]);
-
-OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0xf);
-
-fast_forward_char_pair_sse2_compare(compiler, char2a, char2b, bit2, data2_ind, cmp2a_ind, cmp2b_ind, tmp_ind);
-fast_forward_char_pair_sse2_compare(compiler, char1a, char1b, bit1, data1_ind, cmp1a_ind, cmp1b_ind, tmp_ind);
-
-/* PAND xmm1, xmm2/m128 */
-/* instruction[0] = 0x66; */
-/* instruction[1] = 0x0f; */
-instruction[2] = 0xdb;
-instruction[3] = 0xc0 | (data1_ind << 3) | data2_ind;
-sljit_emit_op_custom(compiler, instruction, 4);
-
-/* PMOVMSKB reg, xmm */
-/* instruction[0] = 0x66; */
-/* instruction[1] = 0x0f; */
-instruction[2] = 0xd7;
-instruction[3] = 0xc0 | (tmp1_ind << 3) | 0;
-sljit_emit_op_custom(compiler, instruction, 4);
-
-/* Ignore matches before the first STR_PTR. */
-OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP2, 0);
-OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, TMP2, 0);
-
-/* BSF r32, r/m32 */
-instruction[0] = 0x0f;
-instruction[1] = 0xbc;
-instruction[2] = 0xc0 | (tmp1_ind << 3) | tmp1_ind;
-sljit_emit_op_custom(compiler, instruction, 3);
-sljit_set_current_flags(compiler, SLJIT_SET_Z);
-
-jump[0] = JUMP(SLJIT_NOT_ZERO);
-
-OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, TMP2, 0);
-
-/* Main loop. */
-instruction[0] = 0x66;
-instruction[1] = 0x0f;
-
-start = LABEL();
-
-load_from_mem_sse2(compiler, data2_ind, str_ptr_ind);
-
-OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, 16);
-add_jump(compiler, &common->failed_match, CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0));
-
-load_from_mem_sse2(compiler, data1_ind, str_ptr_ind);
-
-/* PSRLDQ xmm1, xmm2/m128, imm8 */
-/* instruction[0] = 0x66; */
-/* instruction[1] = 0x0f; */
-instruction[2] = 0x73;
-instruction[3] = 0xc0 | (3 << 3) | data2_ind;
-instruction[4] = 16 - diff;
-sljit_emit_op_custom(compiler, instruction, 5);
-
-/* MOVDQA xmm1, xmm2/m128 */
-/* instruction[0] = 0x66; */
-/* instruction[1] = 0x0f; */
-instruction[2] = 0x6f;
-instruction[3] = 0xc0 | (tmp_ind << 3) | data1_ind;
-sljit_emit_op_custom(compiler, instruction, 4);
-
-/* PSLLDQ xmm1, xmm2/m128, imm8 */
-/* instruction[0] = 0x66; */
-/* instruction[1] = 0x0f; */
-instruction[2] = 0x73;
-instruction[3] = 0xc0 | (7 << 3) | tmp_ind;
-instruction[4] = diff;
-sljit_emit_op_custom(compiler, instruction, 5);
-
-/* POR xmm1, xmm2/m128 */
-/* instruction[0] = 0x66; */
-/* instruction[1] = 0x0f; */
-instruction[2] = 0xeb;
-instruction[3] = 0xc0 | (data2_ind << 3) | tmp_ind;
-sljit_emit_op_custom(compiler, instruction, 4);
-
-fast_forward_char_pair_sse2_compare(compiler, char1a, char1b, bit1, data1_ind, cmp1a_ind, cmp1b_ind, tmp_ind);
-fast_forward_char_pair_sse2_compare(compiler, char2a, char2b, bit2, data2_ind, cmp2a_ind, cmp2b_ind, tmp_ind);
-
-/* PAND xmm1, xmm2/m128 */
-/* instruction[0] = 0x66; */
-/* instruction[1] = 0x0f; */
-instruction[2] = 0xdb;
-instruction[3] = 0xc0 | (data1_ind << 3) | data2_ind;
-sljit_emit_op_custom(compiler, instruction, 4);
-
-/* PMOVMSKB reg, xmm */
-/* instruction[0] = 0x66; */
-/* instruction[1] = 0x0f; */
-instruction[2] = 0xd7;
-instruction[3] = 0xc0 | (tmp1_ind << 3) | 0;
-sljit_emit_op_custom(compiler, instruction, 4);
-
-/* BSF r32, r/m32 */
-instruction[0] = 0x0f;
-instruction[1] = 0xbc;
-instruction[2] = 0xc0 | (tmp1_ind << 3) | tmp1_ind;
-sljit_emit_op_custom(compiler, instruction, 3);
-sljit_set_current_flags(compiler, SLJIT_SET_Z);
-
-JUMPTO(SLJIT_ZERO, start);
-
-JUMPHERE(jump[0]);
-
-OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
-
-add_jump(compiler, &common->failed_match, CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0));
-
-if (common->match_end_ptr != 0)
- OP1(SLJIT_MOV, STR_END, 0, SLJIT_MEM1(SLJIT_SP), common->match_end_ptr);
-
-#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
-if (common->utf)
- {
- OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(-offs1));
-
- jump[0] = jump_if_utf_char_start(compiler, TMP1);
-
- OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
- CMPTO(SLJIT_LESS, STR_PTR, 0, STR_END, 0, restart);
-
- add_jump(compiler, &common->failed_match, JUMP(SLJIT_JUMP));
-
- JUMPHERE(jump[0]);
- }
-#endif
-
-OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(offs1));
-
-if (common->match_end_ptr != 0)
- OP1(SLJIT_MOV, STR_END, 0, TMP3, 0);
-}
-
-static BOOL check_fast_forward_char_pair_sse2(compiler_common *common, fast_forward_char_data *chars, int max)
-{
-sljit_s32 i, j, priority, count;
-sljit_u32 priorities;
-PCRE2_UCHAR a1, a2, b1, b2;
-
-priorities = 0;
-
-count = 0;
-for (i = 0; i < max; i++)
- {
- if (chars[i].last_count > 2)
- {
- SLJIT_ASSERT(chars[i].last_count <= 7);
-
- priorities |= (1 << chars[i].last_count);
- count++;
- }
- }
-
-if (count < 2)
- return FALSE;
-
-for (priority = 7; priority > 2; priority--)
- {
- if ((priorities & (1 << priority)) == 0)
- continue;
+ sljit_s32 i, j, max_i = 0, max_j = 0;
+ sljit_u32 max_pri = 0;
+ PCRE2_UCHAR a1, a2, a_pri, b1, b2, b_pri;
for (i = max - 1; i >= 1; i--)
- if (chars[i].last_count >= priority)
+ {
+ if (chars[i].last_count > 2)
{
- SLJIT_ASSERT(chars[i].count <= 2 && chars[i].count >= 1);
-
a1 = chars[i].chars[0];
a2 = chars[i].chars[1];
+ a_pri = chars[i].last_count;
- j = i - max_fast_forward_char_pair_sse2_offset();
+ j = i - max_fast_forward_char_pair_offset();
if (j < 0)
j = 0;
while (j < i)
{
- if (chars[j].last_count >= priority)
+ b_pri = chars[j].last_count;
+ if (b_pri > 2 && a_pri + b_pri >= max_pri)
{
b1 = chars[j].chars[0];
b2 = chars[j].chars[1];
if (a1 != b1 && a1 != b2 && a2 != b1 && a2 != b2)
{
- fast_forward_char_pair_sse2(common, i, a1, a2, j, b1, b2);
- return TRUE;
+ max_pri = a_pri + b_pri;
+ max_i = i;
+ max_j = j;
}
}
j++;
}
}
- }
-
-return FALSE;
-}
+ }
-#endif
+if (max_pri == 0)
+ return FALSE;
-#undef SSE2_COMPARE_TYPE_INDEX
+fast_forward_char_pair_simd(common, max_i, chars[max_i].chars[0], chars[max_i].chars[1], max_j, chars[max_j].chars[0], chars[max_j].chars[1]);
+return TRUE;
+}
-#endif
+#endif /* JIT_HAS_FAST_FORWARD_CHAR_PAIR_SIMD */
static void fast_forward_first_char2(compiler_common *common, PCRE2_UCHAR char1, PCRE2_UCHAR char2, sljit_s32 offset)
{
@@ -6154,13 +5596,11 @@ if (has_match_end)
CMOV(SLJIT_GREATER, STR_END, TMP1, 0);
}
-#if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86) && !(defined SUPPORT_VALGRIND)
+#ifdef JIT_HAS_FAST_FORWARD_CHAR_SIMD
-/* SSE2 accelerated first character search. */
-
-if (sljit_has_cpu_feature(SLJIT_HAS_SSE2))
+if (JIT_HAS_FAST_FORWARD_CHAR_SIMD)
{
- fast_forward_first_char2_sse2(common, char1, char2, offset);
+ fast_forward_char_simd(common, char1, char2, offset);
if (offset > 0)
OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(offset));
@@ -6267,8 +5707,8 @@ for (i = 0; i < max; i++)
chars[i].last_count = (chars[i].count == 255) ? 0 : 1;
}
-#if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86) && !(defined SUPPORT_VALGRIND) && !(defined _WIN64)
-if (sljit_has_cpu_feature(SLJIT_HAS_SSE2) && check_fast_forward_char_pair_sse2(common, chars, max))
+#ifdef JIT_HAS_FAST_FORWARD_CHAR_PAIR_SIMD
+if (JIT_HAS_FAST_FORWARD_CHAR_PAIR_SIMD && check_fast_forward_char_pair_simd(common, chars, max))
return TRUE;
#endif
@@ -6353,18 +5793,21 @@ if (common->match_end_ptr != 0)
{
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->match_end_ptr);
OP1(SLJIT_MOV, TMP3, 0, STR_END, 0);
- OP2(SLJIT_SUB, STR_END, 0, STR_END, 0, SLJIT_IMM, IN_UCHARS(max));
+ OP2(SLJIT_SUB | SLJIT_SET_LESS, STR_END, 0, STR_END, 0, SLJIT_IMM, IN_UCHARS(max));
+ add_jump(compiler, &common->failed_match, JUMP(SLJIT_LESS));
OP2(SLJIT_SUB | SLJIT_SET_GREATER, SLJIT_UNUSED, 0, STR_END, 0, TMP1, 0);
CMOV(SLJIT_GREATER, STR_END, TMP1, 0);
}
else
- OP2(SLJIT_SUB, STR_END, 0, STR_END, 0, SLJIT_IMM, IN_UCHARS(max));
+ {
+ OP2(SLJIT_SUB | SLJIT_SET_LESS, STR_END, 0, STR_END, 0, SLJIT_IMM, IN_UCHARS(max));
+ add_jump(compiler, &common->failed_match, JUMP(SLJIT_LESS));
+ }
SLJIT_ASSERT(range_right >= 0);
-#if !(defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
-OP1(SLJIT_MOV, RETURN_ADDR, 0, SLJIT_IMM, (sljit_sw)update_table);
-#endif
+if (!HAS_VIRTUAL_REGISTERS)
+ OP1(SLJIT_MOV, RETURN_ADDR, 0, SLJIT_IMM, (sljit_sw)update_table);
start = LABEL();
add_jump(compiler, &common->failed_match, CMP(SLJIT_GREATER, STR_PTR, 0, STR_END, 0));
@@ -6375,11 +5818,11 @@ OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(range_right));
OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(range_right + 1) - 1);
#endif
-#if !(defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
-OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM2(RETURN_ADDR, TMP1), 0);
-#else
-OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)update_table);
-#endif
+if (!HAS_VIRTUAL_REGISTERS)
+ OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM2(RETURN_ADDR, TMP1), 0);
+else
+ OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)update_table);
+
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, 0, start);
@@ -6473,9 +5916,17 @@ if (common->match_end_ptr != 0)
if (common->nltype == NLTYPE_FIXED && common->newline > 255)
{
lastchar = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
- OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
- OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, str));
- OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, begin));
+ if (HAS_VIRTUAL_REGISTERS)
+ {
+ OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
+ OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, str));
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, begin));
+ }
+ else
+ {
+ OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, str));
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, begin));
+ }
firstchar = CMP(SLJIT_LESS_EQUAL, STR_PTR, 0, TMP2, 0);
OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, IN_UCHARS(2));
@@ -6503,9 +5954,15 @@ if (common->nltype == NLTYPE_FIXED && common->newline > 255)
return;
}
-OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
+if (HAS_VIRTUAL_REGISTERS)
+ {
+ OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
+ OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, str));
+ }
+else
+ OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, str));
+
/* Example: match /^/ to \r\n from offset 1. */
-OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, str));
firstchar = CMP(SLJIT_LESS_EQUAL, STR_PTR, 0, TMP2, 0);
move_back(common, NULL, FALSE);
@@ -6586,7 +6043,7 @@ if (!optimize_class(common, start_bits, (start_bits[31] & 0x80) != 0, FALSE, &ma
OP2(SLJIT_AND, TMP2, 0, TMP1, 0, SLJIT_IMM, 0x7);
OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3);
OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)start_bits);
- if (sljit_get_register_index(TMP3) >= 0)
+ if (!HAS_VIRTUAL_REGISTERS)
{
OP2(SLJIT_SHL, TMP3, 0, SLJIT_IMM, 1, TMP2, 0);
OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, TMP3, 0);
@@ -6693,7 +6150,7 @@ OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), -sizeof(sljit_sw));
jump = CMP(SLJIT_SIG_LESS_EQUAL, TMP2, 0, SLJIT_IMM, 0);
OP2(SLJIT_ADD, TMP2, 0, TMP2, 0, TMP1, 0);
-if (sljit_get_register_index(TMP3) < 0)
+if (HAS_VIRTUAL_REGISTERS)
{
OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), 0, SLJIT_MEM1(STACK_TOP), -(2 * sizeof(sljit_sw)));
OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), sizeof(sljit_sw), SLJIT_MEM1(STACK_TOP), -(3 * sizeof(sljit_sw)));
@@ -6718,7 +6175,7 @@ sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
JUMPHERE(jump);
OP1(SLJIT_NEG, TMP2, 0, TMP2, 0);
OP2(SLJIT_ADD, TMP2, 0, TMP2, 0, TMP1, 0);
-if (sljit_get_register_index(TMP3) < 0)
+if (HAS_VIRTUAL_REGISTERS)
{
OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), 0, SLJIT_MEM1(STACK_TOP), -(2 * sizeof(sljit_sw)));
OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, 2 * sizeof(sljit_sw));
@@ -6737,7 +6194,11 @@ static void check_wordboundary(compiler_common *common)
DEFINE_COMPILER;
struct sljit_jump *skipread;
jump_list *skipread_list = NULL;
-jump_list *invalid_utf = NULL;
+#ifdef SUPPORT_UNICODE
+struct sljit_label *valid_utf;
+jump_list *invalid_utf1 = NULL;
+#endif /* SUPPORT_UNICODE */
+jump_list *invalid_utf2 = NULL;
#if PCRE2_CODE_UNIT_WIDTH != 8 || defined SUPPORT_UNICODE
struct sljit_jump *jump;
#endif /* PCRE2_CODE_UNIT_WIDTH != 8 || SUPPORT_UNICODE */
@@ -6751,14 +6212,30 @@ OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, begin));
OP1(SLJIT_MOV, TMP3, 0, SLJIT_IMM, 0);
skipread = CMP(SLJIT_LESS_EQUAL, STR_PTR, 0, TMP2, 0);
-if (common->mode == PCRE2_JIT_COMPLETE)
- peek_char_back(common, READ_CHAR_MAX, &invalid_utf);
+#ifdef SUPPORT_UNICODE
+if (common->invalid_utf)
+ {
+ peek_char_back(common, READ_CHAR_MAX, &invalid_utf1);
+
+ if (common->mode != PCRE2_JIT_COMPLETE)
+ {
+ OP1(SLJIT_MOV, TMP2, 0, STR_PTR, 0);
+ move_back(common, NULL, TRUE);
+ check_start_used_ptr(common);
+ OP1(SLJIT_MOV, STR_PTR, 0, TMP2, 0);
+ }
+ }
else
+#endif /* SUPPORT_UNICODE */
{
- move_back(common, &invalid_utf, FALSE);
- check_start_used_ptr(common);
- /* No need precise read since match fails anyway. */
- read_char(common, 0, READ_CHAR_MAX, &invalid_utf, READ_CHAR_UPDATE_STR_PTR);
+ if (common->mode == PCRE2_JIT_COMPLETE)
+ peek_char_back(common, READ_CHAR_MAX, NULL);
+ else
+ {
+ move_back(common, NULL, TRUE);
+ check_start_used_ptr(common);
+ read_char(common, 0, READ_CHAR_MAX, NULL, READ_CHAR_UPDATE_STR_PTR);
+ }
}
/* Testing char type. */
@@ -6802,10 +6279,13 @@ JUMPHERE(skipread);
OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, 0);
check_str_end(common, &skipread_list);
-peek_char(common, READ_CHAR_MAX, SLJIT_MEM1(SLJIT_SP), LOCALS1, &invalid_utf);
+peek_char(common, READ_CHAR_MAX, SLJIT_MEM1(SLJIT_SP), LOCALS1, &invalid_utf2);
/* Testing char type. This is a code duplication. */
#ifdef SUPPORT_UNICODE
+
+valid_utf = LABEL();
+
if (common->use_ucp)
{
OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, 1);
@@ -6851,13 +6331,19 @@ sljit_emit_fast_return(compiler, TMP1, 0);
#ifdef SUPPORT_UNICODE
if (common->invalid_utf)
{
- SLJIT_ASSERT(invalid_utf != NULL);
+ set_jumps(invalid_utf1, LABEL());
+
+ peek_char(common, READ_CHAR_MAX, SLJIT_MEM1(SLJIT_SP), LOCALS1, NULL);
+ CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, INVALID_UTF_CHAR, valid_utf);
- set_jumps(invalid_utf, LABEL());
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), LOCALS0);
OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, -1);
sljit_emit_fast_return(compiler, TMP1, 0);
- return;
+
+ set_jumps(invalid_utf2, LABEL());
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), LOCALS0);
+ OP1(SLJIT_MOV, TMP2, 0, TMP3, 0);
+ sljit_emit_fast_return(compiler, TMP1, 0);
}
#endif /* SUPPORT_UNICODE */
}
@@ -7225,7 +6711,7 @@ struct sljit_label *label;
int char1_reg;
int char2_reg;
-if (sljit_get_register_index(TMP3) < 0)
+if (HAS_VIRTUAL_REGISTERS)
{
char1_reg = STR_END;
char2_reg = STACK_TOP;
@@ -7307,7 +6793,7 @@ int char2_reg;
int lcc_table;
int opt_type = 0;
-if (sljit_get_register_index(TMP3) < 0)
+if (HAS_VIRTUAL_REGISTERS)
{
char2_reg = STACK_TOP;
lcc_table = STACK_LIMIT;
@@ -7790,8 +7276,6 @@ if (needstype || needsscript)
if (needsscript)
{
// PH hacking
-//fprintf(stderr, "~~B\n");
-
OP2(SLJIT_SHL, TMP1, 0, TMP2, 0, SLJIT_IMM, 2);
OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 3);
OP2(SLJIT_ADD, TMP2, 0, TMP2, 0, TMP1, 0);
@@ -7845,7 +7329,6 @@ if (needstype || needsscript)
if (!needschar)
{
// PH hacking
-//fprintf(stderr, "~~C\n");
OP2(SLJIT_SHL, TMP1, 0, TMP2, 0, SLJIT_IMM, 2);
OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 3);
OP2(SLJIT_ADD, TMP2, 0, TMP2, 0, TMP1, 0);
@@ -7860,7 +7343,6 @@ if (needstype || needsscript)
else
{
// PH hacking
-//fprintf(stderr, "~~D\n");
OP2(SLJIT_SHL, TMP1, 0, TMP2, 0, SLJIT_IMM, 2);
OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 3);
@@ -8174,14 +7656,24 @@ struct sljit_label *label;
switch(type)
{
case OP_SOD:
- OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
- OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, begin));
+ if (HAS_VIRTUAL_REGISTERS)
+ {
+ OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, begin));
+ }
+ else
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, begin));
add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, STR_PTR, 0, TMP1, 0));
return cc;
case OP_SOM:
- OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
- OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, str));
+ if (HAS_VIRTUAL_REGISTERS)
+ {
+ OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, str));
+ }
+ else
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, str));
add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, STR_PTR, 0, TMP1, 0));
return cc;
@@ -8191,9 +7683,7 @@ switch(type)
#ifdef SUPPORT_UNICODE
if (common->invalid_utf)
{
- OP2(SLJIT_SUB | SLJIT_SET_Z | SLJIT_SET_SIG_LESS, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, 0);
- add_jump(compiler, backtracks, JUMP(SLJIT_SIG_LESS));
- add_jump(compiler, backtracks, JUMP(type == OP_NOT_WORD_BOUNDARY ? SLJIT_NOT_ZERO : SLJIT_ZERO));
+ add_jump(compiler, backtracks, CMP((type == OP_NOT_WORD_BOUNDARY) ? SLJIT_NOT_EQUAL : SLJIT_SIG_LESS_EQUAL, TMP2, 0, SLJIT_IMM, 0));
return cc;
}
#endif /* SUPPORT_UNICODE */
@@ -8267,17 +7757,24 @@ switch(type)
JUMPHERE(jump[3]);
}
JUMPHERE(jump[0]);
- check_partial(common, FALSE);
+ if (common->mode != PCRE2_JIT_COMPLETE)
+ check_partial(common, TRUE);
return cc;
case OP_EOD:
add_jump(compiler, backtracks, CMP(SLJIT_LESS, STR_PTR, 0, STR_END, 0));
- check_partial(common, FALSE);
+ if (common->mode != PCRE2_JIT_COMPLETE)
+ check_partial(common, TRUE);
return cc;
case OP_DOLL:
- OP1(SLJIT_MOV, TMP2, 0, ARGUMENTS, 0);
- OP2(SLJIT_AND32 | SLJIT_SET_Z, SLJIT_UNUSED, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTEOL);
+ if (HAS_VIRTUAL_REGISTERS)
+ {
+ OP1(SLJIT_MOV, TMP2, 0, ARGUMENTS, 0);
+ OP2(SLJIT_AND32 | SLJIT_SET_Z, SLJIT_UNUSED, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTEOL);
+ }
+ else
+ OP2(SLJIT_AND32 | SLJIT_SET_Z, SLJIT_UNUSED, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTEOL);
add_jump(compiler, backtracks, JUMP(SLJIT_NOT_ZERO32));
if (!common->endonly)
@@ -8291,8 +7788,13 @@ switch(type)
case OP_DOLLM:
jump[1] = CMP(SLJIT_LESS, STR_PTR, 0, STR_END, 0);
- OP1(SLJIT_MOV, TMP2, 0, ARGUMENTS, 0);
- OP2(SLJIT_AND32 | SLJIT_SET_Z, SLJIT_UNUSED, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTEOL);
+ if (HAS_VIRTUAL_REGISTERS)
+ {
+ OP1(SLJIT_MOV, TMP2, 0, ARGUMENTS, 0);
+ OP2(SLJIT_AND32 | SLJIT_SET_Z, SLJIT_UNUSED, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTEOL);
+ }
+ else
+ OP2(SLJIT_AND32 | SLJIT_SET_Z, SLJIT_UNUSED, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTEOL);
add_jump(compiler, backtracks, JUMP(SLJIT_NOT_ZERO32));
check_partial(common, FALSE);
jump[0] = JUMP(SLJIT_JUMP);
@@ -8327,18 +7829,38 @@ switch(type)
return cc;
case OP_CIRC:
- OP1(SLJIT_MOV, TMP2, 0, ARGUMENTS, 0);
- OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, begin));
- add_jump(compiler, backtracks, CMP(SLJIT_GREATER, STR_PTR, 0, TMP1, 0));
- OP2(SLJIT_AND32 | SLJIT_SET_Z, SLJIT_UNUSED, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTBOL);
- add_jump(compiler, backtracks, JUMP(SLJIT_NOT_ZERO32));
+ if (HAS_VIRTUAL_REGISTERS)
+ {
+ OP1(SLJIT_MOV, TMP2, 0, ARGUMENTS, 0);
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, begin));
+ add_jump(compiler, backtracks, CMP(SLJIT_GREATER, STR_PTR, 0, TMP1, 0));
+ OP2(SLJIT_AND32 | SLJIT_SET_Z, SLJIT_UNUSED, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTBOL);
+ add_jump(compiler, backtracks, JUMP(SLJIT_NOT_ZERO32));
+ }
+ else
+ {
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, begin));
+ add_jump(compiler, backtracks, CMP(SLJIT_GREATER, STR_PTR, 0, TMP1, 0));
+ OP2(SLJIT_AND32 | SLJIT_SET_Z, SLJIT_UNUSED, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTBOL);
+ add_jump(compiler, backtracks, JUMP(SLJIT_NOT_ZERO32));
+ }
return cc;
case OP_CIRCM:
- OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
- OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, begin));
- jump[1] = CMP(SLJIT_GREATER, STR_PTR, 0, TMP2, 0);
- OP2(SLJIT_AND32 | SLJIT_SET_Z, SLJIT_UNUSED, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTBOL);
+ /* TMP2 might be used by peek_char_back. */
+ if (HAS_VIRTUAL_REGISTERS)
+ {
+ OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
+ OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, begin));
+ jump[1] = CMP(SLJIT_GREATER, STR_PTR, 0, TMP2, 0);
+ OP2(SLJIT_AND32 | SLJIT_SET_Z, SLJIT_UNUSED, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTBOL);
+ }
+ else
+ {
+ OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, begin));
+ jump[1] = CMP(SLJIT_GREATER, STR_PTR, 0, TMP2, 0);
+ OP2(SLJIT_AND32 | SLJIT_SET_Z, SLJIT_UNUSED, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTBOL);
+ }
add_jump(compiler, backtracks, JUMP(SLJIT_NOT_ZERO32));
jump[0] = JUMP(SLJIT_JUMP);
JUMPHERE(jump[1]);
@@ -8367,11 +7889,16 @@ switch(type)
length = GET(cc, 0);
if (length == 0)
return cc + LINK_SIZE;
- OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
+ if (HAS_VIRTUAL_REGISTERS)
+ {
+ OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
+ OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, begin));
+ }
+ else
+ OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, begin));
#ifdef SUPPORT_UNICODE
if (common->utf)
{
- OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, begin));
OP1(SLJIT_MOV, TMP3, 0, SLJIT_IMM, length);
label = LABEL();
add_jump(compiler, backtracks, CMP(SLJIT_LESS_EQUAL, STR_PTR, 0, TMP2, 0));
@@ -8382,9 +7909,8 @@ switch(type)
else
#endif
{
- OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, begin));
OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(length));
- add_jump(compiler, backtracks, CMP(SLJIT_LESS, STR_PTR, 0, TMP1, 0));
+ add_jump(compiler, backtracks, CMP(SLJIT_LESS, STR_PTR, 0, TMP2, 0));
}
check_start_used_ptr(common);
return cc + LINK_SIZE;
@@ -8402,12 +7928,12 @@ static PCRE2_SPTR SLJIT_FUNC do_extuni_utf(jit_arguments *args, PCRE2_SPTR cc)
PCRE2_SPTR start_subject = args->begin;
PCRE2_SPTR end_subject = args->end;
int lgb, rgb, ricount;
-PCRE2_SPTR prevcc, startcc, bptr;
+PCRE2_SPTR prevcc, endcc, bptr;
BOOL first = TRUE;
uint32_t c;
prevcc = cc;
-startcc = NULL;
+endcc = NULL;
do
{
GETCHARINC(c, cc);
@@ -8416,7 +7942,7 @@ do
if (first)
{
lgb = rgb;
- startcc = cc;
+ endcc = cc;
first = FALSE;
continue;
}
@@ -8455,25 +7981,27 @@ do
lgb != ucp_gbExtended_Pictographic)
lgb = rgb;
- prevcc = startcc;
- startcc = cc;
+ prevcc = endcc;
+ endcc = cc;
}
while (cc < end_subject);
-return startcc;
+return endcc;
}
+#endif /* PCRE2_CODE_UNIT_WIDTH != 32 */
+
static PCRE2_SPTR SLJIT_FUNC do_extuni_utf_invalid(jit_arguments *args, PCRE2_SPTR cc)
{
PCRE2_SPTR start_subject = args->begin;
PCRE2_SPTR end_subject = args->end;
int lgb, rgb, ricount;
-PCRE2_SPTR prevcc, startcc, bptr;
+PCRE2_SPTR prevcc, endcc, bptr;
BOOL first = TRUE;
uint32_t c;
prevcc = cc;
-startcc = NULL;
+endcc = NULL;
do
{
GETCHARINC_INVALID(c, cc, end_subject, break);
@@ -8482,7 +8010,7 @@ do
if (first)
{
lgb = rgb;
- startcc = cc;
+ endcc = cc;
first = FALSE;
continue;
}
@@ -8520,16 +8048,14 @@ do
lgb != ucp_gbExtended_Pictographic)
lgb = rgb;
- prevcc = startcc;
- startcc = cc;
+ prevcc = endcc;
+ endcc = cc;
}
while (cc < end_subject);
-return startcc;
+return endcc;
}
-#endif /* PCRE2_CODE_UNIT_WIDTH != 32 */
-
static PCRE2_SPTR SLJIT_FUNC do_extuni_no_utf(jit_arguments *args, PCRE2_SPTR cc)
{
PCRE2_SPTR start_subject = args->begin;
@@ -8538,7 +8064,10 @@ int lgb, rgb, ricount;
PCRE2_SPTR bptr;
uint32_t c;
+/* Patch by PH */
+/* GETCHARINC(c, cc); */
c = *cc++;
+
#if PCRE2_CODE_UNIT_WIDTH == 32
if (c >= 0x110000)
return NULL;
@@ -8800,8 +8329,10 @@ switch(type)
if (common->invalid_utf)
add_jump(compiler, backtracks, CMP(SLJIT_EQUAL, SLJIT_RETURN_REG, 0, SLJIT_IMM, 0));
#else
- sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(SW) | SLJIT_ARG1(SW) | SLJIT_ARG2(SW), SLJIT_IMM, SLJIT_FUNC_OFFSET(do_extuni_no_utf));
- add_jump(compiler, backtracks, CMP(SLJIT_EQUAL, SLJIT_RETURN_REG, 0, SLJIT_IMM, 0));
+ sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(SW) | SLJIT_ARG1(SW) | SLJIT_ARG2(SW), SLJIT_IMM,
+ common->invalid_utf ? SLJIT_FUNC_OFFSET(do_extuni_utf_invalid) : SLJIT_FUNC_OFFSET(do_extuni_no_utf));
+ if (!common->utf || common->invalid_utf)
+ add_jump(compiler, backtracks, CMP(SLJIT_EQUAL, SLJIT_RETURN_REG, 0, SLJIT_IMM, 0));
#endif
OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_RETURN_REG, 0);
@@ -9198,8 +8729,6 @@ if (common->utf && *cc == OP_REFI)
CMPTO(SLJIT_EQUAL, TMP1, 0, char1_reg, 0, loop);
// PH hacking
-//fprintf(stderr, "~~E\n");
-
OP1(SLJIT_MOV, TMP3, 0, TMP1, 0);
add_jump(compiler, &common->getucd, JUMP(SLJIT_FAST_CALL));
@@ -10759,10 +10288,23 @@ if (ket != OP_KET || bra != OP_BRA)
if (offset != 0)
stacksize = match_capture_common(common, stacksize, offset, private_data_ptr);
+/* Skip and count the other alternatives. */
+i = 1;
+while (*cc == OP_ALT)
+ {
+ cc += GET(cc, 1);
+ i++;
+ }
+
if (has_alternatives)
{
if (opcode != OP_ONCE)
- OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(stacksize), SLJIT_IMM, 0);
+ {
+ if (i <= 3)
+ OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(stacksize), SLJIT_IMM, 0);
+ else
+ BACKTRACK_AS(bracket_backtrack)->u.matching_put_label = sljit_emit_put_label(compiler, SLJIT_MEM1(STACK_TOP), STACK(stacksize));
+ }
if (ket != OP_KETRMAX)
BACKTRACK_AS(bracket_backtrack)->alternative_matchingpath = LABEL();
}
@@ -10851,9 +10393,6 @@ if (bra == OP_BRAMINZERO)
if ((ket != OP_KET && bra != OP_BRAMINZERO) || bra == OP_BRAZERO)
count_match(common);
-/* Skip the other alternatives. */
-while (*cc == OP_ALT)
- cc += GET(cc, 1);
cc += 1 + LINK_SIZE;
if (opcode == OP_ONCE)
@@ -11412,174 +10951,232 @@ switch(opcode)
JUMPTO(SLJIT_JUMP, label);
if (jump != NULL)
JUMPHERE(jump);
+ BACKTRACK_AS(char_iterator_backtrack)->matchingpath = LABEL();
+ break;
}
- else
- {
- charpos_enabled = FALSE;
- charpos_char = 0;
- charpos_othercasebit = 0;
-
- if ((type != OP_CHAR && type != OP_CHARI) && (*end == OP_CHAR || *end == OP_CHARI))
- {
- charpos_enabled = TRUE;
#ifdef SUPPORT_UNICODE
- charpos_enabled = !common->utf || !HAS_EXTRALEN(end[1]);
-#endif
- if (charpos_enabled && *end == OP_CHARI && char_has_othercase(common, end + 1))
- {
- charpos_othercasebit = char_get_othercase_bit(common, end + 1);
- if (charpos_othercasebit == 0)
- charpos_enabled = FALSE;
- }
-
- if (charpos_enabled)
- {
- charpos_char = end[1];
- /* Consumpe the OP_CHAR opcode. */
- end += 2;
-#if PCRE2_CODE_UNIT_WIDTH == 8
- SLJIT_ASSERT((charpos_othercasebit >> 8) == 0);
-#elif PCRE2_CODE_UNIT_WIDTH == 16 || PCRE2_CODE_UNIT_WIDTH == 32
- SLJIT_ASSERT((charpos_othercasebit >> 9) == 0);
- if ((charpos_othercasebit & 0x100) != 0)
- charpos_othercasebit = (charpos_othercasebit & 0xff) << 8;
+ else if (type == OP_ALLANY && !common->invalid_utf)
+#else
+ else if (type == OP_ALLANY)
#endif
- if (charpos_othercasebit != 0)
- charpos_char |= charpos_othercasebit;
-
- BACKTRACK_AS(char_iterator_backtrack)->u.charpos.enabled = TRUE;
- BACKTRACK_AS(char_iterator_backtrack)->u.charpos.chr = charpos_char;
- BACKTRACK_AS(char_iterator_backtrack)->u.charpos.othercasebit = charpos_othercasebit;
- }
- }
-
- if (charpos_enabled)
+ {
+ if (opcode == OP_STAR)
{
- if (opcode == OP_UPTO)
- OP1(SLJIT_MOV, tmp_base, tmp_offset, SLJIT_IMM, max + 1);
+ if (private_data_ptr == 0)
+ allocate_stack(common, 2);
- /* Search the first instance of charpos_char. */
- jump = JUMP(SLJIT_JUMP);
- label = LABEL();
- if (opcode == OP_UPTO)
- {
- OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
- add_jump(compiler, &backtrack->topbacktracks, JUMP(SLJIT_ZERO));
- }
- compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks, FALSE);
- if (fast_str_ptr != 0)
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), fast_str_ptr, STR_PTR, 0);
- JUMPHERE(jump);
+ OP1(SLJIT_MOV, base, offset0, STR_END, 0);
+ OP1(SLJIT_MOV, base, offset1, STR_PTR, 0);
- detect_partial_match(common, &backtrack->topbacktracks);
- OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));
- if (charpos_othercasebit != 0)
- OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, charpos_othercasebit);
- CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, charpos_char, label);
+ OP1(SLJIT_MOV, STR_PTR, 0, STR_END, 0);
+ process_partial_match(common);
+ if (fast_str_ptr != 0)
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), fast_str_ptr, STR_END, 0);
+ BACKTRACK_AS(char_iterator_backtrack)->matchingpath = LABEL();
+ break;
+ }
+#ifdef SUPPORT_UNICODE
+ else if (!common->utf)
+#else
+ else
+#endif
+ {
if (private_data_ptr == 0)
allocate_stack(common, 2);
- OP1(SLJIT_MOV, base, offset0, STR_PTR, 0);
+
OP1(SLJIT_MOV, base, offset1, STR_PTR, 0);
- if (opcode == OP_UPTO)
- {
- OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
- add_jump(compiler, &no_match, JUMP(SLJIT_ZERO));
- }
+ OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(max));
- /* Search the last instance of charpos_char. */
- label = LABEL();
- compile_char1_matchingpath(common, type, cc, &no_match, FALSE);
- if (fast_str_ptr != 0)
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), fast_str_ptr, STR_PTR, 0);
- detect_partial_match(common, &no_match);
- OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));
- if (charpos_othercasebit != 0)
- OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, charpos_othercasebit);
- if (opcode == OP_STAR)
+ if (common->mode == PCRE2_JIT_COMPLETE)
{
- CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, charpos_char, label);
- OP1(SLJIT_MOV, base, offset0, STR_PTR, 0);
+ OP2(SLJIT_SUB | SLJIT_SET_GREATER, SLJIT_UNUSED, 0, STR_PTR, 0, STR_END, 0);
+ CMOV(SLJIT_GREATER, STR_PTR, STR_END, 0);
}
else
{
- jump = CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, charpos_char);
- OP1(SLJIT_MOV, base, offset0, STR_PTR, 0);
+ jump = CMP(SLJIT_LESS_EQUAL, STR_PTR, 0, STR_END, 0);
+ process_partial_match(common);
JUMPHERE(jump);
}
- if (opcode == OP_UPTO)
- {
- OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
- JUMPTO(SLJIT_NOT_ZERO, label);
- }
- else
- JUMPTO(SLJIT_JUMP, label);
-
- set_jumps(no_match, LABEL());
- OP1(SLJIT_MOV, STR_PTR, 0, base, offset0);
- OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
OP1(SLJIT_MOV, base, offset0, STR_PTR, 0);
+
+ if (fast_str_ptr != 0)
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), fast_str_ptr, STR_PTR, 0);
+ BACKTRACK_AS(char_iterator_backtrack)->matchingpath = LABEL();
+ break;
}
-#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
- else if (common->utf)
+ }
+
+ charpos_enabled = FALSE;
+ charpos_char = 0;
+ charpos_othercasebit = 0;
+
+ if ((type != OP_CHAR && type != OP_CHARI) && (*end == OP_CHAR || *end == OP_CHARI))
+ {
+#ifdef SUPPORT_UNICODE
+ charpos_enabled = !common->utf || !HAS_EXTRALEN(end[1]);
+#else
+ charpos_enabled = TRUE;
+#endif
+ if (charpos_enabled && *end == OP_CHARI && char_has_othercase(common, end + 1))
{
- if (private_data_ptr == 0)
- allocate_stack(common, 2);
+ charpos_othercasebit = char_get_othercase_bit(common, end + 1);
+ if (charpos_othercasebit == 0)
+ charpos_enabled = FALSE;
+ }
- OP1(SLJIT_MOV, base, offset0, STR_PTR, 0);
- OP1(SLJIT_MOV, base, offset1, STR_PTR, 0);
+ if (charpos_enabled)
+ {
+ charpos_char = end[1];
+ /* Consumpe the OP_CHAR opcode. */
+ end += 2;
+#if PCRE2_CODE_UNIT_WIDTH == 8
+ SLJIT_ASSERT((charpos_othercasebit >> 8) == 0);
+#elif PCRE2_CODE_UNIT_WIDTH == 16 || PCRE2_CODE_UNIT_WIDTH == 32
+ SLJIT_ASSERT((charpos_othercasebit >> 9) == 0);
+ if ((charpos_othercasebit & 0x100) != 0)
+ charpos_othercasebit = (charpos_othercasebit & 0xff) << 8;
+#endif
+ if (charpos_othercasebit != 0)
+ charpos_char |= charpos_othercasebit;
- if (opcode == OP_UPTO)
- OP1(SLJIT_MOV, tmp_base, tmp_offset, SLJIT_IMM, max);
+ BACKTRACK_AS(char_iterator_backtrack)->u.charpos.enabled = TRUE;
+ BACKTRACK_AS(char_iterator_backtrack)->u.charpos.chr = charpos_char;
+ BACKTRACK_AS(char_iterator_backtrack)->u.charpos.othercasebit = charpos_othercasebit;
+ }
+ }
- label = LABEL();
- compile_char1_matchingpath(common, type, cc, &no_match, TRUE);
- OP1(SLJIT_MOV, base, offset0, STR_PTR, 0);
+ if (charpos_enabled)
+ {
+ if (opcode == OP_UPTO)
+ OP1(SLJIT_MOV, tmp_base, tmp_offset, SLJIT_IMM, max + 1);
- if (opcode == OP_UPTO)
- {
- OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
- JUMPTO(SLJIT_NOT_ZERO, label);
- }
- else
- JUMPTO(SLJIT_JUMP, label);
+ /* Search the first instance of charpos_char. */
+ jump = JUMP(SLJIT_JUMP);
+ label = LABEL();
+ if (opcode == OP_UPTO)
+ {
+ OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
+ add_jump(compiler, &backtrack->topbacktracks, JUMP(SLJIT_ZERO));
+ }
+ compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks, FALSE);
+ if (fast_str_ptr != 0)
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), fast_str_ptr, STR_PTR, 0);
+ JUMPHERE(jump);
- set_jumps(no_match, LABEL());
- OP1(SLJIT_MOV, STR_PTR, 0, base, offset0);
- if (fast_str_ptr != 0)
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), fast_str_ptr, STR_PTR, 0);
+ detect_partial_match(common, &backtrack->topbacktracks);
+ OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));
+ if (charpos_othercasebit != 0)
+ OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, charpos_othercasebit);
+ CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, charpos_char, label);
+
+ if (private_data_ptr == 0)
+ allocate_stack(common, 2);
+ OP1(SLJIT_MOV, base, offset0, STR_PTR, 0);
+ OP1(SLJIT_MOV, base, offset1, STR_PTR, 0);
+ if (opcode == OP_UPTO)
+ {
+ OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
+ add_jump(compiler, &no_match, JUMP(SLJIT_ZERO));
+ }
+
+ /* Search the last instance of charpos_char. */
+ label = LABEL();
+ compile_char1_matchingpath(common, type, cc, &no_match, FALSE);
+ if (fast_str_ptr != 0)
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), fast_str_ptr, STR_PTR, 0);
+ detect_partial_match(common, &no_match);
+ OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));
+ if (charpos_othercasebit != 0)
+ OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, charpos_othercasebit);
+ if (opcode == OP_STAR)
+ {
+ CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, charpos_char, label);
+ OP1(SLJIT_MOV, base, offset0, STR_PTR, 0);
}
-#endif
else
{
- if (private_data_ptr == 0)
- allocate_stack(common, 2);
+ jump = CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, charpos_char);
+ OP1(SLJIT_MOV, base, offset0, STR_PTR, 0);
+ JUMPHERE(jump);
+ }
- OP1(SLJIT_MOV, base, offset1, STR_PTR, 0);
- if (opcode == OP_UPTO)
- OP1(SLJIT_MOV, tmp_base, tmp_offset, SLJIT_IMM, max);
+ if (opcode == OP_UPTO)
+ {
+ OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
+ JUMPTO(SLJIT_NOT_ZERO, label);
+ }
+ else
+ JUMPTO(SLJIT_JUMP, label);
- label = LABEL();
- detect_partial_match(common, &no_match);
- compile_char1_matchingpath(common, type, cc, &no_char1_match, FALSE);
- if (opcode == OP_UPTO)
- {
- OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
- JUMPTO(SLJIT_NOT_ZERO, label);
- OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
- }
- else
- JUMPTO(SLJIT_JUMP, label);
+ set_jumps(no_match, LABEL());
+ OP1(SLJIT_MOV, STR_PTR, 0, base, offset0);
+ OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
+ OP1(SLJIT_MOV, base, offset0, STR_PTR, 0);
+ }
+#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
+ else if (common->utf)
+ {
+ if (private_data_ptr == 0)
+ allocate_stack(common, 2);
- set_jumps(no_char1_match, LABEL());
- OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
- set_jumps(no_match, LABEL());
- OP1(SLJIT_MOV, base, offset0, STR_PTR, 0);
- if (fast_str_ptr != 0)
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), fast_str_ptr, STR_PTR, 0);
+ OP1(SLJIT_MOV, base, offset0, STR_PTR, 0);
+ OP1(SLJIT_MOV, base, offset1, STR_PTR, 0);
+
+ if (opcode == OP_UPTO)
+ OP1(SLJIT_MOV, tmp_base, tmp_offset, SLJIT_IMM, max);
+
+ detect_partial_match(common, &no_match);
+ label = LABEL();
+ compile_char1_matchingpath(common, type, cc, &no_match, FALSE);
+ OP1(SLJIT_MOV, base, offset0, STR_PTR, 0);
+
+ if (opcode == OP_UPTO)
+ {
+ OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
+ add_jump(compiler, &no_match, JUMP(SLJIT_ZERO));
+ }
+
+ detect_partial_match_to(common, label);
+ OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
+
+ set_jumps(no_match, LABEL());
+ OP1(SLJIT_MOV, STR_PTR, 0, base, offset0);
+ if (fast_str_ptr != 0)
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), fast_str_ptr, STR_PTR, 0);
+ }
+#endif
+ else
+ {
+ if (private_data_ptr == 0)
+ allocate_stack(common, 2);
+
+ OP1(SLJIT_MOV, base, offset1, STR_PTR, 0);
+ if (opcode == OP_UPTO)
+ OP1(SLJIT_MOV, tmp_base, tmp_offset, SLJIT_IMM, max);
+
+ detect_partial_match(common, &no_match);
+ label = LABEL();
+ compile_char1_matchingpath(common, type, cc, &no_char1_match, FALSE);
+ if (opcode == OP_UPTO)
+ {
+ OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
+ add_jump(compiler, &no_match, JUMP(SLJIT_ZERO));
}
+
+ detect_partial_match_to(common, label);
+ OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
+
+ set_jumps(no_char1_match, LABEL());
+ OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
+ set_jumps(no_match, LABEL());
+ OP1(SLJIT_MOV, base, offset0, STR_PTR, 0);
+ if (fast_str_ptr != 0)
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), fast_str_ptr, STR_PTR, 0);
}
+
BACKTRACK_AS(char_iterator_backtrack)->matchingpath = LABEL();
break;
@@ -11616,25 +11213,47 @@ switch(opcode)
break;
case OP_POSSTAR:
+#if defined SUPPORT_UNICODE
+ if (type == OP_ALLANY && !common->invalid_utf)
+#else
+ if (type == OP_ALLANY)
+#endif
+ {
+ OP1(SLJIT_MOV, STR_PTR, 0, STR_END, 0);
+ process_partial_match(common);
+ if (fast_str_ptr != 0)
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), fast_str_ptr, STR_END, 0);
+ break;
+ }
+
#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
if (common->utf)
{
OP1(SLJIT_MOV, tmp_base, tmp_offset, STR_PTR, 0);
+ detect_partial_match(common, &no_match);
label = LABEL();
- compile_char1_matchingpath(common, type, cc, &no_match, TRUE);
+ compile_char1_matchingpath(common, type, cc, &no_match, FALSE);
OP1(SLJIT_MOV, tmp_base, tmp_offset, STR_PTR, 0);
- JUMPTO(SLJIT_JUMP, label);
+ detect_partial_match_to(common, label);
+
set_jumps(no_match, LABEL());
OP1(SLJIT_MOV, STR_PTR, 0, tmp_base, tmp_offset);
if (fast_str_ptr != 0)
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), fast_str_ptr, STR_PTR, 0);
+ {
+ if (tmp_base == TMP3)
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), fast_str_ptr, TMP3, 0);
+ else
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), fast_str_ptr, STR_PTR, 0);
+ }
break;
}
#endif
- label = LABEL();
detect_partial_match(common, &no_match);
+ label = LABEL();
compile_char1_matchingpath(common, type, cc, &no_char1_match, FALSE);
- JUMPTO(SLJIT_JUMP, label);
+ detect_partial_match_to(common, label);
+ OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
+
set_jumps(no_char1_match, LABEL());
OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
set_jumps(no_match, LABEL());
@@ -11649,23 +11268,52 @@ switch(opcode)
{
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), POSSESSIVE1, STR_PTR, 0);
OP1(SLJIT_MOV, tmp_base, tmp_offset, SLJIT_IMM, max);
+
+ detect_partial_match(common, &no_match);
label = LABEL();
- compile_char1_matchingpath(common, type, cc, &no_match, TRUE);
+ compile_char1_matchingpath(common, type, cc, &no_match, FALSE);
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), POSSESSIVE1, STR_PTR, 0);
OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
- JUMPTO(SLJIT_NOT_ZERO, label);
+ add_jump(compiler, &no_match, JUMP(SLJIT_ZERO));
+ detect_partial_match_to(common, label);
+
set_jumps(no_match, LABEL());
OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), POSSESSIVE1);
break;
}
#endif
+
+ if (type == OP_ALLANY)
+ {
+ OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(max));
+
+ if (common->mode == PCRE2_JIT_COMPLETE)
+ {
+ OP2(SLJIT_SUB | SLJIT_SET_GREATER, SLJIT_UNUSED, 0, STR_PTR, 0, STR_END, 0);
+ CMOV(SLJIT_GREATER, STR_PTR, STR_END, 0);
+ }
+ else
+ {
+ jump = CMP(SLJIT_LESS_EQUAL, STR_PTR, 0, STR_END, 0);
+ process_partial_match(common);
+ JUMPHERE(jump);
+ }
+
+ if (fast_str_ptr != 0)
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), fast_str_ptr, STR_PTR, 0);
+ break;
+ }
+
OP1(SLJIT_MOV, tmp_base, tmp_offset, SLJIT_IMM, max);
- label = LABEL();
+
detect_partial_match(common, &no_match);
+ label = LABEL();
compile_char1_matchingpath(common, type, cc, &no_char1_match, FALSE);
OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
- JUMPTO(SLJIT_NOT_ZERO, label);
+ add_jump(compiler, &no_match, JUMP(SLJIT_ZERO));
+ detect_partial_match_to(common, label);
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
+
set_jumps(no_char1_match, LABEL());
OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
set_jumps(no_match, LABEL());
@@ -11719,8 +11367,15 @@ if (common->accept_label == NULL)
add_jump(compiler, &common->accept, CMP(SLJIT_NOT_EQUAL, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(0)));
else
CMPTO(SLJIT_NOT_EQUAL, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(0), common->accept_label);
-OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
-OP1(SLJIT_MOV_U32, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, options));
+
+if (HAS_VIRTUAL_REGISTERS)
+ {
+ OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
+ OP1(SLJIT_MOV_U32, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, options));
+ }
+else
+ OP1(SLJIT_MOV_U32, TMP2, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, options));
+
OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, PCRE2_NOTEMPTY);
add_jump(compiler, &backtrack->topbacktracks, JUMP(SLJIT_NOT_ZERO));
OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, PCRE2_NOTEMPTY_ATSTART);
@@ -11728,7 +11383,8 @@ if (common->accept_label == NULL)
add_jump(compiler, &common->accept, JUMP(SLJIT_ZERO));
else
JUMPTO(SLJIT_ZERO, common->accept_label);
-OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, str));
+
+OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(HAS_VIRTUAL_REGISTERS ? TMP1 : ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, str));
if (common->accept_label == NULL)
add_jump(compiler, &common->accept, CMP(SLJIT_NOT_EQUAL, TMP2, 0, STR_PTR, 0));
else
@@ -11778,10 +11434,11 @@ if (opcode == OP_SKIP)
if (opcode == OP_COMMIT_ARG || opcode == OP_PRUNE_ARG || opcode == OP_THEN_ARG)
{
- OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
+ if (HAS_VIRTUAL_REGISTERS)
+ OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, (sljit_sw)(cc + 2));
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->mark_ptr, TMP2, 0);
- OP1(SLJIT_MOV, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, mark_ptr), TMP2, 0);
+ OP1(SLJIT_MOV, SLJIT_MEM1(HAS_VIRTUAL_REGISTERS ? TMP1 : ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, mark_ptr), TMP2, 0);
}
return ccend;
@@ -12072,11 +11729,12 @@ while (cc < ccend)
SLJIT_ASSERT(common->mark_ptr != 0);
OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->mark_ptr);
allocate_stack(common, common->has_skip_arg ? 5 : 1);
- OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
+ if (HAS_VIRTUAL_REGISTERS)
+ OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(common->has_skip_arg ? 4 : 0), TMP2, 0);
OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, (sljit_sw)(cc + 2));
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->mark_ptr, TMP2, 0);
- OP1(SLJIT_MOV, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, mark_ptr), TMP2, 0);
+ OP1(SLJIT_MOV, SLJIT_MEM1(HAS_VIRTUAL_REGISTERS ? TMP1 : ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, mark_ptr), TMP2, 0);
if (common->has_skip_arg)
{
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr);
@@ -12403,16 +12061,15 @@ PCRE2_SPTR ccprev;
PCRE2_UCHAR bra = OP_BRA;
PCRE2_UCHAR ket;
assert_backtrack *assert;
-sljit_uw *next_update_addr = NULL;
BOOL has_alternatives;
BOOL needs_control_head = FALSE;
struct sljit_jump *brazero = NULL;
-struct sljit_jump *alt1 = NULL;
-struct sljit_jump *alt2 = NULL;
+struct sljit_jump *next_alt = NULL;
struct sljit_jump *once = NULL;
struct sljit_jump *cond = NULL;
struct sljit_label *rmin_label = NULL;
struct sljit_label *exact_label = NULL;
+struct sljit_put_label *put_label = NULL;
if (*cc == OP_BRAZERO || *cc == OP_BRAMINZERO)
{
@@ -12561,7 +12218,7 @@ else if (SLJIT_UNLIKELY(opcode == OP_COND) || SLJIT_UNLIKELY(opcode == OP_SCOND)
free_stack(common, 1);
alt_max = 2;
- alt1 = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, sizeof(sljit_uw));
+ next_alt = CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, 0);
}
}
else if (has_alternatives)
@@ -12569,21 +12226,15 @@ else if (has_alternatives)
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
free_stack(common, 1);
- if (alt_max > 4)
+ if (alt_max > 3)
{
- /* Table jump if alt_max is greater than 4. */
- next_update_addr = allocate_read_only_data(common, alt_max * sizeof(sljit_uw));
- if (SLJIT_UNLIKELY(next_update_addr == NULL))
- return;
- sljit_emit_ijump(compiler, SLJIT_JUMP, SLJIT_MEM1(TMP1), (sljit_sw)next_update_addr);
- add_label_addr(common, next_update_addr++);
+ sljit_emit_ijump(compiler, SLJIT_JUMP, TMP1, 0);
+
+ SLJIT_ASSERT(CURRENT_AS(bracket_backtrack)->u.matching_put_label);
+ sljit_set_put_label(CURRENT_AS(bracket_backtrack)->u.matching_put_label, LABEL());
}
else
- {
- if (alt_max == 4)
- alt2 = CMP(SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, 2 * sizeof(sljit_uw));
- alt1 = CMP(SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, sizeof(sljit_uw));
- }
+ next_alt = CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, 0);
}
COMPILE_BACKTRACKINGPATH(current->top);
@@ -12620,7 +12271,7 @@ if (SLJIT_UNLIKELY(opcode == OP_COND) || SLJIT_UNLIKELY(opcode == OP_SCOND))
if (has_alternatives)
{
- alt_count = sizeof(sljit_uw);
+ alt_count = 1;
do
{
current->top = NULL;
@@ -12699,7 +12350,12 @@ if (has_alternatives)
stacksize = match_capture_common(common, stacksize, offset, private_data_ptr);
if (opcode != OP_ONCE)
- OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(stacksize), SLJIT_IMM, alt_count);
+ {
+ if (alt_max <= 3)
+ OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(stacksize), SLJIT_IMM, alt_count);
+ else
+ put_label = sljit_emit_put_label(compiler, SLJIT_MEM1(STACK_TOP), STACK(stacksize));
+ }
if (offset != 0 && ket == OP_KETRMAX && common->optimized_cbracket[offset >> 1] != 0)
{
@@ -12712,24 +12368,18 @@ if (has_alternatives)
if (opcode != OP_ONCE)
{
- if (alt_max > 4)
- add_label_addr(common, next_update_addr++);
- else
+ if (alt_max <= 3)
{
- if (alt_count != 2 * sizeof(sljit_uw))
- {
- JUMPHERE(alt1);
- if (alt_max == 3 && alt_count == sizeof(sljit_uw))
- alt2 = CMP(SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, 2 * sizeof(sljit_uw));
- }
- else
+ JUMPHERE(next_alt);
+ alt_count++;
+ if (alt_count < alt_max)
{
- JUMPHERE(alt2);
- if (alt_max == 4)
- alt1 = CMP(SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, 3 * sizeof(sljit_uw));
+ SLJIT_ASSERT(alt_count == 2 && alt_max == 3);
+ next_alt = CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, 1);
}
}
- alt_count += sizeof(sljit_uw);
+ else
+ sljit_set_put_label(put_label, LABEL());
}
COMPILE_BACKTRACKINGPATH(current->top);
@@ -13219,11 +12869,10 @@ int private_data_size = get_recurse_data_length(common, ccbegin, ccend, &needs_c
int alt_count, alt_max, local_size;
backtrack_common altbacktrack;
jump_list *match = NULL;
-sljit_uw *next_update_addr = NULL;
-struct sljit_jump *alt1 = NULL;
-struct sljit_jump *alt2 = NULL;
+struct sljit_jump *next_alt = NULL;
struct sljit_jump *accept_exit = NULL;
struct sljit_label *quit;
+struct sljit_put_label *put_label;
/* Recurse captures then. */
common->then_trap = NULL;
@@ -13284,7 +12933,12 @@ while (1)
OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->recursive_head_ptr);
if (alt_max > 1 || has_accept)
- OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, alt_count);
+ {
+ if (alt_max > 3)
+ put_label = sljit_emit_put_label(compiler, SLJIT_MEM1(STACK_TOP), STACK(1));
+ else
+ OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, alt_count);
+ }
add_jump(compiler, &match, JUMP(SLJIT_JUMP));
@@ -13298,7 +12952,7 @@ while (1)
sljit_emit_fast_enter(compiler, TMP1, 0);
if (has_accept)
- accept_exit = CMP(SLJIT_EQUAL, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, alt_max * sizeof (sljit_sw));
+ accept_exit = CMP(SLJIT_EQUAL, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, -1);
OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
/* Save return address. */
@@ -13311,44 +12965,30 @@ while (1)
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(1));
free_stack(common, 2);
- if (alt_max > 4)
+ if (alt_max > 3)
{
- /* Table jump if alt_max is greater than 4. */
- next_update_addr = allocate_read_only_data(common, alt_max * sizeof(sljit_uw));
- if (SLJIT_UNLIKELY(next_update_addr == NULL))
- return;
- sljit_emit_ijump(compiler, SLJIT_JUMP, SLJIT_MEM1(TMP1), (sljit_sw)next_update_addr);
- add_label_addr(common, next_update_addr++);
+ sljit_emit_ijump(compiler, SLJIT_JUMP, TMP1, 0);
+ sljit_set_put_label(put_label, LABEL());
}
else
- {
- if (alt_max == 4)
- alt2 = CMP(SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, 2 * sizeof(sljit_uw));
- alt1 = CMP(SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, sizeof(sljit_uw));
- }
+ next_alt = CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, 0);
}
else
free_stack(common, has_accept ? 2 : 1);
}
- else if (alt_max > 4)
- add_label_addr(common, next_update_addr++);
+ else if (alt_max > 3)
+ sljit_set_put_label(put_label, LABEL());
else
{
- if (alt_count != 2 * sizeof(sljit_uw))
- {
- JUMPHERE(alt1);
- if (alt_max == 3 && alt_count == sizeof(sljit_uw))
- alt2 = CMP(SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, 2 * sizeof(sljit_uw));
- }
- else
+ JUMPHERE(next_alt);
+ if (alt_count + 1 < alt_max)
{
- JUMPHERE(alt2);
- if (alt_max == 4)
- alt1 = CMP(SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, 3 * sizeof(sljit_uw));
+ SLJIT_ASSERT(alt_count == 1 && alt_max == 3);
+ next_alt = CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, 1);
}
}
- alt_count += sizeof(sljit_uw);
+ alt_count++;
compile_backtrackingpath(common, altbacktrack.top);
if (SLJIT_UNLIKELY(sljit_get_compiler_error(compiler)))
@@ -13409,7 +13049,7 @@ if (common->accept != NULL)
OP1(SLJIT_MOV, TMP2, 0, STACK_TOP, 0);
allocate_stack(common, 2);
- OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, alt_count);
+ OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, -1);
}
set_jumps(match, LABEL());
@@ -13444,7 +13084,6 @@ executable_functions *functions;
void *executable_func;
sljit_uw executable_size;
sljit_uw total_length;
-label_addr_list *label_addr;
struct sljit_label *mainloop_label = NULL;
struct sljit_label *continue_match_label;
struct sljit_label *empty_match_found_label = NULL;
@@ -13459,6 +13098,14 @@ struct sljit_jump *end_anchor_failed = NULL;
SLJIT_ASSERT(tables);
+#if HAS_VIRTUAL_REGISTERS == 1
+SLJIT_ASSERT(sljit_get_register_index(TMP3) < 0 && sljit_get_register_index(ARGUMENTS) < 0 && sljit_get_register_index(RETURN_ADDR) < 0);
+#elif HAS_VIRTUAL_REGISTERS == 0
+SLJIT_ASSERT(sljit_get_register_index(TMP3) >= 0 && sljit_get_register_index(ARGUMENTS) >= 0 && sljit_get_register_index(RETURN_ADDR) >= 0);
+#else
+#error "Invalid value for HAS_VIRTUAL_REGISTERS"
+#endif
+
memset(&rootbacktrack, 0, sizeof(backtrack_common));
memset(common, 0, sizeof(compiler_common));
common->re = re;
@@ -13476,6 +13123,7 @@ common->fcc = tables + fcc_offset;
common->lcc = (sljit_sw)(tables + lcc_offset);
common->mode = mode;
common->might_be_empty = re->minlength == 0;
+common->allow_empty_partial = (re->max_lookbehind > 0) || (re->flags & PCRE2_MATCH_EMPTY) != 0;
common->nltype = NLTYPE_FIXED;
switch(re->newline_convention)
{
@@ -14028,13 +13676,8 @@ SLJIT_FREE(common->private_data_ptrs, allocator_data);
executable_func = sljit_generate_code(compiler);
executable_size = sljit_get_generated_code_size(compiler);
-label_addr = common->label_addrs;
-while (label_addr != NULL)
- {
- *label_addr->update_addr = sljit_get_label_addr(label_addr->label);
- label_addr = label_addr->next;
- }
sljit_free_compiler(compiler);
+
if (executable_func == NULL)
{
PRIV(jit_free_rodata)(common->read_only_data_head, allocator_data);
@@ -14097,18 +13740,12 @@ Returns: 0: success or (*NOJIT) was used
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
pcre2_jit_compile(pcre2_code *code, uint32_t options)
{
-#ifndef SUPPORT_JIT
-
-(void)code;
-(void)options;
-return PCRE2_ERROR_JIT_BADOPTION;
-
-#else /* SUPPORT_JIT */
-
pcre2_real_code *re = (pcre2_real_code *)code;
-executable_functions *functions;
-uint32_t excluded_options;
-int result;
+
+#ifdef SUPPORT_JIT
+executable_functions *functions = (executable_functions *)re->executable_jit;
+static int executable_allocator_is_working = 0;
+#endif
if (code == NULL)
return PCRE2_ERROR_NULL;
@@ -14116,30 +13753,98 @@ if (code == NULL)
if ((options & ~PUBLIC_JIT_COMPILE_OPTIONS) != 0)
return PCRE2_ERROR_JIT_BADOPTION;
+/* Support for invalid UTF was first introduced in JIT, with the option
+PCRE2_JIT_INVALID_UTF. Later, support was added to the interpreter, and the
+compile-time option PCRE2_MATCH_INVALID_UTF was created. This is now the
+preferred feature, with the earlier option deprecated. However, for backward
+compatibility, if the earlier option is set, it forces the new option so that
+if JIT matching falls back to the interpreter, there is still support for
+invalid UTF. However, if this function has already been successfully called
+without PCRE2_JIT_INVALID_UTF and without PCRE2_MATCH_INVALID_UTF (meaning that
+non-invalid-supporting JIT code was compiled), give an error.
+
+If in the future support for PCRE2_JIT_INVALID_UTF is withdrawn, the following
+actions are needed:
+
+ 1. Remove the definition from pcre2.h.in and from the list in
+ PUBLIC_JIT_COMPILE_OPTIONS above.
+
+ 2. Replace PCRE2_JIT_INVALID_UTF with a local flag in this module.
+
+ 3. Replace PCRE2_JIT_INVALID_UTF in pcre2_jit_test.c.
+
+ 4. Delete the following short block of code. The setting of "re" and
+ "functions" can be moved into the JIT-only block below, but if that is
+ done, (void)re and (void)functions will be needed in the non-JIT case, to
+ avoid compiler warnings.
+*/
+
+if ((options & PCRE2_JIT_INVALID_UTF) != 0)
+ {
+ if ((re->overall_options & PCRE2_MATCH_INVALID_UTF) == 0)
+ {
+#ifdef SUPPORT_JIT
+ if (functions != NULL) return PCRE2_ERROR_JIT_BADOPTION;
+#endif
+ re->overall_options |= PCRE2_MATCH_INVALID_UTF;
+ }
+ }
+
+/* The above tests are run with and without JIT support. This means that
+PCRE2_JIT_INVALID_UTF propagates back into the regex options (ensuring
+interpreter support) even in the absence of JIT. But now, if there is no JIT
+support, give an error return. */
+
+#ifndef SUPPORT_JIT
+return PCRE2_ERROR_JIT_BADOPTION;
+#else /* SUPPORT_JIT */
+
+/* There is JIT support. Do the necessary. */
+
if ((re->flags & PCRE2_NOJIT) != 0) return 0;
-functions = (executable_functions *)re->executable_jit;
+if (executable_allocator_is_working == 0)
+ {
+ /* Checks whether the executable allocator is working. This check
+ might run multiple times in multi-threaded environments, but the
+ result should not be affected by it. */
+ void *ptr = SLJIT_MALLOC_EXEC(32);
+
+ executable_allocator_is_working = -1;
+
+ if (ptr != NULL)
+ {
+ SLJIT_FREE_EXEC(((sljit_u8*)(ptr)) + SLJIT_EXEC_OFFSET(ptr));
+ executable_allocator_is_working = 1;
+ }
+ }
+
+if (executable_allocator_is_working < 0)
+ return PCRE2_ERROR_NOMEMORY;
+
+if ((re->overall_options & PCRE2_MATCH_INVALID_UTF) != 0)
+ options |= PCRE2_JIT_INVALID_UTF;
if ((options & PCRE2_JIT_COMPLETE) != 0 && (functions == NULL
|| functions->executable_funcs[0] == NULL)) {
- excluded_options = (PCRE2_JIT_PARTIAL_SOFT | PCRE2_JIT_PARTIAL_HARD);
- result = jit_compile(code, options & ~excluded_options);
+ uint32_t excluded_options = (PCRE2_JIT_PARTIAL_SOFT | PCRE2_JIT_PARTIAL_HARD);
+ int result = jit_compile(code, options & ~excluded_options);
if (result != 0)
return result;
}
if ((options & PCRE2_JIT_PARTIAL_SOFT) != 0 && (functions == NULL
|| functions->executable_funcs[1] == NULL)) {
- excluded_options = (PCRE2_JIT_COMPLETE | PCRE2_JIT_PARTIAL_HARD);
- result = jit_compile(code, options & ~excluded_options);
+ uint32_t excluded_options = (PCRE2_JIT_COMPLETE | PCRE2_JIT_PARTIAL_HARD);
+ int result = jit_compile(code, options & ~excluded_options);
if (result != 0)
return result;
}
if ((options & PCRE2_JIT_PARTIAL_HARD) != 0 && (functions == NULL
|| functions->executable_funcs[2] == NULL)) {
- excluded_options = (PCRE2_JIT_COMPLETE | PCRE2_JIT_PARTIAL_SOFT);
- result = jit_compile(code, options & ~excluded_options);
+ uint32_t excluded_options = (PCRE2_JIT_COMPLETE | PCRE2_JIT_PARTIAL_SOFT);
+ int result = jit_compile(code, options & ~excluded_options);
if (result != 0)
return result;
}
diff --git a/ext/pcre/pcre2lib/pcre2_jit_match.c b/ext/pcre/pcre2lib/pcre2_jit_match.c
index eee038644d..7e13b8cfee 100644
--- a/ext/pcre/pcre2lib/pcre2_jit_match.c
+++ b/ext/pcre/pcre2lib/pcre2_jit_match.c
@@ -74,7 +74,6 @@ Arguments:
options option bits
match_data points to a match_data block
mcontext points to a match context
- jit_stack points to a JIT stack
Returns: > 0 => success; value is the number of ovector pairs filled
= 0 => success, but ovector is not big enough
diff --git a/ext/pcre/pcre2lib/pcre2_jit_neon_inc.h b/ext/pcre/pcre2lib/pcre2_jit_neon_inc.h
new file mode 100644
index 0000000000..0265f36a0b
--- /dev/null
+++ b/ext/pcre/pcre2lib/pcre2_jit_neon_inc.h
@@ -0,0 +1,343 @@
+/*************************************************
+* Perl-Compatible Regular Expressions *
+*************************************************/
+
+/* PCRE is a library of functions to support regular expressions whose syntax
+and semantics are as close as possible to those of the Perl 5 language.
+
+ Written by Philip Hazel
+ This module by Zoltan Herczeg and Sebastian Pop
+ Original API code Copyright (c) 1997-2012 University of Cambridge
+ New API code Copyright (c) 2016-2019 University of Cambridge
+
+-----------------------------------------------------------------------------
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of the University of Cambridge nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+-----------------------------------------------------------------------------
+*/
+
+# if defined(FFCS)
+# if defined(FF_UTF)
+# define FF_FUN ffcs_utf
+# else
+# define FF_FUN ffcs
+# endif
+
+# elif defined(FFCS_2)
+# if defined(FF_UTF)
+# define FF_FUN ffcs_2_utf
+# else
+# define FF_FUN ffcs_2
+# endif
+
+# elif defined(FFCS_MASK)
+# if defined(FF_UTF)
+# define FF_FUN ffcs_mask_utf
+# else
+# define FF_FUN ffcs_mask
+# endif
+
+# elif defined(FFCPS_0)
+# if defined (FF_UTF)
+# define FF_FUN ffcps_0_utf
+# else
+# define FF_FUN ffcps_0
+# endif
+
+# elif defined (FFCPS_1)
+# if defined (FF_UTF)
+# define FF_FUN ffcps_1_utf
+# else
+# define FF_FUN ffcps_1
+# endif
+
+# elif defined (FFCPS_DEFAULT)
+# if defined (FF_UTF)
+# define FF_FUN ffcps_default_utf
+# else
+# define FF_FUN ffcps_default
+# endif
+# endif
+
+static sljit_u8* SLJIT_FUNC FF_FUN(sljit_u8 *str_end, sljit_u8 *str_ptr, sljit_uw offs1, sljit_uw offs2, sljit_uw chars)
+#undef FF_FUN
+{
+quad_word qw;
+int_char ic;
+ic.x = chars;
+
+#if defined(FFCS)
+sljit_u8 c1 = ic.c.c1;
+vect_t vc1 = VDUPQ(c1);
+
+#elif defined(FFCS_2)
+sljit_u8 c1 = ic.c.c1;
+vect_t vc1 = VDUPQ(c1);
+sljit_u8 c2 = ic.c.c2;
+vect_t vc2 = VDUPQ(c2);
+
+#elif defined(FFCS_MASK)
+sljit_u8 c1 = ic.c.c1;
+vect_t vc1 = VDUPQ(c1);
+sljit_u8 mask = ic.c.c2;
+vect_t vmask = VDUPQ(mask);
+#endif
+
+#if defined(FFCPS)
+compare_type compare1_type = compare_match1;
+compare_type compare2_type = compare_match1;
+vect_t cmp1a, cmp1b, cmp2a, cmp2b;
+const sljit_u32 diff = IN_UCHARS(offs1 - offs2);
+PCRE2_UCHAR char1a = ic.c.c1;
+PCRE2_UCHAR char2a = ic.c.c3;
+
+# ifdef FFCPS_CHAR1A2A
+cmp1a = VDUPQ(char1a);
+cmp2a = VDUPQ(char2a);
+cmp1b = VDUPQ(0); /* to avoid errors on older compilers -Werror=maybe-uninitialized */
+cmp2b = VDUPQ(0); /* to avoid errors on older compilers -Werror=maybe-uninitialized */
+# else
+PCRE2_UCHAR char1b = ic.c.c2;
+PCRE2_UCHAR char2b = ic.c.c4;
+if (char1a == char1b)
+ {
+ cmp1a = VDUPQ(char1a);
+ cmp1b = VDUPQ(0); /* to avoid errors on older compilers -Werror=maybe-uninitialized */
+ }
+else
+ {
+ sljit_u32 bit1 = char1a ^ char1b;
+ if (is_powerof2(bit1))
+ {
+ compare1_type = compare_match1i;
+ cmp1a = VDUPQ(char1a | bit1);
+ cmp1b = VDUPQ(bit1);
+ }
+ else
+ {
+ compare1_type = compare_match2;
+ cmp1a = VDUPQ(char1a);
+ cmp1b = VDUPQ(char1b);
+ }
+ }
+
+if (char2a == char2b)
+ {
+ cmp2a = VDUPQ(char2a);
+ cmp2b = VDUPQ(0); /* to avoid errors on older compilers -Werror=maybe-uninitialized */
+ }
+else
+ {
+ sljit_u32 bit2 = char2a ^ char2b;
+ if (is_powerof2(bit2))
+ {
+ compare2_type = compare_match1i;
+ cmp2a = VDUPQ(char2a | bit2);
+ cmp2b = VDUPQ(bit2);
+ }
+ else
+ {
+ compare2_type = compare_match2;
+ cmp2a = VDUPQ(char2a);
+ cmp2b = VDUPQ(char2b);
+ }
+ }
+# endif
+
+str_ptr += IN_UCHARS(offs1);
+#endif
+
+#if PCRE2_CODE_UNIT_WIDTH != 8
+vect_t char_mask = VDUPQ(0xff);
+#endif
+
+#if defined(FF_UTF)
+restart:;
+#endif
+
+#if defined(FFCPS)
+sljit_u8 *p1 = str_ptr - diff;
+#endif
+sljit_s32 align_offset = ((uint64_t)str_ptr & 0xf);
+str_ptr = (sljit_u8 *) ((uint64_t)str_ptr & ~0xf);
+vect_t data = VLD1Q(str_ptr);
+#if PCRE2_CODE_UNIT_WIDTH != 8
+data = VANDQ(data, char_mask);
+#endif
+
+#if defined(FFCS)
+vect_t eq = VCEQQ(data, vc1);
+
+#elif defined(FFCS_2)
+vect_t eq1 = VCEQQ(data, vc1);
+vect_t eq2 = VCEQQ(data, vc2);
+vect_t eq = VORRQ(eq1, eq2);
+
+#elif defined(FFCS_MASK)
+vect_t eq = VORRQ(data, vmask);
+eq = VCEQQ(eq, vc1);
+
+#elif defined(FFCPS)
+# if defined(FFCPS_DIFF1)
+vect_t prev_data = data;
+# endif
+
+vect_t data2;
+if (p1 < str_ptr)
+ {
+ data2 = VLD1Q(str_ptr - diff);
+#if PCRE2_CODE_UNIT_WIDTH != 8
+ data2 = VANDQ(data2, char_mask);
+#endif
+ }
+else
+ data2 = shift_left_n_lanes(data, offs1 - offs2);
+
+if (compare1_type == compare_match1)
+ data = VCEQQ(data, cmp1a);
+else
+ data = fast_forward_char_pair_compare(compare1_type, data, cmp1a, cmp1b);
+
+if (compare2_type == compare_match1)
+ data2 = VCEQQ(data2, cmp2a);
+else
+ data2 = fast_forward_char_pair_compare(compare2_type, data2, cmp2a, cmp2b);
+
+vect_t eq = VANDQ(data, data2);
+#endif
+
+VST1Q(qw.mem, eq);
+/* Ignore matches before the first STR_PTR. */
+if (align_offset < 8)
+ {
+ qw.dw[0] >>= align_offset * 8;
+ if (qw.dw[0])
+ {
+ str_ptr += align_offset + __builtin_ctzll(qw.dw[0]) / 8;
+ goto match;
+ }
+ if (qw.dw[1])
+ {
+ str_ptr += 8 + __builtin_ctzll(qw.dw[1]) / 8;
+ goto match;
+ }
+ }
+else
+ {
+ qw.dw[1] >>= (align_offset - 8) * 8;
+ if (qw.dw[1])
+ {
+ str_ptr += align_offset + __builtin_ctzll(qw.dw[1]) / 8;
+ goto match;
+ }
+ }
+str_ptr += 16;
+
+while (str_ptr < str_end)
+ {
+ vect_t orig_data = VLD1Q(str_ptr);
+#if PCRE2_CODE_UNIT_WIDTH != 8
+ orig_data = VANDQ(orig_data, char_mask);
+#endif
+ data = orig_data;
+
+#if defined(FFCS)
+ eq = VCEQQ(data, vc1);
+
+#elif defined(FFCS_2)
+ eq1 = VCEQQ(data, vc1);
+ eq2 = VCEQQ(data, vc2);
+ eq = VORRQ(eq1, eq2);
+
+#elif defined(FFCS_MASK)
+ eq = VORRQ(data, vmask);
+ eq = VCEQQ(eq, vc1);
+#endif
+
+#if defined(FFCPS)
+# if defined (FFCPS_DIFF1)
+ data2 = VEXTQ(prev_data, data, VECTOR_FACTOR - 1);
+# else
+ data2 = VLD1Q(str_ptr - diff);
+# if PCRE2_CODE_UNIT_WIDTH != 8
+ data2 = VANDQ(data2, char_mask);
+# endif
+# endif
+
+# ifdef FFCPS_CHAR1A2A
+ data = VCEQQ(data, cmp1a);
+ data2 = VCEQQ(data2, cmp2a);
+# else
+ if (compare1_type == compare_match1)
+ data = VCEQQ(data, cmp1a);
+ else
+ data = fast_forward_char_pair_compare(compare1_type, data, cmp1a, cmp1b);
+ if (compare2_type == compare_match1)
+ data2 = VCEQQ(data2, cmp2a);
+ else
+ data2 = fast_forward_char_pair_compare(compare2_type, data2, cmp2a, cmp2b);
+# endif
+
+ eq = VANDQ(data, data2);
+#endif
+
+ VST1Q(qw.mem, eq);
+ if (qw.dw[0])
+ str_ptr += __builtin_ctzll(qw.dw[0]) / 8;
+ else if (qw.dw[1])
+ str_ptr += 8 + __builtin_ctzll(qw.dw[1]) / 8;
+ else {
+ str_ptr += 16;
+#if defined (FFCPS_DIFF1)
+ prev_data = orig_data;
+#endif
+ continue;
+ }
+
+match:;
+ if (str_ptr >= str_end)
+ /* Failed match. */
+ return NULL;
+
+#if defined(FF_UTF)
+ if (utf_continue(str_ptr + IN_UCHARS(-offs1)))
+ {
+ /* Not a match. */
+ str_ptr += IN_UCHARS(1);
+ goto restart;
+ }
+#endif
+
+ /* Match. */
+#if defined (FFCPS)
+ str_ptr -= IN_UCHARS(offs1);
+#endif
+ return str_ptr;
+ }
+
+/* Failed match. */
+return NULL;
+}
diff --git a/ext/pcre/pcre2lib/pcre2_jit_simd_inc.h b/ext/pcre/pcre2lib/pcre2_jit_simd_inc.h
new file mode 100644
index 0000000000..f7d56b29f8
--- /dev/null
+++ b/ext/pcre/pcre2lib/pcre2_jit_simd_inc.h
@@ -0,0 +1,993 @@
+/*************************************************
+* Perl-Compatible Regular Expressions *
+*************************************************/
+
+/* PCRE is a library of functions to support regular expressions whose syntax
+and semantics are as close as possible to those of the Perl 5 language.
+
+ Written by Philip Hazel
+ This module by Zoltan Herczeg
+ Original API code Copyright (c) 1997-2012 University of Cambridge
+ New API code Copyright (c) 2016-2019 University of Cambridge
+
+-----------------------------------------------------------------------------
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of the University of Cambridge nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+-----------------------------------------------------------------------------
+*/
+
+#if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86) && !(defined SUPPORT_VALGRIND)
+
+#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
+static struct sljit_jump *jump_if_utf_char_start(struct sljit_compiler *compiler, sljit_s32 reg)
+{
+#if PCRE2_CODE_UNIT_WIDTH == 8
+OP2(SLJIT_AND, reg, 0, reg, 0, SLJIT_IMM, 0xc0);
+return CMP(SLJIT_NOT_EQUAL, reg, 0, SLJIT_IMM, 0x80);
+#elif PCRE2_CODE_UNIT_WIDTH == 16
+OP2(SLJIT_AND, reg, 0, reg, 0, SLJIT_IMM, 0xfc00);
+return CMP(SLJIT_NOT_EQUAL, reg, 0, SLJIT_IMM, 0xdc00);
+#else
+#error "Unknown code width"
+#endif
+}
+#endif
+
+static sljit_s32 character_to_int32(PCRE2_UCHAR chr)
+{
+sljit_u32 value = chr;
+#if PCRE2_CODE_UNIT_WIDTH == 8
+#define SSE2_COMPARE_TYPE_INDEX 0
+return (sljit_s32)((value << 24) | (value << 16) | (value << 8) | value);
+#elif PCRE2_CODE_UNIT_WIDTH == 16
+#define SSE2_COMPARE_TYPE_INDEX 1
+return (sljit_s32)((value << 16) | value);
+#elif PCRE2_CODE_UNIT_WIDTH == 32
+#define SSE2_COMPARE_TYPE_INDEX 2
+return (sljit_s32)(value);
+#else
+#error "Unsupported unit width"
+#endif
+}
+
+static void load_from_mem_sse2(struct sljit_compiler *compiler, sljit_s32 dst_xmm_reg, sljit_s32 src_general_reg, sljit_s8 offset)
+{
+sljit_u8 instruction[5];
+
+SLJIT_ASSERT(dst_xmm_reg < 8);
+SLJIT_ASSERT(src_general_reg < 8);
+
+/* MOVDQA xmm1, xmm2/m128 */
+instruction[0] = ((sljit_u8)offset & 0xf) == 0 ? 0x66 : 0xf3;
+instruction[1] = 0x0f;
+instruction[2] = 0x6f;
+
+if (offset == 0)
+ {
+ instruction[3] = (dst_xmm_reg << 3) | src_general_reg;
+ sljit_emit_op_custom(compiler, instruction, 4);
+ return;
+ }
+
+instruction[3] = 0x40 | (dst_xmm_reg << 3) | src_general_reg;
+instruction[4] = (sljit_u8)offset;
+sljit_emit_op_custom(compiler, instruction, 5);
+}
+
+typedef enum {
+ sse2_compare_match1,
+ sse2_compare_match1i,
+ sse2_compare_match2,
+} sse2_compare_type;
+
+static void fast_forward_char_pair_sse2_compare(struct sljit_compiler *compiler, sse2_compare_type compare_type,
+ int step, sljit_s32 dst_ind, sljit_s32 cmp1_ind, sljit_s32 cmp2_ind, sljit_s32 tmp_ind)
+{
+sljit_u8 instruction[4];
+instruction[0] = 0x66;
+instruction[1] = 0x0f;
+
+SLJIT_ASSERT(step >= 0 && step <= 3);
+
+if (compare_type != sse2_compare_match2)
+ {
+ if (step == 0)
+ {
+ if (compare_type == sse2_compare_match1i)
+ {
+ /* POR xmm1, xmm2/m128 */
+ /* instruction[0] = 0x66; */
+ /* instruction[1] = 0x0f; */
+ instruction[2] = 0xeb;
+ instruction[3] = 0xc0 | (dst_ind << 3) | cmp2_ind;
+ sljit_emit_op_custom(compiler, instruction, 4);
+ }
+ return;
+ }
+
+ if (step != 2)
+ return;
+
+ /* PCMPEQB/W/D xmm1, xmm2/m128 */
+ /* instruction[0] = 0x66; */
+ /* instruction[1] = 0x0f; */
+ instruction[2] = 0x74 + SSE2_COMPARE_TYPE_INDEX;
+ instruction[3] = 0xc0 | (dst_ind << 3) | cmp1_ind;
+ sljit_emit_op_custom(compiler, instruction, 4);
+ return;
+ }
+
+switch (step)
+ {
+ case 0:
+ /* MOVDQA xmm1, xmm2/m128 */
+ /* instruction[0] = 0x66; */
+ /* instruction[1] = 0x0f; */
+ instruction[2] = 0x6f;
+ instruction[3] = 0xc0 | (tmp_ind << 3) | dst_ind;
+ sljit_emit_op_custom(compiler, instruction, 4);
+ return;
+
+ case 1:
+ /* PCMPEQB/W/D xmm1, xmm2/m128 */
+ /* instruction[0] = 0x66; */
+ /* instruction[1] = 0x0f; */
+ instruction[2] = 0x74 + SSE2_COMPARE_TYPE_INDEX;
+ instruction[3] = 0xc0 | (dst_ind << 3) | cmp1_ind;
+ sljit_emit_op_custom(compiler, instruction, 4);
+ return;
+
+ case 2:
+ /* PCMPEQB/W/D xmm1, xmm2/m128 */
+ /* instruction[0] = 0x66; */
+ /* instruction[1] = 0x0f; */
+ instruction[2] = 0x74 + SSE2_COMPARE_TYPE_INDEX;
+ instruction[3] = 0xc0 | (tmp_ind << 3) | cmp2_ind;
+ sljit_emit_op_custom(compiler, instruction, 4);
+ return;
+
+ case 3:
+ /* POR xmm1, xmm2/m128 */
+ /* instruction[0] = 0x66; */
+ /* instruction[1] = 0x0f; */
+ instruction[2] = 0xeb;
+ instruction[3] = 0xc0 | (dst_ind << 3) | tmp_ind;
+ sljit_emit_op_custom(compiler, instruction, 4);
+ return;
+ }
+}
+
+#define JIT_HAS_FAST_FORWARD_CHAR_SIMD (sljit_has_cpu_feature(SLJIT_HAS_SSE2))
+
+static void fast_forward_char_simd(compiler_common *common, PCRE2_UCHAR char1, PCRE2_UCHAR char2, sljit_s32 offset)
+{
+DEFINE_COMPILER;
+struct sljit_label *start;
+#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
+struct sljit_label *restart;
+#endif
+struct sljit_jump *quit;
+struct sljit_jump *partial_quit[2];
+sse2_compare_type compare_type = sse2_compare_match1;
+sljit_u8 instruction[8];
+sljit_s32 tmp1_reg_ind = sljit_get_register_index(TMP1);
+sljit_s32 str_ptr_reg_ind = sljit_get_register_index(STR_PTR);
+sljit_s32 data_ind = 0;
+sljit_s32 tmp_ind = 1;
+sljit_s32 cmp1_ind = 2;
+sljit_s32 cmp2_ind = 3;
+sljit_u32 bit = 0;
+int i;
+
+SLJIT_UNUSED_ARG(offset);
+
+if (char1 != char2)
+ {
+ bit = char1 ^ char2;
+ compare_type = sse2_compare_match1i;
+
+ if (!is_powerof2(bit))
+ {
+ bit = 0;
+ compare_type = sse2_compare_match2;
+ }
+ }
+
+partial_quit[0] = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
+if (common->mode == PCRE2_JIT_COMPLETE)
+ add_jump(compiler, &common->failed_match, partial_quit[0]);
+
+/* First part (unaligned start) */
+
+OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, character_to_int32(char1 | bit));
+
+SLJIT_ASSERT(tmp1_reg_ind < 8);
+
+/* MOVD xmm, r/m32 */
+instruction[0] = 0x66;
+instruction[1] = 0x0f;
+instruction[2] = 0x6e;
+instruction[3] = 0xc0 | (cmp1_ind << 3) | tmp1_reg_ind;
+sljit_emit_op_custom(compiler, instruction, 4);
+
+if (char1 != char2)
+ {
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, character_to_int32(bit != 0 ? bit : char2));
+
+ /* MOVD xmm, r/m32 */
+ instruction[3] = 0xc0 | (cmp2_ind << 3) | tmp1_reg_ind;
+ sljit_emit_op_custom(compiler, instruction, 4);
+ }
+
+OP1(SLJIT_MOV, TMP2, 0, STR_PTR, 0);
+
+/* PSHUFD xmm1, xmm2/m128, imm8 */
+/* instruction[0] = 0x66; */
+/* instruction[1] = 0x0f; */
+instruction[2] = 0x70;
+instruction[3] = 0xc0 | (cmp1_ind << 3) | cmp1_ind;
+instruction[4] = 0;
+sljit_emit_op_custom(compiler, instruction, 5);
+
+if (char1 != char2)
+ {
+ /* PSHUFD xmm1, xmm2/m128, imm8 */
+ instruction[3] = 0xc0 | (cmp2_ind << 3) | cmp2_ind;
+ sljit_emit_op_custom(compiler, instruction, 5);
+ }
+
+#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
+restart = LABEL();
+#endif
+OP2(SLJIT_AND, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, ~0xf);
+OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0xf);
+
+load_from_mem_sse2(compiler, data_ind, str_ptr_reg_ind, 0);
+for (i = 0; i < 4; i++)
+ fast_forward_char_pair_sse2_compare(compiler, compare_type, i, data_ind, cmp1_ind, cmp2_ind, tmp_ind);
+
+/* PMOVMSKB reg, xmm */
+/* instruction[0] = 0x66; */
+/* instruction[1] = 0x0f; */
+instruction[2] = 0xd7;
+instruction[3] = 0xc0 | (tmp1_reg_ind << 3) | data_ind;
+sljit_emit_op_custom(compiler, instruction, 4);
+
+OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP2, 0);
+OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, TMP2, 0);
+
+quit = CMP(SLJIT_NOT_ZERO, TMP1, 0, SLJIT_IMM, 0);
+
+OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, TMP2, 0);
+
+/* Second part (aligned) */
+start = LABEL();
+
+OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, 16);
+
+partial_quit[1] = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
+if (common->mode == PCRE2_JIT_COMPLETE)
+ add_jump(compiler, &common->failed_match, partial_quit[1]);
+
+load_from_mem_sse2(compiler, data_ind, str_ptr_reg_ind, 0);
+for (i = 0; i < 4; i++)
+ fast_forward_char_pair_sse2_compare(compiler, compare_type, i, data_ind, cmp1_ind, cmp2_ind, tmp_ind);
+
+/* PMOVMSKB reg, xmm */
+/* instruction[0] = 0x66; */
+/* instruction[1] = 0x0f; */
+instruction[2] = 0xd7;
+instruction[3] = 0xc0 | (tmp1_reg_ind << 3) | data_ind;
+sljit_emit_op_custom(compiler, instruction, 4);
+
+CMPTO(SLJIT_ZERO, TMP1, 0, SLJIT_IMM, 0, start);
+
+JUMPHERE(quit);
+
+/* BSF r32, r/m32 */
+instruction[0] = 0x0f;
+instruction[1] = 0xbc;
+instruction[2] = 0xc0 | (tmp1_reg_ind << 3) | tmp1_reg_ind;
+sljit_emit_op_custom(compiler, instruction, 3);
+
+OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
+
+if (common->mode != PCRE2_JIT_COMPLETE)
+ {
+ JUMPHERE(partial_quit[0]);
+ JUMPHERE(partial_quit[1]);
+ OP2(SLJIT_SUB | SLJIT_SET_GREATER, SLJIT_UNUSED, 0, STR_PTR, 0, STR_END, 0);
+ CMOV(SLJIT_GREATER, STR_PTR, STR_END, 0);
+ }
+else
+ add_jump(compiler, &common->failed_match, CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0));
+
+#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
+if (common->utf && offset > 0)
+ {
+ SLJIT_ASSERT(common->mode == PCRE2_JIT_COMPLETE);
+
+ OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(-offset));
+
+ quit = jump_if_utf_char_start(compiler, TMP1);
+
+ OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
+ add_jump(compiler, &common->failed_match, CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0));
+ OP1(SLJIT_MOV, TMP2, 0, STR_PTR, 0);
+ JUMPTO(SLJIT_JUMP, restart);
+
+ JUMPHERE(quit);
+ }
+#endif
+}
+
+#ifndef _WIN64
+
+static SLJIT_INLINE sljit_u32 max_fast_forward_char_pair_offset(void)
+{
+#if PCRE2_CODE_UNIT_WIDTH == 8
+return 15;
+#elif PCRE2_CODE_UNIT_WIDTH == 16
+return 7;
+#elif PCRE2_CODE_UNIT_WIDTH == 32
+return 3;
+#else
+#error "Unsupported unit width"
+#endif
+}
+
+#define JIT_HAS_FAST_FORWARD_CHAR_PAIR_SIMD (sljit_has_cpu_feature(SLJIT_HAS_SSE2))
+
+static void fast_forward_char_pair_simd(compiler_common *common, sljit_s32 offs1,
+ PCRE2_UCHAR char1a, PCRE2_UCHAR char1b, sljit_s32 offs2, PCRE2_UCHAR char2a, PCRE2_UCHAR char2b)
+{
+DEFINE_COMPILER;
+sse2_compare_type compare1_type = sse2_compare_match1;
+sse2_compare_type compare2_type = sse2_compare_match1;
+sljit_u32 bit1 = 0;
+sljit_u32 bit2 = 0;
+sljit_u32 diff = IN_UCHARS(offs1 - offs2);
+sljit_s32 tmp1_reg_ind = sljit_get_register_index(TMP1);
+sljit_s32 tmp2_reg_ind = sljit_get_register_index(TMP2);
+sljit_s32 str_ptr_reg_ind = sljit_get_register_index(STR_PTR);
+sljit_s32 data1_ind = 0;
+sljit_s32 data2_ind = 1;
+sljit_s32 tmp1_ind = 2;
+sljit_s32 tmp2_ind = 3;
+sljit_s32 cmp1a_ind = 4;
+sljit_s32 cmp1b_ind = 5;
+sljit_s32 cmp2a_ind = 6;
+sljit_s32 cmp2b_ind = 7;
+struct sljit_label *start;
+#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
+struct sljit_label *restart;
+#endif
+struct sljit_jump *jump[2];
+sljit_u8 instruction[8];
+int i;
+
+SLJIT_ASSERT(common->mode == PCRE2_JIT_COMPLETE && offs1 > offs2);
+SLJIT_ASSERT(diff <= IN_UCHARS(max_fast_forward_char_pair_offset()));
+SLJIT_ASSERT(tmp1_reg_ind < 8 && tmp2_reg_ind == 1);
+
+/* Initialize. */
+if (common->match_end_ptr != 0)
+ {
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->match_end_ptr);
+ OP1(SLJIT_MOV, TMP3, 0, STR_END, 0);
+ OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, IN_UCHARS(offs1 + 1));
+
+ OP2(SLJIT_SUB | SLJIT_SET_LESS, SLJIT_UNUSED, 0, TMP1, 0, STR_END, 0);
+ CMOV(SLJIT_LESS, STR_END, TMP1, 0);
+ }
+
+OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(offs1));
+add_jump(compiler, &common->failed_match, CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0));
+
+/* MOVD xmm, r/m32 */
+instruction[0] = 0x66;
+instruction[1] = 0x0f;
+instruction[2] = 0x6e;
+
+if (char1a == char1b)
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, character_to_int32(char1a));
+else
+ {
+ bit1 = char1a ^ char1b;
+ if (is_powerof2(bit1))
+ {
+ compare1_type = sse2_compare_match1i;
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, character_to_int32(char1a | bit1));
+ OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, character_to_int32(bit1));
+ }
+ else
+ {
+ compare1_type = sse2_compare_match2;
+ bit1 = 0;
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, character_to_int32(char1a));
+ OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, character_to_int32(char1b));
+ }
+ }
+
+instruction[3] = 0xc0 | (cmp1a_ind << 3) | tmp1_reg_ind;
+sljit_emit_op_custom(compiler, instruction, 4);
+
+if (char1a != char1b)
+ {
+ instruction[3] = 0xc0 | (cmp1b_ind << 3) | tmp2_reg_ind;
+ sljit_emit_op_custom(compiler, instruction, 4);
+ }
+
+if (char2a == char2b)
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, character_to_int32(char2a));
+else
+ {
+ bit2 = char2a ^ char2b;
+ if (is_powerof2(bit2))
+ {
+ compare2_type = sse2_compare_match1i;
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, character_to_int32(char2a | bit2));
+ OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, character_to_int32(bit2));
+ }
+ else
+ {
+ compare2_type = sse2_compare_match2;
+ bit2 = 0;
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, character_to_int32(char2a));
+ OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, character_to_int32(char2b));
+ }
+ }
+
+instruction[3] = 0xc0 | (cmp2a_ind << 3) | tmp1_reg_ind;
+sljit_emit_op_custom(compiler, instruction, 4);
+
+if (char2a != char2b)
+ {
+ instruction[3] = 0xc0 | (cmp2b_ind << 3) | tmp2_reg_ind;
+ sljit_emit_op_custom(compiler, instruction, 4);
+ }
+
+/* PSHUFD xmm1, xmm2/m128, imm8 */
+/* instruction[0] = 0x66; */
+/* instruction[1] = 0x0f; */
+instruction[2] = 0x70;
+instruction[4] = 0;
+
+instruction[3] = 0xc0 | (cmp1a_ind << 3) | cmp1a_ind;
+sljit_emit_op_custom(compiler, instruction, 5);
+
+if (char1a != char1b)
+ {
+ instruction[3] = 0xc0 | (cmp1b_ind << 3) | cmp1b_ind;
+ sljit_emit_op_custom(compiler, instruction, 5);
+ }
+
+instruction[3] = 0xc0 | (cmp2a_ind << 3) | cmp2a_ind;
+sljit_emit_op_custom(compiler, instruction, 5);
+
+if (char2a != char2b)
+ {
+ instruction[3] = 0xc0 | (cmp2b_ind << 3) | cmp2b_ind;
+ sljit_emit_op_custom(compiler, instruction, 5);
+ }
+
+#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
+restart = LABEL();
+#endif
+
+OP2(SLJIT_SUB, TMP1, 0, STR_PTR, 0, SLJIT_IMM, diff);
+OP1(SLJIT_MOV, TMP2, 0, STR_PTR, 0);
+OP2(SLJIT_AND, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, ~0xf);
+
+load_from_mem_sse2(compiler, data1_ind, str_ptr_reg_ind, 0);
+
+jump[0] = CMP(SLJIT_GREATER_EQUAL, TMP1, 0, STR_PTR, 0);
+
+load_from_mem_sse2(compiler, data2_ind, str_ptr_reg_ind, -(sljit_s8)diff);
+jump[1] = JUMP(SLJIT_JUMP);
+
+JUMPHERE(jump[0]);
+
+/* MOVDQA xmm1, xmm2/m128 */
+/* instruction[0] = 0x66; */
+/* instruction[1] = 0x0f; */
+instruction[2] = 0x6f;
+instruction[3] = 0xc0 | (data2_ind << 3) | data1_ind;
+sljit_emit_op_custom(compiler, instruction, 4);
+
+/* PSLLDQ xmm1, imm8 */
+/* instruction[0] = 0x66; */
+/* instruction[1] = 0x0f; */
+instruction[2] = 0x73;
+instruction[3] = 0xc0 | (7 << 3) | data2_ind;
+instruction[4] = diff;
+sljit_emit_op_custom(compiler, instruction, 5);
+
+JUMPHERE(jump[1]);
+
+OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0xf);
+
+for (i = 0; i < 4; i++)
+ {
+ fast_forward_char_pair_sse2_compare(compiler, compare2_type, i, data2_ind, cmp2a_ind, cmp2b_ind, tmp2_ind);
+ fast_forward_char_pair_sse2_compare(compiler, compare1_type, i, data1_ind, cmp1a_ind, cmp1b_ind, tmp1_ind);
+ }
+
+/* PAND xmm1, xmm2/m128 */
+/* instruction[0] = 0x66; */
+/* instruction[1] = 0x0f; */
+instruction[2] = 0xdb;
+instruction[3] = 0xc0 | (data1_ind << 3) | data2_ind;
+sljit_emit_op_custom(compiler, instruction, 4);
+
+/* PMOVMSKB reg, xmm */
+/* instruction[0] = 0x66; */
+/* instruction[1] = 0x0f; */
+instruction[2] = 0xd7;
+instruction[3] = 0xc0 | (tmp1_reg_ind << 3) | 0;
+sljit_emit_op_custom(compiler, instruction, 4);
+
+/* Ignore matches before the first STR_PTR. */
+OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP2, 0);
+OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, TMP2, 0);
+
+jump[0] = CMP(SLJIT_NOT_ZERO, TMP1, 0, SLJIT_IMM, 0);
+
+OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, TMP2, 0);
+
+/* Main loop. */
+start = LABEL();
+
+OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, 16);
+add_jump(compiler, &common->failed_match, CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0));
+
+load_from_mem_sse2(compiler, data1_ind, str_ptr_reg_ind, 0);
+load_from_mem_sse2(compiler, data2_ind, str_ptr_reg_ind, -(sljit_s8)diff);
+
+for (i = 0; i < 4; i++)
+ {
+ fast_forward_char_pair_sse2_compare(compiler, compare1_type, i, data1_ind, cmp1a_ind, cmp1b_ind, tmp2_ind);
+ fast_forward_char_pair_sse2_compare(compiler, compare2_type, i, data2_ind, cmp2a_ind, cmp2b_ind, tmp1_ind);
+ }
+
+/* PAND xmm1, xmm2/m128 */
+/* instruction[0] = 0x66; */
+/* instruction[1] = 0x0f; */
+instruction[2] = 0xdb;
+instruction[3] = 0xc0 | (data1_ind << 3) | data2_ind;
+sljit_emit_op_custom(compiler, instruction, 4);
+
+/* PMOVMSKB reg, xmm */
+/* instruction[0] = 0x66; */
+/* instruction[1] = 0x0f; */
+instruction[2] = 0xd7;
+instruction[3] = 0xc0 | (tmp1_reg_ind << 3) | 0;
+sljit_emit_op_custom(compiler, instruction, 4);
+
+CMPTO(SLJIT_ZERO, TMP1, 0, SLJIT_IMM, 0, start);
+
+JUMPHERE(jump[0]);
+
+/* BSF r32, r/m32 */
+instruction[0] = 0x0f;
+instruction[1] = 0xbc;
+instruction[2] = 0xc0 | (tmp1_reg_ind << 3) | tmp1_reg_ind;
+sljit_emit_op_custom(compiler, instruction, 3);
+
+OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
+
+add_jump(compiler, &common->failed_match, CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0));
+
+if (common->match_end_ptr != 0)
+ OP1(SLJIT_MOV, STR_END, 0, SLJIT_MEM1(SLJIT_SP), common->match_end_ptr);
+
+#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
+if (common->utf)
+ {
+ OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(-offs1));
+
+ jump[0] = jump_if_utf_char_start(compiler, TMP1);
+
+ OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
+ CMPTO(SLJIT_LESS, STR_PTR, 0, STR_END, 0, restart);
+
+ add_jump(compiler, &common->failed_match, JUMP(SLJIT_JUMP));
+
+ JUMPHERE(jump[0]);
+ }
+#endif
+
+OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(offs1));
+
+if (common->match_end_ptr != 0)
+ OP1(SLJIT_MOV, STR_END, 0, TMP3, 0);
+}
+
+#endif /* !_WIN64 */
+
+#undef SSE2_COMPARE_TYPE_INDEX
+
+#endif /* SLJIT_CONFIG_X86 && !SUPPORT_VALGRIND */
+
+#if (defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64 && (defined __ARM_NEON || defined __ARM_NEON__))
+
+#include <arm_neon.h>
+
+typedef union {
+ unsigned int x;
+ struct { unsigned char c1, c2, c3, c4; } c;
+} int_char;
+
+#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
+static SLJIT_INLINE int utf_continue(sljit_u8 *s)
+{
+#if PCRE2_CODE_UNIT_WIDTH == 8
+return (*s & 0xc0) == 0x80;
+#elif PCRE2_CODE_UNIT_WIDTH == 16
+return (*s & 0xfc00) == 0xdc00;
+#else
+#error "Unknown code width"
+#endif
+}
+#endif /* SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32 */
+
+#if PCRE2_CODE_UNIT_WIDTH == 8
+# define VECTOR_FACTOR 16
+# define vect_t uint8x16_t
+# define VLD1Q(X) vld1q_u8((sljit_u8 *)(X))
+# define VCEQQ vceqq_u8
+# define VORRQ vorrq_u8
+# define VST1Q vst1q_u8
+# define VDUPQ vdupq_n_u8
+# define VEXTQ vextq_u8
+# define VANDQ vandq_u8
+typedef union {
+ uint8_t mem[16];
+ uint64_t dw[2];
+} quad_word;
+#elif PCRE2_CODE_UNIT_WIDTH == 16
+# define VECTOR_FACTOR 8
+# define vect_t uint16x8_t
+# define VLD1Q(X) vld1q_u16((sljit_u16 *)(X))
+# define VCEQQ vceqq_u16
+# define VORRQ vorrq_u16
+# define VST1Q vst1q_u16
+# define VDUPQ vdupq_n_u16
+# define VEXTQ vextq_u16
+# define VANDQ vandq_u16
+typedef union {
+ uint16_t mem[8];
+ uint64_t dw[2];
+} quad_word;
+#else
+# define VECTOR_FACTOR 4
+# define vect_t uint32x4_t
+# define VLD1Q(X) vld1q_u32((sljit_u32 *)(X))
+# define VCEQQ vceqq_u32
+# define VORRQ vorrq_u32
+# define VST1Q vst1q_u32
+# define VDUPQ vdupq_n_u32
+# define VEXTQ vextq_u32
+# define VANDQ vandq_u32
+typedef union {
+ uint32_t mem[4];
+ uint64_t dw[2];
+} quad_word;
+#endif
+
+#define FFCS
+#include "pcre2_jit_neon_inc.h"
+#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
+# define FF_UTF
+# include "pcre2_jit_neon_inc.h"
+# undef FF_UTF
+#endif
+#undef FFCS
+
+#define FFCS_2
+#include "pcre2_jit_neon_inc.h"
+#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
+# define FF_UTF
+# include "pcre2_jit_neon_inc.h"
+# undef FF_UTF
+#endif
+#undef FFCS_2
+
+#define FFCS_MASK
+#include "pcre2_jit_neon_inc.h"
+#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
+# define FF_UTF
+# include "pcre2_jit_neon_inc.h"
+# undef FF_UTF
+#endif
+#undef FFCS_MASK
+
+#define JIT_HAS_FAST_FORWARD_CHAR_SIMD 1
+
+static void fast_forward_char_simd(compiler_common *common, PCRE2_UCHAR char1, PCRE2_UCHAR char2, sljit_s32 offset)
+{
+DEFINE_COMPILER;
+int_char ic;
+struct sljit_jump *partial_quit;
+/* Save temporary registers. */
+OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS0, STR_PTR, 0);
+OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS1, TMP3, 0);
+
+/* Prepare function arguments */
+OP1(SLJIT_MOV, SLJIT_R0, 0, STR_END, 0);
+OP1(SLJIT_MOV, SLJIT_R1, 0, STR_PTR, 0);
+OP1(SLJIT_MOV, SLJIT_R2, 0, SLJIT_IMM, offset);
+
+if (char1 == char2)
+ {
+ ic.c.c1 = char1;
+ ic.c.c2 = char2;
+ OP1(SLJIT_MOV, SLJIT_R4, 0, SLJIT_IMM, ic.x);
+
+#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
+ if (common->utf && offset > 0)
+ sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(SW) | SLJIT_ARG1(SW) | SLJIT_ARG2(UW) | SLJIT_ARG3(UW) | SLJIT_ARG4(UW),
+ SLJIT_IMM, SLJIT_FUNC_OFFSET(ffcs_utf));
+ else
+ sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(SW) | SLJIT_ARG1(SW) | SLJIT_ARG2(UW) | SLJIT_ARG3(UW) | SLJIT_ARG4(UW),
+ SLJIT_IMM, SLJIT_FUNC_OFFSET(ffcs));
+#else
+ sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(SW) | SLJIT_ARG1(SW) | SLJIT_ARG2(UW) | SLJIT_ARG3(UW) | SLJIT_ARG4(UW),
+ SLJIT_IMM, SLJIT_FUNC_OFFSET(ffcs));
+#endif
+ }
+else
+ {
+ PCRE2_UCHAR mask = char1 ^ char2;
+ if (is_powerof2(mask))
+ {
+ ic.c.c1 = char1 | mask;
+ ic.c.c2 = mask;
+ OP1(SLJIT_MOV, SLJIT_R4, 0, SLJIT_IMM, ic.x);
+
+#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
+ if (common->utf && offset > 0)
+ sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(SW) | SLJIT_ARG1(SW) | SLJIT_ARG2(UW) | SLJIT_ARG3(UW) | SLJIT_ARG4(UW),
+ SLJIT_IMM, SLJIT_FUNC_OFFSET(ffcs_mask_utf));
+ else
+ sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(SW) | SLJIT_ARG1(SW) | SLJIT_ARG2(UW) | SLJIT_ARG3(UW) | SLJIT_ARG4(UW),
+ SLJIT_IMM, SLJIT_FUNC_OFFSET(ffcs_mask));
+#else
+ sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(SW) | SLJIT_ARG1(SW) | SLJIT_ARG2(UW) | SLJIT_ARG3(UW) | SLJIT_ARG4(UW),
+ SLJIT_IMM, SLJIT_FUNC_OFFSET(ffcs_mask));
+#endif
+ }
+ else
+ {
+ ic.c.c1 = char1;
+ ic.c.c2 = char2;
+ OP1(SLJIT_MOV, SLJIT_R4, 0, SLJIT_IMM, ic.x);
+
+#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
+ if (common->utf && offset > 0)
+ sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(SW) | SLJIT_ARG1(SW) | SLJIT_ARG2(UW) | SLJIT_ARG3(UW) | SLJIT_ARG4(UW),
+ SLJIT_IMM, SLJIT_FUNC_OFFSET(ffcs_2_utf));
+ else
+ sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(SW) | SLJIT_ARG1(SW) | SLJIT_ARG2(UW) | SLJIT_ARG3(UW) | SLJIT_ARG4(UW),
+ SLJIT_IMM, SLJIT_FUNC_OFFSET(ffcs_2));
+#else
+ sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(SW) | SLJIT_ARG1(SW) | SLJIT_ARG2(UW) | SLJIT_ARG3(UW) | SLJIT_ARG4(UW),
+ SLJIT_IMM, SLJIT_FUNC_OFFSET(ffcs_2));
+#endif
+ }
+ }
+/* Restore registers. */
+OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), LOCALS0);
+OP1(SLJIT_MOV, TMP3, 0, SLJIT_MEM1(SLJIT_SP), LOCALS1);
+
+/* Check return value. */
+partial_quit = CMP(SLJIT_EQUAL, SLJIT_RETURN_REG, 0, SLJIT_IMM, 0);
+if (common->mode == PCRE2_JIT_COMPLETE)
+ add_jump(compiler, &common->failed_match, partial_quit);
+
+/* Fast forward STR_PTR to the result of memchr. */
+OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_RETURN_REG, 0);
+
+if (common->mode != PCRE2_JIT_COMPLETE)
+ JUMPHERE(partial_quit);
+}
+
+typedef enum {
+ compare_match1,
+ compare_match1i,
+ compare_match2,
+} compare_type;
+
+static inline vect_t fast_forward_char_pair_compare(compare_type ctype, vect_t dst, vect_t cmp1, vect_t cmp2)
+{
+if (ctype == compare_match2)
+ {
+ vect_t tmp = dst;
+ dst = VCEQQ(dst, cmp1);
+ tmp = VCEQQ(tmp, cmp2);
+ dst = VORRQ(dst, tmp);
+ return dst;
+ }
+
+if (ctype == compare_match1i)
+ dst = VORRQ(dst, cmp2);
+dst = VCEQQ(dst, cmp1);
+return dst;
+}
+
+static SLJIT_INLINE sljit_u32 max_fast_forward_char_pair_offset(void)
+{
+#if PCRE2_CODE_UNIT_WIDTH == 8
+return 15;
+#elif PCRE2_CODE_UNIT_WIDTH == 16
+return 7;
+#elif PCRE2_CODE_UNIT_WIDTH == 32
+return 3;
+#else
+#error "Unsupported unit width"
+#endif
+}
+
+/* ARM doesn't have a shift left across lanes. */
+static SLJIT_INLINE vect_t shift_left_n_lanes(vect_t a, sljit_u8 n)
+{
+vect_t zero = VDUPQ(0);
+SLJIT_ASSERT(0 < n && n < VECTOR_FACTOR);
+/* VEXTQ takes an immediate as last argument. */
+#define C(X) case X: return VEXTQ(zero, a, VECTOR_FACTOR - X);
+switch (n)
+ {
+ C(1); C(2); C(3);
+#if PCRE2_CODE_UNIT_WIDTH != 32
+ C(4); C(5); C(6); C(7);
+# if PCRE2_CODE_UNIT_WIDTH != 16
+ C(8); C(9); C(10); C(11); C(12); C(13); C(14); C(15);
+# endif
+#endif
+ default:
+ /* Based on the ASSERT(0 < n && n < VECTOR_FACTOR) above, this won't
+ happen. The return is still here for compilers to not warn. */
+ return a;
+ }
+}
+
+#define FFCPS
+#define FFCPS_DIFF1
+#define FFCPS_CHAR1A2A
+
+#define FFCPS_0
+#include "pcre2_jit_neon_inc.h"
+#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
+# define FF_UTF
+# include "pcre2_jit_neon_inc.h"
+# undef FF_UTF
+#endif
+#undef FFCPS_0
+
+#undef FFCPS_CHAR1A2A
+
+#define FFCPS_1
+#include "pcre2_jit_neon_inc.h"
+#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
+# define FF_UTF
+# include "pcre2_jit_neon_inc.h"
+# undef FF_UTF
+#endif
+#undef FFCPS_1
+
+#undef FFCPS_DIFF1
+
+#define FFCPS_DEFAULT
+#include "pcre2_jit_neon_inc.h"
+#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
+# define FF_UTF
+# include "pcre2_jit_neon_inc.h"
+# undef FF_UTF
+#endif
+#undef FFCPS
+
+#define JIT_HAS_FAST_FORWARD_CHAR_PAIR_SIMD 1
+
+static void fast_forward_char_pair_simd(compiler_common *common, sljit_s32 offs1,
+ PCRE2_UCHAR char1a, PCRE2_UCHAR char1b, sljit_s32 offs2, PCRE2_UCHAR char2a, PCRE2_UCHAR char2b)
+{
+DEFINE_COMPILER;
+sljit_u32 diff = IN_UCHARS(offs1 - offs2);
+struct sljit_jump *partial_quit;
+int_char ic;
+SLJIT_ASSERT(common->mode == PCRE2_JIT_COMPLETE && offs1 > offs2);
+SLJIT_ASSERT(diff <= IN_UCHARS(max_fast_forward_char_pair_offset()));
+SLJIT_ASSERT(compiler->scratches == 5);
+
+/* Save temporary register STR_PTR. */
+OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS0, STR_PTR, 0);
+
+/* Prepare arguments for the function call. */
+if (common->match_end_ptr == 0)
+ OP1(SLJIT_MOV, SLJIT_R0, 0, STR_END, 0);
+else
+ {
+ OP1(SLJIT_MOV, SLJIT_R0, 0, SLJIT_MEM1(SLJIT_SP), common->match_end_ptr);
+ OP2(SLJIT_ADD, SLJIT_R0, 0, SLJIT_R0, 0, SLJIT_IMM, IN_UCHARS(offs1 + 1));
+
+ OP2(SLJIT_SUB | SLJIT_SET_LESS, SLJIT_UNUSED, 0, STR_END, 0, SLJIT_R0, 0);
+ CMOV(SLJIT_LESS, SLJIT_R0, STR_END, 0);
+ }
+
+OP1(SLJIT_MOV, SLJIT_R1, 0, STR_PTR, 0);
+OP1(SLJIT_MOV_S32, SLJIT_R2, 0, SLJIT_IMM, offs1);
+OP1(SLJIT_MOV_S32, SLJIT_R3, 0, SLJIT_IMM, offs2);
+ic.c.c1 = char1a;
+ic.c.c2 = char1b;
+ic.c.c3 = char2a;
+ic.c.c4 = char2b;
+OP1(SLJIT_MOV_U32, SLJIT_R4, 0, SLJIT_IMM, ic.x);
+
+if (diff == 1) {
+ if (char1a == char1b && char2a == char2b) {
+#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
+ if (common->utf)
+ sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(SW) | SLJIT_ARG1(SW) | SLJIT_ARG2(SW) | SLJIT_ARG3(SW) | SLJIT_ARG4(SW),
+ SLJIT_IMM, SLJIT_FUNC_OFFSET(ffcps_0_utf));
+ else
+#endif
+ sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(SW) | SLJIT_ARG1(SW) | SLJIT_ARG2(SW) | SLJIT_ARG3(SW) | SLJIT_ARG4(SW),
+ SLJIT_IMM, SLJIT_FUNC_OFFSET(ffcps_0));
+ } else {
+#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
+ if (common->utf)
+ sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(SW) | SLJIT_ARG1(SW) | SLJIT_ARG2(SW) | SLJIT_ARG3(SW) | SLJIT_ARG4(SW),
+ SLJIT_IMM, SLJIT_FUNC_OFFSET(ffcps_1_utf));
+ else
+#endif
+ sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(SW) | SLJIT_ARG1(SW) | SLJIT_ARG2(SW) | SLJIT_ARG3(SW) | SLJIT_ARG4(SW),
+ SLJIT_IMM, SLJIT_FUNC_OFFSET(ffcps_1));
+ }
+} else {
+#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32
+ if (common->utf)
+ sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(SW) | SLJIT_ARG1(SW) | SLJIT_ARG2(SW) | SLJIT_ARG3(SW) | SLJIT_ARG4(SW),
+ SLJIT_IMM, SLJIT_FUNC_OFFSET(ffcps_default_utf));
+ else
+#endif
+ sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(SW) | SLJIT_ARG1(SW) | SLJIT_ARG2(SW) | SLJIT_ARG3(SW) | SLJIT_ARG4(SW),
+ SLJIT_IMM, SLJIT_FUNC_OFFSET(ffcps_default));
+}
+
+/* Restore STR_PTR register. */
+OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), LOCALS0);
+
+/* Check return value. */
+partial_quit = CMP(SLJIT_EQUAL, SLJIT_RETURN_REG, 0, SLJIT_IMM, 0);
+add_jump(compiler, &common->failed_match, partial_quit);
+
+/* Fast forward STR_PTR to the result of memchr. */
+OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_RETURN_REG, 0);
+
+JUMPHERE(partial_quit);
+}
+
+#endif /* SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64 */
diff --git a/ext/pcre/pcre2lib/pcre2_maketables.c b/ext/pcre/pcre2lib/pcre2_maketables.c
index 5921e90793..8c93b4b573 100644
--- a/ext/pcre/pcre2lib/pcre2_maketables.c
+++ b/ext/pcre/pcre2lib/pcre2_maketables.c
@@ -147,4 +147,15 @@ for (i = 0; i < 256; i++)
return yield;
}
+#ifndef DFTABLES
+PCRE2_EXP_DEFN void PCRE2_CALL_CONVENTION
+pcre2_maketables_free(pcre2_general_context *gcontext, const uint8_t *tables)
+{
+ if (gcontext)
+ gcontext->memctl.free((void *)tables, gcontext->memctl.memory_data);
+ else
+ free((void *)tables);
+}
+#endif
+
/* End of pcre2_maketables.c */
diff --git a/ext/pcre/pcre2lib/pcre2_match.c b/ext/pcre/pcre2lib/pcre2_match.c
index 419561fd64..48e7b9dbb2 100644
--- a/ext/pcre/pcre2lib/pcre2_match.c
+++ b/ext/pcre/pcre2lib/pcre2_match.c
@@ -415,8 +415,7 @@ if (caseless)
else
#endif
- /* Not in UTF mode */
-
+ /* Not in UTF mode */
{
for (; length > 0; length--)
{
@@ -491,27 +490,32 @@ heap is used for a larger vector.
*************************************************/
/* These macros pack up tests that are used for partial matching several times
-in the code. We set the "hit end" flag if the pointer is at the end of the
-subject and also past the earliest inspected character (i.e. something has been
-matched, even if not part of the actual matched string). For hard partial
-matching, we then return immediately. The second one is used when we already
-know we are past the end of the subject. */
+in the code. The second one is used when we already know we are past the end of
+the subject. We set the "hit end" flag if the pointer is at the end of the
+subject and either (a) the pointer is past the earliest inspected character
+(i.e. something has been matched, even if not part of the actual matched
+string), or (b) the pattern contains a lookbehind. These are the conditions for
+which adding more characters may allow the current match to continue.
+
+For hard partial matching, we immediately return a partial match. Otherwise,
+carrying on means that a complete match on the current subject will be sought.
+A partial match is returned only if no complete match can be found. */
#define CHECK_PARTIAL()\
- if (mb->partial != 0 && Feptr >= mb->end_subject && \
- Feptr > mb->start_used_ptr) \
+ if (Feptr >= mb->end_subject) \
{ \
- mb->hitend = TRUE; \
- if (mb->partial > 1) return PCRE2_ERROR_PARTIAL; \
+ SCHECK_PARTIAL(); \
}
#define SCHECK_PARTIAL()\
- if (mb->partial != 0 && Feptr > mb->start_used_ptr) \
+ if (mb->partial != 0 && \
+ (Feptr > mb->start_used_ptr || mb->allowemptypartial)) \
{ \
mb->hitend = TRUE; \
if (mb->partial > 1) return PCRE2_ERROR_PARTIAL; \
}
+
/* These macros are used to implement backtracking. They simulate a recursive
call to the match() function by means of a local vector of frames which
remember the backtracking points. */
@@ -5127,6 +5131,8 @@ fprintf(stderr, "++ op=%d\n", *Fecode);
case OP_ASSERT:
case OP_ASSERTBACK:
+ case OP_ASSERT_NA:
+ case OP_ASSERTBACK_NA:
Lframe_type = GF_NOCAPTURE | Fop;
for (;;)
{
@@ -5412,7 +5418,7 @@ fprintf(stderr, "++ op=%d\n", *Fecode);
{
while (number-- > 0)
{
- if (Feptr <= mb->start_subject) RRETURN(MATCH_NOMATCH);
+ if (Feptr <= mb->check_subject) RRETURN(MATCH_NOMATCH);
Feptr--;
BACKCHAR(Feptr);
}
@@ -5420,7 +5426,7 @@ fprintf(stderr, "++ op=%d\n", *Fecode);
else
#endif
- /* No UTF-8 support, or not in UTF-8 mode: count is byte count */
+ /* No UTF-8 support, or not in UTF-8 mode: count is code unit count */
{
if ((ptrdiff_t)number > Feptr - mb->start_subject) RRETURN(MATCH_NOMATCH);
@@ -5472,15 +5478,16 @@ fprintf(stderr, "++ op=%d\n", *Fecode);
/* If we are at the end of an assertion that is a condition, return a
match, discarding any intermediate backtracking points. Copy back the
- captures into the frame before N so that they are set on return. Doing
- this for all assertions, both positive and negative, seems to match what
- Perl does. */
+ mark setting and the captures into the frame before N so that they are
+ set on return. Doing this for all assertions, both positive and negative,
+ seems to match what Perl does. */
if (GF_IDMASK(N->group_frame_type) == GF_CONDASSERT)
{
memcpy((char *)P + offsetof(heapframe, ovector), Fovector,
Foffset_top * sizeof(PCRE2_SIZE));
P->offset_top = Foffset_top;
+ P->mark = Fmark;
Fback_frame = (char *)F - (char *)P;
RRETURN(MATCH_MATCH);
}
@@ -5496,10 +5503,20 @@ fprintf(stderr, "++ op=%d\n", *Fecode);
case OP_SCOND:
break;
- /* Positive assertions are like OP_ONCE, except that in addition the
+ /* Non-atomic positive assertions are like OP_BRA, except that the
subject pointer must be put back to where it was at the start of the
assertion. */
+ case OP_ASSERT_NA:
+ case OP_ASSERTBACK_NA:
+ if (Feptr > mb->last_used_ptr) mb->last_used_ptr = Feptr;
+ Feptr = P->eptr;
+ break;
+
+ /* Atomic positive assertions are like OP_ONCE, except that in addition
+ the subject pointer must be put back to where it was at the start of the
+ assertion. */
+
case OP_ASSERT:
case OP_ASSERTBACK:
if (Feptr > mb->last_used_ptr) mb->last_used_ptr = Feptr;
@@ -5640,7 +5657,11 @@ fprintf(stderr, "++ op=%d\n", *Fecode);
case OP_EOD:
if (Feptr < mb->end_subject) RRETURN(MATCH_NOMATCH);
- SCHECK_PARTIAL();
+ if (mb->partial != 0)
+ {
+ mb->hitend = TRUE;
+ if (mb->partial > 1) return PCRE2_ERROR_PARTIAL;
+ }
Fecode++;
break;
@@ -5665,7 +5686,11 @@ fprintf(stderr, "++ op=%d\n", *Fecode);
/* Either at end of string or \n before end. */
- SCHECK_PARTIAL();
+ if (mb->partial != 0)
+ {
+ mb->hitend = TRUE;
+ if (mb->partial > 1) return PCRE2_ERROR_PARTIAL;
+ }
Fecode++;
break;
@@ -5743,7 +5768,7 @@ fprintf(stderr, "++ op=%d\n", *Fecode);
case OP_NOT_WORD_BOUNDARY:
case OP_WORD_BOUNDARY:
- if (Feptr == mb->start_subject) prev_is_word = FALSE; else
+ if (Feptr == mb->check_subject) prev_is_word = FALSE; else
{
PCRE2_SPTR lastptr = Feptr - 1;
#ifdef SUPPORT_UNICODE
@@ -5946,6 +5971,7 @@ in rrc. */
#define LBL(val) case val: goto L_RM##val;
RETURN_SWITCH:
+if (Feptr > mb->last_used_ptr) mb->last_used_ptr = Feptr;
if (Frdepth == 0) return rrc; /* Exit from the top level */
F = (heapframe *)((char *)F - Fback_frame); /* Backtrack */
mb->cb->callout_flags |= PCRE2_CALLOUT_BACKTRACK; /* Note for callouts */
@@ -5999,9 +6025,9 @@ Arguments:
Returns: > 0 => success; value is the number of ovector pairs filled
= 0 => success, but ovector is not big enough
- -1 => failed to match (PCRE2_ERROR_NOMATCH)
- -2 => partial match (PCRE2_ERROR_PARTIAL)
- < -2 => some kind of unexpected problem
+ = -1 => failed to match (PCRE2_ERROR_NOMATCH)
+ = -2 => partial match (PCRE2_ERROR_PARTIAL)
+ < -2 => some kind of unexpected problem
*/
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
@@ -6014,7 +6040,6 @@ int was_zero_terminated = 0;
const uint8_t *start_bits = NULL;
const pcre2_real_code *re = (const pcre2_real_code *)code;
-
BOOL anchored;
BOOL firstline;
BOOL has_first_cu = FALSE;
@@ -6022,6 +6047,11 @@ BOOL has_req_cu = FALSE;
BOOL startline;
BOOL utf;
+#if PCRE2_CODE_UNIT_WIDTH == 8
+BOOL memchr_not_found_first_cu = FALSE;
+BOOL memchr_not_found_first_cu2 = FALSE;
+#endif
+
PCRE2_UCHAR first_cu = 0;
PCRE2_UCHAR first_cu2 = 0;
PCRE2_UCHAR req_cu = 0;
@@ -6029,10 +6059,23 @@ PCRE2_UCHAR req_cu2 = 0;
PCRE2_SPTR bumpalong_limit;
PCRE2_SPTR end_subject;
+PCRE2_SPTR true_end_subject;
PCRE2_SPTR start_match = subject + start_offset;
PCRE2_SPTR req_cu_ptr = start_match - 1;
-PCRE2_SPTR start_partial = NULL;
-PCRE2_SPTR match_partial = NULL;
+PCRE2_SPTR start_partial;
+PCRE2_SPTR match_partial;
+
+#ifdef SUPPORT_JIT
+BOOL use_jit;
+#endif
+
+#ifdef SUPPORT_UNICODE
+BOOL allow_invalid;
+uint32_t fragment_options = 0;
+#ifdef SUPPORT_JIT
+BOOL jit_checked_utf = FALSE;
+#endif
+#endif
PCRE2_SIZE frame_size;
@@ -6059,7 +6102,7 @@ if (length == PCRE2_ZERO_TERMINATED)
length = PRIV(strlen)(subject);
was_zero_terminated = 1;
}
-end_subject = subject + length;
+true_end_subject = end_subject = subject + length;
/* Plausibility checks */
@@ -6095,12 +6138,24 @@ options |= (re->flags & FF) / ((FF & (~FF+1)) / (OO & (~OO+1)));
#undef FF
#undef OO
-/* These two settings are used in the code for checking a UTF string that
-follows immediately afterwards. Other values in the mb block are used only
-during interpretive processing, not when the JIT support is in use, so they are
-set up later. */
+/* If the pattern was successfully studied with JIT support, we will run the
+JIT executable instead of the rest of this function. Most options must be set
+at compile time for the JIT code to be usable. */
+
+#ifdef SUPPORT_JIT
+use_jit = (re->executable_jit != NULL &&
+ (options & ~PUBLIC_JIT_MATCH_OPTIONS) == 0);
+#endif
+
+/* Initialize UTF parameters. */
utf = (re->overall_options & PCRE2_UTF) != 0;
+#ifdef SUPPORT_UNICODE
+allow_invalid = (re->overall_options & PCRE2_MATCH_INVALID_UTF) != 0;
+#endif
+
+/* Convert the partial matching flags into an integer. */
+
mb->partial = ((options & PCRE2_PARTIAL_HARD) != 0)? 2 :
((options & PCRE2_PARTIAL_SOFT) != 0)? 1 : 0;
@@ -6111,88 +6166,107 @@ if (mb->partial != 0 &&
((re->overall_options | options) & PCRE2_ENDANCHORED) != 0)
return PCRE2_ERROR_BADOPTION;
-/* Check a UTF string for validity if required. For 8-bit and 16-bit strings,
-we must also check that a starting offset does not point into the middle of a
-multiunit character. We check only the portion of the subject that is going to
-be inspected during matching - from the offset minus the maximum back reference
-to the given length. This saves time when a small part of a large subject is
-being matched by the use of a starting offset. Note that the maximum lookbehind
-is a number of characters, not code units. */
+/* It is an error to set an offset limit without setting the flag at compile
+time. */
-#ifdef SUPPORT_UNICODE
-if (utf && (options & PCRE2_NO_UTF_CHECK) == 0)
+if (mcontext != NULL && mcontext->offset_limit != PCRE2_UNSET &&
+ (re->overall_options & PCRE2_USE_OFFSET_LIMIT) == 0)
+ return PCRE2_ERROR_BADOFFSETLIMIT;
+
+/* If the match data block was previously used with PCRE2_COPY_MATCHED_SUBJECT,
+free the memory that was obtained. Set the field to NULL for no match cases. */
+
+if ((match_data->flags & PCRE2_MD_COPIED_SUBJECT) != 0)
{
- PCRE2_SPTR check_subject = start_match; /* start_match includes offset */
+ match_data->memctl.free((void *)match_data->subject,
+ match_data->memctl.memory_data);
+ match_data->flags &= ~PCRE2_MD_COPIED_SUBJECT;
+ }
+match_data->subject = NULL;
+
+/* Zero the error offset in case the first code unit is invalid UTF. */
+
+match_data->startchar = 0;
+
+
+/* ============================= JIT matching ============================== */
+
+/* Prepare for JIT matching. Check a UTF string for validity unless no check is
+requested or invalid UTF can be handled. We check only the portion of the
+subject that might be be inspected during matching - from the offset minus the
+maximum lookbehind to the given length. This saves time when a small part of a
+large subject is being matched by the use of a starting offset. Note that the
+maximum lookbehind is a number of characters, not code units. */
- if (start_offset > 0)
+#ifdef SUPPORT_JIT
+if (use_jit)
+ {
+#ifdef SUPPORT_UNICODE
+ if (utf && (options & PCRE2_NO_UTF_CHECK) == 0 && !allow_invalid)
{
#if PCRE2_CODE_UNIT_WIDTH != 32
unsigned int i;
+#endif
+
+ /* For 8-bit and 16-bit UTF, check that the first code unit is a valid
+ character start. */
+
+#if PCRE2_CODE_UNIT_WIDTH != 32
if (start_match < end_subject && NOT_FIRSTCU(*start_match))
- return PCRE2_ERROR_BADUTFOFFSET;
- for (i = re->max_lookbehind; i > 0 && check_subject > subject; i--)
{
- check_subject--;
- while (check_subject > subject &&
+ if (start_offset > 0) return PCRE2_ERROR_BADUTFOFFSET;
+#if PCRE2_CODE_UNIT_WIDTH == 8
+ return PCRE2_ERROR_UTF8_ERR20; /* Isolated 0x80 byte */
+#else
+ return PCRE2_ERROR_UTF16_ERR3; /* Isolated low surrogate */
+#endif
+ }
+#endif /* WIDTH != 32 */
+
+ /* Move back by the maximum lookbehind, just in case it happens at the very
+ start of matching. */
+
+#if PCRE2_CODE_UNIT_WIDTH != 32
+ for (i = re->max_lookbehind; i > 0 && start_match > subject; i--)
+ {
+ start_match--;
+ while (start_match > subject &&
#if PCRE2_CODE_UNIT_WIDTH == 8
- (*check_subject & 0xc0) == 0x80)
+ (*start_match & 0xc0) == 0x80)
#else /* 16-bit */
- (*check_subject & 0xfc00) == 0xdc00)
-#endif /* PCRE2_CODE_UNIT_WIDTH == 8 */
- check_subject--;
+ (*start_match & 0xfc00) == 0xdc00)
+#endif
+ start_match--;
}
-#else
+#else /* PCRE2_CODE_UNIT_WIDTH != 32 */
+
/* In the 32-bit library, one code unit equals one character. However,
we cannot just subtract the lookbehind and then compare pointers, because
a very large lookbehind could create an invalid pointer. */
if (start_offset >= re->max_lookbehind)
- check_subject -= re->max_lookbehind;
+ start_match -= re->max_lookbehind;
else
- check_subject = subject;
+ start_match = subject;
#endif /* PCRE2_CODE_UNIT_WIDTH != 32 */
- }
- /* Validate the relevant portion of the subject. After an error, adjust the
- offset to be an absolute offset in the whole string. */
+ /* Validate the relevant portion of the subject. Adjust the offset of an
+ invalid code point to be an absolute offset in the whole string. */
- match_data->rc = PRIV(valid_utf)(check_subject,
- length - (check_subject - subject), &(match_data->startchar));
- if (match_data->rc != 0)
- {
- match_data->startchar += check_subject - subject;
- return match_data->rc;
+ match_data->rc = PRIV(valid_utf)(start_match,
+ length - (start_match - subject), &(match_data->startchar));
+ if (match_data->rc != 0)
+ {
+ match_data->startchar += start_match - subject;
+ return match_data->rc;
+ }
+ jit_checked_utf = TRUE;
}
- }
#endif /* SUPPORT_UNICODE */
-/* It is an error to set an offset limit without setting the flag at compile
-time. */
-
-if (mcontext != NULL && mcontext->offset_limit != PCRE2_UNSET &&
- (re->overall_options & PCRE2_USE_OFFSET_LIMIT) == 0)
- return PCRE2_ERROR_BADOFFSETLIMIT;
-
-/* If the match data block was previously used with PCRE2_COPY_MATCHED_SUBJECT,
-free the memory that was obtained. Set the field to NULL for no match cases. */
+ /* If JIT returns BADOPTION, which means that the selected complete or
+ partial matching mode was not compiled, fall through to the interpreter. */
-if ((match_data->flags & PCRE2_MD_COPIED_SUBJECT) != 0)
- {
- match_data->memctl.free((void *)match_data->subject,
- match_data->memctl.memory_data);
- match_data->flags &= ~PCRE2_MD_COPIED_SUBJECT;
- }
-match_data->subject = NULL;
-
-/* If the pattern was successfully studied with JIT support, run the JIT
-executable instead of the rest of this function. Most options must be set at
-compile time for the JIT code to be usable. Fallback to the normal code path if
-an unsupported option is set or if JIT returns BADOPTION (which means that the
-selected normal or partial matching mode was not compiled). */
-
-#ifdef SUPPORT_JIT
-if (re->executable_jit != NULL && (options & ~PUBLIC_JIT_MATCH_OPTIONS) == 0)
- {
rc = pcre2_jit_match(code, subject, length, start_offset, options,
match_data, mcontext);
if (rc != PCRE2_ERROR_JIT_BADOPTION)
@@ -6209,10 +6283,152 @@ if (re->executable_jit != NULL && (options & ~PUBLIC_JIT_MATCH_OPTIONS) == 0)
return rc;
}
}
+#endif /* SUPPORT_JIT */
+
+/* ========================= End of JIT matching ========================== */
+
+
+/* Proceed with non-JIT matching. The default is to allow lookbehinds to the
+start of the subject. A UTF check when there is a non-zero offset may change
+this. */
+
+mb->check_subject = subject;
+
+/* If a UTF subject string was not checked for validity in the JIT code above,
+check it here, and handle support for invalid UTF strings. The check above
+happens only when invalid UTF is not supported and PCRE2_NO_CHECK_UTF is unset.
+If we get here in those circumstances, it means the subject string is valid,
+but for some reason JIT matching was not successful. There is no need to check
+the subject again.
+
+We check only the portion of the subject that might be be inspected during
+matching - from the offset minus the maximum lookbehind to the given length.
+This saves time when a small part of a large subject is being matched by the
+use of a starting offset. Note that the maximum lookbehind is a number of
+characters, not code units.
+
+Note also that support for invalid UTF forces a check, overriding the setting
+of PCRE2_NO_CHECK_UTF. */
+
+#ifdef SUPPORT_UNICODE
+if (utf &&
+#ifdef SUPPORT_JIT
+ !jit_checked_utf &&
+#endif
+ ((options & PCRE2_NO_UTF_CHECK) == 0 || allow_invalid))
+ {
+#if PCRE2_CODE_UNIT_WIDTH != 32
+ BOOL skipped_bad_start = FALSE;
+#endif
+
+ /* For 8-bit and 16-bit UTF, check that the first code unit is a valid
+ character start. If we are handling invalid UTF, just skip over such code
+ units. Otherwise, give an appropriate error. */
+
+#if PCRE2_CODE_UNIT_WIDTH != 32
+ if (allow_invalid)
+ {
+ while (start_match < end_subject && NOT_FIRSTCU(*start_match))
+ {
+ start_match++;
+ skipped_bad_start = TRUE;
+ }
+ }
+ else if (start_match < end_subject && NOT_FIRSTCU(*start_match))
+ {
+ if (start_offset > 0) return PCRE2_ERROR_BADUTFOFFSET;
+#if PCRE2_CODE_UNIT_WIDTH == 8
+ return PCRE2_ERROR_UTF8_ERR20; /* Isolated 0x80 byte */
+#else
+ return PCRE2_ERROR_UTF16_ERR3; /* Isolated low surrogate */
+#endif
+ }
+#endif /* WIDTH != 32 */
+
+ /* The mb->check_subject field points to the start of UTF checking;
+ lookbehinds can go back no further than this. */
+
+ mb->check_subject = start_match;
+
+ /* Move back by the maximum lookbehind, just in case it happens at the very
+ start of matching, but don't do this if we skipped bad 8-bit or 16-bit code
+ units above. */
+
+#if PCRE2_CODE_UNIT_WIDTH != 32
+ if (!skipped_bad_start)
+ {
+ unsigned int i;
+ for (i = re->max_lookbehind; i > 0 && mb->check_subject > subject; i--)
+ {
+ mb->check_subject--;
+ while (mb->check_subject > subject &&
+#if PCRE2_CODE_UNIT_WIDTH == 8
+ (*mb->check_subject & 0xc0) == 0x80)
+#else /* 16-bit */
+ (*mb->check_subject & 0xfc00) == 0xdc00)
+#endif
+ mb->check_subject--;
+ }
+ }
+#else /* PCRE2_CODE_UNIT_WIDTH != 32 */
+
+ /* In the 32-bit library, one code unit equals one character. However,
+ we cannot just subtract the lookbehind and then compare pointers, because
+ a very large lookbehind could create an invalid pointer. */
+
+ if (start_offset >= re->max_lookbehind)
+ mb->check_subject -= re->max_lookbehind;
+ else
+ mb->check_subject = subject;
+#endif /* PCRE2_CODE_UNIT_WIDTH != 32 */
+
+ /* Validate the relevant portion of the subject. There's a loop in case we
+ encounter bad UTF in the characters preceding start_match which we are
+ scanning because of a lookbehind. */
+
+ for (;;)
+ {
+ match_data->rc = PRIV(valid_utf)(mb->check_subject,
+ length - (mb->check_subject - subject), &(match_data->startchar));
+
+ if (match_data->rc == 0) break; /* Valid UTF string */
+
+ /* Invalid UTF string. Adjust the offset to be an absolute offset in the
+ whole string. If we are handling invalid UTF strings, set end_subject to
+ stop before the bad code unit, and set the options to "not end of line".
+ Otherwise return the error. */
+
+ match_data->startchar += mb->check_subject - subject;
+ if (!allow_invalid || match_data->rc > 0) return match_data->rc;
+ end_subject = subject + match_data->startchar;
+
+ /* If the end precedes start_match, it means there is invalid UTF in the
+ extra code units we reversed over because of a lookbehind. Advance past the
+ first bad code unit, and then skip invalid character starting code units in
+ 8-bit and 16-bit modes, and try again. */
+
+ if (end_subject < start_match)
+ {
+ mb->check_subject = end_subject + 1;
+#if PCRE2_CODE_UNIT_WIDTH != 32
+ while (mb->check_subject < start_match && NOT_FIRSTCU(*mb->check_subject))
+ mb->check_subject++;
#endif
+ }
+
+ /* Otherwise, set the not end of line option, and do the match. */
+
+ else
+ {
+ fragment_options = PCRE2_NOTEOL;
+ break;
+ }
+ }
+ }
+#endif /* SUPPORT_UNICODE */
-/* Carry on with non-JIT matching. A NULL match context means "use a default
-context", but we take the memory control functions from the pattern. */
+/* A NULL match context means "use a default context", but we take the memory
+control functions from the pattern. */
if (mcontext == NULL)
{
@@ -6224,8 +6440,8 @@ else mb->memctl = mcontext->memctl;
anchored = ((re->overall_options | options) & PCRE2_ANCHORED) != 0;
firstline = (re->overall_options & PCRE2_FIRSTLINE) != 0;
startline = (re->flags & PCRE2_STARTLINE) != 0;
-bumpalong_limit = (mcontext->offset_limit == PCRE2_UNSET)?
- end_subject : subject + mcontext->offset_limit;
+bumpalong_limit = (mcontext->offset_limit == PCRE2_UNSET)?
+ true_end_subject : subject + mcontext->offset_limit;
/* Initialize and set up the fixed fields in the callout block, with a pointer
in the match block. */
@@ -6236,7 +6452,8 @@ cb.subject = subject;
cb.subject_length = (PCRE2_SIZE)(end_subject - subject);
cb.callout_flags = 0;
-/* Fill in the remaining fields in the match block. */
+/* Fill in the remaining fields in the match block, except for moptions, which
+gets set later. */
mb->callout = mcontext->callout;
mb->callout_data = mcontext->callout_data;
@@ -6245,13 +6462,11 @@ mb->start_subject = subject;
mb->start_offset = start_offset;
mb->end_subject = end_subject;
mb->hasthen = (re->flags & PCRE2_HASTHEN) != 0;
-
-mb->moptions = options; /* Match options */
-mb->poptions = re->overall_options; /* Pattern options */
-
+mb->allowemptypartial = (re->max_lookbehind > 0) ||
+ (re->flags & PCRE2_MATCH_EMPTY) != 0;
+mb->poptions = re->overall_options; /* Pattern options */
mb->ignore_skip_arg = 0;
-mb->mark = mb->nomatch_mark = NULL; /* In case never set */
-mb->hitend = FALSE;
+mb->mark = mb->nomatch_mark = NULL; /* In case never set */
/* The name table is needed for finding all the numbers associated with a
given name, for condition testing. The code follows the name table. */
@@ -6404,6 +6619,13 @@ if ((re->flags & PCRE2_LASTSET) != 0)
/* Loop for handling unanchored repeated matching attempts; for anchored regexs
the loop runs just once. */
+#ifdef SUPPORT_UNICODE
+FRAGMENT_RESTART:
+#endif
+
+start_partial = match_partial = NULL;
+mb->hitend = FALSE;
+
for(;;)
{
PCRE2_SPTR new_start_match;
@@ -6473,7 +6695,10 @@ for(;;)
/* Not anchored. Advance to a unique first code unit if there is one. In
8-bit mode, the use of memchr() gives a big speed up, even though we have
to call it twice in caseless mode, in order to find the earliest occurrence
- of the character in either of its cases. */
+ of the character in either of its cases. If a call to memchr() that
+ searches the rest of the subject fails to find one case, remember that in
+ order not to keep on repeating the search. This can make a huge difference
+ when the strings are very long and only one case is present. */
else
{
@@ -6487,11 +6712,29 @@ for(;;)
(smc = UCHAR21TEST(start_match)) != first_cu &&
smc != first_cu2)
start_match++;
+
#else /* 8-bit code units */
- PCRE2_SPTR pp1 =
- memchr(start_match, first_cu, end_subject-start_match);
- PCRE2_SPTR pp2 =
- memchr(start_match, first_cu2, end_subject-start_match);
+ PCRE2_SPTR pp1 = NULL;
+ PCRE2_SPTR pp2 = NULL;
+ PCRE2_SIZE cu2size = end_subject - start_match;
+
+ if (!memchr_not_found_first_cu)
+ {
+ pp1 = memchr(start_match, first_cu, end_subject - start_match);
+ if (pp1 == NULL) memchr_not_found_first_cu = TRUE;
+ else cu2size = pp1 - start_match;
+ }
+
+ /* If pp1 is not NULL, we have arranged to search only as far as pp1,
+ to see if the other case is earlier, so we can set "not found" only
+ when both searches have returned NULL. */
+
+ if (!memchr_not_found_first_cu2)
+ {
+ pp2 = memchr(start_match, first_cu2, cu2size);
+ memchr_not_found_first_cu2 = (pp2 == NULL && pp1 == NULL);
+ }
+
if (pp1 == NULL)
start_match = (pp2 == NULL)? end_subject : pp2;
else
@@ -6523,7 +6766,7 @@ for(;;)
we also let the cycle run, because the matching string is legitimately
allowed to start with the first code unit of a newline. */
- if (!mb->partial && start_match >= mb->end_subject)
+ if (mb->partial == 0 && start_match >= mb->end_subject)
{
rc = MATCH_NOMATCH;
break;
@@ -6582,7 +6825,7 @@ for(;;)
/* See comment above in first_cu checking about the next few lines. */
- if (!mb->partial && start_match >= mb->end_subject)
+ if (mb->partial == 0 && start_match >= mb->end_subject)
{
rc = MATCH_NOMATCH;
break;
@@ -6596,8 +6839,10 @@ for(;;)
/* The following two optimizations must be disabled for partial matching. */
- if (!mb->partial)
+ if (mb->partial == 0)
{
+ PCRE2_SPTR p;
+
/* The minimum matching length is a lower bound; no string of that length
may actually match the pattern. Although the value is, strictly, in
characters, we treat it as code units to avoid spending too much time in
@@ -6621,60 +6866,57 @@ for(;;)
memchr() twice in the caseless case because we only need to check for the
presence of the character in either case, not find the first occurrence.
+ The search can be skipped if the code unit was found later than the
+ current starting point in a previous iteration of the bumpalong loop.
+
HOWEVER: when the subject string is very, very long, searching to its end
can take a long time, and give bad performance on quite ordinary
- patterns. This showed up when somebody was matching something like
- /^\d+C/ on a 32-megabyte string... so we don't do this when the string is
- sufficiently long. */
+ anchored patterns. This showed up when somebody was matching something
+ like /^\d+C/ on a 32-megabyte string... so we don't do this when the
+ string is sufficiently long, but it's worth searching a lot more for
+ unanchored patterns. */
- if (has_req_cu && end_subject - start_match < REQ_CU_MAX)
+ p = start_match + (has_first_cu? 1:0);
+ if (has_req_cu && p > req_cu_ptr)
{
- PCRE2_SPTR p = start_match + (has_first_cu? 1:0);
-
- /* We don't need to repeat the search if we haven't yet reached the
- place we found it last time round the bumpalong loop. */
+ PCRE2_SIZE check_length = end_subject - start_match;
- if (p > req_cu_ptr)
+ if (check_length < REQ_CU_MAX ||
+ (!anchored && check_length < REQ_CU_MAX * 1000))
{
- if (p < end_subject)
+ if (req_cu != req_cu2) /* Caseless */
{
- if (req_cu != req_cu2) /* Caseless */
- {
#if PCRE2_CODE_UNIT_WIDTH != 8
- do
- {
- uint32_t pp = UCHAR21INCTEST(p);
- if (pp == req_cu || pp == req_cu2) { p--; break; }
- }
- while (p < end_subject);
-
+ while (p < end_subject)
+ {
+ uint32_t pp = UCHAR21INCTEST(p);
+ if (pp == req_cu || pp == req_cu2) { p--; break; }
+ }
#else /* 8-bit code units */
- PCRE2_SPTR pp = p;
- p = memchr(pp, req_cu, end_subject - pp);
- if (p == NULL)
- {
- p = memchr(pp, req_cu2, end_subject - pp);
- if (p == NULL) p = end_subject;
- }
-#endif /* PCRE2_CODE_UNIT_WIDTH != 8 */
+ PCRE2_SPTR pp = p;
+ p = memchr(pp, req_cu, end_subject - pp);
+ if (p == NULL)
+ {
+ p = memchr(pp, req_cu2, end_subject - pp);
+ if (p == NULL) p = end_subject;
}
+#endif /* PCRE2_CODE_UNIT_WIDTH != 8 */
+ }
- /* The caseful case */
+ /* The caseful case */
- else
- {
+ else
+ {
#if PCRE2_CODE_UNIT_WIDTH != 8
- do
- {
- if (UCHAR21INCTEST(p) == req_cu) { p--; break; }
- }
- while (p < end_subject);
+ while (p < end_subject)
+ {
+ if (UCHAR21INCTEST(p) == req_cu) { p--; break; }
+ }
#else /* 8-bit code units */
- p = memchr(p, req_cu, end_subject - p);
- if (p == NULL) p = end_subject;
+ p = memchr(p, req_cu, end_subject - p);
+ if (p == NULL) p = end_subject;
#endif
- }
}
/* If we can't find the required code unit, break the bumpalong loop,
@@ -6714,6 +6956,11 @@ for(;;)
mb->start_used_ptr = start_match;
mb->last_used_ptr = start_match;
+#ifdef SUPPORT_UNICODE
+ mb->moptions = options | fragment_options;
+#else
+ mb->moptions = options;
+#endif
mb->match_call_count = 0;
mb->end_offset_top = 0;
mb->skip_arg_count = 0;
@@ -6839,6 +7086,68 @@ for(;;)
ENDLOOP:
+/* If end_subject != true_end_subject, it means we are handling invalid UTF,
+and have just processed a non-terminal fragment. If this resulted in no match
+or a partial match we must carry on to the next fragment (a partial match is
+returned to the caller only at the very end of the subject). A loop is used to
+avoid trying to match against empty fragments; if the pattern can match an
+empty string it would have done so already. */
+
+#ifdef SUPPORT_UNICODE
+if (utf && end_subject != true_end_subject &&
+ (rc == MATCH_NOMATCH || rc == PCRE2_ERROR_PARTIAL))
+ {
+ for (;;)
+ {
+ /* Advance past the first bad code unit, and then skip invalid character
+ starting code units in 8-bit and 16-bit modes. */
+
+ start_match = end_subject + 1;
+#if PCRE2_CODE_UNIT_WIDTH != 32
+ while (start_match < true_end_subject && NOT_FIRSTCU(*start_match))
+ start_match++;
+#endif
+
+ /* If we have hit the end of the subject, there isn't another non-empty
+ fragment, so give up. */
+
+ if (start_match >= true_end_subject)
+ {
+ rc = MATCH_NOMATCH; /* In case it was partial */
+ break;
+ }
+
+ /* Check the rest of the subject */
+
+ mb->check_subject = start_match;
+ rc = PRIV(valid_utf)(start_match, length - (start_match - subject),
+ &(match_data->startchar));
+
+ /* The rest of the subject is valid UTF. */
+
+ if (rc == 0)
+ {
+ mb->end_subject = end_subject = true_end_subject;
+ fragment_options = PCRE2_NOTBOL;
+ goto FRAGMENT_RESTART;
+ }
+
+ /* A subsequent UTF error has been found; if the next fragment is
+ non-empty, set up to process it. Otherwise, let the loop advance. */
+
+ else if (rc < 0)
+ {
+ mb->end_subject = end_subject = start_match + match_data->startchar;
+ if (end_subject > start_match)
+ {
+ fragment_options = PCRE2_NOTBOL|PCRE2_NOTEOL;
+ goto FRAGMENT_RESTART;
+ }
+ }
+ }
+ }
+#endif /* SUPPORT_UNICODE */
+
/* Release an enlarged frame vector that is on the heap. */
if (mb->match_frames != mb->stack_frames)
diff --git a/ext/pcre/pcre2lib/pcre2_match_data.c b/ext/pcre/pcre2lib/pcre2_match_data.c
index ccc5f6740e..53e4698707 100644
--- a/ext/pcre/pcre2lib/pcre2_match_data.c
+++ b/ext/pcre/pcre2lib/pcre2_match_data.c
@@ -7,7 +7,7 @@ and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
Original API code Copyright (c) 1997-2012 University of Cambridge
- New API code Copyright (c) 2016-2018 University of Cambridge
+ New API code Copyright (c) 2016-2019 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -150,4 +150,17 @@ pcre2_get_startchar(pcre2_match_data *match_data)
return match_data->startchar;
}
+
+
+/*************************************************
+* Get size of match data block *
+*************************************************/
+
+PCRE2_EXP_DEFN PCRE2_SIZE PCRE2_CALL_CONVENTION
+pcre2_get_match_data_size(pcre2_match_data *match_data)
+{
+return offsetof(pcre2_match_data, ovector) +
+ 2 * (match_data->oveccount) * sizeof(PCRE2_SIZE);
+}
+
/* End of pcre2_match_data.c */
diff --git a/ext/pcre/pcre2lib/pcre2_printint.c b/ext/pcre/pcre2lib/pcre2_printint.c
index b132d44f8c..b9bab025ab 100644
--- a/ext/pcre/pcre2lib/pcre2_printint.c
+++ b/ext/pcre/pcre2lib/pcre2_printint.c
@@ -392,6 +392,8 @@ for(;;)
case OP_ASSERT_NOT:
case OP_ASSERTBACK:
case OP_ASSERTBACK_NOT:
+ case OP_ASSERT_NA:
+ case OP_ASSERTBACK_NA:
case OP_ONCE:
case OP_SCRIPT_RUN:
case OP_COND:
diff --git a/ext/pcre/pcre2lib/pcre2_study.c b/ext/pcre/pcre2lib/pcre2_study.c
index e883c2eb4c..2883868618 100644
--- a/ext/pcre/pcre2lib/pcre2_study.c
+++ b/ext/pcre/pcre2lib/pcre2_study.c
@@ -88,11 +88,13 @@ Arguments:
countptr pointer to call count (to catch over complexity)
backref_cache vector for caching back references.
+This function is no longer called when the pattern contains (*ACCEPT); however,
+the old code for returning -1 is retained, just in case.
+
Returns: the minimum length
-1 \C in UTF-8 mode
or (*ACCEPT)
or pattern too complicated
- or back reference to duplicate name/number
-2 internal error (missing capturing bracket)
-3 internal error (opcode not listed)
*/
@@ -103,6 +105,7 @@ find_minlength(const pcre2_real_code *re, PCRE2_SPTR code,
int *backref_cache)
{
int length = -1;
+int branchlength = 0;
int prev_cap_recno = -1;
int prev_cap_d = 0;
int prev_recurse_recno = -1;
@@ -110,9 +113,9 @@ int prev_recurse_d = 0;
uint32_t once_fudge = 0;
BOOL had_recurse = FALSE;
BOOL dupcapused = (re->flags & PCRE2_DUPCAPUSED) != 0;
-recurse_check this_recurse;
-int branchlength = 0;
+PCRE2_SPTR nextbranch = code + GET(code, 1);
PCRE2_UCHAR *cc = (PCRE2_UCHAR *)code + 1 + LINK_SIZE;
+recurse_check this_recurse;
/* If this is a "could be empty" group, its minimum length is 0. */
@@ -128,16 +131,20 @@ if ((*countptr)++ > 1000) return -1;
/* Scan along the opcodes for this branch. If we get to the end of the branch,
check the length against that of the other branches. If the accumulated length
-passes 16-bits, stop. */
+passes 16-bits, reset to that value and skip the rest of the branch. */
for (;;)
{
int d, min, recno;
- PCRE2_UCHAR *cs, *ce;
- PCRE2_UCHAR op = *cc;
+ PCRE2_UCHAR op, *cs, *ce;
- if (branchlength >= UINT16_MAX) return UINT16_MAX;
+ if (branchlength >= UINT16_MAX)
+ {
+ branchlength = UINT16_MAX;
+ cc = (PCRE2_UCHAR *)nextbranch;
+ }
+ op = *cc;
switch (op)
{
case OP_COND:
@@ -206,7 +213,9 @@ for (;;)
cc += 1 + LINK_SIZE;
break;
- /* ACCEPT makes things far too complicated; we have to give up. */
+ /* ACCEPT makes things far too complicated; we have to give up. In fact,
+ from 10.34 onwards, if a pattern contains (*ACCEPT), this function is not
+ used. However, leave the code in place, just in case. */
case OP_ACCEPT:
case OP_ASSERT_ACCEPT:
@@ -214,9 +223,9 @@ for (;;)
/* Reached end of a branch; if it's a ket it is the end of a nested
call. If it's ALT it is an alternation in a nested call. If it is END it's
- the end of the outer call. All can be handled by the same code. If an
- ACCEPT was previously encountered, use the length that was in force at that
- time, and pass back the shortest ACCEPT length. */
+ the end of the outer call. All can be handled by the same code. If the
+ length of any branch is zero, there is no need to scan any subsequent
+ branches. */
case OP_ALT:
case OP_KET:
@@ -226,7 +235,8 @@ for (;;)
case OP_END:
if (length < 0 || (!had_recurse && branchlength < length))
length = branchlength;
- if (op != OP_ALT) return length;
+ if (op != OP_ALT || length == 0) return length;
+ nextbranch = cc + GET(cc, 1);
cc += 1 + LINK_SIZE;
branchlength = 0;
had_recurse = FALSE;
@@ -238,6 +248,8 @@ for (;;)
case OP_ASSERT_NOT:
case OP_ASSERTBACK:
case OP_ASSERTBACK_NOT:
+ case OP_ASSERT_NA:
+ case OP_ASSERTBACK_NA:
do cc += GET(cc, 1); while (*cc == OP_ALT);
/* Fall through */
@@ -451,15 +463,17 @@ for (;;)
If PCRE2_MATCH_UNSET_BACKREF is set, a backreference to an unset bracket
matches an empty string (by default it causes a matching failure), so in
- that case we must set the minimum length to zero. */
+ that case we must set the minimum length to zero.
+
+ For backreferenes, if duplicate numbers are present in the pattern we check
+ for a reference to a duplicate. If it is, we don't know which version will
+ be referenced, so we have to set the minimum length to zero. */
- /* Duplicate named pattern back reference. We cannot reliably find a length
- for this if duplicate numbers are present in the pattern. */
+ /* Duplicate named pattern back reference. */
case OP_DNREF:
case OP_DNREFI:
- if (dupcapused) return -1;
- if ((re->overall_options & PCRE2_MATCH_UNSET_BACKREF) == 0)
+ if (!dupcapused && (re->overall_options & PCRE2_MATCH_UNSET_BACKREF) == 0)
{
int count = GET2(cc, 1+IMM2_SIZE);
PCRE2_UCHAR *slot =
@@ -482,28 +496,32 @@ for (;;)
ce = cs = (PCRE2_UCHAR *)PRIV(find_bracket)(startcode, utf, recno);
if (cs == NULL) return -2;
do ce += GET(ce, 1); while (*ce == OP_ALT);
- if (cc > cs && cc < ce) /* Simple recursion */
- {
- dd = 0;
- had_recurse = TRUE;
- }
- else
+
+ dd = 0;
+ if (!dupcapused ||
+ (PCRE2_UCHAR *)PRIV(find_bracket)(ce, utf, recno) == NULL)
{
- recurse_check *r = recurses;
- for (r = recurses; r != NULL; r = r->prev)
- if (r->group == cs) break;
- if (r != NULL) /* Mutual recursion */
+ if (cc > cs && cc < ce) /* Simple recursion */
{
- dd = 0;
had_recurse = TRUE;
}
else
{
- this_recurse.prev = recurses;
- this_recurse.group = cs;
- dd = find_minlength(re, cs, startcode, utf, &this_recurse,
- countptr, backref_cache);
- if (dd < 0) return dd;
+ recurse_check *r = recurses;
+ for (r = recurses; r != NULL; r = r->prev)
+ if (r->group == cs) break;
+ if (r != NULL) /* Mutual recursion */
+ {
+ had_recurse = TRUE;
+ }
+ else
+ {
+ this_recurse.prev = recurses; /* No recursion */
+ this_recurse.group = cs;
+ dd = find_minlength(re, cs, startcode, utf, &this_recurse,
+ countptr, backref_cache);
+ if (dd < 0) return dd;
+ }
}
}
@@ -521,48 +539,51 @@ for (;;)
cc += 1 + 2*IMM2_SIZE;
goto REPEAT_BACK_REFERENCE;
- /* Single back reference. We cannot find a length for this if duplicate
- numbers are present in the pattern. */
+ /* Single back reference by number. References by name are converted to by
+ number when there is no duplication. */
case OP_REF:
case OP_REFI:
- if (dupcapused) return -1;
recno = GET2(cc, 1);
if (recno <= backref_cache[0] && backref_cache[recno] >= 0)
d = backref_cache[recno];
else
{
int i;
+ d = 0;
+
if ((re->overall_options & PCRE2_MATCH_UNSET_BACKREF) == 0)
{
ce = cs = (PCRE2_UCHAR *)PRIV(find_bracket)(startcode, utf, recno);
if (cs == NULL) return -2;
do ce += GET(ce, 1); while (*ce == OP_ALT);
- if (cc > cs && cc < ce) /* Simple recursion */
- {
- d = 0;
- had_recurse = TRUE;
- }
- else
+
+ if (!dupcapused ||
+ (PCRE2_UCHAR *)PRIV(find_bracket)(ce, utf, recno) == NULL)
{
- recurse_check *r = recurses;
- for (r = recurses; r != NULL; r = r->prev) if (r->group == cs) break;
- if (r != NULL) /* Mutual recursion */
+ if (cc > cs && cc < ce) /* Simple recursion */
{
- d = 0;
had_recurse = TRUE;
}
else
{
- this_recurse.prev = recurses;
- this_recurse.group = cs;
- d = find_minlength(re, cs, startcode, utf, &this_recurse, countptr,
- backref_cache);
- if (d < 0) return d;
+ recurse_check *r = recurses;
+ for (r = recurses; r != NULL; r = r->prev) if (r->group == cs) break;
+ if (r != NULL) /* Mutual recursion */
+ {
+ had_recurse = TRUE;
+ }
+ else /* No recursion */
+ {
+ this_recurse.prev = recurses;
+ this_recurse.group = cs;
+ d = find_minlength(re, cs, startcode, utf, &this_recurse, countptr,
+ backref_cache);
+ if (d < 0) return d;
+ }
}
}
}
- else d = 0;
backref_cache[recno] = d;
for (i = backref_cache[0] + 1; i < recno; i++) backref_cache[i] = -1;
@@ -888,7 +909,7 @@ if (table_limit != 32) for (c = 24; c < 32; c++) re->start_bitmap[c] = 0xff;
/*************************************************
-* Create bitmap of starting bytes *
+* Create bitmap of starting code units *
*************************************************/
/* This function scans a compiled unanchored expression recursively and
@@ -938,6 +959,9 @@ do
{
int rc;
uint8_t *classmap = NULL;
+#ifdef SUPPORT_WIDE_CHARS
+ PCRE2_UCHAR xclassflags;
+#endif
switch(*tcode)
{
@@ -1078,6 +1102,7 @@ do
case OP_ONCE:
case OP_SCRIPT_RUN:
case OP_ASSERT:
+ case OP_ASSERT_NA:
rc = set_start_bits(re, tcode, utf);
if (rc == SSB_FAIL || rc == SSB_UNKNOWN) return rc;
if (rc == SSB_DONE) try_next = FALSE; else
@@ -1120,6 +1145,7 @@ do
case OP_ASSERT_NOT:
case OP_ASSERTBACK:
case OP_ASSERTBACK_NOT:
+ case OP_ASSERTBACK_NA:
do tcode += GET(tcode, 1); while (*tcode == OP_ALT);
tcode += 1 + LINK_SIZE;
break;
@@ -1444,20 +1470,59 @@ do
negative XCLASS without a map, give up. If there are no property checks,
there must be wide characters on the XCLASS list, because otherwise an
XCLASS would not have been created. This means that code points >= 255
- are always potential starters. */
+ are potential starters. In the UTF-8 case we can scan them and set bits
+ for the relevant leading bytes. */
#ifdef SUPPORT_WIDE_CHARS
case OP_XCLASS:
- if ((tcode[1 + LINK_SIZE] & XCL_HASPROP) != 0 ||
- (tcode[1 + LINK_SIZE] & (XCL_MAP|XCL_NOT)) == XCL_NOT)
+ xclassflags = tcode[1 + LINK_SIZE];
+ if ((xclassflags & XCL_HASPROP) != 0 ||
+ (xclassflags & (XCL_MAP|XCL_NOT)) == XCL_NOT)
return SSB_FAIL;
/* We have a positive XCLASS or a negative one without a map. Set up the
map pointer if there is one, and fall through. */
- classmap = ((tcode[1 + LINK_SIZE] & XCL_MAP) == 0)? NULL :
+ classmap = ((xclassflags & XCL_MAP) == 0)? NULL :
(uint8_t *)(tcode + 1 + LINK_SIZE + 1);
-#endif
+
+ /* In UTF-8 mode, scan the character list and set bits for leading bytes,
+ then jump to handle the map. */
+
+#if PCRE2_CODE_UNIT_WIDTH == 8
+ if (utf && (xclassflags & XCL_NOT) == 0)
+ {
+ PCRE2_UCHAR b, e;
+ PCRE2_SPTR p = tcode + 1 + LINK_SIZE + 1 + ((classmap == NULL)? 0:32);
+ tcode += GET(tcode, 1);
+
+ for (;;) switch (*p++)
+ {
+ case XCL_SINGLE:
+ b = *p++;
+ while ((*p & 0xc0) == 0x80) p++;
+ re->start_bitmap[b/8] |= (1u << (b&7));
+ break;
+
+ case XCL_RANGE:
+ b = *p++;
+ while ((*p & 0xc0) == 0x80) p++;
+ e = *p++;
+ while ((*p & 0xc0) == 0x80) p++;
+ for (; b <= e; b++)
+ re->start_bitmap[b/8] |= (1u << (b&7));
+ break;
+
+ case XCL_END:
+ goto HANDLE_CLASSMAP;
+
+ default:
+ return SSB_UNKNOWN; /* Internal error, should not occur */
+ }
+ }
+#endif /* SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH == 8 */
+#endif /* SUPPORT_WIDE_CHARS */
+
/* It seems that the fall through comment must be outside the #ifdef if
it is to avoid the gcc compiler warning. */
@@ -1499,6 +1564,9 @@ do
greater than 127. In fact, there are only two possible starting bytes for
characters in the range 128 - 255. */
+#if defined SUPPORT_WIDE_CHARS && PCRE2_CODE_UNIT_WIDTH == 8
+ HANDLE_CLASSMAP:
+#endif
if (classmap != NULL)
{
#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH == 8
@@ -1569,7 +1637,9 @@ return yield;
/* This function is handed a compiled expression that it must study to produce
information that will speed up the matching.
-Argument: points to the compiled expression
+Argument:
+ re points to the compiled expression
+
Returns: 0 normally; non-zero should never normally occur
1 unknown opcode in set_start_bits
2 missing capturing bracket
@@ -1579,7 +1649,6 @@ Returns: 0 normally; non-zero should never normally occur
int
PRIV(study)(pcre2_real_code *re)
{
-int min;
int count = 0;
PCRE2_UCHAR *code;
BOOL utf = (re->overall_options & PCRE2_UTF) != 0;
@@ -1597,25 +1666,121 @@ if ((re->flags & (PCRE2_FIRSTSET|PCRE2_STARTLINE)) == 0)
{
int rc = set_start_bits(re, code, utf);
if (rc == SSB_UNKNOWN) return 1;
- if (rc == SSB_DONE) re->flags |= PCRE2_FIRSTMAPSET;
+
+ /* If a list of starting code units was set up, scan the list to see if only
+ one or two were listed. Having only one listed is rare because usually a
+ single starting code unit will have been recognized and PCRE2_FIRSTSET set.
+ If two are listed, see if they are caseless versions of the same character;
+ if so we can replace the list with a caseless first code unit. This gives
+ better performance and is plausibly worth doing for patterns such as [Ww]ord
+ or (word|WORD). */
+
+ if (rc == SSB_DONE)
+ {
+ int i;
+ int a = -1;
+ int b = -1;
+ uint8_t *p = re->start_bitmap;
+ uint32_t flags = PCRE2_FIRSTMAPSET;
+
+ for (i = 0; i < 256; p++, i += 8)
+ {
+ uint8_t x = *p;
+ if (x != 0)
+ {
+ int c;
+ uint8_t y = x & (~x + 1); /* Least significant bit */
+ if (y != x) goto DONE; /* More than one bit set */
+
+ /* In the 16-bit and 32-bit libraries, the bit for 0xff means "0xff and
+ all wide characters", so we cannot use it here. */
+
+#if PCRE2_CODE_UNIT_WIDTH != 8
+ if (i == 248 && x == 0x80) goto DONE;
+#endif
+
+ /* Compute the character value */
+
+ c = i;
+ switch (x)
+ {
+ case 1: break;
+ case 2: c += 1; break; case 4: c += 2; break;
+ case 8: c += 3; break; case 16: c += 4; break;
+ case 32: c += 5; break; case 64: c += 6; break;
+ case 128: c += 7; break;
+ }
+
+ /* c contains the code unit value, in the range 0-255. In 8-bit UTF
+ mode, only values < 128 can be used. */
+
+#if PCRE2_CODE_UNIT_WIDTH == 8
+ if (c > 127) goto DONE;
+#endif
+ if (a < 0) a = c; /* First one found */
+ else if (b < 0) /* Second one found */
+ {
+ int d = TABLE_GET((unsigned int)c, re->tables + fcc_offset, c);
+
+#ifdef SUPPORT_UNICODE
+#if PCRE2_CODE_UNIT_WIDTH == 8
+ if (utf && UCD_CASESET(c) != 0) goto DONE; /* Multiple case set */
+#else /* 16-bit or 32-bit */
+ if (UCD_CASESET(c) != 0) goto DONE; /* Multiple case set */
+ if (utf && c > 127) d = UCD_OTHERCASE(c);
+#endif /* Code width */
+#endif /* SUPPORT_UNICODE */
+
+ if (d != a) goto DONE; /* Not other case of a */
+ b = c;
+ }
+ else goto DONE; /* More than two characters found */
+ }
+ }
+
+ /* Replace the start code unit bits with a first code unit, but only if it
+ is not the same as a required later code unit. This is because a search for
+ a required code unit starts after an explicit first code unit, but at a
+ code unit found from the bitmap. Patterns such as /a*a/ don't work
+ if both the start unit and required unit are the same. */
+
+ if (a >= 0 &&
+ (
+ (re->flags & PCRE2_LASTSET) == 0 ||
+ (
+ re->last_codeunit != (uint32_t)a &&
+ (b < 0 || re->last_codeunit != (uint32_t)b)
+ )
+ ))
+ {
+ re->first_codeunit = a;
+ flags = PCRE2_FIRSTSET;
+ if (b >= 0) flags |= PCRE2_FIRSTCASELESS;
+ }
+
+ DONE:
+ re->flags |= flags;
+ }
}
/* Find the minimum length of subject string. If the pattern can match an empty
-string, the minimum length is already known. If there are more back references
-than the size of the vector we are going to cache them in, do nothing. A
-pattern that complicated will probably take a long time to analyze and may in
-any case turn out to be too complicated. Note that back reference minima are
-held as 16-bit numbers. */
-
-if ((re->flags & PCRE2_MATCH_EMPTY) == 0 &&
+string, the minimum length is already known. If the pattern contains (*ACCEPT)
+all bets are off, and we don't even try to find a minimum length. If there are
+more back references than the size of the vector we are going to cache them in,
+do nothing. A pattern that complicated will probably take a long time to
+analyze and may in any case turn out to be too complicated. Note that back
+reference minima are held as 16-bit numbers. */
+
+if ((re->flags & (PCRE2_MATCH_EMPTY|PCRE2_HASACCEPT)) == 0 &&
re->top_backref <= MAX_CACHE_BACKREF)
{
+ int min;
int backref_cache[MAX_CACHE_BACKREF+1];
backref_cache[0] = 0; /* Highest one that is set */
min = find_minlength(re, code, code, utf, NULL, &count, backref_cache);
switch(min)
{
- case -1: /* \C in UTF mode or (*ACCEPT) or over-complex regex */
+ case -1: /* \C in UTF mode or over-complex regex */
break; /* Leave minlength unchanged (will be zero) */
case -2:
@@ -1625,8 +1790,7 @@ if ((re->flags & PCRE2_MATCH_EMPTY) == 0 &&
return 3; /* unrecognized opcode */
default:
- if (min > UINT16_MAX) min = UINT16_MAX;
- re->minlength = min;
+ re->minlength = (min > UINT16_MAX)? UINT16_MAX : min;
break;
}
}
diff --git a/ext/pcre/pcre2lib/pcre2_tables.c b/ext/pcre/pcre2lib/pcre2_tables.c
index 84019361fc..25531d98c6 100644
--- a/ext/pcre/pcre2lib/pcre2_tables.c
+++ b/ext/pcre/pcre2lib/pcre2_tables.c
@@ -279,6 +279,7 @@ strings to make sure that UTF-8 support works on EBCDIC platforms. */
#define STRING_Duployan0 STR_D STR_u STR_p STR_l STR_o STR_y STR_a STR_n "\0"
#define STRING_Egyptian_Hieroglyphs0 STR_E STR_g STR_y STR_p STR_t STR_i STR_a STR_n STR_UNDERSCORE STR_H STR_i STR_e STR_r STR_o STR_g STR_l STR_y STR_p STR_h STR_s "\0"
#define STRING_Elbasan0 STR_E STR_l STR_b STR_a STR_s STR_a STR_n "\0"
+#define STRING_Elymaic0 STR_E STR_l STR_y STR_m STR_a STR_i STR_c "\0"
#define STRING_Ethiopic0 STR_E STR_t STR_h STR_i STR_o STR_p STR_i STR_c "\0"
#define STRING_Georgian0 STR_G STR_e STR_o STR_r STR_g STR_i STR_a STR_n "\0"
#define STRING_Glagolitic0 STR_G STR_l STR_a STR_g STR_o STR_l STR_i STR_t STR_i STR_c "\0"
@@ -348,6 +349,7 @@ strings to make sure that UTF-8 support works on EBCDIC platforms. */
#define STRING_Myanmar0 STR_M STR_y STR_a STR_n STR_m STR_a STR_r "\0"
#define STRING_N0 STR_N "\0"
#define STRING_Nabataean0 STR_N STR_a STR_b STR_a STR_t STR_a STR_e STR_a STR_n "\0"
+#define STRING_Nandinagari0 STR_N STR_a STR_n STR_d STR_i STR_n STR_a STR_g STR_a STR_r STR_i "\0"
#define STRING_Nd0 STR_N STR_d "\0"
#define STRING_New_Tai_Lue0 STR_N STR_e STR_w STR_UNDERSCORE STR_T STR_a STR_i STR_UNDERSCORE STR_L STR_u STR_e "\0"
#define STRING_Newa0 STR_N STR_e STR_w STR_a "\0"
@@ -355,6 +357,7 @@ strings to make sure that UTF-8 support works on EBCDIC platforms. */
#define STRING_Nl0 STR_N STR_l "\0"
#define STRING_No0 STR_N STR_o "\0"
#define STRING_Nushu0 STR_N STR_u STR_s STR_h STR_u "\0"
+#define STRING_Nyiakeng_Puachue_Hmong0 STR_N STR_y STR_i STR_a STR_k STR_e STR_n STR_g STR_UNDERSCORE STR_P STR_u STR_a STR_c STR_h STR_u STR_e STR_UNDERSCORE STR_H STR_m STR_o STR_n STR_g "\0"
#define STRING_Ogham0 STR_O STR_g STR_h STR_a STR_m "\0"
#define STRING_Ol_Chiki0 STR_O STR_l STR_UNDERSCORE STR_C STR_h STR_i STR_k STR_i "\0"
#define STRING_Old_Hungarian0 STR_O STR_l STR_d STR_UNDERSCORE STR_H STR_u STR_n STR_g STR_a STR_r STR_i STR_a STR_n "\0"
@@ -419,6 +422,7 @@ strings to make sure that UTF-8 support works on EBCDIC platforms. */
#define STRING_Ugaritic0 STR_U STR_g STR_a STR_r STR_i STR_t STR_i STR_c "\0"
#define STRING_Unknown0 STR_U STR_n STR_k STR_n STR_o STR_w STR_n "\0"
#define STRING_Vai0 STR_V STR_a STR_i "\0"
+#define STRING_Wancho0 STR_W STR_a STR_n STR_c STR_h STR_o "\0"
#define STRING_Warang_Citi0 STR_W STR_a STR_r STR_a STR_n STR_g STR_UNDERSCORE STR_C STR_i STR_t STR_i "\0"
#define STRING_Xan0 STR_X STR_a STR_n "\0"
#define STRING_Xps0 STR_X STR_p STR_s "\0"
@@ -474,6 +478,7 @@ const char PRIV(utt_names)[] =
STRING_Duployan0
STRING_Egyptian_Hieroglyphs0
STRING_Elbasan0
+ STRING_Elymaic0
STRING_Ethiopic0
STRING_Georgian0
STRING_Glagolitic0
@@ -543,6 +548,7 @@ const char PRIV(utt_names)[] =
STRING_Myanmar0
STRING_N0
STRING_Nabataean0
+ STRING_Nandinagari0
STRING_Nd0
STRING_New_Tai_Lue0
STRING_Newa0
@@ -550,6 +556,7 @@ const char PRIV(utt_names)[] =
STRING_Nl0
STRING_No0
STRING_Nushu0
+ STRING_Nyiakeng_Puachue_Hmong0
STRING_Ogham0
STRING_Ol_Chiki0
STRING_Old_Hungarian0
@@ -614,6 +621,7 @@ const char PRIV(utt_names)[] =
STRING_Ugaritic0
STRING_Unknown0
STRING_Vai0
+ STRING_Wancho0
STRING_Warang_Citi0
STRING_Xan0
STRING_Xps0
@@ -669,158 +677,162 @@ const ucp_type_table PRIV(utt)[] = {
{ 299, PT_SC, ucp_Duployan },
{ 308, PT_SC, ucp_Egyptian_Hieroglyphs },
{ 329, PT_SC, ucp_Elbasan },
- { 337, PT_SC, ucp_Ethiopic },
- { 346, PT_SC, ucp_Georgian },
- { 355, PT_SC, ucp_Glagolitic },
- { 366, PT_SC, ucp_Gothic },
- { 373, PT_SC, ucp_Grantha },
- { 381, PT_SC, ucp_Greek },
- { 387, PT_SC, ucp_Gujarati },
- { 396, PT_SC, ucp_Gunjala_Gondi },
- { 410, PT_SC, ucp_Gurmukhi },
- { 419, PT_SC, ucp_Han },
- { 423, PT_SC, ucp_Hangul },
- { 430, PT_SC, ucp_Hanifi_Rohingya },
- { 446, PT_SC, ucp_Hanunoo },
- { 454, PT_SC, ucp_Hatran },
- { 461, PT_SC, ucp_Hebrew },
- { 468, PT_SC, ucp_Hiragana },
- { 477, PT_SC, ucp_Imperial_Aramaic },
- { 494, PT_SC, ucp_Inherited },
- { 504, PT_SC, ucp_Inscriptional_Pahlavi },
- { 526, PT_SC, ucp_Inscriptional_Parthian },
- { 549, PT_SC, ucp_Javanese },
- { 558, PT_SC, ucp_Kaithi },
- { 565, PT_SC, ucp_Kannada },
- { 573, PT_SC, ucp_Katakana },
- { 582, PT_SC, ucp_Kayah_Li },
- { 591, PT_SC, ucp_Kharoshthi },
- { 602, PT_SC, ucp_Khmer },
- { 608, PT_SC, ucp_Khojki },
- { 615, PT_SC, ucp_Khudawadi },
- { 625, PT_GC, ucp_L },
- { 627, PT_LAMP, 0 },
- { 630, PT_SC, ucp_Lao },
- { 634, PT_SC, ucp_Latin },
- { 640, PT_SC, ucp_Lepcha },
- { 647, PT_SC, ucp_Limbu },
- { 653, PT_SC, ucp_Linear_A },
- { 662, PT_SC, ucp_Linear_B },
- { 671, PT_SC, ucp_Lisu },
- { 676, PT_PC, ucp_Ll },
- { 679, PT_PC, ucp_Lm },
- { 682, PT_PC, ucp_Lo },
- { 685, PT_PC, ucp_Lt },
- { 688, PT_PC, ucp_Lu },
- { 691, PT_SC, ucp_Lycian },
- { 698, PT_SC, ucp_Lydian },
- { 705, PT_GC, ucp_M },
- { 707, PT_SC, ucp_Mahajani },
- { 716, PT_SC, ucp_Makasar },
- { 724, PT_SC, ucp_Malayalam },
- { 734, PT_SC, ucp_Mandaic },
- { 742, PT_SC, ucp_Manichaean },
- { 753, PT_SC, ucp_Marchen },
- { 761, PT_SC, ucp_Masaram_Gondi },
- { 775, PT_PC, ucp_Mc },
- { 778, PT_PC, ucp_Me },
- { 781, PT_SC, ucp_Medefaidrin },
- { 793, PT_SC, ucp_Meetei_Mayek },
- { 806, PT_SC, ucp_Mende_Kikakui },
- { 820, PT_SC, ucp_Meroitic_Cursive },
- { 837, PT_SC, ucp_Meroitic_Hieroglyphs },
- { 858, PT_SC, ucp_Miao },
- { 863, PT_PC, ucp_Mn },
- { 866, PT_SC, ucp_Modi },
- { 871, PT_SC, ucp_Mongolian },
- { 881, PT_SC, ucp_Mro },
- { 885, PT_SC, ucp_Multani },
- { 893, PT_SC, ucp_Myanmar },
- { 901, PT_GC, ucp_N },
- { 903, PT_SC, ucp_Nabataean },
- { 913, PT_PC, ucp_Nd },
- { 916, PT_SC, ucp_New_Tai_Lue },
- { 928, PT_SC, ucp_Newa },
- { 933, PT_SC, ucp_Nko },
- { 937, PT_PC, ucp_Nl },
- { 940, PT_PC, ucp_No },
- { 943, PT_SC, ucp_Nushu },
- { 949, PT_SC, ucp_Ogham },
- { 955, PT_SC, ucp_Ol_Chiki },
- { 964, PT_SC, ucp_Old_Hungarian },
- { 978, PT_SC, ucp_Old_Italic },
- { 989, PT_SC, ucp_Old_North_Arabian },
- { 1007, PT_SC, ucp_Old_Permic },
- { 1018, PT_SC, ucp_Old_Persian },
- { 1030, PT_SC, ucp_Old_Sogdian },
- { 1042, PT_SC, ucp_Old_South_Arabian },
- { 1060, PT_SC, ucp_Old_Turkic },
- { 1071, PT_SC, ucp_Oriya },
- { 1077, PT_SC, ucp_Osage },
- { 1083, PT_SC, ucp_Osmanya },
- { 1091, PT_GC, ucp_P },
- { 1093, PT_SC, ucp_Pahawh_Hmong },
- { 1106, PT_SC, ucp_Palmyrene },
- { 1116, PT_SC, ucp_Pau_Cin_Hau },
- { 1128, PT_PC, ucp_Pc },
- { 1131, PT_PC, ucp_Pd },
- { 1134, PT_PC, ucp_Pe },
- { 1137, PT_PC, ucp_Pf },
- { 1140, PT_SC, ucp_Phags_Pa },
- { 1149, PT_SC, ucp_Phoenician },
- { 1160, PT_PC, ucp_Pi },
- { 1163, PT_PC, ucp_Po },
- { 1166, PT_PC, ucp_Ps },
- { 1169, PT_SC, ucp_Psalter_Pahlavi },
- { 1185, PT_SC, ucp_Rejang },
- { 1192, PT_SC, ucp_Runic },
- { 1198, PT_GC, ucp_S },
- { 1200, PT_SC, ucp_Samaritan },
- { 1210, PT_SC, ucp_Saurashtra },
- { 1221, PT_PC, ucp_Sc },
- { 1224, PT_SC, ucp_Sharada },
- { 1232, PT_SC, ucp_Shavian },
- { 1240, PT_SC, ucp_Siddham },
- { 1248, PT_SC, ucp_SignWriting },
- { 1260, PT_SC, ucp_Sinhala },
- { 1268, PT_PC, ucp_Sk },
- { 1271, PT_PC, ucp_Sm },
- { 1274, PT_PC, ucp_So },
- { 1277, PT_SC, ucp_Sogdian },
- { 1285, PT_SC, ucp_Sora_Sompeng },
- { 1298, PT_SC, ucp_Soyombo },
- { 1306, PT_SC, ucp_Sundanese },
- { 1316, PT_SC, ucp_Syloti_Nagri },
- { 1329, PT_SC, ucp_Syriac },
- { 1336, PT_SC, ucp_Tagalog },
- { 1344, PT_SC, ucp_Tagbanwa },
- { 1353, PT_SC, ucp_Tai_Le },
- { 1360, PT_SC, ucp_Tai_Tham },
- { 1369, PT_SC, ucp_Tai_Viet },
- { 1378, PT_SC, ucp_Takri },
- { 1384, PT_SC, ucp_Tamil },
- { 1390, PT_SC, ucp_Tangut },
- { 1397, PT_SC, ucp_Telugu },
- { 1404, PT_SC, ucp_Thaana },
- { 1411, PT_SC, ucp_Thai },
- { 1416, PT_SC, ucp_Tibetan },
- { 1424, PT_SC, ucp_Tifinagh },
- { 1433, PT_SC, ucp_Tirhuta },
- { 1441, PT_SC, ucp_Ugaritic },
- { 1450, PT_SC, ucp_Unknown },
- { 1458, PT_SC, ucp_Vai },
- { 1462, PT_SC, ucp_Warang_Citi },
- { 1474, PT_ALNUM, 0 },
- { 1478, PT_PXSPACE, 0 },
- { 1482, PT_SPACE, 0 },
- { 1486, PT_UCNC, 0 },
- { 1490, PT_WORD, 0 },
- { 1494, PT_SC, ucp_Yi },
- { 1497, PT_GC, ucp_Z },
- { 1499, PT_SC, ucp_Zanabazar_Square },
- { 1516, PT_PC, ucp_Zl },
- { 1519, PT_PC, ucp_Zp },
- { 1522, PT_PC, ucp_Zs }
+ { 337, PT_SC, ucp_Elymaic },
+ { 345, PT_SC, ucp_Ethiopic },
+ { 354, PT_SC, ucp_Georgian },
+ { 363, PT_SC, ucp_Glagolitic },
+ { 374, PT_SC, ucp_Gothic },
+ { 381, PT_SC, ucp_Grantha },
+ { 389, PT_SC, ucp_Greek },
+ { 395, PT_SC, ucp_Gujarati },
+ { 404, PT_SC, ucp_Gunjala_Gondi },
+ { 418, PT_SC, ucp_Gurmukhi },
+ { 427, PT_SC, ucp_Han },
+ { 431, PT_SC, ucp_Hangul },
+ { 438, PT_SC, ucp_Hanifi_Rohingya },
+ { 454, PT_SC, ucp_Hanunoo },
+ { 462, PT_SC, ucp_Hatran },
+ { 469, PT_SC, ucp_Hebrew },
+ { 476, PT_SC, ucp_Hiragana },
+ { 485, PT_SC, ucp_Imperial_Aramaic },
+ { 502, PT_SC, ucp_Inherited },
+ { 512, PT_SC, ucp_Inscriptional_Pahlavi },
+ { 534, PT_SC, ucp_Inscriptional_Parthian },
+ { 557, PT_SC, ucp_Javanese },
+ { 566, PT_SC, ucp_Kaithi },
+ { 573, PT_SC, ucp_Kannada },
+ { 581, PT_SC, ucp_Katakana },
+ { 590, PT_SC, ucp_Kayah_Li },
+ { 599, PT_SC, ucp_Kharoshthi },
+ { 610, PT_SC, ucp_Khmer },
+ { 616, PT_SC, ucp_Khojki },
+ { 623, PT_SC, ucp_Khudawadi },
+ { 633, PT_GC, ucp_L },
+ { 635, PT_LAMP, 0 },
+ { 638, PT_SC, ucp_Lao },
+ { 642, PT_SC, ucp_Latin },
+ { 648, PT_SC, ucp_Lepcha },
+ { 655, PT_SC, ucp_Limbu },
+ { 661, PT_SC, ucp_Linear_A },
+ { 670, PT_SC, ucp_Linear_B },
+ { 679, PT_SC, ucp_Lisu },
+ { 684, PT_PC, ucp_Ll },
+ { 687, PT_PC, ucp_Lm },
+ { 690, PT_PC, ucp_Lo },
+ { 693, PT_PC, ucp_Lt },
+ { 696, PT_PC, ucp_Lu },
+ { 699, PT_SC, ucp_Lycian },
+ { 706, PT_SC, ucp_Lydian },
+ { 713, PT_GC, ucp_M },
+ { 715, PT_SC, ucp_Mahajani },
+ { 724, PT_SC, ucp_Makasar },
+ { 732, PT_SC, ucp_Malayalam },
+ { 742, PT_SC, ucp_Mandaic },
+ { 750, PT_SC, ucp_Manichaean },
+ { 761, PT_SC, ucp_Marchen },
+ { 769, PT_SC, ucp_Masaram_Gondi },
+ { 783, PT_PC, ucp_Mc },
+ { 786, PT_PC, ucp_Me },
+ { 789, PT_SC, ucp_Medefaidrin },
+ { 801, PT_SC, ucp_Meetei_Mayek },
+ { 814, PT_SC, ucp_Mende_Kikakui },
+ { 828, PT_SC, ucp_Meroitic_Cursive },
+ { 845, PT_SC, ucp_Meroitic_Hieroglyphs },
+ { 866, PT_SC, ucp_Miao },
+ { 871, PT_PC, ucp_Mn },
+ { 874, PT_SC, ucp_Modi },
+ { 879, PT_SC, ucp_Mongolian },
+ { 889, PT_SC, ucp_Mro },
+ { 893, PT_SC, ucp_Multani },
+ { 901, PT_SC, ucp_Myanmar },
+ { 909, PT_GC, ucp_N },
+ { 911, PT_SC, ucp_Nabataean },
+ { 921, PT_SC, ucp_Nandinagari },
+ { 933, PT_PC, ucp_Nd },
+ { 936, PT_SC, ucp_New_Tai_Lue },
+ { 948, PT_SC, ucp_Newa },
+ { 953, PT_SC, ucp_Nko },
+ { 957, PT_PC, ucp_Nl },
+ { 960, PT_PC, ucp_No },
+ { 963, PT_SC, ucp_Nushu },
+ { 969, PT_SC, ucp_Nyiakeng_Puachue_Hmong },
+ { 992, PT_SC, ucp_Ogham },
+ { 998, PT_SC, ucp_Ol_Chiki },
+ { 1007, PT_SC, ucp_Old_Hungarian },
+ { 1021, PT_SC, ucp_Old_Italic },
+ { 1032, PT_SC, ucp_Old_North_Arabian },
+ { 1050, PT_SC, ucp_Old_Permic },
+ { 1061, PT_SC, ucp_Old_Persian },
+ { 1073, PT_SC, ucp_Old_Sogdian },
+ { 1085, PT_SC, ucp_Old_South_Arabian },
+ { 1103, PT_SC, ucp_Old_Turkic },
+ { 1114, PT_SC, ucp_Oriya },
+ { 1120, PT_SC, ucp_Osage },
+ { 1126, PT_SC, ucp_Osmanya },
+ { 1134, PT_GC, ucp_P },
+ { 1136, PT_SC, ucp_Pahawh_Hmong },
+ { 1149, PT_SC, ucp_Palmyrene },
+ { 1159, PT_SC, ucp_Pau_Cin_Hau },
+ { 1171, PT_PC, ucp_Pc },
+ { 1174, PT_PC, ucp_Pd },
+ { 1177, PT_PC, ucp_Pe },
+ { 1180, PT_PC, ucp_Pf },
+ { 1183, PT_SC, ucp_Phags_Pa },
+ { 1192, PT_SC, ucp_Phoenician },
+ { 1203, PT_PC, ucp_Pi },
+ { 1206, PT_PC, ucp_Po },
+ { 1209, PT_PC, ucp_Ps },
+ { 1212, PT_SC, ucp_Psalter_Pahlavi },
+ { 1228, PT_SC, ucp_Rejang },
+ { 1235, PT_SC, ucp_Runic },
+ { 1241, PT_GC, ucp_S },
+ { 1243, PT_SC, ucp_Samaritan },
+ { 1253, PT_SC, ucp_Saurashtra },
+ { 1264, PT_PC, ucp_Sc },
+ { 1267, PT_SC, ucp_Sharada },
+ { 1275, PT_SC, ucp_Shavian },
+ { 1283, PT_SC, ucp_Siddham },
+ { 1291, PT_SC, ucp_SignWriting },
+ { 1303, PT_SC, ucp_Sinhala },
+ { 1311, PT_PC, ucp_Sk },
+ { 1314, PT_PC, ucp_Sm },
+ { 1317, PT_PC, ucp_So },
+ { 1320, PT_SC, ucp_Sogdian },
+ { 1328, PT_SC, ucp_Sora_Sompeng },
+ { 1341, PT_SC, ucp_Soyombo },
+ { 1349, PT_SC, ucp_Sundanese },
+ { 1359, PT_SC, ucp_Syloti_Nagri },
+ { 1372, PT_SC, ucp_Syriac },
+ { 1379, PT_SC, ucp_Tagalog },
+ { 1387, PT_SC, ucp_Tagbanwa },
+ { 1396, PT_SC, ucp_Tai_Le },
+ { 1403, PT_SC, ucp_Tai_Tham },
+ { 1412, PT_SC, ucp_Tai_Viet },
+ { 1421, PT_SC, ucp_Takri },
+ { 1427, PT_SC, ucp_Tamil },
+ { 1433, PT_SC, ucp_Tangut },
+ { 1440, PT_SC, ucp_Telugu },
+ { 1447, PT_SC, ucp_Thaana },
+ { 1454, PT_SC, ucp_Thai },
+ { 1459, PT_SC, ucp_Tibetan },
+ { 1467, PT_SC, ucp_Tifinagh },
+ { 1476, PT_SC, ucp_Tirhuta },
+ { 1484, PT_SC, ucp_Ugaritic },
+ { 1493, PT_SC, ucp_Unknown },
+ { 1501, PT_SC, ucp_Vai },
+ { 1505, PT_SC, ucp_Wancho },
+ { 1512, PT_SC, ucp_Warang_Citi },
+ { 1524, PT_ALNUM, 0 },
+ { 1528, PT_PXSPACE, 0 },
+ { 1532, PT_SPACE, 0 },
+ { 1536, PT_UCNC, 0 },
+ { 1540, PT_WORD, 0 },
+ { 1544, PT_SC, ucp_Yi },
+ { 1547, PT_GC, ucp_Z },
+ { 1549, PT_SC, ucp_Zanabazar_Square },
+ { 1566, PT_PC, ucp_Zl },
+ { 1569, PT_PC, ucp_Zp },
+ { 1572, PT_PC, ucp_Zs }
};
const size_t PRIV(utt_size) = sizeof(PRIV(utt)) / sizeof(ucp_type_table);
diff --git a/ext/pcre/pcre2lib/pcre2_ucd.c b/ext/pcre/pcre2lib/pcre2_ucd.c
index cc53c24001..55ba03bd43 100644
--- a/ext/pcre/pcre2lib/pcre2_ucd.c
+++ b/ext/pcre/pcre2lib/pcre2_ucd.c
@@ -20,7 +20,7 @@ needed. */
/* Unicode character database. */
/* This file was autogenerated by the MultiStage2.py script. */
-/* Total size: 97152 bytes, block size: 128. */
+/* Total size: 99316 bytes, block size: 128. */
/* The tables herein are needed only when UCP support is built,
and in PCRE2 that happens automatically with UTF support.
@@ -39,7 +39,7 @@ const uint16_t PRIV(ucd_stage2)[] = {0};
const uint32_t PRIV(ucd_caseless_sets)[] = {0};
#else
-const char *PRIV(unicode_version) = "11.0.0";
+const char *PRIV(unicode_version) = "12.1.0";
/* If the 32-bit library is run in non-32-bit mode, character values
greater than 0x10ffff may be encountered. For these we set up a
@@ -116,7 +116,7 @@ set of decimal digits. It is used to ensure that all the digits in
a script run come from the same set. */
const uint32_t PRIV(ucd_digit_sets)[] = {
- 61, /* Number of subsequent values */
+ 63, /* Number of subsequent values */
0x00039, 0x00669, 0x006f9, 0x007c9, 0x0096f, 0x009ef, 0x00a6f, 0x00aef,
0x00b6f, 0x00bef, 0x00c6f, 0x00cef, 0x00d6f, 0x00def, 0x00e59, 0x00ed9,
0x00f29, 0x01049, 0x01099, 0x017e9, 0x01819, 0x0194f, 0x019d9, 0x01a89,
@@ -124,7 +124,7 @@ const uint32_t PRIV(ucd_digit_sets)[] = {
0x0a9d9, 0x0a9f9, 0x0aa59, 0x0abf9, 0x0ff19, 0x104a9, 0x10d39, 0x1106f,
0x110f9, 0x1113f, 0x111d9, 0x112f9, 0x11459, 0x114d9, 0x11659, 0x116c9,
0x11739, 0x118e9, 0x11c59, 0x11d59, 0x11da9, 0x16a69, 0x16b59, 0x1d7d7,
- 0x1d7e1, 0x1d7eb, 0x1d7f5, 0x1d7ff, 0x1e959,
+ 0x1d7e1, 0x1d7eb, 0x1d7f5, 0x1d7ff, 0x1e149, 0x1e2f9, 0x1e959,
};
/* This vector is a list of lists of scripts for the Script Extension
@@ -145,38 +145,42 @@ const uint8_t PRIV(ucd_script_sets)[] = {
/* 31 */ 13, 34, 0,
/* 34 */ 13, 118, 0,
/* 37 */ 15, 107, 0,
- /* 40 */ 15, 100, 0,
- /* 43 */ 15, 54, 0,
- /* 46 */ 17, 34, 0,
- /* 49 */ 107, 54, 0,
- /* 52 */ 21, 108, 0,
- /* 55 */ 22, 129, 0,
- /* 58 */ 27, 30, 0,
- /* 61 */ 38, 65, 0,
- /* 64 */ 1, 50, 56, 0,
- /* 68 */ 3, 96, 49, 0,
- /* 72 */ 96, 39, 53, 0,
- /* 76 */ 12, 110, 36, 0,
- /* 80 */ 15, 107, 29, 0,
- /* 84 */ 15, 107, 34, 0,
- /* 88 */ 23, 27, 30, 0,
- /* 92 */ 69, 34, 39, 0,
- /* 96 */ 1, 144, 50, 56, 0,
- /* 101 */ 3, 15, 107, 29, 0,
- /* 106 */ 7, 25, 52, 51, 0,
- /* 111 */ 15, 142, 85, 111, 0,
- /* 116 */ 4, 24, 23, 27, 30, 0,
- /* 122 */ 4, 24, 23, 27, 30, 61, 0,
- /* 129 */ 15, 29, 37, 44, 54, 55, 0,
- /* 136 */ 132, 1, 95, 112, 121, 144, 148, 50, 0,
- /* 145 */ 15, 142, 21, 22, 108, 85, 111, 114, 109, 102, 124, 0,
- /* 157 */ 3, 15, 107, 21, 22, 29, 34, 37, 44, 54, 55, 124, 0,
- /* 170 */ 15, 142, 21, 22, 108, 29, 85, 111, 114, 109, 102, 124, 0,
- /* 183 */ 3, 15, 107, 21, 22, 29, 34, 37, 44, 100, 54, 55, 124, 0,
- /* 197 */ 15, 142, 21, 22, 108, 29, 85, 111, 37, 114, 109, 102, 124, 0,
- /* 211 */ 3, 15, 142, 143, 107, 21, 22, 29, 111, 37, 44, 109, 48, 49, 102, 54, 55, 124, 0,
- /* 230 */ 3, 15, 142, 143, 107, 21, 22, 29, 35, 111, 37, 44, 109, 48, 49, 102, 54, 55, 124, 0,
- /* 250 */
+ /* 40 */ 15, 150, 0,
+ /* 43 */ 15, 100, 0,
+ /* 46 */ 15, 54, 0,
+ /* 49 */ 17, 34, 0,
+ /* 52 */ 107, 54, 0,
+ /* 55 */ 21, 108, 0,
+ /* 58 */ 22, 129, 0,
+ /* 61 */ 27, 30, 0,
+ /* 64 */ 29, 150, 0,
+ /* 67 */ 34, 38, 0,
+ /* 70 */ 38, 65, 0,
+ /* 73 */ 1, 50, 56, 0,
+ /* 77 */ 3, 96, 49, 0,
+ /* 81 */ 96, 39, 53, 0,
+ /* 85 */ 12, 110, 36, 0,
+ /* 89 */ 15, 107, 29, 0,
+ /* 93 */ 15, 107, 34, 0,
+ /* 97 */ 23, 27, 30, 0,
+ /* 101 */ 69, 34, 39, 0,
+ /* 105 */ 1, 144, 50, 56, 0,
+ /* 110 */ 3, 15, 107, 29, 0,
+ /* 115 */ 7, 25, 52, 51, 0,
+ /* 120 */ 15, 142, 85, 111, 0,
+ /* 125 */ 4, 24, 23, 27, 30, 0,
+ /* 131 */ 4, 24, 23, 27, 30, 61, 0,
+ /* 138 */ 15, 29, 37, 44, 54, 55, 0,
+ /* 145 */ 132, 1, 95, 112, 121, 144, 148, 50, 0,
+ /* 154 */ 3, 15, 107, 29, 150, 44, 55, 124, 0,
+ /* 163 */ 15, 142, 21, 22, 108, 85, 111, 114, 109, 102, 124, 0,
+ /* 175 */ 3, 15, 107, 21, 22, 29, 34, 37, 44, 54, 55, 124, 0,
+ /* 188 */ 3, 15, 107, 21, 22, 29, 34, 37, 44, 100, 54, 55, 124, 0,
+ /* 202 */ 15, 142, 21, 22, 108, 29, 85, 111, 114, 150, 109, 102, 124, 0,
+ /* 216 */ 15, 142, 21, 22, 108, 29, 85, 111, 37, 114, 150, 109, 102, 124, 0,
+ /* 231 */ 3, 15, 142, 143, 138, 107, 21, 22, 29, 111, 37, 150, 44, 109, 48, 49, 102, 54, 55, 124, 0,
+ /* 252 */ 3, 15, 142, 143, 138, 107, 21, 22, 29, 35, 111, 37, 150, 44, 109, 48, 49, 102, 54, 55, 124, 0,
+ /* 274 */
};
/* These are the main two-stage UCD tables. The fields in each record are:
@@ -185,7 +189,7 @@ offset to multichar other cases or zero (8 bits), offset to other case
or zero (32 bits, signed), script extension (16 bits, signed), and a dummy
16-bit field to make the whole thing a multiple of 4 bytes. */
-const ucd_record PRIV(ucd_records)[] = { /* 11136 bytes, record size 12 */
+const ucd_record PRIV(ucd_records)[] = { /* 11508 bytes, record size 12 */
{ 10, 0, 2, 0, 0, 10, 256, }, /* 0 */
{ 10, 0, 2, 0, 0, 10, 0, }, /* 1 */
{ 10, 0, 1, 0, 0, 10, 0, }, /* 2 */
@@ -288,832 +292,863 @@ const ucd_record PRIV(ucd_records)[] = { /* 11136 bytes, record size 12 */
{ 34, 5, 12, 0, -214, 34, 0, }, /* 99 */
{ 34, 5, 12, 0, 10727, 34, 0, }, /* 100 */
{ 34, 5, 12, 0, -218, 34, 0, }, /* 101 */
- { 34, 5, 12, 0, 42282, 34, 0, }, /* 102 */
- { 34, 5, 12, 0, -69, 34, 0, }, /* 103 */
- { 34, 5, 12, 0, -217, 34, 0, }, /* 104 */
- { 34, 5, 12, 0, -71, 34, 0, }, /* 105 */
- { 34, 5, 12, 0, -219, 34, 0, }, /* 106 */
- { 34, 5, 12, 0, 42261, 34, 0, }, /* 107 */
- { 34, 5, 12, 0, 42258, 34, 0, }, /* 108 */
- { 34, 6, 12, 0, 0, 34, 0, }, /* 109 */
- { 10, 6, 12, 0, 0, 10, 0, }, /* 110 */
- { 4, 24, 12, 0, 0, 4, 0, }, /* 111 */
- { 28, 12, 3, 0, 0, 28, 0, }, /* 112 */
- { 28, 12, 3, 0, 0, 20, 0, }, /* 113 */
- { 28, 12, 3, 21, 116, 20, 0, }, /* 114 */
- { 28, 12, 3, 0, 0, 34, 0, }, /* 115 */
- { 20, 9, 12, 0, 1, 20, 0, }, /* 116 */
- { 20, 5, 12, 0, -1, 20, 0, }, /* 117 */
- { 20, 24, 12, 0, 0, 20, 0, }, /* 118 */
- { 0, 2, 12, 0, 0, 0, 0, }, /* 119 */
- { 20, 6, 12, 0, 0, 20, 0, }, /* 120 */
- { 20, 5, 12, 0, 130, 20, 0, }, /* 121 */
- { 20, 9, 12, 0, 116, 20, 0, }, /* 122 */
- { 20, 9, 12, 0, 38, 20, 0, }, /* 123 */
- { 20, 9, 12, 0, 37, 20, 0, }, /* 124 */
- { 20, 9, 12, 0, 64, 20, 0, }, /* 125 */
- { 20, 9, 12, 0, 63, 20, 0, }, /* 126 */
- { 20, 5, 12, 0, 0, 20, 0, }, /* 127 */
- { 20, 9, 12, 0, 32, 20, 0, }, /* 128 */
- { 20, 9, 12, 34, 32, 20, 0, }, /* 129 */
- { 20, 9, 12, 59, 32, 20, 0, }, /* 130 */
- { 20, 9, 12, 38, 32, 20, 0, }, /* 131 */
- { 20, 9, 12, 21, 32, 20, 0, }, /* 132 */
- { 20, 9, 12, 51, 32, 20, 0, }, /* 133 */
- { 20, 9, 12, 26, 32, 20, 0, }, /* 134 */
- { 20, 9, 12, 47, 32, 20, 0, }, /* 135 */
- { 20, 9, 12, 55, 32, 20, 0, }, /* 136 */
- { 20, 9, 12, 30, 32, 20, 0, }, /* 137 */
- { 20, 9, 12, 43, 32, 20, 0, }, /* 138 */
- { 20, 9, 12, 96, 32, 20, 0, }, /* 139 */
- { 20, 5, 12, 0, -38, 20, 0, }, /* 140 */
- { 20, 5, 12, 0, -37, 20, 0, }, /* 141 */
- { 20, 5, 12, 0, -32, 20, 0, }, /* 142 */
- { 20, 5, 12, 34, -32, 20, 0, }, /* 143 */
- { 20, 5, 12, 59, -32, 20, 0, }, /* 144 */
- { 20, 5, 12, 38, -32, 20, 0, }, /* 145 */
- { 20, 5, 12, 21, -116, 20, 0, }, /* 146 */
- { 20, 5, 12, 51, -32, 20, 0, }, /* 147 */
- { 20, 5, 12, 26, -775, 20, 0, }, /* 148 */
- { 20, 5, 12, 47, -32, 20, 0, }, /* 149 */
- { 20, 5, 12, 55, -32, 20, 0, }, /* 150 */
- { 20, 5, 12, 30, 1, 20, 0, }, /* 151 */
- { 20, 5, 12, 30, -32, 20, 0, }, /* 152 */
- { 20, 5, 12, 43, -32, 20, 0, }, /* 153 */
- { 20, 5, 12, 96, -32, 20, 0, }, /* 154 */
- { 20, 5, 12, 0, -64, 20, 0, }, /* 155 */
- { 20, 5, 12, 0, -63, 20, 0, }, /* 156 */
- { 20, 9, 12, 0, 8, 20, 0, }, /* 157 */
- { 20, 5, 12, 34, -30, 20, 0, }, /* 158 */
- { 20, 5, 12, 38, -25, 20, 0, }, /* 159 */
- { 20, 9, 12, 0, 0, 20, 0, }, /* 160 */
- { 20, 5, 12, 43, -15, 20, 0, }, /* 161 */
- { 20, 5, 12, 47, -22, 20, 0, }, /* 162 */
- { 20, 5, 12, 0, -8, 20, 0, }, /* 163 */
- { 11, 9, 12, 0, 1, 11, 0, }, /* 164 */
- { 11, 5, 12, 0, -1, 11, 0, }, /* 165 */
- { 20, 5, 12, 51, -54, 20, 0, }, /* 166 */
- { 20, 5, 12, 55, -48, 20, 0, }, /* 167 */
- { 20, 5, 12, 0, 7, 20, 0, }, /* 168 */
- { 20, 5, 12, 0, -116, 20, 0, }, /* 169 */
- { 20, 9, 12, 38, -60, 20, 0, }, /* 170 */
- { 20, 5, 12, 59, -64, 20, 0, }, /* 171 */
- { 20, 25, 12, 0, 0, 20, 0, }, /* 172 */
- { 20, 9, 12, 0, -7, 20, 0, }, /* 173 */
- { 20, 9, 12, 0, -130, 20, 0, }, /* 174 */
- { 13, 9, 12, 0, 80, 13, 0, }, /* 175 */
- { 13, 9, 12, 0, 32, 13, 0, }, /* 176 */
- { 13, 9, 12, 63, 32, 13, 0, }, /* 177 */
- { 13, 9, 12, 67, 32, 13, 0, }, /* 178 */
- { 13, 9, 12, 71, 32, 13, 0, }, /* 179 */
- { 13, 9, 12, 75, 32, 13, 0, }, /* 180 */
- { 13, 9, 12, 79, 32, 13, 0, }, /* 181 */
- { 13, 9, 12, 84, 32, 13, 0, }, /* 182 */
- { 13, 5, 12, 0, -32, 13, 0, }, /* 183 */
- { 13, 5, 12, 63, -32, 13, 0, }, /* 184 */
- { 13, 5, 12, 67, -32, 13, 0, }, /* 185 */
- { 13, 5, 12, 71, -32, 13, 0, }, /* 186 */
- { 13, 5, 12, 75, -32, 13, 0, }, /* 187 */
- { 13, 5, 12, 79, -32, 13, 0, }, /* 188 */
- { 13, 5, 12, 84, -32, 13, 0, }, /* 189 */
- { 13, 5, 12, 0, -80, 13, 0, }, /* 190 */
- { 13, 9, 12, 0, 1, 13, 0, }, /* 191 */
- { 13, 5, 12, 0, -1, 13, 0, }, /* 192 */
- { 13, 9, 12, 88, 1, 13, 0, }, /* 193 */
- { 13, 5, 12, 88, -1, 13, 0, }, /* 194 */
- { 13, 26, 12, 0, 0, 13, 0, }, /* 195 */
- { 13, 12, 3, 0, 0, -34, 0, }, /* 196 */
- { 13, 12, 3, 0, 0, -28, 0, }, /* 197 */
- { 28, 12, 3, 0, 0, -31, 0, }, /* 198 */
- { 13, 11, 3, 0, 0, 13, 0, }, /* 199 */
- { 13, 9, 12, 0, 15, 13, 0, }, /* 200 */
- { 13, 5, 12, 0, -15, 13, 0, }, /* 201 */
- { 2, 9, 12, 0, 48, 2, 0, }, /* 202 */
- { 2, 6, 12, 0, 0, 2, 0, }, /* 203 */
- { 2, 21, 12, 0, 0, 2, 0, }, /* 204 */
- { 2, 5, 12, 0, 0, 2, 0, }, /* 205 */
- { 2, 5, 12, 0, -48, 2, 0, }, /* 206 */
- { 10, 21, 12, 0, 0, -13, 0, }, /* 207 */
- { 2, 17, 12, 0, 0, 2, 0, }, /* 208 */
- { 2, 26, 12, 0, 0, 2, 0, }, /* 209 */
- { 2, 23, 12, 0, 0, 2, 0, }, /* 210 */
- { 26, 12, 3, 0, 0, 26, 0, }, /* 211 */
- { 26, 17, 12, 0, 0, 26, 0, }, /* 212 */
- { 26, 21, 12, 0, 0, 26, 0, }, /* 213 */
- { 26, 7, 12, 0, 0, 26, 0, }, /* 214 */
- { 1, 1, 4, 0, 0, 1, 0, }, /* 215 */
- { 10, 1, 4, 0, 0, 10, 0, }, /* 216 */
- { 1, 25, 12, 0, 0, 1, 0, }, /* 217 */
- { 1, 21, 12, 0, 0, 1, 0, }, /* 218 */
- { 1, 23, 12, 0, 0, 1, 0, }, /* 219 */
- { 10, 21, 12, 0, 0, -96, 0, }, /* 220 */
- { 1, 26, 12, 0, 0, 1, 0, }, /* 221 */
- { 1, 12, 3, 0, 0, 1, 0, }, /* 222 */
- { 1, 1, 2, 0, 0, -64, 0, }, /* 223 */
- { 1, 7, 12, 0, 0, 1, 0, }, /* 224 */
- { 10, 6, 12, 0, 0, -136, 0, }, /* 225 */
- { 28, 12, 3, 0, 0, -7, 0, }, /* 226 */
- { 1, 13, 12, 0, 0, -10, 0, }, /* 227 */
- { 1, 21, 12, 0, 0, -4, 0, }, /* 228 */
- { 1, 6, 12, 0, 0, 1, 0, }, /* 229 */
- { 1, 13, 12, 0, 0, 1, 0, }, /* 230 */
- { 50, 21, 12, 0, 0, 50, 0, }, /* 231 */
- { 50, 1, 4, 0, 0, 50, 0, }, /* 232 */
- { 50, 7, 12, 0, 0, 50, 0, }, /* 233 */
- { 50, 12, 3, 0, 0, 50, 0, }, /* 234 */
- { 56, 7, 12, 0, 0, 56, 0, }, /* 235 */
- { 56, 12, 3, 0, 0, 56, 0, }, /* 236 */
- { 64, 13, 12, 0, 0, 64, 0, }, /* 237 */
- { 64, 7, 12, 0, 0, 64, 0, }, /* 238 */
- { 64, 12, 3, 0, 0, 64, 0, }, /* 239 */
- { 64, 6, 12, 0, 0, 64, 0, }, /* 240 */
- { 64, 26, 12, 0, 0, 64, 0, }, /* 241 */
- { 64, 21, 12, 0, 0, 64, 0, }, /* 242 */
- { 64, 23, 12, 0, 0, 64, 0, }, /* 243 */
- { 90, 7, 12, 0, 0, 90, 0, }, /* 244 */
- { 90, 12, 3, 0, 0, 90, 0, }, /* 245 */
- { 90, 6, 12, 0, 0, 90, 0, }, /* 246 */
- { 90, 21, 12, 0, 0, 90, 0, }, /* 247 */
- { 95, 7, 12, 0, 0, 95, 0, }, /* 248 */
- { 95, 12, 3, 0, 0, 95, 0, }, /* 249 */
- { 95, 21, 12, 0, 0, 95, 0, }, /* 250 */
- { 15, 12, 3, 0, 0, 15, 0, }, /* 251 */
- { 15, 10, 5, 0, 0, 15, 0, }, /* 252 */
- { 15, 7, 12, 0, 0, 15, 0, }, /* 253 */
- { 28, 12, 3, 0, 0, -183, 0, }, /* 254 */
- { 28, 12, 3, 0, 0, -157, 0, }, /* 255 */
- { 10, 21, 12, 0, 0, -211, 0, }, /* 256 */
- { 10, 21, 12, 0, 0, -230, 0, }, /* 257 */
- { 15, 13, 12, 0, 0, -111, 0, }, /* 258 */
- { 15, 21, 12, 0, 0, 15, 0, }, /* 259 */
- { 15, 6, 12, 0, 0, 15, 0, }, /* 260 */
- { 3, 7, 12, 0, 0, 3, 0, }, /* 261 */
- { 3, 12, 3, 0, 0, 3, 0, }, /* 262 */
- { 3, 10, 5, 0, 0, 3, 0, }, /* 263 */
- { 3, 10, 3, 0, 0, 3, 0, }, /* 264 */
- { 3, 13, 12, 0, 0, -68, 0, }, /* 265 */
- { 3, 23, 12, 0, 0, 3, 0, }, /* 266 */
- { 3, 15, 12, 0, 0, 3, 0, }, /* 267 */
- { 3, 26, 12, 0, 0, 3, 0, }, /* 268 */
- { 3, 21, 12, 0, 0, 3, 0, }, /* 269 */
- { 22, 12, 3, 0, 0, 22, 0, }, /* 270 */
- { 22, 10, 5, 0, 0, 22, 0, }, /* 271 */
- { 22, 7, 12, 0, 0, 22, 0, }, /* 272 */
- { 22, 13, 12, 0, 0, -55, 0, }, /* 273 */
- { 22, 21, 12, 0, 0, 22, 0, }, /* 274 */
- { 21, 12, 3, 0, 0, 21, 0, }, /* 275 */
- { 21, 10, 5, 0, 0, 21, 0, }, /* 276 */
- { 21, 7, 12, 0, 0, 21, 0, }, /* 277 */
- { 21, 13, 12, 0, 0, -52, 0, }, /* 278 */
- { 21, 21, 12, 0, 0, 21, 0, }, /* 279 */
- { 21, 23, 12, 0, 0, 21, 0, }, /* 280 */
- { 44, 12, 3, 0, 0, 44, 0, }, /* 281 */
- { 44, 10, 5, 0, 0, 44, 0, }, /* 282 */
- { 44, 7, 12, 0, 0, 44, 0, }, /* 283 */
- { 44, 10, 3, 0, 0, 44, 0, }, /* 284 */
- { 44, 13, 12, 0, 0, 44, 0, }, /* 285 */
- { 44, 26, 12, 0, 0, 44, 0, }, /* 286 */
- { 44, 15, 12, 0, 0, 44, 0, }, /* 287 */
- { 54, 12, 3, 0, 0, 54, 0, }, /* 288 */
- { 54, 7, 12, 0, 0, 54, 0, }, /* 289 */
- { 54, 10, 3, 0, 0, 54, 0, }, /* 290 */
- { 54, 10, 5, 0, 0, 54, 0, }, /* 291 */
- { 54, 13, 12, 0, 0, -49, 0, }, /* 292 */
- { 54, 15, 12, 0, 0, -49, 0, }, /* 293 */
- { 54, 26, 12, 0, 0, -49, 0, }, /* 294 */
- { 54, 26, 12, 0, 0, 54, 0, }, /* 295 */
- { 54, 23, 12, 0, 0, 54, 0, }, /* 296 */
- { 55, 12, 3, 0, 0, 55, 0, }, /* 297 */
- { 55, 10, 5, 0, 0, 55, 0, }, /* 298 */
- { 55, 7, 12, 0, 0, 55, 0, }, /* 299 */
- { 55, 13, 12, 0, 0, 55, 0, }, /* 300 */
- { 55, 15, 12, 0, 0, 55, 0, }, /* 301 */
- { 55, 26, 12, 0, 0, 55, 0, }, /* 302 */
- { 29, 7, 12, 0, 0, 29, 0, }, /* 303 */
- { 29, 12, 3, 0, 0, 29, 0, }, /* 304 */
- { 29, 10, 5, 0, 0, 29, 0, }, /* 305 */
- { 29, 21, 12, 0, 0, 29, 0, }, /* 306 */
- { 29, 10, 3, 0, 0, 29, 0, }, /* 307 */
- { 29, 13, 12, 0, 0, 29, 0, }, /* 308 */
- { 37, 12, 3, 0, 0, 37, 0, }, /* 309 */
- { 37, 10, 5, 0, 0, 37, 0, }, /* 310 */
- { 37, 7, 12, 0, 0, 37, 0, }, /* 311 */
- { 37, 10, 3, 0, 0, 37, 0, }, /* 312 */
- { 37, 7, 4, 0, 0, 37, 0, }, /* 313 */
- { 37, 26, 12, 0, 0, 37, 0, }, /* 314 */
- { 37, 15, 12, 0, 0, 37, 0, }, /* 315 */
- { 37, 13, 12, 0, 0, 37, 0, }, /* 316 */
- { 48, 10, 5, 0, 0, 48, 0, }, /* 317 */
- { 48, 7, 12, 0, 0, 48, 0, }, /* 318 */
- { 48, 12, 3, 0, 0, 48, 0, }, /* 319 */
- { 48, 10, 3, 0, 0, 48, 0, }, /* 320 */
- { 48, 13, 12, 0, 0, 48, 0, }, /* 321 */
- { 48, 21, 12, 0, 0, 48, 0, }, /* 322 */
- { 57, 7, 12, 0, 0, 57, 0, }, /* 323 */
- { 57, 12, 3, 0, 0, 57, 0, }, /* 324 */
- { 57, 7, 5, 0, 0, 57, 0, }, /* 325 */
- { 57, 6, 12, 0, 0, 57, 0, }, /* 326 */
- { 57, 21, 12, 0, 0, 57, 0, }, /* 327 */
- { 57, 13, 12, 0, 0, 57, 0, }, /* 328 */
- { 33, 7, 12, 0, 0, 33, 0, }, /* 329 */
- { 33, 12, 3, 0, 0, 33, 0, }, /* 330 */
- { 33, 7, 5, 0, 0, 33, 0, }, /* 331 */
- { 33, 6, 12, 0, 0, 33, 0, }, /* 332 */
- { 33, 13, 12, 0, 0, 33, 0, }, /* 333 */
- { 58, 7, 12, 0, 0, 58, 0, }, /* 334 */
- { 58, 26, 12, 0, 0, 58, 0, }, /* 335 */
- { 58, 21, 12, 0, 0, 58, 0, }, /* 336 */
- { 58, 12, 3, 0, 0, 58, 0, }, /* 337 */
- { 58, 13, 12, 0, 0, 58, 0, }, /* 338 */
- { 58, 15, 12, 0, 0, 58, 0, }, /* 339 */
- { 58, 22, 12, 0, 0, 58, 0, }, /* 340 */
- { 58, 18, 12, 0, 0, 58, 0, }, /* 341 */
- { 58, 10, 5, 0, 0, 58, 0, }, /* 342 */
- { 39, 7, 12, 0, 0, 39, 0, }, /* 343 */
- { 39, 10, 12, 0, 0, 39, 0, }, /* 344 */
- { 39, 12, 3, 0, 0, 39, 0, }, /* 345 */
- { 39, 10, 5, 0, 0, 39, 0, }, /* 346 */
- { 39, 13, 12, 0, 0, -72, 0, }, /* 347 */
- { 39, 21, 12, 0, 0, 39, 0, }, /* 348 */
- { 39, 13, 12, 0, 0, 39, 0, }, /* 349 */
- { 39, 26, 12, 0, 0, 39, 0, }, /* 350 */
- { 17, 9, 12, 0, 7264, 17, 0, }, /* 351 */
- { 17, 5, 12, 0, 3008, 17, 0, }, /* 352 */
- { 10, 21, 12, 0, 0, -46, 0, }, /* 353 */
- { 17, 6, 12, 0, 0, 17, 0, }, /* 354 */
- { 24, 7, 6, 0, 0, 24, 0, }, /* 355 */
- { 24, 7, 7, 0, 0, 24, 0, }, /* 356 */
- { 24, 7, 8, 0, 0, 24, 0, }, /* 357 */
- { 16, 7, 12, 0, 0, 16, 0, }, /* 358 */
- { 16, 12, 3, 0, 0, 16, 0, }, /* 359 */
- { 16, 21, 12, 0, 0, 16, 0, }, /* 360 */
- { 16, 15, 12, 0, 0, 16, 0, }, /* 361 */
- { 16, 26, 12, 0, 0, 16, 0, }, /* 362 */
- { 9, 9, 12, 0, 38864, 9, 0, }, /* 363 */
- { 9, 9, 12, 0, 8, 9, 0, }, /* 364 */
- { 9, 5, 12, 0, -8, 9, 0, }, /* 365 */
- { 8, 17, 12, 0, 0, 8, 0, }, /* 366 */
- { 8, 7, 12, 0, 0, 8, 0, }, /* 367 */
- { 8, 21, 12, 0, 0, 8, 0, }, /* 368 */
- { 41, 29, 12, 0, 0, 41, 0, }, /* 369 */
- { 41, 7, 12, 0, 0, 41, 0, }, /* 370 */
- { 41, 22, 12, 0, 0, 41, 0, }, /* 371 */
- { 41, 18, 12, 0, 0, 41, 0, }, /* 372 */
- { 46, 7, 12, 0, 0, 46, 0, }, /* 373 */
- { 46, 14, 12, 0, 0, 46, 0, }, /* 374 */
- { 51, 7, 12, 0, 0, 51, 0, }, /* 375 */
- { 51, 12, 3, 0, 0, 51, 0, }, /* 376 */
- { 25, 7, 12, 0, 0, 25, 0, }, /* 377 */
- { 25, 12, 3, 0, 0, 25, 0, }, /* 378 */
- { 10, 21, 12, 0, 0, -106, 0, }, /* 379 */
- { 7, 7, 12, 0, 0, 7, 0, }, /* 380 */
- { 7, 12, 3, 0, 0, 7, 0, }, /* 381 */
- { 52, 7, 12, 0, 0, 52, 0, }, /* 382 */
- { 52, 12, 3, 0, 0, 52, 0, }, /* 383 */
- { 32, 7, 12, 0, 0, 32, 0, }, /* 384 */
- { 32, 12, 3, 0, 0, 32, 0, }, /* 385 */
- { 32, 10, 5, 0, 0, 32, 0, }, /* 386 */
- { 32, 21, 12, 0, 0, 32, 0, }, /* 387 */
- { 32, 6, 12, 0, 0, 32, 0, }, /* 388 */
- { 32, 23, 12, 0, 0, 32, 0, }, /* 389 */
- { 32, 13, 12, 0, 0, 32, 0, }, /* 390 */
- { 32, 15, 12, 0, 0, 32, 0, }, /* 391 */
- { 38, 21, 12, 0, 0, 38, 0, }, /* 392 */
- { 10, 21, 12, 0, 0, -61, 0, }, /* 393 */
- { 38, 17, 12, 0, 0, 38, 0, }, /* 394 */
- { 38, 12, 3, 0, 0, 38, 0, }, /* 395 */
- { 38, 1, 2, 0, 0, 38, 0, }, /* 396 */
- { 38, 13, 12, 0, 0, 38, 0, }, /* 397 */
- { 38, 7, 12, 0, 0, 38, 0, }, /* 398 */
- { 38, 6, 12, 0, 0, 38, 0, }, /* 399 */
- { 35, 7, 12, 0, 0, 35, 0, }, /* 400 */
- { 35, 12, 3, 0, 0, 35, 0, }, /* 401 */
- { 35, 10, 5, 0, 0, 35, 0, }, /* 402 */
- { 35, 26, 12, 0, 0, 35, 0, }, /* 403 */
- { 35, 21, 12, 0, 0, 35, 0, }, /* 404 */
- { 35, 13, 12, 0, 0, 35, 0, }, /* 405 */
- { 53, 7, 12, 0, 0, 53, 0, }, /* 406 */
- { 40, 7, 12, 0, 0, 40, 0, }, /* 407 */
- { 40, 13, 12, 0, 0, 40, 0, }, /* 408 */
- { 40, 15, 12, 0, 0, 40, 0, }, /* 409 */
- { 40, 26, 12, 0, 0, 40, 0, }, /* 410 */
- { 32, 26, 12, 0, 0, 32, 0, }, /* 411 */
- { 6, 7, 12, 0, 0, 6, 0, }, /* 412 */
- { 6, 12, 3, 0, 0, 6, 0, }, /* 413 */
- { 6, 10, 5, 0, 0, 6, 0, }, /* 414 */
- { 6, 21, 12, 0, 0, 6, 0, }, /* 415 */
- { 91, 7, 12, 0, 0, 91, 0, }, /* 416 */
- { 91, 10, 5, 0, 0, 91, 0, }, /* 417 */
- { 91, 12, 3, 0, 0, 91, 0, }, /* 418 */
- { 91, 10, 12, 0, 0, 91, 0, }, /* 419 */
- { 91, 13, 12, 0, 0, 91, 0, }, /* 420 */
- { 91, 21, 12, 0, 0, 91, 0, }, /* 421 */
- { 91, 6, 12, 0, 0, 91, 0, }, /* 422 */
- { 28, 11, 3, 0, 0, 28, 0, }, /* 423 */
- { 62, 12, 3, 0, 0, 62, 0, }, /* 424 */
- { 62, 10, 5, 0, 0, 62, 0, }, /* 425 */
- { 62, 7, 12, 0, 0, 62, 0, }, /* 426 */
- { 62, 13, 12, 0, 0, 62, 0, }, /* 427 */
- { 62, 21, 12, 0, 0, 62, 0, }, /* 428 */
- { 62, 26, 12, 0, 0, 62, 0, }, /* 429 */
- { 76, 12, 3, 0, 0, 76, 0, }, /* 430 */
- { 76, 10, 5, 0, 0, 76, 0, }, /* 431 */
- { 76, 7, 12, 0, 0, 76, 0, }, /* 432 */
- { 76, 13, 12, 0, 0, 76, 0, }, /* 433 */
- { 93, 7, 12, 0, 0, 93, 0, }, /* 434 */
- { 93, 12, 3, 0, 0, 93, 0, }, /* 435 */
- { 93, 10, 5, 0, 0, 93, 0, }, /* 436 */
- { 93, 21, 12, 0, 0, 93, 0, }, /* 437 */
- { 70, 7, 12, 0, 0, 70, 0, }, /* 438 */
- { 70, 10, 5, 0, 0, 70, 0, }, /* 439 */
- { 70, 12, 3, 0, 0, 70, 0, }, /* 440 */
- { 70, 21, 12, 0, 0, 70, 0, }, /* 441 */
- { 70, 13, 12, 0, 0, 70, 0, }, /* 442 */
- { 73, 13, 12, 0, 0, 73, 0, }, /* 443 */
- { 73, 7, 12, 0, 0, 73, 0, }, /* 444 */
- { 73, 6, 12, 0, 0, 73, 0, }, /* 445 */
- { 73, 21, 12, 0, 0, 73, 0, }, /* 446 */
- { 13, 5, 12, 63, -6222, 13, 0, }, /* 447 */
- { 13, 5, 12, 67, -6221, 13, 0, }, /* 448 */
- { 13, 5, 12, 71, -6212, 13, 0, }, /* 449 */
- { 13, 5, 12, 75, -6210, 13, 0, }, /* 450 */
- { 13, 5, 12, 79, -6210, 13, 0, }, /* 451 */
- { 13, 5, 12, 79, -6211, 13, 0, }, /* 452 */
- { 13, 5, 12, 84, -6204, 13, 0, }, /* 453 */
- { 13, 5, 12, 88, -6180, 13, 0, }, /* 454 */
- { 13, 5, 12, 108, 35267, 13, 0, }, /* 455 */
- { 17, 9, 12, 0, -3008, 17, 0, }, /* 456 */
- { 76, 21, 12, 0, 0, 76, 0, }, /* 457 */
- { 28, 12, 3, 0, 0, -101, 0, }, /* 458 */
- { 28, 12, 3, 0, 0, 15, 0, }, /* 459 */
- { 10, 21, 12, 0, 0, -37, 0, }, /* 460 */
- { 28, 12, 3, 0, 0, -16, 0, }, /* 461 */
- { 28, 12, 3, 0, 0, -40, 0, }, /* 462 */
- { 28, 12, 3, 0, 0, -129, 0, }, /* 463 */
- { 10, 10, 5, 0, 0, -16, 0, }, /* 464 */
- { 10, 7, 12, 0, 0, 15, 0, }, /* 465 */
- { 10, 7, 12, 0, 0, -16, 0, }, /* 466 */
- { 10, 10, 5, 0, 0, -37, 0, }, /* 467 */
- { 28, 12, 3, 0, 0, -80, 0, }, /* 468 */
- { 10, 10, 5, 0, 0, 3, 0, }, /* 469 */
- { 28, 12, 3, 0, 0, -37, 0, }, /* 470 */
- { 13, 5, 12, 0, 0, 13, 0, }, /* 471 */
- { 13, 6, 12, 0, 0, 13, 0, }, /* 472 */
- { 34, 5, 12, 0, 35332, 34, 0, }, /* 473 */
- { 34, 5, 12, 0, 3814, 34, 0, }, /* 474 */
- { 34, 9, 12, 92, 1, 34, 0, }, /* 475 */
- { 34, 5, 12, 92, -1, 34, 0, }, /* 476 */
- { 34, 5, 12, 92, -58, 34, 0, }, /* 477 */
- { 34, 9, 12, 0, -7615, 34, 0, }, /* 478 */
- { 20, 5, 12, 0, 8, 20, 0, }, /* 479 */
- { 20, 9, 12, 0, -8, 20, 0, }, /* 480 */
- { 20, 5, 12, 0, 74, 20, 0, }, /* 481 */
- { 20, 5, 12, 0, 86, 20, 0, }, /* 482 */
- { 20, 5, 12, 0, 100, 20, 0, }, /* 483 */
- { 20, 5, 12, 0, 128, 20, 0, }, /* 484 */
- { 20, 5, 12, 0, 112, 20, 0, }, /* 485 */
- { 20, 5, 12, 0, 126, 20, 0, }, /* 486 */
- { 20, 8, 12, 0, -8, 20, 0, }, /* 487 */
- { 20, 5, 12, 0, 9, 20, 0, }, /* 488 */
- { 20, 9, 12, 0, -74, 20, 0, }, /* 489 */
- { 20, 8, 12, 0, -9, 20, 0, }, /* 490 */
- { 20, 5, 12, 21, -7173, 20, 0, }, /* 491 */
- { 20, 9, 12, 0, -86, 20, 0, }, /* 492 */
- { 20, 9, 12, 0, -100, 20, 0, }, /* 493 */
- { 20, 9, 12, 0, -112, 20, 0, }, /* 494 */
- { 20, 9, 12, 0, -128, 20, 0, }, /* 495 */
- { 20, 9, 12, 0, -126, 20, 0, }, /* 496 */
- { 28, 1, 3, 0, 0, 28, 0, }, /* 497 */
- { 28, 1, 13, 0, 0, 28, 0, }, /* 498 */
- { 10, 27, 2, 0, 0, 10, 0, }, /* 499 */
- { 10, 28, 2, 0, 0, 10, 0, }, /* 500 */
- { 10, 21, 14, 0, 0, 10, 0, }, /* 501 */
- { 0, 2, 2, 0, 0, 0, 0, }, /* 502 */
- { 28, 12, 3, 0, 0, -84, 0, }, /* 503 */
- { 10, 9, 12, 0, 0, 10, 0, }, /* 504 */
- { 10, 5, 12, 0, 0, 10, 0, }, /* 505 */
- { 20, 9, 12, 96, -7517, 20, 0, }, /* 506 */
- { 34, 9, 12, 100, -8383, 34, 0, }, /* 507 */
- { 34, 9, 12, 104, -8262, 34, 0, }, /* 508 */
- { 34, 9, 12, 0, 28, 34, 0, }, /* 509 */
- { 10, 7, 12, 0, 0, 10, 0, }, /* 510 */
- { 10, 5, 14, 0, 0, 10, 0, }, /* 511 */
- { 34, 5, 12, 0, -28, 34, 0, }, /* 512 */
- { 34, 14, 12, 0, 16, 34, 0, }, /* 513 */
- { 34, 14, 12, 0, -16, 34, 0, }, /* 514 */
- { 34, 14, 12, 0, 0, 34, 0, }, /* 515 */
- { 10, 25, 14, 0, 0, 10, 0, }, /* 516 */
- { 10, 26, 12, 0, 26, 10, 0, }, /* 517 */
- { 10, 26, 14, 0, 26, 10, 0, }, /* 518 */
- { 10, 26, 12, 0, -26, 10, 0, }, /* 519 */
- { 5, 26, 12, 0, 0, 5, 0, }, /* 520 */
- { 18, 9, 12, 0, 48, 18, 0, }, /* 521 */
- { 18, 5, 12, 0, -48, 18, 0, }, /* 522 */
- { 34, 9, 12, 0, -10743, 34, 0, }, /* 523 */
- { 34, 9, 12, 0, -3814, 34, 0, }, /* 524 */
- { 34, 9, 12, 0, -10727, 34, 0, }, /* 525 */
- { 34, 5, 12, 0, -10795, 34, 0, }, /* 526 */
- { 34, 5, 12, 0, -10792, 34, 0, }, /* 527 */
- { 34, 9, 12, 0, -10780, 34, 0, }, /* 528 */
- { 34, 9, 12, 0, -10749, 34, 0, }, /* 529 */
- { 34, 9, 12, 0, -10783, 34, 0, }, /* 530 */
- { 34, 9, 12, 0, -10782, 34, 0, }, /* 531 */
- { 34, 9, 12, 0, -10815, 34, 0, }, /* 532 */
- { 11, 5, 12, 0, 0, 11, 0, }, /* 533 */
- { 11, 26, 12, 0, 0, 11, 0, }, /* 534 */
- { 11, 12, 3, 0, 0, 11, 0, }, /* 535 */
- { 11, 21, 12, 0, 0, 11, 0, }, /* 536 */
- { 11, 15, 12, 0, 0, 11, 0, }, /* 537 */
- { 17, 5, 12, 0, -7264, 17, 0, }, /* 538 */
- { 59, 7, 12, 0, 0, 59, 0, }, /* 539 */
- { 59, 6, 12, 0, 0, 59, 0, }, /* 540 */
- { 59, 21, 12, 0, 0, 59, 0, }, /* 541 */
- { 59, 12, 3, 0, 0, 59, 0, }, /* 542 */
- { 13, 12, 3, 0, 0, 13, 0, }, /* 543 */
- { 10, 21, 12, 0, 0, -28, 0, }, /* 544 */
- { 23, 26, 12, 0, 0, 23, 0, }, /* 545 */
- { 10, 21, 12, 0, 0, -122, 0, }, /* 546 */
- { 10, 21, 12, 0, 0, -116, 0, }, /* 547 */
- { 23, 6, 12, 0, 0, 23, 0, }, /* 548 */
- { 10, 7, 12, 0, 0, 23, 0, }, /* 549 */
- { 23, 14, 12, 0, 0, 23, 0, }, /* 550 */
- { 10, 22, 12, 0, 0, -122, 0, }, /* 551 */
- { 10, 18, 12, 0, 0, -122, 0, }, /* 552 */
- { 10, 26, 12, 0, 0, -116, 0, }, /* 553 */
- { 10, 17, 12, 0, 0, -116, 0, }, /* 554 */
- { 10, 22, 12, 0, 0, -116, 0, }, /* 555 */
- { 10, 18, 12, 0, 0, -116, 0, }, /* 556 */
- { 28, 12, 3, 0, 0, -19, 0, }, /* 557 */
- { 24, 10, 3, 0, 0, 24, 0, }, /* 558 */
- { 10, 17, 14, 0, 0, -116, 0, }, /* 559 */
- { 10, 6, 12, 0, 0, -58, 0, }, /* 560 */
- { 10, 7, 12, 0, 0, -88, 0, }, /* 561 */
- { 10, 21, 14, 0, 0, -88, 0, }, /* 562 */
- { 10, 26, 12, 0, 0, 23, 0, }, /* 563 */
- { 27, 7, 12, 0, 0, 27, 0, }, /* 564 */
- { 28, 12, 3, 0, 0, -58, 0, }, /* 565 */
- { 10, 24, 12, 0, 0, -58, 0, }, /* 566 */
- { 27, 6, 12, 0, 0, 27, 0, }, /* 567 */
- { 10, 17, 12, 0, 0, -58, 0, }, /* 568 */
- { 30, 7, 12, 0, 0, 30, 0, }, /* 569 */
- { 30, 6, 12, 0, 0, 30, 0, }, /* 570 */
- { 4, 7, 12, 0, 0, 4, 0, }, /* 571 */
- { 24, 7, 12, 0, 0, 24, 0, }, /* 572 */
- { 10, 15, 12, 0, 0, 23, 0, }, /* 573 */
- { 24, 26, 12, 0, 0, 24, 0, }, /* 574 */
- { 10, 26, 14, 0, 0, 23, 0, }, /* 575 */
- { 30, 26, 12, 0, 0, 30, 0, }, /* 576 */
- { 23, 7, 12, 0, 0, 23, 0, }, /* 577 */
- { 61, 7, 12, 0, 0, 61, 0, }, /* 578 */
- { 61, 6, 12, 0, 0, 61, 0, }, /* 579 */
- { 61, 26, 12, 0, 0, 61, 0, }, /* 580 */
- { 86, 7, 12, 0, 0, 86, 0, }, /* 581 */
- { 86, 6, 12, 0, 0, 86, 0, }, /* 582 */
- { 86, 21, 12, 0, 0, 86, 0, }, /* 583 */
- { 77, 7, 12, 0, 0, 77, 0, }, /* 584 */
- { 77, 6, 12, 0, 0, 77, 0, }, /* 585 */
- { 77, 21, 12, 0, 0, 77, 0, }, /* 586 */
- { 77, 13, 12, 0, 0, 77, 0, }, /* 587 */
- { 13, 9, 12, 108, 1, 13, 0, }, /* 588 */
- { 13, 5, 12, 108, -35267, 13, 0, }, /* 589 */
- { 13, 7, 12, 0, 0, 13, 0, }, /* 590 */
- { 13, 21, 12, 0, 0, 13, 0, }, /* 591 */
- { 79, 7, 12, 0, 0, 79, 0, }, /* 592 */
- { 79, 14, 12, 0, 0, 79, 0, }, /* 593 */
- { 79, 12, 3, 0, 0, 79, 0, }, /* 594 */
- { 79, 21, 12, 0, 0, 79, 0, }, /* 595 */
- { 34, 9, 12, 0, -35332, 34, 0, }, /* 596 */
- { 34, 9, 12, 0, -42280, 34, 0, }, /* 597 */
- { 34, 9, 12, 0, -42308, 34, 0, }, /* 598 */
- { 34, 9, 12, 0, -42319, 34, 0, }, /* 599 */
- { 34, 9, 12, 0, -42315, 34, 0, }, /* 600 */
- { 34, 9, 12, 0, -42305, 34, 0, }, /* 601 */
- { 34, 9, 12, 0, -42258, 34, 0, }, /* 602 */
- { 34, 9, 12, 0, -42282, 34, 0, }, /* 603 */
- { 34, 9, 12, 0, -42261, 34, 0, }, /* 604 */
- { 34, 9, 12, 0, 928, 34, 0, }, /* 605 */
- { 49, 7, 12, 0, 0, 49, 0, }, /* 606 */
- { 49, 12, 3, 0, 0, 49, 0, }, /* 607 */
- { 49, 10, 5, 0, 0, 49, 0, }, /* 608 */
- { 49, 26, 12, 0, 0, 49, 0, }, /* 609 */
- { 10, 15, 12, 0, 0, -197, 0, }, /* 610 */
- { 10, 15, 12, 0, 0, -170, 0, }, /* 611 */
- { 10, 26, 12, 0, 0, -145, 0, }, /* 612 */
- { 10, 23, 12, 0, 0, -145, 0, }, /* 613 */
- { 65, 7, 12, 0, 0, 65, 0, }, /* 614 */
- { 65, 21, 12, 0, 0, 65, 0, }, /* 615 */
- { 75, 10, 5, 0, 0, 75, 0, }, /* 616 */
- { 75, 7, 12, 0, 0, 75, 0, }, /* 617 */
- { 75, 12, 3, 0, 0, 75, 0, }, /* 618 */
- { 75, 21, 12, 0, 0, 75, 0, }, /* 619 */
- { 75, 13, 12, 0, 0, 75, 0, }, /* 620 */
- { 15, 12, 3, 0, 0, -16, 0, }, /* 621 */
- { 15, 7, 12, 0, 0, -43, 0, }, /* 622 */
- { 69, 13, 12, 0, 0, 69, 0, }, /* 623 */
- { 69, 7, 12, 0, 0, 69, 0, }, /* 624 */
- { 69, 12, 3, 0, 0, 69, 0, }, /* 625 */
- { 10, 21, 12, 0, 0, -92, 0, }, /* 626 */
- { 69, 21, 12, 0, 0, 69, 0, }, /* 627 */
- { 74, 7, 12, 0, 0, 74, 0, }, /* 628 */
- { 74, 12, 3, 0, 0, 74, 0, }, /* 629 */
- { 74, 10, 5, 0, 0, 74, 0, }, /* 630 */
- { 74, 21, 12, 0, 0, 74, 0, }, /* 631 */
- { 84, 12, 3, 0, 0, 84, 0, }, /* 632 */
- { 84, 10, 5, 0, 0, 84, 0, }, /* 633 */
- { 84, 7, 12, 0, 0, 84, 0, }, /* 634 */
- { 84, 21, 12, 0, 0, 84, 0, }, /* 635 */
- { 10, 6, 12, 0, 0, -22, 0, }, /* 636 */
- { 84, 13, 12, 0, 0, 84, 0, }, /* 637 */
- { 39, 6, 12, 0, 0, 39, 0, }, /* 638 */
- { 68, 7, 12, 0, 0, 68, 0, }, /* 639 */
- { 68, 12, 3, 0, 0, 68, 0, }, /* 640 */
- { 68, 10, 5, 0, 0, 68, 0, }, /* 641 */
- { 68, 13, 12, 0, 0, 68, 0, }, /* 642 */
- { 68, 21, 12, 0, 0, 68, 0, }, /* 643 */
- { 92, 7, 12, 0, 0, 92, 0, }, /* 644 */
- { 92, 12, 3, 0, 0, 92, 0, }, /* 645 */
- { 92, 6, 12, 0, 0, 92, 0, }, /* 646 */
- { 92, 21, 12, 0, 0, 92, 0, }, /* 647 */
- { 87, 7, 12, 0, 0, 87, 0, }, /* 648 */
- { 87, 10, 5, 0, 0, 87, 0, }, /* 649 */
- { 87, 12, 3, 0, 0, 87, 0, }, /* 650 */
- { 87, 21, 12, 0, 0, 87, 0, }, /* 651 */
- { 87, 6, 12, 0, 0, 87, 0, }, /* 652 */
- { 34, 5, 12, 0, -928, 34, 0, }, /* 653 */
- { 9, 5, 12, 0, -38864, 9, 0, }, /* 654 */
- { 87, 13, 12, 0, 0, 87, 0, }, /* 655 */
- { 24, 7, 9, 0, 0, 24, 0, }, /* 656 */
- { 24, 7, 10, 0, 0, 24, 0, }, /* 657 */
- { 0, 4, 2, 0, 0, 0, 0, }, /* 658 */
- { 0, 3, 12, 0, 0, 0, 0, }, /* 659 */
- { 26, 25, 12, 0, 0, 26, 0, }, /* 660 */
- { 1, 24, 12, 0, 0, 1, 0, }, /* 661 */
- { 1, 7, 12, 0, 0, -10, 0, }, /* 662 */
- { 1, 26, 12, 0, 0, -10, 0, }, /* 663 */
- { 10, 6, 3, 0, 0, -58, 0, }, /* 664 */
- { 36, 7, 12, 0, 0, 36, 0, }, /* 665 */
- { 10, 21, 12, 0, 0, -25, 0, }, /* 666 */
- { 10, 15, 12, 0, 0, -76, 0, }, /* 667 */
- { 10, 26, 12, 0, 0, -25, 0, }, /* 668 */
- { 20, 14, 12, 0, 0, 20, 0, }, /* 669 */
- { 20, 15, 12, 0, 0, 20, 0, }, /* 670 */
- { 20, 26, 12, 0, 0, 20, 0, }, /* 671 */
- { 71, 7, 12, 0, 0, 71, 0, }, /* 672 */
- { 67, 7, 12, 0, 0, 67, 0, }, /* 673 */
- { 28, 12, 3, 0, 0, -1, 0, }, /* 674 */
- { 10, 15, 12, 0, 0, -1, 0, }, /* 675 */
- { 42, 7, 12, 0, 0, 42, 0, }, /* 676 */
- { 42, 15, 12, 0, 0, 42, 0, }, /* 677 */
- { 19, 7, 12, 0, 0, 19, 0, }, /* 678 */
- { 19, 14, 12, 0, 0, 19, 0, }, /* 679 */
- { 118, 7, 12, 0, 0, 118, 0, }, /* 680 */
- { 118, 12, 3, 0, 0, 118, 0, }, /* 681 */
- { 60, 7, 12, 0, 0, 60, 0, }, /* 682 */
- { 60, 21, 12, 0, 0, 60, 0, }, /* 683 */
- { 43, 7, 12, 0, 0, 43, 0, }, /* 684 */
- { 43, 21, 12, 0, 0, 43, 0, }, /* 685 */
- { 43, 14, 12, 0, 0, 43, 0, }, /* 686 */
- { 14, 9, 12, 0, 40, 14, 0, }, /* 687 */
- { 14, 5, 12, 0, -40, 14, 0, }, /* 688 */
- { 47, 7, 12, 0, 0, 47, 0, }, /* 689 */
- { 45, 7, 12, 0, 0, 45, 0, }, /* 690 */
- { 45, 13, 12, 0, 0, 45, 0, }, /* 691 */
- { 136, 9, 12, 0, 40, 136, 0, }, /* 692 */
- { 136, 5, 12, 0, -40, 136, 0, }, /* 693 */
- { 106, 7, 12, 0, 0, 106, 0, }, /* 694 */
- { 104, 7, 12, 0, 0, 104, 0, }, /* 695 */
- { 104, 21, 12, 0, 0, 104, 0, }, /* 696 */
- { 110, 7, 12, 0, 0, 110, 0, }, /* 697 */
- { 12, 7, 12, 0, 0, 12, 0, }, /* 698 */
- { 81, 7, 12, 0, 0, 81, 0, }, /* 699 */
- { 81, 21, 12, 0, 0, 81, 0, }, /* 700 */
- { 81, 15, 12, 0, 0, 81, 0, }, /* 701 */
- { 120, 7, 12, 0, 0, 120, 0, }, /* 702 */
- { 120, 26, 12, 0, 0, 120, 0, }, /* 703 */
- { 120, 15, 12, 0, 0, 120, 0, }, /* 704 */
- { 116, 7, 12, 0, 0, 116, 0, }, /* 705 */
- { 116, 15, 12, 0, 0, 116, 0, }, /* 706 */
- { 128, 7, 12, 0, 0, 128, 0, }, /* 707 */
- { 128, 15, 12, 0, 0, 128, 0, }, /* 708 */
- { 66, 7, 12, 0, 0, 66, 0, }, /* 709 */
- { 66, 15, 12, 0, 0, 66, 0, }, /* 710 */
- { 66, 21, 12, 0, 0, 66, 0, }, /* 711 */
- { 72, 7, 12, 0, 0, 72, 0, }, /* 712 */
- { 72, 21, 12, 0, 0, 72, 0, }, /* 713 */
- { 98, 7, 12, 0, 0, 98, 0, }, /* 714 */
- { 97, 7, 12, 0, 0, 97, 0, }, /* 715 */
- { 97, 15, 12, 0, 0, 97, 0, }, /* 716 */
- { 31, 7, 12, 0, 0, 31, 0, }, /* 717 */
- { 31, 12, 3, 0, 0, 31, 0, }, /* 718 */
- { 31, 15, 12, 0, 0, 31, 0, }, /* 719 */
- { 31, 21, 12, 0, 0, 31, 0, }, /* 720 */
- { 88, 7, 12, 0, 0, 88, 0, }, /* 721 */
- { 88, 15, 12, 0, 0, 88, 0, }, /* 722 */
- { 88, 21, 12, 0, 0, 88, 0, }, /* 723 */
- { 117, 7, 12, 0, 0, 117, 0, }, /* 724 */
- { 117, 15, 12, 0, 0, 117, 0, }, /* 725 */
- { 112, 7, 12, 0, 0, 112, 0, }, /* 726 */
- { 112, 26, 12, 0, 0, 112, 0, }, /* 727 */
- { 112, 12, 3, 0, 0, 112, 0, }, /* 728 */
- { 112, 15, 12, 0, 0, 112, 0, }, /* 729 */
- { 112, 21, 12, 0, 0, 112, 0, }, /* 730 */
- { 78, 7, 12, 0, 0, 78, 0, }, /* 731 */
- { 78, 21, 12, 0, 0, 78, 0, }, /* 732 */
- { 83, 7, 12, 0, 0, 83, 0, }, /* 733 */
- { 83, 15, 12, 0, 0, 83, 0, }, /* 734 */
- { 82, 7, 12, 0, 0, 82, 0, }, /* 735 */
- { 82, 15, 12, 0, 0, 82, 0, }, /* 736 */
- { 121, 7, 12, 0, 0, 121, 0, }, /* 737 */
- { 121, 21, 12, 0, 0, 121, 0, }, /* 738 */
- { 121, 15, 12, 0, 0, 121, 0, }, /* 739 */
- { 89, 7, 12, 0, 0, 89, 0, }, /* 740 */
- { 130, 9, 12, 0, 64, 130, 0, }, /* 741 */
- { 130, 5, 12, 0, -64, 130, 0, }, /* 742 */
- { 130, 15, 12, 0, 0, 130, 0, }, /* 743 */
- { 144, 7, 12, 0, 0, 144, 0, }, /* 744 */
- { 144, 12, 3, 0, 0, 144, 0, }, /* 745 */
- { 144, 13, 12, 0, 0, 144, 0, }, /* 746 */
- { 1, 15, 12, 0, 0, 1, 0, }, /* 747 */
- { 147, 7, 12, 0, 0, 147, 0, }, /* 748 */
- { 147, 15, 12, 0, 0, 147, 0, }, /* 749 */
- { 148, 7, 12, 0, 0, 148, 0, }, /* 750 */
- { 148, 12, 3, 0, 0, 148, 0, }, /* 751 */
- { 148, 15, 12, 0, 0, 148, 0, }, /* 752 */
- { 148, 21, 12, 0, 0, 148, 0, }, /* 753 */
- { 94, 10, 5, 0, 0, 94, 0, }, /* 754 */
- { 94, 12, 3, 0, 0, 94, 0, }, /* 755 */
- { 94, 7, 12, 0, 0, 94, 0, }, /* 756 */
- { 94, 21, 12, 0, 0, 94, 0, }, /* 757 */
- { 94, 15, 12, 0, 0, 94, 0, }, /* 758 */
- { 94, 13, 12, 0, 0, 94, 0, }, /* 759 */
- { 85, 12, 3, 0, 0, 85, 0, }, /* 760 */
- { 85, 10, 5, 0, 0, 85, 0, }, /* 761 */
- { 85, 7, 12, 0, 0, 85, 0, }, /* 762 */
- { 85, 21, 12, 0, 0, 85, 0, }, /* 763 */
- { 85, 1, 4, 0, 0, 85, 0, }, /* 764 */
- { 101, 7, 12, 0, 0, 101, 0, }, /* 765 */
- { 101, 13, 12, 0, 0, 101, 0, }, /* 766 */
- { 96, 12, 3, 0, 0, 96, 0, }, /* 767 */
- { 96, 7, 12, 0, 0, 96, 0, }, /* 768 */
- { 96, 10, 5, 0, 0, 96, 0, }, /* 769 */
- { 96, 13, 12, 0, 0, 96, 0, }, /* 770 */
- { 96, 21, 12, 0, 0, 96, 0, }, /* 771 */
- { 111, 7, 12, 0, 0, 111, 0, }, /* 772 */
- { 111, 12, 3, 0, 0, 111, 0, }, /* 773 */
- { 111, 21, 12, 0, 0, 111, 0, }, /* 774 */
- { 100, 12, 3, 0, 0, 100, 0, }, /* 775 */
- { 100, 10, 5, 0, 0, 100, 0, }, /* 776 */
- { 100, 7, 12, 0, 0, 100, 0, }, /* 777 */
- { 100, 7, 4, 0, 0, 100, 0, }, /* 778 */
- { 100, 21, 12, 0, 0, 100, 0, }, /* 779 */
- { 100, 13, 12, 0, 0, 100, 0, }, /* 780 */
- { 48, 15, 12, 0, 0, 48, 0, }, /* 781 */
- { 108, 7, 12, 0, 0, 108, 0, }, /* 782 */
- { 108, 10, 5, 0, 0, 108, 0, }, /* 783 */
- { 108, 12, 3, 0, 0, 108, 0, }, /* 784 */
- { 108, 21, 12, 0, 0, 108, 0, }, /* 785 */
- { 129, 7, 12, 0, 0, 129, 0, }, /* 786 */
- { 129, 21, 12, 0, 0, 129, 0, }, /* 787 */
- { 109, 7, 12, 0, 0, 109, 0, }, /* 788 */
- { 109, 12, 3, 0, 0, 109, 0, }, /* 789 */
- { 109, 10, 5, 0, 0, 109, 0, }, /* 790 */
- { 109, 13, 12, 0, 0, 109, 0, }, /* 791 */
- { 107, 12, 3, 0, 0, 107, 0, }, /* 792 */
- { 107, 12, 3, 0, 0, -49, 0, }, /* 793 */
- { 107, 10, 5, 0, 0, 107, 0, }, /* 794 */
- { 107, 10, 5, 0, 0, -49, 0, }, /* 795 */
- { 107, 7, 12, 0, 0, 107, 0, }, /* 796 */
- { 28, 12, 3, 0, 0, -49, 0, }, /* 797 */
- { 107, 10, 3, 0, 0, 107, 0, }, /* 798 */
- { 135, 7, 12, 0, 0, 135, 0, }, /* 799 */
- { 135, 10, 5, 0, 0, 135, 0, }, /* 800 */
- { 135, 12, 3, 0, 0, 135, 0, }, /* 801 */
- { 135, 21, 12, 0, 0, 135, 0, }, /* 802 */
- { 135, 13, 12, 0, 0, 135, 0, }, /* 803 */
- { 124, 7, 12, 0, 0, 124, 0, }, /* 804 */
- { 124, 10, 3, 0, 0, 124, 0, }, /* 805 */
- { 124, 10, 5, 0, 0, 124, 0, }, /* 806 */
- { 124, 12, 3, 0, 0, 124, 0, }, /* 807 */
- { 124, 21, 12, 0, 0, 124, 0, }, /* 808 */
- { 124, 13, 12, 0, 0, 124, 0, }, /* 809 */
- { 123, 7, 12, 0, 0, 123, 0, }, /* 810 */
- { 123, 10, 3, 0, 0, 123, 0, }, /* 811 */
- { 123, 10, 5, 0, 0, 123, 0, }, /* 812 */
- { 123, 12, 3, 0, 0, 123, 0, }, /* 813 */
- { 123, 21, 12, 0, 0, 123, 0, }, /* 814 */
- { 114, 7, 12, 0, 0, 114, 0, }, /* 815 */
- { 114, 10, 5, 0, 0, 114, 0, }, /* 816 */
- { 114, 12, 3, 0, 0, 114, 0, }, /* 817 */
- { 114, 21, 12, 0, 0, 114, 0, }, /* 818 */
- { 114, 13, 12, 0, 0, 114, 0, }, /* 819 */
- { 102, 7, 12, 0, 0, 102, 0, }, /* 820 */
- { 102, 12, 3, 0, 0, 102, 0, }, /* 821 */
- { 102, 10, 5, 0, 0, 102, 0, }, /* 822 */
- { 102, 13, 12, 0, 0, 102, 0, }, /* 823 */
- { 126, 7, 12, 0, 0, 126, 0, }, /* 824 */
- { 126, 12, 3, 0, 0, 126, 0, }, /* 825 */
- { 126, 10, 5, 0, 0, 126, 0, }, /* 826 */
- { 126, 13, 12, 0, 0, 126, 0, }, /* 827 */
- { 126, 15, 12, 0, 0, 126, 0, }, /* 828 */
- { 126, 21, 12, 0, 0, 126, 0, }, /* 829 */
- { 126, 26, 12, 0, 0, 126, 0, }, /* 830 */
- { 142, 7, 12, 0, 0, 142, 0, }, /* 831 */
- { 142, 10, 5, 0, 0, 142, 0, }, /* 832 */
- { 142, 12, 3, 0, 0, 142, 0, }, /* 833 */
- { 142, 21, 12, 0, 0, 142, 0, }, /* 834 */
- { 125, 9, 12, 0, 32, 125, 0, }, /* 835 */
- { 125, 5, 12, 0, -32, 125, 0, }, /* 836 */
- { 125, 13, 12, 0, 0, 125, 0, }, /* 837 */
- { 125, 15, 12, 0, 0, 125, 0, }, /* 838 */
- { 125, 7, 12, 0, 0, 125, 0, }, /* 839 */
- { 141, 7, 12, 0, 0, 141, 0, }, /* 840 */
- { 141, 12, 3, 0, 0, 141, 0, }, /* 841 */
- { 141, 10, 5, 0, 0, 141, 0, }, /* 842 */
- { 141, 7, 4, 0, 0, 141, 0, }, /* 843 */
- { 141, 21, 12, 0, 0, 141, 0, }, /* 844 */
- { 140, 7, 12, 0, 0, 140, 0, }, /* 845 */
- { 140, 12, 3, 0, 0, 140, 0, }, /* 846 */
- { 140, 10, 5, 0, 0, 140, 0, }, /* 847 */
- { 140, 7, 4, 0, 0, 140, 0, }, /* 848 */
- { 140, 21, 12, 0, 0, 140, 0, }, /* 849 */
- { 122, 7, 12, 0, 0, 122, 0, }, /* 850 */
- { 133, 7, 12, 0, 0, 133, 0, }, /* 851 */
- { 133, 10, 5, 0, 0, 133, 0, }, /* 852 */
- { 133, 12, 3, 0, 0, 133, 0, }, /* 853 */
- { 133, 21, 12, 0, 0, 133, 0, }, /* 854 */
- { 133, 13, 12, 0, 0, 133, 0, }, /* 855 */
- { 133, 15, 12, 0, 0, 133, 0, }, /* 856 */
- { 134, 21, 12, 0, 0, 134, 0, }, /* 857 */
- { 134, 7, 12, 0, 0, 134, 0, }, /* 858 */
- { 134, 12, 3, 0, 0, 134, 0, }, /* 859 */
- { 134, 10, 5, 0, 0, 134, 0, }, /* 860 */
- { 138, 7, 12, 0, 0, 138, 0, }, /* 861 */
- { 138, 12, 3, 0, 0, 138, 0, }, /* 862 */
- { 138, 7, 4, 0, 0, 138, 0, }, /* 863 */
- { 138, 13, 12, 0, 0, 138, 0, }, /* 864 */
- { 143, 7, 12, 0, 0, 143, 0, }, /* 865 */
- { 143, 10, 5, 0, 0, 143, 0, }, /* 866 */
- { 143, 12, 3, 0, 0, 143, 0, }, /* 867 */
- { 143, 13, 12, 0, 0, 143, 0, }, /* 868 */
- { 145, 7, 12, 0, 0, 145, 0, }, /* 869 */
- { 145, 12, 3, 0, 0, 145, 0, }, /* 870 */
- { 145, 10, 5, 0, 0, 145, 0, }, /* 871 */
- { 145, 21, 12, 0, 0, 145, 0, }, /* 872 */
- { 63, 7, 12, 0, 0, 63, 0, }, /* 873 */
- { 63, 14, 12, 0, 0, 63, 0, }, /* 874 */
- { 63, 21, 12, 0, 0, 63, 0, }, /* 875 */
- { 80, 7, 12, 0, 0, 80, 0, }, /* 876 */
- { 127, 7, 12, 0, 0, 127, 0, }, /* 877 */
- { 115, 7, 12, 0, 0, 115, 0, }, /* 878 */
- { 115, 13, 12, 0, 0, 115, 0, }, /* 879 */
- { 115, 21, 12, 0, 0, 115, 0, }, /* 880 */
- { 103, 7, 12, 0, 0, 103, 0, }, /* 881 */
- { 103, 12, 3, 0, 0, 103, 0, }, /* 882 */
- { 103, 21, 12, 0, 0, 103, 0, }, /* 883 */
- { 119, 7, 12, 0, 0, 119, 0, }, /* 884 */
- { 119, 12, 3, 0, 0, 119, 0, }, /* 885 */
- { 119, 21, 12, 0, 0, 119, 0, }, /* 886 */
- { 119, 26, 12, 0, 0, 119, 0, }, /* 887 */
- { 119, 6, 12, 0, 0, 119, 0, }, /* 888 */
- { 119, 13, 12, 0, 0, 119, 0, }, /* 889 */
- { 119, 15, 12, 0, 0, 119, 0, }, /* 890 */
- { 146, 9, 12, 0, 32, 146, 0, }, /* 891 */
- { 146, 5, 12, 0, -32, 146, 0, }, /* 892 */
- { 146, 15, 12, 0, 0, 146, 0, }, /* 893 */
- { 146, 21, 12, 0, 0, 146, 0, }, /* 894 */
- { 99, 7, 12, 0, 0, 99, 0, }, /* 895 */
- { 99, 10, 5, 0, 0, 99, 0, }, /* 896 */
- { 99, 12, 3, 0, 0, 99, 0, }, /* 897 */
- { 99, 6, 12, 0, 0, 99, 0, }, /* 898 */
- { 137, 6, 12, 0, 0, 137, 0, }, /* 899 */
- { 139, 6, 12, 0, 0, 139, 0, }, /* 900 */
- { 137, 7, 12, 0, 0, 137, 0, }, /* 901 */
- { 139, 7, 12, 0, 0, 139, 0, }, /* 902 */
- { 105, 7, 12, 0, 0, 105, 0, }, /* 903 */
- { 105, 26, 12, 0, 0, 105, 0, }, /* 904 */
- { 105, 12, 3, 0, 0, 105, 0, }, /* 905 */
- { 105, 21, 12, 0, 0, 105, 0, }, /* 906 */
- { 10, 1, 2, 0, 0, 105, 0, }, /* 907 */
- { 10, 10, 3, 0, 0, 10, 0, }, /* 908 */
- { 10, 10, 5, 0, 0, 10, 0, }, /* 909 */
- { 20, 12, 3, 0, 0, 20, 0, }, /* 910 */
- { 131, 26, 12, 0, 0, 131, 0, }, /* 911 */
- { 131, 12, 3, 0, 0, 131, 0, }, /* 912 */
- { 131, 21, 12, 0, 0, 131, 0, }, /* 913 */
- { 18, 12, 3, 0, 0, 18, 0, }, /* 914 */
- { 113, 7, 12, 0, 0, 113, 0, }, /* 915 */
- { 113, 15, 12, 0, 0, 113, 0, }, /* 916 */
- { 113, 12, 3, 0, 0, 113, 0, }, /* 917 */
- { 132, 9, 12, 0, 34, 132, 0, }, /* 918 */
- { 132, 5, 12, 0, -34, 132, 0, }, /* 919 */
- { 132, 12, 3, 0, 0, 132, 0, }, /* 920 */
- { 132, 13, 12, 0, 0, 132, 0, }, /* 921 */
- { 132, 21, 12, 0, 0, 132, 0, }, /* 922 */
- { 0, 2, 14, 0, 0, 0, 0, }, /* 923 */
- { 10, 26, 11, 0, 0, 10, 0, }, /* 924 */
- { 27, 26, 12, 0, 0, 27, 0, }, /* 925 */
- { 10, 24, 3, 0, 0, 10, 0, }, /* 926 */
- { 10, 1, 3, 0, 0, 10, 0, }, /* 927 */
+ { 34, 5, 12, 0, 42307, 34, 0, }, /* 102 */
+ { 34, 5, 12, 0, 42282, 34, 0, }, /* 103 */
+ { 34, 5, 12, 0, -69, 34, 0, }, /* 104 */
+ { 34, 5, 12, 0, -217, 34, 0, }, /* 105 */
+ { 34, 5, 12, 0, -71, 34, 0, }, /* 106 */
+ { 34, 5, 12, 0, -219, 34, 0, }, /* 107 */
+ { 34, 5, 12, 0, 42261, 34, 0, }, /* 108 */
+ { 34, 5, 12, 0, 42258, 34, 0, }, /* 109 */
+ { 34, 6, 12, 0, 0, 34, 0, }, /* 110 */
+ { 10, 6, 12, 0, 0, 10, 0, }, /* 111 */
+ { 4, 24, 12, 0, 0, 4, 0, }, /* 112 */
+ { 28, 12, 3, 0, 0, 28, 0, }, /* 113 */
+ { 28, 12, 3, 0, 0, 20, 0, }, /* 114 */
+ { 28, 12, 3, 21, 116, 20, 0, }, /* 115 */
+ { 28, 12, 3, 0, 0, 34, 0, }, /* 116 */
+ { 20, 9, 12, 0, 1, 20, 0, }, /* 117 */
+ { 20, 5, 12, 0, -1, 20, 0, }, /* 118 */
+ { 20, 24, 12, 0, 0, 20, 0, }, /* 119 */
+ { 0, 2, 12, 0, 0, 0, 0, }, /* 120 */
+ { 20, 6, 12, 0, 0, 20, 0, }, /* 121 */
+ { 20, 5, 12, 0, 130, 20, 0, }, /* 122 */
+ { 20, 9, 12, 0, 116, 20, 0, }, /* 123 */
+ { 20, 9, 12, 0, 38, 20, 0, }, /* 124 */
+ { 20, 9, 12, 0, 37, 20, 0, }, /* 125 */
+ { 20, 9, 12, 0, 64, 20, 0, }, /* 126 */
+ { 20, 9, 12, 0, 63, 20, 0, }, /* 127 */
+ { 20, 5, 12, 0, 0, 20, 0, }, /* 128 */
+ { 20, 9, 12, 0, 32, 20, 0, }, /* 129 */
+ { 20, 9, 12, 34, 32, 20, 0, }, /* 130 */
+ { 20, 9, 12, 59, 32, 20, 0, }, /* 131 */
+ { 20, 9, 12, 38, 32, 20, 0, }, /* 132 */
+ { 20, 9, 12, 21, 32, 20, 0, }, /* 133 */
+ { 20, 9, 12, 51, 32, 20, 0, }, /* 134 */
+ { 20, 9, 12, 26, 32, 20, 0, }, /* 135 */
+ { 20, 9, 12, 47, 32, 20, 0, }, /* 136 */
+ { 20, 9, 12, 55, 32, 20, 0, }, /* 137 */
+ { 20, 9, 12, 30, 32, 20, 0, }, /* 138 */
+ { 20, 9, 12, 43, 32, 20, 0, }, /* 139 */
+ { 20, 9, 12, 96, 32, 20, 0, }, /* 140 */
+ { 20, 5, 12, 0, -38, 20, 0, }, /* 141 */
+ { 20, 5, 12, 0, -37, 20, 0, }, /* 142 */
+ { 20, 5, 12, 0, -32, 20, 0, }, /* 143 */
+ { 20, 5, 12, 34, -32, 20, 0, }, /* 144 */
+ { 20, 5, 12, 59, -32, 20, 0, }, /* 145 */
+ { 20, 5, 12, 38, -32, 20, 0, }, /* 146 */
+ { 20, 5, 12, 21, -116, 20, 0, }, /* 147 */
+ { 20, 5, 12, 51, -32, 20, 0, }, /* 148 */
+ { 20, 5, 12, 26, -775, 20, 0, }, /* 149 */
+ { 20, 5, 12, 47, -32, 20, 0, }, /* 150 */
+ { 20, 5, 12, 55, -32, 20, 0, }, /* 151 */
+ { 20, 5, 12, 30, 1, 20, 0, }, /* 152 */
+ { 20, 5, 12, 30, -32, 20, 0, }, /* 153 */
+ { 20, 5, 12, 43, -32, 20, 0, }, /* 154 */
+ { 20, 5, 12, 96, -32, 20, 0, }, /* 155 */
+ { 20, 5, 12, 0, -64, 20, 0, }, /* 156 */
+ { 20, 5, 12, 0, -63, 20, 0, }, /* 157 */
+ { 20, 9, 12, 0, 8, 20, 0, }, /* 158 */
+ { 20, 5, 12, 34, -30, 20, 0, }, /* 159 */
+ { 20, 5, 12, 38, -25, 20, 0, }, /* 160 */
+ { 20, 9, 12, 0, 0, 20, 0, }, /* 161 */
+ { 20, 5, 12, 43, -15, 20, 0, }, /* 162 */
+ { 20, 5, 12, 47, -22, 20, 0, }, /* 163 */
+ { 20, 5, 12, 0, -8, 20, 0, }, /* 164 */
+ { 11, 9, 12, 0, 1, 11, 0, }, /* 165 */
+ { 11, 5, 12, 0, -1, 11, 0, }, /* 166 */
+ { 20, 5, 12, 51, -54, 20, 0, }, /* 167 */
+ { 20, 5, 12, 55, -48, 20, 0, }, /* 168 */
+ { 20, 5, 12, 0, 7, 20, 0, }, /* 169 */
+ { 20, 5, 12, 0, -116, 20, 0, }, /* 170 */
+ { 20, 9, 12, 38, -60, 20, 0, }, /* 171 */
+ { 20, 5, 12, 59, -64, 20, 0, }, /* 172 */
+ { 20, 25, 12, 0, 0, 20, 0, }, /* 173 */
+ { 20, 9, 12, 0, -7, 20, 0, }, /* 174 */
+ { 20, 9, 12, 0, -130, 20, 0, }, /* 175 */
+ { 13, 9, 12, 0, 80, 13, 0, }, /* 176 */
+ { 13, 9, 12, 0, 32, 13, 0, }, /* 177 */
+ { 13, 9, 12, 63, 32, 13, 0, }, /* 178 */
+ { 13, 9, 12, 67, 32, 13, 0, }, /* 179 */
+ { 13, 9, 12, 71, 32, 13, 0, }, /* 180 */
+ { 13, 9, 12, 75, 32, 13, 0, }, /* 181 */
+ { 13, 9, 12, 79, 32, 13, 0, }, /* 182 */
+ { 13, 9, 12, 84, 32, 13, 0, }, /* 183 */
+ { 13, 5, 12, 0, -32, 13, 0, }, /* 184 */
+ { 13, 5, 12, 63, -32, 13, 0, }, /* 185 */
+ { 13, 5, 12, 67, -32, 13, 0, }, /* 186 */
+ { 13, 5, 12, 71, -32, 13, 0, }, /* 187 */
+ { 13, 5, 12, 75, -32, 13, 0, }, /* 188 */
+ { 13, 5, 12, 79, -32, 13, 0, }, /* 189 */
+ { 13, 5, 12, 84, -32, 13, 0, }, /* 190 */
+ { 13, 5, 12, 0, -80, 13, 0, }, /* 191 */
+ { 13, 9, 12, 0, 1, 13, 0, }, /* 192 */
+ { 13, 5, 12, 0, -1, 13, 0, }, /* 193 */
+ { 13, 9, 12, 88, 1, 13, 0, }, /* 194 */
+ { 13, 5, 12, 88, -1, 13, 0, }, /* 195 */
+ { 13, 26, 12, 0, 0, 13, 0, }, /* 196 */
+ { 13, 12, 3, 0, 0, -34, 0, }, /* 197 */
+ { 13, 12, 3, 0, 0, -28, 0, }, /* 198 */
+ { 28, 12, 3, 0, 0, -31, 0, }, /* 199 */
+ { 13, 11, 3, 0, 0, 13, 0, }, /* 200 */
+ { 13, 9, 12, 0, 15, 13, 0, }, /* 201 */
+ { 13, 5, 12, 0, -15, 13, 0, }, /* 202 */
+ { 2, 9, 12, 0, 48, 2, 0, }, /* 203 */
+ { 2, 6, 12, 0, 0, 2, 0, }, /* 204 */
+ { 2, 21, 12, 0, 0, 2, 0, }, /* 205 */
+ { 2, 5, 12, 0, 0, 2, 0, }, /* 206 */
+ { 2, 5, 12, 0, -48, 2, 0, }, /* 207 */
+ { 10, 21, 12, 0, 0, -13, 0, }, /* 208 */
+ { 2, 17, 12, 0, 0, 2, 0, }, /* 209 */
+ { 2, 26, 12, 0, 0, 2, 0, }, /* 210 */
+ { 2, 23, 12, 0, 0, 2, 0, }, /* 211 */
+ { 26, 12, 3, 0, 0, 26, 0, }, /* 212 */
+ { 26, 17, 12, 0, 0, 26, 0, }, /* 213 */
+ { 26, 21, 12, 0, 0, 26, 0, }, /* 214 */
+ { 26, 7, 12, 0, 0, 26, 0, }, /* 215 */
+ { 1, 1, 4, 0, 0, 1, 0, }, /* 216 */
+ { 10, 1, 4, 0, 0, 10, 0, }, /* 217 */
+ { 1, 25, 12, 0, 0, 1, 0, }, /* 218 */
+ { 1, 21, 12, 0, 0, 1, 0, }, /* 219 */
+ { 1, 23, 12, 0, 0, 1, 0, }, /* 220 */
+ { 10, 21, 12, 0, 0, -105, 0, }, /* 221 */
+ { 1, 26, 12, 0, 0, 1, 0, }, /* 222 */
+ { 1, 12, 3, 0, 0, 1, 0, }, /* 223 */
+ { 1, 1, 2, 0, 0, -73, 0, }, /* 224 */
+ { 1, 7, 12, 0, 0, 1, 0, }, /* 225 */
+ { 10, 6, 12, 0, 0, -145, 0, }, /* 226 */
+ { 28, 12, 3, 0, 0, -7, 0, }, /* 227 */
+ { 1, 13, 12, 0, 0, -10, 0, }, /* 228 */
+ { 1, 21, 12, 0, 0, -4, 0, }, /* 229 */
+ { 1, 6, 12, 0, 0, 1, 0, }, /* 230 */
+ { 1, 13, 12, 0, 0, 1, 0, }, /* 231 */
+ { 50, 21, 12, 0, 0, 50, 0, }, /* 232 */
+ { 50, 1, 4, 0, 0, 50, 0, }, /* 233 */
+ { 50, 7, 12, 0, 0, 50, 0, }, /* 234 */
+ { 50, 12, 3, 0, 0, 50, 0, }, /* 235 */
+ { 56, 7, 12, 0, 0, 56, 0, }, /* 236 */
+ { 56, 12, 3, 0, 0, 56, 0, }, /* 237 */
+ { 64, 13, 12, 0, 0, 64, 0, }, /* 238 */
+ { 64, 7, 12, 0, 0, 64, 0, }, /* 239 */
+ { 64, 12, 3, 0, 0, 64, 0, }, /* 240 */
+ { 64, 6, 12, 0, 0, 64, 0, }, /* 241 */
+ { 64, 26, 12, 0, 0, 64, 0, }, /* 242 */
+ { 64, 21, 12, 0, 0, 64, 0, }, /* 243 */
+ { 64, 23, 12, 0, 0, 64, 0, }, /* 244 */
+ { 90, 7, 12, 0, 0, 90, 0, }, /* 245 */
+ { 90, 12, 3, 0, 0, 90, 0, }, /* 246 */
+ { 90, 6, 12, 0, 0, 90, 0, }, /* 247 */
+ { 90, 21, 12, 0, 0, 90, 0, }, /* 248 */
+ { 95, 7, 12, 0, 0, 95, 0, }, /* 249 */
+ { 95, 12, 3, 0, 0, 95, 0, }, /* 250 */
+ { 95, 21, 12, 0, 0, 95, 0, }, /* 251 */
+ { 15, 12, 3, 0, 0, 15, 0, }, /* 252 */
+ { 15, 10, 5, 0, 0, 15, 0, }, /* 253 */
+ { 15, 7, 12, 0, 0, 15, 0, }, /* 254 */
+ { 28, 12, 3, 0, 0, -188, 0, }, /* 255 */
+ { 28, 12, 3, 0, 0, -175, 0, }, /* 256 */
+ { 10, 21, 12, 0, 0, -231, 0, }, /* 257 */
+ { 10, 21, 12, 0, 0, -252, 0, }, /* 258 */
+ { 15, 13, 12, 0, 0, -120, 0, }, /* 259 */
+ { 15, 21, 12, 0, 0, 15, 0, }, /* 260 */
+ { 15, 6, 12, 0, 0, 15, 0, }, /* 261 */
+ { 3, 7, 12, 0, 0, 3, 0, }, /* 262 */
+ { 3, 12, 3, 0, 0, 3, 0, }, /* 263 */
+ { 3, 10, 5, 0, 0, 3, 0, }, /* 264 */
+ { 3, 10, 3, 0, 0, 3, 0, }, /* 265 */
+ { 3, 13, 12, 0, 0, -77, 0, }, /* 266 */
+ { 3, 23, 12, 0, 0, 3, 0, }, /* 267 */
+ { 3, 15, 12, 0, 0, 3, 0, }, /* 268 */
+ { 3, 26, 12, 0, 0, 3, 0, }, /* 269 */
+ { 3, 21, 12, 0, 0, 3, 0, }, /* 270 */
+ { 22, 12, 3, 0, 0, 22, 0, }, /* 271 */
+ { 22, 10, 5, 0, 0, 22, 0, }, /* 272 */
+ { 22, 7, 12, 0, 0, 22, 0, }, /* 273 */
+ { 22, 13, 12, 0, 0, -58, 0, }, /* 274 */
+ { 22, 21, 12, 0, 0, 22, 0, }, /* 275 */
+ { 21, 12, 3, 0, 0, 21, 0, }, /* 276 */
+ { 21, 10, 5, 0, 0, 21, 0, }, /* 277 */
+ { 21, 7, 12, 0, 0, 21, 0, }, /* 278 */
+ { 21, 13, 12, 0, 0, -55, 0, }, /* 279 */
+ { 21, 21, 12, 0, 0, 21, 0, }, /* 280 */
+ { 21, 23, 12, 0, 0, 21, 0, }, /* 281 */
+ { 44, 12, 3, 0, 0, 44, 0, }, /* 282 */
+ { 44, 10, 5, 0, 0, 44, 0, }, /* 283 */
+ { 44, 7, 12, 0, 0, 44, 0, }, /* 284 */
+ { 44, 10, 3, 0, 0, 44, 0, }, /* 285 */
+ { 44, 13, 12, 0, 0, 44, 0, }, /* 286 */
+ { 44, 26, 12, 0, 0, 44, 0, }, /* 287 */
+ { 44, 15, 12, 0, 0, 44, 0, }, /* 288 */
+ { 54, 12, 3, 0, 0, 54, 0, }, /* 289 */
+ { 54, 7, 12, 0, 0, 54, 0, }, /* 290 */
+ { 54, 10, 3, 0, 0, 54, 0, }, /* 291 */
+ { 54, 10, 5, 0, 0, 54, 0, }, /* 292 */
+ { 54, 13, 12, 0, 0, -52, 0, }, /* 293 */
+ { 54, 15, 12, 0, 0, -52, 0, }, /* 294 */
+ { 54, 26, 12, 0, 0, -52, 0, }, /* 295 */
+ { 54, 26, 12, 0, 0, 54, 0, }, /* 296 */
+ { 54, 23, 12, 0, 0, 54, 0, }, /* 297 */
+ { 55, 12, 3, 0, 0, 55, 0, }, /* 298 */
+ { 55, 10, 5, 0, 0, 55, 0, }, /* 299 */
+ { 55, 7, 12, 0, 0, 55, 0, }, /* 300 */
+ { 55, 13, 12, 0, 0, 55, 0, }, /* 301 */
+ { 55, 21, 12, 0, 0, 55, 0, }, /* 302 */
+ { 55, 15, 12, 0, 0, 55, 0, }, /* 303 */
+ { 55, 26, 12, 0, 0, 55, 0, }, /* 304 */
+ { 29, 7, 12, 0, 0, 29, 0, }, /* 305 */
+ { 29, 12, 3, 0, 0, 29, 0, }, /* 306 */
+ { 29, 10, 5, 0, 0, 29, 0, }, /* 307 */
+ { 29, 21, 12, 0, 0, 29, 0, }, /* 308 */
+ { 29, 10, 3, 0, 0, 29, 0, }, /* 309 */
+ { 29, 13, 12, 0, 0, -64, 0, }, /* 310 */
+ { 37, 12, 3, 0, 0, 37, 0, }, /* 311 */
+ { 37, 10, 5, 0, 0, 37, 0, }, /* 312 */
+ { 37, 7, 12, 0, 0, 37, 0, }, /* 313 */
+ { 37, 10, 3, 0, 0, 37, 0, }, /* 314 */
+ { 37, 7, 4, 0, 0, 37, 0, }, /* 315 */
+ { 37, 26, 12, 0, 0, 37, 0, }, /* 316 */
+ { 37, 15, 12, 0, 0, 37, 0, }, /* 317 */
+ { 37, 13, 12, 0, 0, 37, 0, }, /* 318 */
+ { 48, 10, 5, 0, 0, 48, 0, }, /* 319 */
+ { 48, 7, 12, 0, 0, 48, 0, }, /* 320 */
+ { 48, 12, 3, 0, 0, 48, 0, }, /* 321 */
+ { 48, 10, 3, 0, 0, 48, 0, }, /* 322 */
+ { 48, 13, 12, 0, 0, 48, 0, }, /* 323 */
+ { 48, 21, 12, 0, 0, 48, 0, }, /* 324 */
+ { 57, 7, 12, 0, 0, 57, 0, }, /* 325 */
+ { 57, 12, 3, 0, 0, 57, 0, }, /* 326 */
+ { 57, 7, 5, 0, 0, 57, 0, }, /* 327 */
+ { 57, 6, 12, 0, 0, 57, 0, }, /* 328 */
+ { 57, 21, 12, 0, 0, 57, 0, }, /* 329 */
+ { 57, 13, 12, 0, 0, 57, 0, }, /* 330 */
+ { 33, 7, 12, 0, 0, 33, 0, }, /* 331 */
+ { 33, 12, 3, 0, 0, 33, 0, }, /* 332 */
+ { 33, 7, 5, 0, 0, 33, 0, }, /* 333 */
+ { 33, 6, 12, 0, 0, 33, 0, }, /* 334 */
+ { 33, 13, 12, 0, 0, 33, 0, }, /* 335 */
+ { 58, 7, 12, 0, 0, 58, 0, }, /* 336 */
+ { 58, 26, 12, 0, 0, 58, 0, }, /* 337 */
+ { 58, 21, 12, 0, 0, 58, 0, }, /* 338 */
+ { 58, 12, 3, 0, 0, 58, 0, }, /* 339 */
+ { 58, 13, 12, 0, 0, 58, 0, }, /* 340 */
+ { 58, 15, 12, 0, 0, 58, 0, }, /* 341 */
+ { 58, 22, 12, 0, 0, 58, 0, }, /* 342 */
+ { 58, 18, 12, 0, 0, 58, 0, }, /* 343 */
+ { 58, 10, 5, 0, 0, 58, 0, }, /* 344 */
+ { 39, 7, 12, 0, 0, 39, 0, }, /* 345 */
+ { 39, 10, 12, 0, 0, 39, 0, }, /* 346 */
+ { 39, 12, 3, 0, 0, 39, 0, }, /* 347 */
+ { 39, 10, 5, 0, 0, 39, 0, }, /* 348 */
+ { 39, 13, 12, 0, 0, -81, 0, }, /* 349 */
+ { 39, 21, 12, 0, 0, 39, 0, }, /* 350 */
+ { 39, 13, 12, 0, 0, 39, 0, }, /* 351 */
+ { 39, 26, 12, 0, 0, 39, 0, }, /* 352 */
+ { 17, 9, 12, 0, 7264, 17, 0, }, /* 353 */
+ { 17, 5, 12, 0, 3008, 17, 0, }, /* 354 */
+ { 10, 21, 12, 0, 0, -49, 0, }, /* 355 */
+ { 17, 6, 12, 0, 0, 17, 0, }, /* 356 */
+ { 24, 7, 6, 0, 0, 24, 0, }, /* 357 */
+ { 24, 7, 7, 0, 0, 24, 0, }, /* 358 */
+ { 24, 7, 8, 0, 0, 24, 0, }, /* 359 */
+ { 16, 7, 12, 0, 0, 16, 0, }, /* 360 */
+ { 16, 12, 3, 0, 0, 16, 0, }, /* 361 */
+ { 16, 21, 12, 0, 0, 16, 0, }, /* 362 */
+ { 16, 15, 12, 0, 0, 16, 0, }, /* 363 */
+ { 16, 26, 12, 0, 0, 16, 0, }, /* 364 */
+ { 9, 9, 12, 0, 38864, 9, 0, }, /* 365 */
+ { 9, 9, 12, 0, 8, 9, 0, }, /* 366 */
+ { 9, 5, 12, 0, -8, 9, 0, }, /* 367 */
+ { 8, 17, 12, 0, 0, 8, 0, }, /* 368 */
+ { 8, 7, 12, 0, 0, 8, 0, }, /* 369 */
+ { 8, 26, 12, 0, 0, 8, 0, }, /* 370 */
+ { 8, 21, 12, 0, 0, 8, 0, }, /* 371 */
+ { 41, 29, 12, 0, 0, 41, 0, }, /* 372 */
+ { 41, 7, 12, 0, 0, 41, 0, }, /* 373 */
+ { 41, 22, 12, 0, 0, 41, 0, }, /* 374 */
+ { 41, 18, 12, 0, 0, 41, 0, }, /* 375 */
+ { 46, 7, 12, 0, 0, 46, 0, }, /* 376 */
+ { 46, 14, 12, 0, 0, 46, 0, }, /* 377 */
+ { 51, 7, 12, 0, 0, 51, 0, }, /* 378 */
+ { 51, 12, 3, 0, 0, 51, 0, }, /* 379 */
+ { 25, 7, 12, 0, 0, 25, 0, }, /* 380 */
+ { 25, 12, 3, 0, 0, 25, 0, }, /* 381 */
+ { 10, 21, 12, 0, 0, -115, 0, }, /* 382 */
+ { 7, 7, 12, 0, 0, 7, 0, }, /* 383 */
+ { 7, 12, 3, 0, 0, 7, 0, }, /* 384 */
+ { 52, 7, 12, 0, 0, 52, 0, }, /* 385 */
+ { 52, 12, 3, 0, 0, 52, 0, }, /* 386 */
+ { 32, 7, 12, 0, 0, 32, 0, }, /* 387 */
+ { 32, 12, 3, 0, 0, 32, 0, }, /* 388 */
+ { 32, 10, 5, 0, 0, 32, 0, }, /* 389 */
+ { 32, 21, 12, 0, 0, 32, 0, }, /* 390 */
+ { 32, 6, 12, 0, 0, 32, 0, }, /* 391 */
+ { 32, 23, 12, 0, 0, 32, 0, }, /* 392 */
+ { 32, 13, 12, 0, 0, 32, 0, }, /* 393 */
+ { 32, 15, 12, 0, 0, 32, 0, }, /* 394 */
+ { 38, 21, 12, 0, 0, 38, 0, }, /* 395 */
+ { 10, 21, 12, 0, 0, -70, 0, }, /* 396 */
+ { 38, 17, 12, 0, 0, 38, 0, }, /* 397 */
+ { 38, 12, 3, 0, 0, 38, 0, }, /* 398 */
+ { 38, 1, 2, 0, 0, 38, 0, }, /* 399 */
+ { 38, 13, 12, 0, 0, 38, 0, }, /* 400 */
+ { 38, 7, 12, 0, 0, 38, 0, }, /* 401 */
+ { 38, 6, 12, 0, 0, 38, 0, }, /* 402 */
+ { 35, 7, 12, 0, 0, 35, 0, }, /* 403 */
+ { 35, 12, 3, 0, 0, 35, 0, }, /* 404 */
+ { 35, 10, 5, 0, 0, 35, 0, }, /* 405 */
+ { 35, 26, 12, 0, 0, 35, 0, }, /* 406 */
+ { 35, 21, 12, 0, 0, 35, 0, }, /* 407 */
+ { 35, 13, 12, 0, 0, 35, 0, }, /* 408 */
+ { 53, 7, 12, 0, 0, 53, 0, }, /* 409 */
+ { 40, 7, 12, 0, 0, 40, 0, }, /* 410 */
+ { 40, 13, 12, 0, 0, 40, 0, }, /* 411 */
+ { 40, 15, 12, 0, 0, 40, 0, }, /* 412 */
+ { 40, 26, 12, 0, 0, 40, 0, }, /* 413 */
+ { 32, 26, 12, 0, 0, 32, 0, }, /* 414 */
+ { 6, 7, 12, 0, 0, 6, 0, }, /* 415 */
+ { 6, 12, 3, 0, 0, 6, 0, }, /* 416 */
+ { 6, 10, 5, 0, 0, 6, 0, }, /* 417 */
+ { 6, 21, 12, 0, 0, 6, 0, }, /* 418 */
+ { 91, 7, 12, 0, 0, 91, 0, }, /* 419 */
+ { 91, 10, 5, 0, 0, 91, 0, }, /* 420 */
+ { 91, 12, 3, 0, 0, 91, 0, }, /* 421 */
+ { 91, 10, 12, 0, 0, 91, 0, }, /* 422 */
+ { 91, 13, 12, 0, 0, 91, 0, }, /* 423 */
+ { 91, 21, 12, 0, 0, 91, 0, }, /* 424 */
+ { 91, 6, 12, 0, 0, 91, 0, }, /* 425 */
+ { 28, 11, 3, 0, 0, 28, 0, }, /* 426 */
+ { 62, 12, 3, 0, 0, 62, 0, }, /* 427 */
+ { 62, 10, 5, 0, 0, 62, 0, }, /* 428 */
+ { 62, 7, 12, 0, 0, 62, 0, }, /* 429 */
+ { 62, 10, 3, 0, 0, 62, 0, }, /* 430 */
+ { 62, 13, 12, 0, 0, 62, 0, }, /* 431 */
+ { 62, 21, 12, 0, 0, 62, 0, }, /* 432 */
+ { 62, 26, 12, 0, 0, 62, 0, }, /* 433 */
+ { 76, 12, 3, 0, 0, 76, 0, }, /* 434 */
+ { 76, 10, 5, 0, 0, 76, 0, }, /* 435 */
+ { 76, 7, 12, 0, 0, 76, 0, }, /* 436 */
+ { 76, 13, 12, 0, 0, 76, 0, }, /* 437 */
+ { 93, 7, 12, 0, 0, 93, 0, }, /* 438 */
+ { 93, 12, 3, 0, 0, 93, 0, }, /* 439 */
+ { 93, 10, 5, 0, 0, 93, 0, }, /* 440 */
+ { 93, 21, 12, 0, 0, 93, 0, }, /* 441 */
+ { 70, 7, 12, 0, 0, 70, 0, }, /* 442 */
+ { 70, 10, 5, 0, 0, 70, 0, }, /* 443 */
+ { 70, 12, 3, 0, 0, 70, 0, }, /* 444 */
+ { 70, 21, 12, 0, 0, 70, 0, }, /* 445 */
+ { 70, 13, 12, 0, 0, 70, 0, }, /* 446 */
+ { 73, 13, 12, 0, 0, 73, 0, }, /* 447 */
+ { 73, 7, 12, 0, 0, 73, 0, }, /* 448 */
+ { 73, 6, 12, 0, 0, 73, 0, }, /* 449 */
+ { 73, 21, 12, 0, 0, 73, 0, }, /* 450 */
+ { 13, 5, 12, 63, -6222, 13, 0, }, /* 451 */
+ { 13, 5, 12, 67, -6221, 13, 0, }, /* 452 */
+ { 13, 5, 12, 71, -6212, 13, 0, }, /* 453 */
+ { 13, 5, 12, 75, -6210, 13, 0, }, /* 454 */
+ { 13, 5, 12, 79, -6210, 13, 0, }, /* 455 */
+ { 13, 5, 12, 79, -6211, 13, 0, }, /* 456 */
+ { 13, 5, 12, 84, -6204, 13, 0, }, /* 457 */
+ { 13, 5, 12, 88, -6180, 13, 0, }, /* 458 */
+ { 13, 5, 12, 108, 35267, 13, 0, }, /* 459 */
+ { 17, 9, 12, 0, -3008, 17, 0, }, /* 460 */
+ { 76, 21, 12, 0, 0, 76, 0, }, /* 461 */
+ { 28, 12, 3, 0, 0, -110, 0, }, /* 462 */
+ { 28, 12, 3, 0, 0, 15, 0, }, /* 463 */
+ { 10, 21, 12, 0, 0, -37, 0, }, /* 464 */
+ { 28, 12, 3, 0, 0, -16, 0, }, /* 465 */
+ { 28, 12, 3, 0, 0, -43, 0, }, /* 466 */
+ { 28, 12, 3, 0, 0, -138, 0, }, /* 467 */
+ { 10, 10, 5, 0, 0, -16, 0, }, /* 468 */
+ { 10, 7, 12, 0, 0, -40, 0, }, /* 469 */
+ { 10, 7, 12, 0, 0, -16, 0, }, /* 470 */
+ { 10, 7, 12, 0, 0, 15, 0, }, /* 471 */
+ { 10, 7, 12, 0, 0, -154, 0, }, /* 472 */
+ { 10, 7, 12, 0, 0, -37, 0, }, /* 473 */
+ { 28, 12, 3, 0, 0, -89, 0, }, /* 474 */
+ { 10, 10, 5, 0, 0, 3, 0, }, /* 475 */
+ { 28, 12, 3, 0, 0, -37, 0, }, /* 476 */
+ { 10, 7, 12, 0, 0, 150, 0, }, /* 477 */
+ { 13, 5, 12, 0, 0, 13, 0, }, /* 478 */
+ { 13, 6, 12, 0, 0, 13, 0, }, /* 479 */
+ { 34, 5, 12, 0, 35332, 34, 0, }, /* 480 */
+ { 34, 5, 12, 0, 3814, 34, 0, }, /* 481 */
+ { 34, 5, 12, 0, 35384, 34, 0, }, /* 482 */
+ { 34, 9, 12, 92, 1, 34, 0, }, /* 483 */
+ { 34, 5, 12, 92, -1, 34, 0, }, /* 484 */
+ { 34, 5, 12, 92, -58, 34, 0, }, /* 485 */
+ { 34, 9, 12, 0, -7615, 34, 0, }, /* 486 */
+ { 20, 5, 12, 0, 8, 20, 0, }, /* 487 */
+ { 20, 9, 12, 0, -8, 20, 0, }, /* 488 */
+ { 20, 5, 12, 0, 74, 20, 0, }, /* 489 */
+ { 20, 5, 12, 0, 86, 20, 0, }, /* 490 */
+ { 20, 5, 12, 0, 100, 20, 0, }, /* 491 */
+ { 20, 5, 12, 0, 128, 20, 0, }, /* 492 */
+ { 20, 5, 12, 0, 112, 20, 0, }, /* 493 */
+ { 20, 5, 12, 0, 126, 20, 0, }, /* 494 */
+ { 20, 8, 12, 0, -8, 20, 0, }, /* 495 */
+ { 20, 5, 12, 0, 9, 20, 0, }, /* 496 */
+ { 20, 9, 12, 0, -74, 20, 0, }, /* 497 */
+ { 20, 8, 12, 0, -9, 20, 0, }, /* 498 */
+ { 20, 5, 12, 21, -7173, 20, 0, }, /* 499 */
+ { 20, 9, 12, 0, -86, 20, 0, }, /* 500 */
+ { 20, 9, 12, 0, -100, 20, 0, }, /* 501 */
+ { 20, 9, 12, 0, -112, 20, 0, }, /* 502 */
+ { 20, 9, 12, 0, -128, 20, 0, }, /* 503 */
+ { 20, 9, 12, 0, -126, 20, 0, }, /* 504 */
+ { 28, 1, 3, 0, 0, 28, 0, }, /* 505 */
+ { 28, 1, 13, 0, 0, 28, 0, }, /* 506 */
+ { 10, 27, 2, 0, 0, 10, 0, }, /* 507 */
+ { 10, 28, 2, 0, 0, 10, 0, }, /* 508 */
+ { 10, 29, 12, 0, 0, -67, 0, }, /* 509 */
+ { 10, 21, 14, 0, 0, 10, 0, }, /* 510 */
+ { 0, 2, 2, 0, 0, 0, 0, }, /* 511 */
+ { 28, 12, 3, 0, 0, -93, 0, }, /* 512 */
+ { 10, 9, 12, 0, 0, 10, 0, }, /* 513 */
+ { 10, 5, 12, 0, 0, 10, 0, }, /* 514 */
+ { 20, 9, 12, 96, -7517, 20, 0, }, /* 515 */
+ { 34, 9, 12, 100, -8383, 34, 0, }, /* 516 */
+ { 34, 9, 12, 104, -8262, 34, 0, }, /* 517 */
+ { 34, 9, 12, 0, 28, 34, 0, }, /* 518 */
+ { 10, 7, 12, 0, 0, 10, 0, }, /* 519 */
+ { 10, 5, 14, 0, 0, 10, 0, }, /* 520 */
+ { 34, 5, 12, 0, -28, 34, 0, }, /* 521 */
+ { 34, 14, 12, 0, 16, 34, 0, }, /* 522 */
+ { 34, 14, 12, 0, -16, 34, 0, }, /* 523 */
+ { 34, 14, 12, 0, 0, 34, 0, }, /* 524 */
+ { 10, 25, 14, 0, 0, 10, 0, }, /* 525 */
+ { 10, 26, 12, 0, 26, 10, 0, }, /* 526 */
+ { 10, 26, 14, 0, 26, 10, 0, }, /* 527 */
+ { 10, 26, 12, 0, -26, 10, 0, }, /* 528 */
+ { 5, 26, 12, 0, 0, 5, 0, }, /* 529 */
+ { 18, 9, 12, 0, 48, 18, 0, }, /* 530 */
+ { 18, 5, 12, 0, -48, 18, 0, }, /* 531 */
+ { 34, 9, 12, 0, -10743, 34, 0, }, /* 532 */
+ { 34, 9, 12, 0, -3814, 34, 0, }, /* 533 */
+ { 34, 9, 12, 0, -10727, 34, 0, }, /* 534 */
+ { 34, 5, 12, 0, -10795, 34, 0, }, /* 535 */
+ { 34, 5, 12, 0, -10792, 34, 0, }, /* 536 */
+ { 34, 9, 12, 0, -10780, 34, 0, }, /* 537 */
+ { 34, 9, 12, 0, -10749, 34, 0, }, /* 538 */
+ { 34, 9, 12, 0, -10783, 34, 0, }, /* 539 */
+ { 34, 9, 12, 0, -10782, 34, 0, }, /* 540 */
+ { 34, 9, 12, 0, -10815, 34, 0, }, /* 541 */
+ { 11, 5, 12, 0, 0, 11, 0, }, /* 542 */
+ { 11, 26, 12, 0, 0, 11, 0, }, /* 543 */
+ { 11, 12, 3, 0, 0, 11, 0, }, /* 544 */
+ { 11, 21, 12, 0, 0, 11, 0, }, /* 545 */
+ { 11, 15, 12, 0, 0, 11, 0, }, /* 546 */
+ { 17, 5, 12, 0, -7264, 17, 0, }, /* 547 */
+ { 59, 7, 12, 0, 0, 59, 0, }, /* 548 */
+ { 59, 6, 12, 0, 0, 59, 0, }, /* 549 */
+ { 59, 21, 12, 0, 0, 59, 0, }, /* 550 */
+ { 59, 12, 3, 0, 0, 59, 0, }, /* 551 */
+ { 13, 12, 3, 0, 0, 13, 0, }, /* 552 */
+ { 10, 21, 12, 0, 0, -28, 0, }, /* 553 */
+ { 23, 26, 12, 0, 0, 23, 0, }, /* 554 */
+ { 10, 21, 12, 0, 0, -131, 0, }, /* 555 */
+ { 10, 21, 12, 0, 0, -125, 0, }, /* 556 */
+ { 23, 6, 12, 0, 0, 23, 0, }, /* 557 */
+ { 10, 7, 12, 0, 0, 23, 0, }, /* 558 */
+ { 23, 14, 12, 0, 0, 23, 0, }, /* 559 */
+ { 10, 22, 12, 0, 0, -131, 0, }, /* 560 */
+ { 10, 18, 12, 0, 0, -131, 0, }, /* 561 */
+ { 10, 26, 12, 0, 0, -125, 0, }, /* 562 */
+ { 10, 17, 12, 0, 0, -125, 0, }, /* 563 */
+ { 10, 22, 12, 0, 0, -125, 0, }, /* 564 */
+ { 10, 18, 12, 0, 0, -125, 0, }, /* 565 */
+ { 28, 12, 3, 0, 0, -19, 0, }, /* 566 */
+ { 24, 10, 3, 0, 0, 24, 0, }, /* 567 */
+ { 10, 17, 14, 0, 0, -125, 0, }, /* 568 */
+ { 10, 6, 12, 0, 0, -61, 0, }, /* 569 */
+ { 10, 7, 12, 0, 0, -97, 0, }, /* 570 */
+ { 10, 21, 14, 0, 0, -97, 0, }, /* 571 */
+ { 10, 26, 12, 0, 0, 23, 0, }, /* 572 */
+ { 27, 7, 12, 0, 0, 27, 0, }, /* 573 */
+ { 28, 12, 3, 0, 0, -61, 0, }, /* 574 */
+ { 10, 24, 12, 0, 0, -61, 0, }, /* 575 */
+ { 27, 6, 12, 0, 0, 27, 0, }, /* 576 */
+ { 10, 17, 12, 0, 0, -61, 0, }, /* 577 */
+ { 30, 7, 12, 0, 0, 30, 0, }, /* 578 */
+ { 30, 6, 12, 0, 0, 30, 0, }, /* 579 */
+ { 4, 7, 12, 0, 0, 4, 0, }, /* 580 */
+ { 24, 7, 12, 0, 0, 24, 0, }, /* 581 */
+ { 10, 15, 12, 0, 0, 23, 0, }, /* 582 */
+ { 24, 26, 12, 0, 0, 24, 0, }, /* 583 */
+ { 10, 26, 14, 0, 0, 23, 0, }, /* 584 */
+ { 30, 26, 12, 0, 0, 30, 0, }, /* 585 */
+ { 23, 7, 12, 0, 0, 23, 0, }, /* 586 */
+ { 61, 7, 12, 0, 0, 61, 0, }, /* 587 */
+ { 61, 6, 12, 0, 0, 61, 0, }, /* 588 */
+ { 61, 26, 12, 0, 0, 61, 0, }, /* 589 */
+ { 86, 7, 12, 0, 0, 86, 0, }, /* 590 */
+ { 86, 6, 12, 0, 0, 86, 0, }, /* 591 */
+ { 86, 21, 12, 0, 0, 86, 0, }, /* 592 */
+ { 77, 7, 12, 0, 0, 77, 0, }, /* 593 */
+ { 77, 6, 12, 0, 0, 77, 0, }, /* 594 */
+ { 77, 21, 12, 0, 0, 77, 0, }, /* 595 */
+ { 77, 13, 12, 0, 0, 77, 0, }, /* 596 */
+ { 13, 9, 12, 108, 1, 13, 0, }, /* 597 */
+ { 13, 5, 12, 108, -35267, 13, 0, }, /* 598 */
+ { 13, 7, 12, 0, 0, 13, 0, }, /* 599 */
+ { 13, 21, 12, 0, 0, 13, 0, }, /* 600 */
+ { 79, 7, 12, 0, 0, 79, 0, }, /* 601 */
+ { 79, 14, 12, 0, 0, 79, 0, }, /* 602 */
+ { 79, 12, 3, 0, 0, 79, 0, }, /* 603 */
+ { 79, 21, 12, 0, 0, 79, 0, }, /* 604 */
+ { 34, 9, 12, 0, -35332, 34, 0, }, /* 605 */
+ { 34, 9, 12, 0, -42280, 34, 0, }, /* 606 */
+ { 34, 5, 12, 0, 48, 34, 0, }, /* 607 */
+ { 34, 9, 12, 0, -42308, 34, 0, }, /* 608 */
+ { 34, 9, 12, 0, -42319, 34, 0, }, /* 609 */
+ { 34, 9, 12, 0, -42315, 34, 0, }, /* 610 */
+ { 34, 9, 12, 0, -42305, 34, 0, }, /* 611 */
+ { 34, 9, 12, 0, -42258, 34, 0, }, /* 612 */
+ { 34, 9, 12, 0, -42282, 34, 0, }, /* 613 */
+ { 34, 9, 12, 0, -42261, 34, 0, }, /* 614 */
+ { 34, 9, 12, 0, 928, 34, 0, }, /* 615 */
+ { 34, 9, 12, 0, -48, 34, 0, }, /* 616 */
+ { 34, 9, 12, 0, -42307, 34, 0, }, /* 617 */
+ { 34, 9, 12, 0, -35384, 34, 0, }, /* 618 */
+ { 49, 7, 12, 0, 0, 49, 0, }, /* 619 */
+ { 49, 12, 3, 0, 0, 49, 0, }, /* 620 */
+ { 49, 10, 5, 0, 0, 49, 0, }, /* 621 */
+ { 49, 26, 12, 0, 0, 49, 0, }, /* 622 */
+ { 10, 15, 12, 0, 0, -216, 0, }, /* 623 */
+ { 10, 15, 12, 0, 0, -202, 0, }, /* 624 */
+ { 10, 26, 12, 0, 0, -163, 0, }, /* 625 */
+ { 10, 23, 12, 0, 0, -163, 0, }, /* 626 */
+ { 65, 7, 12, 0, 0, 65, 0, }, /* 627 */
+ { 65, 21, 12, 0, 0, 65, 0, }, /* 628 */
+ { 75, 10, 5, 0, 0, 75, 0, }, /* 629 */
+ { 75, 7, 12, 0, 0, 75, 0, }, /* 630 */
+ { 75, 12, 3, 0, 0, 75, 0, }, /* 631 */
+ { 75, 21, 12, 0, 0, 75, 0, }, /* 632 */
+ { 75, 13, 12, 0, 0, 75, 0, }, /* 633 */
+ { 15, 12, 3, 0, 0, -16, 0, }, /* 634 */
+ { 15, 7, 12, 0, 0, -46, 0, }, /* 635 */
+ { 69, 13, 12, 0, 0, 69, 0, }, /* 636 */
+ { 69, 7, 12, 0, 0, 69, 0, }, /* 637 */
+ { 69, 12, 3, 0, 0, 69, 0, }, /* 638 */
+ { 10, 21, 12, 0, 0, -101, 0, }, /* 639 */
+ { 69, 21, 12, 0, 0, 69, 0, }, /* 640 */
+ { 74, 7, 12, 0, 0, 74, 0, }, /* 641 */
+ { 74, 12, 3, 0, 0, 74, 0, }, /* 642 */
+ { 74, 10, 5, 0, 0, 74, 0, }, /* 643 */
+ { 74, 21, 12, 0, 0, 74, 0, }, /* 644 */
+ { 84, 12, 3, 0, 0, 84, 0, }, /* 645 */
+ { 84, 10, 5, 0, 0, 84, 0, }, /* 646 */
+ { 84, 7, 12, 0, 0, 84, 0, }, /* 647 */
+ { 84, 21, 12, 0, 0, 84, 0, }, /* 648 */
+ { 10, 6, 12, 0, 0, -22, 0, }, /* 649 */
+ { 84, 13, 12, 0, 0, 84, 0, }, /* 650 */
+ { 39, 6, 12, 0, 0, 39, 0, }, /* 651 */
+ { 68, 7, 12, 0, 0, 68, 0, }, /* 652 */
+ { 68, 12, 3, 0, 0, 68, 0, }, /* 653 */
+ { 68, 10, 5, 0, 0, 68, 0, }, /* 654 */
+ { 68, 13, 12, 0, 0, 68, 0, }, /* 655 */
+ { 68, 21, 12, 0, 0, 68, 0, }, /* 656 */
+ { 92, 7, 12, 0, 0, 92, 0, }, /* 657 */
+ { 92, 12, 3, 0, 0, 92, 0, }, /* 658 */
+ { 92, 6, 12, 0, 0, 92, 0, }, /* 659 */
+ { 92, 21, 12, 0, 0, 92, 0, }, /* 660 */
+ { 87, 7, 12, 0, 0, 87, 0, }, /* 661 */
+ { 87, 10, 5, 0, 0, 87, 0, }, /* 662 */
+ { 87, 12, 3, 0, 0, 87, 0, }, /* 663 */
+ { 87, 21, 12, 0, 0, 87, 0, }, /* 664 */
+ { 87, 6, 12, 0, 0, 87, 0, }, /* 665 */
+ { 34, 5, 12, 0, -928, 34, 0, }, /* 666 */
+ { 9, 5, 12, 0, -38864, 9, 0, }, /* 667 */
+ { 87, 13, 12, 0, 0, 87, 0, }, /* 668 */
+ { 24, 7, 9, 0, 0, 24, 0, }, /* 669 */
+ { 24, 7, 10, 0, 0, 24, 0, }, /* 670 */
+ { 0, 4, 12, 0, 0, 0, 0, }, /* 671 */
+ { 0, 3, 12, 0, 0, 0, 0, }, /* 672 */
+ { 26, 25, 12, 0, 0, 26, 0, }, /* 673 */
+ { 1, 24, 12, 0, 0, 1, 0, }, /* 674 */
+ { 1, 7, 12, 0, 0, -10, 0, }, /* 675 */
+ { 1, 26, 12, 0, 0, -10, 0, }, /* 676 */
+ { 10, 6, 3, 0, 0, -61, 0, }, /* 677 */
+ { 36, 7, 12, 0, 0, 36, 0, }, /* 678 */
+ { 10, 21, 12, 0, 0, -25, 0, }, /* 679 */
+ { 10, 15, 12, 0, 0, -85, 0, }, /* 680 */
+ { 10, 26, 12, 0, 0, -25, 0, }, /* 681 */
+ { 20, 14, 12, 0, 0, 20, 0, }, /* 682 */
+ { 20, 15, 12, 0, 0, 20, 0, }, /* 683 */
+ { 20, 26, 12, 0, 0, 20, 0, }, /* 684 */
+ { 71, 7, 12, 0, 0, 71, 0, }, /* 685 */
+ { 67, 7, 12, 0, 0, 67, 0, }, /* 686 */
+ { 28, 12, 3, 0, 0, -1, 0, }, /* 687 */
+ { 10, 15, 12, 0, 0, -1, 0, }, /* 688 */
+ { 42, 7, 12, 0, 0, 42, 0, }, /* 689 */
+ { 42, 15, 12, 0, 0, 42, 0, }, /* 690 */
+ { 19, 7, 12, 0, 0, 19, 0, }, /* 691 */
+ { 19, 14, 12, 0, 0, 19, 0, }, /* 692 */
+ { 118, 7, 12, 0, 0, 118, 0, }, /* 693 */
+ { 118, 12, 3, 0, 0, 118, 0, }, /* 694 */
+ { 60, 7, 12, 0, 0, 60, 0, }, /* 695 */
+ { 60, 21, 12, 0, 0, 60, 0, }, /* 696 */
+ { 43, 7, 12, 0, 0, 43, 0, }, /* 697 */
+ { 43, 21, 12, 0, 0, 43, 0, }, /* 698 */
+ { 43, 14, 12, 0, 0, 43, 0, }, /* 699 */
+ { 14, 9, 12, 0, 40, 14, 0, }, /* 700 */
+ { 14, 5, 12, 0, -40, 14, 0, }, /* 701 */
+ { 47, 7, 12, 0, 0, 47, 0, }, /* 702 */
+ { 45, 7, 12, 0, 0, 45, 0, }, /* 703 */
+ { 45, 13, 12, 0, 0, 45, 0, }, /* 704 */
+ { 136, 9, 12, 0, 40, 136, 0, }, /* 705 */
+ { 136, 5, 12, 0, -40, 136, 0, }, /* 706 */
+ { 106, 7, 12, 0, 0, 106, 0, }, /* 707 */
+ { 104, 7, 12, 0, 0, 104, 0, }, /* 708 */
+ { 104, 21, 12, 0, 0, 104, 0, }, /* 709 */
+ { 110, 7, 12, 0, 0, 110, 0, }, /* 710 */
+ { 12, 7, 12, 0, 0, 12, 0, }, /* 711 */
+ { 81, 7, 12, 0, 0, 81, 0, }, /* 712 */
+ { 81, 21, 12, 0, 0, 81, 0, }, /* 713 */
+ { 81, 15, 12, 0, 0, 81, 0, }, /* 714 */
+ { 120, 7, 12, 0, 0, 120, 0, }, /* 715 */
+ { 120, 26, 12, 0, 0, 120, 0, }, /* 716 */
+ { 120, 15, 12, 0, 0, 120, 0, }, /* 717 */
+ { 116, 7, 12, 0, 0, 116, 0, }, /* 718 */
+ { 116, 15, 12, 0, 0, 116, 0, }, /* 719 */
+ { 128, 7, 12, 0, 0, 128, 0, }, /* 720 */
+ { 128, 15, 12, 0, 0, 128, 0, }, /* 721 */
+ { 66, 7, 12, 0, 0, 66, 0, }, /* 722 */
+ { 66, 15, 12, 0, 0, 66, 0, }, /* 723 */
+ { 66, 21, 12, 0, 0, 66, 0, }, /* 724 */
+ { 72, 7, 12, 0, 0, 72, 0, }, /* 725 */
+ { 72, 21, 12, 0, 0, 72, 0, }, /* 726 */
+ { 98, 7, 12, 0, 0, 98, 0, }, /* 727 */
+ { 97, 7, 12, 0, 0, 97, 0, }, /* 728 */
+ { 97, 15, 12, 0, 0, 97, 0, }, /* 729 */
+ { 31, 7, 12, 0, 0, 31, 0, }, /* 730 */
+ { 31, 12, 3, 0, 0, 31, 0, }, /* 731 */
+ { 31, 15, 12, 0, 0, 31, 0, }, /* 732 */
+ { 31, 21, 12, 0, 0, 31, 0, }, /* 733 */
+ { 88, 7, 12, 0, 0, 88, 0, }, /* 734 */
+ { 88, 15, 12, 0, 0, 88, 0, }, /* 735 */
+ { 88, 21, 12, 0, 0, 88, 0, }, /* 736 */
+ { 117, 7, 12, 0, 0, 117, 0, }, /* 737 */
+ { 117, 15, 12, 0, 0, 117, 0, }, /* 738 */
+ { 112, 7, 12, 0, 0, 112, 0, }, /* 739 */
+ { 112, 26, 12, 0, 0, 112, 0, }, /* 740 */
+ { 112, 12, 3, 0, 0, 112, 0, }, /* 741 */
+ { 112, 15, 12, 0, 0, 112, 0, }, /* 742 */
+ { 112, 21, 12, 0, 0, 112, 0, }, /* 743 */
+ { 78, 7, 12, 0, 0, 78, 0, }, /* 744 */
+ { 78, 21, 12, 0, 0, 78, 0, }, /* 745 */
+ { 83, 7, 12, 0, 0, 83, 0, }, /* 746 */
+ { 83, 15, 12, 0, 0, 83, 0, }, /* 747 */
+ { 82, 7, 12, 0, 0, 82, 0, }, /* 748 */
+ { 82, 15, 12, 0, 0, 82, 0, }, /* 749 */
+ { 121, 7, 12, 0, 0, 121, 0, }, /* 750 */
+ { 121, 21, 12, 0, 0, 121, 0, }, /* 751 */
+ { 121, 15, 12, 0, 0, 121, 0, }, /* 752 */
+ { 89, 7, 12, 0, 0, 89, 0, }, /* 753 */
+ { 130, 9, 12, 0, 64, 130, 0, }, /* 754 */
+ { 130, 5, 12, 0, -64, 130, 0, }, /* 755 */
+ { 130, 15, 12, 0, 0, 130, 0, }, /* 756 */
+ { 144, 7, 12, 0, 0, 144, 0, }, /* 757 */
+ { 144, 12, 3, 0, 0, 144, 0, }, /* 758 */
+ { 144, 13, 12, 0, 0, 144, 0, }, /* 759 */
+ { 1, 15, 12, 0, 0, 1, 0, }, /* 760 */
+ { 147, 7, 12, 0, 0, 147, 0, }, /* 761 */
+ { 147, 15, 12, 0, 0, 147, 0, }, /* 762 */
+ { 148, 7, 12, 0, 0, 148, 0, }, /* 763 */
+ { 148, 12, 3, 0, 0, 148, 0, }, /* 764 */
+ { 148, 15, 12, 0, 0, 148, 0, }, /* 765 */
+ { 148, 21, 12, 0, 0, 148, 0, }, /* 766 */
+ { 149, 7, 12, 0, 0, 149, 0, }, /* 767 */
+ { 94, 10, 5, 0, 0, 94, 0, }, /* 768 */
+ { 94, 12, 3, 0, 0, 94, 0, }, /* 769 */
+ { 94, 7, 12, 0, 0, 94, 0, }, /* 770 */
+ { 94, 21, 12, 0, 0, 94, 0, }, /* 771 */
+ { 94, 15, 12, 0, 0, 94, 0, }, /* 772 */
+ { 94, 13, 12, 0, 0, 94, 0, }, /* 773 */
+ { 85, 12, 3, 0, 0, 85, 0, }, /* 774 */
+ { 85, 10, 5, 0, 0, 85, 0, }, /* 775 */
+ { 85, 7, 12, 0, 0, 85, 0, }, /* 776 */
+ { 85, 21, 12, 0, 0, 85, 0, }, /* 777 */
+ { 85, 1, 4, 0, 0, 85, 0, }, /* 778 */
+ { 101, 7, 12, 0, 0, 101, 0, }, /* 779 */
+ { 101, 13, 12, 0, 0, 101, 0, }, /* 780 */
+ { 96, 12, 3, 0, 0, 96, 0, }, /* 781 */
+ { 96, 7, 12, 0, 0, 96, 0, }, /* 782 */
+ { 96, 10, 5, 0, 0, 96, 0, }, /* 783 */
+ { 96, 13, 12, 0, 0, 96, 0, }, /* 784 */
+ { 96, 21, 12, 0, 0, 96, 0, }, /* 785 */
+ { 111, 7, 12, 0, 0, 111, 0, }, /* 786 */
+ { 111, 12, 3, 0, 0, 111, 0, }, /* 787 */
+ { 111, 21, 12, 0, 0, 111, 0, }, /* 788 */
+ { 100, 12, 3, 0, 0, 100, 0, }, /* 789 */
+ { 100, 10, 5, 0, 0, 100, 0, }, /* 790 */
+ { 100, 7, 12, 0, 0, 100, 0, }, /* 791 */
+ { 100, 7, 4, 0, 0, 100, 0, }, /* 792 */
+ { 100, 21, 12, 0, 0, 100, 0, }, /* 793 */
+ { 100, 13, 12, 0, 0, 100, 0, }, /* 794 */
+ { 48, 15, 12, 0, 0, 48, 0, }, /* 795 */
+ { 108, 7, 12, 0, 0, 108, 0, }, /* 796 */
+ { 108, 10, 5, 0, 0, 108, 0, }, /* 797 */
+ { 108, 12, 3, 0, 0, 108, 0, }, /* 798 */
+ { 108, 21, 12, 0, 0, 108, 0, }, /* 799 */
+ { 129, 7, 12, 0, 0, 129, 0, }, /* 800 */
+ { 129, 21, 12, 0, 0, 129, 0, }, /* 801 */
+ { 109, 7, 12, 0, 0, 109, 0, }, /* 802 */
+ { 109, 12, 3, 0, 0, 109, 0, }, /* 803 */
+ { 109, 10, 5, 0, 0, 109, 0, }, /* 804 */
+ { 109, 13, 12, 0, 0, 109, 0, }, /* 805 */
+ { 107, 12, 3, 0, 0, 107, 0, }, /* 806 */
+ { 107, 12, 3, 0, 0, -52, 0, }, /* 807 */
+ { 107, 10, 5, 0, 0, 107, 0, }, /* 808 */
+ { 107, 10, 5, 0, 0, -52, 0, }, /* 809 */
+ { 107, 7, 12, 0, 0, 107, 0, }, /* 810 */
+ { 28, 12, 3, 0, 0, -52, 0, }, /* 811 */
+ { 107, 10, 3, 0, 0, 107, 0, }, /* 812 */
+ { 135, 7, 12, 0, 0, 135, 0, }, /* 813 */
+ { 135, 10, 5, 0, 0, 135, 0, }, /* 814 */
+ { 135, 12, 3, 0, 0, 135, 0, }, /* 815 */
+ { 135, 21, 12, 0, 0, 135, 0, }, /* 816 */
+ { 135, 13, 12, 0, 0, 135, 0, }, /* 817 */
+ { 124, 7, 12, 0, 0, 124, 0, }, /* 818 */
+ { 124, 10, 3, 0, 0, 124, 0, }, /* 819 */
+ { 124, 10, 5, 0, 0, 124, 0, }, /* 820 */
+ { 124, 12, 3, 0, 0, 124, 0, }, /* 821 */
+ { 124, 21, 12, 0, 0, 124, 0, }, /* 822 */
+ { 124, 13, 12, 0, 0, 124, 0, }, /* 823 */
+ { 123, 7, 12, 0, 0, 123, 0, }, /* 824 */
+ { 123, 10, 3, 0, 0, 123, 0, }, /* 825 */
+ { 123, 10, 5, 0, 0, 123, 0, }, /* 826 */
+ { 123, 12, 3, 0, 0, 123, 0, }, /* 827 */
+ { 123, 21, 12, 0, 0, 123, 0, }, /* 828 */
+ { 114, 7, 12, 0, 0, 114, 0, }, /* 829 */
+ { 114, 10, 5, 0, 0, 114, 0, }, /* 830 */
+ { 114, 12, 3, 0, 0, 114, 0, }, /* 831 */
+ { 114, 21, 12, 0, 0, 114, 0, }, /* 832 */
+ { 114, 13, 12, 0, 0, 114, 0, }, /* 833 */
+ { 102, 7, 12, 0, 0, 102, 0, }, /* 834 */
+ { 102, 12, 3, 0, 0, 102, 0, }, /* 835 */
+ { 102, 10, 5, 0, 0, 102, 0, }, /* 836 */
+ { 102, 13, 12, 0, 0, 102, 0, }, /* 837 */
+ { 126, 7, 12, 0, 0, 126, 0, }, /* 838 */
+ { 126, 12, 3, 0, 0, 126, 0, }, /* 839 */
+ { 126, 10, 5, 0, 0, 126, 0, }, /* 840 */
+ { 126, 13, 12, 0, 0, 126, 0, }, /* 841 */
+ { 126, 15, 12, 0, 0, 126, 0, }, /* 842 */
+ { 126, 21, 12, 0, 0, 126, 0, }, /* 843 */
+ { 126, 26, 12, 0, 0, 126, 0, }, /* 844 */
+ { 142, 7, 12, 0, 0, 142, 0, }, /* 845 */
+ { 142, 10, 5, 0, 0, 142, 0, }, /* 846 */
+ { 142, 12, 3, 0, 0, 142, 0, }, /* 847 */
+ { 142, 21, 12, 0, 0, 142, 0, }, /* 848 */
+ { 125, 9, 12, 0, 32, 125, 0, }, /* 849 */
+ { 125, 5, 12, 0, -32, 125, 0, }, /* 850 */
+ { 125, 13, 12, 0, 0, 125, 0, }, /* 851 */
+ { 125, 15, 12, 0, 0, 125, 0, }, /* 852 */
+ { 125, 7, 12, 0, 0, 125, 0, }, /* 853 */
+ { 150, 7, 12, 0, 0, 150, 0, }, /* 854 */
+ { 150, 10, 5, 0, 0, 150, 0, }, /* 855 */
+ { 150, 12, 3, 0, 0, 150, 0, }, /* 856 */
+ { 150, 21, 12, 0, 0, 150, 0, }, /* 857 */
+ { 141, 7, 12, 0, 0, 141, 0, }, /* 858 */
+ { 141, 12, 3, 0, 0, 141, 0, }, /* 859 */
+ { 141, 10, 5, 0, 0, 141, 0, }, /* 860 */
+ { 141, 7, 4, 0, 0, 141, 0, }, /* 861 */
+ { 141, 21, 12, 0, 0, 141, 0, }, /* 862 */
+ { 140, 7, 12, 0, 0, 140, 0, }, /* 863 */
+ { 140, 12, 3, 0, 0, 140, 0, }, /* 864 */
+ { 140, 10, 5, 0, 0, 140, 0, }, /* 865 */
+ { 140, 7, 4, 0, 0, 140, 0, }, /* 866 */
+ { 140, 21, 12, 0, 0, 140, 0, }, /* 867 */
+ { 122, 7, 12, 0, 0, 122, 0, }, /* 868 */
+ { 133, 7, 12, 0, 0, 133, 0, }, /* 869 */
+ { 133, 10, 5, 0, 0, 133, 0, }, /* 870 */
+ { 133, 12, 3, 0, 0, 133, 0, }, /* 871 */
+ { 133, 21, 12, 0, 0, 133, 0, }, /* 872 */
+ { 133, 13, 12, 0, 0, 133, 0, }, /* 873 */
+ { 133, 15, 12, 0, 0, 133, 0, }, /* 874 */
+ { 134, 21, 12, 0, 0, 134, 0, }, /* 875 */
+ { 134, 7, 12, 0, 0, 134, 0, }, /* 876 */
+ { 134, 12, 3, 0, 0, 134, 0, }, /* 877 */
+ { 134, 10, 5, 0, 0, 134, 0, }, /* 878 */
+ { 138, 7, 12, 0, 0, 138, 0, }, /* 879 */
+ { 138, 12, 3, 0, 0, 138, 0, }, /* 880 */
+ { 138, 7, 4, 0, 0, 138, 0, }, /* 881 */
+ { 138, 13, 12, 0, 0, 138, 0, }, /* 882 */
+ { 143, 7, 12, 0, 0, 143, 0, }, /* 883 */
+ { 143, 10, 5, 0, 0, 143, 0, }, /* 884 */
+ { 143, 12, 3, 0, 0, 143, 0, }, /* 885 */
+ { 143, 13, 12, 0, 0, 143, 0, }, /* 886 */
+ { 145, 7, 12, 0, 0, 145, 0, }, /* 887 */
+ { 145, 12, 3, 0, 0, 145, 0, }, /* 888 */
+ { 145, 10, 5, 0, 0, 145, 0, }, /* 889 */
+ { 145, 21, 12, 0, 0, 145, 0, }, /* 890 */
+ { 54, 15, 12, 0, 0, 54, 0, }, /* 891 */
+ { 54, 21, 12, 0, 0, 54, 0, }, /* 892 */
+ { 63, 7, 12, 0, 0, 63, 0, }, /* 893 */
+ { 63, 14, 12, 0, 0, 63, 0, }, /* 894 */
+ { 63, 21, 12, 0, 0, 63, 0, }, /* 895 */
+ { 80, 7, 12, 0, 0, 80, 0, }, /* 896 */
+ { 80, 1, 2, 0, 0, 80, 0, }, /* 897 */
+ { 127, 7, 12, 0, 0, 127, 0, }, /* 898 */
+ { 115, 7, 12, 0, 0, 115, 0, }, /* 899 */
+ { 115, 13, 12, 0, 0, 115, 0, }, /* 900 */
+ { 115, 21, 12, 0, 0, 115, 0, }, /* 901 */
+ { 103, 7, 12, 0, 0, 103, 0, }, /* 902 */
+ { 103, 12, 3, 0, 0, 103, 0, }, /* 903 */
+ { 103, 21, 12, 0, 0, 103, 0, }, /* 904 */
+ { 119, 7, 12, 0, 0, 119, 0, }, /* 905 */
+ { 119, 12, 3, 0, 0, 119, 0, }, /* 906 */
+ { 119, 21, 12, 0, 0, 119, 0, }, /* 907 */
+ { 119, 26, 12, 0, 0, 119, 0, }, /* 908 */
+ { 119, 6, 12, 0, 0, 119, 0, }, /* 909 */
+ { 119, 13, 12, 0, 0, 119, 0, }, /* 910 */
+ { 119, 15, 12, 0, 0, 119, 0, }, /* 911 */
+ { 146, 9, 12, 0, 32, 146, 0, }, /* 912 */
+ { 146, 5, 12, 0, -32, 146, 0, }, /* 913 */
+ { 146, 15, 12, 0, 0, 146, 0, }, /* 914 */
+ { 146, 21, 12, 0, 0, 146, 0, }, /* 915 */
+ { 99, 7, 12, 0, 0, 99, 0, }, /* 916 */
+ { 99, 12, 3, 0, 0, 99, 0, }, /* 917 */
+ { 99, 10, 5, 0, 0, 99, 0, }, /* 918 */
+ { 99, 6, 12, 0, 0, 99, 0, }, /* 919 */
+ { 137, 6, 12, 0, 0, 137, 0, }, /* 920 */
+ { 139, 6, 12, 0, 0, 139, 0, }, /* 921 */
+ { 137, 7, 12, 0, 0, 137, 0, }, /* 922 */
+ { 139, 7, 12, 0, 0, 139, 0, }, /* 923 */
+ { 105, 7, 12, 0, 0, 105, 0, }, /* 924 */
+ { 105, 26, 12, 0, 0, 105, 0, }, /* 925 */
+ { 105, 12, 3, 0, 0, 105, 0, }, /* 926 */
+ { 105, 21, 12, 0, 0, 105, 0, }, /* 927 */
+ { 10, 1, 2, 0, 0, 105, 0, }, /* 928 */
+ { 10, 10, 3, 0, 0, 10, 0, }, /* 929 */
+ { 10, 10, 5, 0, 0, 10, 0, }, /* 930 */
+ { 20, 12, 3, 0, 0, 20, 0, }, /* 931 */
+ { 131, 26, 12, 0, 0, 131, 0, }, /* 932 */
+ { 131, 12, 3, 0, 0, 131, 0, }, /* 933 */
+ { 131, 21, 12, 0, 0, 131, 0, }, /* 934 */
+ { 18, 12, 3, 0, 0, 18, 0, }, /* 935 */
+ { 151, 7, 12, 0, 0, 151, 0, }, /* 936 */
+ { 151, 12, 3, 0, 0, 151, 0, }, /* 937 */
+ { 151, 6, 12, 0, 0, 151, 0, }, /* 938 */
+ { 151, 13, 12, 0, 0, 151, 0, }, /* 939 */
+ { 151, 26, 12, 0, 0, 151, 0, }, /* 940 */
+ { 152, 7, 12, 0, 0, 152, 0, }, /* 941 */
+ { 152, 12, 3, 0, 0, 152, 0, }, /* 942 */
+ { 152, 13, 12, 0, 0, 152, 0, }, /* 943 */
+ { 152, 23, 12, 0, 0, 152, 0, }, /* 944 */
+ { 113, 7, 12, 0, 0, 113, 0, }, /* 945 */
+ { 113, 15, 12, 0, 0, 113, 0, }, /* 946 */
+ { 113, 12, 3, 0, 0, 113, 0, }, /* 947 */
+ { 132, 9, 12, 0, 34, 132, 0, }, /* 948 */
+ { 132, 5, 12, 0, -34, 132, 0, }, /* 949 */
+ { 132, 12, 3, 0, 0, 132, 0, }, /* 950 */
+ { 132, 6, 12, 0, 0, 132, 0, }, /* 951 */
+ { 132, 13, 12, 0, 0, 132, 0, }, /* 952 */
+ { 132, 21, 12, 0, 0, 132, 0, }, /* 953 */
+ { 0, 2, 14, 0, 0, 0, 0, }, /* 954 */
+ { 10, 26, 11, 0, 0, 10, 0, }, /* 955 */
+ { 27, 26, 12, 0, 0, 27, 0, }, /* 956 */
+ { 10, 24, 3, 0, 0, 10, 0, }, /* 957 */
+ { 10, 1, 3, 0, 0, 10, 0, }, /* 958 */
};
const uint16_t PRIV(ucd_stage1)[] = { /* 17408 bytes */
@@ -1150,37 +1185,37 @@ const uint16_t PRIV(ucd_stage1)[] = { /* 17408 bytes */
126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126, /* U+F000 */
126,126, 98, 98,127,128,129,130,131,131,132,133,134,135,136,137, /* U+F800 */
138,139,140,141,142,143,144,145,146,147,148,142,149,149,150,142, /* U+10000 */
-151,152,153,154,155,156,157,158,159,160,161,142,162,142,163,142, /* U+10800 */
-164,165,166,167,168,169,170,142,171,172,142,173,174,175,176,142, /* U+11000 */
-177,178,142,142,179,180,142,142,181,182,183,184,142,185,142,142, /* U+11800 */
-186,186,186,186,186,186,186,187,188,186,189,142,142,142,142,142, /* U+12000 */
+151,152,153,154,155,156,157,158,159,160,161,142,162,142,163,164, /* U+10800 */
+165,166,167,168,169,170,171,142,172,173,142,174,175,176,177,142, /* U+11000 */
+178,179,142,180,181,182,142,142,183,184,185,186,142,187,142,188, /* U+11800 */
+189,189,189,189,189,189,189,190,191,189,192,142,142,142,142,142, /* U+12000 */
142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+12800 */
-190,190,190,190,190,190,190,190,191,142,142,142,142,142,142,142, /* U+13000 */
+193,193,193,193,193,193,193,193,194,142,142,142,142,142,142,142, /* U+13000 */
142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+13800 */
-142,142,142,142,142,142,142,142,192,192,192,192,193,142,142,142, /* U+14000 */
+142,142,142,142,142,142,142,142,195,195,195,195,196,142,142,142, /* U+14000 */
142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+14800 */
142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+15000 */
142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+15800 */
142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+16000 */
-194,194,194,194,195,196,197,198,142,142,142,142,199,200,201,202, /* U+16800 */
-203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203, /* U+17000 */
-203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203, /* U+17800 */
-203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,204, /* U+18000 */
-203,203,203,203,203,205,142,142,142,142,142,142,142,142,142,142, /* U+18800 */
+197,197,197,197,198,199,200,201,142,142,142,142,202,203,204,205, /* U+16800 */
+206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,206, /* U+17000 */
+206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,206, /* U+17800 */
+206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,207, /* U+18000 */
+206,206,206,206,206,208,142,142,142,142,142,142,142,142,142,142, /* U+18800 */
142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+19000 */
142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+19800 */
142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+1A000 */
142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+1A800 */
-206,207,208,209,209,210,142,142,142,142,142,142,142,142,142,142, /* U+1B000 */
-142,142,142,142,142,142,142,142,211,212,142,142,142,142,142,142, /* U+1B800 */
+209,210,211,212,212,213,142,142,142,142,142,142,142,142,142,142, /* U+1B000 */
+142,142,142,142,142,142,142,142,214,215,142,142,142,142,142,142, /* U+1B800 */
142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+1C000 */
142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+1C800 */
- 71,213,214,215,216,217,218,142,219,220,221,222,223,224,225,226, /* U+1D000 */
-227,227,227,227,228,229,142,142,142,142,142,142,142,142,142,142, /* U+1D800 */
-230,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+1E000 */
-231,232,233,142,142,142,142,142,234,235,142,142,236,237,142,142, /* U+1E800 */
-238,239,240,241,242,243,244,245,244,244,246,244,247,248,249,250, /* U+1F000 */
-251,252,253,254,255,243,243,243,243,243,243,243,243,243,243,256, /* U+1F800 */
+ 71,216,217,218,219,220,221,142,222,223,224,225,226,227,228,229, /* U+1D000 */
+230,230,230,230,231,232,142,142,142,142,142,142,142,142,142,142, /* U+1D800 */
+233,142,234,142,142,235,142,142,142,142,142,142,142,142,142,142, /* U+1E000 */
+236,237,238,142,142,142,142,142,239,240,241,142,242,243,142,142, /* U+1E800 */
+244,245,246,247,248,249,250,251,250,250,252,250,253,254,255,256, /* U+1F000 */
+257,258,259,260,261,262,249,249,249,249,249,249,249,249,249,263, /* U+1F800 */
98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, /* U+20000 */
98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, /* U+20800 */
98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, /* U+21000 */
@@ -1201,18 +1236,18 @@ const uint16_t PRIV(ucd_stage1)[] = { /* 17408 bytes */
98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, /* U+28800 */
98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, /* U+29000 */
98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, /* U+29800 */
- 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98,257, 98, 98, /* U+2A000 */
+ 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98,264, 98, 98, /* U+2A000 */
98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, /* U+2A800 */
- 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98,258, 98, /* U+2B000 */
-259, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, /* U+2B800 */
+ 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98,265, 98, /* U+2B000 */
+266, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, /* U+2B800 */
98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, /* U+2C000 */
- 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98,260, 98, 98, /* U+2C800 */
+ 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98,267, 98, 98, /* U+2C800 */
98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, /* U+2D000 */
98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, /* U+2D800 */
98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, /* U+2E000 */
- 98, 98, 98, 98, 98, 98, 98,261,142,142,142,142,142,142,142,142, /* U+2E800 */
+ 98, 98, 98, 98, 98, 98, 98,268,142,142,142,142,142,142,142,142, /* U+2E800 */
142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+2F000 */
- 98, 98, 98, 98,262,142,142,142,142,142,142,142,142,142,142,142, /* U+2F800 */
+ 98, 98, 98, 98,269,142,142,142,142,142,142,142,142,142,142,142, /* U+2F800 */
142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+30000 */
142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+30800 */
142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+31000 */
@@ -1565,8 +1600,8 @@ const uint16_t PRIV(ucd_stage1)[] = { /* 17408 bytes */
142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+DE800 */
142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+DF000 */
142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+DF800 */
-263,264,265,266,264,264,264,264,264,264,264,264,264,264,264,264, /* U+E0000 */
-264,264,264,264,264,264,264,264,264,264,264,264,264,264,264,264, /* U+E0800 */
+270,271,272,273,271,271,271,271,271,271,271,271,271,271,271,271, /* U+E0000 */
+271,271,271,271,271,271,271,271,271,271,271,271,271,271,271,271, /* U+E0800 */
142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+E1000 */
142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+E1800 */
142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+E2000 */
@@ -1628,7 +1663,7 @@ const uint16_t PRIV(ucd_stage1)[] = { /* 17408 bytes */
126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126, /* U+FE000 */
126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126, /* U+FE800 */
126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126, /* U+FF000 */
-126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,267, /* U+FF800 */
+126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,274, /* U+FF800 */
126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126, /* U+100000 */
126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126, /* U+100800 */
126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126, /* U+101000 */
@@ -1660,10 +1695,10 @@ const uint16_t PRIV(ucd_stage1)[] = { /* 17408 bytes */
126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126, /* U+10E000 */
126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126, /* U+10E800 */
126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126, /* U+10F000 */
-126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,267, /* U+10F800 */
+126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,274, /* U+10F800 */
};
-const uint16_t PRIV(ucd_stage2)[] = { /* 68608 bytes, block = 128 */
+const uint16_t PRIV(ucd_stage2)[] = { /* 70400 bytes, block = 128 */
/* block 0 */
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 3, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -1715,534 +1750,534 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 68608 bytes, block = 128 */
35, 97, 98, 35, 35, 99, 35, 35, 35, 35, 35, 35, 35,100, 35, 35,
/* block 5 */
-101, 35, 35,101, 35, 35, 35,102,101,103,104,104,105, 35, 35, 35,
- 35, 35,106, 35, 22, 35, 35, 35, 35, 35, 35, 35, 35,107,108, 35,
+101, 35,102,101, 35, 35, 35,103,101,104,105,105,106, 35, 35, 35,
+ 35, 35,107, 35, 22, 35, 35, 35, 35, 35, 35, 35, 35,108,109, 35,
35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
-109,109,109,109,109,109,109,109,109,110,110,110,110,110,110,110,
-110,110, 15, 15, 15, 15,110,110,110,110,110,110,110,110,110,110,
-110,110, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
-109,109,109,109,109, 15, 15, 15, 15, 15,111,111,110, 15,110, 15,
+110,110,110,110,110,110,110,110,110,111,111,111,111,111,111,111,
+111,111, 15, 15, 15, 15,111,111,111,111,111,111,111,111,111,111,
+111,111, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+110,110,110,110,110, 15, 15, 15, 15, 15,112,112,111, 15,111, 15,
15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
/* block 6 */
-112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,
-112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,
-112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,
-112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,
-112,112,113,112,112,114,112,112,112,112,112,112,112,112,112,112,
-112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,
-112,112,112,115,115,115,115,115,115,115,115,115,115,115,115,115,
-116,117,116,117,110,118,116,117,119,119,120,121,121,121, 5,122,
+113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,
+113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,
+113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,
+113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,
+113,113,114,113,113,115,113,113,113,113,113,113,113,113,113,113,
+113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,
+113,113,113,116,116,116,116,116,116,116,116,116,116,116,116,116,
+117,118,117,118,111,119,117,118,120,120,121,122,122,122, 5,123,
/* block 7 */
-119,119,119,119,118, 15,123, 5,124,124,124,119,125,119,126,126,
-127,128,129,128,128,130,128,128,131,132,133,128,134,128,128,128,
-135,136,119,137,128,128,138,128,128,139,128,128,140,141,141,141,
-127,142,143,142,142,144,142,142,145,146,147,142,148,142,142,142,
-149,150,151,152,142,142,153,142,142,154,142,142,155,156,156,157,
-158,159,160,160,160,161,162,163,116,117,116,117,116,117,116,117,
-116,117,164,165,164,165,164,165,164,165,164,165,164,165,164,165,
-166,167,168,169,170,171,172,116,117,173,116,117,127,174,174,174,
+120,120,120,120,119, 15,124, 5,125,125,125,120,126,120,127,127,
+128,129,130,129,129,131,129,129,132,133,134,129,135,129,129,129,
+136,137,120,138,129,129,139,129,129,140,129,129,141,142,142,142,
+128,143,144,143,143,145,143,143,146,147,148,143,149,143,143,143,
+150,151,152,153,143,143,154,143,143,155,143,143,156,157,157,158,
+159,160,161,161,161,162,163,164,117,118,117,118,117,118,117,118,
+117,118,165,166,165,166,165,166,165,166,165,166,165,166,165,166,
+167,168,169,170,171,172,173,117,118,174,117,118,128,175,175,175,
/* block 8 */
-175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,
-176,176,177,176,178,176,176,176,176,176,176,176,176,176,179,176,
-176,180,181,176,176,176,176,176,176,176,182,176,176,176,176,176,
-183,183,184,183,185,183,183,183,183,183,183,183,183,183,186,183,
-183,187,188,183,183,183,183,183,183,183,189,183,183,183,183,183,
-190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,
-191,192,193,194,191,192,191,192,191,192,191,192,191,192,191,192,
-191,192,191,192,191,192,191,192,191,192,191,192,191,192,191,192,
+176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,
+177,177,178,177,179,177,177,177,177,177,177,177,177,177,180,177,
+177,181,182,177,177,177,177,177,177,177,183,177,177,177,177,177,
+184,184,185,184,186,184,184,184,184,184,184,184,184,184,187,184,
+184,188,189,184,184,184,184,184,184,184,190,184,184,184,184,184,
+191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,
+192,193,194,195,192,193,192,193,192,193,192,193,192,193,192,193,
+192,193,192,193,192,193,192,193,192,193,192,193,192,193,192,193,
/* block 9 */
-191,192,195,196,197,198,198,197,199,199,191,192,191,192,191,192,
-191,192,191,192,191,192,191,192,191,192,191,192,191,192,191,192,
-191,192,191,192,191,192,191,192,191,192,191,192,191,192,191,192,
-191,192,191,192,191,192,191,192,191,192,191,192,191,192,191,192,
-200,191,192,191,192,191,192,191,192,191,192,191,192,191,192,201,
-191,192,191,192,191,192,191,192,191,192,191,192,191,192,191,192,
-191,192,191,192,191,192,191,192,191,192,191,192,191,192,191,192,
-191,192,191,192,191,192,191,192,191,192,191,192,191,192,191,192,
+192,193,196,197,198,199,199,198,200,200,192,193,192,193,192,193,
+192,193,192,193,192,193,192,193,192,193,192,193,192,193,192,193,
+192,193,192,193,192,193,192,193,192,193,192,193,192,193,192,193,
+192,193,192,193,192,193,192,193,192,193,192,193,192,193,192,193,
+201,192,193,192,193,192,193,192,193,192,193,192,193,192,193,202,
+192,193,192,193,192,193,192,193,192,193,192,193,192,193,192,193,
+192,193,192,193,192,193,192,193,192,193,192,193,192,193,192,193,
+192,193,192,193,192,193,192,193,192,193,192,193,192,193,192,193,
/* block 10 */
-191,192,191,192,191,192,191,192,191,192,191,192,191,192,191,192,
-191,192,191,192,191,192,191,192,191,192,191,192,191,192,191,192,
-191,192,191,192,191,192,191,192,191,192,191,192,191,192,191,192,
-119,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,
-202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,
-202,202,202,202,202,202,202,119,119,203,204,204,204,204,204,204,
-205,206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,
-206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,
+192,193,192,193,192,193,192,193,192,193,192,193,192,193,192,193,
+192,193,192,193,192,193,192,193,192,193,192,193,192,193,192,193,
+192,193,192,193,192,193,192,193,192,193,192,193,192,193,192,193,
+120,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,
+203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,
+203,203,203,203,203,203,203,120,120,204,205,205,205,205,205,205,
+206,207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,
+207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,
/* block 11 */
-206,206,206,206,206,206,206,205,205,207,208,119,119,209,209,210,
-119,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,
-211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,
-211,211,211,211,211,211,211,211,211,211,211,211,211,211,212,211,
-213,211,211,213,211,211,213,211,119,119,119,119,119,119,119,119,
-214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,
-214,214,214,214,214,214,214,214,214,214,214,119,119,119,119,214,
-214,214,214,213,213,119,119,119,119,119,119,119,119,119,119,119,
+207,207,207,207,207,207,207,206,206,208,209,120,120,210,210,211,
+120,212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,
+212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,
+212,212,212,212,212,212,212,212,212,212,212,212,212,212,213,212,
+214,212,212,214,212,212,214,212,120,120,120,120,120,120,120,120,
+215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,
+215,215,215,215,215,215,215,215,215,215,215,120,120,120,120,215,
+215,215,215,214,214,120,120,120,120,120,120,120,120,120,120,120,
/* block 12 */
-215,215,215,215,215,216,217,217,217,218,218,219,220,218,221,221,
-222,222,222,222,222,222,222,222,222,222,222,220,223,119,218,220,
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
-225,224,224,224,224,224,224,224,224,224,224,226,226,226,226,226,
-226,226,226,226,226,226,222,222,222,222,222,222,222,222,222,222,
-227,227,227,227,227,227,227,227,227,227,218,218,218,218,224,224,
-226,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
+216,216,216,216,216,217,218,218,218,219,219,220,221,219,222,222,
+223,223,223,223,223,223,223,223,223,223,223,221,224,120,219,221,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
+226,225,225,225,225,225,225,225,225,225,225,227,227,227,227,227,
+227,227,227,227,227,227,223,223,223,223,223,223,223,223,223,223,
+228,228,228,228,228,228,228,228,228,228,219,219,219,219,225,225,
+227,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
/* block 13 */
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
-224,224,224,224,228,224,222,222,222,222,222,222,222,216,221,222,
-222,222,222,222,222,229,229,222,222,221,222,222,222,222,224,224,
-230,230,230,230,230,230,230,230,230,230,224,224,224,221,221,224,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
+225,225,225,225,229,225,223,223,223,223,223,223,223,217,222,223,
+223,223,223,223,223,230,230,223,223,222,223,223,223,223,225,225,
+231,231,231,231,231,231,231,231,231,231,225,225,225,222,222,225,
/* block 14 */
-231,231,231,231,231,231,231,231,231,231,231,231,231,231,119,232,
-233,234,233,233,233,233,233,233,233,233,233,233,233,233,233,233,
-233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,
+232,232,232,232,232,232,232,232,232,232,232,232,232,232,120,233,
+234,235,234,234,234,234,234,234,234,234,234,234,234,234,234,234,
234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,
-234,234,234,234,234,234,234,234,234,234,234,119,119,233,233,233,
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
+235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,
+235,235,235,235,235,235,235,235,235,235,235,120,120,234,234,234,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
/* block 15 */
-235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,
-235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,
-235,235,235,235,235,235,236,236,236,236,236,236,236,236,236,236,
-236,235,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-237,237,237,237,237,237,237,237,237,237,238,238,238,238,238,238,
-238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,
-238,238,238,238,238,238,238,238,238,238,238,239,239,239,239,239,
-239,239,239,239,240,240,241,242,242,242,240,119,119,239,243,243,
+236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,
+236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,
+236,236,236,236,236,236,237,237,237,237,237,237,237,237,237,237,
+237,236,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+238,238,238,238,238,238,238,238,238,238,239,239,239,239,239,239,
+239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,
+239,239,239,239,239,239,239,239,239,239,239,240,240,240,240,240,
+240,240,240,240,241,241,242,243,243,243,241,120,120,240,244,244,
/* block 16 */
-244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,
-244,244,244,244,244,244,245,245,245,245,246,245,245,245,245,245,
-245,245,245,245,246,245,245,245,246,245,245,245,245,245,119,119,
-247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,119,
-248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,
-248,248,248,248,248,248,248,248,248,249,249,249,119,119,250,119,
-233,233,233,233,233,233,233,233,233,233,233,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,
+245,245,245,245,245,245,246,246,246,246,247,246,246,246,246,246,
+246,246,246,246,247,246,246,246,247,246,246,246,246,246,120,120,
+248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,120,
+249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,
+249,249,249,249,249,249,249,249,249,250,250,250,120,120,251,120,
+234,234,234,234,234,234,234,234,234,234,234,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 17 */
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
-224,224,224,224,224,119,224,224,224,224,224,224,224,224,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,222,222,222,222,222,222,222,222,222,222,222,222,222,
-222,222,216,222,222,222,222,222,222,222,222,222,222,222,222,222,
-222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
+225,225,225,225,225,120,225,225,225,225,225,225,225,225,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,223,223,223,223,223,223,223,223,223,223,223,223,223,
+223,223,217,223,223,223,223,223,223,223,223,223,223,223,223,223,
+223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,
/* block 18 */
-251,251,251,252,253,253,253,253,253,253,253,253,253,253,253,253,
-253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,
-253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,
-253,253,253,253,253,253,253,253,253,253,251,252,251,253,252,252,
-252,251,251,251,251,251,251,251,251,252,252,252,252,251,252,252,
-253,254,255,251,251,251,251,251,253,253,253,253,253,253,253,253,
-253,253,251,251,256,257,258,258,258,258,258,258,258,258,258,258,
-259,260,253,253,253,253,253,253,253,253,253,253,253,253,253,253,
+252,252,252,253,254,254,254,254,254,254,254,254,254,254,254,254,
+254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,
+254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,
+254,254,254,254,254,254,254,254,254,254,252,253,252,254,253,253,
+253,252,252,252,252,252,252,252,252,253,253,253,253,252,253,253,
+254,255,256,113,113,252,252,252,254,254,254,254,254,254,254,254,
+254,254,252,252,257,258,259,259,259,259,259,259,259,259,259,259,
+260,261,254,254,254,254,254,254,254,254,254,254,254,254,254,254,
/* block 19 */
-261,262,263,263,119,261,261,261,261,261,261,261,261,119,119,261,
-261,119,119,261,261,261,261,261,261,261,261,261,261,261,261,261,
-261,261,261,261,261,261,261,261,261,119,261,261,261,261,261,261,
-261,119,261,119,119,119,261,261,261,261,119,119,262,261,264,263,
-263,262,262,262,262,119,119,263,263,119,119,263,263,262,261,119,
-119,119,119,119,119,119,119,264,119,119,119,119,261,261,119,261,
-261,261,262,262,119,119,265,265,265,265,265,265,265,265,265,265,
-261,261,266,266,267,267,267,267,267,267,268,266,261,269,262,119,
+262,263,264,264,120,262,262,262,262,262,262,262,262,120,120,262,
+262,120,120,262,262,262,262,262,262,262,262,262,262,262,262,262,
+262,262,262,262,262,262,262,262,262,120,262,262,262,262,262,262,
+262,120,262,120,120,120,262,262,262,262,120,120,263,262,265,264,
+264,263,263,263,263,120,120,264,264,120,120,264,264,263,262,120,
+120,120,120,120,120,120,120,265,120,120,120,120,262,262,120,262,
+262,262,263,263,120,120,266,266,266,266,266,266,266,266,266,266,
+262,262,267,267,268,268,268,268,268,268,269,267,262,270,263,120,
/* block 20 */
-119,270,270,271,119,272,272,272,272,272,272,119,119,119,119,272,
-272,119,119,272,272,272,272,272,272,272,272,272,272,272,272,272,
-272,272,272,272,272,272,272,272,272,119,272,272,272,272,272,272,
-272,119,272,272,119,272,272,119,272,272,119,119,270,119,271,271,
-271,270,270,119,119,119,119,270,270,119,119,270,270,270,119,119,
-119,270,119,119,119,119,119,119,119,272,272,272,272,119,272,119,
-119,119,119,119,119,119,273,273,273,273,273,273,273,273,273,273,
-270,270,272,272,272,270,274,119,119,119,119,119,119,119,119,119,
+120,271,271,272,120,273,273,273,273,273,273,120,120,120,120,273,
+273,120,120,273,273,273,273,273,273,273,273,273,273,273,273,273,
+273,273,273,273,273,273,273,273,273,120,273,273,273,273,273,273,
+273,120,273,273,120,273,273,120,273,273,120,120,271,120,272,272,
+272,271,271,120,120,120,120,271,271,120,120,271,271,271,120,120,
+120,271,120,120,120,120,120,120,120,273,273,273,273,120,273,120,
+120,120,120,120,120,120,274,274,274,274,274,274,274,274,274,274,
+271,271,273,273,273,271,275,120,120,120,120,120,120,120,120,120,
/* block 21 */
-119,275,275,276,119,277,277,277,277,277,277,277,277,277,119,277,
-277,277,119,277,277,277,277,277,277,277,277,277,277,277,277,277,
-277,277,277,277,277,277,277,277,277,119,277,277,277,277,277,277,
-277,119,277,277,119,277,277,277,277,277,119,119,275,277,276,276,
-276,275,275,275,275,275,119,275,275,276,119,276,276,275,119,119,
-277,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-277,277,275,275,119,119,278,278,278,278,278,278,278,278,278,278,
-279,280,119,119,119,119,119,119,119,277,275,275,275,275,275,275,
+120,276,276,277,120,278,278,278,278,278,278,278,278,278,120,278,
+278,278,120,278,278,278,278,278,278,278,278,278,278,278,278,278,
+278,278,278,278,278,278,278,278,278,120,278,278,278,278,278,278,
+278,120,278,278,120,278,278,278,278,278,120,120,276,278,277,277,
+277,276,276,276,276,276,120,276,276,277,120,277,277,276,120,120,
+278,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+278,278,276,276,120,120,279,279,279,279,279,279,279,279,279,279,
+280,281,120,120,120,120,120,120,120,278,276,276,276,276,276,276,
/* block 22 */
-119,281,282,282,119,283,283,283,283,283,283,283,283,119,119,283,
-283,119,119,283,283,283,283,283,283,283,283,283,283,283,283,283,
-283,283,283,283,283,283,283,283,283,119,283,283,283,283,283,283,
-283,119,283,283,119,283,283,283,283,283,119,119,281,283,284,281,
-282,281,281,281,281,119,119,282,282,119,119,282,282,281,119,119,
-119,119,119,119,119,119,281,284,119,119,119,119,283,283,119,283,
-283,283,281,281,119,119,285,285,285,285,285,285,285,285,285,285,
-286,283,287,287,287,287,287,287,119,119,119,119,119,119,119,119,
+120,282,283,283,120,284,284,284,284,284,284,284,284,120,120,284,
+284,120,120,284,284,284,284,284,284,284,284,284,284,284,284,284,
+284,284,284,284,284,284,284,284,284,120,284,284,284,284,284,284,
+284,120,284,284,120,284,284,284,284,284,120,120,282,284,285,282,
+283,282,282,282,282,120,120,283,283,120,120,283,283,282,120,120,
+120,120,120,120,120,120,282,285,120,120,120,120,284,284,120,284,
+284,284,282,282,120,120,286,286,286,286,286,286,286,286,286,286,
+287,284,288,288,288,288,288,288,120,120,120,120,120,120,120,120,
/* block 23 */
-119,119,288,289,119,289,289,289,289,289,289,119,119,119,289,289,
-289,119,289,289,289,289,119,119,119,289,289,119,289,119,289,289,
-119,119,119,289,289,119,119,119,289,289,289,119,119,119,289,289,
-289,289,289,289,289,289,289,289,289,289,119,119,119,119,290,291,
-288,291,291,119,119,119,291,291,291,119,291,291,291,288,119,119,
-289,119,119,119,119,119,119,290,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,292,292,292,292,292,292,292,292,292,292,
-293,293,293,294,295,295,295,295,295,296,295,119,119,119,119,119,
+120,120,289,290,120,290,290,290,290,290,290,120,120,120,290,290,
+290,120,290,290,290,290,120,120,120,290,290,120,290,120,290,290,
+120,120,120,290,290,120,120,120,290,290,290,120,120,120,290,290,
+290,290,290,290,290,290,290,290,290,290,120,120,120,120,291,292,
+289,292,292,120,120,120,292,292,292,120,292,292,292,289,120,120,
+290,120,120,120,120,120,120,291,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,293,293,293,293,293,293,293,293,293,293,
+294,294,294,295,296,296,296,296,296,297,296,120,120,120,120,120,
/* block 24 */
-297,298,298,298,297,299,299,299,299,299,299,299,299,119,299,299,
-299,119,299,299,299,299,299,299,299,299,299,299,299,299,299,299,
-299,299,299,299,299,299,299,299,299,119,299,299,299,299,299,299,
-299,299,299,299,299,299,299,299,299,299,119,119,119,299,297,297,
-297,298,298,298,298,119,297,297,297,119,297,297,297,297,119,119,
-119,119,119,119,119,297,297,119,299,299,299,119,119,119,119,119,
-299,299,297,297,119,119,300,300,300,300,300,300,300,300,300,300,
-119,119,119,119,119,119,119,119,301,301,301,301,301,301,301,302,
+298,299,299,299,298,300,300,300,300,300,300,300,300,120,300,300,
+300,120,300,300,300,300,300,300,300,300,300,300,300,300,300,300,
+300,300,300,300,300,300,300,300,300,120,300,300,300,300,300,300,
+300,300,300,300,300,300,300,300,300,300,120,120,120,300,298,298,
+298,299,299,299,299,120,298,298,298,120,298,298,298,298,120,120,
+120,120,120,120,120,298,298,120,300,300,300,120,120,120,120,120,
+300,300,298,298,120,120,301,301,301,301,301,301,301,301,301,301,
+120,120,120,120,120,120,120,302,303,303,303,303,303,303,303,304,
/* block 25 */
-303,304,305,305,306,303,303,303,303,303,303,303,303,119,303,303,
-303,119,303,303,303,303,303,303,303,303,303,303,303,303,303,303,
-303,303,303,303,303,303,303,303,303,119,303,303,303,303,303,303,
-303,303,303,303,119,303,303,303,303,303,119,119,304,303,305,304,
-305,305,307,305,305,119,304,305,305,119,305,305,304,304,119,119,
-119,119,119,119,119,307,307,119,119,119,119,119,119,119,303,119,
-303,303,304,304,119,119,308,308,308,308,308,308,308,308,308,308,
-119,303,303,119,119,119,119,119,119,119,119,119,119,119,119,119,
+305,306,307,307,308,305,305,305,305,305,305,305,305,120,305,305,
+305,120,305,305,305,305,305,305,305,305,305,305,305,305,305,305,
+305,305,305,305,305,305,305,305,305,120,305,305,305,305,305,305,
+305,305,305,305,120,305,305,305,305,305,120,120,306,305,307,306,
+307,307,309,307,307,120,306,307,307,120,307,307,306,306,120,120,
+120,120,120,120,120,309,309,120,120,120,120,120,120,120,305,120,
+305,305,306,306,120,120,310,310,310,310,310,310,310,310,310,310,
+120,305,305,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 26 */
-309,309,310,310,119,311,311,311,311,311,311,311,311,119,311,311,
-311,119,311,311,311,311,311,311,311,311,311,311,311,311,311,311,
-311,311,311,311,311,311,311,311,311,311,311,311,311,311,311,311,
-311,311,311,311,311,311,311,311,311,311,311,309,309,311,312,310,
-310,309,309,309,309,119,310,310,310,119,310,310,310,309,313,314,
-119,119,119,119,311,311,311,312,315,315,315,315,315,315,315,311,
-311,311,309,309,119,119,316,316,316,316,316,316,316,316,316,316,
-315,315,315,315,315,315,315,315,315,314,311,311,311,311,311,311,
+311,311,312,312,120,313,313,313,313,313,313,313,313,120,313,313,
+313,120,313,313,313,313,313,313,313,313,313,313,313,313,313,313,
+313,313,313,313,313,313,313,313,313,313,313,313,313,313,313,313,
+313,313,313,313,313,313,313,313,313,313,313,311,311,313,314,312,
+312,311,311,311,311,120,312,312,312,120,312,312,312,311,315,316,
+120,120,120,120,313,313,313,314,317,317,317,317,317,317,317,313,
+313,313,311,311,120,120,318,318,318,318,318,318,318,318,318,318,
+317,317,317,317,317,317,317,317,317,316,313,313,313,313,313,313,
/* block 27 */
-119,119,317,317,119,318,318,318,318,318,318,318,318,318,318,318,
-318,318,318,318,318,318,318,119,119,119,318,318,318,318,318,318,
-318,318,318,318,318,318,318,318,318,318,318,318,318,318,318,318,
-318,318,119,318,318,318,318,318,318,318,318,318,119,318,119,119,
-318,318,318,318,318,318,318,119,119,119,319,119,119,119,119,320,
-317,317,319,319,319,119,319,119,317,317,317,317,317,317,317,320,
-119,119,119,119,119,119,321,321,321,321,321,321,321,321,321,321,
-119,119,317,317,322,119,119,119,119,119,119,119,119,119,119,119,
+120,120,319,319,120,320,320,320,320,320,320,320,320,320,320,320,
+320,320,320,320,320,320,320,120,120,120,320,320,320,320,320,320,
+320,320,320,320,320,320,320,320,320,320,320,320,320,320,320,320,
+320,320,120,320,320,320,320,320,320,320,320,320,120,320,120,120,
+320,320,320,320,320,320,320,120,120,120,321,120,120,120,120,322,
+319,319,321,321,321,120,321,120,319,319,319,319,319,319,319,322,
+120,120,120,120,120,120,323,323,323,323,323,323,323,323,323,323,
+120,120,319,319,324,120,120,120,120,120,120,120,120,120,120,120,
/* block 28 */
-119,323,323,323,323,323,323,323,323,323,323,323,323,323,323,323,
-323,323,323,323,323,323,323,323,323,323,323,323,323,323,323,323,
-323,323,323,323,323,323,323,323,323,323,323,323,323,323,323,323,
-323,324,323,325,324,324,324,324,324,324,324,119,119,119,119, 6,
-323,323,323,323,323,323,326,324,324,324,324,324,324,324,324,327,
-328,328,328,328,328,328,328,328,328,328,327,327,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+120,325,325,325,325,325,325,325,325,325,325,325,325,325,325,325,
+325,325,325,325,325,325,325,325,325,325,325,325,325,325,325,325,
+325,325,325,325,325,325,325,325,325,325,325,325,325,325,325,325,
+325,326,325,327,326,326,326,326,326,326,326,120,120,120,120, 6,
+325,325,325,325,325,325,328,326,326,326,326,326,326,326,326,329,
+330,330,330,330,330,330,330,330,330,330,329,329,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 29 */
-119,329,329,119,329,119,119,329,329,119,329,119,119,329,119,119,
-119,119,119,119,329,329,329,329,119,329,329,329,329,329,329,329,
-119,329,329,329,119,329,119,329,119,119,329,329,119,329,329,329,
-329,330,329,331,330,330,330,330,330,330,119,330,330,329,119,119,
-329,329,329,329,329,119,332,119,330,330,330,330,330,330,119,119,
-333,333,333,333,333,333,333,333,333,333,119,119,329,329,329,329,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+120,331,331,120,331,120,331,331,331,331,331,120,331,331,331,331,
+331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,
+331,331,331,331,120,331,120,331,331,331,331,331,331,331,331,331,
+331,332,331,333,332,332,332,332,332,332,332,332,332,331,120,120,
+331,331,331,331,331,120,334,120,332,332,332,332,332,332,120,120,
+335,335,335,335,335,335,335,335,335,335,120,120,331,331,331,331,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 30 */
-334,335,335,335,336,336,336,336,336,336,336,336,336,336,336,336,
-336,336,336,335,336,335,335,335,337,337,335,335,335,335,335,335,
-338,338,338,338,338,338,338,338,338,338,339,339,339,339,339,339,
-339,339,339,339,335,337,335,337,335,337,340,341,340,341,342,342,
-334,334,334,334,334,334,334,334,119,334,334,334,334,334,334,334,
-334,334,334,334,334,334,334,334,334,334,334,334,334,334,334,334,
-334,334,334,334,334,334,334,334,334,334,334,334,334,119,119,119,
-119,337,337,337,337,337,337,337,337,337,337,337,337,337,337,342,
+336,337,337,337,338,338,338,338,338,338,338,338,338,338,338,338,
+338,338,338,337,338,337,337,337,339,339,337,337,337,337,337,337,
+340,340,340,340,340,340,340,340,340,340,341,341,341,341,341,341,
+341,341,341,341,337,339,337,339,337,339,342,343,342,343,344,344,
+336,336,336,336,336,336,336,336,120,336,336,336,336,336,336,336,
+336,336,336,336,336,336,336,336,336,336,336,336,336,336,336,336,
+336,336,336,336,336,336,336,336,336,336,336,336,336,120,120,120,
+120,339,339,339,339,339,339,339,339,339,339,339,339,339,339,344,
/* block 31 */
-337,337,337,337,337,336,337,337,334,334,334,334,334,337,337,337,
-337,337,337,337,337,337,337,337,119,337,337,337,337,337,337,337,
-337,337,337,337,337,337,337,337,337,337,337,337,337,337,337,337,
-337,337,337,337,337,337,337,337,337,337,337,337,337,119,335,335,
-335,335,335,335,335,335,337,335,335,335,335,335,335,119,335,335,
-336,336,336,336,336, 20, 20, 20, 20,336,336,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+339,339,339,339,339,338,339,339,336,336,336,336,336,339,339,339,
+339,339,339,339,339,339,339,339,120,339,339,339,339,339,339,339,
+339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,
+339,339,339,339,339,339,339,339,339,339,339,339,339,120,337,337,
+337,337,337,337,337,337,339,337,337,337,337,337,337,120,337,337,
+338,338,338,338,338, 20, 20, 20, 20,338,338,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 32 */
-343,343,343,343,343,343,343,343,343,343,343,343,343,343,343,343,
-343,343,343,343,343,343,343,343,343,343,343,343,343,343,343,343,
-343,343,343,343,343,343,343,343,343,343,343,344,344,345,345,345,
-345,346,345,345,345,345,345,345,344,345,345,346,346,345,345,343,
-347,347,347,347,347,347,347,347,347,347,348,348,348,348,348,348,
-343,343,343,343,343,343,346,346,345,345,343,343,343,343,345,345,
-345,343,344,344,344,343,343,344,344,344,344,344,344,344,343,343,
-343,345,345,345,345,343,343,343,343,343,343,343,343,343,343,343,
+345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,
+345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,
+345,345,345,345,345,345,345,345,345,345,345,346,346,347,347,347,
+347,348,347,347,347,347,347,347,346,347,347,348,348,347,347,345,
+349,349,349,349,349,349,349,349,349,349,350,350,350,350,350,350,
+345,345,345,345,345,345,348,348,347,347,345,345,345,345,347,347,
+347,345,346,346,346,345,345,346,346,346,346,346,346,346,345,345,
+345,347,347,347,347,345,345,345,345,345,345,345,345,345,345,345,
/* block 33 */
-343,343,345,344,346,345,345,344,344,344,344,344,344,345,343,344,
-349,349,349,349,349,349,349,349,349,349,344,344,344,345,350,350,
-351,351,351,351,351,351,351,351,351,351,351,351,351,351,351,351,
-351,351,351,351,351,351,351,351,351,351,351,351,351,351,351,351,
-351,351,351,351,351,351,119,351,119,119,119,119,119,351,119,119,
-352,352,352,352,352,352,352,352,352,352,352,352,352,352,352,352,
-352,352,352,352,352,352,352,352,352,352,352,352,352,352,352,352,
-352,352,352,352,352,352,352,352,352,352,352,353,354,352,352,352,
+345,345,347,346,348,347,347,346,346,346,346,346,346,347,345,346,
+351,351,351,351,351,351,351,351,351,351,346,346,346,347,352,352,
+353,353,353,353,353,353,353,353,353,353,353,353,353,353,353,353,
+353,353,353,353,353,353,353,353,353,353,353,353,353,353,353,353,
+353,353,353,353,353,353,120,353,120,120,120,120,120,353,120,120,
+354,354,354,354,354,354,354,354,354,354,354,354,354,354,354,354,
+354,354,354,354,354,354,354,354,354,354,354,354,354,354,354,354,
+354,354,354,354,354,354,354,354,354,354,354,355,356,354,354,354,
/* block 34 */
-355,355,355,355,355,355,355,355,355,355,355,355,355,355,355,355,
-355,355,355,355,355,355,355,355,355,355,355,355,355,355,355,355,
-355,355,355,355,355,355,355,355,355,355,355,355,355,355,355,355,
-355,355,355,355,355,355,355,355,355,355,355,355,355,355,355,355,
-355,355,355,355,355,355,355,355,355,355,355,355,355,355,355,355,
-355,355,355,355,355,355,355,355,355,355,355,355,355,355,355,355,
-356,356,356,356,356,356,356,356,356,356,356,356,356,356,356,356,
-356,356,356,356,356,356,356,356,356,356,356,356,356,356,356,356,
-
-/* block 35 */
-356,356,356,356,356,356,356,356,356,356,356,356,356,356,356,356,
-356,356,356,356,356,356,356,356,356,356,356,356,356,356,356,356,
-356,356,356,356,356,356,356,356,357,357,357,357,357,357,357,357,
357,357,357,357,357,357,357,357,357,357,357,357,357,357,357,357,
357,357,357,357,357,357,357,357,357,357,357,357,357,357,357,357,
357,357,357,357,357,357,357,357,357,357,357,357,357,357,357,357,
357,357,357,357,357,357,357,357,357,357,357,357,357,357,357,357,
357,357,357,357,357,357,357,357,357,357,357,357,357,357,357,357,
-
-/* block 36 */
-358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,
-358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,
+357,357,357,357,357,357,357,357,357,357,357,357,357,357,357,357,
358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,
358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,
-358,358,358,358,358,358,358,358,358,119,358,358,358,358,119,119,
-358,358,358,358,358,358,358,119,358,119,358,358,358,358,119,119,
+
+/* block 35 */
358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,
358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,
+358,358,358,358,358,358,358,358,359,359,359,359,359,359,359,359,
+359,359,359,359,359,359,359,359,359,359,359,359,359,359,359,359,
+359,359,359,359,359,359,359,359,359,359,359,359,359,359,359,359,
+359,359,359,359,359,359,359,359,359,359,359,359,359,359,359,359,
+359,359,359,359,359,359,359,359,359,359,359,359,359,359,359,359,
+359,359,359,359,359,359,359,359,359,359,359,359,359,359,359,359,
+
+/* block 36 */
+360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,
+360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,
+360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,
+360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,
+360,360,360,360,360,360,360,360,360,120,360,360,360,360,120,120,
+360,360,360,360,360,360,360,120,360,120,360,360,360,360,120,120,
+360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,
+360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,
/* block 37 */
-358,358,358,358,358,358,358,358,358,119,358,358,358,358,119,119,
-358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,
-358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,
-358,119,358,358,358,358,119,119,358,358,358,358,358,358,358,119,
-358,119,358,358,358,358,119,119,358,358,358,358,358,358,358,358,
-358,358,358,358,358,358,358,119,358,358,358,358,358,358,358,358,
-358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,
-358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,
+360,360,360,360,360,360,360,360,360,120,360,360,360,360,120,120,
+360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,
+360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,
+360,120,360,360,360,360,120,120,360,360,360,360,360,360,360,120,
+360,120,360,360,360,360,120,120,360,360,360,360,360,360,360,360,
+360,360,360,360,360,360,360,120,360,360,360,360,360,360,360,360,
+360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,
+360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,
/* block 38 */
-358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,
-358,119,358,358,358,358,119,119,358,358,358,358,358,358,358,358,
-358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,
-358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,
-358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,
-358,358,358,358,358,358,358,358,358,358,358,119,119,359,359,359,
-360,360,360,360,360,360,360,360,360,361,361,361,361,361,361,361,
-361,361,361,361,361,361,361,361,361,361,361,361,361,119,119,119,
+360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,
+360,120,360,360,360,360,120,120,360,360,360,360,360,360,360,360,
+360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,
+360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,
+360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,
+360,360,360,360,360,360,360,360,360,360,360,120,120,361,361,361,
+362,362,362,362,362,362,362,362,362,363,363,363,363,363,363,363,
+363,363,363,363,363,363,363,363,363,363,363,363,363,120,120,120,
/* block 39 */
-358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,
-362,362,362,362,362,362,362,362,362,362,119,119,119,119,119,119,
-363,363,363,363,363,363,363,363,363,363,363,363,363,363,363,363,
-363,363,363,363,363,363,363,363,363,363,363,363,363,363,363,363,
-363,363,363,363,363,363,363,363,363,363,363,363,363,363,363,363,
-363,363,363,363,363,363,363,363,363,363,363,363,363,363,363,363,
-363,363,363,363,363,363,363,363,363,363,363,363,363,363,363,363,
-364,364,364,364,364,364,119,119,365,365,365,365,365,365,119,119,
+360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,
+364,364,364,364,364,364,364,364,364,364,120,120,120,120,120,120,
+365,365,365,365,365,365,365,365,365,365,365,365,365,365,365,365,
+365,365,365,365,365,365,365,365,365,365,365,365,365,365,365,365,
+365,365,365,365,365,365,365,365,365,365,365,365,365,365,365,365,
+365,365,365,365,365,365,365,365,365,365,365,365,365,365,365,365,
+365,365,365,365,365,365,365,365,365,365,365,365,365,365,365,365,
+366,366,366,366,366,366,120,120,367,367,367,367,367,367,120,120,
/* block 40 */
-366,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,
-367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,
-367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,
-367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,
-367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,
-367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,
-367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,
-367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,
+368,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,
+369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,
+369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,
+369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,
+369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,
+369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,
+369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,
+369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,
/* block 41 */
-367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,
-367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,
-367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,
-367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,
-367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,
-367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,
-367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,
-367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,
+369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,
+369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,
+369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,
+369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,
+369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,
+369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,
+369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,
+369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,
/* block 42 */
-367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,
-367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,
-367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,
-367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,
-367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,
-367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,
-367,367,367,367,367,367,367,367,367,367,367,367,367,368,368,367,
-367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,
+369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,
+369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,
+369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,
+369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,
+369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,
+369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,
+369,369,369,369,369,369,369,369,369,369,369,369,369,370,371,369,
+369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,
/* block 43 */
-369,370,370,370,370,370,370,370,370,370,370,370,370,370,370,370,
-370,370,370,370,370,370,370,370,370,370,370,371,372,119,119,119,
-373,373,373,373,373,373,373,373,373,373,373,373,373,373,373,373,
-373,373,373,373,373,373,373,373,373,373,373,373,373,373,373,373,
-373,373,373,373,373,373,373,373,373,373,373,373,373,373,373,373,
-373,373,373,373,373,373,373,373,373,373,373,373,373,373,373,373,
-373,373,373,373,373,373,373,373,373,373,373, 5, 5, 5,374,374,
-374,373,373,373,373,373,373,373,373,119,119,119,119,119,119,119,
+372,373,373,373,373,373,373,373,373,373,373,373,373,373,373,373,
+373,373,373,373,373,373,373,373,373,373,373,374,375,120,120,120,
+376,376,376,376,376,376,376,376,376,376,376,376,376,376,376,376,
+376,376,376,376,376,376,376,376,376,376,376,376,376,376,376,376,
+376,376,376,376,376,376,376,376,376,376,376,376,376,376,376,376,
+376,376,376,376,376,376,376,376,376,376,376,376,376,376,376,376,
+376,376,376,376,376,376,376,376,376,376,376, 5, 5, 5,377,377,
+377,376,376,376,376,376,376,376,376,120,120,120,120,120,120,120,
/* block 44 */
-375,375,375,375,375,375,375,375,375,375,375,375,375,119,375,375,
-375,375,376,376,376,119,119,119,119,119,119,119,119,119,119,119,
-377,377,377,377,377,377,377,377,377,377,377,377,377,377,377,377,
-377,377,378,378,378,379,379,119,119,119,119,119,119,119,119,119,
+378,378,378,378,378,378,378,378,378,378,378,378,378,120,378,378,
+378,378,379,379,379,120,120,120,120,120,120,120,120,120,120,120,
380,380,380,380,380,380,380,380,380,380,380,380,380,380,380,380,
-380,380,381,381,119,119,119,119,119,119,119,119,119,119,119,119,
-382,382,382,382,382,382,382,382,382,382,382,382,382,119,382,382,
-382,119,383,383,119,119,119,119,119,119,119,119,119,119,119,119,
+380,380,381,381,381,382,382,120,120,120,120,120,120,120,120,120,
+383,383,383,383,383,383,383,383,383,383,383,383,383,383,383,383,
+383,383,384,384,120,120,120,120,120,120,120,120,120,120,120,120,
+385,385,385,385,385,385,385,385,385,385,385,385,385,120,385,385,
+385,120,386,386,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 45 */
-384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,
-384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,
-384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,
-384,384,384,384,385,385,386,385,385,385,385,385,385,385,386,386,
-386,386,386,386,386,386,385,386,386,385,385,385,385,385,385,385,
-385,385,385,385,387,387,387,388,387,387,387,389,384,385,119,119,
-390,390,390,390,390,390,390,390,390,390,119,119,119,119,119,119,
-391,391,391,391,391,391,391,391,391,391,119,119,119,119,119,119,
+387,387,387,387,387,387,387,387,387,387,387,387,387,387,387,387,
+387,387,387,387,387,387,387,387,387,387,387,387,387,387,387,387,
+387,387,387,387,387,387,387,387,387,387,387,387,387,387,387,387,
+387,387,387,387,388,388,389,388,388,388,388,388,388,388,389,389,
+389,389,389,389,389,389,388,389,389,388,388,388,388,388,388,388,
+388,388,388,388,390,390,390,391,390,390,390,392,387,388,120,120,
+393,393,393,393,393,393,393,393,393,393,120,120,120,120,120,120,
+394,394,394,394,394,394,394,394,394,394,120,120,120,120,120,120,
/* block 46 */
-392,392,393,393,392,393,394,392,392,392,392,395,395,395,396,119,
-397,397,397,397,397,397,397,397,397,397,119,119,119,119,119,119,
-398,398,398,398,398,398,398,398,398,398,398,398,398,398,398,398,
-398,398,398,398,398,398,398,398,398,398,398,398,398,398,398,398,
-398,398,398,399,398,398,398,398,398,398,398,398,398,398,398,398,
-398,398,398,398,398,398,398,398,398,398,398,398,398,398,398,398,
-398,398,398,398,398,398,398,398,398,398,398,398,398,398,398,398,
-398,398,398,398,398,398,398,398,398,119,119,119,119,119,119,119,
+395,395,396,396,395,396,397,395,395,395,395,398,398,398,399,120,
+400,400,400,400,400,400,400,400,400,400,120,120,120,120,120,120,
+401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,
+401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,
+401,401,401,402,401,401,401,401,401,401,401,401,401,401,401,401,
+401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,
+401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,
+401,401,401,401,401,401,401,401,401,120,120,120,120,120,120,120,
/* block 47 */
-398,398,398,398,398,395,395,398,398,398,398,398,398,398,398,398,
-398,398,398,398,398,398,398,398,398,398,398,398,398,398,398,398,
-398,398,398,398,398,398,398,398,398,395,398,119,119,119,119,119,
-367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,
-367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,
-367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,
-367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,
-367,367,367,367,367,367,119,119,119,119,119,119,119,119,119,119,
+401,401,401,401,401,398,398,401,401,401,401,401,401,401,401,401,
+401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,
+401,401,401,401,401,401,401,401,401,398,401,120,120,120,120,120,
+369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,
+369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,
+369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,
+369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,
+369,369,369,369,369,369,120,120,120,120,120,120,120,120,120,120,
/* block 48 */
-400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,
-400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,119,
-401,401,401,402,402,402,402,401,401,402,402,402,119,119,119,119,
-402,402,401,402,402,402,402,402,402,401,401,401,119,119,119,119,
-403,119,119,119,404,404,405,405,405,405,405,405,405,405,405,405,
-406,406,406,406,406,406,406,406,406,406,406,406,406,406,406,406,
-406,406,406,406,406,406,406,406,406,406,406,406,406,406,119,119,
-406,406,406,406,406,119,119,119,119,119,119,119,119,119,119,119,
+403,403,403,403,403,403,403,403,403,403,403,403,403,403,403,403,
+403,403,403,403,403,403,403,403,403,403,403,403,403,403,403,120,
+404,404,404,405,405,405,405,404,404,405,405,405,120,120,120,120,
+405,405,404,405,405,405,405,405,405,404,404,404,120,120,120,120,
+406,120,120,120,407,407,408,408,408,408,408,408,408,408,408,408,
+409,409,409,409,409,409,409,409,409,409,409,409,409,409,409,409,
+409,409,409,409,409,409,409,409,409,409,409,409,409,409,120,120,
+409,409,409,409,409,120,120,120,120,120,120,120,120,120,120,120,
/* block 49 */
-407,407,407,407,407,407,407,407,407,407,407,407,407,407,407,407,
-407,407,407,407,407,407,407,407,407,407,407,407,407,407,407,407,
-407,407,407,407,407,407,407,407,407,407,407,407,119,119,119,119,
-407,407,407,407,407,407,407,407,407,407,407,407,407,407,407,407,
-407,407,407,407,407,407,407,407,407,407,119,119,119,119,119,119,
-408,408,408,408,408,408,408,408,408,408,409,119,119,119,410,410,
-411,411,411,411,411,411,411,411,411,411,411,411,411,411,411,411,
-411,411,411,411,411,411,411,411,411,411,411,411,411,411,411,411,
+410,410,410,410,410,410,410,410,410,410,410,410,410,410,410,410,
+410,410,410,410,410,410,410,410,410,410,410,410,410,410,410,410,
+410,410,410,410,410,410,410,410,410,410,410,410,120,120,120,120,
+410,410,410,410,410,410,410,410,410,410,410,410,410,410,410,410,
+410,410,410,410,410,410,410,410,410,410,120,120,120,120,120,120,
+411,411,411,411,411,411,411,411,411,411,412,120,120,120,413,413,
+414,414,414,414,414,414,414,414,414,414,414,414,414,414,414,414,
+414,414,414,414,414,414,414,414,414,414,414,414,414,414,414,414,
/* block 50 */
-412,412,412,412,412,412,412,412,412,412,412,412,412,412,412,412,
-412,412,412,412,412,412,412,413,413,414,414,413,119,119,415,415,
-416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,
-416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,
-416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,
-416,416,416,416,416,417,418,417,418,418,418,418,418,418,418,119,
-418,419,418,419,419,418,418,418,418,418,418,418,418,417,417,417,
-417,417,417,418,418,418,418,418,418,418,418,418,418,119,119,418,
+415,415,415,415,415,415,415,415,415,415,415,415,415,415,415,415,
+415,415,415,415,415,415,415,416,416,417,417,416,120,120,418,418,
+419,419,419,419,419,419,419,419,419,419,419,419,419,419,419,419,
+419,419,419,419,419,419,419,419,419,419,419,419,419,419,419,419,
+419,419,419,419,419,419,419,419,419,419,419,419,419,419,419,419,
+419,419,419,419,419,420,421,420,421,421,421,421,421,421,421,120,
+421,422,421,422,422,421,421,421,421,421,421,421,421,420,420,420,
+420,420,420,421,421,421,421,421,421,421,421,421,421,120,120,421,
/* block 51 */
-420,420,420,420,420,420,420,420,420,420,119,119,119,119,119,119,
-420,420,420,420,420,420,420,420,420,420,119,119,119,119,119,119,
-421,421,421,421,421,421,421,422,421,421,421,421,421,421,119,119,
-112,112,112,112,112,112,112,112,112,112,112,112,112,112,423,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+423,423,423,423,423,423,423,423,423,423,120,120,120,120,120,120,
+423,423,423,423,423,423,423,423,423,423,120,120,120,120,120,120,
+424,424,424,424,424,424,424,425,424,424,424,424,424,424,120,120,
+113,113,113,113,113,113,113,113,113,113,113,113,113,113,426,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 52 */
-424,424,424,424,425,426,426,426,426,426,426,426,426,426,426,426,
-426,426,426,426,426,426,426,426,426,426,426,426,426,426,426,426,
-426,426,426,426,426,426,426,426,426,426,426,426,426,426,426,426,
-426,426,426,426,424,425,424,424,424,424,424,425,424,425,425,425,
-425,425,424,425,425,426,426,426,426,426,426,426,119,119,119,119,
-427,427,427,427,427,427,427,427,427,427,428,428,428,428,428,428,
-428,429,429,429,429,429,429,429,429,429,429,424,424,424,424,424,
-424,424,424,424,429,429,429,429,429,429,429,429,429,119,119,119,
+427,427,427,427,428,429,429,429,429,429,429,429,429,429,429,429,
+429,429,429,429,429,429,429,429,429,429,429,429,429,429,429,429,
+429,429,429,429,429,429,429,429,429,429,429,429,429,429,429,429,
+429,429,429,429,427,430,427,427,427,427,427,428,427,428,428,428,
+428,428,427,428,428,429,429,429,429,429,429,429,120,120,120,120,
+431,431,431,431,431,431,431,431,431,431,432,432,432,432,432,432,
+432,433,433,433,433,433,433,433,433,433,433,427,427,427,427,427,
+427,427,427,427,433,433,433,433,433,433,433,433,433,120,120,120,
/* block 53 */
-430,430,431,432,432,432,432,432,432,432,432,432,432,432,432,432,
-432,432,432,432,432,432,432,432,432,432,432,432,432,432,432,432,
-432,431,430,430,430,430,431,431,430,430,431,430,430,430,432,432,
-433,433,433,433,433,433,433,433,433,433,432,432,432,432,432,432,
-434,434,434,434,434,434,434,434,434,434,434,434,434,434,434,434,
-434,434,434,434,434,434,434,434,434,434,434,434,434,434,434,434,
-434,434,434,434,434,434,435,436,435,435,436,436,436,435,436,435,
-435,435,436,436,119,119,119,119,119,119,119,119,437,437,437,437,
-
-/* block 54 */
+434,434,435,436,436,436,436,436,436,436,436,436,436,436,436,436,
+436,436,436,436,436,436,436,436,436,436,436,436,436,436,436,436,
+436,435,434,434,434,434,435,435,434,434,435,434,434,434,436,436,
+437,437,437,437,437,437,437,437,437,437,436,436,436,436,436,436,
438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,
438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,
-438,438,438,438,439,439,439,439,439,439,439,439,440,440,440,440,
-440,440,440,440,439,439,440,440,119,119,119,441,441,441,441,441,
-442,442,442,442,442,442,442,442,442,442,119,119,119,438,438,438,
-443,443,443,443,443,443,443,443,443,443,444,444,444,444,444,444,
-444,444,444,444,444,444,444,444,444,444,444,444,444,444,444,444,
-444,444,444,444,444,444,444,444,445,445,445,445,445,445,446,446,
+438,438,438,438,438,438,439,440,439,439,440,440,440,439,440,439,
+439,439,440,440,120,120,120,120,120,120,120,120,441,441,441,441,
+
+/* block 54 */
+442,442,442,442,442,442,442,442,442,442,442,442,442,442,442,442,
+442,442,442,442,442,442,442,442,442,442,442,442,442,442,442,442,
+442,442,442,442,443,443,443,443,443,443,443,443,444,444,444,444,
+444,444,444,444,443,443,444,444,120,120,120,445,445,445,445,445,
+446,446,446,446,446,446,446,446,446,446,120,120,120,442,442,442,
+447,447,447,447,447,447,447,447,447,447,448,448,448,448,448,448,
+448,448,448,448,448,448,448,448,448,448,448,448,448,448,448,448,
+448,448,448,448,448,448,448,448,449,449,449,449,449,449,450,450,
/* block 55 */
-447,448,449,450,451,452,453,454,455,119,119,119,119,119,119,119,
-456,456,456,456,456,456,456,456,456,456,456,456,456,456,456,456,
-456,456,456,456,456,456,456,456,456,456,456,456,456,456,456,456,
-456,456,456,456,456,456,456,456,456,456,456,119,119,456,456,456,
-457,457,457,457,457,457,457,457,119,119,119,119,119,119,119,119,
-458,459,458,460,459,461,461,462,461,462,463,459,462,462,459,459,
-462,464,459,459,459,459,459,459,459,465,466,465,465,461,465,465,
-465,465,467,467,468,466,466,469,470,470,119,119,119,119,119,119,
+451,452,453,454,455,456,457,458,459,120,120,120,120,120,120,120,
+460,460,460,460,460,460,460,460,460,460,460,460,460,460,460,460,
+460,460,460,460,460,460,460,460,460,460,460,460,460,460,460,460,
+460,460,460,460,460,460,460,460,460,460,460,120,120,460,460,460,
+461,461,461,461,461,461,461,461,120,120,120,120,120,120,120,120,
+462,463,462,464,463,465,465,466,465,466,467,463,466,466,463,463,
+466,468,463,463,463,463,463,463,463,469,470,471,471,465,471,471,
+471,471,472,473,474,470,470,475,476,476,477,120,120,120,120,120,
/* block 56 */
35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
- 35, 35, 35, 35, 35, 35,127,127,127,127,127,471,109,109,109,109,
-109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
-109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
-109,109,109,109,109,109,109,109,109,109,109,109,109,120,120,120,
-120,120,109,109,109,109,120,120,120,120,120, 35, 35, 35, 35, 35,
- 35, 35, 35, 35, 35, 35, 35, 35,472,473, 35, 35, 35,474, 35, 35,
+ 35, 35, 35, 35, 35, 35,128,128,128,128,128,478,110,110,110,110,
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,
+110,110,110,110,110,110,110,110,110,110,110,110,110,121,121,121,
+121,121,110,110,110,110,121,121,121,121,121, 35, 35, 35, 35, 35,
+ 35, 35, 35, 35, 35, 35, 35, 35,479,480, 35, 35, 35,481, 35, 35,
/* block 57 */
- 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
- 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,109,109,109,109,109,
-109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
-109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,120,
-113,113,112,112,112,112,112,112,112,112,112,112,112,112,112,112,
-112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,
-112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,
-112,112,112,112,112,112,112,112,112,112,119,112,112,112,112,112,
+ 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,482, 35,
+ 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,110,110,110,110,110,
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,
+110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,121,
+114,114,113,113,113,113,113,113,113,113,113,113,113,113,113,113,
+113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,
+113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,
+113,113,113,113,113,113,113,113,113,113,120,113,113,113,113,113,
/* block 58 */
32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
@@ -2251,12 +2286,12 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 68608 bytes, block = 128 */
32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
-475,476, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
+483,484, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
/* block 59 */
32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
- 32, 33, 32, 33, 32, 33, 35, 35, 35, 35, 35,477, 35, 35,478, 35,
+ 32, 33, 32, 33, 32, 33, 35, 35, 35, 35, 35,485, 35, 35,486, 35,
32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
@@ -2265,58 +2300,58 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 68608 bytes, block = 128 */
32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
/* block 60 */
-479,479,479,479,479,479,479,479,480,480,480,480,480,480,480,480,
-479,479,479,479,479,479,119,119,480,480,480,480,480,480,119,119,
-479,479,479,479,479,479,479,479,480,480,480,480,480,480,480,480,
-479,479,479,479,479,479,479,479,480,480,480,480,480,480,480,480,
-479,479,479,479,479,479,119,119,480,480,480,480,480,480,119,119,
-127,479,127,479,127,479,127,479,119,480,119,480,119,480,119,480,
-479,479,479,479,479,479,479,479,480,480,480,480,480,480,480,480,
-481,481,482,482,482,482,483,483,484,484,485,485,486,486,119,119,
+487,487,487,487,487,487,487,487,488,488,488,488,488,488,488,488,
+487,487,487,487,487,487,120,120,488,488,488,488,488,488,120,120,
+487,487,487,487,487,487,487,487,488,488,488,488,488,488,488,488,
+487,487,487,487,487,487,487,487,488,488,488,488,488,488,488,488,
+487,487,487,487,487,487,120,120,488,488,488,488,488,488,120,120,
+128,487,128,487,128,487,128,487,120,488,120,488,120,488,120,488,
+487,487,487,487,487,487,487,487,488,488,488,488,488,488,488,488,
+489,489,490,490,490,490,491,491,492,492,493,493,494,494,120,120,
/* block 61 */
-479,479,479,479,479,479,479,479,487,487,487,487,487,487,487,487,
-479,479,479,479,479,479,479,479,487,487,487,487,487,487,487,487,
-479,479,479,479,479,479,479,479,487,487,487,487,487,487,487,487,
-479,479,127,488,127,119,127,127,480,480,489,489,490,118,491,118,
-118,118,127,488,127,119,127,127,492,492,492,492,490,118,118,118,
-479,479,127,127,119,119,127,127,480,480,493,493,119,118,118,118,
-479,479,127,127,127,168,127,127,480,480,494,494,173,118,118,118,
-119,119,127,488,127,119,127,127,495,495,496,496,490,118,118,119,
+487,487,487,487,487,487,487,487,495,495,495,495,495,495,495,495,
+487,487,487,487,487,487,487,487,495,495,495,495,495,495,495,495,
+487,487,487,487,487,487,487,487,495,495,495,495,495,495,495,495,
+487,487,128,496,128,120,128,128,488,488,497,497,498,119,499,119,
+119,119,128,496,128,120,128,128,500,500,500,500,498,119,119,119,
+487,487,128,128,120,120,128,128,488,488,501,501,120,119,119,119,
+487,487,128,128,128,169,128,128,488,488,502,502,174,119,119,119,
+120,120,128,496,128,120,128,128,503,503,504,504,498,119,119,120,
/* block 62 */
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 24,497,498, 24, 24,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 24,505,506, 24, 24,
10, 10, 10, 10, 10, 10, 5, 5, 23, 27, 7, 23, 23, 27, 7, 23,
- 5, 5, 5, 5, 5, 5, 5, 5,499,500, 24, 24, 24, 24, 24, 4,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 23, 27, 5,501, 5, 5, 16,
- 16, 5, 5, 5, 9, 7, 8, 5, 5,501, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5,507,508, 24, 24, 24, 24, 24,509,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 23, 27, 5,510, 5, 5, 16,
+ 16, 5, 5, 5, 9, 7, 8, 5, 5,510, 5, 5, 5, 5, 5, 5,
5, 5, 9, 5, 16, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4,
- 24, 24, 24, 24, 24,502, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
- 25,109,119,119, 25, 25, 25, 25, 25, 25, 9, 9, 9, 7, 8,109,
+ 24, 24, 24, 24, 24,511, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+ 25,110,120,120, 25, 25, 25, 25, 25, 25, 9, 9, 9, 7, 8,110,
/* block 63 */
- 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 9, 9, 9, 7, 8,119,
-109,109,109,109,109,109,109,109,109,109,109,109,109,119,119,119,
+ 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 9, 9, 9, 7, 8,120,
+110,110,110,110,110,110,110,110,110,110,110,110,110,120,120,120,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-112,112,112,112,112,112,112,112,112,112,112,112,112,423,423,423,
-423,112,423,423,423,112,112,112,112,112,112,112,112,112,112,112,
-503,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+113,113,113,113,113,113,113,113,113,113,113,113,113,426,426,426,
+426,113,426,426,426,113,113,113,113,113,113,113,113,113,113,113,
+512,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 64 */
- 20, 20,504, 20, 20, 20, 20,504, 20, 20,505,504,504,504,505,505,
-504,504,504,505, 20,504, 20, 20, 9,504,504,504,504,504, 20, 20,
- 20, 20, 21, 20,504, 20,506, 20,504, 20,507,508,504,504, 20,505,
-504,504,509,504,505,510,510,510,510,511, 20, 20,505,505,504,504,
- 9, 9, 9, 9, 9,504,505,505,505,505, 20, 9, 20, 20,512, 20,
+ 20, 20,513, 20, 20, 20, 20,513, 20, 20,514,513,513,513,514,514,
+513,513,513,514, 20,513, 20, 20, 9,513,513,513,513,513, 20, 20,
+ 20, 20, 21, 20,513, 20,515, 20,513, 20,516,517,513,513, 20,514,
+513,513,518,513,514,519,519,519,519,520, 20, 20,514,514,513,513,
+ 9, 9, 9, 9, 9,513,514,514,514,514, 20, 9, 20, 20,521, 20,
25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
-513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,
-514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,
+522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,
+523,523,523,523,523,523,523,523,523,523,523,523,523,523,523,523,
/* block 65 */
-515,515,515, 32, 33,515,515,515,515, 25, 20, 20,119,119,119,119,
- 9, 9, 9, 9,516, 21, 21, 21, 21, 21, 9, 9, 20, 20, 20, 20,
+524,524,524, 32, 33,524,524,524,524, 25, 20, 20,120,120,120,120,
+ 9, 9, 9, 9,525, 21, 21, 21, 21, 21, 9, 9, 20, 20, 20, 20,
9, 20, 20, 9, 20, 20, 9, 20, 20, 21, 21, 20, 20, 20, 9, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 9, 9,
@@ -2357,10 +2392,10 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 68608 bytes, block = 128 */
/* block 69 */
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+ 20, 20, 20, 20, 20, 20, 20,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
@@ -2368,10 +2403,10 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 68608 bytes, block = 128 */
25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20,517,517,517,517,517,517,517,517,517,517,
-517,517,518,517,517,517,517,517,517,517,517,517,517,517,517,517,
-519,519,519,519,519,519,519,519,519,519,519,519,519,519,519,519,
-519,519,519,519,519,519,519,519,519,519, 25, 25, 25, 25, 25, 25,
+ 20, 20, 20, 20, 20, 20,526,526,526,526,526,526,526,526,526,526,
+526,526,527,526,526,526,526,526,526,526,526,526,526,526,526,526,
+528,528,528,528,528,528,528,528,528,528,528,528,528,528,528,528,
+528,528,528,528,528,528,528,528,528,528, 25, 25, 25, 25, 25, 25,
25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
/* block 71 */
@@ -2392,7 +2427,7 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 68608 bytes, block = 128 */
21, 9, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 9, 9, 9,516,516,516,516, 9,
+ 20, 20, 20, 20, 20, 20, 20, 20, 9, 9, 9,525,525,525,525, 9,
/* block 73 */
21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21,
@@ -2401,7 +2436,7 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 68608 bytes, block = 128 */
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
- 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,516,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,525,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
/* block 74 */
@@ -2435,20 +2470,20 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 68608 bytes, block = 128 */
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
/* block 77 */
-520,520,520,520,520,520,520,520,520,520,520,520,520,520,520,520,
-520,520,520,520,520,520,520,520,520,520,520,520,520,520,520,520,
-520,520,520,520,520,520,520,520,520,520,520,520,520,520,520,520,
-520,520,520,520,520,520,520,520,520,520,520,520,520,520,520,520,
-520,520,520,520,520,520,520,520,520,520,520,520,520,520,520,520,
-520,520,520,520,520,520,520,520,520,520,520,520,520,520,520,520,
-520,520,520,520,520,520,520,520,520,520,520,520,520,520,520,520,
-520,520,520,520,520,520,520,520,520,520,520,520,520,520,520,520,
+529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,
+529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,
+529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,
+529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,
+529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,
+529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,
+529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,
+529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,
/* block 78 */
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9,516,516, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9,525,525, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
@@ -2472,167 +2507,167 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 68608 bytes, block = 128 */
9, 9, 9, 9, 9, 20, 20, 9, 9, 9, 9, 9, 9, 20, 20, 20,
21, 20, 20, 20, 20, 21, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20,119,119, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20,120,120, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
/* block 81 */
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20,119,119, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20,120,120, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20,119, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,119,
/* block 82 */
-521,521,521,521,521,521,521,521,521,521,521,521,521,521,521,521,
-521,521,521,521,521,521,521,521,521,521,521,521,521,521,521,521,
-521,521,521,521,521,521,521,521,521,521,521,521,521,521,521,119,
-522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,
-522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,
-522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,119,
- 32, 33,523,524,525,526,527, 32, 33, 32, 33, 32, 33,528,529,530,
-531, 35, 32, 33, 35, 32, 33, 35, 35, 35, 35, 35,109,109,532,532,
+530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,
+530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,
+530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,120,
+531,531,531,531,531,531,531,531,531,531,531,531,531,531,531,531,
+531,531,531,531,531,531,531,531,531,531,531,531,531,531,531,531,
+531,531,531,531,531,531,531,531,531,531,531,531,531,531,531,120,
+ 32, 33,532,533,534,535,536, 32, 33, 32, 33, 32, 33,537,538,539,
+540, 35, 32, 33, 35, 32, 33, 35, 35, 35, 35, 35,110,110,541,541,
/* block 83 */
-164,165,164,165,164,165,164,165,164,165,164,165,164,165,164,165,
-164,165,164,165,164,165,164,165,164,165,164,165,164,165,164,165,
-164,165,164,165,164,165,164,165,164,165,164,165,164,165,164,165,
-164,165,164,165,164,165,164,165,164,165,164,165,164,165,164,165,
-164,165,164,165,164,165,164,165,164,165,164,165,164,165,164,165,
-164,165,164,165,164,165,164,165,164,165,164,165,164,165,164,165,
-164,165,164,165,533,534,534,534,534,534,534,164,165,164,165,535,
-535,535,164,165,119,119,119,119,119,536,536,536,536,537,536,536,
+165,166,165,166,165,166,165,166,165,166,165,166,165,166,165,166,
+165,166,165,166,165,166,165,166,165,166,165,166,165,166,165,166,
+165,166,165,166,165,166,165,166,165,166,165,166,165,166,165,166,
+165,166,165,166,165,166,165,166,165,166,165,166,165,166,165,166,
+165,166,165,166,165,166,165,166,165,166,165,166,165,166,165,166,
+165,166,165,166,165,166,165,166,165,166,165,166,165,166,165,166,
+165,166,165,166,542,543,543,543,543,543,543,165,166,165,166,544,
+544,544,165,166,120,120,120,120,120,545,545,545,545,546,545,545,
/* block 84 */
-538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,
-538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,
-538,538,538,538,538,538,119,538,119,119,119,119,119,538,119,119,
-539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,
-539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,
-539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,
-539,539,539,539,539,539,539,539,119,119,119,119,119,119,119,540,
-541,119,119,119,119,119,119,119,119,119,119,119,119,119,119,542,
+547,547,547,547,547,547,547,547,547,547,547,547,547,547,547,547,
+547,547,547,547,547,547,547,547,547,547,547,547,547,547,547,547,
+547,547,547,547,547,547,120,547,120,120,120,120,120,547,120,120,
+548,548,548,548,548,548,548,548,548,548,548,548,548,548,548,548,
+548,548,548,548,548,548,548,548,548,548,548,548,548,548,548,548,
+548,548,548,548,548,548,548,548,548,548,548,548,548,548,548,548,
+548,548,548,548,548,548,548,548,120,120,120,120,120,120,120,549,
+550,120,120,120,120,120,120,120,120,120,120,120,120,120,120,551,
/* block 85 */
-358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,
-358,358,358,358,358,358,358,119,119,119,119,119,119,119,119,119,
-358,358,358,358,358,358,358,119,358,358,358,358,358,358,358,119,
-358,358,358,358,358,358,358,119,358,358,358,358,358,358,358,119,
-358,358,358,358,358,358,358,119,358,358,358,358,358,358,358,119,
-358,358,358,358,358,358,358,119,358,358,358,358,358,358,358,119,
-543,543,543,543,543,543,543,543,543,543,543,543,543,543,543,543,
-543,543,543,543,543,543,543,543,543,543,543,543,543,543,543,543,
+360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,
+360,360,360,360,360,360,360,120,120,120,120,120,120,120,120,120,
+360,360,360,360,360,360,360,120,360,360,360,360,360,360,360,120,
+360,360,360,360,360,360,360,120,360,360,360,360,360,360,360,120,
+360,360,360,360,360,360,360,120,360,360,360,360,360,360,360,120,
+360,360,360,360,360,360,360,120,360,360,360,360,360,360,360,120,
+552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,
+552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,
/* block 86 */
5, 5, 23, 27, 23, 27, 5, 5, 5, 23, 27, 5, 23, 27, 5, 5,
5, 5, 5, 5, 5, 5, 5, 10, 5, 5, 10, 5, 23, 27, 5, 5,
- 23, 27, 7, 8, 7, 8, 7, 8, 7, 8, 5, 5, 5, 5, 5,110,
+ 23, 27, 7, 8, 7, 8, 7, 8, 7, 8, 5, 5, 5, 5, 5,111,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 10, 10, 5, 5, 5, 5,
- 10, 5, 7,544, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+ 10, 5, 7,553, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 87 */
-545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,
-545,545,545,545,545,545,545,545,545,545,119,545,545,545,545,545,
-545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,
-545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,
-545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,
-545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,
-545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,
-545,545,545,545,119,119,119,119,119,119,119,119,119,119,119,119,
+554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,
+554,554,554,554,554,554,554,554,554,554,120,554,554,554,554,554,
+554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,
+554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,
+554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,
+554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,
+554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,
+554,554,554,554,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 88 */
-545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,
-545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,
-545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,
-545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,
-545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,
-545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,
-545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,
-545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,
+554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,
+554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,
+554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,
+554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,
+554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,
+554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,
+554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,
+554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,
/* block 89 */
-545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,
-545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,
-545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,
-545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,
-545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,
-545,545,545,545,545,545,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,119,119,119,119,
+554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,
+554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,
+554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,
+554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,
+554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,
+554,554,554,554,554,554,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,120,120,120,120,
/* block 90 */
- 4,546,546,547, 20,548,549,550,551,552,551,552,551,552,551,552,
-551,552, 20,553,551,552,551,552,551,552,551,552,554,555,556,556,
- 20,550,550,550,550,550,550,550,550,550,557,557,557,557,558,558,
-559,560,560,560,560,560, 20,553,550,550,550,548,561,562,563,563,
-119,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,
-564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,
-564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,
-564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,
+ 4,555,555,556, 20,557,558,559,560,561,560,561,560,561,560,561,
+560,561, 20,562,560,561,560,561,560,561,560,561,563,564,565,565,
+ 20,559,559,559,559,559,559,559,559,559,566,566,566,566,567,567,
+568,569,569,569,569,569, 20,562,559,559,559,557,570,571,572,572,
+120,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,
+573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,
+573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,
+573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,
/* block 91 */
-564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,
-564,564,564,564,564,564,564,119,119,565,565,566,566,567,567,564,
-568,569,569,569,569,569,569,569,569,569,569,569,569,569,569,569,
-569,569,569,569,569,569,569,569,569,569,569,569,569,569,569,569,
-569,569,569,569,569,569,569,569,569,569,569,569,569,569,569,569,
-569,569,569,569,569,569,569,569,569,569,569,569,569,569,569,569,
-569,569,569,569,569,569,569,569,569,569,569,569,569,569,569,569,
-569,569,569,569,569,569,569,569,569,569,569,546,560,570,570,569,
+573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,
+573,573,573,573,573,573,573,120,120,574,574,575,575,576,576,573,
+577,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,
+578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,
+578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,
+578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,
+578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,
+578,578,578,578,578,578,578,578,578,578,578,555,569,579,579,578,
/* block 92 */
-119,119,119,119,119,571,571,571,571,571,571,571,571,571,571,571,
-571,571,571,571,571,571,571,571,571,571,571,571,571,571,571,571,
-571,571,571,571,571,571,571,571,571,571,571,571,571,571,571,571,
-119,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,
-572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,
-572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,
-572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,
-572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,
+120,120,120,120,120,580,580,580,580,580,580,580,580,580,580,580,
+580,580,580,580,580,580,580,580,580,580,580,580,580,580,580,580,
+580,580,580,580,580,580,580,580,580,580,580,580,580,580,580,580,
+120,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,
+581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,
+581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,
+581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,
+581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,
/* block 93 */
-572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,119,
-563,563,573,573,573,573,563,563,563,563,563,563,563,563,563,563,
-571,571,571,571,571,571,571,571,571,571,571,571,571,571,571,571,
-571,571,571,571,571,571,571,571,571,571,571,119,119,119,119,119,
-563,563,563,563,563,563,563,563,563,563,563,563,563,563,563,563,
-563,563,563,563,563,563,563,563,563,563,563,563,563,563,563,563,
-563,563,563,563,119,119,119,119,119,119,119,119,119,119,119,119,
-569,569,569,569,569,569,569,569,569,569,569,569,569,569,569,569,
+581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,120,
+572,572,582,582,582,582,572,572,572,572,572,572,572,572,572,572,
+580,580,580,580,580,580,580,580,580,580,580,580,580,580,580,580,
+580,580,580,580,580,580,580,580,580,580,580,120,120,120,120,120,
+572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,
+572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,
+572,572,572,572,120,120,120,120,120,120,120,120,120,120,120,120,
+578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,
/* block 94 */
-574,574,574,574,574,574,574,574,574,574,574,574,574,574,574,574,
-574,574,574,574,574,574,574,574,574,574,574,574,574,574,574,119,
-573,573,573,573,573,573,573,573,573,573,563,563,563,563,563,563,
-563,563,563,563,563,563,563,563,563,563,563,563,563,563,563,563,
-563,563,563,563,563,563,563,563, 25, 25, 25, 25, 25, 25, 25, 25,
+583,583,583,583,583,583,583,583,583,583,583,583,583,583,583,583,
+583,583,583,583,583,583,583,583,583,583,583,583,583,583,583,120,
+582,582,582,582,582,582,582,582,582,582,572,572,572,572,572,572,
+572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,
+572,572,572,572,572,572,572,572, 25, 25, 25, 25, 25, 25, 25, 25,
20, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
-574,574,574,574,574,574,574,574,574,574,574,574,574,574,574,574,
-574,574,574,574,574,574,574,574,574,574,574,574,574,574,574, 20,
+583,583,583,583,583,583,583,583,583,583,583,583,583,583,583,583,
+583,583,583,583,583,583,583,583,583,583,583,583,583,583,583, 20,
/* block 95 */
-573,573,573,573,573,573,573,573,573,573,563,563,563,563,563,563,
-563,563,563,563,563,563,563,575,563,575,563,563,563,563,563,563,
-563,563,563,563,563,563,563,563,563,563,563,563,563,563,563,563,
-563, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
-563,563,563,563,563,563,563,563,563,563,563,563, 20, 20, 20, 20,
-576,576,576,576,576,576,576,576,576,576,576,576,576,576,576,576,
-576,576,576,576,576,576,576,576,576,576,576,576,576,576,576,576,
-576,576,576,576,576,576,576,576,576,576,576,576,576,576,576,119,
+582,582,582,582,582,582,582,582,582,582,572,572,572,572,572,572,
+572,572,572,572,572,572,572,584,572,584,572,572,572,572,572,572,
+572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,
+572, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+572,572,572,572,572,572,572,572,572,572,572,572, 20, 20, 20, 20,
+585,585,585,585,585,585,585,585,585,585,585,585,585,585,585,585,
+585,585,585,585,585,585,585,585,585,585,585,585,585,585,585,585,
+585,585,585,585,585,585,585,585,585,585,585,585,585,585,585,572,
/* block 96 */
-576,576,576,576,576,576,576,576,576,576,576,576,576,576,576,576,
-576,576,576,576,576,576,576,576,576,576,576,576,576,576,576,576,
-576,576,576,576,576,576,576,576,576,576,576,576,576,576,576,576,
-576,576,576,576,576,576,576,576,576,576,576,576,576,576,576,576,
-576,576,576,576,576,576,576,576,576,576,576,576,576,576,576,576,
-576,576,576,576,576,576,576,576,563,563,563,563,563,563,563,563,
-563,563,563,563,563,563,563,563,563,563,563,563,563,563,563,563,
-563, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,563,563,563,563,563,
+585,585,585,585,585,585,585,585,585,585,585,585,585,585,585,585,
+585,585,585,585,585,585,585,585,585,585,585,585,585,585,585,585,
+585,585,585,585,585,585,585,585,585,585,585,585,585,585,585,585,
+585,585,585,585,585,585,585,585,585,585,585,585,585,585,585,585,
+585,585,585,585,585,585,585,585,585,585,585,585,585,585,585,585,
+585,585,585,585,585,585,585,585,572,572,572,572,572,572,572,572,
+572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,
+572, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,572,572,572,572,572,
/* block 97 */
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
@@ -2641,1160 +2676,1190 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 68608 bytes, block = 128 */
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
-563,563,563,563,563,563,563,563,563,563,563,563,563,563,563,563,
-563,563,563,563,563,563,563,563,563,563,563,563,563,563,563, 20,
+572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,
+572,572,572,572,572,572,572,572,572,572,572,572,572,572,572, 20,
/* block 98 */
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
/* block 99 */
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,119,119,119,119,119,119,119,119,119,119,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,120,120,120,120,120,120,120,120,120,120,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
/* block 100 */
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 101 */
-578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,
-578,578,578,578,578,579,578,578,578,578,578,578,578,578,578,578,
-578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,
-578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,
-578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,
-578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,
-578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,
-578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,
+587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,587,588,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
/* block 102 */
-578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,
-578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,
-578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,
-578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,
-578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,
-578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,
-578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,
-578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,
+587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
/* block 103 */
-578,578,578,578,578,578,578,578,578,578,578,578,578,119,119,119,
-580,580,580,580,580,580,580,580,580,580,580,580,580,580,580,580,
-580,580,580,580,580,580,580,580,580,580,580,580,580,580,580,580,
-580,580,580,580,580,580,580,580,580,580,580,580,580,580,580,580,
-580,580,580,580,580,580,580,119,119,119,119,119,119,119,119,119,
-581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,
-581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,
-581,581,581,581,581,581,581,581,582,582,582,582,582,582,583,583,
+587,587,587,587,587,587,587,587,587,587,587,587,587,120,120,120,
+589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,
+589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,
+589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,
+589,589,589,589,589,589,589,120,120,120,120,120,120,120,120,120,
+590,590,590,590,590,590,590,590,590,590,590,590,590,590,590,590,
+590,590,590,590,590,590,590,590,590,590,590,590,590,590,590,590,
+590,590,590,590,590,590,590,590,591,591,591,591,591,591,592,592,
/* block 104 */
-584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,
-584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,
-584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,
-584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,
-584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,
-584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,
-584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,
-584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,
+593,593,593,593,593,593,593,593,593,593,593,593,593,593,593,593,
+593,593,593,593,593,593,593,593,593,593,593,593,593,593,593,593,
+593,593,593,593,593,593,593,593,593,593,593,593,593,593,593,593,
+593,593,593,593,593,593,593,593,593,593,593,593,593,593,593,593,
+593,593,593,593,593,593,593,593,593,593,593,593,593,593,593,593,
+593,593,593,593,593,593,593,593,593,593,593,593,593,593,593,593,
+593,593,593,593,593,593,593,593,593,593,593,593,593,593,593,593,
+593,593,593,593,593,593,593,593,593,593,593,593,593,593,593,593,
/* block 105 */
-584,584,584,584,584,584,584,584,584,584,584,584,585,586,586,586,
-584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,
-587,587,587,587,587,587,587,587,587,587,584,584,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-191,192,191,192,191,192,191,192,191,192,588,589,191,192,191,192,
-191,192,191,192,191,192,191,192,191,192,191,192,191,192,191,192,
-191,192,191,192,191,192,191,192,191,192,191,192,191,192,590,197,
-199,199,199,591,543,543,543,543,543,543,543,543,543,543,591,472,
+593,593,593,593,593,593,593,593,593,593,593,593,594,595,595,595,
+593,593,593,593,593,593,593,593,593,593,593,593,593,593,593,593,
+596,596,596,596,596,596,596,596,596,596,593,593,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+192,193,192,193,192,193,192,193,192,193,597,598,192,193,192,193,
+192,193,192,193,192,193,192,193,192,193,192,193,192,193,192,193,
+192,193,192,193,192,193,192,193,192,193,192,193,192,193,599,198,
+200,200,200,600,552,552,552,552,552,552,552,552,552,552,600,479,
/* block 106 */
-191,192,191,192,191,192,191,192,191,192,191,192,191,192,191,192,
-191,192,191,192,191,192,191,192,191,192,191,192,472,472,543,543,
-592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
-592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
-592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
-592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
-592,592,592,592,592,592,593,593,593,593,593,593,593,593,593,593,
-594,594,595,595,595,595,595,595,119,119,119,119,119,119,119,119,
+192,193,192,193,192,193,192,193,192,193,192,193,192,193,192,193,
+192,193,192,193,192,193,192,193,192,193,192,193,479,479,552,552,
+601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,
+601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,
+601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,
+601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,
+601,601,601,601,601,601,602,602,602,602,602,602,602,602,602,602,
+603,603,604,604,604,604,604,604,120,120,120,120,120,120,120,120,
/* block 107 */
15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15,110,110,110,110,110,110,110,110,110,
+ 15, 15, 15, 15, 15, 15, 15,111,111,111,111,111,111,111,111,111,
15, 15, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
35, 35, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
-109, 35, 35, 35, 35, 35, 35, 35, 35, 32, 33, 32, 33,596, 32, 33,
+110, 35, 35, 35, 35, 35, 35, 35, 35, 32, 33, 32, 33,605, 32, 33,
/* block 108 */
- 32, 33, 32, 33, 32, 33, 32, 33,110, 15, 15, 32, 33,597, 35, 22,
- 32, 33, 32, 33, 35, 35, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
- 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,598,599,600,601,598, 35,
-602,603,604,605, 32, 33, 32, 33, 32, 33,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119, 22,109,109, 35, 22, 22, 22, 22, 22,
+ 32, 33, 32, 33, 32, 33, 32, 33,111, 15, 15, 32, 33,606, 35, 22,
+ 32, 33, 32, 33,607, 35, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
+ 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,608,609,610,611,608, 35,
+612,613,614,615, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
+120,120, 32, 33,616,617,618,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120, 22,110,110, 35, 22, 22, 22, 22, 22,
/* block 109 */
-606,606,607,606,606,606,607,606,606,606,606,607,606,606,606,606,
-606,606,606,606,606,606,606,606,606,606,606,606,606,606,606,606,
-606,606,606,608,608,607,607,608,609,609,609,609,119,119,119,119,
-610,610,610,611,611,611,612,612,613,612,119,119,119,119,119,119,
-614,614,614,614,614,614,614,614,614,614,614,614,614,614,614,614,
-614,614,614,614,614,614,614,614,614,614,614,614,614,614,614,614,
-614,614,614,614,614,614,614,614,614,614,614,614,614,614,614,614,
-614,614,614,614,615,615,615,615,119,119,119,119,119,119,119,119,
+619,619,620,619,619,619,620,619,619,619,619,620,619,619,619,619,
+619,619,619,619,619,619,619,619,619,619,619,619,619,619,619,619,
+619,619,619,621,621,620,620,621,622,622,622,622,120,120,120,120,
+623,623,623,624,624,624,625,625,626,625,120,120,120,120,120,120,
+627,627,627,627,627,627,627,627,627,627,627,627,627,627,627,627,
+627,627,627,627,627,627,627,627,627,627,627,627,627,627,627,627,
+627,627,627,627,627,627,627,627,627,627,627,627,627,627,627,627,
+627,627,627,627,628,628,628,628,120,120,120,120,120,120,120,120,
/* block 110 */
-616,616,617,617,617,617,617,617,617,617,617,617,617,617,617,617,
-617,617,617,617,617,617,617,617,617,617,617,617,617,617,617,617,
-617,617,617,617,617,617,617,617,617,617,617,617,617,617,617,617,
-617,617,617,617,616,616,616,616,616,616,616,616,616,616,616,616,
-616,616,616,616,618,618,119,119,119,119,119,119,119,119,619,619,
-620,620,620,620,620,620,620,620,620,620,119,119,119,119,119,119,
-251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,
-251,621,253,622,253,253,253,253,259,259,259,253,259,253,253,251,
+629,629,630,630,630,630,630,630,630,630,630,630,630,630,630,630,
+630,630,630,630,630,630,630,630,630,630,630,630,630,630,630,630,
+630,630,630,630,630,630,630,630,630,630,630,630,630,630,630,630,
+630,630,630,630,629,629,629,629,629,629,629,629,629,629,629,629,
+629,629,629,629,631,631,120,120,120,120,120,120,120,120,632,632,
+633,633,633,633,633,633,633,633,633,633,120,120,120,120,120,120,
+252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,
+252,634,254,635,254,254,254,254,260,260,260,254,260,254,254,252,
/* block 111 */
-623,623,623,623,623,623,623,623,623,623,624,624,624,624,624,624,
-624,624,624,624,624,624,624,624,624,624,624,624,624,624,624,624,
-624,624,624,624,624,624,625,625,625,625,625,625,625,625,626,627,
-628,628,628,628,628,628,628,628,628,628,628,628,628,628,628,628,
-628,628,628,628,628,628,628,629,629,629,629,629,629,629,629,629,
-629,629,630,630,119,119,119,119,119,119,119,119,119,119,119,631,
-355,355,355,355,355,355,355,355,355,355,355,355,355,355,355,355,
-355,355,355,355,355,355,355,355,355,355,355,355,355,119,119,119,
+636,636,636,636,636,636,636,636,636,636,637,637,637,637,637,637,
+637,637,637,637,637,637,637,637,637,637,637,637,637,637,637,637,
+637,637,637,637,637,637,638,638,638,638,638,638,638,638,639,640,
+641,641,641,641,641,641,641,641,641,641,641,641,641,641,641,641,
+641,641,641,641,641,641,641,642,642,642,642,642,642,642,642,642,
+642,642,643,643,120,120,120,120,120,120,120,120,120,120,120,644,
+357,357,357,357,357,357,357,357,357,357,357,357,357,357,357,357,
+357,357,357,357,357,357,357,357,357,357,357,357,357,120,120,120,
/* block 112 */
-632,632,632,633,634,634,634,634,634,634,634,634,634,634,634,634,
-634,634,634,634,634,634,634,634,634,634,634,634,634,634,634,634,
-634,634,634,634,634,634,634,634,634,634,634,634,634,634,634,634,
-634,634,634,632,633,633,632,632,632,632,633,633,632,633,633,633,
-633,635,635,635,635,635,635,635,635,635,635,635,635,635,119,636,
-637,637,637,637,637,637,637,637,637,637,119,119,119,119,635,635,
-343,343,343,343,343,345,638,343,343,343,343,343,343,343,343,343,
-349,349,349,349,349,349,349,349,349,349,343,343,343,343,343,119,
+645,645,645,646,647,647,647,647,647,647,647,647,647,647,647,647,
+647,647,647,647,647,647,647,647,647,647,647,647,647,647,647,647,
+647,647,647,647,647,647,647,647,647,647,647,647,647,647,647,647,
+647,647,647,645,646,646,645,645,645,645,646,646,645,645,646,646,
+646,648,648,648,648,648,648,648,648,648,648,648,648,648,120,649,
+650,650,650,650,650,650,650,650,650,650,120,120,120,120,648,648,
+345,345,345,345,345,347,651,345,345,345,345,345,345,345,345,345,
+351,351,351,351,351,351,351,351,351,351,345,345,345,345,345,120,
/* block 113 */
-639,639,639,639,639,639,639,639,639,639,639,639,639,639,639,639,
-639,639,639,639,639,639,639,639,639,639,639,639,639,639,639,639,
-639,639,639,639,639,639,639,639,639,640,640,640,640,640,640,641,
-641,640,640,641,641,640,640,119,119,119,119,119,119,119,119,119,
-639,639,639,640,639,639,639,639,639,639,639,639,640,641,119,119,
-642,642,642,642,642,642,642,642,642,642,119,119,643,643,643,643,
-343,343,343,343,343,343,343,343,343,343,343,343,343,343,343,343,
-638,343,343,343,343,343,343,350,350,350,343,344,345,344,343,343,
+652,652,652,652,652,652,652,652,652,652,652,652,652,652,652,652,
+652,652,652,652,652,652,652,652,652,652,652,652,652,652,652,652,
+652,652,652,652,652,652,652,652,652,653,653,653,653,653,653,654,
+654,653,653,654,654,653,653,120,120,120,120,120,120,120,120,120,
+652,652,652,653,652,652,652,652,652,652,652,652,653,654,120,120,
+655,655,655,655,655,655,655,655,655,655,120,120,656,656,656,656,
+345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,
+651,345,345,345,345,345,345,352,352,352,345,346,347,346,345,345,
/* block 114 */
-644,644,644,644,644,644,644,644,644,644,644,644,644,644,644,644,
-644,644,644,644,644,644,644,644,644,644,644,644,644,644,644,644,
-644,644,644,644,644,644,644,644,644,644,644,644,644,644,644,644,
-645,644,645,645,645,644,644,645,645,644,644,644,644,644,645,645,
-644,645,644,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,644,644,646,647,647,
-648,648,648,648,648,648,648,648,648,648,648,649,650,650,649,649,
-651,651,648,652,652,649,650,119,119,119,119,119,119,119,119,119,
+657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,
+657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,
+657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,
+658,657,658,658,658,657,657,658,658,657,657,657,657,657,658,658,
+657,658,657,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,657,657,659,660,660,
+661,661,661,661,661,661,661,661,661,661,661,662,663,663,662,662,
+664,664,661,665,665,662,663,120,120,120,120,120,120,120,120,120,
/* block 115 */
-119,358,358,358,358,358,358,119,119,358,358,358,358,358,358,119,
-119,358,358,358,358,358,358,119,119,119,119,119,119,119,119,119,
-358,358,358,358,358,358,358,119,358,358,358,358,358,358,358,119,
+120,360,360,360,360,360,360,120,120,360,360,360,360,360,360,120,
+120,360,360,360,360,360,360,120,120,120,120,120,120,120,120,120,
+360,360,360,360,360,360,360,120,360,360,360,360,360,360,360,120,
35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
- 35, 35, 35,653, 35, 35, 35, 35, 35, 35, 35, 15,109,109,109,109,
- 35, 35, 35, 35, 35,127,119,119,119,119,119,119,119,119,119,119,
-654,654,654,654,654,654,654,654,654,654,654,654,654,654,654,654,
+ 35, 35, 35,666, 35, 35, 35, 35, 35, 35, 35, 15,110,110,110,110,
+ 35, 35, 35, 35, 35,128, 35, 35,120,120,120,120,120,120,120,120,
+667,667,667,667,667,667,667,667,667,667,667,667,667,667,667,667,
/* block 116 */
-654,654,654,654,654,654,654,654,654,654,654,654,654,654,654,654,
-654,654,654,654,654,654,654,654,654,654,654,654,654,654,654,654,
-654,654,654,654,654,654,654,654,654,654,654,654,654,654,654,654,
-654,654,654,654,654,654,654,654,654,654,654,654,654,654,654,654,
-648,648,648,648,648,648,648,648,648,648,648,648,648,648,648,648,
-648,648,648,648,648,648,648,648,648,648,648,648,648,648,648,648,
-648,648,648,649,649,650,649,649,650,649,649,651,649,650,119,119,
-655,655,655,655,655,655,655,655,655,655,119,119,119,119,119,119,
+667,667,667,667,667,667,667,667,667,667,667,667,667,667,667,667,
+667,667,667,667,667,667,667,667,667,667,667,667,667,667,667,667,
+667,667,667,667,667,667,667,667,667,667,667,667,667,667,667,667,
+667,667,667,667,667,667,667,667,667,667,667,667,667,667,667,667,
+661,661,661,661,661,661,661,661,661,661,661,661,661,661,661,661,
+661,661,661,661,661,661,661,661,661,661,661,661,661,661,661,661,
+661,661,661,662,662,663,662,662,663,662,662,664,662,663,120,120,
+668,668,668,668,668,668,668,668,668,668,120,120,120,120,120,120,
/* block 117 */
-656,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,
-657,657,657,657,657,657,657,657,657,657,657,657,656,657,657,657,
-657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,
-657,657,657,657,657,657,657,657,656,657,657,657,657,657,657,657,
-657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,
-657,657,657,657,656,657,657,657,657,657,657,657,657,657,657,657,
-657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,
-656,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,
+669,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,
+670,670,670,670,670,670,670,670,670,670,670,670,669,670,670,670,
+670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,
+670,670,670,670,670,670,670,670,669,670,670,670,670,670,670,670,
+670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,
+670,670,670,670,669,670,670,670,670,670,670,670,670,670,670,670,
+670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,
+669,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,
/* block 118 */
-657,657,657,657,657,657,657,657,657,657,657,657,656,657,657,657,
-657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,
-657,657,657,657,657,657,657,657,656,657,657,657,657,657,657,657,
-657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,
-657,657,657,657,656,657,657,657,657,657,657,657,657,657,657,657,
-657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,
-656,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,
-657,657,657,657,657,657,657,657,657,657,657,657,656,657,657,657,
+670,670,670,670,670,670,670,670,670,670,670,670,669,670,670,670,
+670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,
+670,670,670,670,670,670,670,670,669,670,670,670,670,670,670,670,
+670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,
+670,670,670,670,669,670,670,670,670,670,670,670,670,670,670,670,
+670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,
+669,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,
+670,670,670,670,670,670,670,670,670,670,670,670,669,670,670,670,
/* block 119 */
-657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,
-657,657,657,657,657,657,657,657,656,657,657,657,657,657,657,657,
-657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,
-657,657,657,657,656,657,657,657,657,657,657,657,657,657,657,657,
-657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,
-656,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,
-657,657,657,657,657,657,657,657,657,657,657,657,656,657,657,657,
-657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,
+670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,
+670,670,670,670,670,670,670,670,669,670,670,670,670,670,670,670,
+670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,
+670,670,670,670,669,670,670,670,670,670,670,670,670,670,670,670,
+670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,
+669,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,
+670,670,670,670,670,670,670,670,670,670,670,670,669,670,670,670,
+670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,
/* block 120 */
-657,657,657,657,657,657,657,657,656,657,657,657,657,657,657,657,
-657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,
-657,657,657,657,656,657,657,657,657,657,657,657,657,657,657,657,
-657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,
-656,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,
-657,657,657,657,657,657,657,657,657,657,657,657,656,657,657,657,
-657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,
-657,657,657,657,657,657,657,657,656,657,657,657,657,657,657,657,
+670,670,670,670,670,670,670,670,669,670,670,670,670,670,670,670,
+670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,
+670,670,670,670,669,670,670,670,670,670,670,670,670,670,670,670,
+670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,
+669,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,
+670,670,670,670,670,670,670,670,670,670,670,670,669,670,670,670,
+670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,
+670,670,670,670,670,670,670,670,669,670,670,670,670,670,670,670,
/* block 121 */
-657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,
-657,657,657,657,656,657,657,657,657,657,657,657,657,657,657,657,
-657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,
-656,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,
-657,657,657,657,657,657,657,657,657,657,657,657,656,657,657,657,
-657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,
-657,657,657,657,657,657,657,657,656,657,657,657,657,657,657,657,
-657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,
+670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,
+670,670,670,670,669,670,670,670,670,670,670,670,670,670,670,670,
+670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,
+669,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,
+670,670,670,670,670,670,670,670,670,670,670,670,669,670,670,670,
+670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,
+670,670,670,670,670,670,670,670,669,670,670,670,670,670,670,670,
+670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,
/* block 122 */
-657,657,657,657,656,657,657,657,657,657,657,657,657,657,657,657,
-657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,
-656,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,
-657,657,657,657,657,657,657,657,657,657,657,657,656,657,657,657,
-657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,
-657,657,657,657,657,657,657,657,656,657,657,657,657,657,657,657,
-657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,
-657,657,657,657,656,657,657,657,657,657,657,657,657,657,657,657,
+670,670,670,670,669,670,670,670,670,670,670,670,670,670,670,670,
+670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,
+669,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,
+670,670,670,670,670,670,670,670,670,670,670,670,669,670,670,670,
+670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,
+670,670,670,670,670,670,670,670,669,670,670,670,670,670,670,670,
+670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,
+670,670,670,670,669,670,670,670,670,670,670,670,670,670,670,670,
/* block 123 */
-657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,
-656,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,
-657,657,657,657,657,657,657,657,657,657,657,657,656,657,657,657,
-657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,
-657,657,657,657,657,657,657,657,656,657,657,657,657,657,657,657,
-657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,
-657,657,657,657,656,657,657,657,657,657,657,657,657,657,657,657,
-657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,
+670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,
+669,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,
+670,670,670,670,670,670,670,670,670,670,670,670,669,670,670,670,
+670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,
+670,670,670,670,670,670,670,670,669,670,670,670,670,670,670,670,
+670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,
+670,670,670,670,669,670,670,670,670,670,670,670,670,670,670,670,
+670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,
/* block 124 */
-657,657,657,657,657,657,657,657,656,657,657,657,657,657,657,657,
-657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,
-657,657,657,657,119,119,119,119,119,119,119,119,119,119,119,119,
-356,356,356,356,356,356,356,356,356,356,356,356,356,356,356,356,
-356,356,356,356,356,356,356,119,119,119,119,357,357,357,357,357,
-357,357,357,357,357,357,357,357,357,357,357,357,357,357,357,357,
-357,357,357,357,357,357,357,357,357,357,357,357,357,357,357,357,
-357,357,357,357,357,357,357,357,357,357,357,357,119,119,119,119,
+670,670,670,670,670,670,670,670,669,670,670,670,670,670,670,670,
+670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,
+670,670,670,670,120,120,120,120,120,120,120,120,120,120,120,120,
+358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,
+358,358,358,358,358,358,358,120,120,120,120,359,359,359,359,359,
+359,359,359,359,359,359,359,359,359,359,359,359,359,359,359,359,
+359,359,359,359,359,359,359,359,359,359,359,359,359,359,359,359,
+359,359,359,359,359,359,359,359,359,359,359,359,120,120,120,120,
/* block 125 */
-658,658,658,658,658,658,658,658,658,658,658,658,658,658,658,658,
-658,658,658,658,658,658,658,658,658,658,658,658,658,658,658,658,
-658,658,658,658,658,658,658,658,658,658,658,658,658,658,658,658,
-658,658,658,658,658,658,658,658,658,658,658,658,658,658,658,658,
-658,658,658,658,658,658,658,658,658,658,658,658,658,658,658,658,
-658,658,658,658,658,658,658,658,658,658,658,658,658,658,658,658,
-658,658,658,658,658,658,658,658,658,658,658,658,658,658,658,658,
-658,658,658,658,658,658,658,658,658,658,658,658,658,658,658,658,
+671,671,671,671,671,671,671,671,671,671,671,671,671,671,671,671,
+671,671,671,671,671,671,671,671,671,671,671,671,671,671,671,671,
+671,671,671,671,671,671,671,671,671,671,671,671,671,671,671,671,
+671,671,671,671,671,671,671,671,671,671,671,671,671,671,671,671,
+671,671,671,671,671,671,671,671,671,671,671,671,671,671,671,671,
+671,671,671,671,671,671,671,671,671,671,671,671,671,671,671,671,
+671,671,671,671,671,671,671,671,671,671,671,671,671,671,671,671,
+671,671,671,671,671,671,671,671,671,671,671,671,671,671,671,671,
/* block 126 */
-659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,
-659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,
-659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,
-659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,
-659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,
-659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,
-659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,
-659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,
+672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,
+672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,
+672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,
+672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,
+672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,
+672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,
+672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,
+672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,
/* block 127 */
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,119,119,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,120,120,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
/* block 128 */
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 129 */
- 35, 35, 35, 35, 35, 35, 35,119,119,119,119,119,119,119,119,119,
-119,119,119,205,205,205,205,205,119,119,119,119,119,214,211,214,
-214,214,214,214,214,214,214,214,214,660,214,214,214,214,214,214,
-214,214,214,214,214,214,214,119,214,214,214,214,214,119,214,119,
-214,214,119,214,214,119,214,214,214,214,214,214,214,214,214,214,
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
+ 35, 35, 35, 35, 35, 35, 35,120,120,120,120,120,120,120,120,120,
+120,120,120,206,206,206,206,206,120,120,120,120,120,215,212,215,
+215,215,215,215,215,215,215,215,215,673,215,215,215,215,215,215,
+215,215,215,215,215,215,215,120,215,215,215,215,215,120,215,120,
+215,215,120,215,215,120,215,215,215,215,215,215,215,215,215,215,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
/* block 130 */
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
-224,224,661,661,661,661,661,661,661,661,661,661,661,661,661,661,
-661,661,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,224,224,224,224,224,224,224,224,224,224,224,224,224,
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
+225,225,674,674,674,674,674,674,674,674,674,674,674,674,674,674,
+674,674,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,225,225,225,225,225,225,225,225,225,225,225,225,225,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
/* block 131 */
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
/* block 132 */
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
-224,224,224,224,224,224,224,224,224,224,224,224,224,224, 8, 7,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225, 8, 7,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
/* block 133 */
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
-119,119,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
-224,224,224,224,224,224,224,224,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-224,224,662,224,224,224,224,224,224,224,224,224,219,663,119,119,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
+120,120,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
+225,225,225,225,225,225,225,225,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+225,225,675,225,225,225,225,225,225,225,225,225,220,676,120,120,
/* block 134 */
-112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,
- 5, 5, 5, 5, 5, 5, 5, 7, 8, 5,119,119,119,119,119,119,
-112,112,112,112,112,112,112,112,112,112,112,112,112,112,543,543,
+113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,
+ 5, 5, 5, 5, 5, 5, 5, 7, 8, 5,120,120,120,120,120,120,
+113,113,113,113,113,113,113,113,113,113,113,113,113,113,552,552,
5, 10, 10, 16, 16, 7, 8, 7, 8, 7, 8, 7, 8, 7, 8, 7,
- 8, 7, 8, 7, 8,547,547, 7, 8, 5, 5, 5, 5, 16, 16, 16,
- 5, 5, 5,119, 5, 5, 5, 5, 10, 7, 8, 7, 8, 7, 8, 5,
- 5, 5, 9, 10, 9, 9, 9,119, 5, 6, 5, 5,119,119,119,119,
-224,224,224,224,224,119,224,224,224,224,224,224,224,224,224,224,
+ 8, 7, 8, 7, 8,556,556, 7, 8, 5, 5, 5, 5, 16, 16, 16,
+ 5, 5, 5,120, 5, 5, 5, 5, 10, 7, 8, 7, 8, 7, 8, 5,
+ 5, 5, 9, 10, 9, 9, 9,120, 5, 6, 5, 5,120,120,120,120,
+225,225,225,225,225,120,225,225,225,225,225,225,225,225,225,225,
/* block 135 */
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
-224,224,224,224,224,224,224,224,224,224,224,224,224,119,119, 24,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
+225,225,225,225,225,225,225,225,225,225,225,225,225,120,120, 24,
/* block 136 */
-119, 5, 5, 5, 6, 5, 5, 5, 7, 8, 5, 9, 5, 10, 5, 5,
+120, 5, 5, 5, 6, 5, 5, 5, 7, 8, 5, 9, 5, 10, 5, 5,
11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 5, 5, 9, 9, 9, 5,
5, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 7, 5, 8, 15, 16,
15, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 7, 9, 8, 9, 7,
- 8,546,551,552,546,546,569,569,569,569,569,569,569,569,569,569,
-560,569,569,569,569,569,569,569,569,569,569,569,569,569,569,569,
+ 8,555,560,561,555,555,578,578,578,578,578,578,578,578,578,578,
+569,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,
/* block 137 */
-569,569,569,569,569,569,569,569,569,569,569,569,569,569,569,569,
-569,569,569,569,569,569,569,569,569,569,569,569,569,569,664,664,
-572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,
-572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,119,
-119,119,572,572,572,572,572,572,119,119,572,572,572,572,572,572,
-119,119,572,572,572,572,572,572,119,119,572,572,572,119,119,119,
- 6, 6, 9, 15, 20, 6, 6,119, 20, 9, 9, 9, 9, 20, 20,119,
-502,502,502,502,502,502,502,502,502, 24, 24, 24, 20, 20,119,119,
+578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,
+578,578,578,578,578,578,578,578,578,578,578,578,578,578,677,677,
+581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,
+581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,120,
+120,120,581,581,581,581,581,581,120,120,581,581,581,581,581,581,
+120,120,581,581,581,581,581,581,120,120,581,581,581,120,120,120,
+ 6, 6, 9, 15, 20, 6, 6,120, 20, 9, 9, 9, 9, 20, 20,120,
+511,511,511,511,511,511,511,511,511, 24, 24, 24, 20, 20,120,120,
/* block 138 */
-665,665,665,665,665,665,665,665,665,665,665,665,119,665,665,665,
-665,665,665,665,665,665,665,665,665,665,665,665,665,665,665,665,
-665,665,665,665,665,665,665,119,665,665,665,665,665,665,665,665,
-665,665,665,665,665,665,665,665,665,665,665,119,665,665,119,665,
-665,665,665,665,665,665,665,665,665,665,665,665,665,665,119,119,
-665,665,665,665,665,665,665,665,665,665,665,665,665,665,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+678,678,678,678,678,678,678,678,678,678,678,678,120,678,678,678,
+678,678,678,678,678,678,678,678,678,678,678,678,678,678,678,678,
+678,678,678,678,678,678,678,120,678,678,678,678,678,678,678,678,
+678,678,678,678,678,678,678,678,678,678,678,120,678,678,120,678,
+678,678,678,678,678,678,678,678,678,678,678,678,678,678,120,120,
+678,678,678,678,678,678,678,678,678,678,678,678,678,678,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 139 */
-665,665,665,665,665,665,665,665,665,665,665,665,665,665,665,665,
-665,665,665,665,665,665,665,665,665,665,665,665,665,665,665,665,
-665,665,665,665,665,665,665,665,665,665,665,665,665,665,665,665,
-665,665,665,665,665,665,665,665,665,665,665,665,665,665,665,665,
-665,665,665,665,665,665,665,665,665,665,665,665,665,665,665,665,
-665,665,665,665,665,665,665,665,665,665,665,665,665,665,665,665,
-665,665,665,665,665,665,665,665,665,665,665,665,665,665,665,665,
-665,665,665,665,665,665,665,665,665,665,665,119,119,119,119,119,
+678,678,678,678,678,678,678,678,678,678,678,678,678,678,678,678,
+678,678,678,678,678,678,678,678,678,678,678,678,678,678,678,678,
+678,678,678,678,678,678,678,678,678,678,678,678,678,678,678,678,
+678,678,678,678,678,678,678,678,678,678,678,678,678,678,678,678,
+678,678,678,678,678,678,678,678,678,678,678,678,678,678,678,678,
+678,678,678,678,678,678,678,678,678,678,678,678,678,678,678,678,
+678,678,678,678,678,678,678,678,678,678,678,678,678,678,678,678,
+678,678,678,678,678,678,678,678,678,678,678,120,120,120,120,120,
/* block 140 */
-666,666,666,119,119,119,119,667,667,667,667,667,667,667,667,667,
-667,667,667,667,667,667,667,667,667,667,667,667,667,667,667,667,
-667,667,667,667,667,667,667,667,667,667,667,667,667,667,667,667,
-667,667,667,667,119,119,119,668,668,668,668,668,668,668,668,668,
-669,669,669,669,669,669,669,669,669,669,669,669,669,669,669,669,
-669,669,669,669,669,669,669,669,669,669,669,669,669,669,669,669,
-669,669,669,669,669,669,669,669,669,669,669,669,669,669,669,669,
-669,669,669,669,669,670,670,670,670,671,671,671,671,671,671,671,
+679,679,679,120,120,120,120,680,680,680,680,680,680,680,680,680,
+680,680,680,680,680,680,680,680,680,680,680,680,680,680,680,680,
+680,680,680,680,680,680,680,680,680,680,680,680,680,680,680,680,
+680,680,680,680,120,120,120,681,681,681,681,681,681,681,681,681,
+682,682,682,682,682,682,682,682,682,682,682,682,682,682,682,682,
+682,682,682,682,682,682,682,682,682,682,682,682,682,682,682,682,
+682,682,682,682,682,682,682,682,682,682,682,682,682,682,682,682,
+682,682,682,682,682,683,683,683,683,684,684,684,684,684,684,684,
/* block 141 */
-671,671,671,671,671,671,671,671,671,671,670,670,671,671,671,119,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,119,119,119,119,
-671,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+684,684,684,684,684,684,684,684,684,684,683,683,684,684,684,120,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,120,120,120,120,
+684,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,112,119,119,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,113,120,120,
/* block 142 */
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 143 */
-672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,
-672,672,672,672,672,672,672,672,672,672,672,672,672,119,119,119,
-673,673,673,673,673,673,673,673,673,673,673,673,673,673,673,673,
-673,673,673,673,673,673,673,673,673,673,673,673,673,673,673,673,
-673,673,673,673,673,673,673,673,673,673,673,673,673,673,673,673,
-673,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-674,675,675,675,675,675,675,675,675,675,675,675,675,675,675,675,
-675,675,675,675,675,675,675,675,675,675,675,675,119,119,119,119,
+685,685,685,685,685,685,685,685,685,685,685,685,685,685,685,685,
+685,685,685,685,685,685,685,685,685,685,685,685,685,120,120,120,
+686,686,686,686,686,686,686,686,686,686,686,686,686,686,686,686,
+686,686,686,686,686,686,686,686,686,686,686,686,686,686,686,686,
+686,686,686,686,686,686,686,686,686,686,686,686,686,686,686,686,
+686,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+687,688,688,688,688,688,688,688,688,688,688,688,688,688,688,688,
+688,688,688,688,688,688,688,688,688,688,688,688,120,120,120,120,
/* block 144 */
-676,676,676,676,676,676,676,676,676,676,676,676,676,676,676,676,
-676,676,676,676,676,676,676,676,676,676,676,676,676,676,676,676,
-677,677,677,677,119,119,119,119,119,119,119,119,119,676,676,676,
-678,678,678,678,678,678,678,678,678,678,678,678,678,678,678,678,
-678,679,678,678,678,678,678,678,678,678,679,119,119,119,119,119,
-680,680,680,680,680,680,680,680,680,680,680,680,680,680,680,680,
-680,680,680,680,680,680,680,680,680,680,680,680,680,680,680,680,
-680,680,680,680,680,680,681,681,681,681,681,119,119,119,119,119,
+689,689,689,689,689,689,689,689,689,689,689,689,689,689,689,689,
+689,689,689,689,689,689,689,689,689,689,689,689,689,689,689,689,
+690,690,690,690,120,120,120,120,120,120,120,120,120,689,689,689,
+691,691,691,691,691,691,691,691,691,691,691,691,691,691,691,691,
+691,692,691,691,691,691,691,691,691,691,692,120,120,120,120,120,
+693,693,693,693,693,693,693,693,693,693,693,693,693,693,693,693,
+693,693,693,693,693,693,693,693,693,693,693,693,693,693,693,693,
+693,693,693,693,693,693,694,694,694,694,694,120,120,120,120,120,
/* block 145 */
-682,682,682,682,682,682,682,682,682,682,682,682,682,682,682,682,
-682,682,682,682,682,682,682,682,682,682,682,682,682,682,119,683,
-684,684,684,684,684,684,684,684,684,684,684,684,684,684,684,684,
-684,684,684,684,684,684,684,684,684,684,684,684,684,684,684,684,
-684,684,684,684,119,119,119,119,684,684,684,684,684,684,684,684,
-685,686,686,686,686,686,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+695,695,695,695,695,695,695,695,695,695,695,695,695,695,695,695,
+695,695,695,695,695,695,695,695,695,695,695,695,695,695,120,696,
+697,697,697,697,697,697,697,697,697,697,697,697,697,697,697,697,
+697,697,697,697,697,697,697,697,697,697,697,697,697,697,697,697,
+697,697,697,697,120,120,120,120,697,697,697,697,697,697,697,697,
+698,699,699,699,699,699,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 146 */
-687,687,687,687,687,687,687,687,687,687,687,687,687,687,687,687,
-687,687,687,687,687,687,687,687,687,687,687,687,687,687,687,687,
-687,687,687,687,687,687,687,687,688,688,688,688,688,688,688,688,
-688,688,688,688,688,688,688,688,688,688,688,688,688,688,688,688,
-688,688,688,688,688,688,688,688,688,688,688,688,688,688,688,688,
-689,689,689,689,689,689,689,689,689,689,689,689,689,689,689,689,
-689,689,689,689,689,689,689,689,689,689,689,689,689,689,689,689,
-689,689,689,689,689,689,689,689,689,689,689,689,689,689,689,689,
+700,700,700,700,700,700,700,700,700,700,700,700,700,700,700,700,
+700,700,700,700,700,700,700,700,700,700,700,700,700,700,700,700,
+700,700,700,700,700,700,700,700,701,701,701,701,701,701,701,701,
+701,701,701,701,701,701,701,701,701,701,701,701,701,701,701,701,
+701,701,701,701,701,701,701,701,701,701,701,701,701,701,701,701,
+702,702,702,702,702,702,702,702,702,702,702,702,702,702,702,702,
+702,702,702,702,702,702,702,702,702,702,702,702,702,702,702,702,
+702,702,702,702,702,702,702,702,702,702,702,702,702,702,702,702,
/* block 147 */
-690,690,690,690,690,690,690,690,690,690,690,690,690,690,690,690,
-690,690,690,690,690,690,690,690,690,690,690,690,690,690,119,119,
-691,691,691,691,691,691,691,691,691,691,119,119,119,119,119,119,
-692,692,692,692,692,692,692,692,692,692,692,692,692,692,692,692,
-692,692,692,692,692,692,692,692,692,692,692,692,692,692,692,692,
-692,692,692,692,119,119,119,119,693,693,693,693,693,693,693,693,
-693,693,693,693,693,693,693,693,693,693,693,693,693,693,693,693,
-693,693,693,693,693,693,693,693,693,693,693,693,119,119,119,119,
+703,703,703,703,703,703,703,703,703,703,703,703,703,703,703,703,
+703,703,703,703,703,703,703,703,703,703,703,703,703,703,120,120,
+704,704,704,704,704,704,704,704,704,704,120,120,120,120,120,120,
+705,705,705,705,705,705,705,705,705,705,705,705,705,705,705,705,
+705,705,705,705,705,705,705,705,705,705,705,705,705,705,705,705,
+705,705,705,705,120,120,120,120,706,706,706,706,706,706,706,706,
+706,706,706,706,706,706,706,706,706,706,706,706,706,706,706,706,
+706,706,706,706,706,706,706,706,706,706,706,706,120,120,120,120,
/* block 148 */
-694,694,694,694,694,694,694,694,694,694,694,694,694,694,694,694,
-694,694,694,694,694,694,694,694,694,694,694,694,694,694,694,694,
-694,694,694,694,694,694,694,694,119,119,119,119,119,119,119,119,
-695,695,695,695,695,695,695,695,695,695,695,695,695,695,695,695,
-695,695,695,695,695,695,695,695,695,695,695,695,695,695,695,695,
-695,695,695,695,695,695,695,695,695,695,695,695,695,695,695,695,
-695,695,695,695,119,119,119,119,119,119,119,119,119,119,119,696,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,
+707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,
+707,707,707,707,707,707,707,707,120,120,120,120,120,120,120,120,
+708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,
+708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,
+708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,
+708,708,708,708,120,120,120,120,120,120,120,120,120,120,120,709,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 149 */
-697,697,697,697,697,697,697,697,697,697,697,697,697,697,697,697,
-697,697,697,697,697,697,697,697,697,697,697,697,697,697,697,697,
-697,697,697,697,697,697,697,697,697,697,697,697,697,697,697,697,
-697,697,697,697,697,697,697,697,697,697,697,697,697,697,697,697,
-697,697,697,697,697,697,697,697,697,697,697,697,697,697,697,697,
-697,697,697,697,697,697,697,697,697,697,697,697,697,697,697,697,
-697,697,697,697,697,697,697,697,697,697,697,697,697,697,697,697,
-697,697,697,697,697,697,697,697,697,697,697,697,697,697,697,697,
+710,710,710,710,710,710,710,710,710,710,710,710,710,710,710,710,
+710,710,710,710,710,710,710,710,710,710,710,710,710,710,710,710,
+710,710,710,710,710,710,710,710,710,710,710,710,710,710,710,710,
+710,710,710,710,710,710,710,710,710,710,710,710,710,710,710,710,
+710,710,710,710,710,710,710,710,710,710,710,710,710,710,710,710,
+710,710,710,710,710,710,710,710,710,710,710,710,710,710,710,710,
+710,710,710,710,710,710,710,710,710,710,710,710,710,710,710,710,
+710,710,710,710,710,710,710,710,710,710,710,710,710,710,710,710,
/* block 150 */
-697,697,697,697,697,697,697,697,697,697,697,697,697,697,697,697,
-697,697,697,697,697,697,697,697,697,697,697,697,697,697,697,697,
-697,697,697,697,697,697,697,697,697,697,697,697,697,697,697,697,
-697,697,697,697,697,697,697,119,119,119,119,119,119,119,119,119,
-697,697,697,697,697,697,697,697,697,697,697,697,697,697,697,697,
-697,697,697,697,697,697,119,119,119,119,119,119,119,119,119,119,
-697,697,697,697,697,697,697,697,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+710,710,710,710,710,710,710,710,710,710,710,710,710,710,710,710,
+710,710,710,710,710,710,710,710,710,710,710,710,710,710,710,710,
+710,710,710,710,710,710,710,710,710,710,710,710,710,710,710,710,
+710,710,710,710,710,710,710,120,120,120,120,120,120,120,120,120,
+710,710,710,710,710,710,710,710,710,710,710,710,710,710,710,710,
+710,710,710,710,710,710,120,120,120,120,120,120,120,120,120,120,
+710,710,710,710,710,710,710,710,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 151 */
-698,698,698,698,698,698,119,119,698,119,698,698,698,698,698,698,
-698,698,698,698,698,698,698,698,698,698,698,698,698,698,698,698,
-698,698,698,698,698,698,698,698,698,698,698,698,698,698,698,698,
-698,698,698,698,698,698,119,698,698,119,119,119,698,119,119,698,
-699,699,699,699,699,699,699,699,699,699,699,699,699,699,699,699,
-699,699,699,699,699,699,119,700,701,701,701,701,701,701,701,701,
-702,702,702,702,702,702,702,702,702,702,702,702,702,702,702,702,
-702,702,702,702,702,702,702,703,703,704,704,704,704,704,704,704,
+711,711,711,711,711,711,120,120,711,120,711,711,711,711,711,711,
+711,711,711,711,711,711,711,711,711,711,711,711,711,711,711,711,
+711,711,711,711,711,711,711,711,711,711,711,711,711,711,711,711,
+711,711,711,711,711,711,120,711,711,120,120,120,711,120,120,711,
+712,712,712,712,712,712,712,712,712,712,712,712,712,712,712,712,
+712,712,712,712,712,712,120,713,714,714,714,714,714,714,714,714,
+715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,
+715,715,715,715,715,715,715,716,716,717,717,717,717,717,717,717,
/* block 152 */
-705,705,705,705,705,705,705,705,705,705,705,705,705,705,705,705,
-705,705,705,705,705,705,705,705,705,705,705,705,705,705,705,119,
-119,119,119,119,119,119,119,706,706,706,706,706,706,706,706,706,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,
-707,707,707,119,707,707,119,119,119,119,119,708,708,708,708,708,
+718,718,718,718,718,718,718,718,718,718,718,718,718,718,718,718,
+718,718,718,718,718,718,718,718,718,718,718,718,718,718,718,120,
+120,120,120,120,120,120,120,719,719,719,719,719,719,719,719,719,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,
+720,720,720,120,720,720,120,120,120,120,120,721,721,721,721,721,
/* block 153 */
-709,709,709,709,709,709,709,709,709,709,709,709,709,709,709,709,
-709,709,709,709,709,709,710,710,710,710,710,710,119,119,119,711,
-712,712,712,712,712,712,712,712,712,712,712,712,712,712,712,712,
-712,712,712,712,712,712,712,712,712,712,119,119,119,119,119,713,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+722,722,722,722,722,722,722,722,722,722,722,722,722,722,722,722,
+722,722,722,722,722,722,723,723,723,723,723,723,120,120,120,724,
+725,725,725,725,725,725,725,725,725,725,725,725,725,725,725,725,
+725,725,725,725,725,725,725,725,725,725,120,120,120,120,120,726,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 154 */
-714,714,714,714,714,714,714,714,714,714,714,714,714,714,714,714,
-714,714,714,714,714,714,714,714,714,714,714,714,714,714,714,714,
-715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,
-715,715,715,715,715,715,715,715,119,119,119,119,716,716,715,715,
-716,716,716,716,716,716,716,716,716,716,716,716,716,716,716,716,
-119,119,716,716,716,716,716,716,716,716,716,716,716,716,716,716,
-716,716,716,716,716,716,716,716,716,716,716,716,716,716,716,716,
-716,716,716,716,716,716,716,716,716,716,716,716,716,716,716,716,
+727,727,727,727,727,727,727,727,727,727,727,727,727,727,727,727,
+727,727,727,727,727,727,727,727,727,727,727,727,727,727,727,727,
+728,728,728,728,728,728,728,728,728,728,728,728,728,728,728,728,
+728,728,728,728,728,728,728,728,120,120,120,120,729,729,728,728,
+729,729,729,729,729,729,729,729,729,729,729,729,729,729,729,729,
+120,120,729,729,729,729,729,729,729,729,729,729,729,729,729,729,
+729,729,729,729,729,729,729,729,729,729,729,729,729,729,729,729,
+729,729,729,729,729,729,729,729,729,729,729,729,729,729,729,729,
/* block 155 */
-717,718,718,718,119,718,718,119,119,119,119,119,718,718,718,718,
-717,717,717,717,119,717,717,717,119,717,717,717,717,717,717,717,
-717,717,717,717,717,717,717,717,717,717,717,717,717,717,717,717,
-717,717,717,717,717,717,119,119,718,718,718,119,119,119,119,718,
-719,719,719,719,719,719,719,719,719,119,119,119,119,119,119,119,
-720,720,720,720,720,720,720,720,720,119,119,119,119,119,119,119,
-721,721,721,721,721,721,721,721,721,721,721,721,721,721,721,721,
-721,721,721,721,721,721,721,721,721,721,721,721,721,722,722,723,
+730,731,731,731,120,731,731,120,120,120,120,120,731,731,731,731,
+730,730,730,730,120,730,730,730,120,730,730,730,730,730,730,730,
+730,730,730,730,730,730,730,730,730,730,730,730,730,730,730,730,
+730,730,730,730,730,730,120,120,731,731,731,120,120,120,120,731,
+732,732,732,732,732,732,732,732,732,120,120,120,120,120,120,120,
+733,733,733,733,733,733,733,733,733,120,120,120,120,120,120,120,
+734,734,734,734,734,734,734,734,734,734,734,734,734,734,734,734,
+734,734,734,734,734,734,734,734,734,734,734,734,734,735,735,736,
/* block 156 */
-724,724,724,724,724,724,724,724,724,724,724,724,724,724,724,724,
-724,724,724,724,724,724,724,724,724,724,724,724,724,725,725,725,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-726,726,726,726,726,726,726,726,727,726,726,726,726,726,726,726,
-726,726,726,726,726,726,726,726,726,726,726,726,726,726,726,726,
-726,726,726,726,726,728,728,119,119,119,119,729,729,729,729,729,
-730,730,730,730,730,730,730,119,119,119,119,119,119,119,119,119,
+737,737,737,737,737,737,737,737,737,737,737,737,737,737,737,737,
+737,737,737,737,737,737,737,737,737,737,737,737,737,738,738,738,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+739,739,739,739,739,739,739,739,740,739,739,739,739,739,739,739,
+739,739,739,739,739,739,739,739,739,739,739,739,739,739,739,739,
+739,739,739,739,739,741,741,120,120,120,120,742,742,742,742,742,
+743,743,743,743,743,743,743,120,120,120,120,120,120,120,120,120,
/* block 157 */
-731,731,731,731,731,731,731,731,731,731,731,731,731,731,731,731,
-731,731,731,731,731,731,731,731,731,731,731,731,731,731,731,731,
-731,731,731,731,731,731,731,731,731,731,731,731,731,731,731,731,
-731,731,731,731,731,731,119,119,119,732,732,732,732,732,732,732,
-733,733,733,733,733,733,733,733,733,733,733,733,733,733,733,733,
-733,733,733,733,733,733,119,119,734,734,734,734,734,734,734,734,
-735,735,735,735,735,735,735,735,735,735,735,735,735,735,735,735,
-735,735,735,119,119,119,119,119,736,736,736,736,736,736,736,736,
+744,744,744,744,744,744,744,744,744,744,744,744,744,744,744,744,
+744,744,744,744,744,744,744,744,744,744,744,744,744,744,744,744,
+744,744,744,744,744,744,744,744,744,744,744,744,744,744,744,744,
+744,744,744,744,744,744,120,120,120,745,745,745,745,745,745,745,
+746,746,746,746,746,746,746,746,746,746,746,746,746,746,746,746,
+746,746,746,746,746,746,120,120,747,747,747,747,747,747,747,747,
+748,748,748,748,748,748,748,748,748,748,748,748,748,748,748,748,
+748,748,748,120,120,120,120,120,749,749,749,749,749,749,749,749,
/* block 158 */
-737,737,737,737,737,737,737,737,737,737,737,737,737,737,737,737,
-737,737,119,119,119,119,119,119,119,738,738,738,738,119,119,119,
-119,119,119,119,119,119,119,119,119,739,739,739,739,739,739,739,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+750,750,750,750,750,750,750,750,750,750,750,750,750,750,750,750,
+750,750,120,120,120,120,120,120,120,751,751,751,751,120,120,120,
+120,120,120,120,120,120,120,120,120,752,752,752,752,752,752,752,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 159 */
-740,740,740,740,740,740,740,740,740,740,740,740,740,740,740,740,
-740,740,740,740,740,740,740,740,740,740,740,740,740,740,740,740,
-740,740,740,740,740,740,740,740,740,740,740,740,740,740,740,740,
-740,740,740,740,740,740,740,740,740,740,740,740,740,740,740,740,
-740,740,740,740,740,740,740,740,740,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+753,753,753,753,753,753,753,753,753,753,753,753,753,753,753,753,
+753,753,753,753,753,753,753,753,753,753,753,753,753,753,753,753,
+753,753,753,753,753,753,753,753,753,753,753,753,753,753,753,753,
+753,753,753,753,753,753,753,753,753,753,753,753,753,753,753,753,
+753,753,753,753,753,753,753,753,753,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 160 */
-741,741,741,741,741,741,741,741,741,741,741,741,741,741,741,741,
-741,741,741,741,741,741,741,741,741,741,741,741,741,741,741,741,
-741,741,741,741,741,741,741,741,741,741,741,741,741,741,741,741,
-741,741,741,119,119,119,119,119,119,119,119,119,119,119,119,119,
-742,742,742,742,742,742,742,742,742,742,742,742,742,742,742,742,
-742,742,742,742,742,742,742,742,742,742,742,742,742,742,742,742,
-742,742,742,742,742,742,742,742,742,742,742,742,742,742,742,742,
-742,742,742,119,119,119,119,119,119,119,743,743,743,743,743,743,
+754,754,754,754,754,754,754,754,754,754,754,754,754,754,754,754,
+754,754,754,754,754,754,754,754,754,754,754,754,754,754,754,754,
+754,754,754,754,754,754,754,754,754,754,754,754,754,754,754,754,
+754,754,754,120,120,120,120,120,120,120,120,120,120,120,120,120,
+755,755,755,755,755,755,755,755,755,755,755,755,755,755,755,755,
+755,755,755,755,755,755,755,755,755,755,755,755,755,755,755,755,
+755,755,755,755,755,755,755,755,755,755,755,755,755,755,755,755,
+755,755,755,120,120,120,120,120,120,120,756,756,756,756,756,756,
/* block 161 */
-744,744,744,744,744,744,744,744,744,744,744,744,744,744,744,744,
-744,744,744,744,744,744,744,744,744,744,744,744,744,744,744,744,
-744,744,744,744,745,745,745,745,119,119,119,119,119,119,119,119,
-746,746,746,746,746,746,746,746,746,746,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+757,757,757,757,757,757,757,757,757,757,757,757,757,757,757,757,
+757,757,757,757,757,757,757,757,757,757,757,757,757,757,757,757,
+757,757,757,757,758,758,758,758,120,120,120,120,120,120,120,120,
+759,759,759,759,759,759,759,759,759,759,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 162 */
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-747,747,747,747,747,747,747,747,747,747,747,747,747,747,747,747,
-747,747,747,747,747,747,747,747,747,747,747,747,747,747,747,119,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+760,760,760,760,760,760,760,760,760,760,760,760,760,760,760,760,
+760,760,760,760,760,760,760,760,760,760,760,760,760,760,760,120,
/* block 163 */
-748,748,748,748,748,748,748,748,748,748,748,748,748,748,748,748,
-748,748,748,748,748,748,748,748,748,748,748,748,748,749,749,749,
-749,749,749,749,749,749,749,748,119,119,119,119,119,119,119,119,
-750,750,750,750,750,750,750,750,750,750,750,750,750,750,750,750,
-750,750,750,750,750,750,751,751,751,751,751,751,751,751,751,751,
-751,752,752,752,752,753,753,753,753,753,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+761,761,761,761,761,761,761,761,761,761,761,761,761,761,761,761,
+761,761,761,761,761,761,761,761,761,761,761,761,761,762,762,762,
+762,762,762,762,762,762,762,761,120,120,120,120,120,120,120,120,
+763,763,763,763,763,763,763,763,763,763,763,763,763,763,763,763,
+763,763,763,763,763,763,764,764,764,764,764,764,764,764,764,764,
+764,765,765,765,765,766,766,766,766,766,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 164 */
-754,755,754,756,756,756,756,756,756,756,756,756,756,756,756,756,
-756,756,756,756,756,756,756,756,756,756,756,756,756,756,756,756,
-756,756,756,756,756,756,756,756,756,756,756,756,756,756,756,756,
-756,756,756,756,756,756,756,756,755,755,755,755,755,755,755,755,
-755,755,755,755,755,755,755,757,757,757,757,757,757,757,119,119,
-119,119,758,758,758,758,758,758,758,758,758,758,758,758,758,758,
-758,758,758,758,758,758,759,759,759,759,759,759,759,759,759,759,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,755,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+767,767,767,767,767,767,767,767,767,767,767,767,767,767,767,767,
+767,767,767,767,767,767,767,120,120,120,120,120,120,120,120,120,
/* block 165 */
-760,760,761,762,762,762,762,762,762,762,762,762,762,762,762,762,
-762,762,762,762,762,762,762,762,762,762,762,762,762,762,762,762,
-762,762,762,762,762,762,762,762,762,762,762,762,762,762,762,762,
-761,761,761,760,760,760,760,761,761,760,760,763,763,764,763,763,
-763,763,119,119,119,119,119,119,119,119,119,119,119,764,119,119,
-765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,
-765,765,765,765,765,765,765,765,765,119,119,119,119,119,119,119,
-766,766,766,766,766,766,766,766,766,766,119,119,119,119,119,119,
+768,769,768,770,770,770,770,770,770,770,770,770,770,770,770,770,
+770,770,770,770,770,770,770,770,770,770,770,770,770,770,770,770,
+770,770,770,770,770,770,770,770,770,770,770,770,770,770,770,770,
+770,770,770,770,770,770,770,770,769,769,769,769,769,769,769,769,
+769,769,769,769,769,769,769,771,771,771,771,771,771,771,120,120,
+120,120,772,772,772,772,772,772,772,772,772,772,772,772,772,772,
+772,772,772,772,772,772,773,773,773,773,773,773,773,773,773,773,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,769,
/* block 166 */
-767,767,767,768,768,768,768,768,768,768,768,768,768,768,768,768,
-768,768,768,768,768,768,768,768,768,768,768,768,768,768,768,768,
-768,768,768,768,768,768,768,767,767,767,767,767,769,767,767,767,
-767,767,767,767,767,119,770,770,770,770,770,770,770,770,770,770,
-771,771,771,771,768,769,769,119,119,119,119,119,119,119,119,119,
-772,772,772,772,772,772,772,772,772,772,772,772,772,772,772,772,
-772,772,772,772,772,772,772,772,772,772,772,772,772,772,772,772,
-772,772,772,773,774,774,772,119,119,119,119,119,119,119,119,119,
+774,774,775,776,776,776,776,776,776,776,776,776,776,776,776,776,
+776,776,776,776,776,776,776,776,776,776,776,776,776,776,776,776,
+776,776,776,776,776,776,776,776,776,776,776,776,776,776,776,776,
+775,775,775,774,774,774,774,775,775,774,774,777,777,778,777,777,
+777,777,120,120,120,120,120,120,120,120,120,120,120,778,120,120,
+779,779,779,779,779,779,779,779,779,779,779,779,779,779,779,779,
+779,779,779,779,779,779,779,779,779,120,120,120,120,120,120,120,
+780,780,780,780,780,780,780,780,780,780,120,120,120,120,120,120,
/* block 167 */
-775,775,776,777,777,777,777,777,777,777,777,777,777,777,777,777,
-777,777,777,777,777,777,777,777,777,777,777,777,777,777,777,777,
-777,777,777,777,777,777,777,777,777,777,777,777,777,777,777,777,
-777,777,777,776,776,776,775,775,775,775,775,775,775,775,775,776,
-776,777,778,778,777,779,779,779,779,775,775,775,775,779,119,119,
-780,780,780,780,780,780,780,780,780,780,777,779,777,779,779,779,
-119,781,781,781,781,781,781,781,781,781,781,781,781,781,781,781,
-781,781,781,781,781,119,119,119,119,119,119,119,119,119,119,119,
+781,781,781,782,782,782,782,782,782,782,782,782,782,782,782,782,
+782,782,782,782,782,782,782,782,782,782,782,782,782,782,782,782,
+782,782,782,782,782,782,782,781,781,781,781,781,783,781,781,781,
+781,781,781,781,781,120,784,784,784,784,784,784,784,784,784,784,
+785,785,785,785,782,783,783,120,120,120,120,120,120,120,120,120,
+786,786,786,786,786,786,786,786,786,786,786,786,786,786,786,786,
+786,786,786,786,786,786,786,786,786,786,786,786,786,786,786,786,
+786,786,786,787,788,788,786,120,120,120,120,120,120,120,120,120,
/* block 168 */
-782,782,782,782,782,782,782,782,782,782,782,782,782,782,782,782,
-782,782,119,782,782,782,782,782,782,782,782,782,782,782,782,782,
-782,782,782,782,782,782,782,782,782,782,782,782,783,783,783,784,
-784,784,783,783,784,783,784,784,785,785,785,785,785,785,784,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+789,789,790,791,791,791,791,791,791,791,791,791,791,791,791,791,
+791,791,791,791,791,791,791,791,791,791,791,791,791,791,791,791,
+791,791,791,791,791,791,791,791,791,791,791,791,791,791,791,791,
+791,791,791,790,790,790,789,789,789,789,789,789,789,789,789,790,
+790,791,792,792,791,793,793,793,793,789,789,789,789,793,120,120,
+794,794,794,794,794,794,794,794,794,794,791,793,791,793,793,793,
+120,795,795,795,795,795,795,795,795,795,795,795,795,795,795,795,
+795,795,795,795,795,120,120,120,120,120,120,120,120,120,120,120,
/* block 169 */
-786,786,786,786,786,786,786,119,786,119,786,786,786,786,119,786,
-786,786,786,786,786,786,786,786,786,786,786,786,786,786,119,786,
-786,786,786,786,786,786,786,786,786,787,119,119,119,119,119,119,
-788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,
-788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,
-788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,789,
-790,790,790,789,789,789,789,789,789,789,789,119,119,119,119,119,
-791,791,791,791,791,791,791,791,791,791,119,119,119,119,119,119,
+796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,
+796,796,120,796,796,796,796,796,796,796,796,796,796,796,796,796,
+796,796,796,796,796,796,796,796,796,796,796,796,797,797,797,798,
+798,798,797,797,798,797,798,798,799,799,799,799,799,799,798,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 170 */
-792,793,794,795,119,796,796,796,796,796,796,796,796,119,119,796,
-796,119,119,796,796,796,796,796,796,796,796,796,796,796,796,796,
-796,796,796,796,796,796,796,796,796,119,796,796,796,796,796,796,
-796,119,796,796,119,796,796,796,796,796,119,797,793,796,798,794,
-792,794,794,794,794,119,119,794,794,119,119,794,794,794,119,119,
-796,119,119,119,119,119,119,798,119,119,119,119,119,796,796,796,
-796,796,794,794,119,119,792,792,792,792,792,792,792,119,119,119,
-792,792,792,792,792,119,119,119,119,119,119,119,119,119,119,119,
+800,800,800,800,800,800,800,120,800,120,800,800,800,800,120,800,
+800,800,800,800,800,800,800,800,800,800,800,800,800,800,120,800,
+800,800,800,800,800,800,800,800,800,801,120,120,120,120,120,120,
+802,802,802,802,802,802,802,802,802,802,802,802,802,802,802,802,
+802,802,802,802,802,802,802,802,802,802,802,802,802,802,802,802,
+802,802,802,802,802,802,802,802,802,802,802,802,802,802,802,803,
+804,804,804,803,803,803,803,803,803,803,803,120,120,120,120,120,
+805,805,805,805,805,805,805,805,805,805,120,120,120,120,120,120,
/* block 171 */
-799,799,799,799,799,799,799,799,799,799,799,799,799,799,799,799,
-799,799,799,799,799,799,799,799,799,799,799,799,799,799,799,799,
-799,799,799,799,799,799,799,799,799,799,799,799,799,799,799,799,
-799,799,799,799,799,800,800,800,801,801,801,801,801,801,801,801,
-800,800,801,801,801,800,801,799,799,799,799,802,802,802,802,802,
-803,803,803,803,803,803,803,803,803,803,119,802,119,802,801,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+806,807,808,809,120,810,810,810,810,810,810,810,810,120,120,810,
+810,120,120,810,810,810,810,810,810,810,810,810,810,810,810,810,
+810,810,810,810,810,810,810,810,810,120,810,810,810,810,810,810,
+810,120,810,810,120,810,810,810,810,810,120,811,807,810,812,808,
+806,808,808,808,808,120,120,808,808,120,120,808,808,808,120,120,
+810,120,120,120,120,120,120,812,120,120,120,120,120,810,810,810,
+810,810,808,808,120,120,806,806,806,806,806,806,806,120,120,120,
+806,806,806,806,806,120,120,120,120,120,120,120,120,120,120,120,
/* block 172 */
-804,804,804,804,804,804,804,804,804,804,804,804,804,804,804,804,
-804,804,804,804,804,804,804,804,804,804,804,804,804,804,804,804,
-804,804,804,804,804,804,804,804,804,804,804,804,804,804,804,804,
-805,806,806,807,807,807,807,807,807,806,807,806,806,805,806,807,
-807,806,807,807,804,804,808,804,119,119,119,119,119,119,119,119,
-809,809,809,809,809,809,809,809,809,809,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+813,813,813,813,813,813,813,813,813,813,813,813,813,813,813,813,
+813,813,813,813,813,813,813,813,813,813,813,813,813,813,813,813,
+813,813,813,813,813,813,813,813,813,813,813,813,813,813,813,813,
+813,813,813,813,813,814,814,814,815,815,815,815,815,815,815,815,
+814,814,815,815,815,814,815,813,813,813,813,816,816,816,816,816,
+817,817,817,817,817,817,817,817,817,817,120,816,120,816,815,813,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 173 */
-810,810,810,810,810,810,810,810,810,810,810,810,810,810,810,810,
-810,810,810,810,810,810,810,810,810,810,810,810,810,810,810,810,
-810,810,810,810,810,810,810,810,810,810,810,810,810,810,810,811,
-812,812,813,813,813,813,119,119,812,812,812,812,813,813,812,813,
-813,814,814,814,814,814,814,814,814,814,814,814,814,814,814,814,
-814,814,814,814,814,814,814,814,810,810,810,810,813,813,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+818,818,818,818,818,818,818,818,818,818,818,818,818,818,818,818,
+818,818,818,818,818,818,818,818,818,818,818,818,818,818,818,818,
+818,818,818,818,818,818,818,818,818,818,818,818,818,818,818,818,
+819,820,820,821,821,821,821,821,821,820,821,820,820,819,820,821,
+821,820,821,821,818,818,822,818,120,120,120,120,120,120,120,120,
+823,823,823,823,823,823,823,823,823,823,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 174 */
-815,815,815,815,815,815,815,815,815,815,815,815,815,815,815,815,
-815,815,815,815,815,815,815,815,815,815,815,815,815,815,815,815,
-815,815,815,815,815,815,815,815,815,815,815,815,815,815,815,815,
-816,816,816,817,817,817,817,817,817,817,817,816,816,817,816,817,
-817,818,818,818,815,119,119,119,119,119,119,119,119,119,119,119,
-819,819,819,819,819,819,819,819,819,819,119,119,119,119,119,119,
-392,392,392,392,392,392,392,392,392,392,392,392,392,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+824,824,824,824,824,824,824,824,824,824,824,824,824,824,824,824,
+824,824,824,824,824,824,824,824,824,824,824,824,824,824,824,824,
+824,824,824,824,824,824,824,824,824,824,824,824,824,824,824,825,
+826,826,827,827,827,827,120,120,826,826,826,826,827,827,826,827,
+827,828,828,828,828,828,828,828,828,828,828,828,828,828,828,828,
+828,828,828,828,828,828,828,828,824,824,824,824,827,827,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 175 */
-820,820,820,820,820,820,820,820,820,820,820,820,820,820,820,820,
-820,820,820,820,820,820,820,820,820,820,820,820,820,820,820,820,
-820,820,820,820,820,820,820,820,820,820,820,821,822,821,822,822,
-821,821,821,821,821,821,822,821,119,119,119,119,119,119,119,119,
-823,823,823,823,823,823,823,823,823,823,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+829,829,829,829,829,829,829,829,829,829,829,829,829,829,829,829,
+829,829,829,829,829,829,829,829,829,829,829,829,829,829,829,829,
+829,829,829,829,829,829,829,829,829,829,829,829,829,829,829,829,
+830,830,830,831,831,831,831,831,831,831,831,830,830,831,830,831,
+831,832,832,832,829,120,120,120,120,120,120,120,120,120,120,120,
+833,833,833,833,833,833,833,833,833,833,120,120,120,120,120,120,
+395,395,395,395,395,395,395,395,395,395,395,395,395,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 176 */
-824,824,824,824,824,824,824,824,824,824,824,824,824,824,824,824,
-824,824,824,824,824,824,824,824,824,824,824,119,119,825,825,825,
-826,826,825,825,825,825,826,825,825,825,825,825,119,119,119,119,
-827,827,827,827,827,827,827,827,827,827,828,828,829,829,829,830,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+834,834,834,834,834,834,834,834,834,834,834,834,834,834,834,834,
+834,834,834,834,834,834,834,834,834,834,834,834,834,834,834,834,
+834,834,834,834,834,834,834,834,834,834,834,835,836,835,836,836,
+835,835,835,835,835,835,836,835,834,120,120,120,120,120,120,120,
+837,837,837,837,837,837,837,837,837,837,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 177 */
-831,831,831,831,831,831,831,831,831,831,831,831,831,831,831,831,
-831,831,831,831,831,831,831,831,831,831,831,831,831,831,831,831,
-831,831,831,831,831,831,831,831,831,831,831,831,832,832,832,833,
-833,833,833,833,833,833,833,833,832,833,833,834,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+838,838,838,838,838,838,838,838,838,838,838,838,838,838,838,838,
+838,838,838,838,838,838,838,838,838,838,838,120,120,839,839,839,
+840,840,839,839,839,839,840,839,839,839,839,839,120,120,120,120,
+841,841,841,841,841,841,841,841,841,841,842,842,843,843,843,844,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 178 */
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-835,835,835,835,835,835,835,835,835,835,835,835,835,835,835,835,
-835,835,835,835,835,835,835,835,835,835,835,835,835,835,835,835,
-836,836,836,836,836,836,836,836,836,836,836,836,836,836,836,836,
-836,836,836,836,836,836,836,836,836,836,836,836,836,836,836,836,
-837,837,837,837,837,837,837,837,837,837,838,838,838,838,838,838,
-838,838,838,119,119,119,119,119,119,119,119,119,119,119,119,839,
-
-/* block 179 */
-840,841,841,841,841,841,841,841,841,841,841,840,840,840,840,840,
-840,840,840,840,840,840,840,840,840,840,840,840,840,840,840,840,
-840,840,840,840,840,840,840,840,840,840,840,840,840,840,840,840,
-840,840,840,841,841,841,841,841,841,842,843,841,841,841,841,844,
-844,844,844,844,844,844,844,841,119,119,119,119,119,119,119,119,
-845,846,846,846,846,846,846,847,847,846,846,846,845,845,845,845,
845,845,845,845,845,845,845,845,845,845,845,845,845,845,845,845,
845,845,845,845,845,845,845,845,845,845,845,845,845,845,845,845,
+845,845,845,845,845,845,845,845,845,845,845,845,846,846,846,847,
+847,847,847,847,847,847,847,847,846,847,847,848,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
-/* block 180 */
-845,845,845,845,119,119,848,848,848,848,846,846,846,846,846,846,
-846,846,846,846,846,846,846,847,846,846,849,849,849,845,849,849,
-849,849,849,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-850,850,850,850,850,850,850,850,850,850,850,850,850,850,850,850,
+/* block 179 */
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+849,849,849,849,849,849,849,849,849,849,849,849,849,849,849,849,
+849,849,849,849,849,849,849,849,849,849,849,849,849,849,849,849,
850,850,850,850,850,850,850,850,850,850,850,850,850,850,850,850,
850,850,850,850,850,850,850,850,850,850,850,850,850,850,850,850,
-850,850,850,850,850,850,850,850,850,119,119,119,119,119,119,119,
+851,851,851,851,851,851,851,851,851,851,852,852,852,852,852,852,
+852,852,852,120,120,120,120,120,120,120,120,120,120,120,120,853,
+
+/* block 180 */
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+854,854,854,854,854,854,854,854,120,120,854,854,854,854,854,854,
+854,854,854,854,854,854,854,854,854,854,854,854,854,854,854,854,
+854,854,854,854,854,854,854,854,854,854,854,854,854,854,854,854,
+854,855,855,855,856,856,856,856,120,120,856,856,855,855,855,855,
+856,854,857,854,855,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 181 */
-851,851,851,851,851,851,851,851,851,119,851,851,851,851,851,851,
-851,851,851,851,851,851,851,851,851,851,851,851,851,851,851,851,
-851,851,851,851,851,851,851,851,851,851,851,851,851,851,851,852,
-853,853,853,853,853,853,853,119,853,853,853,853,853,853,852,853,
-851,854,854,854,854,854,119,119,119,119,119,119,119,119,119,119,
-855,855,855,855,855,855,855,855,855,855,856,856,856,856,856,856,
-856,856,856,856,856,856,856,856,856,856,856,856,856,119,119,119,
-857,857,858,858,858,858,858,858,858,858,858,858,858,858,858,858,
+858,859,859,859,859,859,859,859,859,859,859,858,858,858,858,858,
+858,858,858,858,858,858,858,858,858,858,858,858,858,858,858,858,
+858,858,858,858,858,858,858,858,858,858,858,858,858,858,858,858,
+858,858,858,859,859,859,859,859,859,860,861,859,859,859,859,862,
+862,862,862,862,862,862,862,859,120,120,120,120,120,120,120,120,
+863,864,864,864,864,864,864,865,865,864,864,864,863,863,863,863,
+863,863,863,863,863,863,863,863,863,863,863,863,863,863,863,863,
+863,863,863,863,863,863,863,863,863,863,863,863,863,863,863,863,
/* block 182 */
-858,858,858,858,858,858,858,858,858,858,858,858,858,858,858,858,
-119,119,859,859,859,859,859,859,859,859,859,859,859,859,859,859,
-859,859,859,859,859,859,859,859,119,860,859,859,859,859,859,859,
-859,860,859,859,860,859,859,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+863,863,863,863,866,866,866,866,866,866,864,864,864,864,864,864,
+864,864,864,864,864,864,864,865,864,864,867,867,867,863,867,867,
+867,867,867,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+868,868,868,868,868,868,868,868,868,868,868,868,868,868,868,868,
+868,868,868,868,868,868,868,868,868,868,868,868,868,868,868,868,
+868,868,868,868,868,868,868,868,868,868,868,868,868,868,868,868,
+868,868,868,868,868,868,868,868,868,120,120,120,120,120,120,120,
/* block 183 */
-861,861,861,861,861,861,861,119,861,861,119,861,861,861,861,861,
-861,861,861,861,861,861,861,861,861,861,861,861,861,861,861,861,
-861,861,861,861,861,861,861,861,861,861,861,861,861,861,861,861,
-861,862,862,862,862,862,862,119,119,119,862,119,862,862,119,862,
-862,862,862,862,862,862,863,862,119,119,119,119,119,119,119,119,
-864,864,864,864,864,864,864,864,864,864,119,119,119,119,119,119,
-865,865,865,865,865,865,119,865,865,119,865,865,865,865,865,865,
-865,865,865,865,865,865,865,865,865,865,865,865,865,865,865,865,
+869,869,869,869,869,869,869,869,869,120,869,869,869,869,869,869,
+869,869,869,869,869,869,869,869,869,869,869,869,869,869,869,869,
+869,869,869,869,869,869,869,869,869,869,869,869,869,869,869,870,
+871,871,871,871,871,871,871,120,871,871,871,871,871,871,870,871,
+869,872,872,872,872,872,120,120,120,120,120,120,120,120,120,120,
+873,873,873,873,873,873,873,873,873,873,874,874,874,874,874,874,
+874,874,874,874,874,874,874,874,874,874,874,874,874,120,120,120,
+875,875,876,876,876,876,876,876,876,876,876,876,876,876,876,876,
/* block 184 */
-865,865,865,865,865,865,865,865,865,865,866,866,866,866,866,119,
-867,867,119,866,866,867,866,867,865,119,119,119,119,119,119,119,
-868,868,868,868,868,868,868,868,868,868,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+876,876,876,876,876,876,876,876,876,876,876,876,876,876,876,876,
+120,120,877,877,877,877,877,877,877,877,877,877,877,877,877,877,
+877,877,877,877,877,877,877,877,120,878,877,877,877,877,877,877,
+877,878,877,877,878,877,877,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 185 */
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-869,869,869,869,869,869,869,869,869,869,869,869,869,869,869,869,
-869,869,869,870,870,871,871,872,872,119,119,119,119,119,119,119,
+879,879,879,879,879,879,879,120,879,879,120,879,879,879,879,879,
+879,879,879,879,879,879,879,879,879,879,879,879,879,879,879,879,
+879,879,879,879,879,879,879,879,879,879,879,879,879,879,879,879,
+879,880,880,880,880,880,880,120,120,120,880,120,880,880,120,880,
+880,880,880,880,880,880,881,880,120,120,120,120,120,120,120,120,
+882,882,882,882,882,882,882,882,882,882,120,120,120,120,120,120,
+883,883,883,883,883,883,120,883,883,120,883,883,883,883,883,883,
+883,883,883,883,883,883,883,883,883,883,883,883,883,883,883,883,
/* block 186 */
-873,873,873,873,873,873,873,873,873,873,873,873,873,873,873,873,
-873,873,873,873,873,873,873,873,873,873,873,873,873,873,873,873,
-873,873,873,873,873,873,873,873,873,873,873,873,873,873,873,873,
-873,873,873,873,873,873,873,873,873,873,873,873,873,873,873,873,
-873,873,873,873,873,873,873,873,873,873,873,873,873,873,873,873,
-873,873,873,873,873,873,873,873,873,873,873,873,873,873,873,873,
-873,873,873,873,873,873,873,873,873,873,873,873,873,873,873,873,
-873,873,873,873,873,873,873,873,873,873,873,873,873,873,873,873,
+883,883,883,883,883,883,883,883,883,883,884,884,884,884,884,120,
+885,885,120,884,884,885,884,885,883,120,120,120,120,120,120,120,
+886,886,886,886,886,886,886,886,886,886,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 187 */
-873,873,873,873,873,873,873,873,873,873,873,873,873,873,873,873,
-873,873,873,873,873,873,873,873,873,873,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+887,887,887,887,887,887,887,887,887,887,887,887,887,887,887,887,
+887,887,887,888,888,889,889,890,890,120,120,120,120,120,120,120,
/* block 188 */
-874,874,874,874,874,874,874,874,874,874,874,874,874,874,874,874,
-874,874,874,874,874,874,874,874,874,874,874,874,874,874,874,874,
-874,874,874,874,874,874,874,874,874,874,874,874,874,874,874,874,
-874,874,874,874,874,874,874,874,874,874,874,874,874,874,874,874,
-874,874,874,874,874,874,874,874,874,874,874,874,874,874,874,874,
-874,874,874,874,874,874,874,874,874,874,874,874,874,874,874,874,
-874,874,874,874,874,874,874,874,874,874,874,874,874,874,874,119,
-875,875,875,875,875,119,119,119,119,119,119,119,119,119,119,119,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+891,891,891,891,891,891,891,891,891,891,891,891,891,891,891,891,
+294,294,891,294,891,296,296,296,296,296,296,296,296,297,297,297,
+297,296,296,296,296,296,296,296,296,296,296,296,296,296,296,296,
+296,296,120,120,120,120,120,120,120,120,120,120,120,120,120,892,
/* block 189 */
-873,873,873,873,873,873,873,873,873,873,873,873,873,873,873,873,
-873,873,873,873,873,873,873,873,873,873,873,873,873,873,873,873,
-873,873,873,873,873,873,873,873,873,873,873,873,873,873,873,873,
-873,873,873,873,873,873,873,873,873,873,873,873,873,873,873,873,
-873,873,873,873,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+893,893,893,893,893,893,893,893,893,893,893,893,893,893,893,893,
+893,893,893,893,893,893,893,893,893,893,893,893,893,893,893,893,
+893,893,893,893,893,893,893,893,893,893,893,893,893,893,893,893,
+893,893,893,893,893,893,893,893,893,893,893,893,893,893,893,893,
+893,893,893,893,893,893,893,893,893,893,893,893,893,893,893,893,
+893,893,893,893,893,893,893,893,893,893,893,893,893,893,893,893,
+893,893,893,893,893,893,893,893,893,893,893,893,893,893,893,893,
+893,893,893,893,893,893,893,893,893,893,893,893,893,893,893,893,
/* block 190 */
-876,876,876,876,876,876,876,876,876,876,876,876,876,876,876,876,
-876,876,876,876,876,876,876,876,876,876,876,876,876,876,876,876,
-876,876,876,876,876,876,876,876,876,876,876,876,876,876,876,876,
-876,876,876,876,876,876,876,876,876,876,876,876,876,876,876,876,
-876,876,876,876,876,876,876,876,876,876,876,876,876,876,876,876,
-876,876,876,876,876,876,876,876,876,876,876,876,876,876,876,876,
-876,876,876,876,876,876,876,876,876,876,876,876,876,876,876,876,
-876,876,876,876,876,876,876,876,876,876,876,876,876,876,876,876,
+893,893,893,893,893,893,893,893,893,893,893,893,893,893,893,893,
+893,893,893,893,893,893,893,893,893,893,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 191 */
-876,876,876,876,876,876,876,876,876,876,876,876,876,876,876,876,
-876,876,876,876,876,876,876,876,876,876,876,876,876,876,876,876,
-876,876,876,876,876,876,876,876,876,876,876,876,876,876,876,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+894,894,894,894,894,894,894,894,894,894,894,894,894,894,894,894,
+894,894,894,894,894,894,894,894,894,894,894,894,894,894,894,894,
+894,894,894,894,894,894,894,894,894,894,894,894,894,894,894,894,
+894,894,894,894,894,894,894,894,894,894,894,894,894,894,894,894,
+894,894,894,894,894,894,894,894,894,894,894,894,894,894,894,894,
+894,894,894,894,894,894,894,894,894,894,894,894,894,894,894,894,
+894,894,894,894,894,894,894,894,894,894,894,894,894,894,894,120,
+895,895,895,895,895,120,120,120,120,120,120,120,120,120,120,120,
/* block 192 */
-877,877,877,877,877,877,877,877,877,877,877,877,877,877,877,877,
-877,877,877,877,877,877,877,877,877,877,877,877,877,877,877,877,
-877,877,877,877,877,877,877,877,877,877,877,877,877,877,877,877,
-877,877,877,877,877,877,877,877,877,877,877,877,877,877,877,877,
-877,877,877,877,877,877,877,877,877,877,877,877,877,877,877,877,
-877,877,877,877,877,877,877,877,877,877,877,877,877,877,877,877,
-877,877,877,877,877,877,877,877,877,877,877,877,877,877,877,877,
-877,877,877,877,877,877,877,877,877,877,877,877,877,877,877,877,
+893,893,893,893,893,893,893,893,893,893,893,893,893,893,893,893,
+893,893,893,893,893,893,893,893,893,893,893,893,893,893,893,893,
+893,893,893,893,893,893,893,893,893,893,893,893,893,893,893,893,
+893,893,893,893,893,893,893,893,893,893,893,893,893,893,893,893,
+893,893,893,893,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 193 */
-877,877,877,877,877,877,877,877,877,877,877,877,877,877,877,877,
-877,877,877,877,877,877,877,877,877,877,877,877,877,877,877,877,
-877,877,877,877,877,877,877,877,877,877,877,877,877,877,877,877,
-877,877,877,877,877,877,877,877,877,877,877,877,877,877,877,877,
-877,877,877,877,877,877,877,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+896,896,896,896,896,896,896,896,896,896,896,896,896,896,896,896,
+896,896,896,896,896,896,896,896,896,896,896,896,896,896,896,896,
+896,896,896,896,896,896,896,896,896,896,896,896,896,896,896,896,
+896,896,896,896,896,896,896,896,896,896,896,896,896,896,896,896,
+896,896,896,896,896,896,896,896,896,896,896,896,896,896,896,896,
+896,896,896,896,896,896,896,896,896,896,896,896,896,896,896,896,
+896,896,896,896,896,896,896,896,896,896,896,896,896,896,896,896,
+896,896,896,896,896,896,896,896,896,896,896,896,896,896,896,896,
/* block 194 */
-592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
-592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
-592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
-592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
-592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
-592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
-592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
-592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
+896,896,896,896,896,896,896,896,896,896,896,896,896,896,896,896,
+896,896,896,896,896,896,896,896,896,896,896,896,896,896,896,896,
+896,896,896,896,896,896,896,896,896,896,896,896,896,896,896,120,
+897,897,897,897,897,897,897,897,897,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 195 */
-592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
-592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
-592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
-592,592,592,592,592,592,592,592,592,119,119,119,119,119,119,119,
-878,878,878,878,878,878,878,878,878,878,878,878,878,878,878,878,
-878,878,878,878,878,878,878,878,878,878,878,878,878,878,878,119,
-879,879,879,879,879,879,879,879,879,879,119,119,119,119,880,880,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+898,898,898,898,898,898,898,898,898,898,898,898,898,898,898,898,
+898,898,898,898,898,898,898,898,898,898,898,898,898,898,898,898,
+898,898,898,898,898,898,898,898,898,898,898,898,898,898,898,898,
+898,898,898,898,898,898,898,898,898,898,898,898,898,898,898,898,
+898,898,898,898,898,898,898,898,898,898,898,898,898,898,898,898,
+898,898,898,898,898,898,898,898,898,898,898,898,898,898,898,898,
+898,898,898,898,898,898,898,898,898,898,898,898,898,898,898,898,
+898,898,898,898,898,898,898,898,898,898,898,898,898,898,898,898,
/* block 196 */
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-881,881,881,881,881,881,881,881,881,881,881,881,881,881,881,881,
-881,881,881,881,881,881,881,881,881,881,881,881,881,881,119,119,
-882,882,882,882,882,883,119,119,119,119,119,119,119,119,119,119,
+898,898,898,898,898,898,898,898,898,898,898,898,898,898,898,898,
+898,898,898,898,898,898,898,898,898,898,898,898,898,898,898,898,
+898,898,898,898,898,898,898,898,898,898,898,898,898,898,898,898,
+898,898,898,898,898,898,898,898,898,898,898,898,898,898,898,898,
+898,898,898,898,898,898,898,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 197 */
-884,884,884,884,884,884,884,884,884,884,884,884,884,884,884,884,
-884,884,884,884,884,884,884,884,884,884,884,884,884,884,884,884,
-884,884,884,884,884,884,884,884,884,884,884,884,884,884,884,884,
-885,885,885,885,885,885,885,886,886,886,886,886,887,887,887,887,
-888,888,888,888,886,887,119,119,119,119,119,119,119,119,119,119,
-889,889,889,889,889,889,889,889,889,889,119,890,890,890,890,890,
-890,890,119,884,884,884,884,884,884,884,884,884,884,884,884,884,
-884,884,884,884,884,884,884,884,119,119,119,119,119,884,884,884,
+601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,
+601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,
+601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,
+601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,
+601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,
+601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,
+601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,
+601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,
/* block 198 */
-884,884,884,884,884,884,884,884,884,884,884,884,884,884,884,884,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,
+601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,
+601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,
+601,601,601,601,601,601,601,601,601,120,120,120,120,120,120,120,
+899,899,899,899,899,899,899,899,899,899,899,899,899,899,899,899,
+899,899,899,899,899,899,899,899,899,899,899,899,899,899,899,120,
+900,900,900,900,900,900,900,900,900,900,120,120,120,120,901,901,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 199 */
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-891,891,891,891,891,891,891,891,891,891,891,891,891,891,891,891,
-891,891,891,891,891,891,891,891,891,891,891,891,891,891,891,891,
-892,892,892,892,892,892,892,892,892,892,892,892,892,892,892,892,
-892,892,892,892,892,892,892,892,892,892,892,892,892,892,892,892,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,
+902,902,902,902,902,902,902,902,902,902,902,902,902,902,120,120,
+903,903,903,903,903,904,120,120,120,120,120,120,120,120,120,120,
/* block 200 */
-893,893,893,893,893,893,893,893,893,893,893,893,893,893,893,893,
-893,893,893,893,893,893,893,894,894,894,894,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+905,905,905,905,905,905,905,905,905,905,905,905,905,905,905,905,
+905,905,905,905,905,905,905,905,905,905,905,905,905,905,905,905,
+905,905,905,905,905,905,905,905,905,905,905,905,905,905,905,905,
+906,906,906,906,906,906,906,907,907,907,907,907,908,908,908,908,
+909,909,909,909,907,908,120,120,120,120,120,120,120,120,120,120,
+910,910,910,910,910,910,910,910,910,910,120,911,911,911,911,911,
+911,911,120,905,905,905,905,905,905,905,905,905,905,905,905,905,
+905,905,905,905,905,905,905,905,120,120,120,120,120,905,905,905,
/* block 201 */
-895,895,895,895,895,895,895,895,895,895,895,895,895,895,895,895,
-895,895,895,895,895,895,895,895,895,895,895,895,895,895,895,895,
-895,895,895,895,895,895,895,895,895,895,895,895,895,895,895,895,
-895,895,895,895,895,895,895,895,895,895,895,895,895,895,895,895,
-895,895,895,895,895,119,119,119,119,119,119,119,119,119,119,119,
-895,896,896,896,896,896,896,896,896,896,896,896,896,896,896,896,
-896,896,896,896,896,896,896,896,896,896,896,896,896,896,896,896,
-896,896,896,896,896,896,896,896,896,896,896,896,896,896,896,119,
+905,905,905,905,905,905,905,905,905,905,905,905,905,905,905,905,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 202 */
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,897,
-897,897,897,898,898,898,898,898,898,898,898,898,898,898,898,898,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-899,900,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+912,912,912,912,912,912,912,912,912,912,912,912,912,912,912,912,
+912,912,912,912,912,912,912,912,912,912,912,912,912,912,912,912,
+913,913,913,913,913,913,913,913,913,913,913,913,913,913,913,913,
+913,913,913,913,913,913,913,913,913,913,913,913,913,913,913,913,
/* block 203 */
-901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,
-901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,
-901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,
-901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,
-901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,
-901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,
-901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,
-901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,
+914,914,914,914,914,914,914,914,914,914,914,914,914,914,914,914,
+914,914,914,914,914,914,914,915,915,915,915,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 204 */
-901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,
-901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,
-901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,
-901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,
-901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,
-901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,
-901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,
-901,901,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+916,916,916,916,916,916,916,916,916,916,916,916,916,916,916,916,
+916,916,916,916,916,916,916,916,916,916,916,916,916,916,916,916,
+916,916,916,916,916,916,916,916,916,916,916,916,916,916,916,916,
+916,916,916,916,916,916,916,916,916,916,916,916,916,916,916,916,
+916,916,916,916,916,916,916,916,916,916,916,120,120,120,120,917,
+916,918,918,918,918,918,918,918,918,918,918,918,918,918,918,918,
+918,918,918,918,918,918,918,918,918,918,918,918,918,918,918,918,
+918,918,918,918,918,918,918,918,918,918,918,918,918,918,918,918,
/* block 205 */
-901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,
-901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,
-901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,
-901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,
-901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,
-901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,
-901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,
-901,901,901,119,119,119,119,119,119,119,119,119,119,119,119,119,
+918,918,918,918,918,918,918,918,120,120,120,120,120,120,120,917,
+917,917,917,919,919,919,919,919,919,919,919,919,919,919,919,919,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+920,921, 5,111,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 206 */
-569,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,
-564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,
-564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,
-564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,
-564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,
-564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,
-564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,
-564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,
+922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,
+922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,
+922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,
+922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,
+922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,
+922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,
+922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,
+922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,
/* block 207 */
-564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,
-564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,
-564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,
-564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,
-564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,
-564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,
-564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,
-564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,
+922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,
+922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,
+922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,
+922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,
+922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,
+922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,
+922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,
+922,922,922,922,922,922,922,922,120,120,120,120,120,120,120,120,
/* block 208 */
-564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,
-564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,
+922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,
+922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,
+922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,
+922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,
+922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,
+922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,
+922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,
+922,922,922,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 209 */
-902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,
-902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,
-902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,
-902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,
-902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,
-902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,
-902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,
-902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,
+578,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,
+573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,
+573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,
+573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,
+573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,
+573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,
+573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,
+573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,
/* block 210 */
-902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,
-902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,
-902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,
-902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,
-902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,
-902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,
-902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,
-902,902,902,902,902,902,902,902,902,902,902,902,119,119,119,119,
+573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,
+573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,
+573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,
+573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,
+573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,
+573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,
+573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,
+573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,
/* block 211 */
-903,903,903,903,903,903,903,903,903,903,903,903,903,903,903,903,
-903,903,903,903,903,903,903,903,903,903,903,903,903,903,903,903,
-903,903,903,903,903,903,903,903,903,903,903,903,903,903,903,903,
-903,903,903,903,903,903,903,903,903,903,903,903,903,903,903,903,
-903,903,903,903,903,903,903,903,903,903,903,903,903,903,903,903,
-903,903,903,903,903,903,903,903,903,903,903,903,903,903,903,903,
-903,903,903,903,903,903,903,903,903,903,903,119,119,119,119,119,
-903,903,903,903,903,903,903,903,903,903,903,903,903,119,119,119,
+573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,
+573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+573,573,573,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,578,578,578,578,120,120,120,120,120,120,120,120,
+923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
/* block 212 */
-903,903,903,903,903,903,903,903,903,119,119,119,119,119,119,119,
-903,903,903,903,903,903,903,903,903,903,119,119,904,905,905,906,
-907,907,907,907,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
+923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
+923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
+923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
+923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
+923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
+923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
+923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
/* block 213 */
+923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
+923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
+923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
+923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
+923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
+923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
+923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
+923,923,923,923,923,923,923,923,923,923,923,923,120,120,120,120,
+
+/* block 214 */
+924,924,924,924,924,924,924,924,924,924,924,924,924,924,924,924,
+924,924,924,924,924,924,924,924,924,924,924,924,924,924,924,924,
+924,924,924,924,924,924,924,924,924,924,924,924,924,924,924,924,
+924,924,924,924,924,924,924,924,924,924,924,924,924,924,924,924,
+924,924,924,924,924,924,924,924,924,924,924,924,924,924,924,924,
+924,924,924,924,924,924,924,924,924,924,924,924,924,924,924,924,
+924,924,924,924,924,924,924,924,924,924,924,120,120,120,120,120,
+924,924,924,924,924,924,924,924,924,924,924,924,924,120,120,120,
+
+/* block 215 */
+924,924,924,924,924,924,924,924,924,120,120,120,120,120,120,120,
+924,924,924,924,924,924,924,924,924,924,120,120,925,926,926,927,
+928,928,928,928,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+
+/* block 216 */
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
@@ -3802,309 +3867,339 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 68608 bytes, block = 128 */
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20,119,119,119,119,119,119,119,119,119,119,
+ 20, 20, 20, 20, 20, 20,120,120,120,120,120,120,120,120,120,120,
-/* block 214 */
+/* block 217 */
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20,119,119, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20,120,120, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20,908,909,112,112,112, 20, 20, 20,909,908,908,
-908,908,908, 24, 24, 24, 24, 24, 24, 24, 24,112,112,112,112,112,
+ 20, 20, 20, 20, 20,929,930,113,113,113, 20, 20, 20,930,929,929,
+929,929,929, 24, 24, 24, 24, 24, 24, 24, 24,113,113,113,113,113,
-/* block 215 */
-112,112,112, 20, 20,112,112,112,112,112,112,112, 20, 20, 20, 20,
+/* block 218 */
+113,113,113, 20, 20,113,113,113,113,113,113,113, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,112,112,112,112, 20, 20,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,113,113,113,113, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
-/* block 216 */
-671,671,671,671,671,671,671,671,671,671,671,671,671,671,671,671,
-671,671,671,671,671,671,671,671,671,671,671,671,671,671,671,671,
-671,671,671,671,671,671,671,671,671,671,671,671,671,671,671,671,
-671,671,671,671,671,671,671,671,671,671,671,671,671,671,671,671,
-671,671,910,910,910,671,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+/* block 219 */
+684,684,684,684,684,684,684,684,684,684,684,684,684,684,684,684,
+684,684,684,684,684,684,684,684,684,684,684,684,684,684,684,684,
+684,684,684,684,684,684,684,684,684,684,684,684,684,684,684,684,
+684,684,684,684,684,684,684,684,684,684,684,684,684,684,684,684,
+684,684,931,931,931,684,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
-/* block 217 */
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+/* block 220 */
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
- 25, 25, 25, 25,119,119,119,119,119,119,119,119,119,119,119,119,
+ 25, 25, 25, 25,120,120,120,120,120,120,120,120,120,120,120,120,
-/* block 218 */
+/* block 221 */
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20,119,119,119,119,119,119,119,119,119,
-573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,
-573,573, 25, 25, 25, 25, 25, 25, 25,119,119,119,119,119,119,119,
-
-/* block 219 */
-504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,
-504,504,504,504,504,504,504,504,504,504,505,505,505,505,505,505,
-505,505,505,505,505,505,505,505,505,505,505,505,505,505,505,505,
-505,505,505,505,504,504,504,504,504,504,504,504,504,504,504,504,
-504,504,504,504,504,504,504,504,504,504,504,504,504,504,505,505,
-505,505,505,505,505,119,505,505,505,505,505,505,505,505,505,505,
-505,505,505,505,505,505,505,505,504,504,504,504,504,504,504,504,
-504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,
-
-/* block 220 */
-504,504,505,505,505,505,505,505,505,505,505,505,505,505,505,505,
-505,505,505,505,505,505,505,505,505,505,505,505,504,119,504,504,
-119,119,504,119,119,504,504,119,119,504,504,504,504,119,504,504,
-504,504,504,504,504,504,505,505,505,505,119,505,119,505,505,505,
-505,505,505,505,119,505,505,505,505,505,505,505,505,505,505,505,
-504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,
-504,504,504,504,504,504,504,504,504,504,505,505,505,505,505,505,
-505,505,505,505,505,505,505,505,505,505,505,505,505,505,505,505,
-
-/* block 221 */
-505,505,505,505,504,504,119,504,504,504,504,119,119,504,504,504,
-504,504,504,504,504,119,504,504,504,504,504,504,504,119,505,505,
-505,505,505,505,505,505,505,505,505,505,505,505,505,505,505,505,
-505,505,505,505,505,505,505,505,504,504,119,504,504,504,504,119,
-504,504,504,504,504,119,504,119,119,119,504,504,504,504,504,504,
-504,119,505,505,505,505,505,505,505,505,505,505,505,505,505,505,
-505,505,505,505,505,505,505,505,505,505,505,505,504,504,504,504,
-504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,
+ 20, 20, 20, 20, 20, 20, 20,120,120,120,120,120,120,120,120,120,
+582,582,582,582,582,582,582,582,582,582,582,582,582,582,582,582,
+582,582, 25, 25, 25, 25, 25, 25, 25,120,120,120,120,120,120,120,
/* block 222 */
-504,504,504,504,504,504,505,505,505,505,505,505,505,505,505,505,
-505,505,505,505,505,505,505,505,505,505,505,505,505,505,505,505,
-504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,
-504,504,504,504,504,504,504,504,504,504,505,505,505,505,505,505,
-505,505,505,505,505,505,505,505,505,505,505,505,505,505,505,505,
-505,505,505,505,504,504,504,504,504,504,504,504,504,504,504,504,
-504,504,504,504,504,504,504,504,504,504,504,504,504,504,505,505,
-505,505,505,505,505,505,505,505,505,505,505,505,505,505,505,505,
+513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,
+513,513,513,513,513,513,513,513,513,513,514,514,514,514,514,514,
+514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,
+514,514,514,514,513,513,513,513,513,513,513,513,513,513,513,513,
+513,513,513,513,513,513,513,513,513,513,513,513,513,513,514,514,
+514,514,514,514,514,120,514,514,514,514,514,514,514,514,514,514,
+514,514,514,514,514,514,514,514,513,513,513,513,513,513,513,513,
+513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,
/* block 223 */
-505,505,505,505,505,505,505,505,504,504,504,504,504,504,504,504,
-504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,
-504,504,505,505,505,505,505,505,505,505,505,505,505,505,505,505,
-505,505,505,505,505,505,505,505,505,505,505,505,504,504,504,504,
-504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,
-504,504,504,504,504,504,505,505,505,505,505,505,505,505,505,505,
-505,505,505,505,505,505,505,505,505,505,505,505,505,505,505,505,
-504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,
+513,513,514,514,514,514,514,514,514,514,514,514,514,514,514,514,
+514,514,514,514,514,514,514,514,514,514,514,514,513,120,513,513,
+120,120,513,120,120,513,513,120,120,513,513,513,513,120,513,513,
+513,513,513,513,513,513,514,514,514,514,120,514,120,514,514,514,
+514,514,514,514,120,514,514,514,514,514,514,514,514,514,514,514,
+513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,
+513,513,513,513,513,513,513,513,513,513,514,514,514,514,514,514,
+514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,
/* block 224 */
-504,504,504,504,504,504,504,504,504,504,505,505,505,505,505,505,
-505,505,505,505,505,505,505,505,505,505,505,505,505,505,505,505,
-505,505,505,505,505,505,119,119,504,504,504,504,504,504,504,504,
-504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,
-504, 9,505,505,505,505,505,505,505,505,505,505,505,505,505,505,
-505,505,505,505,505,505,505,505,505,505,505, 9,505,505,505,505,
-505,505,504,504,504,504,504,504,504,504,504,504,504,504,504,504,
-504,504,504,504,504,504,504,504,504,504,504, 9,505,505,505,505,
+514,514,514,514,513,513,120,513,513,513,513,120,120,513,513,513,
+513,513,513,513,513,120,513,513,513,513,513,513,513,120,514,514,
+514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,
+514,514,514,514,514,514,514,514,513,513,120,513,513,513,513,120,
+513,513,513,513,513,120,513,120,120,120,513,513,513,513,513,513,
+513,120,514,514,514,514,514,514,514,514,514,514,514,514,514,514,
+514,514,514,514,514,514,514,514,514,514,514,514,513,513,513,513,
+513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,
/* block 225 */
-505,505,505,505,505,505,505,505,505,505,505,505,505,505,505,505,
-505,505,505,505,505, 9,505,505,505,505,505,505,504,504,504,504,
-504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,
-504,504,504,504,504, 9,505,505,505,505,505,505,505,505,505,505,
-505,505,505,505,505,505,505,505,505,505,505,505,505,505,505, 9,
-505,505,505,505,505,505,504,504,504,504,504,504,504,504,504,504,
-504,504,504,504,504,504,504,504,504,504,504,504,504,504,504, 9,
-505,505,505,505,505,505,505,505,505,505,505,505,505,505,505,505,
+513,513,513,513,513,513,514,514,514,514,514,514,514,514,514,514,
+514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,
+513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,
+513,513,513,513,513,513,513,513,513,513,514,514,514,514,514,514,
+514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,
+514,514,514,514,513,513,513,513,513,513,513,513,513,513,513,513,
+513,513,513,513,513,513,513,513,513,513,513,513,513,513,514,514,
+514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,
/* block 226 */
-505,505,505,505,505,505,505,505,505, 9,505,505,505,505,505,505,
-504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,
-504,504,504,504,504,504,504,504,504, 9,505,505,505,505,505,505,
-505,505,505,505,505,505,505,505,505,505,505,505,505,505,505,505,
-505,505,505, 9,505,505,505,505,505,505,504,505,119,119, 11, 11,
- 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
- 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
- 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+514,514,514,514,514,514,514,514,513,513,513,513,513,513,513,513,
+513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,
+513,513,514,514,514,514,514,514,514,514,514,514,514,514,514,514,
+514,514,514,514,514,514,514,514,514,514,514,514,513,513,513,513,
+513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,
+513,513,513,513,513,513,514,514,514,514,514,514,514,514,514,514,
+514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,
+513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,
/* block 227 */
-911,911,911,911,911,911,911,911,911,911,911,911,911,911,911,911,
-911,911,911,911,911,911,911,911,911,911,911,911,911,911,911,911,
-911,911,911,911,911,911,911,911,911,911,911,911,911,911,911,911,
-911,911,911,911,911,911,911,911,911,911,911,911,911,911,911,911,
-911,911,911,911,911,911,911,911,911,911,911,911,911,911,911,911,
-911,911,911,911,911,911,911,911,911,911,911,911,911,911,911,911,
-911,911,911,911,911,911,911,911,911,911,911,911,911,911,911,911,
-911,911,911,911,911,911,911,911,911,911,911,911,911,911,911,911,
+513,513,513,513,513,513,513,513,513,513,514,514,514,514,514,514,
+514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,
+514,514,514,514,514,514,120,120,513,513,513,513,513,513,513,513,
+513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,
+513, 9,514,514,514,514,514,514,514,514,514,514,514,514,514,514,
+514,514,514,514,514,514,514,514,514,514,514, 9,514,514,514,514,
+514,514,513,513,513,513,513,513,513,513,513,513,513,513,513,513,
+513,513,513,513,513,513,513,513,513,513,513, 9,514,514,514,514,
/* block 228 */
-912,912,912,912,912,912,912,912,912,912,912,912,912,912,912,912,
-912,912,912,912,912,912,912,912,912,912,912,912,912,912,912,912,
-912,912,912,912,912,912,912,912,912,912,912,912,912,912,912,912,
-912,912,912,912,912,912,912,911,911,911,911,912,912,912,912,912,
-912,912,912,912,912,912,912,912,912,912,912,912,912,912,912,912,
-912,912,912,912,912,912,912,912,912,912,912,912,912,912,912,912,
-912,912,912,912,912,912,912,912,912,912,912,912,912,911,911,911,
-911,911,911,911,911,912,911,911,911,911,911,911,911,911,911,911,
+514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,
+514,514,514,514,514, 9,514,514,514,514,514,514,513,513,513,513,
+513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,
+513,513,513,513,513, 9,514,514,514,514,514,514,514,514,514,514,
+514,514,514,514,514,514,514,514,514,514,514,514,514,514,514, 9,
+514,514,514,514,514,514,513,513,513,513,513,513,513,513,513,513,
+513,513,513,513,513,513,513,513,513,513,513,513,513,513,513, 9,
+514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,
/* block 229 */
-911,911,911,911,912,911,911,913,913,913,913,913,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,912,912,912,912,912,
-119,912,912,912,912,912,912,912,912,912,912,912,912,912,912,912,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+514,514,514,514,514,514,514,514,514, 9,514,514,514,514,514,514,
+513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,
+513,513,513,513,513,513,513,513,513, 9,514,514,514,514,514,514,
+514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,
+514,514,514, 9,514,514,514,514,514,514,513,514,120,120, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
/* block 230 */
-914,914,914,914,914,914,914,119,914,914,914,914,914,914,914,914,
-914,914,914,914,914,914,914,914,914,119,119,914,914,914,914,914,
-914,914,119,914,914,119,914,914,914,914,914,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+932,932,932,932,932,932,932,932,932,932,932,932,932,932,932,932,
+932,932,932,932,932,932,932,932,932,932,932,932,932,932,932,932,
+932,932,932,932,932,932,932,932,932,932,932,932,932,932,932,932,
+932,932,932,932,932,932,932,932,932,932,932,932,932,932,932,932,
+932,932,932,932,932,932,932,932,932,932,932,932,932,932,932,932,
+932,932,932,932,932,932,932,932,932,932,932,932,932,932,932,932,
+932,932,932,932,932,932,932,932,932,932,932,932,932,932,932,932,
+932,932,932,932,932,932,932,932,932,932,932,932,932,932,932,932,
/* block 231 */
-915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,
-915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,
-915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,
-915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,
-915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,
-915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,
-915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,
-915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,
+933,933,933,933,933,933,933,933,933,933,933,933,933,933,933,933,
+933,933,933,933,933,933,933,933,933,933,933,933,933,933,933,933,
+933,933,933,933,933,933,933,933,933,933,933,933,933,933,933,933,
+933,933,933,933,933,933,933,932,932,932,932,933,933,933,933,933,
+933,933,933,933,933,933,933,933,933,933,933,933,933,933,933,933,
+933,933,933,933,933,933,933,933,933,933,933,933,933,933,933,933,
+933,933,933,933,933,933,933,933,933,933,933,933,933,932,932,932,
+932,932,932,932,932,933,932,932,932,932,932,932,932,932,932,932,
/* block 232 */
-915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,
-915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,
-915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,
-915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,
-915,915,915,915,915,119,119,916,916,916,916,916,916,916,916,916,
-917,917,917,917,917,917,917,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+932,932,932,932,933,932,932,934,934,934,934,934,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,933,933,933,933,933,
+120,933,933,933,933,933,933,933,933,933,933,933,933,933,933,933,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 233 */
-918,918,918,918,918,918,918,918,918,918,918,918,918,918,918,918,
-918,918,918,918,918,918,918,918,918,918,918,918,918,918,918,918,
-918,918,919,919,919,919,919,919,919,919,919,919,919,919,919,919,
-919,919,919,919,919,919,919,919,919,919,919,919,919,919,919,919,
-919,919,919,919,920,920,920,920,920,920,920,119,119,119,119,119,
-921,921,921,921,921,921,921,921,921,921,119,119,119,119,922,922,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+935,935,935,935,935,935,935,120,935,935,935,935,935,935,935,935,
+935,935,935,935,935,935,935,935,935,120,120,935,935,935,935,935,
+935,935,120,935,935,120,935,935,935,935,935,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 234 */
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+936,936,936,936,936,936,936,936,936,936,936,936,936,936,936,936,
+936,936,936,936,936,936,936,936,936,936,936,936,936,936,936,936,
+936,936,936,936,936,936,936,936,936,936,936,936,936,120,120,120,
+937,937,937,937,937,937,937,938,938,938,938,938,938,938,120,120,
+939,939,939,939,939,939,939,939,939,939,120,120,120,120,936,940,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 235 */
- 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
- 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
- 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 20, 25, 25, 25,
- 6, 25, 25, 25, 25,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+941,941,941,941,941,941,941,941,941,941,941,941,941,941,941,941,
+941,941,941,941,941,941,941,941,941,941,941,941,941,941,941,941,
+941,941,941,941,941,941,941,941,941,941,941,941,942,942,942,942,
+943,943,943,943,943,943,943,943,943,943,120,120,120,120,120,944,
/* block 236 */
-224,224,224,224,119,224,224,224,224,224,224,224,224,224,224,224,
-224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
-119,224,224,119,224,119,119,224,119,224,224,224,224,224,224,224,
-224,224,224,119,224,224,224,224,119,224,119,224,119,119,119,119,
-119,119,224,119,119,119,119,224,119,224,119,224,119,224,224,224,
-119,224,224,119,224,119,119,224,119,224,119,224,119,224,119,224,
-119,224,224,119,224,119,119,224,224,224,224,119,224,224,224,224,
-224,224,224,119,224,224,224,224,119,224,224,224,224,119,224,119,
+945,945,945,945,945,945,945,945,945,945,945,945,945,945,945,945,
+945,945,945,945,945,945,945,945,945,945,945,945,945,945,945,945,
+945,945,945,945,945,945,945,945,945,945,945,945,945,945,945,945,
+945,945,945,945,945,945,945,945,945,945,945,945,945,945,945,945,
+945,945,945,945,945,945,945,945,945,945,945,945,945,945,945,945,
+945,945,945,945,945,945,945,945,945,945,945,945,945,945,945,945,
+945,945,945,945,945,945,945,945,945,945,945,945,945,945,945,945,
+945,945,945,945,945,945,945,945,945,945,945,945,945,945,945,945,
/* block 237 */
-224,224,224,224,224,224,224,224,224,224,119,224,224,224,224,224,
-224,224,224,224,224,224,224,224,224,224,224,224,119,119,119,119,
-119,224,224,224,119,224,224,224,224,224,119,224,224,224,224,224,
-224,224,224,224,224,224,224,224,224,224,224,224,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-217,217,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+945,945,945,945,945,945,945,945,945,945,945,945,945,945,945,945,
+945,945,945,945,945,945,945,945,945,945,945,945,945,945,945,945,
+945,945,945,945,945,945,945,945,945,945,945,945,945,945,945,945,
+945,945,945,945,945,945,945,945,945,945,945,945,945,945,945,945,
+945,945,945,945,945,120,120,946,946,946,946,946,946,946,946,946,
+947,947,947,947,947,947,947,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 238 */
+948,948,948,948,948,948,948,948,948,948,948,948,948,948,948,948,
+948,948,948,948,948,948,948,948,948,948,948,948,948,948,948,948,
+948,948,949,949,949,949,949,949,949,949,949,949,949,949,949,949,
+949,949,949,949,949,949,949,949,949,949,949,949,949,949,949,949,
+949,949,949,949,950,950,950,950,950,950,950,951,120,120,120,120,
+952,952,952,952,952,952,952,952,952,952,120,120,120,120,953,953,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+
+/* block 239 */
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+
+/* block 240 */
+ 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+ 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+ 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 20, 25, 25, 25,
+ 6, 25, 25, 25, 25,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+
+/* block 241 */
+120, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+ 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+ 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 20, 25,
+ 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+
+/* block 242 */
+225,225,225,225,120,225,225,225,225,225,225,225,225,225,225,225,
+225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,
+120,225,225,120,225,120,120,225,120,225,225,225,225,225,225,225,
+225,225,225,120,225,225,225,225,120,225,120,225,120,120,120,120,
+120,120,225,120,120,120,120,225,120,225,120,225,120,225,225,225,
+120,225,225,120,225,120,120,225,120,225,120,225,120,225,120,225,
+120,225,225,120,225,120,120,225,225,225,225,120,225,225,225,225,
+225,225,225,120,225,225,225,225,120,225,225,225,225,120,225,120,
+
+/* block 243 */
+225,225,225,225,225,225,225,225,225,225,120,225,225,225,225,225,
+225,225,225,225,225,225,225,225,225,225,225,225,120,120,120,120,
+120,225,225,225,120,225,225,225,225,225,120,225,225,225,225,225,
+225,225,225,225,225,225,225,225,225,225,225,225,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+218,218,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+
+/* block 244 */
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
- 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,923,923,923,923,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,954,954,954,954,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
-/* block 239 */
+/* block 245 */
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
- 21, 21, 21, 21,923,923,923,923,923,923,923,923,923,923,923,923,
- 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,923,
-923, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
-923, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
-923, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21,954,954,954,954,954,954,954,954,954,954,954,954,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,954,
+954, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+954, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+954, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
- 21, 21, 21, 21, 21, 21,923,923,923,923,923,923,923,923,923,923,
+ 21, 21, 21, 21, 21, 21,954,954,954,954,954,954,954,954,954,954,
-/* block 240 */
- 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,923,923,923,
+/* block 246 */
+ 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,954,954,954,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,923,923,923,923,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21,954,954,954,
21, 21, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21,
-/* block 241 */
+/* block 247 */
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 20,
20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,923,923,923,
-923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
-923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
-923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
-923,923,923,923,923,923,924,924,924,924,924,924,924,924,924,924,
-924,924,924,924,924,924,924,924,924,924,924,924,924,924,924,924,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,954,954,954,
+954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,
+954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,
+954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,
+954,954,954,954,954,954,955,955,955,955,955,955,955,955,955,955,
+955,955,955,955,955,955,955,955,955,955,955,955,955,955,955,955,
-/* block 242 */
-925, 21, 21,923,923,923,923,923,923,923,923,923,923,923,923,923,
+/* block 248 */
+956, 21, 21,954,954,954,954,954,954,954,954,954,954,954,954,954,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21,
- 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20,923,923,923,923,
- 20, 20, 20, 20, 20, 20, 20, 20, 20,923,923,923,923,923,923,923,
-575,575,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
- 21, 21, 21, 21, 21, 21,923,923,923,923,923,923,923,923,923,923,
-923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
+ 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20,954,954,954,954,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20,954,954,954,954,954,954,954,
+584,584,954,954,954,954,954,954,954,954,954,954,954,954,954,954,
+ 21, 21, 21, 21, 21, 21,954,954,954,954,954,954,954,954,954,954,
+954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,
-/* block 243 */
-923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
-923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
-923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
-923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
-923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
-923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
-923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
-923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
+/* block 249 */
+954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,
+954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,
+954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,
+954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,
+954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,
+954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,
+954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,
+954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,
-/* block 244 */
+/* block 250 */
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
@@ -4114,7 +4209,7 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 68608 bytes, block = 128 */
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
-/* block 245 */
+/* block 251 */
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
@@ -4122,9 +4217,9 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 68608 bytes, block = 128 */
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
- 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,926,926,926,926,926,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,957,957,957,957,957,
-/* block 246 */
+/* block 252 */
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
@@ -4134,7 +4229,7 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 68608 bytes, block = 128 */
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
-/* block 247 */
+/* block 253 */
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
@@ -4144,17 +4239,17 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 68608 bytes, block = 128 */
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
-/* block 248 */
+/* block 254 */
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
- 21, 21, 21, 21, 21,923,923,923,923,923,923,923,923,923,923,923,
- 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,923,923,923,
- 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,923,923,923,923,923,923,
+ 21, 21, 21, 21, 21, 21,954,954,954,954,954,954,954,954,954,954,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,954,954,954,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,954,954,954,954,954,
-/* block 249 */
+/* block 255 */
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
@@ -4162,187 +4257,197 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 68608 bytes, block = 128 */
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20,923,923,923,923,923,923,923,923,923,923,923,923,
+ 20, 20, 20, 20,954,954,954,954,954,954,954,954,954,954,954,954,
-/* block 250 */
+/* block 256 */
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 21, 21, 21, 21,923,923,923,923,923,923,923,
-923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
-923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
+ 20, 20, 20, 20, 20, 21, 21, 21, 21,954,954,954,954,954,954,954,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,954,954,954,954,
+954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,
-/* block 251 */
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,923,923,923,923,
+/* block 257 */
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,954,954,954,954,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20,923,923,923,923,923,923,923,923,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,923,923,923,923,923,923,
+ 20, 20, 20, 20, 20, 20, 20, 20,954,954,954,954,954,954,954,954,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,954,954,954,954,954,954,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
-/* block 252 */
- 20, 20, 20, 20, 20, 20, 20, 20,923,923,923,923,923,923,923,923,
+/* block 258 */
+ 20, 20, 20, 20, 20, 20, 20, 20,954,954,954,954,954,954,954,954,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,923,923,
-923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
-923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
-923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
-923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
-923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,954,954,
+954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,
+954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,
+954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,
+954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,
+954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,
-/* block 253 */
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,923,923,923,923,
+/* block 259 */
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,954, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
- 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21,923,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
- 21,923,923, 21, 21, 21, 21,923,923,923, 21,923, 21, 21, 21, 21,
+ 21, 21,954, 21, 21, 21, 21,954,954,954, 21, 21, 21, 21, 21, 21,
-/* block 254 */
+/* block 260 */
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
- 21, 21, 21,923,923,923,923,923,923,923,923,923,923,923,923,923,
- 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,923,923,923,923,923,923,
- 21, 21, 21,923,923,923,923,923,923,923,923,923,923,923,923,923,
+ 21, 21, 21,954,954, 21, 21, 21, 21, 21, 21,954,954,954, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,954,954, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
-
-/* block 255 */
-923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
-923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
-923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
-923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
-923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
-923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
- 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,923,923,
-923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
-
-/* block 256 */
-923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
-923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
-923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
-923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
-923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
-923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
-923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,
-923,923,923,923,923,923,923,923,923,923,923,923,923,923,119,119,
-
-/* block 257 */
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-
-/* block 258 */
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,119,119,119,119,119,119,119,119,119,119,119,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-
-/* block 259 */
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,119,119,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-
-/* block 260 */
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
/* block 261 */
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21,954,954,954,954,954,954,954,954,954,954,954,954,
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,954,954,
+ 21, 21, 21, 21,954,954,954,954, 21, 21, 21,954,954,954,954,954,
/* block 262 */
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
-577,577,577,577,577,577,577,577,577,577,577,577,577,577,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
-119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,
+ 21, 21, 21,954,954,954,954,954,954,954,954,954,954,954,954,954,
+ 21, 21, 21, 21, 21, 21,954,954,954,954,954,954,954,954,954,954,
+954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,
+954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,
+954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,
+954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,
+954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,
+954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,
/* block 263 */
-502, 24,502,502,502,502,502,502,502,502,502,502,502,502,502,502,
-502,502,502,502,502,502,502,502,502,502,502,502,502,502,502,502,
-927,927,927,927,927,927,927,927,927,927,927,927,927,927,927,927,
-927,927,927,927,927,927,927,927,927,927,927,927,927,927,927,927,
-927,927,927,927,927,927,927,927,927,927,927,927,927,927,927,927,
-927,927,927,927,927,927,927,927,927,927,927,927,927,927,927,927,
-927,927,927,927,927,927,927,927,927,927,927,927,927,927,927,927,
-927,927,927,927,927,927,927,927,927,927,927,927,927,927,927,927,
+954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,
+954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,
+954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,
+954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,
+954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,
+954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,
+954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,
+954,954,954,954,954,954,954,954,954,954,954,954,954,954,120,120,
/* block 264 */
-502,502,502,502,502,502,502,502,502,502,502,502,502,502,502,502,
-502,502,502,502,502,502,502,502,502,502,502,502,502,502,502,502,
-502,502,502,502,502,502,502,502,502,502,502,502,502,502,502,502,
-502,502,502,502,502,502,502,502,502,502,502,502,502,502,502,502,
-502,502,502,502,502,502,502,502,502,502,502,502,502,502,502,502,
-502,502,502,502,502,502,502,502,502,502,502,502,502,502,502,502,
-502,502,502,502,502,502,502,502,502,502,502,502,502,502,502,502,
-502,502,502,502,502,502,502,502,502,502,502,502,502,502,502,502,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
/* block 265 */
-112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,
-112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,
-112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,
-112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,
-112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,
-112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,
-112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,
-112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,120,120,120,120,120,120,120,120,120,120,120,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
/* block 266 */
-112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,
-112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,
-112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,
-112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,
-112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,
-112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,
-112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,
-502,502,502,502,502,502,502,502,502,502,502,502,502,502,502,502,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,120,120,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
/* block 267 */
-659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,
-659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,
-659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,
-659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,
-659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,
-659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,
-659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,
-659,659,659,659,659,659,659,659,659,659,659,659,659,659,119,119,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+
+/* block 268 */
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+
+/* block 269 */
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,
+
+/* block 270 */
+511, 24,511,511,511,511,511,511,511,511,511,511,511,511,511,511,
+511,511,511,511,511,511,511,511,511,511,511,511,511,511,511,511,
+958,958,958,958,958,958,958,958,958,958,958,958,958,958,958,958,
+958,958,958,958,958,958,958,958,958,958,958,958,958,958,958,958,
+958,958,958,958,958,958,958,958,958,958,958,958,958,958,958,958,
+958,958,958,958,958,958,958,958,958,958,958,958,958,958,958,958,
+958,958,958,958,958,958,958,958,958,958,958,958,958,958,958,958,
+958,958,958,958,958,958,958,958,958,958,958,958,958,958,958,958,
+
+/* block 271 */
+511,511,511,511,511,511,511,511,511,511,511,511,511,511,511,511,
+511,511,511,511,511,511,511,511,511,511,511,511,511,511,511,511,
+511,511,511,511,511,511,511,511,511,511,511,511,511,511,511,511,
+511,511,511,511,511,511,511,511,511,511,511,511,511,511,511,511,
+511,511,511,511,511,511,511,511,511,511,511,511,511,511,511,511,
+511,511,511,511,511,511,511,511,511,511,511,511,511,511,511,511,
+511,511,511,511,511,511,511,511,511,511,511,511,511,511,511,511,
+511,511,511,511,511,511,511,511,511,511,511,511,511,511,511,511,
+
+/* block 272 */
+113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,
+113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,
+113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,
+113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,
+113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,
+113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,
+113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,
+113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,
+
+/* block 273 */
+113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,
+113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,
+113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,
+113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,
+113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,
+113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,
+113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,
+511,511,511,511,511,511,511,511,511,511,511,511,511,511,511,511,
+
+/* block 274 */
+672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,
+672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,
+672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,
+672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,
+672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,
+672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,
+672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,
+672,672,672,672,672,672,672,672,672,672,672,672,672,672,120,120,
};
diff --git a/ext/pcre/pcre2lib/pcre2_ucp.h b/ext/pcre/pcre2lib/pcre2_ucp.h
index 483abd18fc..84b22fb064 100644
--- a/ext/pcre/pcre2lib/pcre2_ucp.h
+++ b/ext/pcre/pcre2lib/pcre2_ucp.h
@@ -281,7 +281,12 @@ enum {
ucp_Makasar,
ucp_Medefaidrin,
ucp_Old_Sogdian,
- ucp_Sogdian
+ ucp_Sogdian,
+ /* New for Unicode 12.0.0 */
+ ucp_Elymaic,
+ ucp_Nandinagari,
+ ucp_Nyiakeng_Puachue_Hmong,
+ ucp_Wancho
};
#endif /* PCRE2_UCP_H_IDEMPOTENT_GUARD */
diff --git a/ext/pcre/pcre2lib/sljit/sljitConfigInternal.h b/ext/pcre/pcre2lib/sljit/sljitConfigInternal.h
index ba60311e45..acba9da4be 100644
--- a/ext/pcre/pcre2lib/sljit/sljitConfigInternal.h
+++ b/ext/pcre/pcre2lib/sljit/sljitConfigInternal.h
@@ -214,6 +214,10 @@
#define SLJIT_MEMCPY(dest, src, len) memcpy(dest, src, len)
#endif
+#ifndef SLJIT_MEMMOVE
+#define SLJIT_MEMMOVE(dest, src, len) memmove(dest, src, len)
+#endif
+
#ifndef SLJIT_ZEROMEM
#define SLJIT_ZEROMEM(dest, len) memset(dest, 0, len)
#endif
diff --git a/ext/pcre/pcre2lib/sljit/sljitExecAllocator.c b/ext/pcre/pcre2lib/sljit/sljitExecAllocator.c
index caaf438578..92ddb94914 100644
--- a/ext/pcre/pcre2lib/sljit/sljitExecAllocator.c
+++ b/ext/pcre/pcre2lib/sljit/sljitExecAllocator.c
@@ -118,22 +118,19 @@ static SLJIT_INLINE int get_map_jit_flag()
if (map_jit_flag == -1) {
struct utsname name;
+ map_jit_flag = 0;
uname(&name);
/* Kernel version for 10.14.0 (Mojave) */
if (atoi(name.release) >= 18) {
- /* Only use MAP_JIT if a hardened runtime is used, because MAP_JIT is incompatible
- with fork(). */
- void *ptr = mmap(
- NULL, getpagesize(), PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
+ /* Only use MAP_JIT if a hardened runtime is used, because MAP_JIT is incompatible with fork(). */
+ void *ptr = mmap(NULL, getpagesize(), PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
+
if (ptr == MAP_FAILED) {
map_jit_flag = MAP_JIT;
} else {
- map_jit_flag = 0;
munmap(ptr, getpagesize());
}
- } else {
- map_jit_flag = 0;
}
}
@@ -150,6 +147,7 @@ static SLJIT_INLINE int get_map_jit_flag()
static SLJIT_INLINE void* alloc_chunk(sljit_uw size)
{
void *retval;
+ const int prot = PROT_READ | PROT_WRITE | PROT_EXEC;
#ifdef MAP_ANON
@@ -159,16 +157,25 @@ static SLJIT_INLINE void* alloc_chunk(sljit_uw size)
flags |= get_map_jit_flag();
#endif
- retval = mmap(NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, flags, -1, 0);
+ retval = mmap(NULL, size, prot, flags, -1, 0);
#else /* !MAP_ANON */
if (dev_zero < 0) {
if (open_dev_zero())
return NULL;
}
- retval = mmap(NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE, dev_zero, 0);
+ retval = mmap(NULL, size, prot, MAP_PRIVATE, dev_zero, 0);
#endif /* MAP_ANON */
- return (retval != MAP_FAILED) ? retval : NULL;
+ if (retval == MAP_FAILED)
+ retval = NULL;
+ else {
+ if (mprotect(retval, size, prot) < 0) {
+ munmap(retval, size);
+ retval = NULL;
+ }
+ }
+
+ return retval;
}
static SLJIT_INLINE void free_chunk(void *chunk, sljit_uw size)
diff --git a/ext/pcre/pcre2lib/sljit/sljitLir.c b/ext/pcre/pcre2lib/sljit/sljitLir.c
index ded9541b31..9bab0c3ec6 100644
--- a/ext/pcre/pcre2lib/sljit/sljitLir.c
+++ b/ext/pcre/pcre2lib/sljit/sljitLir.c
@@ -144,6 +144,7 @@
#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
# define PATCH_MD 0x10
#endif
+# define TYPE_SHIFT 13
#endif
#if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) || (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7)
@@ -521,6 +522,12 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_set_target(struct sljit_jump *jump, sljit_uw
}
}
+SLJIT_API_FUNC_ATTRIBUTE void sljit_set_put_label(struct sljit_put_label *put_label, struct sljit_label *label)
+{
+ if (SLJIT_LIKELY(!!put_label))
+ put_label->label = label;
+}
+
SLJIT_API_FUNC_ATTRIBUTE void sljit_set_current_flags(struct sljit_compiler *compiler, sljit_s32 current_flags)
{
SLJIT_UNUSED_ARG(compiler);
@@ -620,6 +627,30 @@ static SLJIT_INLINE sljit_s32 get_arg_count(sljit_s32 arg_types)
return arg_count;
}
+#if !(defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
+
+static SLJIT_INLINE sljit_uw compute_next_addr(struct sljit_label *label, struct sljit_jump *jump,
+ struct sljit_const *const_, struct sljit_put_label *put_label)
+{
+ sljit_uw result = ~(sljit_uw)0;
+
+ if (label)
+ result = label->size;
+
+ if (jump && jump->addr < result)
+ result = jump->addr;
+
+ if (const_ && const_->addr < result)
+ result = const_->addr;
+
+ if (put_label && put_label->addr < result)
+ result = put_label->addr;
+
+ return result;
+}
+
+#endif /* !SLJIT_CONFIG_X86 */
+
static SLJIT_INLINE void set_emit_enter(struct sljit_compiler *compiler,
sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds,
sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
@@ -687,6 +718,19 @@ static SLJIT_INLINE void set_const(struct sljit_const *const_, struct sljit_comp
compiler->last_const = const_;
}
+static SLJIT_INLINE void set_put_label(struct sljit_put_label *put_label, struct sljit_compiler *compiler, sljit_uw offset)
+{
+ put_label->next = NULL;
+ put_label->label = NULL;
+ put_label->addr = compiler->size - offset;
+ put_label->flags = 0;
+ if (compiler->last_put_label)
+ compiler->last_put_label->next = put_label;
+ else
+ compiler->put_labels = put_label;
+ compiler->last_put_label = put_label;
+}
+
#define ADDRESSING_DEPENDS_ON(exp, reg) \
(((exp) & SLJIT_MEM) && (((exp) & REG_MASK) == reg || OFFS_REG(exp) == reg))
@@ -1905,6 +1949,21 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_const(struct sljit_compil
CHECK_RETURN_OK;
}
+static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_put_label(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw)
+{
+#if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
+ FUNCTION_CHECK_DST(dst, dstw, 0);
+#endif
+#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
+ if (SLJIT_UNLIKELY(!!compiler->verbose)) {
+ fprintf(compiler->verbose, " put_label ");
+ sljit_verbose_param(compiler, dst, dstw);
+ fprintf(compiler->verbose, "\n");
+ }
+#endif
+ CHECK_RETURN_OK;
+}
+
#endif /* SLJIT_ARGUMENT_CHECKS || SLJIT_VERBOSE */
#define SELECT_FOP1_OPERATION_WITH_CHECKS(compiler, op, dst, dstw, src, srcw) \
@@ -2581,6 +2640,14 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compi
return NULL;
}
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_put_label* sljit_emit_put_label(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw)
+{
+ SLJIT_UNUSED_ARG(compiler);
+ SLJIT_UNUSED_ARG(dst);
+ SLJIT_UNUSED_ARG(dstw);
+ return NULL;
+}
+
SLJIT_API_FUNC_ATTRIBUTE void sljit_set_jump_addr(sljit_uw addr, sljit_uw new_target, sljit_sw executable_offset)
{
SLJIT_UNUSED_ARG(addr);
@@ -2597,4 +2664,4 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_set_const(sljit_uw addr, sljit_sw new_consta
SLJIT_UNREACHABLE();
}
-#endif
+#endif /* !SLJIT_CONFIG_UNSUPPORTED */
diff --git a/ext/pcre/pcre2lib/sljit/sljitLir.h b/ext/pcre/pcre2lib/sljit/sljitLir.h
index e71890cf7b..836d25cf71 100644
--- a/ext/pcre/pcre2lib/sljit/sljitLir.h
+++ b/ext/pcre/pcre2lib/sljit/sljitLir.h
@@ -348,13 +348,20 @@ struct sljit_label {
struct sljit_jump {
struct sljit_jump *next;
sljit_uw addr;
- sljit_sw flags;
+ sljit_uw flags;
union {
sljit_uw target;
- struct sljit_label* label;
+ struct sljit_label *label;
} u;
};
+struct sljit_put_label {
+ struct sljit_put_label *next;
+ struct sljit_label *label;
+ sljit_uw addr;
+ sljit_uw flags;
+};
+
struct sljit_const {
struct sljit_const *next;
sljit_uw addr;
@@ -366,10 +373,12 @@ struct sljit_compiler {
struct sljit_label *labels;
struct sljit_jump *jumps;
+ struct sljit_put_label *put_labels;
struct sljit_const *consts;
struct sljit_label *last_label;
struct sljit_jump *last_jump;
struct sljit_const *last_const;
+ struct sljit_put_label *last_put_label;
void *allocator_data;
struct sljit_memory_fragment *buf;
@@ -1314,10 +1323,17 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fmem(struct sljit_compiler *compil
Flags: - (may destroy flags) */
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_local_base(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw offset);
-/* The constant can be changed runtime (see: sljit_set_const)
+/* Store a value that can be changed runtime (see: sljit_get_const_addr / sljit_set_const)
Flags: - (does not modify flags) */
SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw init_value);
+/* Store the value of a label (see: sljit_set_put_label)
+ Flags: - (does not modify flags) */
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_put_label* sljit_emit_put_label(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw);
+
+/* Set the value stored by put_label to this label. */
+SLJIT_API_FUNC_ATTRIBUTE void sljit_set_put_label(struct sljit_put_label *put_label, struct sljit_label *label);
+
/* After the code generation the address for label, jump and const instructions
are computed. Since these structures are freed by sljit_free_compiler, the
addresses must be preserved by the user program elsewere. */
diff --git a/ext/pcre/pcre2lib/sljit/sljitNativeARM_32.c b/ext/pcre/pcre2lib/sljit/sljitNativeARM_32.c
index 6d61eed9a7..71f7bcdadb 100644
--- a/ext/pcre/pcre2lib/sljit/sljitNativeARM_32.c
+++ b/ext/pcre/pcre2lib/sljit/sljitNativeARM_32.c
@@ -583,8 +583,9 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
sljit_uw *buf_end;
sljit_uw size;
sljit_uw word_count;
+ sljit_uw next_addr;
sljit_sw executable_offset;
- sljit_sw jump_addr;
+ sljit_sw addr;
#if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
sljit_uw cpool_size;
sljit_uw cpool_skip_alignment;
@@ -597,6 +598,7 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
struct sljit_label *label;
struct sljit_jump *jump;
struct sljit_const *const_;
+ struct sljit_put_label *put_label;
CHECK_ERROR_PTR();
CHECK_PTR(check_sljit_generate_code(compiler));
@@ -625,11 +627,13 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
code_ptr = code;
word_count = 0;
+ next_addr = 1;
executable_offset = SLJIT_EXEC_OFFSET(code);
label = compiler->labels;
jump = compiler->jumps;
const_ = compiler->consts;
+ put_label = compiler->put_labels;
if (label && label->size == 0) {
label->addr = (sljit_uw)SLJIT_ADD_EXEC_OFFSET(code, executable_offset);
@@ -669,35 +673,45 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
else if ((*buf_ptr & 0xff000000) != PUSH_POOL) {
#endif
*code_ptr = *buf_ptr++;
+ if (next_addr == word_count) {
+ SLJIT_ASSERT(!label || label->size >= word_count);
+ SLJIT_ASSERT(!jump || jump->addr >= word_count);
+ SLJIT_ASSERT(!const_ || const_->addr >= word_count);
+ SLJIT_ASSERT(!put_label || put_label->addr >= word_count);
+
/* These structures are ordered by their address. */
- SLJIT_ASSERT(!label || label->size >= word_count);
- SLJIT_ASSERT(!jump || jump->addr >= word_count);
- SLJIT_ASSERT(!const_ || const_->addr >= word_count);
- if (jump && jump->addr == word_count) {
+ if (jump && jump->addr == word_count) {
#if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
- if (detect_jump_type(jump, code_ptr, code, executable_offset))
- code_ptr--;
- jump->addr = (sljit_uw)code_ptr;
+ if (detect_jump_type(jump, code_ptr, code, executable_offset))
+ code_ptr--;
+ jump->addr = (sljit_uw)code_ptr;
#else
- jump->addr = (sljit_uw)(code_ptr - 2);
- if (detect_jump_type(jump, code_ptr, code, executable_offset))
- code_ptr -= 2;
+ jump->addr = (sljit_uw)(code_ptr - 2);
+ if (detect_jump_type(jump, code_ptr, code, executable_offset))
+ code_ptr -= 2;
#endif
- jump = jump->next;
- }
- if (label && label->size == word_count) {
- /* code_ptr can be affected above. */
- label->addr = (sljit_uw)SLJIT_ADD_EXEC_OFFSET(code_ptr + 1, executable_offset);
- label->size = (code_ptr + 1) - code;
- label = label->next;
- }
- if (const_ && const_->addr == word_count) {
+ jump = jump->next;
+ }
+ if (label && label->size == word_count) {
+ /* code_ptr can be affected above. */
+ label->addr = (sljit_uw)SLJIT_ADD_EXEC_OFFSET(code_ptr + 1, executable_offset);
+ label->size = (code_ptr + 1) - code;
+ label = label->next;
+ }
+ if (const_ && const_->addr == word_count) {
#if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
- const_->addr = (sljit_uw)code_ptr;
+ const_->addr = (sljit_uw)code_ptr;
#else
- const_->addr = (sljit_uw)(code_ptr - 1);
+ const_->addr = (sljit_uw)(code_ptr - 1);
#endif
- const_ = const_->next;
+ const_ = const_->next;
+ }
+ if (put_label && put_label->addr == word_count) {
+ SLJIT_ASSERT(put_label->label);
+ put_label->addr = (sljit_uw)code_ptr;
+ put_label = put_label->next;
+ }
+ next_addr = compute_next_addr(label, jump, const_, put_label);
}
code_ptr++;
#if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
@@ -725,6 +739,7 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
SLJIT_ASSERT(!label);
SLJIT_ASSERT(!jump);
SLJIT_ASSERT(!const_);
+ SLJIT_ASSERT(!put_label);
#if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
SLJIT_ASSERT(cpool_size == 0);
@@ -755,15 +770,15 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
buf_ptr = (sljit_uw *)jump->addr;
if (jump->flags & PATCH_B) {
- jump_addr = (sljit_sw)SLJIT_ADD_EXEC_OFFSET(buf_ptr + 2, executable_offset);
+ addr = (sljit_sw)SLJIT_ADD_EXEC_OFFSET(buf_ptr + 2, executable_offset);
if (!(jump->flags & JUMP_ADDR)) {
SLJIT_ASSERT(jump->flags & JUMP_LABEL);
- SLJIT_ASSERT(((sljit_sw)jump->u.label->addr - jump_addr) <= 0x01ffffff && ((sljit_sw)jump->u.label->addr - jump_addr) >= -0x02000000);
- *buf_ptr |= (((sljit_sw)jump->u.label->addr - jump_addr) >> 2) & 0x00ffffff;
+ SLJIT_ASSERT(((sljit_sw)jump->u.label->addr - addr) <= 0x01ffffff && ((sljit_sw)jump->u.label->addr - addr) >= -0x02000000);
+ *buf_ptr |= (((sljit_sw)jump->u.label->addr - addr) >> 2) & 0x00ffffff;
}
else {
- SLJIT_ASSERT(((sljit_sw)jump->u.target - jump_addr) <= 0x01ffffff && ((sljit_sw)jump->u.target - jump_addr) >= -0x02000000);
- *buf_ptr |= (((sljit_sw)jump->u.target - jump_addr) >> 2) & 0x00ffffff;
+ SLJIT_ASSERT(((sljit_sw)jump->u.target - addr) <= 0x01ffffff && ((sljit_sw)jump->u.target - addr) >= -0x02000000);
+ *buf_ptr |= (((sljit_sw)jump->u.target - addr) >> 2) & 0x00ffffff;
}
}
else if (jump->flags & SLJIT_REWRITABLE_JUMP) {
@@ -813,6 +828,22 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
}
#endif
+ put_label = compiler->put_labels;
+ while (put_label) {
+ addr = put_label->label->addr;
+ buf_ptr = (sljit_uw*)put_label->addr;
+
+#if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
+ SLJIT_ASSERT((buf_ptr[0] & 0xffff0000) == 0xe59f0000);
+ buf_ptr[((buf_ptr[0] & 0xfff) >> 2) + 2] = addr;
+#else
+ SLJIT_ASSERT((buf_ptr[-1] & 0xfff00000) == MOVW && (buf_ptr[0] & 0xfff00000) == MOVT);
+ buf_ptr[-1] |= ((addr << 4) & 0xf0000) | (addr & 0xfff);
+ buf_ptr[0] |= ((addr >> 12) & 0xf0000) | ((addr >> 16) & 0xfff);
+#endif
+ put_label = put_label->next;
+ }
+
SLJIT_ASSERT(code_ptr - code <= (sljit_s32)size);
compiler->error = SLJIT_ERR_COMPILED;
@@ -2639,28 +2670,55 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_mem(struct sljit_compiler *compile
SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw init_value)
{
struct sljit_const *const_;
- sljit_s32 reg;
+ sljit_s32 dst_r;
CHECK_ERROR_PTR();
CHECK_PTR(check_sljit_emit_const(compiler, dst, dstw, init_value));
ADJUST_LOCAL_OFFSET(dst, dstw);
+ dst_r = SLOW_IS_REG(dst) ? dst : TMP_REG2;
+
+#if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
+ PTR_FAIL_IF(push_inst_with_unique_literal(compiler, EMIT_DATA_TRANSFER(WORD_SIZE | LOAD_DATA, 1, dst_r, TMP_PC, 0), init_value));
+ compiler->patches++;
+#else
+ PTR_FAIL_IF(emit_imm(compiler, dst_r, init_value));
+#endif
+
const_ = (struct sljit_const*)ensure_abuf(compiler, sizeof(struct sljit_const));
PTR_FAIL_IF(!const_);
+ set_const(const_, compiler);
- reg = SLOW_IS_REG(dst) ? dst : TMP_REG2;
+ if (dst & SLJIT_MEM)
+ PTR_FAIL_IF(emit_op_mem(compiler, WORD_SIZE, TMP_REG2, dst, dstw, TMP_REG1));
+ return const_;
+}
+
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_put_label* sljit_emit_put_label(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw)
+{
+ struct sljit_put_label *put_label;
+ sljit_s32 dst_r;
+
+ CHECK_ERROR_PTR();
+ CHECK_PTR(check_sljit_emit_put_label(compiler, dst, dstw));
+ ADJUST_LOCAL_OFFSET(dst, dstw);
+
+ dst_r = SLOW_IS_REG(dst) ? dst : TMP_REG2;
#if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
- PTR_FAIL_IF(push_inst_with_unique_literal(compiler, EMIT_DATA_TRANSFER(WORD_SIZE | LOAD_DATA, 1, reg, TMP_PC, 0), init_value));
+ PTR_FAIL_IF(push_inst_with_unique_literal(compiler, EMIT_DATA_TRANSFER(WORD_SIZE | LOAD_DATA, 1, dst_r, TMP_PC, 0), 0));
compiler->patches++;
#else
- PTR_FAIL_IF(emit_imm(compiler, reg, init_value));
+ PTR_FAIL_IF(emit_imm(compiler, dst_r, 0));
#endif
- set_const(const_, compiler);
+
+ put_label = (struct sljit_put_label*)ensure_abuf(compiler, sizeof(struct sljit_put_label));
+ PTR_FAIL_IF(!put_label);
+ set_put_label(put_label, compiler, 0);
if (dst & SLJIT_MEM)
PTR_FAIL_IF(emit_op_mem(compiler, WORD_SIZE, TMP_REG2, dst, dstw, TMP_REG1));
- return const_;
+ return put_label;
}
SLJIT_API_FUNC_ATTRIBUTE void sljit_set_jump_addr(sljit_uw addr, sljit_uw new_target, sljit_sw executable_offset)
diff --git a/ext/pcre/pcre2lib/sljit/sljitNativeARM_64.c b/ext/pcre/pcre2lib/sljit/sljitNativeARM_64.c
index b015695c52..e15b3451e8 100644
--- a/ext/pcre/pcre2lib/sljit/sljitNativeARM_64.c
+++ b/ext/pcre/pcre2lib/sljit/sljitNativeARM_64.c
@@ -161,7 +161,7 @@ static SLJIT_INLINE void modify_imm64_const(sljit_ins* inst, sljit_uw new_imm)
inst[3] = MOVK | dst | ((new_imm >> 48) << 5) | (3 << 21);
}
-static SLJIT_INLINE sljit_s32 detect_jump_type(struct sljit_jump *jump, sljit_ins *code_ptr, sljit_ins *code, sljit_sw executable_offset)
+static SLJIT_INLINE sljit_sw detect_jump_type(struct sljit_jump *jump, sljit_ins *code_ptr, sljit_ins *code, sljit_sw executable_offset)
{
sljit_sw diff;
sljit_uw target_addr;
@@ -196,14 +196,14 @@ static SLJIT_INLINE sljit_s32 detect_jump_type(struct sljit_jump *jump, sljit_in
return 4;
}
- if (target_addr <= 0xffffffffl) {
+ if (target_addr < 0x100000000l) {
if (jump->flags & IS_COND)
code_ptr[-5] -= (2 << 5);
code_ptr[-2] = code_ptr[0];
return 2;
}
- if (target_addr <= 0xffffffffffffl) {
+ if (target_addr < 0x1000000000000l) {
if (jump->flags & IS_COND)
code_ptr[-5] -= (1 << 5);
jump->flags |= PATCH_ABS48;
@@ -215,6 +215,22 @@ static SLJIT_INLINE sljit_s32 detect_jump_type(struct sljit_jump *jump, sljit_in
return 0;
}
+static SLJIT_INLINE sljit_sw put_label_get_length(struct sljit_put_label *put_label, sljit_uw max_label)
+{
+ if (max_label < 0x100000000l) {
+ put_label->flags = 0;
+ return 2;
+ }
+
+ if (max_label < 0x1000000000000l) {
+ put_label->flags = 1;
+ return 1;
+ }
+
+ put_label->flags = 2;
+ return 0;
+}
+
SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compiler)
{
struct sljit_memory_fragment *buf;
@@ -223,6 +239,7 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
sljit_ins *buf_ptr;
sljit_ins *buf_end;
sljit_uw word_count;
+ sljit_uw next_addr;
sljit_sw executable_offset;
sljit_uw addr;
sljit_s32 dst;
@@ -230,6 +247,7 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
struct sljit_label *label;
struct sljit_jump *jump;
struct sljit_const *const_;
+ struct sljit_put_label *put_label;
CHECK_ERROR_PTR();
CHECK_PTR(check_sljit_generate_code(compiler));
@@ -241,34 +259,47 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
code_ptr = code;
word_count = 0;
+ next_addr = 0;
executable_offset = SLJIT_EXEC_OFFSET(code);
label = compiler->labels;
jump = compiler->jumps;
const_ = compiler->consts;
+ put_label = compiler->put_labels;
do {
buf_ptr = (sljit_ins*)buf->memory;
buf_end = buf_ptr + (buf->used_size >> 2);
do {
*code_ptr = *buf_ptr++;
- /* These structures are ordered by their address. */
- SLJIT_ASSERT(!label || label->size >= word_count);
- SLJIT_ASSERT(!jump || jump->addr >= word_count);
- SLJIT_ASSERT(!const_ || const_->addr >= word_count);
- if (label && label->size == word_count) {
- label->addr = (sljit_uw)SLJIT_ADD_EXEC_OFFSET(code_ptr, executable_offset);
- label->size = code_ptr - code;
- label = label->next;
- }
- if (jump && jump->addr == word_count) {
- jump->addr = (sljit_uw)(code_ptr - 4);
- code_ptr -= detect_jump_type(jump, code_ptr, code, executable_offset);
- jump = jump->next;
- }
- if (const_ && const_->addr == word_count) {
- const_->addr = (sljit_uw)code_ptr;
- const_ = const_->next;
+ if (next_addr == word_count) {
+ SLJIT_ASSERT(!label || label->size >= word_count);
+ SLJIT_ASSERT(!jump || jump->addr >= word_count);
+ SLJIT_ASSERT(!const_ || const_->addr >= word_count);
+ SLJIT_ASSERT(!put_label || put_label->addr >= word_count);
+
+ /* These structures are ordered by their address. */
+ if (label && label->size == word_count) {
+ label->addr = (sljit_uw)SLJIT_ADD_EXEC_OFFSET(code_ptr, executable_offset);
+ label->size = code_ptr - code;
+ label = label->next;
+ }
+ if (jump && jump->addr == word_count) {
+ jump->addr = (sljit_uw)(code_ptr - 4);
+ code_ptr -= detect_jump_type(jump, code_ptr, code, executable_offset);
+ jump = jump->next;
+ }
+ if (const_ && const_->addr == word_count) {
+ const_->addr = (sljit_uw)code_ptr;
+ const_ = const_->next;
+ }
+ if (put_label && put_label->addr == word_count) {
+ SLJIT_ASSERT(put_label->label);
+ put_label->addr = (sljit_uw)(code_ptr - 3);
+ code_ptr -= put_label_get_length(put_label, (sljit_uw)(SLJIT_ADD_EXEC_OFFSET(code, executable_offset) + put_label->label->size));
+ put_label = put_label->next;
+ }
+ next_addr = compute_next_addr(label, jump, const_, put_label);
}
code_ptr ++;
word_count ++;
@@ -286,6 +317,7 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
SLJIT_ASSERT(!label);
SLJIT_ASSERT(!jump);
SLJIT_ASSERT(!const_);
+ SLJIT_ASSERT(!put_label);
SLJIT_ASSERT(code_ptr - code <= (sljit_sw)compiler->size);
jump = compiler->jumps;
@@ -323,6 +355,23 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
jump = jump->next;
}
+ put_label = compiler->put_labels;
+ while (put_label) {
+ addr = put_label->label->addr;
+ buf_ptr = (sljit_ins *)put_label->addr;
+
+ buf_ptr[0] |= (addr & 0xffff) << 5;
+ buf_ptr[1] |= ((addr >> 16) & 0xffff) << 5;
+
+ if (put_label->flags >= 1)
+ buf_ptr[2] |= ((addr >> 32) & 0xffff) << 5;
+
+ if (put_label->flags >= 2)
+ buf_ptr[3] |= ((addr >> 48) & 0xffff) << 5;
+
+ put_label = put_label->next;
+ }
+
compiler->error = SLJIT_ERR_COMPILED;
compiler->executable_offset = executable_offset;
compiler->executable_size = (code_ptr - code) * sizeof(sljit_ins);
@@ -1947,6 +1996,28 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compi
return const_;
}
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_put_label* sljit_emit_put_label(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw)
+{
+ struct sljit_put_label *put_label;
+ sljit_s32 dst_r;
+
+ CHECK_ERROR_PTR();
+ CHECK_PTR(check_sljit_emit_put_label(compiler, dst, dstw));
+ ADJUST_LOCAL_OFFSET(dst, dstw);
+
+ dst_r = FAST_IS_REG(dst) ? dst : TMP_REG1;
+ PTR_FAIL_IF(emit_imm64_const(compiler, dst_r, 0));
+
+ put_label = (struct sljit_put_label*)ensure_abuf(compiler, sizeof(struct sljit_put_label));
+ PTR_FAIL_IF(!put_label);
+ set_put_label(put_label, compiler, 1);
+
+ if (dst & SLJIT_MEM)
+ PTR_FAIL_IF(emit_op_mem(compiler, WORD_SIZE | STORE, dst_r, dst, dstw, TMP_REG2));
+
+ return put_label;
+}
+
SLJIT_API_FUNC_ATTRIBUTE void sljit_set_jump_addr(sljit_uw addr, sljit_uw new_target, sljit_sw executable_offset)
{
sljit_ins* inst = (sljit_ins*)addr;
diff --git a/ext/pcre/pcre2lib/sljit/sljitNativeARM_T2_32.c b/ext/pcre/pcre2lib/sljit/sljitNativeARM_T2_32.c
index d7024b6d7d..cdfe4a4d24 100644
--- a/ext/pcre/pcre2lib/sljit/sljitNativeARM_T2_32.c
+++ b/ext/pcre/pcre2lib/sljit/sljitNativeARM_T2_32.c
@@ -365,11 +365,13 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
sljit_u16 *buf_ptr;
sljit_u16 *buf_end;
sljit_uw half_count;
+ sljit_uw next_addr;
sljit_sw executable_offset;
struct sljit_label *label;
struct sljit_jump *jump;
struct sljit_const *const_;
+ struct sljit_put_label *put_label;
CHECK_ERROR_PTR();
CHECK_PTR(check_sljit_generate_code(compiler));
@@ -381,34 +383,46 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
code_ptr = code;
half_count = 0;
+ next_addr = 0;
executable_offset = SLJIT_EXEC_OFFSET(code);
label = compiler->labels;
jump = compiler->jumps;
const_ = compiler->consts;
+ put_label = compiler->put_labels;
do {
buf_ptr = (sljit_u16*)buf->memory;
buf_end = buf_ptr + (buf->used_size >> 1);
do {
*code_ptr = *buf_ptr++;
- /* These structures are ordered by their address. */
- SLJIT_ASSERT(!label || label->size >= half_count);
- SLJIT_ASSERT(!jump || jump->addr >= half_count);
- SLJIT_ASSERT(!const_ || const_->addr >= half_count);
- if (label && label->size == half_count) {
- label->addr = ((sljit_uw)SLJIT_ADD_EXEC_OFFSET(code_ptr, executable_offset)) | 0x1;
- label->size = code_ptr - code;
- label = label->next;
- }
- if (jump && jump->addr == half_count) {
- jump->addr = (sljit_uw)code_ptr - ((jump->flags & IS_COND) ? 10 : 8);
- code_ptr -= detect_jump_type(jump, code_ptr, code, executable_offset);
- jump = jump->next;
- }
- if (const_ && const_->addr == half_count) {
- const_->addr = (sljit_uw)code_ptr;
- const_ = const_->next;
+ if (next_addr == half_count) {
+ SLJIT_ASSERT(!label || label->size >= half_count);
+ SLJIT_ASSERT(!jump || jump->addr >= half_count);
+ SLJIT_ASSERT(!const_ || const_->addr >= half_count);
+ SLJIT_ASSERT(!put_label || put_label->addr >= half_count);
+
+ /* These structures are ordered by their address. */
+ if (label && label->size == half_count) {
+ label->addr = ((sljit_uw)SLJIT_ADD_EXEC_OFFSET(code_ptr, executable_offset)) | 0x1;
+ label->size = code_ptr - code;
+ label = label->next;
+ }
+ if (jump && jump->addr == half_count) {
+ jump->addr = (sljit_uw)code_ptr - ((jump->flags & IS_COND) ? 10 : 8);
+ code_ptr -= detect_jump_type(jump, code_ptr, code, executable_offset);
+ jump = jump->next;
+ }
+ if (const_ && const_->addr == half_count) {
+ const_->addr = (sljit_uw)code_ptr;
+ const_ = const_->next;
+ }
+ if (put_label && put_label->addr == half_count) {
+ SLJIT_ASSERT(put_label->label);
+ put_label->addr = (sljit_uw)code_ptr;
+ put_label = put_label->next;
+ }
+ next_addr = compute_next_addr(label, jump, const_, put_label);
}
code_ptr ++;
half_count ++;
@@ -426,6 +440,7 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
SLJIT_ASSERT(!label);
SLJIT_ASSERT(!jump);
SLJIT_ASSERT(!const_);
+ SLJIT_ASSERT(!put_label);
SLJIT_ASSERT(code_ptr - code <= (sljit_sw)compiler->size);
jump = compiler->jumps;
@@ -434,6 +449,12 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
jump = jump->next;
}
+ put_label = compiler->put_labels;
+ while (put_label) {
+ modify_imm32_const((sljit_u16 *)put_label->addr, put_label->label->addr);
+ put_label = put_label->next;
+ }
+
compiler->error = SLJIT_ERR_COMPILED;
compiler->executable_offset = executable_offset;
compiler->executable_size = (code_ptr - code) * sizeof(sljit_u16);
@@ -2311,6 +2332,27 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compi
return const_;
}
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_put_label* sljit_emit_put_label(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw)
+{
+ struct sljit_put_label *put_label;
+ sljit_s32 dst_r;
+
+ CHECK_ERROR_PTR();
+ CHECK_PTR(check_sljit_emit_put_label(compiler, dst, dstw));
+ ADJUST_LOCAL_OFFSET(dst, dstw);
+
+ put_label = (struct sljit_put_label*)ensure_abuf(compiler, sizeof(struct sljit_put_label));
+ PTR_FAIL_IF(!put_label);
+ set_put_label(put_label, compiler, 0);
+
+ dst_r = FAST_IS_REG(dst) ? dst : TMP_REG1;
+ PTR_FAIL_IF(emit_imm32_const(compiler, dst_r, 0));
+
+ if (dst & SLJIT_MEM)
+ PTR_FAIL_IF(emit_op_mem(compiler, WORD_SIZE | STORE, dst_r, dst, dstw, TMP_REG2));
+ return put_label;
+}
+
SLJIT_API_FUNC_ATTRIBUTE void sljit_set_jump_addr(sljit_uw addr, sljit_uw new_target, sljit_sw executable_offset)
{
sljit_u16 *inst = (sljit_u16*)addr;
diff --git a/ext/pcre/pcre2lib/sljit/sljitNativeMIPS_32.c b/ext/pcre/pcre2lib/sljit/sljitNativeMIPS_32.c
index ad970bf25a..16dec052fe 100644
--- a/ext/pcre/pcre2lib/sljit/sljitNativeMIPS_32.c
+++ b/ext/pcre/pcre2lib/sljit/sljitNativeMIPS_32.c
@@ -425,6 +425,7 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_set_jump_addr(sljit_uw addr, sljit_uw new_ta
{
sljit_ins *inst = (sljit_ins *)addr;
+ SLJIT_ASSERT((inst[0] & 0xffe00000) == LUI && (inst[1] & 0xfc000000) == ORI);
inst[0] = (inst[0] & 0xffff0000) | ((new_target >> 16) & 0xffff);
inst[1] = (inst[1] & 0xffff0000) | (new_target & 0xffff);
inst = (sljit_ins *)SLJIT_ADD_EXEC_OFFSET(inst, executable_offset);
@@ -435,6 +436,7 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_set_const(sljit_uw addr, sljit_sw new_consta
{
sljit_ins *inst = (sljit_ins *)addr;
+ SLJIT_ASSERT((inst[0] & 0xffe00000) == LUI && (inst[1] & 0xfc000000) == ORI);
inst[0] = (inst[0] & 0xffff0000) | ((new_constant >> 16) & 0xffff);
inst[1] = (inst[1] & 0xffff0000) | (new_constant & 0xffff);
inst = (sljit_ins *)SLJIT_ADD_EXEC_OFFSET(inst, executable_offset);
diff --git a/ext/pcre/pcre2lib/sljit/sljitNativeMIPS_common.c b/ext/pcre/pcre2lib/sljit/sljitNativeMIPS_common.c
index e0d6a3f085..7d1d087496 100644
--- a/ext/pcre/pcre2lib/sljit/sljitNativeMIPS_common.c
+++ b/ext/pcre/pcre2lib/sljit/sljitNativeMIPS_common.c
@@ -449,6 +449,55 @@ static __attribute__ ((noinline)) void sljit_cache_flush(void* code, void* code_
}
#endif
+#if (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64)
+
+static SLJIT_INLINE sljit_sw put_label_get_length(struct sljit_put_label *put_label, sljit_uw max_label)
+{
+ if (max_label < 0x80000000l) {
+ put_label->flags = 0;
+ return 1;
+ }
+
+ if (max_label < 0x800000000000l) {
+ put_label->flags = 1;
+ return 3;
+ }
+
+ put_label->flags = 2;
+ return 5;
+}
+
+static SLJIT_INLINE void put_label_set(struct sljit_put_label *put_label)
+{
+ sljit_uw addr = put_label->label->addr;
+ sljit_ins *inst = (sljit_ins *)put_label->addr;
+ sljit_s32 reg = *inst;
+
+ if (put_label->flags == 0) {
+ SLJIT_ASSERT(addr < 0x80000000l);
+ inst[0] = LUI | T(reg) | IMM(addr >> 16);
+ }
+ else if (put_label->flags == 1) {
+ SLJIT_ASSERT(addr < 0x800000000000l);
+ inst[0] = LUI | T(reg) | IMM(addr >> 32);
+ inst[1] = ORI | S(reg) | T(reg) | IMM((addr >> 16) & 0xffff);
+ inst[2] = DSLL | T(reg) | D(reg) | SH_IMM(16);
+ inst += 2;
+ }
+ else {
+ inst[0] = LUI | T(reg) | IMM(addr >> 48);
+ inst[1] = ORI | S(reg) | T(reg) | IMM((addr >> 32) & 0xffff);
+ inst[2] = DSLL | T(reg) | D(reg) | SH_IMM(16);
+ inst[3] = ORI | S(reg) | T(reg) | IMM((addr >> 16) & 0xffff);
+ inst[4] = DSLL | T(reg) | D(reg) | SH_IMM(16);
+ inst += 4;
+ }
+
+ inst[1] = ORI | S(reg) | T(reg) | IMM(addr & 0xffff);
+}
+
+#endif
+
SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compiler)
{
struct sljit_memory_fragment *buf;
@@ -457,12 +506,14 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
sljit_ins *buf_ptr;
sljit_ins *buf_end;
sljit_uw word_count;
+ sljit_uw next_addr;
sljit_sw executable_offset;
sljit_uw addr;
struct sljit_label *label;
struct sljit_jump *jump;
struct sljit_const *const_;
+ struct sljit_put_label *put_label;
CHECK_ERROR_PTR();
CHECK_PTR(check_sljit_generate_code(compiler));
@@ -474,39 +525,54 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
code_ptr = code;
word_count = 0;
+ next_addr = 0;
executable_offset = SLJIT_EXEC_OFFSET(code);
label = compiler->labels;
jump = compiler->jumps;
const_ = compiler->consts;
+ put_label = compiler->put_labels;
do {
buf_ptr = (sljit_ins*)buf->memory;
buf_end = buf_ptr + (buf->used_size >> 2);
do {
*code_ptr = *buf_ptr++;
- SLJIT_ASSERT(!label || label->size >= word_count);
- SLJIT_ASSERT(!jump || jump->addr >= word_count);
- SLJIT_ASSERT(!const_ || const_->addr >= word_count);
- /* These structures are ordered by their address. */
- if (label && label->size == word_count) {
- label->addr = (sljit_uw)SLJIT_ADD_EXEC_OFFSET(code_ptr, executable_offset);
- label->size = code_ptr - code;
- label = label->next;
- }
- if (jump && jump->addr == word_count) {
+ if (next_addr == word_count) {
+ SLJIT_ASSERT(!label || label->size >= word_count);
+ SLJIT_ASSERT(!jump || jump->addr >= word_count);
+ SLJIT_ASSERT(!const_ || const_->addr >= word_count);
+ SLJIT_ASSERT(!put_label || put_label->addr >= word_count);
+
+ /* These structures are ordered by their address. */
+ if (label && label->size == word_count) {
+ label->addr = (sljit_uw)SLJIT_ADD_EXEC_OFFSET(code_ptr, executable_offset);
+ label->size = code_ptr - code;
+ label = label->next;
+ }
+ if (jump && jump->addr == word_count) {
#if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
- jump->addr = (sljit_uw)(code_ptr - 3);
+ jump->addr = (sljit_uw)(code_ptr - 3);
#else
- jump->addr = (sljit_uw)(code_ptr - 7);
+ jump->addr = (sljit_uw)(code_ptr - 7);
#endif
- code_ptr = detect_jump_type(jump, code_ptr, code, executable_offset);
- jump = jump->next;
- }
- if (const_ && const_->addr == word_count) {
- /* Just recording the address. */
- const_->addr = (sljit_uw)code_ptr;
- const_ = const_->next;
+ code_ptr = detect_jump_type(jump, code_ptr, code, executable_offset);
+ jump = jump->next;
+ }
+ if (const_ && const_->addr == word_count) {
+ const_->addr = (sljit_uw)code_ptr;
+ const_ = const_->next;
+ }
+ if (put_label && put_label->addr == word_count) {
+ SLJIT_ASSERT(put_label->label);
+ put_label->addr = (sljit_uw)code_ptr;
+#if (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64)
+ code_ptr += put_label_get_length(put_label, (sljit_uw)(SLJIT_ADD_EXEC_OFFSET(code, executable_offset) + put_label->label->size));
+ word_count += 5;
+#endif
+ put_label = put_label->next;
+ }
+ next_addr = compute_next_addr(label, jump, const_, put_label);
}
code_ptr ++;
word_count ++;
@@ -524,6 +590,7 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
SLJIT_ASSERT(!label);
SLJIT_ASSERT(!jump);
SLJIT_ASSERT(!const_);
+ SLJIT_ASSERT(!put_label);
SLJIT_ASSERT(code_ptr - code <= (sljit_sw)compiler->size);
jump = compiler->jumps;
@@ -571,6 +638,21 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
jump = jump->next;
}
+ put_label = compiler->put_labels;
+ while (put_label) {
+#if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
+ addr = put_label->label->addr;
+ buf_ptr = (sljit_ins *)put_label->addr;
+
+ SLJIT_ASSERT((buf_ptr[0] & 0xffe00000) == LUI && (buf_ptr[1] & 0xfc000000) == ORI);
+ buf_ptr[0] |= (addr >> 16) & 0xffff;
+ buf_ptr[1] |= addr & 0xffff;
+#else
+ put_label_set(put_label);
+#endif
+ put_label = put_label->next;
+ }
+
compiler->error = SLJIT_ERR_COMPILED;
compiler->executable_offset = executable_offset;
compiler->executable_size = (code_ptr - code) * sizeof(sljit_ins);
@@ -2157,7 +2239,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_cmov(struct sljit_compiler *compil
SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw init_value)
{
struct sljit_const *const_;
- sljit_s32 reg;
+ sljit_s32 dst_r;
CHECK_ERROR_PTR();
CHECK_PTR(check_sljit_emit_const(compiler, dst, dstw, init_value));
@@ -2167,11 +2249,38 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compi
PTR_FAIL_IF(!const_);
set_const(const_, compiler);
- reg = FAST_IS_REG(dst) ? dst : TMP_REG2;
-
- PTR_FAIL_IF(emit_const(compiler, reg, init_value));
+ dst_r = FAST_IS_REG(dst) ? dst : TMP_REG2;
+ PTR_FAIL_IF(emit_const(compiler, dst_r, init_value));
if (dst & SLJIT_MEM)
PTR_FAIL_IF(emit_op(compiler, SLJIT_MOV, WORD_DATA, dst, dstw, TMP_REG1, 0, TMP_REG2, 0));
+
return const_;
}
+
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_put_label* sljit_emit_put_label(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw)
+{
+ struct sljit_put_label *put_label;
+ sljit_s32 dst_r;
+
+ CHECK_ERROR_PTR();
+ CHECK_PTR(check_sljit_emit_put_label(compiler, dst, dstw));
+ ADJUST_LOCAL_OFFSET(dst, dstw);
+
+ put_label = (struct sljit_put_label*)ensure_abuf(compiler, sizeof(struct sljit_put_label));
+ PTR_FAIL_IF(!put_label);
+ set_put_label(put_label, compiler, 0);
+
+ dst_r = FAST_IS_REG(dst) ? dst : TMP_REG2;
+#if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
+ PTR_FAIL_IF(emit_const(compiler, dst_r, 0));
+#else
+ PTR_FAIL_IF(push_inst(compiler, dst_r, UNMOVABLE_INS));
+ compiler->size += 5;
+#endif
+
+ if (dst & SLJIT_MEM)
+ PTR_FAIL_IF(emit_op(compiler, SLJIT_MOV, WORD_DATA, dst, dstw, TMP_REG1, 0, TMP_REG2, 0));
+
+ return put_label;
+}
diff --git a/ext/pcre/pcre2lib/sljit/sljitNativePPC_32.c b/ext/pcre/pcre2lib/sljit/sljitNativePPC_32.c
index fc185f7847..3ce741153f 100644
--- a/ext/pcre/pcre2lib/sljit/sljitNativePPC_32.c
+++ b/ext/pcre/pcre2lib/sljit/sljitNativePPC_32.c
@@ -259,6 +259,7 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_set_jump_addr(sljit_uw addr, sljit_uw new_ta
{
sljit_ins *inst = (sljit_ins *)addr;
+ SLJIT_ASSERT((inst[0] & 0xfc1f0000) == ADDIS && (inst[1] & 0xfc000000) == ORI);
inst[0] = (inst[0] & 0xffff0000) | ((new_target >> 16) & 0xffff);
inst[1] = (inst[1] & 0xffff0000) | (new_target & 0xffff);
inst = (sljit_ins *)SLJIT_ADD_EXEC_OFFSET(inst, executable_offset);
@@ -269,6 +270,7 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_set_const(sljit_uw addr, sljit_sw new_consta
{
sljit_ins *inst = (sljit_ins *)addr;
+ SLJIT_ASSERT((inst[0] & 0xfc1f0000) == ADDIS && (inst[1] & 0xfc000000) == ORI);
inst[0] = (inst[0] & 0xffff0000) | ((new_constant >> 16) & 0xffff);
inst[1] = (inst[1] & 0xffff0000) | (new_constant & 0xffff);
inst = (sljit_ins *)SLJIT_ADD_EXEC_OFFSET(inst, executable_offset);
diff --git a/ext/pcre/pcre2lib/sljit/sljitNativePPC_64.c b/ext/pcre/pcre2lib/sljit/sljitNativePPC_64.c
index 706b2ba20b..3b73021cc8 100644
--- a/ext/pcre/pcre2lib/sljit/sljitNativePPC_64.c
+++ b/ext/pcre/pcre2lib/sljit/sljitNativePPC_64.c
@@ -35,9 +35,6 @@
#error "Must implement count leading zeroes"
#endif
-#define RLDI(dst, src, sh, mb, type) \
- (HI(30) | S(src) | A(dst) | ((type) << 2) | (((sh) & 0x1f) << 11) | (((sh) & 0x20) >> 4) | (((mb) & 0x1f) << 6) | ((mb) & 0x20))
-
#define PUSH_RLDICR(reg, shift) \
push_inst(compiler, RLDI(reg, reg, 63 - shift, shift, 1))
diff --git a/ext/pcre/pcre2lib/sljit/sljitNativePPC_common.c b/ext/pcre/pcre2lib/sljit/sljitNativePPC_common.c
index b34e3965ed..e827514315 100644
--- a/ext/pcre/pcre2lib/sljit/sljitNativePPC_common.c
+++ b/ext/pcre/pcre2lib/sljit/sljitNativePPC_common.c
@@ -231,6 +231,9 @@ static const sljit_u8 freg_map[SLJIT_NUMBER_OF_FLOAT_REGISTERS + 3] = {
#define SIMM_MIN (-0x8000)
#define UIMM_MAX (0xffff)
+#define RLDI(dst, src, sh, mb, type) \
+ (HI(30) | S(src) | A(dst) | ((type) << 2) | (((sh) & 0x1f) << 11) | (((sh) & 0x20) >> 4) | (((mb) & 0x1f) << 6) | ((mb) & 0x20))
+
#if (defined SLJIT_INDIRECT_CALL && SLJIT_INDIRECT_CALL)
SLJIT_API_FUNC_ATTRIBUTE void sljit_set_function_context(void** func_ptr, struct sljit_function_context* context, sljit_sw addr, void* func)
{
@@ -324,6 +327,55 @@ keep_address:
return 0;
}
+#if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
+
+static SLJIT_INLINE sljit_sw put_label_get_length(struct sljit_put_label *put_label, sljit_uw max_label)
+{
+ if (max_label < 0x100000000l) {
+ put_label->flags = 0;
+ return 1;
+ }
+
+ if (max_label < 0x1000000000000l) {
+ put_label->flags = 1;
+ return 3;
+ }
+
+ put_label->flags = 2;
+ return 4;
+}
+
+static SLJIT_INLINE void put_label_set(struct sljit_put_label *put_label)
+{
+ sljit_uw addr = put_label->label->addr;
+ sljit_ins *inst = (sljit_ins *)put_label->addr;
+ sljit_s32 reg = *inst;
+
+ if (put_label->flags == 0) {
+ SLJIT_ASSERT(addr < 0x100000000l);
+ inst[0] = ORIS | S(TMP_ZERO) | A(reg) | IMM(addr >> 16);
+ }
+ else {
+ if (put_label->flags == 1) {
+ SLJIT_ASSERT(addr < 0x1000000000000l);
+ inst[0] = ORI | S(TMP_ZERO) | A(reg) | IMM(addr >> 32);
+ }
+ else {
+ inst[0] = ORIS | S(TMP_ZERO) | A(reg) | IMM(addr >> 48);
+ inst[1] = ORI | S(reg) | A(reg) | IMM((addr >> 32) & 0xffff);
+ inst ++;
+ }
+
+ inst[1] = RLDI(reg, reg, 32, 31, 1);
+ inst[2] = ORIS | S(reg) | A(reg) | IMM((addr >> 16) & 0xffff);
+ inst += 2;
+ }
+
+ inst[1] = ORI | S(reg) | A(reg) | IMM(addr & 0xffff);
+}
+
+#endif
+
SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compiler)
{
struct sljit_memory_fragment *buf;
@@ -332,12 +384,14 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
sljit_ins *buf_ptr;
sljit_ins *buf_end;
sljit_uw word_count;
+ sljit_uw next_addr;
sljit_sw executable_offset;
sljit_uw addr;
struct sljit_label *label;
struct sljit_jump *jump;
struct sljit_const *const_;
+ struct sljit_put_label *put_label;
CHECK_ERROR_PTR();
CHECK_PTR(check_sljit_generate_code(compiler));
@@ -356,71 +410,87 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
code_ptr = code;
word_count = 0;
+ next_addr = 0;
executable_offset = SLJIT_EXEC_OFFSET(code);
label = compiler->labels;
jump = compiler->jumps;
const_ = compiler->consts;
+ put_label = compiler->put_labels;
do {
buf_ptr = (sljit_ins*)buf->memory;
buf_end = buf_ptr + (buf->used_size >> 2);
do {
*code_ptr = *buf_ptr++;
- SLJIT_ASSERT(!label || label->size >= word_count);
- SLJIT_ASSERT(!jump || jump->addr >= word_count);
- SLJIT_ASSERT(!const_ || const_->addr >= word_count);
- /* These structures are ordered by their address. */
- if (label && label->size == word_count) {
- /* Just recording the address. */
- label->addr = (sljit_uw)SLJIT_ADD_EXEC_OFFSET(code_ptr, executable_offset);
- label->size = code_ptr - code;
- label = label->next;
- }
- if (jump && jump->addr == word_count) {
+ if (next_addr == word_count) {
+ SLJIT_ASSERT(!label || label->size >= word_count);
+ SLJIT_ASSERT(!jump || jump->addr >= word_count);
+ SLJIT_ASSERT(!const_ || const_->addr >= word_count);
+ SLJIT_ASSERT(!put_label || put_label->addr >= word_count);
+
+ /* These structures are ordered by their address. */
+ if (label && label->size == word_count) {
+ /* Just recording the address. */
+ label->addr = (sljit_uw)SLJIT_ADD_EXEC_OFFSET(code_ptr, executable_offset);
+ label->size = code_ptr - code;
+ label = label->next;
+ }
+ if (jump && jump->addr == word_count) {
#if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32)
- jump->addr = (sljit_uw)(code_ptr - 3);
+ jump->addr = (sljit_uw)(code_ptr - 3);
#else
- jump->addr = (sljit_uw)(code_ptr - 6);
+ jump->addr = (sljit_uw)(code_ptr - 6);
#endif
- if (detect_jump_type(jump, code_ptr, code, executable_offset)) {
+ if (detect_jump_type(jump, code_ptr, code, executable_offset)) {
#if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32)
- code_ptr[-3] = code_ptr[0];
- code_ptr -= 3;
-#else
- if (jump->flags & PATCH_ABS32) {
+ code_ptr[-3] = code_ptr[0];
code_ptr -= 3;
- code_ptr[-1] = code_ptr[2];
- code_ptr[0] = code_ptr[3];
- }
- else if (jump->flags & PATCH_ABS48) {
- code_ptr--;
- code_ptr[-1] = code_ptr[0];
- code_ptr[0] = code_ptr[1];
- /* rldicr rX,rX,32,31 -> rX,rX,16,47 */
- SLJIT_ASSERT((code_ptr[-3] & 0xfc00ffff) == 0x780007c6);
- code_ptr[-3] ^= 0x8422;
- /* oris -> ori */
- code_ptr[-2] ^= 0x4000000;
- }
- else {
- code_ptr[-6] = code_ptr[0];
- code_ptr -= 6;
- }
+#else
+ if (jump->flags & PATCH_ABS32) {
+ code_ptr -= 3;
+ code_ptr[-1] = code_ptr[2];
+ code_ptr[0] = code_ptr[3];
+ }
+ else if (jump->flags & PATCH_ABS48) {
+ code_ptr--;
+ code_ptr[-1] = code_ptr[0];
+ code_ptr[0] = code_ptr[1];
+ /* rldicr rX,rX,32,31 -> rX,rX,16,47 */
+ SLJIT_ASSERT((code_ptr[-3] & 0xfc00ffff) == 0x780007c6);
+ code_ptr[-3] ^= 0x8422;
+ /* oris -> ori */
+ code_ptr[-2] ^= 0x4000000;
+ }
+ else {
+ code_ptr[-6] = code_ptr[0];
+ code_ptr -= 6;
+ }
#endif
- if (jump->flags & REMOVE_COND) {
- code_ptr[0] = BCx | (2 << 2) | ((code_ptr[0] ^ (8 << 21)) & 0x03ff0001);
- code_ptr++;
- jump->addr += sizeof(sljit_ins);
- code_ptr[0] = Bx;
- jump->flags -= IS_COND;
+ if (jump->flags & REMOVE_COND) {
+ code_ptr[0] = BCx | (2 << 2) | ((code_ptr[0] ^ (8 << 21)) & 0x03ff0001);
+ code_ptr++;
+ jump->addr += sizeof(sljit_ins);
+ code_ptr[0] = Bx;
+ jump->flags -= IS_COND;
+ }
}
+ jump = jump->next;
}
- jump = jump->next;
- }
- if (const_ && const_->addr == word_count) {
- const_->addr = (sljit_uw)code_ptr;
- const_ = const_->next;
+ if (const_ && const_->addr == word_count) {
+ const_->addr = (sljit_uw)code_ptr;
+ const_ = const_->next;
+ }
+ if (put_label && put_label->addr == word_count) {
+ SLJIT_ASSERT(put_label->label);
+ put_label->addr = (sljit_uw)code_ptr;
+#if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
+ code_ptr += put_label_get_length(put_label, (sljit_uw)(SLJIT_ADD_EXEC_OFFSET(code, executable_offset) + put_label->label->size));
+ word_count += 4;
+#endif
+ put_label = put_label->next;
+ }
+ next_addr = compute_next_addr(label, jump, const_, put_label);
}
code_ptr ++;
word_count ++;
@@ -438,6 +508,8 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
SLJIT_ASSERT(!label);
SLJIT_ASSERT(!jump);
SLJIT_ASSERT(!const_);
+ SLJIT_ASSERT(!put_label);
+
#if (defined SLJIT_INDIRECT_CALL && SLJIT_INDIRECT_CALL)
SLJIT_ASSERT(code_ptr - code <= (sljit_sw)compiler->size - (sizeof(struct sljit_function_context) / sizeof(sljit_ins)));
#else
@@ -503,6 +575,21 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
jump = jump->next;
}
+ put_label = compiler->put_labels;
+ while (put_label) {
+#if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32)
+ addr = put_label->label->addr;
+ buf_ptr = (sljit_ins *)put_label->addr;
+
+ SLJIT_ASSERT((buf_ptr[0] & 0xfc1f0000) == ADDIS && (buf_ptr[1] & 0xfc000000) == ORI);
+ buf_ptr[0] |= (addr >> 16) & 0xffff;
+ buf_ptr[1] |= addr & 0xffff;
+#else
+ put_label_set(put_label);
+#endif
+ put_label = put_label->next;
+ }
+
compiler->error = SLJIT_ERR_COMPILED;
compiler->executable_offset = executable_offset;
compiler->executable_size = (code_ptr - code) * sizeof(sljit_ins);
@@ -2261,7 +2348,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fmem(struct sljit_compiler *compil
SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw init_value)
{
struct sljit_const *const_;
- sljit_s32 reg;
+ sljit_s32 dst_r;
CHECK_ERROR_PTR();
CHECK_PTR(check_sljit_emit_const(compiler, dst, dstw, init_value));
@@ -2271,11 +2358,38 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compi
PTR_FAIL_IF(!const_);
set_const(const_, compiler);
- reg = FAST_IS_REG(dst) ? dst : TMP_REG2;
-
- PTR_FAIL_IF(emit_const(compiler, reg, init_value));
+ dst_r = FAST_IS_REG(dst) ? dst : TMP_REG2;
+ PTR_FAIL_IF(emit_const(compiler, dst_r, init_value));
if (dst & SLJIT_MEM)
PTR_FAIL_IF(emit_op(compiler, SLJIT_MOV, WORD_DATA, dst, dstw, TMP_REG1, 0, TMP_REG2, 0));
+
return const_;
}
+
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_put_label* sljit_emit_put_label(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw)
+{
+ struct sljit_put_label *put_label;
+ sljit_s32 dst_r;
+
+ CHECK_ERROR_PTR();
+ CHECK_PTR(check_sljit_emit_put_label(compiler, dst, dstw));
+ ADJUST_LOCAL_OFFSET(dst, dstw);
+
+ put_label = (struct sljit_put_label*)ensure_abuf(compiler, sizeof(struct sljit_put_label));
+ PTR_FAIL_IF(!put_label);
+ set_put_label(put_label, compiler, 0);
+
+ dst_r = FAST_IS_REG(dst) ? dst : TMP_REG2;
+#if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32)
+ PTR_FAIL_IF(emit_const(compiler, dst_r, 0));
+#else
+ PTR_FAIL_IF(push_inst(compiler, dst_r));
+ compiler->size += 4;
+#endif
+
+ if (dst & SLJIT_MEM)
+ PTR_FAIL_IF(emit_op(compiler, SLJIT_MOV, WORD_DATA, dst, dstw, TMP_REG1, 0, TMP_REG2, 0));
+
+ return put_label;
+}
diff --git a/ext/pcre/pcre2lib/sljit/sljitNativeSPARC_32.c b/ext/pcre/pcre2lib/sljit/sljitNativeSPARC_32.c
index 0671b130cc..8079fad8df 100644
--- a/ext/pcre/pcre2lib/sljit/sljitNativeSPARC_32.c
+++ b/ext/pcre/pcre2lib/sljit/sljitNativeSPARC_32.c
@@ -267,6 +267,7 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_set_jump_addr(sljit_uw addr, sljit_uw new_ta
{
sljit_ins *inst = (sljit_ins *)addr;
+ SLJIT_ASSERT(((inst[0] & 0xc1c00000) == 0x01000000) && ((inst[1] & 0xc1f82000) == 0x80102000));
inst[0] = (inst[0] & 0xffc00000) | ((new_target >> 10) & 0x3fffff);
inst[1] = (inst[1] & 0xfffffc00) | (new_target & 0x3ff);
inst = (sljit_ins *)SLJIT_ADD_EXEC_OFFSET(inst, executable_offset);
@@ -277,6 +278,7 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_set_const(sljit_uw addr, sljit_sw new_consta
{
sljit_ins *inst = (sljit_ins *)addr;
+ SLJIT_ASSERT(((inst[0] & 0xc1c00000) == 0x01000000) && ((inst[1] & 0xc1f82000) == 0x80102000));
inst[0] = (inst[0] & 0xffc00000) | ((new_constant >> 10) & 0x3fffff);
inst[1] = (inst[1] & 0xfffffc00) | (new_constant & 0x3ff);
inst = (sljit_ins *)SLJIT_ADD_EXEC_OFFSET(inst, executable_offset);
diff --git a/ext/pcre/pcre2lib/sljit/sljitNativeSPARC_common.c b/ext/pcre/pcre2lib/sljit/sljitNativeSPARC_common.c
index 669ecd8152..bfa4ecede2 100644
--- a/ext/pcre/pcre2lib/sljit/sljitNativeSPARC_common.c
+++ b/ext/pcre/pcre2lib/sljit/sljitNativeSPARC_common.c
@@ -298,12 +298,14 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
sljit_ins *buf_ptr;
sljit_ins *buf_end;
sljit_uw word_count;
+ sljit_uw next_addr;
sljit_sw executable_offset;
sljit_uw addr;
struct sljit_label *label;
struct sljit_jump *jump;
struct sljit_const *const_;
+ struct sljit_put_label *put_label;
CHECK_ERROR_PTR();
CHECK_PTR(check_sljit_generate_code(compiler));
@@ -315,40 +317,52 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
code_ptr = code;
word_count = 0;
+ next_addr = 0;
executable_offset = SLJIT_EXEC_OFFSET(code);
label = compiler->labels;
jump = compiler->jumps;
const_ = compiler->consts;
+ put_label = compiler->put_labels;
do {
buf_ptr = (sljit_ins*)buf->memory;
buf_end = buf_ptr + (buf->used_size >> 2);
do {
*code_ptr = *buf_ptr++;
- SLJIT_ASSERT(!label || label->size >= word_count);
- SLJIT_ASSERT(!jump || jump->addr >= word_count);
- SLJIT_ASSERT(!const_ || const_->addr >= word_count);
- /* These structures are ordered by their address. */
- if (label && label->size == word_count) {
- /* Just recording the address. */
- label->addr = (sljit_uw)SLJIT_ADD_EXEC_OFFSET(code_ptr, executable_offset);
- label->size = code_ptr - code;
- label = label->next;
- }
- if (jump && jump->addr == word_count) {
+ if (next_addr == word_count) {
+ SLJIT_ASSERT(!label || label->size >= word_count);
+ SLJIT_ASSERT(!jump || jump->addr >= word_count);
+ SLJIT_ASSERT(!const_ || const_->addr >= word_count);
+ SLJIT_ASSERT(!put_label || put_label->addr >= word_count);
+
+ /* These structures are ordered by their address. */
+ if (label && label->size == word_count) {
+ /* Just recording the address. */
+ label->addr = (sljit_uw)SLJIT_ADD_EXEC_OFFSET(code_ptr, executable_offset);
+ label->size = code_ptr - code;
+ label = label->next;
+ }
+ if (jump && jump->addr == word_count) {
#if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
- jump->addr = (sljit_uw)(code_ptr - 3);
+ jump->addr = (sljit_uw)(code_ptr - 3);
#else
- jump->addr = (sljit_uw)(code_ptr - 6);
+ jump->addr = (sljit_uw)(code_ptr - 6);
#endif
- code_ptr = detect_jump_type(jump, code_ptr, code, executable_offset);
- jump = jump->next;
- }
- if (const_ && const_->addr == word_count) {
- /* Just recording the address. */
- const_->addr = (sljit_uw)code_ptr;
- const_ = const_->next;
+ code_ptr = detect_jump_type(jump, code_ptr, code, executable_offset);
+ jump = jump->next;
+ }
+ if (const_ && const_->addr == word_count) {
+ /* Just recording the address. */
+ const_->addr = (sljit_uw)code_ptr;
+ const_ = const_->next;
+ }
+ if (put_label && put_label->addr == word_count) {
+ SLJIT_ASSERT(put_label->label);
+ put_label->addr = (sljit_uw)code_ptr;
+ put_label = put_label->next;
+ }
+ next_addr = compute_next_addr(label, jump, const_, put_label);
}
code_ptr ++;
word_count ++;
@@ -366,6 +380,7 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
SLJIT_ASSERT(!label);
SLJIT_ASSERT(!jump);
SLJIT_ASSERT(!const_);
+ SLJIT_ASSERT(!put_label);
SLJIT_ASSERT(code_ptr - code <= (sljit_s32)compiler->size);
jump = compiler->jumps;
@@ -389,8 +404,9 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
/* Set the fields of immediate loads. */
#if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
- buf_ptr[0] = (buf_ptr[0] & 0xffc00000) | ((addr >> 10) & 0x3fffff);
- buf_ptr[1] = (buf_ptr[1] & 0xfffffc00) | (addr & 0x3ff);
+ SLJIT_ASSERT(((buf_ptr[0] & 0xc1cfffff) == 0x01000000) && ((buf_ptr[1] & 0xc1f83fff) == 0x80102000));
+ buf_ptr[0] |= (addr >> 10) & 0x3fffff;
+ buf_ptr[1] |= addr & 0x3ff;
#else
#error "Implementation required"
#endif
@@ -398,6 +414,20 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
jump = jump->next;
}
+ put_label = compiler->put_labels;
+ while (put_label) {
+ addr = put_label->label->addr;
+ buf_ptr = (sljit_ins *)put_label->addr;
+
+#if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
+ SLJIT_ASSERT(((buf_ptr[0] & 0xc1cfffff) == 0x01000000) && ((buf_ptr[1] & 0xc1f83fff) == 0x80102000));
+ buf_ptr[0] |= (addr >> 10) & 0x3fffff;
+ buf_ptr[1] |= addr & 0x3ff;
+#else
+#error "Implementation required"
+#endif
+ put_label = put_label->next;
+ }
compiler->error = SLJIT_ERR_COMPILED;
compiler->executable_offset = executable_offset;
@@ -1465,8 +1495,8 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_cmov(struct sljit_compiler *compil
SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw init_value)
{
- sljit_s32 reg;
struct sljit_const *const_;
+ sljit_s32 dst_r;
CHECK_ERROR_PTR();
CHECK_PTR(check_sljit_emit_const(compiler, dst, dstw, init_value));
@@ -1476,11 +1506,31 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compi
PTR_FAIL_IF(!const_);
set_const(const_, compiler);
- reg = FAST_IS_REG(dst) ? dst : TMP_REG2;
-
- PTR_FAIL_IF(emit_const(compiler, reg, init_value));
+ dst_r = FAST_IS_REG(dst) ? dst : TMP_REG2;
+ PTR_FAIL_IF(emit_const(compiler, dst_r, init_value));
if (dst & SLJIT_MEM)
PTR_FAIL_IF(emit_op_mem(compiler, WORD_DATA, TMP_REG2, dst, dstw));
return const_;
}
+
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_put_label* sljit_emit_put_label(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw)
+{
+ struct sljit_put_label *put_label;
+ sljit_s32 dst_r;
+
+ CHECK_ERROR_PTR();
+ CHECK_PTR(check_sljit_emit_put_label(compiler, dst, dstw));
+ ADJUST_LOCAL_OFFSET(dst, dstw);
+
+ put_label = (struct sljit_put_label*)ensure_abuf(compiler, sizeof(struct sljit_put_label));
+ PTR_FAIL_IF(!put_label);
+ set_put_label(put_label, compiler, 0);
+
+ dst_r = FAST_IS_REG(dst) ? dst : TMP_REG2;
+ PTR_FAIL_IF(emit_const(compiler, dst_r, 0));
+
+ if (dst & SLJIT_MEM)
+ PTR_FAIL_IF(emit_op_mem(compiler, WORD_DATA, TMP_REG2, dst, dstw));
+ return put_label;
+}
diff --git a/ext/pcre/pcre2lib/sljit/sljitNativeX86_32.c b/ext/pcre/pcre2lib/sljit/sljitNativeX86_32.c
index 074e64b9f2..34a3a3d940 100644
--- a/ext/pcre/pcre2lib/sljit/sljitNativeX86_32.c
+++ b/ext/pcre/pcre2lib/sljit/sljitNativeX86_32.c
@@ -38,8 +38,10 @@ static sljit_s32 emit_do_imm(struct sljit_compiler *compiler, sljit_u8 opcode, s
return SLJIT_SUCCESS;
}
-static sljit_u8* generate_far_jump_code(struct sljit_jump *jump, sljit_u8 *code_ptr, sljit_s32 type, sljit_sw executable_offset)
+static sljit_u8* generate_far_jump_code(struct sljit_jump *jump, sljit_u8 *code_ptr, sljit_sw executable_offset)
{
+ sljit_s32 type = jump->flags >> TYPE_SHIFT;
+
if (type == SLJIT_JUMP) {
*code_ptr++ = JMP_i32;
jump->addr++;
diff --git a/ext/pcre/pcre2lib/sljit/sljitNativeX86_64.c b/ext/pcre/pcre2lib/sljit/sljitNativeX86_64.c
index 8506565614..5758711954 100644
--- a/ext/pcre/pcre2lib/sljit/sljitNativeX86_64.c
+++ b/ext/pcre/pcre2lib/sljit/sljitNativeX86_64.c
@@ -39,8 +39,10 @@ static sljit_s32 emit_load_imm64(struct sljit_compiler *compiler, sljit_s32 reg,
return SLJIT_SUCCESS;
}
-static sljit_u8* generate_far_jump_code(struct sljit_jump *jump, sljit_u8 *code_ptr, sljit_s32 type)
+static sljit_u8* generate_far_jump_code(struct sljit_jump *jump, sljit_u8 *code_ptr)
{
+ sljit_s32 type = jump->flags >> TYPE_SHIFT;
+
int short_addr = !(jump->flags & SLJIT_REWRITABLE_JUMP) && !(jump->flags & JUMP_LABEL) && (jump->u.target <= 0xffffffff);
/* The relative jump below specialized for this case. */
@@ -72,6 +74,56 @@ static sljit_u8* generate_far_jump_code(struct sljit_jump *jump, sljit_u8 *code_
return code_ptr;
}
+static sljit_u8* generate_put_label_code(struct sljit_put_label *put_label, sljit_u8 *code_ptr, sljit_uw max_label)
+{
+ if (max_label > HALFWORD_MAX) {
+ put_label->addr -= put_label->flags;
+ put_label->flags = PATCH_MD;
+ return code_ptr;
+ }
+
+ if (put_label->flags == 0) {
+ /* Destination is register. */
+ code_ptr = (sljit_u8*)put_label->addr - 2 - sizeof(sljit_uw);
+
+ SLJIT_ASSERT((code_ptr[0] & 0xf8) == REX_W);
+ SLJIT_ASSERT((code_ptr[1] & 0xf8) == MOV_r_i32);
+
+ if ((code_ptr[0] & 0x07) != 0) {
+ code_ptr[0] = (sljit_u8)(code_ptr[0] & ~0x08);
+ code_ptr += 2 + sizeof(sljit_s32);
+ }
+ else {
+ code_ptr[0] = code_ptr[1];
+ code_ptr += 1 + sizeof(sljit_s32);
+ }
+
+ put_label->addr = (sljit_uw)code_ptr;
+ return code_ptr;
+ }
+
+ code_ptr -= put_label->flags + (2 + sizeof(sljit_uw));
+ SLJIT_MEMMOVE(code_ptr, code_ptr + (2 + sizeof(sljit_uw)), put_label->flags);
+
+ SLJIT_ASSERT((code_ptr[0] & 0xf8) == REX_W);
+
+ if ((code_ptr[1] & 0xf8) == MOV_r_i32) {
+ code_ptr += 2 + sizeof(sljit_uw);
+ SLJIT_ASSERT((code_ptr[0] & 0xf8) == REX_W);
+ }
+
+ SLJIT_ASSERT(code_ptr[1] == MOV_rm_r);
+
+ code_ptr[0] = (sljit_u8)(code_ptr[0] & ~0x4);
+ code_ptr[1] = MOV_rm_i32;
+ code_ptr[2] = (sljit_u8)(code_ptr[2] & ~(0x7 << 3));
+
+ code_ptr = (sljit_u8*)(put_label->addr - (2 + sizeof(sljit_uw)) + sizeof(sljit_s32));
+ put_label->addr = (sljit_uw)code_ptr;
+ put_label->flags = 0;
+ return code_ptr;
+}
+
SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compiler,
sljit_s32 options, sljit_s32 arg_types, sljit_s32 scratches, sljit_s32 saveds,
sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size)
diff --git a/ext/pcre/pcre2lib/sljit/sljitNativeX86_common.c b/ext/pcre/pcre2lib/sljit/sljitNativeX86_common.c
index 6f02ee3e8b..6296da5382 100644
--- a/ext/pcre/pcre2lib/sljit/sljitNativeX86_common.c
+++ b/ext/pcre/pcre2lib/sljit/sljitNativeX86_common.c
@@ -428,13 +428,15 @@ static sljit_u8 get_jump_code(sljit_s32 type)
}
#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
-static sljit_u8* generate_far_jump_code(struct sljit_jump *jump, sljit_u8 *code_ptr, sljit_s32 type, sljit_sw executable_offset);
+static sljit_u8* generate_far_jump_code(struct sljit_jump *jump, sljit_u8 *code_ptr, sljit_sw executable_offset);
#else
-static sljit_u8* generate_far_jump_code(struct sljit_jump *jump, sljit_u8 *code_ptr, sljit_s32 type);
+static sljit_u8* generate_far_jump_code(struct sljit_jump *jump, sljit_u8 *code_ptr);
+static sljit_u8* generate_put_label_code(struct sljit_put_label *put_label, sljit_u8 *code_ptr, sljit_uw max_label);
#endif
-static sljit_u8* generate_near_jump_code(struct sljit_jump *jump, sljit_u8 *code_ptr, sljit_u8 *code, sljit_s32 type, sljit_sw executable_offset)
+static sljit_u8* generate_near_jump_code(struct sljit_jump *jump, sljit_u8 *code_ptr, sljit_u8 *code, sljit_sw executable_offset)
{
+ sljit_s32 type = jump->flags >> TYPE_SHIFT;
sljit_s32 short_jump;
sljit_uw label_addr;
@@ -447,7 +449,7 @@ static sljit_u8* generate_near_jump_code(struct sljit_jump *jump, sljit_u8 *code
#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
if ((sljit_sw)(label_addr - (jump->addr + 1)) > HALFWORD_MAX || (sljit_sw)(label_addr - (jump->addr + 1)) < HALFWORD_MIN)
- return generate_far_jump_code(jump, code_ptr, type);
+ return generate_far_jump_code(jump, code_ptr);
#endif
if (type == SLJIT_JUMP) {
@@ -497,6 +499,7 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
struct sljit_label *label;
struct sljit_jump *jump;
struct sljit_const *const_;
+ struct sljit_put_label *put_label;
CHECK_ERROR_PTR();
CHECK_PTR(check_sljit_generate_code(compiler));
@@ -511,6 +514,7 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
label = compiler->labels;
jump = compiler->jumps;
const_ = compiler->consts;
+ put_label = compiler->put_labels;
executable_offset = SLJIT_EXEC_OFFSET(code);
do {
@@ -525,27 +529,38 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
buf_ptr += len;
}
else {
- if (*buf_ptr >= 2) {
+ switch (*buf_ptr) {
+ case 0:
+ label->addr = (sljit_uw)SLJIT_ADD_EXEC_OFFSET(code_ptr, executable_offset);
+ label->size = code_ptr - code;
+ label = label->next;
+ break;
+ case 1:
jump->addr = (sljit_uw)code_ptr;
if (!(jump->flags & SLJIT_REWRITABLE_JUMP))
- code_ptr = generate_near_jump_code(jump, code_ptr, code, *buf_ptr - 2, executable_offset);
+ code_ptr = generate_near_jump_code(jump, code_ptr, code, executable_offset);
else {
#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
- code_ptr = generate_far_jump_code(jump, code_ptr, *buf_ptr - 2, executable_offset);
+ code_ptr = generate_far_jump_code(jump, code_ptr, executable_offset);
#else
- code_ptr = generate_far_jump_code(jump, code_ptr, *buf_ptr - 2);
+ code_ptr = generate_far_jump_code(jump, code_ptr);
#endif
}
jump = jump->next;
- }
- else if (*buf_ptr == 0) {
- label->addr = ((sljit_uw)code_ptr) + executable_offset;
- label->size = code_ptr - code;
- label = label->next;
- }
- else { /* *buf_ptr is 1 */
+ break;
+ case 2:
const_->addr = ((sljit_uw)code_ptr) - sizeof(sljit_sw);
const_ = const_->next;
+ break;
+ default:
+ SLJIT_ASSERT(*buf_ptr == 3);
+ SLJIT_ASSERT(put_label->label);
+ put_label->addr = (sljit_uw)code_ptr;
+#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
+ code_ptr = generate_put_label_code(put_label, code_ptr, (sljit_uw)(SLJIT_ADD_EXEC_OFFSET(code, executable_offset) + put_label->label->size));
+#endif
+ put_label = put_label->next;
+ break;
}
buf_ptr++;
}
@@ -557,6 +572,8 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
SLJIT_ASSERT(!label);
SLJIT_ASSERT(!jump);
SLJIT_ASSERT(!const_);
+ SLJIT_ASSERT(!put_label);
+ SLJIT_ASSERT(code_ptr <= code + compiler->size);
jump = compiler->jumps;
while (jump) {
@@ -591,8 +608,24 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil
jump = jump->next;
}
- /* Some space may be wasted because of short jumps. */
- SLJIT_ASSERT(code_ptr <= code + compiler->size);
+ put_label = compiler->put_labels;
+ while (put_label) {
+#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
+ sljit_unaligned_store_sw((void*)(put_label->addr - sizeof(sljit_sw)), (sljit_sw)put_label->label->addr);
+#else
+ if (put_label->flags & PATCH_MD) {
+ SLJIT_ASSERT(put_label->label->addr > HALFWORD_MAX);
+ sljit_unaligned_store_sw((void*)(put_label->addr - sizeof(sljit_sw)), (sljit_sw)put_label->label->addr);
+ }
+ else {
+ SLJIT_ASSERT(put_label->label->addr <= HALFWORD_MAX);
+ sljit_unaligned_store_s32((void*)(put_label->addr - sizeof(sljit_s32)), (sljit_s32)put_label->label->addr);
+ }
+#endif
+
+ put_label = put_label->next;
+ }
+
compiler->error = SLJIT_ERR_COMPILED;
compiler->executable_offset = executable_offset;
compiler->executable_size = code_ptr - code;
@@ -2481,7 +2514,7 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compile
jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump));
PTR_FAIL_IF_NULL(jump);
- set_jump(jump, compiler, type & SLJIT_REWRITABLE_JUMP);
+ set_jump(jump, compiler, (type & SLJIT_REWRITABLE_JUMP) | ((type & 0xff) << TYPE_SHIFT));
type &= 0xff;
/* Worst case size. */
@@ -2495,7 +2528,7 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compile
PTR_FAIL_IF_NULL(inst);
*inst++ = 0;
- *inst++ = type + 2;
+ *inst++ = 1;
return jump;
}
@@ -2513,7 +2546,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compi
if (src == SLJIT_IMM) {
jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump));
FAIL_IF_NULL(jump);
- set_jump(jump, compiler, JUMP_ADDR);
+ set_jump(jump, compiler, JUMP_ADDR | (type << TYPE_SHIFT));
jump->u.target = srcw;
/* Worst case size. */
@@ -2527,7 +2560,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compi
FAIL_IF_NULL(inst);
*inst++ = 0;
- *inst++ = type + 2;
+ *inst++ = 1;
}
else {
#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
@@ -2831,7 +2864,7 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compi
PTR_FAIL_IF(!inst);
*inst++ = 0;
- *inst++ = 1;
+ *inst++ = 2;
#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
if (dst & SLJIT_MEM)
@@ -2842,6 +2875,54 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compi
return const_;
}
+SLJIT_API_FUNC_ATTRIBUTE struct sljit_put_label* sljit_emit_put_label(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw)
+{
+ struct sljit_put_label *put_label;
+ sljit_u8 *inst;
+#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
+ sljit_s32 reg;
+ sljit_uw start_size;
+#endif
+
+ CHECK_ERROR_PTR();
+ CHECK_PTR(check_sljit_emit_put_label(compiler, dst, dstw));
+ ADJUST_LOCAL_OFFSET(dst, dstw);
+
+ CHECK_EXTRA_REGS(dst, dstw, (void)0);
+
+ put_label = (struct sljit_put_label*)ensure_abuf(compiler, sizeof(struct sljit_put_label));
+ PTR_FAIL_IF(!put_label);
+ set_put_label(put_label, compiler, 0);
+
+#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
+ compiler->mode32 = 0;
+ reg = FAST_IS_REG(dst) ? dst : TMP_REG1;
+
+ if (emit_load_imm64(compiler, reg, 0))
+ return NULL;
+#else
+ if (emit_mov(compiler, dst, dstw, SLJIT_IMM, 0))
+ return NULL;
+#endif
+
+#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
+ if (dst & SLJIT_MEM) {
+ start_size = compiler->size;
+ if (emit_mov(compiler, dst, dstw, TMP_REG1, 0))
+ return NULL;
+ put_label->flags = compiler->size - start_size;
+ }
+#endif
+
+ inst = (sljit_u8*)ensure_buf(compiler, 2);
+ PTR_FAIL_IF(!inst);
+
+ *inst++ = 0;
+ *inst++ = 3;
+
+ return put_label;
+}
+
SLJIT_API_FUNC_ATTRIBUTE void sljit_set_jump_addr(sljit_uw addr, sljit_uw new_target, sljit_sw executable_offset)
{
SLJIT_UNUSED_ARG(executable_offset);
diff --git a/ext/pcre/pcre2lib/sljit/sljitUtils.c b/ext/pcre/pcre2lib/sljit/sljitUtils.c
index 5c2a838932..857492a174 100644
--- a/ext/pcre/pcre2lib/sljit/sljitUtils.c
+++ b/ext/pcre/pcre2lib/sljit/sljitUtils.c
@@ -154,7 +154,13 @@ SLJIT_API_FUNC_ATTRIBUTE void SLJIT_FUNC sljit_release_lock(void)
#include "windows.h"
#else
/* Provides mmap function. */
+#include <sys/types.h>
#include <sys/mman.h>
+#ifndef MAP_ANON
+#ifdef MAP_ANONYMOUS
+#define MAP_ANON MAP_ANONYMOUS
+#endif
+#endif
/* For detecting the page size. */
#include <unistd.h>
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index 39896bb07b..edf48ca1f4 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -20,6 +18,7 @@
#include "php_ini.h"
#include "php_globals.h"
#include "php_pcre.h"
+#include "php_pcre_arginfo.h"
#include "ext/standard/info.h"
#include "ext/standard/basic_functions.h"
#include "zend_smart_str.h"
@@ -50,7 +49,6 @@ struct _pcre_cache_entry {
uint32_t capture_count;
uint32_t name_count;
uint32_t compile_options;
- uint32_t extra_compile_options;
uint32_t refcount;
};
@@ -169,7 +167,6 @@ static void php_pcre_free(void *block, void *data)
pefree(block, 1);
}/*}}}*/
-#define PHP_PCRE_DEFAULT_EXTRA_COPTIONS PCRE2_EXTRA_BAD_ESCAPE_IS_LITERAL
#define PHP_PCRE_PREALLOC_MDATA_SIZE 32
static void php_pcre_init_pcre2(uint8_t jit)
@@ -190,12 +187,6 @@ static void php_pcre_init_pcre2(uint8_t jit)
}
}
- /* XXX The 'X' modifier is the default behavior in PCRE2. This option is
- called dangerous in the manual, as typos in patterns can cause
- unexpected results. We might want to to switch to the default PCRE2
- behavior, too, thus causing a certain BC break. */
- pcre2_set_compile_extra_options(cctx, PHP_PCRE_DEFAULT_EXTRA_COPTIONS);
-
if (!mctx) {
mctx = pcre2_match_context_create(gctx);
if (!mctx) {
@@ -571,7 +562,6 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache_ex(zend_string *regex, in
{
pcre2_code *re = NULL;
uint32_t coptions = 0;
- uint32_t extra_coptions = PHP_PCRE_DEFAULT_EXTRA_COPTIONS;
PCRE2_UCHAR error[128];
PCRE2_SIZE erroffset;
int errnumber;
@@ -705,8 +695,8 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache_ex(zend_string *regex, in
case 'A': coptions |= PCRE2_ANCHORED; break;
case 'D': coptions |= PCRE2_DOLLAR_ENDONLY;break;
case 'S': /* Pass. */ break;
+ case 'X': /* Pass. */ break;
case 'U': coptions |= PCRE2_UNGREEDY; break;
- case 'X': extra_coptions &= ~PCRE2_EXTRA_BAD_ESCAPE_IS_LITERAL; break;
case 'u': coptions |= PCRE2_UTF;
/* In PCRE, by default, \d, \D, \s, \S, \w, and \W recognize only ASCII
characters, even in UTF-8 mode. However, this can be changed by setting
@@ -770,19 +760,9 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache_ex(zend_string *regex, in
pcre2_set_character_tables(cctx, tables);
}
- /* Set extra options for the compile context. */
- if (PHP_PCRE_DEFAULT_EXTRA_COPTIONS != extra_coptions) {
- pcre2_set_compile_extra_options(cctx, extra_coptions);
- }
-
/* Compile pattern and display a warning if compilation failed. */
re = pcre2_compile((PCRE2_SPTR)pattern, pattern_len, coptions, &errnumber, &erroffset, cctx);
- /* Reset the compile context extra options to default. */
- if (PHP_PCRE_DEFAULT_EXTRA_COPTIONS != extra_coptions) {
- pcre2_set_compile_extra_options(cctx, PHP_PCRE_DEFAULT_EXTRA_COPTIONS);
- }
-
if (re == NULL) {
if (key != regex) {
zend_string_release_ex(key, 0);
@@ -832,7 +812,6 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache_ex(zend_string *regex, in
new_entry.re = re;
new_entry.preg_options = poptions;
new_entry.compile_options = coptions;
- new_entry.extra_compile_options = extra_coptions;
new_entry.refcount = 0;
rc = pcre2_pattern_info(re, PCRE2_INFO_CAPTURECOUNT, &new_entry.capture_count);
@@ -1128,7 +1107,7 @@ static void php_do_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global) /* {{{ *
Z_PARAM_ZVAL(subpats)
Z_PARAM_LONG(flags)
Z_PARAM_LONG(start_offset)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
/* Compile regex or get it from cache. */
if ((pce = pcre_get_compiled_regex_cache(regex)) == NULL) {
@@ -2308,8 +2287,8 @@ static void preg_replace_common(INTERNAL_FUNCTION_PARAMETERS, int is_filter)
}
} else {
if (Z_TYPE_P(regex) != IS_ARRAY) {
- php_error_docref(NULL, E_WARNING, "Parameter mismatch, pattern is a string while replacement is an array");
- RETURN_FALSE;
+ zend_type_error("Parameter mismatch, pattern is a string while replacement is an array");
+ RETURN_THROWS();
}
}
@@ -2510,7 +2489,7 @@ static PHP_FUNCTION(preg_split)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(limit_val)
Z_PARAM_LONG(flags)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
/* Compile regex or get it from cache. */
if ((pce = pcre_get_compiled_regex_cache(regex)) == NULL) {
@@ -2980,70 +2959,6 @@ static PHP_FUNCTION(preg_last_error)
/* {{{ module definition structures */
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_preg_match, 0, 0, 2)
- ZEND_ARG_INFO(0, pattern)
- ZEND_ARG_INFO(0, subject)
- ZEND_ARG_INFO(1, subpatterns) /* array */
- ZEND_ARG_INFO(0, flags)
- ZEND_ARG_INFO(0, offset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_preg_match_all, 0, 0, 2)
- ZEND_ARG_INFO(0, pattern)
- ZEND_ARG_INFO(0, subject)
- ZEND_ARG_INFO(1, subpatterns) /* array */
- ZEND_ARG_INFO(0, flags)
- ZEND_ARG_INFO(0, offset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_preg_replace, 0, 0, 3)
- ZEND_ARG_INFO(0, regex)
- ZEND_ARG_INFO(0, replace)
- ZEND_ARG_INFO(0, subject)
- ZEND_ARG_INFO(0, limit)
- ZEND_ARG_INFO(1, count)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_preg_replace_callback, 0, 0, 3)
- ZEND_ARG_INFO(0, regex)
- ZEND_ARG_INFO(0, callback)
- ZEND_ARG_INFO(0, subject)
- ZEND_ARG_INFO(0, limit)
- ZEND_ARG_INFO(1, count)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_preg_replace_callback_array, 0, 0, 2)
- ZEND_ARG_INFO(0, pattern)
- ZEND_ARG_INFO(0, subject)
- ZEND_ARG_INFO(0, limit)
- ZEND_ARG_INFO(1, count)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_preg_split, 0, 0, 2)
- ZEND_ARG_INFO(0, pattern)
- ZEND_ARG_INFO(0, subject)
- ZEND_ARG_INFO(0, limit)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_preg_quote, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, delim_char)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_preg_grep, 0, 0, 2)
- ZEND_ARG_INFO(0, regex)
- ZEND_ARG_INFO(0, input) /* array */
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_preg_last_error, 0)
-ZEND_END_ARG_INFO()
-/* }}} */
-
static const zend_function_entry pcre_functions[] = {
PHP_FE(preg_match, arginfo_preg_match)
PHP_FE(preg_match_all, arginfo_preg_match_all)
diff --git a/ext/pcre/php_pcre.h b/ext/pcre/php_pcre.h
index b375981df3..3c2fff4251 100644
--- a/ext/pcre/php_pcre.h
+++ b/ext/pcre/php_pcre.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/pcre/php_pcre.stub.php b/ext/pcre/php_pcre.stub.php
new file mode 100644
index 0000000000..397ab22159
--- /dev/null
+++ b/ext/pcre/php_pcre.stub.php
@@ -0,0 +1,39 @@
+<?php
+
+function preg_match(string $pattern, string $subject, &$subpatterns = null, int $flags = 0, int $offset = 0): int|false {}
+
+function preg_match_all(string $pattern, string $subject, &$subpatterns = null, int $flags = 0, int $offset = 0): int|false|null {}
+
+/**
+ * @param string|array $regex
+ * @param string|array $replace
+ * @param string|array $subject
+ */
+function preg_replace($regex, $replace, $subject, int $limit = -1, &$count = null): string|array|null {}
+
+/**
+ * @param string|array $regex
+ * @param string|array $replace
+ * @param string|array $subject
+ */
+function preg_filter($regex, $replace, $subject, int $limit = -1, &$count = null): string|array|null {}
+
+/**
+ * @param string|array $regex
+ * @param string|array $subject
+ *
+ * TODO: $callback should be `callable`
+ */
+function preg_replace_callback($regex, $callback, $subject, int $limit = -1, &$count = null, int $flags = 0): string|array|null {}
+
+/** @param string|array $subject */
+function preg_replace_callback_array(array $pattern, $subject, int $limit = -1, &$count = null, int $flags = 0): string|array|null {}
+
+function preg_split(string $pattern, string $subject, int $limit = -1, int $flags = 0): array|false {}
+
+
+function preg_quote(string $str, ?string $delim_char = null): string {}
+
+function preg_grep(string $regex, array $input, int $flags = 0): array|false {}
+
+function preg_last_error(): int {}
diff --git a/ext/pcre/php_pcre_arginfo.h b/ext/pcre/php_pcre_arginfo.h
new file mode 100644
index 0000000000..4c7308baab
--- /dev/null
+++ b/ext/pcre/php_pcre_arginfo.h
@@ -0,0 +1,65 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_preg_match, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, subject, IS_STRING, 0)
+ ZEND_ARG_INFO(1, subpatterns)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_preg_match_all, 0, 2, MAY_BE_LONG|MAY_BE_FALSE|MAY_BE_NULL)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, subject, IS_STRING, 0)
+ ZEND_ARG_INFO(1, subpatterns)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_preg_replace, 0, 3, MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_NULL)
+ ZEND_ARG_INFO(0, regex)
+ ZEND_ARG_INFO(0, replace)
+ ZEND_ARG_INFO(0, subject)
+ ZEND_ARG_TYPE_INFO(0, limit, IS_LONG, 0)
+ ZEND_ARG_INFO(1, count)
+ZEND_END_ARG_INFO()
+
+#define arginfo_preg_filter arginfo_preg_replace
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_preg_replace_callback, 0, 3, MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_NULL)
+ ZEND_ARG_INFO(0, regex)
+ ZEND_ARG_INFO(0, callback)
+ ZEND_ARG_INFO(0, subject)
+ ZEND_ARG_TYPE_INFO(0, limit, IS_LONG, 0)
+ ZEND_ARG_INFO(1, count)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_preg_replace_callback_array, 0, 2, MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_NULL)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_ARRAY, 0)
+ ZEND_ARG_INFO(0, subject)
+ ZEND_ARG_TYPE_INFO(0, limit, IS_LONG, 0)
+ ZEND_ARG_INFO(1, count)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_preg_split, 0, 2, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, subject, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, limit, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_preg_quote, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, delim_char, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_preg_grep, 0, 2, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, regex, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, input, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_preg_last_error, 0, 0, IS_LONG, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/pcre/tests/001.phpt b/ext/pcre/tests/001.phpt
index 313f7fdc67..482ba1b732 100644
--- a/ext/pcre/tests/001.phpt
+++ b/ext/pcre/tests/001.phpt
@@ -4,14 +4,14 @@ abusing preg_match()
<?php
foreach (array('2006-05-13', '06-12-12', 'data: "12-Aug-87"') as $s) {
- var_dump(preg_match('~
- (?P<date>
- (?P<year>(\d{2})?\d\d) -
- (?P<month>(?:\d\d|[a-zA-Z]{2,3})) -
- (?P<day>[0-3]?\d))
- ~x', $s, $m));
+ var_dump(preg_match('~
+ (?P<date>
+ (?P<year>(\d{2})?\d\d) -
+ (?P<month>(?:\d\d|[a-zA-Z]{2,3})) -
+ (?P<day>[0-3]?\d))
+ ~x', $s, $m));
- var_dump($m);
+ var_dump($m);
}
?>
diff --git a/ext/pcre/tests/002.phpt b/ext/pcre/tests/002.phpt
index d4780447bc..073a7a8d56 100644
--- a/ext/pcre/tests/002.phpt
+++ b/ext/pcre/tests/002.phpt
@@ -3,11 +3,8 @@ preg_* with bogus vals
--FILE--
<?php
-var_dump(preg_match());
-var_dump(preg_match_all());
var_dump(preg_match_all('//', '', $dummy, 0xdead));
-var_dump(preg_quote());
var_dump(preg_quote(''));
var_dump(preg_replace('/(.)/', '${1}${1', 'abc'));
@@ -16,22 +13,13 @@ var_dump(preg_replace('/(.)/e', 'for ($', 'abc'));
?>
--EXPECTF--
-Warning: preg_match() expects at least 2 parameters, 0 given in %s002.php on line 3
-bool(false)
-
-Warning: preg_match_all() expects at least 2 parameters, 0 given in %s002.php on line 4
-bool(false)
-
-Warning: preg_match_all(): Invalid flags specified in %s002.php on line 5
-NULL
-
-Warning: preg_quote() expects at least 1 parameter, 0 given in %s002.php on line 7
+Warning: preg_match_all(): Invalid flags specified in %s002.php on line %d
NULL
string(0) ""
string(12) "a${1b${1c${1"
-Warning: preg_replace(): Compilation failed: missing terminating ] for character class at offset 8 in %s002.php on line 11
+Warning: preg_replace(): Compilation failed: missing terminating ] for character class at offset 8 in %s002.php on line %d
NULL
-Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in %s on line 12
+Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in %s on line %d
NULL
diff --git a/ext/pcre/tests/003.phpt b/ext/pcre/tests/003.phpt
index e697c375c6..b5fce13194 100644
--- a/ext/pcre/tests/003.phpt
+++ b/ext/pcre/tests/003.phpt
@@ -4,15 +4,15 @@ abusing preg_match_all()
<?php
foreach (array(PREG_PATTERN_ORDER, PREG_SET_ORDER) as $flag) {
- var_dump(preg_match_all('~
- (?P<date>
- (?P<year>(\d{2})?\d\d) -
- (?P<month>(?:\d\d|[a-zA-Z]{2,3})) -
- (?P<day>[0-3]?\d))
- ~x',
- '2006-05-13 e outra data: "12-Aug-37"', $m, $flag));
+ var_dump(preg_match_all('~
+ (?P<date>
+ (?P<year>(\d{2})?\d\d) -
+ (?P<month>(?:\d\d|[a-zA-Z]{2,3})) -
+ (?P<day>[0-3]?\d))
+ ~x',
+ '2006-05-13 e outra data: "12-Aug-37"', $m, $flag));
- var_dump($m);
+ var_dump($m);
}
?>
--EXPECT--
diff --git a/ext/pcre/tests/005.phpt b/ext/pcre/tests/005.phpt
index 5eff83eba6..f988da054a 100644
--- a/ext/pcre/tests/005.phpt
+++ b/ext/pcre/tests/005.phpt
@@ -63,12 +63,12 @@ ext/ming/ming.o(.text+0x851): In function `zif_ming_setSWFCompression':
/p2/var/php_gcov/PHP_5_2/ext/ming/ming.c:154: undefined reference to `Ming_setSWFCompression'
";
- // Regular expression to select the error and warning information
- // tuned for gcc 3.4, 4.0 and 4.1
- $gcc_regex = '/^((.+)(\(\.text\+0x[[:xdigit:]]+\))?: In function [`\'](\w+)\':\s+)?'.
- '((?(1)(?(3)[^:\n]+|\2)|[^:\n]+)):(\d+): (?:(error|warning):\s+)?(.+)'.
- str_repeat('(?:\s+\5:(\d+): (?:(error|warning):\s+)?(.+))?', 99). // capture up to 100 errors
- '/mS';
+ // Regular expression to select the error and warning information
+ // tuned for gcc 3.4, 4.0 and 4.1
+ $gcc_regex = '/^((.+)(\(\.text\+0x[[:xdigit:]]+\))?: In function [`\'](\w+)\':\s+)?'.
+ '((?(1)(?(3)[^:\n]+|\2)|[^:\n]+)):(\d+): (?:(error|warning):\s+)?(.+)'.
+ str_repeat('(?:\s+\5:(\d+): (?:(error|warning):\s+)?(.+))?', 99). // capture up to 100 errors
+ '/mS';
var_dump(preg_match_all($gcc_regex, $sampledata, $m, PREG_SET_ORDER));
diff --git a/ext/pcre/tests/007.phpt b/ext/pcre/tests/007.phpt
index 776bec27b2..bc213ad0e0 100644
--- a/ext/pcre/tests/007.phpt
+++ b/ext/pcre/tests/007.phpt
@@ -10,10 +10,10 @@ if (@preg_match('/./u', '') === false) {
<?php
function evil($x) {
- global $txt;
- $txt[3] = "\xFF";
- var_dump($x);
- return $x[0];
+ global $txt;
+ $txt[3] = "\xFF";
+ var_dump($x);
+ return $x[0];
}
$txt = "ola123";
diff --git a/ext/pcre/tests/bug20528.phpt b/ext/pcre/tests/bug20528.phpt
index 43e548b26e..a067680b05 100644
--- a/ext/pcre/tests/bug20528.phpt
+++ b/ext/pcre/tests/bug20528.phpt
@@ -2,8 +2,8 @@
Bug #20528 (preg_split() drops characters (re-opens Bug #15413))
--FILE--
<?php
- $data = '(#11/19/2002#)';
- var_dump(preg_split('/\b/', $data));
+ $data = '(#11/19/2002#)';
+ var_dump(preg_split('/\b/', $data));
?>
--EXPECT--
array(7) {
diff --git a/ext/pcre/tests/bug21732.phpt b/ext/pcre/tests/bug21732.phpt
index 3dfc41e19f..a88d36c94c 100644
--- a/ext/pcre/tests/bug21732.phpt
+++ b/ext/pcre/tests/bug21732.phpt
@@ -1,21 +1,23 @@
--TEST--
Bug #21732 (preg_replace() segfaults with invalid parameters)
---INI--
-error_reporting=0
--FILE--
<?php
class foo {
- function cb($param) {
- var_dump($param);
- return "yes!";
- }
+ function cb($param) {
+ var_dump($param);
+ return "yes!";
+ }
}
-var_dump(preg_replace('', array(), ''));
+try {
+ var_dump(preg_replace('', array(), ''));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump(preg_replace_callback("/(ab)(cd)(e)/", array(new foo(), "cb"), 'abcde'));
?>
--EXPECT--
-bool(false)
+Parameter mismatch, pattern is a string while replacement is an array
array(4) {
[0]=>
string(5) "abcde"
diff --git a/ext/pcre/tests/bug26927.phpt b/ext/pcre/tests/bug26927.phpt
index 200a534b76..8cc6280afd 100644
--- a/ext/pcre/tests/bug26927.phpt
+++ b/ext/pcre/tests/bug26927.phpt
@@ -2,9 +2,9 @@
Bug #26927 (preg_quote() does not escape \0)
--FILE--
<?php
- $str = "a\000b";
- $str_quoted = preg_quote($str);
- var_dump(preg_match("!{$str_quoted}!", $str), $str_quoted);
+ $str = "a\000b";
+ $str_quoted = preg_quote($str);
+ var_dump(preg_match("!{$str_quoted}!", $str), $str_quoted);
?>
--EXPECT--
int(1)
diff --git a/ext/pcre/tests/bug27103.phpt b/ext/pcre/tests/bug27103.phpt
index 0264228aee..0b706010a0 100644
--- a/ext/pcre/tests/bug27103.phpt
+++ b/ext/pcre/tests/bug27103.phpt
@@ -10,9 +10,9 @@ if (@preg_match('/./u', '') === false) {
<?php
function iter($ar)
{
- foreach ($ar as $c) {
- echo htmlentities($c, 0, "UTF-8"), ": ", strlen($c), "\n";
- }
+ foreach ($ar as $c) {
+ echo htmlentities($c, 0, "UTF-8"), ": ", strlen($c), "\n";
+ }
}
$teststr = "\xe2\x82\xac hi there";
iter(preg_split('//u', $teststr, -1, PREG_SPLIT_NO_EMPTY));
diff --git a/ext/pcre/tests/bug37911.phpt b/ext/pcre/tests/bug37911.phpt
index 4f3cb3574d..c9cad1d6d5 100644
--- a/ext/pcre/tests/bug37911.phpt
+++ b/ext/pcre/tests/bug37911.phpt
@@ -5,8 +5,8 @@ Bug #37911 (preg_replace_callback ignores named groups)
function callback($match)
{
- var_dump($match);
- return $match[1].'/'.strlen($match['name']);
+ var_dump($match);
+ return $match[1].'/'.strlen($match['name']);
}
var_dump(preg_replace_callback('|(?P<name>blub)|', 'callback', 'bla blub blah'));
diff --git a/ext/pcre/tests/bug41638.phpt b/ext/pcre/tests/bug41638.phpt
index 8c907f9903..3ab9a84ac2 100644
--- a/ext/pcre/tests/bug41638.phpt
+++ b/ext/pcre/tests/bug41638.phpt
@@ -2,7 +2,7 @@
Bug #41638 (pcre 7.0 regression)
--FILE--
<?php
-$str = "repeater id='loopt' dataSrc=subject colums=2";
+$str = "repeater id='loopt' dataSrc=subject columns=2";
preg_match_all("/(['\"])((.*(\\\\\\1)*)*)\\1/sU",$str,$str_instead);
print_r($str_instead);
diff --git a/ext/pcre/tests/bug44191.phpt b/ext/pcre/tests/bug44191.phpt
index 73fc29cd90..7d0b535dc6 100644
--- a/ext/pcre/tests/bug44191.phpt
+++ b/ext/pcre/tests/bug44191.phpt
@@ -8,7 +8,7 @@ $array = range(1, 10);
preg_grep('/asdf/', $array);
foreach ($array as $k => $v) {
- print $k;
+ print $k;
}
?>
diff --git a/ext/pcre/tests/bug44925.phpt b/ext/pcre/tests/bug44925.phpt
index f6e0db4253..c495331b4b 100644
--- a/ext/pcre/tests/bug44925.phpt
+++ b/ext/pcre/tests/bug44925.phpt
@@ -45,11 +45,11 @@ array(9) {
&string(1) "b"
}
-Notice: Array to string conversion in %sbug44925.php on line 9
+Warning: Array to string conversion in %s on line %d
array(0) {
}
-Notice: Array to string conversion in %sbug44925.php on line 11
+Warning: Array to string conversion in %s on line %d
array(7) {
[0]=>
string(1) "1"
diff --git a/ext/pcre/tests/bug47662.phpt b/ext/pcre/tests/bug47662.phpt
index abf65e6ca9..84b237864a 100644
--- a/ext/pcre/tests/bug47662.phpt
+++ b/ext/pcre/tests/bug47662.phpt
@@ -5,7 +5,7 @@ Bug #47662 (support more than 127 named subpatterns)
$regex = '@';
for($bar=0; $bar<129; $bar++) {
- $regex .= '((?P<x'.$bar.'>))';
+ $regex .= '((?P<x'.$bar.'>))';
}
$regex .= 'fo+bar@';
diff --git a/ext/pcre/tests/bug73392.phpt b/ext/pcre/tests/bug73392.phpt
index 90606c9e05..704cc3d351 100644
--- a/ext/pcre/tests/bug73392.phpt
+++ b/ext/pcre/tests/bug73392.phpt
@@ -3,22 +3,22 @@ Bug #73392 (A use-after-free in zend allocator management)
--FILE--
<?php
class Rep {
- public function __invoke() {
- return "d";
- }
+ public function __invoke() {
+ return "d";
+ }
}
class Foo {
- public static function rep($rep) {
- return "ok";
- }
+ public static function rep($rep) {
+ return "ok";
+ }
}
function b() {
- return "b";
+ return "b";
}
var_dump(preg_replace_callback_array(
- array(
- "/a/" => 'b', "/b/" => function () { return "c"; }, "/c/" => new Rep, "reporting" => array("Foo", "rep"), "a1" => array("Foo", "rep"),
- ), 'a'));
+ array(
+ "/a/" => 'b', "/b/" => function () { return "c"; }, "/c/" => new Rep, "reporting" => array("Foo", "rep"), "a1" => array("Foo", "rep"),
+ ), 'a'));
?>
--EXPECTF--
Warning: preg_replace_callback_array(): Delimiter must not be alphanumeric or backslash in %sbug73392.php on line %d
diff --git a/ext/pcre/tests/bug73483.phpt b/ext/pcre/tests/bug73483.phpt
index fd10702527..cbf4a2bdaf 100644
--- a/ext/pcre/tests/bug73483.phpt
+++ b/ext/pcre/tests/bug73483.phpt
@@ -8,7 +8,7 @@ var_dump(preg_replace_callback($regex, function (array $matches) use($regex) {
setlocale(LC_ALL, "en_US");
$ret = preg_replace($regex, "okey", $matches[0]);
setlocale(LC_ALL, "C");
- return $ret;
+ return $ret;
}, "dummy"));
?>
--EXPECT--
diff --git a/ext/pcre/tests/bug75207.phpt b/ext/pcre/tests/bug75207.phpt
index 82b2cc9bd9..ea25c547c1 100644
--- a/ext/pcre/tests/bug75207.phpt
+++ b/ext/pcre/tests/bug75207.phpt
@@ -4,7 +4,5 @@ CVE-2016-1283, see bug #75207
<?php
preg_match("/š(?:F?+(?:^(?(R)a+\"){99}-))(?J)(?'R'(?'R'<((?'RR'(?'R'\){97)?J)?J)(?'R'(?'R'\){99|(:(?|(?'R')(\k'R')|((?'R')))H'R'R)(H'R))))))/", "*b\dc");
?>
-==DONE==
--EXPECTF--
Warning: preg_match(): Compilation failed: unmatched closing parenthesis at offset %d in %s on line %d
-==DONE==
diff --git a/ext/pcre/tests/bug76512.phpt b/ext/pcre/tests/bug76512.phpt
index cb8a9fa95f..3090291736 100644
--- a/ext/pcre/tests/bug76512.phpt
+++ b/ext/pcre/tests/bug76512.phpt
@@ -4,7 +4,5 @@ Bug #76512 (\w no longer includes unicode characters)
<?php
var_dump(preg_match('/\w/u', 'ä'));
?>
-===DONE===
--EXPECT--
int(1)
-===DONE===
diff --git a/ext/pcre/tests/bug76850.phpt b/ext/pcre/tests/bug76850.phpt
index 3e07ab7aa8..50c62ad1b3 100644
--- a/ext/pcre/tests/bug76850.phpt
+++ b/ext/pcre/tests/bug76850.phpt
@@ -21,7 +21,5 @@ foo();
var_dump(preg_match('/./', "a"));
?>
-==DONE==
--EXPECT--
int(1)
-==DONE==
diff --git a/ext/pcre/tests/bug77193.phpt b/ext/pcre/tests/bug77193.phpt
index 5dc7913db2..4fdb603b85 100644
--- a/ext/pcre/tests/bug77193.phpt
+++ b/ext/pcre/tests/bug77193.phpt
@@ -12,16 +12,14 @@ $text = '{CCM:CID_2}';
echo '1';
$mt = array();
preg_replace_callback(
- '/([0-9]+)/i',
- function ($matches) {
- echo $matches[1];
- filter_var('http', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => '/^http$/i']]);
- },
- $text
+ '/([0-9]+)/i',
+ function ($matches) {
+ echo $matches[1];
+ filter_var('http', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => '/^http$/i']]);
+ },
+ $text
);
echo '3', "\n";
?>
-===DONE===
--EXPECT--
123
-===DONE===
diff --git a/ext/pcre/tests/bug77827.phpt b/ext/pcre/tests/bug77827.phpt
index c8f8c7a16a..ebb5d8b228 100644
--- a/ext/pcre/tests/bug77827.phpt
+++ b/ext/pcre/tests/bug77827.phpt
@@ -7,8 +7,6 @@ var_dump(
preg_last_error()
);
?>
-===DONE===
--EXPECT--
int(1)
int(0)
-===DONE===
diff --git a/ext/pcre/tests/cache_limit.phpt b/ext/pcre/tests/cache_limit.phpt
index d6f3510e9d..d15b7675e4 100644
--- a/ext/pcre/tests/cache_limit.phpt
+++ b/ext/pcre/tests/cache_limit.phpt
@@ -12,10 +12,10 @@ $re = '';
$str = str_repeat('x', PREG_CACHE_SIZE);
for ($i=0; $i < PREG_CACHE_SIZE; ++$i) {
- $re .= '.';
- if (!preg_match("/$re/", $str)) {
- die('non match. error');
- }
+ $re .= '.';
+ if (!preg_match("/$re/", $str)) {
+ die('non match. error');
+ }
}
var_dump(preg_match('/./', $str)); // this one was already deleted from the cache
diff --git a/ext/pcre/tests/grep2.phpt b/ext/pcre/tests/grep2.phpt
index 4c6f9b155f..9721dfbd9e 100644
--- a/ext/pcre/tests/grep2.phpt
+++ b/ext/pcre/tests/grep2.phpt
@@ -7,8 +7,6 @@ pcre.jit=1
--FILE--
<?php
-var_dump(preg_grep(1,array(),3,4));
-var_dump(preg_grep(1, 2));
var_dump(preg_grep('/+/', array()));
$array = array(5=>'a', 'x' => '1', 'xyz'=>'q6', 'h20');
@@ -23,13 +21,7 @@ var_dump(preg_last_error() == PREG_RECURSION_LIMIT_ERROR);
?>
--EXPECTF--
-Warning: preg_grep() expects at most 3 parameters, 4 given in %sgrep2.php on line 3
-NULL
-
-Warning: preg_grep() expects parameter 2 to be array, int given in %sgrep2.php on line 4
-NULL
-
-Warning: preg_grep(): Compilation failed: quantifier does not follow a repeatable item at offset 0 in %sgrep2.php on line 5
+Warning: preg_grep(): Compilation failed: quantifier does not follow a repeatable item at offset 0 in %sgrep2.php on line %d
bool(false)
array(3) {
[5]=>
diff --git a/ext/pcre/tests/marks.phpt b/ext/pcre/tests/marks.phpt
index 2a410834c6..e718e78093 100644
--- a/ext/pcre/tests/marks.phpt
+++ b/ext/pcre/tests/marks.phpt
@@ -4,7 +4,7 @@ Test support for PCRE marks
<?php
$regex = <<<'REGEX'
-/
+/
_ (a) (*MARK:A_MARK) _
| _ (b) _
| _ (c) (*MARK:C_MARK) _
diff --git a/ext/pcre/tests/no_jit_bug70110.phpt b/ext/pcre/tests/no_jit_bug70110.phpt
index fa673ac935..aece155257 100644
--- a/ext/pcre/tests/no_jit_bug70110.phpt
+++ b/ext/pcre/tests/no_jit_bug70110.phpt
@@ -9,8 +9,6 @@ var_dump(preg_match('/(*NO_JIT)^(A{1,2}B)+$$/',str_repeat('AB',8192)));
var_dump(preg_match('~(*NO_JIT)(a)*~', str_repeat('a', 5431), $match))
?>
-==DONE==
--EXPECT--
int(1)
int(1)
-==DONE==
diff --git a/ext/pcre/tests/pcre.constants.phpt b/ext/pcre/tests/pcre.constants.phpt
index 5abc6c72c2..d58454c225 100644
--- a/ext/pcre/tests/pcre.constants.phpt
+++ b/ext/pcre/tests/pcre.constants.phpt
@@ -18,7 +18,6 @@ echo "PREG_RECURSION_LIMIT_ERROR= ", PREG_RECURSION_LIMIT_ERROR, "\n";
echo "PREG_BAD_UTF8_ERROR= ", PREG_BAD_UTF8_ERROR, "\n";
?>
-===Done===
--EXPECT--
PCRE constants test
PREG_PATTERN_ORDER= 1
@@ -32,4 +31,3 @@ PREG_INTERNAL_ERROR= 1
PREG_BACKTRACK_LIMIT_ERROR= 2
PREG_RECURSION_LIMIT_ERROR= 3
PREG_BAD_UTF8_ERROR= 4
-===Done===
diff --git a/ext/pcre/tests/pcre_extra.phpt b/ext/pcre/tests/pcre_extra.phpt
index 4c5930f975..730c729939 100644
--- a/ext/pcre/tests/pcre_extra.phpt
+++ b/ext/pcre/tests/pcre_extra.phpt
@@ -1,5 +1,5 @@
--TEST--
-X (PCRE_EXTRA) modifier
+X (PCRE_EXTRA) modifier is ignored (no error, no change)
--FILE--
<?php
@@ -8,7 +8,8 @@ var_dump(preg_match('/\y/X', '\y'));
?>
--EXPECTF--
-int(1)
+Warning: preg_match(): Compilation failed: unrecognized character follows \ at offset 1 in %spcre_extra.php on line 3
+bool(false)
Warning: preg_match(): Compilation failed: unrecognized character follows \ at offset 1 in %spcre_extra.php on line 4
bool(false)
diff --git a/ext/pcre/tests/preg_filter.phpt b/ext/pcre/tests/preg_filter.phpt
index 6cd9802575..1625fc8450 100644
--- a/ext/pcre/tests/preg_filter.phpt
+++ b/ext/pcre/tests/preg_filter.phpt
@@ -10,7 +10,6 @@ $replace = array('A:$0', 'B:$0', 'C:$0');
var_dump(preg_filter($pattern, $replace, $subject));
?>
-===DONE===
--EXPECT--
array(6) {
[0]=>
@@ -26,4 +25,3 @@ array(6) {
[7]=>
string(3) "A:4"
}
-===DONE===
diff --git a/ext/pcre/tests/preg_grep_error1.phpt b/ext/pcre/tests/preg_grep_error1.phpt
index fcc36e7d91..1bf23bb640 100644
--- a/ext/pcre/tests/preg_grep_error1.phpt
+++ b/ext/pcre/tests/preg_grep_error1.phpt
@@ -6,7 +6,6 @@ Test preg_grep() function : error conditions - bad regular expressions
* proto array preg_grep(string regex, array input [, int flags])
* Function is implemented in ext/pcre/php_pcre.c
*/
-error_reporting(E_ALL&~E_NOTICE);
/*
* Testing how preg_grep reacts to being passed bad regexes
*/
@@ -19,11 +18,19 @@ $values = array('abcdef', //Regex without delimiter
);
$array = array(123, 'abc', 'test');
foreach($values as $value) {
- print "\nArg value is $value\n";
- var_dump(preg_grep($value, $array));
+ @print "\nArg value is $value\n";
+ try {
+ var_dump(preg_grep($value, $array));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
}
$value = new stdclass(); //Object
-var_dump(preg_grep($value, $array));
+try {
+ var_dump(preg_grep($value, $array));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done"
?>
--EXPECTF--
@@ -50,9 +57,7 @@ Warning: preg_grep(): Unknown modifier 'F' in %spreg_grep_error1.php on line %d
bool(false)
Arg value is Array
-
-Warning: preg_grep() expects parameter 1 to be string, array given in %spreg_grep_error1.php on line %d
-NULL
+preg_grep() expects parameter 1 to be string, array given
Arg value is /[a-zA-Z]/
array(2) {
@@ -61,7 +66,5 @@ array(2) {
[2]=>
string(4) "test"
}
-
-Warning: preg_grep() expects parameter 1 to be string, object given in %spreg_grep_error1.php on line %d
-NULL
+preg_grep() expects parameter 1 to be string, object given
Done
diff --git a/ext/pcre/tests/preg_match_all_error1.phpt b/ext/pcre/tests/preg_match_all_error1.phpt
index 95ab905d7d..6a5a0055a9 100644
--- a/ext/pcre/tests/preg_match_all_error1.phpt
+++ b/ext/pcre/tests/preg_match_all_error1.phpt
@@ -6,7 +6,6 @@ Test preg_match_all() function : error conditions - bad regular expressions
* proto int preg_match_all(string pattern, string subject, array subpatterns [, int flags [, int offset]])
* Function is implemented in ext/pcre/php_pcre.c
*/
-error_reporting(E_ALL&~E_NOTICE);
/*
* Testing how preg_match_all reacts to being passed the wrong type of regex argument
*/
@@ -19,12 +18,20 @@ $regex_array = array('abcdef', //Regex without delimiter
);
$subject = 'test';
foreach($regex_array as $regex_value) {
- print "\nArg value is $regex_value\n";
- var_dump(preg_match_all($regex_value, $subject, $matches1));
+ @print "\nArg value is $regex_value\n";
+ try {
+ var_dump(preg_match_all($regex_value, $subject, $matches1));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
var_dump($matches1);
}
$regex_value = new stdclass(); //Object
-var_dump(preg_match_all($regex_value, $subject, $matches));
+try {
+ var_dump(preg_match_all($regex_value, $subject, $matches));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump($matches);
?>
--EXPECTF--
@@ -55,9 +62,7 @@ bool(false)
NULL
Arg value is Array
-
-Warning: preg_match_all() expects parameter 1 to be string, array given in %spreg_match_all_error1.php on line %d
-bool(false)
+preg_match_all() expects parameter 1 to be string, array given
NULL
Arg value is /[a-zA-Z]/
@@ -75,7 +80,5 @@ array(1) {
string(1) "t"
}
}
-
-Warning: preg_match_all() expects parameter 1 to be string, object given in %spreg_match_all_error1.php on line %d
-bool(false)
+preg_match_all() expects parameter 1 to be string, object given
NULL
diff --git a/ext/pcre/tests/preg_match_all_error2.phpt b/ext/pcre/tests/preg_match_all_error2.phpt
index 1c55cce64e..29762739c4 100644
--- a/ext/pcre/tests/preg_match_all_error2.phpt
+++ b/ext/pcre/tests/preg_match_all_error2.phpt
@@ -6,19 +6,19 @@ Test preg_match_all() function : error conditions - wrong arg types
* proto int preg_match_all(string pattern, string subject, array subpatterns [, int flags [, int offset]])
* Function is implemented in ext/pcre/php_pcre.c
*/
-error_reporting(E_ALL&~E_NOTICE);
/*
* Testing how preg_match_all reacts to being passed the wrong type of input argument
*/
echo "*** Testing preg_match_all() : error conditions ***\n";
$regex = '/[a-zA-Z]/';
-$value = new stdclass(); //Object
-var_dump(preg_match_all($regex, $value, $matches));
-var_dump($matches);
$input = array(array('this is', 'a subarray'), 'test',);
foreach($input as $value) {
- print "\nArg value is: $value\n";
- var_dump(preg_match_all($regex, $value, $matches));
+ @print "\nArg value is: $value\n";
+ try {
+ var_dump(preg_match_all($regex, $value, $matches));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
var_dump($matches);
}
echo "Done";
@@ -26,14 +26,8 @@ echo "Done";
--EXPECTF--
*** Testing preg_match_all() : error conditions ***
-Warning: preg_match_all() expects parameter 2 to be string, object given in %spreg_match_all_error2.php on line %d
-bool(false)
-NULL
-
Arg value is: Array
-
-Warning: preg_match_all() expects parameter 2 to be string, array given in %spreg_match_all_error2.php on line %d
-bool(false)
+preg_match_all() expects parameter 2 to be string, array given
NULL
Arg value is: test
diff --git a/ext/pcre/tests/preg_match_all_error3.phpt b/ext/pcre/tests/preg_match_all_error3.phpt
index 6559b22d2e..2a25b47205 100644
--- a/ext/pcre/tests/preg_match_all_error3.phpt
+++ b/ext/pcre/tests/preg_match_all_error3.phpt
@@ -16,4 +16,9 @@ var_dump(preg_match_all($regex, $subject, 'test'));
echo "Done";
?>
--EXPECTF--
-Fatal error: Only variables can be passed by reference in %spreg_match_all_error3.php on line %d
+*** Testing preg_match_all() : error conditions ***
+
+Fatal error: Uncaught Error: Cannot pass parameter 3 by reference in %s:%d
+Stack trace:
+#0 {main}
+ thrown in %s on line %d
diff --git a/ext/pcre/tests/preg_match_basic_002.phpt b/ext/pcre/tests/preg_match_basic_002.phpt
index bca8f3e3c5..7aa125bda0 100644
--- a/ext/pcre/tests/preg_match_basic_002.phpt
+++ b/ext/pcre/tests/preg_match_basic_002.phpt
@@ -12,7 +12,6 @@ preg_match("/M(.*)/", $string, $matches);
var_dump($matches);
?>
-===Done===
--EXPECT--
array(2) {
[0]=>
@@ -20,4 +19,3 @@ array(2) {
[1]=>
string(1) "y"
}
-===Done===
diff --git a/ext/pcre/tests/preg_match_error1.phpt b/ext/pcre/tests/preg_match_error1.phpt
index 42bb5abd27..2f1b39d67f 100644
--- a/ext/pcre/tests/preg_match_error1.phpt
+++ b/ext/pcre/tests/preg_match_error1.phpt
@@ -6,7 +6,6 @@ Test preg_match() function : error conditions - bad regular expressions
* proto int preg_match(string pattern, string subject [, array subpatterns [, int flags [, int offset]]])
* Function is implemented in ext/pcre/php_pcre.c
*/
-error_reporting(E_ALL&~E_NOTICE);
/*
* Testing how preg_match reacts to being passed the wrong type of regex argument
*/
@@ -19,11 +18,19 @@ $regex_array = array('abcdef', //Regex without delimiter
);
$subject = 'this is a test';
foreach($regex_array as $regex_value) {
- print "\nArg value is $regex_value\n";
- var_dump(preg_match($regex_value, $subject));
+ @print "\nArg value is $regex_value\n";
+ try {
+ var_dump(preg_match($regex_value, $subject));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
}
$regex_value = new stdclass(); //Object
-var_dump(preg_match($regex_value, $subject));
+try {
+ var_dump(preg_match($regex_value, $subject));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
--EXPECTF--
*** Testing preg_match() : error conditions ***
@@ -49,12 +56,8 @@ Warning: preg_match(): Unknown modifier 'F' in %spreg_match_error1.php on line %
bool(false)
Arg value is Array
-
-Warning: preg_match() expects parameter 1 to be string, array given in %spreg_match_error1.php on line %d
-bool(false)
+preg_match() expects parameter 1 to be string, array given
Arg value is /[a-zA-Z]/
int(1)
-
-Warning: preg_match() expects parameter 1 to be string, object given in %spreg_match_error1.php on line %d
-bool(false)
+preg_match() expects parameter 1 to be string, object given
diff --git a/ext/pcre/tests/preg_match_error2.phpt b/ext/pcre/tests/preg_match_error2.phpt
index cb0917a228..18a42c6445 100644
--- a/ext/pcre/tests/preg_match_error2.phpt
+++ b/ext/pcre/tests/preg_match_error2.phpt
@@ -6,7 +6,6 @@ Test preg_match() function : error conditions - wrong arg types
* proto int preg_match(string pattern, string subject [, array subpatterns [, int flags [, int offset]]])
* Function is implemented in ext/pcre/php_pcre.c
*/
-error_reporting(E_ALL&~E_NOTICE);
/*
* Testing how preg_match reacts to being passed the wrong type of subject argument
*/
@@ -14,11 +13,19 @@ echo "*** Testing preg_match() : error conditions ***\n";
$regex = '/[a-zA-Z]/';
$input = array('this is a string', array('this is', 'a subarray'),);
foreach($input as $value) {
- print "\nArg value is: $value\n";
- var_dump(preg_match($regex, $value));
+ @print "\nArg value is: $value\n";
+ try {
+ var_dump(preg_match($regex, $value));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
}
$value = new stdclass(); //Object
-var_dump(preg_match($regex, $value));
+try {
+ var_dump(preg_match($regex, $value));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done";
?>
--EXPECTF--
@@ -28,10 +35,6 @@ Arg value is: this is a string
int(1)
Arg value is: Array
-
-Warning: preg_match() expects parameter 2 to be string, array given in %spreg_match_error2.php on line %d
-bool(false)
-
-Warning: preg_match() expects parameter 2 to be string, object given in %spreg_match_error2.php on line %d
-bool(false)
+preg_match() expects parameter 2 to be string, array given
+preg_match() expects parameter 2 to be string, object given
Done
diff --git a/ext/pcre/tests/preg_match_error4.phpt b/ext/pcre/tests/preg_match_error4.phpt
index 06aa82b469..8c8f25b6e9 100644
--- a/ext/pcre/tests/preg_match_error4.phpt
+++ b/ext/pcre/tests/preg_match_error4.phpt
@@ -926,10 +926,8 @@ if($count === false) {
throw new \RuntimeException('Failed to execute regex: Unknown error');
}
} else {
- var_dump("Done, $count matches.");
+ var_dump("Done, $count matches.");
}
?>
-==DONE==
--EXPECT--
string(16) "Done, 1 matches."
-==DONE==
diff --git a/ext/pcre/tests/preg_match_variation1.phpt b/ext/pcre/tests/preg_match_variation1.phpt
index 5fa50ce49c..91c7841ff7 100644
--- a/ext/pcre/tests/preg_match_variation1.phpt
+++ b/ext/pcre/tests/preg_match_variation1.phpt
@@ -13,10 +13,8 @@ $string = "-1";
preg_match('/[\-\+]?[0-9\.]*/', $string, $string);
var_dump($string);
?>
-===Done===
--EXPECT--
array(1) {
[0]=>
string(2) "-1"
}
-===Done===
diff --git a/ext/pcre/tests/preg_replace2.phpt b/ext/pcre/tests/preg_replace2.phpt
index 4a191f3331..ac88e876e6 100644
--- a/ext/pcre/tests/preg_replace2.phpt
+++ b/ext/pcre/tests/preg_replace2.phpt
@@ -9,8 +9,6 @@ if (@preg_match('/./u', '') === false) {
--FILE--
<?php
-var_dump(preg_replace('', array(), ''));
-
var_dump(preg_replace(array('/\da(.)/ui', '@..@'), '$1', '12Abc'));
var_dump(preg_replace(array('/\da(.)/ui', '@(.)@'), '$1', array('x','a2aA', '1av2Ab')));
@@ -18,12 +16,8 @@ var_dump(preg_replace(array('/\da(.)/ui', '@(.)@'), '$1', array('x','a2aA', '1av
var_dump(preg_replace(array('/[\w]+/'), array('$'), array('xyz', 'bdbd')));
var_dump(preg_replace(array('/\s+/', '~[b-d]~'), array('$'), array('x y', 'bd bc')));
-echo "==done==\n";
-
?>
---EXPECTF--
-Warning: preg_replace(): Parameter mismatch, pattern is a string while replacement is an array in %spreg_replace2.php on line 3
-bool(false)
+--EXPECT--
string(1) "c"
array(3) {
[0]=>
@@ -45,4 +39,3 @@ array(2) {
[1]=>
string(1) "$"
}
-==done==
diff --git a/ext/pcre/tests/preg_replace_callback2.phpt b/ext/pcre/tests/preg_replace_callback2.phpt
index 1fe78d59ee..42c613726f 100644
--- a/ext/pcre/tests/preg_replace_callback2.phpt
+++ b/ext/pcre/tests/preg_replace_callback2.phpt
@@ -4,7 +4,7 @@ preg_replace_callback() 2
<?php
function f() {
- throw new Exception();
+ throw new Exception();
}
try {
@@ -12,7 +12,7 @@ var_dump(preg_replace_callback('/\w/', 'f', 'z'));
} catch(Exception $e) {}
function g($x) {
- return "'$x[0]'";
+ return "'$x[0]'";
}
var_dump(preg_replace_callback('@\b\w{1,2}\b@', 'g', array('a b3 bcd', 'v' => 'aksfjk', 12 => 'aa bb')));
@@ -31,7 +31,7 @@ array(3) {
string(9) "'aa' 'bb'"
}
-Notice: Array to string conversion in %spreg_replace_callback2.php on line 17
+Warning: Array to string conversion in %s on line %d
array(1) {
[0]=>
string(7) "'A'rray"
diff --git a/ext/pcre/tests/preg_replace_callback3.phpt b/ext/pcre/tests/preg_replace_callback3.phpt
index f5c87176f9..842dfacb39 100644
--- a/ext/pcre/tests/preg_replace_callback3.phpt
+++ b/ext/pcre/tests/preg_replace_callback3.phpt
@@ -3,30 +3,14 @@ preg_replace_callback() 3
--FILE--
<?php
-var_dump(preg_replace_callback());
-var_dump(preg_replace_callback(1));
-var_dump(preg_replace_callback(1,2));
var_dump(preg_replace_callback(1,2,3));
var_dump(preg_replace_callback(1,2,3,4));
$a = 5;
var_dump(preg_replace_callback(1,2,3,4,$a));
-$a = "";
-var_dump(preg_replace_callback("","","","",$a));
-$a = array();
-var_dump(preg_replace_callback($a,$a,$a,$a,$a));
echo "Done\n";
?>
--EXPECTF--
-Warning: preg_replace_callback() expects at least 3 parameters, 0 given in %s on line %d
-NULL
-
-Warning: preg_replace_callback() expects at least 3 parameters, 1 given in %s on line %d
-NULL
-
-Warning: preg_replace_callback() expects at least 3 parameters, 2 given in %s on line %d
-NULL
-
Warning: preg_replace_callback(): Requires argument 2, '2', to be a valid callback in %s on line %d
string(1) "3"
@@ -35,10 +19,4 @@ string(1) "3"
Warning: preg_replace_callback(): Requires argument 2, '2', to be a valid callback in %s on line %d
string(1) "3"
-
-Warning: preg_replace_callback() expects parameter 4 to be int, string given in %s on line %d
-NULL
-
-Warning: preg_replace_callback() expects parameter 4 to be int, array given in %s on line %d
-NULL
Done
diff --git a/ext/pcre/tests/preg_replace_callback_array.phpt b/ext/pcre/tests/preg_replace_callback_array.phpt
index 01973eaa32..ffefa2cc26 100644
--- a/ext/pcre/tests/preg_replace_callback_array.phpt
+++ b/ext/pcre/tests/preg_replace_callback_array.phpt
@@ -4,41 +4,41 @@ preg_replace_callback_array() basic functions
<?php
class Rep {
- public function __invoke() {
- return "d";
- }
+ public function __invoke() {
+ return "d";
+ }
}
class Foo {
- public static function rep($rep) {
- return "ok";
- }
+ public static function rep($rep) {
+ return "ok";
+ }
}
function b() {
- return "b";
+ return "b";
}
var_dump(preg_replace_callback_array(
- array(
- "/a/" => 'b',
- "/b/" => function () { return "c"; },
- "/c/" => new Rep,
- '/d/' => array("Foo", "rep")), 'a'));
+ array(
+ "/a/" => 'b',
+ "/b/" => function () { return "c"; },
+ "/c/" => new Rep,
+ '/d/' => array("Foo", "rep")), 'a'));
var_dump(preg_replace_callback_array(
- array(
- "/a/" => 'b',
- "/c/" => new Rep,
- "/b/" => function () { return "ok"; },
- '/d/' => array("Foo", "rep")), 'a'));
+ array(
+ "/a/" => 'b',
+ "/c/" => new Rep,
+ "/b/" => function () { return "ok"; },
+ '/d/' => array("Foo", "rep")), 'a'));
var_dump(preg_replace_callback_array(
- array(
- '/d/' => array("Foo", "rep"),
- "/c/" => new Rep,
- "/a/" => 'b',
- "/b/" => function($a) { return "ok"; }), 'a', -1, $count));
+ array(
+ '/d/' => array("Foo", "rep"),
+ "/c/" => new Rep,
+ "/a/" => 'b',
+ "/b/" => function($a) { return "ok"; }), 'a', -1, $count));
var_dump($count);
?>
diff --git a/ext/pcre/tests/preg_replace_callback_array2.phpt b/ext/pcre/tests/preg_replace_callback_array2.phpt
index f2f20ef645..f333d06dcb 100644
--- a/ext/pcre/tests/preg_replace_callback_array2.phpt
+++ b/ext/pcre/tests/preg_replace_callback_array2.phpt
@@ -3,59 +3,26 @@ preg_replace_callback_array() errors
--FILE--
<?php
-var_dump(preg_replace_callback_array());
-var_dump(preg_replace_callback_array(1));
-var_dump(preg_replace_callback_array(1,2));
-var_dump(preg_replace_callback_array(1,2,3));
-$a = 5;
-var_dump(preg_replace_callback_array(1,2,3,$a));
-$a = "";
-var_dump(preg_replace_callback_array(array("" => ""),"","",$a));
$a = array();
$b = "";
-var_dump(preg_replace_callback($a, $a, $a, $a, $b));
-var_dump($b);
-$b = "";
var_dump(preg_replace_callback_array(array("xx" => "s"), $a, -1, $b));
var_dump($b);
function f() {
- static $count = 1;
- throw new Exception($count);
+ static $count = 1;
+ throw new Exception($count);
}
var_dump(preg_replace_callback_array(array('/\w' => 'f'), 'z'));
try {
- var_dump(preg_replace_callback_array(array('/\w/' => 'f', '/.*/' => 'f'), 'z'));
+ var_dump(preg_replace_callback_array(array('/\w/' => 'f', '/.*/' => 'f'), 'z'));
} catch (Exception $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
echo "Done\n";
?>
--EXPECTF--
-Warning: preg_replace_callback_array() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: preg_replace_callback_array() expects at least 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: preg_replace_callback_array() expects parameter 1 to be array, int given in %s on line %d
-NULL
-
-Warning: preg_replace_callback_array() expects parameter 1 to be array, int given in %s on line %d
-NULL
-
-Warning: preg_replace_callback_array() expects parameter 1 to be array, int given in %s on line %d
-NULL
-
-Warning: preg_replace_callback_array() expects parameter 3 to be int, string given in %s on line %d
-NULL
-
-Warning: preg_replace_callback() expects parameter 4 to be int, array given in %s on line %d
-NULL
-string(0) ""
-
Warning: preg_replace_callback_array(): 's' is not a valid callback in %spreg_replace_callback_array2.php on line %d
array(0) {
}
diff --git a/ext/pcre/tests/preg_replace_callback_error1.phpt b/ext/pcre/tests/preg_replace_callback_error1.phpt
index 313064eab8..120944b33b 100644
--- a/ext/pcre/tests/preg_replace_callback_error1.phpt
+++ b/ext/pcre/tests/preg_replace_callback_error1.phpt
@@ -6,7 +6,6 @@ Test preg_replace_callback() function : error
* proto string preg_replace(mixed regex, mixed replace, mixed subject [, int limit [, count]])
* Function is implemented in ext/pcre/php_pcre.c
*/
-error_reporting(E_ALL&~E_NOTICE);
/*
* Testing how preg_replace_callback reacts to being passed the wrong type of regex argument
*/
@@ -15,7 +14,7 @@ $regex_array = array('abcdef', //Regex without delimiters
'/[a-zA-Z]', //Regex without closing delimiter
'[a-zA-Z]/', //Regex without opening delimiter
'/[a-zA-Z]/F', array('[a-z]', //Array of Regexes
-'[A-Z]', '[0-9]'), '/[a-zA-Z]/'); //Regex string
+'[A-Z]', '[0-9]'), '/[0-9]/'); //Regex string
$replacement = array('zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine');
function integer_word($matches) {
global $replacement;
@@ -23,11 +22,10 @@ function integer_word($matches) {
}
$subject = 'number 1.';
foreach($regex_array as $regex_value) {
- print "\nArg value is $regex_value\n";
+ @print "\nArg value is $regex_value\n";
var_dump(preg_replace_callback($regex_value, 'integer_word', $subject));
}
?>
-===Done===
--EXPECTF--
*** Testing preg_replace_callback() : error conditions ***
@@ -54,6 +52,5 @@ NULL
Arg value is Array
string(9) "number 1."
-Arg value is /[a-zA-Z]/
-string(3) " 1."
-===Done===
+Arg value is /[0-9]/
+string(11) "number one."
diff --git a/ext/pcre/tests/preg_replace_edit_basic.phpt b/ext/pcre/tests/preg_replace_edit_basic.phpt
index b272f379be..d5a251392a 100644
--- a/ext/pcre/tests/preg_replace_edit_basic.phpt
+++ b/ext/pcre/tests/preg_replace_edit_basic.phpt
@@ -16,7 +16,7 @@ var_dump(preg_replace('<- This is a string$>',
var_dump(preg_replace('<[0-35-9]>',
'4', $string, //finds any number that's not 4 and replaces it with a 4
- '5', $count)); //limits to 5 replacements returns 444444789
+ '5', $count)); //limits to 5 replacements returns 444444789
var_dump($count); //counts the number of replacements made (5)
diff --git a/ext/pcre/tests/preg_replace_error1.phpt b/ext/pcre/tests/preg_replace_error1.phpt
index 780556956a..669a5c6c4e 100644
--- a/ext/pcre/tests/preg_replace_error1.phpt
+++ b/ext/pcre/tests/preg_replace_error1.phpt
@@ -6,7 +6,6 @@ Test preg_replace() function : error - bad regular expressions
* proto string preg_replace(mixed regex, mixed replace, mixed subject [, int limit [, count]])
* Function is implemented in ext/pcre/php_pcre.c
*/
-error_reporting(E_ALL&~E_NOTICE);
/*
* Testing how preg_replace reacts to being passed the wrong type of regex argument
*/
@@ -20,7 +19,7 @@ $regex_array = array('abcdef', //Regex without delimiter
$replace = 1;
$subject = 'a';
foreach($regex_array as $regex_value) {
- print "\nArg value is $regex_value\n";
+ @print "\nArg value is $regex_value\n";
var_dump(preg_replace($regex_value, $replace, $subject));
}
$regex_value = new stdclass(); //Object
diff --git a/ext/pcre/tests/preg_replace_error2.phpt b/ext/pcre/tests/preg_replace_error2.phpt
index a334b2fefd..eeff2fae54 100644
--- a/ext/pcre/tests/preg_replace_error2.phpt
+++ b/ext/pcre/tests/preg_replace_error2.phpt
@@ -6,7 +6,6 @@ Test preg_replace() function : error conditions - wrong arg types
* proto string preg_replace(mixed regex, mixed replace, mixed subject [, int limit [, count]])
* Function is implemented in ext/pcre/php_pcre.c
*/
-error_reporting(E_ALL&~E_NOTICE);
/*
* Testing how preg_replace reacts to being passed the wrong type of replacement argument
*/
@@ -15,8 +14,12 @@ $regex = '/[a-zA-Z]/';
$replace = array('this is a string', array('this is', 'a subarray'),);
$subject = 'test';
foreach($replace as $value) {
- print "\nArg value is: $value\n";
- var_dump(preg_replace($regex, $value, $subject));
+ @print "\nArg value is: $value\n";
+ try {
+ var_dump(preg_replace($regex, $value, $subject));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
}
$value = new stdclass(); //Object
try {
@@ -33,8 +36,6 @@ Arg value is: this is a string
string(64) "this is a stringthis is a stringthis is a stringthis is a string"
Arg value is: Array
-
-Warning: preg_replace(): Parameter mismatch, pattern is a string while replacement is an array in %spreg_replace_error2.php on line %d
-bool(false)
+Parameter mismatch, pattern is a string while replacement is an array
Object of class stdClass could not be converted to string
Done
diff --git a/ext/pcre/tests/preg_split_error1.phpt b/ext/pcre/tests/preg_split_error1.phpt
index 79942a9480..b69caf1aed 100644
--- a/ext/pcre/tests/preg_split_error1.phpt
+++ b/ext/pcre/tests/preg_split_error1.phpt
@@ -6,7 +6,6 @@ Test preg_split() function : error conditions - bad regular expressions
* proto array preg_split(string pattern, string subject [, int limit [, int flags]])
* Function is implemented in ext/pcre/php_pcre.c
*/
-error_reporting(E_ALL&~E_NOTICE);
/*
* Testing how preg_split reacts to being passed the wrong type of regex argument
*/
@@ -19,11 +18,19 @@ $regex_array = array('abcdef', //Regex without delimiter
);
$subject = '1 2 a 3 4 b 5 6';
foreach($regex_array as $regex_value) {
- print "\nArg value is $regex_value\n";
- var_dump(preg_split($regex_value, $subject));
+ @print "\nArg value is $regex_value\n";
+ try {
+ var_dump(preg_split($regex_value, $subject));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
}
$regex_value = new stdclass(); //Object
-var_dump(preg_split($regex_value, $subject));
+try {
+ var_dump(preg_split($regex_value, $subject));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
--EXPECTF--
*** Testing preg_split() : error conditions ***
@@ -49,9 +56,7 @@ Warning: preg_split(): Unknown modifier 'F' in %spreg_split_error1.php on line %
bool(false)
Arg value is Array
-
-Warning: preg_split() expects parameter 1 to be string, array given in %spreg_split_error1.php on line %d
-bool(false)
+preg_split() expects parameter 1 to be string, array given
Arg value is /[a-zA-Z]/
array(3) {
@@ -62,6 +67,4 @@ array(3) {
[2]=>
string(4) " 5 6"
}
-
-Warning: preg_split() expects parameter 1 to be string, object given in %spreg_split_error1.php on line %d
-bool(false)
+preg_split() expects parameter 1 to be string, object given
diff --git a/ext/pcre/tests/skip_001.inc b/ext/pcre/tests/skip_001.inc
index 35434ece5b..13035969b4 100644
--- a/ext/pcre/tests/skip_001.inc
+++ b/ext/pcre/tests/skip_001.inc
@@ -1,5 +1,5 @@
<?php
if (!@setlocale(LC_ALL, 'pt_PT', 'pt', 'pt_PT.ISO8859-1', 'portuguese')) {
- die('skip pt locale not available');
+ die('skip pt locale not available');
}
diff --git a/ext/pcre/tests/skip_002.inc b/ext/pcre/tests/skip_002.inc
index 7f3a253faa..e62864b6a8 100644
--- a/ext/pcre/tests/skip_002.inc
+++ b/ext/pcre/tests/skip_002.inc
@@ -1,5 +1,5 @@
<?php
if (@preg_match('/./u', '') === false) {
- die('skip');
+ die('skip');
}
diff --git a/ext/pcre/tests/skip_003.inc b/ext/pcre/tests/skip_003.inc
index af2f548ca1..5a03c5802c 100644
--- a/ext/pcre/tests/skip_003.inc
+++ b/ext/pcre/tests/skip_003.inc
@@ -1,5 +1,5 @@
<?php
if (@preg_match_all('/\p{N}/', '0123456789', $dummy) === false) {
- die('skip');
+ die('skip');
}
diff --git a/ext/pcre/tests/split.phpt b/ext/pcre/tests/split.phpt
index c87d1b03a9..df4b9af92f 100644
--- a/ext/pcre/tests/split.phpt
+++ b/ext/pcre/tests/split.phpt
@@ -3,7 +3,6 @@ preg_split()
--FILE--
<?php
-var_dump(preg_split());
var_dump(preg_split('/*/', 'x'));
var_dump(preg_split('/[\s, ]+/', 'x yy,zzz'));
@@ -17,10 +16,7 @@ var_dump(preg_split('/\d*/', 'ab2c3u', -1, PREG_SPLIT_NO_EMPTY));
?>
--EXPECTF--
-Warning: preg_split() expects at least 2 parameters, 0 given in %ssplit.php on line 3
-bool(false)
-
-Warning: preg_split(): Compilation failed: quantifier does not follow a repeatable item at offset 0 in %ssplit.php on line 4
+Warning: preg_split(): Compilation failed: quantifier does not follow a repeatable item at offset 0 in %ssplit.php on line %d
bool(false)
array(3) {
[0]=>
diff --git a/ext/pcre/tests/split2.phpt b/ext/pcre/tests/split2.phpt
index 5c77c6d1bc..5fafee3b87 100644
--- a/ext/pcre/tests/split2.phpt
+++ b/ext/pcre/tests/split2.phpt
@@ -13,7 +13,6 @@ var_dump(preg_split('/(\d*)/', 'ab2c3u', -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPL
var_dump(preg_split('/(\d*)/', 'ab2c3u', -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_OFFSET_CAPTURE));
-var_dump(preg_last_error(1));
ini_set('pcre.recursion_limit', 1);
var_dump(preg_last_error() == PREG_NO_ERROR);
var_dump(preg_split('/(\d*)/', 'ab2c3u'));
@@ -306,9 +305,6 @@ array(6) {
int(5)
}
}
-
-Warning: preg_last_error() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
bool(true)
bool(false)
bool(true)
diff --git a/ext/pdo/pdo.c b/ext/pdo/pdo.c
index 88839bf61f..2f41b29f1f 100644
--- a/ext/pdo/pdo.c
+++ b/ext/pdo/pdo.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -31,6 +29,7 @@
#include "php_pdo_int.h"
#include "zend_exceptions.h"
#include "ext/spl/spl_exceptions.h"
+#include "pdo_arginfo.h"
zend_class_entry *pdo_dbh_ce, *pdo_dbstmt_ce, *pdo_row_ce;
@@ -86,9 +85,7 @@ PHP_FUNCTION(pdo_drivers)
{
pdo_driver_t *pdriver;
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
array_init(return_value);
@@ -98,11 +95,6 @@ PHP_FUNCTION(pdo_drivers)
}
/* }}} */
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO(arginfo_pdo_drivers, 0)
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ pdo_functions[] */
const zend_function_entry pdo_functions[] = {
PHP_FE(pdo_drivers, arginfo_pdo_drivers)
diff --git a/ext/pdo/pdo.stub.php b/ext/pdo/pdo.stub.php
new file mode 100644
index 0000000000..13969edb57
--- /dev/null
+++ b/ext/pdo/pdo.stub.php
@@ -0,0 +1,133 @@
+<?php
+
+/* pdo.c */
+
+function pdo_drivers(): array {}
+
+/* pdo_dbh.c */
+
+class PDO {
+ public function __construct(string $dsn, ?string $username = null, ?string $passwd = null, ?array $options = null) {}
+
+ /** @return bool */
+ public function beginTransaction() {}
+
+ /** @return bool */
+ public function commit() {}
+
+ /** @return string|null */
+ public function errorCode() {}
+
+ /** @return array */
+ public function errorInfo() {}
+
+ /** @return int|false */
+ public function exec(string $statement) {}
+
+ /** @return mixed */
+ public function getAttribute(int $attribute) {}
+
+ /** @return array */
+ public static function getAvailableDrivers() {}
+
+ /** @return bool */
+ public function inTransaction() {}
+
+ /** @return string|false */
+ public function lastInsertId(?string $name = null) {}
+
+ /** @return PDOStatement|false */
+ public function prepare(string $statement, array $driver_options = []) {}
+
+ /** @return PDOStatement|false */
+ public function query(string $statement) {}
+
+ /** @return string|false */
+ public function quote(string $string, int $parameter_type = PDO::PARAM_STR) {}
+
+ /** @return bool */
+ public function rollBack() {}
+
+ /**
+ * @param mixed $value
+ * @return bool
+ */
+ public function setAttribute(int $attribute, $value) {}
+}
+
+/* pdo_stmt.c */
+
+class PDOStatement implements Traversable {
+ /**
+ * @param mixed $driverdata
+ * @return bool
+ */
+ public function bindColumn(int|string $column, &$param, int $type = 0, int $maxlen = 0, $driverdata = null) {}
+
+ /**
+ * @param mixed $driver_options
+ * @return bool
+ */
+ public function bindParam(int|string $parameter, &$param, int $type = PDO::PARAM_STR, int $maxlen = 0, $driverdata = null) {}
+
+ /**
+ * @param int|string $parameter
+ * @param mixed $value
+ * @return bool
+ */
+ public function bindValue($parameter, $value, int $type = PDO::PARAM_STR) {}
+
+ /** @return bool */
+ public function closeCursor() {}
+
+ /** @return int|false */
+ public function columnCount() {}
+
+ /** @return false|null */
+ public function debugDumpParams() {}
+
+ /** @return string|false|null */
+ public function errorCode() {}
+
+ /** @return array|false */
+ public function errorInfo() {}
+
+ /** @return bool */
+ public function execute(?array $input_parameters = null) {}
+
+ /** @return mixed */
+ public function fetch(int $fetch_style = PDO::FETCH_BOTH, int $cursor_orientation = PDO::FETCH_ORI_NEXT, int $cursor_offset = 0) {}
+
+ /**
+ * @param mixed $fetch_argument
+ * @return array|false
+ */
+ public function fetchAll(int $fetch_style = PDO::FETCH_BOTH, $fetch_argument = UNKNOWN, array $ctor_args = []) {}
+
+ /** @return mixed */
+ public function fetchColumn(int $column_number = 0) {}
+
+ /** @return mixed */
+ public function fetchObject(?string $class_name = "stdClass", ?array $ctor_args = null) {}
+
+ /** @return mixed */
+ public function getAttribute(int $attribute) {}
+
+ /** @return array|false */
+ public function getColumnMeta(int $column) {}
+
+ /** @return bool */
+ public function nextRowset() {}
+
+ /** @return int|false */
+ public function rowCount() {}
+
+ /**
+ * @param mixed $value
+ * @return bool
+ */
+ public function setAttribute(int $attribute, $value) {}
+
+ /** @return bool */
+ public function setFetchMode(int $mode, $param1 = UNKNOWN, $param2 = UNKNOWN) {}
+}
diff --git a/ext/pdo/pdo_arginfo.h b/ext/pdo/pdo_arginfo.h
new file mode 100644
index 0000000000..56c1825198
--- /dev/null
+++ b/ext/pdo/pdo_arginfo.h
@@ -0,0 +1,130 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pdo_drivers, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDO___construct, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, dsn, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, username, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, passwd, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, options, IS_ARRAY, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDO_beginTransaction, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_PDO_commit arginfo_class_PDO_beginTransaction
+
+#define arginfo_class_PDO_errorCode arginfo_class_PDO_beginTransaction
+
+#define arginfo_class_PDO_errorInfo arginfo_class_PDO_beginTransaction
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDO_exec, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, statement, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDO_getAttribute, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, attribute, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_PDO_getAvailableDrivers arginfo_class_PDO_beginTransaction
+
+#define arginfo_class_PDO_inTransaction arginfo_class_PDO_beginTransaction
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDO_lastInsertId, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDO_prepare, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, statement, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, driver_options, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_PDO_query arginfo_class_PDO_exec
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDO_quote, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, parameter_type, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_PDO_rollBack arginfo_class_PDO_beginTransaction
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDO_setAttribute, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, attribute, IS_LONG, 0)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_bindColumn, 0, 0, 2)
+ ZEND_ARG_TYPE_MASK(0, column, MAY_BE_LONG|MAY_BE_STRING)
+ ZEND_ARG_INFO(1, param)
+ ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, maxlen, IS_LONG, 0)
+ ZEND_ARG_INFO(0, driverdata)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_bindParam, 0, 0, 2)
+ ZEND_ARG_TYPE_MASK(0, parameter, MAY_BE_LONG|MAY_BE_STRING)
+ ZEND_ARG_INFO(1, param)
+ ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, maxlen, IS_LONG, 0)
+ ZEND_ARG_INFO(0, driverdata)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_bindValue, 0, 0, 2)
+ ZEND_ARG_INFO(0, parameter)
+ ZEND_ARG_INFO(0, value)
+ ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_PDOStatement_closeCursor arginfo_class_PDO_beginTransaction
+
+#define arginfo_class_PDOStatement_columnCount arginfo_class_PDO_beginTransaction
+
+#define arginfo_class_PDOStatement_debugDumpParams arginfo_class_PDO_beginTransaction
+
+#define arginfo_class_PDOStatement_errorCode arginfo_class_PDO_beginTransaction
+
+#define arginfo_class_PDOStatement_errorInfo arginfo_class_PDO_beginTransaction
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_execute, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, input_parameters, IS_ARRAY, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_fetch, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, fetch_style, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, cursor_orientation, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, cursor_offset, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_fetchAll, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, fetch_style, IS_LONG, 0)
+ ZEND_ARG_INFO(0, fetch_argument)
+ ZEND_ARG_TYPE_INFO(0, ctor_args, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_fetchColumn, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, column_number, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_fetchObject, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, class_name, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, ctor_args, IS_ARRAY, 1)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_PDOStatement_getAttribute arginfo_class_PDO_getAttribute
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_getColumnMeta, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, column, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_PDOStatement_nextRowset arginfo_class_PDO_beginTransaction
+
+#define arginfo_class_PDOStatement_rowCount arginfo_class_PDO_beginTransaction
+
+#define arginfo_class_PDOStatement_setAttribute arginfo_class_PDO_setAttribute
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PDOStatement_setFetchMode, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ ZEND_ARG_INFO(0, param1)
+ ZEND_ARG_INFO(0, param2)
+ZEND_END_ARG_INFO()
diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c
index aa0edbbb47..9a1e0f53f6 100644
--- a/ext/pdo/pdo_dbh.c
+++ b/ext/pdo/pdo_dbh.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -34,6 +32,7 @@
#include "zend_object_handlers.h"
#include "zend_hash.h"
#include "zend_interfaces.h"
+#include "pdo_arginfo.h"
static int pdo_dbh_attribute_set(pdo_dbh_t *dbh, zend_long attr, zval *value);
@@ -209,12 +208,12 @@ static PHP_METHOD(PDO, dbh_constructor)
int call_factory = 1;
zend_error_handling zeh;
- ZEND_PARSE_PARAMETERS_START_EX(ZEND_PARSE_PARAMS_THROW, 1, 4)
+ ZEND_PARSE_PARAMETERS_START(1, 4)
Z_PARAM_STRING(data_source, data_source_len)
Z_PARAM_OPTIONAL
- Z_PARAM_STRING_EX(username, usernamelen, 1, 0)
- Z_PARAM_STRING_EX(password, passwordlen, 1, 0)
- Z_PARAM_ARRAY_EX(options, 1, 0)
+ Z_PARAM_STRING_OR_NULL(username, usernamelen)
+ Z_PARAM_STRING_OR_NULL(password, passwordlen)
+ Z_PARAM_ARRAY_OR_NULL(options)
ZEND_PARSE_PARAMETERS_END();
/* parse the data source name */
@@ -227,7 +226,7 @@ static PHP_METHOD(PDO, dbh_constructor)
snprintf(alt_dsn, sizeof(alt_dsn), "pdo.dsn.%s", data_source);
if (FAILURE == cfg_get_string(alt_dsn, &ini_dsn)) {
zend_throw_exception_ex(php_pdo_get_exception(), 0, "invalid data source name");
- return;
+ RETURN_THROWS();
}
data_source = ini_dsn;
@@ -235,7 +234,7 @@ static PHP_METHOD(PDO, dbh_constructor)
if (!colon) {
zend_throw_exception_ex(php_pdo_get_exception(), 0, "invalid data source name (via INI: %s)", alt_dsn);
- return;
+ RETURN_THROWS();
}
}
@@ -244,12 +243,12 @@ static PHP_METHOD(PDO, dbh_constructor)
data_source = dsn_from_uri(data_source + sizeof("uri:")-1, alt_dsn, sizeof(alt_dsn));
if (!data_source) {
zend_throw_exception_ex(php_pdo_get_exception(), 0, "invalid data source URI");
- return;
+ RETURN_THROWS();
}
colon = strchr(data_source, ':');
if (!colon) {
zend_throw_exception_ex(php_pdo_get_exception(), 0, "invalid data source name (via URI)");
- return;
+ RETURN_THROWS();
}
}
@@ -259,7 +258,7 @@ static PHP_METHOD(PDO, dbh_constructor)
/* NB: don't want to include the data_source in the error message as
* it might contain a password */
zend_throw_exception_ex(php_pdo_get_exception(), 0, "could not find driver");
- return;
+ RETURN_THROWS();
}
dbh = Z_PDO_DBH_P(object);
@@ -344,7 +343,7 @@ static PHP_METHOD(PDO, dbh_constructor)
dbh->auto_commit = pdo_attr_lval(options, PDO_ATTR_AUTOCOMMIT, 1);
if (!dbh->data_source || (username && !dbh->username) || (password && !dbh->password)) {
- php_error_docref(NULL, E_ERROR, "out of memory");
+ php_error_docref(NULL, E_ERROR, "Out of memory");
}
zend_replace_error_handling(EH_THROW, pdo_exception_ce, &zeh);
@@ -419,13 +418,13 @@ static zval *pdo_stmt_instantiate(pdo_dbh_t *dbh, zval *object, zend_class_entry
static void pdo_stmt_construct(zend_execute_data *execute_data, pdo_stmt_t *stmt, zval *object, zend_class_entry *dbstmt_ce, zval *ctor_args) /* {{{ */
{
zval query_string;
- zval z_key;
+ zend_string *key;
ZVAL_STRINGL(&query_string, stmt->query_string, stmt->query_stringlen);
- ZVAL_STRINGL(&z_key, "queryString", sizeof("queryString") - 1);
- zend_std_write_property(object, &z_key, &query_string, NULL);
+ key = zend_string_init("queryString", sizeof("queryString") - 1, 0);
+ zend_std_write_property(Z_OBJ_P(object), key, &query_string, NULL);
zval_ptr_dtor(&query_string);
- zval_ptr_dtor(&z_key);
+ zend_string_release_ex(key, 0);
if (dbstmt_ce->constructor) {
zend_fcall_info fci;
@@ -471,7 +470,7 @@ static PHP_METHOD(PDO, prepare)
Z_PARAM_STRING(statement, statement_len)
Z_PARAM_OPTIONAL
Z_PARAM_ARRAY(options)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
PDO_DBH_CLEAR_ERR();
PDO_CONSTRUCT_CHECK;
@@ -561,21 +560,20 @@ static PHP_METHOD(PDO, beginTransaction)
{
pdo_dbh_t *dbh = Z_PDO_DBH_P(ZEND_THIS);
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
+
PDO_CONSTRUCT_CHECK;
if (dbh->in_txn) {
zend_throw_exception_ex(php_pdo_get_exception(), 0, "There is already an active transaction");
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (!dbh->methods->begin) {
/* TODO: this should be an exception; see the auto-commit mode
* comments below */
zend_throw_exception_ex(php_pdo_get_exception(), 0, "This driver doesn't support transactions");
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (dbh->methods->begin(dbh)) {
@@ -594,14 +592,13 @@ static PHP_METHOD(PDO, commit)
{
pdo_dbh_t *dbh = Z_PDO_DBH_P(ZEND_THIS);
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
+
PDO_CONSTRUCT_CHECK;
if (!dbh->in_txn) {
zend_throw_exception_ex(php_pdo_get_exception(), 0, "There is no active transaction");
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (dbh->methods->commit(dbh)) {
@@ -620,14 +617,13 @@ static PHP_METHOD(PDO, rollBack)
{
pdo_dbh_t *dbh = Z_PDO_DBH_P(ZEND_THIS);
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
+
PDO_CONSTRUCT_CHECK;
if (!dbh->in_txn) {
zend_throw_exception_ex(php_pdo_get_exception(), 0, "There is no active transaction");
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (dbh->methods->rollback(dbh)) {
@@ -646,9 +642,8 @@ static PHP_METHOD(PDO, inTransaction)
{
pdo_dbh_t *dbh = Z_PDO_DBH_P(ZEND_THIS);
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
+
PDO_CONSTRUCT_CHECK;
if (!dbh->methods->in_transaction) {
@@ -824,7 +819,7 @@ static PHP_METHOD(PDO, setAttribute)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_LONG(attr)
Z_PARAM_ZVAL(value)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
PDO_DBH_CLEAR_ERR();
PDO_CONSTRUCT_CHECK;
@@ -845,7 +840,7 @@ static PHP_METHOD(PDO, getAttribute)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_LONG(attr)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
PDO_DBH_CLEAR_ERR();
PDO_CONSTRUCT_CHECK;
@@ -901,8 +896,8 @@ static PHP_METHOD(PDO, getAttribute)
}
/* }}} */
-/* {{{ proto int PDO::exec(string query)
- Execute a query that does not return a row set, returning the number of affected rows */
+/* {{{ proto int PDO::exec(string statement)
+ Execute a statement that does not return a row set, returning the number of affected rows */
static PHP_METHOD(PDO, exec)
{
pdo_dbh_t *dbh = Z_PDO_DBH_P(ZEND_THIS);
@@ -912,7 +907,7 @@ static PHP_METHOD(PDO, exec)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_STRING(statement, statement_len)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (!statement_len) {
pdo_raise_impl_error(dbh, NULL, "HY000", "trying to execute an empty query");
@@ -930,8 +925,8 @@ static PHP_METHOD(PDO, exec)
}
/* }}} */
-/* {{{ proto string PDO::lastInsertId([string seqname])
- Returns the id of the last row that we affected on this connection. Some databases require a sequence or table name to be passed in. Not always meaningful. */
+/* {{{ proto string PDO::lastInsertId([string name])
+ Returns the id of the last row that we affected on this connection. Some databases require a sequence or table name to be passed in. Not always meaningful. */
static PHP_METHOD(PDO, lastInsertId)
{
pdo_dbh_t *dbh = Z_PDO_DBH_P(ZEND_THIS);
@@ -940,8 +935,8 @@ static PHP_METHOD(PDO, lastInsertId)
ZEND_PARSE_PARAMETERS_START(0, 1)
Z_PARAM_OPTIONAL
- Z_PARAM_STRING_EX(name, namelen, 1, 0)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ Z_PARAM_STRING_OR_NULL(name, namelen)
+ ZEND_PARSE_PARAMETERS_END();
PDO_DBH_CLEAR_ERR();
PDO_CONSTRUCT_CHECK;
@@ -970,9 +965,8 @@ static PHP_METHOD(PDO, errorCode)
{
pdo_dbh_t *dbh = Z_PDO_DBH_P(ZEND_THIS);
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
+
PDO_CONSTRUCT_CHECK;
if (dbh->query_stmt) {
@@ -991,7 +985,7 @@ static PHP_METHOD(PDO, errorCode)
}
/* }}} */
-/* {{{ proto int PDO::errorInfo()
+/* {{{ proto array PDO::errorInfo()
Fetch extended error information associated with the last operation on the database handle */
static PHP_METHOD(PDO, errorInfo)
{
@@ -1001,9 +995,7 @@ static PHP_METHOD(PDO, errorInfo)
pdo_dbh_t *dbh = Z_PDO_DBH_P(ZEND_THIS);
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
PDO_CONSTRUCT_CHECK;
@@ -1053,12 +1045,12 @@ static PHP_METHOD(PDO, query)
/* Return a meaningful error when no parameters were passed */
if (!ZEND_NUM_ARGS()) {
zend_parse_parameters(0, "z|z", NULL, NULL);
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (FAILURE == zend_parse_parameters(1, "s", &statement,
&statement_len)) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
PDO_DBH_CLEAR_ERR();
@@ -1122,7 +1114,7 @@ static PHP_METHOD(PDO, query)
/* }}} */
/* {{{ proto string PDO::quote(string string [, int paramtype])
- quotes string for use in a query. The optional paramtype acts as a hint for drivers that have alternate quoting styles. The default value is PDO_PARAM_STR */
+ quotes string for use in a query. The optional paramtype acts as a hint for drivers that have alternate quoting styles. The default value is PDO_PARAM_STR */
static PHP_METHOD(PDO, quote)
{
pdo_dbh_t *dbh = Z_PDO_DBH_P(ZEND_THIS);
@@ -1136,7 +1128,7 @@ static PHP_METHOD(PDO, quote)
Z_PARAM_STRING(str, str_len)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(paramtype)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
PDO_DBH_CLEAR_ERR();
PDO_CONSTRUCT_CHECK;
@@ -1161,9 +1153,7 @@ static PHP_METHOD(PDO, getAvailableDrivers)
{
pdo_driver_t *pdriver;
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
array_init(return_value);
@@ -1173,61 +1163,22 @@ static PHP_METHOD(PDO, getAvailableDrivers)
}
/* }}} */
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pdo___construct, 0, 0, 1)
- ZEND_ARG_INFO(0, dsn)
- ZEND_ARG_INFO(0, username)
- ZEND_ARG_INFO(0, passwd)
- ZEND_ARG_INFO(0, options) /* array */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pdo_prepare, 0, 0, 1)
- ZEND_ARG_INFO(0, statement)
- ZEND_ARG_INFO(0, options) /* array */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_pdo_setattribute, 0)
- ZEND_ARG_INFO(0, attribute)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_pdo_getattribute, 0)
- ZEND_ARG_INFO(0, attribute)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_pdo_exec, 0)
- ZEND_ARG_INFO(0, query)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pdo_lastinsertid, 0, 0, 0)
- ZEND_ARG_INFO(0, seqname)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pdo_quote, 0, 0, 1)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, paramtype)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_pdo__void, 0)
-ZEND_END_ARG_INFO()
-/* }}} */
-
const zend_function_entry pdo_dbh_functions[] = /* {{{ */ {
- ZEND_MALIAS(PDO, __construct, dbh_constructor, arginfo_pdo___construct, ZEND_ACC_PUBLIC)
- PHP_ME(PDO, prepare, arginfo_pdo_prepare, ZEND_ACC_PUBLIC)
- PHP_ME(PDO, beginTransaction, arginfo_pdo__void, ZEND_ACC_PUBLIC)
- PHP_ME(PDO, commit, arginfo_pdo__void, ZEND_ACC_PUBLIC)
- PHP_ME(PDO, rollBack, arginfo_pdo__void, ZEND_ACC_PUBLIC)
- PHP_ME(PDO, inTransaction, arginfo_pdo__void, ZEND_ACC_PUBLIC)
- PHP_ME(PDO, setAttribute, arginfo_pdo_setattribute, ZEND_ACC_PUBLIC)
- PHP_ME(PDO, exec, arginfo_pdo_exec, ZEND_ACC_PUBLIC)
- PHP_ME(PDO, query, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(PDO, lastInsertId, arginfo_pdo_lastinsertid, ZEND_ACC_PUBLIC)
- PHP_ME(PDO, errorCode, arginfo_pdo__void, ZEND_ACC_PUBLIC)
- PHP_ME(PDO, errorInfo, arginfo_pdo__void, ZEND_ACC_PUBLIC)
- PHP_ME(PDO, getAttribute, arginfo_pdo_getattribute, ZEND_ACC_PUBLIC)
- PHP_ME(PDO, quote, arginfo_pdo_quote, ZEND_ACC_PUBLIC)
- PHP_ME(PDO, getAvailableDrivers, arginfo_pdo__void, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_MALIAS(PDO, __construct, dbh_constructor, arginfo_class_PDO___construct, ZEND_ACC_PUBLIC)
+ PHP_ME(PDO, prepare, arginfo_class_PDO_prepare, ZEND_ACC_PUBLIC)
+ PHP_ME(PDO, beginTransaction, arginfo_class_PDO_beginTransaction, ZEND_ACC_PUBLIC)
+ PHP_ME(PDO, commit, arginfo_class_PDO_commit, ZEND_ACC_PUBLIC)
+ PHP_ME(PDO, rollBack, arginfo_class_PDO_rollBack, ZEND_ACC_PUBLIC)
+ PHP_ME(PDO, inTransaction, arginfo_class_PDO_inTransaction, ZEND_ACC_PUBLIC)
+ PHP_ME(PDO, setAttribute, arginfo_class_PDO_setAttribute, ZEND_ACC_PUBLIC)
+ PHP_ME(PDO, exec, arginfo_class_PDO_exec, ZEND_ACC_PUBLIC)
+ PHP_ME(PDO, query, arginfo_class_PDO_query, ZEND_ACC_PUBLIC)
+ PHP_ME(PDO, lastInsertId, arginfo_class_PDO_lastInsertId, ZEND_ACC_PUBLIC)
+ PHP_ME(PDO, errorCode, arginfo_class_PDO_errorCode, ZEND_ACC_PUBLIC)
+ PHP_ME(PDO, errorInfo, arginfo_class_PDO_errorInfo, ZEND_ACC_PUBLIC)
+ PHP_ME(PDO, getAttribute, arginfo_class_PDO_getAttribute, ZEND_ACC_PUBLIC)
+ PHP_ME(PDO, quote, arginfo_class_PDO_quote, ZEND_ACC_PUBLIC)
+ PHP_ME(PDO, getAvailableDrivers, arginfo_class_PDO_getAvailableDrivers, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
PHP_FE_END
};
/* }}} */
@@ -1294,10 +1245,10 @@ int pdo_hash_methods(pdo_dbh_object_t *dbh_obj, int kind)
} else {
func.required_num_args = info->required_num_args;
}
- if (info->return_reference) {
+ if (ZEND_ARG_SEND_MODE(info)) {
func.fn_flags |= ZEND_ACC_RETURN_REFERENCE;
}
- if (funcs->arg_info[funcs->num_args].is_variadic) {
+ if (ZEND_ARG_IS_VARIADIC(&funcs->arg_info[funcs->num_args])) {
func.fn_flags |= ZEND_ACC_VARIADIC;
/* Don't count the variadic argument */
func.num_args--;
@@ -1350,9 +1301,9 @@ static int dbh_compare(zval *object1, zval *object2)
return -1;
}
-static HashTable *dbh_get_gc(zval *object, zval **gc_data, int *gc_count)
+static HashTable *dbh_get_gc(zend_object *object, zval **gc_data, int *gc_count)
{
- pdo_dbh_t *dbh = Z_PDO_DBH_P(object);
+ pdo_dbh_t *dbh = php_pdo_dbh_fetch_inner(object);
*gc_data = &dbh->def_stmt_ctor_args;
*gc_count = 1;
return zend_std_get_properties(object);
@@ -1377,7 +1328,7 @@ void pdo_dbh_init(void)
pdo_dbh_object_handlers.free_obj = pdo_dbh_free_storage;
pdo_dbh_object_handlers.clone_obj = NULL;
pdo_dbh_object_handlers.get_method = dbh_method_get;
- pdo_dbh_object_handlers.compare_objects = dbh_compare;
+ pdo_dbh_object_handlers.compare = dbh_compare;
pdo_dbh_object_handlers.get_gc = dbh_get_gc;
REGISTER_PDO_CLASS_CONST_LONG("PARAM_BOOL", (zend_long)PDO_PARAM_BOOL);
diff --git a/ext/pdo/pdo_sql_parser.re b/ext/pdo/pdo_sql_parser.re
index 71d41002cf..31da8ffdf9 100644
--- a/ext/pdo/pdo_sql_parser.re
+++ b/ext/pdo/pdo_sql_parser.re
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/pdo/pdo_sqlstate.c b/ext/pdo/pdo_sqlstate.c
index 0b3fe7172c..7df2f9c87a 100644
--- a/ext/pdo/pdo_sqlstate.c
+++ b/ext/pdo/pdo_sqlstate.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c
index 67fce95137..84afe14b60 100644
--- a/ext/pdo/pdo_stmt.c
+++ b/ext/pdo/pdo_stmt.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -34,76 +32,7 @@
#include "zend_exceptions.h"
#include "zend_interfaces.h"
#include "php_memory_streams.h"
-
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO(arginfo_pdostatement__void, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pdostatement_execute, 0, 0, 0)
- ZEND_ARG_INFO(0, bound_input_params) /* array */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pdostatement_fetch, 0, 0, 0)
- ZEND_ARG_INFO(0, how)
- ZEND_ARG_INFO(0, orientation)
- ZEND_ARG_INFO(0, offset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pdostatement_fetchobject, 0, 0, 0)
- ZEND_ARG_INFO(0, class_name)
- ZEND_ARG_INFO(0, ctor_args) /* array */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pdostatement_fetchcolumn, 0, 0, 0)
- ZEND_ARG_INFO(0, column_number)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pdostatement_fetchall, 0, 0, 0)
- ZEND_ARG_INFO(0, how)
- ZEND_ARG_INFO(0, class_name)
- ZEND_ARG_INFO(0, ctor_args) /* array */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pdostatement_bindvalue, 0, 0, 2)
- ZEND_ARG_INFO(0, paramno)
- ZEND_ARG_INFO(0, param)
- ZEND_ARG_INFO(0, type)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pdostatement_bindparam, 0, 0, 2)
- ZEND_ARG_INFO(0, paramno)
- ZEND_ARG_INFO(1, param)
- ZEND_ARG_INFO(0, type)
- ZEND_ARG_INFO(0, maxlen)
- ZEND_ARG_INFO(0, driverdata)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pdostatement_bindcolumn, 0, 0, 2)
- ZEND_ARG_INFO(0, column)
- ZEND_ARG_INFO(1, param)
- ZEND_ARG_INFO(0, type)
- ZEND_ARG_INFO(0, maxlen)
- ZEND_ARG_INFO(0, driverdata)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_pdostatement_setattribute, 0)
- ZEND_ARG_INFO(0, attribute)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_pdostatement_getattribute, 0)
- ZEND_ARG_INFO(0, attribute)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_pdostatement_getcolumnmeta, 0)
- ZEND_ARG_INFO(0, column)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pdostatement_setfetchmode, 0, 0, 1)
- ZEND_ARG_INFO(0, mode)
- ZEND_ARG_INFO(0, params)
-ZEND_END_ARG_INFO()
-/* }}} */
+#include "pdo_arginfo.h"
#define PHP_STMT_GET_OBJ \
pdo_stmt_t *stmt = Z_PDO_STMT_P(ZEND_THIS); \
@@ -424,8 +353,8 @@ static PHP_METHOD(PDOStatement, execute)
ZEND_PARSE_PARAMETERS_START(0, 1)
Z_PARAM_OPTIONAL
- Z_PARAM_ARRAY_EX(input_params, 1, 0)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ Z_PARAM_ARRAY_OR_NULL(input_params)
+ ZEND_PARSE_PARAMETERS_END();
PDO_STMT_CLEAR_ERR();
@@ -870,7 +799,7 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_
case PDO_FETCH_KEY_PAIR:
if (stmt->column_count != 2) {
- pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "PDO::FETCH_KEY_PAIR fetch mode requires the result set to contain extactly 2 columns.");
+ pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "PDO::FETCH_KEY_PAIR fetch mode requires the result set to contain exactly 2 columns.");
return 0;
}
if (!return_all) {
@@ -1032,10 +961,9 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_
case PDO_FETCH_USE_DEFAULT:
case PDO_FETCH_BOTH:
zend_symtable_update(Z_ARRVAL_P(return_value), stmt->columns[i].name, &val);
- if (Z_REFCOUNTED(val)) {
- Z_ADDREF(val);
+ if (zend_hash_index_add(Z_ARRVAL_P(return_value), i, &val) != NULL) {
+ Z_TRY_ADDREF(val);
}
- zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &val);
break;
case PDO_FETCH_NAMED:
@@ -1252,7 +1180,7 @@ static PHP_METHOD(PDOStatement, fetch)
Z_PARAM_LONG(how)
Z_PARAM_LONG(ori)
Z_PARAM_LONG(off)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
PDO_STMT_CLEAR_ERR();
@@ -1285,7 +1213,7 @@ static PHP_METHOD(PDOStatement, fetchObject)
Z_PARAM_OPTIONAL
Z_PARAM_STR_EX(class_name, 1, 0)
Z_PARAM_ARRAY(ctor_args)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
PDO_STMT_CLEAR_ERR();
@@ -1344,7 +1272,7 @@ static PHP_METHOD(PDOStatement, fetchColumn)
ZEND_PARSE_PARAMETERS_START(0, 1)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(col_n)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
PDO_STMT_CLEAR_ERR();
@@ -1374,7 +1302,7 @@ static PHP_METHOD(PDOStatement, fetchAll)
Z_PARAM_LONG(how)
Z_PARAM_ZVAL(arg2)
Z_PARAM_ZVAL(ctor_args)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (!pdo_stmt_verify_mode(stmt, how, 1)) {
RETURN_FALSE;
@@ -1579,7 +1507,7 @@ static PHP_METHOD(PDOStatement, bindValue)
"lz|l", &param.paramno, &parameter, &param_type)) {
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "Sz|l", &param.name,
&parameter, &param_type)) {
- RETURN_FALSE;
+ return;
}
}
@@ -1628,6 +1556,8 @@ static PHP_METHOD(PDOStatement, rowCount)
{
PHP_STMT_GET_OBJ;
+ ZEND_PARSE_PARAMETERS_NONE();
+
RETURN_LONG(stmt->row_count);
}
/* }}} */
@@ -1638,9 +1568,7 @@ static PHP_METHOD(PDOStatement, errorCode)
{
PHP_STMT_GET_OBJ;
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
if (stmt->error_code[0] == '\0') {
RETURN_NULL();
@@ -1660,9 +1588,7 @@ static PHP_METHOD(PDOStatement, errorInfo)
PHP_STMT_GET_OBJ;
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
array_init(return_value);
add_next_index_string(return_value, stmt->error_code);
@@ -1695,7 +1621,7 @@ static PHP_METHOD(PDOStatement, setAttribute)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_LONG(attr)
Z_PARAM_ZVAL_EX(value, 1, 0)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (!stmt->methods->set_attribute) {
goto fail;
@@ -1736,7 +1662,7 @@ static PHP_METHOD(PDOStatement, getAttribute)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_LONG(attr)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (!stmt->methods->get_attribute) {
if (!generic_stmt_attr_get(stmt, return_value, attr)) {
@@ -1773,9 +1699,9 @@ static PHP_METHOD(PDOStatement, getAttribute)
static PHP_METHOD(PDOStatement, columnCount)
{
PHP_STMT_GET_OBJ;
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+
+ ZEND_PARSE_PARAMETERS_NONE();
+
RETURN_LONG(stmt->column_count);
}
/* }}} */
@@ -1790,7 +1716,7 @@ static PHP_METHOD(PDOStatement, getColumnMeta)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_LONG(colno)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if(colno < 0) {
pdo_raise_impl_error(stmt->dbh, stmt, "42P10", "column number must be non-negative");
@@ -1820,7 +1746,7 @@ static PHP_METHOD(PDOStatement, getColumnMeta)
}
/* }}} */
-/* {{{ proto bool PDOStatement::setFetchMode(int mode [mixed* params])
+/* {{{ proto bool PDOStatement::setFetchMode(int mode [, mixed* params])
Changes the default fetch mode for subsequent fetches (params have different meaning for different fetch modes) */
int pdo_stmt_setup_fetch_mode(INTERNAL_FUNCTION_PARAMETERS, pdo_stmt_t *stmt, int skip)
@@ -2037,6 +1963,8 @@ static PHP_METHOD(PDOStatement, nextRowset)
{
PHP_STMT_GET_OBJ;
+ ZEND_PARSE_PARAMETERS_NONE();
+
if (!stmt->methods->next_rowset) {
pdo_raise_impl_error(stmt->dbh, stmt, "IM001", "driver does not support multiple rowsets");
RETURN_FALSE;
@@ -2059,6 +1987,8 @@ static PHP_METHOD(PDOStatement, closeCursor)
{
PHP_STMT_GET_OBJ;
+ ZEND_PARSE_PARAMETERS_NONE();
+
if (!stmt->methods->cursor_closer) {
/* emulate it by fetching and discarding rows */
do {
@@ -2092,10 +2022,14 @@ static PHP_METHOD(PDOStatement, closeCursor)
A utility for internals hackers to debug parameter internals */
static PHP_METHOD(PDOStatement, debugDumpParams)
{
+ ZEND_PARSE_PARAMETERS_NONE();
+
php_stream *out = php_stream_open_wrapper("php://output", "w", 0, NULL);
struct pdo_bound_param_data *param;
PHP_STMT_GET_OBJ;
+ ZEND_PARSE_PARAMETERS_NONE();
+
if (out == NULL) {
RETURN_FALSE;
}
@@ -2144,59 +2078,50 @@ static PHP_METHOD(PDOStatement, debugDumpParams)
php_stream_close(out);
}
/* }}} */
-
const zend_function_entry pdo_dbstmt_functions[] = {
- PHP_ME(PDOStatement, execute, arginfo_pdostatement_execute, ZEND_ACC_PUBLIC)
- PHP_ME(PDOStatement, fetch, arginfo_pdostatement_fetch, ZEND_ACC_PUBLIC)
- PHP_ME(PDOStatement, bindParam, arginfo_pdostatement_bindparam, ZEND_ACC_PUBLIC)
- PHP_ME(PDOStatement, bindColumn, arginfo_pdostatement_bindcolumn, ZEND_ACC_PUBLIC)
- PHP_ME(PDOStatement, bindValue, arginfo_pdostatement_bindvalue, ZEND_ACC_PUBLIC)
- PHP_ME(PDOStatement, rowCount, arginfo_pdostatement__void, ZEND_ACC_PUBLIC)
- PHP_ME(PDOStatement, fetchColumn, arginfo_pdostatement_fetchcolumn, ZEND_ACC_PUBLIC)
- PHP_ME(PDOStatement, fetchAll, arginfo_pdostatement_fetchall, ZEND_ACC_PUBLIC)
- PHP_ME(PDOStatement, fetchObject, arginfo_pdostatement_fetchobject, ZEND_ACC_PUBLIC)
- PHP_ME(PDOStatement, errorCode, arginfo_pdostatement__void, ZEND_ACC_PUBLIC)
- PHP_ME(PDOStatement, errorInfo, arginfo_pdostatement__void, ZEND_ACC_PUBLIC)
- PHP_ME(PDOStatement, setAttribute, arginfo_pdostatement_setattribute, ZEND_ACC_PUBLIC)
- PHP_ME(PDOStatement, getAttribute, arginfo_pdostatement_getattribute, ZEND_ACC_PUBLIC)
- PHP_ME(PDOStatement, columnCount, arginfo_pdostatement__void, ZEND_ACC_PUBLIC)
- PHP_ME(PDOStatement, getColumnMeta, arginfo_pdostatement_getcolumnmeta, ZEND_ACC_PUBLIC)
- PHP_ME(PDOStatement, setFetchMode, arginfo_pdostatement_setfetchmode, ZEND_ACC_PUBLIC)
- PHP_ME(PDOStatement, nextRowset, arginfo_pdostatement__void, ZEND_ACC_PUBLIC)
- PHP_ME(PDOStatement, closeCursor, arginfo_pdostatement__void, ZEND_ACC_PUBLIC)
- PHP_ME(PDOStatement, debugDumpParams, arginfo_pdostatement__void, ZEND_ACC_PUBLIC)
+ PHP_ME(PDOStatement, execute, arginfo_class_PDOStatement_execute, ZEND_ACC_PUBLIC)
+ PHP_ME(PDOStatement, fetch, arginfo_class_PDOStatement_fetch, ZEND_ACC_PUBLIC)
+ PHP_ME(PDOStatement, bindParam, arginfo_class_PDOStatement_bindParam, ZEND_ACC_PUBLIC)
+ PHP_ME(PDOStatement, bindColumn, arginfo_class_PDOStatement_bindColumn, ZEND_ACC_PUBLIC)
+ PHP_ME(PDOStatement, bindValue, arginfo_class_PDOStatement_bindValue, ZEND_ACC_PUBLIC)
+ PHP_ME(PDOStatement, rowCount, arginfo_class_PDOStatement_rowCount, ZEND_ACC_PUBLIC)
+ PHP_ME(PDOStatement, fetchColumn, arginfo_class_PDOStatement_fetchColumn, ZEND_ACC_PUBLIC)
+ PHP_ME(PDOStatement, fetchAll, arginfo_class_PDOStatement_fetchAll, ZEND_ACC_PUBLIC)
+ PHP_ME(PDOStatement, fetchObject, arginfo_class_PDOStatement_fetchObject, ZEND_ACC_PUBLIC)
+ PHP_ME(PDOStatement, errorCode, arginfo_class_PDOStatement_errorCode, ZEND_ACC_PUBLIC)
+ PHP_ME(PDOStatement, errorInfo, arginfo_class_PDOStatement_errorInfo, ZEND_ACC_PUBLIC)
+ PHP_ME(PDOStatement, setAttribute, arginfo_class_PDOStatement_setAttribute, ZEND_ACC_PUBLIC)
+ PHP_ME(PDOStatement, getAttribute, arginfo_class_PDOStatement_getAttribute, ZEND_ACC_PUBLIC)
+ PHP_ME(PDOStatement, columnCount, arginfo_class_PDOStatement_columnCount, ZEND_ACC_PUBLIC)
+ PHP_ME(PDOStatement, getColumnMeta, arginfo_class_PDOStatement_getColumnMeta, ZEND_ACC_PUBLIC)
+ PHP_ME(PDOStatement, setFetchMode, arginfo_class_PDOStatement_setFetchMode, ZEND_ACC_PUBLIC)
+ PHP_ME(PDOStatement, nextRowset, arginfo_class_PDOStatement_nextRowset, ZEND_ACC_PUBLIC)
+ PHP_ME(PDOStatement, closeCursor, arginfo_class_PDOStatement_closeCursor, ZEND_ACC_PUBLIC)
+ PHP_ME(PDOStatement, debugDumpParams, arginfo_class_PDOStatement_debugDumpParams, ZEND_ACC_PUBLIC)
PHP_FE_END
};
/* {{{ overloaded handlers for PDOStatement class */
-static zval *dbstmt_prop_write(zval *object, zval *member, zval *value, void **cache_slot)
+static zval *dbstmt_prop_write(zend_object *object, zend_string *name, zval *value, void **cache_slot)
{
- pdo_stmt_t *stmt = Z_PDO_STMT_P(object);
+ pdo_stmt_t *stmt = php_pdo_stmt_fetch_object(object);
- if (!try_convert_to_string(member)) {
- return value;
- }
-
- if (strcmp(Z_STRVAL_P(member), "queryString") == 0) {
+ if (strcmp(ZSTR_VAL(name), "queryString") == 0) {
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "property queryString is read only");
return value;
} else {
- return zend_std_write_property(object, member, value, cache_slot);
+ return zend_std_write_property(object, name, value, cache_slot);
}
}
-static void dbstmt_prop_delete(zval *object, zval *member, void **cache_slot)
+static void dbstmt_prop_delete(zend_object *object, zend_string *name, void **cache_slot)
{
- pdo_stmt_t *stmt = Z_PDO_STMT_P(object);
-
- if (!try_convert_to_string(member)) {
- return;
- }
+ pdo_stmt_t *stmt = php_pdo_stmt_fetch_object(object);
- if (strcmp(Z_STRVAL_P(member), "queryString") == 0) {
+ if (strcmp(ZSTR_VAL(name), "queryString") == 0) {
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "property queryString is read only");
} else {
- zend_std_unset_property(object, member, cache_slot);
+ zend_std_unset_property(object, name, cache_slot);
}
}
@@ -2436,12 +2361,44 @@ const zend_function_entry pdo_row_functions[] = {
PHP_FE_END
};
-static zval *row_prop_read(zval *object, zval *member, int type, void **cache_slot, zval *rv)
+static zval *row_prop_read(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv)
+{
+ pdo_row_t *row = (pdo_row_t *)object;
+ pdo_stmt_t *stmt = row->stmt;
+ int colno = -1;
+ zend_long lval;
+
+ ZVAL_NULL(rv);
+ if (stmt) {
+ if (is_numeric_string_ex(ZSTR_VAL(name), ZSTR_LEN(name), &lval, NULL, 0, NULL) == IS_LONG) {
+ if (lval >= 0 && lval < stmt->column_count) {
+ fetch_value(stmt, rv, lval, NULL);
+ }
+ } else {
+ /* TODO: replace this with a hash of available column names to column
+ * numbers */
+ for (colno = 0; colno < stmt->column_count; colno++) {
+ if (ZSTR_LEN(stmt->columns[colno].name) == ZSTR_LEN(name) &&
+ strncmp(ZSTR_VAL(stmt->columns[colno].name), ZSTR_VAL(name), ZSTR_LEN(name)) == 0) {
+ fetch_value(stmt, rv, colno, NULL);
+ return rv;
+ }
+ }
+ if (strcmp(ZSTR_VAL(name), "queryString") == 0) {
+ //zval_ptr_dtor(rv);
+ return zend_std_read_property(&stmt->std, name, type, cache_slot, rv);
+ }
+ }
+ }
+
+ return rv;
+}
+
+static zval *row_dim_read(zend_object *object, zval *member, int type, zval *rv)
{
- pdo_row_t *row = (pdo_row_t *)Z_OBJ_P(object);
+ pdo_row_t *row = (pdo_row_t *)object;
pdo_stmt_t *stmt = row->stmt;
int colno = -1;
- zval zobj;
zend_long lval;
ZVAL_NULL(rv);
@@ -2470,9 +2427,8 @@ static zval *row_prop_read(zval *object, zval *member, int type, void **cache_sl
}
}
if (strcmp(Z_STRVAL_P(member), "queryString") == 0) {
- ZVAL_OBJ(&zobj, &stmt->std);
//zval_ptr_dtor(rv);
- return zend_std_read_property(&zobj, member, type, cache_slot, rv);
+ return zend_std_read_property(&stmt->std, Z_STR_P(member), type, NULL, rv);
}
}
}
@@ -2480,25 +2436,52 @@ static zval *row_prop_read(zval *object, zval *member, int type, void **cache_sl
return rv;
}
-static zval *row_dim_read(zval *object, zval *member, int type, zval *rv)
+static zval *row_prop_write(zend_object *object, zend_string *name, zval *value, void **cache_slot)
{
- return row_prop_read(object, member, type, NULL, rv);
+ php_error_docref(NULL, E_WARNING, "This PDORow is not from a writable result set");
+ return value;
}
-static zval *row_prop_write(zval *object, zval *member, zval *value, void **cache_slot)
+static void row_dim_write(zend_object *object, zval *member, zval *value)
{
php_error_docref(NULL, E_WARNING, "This PDORow is not from a writable result set");
- return value;
}
-static void row_dim_write(zval *object, zval *member, zval *value)
+static int row_prop_exists(zend_object *object, zend_string *name, int check_empty, void **cache_slot)
{
- php_error_docref(NULL, E_WARNING, "This PDORow is not from a writable result set");
+ pdo_row_t *row = (pdo_row_t *)object;
+ pdo_stmt_t *stmt = row->stmt;
+ int colno = -1;
+ zend_long lval;
+
+ if (stmt) {
+ if (is_numeric_string_ex(ZSTR_VAL(name), ZSTR_LEN(name), &lval, NULL, 0, NULL) == IS_LONG) {
+ return lval >=0 && lval < stmt->column_count;
+ }
+
+ /* TODO: replace this with a hash of available column names to column
+ * numbers */
+ for (colno = 0; colno < stmt->column_count; colno++) {
+ if (ZSTR_LEN(stmt->columns[colno].name) == ZSTR_LEN(name) &&
+ strncmp(ZSTR_VAL(stmt->columns[colno].name), ZSTR_VAL(name), ZSTR_LEN(name)) == 0) {
+ int res;
+ zval val;
+
+ fetch_value(stmt, &val, colno, NULL);
+ res = check_empty ? i_zend_is_true(&val) : Z_TYPE(val) != IS_NULL;
+ zval_ptr_dtor_nogc(&val);
+
+ return res;
+ }
+ }
+ }
+
+ return 0;
}
-static int row_prop_exists(zval *object, zval *member, int check_empty, void **cache_slot)
+static int row_dim_exists(zend_object *object, zval *member, int check_empty)
{
- pdo_row_t *row = (pdo_row_t *)Z_OBJ_P(object);
+ pdo_row_t *row = (pdo_row_t *)object;
pdo_stmt_t *stmt = row->stmt;
int colno = -1;
zend_long lval;
@@ -2536,24 +2519,19 @@ static int row_prop_exists(zval *object, zval *member, int check_empty, void **c
return 0;
}
-static int row_dim_exists(zval *object, zval *member, int check_empty)
-{
- return row_prop_exists(object, member, check_empty, NULL);
-}
-
-static void row_prop_delete(zval *object, zval *offset, void **cache_slot)
+static void row_prop_delete(zend_object *object, zend_string *offset, void **cache_slot)
{
php_error_docref(NULL, E_WARNING, "Cannot delete properties from a PDORow");
}
-static void row_dim_delete(zval *object, zval *offset)
+static void row_dim_delete(zend_object *object, zval *offset)
{
php_error_docref(NULL, E_WARNING, "Cannot delete properties from a PDORow");
}
-static HashTable *row_get_properties_for(zval *object, zend_prop_purpose purpose)
+static HashTable *row_get_properties_for(zend_object *object, zend_prop_purpose purpose)
{
- pdo_row_t *row = (pdo_row_t *)Z_OBJ_P(object);
+ pdo_row_t *row = (pdo_row_t *)object;
pdo_stmt_t *stmt = row->stmt;
HashTable *props;
int i;
@@ -2594,11 +2572,6 @@ static zend_function *row_method_get(
return fbc;
}
-static int row_call_method(zend_string *method, zend_object *object, INTERNAL_FUNCTION_PARAMETERS)
-{
- return FAILURE;
-}
-
static zend_function *row_get_ctor(zend_object *object)
{
zend_throw_exception_ex(php_pdo_get_exception(), 0, "You may not create a PDORow manually");
@@ -2653,7 +2626,7 @@ void pdo_stmt_init(void)
pdo_dbstmt_object_handlers.write_property = dbstmt_prop_write;
pdo_dbstmt_object_handlers.unset_property = dbstmt_prop_delete;
pdo_dbstmt_object_handlers.get_method = dbstmt_method_get;
- pdo_dbstmt_object_handlers.compare_objects = dbstmt_compare;
+ pdo_dbstmt_object_handlers.compare = dbstmt_compare;
pdo_dbstmt_object_handlers.clone_obj = NULL;
INIT_CLASS_ENTRY(ce, "PDORow", pdo_row_functions);
@@ -2677,8 +2650,7 @@ void pdo_stmt_init(void)
pdo_row_object_handlers.unset_dimension = row_dim_delete;
pdo_row_object_handlers.get_properties_for = row_get_properties_for;
pdo_row_object_handlers.get_method = row_method_get;
- pdo_row_object_handlers.call_method = row_call_method;
pdo_row_object_handlers.get_constructor = row_get_ctor;
pdo_row_object_handlers.get_class_name = row_get_classname;
- pdo_row_object_handlers.compare_objects = row_compare;
+ pdo_row_object_handlers.compare = row_compare;
}
diff --git a/ext/pdo/php_pdo.h b/ext/pdo/php_pdo.h
index 27c9c984d6..9d9e73915d 100644
--- a/ext/pdo/php_pdo.h
+++ b/ext/pdo/php_pdo.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/pdo/php_pdo_driver.h b/ext/pdo/php_pdo_driver.h
index d057857fa6..7f4861db20 100644
--- a/ext/pdo/php_pdo_driver.h
+++ b/ext/pdo/php_pdo_driver.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/pdo/php_pdo_error.h b/ext/pdo/php_pdo_error.h
index b9702833dd..d93960317e 100644
--- a/ext/pdo/php_pdo_error.h
+++ b/ext/pdo/php_pdo_error.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/pdo/php_pdo_int.h b/ext/pdo/php_pdo_int.h
index 20c373bd24..00131cdf6b 100644
--- a/ext/pdo/php_pdo_int.h
+++ b/ext/pdo/php_pdo_int.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/pdo/tests/bug_34630.phpt b/ext/pdo/tests/bug_34630.phpt
index 32a60643db..97845029ef 100644
--- a/ext/pdo/tests/bug_34630.phpt
+++ b/ext/pdo/tests/bug_34630.phpt
@@ -18,9 +18,9 @@ $driver = $db->getAttribute(PDO::ATTR_DRIVER_NAME);
$is_oci = $driver == 'oci';
if ($is_oci) {
- $db->exec('CREATE TABLE test (id int NOT NULL PRIMARY KEY, val BLOB)');
+ $db->exec('CREATE TABLE test (id int NOT NULL PRIMARY KEY, val BLOB)');
} else {
- $db->exec('CREATE TABLE test (id int NOT NULL PRIMARY KEY, val VARCHAR(256))');
+ $db->exec('CREATE TABLE test (id int NOT NULL PRIMARY KEY, val VARCHAR(256))');
}
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
@@ -29,13 +29,13 @@ fwrite($fp, "I am the LOB data");
rewind($fp);
if ($is_oci) {
- /* oracle is a bit different; you need to initiate a transaction otherwise
- * the empty blob will be committed implicitly when the statement is
- * executed */
- $db->beginTransaction();
- $insert = $db->prepare("insert into test (id, val) values (1, EMPTY_BLOB()) RETURNING val INTO :blob");
+ /* oracle is a bit different; you need to initiate a transaction otherwise
+ * the empty blob will be committed implicitly when the statement is
+ * executed */
+ $db->beginTransaction();
+ $insert = $db->prepare("insert into test (id, val) values (1, EMPTY_BLOB()) RETURNING val INTO :blob");
} else {
- $insert = $db->prepare("insert into test (id, val) values (1, :blob)");
+ $insert = $db->prepare("insert into test (id, val) values (1, :blob)");
}
$insert->bindValue(':blob', $fp, PDO::PARAM_LOB);
$insert->execute();
diff --git a/ext/pdo/tests/bug_34687.phpt b/ext/pdo/tests/bug_34687.phpt
index f25da54893..c260ddb271 100644
--- a/ext/pdo/tests/bug_34687.phpt
+++ b/ext/pdo/tests/bug_34687.phpt
@@ -20,10 +20,10 @@ $x = $db->query("UPDATE non_existent_pdo_test_table set foo = 'bar'");
var_dump($x);
$code = $db->errorCode();
if ($code !== '00000' && strlen($code)) {
- echo "OK: $code\n";
+ echo "OK: $code\n";
} else {
- echo "ERR: $code\n";
- print_r($db->errorInfo());
+ echo "ERR: $code\n";
+ print_r($db->errorInfo());
}
?>
diff --git a/ext/pdo/tests/bug_35671.phpt b/ext/pdo/tests/bug_35671.phpt
index fae84652f8..c5e4bbb609 100644
--- a/ext/pdo/tests/bug_35671.phpt
+++ b/ext/pdo/tests/bug_35671.phpt
@@ -20,9 +20,9 @@ $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$insert = $db->prepare("insert into test (field1, field2, field3) values (:value1, :value2, :value3)");
$parm = array(
- ":value1" => 15,
- ":value2" => 20,
- ":value3" => 25
+ ":value1" => 15,
+ ":value2" => 20,
+ ":value3" => 25
);
$insert->execute($parm);
diff --git a/ext/pdo/tests/bug_36428.phpt b/ext/pdo/tests/bug_36428.phpt
index 3cb32d47e8..981a4bb98e 100644
--- a/ext/pdo/tests/bug_36428.phpt
+++ b/ext/pdo/tests/bug_36428.phpt
@@ -21,7 +21,6 @@ $res = $db->query("SELECT a FROM test");
var_dump($res->fetchAll(PDO::FETCH_CLASS|PDO::FETCH_PROPS_LATE, 'SimpleXMLElement', array('<root/>')));
?>
-===DONE===
--EXPECTF--
array(1) {
[0]=>
@@ -30,4 +29,3 @@ array(1) {
string(3) "xyz"
}
}
-===DONE===
diff --git a/ext/pdo/tests/bug_38394.phpt b/ext/pdo/tests/bug_38394.phpt
index 6ec897fed7..e3c2a17fda 100644
--- a/ext/pdo/tests/bug_38394.phpt
+++ b/ext/pdo/tests/bug_38394.phpt
@@ -26,7 +26,6 @@ $s->execute(array('a' => 9, 'b' => 10, 'c' => 11));
var_dump($db->query("SELECT * FROM test")->fetchAll(PDO::FETCH_ASSOC));
?>
-===DONE===
--EXPECT--
array(2) {
[0]=>
@@ -48,4 +47,3 @@ array(2) {
string(2) "11"
}
}
-===DONE===
diff --git a/ext/pdo/tests/bug_39398.phpt b/ext/pdo/tests/bug_39398.phpt
index 7d76adca55..e0c78f824d 100644
--- a/ext/pdo/tests/bug_39398.phpt
+++ b/ext/pdo/tests/bug_39398.phpt
@@ -23,7 +23,6 @@ $stmt->execute();
var_dump($db->query("SELECT * FROM test")->fetchAll(PDO::FETCH_ASSOC));
?>
-===DONE===
--EXPECT--
array(1) {
[0]=>
@@ -32,4 +31,3 @@ array(1) {
string(1) "1"
}
}
-===DONE===
diff --git a/ext/pdo/tests/bug_42917.phpt b/ext/pdo/tests/bug_42917.phpt
index 814086a56a..073e9c0126 100644
--- a/ext/pdo/tests/bug_42917.phpt
+++ b/ext/pdo/tests/bug_42917.phpt
@@ -17,7 +17,7 @@ $db = PDOTest::factory();
$db->exec("CREATE TABLE test (a varchar(100), b varchar(100), c varchar(100))");
for ($i = 0; $i < 5; $i++) {
- $db->exec("INSERT INTO test (a,b,c) VALUES('test".$i."','".$i."','".$i."')");
+ $db->exec("INSERT INTO test (a,b,c) VALUES('test".$i."','".$i."','".$i."')");
}
$res = $db->query("SELECT a,b FROM test");
diff --git a/ext/pdo/tests/bug_43130.phpt b/ext/pdo/tests/bug_43130.phpt
index 4fea1a78ae..bf65bf0513 100644
--- a/ext/pdo/tests/bug_43130.phpt
+++ b/ext/pdo/tests/bug_43130.phpt
@@ -20,12 +20,12 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
$db = PDOTest::factory();
if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql')
- $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1);
+ $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1);
$db->exec("CREATE TABLE test (a varchar(100), b varchar(100), c varchar(100))");
for ($i = 0; $i < 5; $i++) {
- $db->exec("INSERT INTO test (a,b,c) VALUES('test".$i."','".$i."','".$i."')");
+ $db->exec("INSERT INTO test (a,b,c) VALUES('test".$i."','".$i."','".$i."')");
}
$stmt = $db->prepare("SELECT a FROM test WHERE b=:id-value");
diff --git a/ext/pdo/tests/bug_43139.phpt b/ext/pdo/tests/bug_43139.phpt
index 066eb2ed18..3b456a2ccc 100644
--- a/ext/pdo/tests/bug_43139.phpt
+++ b/ext/pdo/tests/bug_43139.phpt
@@ -19,9 +19,9 @@ $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
$from = '';
if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'oci') {
- $from = 'from dual';
+ $from = 'from dual';
} else if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'firebird') {
- $from = 'FROM RDB$DATABASE';
+ $from = 'FROM RDB$DATABASE';
}
var_dump($db->query("select 0 as abc, 1 as xyz, 2 as def $from")->fetchAll(PDO::FETCH_GROUP));
diff --git a/ext/pdo/tests/bug_44159.phpt b/ext/pdo/tests/bug_44159.phpt
index 26b0e33b60..bd7aca0e93 100644
--- a/ext/pdo/tests/bug_44159.phpt
+++ b/ext/pdo/tests/bug_44159.phpt
@@ -16,9 +16,9 @@ $pdo = new PDO("sqlite:".__DIR__."/foo.db");
$attrs = array(PDO::ATTR_STATEMENT_CLASS, PDO::ATTR_STRINGIFY_FETCHES, PDO::NULL_TO_STRING);
foreach ($attrs as $attr) {
- var_dump($pdo->setAttribute($attr, NULL));
- var_dump($pdo->setAttribute($attr, 1));
- var_dump($pdo->setAttribute($attr, 'nonsense'));
+ var_dump($pdo->setAttribute($attr, NULL));
+ var_dump($pdo->setAttribute($attr, 1));
+ var_dump($pdo->setAttribute($attr, 'nonsense'));
}
@unlink(__DIR__."/foo.db");
diff --git a/ext/pdo/tests/bug_44173.phpt b/ext/pdo/tests/bug_44173.phpt
index abf9ac7275..c5ced633a4 100644
--- a/ext/pdo/tests/bug_44173.phpt
+++ b/ext/pdo/tests/bug_44173.phpt
@@ -18,11 +18,6 @@ $db->exec("CREATE TABLE test (x int)");
$db->exec("INSERT INTO test VALUES (1)");
-// Bug entry [1]
-$stmt = $db->query();
-var_dump($stmt);
-
-
// Bug entry [2] -- 1 is PDO::FETCH_LAZY
$stmt = $db->query("SELECT * FROM test", PDO::FETCH_LAZY, 0, 0);
var_dump($stmt);
@@ -55,9 +50,6 @@ var_dump($stmt);
?>
--EXPECTF--
-Warning: PDO::query() expects at least 1 parameter, 0 given in %s
-bool(false)
-
Warning: PDO::query(): SQLSTATE[HY000]: General error: fetch mode doesn't allow any extra arguments in %s
bool(false)
diff --git a/ext/pdo/tests/bug_44409.phpt b/ext/pdo/tests/bug_44409.phpt
index f32eb879bd..a378301f41 100644
--- a/ext/pdo/tests/bug_44409.phpt
+++ b/ext/pdo/tests/bug_44409.phpt
@@ -19,20 +19,20 @@ $db->exec("INSERT INTO test (dat) VALUES ('Data from DB')");
class bug44409 implements Serializable
{
- public function __construct()
- {
- printf("Method called: %s()\n", __METHOD__);
- }
-
- public function serialize()
- {
- return "any data from serizalize()";
- }
-
- public function unserialize($dat)
- {
- printf("Method called: %s(%s)\n", __METHOD__, var_export($dat, true));
- }
+ public function __construct()
+ {
+ printf("Method called: %s()\n", __METHOD__);
+ }
+
+ public function serialize()
+ {
+ return "any data from serizalize()";
+ }
+
+ public function unserialize($dat)
+ {
+ printf("Method called: %s(%s)\n", __METHOD__, var_export($dat, true));
+ }
}
$stmt = $db->query("SELECT * FROM test");
diff --git a/ext/pdo/tests/bug_44861.phpt b/ext/pdo/tests/bug_44861.phpt
index ec2d779fb5..6ca5b17563 100644
--- a/ext/pdo/tests/bug_44861.phpt
+++ b/ext/pdo/tests/bug_44861.phpt
@@ -27,11 +27,11 @@ $db = PDOTest::factory();
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'oci') {
- $from = 'FROM DUAL';
- $ob = '1';
+ $from = 'FROM DUAL';
+ $ob = '1';
} else {
- $from = '';
- $ob = 'r';
+ $from = '';
+ $ob = 'r';
}
$query = "SELECT 'row1' AS r $from UNION SELECT 'row2' $from UNION SELECT 'row3' $from UNION SELECT 'row4' $from ORDER BY $ob";
diff --git a/ext/pdo/tests/bug_47769.phpt b/ext/pdo/tests/bug_47769.phpt
index c0ac8350ce..1c4395cc4b 100644
--- a/ext/pdo/tests/bug_47769.phpt
+++ b/ext/pdo/tests/bug_47769.phpt
@@ -10,18 +10,18 @@ if (!extension_loaded("pdo_sqlite"))
class test extends PDO
{
- protected function isProtected() {
- echo "this is a protected method.\n";
- }
- private function isPrivate() {
- echo "this is a private method.\n";
- }
+ protected function isProtected() {
+ echo "this is a protected method.\n";
+ }
+ private function isPrivate() {
+ echo "this is a private method.\n";
+ }
public function quote($str, $paramtype = NULL) {
- $this->isProtected();
- $this->isPrivate();
- print $str ."\n";
- }
+ $this->isProtected();
+ $this->isPrivate();
+ print $str ."\n";
+ }
}
$test = new test('sqlite::memory:');
diff --git a/ext/pdo/tests/bug_50458.phpt b/ext/pdo/tests/bug_50458.phpt
index f248f5f387..f5a25f0a14 100644
--- a/ext/pdo/tests/bug_50458.phpt
+++ b/ext/pdo/tests/bug_50458.phpt
@@ -20,10 +20,8 @@ $res = $db->query("SELECT a FROM test");
var_dump($res->fetchAll(PDO::FETCH_FUNC, function($a) { return strtoupper($a); }));
?>
-===DONE===
--EXPECT--
array(1) {
[0]=>
string(3) "XYZ"
}
-===DONE===
diff --git a/ext/pdo/tests/bug_52098.phpt b/ext/pdo/tests/bug_52098.phpt
index 681af4c594..68df06ccc4 100644
--- a/ext/pdo/tests/bug_52098.phpt
+++ b/ext/pdo/tests/bug_52098.phpt
@@ -51,9 +51,7 @@ echo $obj->lucky();
$db->exec("DROP TABLE test");
?>
-===DONE===
--EXPECT--
Calling object method 'foo'
Calling object method 'bar'
Calling object method 'lucky'
-===DONE===
diff --git a/ext/pdo/tests/bug_60665.phpt b/ext/pdo/tests/bug_60665.phpt
index 99cc07171a..efc43e4b50 100644
--- a/ext/pdo/tests/bug_60665.phpt
+++ b/ext/pdo/tests/bug_60665.phpt
@@ -14,9 +14,9 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../
require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
$db = PDOTest::factory();
switch ($db->getAttribute(PDO::ATTR_DRIVER_NAME)) {
- case 'oci': $from = 'from dual'; break;
- case 'firebird': $from = 'from rdb$database'; break;
- default: $from = ''; break;
+ case 'oci': $from = 'from dual'; break;
+ case 'firebird': $from = 'from rdb$database'; break;
+ default: $from = ''; break;
}
$statement = $db->prepare("SELECT NULL AS null_value, 0 AS zero, 1 AS one $from");
$statement->execute();
@@ -32,7 +32,6 @@ var_dump(
!isset($row->missing)
);
?>
-===DONE===
--EXPECT--
bool(true)
bool(true)
@@ -42,4 +41,3 @@ bool(true)
bool(true)
bool(true)
bool(true)
-===DONE===
diff --git a/ext/pdo/tests/bug_61292.phpt b/ext/pdo/tests/bug_61292.phpt
index f82619d20e..07501d594f 100644
--- a/ext/pdo/tests/bug_61292.phpt
+++ b/ext/pdo/tests/bug_61292.phpt
@@ -15,25 +15,25 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
class Database_SQL extends PDO
{
- function __construct()
- {
+ function __construct()
+ {
$dsn = getenv('PDOTEST_DSN');
$user = getenv('PDOTEST_USER');
$pass = getenv('PDOTEST_PASS');
if ($user === false) $user = NULL;
if ($pass === false) $pass = NULL;
- $options = array(PDO::ATTR_PERSISTENT => TRUE);
+ $options = array(PDO::ATTR_PERSISTENT => TRUE);
- parent::__construct($dsn, $user, $pass, $options);
- }
+ parent::__construct($dsn, $user, $pass, $options);
+ }
- var $bar = array();
+ var $bar = array();
- public function foo()
- {
- var_dump($this->bar);
- }
+ public function foo()
+ {
+ var_dump($this->bar);
+ }
}
(new Database_SQL)->foo();
diff --git a/ext/pdo/tests/bug_64172.phpt b/ext/pdo/tests/bug_64172.phpt
index 9a729c90c1..636bbc798b 100644
--- a/ext/pdo/tests/bug_64172.phpt
+++ b/ext/pdo/tests/bug_64172.phpt
@@ -45,7 +45,6 @@ var_dump($db->errorInfo());
$db->exec("DROP TABLE test");
?>
-===DONE===
--EXPECTF--
===FAIL===
@@ -81,4 +80,3 @@ array(3) {
[2]=>
NULL
}
-===DONE===
diff --git a/ext/pdo/tests/bug_65946.phpt b/ext/pdo/tests/bug_65946.phpt
index db7671de99..7c8f8c93cb 100644
--- a/ext/pdo/tests/bug_65946.phpt
+++ b/ext/pdo/tests/bug_65946.phpt
@@ -17,22 +17,22 @@ $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
$db->exec('CREATE TABLE test(id int)');
$db->exec('INSERT INTO test VALUES(1)');
switch ($db->getAttribute(PDO::ATTR_DRIVER_NAME)) {
- case 'dblib':
- $sql = 'SELECT TOP :limit * FROM test';
- break;
- case 'odbc':
- $sql = 'SELECT TOP (:limit) * FROM test';
- break;
- case 'firebird':
- $sql = 'SELECT FIRST :limit * FROM test';
- break;
- case 'oci':
- //$sql = 'SELECT * FROM test FETCH FIRST :limit ROWS ONLY'; // Oracle 12c syntax
- $sql = "select id from (select a.*, rownum rnum from (SELECT * FROM test) a where rownum <= :limit)";
- break;
- default:
- $sql = 'SELECT * FROM test LIMIT :limit';
- break;
+ case 'dblib':
+ $sql = 'SELECT TOP :limit * FROM test';
+ break;
+ case 'odbc':
+ $sql = 'SELECT TOP (:limit) * FROM test';
+ break;
+ case 'firebird':
+ $sql = 'SELECT FIRST :limit * FROM test';
+ break;
+ case 'oci':
+ //$sql = 'SELECT * FROM test FETCH FIRST :limit ROWS ONLY'; // Oracle 12c syntax
+ $sql = "select id from (select a.*, rownum rnum from (SELECT * FROM test) a where rownum <= :limit)";
+ break;
+ default:
+ $sql = 'SELECT * FROM test LIMIT :limit';
+ break;
}
$stmt = $db->prepare($sql);
$stmt->bindValue('limit', 1, PDO::PARAM_INT);
diff --git a/ext/pdo/tests/bug_69356.phpt b/ext/pdo/tests/bug_69356.phpt
index 4fca242a91..2bd3b30973 100644
--- a/ext/pdo/tests/bug_69356.phpt
+++ b/ext/pdo/tests/bug_69356.phpt
@@ -5,6 +5,7 @@ PDO Common: Bug #69356 (PDOStatement::debugDumpParams() truncates query)
if (!extension_loaded('pdo')) die('skip');
$dir = getenv('REDIR_TEST_DIR');
if (false == $dir) die('skip no driver');
+if (!strncasecmp(getenv('PDOTEST_DSN'), 'oci', strlen('oci'))) die('skip query not supported');
require_once $dir . 'pdo_test.inc';
PDOTest::skip();
?>
@@ -17,7 +18,7 @@ $db = PDOTest::factory();
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
$stmt = $db->query("
SELECT '
- Dumps the informations contained by a prepared statement directly on the output. It will provide the SQL query in use, the number of parameters used (Params), the list of parameters, with their name, type (paramtype) as an integer, their key name or position, and the position in the query (if this is supported by the PDO driver, otherwise, it will be -1).
+ Dumps the information contained by a prepared statement directly on the output. It will provide the SQL query in use, the number of parameters used (Params), the list of parameters, with their name, type (paramtype) as an integer, their key name or position, and the position in the query (if this is supported by the PDO driver, otherwise, it will be -1).
This is a debug function, which dump directly the data on the normal output.
Tip:
As with anything that outputs its result directly to the browser, the output-control functions can be used to capture the output of this function, and save it in a string (for example).
@@ -27,9 +28,9 @@ $stmt = $db->query("
var_dump($stmt->debugDumpParams());
?>
--EXPECT--
-SQL: [835]
+SQL: [834]
SELECT '
- Dumps the informations contained by a prepared statement directly on the output. It will provide the SQL query in use, the number of parameters used (Params), the list of parameters, with their name, type (paramtype) as an integer, their key name or position, and the position in the query (if this is supported by the PDO driver, otherwise, it will be -1).
+ Dumps the information contained by a prepared statement directly on the output. It will provide the SQL query in use, the number of parameters used (Params), the list of parameters, with their name, type (paramtype) as an integer, their key name or position, and the position in the query (if this is supported by the PDO driver, otherwise, it will be -1).
This is a debug function, which dump directly the data on the normal output.
Tip:
As with anything that outputs its result directly to the browser, the output-control functions can be used to capture the output of this function, and save it in a string (for example).
diff --git a/ext/pdo/tests/bug_71447.phpt b/ext/pdo/tests/bug_71447.phpt
index 8705717df1..1db3ccf151 100644
--- a/ext/pdo/tests/bug_71447.phpt
+++ b/ext/pdo/tests/bug_71447.phpt
@@ -22,9 +22,9 @@ $db->exec('INSERT INTO test VALUES(1)');
// Comment without quotes or placeholders
$stmt = $db->prepare("
- SELECT -- Thats all folks!
- '\"abc\":8000'
- FROM test
+ SELECT -- That's all folks!
+ '\"abc\":8000'
+ FROM test
");
$stmt->execute();
@@ -32,9 +32,9 @@ var_dump($stmt->fetchColumn());
// Comment and placeholder within a string
$stmt = $db->prepare("
- SELECT
- '\"abc\":8001 -- Wat?'
- FROM test
+ SELECT
+ '\"abc\":8001 -- Wat?'
+ FROM test
");
$stmt->execute();
@@ -42,9 +42,9 @@ var_dump($stmt->fetchColumn());
// Comment with single quote
$stmt = $db->prepare("
- SELECT -- That's all folks!
- '\"abc\":8002'
- FROM test
+ SELECT -- That's all folks!
+ '\"abc\":8002'
+ FROM test
");
$stmt->execute();
@@ -52,9 +52,9 @@ var_dump($stmt->fetchColumn());
// C-Style comment with single quote
$stmt = $db->prepare("
- SELECT /* That's all folks! */
- '\"abc\":8003'
- FROM test
+ SELECT /* That's all folks! */
+ '\"abc\":8003'
+ FROM test
");
$stmt->execute();
@@ -62,9 +62,9 @@ var_dump($stmt->fetchColumn());
// Comment with double quote
$stmt = $db->prepare("
- SELECT -- Is it only \"single quotes?
- '\"abc\":8004'
- FROM test
+ SELECT -- Is it only \"single quotes?
+ '\"abc\":8004'
+ FROM test
");
$stmt->execute();
@@ -72,10 +72,10 @@ var_dump($stmt->fetchColumn());
// Comment with ? placeholder
$stmt = $db->prepare("
- SELECT -- What about question marks here?
- *
- FROM test
- WHERE id = ?
+ SELECT -- What about question marks here?
+ *
+ FROM test
+ WHERE id = ?
");
$stmt->execute([1]);
@@ -83,10 +83,10 @@ var_dump($stmt->fetchColumn());
// Comment with named placeholder
$stmt = $db->prepare("
- SELECT -- What about placeholders :bar
- *
- FROM test
- WHERE id = :id
+ SELECT -- What about placeholders :bar
+ *
+ FROM test
+ WHERE id = :id
");
$stmt->execute(['id' => 1]);
diff --git a/ext/pdo/tests/bug_71885.phpt b/ext/pdo/tests/bug_71885.phpt
index 64e92608be..8eb097f5d9 100644
--- a/ext/pdo/tests/bug_71885.phpt
+++ b/ext/pdo/tests/bug_71885.phpt
@@ -22,33 +22,31 @@ $db->exec("CREATE TABLE test (a int)");
$sql = "SELECT * FROM test WHERE a ?? 1";
try {
- $db->exec($sql);
+ $db->exec($sql);
} catch (PDOException $e) {
- var_dump(strpos($e->getMessage(), "?") !== false);
+ var_dump(strpos($e->getMessage(), "?") !== false);
}
try {
- $stmt = $db->prepare($sql);
- $stmt->execute();
+ $stmt = $db->prepare($sql);
+ $stmt->execute();
} catch (PDOException $e) {
- var_dump(strpos($e->getMessage(), "?") !== false);
+ var_dump(strpos($e->getMessage(), "?") !== false);
}
if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql') {
- $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1);
+ $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1);
}
try {
- $stmt = $db->prepare($sql);
- $stmt->execute();
+ $stmt = $db->prepare($sql);
+ $stmt->execute();
} catch (PDOException $e) {
- var_dump(strpos($e->getMessage(), "?") !== false);
+ var_dump(strpos($e->getMessage(), "?") !== false);
}
?>
-===DONE===
--EXPECT--
bool(true)
bool(true)
bool(true)
-===DONE===
diff --git a/ext/pdo/tests/bug_79106.phpt b/ext/pdo/tests/bug_79106.phpt
new file mode 100644
index 0000000000..06e36aec74
--- /dev/null
+++ b/ext/pdo/tests/bug_79106.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Bug #79106 (PDO may fetch wrong column indexes with PDO::FETCH_BOTH)
+--SKIPIF--
+<?php
+if (!extension_loaded('pdo')) die('skip pdo extension not available');
+$dir = getenv('REDIR_TEST_DIR');
+if (!$dir) die('skip no driver');
+require_once $dir . 'pdo_test.inc';
+try {
+ $db = PDOTest::factory();
+} catch (PDOException $e) {
+ die('skip ' . $e->getMessage());
+}
+if ($db->query('SELECT 1 as "1"') === false) {
+ die('skip driver does not support quoted numeric identifiers');
+}
+?>
+--FILE--
+<?php
+if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR=' . dirname(__FILE__) . '/../../pdo/tests/');
+require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
+$db = PDOTest::factory();
+
+$stmt = $db->query('SELECT 0 as "2007", 0 as "2008", 0 as "2020"');
+var_dump($stmt->fetchAll());
+?>
+--EXPECT--
+array(1) {
+ [0]=>
+ array(6) {
+ [2007]=>
+ string(1) "0"
+ [0]=>
+ string(1) "0"
+ [2008]=>
+ string(1) "0"
+ [1]=>
+ string(1) "0"
+ [2020]=>
+ string(1) "0"
+ [2]=>
+ string(1) "0"
+ }
+}
diff --git a/ext/pdo/tests/bug_79106_collision.phpt b/ext/pdo/tests/bug_79106_collision.phpt
new file mode 100644
index 0000000000..8dcb9d997b
--- /dev/null
+++ b/ext/pdo/tests/bug_79106_collision.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Bug #79106 (PDO may fetch wrong column indexes with PDO::FETCH_BOTH) - collision
+--SKIPIF--
+<?php
+if (!extension_loaded('pdo')) die('skip pdo extension not available');
+$dir = getenv('REDIR_TEST_DIR');
+if (!$dir) die('skip no driver');
+require_once $dir . 'pdo_test.inc';
+try {
+ $db = PDOTest::factory();
+} catch (PDOException $e) {
+ die('skip ' . $e->getMessage());
+}
+if ($db->query('SELECT 1 as "1"') === false) {
+ die('skip driver does not support quoted numeric identifiers');
+}
+?>
+--FILE--
+<?php
+if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR=' . dirname(__FILE__) . '/../../pdo/tests/');
+require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
+$db = PDOTest::factory();
+
+$stmt = $db->query('SELECT 11111 as "1", 22222 as "2"');
+var_dump($stmt->fetchAll());
+?>
+--EXPECT--
+array(1) {
+ [0]=>
+ array(3) {
+ [1]=>
+ string(5) "11111"
+ [0]=>
+ string(5) "11111"
+ [2]=>
+ string(5) "22222"
+ }
+}
diff --git a/ext/pdo/tests/pdo.inc b/ext/pdo/tests/pdo.inc
index 8089236bbc..214764fc47 100644
--- a/ext/pdo/tests/pdo.inc
+++ b/ext/pdo/tests/pdo.inc
@@ -2,9 +2,9 @@
function set_sql($name, $query)
{
- if (empty($GLOBALS['SQL'][$name]))
- {
- $GLOBALS['SQL'][$name] = $query;
- }
+ if (empty($GLOBALS['SQL'][$name]))
+ {
+ $GLOBALS['SQL'][$name] = $query;
+ }
}
?>
diff --git a/ext/pdo/tests/pdo_005.phpt b/ext/pdo/tests/pdo_005.phpt
index 6e89aad744..25eab7782f 100644
--- a/ext/pdo/tests/pdo_005.phpt
+++ b/ext/pdo/tests/pdo_005.phpt
@@ -23,20 +23,20 @@ $stmt = $db->prepare('SELECT id, val, val2 from test');
class TestBase
{
- public $id;
- protected $val;
- private $val2;
+ public $id;
+ protected $val;
+ private $val2;
}
class TestDerived extends TestBase
{
- protected $row;
+ protected $row;
- public function __construct(&$row)
- {
- echo __METHOD__ . "($row,{$this->id})\n";
- $this->row = $row++;
- }
+ public function __construct(&$row)
+ {
+ echo __METHOD__ . "($row,{$this->id})\n";
+ $this->row = $row++;
+ }
}
$stmt->execute();
diff --git a/ext/pdo/tests/pdo_009.phpt b/ext/pdo/tests/pdo_009.phpt
index bc63aa66fd..7f332db742 100644
--- a/ext/pdo/tests/pdo_009.phpt
+++ b/ext/pdo/tests/pdo_009.phpt
@@ -28,26 +28,26 @@ $stmt = $db->prepare('SELECT classtypes.name, test.id AS id, test.val AS val FRO
class Test1
{
- public function __construct()
- {
- echo __METHOD__ . "()\n";
- }
+ public function __construct()
+ {
+ echo __METHOD__ . "()\n";
+ }
}
class Test2
{
- public function __construct()
- {
- echo __METHOD__ . "()\n";
- }
+ public function __construct()
+ {
+ echo __METHOD__ . "()\n";
+ }
}
class Test3
{
- public function __construct()
- {
- echo __METHOD__ . "()\n";
- }
+ public function __construct()
+ {
+ echo __METHOD__ . "()\n";
+ }
}
$stmt->execute();
diff --git a/ext/pdo/tests/pdo_010.phpt b/ext/pdo/tests/pdo_010.phpt
index f5b6bafbb9..7cc4ff15f7 100644
--- a/ext/pdo/tests/pdo_010.phpt
+++ b/ext/pdo/tests/pdo_010.phpt
@@ -28,26 +28,26 @@ $stmt = $db->prepare('SELECT classtypes.name, test.grp AS grp, test.id AS id, te
class Test1
{
- public function __construct()
- {
- echo __METHOD__ . "()\n";
- }
+ public function __construct()
+ {
+ echo __METHOD__ . "()\n";
+ }
}
class Test2
{
- public function __construct()
- {
- echo __METHOD__ . "()\n";
- }
+ public function __construct()
+ {
+ echo __METHOD__ . "()\n";
+ }
}
class Test3
{
- public function __construct()
- {
- echo __METHOD__ . "()\n";
- }
+ public function __construct()
+ {
+ echo __METHOD__ . "()\n";
+ }
}
diff --git a/ext/pdo/tests/pdo_011.phpt b/ext/pdo/tests/pdo_011.phpt
index e014ff9c9b..7985d4406a 100644
--- a/ext/pdo/tests/pdo_011.phpt
+++ b/ext/pdo/tests/pdo_011.phpt
@@ -22,16 +22,16 @@ $db->exec('INSERT INTO test VALUES(4, \'D\', \'Group2\')');
class DerivedStatement extends PDOStatement
{
- private function __construct($name, $db)
- {
- $this->name = $name;
- echo __METHOD__ . "($name)\n";
- }
+ private function __construct($name, $db)
+ {
+ $this->name = $name;
+ echo __METHOD__ . "($name)\n";
+ }
- function reTrieve($id, $val) {
- echo __METHOD__ . "($id,$val)\n";
- return array($id=>$val);
- }
+ function reTrieve($id, $val) {
+ echo __METHOD__ . "($id,$val)\n";
+ return array($id=>$val);
+ }
}
$select1 = $db->prepare('SELECT grp, id FROM test');
@@ -40,24 +40,24 @@ $derived = $db->prepare('SELECT id, val FROM test', array(PDO::ATTR_STATEMENT_CL
class Test1
{
- public function __construct($id, $val)
- {
- echo __METHOD__ . "($id,$val)\n";
- $this->id = $id;
- $this->val = $val;
- }
+ public function __construct($id, $val)
+ {
+ echo __METHOD__ . "($id,$val)\n";
+ $this->id = $id;
+ $this->val = $val;
+ }
- static public function factory($id, $val)
- {
- echo __METHOD__ . "($id,$val)\n";
- return new self($id, $val);
- }
+ static public function factory($id, $val)
+ {
+ echo __METHOD__ . "($id,$val)\n";
+ return new self($id, $val);
+ }
}
function test($id,$val='N/A')
{
- echo __METHOD__ . "($id,$val)\n";
- return array($id=>$val);
+ echo __METHOD__ . "($id,$val)\n";
+ return array($id=>$val);
}
$f = new Test1(0,0);
diff --git a/ext/pdo/tests/pdo_012.phpt b/ext/pdo/tests/pdo_012.phpt
index 0570f446cf..1acad839de 100644
--- a/ext/pdo/tests/pdo_012.phpt
+++ b/ext/pdo/tests/pdo_012.phpt
@@ -25,10 +25,10 @@ var_dump($stmt->fetchAll());
class Test
{
- function __construct($name = 'N/A')
- {
- echo __METHOD__ . "($name)\n";
- }
+ function __construct($name = 'N/A')
+ {
+ echo __METHOD__ . "($name)\n";
+ }
}
unset($stmt);
diff --git a/ext/pdo/tests/pdo_013.phpt b/ext/pdo/tests/pdo_013.phpt
index ab40738051..133fa40f19 100644
--- a/ext/pdo/tests/pdo_013.phpt
+++ b/ext/pdo/tests/pdo_013.phpt
@@ -26,22 +26,22 @@ $stmt->execute();
$stmt->setFetchMode(PDO::FETCH_NUM);
foreach ($stmt as $data)
{
- var_dump($data);
+ var_dump($data);
}
class Test
{
- function __construct($name = 'N/A')
- {
- echo __METHOD__ . "($name)\n";
- }
+ function __construct($name = 'N/A')
+ {
+ echo __METHOD__ . "($name)\n";
+ }
}
unset($stmt);
foreach ($db->query($SELECT, PDO::FETCH_CLASS, 'Test') as $data)
{
- var_dump($data);
+ var_dump($data);
}
unset($stmt);
@@ -50,7 +50,7 @@ $stmt = $db->query($SELECT, PDO::FETCH_CLASS, 'Test', array('WOW'));
foreach($stmt as $data)
{
- var_dump($data);
+ var_dump($data);
}
?>
--EXPECTF--
diff --git a/ext/pdo/tests/pdo_014.phpt b/ext/pdo/tests/pdo_014.phpt
index 5c7774f2cd..ef47fd89d0 100644
--- a/ext/pdo/tests/pdo_014.phpt
+++ b/ext/pdo/tests/pdo_014.phpt
@@ -21,10 +21,10 @@ $SELECT = 'SELECT val, grp FROM test';
class Test
{
- function __construct($name = 'N/A')
- {
- echo __METHOD__ . "($name)\n";
- }
+ function __construct($name = 'N/A')
+ {
+ echo __METHOD__ . "($name)\n";
+ }
}
$stmt = $db->query($SELECT, PDO::FETCH_CLASS, 'Test', array('WOW'));
@@ -35,7 +35,7 @@ $it = new IteratorIterator($stmt); /* check if we can convert that thing */
foreach($it as $data)
{
- var_dump($data);
+ var_dump($data);
}
$it->next(); /* must be allowed */
@@ -44,26 +44,26 @@ var_dump($it->valid()); /* must return false */
class PDOStatementAggregate extends PDOStatement implements IteratorAggregate
{
- private function __construct()
- {
- echo __METHOD__ . "\n";
- $this->setFetchMode(PDO::FETCH_NUM);
- /* default fetch mode is BOTH, so we see if the ctor can overwrite that */
- }
+ private function __construct()
+ {
+ echo __METHOD__ . "\n";
+ $this->setFetchMode(PDO::FETCH_NUM);
+ /* default fetch mode is BOTH, so we see if the ctor can overwrite that */
+ }
- function getIterator()
- {
- echo __METHOD__ . "\n";
- $this->execute();
- return new IteratorIterator($this, 'PDOStatement');
- }
+ function getIterator()
+ {
+ echo __METHOD__ . "\n";
+ $this->execute();
+ return new IteratorIterator($this, 'PDOStatement');
+ }
}
$stmt = $db->prepare($SELECT, array(PDO::ATTR_STATEMENT_CLASS=>array('PDOStatementAggregate')));
foreach($stmt as $data)
{
- var_dump($data);
+ var_dump($data);
}
?>
diff --git a/ext/pdo/tests/pdo_016.phpt b/ext/pdo/tests/pdo_016.phpt
index 6879faa5b9..69a70a1a4b 100644
--- a/ext/pdo/tests/pdo_016.phpt
+++ b/ext/pdo/tests/pdo_016.phpt
@@ -16,7 +16,7 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
$db = PDOTest::factory();
if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql') {
- $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
+ $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
}
$db->exec('CREATE TABLE test(idx int NOT NULL PRIMARY KEY, txt VARCHAR(20))');
@@ -42,7 +42,7 @@ $stmt2->bindColumn('txt', $txt);
$stmt2->execute();
while($stmt2->fetch(PDO::FETCH_BOUND)) {
- var_dump(array($idx=>$txt));
+ var_dump(array($idx=>$txt));
}
echo "===ALONE===\n";
@@ -55,26 +55,26 @@ $stmt4->bindParam(':txt', $txt); /* using same name */
foreach($cont as $idx => $txt)
{
- var_dump(array($idx=>$txt));
- var_dump($stmt3->execute());
-
- if ($idx == 0) {
- /* portability-wise, you may only bindColumn()s
- * after execute() has been called at least once */
- $stmt3->bindColumn('txt', $col1);
- }
- var_dump($stmt3->fetch(PDO::FETCH_BOUND));
- $stmt3->closeCursor();
-
- var_dump($stmt4->execute());
- if ($idx == 0) {
- /* portability-wise, you may only bindColumn()s
- * after execute() has been called at least once */
- $stmt4->bindColumn('idx', $col2);
- }
- var_dump($stmt4->fetch(PDO::FETCH_BOUND));
- $stmt4->closeCursor();
- var_dump(array($col2=>$col1));
+ var_dump(array($idx=>$txt));
+ var_dump($stmt3->execute());
+
+ if ($idx == 0) {
+ /* portability-wise, you may only bindColumn()s
+ * after execute() has been called at least once */
+ $stmt3->bindColumn('txt', $col1);
+ }
+ var_dump($stmt3->fetch(PDO::FETCH_BOUND));
+ $stmt3->closeCursor();
+
+ var_dump($stmt4->execute());
+ if ($idx == 0) {
+ /* portability-wise, you may only bindColumn()s
+ * after execute() has been called at least once */
+ $stmt4->bindColumn('idx', $col2);
+ }
+ var_dump($stmt4->fetch(PDO::FETCH_BOUND));
+ $stmt4->closeCursor();
+ var_dump(array($col2=>$col1));
}
echo "===REBIND/SAME===\n";
@@ -83,15 +83,15 @@ $stmt4->bindColumn('idx', $col1);
foreach($cont as $idx => $txt)
{
- var_dump(array($idx=>$txt));
- var_dump($stmt3->execute());
- var_dump($stmt3->fetch(PDO::FETCH_BOUND));
- $stmt3->closeCursor();
- var_dump($col1);
- var_dump($stmt4->execute());
- var_dump($stmt4->fetch(PDO::FETCH_BOUND));
- $stmt4->closeCursor();
- var_dump($col1);
+ var_dump(array($idx=>$txt));
+ var_dump($stmt3->execute());
+ var_dump($stmt3->fetch(PDO::FETCH_BOUND));
+ $stmt3->closeCursor();
+ var_dump($col1);
+ var_dump($stmt4->execute());
+ var_dump($stmt4->fetch(PDO::FETCH_BOUND));
+ $stmt4->closeCursor();
+ var_dump($col1);
}
echo "===REBIND/CONFLICT===\n";
@@ -102,7 +102,7 @@ $stmt2->execute();
while($stmt2->fetch(PDO::FETCH_BOUND))
{
- var_dump($col1);
+ var_dump($col1);
}
diff --git a/ext/pdo/tests/pdo_016a.phpt b/ext/pdo/tests/pdo_016a.phpt
index 9f07516f8e..5f64d462d6 100644
--- a/ext/pdo/tests/pdo_016a.phpt
+++ b/ext/pdo/tests/pdo_016a.phpt
@@ -16,7 +16,7 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
$db = PDOTest::factory();
if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql') {
- $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
+ $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
}
$db->exec('CREATE TABLE test(idx int NOT NULL PRIMARY KEY, txt VARCHAR(20))');
@@ -42,7 +42,7 @@ $stmt2->bindColumn('txt', $txt);
$stmt2->execute();
while($stmt2->fetch(PDO::FETCH_BOUND)) {
- var_dump(array($idx=>$txt));
+ var_dump(array($idx=>$txt));
}
echo "===ALONE===\n";
@@ -55,26 +55,26 @@ $stmt4->bindParam('txt', $txt); /* using same name */
foreach($cont as $idx => $txt)
{
- var_dump(array($idx=>$txt));
- var_dump($stmt3->execute());
-
- if ($idx == 0) {
- /* portability-wise, you may only bindColumn()s
- * after execute() has been called at least once */
- $stmt3->bindColumn('txt', $col1);
- }
- var_dump($stmt3->fetch(PDO::FETCH_BOUND));
- $stmt3->closeCursor();
-
- var_dump($stmt4->execute());
- if ($idx == 0) {
- /* portability-wise, you may only bindColumn()s
- * after execute() has been called at least once */
- $stmt4->bindColumn('idx', $col2);
- }
- var_dump($stmt4->fetch(PDO::FETCH_BOUND));
- $stmt4->closeCursor();
- var_dump(array($col2=>$col1));
+ var_dump(array($idx=>$txt));
+ var_dump($stmt3->execute());
+
+ if ($idx == 0) {
+ /* portability-wise, you may only bindColumn()s
+ * after execute() has been called at least once */
+ $stmt3->bindColumn('txt', $col1);
+ }
+ var_dump($stmt3->fetch(PDO::FETCH_BOUND));
+ $stmt3->closeCursor();
+
+ var_dump($stmt4->execute());
+ if ($idx == 0) {
+ /* portability-wise, you may only bindColumn()s
+ * after execute() has been called at least once */
+ $stmt4->bindColumn('idx', $col2);
+ }
+ var_dump($stmt4->fetch(PDO::FETCH_BOUND));
+ $stmt4->closeCursor();
+ var_dump(array($col2=>$col1));
}
echo "===REBIND/SAME===\n";
@@ -83,15 +83,15 @@ $stmt4->bindColumn('idx', $col1);
foreach($cont as $idx => $txt)
{
- var_dump(array($idx=>$txt));
- var_dump($stmt3->execute());
- var_dump($stmt3->fetch(PDO::FETCH_BOUND));
- $stmt3->closeCursor();
- var_dump($col1);
- var_dump($stmt4->execute());
- var_dump($stmt4->fetch(PDO::FETCH_BOUND));
- $stmt4->closeCursor();
- var_dump($col1);
+ var_dump(array($idx=>$txt));
+ var_dump($stmt3->execute());
+ var_dump($stmt3->fetch(PDO::FETCH_BOUND));
+ $stmt3->closeCursor();
+ var_dump($col1);
+ var_dump($stmt4->execute());
+ var_dump($stmt4->fetch(PDO::FETCH_BOUND));
+ $stmt4->closeCursor();
+ var_dump($col1);
}
echo "===REBIND/CONFLICT===\n";
@@ -102,7 +102,7 @@ $stmt2->execute();
while($stmt2->fetch(PDO::FETCH_BOUND))
{
- var_dump($col1);
+ var_dump($col1);
}
diff --git a/ext/pdo/tests/pdo_017.phpt b/ext/pdo/tests/pdo_017.phpt
index 32018da6e1..f06ebbdc43 100644
--- a/ext/pdo/tests/pdo_017.phpt
+++ b/ext/pdo/tests/pdo_017.phpt
@@ -29,10 +29,10 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
$db = PDOTest::factory();
if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql') {
- require_once(__DIR__ . DIRECTORY_SEPARATOR . '../../pdo_mysql/tests/mysql_pdo_test.inc');
- $suf = ' ENGINE=' . MySQLPDOTest::detect_transactional_mysql_engine($db);
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . '../../pdo_mysql/tests/mysql_pdo_test.inc');
+ $suf = ' ENGINE=' . MySQLPDOTest::detect_transactional_mysql_engine($db);
} else {
- $suf = '';
+ $suf = '';
}
$db->exec('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, val VARCHAR(10))'.$suf);
@@ -43,8 +43,8 @@ $delete = $db->prepare('DELETE FROM test');
function countRows($action) {
global $db;
- $select = $db->prepare('SELECT COUNT(*) FROM test');
- $select->execute();
+ $select = $db->prepare('SELECT COUNT(*) FROM test');
+ $select->execute();
$res = $select->fetchColumn();
return "Counted $res rows after $action.\n";
}
diff --git a/ext/pdo/tests/pdo_018.phpt b/ext/pdo/tests/pdo_018.phpt
index b99cb80968..d35e078b32 100644
--- a/ext/pdo/tests/pdo_018.phpt
+++ b/ext/pdo/tests/pdo_018.phpt
@@ -16,50 +16,50 @@ $db = PDOTest::factory();
class TestBase implements Serializable
{
- public $BasePub = 'Public';
- protected $BasePro = 'Protected';
- private $BasePri = 'Private';
+ public $BasePub = 'Public';
+ protected $BasePro = 'Protected';
+ private $BasePri = 'Private';
- function serialize()
- {
- $serialized = array();
- foreach($this as $prop => $val) {
- $serialized[$prop] = $val;
- }
- $serialized = serialize($serialized);
- echo __METHOD__ . "() = '$serialized'\n";
- return $serialized;
- }
+ function serialize()
+ {
+ $serialized = array();
+ foreach($this as $prop => $val) {
+ $serialized[$prop] = $val;
+ }
+ $serialized = serialize($serialized);
+ echo __METHOD__ . "() = '$serialized'\n";
+ return $serialized;
+ }
- function unserialize($serialized)
- {
- echo __METHOD__ . "($serialized)\n";
- foreach(unserialize($serialized) as $prop => $val) {
- $this->$prop = '#'.$val;
- }
- return true;
- }
+ function unserialize($serialized)
+ {
+ echo __METHOD__ . "($serialized)\n";
+ foreach(unserialize($serialized) as $prop => $val) {
+ $this->$prop = '#'.$val;
+ }
+ return true;
+ }
}
class TestDerived extends TestBase
{
- public $BasePub = 'DerivedPublic';
- protected $BasePro = 'DerivdeProtected';
- public $DerivedPub = 'Public';
- protected $DerivedPro = 'Protected';
- private $DerivedPri = 'Private';
+ public $BasePub = 'DerivedPublic';
+ protected $BasePro = 'DerivdeProtected';
+ public $DerivedPub = 'Public';
+ protected $DerivedPro = 'Protected';
+ private $DerivedPri = 'Private';
- function serialize()
- {
- echo __METHOD__ . "()\n";
- return TestBase::serialize();
- }
+ function serialize()
+ {
+ echo __METHOD__ . "()\n";
+ return TestBase::serialize();
+ }
- function unserialize($serialized)
- {
- echo __METHOD__ . "()\n";
- return TestBase::unserialize($serialized);
- }
+ function unserialize($serialized)
+ {
+ echo __METHOD__ . "()\n";
+ return TestBase::unserialize($serialized);
+ }
}
class TestLeaf extends TestDerived
@@ -101,12 +101,12 @@ $ctypes = array();
foreach($objs as $obj)
{
- $cname = get_class($obj);
- $ctype = NULL; /* set default for non stored class name */
- $stmt->execute();
- $stmt->bindColumn('id', $ctype);
- $stmt->fetch(PDO::FETCH_BOUND);
- $ctypes[$cname] = $ctype;
+ $cname = get_class($obj);
+ $ctype = NULL; /* set default for non stored class name */
+ $stmt->execute();
+ $stmt->bindColumn('id', $ctype);
+ $stmt->fetch(PDO::FETCH_BOUND);
+ $ctypes[$cname] = $ctype;
}
echo "===TYPES===\n";
@@ -122,16 +122,16 @@ $stmt->bindParam(':val', $val);
foreach($objs as $idx => $obj)
{
- $ctype = $ctypes[get_class($obj)];
- if (method_exists($obj, 'serialize'))
- {
- $val = $obj->serialize();
- }
- else
- {
- $val = '';
- }
- $stmt->execute();
+ $ctype = $ctypes[get_class($obj)];
+ if (method_exists($obj, 'serialize'))
+ {
+ $val = $obj->serialize();
+ }
+ else
+ {
+ $val = '';
+ }
+ $stmt->execute();
}
unset($stmt);
@@ -140,31 +140,31 @@ echo "===DATA===\n";
$res = $db->query('SELECT test.val FROM test')->fetchAll(PDO::FETCH_COLUMN);
switch ($db->getAttribute(PDO::ATTR_DRIVER_NAME)) {
- case 'dblib':
- // map whitespace (from early TDS versions) to empty string so the test doesn't diff
- if ($res[0] === ' ') {
- $res[0] = '';
- }
- break;
+ case 'dblib':
+ // map whitespace (from early TDS versions) to empty string so the test doesn't diff
+ if ($res[0] === ' ') {
+ $res[0] = '';
+ }
+ break;
- case 'oci':
- // map NULL to empty string so the test doesn't diff
- if ($res[0] === null) {
- $res[0] = '';
- }
- break;
+ case 'oci':
+ // map NULL to empty string so the test doesn't diff
+ if ($res[0] === null) {
+ $res[0] = '';
+ }
+ break;
}
var_dump($res);
echo "===FAILURE===\n";
try
{
- $db->query('SELECT classtypes.name AS name, test.val AS val FROM test LEFT JOIN classtypes ON test.classtype=classtypes.id')->fetchAll(PDO::FETCH_CLASS|PDO::FETCH_CLASSTYPE|PDO::FETCH_SERIALIZE, 'TestLeaf', array());
+ $db->query('SELECT classtypes.name AS name, test.val AS val FROM test LEFT JOIN classtypes ON test.classtype=classtypes.id')->fetchAll(PDO::FETCH_CLASS|PDO::FETCH_CLASSTYPE|PDO::FETCH_SERIALIZE, 'TestLeaf', array());
}
catch (PDOException $e)
{
- echo 'Exception:';
- echo $e->getMessage()."\n";
+ echo 'Exception:';
+ echo $e->getMessage()."\n";
}
echo "===COUNT===\n";
diff --git a/ext/pdo/tests/pdo_019.phpt b/ext/pdo/tests/pdo_019.phpt
index 68c5311b41..f37b9b13a5 100644
--- a/ext/pdo/tests/pdo_019.phpt
+++ b/ext/pdo/tests/pdo_019.phpt
@@ -36,7 +36,7 @@ $stmt->bindColumn('txt', $txt);
$stmt->execute();
while($stmt->fetch(PDO::FETCH_BOUND)) {
- var_dump(array($idx=>$txt));
+ var_dump(array($idx=>$txt));
}
?>
diff --git a/ext/pdo/tests/pdo_020.phpt b/ext/pdo/tests/pdo_020.phpt
index 32f53d840e..4586cc202d 100644
--- a/ext/pdo/tests/pdo_020.phpt
+++ b/ext/pdo/tests/pdo_020.phpt
@@ -21,10 +21,10 @@ $db->exec("INSERT INTO test VALUES(3, 'C', 'C')");
foreach (array('SELECT id, val FROM test', 'SELECT id, val, val2 FROM test', 'SELECT COUNT(*) FROM test') as $sql) {
- $stmt = $db->query($sql);
- $res = $stmt->columnCount();
+ $stmt = $db->query($sql);
+ $res = $stmt->columnCount();
echo "Counted $res columns after $sql.\n";
- $stmt = null;
+ $stmt = null;
}
?>
diff --git a/ext/pdo/tests/pdo_021.phpt b/ext/pdo/tests/pdo_021.phpt
index 10b8029c20..b627c453bf 100644
--- a/ext/pdo/tests/pdo_021.phpt
+++ b/ext/pdo/tests/pdo_021.phpt
@@ -15,7 +15,7 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
$db = PDOTest::factory();
if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql') {
- $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
+ $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
}
$db->exec('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(16))');
diff --git a/ext/pdo/tests/pdo_023.phpt b/ext/pdo/tests/pdo_023.phpt
index e021e67881..61c614ba52 100644
--- a/ext/pdo/tests/pdo_023.phpt
+++ b/ext/pdo/tests/pdo_023.phpt
@@ -19,14 +19,14 @@ class PDOStatementX extends PDOStatement
protected function __construct()
{
- $this->test2 = 2;
- $this->test2 = 22;
- echo __METHOD__ . "()\n";
+ $this->test2 = 2;
+ $this->test2 = 22;
+ echo __METHOD__ . "()\n";
}
function __destruct()
{
- echo __METHOD__ . "()\n";
+ echo __METHOD__ . "()\n";
}
}
@@ -36,23 +36,23 @@ class PDODatabaseX extends PDO
function __destruct()
{
- echo __METHOD__ . "()\n";
+ echo __METHOD__ . "()\n";
}
function test()
{
- $this->test2 = 2;
+ $this->test2 = 2;
var_dump($this->test1);
var_dump($this->test2);
- $this->test2 = 22;
+ $this->test2 = 22;
}
function query($sql)
{
- echo __METHOD__ . "()\n";
- $stmt = parent::prepare($sql, array(PDO::ATTR_STATEMENT_CLASS=>array('PDOStatementx')));
- $stmt->execute();
- return $stmt;
+ echo __METHOD__ . "()\n";
+ $stmt = parent::prepare($sql, array(PDO::ATTR_STATEMENT_CLASS=>array('PDOStatementx')));
+ $stmt->execute();
+ return $stmt;
}
}
diff --git a/ext/pdo/tests/pdo_024.phpt b/ext/pdo/tests/pdo_024.phpt
index 042322871f..6f8063cc80 100644
--- a/ext/pdo/tests/pdo_024.phpt
+++ b/ext/pdo/tests/pdo_024.phpt
@@ -15,14 +15,14 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
$db = PDOTest::factory();
switch ($db->getAttribute(PDO::ATTR_DRIVER_NAME)) {
- case 'dblib':
- // environment settings can influence how the table is created if specifics are missing
- // https://msdn.microsoft.com/en-us/library/ms174979.aspx#Nullability Rules Within a Table Definition
- $sql = 'create table test (id int, name varchar(10) null)';
- break;
- default:
- $sql = 'create table test (id int, name varchar(10))';
- break;
+ case 'dblib':
+ // environment settings can influence how the table is created if specifics are missing
+ // https://msdn.microsoft.com/en-us/library/ms174979.aspx#Nullability Rules Within a Table Definition
+ $sql = 'create table test (id int, name varchar(10) null)';
+ break;
+ default:
+ $sql = 'create table test (id int, name varchar(10))';
+ break;
}
$db->exec($sql);
@@ -31,9 +31,9 @@ $name = NULL;
$before_bind = $name;
$stmt->bindParam(':name', $name, PDO::PARAM_NULL);
if ($name !== $before_bind) {
- echo "bind: fail\n";
+ echo "bind: fail\n";
} else {
- echo "bind: success\n";
+ echo "bind: success\n";
}
var_dump($stmt->execute());
var_dump($db->query('select name from test where id=0')->fetchColumn());
diff --git a/ext/pdo/tests/pdo_025.phpt b/ext/pdo/tests/pdo_025.phpt
index 43cc542a00..7bbd9b92f2 100644
--- a/ext/pdo/tests/pdo_025.phpt
+++ b/ext/pdo/tests/pdo_025.phpt
@@ -33,7 +33,7 @@ foreach ($data as $row) {
}
class Test {
- public $id, $val, $val2;
+ public $id, $val, $val2;
}
$stmt = $db->prepare('SELECT * FROM test');
@@ -41,21 +41,21 @@ $stmt->setFetchMode(PDO::FETCH_INTO, new Test);
$stmt->execute();
foreach($stmt as $obj) {
- var_dump($obj);
+ var_dump($obj);
}
echo "===FAIL===\n";
class Fail {
- protected $id;
- public $val, $val2;
+ protected $id;
+ public $val, $val2;
}
$stmt->setFetchMode(PDO::FETCH_INTO, new Fail);
$stmt->execute();
foreach($stmt as $obj) {
- var_dump($obj);
+ var_dump($obj);
}
?>
diff --git a/ext/pdo/tests/pdo_026.phpt b/ext/pdo/tests/pdo_026.phpt
index 8f72aff6e1..4bb1890b36 100644
--- a/ext/pdo/tests/pdo_026.phpt
+++ b/ext/pdo/tests/pdo_026.phpt
@@ -25,13 +25,13 @@ class PDOStatementX extends PDOStatement
protected function __construct($dbh)
{
- $this->dbh = $dbh;
- echo __METHOD__ . "()\n";
+ $this->dbh = $dbh;
+ echo __METHOD__ . "()\n";
}
function __destruct()
{
- echo __METHOD__ . "()\n";
+ echo __METHOD__ . "()\n";
}
}
@@ -39,16 +39,16 @@ class PDODatabase extends PDO
{
function __destruct()
{
- echo __METHOD__ . "()\n";
+ echo __METHOD__ . "()\n";
}
function query($sql)
{
- echo __METHOD__ . "()\n";
- $stmt = $this->prepare($sql, array(PDO::ATTR_STATEMENT_CLASS=>array('PDOStatementx', array($this))));
- $stmt->setFetchMode(PDO::FETCH_ASSOC);
- $stmt->execute();
- return $stmt;
+ echo __METHOD__ . "()\n";
+ $stmt = $this->prepare($sql, array(PDO::ATTR_STATEMENT_CLASS=>array('PDOStatementx', array($this))));
+ $stmt->setFetchMode(PDO::FETCH_ASSOC);
+ $stmt->execute();
+ return $stmt;
}
}
@@ -70,7 +70,7 @@ var_dump(get_class($stmt));
var_dump(get_class($stmt->dbh));
foreach($stmt as $obj) {
- var_dump($obj);
+ var_dump($obj);
}
echo "===DONE===\n";
diff --git a/ext/pdo/tests/pdo_027.phpt b/ext/pdo/tests/pdo_027.phpt
index e10ab0aa75..79151d0b6d 100644
--- a/ext/pdo/tests/pdo_027.phpt
+++ b/ext/pdo/tests/pdo_027.phpt
@@ -19,7 +19,7 @@ $db->exec("INSERT INTO test (id,name) VALUES(1,'test1')");
$db->exec("INSERT INTO test (id,name) VALUES(2,'test2')");
foreach ($db->query("SELECT * FROM test", PDO::FETCH_LAZY) as $v) {
- echo "lazy: " . $v->id.$v->name."\n";
+ echo "lazy: " . $v->id.$v->name."\n";
}
echo "End\n";
?>
diff --git a/ext/pdo/tests/pdo_028.phpt b/ext/pdo/tests/pdo_028.phpt
index 726c28b2b8..427a22343c 100644
--- a/ext/pdo/tests/pdo_028.phpt
+++ b/ext/pdo/tests/pdo_028.phpt
@@ -20,7 +20,7 @@ $stmt = $db->prepare('INSERT INTO test values (1, ?, ?, ?)');
$data = array("one", "two", "three");
foreach ($data as $i => $v) {
- $stmt->bindValue($i+1, $v);
+ $stmt->bindValue($i+1, $v);
}
$stmt->execute();
diff --git a/ext/pdo/tests/pdo_029.phpt b/ext/pdo/tests/pdo_029.phpt
index 8204de236a..10ab369128 100644
--- a/ext/pdo/tests/pdo_029.phpt
+++ b/ext/pdo/tests/pdo_029.phpt
@@ -25,19 +25,19 @@ class PDOStatementX extends PDOStatement
protected function __construct($dbh)
{
- $this->dbh = $dbh;
- echo __METHOD__ . "()\n";
+ $this->dbh = $dbh;
+ echo __METHOD__ . "()\n";
}
function __destruct()
{
- echo __METHOD__ . "()\n";
+ echo __METHOD__ . "()\n";
}
function execute($params = array())
{
- echo __METHOD__ . "()\n";
- parent::execute();
+ echo __METHOD__ . "()\n";
+ parent::execute();
}
}
@@ -45,16 +45,16 @@ class PDODatabase extends PDO
{
function __destruct()
{
- echo __METHOD__ . "()\n";
+ echo __METHOD__ . "()\n";
}
function query($sql)
{
- echo __METHOD__ . "()\n";
- $stmt = $this->prepare($sql, array(PDO::ATTR_STATEMENT_CLASS=>array('PDOStatementx', array($this))));
- $stmt->setFetchMode(PDO::FETCH_ASSOC);
- $stmt->execute();
- return $stmt;
+ echo __METHOD__ . "()\n";
+ $stmt = $this->prepare($sql, array(PDO::ATTR_STATEMENT_CLASS=>array('PDOStatementx', array($this))));
+ $stmt->setFetchMode(PDO::FETCH_ASSOC);
+ $stmt->execute();
+ return $stmt;
}
}
@@ -80,7 +80,7 @@ var_dump(get_class($stmt->dbh));
echo "===FOREACH===\n";
foreach($stmt as $obj) {
- var_dump($obj);
+ var_dump($obj);
}
echo "===DONE===\n";
diff --git a/ext/pdo/tests/pdo_030.phpt b/ext/pdo/tests/pdo_030.phpt
index bc697d7108..2d054e0dd6 100644
--- a/ext/pdo/tests/pdo_030.phpt
+++ b/ext/pdo/tests/pdo_030.phpt
@@ -25,20 +25,20 @@ class PDOStatementX extends PDOStatement
protected function __construct($dbh)
{
- $this->dbh = $dbh;
- $this->setFetchMode(PDO::FETCH_ASSOC);
- echo __METHOD__ . "()\n";
+ $this->dbh = $dbh;
+ $this->setFetchMode(PDO::FETCH_ASSOC);
+ echo __METHOD__ . "()\n";
}
function __destruct()
{
- echo __METHOD__ . "()\n";
+ echo __METHOD__ . "()\n";
}
function execute($params = array())
{
- echo __METHOD__ . "()\n";
- parent::execute();
+ echo __METHOD__ . "()\n";
+ parent::execute();
}
}
@@ -46,13 +46,13 @@ class PDODatabase extends PDO
{
function __destruct()
{
- echo __METHOD__ . "()\n";
+ echo __METHOD__ . "()\n";
}
function query($sql)
{
- echo __METHOD__ . "()\n";
- return parent::query($sql);
+ echo __METHOD__ . "()\n";
+ return parent::query($sql);
}
}
@@ -81,7 +81,7 @@ var_dump(get_class($stmt->dbh));
echo "===FOREACH===\n";
foreach($stmt as $obj) {
- var_dump($obj);
+ var_dump($obj);
}
echo "===DONE===\n";
diff --git a/ext/pdo/tests/pdo_031.phpt b/ext/pdo/tests/pdo_031.phpt
index 689f7624ce..bf1d0e06ca 100644
--- a/ext/pdo/tests/pdo_031.phpt
+++ b/ext/pdo/tests/pdo_031.phpt
@@ -36,7 +36,7 @@ $stmt = $db->query('SELECT * FROM test');
foreach(new RecursiveTreeIterator(new RecursiveArrayIterator($stmt->fetchAll(PDO::FETCH_ASSOC)), RecursiveTreeIterator::BYPASS_KEY) as $c=>$v)
{
- echo "$v [$c]\n";
+ echo "$v [$c]\n";
}
echo "===DONE===\n";
diff --git a/ext/pdo/tests/pdo_034.phpt b/ext/pdo/tests/pdo_034.phpt
index dafcca1c71..3a504b6dea 100644
--- a/ext/pdo/tests/pdo_034.phpt
+++ b/ext/pdo/tests/pdo_034.phpt
@@ -17,7 +17,7 @@ $db = PDOTest::factory();
$db->exec("CREATE TABLE test (a varchar(100), b varchar(100), c varchar(100))");
for ($i = 0; $i < 5; $i++) {
- $db->exec("INSERT INTO test (a,b,c) VALUES('test".$i."','".$i."','".$i."')");
+ $db->exec("INSERT INTO test (a,b,c) VALUES('test".$i."','".$i."','".$i."')");
}
var_dump($db->query("SELECT a,b FROM test")->fetch(PDO::FETCH_KEY_PAIR));
@@ -44,7 +44,7 @@ array(5) {
string(1) "4"
}
-Warning: PDOStatement::fetch(): SQLSTATE[HY000]: General error: PDO::FETCH_KEY_PAIR fetch mode requires the result set to contain extactly 2 columns. in %spdo_034.php on line %d
+Warning: PDOStatement::fetch(): SQLSTATE[HY000]: General error: PDO::FETCH_KEY_PAIR fetch mode requires the result set to contain exactly 2 columns. in %spdo_034.php on line %d
Warning: PDOStatement::fetch(): SQLSTATE[HY000]: General error%spdo_034.php on line %d
bool(false)
diff --git a/ext/pdo/tests/pdo_drivers_error.phpt b/ext/pdo/tests/pdo_drivers_error.phpt
deleted file mode 100644
index 5a371f02bc..0000000000
--- a/ext/pdo/tests/pdo_drivers_error.phpt
+++ /dev/null
@@ -1,15 +0,0 @@
---TEST--
-Test that PDO::getAvailableDrivers / pdo_drivers does not accept any parameters
---CREDITS--
-Amo Chohan <amo.chohan@gmail.com>
---SKIPIF--
-<?php
-if (!extension_loaded('pdo')) die('skip');
---FILE--
-<?php
-PDO::getAvailableDrivers('fail');
-pdo_drivers('fail');
---EXPECTF--
-Warning: PDO::getAvailableDrivers() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: pdo_drivers() expects exactly 0 parameters, 1 given in %s on line %d
diff --git a/ext/pdo/tests/pdo_dsn_containing_credentials.phpt b/ext/pdo/tests/pdo_dsn_containing_credentials.phpt
index dca3ba1709..94859e5360 100644
--- a/ext/pdo/tests/pdo_dsn_containing_credentials.phpt
+++ b/ext/pdo/tests/pdo_dsn_containing_credentials.phpt
@@ -15,36 +15,36 @@ PDOTest::skip();
?>
--FILE--
<?php
- require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
-
- $orgDsn = getenv('PDOTEST_DSN');
- $orgUser = getenv('PDOTEST_USER');
- $orgPass = getenv('PDOTEST_PASS');
-
- try
- {
- putenv("PDOTEST_DSN=$orgDsn;user=$orgUser;password=$orgPass");
- putenv("PDOTEST_USER");
- putenv("PDOTEST_PASS");
-
- $link = PDOTest::factory();
- echo "using credentials in dsn: done\n";
-
-
- // test b/c - credentials in DSN are ignored when user/pass passed as separate params
- putenv("PDOTEST_DSN=$orgDsn;user=incorrect;password=ignored");
- putenv("PDOTEST_USER=$orgUser");
- putenv("PDOTEST_PASS=$orgPass");
-
- $link = PDOTest::factory();
- echo "ignoring credentials in dsn: done\n";
- }
- finally
- {
- putenv("PDOTEST_DSN=$orgDsn");
- putenv("PDOTEST_USER=$orgUser");
- putenv("PDOTEST_PASS=$orgPass");
- }
+ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
+
+ $orgDsn = getenv('PDOTEST_DSN');
+ $orgUser = getenv('PDOTEST_USER');
+ $orgPass = getenv('PDOTEST_PASS');
+
+ try
+ {
+ putenv("PDOTEST_DSN=$orgDsn;user=$orgUser;password=$orgPass");
+ putenv("PDOTEST_USER");
+ putenv("PDOTEST_PASS");
+
+ $link = PDOTest::factory();
+ echo "using credentials in dsn: done\n";
+
+
+ // test b/c - credentials in DSN are ignored when user/pass passed as separate params
+ putenv("PDOTEST_DSN=$orgDsn;user=incorrect;password=ignored");
+ putenv("PDOTEST_USER=$orgUser");
+ putenv("PDOTEST_PASS=$orgPass");
+
+ $link = PDOTest::factory();
+ echo "ignoring credentials in dsn: done\n";
+ }
+ finally
+ {
+ putenv("PDOTEST_DSN=$orgDsn");
+ putenv("PDOTEST_USER=$orgUser");
+ putenv("PDOTEST_PASS=$orgPass");
+ }
?>
--EXPECTF--
using credentials in dsn: done
diff --git a/ext/pdo/tests/pdo_test.inc b/ext/pdo/tests/pdo_test.inc
index 443c8dd822..2238123d40 100644
--- a/ext/pdo/tests/pdo_test.inc
+++ b/ext/pdo/tests/pdo_test.inc
@@ -2,83 +2,83 @@
# PDO test framework utilities
if (getenv('PDOTEST_DSN') === false) {
- $common = '';
- $append = false;
- foreach(file(dirname($_SERVER['PHP_SELF']).'/common.phpt') as $line) {
- if ($append) {
- $common .= $line;
- } elseif (trim($line) == '--REDIRECTTEST--') {
- $append = true;
- }
- }
- $conf = eval($common);
- foreach($conf['ENV'] as $n=>$v) putenv("$n=$v");
+ $common = '';
+ $append = false;
+ foreach(file(dirname($_SERVER['PHP_SELF']).'/common.phpt') as $line) {
+ if ($append) {
+ $common .= $line;
+ } elseif (trim($line) == '--REDIRECTTEST--') {
+ $append = true;
+ }
+ }
+ $conf = eval($common);
+ foreach($conf['ENV'] as $n=>$v) putenv("$n=$v");
}
class PDOTest {
- // create an instance of the PDO driver, based on
- // the current environment
- static function factory($classname = 'PDO', $drop_test_tables = true) {
- $dsn = getenv('PDOTEST_DSN');
- $user = getenv('PDOTEST_USER');
- $pass = getenv('PDOTEST_PASS');
- $attr = getenv('PDOTEST_ATTR');
- if (is_string($attr) && strlen($attr)) {
- $attr = unserialize($attr);
- } else {
- $attr = null;
- }
+ // create an instance of the PDO driver, based on
+ // the current environment
+ static function factory($classname = 'PDO', $drop_test_tables = true) {
+ $dsn = getenv('PDOTEST_DSN');
+ $user = getenv('PDOTEST_USER');
+ $pass = getenv('PDOTEST_PASS');
+ $attr = getenv('PDOTEST_ATTR');
+ if (is_string($attr) && strlen($attr)) {
+ $attr = unserialize($attr);
+ } else {
+ $attr = null;
+ }
- if ($user === false) $user = NULL;
- if ($pass === false) $pass = NULL;
+ if ($user === false) $user = NULL;
+ if ($pass === false) $pass = NULL;
- $db = new $classname($dsn, $user, $pass, $attr);
+ $db = new $classname($dsn, $user, $pass, $attr);
- if (!$db) {
- die("Could not create PDO object (DSN=$dsn, user=$user)\n");
- }
+ if (!$db) {
+ die("Could not create PDO object (DSN=$dsn, user=$user)\n");
+ }
- // clean up any crufty test tables we might have left behind
- // on a previous run
- static $test_tables = array(
- 'test',
- 'test2',
- 'classtypes'
- );
- if ($drop_test_tables) {
- foreach ($test_tables as $table) {
- $db->exec("DROP TABLE $table");
- }
- }
+ // clean up any crufty test tables we might have left behind
+ // on a previous run
+ static $test_tables = array(
+ 'test',
+ 'test2',
+ 'classtypes'
+ );
+ if ($drop_test_tables) {
+ foreach ($test_tables as $table) {
+ $db->exec("DROP TABLE $table");
+ }
+ }
- $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
- $db->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER);
- $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
- return $db;
- }
+ $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
+ $db->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER);
+ $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
+ return $db;
+ }
- static function skip() {
- try {
- $db = PDOTest::factory();
- } catch (PDOException $e) {
- die("skip " . $e->getMessage());
- }
- }
+ static function skip() {
+ try {
+ $db = PDOTest::factory();
+ } catch (PDOException $e) {
+ die("skip " . $e->getMessage());
+ }
+ }
- static function test_factory($file) {
- $config = self::get_config($file);
- foreach ($config['ENV'] as $k => $v) {
- putenv("$k=$v");
- }
- return self::factory();
- }
+ static function test_factory($file) {
+ $config = self::get_config($file);
+ foreach ($config['ENV'] as $k => $v) {
+ putenv("$k=$v");
+ }
+ return self::factory();
+ }
- static function get_config($file) {
- $data = file_get_contents($file);
- $data = preg_replace('/^.*--REDIRECTTEST--/s', '', $data);
- $config = eval($data);
+ static function get_config($file) {
+ $data = file_get_contents($file);
+ $data = preg_replace('/^.*--REDIRECTTEST--/s', '', $data);
+ $config = eval($data);
- return $config;
- }
+ return $config;
+ }
}
?>
diff --git a/ext/pdo/tests/pecl_bug_5217.phpt b/ext/pdo/tests/pecl_bug_5217.phpt
index 458092d25f..6e97ca48c6 100644
--- a/ext/pdo/tests/pecl_bug_5217.phpt
+++ b/ext/pdo/tests/pecl_bug_5217.phpt
@@ -14,12 +14,12 @@ if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../
require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
$db = PDOTest::factory();
try {
- $ser = serialize($db);
- debug_zval_dump($ser);
- $db = unserialize($ser);
- $db->exec('CREATE TABLE test (id int NOT NULL PRIMARY KEY, val VARCHAR(10))');
+ $ser = serialize($db);
+ debug_zval_dump($ser);
+ $db = unserialize($ser);
+ $db->exec('CREATE TABLE test (id int NOT NULL PRIMARY KEY, val VARCHAR(10))');
} catch (Exception $e) {
- echo "Safely caught " . $e->getMessage() . "\n";
+ echo "Safely caught " . $e->getMessage() . "\n";
}
echo "PHP Didn't crash!\n";
diff --git a/ext/pdo/tests/pecl_bug_5772.phpt b/ext/pdo/tests/pecl_bug_5772.phpt
index 5363d80cee..28cae695b7 100644
--- a/ext/pdo/tests/pecl_bug_5772.phpt
+++ b/ext/pdo/tests/pecl_bug_5772.phpt
@@ -18,11 +18,11 @@ $db->exec("CREATE TABLE test (id int NOT NULL, PRIMARY KEY (id))");
$db->exec("INSERT INTO test (id) VALUES (1)");
function heLLO($row) {
- return $row;
+ return $row;
}
foreach ($db->query("SELECT * FROM test")->fetchAll(PDO::FETCH_FUNC, 'heLLO') as $row) {
- var_dump($row);
+ var_dump($row);
}
--EXPECT--
string(1) "1"
diff --git a/ext/pdo_dblib/dblib_driver.c b/ext/pdo_dblib/dblib_driver.c
index f36451afee..85473c2ac1 100644
--- a/ext/pdo_dblib/dblib_driver.c
+++ b/ext/pdo_dblib/dblib_driver.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/pdo_dblib/dblib_stmt.c b/ext/pdo_dblib/dblib_stmt.c
index b05bbfdc4a..d8608c1d46 100644
--- a/ext/pdo_dblib/dblib_stmt.c
+++ b/ext/pdo_dblib/dblib_stmt.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/pdo_dblib/pdo_dblib.c b/ext/pdo_dblib/pdo_dblib.c
index 0272a12585..d5670cc86f 100644
--- a/ext/pdo_dblib/pdo_dblib.c
+++ b/ext/pdo_dblib/pdo_dblib.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/pdo_dblib/php_pdo_dblib.h b/ext/pdo_dblib/php_pdo_dblib.h
index 3ae70668ea..af4e845624 100644
--- a/ext/pdo_dblib/php_pdo_dblib.h
+++ b/ext/pdo_dblib/php_pdo_dblib.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/pdo_dblib/php_pdo_dblib_int.h b/ext/pdo_dblib/php_pdo_dblib_int.h
index 52ee3aafd9..ed82ada40e 100644
--- a/ext/pdo_dblib/php_pdo_dblib_int.h
+++ b/ext/pdo_dblib/php_pdo_dblib_int.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/pdo_dblib/tests/bug_50755.phpt b/ext/pdo_dblib/tests/bug_50755.phpt
index 33b776c145..17ce3a1214 100644
--- a/ext/pdo_dblib/tests/bug_50755.phpt
+++ b/ext/pdo_dblib/tests/bug_50755.phpt
@@ -18,7 +18,7 @@ cross join information_schema.columns ic3");
$x = $stmt->execute();
$n = 0;
while (($r = $stmt->fetch())) {
- $n++;
+ $n++;
}
$stmt = null;
diff --git a/ext/pdo_dblib/tests/config.inc b/ext/pdo_dblib/tests/config.inc
index 2723090f08..165f1d9330 100644
--- a/ext/pdo_dblib/tests/config.inc
+++ b/ext/pdo_dblib/tests/config.inc
@@ -3,50 +3,50 @@
// bug #72969 reflects a bug with FreeTDS, not with pdo_dblib
// this function will version detect so the relevant tests can XFAILIF
function driver_supports_batch_statements_without_select($db) {
- $version = $db->getAttribute(PDO::DBLIB_ATTR_VERSION);
+ $version = $db->getAttribute(PDO::DBLIB_ATTR_VERSION);
- // assume driver doesn't have this bug if not using FreeTDS
- if (!strstartswith($version, 'freetds ')) {
- return true;
- }
+ // assume driver doesn't have this bug if not using FreeTDS
+ if (!strstartswith($version, 'freetds ')) {
+ return true;
+ }
- // hasn't made it to numbered release yet
- if (!strstartswith($version, 'freetds v1.1.dev.')) {
- return false;
- }
+ // hasn't made it to numbered release yet
+ if (!strstartswith($version, 'freetds v1.1.dev.')) {
+ return false;
+ }
- // fc820490336c50d5c175d2a15327383256add4c9 was committed on the 5th
- return intval(substr($version, -8)) >= 20161206;
+ // fc820490336c50d5c175d2a15327383256add4c9 was committed on the 5th
+ return intval(substr($version, -8)) >= 20161206;
}
function strstartswith($haystack, $needle) {
- return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== false;
+ return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== false;
}
if (false !== getenv('PDO_DBLIB_TEST_DSN')) {
- $dsn = getenv('PDO_DBLIB_TEST_DSN');
+ $dsn = getenv('PDO_DBLIB_TEST_DSN');
} else {
- $dsn = 'dblib:host=localhost;dbname=test';
+ $dsn = 'dblib:host=localhost;dbname=test';
}
if (false !== getenv('PDO_DBLIB_TEST_USER')) {
- $user = getenv('PDO_DBLIB_TEST_USER');
+ $user = getenv('PDO_DBLIB_TEST_USER');
} else {
- $user = 'php';
+ $user = 'php';
}
if (false !== getenv('PDO_DBLIB_TEST_PASS')) {
- $pass = getenv('PDO_DBLIB_TEST_PASS');
+ $pass = getenv('PDO_DBLIB_TEST_PASS');
} else {
- $pass = 'password';
+ $pass = 'password';
}
try {
- $db = new PDO($dsn, $user, $pass);
- $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false);
+ $db = new PDO($dsn, $user, $pass);
+ $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+ $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false);
} catch (PDOException $e) {
- die('skip ' . $e->getMessage());
+ die('skip ' . $e->getMessage());
}
?>
diff --git a/ext/pdo_dblib/tests/timeout.phpt b/ext/pdo_dblib/tests/timeout.phpt
index c0485c6d51..2ef20fd4fc 100644
--- a/ext/pdo_dblib/tests/timeout.phpt
+++ b/ext/pdo_dblib/tests/timeout.phpt
@@ -15,7 +15,7 @@ $sql = 'WAITFOR DELAY \'00:00:02\'';
// querying without a timeout will succeed
$stmt = $db->prepare($sql);
if ($stmt->execute()) {
- echo "OK\n";
+ echo "OK\n";
}
// regular timeout attribute, set after instance created, will affect query timeout, causing this query to fail
@@ -23,12 +23,12 @@ $db = new PDO($dsn, $user, $pass);
$db->setAttribute(PDO::ATTR_TIMEOUT, 1);
$stmt = $db->prepare($sql);
if (!$stmt->execute()) {
- echo "OK\n";
+ echo "OK\n";
- // expect some kind of error code
- if ($stmt->errorCode() != '00000') {
- echo "OK\n";
- }
+ // expect some kind of error code
+ if ($stmt->errorCode() != '00000') {
+ echo "OK\n";
+ }
}
// pdo_dblib-specific timeout attribute, set after instance created, will control query timeout, causing this query to fail
@@ -36,36 +36,36 @@ $db = new PDO($dsn, $user, $pass);
$db->setAttribute(PDO::DBLIB_ATTR_QUERY_TIMEOUT, 1);
$stmt = $db->prepare($sql);
if (!$stmt->execute()) {
- echo "OK\n";
+ echo "OK\n";
- // expect some kind of error code
- if ($stmt->errorCode() != '00000') {
- echo "OK\n";
- }
+ // expect some kind of error code
+ if ($stmt->errorCode() != '00000') {
+ echo "OK\n";
+ }
}
// regular timeout attribute will affect query timeout, causing this query to fail
$db = new PDO($dsn, $user, $pass, [PDO::ATTR_TIMEOUT => 1]);
$stmt = $db->prepare($sql);
if (!$stmt->execute()) {
- echo "OK\n";
+ echo "OK\n";
- // expect some kind of error code
- if ($stmt->errorCode() != '00000') {
- echo "OK\n";
- }
+ // expect some kind of error code
+ if ($stmt->errorCode() != '00000') {
+ echo "OK\n";
+ }
}
// pdo_dblib-specific timeout attribute will control query timeout, causing this query to fail
$db = new PDO($dsn, $user, $pass, [PDO::DBLIB_ATTR_QUERY_TIMEOUT => 1]);
$stmt = $db->prepare($sql);
if (!$stmt->execute()) {
- echo "OK\n";
+ echo "OK\n";
- // expect some kind of error code
- if ($stmt->errorCode() != '00000') {
- echo "OK\n";
- }
+ // expect some kind of error code
+ if ($stmt->errorCode() != '00000') {
+ echo "OK\n";
+ }
}
?>
diff --git a/ext/pdo_dblib/tests/types.phpt b/ext/pdo_dblib/tests/types.phpt
index a4d4fd39f7..fa336d9fb4 100644
--- a/ext/pdo_dblib/tests/types.phpt
+++ b/ext/pdo_dblib/tests/types.phpt
@@ -10,31 +10,31 @@ require __DIR__ . '/config.inc';
require __DIR__ . '/config.inc';
function get_expected_float_string() {
- global $db;
+ global $db;
- switch ($db->getAttribute(PDO::DBLIB_ATTR_TDS_VERSION)) {
- case '5.0':
- case '6.0':
- case '7.0':
- case '7.1':
- case '7.2':
- case '8.0':
- return '10.500';
- default:
- return '10.5';
- }
+ switch ($db->getAttribute(PDO::DBLIB_ATTR_TDS_VERSION)) {
+ case '5.0':
+ case '6.0':
+ case '7.0':
+ case '7.1':
+ case '7.2':
+ case '8.0':
+ return '10.500';
+ default:
+ return '10.5';
+ }
}
$sql = "
- SELECT
- 'foo' AS [char],
- CAST('2030-01-01 23:59:59' AS DATETIME) AS [datetime],
- CAST(0 AS BIT) AS [false],
- 10.500 AS [float],
- 1000 AS [int],
- CAST(10.500 AS MONEY) AS [money],
- CAST('1950-01-18 23:00:00' AS SMALLDATETIME) as [smalldatetime],
- CAST(1 AS BIT) AS [true]
+ SELECT
+ 'foo' AS [char],
+ CAST('2030-01-01 23:59:59' AS DATETIME) AS [datetime],
+ CAST(0 AS BIT) AS [false],
+ 10.500 AS [float],
+ 1000 AS [int],
+ CAST(10.500 AS MONEY) AS [money],
+ CAST('1950-01-18 23:00:00' AS SMALLDATETIME) as [smalldatetime],
+ CAST(1 AS BIT) AS [true]
";
$stmt = $db->query($sql);
diff --git a/ext/pdo_firebird/firebird_driver.c b/ext/pdo_firebird/firebird_driver.c
index b1869f2695..f3e71e8313 100644
--- a/ext/pdo_firebird/firebird_driver.c
+++ b/ext/pdo_firebird/firebird_driver.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/pdo_firebird/firebird_statement.c b/ext/pdo_firebird/firebird_statement.c
index 05dfe46848..105d5a3587 100644
--- a/ext/pdo_firebird/firebird_statement.c
+++ b/ext/pdo_firebird/firebird_statement.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/pdo_firebird/pdo_firebird.c b/ext/pdo_firebird/pdo_firebird.c
index 02f577fb35..d8e55957f2 100644
--- a/ext/pdo_firebird/pdo_firebird.c
+++ b/ext/pdo_firebird/pdo_firebird.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/pdo_firebird/php_pdo_firebird.h b/ext/pdo_firebird/php_pdo_firebird.h
index 48ff715e8c..deff3f10c5 100644
--- a/ext/pdo_firebird/php_pdo_firebird.h
+++ b/ext/pdo_firebird/php_pdo_firebird.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/pdo_firebird/php_pdo_firebird_int.h b/ext/pdo_firebird/php_pdo_firebird_int.h
index dca1a575f0..1528b417ae 100644
--- a/ext/pdo_firebird/php_pdo_firebird_int.h
+++ b/ext/pdo_firebird/php_pdo_firebird_int.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/pdo_firebird/tests/bug_48877.phpt b/ext/pdo_firebird/tests/bug_48877.phpt
index d685d0ac80..85da7d4285 100644
--- a/ext/pdo_firebird/tests/bug_48877.phpt
+++ b/ext/pdo_firebird/tests/bug_48877.phpt
@@ -8,7 +8,7 @@ PDO_Firebird: bug 48877 The "bindValue" and "bindParam" do not work for PDO Fire
require("testdb.inc");
$value = '2';
-
+
@$dbh->exec('DROP TABLE testz');
$dbh->exec('CREATE TABLE testz (A integer)');
$dbh->exec("INSERT INTO testz VALUES ('1')");
diff --git a/ext/pdo_firebird/tests/bug_73087.phpt b/ext/pdo_firebird/tests/bug_73087.phpt
index b676293e44..cd3d90137e 100644
--- a/ext/pdo_firebird/tests/bug_73087.phpt
+++ b/ext/pdo_firebird/tests/bug_73087.phpt
@@ -10,13 +10,13 @@ require 'testdb.inc';
$dbh->exec('create table atable (id integer not null, content blob sub_type 1 segment size 80)');
$S = $dbh->prepare('insert into atable (id, content) values (:id, :content)');
for ($I = 1; $I < 10; $I++) {
- $Params = [
- 'id' => $I,
- 'content' => base64_encode(random_bytes(10))
- ];
- foreach ($Params as $Param => $Value)
- $S->bindValue($Param, $Value);
- $S->execute();
+ $Params = [
+ 'id' => $I,
+ 'content' => base64_encode(random_bytes(10))
+ ];
+ foreach ($Params as $Param => $Value)
+ $S->bindValue($Param, $Value);
+ $S->execute();
}
unset($S);
unset($dbh);
diff --git a/ext/pdo_firebird/tests/bug_76488.phpt b/ext/pdo_firebird/tests/bug_76488.phpt
index ffcca7efd3..27b899086d 100644
--- a/ext/pdo_firebird/tests/bug_76488.phpt
+++ b/ext/pdo_firebird/tests/bug_76488.phpt
@@ -14,15 +14,15 @@ with recursive r(n) as (
)
select n,
cast(lpad(\'A\', 8000, \'A\') as BLOB sub_type TEXT) as SRC
-from r
+from r
';
for ($i = 0; $i < 10; $i++) {
$sth = $dbh->prepare($sql);
$sth->execute();
$rows = $sth->fetchAll();
- unset($rows);
- unset($sth);
+ unset($rows);
+ unset($sth);
}
unset($dbh);
echo "OK";
diff --git a/ext/pdo_firebird/tests/bug_77863.phpt b/ext/pdo_firebird/tests/bug_77863.phpt
index a133de5ba8..e0d8293118 100644
--- a/ext/pdo_firebird/tests/bug_77863.phpt
+++ b/ext/pdo_firebird/tests/bug_77863.phpt
@@ -107,8 +107,8 @@ try {
echo "OK\n";
}
catch(Exception $e) {
- echo $e->getMessage() . '<br>';
- echo $e->getTraceAsString();
+ echo $e->getMessage() . '<br>';
+ echo $e->getTraceAsString();
}
?>
--EXPECT--
diff --git a/ext/pdo_firebird/tests/connect.phpt b/ext/pdo_firebird/tests/connect.phpt
index 20f0ce7013..116e991066 100644
--- a/ext/pdo_firebird/tests/connect.phpt
+++ b/ext/pdo_firebird/tests/connect.phpt
@@ -4,10 +4,10 @@ PDO_Firebird: connect/disconnect
<?php require('skipif.inc'); ?>
--FILE--
<?php
- require("testdb.inc");
+ require("testdb.inc");
- unset($dbh);
- echo "done\n";
+ unset($dbh);
+ echo "done\n";
?>
--EXPECT--
diff --git a/ext/pdo_firebird/tests/ddl.phpt b/ext/pdo_firebird/tests/ddl.phpt
index b89c70456a..ea2c15cd11 100644
--- a/ext/pdo_firebird/tests/ddl.phpt
+++ b/ext/pdo_firebird/tests/ddl.phpt
@@ -5,32 +5,32 @@ PDO_Firebird: DDL/transactions
--FILE--
<?php
- require("testdb.inc");
+ require("testdb.inc");
- $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
+ $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
- @$dbh->exec('DROP TABLE ddl');
- @$dbh->exec('DROP GENERATOR gen_ddl_id');
- @$dbh->exec('DROP TRIGGER ddl_bi');
+ @$dbh->exec('DROP TABLE ddl');
+ @$dbh->exec('DROP GENERATOR gen_ddl_id');
+ @$dbh->exec('DROP TRIGGER ddl_bi');
- $dbh->exec("CREATE TABLE ddl (id INT NOT NULL PRIMARY KEY, text BLOB SUB_TYPE 1)");
- $dbh->exec("CREATE GENERATOR gen_ddl_id");
- $dbh->exec("CREATE TRIGGER ddl_bi FOR ddl BEFORE INSERT AS
- BEGIN IF (NEW.id IS NULL) THEN NEW.id=GEN_ID(gen_ddl_id,1); END");
+ $dbh->exec("CREATE TABLE ddl (id INT NOT NULL PRIMARY KEY, text BLOB SUB_TYPE 1)");
+ $dbh->exec("CREATE GENERATOR gen_ddl_id");
+ $dbh->exec("CREATE TRIGGER ddl_bi FOR ddl BEFORE INSERT AS
+ BEGIN IF (NEW.id IS NULL) THEN NEW.id=GEN_ID(gen_ddl_id,1); END");
- $dbh->setAttribute(PDO::ATTR_AUTOCOMMIT,0);
+ $dbh->setAttribute(PDO::ATTR_AUTOCOMMIT,0);
- $dbh->beginTransaction();
- var_dump($dbh->exec("INSERT INTO ddl (text) VALUES ('bla')"));
- var_dump($dbh->exec("UPDATE ddl SET text='blabla'"));
- $dbh->rollback();
+ $dbh->beginTransaction();
+ var_dump($dbh->exec("INSERT INTO ddl (text) VALUES ('bla')"));
+ var_dump($dbh->exec("UPDATE ddl SET text='blabla'"));
+ $dbh->rollback();
- $dbh->beginTransaction();
- var_dump($dbh->exec("DELETE FROM ddl"));
- $dbh->commit();
+ $dbh->beginTransaction();
+ var_dump($dbh->exec("DELETE FROM ddl"));
+ $dbh->commit();
- unset($dbh);
- echo "done\n";
+ unset($dbh);
+ echo "done\n";
?>
--EXPECT--
diff --git a/ext/pdo_firebird/tests/dialect_1.phpt b/ext/pdo_firebird/tests/dialect_1.phpt
index 829025c162..c0f2ff017d 100644
--- a/ext/pdo_firebird/tests/dialect_1.phpt
+++ b/ext/pdo_firebird/tests/dialect_1.phpt
@@ -8,44 +8,44 @@ if (strpos(getenv('PDO_FIREBIRD_TEST_DSN'), 'dialect=1')===false) {
?>
--FILE--
<?php
- require("testdb.inc");
+ require("testdb.inc");
- $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
- $dbh->setAttribute(PDO::FB_ATTR_TIMESTAMP_FORMAT, '%Y-%m-%d %H:%M:%S');
+ $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
+ $dbh->setAttribute(PDO::FB_ATTR_TIMESTAMP_FORMAT, '%Y-%m-%d %H:%M:%S');
- $sql =
- 'SELECT
- 1 as N,
- 2.0 as F,
- cast(0.76 as numeric(15, 2)) as K,
- cast(\'2019-06-12\' as date) as DT
- FROM RDB$DATABASE';
- $query = $dbh->prepare($sql);
- $query->execute();
- $row = $query->fetch(\PDO::FETCH_OBJ);
- var_dump($row->N);
- var_dump($row->F);
- var_dump($row->K);
- var_dump($row->DT);
+ $sql =
+ 'SELECT
+ 1 as N,
+ 2.0 as F,
+ cast(0.76 as numeric(15, 2)) as K,
+ cast(\'2019-06-12\' as date) as DT
+ FROM RDB$DATABASE';
+ $query = $dbh->prepare($sql);
+ $query->execute();
+ $row = $query->fetch(\PDO::FETCH_OBJ);
+ var_dump($row->N);
+ var_dump($row->F);
+ var_dump($row->K);
+ var_dump($row->DT);
- unset($query);
+ unset($query);
- $dbh->exec('RECREATE TABLE test_d1(K numeric(15, 2), DT date)');
- $sql='INSERT INTO test_d1(K, DT) values(?, ?)';
- $query = $dbh->prepare($sql);
- $query->execute([0.76, '2019-06-12']);
- unset($query);
+ $dbh->exec('RECREATE TABLE test_d1(K numeric(15, 2), DT date)');
+ $sql='INSERT INTO test_d1(K, DT) values(?, ?)';
+ $query = $dbh->prepare($sql);
+ $query->execute([0.76, '2019-06-12']);
+ unset($query);
- $sql='SELECT * FROM test_d1';
- $query = $dbh->prepare($sql);
- $query->execute();
- $row = $query->fetch(\PDO::FETCH_OBJ);
- var_dump($row->K);
- var_dump($row->DT);
+ $sql='SELECT * FROM test_d1';
+ $query = $dbh->prepare($sql);
+ $query->execute();
+ $row = $query->fetch(\PDO::FETCH_OBJ);
+ var_dump($row->K);
+ var_dump($row->DT);
- unset($query);
- unset($dbh);
- echo "done\n";
+ unset($query);
+ unset($dbh);
+ echo "done\n";
?>
--EXPECT--
diff --git a/ext/pdo_firebird/tests/execute.phpt b/ext/pdo_firebird/tests/execute.phpt
index 0f1721f559..56ed10b0d0 100644
--- a/ext/pdo_firebird/tests/execute.phpt
+++ b/ext/pdo_firebird/tests/execute.phpt
@@ -4,41 +4,41 @@ PDO_Firebird: prepare/execute/binding
<?php require('skipif.inc'); ?>
--FILE--
<?php
- require("testdb.inc");
+ require("testdb.inc");
- var_dump($dbh->getAttribute(PDO::ATTR_CONNECTION_STATUS));
+ var_dump($dbh->getAttribute(PDO::ATTR_CONNECTION_STATUS));
- $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
- $dbh->setAttribute(PDO::FB_ATTR_TIMESTAMP_FORMAT, '%Y-%m-%d %H:%M:%S');
+ $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
+ $dbh->setAttribute(PDO::FB_ATTR_TIMESTAMP_FORMAT, '%Y-%m-%d %H:%M:%S');
- @$dbh->exec('DROP TABLE ddl');
- $dbh->exec("CREATE TABLE ddl (id SMALLINT NOT NULL PRIMARY KEY, text VARCHAR(32),
- datetime TIMESTAMP DEFAULT '2000-02-12' NOT NULL)");
- $dbh->exec("INSERT INTO ddl (id,text) VALUES (1,'bla')");
+ @$dbh->exec('DROP TABLE ddl');
+ $dbh->exec("CREATE TABLE ddl (id SMALLINT NOT NULL PRIMARY KEY, text VARCHAR(32),
+ datetime TIMESTAMP DEFAULT '2000-02-12' NOT NULL)");
+ $dbh->exec("INSERT INTO ddl (id,text) VALUES (1,'bla')");
- $s = $dbh->prepare("SELECT * FROM ddl WHERE id=? FOR UPDATE");
+ $s = $dbh->prepare("SELECT * FROM ddl WHERE id=? FOR UPDATE");
- $id = 0;
- $s->bindParam(1,$id);
- $var = null;
- $s->bindColumn("TEXT",$var);
- $id = 1;
- $s->execute();
- $s->setAttribute(PDO::ATTR_CURSOR_NAME, "c");
+ $id = 0;
+ $s->bindParam(1,$id);
+ $var = null;
+ $s->bindColumn("TEXT",$var);
+ $id = 1;
+ $s->execute();
+ $s->setAttribute(PDO::ATTR_CURSOR_NAME, "c");
- var_dump($id);
+ var_dump($id);
- var_dump($s->fetch());
+ var_dump($s->fetch());
- var_dump($var);
+ var_dump($var);
- var_dump($dbh->exec("UPDATE ddl SET id=2 WHERE CURRENT OF c"));
+ var_dump($dbh->exec("UPDATE ddl SET id=2 WHERE CURRENT OF c"));
- var_dump($s->fetch());
+ var_dump($s->fetch());
- unset($s);
- unset($dbh);
- echo "done\n";
+ unset($s);
+ unset($dbh);
+ echo "done\n";
?>
--EXPECT--
diff --git a/ext/pdo_firebird/tests/testdb.inc b/ext/pdo_firebird/tests/testdb.inc
index d345d090bb..23008fa0d9 100644
--- a/ext/pdo_firebird/tests/testdb.inc
+++ b/ext/pdo_firebird/tests/testdb.inc
@@ -1,7 +1,7 @@
<?php
// Test defaults, assumes the following:
-//
+//
// Username: SYSDBA
// Password: phpfi
// Database: <nothing>
diff --git a/ext/pdo_mysql/config.m4 b/ext/pdo_mysql/config.m4
index 6f0302feab..622c1e55b8 100644
--- a/ext/pdo_mysql/config.m4
+++ b/ext/pdo_mysql/config.m4
@@ -58,7 +58,7 @@ if test "$PHP_PDO_MYSQL" != "no"; then
if test "x$SED" = "x"; then
AC_PATH_PROG(SED, sed)
fi
- if test "$enable_maintainer_zts" = "yes"; then
+ if test "$enable_zts" = "yes"; then
PDO_MYSQL_LIBNAME=mysqlclient_r
PDO_MYSQL_LIBS=`$PDO_MYSQL_CONFIG --libs_r | $SED -e "s/'//g"`
else
diff --git a/ext/pdo_mysql/mysql_driver.c b/ext/pdo_mysql/mysql_driver.c
index 2f85d8dbb7..0b5ef64b22 100644
--- a/ext/pdo_mysql/mysql_driver.c
+++ b/ext/pdo_mysql/mysql_driver.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/pdo_mysql/mysql_statement.c b/ext/pdo_mysql/mysql_statement.c
index 9b880ea1fa..e99a11c715 100644
--- a/ext/pdo_mysql/mysql_statement.c
+++ b/ext/pdo_mysql/mysql_statement.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/pdo_mysql/pdo_mysql.c b/ext/pdo_mysql/pdo_mysql.c
index 54e1c931ce..e69e857ef0 100644
--- a/ext/pdo_mysql/pdo_mysql.c
+++ b/ext/pdo_mysql/pdo_mysql.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/pdo_mysql/php_pdo_mysql.h b/ext/pdo_mysql/php_pdo_mysql.h
index fa34e70f3a..69ddff6b40 100644
--- a/ext/pdo_mysql/php_pdo_mysql.h
+++ b/ext/pdo_mysql/php_pdo_mysql.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/pdo_mysql/php_pdo_mysql_int.h b/ext/pdo_mysql/php_pdo_mysql_int.h
index edded8dea9..f90a92d6a4 100644
--- a/ext/pdo_mysql/php_pdo_mysql_int.h
+++ b/ext/pdo_mysql/php_pdo_mysql_int.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/pdo_mysql/tests/bug41125.phpt b/ext/pdo_mysql/tests/bug41125.phpt
index 2212bb621d..63ff7df2f3 100644
--- a/ext/pdo_mysql/tests/bug41125.phpt
+++ b/ext/pdo_mysql/tests/bug41125.phpt
@@ -24,19 +24,19 @@ print implode(' - ', $stmt->errorinfo()) ."\n";
print "-------------------------------------------------------\n";
$queries = array(
- "SELECT 1 FROM DUAL WHERE 1 = '?\'\''",
- "SELECT 'a\\'0' FROM DUAL WHERE 1 = ?",
- "SELECT 'a', 'b\'' FROM DUAL WHERE '''' LIKE '\\'' AND ?",
- "SELECT 'foo?bar', '', '''' FROM DUAL WHERE ?"
+ "SELECT 1 FROM DUAL WHERE 1 = '?\'\''",
+ "SELECT 'a\\'0' FROM DUAL WHERE 1 = ?",
+ "SELECT 'a', 'b\'' FROM DUAL WHERE '''' LIKE '\\'' AND ?",
+ "SELECT 'foo?bar', '', '''' FROM DUAL WHERE ?"
);
foreach ($queries as $k => $query) {
- $stmt = $db->prepare($query);
- $stmt->execute(array(1));
- printf("[%d] Query: [[%s]]\n", $k + 1, $query);
- print implode(' - ', (($r = @$stmt->fetch(PDO::FETCH_NUM)) ? $r : array())) ."\n";
- print implode(' - ', $stmt->errorinfo()) ."\n";
- print "--------\n";
+ $stmt = $db->prepare($query);
+ $stmt->execute(array(1));
+ printf("[%d] Query: [[%s]]\n", $k + 1, $query);
+ print implode(' - ', (($r = @$stmt->fetch(PDO::FETCH_NUM)) ? $r : array())) ."\n";
+ print implode(' - ', $stmt->errorinfo()) ."\n";
+ print "--------\n";
}
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1);
@@ -53,33 +53,33 @@ print implode(' - ', $stmt->errorinfo()) ."\n";
print "-------------------------------------------------------\n";
$queries = array(
- "SELECT 1, 'foo' FROM DUAL WHERE 1 = :id AND '\\0' IS NULL AND 2 <> :id",
- "SELECT 1 FROM DUAL WHERE 1 = :id AND '' AND 2 <> :id",
- "SELECT 1 FROM DUAL WHERE 1 = :id AND '\'\'' = '''' AND 2 <> :id",
- "SELECT 1 FROM DUAL WHERE 1 = :id AND '\'' = '''' AND 2 <> :id",
- "SELECT 'a', 'b\'' FROM DUAL WHERE '''' LIKE '\\'' AND 1",
- "SELECT 'a''', '\'b\'' FROM DUAL WHERE '''' LIKE '\\'' AND 1",
- "SELECT UPPER(:id) FROM DUAL WHERE '1'",
- "SELECT 1 FROM DUAL WHERE '\''",
- "SELECT 1 FROM DUAL WHERE :id AND '\\0' OR :id",
- "SELECT 1 FROM DUAL WHERE 'a\\f\\n\\0' AND 1 >= :id",
- "SELECT 1 FROM DUAL WHERE '\'' = ''''",
- "SELECT '\\n' '1 FROM DUAL WHERE '''' and :id'",
- "SELECT 1 'FROM DUAL WHERE :id AND '''' = '''' OR 1 = 1 AND ':id",
+ "SELECT 1, 'foo' FROM DUAL WHERE 1 = :id AND '\\0' IS NULL AND 2 <> :id",
+ "SELECT 1 FROM DUAL WHERE 1 = :id AND '' AND 2 <> :id",
+ "SELECT 1 FROM DUAL WHERE 1 = :id AND '\'\'' = '''' AND 2 <> :id",
+ "SELECT 1 FROM DUAL WHERE 1 = :id AND '\'' = '''' AND 2 <> :id",
+ "SELECT 'a', 'b\'' FROM DUAL WHERE '''' LIKE '\\'' AND 1",
+ "SELECT 'a''', '\'b\'' FROM DUAL WHERE '''' LIKE '\\'' AND 1",
+ "SELECT UPPER(:id) FROM DUAL WHERE '1'",
+ "SELECT 1 FROM DUAL WHERE '\''",
+ "SELECT 1 FROM DUAL WHERE :id AND '\\0' OR :id",
+ "SELECT 1 FROM DUAL WHERE 'a\\f\\n\\0' AND 1 >= :id",
+ "SELECT 1 FROM DUAL WHERE '\'' = ''''",
+ "SELECT '\\n' '1 FROM DUAL WHERE '''' and :id'",
+ "SELECT 1 'FROM DUAL WHERE :id AND '''' = '''' OR 1 = 1 AND ':id",
);
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1);
$id = 1;
foreach ($queries as $k => $query) {
- $stmt = $db->prepare($query);
- $stmt->bindParam(':id', $id);
- $stmt->execute();
-
- printf("[%d] Query: [[%s]]\n", $k + 1, $query);
- print implode(' - ', (($r = @$stmt->fetch(PDO::FETCH_NUM)) ? $r : array())) ."\n";
- print implode(' - ', $stmt->errorinfo()) ."\n";
- print "--------\n";
+ $stmt = $db->prepare($query);
+ $stmt->bindParam(':id', $id);
+ $stmt->execute();
+
+ printf("[%d] Query: [[%s]]\n", $k + 1, $query);
+ print implode(' - ', (($r = @$stmt->fetch(PDO::FETCH_NUM)) ? $r : array())) ."\n";
+ print implode(' - ', $stmt->errorinfo()) ."\n";
+ print "--------\n";
}
?>
diff --git a/ext/pdo_mysql/tests/bug44327.phpt b/ext/pdo_mysql/tests/bug44327.phpt
index 27a926295c..5adc8209e7 100644
--- a/ext/pdo_mysql/tests/bug44327.phpt
+++ b/ext/pdo_mysql/tests/bug44327.phpt
@@ -9,35 +9,35 @@ $db = MySQLPDOTest::factory();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
- $stmt = $db->prepare("SELECT 1 AS \"one\"");
- $stmt->execute();
- $row = $stmt->fetch(PDO::FETCH_LAZY);
- var_dump($row);
- var_dump($row->{0});
- var_dump($row->one);
- var_dump($row->queryString);
+ $stmt = $db->prepare("SELECT 1 AS \"one\"");
+ $stmt->execute();
+ $row = $stmt->fetch(PDO::FETCH_LAZY);
+ var_dump($row);
+ var_dump($row->{0});
+ var_dump($row->one);
+ var_dump($row->queryString);
- print "----------------------------------\n";
+ print "----------------------------------\n";
- @$db->exec("DROP TABLE test");
- $db->exec("CREATE TABLE test (id INT)");
- $db->exec("INSERT INTO test(id) VALUES (1)");
- $stmt = $db->prepare("SELECT id FROM test");
- $stmt->execute();
- $row = $stmt->fetch(PDO::FETCH_LAZY);
- var_dump($row);
- var_dump($row->queryString);
- @$db->exec("DROP TABLE test");
+ @$db->exec("DROP TABLE test");
+ $db->exec("CREATE TABLE test (id INT)");
+ $db->exec("INSERT INTO test(id) VALUES (1)");
+ $stmt = $db->prepare("SELECT id FROM test");
+ $stmt->execute();
+ $row = $stmt->fetch(PDO::FETCH_LAZY);
+ var_dump($row);
+ var_dump($row->queryString);
+ @$db->exec("DROP TABLE test");
- print "----------------------------------\n";
+ print "----------------------------------\n";
- $stmt = $db->prepare('foo');
- @$stmt->execute();
- $row = $stmt->fetch();
- var_dump($row->queryString);
+ $stmt = $db->prepare('foo');
+ @$stmt->execute();
+ $row = $stmt->fetch();
+ var_dump($row->queryString);
?>
--EXPECTF--
@@ -60,5 +60,5 @@ object(PDORow)#%d (2) {
string(19) "SELECT id FROM test"
----------------------------------
-Notice: Trying to get property 'queryString' of non-object in %s on line %d
+Warning: Trying to get property 'queryString' of non-object in %s on line %d
NULL
diff --git a/ext/pdo_mysql/tests/bug46292.phpt b/ext/pdo_mysql/tests/bug46292.phpt
index fd2ef759e5..dec4a9f550 100644
--- a/ext/pdo_mysql/tests/bug46292.phpt
+++ b/ext/pdo_mysql/tests/bug46292.phpt
@@ -9,45 +9,45 @@ MySQLPDOTest::skip();
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $pdoDb = MySQLPDOTest::factory();
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $pdoDb = MySQLPDOTest::factory();
- class myclass implements Serializable {
- public function __construct() {
- printf("%s()\n", __METHOD__);
- }
+ class myclass implements Serializable {
+ public function __construct() {
+ printf("%s()\n", __METHOD__);
+ }
- public function serialize() {
- printf("%s()\n", __METHOD__);
- return "any data from serialize()";
- }
+ public function serialize() {
+ printf("%s()\n", __METHOD__);
+ return "any data from serialize()";
+ }
- public function unserialize($dat) {
- printf("%s(%s)\n", __METHOD__, var_export($dat, true));
- return $dat;
- }
- }
+ public function unserialize($dat) {
+ printf("%s(%s)\n", __METHOD__, var_export($dat, true));
+ return $dat;
+ }
+ }
- class myclass2 extends myclass { }
+ class myclass2 extends myclass { }
- $pdoDb->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
- $pdoDb->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
+ $pdoDb->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
+ $pdoDb->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
- $pdoDb->query('DROP TABLE IF EXISTS testz');
+ $pdoDb->query('DROP TABLE IF EXISTS testz');
- $pdoDb->query('CREATE TABLE testz (name VARCHAR(20) NOT NULL, value INT)');
+ $pdoDb->query('CREATE TABLE testz (name VARCHAR(20) NOT NULL, value INT)');
- $pdoDb->query("INSERT INTO testz VALUES ('myclass', 1), ('myclass2', 2), ('myclass', NULL), ('myclass3', NULL)");
+ $pdoDb->query("INSERT INTO testz VALUES ('myclass', 1), ('myclass2', 2), ('myclass', NULL), ('myclass3', NULL)");
- $stmt = $pdoDb->prepare("SELECT * FROM testz");
+ $stmt = $pdoDb->prepare("SELECT * FROM testz");
- var_dump($stmt->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_CLASSTYPE | PDO::FETCH_GROUP));
- $stmt->execute();
+ var_dump($stmt->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_CLASSTYPE | PDO::FETCH_GROUP));
+ $stmt->execute();
- var_dump($stmt->fetch());
- var_dump($stmt->fetch());
- var_dump($stmt->fetchAll());
+ var_dump($stmt->fetch());
+ var_dump($stmt->fetch());
+ var_dump($stmt->fetchAll());
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/bug54929.phpt b/ext/pdo_mysql/tests/bug54929.phpt
index 6f2c2b0b80..c9f68af862 100644
--- a/ext/pdo_mysql/tests/bug54929.phpt
+++ b/ext/pdo_mysql/tests/bug54929.phpt
@@ -16,14 +16,14 @@ $pdodb = PDOTest::test_factory(__DIR__ . '/common.phpt');
function testQuery($query) {
- global $pdodb;
- $stmt = $pdodb->prepare($query);
+ global $pdodb;
+ $stmt = $pdodb->prepare($query);
- if (!$stmt->execute(array("foo"))) {
- var_dump($stmt->errorInfo());
- } else{
- var_dump($stmt->fetch(PDO::FETCH_ASSOC));
- }
+ if (!$stmt->execute(array("foo"))) {
+ var_dump($stmt->errorInfo());
+ } else{
+ var_dump($stmt->fetch(PDO::FETCH_ASSOC));
+ }
}
testQuery("/* ' */ select ? as f1 /* ' */");
diff --git a/ext/pdo_mysql/tests/bug63176.phpt b/ext/pdo_mysql/tests/bug63176.phpt
index ed462c0c53..2a75f47384 100644
--- a/ext/pdo_mysql/tests/bug63176.phpt
+++ b/ext/pdo_mysql/tests/bug63176.phpt
@@ -10,24 +10,24 @@ MySQLPDOTest::skip();
<?php
require(__DIR__. DIRECTORY_SEPARATOR . 'config.inc');
class PDO2 extends PDO {
- protected $transLevel;
+ protected $transLevel;
}
class PDO3 extends PDO {
- protected $tomato;
+ protected $tomato;
}
class ModelA {
- public function __construct($h) {
- var_dump($h);
- if ($h) {
- $this->db = new PDO2(PDO_MYSQL_TEST_DSN, PDO_MYSQL_TEST_USER, PDO_MYSQL_TEST_PASS, array(PDO::ATTR_PERSISTENT => true));
- } else {
- $this->db = new PDO3(PDO_MYSQL_TEST_DSN, PDO_MYSQL_TEST_USER, PDO_MYSQL_TEST_PASS, array(PDO::ATTR_PERSISTENT => true));
- }
- $this->db->query('SELECT 1')->fetchAll();
- }
+ public function __construct($h) {
+ var_dump($h);
+ if ($h) {
+ $this->db = new PDO2(PDO_MYSQL_TEST_DSN, PDO_MYSQL_TEST_USER, PDO_MYSQL_TEST_PASS, array(PDO::ATTR_PERSISTENT => true));
+ } else {
+ $this->db = new PDO3(PDO_MYSQL_TEST_DSN, PDO_MYSQL_TEST_USER, PDO_MYSQL_TEST_PASS, array(PDO::ATTR_PERSISTENT => true));
+ }
+ $this->db->query('SELECT 1')->fetchAll();
+ }
}
$a = new ModelA(true);
diff --git a/ext/pdo_mysql/tests/bug68371.phpt b/ext/pdo_mysql/tests/bug68371.phpt
index f5046f0375..17eee8c2f4 100644
--- a/ext/pdo_mysql/tests/bug68371.phpt
+++ b/ext/pdo_mysql/tests/bug68371.phpt
@@ -14,54 +14,54 @@ $pdo->setAttribute (\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
$attrs = array(
// Extensive test: default value and set+get values
- PDO::ATTR_EMULATE_PREPARES => array(null, 1, 0),
- PDO::MYSQL_ATTR_DIRECT_QUERY => array(null, 0, 1),
- PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => array(null, 0, 1),
+ PDO::ATTR_EMULATE_PREPARES => array(null, 1, 0),
+ PDO::MYSQL_ATTR_DIRECT_QUERY => array(null, 0, 1),
+ PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => array(null, 0, 1),
// Just test the default
- PDO::ATTR_AUTOCOMMIT => array(null),
- PDO::ATTR_PREFETCH => array(null),
- PDO::ATTR_TIMEOUT => array(null),
- PDO::ATTR_ERRMODE => array(null),
- PDO::ATTR_SERVER_VERSION => array(null),
- PDO::ATTR_CLIENT_VERSION => array(null),
- PDO::ATTR_SERVER_INFO => array(null),
- PDO::ATTR_CONNECTION_STATUS => array(null),
- PDO::ATTR_CASE => array(null),
- PDO::ATTR_CURSOR_NAME => array(null),
- PDO::ATTR_CURSOR => array(null),
- PDO::ATTR_ORACLE_NULLS => array(null),
- PDO::ATTR_PERSISTENT => array(null),
- PDO::ATTR_STATEMENT_CLASS => array(null),
- PDO::ATTR_FETCH_TABLE_NAMES => array(null),
- PDO::ATTR_FETCH_CATALOG_NAMES => array(null),
- PDO::ATTR_DRIVER_NAME => array(null),
- PDO::ATTR_STRINGIFY_FETCHES => array(null),
- PDO::ATTR_MAX_COLUMN_LEN => array(null),
- PDO::ATTR_DEFAULT_FETCH_MODE => array(null),
+ PDO::ATTR_AUTOCOMMIT => array(null),
+ PDO::ATTR_PREFETCH => array(null),
+ PDO::ATTR_TIMEOUT => array(null),
+ PDO::ATTR_ERRMODE => array(null),
+ PDO::ATTR_SERVER_VERSION => array(null),
+ PDO::ATTR_CLIENT_VERSION => array(null),
+ PDO::ATTR_SERVER_INFO => array(null),
+ PDO::ATTR_CONNECTION_STATUS => array(null),
+ PDO::ATTR_CASE => array(null),
+ PDO::ATTR_CURSOR_NAME => array(null),
+ PDO::ATTR_CURSOR => array(null),
+ PDO::ATTR_ORACLE_NULLS => array(null),
+ PDO::ATTR_PERSISTENT => array(null),
+ PDO::ATTR_STATEMENT_CLASS => array(null),
+ PDO::ATTR_FETCH_TABLE_NAMES => array(null),
+ PDO::ATTR_FETCH_CATALOG_NAMES => array(null),
+ PDO::ATTR_DRIVER_NAME => array(null),
+ PDO::ATTR_STRINGIFY_FETCHES => array(null),
+ PDO::ATTR_MAX_COLUMN_LEN => array(null),
+ PDO::ATTR_DEFAULT_FETCH_MODE => array(null),
);
foreach ($attrs as $a => $vals) {
- foreach ($vals as $v) {
- try {
- if (!isset($v)) {
- var_dump($pdo->getAttribute($a));
- } else {
- $pdo->setAttribute($a, $v);
- if ($pdo->getAttribute($a) === $v) {
- echo "OK\n";
- } else {
- throw new \Exception('KO');
- }
- }
- } catch (\Exception $e) {
- if ($e->getCode() == 'IM001') {
- echo "ERR\n";
- } else {
- echo "ERR {$e->getMessage()}\n";
- }
- }
- }
+ foreach ($vals as $v) {
+ try {
+ if (!isset($v)) {
+ var_dump($pdo->getAttribute($a));
+ } else {
+ $pdo->setAttribute($a, $v);
+ if ($pdo->getAttribute($a) === $v) {
+ echo "OK\n";
+ } else {
+ throw new \Exception('KO');
+ }
+ }
+ } catch (\Exception $e) {
+ if ($e->getCode() == 'IM001') {
+ echo "ERR\n";
+ } else {
+ echo "ERR {$e->getMessage()}\n";
+ }
+ }
+ }
}
?>
diff --git a/ext/pdo_mysql/tests/bug70389.phpt b/ext/pdo_mysql/tests/bug70389.phpt
index 09f439804e..f2be259543 100644
--- a/ext/pdo_mysql/tests/bug70389.phpt
+++ b/ext/pdo_mysql/tests/bug70389.phpt
@@ -10,9 +10,9 @@ MySQLPDOTest::skip();
<?php
require(__DIR__. DIRECTORY_SEPARATOR . 'config.inc');
$flags = [
- PDO::MYSQL_ATTR_FOUND_ROWS => true,
- PDO::MYSQL_ATTR_LOCAL_INFILE => true,
- PDO::ATTR_PERSISTENT => true,
+ PDO::MYSQL_ATTR_FOUND_ROWS => true,
+ PDO::MYSQL_ATTR_LOCAL_INFILE => true,
+ PDO::ATTR_PERSISTENT => true,
];
$std = new StdClass();
diff --git a/ext/pdo_mysql/tests/bug70862.phpt b/ext/pdo_mysql/tests/bug70862.phpt
index d54d19f17b..fee79cbebb 100644
--- a/ext/pdo_mysql/tests/bug70862.phpt
+++ b/ext/pdo_mysql/tests/bug70862.phpt
@@ -8,32 +8,32 @@ MySQLPDOTest::skip();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
- $db->exec('DROP TABLE IF EXISTS test');
- $db->exec(sprintf('CREATE TABLE test(id INT, label BLOB)'));
+ $db->exec('DROP TABLE IF EXISTS test');
+ $db->exec(sprintf('CREATE TABLE test(id INT, label BLOB)'));
- $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
- $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
+ $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
+ $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
- class HelloWrapper {
- public function stream_open() { return true; }
- public function stream_eof() { return true; }
- public function stream_read() { return NULL; }
- public function stream_stat() { return array(); }
- }
- stream_wrapper_register("hello", "HelloWrapper");
+ class HelloWrapper {
+ public function stream_open() { return true; }
+ public function stream_eof() { return true; }
+ public function stream_read() { return NULL; }
+ public function stream_stat() { return array(); }
+ }
+ stream_wrapper_register("hello", "HelloWrapper");
- $f = fopen("hello://there", "r");
+ $f = fopen("hello://there", "r");
- $stmt = $db->prepare('INSERT INTO test(id, label) VALUES (1, :para)');
- $stmt->bindParam(":para", $f, PDO::PARAM_LOB);
- $stmt->execute();
+ $stmt = $db->prepare('INSERT INTO test(id, label) VALUES (1, :para)');
+ $stmt->bindParam(":para", $f, PDO::PARAM_LOB);
+ $stmt->execute();
- var_dump($f);
+ var_dump($f);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/bug75177.phpt b/ext/pdo_mysql/tests/bug75177.phpt
index 3a9127cb1e..f6414f0b29 100644
--- a/ext/pdo_mysql/tests/bug75177.phpt
+++ b/ext/pdo_mysql/tests/bug75177.phpt
@@ -21,13 +21,11 @@ $pdo->query("INSERT INTO $tbl (`bit`) VALUES (0b01100)");
$ret = $pdo->query("SELECT * FROM $tbl")->fetchAll();
foreach ($ret as $i) {
- var_dump($i["bit"]);
+ var_dump($i["bit"]);
}
?>
-==DONE==
--EXPECT--
string(1) "1"
string(1) "3"
string(2) "12"
-==DONE==
diff --git a/ext/pdo_mysql/tests/bug_33689.phpt b/ext/pdo_mysql/tests/bug_33689.phpt
index 0755112f5f..84b8f5b914 100644
--- a/ext/pdo_mysql/tests/bug_33689.phpt
+++ b/ext/pdo_mysql/tests/bug_33689.phpt
@@ -18,7 +18,7 @@ $db->exec('INSERT INTO test VALUES(1)');
var_dump($db->query('SELECT * from test'));
foreach ($db->query('SELECT * from test') as $row) {
- print_r($row);
+ print_r($row);
}
$stmt = $db->prepare('SELECT * from test');
@@ -28,9 +28,9 @@ $tmp = $stmt->getColumnMeta(0);
// libmysql and mysqlnd will show the pdo_type entry at a different position in the hash
if (!isset($tmp['pdo_type']) || (isset($tmp['pdo_type']) && $tmp['pdo_type'] != 2))
- printf("Expecting pdo_type = 2 got %s\n", $tmp['pdo_type']);
+ printf("Expecting pdo_type = 2 got %s\n", $tmp['pdo_type']);
else
- unset($tmp['pdo_type']);
+ unset($tmp['pdo_type']);
print_r($tmp);
?>
diff --git a/ext/pdo_mysql/tests/bug_38546.phpt b/ext/pdo_mysql/tests/bug_38546.phpt
index 0d7b44d1dc..238bccb035 100644
--- a/ext/pdo_mysql/tests/bug_38546.phpt
+++ b/ext/pdo_mysql/tests/bug_38546.phpt
@@ -21,20 +21,20 @@ $db->exec("SET sql_mode='STRICT_TRANS_TABLES'");
$db->exec("DROP TABLE IF EXISTS test");
$query = "CREATE TABLE test(
- uid MEDIUMINT UNSIGNED NOT NULL,
+ uid MEDIUMINT UNSIGNED NOT NULL,
some_bool_1 BOOL NOT NULL,
some_bool_2 BOOL NOT NULL,
some_int TINYINT NOT NULL
- )";
+ )";
$db->exec($query);
$st = $db->prepare("INSERT INTO test (uid, some_bool_1, some_bool_2, some_int) VALUES (?, ?, ?, ?)");
$values = [
- 'uid' => 6,
- 'some_bool_1' => false,
- 'some_bool_2' => true,
- 'some_int' => -23
+ 'uid' => 6,
+ 'some_bool_1' => false,
+ 'some_bool_2' => true,
+ 'some_int' => -23
];
$st->bindParam(1, $values['uid'], PDO::PARAM_INT);
$st->bindParam(2, $values['some_bool_1'], PDO::PARAM_BOOL);
@@ -50,16 +50,16 @@ if ($result === false) {
}
foreach ($db->query('SELECT * from test') as $row) {
- print_r($row);
+ print_r($row);
}
$st = $db->prepare("UPDATE test SET some_bool_1=?, some_bool_2=?, some_int=? WHERE uid=?");
$values = [
- 'uid' => 6,
- 'some_bool_1' => (bool) 1,
- 'some_bool_2' => (bool) 0,
- 'some_int' => 1,
+ 'uid' => 6,
+ 'some_bool_1' => (bool) 1,
+ 'some_bool_2' => (bool) 0,
+ 'some_int' => 1,
];
$st->bindParam(1, $values['some_bool_1'], PDO::PARAM_BOOL);
@@ -76,16 +76,16 @@ if ($result === false) {
}
foreach ($db->query('SELECT * from test') as $row) {
- print_r($row);
+ print_r($row);
}
$st = $db->prepare("UPDATE test SET some_bool_1=?, some_bool_2=?, some_int=? WHERE uid=?");
$values = [
- 'uid' => 6,
- 'some_bool_1' => (bool) 0,
- 'some_bool_2' => (bool) 1,
- 'some_int' => 2,
+ 'uid' => 6,
+ 'some_bool_1' => (bool) 0,
+ 'some_bool_2' => (bool) 1,
+ 'some_int' => 2,
];
$st->bindParam(1, $values['some_bool_1'], PDO::PARAM_BOOL);
@@ -102,17 +102,17 @@ if ($result === false) {
}
foreach ($db->query('SELECT * from test') as $row) {
- print_r($row);
+ print_r($row);
}
// String true and false should fail
$st = $db->prepare("UPDATE test SET some_bool_1=?, some_bool_2=?, some_int=? WHERE uid=?");
$values = [
- 'uid' => 6,
- 'some_bool_1' => 'true',
- 'some_bool_2' => 'false',
- 'some_int' => 3,
+ 'uid' => 6,
+ 'some_bool_1' => 'true',
+ 'some_bool_2' => 'false',
+ 'some_int' => 3,
];
$st->bindParam(1, $values['some_bool_1'], PDO::PARAM_BOOL);
@@ -129,17 +129,17 @@ if ($result === false) {
}
foreach ($db->query('SELECT * from test') as $row) {
- print_r($row);
+ print_r($row);
}
// Null should not be treated as false
$st = $db->prepare("UPDATE test SET some_bool_1=?, some_bool_2=?, some_int=? WHERE uid=?");
$values = [
- 'uid' => 6,
- 'some_bool_1' => true,
- 'some_bool_2' => null,
- 'some_int' => 4,
+ 'uid' => 6,
+ 'some_bool_1' => true,
+ 'some_bool_2' => null,
+ 'some_int' => 4,
];
$st->bindParam(1, $values['some_bool_1'], PDO::PARAM_BOOL);
@@ -156,17 +156,17 @@ if ($result === false) {
}
foreach ($db->query('SELECT * from test') as $row) {
- print_r($row);
+ print_r($row);
}
// Integers converted correctly
$st = $db->prepare("UPDATE test SET some_bool_1=?, some_bool_2=?, some_int=? WHERE uid=?");
$values = [
- 'uid' => 6,
- 'some_bool_1' => 256,
- 'some_bool_2' => 0,
- 'some_int' => 5,
+ 'uid' => 6,
+ 'some_bool_1' => 256,
+ 'some_bool_2' => 0,
+ 'some_int' => 5,
];
$st->bindParam(1, $values['some_bool_1'], PDO::PARAM_BOOL);
@@ -183,7 +183,7 @@ if ($result === false) {
}
foreach ($db->query('SELECT * from test') as $row) {
- print_r($row);
+ print_r($row);
}
?>
diff --git a/ext/pdo_mysql/tests/bug_39858.phpt b/ext/pdo_mysql/tests/bug_39858.phpt
index db8afa99b8..9328c0f20d 100644
--- a/ext/pdo_mysql/tests/bug_39858.phpt
+++ b/ext/pdo_mysql/tests/bug_39858.phpt
@@ -28,29 +28,29 @@ $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
function bug_39858($db) {
- $db->exec("DROP PROCEDURE IF EXISTS p");
- $db->exec("
- CREATE PROCEDURE p()
- NOT DETERMINISTIC
- CONTAINS SQL
- SQL SECURITY DEFINER
- COMMENT ''
- BEGIN
- SELECT 2 * 2;
- END;");
+ $db->exec("DROP PROCEDURE IF EXISTS p");
+ $db->exec("
+ CREATE PROCEDURE p()
+ NOT DETERMINISTIC
+ CONTAINS SQL
+ SQL SECURITY DEFINER
+ COMMENT ''
+ BEGIN
+ SELECT 2 * 2;
+ END;");
- $stmt = $db->prepare("CALL p()");
- $stmt->execute();
- do {
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
- } while ($stmt->nextRowset());
+ $stmt = $db->prepare("CALL p()");
+ $stmt->execute();
+ do {
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+ } while ($stmt->nextRowset());
- $stmt = $db->prepare("CALL p()");
- $stmt->execute();
- do {
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
- } while ($stmt->nextRowset());
- $stmt->closeCursor();
+ $stmt = $db->prepare("CALL p()");
+ $stmt->execute();
+ do {
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+ } while ($stmt->nextRowset());
+ $stmt->closeCursor();
}
diff --git a/ext/pdo_mysql/tests/bug_41125.phpt b/ext/pdo_mysql/tests/bug_41125.phpt
index e341ed409c..c86cad2b51 100644
--- a/ext/pdo_mysql/tests/bug_41125.phpt
+++ b/ext/pdo_mysql/tests/bug_41125.phpt
@@ -33,7 +33,7 @@ $sql = "CREATE TABLE IF NOT EXISTS test(id INT); INSERT INTO test(id) VALUES (1)
// Compare MySQL C-API documentation
$stmt = $db->query($sql);
do {
- var_dump($stmt->fetchAll());
+ var_dump($stmt->fetchAll());
} while ($stmt->nextRowset());
print "done!";
diff --git a/ext/pdo_mysql/tests/bug_41997.phpt b/ext/pdo_mysql/tests/bug_41997.phpt
index e3b52944be..def3d4406d 100644
--- a/ext/pdo_mysql/tests/bug_41997.phpt
+++ b/ext/pdo_mysql/tests/bug_41997.phpt
@@ -29,7 +29,7 @@ $db->exec('CREATE PROCEDURE p() BEGIN SELECT 1 AS "one"; END');
$stmt = $db->query("CALL p()");
do {
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
} while ($stmt->nextRowset());
var_dump($stmt->errorInfo());
diff --git a/ext/pdo_mysql/tests/bug_42499.phpt b/ext/pdo_mysql/tests/bug_42499.phpt
index 244101a7ae..4ad38eeca2 100644
--- a/ext/pdo_mysql/tests/bug_42499.phpt
+++ b/ext/pdo_mysql/tests/bug_42499.phpt
@@ -26,16 +26,16 @@ $db = MySQLPDOTest::factory();
function bug_42499($db) {
- $db->exec('DROP TABLE IF EXISTS test');
- $db->exec("CREATE TABLE test(id CHAR(1)); INSERT INTO test(id) VALUES ('a')");
+ $db->exec('DROP TABLE IF EXISTS test');
+ $db->exec("CREATE TABLE test(id CHAR(1)); INSERT INTO test(id) VALUES ('a')");
- $stmt = $db->query('SELECT id AS _id FROM test');
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+ $stmt = $db->query('SELECT id AS _id FROM test');
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
- // You must not use exec() to run statements that create a result set!
- $db->exec('SELECT id FROM test');
- // This will bail at you because you have not fetched the SELECT results: this is not a bug!
- $db->exec("INSERT INTO test(id) VALUES ('b')");
+ // You must not use exec() to run statements that create a result set!
+ $db->exec('SELECT id FROM test');
+ // This will bail at you because you have not fetched the SELECT results: this is not a bug!
+ $db->exec("INSERT INTO test(id) VALUES ('b')");
}
diff --git a/ext/pdo_mysql/tests/bug_44454.phpt b/ext/pdo_mysql/tests/bug_44454.phpt
index d21cf3a4e2..e95904dda1 100644
--- a/ext/pdo_mysql/tests/bug_44454.phpt
+++ b/ext/pdo_mysql/tests/bug_44454.phpt
@@ -15,43 +15,43 @@ $db = PDOTest::test_factory(__DIR__ . '/common.phpt');
function bug_44454($db) {
- try {
+ try {
- $db->exec('DROP TABLE IF EXISTS test');
- $db->exec('CREATE TABLE test(a INT, b INT, UNIQUE KEY idx_ab (a, b))');
- $db->exec('INSERT INTO test(a, b) VALUES (1, 1)');
+ $db->exec('DROP TABLE IF EXISTS test');
+ $db->exec('CREATE TABLE test(a INT, b INT, UNIQUE KEY idx_ab (a, b))');
+ $db->exec('INSERT INTO test(a, b) VALUES (1, 1)');
- $stmt = $db->query('SELECT a, b FROM test');
- printf("... SELECT has returned %d row...\n", $stmt->rowCount());
- while ($row = $stmt->fetch()) {
- try {
- printf("... INSERT should fail...\n");
- $db->exec('INSERT INTO test(a, b) VALUES (1, 1)');
- } catch (Exception $e) {
- printf("... STMT - %s\n", var_export($stmt->errorCode(), true));
- printf("... PDO - %s\n", var_export($db->errorInfo(), true));
- }
- }
+ $stmt = $db->query('SELECT a, b FROM test');
+ printf("... SELECT has returned %d row...\n", $stmt->rowCount());
+ while ($row = $stmt->fetch()) {
+ try {
+ printf("... INSERT should fail...\n");
+ $db->exec('INSERT INTO test(a, b) VALUES (1, 1)');
+ } catch (Exception $e) {
+ printf("... STMT - %s\n", var_export($stmt->errorCode(), true));
+ printf("... PDO - %s\n", var_export($db->errorInfo(), true));
+ }
+ }
- $db->exec('DROP TABLE IF EXISTS test');
- $db->exec('CREATE TABLE test(a INT, b INT, UNIQUE KEY idx_ab (a, b))');
- $db->exec('INSERT INTO test(a, b) VALUES (1, 1)');
+ $db->exec('DROP TABLE IF EXISTS test');
+ $db->exec('CREATE TABLE test(a INT, b INT, UNIQUE KEY idx_ab (a, b))');
+ $db->exec('INSERT INTO test(a, b) VALUES (1, 1)');
- } catch (Exception $e) {
- printf("... While error %s\n", $e->getMessage()); ;
- }
+ } catch (Exception $e) {
+ printf("... While error %s\n", $e->getMessage()); ;
+ }
- $stmt = $db->query('SELECT a, b FROM test');
- printf("... SELECT has returned %d row...\n", $stmt->rowCount());
- foreach ($stmt as $row) {
- try {
- printf("... INSERT should fail...\n");
- $db->exec('INSERT INTO test(a, b) VALUES (1, 1)');
- } catch (Exception $e) {
- printf("... STMT - %s\n", var_export($stmt->errorCode(), true));
- printf("... PDO - %s\n", var_export($db->errorInfo(), true));
- }
- }
+ $stmt = $db->query('SELECT a, b FROM test');
+ printf("... SELECT has returned %d row...\n", $stmt->rowCount());
+ foreach ($stmt as $row) {
+ try {
+ printf("... INSERT should fail...\n");
+ $db->exec('INSERT INTO test(a, b) VALUES (1, 1)');
+ } catch (Exception $e) {
+ printf("... STMT - %s\n", var_export($stmt->errorCode(), true));
+ printf("... PDO - %s\n", var_export($db->errorInfo(), true));
+ }
+ }
}
diff --git a/ext/pdo_mysql/tests/bug_44707.phpt b/ext/pdo_mysql/tests/bug_44707.phpt
index 60f4ccdfae..6bd7114431 100644
--- a/ext/pdo_mysql/tests/bug_44707.phpt
+++ b/ext/pdo_mysql/tests/bug_44707.phpt
@@ -28,32 +28,32 @@ $db = PDOTest::test_factory(__DIR__ . '/common.phpt');
function bug_44707($db) {
- $db->exec('DROP TABLE IF EXISTS test');
- $db->exec('CREATE TABLE test(id INT, mybool TINYINT)');
+ $db->exec('DROP TABLE IF EXISTS test');
+ $db->exec('CREATE TABLE test(id INT, mybool TINYINT)');
- $id = 1;
- $mybool = false;
- var_dump($mybool);
+ $id = 1;
+ $mybool = false;
+ var_dump($mybool);
- $stmt = $db->prepare('INSERT INTO test(id, mybool) VALUES (?, ?)');
- $stmt->bindParam(1, $id);
- $stmt->bindParam(2, $mybool, PDO::PARAM_BOOL);
- var_dump($mybool);
+ $stmt = $db->prepare('INSERT INTO test(id, mybool) VALUES (?, ?)');
+ $stmt->bindParam(1, $id);
+ $stmt->bindParam(2, $mybool, PDO::PARAM_BOOL);
+ var_dump($mybool);
- $stmt->execute();
- var_dump($mybool);
+ $stmt->execute();
+ var_dump($mybool);
- $stmt = $db->query('SELECT * FROM test');
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+ $stmt = $db->query('SELECT * FROM test');
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
- $stmt = $db->prepare('INSERT INTO test(id, mybool) VALUES (?, ?)');
- $stmt->bindParam(1, $id);
- // INT and integer work well together
- $stmt->bindParam(2, $mybool, PDO::PARAM_INT);
- $stmt->execute();
+ $stmt = $db->prepare('INSERT INTO test(id, mybool) VALUES (?, ?)');
+ $stmt->bindParam(1, $id);
+ // INT and integer work well together
+ $stmt->bindParam(2, $mybool, PDO::PARAM_INT);
+ $stmt->execute();
- $stmt = $db->query('SELECT * FROM test');
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+ $stmt = $db->query('SELECT * FROM test');
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
}
diff --git a/ext/pdo_mysql/tests/bug_45120.phpt b/ext/pdo_mysql/tests/bug_45120.phpt
index bc2ea76629..b281a6a354 100644
--- a/ext/pdo_mysql/tests/bug_45120.phpt
+++ b/ext/pdo_mysql/tests/bug_45120.phpt
@@ -15,20 +15,20 @@ $db = PDOTest::test_factory(__DIR__ . '/common.phpt');
function bug_45120($db) {
- $stmt = $db->prepare("SELECT 1 AS 'one'");
- if (true !== $stmt->execute())
- printf("[001] Execute has failed: %s\n", var_export($stmt->errorInfo(), true));
+ $stmt = $db->prepare("SELECT 1 AS 'one'");
+ if (true !== $stmt->execute())
+ printf("[001] Execute has failed: %s\n", var_export($stmt->errorInfo(), true));
- $res = $stmt->fetch(PDO::FETCH_ASSOC);
- if ($res['one'] != 1)
- printf("[002] Wrong results: %s\n", var_export($res, true));
+ $res = $stmt->fetch(PDO::FETCH_ASSOC);
+ if ($res['one'] != 1)
+ printf("[002] Wrong results: %s\n", var_export($res, true));
- if (true !== $stmt->execute())
- printf("[003] Execute has failed: %s\n", var_export($stmt->errorInfo(), true));
+ if (true !== $stmt->execute())
+ printf("[003] Execute has failed: %s\n", var_export($stmt->errorInfo(), true));
- $res = $stmt->fetch(PDO::FETCH_ASSOC);
- if ($res['one'] != 1)
- printf("[004] Wrong results: %s\n", var_export($res, true));
+ $res = $stmt->fetch(PDO::FETCH_ASSOC);
+ if ($res['one'] != 1)
+ printf("[004] Wrong results: %s\n", var_export($res, true));
}
diff --git a/ext/pdo_mysql/tests/bug_61207.phpt b/ext/pdo_mysql/tests/bug_61207.phpt
index 346c1687e7..b8a6a21f09 100644
--- a/ext/pdo_mysql/tests/bug_61207.phpt
+++ b/ext/pdo_mysql/tests/bug_61207.phpt
@@ -26,9 +26,9 @@ $handle1->execute();
$i = 1;
print("Handle 1:\n");
do {
- print('Rowset ' . $i++ . "\n");
- if ($handle1->columnCount() > 0)
- print("Results detected\n");
+ print('Rowset ' . $i++ . "\n");
+ if ($handle1->columnCount() > 0)
+ print("Results detected\n");
} while($handle1->nextRowset());
$handle2 = $db->prepare('select * from test where id = ?;
@@ -42,9 +42,9 @@ $handle2->execute();
$i = 1;
print("Handle 2:\n");
do {
- print('Rowset ' . $i++ . "\n");
- if ($handle2->columnCount() > 0)
- print("Results detected\n");
+ print('Rowset ' . $i++ . "\n");
+ if ($handle2->columnCount() > 0)
+ print("Results detected\n");
} while($handle2->nextRowset());
$handle3 = $db->prepare('update test set id = 2 where id = ?;
@@ -58,9 +58,9 @@ $handle3->execute();
$i = 1;
print("Handle 3:\n");
do {
- print('Rowset ' . $i++ . "\n");
- if ($handle3->columnCount() > 0)
- print("Results detected\n");
+ print('Rowset ' . $i++ . "\n");
+ if ($handle3->columnCount() > 0)
+ print("Results detected\n");
} while($handle3->nextRowset());
$handle4 = $db->prepare('insert into test(id) values(3);
@@ -75,9 +75,9 @@ $handle4->execute();
$i = 1;
print("Handle 4:\n");
do {
- print('Rowset ' . $i++ . "\n");
- if ($handle1->columnCount() > 0)
- print("Results detected\n");
+ print('Rowset ' . $i++ . "\n");
+ if ($handle1->columnCount() > 0)
+ print("Results detected\n");
} while($handle1->nextRowset());
$db->query("DROP TABLE test");
diff --git a/ext/pdo_mysql/tests/bug_61411.phpt b/ext/pdo_mysql/tests/bug_61411.phpt
index c5df174997..920dc4e067 100644
--- a/ext/pdo_mysql/tests/bug_61411.phpt
+++ b/ext/pdo_mysql/tests/bug_61411.phpt
@@ -24,9 +24,9 @@ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
$attr = getenv('PDOTEST_ATTR');
if (!$attr) {
- $attr = array();
+ $attr = array();
} else {
- $attr = unserialize($attr);
+ $attr = unserialize($attr);
}
$attr[PDO::ATTR_PERSISTENT] = true;
$attr[PDO::ATTR_EMULATE_PREPARES] = false;
@@ -38,7 +38,7 @@ $stmt = $db->prepare("SELECT 1");
$stmt->execute();
foreach ($stmt as $line) {
- var_dump($line);
+ var_dump($line);
}
print "done!";
@@ -47,7 +47,7 @@ print "done!";
array(2) {
[1]=>
int(1)
- [2]=>
+ [0]=>
int(1)
}
done!
diff --git a/ext/pdo_mysql/tests/bug_pecl_12925.phpt b/ext/pdo_mysql/tests/bug_pecl_12925.phpt
index 361ef719d0..2075d14581 100644
--- a/ext/pdo_mysql/tests/bug_pecl_12925.phpt
+++ b/ext/pdo_mysql/tests/bug_pecl_12925.phpt
@@ -15,17 +15,17 @@ $db = MySQLPDOTest::factory();
function bug_pecl_1295($db) {
- $db->exec('DROP TABLE IF EXISTS test');
- $db->exec('CREATE TABLE test(id CHAR(1))');
- $db->exec("INSERT INTO test(id) VALUES ('a')");
- $stmt = $db->prepare("UPDATE test SET id = 'b'");
- $stmt->execute();
- $stmt = $db->prepare("UPDATE test SET id = 'c'");
- $stmt->execute();
- $stmt = $db->prepare('SELECT id FROM test');
- $stmt->execute();
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
- $stmt->closeCursor();
+ $db->exec('DROP TABLE IF EXISTS test');
+ $db->exec('CREATE TABLE test(id CHAR(1))');
+ $db->exec("INSERT INTO test(id) VALUES ('a')");
+ $stmt = $db->prepare("UPDATE test SET id = 'b'");
+ $stmt->execute();
+ $stmt = $db->prepare("UPDATE test SET id = 'c'");
+ $stmt->execute();
+ $stmt = $db->prepare('SELECT id FROM test');
+ $stmt->execute();
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+ $stmt->closeCursor();
}
diff --git a/ext/pdo_mysql/tests/bug_pecl_7976.phpt b/ext/pdo_mysql/tests/bug_pecl_7976.phpt
index 9eb50abd43..00446edc47 100644
--- a/ext/pdo_mysql/tests/bug_pecl_7976.phpt
+++ b/ext/pdo_mysql/tests/bug_pecl_7976.phpt
@@ -25,16 +25,16 @@ $db = MySQLPDOTest::factory();
function bug_pecl_7976($db) {
- $db->exec('DROP PROCEDURE IF EXISTS p');
- $db->exec('CREATE PROCEDURE p() BEGIN SELECT "1" AS _one; END;');
+ $db->exec('DROP PROCEDURE IF EXISTS p');
+ $db->exec('CREATE PROCEDURE p() BEGIN SELECT "1" AS _one; END;');
- $stmt = $db->query('CALL p()');
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
- $stmt->closeCursor();
+ $stmt = $db->query('CALL p()');
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+ $stmt->closeCursor();
- $stmt = $db->query('CALL p()');
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
- $stmt->closeCursor();
+ $stmt = $db->query('CALL p()');
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+ $stmt->closeCursor();
}
diff --git a/ext/pdo_mysql/tests/config.inc b/ext/pdo_mysql/tests/config.inc
index f5ea020b78..d0a67ccd16 100644
--- a/ext/pdo_mysql/tests/config.inc
+++ b/ext/pdo_mysql/tests/config.inc
@@ -2,21 +2,21 @@
/* Overrule global settings, if need be */
if (false !== getenv('PDO_MYSQL_TEST_DSN')) {
- # user set them from their shell
- $config['ENV']['PDOTEST_DSN'] = getenv('PDO_MYSQL_TEST_DSN');
- $config['ENV']['PDOTEST_USER'] = getenv('PDO_MYSQL_TEST_USER');
- $config['ENV']['PDOTEST_PASS'] = getenv('PDO_MYSQL_TEST_PASS');
- if (false !== getenv('PDO_MYSQL_TEST_ATTR')) {
- $config['ENV']['PDOTEST_ATTR'] = getenv('PDO_MYSQL_TEST_ATTR');
- }
+ # user set them from their shell
+ $config['ENV']['PDOTEST_DSN'] = getenv('PDO_MYSQL_TEST_DSN');
+ $config['ENV']['PDOTEST_USER'] = getenv('PDO_MYSQL_TEST_USER');
+ $config['ENV']['PDOTEST_PASS'] = getenv('PDO_MYSQL_TEST_PASS');
+ if (false !== getenv('PDO_MYSQL_TEST_ATTR')) {
+ $config['ENV']['PDOTEST_ATTR'] = getenv('PDO_MYSQL_TEST_ATTR');
+ }
} else {
- $config['ENV']['PDOTEST_DSN'] = 'mysql:host=localhost;dbname=test';
- $config['ENV']['PDOTEST_USER'] = 'root';
- $config['ENV']['PDOTEST_PASS'] = '';
+ $config['ENV']['PDOTEST_DSN'] = 'mysql:host=localhost;dbname=test';
+ $config['ENV']['PDOTEST_USER'] = 'root';
+ $config['ENV']['PDOTEST_PASS'] = '';
}
foreach ($config['ENV'] as $k => $v) {
- putenv("$k=$v");
+ putenv("$k=$v");
}
/* MySQL specific settings */
@@ -31,22 +31,22 @@ define('PDO_MYSQL_TEST_PASS', (false !== getenv('PDO_MYSQL_TEST_PASS')) ? getenv
define('PDO_MYSQL_TEST_CHARSET', (false !== getenv('PDO_MYSQL_TEST_CHARSET')) ? getenv('PDO_MYSQL_TEST_CHARSET') : NULL);
if (!function_exists('sys_get_temp_dir')) {
- function sys_get_temp_dir() {
+ function sys_get_temp_dir() {
- if (!empty($_ENV['TMP']))
- return realpath( $_ENV['TMP'] );
- if (!empty($_ENV['TMPDIR']))
- return realpath( $_ENV['TMPDIR'] );
- if (!empty($_ENV['TEMP']))
- return realpath( $_ENV['TEMP'] );
+ if (!empty($_ENV['TMP']))
+ return realpath( $_ENV['TMP'] );
+ if (!empty($_ENV['TMPDIR']))
+ return realpath( $_ENV['TMPDIR'] );
+ if (!empty($_ENV['TEMP']))
+ return realpath( $_ENV['TEMP'] );
- $temp_file = tempnam(md5(uniqid(rand(), TRUE)), '');
- if ($temp_file) {
- $temp_dir = realpath(dirname($temp_file));
- unlink($temp_file);
- return $temp_dir;
- }
- return FALSE;
- }
+ $temp_file = tempnam(md5(uniqid(rand(), TRUE)), '');
+ if ($temp_file) {
+ $temp_dir = realpath(dirname($temp_file));
+ unlink($temp_file);
+ return $temp_dir;
+ }
+ return FALSE;
+ }
}
?>
diff --git a/ext/pdo_mysql/tests/mysql_pdo_test.inc b/ext/pdo_mysql/tests/mysql_pdo_test.inc
index 65ad7b2d17..880f8dbf75 100644
--- a/ext/pdo_mysql/tests/mysql_pdo_test.inc
+++ b/ext/pdo_mysql/tests/mysql_pdo_test.inc
@@ -4,174 +4,174 @@ require_once(dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc');
class MySQLPDOTest extends PDOTest {
- static function factory($classname = 'PDO', $drop_test_tables = false, $myattr = null, $mydsn = null) {
-
- $dsn = self::getDSN($mydsn);
- $user = PDO_MYSQL_TEST_USER;
- $pass = PDO_MYSQL_TEST_PASS;
- $attr = getenv('PDOTEST_ATTR');
-
- if (is_string($attr) && strlen($attr)) {
- $attr = unserialize($attr);
- } else {
- $attr = null;
- }
- if ($user === false)
- $user = NULL;
- if ($pass === false)
- $pass = NULL;
-
- $db = new $classname($dsn, $user, $pass, $attr);
- if (!$db) {
- die("Could not create PDO object (DSN=$dsn, user=$user)\n");
- }
-
- $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
- $db->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER);
-
- return $db;
- }
-
- static function createTestTable($db, $engine = null) {
- if (!$engine)
- $engine = PDO_MYSQL_TEST_ENGINE;
-
- $db->exec('DROP TABLE IF EXISTS test');
- $db->exec('CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE=' . $engine);
- $db->exec("INSERT INTO test(id, label) VALUES (1, 'a'), (2, 'b'), (3, 'c'), (4, 'd'), (5, 'e'), (6, 'f')");
- }
-
- static function getTableEngine() {
- return PDO_MYSQL_TEST_ENGINE;
- }
-
-
- static function getDSN($new_options = null, $addition = '') {
- if (!$new_options)
- return PDO_MYSQL_TEST_DSN . $addition;
-
- $old_options = array();
- $dsn = substr(PDO_MYSQL_TEST_DSN,
- strpos(PDO_MYSQL_TEST_DSN, ':') + 1,
- strlen(PDO_MYSQL_TEST_DSN));
-
- // no real parser - any exotic setting can fool us
- $parts = explode(';', $dsn);
- foreach ($parts as $k => $v) {
- $tmp = explode('=', $v);
- if (count($tmp) == 2)
- $old_options[$tmp[0]] = $tmp[1];
- }
-
- $options = $old_options;
- foreach ($new_options as $k => $v)
- $options[$k] = $v;
-
- $dsn = 'mysql:';
- foreach ($options as $k => $v)
- $dsn .= sprintf('%s=%s;', $k, $v);
-
- if ($addition)
- $dsn .= $addition;
- else
- $dsn = substr($dsn, 0, strlen($dsn) -1);
-
- return $dsn;
- }
-
- static function getClientVersion($db) {
- return self::extractVersion($db->getAttribute(PDO::ATTR_CLIENT_VERSION));
- }
-
- static function getServerVersion($db) {
- return self::extractVersion($db->getAttribute(PDO::ATTR_SERVER_VERSION));
- }
-
- static function extractVersion($version_string) {
- /*
- TODO:
- We're a bit in trouble: PDO_MYSQL returns version strings.
- That's wrong according to the manual. According to the manual
- integers should be returned. However, this code needs to work
- with stinky PDO_MYSQL and hopefully better PDO_MYSQLND.
- */
-
- // already an int value?
- if (is_int($version_string))
- return $version_string;
-
- // string but int value?
- $tmp = (int)$version_string;
- if (((string)$tmp) === $version_string)
- return $tmp;
-
- // stinky string which we need to parse
- $parts = explode('.', $version_string);
- if (count($parts) < 3)
- return -1;
-
- $version = (int)$parts[0] * 10000;
- $version+= (int)$parts[1] * 100;
- $version+= (int)$parts[2];
-
- return $version;
- }
-
- static function getTempDir() {
-
- if (!function_exists('sys_get_temp_dir')) {
-
- if (!empty($_ENV['TMP']))
- return realpath( $_ENV['TMP'] );
- if (!empty($_ENV['TMPDIR']))
- return realpath( $_ENV['TMPDIR'] );
- if (!empty($_ENV['TEMP']))
- return realpath( $_ENV['TEMP'] );
-
- $temp_file = tempnam(md5(uniqid(rand(), TRUE)), '');
- if ($temp_file) {
- $temp_dir = realpath(dirname($temp_file));
- unlink($temp_file);
- return $temp_dir;
- }
- return FALSE;
- } else {
- return sys_get_temp_dir();
- }
-
- }
-
- static function detect_transactional_mysql_engine($db) {
- foreach ($db->query("show variables like 'have%'") as $row) {
- if (!empty($row) && $row[1] == 'YES' && ($row[0] == 'have_innodb' || $row[0] == 'have_bdb')) {
- return str_replace("have_", "", $row[0]);
- }
- }
- /* MySQL 5.6.1+ */
- foreach ($db->query("SHOW ENGINES") as $row) {
- if (isset($row['engine']) && isset($row['support'])) {
- if ('InnoDB' == $row['engine'] && ('YES' == $row['support'] || 'DEFAULT' == $row['support']))
- return 'innodb';
- }
- }
- return false;
- }
-
- static function isPDOMySQLnd() {
- ob_start();
- phpinfo();
- $tmp = ob_get_contents();
- ob_end_clean();
- return (preg_match('/PDO Driver for MySQL.*enabled/', $tmp) &&
- preg_match('/Client API version.*mysqlnd/', $tmp));
- }
-
- static function dropTestTable($db = NULL) {
- if (is_null($db))
- $db = self::factory();
-
- $db->exec('DROP TABLE IF EXISTS test');
- }
+ static function factory($classname = 'PDO', $drop_test_tables = false, $myattr = null, $mydsn = null) {
+
+ $dsn = self::getDSN($mydsn);
+ $user = PDO_MYSQL_TEST_USER;
+ $pass = PDO_MYSQL_TEST_PASS;
+ $attr = getenv('PDOTEST_ATTR');
+
+ if (is_string($attr) && strlen($attr)) {
+ $attr = unserialize($attr);
+ } else {
+ $attr = null;
+ }
+ if ($user === false)
+ $user = NULL;
+ if ($pass === false)
+ $pass = NULL;
+
+ $db = new $classname($dsn, $user, $pass, $attr);
+ if (!$db) {
+ die("Could not create PDO object (DSN=$dsn, user=$user)\n");
+ }
+
+ $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
+ $db->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER);
+
+ return $db;
+ }
+
+ static function createTestTable($db, $engine = null) {
+ if (!$engine)
+ $engine = PDO_MYSQL_TEST_ENGINE;
+
+ $db->exec('DROP TABLE IF EXISTS test');
+ $db->exec('CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE=' . $engine);
+ $db->exec("INSERT INTO test(id, label) VALUES (1, 'a'), (2, 'b'), (3, 'c'), (4, 'd'), (5, 'e'), (6, 'f')");
+ }
+
+ static function getTableEngine() {
+ return PDO_MYSQL_TEST_ENGINE;
+ }
+
+
+ static function getDSN($new_options = null, $addition = '') {
+ if (!$new_options)
+ return PDO_MYSQL_TEST_DSN . $addition;
+
+ $old_options = array();
+ $dsn = substr(PDO_MYSQL_TEST_DSN,
+ strpos(PDO_MYSQL_TEST_DSN, ':') + 1,
+ strlen(PDO_MYSQL_TEST_DSN));
+
+ // no real parser - any exotic setting can fool us
+ $parts = explode(';', $dsn);
+ foreach ($parts as $k => $v) {
+ $tmp = explode('=', $v);
+ if (count($tmp) == 2)
+ $old_options[$tmp[0]] = $tmp[1];
+ }
+
+ $options = $old_options;
+ foreach ($new_options as $k => $v)
+ $options[$k] = $v;
+
+ $dsn = 'mysql:';
+ foreach ($options as $k => $v)
+ $dsn .= sprintf('%s=%s;', $k, $v);
+
+ if ($addition)
+ $dsn .= $addition;
+ else
+ $dsn = substr($dsn, 0, strlen($dsn) -1);
+
+ return $dsn;
+ }
+
+ static function getClientVersion($db) {
+ return self::extractVersion($db->getAttribute(PDO::ATTR_CLIENT_VERSION));
+ }
+
+ static function getServerVersion($db) {
+ return self::extractVersion($db->getAttribute(PDO::ATTR_SERVER_VERSION));
+ }
+
+ static function extractVersion($version_string) {
+ /*
+ TODO:
+ We're a bit in trouble: PDO_MYSQL returns version strings.
+ That's wrong according to the manual. According to the manual
+ integers should be returned. However, this code needs to work
+ with stinky PDO_MYSQL and hopefully better PDO_MYSQLND.
+ */
+
+ // already an int value?
+ if (is_int($version_string))
+ return $version_string;
+
+ // string but int value?
+ $tmp = (int)$version_string;
+ if (((string)$tmp) === $version_string)
+ return $tmp;
+
+ // stinky string which we need to parse
+ $parts = explode('.', $version_string);
+ if (count($parts) < 3)
+ return -1;
+
+ $version = (int)$parts[0] * 10000;
+ $version+= (int)$parts[1] * 100;
+ $version+= (int)$parts[2];
+
+ return $version;
+ }
+
+ static function getTempDir() {
+
+ if (!function_exists('sys_get_temp_dir')) {
+
+ if (!empty($_ENV['TMP']))
+ return realpath( $_ENV['TMP'] );
+ if (!empty($_ENV['TMPDIR']))
+ return realpath( $_ENV['TMPDIR'] );
+ if (!empty($_ENV['TEMP']))
+ return realpath( $_ENV['TEMP'] );
+
+ $temp_file = tempnam(md5(uniqid(rand(), TRUE)), '');
+ if ($temp_file) {
+ $temp_dir = realpath(dirname($temp_file));
+ unlink($temp_file);
+ return $temp_dir;
+ }
+ return FALSE;
+ } else {
+ return sys_get_temp_dir();
+ }
+
+ }
+
+ static function detect_transactional_mysql_engine($db) {
+ foreach ($db->query("show variables like 'have%'") as $row) {
+ if (!empty($row) && $row[1] == 'YES' && ($row[0] == 'have_innodb' || $row[0] == 'have_bdb')) {
+ return str_replace("have_", "", $row[0]);
+ }
+ }
+ /* MySQL 5.6.1+ */
+ foreach ($db->query("SHOW ENGINES") as $row) {
+ if (isset($row['engine']) && isset($row['support'])) {
+ if ('InnoDB' == $row['engine'] && ('YES' == $row['support'] || 'DEFAULT' == $row['support']))
+ return 'innodb';
+ }
+ }
+ return false;
+ }
+
+ static function isPDOMySQLnd() {
+ ob_start();
+ phpinfo();
+ $tmp = ob_get_contents();
+ ob_end_clean();
+ return (preg_match('/PDO Driver for MySQL.*enabled/', $tmp) &&
+ preg_match('/Client API version.*mysqlnd/', $tmp));
+ }
+
+ static function dropTestTable($db = NULL) {
+ if (is_null($db))
+ $db = self::factory();
+
+ $db->exec('DROP TABLE IF EXISTS test');
+ }
}
?>
diff --git a/ext/pdo_mysql/tests/pdo_mysql___construct.phpt b/ext/pdo_mysql/tests/pdo_mysql___construct.phpt
index b849f274be..2231f8b449 100644
--- a/ext/pdo_mysql/tests/pdo_mysql___construct.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql___construct.phpt
@@ -8,289 +8,289 @@ MySQLPDOTest::skip();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
-
- function tryandcatch($offset, $code) {
-
- try {
- eval($code);
- assert(sprintf("[%03d] Should have failed\n", $offset) != '');
- } catch (PDOException $e) {
- return sprintf("[%03d] %s, [%s] %s\n",
- $offset,
- $e->getMessage(),
- (isset($db) && is_object($db)) ? $db->errorCode() : 'n/a',
- (isset($db) && is_object($db)) ? implode(' ', $db->errorInfo()) : 'n/a');
- }
-
- return '';
- }
-
- try {
-
- try {
- if (NULL !== ($db = @new PDO()))
- printf("[001] Too few parameters\n");
- } catch (TypeError $ex) {
- }
-
- print tryandcatch(2, '$db = new PDO(chr(0));');
- print tryandcatch(3, '$db = new PDO("a" . chr(0) . "b");');
- print tryandcatch(4, '$db = new PDO("MYSQL");');
- print tryandcatch(5, '$db = new PDO("mysql");');
- print tryandcatch(6, '$db = new PDO("mysql ");');
- print tryandcatch(7, '$db = new PDO("fantasyandfriends :");');
-
- $dsn = PDO_MYSQL_TEST_DSN;
- // MySQL Server might accept anonymous connections, don't
- // print anything
- tryandcatch(8, '$db = new PDO("' . $dsn . '");');
-
- $user = 'dontcreatesuchauser';
- $pass = 'withthispassword';
- print tryandcatch(9, '$db = new PDO("' . $dsn . '", "' . $user . '", "' . $pass . '");');
-
- // should fail
- $dsn = 'mysql:';
- // don't print the message since it can be different
- tryandcatch(10, '$db = new PDO("' . $dsn . '", "' . $user . '", "' . $pass . '");');
-
- $dsn = PDO_MYSQL_TEST_DSN;
- $user = PDO_MYSQL_TEST_USER;
- $pass = PDO_MYSQL_TEST_PASS;
- // should work...
- $db = new PDO($dsn, $user, $pass);
-
- // Reaction on host not specified differs for different configs, so no printing
- $dsn = 'mysql:invalid=foo';
- tryandcatch(11, '$db = new PDO("' . $dsn . '", "' . $user . '", "' . $pass . '");');
-
- $dsn = 'mysql:' . str_repeat('howmuch=canpdoeat;', 1000);
- tryandcatch(12, '$db = new PDO("' . $dsn . '", "' . $user . '", "' . $pass . '");');
-
- $dsn = 'mysql:' . str_repeat('abcdefghij', 1024 * 10) . '=somevalue';
- tryandcatch(13, '$db = new PDO("' . $dsn . '", "' . $user . '", "' . $pass . '");');
-
- if (PDO_MYSQL_TEST_HOST) {
- $host = PDO_MYSQL_TEST_HOST;
- $invalid_host = $host . 'invalid';
-
- // last host specification should be the one used
- $dsn = MySQLPDOTest::getDSN(array('host' => $host), 'host=' . $invalid_host);
- try { $db = @new PDO($dsn, $user, $pass); assert(false); printf("%s\n", $dsn); } catch (PDOException $e) {
- $tmp = $e->getMessage();
- if (!stristr($tmp, 'HY000') && !stristr($tmp, '2005') && !stristr($tmp, '2002'))
- printf("[014] Cannot find proper error codes: %s\n", $tmp);
- }
-
- $dsn = MySQLPDOTest::getDSN(array('host' => $invalid_host), 'host=' . $host);
- try { $db = @new PDO($dsn, $user, $pass); } catch (PDOException $e) {
- printf("[015] DSN=%s, %s\n", $dsn, $e->getMessage());
- }
-
- $invalid_host = '-' . chr(0);
-
- $dsn = MySQLPDOTest::getDSN(array('host' => $invalid_host));
- try { $db = @new PDO($dsn, $user, $pass); assert(false); printf("%s\n", $dsn); } catch (PDOException $e) {
- $tmp = $e->getMessage();
- if (!stristr($tmp, 'HY000') && !stristr($tmp, '2005') && !stristr($tmp, '2002'))
- printf("[016] Cannot find proper error codes: %s\n", $tmp);
- }
-
- // parsing should not get confused by chr(0)
- $dsn = MySQLPDOTest::getDSN(array('host' => $invalid_host), 'host=' . $host);
- try { $db = @new PDO($dsn, $user, $pass); } catch (PDOException $e) {
- printf("[017] DSN=%s, %s\n", $dsn, $e->getMessage());
- }
-
- }
-
- // what about long values for a valid option ...
- // hostnames > 1024 chars break on some NIS-enabled FreeBSD...
- $dsn = MySQLPDOTest::getDSN(array('host' => str_repeat('0123456789', 100)));
- try { $db = @new PDO($dsn, $user, $pass); assert(false); printf("%s\n", $dsn); } catch (PDOException $e) {
- $tmp = $e->getMessage();
- if (!stristr($tmp, 'HY000') && !stristr($tmp, '2005') && !stristr($tmp, '2002'))
- printf("[018] Cannot find proper error codes: %s\n", $tmp);
- }
-
- if (PDO_MYSQL_TEST_PORT && (PDO_MYSQL_TEST_SOCKET == '')) {
- // Playing with the port makes only sense if no socket gets used
-
- $port = PDO_MYSQL_TEST_PORT;
- // let's hope we don't hit a MySQL running on that port...
- $invalid_port = $port * 2;
-
- $dsn = MySQLPDOTest::getDSN(array('port' => $port), 'port=' . $invalid_port);
- try { $db = @new PDO($dsn, $user, $pass); assert(false); printf("%s\n", $dsn); } catch (PDOException $e) {
- $tmp = $e->getMessage();
- if (!stristr($tmp, 'HY000') && !stristr($tmp, '2005'))
- printf("[019] Cannot find proper error codes: %s\n", $tmp);
- }
-
- $dsn = MySQLPDOTest::getDSN(array('port' => $invalid_port), 'port=' . $port);
- try { $db = @new PDO($dsn, $user, $pass); } catch (PDOException $e) {
- printf("[020] DSN=%s, %s\n", $dsn, $e->getMessage());
- }
-
- $invalid_port = 'abc';
- $dsn = MySQLPDOTest::getDSN(array('port' => $port), 'port=' . $invalid_port);
- try {
- $db = @new PDO($dsn, $user, $pass);
- // atoi('abc') = 0, 0 -> fallback to default 3306 -> may or may not fail!
- } catch (PDOException $e) {
- }
-
- }
-
- if (PDO_MYSQL_TEST_DB) {
- $db = PDO_MYSQL_TEST_DB;
- $invalid_db = 'letshopeitdoesnotexist';
-
- $dsn = MySQLPDOTest::getDSN(array('dbname' => $db), 'dbname=' . $invalid_db);
- try { $db = @new PDO($dsn, $user, $pass); assert(false); printf("%s\n", $dsn); } catch (PDOException $e) {
- $tmp = $e->getMessage();
- if (!stristr($tmp, '42000') && !stristr($tmp, '1049'))
- printf("[022] Cannot find proper error codes: %s\n", $tmp);
- }
-
- $dsn = MySQLPDOTest::getDSN(array('dbname' => $invalid_db), 'dbname=' . $db);
- try { $db = @new PDO($dsn, $user, $pass); } catch (PDOException $e) {
- printf("[023] DSN=%s, %s\n", $dsn, $e->getMessage());
- }
-
- }
-
- if (PDO_MYSQL_TEST_SOCKET && (stristr(PDO_MYSQL_TEST_DSN, PDO_MYSQL_TEST_SOCKET) !== false)) {
- $socket = PDO_MYSQL_TEST_SOCKET;
- $invalid_socket = '/lets/hope/it/does/not/exist';
-
- $dsn = MySQLPDOTest::getDSN(array('unix_socket' => $socket), 'unix_socket=' . $invalid_socket);
- try { $db = @new PDO($dsn, $user, $pass); assert(false); printf("%s\n", $dsn); } catch (PDOException $e) {
- $tmp = $e->getMessage();
- if (!stristr($tmp, 'HY000') && !stristr($tmp, '2002'))
- printf("[024] Cannot find proper error codes: %s\n", $tmp);
- }
-
- $dsn = MySQLPDOTest::getDSN(array('unix_socket' => $invalid_socket), 'unix_socket=' . $socket);
- try { $db = @new PDO($dsn, $user, $pass); } catch (PDOException $e) {
- printf("[025] DSN=%s, %s\n", $dsn, $e->getMessage());
- }
-
- }
-
- $have_charset_support = false;
- $dsn = MySQLPDOTest::getDSN();
- try {
- $db = new PDO($dsn, $user, $pass);
- $stmt = $db->query('SELECT VERSION() as _version');
- $version = $stmt->fetch(PDO::FETCH_ASSOC);
-
- $tmp = explode('.', $version['_version']);
- if ((count($tmp) == 3) &&
- (($tmp[0] >= 4 && $tmp[1] >= 1) || ($tmp[0] >= 5))) {
- // MySQL Server 4.1 - charset support available
- $have_charset_support = true;
- }
-
- } catch (PDOException $e) {
- printf("[026] DSN=%s, %s\n", $dsn, $e->getMessage());
- }
-
- if (PDO_MYSQL_TEST_CHARSET) {
- $charset = PDO_MYSQL_TEST_CHARSET;
- $invalid_charset = 'invalid';
-
- if ($have_charset_support) {
- $dsn = MySQLPDOTest::getDSN();
- $db = new PDO($dsn, $user, $pass);
- $stmt = $db->query(sprintf('SHOW CHARACTER SET LIKE "%s"', $charset));
- $tmp = $stmt->fetch(PDO::FETCH_ASSOC);
- $have_charset = (empty($tmp)) ? false : true;
-
- if ($have_charset) {
- $dsn = MySQLPDOTest::getDSN(array('charset' => $charset), 'charset=' . $invalid_charset);
- try {
- $db = @new PDO($dsn, $user, $pass);
- /* NOTE: MySQL does a fallback to the charset suggested during the handshake - no error - no bug! */
- } catch (PDOException $e) {
- $tmp = $e->getMessage();
- /* TODO: add proper codes */
- if (!stristr($tmp, 'sqlstatecode') || !stristr($tmp, 'mysqlinternalerrcode'))
- printf("[027] TODO - Cannot find proper error codes: %s\n", $tmp);
- }
-
- $dsn = MySQLPDOTest::getDSN(array('charset' => $invalid_charset), 'charset=' . $charset);
- try {
- $db = @new PDO($dsn, $user, $pass);
- /* Strictly speaking we should test more: character_set_client, character_set_results, and character_set_connection */
- $stmt = $db->query('SELECT @@character_set_connection AS _charset');
- $tmp = $stmt->fetch(PDO::FETCH_ASSOC);
- if ($tmp['_charset'] != $charset)
- printf("[028] Character sets has not been set, @@character_set_connection reports '%s', expecting '%s'",
- $tmp['_charset'], $charset);
- } catch (PDOException $e) {
- printf("[029] DSN=%s, %s\n", $dsn, $e->getMessage());
- }
- } else {
- printf("[030] You're trying to run the tests with charset '%s' which seems not supported by the server!", $charset);
- }
-
- }
-
- }
-
- if ($have_charset_support) {
- // In case the PDO_MYSQL_TEST_CHARSET interferes with any defaults
- // we do another test to verify that the charset has been set.
- $dsn = MySQLPDOTest::getDSN();
- $db = new PDO($dsn, $user, $pass);
- $stmt = $db->query('SHOW CHARACTER SET LIKE "latin1"');
- $tmp = $stmt->fetch(PDO::FETCH_ASSOC);
- $have_latin1 =(empty($tmp)) ? false : true;
- $stmt = $db->query('SHOW CHARACTER SET LIKE "latin2"');
- $tmp = $stmt->fetch(PDO::FETCH_ASSOC);
- $have_latin2 =(empty($tmp)) ? false : true;
-
- if ($have_latin1 && $have_latin2) {
- // very likely we do have both of them...
- try {
- $dsn = MySQLPDOTest::getDSN(array('charset' => 'latin1'));
- $db = new PDO($dsn, $user, $pass);
- $stmt = $db->query('SELECT @@character_set_connection AS _charset');
- $tmp = $stmt->fetch(PDO::FETCH_ASSOC);
- if ($tmp['_charset'] != 'latin1')
- printf("[031] DSN = %s, Character sets has not been set, @@character_set_connection reports '%s', expecting '%s'",
- $dsn, $tmp['_charset'], 'latin1');
-
- } catch (PDOException $e) {
- printf("[032] %s\n", $e->getMessage());
- }
-
- try {
- $dsn = MySQLPDOTest::getDSN(array('charset' => 'latin2'));
- $db = new PDO($dsn, $user, $pass);
- $stmt = $db->query('SELECT @@character_set_connection AS _charset');
- $tmp = $stmt->fetch(PDO::FETCH_ASSOC);
- if ($tmp['_charset'] != 'latin2')
- printf("[033] DSN = %s, character sets has not been set, @@character_set_connection reports '%s', expecting '%s'",
- $dsn, $tmp['_charset'], 'latin2');
-
- } catch (PDOException $e) {
- printf("[034] %s\n", $e->getMessage());
- }
-
- }
- }
-
- } catch (PDOException $e) {
- printf("[001] %s, [%s] %s\n",
- $e->getMessage(),
- (is_object($db)) ? $db->errorCode() : 'n/a',
- (is_object($db)) ? implode(' ', $db->errorInfo()) : 'n/a');
- }
-
- print "done!";
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+
+ function tryandcatch($offset, $code) {
+
+ try {
+ eval($code);
+ assert(sprintf("[%03d] Should have failed\n", $offset) != '');
+ } catch (PDOException $e) {
+ return sprintf("[%03d] %s, [%s] %s\n",
+ $offset,
+ $e->getMessage(),
+ (isset($db) && is_object($db)) ? $db->errorCode() : 'n/a',
+ (isset($db) && is_object($db)) ? implode(' ', $db->errorInfo()) : 'n/a');
+ }
+
+ return '';
+ }
+
+ try {
+
+ try {
+ if (NULL !== ($db = @new PDO()))
+ printf("[001] Too few parameters\n");
+ } catch (TypeError $ex) {
+ }
+
+ print tryandcatch(2, '$db = new PDO(chr(0));');
+ print tryandcatch(3, '$db = new PDO("a" . chr(0) . "b");');
+ print tryandcatch(4, '$db = new PDO("MYSQL");');
+ print tryandcatch(5, '$db = new PDO("mysql");');
+ print tryandcatch(6, '$db = new PDO("mysql ");');
+ print tryandcatch(7, '$db = new PDO("fantasyandfriends :");');
+
+ $dsn = PDO_MYSQL_TEST_DSN;
+ // MySQL Server might accept anonymous connections, don't
+ // print anything
+ tryandcatch(8, '$db = new PDO("' . $dsn . '");');
+
+ $user = 'dontcreatesuchauser';
+ $pass = 'withthispassword';
+ print tryandcatch(9, '$db = new PDO("' . $dsn . '", "' . $user . '", "' . $pass . '");');
+
+ // should fail
+ $dsn = 'mysql:';
+ // don't print the message since it can be different
+ tryandcatch(10, '$db = new PDO("' . $dsn . '", "' . $user . '", "' . $pass . '");');
+
+ $dsn = PDO_MYSQL_TEST_DSN;
+ $user = PDO_MYSQL_TEST_USER;
+ $pass = PDO_MYSQL_TEST_PASS;
+ // should work...
+ $db = new PDO($dsn, $user, $pass);
+
+ // Reaction on host not specified differs for different configs, so no printing
+ $dsn = 'mysql:invalid=foo';
+ tryandcatch(11, '$db = new PDO("' . $dsn . '", "' . $user . '", "' . $pass . '");');
+
+ $dsn = 'mysql:' . str_repeat('howmuch=canpdoeat;', 1000);
+ tryandcatch(12, '$db = new PDO("' . $dsn . '", "' . $user . '", "' . $pass . '");');
+
+ $dsn = 'mysql:' . str_repeat('abcdefghij', 1024 * 10) . '=somevalue';
+ tryandcatch(13, '$db = new PDO("' . $dsn . '", "' . $user . '", "' . $pass . '");');
+
+ if (PDO_MYSQL_TEST_HOST) {
+ $host = PDO_MYSQL_TEST_HOST;
+ $invalid_host = $host . 'invalid';
+
+ // last host specification should be the one used
+ $dsn = MySQLPDOTest::getDSN(array('host' => $host), 'host=' . $invalid_host);
+ try { $db = @new PDO($dsn, $user, $pass); assert(false); printf("%s\n", $dsn); } catch (PDOException $e) {
+ $tmp = $e->getMessage();
+ if (!stristr($tmp, 'HY000') && !stristr($tmp, '2005') && !stristr($tmp, '2002'))
+ printf("[014] Cannot find proper error codes: %s\n", $tmp);
+ }
+
+ $dsn = MySQLPDOTest::getDSN(array('host' => $invalid_host), 'host=' . $host);
+ try { $db = @new PDO($dsn, $user, $pass); } catch (PDOException $e) {
+ printf("[015] DSN=%s, %s\n", $dsn, $e->getMessage());
+ }
+
+ $invalid_host = '-' . chr(0);
+
+ $dsn = MySQLPDOTest::getDSN(array('host' => $invalid_host));
+ try { $db = @new PDO($dsn, $user, $pass); assert(false); printf("%s\n", $dsn); } catch (PDOException $e) {
+ $tmp = $e->getMessage();
+ if (!stristr($tmp, 'HY000') && !stristr($tmp, '2005') && !stristr($tmp, '2002'))
+ printf("[016] Cannot find proper error codes: %s\n", $tmp);
+ }
+
+ // parsing should not get confused by chr(0)
+ $dsn = MySQLPDOTest::getDSN(array('host' => $invalid_host), 'host=' . $host);
+ try { $db = @new PDO($dsn, $user, $pass); } catch (PDOException $e) {
+ printf("[017] DSN=%s, %s\n", $dsn, $e->getMessage());
+ }
+
+ }
+
+ // what about long values for a valid option ...
+ // hostnames > 1024 chars break on some NIS-enabled FreeBSD...
+ $dsn = MySQLPDOTest::getDSN(array('host' => str_repeat('0123456789', 100)));
+ try { $db = @new PDO($dsn, $user, $pass); assert(false); printf("%s\n", $dsn); } catch (PDOException $e) {
+ $tmp = $e->getMessage();
+ if (!stristr($tmp, 'HY000') && !stristr($tmp, '2005') && !stristr($tmp, '2002'))
+ printf("[018] Cannot find proper error codes: %s\n", $tmp);
+ }
+
+ if (PDO_MYSQL_TEST_PORT && (PDO_MYSQL_TEST_SOCKET == '')) {
+ // Playing with the port makes only sense if no socket gets used
+
+ $port = PDO_MYSQL_TEST_PORT;
+ // let's hope we don't hit a MySQL running on that port...
+ $invalid_port = $port * 2;
+
+ $dsn = MySQLPDOTest::getDSN(array('port' => $port), 'port=' . $invalid_port);
+ try { $db = @new PDO($dsn, $user, $pass); assert(false); printf("%s\n", $dsn); } catch (PDOException $e) {
+ $tmp = $e->getMessage();
+ if (!stristr($tmp, 'HY000') && !stristr($tmp, '2005'))
+ printf("[019] Cannot find proper error codes: %s\n", $tmp);
+ }
+
+ $dsn = MySQLPDOTest::getDSN(array('port' => $invalid_port), 'port=' . $port);
+ try { $db = @new PDO($dsn, $user, $pass); } catch (PDOException $e) {
+ printf("[020] DSN=%s, %s\n", $dsn, $e->getMessage());
+ }
+
+ $invalid_port = 'abc';
+ $dsn = MySQLPDOTest::getDSN(array('port' => $port), 'port=' . $invalid_port);
+ try {
+ $db = @new PDO($dsn, $user, $pass);
+ // atoi('abc') = 0, 0 -> fallback to default 3306 -> may or may not fail!
+ } catch (PDOException $e) {
+ }
+
+ }
+
+ if (PDO_MYSQL_TEST_DB) {
+ $db = PDO_MYSQL_TEST_DB;
+ $invalid_db = 'letshopeitdoesnotexist';
+
+ $dsn = MySQLPDOTest::getDSN(array('dbname' => $db), 'dbname=' . $invalid_db);
+ try { $db = @new PDO($dsn, $user, $pass); assert(false); printf("%s\n", $dsn); } catch (PDOException $e) {
+ $tmp = $e->getMessage();
+ if (!stristr($tmp, '42000') && !stristr($tmp, '1049'))
+ printf("[022] Cannot find proper error codes: %s\n", $tmp);
+ }
+
+ $dsn = MySQLPDOTest::getDSN(array('dbname' => $invalid_db), 'dbname=' . $db);
+ try { $db = @new PDO($dsn, $user, $pass); } catch (PDOException $e) {
+ printf("[023] DSN=%s, %s\n", $dsn, $e->getMessage());
+ }
+
+ }
+
+ if (PDO_MYSQL_TEST_SOCKET && (stristr(PDO_MYSQL_TEST_DSN, PDO_MYSQL_TEST_SOCKET) !== false)) {
+ $socket = PDO_MYSQL_TEST_SOCKET;
+ $invalid_socket = '/lets/hope/it/does/not/exist';
+
+ $dsn = MySQLPDOTest::getDSN(array('unix_socket' => $socket), 'unix_socket=' . $invalid_socket);
+ try { $db = @new PDO($dsn, $user, $pass); assert(false); printf("%s\n", $dsn); } catch (PDOException $e) {
+ $tmp = $e->getMessage();
+ if (!stristr($tmp, 'HY000') && !stristr($tmp, '2002'))
+ printf("[024] Cannot find proper error codes: %s\n", $tmp);
+ }
+
+ $dsn = MySQLPDOTest::getDSN(array('unix_socket' => $invalid_socket), 'unix_socket=' . $socket);
+ try { $db = @new PDO($dsn, $user, $pass); } catch (PDOException $e) {
+ printf("[025] DSN=%s, %s\n", $dsn, $e->getMessage());
+ }
+
+ }
+
+ $have_charset_support = false;
+ $dsn = MySQLPDOTest::getDSN();
+ try {
+ $db = new PDO($dsn, $user, $pass);
+ $stmt = $db->query('SELECT VERSION() as _version');
+ $version = $stmt->fetch(PDO::FETCH_ASSOC);
+
+ $tmp = explode('.', $version['_version']);
+ if ((count($tmp) == 3) &&
+ (($tmp[0] >= 4 && $tmp[1] >= 1) || ($tmp[0] >= 5))) {
+ // MySQL Server 4.1 - charset support available
+ $have_charset_support = true;
+ }
+
+ } catch (PDOException $e) {
+ printf("[026] DSN=%s, %s\n", $dsn, $e->getMessage());
+ }
+
+ if (PDO_MYSQL_TEST_CHARSET) {
+ $charset = PDO_MYSQL_TEST_CHARSET;
+ $invalid_charset = 'invalid';
+
+ if ($have_charset_support) {
+ $dsn = MySQLPDOTest::getDSN();
+ $db = new PDO($dsn, $user, $pass);
+ $stmt = $db->query(sprintf('SHOW CHARACTER SET LIKE "%s"', $charset));
+ $tmp = $stmt->fetch(PDO::FETCH_ASSOC);
+ $have_charset = (empty($tmp)) ? false : true;
+
+ if ($have_charset) {
+ $dsn = MySQLPDOTest::getDSN(array('charset' => $charset), 'charset=' . $invalid_charset);
+ try {
+ $db = @new PDO($dsn, $user, $pass);
+ /* NOTE: MySQL does a fallback to the charset suggested during the handshake - no error - no bug! */
+ } catch (PDOException $e) {
+ $tmp = $e->getMessage();
+ /* TODO: add proper codes */
+ if (!stristr($tmp, 'sqlstatecode') || !stristr($tmp, 'mysqlinternalerrcode'))
+ printf("[027] TODO - Cannot find proper error codes: %s\n", $tmp);
+ }
+
+ $dsn = MySQLPDOTest::getDSN(array('charset' => $invalid_charset), 'charset=' . $charset);
+ try {
+ $db = @new PDO($dsn, $user, $pass);
+ /* Strictly speaking we should test more: character_set_client, character_set_results, and character_set_connection */
+ $stmt = $db->query('SELECT @@character_set_connection AS _charset');
+ $tmp = $stmt->fetch(PDO::FETCH_ASSOC);
+ if ($tmp['_charset'] != $charset)
+ printf("[028] Character sets has not been set, @@character_set_connection reports '%s', expecting '%s'",
+ $tmp['_charset'], $charset);
+ } catch (PDOException $e) {
+ printf("[029] DSN=%s, %s\n", $dsn, $e->getMessage());
+ }
+ } else {
+ printf("[030] You're trying to run the tests with charset '%s' which seems not supported by the server!", $charset);
+ }
+
+ }
+
+ }
+
+ if ($have_charset_support) {
+ // In case the PDO_MYSQL_TEST_CHARSET interferes with any defaults
+ // we do another test to verify that the charset has been set.
+ $dsn = MySQLPDOTest::getDSN();
+ $db = new PDO($dsn, $user, $pass);
+ $stmt = $db->query('SHOW CHARACTER SET LIKE "latin1"');
+ $tmp = $stmt->fetch(PDO::FETCH_ASSOC);
+ $have_latin1 =(empty($tmp)) ? false : true;
+ $stmt = $db->query('SHOW CHARACTER SET LIKE "latin2"');
+ $tmp = $stmt->fetch(PDO::FETCH_ASSOC);
+ $have_latin2 =(empty($tmp)) ? false : true;
+
+ if ($have_latin1 && $have_latin2) {
+ // very likely we do have both of them...
+ try {
+ $dsn = MySQLPDOTest::getDSN(array('charset' => 'latin1'));
+ $db = new PDO($dsn, $user, $pass);
+ $stmt = $db->query('SELECT @@character_set_connection AS _charset');
+ $tmp = $stmt->fetch(PDO::FETCH_ASSOC);
+ if ($tmp['_charset'] != 'latin1')
+ printf("[031] DSN = %s, Character sets has not been set, @@character_set_connection reports '%s', expecting '%s'",
+ $dsn, $tmp['_charset'], 'latin1');
+
+ } catch (PDOException $e) {
+ printf("[032] %s\n", $e->getMessage());
+ }
+
+ try {
+ $dsn = MySQLPDOTest::getDSN(array('charset' => 'latin2'));
+ $db = new PDO($dsn, $user, $pass);
+ $stmt = $db->query('SELECT @@character_set_connection AS _charset');
+ $tmp = $stmt->fetch(PDO::FETCH_ASSOC);
+ if ($tmp['_charset'] != 'latin2')
+ printf("[033] DSN = %s, character sets has not been set, @@character_set_connection reports '%s', expecting '%s'",
+ $dsn, $tmp['_charset'], 'latin2');
+
+ } catch (PDOException $e) {
+ printf("[034] %s\n", $e->getMessage());
+ }
+
+ }
+ }
+
+ } catch (PDOException $e) {
+ printf("[001] %s, [%s] %s\n",
+ $e->getMessage(),
+ (is_object($db)) ? $db->errorCode() : 'n/a',
+ (is_object($db)) ? implode(' ', $db->errorInfo()) : 'n/a');
+ }
+
+ print "done!";
?>
--EXPECTF--
[002] invalid data source name, [n/a] n/a
diff --git a/ext/pdo_mysql/tests/pdo_mysql___construct_ini.phpt b/ext/pdo_mysql/tests/pdo_mysql___construct_ini.phpt
index a03ad7f324..985179b84c 100644
--- a/ext/pdo_mysql/tests/pdo_mysql___construct_ini.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql___construct_ini.phpt
@@ -13,43 +13,43 @@ if (getenv('PDO_MYSQL_TEST_DSN') !== "mysql:dbname=phptest;unix_socket=/tmp/mysq
pdo.dsn.mysql="mysql:dbname=phptest;socket=/tmp/mysql.sock"
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
-
- $found = false;
- $values = ini_get_all();
- foreach ($values as $name => $dsn)
- if ('pdo.dsn.mysql' == $name) {
- printf("pdo.dsn.mysql=%s\n", $dsn);
- $found = true;
- break;
- }
-
- if (!$found) {
- $dsn = ini_get('pdo.dsn.mysql');
- $found = ($dsn !== false);
- }
-
- if (!$found)
- printf("pdo.dsn.mysql cannot be accessed through ini_get_all()/ini_get()\n");
-
- if (MySQLPDOTest::getDSN() == $dsn) {
- // we are lucky, we can run the test
- try {
-
- $user = PDO_MYSQL_TEST_USER;
- $pass = PDO_MYSQL_TEST_PASS;
- $db = new PDO('mysql', $user, $pass);
-
- } catch (PDOException $e) {
- printf("[001] %s, [%s] %s\n",
- $e->getMessage(),
- (is_object($db)) ? $db->errorCode() : 'n/a',
- (is_object($db)) ? implode(' ', $db->errorInfo()) : 'n/a');
- }
-
- }
-
- print "done!";
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+
+ $found = false;
+ $values = ini_get_all();
+ foreach ($values as $name => $dsn)
+ if ('pdo.dsn.mysql' == $name) {
+ printf("pdo.dsn.mysql=%s\n", $dsn);
+ $found = true;
+ break;
+ }
+
+ if (!$found) {
+ $dsn = ini_get('pdo.dsn.mysql');
+ $found = ($dsn !== false);
+ }
+
+ if (!$found)
+ printf("pdo.dsn.mysql cannot be accessed through ini_get_all()/ini_get()\n");
+
+ if (MySQLPDOTest::getDSN() == $dsn) {
+ // we are lucky, we can run the test
+ try {
+
+ $user = PDO_MYSQL_TEST_USER;
+ $pass = PDO_MYSQL_TEST_PASS;
+ $db = new PDO('mysql', $user, $pass);
+
+ } catch (PDOException $e) {
+ printf("[001] %s, [%s] %s\n",
+ $e->getMessage(),
+ (is_object($db)) ? $db->errorCode() : 'n/a',
+ (is_object($db)) ? implode(' ', $db->errorInfo()) : 'n/a');
+ }
+
+ }
+
+ print "done!";
?>
--EXPECT--
pdo.dsn.mysql cannot be accessed through ini_get_all()/ini_get()
diff --git a/ext/pdo_mysql/tests/pdo_mysql___construct_options.phpt b/ext/pdo_mysql/tests/pdo_mysql___construct_options.phpt
index b7a52127c5..ac5f7f6911 100644
--- a/ext/pdo_mysql/tests/pdo_mysql___construct_options.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql___construct_options.phpt
@@ -8,160 +8,160 @@ MySQLPDOTest::skip();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
-
- function set_option_and_check($offset, $option, $value, $option_desc) {
-
- $dsn = MySQLPDOTest::getDSN();
- $user = PDO_MYSQL_TEST_USER;
- $pass = PDO_MYSQL_TEST_PASS;
-
- try {
- $db = new PDO($dsn, $user, $pass, array($option => $value));
- if (!is_object($db) || ($value !== ($tmp = @$db->getAttribute($option))))
- printf("[%03d] Expecting '%s'/%s got '%s'/%s' for options '%s'\n",
- $offset,
- $value, gettype($value),
- $tmp, gettype($tmp),
- $option_desc);
- } catch (PDOException $e) {
- printf("[%03d] %s\n", $offset, $e->getMessage());
- }
-
- }
-
- try {
-
- $dsn = MySQLPDOTest::getDSN();
- $user = PDO_MYSQL_TEST_USER;
- $pass = PDO_MYSQL_TEST_PASS;
-
- $valid_options = array(
- /* pdo_dbh.c */
- PDO::ATTR_PERSISTENT => 'PDO::ATTR_PERSISTENT',
- PDO::ATTR_AUTOCOMMIT => 'PDO::ATTR_AUTOCOMMIT',
- /* mysql_driver.c */
- /* TODO Possible bug PDO::ATTR_TIMEOUT != MYSQLI_OPT_CONNECT_TIMEOUT*/
- PDO::ATTR_TIMEOUT => 'PDO::ATTR_TIMEOUT',
- PDO::ATTR_EMULATE_PREPARES => 'PDO::ATTR_EMULATE_PREPARES',
-
- PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => 'PDO::MYSQL_ATTR_USE_BUFFERED_QUERY',
- PDO::MYSQL_ATTR_LOCAL_INFILE => 'PDO::MYSQL_ATTR_LOCAL_INFILE',
- PDO::MYSQL_ATTR_DIRECT_QUERY => 'PDO::MYSQL_ATTR_DIRECT_QUERY',
-
- PDO::MYSQL_ATTR_INIT_COMMAND => 'PDO::MYSQL_ATTR_INIT_COMMAND',
- PDO::ATTR_EMULATE_PREPARES => 'PDO::ATTR_EMULATE_PREPARES',
- );
-
- $defaults = array(
- PDO::ATTR_PERSISTENT => false,
- PDO::ATTR_AUTOCOMMIT => 1,
- /* TODO - why is this a valid option if getAttribute() does not support it?! */
- PDO::ATTR_TIMEOUT => false,
- PDO::ATTR_EMULATE_PREPARES => 1,
- PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => 1,
- /* TODO getAttribute() does not handle it */
- PDO::MYSQL_ATTR_LOCAL_INFILE => false,
- /* TODO getAttribute() does not handle it */
- PDO::MYSQL_ATTR_DIRECT_QUERY => 1,
- PDO::MYSQL_ATTR_INIT_COMMAND => '',
- );
-
- try {
- if (NULL !== ($db = @new PDO($dsn, $user, $pass, 'wrong type')))
- printf("[001] Expecting NULL got %s/%s\n", gettype($db), $db);
- } catch (TypeError $e) {
- }
-
- if (!is_object($db = new PDO($dsn, $user, $pass, array())))
- printf("[002] Expecting object got %s/%s¸\n", gettype($db), $db);
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+
+ function set_option_and_check($offset, $option, $value, $option_desc) {
+
+ $dsn = MySQLPDOTest::getDSN();
+ $user = PDO_MYSQL_TEST_USER;
+ $pass = PDO_MYSQL_TEST_PASS;
+
+ try {
+ $db = new PDO($dsn, $user, $pass, array($option => $value));
+ if (!is_object($db) || ($value !== ($tmp = @$db->getAttribute($option))))
+ printf("[%03d] Expecting '%s'/%s got '%s'/%s' for options '%s'\n",
+ $offset,
+ $value, gettype($value),
+ $tmp, gettype($tmp),
+ $option_desc);
+ } catch (PDOException $e) {
+ printf("[%03d] %s\n", $offset, $e->getMessage());
+ }
+
+ }
+
+ try {
+
+ $dsn = MySQLPDOTest::getDSN();
+ $user = PDO_MYSQL_TEST_USER;
+ $pass = PDO_MYSQL_TEST_PASS;
+
+ $valid_options = array(
+ /* pdo_dbh.c */
+ PDO::ATTR_PERSISTENT => 'PDO::ATTR_PERSISTENT',
+ PDO::ATTR_AUTOCOMMIT => 'PDO::ATTR_AUTOCOMMIT',
+ /* mysql_driver.c */
+ /* TODO Possible bug PDO::ATTR_TIMEOUT != MYSQLI_OPT_CONNECT_TIMEOUT*/
+ PDO::ATTR_TIMEOUT => 'PDO::ATTR_TIMEOUT',
+ PDO::ATTR_EMULATE_PREPARES => 'PDO::ATTR_EMULATE_PREPARES',
+
+ PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => 'PDO::MYSQL_ATTR_USE_BUFFERED_QUERY',
+ PDO::MYSQL_ATTR_LOCAL_INFILE => 'PDO::MYSQL_ATTR_LOCAL_INFILE',
+ PDO::MYSQL_ATTR_DIRECT_QUERY => 'PDO::MYSQL_ATTR_DIRECT_QUERY',
+
+ PDO::MYSQL_ATTR_INIT_COMMAND => 'PDO::MYSQL_ATTR_INIT_COMMAND',
+ PDO::ATTR_EMULATE_PREPARES => 'PDO::ATTR_EMULATE_PREPARES',
+ );
+
+ $defaults = array(
+ PDO::ATTR_PERSISTENT => false,
+ PDO::ATTR_AUTOCOMMIT => 1,
+ /* TODO - why is this a valid option if getAttribute() does not support it?! */
+ PDO::ATTR_TIMEOUT => false,
+ PDO::ATTR_EMULATE_PREPARES => 1,
+ PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => 1,
+ /* TODO getAttribute() does not handle it */
+ PDO::MYSQL_ATTR_LOCAL_INFILE => false,
+ /* TODO getAttribute() does not handle it */
+ PDO::MYSQL_ATTR_DIRECT_QUERY => 1,
+ PDO::MYSQL_ATTR_INIT_COMMAND => '',
+ );
+
+ try {
+ if (NULL !== ($db = @new PDO($dsn, $user, $pass, 'wrong type')))
+ printf("[001] Expecting NULL got %s/%s\n", gettype($db), $db);
+ } catch (TypeError $e) {
+ }
+
+ if (!is_object($db = new PDO($dsn, $user, $pass, array())))
+ printf("[002] Expecting object got %s/%s¸\n", gettype($db), $db);
$invalid = 999;
- if (is_object($db = new PDO($dsn, $user, $pass, array($invalid => true))))
- printf("[003] [TODO][CHANGEREQUEST] Please, lets not ignore invalid options and bail out!\n");
-
- $db = new PDO($dsn, $user, $pass);
- foreach ($valid_options as $option => $name) {
- /* TODO getAttribute() is pretty poor in supporting the options, suppress errors */
- $tmp = @$db->getAttribute($option);
- if ($tmp !== $defaults[$option])
- printf("[003a] Expecting default value for '%s' of '%s'/%s, getAttribute() reports setting '%s'/%s\n",
- $name, $defaults[$option], gettype($defaults[$option]),
- $tmp, gettype($tmp));
- }
-
- $db = new PDO($dsn, $user, $pass, array(PDO::ATTR_AUTOCOMMIT => true));
- if (!is_object($db) || !$db->getAttribute(PDO::ATTR_AUTOCOMMIT))
- printf("[004] Autocommit should be on\n");
-
- $db = new PDO($dsn, $user, $pass, array(PDO::ATTR_AUTOCOMMIT => false));
- if (!is_object($db) || $db->getAttribute(PDO::ATTR_AUTOCOMMIT))
- printf("[005] Autocommit should be off\n");
-
- /* TODO: no way to check ATTR_TIMEOUT settings */
- if (!is_object($db = new PDO($dsn, $user, $pass, array(PDO::ATTR_TIMEOUT => 10))))
- printf("[006] ATTR_TIMEOUT should be accepted\n");
-
- if (!is_object($db = new PDO($dsn, $user, $pass, array(PDO::ATTR_TIMEOUT => PHP_INT_MAX))))
- printf("[007] ATTR_TIMEOUT should be accepted\n");
-
- if (!is_object($db = new PDO($dsn, $user, $pass, array(PDO::ATTR_TIMEOUT => -PHP_INT_MAX))))
- printf("[008] ATTR_TIMEOUT should be accepted\n");
-
- /* TODO: Its ugly that PDO::ATTR_EMULATE_PREPARES == PDO::MYSQL_ATTR_DIRECT_QUERY */
- $db = new PDO($dsn, $user, $pass, array(PDO::ATTR_EMULATE_PREPARES => true));
- if (!is_object($db))
- printf("[009] ATTR_EMULATE_PREPARES should be accepted and on\n");
- if (!$db->getAttribute(PDO::ATTR_EMULATE_PREPARES))
- printf("[010] [TODO][CHANGEREQUEST] ATTR_EMULATE_PREPARES should be on\n");
- if (!$db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
- printf("[011] As PDO::MYSQL_ATTR_DIRECT_QUERY == PDO::ATTR_EMULATE_PREPARES
- and PDO::ATTR_EMULATE_PREPARES overrules the other, PDO::MYSQL_ATTR_DIRECT_QUERY should be on\n");
-
- $db = new PDO($dsn, $user, $pass, array(PDO::ATTR_EMULATE_PREPARES => false));
- if (!is_object($db))
- printf("[012] ATTR_EMULATE_PREPARES should be accepted and on\n");
- if ($db->getAttribute(PDO::ATTR_EMULATE_PREPARES))
- printf("[013] [TODO][CHANGEREQUEST] ATTR_EMULATE_PREPARES should be off\n");
- if ($db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
- printf("[014] As PDO::MYSQL_ATTR_DIRECT_QUERY == PDO::ATTR_EMULATE_PREPARES
- and PDO::ATTR_EMULATE_PREPARES overrules the other, PDO::MYSQL_ATTR_DIRECT_QUERY should be off\n");
-
- // PDO::ATTR_EMULATE_PREPARES overrules PDO::MYSQL_ATTR_DIRECT_QUERY
- // TODO: is it clever that a generic setting overrules a specific setting?
- $db = new PDO($dsn, $user, $pass, array(PDO::ATTR_EMULATE_PREPARES => true, PDO::MYSQL_ATTR_DIRECT_QUERY => false));
- if (!$db->getAttribute(PDO::ATTR_EMULATE_PREPARES))
- printf("[015] PDO::ATTR_EMULATE_PREPARES should be on\n");
- if (!$db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
- printf("[016] PDO::MYSQL_ATTR_DIRECT_QUERY should be on\n");
-
- $db = new PDO($dsn, $user, $pass, array(PDO::ATTR_EMULATE_PREPARES => false, PDO::MYSQL_ATTR_DIRECT_QUERY => true));
- if ($db->getAttribute(PDO::ATTR_EMULATE_PREPARES))
- printf("[017] PDO::ATTR_EMULATE_PREPARES should be off\n");
- if ($db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
- printf("[018] PDO::MYSQL_ATTR_DIRECT_QUERY should be off\n");
-
- set_option_and_check(19, PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 1, 'PDO::MYSQL_ATTR_USE_BUFFERED_QUERY');
- set_option_and_check(20, PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 0, 'PDO::MYSQL_ATTR_USE_BUFFERED_QUERY');
-
- set_option_and_check(21, PDO::MYSQL_ATTR_LOCAL_INFILE, true, 'PDO::MYSQL_ATTR_LOCAL_INFILE');
- set_option_and_check(22, PDO::MYSQL_ATTR_LOCAL_INFILE, false, 'PDO::MYSQL_ATTR_LOCAL_INFILE');
-
- set_option_and_check(23, PDO::MYSQL_ATTR_INIT_COMMAND, 'SET @a=1', 'PDO::MYSQL_ATTR_INIT_COMMAND');
- set_option_and_check(24, PDO::MYSQL_ATTR_INIT_COMMAND, '', 'PDO::MYSQL_ATTR_INIT_COMMAND');
- set_option_and_check(25, PDO::MYSQL_ATTR_INIT_COMMAND, 'INSERT INTO nonexistent(invalid) VALUES (1)', 'PDO::MYSQL_ATTR_INIT_COMMAND');
-
- set_option_and_check(33, PDO::MYSQL_ATTR_DIRECT_QUERY, 1, 'PDO::MYSQL_ATTR_DIRECT_QUERY');
- set_option_and_check(34, PDO::MYSQL_ATTR_DIRECT_QUERY, 0, 'PDO::MYSQL_ATTR_DIRECT_QUERY');
-
- } catch (PDOException $e) {
- printf("[001] %s, [%s] %s\n",
- $e->getMessage(),
- (is_object($db)) ? $db->errorCode() : 'n/a',
- (is_object($db)) ? implode(' ', $db->errorInfo()) : 'n/a');
- }
-
- print "done!";
+ if (is_object($db = new PDO($dsn, $user, $pass, array($invalid => true))))
+ printf("[003] [TODO][CHANGEREQUEST] Please, lets not ignore invalid options and bail out!\n");
+
+ $db = new PDO($dsn, $user, $pass);
+ foreach ($valid_options as $option => $name) {
+ /* TODO getAttribute() is pretty poor in supporting the options, suppress errors */
+ $tmp = @$db->getAttribute($option);
+ if ($tmp !== $defaults[$option])
+ printf("[003a] Expecting default value for '%s' of '%s'/%s, getAttribute() reports setting '%s'/%s\n",
+ $name, $defaults[$option], gettype($defaults[$option]),
+ $tmp, gettype($tmp));
+ }
+
+ $db = new PDO($dsn, $user, $pass, array(PDO::ATTR_AUTOCOMMIT => true));
+ if (!is_object($db) || !$db->getAttribute(PDO::ATTR_AUTOCOMMIT))
+ printf("[004] Autocommit should be on\n");
+
+ $db = new PDO($dsn, $user, $pass, array(PDO::ATTR_AUTOCOMMIT => false));
+ if (!is_object($db) || $db->getAttribute(PDO::ATTR_AUTOCOMMIT))
+ printf("[005] Autocommit should be off\n");
+
+ /* TODO: no way to check ATTR_TIMEOUT settings */
+ if (!is_object($db = new PDO($dsn, $user, $pass, array(PDO::ATTR_TIMEOUT => 10))))
+ printf("[006] ATTR_TIMEOUT should be accepted\n");
+
+ if (!is_object($db = new PDO($dsn, $user, $pass, array(PDO::ATTR_TIMEOUT => PHP_INT_MAX))))
+ printf("[007] ATTR_TIMEOUT should be accepted\n");
+
+ if (!is_object($db = new PDO($dsn, $user, $pass, array(PDO::ATTR_TIMEOUT => -PHP_INT_MAX))))
+ printf("[008] ATTR_TIMEOUT should be accepted\n");
+
+ /* TODO: Its ugly that PDO::ATTR_EMULATE_PREPARES == PDO::MYSQL_ATTR_DIRECT_QUERY */
+ $db = new PDO($dsn, $user, $pass, array(PDO::ATTR_EMULATE_PREPARES => true));
+ if (!is_object($db))
+ printf("[009] ATTR_EMULATE_PREPARES should be accepted and on\n");
+ if (!$db->getAttribute(PDO::ATTR_EMULATE_PREPARES))
+ printf("[010] [TODO][CHANGEREQUEST] ATTR_EMULATE_PREPARES should be on\n");
+ if (!$db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
+ printf("[011] As PDO::MYSQL_ATTR_DIRECT_QUERY == PDO::ATTR_EMULATE_PREPARES
+ and PDO::ATTR_EMULATE_PREPARES overrules the other, PDO::MYSQL_ATTR_DIRECT_QUERY should be on\n");
+
+ $db = new PDO($dsn, $user, $pass, array(PDO::ATTR_EMULATE_PREPARES => false));
+ if (!is_object($db))
+ printf("[012] ATTR_EMULATE_PREPARES should be accepted and on\n");
+ if ($db->getAttribute(PDO::ATTR_EMULATE_PREPARES))
+ printf("[013] [TODO][CHANGEREQUEST] ATTR_EMULATE_PREPARES should be off\n");
+ if ($db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
+ printf("[014] As PDO::MYSQL_ATTR_DIRECT_QUERY == PDO::ATTR_EMULATE_PREPARES
+ and PDO::ATTR_EMULATE_PREPARES overrules the other, PDO::MYSQL_ATTR_DIRECT_QUERY should be off\n");
+
+ // PDO::ATTR_EMULATE_PREPARES overrules PDO::MYSQL_ATTR_DIRECT_QUERY
+ // TODO: is it clever that a generic setting overrules a specific setting?
+ $db = new PDO($dsn, $user, $pass, array(PDO::ATTR_EMULATE_PREPARES => true, PDO::MYSQL_ATTR_DIRECT_QUERY => false));
+ if (!$db->getAttribute(PDO::ATTR_EMULATE_PREPARES))
+ printf("[015] PDO::ATTR_EMULATE_PREPARES should be on\n");
+ if (!$db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
+ printf("[016] PDO::MYSQL_ATTR_DIRECT_QUERY should be on\n");
+
+ $db = new PDO($dsn, $user, $pass, array(PDO::ATTR_EMULATE_PREPARES => false, PDO::MYSQL_ATTR_DIRECT_QUERY => true));
+ if ($db->getAttribute(PDO::ATTR_EMULATE_PREPARES))
+ printf("[017] PDO::ATTR_EMULATE_PREPARES should be off\n");
+ if ($db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
+ printf("[018] PDO::MYSQL_ATTR_DIRECT_QUERY should be off\n");
+
+ set_option_and_check(19, PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 1, 'PDO::MYSQL_ATTR_USE_BUFFERED_QUERY');
+ set_option_and_check(20, PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 0, 'PDO::MYSQL_ATTR_USE_BUFFERED_QUERY');
+
+ set_option_and_check(21, PDO::MYSQL_ATTR_LOCAL_INFILE, true, 'PDO::MYSQL_ATTR_LOCAL_INFILE');
+ set_option_and_check(22, PDO::MYSQL_ATTR_LOCAL_INFILE, false, 'PDO::MYSQL_ATTR_LOCAL_INFILE');
+
+ set_option_and_check(23, PDO::MYSQL_ATTR_INIT_COMMAND, 'SET @a=1', 'PDO::MYSQL_ATTR_INIT_COMMAND');
+ set_option_and_check(24, PDO::MYSQL_ATTR_INIT_COMMAND, '', 'PDO::MYSQL_ATTR_INIT_COMMAND');
+ set_option_and_check(25, PDO::MYSQL_ATTR_INIT_COMMAND, 'INSERT INTO nonexistent(invalid) VALUES (1)', 'PDO::MYSQL_ATTR_INIT_COMMAND');
+
+ set_option_and_check(33, PDO::MYSQL_ATTR_DIRECT_QUERY, 1, 'PDO::MYSQL_ATTR_DIRECT_QUERY');
+ set_option_and_check(34, PDO::MYSQL_ATTR_DIRECT_QUERY, 0, 'PDO::MYSQL_ATTR_DIRECT_QUERY');
+
+ } catch (PDOException $e) {
+ printf("[001] %s, [%s] %s\n",
+ $e->getMessage(),
+ (is_object($db)) ? $db->errorCode() : 'n/a',
+ (is_object($db)) ? implode(' ', $db->errorInfo()) : 'n/a');
+ }
+
+ print "done!";
?>
--EXPECTF--
[003] [TODO][CHANGEREQUEST] Please, lets not ignore invalid options and bail out!
diff --git a/ext/pdo_mysql/tests/pdo_mysql___construct_options_libmysql.phpt b/ext/pdo_mysql/tests/pdo_mysql___construct_options_libmysql.phpt
index d01ef0a69a..99754c9058 100644
--- a/ext/pdo_mysql/tests/pdo_mysql___construct_options_libmysql.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql___construct_options_libmysql.phpt
@@ -10,74 +10,74 @@ if (MySQLPDOTest::isPDOMySQLnd())
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- function set_option_and_check($offset, $option, $value, $option_desc, $ignore_diff = false) {
+ function set_option_and_check($offset, $option, $value, $option_desc, $ignore_diff = false) {
- $dsn = MySQLPDOTest::getDSN();
- $user = PDO_MYSQL_TEST_USER;
- $pass = PDO_MYSQL_TEST_PASS;
+ $dsn = MySQLPDOTest::getDSN();
+ $user = PDO_MYSQL_TEST_USER;
+ $pass = PDO_MYSQL_TEST_PASS;
- try {
- $db = new PDO($dsn, $user, $pass, array($option => $value));
- if (!is_object($db) || (!$ignore_diff && ($value !== ($tmp = @$db->getAttribute($option)))))
- printf("[%03d] Execting '%s'/%s got '%s'/%s' for options '%s'\n",
- $offset,
- $value, gettype($value),
- $tmp, gettype($tmp),
- $option_desc);
- } catch (PDOException $e) {
- printf("[%03d] %s\n", $offset, $e->getMessage());
- }
+ try {
+ $db = new PDO($dsn, $user, $pass, array($option => $value));
+ if (!is_object($db) || (!$ignore_diff && ($value !== ($tmp = @$db->getAttribute($option)))))
+ printf("[%03d] Expecting '%s'/%s got '%s'/%s' for options '%s'\n",
+ $offset,
+ $value, gettype($value),
+ $tmp, gettype($tmp),
+ $option_desc);
+ } catch (PDOException $e) {
+ printf("[%03d] %s\n", $offset, $e->getMessage());
+ }
- }
+ }
- try {
+ try {
- $dsn = MySQLPDOTest::getDSN();
- $user = PDO_MYSQL_TEST_USER;
- $pass = PDO_MYSQL_TEST_PASS;
+ $dsn = MySQLPDOTest::getDSN();
+ $user = PDO_MYSQL_TEST_USER;
+ $pass = PDO_MYSQL_TEST_PASS;
- $valid_options = array();
- $valid_options[PDO::MYSQL_ATTR_MAX_BUFFER_SIZE] = 'PDO::MYSQL_ATTR_MAX_BUFFER_SIZE';
- $valid_options[PDO::MYSQL_ATTR_INIT_COMMAND] = 'PDO::MYSQL_ATTR_INIT_COMMAND';
- $valid_options[PDO::MYSQL_ATTR_READ_DEFAULT_FILE] = 'PDO::MYSQL_ATTR_READ_DEFAULT_FILE';
- $valid_options[PDO::MYSQL_ATTR_READ_DEFAULT_GROUP] = 'PDO::MYSQL_ATTR_READ_DEFAULT_GROUP';
+ $valid_options = array();
+ $valid_options[PDO::MYSQL_ATTR_MAX_BUFFER_SIZE] = 'PDO::MYSQL_ATTR_MAX_BUFFER_SIZE';
+ $valid_options[PDO::MYSQL_ATTR_INIT_COMMAND] = 'PDO::MYSQL_ATTR_INIT_COMMAND';
+ $valid_options[PDO::MYSQL_ATTR_READ_DEFAULT_FILE] = 'PDO::MYSQL_ATTR_READ_DEFAULT_FILE';
+ $valid_options[PDO::MYSQL_ATTR_READ_DEFAULT_GROUP] = 'PDO::MYSQL_ATTR_READ_DEFAULT_GROUP';
- $defaults[PDO::MYSQL_ATTR_MAX_BUFFER_SIZE] = 1048576;
- /* TODO getAttribute() does not handle it */
- $defaults[PDO::MYSQL_ATTR_INIT_COMMAND] = '';
- $defaults[PDO::MYSQL_ATTR_READ_DEFAULT_FILE] = false;
- $defaults[PDO::MYSQL_ATTR_READ_DEFAULT_GROUP] = false;
+ $defaults[PDO::MYSQL_ATTR_MAX_BUFFER_SIZE] = 1048576;
+ /* TODO getAttribute() does not handle it */
+ $defaults[PDO::MYSQL_ATTR_INIT_COMMAND] = '';
+ $defaults[PDO::MYSQL_ATTR_READ_DEFAULT_FILE] = false;
+ $defaults[PDO::MYSQL_ATTR_READ_DEFAULT_GROUP] = false;
- $db = new PDO($dsn, $user, $pass);
- foreach ($valid_options as $option => $name) {
- /* TODO getAttribute() is pretty poor in supporting the options, suppress errors */
- $tmp = @$db->getAttribute($option);
- if ($tmp !== $defaults[$option])
- printf("[001] Expecting default value for '%s' of '%s'/%s, getAttribute() reports setting '%s'/%s\n",
- $name, $defaults[$option], gettype($defaults[$option]),
- $tmp, gettype($tmp));
- }
+ $db = new PDO($dsn, $user, $pass);
+ foreach ($valid_options as $option => $name) {
+ /* TODO getAttribute() is pretty poor in supporting the options, suppress errors */
+ $tmp = @$db->getAttribute($option);
+ if ($tmp !== $defaults[$option])
+ printf("[001] Expecting default value for '%s' of '%s'/%s, getAttribute() reports setting '%s'/%s\n",
+ $name, $defaults[$option], gettype($defaults[$option]),
+ $tmp, gettype($tmp));
+ }
- set_option_and_check(26, PDO::MYSQL_ATTR_READ_DEFAULT_FILE, true, 'PDO::MYSQL_ATTR_READ_DEFAULT_FILE');
- set_option_and_check(27, PDO::MYSQL_ATTR_READ_DEFAULT_FILE, false, 'PDO::MYSQL_ATTR_READ_DEFAULT_FILE');
+ set_option_and_check(26, PDO::MYSQL_ATTR_READ_DEFAULT_FILE, true, 'PDO::MYSQL_ATTR_READ_DEFAULT_FILE');
+ set_option_and_check(27, PDO::MYSQL_ATTR_READ_DEFAULT_FILE, false, 'PDO::MYSQL_ATTR_READ_DEFAULT_FILE');
- set_option_and_check(30, PDO::MYSQL_ATTR_MAX_BUFFER_SIZE, -1, 'PDO::MYSQL_ATTR_MAX_BUFFER_SIZE', true);
- set_option_and_check(31, PDO::MYSQL_ATTR_MAX_BUFFER_SIZE, PHP_INT_MAX, 'PDO::MYSQL_ATTR_MAX_BUFFER_SIZE');
- set_option_and_check(32, PDO::MYSQL_ATTR_MAX_BUFFER_SIZE, 1, 'PDO::MYSQL_ATTR_MAX_BUFFER_SIZE');
+ set_option_and_check(30, PDO::MYSQL_ATTR_MAX_BUFFER_SIZE, -1, 'PDO::MYSQL_ATTR_MAX_BUFFER_SIZE', true);
+ set_option_and_check(31, PDO::MYSQL_ATTR_MAX_BUFFER_SIZE, PHP_INT_MAX, 'PDO::MYSQL_ATTR_MAX_BUFFER_SIZE');
+ set_option_and_check(32, PDO::MYSQL_ATTR_MAX_BUFFER_SIZE, 1, 'PDO::MYSQL_ATTR_MAX_BUFFER_SIZE');
- } catch (PDOException $e) {
- printf("[001] %s, [%s] %s\n",
- $e->getMessage(),
- (is_object($db)) ? $db->errorCode() : 'n/a',
- (is_object($db)) ? implode(' ', $db->errorInfo()) : 'n/a');
- }
+ } catch (PDOException $e) {
+ printf("[001] %s, [%s] %s\n",
+ $e->getMessage(),
+ (is_object($db)) ? $db->errorCode() : 'n/a',
+ (is_object($db)) ? implode(' ', $db->errorInfo()) : 'n/a');
+ }
- print "done!";
+ print "done!";
?>
--EXPECT--
[001] Expecting default value for 'PDO::MYSQL_ATTR_INIT_COMMAND' of ''/string, getAttribute() reports setting ''/boolean
-[026] Execting '1'/boolean got ''/boolean' for options 'PDO::MYSQL_ATTR_READ_DEFAULT_FILE'
+[026] Expecting '1'/boolean got ''/boolean' for options 'PDO::MYSQL_ATTR_READ_DEFAULT_FILE'
done!
diff --git a/ext/pdo_mysql/tests/pdo_mysql___construct_uri.phpt b/ext/pdo_mysql/tests/pdo_mysql___construct_uri.phpt
index 7418033768..8d51961c9d 100644
--- a/ext/pdo_mysql/tests/pdo_mysql___construct_uri.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql___construct_uri.phpt
@@ -8,68 +8,68 @@ MySQLPDOTest::skip();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- try {
+ try {
- if ($tmp = MySQLPDOTest::getTempDir()) {
+ if ($tmp = MySQLPDOTest::getTempDir()) {
- $file = $tmp . DIRECTORY_SEPARATOR . 'pdomuri.tst';
- $dsn = MySQLPDOTest::getDSN();
- $user = PDO_MYSQL_TEST_USER;
- $pass = PDO_MYSQL_TEST_PASS;
- $uri = sprintf('uri:file://%s', (substr(PHP_OS, 0, 3) == 'WIN' ? str_replace('\\', '/', $file) : $file));
+ $file = $tmp . DIRECTORY_SEPARATOR . 'pdomuri.tst';
+ $dsn = MySQLPDOTest::getDSN();
+ $user = PDO_MYSQL_TEST_USER;
+ $pass = PDO_MYSQL_TEST_PASS;
+ $uri = sprintf('uri:file://%s', (substr(PHP_OS, 0, 3) == 'WIN' ? str_replace('\\', '/', $file) : $file));
- if ($fp = @fopen($file, 'w')) {
- // ok, great we can create a file with a DSN in it
- fwrite($fp, $dsn);
- fclose($fp);
- clearstatcache();
- assert(file_exists($file));
- try {
- $db = new PDO($uri, $user, $pass);
- } catch (PDOException $e) {
- printf("[002] URI=%s, DSN=%s, File=%s (%d bytes, '%s'), %s\n",
- $uri, $dsn,
- $file, filesize($file), file_get_contents($file),
- $e->getMessage());
- }
- unlink($file);
- }
+ if ($fp = @fopen($file, 'w')) {
+ // ok, great we can create a file with a DSN in it
+ fwrite($fp, $dsn);
+ fclose($fp);
+ clearstatcache();
+ assert(file_exists($file));
+ try {
+ $db = new PDO($uri, $user, $pass);
+ } catch (PDOException $e) {
+ printf("[002] URI=%s, DSN=%s, File=%s (%d bytes, '%s'), %s\n",
+ $uri, $dsn,
+ $file, filesize($file), file_get_contents($file),
+ $e->getMessage());
+ }
+ unlink($file);
+ }
- if ($fp = @fopen($file, 'w')) {
- fwrite($fp, sprintf('mysql:dbname=letshopeinvalid;%s%s',
- chr(0), $dsn));
- fclose($fp);
- clearstatcache();
- assert(file_exists($file));
- try {
- $db = new PDO($uri, $user, $pass);
- } catch (PDOException $e) {
- $expected = array(
- "SQLSTATE[HY000] [1049] Unknown database 'letshopeinvalid'",
- "SQLSTATE[HY000] [2002] No such file or directory"
- );
- printf("[003] URI=%s, DSN=%s, File=%s (%d bytes, '%s'), chr(0) test, %s\n",
- $uri, $dsn,
- $file, filesize($file), file_get_contents($file),
- (in_array($e->getMessage(), $expected) ? 'EXPECTED ERROR' : $e->getMessage()));
- }
- unlink($file);
- }
+ if ($fp = @fopen($file, 'w')) {
+ fwrite($fp, sprintf('mysql:dbname=letshopeinvalid;%s%s',
+ chr(0), $dsn));
+ fclose($fp);
+ clearstatcache();
+ assert(file_exists($file));
+ try {
+ $db = new PDO($uri, $user, $pass);
+ } catch (PDOException $e) {
+ $expected = array(
+ "SQLSTATE[HY000] [1049] Unknown database 'letshopeinvalid'",
+ "SQLSTATE[HY000] [2002] No such file or directory"
+ );
+ printf("[003] URI=%s, DSN=%s, File=%s (%d bytes, '%s'), chr(0) test, %s\n",
+ $uri, $dsn,
+ $file, filesize($file), file_get_contents($file),
+ (in_array($e->getMessage(), $expected) ? 'EXPECTED ERROR' : $e->getMessage()));
+ }
+ unlink($file);
+ }
- }
+ }
- /* TODO: safe mode */
+ /* TODO: safe mode */
- } catch (PDOException $e) {
- printf("[001] %s, [%s] %s\n",
- $e->getMessage(),
- (is_object($db)) ? $db->errorCode() : 'n/a',
- (is_object($db)) ? implode(' ', $db->errorInfo()) : 'n/a');
- }
+ } catch (PDOException $e) {
+ printf("[001] %s, [%s] %s\n",
+ $e->getMessage(),
+ (is_object($db)) ? $db->errorCode() : 'n/a',
+ (is_object($db)) ? implode(' ', $db->errorInfo()) : 'n/a');
+ }
- print "done!";
+ print "done!";
?>
--EXPECTF--
[003] URI=uri:file://%spdomuri.tst, DSN=mysql%sdbname=%s, File=%spdomuri.tst (%d bytes, 'mysql%sdbname=letshopeinvalid%s'), chr(0) test, EXPECTED ERROR
diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_autocommit.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_autocommit.phpt
index 361750260b..0dd8663d08 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_attr_autocommit.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_attr_autocommit.phpt
@@ -9,85 +9,85 @@ $db = MySQLPDOTest::factory();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
- // autocommit should be on by default
- if (1 !== ($tmp = $db->getAttribute(PDO::ATTR_AUTOCOMMIT)))
- printf("[001] Expecting int/1 got %s\n", var_export($tmp, true));
+ // autocommit should be on by default
+ if (1 !== ($tmp = $db->getAttribute(PDO::ATTR_AUTOCOMMIT)))
+ printf("[001] Expecting int/1 got %s\n", var_export($tmp, true));
- // lets see if the server agrees to that
- $row = $db->query('SELECT @@autocommit AS _autocommit')->fetch(PDO::FETCH_ASSOC);
- if (!$row['_autocommit'])
- printf("[002] Server autocommit mode should be on, got '%s'\n", var_export($row['_autocommit']));
+ // lets see if the server agrees to that
+ $row = $db->query('SELECT @@autocommit AS _autocommit')->fetch(PDO::FETCH_ASSOC);
+ if (!$row['_autocommit'])
+ printf("[002] Server autocommit mode should be on, got '%s'\n", var_export($row['_autocommit']));
- // on -> off
- if (!$db->setAttribute(PDO::ATTR_AUTOCOMMIT, 0))
- printf("[003] Cannot turn off autocommit\n");
+ // on -> off
+ if (!$db->setAttribute(PDO::ATTR_AUTOCOMMIT, 0))
+ printf("[003] Cannot turn off autocommit\n");
- $row = $db->query('SELECT @@autocommit AS _autocommit')->fetch(PDO::FETCH_ASSOC);
- if ($row['_autocommit'])
- printf("[004] Server autocommit mode should be off, got '%s'\n", var_export($row['_autocommit']));
+ $row = $db->query('SELECT @@autocommit AS _autocommit')->fetch(PDO::FETCH_ASSOC);
+ if ($row['_autocommit'])
+ printf("[004] Server autocommit mode should be off, got '%s'\n", var_export($row['_autocommit']));
- // PDO thinks autocommit is off, but its manually turned on...
- if (!$db->query('SET autocommit = 1'))
- printf("[005] Cannot turn on server autocommit mode, %s\n", var_export($db->errorInfo(), true));
+ // PDO thinks autocommit is off, but its manually turned on...
+ if (!$db->query('SET autocommit = 1'))
+ printf("[005] Cannot turn on server autocommit mode, %s\n", var_export($db->errorInfo(), true));
- if (0 !== ($tmp = $db->getAttribute(PDO::ATTR_AUTOCOMMIT)))
- printf("[006] Expecting int/0 got %s\n", var_export($tmp, true));
+ if (0 !== ($tmp = $db->getAttribute(PDO::ATTR_AUTOCOMMIT)))
+ printf("[006] Expecting int/0 got %s\n", var_export($tmp, true));
- // off -> on
- if (!$db->query('SET autocommit = 0'))
- printf("[007] Cannot turn off server autocommit mode, %s\n", var_export($db->errorInfo(), true));
+ // off -> on
+ if (!$db->query('SET autocommit = 0'))
+ printf("[007] Cannot turn off server autocommit mode, %s\n", var_export($db->errorInfo(), true));
- if (!$db->setAttribute(PDO::ATTR_AUTOCOMMIT, 1))
- printf("[008] Cannot turn on autocommit\n");
+ if (!$db->setAttribute(PDO::ATTR_AUTOCOMMIT, 1))
+ printf("[008] Cannot turn on autocommit\n");
- $row = $db->query('SELECT @@autocommit AS _autocommit')->fetch(PDO::FETCH_ASSOC);
- if (!$row['_autocommit'])
- printf("[009] Server autocommit mode should be on, got '%s'\n", var_export($row['_autocommit']));
+ $row = $db->query('SELECT @@autocommit AS _autocommit')->fetch(PDO::FETCH_ASSOC);
+ if (!$row['_autocommit'])
+ printf("[009] Server autocommit mode should be on, got '%s'\n", var_export($row['_autocommit']));
- if (1 !== ($tmp = $db->getAttribute(PDO::ATTR_AUTOCOMMIT)))
- printf("[010] Expecting int/1 got %s\n", var_export($tmp, true));
+ if (1 !== ($tmp = $db->getAttribute(PDO::ATTR_AUTOCOMMIT)))
+ printf("[010] Expecting int/1 got %s\n", var_export($tmp, true));
- if (MySQLPDOTest::detect_transactional_mysql_engine($db)) {
- // nice, we have a transactional engine to play with
+ if (MySQLPDOTest::detect_transactional_mysql_engine($db)) {
+ // nice, we have a transactional engine to play with
- MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db));
- $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC);
- $num = $row['_num'];
+ MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db));
+ $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC);
+ $num = $row['_num'];
- $db->query("INSERT INTO test(id, label) VALUES (100, 'z')");
- $num++;
- $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC);
- if ($row['_num'] != $num)
- printf("[011] Insert has failed, test will fail\n");
+ $db->query("INSERT INTO test(id, label) VALUES (100, 'z')");
+ $num++;
+ $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC);
+ if ($row['_num'] != $num)
+ printf("[011] Insert has failed, test will fail\n");
- // autocommit is on, no rollback possible
- $db->query('ROLLBACK');
- $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC);
- if ($row['_num'] != $num)
- printf("[012] ROLLBACK should not have undone anything\n");
+ // autocommit is on, no rollback possible
+ $db->query('ROLLBACK');
+ $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC);
+ if ($row['_num'] != $num)
+ printf("[012] ROLLBACK should not have undone anything\n");
- if (!$db->setAttribute(PDO::ATTR_AUTOCOMMIT, 0))
- printf("[013] Cannot turn off autocommit\n");
+ if (!$db->setAttribute(PDO::ATTR_AUTOCOMMIT, 0))
+ printf("[013] Cannot turn off autocommit\n");
- $db->query('DELETE FROM test WHERE id = 100');
- $db->query('ROLLBACK');
- $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC);
- if ($row['_num'] != $num)
- printf("[014] ROLLBACK should have undone the DELETE\n");
+ $db->query('DELETE FROM test WHERE id = 100');
+ $db->query('ROLLBACK');
+ $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC);
+ if ($row['_num'] != $num)
+ printf("[014] ROLLBACK should have undone the DELETE\n");
- $db->query('DELETE FROM test WHERE id = 100');
- $db->query('COMMIT');
- $num--;
- $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC);
- if ($row['_num'] != $num)
- printf("[015] DELETE should have been committed\n");
+ $db->query('DELETE FROM test WHERE id = 100');
+ $db->query('COMMIT');
+ $num--;
+ $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC);
+ if ($row['_num'] != $num)
+ printf("[015] DELETE should have been committed\n");
- }
+ }
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_case.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_case.phpt
index a011c864c5..2b45154248 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_attr_case.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_attr_case.phpt
@@ -9,80 +9,80 @@ $db = MySQLPDOTest::factory();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
- MySQLPDOTest::createTestTable($db);
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
+ MySQLPDOTest::createTestTable($db);
- $default = $db->getAttribute(PDO::ATTR_CASE);
- $known = array(
- PDO::CASE_LOWER => 'PDO::CASE_LOWER',
- PDO::CASE_UPPER => 'PDO::CASE_UPPER',
- PDO::CASE_NATURAL => 'PDO::CASE_NATURAL'
- );
- if (!isset($known[$default]))
- printf("[001] getAttribute(PDO::ATTR_CASE) returns unknown value '%s'\n",
- var_export($default, true));
- else
- var_dump($known[$default]);
+ $default = $db->getAttribute(PDO::ATTR_CASE);
+ $known = array(
+ PDO::CASE_LOWER => 'PDO::CASE_LOWER',
+ PDO::CASE_UPPER => 'PDO::CASE_UPPER',
+ PDO::CASE_NATURAL => 'PDO::CASE_NATURAL'
+ );
+ if (!isset($known[$default]))
+ printf("[001] getAttribute(PDO::ATTR_CASE) returns unknown value '%s'\n",
+ var_export($default, true));
+ else
+ var_dump($known[$default]);
- // lets see what the default is...
- if (!is_object($stmt = $db->query("SELECT id, id AS 'ID_UPPER', label FROM test ORDER BY id ASC LIMIT 2")))
- printf("[002] %s - %s\n",
- var_export($db->errorInfo(), true), var_export($db->errorCode(), true));
+ // lets see what the default is...
+ if (!is_object($stmt = $db->query("SELECT id, id AS 'ID_UPPER', label FROM test ORDER BY id ASC LIMIT 2")))
+ printf("[002] %s - %s\n",
+ var_export($db->errorInfo(), true), var_export($db->errorCode(), true));
- var_dump($stmt->fetchAll(PDO::FETCH_BOTH));
+ var_dump($stmt->fetchAll(PDO::FETCH_BOTH));
- if (true !== $db->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER))
- printf("[003] Cannot set PDO::ATTR_CASE = PDO::CASE_LOWER, %s - %s\n",
- var_export($db->errorInfo(), true), var_export($db->errorCode(), true));
+ if (true !== $db->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER))
+ printf("[003] Cannot set PDO::ATTR_CASE = PDO::CASE_LOWER, %s - %s\n",
+ var_export($db->errorInfo(), true), var_export($db->errorCode(), true));
- if (($tmp = $db->getAttribute(PDO::ATTR_CASE)) !== PDO::CASE_LOWER)
- printf("[004] getAttribute(PDO::ATTR_CASE) returns wrong value '%s'\n",
- var_export($tmp, true));
+ if (($tmp = $db->getAttribute(PDO::ATTR_CASE)) !== PDO::CASE_LOWER)
+ printf("[004] getAttribute(PDO::ATTR_CASE) returns wrong value '%s'\n",
+ var_export($tmp, true));
- if (true === $db->exec('ALTER TABLE test ADD MiXeD CHAR(1)'))
- printf("[005] Cannot add column %s - %s\n",
- var_export($db->errorInfo(), true), var_export($db->errorCode(), true));
+ if (true === $db->exec('ALTER TABLE test ADD MiXeD CHAR(1)'))
+ printf("[005] Cannot add column %s - %s\n",
+ var_export($db->errorInfo(), true), var_export($db->errorCode(), true));
- if (false === $db->exec('ALTER TABLE test ADD MYUPPER CHAR(1)'))
- printf("[006] Cannot add column %s - %s\n",
- var_export($db->errorInfo(), true), var_export($db->errorCode(), true));
+ if (false === $db->exec('ALTER TABLE test ADD MYUPPER CHAR(1)'))
+ printf("[006] Cannot add column %s - %s\n",
+ var_export($db->errorInfo(), true), var_export($db->errorCode(), true));
- if (!is_object($stmt = $db->query("SELECT id, id AS 'ID_UPPER', label, MiXeD, MYUPPER FROM test ORDER BY id ASC LIMIT 2")))
- printf("[007] %s - %s\n",
- var_export($db->errorInfo(), true), var_export($db->errorCode(), true));
+ if (!is_object($stmt = $db->query("SELECT id, id AS 'ID_UPPER', label, MiXeD, MYUPPER FROM test ORDER BY id ASC LIMIT 2")))
+ printf("[007] %s - %s\n",
+ var_export($db->errorInfo(), true), var_export($db->errorCode(), true));
- var_dump($stmt->fetchAll(PDO::FETCH_BOTH));
+ var_dump($stmt->fetchAll(PDO::FETCH_BOTH));
- if (true !== $db->setAttribute(PDO::ATTR_CASE, PDO::CASE_UPPER))
- printf("[008] Cannot set PDO::ATTR_CASE = PDO::CASE_UPPER %s - %s\n",
- var_export($db->errorInfo(), true), var_export($db->errorCode(), true));
+ if (true !== $db->setAttribute(PDO::ATTR_CASE, PDO::CASE_UPPER))
+ printf("[008] Cannot set PDO::ATTR_CASE = PDO::CASE_UPPER %s - %s\n",
+ var_export($db->errorInfo(), true), var_export($db->errorCode(), true));
- if (($tmp = $db->getAttribute(PDO::ATTR_CASE)) !== PDO::CASE_UPPER)
- printf("[009] getAttribute(PDO::ATTR_CASE) returns wrong value '%s'\n",
- var_export($tmp, true));
+ if (($tmp = $db->getAttribute(PDO::ATTR_CASE)) !== PDO::CASE_UPPER)
+ printf("[009] getAttribute(PDO::ATTR_CASE) returns wrong value '%s'\n",
+ var_export($tmp, true));
- if (!is_object($stmt = $db->query("SELECT id, label, MiXeD, MYUPPER, MYUPPER AS 'lower' FROM test ORDER BY id ASC LIMIT 1")))
- printf("[010] %s - %s\n",
- var_export($db->errorInfo(), true), var_export($db->errorCode(), true));
+ if (!is_object($stmt = $db->query("SELECT id, label, MiXeD, MYUPPER, MYUPPER AS 'lower' FROM test ORDER BY id ASC LIMIT 1")))
+ printf("[010] %s - %s\n",
+ var_export($db->errorInfo(), true), var_export($db->errorCode(), true));
- var_dump($stmt->fetchAll(PDO::FETCH_BOTH));
+ var_dump($stmt->fetchAll(PDO::FETCH_BOTH));
- if (true !== $db->setAttribute(PDO::ATTR_CASE, PDO::CASE_NATURAL))
- printf("[011] Cannot set PDO::ATTR_CASE = PDO::CASE_NATURAL %s - %s\n",
- var_export($db->errorInfo(), true), var_export($db->errorCode(), true));
+ if (true !== $db->setAttribute(PDO::ATTR_CASE, PDO::CASE_NATURAL))
+ printf("[011] Cannot set PDO::ATTR_CASE = PDO::CASE_NATURAL %s - %s\n",
+ var_export($db->errorInfo(), true), var_export($db->errorCode(), true));
- if (($tmp = $db->getAttribute(PDO::ATTR_CASE)) !== PDO::CASE_NATURAL)
- printf("[012] getAttribute(PDO::ATTR_CASE) returns wrong value '%s'\n",
- var_export($tmp, true));
+ if (($tmp = $db->getAttribute(PDO::ATTR_CASE)) !== PDO::CASE_NATURAL)
+ printf("[012] getAttribute(PDO::ATTR_CASE) returns wrong value '%s'\n",
+ var_export($tmp, true));
- if (!is_object($stmt = $db->query("SELECT id, label, MiXeD, MYUPPER, id AS 'ID' FROM test ORDER BY id ASC LIMIT 1")))
- printf("[013] %s - %s\n",
- var_export($db->errorInfo(), true), var_export($db->errorCode(), true));
+ if (!is_object($stmt = $db->query("SELECT id, label, MiXeD, MYUPPER, id AS 'ID' FROM test ORDER BY id ASC LIMIT 1")))
+ printf("[013] %s - %s\n",
+ var_export($db->errorInfo(), true), var_export($db->errorCode(), true));
- var_dump($stmt->fetchAll(PDO::FETCH_BOTH));
+ var_dump($stmt->fetchAll(PDO::FETCH_BOTH));
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_client_version.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_client_version.phpt
index ce50df80eb..604ec90c41 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_attr_client_version.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_attr_client_version.phpt
@@ -9,29 +9,29 @@ $db = MySQLPDOTest::factory();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
- assert(('' == $db->errorCode()) || ('00000' == $db->errorCode()));
+ assert(('' == $db->errorCode()) || ('00000' == $db->errorCode()));
- $version = $db->getAttribute(PDO::ATTR_CLIENT_VERSION);
+ $version = $db->getAttribute(PDO::ATTR_CLIENT_VERSION);
- // No more constraints - mysqlnd and libmysql return different strings at least
- // with mysqli. Return type check is already performed in the generic test.
- // According to the manual we should get an int but as of today we do get a string...
- if ('' == $version)
- printf("[001] Client version must not be empty\n");
+ // No more constraints - mysqlnd and libmysql return different strings at least
+ // with mysqli. Return type check is already performed in the generic test.
+ // According to the manual we should get an int but as of today we do get a string...
+ if ('' == $version)
+ printf("[001] Client version must not be empty\n");
- // Read-only
- if (false !== $db->setAttribute(PDO::ATTR_CLIENT_VERSION, '1.0'))
- printf("[002] Wonderful, I can change the client version!\n");
+ // Read-only
+ if (false !== $db->setAttribute(PDO::ATTR_CLIENT_VERSION, '1.0'))
+ printf("[002] Wonderful, I can change the client version!\n");
- $new_version = $db->getAttribute(PDO::ATTR_CLIENT_VERSION);
- if ($new_version !== $version)
- printf("[003] Did we change it from '%s' to '%s'?\n", $version, $new_version);
+ $new_version = $db->getAttribute(PDO::ATTR_CLIENT_VERSION);
+ if ($new_version !== $version)
+ printf("[003] Did we change it from '%s' to '%s'?\n", $version, $new_version);
- print "done!";
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_connection_status.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_connection_status.phpt
index 8abb16a1c7..07a1de5b65 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_attr_connection_status.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_attr_connection_status.phpt
@@ -9,24 +9,24 @@ $db = MySQLPDOTest::factory();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
- $status = $db->getAttribute(PDO::ATTR_CONNECTION_STATUS);
+ $status = $db->getAttribute(PDO::ATTR_CONNECTION_STATUS);
if (!is_string($status))
printf("[002] Expecting string, got '%s'\n", var_export($status, true));
- if ('' == $status)
- printf("[003] Connection status string must not be empty\n");
+ if ('' == $status)
+ printf("[003] Connection status string must not be empty\n");
- if (false !== $db->setAttribute(PDO::ATTR_CONNECTION_STATUS, 'my own connection status'))
- printf("[004] Changing read only attribute\n");
+ if (false !== $db->setAttribute(PDO::ATTR_CONNECTION_STATUS, 'my own connection status'))
+ printf("[004] Changing read only attribute\n");
- $status2 = $db->getAttribute(PDO::ATTR_CONNECTION_STATUS);
- if ($status !== $status2)
- printf("[005] Connection status should not have changed\n");
+ $status2 = $db->getAttribute(PDO::ATTR_CONNECTION_STATUS);
+ if ($status !== $status2)
+ printf("[005] Connection status should not have changed\n");
- print "done!";
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_driver_name.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_driver_name.phpt
index 65ab531ffd..e105a0eac1 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_attr_driver_name.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_attr_driver_name.phpt
@@ -9,22 +9,22 @@ $db = MySQLPDOTest::factory();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
- assert(('' == $db->errorCode()) || ('00000' == $db->errorCode()));
+ assert(('' == $db->errorCode()) || ('00000' == $db->errorCode()));
- $name = $db->getAttribute(PDO::ATTR_DRIVER_NAME);
- var_dump($name);
+ $name = $db->getAttribute(PDO::ATTR_DRIVER_NAME);
+ var_dump($name);
- if (false !== $db->setAttribute(PDO::ATTR_DRIVER_NAME, 'mydriver'))
- printf("[001] Wonderful, I can create new PDO drivers!\n");
+ if (false !== $db->setAttribute(PDO::ATTR_DRIVER_NAME, 'mydriver'))
+ printf("[001] Wonderful, I can create new PDO drivers!\n");
- $new_name = $db->getAttribute(PDO::ATTR_DRIVER_NAME);
- if ($name != $new_name)
- printf("[002] Did we change it from '%s' to '%s'?\n", $name, $new_name);
+ $new_name = $db->getAttribute(PDO::ATTR_DRIVER_NAME);
+ if ($name != $new_name)
+ printf("[002] Did we change it from '%s' to '%s'?\n", $name, $new_name);
- print "done!";
+ print "done!";
?>
--EXPECT--
string(5) "mysql"
diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_errmode.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_errmode.phpt
index f0dc29b8d4..13c331633c 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_attr_errmode.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_attr_errmode.phpt
@@ -11,153 +11,153 @@ $db = MySQLPDOTest::factory();
error_reporting=E_ALL
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
-
- $valid = array(PDO::ERRMODE_SILENT, PDO::ERRMODE_WARNING, PDO::ERRMODE_EXCEPTION);
- do {
- $invalid = mt_rand(-1000, 1000);
- } while (in_array($invalid, $valid));
-
-
- $tmp = array();
- if (false != @$db->setAttribute(PDO::ATTR_ERRMODE, $tmp))
- printf("[001] Maybe PDO could indicate that this is not a proper way of setting the ERRMODE...\n");
-
- $tmp = new stdClass();
- $ret = @$db->setAttribute(PDO::ATTR_ERRMODE, $tmp);
- if (false != $ret)
- printf("[002] Maybe PDO could indicate that this is not a proper way of setting the ERRMODE...%s\n",
- var_export($ret, true));
-
- $ret = @$db->setAttribute(PDO::ATTR_ERRMODE, 'pdo');
- if (false != $ret)
- printf("[003] Maybe PDO could indicate that this is not a proper way of setting the ERRMODE...%s\n",
- var_export($ret, true));
-
- if (false != @$db->setAttribute(PDO::ATTR_ERRMODE, $invalid))
- printf("[004] Invalid ERRMODE should be rejected\n");
-
- $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
- // no message for any PDO call but...
- $db->query('THIS IS NOT VALID SQL');
- // ... still messages for everything else
- $code = $db->errorCode();
- $info = $db->errorInfo();
-
- if ($code != '42000')
- printf("[005] Expecting SQL code 42000 got '%s'\n", $code);
- if ($code !== $info[0])
- printf("[006] Code and info should be identical, got errorCode() = %s, errorInfo()[0] = %s\n",
- $code, $info[0]);
- if ('' == $info[1])
- printf("[007] Driver specific error code not set\n");
- if ('' == $info[2])
- printf("[008] Driver specific error message not set\n");
-
- $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
- $db->query('THIS IS NOT VALID SQL');
-
- $code = $db->errorCode();
- $info = $db->errorInfo();
-
- if ($code != '42000')
- printf("[009] Expecting SQL code 42000 got '%s'\n", $code);
- if ($code !== $info[0])
- printf("[010] Code and info should be identical, got errorCode() = %s, errorInfo()[0] = %s\n",
- $code, $info[0]);
- if ('' == $info[1])
- printf("[011] Driver specific error code not set\n");
- if ('' == $info[2])
- printf("[012] Driver specific error message not set\n");
-
- $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- try {
- $line = __LINE__ + 1;
- $db->query('THIS IS NOT VALID SQL');
- } catch (PDOException $e) {
-
- $code = $db->errorCode();
- $info = $db->errorInfo();
-
- if ($code != '42000')
- printf("[013] Expecting SQL code 42000 got '%s'\n", $code);
- if ($code !== $info[0])
- printf("[014] Code and info should be identical, got errorCode() = %s, errorInfo()[0] = %s\n",
- $code, $info[0]);
- if ('' == $info[1])
- printf("[015] Driver specific error code not set\n");
- if ('' == $info[2])
- printf("[016] Driver specific error message not set\n");
-
- if ($e->getCode() !== $code)
- printf("[017] Exception code '%s' differs from errorCode '%s'\n",
- $e->getCode(), $code);
-
- $msg = $e->getMessage();
- foreach ($info as $k => $v) {
- if (false === stristr($msg, (string)$v)) {
- printf("[018] Cannot find all parts of the error info ('%s') in the exception message '%s'\n",
- $v, $msg);
- }
- }
-
- if ($e->getLine() !== $line)
- printf("[019] Exception has been thrown in line %d, exception object reports line %d\n",
- $line, $e->getLine());
-
- if ($e->getFile() !== __FILE__)
- printf("[020] Exception has been thrown in file '%s', exception object reports file '%s'\n",
- __FILE__, $e->getFile());
-
- }
-
- function my_handler($e) {
- global $db, $line;
-
- $code = $db->errorCode();
- $info = $db->errorInfo();
-
- if ($code != '42000')
- printf("[021] Expecting SQL code 42000 got '%s'\n", $code);
- if ($code !== $info[0])
- printf("[022] Code and info should be identical, got errorCode() = %s, errorInfo()[0] = %s\n",
- $code, $info[0]);
- if ('' == $info[1])
- printf("[023] Driver specific error code not set\n");
- if ('' == $info[2])
- printf("[024] Driver specific error message not set\n");
-
- if ($e->getCode() !== $code)
- printf("[025] Exception code '%s' differs from errorCode '%s'\n",
- $e->getCode(), $code);
-
- $msg = $e->getMessage();
- foreach ($info as $k => $v) {
- if (false === stristr($msg, (string)$v)) {
- printf("[026] Cannot find all parts of the error info ('%s') in the exception message '%s'\n",
- $v, $msg);
- }
- }
-
- if ($e->getLine() !== $line)
- printf("[027] Exception has been thrown in line %d, exception object reports line %d\n",
- $line, $e->getLine());
-
- if ($e->getFile() !== __FILE__)
- printf("[028] Exception has been thrown in file '%s', exception object reports file '%s'\n",
- __FILE__, $e->getFile());
-
- if (get_class($e) != 'PDOException')
- printf("[029] Expecting PDO exception got exception of type '%s'\n", get_class($e));
-
- print "\nend of execution";
- }
- set_exception_handler('my_handler');
- $line = __LINE__ + 1;
- $db->query('THIS IS NOT VALID SQL');
-
- print "done!\n";
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
+
+ $valid = array(PDO::ERRMODE_SILENT, PDO::ERRMODE_WARNING, PDO::ERRMODE_EXCEPTION);
+ do {
+ $invalid = mt_rand(-1000, 1000);
+ } while (in_array($invalid, $valid));
+
+
+ $tmp = array();
+ if (false != @$db->setAttribute(PDO::ATTR_ERRMODE, $tmp))
+ printf("[001] Maybe PDO could indicate that this is not a proper way of setting the ERRMODE...\n");
+
+ $tmp = new stdClass();
+ $ret = @$db->setAttribute(PDO::ATTR_ERRMODE, $tmp);
+ if (false != $ret)
+ printf("[002] Maybe PDO could indicate that this is not a proper way of setting the ERRMODE...%s\n",
+ var_export($ret, true));
+
+ $ret = @$db->setAttribute(PDO::ATTR_ERRMODE, 'pdo');
+ if (false != $ret)
+ printf("[003] Maybe PDO could indicate that this is not a proper way of setting the ERRMODE...%s\n",
+ var_export($ret, true));
+
+ if (false != @$db->setAttribute(PDO::ATTR_ERRMODE, $invalid))
+ printf("[004] Invalid ERRMODE should be rejected\n");
+
+ $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
+ // no message for any PDO call but...
+ $db->query('THIS IS NOT VALID SQL');
+ // ... still messages for everything else
+ $code = $db->errorCode();
+ $info = $db->errorInfo();
+
+ if ($code != '42000')
+ printf("[005] Expecting SQL code 42000 got '%s'\n", $code);
+ if ($code !== $info[0])
+ printf("[006] Code and info should be identical, got errorCode() = %s, errorInfo()[0] = %s\n",
+ $code, $info[0]);
+ if ('' == $info[1])
+ printf("[007] Driver specific error code not set\n");
+ if ('' == $info[2])
+ printf("[008] Driver specific error message not set\n");
+
+ $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
+ $db->query('THIS IS NOT VALID SQL');
+
+ $code = $db->errorCode();
+ $info = $db->errorInfo();
+
+ if ($code != '42000')
+ printf("[009] Expecting SQL code 42000 got '%s'\n", $code);
+ if ($code !== $info[0])
+ printf("[010] Code and info should be identical, got errorCode() = %s, errorInfo()[0] = %s\n",
+ $code, $info[0]);
+ if ('' == $info[1])
+ printf("[011] Driver specific error code not set\n");
+ if ('' == $info[2])
+ printf("[012] Driver specific error message not set\n");
+
+ $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+ try {
+ $line = __LINE__ + 1;
+ $db->query('THIS IS NOT VALID SQL');
+ } catch (PDOException $e) {
+
+ $code = $db->errorCode();
+ $info = $db->errorInfo();
+
+ if ($code != '42000')
+ printf("[013] Expecting SQL code 42000 got '%s'\n", $code);
+ if ($code !== $info[0])
+ printf("[014] Code and info should be identical, got errorCode() = %s, errorInfo()[0] = %s\n",
+ $code, $info[0]);
+ if ('' == $info[1])
+ printf("[015] Driver specific error code not set\n");
+ if ('' == $info[2])
+ printf("[016] Driver specific error message not set\n");
+
+ if ($e->getCode() !== $code)
+ printf("[017] Exception code '%s' differs from errorCode '%s'\n",
+ $e->getCode(), $code);
+
+ $msg = $e->getMessage();
+ foreach ($info as $k => $v) {
+ if (false === stristr($msg, (string)$v)) {
+ printf("[018] Cannot find all parts of the error info ('%s') in the exception message '%s'\n",
+ $v, $msg);
+ }
+ }
+
+ if ($e->getLine() !== $line)
+ printf("[019] Exception has been thrown in line %d, exception object reports line %d\n",
+ $line, $e->getLine());
+
+ if ($e->getFile() !== __FILE__)
+ printf("[020] Exception has been thrown in file '%s', exception object reports file '%s'\n",
+ __FILE__, $e->getFile());
+
+ }
+
+ function my_handler($e) {
+ global $db, $line;
+
+ $code = $db->errorCode();
+ $info = $db->errorInfo();
+
+ if ($code != '42000')
+ printf("[021] Expecting SQL code 42000 got '%s'\n", $code);
+ if ($code !== $info[0])
+ printf("[022] Code and info should be identical, got errorCode() = %s, errorInfo()[0] = %s\n",
+ $code, $info[0]);
+ if ('' == $info[1])
+ printf("[023] Driver specific error code not set\n");
+ if ('' == $info[2])
+ printf("[024] Driver specific error message not set\n");
+
+ if ($e->getCode() !== $code)
+ printf("[025] Exception code '%s' differs from errorCode '%s'\n",
+ $e->getCode(), $code);
+
+ $msg = $e->getMessage();
+ foreach ($info as $k => $v) {
+ if (false === stristr($msg, (string)$v)) {
+ printf("[026] Cannot find all parts of the error info ('%s') in the exception message '%s'\n",
+ $v, $msg);
+ }
+ }
+
+ if ($e->getLine() !== $line)
+ printf("[027] Exception has been thrown in line %d, exception object reports line %d\n",
+ $line, $e->getLine());
+
+ if ($e->getFile() !== __FILE__)
+ printf("[028] Exception has been thrown in file '%s', exception object reports file '%s'\n",
+ __FILE__, $e->getFile());
+
+ if (get_class($e) != 'PDOException')
+ printf("[029] Expecting PDO exception got exception of type '%s'\n", get_class($e));
+
+ print "\nend of execution";
+ }
+ set_exception_handler('my_handler');
+ $line = __LINE__ + 1;
+ $db->query('THIS IS NOT VALID SQL');
+
+ print "done!\n";
--EXPECTF--
[003] Maybe PDO could indicate that this is not a proper way of setting the ERRMODE...true
diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_fetch_table_names.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_fetch_table_names.phpt
index a19e680de1..eabc4db829 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_attr_fetch_table_names.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_attr_fetch_table_names.phpt
@@ -8,21 +8,21 @@ MySQLPDOTest::skip();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
- MySQLPDOTest::createTestTable($db);
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
+ MySQLPDOTest::createTestTable($db);
- $db->setAttribute(PDO::ATTR_FETCH_TABLE_NAMES, 1);
- $stmt = $db->query('SELECT label FROM test LIMIT 1');
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
- $stmt->closeCursor();
+ $db->setAttribute(PDO::ATTR_FETCH_TABLE_NAMES, 1);
+ $stmt = $db->query('SELECT label FROM test LIMIT 1');
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+ $stmt->closeCursor();
- $db->setAttribute(PDO::ATTR_FETCH_TABLE_NAMES, 0);
- $stmt = $db->query('SELECT label FROM test LIMIT 1');
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
- $stmt->closeCursor();
+ $db->setAttribute(PDO::ATTR_FETCH_TABLE_NAMES, 0);
+ $stmt = $db->query('SELECT label FROM test LIMIT 1');
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+ $stmt->closeCursor();
- print "done!";
+ print "done!";
?>
--EXPECT--
array(1) {
diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_init_command.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_init_command.phpt
index cd3b40d6d1..c979075fd7 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_attr_init_command.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_attr_init_command.phpt
@@ -11,29 +11,29 @@ $db = MySQLPDOTest::factory();
error_reporting=E_ALL
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $dsn = MySQLPDOTest::getDSN();
- $user = PDO_MYSQL_TEST_USER;
- $pass = PDO_MYSQL_TEST_PASS;
+ $dsn = MySQLPDOTest::getDSN();
+ $user = PDO_MYSQL_TEST_USER;
+ $pass = PDO_MYSQL_TEST_PASS;
- $table = sprintf("test_%s", md5(mt_rand(0, PHP_INT_MAX)));
- $db = new PDO($dsn, $user, $pass);
- $db->exec(sprintf('DROP TABLE IF EXISTS %s', $table));
+ $table = sprintf("test_%s", md5(mt_rand(0, PHP_INT_MAX)));
+ $db = new PDO($dsn, $user, $pass);
+ $db->exec(sprintf('DROP TABLE IF EXISTS %s', $table));
- $create = sprintf('CREATE TABLE %s(id INT)', $table);
- var_dump($create);
- $db = new PDO($dsn, $user, $pass, array(PDO::MYSQL_ATTR_INIT_COMMAND => $create));
+ $create = sprintf('CREATE TABLE %s(id INT)', $table);
+ var_dump($create);
+ $db = new PDO($dsn, $user, $pass, array(PDO::MYSQL_ATTR_INIT_COMMAND => $create));
- $info = $db->errorInfo();
- var_dump($info[0]);
+ $info = $db->errorInfo();
+ var_dump($info[0]);
- $db->exec(sprintf('INSERT INTO %s(id) VALUES (1)', $table));
- $stmt = $db->query(sprintf('SELECT id FROM %s', $table));
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+ $db->exec(sprintf('INSERT INTO %s(id) VALUES (1)', $table));
+ $stmt = $db->query(sprintf('SELECT id FROM %s', $table));
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
- $db->exec(sprintf('DROP TABLE IF EXISTS %s', $table));
- print "done!";
+ $db->exec(sprintf('DROP TABLE IF EXISTS %s', $table));
+ print "done!";
?>
--EXPECTF--
string(58) "CREATE TABLE test_%s(id INT)"
diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_max_buffer_size.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_max_buffer_size.phpt
index c988b2b3cb..1337c1ac95 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_attr_max_buffer_size.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_attr_max_buffer_size.phpt
@@ -10,58 +10,58 @@ if (MySQLPDOTest::isPDOMySQLnd())
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- function try_buffer_size($offset, $buffer_size) {
+ function try_buffer_size($offset, $buffer_size) {
- try {
+ try {
- $dsn = MySQLPDOTest::getDSN();
- $user = PDO_MYSQL_TEST_USER;
- $pass = PDO_MYSQL_TEST_PASS;
+ $dsn = MySQLPDOTest::getDSN();
+ $user = PDO_MYSQL_TEST_USER;
+ $pass = PDO_MYSQL_TEST_PASS;
- /* unsigned overflow possible ? */
- $db = new PDO($dsn, $user, $pass,
- array(
- PDO::MYSQL_ATTR_MAX_BUFFER_SIZE => $buffer_size,
- /* buffer is only relevant with native PS */
- PDO::MYSQL_ATTR_DIRECT_QUERY => 0,
- PDO::ATTR_EMULATE_PREPARES => 0,
- ));
+ /* unsigned overflow possible ? */
+ $db = new PDO($dsn, $user, $pass,
+ array(
+ PDO::MYSQL_ATTR_MAX_BUFFER_SIZE => $buffer_size,
+ /* buffer is only relevant with native PS */
+ PDO::MYSQL_ATTR_DIRECT_QUERY => 0,
+ PDO::ATTR_EMULATE_PREPARES => 0,
+ ));
- $db->exec('DROP TABLE IF EXISTS test');
- $db->exec(sprintf('CREATE TABLE test(id INT, val LONGBLOB) ENGINE = %s', PDO_MYSQL_TEST_ENGINE));
+ $db->exec('DROP TABLE IF EXISTS test');
+ $db->exec(sprintf('CREATE TABLE test(id INT, val LONGBLOB) ENGINE = %s', PDO_MYSQL_TEST_ENGINE));
- // 10 * (10 * 1024) = 10 * (10 * 1k) = 100k
- $db->exec('INSERT INTO test(id, val) VALUES (1, REPEAT("01234567890", 10240))');
+ // 10 * (10 * 1024) = 10 * (10 * 1k) = 100k
+ $db->exec('INSERT INTO test(id, val) VALUES (1, REPEAT("01234567890", 10240))');
- $stmt = $db->prepare('SELECT id, val FROM test');
- $stmt->execute();
+ $stmt = $db->prepare('SELECT id, val FROM test');
+ $stmt->execute();
- $id = $val = NULL;
- $stmt->bindColumn(1, $id);
- $stmt->bindColumn(2, $val);
- while ($row = $stmt->fetch(PDO::FETCH_BOUND)) {
- printf("[%03d] id = %d, val = %s... (length: %d)\n",
- $offset, $id, substr($val, 0, 10), strlen($val));
- }
- $db->exec('DROP TABLE IF EXISTS test');
+ $id = $val = NULL;
+ $stmt->bindColumn(1, $id);
+ $stmt->bindColumn(2, $val);
+ while ($row = $stmt->fetch(PDO::FETCH_BOUND)) {
+ printf("[%03d] id = %d, val = %s... (length: %d)\n",
+ $offset, $id, substr($val, 0, 10), strlen($val));
+ }
+ $db->exec('DROP TABLE IF EXISTS test');
- } catch (PDOException $e) {
- printf("[%03d] %s, [%s] %s\n",
- $offset,
- $e->getMessage(),
- (is_object($db)) ? $db->errorCode() : 'n/a',
- (is_object($db)) ? implode(' ', $db->errorInfo()) : 'n/a');
- }
- }
+ } catch (PDOException $e) {
+ printf("[%03d] %s, [%s] %s\n",
+ $offset,
+ $e->getMessage(),
+ (is_object($db)) ? $db->errorCode() : 'n/a',
+ (is_object($db)) ? implode(' ', $db->errorInfo()) : 'n/a');
+ }
+ }
- try_buffer_size(1, -1);
- try_buffer_size(2, 1000);
- try_buffer_size(3, NULL);
- try_buffer_size(4, 2000);
+ try_buffer_size(1, -1);
+ try_buffer_size(2, 1000);
+ try_buffer_size(3, NULL);
+ try_buffer_size(4, 2000);
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_multi_statements.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_multi_statements.phpt
index 92bab1d30d..65b5e1bdc9 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_attr_multi_statements.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_attr_multi_statements.phpt
@@ -11,43 +11,43 @@ $db = MySQLPDOTest::factory();
error_reporting=E_ALL
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $dsn = MySQLPDOTest::getDSN();
- $user = PDO_MYSQL_TEST_USER;
- $pass = PDO_MYSQL_TEST_PASS;
+ $dsn = MySQLPDOTest::getDSN();
+ $user = PDO_MYSQL_TEST_USER;
+ $pass = PDO_MYSQL_TEST_PASS;
- $table = sprintf("test_%s", md5(mt_rand(0, PHP_INT_MAX)));
- $db = new PDO($dsn, $user, $pass);
- $db->exec(sprintf('DROP TABLE IF EXISTS %s', $table));
- $create = sprintf('CREATE TABLE %s(id INT)', $table);
- $db->exec($create);
- $db->exec(sprintf('INSERT INTO %s(id) VALUES (1)', $table));
- $stmt = $db->query(sprintf('SELECT * FROM %s; INSERT INTO %s(id) VALUES (2)', $table, $table));
- $stmt->closeCursor();
- $info = $db->errorInfo();
- var_dump($info[0]);
- $stmt = $db->query(sprintf('SELECT id FROM %s', $table));
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+ $table = sprintf("test_%s", md5(mt_rand(0, PHP_INT_MAX)));
+ $db = new PDO($dsn, $user, $pass);
+ $db->exec(sprintf('DROP TABLE IF EXISTS %s', $table));
+ $create = sprintf('CREATE TABLE %s(id INT)', $table);
+ $db->exec($create);
+ $db->exec(sprintf('INSERT INTO %s(id) VALUES (1)', $table));
+ $stmt = $db->query(sprintf('SELECT * FROM %s; INSERT INTO %s(id) VALUES (2)', $table, $table));
+ $stmt->closeCursor();
+ $info = $db->errorInfo();
+ var_dump($info[0]);
+ $stmt = $db->query(sprintf('SELECT id FROM %s', $table));
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
// A single query with a trailing delimiter.
- $stmt = $db->query('SELECT 1 AS value;');
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+ $stmt = $db->query('SELECT 1 AS value;');
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
- // New connection, does not allow multiple statements.
- $db = new PDO($dsn, $user, $pass, array(PDO::MYSQL_ATTR_MULTI_STATEMENTS => false));
- $stmt = $db->query(sprintf('SELECT * FROM %s; INSERT INTO %s(id) VALUES (3)', $table, $table));
- var_dump($stmt);
- $info = $db->errorInfo();
- var_dump($info[0]);
+ // New connection, does not allow multiple statements.
+ $db = new PDO($dsn, $user, $pass, array(PDO::MYSQL_ATTR_MULTI_STATEMENTS => false));
+ $stmt = $db->query(sprintf('SELECT * FROM %s; INSERT INTO %s(id) VALUES (3)', $table, $table));
+ var_dump($stmt);
+ $info = $db->errorInfo();
+ var_dump($info[0]);
- $stmt = $db->query(sprintf('SELECT id FROM %s', $table));
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+ $stmt = $db->query(sprintf('SELECT id FROM %s', $table));
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
// A single query with a trailing delimiter.
$stmt = $db->query('SELECT 1 AS value;');
var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
- $db->exec(sprintf('DROP TABLE IF EXISTS %s', $table));
- print "done!";
+ $db->exec(sprintf('DROP TABLE IF EXISTS %s', $table));
+ print "done!";
?>
--EXPECT--
string(5) "00000"
diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_oracle_nulls.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_oracle_nulls.phpt
index 44503c1053..694a039441 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_attr_oracle_nulls.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_attr_oracle_nulls.phpt
@@ -8,78 +8,78 @@ MySQLPDOTest::skip();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
- MySQLPDOTest::createTestTable($db);
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
+ MySQLPDOTest::createTestTable($db);
- $tmp = array();
- if (false !== @$db->setAttribute(PDO::ATTR_ORACLE_NULLS, $tmp))
- printf("[001] Maybe PDO could indicate that this is not a proper way of setting ATTR_ORACLE_NULLS...\n");
+ $tmp = array();
+ if (false !== @$db->setAttribute(PDO::ATTR_ORACLE_NULLS, $tmp))
+ printf("[001] Maybe PDO could indicate that this is not a proper way of setting ATTR_ORACLE_NULLS...\n");
- $tmp = new stdClass();
- if (false !== @$db->setAttribute(PDO::ATTR_ORACLE_NULLS, $tmp));
- printf("[002] Maybe PDO could indicate that this is not a proper way of setting ATTR_ORACLE_NULLS...\n");
+ $tmp = new stdClass();
+ if (false !== @$db->setAttribute(PDO::ATTR_ORACLE_NULLS, $tmp));
+ printf("[002] Maybe PDO could indicate that this is not a proper way of setting ATTR_ORACLE_NULLS...\n");
- if (false !== @$db->setAttribute(PDO::ATTR_ORACLE_NULLS, 'pdo'))
- printf("[003] Maybe PDO could indicate that this is not a proper way of setting ATTR_ORACLE_NULLS...\n");
+ if (false !== @$db->setAttribute(PDO::ATTR_ORACLE_NULLS, 'pdo'))
+ printf("[003] Maybe PDO could indicate that this is not a proper way of setting ATTR_ORACLE_NULLS...\n");
- $db->setAttribute(PDO::ATTR_ORACLE_NULLS, 1);
- $stmt = $db->query("SELECT NULL AS z, '' AS a, ' ' AS b, TRIM(' ') as c, ' d' AS d, '" . chr(0) . " e' AS e");
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+ $db->setAttribute(PDO::ATTR_ORACLE_NULLS, 1);
+ $stmt = $db->query("SELECT NULL AS z, '' AS a, ' ' AS b, TRIM(' ') as c, ' d' AS d, '" . chr(0) . " e' AS e");
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
- $db->setAttribute(PDO::ATTR_ORACLE_NULLS, 0);
- $stmt = $db->query("SELECT NULL AS z, '' AS a, ' ' AS b, TRIM(' ') as c, ' d' AS d, '" . chr(0) . " e' AS e");
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+ $db->setAttribute(PDO::ATTR_ORACLE_NULLS, 0);
+ $stmt = $db->query("SELECT NULL AS z, '' AS a, ' ' AS b, TRIM(' ') as c, ' d' AS d, '" . chr(0) . " e' AS e");
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
- $db->setAttribute(PDO::ATTR_ORACLE_NULLS, 1);
- $stmt = $db->query('SELECT VERSION() as _version');
- $row = $stmt->fetch(PDO::FETCH_ASSOC);
- if ((int)substr($row['_version'], 0, 1) >= 5)
- $have_procedures = true;
- else
- $have_procedures = false;
+ $db->setAttribute(PDO::ATTR_ORACLE_NULLS, 1);
+ $stmt = $db->query('SELECT VERSION() as _version');
+ $row = $stmt->fetch(PDO::FETCH_ASSOC);
+ if ((int)substr($row['_version'], 0, 1) >= 5)
+ $have_procedures = true;
+ else
+ $have_procedures = false;
- $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
- $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
+ $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
+ $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
- if ($have_procedures && (false !== $db->exec('DROP PROCEDURE IF EXISTS p')) &&
- (false !== $db->exec("CREATE PROCEDURE p() BEGIN SELECT NULL as z, '' AS a, ' ' AS b, TRIM(' ') as c, ' d' AS d, ' e' AS e; END;"))) {
- // requires MySQL 5+
- $stmt = $db->prepare('CALL p()');
- $stmt->execute();
- $expected = array(
- array(
- "z" => NULL,
- "a" => NULL,
- "b" => " ",
- "c" => NULL,
- "d" => " d",
- "e" => " e",
- ),
- );
- do {
- $tmp = $stmt->fetchAll(PDO::FETCH_ASSOC);
- if ($tmp != $expected) {
- printf("[004] Expecting %s got %s\n",
- var_export($expected, true), var_export($tmp, true));
- }
- } while ($stmt->nextRowset());
+ if ($have_procedures && (false !== $db->exec('DROP PROCEDURE IF EXISTS p')) &&
+ (false !== $db->exec("CREATE PROCEDURE p() BEGIN SELECT NULL as z, '' AS a, ' ' AS b, TRIM(' ') as c, ' d' AS d, ' e' AS e; END;"))) {
+ // requires MySQL 5+
+ $stmt = $db->prepare('CALL p()');
+ $stmt->execute();
+ $expected = array(
+ array(
+ "z" => NULL,
+ "a" => NULL,
+ "b" => " ",
+ "c" => NULL,
+ "d" => " d",
+ "e" => " e",
+ ),
+ );
+ do {
+ $tmp = $stmt->fetchAll(PDO::FETCH_ASSOC);
+ if ($tmp != $expected) {
+ printf("[004] Expecting %s got %s\n",
+ var_export($expected, true), var_export($tmp, true));
+ }
+ } while ($stmt->nextRowset());
- $stmt->execute();
- do {
- $tmp = $stmt->fetchAll(PDO::FETCH_ASSOC);
- if ($tmp != $expected) {
- printf("[005] Expecting %s got %s\n",
- var_export($expected, true), var_export($tmp, true));
- }
- } while ($stmt->nextRowset());
+ $stmt->execute();
+ do {
+ $tmp = $stmt->fetchAll(PDO::FETCH_ASSOC);
+ if ($tmp != $expected) {
+ printf("[005] Expecting %s got %s\n",
+ var_export($expected, true), var_export($tmp, true));
+ }
+ } while ($stmt->nextRowset());
- }
+ }
- if ($have_procedures)
- @$db->exec('DROP PROCEDURE IF EXISTS p');
+ if ($have_procedures)
+ @$db->exec('DROP PROCEDURE IF EXISTS p');
- print "done!";
+ print "done!";
?>
--EXPECTF--
[002] Maybe PDO could indicate that this is not a proper way of setting ATTR_ORACLE_NULLS...
diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_prefetch.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_prefetch.phpt
index f1ca4be1de..155f3514fa 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_attr_prefetch.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_attr_prefetch.phpt
@@ -9,11 +9,11 @@ $db = MySQLPDOTest::factory();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
- var_dump($db->getAttribute(PDO::ATTR_PREFETCH));
- var_dump($db->setAttribute(PDO::ATTR_PREFETCH, true));
- print "done!";
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
+ var_dump($db->getAttribute(PDO::ATTR_PREFETCH));
+ var_dump($db->setAttribute(PDO::ATTR_PREFETCH, true));
+ print "done!";
--EXPECTF--
Warning: PDO::getAttribute(): SQLSTATE[IM001]: Driver does not support this function: driver does not support that attribute in %s on line %d
bool(false)
diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_server_info.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_server_info.phpt
index 4a142eee38..d1b6e1e02b 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_attr_server_info.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_attr_server_info.phpt
@@ -9,43 +9,43 @@ $db = MySQLPDOTest::factory();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
-
- assert(('' == $db->errorCode()) || ('00000' == $db->errorCode()));
-
- $info = $db->getAttribute(PDO::ATTR_SERVER_INFO);
- if ('' == $info)
- printf("[001] Server info must not be empty\n");
-
- // Read-only?
- if (false !== $db->setAttribute(PDO::ATTR_SERVER_INFO, 'new uptime: 0s'))
- printf("[002] Wonderful, I can change the client version!\n");
-
- $new_info = $db->getAttribute(PDO::ATTR_SERVER_INFO);
- if (soundex($new_info) != soundex($info))
- printf("[003] Did we change it from '%s' to '%s'?\n", $info, $info);
-
- // lets hope we always run this in the same second as we did run the server info request...
- if (!$stmt = $db->query("SHOW STATUS LIKE '%uptime%'"))
- printf("[004] Cannot run SHOW STATUS, [%s]\n", $db->errorCode());
- else {
- if (!$row = $stmt->fetch(PDO::FETCH_NUM))
- printf("[005] Unable to fetch uptime, [%s]\n", $db->errorCode());
- else
- $uptime = $row[1];
- $stmt->closeCursor();
- }
-
- if (!preg_match('/Uptime/i', $info))
- printf("[006] Can't find uptime in server info '%s'\n", $info);
-
- if (isset($uptime)) {
- if (!preg_match('/Uptime: (\d+)/i', $info, $matches) || $uptime - $matches[1] > 1) {
- printf("[007] SHOW STATUS and server info have reported a different uptime, please check. Server info: '%s', SHOW STATUS: '%s'\n", $info, $uptime);
- }
- }
-
- print "done!";
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
+
+ assert(('' == $db->errorCode()) || ('00000' == $db->errorCode()));
+
+ $info = $db->getAttribute(PDO::ATTR_SERVER_INFO);
+ if ('' == $info)
+ printf("[001] Server info must not be empty\n");
+
+ // Read-only?
+ if (false !== $db->setAttribute(PDO::ATTR_SERVER_INFO, 'new uptime: 0s'))
+ printf("[002] Wonderful, I can change the client version!\n");
+
+ $new_info = $db->getAttribute(PDO::ATTR_SERVER_INFO);
+ if (soundex($new_info) != soundex($info))
+ printf("[003] Did we change it from '%s' to '%s'?\n", $info, $info);
+
+ // lets hope we always run this in the same second as we did run the server info request...
+ if (!$stmt = $db->query("SHOW STATUS LIKE '%uptime%'"))
+ printf("[004] Cannot run SHOW STATUS, [%s]\n", $db->errorCode());
+ else {
+ if (!$row = $stmt->fetch(PDO::FETCH_NUM))
+ printf("[005] Unable to fetch uptime, [%s]\n", $db->errorCode());
+ else
+ $uptime = $row[1];
+ $stmt->closeCursor();
+ }
+
+ if (!preg_match('/Uptime/i', $info))
+ printf("[006] Can't find uptime in server info '%s'\n", $info);
+
+ if (isset($uptime)) {
+ if (!preg_match('/Uptime: (\d+)/i', $info, $matches) || $uptime - $matches[1] > 1) {
+ printf("[007] SHOW STATUS and server info have reported a different uptime, please check. Server info: '%s', SHOW STATUS: '%s'\n", $info, $uptime);
+ }
+ }
+
+ print "done!";
--EXPECT--
done!
diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_server_version.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_server_version.phpt
index a635c3771a..62a2fae8b0 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_attr_server_version.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_attr_server_version.phpt
@@ -9,57 +9,57 @@ $db = MySQLPDOTest::factory();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
- assert(('' == $db->errorCode()) || ('00000' == $db->errorCode()));
+ assert(('' == $db->errorCode()) || ('00000' == $db->errorCode()));
- $version = $db->getAttribute(PDO::ATTR_SERVER_VERSION);
- if ('' == $version)
- printf("[001] Server version must not be empty\n");
+ $version = $db->getAttribute(PDO::ATTR_SERVER_VERSION);
+ if ('' == $version)
+ printf("[001] Server version must not be empty\n");
- // Ideally the server version would be an integer - as documented but BC break!
- // If its a version string it should be of the format \d+\.\d+\.\d+.*
+ // Ideally the server version would be an integer - as documented but BC break!
+ // If its a version string it should be of the format \d+\.\d+\.\d+.*
- if (is_string($version)) {
- // Its not an int like documented but a string - maybe for BC reasons...
- if (!preg_match('/(\d+)\.(\d+)\.(\d+)(.*)/', $version, $matches))
- printf("[002] Client version string seems wrong, got '%s'\n", $version);
- else {
- // Difficult to define any meaningful constraints
- // A possible better check would be calling mysqli_get_server_version() and
- // comparing what we get. However, mysqli_get_server_version() needs a mysqli handle
- // for which in turn one needs to parse the PDO test environment variables
- // for connection parameter...
- if ($matches[1] < 3)
- printf("[003] Strange major version: '%s'. Should be more than 3\n", $matches[1]);
- if ($matches[2] < 0)
- printf("[004] Minor version should be at least 0, got '%s'\n", $matches[2]);
- if ($matches[3] < 0)
- printf("[005] Sub version should be at least 0, got '%s'\n", $matches[2]);
- }
- } else if (is_int($version)) {
- // Lets accept also int if it follows the rules from the original MYSQL C API
- $major = floor($version / 10000);
- $minor = floor(($version - ($main * 10000)) / 100);
- $sub = $version - ($main * 10000) - ($minor * 100);
- if ($major < 3)
- printf("[006] Strange major version: '%s'. Should be more than 3\n", $major);
- if ($minor < 0)
- printf("[007] Minor version should be at least 0, got '%s'\n", $minor);
- if ($sub < 0)
- printf("[008] Sub version should be at least 0, got '%s'\n", $sub);
- }
+ if (is_string($version)) {
+ // Its not an int like documented but a string - maybe for BC reasons...
+ if (!preg_match('/(\d+)\.(\d+)\.(\d+)(.*)/', $version, $matches))
+ printf("[002] Client version string seems wrong, got '%s'\n", $version);
+ else {
+ // Difficult to define any meaningful constraints
+ // A possible better check would be calling mysqli_get_server_version() and
+ // comparing what we get. However, mysqli_get_server_version() needs a mysqli handle
+ // for which in turn one needs to parse the PDO test environment variables
+ // for connection parameter...
+ if ($matches[1] < 3)
+ printf("[003] Strange major version: '%s'. Should be more than 3\n", $matches[1]);
+ if ($matches[2] < 0)
+ printf("[004] Minor version should be at least 0, got '%s'\n", $matches[2]);
+ if ($matches[3] < 0)
+ printf("[005] Sub version should be at least 0, got '%s'\n", $matches[2]);
+ }
+ } else if (is_int($version)) {
+ // Lets accept also int if it follows the rules from the original MYSQL C API
+ $major = floor($version / 10000);
+ $minor = floor(($version - ($main * 10000)) / 100);
+ $sub = $version - ($main * 10000) - ($minor * 100);
+ if ($major < 3)
+ printf("[006] Strange major version: '%s'. Should be more than 3\n", $major);
+ if ($minor < 0)
+ printf("[007] Minor version should be at least 0, got '%s'\n", $minor);
+ if ($sub < 0)
+ printf("[008] Sub version should be at least 0, got '%s'\n", $sub);
+ }
- // Read-only?
- if (false !== $db->setAttribute(PDO::ATTR_CLIENT_VERSION, '1.0'))
- printf("[009] Wonderful, I can change the client version!\n");
+ // Read-only?
+ if (false !== $db->setAttribute(PDO::ATTR_CLIENT_VERSION, '1.0'))
+ printf("[009] Wonderful, I can change the client version!\n");
- $new_version = $db->getAttribute(PDO::ATTR_SERVER_VERSION);
- if ($new_version !== $version)
- printf("[010] Did we change it from '%s' to '%s'?\n", $version, $new_version);
+ $new_version = $db->getAttribute(PDO::ATTR_SERVER_VERSION);
+ if ($new_version !== $version)
+ printf("[010] Did we change it from '%s' to '%s'?\n", $version, $new_version);
- print "done!";
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/pdo_mysql/tests/pdo_mysql_attr_statement_class.phpt b/ext/pdo_mysql/tests/pdo_mysql_attr_statement_class.phpt
index ddc76d4b60..e8bdd16434 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_attr_statement_class.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_attr_statement_class.phpt
@@ -9,103 +9,100 @@ $db = MySQLPDOTest::factory();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
- MySQLPDOTest::createTestTable($db);
-
- $default = $db->getAttribute(PDO::ATTR_STATEMENT_CLASS);
- var_dump($default);
-
- if (false !== ($tmp = @$db->setAttribute(PDO::ATTR_STATEMENT_CLASS)))
- printf("[001] Expecting boolean/false got %s\n", var_export($tmp, true));
-
- if (false !== ($tmp = @$db->setAttribute(PDO::ATTR_STATEMENT_CLASS, 'foo')))
- printf("[002] Expecting boolean/false got %s\n", var_export($tmp, true));
-
- if (false !== ($tmp = @$db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('classname'))))
- printf("[003] Expecting boolean/false got %s\n", var_export($tmp, true));
-
- // unknown class
- if (false !== ($tmp = $db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('classname', array()))))
- printf("[004] Expecting boolean/false got %s\n", var_export($tmp, true));
-
- // class not derived from PDOStatement
- class myclass {
- function __construct() {
- printf("myclass\n");
- }
- }
- if (false !== ($tmp = $db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('myclass', array()))))
- printf("[005] Expecting boolean/false got %s\n", var_export($tmp, true));
-
- // public constructor not allowed
- class mystatement extends PDOStatement {
- public function __construct() {
- printf("mystatement\n");
- }
- }
-
- if (false !== ($tmp = $db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('mystatement', array()))))
- printf("[006] Expecting boolean/false got %s\n", var_export($tmp, true));
-
- // ... but a public destructor is allowed
- class mystatement2 extends PDOStatement {
- public function __destruct() {
- printf("mystatement\n");
- }
- }
-
- if (true !== ($tmp = $db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('mystatement2', array()))))
- printf("[007] Expecting boolean/true got %s\n", var_export($tmp, true));
-
- // private constructor
- class mystatement3 extends PDOStatement {
- private function __construct($msg) {
- printf("mystatement3\n");
- var_dump($msg);
- }
- }
- if (true !== ($tmp = $db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('mystatement3', array('param1')))))
- printf("[008] Expecting boolean/true got %s\n", var_export($tmp, true));
-
- // private constructor
- class mystatement4 extends PDOStatement {
- private function __construct($msg) {
- printf("%s\n", get_class($this));
- var_dump($msg);
- }
- }
- if (true !== ($tmp = $db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('mystatement4', array('param1')))))
- printf("[008] Expecting boolean/true got %s\n", var_export($tmp, true));
-
- var_dump($db->getAttribute(PDO::ATTR_STATEMENT_CLASS));
- $stmt = $db->query('SELECT id, label FROM test ORDER BY id ASC LIMIT 2');
-
- class mystatement5 extends mystatement4 {
- public function fetchAll($fetch_style = 1, $column_index = 1, $ctor_args = array()) {
- return "no data :)";
- }
- }
-
- if (true !== ($tmp = $db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('mystatement5', array('mystatement5')))))
- printf("[009] Expecting boolean/true got %s\n", var_export($tmp, true));
- $stmt = $db->query('SELECT id, label FROM test ORDER BY id ASC LIMIT 2');
- var_dump($stmt->fetchAll());
-
- if (true !== ($tmp = $db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('PDOStatement'))))
- printf("[010] Expecting boolean/true got %s\n", var_export($tmp, true));
-
- $stmt = $db->query('SELECT id, label FROM test ORDER BY id ASC LIMIT 1');
- var_dump($stmt->fetchAll());
-
- // Yes, this is a fatal error and I want it to fail.
- abstract class mystatement6 extends mystatement5 {
- }
- if (true !== ($tmp = $db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('mystatement6', array('mystatement6')))))
- printf("[011] Expecting boolean/true got %s\n", var_export($tmp, true));
- $stmt = $db->query('SELECT id, label FROM test ORDER BY id ASC LIMIT 1');
-
- print "done!";
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
+ MySQLPDOTest::createTestTable($db);
+
+ $default = $db->getAttribute(PDO::ATTR_STATEMENT_CLASS);
+ var_dump($default);
+
+ if (false !== ($tmp = @$db->setAttribute(PDO::ATTR_STATEMENT_CLASS, 'foo')))
+ printf("[002] Expecting boolean/false got %s\n", var_export($tmp, true));
+
+ if (false !== ($tmp = @$db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('classname'))))
+ printf("[003] Expecting boolean/false got %s\n", var_export($tmp, true));
+
+ // unknown class
+ if (false !== ($tmp = $db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('classname', array()))))
+ printf("[004] Expecting boolean/false got %s\n", var_export($tmp, true));
+
+ // class not derived from PDOStatement
+ class myclass {
+ function __construct() {
+ printf("myclass\n");
+ }
+ }
+ if (false !== ($tmp = $db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('myclass', array()))))
+ printf("[005] Expecting boolean/false got %s\n", var_export($tmp, true));
+
+ // public constructor not allowed
+ class mystatement extends PDOStatement {
+ public function __construct() {
+ printf("mystatement\n");
+ }
+ }
+
+ if (false !== ($tmp = $db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('mystatement', array()))))
+ printf("[006] Expecting boolean/false got %s\n", var_export($tmp, true));
+
+ // ... but a public destructor is allowed
+ class mystatement2 extends PDOStatement {
+ public function __destruct() {
+ printf("mystatement\n");
+ }
+ }
+
+ if (true !== ($tmp = $db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('mystatement2', array()))))
+ printf("[007] Expecting boolean/true got %s\n", var_export($tmp, true));
+
+ // private constructor
+ class mystatement3 extends PDOStatement {
+ private function __construct($msg) {
+ printf("mystatement3\n");
+ var_dump($msg);
+ }
+ }
+ if (true !== ($tmp = $db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('mystatement3', array('param1')))))
+ printf("[008] Expecting boolean/true got %s\n", var_export($tmp, true));
+
+ // private constructor
+ class mystatement4 extends PDOStatement {
+ private function __construct($msg) {
+ printf("%s\n", get_class($this));
+ var_dump($msg);
+ }
+ }
+ if (true !== ($tmp = $db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('mystatement4', array('param1')))))
+ printf("[008] Expecting boolean/true got %s\n", var_export($tmp, true));
+
+ var_dump($db->getAttribute(PDO::ATTR_STATEMENT_CLASS));
+ $stmt = $db->query('SELECT id, label FROM test ORDER BY id ASC LIMIT 2');
+
+ class mystatement5 extends mystatement4 {
+ public function fetchAll($fetch_style = 1, $column_index = 1, $ctor_args = array()) {
+ return "no data :)";
+ }
+ }
+
+ if (true !== ($tmp = $db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('mystatement5', array('mystatement5')))))
+ printf("[009] Expecting boolean/true got %s\n", var_export($tmp, true));
+ $stmt = $db->query('SELECT id, label FROM test ORDER BY id ASC LIMIT 2');
+ var_dump($stmt->fetchAll());
+
+ if (true !== ($tmp = $db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('PDOStatement'))))
+ printf("[010] Expecting boolean/true got %s\n", var_export($tmp, true));
+
+ $stmt = $db->query('SELECT id, label FROM test ORDER BY id ASC LIMIT 1');
+ var_dump($stmt->fetchAll());
+
+ // Yes, this is a fatal error and I want it to fail.
+ abstract class mystatement6 extends mystatement5 {
+ }
+ if (true !== ($tmp = $db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('mystatement6', array('mystatement6')))))
+ printf("[011] Expecting boolean/true got %s\n", var_export($tmp, true));
+ $stmt = $db->query('SELECT id, label FROM test ORDER BY id ASC LIMIT 1');
+
+ print "done!";
?>
--EXPECTF--
array(1) {
diff --git a/ext/pdo_mysql/tests/pdo_mysql_begintransaction.phpt b/ext/pdo_mysql/tests/pdo_mysql_begintransaction.phpt
index f2653f4b6b..2fc60f9fc2 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_begintransaction.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_begintransaction.phpt
@@ -11,175 +11,175 @@ if (false == MySQLPDOTest::detect_transactional_mysql_engine($db))
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
- MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db));
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
+ MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db));
- if (1 !== $db->getAttribute(PDO::ATTR_AUTOCOMMIT))
- printf("[001] Autocommit should be on by default\n");
+ if (1 !== $db->getAttribute(PDO::ATTR_AUTOCOMMIT))
+ printf("[001] Autocommit should be on by default\n");
- if (false == $db->beginTransaction())
- printf("[002] Cannot start a transaction, [%s] [%s]\n",
- $db->errorCode(), implode(' ', $db->errorInfo()));
+ if (false == $db->beginTransaction())
+ printf("[002] Cannot start a transaction, [%s] [%s]\n",
+ $db->errorCode(), implode(' ', $db->errorInfo()));
- if (1 !== $db->getAttribute(PDO::ATTR_AUTOCOMMIT))
- printf("[003] Autocommit should be on by default, beginTransaction() shall not impact it\n");
+ if (1 !== $db->getAttribute(PDO::ATTR_AUTOCOMMIT))
+ printf("[003] Autocommit should be on by default, beginTransaction() shall not impact it\n");
- if (0 == $db->exec('DELETE FROM test'))
- printf("[004] No rows deleted, can't be true.\n");
+ if (0 == $db->exec('DELETE FROM test'))
+ printf("[004] No rows deleted, can't be true.\n");
- /* This is the PDO way to close a connection */
- $db = null;
- $db = MySQLPDOTest::factory();
+ /* This is the PDO way to close a connection */
+ $db = null;
+ $db = MySQLPDOTest::factory();
- /* Autocommit was off - by definition. Commit was not issued. DELETE should have been rolled back. */
- if (!($stmt = $db->query('SELECT id, label FROM test ORDER BY id ASC')))
- printf("[005] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
+ /* Autocommit was off - by definition. Commit was not issued. DELETE should have been rolled back. */
+ if (!($stmt = $db->query('SELECT id, label FROM test ORDER BY id ASC')))
+ printf("[005] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
- $row = $stmt->fetch(PDO::FETCH_ASSOC);
- var_dump($row);
+ $row = $stmt->fetch(PDO::FETCH_ASSOC);
+ var_dump($row);
- if (!$db->beginTransaction())
- printf("[006] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
+ if (!$db->beginTransaction())
+ printf("[006] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
- if (1 !== $db->exec(sprintf('DELETE FROM test WHERE id = %d', $row['id'])))
- printf("[007] DELETE should have indicated 1 deleted row, [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
+ if (1 !== $db->exec(sprintf('DELETE FROM test WHERE id = %d', $row['id'])))
+ printf("[007] DELETE should have indicated 1 deleted row, [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
- if (!$db->commit())
- printf("[008] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
+ if (!$db->commit())
+ printf("[008] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
- if (1 !== $db->getAttribute(PDO::ATTR_AUTOCOMMIT))
- printf("[009] Autocommit should be on after commit()\n");
+ if (1 !== $db->getAttribute(PDO::ATTR_AUTOCOMMIT))
+ printf("[009] Autocommit should be on after commit()\n");
- if (!($stmt = $db->query(sprintf('SELECT id, label FROM test WHERE id = %d', $row['id']))))
- printf("[010] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
+ if (!($stmt = $db->query(sprintf('SELECT id, label FROM test WHERE id = %d', $row['id']))))
+ printf("[010] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
- var_dump($stmt->fetch(PDO::FETCH_ASSOC));
+ var_dump($stmt->fetch(PDO::FETCH_ASSOC));
- if (!$db->beginTransaction())
- printf("[011] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
+ if (!$db->beginTransaction())
+ printf("[011] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
- $db->exec(sprintf("INSERT INTO test(id, label) VALUES (%d, 'z')", $row['id']));
+ $db->exec(sprintf("INSERT INTO test(id, label) VALUES (%d, 'z')", $row['id']));
- if (!($stmt = $db->query(sprintf('SELECT id, label FROM test WHERE id = %d', $row['id']))))
- printf("[012] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
+ if (!($stmt = $db->query(sprintf('SELECT id, label FROM test WHERE id = %d', $row['id']))))
+ printf("[012] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
- $new_row1 = $stmt->fetch(PDO::FETCH_ASSOC);
- var_dump($new_row1);
+ $new_row1 = $stmt->fetch(PDO::FETCH_ASSOC);
+ var_dump($new_row1);
- if (!$db->commit())
- printf("[013] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
+ if (!$db->commit())
+ printf("[013] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
- if (!($stmt = $db->query(sprintf('SELECT id, label FROM test WHERE id = %d', $row['id']))))
- printf("[014] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
+ if (!($stmt = $db->query(sprintf('SELECT id, label FROM test WHERE id = %d', $row['id']))))
+ printf("[014] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
- $new_row2 = $stmt->fetch(PDO::FETCH_ASSOC);
- if ($new_row1 != $new_row2) {
- printf("[015] Results must not differ!\n");
- var_dump($new_row1);
- var_dump($new_row2);
- }
+ $new_row2 = $stmt->fetch(PDO::FETCH_ASSOC);
+ if ($new_row1 != $new_row2) {
+ printf("[015] Results must not differ!\n");
+ var_dump($new_row1);
+ var_dump($new_row2);
+ }
- if (!$db->beginTransaction())
- printf("[016] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
+ if (!$db->beginTransaction())
+ printf("[016] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
- if (1 !== $db->exec(sprintf('DELETE FROM test WHERE id = %d', $row['id'])))
- printf("[017] DELETE should have indicated 1 deleted row, [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
+ if (1 !== $db->exec(sprintf('DELETE FROM test WHERE id = %d', $row['id'])))
+ printf("[017] DELETE should have indicated 1 deleted row, [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
- if (!$db->rollback())
- printf("[018] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
+ if (!$db->rollback())
+ printf("[018] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
- if (1 !== $db->getAttribute(PDO::ATTR_AUTOCOMMIT))
- printf("[019] Autocommit should be on after rollback\n");
+ if (1 !== $db->getAttribute(PDO::ATTR_AUTOCOMMIT))
+ printf("[019] Autocommit should be on after rollback\n");
- if (!($stmt = $db->query(sprintf('SELECT id, label FROM test WHERE id = %d', $row['id']))))
- printf("[020] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
+ if (!($stmt = $db->query(sprintf('SELECT id, label FROM test WHERE id = %d', $row['id']))))
+ printf("[020] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
- $new_row2 = $stmt->fetch(PDO::FETCH_ASSOC);
- if ($new_row1 != $new_row2) {
- printf("[021] Results must not differ!\n");
- var_dump($new_row1);
- var_dump($new_row2);
- }
+ $new_row2 = $stmt->fetch(PDO::FETCH_ASSOC);
+ if ($new_row1 != $new_row2) {
+ printf("[021] Results must not differ!\n");
+ var_dump($new_row1);
+ var_dump($new_row2);
+ }
- // now, lets check the server variables
- if (!($stmt = $db->query('SELECT @@autocommit as auto_commit')))
- printf("[022] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
+ // now, lets check the server variables
+ if (!($stmt = $db->query('SELECT @@autocommit as auto_commit')))
+ printf("[022] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
- $tmp = $stmt->fetch(PDO::FETCH_ASSOC);
- if ($tmp['auto_commit'] != 1)
- printf("[023] MySQL Server should indicate autocommit mode, expecting 1, got '%s', [%d] %s\n",
- $tmp['auto_commit'], $stmt->errorCode(), $stmt->errorInfo());
+ $tmp = $stmt->fetch(PDO::FETCH_ASSOC);
+ if ($tmp['auto_commit'] != 1)
+ printf("[023] MySQL Server should indicate autocommit mode, expecting 1, got '%s', [%d] %s\n",
+ $tmp['auto_commit'], $stmt->errorCode(), $stmt->errorInfo());
- if (!$db->beginTransaction())
- printf("[024] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
+ if (!$db->beginTransaction())
+ printf("[024] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
- if (!($stmt = $db->query('SELECT @@autocommit as auto_commit')))
- printf("[025] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
+ if (!($stmt = $db->query('SELECT @@autocommit as auto_commit')))
+ printf("[025] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
- $tmp = $stmt->fetch(PDO::FETCH_ASSOC);
- if ($tmp['auto_commit'] != 0)
- printf("[026] Autocommit mode of the MySQL Server should be off, got '%s', [%d] %s\n",
- $tmp['auto_commit'], $stmt->errorCode(), trim(implode(' ', $stmt->errorInfo())));
+ $tmp = $stmt->fetch(PDO::FETCH_ASSOC);
+ if ($tmp['auto_commit'] != 0)
+ printf("[026] Autocommit mode of the MySQL Server should be off, got '%s', [%d] %s\n",
+ $tmp['auto_commit'], $stmt->errorCode(), trim(implode(' ', $stmt->errorInfo())));
- $db->commit();
- // Now we should be back to autocommit - we've issues a commit
- if ($tmp['auto_commit'] != 1)
- printf("[027] MySQL Server should indicate autocommit mode, expecting 1, got '%s', [%d] %s\n",
- $tmp['auto_commit'], $stmt->errorCode(), $stmt->errorInfo());
+ $db->commit();
+ // Now we should be back to autocommit - we've issues a commit
+ if ($tmp['auto_commit'] != 1)
+ printf("[027] MySQL Server should indicate autocommit mode, expecting 1, got '%s', [%d] %s\n",
+ $tmp['auto_commit'], $stmt->errorCode(), $stmt->errorInfo());
- // Turn off autocommit using a server variable
- $db->exec('SET @@autocommit = 0');
- if (1 === $db->getAttribute(PDO::ATTR_AUTOCOMMIT))
- printf("[028] I'm confused, how can autocommit be on? Didn't I say I want to manually control transactions?\n");
+ // Turn off autocommit using a server variable
+ $db->exec('SET @@autocommit = 0');
+ if (1 === $db->getAttribute(PDO::ATTR_AUTOCOMMIT))
+ printf("[028] I'm confused, how can autocommit be on? Didn't I say I want to manually control transactions?\n");
- if (!$db->beginTransaction())
- printf("[029] Cannot start a transaction, [%d] %s\n",
- $db->errorCode(), implode(' ', $db->errorInfo()));
+ if (!$db->beginTransaction())
+ printf("[029] Cannot start a transaction, [%d] %s\n",
+ $db->errorCode(), implode(' ', $db->errorInfo()));
- try {
- if (false !== $db->beginTransaction()) {
- printf("[030] No false and no exception - that's wrong.\n");
- }
- } catch (PDOException $e) {
- assert($e->getMessage() != '');
- }
+ try {
+ if (false !== $db->beginTransaction()) {
+ printf("[030] No false and no exception - that's wrong.\n");
+ }
+ } catch (PDOException $e) {
+ assert($e->getMessage() != '');
+ }
- // TODO: What about an engine that does not support transactions?
- $db = MySQLPDOTest::factory();
- MySQLPDOTest::createTestTable($db, 'MyISAM');
+ // TODO: What about an engine that does not support transactions?
+ $db = MySQLPDOTest::factory();
+ MySQLPDOTest::createTestTable($db, 'MyISAM');
- if (false == $db->beginTransaction())
- printf("[031] Cannot start a transaction, [%s] [%s]\n",
- $db->errorCode(), implode(' ', $db->errorInfo()));
+ if (false == $db->beginTransaction())
+ printf("[031] Cannot start a transaction, [%s] [%s]\n",
+ $db->errorCode(), implode(' ', $db->errorInfo()));
- if (1 !== $db->getAttribute(PDO::ATTR_AUTOCOMMIT))
- printf("[032] Autocommit should be on my default, beginTransaction() should not change that\n");
+ if (1 !== $db->getAttribute(PDO::ATTR_AUTOCOMMIT))
+ printf("[032] Autocommit should be on my default, beginTransaction() should not change that\n");
- if (0 == $db->exec('DELETE FROM test'))
- printf("[033] No rows deleted, can't be true.\n");
+ if (0 == $db->exec('DELETE FROM test'))
+ printf("[033] No rows deleted, can't be true.\n");
- if (!$db->commit())
- printf("[034] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
+ if (!$db->commit())
+ printf("[034] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
- if (false == $db->beginTransaction())
- printf("[035] Cannot start a transaction, [%s] [%s]\n",
- $db->errorCode(), implode(' ', $db->errorInfo()));
+ if (false == $db->beginTransaction())
+ printf("[035] Cannot start a transaction, [%s] [%s]\n",
+ $db->errorCode(), implode(' ', $db->errorInfo()));
- if (0 == $db->exec("INSERT INTO test(id, label) VALUES (1, 'a')"))
- printf("[036] Cannot insert data, [%s] [%s]\n",
- $db->errorCode(), implode(' ', $db->errorInfo()));
+ if (0 == $db->exec("INSERT INTO test(id, label) VALUES (1, 'a')"))
+ printf("[036] Cannot insert data, [%s] [%s]\n",
+ $db->errorCode(), implode(' ', $db->errorInfo()));
- // Should cause a Server warning but no error
- if (!$db->rollback())
- printf("[037] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
+ // Should cause a Server warning but no error
+ if (!$db->rollback())
+ printf("[037] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
- var_dump($db->errorCode());
+ var_dump($db->errorCode());
- if (1 != $db->exec('DELETE FROM test'))
- printf("[038] No rows deleted, can't be true.\n");
+ if (1 != $db->exec('DELETE FROM test'))
+ printf("[038] No rows deleted, can't be true.\n");
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_bit.phpt b/ext/pdo_mysql/tests/pdo_mysql_bit.phpt
index caa81e96ac..9e53f18154 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_bit.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_bit.phpt
@@ -10,42 +10,42 @@ if (MySQLPDOTest::isPDOMySQLnd())
?>
--FILE--
<?php
- /* TODO: remove this test after fix and enable the BIT test in pdo_mysql_types.phpt again */
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ /* TODO: remove this test after fix and enable the BIT test in pdo_mysql_types.phpt again */
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- function test_type(&$db, $offset, $sql_type, $value, $ret_value = NULL, $pattern = NULL) {
+ function test_type(&$db, $offset, $sql_type, $value, $ret_value = NULL, $pattern = NULL) {
- $db->exec('DROP TABLE IF EXISTS test');
- $sql = sprintf('CREATE TABLE test(id INT, label %s) ENGINE=%s', $sql_type, MySQLPDOTest::getTableEngine());
- @$db->exec($sql);
- if ($db->errorCode() != 0) {
- // not all MySQL Server versions and/or engines might support the type
- return true;
- }
+ $db->exec('DROP TABLE IF EXISTS test');
+ $sql = sprintf('CREATE TABLE test(id INT, label %s) ENGINE=%s', $sql_type, MySQLPDOTest::getTableEngine());
+ @$db->exec($sql);
+ if ($db->errorCode() != 0) {
+ // not all MySQL Server versions and/or engines might support the type
+ return true;
+ }
- $stmt = $db->prepare('INSERT INTO test(id, label) VALUES (?, ?)');
- $stmt->bindValue(1, $offset);
- $stmt->bindValue(2, $value);
- if (!$stmt->execute()) {
- printf("[%03d + 1] INSERT failed, %s\n", $offset, var_export($stmt->errorInfo(), true));
- return false;
- }
- $stmt = $db->query('SELECT id, label FROM test');
- $row = $stmt->fetch(PDO::FETCH_ASSOC);
- var_dump($row);
- var_dump($value);
+ $stmt = $db->prepare('INSERT INTO test(id, label) VALUES (?, ?)');
+ $stmt->bindValue(1, $offset);
+ $stmt->bindValue(2, $value);
+ if (!$stmt->execute()) {
+ printf("[%03d + 1] INSERT failed, %s\n", $offset, var_export($stmt->errorInfo(), true));
+ return false;
+ }
+ $stmt = $db->query('SELECT id, label FROM test');
+ $row = $stmt->fetch(PDO::FETCH_ASSOC);
+ var_dump($row);
+ var_dump($value);
- return true;
- }
+ return true;
+ }
- $db = MySQLPDOTest::factory();
- $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
- $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
+ $db = MySQLPDOTest::factory();
+ $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+ $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
+ $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
- test_type($db, 20, 'BIT(8)', 1);
+ test_type($db, 20, 'BIT(8)', 1);
- echo "done!\n";
+ echo "done!\n";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_class_constants.phpt b/ext/pdo_mysql/tests/pdo_mysql_class_constants.phpt
index 05f3151e8b..e5809c5a76 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_class_constants.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_class_constants.phpt
@@ -11,95 +11,95 @@ if (!extension_loaded('mysqli') && !extension_loaded('mysqlnd')) {
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $expected = array(
- 'MYSQL_ATTR_USE_BUFFERED_QUERY' => true,
- 'MYSQL_ATTR_LOCAL_INFILE' => true,
- 'MYSQL_ATTR_DIRECT_QUERY' => true,
- 'MYSQL_ATTR_FOUND_ROWS' => true,
- 'MYSQL_ATTR_IGNORE_SPACE' => true,
- 'MYSQL_ATTR_INIT_COMMAND' => true,
- "MYSQL_ATTR_SSL_KEY" => true,
- "MYSQL_ATTR_SSL_CERT" => true,
- "MYSQL_ATTR_SSL_CA" => true,
- "MYSQL_ATTR_SSL_CAPATH" => true,
- "MYSQL_ATTR_SSL_CIPHER" => true,
- "MYSQL_ATTR_COMPRESS" => true,
- "MYSQL_ATTR_MULTI_STATEMENTS" => true,
- "MYSQL_ATTR_SSL_VERIFY_SERVER_CERT" => true,
- );
+ $expected = array(
+ 'MYSQL_ATTR_USE_BUFFERED_QUERY' => true,
+ 'MYSQL_ATTR_LOCAL_INFILE' => true,
+ 'MYSQL_ATTR_DIRECT_QUERY' => true,
+ 'MYSQL_ATTR_FOUND_ROWS' => true,
+ 'MYSQL_ATTR_IGNORE_SPACE' => true,
+ 'MYSQL_ATTR_INIT_COMMAND' => true,
+ "MYSQL_ATTR_SSL_KEY" => true,
+ "MYSQL_ATTR_SSL_CERT" => true,
+ "MYSQL_ATTR_SSL_CA" => true,
+ "MYSQL_ATTR_SSL_CAPATH" => true,
+ "MYSQL_ATTR_SSL_CIPHER" => true,
+ "MYSQL_ATTR_COMPRESS" => true,
+ "MYSQL_ATTR_MULTI_STATEMENTS" => true,
+ "MYSQL_ATTR_SSL_VERIFY_SERVER_CERT" => true,
+ );
- if (!MySQLPDOTest::isPDOMySQLnd()) {
- $expected['MYSQL_ATTR_MAX_BUFFER_SIZE'] = true;
- $expected['MYSQL_ATTR_READ_DEFAULT_FILE'] = true;
- $expected['MYSQL_ATTR_READ_DEFAULT_GROUP'] = true;
- }
+ if (!MySQLPDOTest::isPDOMySQLnd()) {
+ $expected['MYSQL_ATTR_MAX_BUFFER_SIZE'] = true;
+ $expected['MYSQL_ATTR_READ_DEFAULT_FILE'] = true;
+ $expected['MYSQL_ATTR_READ_DEFAULT_GROUP'] = true;
+ }
- if (extension_loaded('mysqlnd')) {
- $expected['MYSQL_ATTR_SERVER_PUBLIC_KEY'] = true;
- } else if (extension_loaded('mysqli')) {
- if (mysqli_get_client_version() > 50605) {
- $expected['MYSQL_ATTR_SERVER_PUBLIC_KEY'] = true;
- }
- } else if (MySQLPDOTest::getClientVersion(MySQLPDOTest::factory()) > 50605) {
- /* XXX the MySQL client library version isn't exposed with any
- constants, the single possibility is to use the PDO::getAttribute().
- This however will fail with no connection. */
- $expected['MYSQL_ATTR_SERVER_PUBLIC_KEY'] = true;
- }
+ if (extension_loaded('mysqlnd')) {
+ $expected['MYSQL_ATTR_SERVER_PUBLIC_KEY'] = true;
+ } else if (extension_loaded('mysqli')) {
+ if (mysqli_get_client_version() > 50605) {
+ $expected['MYSQL_ATTR_SERVER_PUBLIC_KEY'] = true;
+ }
+ } else if (MySQLPDOTest::getClientVersion(MySQLPDOTest::factory()) > 50605) {
+ /* XXX the MySQL client library version isn't exposed with any
+ constants, the single possibility is to use the PDO::getAttribute().
+ This however will fail with no connection. */
+ $expected['MYSQL_ATTR_SERVER_PUBLIC_KEY'] = true;
+ }
- /*
- TODO
+ /*
+ TODO
- MYSQLI_OPT_CONNECT_TIMEOUT != PDO::ATTR_TIMEOUT (integer)
+ MYSQLI_OPT_CONNECT_TIMEOUT != PDO::ATTR_TIMEOUT (integer)
Sets the timeout value in seconds for communications with the database.
- ^ Potential BUG, PDO::ATTR_TIMEOUT is used in pdo_mysql_handle_factory
+ ^ Potential BUG, PDO::ATTR_TIMEOUT is used in pdo_mysql_handle_factory
- MYSQLI_SET_CHARSET_NAME -> DSN/charset=<charset_name>
- ^ Undocumented and pitfall for ext/mysqli users
+ MYSQLI_SET_CHARSET_NAME -> DSN/charset=<charset_name>
+ ^ Undocumented and pitfall for ext/mysqli users
- Assorted mysqlnd settings missing
- */
- $ref = new ReflectionClass('PDO');
- $constants = $ref->getConstants();
- $values = array();
+ Assorted mysqlnd settings missing
+ */
+ $ref = new ReflectionClass('PDO');
+ $constants = $ref->getConstants();
+ $values = array();
- foreach ($constants as $name => $value)
- if (substr($name, 0, 11) == 'MYSQL_ATTR_') {
- if (!isset($values[$value]))
- $values[$value] = array($name);
- else
- $values[$value][] = $name;
+ foreach ($constants as $name => $value)
+ if (substr($name, 0, 11) == 'MYSQL_ATTR_') {
+ if (!isset($values[$value]))
+ $values[$value] = array($name);
+ else
+ $values[$value][] = $name;
- if (isset($expected[$name])) {
- unset($expected[$name]);
- unset($constants[$name]);
- }
+ if (isset($expected[$name])) {
+ unset($expected[$name]);
+ unset($constants[$name]);
+ }
- } else {
- unset($constants[$name]);
- }
+ } else {
+ unset($constants[$name]);
+ }
- if (!empty($constants)) {
- printf("[001] Dumping list of unexpected constants\n");
- var_dump($constants);
- }
+ if (!empty($constants)) {
+ printf("[001] Dumping list of unexpected constants\n");
+ var_dump($constants);
+ }
- if (!empty($expected)) {
- printf("[002] Dumping list of missing constants\n");
- var_dump($expected);
- }
+ if (!empty($expected)) {
+ printf("[002] Dumping list of missing constants\n");
+ var_dump($expected);
+ }
- if (!empty($values)) {
- foreach ($values as $value => $constants) {
- if (count($constants) > 1) {
- printf("[003] Several constants share the same value '%s'\n", $value);
- var_dump($constants);
- }
- }
- }
+ if (!empty($values)) {
+ foreach ($values as $value => $constants) {
+ if (count($constants) > 1) {
+ printf("[003] Several constants share the same value '%s'\n", $value);
+ var_dump($constants);
+ }
+ }
+ }
- print "done!";
+ print "done!";
--EXPECT--
done!
diff --git a/ext/pdo_mysql/tests/pdo_mysql_commit.phpt b/ext/pdo_mysql/tests/pdo_mysql_commit.phpt
index 6141ff611b..9dec5700b6 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_commit.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_commit.phpt
@@ -11,74 +11,74 @@ if (false == MySQLPDOTest::detect_transactional_mysql_engine($db))
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
- MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db));
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
+ MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db));
- try {
- if (true !== ($tmp = $db->beginTransaction())) {
- printf("[001] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
- }
+ try {
+ if (true !== ($tmp = $db->beginTransaction())) {
+ printf("[001] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
+ }
- // DDL will issue an implicit commit
- $db->exec(sprintf('DROP TABLE IF EXISTS test_commit'));
- $db->exec(sprintf('CREATE TABLE test_commit(id INT) ENGINE=%s', MySQLPDOTest::detect_transactional_mysql_engine($db)));
- if (true !== ($tmp = $db->commit())) {
- printf("[002] No commit allowed? [%s] %s\n",
- $db->errorCode(), implode(' ', $db->errorInfo()));
- }
+ // DDL will issue an implicit commit
+ $db->exec(sprintf('DROP TABLE IF EXISTS test_commit'));
+ $db->exec(sprintf('CREATE TABLE test_commit(id INT) ENGINE=%s', MySQLPDOTest::detect_transactional_mysql_engine($db)));
+ if (true !== ($tmp = $db->commit())) {
+ printf("[002] No commit allowed? [%s] %s\n",
+ $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
- // pdo_transaction_transitions should check this as well...
- // ... just to be sure the most basic stuff really works we check it again...
- if (1 !== ($tmp = $db->getAttribute(PDO::ATTR_AUTOCOMMIT)))
- printf("[003] According to the manual we should be back to autocommit mode, got %s/%s\n",
- gettype($tmp), var_export($tmp, true));
+ // pdo_transaction_transitions should check this as well...
+ // ... just to be sure the most basic stuff really works we check it again...
+ if (1 !== ($tmp = $db->getAttribute(PDO::ATTR_AUTOCOMMIT)))
+ printf("[003] According to the manual we should be back to autocommit mode, got %s/%s\n",
+ gettype($tmp), var_export($tmp, true));
- if (true !== ($tmp = $db->beginTransaction()))
- printf("[004] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = $db->beginTransaction()))
+ printf("[004] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
- $db->exec("INSERT INTO test(id, label) VALUES (100, 'z')");
+ $db->exec("INSERT INTO test(id, label) VALUES (100, 'z')");
- if (true !== ($tmp = $db->commit()))
- printf("[005] No commit allowed? [%s] %s\n",
- $db->errorCode(), implode(' ', $db->errorInfo()));
+ if (true !== ($tmp = $db->commit()))
+ printf("[005] No commit allowed? [%s] %s\n",
+ $db->errorCode(), implode(' ', $db->errorInfo()));
- // a weak test without unicode etc. - lets leave that to dedicated tests
- $stmt = $db->query('SELECT id, label FROM test WHERE id = 100');
- $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
- if (!isset($rows[0]['label']) || ($rows[0]['label'] != 'z')) {
- printf("[006] Record data is strange, dumping rows\n");
- var_dump($rows);
- }
+ // a weak test without unicode etc. - lets leave that to dedicated tests
+ $stmt = $db->query('SELECT id, label FROM test WHERE id = 100');
+ $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
+ if (!isset($rows[0]['label']) || ($rows[0]['label'] != 'z')) {
+ printf("[006] Record data is strange, dumping rows\n");
+ var_dump($rows);
+ }
- // Ok, lets check MyISAM resp. any other non-transactional engine
- // pdo_mysql_begin_transaction has more on this, quick check only
- $db = MySQLPDOTest::factory();
- MySQLPDOTest::createTestTable($db, 'MyISAM');
+ // Ok, lets check MyISAM resp. any other non-transactional engine
+ // pdo_mysql_begin_transaction has more on this, quick check only
+ $db = MySQLPDOTest::factory();
+ MySQLPDOTest::createTestTable($db, 'MyISAM');
- if (true !== ($tmp = $db->beginTransaction()))
- printf("[007] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
+ if (true !== ($tmp = $db->beginTransaction()))
+ printf("[007] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
- $db->exec("INSERT INTO test(id, label) VALUES (100, 'z')");
- if (true !== ($tmp = $db->commit()))
- printf("[008] No commit allowed? [%s] %s\n",
- $db->errorCode(), implode(' ', $db->errorInfo()));
+ $db->exec("INSERT INTO test(id, label) VALUES (100, 'z')");
+ if (true !== ($tmp = $db->commit()))
+ printf("[008] No commit allowed? [%s] %s\n",
+ $db->errorCode(), implode(' ', $db->errorInfo()));
- // a weak test without unicode etc. - lets leave that to dedicated tests
- $stmt = $db->query('SELECT id, label FROM test WHERE id = 100');
- $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
- if (!isset($rows[0]['label']) || ($rows[0]['label'] != 'z')) {
- printf("[009] Record data is strange, dumping rows\n");
- var_dump($rows);
- }
+ // a weak test without unicode etc. - lets leave that to dedicated tests
+ $stmt = $db->query('SELECT id, label FROM test WHERE id = 100');
+ $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
+ if (!isset($rows[0]['label']) || ($rows[0]['label'] != 'z')) {
+ printf("[009] Record data is strange, dumping rows\n");
+ var_dump($rows);
+ }
- } catch (PDOException $e) {
- printf("[002] %s, [%s] %s\n",
- $e->getMessage(),
- $db->errorCode(), implode(' ', $db->errorInfo()));
- }
+ } catch (PDOException $e) {
+ printf("[002] %s, [%s] %s\n",
+ $e->getMessage(),
+ $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
- print "done!";
+ print "done!";
--CLEAN--
<?php
require __DIR__ . '/mysql_pdo_test.inc';
diff --git a/ext/pdo_mysql/tests/pdo_mysql_connect_charset.phpt b/ext/pdo_mysql/tests/pdo_mysql_connect_charset.phpt
index 84ce556d32..294d45e586 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_connect_charset.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_connect_charset.phpt
@@ -8,26 +8,26 @@ MySQLPDOTest::skip();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- /* Connect to mysql to determine the current charset so we can diffinate it */
- $link = MySQLPDOTest::factory();
- $charset = $link->query("SHOW VARIABLES LIKE 'character_set_connection'")->fetchObject()->value;
+ /* Connect to mysql to determine the current charset so we can diffinate it */
+ $link = MySQLPDOTest::factory();
+ $charset = $link->query("SHOW VARIABLES LIKE 'character_set_connection'")->fetchObject()->value;
- /* Make sure that we don't attempt to set the current character set to make this case useful */
- $new_charset = ($charset == 'latin1' ? 'ascii' : 'latin1');
+ /* Make sure that we don't attempt to set the current character set to make this case useful */
+ $new_charset = ($charset == 'latin1' ? 'ascii' : 'latin1');
- /* Done with the original connection, create a second link to test the character set being defined */
- unset($link);
+ /* Done with the original connection, create a second link to test the character set being defined */
+ unset($link);
- $link = MySQLPDOTest::factory('PDO', false, null, Array('charset' => $new_charset));
- $conn_charset = $link->query("SHOW VARIABLES LIKE 'character_set_connection'")->fetchObject()->value;
+ $link = MySQLPDOTest::factory('PDO', false, null, Array('charset' => $new_charset));
+ $conn_charset = $link->query("SHOW VARIABLES LIKE 'character_set_connection'")->fetchObject()->value;
- if ($charset !== $conn_charset) {
- echo "done!\n";
- } else {
- echo "failed!\n";
- }
+ if ($charset !== $conn_charset) {
+ echo "done!\n";
+ } else {
+ echo "failed!\n";
+ }
?>
--EXPECT--
done!
diff --git a/ext/pdo_mysql/tests/pdo_mysql_errorcode.phpt b/ext/pdo_mysql/tests/pdo_mysql_errorcode.phpt
index 5bf6c10448..c2b07100c0 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_errorcode.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_errorcode.phpt
@@ -9,73 +9,73 @@ $db = MySQLPDOTest::factory();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
- MySQLPDOTest::createTestTable($db);
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
+ MySQLPDOTest::createTestTable($db);
- function check_error($offset, &$obj, $expected = '00000') {
+ function check_error($offset, &$obj, $expected = '00000') {
- $code = $obj->errorCode();
- if (($code != $expected) && (($expected != '00000') && ($code != ''))) {
- printf("[%03d] Expecting error code '%s' got code '%s'\n",
- $offset, $expected, $code);
- }
+ $code = $obj->errorCode();
+ if (($code != $expected) && (($expected != '00000') && ($code != ''))) {
+ printf("[%03d] Expecting error code '%s' got code '%s'\n",
+ $offset, $expected, $code);
+ }
- }
+ }
- try {
+ try {
- /*
- If you create a PDOStatement object through PDO->prepare()
- or PDO->query() and invoke an error on the statement handle,
- PDO->errorCode() will not reflect that error. You must call
- PDOStatement->errorCode() to return the error code for an
- operation performed on a particular statement handle.
- */
- $code = $db->errorCode();
- check_error(2, $db);
+ /*
+ If you create a PDOStatement object through PDO->prepare()
+ or PDO->query() and invoke an error on the statement handle,
+ PDO->errorCode() will not reflect that error. You must call
+ PDOStatement->errorCode() to return the error code for an
+ operation performed on a particular statement handle.
+ */
+ $code = $db->errorCode();
+ check_error(2, $db);
- $stmt = $db->query('SELECT id, label FROM test');
- $stmt2 = &$stmt;
- check_error(3, $db);
- check_error(4, $stmt);
+ $stmt = $db->query('SELECT id, label FROM test');
+ $stmt2 = &$stmt;
+ check_error(3, $db);
+ check_error(4, $stmt);
- $db->exec('DROP TABLE IF EXISTS test');
- @$stmt->execute();
- check_error(4, $db);
- check_error(5, $stmt, '42S02');
- check_error(6, $stmt2, '42S02');
+ $db->exec('DROP TABLE IF EXISTS test');
+ @$stmt->execute();
+ check_error(4, $db);
+ check_error(5, $stmt, '42S02');
+ check_error(6, $stmt2, '42S02');
- $db->exec('DROP TABLE IF EXISTS unknown');
- @$stmt = $db->query('SELECT id, label FROM unknown');
- check_error(7, $db, '42S02');
+ $db->exec('DROP TABLE IF EXISTS unknown');
+ @$stmt = $db->query('SELECT id, label FROM unknown');
+ check_error(7, $db, '42S02');
- MySQLPDOTest::createTestTable($db);
- $stmt = $db->query('SELECT id, label FROM test');
- check_error(8, $db);
- check_error(9, $stmt);
+ MySQLPDOTest::createTestTable($db);
+ $stmt = $db->query('SELECT id, label FROM test');
+ check_error(8, $db);
+ check_error(9, $stmt);
- $db2 = &$db;
- @$db->query('SELECT id, label FROM unknown');
- check_error(10, $db, '42S02');
- check_error(11, $db2, '42S02');
- check_error(12, $stmt);
- check_error(13, $stmt2);
+ $db2 = &$db;
+ @$db->query('SELECT id, label FROM unknown');
+ check_error(10, $db, '42S02');
+ check_error(11, $db2, '42S02');
+ check_error(12, $stmt);
+ check_error(13, $stmt2);
- // lets hope this is an invalid attribute code
- $invalid_attr = -1 * PHP_INT_MAX + 3;
- $tmp = @$db->getAttribute($invalid_attr);
- check_error(14, $db, 'IM001');
- check_error(15, $db2, 'IM001');
- check_error(16, $stmt);
- check_error(17, $stmt2);
+ // lets hope this is an invalid attribute code
+ $invalid_attr = -1 * PHP_INT_MAX + 3;
+ $tmp = @$db->getAttribute($invalid_attr);
+ check_error(14, $db, 'IM001');
+ check_error(15, $db2, 'IM001');
+ check_error(16, $stmt);
+ check_error(17, $stmt2);
- } catch (PDOException $e) {
- printf("[001] %s [%s] %s\n",
- $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
- }
+ } catch (PDOException $e) {
+ printf("[001] %s [%s] %s\n",
+ $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_errorinfo.phpt b/ext/pdo_mysql/tests/pdo_mysql_errorinfo.phpt
index 487f8ab97a..2da0f4aaa3 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_errorinfo.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_errorinfo.phpt
@@ -9,92 +9,92 @@ $db = MySQLPDOTest::factory();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
- MySQLPDOTest::createTestTable($db);
-
- function check_error($offset, &$obj, $expected = '00000') {
- $info = $obj->errorInfo();
- $code = $info[0];
-
- if (($code != $expected) && (($expected != '00000') && ($code != ''))) {
- printf("[%03d] Expecting error code '%s' got code '%s'\n",
- $offset, $expected, $code);
- }
-
- if ($expected != '00000') {
- if (!isset($info[1]) || $info[1] == '')
- printf("[%03d] Driver-specific error code not set\n", $offset);
- if (!isset($info[2]) || $info[2] == '')
- printf("[%03d] Driver-specific error message.not set\n", $offset);
- }
-
- }
-
- function pdo_mysql_errorinfo($db, $offset) {
-
- try {
-
- /*
- If you create a PDOStatement object through PDO->prepare()
- or PDO->query() and invoke an error on the statement handle,
- PDO->errorCode() will not reflect that error. You must call
- PDOStatement->errorCode() to return the error code for an
- operation performed on a particular statement handle.
- */
- $code = $db->errorCode();
- check_error($offset + 2, $db);
-
- $stmt = $db->query('SELECT id, label FROM test');
- $stmt2 = &$stmt;
- check_error($offset + 3, $db);
- check_error($offset + 4, $stmt);
-
- $db->exec('DROP TABLE IF EXISTS test');
- @$stmt->execute();
- check_error($offset + 5, $db);
- check_error($offset + 6, $stmt, '42S02');
- check_error($offset + 7, $stmt2, '42S02');
-
- @$stmt = $db->query('SELECT id, label FROM unknown');
- check_error($offset + 8, $db, '42S02');
-
- MySQLPDOTest::createTestTable($db);
- $stmt = $db->query('SELECT id, label FROM test');
- check_error($offset + 9, $db);
- check_error($offset + 10, $stmt);
-
- $db2 = &$db;
- $db->exec('DROP TABLE IF EXISTS unknown');
- @$db->query('SELECT id, label FROM unknown');
- check_error($offset + 11, $db, '42S02');
- check_error($offset + 12, $db2, '42S02');
- check_error($offset + 13, $stmt);
- check_error($offset + 14, $stmt2);
-
- // lets hope this is an invalid attribute code
- $invalid_attr = -1 * PHP_INT_MAX + 3;
- $tmp = @$db->getAttribute($invalid_attr);
- check_error($offset + 15, $db, 'IM001');
- check_error($offset + 16, $db2, 'IM001');
- check_error($offset + 17, $stmt);
- check_error($offset + 18, $stmt2);
-
- } catch (PDOException $e) {
- printf("[%03d] %s [%s] %s\n",
- $offset + 19, $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
- }
- }
-
- $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1);
- printf("Emulated Prepared Statements...\n");
- pdo_mysql_errorinfo($db, 0);
-
- $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
- printf("Native Prepared Statements...\n");
- pdo_mysql_errorinfo($db, 20);
-
- print "done!";
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
+ MySQLPDOTest::createTestTable($db);
+
+ function check_error($offset, &$obj, $expected = '00000') {
+ $info = $obj->errorInfo();
+ $code = $info[0];
+
+ if (($code != $expected) && (($expected != '00000') && ($code != ''))) {
+ printf("[%03d] Expecting error code '%s' got code '%s'\n",
+ $offset, $expected, $code);
+ }
+
+ if ($expected != '00000') {
+ if (!isset($info[1]) || $info[1] == '')
+ printf("[%03d] Driver-specific error code not set\n", $offset);
+ if (!isset($info[2]) || $info[2] == '')
+ printf("[%03d] Driver-specific error message.not set\n", $offset);
+ }
+
+ }
+
+ function pdo_mysql_errorinfo($db, $offset) {
+
+ try {
+
+ /*
+ If you create a PDOStatement object through PDO->prepare()
+ or PDO->query() and invoke an error on the statement handle,
+ PDO->errorCode() will not reflect that error. You must call
+ PDOStatement->errorCode() to return the error code for an
+ operation performed on a particular statement handle.
+ */
+ $code = $db->errorCode();
+ check_error($offset + 2, $db);
+
+ $stmt = $db->query('SELECT id, label FROM test');
+ $stmt2 = &$stmt;
+ check_error($offset + 3, $db);
+ check_error($offset + 4, $stmt);
+
+ $db->exec('DROP TABLE IF EXISTS test');
+ @$stmt->execute();
+ check_error($offset + 5, $db);
+ check_error($offset + 6, $stmt, '42S02');
+ check_error($offset + 7, $stmt2, '42S02');
+
+ @$stmt = $db->query('SELECT id, label FROM unknown');
+ check_error($offset + 8, $db, '42S02');
+
+ MySQLPDOTest::createTestTable($db);
+ $stmt = $db->query('SELECT id, label FROM test');
+ check_error($offset + 9, $db);
+ check_error($offset + 10, $stmt);
+
+ $db2 = &$db;
+ $db->exec('DROP TABLE IF EXISTS unknown');
+ @$db->query('SELECT id, label FROM unknown');
+ check_error($offset + 11, $db, '42S02');
+ check_error($offset + 12, $db2, '42S02');
+ check_error($offset + 13, $stmt);
+ check_error($offset + 14, $stmt2);
+
+ // lets hope this is an invalid attribute code
+ $invalid_attr = -1 * PHP_INT_MAX + 3;
+ $tmp = @$db->getAttribute($invalid_attr);
+ check_error($offset + 15, $db, 'IM001');
+ check_error($offset + 16, $db2, 'IM001');
+ check_error($offset + 17, $stmt);
+ check_error($offset + 18, $stmt2);
+
+ } catch (PDOException $e) {
+ printf("[%03d] %s [%s] %s\n",
+ $offset + 19, $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
+ }
+
+ $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1);
+ printf("Emulated Prepared Statements...\n");
+ pdo_mysql_errorinfo($db, 0);
+
+ $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
+ printf("Native Prepared Statements...\n");
+ pdo_mysql_errorinfo($db, 20);
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_exec.phpt b/ext/pdo_mysql/tests/pdo_mysql_exec.phpt
index 71d93815ff..c6f3d54ddd 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_exec.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_exec.phpt
@@ -8,169 +8,169 @@ MySQLPDOTest::skip();
?>
--FILE--
<?php
- function exec_and_count($offset, &$db, $sql, $exp = NULL) {
-
- try {
-
- $ret = $db->exec($sql);
- if (!is_null($exp) && ($ret !== $exp)) {
- printf("[%03d] Expecting '%s'/%s got '%s'/%s when running '%s', [%s] %s\n",
- $offset, $exp, gettype($exp), $ret, gettype($ret), $sql,
- $db->errorCode(), implode(' ', $db->errorInfo()));
- return false;
- }
-
- } catch (PDOException $e) {
- printf("[%03d] '%s' has failed, [%s] %s\n",
- $offset, $sql, $db->errorCode(), implode(' ', $db->errorInfo()));
- return false;
- }
-
- return true;
- }
-
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
- MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db));
-
- /* affected rows related */
- try {
-
- exec_and_count(2, $db, 'DROP TABLE IF EXISTS test', 0);
- exec_and_count(3, $db, sprintf('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, col1 CHAR(10)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE), 0);
- exec_and_count(4, $db, "INSERT INTO test(id, col1) VALUES (1, 'a')", 1);
- exec_and_count(5, $db, "INSERT INTO test(id, col1) VALUES (2, 'b'), (3, 'c')", 2);
- exec_and_count(6, $db, "UPDATE test SET id = 4 WHERE id = 3", 1);
- exec_and_count(7, $db, "INSERT INTO test(id, col1) VALUES (1, 'd') ON DUPLICATE KEY UPDATE id = 3", 2);
- exec_and_count(8, $db, "UPDATE test SET id = 5 WHERE id = 5", 0);
- exec_and_count(9, $db, "INSERT INTO test(id, col1) VALUES (5, 'e') ON DUPLICATE KEY UPDATE id = 6", 1);
- exec_and_count(10, $db, "REPLACE INTO test(id, col1) VALUES (5, 'f')", 2);
- exec_and_count(11, $db, "REPLACE INTO test(id, col1) VALUES (6, 'g')", 1);
- exec_and_count(12, $db, 'DELETE FROM test WHERE id > 2', 4);
- exec_and_count(13, $db, 'DROP TABLE test', 0);
- exec_and_count(14, $db, 'SET @myvar = 1', 0);
-
- exec_and_count(15, $db, 'THIS IS NOT VALID SQL, I HOPE', false);
- printf("[016] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
-
- exec_and_count(36, $db, sprintf('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, col1 CHAR(10)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE), 0);
- exec_and_count(37, $db, "INSERT INTO test(id, col1) VALUES (1, 'a')", 1);
- // Results may vary. Typically you will get 1. But the MySQL 5.1 manual states: Truncation operations do not return the number of deleted rows.
- // Don't rely on any return value!
- exec_and_count(38, $db, 'TRUNCATE TABLE test', NULL);
-
- } catch (PDOException $e) {
- printf("[001] %s, [%s] %s\n",
- $e->getMessage(),
- $db->errorCode(), implode(' ', $db->errorInfo()));
- }
-
-
- /* CREATE, DROP, CALL SP and SF */
- if (MySQLPDOTest::getServerVersion($db) > 50000) {
- // let's try to play with stored procedures
- try {
- $ignore_exception = true;
- exec_and_count(18, $db, 'DROP PROCEDURE IF EXISTS p', 0);
- exec_and_count(19, $db, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(255)) BEGIN SELECT VERSION() INTO ver_param; END;', 0);
- // we got this far without problems. If there's an issue from now on, its a failure
- $ignore_exception = false;
- exec_and_count(20, $db, 'CALL p(@version)', 1);
- $stmt = $db->query('SELECT @version AS p_version');
- $tmp = $stmt->fetchAll(PDO::FETCH_ASSOC);
- if (count($tmp) > 1 || !isset($tmp[0]['p_version'])) {
- printf("[022] Data seems wrong, dumping\n");
- var_dump($tmp);
- } else {
- $p_version = $tmp[0]['p_version'];
- }
-
- $stmt = $db->query('SELECT VERSION() AS _version');
- $tmp = $stmt->fetchAll(PDO::FETCH_ASSOC);
- if (count($tmp) > 1 || !isset($tmp[0]['_version'])) {
- printf("[023] Data seems wrong, dumping\n");
- var_dump($tmp);
- } else {
- if ($p_version !== $tmp[0]['_version']) {
- printf("[024] Found different version strings, SP returned '%s'/%s, SELECT returned '%s'/%s\n",
- $p_version, gettype($p_version),
- $tmp[0]['_version'], gettype($tmp[0]['_version']));
- }
- }
- exec_and_count(25, $db, 'DROP PROCEDURE IF EXISTS p', 0);
-
- } catch (PDOException $e) {
- // ignore it, we might not have sufficient permissions
- if (!$ignore_exception)
- printf("[021] %s, [%s] %s\n",
- $e->getMessage(),
- $db->errorCode(), implode(' ', $db->errorInfo()));
- }
-
- // stored function
- try {
- $ignore_exception = true;
- exec_and_count(27, $db, 'DROP FUNCTION IF EXISTS f', 0);
- exec_and_count(28, $db, 'CREATE FUNCTION f( ver_param VARCHAR(255)) RETURNS VARCHAR(255) DETERMINISTIC RETURN ver_param;', 0);
- // we got this far without problems. If there's an issue from now on, its a failure
- $ignore_exception = false;
- $stmt = $db->query('SELECT f(VERSION()) AS f_version');
- $tmp = $stmt->fetchAll(PDO::FETCH_ASSOC);
- if (count($tmp) > 1 || !isset($tmp[0]['f_version'])) {
- printf("[029] Data seems wrong, dumping\n");
- var_dump($tmp);
- } else {
- $f_version = $tmp[0]['f_version'];
- }
- $stmt = $db->query('SELECT VERSION() AS _version');
- $tmp = $stmt->fetchAll(PDO::FETCH_ASSOC);
- if (count($tmp) > 1 || !isset($tmp[0]['_version'])) {
- printf("[030] Data seems wrong, dumping\n");
- var_dump($tmp);
- } else {
- if ($f_version !== $tmp[0]['_version']) {
- printf("[031] Found different version strings, SF returned '%s'/%s, SELECT returned '%s'/%s\n",
- $f_version, gettype($f_version),
- $tmp[0]['_version'], gettype($tmp[0]['_version']));
- }
- }
- exec_and_count(32, $db, 'DROP FUNCTION IF EXISTS f', 0);
-
- } catch (PDOException $e) {
- // ignore it, we might not have sufficient permissions
- if (!$ignore_exception)
- printf("[026] %s, [%s] %s\n",
- $e->getMessage(),
- $db->errorCode(), implode(' ', $db->errorInfo()));
- }
- }
-
- // multi query
- try {
-
- $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1);
- $exp = 0;
-
- $tmp = @$db->exec(sprintf('DROP TABLE IF EXISTS test; CREATE TABLE test(id INT) ENGINE=%s', PDO_MYSQL_TEST_ENGINE));
- if ($exp !== $tmp)
- printf("[034] Expecting %s/%s got %s/%s, [%s] %s\n",
- $exp, gettype($exp),
- $tmp, gettype($tmp),
- $db->errorCode(), var_export($db->errorInfo(), true));
-
- // this is interesting: if we get sort of affected rows, what will happen now?
- $tmp = @$db->exec('INSERT INTO test(id) VALUES (1); INSERT INTO test(id) VALUES (2)');
- printf("[035] With emulated PS it works but makes no sense given that exec() returns sort of affected rows...\n");
-
-
- } catch (PDOException $e) {
- printf("[033] %s, [%s] %s\n",
- $e->getMessage(),
- $db->errorCode(), implode(' ', $db->errorInfo()));
- }
- $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
-
- print "done!";
+ function exec_and_count($offset, &$db, $sql, $exp = NULL) {
+
+ try {
+
+ $ret = $db->exec($sql);
+ if (!is_null($exp) && ($ret !== $exp)) {
+ printf("[%03d] Expecting '%s'/%s got '%s'/%s when running '%s', [%s] %s\n",
+ $offset, $exp, gettype($exp), $ret, gettype($ret), $sql,
+ $db->errorCode(), implode(' ', $db->errorInfo()));
+ return false;
+ }
+
+ } catch (PDOException $e) {
+ printf("[%03d] '%s' has failed, [%s] %s\n",
+ $offset, $sql, $db->errorCode(), implode(' ', $db->errorInfo()));
+ return false;
+ }
+
+ return true;
+ }
+
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
+ MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db));
+
+ /* affected rows related */
+ try {
+
+ exec_and_count(2, $db, 'DROP TABLE IF EXISTS test', 0);
+ exec_and_count(3, $db, sprintf('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, col1 CHAR(10)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE), 0);
+ exec_and_count(4, $db, "INSERT INTO test(id, col1) VALUES (1, 'a')", 1);
+ exec_and_count(5, $db, "INSERT INTO test(id, col1) VALUES (2, 'b'), (3, 'c')", 2);
+ exec_and_count(6, $db, "UPDATE test SET id = 4 WHERE id = 3", 1);
+ exec_and_count(7, $db, "INSERT INTO test(id, col1) VALUES (1, 'd') ON DUPLICATE KEY UPDATE id = 3", 2);
+ exec_and_count(8, $db, "UPDATE test SET id = 5 WHERE id = 5", 0);
+ exec_and_count(9, $db, "INSERT INTO test(id, col1) VALUES (5, 'e') ON DUPLICATE KEY UPDATE id = 6", 1);
+ exec_and_count(10, $db, "REPLACE INTO test(id, col1) VALUES (5, 'f')", 2);
+ exec_and_count(11, $db, "REPLACE INTO test(id, col1) VALUES (6, 'g')", 1);
+ exec_and_count(12, $db, 'DELETE FROM test WHERE id > 2', 4);
+ exec_and_count(13, $db, 'DROP TABLE test', 0);
+ exec_and_count(14, $db, 'SET @myvar = 1', 0);
+
+ exec_and_count(15, $db, 'THIS IS NOT VALID SQL, I HOPE', false);
+ printf("[016] [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
+
+ exec_and_count(36, $db, sprintf('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, col1 CHAR(10)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE), 0);
+ exec_and_count(37, $db, "INSERT INTO test(id, col1) VALUES (1, 'a')", 1);
+ // Results may vary. Typically you will get 1. But the MySQL 5.1 manual states: Truncation operations do not return the number of deleted rows.
+ // Don't rely on any return value!
+ exec_and_count(38, $db, 'TRUNCATE TABLE test', NULL);
+
+ } catch (PDOException $e) {
+ printf("[001] %s, [%s] %s\n",
+ $e->getMessage(),
+ $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
+
+
+ /* CREATE, DROP, CALL SP and SF */
+ if (MySQLPDOTest::getServerVersion($db) > 50000) {
+ // let's try to play with stored procedures
+ try {
+ $ignore_exception = true;
+ exec_and_count(18, $db, 'DROP PROCEDURE IF EXISTS p', 0);
+ exec_and_count(19, $db, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(255)) BEGIN SELECT VERSION() INTO ver_param; END;', 0);
+ // we got this far without problems. If there's an issue from now on, its a failure
+ $ignore_exception = false;
+ exec_and_count(20, $db, 'CALL p(@version)', 1);
+ $stmt = $db->query('SELECT @version AS p_version');
+ $tmp = $stmt->fetchAll(PDO::FETCH_ASSOC);
+ if (count($tmp) > 1 || !isset($tmp[0]['p_version'])) {
+ printf("[022] Data seems wrong, dumping\n");
+ var_dump($tmp);
+ } else {
+ $p_version = $tmp[0]['p_version'];
+ }
+
+ $stmt = $db->query('SELECT VERSION() AS _version');
+ $tmp = $stmt->fetchAll(PDO::FETCH_ASSOC);
+ if (count($tmp) > 1 || !isset($tmp[0]['_version'])) {
+ printf("[023] Data seems wrong, dumping\n");
+ var_dump($tmp);
+ } else {
+ if ($p_version !== $tmp[0]['_version']) {
+ printf("[024] Found different version strings, SP returned '%s'/%s, SELECT returned '%s'/%s\n",
+ $p_version, gettype($p_version),
+ $tmp[0]['_version'], gettype($tmp[0]['_version']));
+ }
+ }
+ exec_and_count(25, $db, 'DROP PROCEDURE IF EXISTS p', 0);
+
+ } catch (PDOException $e) {
+ // ignore it, we might not have sufficient permissions
+ if (!$ignore_exception)
+ printf("[021] %s, [%s] %s\n",
+ $e->getMessage(),
+ $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
+
+ // stored function
+ try {
+ $ignore_exception = true;
+ exec_and_count(27, $db, 'DROP FUNCTION IF EXISTS f', 0);
+ exec_and_count(28, $db, 'CREATE FUNCTION f( ver_param VARCHAR(255)) RETURNS VARCHAR(255) DETERMINISTIC RETURN ver_param;', 0);
+ // we got this far without problems. If there's an issue from now on, its a failure
+ $ignore_exception = false;
+ $stmt = $db->query('SELECT f(VERSION()) AS f_version');
+ $tmp = $stmt->fetchAll(PDO::FETCH_ASSOC);
+ if (count($tmp) > 1 || !isset($tmp[0]['f_version'])) {
+ printf("[029] Data seems wrong, dumping\n");
+ var_dump($tmp);
+ } else {
+ $f_version = $tmp[0]['f_version'];
+ }
+ $stmt = $db->query('SELECT VERSION() AS _version');
+ $tmp = $stmt->fetchAll(PDO::FETCH_ASSOC);
+ if (count($tmp) > 1 || !isset($tmp[0]['_version'])) {
+ printf("[030] Data seems wrong, dumping\n");
+ var_dump($tmp);
+ } else {
+ if ($f_version !== $tmp[0]['_version']) {
+ printf("[031] Found different version strings, SF returned '%s'/%s, SELECT returned '%s'/%s\n",
+ $f_version, gettype($f_version),
+ $tmp[0]['_version'], gettype($tmp[0]['_version']));
+ }
+ }
+ exec_and_count(32, $db, 'DROP FUNCTION IF EXISTS f', 0);
+
+ } catch (PDOException $e) {
+ // ignore it, we might not have sufficient permissions
+ if (!$ignore_exception)
+ printf("[026] %s, [%s] %s\n",
+ $e->getMessage(),
+ $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
+ }
+
+ // multi query
+ try {
+
+ $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1);
+ $exp = 0;
+
+ $tmp = @$db->exec(sprintf('DROP TABLE IF EXISTS test; CREATE TABLE test(id INT) ENGINE=%s', PDO_MYSQL_TEST_ENGINE));
+ if ($exp !== $tmp)
+ printf("[034] Expecting %s/%s got %s/%s, [%s] %s\n",
+ $exp, gettype($exp),
+ $tmp, gettype($tmp),
+ $db->errorCode(), var_export($db->errorInfo(), true));
+
+ // this is interesting: if we get sort of affected rows, what will happen now?
+ $tmp = @$db->exec('INSERT INTO test(id) VALUES (1); INSERT INTO test(id) VALUES (2)');
+ printf("[035] With emulated PS it works but makes no sense given that exec() returns sort of affected rows...\n");
+
+
+ } catch (PDOException $e) {
+ printf("[033] %s, [%s] %s\n",
+ $e->getMessage(),
+ $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
+ $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_exec_ddl.phpt b/ext/pdo_mysql/tests/pdo_mysql_exec_ddl.phpt
index 0b2428cc1c..53d36af4ff 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_exec_ddl.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_exec_ddl.phpt
@@ -8,75 +8,75 @@ MySQLPDOTest::skip();
?>
--FILE--
<?php
- function exec_and_count($offset, &$db, $sql, $exp, $suppress_warning = false) {
+ function exec_and_count($offset, &$db, $sql, $exp, $suppress_warning = false) {
- try {
+ try {
- if ($suppress_warning)
- $ret = @$db->exec($sql);
- else
- $ret = $db->exec($sql);
+ if ($suppress_warning)
+ $ret = @$db->exec($sql);
+ else
+ $ret = $db->exec($sql);
- if ($ret !== $exp) {
- printf("[%03d] Expecting '%s'/%s got '%s'/%s when running '%s', [%s] %s\n",
- $offset, $exp, gettype($exp), $ret, gettype($ret), $sql,
- $db->errorCode(), implode(' ', $db->errorInfo()));
- return false;
- }
+ if ($ret !== $exp) {
+ printf("[%03d] Expecting '%s'/%s got '%s'/%s when running '%s', [%s] %s\n",
+ $offset, $exp, gettype($exp), $ret, gettype($ret), $sql,
+ $db->errorCode(), implode(' ', $db->errorInfo()));
+ return false;
+ }
- } catch (PDOException $e) {
- printf("[%03d] '%s' has failed, [%s] %s\n",
- $offset, $sql, $db->errorCode(), implode(' ', $db->errorInfo()));
- return false;
- }
+ } catch (PDOException $e) {
+ printf("[%03d] '%s' has failed, [%s] %s\n",
+ $offset, $sql, $db->errorCode(), implode(' ', $db->errorInfo()));
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
- MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db));
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
+ MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db));
- /* affected rows related */
- try {
+ /* affected rows related */
+ try {
- @$db->exec('DROP DATABASE IF EXISTS pdo_exec_ddl');
- @$db->exec('DROP DATABASE IF EXISTS pdo_exec_ddl2');
- if (1 === @$db->exec('CREATE DATABASE pdo_exec_ddl')) {
- // yippie - we can create databases etc.
- exec_and_count(3, $db, 'ALTER DATABASE pdo_exec_ddl CHARACTER SET latin1', 1);
- }
+ @$db->exec('DROP DATABASE IF EXISTS pdo_exec_ddl');
+ @$db->exec('DROP DATABASE IF EXISTS pdo_exec_ddl2');
+ if (1 === @$db->exec('CREATE DATABASE pdo_exec_ddl')) {
+ // yippie - we can create databases etc.
+ exec_and_count(3, $db, 'ALTER DATABASE pdo_exec_ddl CHARACTER SET latin1', 1);
+ }
- exec_and_count(4, $db, 'DROP TABLE IF EXISTS pdo_exec_ddl', 0);
- exec_and_count(5, $db, 'DROP TABLE IF EXISTS pdo_exec_ddl2', 0);
- if (0 === $db->exec('CREATE TABLE pdo_exec_ddl(id INT, col1 CHAR(2))')) {
- exec_and_count(5, $db, 'CREATE INDEX idx1 ON pdo_exec_ddl(id)', 0);
- exec_and_count(6, $db, 'DROP INDEX idx1 ON pdo_exec_ddl', 0);
- exec_and_count(7, $db, 'ALTER TABLE pdo_exec_ddl DROP id', 0);
- exec_and_count(8, $db, 'ALTER TABLE pdo_exec_ddl ADD id INT', 0);
- exec_and_count(9, $db, 'ALTER TABLE pdo_exec_ddl ALTER id SET DEFAULT 1', 0);
- exec_and_count(10, $db, 'RENAME TABLE pdo_exec_ddl TO pdo_exec_ddl2', 0);
- }
+ exec_and_count(4, $db, 'DROP TABLE IF EXISTS pdo_exec_ddl', 0);
+ exec_and_count(5, $db, 'DROP TABLE IF EXISTS pdo_exec_ddl2', 0);
+ if (0 === $db->exec('CREATE TABLE pdo_exec_ddl(id INT, col1 CHAR(2))')) {
+ exec_and_count(5, $db, 'CREATE INDEX idx1 ON pdo_exec_ddl(id)', 0);
+ exec_and_count(6, $db, 'DROP INDEX idx1 ON pdo_exec_ddl', 0);
+ exec_and_count(7, $db, 'ALTER TABLE pdo_exec_ddl DROP id', 0);
+ exec_and_count(8, $db, 'ALTER TABLE pdo_exec_ddl ADD id INT', 0);
+ exec_and_count(9, $db, 'ALTER TABLE pdo_exec_ddl ALTER id SET DEFAULT 1', 0);
+ exec_and_count(10, $db, 'RENAME TABLE pdo_exec_ddl TO pdo_exec_ddl2', 0);
+ }
- /*
- 11.1.2. ALTER LOGFILE GROUP Syntax
- 11.1.3. ALTER SERVER Syntax
- 11.1.5. ALTER TABLESPACE Syntax
- 11.1.8. CREATE LOGFILE GROUP Syntax
- 11.1.9. CREATE SERVER Syntax
- 11.1.11. CREATE TABLESPACE Syntax
- 11.1.14. DROP LOGFILE GROUP Syntax
- 11.1.15. DROP SERVER Syntax
- 11.1.17. DROP TABLESPACE Syntax
- */
+ /*
+ 11.1.2. ALTER LOGFILE GROUP Syntax
+ 11.1.3. ALTER SERVER Syntax
+ 11.1.5. ALTER TABLESPACE Syntax
+ 11.1.8. CREATE LOGFILE GROUP Syntax
+ 11.1.9. CREATE SERVER Syntax
+ 11.1.11. CREATE TABLESPACE Syntax
+ 11.1.14. DROP LOGFILE GROUP Syntax
+ 11.1.15. DROP SERVER Syntax
+ 11.1.17. DROP TABLESPACE Syntax
+ */
- } catch (PDOException $e) {
- printf("[001] %s, [%s] %s\n",
- $e->getMessage(),
- $db->errorCode(), implode(' ', $db->errorInfo()));
- }
+ } catch (PDOException $e) {
+ printf("[001] %s, [%s] %s\n",
+ $e->getMessage(),
+ $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
- print "done!";
+ print "done!";
--CLEAN--
<?php
require __DIR__ . '/mysql_pdo_test.inc';
diff --git a/ext/pdo_mysql/tests/pdo_mysql_exec_load_data.phpt b/ext/pdo_mysql/tests/pdo_mysql_exec_load_data.phpt
index 50b35618b3..4e3f40d369 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_exec_load_data.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_exec_load_data.phpt
@@ -30,85 +30,85 @@ if (($row = $stmt->fetch(PDO::FETCH_ASSOC)) && ($row['value'] != '')) {
?>
--FILE--
<?php
- function exec_and_count($offset, &$db, $sql, $exp) {
-
- try {
-
- $ret = $db->exec($sql);
- if ($ret !== $exp) {
- printf("[%03d] Expecting '%s'/%s got '%s'/%s when running '%s', [%s] %s\n",
- $offset, $exp, gettype($exp), $ret, gettype($ret), $sql,
- $db->errorCode(), implode(' ', $db->errorInfo()));
- return false;
- }
-
- } catch (PDOException $e) {
-
- if (42000 == $db->errorCode()) {
- // Error: 1148 SQLSTATE: 42000 (ER_NOT_ALLOWED_COMMAND)
- // Load data infile not allowed
- return false;
- }
-
- printf("[%03d] '%s' has failed, [%s] %s\n",
- $offset, $sql, $db->errorCode(), implode(' ', $db->errorInfo()));
- return false;
- }
-
- return true;
- }
-
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- putenv('PDOTEST_ATTR='.serialize([PDO::MYSQL_ATTR_LOCAL_INFILE=>true]));
- $db = MySQLPDOTest::factory();
- MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db));
-
- /* affected rows related */
- try {
-
- exec_and_count(2, $db, 'DROP TABLE IF EXISTS test', 0);
- exec_and_count(3, $db, sprintf('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, col1 CHAR(10)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE), 0);
-
- $stmt = $db->query("SHOW VARIABLES LIKE 'secure_file_priv'");
- if (($row = $stmt->fetch(PDO::FETCH_ASSOC)) && ($row['value'] != '')) {
- $filename = $row['value'] . DIRECTORY_SEPARATOR . "pdo_mysql_exec_load_data.csv";
- } else {
- $filename = MySQLPDOTest::getTempDir() . DIRECTORY_SEPARATOR . "pdo_mysql_exec_load_data.csv";
- }
-
- $fp = fopen($filename, "w");
- fwrite($fp, "1;foo\n");
- fwrite($fp, "2;bar");
- fclose($fp);
-
- $sql = sprintf("LOAD DATA LOCAL INFILE %s INTO TABLE test FIELDS TERMINATED BY ';' LINES TERMINATED BY '\n'", $db->quote($filename));
-
- if (exec_and_count(4, $db, $sql, 2)) {
-
- $stmt = $db->query('SELECT id, col1 FROM test ORDER BY id ASC');
- $expected = array(array("id" => 1, "col1" => "foo"), array("id" => 2, "col1" => "bar"));
- $ret = $stmt->fetchAll(PDO::FETCH_ASSOC);
- foreach ($expected as $offset => $exp) {
- foreach ($exp as $key => $value) {
- if ($ret[$offset][$key] != $value) {
- printf("Results seem wrong, check manually\n");
- var_dump($ret);
- var_dump($expected);
- break 2;
- }
- }
- }
- }
-
- unlink($filename);
-
- } catch (PDOException $e) {
- printf("[001] %s, [%s] %s\n",
- $e->getMessage(),
- $db->errorCode(), implode(' ', $db->errorInfo()));
- }
-
- print "done!";
+ function exec_and_count($offset, &$db, $sql, $exp) {
+
+ try {
+
+ $ret = $db->exec($sql);
+ if ($ret !== $exp) {
+ printf("[%03d] Expecting '%s'/%s got '%s'/%s when running '%s', [%s] %s\n",
+ $offset, $exp, gettype($exp), $ret, gettype($ret), $sql,
+ $db->errorCode(), implode(' ', $db->errorInfo()));
+ return false;
+ }
+
+ } catch (PDOException $e) {
+
+ if (42000 == $db->errorCode()) {
+ // Error: 1148 SQLSTATE: 42000 (ER_NOT_ALLOWED_COMMAND)
+ // Load data infile not allowed
+ return false;
+ }
+
+ printf("[%03d] '%s' has failed, [%s] %s\n",
+ $offset, $sql, $db->errorCode(), implode(' ', $db->errorInfo()));
+ return false;
+ }
+
+ return true;
+ }
+
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ putenv('PDOTEST_ATTR='.serialize([PDO::MYSQL_ATTR_LOCAL_INFILE=>true]));
+ $db = MySQLPDOTest::factory();
+ MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db));
+
+ /* affected rows related */
+ try {
+
+ exec_and_count(2, $db, 'DROP TABLE IF EXISTS test', 0);
+ exec_and_count(3, $db, sprintf('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, col1 CHAR(10)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE), 0);
+
+ $stmt = $db->query("SHOW VARIABLES LIKE 'secure_file_priv'");
+ if (($row = $stmt->fetch(PDO::FETCH_ASSOC)) && ($row['value'] != '')) {
+ $filename = $row['value'] . DIRECTORY_SEPARATOR . "pdo_mysql_exec_load_data.csv";
+ } else {
+ $filename = MySQLPDOTest::getTempDir() . DIRECTORY_SEPARATOR . "pdo_mysql_exec_load_data.csv";
+ }
+
+ $fp = fopen($filename, "w");
+ fwrite($fp, "1;foo\n");
+ fwrite($fp, "2;bar");
+ fclose($fp);
+
+ $sql = sprintf("LOAD DATA LOCAL INFILE %s INTO TABLE test FIELDS TERMINATED BY ';' LINES TERMINATED BY '\n'", $db->quote($filename));
+
+ if (exec_and_count(4, $db, $sql, 2)) {
+
+ $stmt = $db->query('SELECT id, col1 FROM test ORDER BY id ASC');
+ $expected = array(array("id" => 1, "col1" => "foo"), array("id" => 2, "col1" => "bar"));
+ $ret = $stmt->fetchAll(PDO::FETCH_ASSOC);
+ foreach ($expected as $offset => $exp) {
+ foreach ($exp as $key => $value) {
+ if ($ret[$offset][$key] != $value) {
+ printf("Results seem wrong, check manually\n");
+ var_dump($ret);
+ var_dump($expected);
+ break 2;
+ }
+ }
+ }
+ }
+
+ unlink($filename);
+
+ } catch (PDOException $e) {
+ printf("[001] %s, [%s] %s\n",
+ $e->getMessage(),
+ $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_exec_select.phpt b/ext/pdo_mysql/tests/pdo_mysql_exec_select.phpt
index 901a4ad9a8..2cff2e3915 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_exec_select.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_exec_select.phpt
@@ -8,50 +8,50 @@ MySQLPDOTest::skip();
?>
--FILE--
<?php
- function exec_and_count($offset, &$db, $sql, $exp) {
+ function exec_and_count($offset, &$db, $sql, $exp) {
- try {
+ try {
- $ret = $db->exec($sql);
- if ($ret !== $exp) {
- printf("[%03d] Expecting '%s'/%s got '%s'/%s when running '%s', [%s] %s\n",
- $offset, $exp, gettype($exp), $ret, gettype($ret), $sql,
- $db->errorCode(), implode(' ', $db->errorInfo()));
- return false;
- }
+ $ret = $db->exec($sql);
+ if ($ret !== $exp) {
+ printf("[%03d] Expecting '%s'/%s got '%s'/%s when running '%s', [%s] %s\n",
+ $offset, $exp, gettype($exp), $ret, gettype($ret), $sql,
+ $db->errorCode(), implode(' ', $db->errorInfo()));
+ return false;
+ }
- } catch (PDOException $e) {
- printf("[%03d] '%s' has failed, [%s] %s\n",
- $offset, $sql, $db->errorCode(), implode(' ', $db->errorInfo()));
- return false;
- }
+ } catch (PDOException $e) {
+ printf("[%03d] '%s' has failed, [%s] %s\n",
+ $offset, $sql, $db->errorCode(), implode(' ', $db->errorInfo()));
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
- MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db));
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
+ MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db));
- /* affected rows related */
- try {
+ /* affected rows related */
+ try {
- exec_and_count(2, $db, 'DROP TABLE IF EXISTS test', 0);
- exec_and_count(3, $db, sprintf('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, col1 CHAR(10)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE), 0);
- exec_and_count(4, $db, "INSERT INTO test(id, col1) VALUES (1, 'a')", 1);
- // question is: will the result set be cleaned up, will it be possible to run more queries on the line?
- // buffered or unbuffered does not matter!
- $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
- exec_and_count(5, $db, 'SELECT id FROM test', 0);
- exec_and_count(6, $db, "INSERT INTO test(id, col1) VALUES (2, 'b')", 1);
+ exec_and_count(2, $db, 'DROP TABLE IF EXISTS test', 0);
+ exec_and_count(3, $db, sprintf('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, col1 CHAR(10)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE), 0);
+ exec_and_count(4, $db, "INSERT INTO test(id, col1) VALUES (1, 'a')", 1);
+ // question is: will the result set be cleaned up, will it be possible to run more queries on the line?
+ // buffered or unbuffered does not matter!
+ $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
+ exec_and_count(5, $db, 'SELECT id FROM test', 0);
+ exec_and_count(6, $db, "INSERT INTO test(id, col1) VALUES (2, 'b')", 1);
- } catch (PDOException $e) {
- printf("[001] %s, [%s] %s\n",
- $e->getMessage(),
- $db->errorCode(), implode(' ', $db->errorInfo()));
- }
+ } catch (PDOException $e) {
+ printf("[001] %s, [%s] %s\n",
+ $e->getMessage(),
+ $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_fetch_both.phpt b/ext/pdo_mysql/tests/pdo_mysql_fetch_both.phpt
index 0e53d40deb..fb20dff5bc 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_fetch_both.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_fetch_both.phpt
@@ -9,80 +9,54 @@ $db = MySQLPDOTest::factory();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
- function fetch($offset, &$db, $query, $expect = null) {
+ function fetch($offset, &$db, $query, $expect = null) {
- try {
- $stmt = $db->query('SELECT 1');
- $num = $stmt->fetch(PDO::FETCH_NUM);
+ try {
+ $stmt = $db->query('SELECT 1');
+ $num = $stmt->fetch(PDO::FETCH_NUM);
- $stmt = $db->query('SELECT 1');
- $assoc = $stmt->fetch(PDO::FETCH_ASSOC);
+ $stmt = $db->query('SELECT 1');
+ $assoc = $stmt->fetch(PDO::FETCH_ASSOC);
- $stmt = $db->query('SELECT 1');
- $both = $stmt->fetch(PDO::FETCH_BOTH);
+ $stmt = $db->query('SELECT 1');
+ $both = $stmt->fetch(PDO::FETCH_BOTH);
- $computed_both = array_merge($num, $assoc);
- if ($computed_both != $both) {
- printf("[%03d] Suspicious FETCH_BOTH result, dumping\n", $offset);
- var_dump($computed_both);
- var_dump($both);
- }
+ $computed_both = array_merge($num, $assoc);
+ if ($computed_both != $both) {
+ printf("[%03d] Suspicious FETCH_BOTH result, dumping\n", $offset);
+ var_dump($computed_both);
+ var_dump($both);
+ }
- if (!is_null($expect) && ($expect != $both)) {
- printf("[%03d] Expected differes from returned data, dumping\n", $offset);
- var_dump($expect);
- var_dump($both);
- }
+ if (!is_null($expect) && ($expect != $both)) {
+ printf("[%03d] Expected differs from returned data, dumping\n", $offset);
+ var_dump($expect);
+ var_dump($both);
+ }
- } catch (PDOException $e) {
+ } catch (PDOException $e) {
- printf("[%03d] %s, [%s] %s\n",
- $offset,
- $e->getMessage(), $db->errroCode(), implode(' ', $db->errorInfo()));
+ printf("[%03d] %s, [%s] %s\n",
+ $offset,
+ $e->getMessage(), $db->errroCode(), implode(' ', $db->errorInfo()));
- }
+ }
- }
+ }
- try {
+ try {
- fetch(2, $db, 'SELECT 1', array(0 => '1', '1' => '1'));
+ fetch(2, $db, 'SELECT 1', array(0 => '1', '1' => '1'));
- } catch (PDOException $e) {
- printf("[001] %s [%s] %s\n",
- $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
- }
+ } catch (PDOException $e) {
+ printf("[001] %s [%s] %s\n",
+ $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
- print "done!";
+ print "done!";
?>
--EXPECT--
-[002] Suspicious FETCH_BOTH result, dumping
-array(2) {
- [0]=>
- string(1) "1"
- [1]=>
- string(1) "1"
-}
-array(2) {
- [1]=>
- string(1) "1"
- [2]=>
- string(1) "1"
-}
-[002] Expected differes from returned data, dumping
-array(2) {
- [0]=>
- string(1) "1"
- [1]=>
- string(1) "1"
-}
-array(2) {
- [1]=>
- string(1) "1"
- [2]=>
- string(1) "1"
-}
done!
diff --git a/ext/pdo_mysql/tests/pdo_mysql_get_attribute.phpt b/ext/pdo_mysql/tests/pdo_mysql_get_attribute.phpt
index 51310faa9e..386dfb1e1e 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_get_attribute.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_get_attribute.phpt
@@ -11,60 +11,60 @@ if (false == MySQLPDOTest::detect_transactional_mysql_engine($db))
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
- MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db));
-
- function set_and_get($offset, $db, $attribute, $value) {
-
- $value_type = gettype($value);
- try {
-
- if (!$db->setAttribute($attribute, $value)) {
- printf("[%03d] Cannot set attribute '%s' to value '%s'\n",
- $offset, $attribute, var_export($tmp, true));
- return false;
- }
-
- if (gettype($value) != $value_type) {
- printf("[%03d] Call to PDO::setAttribute(int attribute, mixed value) has changed the type of value from %s to %s, test will not work properly\n",
- $offset, $value_type, gettype($value));
- return false;
- }
-
- $tmp = $db->getAttribute($attribute);
- if ($tmp !== $value) {
- printf("[%03d] Attribute '%s' was set to '%s'/%s but getAttribute() reports '%s'/%s\n",
- $offset, $attribute, var_export($value, true), gettype($value), var_export($tmp, true), gettype($tmp));
- return false;
- }
-
- } catch (PDOException $e) {
- printf("[%03d] %s, [%s] %s\n",
- $offset, $e->getMessage(),
- $db->errorCode(), implode(' ', $db->errorInfo()));
- return false;
- }
-
- return true;
- }
-
- set_and_get(1, $db, PDO::ATTR_AUTOCOMMIT, 1);
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
+ MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db));
+
+ function set_and_get($offset, $db, $attribute, $value) {
+
+ $value_type = gettype($value);
+ try {
+
+ if (!$db->setAttribute($attribute, $value)) {
+ printf("[%03d] Cannot set attribute '%s' to value '%s'\n",
+ $offset, $attribute, var_export($tmp, true));
+ return false;
+ }
+
+ if (gettype($value) != $value_type) {
+ printf("[%03d] Call to PDO::setAttribute(int attribute, mixed value) has changed the type of value from %s to %s, test will not work properly\n",
+ $offset, $value_type, gettype($value));
+ return false;
+ }
+
+ $tmp = $db->getAttribute($attribute);
+ if ($tmp !== $value) {
+ printf("[%03d] Attribute '%s' was set to '%s'/%s but getAttribute() reports '%s'/%s\n",
+ $offset, $attribute, var_export($value, true), gettype($value), var_export($tmp, true), gettype($tmp));
+ return false;
+ }
+
+ } catch (PDOException $e) {
+ printf("[%03d] %s, [%s] %s\n",
+ $offset, $e->getMessage(),
+ $db->errorCode(), implode(' ', $db->errorInfo()));
+ return false;
+ }
+
+ return true;
+ }
+
+ set_and_get(1, $db, PDO::ATTR_AUTOCOMMIT, 1);
/*
- set_and_get(2, $db, PDO::ATTR_AUTOCOMMIT, 0);
- set_and_get(3, $db, PDO::ATTR_AUTOCOMMIT, -1);
- $obj = new stdClass();
- set_and_get(4, $db, PDO::ATTR_AUTOCOMMIT, $obj);
+ set_and_get(2, $db, PDO::ATTR_AUTOCOMMIT, 0);
+ set_and_get(3, $db, PDO::ATTR_AUTOCOMMIT, -1);
+ $obj = new stdClass();
+ set_and_get(4, $db, PDO::ATTR_AUTOCOMMIT, $obj);
- set_and_get(5, $db, PDO::MYSQL_ATTR_LOCAL_INFILE, 1);
- set_and_get(6, $db, PDO::MYSQL_ATTR_LOCAL_INFILE, 0);
- set_and_get(7, $db, PDO::MYSQL_ATTR_LOCAL_INFILE, -1);
- $tmp = array();
- set_and_get(8, $db, PDO::MYSQL_ATTR_LOCAL_INFILE, $tmp);
+ set_and_get(5, $db, PDO::MYSQL_ATTR_LOCAL_INFILE, 1);
+ set_and_get(6, $db, PDO::MYSQL_ATTR_LOCAL_INFILE, 0);
+ set_and_get(7, $db, PDO::MYSQL_ATTR_LOCAL_INFILE, -1);
+ $tmp = array();
+ set_and_get(8, $db, PDO::MYSQL_ATTR_LOCAL_INFILE, $tmp);
- set_and_get(9, $db, PPDO::MYSQL_ATTR_INIT_COMMAND, '');
- set_and_get(10, $db, PPDO::MYSQL_ATTR_INIT_COMMAND, 'SOME SQL');
- set_and_get(11, $db, PPDO::MYSQL_ATTR_INIT_COMMAND, -1);
+ set_and_get(9, $db, PPDO::MYSQL_ATTR_INIT_COMMAND, '');
+ set_and_get(10, $db, PPDO::MYSQL_ATTR_INIT_COMMAND, 'SOME SQL');
+ set_and_get(11, $db, PPDO::MYSQL_ATTR_INIT_COMMAND, -1);
*/
/*
@@ -87,7 +87,7 @@ PDO::ATTR_CONNECTION_STATUS
PDO::ATTR_SERVER_INFO
*/
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_interface.phpt b/ext/pdo_mysql/tests/pdo_mysql_interface.phpt
index cc949b265d..fbf0938dc9 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_interface.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_interface.phpt
@@ -11,48 +11,48 @@ if (false == MySQLPDOTest::detect_transactional_mysql_engine($db))
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
- $expected = array(
- '__construct' => true,
- 'prepare' => true,
- 'beginTransaction' => true,
- 'commit' => true,
- 'rollBack' => true,
- 'setAttribute' => true,
- 'exec' => true,
- 'query' => true,
- 'lastInsertId' => true,
- 'errorCode' => true,
- 'errorInfo' => true,
- 'getAttribute' => true,
- 'quote' => true,
- 'inTransaction' => true,
- 'getAvailableDrivers' => true,
- );
- $classname = get_class($db);
+ $expected = array(
+ '__construct' => true,
+ 'prepare' => true,
+ 'beginTransaction' => true,
+ 'commit' => true,
+ 'rollBack' => true,
+ 'setAttribute' => true,
+ 'exec' => true,
+ 'query' => true,
+ 'lastInsertId' => true,
+ 'errorCode' => true,
+ 'errorInfo' => true,
+ 'getAttribute' => true,
+ 'quote' => true,
+ 'inTransaction' => true,
+ 'getAvailableDrivers' => true,
+ );
+ $classname = get_class($db);
- $methods = get_class_methods($classname);
- foreach ($methods as $k => $method) {
- if (isset($expected[$method])) {
- unset($expected[$method]);
- unset($methods[$k]);
- }
- if ($method == $classname) {
- unset($expected['__construct']);
- unset($methods[$k]);
- }
- }
- if (!empty($expected)) {
- printf("Dumping missing class methods\n");
- var_dump($expected);
- }
- if (!empty($methods)) {
- printf("Found more methods than expected, dumping list\n");
- var_dump($methods);
- }
+ $methods = get_class_methods($classname);
+ foreach ($methods as $k => $method) {
+ if (isset($expected[$method])) {
+ unset($expected[$method]);
+ unset($methods[$k]);
+ }
+ if ($method == $classname) {
+ unset($expected['__construct']);
+ unset($methods[$k]);
+ }
+ }
+ if (!empty($expected)) {
+ printf("Dumping missing class methods\n");
+ var_dump($expected);
+ }
+ if (!empty($methods)) {
+ printf("Found more methods than expected, dumping list\n");
+ var_dump($methods);
+ }
- print "done!";
+ print "done!";
--EXPECT--
done!
diff --git a/ext/pdo_mysql/tests/pdo_mysql_last_insert_id.phpt b/ext/pdo_mysql/tests/pdo_mysql_last_insert_id.phpt
index d9dec0bcd3..b63ecb2c52 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_last_insert_id.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_last_insert_id.phpt
@@ -9,106 +9,106 @@ $db = MySQLPDOTest::factory();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
-
- try {
- if ('0' !== ($tmp = $db->lastInsertId()))
- printf("[001] No query has been run, lastInsertId() should return '0'/string got '%s'/%s\n",
- var_export($tmp, true), gettype($tmp));
-
- if ('0' !== ($tmp = $db->lastInsertId('sequence_name')))
- printf("[002] MySQL does not support sequences, expecting '0'/string got '%s'/%s\n",
- var_export($tmp, true), gettype($tmp));
-
- $db->exec('DROP TABLE IF EXISTS test');
- if ('0' !== ($tmp = $db->lastInsertId()))
- printf("[003] Expecting '0'/string got '%s'/%s", var_export($tmp, true), gettype($tmp));
-
- $db->exec(sprintf('CREATE TABLE test(id INT, col1 CHAR(10)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE));
- if ('0' !== ($tmp = $db->lastInsertId()))
- printf("[004] Expecting '0'/string got '%s'/%s", var_export($tmp, true), gettype($tmp));
-
- $stmt = $db->query('SELECT id FROM test LIMIT 1');
- if ('0' !== ($tmp = $db->lastInsertId()))
- printf("[005] Expecting '0'/string got '%s'/%s", var_export($tmp, true), gettype($tmp));
-
- // no auto increment column
- $db->exec("INSERT INTO test(id, col1) VALUES (100, 'a')");
- if ('0' !== ($tmp = $db->lastInsertId()))
- printf("[006] Expecting '0'/string got '%s'/%s", var_export($tmp, true), gettype($tmp));
-
- $db->exec('ALTER TABLE test MODIFY id INT AUTO_INCREMENT PRIMARY KEY');
- if ('0' !== ($tmp = $db->lastInsertId()))
- printf("[006] Expecting '0'/string got '%s'/%s", var_export($tmp, true), gettype($tmp));
-
- // duplicate key
- @$db->exec("INSERT INTO test(id, col1) VALUES (100, 'a')");
- if ('0' !== ($tmp = $db->lastInsertId()))
- printf("[007] Expecting '0'/string got '%s'/%s", var_export($tmp, true), gettype($tmp));
-
- $db->exec("INSERT INTO test(id, col1) VALUES (101, 'b')");
- if ('101' !== ($tmp = $db->lastInsertId()))
- printf("[008] Expecting '0'/string got '%s'/%s", var_export($tmp, true), gettype($tmp));
-
- $db->exec('ALTER TABLE test MODIFY col1 CHAR(10) UNIQUE');
- // replace = delete + insert -> new auto increment value
- $db->exec("REPLACE INTO test(col1) VALUES ('b')");
- $next_id = (int)$db->lastInsertId();
-
- if ($next_id <= 101)
- printf("[009] Expecting at least 102, got %d\n",$next_id);
-
- $stmt = $db->query('SELECT LAST_INSERT_ID() as _last_id');
- $row = $stmt->fetch(PDO::FETCH_ASSOC);
- $last_id = $row['_last_id'];
- if ($next_id != $last_id) {
- printf("[010] LAST_INSERT_ID() = %d and lastInserId() = %d differ\n",
- $last_id, $next_id);
- }
-
- $db->exec("INSERT INTO test(col1) VALUES ('c'), ('d'), ('e')");
- $next_id = (int)$db->lastInsertId();
- if ($next_id <= $last_id)
- printf("[011] Expecting at least %d, got %d\n", $last_id + 1, $next_id);
-
- // warnings are unhandy, lets go for exceptions for a second
- $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- try {
- $ignore_exception = true;
- $db->exec('LOCK TABLE test WRITE');
- $ignore_exception = false;
-
- if (MySQLPDOTest::getServerVersion($db) >= 50000) {
- $stmt = $db->query('SELECT @@auto_increment_increment AS inc');
- $row = $stmt->fetch(PDO::FETCH_ASSOC);
- $inc = $row['inc'];
- } else {
- $inc = 1;
- }
-
- $stmt = $db->query('SELECT LAST_INSERT_ID() as _last_id');
- $row = $stmt->fetch(PDO::FETCH_ASSOC);
- $last_id = $row['_last_id'];
-
- $db->exec("INSERT INTO test(col1) VALUES ('z')");
- $next_id = (int)$db->lastInsertId();
- if ($next_id < ($last_id + $inc))
- printf("[012] Expecting at least %d, got %d\n", $last_id + $inc, $next_id);
-
- } catch (PDOException $e) {
- if (!$ignore_exception)
- printf("[014] %s, [%s} %s\n", $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
- }
- $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
- @$db->exec('UNLOCK TABLE test');
-
- } catch (PDOException $e) {
- printf("[001] %s [%s] %s\n",
- $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
- }
-
- print "done!";
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
+
+ try {
+ if ('0' !== ($tmp = $db->lastInsertId()))
+ printf("[001] No query has been run, lastInsertId() should return '0'/string got '%s'/%s\n",
+ var_export($tmp, true), gettype($tmp));
+
+ if ('0' !== ($tmp = $db->lastInsertId('sequence_name')))
+ printf("[002] MySQL does not support sequences, expecting '0'/string got '%s'/%s\n",
+ var_export($tmp, true), gettype($tmp));
+
+ $db->exec('DROP TABLE IF EXISTS test');
+ if ('0' !== ($tmp = $db->lastInsertId()))
+ printf("[003] Expecting '0'/string got '%s'/%s", var_export($tmp, true), gettype($tmp));
+
+ $db->exec(sprintf('CREATE TABLE test(id INT, col1 CHAR(10)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE));
+ if ('0' !== ($tmp = $db->lastInsertId()))
+ printf("[004] Expecting '0'/string got '%s'/%s", var_export($tmp, true), gettype($tmp));
+
+ $stmt = $db->query('SELECT id FROM test LIMIT 1');
+ if ('0' !== ($tmp = $db->lastInsertId()))
+ printf("[005] Expecting '0'/string got '%s'/%s", var_export($tmp, true), gettype($tmp));
+
+ // no auto increment column
+ $db->exec("INSERT INTO test(id, col1) VALUES (100, 'a')");
+ if ('0' !== ($tmp = $db->lastInsertId()))
+ printf("[006] Expecting '0'/string got '%s'/%s", var_export($tmp, true), gettype($tmp));
+
+ $db->exec('ALTER TABLE test MODIFY id INT AUTO_INCREMENT PRIMARY KEY');
+ if ('0' !== ($tmp = $db->lastInsertId()))
+ printf("[006] Expecting '0'/string got '%s'/%s", var_export($tmp, true), gettype($tmp));
+
+ // duplicate key
+ @$db->exec("INSERT INTO test(id, col1) VALUES (100, 'a')");
+ if ('0' !== ($tmp = $db->lastInsertId()))
+ printf("[007] Expecting '0'/string got '%s'/%s", var_export($tmp, true), gettype($tmp));
+
+ $db->exec("INSERT INTO test(id, col1) VALUES (101, 'b')");
+ if ('101' !== ($tmp = $db->lastInsertId()))
+ printf("[008] Expecting '0'/string got '%s'/%s", var_export($tmp, true), gettype($tmp));
+
+ $db->exec('ALTER TABLE test MODIFY col1 CHAR(10) UNIQUE');
+ // replace = delete + insert -> new auto increment value
+ $db->exec("REPLACE INTO test(col1) VALUES ('b')");
+ $next_id = (int)$db->lastInsertId();
+
+ if ($next_id <= 101)
+ printf("[009] Expecting at least 102, got %d\n",$next_id);
+
+ $stmt = $db->query('SELECT LAST_INSERT_ID() as _last_id');
+ $row = $stmt->fetch(PDO::FETCH_ASSOC);
+ $last_id = $row['_last_id'];
+ if ($next_id != $last_id) {
+ printf("[010] LAST_INSERT_ID() = %d and lastInserId() = %d differ\n",
+ $last_id, $next_id);
+ }
+
+ $db->exec("INSERT INTO test(col1) VALUES ('c'), ('d'), ('e')");
+ $next_id = (int)$db->lastInsertId();
+ if ($next_id <= $last_id)
+ printf("[011] Expecting at least %d, got %d\n", $last_id + 1, $next_id);
+
+ // warnings are unhandy, lets go for exceptions for a second
+ $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+ try {
+ $ignore_exception = true;
+ $db->exec('LOCK TABLE test WRITE');
+ $ignore_exception = false;
+
+ if (MySQLPDOTest::getServerVersion($db) >= 50000) {
+ $stmt = $db->query('SELECT @@auto_increment_increment AS inc');
+ $row = $stmt->fetch(PDO::FETCH_ASSOC);
+ $inc = $row['inc'];
+ } else {
+ $inc = 1;
+ }
+
+ $stmt = $db->query('SELECT LAST_INSERT_ID() as _last_id');
+ $row = $stmt->fetch(PDO::FETCH_ASSOC);
+ $last_id = $row['_last_id'];
+
+ $db->exec("INSERT INTO test(col1) VALUES ('z')");
+ $next_id = (int)$db->lastInsertId();
+ if ($next_id < ($last_id + $inc))
+ printf("[012] Expecting at least %d, got %d\n", $last_id + $inc, $next_id);
+
+ } catch (PDOException $e) {
+ if (!$ignore_exception)
+ printf("[014] %s, [%s} %s\n", $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
+ $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
+ @$db->exec('UNLOCK TABLE test');
+
+ } catch (PDOException $e) {
+ printf("[001] %s [%s] %s\n",
+ $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_multi_stmt_nextrowset.phpt b/ext/pdo_mysql/tests/pdo_mysql_multi_stmt_nextrowset.phpt
index f520c1d828..74ab7858d4 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_multi_stmt_nextrowset.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_multi_stmt_nextrowset.phpt
@@ -21,65 +21,65 @@ if (!MySQLPDOTest::isPDOMySQLnd())
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
- $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
+ $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
- MySQLPDOTest::createTestTable($db);
+ MySQLPDOTest::createTestTable($db);
- function test_proc($db) {
+ function test_proc($db) {
- $db->exec('DROP PROCEDURE IF EXISTS p');
- $db->exec('CREATE PROCEDURE p() BEGIN SELECT id FROM test ORDER BY id ASC LIMIT 3; SELECT id, label FROM test WHERE id < 4 ORDER BY id DESC LIMIT 3; END;');
- $stmt = $db->query('CALL p()');
- do {
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
- } while ($stmt->nextRowSet());
- var_dump($stmt->nextRowSet());
+ $db->exec('DROP PROCEDURE IF EXISTS p');
+ $db->exec('CREATE PROCEDURE p() BEGIN SELECT id FROM test ORDER BY id ASC LIMIT 3; SELECT id, label FROM test WHERE id < 4 ORDER BY id DESC LIMIT 3; END;');
+ $stmt = $db->query('CALL p()');
+ do {
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+ } while ($stmt->nextRowSet());
+ var_dump($stmt->nextRowSet());
- }
+ }
- try {
+ try {
- // Using native PS for proc, since emulated fails.
- printf("Native PS...\n");
- foreach (array(false, true) as $multi) {
- $value = $multi ? 'true' : 'false';
- echo "\nTesting with PDO::MYSQL_ATTR_MULTI_STATEMENTS set to {$value}\n";
- $dsn = MySQLPDOTest::getDSN();
- $user = PDO_MYSQL_TEST_USER;
- $pass = PDO_MYSQL_TEST_PASS;
- $db = new PDO($dsn, $user, $pass, array(PDO::MYSQL_ATTR_MULTI_STATEMENTS => $multi));
- $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
- $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 1);
- $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
- test_proc($db);
+ // Using native PS for proc, since emulated fails.
+ printf("Native PS...\n");
+ foreach (array(false, true) as $multi) {
+ $value = $multi ? 'true' : 'false';
+ echo "\nTesting with PDO::MYSQL_ATTR_MULTI_STATEMENTS set to {$value}\n";
+ $dsn = MySQLPDOTest::getDSN();
+ $user = PDO_MYSQL_TEST_USER;
+ $pass = PDO_MYSQL_TEST_PASS;
+ $db = new PDO($dsn, $user, $pass, array(PDO::MYSQL_ATTR_MULTI_STATEMENTS => $multi));
+ $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
+ $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 1);
+ $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
+ test_proc($db);
- $db = new PDO($dsn, $user, $pass, array(PDO::MYSQL_ATTR_MULTI_STATEMENTS => $multi));
- $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
- $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 0);
- $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
+ $db = new PDO($dsn, $user, $pass, array(PDO::MYSQL_ATTR_MULTI_STATEMENTS => $multi));
+ $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
+ $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 0);
+ $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
- test_proc($db);
+ test_proc($db);
- // Switch back to emulated prepares to verify multi statement attribute.
- $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1);
- // This will fail when $multi is false.
- $stmt = $db->query("SELECT * FROM test; INSERT INTO test (id, label) VALUES (99, 'x')");
- if ($stmt !== false) {
- $stmt->closeCursor();
- }
- $info = $db->errorInfo();
- var_dump($info[0]);
- }
- @$db->exec('DROP PROCEDURE IF EXISTS p');
+ // Switch back to emulated prepares to verify multi statement attribute.
+ $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1);
+ // This will fail when $multi is false.
+ $stmt = $db->query("SELECT * FROM test; INSERT INTO test (id, label) VALUES (99, 'x')");
+ if ($stmt !== false) {
+ $stmt->closeCursor();
+ }
+ $info = $db->errorInfo();
+ var_dump($info[0]);
+ }
+ @$db->exec('DROP PROCEDURE IF EXISTS p');
- } catch (PDOException $e) {
- printf("[001] %s [%s] %s\n",
- $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
- }
+ } catch (PDOException $e) {
+ printf("[001] %s [%s] %s\n",
+ $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_param_str_natl.phpt b/ext/pdo_mysql/tests/pdo_mysql_param_str_natl.phpt
index 01964c0cd9..a45259f0e0 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_param_str_natl.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_param_str_natl.phpt
@@ -23,7 +23,7 @@ $stmt->execute();
var_dump($db->query('SELECT * from test'));
foreach ($db->query('SELECT * from test') as $row) {
- print_r($row);
+ print_r($row);
}
?>
diff --git a/ext/pdo_mysql/tests/pdo_mysql_pconnect.phpt b/ext/pdo_mysql/tests/pdo_mysql_pconnect.phpt
index 3656e71a0c..4d95c73cdc 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_pconnect.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_pconnect.phpt
@@ -8,92 +8,92 @@ MySQLPDOTest::skip();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
-
- try {
-
- $dsn = MySQLPDOTest::getDSN();
- $user = PDO_MYSQL_TEST_USER;
- $pass = PDO_MYSQL_TEST_PASS;
-
- $db1 = new PDO($dsn, $user, $pass, array(PDO::ATTR_PERSISTENT => true));
- $db2 = new PDO($dsn, $user, $pass, array(PDO::ATTR_PERSISTENT => true));
- $db1->exec('SET @pdo_persistent_connection=1');
- $stmt = $db2->query('SELECT @pdo_persistent_connection as _pers');
- $tmp = $stmt->fetch(PDO::FETCH_ASSOC);
- if ($tmp['_pers'] !== '1')
- printf("[001] Both handles should use the same connection.");
-
- $stmt = $db1->query('SELECT CONNECTION_ID() as _con1');
- $tmp = $stmt->fetch(PDO::FETCH_ASSOC);
- $con1 = $tmp['_con1'];
-
- $stmt = $db2->query('SELECT CONNECTION_ID() as _con2');
- $tmp = $stmt->fetch(PDO::FETCH_ASSOC);
- $con2 = $tmp['_con2'];
-
- if ($con1 !== $con2)
- printf("[002] Both handles should report the same MySQL thread ID");
-
- $db1 = NULL; /* should be equal to closing to my understanding */
- $db1 = new PDO($dsn, $user, $pass, array(PDO::ATTR_PERSISTENT => true));
- $stmt = $db1->query('SELECT CONNECTION_ID() as _con1');
- $tmp = $stmt->fetch(PDO::FETCH_ASSOC);
- $con1 = $tmp['_con1'];
-
- if ($con1 !== $con2)
- printf("[003] Both handles should report the same MySQL thread ID");
-
- $affected = $db1->exec(sprintf('KILL %d', $con1));
- // Server needs some think-time sometimes
- sleep(1);
- if ('00000' == $db1->errorCode()) {
- // looks like KILL has worked ? Or not... TODO: why no warning with libmysql?!
- @$db1->exec("SET @pdo_persistent_connection=2");
- // but now I want to see some error...
- if ('HY000' != $db1->errorCode())
- printf("[004] Wrong error code %s\n", $db1->errorCode());
-
- $tmp = implode(' ', $db1->errorInfo());
- if (!strstr($tmp, '2006'))
- printf("[005] Wrong error info %s\n", $tmp);
- }
-
- $db1 = new PDO($dsn, $user, $pass, array(PDO::ATTR_PERSISTENT => false));
- $stmt = $db1->query('SELECT CONNECTION_ID() as _con1');
- $tmp = $stmt->fetch(PDO::FETCH_ASSOC);
- $con1 = $tmp['_con1'];
-
- @$db2 = new PDO($dsn, $user, $pass, array(PDO::ATTR_PERSISTENT => true));
- $stmt = $db2->query('SELECT CONNECTION_ID() as _con2');
- $tmp = $stmt->fetch(PDO::FETCH_ASSOC);
- $con2 = $tmp['_con2'];
-
- if ($con1 == $con2)
- printf("[006] Looks like the persistent and the non persistent connection are using the same link?!\n");
-
- // lets go crazy and create a few pconnections...
- $connections = array();
- for ($i = 0; $i <= 20; $i++) {
- $connections[$i] = new PDO($dsn, $user, $pass, array(PDO::ATTR_PERSISTENT => true));
- }
- do {
- $i = mt_rand(0, 20);
- if (isset($connections[$i]))
- unset($connections[$i]);
- } while (!empty($connections));
-
-
- } catch (PDOException $e) {
- printf("[001] %s, [%s] %s [%s] %s\n",
- $e->getMessage(),
- (is_object($db1)) ? $db1->errorCode() : 'n/a',
- (is_object($db1)) ? implode(' ', $db1->errorInfo()) : 'n/a',
- (is_object($db2)) ? $db2->errorCode() : 'n/a',
- (is_object($db2)) ? implode(' ', $db2->errorInfo()) : 'n/a');
- }
-
- print "done!";
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+
+ try {
+
+ $dsn = MySQLPDOTest::getDSN();
+ $user = PDO_MYSQL_TEST_USER;
+ $pass = PDO_MYSQL_TEST_PASS;
+
+ $db1 = new PDO($dsn, $user, $pass, array(PDO::ATTR_PERSISTENT => true));
+ $db2 = new PDO($dsn, $user, $pass, array(PDO::ATTR_PERSISTENT => true));
+ $db1->exec('SET @pdo_persistent_connection=1');
+ $stmt = $db2->query('SELECT @pdo_persistent_connection as _pers');
+ $tmp = $stmt->fetch(PDO::FETCH_ASSOC);
+ if ($tmp['_pers'] !== '1')
+ printf("[001] Both handles should use the same connection.");
+
+ $stmt = $db1->query('SELECT CONNECTION_ID() as _con1');
+ $tmp = $stmt->fetch(PDO::FETCH_ASSOC);
+ $con1 = $tmp['_con1'];
+
+ $stmt = $db2->query('SELECT CONNECTION_ID() as _con2');
+ $tmp = $stmt->fetch(PDO::FETCH_ASSOC);
+ $con2 = $tmp['_con2'];
+
+ if ($con1 !== $con2)
+ printf("[002] Both handles should report the same MySQL thread ID");
+
+ $db1 = NULL; /* should be equal to closing to my understanding */
+ $db1 = new PDO($dsn, $user, $pass, array(PDO::ATTR_PERSISTENT => true));
+ $stmt = $db1->query('SELECT CONNECTION_ID() as _con1');
+ $tmp = $stmt->fetch(PDO::FETCH_ASSOC);
+ $con1 = $tmp['_con1'];
+
+ if ($con1 !== $con2)
+ printf("[003] Both handles should report the same MySQL thread ID");
+
+ $affected = $db1->exec(sprintf('KILL %d', $con1));
+ // Server needs some think-time sometimes
+ sleep(1);
+ if ('00000' == $db1->errorCode()) {
+ // looks like KILL has worked ? Or not... TODO: why no warning with libmysql?!
+ @$db1->exec("SET @pdo_persistent_connection=2");
+ // but now I want to see some error...
+ if ('HY000' != $db1->errorCode())
+ printf("[004] Wrong error code %s\n", $db1->errorCode());
+
+ $tmp = implode(' ', $db1->errorInfo());
+ if (!strstr($tmp, '2006'))
+ printf("[005] Wrong error info %s\n", $tmp);
+ }
+
+ $db1 = new PDO($dsn, $user, $pass, array(PDO::ATTR_PERSISTENT => false));
+ $stmt = $db1->query('SELECT CONNECTION_ID() as _con1');
+ $tmp = $stmt->fetch(PDO::FETCH_ASSOC);
+ $con1 = $tmp['_con1'];
+
+ @$db2 = new PDO($dsn, $user, $pass, array(PDO::ATTR_PERSISTENT => true));
+ $stmt = $db2->query('SELECT CONNECTION_ID() as _con2');
+ $tmp = $stmt->fetch(PDO::FETCH_ASSOC);
+ $con2 = $tmp['_con2'];
+
+ if ($con1 == $con2)
+ printf("[006] Looks like the persistent and the non persistent connection are using the same link?!\n");
+
+ // lets go crazy and create a few pconnections...
+ $connections = array();
+ for ($i = 0; $i <= 20; $i++) {
+ $connections[$i] = new PDO($dsn, $user, $pass, array(PDO::ATTR_PERSISTENT => true));
+ }
+ do {
+ $i = mt_rand(0, 20);
+ if (isset($connections[$i]))
+ unset($connections[$i]);
+ } while (!empty($connections));
+
+
+ } catch (PDOException $e) {
+ printf("[001] %s, [%s] %s [%s] %s\n",
+ $e->getMessage(),
+ (is_object($db1)) ? $db1->errorCode() : 'n/a',
+ (is_object($db1)) ? implode(' ', $db1->errorInfo()) : 'n/a',
+ (is_object($db2)) ? $db2->errorCode() : 'n/a',
+ (is_object($db2)) ? implode(' ', $db2->errorInfo()) : 'n/a');
+ }
+
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/pdo_mysql/tests/pdo_mysql_phpinfo.phpt b/ext/pdo_mysql/tests/pdo_mysql_phpinfo.phpt
index a230b3c19f..e44f1d2a52 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_phpinfo.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_phpinfo.phpt
@@ -9,22 +9,22 @@ $db = MySQLPDOTest::factory();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
- ob_start();
- phpinfo();
- $tmp = ob_get_contents();
- ob_end_clean();
+ ob_start();
+ phpinfo();
+ $tmp = ob_get_contents();
+ ob_end_clean();
- /* PDO Driver for MySQL, client library version => 6.0.3-alpha */
- $reg = 'Client API version.*' . preg_quote($db->getAttribute(PDO::ATTR_CLIENT_VERSION), '/');
+ /* PDO Driver for MySQL, client library version => 6.0.3-alpha */
+ $reg = 'Client API version.*' . preg_quote($db->getAttribute(PDO::ATTR_CLIENT_VERSION), '/');
- if (!preg_match("/$reg/", $tmp)) {
- printf("[001] Cannot find MySQL PDO driver line in phpinfo() output\n");
- }
+ if (!preg_match("/$reg/", $tmp)) {
+ printf("[001] Cannot find MySQL PDO driver line in phpinfo() output\n");
+ }
- print "done!";
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated.phpt
index 8db812ee19..6fe2ff20ba 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated.phpt
@@ -9,314 +9,314 @@ $db = MySQLPDOTest::factory();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
-
- function prepex($offset, &$db, $query, $input_params = null, $error_info = null) {
-
- try {
-
- if (is_array($error_info) && isset($error_info['prepare']))
- $stmt = @$db->prepare($query);
- else
- $stmt = $db->prepare($query);
-
- if (is_array($error_info) && isset($error_info['prepare'])) {
- $tmp = $db->errorInfo();
-
- if (isset($error_info['prepare']['sqlstate']) &&
- ($error_info['prepare']['sqlstate'] !== $tmp[0])) {
- printf("[%03d] prepare() - expecting SQLSTATE '%s' got '%s'\n",
- $offset, $error_info['prepare']['sqlstate'], $tmp[0]);
- return false;
- }
-
- if (isset($error_info['prepare']['mysql']) &&
- ($error_info['prepare']['mysql'] !== $tmp[1])) {
- printf("[%03d] prepare() - expecting MySQL Code '%s' got '%s'\n",
- $offset, $error_info['prepare']['mysql'], $tmp[0]);
- return false;
- }
-
- return false;
- }
-
- if (is_null($input_params))
- $input_params = array();
-
- if (is_array($error_info) && isset($error_info['execute']))
- $ret = @$stmt->execute($input_params);
- else
- $ret = $stmt->execute($input_params);
-
- if (!is_bool($ret))
- printf("[%03d] PDO::execute() should return a boolean value, got %s/%s\n",
- var_export($ret, true), $ret);
-
- if (is_array($error_info) && isset($error_info['execute'])) {
- $tmp = $stmt->errorInfo();
-
- if (isset($error_info['execute']['sqlstate']) &&
- ($error_info['execute']['sqlstate'] !== $tmp[0])) {
- printf("[%03d] execute() - expecting SQLSTATE '%s' got '%s'\n",
- $offset, $error_info['execute']['sqlstate'], $tmp[0]);
- return false;
- }
-
- if (isset($error_info['execute']['mysql']) &&
- ($error_info['execute']['mysql'] !== $tmp[1])) {
- printf("[%03d] execute() - expecting MySQL Code '%s' got '%s'\n",
- $offset, $error_info['execute']['mysql'], $tmp[0]);
- return false;
- }
-
- return false;
- }
-
- } catch (PDOException $e) {
- printf("[%03d] %s, [%s} %s\n",
- $offset, $e->getMessage(),
- $db->errorCode(), implode(' ', $db->errorInfo()));
- return false;
- }
-
- return $stmt;
- }
-
- try {
- $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1);
- if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
- printf("[002] Unable to switch to emulated prepared statements, test will fail\n");
-
- // TODO - that's PDO - you can prepare empty statements!
- prepex(3, $db, '',
- array(), array('execute' => array('sqlstate' => '42000')));
-
- // lets be fair and do the most simple SELECT first
- $stmt = prepex(4, $db, 'SELECT 1 as "one"');
- var_dump($stmt->fetch(PDO::FETCH_ASSOC));
-
- prepex(5, $db, 'DROP TABLE IF EXISTS test');
- prepex(6, $db, sprintf('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE));
- prepex(7, $db, "INSERT INTO test(id, label) VALUES(1, ':placeholder')");
- $stmt = prepex(8, $db, 'SELECT label FROM test');
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
-
- prepex(9, $db, 'DELETE FROM test');
- prepex(10, $db, "INSERT INTO test(id, label) VALUES(1, ':placeholder')",
- array(':placeholder' => 'first row'));
- $stmt = prepex(11, $db, 'SELECT label FROM test');
-
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
- prepex(12, $db, 'DELETE FROM test');
- prepex(13, $db, 'INSERT INTO test(id, label) VALUES(1, :placeholder)',
- array(':placeholder' => 'first row'));
- prepex(14, $db, 'INSERT INTO test(id, label) VALUES(2, :placeholder)',
- array(':placeholder' => 'second row'));
- $stmt = prepex(15, $db, 'SELECT label FROM test');
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
-
- // Is PDO fun?
- prepex(16, $db, 'SELECT label FROM test WHERE :placeholder > 1',
- array(':placeholder' => 'id'));
- prepex(17, $db, 'SELECT :placeholder FROM test WHERE id > 1',
- array(':placeholder' => 'id'));
- prepex(18, $db, 'SELECT :placeholder FROM test WHERE :placeholder > :placeholder',
- array(':placeholder' => 'test'));
-
- for ($num_params = 2; $num_params < 100; $num_params++) {
- $params = array(':placeholder' => 'a');
- for ($i = 1; $i < $num_params; $i++) {
- $params[str_repeat('a', $i)] = 'some data';
- }
- prepex(19, $db, 'SELECT id, label FROM test WHERE label > :placeholder',
- $params, array('execute' => array('sqlstate' => 'HY093')));
- }
-
- prepex(20, $db, 'DELETE FROM test');
- prepex(21, $db, 'INSERT INTO test(id, label) VALUES (1, :placeholder), (2, :placeholder)',
- array(':placeholder' => 'row'));
- $stmt = prepex(22, $db, 'SELECT id, label FROM test');
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
-
- $stmt = prepex(23, $db, 'SELECT id, label FROM test WHERE :placeholder IS NOT NULL',
- array(':placeholder' => 1));
- if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2)
- printf("[024] '1' IS NOT NULL evaluates to true, expecting two rows, got %d rows\n", $tmp);
-
- $stmt = prepex(25, $db, 'SELECT id, label FROM test WHERE :placeholder IS NULL',
- array(':placeholder' => 1));
- if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 0)
- printf("[026] '1' IS NOT NULL evaluates to true, expecting zero rows, got %d rows\n", $tmp);
-
- prepex(27, $db, 'DROP TABLE IF EXISTS test');
- prepex(28, $db, 'CREATE TABLE test(id INT, label CHAR(255)) ENGINE=MyISAM');
- if (is_object(prepex(29, $db, 'CREATE FULLTEXT INDEX idx1 ON test(label)'))) {
- prepex(30, $db, 'INSERT INTO test(id, label) VALUES (1, :placeholder)',
- array(':placeholder' => 'MySQL is the best database in the world!'));
- prepex(31, $db, 'INSERT INTO test(id, label) VALUES (1, :placeholder)',
- array(':placeholder' => 'If I have the freedom to choose, I would always go again for the MySQL Server'));
- $stmt = prepex(32, $db, 'SELECT id, label FROM test WHERE MATCH label AGAINST (:placeholder)',
- array(':placeholder' => 'mysql'));
- /*
- Lets ignore this
- if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2)
- printf("[033] Expecting two rows, got %d rows\n", $tmp);
- */
- }
- prepex(34, $db, 'DELETE FROM test');
- prepex(35, $db, 'INSERT INTO test(id, label) VALUES (1, :placeholder), (2, :placeholder)',
- array(':placeholder' => 'row'));
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
+
+ function prepex($offset, &$db, $query, $input_params = null, $error_info = null) {
+
+ try {
+
+ if (is_array($error_info) && isset($error_info['prepare']))
+ $stmt = @$db->prepare($query);
+ else
+ $stmt = $db->prepare($query);
+
+ if (is_array($error_info) && isset($error_info['prepare'])) {
+ $tmp = $db->errorInfo();
+
+ if (isset($error_info['prepare']['sqlstate']) &&
+ ($error_info['prepare']['sqlstate'] !== $tmp[0])) {
+ printf("[%03d] prepare() - expecting SQLSTATE '%s' got '%s'\n",
+ $offset, $error_info['prepare']['sqlstate'], $tmp[0]);
+ return false;
+ }
+
+ if (isset($error_info['prepare']['mysql']) &&
+ ($error_info['prepare']['mysql'] !== $tmp[1])) {
+ printf("[%03d] prepare() - expecting MySQL Code '%s' got '%s'\n",
+ $offset, $error_info['prepare']['mysql'], $tmp[0]);
+ return false;
+ }
+
+ return false;
+ }
+
+ if (is_null($input_params))
+ $input_params = array();
+
+ if (is_array($error_info) && isset($error_info['execute']))
+ $ret = @$stmt->execute($input_params);
+ else
+ $ret = $stmt->execute($input_params);
+
+ if (!is_bool($ret))
+ printf("[%03d] PDO::execute() should return a boolean value, got %s/%s\n",
+ var_export($ret, true), $ret);
+
+ if (is_array($error_info) && isset($error_info['execute'])) {
+ $tmp = $stmt->errorInfo();
+
+ if (isset($error_info['execute']['sqlstate']) &&
+ ($error_info['execute']['sqlstate'] !== $tmp[0])) {
+ printf("[%03d] execute() - expecting SQLSTATE '%s' got '%s'\n",
+ $offset, $error_info['execute']['sqlstate'], $tmp[0]);
+ return false;
+ }
+
+ if (isset($error_info['execute']['mysql']) &&
+ ($error_info['execute']['mysql'] !== $tmp[1])) {
+ printf("[%03d] execute() - expecting MySQL Code '%s' got '%s'\n",
+ $offset, $error_info['execute']['mysql'], $tmp[0]);
+ return false;
+ }
+
+ return false;
+ }
+
+ } catch (PDOException $e) {
+ printf("[%03d] %s, [%s} %s\n",
+ $offset, $e->getMessage(),
+ $db->errorCode(), implode(' ', $db->errorInfo()));
+ return false;
+ }
+
+ return $stmt;
+ }
+
+ try {
+ $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1);
+ if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
+ printf("[002] Unable to switch to emulated prepared statements, test will fail\n");
+
+ // TODO - that's PDO - you can prepare empty statements!
+ prepex(3, $db, '',
+ array(), array('execute' => array('sqlstate' => '42000')));
+
+ // lets be fair and do the most simple SELECT first
+ $stmt = prepex(4, $db, 'SELECT 1 as "one"');
+ var_dump($stmt->fetch(PDO::FETCH_ASSOC));
+
+ prepex(5, $db, 'DROP TABLE IF EXISTS test');
+ prepex(6, $db, sprintf('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE));
+ prepex(7, $db, "INSERT INTO test(id, label) VALUES(1, ':placeholder')");
+ $stmt = prepex(8, $db, 'SELECT label FROM test');
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+
+ prepex(9, $db, 'DELETE FROM test');
+ prepex(10, $db, "INSERT INTO test(id, label) VALUES(1, ':placeholder')",
+ array(':placeholder' => 'first row'));
+ $stmt = prepex(11, $db, 'SELECT label FROM test');
+
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+ prepex(12, $db, 'DELETE FROM test');
+ prepex(13, $db, 'INSERT INTO test(id, label) VALUES(1, :placeholder)',
+ array(':placeholder' => 'first row'));
+ prepex(14, $db, 'INSERT INTO test(id, label) VALUES(2, :placeholder)',
+ array(':placeholder' => 'second row'));
+ $stmt = prepex(15, $db, 'SELECT label FROM test');
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+
+ // Is PDO fun?
+ prepex(16, $db, 'SELECT label FROM test WHERE :placeholder > 1',
+ array(':placeholder' => 'id'));
+ prepex(17, $db, 'SELECT :placeholder FROM test WHERE id > 1',
+ array(':placeholder' => 'id'));
+ prepex(18, $db, 'SELECT :placeholder FROM test WHERE :placeholder > :placeholder',
+ array(':placeholder' => 'test'));
+
+ for ($num_params = 2; $num_params < 100; $num_params++) {
+ $params = array(':placeholder' => 'a');
+ for ($i = 1; $i < $num_params; $i++) {
+ $params[str_repeat('a', $i)] = 'some data';
+ }
+ prepex(19, $db, 'SELECT id, label FROM test WHERE label > :placeholder',
+ $params, array('execute' => array('sqlstate' => 'HY093')));
+ }
+
+ prepex(20, $db, 'DELETE FROM test');
+ prepex(21, $db, 'INSERT INTO test(id, label) VALUES (1, :placeholder), (2, :placeholder)',
+ array(':placeholder' => 'row'));
+ $stmt = prepex(22, $db, 'SELECT id, label FROM test');
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+
+ $stmt = prepex(23, $db, 'SELECT id, label FROM test WHERE :placeholder IS NOT NULL',
+ array(':placeholder' => 1));
+ if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2)
+ printf("[024] '1' IS NOT NULL evaluates to true, expecting two rows, got %d rows\n", $tmp);
+
+ $stmt = prepex(25, $db, 'SELECT id, label FROM test WHERE :placeholder IS NULL',
+ array(':placeholder' => 1));
+ if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 0)
+ printf("[026] '1' IS NOT NULL evaluates to true, expecting zero rows, got %d rows\n", $tmp);
+
+ prepex(27, $db, 'DROP TABLE IF EXISTS test');
+ prepex(28, $db, 'CREATE TABLE test(id INT, label CHAR(255)) ENGINE=MyISAM');
+ if (is_object(prepex(29, $db, 'CREATE FULLTEXT INDEX idx1 ON test(label)'))) {
+ prepex(30, $db, 'INSERT INTO test(id, label) VALUES (1, :placeholder)',
+ array(':placeholder' => 'MySQL is the best database in the world!'));
+ prepex(31, $db, 'INSERT INTO test(id, label) VALUES (1, :placeholder)',
+ array(':placeholder' => 'If I have the freedom to choose, I would always go again for the MySQL Server'));
+ $stmt = prepex(32, $db, 'SELECT id, label FROM test WHERE MATCH label AGAINST (:placeholder)',
+ array(':placeholder' => 'mysql'));
+ /*
+ Lets ignore this
+ if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2)
+ printf("[033] Expecting two rows, got %d rows\n", $tmp);
+ */
+ }
+ prepex(34, $db, 'DELETE FROM test');
+ prepex(35, $db, 'INSERT INTO test(id, label) VALUES (1, :placeholder), (2, :placeholder)',
+ array(':placeholder' => 'row'));
/*
- $stmt = prepex(36, $db, 'SELECT id, label FROM "test WHERE MATCH label AGAINST (:placeholder)',
- array(':placeholder' => 'row'),
- array('execute' => array('sqlstate' => '42000', 'mysql' => 1064)));
+ $stmt = prepex(36, $db, 'SELECT id, label FROM "test WHERE MATCH label AGAINST (:placeholder)',
+ array(':placeholder' => 'row'),
+ array('execute' => array('sqlstate' => '42000', 'mysql' => 1064)));
*/
- $stmt = prepex(37, $db, 'SELECT id, label FROM \'test WHERE MATCH label AGAINST (:placeholder)',
- array(':placeholder' => 'row'),
- array('execute' => array('sqlstate' => '42000', 'mysql' => 1064)));
-
- $stmt = prepex(38, $db, 'SELECT id, label AS "label" FROM test WHERE label = :placeholder',
- array(':placeholder' => 'row'));
-
- $sql = sprintf("SELECT id, label FROM test WHERE (label LIKE %s) AND (id = :placeholder)",
- $db->quote('%ro%'));
- $stmt = prepex(39, $db, $sql, array('placeholder' => -1));
- if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 0)
- printf("[040] Expecting zero rows, got %d rows\n", $tmp);
-
-
- $sql = sprintf("SELECT id, label FROM test WHERE (id = :placeholder) OR (label LIKE %s)",
- $db->quote('%ro%'));
- $stmt = prepex(41, $db, $sql, array('placeholder' => 1));
- if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2)
- printf("[042] Expecting two rows, got %d rows\n", $tmp);
-
- $sql = "SELECT id, label FROM test WHERE id = :placeholder AND label = (SELECT label AS 'SELECT' FROM test WHERE id = :placeholder)";
- $stmt = prepex(43, $db, $sql, array('placeholder' => 1));
- if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 1)
- printf("[044] Expecting onw row, got %d rows\n", $tmp);
-
- // and now, the same with anonymous placeholders...
- prepex(45, $db, 'DROP TABLE IF EXISTS test');
- prepex(46, $db, sprintf('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE));
- prepex(47, $db, "INSERT INTO test(id, label) VALUES(1, '?')");
- $stmt = prepex(48, $db, 'SELECT label FROM test');
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
-
- prepex(49, $db, 'DELETE FROM test');
- prepex(50, $db, "INSERT INTO test(id, label) VALUES(1, '?')",
- array('first row'));
- $stmt = prepex(51, $db, 'SELECT label FROM test');
-
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
- prepex(52, $db, 'DELETE FROM test');
- prepex(53, $db, 'INSERT INTO test(id, label) VALUES(1, ?)',
- array('first row'));
- prepex(54, $db, 'INSERT INTO test(id, label) VALUES(2, ?)',
- array('second row'));
- $stmt = prepex(55, $db, 'SELECT label FROM test');
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
-
- // Is PDO fun?
- prepex(56, $db, 'SELECT label FROM test WHERE ? > 1',
- array('id'));
- prepex(57, $db, 'SELECT ? FROM test WHERE id > 1',
- array('id'));
- prepex(58, $db, 'SELECT ? FROM test WHERE ? > ?',
- array('test'), array('execute' => array('sqlstate' => 'HY093')));
-
- prepex(59, $db, 'SELECT ? FROM test WHERE ? > ?',
- array('id', 'label', 'value'));
-
- for ($num_params = 2; $num_params < 100; $num_params++) {
- $params = array('a');
- for ($i = 1; $i < $num_params; $i++) {
- $params[] = 'some data';
- }
- prepex(60, $db, 'SELECT id, label FROM test WHERE label > ?',
- $params, array('execute' => array('sqlstate' => 'HY093')));
- }
-
- prepex(61, $db, 'DELETE FROM test');
- prepex(62, $db, 'INSERT INTO test(id, label) VALUES (1, ?), (2, ?)',
- array('row', 'row'));
- $stmt = prepex(63, $db, 'SELECT id, label FROM test');
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
-
- $stmt = prepex(64, $db, 'SELECT id, label FROM test WHERE ? IS NOT NULL',
- array(1));
- if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2)
- printf("[065] '1' IS NOT NULL evaluates to true, expecting two rows, got %d rows\n", $tmp);
-
- $stmt = prepex(66, $db, 'SELECT id, label FROM test WHERE ? IS NULL',
- array(1));
- if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 0)
- printf("[067] '1' IS NOT NULL evaluates to true, expecting zero rows, got %d rows\n", $tmp);
-
- prepex(68, $db, 'DROP TABLE IF EXISTS test');
- prepex(69, $db, 'CREATE TABLE test(id INT, label CHAR(255)) ENGINE=MyISAM');
- if (is_object(prepex(70, $db, 'CREATE FULLTEXT INDEX idx1 ON test(label)'))) {
- prepex(71, $db, 'INSERT INTO test(id, label) VALUES (1, ?)',
- array('MySQL is the best database in the world!'));
- prepex(72, $db, 'INSERT INTO test(id, label) VALUES (1, ?)',
- array('If I have the freedom to choose, I would always go again for the MySQL Server'));
- $stmt = prepex(73, $db, 'SELECT id, label FROM test WHERE MATCH label AGAINST (?)',
- array('mysql'));
- /*
- Lets ignore that
- if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2)
- printf("[074] Expecting two rows, got %d rows\n", $tmp);
- */
- }
-
- prepex(74, $db, 'DELETE FROM test');
- prepex(75, $db, 'INSERT INTO test(id, label) VALUES (1, ?), (2, ?)',
- array('row', 'row'));
-
- $stmt = prepex(76, $db, 'SELECT id, label FROM "test WHERE MATCH label AGAINST (?)',
- array('row'),
- array('execute' => array('sqlstate' => '42000', 'mysql' => 1064)));
-
- /*
- TODO enable after fix
- $stmt = prepex(37, $db, 'SELECT id, label FROM \'test WHERE MATCH label AGAINST (:placeholder)',
- array(':placeholder' => 'row'),
- array('execute' => array('sqlstate' => '42000', 'mysql' => 1064)));
- */
-
- $stmt = prepex(78, $db, 'SELECT id, label AS "label" FROM test WHERE label = ?',
- array('row'));
-
- $sql = sprintf("SELECT id, label FROM test WHERE (label LIKE %s) AND (id = ?)",
- $db->quote('%ro%'));
- $stmt = prepex(79, $db, $sql, array(-1));
- if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 0)
- printf("[080] Expecting zero rows, got %d rows\n", $tmp);
-
-
- $sql = sprintf("SELECT id, label FROM test WHERE (id = ?) OR (label LIKE %s)",
- $db->quote('%ro%'));
- $stmt = prepex(81, $db, $sql, array(1));
- if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2)
- printf("[082] Expecting two rows, got %d rows\n", $tmp);
-
- $sql = "SELECT id, label FROM test WHERE id = ? AND label = (SELECT label AS 'SELECT' FROM test WHERE id = ?)";
- $stmt = prepex(83, $db, $sql, array(1, 1));
- if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 1)
- printf("[084] Expecting one row, got %d rows\n", $tmp);
-
- $sql = "SELECT id, label FROM test WHERE id = :placeholder AND label = (SELECT label AS 'SELECT' FROM test WHERE id = ?)";
- $stmt = prepex(85, $db, $sql, array(1, 1), array('execute' => array('sqlstate' => 'HY093')));
- if (is_object($stmt) && count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 0)
- printf("[086] Expecting no rows, got %d rows\n", $tmp);
-
- } catch (PDOException $e) {
- printf("[001] %s [%s] %s\n",
- $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
- }
-
- print "done!";
+ $stmt = prepex(37, $db, 'SELECT id, label FROM \'test WHERE MATCH label AGAINST (:placeholder)',
+ array(':placeholder' => 'row'),
+ array('execute' => array('sqlstate' => '42000', 'mysql' => 1064)));
+
+ $stmt = prepex(38, $db, 'SELECT id, label AS "label" FROM test WHERE label = :placeholder',
+ array(':placeholder' => 'row'));
+
+ $sql = sprintf("SELECT id, label FROM test WHERE (label LIKE %s) AND (id = :placeholder)",
+ $db->quote('%ro%'));
+ $stmt = prepex(39, $db, $sql, array('placeholder' => -1));
+ if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 0)
+ printf("[040] Expecting zero rows, got %d rows\n", $tmp);
+
+
+ $sql = sprintf("SELECT id, label FROM test WHERE (id = :placeholder) OR (label LIKE %s)",
+ $db->quote('%ro%'));
+ $stmt = prepex(41, $db, $sql, array('placeholder' => 1));
+ if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2)
+ printf("[042] Expecting two rows, got %d rows\n", $tmp);
+
+ $sql = "SELECT id, label FROM test WHERE id = :placeholder AND label = (SELECT label AS 'SELECT' FROM test WHERE id = :placeholder)";
+ $stmt = prepex(43, $db, $sql, array('placeholder' => 1));
+ if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 1)
+ printf("[044] Expecting onw row, got %d rows\n", $tmp);
+
+ // and now, the same with anonymous placeholders...
+ prepex(45, $db, 'DROP TABLE IF EXISTS test');
+ prepex(46, $db, sprintf('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE));
+ prepex(47, $db, "INSERT INTO test(id, label) VALUES(1, '?')");
+ $stmt = prepex(48, $db, 'SELECT label FROM test');
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+
+ prepex(49, $db, 'DELETE FROM test');
+ prepex(50, $db, "INSERT INTO test(id, label) VALUES(1, '?')",
+ array('first row'));
+ $stmt = prepex(51, $db, 'SELECT label FROM test');
+
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+ prepex(52, $db, 'DELETE FROM test');
+ prepex(53, $db, 'INSERT INTO test(id, label) VALUES(1, ?)',
+ array('first row'));
+ prepex(54, $db, 'INSERT INTO test(id, label) VALUES(2, ?)',
+ array('second row'));
+ $stmt = prepex(55, $db, 'SELECT label FROM test');
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+
+ // Is PDO fun?
+ prepex(56, $db, 'SELECT label FROM test WHERE ? > 1',
+ array('id'));
+ prepex(57, $db, 'SELECT ? FROM test WHERE id > 1',
+ array('id'));
+ prepex(58, $db, 'SELECT ? FROM test WHERE ? > ?',
+ array('test'), array('execute' => array('sqlstate' => 'HY093')));
+
+ prepex(59, $db, 'SELECT ? FROM test WHERE ? > ?',
+ array('id', 'label', 'value'));
+
+ for ($num_params = 2; $num_params < 100; $num_params++) {
+ $params = array('a');
+ for ($i = 1; $i < $num_params; $i++) {
+ $params[] = 'some data';
+ }
+ prepex(60, $db, 'SELECT id, label FROM test WHERE label > ?',
+ $params, array('execute' => array('sqlstate' => 'HY093')));
+ }
+
+ prepex(61, $db, 'DELETE FROM test');
+ prepex(62, $db, 'INSERT INTO test(id, label) VALUES (1, ?), (2, ?)',
+ array('row', 'row'));
+ $stmt = prepex(63, $db, 'SELECT id, label FROM test');
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+
+ $stmt = prepex(64, $db, 'SELECT id, label FROM test WHERE ? IS NOT NULL',
+ array(1));
+ if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2)
+ printf("[065] '1' IS NOT NULL evaluates to true, expecting two rows, got %d rows\n", $tmp);
+
+ $stmt = prepex(66, $db, 'SELECT id, label FROM test WHERE ? IS NULL',
+ array(1));
+ if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 0)
+ printf("[067] '1' IS NOT NULL evaluates to true, expecting zero rows, got %d rows\n", $tmp);
+
+ prepex(68, $db, 'DROP TABLE IF EXISTS test');
+ prepex(69, $db, 'CREATE TABLE test(id INT, label CHAR(255)) ENGINE=MyISAM');
+ if (is_object(prepex(70, $db, 'CREATE FULLTEXT INDEX idx1 ON test(label)'))) {
+ prepex(71, $db, 'INSERT INTO test(id, label) VALUES (1, ?)',
+ array('MySQL is the best database in the world!'));
+ prepex(72, $db, 'INSERT INTO test(id, label) VALUES (1, ?)',
+ array('If I have the freedom to choose, I would always go again for the MySQL Server'));
+ $stmt = prepex(73, $db, 'SELECT id, label FROM test WHERE MATCH label AGAINST (?)',
+ array('mysql'));
+ /*
+ Lets ignore that
+ if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2)
+ printf("[074] Expecting two rows, got %d rows\n", $tmp);
+ */
+ }
+
+ prepex(74, $db, 'DELETE FROM test');
+ prepex(75, $db, 'INSERT INTO test(id, label) VALUES (1, ?), (2, ?)',
+ array('row', 'row'));
+
+ $stmt = prepex(76, $db, 'SELECT id, label FROM "test WHERE MATCH label AGAINST (?)',
+ array('row'),
+ array('execute' => array('sqlstate' => '42000', 'mysql' => 1064)));
+
+ /*
+ TODO enable after fix
+ $stmt = prepex(37, $db, 'SELECT id, label FROM \'test WHERE MATCH label AGAINST (:placeholder)',
+ array(':placeholder' => 'row'),
+ array('execute' => array('sqlstate' => '42000', 'mysql' => 1064)));
+ */
+
+ $stmt = prepex(78, $db, 'SELECT id, label AS "label" FROM test WHERE label = ?',
+ array('row'));
+
+ $sql = sprintf("SELECT id, label FROM test WHERE (label LIKE %s) AND (id = ?)",
+ $db->quote('%ro%'));
+ $stmt = prepex(79, $db, $sql, array(-1));
+ if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 0)
+ printf("[080] Expecting zero rows, got %d rows\n", $tmp);
+
+
+ $sql = sprintf("SELECT id, label FROM test WHERE (id = ?) OR (label LIKE %s)",
+ $db->quote('%ro%'));
+ $stmt = prepex(81, $db, $sql, array(1));
+ if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2)
+ printf("[082] Expecting two rows, got %d rows\n", $tmp);
+
+ $sql = "SELECT id, label FROM test WHERE id = ? AND label = (SELECT label AS 'SELECT' FROM test WHERE id = ?)";
+ $stmt = prepex(83, $db, $sql, array(1, 1));
+ if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 1)
+ printf("[084] Expecting one row, got %d rows\n", $tmp);
+
+ $sql = "SELECT id, label FROM test WHERE id = :placeholder AND label = (SELECT label AS 'SELECT' FROM test WHERE id = ?)";
+ $stmt = prepex(85, $db, $sql, array(1, 1), array('execute' => array('sqlstate' => 'HY093')));
+ if (is_object($stmt) && count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 0)
+ printf("[086] Expecting no rows, got %d rows\n", $tmp);
+
+ } catch (PDOException $e) {
+ printf("[001] %s [%s] %s\n",
+ $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_anonymous.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_anonymous.phpt
index e8b5cb39ae..abd2615ce8 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_anonymous.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_anonymous.phpt
@@ -9,54 +9,54 @@ $db = MySQLPDOTest::factory();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
- try {
- $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1);
- if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
- printf("[002] Unable to switch to emulated prepared statements, test will fail\n");
+ try {
+ $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1);
+ if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
+ printf("[002] Unable to switch to emulated prepared statements, test will fail\n");
- $db->exec('DROP TABLE IF EXISTS test');
- $db->exec(sprintf('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE));
+ $db->exec('DROP TABLE IF EXISTS test');
+ $db->exec(sprintf('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE));
- $stmt = $db->prepare("INSERT INTO test(id, label) VALUES(1, '?')");
- // you can bind as many values as you want no matter if they can be replaced or not
- $stmt->execute(array('first row'));
- if ('00000' !== $stmt->errorCode())
- printf("[003] Execute has failed, %s %s\n",
- var_export($stmt->errorCode(), true),
- var_export($stmt->errorInfo(), true));
+ $stmt = $db->prepare("INSERT INTO test(id, label) VALUES(1, '?')");
+ // you can bind as many values as you want no matter if they can be replaced or not
+ $stmt->execute(array('first row'));
+ if ('00000' !== $stmt->errorCode())
+ printf("[003] Execute has failed, %s %s\n",
+ var_export($stmt->errorCode(), true),
+ var_export($stmt->errorInfo(), true));
- $stmt = $db->prepare('SELECT id, label FROM test');
- $stmt->execute();
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+ $stmt = $db->prepare('SELECT id, label FROM test');
+ $stmt->execute();
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
- // now the same with native PS
- printf("now the same with native PS\n");
- $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
- if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
- printf("[004] Unable to switch off emulated prepared statements, test will fail\n");
+ // now the same with native PS
+ printf("now the same with native PS\n");
+ $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
+ if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
+ printf("[004] Unable to switch off emulated prepared statements, test will fail\n");
- $db->exec('DELETE FROM test');
- $stmt = $db->prepare("INSERT INTO test(id, label) VALUES(1, '?')");
- // you can bind as many values as you want no matter if they can be replaced or not
- $stmt->execute(array('first row'));
- if ('00000' !== $stmt->errorCode())
- printf("[005] Execute has failed, %s %s\n",
- var_export($stmt->errorCode(), true),
- var_export($stmt->errorInfo(), true));
+ $db->exec('DELETE FROM test');
+ $stmt = $db->prepare("INSERT INTO test(id, label) VALUES(1, '?')");
+ // you can bind as many values as you want no matter if they can be replaced or not
+ $stmt->execute(array('first row'));
+ if ('00000' !== $stmt->errorCode())
+ printf("[005] Execute has failed, %s %s\n",
+ var_export($stmt->errorCode(), true),
+ var_export($stmt->errorInfo(), true));
- $stmt = $db->prepare('SELECT id, label FROM test');
- $stmt->execute();
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+ $stmt = $db->prepare('SELECT id, label FROM test');
+ $stmt->execute();
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
- } catch (PDOException $e) {
- printf("[001] %s [%s] %s\n",
- $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
- }
+ } catch (PDOException $e) {
+ printf("[001] %s [%s] %s\n",
+ $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_placeholder_everywhere.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_placeholder_everywhere.phpt
index 5ad3c85641..e47b03b999 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_placeholder_everywhere.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_placeholder_everywhere.phpt
@@ -9,50 +9,50 @@ MySQLPDOTest::skip();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
- try {
- // native PS
- $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
- if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
- printf("[002] Unable to switch off emulated prepared statements, test will fail\n");
+ try {
+ // native PS
+ $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
+ if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
+ printf("[002] Unable to switch off emulated prepared statements, test will fail\n");
- $db->exec('DROP TABLE IF EXISTS test');
- $db->exec(sprintf('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE));
- $db->exec("INSERT INTO test(id, label) VALUES (1, 'row1')");
+ $db->exec('DROP TABLE IF EXISTS test');
+ $db->exec(sprintf('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE));
+ $db->exec("INSERT INTO test(id, label) VALUES (1, 'row1')");
- // So, what will happen? More placeholder but values and
- // placeholders in interesting places...
- $stmt = $db->prepare('SELECT ? FROM test WHERE ? > ?');
- $stmt->execute(array('test'));
- if ('00000' !== $stmt->errorCode()) {
- printf("[003] Execute has failed, %s %s\n",
- var_export($stmt->errorCode(), true),
- var_export($stmt->errorInfo(), true));
- }
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+ // So, what will happen? More placeholder but values and
+ // placeholders in interesting places...
+ $stmt = $db->prepare('SELECT ? FROM test WHERE ? > ?');
+ $stmt->execute(array('test'));
+ if ('00000' !== $stmt->errorCode()) {
+ printf("[003] Execute has failed, %s %s\n",
+ var_export($stmt->errorCode(), true),
+ var_export($stmt->errorInfo(), true));
+ }
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
- // now the same with emulated PS
- printf("now the same with emulated PS\n");
- $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1);
- if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
- printf("[004] Unable to switch on emulated prepared statements, test will fail\n");
+ // now the same with emulated PS
+ printf("now the same with emulated PS\n");
+ $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1);
+ if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
+ printf("[004] Unable to switch on emulated prepared statements, test will fail\n");
- $stmt = $db->prepare('SELECT ? FROM test WHERE ? > ?');
- $stmt->execute(array('test'));
- if ('00000' !== $stmt->errorCode())
- printf("[005] Execute has failed, %s %s\n",
- var_export($stmt->errorCode(), true),
- var_export($stmt->errorInfo(), true));
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+ $stmt = $db->prepare('SELECT ? FROM test WHERE ? > ?');
+ $stmt->execute(array('test'));
+ if ('00000' !== $stmt->errorCode())
+ printf("[005] Execute has failed, %s %s\n",
+ var_export($stmt->errorCode(), true),
+ var_export($stmt->errorInfo(), true));
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
- } catch (PDOException $e) {
- printf("[001] %s [%s] %s\n",
- $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
- }
+ } catch (PDOException $e) {
+ printf("[001] %s [%s] %s\n",
+ $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_load_data.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_load_data.phpt
index 0e7dc4b3ab..c76a7460c9 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_prepare_load_data.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_load_data.phpt
@@ -30,89 +30,89 @@ if (($row = $stmt->fetch(PDO::FETCH_ASSOC)) && ($row['value'] != '')) {
?>
--FILE--
<?php
- function exec_and_count($offset, &$db, $sql, $exp) {
-
- try {
-
- $ret = $db->exec($sql);
- if ($ret !== $exp) {
- printf("[%03d] Expecting '%s'/%s got '%s'/%s when running '%s', [%s] %s\n",
- $offset, $exp, gettype($exp), $ret, gettype($ret), $sql,
- $db->errorCode(), implode(' ', $db->errorInfo()));
- return false;
- }
-
- } catch (PDOException $e) {
-
- if (42000 == $db->errorCode()) {
- // Error: 1148 SQLSTATE: 42000 (ER_NOT_ALLOWED_COMMAND)
- // Load data infile not allowed
- return false;
- }
-
- printf("[%03d] '%s' has failed, [%s] %s\n",
- $offset, $sql, $db->errorCode(), implode(' ', $db->errorInfo()));
- return false;
- }
-
- return true;
- }
-
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
- // Run with native PS.
- // The test is about checking the fallback to emulation
- $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
- MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db));
-
- /* affected rows related */
- try {
-
- exec_and_count(2, $db, 'DROP TABLE IF EXISTS test', 0);
- exec_and_count(3, $db, sprintf('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, col1 CHAR(10)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE), 0);
-
- $stmt = $db->query("SHOW VARIABLES LIKE 'secure_file_priv'");
- if (($row = $stmt->fetch(PDO::FETCH_ASSOC)) && ($row['value'] != '')) {
- $filename = $row['value'] . DIRECTORY_SEPARATOR . "pdo_mysql_exec_load_data.csv";
- } else {
- $filename = MySQLPDOTest::getTempDir() . DIRECTORY_SEPARATOR . "pdo_mysql_exec_load_data.csv";
- }
-
- $fp = fopen($filename, "w");
- fwrite($fp, "1;foo\n");
- fwrite($fp, "2;bar");
- fclose($fp);
-
- // This should fail, the PS protocol should not support it.
- // mysqlnd will give 2014 as a follow-up of the fallback logic
- // libmysql will give a little more precise 2030 error code
- // However, you get an error and the big question is what happens to the line
- $stmt = $db->prepare(sprintf("LOAD DATA INFILE %s INTO TABLE test FIELDS TERMINATED BY ';' LINES TERMINATED BY '\n'", $db->quote($filename)));
- if (!$stmt->execute()) {
- printf("[004] [%d] %s\n", $stmt->errorCode(), var_export($stmt->errorInfo(), true));
- }
-
- // Check the line
- $stmt = $db->query("SELECT 1 as 'one'");
- if ($stmt->errorCode() != '0000') {
- printf("[005] [%d] %s\n", $stmt->errorCode(), var_export($stmt->errorInfo(), true));
- } else {
- $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
- if (!isset($rows[0]['one']) || $rows[0]['one'] != 1)
- printf("[006] [%d] %s\n", $stmt->errorCode(), var_export($stmt->errorInfo(), true));
- }
-
- unlink($filename);
-
- } catch (PDOException $e) {
- printf("[001] %s, [%s] %s (%s)\n",
- $e->getMessage(),
- $db->errorCode(),
- implode(' ', $db->errorInfo()),
- (isset($stmt)) ? implode(' ', $stmt->errorInfo()) : 'N/A');
- }
-
- print "done!";
+ function exec_and_count($offset, &$db, $sql, $exp) {
+
+ try {
+
+ $ret = $db->exec($sql);
+ if ($ret !== $exp) {
+ printf("[%03d] Expecting '%s'/%s got '%s'/%s when running '%s', [%s] %s\n",
+ $offset, $exp, gettype($exp), $ret, gettype($ret), $sql,
+ $db->errorCode(), implode(' ', $db->errorInfo()));
+ return false;
+ }
+
+ } catch (PDOException $e) {
+
+ if (42000 == $db->errorCode()) {
+ // Error: 1148 SQLSTATE: 42000 (ER_NOT_ALLOWED_COMMAND)
+ // Load data infile not allowed
+ return false;
+ }
+
+ printf("[%03d] '%s' has failed, [%s] %s\n",
+ $offset, $sql, $db->errorCode(), implode(' ', $db->errorInfo()));
+ return false;
+ }
+
+ return true;
+ }
+
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
+ // Run with native PS.
+ // The test is about checking the fallback to emulation
+ $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
+ MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db));
+
+ /* affected rows related */
+ try {
+
+ exec_and_count(2, $db, 'DROP TABLE IF EXISTS test', 0);
+ exec_and_count(3, $db, sprintf('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, col1 CHAR(10)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE), 0);
+
+ $stmt = $db->query("SHOW VARIABLES LIKE 'secure_file_priv'");
+ if (($row = $stmt->fetch(PDO::FETCH_ASSOC)) && ($row['value'] != '')) {
+ $filename = $row['value'] . DIRECTORY_SEPARATOR . "pdo_mysql_exec_load_data.csv";
+ } else {
+ $filename = MySQLPDOTest::getTempDir() . DIRECTORY_SEPARATOR . "pdo_mysql_exec_load_data.csv";
+ }
+
+ $fp = fopen($filename, "w");
+ fwrite($fp, "1;foo\n");
+ fwrite($fp, "2;bar");
+ fclose($fp);
+
+ // This should fail, the PS protocol should not support it.
+ // mysqlnd will give 2014 as a follow-up of the fallback logic
+ // libmysql will give a little more precise 2030 error code
+ // However, you get an error and the big question is what happens to the line
+ $stmt = $db->prepare(sprintf("LOAD DATA INFILE %s INTO TABLE test FIELDS TERMINATED BY ';' LINES TERMINATED BY '\n'", $db->quote($filename)));
+ if (!$stmt->execute()) {
+ printf("[004] [%d] %s\n", $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+ }
+
+ // Check the line
+ $stmt = $db->query("SELECT 1 as 'one'");
+ if ($stmt->errorCode() != '0000') {
+ printf("[005] [%d] %s\n", $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+ } else {
+ $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
+ if (!isset($rows[0]['one']) || $rows[0]['one'] != 1)
+ printf("[006] [%d] %s\n", $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+ }
+
+ unlink($filename);
+
+ } catch (PDOException $e) {
+ printf("[001] %s, [%s] %s (%s)\n",
+ $e->getMessage(),
+ $db->errorCode(),
+ implode(' ', $db->errorInfo()),
+ (isset($stmt)) ? implode(' ', $stmt->errorInfo()) : 'N/A');
+ }
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_match_against.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_match_against.phpt
index f77c420d67..9c5b953a52 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_prepare_match_against.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_match_against.phpt
@@ -8,35 +8,35 @@ MySQLPDOTest::skip();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
- try {
+ try {
- $db->exec('DROP TABLE IF EXISTS test');
- $db->exec('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=MyISAM');
- $db->exec('CREATE FULLTEXT INDEX idx1 ON test(label)');
+ $db->exec('DROP TABLE IF EXISTS test');
+ $db->exec('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=MyISAM');
+ $db->exec('CREATE FULLTEXT INDEX idx1 ON test(label)');
- $stmt = $db->prepare('SELECT id, label FROM test WHERE MATCH label AGAINST (:placeholder)');
- $stmt->execute(array(':placeholder' => 'row'));
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+ $stmt = $db->prepare('SELECT id, label FROM test WHERE MATCH label AGAINST (:placeholder)');
+ $stmt->execute(array(':placeholder' => 'row'));
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
- $stmt = $db->prepare('SELECT id, label FROM test WHERE MATCH label AGAINST (:placeholder)');
- $stmt->execute(array('placeholder' => 'row'));
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+ $stmt = $db->prepare('SELECT id, label FROM test WHERE MATCH label AGAINST (:placeholder)');
+ $stmt->execute(array('placeholder' => 'row'));
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
- $stmt = $db->prepare('SELECT id, label FROM test WHERE MATCH label AGAINST (?)');
- $stmt->execute(array('row'));
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+ $stmt = $db->prepare('SELECT id, label FROM test WHERE MATCH label AGAINST (?)');
+ $stmt->execute(array('row'));
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
- } catch (PDOException $e) {
+ } catch (PDOException $e) {
- printf("[001] %s, [%s} %s\n",
- $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
+ printf("[001] %s, [%s} %s\n",
+ $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
- }
+ }
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_native.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_native.phpt
index efd472edc6..5ea3e94c1e 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_prepare_native.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_native.phpt
@@ -9,331 +9,331 @@ $db = MySQLPDOTest::factory();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
- function prepex($offset, &$db, $query, $input_params = null, $error_info = null, $suppress_warning = false) {
+ function prepex($offset, &$db, $query, $input_params = null, $error_info = null, $suppress_warning = false) {
- try {
+ try {
- if ($suppress_warning || (is_array($error_info) && isset($error_info['prepare'])))
- $stmt = @$db->prepare($query);
- else
- $stmt = $db->prepare($query);
+ if ($suppress_warning || (is_array($error_info) && isset($error_info['prepare'])))
+ $stmt = @$db->prepare($query);
+ else
+ $stmt = $db->prepare($query);
- if (is_array($error_info) && isset($error_info['prepare'])) {
- $tmp = $db->errorInfo();
+ if (is_array($error_info) && isset($error_info['prepare'])) {
+ $tmp = $db->errorInfo();
- if (isset($error_info['prepare']['sqlstate']) &&
- ($error_info['prepare']['sqlstate'] !== $tmp[0])) {
- printf("[%03d] prepare() - expecting SQLSTATE '%s' got '%s'\n",
- $offset, $error_info['prepare']['sqlstate'], $tmp[0]);
- return false;
- }
+ if (isset($error_info['prepare']['sqlstate']) &&
+ ($error_info['prepare']['sqlstate'] !== $tmp[0])) {
+ printf("[%03d] prepare() - expecting SQLSTATE '%s' got '%s'\n",
+ $offset, $error_info['prepare']['sqlstate'], $tmp[0]);
+ return false;
+ }
- if (isset($error_info['prepare']['mysql']) &&
- ($error_info['prepare']['mysql'] !== $tmp[1])) {
- printf("[%03d] prepare() - expecting MySQL Code '%s' got '%s'\n",
- $offset, $error_info['prepare']['mysql'], $tmp[0]);
- return false;
- }
+ if (isset($error_info['prepare']['mysql']) &&
+ ($error_info['prepare']['mysql'] !== $tmp[1])) {
+ printf("[%03d] prepare() - expecting MySQL Code '%s' got '%s'\n",
+ $offset, $error_info['prepare']['mysql'], $tmp[0]);
+ return false;
+ }
- return false;
- }
+ return false;
+ }
- if (!is_object($stmt))
- return false;
+ if (!is_object($stmt))
+ return false;
- if (is_null($input_params))
- $input_params = array();
+ if (is_null($input_params))
+ $input_params = array();
// 5.0.18, 5.1.14 @ 15
// printf("[%03d]\n", $offset);
- if ($suppress_warning || (is_array($error_info) && isset($error_info['execute'])))
- $ret = @$stmt->execute($input_params);
- else
- $ret = $stmt->execute($input_params);
-
- if (!is_bool($ret))
- printf("[%03d] PDO::execute() should return a boolean value, got %s/%s\n",
- var_export($ret, true), $ret);
-
- $tmp = $stmt->errorInfo();
- if (isset($tmp[1]) && ($tmp[1] == 2030)) {
- // Trying to hack around MySQL Server version dependent features
- // 2030 This command is not supported in the prepared statement protocol yet
- return false;
- }
-
- if (is_array($error_info) && isset($error_info['execute'])) {
-
- if (isset($error_info['execute']['sqlstate']) &&
- ($error_info['execute']['sqlstate'] !== $tmp[0])) {
- printf("[%03d] execute() - expecting SQLSTATE '%s' got '%s'\n",
- $offset, $error_info['execute']['sqlstate'], $tmp[0]);
- return false;
- }
-
- if (isset($error_info['execute']['mysql']) &&
- ($error_info['execute']['mysql'] !== $tmp[1])) {
- printf("[%03d] execute() - expecting MySQL Code '%s' got '%s'\n",
- $offset, $error_info['execute']['mysql'], $tmp[0]);
- return false;
- }
-
- return false;
-
- }
-
- } catch (PDOException $e) {
- printf("[%03d] %s, [%s} %s\n",
- $offset, $e->getMessage(),
- $db->errorCode(), implode(' ', $db->errorInfo()));
- return false;
- }
-
- return $stmt;
- }
-
- try {
- $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
- if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
- printf("[002] Unable to turn off emulated prepared statements\n");
-
- // TODO - that's PDO - you can prepare empty statements!
- prepex(3, $db, '',
- array(), array('prepare' => array('sqlstate' => '42000')));
-
- // lets be fair and do the most simple SELECT first
- $stmt = prepex(4, $db, 'SELECT 1 as "one"');
- if (MySQLPDOTest::isPDOMySQLnd())
- // native types - int
- $expected = array('one' => 1);
- else
- // always strings, like STRINGIFY flag
- $expected = array('one' => '1');
-
- $row = $stmt->fetch(PDO::FETCH_ASSOC);
- if ($row !== $expected) {
- printf("[004a] Expecting %s got %s\n", var_export($expected, true), var_export($row, true));
- }
-
- prepex(5, $db, 'DROP TABLE IF EXISTS test');
- prepex(6, $db, sprintf('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE));
- prepex(7, $db, "INSERT INTO test(id, label) VALUES(1, ':placeholder')");
- $stmt = prepex(8, $db, 'SELECT label FROM test ORDER BY id ASC');
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
-
- prepex(9, $db, 'DELETE FROM test');
- prepex(10, $db, 'INSERT INTO test(id, label) VALUES(1, :placeholder)',
- array(':placeholder' => 'first row'));
- prepex(11, $db, 'INSERT INTO test(id, label) VALUES(2, :placeholder)',
- array(':placeholder' => 'second row'));
- $stmt = prepex(12, $db, 'SELECT label FROM test ORDER BY id ASC');
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
-
- // Is PDO fun?
- $stmt = prepex(13, $db, 'SELECT label FROM test WHERE :placeholder > 1',
- array(':placeholder' => 'id'));
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
-
- for ($num_params = 2; $num_params < 100; $num_params++) {
- $params = array(':placeholder' => 'a');
- for ($i = 1; $i < $num_params; $i++) {
- $params[str_repeat('a', $i)] = 'some data';
- }
- prepex(16, $db, 'SELECT id, label FROM test WHERE label > :placeholder',
- $params, array('execute' => array('sqlstate' => 'HY093')));
- }
-
- $stmt = prepex(16, $db, 'SELECT id, label FROM test WHERE :placeholder IS NOT NULL',
- array(':placeholder' => 1));
- if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2)
- printf("[017] '1' IS NOT NULL evaluates to true, expecting two rows, got %d rows\n", $tmp);
-
- $stmt = prepex(18, $db, 'SELECT id, label FROM test WHERE :placeholder IS NULL',
- array(':placeholder' => 1));
- if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 0)
- printf("[019] '1' IS NOT NULL evaluates to true, expecting zero rows, got %d rows\n", $tmp);
-
- prepex(20, $db, 'DROP TABLE IF EXISTS test');
- prepex(21, $db, 'CREATE TABLE test(id INT, label CHAR(255)) ENGINE=MyISAM');
- // Not every MySQL Server version supports this
- if (is_object(prepex(22, $db, 'CREATE FULLTEXT INDEX idx1 ON test(label)', null, null, true))) {
- prepex(23, $db, 'INSERT INTO test(id, label) VALUES (1, :placeholder)',
- array(':placeholder' => 'MySQL is the best database in the world!'));
- prepex(24, $db, 'INSERT INTO test(id, label) VALUES (2, :placeholder)',
- array(':placeholder' => 'If I have the freedom to choose, I would always go again for the MySQL Server'));
- $stmt = prepex(25, $db, 'SELECT id, label FROM test WHERE MATCH label AGAINST (:placeholder)',
- array(':placeholder' => 'mysql'), null, true);
- if (is_object($stmt)) {
- /*
- Lets ignore this
- if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2)
- printf("[033] Expecting two rows, got %d rows\n", $tmp);
- */
- $stmt = prepex(26, $db, 'SELECT id, label FROM test ORDER BY id ASC');
- if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2)
- printf("[027] Expecting two rows, got %d rows\n", $tmp);
-
- if ($tmp[0]['label'] !== 'MySQL is the best database in the world!') {
- printf("[028] INSERT seems to have failed, dumping data, check manually\n");
- var_dump($tmp);
- }
- }
- }
-
- $db->exec('DELETE FROM test');
- $db->exec("INSERT INTO test(id, label) VALUES (1, 'row1')");
- $db->exec("INSERT INTO test(id, label) VALUES (2, 'row2')");
-
- $sql = sprintf("SELECT id, label FROM test WHERE (label LIKE %s) AND (id = :placeholder)",
- $db->quote('%ro%'));
- $stmt = prepex(29, $db, $sql, array('placeholder' => -1));
- if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 0)
- printf("[030] Expecting zero rows, got %d rows\n", $tmp);
-
- $sql = sprintf("SELECT id, label FROM test WHERE (id = :placeholder) OR (label LIKE %s)",
- $db->quote('%go%'));
- $stmt = prepex(31, $db, $sql, array('placeholder' => 1));
- if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 1)
- printf("[032] Expecting one row, got %d rows\n", $tmp);
-
- // and now, the same with anonymous placeholders...
- prepex(33, $db, 'DROP TABLE IF EXISTS test');
- prepex(34, $db, sprintf('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE));
- prepex(35, $db, "INSERT INTO test(id, label) VALUES(1, '?')");
- $stmt = prepex(36, $db, 'SELECT label FROM test');
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
-
- prepex(37, $db, 'DELETE FROM test');
- prepex(38, $db, 'INSERT INTO test(id, label) VALUES(1, ?)',
- array('first row'));
- prepex(39, $db, 'INSERT INTO test(id, label) VALUES(2, ?)',
- array('second row'));
- $stmt = prepex(40, $db, 'SELECT label FROM test');
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
-
- // Is PDO fun?
- prepex(40, $db, 'SELECT label FROM test WHERE ? > 1',
- array('id'));
- prepex(41, $db, 'SELECT ? FROM test WHERE id > 1',
- array('id'));
- prepex(42, $db, 'SELECT ? FROM test WHERE ? > ?',
- array('id', 'label', 'value'));
-
- for ($num_params = 2; $num_params < 100; $num_params++) {
- $params = array('a');
- for ($i = 1; $i < $num_params; $i++) {
- $params[] = 'some data';
- }
- prepex(43, $db, 'SELECT id, label FROM test WHERE label > ?',
- $params, array('execute' => array('sqlstate' => 'HY093')));
- }
-
- prepex(44, $db, 'DELETE FROM test');
- prepex(45, $db, 'INSERT INTO test(id, label) VALUES (1, ?), (2, ?)',
- array('row', 'row'));
- $stmt = prepex(46, $db, 'SELECT id, label FROM test ORDER BY id');
- $tmp = $stmt->fetchAll(PDO::FETCH_ASSOC);
- $exp = array(
- 0 => array(
- "id" => "1",
- "label" => "row"
- ),
- 1 => array(
- "id" => "2",
- "label" => "row"
- ),
- );
-
- if (MySQLPDOTest::isPDOMySQLnd()) {
- // mysqlnd returns native types
- $exp[0]['id'] = 1;
- $exp[1]['id'] = 2;
- }
- if ($tmp !== $exp) {
- printf("[064] Results seem wrong. Please check dumps manually.\n");
- var_dump($exp);
- var_dump($tmp);
- }
-
- $stmt = prepex(47, $db, 'SELECT id, label FROM test WHERE ? IS NOT NULL',
- array(1));
- if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2)
- printf("[048] '1' IS NOT NULL evaluates to true, expecting two rows, got %d rows\n", $tmp);
-
- $stmt = prepex(49, $db, 'SELECT id, label FROM test WHERE ? IS NULL',
- array(1));
- if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 0)
- printf("[050] '1' IS NOT NULL evaluates to true, expecting zero rows, got %d rows\n", $tmp);
-
- prepex(51, $db, 'DROP TABLE IF EXISTS test');
- prepex(52, $db, 'CREATE TABLE test(id INT, label CHAR(255)) ENGINE=MyISAM');
- if (is_object(prepex(53, $db, 'CREATE FULLTEXT INDEX idx1 ON test(label)', null, null, true))) {
- prepex(54, $db, 'INSERT INTO test(id, label) VALUES (1, ?)',
- array('MySQL is the best database in the world!'));
- prepex(55, $db, 'INSERT INTO test(id, label) VALUES (1, ?)',
- array('If I have the freedom to choose, I would always go again for the MySQL Server'));
- $stmt = prepex(56, $db, 'SELECT id, label FROM test WHERE MATCH label AGAINST (?)',
- array('mysql'), null, true);
- /*
- Lets ignore that
- if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2)
- printf("[074] Expecting two rows, got %d rows\n", $tmp);
- */
- }
-
- prepex(57, $db, 'DELETE FROM test');
- prepex(58, $db, 'INSERT INTO test(id, label) VALUES (1, ?), (2, ?)',
- array('row1', 'row2'));
-
- /*
- TODO enable after fix
- $stmt = prepex(37, $db, 'SELECT id, label FROM \'test WHERE MATCH label AGAINST (:placeholder)',
- array(':placeholder' => 'row'),
- array('execute' => array('sqlstate' => '42000', 'mysql' => 1064)));
- */
-
- $stmt = prepex(59, $db, 'SELECT id, label AS "label" FROM test WHERE label = ?',
- array('row1'));
- $tmp = $stmt->fetchAll(PDO::FETCH_ASSOC);
- $exp = array(
- 0 => array("id" => "1", "label" => "row1")
- );
-
- if (MySQLPDOTest::isPDOMySQLnd()) {
- // mysqlnd returns native types
- $exp[0]['id'] = 1;
- }
- if ($tmp !== $exp) {
- printf("[065] Results seem wrong. Please check dumps manually.\n");
- var_dump($exp);
- var_dump($tmp);
- }
-
- $sql = sprintf("SELECT id, label FROM test WHERE (label LIKE %s) AND (id = ?)",
- $db->quote('%ro%'));
- $stmt = prepex(60, $db, $sql, array(-1));
- if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 0)
- printf("[061] Expecting zero rows, got %d rows\n", $tmp);
-
- $sql = sprintf("SELECT id, label FROM test WHERE (id = ?) OR (label LIKE %s)",
- $db->quote('%ro%'));
- $stmt = prepex(61, $db, $sql, array(1));
- if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2)
- printf("[062] Expecting two rows, got %d rows\n", $tmp);
-
- $sql = "SELECT id, label FROM test WHERE id = ? AND label = (SELECT label AS 'SELECT' FROM test WHERE id = ?)";
- $stmt = prepex(63, $db, $sql, array(1, 1));
- if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 1)
- printf("[064] Expecting one row, got %d rows\n", $tmp);
-
- } catch (PDOException $e) {
- printf("[001] %s [%s] %s\n",
- $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
- }
-
- print "done!";
+ if ($suppress_warning || (is_array($error_info) && isset($error_info['execute'])))
+ $ret = @$stmt->execute($input_params);
+ else
+ $ret = $stmt->execute($input_params);
+
+ if (!is_bool($ret))
+ printf("[%03d] PDO::execute() should return a boolean value, got %s/%s\n",
+ var_export($ret, true), $ret);
+
+ $tmp = $stmt->errorInfo();
+ if (isset($tmp[1]) && ($tmp[1] == 2030)) {
+ // Trying to hack around MySQL Server version dependent features
+ // 2030 This command is not supported in the prepared statement protocol yet
+ return false;
+ }
+
+ if (is_array($error_info) && isset($error_info['execute'])) {
+
+ if (isset($error_info['execute']['sqlstate']) &&
+ ($error_info['execute']['sqlstate'] !== $tmp[0])) {
+ printf("[%03d] execute() - expecting SQLSTATE '%s' got '%s'\n",
+ $offset, $error_info['execute']['sqlstate'], $tmp[0]);
+ return false;
+ }
+
+ if (isset($error_info['execute']['mysql']) &&
+ ($error_info['execute']['mysql'] !== $tmp[1])) {
+ printf("[%03d] execute() - expecting MySQL Code '%s' got '%s'\n",
+ $offset, $error_info['execute']['mysql'], $tmp[0]);
+ return false;
+ }
+
+ return false;
+
+ }
+
+ } catch (PDOException $e) {
+ printf("[%03d] %s, [%s} %s\n",
+ $offset, $e->getMessage(),
+ $db->errorCode(), implode(' ', $db->errorInfo()));
+ return false;
+ }
+
+ return $stmt;
+ }
+
+ try {
+ $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
+ if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
+ printf("[002] Unable to turn off emulated prepared statements\n");
+
+ // TODO - that's PDO - you can prepare empty statements!
+ prepex(3, $db, '',
+ array(), array('prepare' => array('sqlstate' => '42000')));
+
+ // lets be fair and do the most simple SELECT first
+ $stmt = prepex(4, $db, 'SELECT 1 as "one"');
+ if (MySQLPDOTest::isPDOMySQLnd())
+ // native types - int
+ $expected = array('one' => 1);
+ else
+ // always strings, like STRINGIFY flag
+ $expected = array('one' => '1');
+
+ $row = $stmt->fetch(PDO::FETCH_ASSOC);
+ if ($row !== $expected) {
+ printf("[004a] Expecting %s got %s\n", var_export($expected, true), var_export($row, true));
+ }
+
+ prepex(5, $db, 'DROP TABLE IF EXISTS test');
+ prepex(6, $db, sprintf('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE));
+ prepex(7, $db, "INSERT INTO test(id, label) VALUES(1, ':placeholder')");
+ $stmt = prepex(8, $db, 'SELECT label FROM test ORDER BY id ASC');
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+
+ prepex(9, $db, 'DELETE FROM test');
+ prepex(10, $db, 'INSERT INTO test(id, label) VALUES(1, :placeholder)',
+ array(':placeholder' => 'first row'));
+ prepex(11, $db, 'INSERT INTO test(id, label) VALUES(2, :placeholder)',
+ array(':placeholder' => 'second row'));
+ $stmt = prepex(12, $db, 'SELECT label FROM test ORDER BY id ASC');
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+
+ // Is PDO fun?
+ $stmt = prepex(13, $db, 'SELECT label FROM test WHERE :placeholder > 1',
+ array(':placeholder' => 'id'));
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+
+ for ($num_params = 2; $num_params < 100; $num_params++) {
+ $params = array(':placeholder' => 'a');
+ for ($i = 1; $i < $num_params; $i++) {
+ $params[str_repeat('a', $i)] = 'some data';
+ }
+ prepex(16, $db, 'SELECT id, label FROM test WHERE label > :placeholder',
+ $params, array('execute' => array('sqlstate' => 'HY093')));
+ }
+
+ $stmt = prepex(16, $db, 'SELECT id, label FROM test WHERE :placeholder IS NOT NULL',
+ array(':placeholder' => 1));
+ if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2)
+ printf("[017] '1' IS NOT NULL evaluates to true, expecting two rows, got %d rows\n", $tmp);
+
+ $stmt = prepex(18, $db, 'SELECT id, label FROM test WHERE :placeholder IS NULL',
+ array(':placeholder' => 1));
+ if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 0)
+ printf("[019] '1' IS NOT NULL evaluates to true, expecting zero rows, got %d rows\n", $tmp);
+
+ prepex(20, $db, 'DROP TABLE IF EXISTS test');
+ prepex(21, $db, 'CREATE TABLE test(id INT, label CHAR(255)) ENGINE=MyISAM');
+ // Not every MySQL Server version supports this
+ if (is_object(prepex(22, $db, 'CREATE FULLTEXT INDEX idx1 ON test(label)', null, null, true))) {
+ prepex(23, $db, 'INSERT INTO test(id, label) VALUES (1, :placeholder)',
+ array(':placeholder' => 'MySQL is the best database in the world!'));
+ prepex(24, $db, 'INSERT INTO test(id, label) VALUES (2, :placeholder)',
+ array(':placeholder' => 'If I have the freedom to choose, I would always go again for the MySQL Server'));
+ $stmt = prepex(25, $db, 'SELECT id, label FROM test WHERE MATCH label AGAINST (:placeholder)',
+ array(':placeholder' => 'mysql'), null, true);
+ if (is_object($stmt)) {
+ /*
+ Lets ignore this
+ if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2)
+ printf("[033] Expecting two rows, got %d rows\n", $tmp);
+ */
+ $stmt = prepex(26, $db, 'SELECT id, label FROM test ORDER BY id ASC');
+ if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2)
+ printf("[027] Expecting two rows, got %d rows\n", $tmp);
+
+ if ($tmp[0]['label'] !== 'MySQL is the best database in the world!') {
+ printf("[028] INSERT seems to have failed, dumping data, check manually\n");
+ var_dump($tmp);
+ }
+ }
+ }
+
+ $db->exec('DELETE FROM test');
+ $db->exec("INSERT INTO test(id, label) VALUES (1, 'row1')");
+ $db->exec("INSERT INTO test(id, label) VALUES (2, 'row2')");
+
+ $sql = sprintf("SELECT id, label FROM test WHERE (label LIKE %s) AND (id = :placeholder)",
+ $db->quote('%ro%'));
+ $stmt = prepex(29, $db, $sql, array('placeholder' => -1));
+ if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 0)
+ printf("[030] Expecting zero rows, got %d rows\n", $tmp);
+
+ $sql = sprintf("SELECT id, label FROM test WHERE (id = :placeholder) OR (label LIKE %s)",
+ $db->quote('%go%'));
+ $stmt = prepex(31, $db, $sql, array('placeholder' => 1));
+ if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 1)
+ printf("[032] Expecting one row, got %d rows\n", $tmp);
+
+ // and now, the same with anonymous placeholders...
+ prepex(33, $db, 'DROP TABLE IF EXISTS test');
+ prepex(34, $db, sprintf('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE));
+ prepex(35, $db, "INSERT INTO test(id, label) VALUES(1, '?')");
+ $stmt = prepex(36, $db, 'SELECT label FROM test');
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+
+ prepex(37, $db, 'DELETE FROM test');
+ prepex(38, $db, 'INSERT INTO test(id, label) VALUES(1, ?)',
+ array('first row'));
+ prepex(39, $db, 'INSERT INTO test(id, label) VALUES(2, ?)',
+ array('second row'));
+ $stmt = prepex(40, $db, 'SELECT label FROM test');
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+
+ // Is PDO fun?
+ prepex(40, $db, 'SELECT label FROM test WHERE ? > 1',
+ array('id'));
+ prepex(41, $db, 'SELECT ? FROM test WHERE id > 1',
+ array('id'));
+ prepex(42, $db, 'SELECT ? FROM test WHERE ? > ?',
+ array('id', 'label', 'value'));
+
+ for ($num_params = 2; $num_params < 100; $num_params++) {
+ $params = array('a');
+ for ($i = 1; $i < $num_params; $i++) {
+ $params[] = 'some data';
+ }
+ prepex(43, $db, 'SELECT id, label FROM test WHERE label > ?',
+ $params, array('execute' => array('sqlstate' => 'HY093')));
+ }
+
+ prepex(44, $db, 'DELETE FROM test');
+ prepex(45, $db, 'INSERT INTO test(id, label) VALUES (1, ?), (2, ?)',
+ array('row', 'row'));
+ $stmt = prepex(46, $db, 'SELECT id, label FROM test ORDER BY id');
+ $tmp = $stmt->fetchAll(PDO::FETCH_ASSOC);
+ $exp = array(
+ 0 => array(
+ "id" => "1",
+ "label" => "row"
+ ),
+ 1 => array(
+ "id" => "2",
+ "label" => "row"
+ ),
+ );
+
+ if (MySQLPDOTest::isPDOMySQLnd()) {
+ // mysqlnd returns native types
+ $exp[0]['id'] = 1;
+ $exp[1]['id'] = 2;
+ }
+ if ($tmp !== $exp) {
+ printf("[064] Results seem wrong. Please check dumps manually.\n");
+ var_dump($exp);
+ var_dump($tmp);
+ }
+
+ $stmt = prepex(47, $db, 'SELECT id, label FROM test WHERE ? IS NOT NULL',
+ array(1));
+ if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2)
+ printf("[048] '1' IS NOT NULL evaluates to true, expecting two rows, got %d rows\n", $tmp);
+
+ $stmt = prepex(49, $db, 'SELECT id, label FROM test WHERE ? IS NULL',
+ array(1));
+ if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 0)
+ printf("[050] '1' IS NOT NULL evaluates to true, expecting zero rows, got %d rows\n", $tmp);
+
+ prepex(51, $db, 'DROP TABLE IF EXISTS test');
+ prepex(52, $db, 'CREATE TABLE test(id INT, label CHAR(255)) ENGINE=MyISAM');
+ if (is_object(prepex(53, $db, 'CREATE FULLTEXT INDEX idx1 ON test(label)', null, null, true))) {
+ prepex(54, $db, 'INSERT INTO test(id, label) VALUES (1, ?)',
+ array('MySQL is the best database in the world!'));
+ prepex(55, $db, 'INSERT INTO test(id, label) VALUES (1, ?)',
+ array('If I have the freedom to choose, I would always go again for the MySQL Server'));
+ $stmt = prepex(56, $db, 'SELECT id, label FROM test WHERE MATCH label AGAINST (?)',
+ array('mysql'), null, true);
+ /*
+ Lets ignore that
+ if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2)
+ printf("[074] Expecting two rows, got %d rows\n", $tmp);
+ */
+ }
+
+ prepex(57, $db, 'DELETE FROM test');
+ prepex(58, $db, 'INSERT INTO test(id, label) VALUES (1, ?), (2, ?)',
+ array('row1', 'row2'));
+
+ /*
+ TODO enable after fix
+ $stmt = prepex(37, $db, 'SELECT id, label FROM \'test WHERE MATCH label AGAINST (:placeholder)',
+ array(':placeholder' => 'row'),
+ array('execute' => array('sqlstate' => '42000', 'mysql' => 1064)));
+ */
+
+ $stmt = prepex(59, $db, 'SELECT id, label AS "label" FROM test WHERE label = ?',
+ array('row1'));
+ $tmp = $stmt->fetchAll(PDO::FETCH_ASSOC);
+ $exp = array(
+ 0 => array("id" => "1", "label" => "row1")
+ );
+
+ if (MySQLPDOTest::isPDOMySQLnd()) {
+ // mysqlnd returns native types
+ $exp[0]['id'] = 1;
+ }
+ if ($tmp !== $exp) {
+ printf("[065] Results seem wrong. Please check dumps manually.\n");
+ var_dump($exp);
+ var_dump($tmp);
+ }
+
+ $sql = sprintf("SELECT id, label FROM test WHERE (label LIKE %s) AND (id = ?)",
+ $db->quote('%ro%'));
+ $stmt = prepex(60, $db, $sql, array(-1));
+ if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 0)
+ printf("[061] Expecting zero rows, got %d rows\n", $tmp);
+
+ $sql = sprintf("SELECT id, label FROM test WHERE (id = ?) OR (label LIKE %s)",
+ $db->quote('%ro%'));
+ $stmt = prepex(61, $db, $sql, array(1));
+ if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 2)
+ printf("[062] Expecting two rows, got %d rows\n", $tmp);
+
+ $sql = "SELECT id, label FROM test WHERE id = ? AND label = (SELECT label AS 'SELECT' FROM test WHERE id = ?)";
+ $stmt = prepex(63, $db, $sql, array(1, 1));
+ if (count(($tmp = $stmt->fetchAll(PDO::FETCH_ASSOC))) != 1)
+ printf("[064] Expecting one row, got %d rows\n", $tmp);
+
+ } catch (PDOException $e) {
+ printf("[001] %s [%s] %s\n",
+ $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_clear_error.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_clear_error.phpt
index 48bd33fda5..88f9f5dcf1 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_clear_error.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_clear_error.phpt
@@ -9,64 +9,64 @@ $db = MySQLPDOTest::factory();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
- try {
+ try {
- $db->exec('DROP TABLE IF EXISTS test');
- $db->exec(sprintf('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE));
+ $db->exec('DROP TABLE IF EXISTS test');
+ $db->exec(sprintf('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE));
- // We need to run the emulated version first. Native version will cause a fatal error
- $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1);
- if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
- printf("[002] Unable to turn on emulated prepared statements\n");
+ // We need to run the emulated version first. Native version will cause a fatal error
+ $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1);
+ if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
+ printf("[002] Unable to turn on emulated prepared statements\n");
- // INSERT a single row
- $db->exec("INSERT INTO test(id, label) VALUES (1, 'row1')");
+ // INSERT a single row
+ $db->exec("INSERT INTO test(id, label) VALUES (1, 'row1')");
- $stmt = $db->prepare('SELECT unknown_column FROM test WHERE id > :placeholder ORDER BY id ASC');
- $stmt->execute(array(':placeholder' => 0));
- if ('00000' !== $stmt->errorCode())
- printf("[003] Execute has failed, %s %s\n",
- var_export($stmt->errorCode(), true),
- var_export($stmt->errorInfo(), true));
+ $stmt = $db->prepare('SELECT unknown_column FROM test WHERE id > :placeholder ORDER BY id ASC');
+ $stmt->execute(array(':placeholder' => 0));
+ if ('00000' !== $stmt->errorCode())
+ printf("[003] Execute has failed, %s %s\n",
+ var_export($stmt->errorCode(), true),
+ var_export($stmt->errorInfo(), true));
- $stmt = $db->prepare('SELECT id, label FROM test WHERE id > :placeholder ORDER BY id ASC');
- $stmt->execute(array(':placeholder' => 0));
- if ('00000' !== $stmt->errorCode())
- printf("[004] Execute has failed, %s %s\n",
- var_export($stmt->errorCode(), true),
- var_export($stmt->errorInfo(), true));
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+ $stmt = $db->prepare('SELECT id, label FROM test WHERE id > :placeholder ORDER BY id ASC');
+ $stmt->execute(array(':placeholder' => 0));
+ if ('00000' !== $stmt->errorCode())
+ printf("[004] Execute has failed, %s %s\n",
+ var_export($stmt->errorCode(), true),
+ var_export($stmt->errorInfo(), true));
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
- // Native PS
- $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
- if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
- printf("[005] Unable to turn off emulated prepared statements\n");
+ // Native PS
+ $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
+ if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
+ printf("[005] Unable to turn off emulated prepared statements\n");
- $stmt = $db->prepare('SELECT unknown_column FROM test WHERE id > :placeholder ORDER BY id ASC');
- $stmt->execute(array(':placeholder' => 0));
- if ('00000' !== $stmt->errorCode())
- printf("[006] Execute has failed, %s %s\n",
- var_export($stmt->errorCode(), true),
- var_export($stmt->errorInfo(), true));
+ $stmt = $db->prepare('SELECT unknown_column FROM test WHERE id > :placeholder ORDER BY id ASC');
+ $stmt->execute(array(':placeholder' => 0));
+ if ('00000' !== $stmt->errorCode())
+ printf("[006] Execute has failed, %s %s\n",
+ var_export($stmt->errorCode(), true),
+ var_export($stmt->errorInfo(), true));
- $stmt = $db->prepare('SELECT id, label FROM test WHERE id > :placeholder ORDER BY id ASC');
- $stmt->execute(array(':placeholder' => 0));
- if ('00000' !== $stmt->errorCode())
- printf("[007] Execute has failed, %s %s\n",
- var_export($stmt->errorCode(), true),
- var_export($stmt->errorInfo(), true));
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+ $stmt = $db->prepare('SELECT id, label FROM test WHERE id > :placeholder ORDER BY id ASC');
+ $stmt->execute(array(':placeholder' => 0));
+ if ('00000' !== $stmt->errorCode())
+ printf("[007] Execute has failed, %s %s\n",
+ var_export($stmt->errorCode(), true),
+ var_export($stmt->errorInfo(), true));
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
- } catch (PDOException $e) {
- printf("[001] %s [%s] %s\n",
- $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
- }
+ } catch (PDOException $e) {
+ printf("[001] %s [%s] %s\n",
+ $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_column.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_column.phpt
index 1ee1c3a43b..4c9dcb0e7e 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_column.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_column.phpt
@@ -9,24 +9,24 @@ $db = MySQLPDOTest::factory();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
- MySQLPDOTest::createTestTable($db);
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
+ MySQLPDOTest::createTestTable($db);
- $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
- if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
- printf("[002] Unable to turn off emulated prepared statements\n");
+ $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
+ if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
+ printf("[002] Unable to turn off emulated prepared statements\n");
- $stmt = $db->prepare("SELECT :param FROM test ORDER BY id ASC LIMIT 1");
- $stmt->execute(array(':param' => 'id'));
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+ $stmt = $db->prepare("SELECT :param FROM test ORDER BY id ASC LIMIT 1");
+ $stmt->execute(array(':param' => 'id'));
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
- $db->prepare('SELECT :placeholder FROM test WHERE :placeholder > :placeholder');
- $stmt->execute(array(':placeholder' => 'test'));
+ $db->prepare('SELECT :placeholder FROM test WHERE :placeholder > :placeholder');
+ $stmt->execute(array(':placeholder' => 'test'));
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_dup_named_placeholder.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_dup_named_placeholder.phpt
index c9465b62a2..1c5ddc407f 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_dup_named_placeholder.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_dup_named_placeholder.phpt
@@ -9,90 +9,90 @@ $db = MySQLPDOTest::factory();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
-
- try {
-
- $db->exec('DROP TABLE IF EXISTS test');
- $db->exec(sprintf('CREATE TABLE test(id INT, label1 CHAR(255), label2 CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE));
-
- $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
- if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
- printf("[002] Unable to turn off emulated prepared statements\n");
- printf("Native...\n");
-
- // INSERT a single row
- $stmt = $db->prepare('INSERT INTO test(id, label1, label2) VALUES (1, :placeholder, :placeholder)');
-
- $stmt->execute(array(':placeholder' => 'row1'));
- if ('00000' !== $stmt->errorCode())
- printf("[003] Execute has failed, %s %s\n",
- var_export($stmt->errorCode(), true),
- var_export($stmt->errorInfo(), true));
-
- // Ok, what has happened: anything inserted into the DB?
- $stmt = $db->prepare('SELECT id, label1, label2 FROM test WHERE id = 1');
- $stmt->execute();
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
-
- // Now the same with emulated PS.
- $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1);
- if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
- printf("[004] Unable to turn on emulated prepared statements\n");
- printf("Emulated...\n");
-
- $stmt = $db->prepare('INSERT INTO test(id, label1, label2) VALUES(2, :placeholder, :placeholder)');
- // No replacement shall be made
- $stmt->execute(array(':placeholder' => 'row2'));
- if ('00000' !== $stmt->errorCode())
- printf("[005] Execute has failed, %s %s\n",
- var_export($stmt->errorCode(), true),
- var_export($stmt->errorInfo(), true));
-
- // Now, what do we have in the DB?
- $stmt = $db->prepare('SELECT id, label1, label2 FROM test WHERE id = 2');
- $stmt->execute();
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
-
- //
- // Another variation of the theme
- //
-
- $db->exec('DELETE FROM test');
- $db->exec("INSERT INTO test (id, label1, label2) VALUES (1, 'row1', 'row2')");
- $sql = "SELECT id, label1 FROM test WHERE id = :placeholder AND label1 = (SELECT label1 AS 'SELECT' FROM test WHERE id = :placeholder)";
-
- // emulated...
- $stmt = $db->prepare($sql);
- $stmt->execute(array(':placeholder' => 1));
- if ('00000' !== $stmt->errorCode())
- printf("[006] Execute has failed, %s %s\n",
- var_export($stmt->errorCode(), true),
- var_export($stmt->errorInfo(), true));
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
-
- // native...
- $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
- if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
- printf("[007] Unable to turn off emulated prepared statements\n");
- printf("Native...\n");
-
- $stmt = $db->prepare($sql);
- $stmt->execute(array(':placeholder' => 1));
- if ('00000' !== $stmt->errorCode())
- printf("[008] Execute has failed, %s %s\n",
- var_export($stmt->errorCode(), true),
- var_export($stmt->errorInfo(), true));
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
-
-
- } catch (PDOException $e) {
- printf("[001] %s [%s] %s\n",
- $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
- }
-
- print "done!";
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
+
+ try {
+
+ $db->exec('DROP TABLE IF EXISTS test');
+ $db->exec(sprintf('CREATE TABLE test(id INT, label1 CHAR(255), label2 CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE));
+
+ $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
+ if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
+ printf("[002] Unable to turn off emulated prepared statements\n");
+ printf("Native...\n");
+
+ // INSERT a single row
+ $stmt = $db->prepare('INSERT INTO test(id, label1, label2) VALUES (1, :placeholder, :placeholder)');
+
+ $stmt->execute(array(':placeholder' => 'row1'));
+ if ('00000' !== $stmt->errorCode())
+ printf("[003] Execute has failed, %s %s\n",
+ var_export($stmt->errorCode(), true),
+ var_export($stmt->errorInfo(), true));
+
+ // Ok, what has happened: anything inserted into the DB?
+ $stmt = $db->prepare('SELECT id, label1, label2 FROM test WHERE id = 1');
+ $stmt->execute();
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+
+ // Now the same with emulated PS.
+ $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1);
+ if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
+ printf("[004] Unable to turn on emulated prepared statements\n");
+ printf("Emulated...\n");
+
+ $stmt = $db->prepare('INSERT INTO test(id, label1, label2) VALUES(2, :placeholder, :placeholder)');
+ // No replacement shall be made
+ $stmt->execute(array(':placeholder' => 'row2'));
+ if ('00000' !== $stmt->errorCode())
+ printf("[005] Execute has failed, %s %s\n",
+ var_export($stmt->errorCode(), true),
+ var_export($stmt->errorInfo(), true));
+
+ // Now, what do we have in the DB?
+ $stmt = $db->prepare('SELECT id, label1, label2 FROM test WHERE id = 2');
+ $stmt->execute();
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+
+ //
+ // Another variation of the theme
+ //
+
+ $db->exec('DELETE FROM test');
+ $db->exec("INSERT INTO test (id, label1, label2) VALUES (1, 'row1', 'row2')");
+ $sql = "SELECT id, label1 FROM test WHERE id = :placeholder AND label1 = (SELECT label1 AS 'SELECT' FROM test WHERE id = :placeholder)";
+
+ // emulated...
+ $stmt = $db->prepare($sql);
+ $stmt->execute(array(':placeholder' => 1));
+ if ('00000' !== $stmt->errorCode())
+ printf("[006] Execute has failed, %s %s\n",
+ var_export($stmt->errorCode(), true),
+ var_export($stmt->errorInfo(), true));
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+
+ // native...
+ $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
+ if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
+ printf("[007] Unable to turn off emulated prepared statements\n");
+ printf("Native...\n");
+
+ $stmt = $db->prepare($sql);
+ $stmt->execute(array(':placeholder' => 1));
+ if ('00000' !== $stmt->errorCode())
+ printf("[008] Execute has failed, %s %s\n",
+ var_export($stmt->errorCode(), true),
+ var_export($stmt->errorInfo(), true));
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+
+
+ } catch (PDOException $e) {
+ printf("[001] %s [%s] %s\n",
+ $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_mixed_style.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_mixed_style.phpt
index e706b92616..d24cb894ac 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_mixed_style.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_mixed_style.phpt
@@ -9,22 +9,22 @@ $db = MySQLPDOTest::factory();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
- MySQLPDOTest::createTestTable($db);
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
+ MySQLPDOTest::createTestTable($db);
- $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
- if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
- printf("[002] Unable to turn off emulated prepared statements\n");
+ $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
+ if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
+ printf("[002] Unable to turn off emulated prepared statements\n");
- $stmt = $db->query('DELETE FROM test');
- $stmt = $db->prepare('INSERT INTO test(id, label) VALUES (1, ?), (2, ?)');
- $stmt->execute(array('a', 'b'));
- $stmt = $db->prepare("SELECT id, label FROM test WHERE id = :placeholder AND label = (SELECT label AS 'SELECT' FROM test WHERE id = ?)");
- $stmt->execute(array(1, 1));
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+ $stmt = $db->query('DELETE FROM test');
+ $stmt = $db->prepare('INSERT INTO test(id, label) VALUES (1, ?), (2, ?)');
+ $stmt->execute(array('a', 'b'));
+ $stmt = $db->prepare("SELECT id, label FROM test WHERE id = :placeholder AND label = (SELECT label AS 'SELECT' FROM test WHERE id = ?)");
+ $stmt->execute(array(1, 1));
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_named_placeholder.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_named_placeholder.phpt
index 12acdcc0b1..6b553375d6 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_named_placeholder.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_named_placeholder.phpt
@@ -9,62 +9,62 @@ $db = MySQLPDOTest::factory();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
- try {
+ try {
- $db->exec('DROP TABLE IF EXISTS test');
- $db->exec(sprintf('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE));
+ $db->exec('DROP TABLE IF EXISTS test');
+ $db->exec(sprintf('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE));
- $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
- if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
- printf("[002] Unable to turn off emulated prepared statements\n");
+ $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
+ if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
+ printf("[002] Unable to turn off emulated prepared statements\n");
- // INSERT a single row
- $stmt = $db->prepare("INSERT INTO test(id, label) VALUES (100, ':placeholder')");
+ // INSERT a single row
+ $stmt = $db->prepare("INSERT INTO test(id, label) VALUES (100, ':placeholder')");
- // Yes, there is no placeholder to bind to and named placeholder
- // do not work with MySQL native PS, but lets see what happens!
- // The ':placeholder' is a string constant in the INSERT statement.
- // I would expect to get an error message, but this is not what happens.
- $stmt->execute(array(':placeholder' => 'row1'));
- if ('00000' !== $stmt->errorCode())
- printf("[003] Execute has failed, %s %s\n",
- var_export($stmt->errorCode(), true),
- var_export($stmt->errorInfo(), true));
+ // Yes, there is no placeholder to bind to and named placeholder
+ // do not work with MySQL native PS, but lets see what happens!
+ // The ':placeholder' is a string constant in the INSERT statement.
+ // I would expect to get an error message, but this is not what happens.
+ $stmt->execute(array(':placeholder' => 'row1'));
+ if ('00000' !== $stmt->errorCode())
+ printf("[003] Execute has failed, %s %s\n",
+ var_export($stmt->errorCode(), true),
+ var_export($stmt->errorInfo(), true));
- // Ok, what has happened: anything inserted into the DB?
- $stmt = $db->prepare('SELECT id, label FROM test');
- $stmt->execute();
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+ // Ok, what has happened: anything inserted into the DB?
+ $stmt = $db->prepare('SELECT id, label FROM test');
+ $stmt->execute();
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
- // Now the same with emulated PS.
- $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1);
- if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
- printf("[004] Unable to turn on emulated prepared statements\n");
+ // Now the same with emulated PS.
+ $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1);
+ if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
+ printf("[004] Unable to turn on emulated prepared statements\n");
- // Note that the "named placeholder" is enclosed by double quotes.
- $stmt = $db->prepare("INSERT INTO test(id, label) VALUES(101, ':placeholder')");
- // No replacement shall be made
- $stmt->execute(array(':placeholder' => 'row1'));
- // Again, I'd like to see an error message
- if ('00000' !== $stmt->errorCode())
- printf("[005] Execute has failed, %s %s\n",
- var_export($stmt->errorCode(), true),
- var_export($stmt->errorInfo(), true));
+ // Note that the "named placeholder" is enclosed by double quotes.
+ $stmt = $db->prepare("INSERT INTO test(id, label) VALUES(101, ':placeholder')");
+ // No replacement shall be made
+ $stmt->execute(array(':placeholder' => 'row1'));
+ // Again, I'd like to see an error message
+ if ('00000' !== $stmt->errorCode())
+ printf("[005] Execute has failed, %s %s\n",
+ var_export($stmt->errorCode(), true),
+ var_export($stmt->errorInfo(), true));
- // Now, what do we have in the DB?
- $stmt = $db->prepare('SELECT id, label FROM test ORDER BY id');
- $stmt->execute();
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+ // Now, what do we have in the DB?
+ $stmt = $db->prepare('SELECT id, label FROM test ORDER BY id');
+ $stmt->execute();
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
- } catch (PDOException $e) {
- printf("[001] %s [%s] %s\n",
- $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
- }
+ } catch (PDOException $e) {
+ printf("[001] %s [%s] %s\n",
+ $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_placeholder_everywhere.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_placeholder_everywhere.phpt
index 8df6961f93..a7a76a462b 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_prepare_native_placeholder_everywhere.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_native_placeholder_everywhere.phpt
@@ -9,55 +9,55 @@ $db = MySQLPDOTest::factory();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
- try {
- $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1);
- if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
- printf("[002] Unable to switch on emulated prepared statements, test will fail\n");
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
+ try {
+ $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1);
+ if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
+ printf("[002] Unable to switch on emulated prepared statements, test will fail\n");
- $db->exec('DROP TABLE IF EXISTS test');
- $db->exec(sprintf('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE));
- $db->exec("INSERT INTO test(id, label) VALUES (1, 'row1')");
+ $db->exec('DROP TABLE IF EXISTS test');
+ $db->exec(sprintf('CREATE TABLE test(id INT, label CHAR(255)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE));
+ $db->exec("INSERT INTO test(id, label) VALUES (1, 'row1')");
- $stmt = $db->prepare('SELECT ?, id, label FROM test WHERE ? = ? ORDER BY id ASC');
- $stmt->execute(array('id', 'label', 'label'));
- if ('00000' !== $stmt->errorCode())
- printf("[003] Execute has failed, %s %s\n",
- var_export($stmt->errorCode(), true),
- var_export($stmt->errorInfo(), true));
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+ $stmt = $db->prepare('SELECT ?, id, label FROM test WHERE ? = ? ORDER BY id ASC');
+ $stmt->execute(array('id', 'label', 'label'));
+ if ('00000' !== $stmt->errorCode())
+ printf("[003] Execute has failed, %s %s\n",
+ var_export($stmt->errorCode(), true),
+ var_export($stmt->errorInfo(), true));
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
- // now the same with native PS
- printf("now the same with native PS\n");
- $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
- if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
- printf("[004] Unable to switch off emulated prepared statements, test will fail\n");
+ // now the same with native PS
+ printf("now the same with native PS\n");
+ $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
+ if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
+ printf("[004] Unable to switch off emulated prepared statements, test will fail\n");
- $stmt = $db->prepare('SELECT ?, id, label FROM test WHERE ? = ? ORDER BY id ASC');
- $stmt->execute(array('id', 'label', 'label'));
- if ('00000' !== $stmt->errorCode())
- printf("[005] Execute has failed, %s %s\n",
- var_export($stmt->errorCode(), true),
- var_export($stmt->errorInfo(), true));
+ $stmt = $db->prepare('SELECT ?, id, label FROM test WHERE ? = ? ORDER BY id ASC');
+ $stmt->execute(array('id', 'label', 'label'));
+ if ('00000' !== $stmt->errorCode())
+ printf("[005] Execute has failed, %s %s\n",
+ var_export($stmt->errorCode(), true),
+ var_export($stmt->errorInfo(), true));
- $tmp = $stmt->fetchAll(PDO::FETCH_ASSOC);
- if (!MySQLPDOTest::isPDOMySQLnd()) {
- if (isset($tmp[0]['id'])) {
- // libmysql should return a string here whereas mysqlnd returns a native int
- if (gettype($tmp[0]['id']) == 'string')
- // convert to int for the test output...
- settype($tmp[0]['id'], 'integer');
- }
- }
- var_dump($tmp);
+ $tmp = $stmt->fetchAll(PDO::FETCH_ASSOC);
+ if (!MySQLPDOTest::isPDOMySQLnd()) {
+ if (isset($tmp[0]['id'])) {
+ // libmysql should return a string here whereas mysqlnd returns a native int
+ if (gettype($tmp[0]['id']) == 'string')
+ // convert to int for the test output...
+ settype($tmp[0]['id'], 'integer');
+ }
+ }
+ var_dump($tmp);
- } catch (PDOException $e) {
- printf("[001] %s [%s] %s\n",
- $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
- }
+ } catch (PDOException $e) {
+ printf("[001] %s [%s] %s\n",
+ $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_rollback.phpt b/ext/pdo_mysql/tests/pdo_mysql_rollback.phpt
index 30f1d56f88..96e77a1326 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_rollback.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_rollback.phpt
@@ -11,75 +11,75 @@ if (false == MySQLPDOTest::detect_transactional_mysql_engine($db))
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
- MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db));
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
+ MySQLPDOTest::createTestTable($db, MySQLPDOTest::detect_transactional_mysql_engine($db));
- $db->beginTransaction();
+ $db->beginTransaction();
- $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC);
- $num = $row['_num'];
+ $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC);
+ $num = $row['_num'];
- $db->query("INSERT INTO test(id, label) VALUES (100, 'z')");
- $num++;
- $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC);
- if ($row['_num'] != $num)
- printf("[001] INSERT has failed, test will fail\n");
+ $db->query("INSERT INTO test(id, label) VALUES (100, 'z')");
+ $num++;
+ $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC);
+ if ($row['_num'] != $num)
+ printf("[001] INSERT has failed, test will fail\n");
- $db->rollBack();
- $num--;
- $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC);
- if ($row['_num'] != $num)
- printf("[002] ROLLBACK has failed\n");
+ $db->rollBack();
+ $num--;
+ $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC);
+ if ($row['_num'] != $num)
+ printf("[002] ROLLBACK has failed\n");
- $db->beginTransaction();
- $db->query("INSERT INTO test(id, label) VALUES (100, 'z')");
- $db->query('DROP TABLE IF EXISTS test2');
- $db->query('CREATE TABLE test2(id INT)');
- $num++;
- $db->rollBack();
- $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC);
- if ($row['_num'] != $num)
- printf("[002] ROLLBACK should have no effect because of the implicit COMMIT
- triggered by DROP/CREATE TABLE\n");
+ $db->beginTransaction();
+ $db->query("INSERT INTO test(id, label) VALUES (100, 'z')");
+ $db->query('DROP TABLE IF EXISTS test2');
+ $db->query('CREATE TABLE test2(id INT)');
+ $num++;
+ $db->rollBack();
+ $row = $db->query('SELECT COUNT(*) AS _num FROM test')->fetch(PDO::FETCH_ASSOC);
+ if ($row['_num'] != $num)
+ printf("[002] ROLLBACK should have no effect because of the implicit COMMIT
+ triggered by DROP/CREATE TABLE\n");
- $db->query('DROP TABLE IF EXISTS test2');
- $db->query('CREATE TABLE test2(id INT) ENGINE=MyISAM');
- $db->beginTransaction();
- $db->query('INSERT INTO test2(id) VALUES (1)');
- $db->rollBack();
- $row = $db->query('SELECT COUNT(*) AS _num FROM test2')->fetch(PDO::FETCH_ASSOC);
- if ($row['_num'] != 1)
- printf("[003] ROLLBACK should have no effect\n");
+ $db->query('DROP TABLE IF EXISTS test2');
+ $db->query('CREATE TABLE test2(id INT) ENGINE=MyISAM');
+ $db->beginTransaction();
+ $db->query('INSERT INTO test2(id) VALUES (1)');
+ $db->rollBack();
+ $row = $db->query('SELECT COUNT(*) AS _num FROM test2')->fetch(PDO::FETCH_ASSOC);
+ if ($row['_num'] != 1)
+ printf("[003] ROLLBACK should have no effect\n");
- $db->query('DROP TABLE IF EXISTS test2');
+ $db->query('DROP TABLE IF EXISTS test2');
- $db->setAttribute(PDO::ATTR_AUTOCOMMIT, 1);
- $db->beginTransaction();
- $db->query('DELETE FROM test');
- $db->rollBack();
- var_dump($db->getAttribute(PDO::ATTR_AUTOCOMMIT));
+ $db->setAttribute(PDO::ATTR_AUTOCOMMIT, 1);
+ $db->beginTransaction();
+ $db->query('DELETE FROM test');
+ $db->rollBack();
+ var_dump($db->getAttribute(PDO::ATTR_AUTOCOMMIT));
- $db->setAttribute(PDO::ATTR_AUTOCOMMIT, 0);
- $db->beginTransaction();
- $db->query('DELETE FROM test');
- $db->rollBack();
- var_dump($db->getAttribute(PDO::ATTR_AUTOCOMMIT));
+ $db->setAttribute(PDO::ATTR_AUTOCOMMIT, 0);
+ $db->beginTransaction();
+ $db->query('DELETE FROM test');
+ $db->rollBack();
+ var_dump($db->getAttribute(PDO::ATTR_AUTOCOMMIT));
- $db->setAttribute(PDO::ATTR_AUTOCOMMIT, 1);
- $db->beginTransaction();
- $db->query('DELETE FROM test');
- $db->commit();
- var_dump($db->getAttribute(PDO::ATTR_AUTOCOMMIT));
+ $db->setAttribute(PDO::ATTR_AUTOCOMMIT, 1);
+ $db->beginTransaction();
+ $db->query('DELETE FROM test');
+ $db->commit();
+ var_dump($db->getAttribute(PDO::ATTR_AUTOCOMMIT));
- $db->setAttribute(PDO::ATTR_AUTOCOMMIT, 0);
- $db->beginTransaction();
- $db->query('DELETE FROM test');
- $db->commit();
- var_dump($db->getAttribute(PDO::ATTR_AUTOCOMMIT));
+ $db->setAttribute(PDO::ATTR_AUTOCOMMIT, 0);
+ $db->beginTransaction();
+ $db->query('DELETE FROM test');
+ $db->commit();
+ var_dump($db->getAttribute(PDO::ATTR_AUTOCOMMIT));
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_bindcolumn.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_bindcolumn.phpt
index bf56cbc835..6d1ac4bbfb 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_stmt_bindcolumn.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_bindcolumn.phpt
@@ -9,97 +9,97 @@ $db = MySQLPDOTest::factory();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
- MySQLPDOTest::createTestTable($db);
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
+ MySQLPDOTest::createTestTable($db);
- try {
- $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1);
- if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
- printf("[002] Unable to turn on emulated prepared statements\n");
+ try {
+ $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1);
+ if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
+ printf("[002] Unable to turn on emulated prepared statements\n");
- $stmt = $db->prepare('SELECT id, label FROM test ORDER BY id ASC LIMIT 2');
- $stmt->execute();
- $id = $label = null;
+ $stmt = $db->prepare('SELECT id, label FROM test ORDER BY id ASC LIMIT 2');
+ $stmt->execute();
+ $id = $label = null;
- if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT))
- printf("[003] Cannot bind integer column, %s %s\n",
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+ if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT))
+ printf("[003] Cannot bind integer column, %s %s\n",
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
- if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR))
- printf("[004] Cannot bind string column, %s %s\n",
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+ if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR))
+ printf("[004] Cannot bind string column, %s %s\n",
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
- $data = array();
- while ($stmt->fetch(PDO::FETCH_BOUND)) {
- printf("id = %s (%s) / label = %s (%s)\n",
- var_export($id, true), gettype($id),
- var_export($label, true), gettype($label));
- $data[] = array('id' => $id, 'label' => $label);
- }
+ $data = array();
+ while ($stmt->fetch(PDO::FETCH_BOUND)) {
+ printf("id = %s (%s) / label = %s (%s)\n",
+ var_export($id, true), gettype($id),
+ var_export($label, true), gettype($label));
+ $data[] = array('id' => $id, 'label' => $label);
+ }
- $stmt = $db->query('SELECT id, label FROM test ORDER BY id ASC LIMIT 2');
- $index = 0;
- while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
- if ($row['id'] != $data[$index]['id']) {
- printf("[005] Fetch bound and fetch assoc differ - column 'id', bound: %s/%s, assoc: %s/%s\n",
- var_export($data[$index]['id'], true), gettype($data[$index]['id']),
- var_export($row['id'], true), gettype($row['id']));
- }
- if ($row['label'] != $data[$index]['label']) {
- printf("[006] Fetch bound and fetch assoc differ - column 'label', bound: %s/%s, assoc: %s/%s\n",
- var_export($data[$index]['label'], true), gettype($data[$index]['label']),
- var_export($row['label'], true), gettype($row['label']));
- }
- $index++;
- }
+ $stmt = $db->query('SELECT id, label FROM test ORDER BY id ASC LIMIT 2');
+ $index = 0;
+ while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
+ if ($row['id'] != $data[$index]['id']) {
+ printf("[005] Fetch bound and fetch assoc differ - column 'id', bound: %s/%s, assoc: %s/%s\n",
+ var_export($data[$index]['id'], true), gettype($data[$index]['id']),
+ var_export($row['id'], true), gettype($row['id']));
+ }
+ if ($row['label'] != $data[$index]['label']) {
+ printf("[006] Fetch bound and fetch assoc differ - column 'label', bound: %s/%s, assoc: %s/%s\n",
+ var_export($data[$index]['label'], true), gettype($data[$index]['label']),
+ var_export($row['label'], true), gettype($row['label']));
+ }
+ $index++;
+ }
- $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
- if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
- printf("[007] Unable to turn off emulated prepared statements\n");
+ $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
+ if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
+ printf("[007] Unable to turn off emulated prepared statements\n");
- $stmt = $db->prepare('SELECT id, label FROM test ORDER BY id ASC LIMIT 2, 2');
- $stmt->execute();
- $id = $label = null;
+ $stmt = $db->prepare('SELECT id, label FROM test ORDER BY id ASC LIMIT 2, 2');
+ $stmt->execute();
+ $id = $label = null;
- if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT))
- printf("[008] Cannot bind integer column, %s %s\n",
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+ if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT))
+ printf("[008] Cannot bind integer column, %s %s\n",
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
- if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR))
- printf("[009] Cannot bind string column, %s %s\n",
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+ if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR))
+ printf("[009] Cannot bind string column, %s %s\n",
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
- $data = array();
- while ($stmt->fetch(PDO::FETCH_BOUND)) {
- printf("id = %s (%s) / label = %s (%s)\n",
- var_export($id, true), gettype($id),
- var_export($label, true), gettype($label));
- $data[] = array('id' => $id, 'label' => $label);
- }
+ $data = array();
+ while ($stmt->fetch(PDO::FETCH_BOUND)) {
+ printf("id = %s (%s) / label = %s (%s)\n",
+ var_export($id, true), gettype($id),
+ var_export($label, true), gettype($label));
+ $data[] = array('id' => $id, 'label' => $label);
+ }
- $stmt = $db->query('SELECT id, label FROM test ORDER BY id ASC LIMIT 2, 2');
- $index = 0;
- while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
- if ($row['id'] != $data[$index]['id']) {
- printf("[010] Fetch bound and fetch assoc differ - column 'id', bound: %s/%s, assoc: %s/%s\n",
- var_export($data[$index]['id'], true), gettype($data[$index]['id']),
- var_export($row['id'], true), gettype($row['id']));
- }
- if ($row['label'] != $data[$index]['label']) {
- printf("[011] Fetch bound and fetch assoc differ - column 'label', bound: %s/%s, assoc: %s/%s\n",
- var_export($data[$index]['label'], true), gettype($data[$index]['label']),
- var_export($row['label'], true), gettype($row['label']));
- }
- $index++;
- }
+ $stmt = $db->query('SELECT id, label FROM test ORDER BY id ASC LIMIT 2, 2');
+ $index = 0;
+ while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
+ if ($row['id'] != $data[$index]['id']) {
+ printf("[010] Fetch bound and fetch assoc differ - column 'id', bound: %s/%s, assoc: %s/%s\n",
+ var_export($data[$index]['id'], true), gettype($data[$index]['id']),
+ var_export($row['id'], true), gettype($row['id']));
+ }
+ if ($row['label'] != $data[$index]['label']) {
+ printf("[011] Fetch bound and fetch assoc differ - column 'label', bound: %s/%s, assoc: %s/%s\n",
+ var_export($data[$index]['label'], true), gettype($data[$index]['label']),
+ var_export($row['label'], true), gettype($row['label']));
+ }
+ $index++;
+ }
- } catch (PDOException $e) {
- printf("[001] %s [%s] %s\n",
- $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
- }
+ } catch (PDOException $e) {
+ printf("[001] %s [%s] %s\n",
+ $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_bindparam.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_bindparam.phpt
index 422c519355..4559c499ea 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_stmt_bindparam.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_bindparam.phpt
@@ -8,113 +8,113 @@ MySQLPDOTest::skip();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
- $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false);
-
- MySQLPDOTest::createTestTable($db);
-
- function pdo_mysql_stmt_bindparam($db, $offset) {
-
- $stmt = $db->prepare('SELECT id, label FROM test WHERE id > ? ORDER BY id ASC LIMIT 2');
- $in = 0;
- if (!$stmt->bindParam(1, $in))
- printf("[%03d + 1] Cannot bind parameter, %s %s\n", $offset,
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- $stmt->execute();
- $id = $label = null;
-
- if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT))
- printf("[%03d + 2] Cannot bind integer column, %s %s\n", $offset,
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR))
- printf("[%03d + 3] Cannot bind string column, %s %s\n", $offset,
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- while ($stmt->fetch(PDO::FETCH_BOUND))
- printf("in = %d -> id = %s (%s) / label = %s (%s)\n",
- $in,
- var_export($id, true), gettype($id),
- var_export($label, true), gettype($label));
-
- printf("Same again...\n");
- $stmt->execute();
- while ($stmt->fetch(PDO::FETCH_BOUND))
- printf("in = %d -> id = %s (%s) / label = %s (%s)\n",
- $in,
- var_export($id, true), gettype($id),
- var_export($label, true), gettype($label));
-
- // NULL values
- printf("NULL...\n");
- $stmt = $db->prepare('INSERT INTO test(id, label) VALUES (100, ?)');
- $label = null;
- if (!$stmt->bindParam(1, $label))
- printf("[%03d + 4] Cannot bind parameter, %s %s\n", $offset,
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- if (!$stmt->execute())
- printf("[%03d + 5] Cannot execute statement, %s %s\n", $offset,
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- /* NOTE: you cannot use PDO::query() with unbuffered, native PS - see extra test */
- $stmt = $db->prepare('SELECT id, NULL AS _label FROM test WHERE label IS NULL');
- $stmt->execute();
-
- $id = $label = 'bogus';
- if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT))
- printf("[%03d + 6] Cannot bind NULL column, %s %s\n", $offset,
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR))
- printf("[%03d + 3] Cannot bind string column, %s %s\n", $offset,
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- while ($stmt->fetch(PDO::FETCH_BOUND))
- printf("in = %d -> id = %s (%s) / label = %s (%s)\n",
- $in,
- var_export($id, true), gettype($id),
- var_export($label, true), gettype($label));
- }
-
- try {
- printf("Emulated PS...\n");
- $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1);
- if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
- printf("[002] Unable to turn on emulated prepared statements\n");
-
- printf("Buffered...\n");
- $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
- pdo_mysql_stmt_bindparam($db, 3);
-
- printf("Unbuffered...\n");
- MySQLPDOTest::createTestTable($db);
- $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
- pdo_mysql_stmt_bindparam($db, 4);
-
- printf("Native PS...\n");
- $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
- if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
- printf("[004] Unable to turn off emulated prepared statements\n");
-
- printf("Buffered...\n");
- MySQLPDOTest::createTestTable($db);
- $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
- pdo_mysql_stmt_bindparam($db, 5);
-
- printf("Unbuffered...\n");
- MySQLPDOTest::createTestTable($db);
- $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
- pdo_mysql_stmt_bindparam($db, 6);
-
- } catch (PDOException $e) {
- printf("[001] %s [%s] %s\n",
- $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
- }
-
- print "done!";
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
+ $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false);
+
+ MySQLPDOTest::createTestTable($db);
+
+ function pdo_mysql_stmt_bindparam($db, $offset) {
+
+ $stmt = $db->prepare('SELECT id, label FROM test WHERE id > ? ORDER BY id ASC LIMIT 2');
+ $in = 0;
+ if (!$stmt->bindParam(1, $in))
+ printf("[%03d + 1] Cannot bind parameter, %s %s\n", $offset,
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ $stmt->execute();
+ $id = $label = null;
+
+ if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT))
+ printf("[%03d + 2] Cannot bind integer column, %s %s\n", $offset,
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR))
+ printf("[%03d + 3] Cannot bind string column, %s %s\n", $offset,
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ while ($stmt->fetch(PDO::FETCH_BOUND))
+ printf("in = %d -> id = %s (%s) / label = %s (%s)\n",
+ $in,
+ var_export($id, true), gettype($id),
+ var_export($label, true), gettype($label));
+
+ printf("Same again...\n");
+ $stmt->execute();
+ while ($stmt->fetch(PDO::FETCH_BOUND))
+ printf("in = %d -> id = %s (%s) / label = %s (%s)\n",
+ $in,
+ var_export($id, true), gettype($id),
+ var_export($label, true), gettype($label));
+
+ // NULL values
+ printf("NULL...\n");
+ $stmt = $db->prepare('INSERT INTO test(id, label) VALUES (100, ?)');
+ $label = null;
+ if (!$stmt->bindParam(1, $label))
+ printf("[%03d + 4] Cannot bind parameter, %s %s\n", $offset,
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ if (!$stmt->execute())
+ printf("[%03d + 5] Cannot execute statement, %s %s\n", $offset,
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ /* NOTE: you cannot use PDO::query() with unbuffered, native PS - see extra test */
+ $stmt = $db->prepare('SELECT id, NULL AS _label FROM test WHERE label IS NULL');
+ $stmt->execute();
+
+ $id = $label = 'bogus';
+ if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT))
+ printf("[%03d + 6] Cannot bind NULL column, %s %s\n", $offset,
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR))
+ printf("[%03d + 3] Cannot bind string column, %s %s\n", $offset,
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ while ($stmt->fetch(PDO::FETCH_BOUND))
+ printf("in = %d -> id = %s (%s) / label = %s (%s)\n",
+ $in,
+ var_export($id, true), gettype($id),
+ var_export($label, true), gettype($label));
+ }
+
+ try {
+ printf("Emulated PS...\n");
+ $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1);
+ if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
+ printf("[002] Unable to turn on emulated prepared statements\n");
+
+ printf("Buffered...\n");
+ $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
+ pdo_mysql_stmt_bindparam($db, 3);
+
+ printf("Unbuffered...\n");
+ MySQLPDOTest::createTestTable($db);
+ $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
+ pdo_mysql_stmt_bindparam($db, 4);
+
+ printf("Native PS...\n");
+ $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
+ if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
+ printf("[004] Unable to turn off emulated prepared statements\n");
+
+ printf("Buffered...\n");
+ MySQLPDOTest::createTestTable($db);
+ $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
+ pdo_mysql_stmt_bindparam($db, 5);
+
+ printf("Unbuffered...\n");
+ MySQLPDOTest::createTestTable($db);
+ $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
+ pdo_mysql_stmt_bindparam($db, 6);
+
+ } catch (PDOException $e) {
+ printf("[001] %s [%s] %s\n",
+ $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_bindparam_types.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_bindparam_types.phpt
index c6860fa539..5da2bb30fb 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_stmt_bindparam_types.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_bindparam_types.phpt
@@ -9,160 +9,160 @@ $db = MySQLPDOTest::factory();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
- MySQLPDOTest::createTestTable($db);
-
- function pdo_mysql_stmt_bindparam_types_do($db, $offset, $native, $sql_type, $value) {
-
- if ($native)
- $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
- else
- $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1);
-
- $db->exec('DROP TABLE IF EXISTS test');
- $sql = sprintf('CREATE TABLE test(id INT, label %s) ENGINE=%s', $sql_type, MySQLPDOTest::getTableEngine());
- if ((!$stmt = @$db->prepare($sql)) || (!@$stmt->execute()))
- // Server might not support column type - skip it
- return true;
-
- $stmt = $db->prepare('INSERT INTO test(id, label) VALUES (1, ?)');
- if (!$stmt->bindParam(1, $value)) {
- printf("[%03d/%s + 1] %s\n", $offset, ($native) ? 'native' : 'emulated',
- var_export($stmt->errorInfo(), true));
- return false;
- }
- if (!$stmt->execute()) {
- printf("[%03d/%s + 2] %s\n", $offset, ($native) ? 'native' : 'emulated',
- var_export($stmt->errorInfo(), true));
- return false;
- }
-
- $stmt = $db->query('SELECT id, label FROM test');
- $id = $label = null;
- if (!$stmt->bindColumn(1, $id)) {
- printf("[%03d/%s + 3] %s\n", $offset, ($native) ? 'native' : 'emulated',
- var_export($stmt->errorInfo(), true));
- return false;
- }
- if (!$stmt->bindColumn(2, $label)) {
- printf("[%03d/%s + 4] %s\n", $offset, ($native) ? 'native' : 'emulated',
- var_export($stmt->errorInfo(), true));
- return false;
- }
-
- if (!$stmt->fetch(PDO::FETCH_BOUND)) {
- printf("[%03d/%s + 5] %s\n", $offset, ($native) ? 'native' : 'emulated',
- var_export($stmt->errorInfo(), true));
- return false;
- }
- $stmt->closeCursor();
-
- if ($label != $value) {
- printf("[%03d/%s + 6] Got %s expecting %s - plase check manually\n",
- $offset, ($native) ? 'native' : 'emulated',
- var_export($label, true), var_export($value, true));
- // fall through
- }
-
- $stmt->execute();
- $row = $stmt->fetch(PDO::FETCH_ASSOC);
- if (empty($row)) {
- printf("[%03d/%s + 7] %s\n", $offset, ($native) ? 'native' : 'emulated',
- var_export($stmt->errorInfo(), true));
- return false;
- }
-
- if ($row['label'] != $value) {
- printf("[%03d/%s + 8] Got %s expecting %s - plase check manually\n",
- $offset, ($native) ? 'native' : 'emulated',
- var_export($row['label'], true), var_export($value, true));
- return false;
- }
-
- if ($row['label'] != $label) {
- printf("[%03d/%s + 9] Got %s from FETCH_ASSOC and %s from FETCH_BOUND- plase check manually\n",
- $offset, ($native) ? 'native' : 'emulated',
- var_export($row['label'], true), var_export($value, true));
- return false;
- }
-
- $db->exec('DROP TABLE IF EXISTS test');
- return true;
- }
-
- function pdo_mysql_stmt_bindparam_types($db, $offset, $sql_type, $value) {
-
- pdo_mysql_stmt_bindparam_types_do($db, $offset, true, $sql_type, $value);
- pdo_mysql_stmt_bindparam_types_do($db, $offset, false, $sql_type, $value);
-
- }
-
- try {
-
- // pdo_mysql_stmt_bindparam_types($db, 2, 'BIT(8)', 1);
- pdo_mysql_stmt_bindparam_types($db, 3, 'TINYINT', -127);
- pdo_mysql_stmt_bindparam_types($db, 4, 'TINYINT UNSIGNED', 255);
- pdo_mysql_stmt_bindparam_types($db, 5, 'BOOLEAN', 1);
- pdo_mysql_stmt_bindparam_types($db, 6, 'SMALLINT', -32768);
- pdo_mysql_stmt_bindparam_types($db, 7, 'SMALLINT UNSIGNED', 65535);
- pdo_mysql_stmt_bindparam_types($db, 8, 'MEDIUMINT', -8388608);
- pdo_mysql_stmt_bindparam_types($db, 9, 'MEDIUMINT UNSIGNED', 16777215);
- pdo_mysql_stmt_bindparam_types($db, 10, 'INT', -2147483648);
- pdo_mysql_stmt_bindparam_types($db, 11, 'INT UNSIGNED', 4294967295);
- pdo_mysql_stmt_bindparam_types($db, 12, 'BIGINT', -1000);
- pdo_mysql_stmt_bindparam_types($db, 13, 'BIGINT UNSIGNED', 1000);
- pdo_mysql_stmt_bindparam_types($db, 14, 'REAL', -1000);
- pdo_mysql_stmt_bindparam_types($db, 15, 'REAL UNSIGNED', 1000);
- pdo_mysql_stmt_bindparam_types($db, 16, 'REAL ZEROFILL', '0000000000000000000000');
- pdo_mysql_stmt_bindparam_types($db, 17, 'REAL UNSIGNED ZEROFILL', '0000000000000000000010');
- pdo_mysql_stmt_bindparam_types($db, 18, 'DOUBLE', -1000);
- pdo_mysql_stmt_bindparam_types($db, 19, 'DOUBLE UNSIGNED', 1000);
- pdo_mysql_stmt_bindparam_types($db, 20, 'DOUBLE ZEROFILL', '000000000000');
- pdo_mysql_stmt_bindparam_types($db, 21, 'DOUBLE ZEROFILL UNSIGNED', '000000001000');
- pdo_mysql_stmt_bindparam_types($db, 22, 'FLOAT', -1000);
- pdo_mysql_stmt_bindparam_types($db, 23, 'FLOAT UNSIGNED', 1000);
- pdo_mysql_stmt_bindparam_types($db, 24, 'FLOAT ZEROFILL', '000000000000');
- pdo_mysql_stmt_bindparam_types($db, 25, 'FLOAT ZEROFILL UNSIGNED', '000000001000');
- pdo_mysql_stmt_bindparam_types($db, 26, 'DECIMAL', -1000);
- pdo_mysql_stmt_bindparam_types($db, 27, 'DECIMAL UNSIGNED', 1000);
- pdo_mysql_stmt_bindparam_types($db, 28, 'DECIMAL ZEROFILL', '000000000000');
- pdo_mysql_stmt_bindparam_types($db, 29, 'DECIMAL ZEROFILL UNSIGNED', '000000001000');
- pdo_mysql_stmt_bindparam_types($db, 30, 'NUMERIC', -1000);
- pdo_mysql_stmt_bindparam_types($db, 31, 'NUMERIC UNSIGNED', 1000);
- pdo_mysql_stmt_bindparam_types($db, 32, 'NUMERIC ZEROFILL', '000000000000');
- pdo_mysql_stmt_bindparam_types($db, 33, 'NUMERIC ZEROFILL UNSIGNED', '000000001000');
- pdo_mysql_stmt_bindparam_types($db, 34, 'DATE', '2008-04-23');
- pdo_mysql_stmt_bindparam_types($db, 35, 'TIME', '16:43:12');
- pdo_mysql_stmt_bindparam_types($db, 36, 'TIMESTAMP', '2008-04-23 16:44:53');
- pdo_mysql_stmt_bindparam_types($db, 37, 'DATETIME', '2008-04-23 16:44:53');
- pdo_mysql_stmt_bindparam_types($db, 38, 'YEAR', '2008');
- pdo_mysql_stmt_bindparam_types($db, 39, 'CHAR(1)', 'a');
- pdo_mysql_stmt_bindparam_types($db, 40, 'CHAR(255)', 'abc');
- pdo_mysql_stmt_bindparam_types($db, 41, 'VARCHAR(255)', str_repeat('a', 255));
- pdo_mysql_stmt_bindparam_types($db, 42, 'BINARY(255)', str_repeat('a', 255));
- pdo_mysql_stmt_bindparam_types($db, 43, 'VARBINARY(255)', str_repeat('a', 255));
- pdo_mysql_stmt_bindparam_types($db, 44, 'TINYBLOB', str_repeat('a', 255));
- pdo_mysql_stmt_bindparam_types($db, 45, 'BLOB', str_repeat('b', 300));
- pdo_mysql_stmt_bindparam_types($db, 46, 'MEDIUMBLOB', str_repeat('b', 300));
- pdo_mysql_stmt_bindparam_types($db, 47, 'LONGBLOB', str_repeat('b', 300));
- pdo_mysql_stmt_bindparam_types($db, 48, 'TINYTEXT', str_repeat('c', 255));
- pdo_mysql_stmt_bindparam_types($db, 49, 'TINYTEXT BINARY', str_repeat('c', 255));
- pdo_mysql_stmt_bindparam_types($db, 50, 'TEXT', str_repeat('d', 300));
- pdo_mysql_stmt_bindparam_types($db, 51, 'TEXT BINARY', str_repeat('d', 300));
- pdo_mysql_stmt_bindparam_types($db, 52, 'MEDIUMTEXT', str_repeat('d', 300));
- pdo_mysql_stmt_bindparam_types($db, 53, 'MEDIUMTEXT BINARY', str_repeat('d', 300));
- pdo_mysql_stmt_bindparam_types($db, 54, 'LONGTEXT', str_repeat('d', 300));
- pdo_mysql_stmt_bindparam_types($db, 55, 'LONGTEXT BINARY', str_repeat('d', 300));
- pdo_mysql_stmt_bindparam_types($db, 56, "ENUM('yes', 'no') DEFAULT 'yes'", "no");
- pdo_mysql_stmt_bindparam_types($db, 57, "SET('yes', 'no') DEFAULT 'yes'", "no");
-
- } catch (PDOException $e) {
- printf("[001] %s [%s] %s\n",
- $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
- }
-
- print "done!";
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
+ MySQLPDOTest::createTestTable($db);
+
+ function pdo_mysql_stmt_bindparam_types_do($db, $offset, $native, $sql_type, $value) {
+
+ if ($native)
+ $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
+ else
+ $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1);
+
+ $db->exec('DROP TABLE IF EXISTS test');
+ $sql = sprintf('CREATE TABLE test(id INT, label %s) ENGINE=%s', $sql_type, MySQLPDOTest::getTableEngine());
+ if ((!$stmt = @$db->prepare($sql)) || (!@$stmt->execute()))
+ // Server might not support column type - skip it
+ return true;
+
+ $stmt = $db->prepare('INSERT INTO test(id, label) VALUES (1, ?)');
+ if (!$stmt->bindParam(1, $value)) {
+ printf("[%03d/%s + 1] %s\n", $offset, ($native) ? 'native' : 'emulated',
+ var_export($stmt->errorInfo(), true));
+ return false;
+ }
+ if (!$stmt->execute()) {
+ printf("[%03d/%s + 2] %s\n", $offset, ($native) ? 'native' : 'emulated',
+ var_export($stmt->errorInfo(), true));
+ return false;
+ }
+
+ $stmt = $db->query('SELECT id, label FROM test');
+ $id = $label = null;
+ if (!$stmt->bindColumn(1, $id)) {
+ printf("[%03d/%s + 3] %s\n", $offset, ($native) ? 'native' : 'emulated',
+ var_export($stmt->errorInfo(), true));
+ return false;
+ }
+ if (!$stmt->bindColumn(2, $label)) {
+ printf("[%03d/%s + 4] %s\n", $offset, ($native) ? 'native' : 'emulated',
+ var_export($stmt->errorInfo(), true));
+ return false;
+ }
+
+ if (!$stmt->fetch(PDO::FETCH_BOUND)) {
+ printf("[%03d/%s + 5] %s\n", $offset, ($native) ? 'native' : 'emulated',
+ var_export($stmt->errorInfo(), true));
+ return false;
+ }
+ $stmt->closeCursor();
+
+ if ($label != $value) {
+ printf("[%03d/%s + 6] Got %s expecting %s - please check manually\n",
+ $offset, ($native) ? 'native' : 'emulated',
+ var_export($label, true), var_export($value, true));
+ // fall through
+ }
+
+ $stmt->execute();
+ $row = $stmt->fetch(PDO::FETCH_ASSOC);
+ if (empty($row)) {
+ printf("[%03d/%s + 7] %s\n", $offset, ($native) ? 'native' : 'emulated',
+ var_export($stmt->errorInfo(), true));
+ return false;
+ }
+
+ if ($row['label'] != $value) {
+ printf("[%03d/%s + 8] Got %s expecting %s - please check manually\n",
+ $offset, ($native) ? 'native' : 'emulated',
+ var_export($row['label'], true), var_export($value, true));
+ return false;
+ }
+
+ if ($row['label'] != $label) {
+ printf("[%03d/%s + 9] Got %s from FETCH_ASSOC and %s from FETCH_BOUND- please check manually\n",
+ $offset, ($native) ? 'native' : 'emulated',
+ var_export($row['label'], true), var_export($value, true));
+ return false;
+ }
+
+ $db->exec('DROP TABLE IF EXISTS test');
+ return true;
+ }
+
+ function pdo_mysql_stmt_bindparam_types($db, $offset, $sql_type, $value) {
+
+ pdo_mysql_stmt_bindparam_types_do($db, $offset, true, $sql_type, $value);
+ pdo_mysql_stmt_bindparam_types_do($db, $offset, false, $sql_type, $value);
+
+ }
+
+ try {
+
+ // pdo_mysql_stmt_bindparam_types($db, 2, 'BIT(8)', 1);
+ pdo_mysql_stmt_bindparam_types($db, 3, 'TINYINT', -127);
+ pdo_mysql_stmt_bindparam_types($db, 4, 'TINYINT UNSIGNED', 255);
+ pdo_mysql_stmt_bindparam_types($db, 5, 'BOOLEAN', 1);
+ pdo_mysql_stmt_bindparam_types($db, 6, 'SMALLINT', -32768);
+ pdo_mysql_stmt_bindparam_types($db, 7, 'SMALLINT UNSIGNED', 65535);
+ pdo_mysql_stmt_bindparam_types($db, 8, 'MEDIUMINT', -8388608);
+ pdo_mysql_stmt_bindparam_types($db, 9, 'MEDIUMINT UNSIGNED', 16777215);
+ pdo_mysql_stmt_bindparam_types($db, 10, 'INT', -2147483648);
+ pdo_mysql_stmt_bindparam_types($db, 11, 'INT UNSIGNED', 4294967295);
+ pdo_mysql_stmt_bindparam_types($db, 12, 'BIGINT', -1000);
+ pdo_mysql_stmt_bindparam_types($db, 13, 'BIGINT UNSIGNED', 1000);
+ pdo_mysql_stmt_bindparam_types($db, 14, 'REAL', -1000);
+ pdo_mysql_stmt_bindparam_types($db, 15, 'REAL UNSIGNED', 1000);
+ pdo_mysql_stmt_bindparam_types($db, 16, 'REAL ZEROFILL', '0000000000000000000000');
+ pdo_mysql_stmt_bindparam_types($db, 17, 'REAL UNSIGNED ZEROFILL', '0000000000000000000010');
+ pdo_mysql_stmt_bindparam_types($db, 18, 'DOUBLE', -1000);
+ pdo_mysql_stmt_bindparam_types($db, 19, 'DOUBLE UNSIGNED', 1000);
+ pdo_mysql_stmt_bindparam_types($db, 20, 'DOUBLE ZEROFILL', '000000000000');
+ pdo_mysql_stmt_bindparam_types($db, 21, 'DOUBLE ZEROFILL UNSIGNED', '000000001000');
+ pdo_mysql_stmt_bindparam_types($db, 22, 'FLOAT', -1000);
+ pdo_mysql_stmt_bindparam_types($db, 23, 'FLOAT UNSIGNED', 1000);
+ pdo_mysql_stmt_bindparam_types($db, 24, 'FLOAT ZEROFILL', '000000000000');
+ pdo_mysql_stmt_bindparam_types($db, 25, 'FLOAT ZEROFILL UNSIGNED', '000000001000');
+ pdo_mysql_stmt_bindparam_types($db, 26, 'DECIMAL', -1000);
+ pdo_mysql_stmt_bindparam_types($db, 27, 'DECIMAL UNSIGNED', 1000);
+ pdo_mysql_stmt_bindparam_types($db, 28, 'DECIMAL ZEROFILL', '000000000000');
+ pdo_mysql_stmt_bindparam_types($db, 29, 'DECIMAL ZEROFILL UNSIGNED', '000000001000');
+ pdo_mysql_stmt_bindparam_types($db, 30, 'NUMERIC', -1000);
+ pdo_mysql_stmt_bindparam_types($db, 31, 'NUMERIC UNSIGNED', 1000);
+ pdo_mysql_stmt_bindparam_types($db, 32, 'NUMERIC ZEROFILL', '000000000000');
+ pdo_mysql_stmt_bindparam_types($db, 33, 'NUMERIC ZEROFILL UNSIGNED', '000000001000');
+ pdo_mysql_stmt_bindparam_types($db, 34, 'DATE', '2008-04-23');
+ pdo_mysql_stmt_bindparam_types($db, 35, 'TIME', '16:43:12');
+ pdo_mysql_stmt_bindparam_types($db, 36, 'TIMESTAMP', '2008-04-23 16:44:53');
+ pdo_mysql_stmt_bindparam_types($db, 37, 'DATETIME', '2008-04-23 16:44:53');
+ pdo_mysql_stmt_bindparam_types($db, 38, 'YEAR', '2008');
+ pdo_mysql_stmt_bindparam_types($db, 39, 'CHAR(1)', 'a');
+ pdo_mysql_stmt_bindparam_types($db, 40, 'CHAR(255)', 'abc');
+ pdo_mysql_stmt_bindparam_types($db, 41, 'VARCHAR(255)', str_repeat('a', 255));
+ pdo_mysql_stmt_bindparam_types($db, 42, 'BINARY(255)', str_repeat('a', 255));
+ pdo_mysql_stmt_bindparam_types($db, 43, 'VARBINARY(255)', str_repeat('a', 255));
+ pdo_mysql_stmt_bindparam_types($db, 44, 'TINYBLOB', str_repeat('a', 255));
+ pdo_mysql_stmt_bindparam_types($db, 45, 'BLOB', str_repeat('b', 300));
+ pdo_mysql_stmt_bindparam_types($db, 46, 'MEDIUMBLOB', str_repeat('b', 300));
+ pdo_mysql_stmt_bindparam_types($db, 47, 'LONGBLOB', str_repeat('b', 300));
+ pdo_mysql_stmt_bindparam_types($db, 48, 'TINYTEXT', str_repeat('c', 255));
+ pdo_mysql_stmt_bindparam_types($db, 49, 'TINYTEXT BINARY', str_repeat('c', 255));
+ pdo_mysql_stmt_bindparam_types($db, 50, 'TEXT', str_repeat('d', 300));
+ pdo_mysql_stmt_bindparam_types($db, 51, 'TEXT BINARY', str_repeat('d', 300));
+ pdo_mysql_stmt_bindparam_types($db, 52, 'MEDIUMTEXT', str_repeat('d', 300));
+ pdo_mysql_stmt_bindparam_types($db, 53, 'MEDIUMTEXT BINARY', str_repeat('d', 300));
+ pdo_mysql_stmt_bindparam_types($db, 54, 'LONGTEXT', str_repeat('d', 300));
+ pdo_mysql_stmt_bindparam_types($db, 55, 'LONGTEXT BINARY', str_repeat('d', 300));
+ pdo_mysql_stmt_bindparam_types($db, 56, "ENUM('yes', 'no') DEFAULT 'yes'", "no");
+ pdo_mysql_stmt_bindparam_types($db, 57, "SET('yes', 'no') DEFAULT 'yes'", "no");
+
+ } catch (PDOException $e) {
+ printf("[001] %s [%s] %s\n",
+ $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_bindvalue.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_bindvalue.phpt
index 173105a48e..537156ebbf 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_stmt_bindvalue.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_bindvalue.phpt
@@ -9,291 +9,291 @@ $db = MySQLPDOTest::factory();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
- MySQLPDOTest::createTestTable($db);
-
- printf("Testing native PS...\n");
- try {
- $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
- if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
- printf("[002] Unable to turn off emulated prepared statements\n");
-
- printf("Binding variable...\n");
- $stmt = $db->prepare('SELECT id, label FROM test WHERE id > ? ORDER BY id ASC LIMIT 2');
- $in = 0;
- if (!$stmt->bindValue(1, $in))
- printf("[003] Cannot bind value, %s %s\n",
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- $stmt->execute();
- $id = $label = null;
-
- if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT))
- printf("[004] Cannot bind integer column, %s %s\n",
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR))
- printf("[005] Cannot bind string column, %s %s\n",
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- while ($stmt->fetch(PDO::FETCH_BOUND))
- printf("in = %d -> id = %s (%s) / label = %s (%s)\n",
- $in,
- var_export($id, true), gettype($id),
- var_export($label, true), gettype($label));
-
- printf("Binding value and not variable...\n");
- if (!$stmt->bindValue(1, 0))
- printf("[006] Cannot bind value, %s %s\n",
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- $stmt->execute();
- $id = $label = null;
-
- if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT))
- printf("[007] Cannot bind integer column, %s %s\n",
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR))
- printf("[008] Cannot bind string column, %s %s\n",
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- while ($stmt->fetch(PDO::FETCH_BOUND))
- printf("in = %d -> id = %s (%s) / label = %s (%s)\n",
- $in,
- var_export($id, true), gettype($id),
- var_export($label, true), gettype($label));
-
- printf("Binding variable which references another variable...\n");
- $in = 0;
- $in_ref = &$in;
- if (!$stmt->bindValue(1, $in_ref))
- printf("[009] Cannot bind value, %s %s\n",
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- $stmt->execute();
- $id = $label = null;
-
- if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT))
- printf("[010] Cannot bind integer column, %s %s\n",
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR))
- printf("[011] Cannot bind string column, %s %s\n",
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- while ($stmt->fetch(PDO::FETCH_BOUND))
- printf("in = %d -> id = %s (%s) / label = %s (%s)\n",
- $in,
- var_export($id, true), gettype($id),
- var_export($label, true), gettype($label));
-
-
- printf("Binding a variable and a value...\n");
- $stmt = $db->prepare('SELECT id, label FROM test WHERE id > ? AND id <= ? ORDER BY id ASC LIMIT 2');
- $in = 0;
- if (!$stmt->bindValue(1, $in))
- printf("[012] Cannot bind value, %s %s\n",
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- if (!$stmt->bindValue(2, 2))
- printf("[013] Cannot bind value, %s %s\n",
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- $stmt->execute();
- $id = $label = null;
-
- if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT))
- printf("[014] Cannot bind integer column, %s %s\n",
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR))
- printf("[015] Cannot bind string column, %s %s\n",
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- while ($stmt->fetch(PDO::FETCH_BOUND))
- printf("in = %d -> id = %s (%s) / label = %s (%s)\n",
- $in,
- var_export($id, true), gettype($id),
- var_export($label, true), gettype($label));
-
- printf("Binding a variable to two placeholders and changing the variable value in between the binds...\n");
- // variable value change shall have no impact
- $stmt = $db->prepare('SELECT id, label FROM test WHERE id > ? AND id <= ? ORDER BY id ASC LIMIT 2');
- $in = 0;
- if (!$stmt->bindValue(1, $in))
- printf("[016] Cannot bind value, %s %s\n",
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- $in = 2;
- if (!$stmt->bindValue(2, $in))
- printf("[017] Cannot bind value, %s %s\n",
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- $stmt->execute();
- $id = $label = null;
-
- if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT))
- printf("[018] Cannot bind integer column, %s %s\n",
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR))
- printf("[019] Cannot bind string column, %s %s\n",
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- while ($stmt->fetch(PDO::FETCH_BOUND))
- printf("in = %d -> id = %s (%s) / label = %s (%s)\n",
- $in,
- var_export($id, true), gettype($id),
- var_export($label, true), gettype($label));
-
- } catch (PDOException $e) {
- printf("[001] %s [%s] %s\n",
- $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
- }
-
- printf("Testing emulated PS...\n");
- try {
- $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1);
- if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
- printf("[002] Unable to turn on emulated prepared statements\n");
-
- printf("Binding variable...\n");
- $stmt = $db->prepare('SELECT id, label FROM test WHERE id > ? ORDER BY id ASC LIMIT 2');
- $in = 0;
- if (!$stmt->bindValue(1, $in))
- printf("[003] Cannot bind value, %s %s\n",
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- $stmt->execute();
- $id = $label = null;
-
- if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT))
- printf("[004] Cannot bind integer column, %s %s\n",
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR))
- printf("[005] Cannot bind string column, %s %s\n",
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- while ($stmt->fetch(PDO::FETCH_BOUND))
- printf("in = %d -> id = %s (%s) / label = %s (%s)\n",
- $in,
- var_export($id, true), gettype($id),
- var_export($label, true), gettype($label));
-
- printf("Binding value and not variable...\n");
- if (!$stmt->bindValue(1, 0))
- printf("[006] Cannot bind value, %s %s\n",
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- $stmt->execute();
- $id = $label = null;
-
- if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT))
- printf("[007] Cannot bind integer column, %s %s\n",
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR))
- printf("[008] Cannot bind string column, %s %s\n",
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- while ($stmt->fetch(PDO::FETCH_BOUND))
- printf("in = %d -> id = %s (%s) / label = %s (%s)\n",
- $in,
- var_export($id, true), gettype($id),
- var_export($label, true), gettype($label));
-
- printf("Binding variable which references another variable...\n");
- $in = 0;
- $in_ref = &$in;
- if (!$stmt->bindValue(1, $in_ref))
- printf("[009] Cannot bind value, %s %s\n",
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- $stmt->execute();
- $id = $label = null;
-
- if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT))
- printf("[010] Cannot bind integer column, %s %s\n",
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR))
- printf("[011] Cannot bind string column, %s %s\n",
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- while ($stmt->fetch(PDO::FETCH_BOUND))
- printf("in = %d -> id = %s (%s) / label = %s (%s)\n",
- $in,
- var_export($id, true), gettype($id),
- var_export($label, true), gettype($label));
-
-
- printf("Binding a variable and a value...\n");
- $stmt = $db->prepare('SELECT id, label FROM test WHERE id > ? AND id <= ? ORDER BY id ASC LIMIT 2');
- $in = 0;
- if (!$stmt->bindValue(1, $in))
- printf("[012] Cannot bind value, %s %s\n",
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- if (!$stmt->bindValue(2, 2))
- printf("[013] Cannot bind value, %s %s\n",
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- $stmt->execute();
- $id = $label = null;
-
- if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT))
- printf("[014] Cannot bind integer column, %s %s\n",
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR))
- printf("[015] Cannot bind string column, %s %s\n",
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- while ($stmt->fetch(PDO::FETCH_BOUND))
- printf("in = %d -> id = %s (%s) / label = %s (%s)\n",
- $in,
- var_export($id, true), gettype($id),
- var_export($label, true), gettype($label));
-
- printf("Binding a variable to two placeholders and changing the variable value in between the binds...\n");
- // variable value change shall have no impact
- $stmt = $db->prepare('SELECT id, label FROM test WHERE id > ? AND id <= ? ORDER BY id ASC LIMIT 2');
- $in = 0;
- if (!$stmt->bindValue(1, $in))
- printf("[016] Cannot bind value, %s %s\n",
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- $in = 2;
- if (!$stmt->bindValue(2, $in))
- printf("[017] Cannot bind value, %s %s\n",
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- $stmt->execute();
- $id = $label = null;
-
- if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT))
- printf("[018] Cannot bind integer column, %s %s\n",
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR))
- printf("[019] Cannot bind string column, %s %s\n",
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- while ($stmt->fetch(PDO::FETCH_BOUND))
- printf("in = %d -> id = %s (%s) / label = %s (%s)\n",
- $in,
- var_export($id, true), gettype($id),
- var_export($label, true), gettype($label));
-
- } catch (PDOException $e) {
- printf("[001] %s [%s] %s\n",
- $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
- }
-
- print "done!";
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
+ MySQLPDOTest::createTestTable($db);
+
+ printf("Testing native PS...\n");
+ try {
+ $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
+ if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
+ printf("[002] Unable to turn off emulated prepared statements\n");
+
+ printf("Binding variable...\n");
+ $stmt = $db->prepare('SELECT id, label FROM test WHERE id > ? ORDER BY id ASC LIMIT 2');
+ $in = 0;
+ if (!$stmt->bindValue(1, $in))
+ printf("[003] Cannot bind value, %s %s\n",
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ $stmt->execute();
+ $id = $label = null;
+
+ if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT))
+ printf("[004] Cannot bind integer column, %s %s\n",
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR))
+ printf("[005] Cannot bind string column, %s %s\n",
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ while ($stmt->fetch(PDO::FETCH_BOUND))
+ printf("in = %d -> id = %s (%s) / label = %s (%s)\n",
+ $in,
+ var_export($id, true), gettype($id),
+ var_export($label, true), gettype($label));
+
+ printf("Binding value and not variable...\n");
+ if (!$stmt->bindValue(1, 0))
+ printf("[006] Cannot bind value, %s %s\n",
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ $stmt->execute();
+ $id = $label = null;
+
+ if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT))
+ printf("[007] Cannot bind integer column, %s %s\n",
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR))
+ printf("[008] Cannot bind string column, %s %s\n",
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ while ($stmt->fetch(PDO::FETCH_BOUND))
+ printf("in = %d -> id = %s (%s) / label = %s (%s)\n",
+ $in,
+ var_export($id, true), gettype($id),
+ var_export($label, true), gettype($label));
+
+ printf("Binding variable which references another variable...\n");
+ $in = 0;
+ $in_ref = &$in;
+ if (!$stmt->bindValue(1, $in_ref))
+ printf("[009] Cannot bind value, %s %s\n",
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ $stmt->execute();
+ $id = $label = null;
+
+ if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT))
+ printf("[010] Cannot bind integer column, %s %s\n",
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR))
+ printf("[011] Cannot bind string column, %s %s\n",
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ while ($stmt->fetch(PDO::FETCH_BOUND))
+ printf("in = %d -> id = %s (%s) / label = %s (%s)\n",
+ $in,
+ var_export($id, true), gettype($id),
+ var_export($label, true), gettype($label));
+
+
+ printf("Binding a variable and a value...\n");
+ $stmt = $db->prepare('SELECT id, label FROM test WHERE id > ? AND id <= ? ORDER BY id ASC LIMIT 2');
+ $in = 0;
+ if (!$stmt->bindValue(1, $in))
+ printf("[012] Cannot bind value, %s %s\n",
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ if (!$stmt->bindValue(2, 2))
+ printf("[013] Cannot bind value, %s %s\n",
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ $stmt->execute();
+ $id = $label = null;
+
+ if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT))
+ printf("[014] Cannot bind integer column, %s %s\n",
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR))
+ printf("[015] Cannot bind string column, %s %s\n",
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ while ($stmt->fetch(PDO::FETCH_BOUND))
+ printf("in = %d -> id = %s (%s) / label = %s (%s)\n",
+ $in,
+ var_export($id, true), gettype($id),
+ var_export($label, true), gettype($label));
+
+ printf("Binding a variable to two placeholders and changing the variable value in between the binds...\n");
+ // variable value change shall have no impact
+ $stmt = $db->prepare('SELECT id, label FROM test WHERE id > ? AND id <= ? ORDER BY id ASC LIMIT 2');
+ $in = 0;
+ if (!$stmt->bindValue(1, $in))
+ printf("[016] Cannot bind value, %s %s\n",
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ $in = 2;
+ if (!$stmt->bindValue(2, $in))
+ printf("[017] Cannot bind value, %s %s\n",
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ $stmt->execute();
+ $id = $label = null;
+
+ if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT))
+ printf("[018] Cannot bind integer column, %s %s\n",
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR))
+ printf("[019] Cannot bind string column, %s %s\n",
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ while ($stmt->fetch(PDO::FETCH_BOUND))
+ printf("in = %d -> id = %s (%s) / label = %s (%s)\n",
+ $in,
+ var_export($id, true), gettype($id),
+ var_export($label, true), gettype($label));
+
+ } catch (PDOException $e) {
+ printf("[001] %s [%s] %s\n",
+ $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
+
+ printf("Testing emulated PS...\n");
+ try {
+ $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1);
+ if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
+ printf("[002] Unable to turn on emulated prepared statements\n");
+
+ printf("Binding variable...\n");
+ $stmt = $db->prepare('SELECT id, label FROM test WHERE id > ? ORDER BY id ASC LIMIT 2');
+ $in = 0;
+ if (!$stmt->bindValue(1, $in))
+ printf("[003] Cannot bind value, %s %s\n",
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ $stmt->execute();
+ $id = $label = null;
+
+ if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT))
+ printf("[004] Cannot bind integer column, %s %s\n",
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR))
+ printf("[005] Cannot bind string column, %s %s\n",
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ while ($stmt->fetch(PDO::FETCH_BOUND))
+ printf("in = %d -> id = %s (%s) / label = %s (%s)\n",
+ $in,
+ var_export($id, true), gettype($id),
+ var_export($label, true), gettype($label));
+
+ printf("Binding value and not variable...\n");
+ if (!$stmt->bindValue(1, 0))
+ printf("[006] Cannot bind value, %s %s\n",
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ $stmt->execute();
+ $id = $label = null;
+
+ if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT))
+ printf("[007] Cannot bind integer column, %s %s\n",
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR))
+ printf("[008] Cannot bind string column, %s %s\n",
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ while ($stmt->fetch(PDO::FETCH_BOUND))
+ printf("in = %d -> id = %s (%s) / label = %s (%s)\n",
+ $in,
+ var_export($id, true), gettype($id),
+ var_export($label, true), gettype($label));
+
+ printf("Binding variable which references another variable...\n");
+ $in = 0;
+ $in_ref = &$in;
+ if (!$stmt->bindValue(1, $in_ref))
+ printf("[009] Cannot bind value, %s %s\n",
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ $stmt->execute();
+ $id = $label = null;
+
+ if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT))
+ printf("[010] Cannot bind integer column, %s %s\n",
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR))
+ printf("[011] Cannot bind string column, %s %s\n",
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ while ($stmt->fetch(PDO::FETCH_BOUND))
+ printf("in = %d -> id = %s (%s) / label = %s (%s)\n",
+ $in,
+ var_export($id, true), gettype($id),
+ var_export($label, true), gettype($label));
+
+
+ printf("Binding a variable and a value...\n");
+ $stmt = $db->prepare('SELECT id, label FROM test WHERE id > ? AND id <= ? ORDER BY id ASC LIMIT 2');
+ $in = 0;
+ if (!$stmt->bindValue(1, $in))
+ printf("[012] Cannot bind value, %s %s\n",
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ if (!$stmt->bindValue(2, 2))
+ printf("[013] Cannot bind value, %s %s\n",
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ $stmt->execute();
+ $id = $label = null;
+
+ if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT))
+ printf("[014] Cannot bind integer column, %s %s\n",
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR))
+ printf("[015] Cannot bind string column, %s %s\n",
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ while ($stmt->fetch(PDO::FETCH_BOUND))
+ printf("in = %d -> id = %s (%s) / label = %s (%s)\n",
+ $in,
+ var_export($id, true), gettype($id),
+ var_export($label, true), gettype($label));
+
+ printf("Binding a variable to two placeholders and changing the variable value in between the binds...\n");
+ // variable value change shall have no impact
+ $stmt = $db->prepare('SELECT id, label FROM test WHERE id > ? AND id <= ? ORDER BY id ASC LIMIT 2');
+ $in = 0;
+ if (!$stmt->bindValue(1, $in))
+ printf("[016] Cannot bind value, %s %s\n",
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ $in = 2;
+ if (!$stmt->bindValue(2, $in))
+ printf("[017] Cannot bind value, %s %s\n",
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ $stmt->execute();
+ $id = $label = null;
+
+ if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT))
+ printf("[018] Cannot bind integer column, %s %s\n",
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR))
+ printf("[019] Cannot bind string column, %s %s\n",
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ while ($stmt->fetch(PDO::FETCH_BOUND))
+ printf("in = %d -> id = %s (%s) / label = %s (%s)\n",
+ $in,
+ var_export($id, true), gettype($id),
+ var_export($label, true), gettype($label));
+
+ } catch (PDOException $e) {
+ printf("[001] %s [%s] %s\n",
+ $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_blobfromsteam.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_blobfromsteam.phpt
index bea8773a23..9d6ee3d9b8 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_stmt_blobfromsteam.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_blobfromsteam.phpt
@@ -28,112 +28,112 @@ unlink($file);
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
-
- function blob_from_stream($offset, $db, $file, $blob) {
-
- @unlink($file);
- clearstatcache();
- if (file_exists($file)) {
- printf("[%03d + 1] Cannot remove old test file\n", $offset);
- return false;
- }
-
- $fp = fopen($file, 'w');
- if (!$fp || !fwrite($fp, $blob)) {
- printf("[%03d + 2] Cannot create test file '%s'\n", $offset, $file);
- return false;
- }
-
- fclose($fp);
- clearstatcache();
- if (!file_exists($file)) {
- printf("[%03d + 3] Failed to create test file '%s'\n", $offset, $file);
- return false;
- }
-
- $db->exec('DROP TABLE IF EXISTS test');
- $sql = sprintf('CREATE TABLE test(id INT, label BLOB) ENGINE=%s', PDO_MYSQL_TEST_ENGINE);
- $db->exec($sql);
-
- if (!$stmt = $db->prepare('INSERT INTO test(id, label) VALUES (?, ?)')) {
- printf("[%03d + 4] %s\n", $offset, var_export($db->errorInfo(), true));
- return false;
- }
-
- $fp = fopen($file, 'r');
- if (!$fp) {
- printf("[%03d + 5] Cannot create test file '%s'\n", $offset, $file);
- return false;
- }
-
-
- $id = 1;
- $stmt->bindParam(1, $id);
- if (true !== ($tmp = $stmt->bindParam(2, $fp, PDO::PARAM_LOB))) {
- printf("[%03d + 6] Expecting true, got %s. %s\n",
- $offset,
- var_export($tmp, true),
- var_export($db->errorInfo(), true));
- return false;
- }
-
- if (true !== $stmt->execute()) {
- printf("[%03d + 7] Failed to INSERT data, %s\n", $offset, var_export($stmt->errorInfo(), true));
- return false;
- }
-
- $stmt2 = $db->query('SELECT id, label FROM test WHERE id = 1');
- $row = $stmt2->fetch(PDO::FETCH_ASSOC);
- if ($row['label'] != $blob) {
- printf("[%03d + 8] INSERT and/or SELECT has failed, dumping data.\n", $offset);
- var_dump($row);
- var_dump($blob);
- return false;
- }
-
- // Lets test the chr(0) handling in case the streaming has failed:
- // is the bug about chr(0) or the streaming...
- $db->exec('DELETE FROM test');
- $stmt = $db->prepare('INSERT INTO test(id, label) VALUES (?, ?)');
- $stmt->bindParam(1, $id);
- $stmt->bindParam(2, $blob);
- if (true !== $stmt->execute())
- printf("[%03d + 9] %s\n", $offset, var_export($stmt->errorInfo(), true));
-
- $stmt2 = $db->query('SELECT id, label FROM test WHERE id = 1');
- $row = $stmt2->fetch(PDO::FETCH_ASSOC);
- if ($row['label'] != $blob) {
- printf("[%03d + 10] INSERT and/or SELECT has failed, dumping data.\n", $offset);
- var_dump($row);
- var_dump($blob);
- return false;
- }
-
- return true;
- }
-
- $db = MySQLPDOTest::factory();
- $blob = 'I am a mighty BLOB!' . chr(0) . "I am a binary thingie!";
- $tmp = MySQLPDOTest::getTempDir();
- $file = $tmp . DIRECTORY_SEPARATOR . 'pdoblob.tst';
-
- try {
-
- printf("Emulated PS...\n");
- $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1);
- blob_from_stream(10, $db, $file, $blob);
-
- printf("Native PS...\n");
- $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
- blob_from_stream(30, $db, $file, $blob);
-
- } catch (PDOException $e) {
- printf("[001] %s [%s] %s\n",
- $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
- }
-
- print "done!";
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+
+ function blob_from_stream($offset, $db, $file, $blob) {
+
+ @unlink($file);
+ clearstatcache();
+ if (file_exists($file)) {
+ printf("[%03d + 1] Cannot remove old test file\n", $offset);
+ return false;
+ }
+
+ $fp = fopen($file, 'w');
+ if (!$fp || !fwrite($fp, $blob)) {
+ printf("[%03d + 2] Cannot create test file '%s'\n", $offset, $file);
+ return false;
+ }
+
+ fclose($fp);
+ clearstatcache();
+ if (!file_exists($file)) {
+ printf("[%03d + 3] Failed to create test file '%s'\n", $offset, $file);
+ return false;
+ }
+
+ $db->exec('DROP TABLE IF EXISTS test');
+ $sql = sprintf('CREATE TABLE test(id INT, label BLOB) ENGINE=%s', PDO_MYSQL_TEST_ENGINE);
+ $db->exec($sql);
+
+ if (!$stmt = $db->prepare('INSERT INTO test(id, label) VALUES (?, ?)')) {
+ printf("[%03d + 4] %s\n", $offset, var_export($db->errorInfo(), true));
+ return false;
+ }
+
+ $fp = fopen($file, 'r');
+ if (!$fp) {
+ printf("[%03d + 5] Cannot create test file '%s'\n", $offset, $file);
+ return false;
+ }
+
+
+ $id = 1;
+ $stmt->bindParam(1, $id);
+ if (true !== ($tmp = $stmt->bindParam(2, $fp, PDO::PARAM_LOB))) {
+ printf("[%03d + 6] Expecting true, got %s. %s\n",
+ $offset,
+ var_export($tmp, true),
+ var_export($db->errorInfo(), true));
+ return false;
+ }
+
+ if (true !== $stmt->execute()) {
+ printf("[%03d + 7] Failed to INSERT data, %s\n", $offset, var_export($stmt->errorInfo(), true));
+ return false;
+ }
+
+ $stmt2 = $db->query('SELECT id, label FROM test WHERE id = 1');
+ $row = $stmt2->fetch(PDO::FETCH_ASSOC);
+ if ($row['label'] != $blob) {
+ printf("[%03d + 8] INSERT and/or SELECT has failed, dumping data.\n", $offset);
+ var_dump($row);
+ var_dump($blob);
+ return false;
+ }
+
+ // Lets test the chr(0) handling in case the streaming has failed:
+ // is the bug about chr(0) or the streaming...
+ $db->exec('DELETE FROM test');
+ $stmt = $db->prepare('INSERT INTO test(id, label) VALUES (?, ?)');
+ $stmt->bindParam(1, $id);
+ $stmt->bindParam(2, $blob);
+ if (true !== $stmt->execute())
+ printf("[%03d + 9] %s\n", $offset, var_export($stmt->errorInfo(), true));
+
+ $stmt2 = $db->query('SELECT id, label FROM test WHERE id = 1');
+ $row = $stmt2->fetch(PDO::FETCH_ASSOC);
+ if ($row['label'] != $blob) {
+ printf("[%03d + 10] INSERT and/or SELECT has failed, dumping data.\n", $offset);
+ var_dump($row);
+ var_dump($blob);
+ return false;
+ }
+
+ return true;
+ }
+
+ $db = MySQLPDOTest::factory();
+ $blob = 'I am a mighty BLOB!' . chr(0) . "I am a binary thingie!";
+ $tmp = MySQLPDOTest::getTempDir();
+ $file = $tmp . DIRECTORY_SEPARATOR . 'pdoblob.tst';
+
+ try {
+
+ printf("Emulated PS...\n");
+ $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1);
+ blob_from_stream(10, $db, $file, $blob);
+
+ printf("Native PS...\n");
+ $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
+ blob_from_stream(30, $db, $file, $blob);
+
+ } catch (PDOException $e) {
+ printf("[001] %s [%s] %s\n",
+ $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_blobs.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_blobs.phpt
index a247de534e..9bdd03d7bd 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_stmt_blobs.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_blobs.phpt
@@ -8,85 +8,85 @@ MySQLPDOTest::skip();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
- $blobs = array(
- 'TINYBLOB' => 255,
- 'TINYTEXT' => 255,
- 'BLOB' => 32767,
- 'TEXT' => 32767,
- 'MEDIUMBLOB' => 100000,
- 'MEDIUMTEXT' => 100000,
- 'LONGBLOB' => 100000,
- 'LONGTEXT' => 100000,
- );
+ $blobs = array(
+ 'TINYBLOB' => 255,
+ 'TINYTEXT' => 255,
+ 'BLOB' => 32767,
+ 'TEXT' => 32767,
+ 'MEDIUMBLOB' => 100000,
+ 'MEDIUMTEXT' => 100000,
+ 'LONGBLOB' => 100000,
+ 'LONGTEXT' => 100000,
+ );
- function test_blob($db, $offset, $sql_type, $test_len) {
+ function test_blob($db, $offset, $sql_type, $test_len) {
- $db->exec('DROP TABLE IF EXISTS test');
- $db->exec(sprintf('CREATE TABLE test(id INT, label %s) ENGINE=%s', $sql_type, PDO_MYSQL_TEST_ENGINE));
+ $db->exec('DROP TABLE IF EXISTS test');
+ $db->exec(sprintf('CREATE TABLE test(id INT, label %s) ENGINE=%s', $sql_type, PDO_MYSQL_TEST_ENGINE));
- $value = str_repeat('a', $test_len);
- $stmt = $db->prepare('INSERT INTO test(id, label) VALUES (?, ?)');
- $stmt->bindValue(1, 1);
- $stmt->bindValue(2, $value);
- if (!$stmt->execute()) {
- printf("[%03d + 1] %d %s\n",
- $offset, $stmt->errorCode(), var_export($stmt->errorInfo(), true));
- return false;
- }
+ $value = str_repeat('a', $test_len);
+ $stmt = $db->prepare('INSERT INTO test(id, label) VALUES (?, ?)');
+ $stmt->bindValue(1, 1);
+ $stmt->bindValue(2, $value);
+ if (!$stmt->execute()) {
+ printf("[%03d + 1] %d %s\n",
+ $offset, $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+ return false;
+ }
- $stmt = $db->query('SELECT id, label FROM test');
- $id = $label = NULL;
- $stmt->bindColumn(1, $id, PDO::PARAM_INT);
- $stmt->bindColumn(2, $label, PDO::PARAM_LOB);
+ $stmt = $db->query('SELECT id, label FROM test');
+ $id = $label = NULL;
+ $stmt->bindColumn(1, $id, PDO::PARAM_INT);
+ $stmt->bindColumn(2, $label, PDO::PARAM_LOB);
- if (!$stmt->fetch(PDO::FETCH_BOUND)) {
- printf("[%03d + 2] %d %s\n",
- $offset, $stmt->errorCode(), var_export($stmt->errorInfo(), true));
- return false;
- }
+ if (!$stmt->fetch(PDO::FETCH_BOUND)) {
+ printf("[%03d + 2] %d %s\n",
+ $offset, $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+ return false;
+ }
- if ($label !== $value) {
- printf("[%03d + 3] Returned value seems to be wrong (%d vs. %d characters). Check manually\n",
- $offset, strlen($label), strlen($value));
- return false;
- }
+ if ($label !== $value) {
+ printf("[%03d + 3] Returned value seems to be wrong (%d vs. %d characters). Check manually\n",
+ $offset, strlen($label), strlen($value));
+ return false;
+ }
- if (1 != $id) {
- printf("[%03d + 3] Returned id column value seems wrong, expecting 1 got %s.\n",
- $offset, var_export($id, true));
- return false;
- }
+ if (1 != $id) {
+ printf("[%03d + 3] Returned id column value seems wrong, expecting 1 got %s.\n",
+ $offset, var_export($id, true));
+ return false;
+ }
- $stmt = $db->query('SELECT id, label FROM test');
- $ret = $stmt->fetch(PDO::FETCH_ASSOC);
+ $stmt = $db->query('SELECT id, label FROM test');
+ $ret = $stmt->fetch(PDO::FETCH_ASSOC);
- if ($ret['label'] !== $value) {
- printf("[%03d + 3] Returned value seems to be wrong (%d vs. %d characters). Check manually\n",
- $offset, strlen($ret['label']), strlen($value));
- return false;
- }
+ if ($ret['label'] !== $value) {
+ printf("[%03d + 3] Returned value seems to be wrong (%d vs. %d characters). Check manually\n",
+ $offset, strlen($ret['label']), strlen($value));
+ return false;
+ }
- if (1 != $ret['id']) {
- printf("[%03d + 3] Returned id column value seems wrong, expecting 1 got %s.\n",
- $offset, var_export($ret['id'], true));
- return false;
- }
+ if (1 != $ret['id']) {
+ printf("[%03d + 3] Returned id column value seems wrong, expecting 1 got %s.\n",
+ $offset, var_export($ret['id'], true));
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- $offset = 0;
- foreach ($blobs as $sql_type => $test_len) {
- $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1);
- test_blob($db, ++$offset, $sql_type, $test_len);
- $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
- test_blob($db, ++$offset, $sql_type, $test_len);
- }
+ $offset = 0;
+ foreach ($blobs as $sql_type => $test_len) {
+ $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1);
+ test_blob($db, ++$offset, $sql_type, $test_len);
+ $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
+ test_blob($db, ++$offset, $sql_type, $test_len);
+ }
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_closecursor.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_closecursor.phpt
index d0da7a8e16..4125155f6d 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_stmt_closecursor.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_closecursor.phpt
@@ -9,140 +9,140 @@ $db = MySQLPDOTest::factory();
?>
--FILE--
<?php
- /* TODO the results look wrong, why do we get 2014 with buffered AND unbuffered queries */
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
-
- function pdo_mysql_stmt_closecursor($db) {
-
- // This one should fail. I let it fail to prove that closeCursor() makes a difference.
- // If no error messages gets printed do not know if proper usage of closeCursor() makes any
- // difference or not. That's why we need to cause an error here.
- $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
- $stmt1 = $db->query('SELECT id, label FROM test ORDER BY id ASC');
- // query() shall fail!
- $stmt2 = $db->query('SELECT id, label FROM test ORDER BY id ASC');
- $stmt1->closeCursor();
-
- // This is proper usage of closeCursor(). It shall prevent any further error messages.
- if (MySQLPDOTest::isPDOMySQLnd()) {
- $stmt1 = $db->query('SELECT id, label FROM test ORDER BY id ASC');
- } else {
- // see pdo_mysql_stmt_unbuffered_2050.phpt for an explanation
- unset($stmt1);
- $stmt1 = $db->query('SELECT id, label FROM test ORDER BY id ASC');
- }
- // fetch only the first rows and let closeCursor() clean up
- $row1 = $stmt1->fetch(PDO::FETCH_ASSOC);
- $stmt1->closeCursor();
-
- $stmt2 = $db->prepare('UPDATE test SET label = ? WHERE id = ?');
- $stmt2->bindValue(1, "z");
-
- $stmt2->bindValue(2, $row1['id']);
- $stmt2->execute();
- $stmt2->closeCursor();
-
- $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
- // check if changing the fetch mode from unbuffered to buffered will
- // cause any harm to a statement created prior to the change
- $stmt1->execute();
- $row2 = $stmt1->fetch(PDO::FETCH_ASSOC);
- $stmt1->closeCursor();
- if (!isset($row2['label']) || ('z' !== $row2['label']))
- printf("Expecting array(id => 1, label => z) got %s\n", var_export($row2, true));
- unset($stmt1);
-
- $stmt1 = $db->query('SELECT id, label FROM test ORDER BY id ASC');
- // should work
- $stmt2 = $db->query('SELECT id, label FROM test ORDER BY id ASC');
- $stmt1->closeCursor();
-
- $stmt1 = $db->query('SELECT id, label FROM test ORDER BY id ASC');
- // fetch only the first rows and let closeCursor() clean up
- $row3 = $stmt1->fetch(PDO::FETCH_ASSOC);
- $stmt1->closeCursor();
- assert($row3 == $row2);
-
- $stmt2 = $db->prepare('UPDATE test SET label = ? WHERE id = ?');
- $stmt2->bindValue(1, "a");
- $stmt2->bindValue(2, $row1['id']);
- $stmt2->execute();
- $stmt2->closeCursor();
-
- $stmt1->execute();
- $row4 = $stmt1->fetch(PDO::FETCH_ASSOC);
- $stmt1->closeCursor();
- assert($row4 == $row1);
-
- $offset = 0;
- $stmt = $db->prepare('SELECT id, label FROM test WHERE id > ? ORDER BY id ASC LIMIT 2');
- $in = 0;
- if (!$stmt->bindParam(1, $in))
- printf("[%03d + 1] Cannot bind parameter, %s %s\n", $offset,
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- $stmt->execute();
- $id = $label = null;
-
- if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT))
- printf("[%03d + 2] Cannot bind integer column, %s %s\n", $offset,
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR))
- printf("[%03d + 3] Cannot bind string column, %s %s\n", $offset,
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
-
- while ($stmt->fetch(PDO::FETCH_BOUND))
- printf("in = %d -> id = %s (%s) / label = %s (%s)\n",
- $in,
- var_export($id, true), gettype($id),
- var_export($label, true), gettype($label));
-
- $stmt->closeCursor();
- $stmt->execute();
-
- }
-
-
- try {
-
- printf("Testing emulated PS...\n");
- $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1);
- if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
- printf("[002] Unable to turn on emulated prepared statements\n");
-
- printf("Buffered...\n");
- $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
- MySQLPDOTest::createTestTable($db);
- pdo_mysql_stmt_closecursor($db);
-
- printf("Unbuffered...\n");
- $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
- MySQLPDOTest::createTestTable($db);
- pdo_mysql_stmt_closecursor($db);
-
- printf("Testing native PS...\n");
- $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
- if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
- printf("[002] Unable to turn off emulated prepared statements\n");
-
- printf("Buffered...\n");
- MySQLPDOTest::createTestTable($db);
- $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
- pdo_mysql_stmt_closecursor($db);
-
- printf("Unbuffered...\n");
- MySQLPDOTest::createTestTable($db);
- $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
- pdo_mysql_stmt_closecursor($db);
-
- } catch (PDOException $e) {
- printf("[001] %s [%s] %s\n",
- $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
- }
-
- print "done!";
+ /* TODO the results look wrong, why do we get 2014 with buffered AND unbuffered queries */
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
+
+ function pdo_mysql_stmt_closecursor($db) {
+
+ // This one should fail. I let it fail to prove that closeCursor() makes a difference.
+ // If no error messages gets printed do not know if proper usage of closeCursor() makes any
+ // difference or not. That's why we need to cause an error here.
+ $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
+ $stmt1 = $db->query('SELECT id, label FROM test ORDER BY id ASC');
+ // query() shall fail!
+ $stmt2 = $db->query('SELECT id, label FROM test ORDER BY id ASC');
+ $stmt1->closeCursor();
+
+ // This is proper usage of closeCursor(). It shall prevent any further error messages.
+ if (MySQLPDOTest::isPDOMySQLnd()) {
+ $stmt1 = $db->query('SELECT id, label FROM test ORDER BY id ASC');
+ } else {
+ // see pdo_mysql_stmt_unbuffered_2050.phpt for an explanation
+ unset($stmt1);
+ $stmt1 = $db->query('SELECT id, label FROM test ORDER BY id ASC');
+ }
+ // fetch only the first rows and let closeCursor() clean up
+ $row1 = $stmt1->fetch(PDO::FETCH_ASSOC);
+ $stmt1->closeCursor();
+
+ $stmt2 = $db->prepare('UPDATE test SET label = ? WHERE id = ?');
+ $stmt2->bindValue(1, "z");
+
+ $stmt2->bindValue(2, $row1['id']);
+ $stmt2->execute();
+ $stmt2->closeCursor();
+
+ $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
+ // check if changing the fetch mode from unbuffered to buffered will
+ // cause any harm to a statement created prior to the change
+ $stmt1->execute();
+ $row2 = $stmt1->fetch(PDO::FETCH_ASSOC);
+ $stmt1->closeCursor();
+ if (!isset($row2['label']) || ('z' !== $row2['label']))
+ printf("Expecting array(id => 1, label => z) got %s\n", var_export($row2, true));
+ unset($stmt1);
+
+ $stmt1 = $db->query('SELECT id, label FROM test ORDER BY id ASC');
+ // should work
+ $stmt2 = $db->query('SELECT id, label FROM test ORDER BY id ASC');
+ $stmt1->closeCursor();
+
+ $stmt1 = $db->query('SELECT id, label FROM test ORDER BY id ASC');
+ // fetch only the first rows and let closeCursor() clean up
+ $row3 = $stmt1->fetch(PDO::FETCH_ASSOC);
+ $stmt1->closeCursor();
+ assert($row3 == $row2);
+
+ $stmt2 = $db->prepare('UPDATE test SET label = ? WHERE id = ?');
+ $stmt2->bindValue(1, "a");
+ $stmt2->bindValue(2, $row1['id']);
+ $stmt2->execute();
+ $stmt2->closeCursor();
+
+ $stmt1->execute();
+ $row4 = $stmt1->fetch(PDO::FETCH_ASSOC);
+ $stmt1->closeCursor();
+ assert($row4 == $row1);
+
+ $offset = 0;
+ $stmt = $db->prepare('SELECT id, label FROM test WHERE id > ? ORDER BY id ASC LIMIT 2');
+ $in = 0;
+ if (!$stmt->bindParam(1, $in))
+ printf("[%03d + 1] Cannot bind parameter, %s %s\n", $offset,
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ $stmt->execute();
+ $id = $label = null;
+
+ if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT))
+ printf("[%03d + 2] Cannot bind integer column, %s %s\n", $offset,
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR))
+ printf("[%03d + 3] Cannot bind string column, %s %s\n", $offset,
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+
+ while ($stmt->fetch(PDO::FETCH_BOUND))
+ printf("in = %d -> id = %s (%s) / label = %s (%s)\n",
+ $in,
+ var_export($id, true), gettype($id),
+ var_export($label, true), gettype($label));
+
+ $stmt->closeCursor();
+ $stmt->execute();
+
+ }
+
+
+ try {
+
+ printf("Testing emulated PS...\n");
+ $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1);
+ if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
+ printf("[002] Unable to turn on emulated prepared statements\n");
+
+ printf("Buffered...\n");
+ $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
+ MySQLPDOTest::createTestTable($db);
+ pdo_mysql_stmt_closecursor($db);
+
+ printf("Unbuffered...\n");
+ $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
+ MySQLPDOTest::createTestTable($db);
+ pdo_mysql_stmt_closecursor($db);
+
+ printf("Testing native PS...\n");
+ $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
+ if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
+ printf("[002] Unable to turn off emulated prepared statements\n");
+
+ printf("Buffered...\n");
+ MySQLPDOTest::createTestTable($db);
+ $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
+ pdo_mysql_stmt_closecursor($db);
+
+ printf("Unbuffered...\n");
+ MySQLPDOTest::createTestTable($db);
+ $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
+ pdo_mysql_stmt_closecursor($db);
+
+ } catch (PDOException $e) {
+ printf("[001] %s [%s] %s\n",
+ $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_closecursor_empty.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_closecursor_empty.phpt
index 77f663584a..e732ed5e34 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_stmt_closecursor_empty.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_closecursor_empty.phpt
@@ -9,57 +9,57 @@ $db = MySQLPDOTest::factory();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
- try {
+ try {
- $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
- if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
- printf("[002] Unable to turn off emulated prepared statements\n");
+ $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
+ if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
+ printf("[002] Unable to turn off emulated prepared statements\n");
- $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
- MySQLPDOTest::createTestTable($db);
+ $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
+ MySQLPDOTest::createTestTable($db);
- $stmt = $db->prepare('SELECT id, label FROM test WHERE id > ? ORDER BY id ASC LIMIT 2');
- $in = 0;
- if (!$stmt->bindParam(1, $in))
- printf("[003] Cannot bind parameter, %s %s\n",
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+ $stmt = $db->prepare('SELECT id, label FROM test WHERE id > ? ORDER BY id ASC LIMIT 2');
+ $in = 0;
+ if (!$stmt->bindParam(1, $in))
+ printf("[003] Cannot bind parameter, %s %s\n",
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
- $stmt->execute();
- $id = $label = null;
+ $stmt->execute();
+ $id = $label = null;
- if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT))
- printf("[004] Cannot bind integer column, %s %s\n",
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+ if (!$stmt->bindColumn(1, $id, PDO::PARAM_INT))
+ printf("[004] Cannot bind integer column, %s %s\n",
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
- if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR))
- printf("[005] Cannot bind string column, %s %s\n",
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+ if (!$stmt->bindColumn(2, $label, PDO::PARAM_STR))
+ printf("[005] Cannot bind string column, %s %s\n",
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
- while ($stmt->fetch(PDO::FETCH_BOUND))
- printf("in = %d -> id = %s (%s) / label = %s (%s)\n",
- $in,
- var_export($id, true), gettype($id),
- var_export($label, true), gettype($label));
+ while ($stmt->fetch(PDO::FETCH_BOUND))
+ printf("in = %d -> id = %s (%s) / label = %s (%s)\n",
+ $in,
+ var_export($id, true), gettype($id),
+ var_export($label, true), gettype($label));
- $stmt->closeCursor();
- $stmt->execute();
- while ($stmt->fetch(PDO::FETCH_BOUND))
- printf("in = %d -> id = %s (%s) / label = %s (%s)\n",
- $in,
- var_export($id, true), gettype($id),
- var_export($label, true), gettype($label));
+ $stmt->closeCursor();
+ $stmt->execute();
+ while ($stmt->fetch(PDO::FETCH_BOUND))
+ printf("in = %d -> id = %s (%s) / label = %s (%s)\n",
+ $in,
+ var_export($id, true), gettype($id),
+ var_export($label, true), gettype($label));
- } catch (PDOException $e) {
- printf("[001] %s [%s] %s\n",
- $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
- }
+ } catch (PDOException $e) {
+ printf("[001] %s [%s] %s\n",
+ $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
- $db->exec('DROP TABLE IF EXISTS test');
- print "done!";
+ $db->exec('DROP TABLE IF EXISTS test');
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_columncount.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_columncount.phpt
index a701469ed1..2c4de9f87c 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_stmt_columncount.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_columncount.phpt
@@ -9,50 +9,50 @@ $db = MySQLPDOTest::factory();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
- MySQLPDOTest::createTestTable($db);
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
+ MySQLPDOTest::createTestTable($db);
- // The only purpose of this is to check if emulated and native PS
+ // The only purpose of this is to check if emulated and native PS
// return the same. If it works for one, it should work for all.
- // Internal data structures should be the same in both cases.
- printf("Testing emulated PS...\n");
- try {
- $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1);
- if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
- printf("[002] Unable to turn on emulated prepared statements\n");
+ // Internal data structures should be the same in both cases.
+ printf("Testing emulated PS...\n");
+ try {
+ $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1);
+ if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
+ printf("[002] Unable to turn on emulated prepared statements\n");
- $stmt = $db->prepare("SELECT id, label, '?' as foo FROM test");
- $stmt->execute();
- var_dump($stmt->columnCount());
+ $stmt = $db->prepare("SELECT id, label, '?' as foo FROM test");
+ $stmt->execute();
+ var_dump($stmt->columnCount());
- $stmt = $db->query('SELECT * FROM test');
- var_dump($stmt->columnCount());
+ $stmt = $db->query('SELECT * FROM test');
+ var_dump($stmt->columnCount());
- } catch (PDOException $e) {
- printf("[001] %s [%s] %s\n",
- $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
- }
+ } catch (PDOException $e) {
+ printf("[001] %s [%s] %s\n",
+ $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
- printf("Testing native PS...\n");
- try {
- $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
- if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
- printf("[004] Unable to turn off emulated prepared statements\n");
+ printf("Testing native PS...\n");
+ try {
+ $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
+ if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
+ printf("[004] Unable to turn off emulated prepared statements\n");
- $stmt = $db->prepare("SELECT id, label, '?' as foo, 'TODO - Stored Procedure' as bar FROM test");
- $stmt->execute();
- var_dump($stmt->columnCount());
+ $stmt = $db->prepare("SELECT id, label, '?' as foo, 'TODO - Stored Procedure' as bar FROM test");
+ $stmt->execute();
+ var_dump($stmt->columnCount());
- $stmt = $db->query('SELECT * FROM test');
- var_dump($stmt->columnCount());
+ $stmt = $db->query('SELECT * FROM test');
+ var_dump($stmt->columnCount());
- } catch (PDOException $e) {
- printf("[003] %s [%s] %s\n",
- $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
- }
+ } catch (PDOException $e) {
+ printf("[003] %s [%s] %s\n",
+ $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_errorcode.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_errorcode.phpt
index f77ba60f75..cfd30a635d 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_stmt_errorcode.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_errorcode.phpt
@@ -9,43 +9,43 @@ $db = MySQLPDOTest::factory();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
- $db->exec('DROP TABLE IF EXISTS ihopeitdoesnotexist');
+ $db->exec('DROP TABLE IF EXISTS ihopeitdoesnotexist');
- printf("Testing emulated PS...\n");
- try {
- $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1);
- if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
- printf("[002] Unable to turn on emulated prepared statements\n");
+ printf("Testing emulated PS...\n");
+ try {
+ $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1);
+ if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
+ printf("[002] Unable to turn on emulated prepared statements\n");
- $stmt = $db->prepare('SELECT id FROM ihopeitdoesnotexist ORDER BY id ASC');
- $stmt->execute();
- var_dump($stmt->errorCode());
+ $stmt = $db->prepare('SELECT id FROM ihopeitdoesnotexist ORDER BY id ASC');
+ $stmt->execute();
+ var_dump($stmt->errorCode());
- } catch (PDOException $e) {
- printf("[001] %s [%s] %s\n",
- $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
- }
+ } catch (PDOException $e) {
+ printf("[001] %s [%s] %s\n",
+ $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
- printf("Testing native PS...\n");
- try {
- $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
- if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
- printf("[004] Unable to turn off emulated prepared statements\n");
+ printf("Testing native PS...\n");
+ try {
+ $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
+ if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
+ printf("[004] Unable to turn off emulated prepared statements\n");
- $stmt = $db->prepare('SELECT id FROM ihopeitdoesnotexist ORDER BY id ASC');
- $stmt->execute();
- var_dump($stmt->errorCode());
+ $stmt = $db->prepare('SELECT id FROM ihopeitdoesnotexist ORDER BY id ASC');
+ $stmt->execute();
+ var_dump($stmt->errorCode());
- } catch (PDOException $e) {
- printf("[003] %s [%s] %s\n",
- $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
- }
+ } catch (PDOException $e) {
+ printf("[003] %s [%s] %s\n",
+ $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
- print "done!";
+ print "done!";
?>
--EXPECTF--
Testing emulated PS...
diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_errorinfo.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_errorinfo.phpt
index e9dbeab3a6..b876628e25 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_stmt_errorinfo.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_errorinfo.phpt
@@ -9,55 +9,55 @@ $db = MySQLPDOTest::factory();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
- MySQLPDOTest::createTestTable($db);
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
+ MySQLPDOTest::createTestTable($db);
- printf("Testing emulated PS...\n");
- try {
- $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1);
- if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
- printf("[002] Unable to turn on emulated prepared statements\n");
+ printf("Testing emulated PS...\n");
+ try {
+ $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1);
+ if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
+ printf("[002] Unable to turn on emulated prepared statements\n");
- $stmt = $db->prepare('SELECT id FROM ihopeitdoesnotexist ORDER BY id ASC');
- var_dump($stmt->errorInfo());
- $stmt->execute();
- var_dump($stmt->errorInfo());
+ $stmt = $db->prepare('SELECT id FROM ihopeitdoesnotexist ORDER BY id ASC');
+ var_dump($stmt->errorInfo());
+ $stmt->execute();
+ var_dump($stmt->errorInfo());
- MySQLPDOTest::createTestTable($db);
- $stmt = $db->prepare('SELECT label FROM test ORDER BY id ASC LIMIT 1');
- $db->exec('DROP TABLE test');
- var_dump($stmt->execute());
- var_dump($stmt->errorInfo());
- var_dump($db->errorInfo());
+ MySQLPDOTest::createTestTable($db);
+ $stmt = $db->prepare('SELECT label FROM test ORDER BY id ASC LIMIT 1');
+ $db->exec('DROP TABLE test');
+ var_dump($stmt->execute());
+ var_dump($stmt->errorInfo());
+ var_dump($db->errorInfo());
- } catch (PDOException $e) {
- printf("[001] %s [%s] %s\n",
- $e->getMessage(), $db->errorInfo(), implode(' ', $db->errorInfo()));
- }
+ } catch (PDOException $e) {
+ printf("[001] %s [%s] %s\n",
+ $e->getMessage(), $db->errorInfo(), implode(' ', $db->errorInfo()));
+ }
- printf("Testing native PS...\n");
- try {
- $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
- if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
- printf("[004] Unable to turn off emulated prepared statements\n");
+ printf("Testing native PS...\n");
+ try {
+ $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
+ if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
+ printf("[004] Unable to turn off emulated prepared statements\n");
- $stmt = $db->prepare('SELECT id FROM ihopeitdoesnotexist ORDER BY id ASC');
- var_dump($stmt);
+ $stmt = $db->prepare('SELECT id FROM ihopeitdoesnotexist ORDER BY id ASC');
+ var_dump($stmt);
- MySQLPDOTest::createTestTable($db);
- $stmt = $db->prepare('SELECT label FROM test ORDER BY id ASC LIMIT 1');
- var_dump($stmt->errorInfo());
- $db->exec('DROP TABLE test');
- $stmt->execute();
- var_dump($stmt->errorInfo());
- var_dump($db->errorInfo());
+ MySQLPDOTest::createTestTable($db);
+ $stmt = $db->prepare('SELECT label FROM test ORDER BY id ASC LIMIT 1');
+ var_dump($stmt->errorInfo());
+ $db->exec('DROP TABLE test');
+ $stmt->execute();
+ var_dump($stmt->errorInfo());
+ var_dump($db->errorInfo());
- } catch (PDOException $e) {
- printf("[003] %s [%s] %s\n",
- $e->getMessage(), $db->errorInfo(), implode(' ', $db->errorInfo()));
- }
- print "done!";
+ } catch (PDOException $e) {
+ printf("[003] %s [%s] %s\n",
+ $e->getMessage(), $db->errorInfo(), implode(' ', $db->errorInfo()));
+ }
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_non_select.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_non_select.phpt
index 46ab4f911c..8e414a6c16 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_non_select.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_non_select.phpt
@@ -8,179 +8,179 @@ MySQLPDOTest::skip();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
- MySQLPDOTest::createTestTable($db);
-
- try {
-
- // Emulated PS first
- $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1);
- if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
- printf("[002] Unable to turn on emulated prepared statements\n");
-
- if (!is_object($stmt = $db->query('DESCRIBE test id')))
- printf("[003] Emulated PS, DESCRIBE failed, %s\n", var_export($db->errorInfo(), true));
-
- $describe = array();
- $valid = false;
- while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
- $describe[] = $row;
- foreach ($row as $column => $value)
- if (isset($row['field']) && ($row['field'] == 'id'))
- $valid = true;
- }
- if (empty($describe))
- printf("[004] Emulated PS, DESCRIBE returned no results\n");
- else if (!$valid)
- printf("[005] Emulated PS, DESCRIBE, returned data seems wrong, dumping %s\n",
- var_export($describe, true));
-
- if (!is_object($stmt = $db->query('SHOW ENGINES')))
- printf("[006] Emulated PS, SHOW failed, %s\n", var_export($db->errorInfo(), true));
-
- $show = array();
- $valid = false;
- while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
- $show[] = $row;
- foreach ($row as $column => $value)
- // MyISAM engine should be part of _every_ MySQL today
- if ($value == 'MyISAM')
- $valid = true;
- }
- if (empty($show))
- printf("[007] Emulated PS, SHOW returned no results\n");
- else if (!$valid)
- printf("[008] Emulated PS, SHOW data seems wrong, dumping %s\n",
- var_export($show, true));
-
- if (!is_object($stmt = $db->query("EXPLAIN SELECT id FROM test")))
- printf("[009] Emulated PS, EXPLAIN returned no results\n");
-
- $explain = array();
- while ($row = $stmt->fetch(PDO::FETCH_ASSOC))
- $explain[] = $row;
-
- if (empty($explain))
- printf("[010] Emulated PS, EXPLAIN returned no results\n");
-
- // And now native PS
- $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
- if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
- printf("[011] Unable to turn off emulated prepared statements\n");
-
- $native_support = 'no';
- if ($db->exec("PREPARE mystmt FROM 'DESCRIBE test id'")) {
- $native_support = 'yes';
- $db->exec('DEALLOCATE PREPARE mystmt');
- }
-
- if (!is_object($stmt = $db->query('DESCRIBE test id')))
- printf("[012] Native PS (native support: %s), DESCRIBE failed, %s\n",
- $native_support,
- var_export($db->errorInfo(), true));
-
- $describe_native = array();
- $valid = false;
- while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
- $describe_native[] = $row;
- foreach ($row as $column => $value)
- if (isset($row['field']) && ($row['field'] == 'id'))
- $valid = true;
- }
- if (empty($describe_native))
- printf("[013] Native PS (native support: %s), DESCRIBE returned no results\n",
- $native_support);
- else if (!$valid)
- printf("[014] Native PS (native support: %s), DESCRIBE, returned data seems wrong, dumping %s\n",
- $native_support,
- var_export($describe_native, true));
-
- if ($describe != $describe_native)
- printf("[015] Emulated and native PS (native support: %s) results of DESCRIBE differ: %s vs. %s\n",
- $native_support,
- var_export($describe, true),
- var_export($describe_native, true));
-
-
- $native_support = 'no';
- if ($db->exec("PREPARE mystmt FROM 'SHOW ENGINES'")) {
- $native_support = 'yes';
- $db->exec('DEALLOCATE PREPARE mystmt');
- }
-
- if (!is_object($stmt = $db->query('SHOW ENGINES')))
- printf("[016] Native PS (native support: %s), SHOW failed, %s\n",
- $native_support,
- var_export($db->errorInfo(), true));
-
- $show_native = array();
- $valid = false;
- while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
- $show_native[] = $row;
- foreach ($row as $column => $value)
- // MyISAM engine should be part of _every_ MySQL today
- if ($value == 'MyISAM')
- $valid = true;
- }
- if (empty($show_native))
- printf("[017] Native PS (native support: %s), SHOW returned no results\n",
- $native_support);
- else if (!$valid)
- printf("[018] Native PS (native support: %s), SHOW data seems wrong, dumping %s\n",
- var_export($show_native, true));
-
- if ($show != $show_native)
- printf("Native PS (native support: %s) and emulated PS returned different data for SHOW: %s vs. %s\n",
- $native_support,
- var_export($show, true),
- var_export($show_native, true));
-
- $native_support = 'no';
- if ($db->exec("PREPARE mystmt FROM 'EXPLAIN SELECT id FROM test'")) {
- $native_support = 'yes';
- $db->exec('DEALLOCATE PREPARE mystmt');
- }
-
- if (!is_object($stmt = $db->query("EXPLAIN SELECT id FROM test")))
- printf("[012] Native PS (native support: %s), EXPLAIN failed, %s\n",
- $native_support,
- var_export($db->errorInfo(), true));
-
- $explain_native = array();
- while ($row = $stmt->fetch(PDO::FETCH_ASSOC))
- $explain_native[] = $row;
-
- if (empty($explain_native))
- printf("[013] Native PS (native support: %s), EXPLAIN returned no results\n",
- $native_support);
-
- if ($explain != $explain_native)
- printf("Native PS (native support: %s) and emulated PS returned different data for EXPLAIN: %s vs. %s\n",
- $native_support,
- var_export($explain, true),
- var_export($explain_native, true));
-
- $stmt->execute();
- $explain_native = $stmt->fetchAll(PDO::FETCH_ASSOC);
- if ($explain != $explain_native)
- printf("Native PS (native support: %s) and emulated PS returned different data for EXPLAIN: %s vs. %s\n",
- $native_support,
- var_export($explain, true),
- var_export($explain_native, true));
-
- $stmt->execute();
- $stmt->execute();
- // libmysql needs this - otherwise we get a 2015 error
- if (!MYSQLPDOTest::isPDOMySQLnd())
- $stmt->fetchAll(PDO::FETCH_ASSOC);
-
- } catch (PDOException $e) {
- printf("[001] %s [%s] %s\n",
- $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
- }
-
- print "done!\n";
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
+ MySQLPDOTest::createTestTable($db);
+
+ try {
+
+ // Emulated PS first
+ $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 1);
+ if (1 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
+ printf("[002] Unable to turn on emulated prepared statements\n");
+
+ if (!is_object($stmt = $db->query('DESCRIBE test id')))
+ printf("[003] Emulated PS, DESCRIBE failed, %s\n", var_export($db->errorInfo(), true));
+
+ $describe = array();
+ $valid = false;
+ while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
+ $describe[] = $row;
+ foreach ($row as $column => $value)
+ if (isset($row['field']) && ($row['field'] == 'id'))
+ $valid = true;
+ }
+ if (empty($describe))
+ printf("[004] Emulated PS, DESCRIBE returned no results\n");
+ else if (!$valid)
+ printf("[005] Emulated PS, DESCRIBE, returned data seems wrong, dumping %s\n",
+ var_export($describe, true));
+
+ if (!is_object($stmt = $db->query('SHOW ENGINES')))
+ printf("[006] Emulated PS, SHOW failed, %s\n", var_export($db->errorInfo(), true));
+
+ $show = array();
+ $valid = false;
+ while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
+ $show[] = $row;
+ foreach ($row as $column => $value)
+ // MyISAM engine should be part of _every_ MySQL today
+ if ($value == 'MyISAM')
+ $valid = true;
+ }
+ if (empty($show))
+ printf("[007] Emulated PS, SHOW returned no results\n");
+ else if (!$valid)
+ printf("[008] Emulated PS, SHOW data seems wrong, dumping %s\n",
+ var_export($show, true));
+
+ if (!is_object($stmt = $db->query("EXPLAIN SELECT id FROM test")))
+ printf("[009] Emulated PS, EXPLAIN returned no results\n");
+
+ $explain = array();
+ while ($row = $stmt->fetch(PDO::FETCH_ASSOC))
+ $explain[] = $row;
+
+ if (empty($explain))
+ printf("[010] Emulated PS, EXPLAIN returned no results\n");
+
+ // And now native PS
+ $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
+ if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
+ printf("[011] Unable to turn off emulated prepared statements\n");
+
+ $native_support = 'no';
+ if ($db->exec("PREPARE mystmt FROM 'DESCRIBE test id'")) {
+ $native_support = 'yes';
+ $db->exec('DEALLOCATE PREPARE mystmt');
+ }
+
+ if (!is_object($stmt = $db->query('DESCRIBE test id')))
+ printf("[012] Native PS (native support: %s), DESCRIBE failed, %s\n",
+ $native_support,
+ var_export($db->errorInfo(), true));
+
+ $describe_native = array();
+ $valid = false;
+ while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
+ $describe_native[] = $row;
+ foreach ($row as $column => $value)
+ if (isset($row['field']) && ($row['field'] == 'id'))
+ $valid = true;
+ }
+ if (empty($describe_native))
+ printf("[013] Native PS (native support: %s), DESCRIBE returned no results\n",
+ $native_support);
+ else if (!$valid)
+ printf("[014] Native PS (native support: %s), DESCRIBE, returned data seems wrong, dumping %s\n",
+ $native_support,
+ var_export($describe_native, true));
+
+ if ($describe != $describe_native)
+ printf("[015] Emulated and native PS (native support: %s) results of DESCRIBE differ: %s vs. %s\n",
+ $native_support,
+ var_export($describe, true),
+ var_export($describe_native, true));
+
+
+ $native_support = 'no';
+ if ($db->exec("PREPARE mystmt FROM 'SHOW ENGINES'")) {
+ $native_support = 'yes';
+ $db->exec('DEALLOCATE PREPARE mystmt');
+ }
+
+ if (!is_object($stmt = $db->query('SHOW ENGINES')))
+ printf("[016] Native PS (native support: %s), SHOW failed, %s\n",
+ $native_support,
+ var_export($db->errorInfo(), true));
+
+ $show_native = array();
+ $valid = false;
+ while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
+ $show_native[] = $row;
+ foreach ($row as $column => $value)
+ // MyISAM engine should be part of _every_ MySQL today
+ if ($value == 'MyISAM')
+ $valid = true;
+ }
+ if (empty($show_native))
+ printf("[017] Native PS (native support: %s), SHOW returned no results\n",
+ $native_support);
+ else if (!$valid)
+ printf("[018] Native PS (native support: %s), SHOW data seems wrong, dumping %s\n",
+ var_export($show_native, true));
+
+ if ($show != $show_native)
+ printf("Native PS (native support: %s) and emulated PS returned different data for SHOW: %s vs. %s\n",
+ $native_support,
+ var_export($show, true),
+ var_export($show_native, true));
+
+ $native_support = 'no';
+ if ($db->exec("PREPARE mystmt FROM 'EXPLAIN SELECT id FROM test'")) {
+ $native_support = 'yes';
+ $db->exec('DEALLOCATE PREPARE mystmt');
+ }
+
+ if (!is_object($stmt = $db->query("EXPLAIN SELECT id FROM test")))
+ printf("[012] Native PS (native support: %s), EXPLAIN failed, %s\n",
+ $native_support,
+ var_export($db->errorInfo(), true));
+
+ $explain_native = array();
+ while ($row = $stmt->fetch(PDO::FETCH_ASSOC))
+ $explain_native[] = $row;
+
+ if (empty($explain_native))
+ printf("[013] Native PS (native support: %s), EXPLAIN returned no results\n",
+ $native_support);
+
+ if ($explain != $explain_native)
+ printf("Native PS (native support: %s) and emulated PS returned different data for EXPLAIN: %s vs. %s\n",
+ $native_support,
+ var_export($explain, true),
+ var_export($explain_native, true));
+
+ $stmt->execute();
+ $explain_native = $stmt->fetchAll(PDO::FETCH_ASSOC);
+ if ($explain != $explain_native)
+ printf("Native PS (native support: %s) and emulated PS returned different data for EXPLAIN: %s vs. %s\n",
+ $native_support,
+ var_export($explain, true),
+ var_export($explain_native, true));
+
+ $stmt->execute();
+ $stmt->execute();
+ // libmysql needs this - otherwise we get a 2015 error
+ if (!MYSQLPDOTest::isPDOMySQLnd())
+ $stmt->fetchAll(PDO::FETCH_ASSOC);
+
+ } catch (PDOException $e) {
+ printf("[001] %s [%s] %s\n",
+ $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
+
+ print "done!\n";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize.phpt
index 37dda2c0f5..d1c00f1aa3 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize.phpt
@@ -8,110 +8,110 @@ MySQLPDOTest::skip();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
- try {
-
- class myclass implements Serializable {
-
- private static $instance = null;
- protected $myprotected = 'a protected propery';
-
- // Good old magic stuff
- private function __construct($caller = NULL) {
- printf("%s(%s)\n", __METHOD__, $caller);
- }
-
-
- public function __destruct() {
- // printf("%s()\n", __METHOD__);
- }
-
- public function __sleep() {
- printf("%s()\n", __METHOD__);
- }
-
- public function __wakeup() {
- printf("%s()\n", __METHOD__);
- }
-
- public function __call($method, $params) {
- printf("%s(%s, %s)\n", __METHOD__, $method, var_export($params, true));
- }
-
- public function __set($prop, $value) {
- printf("%s(%s, %s)\n", __METHOD__, $prop, var_export($value, true));
- $this->{$prop} = $value;
- }
-
- public function __get($prop) {
- printf("%s(%s)\n", __METHOD__, $prop);
- return NULL;
- }
-
- // Singleton
- public static function singleton($caller) {
- printf("%s(%s)\n", __METHOD__, $caller);
-
- if (!self::$instance) {
- $c = __CLASS__;
- self::$instance = new $c($caller);
- }
- return self::$instance;
- }
-
- // Serializable
- public function serialize() {
- printf("%s()\n", __METHOD__);
- return 'Data from serialize';
- }
-
- public function unserialize($data) {
- printf("%s(%s)\n", __METHOD__, var_export($data, true));
- }
-
- }
-
- $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
- if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
- printf("[002] Unable to turn off emulated prepared statements\n");
-
- $db->exec('DROP TABLE IF EXISTS test');
- $db->exec(sprintf('CREATE TABLE test(id INT, myobj BLOB) ENGINE=%s',
- MySQLPDOTest::getTableEngine()));
-
- printf("Creating an object, serializing it and writing it to DB...\n");
- $id = 1;
- $obj = myclass::singleton('Creating object');
- $myobj = serialize($obj);
- $stmt = $db->prepare('INSERT INTO test(id, myobj) VALUES (?, ?)');
- $stmt->bindValue(1, $id);
- $stmt->bindValue(2, $myobj);
- $stmt->execute();
-
- printf("\nUnserializing the previously serialized object...\n");
- var_dump(unserialize($myobj));
-
- printf("\nUsing PDO::FETCH_CLASS|PDO::FETCH_SERIALIZE to fetch the object from DB and unserialize it...\n");
- $stmt = $db->prepare('SELECT myobj FROM test');
- $stmt->setFetchMode(PDO::FETCH_CLASS|PDO::FETCH_SERIALIZE, 'myclass', array('PDO shall not call __construct()'));
- $stmt->execute();
- var_dump($stmt->fetch());
-
- printf("\nUsing PDO::FETCH_CLASS to fetch the object from DB and unserialize it...\n");
- $stmt = $db->prepare('SELECT myobj FROM test');
- $stmt->setFetchMode(PDO::FETCH_CLASS, 'myclass', array('PDO shall call __construct()'));
- $stmt->execute();
- var_dump($stmt->fetch());
-
-
- } catch (PDOException $e) {
- printf("[001] %s [%s] %s\n",
- $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
- }
+ try {
+
+ class myclass implements Serializable {
+
+ private static $instance = null;
+ protected $myprotected = 'a protected property';
+
+ // Good old magic stuff
+ private function __construct($caller = NULL) {
+ printf("%s(%s)\n", __METHOD__, $caller);
+ }
+
+
+ public function __destruct() {
+ // printf("%s()\n", __METHOD__);
+ }
+
+ public function __sleep() {
+ printf("%s()\n", __METHOD__);
+ }
+
+ public function __wakeup() {
+ printf("%s()\n", __METHOD__);
+ }
+
+ public function __call($method, $params) {
+ printf("%s(%s, %s)\n", __METHOD__, $method, var_export($params, true));
+ }
+
+ public function __set($prop, $value) {
+ printf("%s(%s, %s)\n", __METHOD__, $prop, var_export($value, true));
+ $this->{$prop} = $value;
+ }
+
+ public function __get($prop) {
+ printf("%s(%s)\n", __METHOD__, $prop);
+ return NULL;
+ }
+
+ // Singleton
+ public static function singleton($caller) {
+ printf("%s(%s)\n", __METHOD__, $caller);
+
+ if (!self::$instance) {
+ $c = __CLASS__;
+ self::$instance = new $c($caller);
+ }
+ return self::$instance;
+ }
+
+ // Serializable
+ public function serialize() {
+ printf("%s()\n", __METHOD__);
+ return 'Data from serialize';
+ }
+
+ public function unserialize($data) {
+ printf("%s(%s)\n", __METHOD__, var_export($data, true));
+ }
+
+ }
+
+ $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
+ if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
+ printf("[002] Unable to turn off emulated prepared statements\n");
+
+ $db->exec('DROP TABLE IF EXISTS test');
+ $db->exec(sprintf('CREATE TABLE test(id INT, myobj BLOB) ENGINE=%s',
+ MySQLPDOTest::getTableEngine()));
+
+ printf("Creating an object, serializing it and writing it to DB...\n");
+ $id = 1;
+ $obj = myclass::singleton('Creating object');
+ $myobj = serialize($obj);
+ $stmt = $db->prepare('INSERT INTO test(id, myobj) VALUES (?, ?)');
+ $stmt->bindValue(1, $id);
+ $stmt->bindValue(2, $myobj);
+ $stmt->execute();
+
+ printf("\nUnserializing the previously serialized object...\n");
+ var_dump(unserialize($myobj));
+
+ printf("\nUsing PDO::FETCH_CLASS|PDO::FETCH_SERIALIZE to fetch the object from DB and unserialize it...\n");
+ $stmt = $db->prepare('SELECT myobj FROM test');
+ $stmt->setFetchMode(PDO::FETCH_CLASS|PDO::FETCH_SERIALIZE, 'myclass', array('PDO shall not call __construct()'));
+ $stmt->execute();
+ var_dump($stmt->fetch());
+
+ printf("\nUsing PDO::FETCH_CLASS to fetch the object from DB and unserialize it...\n");
+ $stmt = $db->prepare('SELECT myobj FROM test');
+ $stmt->setFetchMode(PDO::FETCH_CLASS, 'myclass', array('PDO shall call __construct()'));
+ $stmt->execute();
+ var_dump($stmt->fetch());
+
+
+ } catch (PDOException $e) {
+ printf("[001] %s [%s] %s\n",
+ $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
- print "done!\n";
+ print "done!\n";
?>
--CLEAN--
<?php
@@ -129,14 +129,14 @@ Unserializing the previously serialized object...
myclass::unserialize('Data from serialize')
object(myclass)#4 (1) {
["myprotected":protected]=>
- string(19) "a protected propery"
+ string(20) "a protected property"
}
Using PDO::FETCH_CLASS|PDO::FETCH_SERIALIZE to fetch the object from DB and unserialize it...
myclass::unserialize('C:7:"myclass":19:{Data from serialize}')
object(myclass)#%d (1) {
["myprotected":protected]=>
- string(19) "a protected propery"
+ string(20) "a protected property"
}
Using PDO::FETCH_CLASS to fetch the object from DB and unserialize it...
@@ -144,7 +144,7 @@ myclass::__set(myobj, 'C:7:"myclass":19:{Data from serialize}')
myclass::__construct(PDO shall call __construct())
object(myclass)#%d (2) {
["myprotected":protected]=>
- string(19) "a protected propery"
+ string(20) "a protected property"
["myobj"]=>
string(38) "C:7:"myclass":19:{Data from serialize}"
}
diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize_simple.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize_simple.phpt
index bfc907dbcb..07c9205796 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize_simple.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize_simple.phpt
@@ -8,65 +8,65 @@ MySQLPDOTest::skip();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
- try {
+ try {
- class myclass implements Serializable {
+ class myclass implements Serializable {
- public function __construct($caller = null) {
- printf("%s(%s) - note that it must not be called when unserializing\n", __METHOD__, var_export($caller, true));
- }
+ public function __construct($caller = null) {
+ printf("%s(%s) - note that it must not be called when unserializing\n", __METHOD__, var_export($caller, true));
+ }
- public function __set($prop, $value) {
- printf("%s(%s, %s)\n", __METHOD__, var_export($prop, true), var_export($value, true));
- $this->{$prop} = $value;
- }
+ public function __set($prop, $value) {
+ printf("%s(%s, %s)\n", __METHOD__, var_export($prop, true), var_export($value, true));
+ $this->{$prop} = $value;
+ }
- public function serialize() {
- printf("%s()\n", __METHOD__);
- return 'Value from serialize()';
- }
+ public function serialize() {
+ printf("%s()\n", __METHOD__);
+ return 'Value from serialize()';
+ }
- public function unserialize($data) {
- printf("%s(%s)\n", __METHOD__, var_export($data, true));
- }
+ public function unserialize($data) {
+ printf("%s(%s)\n", __METHOD__, var_export($data, true));
+ }
- }
+ }
- printf("Lets see what the Serializeable interface makes our object behave like...\n");
- $obj = new myclass('Called by script');
- $tmp = unserialize(serialize($obj));
- var_dump($tmp);
+ printf("Lets see what the Serializeable interface makes our object behave like...\n");
+ $obj = new myclass('Called by script');
+ $tmp = unserialize(serialize($obj));
+ var_dump($tmp);
- printf("\nAnd now magic PDO using fetchAll(PDO::FETCH_CLASS|PDO::FETCH_SERIALIZE)...\n");
- $db->exec('DROP TABLE IF EXISTS test');
- $db->exec(sprintf('CREATE TABLE test(myobj BLOB) ENGINE=%s', MySQLPDOTest::getTableEngine()));
- $db->exec("INSERT INTO test(myobj) VALUES ('Data fetched from DB to be given to unserialize()')");
+ printf("\nAnd now magic PDO using fetchAll(PDO::FETCH_CLASS|PDO::FETCH_SERIALIZE)...\n");
+ $db->exec('DROP TABLE IF EXISTS test');
+ $db->exec(sprintf('CREATE TABLE test(myobj BLOB) ENGINE=%s', MySQLPDOTest::getTableEngine()));
+ $db->exec("INSERT INTO test(myobj) VALUES ('Data fetched from DB to be given to unserialize()')");
- $stmt = $db->prepare('SELECT myobj FROM test');
- $stmt->execute();
- $rows = $stmt->fetchAll(PDO::FETCH_CLASS|PDO::FETCH_SERIALIZE, 'myclass', array('Called by PDO'));
- var_dump($rows[0]);
+ $stmt = $db->prepare('SELECT myobj FROM test');
+ $stmt->execute();
+ $rows = $stmt->fetchAll(PDO::FETCH_CLASS|PDO::FETCH_SERIALIZE, 'myclass', array('Called by PDO'));
+ var_dump($rows[0]);
- $stmt->execute();
- $rows = $stmt->fetchAll(PDO::FETCH_CLASS|PDO::FETCH_SERIALIZE, 'myclass');
- var_dump($rows[0]);
+ $stmt->execute();
+ $rows = $stmt->fetchAll(PDO::FETCH_CLASS|PDO::FETCH_SERIALIZE, 'myclass');
+ var_dump($rows[0]);
- printf("\nAnd now PDO using setFetchMode(PDO::FETCH:CLASS|PDO::FETCH_SERIALIZE) + fetch()...\n");
- $stmt = $db->prepare('SELECT myobj FROM test');
- $stmt->setFetchMode(PDO::FETCH_CLASS|PDO::FETCH_SERIALIZE, 'myclass', array('Called by PDO'));
- $stmt->execute();
- var_dump($stmt->fetch());
+ printf("\nAnd now PDO using setFetchMode(PDO::FETCH:CLASS|PDO::FETCH_SERIALIZE) + fetch()...\n");
+ $stmt = $db->prepare('SELECT myobj FROM test');
+ $stmt->setFetchMode(PDO::FETCH_CLASS|PDO::FETCH_SERIALIZE, 'myclass', array('Called by PDO'));
+ $stmt->execute();
+ var_dump($stmt->fetch());
- } catch (PDOException $e) {
- printf("[001] %s [%s] %s\n",
- $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
- }
+ } catch (PDOException $e) {
+ printf("[001] %s [%s] %s\n",
+ $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
- $db->exec('DROP TABLE IF EXISTS test');
- print "done!\n";
+ $db->exec('DROP TABLE IF EXISTS test');
+ print "done!\n";
?>
--EXPECTF--
Lets see what the Serializeable interface makes our object behave like...
diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_fetchobject.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_fetchobject.phpt
index ae14c056f3..9760682358 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_stmt_fetchobject.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_fetchobject.phpt
@@ -25,52 +25,52 @@ MySQLPDOTest::createTestTable($db);
try {
- $query = "SELECT id, '', NULL, \"\" FROM test ORDER BY id ASC LIMIT 3";
- $stmt = $db->prepare($query);
+ $query = "SELECT id, '', NULL, \"\" FROM test ORDER BY id ASC LIMIT 3";
+ $stmt = $db->prepare($query);
- class myclass {
+ class myclass {
- private $set_calls = 0;
- protected static $static_set_calls = 0;
+ private $set_calls = 0;
+ protected static $static_set_calls = 0;
- // NOTE: PDO does not care about protected
- protected $grp;
+ // NOTE: PDO does not care about protected
+ protected $grp;
- // NOTE: PDO does not care about private and calls __construct() after __set()
- private function __construct($param1, $param2) {
- printf("myclass::__construct(%s, %s): %d / %d\n",
- $param1, $param2,
- self::$static_set_calls, $this->set_calls);
- }
+ // NOTE: PDO does not care about private and calls __construct() after __set()
+ private function __construct($param1, $param2) {
+ printf("myclass::__construct(%s, %s): %d / %d\n",
+ $param1, $param2,
+ self::$static_set_calls, $this->set_calls);
+ }
- // NOTE: PDO will call __set() prior to calling __construct()
- public function __set($prop, $value) {
- $this->not_a_magic_one();
- printf("myclass::__set(%s, -%s-) %d\n",
- $prop, var_export($value, true), $this->set_calls, self::$static_set_calls);
- if ("" != $prop)
- $this->{$prop} = $value;
- }
+ // NOTE: PDO will call __set() prior to calling __construct()
+ public function __set($prop, $value) {
+ $this->not_a_magic_one();
+ printf("myclass::__set(%s, -%s-) %d\n",
+ $prop, var_export($value, true), $this->set_calls, self::$static_set_calls);
+ if ("" != $prop)
+ $this->{$prop} = $value;
+ }
- // NOTE: PDO can call regular methods prior to calling __construct()
- public function not_a_magic_one() {
- $this->set_calls++;
- self::$static_set_calls++;
- }
+ // NOTE: PDO can call regular methods prior to calling __construct()
+ public function not_a_magic_one() {
+ $this->set_calls++;
+ self::$static_set_calls++;
+ }
- }
- $stmt->execute();
- $rowno = 0;
- $rows[] = array();
- while (is_object($rows[] = $stmt->fetchObject('myclass', array($rowno++, $rowno))))
- ;
+ }
+ $stmt->execute();
+ $rowno = 0;
+ $rows[] = array();
+ while (is_object($rows[] = $stmt->fetchObject('myclass', array($rowno++, $rowno))))
+ ;
- var_dump($rows[$rowno - 1]);
+ var_dump($rows[$rowno - 1]);
} catch (PDOException $e) {
- // we should never get here, we use warnings, but never trust a system...
- printf("[001] %s, [%s} %s\n",
- $e->getMessage(), $db->errorInfo(), implode(' ', $db->errorInfo()));
+ // we should never get here, we use warnings, but never trust a system...
+ printf("[001] %s, [%s} %s\n",
+ $e->getMessage(), $db->errorInfo(), implode(' ', $db->errorInfo()));
}
print "done!";
diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_getcolumnmeta.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_getcolumnmeta.phpt
index 529858fc2b..3526b35c24 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_stmt_getcolumnmeta.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_getcolumnmeta.phpt
@@ -22,288 +22,277 @@ MySQLPDOTest::createTestTable($db);
try {
- $stmt = $db->prepare('SELECT id FROM test ORDER BY id ASC');
-
- // execute() has not been called yet
- // NOTE: no warning
- if (false !== ($tmp = $stmt->getColumnMeta(0)))
- printf("[002] Expecting false got %s\n", var_export($tmp, true));
-
- $stmt->execute();
- // Warning: PDOStatement::getColumnMeta() expects exactly 1 parameter, 0 given in
- if (false !== ($tmp = @$stmt->getColumnMeta()))
- printf("[003] Expecting false got %s\n", var_export($tmp, true));
-
- // invalid offset
- if (false !== ($tmp = @$stmt->getColumnMeta(-1)))
- printf("[004] Expecting false got %s\n", var_export($tmp, true));
-
- // Warning: PDOStatement::getColumnMeta() expects parameter 1 to be int, array given in
- if (false !== ($tmp = @$stmt->getColumnMeta(array())))
- printf("[005] Expecting false got %s\n", var_export($tmp, true));
-
- // Warning: PDOStatement::getColumnMeta() expects exactly 1 parameter, 2 given in
- if (false !== ($tmp = @$stmt->getColumnMeta(1, 1)))
- printf("[006] Expecting false got %s\n", var_export($tmp, true));
-
- $emulated = $stmt->getColumnMeta(0);
-
- printf("Testing native PS...\n");
- $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
- if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
- printf("[007] Unable to turn off emulated prepared statements\n");
-
- $stmt = $db->prepare('SELECT id FROM test ORDER BY id ASC');
- $stmt->execute();
- $native = $stmt->getColumnMeta(0);
- if (count($native) == 0) {
- printf("[008] Meta data seems wrong, %s / %s\n",
- var_export($native, true), var_export($emulated, true));
- }
-
- // invalid offset
- if (false !== ($tmp = $stmt->getColumnMeta(1)))
- printf("[009] Expecting false because of invalid offset got %s\n", var_export($tmp, true));
-
-
- function test_meta(&$db, $offset, $sql_type, $value, $native_type, $pdo_type) {
-
- $db->exec('DROP TABLE IF EXISTS test');
-
- $sql = sprintf('CREATE TABLE test(id INT, label %s) ENGINE=%s', $sql_type, MySQLPDOTest::getTableEngine());
- if (!($stmt = @$db->prepare($sql)) || (!@$stmt->execute())) {
- // Some engines and/or MySQL server versions might not support the data type
- return true;
- }
-
- if (!$db->exec(sprintf("INSERT INTO test(id, label) VALUES (1, '%s')", $value))) {
- printf("[%03d] + 1] Insert failed, %d - %s\n", $offset,
- $db->errorCode(), var_export($db->errorInfo(), true));
- return false;
- }
-
- $stmt = $db->prepare('SELECT id, label FROM test');
- $stmt->execute();
- $meta = $stmt->getColumnMeta(1);
- $row = $stmt->fetch(PDO::FETCH_ASSOC);
-
- if (empty($meta)) {
- printf("[%03d + 2] getColumnMeta() failed, %d - %s\n", $offset,
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
- return false;
- }
-
- $elements = array('flags', 'table', 'name', 'len', 'precision', 'pdo_type');
- foreach ($elements as $k => $element)
- if (!isset($meta[$element])) {
- printf("[%03d + 3] Element %s missing, %s\n", $offset,
- $element, var_export($meta, true));
- return false;
- }
-
- if (($meta['table'] != 'test') || ($meta['name'] != 'label')) {
- printf("[%03d + 4] Table or field name is wrong, %s\n", $offset,
- var_export($meta, true));
- return false;
- }
-
- if (!is_null($native_type)) {
- if (!isset($meta['native_type'])) {
- printf("[%03d + 5] Element native_type missing, %s\n", $offset,
- var_export($meta, true));
- return false;
- }
-
- if (!is_array($native_type))
- $native_type = array($native_type);
-
- $found = false;
- foreach ($native_type as $k => $type) {
- if ($meta['native_type'] == $type) {
- $found = true;
- break;
- }
- }
-
- if (!$found) {
- printf("[%03d + 6] Expecting native type %s, %s\n", $offset,
- var_export($native_type, true), var_export($meta, true));
- return false;
- }
- }
-
- if (!is_null($pdo_type) && ($meta['pdo_type'] != $pdo_type)) {
- printf("[%03d + 6] Expecting PDO type %s got %s (%s)\n", $offset,
- $pdo_type, var_export($meta, true), var_export($meta['native_type']));
- return false;
- }
-
- return true;
- }
-
- $stmt = $db->prepare('SELECT @@sql_mode AS _mode');
- $stmt->execute();
- $row = $stmt->fetch(PDO::FETCH_ASSOC);
- $real_as_float = (false === stristr($row['_mode'], "REAL_AS_FLOAT")) ? false : true;
-
- $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false);
- $is_mysqlnd = MySQLPDOTest::isPDOMySQLnd();
- test_meta($db, 20, 'BIT(8)', 1, 'BIT', ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR);
- test_meta($db, 30, 'TINYINT', -127, 'TINY', ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR);
- test_meta($db, 40, 'TINYINT UNSIGNED', 255, 'TINY', ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR);
- test_meta($db, 50, 'BOOLEAN', 1, NULL, ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR);
-
- test_meta($db, 60, 'SMALLINT', -32768, 'SHORT', ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR);
- test_meta($db, 70, 'SMALLINT UNSIGNED', 65535, 'SHORT', ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR);
-
- test_meta($db, 80, 'MEDIUMINT', -8388608, 'INT24', ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR);
- test_meta($db, 90, 'MEDIUMINT UNSIGNED', 16777215, 'INT24', ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR);
-
- test_meta($db, 100, 'INT', -2147483648, 'LONG', ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR);
- test_meta($db, 110, 'INT UNSIGNED', 4294967295, 'LONG', ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR);
-
- test_meta($db, 120, 'BIGINT', '-9223372036854775808', 'LONGLONG', ($is_mysqlnd) ? ((PHP_INT_SIZE == 4) ? PDO::PARAM_STR : PDO::PARAM_INT) : PDO::PARAM_STR);
- test_meta($db, 130, 'BIGINT UNSIGNED', '18446744073709551615', 'LONGLONG', ($is_mysqlnd) ? ((PHP_INT_SIZE == 4) ? PDO::PARAM_STR : PDO::PARAM_INT) : PDO::PARAM_STR);
-
- test_meta($db, 130, 'REAL', -1.01, ($real_as_float) ? 'FLOAT' : 'DOUBLE', PDO::PARAM_STR);
- test_meta($db, 140, 'REAL UNSIGNED', 1.01, ($real_as_float) ? 'FLOAT' : 'DOUBLE', PDO::PARAM_STR);
- test_meta($db, 150, 'REAL ZEROFILL', 1.01, ($real_as_float) ? 'FLOAT' : 'DOUBLE', PDO::PARAM_STR);
- test_meta($db, 160, 'REAL UNSIGNED ZEROFILL', 1.01, ($real_as_float) ? 'FLOAT' : 'DOUBLE', PDO::PARAM_STR);
-
- test_meta($db, 170, 'DOUBLE', -1.01, 'DOUBLE', PDO::PARAM_STR);
- test_meta($db, 180, 'DOUBLE UNSIGNED', 1.01, 'DOUBLE', PDO::PARAM_STR);
- test_meta($db, 190, 'DOUBLE ZEROFILL', 1.01, 'DOUBLE', PDO::PARAM_STR);
- test_meta($db, 200, 'DOUBLE UNSIGNED ZEROFILL', 1.01, 'DOUBLE', PDO::PARAM_STR);
-
- test_meta($db, 210, 'FLOAT', -1.01, 'FLOAT', PDO::PARAM_STR);
- test_meta($db, 220, 'FLOAT UNSIGNED', 1.01, 'FLOAT', PDO::PARAM_STR);
- test_meta($db, 230, 'FLOAT ZEROFILL', 1.01, 'FLOAT', PDO::PARAM_STR);
- test_meta($db, 240, 'FLOAT UNSIGNED ZEROFILL', 1.01, 'FLOAT', PDO::PARAM_STR);
-
- test_meta($db, 250, 'DECIMAL', -1.01, array('DECIMAL', 'NEWDECIMAL'), PDO::PARAM_STR);
- test_meta($db, 260, 'DECIMAL UNSIGNED', 1.01, array('DECIMAL', 'NEWDECIMAL'), PDO::PARAM_STR);
- test_meta($db, 270, 'DECIMAL ZEROFILL', 1.01, array('DECIMAL', 'NEWDECIMAL'), PDO::PARAM_STR);
- test_meta($db, 280, 'DECIMAL UNSIGNED ZEROFILL', 1.01, array('DECIMAL', 'NEWDECIMAL'), PDO::PARAM_STR);
-
- test_meta($db, 290, 'NUMERIC', -1.01, array('DECIMAL', 'NEWDECIMAL'), PDO::PARAM_STR);
- test_meta($db, 300, 'NUMERIC UNSIGNED', 1.01, array('DECIMAL', 'NEWDECIMAL'), PDO::PARAM_STR);
- test_meta($db, 310, 'NUMERIC ZEROFILL', 1.01, array('DECIMAL', 'NEWDECIMAL'), PDO::PARAM_STR);
- test_meta($db, 320, 'NUMERIC UNSIGNED ZEROFILL', 1.01, array('DECIMAL', 'NEWDECIMAL'), PDO::PARAM_STR);
-
- test_meta($db, 330, 'DATE', '2008-04-23', array('DATE', 'NEWDATE'), PDO::PARAM_STR);
- test_meta($db, 340, 'TIME', '14:37:00', 'TIME', PDO::PARAM_STR);
- test_meta($db, 350, 'TIMESTAMP', '2008-03-23 14:38:00', 'TIMESTAMP', PDO::PARAM_STR);
- test_meta($db, 360, 'DATETIME', '2008-03-23 14:38:00', 'DATETIME', PDO::PARAM_STR);
- test_meta($db, 370, 'YEAR', '2008', 'YEAR', ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR);
-
- test_meta($db, 380, 'CHAR(1)', 'a', 'STRING', PDO::PARAM_STR);
- test_meta($db, 390, 'CHAR(10)', '0123456789', 'STRING', PDO::PARAM_STR);
- test_meta($db, 400, 'CHAR(255)', str_repeat('z', 255), 'STRING', PDO::PARAM_STR);
- test_meta($db, 410, 'VARCHAR(1)', 'a', 'VAR_STRING', PDO::PARAM_STR);
- test_meta($db, 420, 'VARCHAR(10)', '0123456789', 'VAR_STRING', PDO::PARAM_STR);
- test_meta($db, 430, 'VARCHAR(255)', str_repeat('z', 255), 'VAR_STRING', PDO::PARAM_STR);
-
- test_meta($db, 440, 'BINARY(1)', str_repeat('a', 1), 'STRING', PDO::PARAM_STR);
- test_meta($db, 450, 'BINARY(255)', str_repeat('b', 255), 'STRING', PDO::PARAM_STR);
- test_meta($db, 460, 'VARBINARY(1)', str_repeat('a', 1), 'VAR_STRING', PDO::PARAM_STR);
- test_meta($db, 470, 'VARBINARY(255)', str_repeat('b', 255), 'VAR_STRING', PDO::PARAM_STR);
-
- test_meta($db, 480, 'TINYBLOB', str_repeat('b', 255), 'BLOB', PDO::PARAM_STR);
- test_meta($db, 490, 'BLOB', str_repeat('b', 256), 'BLOB', PDO::PARAM_STR);
- test_meta($db, 500, 'MEDIUMBLOB', str_repeat('b', 256), 'BLOB', PDO::PARAM_STR);
- test_meta($db, 510, 'LONGBLOB', str_repeat('b', 256), 'BLOB', PDO::PARAM_STR);
-
- test_meta($db, 520, 'TINYTEXT', str_repeat('b', 255), 'BLOB', PDO::PARAM_STR);
- test_meta($db, 530, 'TINYTEXT BINARY', str_repeat('b', 255), 'BLOB', PDO::PARAM_STR);
-
- test_meta($db, 560, 'TEXT', str_repeat('b', 256), 'BLOB', PDO::PARAM_STR);
- test_meta($db, 570, 'TEXT BINARY', str_repeat('b', 256), 'BLOB', PDO::PARAM_STR);
-
- test_meta($db, 580, 'MEDIUMTEXT', str_repeat('b', 256), 'BLOB', PDO::PARAM_STR);
- test_meta($db, 590, 'MEDIUMTEXT BINARY', str_repeat('b', 256), 'BLOB', PDO::PARAM_STR);
-
- test_meta($db, 600, 'LONGTEXT', str_repeat('b', 256), 'BLOB', PDO::PARAM_STR);
- test_meta($db, 610, 'LONGTEXT BINARY', str_repeat('b', 256), 'BLOB', PDO::PARAM_STR);
-
- test_meta($db, 620, "ENUM('yes', 'no') DEFAULT 'yes'", 'no', NULL, PDO::PARAM_STR);
- test_meta($db, 630, "SET('yes', 'no') DEFAULT 'yes'", 'no', NULL, PDO::PARAM_STR);
+ $stmt = $db->prepare('SELECT id FROM test ORDER BY id ASC');
+
+ // execute() has not been called yet
+ // NOTE: no warning
+ if (false !== ($tmp = $stmt->getColumnMeta(0)))
+ printf("[002] Expecting false got %s\n", var_export($tmp, true));
+
+ $stmt->execute();
+
+ // invalid offset
+ if (false !== ($tmp = @$stmt->getColumnMeta(-1)))
+ printf("[004] Expecting false got %s\n", var_export($tmp, true));
+
+ $emulated = $stmt->getColumnMeta(0);
+
+ printf("Testing native PS...\n");
+ $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
+ if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
+ printf("[007] Unable to turn off emulated prepared statements\n");
+
+ $stmt = $db->prepare('SELECT id FROM test ORDER BY id ASC');
+ $stmt->execute();
+ $native = $stmt->getColumnMeta(0);
+ if (count($native) == 0) {
+ printf("[008] Meta data seems wrong, %s / %s\n",
+ var_export($native, true), var_export($emulated, true));
+ }
+
+ // invalid offset
+ if (false !== ($tmp = $stmt->getColumnMeta(1)))
+ printf("[009] Expecting false because of invalid offset got %s\n", var_export($tmp, true));
+
+
+ function test_meta(&$db, $offset, $sql_type, $value, $native_type, $pdo_type) {
+
+ $db->exec('DROP TABLE IF EXISTS test');
+
+ $sql = sprintf('CREATE TABLE test(id INT, label %s) ENGINE=%s', $sql_type, MySQLPDOTest::getTableEngine());
+ if (!($stmt = @$db->prepare($sql)) || (!@$stmt->execute())) {
+ // Some engines and/or MySQL server versions might not support the data type
+ return true;
+ }
+
+ if (!$db->exec(sprintf("INSERT INTO test(id, label) VALUES (1, '%s')", $value))) {
+ printf("[%03d] + 1] Insert failed, %d - %s\n", $offset,
+ $db->errorCode(), var_export($db->errorInfo(), true));
+ return false;
+ }
+
+ $stmt = $db->prepare('SELECT id, label FROM test');
+ $stmt->execute();
+ $meta = $stmt->getColumnMeta(1);
+ $row = $stmt->fetch(PDO::FETCH_ASSOC);
+
+ if (empty($meta)) {
+ printf("[%03d + 2] getColumnMeta() failed, %d - %s\n", $offset,
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+ return false;
+ }
+
+ $elements = array('flags', 'table', 'name', 'len', 'precision', 'pdo_type');
+ foreach ($elements as $k => $element)
+ if (!isset($meta[$element])) {
+ printf("[%03d + 3] Element %s missing, %s\n", $offset,
+ $element, var_export($meta, true));
+ return false;
+ }
+
+ if (($meta['table'] != 'test') || ($meta['name'] != 'label')) {
+ printf("[%03d + 4] Table or field name is wrong, %s\n", $offset,
+ var_export($meta, true));
+ return false;
+ }
+
+ if (!is_null($native_type)) {
+ if (!isset($meta['native_type'])) {
+ printf("[%03d + 5] Element native_type missing, %s\n", $offset,
+ var_export($meta, true));
+ return false;
+ }
+
+ if (!is_array($native_type))
+ $native_type = array($native_type);
+
+ $found = false;
+ foreach ($native_type as $k => $type) {
+ if ($meta['native_type'] == $type) {
+ $found = true;
+ break;
+ }
+ }
+
+ if (!$found) {
+ printf("[%03d + 6] Expecting native type %s, %s\n", $offset,
+ var_export($native_type, true), var_export($meta, true));
+ return false;
+ }
+ }
+
+ if (!is_null($pdo_type) && ($meta['pdo_type'] != $pdo_type)) {
+ printf("[%03d + 6] Expecting PDO type %s got %s (%s)\n", $offset,
+ $pdo_type, var_export($meta, true), var_export($meta['native_type']));
+ return false;
+ }
+
+ return true;
+ }
+
+ $stmt = $db->prepare('SELECT @@sql_mode AS _mode');
+ $stmt->execute();
+ $row = $stmt->fetch(PDO::FETCH_ASSOC);
+ $real_as_float = (false === stristr($row['_mode'], "REAL_AS_FLOAT")) ? false : true;
+
+ $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false);
+ $is_mysqlnd = MySQLPDOTest::isPDOMySQLnd();
+ test_meta($db, 20, 'BIT(8)', 1, 'BIT', ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR);
+ test_meta($db, 30, 'TINYINT', -127, 'TINY', ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR);
+ test_meta($db, 40, 'TINYINT UNSIGNED', 255, 'TINY', ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR);
+ test_meta($db, 50, 'BOOLEAN', 1, NULL, ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR);
+
+ test_meta($db, 60, 'SMALLINT', -32768, 'SHORT', ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR);
+ test_meta($db, 70, 'SMALLINT UNSIGNED', 65535, 'SHORT', ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR);
+
+ test_meta($db, 80, 'MEDIUMINT', -8388608, 'INT24', ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR);
+ test_meta($db, 90, 'MEDIUMINT UNSIGNED', 16777215, 'INT24', ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR);
+
+ test_meta($db, 100, 'INT', -2147483648, 'LONG', ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR);
+ test_meta($db, 110, 'INT UNSIGNED', 4294967295, 'LONG', ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR);
+
+ test_meta($db, 120, 'BIGINT', '-9223372036854775808', 'LONGLONG', ($is_mysqlnd) ? ((PHP_INT_SIZE == 4) ? PDO::PARAM_STR : PDO::PARAM_INT) : PDO::PARAM_STR);
+ test_meta($db, 130, 'BIGINT UNSIGNED', '18446744073709551615', 'LONGLONG', ($is_mysqlnd) ? ((PHP_INT_SIZE == 4) ? PDO::PARAM_STR : PDO::PARAM_INT) : PDO::PARAM_STR);
+
+ test_meta($db, 130, 'REAL', -1.01, ($real_as_float) ? 'FLOAT' : 'DOUBLE', PDO::PARAM_STR);
+ test_meta($db, 140, 'REAL UNSIGNED', 1.01, ($real_as_float) ? 'FLOAT' : 'DOUBLE', PDO::PARAM_STR);
+ test_meta($db, 150, 'REAL ZEROFILL', 1.01, ($real_as_float) ? 'FLOAT' : 'DOUBLE', PDO::PARAM_STR);
+ test_meta($db, 160, 'REAL UNSIGNED ZEROFILL', 1.01, ($real_as_float) ? 'FLOAT' : 'DOUBLE', PDO::PARAM_STR);
+
+ test_meta($db, 170, 'DOUBLE', -1.01, 'DOUBLE', PDO::PARAM_STR);
+ test_meta($db, 180, 'DOUBLE UNSIGNED', 1.01, 'DOUBLE', PDO::PARAM_STR);
+ test_meta($db, 190, 'DOUBLE ZEROFILL', 1.01, 'DOUBLE', PDO::PARAM_STR);
+ test_meta($db, 200, 'DOUBLE UNSIGNED ZEROFILL', 1.01, 'DOUBLE', PDO::PARAM_STR);
+
+ test_meta($db, 210, 'FLOAT', -1.01, 'FLOAT', PDO::PARAM_STR);
+ test_meta($db, 220, 'FLOAT UNSIGNED', 1.01, 'FLOAT', PDO::PARAM_STR);
+ test_meta($db, 230, 'FLOAT ZEROFILL', 1.01, 'FLOAT', PDO::PARAM_STR);
+ test_meta($db, 240, 'FLOAT UNSIGNED ZEROFILL', 1.01, 'FLOAT', PDO::PARAM_STR);
+
+ test_meta($db, 250, 'DECIMAL', -1.01, array('DECIMAL', 'NEWDECIMAL'), PDO::PARAM_STR);
+ test_meta($db, 260, 'DECIMAL UNSIGNED', 1.01, array('DECIMAL', 'NEWDECIMAL'), PDO::PARAM_STR);
+ test_meta($db, 270, 'DECIMAL ZEROFILL', 1.01, array('DECIMAL', 'NEWDECIMAL'), PDO::PARAM_STR);
+ test_meta($db, 280, 'DECIMAL UNSIGNED ZEROFILL', 1.01, array('DECIMAL', 'NEWDECIMAL'), PDO::PARAM_STR);
+
+ test_meta($db, 290, 'NUMERIC', -1.01, array('DECIMAL', 'NEWDECIMAL'), PDO::PARAM_STR);
+ test_meta($db, 300, 'NUMERIC UNSIGNED', 1.01, array('DECIMAL', 'NEWDECIMAL'), PDO::PARAM_STR);
+ test_meta($db, 310, 'NUMERIC ZEROFILL', 1.01, array('DECIMAL', 'NEWDECIMAL'), PDO::PARAM_STR);
+ test_meta($db, 320, 'NUMERIC UNSIGNED ZEROFILL', 1.01, array('DECIMAL', 'NEWDECIMAL'), PDO::PARAM_STR);
+
+ test_meta($db, 330, 'DATE', '2008-04-23', array('DATE', 'NEWDATE'), PDO::PARAM_STR);
+ test_meta($db, 340, 'TIME', '14:37:00', 'TIME', PDO::PARAM_STR);
+ test_meta($db, 350, 'TIMESTAMP', '2008-03-23 14:38:00', 'TIMESTAMP', PDO::PARAM_STR);
+ test_meta($db, 360, 'DATETIME', '2008-03-23 14:38:00', 'DATETIME', PDO::PARAM_STR);
+ test_meta($db, 370, 'YEAR', '2008', 'YEAR', ($is_mysqlnd) ? PDO::PARAM_INT : PDO::PARAM_STR);
+
+ test_meta($db, 380, 'CHAR(1)', 'a', 'STRING', PDO::PARAM_STR);
+ test_meta($db, 390, 'CHAR(10)', '0123456789', 'STRING', PDO::PARAM_STR);
+ test_meta($db, 400, 'CHAR(255)', str_repeat('z', 255), 'STRING', PDO::PARAM_STR);
+ test_meta($db, 410, 'VARCHAR(1)', 'a', 'VAR_STRING', PDO::PARAM_STR);
+ test_meta($db, 420, 'VARCHAR(10)', '0123456789', 'VAR_STRING', PDO::PARAM_STR);
+ test_meta($db, 430, 'VARCHAR(255)', str_repeat('z', 255), 'VAR_STRING', PDO::PARAM_STR);
+
+ test_meta($db, 440, 'BINARY(1)', str_repeat('a', 1), 'STRING', PDO::PARAM_STR);
+ test_meta($db, 450, 'BINARY(255)', str_repeat('b', 255), 'STRING', PDO::PARAM_STR);
+ test_meta($db, 460, 'VARBINARY(1)', str_repeat('a', 1), 'VAR_STRING', PDO::PARAM_STR);
+ test_meta($db, 470, 'VARBINARY(255)', str_repeat('b', 255), 'VAR_STRING', PDO::PARAM_STR);
+
+ test_meta($db, 480, 'TINYBLOB', str_repeat('b', 255), 'BLOB', PDO::PARAM_STR);
+ test_meta($db, 490, 'BLOB', str_repeat('b', 256), 'BLOB', PDO::PARAM_STR);
+ test_meta($db, 500, 'MEDIUMBLOB', str_repeat('b', 256), 'BLOB', PDO::PARAM_STR);
+ test_meta($db, 510, 'LONGBLOB', str_repeat('b', 256), 'BLOB', PDO::PARAM_STR);
+
+ test_meta($db, 520, 'TINYTEXT', str_repeat('b', 255), 'BLOB', PDO::PARAM_STR);
+ test_meta($db, 530, 'TINYTEXT BINARY', str_repeat('b', 255), 'BLOB', PDO::PARAM_STR);
+
+ test_meta($db, 560, 'TEXT', str_repeat('b', 256), 'BLOB', PDO::PARAM_STR);
+ test_meta($db, 570, 'TEXT BINARY', str_repeat('b', 256), 'BLOB', PDO::PARAM_STR);
+
+ test_meta($db, 580, 'MEDIUMTEXT', str_repeat('b', 256), 'BLOB', PDO::PARAM_STR);
+ test_meta($db, 590, 'MEDIUMTEXT BINARY', str_repeat('b', 256), 'BLOB', PDO::PARAM_STR);
+
+ test_meta($db, 600, 'LONGTEXT', str_repeat('b', 256), 'BLOB', PDO::PARAM_STR);
+ test_meta($db, 610, 'LONGTEXT BINARY', str_repeat('b', 256), 'BLOB', PDO::PARAM_STR);
+
+ test_meta($db, 620, "ENUM('yes', 'no') DEFAULT 'yes'", 'no', NULL, PDO::PARAM_STR);
+ test_meta($db, 630, "SET('yes', 'no') DEFAULT 'yes'", 'no', NULL, PDO::PARAM_STR);
/*
| spatial_type
*/
- // unique key
- $db->exec('DROP TABLE IF EXISTS test');
- $sql = sprintf('CREATE TABLE test(id INT, label INT UNIQUE) ENGINE = %s', MySQLPDOTest::getTableEngine());
- if (($stmt = @$db->prepare($sql)) && @$stmt->execute()) {
- $db->exec('INSERT INTO test(id, label) VALUES (1, 2)');
- $stmt = $db->query('SELECT id, label FROM test');
- $meta = $stmt->getColumnMeta(1);
- if (!isset($meta['flags'])) {
- printf("[1000] No flags contained in metadata %s\n", var_export($meta, true));
- } else {
- $flags = $meta['flags'];
- $found = false;
- foreach ($flags as $k => $flag) {
- if ($flag == 'unique_key')
- $found = true;
- }
- if (!$found)
- printf("[1001] Flags seem wrong %s\n", var_export($meta, true));
- }
- }
-
- // primary key
- $db->exec('DROP TABLE IF EXISTS test');
- $sql = sprintf('CREATE TABLE test(id INT PRIMARY KEY NOT NULL AUTO_INCREMENT) ENGINE = %s', MySQLPDOTest::getTableEngine());
- if (($stmt = @$db->prepare($sql)) && @$stmt->execute()) {
- $db->exec('INSERT INTO test(id) VALUES (1)');
- $stmt = $db->query('SELECT id FROM test');
- $meta = $stmt->getColumnMeta(0);
- if (!isset($meta['flags'])) {
- printf("[1002] No flags contained in metadata %s\n", var_export($meta, true));
- } else {
- $flags = $meta['flags'];
- $found = false;
- foreach ($flags as $k => $flag) {
- if ($flag == 'primary_key')
- $found = true;
- }
- if (!$found)
- printf("[1003] Flags seem wrong %s\n", var_export($meta, true));
- }
- }
-
- // multiple key
- $db->exec('DROP TABLE IF EXISTS test');
- $sql = sprintf('CREATE TABLE test(id INT, label1 INT, label2 INT, INDEX idx1(label1, label2)) ENGINE = %s', MySQLPDOTest::getTableEngine());
- if (($stmt = @$db->prepare($sql)) && @$stmt->execute()) {
- $db->exec('INSERT INTO test(id, label1, label2) VALUES (1, 2, 3)');
- $stmt = $db->query('SELECT id, label1, label2 FROM test');
- $meta = $stmt->getColumnMeta(1);
- if (!isset($meta['flags'])) {
- printf("[1004] No flags contained in metadata %s\n", var_export($meta, true));
- } else {
- $flags = $meta['flags'];
- $found = false;
- foreach ($flags as $k => $flag) {
- if ($flag == 'multiple_key')
- $found = true;
- }
- if (!$found)
- printf("[1005] Flags seem wrong %s\n", var_export($meta, true));
- }
- }
-
- $stmt = $db->query('SELECT NULL AS col1');
- $meta = $stmt->getColumnMeta(0);
- if ('NULL' !== $meta['native_type'])
- printf("[1006] Expecting NULL got %s\n", $meta['native_type']);
+ // unique key
+ $db->exec('DROP TABLE IF EXISTS test');
+ $sql = sprintf('CREATE TABLE test(id INT, label INT UNIQUE) ENGINE = %s', MySQLPDOTest::getTableEngine());
+ if (($stmt = @$db->prepare($sql)) && @$stmt->execute()) {
+ $db->exec('INSERT INTO test(id, label) VALUES (1, 2)');
+ $stmt = $db->query('SELECT id, label FROM test');
+ $meta = $stmt->getColumnMeta(1);
+ if (!isset($meta['flags'])) {
+ printf("[1000] No flags contained in metadata %s\n", var_export($meta, true));
+ } else {
+ $flags = $meta['flags'];
+ $found = false;
+ foreach ($flags as $k => $flag) {
+ if ($flag == 'unique_key')
+ $found = true;
+ }
+ if (!$found)
+ printf("[1001] Flags seem wrong %s\n", var_export($meta, true));
+ }
+ }
+
+ // primary key
+ $db->exec('DROP TABLE IF EXISTS test');
+ $sql = sprintf('CREATE TABLE test(id INT PRIMARY KEY NOT NULL AUTO_INCREMENT) ENGINE = %s', MySQLPDOTest::getTableEngine());
+ if (($stmt = @$db->prepare($sql)) && @$stmt->execute()) {
+ $db->exec('INSERT INTO test(id) VALUES (1)');
+ $stmt = $db->query('SELECT id FROM test');
+ $meta = $stmt->getColumnMeta(0);
+ if (!isset($meta['flags'])) {
+ printf("[1002] No flags contained in metadata %s\n", var_export($meta, true));
+ } else {
+ $flags = $meta['flags'];
+ $found = false;
+ foreach ($flags as $k => $flag) {
+ if ($flag == 'primary_key')
+ $found = true;
+ }
+ if (!$found)
+ printf("[1003] Flags seem wrong %s\n", var_export($meta, true));
+ }
+ }
+
+ // multiple key
+ $db->exec('DROP TABLE IF EXISTS test');
+ $sql = sprintf('CREATE TABLE test(id INT, label1 INT, label2 INT, INDEX idx1(label1, label2)) ENGINE = %s', MySQLPDOTest::getTableEngine());
+ if (($stmt = @$db->prepare($sql)) && @$stmt->execute()) {
+ $db->exec('INSERT INTO test(id, label1, label2) VALUES (1, 2, 3)');
+ $stmt = $db->query('SELECT id, label1, label2 FROM test');
+ $meta = $stmt->getColumnMeta(1);
+ if (!isset($meta['flags'])) {
+ printf("[1004] No flags contained in metadata %s\n", var_export($meta, true));
+ } else {
+ $flags = $meta['flags'];
+ $found = false;
+ foreach ($flags as $k => $flag) {
+ if ($flag == 'multiple_key')
+ $found = true;
+ }
+ if (!$found)
+ printf("[1005] Flags seem wrong %s\n", var_export($meta, true));
+ }
+ }
+
+ $stmt = $db->query('SELECT NULL AS col1');
+ $meta = $stmt->getColumnMeta(0);
+ if ('NULL' !== $meta['native_type'])
+ printf("[1006] Expecting NULL got %s\n", $meta['native_type']);
} catch (PDOException $e) {
- // we should never get here, we use warnings, but never trust a system...
- printf("[001] %s, [%s} %s\n",
- $e->getMessage(), $db->errorInfo(), implode(' ', $db->errorInfo()));
+ // we should never get here, we use warnings, but never trust a system...
+ printf("[001] %s, [%s} %s\n",
+ $e->getMessage(), $db->errorInfo(), implode(' ', $db->errorInfo()));
}
$db->exec('DROP TABLE IF EXISTS test');
diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_multiquery.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_multiquery.phpt
index 9e36714d54..7f4904d23b 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_stmt_multiquery.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_multiquery.phpt
@@ -8,48 +8,48 @@ MySQLPDOTest::skip();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- function mysql_stmt_multiquery_wrong_usage($db) {
+ function mysql_stmt_multiquery_wrong_usage($db) {
- $stmt = $db->query('SELECT label FROM test ORDER BY id ASC LIMIT 1; SELECT label FROM test ORDER BY id ASC LIMIT 1');
- var_dump($stmt->errorInfo());
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
- var_dump($stmt->errorInfo());
+ $stmt = $db->query('SELECT label FROM test ORDER BY id ASC LIMIT 1; SELECT label FROM test ORDER BY id ASC LIMIT 1');
+ var_dump($stmt->errorInfo());
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+ var_dump($stmt->errorInfo());
- }
+ }
- function mysql_stmt_multiquery_proper_usage($db) {
+ function mysql_stmt_multiquery_proper_usage($db) {
- $stmt = $db->query('SELECT label FROM test ORDER BY id ASC LIMIT 1; SELECT label FROM test ORDER BY id ASC LIMIT 1');
- do {
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
- } while ($stmt->nextRowset());
+ $stmt = $db->query('SELECT label FROM test ORDER BY id ASC LIMIT 1; SELECT label FROM test ORDER BY id ASC LIMIT 1');
+ do {
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+ } while ($stmt->nextRowset());
- }
+ }
- try {
+ try {
- printf("Emulated Prepared Statements...\n");
- $db = MySQLPDOTest::factory();
- MySQLPDOTest::createTestTable($db);
- $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1);
- mysql_stmt_multiquery_wrong_usage($db);
- mysql_stmt_multiquery_proper_usage($db);
+ printf("Emulated Prepared Statements...\n");
+ $db = MySQLPDOTest::factory();
+ MySQLPDOTest::createTestTable($db);
+ $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1);
+ mysql_stmt_multiquery_wrong_usage($db);
+ mysql_stmt_multiquery_proper_usage($db);
- printf("Native Prepared Statements...\n");
- $db = MySQLPDOTest::factory();
- MySQLPDOTest::createTestTable($db);
- $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
- mysql_stmt_multiquery_wrong_usage($db);
- mysql_stmt_multiquery_proper_usage($db);
+ printf("Native Prepared Statements...\n");
+ $db = MySQLPDOTest::factory();
+ MySQLPDOTest::createTestTable($db);
+ $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
+ mysql_stmt_multiquery_wrong_usage($db);
+ mysql_stmt_multiquery_proper_usage($db);
- } catch (PDOException $e) {
- printf("[001] %s [%s] %s\n",
- $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
- }
+ } catch (PDOException $e) {
+ printf("[001] %s [%s] %s\n",
+ $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_nextrowset.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_nextrowset.phpt
index 9452ca8ec5..e473d6716e 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_stmt_nextrowset.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_nextrowset.phpt
@@ -23,90 +23,90 @@ if (!MySQLPDOTest::isPDOMySQLnd())
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
- $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
+ $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
- MySQLPDOTest::createTestTable($db);
+ MySQLPDOTest::createTestTable($db);
- $stmt = $db->query('SELECT id FROM test');
- if (false !== ($tmp = $stmt->nextRowSet()))
- printf("[002] Expecting false got %s\n", var_export($tmp, true));
+ $stmt = $db->query('SELECT id FROM test');
+ if (false !== ($tmp = $stmt->nextRowSet()))
+ printf("[002] Expecting false got %s\n", var_export($tmp, true));
- // TODO: should give a warning, but its PDO, let's ignore the missing warning for now
- if (false !== ($tmp = $stmt->nextRowSet(1)))
- printf("[003] Expecting false got %s\n", var_export($tmp, true));
+ // TODO: should give a warning, but its PDO, let's ignore the missing warning for now
+ if (false !== ($tmp = $stmt->nextRowSet(1)))
+ printf("[003] Expecting false got %s\n", var_export($tmp, true));
- function test_proc1($db) {
+ function test_proc1($db) {
- $stmt = $db->query('SELECT @VERSION as _version');
- $tmp = $stmt->fetch(PDO::FETCH_ASSOC);
- assert($tmp['_version'] === NULL);
- while ($stmt->fetch()) ;
+ $stmt = $db->query('SELECT @VERSION as _version');
+ $tmp = $stmt->fetch(PDO::FETCH_ASSOC);
+ assert($tmp['_version'] === NULL);
+ while ($stmt->fetch()) ;
- $db->exec('DROP PROCEDURE IF EXISTS p');
- $db->exec('CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) BEGIN SELECT VERSION() INTO ver_param; END;');
- $db->exec('CALL p(@VERSION)');
- $stmt = $db->query('SELECT @VERSION as _version');
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
- var_dump($stmt->nextRowSet());
+ $db->exec('DROP PROCEDURE IF EXISTS p');
+ $db->exec('CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) BEGIN SELECT VERSION() INTO ver_param; END;');
+ $db->exec('CALL p(@VERSION)');
+ $stmt = $db->query('SELECT @VERSION as _version');
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+ var_dump($stmt->nextRowSet());
- }
+ }
- function test_proc2($db) {
+ function test_proc2($db) {
- $db->exec('DROP PROCEDURE IF EXISTS p');
- $db->exec('CREATE PROCEDURE p() BEGIN SELECT id FROM test ORDER BY id ASC LIMIT 3; SELECT id, label FROM test WHERE id < 4 ORDER BY id DESC LIMIT 3; END;');
- $stmt = $db->query('CALL p()');
- do {
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
- } while ($stmt->nextRowSet());
- var_dump($stmt->nextRowSet());
+ $db->exec('DROP PROCEDURE IF EXISTS p');
+ $db->exec('CREATE PROCEDURE p() BEGIN SELECT id FROM test ORDER BY id ASC LIMIT 3; SELECT id, label FROM test WHERE id < 4 ORDER BY id DESC LIMIT 3; END;');
+ $stmt = $db->query('CALL p()');
+ do {
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+ } while ($stmt->nextRowSet());
+ var_dump($stmt->nextRowSet());
- }
+ }
- try {
+ try {
- // Emulated PS
- printf("Emulated PS...\n");
- $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1);
+ // Emulated PS
+ printf("Emulated PS...\n");
+ $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1);
- $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 1);
- test_proc1($db);
- test_proc2($db);
+ $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 1);
+ test_proc1($db);
+ test_proc2($db);
- $db = MySQLPDOTest::factory();
- $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
- $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1);
- $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 0);
- test_proc1($db);
- test_proc2($db);
+ $db = MySQLPDOTest::factory();
+ $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
+ $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1);
+ $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 0);
+ test_proc1($db);
+ test_proc2($db);
- // Native PS
- printf("Native PS...\n");
- $db = MySQLPDOTest::factory();
- $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
- $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 1);
- $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
- test_proc1($db);
- test_proc2($db);
+ // Native PS
+ printf("Native PS...\n");
+ $db = MySQLPDOTest::factory();
+ $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
+ $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 1);
+ $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
+ test_proc1($db);
+ test_proc2($db);
- $db = MySQLPDOTest::factory();
- $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
- $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 0);
- $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
+ $db = MySQLPDOTest::factory();
+ $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
+ $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 0);
+ $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
- test_proc1($db);
- test_proc2($db);
+ test_proc1($db);
+ test_proc2($db);
- @$db->exec('DROP PROCEDURE IF EXISTS p');
+ @$db->exec('DROP PROCEDURE IF EXISTS p');
- } catch (PDOException $e) {
- printf("[001] %s [%s] %s\n",
- $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
- }
+ } catch (PDOException $e) {
+ printf("[001] %s [%s] %s\n",
+ $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_rowcount.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_rowcount.phpt
index 713945e98d..99eb481304 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_stmt_rowcount.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_rowcount.phpt
@@ -8,24 +8,24 @@ MySQLPDOTest::skip();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
- MySQLPDOTest::createTestTable($db);
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
+ MySQLPDOTest::createTestTable($db);
- try {
+ try {
- if (0 !== ($tmp = $db->query('SELECT id FROM test WHERE 1 = 0')->rowCount()))
- printf("[002] Expecting 0 got %s", var_export($tmp, true));
+ if (0 !== ($tmp = $db->query('SELECT id FROM test WHERE 1 = 0')->rowCount()))
+ printf("[002] Expecting 0 got %s", var_export($tmp, true));
- if (1 !== ($tmp = $db->query('SELECT id FROM test WHERE id = 1')->rowCount()))
- printf("[003] Expecting 1 got %s", var_export($tmp, true));
+ if (1 !== ($tmp = $db->query('SELECT id FROM test WHERE id = 1')->rowCount()))
+ printf("[003] Expecting 1 got %s", var_export($tmp, true));
- } catch (PDOException $e) {
- printf("[001] %s [%s] %s\n",
- $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
- }
+ } catch (PDOException $e) {
+ printf("[001] %s [%s] %s\n",
+ $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
- print "done!";
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_unbuffered_2050.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_unbuffered_2050.phpt
index 35d4ba3cba..13f4f5769a 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_stmt_unbuffered_2050.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_unbuffered_2050.phpt
@@ -11,104 +11,104 @@ if (MYSQLPDOTest::isPDOMySQLnd())
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
-
- try {
-
- printf("Native PS...\n");
- $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
- if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
- printf("[004] Unable to turn off emulated prepared statements\n");
-
- printf("Buffered...\n");
- MySQLPDOTest::createTestTable($db);
- $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
- $stmt = $db->query('SELECT id, label FROM test WHERE id = 1');
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
- $stmt = $db->query('SELECT id, label FROM test WHERE id = 1');
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
-
- printf("Unbuffered...\n");
- MySQLPDOTest::createTestTable($db);
- $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
- $stmt = $db->query('SELECT id, label FROM test WHERE id = 1');
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
- /*
- NOTE - this will cause an error and it OK
- When using unbuffered prepared statements MySQL expects you to
- fetch all data from the row before sending new data to the server.
- PDO::query() will prepare and execute a statement in one step.
- After the execution of PDO::query(), MySQL expects you to fetch
- the results from the line before sending new commands. However,
- PHP/PDO will send a CLOSE message as part of the PDO::query() call.
-
- The following happens:
-
- $stmt = PDO::query(<some query>)
- mysql_stmt_prepare()
- mysql_stmt_execute()
-
- $stmt->fetchAll()
- mysql_stmt_fetch()
-
- And now the right side of the expression will be executed first:
- $stmt = PDO::query(<some query>)
- PDO::query(<some query>)
- mysql_stmt_prepare
- mysql_stmt_execute
-
- PHP continues at the left side of the expression:
-
- $stmt = PDO::query(<some query>)
-
- What happens is that $stmt gets overwritten. The reference counter of the
- zval representing the current value of $stmt. PDO gets a callback that
- it has to free the resources associated with the zval representing the
- current value of stmt:
- mysql_stmt_close
- ---> ERROR
- ---> execute() has been send on the line, you are supposed to fetch
- ---> you must not try to send a CLOSE after execute()
- ---> Error: 2050 (CR_FETCH_CANCELED)
- ---> Message: Row retrieval was canceled by mysql_stmt_close() call
- ---> MySQL does its best to recover the line and cancels the retrieval
-
- PHP proceeds and assigns the new statement object/zval obtained from
- PDO to $stmt.
-
- Solutions:
- - use mysqlnd
- - use prepare() + execute() instead of query()
- - as there is no explicit close() in PDO, try unset($stmt) before the new assignment
- - fix PDO::query() [not the driver, fix PDO itself]
- */
-
- $stmt = $db->query('SELECT id, label FROM test WHERE id = 1');
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
-
- $stmt = $db->prepare('SELECT id, label FROM test WHERE id = 1');
- $stmt->execute();
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
-
- $stmt = $db->prepare('SELECT id, label FROM test WHERE id = 1');
- $stmt->execute();
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
-
- unset($stmt);
- $stmt = $db->query('SELECT id, label FROM test WHERE id = 1');
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
-
- unset($stmt);
- $stmt = $db->query('SELECT id, label FROM test WHERE id = 1');
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
-
- } catch (PDOException $e) {
- printf("[001] %s [%s] %s\n",
- $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
- }
-
- print "done!";
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
+
+ try {
+
+ printf("Native PS...\n");
+ $db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
+ if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
+ printf("[004] Unable to turn off emulated prepared statements\n");
+
+ printf("Buffered...\n");
+ MySQLPDOTest::createTestTable($db);
+ $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
+ $stmt = $db->query('SELECT id, label FROM test WHERE id = 1');
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+ $stmt = $db->query('SELECT id, label FROM test WHERE id = 1');
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+
+ printf("Unbuffered...\n");
+ MySQLPDOTest::createTestTable($db);
+ $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
+ $stmt = $db->query('SELECT id, label FROM test WHERE id = 1');
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+ /*
+ NOTE - this will cause an error and it OK
+ When using unbuffered prepared statements MySQL expects you to
+ fetch all data from the row before sending new data to the server.
+ PDO::query() will prepare and execute a statement in one step.
+ After the execution of PDO::query(), MySQL expects you to fetch
+ the results from the line before sending new commands. However,
+ PHP/PDO will send a CLOSE message as part of the PDO::query() call.
+
+ The following happens:
+
+ $stmt = PDO::query(<some query>)
+ mysql_stmt_prepare()
+ mysql_stmt_execute()
+
+ $stmt->fetchAll()
+ mysql_stmt_fetch()
+
+ And now the right side of the expression will be executed first:
+ $stmt = PDO::query(<some query>)
+ PDO::query(<some query>)
+ mysql_stmt_prepare
+ mysql_stmt_execute
+
+ PHP continues at the left side of the expression:
+
+ $stmt = PDO::query(<some query>)
+
+ What happens is that $stmt gets overwritten. The reference counter of the
+ zval representing the current value of $stmt. PDO gets a callback that
+ it has to free the resources associated with the zval representing the
+ current value of stmt:
+ mysql_stmt_close
+ ---> ERROR
+ ---> execute() has been send on the line, you are supposed to fetch
+ ---> you must not try to send a CLOSE after execute()
+ ---> Error: 2050 (CR_FETCH_CANCELED)
+ ---> Message: Row retrieval was canceled by mysql_stmt_close() call
+ ---> MySQL does its best to recover the line and cancels the retrieval
+
+ PHP proceeds and assigns the new statement object/zval obtained from
+ PDO to $stmt.
+
+ Solutions:
+ - use mysqlnd
+ - use prepare() + execute() instead of query()
+ - as there is no explicit close() in PDO, try unset($stmt) before the new assignment
+ - fix PDO::query() [not the driver, fix PDO itself]
+ */
+
+ $stmt = $db->query('SELECT id, label FROM test WHERE id = 1');
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+
+ $stmt = $db->prepare('SELECT id, label FROM test WHERE id = 1');
+ $stmt->execute();
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+
+ $stmt = $db->prepare('SELECT id, label FROM test WHERE id = 1');
+ $stmt->execute();
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+
+ unset($stmt);
+ $stmt = $db->query('SELECT id, label FROM test WHERE id = 1');
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+
+ unset($stmt);
+ $stmt = $db->query('SELECT id, label FROM test WHERE id = 1');
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+
+ } catch (PDOException $e) {
+ printf("[001] %s [%s] %s\n",
+ $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
+
+ print "done!";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_variable_columncount.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_variable_columncount.phpt
index 63a500b7b3..21fd83f57d 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_stmt_variable_columncount.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_variable_columncount.phpt
@@ -21,105 +21,105 @@ if ($version < 50000)
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- $db = MySQLPDOTest::factory();
-
- function check_result($offset, $stmt, $columns) {
-
- do {
- $row = $stmt->fetch(PDO::FETCH_ASSOC);
- } while ($stmt->nextRowSet());
-
- if (!isset($row['one']) || ($row['one'] != 1)) {
- printf("[%03d + 1] Expecting array('one' => 1), got %s\n", $offset, var_export($row, true));
- return false;
- }
-
- if (($columns == 2) &&
- (!isset($row['two']) || ($row['two'] != 2))) {
- printf("[%03d + 2] Expecting array('one' => 1, 'two' => 2), got %s\n", $offset, var_export($row, true));
- return false;
- } else if (($columns == 1) && isset($row['two'])) {
- printf("[%03d + 3] Expecting one array element got two\n", $offset);
- return false;
- }
-
- return true;
- }
-
- try {
-
- // What will happen if a PS returns a differen number of result set column upon each execution?
- // Lets try with a SP accepting parameters...
- $db->exec('DROP PROCEDURE IF EXISTS p');
- $db->exec('CREATE PROCEDURE p(IN cols INT) BEGIN IF cols < 2 THEN SELECT cols AS "one"; ELSE SELECT 1 AS "one", cols AS "two"; END IF; END;');
-
- // Emulates PS first
- $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1);
- $stmt = $db->prepare('CALL p(?)');
-
- $columns = null;
- $stmt->bindParam(1, $columns);
- for ($i = 0; $i < 5; $i++) {
- $columns = ($i % 2) + 1;
- $stmt->execute();
- check_result($i, $stmt, $columns);
- }
-
- if (MySQLPDOTest::isPDOMySQLnd()) {
- // Native PS
- // Libmysql cannot handle such a stored procedure. You will see leaks with libmysql
- $db = MySQLPDOTest::factory();
- $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
- $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 1);
- $stmt = $db->prepare('CALL p(?)');
- $stmt->bindParam(1, $columns);
- for ($i = 5; $i < 10; $i++) {
- $columns = ($i % 2) + 1;
- $stmt->execute();
- check_result($i, $stmt, $columns);
- }
- }
-
- // And now without parameters... - this gives a different control flow inside PDO
- $db->exec('DROP PROCEDURE IF EXISTS p');
- $db->exec('CREATE PROCEDURE p() BEGIN DECLARE cols INT; SELECT @numcols INTO cols; IF cols < 2 THEN SET @numcols = 2; SELECT cols AS "one"; ELSE SET @numcols = 1; SELECT 1 AS "one", cols AS "two"; END IF; END;');
-
- // Emulates PS first
- $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1);
- $db->exec('SET @numcols = 1');
- $stmt = $db->prepare('CALL p()');
- $stmt->execute();
- check_result(11, $stmt, 1);
- $stmt->execute();
- check_result(12, $stmt, 2);
- $db->exec('SET @numcols = 1');
- $stmt->execute();
- check_result(13, $stmt, 1);
-
- if (MySQLPDOTest::isPDOMySQLnd()) {
- // Native PS
- // Libmysql cannot handle such a stored procedure. You will see leaks with libmysql
- $db = MySQLPDOTest::factory();
- $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
- $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 1);
- $db->exec('SET @numcols = 1');
- $stmt = $db->prepare('CALL p()');
- $stmt->execute();
- check_result(14, $stmt, 1);
- $stmt->execute();
- check_result(15, $stmt, 2);
- $db->exec('SET @numcols = 1');
- $stmt->execute();
- check_result(16, $stmt, 1);
- }
-
- } catch (PDOException $e) {
- printf("[99] %s [%s] %s\n",
- $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
- }
-
- print "done!";
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ $db = MySQLPDOTest::factory();
+
+ function check_result($offset, $stmt, $columns) {
+
+ do {
+ $row = $stmt->fetch(PDO::FETCH_ASSOC);
+ } while ($stmt->nextRowSet());
+
+ if (!isset($row['one']) || ($row['one'] != 1)) {
+ printf("[%03d + 1] Expecting array('one' => 1), got %s\n", $offset, var_export($row, true));
+ return false;
+ }
+
+ if (($columns == 2) &&
+ (!isset($row['two']) || ($row['two'] != 2))) {
+ printf("[%03d + 2] Expecting array('one' => 1, 'two' => 2), got %s\n", $offset, var_export($row, true));
+ return false;
+ } else if (($columns == 1) && isset($row['two'])) {
+ printf("[%03d + 3] Expecting one array element got two\n", $offset);
+ return false;
+ }
+
+ return true;
+ }
+
+ try {
+
+ // What will happen if a PS returns a different number of result set column upon each execution?
+ // Lets try with a SP accepting parameters...
+ $db->exec('DROP PROCEDURE IF EXISTS p');
+ $db->exec('CREATE PROCEDURE p(IN cols INT) BEGIN IF cols < 2 THEN SELECT cols AS "one"; ELSE SELECT 1 AS "one", cols AS "two"; END IF; END;');
+
+ // Emulates PS first
+ $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1);
+ $stmt = $db->prepare('CALL p(?)');
+
+ $columns = null;
+ $stmt->bindParam(1, $columns);
+ for ($i = 0; $i < 5; $i++) {
+ $columns = ($i % 2) + 1;
+ $stmt->execute();
+ check_result($i, $stmt, $columns);
+ }
+
+ if (MySQLPDOTest::isPDOMySQLnd()) {
+ // Native PS
+ // Libmysql cannot handle such a stored procedure. You will see leaks with libmysql
+ $db = MySQLPDOTest::factory();
+ $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
+ $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 1);
+ $stmt = $db->prepare('CALL p(?)');
+ $stmt->bindParam(1, $columns);
+ for ($i = 5; $i < 10; $i++) {
+ $columns = ($i % 2) + 1;
+ $stmt->execute();
+ check_result($i, $stmt, $columns);
+ }
+ }
+
+ // And now without parameters... - this gives a different control flow inside PDO
+ $db->exec('DROP PROCEDURE IF EXISTS p');
+ $db->exec('CREATE PROCEDURE p() BEGIN DECLARE cols INT; SELECT @numcols INTO cols; IF cols < 2 THEN SET @numcols = 2; SELECT cols AS "one"; ELSE SET @numcols = 1; SELECT 1 AS "one", cols AS "two"; END IF; END;');
+
+ // Emulates PS first
+ $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1);
+ $db->exec('SET @numcols = 1');
+ $stmt = $db->prepare('CALL p()');
+ $stmt->execute();
+ check_result(11, $stmt, 1);
+ $stmt->execute();
+ check_result(12, $stmt, 2);
+ $db->exec('SET @numcols = 1');
+ $stmt->execute();
+ check_result(13, $stmt, 1);
+
+ if (MySQLPDOTest::isPDOMySQLnd()) {
+ // Native PS
+ // Libmysql cannot handle such a stored procedure. You will see leaks with libmysql
+ $db = MySQLPDOTest::factory();
+ $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
+ $db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, 1);
+ $db->exec('SET @numcols = 1');
+ $stmt = $db->prepare('CALL p()');
+ $stmt->execute();
+ check_result(14, $stmt, 1);
+ $stmt->execute();
+ check_result(15, $stmt, 2);
+ $db->exec('SET @numcols = 1');
+ $stmt->execute();
+ check_result(16, $stmt, 1);
+ }
+
+ } catch (PDOException $e) {
+ printf("[99] %s [%s] %s\n",
+ $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
+
+ print "done!";
?>
--EXPECT--
done!
diff --git a/ext/pdo_mysql/tests/pdo_mysql_subclass.phpt b/ext/pdo_mysql/tests/pdo_mysql_subclass.phpt
index 604a13bdb3..f98271d792 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_subclass.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_subclass.phpt
@@ -8,65 +8,65 @@ MySQLPDOTest::skip();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
- try {
+ try {
- class MyPDO extends PDO {
+ class MyPDO extends PDO {
- public function __construct() {
- $this->protocol();
- return call_user_func_array(array($this, 'parent::__construct'), func_get_args());
- }
+ public function __construct() {
+ $this->protocol();
+ return call_user_func_array(array($this, 'parent::__construct'), func_get_args());
+ }
- public function exec($statement) {
- $this->protocol();
- return parent::exec($statement);
- }
+ public function exec($statement) {
+ $this->protocol();
+ return parent::exec($statement);
+ }
- public function query() {
- $this->protocol();
- return call_user_func_array(array($this, 'parent::query'), func_get_args());
- }
+ public function query($statement) {
+ $this->protocol();
+ return call_user_func_array(array($this, 'parent::query'), func_get_args());
+ }
- public function __call($method, $args) {
- print "__call(".var_export($method,true).", ".var_export($args, true).")\n";
- // $this->protocol();
- }
+ public function __call($method, $args) {
+ print "__call(".var_export($method,true).", ".var_export($args, true).")\n";
+ // $this->protocol();
+ }
- private function protocol() {
- $stack = debug_backtrace();
- if (!isset($stack[1]))
- return;
+ private function protocol() {
+ $stack = debug_backtrace();
+ if (!isset($stack[1]))
+ return;
- printf("%s(", $stack[1]['function']);
- $args = '';
- foreach ($stack[1]['args'] as $k => $v)
- $args .= sprintf("%s, ", var_export($v, true));
- if ($args != '')
- printf("%s", substr($args, 0, -2));
- printf(")\n");
- }
+ printf("%s(", $stack[1]['function']);
+ $args = '';
+ foreach ($stack[1]['args'] as $k => $v)
+ $args .= sprintf("%s, ", var_export($v, true));
+ if ($args != '')
+ printf("%s", substr($args, 0, -2));
+ printf(")\n");
+ }
- }
+ }
- $db = new MyPDO(PDO_MYSQL_TEST_DSN, PDO_MYSQL_TEST_USER, PDO_MYSQL_TEST_PASS);
- $db->exec('DROP TABLE IF EXISTS test');
- $db->exec('CREATE TABLE test(id INT)');
- $db->exec('INSERT INTO test(id) VALUES (1), (2)');
- $stmt = $db->query('SELECT * FROM test ORDER BY id ASC');
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
- var_dump($stmt->fetch());
- $db->intercept_call();
+ $db = new MyPDO(PDO_MYSQL_TEST_DSN, PDO_MYSQL_TEST_USER, PDO_MYSQL_TEST_PASS);
+ $db->exec('DROP TABLE IF EXISTS test');
+ $db->exec('CREATE TABLE test(id INT)');
+ $db->exec('INSERT INTO test(id) VALUES (1), (2)');
+ $stmt = $db->query('SELECT * FROM test ORDER BY id ASC');
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+ var_dump($stmt->fetch());
+ $db->intercept_call();
- } catch (PDOException $e) {
- printf("[001] %s [%s] %s\n",
- $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
- }
+ } catch (PDOException $e) {
+ printf("[001] %s [%s] %s\n",
+ $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
+ }
- $db->exec('DROP TABLE IF EXISTS test');
- print "done!\n";
+ $db->exec('DROP TABLE IF EXISTS test');
+ print "done!\n";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_types.phpt b/ext/pdo_mysql/tests/pdo_mysql_types.phpt
index fee1aff514..6360c9a61b 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_types.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_types.phpt
@@ -8,171 +8,171 @@ MySQLPDOTest::skip();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
-
- function test_type(&$db, $offset, $sql_type, $value, $ret_value = NULL, $pattern = NULL, $alternative_type = NULL) {
-
- $db->exec('DROP TABLE IF EXISTS test');
- $sql = sprintf('CREATE TABLE test(id INT, label %s) ENGINE=%s', $sql_type, MySQLPDOTest::getTableEngine());
- @$db->exec($sql);
- if ($db->errorCode() != 0) {
- // not all MySQL Server versions and/or engines might support the type
- return true;
- }
-
- $stmt = $db->prepare('INSERT INTO test(id, label) VALUES (?, ?)');
- $stmt->bindValue(1, $offset);
- $stmt->bindValue(2, $value);
- if (!$stmt->execute()) {
- printf("[%03d + 1] INSERT failed, %s\n", $offset, var_export($stmt->errorInfo(), true));
- return false;
- }
- $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false);
- $stmt = $db->query('SELECT id, label FROM test');
- $row = $stmt->fetch(PDO::FETCH_ASSOC);
- $stmt->closeCursor();
-
- if (!isset($row['id']) || !isset($row['label'])) {
- printf("[%03d + 2] Fetched result seems wrong, dumping result: %s\n", $offset, var_export($row, true));
- return false;
- }
-
- if ($row['id'] != $offset) {
- printf("[%03d + 3] Expecting %s got %s\n", $offset, $row['id']);
- return false;
- }
-
- if (!is_null($pattern)) {
- if (!preg_match($pattern, $row['label'])) {
- printf("[%03d + 5] Value seems wrong, accepting pattern %s got %s, check manually\n",
- $offset, $pattern, var_export($row['label'], true));
- return false;
- }
-
- } else {
-
- $exp = $value;
- if (!is_null($ret_value)) {
- // we expect a different return value than our input value
- // typically the difference is only the type
- $exp = $ret_value;
- }
- if ($row['label'] !== $exp && !is_null($alternative_type) && gettype($row['label']) != $alternative_type) {
- printf("[%03d + 4] %s - input = %s/%s, output = %s/%s (alternative type: %s)\n", $offset,
- $sql_type, var_export($exp, true), gettype($exp),
- var_export($row['label'], true), gettype($row['label']),
- $alternative_type);
- return false;
- }
-
- }
-
- $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
- $stmt = $db->query('SELECT id, label FROM test');
- $row_string = $stmt->fetch(PDO::FETCH_ASSOC);
- $stmt->closeCursor();
- if (is_null($pattern) && ($row['label'] != $row_string['label'])) {
- printf("%s - STRINGIGY = %s, NATIVE = %s\n", $sql_type, var_export($row_string['label'], true), var_export($row['label'], true));
- return false;
- } else if (!is_null($pattern) && !preg_match($pattern, $row_string['label'])) {
- printf("%s - STRINGIGY = %s, NATIVE = %s, pattern '%s'\n", $sql_type, var_export($row_string['label'], true), var_export($row['label'], true), $pattern);
- return false;
- }
-
-
- return true;
- }
-
- $db = MySQLPDOTest::factory();
- $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
- $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false);
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+
+ function test_type(&$db, $offset, $sql_type, $value, $ret_value = NULL, $pattern = NULL, $alternative_type = NULL) {
+
+ $db->exec('DROP TABLE IF EXISTS test');
+ $sql = sprintf('CREATE TABLE test(id INT, label %s) ENGINE=%s', $sql_type, MySQLPDOTest::getTableEngine());
+ @$db->exec($sql);
+ if ($db->errorCode() != 0) {
+ // not all MySQL Server versions and/or engines might support the type
+ return true;
+ }
+
+ $stmt = $db->prepare('INSERT INTO test(id, label) VALUES (?, ?)');
+ $stmt->bindValue(1, $offset);
+ $stmt->bindValue(2, $value);
+ if (!$stmt->execute()) {
+ printf("[%03d + 1] INSERT failed, %s\n", $offset, var_export($stmt->errorInfo(), true));
+ return false;
+ }
+ $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false);
+ $stmt = $db->query('SELECT id, label FROM test');
+ $row = $stmt->fetch(PDO::FETCH_ASSOC);
+ $stmt->closeCursor();
+
+ if (!isset($row['id']) || !isset($row['label'])) {
+ printf("[%03d + 2] Fetched result seems wrong, dumping result: %s\n", $offset, var_export($row, true));
+ return false;
+ }
+
+ if ($row['id'] != $offset) {
+ printf("[%03d + 3] Expecting %s got %s\n", $offset, $row['id']);
+ return false;
+ }
+
+ if (!is_null($pattern)) {
+ if (!preg_match($pattern, $row['label'])) {
+ printf("[%03d + 5] Value seems wrong, accepting pattern %s got %s, check manually\n",
+ $offset, $pattern, var_export($row['label'], true));
+ return false;
+ }
+
+ } else {
+
+ $exp = $value;
+ if (!is_null($ret_value)) {
+ // we expect a different return value than our input value
+ // typically the difference is only the type
+ $exp = $ret_value;
+ }
+ if ($row['label'] !== $exp && !is_null($alternative_type) && gettype($row['label']) != $alternative_type) {
+ printf("[%03d + 4] %s - input = %s/%s, output = %s/%s (alternative type: %s)\n", $offset,
+ $sql_type, var_export($exp, true), gettype($exp),
+ var_export($row['label'], true), gettype($row['label']),
+ $alternative_type);
+ return false;
+ }
+
+ }
+
+ $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
+ $stmt = $db->query('SELECT id, label FROM test');
+ $row_string = $stmt->fetch(PDO::FETCH_ASSOC);
+ $stmt->closeCursor();
+ if (is_null($pattern) && ($row['label'] != $row_string['label'])) {
+ printf("%s - STRINGIGY = %s, NATIVE = %s\n", $sql_type, var_export($row_string['label'], true), var_export($row['label'], true));
+ return false;
+ } else if (!is_null($pattern) && !preg_match($pattern, $row_string['label'])) {
+ printf("%s - STRINGIGY = %s, NATIVE = %s, pattern '%s'\n", $sql_type, var_export($row_string['label'], true), var_export($row['label'], true), $pattern);
+ return false;
+ }
+
+
+ return true;
+ }
+
+ $db = MySQLPDOTest::factory();
+ $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+ $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
+ $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false);
/*
- test_type($db, 20, 'BIT(8)', 1);
+ test_type($db, 20, 'BIT(8)', 1);
*/
- $is_mysqlnd = MySQLPDOTest::isPDOMySQLnd();
+ $is_mysqlnd = MySQLPDOTest::isPDOMySQLnd();
- test_type($db, 30, 'TINYINT', -127, ($is_mysqlnd) ? -127: '-127');
- test_type($db, 40, 'TINYINT UNSIGNED', 255, ($is_mysqlnd) ? 255 : '255');
- test_type($db, 50, 'BOOLEAN', 1, ($is_mysqlnd) ? 1 : '1');
+ test_type($db, 30, 'TINYINT', -127, ($is_mysqlnd) ? -127: '-127');
+ test_type($db, 40, 'TINYINT UNSIGNED', 255, ($is_mysqlnd) ? 255 : '255');
+ test_type($db, 50, 'BOOLEAN', 1, ($is_mysqlnd) ? 1 : '1');
- test_type($db, 60, 'SMALLINT', -32768, ($is_mysqlnd) ? -32768 : '-32768');
- test_type($db, 70, 'SMALLINT UNSIGNED', 65535, ($is_mysqlnd) ? 65535 : '65535');
+ test_type($db, 60, 'SMALLINT', -32768, ($is_mysqlnd) ? -32768 : '-32768');
+ test_type($db, 70, 'SMALLINT UNSIGNED', 65535, ($is_mysqlnd) ? 65535 : '65535');
- test_type($db, 80, 'MEDIUMINT', -8388608, ($is_mysqlnd) ? -8388608 : '-8388608');
- test_type($db, 90, 'MEDIUMINT UNSIGNED', 16777215, ($is_mysqlnd) ? 16777215 : '16777215');
+ test_type($db, 80, 'MEDIUMINT', -8388608, ($is_mysqlnd) ? -8388608 : '-8388608');
+ test_type($db, 90, 'MEDIUMINT UNSIGNED', 16777215, ($is_mysqlnd) ? 16777215 : '16777215');
- test_type($db, 100, 'INT', -2147483648,
- ($is_mysqlnd) ? ((PHP_INT_SIZE > 4) ? (int)-2147483648 : (double)-2147483648) : '-2147483648',
- NULL, ($is_mysqlnd) ? 'integer' : NULL);
+ test_type($db, 100, 'INT', -2147483648,
+ ($is_mysqlnd) ? ((PHP_INT_SIZE > 4) ? (int)-2147483648 : (double)-2147483648) : '-2147483648',
+ NULL, ($is_mysqlnd) ? 'integer' : NULL);
- test_type($db, 110, 'INT UNSIGNED', 4294967295, ($is_mysqlnd) ? ((PHP_INT_SIZE > 4) ? 4294967295 : '4294967295') : '4294967295');
+ test_type($db, 110, 'INT UNSIGNED', 4294967295, ($is_mysqlnd) ? ((PHP_INT_SIZE > 4) ? 4294967295 : '4294967295') : '4294967295');
- // no chance to return int with the current PDO version - we are forced to return strings
- test_type($db, 120, 'BIGINT', 1, ($is_mysqlnd) ? 1 : '1');
- // to avoid trouble with numeric ranges, lets pass the numbers as a string
- test_type($db, 130, 'BIGINT', '-9223372036854775808', NULL, '/^\-9[\.]*22/');
- test_type($db, 140, 'BIGINT UNSIGNED', '18446744073709551615', NULL, '/^1[\.]*844/');
+ // no chance to return int with the current PDO version - we are forced to return strings
+ test_type($db, 120, 'BIGINT', 1, ($is_mysqlnd) ? 1 : '1');
+ // to avoid trouble with numeric ranges, lets pass the numbers as a string
+ test_type($db, 130, 'BIGINT', '-9223372036854775808', NULL, '/^\-9[\.]*22/');
+ test_type($db, 140, 'BIGINT UNSIGNED', '18446744073709551615', NULL, '/^1[\.]*844/');
- test_type($db, 150, 'REAL', -1.01, ($is_mysqlnd) ? -1.01 : '-1.01');
- test_type($db, 160, 'REAL UNSIGNED', 1.01, ($is_mysqlnd) ? 1.01 : '1.01');
+ test_type($db, 150, 'REAL', -1.01, ($is_mysqlnd) ? -1.01 : '-1.01');
+ test_type($db, 160, 'REAL UNSIGNED', 1.01, ($is_mysqlnd) ? 1.01 : '1.01');
- test_type($db, 170, 'DOUBLE', -1.01, ($is_mysqlnd) ? -1.01 : '-1.01');
- test_type($db, 180, 'DOUBLE UNSIGNED', 1.01, ($is_mysqlnd) ? 1.01 : '1.01');
+ test_type($db, 170, 'DOUBLE', -1.01, ($is_mysqlnd) ? -1.01 : '-1.01');
+ test_type($db, 180, 'DOUBLE UNSIGNED', 1.01, ($is_mysqlnd) ? 1.01 : '1.01');
- test_type($db, 210, 'FLOAT', -1.01, NULL, '/^\-1.0\d+/');
- test_type($db, 220, 'FLOAT UNSIGNED', 1.01, NULL, '/^1.0\d+/');
+ test_type($db, 210, 'FLOAT', -1.01, NULL, '/^\-1.0\d+/');
+ test_type($db, 220, 'FLOAT UNSIGNED', 1.01, NULL, '/^1.0\d+/');
- test_type($db, 250, 'DECIMAL', -1.01, '-1');
- test_type($db, 260, 'DECIMAL UNSIGNED', 1.01, '1');
+ test_type($db, 250, 'DECIMAL', -1.01, '-1');
+ test_type($db, 260, 'DECIMAL UNSIGNED', 1.01, '1');
- test_type($db, 290, 'NUMERIC', -1.01, '-1');
- test_type($db, 300, 'NUMERIC UNSIGNED', 1.01, '1');
+ test_type($db, 290, 'NUMERIC', -1.01, '-1');
+ test_type($db, 300, 'NUMERIC UNSIGNED', 1.01, '1');
- test_type($db, 330, 'DATE', '2008-04-23');
- test_type($db, 340, 'TIME', '14:37:00');
- test_type($db, 350, 'TIMESTAMP', '2008-05-06 21:09:00');
- test_type($db, 360, 'DATETIME', '2008-03-23 14:38:00');
- test_type($db, 370, 'YEAR', 2008, ($is_mysqlnd) ? 2008 : '2008');
+ test_type($db, 330, 'DATE', '2008-04-23');
+ test_type($db, 340, 'TIME', '14:37:00');
+ test_type($db, 350, 'TIMESTAMP', '2008-05-06 21:09:00');
+ test_type($db, 360, 'DATETIME', '2008-03-23 14:38:00');
+ test_type($db, 370, 'YEAR', 2008, ($is_mysqlnd) ? 2008 : '2008');
- test_type($db, 380, 'CHAR(1)', 'a');
- test_type($db, 390, 'CHAR(10)', '0123456789');
- test_type($db, 400, 'CHAR(255)', str_repeat('z', 255));
- test_type($db, 410, 'VARCHAR(1)', 'a');
- test_type($db, 420, 'VARCHAR(10)', '0123456789');
- test_type($db, 430, 'VARCHAR(255)', str_repeat('z', 255));
+ test_type($db, 380, 'CHAR(1)', 'a');
+ test_type($db, 390, 'CHAR(10)', '0123456789');
+ test_type($db, 400, 'CHAR(255)', str_repeat('z', 255));
+ test_type($db, 410, 'VARCHAR(1)', 'a');
+ test_type($db, 420, 'VARCHAR(10)', '0123456789');
+ test_type($db, 430, 'VARCHAR(255)', str_repeat('z', 255));
- test_type($db, 440, 'BINARY(1)', str_repeat('a', 1));
- test_type($db, 450, 'BINARY(255)', str_repeat('b', 255));
- test_type($db, 460, 'VARBINARY(1)', str_repeat('a', 1));
- test_type($db, 470, 'VARBINARY(255)', str_repeat('b', 255));
+ test_type($db, 440, 'BINARY(1)', str_repeat('a', 1));
+ test_type($db, 450, 'BINARY(255)', str_repeat('b', 255));
+ test_type($db, 460, 'VARBINARY(1)', str_repeat('a', 1));
+ test_type($db, 470, 'VARBINARY(255)', str_repeat('b', 255));
- test_type($db, 480, 'TINYBLOB', str_repeat('b', 255));
- test_type($db, 490, 'BLOB', str_repeat('b', 256));
- test_type($db, 500, 'MEDIUMBLOB', str_repeat('b', 256));
- test_type($db, 510, 'LONGBLOB', str_repeat('b', 256));
+ test_type($db, 480, 'TINYBLOB', str_repeat('b', 255));
+ test_type($db, 490, 'BLOB', str_repeat('b', 256));
+ test_type($db, 500, 'MEDIUMBLOB', str_repeat('b', 256));
+ test_type($db, 510, 'LONGBLOB', str_repeat('b', 256));
- test_type($db, 520, 'TINYTEXT', str_repeat('b', 255));
- test_type($db, 530, 'TINYTEXT BINARY', str_repeat('b', 255));
+ test_type($db, 520, 'TINYTEXT', str_repeat('b', 255));
+ test_type($db, 530, 'TINYTEXT BINARY', str_repeat('b', 255));
- test_type($db, 560, 'TEXT', str_repeat('b', 256));
- test_type($db, 570, 'TEXT BINARY', str_repeat('b', 256));
+ test_type($db, 560, 'TEXT', str_repeat('b', 256));
+ test_type($db, 570, 'TEXT BINARY', str_repeat('b', 256));
- test_type($db, 580, 'MEDIUMTEXT', str_repeat('b', 256));
- test_type($db, 590, 'MEDIUMTEXT BINARY', str_repeat('b', 256));
+ test_type($db, 580, 'MEDIUMTEXT', str_repeat('b', 256));
+ test_type($db, 590, 'MEDIUMTEXT BINARY', str_repeat('b', 256));
- test_type($db, 600, 'LONGTEXT', str_repeat('b', 256));
- test_type($db, 610, 'LONGTEXT BINARY', str_repeat('b', 256));
+ test_type($db, 600, 'LONGTEXT', str_repeat('b', 256));
+ test_type($db, 610, 'LONGTEXT BINARY', str_repeat('b', 256));
- test_type($db, 620, "ENUM('yes', 'no') DEFAULT 'yes'", 'no');
- test_type($db, 630, "SET('yes', 'no') DEFAULT 'yes'", 'no');
+ test_type($db, 620, "ENUM('yes', 'no') DEFAULT 'yes'", 'no');
+ test_type($db, 630, "SET('yes', 'no') DEFAULT 'yes'", 'no');
- test_type($db, 640, 'DECIMAL(3,2)', -1.01, '-1.01');
+ test_type($db, 640, 'DECIMAL(3,2)', -1.01, '-1.01');
- echo "done!\n";
+ echo "done!\n";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pdo_mysql_types_zerofill.phpt b/ext/pdo_mysql/tests/pdo_mysql_types_zerofill.phpt
index 1ef5ab1370..8e98b74acb 100644
--- a/ext/pdo_mysql/tests/pdo_mysql_types_zerofill.phpt
+++ b/ext/pdo_mysql/tests/pdo_mysql_types_zerofill.phpt
@@ -8,115 +8,115 @@ MySQLPDOTest::skip();
?>
--FILE--
<?php
- require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
-
- function test_type(&$db, $offset, $sql_type, $value, $ret_value = NULL, $pattern = NULL) {
-
- $db->exec('DROP TABLE IF EXISTS test');
- $sql = sprintf('CREATE TABLE test(id INT, label %s) ENGINE=%s', $sql_type, MySQLPDOTest::getTableEngine());
- @$db->exec($sql);
- if ($db->errorCode() != 0) {
- // not all MySQL Server versions and/or engines might support the type
- return true;
- }
-
- $stmt = $db->prepare('INSERT INTO test(id, label) VALUES (?, ?)');
- $stmt->bindValue(1, $offset);
- $stmt->bindValue(2, $value);
- try {
- if (!$stmt->execute()) {
- printf("[%03d + 1] INSERT failed, %s\n", $offset, var_export($stmt->errorInfo(), true));
- return false;
- }
- } catch (PDOException $e) {
- // This might be a SQL warning on signed values inserted in unsigned columns
- // Zerofill implies unsigned but the test plays with signed = negative values as well!
- return true;
- }
-
- $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false);
- $stmt = $db->query('SELECT id, label FROM test');
- $row = $stmt->fetch(PDO::FETCH_ASSOC);
- $stmt->closeCursor();
- if (!isset($row['id']) || !isset($row['label'])) {
- printf("[%03d + 2] Fetched result seems wrong, dumping result: %s\n", $offset, var_export($row, true));
- return false;
- }
-
- if ($row['id'] != $offset) {
- printf("[%03d + 3] Expecting %s got %s\n", $offset, $row['id']);
- return false;
- }
-
- if (!is_null($pattern)) {
-
- if (!preg_match($pattern, $row['label'])) {
- printf("[%03d + 5] Value seems wrong, accepting pattern %s got %s, check manually\n",
- $offset, $pattern, var_export($row['label'], true));
- return false;
- }
-
- } else {
-
- $exp = $value;
- if (!is_null($ret_value)) {
- // we expect a different return value than our input value
- // typically the difference is only the type
- $exp = $ret_value;
- }
-
- if ($row['label'] !== $exp) {
- printf("[%03d + 4] %s - input = %s/%s, output = %s/%s\n", $offset,
- $sql_type, var_export($exp, true), gettype($exp),
- var_export($row['label'], true), gettype($row['label']));
- return false;
- }
-
- }
-
- $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
- $stmt = $db->query('SELECT id, label FROM test');
- $row_string = $stmt->fetch(PDO::FETCH_ASSOC);
- $stmt->closeCursor();
- if ($row['label'] != $row_string['label']) {
- printf("%s - STRINGIGY = %s, NATIVE = %s\n", $sql_type, var_export($row_string['label'], true), var_export($row['label'], true));
- return false;
- }
-
- return true;
- }
-
- $db = MySQLPDOTest::factory();
- $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
- $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false);
-
- $stmt = $db->prepare('SELECT @@sql_mode AS _mode');
- $stmt->execute();
- $row = $stmt->fetch(PDO::FETCH_ASSOC);
- $real_as_float = (false === stristr($row['_mode'], "REAL_AS_FLOAT")) ? false : true;
-
- test_type($db, 100, 'REAL ZEROFILL', -1.01, NULL, '/^[0]*0$/');
- test_type($db, 110, 'REAL ZEROFILL', 1.01, NULL, ($real_as_float) ? '/^[0]*1\.0.*$/' : '/^[0]*1\.01$/');
- test_type($db, 120, 'REAL UNSIGNED ZEROFILL', 1.01, NULL, ($real_as_float) ? '/^[0]*1\..*$/' : '/^[0]*1\.01$/');
-
- test_type($db, 130, 'DOUBLE ZEROFILL', -1.01, NULL, '/^[0]*0$/');
- test_type($db, 140, 'DOUBLE ZEROFILL', 1.01, NULL, '/^[0]*1\.01$/');
- test_type($db, 150, 'DOUBLE UNSIGNED ZEROFILL', 1.01, NULL, '/^[0]*1\.01$/');
-
- test_type($db, 160, 'FLOAT ZEROFILL', -1.01, NULL, '/^[0]*0$/');
- test_type($db, 170, 'FLOAT ZEROFILL', 1, NULL, '/^[0]*1$/');
- test_type($db, 180, 'FLOAT UNSIGNED ZEROFILL', -1, NULL, '/^[0]*0$/');
-
- test_type($db, 190, 'DECIMAL ZEROFILL', -1.01, NULL, '/^[0]*0$/');
- test_type($db, 200, 'DECIMAL ZEROFILL', 1.01, NULL, '/^[0]*1$/');
- test_type($db, 210, 'DECIMAL UNSIGNED ZEROFILL', 1.01, NULL, '/^[0]*1$/');
-
- test_type($db, 220, 'NUMERIC ZEROFILL', -1, NULL, '/^[0]*0$/');
- test_type($db, 230, 'NUMERIC ZEROFILL', 1, NULL, '/^[0]*1$/');
- test_type($db, 240, 'NUMERIC UNSIGNED ZEROFILL', 1.01, NULL, '/^[0]*1$/');
-
- echo "done!\n";
+ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
+
+ function test_type(&$db, $offset, $sql_type, $value, $ret_value = NULL, $pattern = NULL) {
+
+ $db->exec('DROP TABLE IF EXISTS test');
+ $sql = sprintf('CREATE TABLE test(id INT, label %s) ENGINE=%s', $sql_type, MySQLPDOTest::getTableEngine());
+ @$db->exec($sql);
+ if ($db->errorCode() != 0) {
+ // not all MySQL Server versions and/or engines might support the type
+ return true;
+ }
+
+ $stmt = $db->prepare('INSERT INTO test(id, label) VALUES (?, ?)');
+ $stmt->bindValue(1, $offset);
+ $stmt->bindValue(2, $value);
+ try {
+ if (!$stmt->execute()) {
+ printf("[%03d + 1] INSERT failed, %s\n", $offset, var_export($stmt->errorInfo(), true));
+ return false;
+ }
+ } catch (PDOException $e) {
+ // This might be a SQL warning on signed values inserted in unsigned columns
+ // Zerofill implies unsigned but the test plays with signed = negative values as well!
+ return true;
+ }
+
+ $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false);
+ $stmt = $db->query('SELECT id, label FROM test');
+ $row = $stmt->fetch(PDO::FETCH_ASSOC);
+ $stmt->closeCursor();
+ if (!isset($row['id']) || !isset($row['label'])) {
+ printf("[%03d + 2] Fetched result seems wrong, dumping result: %s\n", $offset, var_export($row, true));
+ return false;
+ }
+
+ if ($row['id'] != $offset) {
+ printf("[%03d + 3] Expecting %s got %s\n", $offset, $row['id']);
+ return false;
+ }
+
+ if (!is_null($pattern)) {
+
+ if (!preg_match($pattern, $row['label'])) {
+ printf("[%03d + 5] Value seems wrong, accepting pattern %s got %s, check manually\n",
+ $offset, $pattern, var_export($row['label'], true));
+ return false;
+ }
+
+ } else {
+
+ $exp = $value;
+ if (!is_null($ret_value)) {
+ // we expect a different return value than our input value
+ // typically the difference is only the type
+ $exp = $ret_value;
+ }
+
+ if ($row['label'] !== $exp) {
+ printf("[%03d + 4] %s - input = %s/%s, output = %s/%s\n", $offset,
+ $sql_type, var_export($exp, true), gettype($exp),
+ var_export($row['label'], true), gettype($row['label']));
+ return false;
+ }
+
+ }
+
+ $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
+ $stmt = $db->query('SELECT id, label FROM test');
+ $row_string = $stmt->fetch(PDO::FETCH_ASSOC);
+ $stmt->closeCursor();
+ if ($row['label'] != $row_string['label']) {
+ printf("%s - STRINGIGY = %s, NATIVE = %s\n", $sql_type, var_export($row_string['label'], true), var_export($row['label'], true));
+ return false;
+ }
+
+ return true;
+ }
+
+ $db = MySQLPDOTest::factory();
+ $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+ $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
+ $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false);
+
+ $stmt = $db->prepare('SELECT @@sql_mode AS _mode');
+ $stmt->execute();
+ $row = $stmt->fetch(PDO::FETCH_ASSOC);
+ $real_as_float = (false === stristr($row['_mode'], "REAL_AS_FLOAT")) ? false : true;
+
+ test_type($db, 100, 'REAL ZEROFILL', -1.01, NULL, '/^[0]*0$/');
+ test_type($db, 110, 'REAL ZEROFILL', 1.01, NULL, ($real_as_float) ? '/^[0]*1\.0.*$/' : '/^[0]*1\.01$/');
+ test_type($db, 120, 'REAL UNSIGNED ZEROFILL', 1.01, NULL, ($real_as_float) ? '/^[0]*1\..*$/' : '/^[0]*1\.01$/');
+
+ test_type($db, 130, 'DOUBLE ZEROFILL', -1.01, NULL, '/^[0]*0$/');
+ test_type($db, 140, 'DOUBLE ZEROFILL', 1.01, NULL, '/^[0]*1\.01$/');
+ test_type($db, 150, 'DOUBLE UNSIGNED ZEROFILL', 1.01, NULL, '/^[0]*1\.01$/');
+
+ test_type($db, 160, 'FLOAT ZEROFILL', -1.01, NULL, '/^[0]*0$/');
+ test_type($db, 170, 'FLOAT ZEROFILL', 1, NULL, '/^[0]*1$/');
+ test_type($db, 180, 'FLOAT UNSIGNED ZEROFILL', -1, NULL, '/^[0]*0$/');
+
+ test_type($db, 190, 'DECIMAL ZEROFILL', -1.01, NULL, '/^[0]*0$/');
+ test_type($db, 200, 'DECIMAL ZEROFILL', 1.01, NULL, '/^[0]*1$/');
+ test_type($db, 210, 'DECIMAL UNSIGNED ZEROFILL', 1.01, NULL, '/^[0]*1$/');
+
+ test_type($db, 220, 'NUMERIC ZEROFILL', -1, NULL, '/^[0]*0$/');
+ test_type($db, 230, 'NUMERIC ZEROFILL', 1, NULL, '/^[0]*1$/');
+ test_type($db, 240, 'NUMERIC UNSIGNED ZEROFILL', 1.01, NULL, '/^[0]*1$/');
+
+ echo "done!\n";
?>
--CLEAN--
<?php
diff --git a/ext/pdo_mysql/tests/pecl_bug_5200.phpt b/ext/pdo_mysql/tests/pecl_bug_5200.phpt
index d44a5c2282..941dc7836e 100644
--- a/ext/pdo_mysql/tests/pecl_bug_5200.phpt
+++ b/ext/pdo_mysql/tests/pecl_bug_5200.phpt
@@ -15,7 +15,7 @@ $db = PDOTest::test_factory(__DIR__. '/common.phpt');
$db->exec("CREATE TABLE test (bar INT NOT NULL, phase enum('please_select', 'I', 'II', 'IIa', 'IIb', 'III', 'IV'))");
foreach ($db->query('DESCRIBE test phase')->fetchAll(PDO::FETCH_ASSOC) as $row) {
- print_r($row);
+ print_r($row);
}
?>
--CLEAN--
diff --git a/ext/pdo_mysql/tests/skipif.inc b/ext/pdo_mysql/tests/skipif.inc
index e503f55b3c..65c7f34fc6 100644
--- a/ext/pdo_mysql/tests/skipif.inc
+++ b/ext/pdo_mysql/tests/skipif.inc
@@ -1,3 +1,3 @@
<?php
if (!extension_loaded('pdo') || !extension_loaded('pdo_mysql'))
- die('skip PDO_MySQL driver not loaded');
+ die('skip PDO_MySQL driver not loaded');
diff --git a/ext/pdo_mysql/tests/table.inc b/ext/pdo_mysql/tests/table.inc
index 54bf14f07d..9ef8fac134 100644
--- a/ext/pdo_mysql/tests/table.inc
+++ b/ext/pdo_mysql/tests/table.inc
@@ -1,7 +1,7 @@
<?php
if (!$db) {
- require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
- $db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
+ require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
+ $db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
}
// $db->exec('DROP TABLE IF EXISTS test');
$db->exec('CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE=' . $engine);
diff --git a/ext/pdo_oci/oci_driver.c b/ext/pdo_oci/oci_driver.c
index 386789e069..3d9267ba85 100644
--- a/ext/pdo_oci/oci_driver.c
+++ b/ext/pdo_oci/oci_driver.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -541,6 +539,24 @@ static int oci_handle_set_attribute(pdo_dbh_t *dbh, zend_long attr, zval *val) /
return 0;
#endif
}
+ case PDO_OCI_ATTR_CALL_TIMEOUT:
+ {
+#if (OCI_MAJOR_VERSION >= 18)
+ ub4 timeout = (ub4) lval;
+
+ H->last_err = OCIAttrSet(H->svc, OCI_HTYPE_SVCCTX,
+ (dvoid *) &timeout, (ub4) 0,
+ OCI_ATTR_CALL_TIMEOUT, H->err);
+ if (H->last_err) {
+ oci_drv_error("OCIAttrSet: OCI_ATTR_CALL_TIMEOUT");
+ return 0;
+ }
+ return 1;
+#else
+ oci_drv_error("Unsupported attribute type");
+ return 0;
+#endif
+ }
default:
return 0;
}
@@ -608,6 +624,26 @@ static int oci_handle_get_attribute(pdo_dbh_t *dbh, zend_long attr, zval *return
case PDO_ATTR_PREFETCH:
ZVAL_LONG(return_value, H->prefetch);
return TRUE;
+ case PDO_OCI_ATTR_CALL_TIMEOUT:
+ {
+#if (OCI_MAJOR_VERSION >= 18)
+ ub4 timeout;
+
+ H->last_err = OCIAttrGet(H->svc, OCI_HTYPE_SVCCTX,
+ (dvoid *) &timeout, NULL,
+ OCI_ATTR_CALL_TIMEOUT, H->err);
+ if (H->last_err) {
+ oci_drv_error("OCIAttrGet: OCI_ATTR_CALL_TIMEOUT");
+ return FALSE;
+ }
+
+ ZVAL_LONG(return_value, (zend_long) timeout);
+ return TRUE;
+#else
+ oci_drv_error("Unsupported attribute type");
+ return FALSE;
+#endif
+ }
default:
return FALSE;
diff --git a/ext/pdo_oci/oci_statement.c b/ext/pdo_oci/oci_statement.c
index 5d01ae1dab..d25c324eca 100644
--- a/ext/pdo_oci/oci_statement.c
+++ b/ext/pdo_oci/oci_statement.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -782,7 +780,7 @@ static int oci_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, size_t *len
return 1;
} else {
/* it was truncated */
- php_error_docref(NULL, E_WARNING, "column %d data was too large for buffer and was truncated to fit it", colno);
+ php_error_docref(NULL, E_WARNING, "Column %d data was too large for buffer and was truncated to fit it", colno);
*ptr = C->data;
*len = (size_t) C->fetched_len;
diff --git a/ext/pdo_oci/pdo_oci.c b/ext/pdo_oci/pdo_oci.c
index 5fcefbe799..121378492a 100644
--- a/ext/pdo_oci/pdo_oci.c
+++ b/ext/pdo_oci/pdo_oci.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -94,6 +92,7 @@ PHP_MINIT_FUNCTION(pdo_oci)
REGISTER_PDO_CLASS_CONST_LONG("OCI_ATTR_CLIENT_INFO", (zend_long)PDO_OCI_ATTR_CLIENT_INFO);
REGISTER_PDO_CLASS_CONST_LONG("OCI_ATTR_CLIENT_IDENTIFIER", (zend_long)PDO_OCI_ATTR_CLIENT_IDENTIFIER);
REGISTER_PDO_CLASS_CONST_LONG("OCI_ATTR_MODULE", (zend_long)PDO_OCI_ATTR_MODULE);
+ REGISTER_PDO_CLASS_CONST_LONG("OCI_ATTR_CALL_TIMEOUT", (zend_long)PDO_OCI_ATTR_CALL_TIMEOUT);
php_pdo_register_driver(&pdo_oci_driver);
diff --git a/ext/pdo_oci/php_pdo_oci.h b/ext/pdo_oci/php_pdo_oci.h
index 7d49e1d775..f5215d914e 100644
--- a/ext/pdo_oci/php_pdo_oci.h
+++ b/ext/pdo_oci/php_pdo_oci.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/pdo_oci/php_pdo_oci_int.h b/ext/pdo_oci/php_pdo_oci_int.h
index 683ef037cf..488daf54e5 100644
--- a/ext/pdo_oci/php_pdo_oci_int.h
+++ b/ext/pdo_oci/php_pdo_oci_int.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -104,5 +102,6 @@ enum {
PDO_OCI_ATTR_ACTION = PDO_ATTR_DRIVER_SPECIFIC,
PDO_OCI_ATTR_CLIENT_INFO,
PDO_OCI_ATTR_CLIENT_IDENTIFIER,
- PDO_OCI_ATTR_MODULE
+ PDO_OCI_ATTR_MODULE,
+ PDO_OCI_ATTR_CALL_TIMEOUT
};
diff --git a/ext/pdo_oci/tests/bug46274.phpt b/ext/pdo_oci/tests/bug46274.phpt
index 91aa5c883f..388d297199 100644
--- a/ext/pdo_oci/tests/bug46274.phpt
+++ b/ext/pdo_oci/tests/bug46274.phpt
@@ -16,7 +16,7 @@ $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
try {
- $db->exec("DROP TABLE test_one_blob");
+ $db->exec("DROP TABLE test_one_blob");
} catch (Exception $e) {
}
diff --git a/ext/pdo_oci/tests/bug46274_2.phpt b/ext/pdo_oci/tests/bug46274_2.phpt
index 434cdbc218..cf2618366e 100644
--- a/ext/pdo_oci/tests/bug46274_2.phpt
+++ b/ext/pdo_oci/tests/bug46274_2.phpt
@@ -16,7 +16,7 @@ $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false);
try {
- $db->exec("DROP TABLE test_one_blob");
+ $db->exec("DROP TABLE test_one_blob");
} catch (Exception $e) {
}
diff --git a/ext/pdo_oci/tests/bug57702.phpt b/ext/pdo_oci/tests/bug57702.phpt
index ff64399a9a..12f91226c6 100644
--- a/ext/pdo_oci/tests/bug57702.phpt
+++ b/ext/pdo_oci/tests/bug57702.phpt
@@ -25,20 +25,20 @@ $stmt->execute();
function do_insert($db, $id, $data1, $data2)
{
- $db->beginTransaction();
- $stmt = $db->prepare("insert into bug57702 (id, data1, data2) values (:id, empty_blob(), empty_blob()) returning data1, data2 into :blob1, :blob2");
- $stmt->bindParam(':id', $id);
- $stmt->bindParam(':blob1', $blob1, PDO::PARAM_LOB);
- $stmt->bindParam(':blob2', $blob2, PDO::PARAM_LOB);
- $blob1 = null;
- $blob2 = null;
- $stmt->execute();
-
- fwrite($blob1, $data1);
- fclose($blob1);
- fwrite($blob2, $data2);
- fclose($blob2);
- $db->commit();
+ $db->beginTransaction();
+ $stmt = $db->prepare("insert into bug57702 (id, data1, data2) values (:id, empty_blob(), empty_blob()) returning data1, data2 into :blob1, :blob2");
+ $stmt->bindParam(':id', $id);
+ $stmt->bindParam(':blob1', $blob1, PDO::PARAM_LOB);
+ $stmt->bindParam(':blob2', $blob2, PDO::PARAM_LOB);
+ $blob1 = null;
+ $blob2 = null;
+ $stmt->execute();
+
+ fwrite($blob1, $data1);
+ fclose($blob1);
+ fwrite($blob2, $data2);
+ fclose($blob2);
+ $db->commit();
}
do_insert($db, 1, "row 1 col 1", "row 1 col 2");
@@ -63,8 +63,8 @@ var_dump($row['data2']);
echo "\nSecond Query\n";
foreach($db->query("select data1 as d1, data2 as d2 from bug57702 order by id") as $row) {
- var_dump($row['d1']);
- var_dump($row['d2']);
+ var_dump($row['d1']);
+ var_dump($row['d2']);
}
////////////////////
@@ -89,8 +89,8 @@ echo "\nFourth Query\n";
$a = array();
$i = 0;
foreach($db->query("select data1 as d4_1, data2 as d4_2 from bug57702 order by id") as $row) {
- $a[$i][0] = $row['d4_1'];
- $a[$i][1] = $row['d4_2'];
+ $a[$i][0] = $row['d4_1'];
+ $a[$i][1] = $row['d4_2'];
$i++;
}
@@ -112,8 +112,8 @@ $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); // Let's use streams
$a = array();
$i = 0;
foreach($db->query("select data1 as d4_1, data2 as d4_2 from bug57702 order by id") as $row) {
- $a[$i][0] = $row['d4_1'];
- $a[$i][1] = $row['d4_2'];
+ $a[$i][0] = $row['d4_1'];
+ $a[$i][1] = $row['d4_2'];
$i++;
}
@@ -131,11 +131,11 @@ $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); // Let's use streams
$a = array();
$i = 0;
foreach($db->query("select data1 as d4_1, data2 as d4_2 from bug57702 order by id") as $row) {
- $a[$i][0] = $row['d4_1'];
- $a[$i][1] = $row['d4_2'];
- var_dump(stream_get_contents($a[$i][0]));
- var_dump(stream_get_contents($a[$i][1]));
- $i++;
+ $a[$i][0] = $row['d4_1'];
+ $a[$i][1] = $row['d4_2'];
+ var_dump(stream_get_contents($a[$i][0]));
+ var_dump(stream_get_contents($a[$i][1]));
+ $i++;
}
// Cleanup
diff --git a/ext/pdo_oci/tests/bug_33707.phpt b/ext/pdo_oci/tests/bug_33707.phpt
index 9b682cac95..7765d36343 100644
--- a/ext/pdo_oci/tests/bug_33707.phpt
+++ b/ext/pdo_oci/tests/bug_33707.phpt
@@ -12,7 +12,7 @@ require 'ext/pdo/tests/pdo_test.inc';
$db = PDOTest::test_factory('ext/pdo_oci/tests/common.phpt');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
-$rs = $db->query('select blah from a_table_that_doesnt_exist');
+$rs = $db->query('select blah from a_table_that_does_not_exist');
var_dump($rs);
var_dump($db->errorInfo());
--EXPECTF--
diff --git a/ext/pdo_oci/tests/pdo_oci_attr_autocommit_2.phpt b/ext/pdo_oci/tests/pdo_oci_attr_autocommit_2.phpt
index f208fd56d9..bfe4c59f87 100644
--- a/ext/pdo_oci/tests/pdo_oci_attr_autocommit_2.phpt
+++ b/ext/pdo_oci/tests/pdo_oci_attr_autocommit_2.phpt
@@ -22,28 +22,28 @@ echo "Test 1 Check beginTransaction insertion\n";
$dbh->beginTransaction();
try {
- $dbh->exec("insert into pdo_ac_tab (col1) values ('data 1')");
- $dbh->exec("insert into pdo_ac_tab (col1) values ('data 2')");
- $dbh->commit();
+ $dbh->exec("insert into pdo_ac_tab (col1) values ('data 1')");
+ $dbh->exec("insert into pdo_ac_tab (col1) values ('data 2')");
+ $dbh->commit();
}
catch (PDOException $e) {
- echo "Caught unexpected exception at line " . __LINE__ . "\n";
- echo $e->getMessage() . "\n";
- $dbh->rollback();
+ echo "Caught unexpected exception at line " . __LINE__ . "\n";
+ echo $e->getMessage() . "\n";
+ $dbh->rollback();
}
echo "Test 2 Cause an exception and test beginTransaction rollback\n";
$dbh->beginTransaction();
try {
- $dbh->exec("insert into pdo_ac_tab (col1) values ('not committed #1')");
- $dbh->exec("insert into pdo_ac_tab (col1) values ('data that is too long to fit and will barf')");
- $dbh->commit();
+ $dbh->exec("insert into pdo_ac_tab (col1) values ('not committed #1')");
+ $dbh->exec("insert into pdo_ac_tab (col1) values ('data that is too long to fit and will barf')");
+ $dbh->commit();
}
catch (PDOException $e) {
- echo "Caught expected exception at line " . __LINE__ . "\n";
- echo $e->getMessage() . "\n";
- $dbh->rollback();
+ echo "Caught expected exception at line " . __LINE__ . "\n";
+ echo $e->getMessage() . "\n";
+ $dbh->rollback();
}
echo "Test 3 Setting ATTR_AUTOCOMMIT to true will commit and end the transaction\n";
@@ -53,11 +53,11 @@ $dbh->setAttribute(PDO::ATTR_AUTOCOMMIT, true);
print "PDO::ATTR_AUTOCOMMIT: ";
var_dump($dbh->getAttribute(PDO::ATTR_AUTOCOMMIT));
try {
- $dbh->rollback();
+ $dbh->rollback();
}
catch (PDOException $e) {
- echo "Caught expected exception at line " . __LINE__ . "\n";
- echo $e->getMessage() . "\n";
+ echo "Caught expected exception at line " . __LINE__ . "\n";
+ echo $e->getMessage() . "\n";
}
echo "Test 4 Setting ATTR_AUTOCOMMIT to false will commit and end the transaction\n";
@@ -68,11 +68,11 @@ $dbh->setAttribute(PDO::ATTR_AUTOCOMMIT, false);
print "PDO::ATTR_AUTOCOMMIT: ";
var_dump($dbh->getAttribute(PDO::ATTR_AUTOCOMMIT));
try {
- $dbh->rollback();
+ $dbh->rollback();
}
catch (PDOException $e) {
- echo "Caught expected exception at line " . __LINE__ . "\n";
- echo $e->getMessage() . "\n";
+ echo "Caught expected exception at line " . __LINE__ . "\n";
+ echo $e->getMessage() . "\n";
}
echo "Test 5 Handle transactions ourselves\n";
diff --git a/ext/pdo_oci/tests/pdo_oci_attr_call_timeout.phpt b/ext/pdo_oci/tests/pdo_oci_attr_call_timeout.phpt
new file mode 100644
index 0000000000..31df15320e
--- /dev/null
+++ b/ext/pdo_oci/tests/pdo_oci_attr_call_timeout.phpt
@@ -0,0 +1,66 @@
+--TEST--
+PDO_OCI: Attribute: Setting and using call timeout
+--SKIPIF--
+<?php
+if (getenv('SKIP_SLOW_TESTS')) die('skip slow tests excluded by request');
+if (!extension_loaded('pdo') || !extension_loaded('pdo_oci')) die('skip not loaded');
+require(__DIR__.'/../../pdo/tests/pdo_test.inc');
+PDOTest::skip();
+if (strcasecmp(getenv('PDOTEST_USER'), "system") && strcasecmp(getenv('PDOTEST_USER'), "sys")) {
+ die("skip needs to be run as a user with access to DBMS_LOCK");
+}
+
+$dbh = PDOTest::factory();
+preg_match('/^[[:digit:]]+/', $dbh->getAttribute(PDO::ATTR_CLIENT_VERSION), $matches);
+if (!(isset($matches[0]) && $matches[0] >= 18)) {
+ die("skip works only with Oracle 18c or greater version of Oracle client libraries");
+}
+
+?>
+--FILE--
+<?php
+
+require(__DIR__ . '/../../pdo/tests/pdo_test.inc');
+
+function mysleep($dbh, $t)
+{
+ $stmt = $dbh->prepare("begin dbms_lock.sleep(:t); end;");
+
+ if (!$stmt) {
+ $error = $dbh->errorInfo();
+ echo "Prepare error was ", $error[2], "\n";
+ return;
+ }
+ $stmt->bindParam(":t", $t, PDO::PARAM_INT);
+
+ $r = $stmt->execute();
+ if ($r) {
+ echo "Execute succeeded\n";
+ } else {
+ $error = $dbh->errorInfo();
+ echo "Execute error was ", $error[2], "\n";
+ }
+}
+
+$dbh = PDOTest::factory();
+$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
+
+echo "Test 1\n";
+
+$dbh->setAttribute(PDO::OCI_ATTR_CALL_TIMEOUT, 4000); // milliseconds
+
+echo "call timeout:\n";
+var_dump($dbh->getAttribute(PDO::OCI_ATTR_CALL_TIMEOUT));
+
+$r = mysleep($dbh, 8); // seconds
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+call timeout:
+int(4000)
+Execute error was OCIStmtExecute: ORA-%r(03136|03156)%r: %s
+ (%s:%d)
+===DONE===
diff --git a/ext/pdo_oci/tests/pdo_oci_attr_case.phpt b/ext/pdo_oci/tests/pdo_oci_attr_case.phpt
index 5ad89af6b1..09821cb74d 100644
--- a/ext/pdo_oci/tests/pdo_oci_attr_case.phpt
+++ b/ext/pdo_oci/tests/pdo_oci_attr_case.phpt
@@ -13,22 +13,22 @@ require(__DIR__ . '/../../pdo/tests/pdo_test.inc');
function do_query1($dbh)
{
- var_dump($dbh->getAttribute(PDO::ATTR_CASE));
- $s = $dbh->prepare("select dummy from dual");
- $s->execute();
- while ($r = $s->fetch(PDO::FETCH_ASSOC)) {
- var_dump($r);
- }
+ var_dump($dbh->getAttribute(PDO::ATTR_CASE));
+ $s = $dbh->prepare("select dummy from dual");
+ $s->execute();
+ while ($r = $s->fetch(PDO::FETCH_ASSOC)) {
+ var_dump($r);
+ }
}
function do_query2($dbh, $mode)
{
- echo "Mode desired is $mode\n";
- $s = $dbh->prepare("select dummy from dual", array(PDO::ATTR_CASE, $mode));
- $s->execute();
- while ($r = $s->fetch(PDO::FETCH_ASSOC)) {
- var_dump($r);
- }
+ echo "Mode desired is $mode\n";
+ $s = $dbh->prepare("select dummy from dual", array(PDO::ATTR_CASE, $mode));
+ $s->execute();
+ while ($r = $s->fetch(PDO::FETCH_ASSOC)) {
+ var_dump($r);
+ }
}
$dbh = PDOTest::factory();
diff --git a/ext/pdo_oci/tests/pdo_oci_attr_client.phpt b/ext/pdo_oci/tests/pdo_oci_attr_client.phpt
index 3febab71ea..fdb65cf156 100644
--- a/ext/pdo_oci/tests/pdo_oci_attr_client.phpt
+++ b/ext/pdo_oci/tests/pdo_oci_attr_client.phpt
@@ -19,19 +19,19 @@ var_dump($cv);
$s = explode(".", $cv);
if (count($s) > 1 && (($s[0] == 10 && $s[1] >= 2) || $s[0] >= 11)) {
- if (count($s) != 5) {
- echo "Wrong number of values in array\nVersion was: ";
- var_dump($cv);
- } else {
- echo "Version OK, so far as can be portably checked\n";
- }
+ if (count($s) != 5) {
+ echo "Wrong number of values in array\nVersion was: ";
+ var_dump($cv);
+ } else {
+ echo "Version OK, so far as can be portably checked\n";
+ }
} else {
- if (count($s) != 2) {
- echo "Wrong number of values in array\nVersion was: ";
- var_dump($cv);
- } else {
- echo "Version OK, so far as can be portably checked\n";
- }
+ if (count($s) != 2) {
+ echo "Wrong number of values in array\nVersion was: ";
+ var_dump($cv);
+ } else {
+ echo "Version OK, so far as can be portably checked\n";
+ }
}
echo "Done\n";
diff --git a/ext/pdo_oci/tests/pdo_oci_attr_nulls_1.phpt b/ext/pdo_oci/tests/pdo_oci_attr_nulls_1.phpt
index 2a38341b27..cb8edba543 100644
--- a/ext/pdo_oci/tests/pdo_oci_attr_nulls_1.phpt
+++ b/ext/pdo_oci/tests/pdo_oci_attr_nulls_1.phpt
@@ -13,13 +13,13 @@ require(__DIR__ . '/../../pdo/tests/pdo_test.inc');
function do_query($dbh)
{
- var_dump($dbh->getAttribute(PDO::ATTR_ORACLE_NULLS));
- $s = $dbh->prepare("select '' as myempty, null as mynull from dual");
- $s->execute();
- while ($r = $s->fetch()) {
- var_dump($r[0]);
- var_dump($r[1]);
- }
+ var_dump($dbh->getAttribute(PDO::ATTR_ORACLE_NULLS));
+ $s = $dbh->prepare("select '' as myempty, null as mynull from dual");
+ $s->execute();
+ while ($r = $s->fetch()) {
+ var_dump($r[0]);
+ var_dump($r[1]);
+ }
}
$dbh = PDOTest::factory();
diff --git a/ext/pdo_oci/tests/pdo_oci_attr_server.phpt b/ext/pdo_oci/tests/pdo_oci_attr_server.phpt
index 566bd0749d..e17401ddac 100644
--- a/ext/pdo_oci/tests/pdo_oci_attr_server.phpt
+++ b/ext/pdo_oci/tests/pdo_oci_attr_server.phpt
@@ -22,10 +22,10 @@ echo "ATTR_SERVER_INFO\n";
$si = $dbh->getAttribute(PDO::ATTR_SERVER_INFO);
$pos = strpos($si, "Oracle");
if ($pos === 0) {
- echo "Found 'Oracle' at position $pos as expected\n";
+ echo "Found 'Oracle' at position $pos as expected\n";
} else {
- echo "Unexpected result. Server info was:\n";
- var_dump($si);
+ echo "Unexpected result. Server info was:\n";
+ var_dump($si);
}
echo "Done\n";
diff --git a/ext/pdo_oci/tests/pdo_oci_class_constants.phpt b/ext/pdo_oci/tests/pdo_oci_class_constants.phpt
index 265e84b9ba..f66c825245 100644
--- a/ext/pdo_oci/tests/pdo_oci_class_constants.phpt
+++ b/ext/pdo_oci/tests/pdo_oci_class_constants.phpt
@@ -12,10 +12,11 @@ PDOTest::skip();
require(__DIR__ . '/../../pdo/tests/pdo_test.inc');
$expected = [
- 'OCI_ATTR_CLIENT_INFO' => true,
- 'OCI_ATTR_ACTION' => true,
- 'OCI_ATTR_CLIENT_IDENTIFIER' => true,
- 'OCI_ATTR_MODULE' => true,
+ 'OCI_ATTR_CLIENT_INFO' => true,
+ 'OCI_ATTR_ACTION' => true,
+ 'OCI_ATTR_CLIENT_IDENTIFIER' => true,
+ 'OCI_ATTR_MODULE' => true,
+ 'OCI_ATTR_CALL_TIMEOUT' => true,
];
$ref = new ReflectionClass('PDO');
@@ -23,40 +24,40 @@ $constants = $ref->getConstants();
$values = [];
foreach ($constants as $name => $value) {
- if (substr($name, 0, 8) == 'OCI_ATTR') {
- if (!isset($values[$value])) {
- $values[$value] = [$name];
+ if (substr($name, 0, 8) == 'OCI_ATTR') {
+ if (!isset($values[$value])) {
+ $values[$value] = [$name];
} else {
- $values[$value][] = $name;
+ $values[$value][] = $name;
}
- if (isset($expected[$name])) {
- unset($expected[$name]);
- unset($constants[$name]);
- }
+ if (isset($expected[$name])) {
+ unset($expected[$name]);
+ unset($constants[$name]);
+ }
- } else {
- unset($constants[$name]);
- }
+ } else {
+ unset($constants[$name]);
+ }
}
if (!empty($constants)) {
- printf("[001] Dumping list of unexpected constants\n");
- var_dump($constants);
+ printf("[001] Dumping list of unexpected constants\n");
+ var_dump($constants);
}
if (!empty($expected)) {
- printf("[002] Dumping list of missing constants\n");
- var_dump($expected);
+ printf("[002] Dumping list of missing constants\n");
+ var_dump($expected);
}
if (!empty($values)) {
- foreach ($values as $value => $constants) {
- if (count($constants) > 1) {
- printf("[003] Several constants share the same value '%s'\n", $value);
- var_dump($constants);
- }
- }
+ foreach ($values as $value => $constants) {
+ if (count($constants) > 1) {
+ printf("[003] Several constants share the same value '%s'\n", $value);
+ var_dump($constants);
+ }
+ }
}
print "done!";
diff --git a/ext/pdo_oci/tests/pdo_oci_debugdumpparams.phpt b/ext/pdo_oci/tests/pdo_oci_debugdumpparams.phpt
new file mode 100644
index 0000000000..ad88b25ee0
--- /dev/null
+++ b/ext/pdo_oci/tests/pdo_oci_debugdumpparams.phpt
@@ -0,0 +1,37 @@
+--TEST--
+PDO_OCI: Bug #69356 (PDOStatement::debugDumpParams() truncates query)
+--SKIPIF--
+<?php
+if (!extension_loaded('pdo') || !extension_loaded('pdo_oci')) die('skip not loaded');
+require(__DIR__.'/../../pdo/tests/pdo_test.inc');
+PDOTest::skip();
+?>
+--FILE--
+<?php
+require(__DIR__ . '/../../pdo/tests/pdo_test.inc');
+
+$db = PDOTest::factory();
+$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
+$stmt = $db->query("
+ SELECT '
+ Dumps the information contained by a prepared statement directly on the output. It will provide the SQL query in use, the number of parameters used (Params), the list of parameters, with their name, type (paramtype) as an integer, their key name or position, and the position in the query (if this is supported by the PDO driver, otherwise, it will be -1).
+ This is a debug function, which dump directly the data on the normal output.
+ Tip:
+ As with anything that outputs its result directly to the browser, the output-control functions can be used to capture the output of this function, and save it in a string (for example).
+ This will only dumps the parameters in the statement at the moment of the dump. Extra parameters are not stored in the statement, and not displayed.
+ ' FROM DUAL
+");
+var_dump($stmt->debugDumpParams());
+?>
+--EXPECT--
+SQL: [844]
+ SELECT '
+ Dumps the information contained by a prepared statement directly on the output. It will provide the SQL query in use, the number of parameters used (Params), the list of parameters, with their name, type (paramtype) as an integer, their key name or position, and the position in the query (if this is supported by the PDO driver, otherwise, it will be -1).
+ This is a debug function, which dump directly the data on the normal output.
+ Tip:
+ As with anything that outputs its result directly to the browser, the output-control functions can be used to capture the output of this function, and save it in a string (for example).
+ This will only dumps the parameters in the statement at the moment of the dump. Extra parameters are not stored in the statement, and not displayed.
+ ' FROM DUAL
+
+Params: 0
+NULL
diff --git a/ext/pdo_oci/tests/pdo_oci_fread_1.phpt b/ext/pdo_oci/tests/pdo_oci_fread_1.phpt
index 0fa06c9ce4..85a0ca19ed 100644
--- a/ext/pdo_oci/tests/pdo_oci_fread_1.phpt
+++ b/ext/pdo_oci/tests/pdo_oci_fread_1.phpt
@@ -19,7 +19,7 @@ $dbh->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false);
// Initialization
$stmtarray = array(
"begin execute immediate 'drop table pdo_oci_fread_tab'; exception when others then null; end;",
- "create table pdo_oci_fread_tab (id number, data clob)",
+ "create table pdo_oci_fread_tab (id number, data clob)",
"declare
lob1 clob := 'abc' || lpad('j',4020,'j') || 'xyz';
begin
@@ -28,7 +28,7 @@ $stmtarray = array(
);
foreach ($stmtarray as $stmt) {
- $dbh->exec($stmt);
+ $dbh->exec($stmt);
}
echo "Test 1\n";
@@ -47,11 +47,11 @@ fclose($sh);
// Clean up
$stmtarray = array(
- "drop table pdo_oci_fread_tab"
+ "drop table pdo_oci_fread_tab"
);
foreach ($stmtarray as $stmt) {
- $dbh->exec($stmt);
+ $dbh->exec($stmt);
}
?>
diff --git a/ext/pdo_oci/tests/pdo_oci_quote1.phpt b/ext/pdo_oci/tests/pdo_oci_quote1.phpt
index b71ff17e80..415917829f 100644
--- a/ext/pdo_oci/tests/pdo_oci_quote1.phpt
+++ b/ext/pdo_oci/tests/pdo_oci_quote1.phpt
@@ -21,17 +21,17 @@ $stmt = $db->prepare('select * from poq_tab');
$a = array(null, "", "a", "ab", "abc", "ab'cd", "a\b\n", "'", "''", "a'", "'z", "a''b", '"');
foreach ($a as $u) {
- $q = $db->quote($u);
- echo "Unquoted : ";
- var_dump($u);
- echo "Quoted : ";
- var_dump($q);
+ $q = $db->quote($u);
+ echo "Unquoted : ";
+ var_dump($u);
+ echo "Quoted : ";
+ var_dump($q);
- $db->exec("delete from poq_tab");
+ $db->exec("delete from poq_tab");
- $db->query("insert into poq_tab (t) values($q)");
- $stmt->execute();
- var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+ $db->query("insert into poq_tab (t) values($q)");
+ $stmt->execute();
+ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
}
echo "Done\n";
diff --git a/ext/pdo_oci/tests/pdo_oci_stmt_getcolumnmeta.phpt b/ext/pdo_oci/tests/pdo_oci_stmt_getcolumnmeta.phpt
index b56ff9a4f0..4f3a19c8be 100644
--- a/ext/pdo_oci/tests/pdo_oci_stmt_getcolumnmeta.phpt
+++ b/ext/pdo_oci/tests/pdo_oci_stmt_getcolumnmeta.phpt
@@ -13,116 +13,116 @@ echo "Preparations before the test\n";
require(__DIR__ . '/../../pdo/tests/pdo_test.inc');
try {
- $db = PDOTest::factory();
- $db->exec(<<<SQL
+ $db = PDOTest::factory();
+ $db->exec(<<<SQL
BEGIN
EXECUTE IMMEDIATE 'DROP TABLE test';
EXCEPTION
WHEN OTHERS THEN
IF SQLCODE != -942 THEN
- RAISE;
+ RAISE;
END IF;
END;
SQL
);
- $db->exec("CREATE TABLE test(id INT)");
-
- $db->beginTransaction();
-
- $stmt = $db->prepare('SELECT id FROM test ORDER BY id ASC');
-
- echo "Test 1. calling function with invalid parameters\n";
-
- // execute() has not been called yet
- // NOTE: no warning
- if (false !== ($tmp = $stmt->getColumnMeta(0)))
- printf("[002] Expecting false got %s\n", var_export($tmp, true));
-
- $stmt->execute();
- // Warning: PDOStatement::getColumnMeta() expects exactly 1 parameter, 0 given in
- if (false !== ($tmp = @$stmt->getColumnMeta()))
- printf("[003] Expecting false got %s\n", var_export($tmp, true));
-
- // invalid offset
- if (false !== ($tmp = @$stmt->getColumnMeta(-1)))
- printf("[004] Expecting false got %s\n", var_export($tmp, true));
-
- // Warning: PDOStatement::getColumnMeta() expects parameter 1 to be int, array given in
- if (false !== ($tmp = @$stmt->getColumnMeta(array())))
- printf("[005] Expecting false got %s\n", var_export($tmp, true));
-
- // Warning: PDOStatement::getColumnMeta() expects exactly 1 parameter, 2 given in
- if (false !== ($tmp = @$stmt->getColumnMeta(1, 1)))
- printf("[006] Expecting false got %s\n", var_export($tmp, true));
-
- // invalid offset
- if (false !== ($tmp = $stmt->getColumnMeta(1)))
- printf("[007] Expecting false because of invalid offset got %s\n", var_export($tmp, true));
-
- echo "Test 2. testing return values\n";
- echo "Test 2.1 testing array returned\n";
-
- $stmt = $db->prepare('SELECT id FROM test ORDER BY id ASC');
- $stmt->execute();
- $native = $stmt->getColumnMeta(0);
- if (count($native) == 0) {
- printf("[008] Meta data seems wrong, %s / %s\n",
- var_export($native, true), var_export($emulated, true));
- }
-
-
- function test_return($meta, $offset, $native_type, $pdo_type){
- if (empty($meta)) {
- printf("[%03d + 2] getColumnMeta() failed, %d - %s\n", $offset,
- $stmt->errorCode(), var_export($stmt->errorInfo(), true));
- return false;
- }
- $elements = array('flags', 'scale', 'name', 'len', 'precision', 'pdo_type');
- foreach ($elements as $k => $element)
- if (!isset($meta[$element])) {
- printf("[%03d + 3] Element %s missing, %s\n", $offset,
- $element, var_export($meta, true));
- return false;
- }
-
- if (!is_null($native_type)) {
- if (!isset($meta['native_type'])) {
- printf("[%03d + 4] Element native_type missing, %s\n", $offset,
- var_export($meta, true));
- return false;
- }
-
- if (!is_array($native_type))
- $native_type = array($native_type);
-
- $found = false;
- foreach ($native_type as $k => $type) {
- if ($meta['native_type'] == $type) {
- $found = true;
- break;
- }
- }
-
- if (!$found) {
- printf("[%03d + 5] Expecting native type %s, %s\n", $offset,
- var_export($native_type, true), var_export($meta, true));
- return false;
- }
- }
-
- if (!is_null($pdo_type) && ($meta['pdo_type'] != $pdo_type)) {
- printf("[%03d + 6] Expecting PDO type %s got %s (%s)\n", $offset,
- $pdo_type, var_export($meta, true), var_export($meta['native_type']));
- return false;
- }
-
- return true;
- }
-
-
- function test_meta(&$db, $offset, $sql_type, $value, $native_type, $pdo_type) {
-
- $db->exec(<<<SQL
+ $db->exec("CREATE TABLE test(id INT)");
+
+ $db->beginTransaction();
+
+ $stmt = $db->prepare('SELECT id FROM test ORDER BY id ASC');
+
+ echo "Test 1. calling function with invalid parameters\n";
+
+ // execute() has not been called yet
+ // NOTE: no warning
+ if (false !== ($tmp = $stmt->getColumnMeta(0)))
+ printf("[002] Expecting false got %s\n", var_export($tmp, true));
+
+ $stmt->execute();
+ // Warning: PDOStatement::getColumnMeta() expects exactly 1 parameter, 0 given in
+ if (false !== ($tmp = @$stmt->getColumnMeta()))
+ printf("[003] Expecting false got %s\n", var_export($tmp, true));
+
+ // invalid offset
+ if (false !== ($tmp = @$stmt->getColumnMeta(-1)))
+ printf("[004] Expecting false got %s\n", var_export($tmp, true));
+
+ // Warning: PDOStatement::getColumnMeta() expects parameter 1 to be int, array given in
+ if (false !== ($tmp = @$stmt->getColumnMeta(array())))
+ printf("[005] Expecting false got %s\n", var_export($tmp, true));
+
+ // Warning: PDOStatement::getColumnMeta() expects exactly 1 parameter, 2 given in
+ if (false !== ($tmp = @$stmt->getColumnMeta(1, 1)))
+ printf("[006] Expecting false got %s\n", var_export($tmp, true));
+
+ // invalid offset
+ if (false !== ($tmp = $stmt->getColumnMeta(1)))
+ printf("[007] Expecting false because of invalid offset got %s\n", var_export($tmp, true));
+
+ echo "Test 2. testing return values\n";
+ echo "Test 2.1 testing array returned\n";
+
+ $stmt = $db->prepare('SELECT id FROM test ORDER BY id ASC');
+ $stmt->execute();
+ $native = $stmt->getColumnMeta(0);
+ if (count($native) == 0) {
+ printf("[008] Meta data seems wrong, %s / %s\n",
+ var_export($native, true), var_export($emulated, true));
+ }
+
+
+ function test_return($meta, $offset, $native_type, $pdo_type){
+ if (empty($meta)) {
+ printf("[%03d + 2] getColumnMeta() failed, %d - %s\n", $offset,
+ $stmt->errorCode(), var_export($stmt->errorInfo(), true));
+ return false;
+ }
+ $elements = array('flags', 'scale', 'name', 'len', 'precision', 'pdo_type');
+ foreach ($elements as $k => $element)
+ if (!isset($meta[$element])) {
+ printf("[%03d + 3] Element %s missing, %s\n", $offset,
+ $element, var_export($meta, true));
+ return false;
+ }
+
+ if (!is_null($native_type)) {
+ if (!isset($meta['native_type'])) {
+ printf("[%03d + 4] Element native_type missing, %s\n", $offset,
+ var_export($meta, true));
+ return false;
+ }
+
+ if (!is_array($native_type))
+ $native_type = array($native_type);
+
+ $found = false;
+ foreach ($native_type as $k => $type) {
+ if ($meta['native_type'] == $type) {
+ $found = true;
+ break;
+ }
+ }
+
+ if (!$found) {
+ printf("[%03d + 5] Expecting native type %s, %s\n", $offset,
+ var_export($native_type, true), var_export($meta, true));
+ return false;
+ }
+ }
+
+ if (!is_null($pdo_type) && ($meta['pdo_type'] != $pdo_type)) {
+ printf("[%03d + 6] Expecting PDO type %s got %s (%s)\n", $offset,
+ $pdo_type, var_export($meta, true), var_export($meta['native_type']));
+ return false;
+ }
+
+ return true;
+ }
+
+
+ function test_meta(&$db, $offset, $sql_type, $value, $native_type, $pdo_type) {
+
+ $db->exec(<<<SQL
BEGIN
EXECUTE IMMEDIATE 'DROP TABLE test';
EXCEPTION
@@ -134,77 +134,77 @@ END;
SQL
);
- $sql = sprintf('CREATE TABLE test(id INT, label %s)', $sql_type);
- $stmt = $db->prepare($sql);
- $stmt->execute();
-
- if (!$db->exec(sprintf("INSERT INTO test(id, label) VALUES (1, '%s')", $value))) {
- printf("[%03d] + 1] Insert failed, %d - %s\n", $offset,
- $db->errorCode(), var_export($db->errorInfo(), true));
- return false;
- }
-
- $stmt = $db->prepare('SELECT id, label FROM test');
- $stmt->execute();
- $meta = $stmt->getColumnMeta(1);
- return test_return($meta, $offset, $native_type, $pdo_type);
- }
-
- echo "Test 2.2 testing numeric columns\n";
-
- test_meta($db, 20, 'NUMBER' , 0 , 'NUMBER', PDO::PARAM_STR);
- test_meta($db, 30, 'NUMBER' , 256 , 'NUMBER', PDO::PARAM_STR);
- test_meta($db, 40, 'INT' , 256 , 'NUMBER', PDO::PARAM_STR);
- test_meta($db, 50, 'INTEGER' , 256 , 'NUMBER', PDO::PARAM_STR);
- test_meta($db, 60, 'NUMBER' , 256.01 , 'NUMBER', PDO::PARAM_STR);
- test_meta($db, 70, 'NUMBER' , -8388608 , 'NUMBER', PDO::PARAM_STR);
-
- test_meta($db, 80, 'NUMBER' , 2147483648 , 'NUMBER', PDO::PARAM_STR);
- test_meta($db, 90, 'NUMBER' , 4294967295 , 'NUMBER', PDO::PARAM_STR);
-
- test_meta($db, 100, 'DEC' , 1.01 , 'NUMBER' , PDO::PARAM_STR);
- test_meta($db, 110, 'DECIMAL' , 1.01 , 'NUMBER' , PDO::PARAM_STR);
- test_meta($db, 120, 'FLOAT' , 1.01 , 'FLOAT' , PDO::PARAM_STR);
- test_meta($db, 130, 'DOUBLE PRECISION', 1.01 , 'FLOAT' , PDO::PARAM_STR);
- test_meta($db, 140, 'BINARY_FLOAT' , 1.01 , 'BINARY_FLOAT' , PDO::PARAM_STR);
- test_meta($db, 150, 'BINARY_DOUBLE' , 1.01 , 'BINARY_DOUBLE', PDO::PARAM_STR);
-
- echo "Test 2.3 testing temporal columns\n";
-
- $db->exec("alter session set nls_date_format='YYYY-MM-DD'");
- test_meta($db, 160, 'DATE' , '2008-04-23' , 'DATE', PDO::PARAM_STR);
-
- echo "Test 2.4 testing string columns\n";
-
- test_meta($db, 170, 'CHAR(1)' , 'a' , 'CHAR' , PDO::PARAM_STR);
- test_meta($db, 180, 'CHAR(10)' , '0123456789' , 'CHAR' , PDO::PARAM_STR);
- test_meta($db, 190, 'CHAR(255)' , str_repeat('z', 255) , 'CHAR' , PDO::PARAM_STR);
- test_meta($db, 200, 'VARCHAR(1)' , 'a' , 'VARCHAR2' , PDO::PARAM_STR);
- test_meta($db, 210, 'VARCHAR(10)' , '0123456789' , 'VARCHAR2' , PDO::PARAM_STR);
- test_meta($db, 220, 'VARCHAR(255)' , str_repeat('z', 255) , 'VARCHAR2' , PDO::PARAM_STR);
- test_meta($db, 230, 'VARCHAR2(1)' , 'a' , 'VARCHAR2' , PDO::PARAM_STR);
- test_meta($db, 240, 'VARCHAR2(10)' , '0123456789' , 'VARCHAR2' , PDO::PARAM_STR);
- test_meta($db, 250, 'VARCHAR2(255)' , str_repeat('z', 255) , 'VARCHAR2' , PDO::PARAM_STR);
-
- test_meta($db, 260, 'NCHAR(1)' , 'a' , 'NCHAR' , PDO::PARAM_STR);
- test_meta($db, 270, 'NCHAR(10)' , '0123456789' , 'NCHAR' , PDO::PARAM_STR);
- test_meta($db, 280, 'NCHAR(255)' , str_repeat('z', 255) , 'NCHAR' , PDO::PARAM_STR);
- test_meta($db, 290, 'NVARCHAR2(1)' , 'a' , 'NVARCHAR2', PDO::PARAM_STR);
- test_meta($db, 300, 'NVARCHAR2(10)' , '0123456789' , 'NVARCHAR2', PDO::PARAM_STR);
- test_meta($db, 310, 'NVARCHAR2(255)', str_repeat('z', 255) , 'NVARCHAR2', PDO::PARAM_STR);
-
- echo "Test 2.5 testing lobs columns\n";
-
- test_meta($db, 320, 'CLOB' , str_repeat('b', 255) , 'CLOB' , PDO::PARAM_LOB);
- test_meta($db, 330, 'BLOB' , str_repeat('b', 256) , 'BLOB' , PDO::PARAM_LOB);
- test_meta($db, 340, 'NCLOB' , str_repeat('b', 255) , 'NCLOB' , PDO::PARAM_LOB);
-
- test_meta($db, 350, 'LONG' , str_repeat('b', 256) , 'LONG' , PDO::PARAM_STR);
- test_meta($db, 360, 'LONG RAW' , str_repeat('b', 256) , 'LONG RAW', PDO::PARAM_STR);
- test_meta($db, 370, 'RAW(256)' , str_repeat('b', 256) , 'RAW' , PDO::PARAM_STR);
-
-
- $db->exec(<<<SQL
+ $sql = sprintf('CREATE TABLE test(id INT, label %s)', $sql_type);
+ $stmt = $db->prepare($sql);
+ $stmt->execute();
+
+ if (!$db->exec(sprintf("INSERT INTO test(id, label) VALUES (1, '%s')", $value))) {
+ printf("[%03d] + 1] Insert failed, %d - %s\n", $offset,
+ $db->errorCode(), var_export($db->errorInfo(), true));
+ return false;
+ }
+
+ $stmt = $db->prepare('SELECT id, label FROM test');
+ $stmt->execute();
+ $meta = $stmt->getColumnMeta(1);
+ return test_return($meta, $offset, $native_type, $pdo_type);
+ }
+
+ echo "Test 2.2 testing numeric columns\n";
+
+ test_meta($db, 20, 'NUMBER' , 0 , 'NUMBER', PDO::PARAM_STR);
+ test_meta($db, 30, 'NUMBER' , 256 , 'NUMBER', PDO::PARAM_STR);
+ test_meta($db, 40, 'INT' , 256 , 'NUMBER', PDO::PARAM_STR);
+ test_meta($db, 50, 'INTEGER' , 256 , 'NUMBER', PDO::PARAM_STR);
+ test_meta($db, 60, 'NUMBER' , 256.01 , 'NUMBER', PDO::PARAM_STR);
+ test_meta($db, 70, 'NUMBER' , -8388608 , 'NUMBER', PDO::PARAM_STR);
+
+ test_meta($db, 80, 'NUMBER' , 2147483648 , 'NUMBER', PDO::PARAM_STR);
+ test_meta($db, 90, 'NUMBER' , 4294967295 , 'NUMBER', PDO::PARAM_STR);
+
+ test_meta($db, 100, 'DEC' , 1.01 , 'NUMBER' , PDO::PARAM_STR);
+ test_meta($db, 110, 'DECIMAL' , 1.01 , 'NUMBER' , PDO::PARAM_STR);
+ test_meta($db, 120, 'FLOAT' , 1.01 , 'FLOAT' , PDO::PARAM_STR);
+ test_meta($db, 130, 'DOUBLE PRECISION', 1.01 , 'FLOAT' , PDO::PARAM_STR);
+ test_meta($db, 140, 'BINARY_FLOAT' , 1.01 , 'BINARY_FLOAT' , PDO::PARAM_STR);
+ test_meta($db, 150, 'BINARY_DOUBLE' , 1.01 , 'BINARY_DOUBLE', PDO::PARAM_STR);
+
+ echo "Test 2.3 testing temporal columns\n";
+
+ $db->exec("alter session set nls_date_format='YYYY-MM-DD'");
+ test_meta($db, 160, 'DATE' , '2008-04-23' , 'DATE', PDO::PARAM_STR);
+
+ echo "Test 2.4 testing string columns\n";
+
+ test_meta($db, 170, 'CHAR(1)' , 'a' , 'CHAR' , PDO::PARAM_STR);
+ test_meta($db, 180, 'CHAR(10)' , '0123456789' , 'CHAR' , PDO::PARAM_STR);
+ test_meta($db, 190, 'CHAR(255)' , str_repeat('z', 255) , 'CHAR' , PDO::PARAM_STR);
+ test_meta($db, 200, 'VARCHAR(1)' , 'a' , 'VARCHAR2' , PDO::PARAM_STR);
+ test_meta($db, 210, 'VARCHAR(10)' , '0123456789' , 'VARCHAR2' , PDO::PARAM_STR);
+ test_meta($db, 220, 'VARCHAR(255)' , str_repeat('z', 255) , 'VARCHAR2' , PDO::PARAM_STR);
+ test_meta($db, 230, 'VARCHAR2(1)' , 'a' , 'VARCHAR2' , PDO::PARAM_STR);
+ test_meta($db, 240, 'VARCHAR2(10)' , '0123456789' , 'VARCHAR2' , PDO::PARAM_STR);
+ test_meta($db, 250, 'VARCHAR2(255)' , str_repeat('z', 255) , 'VARCHAR2' , PDO::PARAM_STR);
+
+ test_meta($db, 260, 'NCHAR(1)' , 'a' , 'NCHAR' , PDO::PARAM_STR);
+ test_meta($db, 270, 'NCHAR(10)' , '0123456789' , 'NCHAR' , PDO::PARAM_STR);
+ test_meta($db, 280, 'NCHAR(255)' , str_repeat('z', 255) , 'NCHAR' , PDO::PARAM_STR);
+ test_meta($db, 290, 'NVARCHAR2(1)' , 'a' , 'NVARCHAR2', PDO::PARAM_STR);
+ test_meta($db, 300, 'NVARCHAR2(10)' , '0123456789' , 'NVARCHAR2', PDO::PARAM_STR);
+ test_meta($db, 310, 'NVARCHAR2(255)', str_repeat('z', 255) , 'NVARCHAR2', PDO::PARAM_STR);
+
+ echo "Test 2.5 testing lobs columns\n";
+
+ test_meta($db, 320, 'CLOB' , str_repeat('b', 255) , 'CLOB' , PDO::PARAM_LOB);
+ test_meta($db, 330, 'BLOB' , str_repeat('b', 256) , 'BLOB' , PDO::PARAM_LOB);
+ test_meta($db, 340, 'NCLOB' , str_repeat('b', 255) , 'NCLOB' , PDO::PARAM_LOB);
+
+ test_meta($db, 350, 'LONG' , str_repeat('b', 256) , 'LONG' , PDO::PARAM_STR);
+ test_meta($db, 360, 'LONG RAW' , str_repeat('b', 256) , 'LONG RAW', PDO::PARAM_STR);
+ test_meta($db, 370, 'RAW(256)' , str_repeat('b', 256) , 'RAW' , PDO::PARAM_STR);
+
+
+ $db->exec(<<<SQL
BEGIN
EXECUTE IMMEDIATE 'DROP TABLE test';
EXCEPTION
@@ -215,63 +215,63 @@ EXCEPTION
END;
SQL
);
- echo "Test 2.6 testing function return\n";
-
- $stmt = $db->query('SELECT count(*) FROM dual');
- $meta = $stmt->getColumnMeta(0);
- test_return($meta, 380, 'NUMBER', PDO::PARAM_STR);
- $stmt = $db->query("SELECT TO_DATE('2008-04-23') FROM dual");
- $meta = $stmt->getColumnMeta(0);
- test_return($meta, 390, 'DATE', PDO::PARAM_STR);
- $stmt = $db->query("SELECT TO_CHAR(542) FROM dual");
- $meta = $stmt->getColumnMeta(0);
- test_return($meta, 400, 'VARCHAR2', PDO::PARAM_STR);
-
-
- echo "Test 2.7 testing flags returned\n";
-
- $sql = sprintf('CREATE TABLE test(id INT NOT NULL, label INT NULL)');
- $stmt = $db->prepare($sql);
- $stmt->execute();
- $db->exec('INSERT INTO test(id, label) VALUES (1, 1)');
- $stmt = $db->query('SELECT id, label FROM test');
- $meta = $stmt->getColumnMeta(0);
- // verify the flags array countains a not_null flag and not nullable flags
- if (!isset($meta['flags'])) {
- printf("[1001] No flags contained in metadata %s\n", var_export($meta, true));
- } else {
- $flags = $meta['flags'];
- $found = false;
- foreach ($flags as $k => $flag) {
- if ($flag == 'not_null')
- $found = true;
- if ($flag == 'nullable')
- printf("[1003] Flags seem wrong %s\n", var_export($meta, true));
- }
- if (!$found)
- printf("[1002] Flags seem wrong %s\n", var_export($meta, true));
- }
- $meta = $stmt->getColumnMeta(1);
- // verify the flags array countains a nullable flag and not not_null flags
- if (!isset($meta['flags'])) {
- printf("[1003] No flags contained in metadata %s\n", var_export($meta, true));
- } else {
- $flags = $meta['flags'];
- $found = false;
- foreach ($flags as $k => $flag) {
- if ($flag == 'not_null')
- printf("[1004] Flags seem wrong %s\n", var_export($meta, true));
- if ($flag == 'nullable')
- $found = true;
- }
- if (!$found)
- printf("[1005] Flags seem wrong %s\n", var_export($meta, true));
- }
+ echo "Test 2.6 testing function return\n";
+
+ $stmt = $db->query('SELECT count(*) FROM dual');
+ $meta = $stmt->getColumnMeta(0);
+ test_return($meta, 380, 'NUMBER', PDO::PARAM_STR);
+ $stmt = $db->query("SELECT TO_DATE('2008-04-23') FROM dual");
+ $meta = $stmt->getColumnMeta(0);
+ test_return($meta, 390, 'DATE', PDO::PARAM_STR);
+ $stmt = $db->query("SELECT TO_CHAR(542) FROM dual");
+ $meta = $stmt->getColumnMeta(0);
+ test_return($meta, 400, 'VARCHAR2', PDO::PARAM_STR);
+
+
+ echo "Test 2.7 testing flags returned\n";
+
+ $sql = sprintf('CREATE TABLE test(id INT NOT NULL, label INT NULL)');
+ $stmt = $db->prepare($sql);
+ $stmt->execute();
+ $db->exec('INSERT INTO test(id, label) VALUES (1, 1)');
+ $stmt = $db->query('SELECT id, label FROM test');
+ $meta = $stmt->getColumnMeta(0);
+ // verify the flags array contains a not_null flag and not nullable flags
+ if (!isset($meta['flags'])) {
+ printf("[1001] No flags contained in metadata %s\n", var_export($meta, true));
+ } else {
+ $flags = $meta['flags'];
+ $found = false;
+ foreach ($flags as $k => $flag) {
+ if ($flag == 'not_null')
+ $found = true;
+ if ($flag == 'nullable')
+ printf("[1003] Flags seem wrong %s\n", var_export($meta, true));
+ }
+ if (!$found)
+ printf("[1002] Flags seem wrong %s\n", var_export($meta, true));
+ }
+ $meta = $stmt->getColumnMeta(1);
+ // verify the flags array contains a nullable flag and not not_null flags
+ if (!isset($meta['flags'])) {
+ printf("[1003] No flags contained in metadata %s\n", var_export($meta, true));
+ } else {
+ $flags = $meta['flags'];
+ $found = false;
+ foreach ($flags as $k => $flag) {
+ if ($flag == 'not_null')
+ printf("[1004] Flags seem wrong %s\n", var_export($meta, true));
+ if ($flag == 'nullable')
+ $found = true;
+ }
+ if (!$found)
+ printf("[1005] Flags seem wrong %s\n", var_export($meta, true));
+ }
} catch (PDOException $e) {
- // we should never get here, we use warnings, but never trust a system...
- printf("[001] %s, [%s} %s\n",
- $e->getMessage(), $db->errorInfo(), implode(' ', $db->errorInfo()));
+ // we should never get here, we use warnings, but never trust a system...
+ printf("[001] %s, [%s} %s\n",
+ $e->getMessage(), $db->errorInfo(), implode(' ', $db->errorInfo()));
}
$db->exec(<<<SQL
diff --git a/ext/pdo_oci/tests/pdo_oci_stream_1.phpt b/ext/pdo_oci/tests/pdo_oci_stream_1.phpt
index ee2008d33f..a1dd8451ba 100644
--- a/ext/pdo_oci/tests/pdo_oci_stream_1.phpt
+++ b/ext/pdo_oci/tests/pdo_oci_stream_1.phpt
@@ -20,11 +20,11 @@ $dbh->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false);
@$dbh->exec("drop table pdo_oci_stream_1_tab");
$stmtarray = array(
- "create table pdo_oci_stream_1_tab (id number, data clob)",
+ "create table pdo_oci_stream_1_tab (id number, data clob)",
);
foreach ($stmtarray as $stmt) {
- $dbh->exec($stmt);
+ $dbh->exec($stmt);
}
$dbh->exec("
@@ -76,11 +76,11 @@ echo 'Read '.stream_get_contents($r['data'], -1, 30000)."\n"; // jjjxyz
// Clean up
$stmtarray = array(
- "drop table pdo_oci_stream_1_tab"
+ "drop table pdo_oci_stream_1_tab"
);
foreach ($stmtarray as $stmt) {
- $dbh->exec($stmt);
+ $dbh->exec($stmt);
}
?>
diff --git a/ext/pdo_oci/tests/pdo_oci_stream_2b.phpt b/ext/pdo_oci/tests/pdo_oci_stream_2b.phpt
index 7164f5ad6f..a50b4815c3 100644
--- a/ext/pdo_oci/tests/pdo_oci_stream_2b.phpt
+++ b/ext/pdo_oci/tests/pdo_oci_stream_2b.phpt
@@ -26,16 +26,16 @@ $j = 9;
$a_val = ord('a');
foreach($db->query("select data1 as d4_1, data2 as d4_2 from pdo_oci_stream_2 order by id") as $row) {
$a = $row['d4_1'];
- $a1 = $row['d4_2'];
+ $a1 = $row['d4_2'];
$str1 = stream_get_contents($a);
- $str2 = stream_get_contents($a1);
+ $str2 = stream_get_contents($a1);
$str1len = strlen($str1);
- $str2len = strlen($str2);
+ $str2len = strlen($str2);
$b = ord($str1[0]);
- $b1 = ord($str2[0]);
+ $b1 = ord($str2[0]);
if (($b != ($a_val + $i)) && ($str1len != (4086 + $i)) &&
($b1 != ($a_val + $j)) && ($str2len != (4086 + $j))) {
@@ -56,8 +56,8 @@ foreach($db->query("select data1 as d4_1, data2 as d4_2 from pdo_oci_stream_2 or
$i++;
if ($i>9)
$i = 0;
- $j--;
- if ($j<0)
+ $j--;
+ if ($j<0)
$j = 9;
}
echo "Fetch operation done!\n";
diff --git a/ext/pdo_oci/tests/pecl_bug_6364.phpt b/ext/pdo_oci/tests/pecl_bug_6364.phpt
index 054d58a0f8..affdc77649 100644
--- a/ext/pdo_oci/tests/pecl_bug_6364.phpt
+++ b/ext/pdo_oci/tests/pecl_bug_6364.phpt
@@ -32,7 +32,7 @@ var_dump($out_param1);
var_dump($out_param2);
foreach ($dbh->query("select * from bug_6364_t") as $row) {
- var_dump($row);
+ var_dump($row);
}
print "Done\n";
diff --git a/ext/pdo_odbc/odbc_driver.c b/ext/pdo_odbc/odbc_driver.c
index 9e10c4c446..d0441e98a9 100644
--- a/ext/pdo_odbc/odbc_driver.c
+++ b/ext/pdo_odbc/odbc_driver.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
diff --git a/ext/pdo_odbc/odbc_stmt.c b/ext/pdo_odbc/odbc_stmt.c
index e67acbc6e8..799ef02e48 100644
--- a/ext/pdo_odbc/odbc_stmt.c
+++ b/ext/pdo_odbc/odbc_stmt.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
diff --git a/ext/pdo_odbc/pdo_odbc.c b/ext/pdo_odbc/pdo_odbc.c
index 5f0eb26df3..51af17055c 100644
--- a/ext/pdo_odbc/pdo_odbc.c
+++ b/ext/pdo_odbc/pdo_odbc.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
@@ -66,13 +64,6 @@ zend_ulong pdo_odbc_pool_on = SQL_CP_OFF;
zend_ulong pdo_odbc_pool_mode = SQL_CP_ONE_PER_HENV;
#endif
-#if defined(DB2CLI_VER) && !defined(PHP_WIN32)
-PHP_INI_BEGIN()
- PHP_INI_ENTRY("pdo_odbc.db2_instance_name", NULL, PHP_INI_SYSTEM, NULL)
-PHP_INI_END()
-
-#endif
-
/* {{{ PHP_MINIT_FUNCTION */
PHP_MINIT_FUNCTION(pdo_odbc)
{
@@ -84,26 +75,6 @@ PHP_MINIT_FUNCTION(pdo_odbc)
return FAILURE;
}
-#if defined(DB2CLI_VER) && !defined(PHP_WIN32)
- REGISTER_INI_ENTRIES();
- {
- char *instance = INI_STR("pdo_odbc.db2_instance_name");
- if (instance) {
- char *env = malloc(sizeof("DB2INSTANCE=") + strlen(instance));
-
- php_error_docref(NULL, E_DEPRECATED, "The pdo_odbc.db2_instance_name ini directive is deprecated and will be removed in the future");
-
- if (!env) {
- return FAILURE;
- }
- strcpy(env, "DB2INSTANCE=");
- strcat(env, instance);
- putenv(env);
- /* after this point, we can't free env without breaking the environment */
- }
- }
-#endif
-
#ifdef SQL_ATTR_CONNECTION_POOLING
/* ugh, we don't really like .ini stuff in PDO, but since ODBC connection
* pooling is process wide, we can't set it from within the scope of a
@@ -145,9 +116,6 @@ PHP_MINIT_FUNCTION(pdo_odbc)
*/
PHP_MSHUTDOWN_FUNCTION(pdo_odbc)
{
-#if defined(DB2CLI_VER) && !defined(PHP_WIN32)
- UNREGISTER_INI_ENTRIES();
-#endif
php_pdo_unregister_driver(&pdo_odbc_driver);
return SUCCESS;
}
@@ -166,9 +134,5 @@ PHP_MINFO_FUNCTION(pdo_odbc)
php_info_print_table_row(2, "ODBC Connection Pooling", "Not supported in this build");
#endif
php_info_print_table_end();
-
-#if defined(DB2CLI_VER) && !defined(PHP_WIN32)
- DISPLAY_INI_ENTRIES();
-#endif
}
/* }}} */
diff --git a/ext/pdo_odbc/php_pdo_odbc.h b/ext/pdo_odbc/php_pdo_odbc.h
index 9cc748715e..3d6e470994 100644
--- a/ext/pdo_odbc/php_pdo_odbc.h
+++ b/ext/pdo_odbc/php_pdo_odbc.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
diff --git a/ext/pdo_odbc/php_pdo_odbc_int.h b/ext/pdo_odbc/php_pdo_odbc_int.h
index e6098f4951..5604e86273 100644
--- a/ext/pdo_odbc/php_pdo_odbc_int.h
+++ b/ext/pdo_odbc/php_pdo_odbc_int.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
diff --git a/ext/pdo_odbc/tests/long_columns.phpt b/ext/pdo_odbc/tests/long_columns.phpt
index bb02dcf89f..5f369a50d4 100644
--- a/ext/pdo_odbc/tests/long_columns.phpt
+++ b/ext/pdo_odbc/tests/long_columns.phpt
@@ -46,11 +46,11 @@ $db = PDOTest::test_factory('ext/pdo_odbc/tests/common.phpt');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
if (false === $db->exec('CREATE TABLE TEST (id INT NOT NULL PRIMARY KEY, data CLOB)')) {
- if (false === $db->exec('CREATE TABLE TEST (id INT NOT NULL PRIMARY KEY, data longtext)')) {
- if (false === $db->exec('CREATE TABLE TEST (id INT NOT NULL PRIMARY KEY, data varchar(4000))')) {
- die("BORK: don't know how to create a long column here:\n" . implode(", ", $db->errorInfo()));
- }
- }
+ if (false === $db->exec('CREATE TABLE TEST (id INT NOT NULL PRIMARY KEY, data longtext)')) {
+ if (false === $db->exec('CREATE TABLE TEST (id INT NOT NULL PRIMARY KEY, data varchar(4000))')) {
+ die("BORK: don't know how to create a long column here:\n" . implode(", ", $db->errorInfo()));
+ }
+ }
}
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
@@ -61,32 +61,32 @@ $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sizes = array(32, 53, 64, 79, 128, 253, 254, 255, 256, 257, 258, 1022, 1023, 1024, 1025, 1026, 510, 511, 512, 513, 514, 1278, 1279, 1280, 1281, 1282, 2046, 2047, 2048, 2049, 2050, 1534, 1535, 1536, 1537, 1538, 3070, 3071, 3072, 3073, 3074, 3998, 3999, 4000);
function alpha_repeat($len) {
- // use the alphabet instead of 'i' characters to make sure the blocks don't overlap when they are reassembled
- $out = "";
- while (strlen($out) < $len) {
- $out .= "abcdefghijklmnopqrstuvwxyz";
- }
- return substr($out, 0, $len);
+ // use the alphabet instead of 'i' characters to make sure the blocks don't overlap when they are reassembled
+ $out = "";
+ while (strlen($out) < $len) {
+ $out .= "abcdefghijklmnopqrstuvwxyz";
+ }
+ return substr($out, 0, $len);
}
// don't use Prepared Statements. that fails on MS SQL server (works with Access, MyODBC), which is a separate failure, feature/code-path from what
// this test does - nice to be able to test using MS SQL server
foreach ($sizes as $num) {
- $text = alpha_repeat($num);
- $db->exec("INSERT INTO TEST VALUES($num, '$text')");
+ $text = alpha_repeat($num);
+ $db->exec("INSERT INTO TEST VALUES($num, '$text')");
}
// verify data
foreach ($db->query('SELECT id, data from TEST ORDER BY LEN(data) ASC') as $row) {
- $expect = alpha_repeat($row[0]);
- if (strcmp($expect, $row[1])) {
- echo "Failed on size $row[id]:\n";
- printf("Expected %d bytes, got %d\n", strlen($expect), strlen($row['data']));
- echo ($expect) . "\n";
- echo ($row['data']) . "\n";
- } else {
- echo "Passed on size $row[id]\n";
- }
+ $expect = alpha_repeat($row[0]);
+ if (strcmp($expect, $row[1])) {
+ echo "Failed on size $row[id]:\n";
+ printf("Expected %d bytes, got %d\n", strlen($expect), strlen($row['data']));
+ echo ($expect) . "\n";
+ echo ($row['data']) . "\n";
+ } else {
+ echo "Passed on size $row[id]\n";
+ }
}
echo "Finished\n";
diff --git a/ext/pdo_odbc/tests/max_columns.phpt b/ext/pdo_odbc/tests/max_columns.phpt
index ae68a09e91..b36eb5381f 100644
--- a/ext/pdo_odbc/tests/max_columns.phpt
+++ b/ext/pdo_odbc/tests/max_columns.phpt
@@ -11,11 +11,11 @@ $db = PDOTest::test_factory('ext/pdo_odbc/tests/common.phpt');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
if (false === $db->exec('CREATE TABLE TEST (id INT NOT NULL PRIMARY KEY, data varchar(max))')) {
- if (false === $db->exec('CREATE TABLE TEST (id INT NOT NULL PRIMARY KEY, data longtext)')) {
- if (false === $db->exec('CREATE TABLE TEST (id INT NOT NULL PRIMARY KEY, data CLOB)')) {
- die("BORK: don't know how to create a long column here:\n" . implode(", ", $db->errorInfo()));
- }
- }
+ if (false === $db->exec('CREATE TABLE TEST (id INT NOT NULL PRIMARY KEY, data longtext)')) {
+ if (false === $db->exec('CREATE TABLE TEST (id INT NOT NULL PRIMARY KEY, data CLOB)')) {
+ die("BORK: don't know how to create a long column here:\n" . implode(", ", $db->errorInfo()));
+ }
+ }
}
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
@@ -25,19 +25,19 @@ $sizes = array(32, 64, 128, 253, 254, 255, 256, 257, 258, 512, 1024, 2048, 3998,
$db->beginTransaction();
$insert = $db->prepare('INSERT INTO TEST VALUES (?, ?)');
foreach ($sizes as $num) {
- $insert->execute(array($num, str_repeat('i', $num)));
+ $insert->execute(array($num, str_repeat('i', $num)));
}
$insert = null;
$db->commit();
foreach ($db->query('SELECT id, data from TEST') as $row) {
- $expect = str_repeat('i', $row[0]);
- if (strcmp($expect, $row[1])) {
- echo "Failed on size $row[id]:\n";
- printf("Expected %d bytes, got %d\n", strlen($expect), strlen($row['data']));
- echo bin2hex($expect) . "\n";
- echo bin2hex($row['data']) . "\n";
- }
+ $expect = str_repeat('i', $row[0]);
+ if (strcmp($expect, $row[1])) {
+ echo "Failed on size $row[id]:\n";
+ printf("Expected %d bytes, got %d\n", strlen($expect), strlen($row['data']));
+ echo bin2hex($expect) . "\n";
+ echo bin2hex($row['data']) . "\n";
+ }
}
echo "Finished\n";
diff --git a/ext/pdo_pgsql/pdo_pgsql.c b/ext/pdo_pgsql/pdo_pgsql.c
index 8d60fe420b..9cd9dab3b9 100644
--- a/ext/pdo_pgsql/pdo_pgsql.c
+++ b/ext/pdo_pgsql/pdo_pgsql.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c
index b6f008071c..65a0191a8d 100644
--- a/ext/pdo_pgsql/pgsql_driver.c
+++ b/ext/pdo_pgsql/pgsql_driver.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -548,7 +546,7 @@ static PHP_METHOD(PDO, pgsqlCopyFromArray)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sa|sss",
&table_name, &table_name_len, &pg_rows,
&pg_delim, &pg_delim_len, &pg_null_as, &pg_null_as_len, &pg_fields, &pg_fields_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!zend_hash_num_elements(Z_ARRVAL_P(pg_rows))) {
@@ -594,7 +592,7 @@ static PHP_METHOD(PDO, pgsqlCopyFromArray)
size_t query_len;
if (!try_convert_to_string(tmp)) {
efree(query);
- return;
+ RETURN_THROWS();
}
if (buffer_len < Z_STRLEN_P(tmp)) {
@@ -660,7 +658,7 @@ static PHP_METHOD(PDO, pgsqlCopyFromFile)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sp|sss",
&table_name, &table_name_len, &filename, &filename_len,
&pg_delim, &pg_delim_len, &pg_null_as, &pg_null_as_len, &pg_fields, &pg_fields_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
/* Obtain db Handler */
@@ -761,7 +759,7 @@ static PHP_METHOD(PDO, pgsqlCopyToFile)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sp|sss",
&table_name, &table_name_len, &filename, &filename_len,
&pg_delim, &pg_delim_len, &pg_null_as, &pg_null_as_len, &pg_fields, &pg_fields_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
dbh = Z_PDO_DBH_P(ZEND_THIS);
@@ -854,7 +852,7 @@ static PHP_METHOD(PDO, pgsqlCopyToArray)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|sss",
&table_name, &table_name_len,
&pg_delim, &pg_delim_len, &pg_null_as, &pg_null_as_len, &pg_fields, &pg_fields_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
dbh = Z_PDO_DBH_P(ZEND_THIS);
@@ -922,6 +920,8 @@ static PHP_METHOD(PDO, pgsqlLOBCreate)
pdo_pgsql_db_handle *H;
Oid lfd;
+ ZEND_PARSE_PARAMETERS_NONE();
+
dbh = Z_PDO_DBH_P(ZEND_THIS);
PDO_CONSTRUCT_CHECK;
PDO_DBH_CLEAR_ERR();
@@ -958,7 +958,7 @@ static PHP_METHOD(PDO, pgsqlLOBOpen)
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "s|s",
&oidstr, &oidstrlen, &modestr, &modestrlen)) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
oid = (Oid)strtoul(oidstr, &end_ptr, 10);
@@ -1005,7 +1005,7 @@ static PHP_METHOD(PDO, pgsqlLOBUnlink)
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "s",
&oidstr, &oidlen)) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
oid = (Oid)strtoul(oidstr, &end_ptr, 10);
@@ -1030,7 +1030,7 @@ static PHP_METHOD(PDO, pgsqlLOBUnlink)
/* }}} */
/* {{{ proto mixed PDO::pgsqlGetNotify([ int $result_type = PDO::FETCH_USE_DEFAULT] [, int $ms_timeout = 0 ]])
- Get asyncronous notification */
+ Get asynchronous notification */
static PHP_METHOD(PDO, pgsqlGetNotify)
{
pdo_dbh_t *dbh;
@@ -1041,7 +1041,7 @@ static PHP_METHOD(PDO, pgsqlGetNotify)
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "|ll",
&result_type, &ms_timeout)) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
dbh = Z_PDO_DBH_P(ZEND_THIS);
@@ -1061,7 +1061,7 @@ static PHP_METHOD(PDO, pgsqlGetNotify)
RETURN_FALSE;
#if ZEND_ENABLE_ZVAL_LONG64
} else if (ms_timeout > INT_MAX) {
- php_error_docref(NULL, E_WARNING, "timeout was shrunk to %d", INT_MAX);
+ php_error_docref(NULL, E_WARNING, "Timeout was shrunk to %d", INT_MAX);
ms_timeout = INT_MAX;
#endif
}
@@ -1117,6 +1117,8 @@ static PHP_METHOD(PDO, pgsqlGetPid)
pdo_dbh_t *dbh;
pdo_pgsql_db_handle *H;
+ ZEND_PARSE_PARAMETERS_NONE();
+
dbh = Z_PDO_DBH_P(ZEND_THIS);
PDO_CONSTRUCT_CHECK;
diff --git a/ext/pdo_pgsql/pgsql_statement.c b/ext/pdo_pgsql/pgsql_statement.c
index d830d57c18..1b728951f5 100644
--- a/ext/pdo_pgsql/pgsql_statement.c
+++ b/ext/pdo_pgsql/pgsql_statement.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/pdo_pgsql/php_pdo_pgsql.h b/ext/pdo_pgsql/php_pdo_pgsql.h
index e6d7c17058..950aed79ca 100644
--- a/ext/pdo_pgsql/php_pdo_pgsql.h
+++ b/ext/pdo_pgsql/php_pdo_pgsql.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/pdo_pgsql/php_pdo_pgsql_int.h b/ext/pdo_pgsql/php_pdo_pgsql_int.h
index 9b1f60549f..5d80e32205 100644
--- a/ext/pdo_pgsql/php_pdo_pgsql_int.h
+++ b/ext/pdo_pgsql/php_pdo_pgsql_int.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/pdo_pgsql/tests/bug43925.phpt b/ext/pdo_pgsql/tests/bug43925.phpt
index d90f36fbbc..20b1156de5 100644
--- a/ext/pdo_pgsql/tests/bug43925.phpt
+++ b/ext/pdo_pgsql/tests/bug43925.phpt
@@ -29,13 +29,13 @@ $dbh->query('INSERT INTO nodes (id, root, lft, rgt) VALUES (3, 1, 4, 5);');
$stmt = $dbh->prepare('
- SELECT *
- FROM nodes
- WHERE (:rootId > 0 OR lft > :left OR rgt > :left)
- AND (root = :rootId OR root = :left)
- AND (1 > :left OR 1 < :left OR 1 = :left)
- AND (:x > 0 OR :x < 10 OR :x > 100)
- OR :y = 1 OR :left = 1
+ SELECT *
+ FROM nodes
+ WHERE (:rootId > 0 OR lft > :left OR rgt > :left)
+ AND (root = :rootId OR root = :left)
+ AND (1 > :left OR 1 < :left OR 1 = :left)
+ AND (:x > 0 OR :x < 10 OR :x > 100)
+ OR :y = 1 OR :left = 1
');
$stmt->bindValue('left', 1, PDO::PARAM_INT);
@@ -46,8 +46,8 @@ $stmt->bindValue('y', 50, PDO::PARAM_INT);
$stmt->execute();
foreach ($stmt->fetchAll() as $row) {
- print implode(' - ', $row);
- print "\n";
+ print implode(' - ', $row);
+ print "\n";
}
$dbh->query('DROP TABLE nodes');
diff --git a/ext/pdo_pgsql/tests/bug46274.phpt b/ext/pdo_pgsql/tests/bug46274.phpt
index 0ae6849b41..9f3dbf0542 100644
--- a/ext/pdo_pgsql/tests/bug46274.phpt
+++ b/ext/pdo_pgsql/tests/bug46274.phpt
@@ -15,7 +15,7 @@ $db = PDOTest::test_factory(__DIR__ . '/common.phpt');
$db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
try {
- @$db->query("SET bytea_output = 'escape'");
+ @$db->query("SET bytea_output = 'escape'");
} catch (Exception $e) {
}
diff --git a/ext/pdo_pgsql/tests/bug48764.phpt b/ext/pdo_pgsql/tests/bug48764.phpt
index 1f890267e5..c1d6c6a74f 100644
--- a/ext/pdo_pgsql/tests/bug48764.phpt
+++ b/ext/pdo_pgsql/tests/bug48764.phpt
@@ -37,7 +37,7 @@ $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
bug($db);
putenv('PDOTEST_ATTR='.serialize(array(
- PDO::ATTR_EMULATE_PREPARES => 1,
+ PDO::ATTR_EMULATE_PREPARES => 1,
)));
$db = PDOTest::factory('PDO', false);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
@@ -50,14 +50,14 @@ putenv('PDOTEST_ATTR');
function bug($db, $options = array()) {
- try {
- $stmt = $db->prepare("SELECT ?", $options);
- $stmt->execute(array(1));
- echo "OK\n";
- } catch (PDOException $e) {
- // Indetermined data type when using native prepared statements
- echo $e->getCode()."\n";
- }
+ try {
+ $stmt = $db->prepare("SELECT ?", $options);
+ $stmt->execute(array(1));
+ echo "OK\n";
+ } catch (PDOException $e) {
+ // Indetermined data type when using native prepared statements
+ echo $e->getCode()."\n";
+ }
}
--EXPECT--
Test 1
diff --git a/ext/pdo_pgsql/tests/bug66584.phpt b/ext/pdo_pgsql/tests/bug66584.phpt
index 7c98046a30..4fc43d8817 100644
--- a/ext/pdo_pgsql/tests/bug66584.phpt
+++ b/ext/pdo_pgsql/tests/bug66584.phpt
@@ -21,24 +21,24 @@ $pdo->query("CREATE TABLE b66584 (a int)");
$pdo->query("INSERT INTO b66584 VALUES (165)");
for ($i = 1; $i >= 0; $i--) {
- $pdo->setAttribute(\PDO::ATTR_EMULATE_PREPARES, (bool)$i);
+ $pdo->setAttribute(\PDO::ATTR_EMULATE_PREPARES, (bool)$i);
- try {
- run($pdo, [0 => 1, 2 => 165, 5 => 3]);
- } catch (\Exception $e) {
- var_dump($e->getMessage());
- }
+ try {
+ run($pdo, [0 => 1, 2 => 165, 5 => 3]);
+ } catch (\Exception $e) {
+ var_dump($e->getMessage());
+ }
- try {
- run($pdo, json_decode('{"0":234,"1":165,"2":221,"3":207,"4":188,"5":216,"6":1150,"7":916,"8":967,"9":987,"10":951,"11":990,"12":959,"13":896,"14":947,"15":877,"16":1000,"17":1023,"18":904,"19":856,"20":860,"21":866,"22":930,"23":974,"24":1032,"25":1016,"26":1050,"27":1059,"28":1040,"29":1064,"30":1004,"31":214,"32":189,"33":166,"34":1002,"35":167,"36":191,"37":859,"38":204,"39":181,"40":1001,"42":208,"43":198,"44":177,"45":1003,"46":858,"47":190,"48":162,"49":210,"50":171,"51":197,"52":168,"53":194,"54":209,"55":200,"56":192,"57":180,"58":232,"59":222,"60":163,"61":196,"62":217,"64":176,"65":193,"66":172,"67":195,"68":170,"69":173,"70":233,"71":223,"72":218,"73":186,"74":175,"75":224,"76":205,"77":211,"78":235,"79":1101,"80":225,"81":236,"82":1102,"83":1164,"84":1083,"85":1005,"86":861,"87":1179,"88":960,"89":991,"90":1187,"91":880,"92":1149,"93":1033,"94":931,"95":1006,"96":862,"97":1151,"98":917,"99":881,"100":1148,"101":1065,"102":867,"103":952,"104":1152,"105":918,"106":961,"107":1180,"108":992,"109":1188,"110":932,"111":933,"112":968,"113":868,"114":882,"115":1147,"116":1017,"117":1131,"118":1174,"119":1178,"120":1186,"121":869,"122":1051,"123":934,"124":969,"125":975,"126":1066,"127":237,"128":953,"129":1024,"130":1146,"131":883,"132":1145,"133":884,"134":885,"135":1144,"136":886,"137":1143,"138":1025,"139":897,"140":898,"141":899,"142":1026,"143":1142,"144":887,"145":1141,"146":888,"147":889,"148":1140,"149":1189,"150":993,"151":1139,"152":890,"153":1138,"154":891,"155":900,"156":892,"157":1137,"158":1027,"159":901,"160":1136,"161":893,"162":870,"163":1052,"164":954,"165":1041,"166":1018,"167":1165,"168":1084,"169":962,"170":1181,"171":994,"172":1190,"173":1042,"174":935,"175":226,"176":871,"177":1191,"178":995,"179":977,"180":948,"181":1175,"182":1053,"183":955,"184":1182,"185":963,"186":1067,"187":919,"188":1153,"189":920,"190":1154,"191":1055,"192":1054,"193":1056,"194":863,"195":872,"196":1028,"197":921,"198":1155,"199":936,"200":970,"201":1019,"202":1166,"203":1085,"204":1135,"205":894,"206":1034,"207":905,"208":873,"209":937,"210":902,"211":1029,"212":1007,"213":864,"214":1043,"215":1057,"216":956,"217":957,"218":939,"219":1086,"220":1167,"221":1087,"222":1168,"223":1173,"224":1108,"225":978,"226":1044,"227":1183,"228":964,"229":965,"230":1184,"231":1045,"232":874,"233":940,"234":1046,"235":979,"236":903,"237":980,"238":1156,"239":922,"240":1035,"241":906,"242":971,"243":972,"244":878,"245":1134,"246":879,"247":1133,"248":907,"249":1036,"250":908,"251":1132,"252":895,"253":909,"254":1060,"255":981,"256":1068,"257":996,"258":1192,"259":941,"260":865,"261":1008,"262":910,"263":997,"264":1193,"265":982,"266":942,"267":1020,"268":983,"269":1061,"270":949,"271":1176,"272":875,"273":911,"274":1069,"275":1157,"276":923,"277":1158,"278":924,"279":988,"280":984,"281":925,"282":1159,"283":1062,"284":1047,"285":1194,"286":998,"287":1021,"288":1030,"289":1031,"290":1070,"291":1088,"292":1169,"293":958,"294":1195,"295":999,"296":966,"297":1185,"298":944,"299":945,"300":1022,"301":1103,"302":220,"303":1099,"304":1048,"305":927,"306":1161,"307":989,"308":973,"309":1071,"310":1074,"311":1072,"312":1073,"313":912,"314":1037,"315":913,"316":914,"317":1177,"318":950,"319":1049,"320":876,"321":985,"322":915,"323":1038,"324":946,"325":1089,"326":1170,"327":1090,"328":1171,"329":1091,"330":1172,"331":1063,"332":986,"333":928,"334":1162,"335":929,"336":1163,"337":976,"338":231,"339":201,"340":1098,"341":215}', true));
- } catch (\Exception $e) {
- var_dump($e->getMessage());
- }
+ try {
+ run($pdo, json_decode('{"0":234,"1":165,"2":221,"3":207,"4":188,"5":216,"6":1150,"7":916,"8":967,"9":987,"10":951,"11":990,"12":959,"13":896,"14":947,"15":877,"16":1000,"17":1023,"18":904,"19":856,"20":860,"21":866,"22":930,"23":974,"24":1032,"25":1016,"26":1050,"27":1059,"28":1040,"29":1064,"30":1004,"31":214,"32":189,"33":166,"34":1002,"35":167,"36":191,"37":859,"38":204,"39":181,"40":1001,"42":208,"43":198,"44":177,"45":1003,"46":858,"47":190,"48":162,"49":210,"50":171,"51":197,"52":168,"53":194,"54":209,"55":200,"56":192,"57":180,"58":232,"59":222,"60":163,"61":196,"62":217,"64":176,"65":193,"66":172,"67":195,"68":170,"69":173,"70":233,"71":223,"72":218,"73":186,"74":175,"75":224,"76":205,"77":211,"78":235,"79":1101,"80":225,"81":236,"82":1102,"83":1164,"84":1083,"85":1005,"86":861,"87":1179,"88":960,"89":991,"90":1187,"91":880,"92":1149,"93":1033,"94":931,"95":1006,"96":862,"97":1151,"98":917,"99":881,"100":1148,"101":1065,"102":867,"103":952,"104":1152,"105":918,"106":961,"107":1180,"108":992,"109":1188,"110":932,"111":933,"112":968,"113":868,"114":882,"115":1147,"116":1017,"117":1131,"118":1174,"119":1178,"120":1186,"121":869,"122":1051,"123":934,"124":969,"125":975,"126":1066,"127":237,"128":953,"129":1024,"130":1146,"131":883,"132":1145,"133":884,"134":885,"135":1144,"136":886,"137":1143,"138":1025,"139":897,"140":898,"141":899,"142":1026,"143":1142,"144":887,"145":1141,"146":888,"147":889,"148":1140,"149":1189,"150":993,"151":1139,"152":890,"153":1138,"154":891,"155":900,"156":892,"157":1137,"158":1027,"159":901,"160":1136,"161":893,"162":870,"163":1052,"164":954,"165":1041,"166":1018,"167":1165,"168":1084,"169":962,"170":1181,"171":994,"172":1190,"173":1042,"174":935,"175":226,"176":871,"177":1191,"178":995,"179":977,"180":948,"181":1175,"182":1053,"183":955,"184":1182,"185":963,"186":1067,"187":919,"188":1153,"189":920,"190":1154,"191":1055,"192":1054,"193":1056,"194":863,"195":872,"196":1028,"197":921,"198":1155,"199":936,"200":970,"201":1019,"202":1166,"203":1085,"204":1135,"205":894,"206":1034,"207":905,"208":873,"209":937,"210":902,"211":1029,"212":1007,"213":864,"214":1043,"215":1057,"216":956,"217":957,"218":939,"219":1086,"220":1167,"221":1087,"222":1168,"223":1173,"224":1108,"225":978,"226":1044,"227":1183,"228":964,"229":965,"230":1184,"231":1045,"232":874,"233":940,"234":1046,"235":979,"236":903,"237":980,"238":1156,"239":922,"240":1035,"241":906,"242":971,"243":972,"244":878,"245":1134,"246":879,"247":1133,"248":907,"249":1036,"250":908,"251":1132,"252":895,"253":909,"254":1060,"255":981,"256":1068,"257":996,"258":1192,"259":941,"260":865,"261":1008,"262":910,"263":997,"264":1193,"265":982,"266":942,"267":1020,"268":983,"269":1061,"270":949,"271":1176,"272":875,"273":911,"274":1069,"275":1157,"276":923,"277":1158,"278":924,"279":988,"280":984,"281":925,"282":1159,"283":1062,"284":1047,"285":1194,"286":998,"287":1021,"288":1030,"289":1031,"290":1070,"291":1088,"292":1169,"293":958,"294":1195,"295":999,"296":966,"297":1185,"298":944,"299":945,"300":1022,"301":1103,"302":220,"303":1099,"304":1048,"305":927,"306":1161,"307":989,"308":973,"309":1071,"310":1074,"311":1072,"312":1073,"313":912,"314":1037,"315":913,"316":914,"317":1177,"318":950,"319":1049,"320":876,"321":985,"322":915,"323":1038,"324":946,"325":1089,"326":1170,"327":1090,"328":1171,"329":1091,"330":1172,"331":1063,"332":986,"333":928,"334":1162,"335":929,"336":1163,"337":976,"338":231,"339":201,"340":1098,"341":215}', true));
+ } catch (\Exception $e) {
+ var_dump($e->getMessage());
+ }
}
try {
- $pdo->query("DROP TABLE b66584");
- $pdo->rollback();
+ $pdo->query("DROP TABLE b66584");
+ $pdo->rollback();
} catch (\Exception $e) {
}
@@ -48,11 +48,11 @@ function run($pdo, $data)
$stmt = $pdo->prepare("SELECT COUNT(*) FROM b66584 WHERE a IN ({$bind})");
- var_dump(count($data));
+ var_dump(count($data));
$stmt->execute($data);
- var_dump($stmt->fetchColumn());
+ var_dump($stmt->fetchColumn());
}
?>
diff --git a/ext/pdo_pgsql/tests/bug67462.phpt b/ext/pdo_pgsql/tests/bug67462.phpt
index 11a39a5f12..197bbb32ed 100644
--- a/ext/pdo_pgsql/tests/bug67462.phpt
+++ b/ext/pdo_pgsql/tests/bug67462.phpt
@@ -17,14 +17,14 @@ $pdo->setAttribute (\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
$pdo->beginTransaction();
try {
- $pdo->query("CREATE TABLE b67462 (a int NOT NULL PRIMARY KEY DEFERRABLE INITIALLY DEFERRED)");
- $pdo->query("INSERT INTO b67462 VALUES (1), (1)");
+ $pdo->query("CREATE TABLE b67462 (a int NOT NULL PRIMARY KEY DEFERRABLE INITIALLY DEFERRED)");
+ $pdo->query("INSERT INTO b67462 VALUES (1), (1)");
- var_dump($pdo->inTransaction());
- $pdo->commit(); // This should fail!
+ var_dump($pdo->inTransaction());
+ $pdo->commit(); // This should fail!
} catch (\Exception $e) {
- var_dump($pdo->inTransaction());
- var_dump($pdo->beginTransaction());
+ var_dump($pdo->inTransaction());
+ var_dump($pdo->beginTransaction());
}
?>
diff --git a/ext/pdo_pgsql/tests/bug68371.phpt b/ext/pdo_pgsql/tests/bug68371.phpt
index 24dc5f501f..8cbcc7179c 100644
--- a/ext/pdo_pgsql/tests/bug68371.phpt
+++ b/ext/pdo_pgsql/tests/bug68371.phpt
@@ -16,53 +16,53 @@ $pdo->setAttribute (\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
$attrs = array(
// Extensive test: default value and set+get values
- PDO::ATTR_EMULATE_PREPARES => array(null, true, false),
- PDO::PGSQL_ATTR_DISABLE_PREPARES => array(null, true, false),
+ PDO::ATTR_EMULATE_PREPARES => array(null, true, false),
+ PDO::PGSQL_ATTR_DISABLE_PREPARES => array(null, true, false),
// Just test the default
- PDO::ATTR_AUTOCOMMIT => array(null),
- PDO::ATTR_PREFETCH => array(null),
- PDO::ATTR_TIMEOUT => array(null),
- PDO::ATTR_ERRMODE => array(null),
- PDO::ATTR_SERVER_VERSION => array(null),
- PDO::ATTR_CLIENT_VERSION => array(null),
- PDO::ATTR_SERVER_INFO => array(null),
- PDO::ATTR_CONNECTION_STATUS => array(null),
- PDO::ATTR_CASE => array(null),
- PDO::ATTR_CURSOR_NAME => array(null),
- PDO::ATTR_CURSOR => array(null),
- PDO::ATTR_ORACLE_NULLS => array(null),
- PDO::ATTR_PERSISTENT => array(null),
- PDO::ATTR_STATEMENT_CLASS => array(null),
- PDO::ATTR_FETCH_TABLE_NAMES => array(null),
- PDO::ATTR_FETCH_CATALOG_NAMES => array(null),
- PDO::ATTR_DRIVER_NAME => array(null),
- PDO::ATTR_STRINGIFY_FETCHES => array(null),
- PDO::ATTR_MAX_COLUMN_LEN => array(null),
- PDO::ATTR_DEFAULT_FETCH_MODE => array(null),
+ PDO::ATTR_AUTOCOMMIT => array(null),
+ PDO::ATTR_PREFETCH => array(null),
+ PDO::ATTR_TIMEOUT => array(null),
+ PDO::ATTR_ERRMODE => array(null),
+ PDO::ATTR_SERVER_VERSION => array(null),
+ PDO::ATTR_CLIENT_VERSION => array(null),
+ PDO::ATTR_SERVER_INFO => array(null),
+ PDO::ATTR_CONNECTION_STATUS => array(null),
+ PDO::ATTR_CASE => array(null),
+ PDO::ATTR_CURSOR_NAME => array(null),
+ PDO::ATTR_CURSOR => array(null),
+ PDO::ATTR_ORACLE_NULLS => array(null),
+ PDO::ATTR_PERSISTENT => array(null),
+ PDO::ATTR_STATEMENT_CLASS => array(null),
+ PDO::ATTR_FETCH_TABLE_NAMES => array(null),
+ PDO::ATTR_FETCH_CATALOG_NAMES => array(null),
+ PDO::ATTR_DRIVER_NAME => array(null),
+ PDO::ATTR_STRINGIFY_FETCHES => array(null),
+ PDO::ATTR_MAX_COLUMN_LEN => array(null),
+ PDO::ATTR_DEFAULT_FETCH_MODE => array(null),
);
foreach ($attrs as $a => $vals) {
- foreach ($vals as $v) {
- try {
- if (!isset($v)) {
- var_dump($pdo->getAttribute($a));
- } else {
- $pdo->setAttribute($a, $v);
- if ($pdo->getAttribute($a) === $v) {
- echo "OK\n";
- } else {
- throw new \Exception('KO');
- }
- }
- } catch (\Exception $e) {
- if ($e->getCode() == 'IM001') {
- echo "ERR\n";
- } else {
- echo "ERR {$e->getMessage()}\n";
- }
- }
- }
+ foreach ($vals as $v) {
+ try {
+ if (!isset($v)) {
+ var_dump($pdo->getAttribute($a));
+ } else {
+ $pdo->setAttribute($a, $v);
+ if ($pdo->getAttribute($a) === $v) {
+ echo "OK\n";
+ } else {
+ throw new \Exception('KO');
+ }
+ }
+ } catch (\Exception $e) {
+ if ($e->getCode() == 'IM001') {
+ echo "ERR\n";
+ } else {
+ echo "ERR {$e->getMessage()}\n";
+ }
+ }
+ }
}
?>
diff --git a/ext/pdo_pgsql/tests/bug69344.phpt b/ext/pdo_pgsql/tests/bug69344.phpt
index 14d45d0ddb..f544518455 100644
--- a/ext/pdo_pgsql/tests/bug69344.phpt
+++ b/ext/pdo_pgsql/tests/bug69344.phpt
@@ -16,19 +16,19 @@ $pdo->setAttribute (\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
$pdo->setAttribute (\PDO::ATTR_DEFAULT_FETCH_MODE, \PDO::FETCH_ASSOC);
$test = function () use ($pdo) {
- $arr = [
- 0 => "a",
- 2 => "b",
- ];
-
- $stmt = $pdo->prepare("SELECT (?)::text AS a, (?)::text AS b");
-
- try {
- $stmt->execute($arr);
- var_dump($stmt->fetch());
- } catch (\Exception $e) {
- echo $e->getMessage()."\n";
- }
+ $arr = [
+ 0 => "a",
+ 2 => "b",
+ ];
+
+ $stmt = $pdo->prepare("SELECT (?)::text AS a, (?)::text AS b");
+
+ try {
+ $stmt->execute($arr);
+ var_dump($stmt->fetch());
+ } catch (\Exception $e) {
+ echo $e->getMessage()."\n";
+ }
};
$test();
diff --git a/ext/pdo_pgsql/tests/bug70313.phpt b/ext/pdo_pgsql/tests/bug70313.phpt
index f734442f8c..07c7f68ab3 100644
--- a/ext/pdo_pgsql/tests/bug70313.phpt
+++ b/ext/pdo_pgsql/tests/bug70313.phpt
@@ -15,20 +15,20 @@ $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
try {
- $stmt = $db->prepare(");");
+ $stmt = $db->prepare(");");
- $stmt->execute([1]);
+ $stmt->execute([1]);
} catch (PDOException $e) {
- var_dump($e->getCode());
+ var_dump($e->getCode());
}
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
try {
- $stmt = $db->prepare(");");
+ $stmt = $db->prepare(");");
- $stmt->execute([1]);
+ $stmt->execute([1]);
} catch (PDOException $e) {
- var_dump($e->getCode());
+ var_dump($e->getCode());
}
?>
diff --git a/ext/pdo_pgsql/tests/bug70861.phpt b/ext/pdo_pgsql/tests/bug70861.phpt
index 2da08e6e03..a7d1d1f9d6 100644
--- a/ext/pdo_pgsql/tests/bug70861.phpt
+++ b/ext/pdo_pgsql/tests/bug70861.phpt
@@ -15,7 +15,7 @@ $db = PDOTest::test_factory(__DIR__ . '/common.phpt');
$db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
try {
- @$db->query("SET bytea_output = 'escape'");
+ @$db->query("SET bytea_output = 'escape'");
} catch (Exception $e) {
}
@@ -23,10 +23,10 @@ $db->query('DROP TABLE IF EXISTS test_blob_crash CASCADE');
$db->query('CREATE TABLE test_blob_crash (id SERIAL NOT NULL, blob1 BYTEA)');
class HelloWrapper {
- public function stream_open() { return true; }
- public function stream_eof() { return true; }
- public function stream_read() { return NULL; }
- public function stream_stat() { return array(); }
+ public function stream_open() { return true; }
+ public function stream_eof() { return true; }
+ public function stream_read() { return NULL; }
+ public function stream_stat() { return array(); }
}
stream_wrapper_register("hello", "HelloWrapper");
diff --git a/ext/pdo_pgsql/tests/bug71885.phpt b/ext/pdo_pgsql/tests/bug71885.phpt
index ea5b1882ff..f47ffcb444 100644
--- a/ext/pdo_pgsql/tests/bug71885.phpt
+++ b/ext/pdo_pgsql/tests/bug71885.phpt
@@ -16,19 +16,19 @@ $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_NUM);
foreach ([false, true] as $emulate) {
- $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, $emulate);
+ $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, $emulate);
- try {
- $stmt = $db->prepare('select ?- lseg \'((-1,0),(1,0))\'');
- $stmt->execute();
- } catch (PDOException $e) {
- var_dump('ERR');
- }
+ try {
+ $stmt = $db->prepare('select ?- lseg \'((-1,0),(1,0))\'');
+ $stmt->execute();
+ } catch (PDOException $e) {
+ var_dump('ERR');
+ }
- $stmt = $db->prepare('select ??- lseg \'((-1,0),(1,0))\'');
- $stmt->execute();
+ $stmt = $db->prepare('select ??- lseg \'((-1,0),(1,0))\'');
+ $stmt->execute();
- var_dump($stmt->fetch());
+ var_dump($stmt->fetch());
}
?>
diff --git a/ext/pdo_pgsql/tests/bug71885_2.phpt b/ext/pdo_pgsql/tests/bug71885_2.phpt
index f957a39610..452902ed38 100644
--- a/ext/pdo_pgsql/tests/bug71885_2.phpt
+++ b/ext/pdo_pgsql/tests/bug71885_2.phpt
@@ -25,15 +25,15 @@ $db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_NUM);
$jsonb = $db->quote(json_encode(['a' => 1]));
foreach ([false, true] as $emulate) {
- $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, $emulate);
+ $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, $emulate);
- $stmt = $db->prepare("SELECT {$jsonb}::jsonb ?? ?");
- $stmt->execute(['b']);
- var_dump($stmt->fetch());
+ $stmt = $db->prepare("SELECT {$jsonb}::jsonb ?? ?");
+ $stmt->execute(['b']);
+ var_dump($stmt->fetch());
- $stmt = $db->prepare("SELECT {$jsonb}::jsonb ???");
- $stmt->execute(['a']);
- var_dump($stmt->fetch());
+ $stmt = $db->prepare("SELECT {$jsonb}::jsonb ???");
+ $stmt->execute(['a']);
+ var_dump($stmt->fetch());
}
?>
diff --git a/ext/pdo_pgsql/tests/bug72294.phpt b/ext/pdo_pgsql/tests/bug72294.phpt
index bd5124ff17..6940fa8d1f 100644
--- a/ext/pdo_pgsql/tests/bug72294.phpt
+++ b/ext/pdo_pgsql/tests/bug72294.phpt
@@ -102,7 +102,7 @@ class PreparedStatementCache
//return $pdo->prepare( $sql );
$this->cached_statements[$sql] = $pdo->prepare( $sql );
- return $this->cached_statements[$sql];
+ return $this->cached_statements[$sql];
}
}
@@ -110,29 +110,29 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
{
public function testIt()
{
- $pdo = PDOTest::test_factory(__DIR__ . '/common.phpt');
+ $pdo = PDOTest::test_factory(__DIR__ . '/common.phpt');
- $prepared_statement_cache = new PreparedStatementCache( $pdo );
+ $prepared_statement_cache = new PreparedStatementCache( $pdo );
- for( $i = 1; $i <= 300; ++$i ) {
- $statement = $prepared_statement_cache->prepare( $pdo, <<<SQL
+ for( $i = 1; $i <= 300; ++$i ) {
+ $statement = $prepared_statement_cache->prepare( $pdo, <<<SQL
SELECT $i;
SQL
- );
+ );
$statement->execute();
- }
+ }
}
public function test_construct()
{
- $pdo = PDOTest::test_factory(__DIR__ . '/common.phpt');
+ $pdo = PDOTest::test_factory(__DIR__ . '/common.phpt');
- $pdo->exec( 'CREATE TEMPORARY TABLE temp_table ( test_column INT NOT NULL );' );
+ $pdo->exec( 'CREATE TEMPORARY TABLE temp_table ( test_column INT NOT NULL );' );
- $this->cache = new PreparedStatementCache( $pdo );
+ $this->cache = new PreparedStatementCache( $pdo );
- $statement = $this->cache->prepare( $pdo, 'SELECT * FROM temp_table WHERE test_column > 0' );
- $statement->execute();
+ $statement = $this->cache->prepare( $pdo, 'SELECT * FROM temp_table WHERE test_column > 0' );
+ $statement->execute();
}
}
diff --git a/ext/pdo_pgsql/tests/bug72570.phpt b/ext/pdo_pgsql/tests/bug72570.phpt
index b479974484..1d5512f1f6 100644
--- a/ext/pdo_pgsql/tests/bug72570.phpt
+++ b/ext/pdo_pgsql/tests/bug72570.phpt
@@ -18,9 +18,9 @@ $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
$stmt = $db->prepare("SELECT 1");
try {
- var_dump($stmt->execute([1]));
+ var_dump($stmt->execute([1]));
} catch (PDOException $e) {
- var_dump($e->getCode());
+ var_dump($e->getCode());
}
?>
diff --git a/ext/pdo_pgsql/tests/bug75402.phpt b/ext/pdo_pgsql/tests/bug75402.phpt
index 9c7460b871..52ae4df957 100644
--- a/ext/pdo_pgsql/tests/bug75402.phpt
+++ b/ext/pdo_pgsql/tests/bug75402.phpt
@@ -46,7 +46,7 @@ $db->query("INSERT INTO bug75402 (\"id\", \"group_id\", \"submitter\", \"operati
-$sql = "SELECT
+$sql = "SELECT
ID as \"sID\",
GROUP_ID as \"sGroupID\",
SUBMITTER as \"sOwner\",
@@ -56,19 +56,19 @@ $sql = "SELECT
STATUS as \"sStatus\",
PROGRESS as \"sProgress\",
HIDDEN as \"bHidden\",
- to_char(INSERT_DATETIME, 'IYYY.MM.DD HH24:MI:SS') as \"sDatetime\"
- FROM bug75402
+ to_char(INSERT_DATETIME, 'IYYY.MM.DD HH24:MI:SS') as \"sDatetime\"
+ FROM bug75402
ORDER BY INSERT_DATETIME DESC";
if ($db) {
$stmt = $db->prepare($sql,
- array(
- // With the following options memory is not being
- // deallocated
- \PDO::ATTR_CURSOR => \PDO::CURSOR_SCROLL
- // With the following option memory is de-allocated
- // \PDO::ATTR_CURSOR => \PDO::CURSOR_FWDONLY
- )
+ array(
+ // With the following options memory is not being
+ // deallocated
+ \PDO::ATTR_CURSOR => \PDO::CURSOR_SCROLL
+ // With the following option memory is de-allocated
+ // \PDO::ATTR_CURSOR => \PDO::CURSOR_FWDONLY
+ )
);
$stmt->execute();
diff --git a/ext/pdo_pgsql/tests/bug_33876.phpt b/ext/pdo_pgsql/tests/bug_33876.phpt
index dc213f6abb..a425f6d9f6 100644
--- a/ext/pdo_pgsql/tests/bug_33876.phpt
+++ b/ext/pdo_pgsql/tests/bug_33876.phpt
@@ -23,70 +23,70 @@ $res = $db->prepare('SELECT foo from test where bar = ?');
# this is the portable approach to binding a bool
$res->bindValue(1, false, PDO::PARAM_BOOL);
if (!$res->execute())
- print_r($res->errorInfo());
+ print_r($res->errorInfo());
else
- print_r($res->fetchAll(PDO::FETCH_ASSOC));
+ print_r($res->fetchAll(PDO::FETCH_ASSOC));
# this is the portable approach to binding a bool
$res->bindValue(1, true, PDO::PARAM_BOOL);
if (!$res->execute())
- print_r($res->errorInfo());
+ print_r($res->errorInfo());
else
- print_r($res->fetchAll(PDO::FETCH_ASSOC));
+ print_r($res->fetchAll(PDO::FETCH_ASSOC));
# true gets cast to string (because the implied default is string)
# true-as-string is 1, so this "works"
if (!$res->execute(array(true)))
- print_r($res->errorInfo());
+ print_r($res->errorInfo());
else
- print_r($res->fetchAll(PDO::FETCH_ASSOC));
+ print_r($res->fetchAll(PDO::FETCH_ASSOC));
# Expected to fail; unless told otherwise, PDO assumes string inputs
# false -> "" as string, which pgsql doesn't like
if (!$res->execute(array(false)))
- print_r($res->errorInfo());
+ print_r($res->errorInfo());
else
- print_r($res->fetchAll(PDO::FETCH_ASSOC));
+ print_r($res->fetchAll(PDO::FETCH_ASSOC));
# And now using emulator prepares
echo "EMUL\n";
$res = $db->prepare('SELECT foo from test where bar = ?', array(
- PDO::ATTR_EMULATE_PREPARES => true));
+ PDO::ATTR_EMULATE_PREPARES => true));
# this is the portable approach to binding a bool
$res->bindValue(1, false, PDO::PARAM_BOOL);
if (!$res->execute())
- print_r($res->errorInfo());
+ print_r($res->errorInfo());
else
- print_r($res->fetchAll(PDO::FETCH_ASSOC));
+ print_r($res->fetchAll(PDO::FETCH_ASSOC));
# this is the portable approach to binding a bool
$res->bindValue(1, true, PDO::PARAM_BOOL);
if (!$res->execute())
- print_r($res->errorInfo());
+ print_r($res->errorInfo());
else
- print_r($res->fetchAll(PDO::FETCH_ASSOC));
+ print_r($res->fetchAll(PDO::FETCH_ASSOC));
# true gets cast to string (because the implied default is string)
# true-as-string is 1, so this "works"
if (!$res->execute(array(true)))
- print_r($res->errorInfo());
+ print_r($res->errorInfo());
else
- print_r($res->fetchAll(PDO::FETCH_ASSOC));
+ print_r($res->fetchAll(PDO::FETCH_ASSOC));
# Expected to fail; unless told otherwise, PDO assumes string inputs
# false -> "" as string, which pgsql doesn't like
if (!$res->execute(array(false))) {
- $err = $res->errorInfo();
- // Strip additional lines outputted by recent PgSQL versions
- $err[2] = trim(current(explode("\n", $err[2])));
- print_r($err);
+ $err = $res->errorInfo();
+ // Strip additional lines outputted by recent PgSQL versions
+ $err[2] = trim(current(explode("\n", $err[2])));
+ print_r($err);
} else {
- print_r($res->fetchAll(PDO::FETCH_ASSOC));
+ print_r($res->fetchAll(PDO::FETCH_ASSOC));
}
--EXPECTF--
Array
diff --git a/ext/pdo_pgsql/tests/config.inc b/ext/pdo_pgsql/tests/config.inc
index 0fefe4664b..367671e42a 100644
--- a/ext/pdo_pgsql/tests/config.inc
+++ b/ext/pdo_pgsql/tests/config.inc
@@ -1,16 +1,16 @@
<?php
if (false !== getenv('PDO_PGSQL_TEST_DSN')) {
- # user set them from their shell
- $config['ENV']['PDOTEST_DSN'] = getenv('PDO_PGSQL_TEST_DSN');
- if (false !== getenv('PDO_PGSQL_TEST_ATTR')) {
- $config['ENV']['PDOTEST_ATTR'] = getenv('PDO_PGSQL_TEST_ATTR');
- }
+ # user set them from their shell
+ $config['ENV']['PDOTEST_DSN'] = getenv('PDO_PGSQL_TEST_DSN');
+ if (false !== getenv('PDO_PGSQL_TEST_ATTR')) {
+ $config['ENV']['PDOTEST_ATTR'] = getenv('PDO_PGSQL_TEST_ATTR');
+ }
} else {
- $config['ENV']['PDOTEST_DSN'] = 'pgsql:host=localhost port=5432 dbname=test user=postgres password=postgres';
- $config['ENV']['PDOTEST_USER'] = 'postgres';
- $config['ENV']['PDOTEST_PASS'] = 'postgres';
+ $config['ENV']['PDOTEST_DSN'] = 'pgsql:host=localhost port=5432 dbname=test user=postgres password=postgres';
+ $config['ENV']['PDOTEST_USER'] = 'postgres';
+ $config['ENV']['PDOTEST_PASS'] = 'postgres';
}
foreach ($config['ENV'] as $k => $v) {
- putenv("$k=$v");
+ putenv("$k=$v");
}
diff --git a/ext/pdo_pgsql/tests/copy_from.phpt b/ext/pdo_pgsql/tests/copy_from.phpt
index 55a9df72aa..b57a8ea9ae 100644
--- a/ext/pdo_pgsql/tests/copy_from.phpt
+++ b/ext/pdo_pgsql/tests/copy_from.phpt
@@ -22,11 +22,11 @@ $tableRows = array();
$tableRowsWithDifferentNullValues = array();
for($i=0;$i<3;$i++) {
- $firstParameter = $i;
- $secondParameter = "test insert {$i}";
- $tableRows[] = "{$firstParameter}\t{$secondParameter}\t\\N";
- $tableRowsWithDifferentNullValues[] = "{$firstParameter};{$secondParameter};NULL";
- $tableRowsWithDifferentNullValuesAndSelectedFields[] = "{$firstParameter};NULL";
+ $firstParameter = $i;
+ $secondParameter = "test insert {$i}";
+ $tableRows[] = "{$firstParameter}\t{$secondParameter}\t\\N";
+ $tableRowsWithDifferentNullValues[] = "{$firstParameter};{$secondParameter};NULL";
+ $tableRowsWithDifferentNullValuesAndSelectedFields[] = "{$firstParameter};NULL";
}
$filename = 'test_pgsqlCopyFromFile.csv';
$filenameWithDifferentNullValues = 'test_pgsqlCopyFromFileWithDifferentNullValues.csv';
@@ -42,7 +42,7 @@ var_dump($db->pgsqlCopyFromArray('test',$tableRows));
$stmt = $db->query("select * from test");
foreach($stmt as $r) {
- var_dump($r);
+ var_dump($r);
}
$db->rollback();
@@ -51,7 +51,7 @@ $db->beginTransaction();
var_dump($db->pgsqlCopyFromArray('test',$tableRowsWithDifferentNullValues,";","NULL"));
$stmt = $db->query("select * from test");
foreach($stmt as $r) {
- var_dump($r);
+ var_dump($r);
}
$db->rollback();
@@ -60,16 +60,16 @@ $db->beginTransaction();
var_dump($db->pgsqlCopyFromArray('test',$tableRowsWithDifferentNullValuesAndSelectedFields,";","NULL",'a,c'));
$stmt = $db->query("select * from test");
foreach($stmt as $r) {
- var_dump($r);
+ var_dump($r);
}
$db->rollback();
echo "Testing pgsqlCopyFromArray() with error\n";
$db->beginTransaction();
try {
- var_dump($db->pgsqlCopyFromArray('test_error',$tableRowsWithDifferentNullValuesAndSelectedFields,";","NULL",'a,c'));
+ var_dump($db->pgsqlCopyFromArray('test_error',$tableRowsWithDifferentNullValuesAndSelectedFields,";","NULL",'a,c'));
} catch (Exception $e) {
- echo "Exception: {$e->getMessage()}\n";
+ echo "Exception: {$e->getMessage()}\n";
}
$db->rollback();
@@ -79,7 +79,7 @@ var_dump($db->pgsqlCopyFromFile('test',$filename));
$stmt = $db->query("select * from test");
foreach($stmt as $r) {
- var_dump($r);
+ var_dump($r);
}
$db->rollback();
@@ -88,7 +88,7 @@ $db->beginTransaction();
var_dump($db->pgsqlCopyFromFile('test',$filenameWithDifferentNullValues,";","NULL"));
$stmt = $db->query("select * from test");
foreach($stmt as $r) {
- var_dump($r);
+ var_dump($r);
}
$db->rollback();
@@ -97,31 +97,31 @@ $db->beginTransaction();
var_dump($db->pgsqlCopyFromFile('test',$filenameWithDifferentNullValuesAndSelectedFields,";","NULL",'a,c'));
$stmt = $db->query("select * from test");
foreach($stmt as $r) {
- var_dump($r);
+ var_dump($r);
}
$db->rollback();
echo "Testing pgsqlCopyFromFile() with error\n";
$db->beginTransaction();
try {
- var_dump($db->pgsqlCopyFromFile('test_error',$filenameWithDifferentNullValuesAndSelectedFields,";","NULL",'a,c'));
+ var_dump($db->pgsqlCopyFromFile('test_error',$filenameWithDifferentNullValuesAndSelectedFields,";","NULL",'a,c'));
} catch (Exception $e) {
- echo "Exception: {$e->getMessage()}\n";
+ echo "Exception: {$e->getMessage()}\n";
}
$db->rollback();
echo "Testing pgsqlCopyFromFile() with non existing file\n";
$db->beginTransaction();
try {
- var_dump($db->pgsqlCopyFromFile('test',"nonexisting/foo.csv",";","NULL",'a,c'));
+ var_dump($db->pgsqlCopyFromFile('test',"nonexisting/foo.csv",";","NULL",'a,c'));
} catch (Exception $e) {
- echo "Exception: {$e->getMessage()}\n";
+ echo "Exception: {$e->getMessage()}\n";
}
$db->rollback();
// Clean up
foreach (array($filename, $filenameWithDifferentNullValues, $filenameWithDifferentNullValuesAndSelectedFields) as $f) {
- @unlink($f);
+ @unlink($f);
}
?>
--EXPECTF--
diff --git a/ext/pdo_pgsql/tests/copy_to.phpt b/ext/pdo_pgsql/tests/copy_to.phpt
index 3df882c93c..edda1483db 100644
--- a/ext/pdo_pgsql/tests/copy_to.phpt
+++ b/ext/pdo_pgsql/tests/copy_to.phpt
@@ -22,13 +22,13 @@ echo "Preparing test table for CopyTo tests\n";
$stmt = $db->prepare("INSERT INTO test (a, b, c) values (?, ?, ?)");
for($i=0;$i<3;$i++) {
- $firstParameter = $i;
- $secondParameter = "test insert {$i}";
- $thirdParameter = NULL;
- $stmt->bindValue(1, $firstParameter);
- $stmt->bindValue(2, $secondParameter);
- $stmt->bindValue(3, $thirdParameter);
- $stmt->execute();
+ $firstParameter = $i;
+ $secondParameter = "test insert {$i}";
+ $thirdParameter = NULL;
+ $stmt->bindValue(1, $firstParameter);
+ $stmt->bindValue(2, $secondParameter);
+ $stmt->bindValue(3, $thirdParameter);
+ $stmt->execute();
}
$db->commit();
@@ -42,9 +42,9 @@ var_dump($db->pgsqlCopyToArray('test',";","NULL",'a,c'));
echo "Testing pgsqlCopyToArray() with error\n";
try {
- var_dump($db->pgsqlCopyToArray('test_error'));
+ var_dump($db->pgsqlCopyToArray('test_error'));
} catch (Exception $e) {
- echo "Exception: {$e->getMessage()}\n";
+ echo "Exception: {$e->getMessage()}\n";
}
echo "Testing pgsqlCopyToFile() with default parameters\n";
@@ -61,20 +61,20 @@ echo file_get_contents($filename);
echo "Testing pgsqlCopyToFile() with error\n";
try {
- var_dump($db->pgsqlCopyToFile('test_error',$filename));
+ var_dump($db->pgsqlCopyToFile('test_error',$filename));
} catch (Exception $e) {
- echo "Exception: {$e->getMessage()}\n";
+ echo "Exception: {$e->getMessage()}\n";
}
echo "Testing pgsqlCopyToFile() to unwritable file\n";
try {
- var_dump($db->pgsqlCopyToFile('test', 'nonexistent/foo.csv'));
+ var_dump($db->pgsqlCopyToFile('test', 'nonexistent/foo.csv'));
} catch (Exception $e) {
- echo "Exception: {$e->getMessage()}\n";
+ echo "Exception: {$e->getMessage()}\n";
}
if(isset($filename)) {
- @unlink($filename);
+ @unlink($filename);
}
?>
--EXPECTF--
diff --git a/ext/pdo_pgsql/tests/disable_prepares.phpt b/ext/pdo_pgsql/tests/disable_prepares.phpt
index bbc6a62e87..f224bffb15 100644
--- a/ext/pdo_pgsql/tests/disable_prepares.phpt
+++ b/ext/pdo_pgsql/tests/disable_prepares.phpt
@@ -15,7 +15,7 @@ $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_COLUMN);
$stmt = $db->prepare("SELECT statement FROM pg_prepared_statements", array(
- PDO::ATTR_EMULATE_PREPARES => true));
+ PDO::ATTR_EMULATE_PREPARES => true));
$stmt2 = $db->prepare("SELECT (?)::int2");
$stmt2->execute(array(1));
@@ -27,7 +27,7 @@ $stmt->execute();
$first = $stmt->fetchAll();
$stmt3 = $db->prepare("SELECT (?)::int4", array(
- PDO::PGSQL_ATTR_DISABLE_PREPARES => true));
+ PDO::PGSQL_ATTR_DISABLE_PREPARES => true));
$stmt3->execute(array(3));
var_dump($stmt3->fetch());
$stmt3->execute(array(4));
diff --git a/ext/pdo_pgsql/tests/is_in_transaction.phpt b/ext/pdo_pgsql/tests/is_in_transaction.phpt
index f5e950a047..cff798619b 100644
--- a/ext/pdo_pgsql/tests/is_in_transaction.phpt
+++ b/ext/pdo_pgsql/tests/is_in_transaction.phpt
@@ -39,19 +39,19 @@ $stmt->bindValue(1, "error");
$stmt->bindValue(2, "test insert");
$stmt->execute();
} catch (Exception $e) {
- /* We catch the exception because the execute will give error and we must test the PDO::PGSQL_TRANSACTION_ERROR */
- echo "Test PDO::PGSQL_TRANSACTION_INERROR\n";
- var_dump($db->inTransaction());
- $db->rollBack();
+ /* We catch the exception because the execute will give error and we must test the PDO::PGSQL_TRANSACTION_ERROR */
+ echo "Test PDO::PGSQL_TRANSACTION_INERROR\n";
+ var_dump($db->inTransaction());
+ $db->rollBack();
}
echo "Test PDO::PGSQL_TRANSACTION_IDLE\n";
var_dump($db->inTransaction());
} catch (Exception $e) {
- /* catch exceptions so that we can show the relative error */
- echo "Exception! at line ", $e->getLine(), "\n";
- var_dump($e->getMessage());
+ /* catch exceptions so that we can show the relative error */
+ echo "Exception! at line ", $e->getLine(), "\n";
+ var_dump($e->getMessage());
}
?>
diff --git a/ext/pdo_pgsql/tests/large_objects.phpt b/ext/pdo_pgsql/tests/large_objects.phpt
index 6215e49cb5..d1f1f05048 100644
--- a/ext/pdo_pgsql/tests/large_objects.phpt
+++ b/ext/pdo_pgsql/tests/large_objects.phpt
@@ -38,8 +38,8 @@ $stmt->bindColumn('bloboid', $lob, PDO::PARAM_LOB);
$stmt->execute();
echo "Fetching:\n";
while (($row = $stmt->fetch(PDO::FETCH_ASSOC))) {
- var_dump($row['blobid']);
- var_dump(stream_get_contents($lob));
+ var_dump($row['blobid']);
+ var_dump(stream_get_contents($lob));
}
echo "Fetched!\n";
@@ -49,8 +49,8 @@ $stmt->execute();
$stmt->bindColumn('bloboid', $lob, PDO::PARAM_LOB);
echo "Fetching late bind:\n";
while (($row = $stmt->fetch(PDO::FETCH_ASSOC))) {
- var_dump($row['blobid']);
- var_dump(is_int($row['bloboid']));
+ var_dump($row['blobid']);
+ var_dump(is_int($row['bloboid']));
}
echo "Fetched!\n";
@@ -60,16 +60,16 @@ $stmt->execute();
$stmt->bindColumn('bloboid', $lob, PDO::PARAM_LOB);
echo "Fetching NO bind:\n";
while (($row = $stmt->fetch(PDO::FETCH_ASSOC))) {
- var_dump($row['blobid']);
- var_dump(is_int($row['bloboid']));
+ var_dump($row['blobid']);
+ var_dump(is_int($row['bloboid']));
}
echo "Fetched!\n";
} catch (Exception $e) {
- /* catch exceptions so that we can guarantee to clean
- * up the LOB */
- echo "Exception! at line ", $e->getLine(), "\n";
- var_dump($e->getMessage());
+ /* catch exceptions so that we can guarantee to clean
+ * up the LOB */
+ echo "Exception! at line ", $e->getLine(), "\n";
+ var_dump($e->getMessage());
}
/* Now to remove the large object from the database, so it doesn't
diff --git a/ext/pdo_sqlite/pdo_sqlite.c b/ext/pdo_sqlite/pdo_sqlite.c
index 5c2fd63cdb..4f932cc969 100644
--- a/ext/pdo_sqlite/pdo_sqlite.c
+++ b/ext/pdo_sqlite/pdo_sqlite.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/pdo_sqlite/php_pdo_sqlite.h b/ext/pdo_sqlite/php_pdo_sqlite.h
index 73d8a98675..e9fe2463ff 100644
--- a/ext/pdo_sqlite/php_pdo_sqlite.h
+++ b/ext/pdo_sqlite/php_pdo_sqlite.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/pdo_sqlite/php_pdo_sqlite_int.h b/ext/pdo_sqlite/php_pdo_sqlite_int.h
index c1d3a953a0..31fa7cc9ff 100644
--- a/ext/pdo_sqlite/php_pdo_sqlite_int.h
+++ b/ext/pdo_sqlite/php_pdo_sqlite_int.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/pdo_sqlite/sqlite_driver.c b/ext/pdo_sqlite/sqlite_driver.c
index 120488e229..b96d59152e 100644
--- a/ext/pdo_sqlite/sqlite_driver.c
+++ b/ext/pdo_sqlite/sqlite_driver.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -536,14 +534,14 @@ static PHP_METHOD(SQLite, sqliteCreateFunction)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(argc)
Z_PARAM_LONG(flags)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
dbh = Z_PDO_DBH_P(ZEND_THIS);
PDO_CONSTRUCT_CHECK;
if (!zend_is_callable(callback, 0, NULL)) {
zend_string *cbname = zend_get_callable_name(callback);
- php_error_docref(NULL, E_WARNING, "function '%s' is not callable", ZSTR_VAL(cbname));
+ php_error_docref(NULL, E_WARNING, "Function '%s' is not callable", ZSTR_VAL(cbname));
zend_string_release_ex(cbname, 0);
RETURN_FALSE;
}
@@ -608,21 +606,21 @@ static PHP_METHOD(SQLite, sqliteCreateAggregate)
Z_PARAM_ZVAL(fini_callback)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(argc)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
dbh = Z_PDO_DBH_P(ZEND_THIS);
PDO_CONSTRUCT_CHECK;
if (!zend_is_callable(step_callback, 0, NULL)) {
zend_string *cbname = zend_get_callable_name(step_callback);
- php_error_docref(NULL, E_WARNING, "function '%s' is not callable", ZSTR_VAL(cbname));
+ php_error_docref(NULL, E_WARNING, "Function '%s' is not callable", ZSTR_VAL(cbname));
zend_string_release_ex(cbname, 0);
RETURN_FALSE;
}
if (!zend_is_callable(fini_callback, 0, NULL)) {
zend_string *cbname = zend_get_callable_name(fini_callback);
- php_error_docref(NULL, E_WARNING, "function '%s' is not callable", ZSTR_VAL(cbname));
+ php_error_docref(NULL, E_WARNING, "Function '%s' is not callable", ZSTR_VAL(cbname));
zend_string_release_ex(cbname, 0);
RETURN_FALSE;
}
@@ -668,14 +666,14 @@ static PHP_METHOD(SQLite, sqliteCreateCollation)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_STRING(collation_name, collation_name_len)
Z_PARAM_ZVAL(callback)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
dbh = Z_PDO_DBH_P(ZEND_THIS);
PDO_CONSTRUCT_CHECK;
if (!zend_is_callable(callback, 0, NULL)) {
zend_string *cbname = zend_get_callable_name(callback);
- php_error_docref(NULL, E_WARNING, "function '%s' is not callable", ZSTR_VAL(cbname));
+ php_error_docref(NULL, E_WARNING, "Function '%s' is not callable", ZSTR_VAL(cbname));
zend_string_release_ex(cbname, 0);
RETURN_FALSE;
}
diff --git a/ext/pdo_sqlite/sqlite_statement.c b/ext/pdo_sqlite/sqlite_statement.c
index 80bdcafd10..db1bbf9b14 100644
--- a/ext/pdo_sqlite/sqlite_statement.c
+++ b/ext/pdo_sqlite/sqlite_statement.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/pdo_sqlite/tests/bug35336.phpt b/ext/pdo_sqlite/tests/bug35336.phpt
index 201429bc4e..52a425b62f 100644
--- a/ext/pdo_sqlite/tests/bug35336.phpt
+++ b/ext/pdo_sqlite/tests/bug35336.phpt
@@ -7,9 +7,9 @@ if (!extension_loaded('pdo_sqlite')) print 'skip not loaded';
--FILE--
<?php
class EEE {
- function __set ($field, $value) {
- echo "hello world\n";
- }
+ function __set ($field, $value) {
+ echo "hello world\n";
+ }
}
$a = new PDO("sqlite::memory:");// pool ("sqlite::memory:");
diff --git a/ext/pdo_sqlite/tests/bug43831.phpt b/ext/pdo_sqlite/tests/bug43831.phpt
index 4620559da4..1909d88033 100644
--- a/ext/pdo_sqlite/tests/bug43831.phpt
+++ b/ext/pdo_sqlite/tests/bug43831.phpt
@@ -6,23 +6,23 @@ Bug #43831 ($this gets mangled when extending PDO with persistent connection)
<?php
class Foo extends PDO {
- function __construct($dsn) {
- parent::__construct($dsn, null, null, array(PDO::ATTR_PERSISTENT => true));
- }
+ function __construct($dsn) {
+ parent::__construct($dsn, null, null, array(PDO::ATTR_PERSISTENT => true));
+ }
}
class Baz extends PDO {
- function __construct($dsn) {
- parent::__construct($dsn, null, null, array(PDO::ATTR_PERSISTENT => true));
- }
+ function __construct($dsn) {
+ parent::__construct($dsn, null, null, array(PDO::ATTR_PERSISTENT => true));
+ }
}
class Bar extends Baz {
- function quux() {
- echo get_class($this), "\n";
- $foo = new Foo("sqlite::memory:");
- echo get_class($this), "\n";
- }
+ function quux() {
+ echo get_class($this), "\n";
+ $foo = new Foo("sqlite::memory:");
+ echo get_class($this), "\n";
+ }
}
$bar = new Bar("sqlite::memory:");
@@ -49,5 +49,5 @@ object(PDO)#%d (0) {
object(MyPDO)#%d (0) {
}
-Notice: Undefined variable: bar in %s on line %d
+Warning: Undefined variable: bar in %s on line %d
NULL
diff --git a/ext/pdo_sqlite/tests/bug48773.phpt b/ext/pdo_sqlite/tests/bug48773.phpt
index c9a2f64bef..a5f43cdd92 100644
--- a/ext/pdo_sqlite/tests/bug48773.phpt
+++ b/ext/pdo_sqlite/tests/bug48773.phpt
@@ -8,18 +8,18 @@ if (!extension_loaded('pdo_sqlite')) print 'skip not loaded';
<?php
class bar extends PDOStatement {
- private function __construct() {
- }
+ private function __construct() {
+ }
}
class foo extends PDO {
- public $statementClass = 'bar';
- function __construct($dsn, $username, $password, $driver_options = array()) {
- $driver_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
- parent::__construct($dsn, $username, $password, $driver_options);
+ public $statementClass = 'bar';
+ function __construct($dsn, $username, $password, $driver_options = array()) {
+ $driver_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
+ parent::__construct($dsn, $username, $password, $driver_options);
- $this->setAttribute(PDO::ATTR_STATEMENT_CLASS, array($this->statementClass, array($this)));
- }
+ $this->setAttribute(PDO::ATTR_STATEMENT_CLASS, array($this->statementClass, array($this)));
+ }
}
$db = new foo('sqlite::memory:', '', '');
diff --git a/ext/pdo_sqlite/tests/bug50728.phpt b/ext/pdo_sqlite/tests/bug50728.phpt
index b00ea50cf0..98f8907f48 100644
--- a/ext/pdo_sqlite/tests/bug50728.phpt
+++ b/ext/pdo_sqlite/tests/bug50728.phpt
@@ -7,9 +7,9 @@ if (!extension_loaded('pdo_sqlite')) print 'skip not loaded';
--FILE--
<?php
try {
- $a = new PDO("sqlite:/this/path/should/not/exist.db");
+ $a = new PDO("sqlite:/this/path/should/not/exist.db");
} catch (PDOException $e) {
- var_dump($e->getCode());
+ var_dump($e->getCode());
}
?>
--EXPECT--
diff --git a/ext/pdo_sqlite/tests/bug52487.phpt b/ext/pdo_sqlite/tests/bug52487.phpt
index ff586d2f64..17a581296a 100644
--- a/ext/pdo_sqlite/tests/bug52487.phpt
+++ b/ext/pdo_sqlite/tests/bug52487.phpt
@@ -11,7 +11,7 @@ $db = PDOTest::test_factory(__DIR__ . '/common.phpt');
$stmt = $db->prepare("select 1 as attr");
for ($i = 0; $i < 10; $i++) {
- $stmt->setFetchMode(PDO::FETCH_INTO, new stdClass);
+ $stmt->setFetchMode(PDO::FETCH_INTO, new stdClass);
}
print "ok\n";
diff --git a/ext/pdo_sqlite/tests/bug66033.phpt b/ext/pdo_sqlite/tests/bug66033.phpt
index ebd519171a..c48ebe41ec 100644
--- a/ext/pdo_sqlite/tests/bug66033.phpt
+++ b/ext/pdo_sqlite/tests/bug66033.phpt
@@ -7,26 +7,26 @@ if (!extension_loaded('pdo_sqlite')) print 'skip not loaded';
--FILE--
<?php
class DBStatement extends PDOStatement {
- public $dbh;
- protected function __construct($dbh) {
- $this->dbh = $dbh;
- throw new Exception("Blah");
- }
+ public $dbh;
+ protected function __construct($dbh) {
+ $this->dbh = $dbh;
+ throw new Exception("Blah");
+ }
}
$pdo = new PDO('sqlite::memory:', null, null);
$pdo->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('DBStatement',
- array($pdo)));
+ array($pdo)));
$pdo->exec("CREATE TABLE IF NOT EXISTS messages (
- id INTEGER PRIMARY KEY,
- title TEXT,
- message TEXT,
- time INTEGER)");
+ id INTEGER PRIMARY KEY,
+ title TEXT,
+ message TEXT,
+ time INTEGER)");
try {
- $pdoStatement = $pdo->query("select * from messages");
+ $pdoStatement = $pdo->query("select * from messages");
} catch (Exception $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
?>
--EXPECT--
diff --git a/ext/pdo_sqlite/tests/bug70862.phpt b/ext/pdo_sqlite/tests/bug70862.phpt
index d66bb6262f..f676d66387 100644
--- a/ext/pdo_sqlite/tests/bug70862.phpt
+++ b/ext/pdo_sqlite/tests/bug70862.phpt
@@ -14,10 +14,10 @@ $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
$db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
class HelloWrapper {
- public function stream_open() { return true; }
- public function stream_eof() { return true; }
- public function stream_read() { return NULL; }
- public function stream_stat() { return array(); }
+ public function stream_open() { return true; }
+ public function stream_eof() { return true; }
+ public function stream_read() { return NULL; }
+ public function stream_stat() { return array(); }
}
stream_wrapper_register("hello", "HelloWrapper");
diff --git a/ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt b/ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt
index c452d4c34f..525e29b953 100644
--- a/ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt
+++ b/ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt
@@ -34,27 +34,27 @@ $st = $db->query('SELECT * FROM testing');
var_dump($st->fetchAll(PDO::FETCH_FUNC, array('self', 'foo')));
class foo {
- public function method($x) {
- return "--- $x ---";
- }
+ public function method($x) {
+ return "--- $x ---";
+ }
}
class bar extends foo {
- public function __construct($db) {
- $st = $db->query('SELECT * FROM testing');
- var_dump($st->fetchAll(PDO::FETCH_FUNC, array($this, 'parent::method')));
- }
-
- static public function test($x, $y) {
- return $x .'---'. $y;
- }
-
- private function test2($x, $y) {
- return $x;
- }
-
- public function test3($x, $y) {
- return $x .'==='. $y;
- }
+ public function __construct($db) {
+ $st = $db->query('SELECT * FROM testing');
+ var_dump($st->fetchAll(PDO::FETCH_FUNC, array($this, 'parent::method')));
+ }
+
+ static public function test($x, $y) {
+ return $x .'---'. $y;
+ }
+
+ private function test2($x, $y) {
+ return $x;
+ }
+
+ public function test3($x, $y) {
+ return $x .'==='. $y;
+ }
}
new bar($db);
@@ -117,14 +117,11 @@ array(2) {
string(4) "2---"
}
-Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error: cannot access private method bar::test2() in %s on line %d
+Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error: non-static method bar::test2() cannot be called statically in %s on line %d
+bool(false)
+
+Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error: non-static method bar::test3() cannot be called statically in %s on line %d
bool(false)
-array(2) {
- [0]=>
- string(7) "1===php"
- [1]=>
- string(4) "2==="
-}
Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error: class 'bar' does not have a method 'inexistent' in %s on line %d
bool(false)
diff --git a/ext/pdo_sqlite/tests/pdo_sqlite_createaggregate.phpt b/ext/pdo_sqlite/tests/pdo_sqlite_createaggregate.phpt
index c9157d1b05..b21620bee7 100644
--- a/ext/pdo_sqlite/tests/pdo_sqlite_createaggregate.phpt
+++ b/ext/pdo_sqlite/tests/pdo_sqlite_createaggregate.phpt
@@ -16,7 +16,7 @@ $db->sqliteCreateAggregate('testing', function(&$a, $b) { $a .= $b; return $a; }
foreach ($db->query('SELECT testing(name) FROM foobar') as $row) {
- var_dump($row);
+ var_dump($row);
}
$db->query('DROP TABLE foobar');
diff --git a/ext/pdo_sqlite/tests/pdo_sqlite_createaggregate_002.phpt b/ext/pdo_sqlite/tests/pdo_sqlite_createaggregate_002.phpt
index 671e4b3454..8bddde7165 100644
--- a/ext/pdo_sqlite/tests/pdo_sqlite_createaggregate_002.phpt
+++ b/ext/pdo_sqlite/tests/pdo_sqlite_createaggregate_002.phpt
@@ -12,6 +12,6 @@ $pdo->sqliteCreateAggregate('foo', 'strlen', '');
?>
--EXPECTF--
-Warning: PDO::sqliteCreateAggregate(): function 'a' is not callable in %s on line %d
+Warning: PDO::sqliteCreateAggregate(): Function 'a' is not callable in %s on line %d
-Warning: PDO::sqliteCreateAggregate(): function '' is not callable in %s on line %d
+Warning: PDO::sqliteCreateAggregate(): Function '' is not callable in %s on line %d
diff --git a/ext/pdo_sqlite/tests/pdo_sqlite_createcollation.phpt b/ext/pdo_sqlite/tests/pdo_sqlite_createcollation.phpt
index fcfc344896..0742d20e84 100644
--- a/ext/pdo_sqlite/tests/pdo_sqlite_createcollation.phpt
+++ b/ext/pdo_sqlite/tests/pdo_sqlite_createcollation.phpt
@@ -18,7 +18,7 @@ $db->sqliteCreateCollation('MYCOLLATE', function($a, $b) { return strnatcmp($a,
$result = $db->query('SELECT name FROM foobar ORDER BY name COLLATE MYCOLLATE');
foreach ($result as $row) {
- echo $row['name'] . "\n";
+ echo $row['name'] . "\n";
}
$result = $db->query('SELECT name FROM foobar ORDER BY name');
diff --git a/ext/pdo_sqlite/tests/pdo_sqlite_createfunction.phpt b/ext/pdo_sqlite/tests/pdo_sqlite_createfunction.phpt
index 1e753f3799..45075e9748 100644
--- a/ext/pdo_sqlite/tests/pdo_sqlite_createfunction.phpt
+++ b/ext/pdo_sqlite/tests/pdo_sqlite_createfunction.phpt
@@ -17,7 +17,7 @@ $db->sqliteCreateFunction('testing', function($v) { return strtolower($v); });
foreach ($db->query('SELECT testing(name) FROM foobar') as $row) {
- var_dump($row);
+ var_dump($row);
}
$db->query('DROP TABLE foobar');
diff --git a/ext/pdo_sqlite/tests/pdo_sqlite_createfunction_002.phpt b/ext/pdo_sqlite/tests/pdo_sqlite_createfunction_002.phpt
index a1d890ac1b..190c0d8b6c 100644
--- a/ext/pdo_sqlite/tests/pdo_sqlite_createfunction_002.phpt
+++ b/ext/pdo_sqlite/tests/pdo_sqlite_createfunction_002.phpt
@@ -14,4 +14,4 @@ $db->sqliteCreateFunction('bar-alias', 'bar');
?>
--EXPECTF--
-Warning: PDO::sqliteCreateFunction(): function 'bar' is not callable in %s on line %d
+Warning: PDO::sqliteCreateFunction(): Function 'bar' is not callable in %s on line %d
diff --git a/ext/pdo_sqlite/tests/pdo_sqlite_createfunction_with_flags.phpt b/ext/pdo_sqlite/tests/pdo_sqlite_createfunction_with_flags.phpt
index 5a329a1d97..9cb6ecc02d 100644
--- a/ext/pdo_sqlite/tests/pdo_sqlite_createfunction_with_flags.phpt
+++ b/ext/pdo_sqlite/tests/pdo_sqlite_createfunction_with_flags.phpt
@@ -20,7 +20,7 @@ $db->sqliteCreateFunction('testing', function($v) { return strtolower($v); }, 1,
foreach ($db->query('SELECT testing(name) FROM foobar') as $row) {
- var_dump($row);
+ var_dump($row);
}
$db->query('DROP TABLE foobar');
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index 9f51256ac5..9450bf0f61 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -1551,11 +1549,11 @@ PHP_FUNCTION(pg_connect_poll)
int ret;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pgsql_link) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((pgsql = (PGconn *)zend_fetch_resource2(Z_RES_P(pgsql_link), "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
ret = PQconnectPoll(pgsql);
@@ -1580,7 +1578,7 @@ PHP_FUNCTION(pg_close)
zend_resource *link;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|r", &pgsql_link) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!pgsql_link) {
@@ -1593,7 +1591,7 @@ PHP_FUNCTION(pg_close)
link = Z_RES_P(pgsql_link);
if (zend_fetch_resource2(link, "PostgreSQL link", le_link, le_plink) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (link == PGG(default_link)) {
@@ -1626,7 +1624,7 @@ static void php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type
char *result;
if (zend_parse_parameters(argc, "|r", &pgsql_link) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (argc == 0) {
@@ -1637,7 +1635,7 @@ static void php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type
}
if ((pgsql = (PGconn *)zend_fetch_resource2(link, "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
switch(entry_type) {
@@ -1780,7 +1778,7 @@ PHP_FUNCTION(pg_parameter_status)
}
if ((pgsql = (PGconn *)zend_fetch_resource2(link, "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
param = (char*)PQparameterStatus(pgsql, param);
@@ -1810,7 +1808,7 @@ PHP_FUNCTION(pg_ping)
}
if ((pgsql = (PGconn *)zend_fetch_resource2(link, "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* ping connection */
@@ -1846,19 +1844,19 @@ PHP_FUNCTION(pg_query)
if (argc == 1) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &query, &query_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
link = FETCH_DEFAULT_LINK();
CHECK_DEFAULT_LINK(link);
} else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &pgsql_link, &query, &query_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
link = Z_RES_P(pgsql_link);
}
if ((pgsql = (PGconn *)zend_fetch_resource2(link, "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (PQ_SETNONBLOCKING(pgsql, 0)) {
@@ -1949,19 +1947,19 @@ PHP_FUNCTION(pg_query_params)
if (argc == 2) {
if (zend_parse_parameters(argc, "sa", &query, &query_len, &pv_param_arr) == FAILURE) {
- return;
+ RETURN_THROWS();
}
link = FETCH_DEFAULT_LINK();
CHECK_DEFAULT_LINK(link);
} else {
if (zend_parse_parameters(argc, "rsa", &pgsql_link, &query, &query_len, &pv_param_arr) == FAILURE) {
- return;
+ RETURN_THROWS();
}
link = Z_RES_P(pgsql_link);
}
if ((pgsql = (PGconn *)zend_fetch_resource2(link, "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (PQ_SETNONBLOCKING(pgsql, 0)) {
@@ -2065,19 +2063,19 @@ PHP_FUNCTION(pg_prepare)
if (argc == 2) {
if (zend_parse_parameters(argc, "ss", &stmtname, &stmtname_len, &query, &query_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
link = FETCH_DEFAULT_LINK();
CHECK_DEFAULT_LINK(link);
} else {
if (zend_parse_parameters(argc, "rss", &pgsql_link, &stmtname, &stmtname_len, &query, &query_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
link = Z_RES_P(pgsql_link);
}
if ((pgsql = (PGconn *)zend_fetch_resource2(link, "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (PQ_SETNONBLOCKING(pgsql, 0)) {
@@ -2152,19 +2150,19 @@ PHP_FUNCTION(pg_execute)
if (argc == 2) {
if (zend_parse_parameters(argc, "sa", &stmtname, &stmtname_len, &pv_param_arr)==FAILURE) {
- return;
+ RETURN_THROWS();
}
link = FETCH_DEFAULT_LINK();
CHECK_DEFAULT_LINK(link);
} else {
if (zend_parse_parameters(argc, "rsa", &pgsql_link, &stmtname, &stmtname_len, &pv_param_arr) == FAILURE) {
- return;
+ RETURN_THROWS();
}
link = Z_RES_P(pgsql_link);
}
if ((pgsql = (PGconn *)zend_fetch_resource2(link, "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (PQ_SETNONBLOCKING(pgsql, 0)) {
@@ -2257,11 +2255,11 @@ static void php_pgsql_get_result_info(INTERNAL_FUNCTION_PARAMETERS, int entry_ty
pgsql_result_handle *pg_result;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &result) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((pg_result = (pgsql_result_handle *)zend_fetch_resource(Z_RES_P(result), "PostgreSQL result", le_result)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
pgsql_result = pg_result->result;
@@ -2323,12 +2321,12 @@ PHP_FUNCTION(pg_last_notice)
zend_long option = PGSQL_NOTICE_LAST;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|l", &pgsql_link, &option) == FAILURE) {
- return;
+ RETURN_THROWS();
}
/* Just to check if user passed valid resoruce */
if ((pg_link = (PGconn *)zend_fetch_resource2(Z_RES_P(pgsql_link), "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
notices = zend_hash_index_find(&PGG(notices), (zend_ulong)Z_RES_HANDLE_P(pgsql_link));
@@ -2339,14 +2337,14 @@ PHP_FUNCTION(pg_last_notice)
if ((notice = zend_hash_get_current_data(Z_ARRVAL_P(notices))) == NULL) {
RETURN_EMPTY_STRING();
}
- RETURN_ZVAL(notice, 1, 0);
+ RETURN_COPY(notice);
} else {
RETURN_EMPTY_STRING();
}
break;
case PGSQL_NOTICE_ALL:
if (notices) {
- RETURN_ZVAL(notices, 1, 0);
+ RETURN_COPY(notices);
} else {
array_init(return_value);
return;
@@ -2442,11 +2440,11 @@ PHP_FUNCTION(pg_field_table)
zend_resource *field_table;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl|b", &result, &fnum, &return_oid) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((pg_result = (pgsql_result_handle *)zend_fetch_resource(Z_RES_P(result), "PostgreSQL result", le_result)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (fnum < 0 || fnum >= PQnfields(pg_result->result)) {
@@ -2535,11 +2533,11 @@ static void php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_typ
Oid oid;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &result, &field) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((pg_result = (pgsql_result_handle *)zend_fetch_resource(Z_RES_P(result), "PostgreSQL result", le_result)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
@@ -2627,11 +2625,11 @@ PHP_FUNCTION(pg_field_num)
pgsql_result_handle *pg_result;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &result, &field, &field_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((pg_result = (pgsql_result_handle *)zend_fetch_resource(Z_RES_P(result), "PostgreSQL result", le_result)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
pgsql_result = pg_result->result;
@@ -2652,16 +2650,16 @@ PHP_FUNCTION(pg_fetch_result)
if (argc == 2) {
if (zend_parse_parameters(argc, "rz", &result, &field) == FAILURE) {
- return;
+ RETURN_THROWS();
}
} else {
if (zend_parse_parameters(argc, "rlz", &result, &row, &field) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
if ((pg_result = (pgsql_result_handle *)zend_fetch_resource(Z_RES_P(result), "PostgreSQL result", le_result)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
pgsql_result = pg_result->result;
@@ -2725,7 +2723,7 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, zend_long result_
zend_string *class_name = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|z!Sz", &result, &zrow, &class_name, &ctor_params) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!class_name) {
ce = zend_standard_class_def;
@@ -2739,7 +2737,7 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, zend_long result_
result_type = PGSQL_ASSOC;
} else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|z!l", &result, &zrow, &result_type) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
if (zrow == NULL) {
@@ -2760,7 +2758,7 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, zend_long result_
}
if ((pg_result = (pgsql_result_handle *)zend_fetch_resource(Z_RES_P(result), "PostgreSQL result", le_result)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
pgsql_result = pg_result->result;
@@ -2842,7 +2840,7 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, zend_long result_
* argument passed by reference.
*/
zend_throw_exception(zend_ce_exception, "Parameter ctor_params must be an array", 0);
- return;
+ RETURN_THROWS();
}
}
@@ -2913,7 +2911,7 @@ PHP_FUNCTION(pg_fetch_all)
pgsql_result_handle *pg_result;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|l", &result, &result_type) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!(result_type & PGSQL_BOTH)) {
@@ -2922,7 +2920,7 @@ PHP_FUNCTION(pg_fetch_all)
}
if ((pg_result = (pgsql_result_handle *)zend_fetch_resource(Z_RES_P(result), "PostgreSQL result", le_result)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
pgsql_result = pg_result->result;
@@ -2946,11 +2944,11 @@ PHP_FUNCTION(pg_fetch_all_columns)
size_t num_fields;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|l", &result, &colno) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ((pg_result = (pgsql_result_handle *)zend_fetch_resource(Z_RES_P(result), "PostgreSQL result", le_result)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
pgsql_result = pg_result->result;
@@ -2986,11 +2984,11 @@ PHP_FUNCTION(pg_result_seek)
pgsql_result_handle *pg_result;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &result, &row) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((pg_result = (pgsql_result_handle *)zend_fetch_resource(Z_RES_P(result), "PostgreSQL result", le_result)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (row < 0 || row >= PQntuples(pg_result->result)) {
@@ -3018,16 +3016,16 @@ static void php_pgsql_data_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
if (argc == 2) {
if (zend_parse_parameters(argc, "rz", &result, &field) == FAILURE) {
- return;
+ RETURN_THROWS();
}
} else {
if (zend_parse_parameters(argc, "rlz", &result, &row, &field) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
if ((pg_result = (pgsql_result_handle *)zend_fetch_resource(Z_RES_P(result), "PostgreSQL result", le_result)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
pgsql_result = pg_result->result;
@@ -3101,11 +3099,11 @@ PHP_FUNCTION(pg_free_result)
pgsql_result_handle *pg_result;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &result) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((pg_result = (pgsql_result_handle *)zend_fetch_resource(Z_RES_P(result), "PostgreSQL result", le_result)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
zend_list_close(Z_RES_P(result));
@@ -3125,11 +3123,11 @@ PHP_FUNCTION(pg_last_oid)
#endif
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &result) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((pg_result = (pgsql_result_handle *)zend_fetch_resource(Z_RES_P(result), "PostgreSQL result", le_result)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
pgsql_result = pg_result->result;
@@ -3163,7 +3161,7 @@ PHP_FUNCTION(pg_trace)
zend_resource *link;
if (zend_parse_parameters(argc, "p|sr", &z_filename, &z_filename_len, &mode, &mode_len, &pgsql_link) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (argc < 3) {
@@ -3174,7 +3172,7 @@ PHP_FUNCTION(pg_trace)
}
if ((pgsql = (PGconn *)zend_fetch_resource2(link, "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
stream = php_stream_open_wrapper(z_filename, mode, REPORT_ERRORS, NULL);
@@ -3203,7 +3201,7 @@ PHP_FUNCTION(pg_untrace)
zend_resource *link;
if (zend_parse_parameters(argc, "|r", &pgsql_link) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (argc == 0) {
@@ -3214,7 +3212,7 @@ PHP_FUNCTION(pg_untrace)
}
if ((pgsql = (PGconn *)zend_fetch_resource2(link, "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
PQuntrace(pgsql);
@@ -3233,7 +3231,7 @@ PHP_FUNCTION(pg_lo_create)
zend_resource *link;
if (zend_parse_parameters(argc, "|zz", &pgsql_link, &oid) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((argc == 1) && (Z_TYPE_P(pgsql_link) != IS_RESOURCE)) {
@@ -3251,7 +3249,7 @@ PHP_FUNCTION(pg_lo_create)
}
if ((pgsql = (PGconn *)zend_fetch_resource2(link, "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (oid) {
@@ -3265,20 +3263,20 @@ PHP_FUNCTION(pg_lo_create)
wanted_oid = (Oid)strtoul(Z_STRVAL_P(oid), &end_ptr, 10);
if ((Z_STRVAL_P(oid)+Z_STRLEN_P(oid)) != end_ptr) {
/* wrong integer format */
- php_error_docref(NULL, E_NOTICE, "invalid OID value passed");
+ php_error_docref(NULL, E_NOTICE, "Invalid OID value passed");
RETURN_FALSE;
}
}
break;
case IS_LONG:
if (Z_LVAL_P(oid) < (zend_long)InvalidOid) {
- php_error_docref(NULL, E_NOTICE, "invalid OID value passed");
+ php_error_docref(NULL, E_NOTICE, "Invalid OID value passed");
RETURN_FALSE;
}
wanted_oid = (Oid)Z_LVAL_P(oid);
break;
default:
- php_error_docref(NULL, E_NOTICE, "invalid OID value passed");
+ php_error_docref(NULL, E_NOTICE, "Invalid OID value passed");
RETURN_FALSE;
}
if ((pgsql_oid = lo_create(pgsql, wanted_oid)) == InvalidOid) {
@@ -3359,7 +3357,7 @@ PHP_FUNCTION(pg_lo_unlink)
}
if ((pgsql = (PGconn *)zend_fetch_resource2(link, "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (lo_unlink(pgsql, oid) == -1) {
@@ -3433,7 +3431,7 @@ PHP_FUNCTION(pg_lo_open)
}
if ((pgsql = (PGconn *)zend_fetch_resource2(link, "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* r/w/+ is little bit more PHP-like than INV_READ/INV_WRITE and a lot of
@@ -3500,11 +3498,11 @@ PHP_FUNCTION(pg_lo_close)
pgLofp *pgsql;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pgsql_lofp) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((pgsql = (pgLofp *)zend_fetch_resource(Z_RES_P(pgsql_lofp), "PostgreSQL large object", le_lofp)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (lo_close((PGconn *)pgsql->conn, pgsql->lofd) < 0) {
@@ -3533,11 +3531,11 @@ PHP_FUNCTION(pg_lo_read)
pgLofp *pgsql;
if (zend_parse_parameters(argc, "r|l", &pgsql_id, &len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((pgsql = (pgLofp *)zend_fetch_resource(Z_RES_P(pgsql_id), "PostgreSQL large object", le_lofp)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (argc > 1) {
@@ -3569,7 +3567,7 @@ PHP_FUNCTION(pg_lo_write)
int argc = ZEND_NUM_ARGS();
if (zend_parse_parameters(argc, "rs|l", &pgsql_id, &str, &str_len, &z_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (argc > 2) {
@@ -3588,7 +3586,7 @@ PHP_FUNCTION(pg_lo_write)
}
if ((pgsql = (pgLofp *)zend_fetch_resource(Z_RES_P(pgsql_id), "PostgreSQL large object", le_lofp)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ((nbytes = lo_write((PGconn *)pgsql->conn, pgsql->lofd, str, len)) == (size_t)-1) {
@@ -3610,11 +3608,11 @@ PHP_FUNCTION(pg_lo_read_all)
pgLofp *pgsql;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pgsql_id) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((pgsql = (pgLofp *)zend_fetch_resource(Z_RES_P(pgsql_id), "PostgreSQL large object", le_lofp)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
tbytes = 0;
@@ -3662,7 +3660,7 @@ PHP_FUNCTION(pg_lo_import)
}
if ((pgsql = (PGconn *)zend_fetch_resource2(link, "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (oid) {
@@ -3677,20 +3675,20 @@ PHP_FUNCTION(pg_lo_import)
wanted_oid = (Oid)strtoul(Z_STRVAL_P(oid), &end_ptr, 10);
if ((Z_STRVAL_P(oid)+Z_STRLEN_P(oid)) != end_ptr) {
/* wrong integer format */
- php_error_docref(NULL, E_NOTICE, "invalid OID value passed");
+ php_error_docref(NULL, E_NOTICE, "Invalid OID value passed");
RETURN_FALSE;
}
}
break;
case IS_LONG:
if (Z_LVAL_P(oid) < (zend_long)InvalidOid) {
- php_error_docref(NULL, E_NOTICE, "invalid OID value passed");
+ php_error_docref(NULL, E_NOTICE, "Invalid OID value passed");
RETURN_FALSE;
}
wanted_oid = (Oid)Z_LVAL_P(oid);
break;
default:
- php_error_docref(NULL, E_NOTICE, "invalid OID value passed");
+ php_error_docref(NULL, E_NOTICE, "Invalid OID value passed");
RETURN_FALSE;
}
@@ -3798,7 +3796,7 @@ PHP_FUNCTION(pg_lo_export)
}
if ((pgsql = (PGconn *)zend_fetch_resource2(link, "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (lo_export(pgsql, oid, file_out) == -1) {
@@ -3818,7 +3816,7 @@ PHP_FUNCTION(pg_lo_seek)
int argc = ZEND_NUM_ARGS();
if (zend_parse_parameters(argc, "rl|l", &pgsql_id, &offset, &whence) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (whence != SEEK_SET && whence != SEEK_CUR && whence != SEEK_END) {
php_error_docref(NULL, E_WARNING, "Invalid whence parameter");
@@ -3826,7 +3824,7 @@ PHP_FUNCTION(pg_lo_seek)
}
if ((pgsql = (pgLofp *)zend_fetch_resource(Z_RES_P(pgsql_id), "PostgreSQL large object", le_lofp)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
#if HAVE_PG_LO64
@@ -3856,11 +3854,11 @@ PHP_FUNCTION(pg_lo_tell)
int argc = ZEND_NUM_ARGS();
if (zend_parse_parameters(argc, "r", &pgsql_id) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((pgsql = (pgLofp *)zend_fetch_resource(Z_RES_P(pgsql_id), "PostgreSQL large object", le_lofp)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
#if HAVE_PG_LO64
@@ -3888,11 +3886,11 @@ PHP_FUNCTION(pg_lo_truncate)
int result;
if (zend_parse_parameters(argc, "rl", &pgsql_id, &size) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((pgsql = (pgLofp *)zend_fetch_resource(Z_RES_P(pgsql_id), "PostgreSQL large object", le_lofp)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
#if HAVE_PG_LO64
@@ -3926,19 +3924,19 @@ PHP_FUNCTION(pg_set_error_verbosity)
if (argc == 1) {
if (zend_parse_parameters(argc, "l", &verbosity) == FAILURE) {
- return;
+ RETURN_THROWS();
}
link = FETCH_DEFAULT_LINK();
CHECK_DEFAULT_LINK(link);
} else {
if (zend_parse_parameters(argc, "rl", &pgsql_link, &verbosity) == FAILURE) {
- return;
+ RETURN_THROWS();
}
link = Z_RES_P(pgsql_link);
}
if ((pgsql = (PGconn *)zend_fetch_resource2(link, "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (verbosity & (PQERRORS_TERSE|PQERRORS_DEFAULT|PQERRORS_VERBOSE)) {
@@ -3964,19 +3962,19 @@ PHP_FUNCTION(pg_set_client_encoding)
if (argc == 1) {
if (zend_parse_parameters(argc, "s", &encoding, &encoding_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
link = FETCH_DEFAULT_LINK();
CHECK_DEFAULT_LINK(link);
} else {
if (zend_parse_parameters(argc, "rs", &pgsql_link, &encoding, &encoding_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
link = Z_RES_P(pgsql_link);
}
if ((pgsql = (PGconn *)zend_fetch_resource2(link, "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
RETURN_LONG(PQsetClientEncoding(pgsql, encoding));
@@ -3993,7 +3991,7 @@ PHP_FUNCTION(pg_client_encoding)
zend_resource *link;
if (zend_parse_parameters(argc, "|r", &pgsql_link) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (argc == 0) {
@@ -4004,7 +4002,7 @@ PHP_FUNCTION(pg_client_encoding)
}
if ((pgsql = (PGconn *)zend_fetch_resource2(link, "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* Just do the same as found in PostgreSQL sources... */
@@ -4029,7 +4027,7 @@ PHP_FUNCTION(pg_end_copy)
zend_resource *link;
if (zend_parse_parameters(argc, "|r", &pgsql_link) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (argc == 0) {
@@ -4040,7 +4038,7 @@ PHP_FUNCTION(pg_end_copy)
}
if ((pgsql = (PGconn *)zend_fetch_resource2(link, "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
result = PQendcopy(pgsql);
@@ -4066,19 +4064,19 @@ PHP_FUNCTION(pg_put_line)
if (argc == 1) {
if (zend_parse_parameters(argc, "s", &query, &query_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
link = FETCH_DEFAULT_LINK();
CHECK_DEFAULT_LINK(link);
} else {
if (zend_parse_parameters(argc, "rs", &pgsql_link, &query, &query_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
link = Z_RES_P(pgsql_link);
}
if ((pgsql = (PGconn *)zend_fetch_resource2(link, "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
result = PQputline(pgsql, query);
@@ -4107,11 +4105,11 @@ PHP_FUNCTION(pg_copy_to)
if (zend_parse_parameters(argc, "rs|ss",
&pgsql_link, &table_name, &table_name_len,
&pg_delim, &pg_delim_len, &pg_null_as, &pg_null_as_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((pgsql = (PGconn *)zend_fetch_resource2(Z_RES_P(pgsql_link), "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (!pg_delim) {
@@ -4245,11 +4243,11 @@ PHP_FUNCTION(pg_copy_from)
if (zend_parse_parameters(argc, "rsa|ss",
&pgsql_link, &table_name, &table_name_len, &pg_rows,
&pg_delim, &pg_delim_len, &pg_null_as, &pg_null_as_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((pgsql = (PGconn *)zend_fetch_resource2(Z_RES_P(pgsql_link), "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (!pg_delim) {
@@ -4377,13 +4375,13 @@ PHP_FUNCTION(pg_escape_string)
switch (ZEND_NUM_ARGS()) {
case 1:
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &from) == FAILURE) {
- return;
+ RETURN_THROWS();
}
link = FETCH_DEFAULT_LINK();
break;
default:
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rS", &pgsql_link, &from) == FAILURE) {
- return;
+ RETURN_THROWS();
}
link = Z_RES_P(pgsql_link);
break;
@@ -4393,7 +4391,7 @@ PHP_FUNCTION(pg_escape_string)
#ifdef HAVE_PQESCAPE_CONN
if (link) {
if ((pgsql = (PGconn *)zend_fetch_resource2(link, "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
ZSTR_LEN(to) = PQescapeStringConn(pgsql, ZSTR_VAL(to), ZSTR_VAL(from), ZSTR_LEN(from), NULL);
} else
@@ -4423,13 +4421,13 @@ PHP_FUNCTION(pg_escape_bytea)
switch (ZEND_NUM_ARGS()) {
case 1:
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &from, &from_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
link = FETCH_DEFAULT_LINK();
break;
default:
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &pgsql_link, &from, &from_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
link = Z_RES_P(pgsql_link);
break;
@@ -4438,7 +4436,7 @@ PHP_FUNCTION(pg_escape_bytea)
#ifdef HAVE_PQESCAPE_BYTEA_CONN
if (link) {
if ((pgsql = (PGconn *)zend_fetch_resource2(link, "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
to = (char *)PQescapeByteaConn(pgsql, (unsigned char *)from, (size_t)from_len, &to_len);
} else
@@ -4566,7 +4564,7 @@ PHP_FUNCTION(pg_unescape_bytea)
size_t from_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",
&from, &from_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
#if HAVE_PQUNESCAPEBYTEA
@@ -4598,7 +4596,7 @@ static void php_pgsql_escape_internal(INTERNAL_FUNCTION_PARAMETERS, int escape_l
switch (ZEND_NUM_ARGS()) {
case 1:
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &from, &from_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
link = FETCH_DEFAULT_LINK();
CHECK_DEFAULT_LINK(link);
@@ -4606,14 +4604,14 @@ static void php_pgsql_escape_internal(INTERNAL_FUNCTION_PARAMETERS, int escape_l
default:
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &pgsql_link, &from, &from_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
link = Z_RES_P(pgsql_link);
break;
}
if ((pgsql = (PGconn *)zend_fetch_resource2(link, "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (pgsql == NULL) {
@@ -4668,7 +4666,7 @@ PHP_FUNCTION(pg_result_error)
}
if ((pg_result = (pgsql_result_handle *)zend_fetch_resource(Z_RES_P(result), "PostgreSQL result", le_result)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
pgsql_result = pg_result->result;
@@ -4697,7 +4695,7 @@ PHP_FUNCTION(pg_result_error_field)
}
if ((pg_result = (pgsql_result_handle *)zend_fetch_resource(Z_RES_P(result), "PostgreSQL result", le_result)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
pgsql_result = pg_result->result;
@@ -4740,7 +4738,7 @@ PHP_FUNCTION(pg_connection_status)
}
if ((pgsql = (PGconn *)zend_fetch_resource2(Z_RES_P(pgsql_link), "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
RETURN_LONG(PQstatus(pgsql));
@@ -4762,7 +4760,7 @@ PHP_FUNCTION(pg_transaction_status)
}
if ((pgsql = (PGconn *)zend_fetch_resource2(Z_RES_P(pgsql_link), "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
RETURN_LONG(PQtransactionStatus(pgsql));
@@ -4784,7 +4782,7 @@ PHP_FUNCTION(pg_connection_reset)
}
if ((pgsql = (PGconn *)zend_fetch_resource2(Z_RES_P(pgsql_link), "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
PQreset(pgsql);
@@ -4832,7 +4830,7 @@ static void php_pgsql_do_async(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
}
if ((pgsql = (PGconn *)zend_fetch_resource2(Z_RES_P(pgsql_link), "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (PQ_SETNONBLOCKING(pgsql, 1)) {
@@ -4900,11 +4898,11 @@ PHP_FUNCTION(pg_send_query)
int ret;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &pgsql_link, &query, &len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((pgsql = (PGconn *)zend_fetch_resource2(Z_RES_P(pgsql_link), "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
is_non_blocking = PQisnonblocking(pgsql);
@@ -4973,11 +4971,11 @@ PHP_FUNCTION(pg_send_query_params)
int ret;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsa", &pgsql_link, &query, &query_len, &pv_param_arr) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((pgsql = (PGconn *)zend_fetch_resource2(Z_RES_P(pgsql_link), "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
is_non_blocking = PQisnonblocking(pgsql);
@@ -5069,11 +5067,11 @@ PHP_FUNCTION(pg_send_prepare)
int ret;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rss", &pgsql_link, &stmtname, &stmtname_len, &query, &query_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((pgsql = (PGconn *)zend_fetch_resource2(Z_RES_P(pgsql_link), "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
is_non_blocking = PQisnonblocking(pgsql);
@@ -5144,11 +5142,11 @@ PHP_FUNCTION(pg_send_execute)
int ret;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsa", &pgsql_link, &stmtname, &stmtname_len, &pv_param_arr) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((pgsql = (PGconn *)zend_fetch_resource2(Z_RES_P(pgsql_link), "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
is_non_blocking = PQisnonblocking(pgsql);
@@ -5242,7 +5240,7 @@ PHP_FUNCTION(pg_get_result)
}
if ((pgsql = (PGconn *)zend_fetch_resource2(Z_RES_P(pgsql_link), "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
pgsql_result = PQgetResult(pgsql);
@@ -5274,7 +5272,7 @@ PHP_FUNCTION(pg_result_status)
}
if ((pg_result = (pgsql_result_handle *)zend_fetch_resource(Z_RES_P(result), "PostgreSQL result", le_result)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
pgsql_result = pg_result->result;
@@ -5307,7 +5305,7 @@ PHP_FUNCTION(pg_get_notify)
}
if ((pgsql = (PGconn *)zend_fetch_resource2(Z_RES_P(pgsql_link), "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (!(result_type & PGSQL_BOTH)) {
@@ -5365,7 +5363,7 @@ PHP_FUNCTION(pg_get_pid)
}
if ((pgsql = (PGconn *)zend_fetch_resource2(Z_RES_P(pgsql_link), "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
RETURN_LONG(PQbackendPID(pgsql));
@@ -5440,11 +5438,11 @@ PHP_FUNCTION(pg_socket)
PGconn *pgsql;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pgsql_link) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((pgsql = (PGconn *)zend_fetch_resource2(Z_RES_P(pgsql_link), "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
stream = php_stream_alloc(&php_stream_pgsql_fd_ops, pgsql, NULL, "r");
@@ -5466,11 +5464,11 @@ PHP_FUNCTION(pg_consume_input)
PGconn *pgsql;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pgsql_link) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((pgsql = (PGconn *)zend_fetch_resource2(Z_RES_P(pgsql_link), "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
RETURN_BOOL(PQconsumeInput(pgsql));
@@ -5487,11 +5485,11 @@ PHP_FUNCTION(pg_flush)
int is_non_blocking;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pgsql_link) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((pgsql = (PGconn *)zend_fetch_resource2(Z_RES_P(pgsql_link), "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
is_non_blocking = PQisnonblocking(pgsql);
@@ -5641,11 +5639,11 @@ PHP_FUNCTION(pg_meta_data)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|b",
&pgsql_link, &table_name, &table_name_len, &extended) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((pgsql = (PGconn *)zend_fetch_resource2(Z_RES_P(pgsql_link), "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
array_init(return_value);
@@ -6512,7 +6510,7 @@ PHP_FUNCTION(pg_convert)
if (zend_parse_parameters(ZEND_NUM_ARGS(),
"rsa|l", &pgsql_link, &table_name, &table_name_len, &values, &option) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (option & ~PGSQL_CONV_OPTS) {
php_error_docref(NULL, E_WARNING, "Invalid option is specified");
@@ -6524,7 +6522,7 @@ PHP_FUNCTION(pg_convert)
}
if ((pg_link = (PGconn *)zend_fetch_resource2(Z_RES_P(pgsql_link), "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (php_pgsql_flush_query(pg_link)) {
@@ -6725,7 +6723,7 @@ PHP_FUNCTION(pg_insert)
if (zend_parse_parameters(argc, "rsa|l",
&pgsql_link, &table, &table_len, &values, &option) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (option & ~(PGSQL_CONV_OPTS|PGSQL_DML_NO_CONV|PGSQL_DML_EXEC|PGSQL_DML_ASYNC|PGSQL_DML_STRING|PGSQL_DML_ESCAPE)) {
php_error_docref(NULL, E_WARNING, "Invalid option is specified");
@@ -6733,7 +6731,7 @@ PHP_FUNCTION(pg_insert)
}
if ((pg_link = (PGconn *)zend_fetch_resource2(Z_RES_P(pgsql_link), "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (php_pgsql_flush_query(pg_link)) {
@@ -6937,7 +6935,7 @@ PHP_FUNCTION(pg_update)
if (zend_parse_parameters(argc, "rsaa|l",
&pgsql_link, &table, &table_len, &values, &ids, &option) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (option & ~(PGSQL_CONV_OPTS|PGSQL_DML_NO_CONV|PGSQL_DML_EXEC|PGSQL_DML_STRING|PGSQL_DML_ESCAPE)) {
php_error_docref(NULL, E_WARNING, "Invalid option is specified");
@@ -6945,7 +6943,7 @@ PHP_FUNCTION(pg_update)
}
if ((pg_link = (PGconn *)zend_fetch_resource2(Z_RES_P(pgsql_link), "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (php_pgsql_flush_query(pg_link)) {
@@ -7029,7 +7027,7 @@ PHP_FUNCTION(pg_delete)
if (zend_parse_parameters(argc, "rsa|l",
&pgsql_link, &table, &table_len, &ids, &option) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (option & ~(PGSQL_CONV_FORCE_NULL|PGSQL_DML_NO_CONV|PGSQL_DML_EXEC|PGSQL_DML_STRING|PGSQL_DML_ESCAPE)) {
php_error_docref(NULL, E_WARNING, "Invalid option is specified");
@@ -7037,7 +7035,7 @@ PHP_FUNCTION(pg_delete)
}
if ((pg_link = (PGconn *)zend_fetch_resource2(Z_RES_P(pgsql_link), "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (php_pgsql_flush_query(pg_link)) {
@@ -7170,7 +7168,7 @@ PHP_FUNCTION(pg_select)
if (zend_parse_parameters(argc, "rsa|l",
&pgsql_link, &table, &table_len, &ids, &option, &result_type) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (option & ~(PGSQL_CONV_FORCE_NULL|PGSQL_DML_NO_CONV|PGSQL_DML_EXEC|PGSQL_DML_ASYNC|PGSQL_DML_STRING|PGSQL_DML_ESCAPE)) {
php_error_docref(NULL, E_WARNING, "Invalid option is specified");
@@ -7182,7 +7180,7 @@ PHP_FUNCTION(pg_select)
}
if ((pg_link = (PGconn *)zend_fetch_resource2(Z_RES_P(pgsql_link), "PostgreSQL link", le_link, le_plink)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (php_pgsql_flush_query(pg_link)) {
diff --git a/ext/pgsql/php_pgsql.h b/ext/pgsql/php_pgsql.h
index cecd2cc95b..978112cf3b 100644
--- a/ext/pgsql/php_pgsql.h
+++ b/ext/pgsql/php_pgsql.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/pgsql/tests/01createdb.phpt b/ext/pgsql/tests/01createdb.phpt
index aa2e43748f..2abd051c8b 100644
--- a/ext/pgsql/tests/01createdb.phpt
+++ b/ext/pgsql/tests/01createdb.phpt
@@ -9,24 +9,24 @@ PostgreSQL create db
include('config.inc');
$db = pg_connect($conn_str);
-if (!@pg_num_rows(@pg_query($db, "SELECT * FROM ".$table_name)))
+if (!($q = @pg_query($db, "SELECT * FROM ".$table_name)) || !@pg_num_rows($q))
{
- pg_query($db,$table_def); // Create table here
- for ($i=0; $i < $num_test_record; $i++) {
- pg_query($db,"INSERT INTO ".$table_name." VALUES ($i, 'ABC');");
- }
+ pg_query($db,$table_def); // Create table here
+ for ($i=0; $i < $num_test_record; $i++) {
+ pg_query($db,"INSERT INTO ".$table_name." VALUES ($i, 'ABC');");
+ }
}
else {
- echo pg_last_error()."\n";
+ echo pg_last_error()."\n";
}
$v = pg_version();
-if (version_compare($v['server'], '9.2', '>=') && !@pg_num_rows(@pg_query($db, "SELECT * FROM ".$table_name_92)))
+if (version_compare($v['server'], '9.2', '>=') && (!($q = @pg_query($db, "SELECT * FROM ".$table_name_92)) || !@pg_num_rows($q)))
{
- pg_query($db,$table_def_92); // Create table here
+ pg_query($db,$table_def_92); // Create table here
}
else {
- echo pg_last_error()."\n";
+ echo pg_last_error()."\n";
}
// Create view here
diff --git a/ext/pgsql/tests/02connection.phpt b/ext/pgsql/tests/02connection.phpt
index 8db5e2071a..9922bba98f 100644
--- a/ext/pgsql/tests/02connection.phpt
+++ b/ext/pgsql/tests/02connection.phpt
@@ -13,47 +13,45 @@ var_dump($db);
if (pg_connection_status($db) != PGSQL_CONNECTION_OK)
{
- echo "pg_connection_status() error\n";
+ echo "pg_connection_status() error\n";
}
if (!pg_connection_reset($db))
{
- echo "pg_connection_reset() error\n";
+ echo "pg_connection_reset() error\n";
}
if (pg_connection_busy($db))
{
- echo "pg_connection_busy() error\n";
+ echo "pg_connection_busy() error\n";
}
if (function_exists('pg_transaction_status')) {
- if (pg_transaction_status($db) != PGSQL_TRANSACTION_IDLE)
- {
- echo "pg_transaction_status() error\n";
- }
+ if (pg_transaction_status($db) != PGSQL_TRANSACTION_IDLE)
+ {
+ echo "pg_transaction_status() error\n";
+ }
}
if (false === pg_host($db))
{
- echo "pg_host() error\n";
+ echo "pg_host() error\n";
}
if (!pg_dbname($db))
{
- echo "pg_dbname() error\n";
+ echo "pg_dbname() error\n";
}
if (!pg_port($db))
{
- echo "pg_port() error\n";
+ echo "pg_port() error\n";
}
if (pg_tty($db))
{
- echo "pg_tty() error\n";
+ echo "pg_tty() error\n";
}
if (pg_options($db))
{
- echo "pg_options() error\n";
+ echo "pg_options() error\n";
}
pg_close($db);
?>
-===DONE===
--EXPECTF--
resource(%d) of type (pgsql link%s)
-===DONE===
diff --git a/ext/pgsql/tests/03sync_query.phpt b/ext/pgsql/tests/03sync_query.phpt
index eb8fae084d..1cd439bc20 100644
--- a/ext/pgsql/tests/03sync_query.phpt
+++ b/ext/pgsql/tests/03sync_query.phpt
@@ -12,45 +12,45 @@ $db = pg_connect($conn_str);
$result = pg_query($db, "SELECT * FROM ".$table_name.";");
if (!($rows = pg_num_rows($result)))
{
- echo "pg_num_row() error\n";
+ echo "pg_num_row() error\n";
}
for ($i=0; $i < $rows; $i++)
{
- pg_fetch_array($result, $i, PGSQL_NUM);
+ pg_fetch_array($result, $i, PGSQL_NUM);
}
for ($i=0; $i < $rows; $i++)
{
- pg_fetch_object($result);
+ pg_fetch_object($result);
}
for ($i=0; $i < $rows; $i++)
{
- pg_fetch_row($result, $i);
+ pg_fetch_row($result, $i);
}
for ($i=0; $i < $rows; $i++)
{
- pg_fetch_result($result, $i, 0);
+ pg_fetch_result($result, $i, 0);
}
pg_result_error($result);
if (function_exists('pg_result_error_field')) {
- pg_result_error_field($result, PGSQL_DIAG_SEVERITY);
- pg_result_error_field($result, PGSQL_DIAG_SQLSTATE);
- pg_result_error_field($result, PGSQL_DIAG_MESSAGE_PRIMARY);
- pg_result_error_field($result, PGSQL_DIAG_MESSAGE_DETAIL);
- pg_result_error_field($result, PGSQL_DIAG_MESSAGE_HINT);
- pg_result_error_field($result, PGSQL_DIAG_STATEMENT_POSITION);
- if (defined('PGSQL_DIAG_INTERNAL_POSITION'))
- {
- pg_result_error_field($result, PGSQL_DIAG_INTERNAL_POSITION);
- }
- if (defined('PGSQL_DIAG_INTERNAL_QUERY'))
- {
- pg_result_error_field($result, PGSQL_DIAG_INTERNAL_QUERY);
- }
- pg_result_error_field($result, PGSQL_DIAG_CONTEXT);
- pg_result_error_field($result, PGSQL_DIAG_SOURCE_FILE);
- pg_result_error_field($result, PGSQL_DIAG_SOURCE_LINE);
- pg_result_error_field($result, PGSQL_DIAG_SOURCE_FUNCTION);
+ pg_result_error_field($result, PGSQL_DIAG_SEVERITY);
+ pg_result_error_field($result, PGSQL_DIAG_SQLSTATE);
+ pg_result_error_field($result, PGSQL_DIAG_MESSAGE_PRIMARY);
+ pg_result_error_field($result, PGSQL_DIAG_MESSAGE_DETAIL);
+ pg_result_error_field($result, PGSQL_DIAG_MESSAGE_HINT);
+ pg_result_error_field($result, PGSQL_DIAG_STATEMENT_POSITION);
+ if (defined('PGSQL_DIAG_INTERNAL_POSITION'))
+ {
+ pg_result_error_field($result, PGSQL_DIAG_INTERNAL_POSITION);
+ }
+ if (defined('PGSQL_DIAG_INTERNAL_QUERY'))
+ {
+ pg_result_error_field($result, PGSQL_DIAG_INTERNAL_QUERY);
+ }
+ pg_result_error_field($result, PGSQL_DIAG_CONTEXT);
+ pg_result_error_field($result, PGSQL_DIAG_SOURCE_FILE);
+ pg_result_error_field($result, PGSQL_DIAG_SOURCE_LINE);
+ pg_result_error_field($result, PGSQL_DIAG_SOURCE_FUNCTION);
}
pg_num_rows(pg_query($db, "SELECT * FROM ".$table_name.";"));
pg_num_fields(pg_query($db, "SELECT * FROM ".$table_name.";"));
diff --git a/ext/pgsql/tests/04async_query.phpt b/ext/pgsql/tests/04async_query.phpt
index fe67382026..34d383ed68 100644
--- a/ext/pgsql/tests/04async_query.phpt
+++ b/ext/pgsql/tests/04async_query.phpt
@@ -10,35 +10,35 @@ include('config.inc');
$db = pg_connect($conn_str);
if (!pg_send_query($db, "SELECT * FROM ".$table_name.";")) {
- echo "pg_send_query() error\n";
+ echo "pg_send_query() error\n";
}
while(pg_connection_busy($db)); // busy wait: intended
if (pg_connection_status($db) === PGSQL_CONNECTION_BAD) {
- echo "pg_connection_status() error\n";
+ echo "pg_connection_status() error\n";
}
if (!($result = pg_get_result($db)))
{
- echo "pg_get_result() error\n";
+ echo "pg_get_result() error\n";
}
if (!($rows = pg_num_rows($result))) {
- echo "pg_num_rows() error\n";
+ echo "pg_num_rows() error\n";
}
for ($i=0; $i < $rows; $i++)
{
- pg_fetch_array($result, $i, PGSQL_NUM);
+ pg_fetch_array($result, $i, PGSQL_NUM);
}
for ($i=0; $i < $rows; $i++)
{
- pg_fetch_object($result);
+ pg_fetch_object($result);
}
for ($i=0; $i < $rows; $i++)
{
- pg_fetch_row($result, $i);
+ pg_fetch_row($result, $i);
}
for ($i=0; $i < $rows; $i++)
{
- pg_fetch_result($result, $i, 0);
+ pg_fetch_result($result, $i, 0);
}
pg_num_rows(pg_query($db, "SELECT * FROM ".$table_name.";"));
@@ -52,7 +52,7 @@ pg_field_is_null($result, 0);
if (!pg_send_query($db, "INSERT INTO ".$table_name." VALUES (8888, 'GGG');"))
{
- echo "pg_send_query() error\n";
+ echo "pg_send_query() error\n";
}
pg_last_oid($result);
diff --git a/ext/pgsql/tests/05large_object.phpt b/ext/pgsql/tests/05large_object.phpt
index e091d6072a..df47d07404 100644
--- a/ext/pgsql/tests/05large_object.phpt
+++ b/ext/pgsql/tests/05large_object.phpt
@@ -63,7 +63,7 @@ pg_query($db, 'begin');
@unlink($path . 'php.gif.exported');
pg_lo_export($oid, $path . 'php.gif.exported', $db);
if (!file_exists($path . 'php.gif.exported')) {
- echo "Export failed\n";
+ echo "Export failed\n";
}
@unlink($path . 'php.gif.exported');
pg_query($db, 'commit');
diff --git a/ext/pgsql/tests/07optional.phpt b/ext/pgsql/tests/07optional.phpt
index 9fa6f16331..f633f81498 100644
--- a/ext/pgsql/tests/07optional.phpt
+++ b/ext/pgsql/tests/07optional.phpt
@@ -14,9 +14,9 @@ $enc = pg_client_encoding($db);
pg_set_client_encoding($db, $enc);
if (function_exists('pg_set_error_verbosity')) {
- pg_set_error_verbosity(PGSQL_ERRORS_TERSE);
- pg_set_error_verbosity(PGSQL_ERRORS_DEFAULT);
- pg_set_error_verbosity(PGSQL_ERRORS_VERBOSE);
+ pg_set_error_verbosity(PGSQL_ERRORS_TERSE);
+ pg_set_error_verbosity(PGSQL_ERRORS_DEFAULT);
+ pg_set_error_verbosity(PGSQL_ERRORS_VERBOSE);
}
echo "OK";
?>
diff --git a/ext/pgsql/tests/08escape.phpt b/ext/pgsql/tests/08escape.phpt
index 6b0d1899d4..6b510aef73 100644
--- a/ext/pgsql/tests/08escape.phpt
+++ b/ext/pgsql/tests/08escape.phpt
@@ -14,13 +14,13 @@ $expect = "ABC\\\\ABC\\'";
$expect2 = "ABC\\\\ABC\\\\''"; //the way escape string differs from PostgreSQL 9.0
$after = pg_escape_string($before);
if ($expect === $after || $expect2 === $after) {
- echo "pg_escape_string() is Ok\n";
+ echo "pg_escape_string() is Ok\n";
}
else {
- echo "pg_escape_string() is NOT Ok\n";
- var_dump($before);
- var_dump($after);
- var_dump($expect);
+ echo "pg_escape_string() is NOT Ok\n";
+ var_dump($before);
+ var_dump($after);
+ var_dump($expect);
}
// pg_escape_bytea() test
@@ -28,13 +28,13 @@ $before = "ABC\\ABC";
$expect = "ABC\\\\\\\\ABC";
$after = pg_escape_bytea($before);
if ($expect === $after) {
- echo "pg_escape_bytea() is Ok\n";
+ echo "pg_escape_bytea() is Ok\n";
}
else {
- echo "pg_escape_byte() is NOT Ok\n";
- var_dump($before);
- var_dump($after);
- var_dump($expect);
+ echo "pg_escape_byte() is NOT Ok\n";
+ var_dump($before);
+ var_dump($after);
+ var_dump($expect);
}
// Test using database
@@ -49,23 +49,23 @@ pg_query($db, $sql);
// Retrieve binary from DB
for ($i = 0; $i < 2; $i++) {
- $sql = "SELECT bin::bytea FROM ".$table_name." WHERE num = 10000";
- $result = pg_query($db, $sql);
- $row = pg_fetch_array($result, 0, PGSQL_ASSOC);
+ $sql = "SELECT bin::bytea FROM ".$table_name." WHERE num = 10000";
+ $result = pg_query($db, $sql);
+ $row = pg_fetch_array($result, 0, PGSQL_ASSOC);
- if ($data === pg_unescape_bytea($row['bin'])) {
- echo "pg_escape_bytea() actually works with database\n";
- break;
- }
- elseif (!$i) {
- // Force bytea escaping and retry
- @pg_query($db, "SET bytea_output = 'escape'");
- }
- else {
- $result = pg_query($db, $sql);
- echo "pg_escape_bytea() is broken\n";
- break;
- }
+ if ($data === pg_unescape_bytea($row['bin'])) {
+ echo "pg_escape_bytea() actually works with database\n";
+ break;
+ }
+ elseif (!$i) {
+ // Force bytea escaping and retry
+ @pg_query($db, "SET bytea_output = 'escape'");
+ }
+ else {
+ $result = pg_query($db, $sql);
+ echo "pg_escape_bytea() is broken\n";
+ break;
+ }
}
// pg_escape_literal/pg_escape_identifier
@@ -73,26 +73,26 @@ $before = "ABC\\ABC\'";
$expect = " E'ABC\\\\ABC\\\\'''";
$after = pg_escape_literal($before);
if ($expect === $after) {
- echo "pg_escape_literal() is Ok\n";
+ echo "pg_escape_literal() is Ok\n";
}
else {
- echo "pg_escape_literal() is NOT Ok\n";
- var_dump($before);
- var_dump($after);
- var_dump($expect);
+ echo "pg_escape_literal() is NOT Ok\n";
+ var_dump($before);
+ var_dump($after);
+ var_dump($expect);
}
$before = "ABC\\ABC\'";
$expect = "\"ABC\ABC\'\"";
$after = pg_escape_identifier($before);
if ($expect === $after) {
- echo "pg_escape_identifier() is Ok\n";
+ echo "pg_escape_identifier() is Ok\n";
}
else {
- echo "pg_escape_identifier() is NOT Ok\n";
- var_dump($before);
- var_dump($after);
- var_dump($expect);
+ echo "pg_escape_identifier() is NOT Ok\n";
+ var_dump($before);
+ var_dump($after);
+ var_dump($expect);
}
?>
diff --git a/ext/pgsql/tests/10pg_convert_json_array.phpt b/ext/pgsql/tests/10pg_convert_json_array.phpt
index 960cfd6c99..46aec3ffbc 100644
--- a/ext/pgsql/tests/10pg_convert_json_array.phpt
+++ b/ext/pgsql/tests/10pg_convert_json_array.phpt
@@ -14,16 +14,16 @@ include 'config.inc';
$db = pg_connect($conn_str);
$fields = array(
- 'textary'=>'{"meeting", "lunch", "training", "presentation"}',
- 'jsn'=>'{"f1":1,"f2":"foo"}',
+ 'textary'=>'{"meeting", "lunch", "training", "presentation"}',
+ 'jsn'=>'{"f1":1,"f2":"foo"}',
);
$converted = pg_convert($db, $table_name_92, $fields);
var_dump($converted);
if (!pg_insert($db, $table_name_92, $fields)) {
- echo "Error\n";
+ echo "Error\n";
} else {
- echo "OK\n";
+ echo "OK\n";
}
?>
diff --git a/ext/pgsql/tests/15pg_delete.phpt b/ext/pgsql/tests/15pg_delete.phpt
index 3b9f7d803c..5afcf60253 100644
--- a/ext/pgsql/tests/15pg_delete.phpt
+++ b/ext/pgsql/tests/15pg_delete.phpt
@@ -15,10 +15,10 @@ $ids = array('num'=>'1234');
echo pg_delete($db, $table_name, $ids, PGSQL_DML_STRING)."\n";
echo pg_delete($db, $table_name, $ids, PGSQL_DML_STRING|PGSQL_DML_ESCAPE)."\n";
if (!pg_delete($db, $table_name, $ids)) {
- echo "Error\n";
+ echo "Error\n";
}
else {
- echo "Ok\n";
+ echo "Ok\n";
}
?>
--EXPECT--
diff --git a/ext/pgsql/tests/18pg_escape_bytea_before.phpt b/ext/pgsql/tests/18pg_escape_bytea_before.phpt
index ca2acd9ce7..8222eccde4 100644
--- a/ext/pgsql/tests/18pg_escape_bytea_before.phpt
+++ b/ext/pgsql/tests/18pg_escape_bytea_before.phpt
@@ -20,10 +20,10 @@ $rows = pg_fetch_all($result);
$unesc_image = pg_unescape_bytea($rows[0]['bin']);
if ($unesc_image !== $image) {
- echo "NG";
+ echo "NG";
}
else {
- echo "OK";
+ echo "OK";
}
?>
--EXPECT--
diff --git a/ext/pgsql/tests/18pg_escape_bytea_esc.phpt b/ext/pgsql/tests/18pg_escape_bytea_esc.phpt
index 263adad40c..0420c7eb75 100644
--- a/ext/pgsql/tests/18pg_escape_bytea_esc.phpt
+++ b/ext/pgsql/tests/18pg_escape_bytea_esc.phpt
@@ -20,10 +20,10 @@ $rows = pg_fetch_all($result);
$unesc_image = pg_unescape_bytea($rows[0]['bin']);
if ($unesc_image !== $image) {
- echo "NG";
+ echo "NG";
}
else {
- echo "OK";
+ echo "OK";
}
?>
--EXPECT--
diff --git a/ext/pgsql/tests/18pg_escape_bytea_hex.phpt b/ext/pgsql/tests/18pg_escape_bytea_hex.phpt
index 5af7bbebef..af2f3cf4d4 100644
--- a/ext/pgsql/tests/18pg_escape_bytea_hex.phpt
+++ b/ext/pgsql/tests/18pg_escape_bytea_hex.phpt
@@ -23,10 +23,10 @@ $rows = pg_fetch_all($result);
$unesc_image = pg_unescape_bytea($rows[0]['bin']);
if ($unesc_image !== $image) {
- echo "NG";
+ echo "NG";
}
else {
- echo "OK";
+ echo "OK";
}
?>
--EXPECT--
diff --git a/ext/pgsql/tests/22pg_fetch_object.phpt b/ext/pgsql/tests/22pg_fetch_object.phpt
index ebdf77568e..9f9319bcfe 100644
--- a/ext/pgsql/tests/22pg_fetch_object.phpt
+++ b/ext/pgsql/tests/22pg_fetch_object.phpt
@@ -9,9 +9,9 @@ error_reporting(E_ALL);
include 'config.inc';
class test_class {
- function __construct($arg1, $arg2) {
- echo __METHOD__ . "($arg1,$arg2)\n";
- }
+ function __construct($arg1, $arg2) {
+ echo __METHOD__ . "($arg1,$arg2)\n";
+ }
}
$db = pg_connect($conn_str);
diff --git a/ext/pgsql/tests/23sync_query_params.phpt b/ext/pgsql/tests/23sync_query_params.phpt
index a700ddca17..1406cec5bf 100644
--- a/ext/pgsql/tests/23sync_query_params.phpt
+++ b/ext/pgsql/tests/23sync_query_params.phpt
@@ -14,42 +14,42 @@ $db = pg_connect($conn_str);
$version = pg_version($db);
if ($version['protocol'] >= 3) {
- $result = pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100));
- if (!($rows = pg_num_rows($result)))
- {
- echo "pg_num_row() error\n";
- }
- for ($i=0; $i < $rows; $i++)
- {
- pg_fetch_array($result, $i, PGSQL_NUM);
- }
- for ($i=0; $i < $rows; $i++)
- {
- pg_fetch_object($result);
- }
- for ($i=0; $i < $rows; $i++)
- {
- pg_fetch_row($result, $i);
- }
- for ($i=0; $i < $rows; $i++)
- {
- pg_fetch_result($result, $i, 0);
- }
+ $result = pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100));
+ if (!($rows = pg_num_rows($result)))
+ {
+ echo "pg_num_row() error\n";
+ }
+ for ($i=0; $i < $rows; $i++)
+ {
+ pg_fetch_array($result, $i, PGSQL_NUM);
+ }
+ for ($i=0; $i < $rows; $i++)
+ {
+ pg_fetch_object($result);
+ }
+ for ($i=0; $i < $rows; $i++)
+ {
+ pg_fetch_row($result, $i);
+ }
+ for ($i=0; $i < $rows; $i++)
+ {
+ pg_fetch_result($result, $i, 0);
+ }
- pg_result_error($result);
- pg_num_rows(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
- pg_num_fields(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
- pg_field_name($result, 0);
- pg_field_num($result, $field_name);
- pg_field_size($result, 0);
- pg_field_type($result, 0);
- pg_field_prtlen($result, 0);
- pg_field_is_null($result, 0);
+ pg_result_error($result);
+ pg_num_rows(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
+ pg_num_fields(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
+ pg_field_name($result, 0);
+ pg_field_num($result, $field_name);
+ pg_field_size($result, 0);
+ pg_field_type($result, 0);
+ pg_field_prtlen($result, 0);
+ pg_field_is_null($result, 0);
- $result = pg_query_params($db, "INSERT INTO ".$table_name." VALUES (\$1, \$2);", array(9999, "A'BC"));
- pg_last_oid($result);
+ $result = pg_query_params($db, "INSERT INTO ".$table_name." VALUES (\$1, \$2);", array(9999, "A'BC"));
+ pg_last_oid($result);
- pg_free_result($result);
+ pg_free_result($result);
}
pg_close($db);
diff --git a/ext/pgsql/tests/24sync_query_prepared.phpt b/ext/pgsql/tests/24sync_query_prepared.phpt
index ca099eb43b..1ab7e095f4 100644
--- a/ext/pgsql/tests/24sync_query_prepared.phpt
+++ b/ext/pgsql/tests/24sync_query_prepared.phpt
@@ -14,48 +14,48 @@ $db = pg_connect($conn_str);
$version = pg_version($db);
if ($version['protocol'] >= 3) {
- $result = pg_prepare($db, "php_test", "SELECT * FROM ".$table_name." WHERE num > \$1;");
- pg_result_error($result);
- pg_free_result($result);
- $result = pg_execute($db, "php_test", array(100));
- if (!($rows = pg_num_rows($result)))
- {
- echo "pg_num_row() error\n";
- }
- for ($i=0; $i < $rows; $i++)
- {
- pg_fetch_array($result, $i, PGSQL_NUM);
- }
- for ($i=0; $i < $rows; $i++)
- {
- pg_fetch_object($result);
- }
- for ($i=0; $i < $rows; $i++)
- {
- pg_fetch_row($result, $i);
- }
- for ($i=0; $i < $rows; $i++)
- {
- pg_fetch_result($result, $i, 0);
- }
+ $result = pg_prepare($db, "php_test", "SELECT * FROM ".$table_name." WHERE num > \$1;");
+ pg_result_error($result);
+ pg_free_result($result);
+ $result = pg_execute($db, "php_test", array(100));
+ if (!($rows = pg_num_rows($result)))
+ {
+ echo "pg_num_row() error\n";
+ }
+ for ($i=0; $i < $rows; $i++)
+ {
+ pg_fetch_array($result, $i, PGSQL_NUM);
+ }
+ for ($i=0; $i < $rows; $i++)
+ {
+ pg_fetch_object($result);
+ }
+ for ($i=0; $i < $rows; $i++)
+ {
+ pg_fetch_row($result, $i);
+ }
+ for ($i=0; $i < $rows; $i++)
+ {
+ pg_fetch_result($result, $i, 0);
+ }
- pg_result_error($result);
- pg_num_rows(pg_execute($db, "php_test", array(100)));
- pg_num_fields(pg_execute($db, "php_test", array(100)));
- pg_field_name($result, 0);
- pg_field_num($result, $field_name);
- pg_field_size($result, 0);
- pg_field_type($result, 0);
- pg_field_prtlen($result, 0);
- pg_field_is_null($result, 0);
+ pg_result_error($result);
+ pg_num_rows(pg_execute($db, "php_test", array(100)));
+ pg_num_fields(pg_execute($db, "php_test", array(100)));
+ pg_field_name($result, 0);
+ pg_field_num($result, $field_name);
+ pg_field_size($result, 0);
+ pg_field_type($result, 0);
+ pg_field_prtlen($result, 0);
+ pg_field_is_null($result, 0);
- $result = pg_prepare($db, "php_test2", "INSERT INTO ".$table_name." VALUES (\$1, \$2);");
- pg_result_error($result);
- pg_free_result($result);
- $result = pg_execute($db, "php_test2", array(9999, "A'BC"));
- pg_last_oid($result);
+ $result = pg_prepare($db, "php_test2", "INSERT INTO ".$table_name." VALUES (\$1, \$2);");
+ pg_result_error($result);
+ pg_free_result($result);
+ $result = pg_execute($db, "php_test2", array(9999, "A'BC"));
+ pg_last_oid($result);
- pg_free_result($result);
+ pg_free_result($result);
}
pg_close($db);
diff --git a/ext/pgsql/tests/25async_query_params.phpt b/ext/pgsql/tests/25async_query_params.phpt
index ae1a1630ef..87b5e0dbb1 100644
--- a/ext/pgsql/tests/25async_query_params.phpt
+++ b/ext/pgsql/tests/25async_query_params.phpt
@@ -14,53 +14,53 @@ $db = pg_connect($conn_str);
$version = pg_version($db);
if ($version['protocol'] >= 3) {
- if (!pg_send_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100))) {
- echo "pg_send_query_params() error\n";
- }
- while(pg_connection_busy($db)); // busy wait: intended
- if (pg_connection_status($db) === PGSQL_CONNECTION_BAD) {
- echo "pg_connection_status() error\n";
- }
- if (!($result = pg_get_result($db)))
- {
- echo "pg_get_result() error\n";
- }
- if (!($rows = pg_num_rows($result))) {
- echo "pg_num_rows() error\n";
- }
- for ($i=0; $i < $rows; $i++)
- {
- pg_fetch_array($result, $i, PGSQL_NUM);
- }
- for ($i=0; $i < $rows; $i++)
- {
- pg_fetch_object($result);
- }
- for ($i=0; $i < $rows; $i++)
- {
- pg_fetch_row($result, $i);
- }
- for ($i=0; $i < $rows; $i++)
- {
- pg_fetch_result($result, $i, 0);
- }
+ if (!pg_send_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100))) {
+ echo "pg_send_query_params() error\n";
+ }
+ while(pg_connection_busy($db)); // busy wait: intended
+ if (pg_connection_status($db) === PGSQL_CONNECTION_BAD) {
+ echo "pg_connection_status() error\n";
+ }
+ if (!($result = pg_get_result($db)))
+ {
+ echo "pg_get_result() error\n";
+ }
+ if (!($rows = pg_num_rows($result))) {
+ echo "pg_num_rows() error\n";
+ }
+ for ($i=0; $i < $rows; $i++)
+ {
+ pg_fetch_array($result, $i, PGSQL_NUM);
+ }
+ for ($i=0; $i < $rows; $i++)
+ {
+ pg_fetch_object($result);
+ }
+ for ($i=0; $i < $rows; $i++)
+ {
+ pg_fetch_row($result, $i);
+ }
+ for ($i=0; $i < $rows; $i++)
+ {
+ pg_fetch_result($result, $i, 0);
+ }
- pg_num_rows(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
- pg_num_fields(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
- pg_field_name($result, 0);
- pg_field_num($result, $field_name);
- pg_field_size($result, 0);
- pg_field_type($result, 0);
- pg_field_prtlen($result, 0);
- pg_field_is_null($result, 0);
+ pg_num_rows(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
+ pg_num_fields(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
+ pg_field_name($result, 0);
+ pg_field_num($result, $field_name);
+ pg_field_size($result, 0);
+ pg_field_type($result, 0);
+ pg_field_prtlen($result, 0);
+ pg_field_is_null($result, 0);
- if (!pg_send_query_params($db, "INSERT INTO ".$table_name." VALUES (\$1, \$2);", array(9999, "A'BC")))
- {
- echo "pg_send_query_params() error\n";
- }
+ if (!pg_send_query_params($db, "INSERT INTO ".$table_name." VALUES (\$1, \$2);", array(9999, "A'BC")))
+ {
+ echo "pg_send_query_params() error\n";
+ }
- pg_last_oid($result);
- pg_free_result($result);
+ pg_last_oid($result);
+ pg_free_result($result);
}
pg_close($db);
diff --git a/ext/pgsql/tests/26async_query_prepared.phpt b/ext/pgsql/tests/26async_query_prepared.phpt
index 33ca7c7bfa..6eacb4e3ee 100644
--- a/ext/pgsql/tests/26async_query_prepared.phpt
+++ b/ext/pgsql/tests/26async_query_prepared.phpt
@@ -14,89 +14,89 @@ $db = pg_connect($conn_str);
$version = pg_version($db);
if ($version['protocol'] >= 3) {
- if (!pg_send_prepare($db, 'php_test', "SELECT * FROM ".$table_name." WHERE num > \$1;")) {
- echo "pg_send_prepare() error\n";
- }
- while(pg_connection_busy($db)); // busy wait: intended
- if (pg_connection_status($db) === PGSQL_CONNECTION_BAD) {
- echo "pg_connection_status() error\n";
- }
- if (!($result = pg_get_result($db)))
- {
- echo "pg_get_result() error\n";
- }
- pg_free_result($result);
+ if (!pg_send_prepare($db, 'php_test', "SELECT * FROM ".$table_name." WHERE num > \$1;")) {
+ echo "pg_send_prepare() error\n";
+ }
+ while(pg_connection_busy($db)); // busy wait: intended
+ if (pg_connection_status($db) === PGSQL_CONNECTION_BAD) {
+ echo "pg_connection_status() error\n";
+ }
+ if (!($result = pg_get_result($db)))
+ {
+ echo "pg_get_result() error\n";
+ }
+ pg_free_result($result);
- if (!pg_send_execute($db, 'php_test', array(100))) {
- echo "pg_send_execute() error\n";
- }
- while(pg_connection_busy($db)); // busy wait: intended
- if (pg_connection_status($db) === PGSQL_CONNECTION_BAD) {
- echo "pg_connection_status() error\n";
- }
- if (!($result = pg_get_result($db)))
- {
- echo "pg_get_result() error\n";
- }
+ if (!pg_send_execute($db, 'php_test', array(100))) {
+ echo "pg_send_execute() error\n";
+ }
+ while(pg_connection_busy($db)); // busy wait: intended
+ if (pg_connection_status($db) === PGSQL_CONNECTION_BAD) {
+ echo "pg_connection_status() error\n";
+ }
+ if (!($result = pg_get_result($db)))
+ {
+ echo "pg_get_result() error\n";
+ }
- if (!($rows = pg_num_rows($result))) {
- echo "pg_num_rows() error\n";
- }
- for ($i=0; $i < $rows; $i++)
- {
- pg_fetch_array($result, $i, PGSQL_NUM);
- }
- for ($i=0; $i < $rows; $i++)
- {
- pg_fetch_object($result);
- }
- for ($i=0; $i < $rows; $i++)
- {
- pg_fetch_row($result, $i);
- }
- for ($i=0; $i < $rows; $i++)
- {
- pg_fetch_result($result, $i, 0);
- }
+ if (!($rows = pg_num_rows($result))) {
+ echo "pg_num_rows() error\n";
+ }
+ for ($i=0; $i < $rows; $i++)
+ {
+ pg_fetch_array($result, $i, PGSQL_NUM);
+ }
+ for ($i=0; $i < $rows; $i++)
+ {
+ pg_fetch_object($result);
+ }
+ for ($i=0; $i < $rows; $i++)
+ {
+ pg_fetch_row($result, $i);
+ }
+ for ($i=0; $i < $rows; $i++)
+ {
+ pg_fetch_result($result, $i, 0);
+ }
- pg_num_rows(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
- pg_num_fields(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
- pg_field_name($result, 0);
- pg_field_num($result, $field_name);
- pg_field_size($result, 0);
- pg_field_type($result, 0);
- pg_field_prtlen($result, 0);
- pg_field_is_null($result, 0);
+ pg_num_rows(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
+ pg_num_fields(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
+ pg_field_name($result, 0);
+ pg_field_num($result, $field_name);
+ pg_field_size($result, 0);
+ pg_field_type($result, 0);
+ pg_field_prtlen($result, 0);
+ pg_field_is_null($result, 0);
- if (!pg_send_prepare($db, "php_test2", "INSERT INTO ".$table_name." VALUES (\$1, \$2);"))
- {
- echo "pg_send_prepare() error\n";
- }
- while(pg_connection_busy($db)); // busy wait: intended
- if (pg_connection_status($db) === PGSQL_CONNECTION_BAD) {
- echo "pg_connection_status() error\n";
- }
- if (!($result = pg_get_result($db)))
- {
- echo "pg_get_result() error\n";
- }
- pg_free_result($result);
+ if (!pg_send_prepare($db, "php_test2", "INSERT INTO ".$table_name." VALUES (\$1, \$2);"))
+ {
+ echo "pg_send_prepare() error\n";
+ }
+ while(pg_connection_busy($db)); // busy wait: intended
+ if (pg_connection_status($db) === PGSQL_CONNECTION_BAD) {
+ echo "pg_connection_status() error\n";
+ }
+ if (!($result = pg_get_result($db)))
+ {
+ echo "pg_get_result() error\n";
+ }
+ pg_free_result($result);
- if (!pg_send_execute($db, "php_test2", array(9999, "A'BC")))
- {
- echo "pg_send_execute() error\n";
- }
- while(pg_connection_busy($db)); // busy wait: intended
- if (pg_connection_status($db) === PGSQL_CONNECTION_BAD) {
- echo "pg_connection_status() error\n";
- }
- if (!($result = pg_get_result($db)))
- {
- echo "pg_get_result() error\n";
- }
+ if (!pg_send_execute($db, "php_test2", array(9999, "A'BC")))
+ {
+ echo "pg_send_execute() error\n";
+ }
+ while(pg_connection_busy($db)); // busy wait: intended
+ if (pg_connection_status($db) === PGSQL_CONNECTION_BAD) {
+ echo "pg_connection_status() error\n";
+ }
+ if (!($result = pg_get_result($db)))
+ {
+ echo "pg_get_result() error\n";
+ }
- pg_last_oid($result);
- pg_free_result($result);
+ pg_last_oid($result);
+ pg_free_result($result);
}
pg_close($db);
diff --git a/ext/pgsql/tests/29nb_async_connect.phpt b/ext/pgsql/tests/29nb_async_connect.phpt
index a9b17ebc3a..d98b34da47 100644
--- a/ext/pgsql/tests/29nb_async_connect.phpt
+++ b/ext/pgsql/tests/29nb_async_connect.phpt
@@ -11,30 +11,30 @@ include('config.inc');
include('nonblocking.inc');
if (!$db = pg_connect($conn_str, PGSQL_CONNECT_ASYNC)) {
- die("pg_connect() error");
+ die("pg_connect() error");
} elseif (pg_connection_status($db) === PGSQL_CONNECTION_BAD) {
- die("pg_connect() error");
+ die("pg_connect() error");
} elseif ($db_socket = pg_socket($db)) {
- stream_set_blocking($db_socket, FALSE);
+ stream_set_blocking($db_socket, FALSE);
} else {
- die("pg_socket() error");
+ die("pg_socket() error");
}
while (TRUE) {
- switch ($status = pg_connect_poll($db)) {
- case PGSQL_POLLING_READING:
- nb_is_readable($db_socket);
- break;
- case PGSQL_POLLING_WRITING:
- nb_is_writable($db_socket);
- break;
- case PGSQL_POLLING_FAILED:
- die("async connection failed");
- case PGSQL_POLLING_OK:
- break 2;
- default:
- die("unknown poll status");
- }
+ switch ($status = pg_connect_poll($db)) {
+ case PGSQL_POLLING_READING:
+ nb_is_readable($db_socket);
+ break;
+ case PGSQL_POLLING_WRITING:
+ nb_is_writable($db_socket);
+ break;
+ case PGSQL_POLLING_FAILED:
+ die("async connection failed");
+ case PGSQL_POLLING_OK:
+ break 2;
+ default:
+ die("unknown poll status");
+ }
}
assert(pg_connection_status($db) === PGSQL_CONNECTION_OK);
echo "OK";
diff --git a/ext/pgsql/tests/30nb_async_query_params.phpt b/ext/pgsql/tests/30nb_async_query_params.phpt
index 1c8a1eed8f..612327a9c4 100644
--- a/ext/pgsql/tests/30nb_async_query_params.phpt
+++ b/ext/pgsql/tests/30nb_async_query_params.phpt
@@ -15,8 +15,8 @@ $db = pg_connect($conn_str);
$version = pg_version($db);
if ($version['protocol'] < 3) {
- echo "OK";
- exit(0);
+ echo "OK";
+ exit(0);
}
$db_socket = pg_socket($db);
@@ -24,30 +24,30 @@ stream_set_blocking($db_socket, false);
$sent = pg_send_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100));
if ($sent === FALSE) {
- echo "pg_send_query_params() error\n";
+ echo "pg_send_query_params() error\n";
} elseif ($sent === 0) {
- nb_flush($db, $db_socket);
+ nb_flush($db, $db_socket);
}
nb_consume($db, $db_socket);
if (!($result = pg_get_result($db))) {
- echo "pg_get_result() error\n";
+ echo "pg_get_result() error\n";
}
if (!($rows = pg_num_rows($result))) {
- echo "pg_num_rows() error\n";
+ echo "pg_num_rows() error\n";
}
for ($i=0; $i < $rows; $i++) {
- pg_fetch_array($result, $i, PGSQL_NUM);
+ pg_fetch_array($result, $i, PGSQL_NUM);
}
for ($i=0; $i < $rows; $i++) {
- pg_fetch_object($result);
+ pg_fetch_object($result);
}
for ($i=0; $i < $rows; $i++) {
- pg_fetch_row($result, $i);
+ pg_fetch_row($result, $i);
}
for ($i=0; $i < $rows; $i++) {
- pg_fetch_result($result, $i, 0);
+ pg_fetch_result($result, $i, 0);
}
pg_num_rows(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
@@ -62,9 +62,9 @@ pg_field_is_null($result, 0);
$sent = pg_send_query_params($db, "INSERT INTO ".$table_name." VALUES (\$1, \$2);", array(9999, "A'BC"));
if ($sent === FALSE) {
- echo "pg_send_query_params() error\n";
+ echo "pg_send_query_params() error\n";
} elseif ($sent === 0) {
- nb_flush($db, $db_socket);
+ nb_flush($db, $db_socket);
}
pg_last_oid($result);
diff --git a/ext/pgsql/tests/31nb_async_query_prepared.phpt b/ext/pgsql/tests/31nb_async_query_prepared.phpt
index f485e596f9..476f21bc51 100644
--- a/ext/pgsql/tests/31nb_async_query_prepared.phpt
+++ b/ext/pgsql/tests/31nb_async_query_prepared.phpt
@@ -15,8 +15,8 @@ $db = pg_connect($conn_str);
$version = pg_version($db);
if ($version['protocol'] < 3) {
- echo "OK";
- exit(0);
+ echo "OK";
+ exit(0);
}
$db_socket = pg_socket($db);
@@ -24,45 +24,45 @@ stream_set_blocking($db_socket, false);
$nb_send = pg_send_prepare($db, 'php_test', "SELECT * FROM ".$table_name." WHERE num > \$1;");
if ($nb_send === FALSE) {
- echo "pg_send_prepare() error\n";
+ echo "pg_send_prepare() error\n";
} elseif ($nb_send === 0) {
- nb_flush($db, $db_socket);
+ nb_flush($db, $db_socket);
}
nb_consume($db, $db_socket);
if (!($result = pg_get_result($db))) {
- echo "pg_get_result() error\n";
+ echo "pg_get_result() error\n";
}
pg_free_result($result);
$nb_send = pg_send_execute($db, 'php_test', array(100));
if ($nb_send === FALSE) {
- echo "pg_send_execute() error\n";
+ echo "pg_send_execute() error\n";
} elseif ($nb_send === 0) {
- nb_flush($db, $db_socket);
+ nb_flush($db, $db_socket);
}
nb_consume($db, $db_socket);
if (!($result = pg_get_result($db))) {
- echo "pg_get_result() error\n";
+ echo "pg_get_result() error\n";
}
if (!($rows = pg_num_rows($result))) {
- echo "pg_num_rows() error\n";
+ echo "pg_num_rows() error\n";
}
for ($i=0; $i < $rows; $i++) {
- pg_fetch_array($result, $i, PGSQL_NUM);
+ pg_fetch_array($result, $i, PGSQL_NUM);
}
for ($i=0; $i < $rows; $i++) {
- pg_fetch_object($result);
+ pg_fetch_object($result);
}
for ($i=0; $i < $rows; $i++) {
- pg_fetch_row($result, $i);
+ pg_fetch_row($result, $i);
}
for ($i=0; $i < $rows; $i++) {
- pg_fetch_result($result, $i, 0);
+ pg_fetch_result($result, $i, 0);
}
pg_num_rows(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100)));
@@ -76,29 +76,29 @@ pg_field_is_null($result, 0);
$nb_send = pg_send_prepare($db, "php_test2", "INSERT INTO ".$table_name." VALUES (\$1, \$2);");
if ($nb_send === FALSE) {
- echo "pg_send_prepare() error\n";
+ echo "pg_send_prepare() error\n";
} elseif ($nb_send === 0) {
- nb_flush($db, $db_socket);
+ nb_flush($db, $db_socket);
}
nb_consume($db, $db_socket);
if (!($result = pg_get_result($db))) {
- echo "pg_get_result() error\n";
+ echo "pg_get_result() error\n";
}
pg_free_result($result);
$nb_send = pg_send_execute($db, "php_test2", array(9999, "A'BC"));
if ($nb_send === FALSE) {
- echo "pg_send_execute() error\n";
+ echo "pg_send_execute() error\n";
} elseif ($nb_send === 0) {
- nb_flush($db, $db_socket);
+ nb_flush($db, $db_socket);
}
nb_consume($db, $db_socket);
if (!($result = pg_get_result($db))) {
- echo "pg_get_result() error\n";
+ echo "pg_get_result() error\n";
}
pg_last_oid($result);
diff --git a/ext/pgsql/tests/32nb_async_query.phpt b/ext/pgsql/tests/32nb_async_query.phpt
index 8ef1591db5..a90f9799a3 100644
--- a/ext/pgsql/tests/32nb_async_query.phpt
+++ b/ext/pgsql/tests/32nb_async_query.phpt
@@ -15,8 +15,8 @@ $db = pg_connect($conn_str);
$version = pg_version($db);
if ($version['protocol'] < 3) {
- echo "OK";
- exit(0);
+ echo "OK";
+ exit(0);
}
$db_socket = pg_socket($db);
@@ -24,31 +24,31 @@ stream_set_blocking($db_socket, false);
$nb_send = pg_send_query($db, "SELECT * FROM ".$table_name.";");
if ($nb_send === FALSE) {
- echo "pg_send_query() error\n";
+ echo "pg_send_query() error\n";
} elseif ($nb_send === 0) {
- nb_flush($db, $db_socket);
+ nb_flush($db, $db_socket);
}
nb_consume($db, $db_socket);
if (!($result = pg_get_result($db))) {
- echo "pg_get_result() error\n";
+ echo "pg_get_result() error\n";
}
if (!($rows = pg_num_rows($result))) {
- echo "pg_num_rows() error\n";
+ echo "pg_num_rows() error\n";
}
for ($i=0; $i < $rows; $i++) {
- pg_fetch_array($result, $i, PGSQL_NUM);
+ pg_fetch_array($result, $i, PGSQL_NUM);
}
for ($i=0; $i < $rows; $i++) {
- pg_fetch_object($result);
+ pg_fetch_object($result);
}
for ($i=0; $i < $rows; $i++) {
- pg_fetch_row($result, $i);
+ pg_fetch_row($result, $i);
}
for ($i=0; $i < $rows; $i++) {
- pg_fetch_result($result, $i, 0);
+ pg_fetch_result($result, $i, 0);
}
pg_num_rows(pg_query($db, "SELECT * FROM ".$table_name.";"));
@@ -62,15 +62,15 @@ pg_field_is_null($result, 0);
$nb_send = pg_send_query($db, "INSERT INTO ".$table_name." VALUES (8888, 'GGG');");
if ($nb_send === FALSE) {
- echo "pg_send_query() error\n";
+ echo "pg_send_query() error\n";
} elseif ($nb_send === 0) {
- nb_flush($db, $db_socket);
+ nb_flush($db, $db_socket);
}
nb_consume($db, $db_socket);
if (!($result = pg_get_result($db))) {
- echo "pg_get_result() error\n";
+ echo "pg_get_result() error\n";
}
pg_last_oid($result);
diff --git a/ext/pgsql/tests/80_bug14383.phpt b/ext/pgsql/tests/80_bug14383.phpt
index 1331f146cc..e9c6093888 100644
--- a/ext/pgsql/tests/80_bug14383.phpt
+++ b/ext/pgsql/tests/80_bug14383.phpt
@@ -11,7 +11,7 @@ require_once('config.inc');
$dbh = @pg_connect($conn_str);
if (!$dbh) {
- die ("Could not connect to the server");
+ die ("Could not connect to the server");
}
pg_close($dbh);
diff --git a/ext/pgsql/tests/80_bug24499.phpt b/ext/pgsql/tests/80_bug24499.phpt
index a9773bdafe..1ba8accade 100644
--- a/ext/pgsql/tests/80_bug24499.phpt
+++ b/ext/pgsql/tests/80_bug24499.phpt
@@ -11,7 +11,7 @@ require_once('config.inc');
$dbh = @pg_connect($conn_str);
if (!$dbh) {
- die ("Could not connect to the server");
+ die ("Could not connect to the server");
}
@pg_query("DROP SEQUENCE id_id_seq");
@@ -19,24 +19,24 @@ if (!$dbh) {
pg_query("CREATE TABLE id (id SERIAL, t INT)");
for ($i=0; $i<4; $i++) {
- pg_query("INSERT INTO id (t) VALUES ($i)");
+ pg_query("INSERT INTO id (t) VALUES ($i)");
}
class Id
{
- public $id;
+ public $id;
- public function getId()
- {
- global $dbh;
+ public function getId()
+ {
+ global $dbh;
- $q = pg_query($dbh, "SELECT id FROM id");
- print_r(pg_fetch_array($q));
- print_r(pg_fetch_array($q));
- $id = pg_fetch_object($q);
- var_dump($id);
- return $id->id;
- }
+ $q = pg_query($dbh, "SELECT id FROM id");
+ print_r(pg_fetch_array($q));
+ print_r(pg_fetch_array($q));
+ $id = pg_fetch_object($q);
+ var_dump($id);
+ return $id->id;
+ }
}
$id = new Id();
diff --git a/ext/pgsql/tests/80_bug27597.phpt b/ext/pgsql/tests/80_bug27597.phpt
index 6411d9ba36..92f0d81800 100644
--- a/ext/pgsql/tests/80_bug27597.phpt
+++ b/ext/pgsql/tests/80_bug27597.phpt
@@ -11,35 +11,34 @@ require_once(__DIR__ . '/config.inc');
$dbh = @pg_connect($conn_str);
if (!$dbh) {
- die ("Could not connect to the server");
+ die ("Could not connect to the server");
}
@pg_query("DROP TABLE id");
pg_query("CREATE TABLE id (id INT)");
for ($i=0; $i<4; $i++) {
- pg_query("INSERT INTO id (id) VALUES ($i)");
+ pg_query("INSERT INTO id (id) VALUES ($i)");
}
function xi_fetch_array($res, $type = PGSQL_ASSOC) {
- $a = pg_fetch_array($res, NULL, $type) ;
- return $a ;
+ $a = pg_fetch_array($res, NULL, $type) ;
+ return $a ;
}
$res = pg_query("SELECT * FROM id");
$i = 0; // endless-loop protection
while($row = xi_fetch_array($res)) {
- print_r($row);
- if ($i++ > 4) {
- echo "ENDLESS-LOOP";
- exit(1);
- }
+ print_r($row);
+ if ($i++ > 4) {
+ echo "ENDLESS-LOOP";
+ exit(1);
+ }
}
pg_close($dbh);
?>
-===DONE===
--EXPECT--
Array
(
@@ -57,4 +56,3 @@ Array
(
[id] => 3
)
-===DONE===
diff --git a/ext/pgsql/tests/80_bug32223.phpt b/ext/pgsql/tests/80_bug32223.phpt
index fbe0d5ff97..08c8903dbf 100644
--- a/ext/pgsql/tests/80_bug32223.phpt
+++ b/ext/pgsql/tests/80_bug32223.phpt
@@ -25,7 +25,7 @@ require_once('lcmess.inc');
$dbh = @pg_connect($conn_str);
if (!$dbh) {
- die ("Could not connect to the server");
+ die ("Could not connect to the server");
}
_set_lc_messages();
@@ -46,13 +46,12 @@ var_dump($row);
pg_free_result($res);
if ($row[0] == 'f')
{
- var_dump(pg_last_notice($dbh));
+ var_dump(pg_last_notice($dbh));
}
pg_close($dbh);
?>
-===DONE===
--EXPECTF--
resource(%d) of type (pgsql result)
resource(%d) of type (pgsql result)
@@ -61,4 +60,3 @@ array(1) {
string(1) "f"
}
string(14) "NOTICE: 11111"
-===DONE===
diff --git a/ext/pgsql/tests/80_bug32223b.phpt b/ext/pgsql/tests/80_bug32223b.phpt
index 9e0e0f7132..0584604353 100644
--- a/ext/pgsql/tests/80_bug32223b.phpt
+++ b/ext/pgsql/tests/80_bug32223b.phpt
@@ -55,7 +55,6 @@ tester();
pg_close(dbh);
?>
-===DONE===
--EXPECTF--
resource(%d) of type (pgsql result)
array(1) {
@@ -63,4 +62,3 @@ array(1) {
string(1) "f"
}
string(14) "NOTICE: 11111"
-===DONE===
diff --git a/ext/pgsql/tests/80_bug36625.phpt b/ext/pgsql/tests/80_bug36625.phpt
index b36ff4e890..63908f3b7a 100644
--- a/ext/pgsql/tests/80_bug36625.phpt
+++ b/ext/pgsql/tests/80_bug36625.phpt
@@ -11,7 +11,7 @@ require_once('config.inc');
$dbh = @pg_connect($conn_str);
if (!$dbh) {
- die ('Could not connect to the server');
+ die ('Could not connect to the server');
}
$tracefile = __DIR__ . '/trace.tmp';
@@ -27,9 +27,9 @@ pg_close($dbh);
$found = 0;
function search_trace_file($line)
{
- if (strpos($line, '"select 1"') !== false || strpos($line, "'select 1'") !== false) {
- $GLOBALS['found']++;
- }
+ if (strpos($line, '"select 1"') !== false || strpos($line, "'select 1'") !== false) {
+ $GLOBALS['found']++;
+ }
}
$trace = file($tracefile);
@@ -40,7 +40,6 @@ var_dump(file_exists($tracefile));
@unlink($tracefile);
?>
-===DONE===
--CLEAN--
<?php
@@ -54,4 +53,3 @@ bool(false)
resource(%d) of type (pgsql result)
bool(true)
bool(true)
-===DONE===
diff --git a/ext/pgsql/tests/80_bug39971.phpt b/ext/pgsql/tests/80_bug39971.phpt
index 14c7fbd547..4fd065adf7 100644
--- a/ext/pgsql/tests/80_bug39971.phpt
+++ b/ext/pgsql/tests/80_bug39971.phpt
@@ -11,7 +11,7 @@ require_once('config.inc');
$dbh = @pg_connect($conn_str);
if (!$dbh) {
- die ("Could not connect to the server");
+ die ("Could not connect to the server");
}
pg_query("CREATE TABLE php_test (id SERIAL, tm timestamp NOT NULL)");
diff --git a/ext/pgsql/tests/80_bug42783.phpt b/ext/pgsql/tests/80_bug42783.phpt
index 91461f4b73..49119891e0 100644
--- a/ext/pgsql/tests/80_bug42783.phpt
+++ b/ext/pgsql/tests/80_bug42783.phpt
@@ -11,7 +11,7 @@ require_once('config.inc');
$dbh = @pg_connect($conn_str);
if (!$dbh) {
- die ("Could not connect to the server");
+ die ("Could not connect to the server");
}
pg_query("CREATE TABLE php_test (id SERIAL PRIMARY KEY, time TIMESTAMP NOT NULL DEFAULT now())");
@@ -23,7 +23,6 @@ var_dump(pg_fetch_assoc(pg_query("SELECT * FROM php_test")));
pg_query($dbh, "DROP TABLE php_test");
pg_close($dbh);
?>
-===DONE===
--EXPECTF--
array(2) {
["id"]=>
@@ -31,4 +30,3 @@ array(2) {
["time"]=>
string(%d) "%s"
}
-===DONE===
diff --git a/ext/pgsql/tests/bug71998.phpt b/ext/pgsql/tests/bug71998.phpt
index f69261c1c0..116135ab51 100644
--- a/ext/pgsql/tests/bug71998.phpt
+++ b/ext/pgsql/tests/bug71998.phpt
@@ -14,69 +14,68 @@ $db = pg_connect($conn_str);
pg_query("CREATE TABLE tmp_statistics (id integer NOT NULL, remote_addr inet);");
$ips = array(
- /* IPv4*/
- "127.0.0.1",
- "10.0.0.1",
- "192.168.1.1",
- "0.0.0.0",
- "255.255.255.255",
- "192.168.1.35/24",
+ /* IPv4*/
+ "127.0.0.1",
+ "10.0.0.1",
+ "192.168.1.1",
+ "0.0.0.0",
+ "255.255.255.255",
+ "192.168.1.35/24",
- /* IPv6 */
- "::1",
- "::10.2.3.4",
- "::ffff:10.4.3.2",
- "1:2:3:4:5:6:7:8",
- "::ffff:10.0.0.1",
- "::ffff:1.2.3.4",
- "::ffff:0.0.0.0",
- "1:2:3:4:5:6:77:88",
- "::ffff:255.255.255.255",
- "fe08::7:8",
- "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
- "::5:aef1:ffff/128",
- "2001:4f8:3:ba::/112",
+ /* IPv6 */
+ "::1",
+ "::10.2.3.4",
+ "::ffff:10.4.3.2",
+ "1:2:3:4:5:6:7:8",
+ "::ffff:10.0.0.1",
+ "::ffff:1.2.3.4",
+ "::ffff:0.0.0.0",
+ "1:2:3:4:5:6:77:88",
+ "::ffff:255.255.255.255",
+ "fe08::7:8",
+ "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
+ "::5:aef1:ffff/128",
+ "2001:4f8:3:ba::/112",
);
$bad = array(
- /* bad */
- "256.257.258.259",
- "fe08::7:8interface",
- "schnitzel",
- "10002.3.4",
- "1.2.3.4.5",
- "256.0.0.0",
- "260.0.0.0",
+ /* bad */
+ "256.257.258.259",
+ "fe08::7:8interface",
+ "schnitzel",
+ "10002.3.4",
+ "1.2.3.4.5",
+ "256.0.0.0",
+ "260.0.0.0",
);
$ips = array_merge($ips, $bad);
$i = 0;
$errors = 0;
foreach ($ips as $ip) {
- $data = array("id" => ++$i, "remote_addr" => $ip);
- $r = @pg_insert($db, 'tmp_statistics', $data);
+ $data = array("id" => ++$i, "remote_addr" => $ip);
+ $r = @pg_insert($db, 'tmp_statistics', $data);
- if (!$r && in_array($ip, $bad)) {
- $errors++;
- //echo pg_last_error($db);
- }
+ if (!$r && in_array($ip, $bad)) {
+ $errors++;
+ //echo pg_last_error($db);
+ }
- //pg_query($db, "INSERT INTO tmp_statistics (id, remote_addr) VALUES (2, '127.0.0.1')"); // OK, record inserted
+ //pg_query($db, "INSERT INTO tmp_statistics (id, remote_addr) VALUES (2, '127.0.0.1')"); // OK, record inserted
}
$r = pg_query($db, "SELECT * FROM tmp_statistics");
while (false != ($row = pg_fetch_row($r))) {
- var_dump($row);
+ var_dump($row);
}
-echo $errors, " errors catched\n";
+echo $errors, " errors caught\n";
pg_query($db, "DROP TABLE tmp_statistics");
pg_close($db);
?>
-==DONE==
--EXPECT--
array(2) {
[0]=>
@@ -192,5 +191,4 @@ array(2) {
[1]=>
string(19) "2001:4f8:3:ba::/112"
}
-7 errors catched
-==DONE==
+7 errors caught
diff --git a/ext/pgsql/tests/bug72028.phpt b/ext/pgsql/tests/bug72028.phpt
index 217a03abc7..7073ca7d03 100644
--- a/ext/pgsql/tests/bug72028.phpt
+++ b/ext/pgsql/tests/bug72028.phpt
@@ -29,13 +29,12 @@ $result = pg_query_params($conn, $sql, $params2);
$r = pg_query("SELECT * FROM $table");
while (false !== ($i = pg_fetch_assoc($r))) {
- var_dump($i);
+ var_dump($i);
}
pg_query("DROP TABLE $table");
?>
-==DONE==
--EXPECT--
array(2) {
["value"]=>
@@ -49,4 +48,3 @@ array(2) {
["details"]=>
string(37) "insert after looping with a reference"
}
-==DONE==
diff --git a/ext/pgsql/tests/bug72197.phpt b/ext/pgsql/tests/bug72197.phpt
index bf9c16978b..796d4c713c 100644
--- a/ext/pgsql/tests/bug72197.phpt
+++ b/ext/pgsql/tests/bug72197.phpt
@@ -7,7 +7,11 @@ Bug #72197 pg_lo_create arbitrary read
/* This shouldn't crash. */
$var1=-32768;
$var2="12";
-pg_lo_create($var1, $var2);
+try {
+ pg_lo_create($var1, $var2);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
/* This should work correctly. */
include('config.inc');
@@ -26,9 +30,7 @@ var_dump($oid);
pg_query($conn, "ROLLBACK");
pg_close($conn);
?>
-==DONE==
--EXPECTF--
-Warning: pg_lo_create(): supplied resource is not a valid PostgreSQL link resource in %sbug72197.php on line %d%w
+pg_lo_create(): supplied resource is not a valid PostgreSQL link resource%w
int(%d)
int(%d)
-==DONE==
diff --git a/ext/pgsql/tests/bug76548.phpt b/ext/pgsql/tests/bug76548.phpt
index 00940dcec0..9087b234a2 100644
--- a/ext/pgsql/tests/bug76548.phpt
+++ b/ext/pgsql/tests/bug76548.phpt
@@ -15,9 +15,7 @@ while ($value = pg_fetch_result($result, 0)) {
}
?>
-==DONE==
--EXPECT--
string(1) "1"
string(1) "2"
string(1) "3"
-==DONE==
diff --git a/ext/pgsql/tests/bug77047.phpt b/ext/pgsql/tests/bug77047.phpt
index 2cbc4c3dda..222a5398b6 100644
--- a/ext/pgsql/tests/bug77047.phpt
+++ b/ext/pgsql/tests/bug77047.phpt
@@ -14,8 +14,8 @@ $db = pg_connect($conn_str);
pg_query($db, "DROP TABLE IF EXISTS bug77047");
pg_query($db, "CREATE TABLE bug77047 (
- t TIME WITHOUT TIME ZONE
- )");
+ t TIME WITHOUT TIME ZONE
+ )");
pg_insert($db, "bug77047", array("t" => "13:31"));
pg_insert($db, "bug77047", array("t" => "13:31:13"));
@@ -26,7 +26,7 @@ pg_insert($db, "bug77047", array("t" => ""));
$res = pg_query($db, "SELECT t FROM bug77047");
while (false !== ($row = pg_fetch_row($res))) {
- var_dump(array_pop($row));
+ var_dump(array_pop($row));
}
?>
diff --git a/ext/pgsql/tests/lcmess.inc b/ext/pgsql/tests/lcmess.inc
index 6e0ac25b11..32ab0e36f5 100644
--- a/ext/pgsql/tests/lcmess.inc
+++ b/ext/pgsql/tests/lcmess.inc
@@ -2,20 +2,20 @@
function _skip_lc_messages($lc_messages = 'C')
{
- if (!_set_lc_messages($lc_messages)) {
- die("skip Cannot set LC_MESSAGES to '{$lc_messages}'\n");
- }
+ if (!_set_lc_messages($lc_messages)) {
+ die("skip Cannot set LC_MESSAGES to '{$lc_messages}'\n");
+ }
}
function _set_lc_messages($lc_messages = 'C')
{
- if (pg_result(pg_query("SHOW LC_MESSAGES"), 0, 0) != $lc_messages) {
- if (!@pg_exec("SET LC_MESSAGES='{$lc_messages}'")) {
- return false;
- }
- }
+ if (pg_result(pg_query("SHOW LC_MESSAGES"), 0, 0) != $lc_messages) {
+ if (!@pg_exec("SET LC_MESSAGES='{$lc_messages}'")) {
+ return false;
+ }
+ }
- return true;
+ return true;
}
?>
diff --git a/ext/pgsql/tests/pg_insert_002.phpt b/ext/pgsql/tests/pg_insert_002.phpt
index 0dcee55b8f..bb84a00d0d 100644
--- a/ext/pgsql/tests/pg_insert_002.phpt
+++ b/ext/pgsql/tests/pg_insert_002.phpt
@@ -10,7 +10,7 @@ include('config.inc');
$conn = pg_connect($conn_str);
foreach (array('', '.', '..') as $table) {
- var_dump(pg_insert($conn, $table, array('id' => 1, 'id2' => 1)));
+ var_dump(pg_insert($conn, $table, array('id' => 1, 'id2' => 1)));
}
?>
Done
diff --git a/ext/pgsql/tests/pg_update_001.phpt b/ext/pgsql/tests/pg_update_001.phpt
index 85a86f3d23..7ef66c2652 100644
--- a/ext/pgsql/tests/pg_update_001.phpt
+++ b/ext/pgsql/tests/pg_update_001.phpt
@@ -26,7 +26,7 @@ var_dump(pg_update($conn, 'phptests.foo', array('id' => 100), array('id2' => 2),
$rs = pg_query('SELECT * FROM foo UNION SELECT * FROM phptests.foo ORDER BY id');
while ($row = pg_fetch_assoc($rs)) {
- var_dump($row);
+ var_dump($row);
}
pg_query('DROP TABLE foo');
diff --git a/ext/pgsql/tests/skipif.inc b/ext/pgsql/tests/skipif.inc
index e24847445c..38c2888afa 100644
--- a/ext/pgsql/tests/skipif.inc
+++ b/ext/pgsql/tests/skipif.inc
@@ -19,27 +19,27 @@ if (!is_resource($conn)) {
function skip_server_version($version, $op = '<')
{
- $pg = pg_parameter_status('server_version');
- if (version_compare($pg, $version, $op)) {
- die("skip Server version {$pg} is {$op} {$version}\n");
- }
- return $pg;
+ $pg = pg_parameter_status('server_version');
+ if (version_compare($pg, $version, $op)) {
+ die("skip Server version {$pg} is {$op} {$version}\n");
+ }
+ return $pg;
}
function skip_bytea_not_hex()
{
- $out = pg_escape_bytea("\xFF");
- if (strpos($out, '377') !== false) {
- die("skip libpq or backend < 9.0\n");
- }
+ $out = pg_escape_bytea("\xFF");
+ if (strpos($out, '377') !== false) {
+ die("skip libpq or backend < 9.0\n");
+ }
}
function skip_bytea_not_escape()
{
- $out = pg_escape_bytea("\xFF");
- if (strpos($out, '377') === false) {
- die("skip libpq or backend >= 9.0\n");
- }
+ $out = pg_escape_bytea("\xFF");
+ if (strpos($out, '377') === false) {
+ die("skip libpq or backend >= 9.0\n");
+ }
}
?>
diff --git a/ext/phar/dirstream.c b/ext/phar/dirstream.c
index 4710703c70..cb14f9e986 100644
--- a/ext/phar/dirstream.c
+++ b/ext/phar/dirstream.c
@@ -285,10 +285,7 @@ PHAR_ADD_ENTRY:
if (FAILURE != zend_hash_has_more_elements(data)) {
efree(dir);
- if (zend_hash_sort(data, phar_compare_dir_name, 0) == FAILURE) {
- FREE_HASHTABLE(data);
- return NULL;
- }
+ zend_hash_sort(data, phar_compare_dir_name, 0);
return php_stream_alloc(&phar_dir_ops, data, NULL, "r");
} else {
efree(dir);
diff --git a/ext/phar/func_interceptors.c b/ext/phar/func_interceptors.c
index 404014f045..4e5115f884 100644
--- a/ext/phar/func_interceptors.c
+++ b/ext/phar/func_interceptors.c
@@ -37,7 +37,7 @@ PHAR_FUNC(phar_opendir) /* {{{ */
}
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|z", &filename, &filename_len, &zcontext) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!IS_ABSOLUTE_PATH(filename, filename_len) && !strstr(filename, "://")) {
@@ -137,7 +137,7 @@ PHAR_FUNC(phar_file_get_contents) /* {{{ */
if (ZEND_NUM_ARGS() == 5 && maxlen < 0) {
efree(arch);
- php_error_docref(NULL, E_WARNING, "length must be greater than or equal to zero");
+ php_error_docref(NULL, E_WARNING, "Length must be greater than or equal to zero");
RETURN_FALSE;
}
@@ -765,7 +765,7 @@ ZEND_NAMED_FUNCTION(fname) { \
size_t filename_len; \
\
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &filename, &filename_len) == FAILURE) { \
- return; \
+ RETURN_THROWS(); \
} \
\
phar_file_stat(filename, filename_len, funcnum, PHAR_G(orig), INTERNAL_FUNCTION_PARAM_PASSTHRU); \
diff --git a/ext/phar/phar/clicommand.inc b/ext/phar/phar/clicommand.inc
index 79bf5c8855..7527e1c4d9 100644
--- a/ext/phar/phar/clicommand.inc
+++ b/ext/phar/phar/clicommand.inc
@@ -16,336 +16,336 @@
*/
abstract class CLICommand
{
- protected $argc;
- protected $argv;
- protected $cmds = array();
- protected $args = array();
- protected $typs = array();
-
- function __construct($argc, array $argv)
- {
- $this->argc = $argc;
- $this->argv = $argv;
- $this->cmds = self::getCommands($this);
- $this->typs = self::getArgTyps($this);
-
- if ($argc < 2) {
- self::error("No command given, check ${argv[0]} help\n");
- } elseif (!isset($this->cmds[$argv[1]]['run'])) {
- self::error("Unknown command '${argv[1]}', check ${argv[0]} help\n");
- } else {
- $command = $argv[1];
- }
-
- if (isset($this->cmds[$command]['arg'])) {
- $this->args = call_user_func(array($this, $this->cmds[$command]['arg']));
- $i = 1;
- $missing = false;
- while (++$i < $argc) {
- if ($argv[$i][0] == '-') {
- if (strlen($argv[$i]) == 2 && isset($this->args[$argv[$i][1]])) {
- $arg = $argv[$i][1];
- if (++$i >= $argc) {
- self::error("Missing argument to parameter '$arg' of command '$command', check ${argv[0]} help\n");
- } else {
- $this->args[$arg]['val'] = $this->checkArgTyp($arg, $i, $argc, $argv);
- }
- } else {
- self::error("Unknown parameter '${argv[$i]}' to command $command, check ${argv[0]} help\n");
- }
- } else {
- break;
- }
- }
-
- if (isset($this->args[''])) {
- if ($i >= $argc) {
- if (isset($this->args['']['require']) && $this->args['']['require']) {
- self::error("Missing default trailing arguments to command $command, check ${argv[0]} help\n");
- }
- } else {
- $this->args['']['val'] = array();
- while($i < $argc) {
- $this->args['']['val'][] = $argv[$i++];
- }
- }
- } else if ($i < $argc) {
- self::error("Unexpected default arguments to command $command, check ${argv[0]} help\n");
- }
-
- foreach($this->args as $arg => $inf) {
- if (strlen($arg) && !isset($inf['val']) && isset($inf['required']) && $inf['required']) {
- $missing .= "Missing parameter '-$arg' to command $command, check ${argv[0]} help\n";
- }
- }
-
- if (strlen($missing)) {
- self::error($missing);
- }
- }
-
- call_user_func(array($this, $this->cmds[$command]['run']), $this->args);
- }
-
- static function notice ($msg)
- {
- fprintf(STDERR, $msg);
- }
-
- static function error ($msg, $exit_code = 1)
- {
- self::notice($msg);
- exit($exit_code);
- }
-
- function checkArgTyp($arg, $i, $argc, $argv)
- {
- $typ = $this->args[$arg]['typ'];
-
- if (isset($this->typs[$typ]['typ'])) {
- return call_user_func(array($this, $this->typs[$typ]['typ']), $argv[$i], $this->args[$arg], $arg);
- } else {
- return $argv[$i];
- }
- }
-
- static function getSubFuncs(CLICommand $cmdclass, $prefix, array $subs)
- {
- $a = array();
- $r = new ReflectionClass($cmdclass);
- $l = strlen($prefix);
-
- foreach($r->getMethods() as $m) {
- if (substr($m->name, 0, $l) == $prefix) {
- foreach($subs as $sub) {
- $what = substr($m->name, $l+strlen($sub)+1);
- $func = $prefix . $sub . '_' . $what;
- $what = str_replace('_', '-', $what);
- if ($r->hasMethod($func)) {
- if (!isset($a[$what])) {
- $a[$what] = array();
- }
- $a[$what][$sub] = /*$m->class . '::' .*/ $func;
- }
- }
- }
- }
- return $a;
- }
-
- static function getCommands(CLICommand $cmdclass)
- {
- return self::getSubFuncs($cmdclass, 'cli_cmd_', array('arg','inf','run'));
- }
-
- static function getArgTyps(CLICommand $cmdclass)
- {
- return self::getSubFuncs($cmdclass, 'cli_arg_', array('typ'));
- }
-
- static function cli_arg_typ_bool($arg, $cfg, $key)
- {
- return (bool)$arg;
- }
-
- static function cli_arg_typ_int($arg, $cfg, $key)
- {
- if ((int)$arg != $arg) {
- self::error("Argument to -$key must be an integer.\n");
- }
-
- return (int)$arg;
- }
-
- static function cli_arg_typ_regex($arg, $cfg, $key)
- {
- if (strlen($arg)) {
- if (strlen($arg) > 1 && $arg[0] == $arg[strlen($arg)-1] && strpos('/,', $arg) !== false) {
- return $arg;
- } else {
- return '/' . $arg . '/';
- }
- } else {
- return NULL;
- }
- }
-
- static function cli_arg_typ_select($arg, $cfg, $key)
- {
- if (!in_array($arg, array_keys($cfg['select']))) {
- self::error("Parameter value '$arg' not one of '" . join("', '", array_keys($cfg['select'])) . "'.\n");
- }
- return $arg;
- }
-
- static function cli_arg_typ_dir($arg, $cfg, $key)
- {
- $f = realpath($arg);
-
- if ($f===false || !file_exists($f) || !is_dir($f)) {
- self::error("Requested path '$arg' does not exist.\n");
- }
- return $f;
- }
-
- static function cli_arg_typ_file($arg)
- {
- $f = new SplFileInfo($arg);
- $f = $f->getRealPath();
- if ($f===false || !file_exists($f)) {
- echo "Requested file '$arg' does not exist.\n";
- exit(1);
- }
- return $f;
- }
-
- static function cli_arg_typ_filenew($arg, $cfg, $key)
- {
- $d = dirname($arg);
- $f = realpath($d);
-
- if ($f === false) {
- self::error("Path for file '$arg' does not exist.\n");
- }
- return $f . '/' . basename($arg);
- }
-
- static function cli_arg_typ_filecont($arg, $cfg, $key)
- {
- return file_get_contents(self::cli_arg_typ_file($arg, $cfg, $key));
- }
-
- function cli_get_SP2($l1, $arg_inf)
- {
- return str_repeat(' ', $l1 + 2 + 4 + 8);
- }
-
- function cli_get_SP3($l1, $l2, $arg_inf)
- {
- return str_repeat(' ', $l1 + 2 + 4 + 8 + 2 + $l2 + 2);
- }
-
- static function cli_cmd_inf_help()
- {
- return "This help or help for a selected command.";
- }
-
- private function cli_wordwrap($what, $l, $sp)
- {
- $p = max(79 - $l, 40); // minimum length for paragraph
- $b = substr($what, 0, $l); // strip out initial $l
- $r = substr($what, $l); // remainder
- $r = str_replace("\n", "\n".$sp, $r); // in remainder replace \n's
- return $b . wordwrap($r, $p, "\n".$sp);
- }
-
- private function cli_help_get_args($func, $l, $sp, $required)
- {
- $inf = "";
- foreach(call_user_func($func, $l, $sp) as $arg => $conf) {
- if ((isset($conf['required']) && $conf['required']) != $required) {
- continue;
- }
-
- if (strlen($arg)) {
- $arg = "-$arg ";
- } else {
- $arg = "... ";
- }
-
- $sp2 = $this->cli_get_SP2($l, $inf);
- $l2 = strlen($sp2);
- $inf .= $this->cli_wordwrap($sp . $arg . $conf['inf'], $l2, $sp2) . "\n";
-
- if (isset($conf['select']) && count($conf['select'])) {
- $ls = 0;
- foreach($conf['select'] as $opt => $what) {
- $ls = max($ls, strlen($opt));
- }
- $sp3 = $this->cli_get_SP3($l, $ls, $inf);
- $l3 = strlen($sp3);
- foreach($conf['select'] as $opt => $what) {
- $inf .= $this->cli_wordwrap($sp2 . " " . sprintf("%-${ls}s ", $opt) . $what, $l3, $sp3) . "\n";
- }
- }
- }
- if (strlen($inf)) {
- if ($required) {
- return $sp . "Required arguments:\n\n" . $inf;
- } else {
- return $sp . "Optional arguments:\n\n". $inf;
- }
- }
- }
-
- function cli_cmd_arg_help()
- {
- return array('' => array('typ'=>'any','val'=>NULL,'inf'=>'Optional command to retrieve help for.'));
- }
-
- function cli_cmd_run_help()
- {
- $argv = $this->argv;
- $which = $this->args['']['val'];
- if (isset($which)) {
- if (count($which) != 1) {
- self::error("More than one command given.\n");
- }
-
- $which = $which[0];
- if (!array_key_exists($which, $this->cmds)) {
- if (strtolower($which) == 'commands') {
- self::cli_cmd_run_help_list();
- exit(0);
- }
- self::error("Unknown command, cannot retrieve help.\n");
- }
-
- $l = strlen($which);
- $cmds = array($which => $this->cmds[$which]);
- } else {
- echo "\n$argv[0] <command> [options]\n\n";
- $l = 0;
- ksort($this->cmds);
- foreach($this->cmds as $name => $funcs) {
- $l = max($l, strlen($name));
- }
- $inf = "Commands:";
- $lst = "";
- $ind = strlen($inf) + 1;
- foreach($this->cmds as $name => $funcs) {
- $lst .= ' ' . $name;
- }
- echo $this->cli_wordwrap($inf.$lst, $ind, str_repeat(' ', $ind)) . "\n\n";
- $cmds = $this->cmds;
- }
- $sp = str_repeat(' ', $l + 2);
- foreach($cmds as $name => $funcs) {
- $inf = $name . substr($sp, strlen($name));
- if (isset($funcs['inf'])) {
- $inf .= $this->cli_wordwrap(call_user_func(array($this, $funcs['inf'])), $l, $sp) . "\n";
- if (isset($funcs['arg'])) {
- $inf .= "\n";
- $inf .= $this->cli_help_get_args(array($this, $funcs['arg']), $l, $sp, true);
- $inf .= "\n";
- $inf .= $this->cli_help_get_args(array($this, $funcs['arg']), $l, $sp, false);
- }
- }
- echo "$inf\n\n";
- }
- exit(0);
- }
-
- static function cli_cmd_inf_help_list()
- {
- return "Lists available commands.";
- }
-
- function cli_cmd_run_help_list()
- {
- ksort($this->cmds);
- echo join(' ', array_keys($this->cmds)) . "\n";
- }
+ protected $argc;
+ protected $argv;
+ protected $cmds = array();
+ protected $args = array();
+ protected $typs = array();
+
+ function __construct($argc, array $argv)
+ {
+ $this->argc = $argc;
+ $this->argv = $argv;
+ $this->cmds = self::getCommands($this);
+ $this->typs = self::getArgTyps($this);
+
+ if ($argc < 2) {
+ self::error("No command given, check ${argv[0]} help\n");
+ } elseif (!isset($this->cmds[$argv[1]]['run'])) {
+ self::error("Unknown command '${argv[1]}', check ${argv[0]} help\n");
+ } else {
+ $command = $argv[1];
+ }
+
+ if (isset($this->cmds[$command]['arg'])) {
+ $this->args = call_user_func(array($this, $this->cmds[$command]['arg']));
+ $i = 1;
+ $missing = false;
+ while (++$i < $argc) {
+ if ($argv[$i][0] == '-') {
+ if (strlen($argv[$i]) == 2 && isset($this->args[$argv[$i][1]])) {
+ $arg = $argv[$i][1];
+ if (++$i >= $argc) {
+ self::error("Missing argument to parameter '$arg' of command '$command', check ${argv[0]} help\n");
+ } else {
+ $this->args[$arg]['val'] = $this->checkArgTyp($arg, $i, $argc, $argv);
+ }
+ } else {
+ self::error("Unknown parameter '${argv[$i]}' to command $command, check ${argv[0]} help\n");
+ }
+ } else {
+ break;
+ }
+ }
+
+ if (isset($this->args[''])) {
+ if ($i >= $argc) {
+ if (isset($this->args['']['require']) && $this->args['']['require']) {
+ self::error("Missing default trailing arguments to command $command, check ${argv[0]} help\n");
+ }
+ } else {
+ $this->args['']['val'] = array();
+ while($i < $argc) {
+ $this->args['']['val'][] = $argv[$i++];
+ }
+ }
+ } else if ($i < $argc) {
+ self::error("Unexpected default arguments to command $command, check ${argv[0]} help\n");
+ }
+
+ foreach($this->args as $arg => $inf) {
+ if (strlen($arg) && !isset($inf['val']) && isset($inf['required']) && $inf['required']) {
+ $missing .= "Missing parameter '-$arg' to command $command, check ${argv[0]} help\n";
+ }
+ }
+
+ if (strlen($missing)) {
+ self::error($missing);
+ }
+ }
+
+ call_user_func(array($this, $this->cmds[$command]['run']), $this->args);
+ }
+
+ static function notice ($msg)
+ {
+ fprintf(STDERR, $msg);
+ }
+
+ static function error ($msg, $exit_code = 1)
+ {
+ self::notice($msg);
+ exit($exit_code);
+ }
+
+ function checkArgTyp($arg, $i, $argc, $argv)
+ {
+ $typ = $this->args[$arg]['typ'];
+
+ if (isset($this->typs[$typ]['typ'])) {
+ return call_user_func(array($this, $this->typs[$typ]['typ']), $argv[$i], $this->args[$arg], $arg);
+ } else {
+ return $argv[$i];
+ }
+ }
+
+ static function getSubFuncs(CLICommand $cmdclass, $prefix, array $subs)
+ {
+ $a = array();
+ $r = new ReflectionClass($cmdclass);
+ $l = strlen($prefix);
+
+ foreach($r->getMethods() as $m) {
+ if (substr($m->name, 0, $l) == $prefix) {
+ foreach($subs as $sub) {
+ $what = substr($m->name, $l+strlen($sub)+1);
+ $func = $prefix . $sub . '_' . $what;
+ $what = str_replace('_', '-', $what);
+ if ($r->hasMethod($func)) {
+ if (!isset($a[$what])) {
+ $a[$what] = array();
+ }
+ $a[$what][$sub] = /*$m->class . '::' .*/ $func;
+ }
+ }
+ }
+ }
+ return $a;
+ }
+
+ static function getCommands(CLICommand $cmdclass)
+ {
+ return self::getSubFuncs($cmdclass, 'cli_cmd_', array('arg','inf','run'));
+ }
+
+ static function getArgTyps(CLICommand $cmdclass)
+ {
+ return self::getSubFuncs($cmdclass, 'cli_arg_', array('typ'));
+ }
+
+ static function cli_arg_typ_bool($arg, $cfg, $key)
+ {
+ return (bool)$arg;
+ }
+
+ static function cli_arg_typ_int($arg, $cfg, $key)
+ {
+ if ((int)$arg != $arg) {
+ self::error("Argument to -$key must be an integer.\n");
+ }
+
+ return (int)$arg;
+ }
+
+ static function cli_arg_typ_regex($arg, $cfg, $key)
+ {
+ if (strlen($arg)) {
+ if (strlen($arg) > 1 && $arg[0] == $arg[strlen($arg)-1] && strpos('/,', $arg) !== false) {
+ return $arg;
+ } else {
+ return '/' . $arg . '/';
+ }
+ } else {
+ return NULL;
+ }
+ }
+
+ static function cli_arg_typ_select($arg, $cfg, $key)
+ {
+ if (!in_array($arg, array_keys($cfg['select']))) {
+ self::error("Parameter value '$arg' not one of '" . join("', '", array_keys($cfg['select'])) . "'.\n");
+ }
+ return $arg;
+ }
+
+ static function cli_arg_typ_dir($arg, $cfg, $key)
+ {
+ $f = realpath($arg);
+
+ if ($f===false || !file_exists($f) || !is_dir($f)) {
+ self::error("Requested path '$arg' does not exist.\n");
+ }
+ return $f;
+ }
+
+ static function cli_arg_typ_file($arg)
+ {
+ $f = new SplFileInfo($arg);
+ $f = $f->getRealPath();
+ if ($f===false || !file_exists($f)) {
+ echo "Requested file '$arg' does not exist.\n";
+ exit(1);
+ }
+ return $f;
+ }
+
+ static function cli_arg_typ_filenew($arg, $cfg, $key)
+ {
+ $d = dirname($arg);
+ $f = realpath($d);
+
+ if ($f === false) {
+ self::error("Path for file '$arg' does not exist.\n");
+ }
+ return $f . '/' . basename($arg);
+ }
+
+ static function cli_arg_typ_filecont($arg, $cfg, $key)
+ {
+ return file_get_contents(self::cli_arg_typ_file($arg, $cfg, $key));
+ }
+
+ function cli_get_SP2($l1, $arg_inf)
+ {
+ return str_repeat(' ', $l1 + 2 + 4 + 8);
+ }
+
+ function cli_get_SP3($l1, $l2, $arg_inf)
+ {
+ return str_repeat(' ', $l1 + 2 + 4 + 8 + 2 + $l2 + 2);
+ }
+
+ static function cli_cmd_inf_help()
+ {
+ return "This help or help for a selected command.";
+ }
+
+ private function cli_wordwrap($what, $l, $sp)
+ {
+ $p = max(79 - $l, 40); // minimum length for paragraph
+ $b = substr($what, 0, $l); // strip out initial $l
+ $r = substr($what, $l); // remainder
+ $r = str_replace("\n", "\n".$sp, $r); // in remainder replace \n's
+ return $b . wordwrap($r, $p, "\n".$sp);
+ }
+
+ private function cli_help_get_args($func, $l, $sp, $required)
+ {
+ $inf = "";
+ foreach(call_user_func($func, $l, $sp) as $arg => $conf) {
+ if ((isset($conf['required']) && $conf['required']) != $required) {
+ continue;
+ }
+
+ if (strlen($arg)) {
+ $arg = "-$arg ";
+ } else {
+ $arg = "... ";
+ }
+
+ $sp2 = $this->cli_get_SP2($l, $inf);
+ $l2 = strlen($sp2);
+ $inf .= $this->cli_wordwrap($sp . $arg . $conf['inf'], $l2, $sp2) . "\n";
+
+ if (isset($conf['select']) && count($conf['select'])) {
+ $ls = 0;
+ foreach($conf['select'] as $opt => $what) {
+ $ls = max($ls, strlen($opt));
+ }
+ $sp3 = $this->cli_get_SP3($l, $ls, $inf);
+ $l3 = strlen($sp3);
+ foreach($conf['select'] as $opt => $what) {
+ $inf .= $this->cli_wordwrap($sp2 . " " . sprintf("%-${ls}s ", $opt) . $what, $l3, $sp3) . "\n";
+ }
+ }
+ }
+ if (strlen($inf)) {
+ if ($required) {
+ return $sp . "Required arguments:\n\n" . $inf;
+ } else {
+ return $sp . "Optional arguments:\n\n". $inf;
+ }
+ }
+ }
+
+ function cli_cmd_arg_help()
+ {
+ return array('' => array('typ'=>'any','val'=>NULL,'inf'=>'Optional command to retrieve help for.'));
+ }
+
+ function cli_cmd_run_help()
+ {
+ $argv = $this->argv;
+ $which = $this->args['']['val'];
+ if (isset($which)) {
+ if (count($which) != 1) {
+ self::error("More than one command given.\n");
+ }
+
+ $which = $which[0];
+ if (!array_key_exists($which, $this->cmds)) {
+ if (strtolower($which) == 'commands') {
+ self::cli_cmd_run_help_list();
+ exit(0);
+ }
+ self::error("Unknown command, cannot retrieve help.\n");
+ }
+
+ $l = strlen($which);
+ $cmds = array($which => $this->cmds[$which]);
+ } else {
+ echo "\n$argv[0] <command> [options]\n\n";
+ $l = 0;
+ ksort($this->cmds);
+ foreach($this->cmds as $name => $funcs) {
+ $l = max($l, strlen($name));
+ }
+ $inf = "Commands:";
+ $lst = "";
+ $ind = strlen($inf) + 1;
+ foreach($this->cmds as $name => $funcs) {
+ $lst .= ' ' . $name;
+ }
+ echo $this->cli_wordwrap($inf.$lst, $ind, str_repeat(' ', $ind)) . "\n\n";
+ $cmds = $this->cmds;
+ }
+ $sp = str_repeat(' ', $l + 2);
+ foreach($cmds as $name => $funcs) {
+ $inf = $name . substr($sp, strlen($name));
+ if (isset($funcs['inf'])) {
+ $inf .= $this->cli_wordwrap(call_user_func(array($this, $funcs['inf'])), $l, $sp) . "\n";
+ if (isset($funcs['arg'])) {
+ $inf .= "\n";
+ $inf .= $this->cli_help_get_args(array($this, $funcs['arg']), $l, $sp, true);
+ $inf .= "\n";
+ $inf .= $this->cli_help_get_args(array($this, $funcs['arg']), $l, $sp, false);
+ }
+ }
+ echo "$inf\n\n";
+ }
+ exit(0);
+ }
+
+ static function cli_cmd_inf_help_list()
+ {
+ return "Lists available commands.";
+ }
+
+ function cli_cmd_run_help_list()
+ {
+ ksort($this->cmds);
+ echo join(' ', array_keys($this->cmds)) . "\n";
+ }
}
?>
diff --git a/ext/phar/phar/directorygraphiterator.inc b/ext/phar/phar/directorygraphiterator.inc
index 34579678a7..e31f3e4e67 100644
--- a/ext/phar/phar/directorygraphiterator.inc
+++ b/ext/phar/phar/directorygraphiterator.inc
@@ -16,19 +16,19 @@
*/
class DirectoryGraphIterator extends DirectoryTreeIterator
{
- function __construct($path)
- {
- RecursiveIteratorIterator::__construct(
- new RecursiveCachingIterator(
- new ParentIterator(
- new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::KEY_AS_FILENAME
- )
- ),
- CachingIterator::CALL_TOSTRING|CachingIterator::CATCH_GET_CHILD
- ),
- parent::SELF_FIRST
- );
- }
+ function __construct($path)
+ {
+ RecursiveIteratorIterator::__construct(
+ new RecursiveCachingIterator(
+ new ParentIterator(
+ new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::KEY_AS_FILENAME
+ )
+ ),
+ CachingIterator::CALL_TOSTRING|CachingIterator::CATCH_GET_CHILD
+ ),
+ parent::SELF_FIRST
+ );
+ }
}
?>
diff --git a/ext/phar/phar/directorytreeiterator.inc b/ext/phar/phar/directorytreeiterator.inc
index 2c681632fb..de6acea13d 100644
--- a/ext/phar/phar/directorytreeiterator.inc
+++ b/ext/phar/phar/directorytreeiterator.inc
@@ -16,39 +16,39 @@
*/
class DirectoryTreeIterator extends RecursiveIteratorIterator
{
- /** Construct from a path.
- * @param $path directory to iterate
- */
- function __construct($path)
- {
- parent::__construct(
- new RecursiveCachingIterator(
- new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::KEY_AS_FILENAME
- ),
- CachingIterator::CALL_TOSTRING|CachingIterator::CATCH_GET_CHILD
- ),
- parent::SELF_FIRST
- );
- }
+ /** Construct from a path.
+ * @param $path directory to iterate
+ */
+ function __construct($path)
+ {
+ parent::__construct(
+ new RecursiveCachingIterator(
+ new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::KEY_AS_FILENAME
+ ),
+ CachingIterator::CALL_TOSTRING|CachingIterator::CATCH_GET_CHILD
+ ),
+ parent::SELF_FIRST
+ );
+ }
- /** @return the current element prefixed with ASCII graphics
- */
- function current()
- {
- $tree = '';
- for ($l=0; $l < $this->getDepth(); $l++) {
- $tree .= $this->getSubIterator($l)->hasNext() ? '| ' : ' ';
- }
- return $tree . ($this->getSubIterator($l)->hasNext() ? '|-' : '\-')
- . $this->getSubIterator($l)->__toString();
- }
+ /** @return the current element prefixed with ASCII graphics
+ */
+ function current()
+ {
+ $tree = '';
+ for ($l=0; $l < $this->getDepth(); $l++) {
+ $tree .= $this->getSubIterator($l)->hasNext() ? '| ' : ' ';
+ }
+ return $tree . ($this->getSubIterator($l)->hasNext() ? '|-' : '\-')
+ . $this->getSubIterator($l)->__toString();
+ }
- /** Aggregates the inner iterator
- */
- function __call($func, $params)
- {
- return call_user_func_array(array($this->getSubIterator(), $func), $params);
- }
+ /** Aggregates the inner iterator
+ */
+ function __call($func, $params)
+ {
+ return call_user_func_array(array($this->getSubIterator(), $func), $params);
+ }
}
?>
diff --git a/ext/phar/phar/invertedregexiterator.inc b/ext/phar/phar/invertedregexiterator.inc
index 8f82f41f2a..ff7024e4ec 100644
--- a/ext/phar/phar/invertedregexiterator.inc
+++ b/ext/phar/phar/invertedregexiterator.inc
@@ -16,12 +16,12 @@
*/
class InvertedRegexIterator extends RegexIterator
{
- /** @return !RegexIterator::accept()
- */
- function accept()
- {
- return !RegexIterator::accept();
- }
+ /** @return !RegexIterator::accept()
+ */
+ function accept()
+ {
+ return !RegexIterator::accept();
+ }
}
?>
diff --git a/ext/phar/phar/phar.inc b/ext/phar/phar/phar.inc
index 129a0c43bf..9ca25e7f6f 100644
--- a/ext/phar/phar/phar.inc
+++ b/ext/phar/phar/phar.inc
@@ -20,61 +20,61 @@
*/
class Phar extends PHP_Archive implements RecursiveIterator
{
- function getSignature()
- {
- return false;
- }
+ function getSignature()
+ {
+ return false;
+ }
- function getAlias()
- {
- return false;
- }
+ function getAlias()
+ {
+ return false;
+ }
- function rewind()
- {
- }
+ function rewind()
+ {
+ }
- function valid()
- {
- return false;
- }
+ function valid()
+ {
+ return false;
+ }
- function current()
- {
- }
+ function current()
+ {
+ }
- function key()
- {
- }
+ function key()
+ {
+ }
- function next()
- {
- }
+ function next()
+ {
+ }
- function hasChildren()
- {
- return false;
- }
+ function hasChildren()
+ {
+ return false;
+ }
- function getChildren()
- {
- }
+ function getChildren()
+ {
+ }
- function hasMetadata()
- {
- }
+ function hasMetadata()
+ {
+ }
- function getMetadata()
- {
- }
+ function getMetadata()
+ {
+ }
- function getStub()
- {
- }
+ function getStub()
+ {
+ }
- function setStub()
- {
- }
+ function setStub()
+ {
+ }
}
?>
diff --git a/ext/phar/phar/pharcommand.inc b/ext/phar/phar/pharcommand.inc
index 341e5f3465..1fb41dbb6a 100644
--- a/ext/phar/phar/pharcommand.inc
+++ b/ext/phar/phar/pharcommand.inc
@@ -24,1572 +24,1572 @@
*/
class PharCommand extends CLICommand
{
- // {{{ public function cli_get_SP2
- public function cli_get_SP2($l1, $arg_inf)
- {
- return str_repeat(' ', $l1 + 2 + 4 + 9);
- }
- // }}}
- // {{{ public function cli_get_SP3
- /**
- * Cli Get SP3
- *
- * @param string $l1 Eleven
- * @param string $l2 Twelve
- * @param string $arg_inf
- * @return string The repeated string.
- */
- function cli_get_SP3($l1, $l2, $arg_inf)
- {
- return str_repeat(' ', $l1 + 2 + 4 + 9 + 2 + $l2 + 2);
- }
- // }}}
- // {{{ static function phar_args
- /**
- * Phar arguments
- *
- * This function contains all the phar commands
- *
- * @param string $which Which argument is chosen.
- * @param string $phartype The type of phar, specific file to work on
- * @return unknown
- */
- static function phar_args($which, $phartype)
- {
- $phar_args = array(
- 'a' => array(
- 'typ' => 'alias',
- 'val' => NULL,
- 'inf' => '<alias> Provide an alias name for the phar file.'
- ),
- 'b' => array(
- 'typ' => 'any',
- 'val' => NULL,
- 'inf' => '<bang> Hash-bang line to start the archive (e.g. #!/usr/bin/php). The hash '
- .' mark itself \'#!\' and the newline character are optional.'
- ),
- 'c' => array(
- 'typ' => 'compalg',
- 'val' => NULL,
- 'inf' => '<algo> Compression algorithm.',
- 'select' => array(
- '0' => 'No compression',
- 'none' => 'No compression',
- 'auto' => 'Automatically select compression algorithm'
- )
- ),
- 'e' => array(
- 'typ' => 'entry',
- 'val' => NULL,
- 'inf' => '<entry> Name of entry to work on (must include PHAR internal directory name if any).'
- ),
- 'f' => array(
- 'typ' => $phartype,
- 'val' => NULL,
- 'inf' => '<file> Specifies the phar file to work on.'
- ),
- 'h' => array(
- 'typ' => 'select',
- 'val' => NULL,
- 'inf' => '<method> Selects the hash algorithm.',
- 'select' => array('md5' => 'MD5','sha1' => 'SHA1')
- ),
- 'i' => array(
- 'typ' => 'regex',
- 'val' => NULL,
- 'inf' => '<regex> Specifies a regular expression for input files.'
- ),
- 'k' => array(
- 'typ' => 'any',
- 'val' => NULL,
- 'inf' => '<index> Subscription index to work on.',
- ),
- 'l' => array(
- 'typ' => 'int',
- 'val' => 0,
- 'inf' => '<level> Number of preceding subdirectories to strip from file entries',
- ),
- 'm' => array(
- 'typ' => 'any',
- 'val' => NULL,
- 'inf' => '<meta> Meta data to store with entry (serialized php data).'
- ),
- 'p' => array(
- 'typ' => 'loader',
- 'val' => NULL,
- 'inf' => '<loader> Location of PHP_Archive class file (pear list-files PHP_Archive).'
- .'You can use \'0\' or \'1\' to locate it automatically using the mentioned '
- .'pear command. When using \'0\' the command does not error out when the '
- .'class file cannot be located. This switch also adds some code around the '
- .'stub so that class PHP_Archive gets registered as phar:// stream wrapper '
- .'if necessary. And finally this switch will add the file phar.inc from '
- .'this package and load it to ensure class Phar is present.'
- ,
- ),
- 's' => array(
- 'typ' => 'file',
- 'val' => NULL,
- 'inf' => '<stub> Select the stub file.'
- ),
- 'x' => array(
- 'typ' => 'regex',
- 'val' => NULL,
- 'inf' => '<regex> Regular expression for input files to exclude.'
- ),
- 'y' => array(
- 'typ' => 'privkey',
- 'val' => NULL,
- 'inf' => '<key> Private key for OpenSSL signing.',
- ),
- );
-
- if (extension_loaded('zlib')) {
- $phar_args['c']['select']['gz'] = 'GZip compression';
- $phar_args['c']['select']['gzip'] = 'GZip compression';
- }
-
- if (extension_loaded('bz2')) {
- $phar_args['c']['select']['bz2'] = 'BZip2 compression';
- $phar_args['c']['select']['bzip2'] = 'BZip2 compression';
- }
-
- $hash_avail = Phar::getSupportedSignatures();
- $hash_optional = array('SHA-256' => 'SHA256',
- 'SHA-512' => 'SHA512',
- 'OpenSSL' => 'OpenSSL');
- if (!in_array('OpenSSL', $hash_avail)) {
- unset($phar_args['y']);
- }
-
- foreach($hash_optional as $key => $name) {
- if (in_array($key, $hash_avail)) {
- $phar_args['h']['select'][strtolower($name)] = $name;
- }
- }
-
- $args = array();
-
- foreach($phar_args as $lkey => $cfg) {
- $ukey = strtoupper($lkey);
- $required = strpos($which, $ukey) !== false;
- $optional = strpos($which, $lkey) !== false;
-
- if ($required || $optional) {
- $args[$lkey] = $cfg;
- $args[$lkey]['required'] = $required;
- }
- }
- return $args;
- }
- // }}}
- // {{{ static function strEndsWith
- /**
- * String Ends With
- *
- * Whether a string ends with another needle.
- *
- * @param string $haystack The haystack
- * @param string $needle The needle.
- * @return mixed false if doesn't end with anything, the string
- * substr'ed if the string ends with the needle.
- */
- static function strEndsWith($haystack, $needle)
- {
- return substr($haystack, -strlen($needle)) == $needle;
- }
- // }}}
- // {{{ static function cli_arg_typ_loader
- /**
- * Argument type loader
- *
- * @param string $arg Either 'auto', 'optional' or an filename that
- * contains class PHP_Archive
- * @param string $cfg Configuration to pass to a new file
- * @param string $key The key
- * @return string $arg The argument.
- */
- static function cli_arg_typ_loader($arg, $cfg, $key)
- {
- if (($arg == '0' || $arg == '1') && !file_exists($arg) && substr(PHP_OS, 0, 3) != 'WIN') {
- $found = NULL;
- $apiver = false;
- $path = explode(PATH_SEPARATOR, $_ENV['PATH']);
- $pear = false;
- foreach ($path as $component) {
- if (file_exists($component . DIRECTORY_SEPARATOR . 'pear')
- && is_executable($component . DIRECTORY_SEPARATOR . 'pear')) {
- $pear = true;
- break;
- }
- }
- if ($pear) {
- $apiver = `pear -q info PHP_Archive 2>/dev/null|grep 'API Version'`;
- $apiver = trim(substr($apiver, strlen('API Version')));
- }
- if ($apiver) {
- self::notice("PEAR package PHP_Archive: API Version: $apiver.\n");
- $files = explode("\n", `pear list-files PHP_Archive`);
- $phpdir = `pear config-get php_dir 2>/dev/null`;
- $phpdir = trim($phpdir);
- self::notice("PEAR package PHP_Archive: $phpdir.\n");
- if (is_dir($phpdir)) {
- foreach($files as $ent) {
- $matches = NULL;
- if (preg_match(",^php[ \t]+([^ \t].*[\\\\/]PHP[\\\\/]Archive\.php)$,", $ent, $matches)) {
- $sub = $matches[1];
- if (strpos($sub, $phpdir) !== 0) {
- $found = NULL;
- break;
- }
- $found = $sub;
- break;
- }
- }
- } else {
- self::notice("PEAR package PHP_Archive: corrupt or inaccessible base dir: $php_dir.\n");
- }
- }
- if (isset($found)) {
- self::notice("PEAR package PHP_Archive: $found.\n");
- } else {
- $msg = "PEAR package PHP_Archive not installed: generated phar will require PHP's phar extension be enabled.\n";
- if ($arg == '0') {
- self::notice($msg);
- } else {
- self::error($msg);
- }
- }
- $arg = $found;
- }
- return self::cli_arg_typ_file($arg);
- }
- // }}}
- // {{{ static function cli_arg_typ_pharnew
- /**
- * Argument type new phar
- *
- * @param string $arg The new phar component.
- * @param string $cfg Configuration to pass to a new file
- * @param string $key The key
- * @return string $arg The new argument file.
- */
- static function cli_arg_typ_pharnew($arg, $cfg, $key)
- {
- $arg = self::cli_arg_typ_filenew($arg, $cfg, $key);
- if (!Phar::isValidPharFilename($arg)) {
- self::error("Phar files must have file extension '.phar', '.phar.php', '.phar.bz2' or '.phar.gz'.\n");
- }
- return $arg;
- }
- // }}}
- // {{{ static function cli_arg_typ_pharfile
- /**
- * Argument type existing Phar file
- *
- * Return filename of an existing Phar.
- *
- * @param string $arg The file in the phar to open.
- * @param string $cfg The configuration information
- * @param string $key The key information.
- * @return string $pharfile The name of the loaded Phar file.
- * @note The Phar will be loaded
- */
- static function cli_arg_typ_pharfile($arg, $cfg, $key)
- {
- try {
- $pharfile = self::cli_arg_typ_file($arg, $cfg, $key);
-
- if (!Phar::loadPhar($pharfile)) {
- self::error("Unable to open phar '$arg'\n");
- }
-
- return $pharfile;
- } catch(Exception $e) {
- self::error("Exception while opening phar '$arg':\n" . $e->getMessage() . "\n");
- }
- }
- // }}}
- // {{{ static function cli_arg_typ_pharurl
- /**
- * Argument type Phar url-like
- *
- * Check the argument as cli_arg_Typ_phar and return its name prefixed
- * with phar://
- *
- * Ex:
- * <code>
- * $arg = 'pharchive.phar/file.php';
- * cli_arg_typ_pharurl($arg)
- * </code>
- *
- * @param string $arg The url-like phar archive to retrieve.
- * @return string The phar file-archive.
- */
- static function cli_arg_typ_pharurl($arg, $cfg, $key)
- {
- return 'phar://' . self::cli_arg_typ_pharfile($arg, $cfg, $key);
- }
- // }}}
- // {{{ static function cli_arg_typ_phar
- /**
- * Cli argument type phar
- *
- * @param string $arg The phar archive to use.
- * @return object new Phar of the passed argument.
- */
- static function cli_arg_typ_phar($arg, $cfg, $key)
- {
- try {
- return new Phar(self::cli_arg_typ_pharfile($arg, $cfg, $key));
- } catch(Exception $e) {
- self::error("Exception while opening phar '$argv':\n" . $e->getMessage() . "\n");
- }
- }
- // }}}
- // {{{ static function cli_arg_typ_entry
- /**
- * Argument type Entry name
- *
- * @param string $arg The argument (the entry)
- * @return string $arg The entry itself.
- */
- static function cli_arg_typ_entry($arg, $cfg, $key)
- {
- // no further check atm, maybe check for no '/' at beginning
- return $arg;
- }
- // }}}
- // {{{ static function cli_arg_typ_compalg
- /**
- * Argument type compression algorithm
- *
- * @param string $arg The phar selection
- * @param string $cfg The config option.
- * @param string $key The key information.
- * @return string $arg The selected algorithm
- */
- static function cli_arg_typ_compalg($arg, $cfg, $key)
- {
- $arg = self::cli_arg_typ_select($arg, $cfg, $key);
-
- switch($arg) {
- case 'auto':
- if (extension_loaded('zlib')) {
- $arg = 'gz';
- } elseif (extension_loaded('bz2')) {
- $arg = 'bz2';
- } else {
- $arg = '0';
- }
- break;
- }
- return $arg;
- }
- // }}}
- // {{{ static function cli_arg_typ_privkey
- /**
- * Argument type private key (for OpenSSL signing)
- *
- * @param string $arg The phar selection
- * @param string $cfg The config option.
- * @param string $key The key information.
- * @return string $arg The private key.
- */
- static function cli_arg_typ_privkey($arg, $cfg, $key)
- {
- $arg = self::cli_arg_typ_filecont($arg, $cfg, $key);
-
- $hash_avail = Phar::getSupportedSignatures();
- if ($arg && !in_array('OpenSSL', $hash_avail))
- {
- self::error("Cannot specify private key without OpenSSL support.\n");
- }
- return $arg;
- }
- // }}}
- // {{{ static function phar_check_hash
- /**
- * Check whether hash method is valid.
- *
- * @return Hash constant to be used.
- */
- function phar_check_hash($hash, $privkey)
- {
- switch($hash) {
- case 'md5':
- return Phar::MD5;
- case 'sha1':
- return Phar::SHA1;
- case 'sha256':
- return Phar::SHA256;
- case 'sha512':
- return Phar::SHA512;
- case 'openssl':
- if (!$privkey) {
- self::error("Cannot use OpenSSL signing without key.\n");
- }
- return Phar::OPENSSL;
- }
- }
- // }}}
- // {{{ static function cli_cmd_inf_pack
- /**
- * Information pack
- *
- * @return string A description about packing files into a Phar archive.
- */
- static function cli_cmd_inf_pack()
- {
- return "Pack files into a PHAR archive.\n" .
- "When using -s <stub>, then the stub file is being " .
- "excluded from the list of input files/dirs." .
- "To create an archive that contains PEAR class PHP_Archive " .
- "then point -p argument to PHP/Archive.php.\n";
- }
- // }}}
- // {{{ static function cli_cmd_arg_pack
- /**
- * Pack a new phar infos
- *
- * @return array $args The arguments for a new Phar archive.
- */
- static function cli_cmd_arg_pack()
- {
- $args = self::phar_args('abcFhilpsxy', 'pharnew');
-
- $args[''] = array(
- 'typ' => 'any',
- 'val' => NULL,
- 'required' => 1,
- 'inf' => ' Any number of input files and directories. If -i is in use then ONLY files and matching the given regular expression are being packed. If -x is given then files matching that regular expression are NOT being packed.',
- );
-
- return $args;
- }
- // }}}
- // {{{ function phar_set_stub_begin
- /**
- * Set the stub
- */
- public function phar_set_stub_begin(Phar $phar, $stub, $loader = NULL, $hashbang = NULL)
- {
- if (isset($stub)) {
- $c = file_get_contents($stub);
-
- if (substr($c, 0, 2) == '#!') {
- if (strpos($c, "\n") !== false) {
- if (!isset($hashbang)) {
- $hashbang = substr($c, 0, strpos($c, "\n") + 1);
- }
- $c = substr($c, strpos($c, "\n") + 1);
- } else {
- if (!isset($hashbang)) {
- $hashbang = $c;
- }
- $c = NULL;
- }
- }
-
- if (isset($hashbang)) {
- if (substr($hashbang, 0, 2) != '#!') {
- $hashbang = '#!' . $hashbang;
- }
- if (substr($hashbang, -1) != "\n") {
- $hashbang .= "\n";
- }
- } else {
- $hashbang = "";
- }
-
- if (isset($loader)) {
- $s = "<?php if (!class_exists('PHP_Archive')) {\n?>";
- if (is_file($loader)) {
- $s .= file_get_contents($loader);
- }
- $s .= "<?php\n";
- $s .= "}\n";
- $s .= "if (!in_array('phar', stream_get_wrappers())) {\n";
- $s .= "\tstream_wrapper_register('phar', 'PHP_Archive');\n";
- $s .= "}\n";
- $s .= "if (!class_exists('Phar',0)) {\n";
- $s .= "\tinclude 'phar://'.__FILE__.'/phar.inc';\n";
- $s .= "}\n";
- $s .= '?>';
- $s .= $c;
-
- $phar->setStub($hashbang . $s);
- } else {
- $phar->setStub($hashbang . $c);
- }
- return new SplFileInfo($stub);
- }
- return NULL;
- }
- // }}}
- // {{{ function phar_set_stub_end
- /**
- * Set stub end
- */
- public function phar_set_stub_end(Phar $phar, $stub, $loader = NULL)
- {
- if (isset($stub) && isset($loader)) {
- if (substr(__FILE__, -15) == 'pharcommand.inc') {
- self::phar_add_file($phar, 0, 'phar.inc', 'phar://'.__FILE__.'/phar.inc', NULL);
- } else {
- self::phar_add_file($phar, 0, 'phar.inc', dirname(__FILE__).'/phar/phar.inc', NULL);
- }
- }
- }
- // }}}
- // {{{ function cli_cmd_run_pack
- /**
- * Pack a new Phar
- *
- * This function will try to pack a new Phar archive.
- *
- * @see Exit to make sure that we are done.
- */
- public function cli_cmd_run_pack()
- {
- if (ini_get('phar.readonly')) {
- self::error("Creating phar files is disabled by ini setting 'phar.readonly'.\n");
- }
-
- if (!Phar::canWrite()) {
- self::error("Creating phar files is disabled, Phar::canWrite() returned false.\n");
- }
-
- $alias = $this->args['a']['val'];
- $hashbang = $this->args['b']['val'];
- $archive = $this->args['f']['val'];
- $hash = $this->args['h']['val'];
- $privkey = $this->args['y']['val'] ?? null;
- $regex = $this->args['i']['val'];
- $level = $this->args['l']['val'];
- $loader = $this->args['p']['val'];
- $stub = $this->args['s']['val'];
- $invregex = $this->args['x']['val'];
- $input = $this->args['']['val'];
-
- $hash = self::phar_check_hash($hash, $privkey);
-
- $phar = new Phar($archive, 0, $alias);
-
- $phar->startBuffering();
-
- $stub = $this->phar_set_stub_begin($phar, $stub, $loader, $hashbang);
-
- if (!is_array($input)) {
- $this->phar_add($phar, $level, $input, $regex, $invregex, $stub, NULL, isset($loader));
- } else {
- foreach($input as $i) {
- $this->phar_add($phar, $level, $i, $regex, $invregex, $stub, NULL, isset($loader));
- }
- }
-
- $this->phar_set_stub_end($phar, $stub, $loader);
-
- switch($this->args['c']['val']) {
- case 'gz':
- case 'gzip':
- $phar->compressFiles(Phar::GZ);
- break;
- case 'bz2':
- case 'bzip2':
- $phar->compressFiles(Phar::BZ2);
- break;
- default:
- $phar->decompressFiles();
- break;
- }
-
- if ($hash) {
- $phar->setSignatureAlgorithm($hash, $privkey);
- }
-
- $phar->stopBuffering();
- exit(0);
- }
- // }}}
- // {{{ static function phar_add
- /**
- * Add files to a phar archive.
- *
- * This function will take a directory and iterate through
- * it and get the files to insert into the Phar archive.
- *
- * @param Phar $phar The phar object.
- * @param string $input The input directory
- * @param string $regex The regex used in RegexIterator.
- * @param string $invregex The InvertedRegexIterator expression.
- * @param SplFileInfo $stub Stub file object
- * @param mixed $compress Compression algorithm or NULL
- * @param boolean $noloader Whether to prevent adding the loader
- */
- static function phar_add(Phar $phar, $level, $input, $regex, $invregex, SplFileInfo $stub = NULL, $compress = NULL, $noloader = false)
- {
- if ($input && is_file($input) && !is_dir($input)) {
- return self::phar_add_file($phar, $level, $input, $input, $compress);
- }
- $dir = new RecursiveDirectoryIterator($input);
- $dir = new RecursiveIteratorIterator($dir);
-
- if (isset($regex)) {
- $dir = new RegexIterator($dir, $regex);
- }
-
- if (isset($invregex)) {
- $dir = new InvertedRegexIterator($dir, $invregex);
- }
-
- try {
- foreach($dir as $file) {
- if ((empty($stub) || $file->getRealPath() != $stub->getRealPath()) && !is_dir($file)) {
- self::phar_add_file($phar, $level, $dir->getSubPathName(), $file, $compress, $noloader);
- }
- }
- } catch(Exception $e) {
- self::error("Unable to complete operation on file '$file'\n" . $e->getMessage() . "\n");
- }
- }
- // }}}
- // {{{ static function phar_add_file
- /**
- * Add a phar file
- *
- * This function adds a file to a phar archive.
- *
- * @param Phar $phar The phar object
- * @param string $level The level of the file.
- * @param string $entry The entry point
- * @param string $file The file to add to the archive
- * @param string $compress The compression scheme for the file.
- * @param boolean $noloader Whether to prevent adding the loader
- */
- static function phar_add_file(Phar $phar, $level, $entry, $file, $compress, $noloader = false)
- {
- $entry = str_replace('//', '/', $entry);
- while($level-- > 0 && ($p = strpos($entry, '/')) !== false) {
- $entry = substr($entry, $p+1);
- }
-
- if ($noloader && $entry == 'phar.inc') {
- return;
- }
-
- echo "$entry\n";
-
- $phar[$entry] = file_get_contents($file);
- switch($compress) {
- case 'gz':
- case 'gzip':
- $phar[$entry]->compress(Phar::GZ);
- break;
- case 'bz2':
- case 'bzip2':
- $phar[$entry]->compress(Phar::BZ2);
- break;
- case '0':
- $phar[$entry]->decompress();
- break;
- default:
- break;
- }
- }
- // }}}
- // {{{ public function phar_dir_echo
- /**
- * Echo directory
- *
- * @param string $pn
- * @param unknown_type $f
- */
- public function phar_dir_echo($pn, $f)
- {
- echo "$f\n";
- }
- // }}}
- // {{{ public function phar_dir_operation
- /**
- * Directory operations
- *
- * Phar directory operations.
- *
- * @param RecursiveIteratorIterator $dir The recursiveIteratorIterator object.
- * @param string $func Function to call on the iterations
- * @param array $args Function arguments.
- */
- public function phar_dir_operation(RecursiveIteratorIterator $dir, $func, array $args = array())
- {
- $regex = $this->args['i']['val'];
- $invregex= $this->args['x']['val'];
-
- if (isset($regex)) {
- $dir = new RegexIterator($dir, $regex);
- }
-
- if (isset($invregex)) {
- $dir = new InvertedRegexIterator($dir, $invregex);
- }
-
- $any = false;
- foreach($dir as $pn => $f) {
- $any = true;
- call_user_func($func, $pn, $f, $args);
- }
- return $any;
- }
- // {{{ static function cli_cmd_inf_list
- /**
- * Cli Command Info List
- *
- * @return string What inf does
- */
- static function cli_cmd_inf_list()
- {
- return "List contents of a PHAR archive.";
- }
- // }}}
- // {{{ static function cli_cmd_arg_list
- /**
- * Cli Command Argument List
- *
- * @return arguments list
- */
- static function cli_cmd_arg_list()
- {
- return self::phar_args('Fix', 'pharurl');
- }
- // }}}
- // {{{ public function cli_cmd_run_list
- /**
- * Cli Command Run List
- *
- * @see $this->phar_dir_operation
- */
- public function cli_cmd_run_list()
- {
- $this->phar_dir_operation(
- new DirectoryTreeIterator(
- $this->args['f']['val']),
- array($this, 'phar_dir_echo')
- );
- }
- // }}}
- // {{{ static function cli_command_inf_tree
- /**
- * Cli Command Inf Tree
- *
- * @return string The description of a directory tree for a Phar archive.
- */
- static function cli_cmd_inf_tree()
- {
- return "Get a directory tree for a PHAR archive.";
- }
- // }}}
- // {{{ static function cli_cmd_arg_tree
- /**
- * Cli Command Argument Tree
- *
- * @return string Arguments in URL format.
- */
- static function cli_cmd_arg_tree()
- {
- return self::phar_args('Fix', 'pharurl');
- }
- // }}}
- // {{{ public function cli_cmd_run_tree
- /**
- * Cli Command Run Tree
- *
- * Set the phar_dir_operation with a directorygraphiterator.
- *
- * @see DirectoryGraphIterator
- * @see $this->phar_dir_operation
- *
- */
- public function cli_cmd_run_tree()
- {
- $a = $this->phar_dir_operation(
- new DirectoryGraphIterator(
- $this->args['f']['val']),
- array($this, 'phar_dir_echo')
- );
- if (!$a) {
- echo "|-<root directory>\n";
- }
- }
- // }}}
- // {{{ cli_cmd_inf_extract
- /**
- * Cli Command Inf Extract
- *
- * @return string The description of the command extra to a directory.
- */
- static function cli_cmd_inf_extract()
- {
- return "Extract a PHAR package to a directory.";
- }
- // }}}
- // {{{ static function cli_cmd_arg_extract
- /**
- * Cli Command Arguments Extract
- *
- * The arguments for the extract function.
- *
- * @return array The arguments for the extraction.
- */
- static function cli_cmd_arg_extract()
- {
- $args = self::phar_args('Fix', 'phar');
-
- $args[''] = array(
- 'type' => 'dir',
- 'val' => '.',
- 'inf' => ' Directory to extract to (defaults to \'.\').',
- );
-
- return $args;
- }
- // }}}
- // {{{ public function cli_cmd_run_extract
- /**
- * Run Extract
- *
- * Run the extraction of a phar Archive.
- *
- * @see $this->phar_dir_operation
- */
- public function cli_cmd_run_extract()
- {
- $dir = $this->args['']['val'];
-
- if (is_array($dir)) {
- if (count($dir) != 1) {
- self::error("Only one target directory allowed.\n");
- } else {
- $dir = $dir[0];
- }
- }
-
- $phar = $this->args['f']['val'];
- $base = $phar->getPathname();
- $bend = strpos($base, '.phar');
- $bend = strpos($base, '/', $bend);
- $base = substr($base, 0, $bend + 1);
- $blen = strlen($base);
-
- $this->phar_dir_operation(
- new RecursiveIteratorIterator($phar),
- array($this, 'phar_dir_extract'),
- array($blen, $dir)
- );
- }
- // }}}
- // {{{ public function phar_dir_extract
- /**
- * Extract to a directory
- *
- * This function will extract the content of a Phar
- * to a directory and create new files and directories
- * depending on the permissions on that folder.
- *
- * @param string $pn
- * @param string $f The file name
- * @param array $args The directory and Blen information
- */
- public function phar_dir_extract($pn, $f, $args)
- {
- $blen = $args[0];
- $dir = $args[1];
- $sub = substr($pn, $blen);
- $target = $dir . '/' . $sub;
-
- if (!file_exists(dirname($target))) {
- @mkdir(dirname($target), 0777, true);
- }
- if (!file_exists(dirname($target))) {
- self::error("Operation could not be completed\n");
- }
-
- echo "$sub";
-
- if (!@copy($f, $target)) {
- echo " ...error\n";
- } else {
- echo " ...ok\n";
- }
- }
- // }}}
- // {{{ static function cli_cmd_inf_delete
- /**
- * Delete an entry from a phar information.
- *
- * @return string The information
- */
- static function cli_cmd_inf_delete()
- {
- return 'Delete entry from a PHAR archive';
- }
- // }}}
- // {{{ static function cli_cmd_arg_delete
- /**
- * The cli command argument for deleting.
- *
- * @return array information about the arguments to use.
- */
- static function cli_cmd_arg_delete()
- {
- return self::phar_args('FE', 'phar');
- }
- // }}}
- // {{{ public function cli_cmd_run_delete
- /**
- * Deleting execution
- *
- * Execute the deleting of the file from the phar archive.
- */
- public function cli_cmd_run_delete()
- {
- $phar = $this->args['f']['val'];
- $entry = $this->args['e']['val'];
-
- $phar->startBuffering();
- unset($phar[$entry]);
- $phar->stopBuffering();
- }
- // }}}
- // {{{ static function cli_cmd_inf_add
- /**
- * Client comment add file information
- *
- * @return string The description of the feature
- */
- static function cli_cmd_inf_add()
- {
- return "Add entries to a PHAR package.";
- }
- // }}}
- // {{{ static function cli_cmd_arg_add
- /**
- * Add a file arguments
- */
- static function cli_cmd_arg_add()
- {
- $args = self::phar_args('acFilx', 'phar');
- $args[''] = array(
- 'type' => 'any',
- 'val' => NULL,
- 'required' => 1,
- 'inf' => ' Any number of input files and directories. If -i is in use then ONLY files and matching the given regular expression are being packed. If -x is given then files matching that regular expression are NOT being packed.',
- );
- return $args;
- }
- // }}}
- // {{{ public functio cli_cmd_run_add
- /**
- * Add a file
- *
- * Run the action of adding a file to
- * a phar archive.
- */
- public function cli_cmd_run_add()
- {
- $compress= $this->args['c']['val'];
- $phar = $this->args['f']['val'];
- $regex = $this->args['i']['val'];
- $level = $this->args['l']['val'];
- $invregex= $this->args['x']['val'];
- $input = $this->args['']['val'];
-
- $phar->startBuffering();
-
- if (!is_array($input)) {
- $this->phar_add($phar, $level, $input, $regex, $invregex, NULL, $compress);
- } else {
- foreach($input as $i) {
- $this->phar_add($phar, $level, $i, $regex, $invregex, NULL, $compress);
- }
- }
- $phar->stopBuffering();
- exit(0);
- }
- // }}}
- // {{{ public function cli_cmd_inf_stub_set
- /**
- * Set the stup of a phar file.
- *
- * @return string The stub set description.
- */
- public function cli_cmd_inf_stub_set()
- {
- return "Set the stub of a PHAR file. " .
- "If no input file is specified as stub then stdin is being used.";
- }
- // }}}
- // {{{ public function cli_cmd_arg_stub_set
- /**
- * Set the argument stub
- *
- * @return string arguments for a stub
- */
- public function cli_cmd_arg_stub_set()
- {
- $args = self::phar_args('bFps', 'phar');
- $args['s']['val'] = 'php://stdin';
- return $args;
- }
- // }}}
- // {{{ public function cli_cmd_run_stub_set
- /**
- * Cli Command run stub set
- *
- * @see $phar->setStub()
- */
- public function cli_cmd_run_stub_set()
- {
- $hashbang = $this->args['b']['val'];
- $phar = $this->args['f']['val'];
- $stub = $this->args['s']['val'];
- $loader = $this->args['p']['val'];
-
- $this->phar_set_stub_begin($phar, $stub, $loader, $hashbang);
- $this->phar_set_stub_end($phar, $stub, $loader);
- }
- // }}}
- // {{{ public function cli_cmd_inf_stub_get
- /**
- * Get the command stub infos.
- *
- * @return string a description of the stub of a Phar file.
- */
- public function cli_cmd_inf_stub_get()
- {
- return "Get the stub of a PHAR file. " .
- "If no output file is specified as stub then stdout is being used.";
- }
- // }}}
- // {{{ public function cli_cmd_arg_stub_get
- /**
- * Get the argument stub
- *
- * @return array $args The arguments passed to the stub.
- */
- public function cli_cmd_arg_stub_get()
- {
- $args = self::phar_args('Fs', 'phar');
- $args['s']['val'] = 'php://stdin';
- return $args;
- }
- // }}}
- // {{{ public function cli_cmd_run_stub_get
- /**
- * Cli Command Run Stub
- *
- * Get arguments and store them into a stub.
- *
- * @param arguments $args
- * @see $this->args
- */
- public function cli_cmd_run_stub_get($args)
- {
- $phar = $this->args['f']['val'];
- $stub = $this->args['s']['val'];
-
- file_put_contents($stub, $phar->getStub());
- }
- // }}}
- // {{{ public function cli_cmd_inf_compress
- /**
- * Cli Command Inf Compress
- *
- * Cli Command compress information
- *
- * @return string A description of the command.
- */
- public function cli_cmd_inf_compress()
- {
- return "Compress or uncompress all files or a selected entry.";
- }
- // }}}
- // {{{ public function cli_cmd_arg_cmpress
- /**
- * Cli Command Arg Compress
- *
- * @return array The arguments for compress
- */
- public function cli_cmd_arg_compress()
- {
- return self::phar_args('FCe', 'phar');
- }
- // }}}
- // {{{ public function cli_cmd_run_compress
- /**
- * Cli Command Run Compress
- *
- * @see $this->args
- */
- public function cli_cmd_run_compress()
- {
- $phar = $this->args['f']['val'];
- $entry = $this->args['e']['val'];
-
- switch($this->args['c']['val']) {
- case 'gz':
- case 'gzip':
- if (isset($entry)) {
- $phar[$entry]->compress(Phar::GZ);
- } else {
- $phar->compressFiles(Phar::GZ);
- }
- break;
- case 'bz2':
- case 'bzip2':
- if (isset($entry)) {
- $phar[$entry]->compress(Phar::BZ2);
- } else {
- $phar->compressFiles(Phar::BZ2);
- }
- break;
- default:
- if (isset($entry)) {
- $phar[$entry]->decompress();
- } else {
- $phar->decompressFiles();
- }
- break;
- }
- }
- // }}}
- // {{{ public function cli_cmd_inf_sign
- /**
- * Cli Command Info Signature
- *
- * @return string A description of the signature arguments.
- */
- public function cli_cmd_inf_sign()
- {
- return "Set signature hash algorithm.";
- }
- // }}}
- // {{{ public function cli_cmd_arg_sign
- /**
- * Cli Command Argument Sign
- *
- * @return array Arguments for Signature
- */
- public function cli_cmd_arg_sign()
- {
- return self::phar_args('FHy', 'phar');
- }
- // }}}
- // {{{ public function cli_cmd_run_sign
- /**
- * Cli Command Run Signature
- *
- * @see $phar->setSignaturealgorithm
- */
- public function cli_cmd_run_sign()
- {
- $phar = $this->args['f']['val'];
- $hash = $this->args['h']['val'];
- $privkey = $this->args['y']['val'];
-
- $hash = self::phar_check_hash($hash, $privkey);
-
- $phar->setSignatureAlgorithm($hash, $privkey);
- }
- // }}}
- // {{{ public function cli_cmd_inf_meta_set
- /**
- * Cli Command Inf Meta Set
- *
- * @return string A description
- */
- public function cli_cmd_inf_meta_set()
- {
- return "Set meta data of a PHAR entry or a PHAR package using serialized input. " .
- "If no input file is specified for meta data then stdin is being used." .
- "You can also specify a particular index using -k. In that case the metadata is " .
- "expected to be an array and the value of the given index is being set. If " .
- "the metadata is not present or empty a new array will be created. If the " .
- "metadata is present and a flat value then the return value is 1. Also using -k " .
- "the input is been taken directly rather then being serialized.";
- }
- // }}}
- // {{{ public function cli_cmd_arg_meta_set
- /**
- * Cli Command Argument Meta Set
- *
- * @return array The arguments for meta set
- */
- public function cli_cmd_arg_meta_set()
- {
- return self::phar_args('FekM', 'phar');
- }
- // }}}
- // {{{ public function cli_cmd_run_met_set
- /**
- * Cli Command Run Metaset
- *
- * @see $phar->startBuffering
- * @see $phar->setMetadata
- * @see $phar->stopBuffering
- */
- public function cli_cmd_run_meta_set()
- {
- $phar = $this->args['f']['val'];
- $entry = $this->args['e']['val'];
- $index = $this->args['k']['val'];
- $meta = $this->args['m']['val'];
-
- $phar->startBuffering();
-
- if (isset($index)) {
- if (isset($entry)) {
- if ($phar[$entry]->hasMetadata()) {
- $old = $phar[$entry]->getMetadata();
- } else {
- $old = array();
- }
- } else {
- if ($phar->hasMetadata()) {
- $old = $phar->getMetadata();
- } else {
- $old = array();
- }
- }
-
- if (!is_array($old)) {
- self::error('Metadata is a flat value while an index operation was issued.');
- }
-
- $old[$index] = $meta;
- $meta = $old;
- } else {
- $meta = unserialize($meta);
- }
-
- if (isset($entry)) {
- $phar[$entry]->setMetadata($meta);
- } else {
- $phar->setMetadata($meta);
- }
- $phar->stopBuffering();
- }
- // }}}
- // {{{ public function cli_cmd_inf_met_get
- /**
- * Cli Command Inf Metaget
- *
- * @return string A description of the metaget arguments
- */
- public function cli_cmd_inf_meta_get()
- {
- return "Get meta information of a PHAR entry or a PHAR package in serialized from. " .
- "If no output file is specified for meta data then stdout is being used.\n" .
- "You can also specify a particular index using -k. In that case the metadata is " .
- "expected to be an array and the value of the given index is returned using echo " .
- "rather than using serialize. If that index does not exist or no meta data is " .
- "present then the return value is 1.";
- }
- // }}}
- // {{{ public function cli_cmd_arg_meta_get
- /**
- * Cli Command arg metaget
- *
- * @return array The arguments for meta get.
- */
- public function cli_cmd_arg_meta_get()
- {
- return self::phar_args('Fek', 'phar');
- }
- // }}}
- // {{{ public function cli_cmd_run_meta_get
- /**
- * Cli Command Run Metaget
- *
- * @see $this->args
- * @see $phar[$x]->hasMetadata()
- * @see $phar->getMetadata()
- */
- public function cli_cmd_run_meta_get()
- {
- $phar = $this->args['f']['val'];
- $entry = $this->args['e']['val'];
- $index = $this->args['k']['val'];
-
- if (isset($entry)) {
- if (!$phar[$entry]->hasMetadata()) {
- echo "No Metadata\n";
- exit(1);
- }
- echo serialize($phar[$entry]->getMetadata());
- } else {
- if (!$phar->hasMetadata()) {
- echo "No Metadata\n";
- exit(1);
- }
- $meta = $phar->getMetadata();
- }
-
- if (isset($index)) {
- if (isset($index)) {
- if (isset($meta[$index])) {
- echo $meta[$index];
- exit(0);
- } else {
- echo "No Metadata\n";
- exit(1);
- }
- } else {
- echo serialize($meta);
- }
- }
- }
- // }}}
- // {{{ public function cli_cmd_inf_meta_del
- /**
- * Cli Command Inf Metadel
- *
- * @return string A description of the metadel function
- */
- public function cli_cmd_inf_meta_del()
- {
- return "Delete meta information of a PHAR entry or a PHAR package.\n" .
- "If -k is given then the metadata is expected to be an array " .
- "and the given index is being deleted.\n" .
- "If something was deleted the return value is 0 otherwise it is 1.";
- }
- // }}}
- // {{{ public function cli_cmd_arg_meta_del
- /**
- * CliC ommand Arg Metadelete
- *
- * @return array The arguments for metadel
- */
- public function cli_cmd_arg_meta_del()
- {
- return self::phar_args('Fek', 'phar');
- }
- // }}}
- // {{{ public function cli_cmd_run_meta_del
- /**
- * Cli Command Run MetaDel
- *
- * @see $phar[$x]->delMetadata()
- * @see $phar->delMetadata()
- */
- public function cli_cmd_run_meta_del()
- {
- $phar = $this->args['f']['val'];
- $entry = $this->args['e']['val'];
- $index = $this->args['k']['val'];
-
- if (isset($entry)) {
- if (isset($index)) {
- if (!$phar[$entry]->hasMetadata()) {
- exit(1);
- }
- $meta = $phar[$entry]->getMetadata();
-
- // @todo add error message here.
- if (!is_array($meta)) {
- exit(1);
- }
-
- unset($meta[$index]);
- $phar[$entry]->setMetadata($meta);
- } else {
- exit($phar[$entry]->delMetadata() ? 0 : 1);
- }
- } else {
- if (isset($index)) {
- if (!$phar->hasMetadata()) {
- exit(1);
- }
-
- $meta = $phar->getMetadata();
-
- // @todo Add error message
- if (!is_array($meta)) {
- exit(1);
- }
-
- unset($meta[$index]);
- $phar->setMetadata($meta);
- } else {
- exit($phar->delMetadata() ? 0 : 1);
- }
- }
- }
- // }}}
- // {{{ public function cli_cmd_inf_info
- /**
- * CLi Command Inf Info
- *
- * @return string A description about the info commands.
- */
- public function cli_cmd_inf_info()
- {
- return "Get information about a PHAR package.\n" .
- "By using -k it is possible to return a single value.";
- }
- // }}}
- // {{{ public function cli_cmd_arg_info
- /**
- * Cli Command Arg Infos
- *
- * @return array The arguments for info command.
- */
- public function cli_cmd_arg_info()
- {
- return self::phar_args('Fk', 'phar');
- }
- // }}}
- // {{{ public function cli_cmd_run_info
- /**
- * Cli Command Run Info
- *
- * @param args $args
- */
- public function cli_cmd_run_info()
- {
- $phar = $this->args['f']['val'];
- $index = $this->args['k']['val'];
-
- $hash = $phar->getSignature();
- $infos = array();
-
- if ($phar->getAlias()) {
- $infos['Alias'] = $phar->getAlias();
- }
-
- if (!$hash) {
- $infos['Hash-type'] = 'NONE';
- } else {
- $infos['Hash-type'] = $hash['hash_type'];
- $infos['Hash'] = $hash['hash'];
- }
-
- $csize = 0;
- $usize = 0;
- $count = 0;
- $ccount = 0;
- $ucount = 0;
- $mcount = 0;
- $compalg = array('GZ'=>0, 'BZ2'=>0);
-
- foreach(new RecursiveIteratorIterator($phar) as $ent) {
- $count++;
- if ($ent->isCompressed()) {
- $ccount++;
- $csize += $ent->getCompressedSize();
- if ($ent->isCompressed(Phar::GZ)) {
- $compalg['GZ']++;
- } elseif ($ent->isCompressed(Phar::BZ2)) {
- $compalg['BZ2']++;
- }
- } else {
- $ucount++;
- $csize += $ent->getSize();
- }
-
- $usize += $ent->getSize();
-
- if ($ent->hasMetadata()) {
- $mcount++;
- }
- }
-
- $infos['Entries'] = $count;
- $infos['Uncompressed-files'] = $ucount;
- $infos['Compressed-files'] = $ccount;
- $infos['Compressed-gz'] = $compalg['GZ'];
- $infos['Compressed-bz2'] = $compalg['BZ2'];
- $infos['Uncompressed-size'] = $usize;
- $infos['Compressed-size'] = $csize;
- $infos['Compression-ratio'] = sprintf('%.3g%%', $usize ? ($csize * 100) / $usize : 100);
- $infos['Metadata-global'] = $phar->hasMetadata() * 1;
- $infos['Metadata-files'] = $mcount;
- $infos['Stub-size'] = strlen($phar->getStub());
-
- if (isset($index)) {
- if (!isset($infos[$index])) {
- self::error("Requested value does not exist.\n");
- }
-
- echo $infos[$index];
- exit(0);
- }
-
- $l = 0;
- foreach($infos as $which => $val) {
- $l = max(strlen($which), $l);
- }
-
- foreach($infos as $which => $val) {
- echo $which . ':' . str_repeat(' ', $l + 1 - strlen($which)) . $val . "\n";
- }
- }
- // }}}
- // {{{ public function cli_cmd_inf_version
- /**
- * CLi Command Inf Version
- *
- * @return string A description about the info commands.
- */
- public function cli_cmd_inf_version()
- {
- return "Get information about the PHAR environment and the tool version.";
- }
- // }}}
- // {{{ public function cli_cmd_arg_version
- /**
- * Cli Command Arg Version
- *
- * @return array The arguments for version command.
- */
- public function cli_cmd_arg_version()
- {
- return self::phar_args('', NULL);
- }
- // }}}
- // {{{ public function cli_cmd_run_info
- /**
- * Cli Command Run Info
- *
- * @param args $args
- */
- public function cli_cmd_run_version()
- {
- $use_ext = extension_loaded('phar');
- $version = array(
- 'PHP Version' => phpversion(),
- 'phar.phar version' => '$Id$',
- 'Phar EXT version' => $use_ext ? phpversion('phar') : 'Not available',
- 'Phar API version' => Phar::apiVersion(),
- 'Phar-based phar archives' => true,
- 'Tar-based phar archives' => $use_ext,
- 'ZIP-based phar archives' => $use_ext,
- 'gzip compression' => extension_loaded('zlib'),
- 'bzip2 compression' => extension_loaded('bz2'),
- 'supported signatures' => $use_ext ? join(', ', Phar::getSupportedSignatures()) : '',
- );
- $klen = 0;
- foreach($version as $k => $v)
- {
- $klen = max($klen, strlen($k));
- }
- ++$klen;
- foreach($version as $k => $v) {
- if (is_bool($v)) {
- $v = $v ? 'enabled' : 'disabled';
- }
- printf("%-${klen}s %s\n", $k.':', $v);
- }
- }
- // }}}
+ // {{{ public function cli_get_SP2
+ public function cli_get_SP2($l1, $arg_inf)
+ {
+ return str_repeat(' ', $l1 + 2 + 4 + 9);
+ }
+ // }}}
+ // {{{ public function cli_get_SP3
+ /**
+ * Cli Get SP3
+ *
+ * @param string $l1 Eleven
+ * @param string $l2 Twelve
+ * @param string $arg_inf
+ * @return string The repeated string.
+ */
+ function cli_get_SP3($l1, $l2, $arg_inf)
+ {
+ return str_repeat(' ', $l1 + 2 + 4 + 9 + 2 + $l2 + 2);
+ }
+ // }}}
+ // {{{ static function phar_args
+ /**
+ * Phar arguments
+ *
+ * This function contains all the phar commands
+ *
+ * @param string $which Which argument is chosen.
+ * @param string $phartype The type of phar, specific file to work on
+ * @return unknown
+ */
+ static function phar_args($which, $phartype)
+ {
+ $phar_args = array(
+ 'a' => array(
+ 'typ' => 'alias',
+ 'val' => NULL,
+ 'inf' => '<alias> Provide an alias name for the phar file.'
+ ),
+ 'b' => array(
+ 'typ' => 'any',
+ 'val' => NULL,
+ 'inf' => '<bang> Hash-bang line to start the archive (e.g. #!/usr/bin/php). The hash '
+ .' mark itself \'#!\' and the newline character are optional.'
+ ),
+ 'c' => array(
+ 'typ' => 'compalg',
+ 'val' => NULL,
+ 'inf' => '<algo> Compression algorithm.',
+ 'select' => array(
+ '0' => 'No compression',
+ 'none' => 'No compression',
+ 'auto' => 'Automatically select compression algorithm'
+ )
+ ),
+ 'e' => array(
+ 'typ' => 'entry',
+ 'val' => NULL,
+ 'inf' => '<entry> Name of entry to work on (must include PHAR internal directory name if any).'
+ ),
+ 'f' => array(
+ 'typ' => $phartype,
+ 'val' => NULL,
+ 'inf' => '<file> Specifies the phar file to work on.'
+ ),
+ 'h' => array(
+ 'typ' => 'select',
+ 'val' => NULL,
+ 'inf' => '<method> Selects the hash algorithm.',
+ 'select' => array('md5' => 'MD5','sha1' => 'SHA1')
+ ),
+ 'i' => array(
+ 'typ' => 'regex',
+ 'val' => NULL,
+ 'inf' => '<regex> Specifies a regular expression for input files.'
+ ),
+ 'k' => array(
+ 'typ' => 'any',
+ 'val' => NULL,
+ 'inf' => '<index> Subscription index to work on.',
+ ),
+ 'l' => array(
+ 'typ' => 'int',
+ 'val' => 0,
+ 'inf' => '<level> Number of preceding subdirectories to strip from file entries',
+ ),
+ 'm' => array(
+ 'typ' => 'any',
+ 'val' => NULL,
+ 'inf' => '<meta> Meta data to store with entry (serialized php data).'
+ ),
+ 'p' => array(
+ 'typ' => 'loader',
+ 'val' => NULL,
+ 'inf' => '<loader> Location of PHP_Archive class file (pear list-files PHP_Archive).'
+ .'You can use \'0\' or \'1\' to locate it automatically using the mentioned '
+ .'pear command. When using \'0\' the command does not error out when the '
+ .'class file cannot be located. This switch also adds some code around the '
+ .'stub so that class PHP_Archive gets registered as phar:// stream wrapper '
+ .'if necessary. And finally this switch will add the file phar.inc from '
+ .'this package and load it to ensure class Phar is present.'
+ ,
+ ),
+ 's' => array(
+ 'typ' => 'file',
+ 'val' => NULL,
+ 'inf' => '<stub> Select the stub file.'
+ ),
+ 'x' => array(
+ 'typ' => 'regex',
+ 'val' => NULL,
+ 'inf' => '<regex> Regular expression for input files to exclude.'
+ ),
+ 'y' => array(
+ 'typ' => 'privkey',
+ 'val' => NULL,
+ 'inf' => '<key> Private key for OpenSSL signing.',
+ ),
+ );
+
+ if (extension_loaded('zlib')) {
+ $phar_args['c']['select']['gz'] = 'GZip compression';
+ $phar_args['c']['select']['gzip'] = 'GZip compression';
+ }
+
+ if (extension_loaded('bz2')) {
+ $phar_args['c']['select']['bz2'] = 'BZip2 compression';
+ $phar_args['c']['select']['bzip2'] = 'BZip2 compression';
+ }
+
+ $hash_avail = Phar::getSupportedSignatures();
+ $hash_optional = array('SHA-256' => 'SHA256',
+ 'SHA-512' => 'SHA512',
+ 'OpenSSL' => 'OpenSSL');
+ if (!in_array('OpenSSL', $hash_avail)) {
+ unset($phar_args['y']);
+ }
+
+ foreach($hash_optional as $key => $name) {
+ if (in_array($key, $hash_avail)) {
+ $phar_args['h']['select'][strtolower($name)] = $name;
+ }
+ }
+
+ $args = array();
+
+ foreach($phar_args as $lkey => $cfg) {
+ $ukey = strtoupper($lkey);
+ $required = strpos($which, $ukey) !== false;
+ $optional = strpos($which, $lkey) !== false;
+
+ if ($required || $optional) {
+ $args[$lkey] = $cfg;
+ $args[$lkey]['required'] = $required;
+ }
+ }
+ return $args;
+ }
+ // }}}
+ // {{{ static function strEndsWith
+ /**
+ * String Ends With
+ *
+ * Whether a string ends with another needle.
+ *
+ * @param string $haystack The haystack
+ * @param string $needle The needle.
+ * @return mixed false if doesn't end with anything, the string
+ * substr'ed if the string ends with the needle.
+ */
+ static function strEndsWith($haystack, $needle)
+ {
+ return substr($haystack, -strlen($needle)) == $needle;
+ }
+ // }}}
+ // {{{ static function cli_arg_typ_loader
+ /**
+ * Argument type loader
+ *
+ * @param string $arg Either 'auto', 'optional' or an filename that
+ * contains class PHP_Archive
+ * @param string $cfg Configuration to pass to a new file
+ * @param string $key The key
+ * @return string $arg The argument.
+ */
+ static function cli_arg_typ_loader($arg, $cfg, $key)
+ {
+ if (($arg == '0' || $arg == '1') && !file_exists($arg) && substr(PHP_OS, 0, 3) != 'WIN') {
+ $found = NULL;
+ $apiver = false;
+ $path = explode(PATH_SEPARATOR, $_ENV['PATH']);
+ $pear = false;
+ foreach ($path as $component) {
+ if (file_exists($component . DIRECTORY_SEPARATOR . 'pear')
+ && is_executable($component . DIRECTORY_SEPARATOR . 'pear')) {
+ $pear = true;
+ break;
+ }
+ }
+ if ($pear) {
+ $apiver = `pear -q info PHP_Archive 2>/dev/null|grep 'API Version'`;
+ $apiver = trim(substr($apiver, strlen('API Version')));
+ }
+ if ($apiver) {
+ self::notice("PEAR package PHP_Archive: API Version: $apiver.\n");
+ $files = explode("\n", `pear list-files PHP_Archive`);
+ $phpdir = `pear config-get php_dir 2>/dev/null`;
+ $phpdir = trim($phpdir);
+ self::notice("PEAR package PHP_Archive: $phpdir.\n");
+ if (is_dir($phpdir)) {
+ foreach($files as $ent) {
+ $matches = NULL;
+ if (preg_match(",^php[ \t]+([^ \t].*[\\\\/]PHP[\\\\/]Archive\.php)$,", $ent, $matches)) {
+ $sub = $matches[1];
+ if (strpos($sub, $phpdir) !== 0) {
+ $found = NULL;
+ break;
+ }
+ $found = $sub;
+ break;
+ }
+ }
+ } else {
+ self::notice("PEAR package PHP_Archive: corrupt or inaccessible base dir: $php_dir.\n");
+ }
+ }
+ if (isset($found)) {
+ self::notice("PEAR package PHP_Archive: $found.\n");
+ } else {
+ $msg = "PEAR package PHP_Archive not installed: generated phar will require PHP's phar extension be enabled.\n";
+ if ($arg == '0') {
+ self::notice($msg);
+ } else {
+ self::error($msg);
+ }
+ }
+ $arg = $found;
+ }
+ return self::cli_arg_typ_file($arg);
+ }
+ // }}}
+ // {{{ static function cli_arg_typ_pharnew
+ /**
+ * Argument type new phar
+ *
+ * @param string $arg The new phar component.
+ * @param string $cfg Configuration to pass to a new file
+ * @param string $key The key
+ * @return string $arg The new argument file.
+ */
+ static function cli_arg_typ_pharnew($arg, $cfg, $key)
+ {
+ $arg = self::cli_arg_typ_filenew($arg, $cfg, $key);
+ if (!Phar::isValidPharFilename($arg)) {
+ self::error("Phar files must have file extension '.phar', '.phar.php', '.phar.bz2' or '.phar.gz'.\n");
+ }
+ return $arg;
+ }
+ // }}}
+ // {{{ static function cli_arg_typ_pharfile
+ /**
+ * Argument type existing Phar file
+ *
+ * Return filename of an existing Phar.
+ *
+ * @param string $arg The file in the phar to open.
+ * @param string $cfg The configuration information
+ * @param string $key The key information.
+ * @return string $pharfile The name of the loaded Phar file.
+ * @note The Phar will be loaded
+ */
+ static function cli_arg_typ_pharfile($arg, $cfg, $key)
+ {
+ try {
+ $pharfile = self::cli_arg_typ_file($arg, $cfg, $key);
+
+ if (!Phar::loadPhar($pharfile)) {
+ self::error("Unable to open phar '$arg'\n");
+ }
+
+ return $pharfile;
+ } catch(Exception $e) {
+ self::error("Exception while opening phar '$arg':\n" . $e->getMessage() . "\n");
+ }
+ }
+ // }}}
+ // {{{ static function cli_arg_typ_pharurl
+ /**
+ * Argument type Phar url-like
+ *
+ * Check the argument as cli_arg_Typ_phar and return its name prefixed
+ * with phar://
+ *
+ * Ex:
+ * <code>
+ * $arg = 'pharchive.phar/file.php';
+ * cli_arg_typ_pharurl($arg)
+ * </code>
+ *
+ * @param string $arg The url-like phar archive to retrieve.
+ * @return string The phar file-archive.
+ */
+ static function cli_arg_typ_pharurl($arg, $cfg, $key)
+ {
+ return 'phar://' . self::cli_arg_typ_pharfile($arg, $cfg, $key);
+ }
+ // }}}
+ // {{{ static function cli_arg_typ_phar
+ /**
+ * Cli argument type phar
+ *
+ * @param string $arg The phar archive to use.
+ * @return object new Phar of the passed argument.
+ */
+ static function cli_arg_typ_phar($arg, $cfg, $key)
+ {
+ try {
+ return new Phar(self::cli_arg_typ_pharfile($arg, $cfg, $key));
+ } catch(Exception $e) {
+ self::error("Exception while opening phar '$argv':\n" . $e->getMessage() . "\n");
+ }
+ }
+ // }}}
+ // {{{ static function cli_arg_typ_entry
+ /**
+ * Argument type Entry name
+ *
+ * @param string $arg The argument (the entry)
+ * @return string $arg The entry itself.
+ */
+ static function cli_arg_typ_entry($arg, $cfg, $key)
+ {
+ // no further check atm, maybe check for no '/' at beginning
+ return $arg;
+ }
+ // }}}
+ // {{{ static function cli_arg_typ_compalg
+ /**
+ * Argument type compression algorithm
+ *
+ * @param string $arg The phar selection
+ * @param string $cfg The config option.
+ * @param string $key The key information.
+ * @return string $arg The selected algorithm
+ */
+ static function cli_arg_typ_compalg($arg, $cfg, $key)
+ {
+ $arg = self::cli_arg_typ_select($arg, $cfg, $key);
+
+ switch($arg) {
+ case 'auto':
+ if (extension_loaded('zlib')) {
+ $arg = 'gz';
+ } elseif (extension_loaded('bz2')) {
+ $arg = 'bz2';
+ } else {
+ $arg = '0';
+ }
+ break;
+ }
+ return $arg;
+ }
+ // }}}
+ // {{{ static function cli_arg_typ_privkey
+ /**
+ * Argument type private key (for OpenSSL signing)
+ *
+ * @param string $arg The phar selection
+ * @param string $cfg The config option.
+ * @param string $key The key information.
+ * @return string $arg The private key.
+ */
+ static function cli_arg_typ_privkey($arg, $cfg, $key)
+ {
+ $arg = self::cli_arg_typ_filecont($arg, $cfg, $key);
+
+ $hash_avail = Phar::getSupportedSignatures();
+ if ($arg && !in_array('OpenSSL', $hash_avail))
+ {
+ self::error("Cannot specify private key without OpenSSL support.\n");
+ }
+ return $arg;
+ }
+ // }}}
+ // {{{ static function phar_check_hash
+ /**
+ * Check whether hash method is valid.
+ *
+ * @return Hash constant to be used.
+ */
+ function phar_check_hash($hash, $privkey)
+ {
+ switch($hash) {
+ case 'md5':
+ return Phar::MD5;
+ case 'sha1':
+ return Phar::SHA1;
+ case 'sha256':
+ return Phar::SHA256;
+ case 'sha512':
+ return Phar::SHA512;
+ case 'openssl':
+ if (!$privkey) {
+ self::error("Cannot use OpenSSL signing without key.\n");
+ }
+ return Phar::OPENSSL;
+ }
+ }
+ // }}}
+ // {{{ static function cli_cmd_inf_pack
+ /**
+ * Information pack
+ *
+ * @return string A description about packing files into a Phar archive.
+ */
+ static function cli_cmd_inf_pack()
+ {
+ return "Pack files into a PHAR archive.\n" .
+ "When using -s <stub>, then the stub file is being " .
+ "excluded from the list of input files/dirs." .
+ "To create an archive that contains PEAR class PHP_Archive " .
+ "then point -p argument to PHP/Archive.php.\n";
+ }
+ // }}}
+ // {{{ static function cli_cmd_arg_pack
+ /**
+ * Pack a new phar infos
+ *
+ * @return array $args The arguments for a new Phar archive.
+ */
+ static function cli_cmd_arg_pack()
+ {
+ $args = self::phar_args('abcFhilpsxy', 'pharnew');
+
+ $args[''] = array(
+ 'typ' => 'any',
+ 'val' => NULL,
+ 'required' => 1,
+ 'inf' => ' Any number of input files and directories. If -i is in use then ONLY files and matching the given regular expression are being packed. If -x is given then files matching that regular expression are NOT being packed.',
+ );
+
+ return $args;
+ }
+ // }}}
+ // {{{ function phar_set_stub_begin
+ /**
+ * Set the stub
+ */
+ public function phar_set_stub_begin(Phar $phar, $stub, $loader = NULL, $hashbang = NULL)
+ {
+ if (isset($stub)) {
+ $c = file_get_contents($stub);
+
+ if (substr($c, 0, 2) == '#!') {
+ if (strpos($c, "\n") !== false) {
+ if (!isset($hashbang)) {
+ $hashbang = substr($c, 0, strpos($c, "\n") + 1);
+ }
+ $c = substr($c, strpos($c, "\n") + 1);
+ } else {
+ if (!isset($hashbang)) {
+ $hashbang = $c;
+ }
+ $c = NULL;
+ }
+ }
+
+ if (isset($hashbang)) {
+ if (substr($hashbang, 0, 2) != '#!') {
+ $hashbang = '#!' . $hashbang;
+ }
+ if (substr($hashbang, -1) != "\n") {
+ $hashbang .= "\n";
+ }
+ } else {
+ $hashbang = "";
+ }
+
+ if (isset($loader)) {
+ $s = "<?php if (!class_exists('PHP_Archive')) {\n?>";
+ if (is_file($loader)) {
+ $s .= file_get_contents($loader);
+ }
+ $s .= "<?php\n";
+ $s .= "}\n";
+ $s .= "if (!in_array('phar', stream_get_wrappers())) {\n";
+ $s .= "\tstream_wrapper_register('phar', 'PHP_Archive');\n";
+ $s .= "}\n";
+ $s .= "if (!class_exists('Phar',0)) {\n";
+ $s .= "\tinclude 'phar://'.__FILE__.'/phar.inc';\n";
+ $s .= "}\n";
+ $s .= '?>';
+ $s .= $c;
+
+ $phar->setStub($hashbang . $s);
+ } else {
+ $phar->setStub($hashbang . $c);
+ }
+ return new SplFileInfo($stub);
+ }
+ return NULL;
+ }
+ // }}}
+ // {{{ function phar_set_stub_end
+ /**
+ * Set stub end
+ */
+ public function phar_set_stub_end(Phar $phar, $stub, $loader = NULL)
+ {
+ if (isset($stub) && isset($loader)) {
+ if (substr(__FILE__, -15) == 'pharcommand.inc') {
+ self::phar_add_file($phar, 0, 'phar.inc', 'phar://'.__FILE__.'/phar.inc', NULL);
+ } else {
+ self::phar_add_file($phar, 0, 'phar.inc', dirname(__FILE__).'/phar/phar.inc', NULL);
+ }
+ }
+ }
+ // }}}
+ // {{{ function cli_cmd_run_pack
+ /**
+ * Pack a new Phar
+ *
+ * This function will try to pack a new Phar archive.
+ *
+ * @see Exit to make sure that we are done.
+ */
+ public function cli_cmd_run_pack()
+ {
+ if (ini_get('phar.readonly')) {
+ self::error("Creating phar files is disabled by ini setting 'phar.readonly'.\n");
+ }
+
+ if (!Phar::canWrite()) {
+ self::error("Creating phar files is disabled, Phar::canWrite() returned false.\n");
+ }
+
+ $alias = $this->args['a']['val'];
+ $hashbang = $this->args['b']['val'];
+ $archive = $this->args['f']['val'];
+ $hash = $this->args['h']['val'];
+ $privkey = $this->args['y']['val'] ?? null;
+ $regex = $this->args['i']['val'];
+ $level = $this->args['l']['val'];
+ $loader = $this->args['p']['val'];
+ $stub = $this->args['s']['val'];
+ $invregex = $this->args['x']['val'];
+ $input = $this->args['']['val'];
+
+ $hash = self::phar_check_hash($hash, $privkey);
+
+ $phar = new Phar($archive, 0, $alias);
+
+ $phar->startBuffering();
+
+ $stub = $this->phar_set_stub_begin($phar, $stub, $loader, $hashbang);
+
+ if (!is_array($input)) {
+ $this->phar_add($phar, $level, $input, $regex, $invregex, $stub, NULL, isset($loader));
+ } else {
+ foreach($input as $i) {
+ $this->phar_add($phar, $level, $i, $regex, $invregex, $stub, NULL, isset($loader));
+ }
+ }
+
+ $this->phar_set_stub_end($phar, $stub, $loader);
+
+ switch($this->args['c']['val']) {
+ case 'gz':
+ case 'gzip':
+ $phar->compressFiles(Phar::GZ);
+ break;
+ case 'bz2':
+ case 'bzip2':
+ $phar->compressFiles(Phar::BZ2);
+ break;
+ default:
+ $phar->decompressFiles();
+ break;
+ }
+
+ if ($hash) {
+ $phar->setSignatureAlgorithm($hash, $privkey);
+ }
+
+ $phar->stopBuffering();
+ exit(0);
+ }
+ // }}}
+ // {{{ static function phar_add
+ /**
+ * Add files to a phar archive.
+ *
+ * This function will take a directory and iterate through
+ * it and get the files to insert into the Phar archive.
+ *
+ * @param Phar $phar The phar object.
+ * @param string $input The input directory
+ * @param string $regex The regex used in RegexIterator.
+ * @param string $invregex The InvertedRegexIterator expression.
+ * @param SplFileInfo $stub Stub file object
+ * @param mixed $compress Compression algorithm or NULL
+ * @param boolean $noloader Whether to prevent adding the loader
+ */
+ static function phar_add(Phar $phar, $level, $input, $regex, $invregex, SplFileInfo $stub = NULL, $compress = NULL, $noloader = false)
+ {
+ if ($input && is_file($input) && !is_dir($input)) {
+ return self::phar_add_file($phar, $level, $input, $input, $compress);
+ }
+ $dir = new RecursiveDirectoryIterator($input);
+ $dir = new RecursiveIteratorIterator($dir);
+
+ if (isset($regex)) {
+ $dir = new RegexIterator($dir, $regex);
+ }
+
+ if (isset($invregex)) {
+ $dir = new InvertedRegexIterator($dir, $invregex);
+ }
+
+ try {
+ foreach($dir as $file) {
+ if ((empty($stub) || $file->getRealPath() != $stub->getRealPath()) && !is_dir($file)) {
+ self::phar_add_file($phar, $level, $dir->getSubPathName(), $file, $compress, $noloader);
+ }
+ }
+ } catch(Exception $e) {
+ self::error("Unable to complete operation on file '$file'\n" . $e->getMessage() . "\n");
+ }
+ }
+ // }}}
+ // {{{ static function phar_add_file
+ /**
+ * Add a phar file
+ *
+ * This function adds a file to a phar archive.
+ *
+ * @param Phar $phar The phar object
+ * @param string $level The level of the file.
+ * @param string $entry The entry point
+ * @param string $file The file to add to the archive
+ * @param string $compress The compression scheme for the file.
+ * @param boolean $noloader Whether to prevent adding the loader
+ */
+ static function phar_add_file(Phar $phar, $level, $entry, $file, $compress, $noloader = false)
+ {
+ $entry = str_replace('//', '/', $entry);
+ while($level-- > 0 && ($p = strpos($entry, '/')) !== false) {
+ $entry = substr($entry, $p+1);
+ }
+
+ if ($noloader && $entry == 'phar.inc') {
+ return;
+ }
+
+ echo "$entry\n";
+
+ $phar[$entry] = file_get_contents($file);
+ switch($compress) {
+ case 'gz':
+ case 'gzip':
+ $phar[$entry]->compress(Phar::GZ);
+ break;
+ case 'bz2':
+ case 'bzip2':
+ $phar[$entry]->compress(Phar::BZ2);
+ break;
+ case '0':
+ $phar[$entry]->decompress();
+ break;
+ default:
+ break;
+ }
+ }
+ // }}}
+ // {{{ public function phar_dir_echo
+ /**
+ * Echo directory
+ *
+ * @param string $pn
+ * @param unknown_type $f
+ */
+ public function phar_dir_echo($pn, $f)
+ {
+ echo "$f\n";
+ }
+ // }}}
+ // {{{ public function phar_dir_operation
+ /**
+ * Directory operations
+ *
+ * Phar directory operations.
+ *
+ * @param RecursiveIteratorIterator $dir The recursiveIteratorIterator object.
+ * @param string $func Function to call on the iterations
+ * @param array $args Function arguments.
+ */
+ public function phar_dir_operation(RecursiveIteratorIterator $dir, $func, array $args = array())
+ {
+ $regex = $this->args['i']['val'];
+ $invregex= $this->args['x']['val'];
+
+ if (isset($regex)) {
+ $dir = new RegexIterator($dir, $regex);
+ }
+
+ if (isset($invregex)) {
+ $dir = new InvertedRegexIterator($dir, $invregex);
+ }
+
+ $any = false;
+ foreach($dir as $pn => $f) {
+ $any = true;
+ call_user_func($func, $pn, $f, $args);
+ }
+ return $any;
+ }
+ // {{{ static function cli_cmd_inf_list
+ /**
+ * Cli Command Info List
+ *
+ * @return string What inf does
+ */
+ static function cli_cmd_inf_list()
+ {
+ return "List contents of a PHAR archive.";
+ }
+ // }}}
+ // {{{ static function cli_cmd_arg_list
+ /**
+ * Cli Command Argument List
+ *
+ * @return arguments list
+ */
+ static function cli_cmd_arg_list()
+ {
+ return self::phar_args('Fix', 'pharurl');
+ }
+ // }}}
+ // {{{ public function cli_cmd_run_list
+ /**
+ * Cli Command Run List
+ *
+ * @see $this->phar_dir_operation
+ */
+ public function cli_cmd_run_list()
+ {
+ $this->phar_dir_operation(
+ new DirectoryTreeIterator(
+ $this->args['f']['val']),
+ array($this, 'phar_dir_echo')
+ );
+ }
+ // }}}
+ // {{{ static function cli_command_inf_tree
+ /**
+ * Cli Command Inf Tree
+ *
+ * @return string The description of a directory tree for a Phar archive.
+ */
+ static function cli_cmd_inf_tree()
+ {
+ return "Get a directory tree for a PHAR archive.";
+ }
+ // }}}
+ // {{{ static function cli_cmd_arg_tree
+ /**
+ * Cli Command Argument Tree
+ *
+ * @return string Arguments in URL format.
+ */
+ static function cli_cmd_arg_tree()
+ {
+ return self::phar_args('Fix', 'pharurl');
+ }
+ // }}}
+ // {{{ public function cli_cmd_run_tree
+ /**
+ * Cli Command Run Tree
+ *
+ * Set the phar_dir_operation with a directorygraphiterator.
+ *
+ * @see DirectoryGraphIterator
+ * @see $this->phar_dir_operation
+ *
+ */
+ public function cli_cmd_run_tree()
+ {
+ $a = $this->phar_dir_operation(
+ new DirectoryGraphIterator(
+ $this->args['f']['val']),
+ array($this, 'phar_dir_echo')
+ );
+ if (!$a) {
+ echo "|-<root directory>\n";
+ }
+ }
+ // }}}
+ // {{{ cli_cmd_inf_extract
+ /**
+ * Cli Command Inf Extract
+ *
+ * @return string The description of the command extra to a directory.
+ */
+ static function cli_cmd_inf_extract()
+ {
+ return "Extract a PHAR package to a directory.";
+ }
+ // }}}
+ // {{{ static function cli_cmd_arg_extract
+ /**
+ * Cli Command Arguments Extract
+ *
+ * The arguments for the extract function.
+ *
+ * @return array The arguments for the extraction.
+ */
+ static function cli_cmd_arg_extract()
+ {
+ $args = self::phar_args('Fix', 'phar');
+
+ $args[''] = array(
+ 'type' => 'dir',
+ 'val' => '.',
+ 'inf' => ' Directory to extract to (defaults to \'.\').',
+ );
+
+ return $args;
+ }
+ // }}}
+ // {{{ public function cli_cmd_run_extract
+ /**
+ * Run Extract
+ *
+ * Run the extraction of a phar Archive.
+ *
+ * @see $this->phar_dir_operation
+ */
+ public function cli_cmd_run_extract()
+ {
+ $dir = $this->args['']['val'];
+
+ if (is_array($dir)) {
+ if (count($dir) != 1) {
+ self::error("Only one target directory allowed.\n");
+ } else {
+ $dir = $dir[0];
+ }
+ }
+
+ $phar = $this->args['f']['val'];
+ $base = $phar->getPathname();
+ $bend = strpos($base, '.phar');
+ $bend = strpos($base, '/', $bend);
+ $base = substr($base, 0, $bend + 1);
+ $blen = strlen($base);
+
+ $this->phar_dir_operation(
+ new RecursiveIteratorIterator($phar),
+ array($this, 'phar_dir_extract'),
+ array($blen, $dir)
+ );
+ }
+ // }}}
+ // {{{ public function phar_dir_extract
+ /**
+ * Extract to a directory
+ *
+ * This function will extract the content of a Phar
+ * to a directory and create new files and directories
+ * depending on the permissions on that folder.
+ *
+ * @param string $pn
+ * @param string $f The file name
+ * @param array $args The directory and Blen information
+ */
+ public function phar_dir_extract($pn, $f, $args)
+ {
+ $blen = $args[0];
+ $dir = $args[1];
+ $sub = substr($pn, $blen);
+ $target = $dir . '/' . $sub;
+
+ if (!file_exists(dirname($target))) {
+ @mkdir(dirname($target), 0777, true);
+ }
+ if (!file_exists(dirname($target))) {
+ self::error("Operation could not be completed\n");
+ }
+
+ echo "$sub";
+
+ if (!@copy($f, $target)) {
+ echo " ...error\n";
+ } else {
+ echo " ...ok\n";
+ }
+ }
+ // }}}
+ // {{{ static function cli_cmd_inf_delete
+ /**
+ * Delete an entry from a phar information.
+ *
+ * @return string The information
+ */
+ static function cli_cmd_inf_delete()
+ {
+ return 'Delete entry from a PHAR archive';
+ }
+ // }}}
+ // {{{ static function cli_cmd_arg_delete
+ /**
+ * The cli command argument for deleting.
+ *
+ * @return array information about the arguments to use.
+ */
+ static function cli_cmd_arg_delete()
+ {
+ return self::phar_args('FE', 'phar');
+ }
+ // }}}
+ // {{{ public function cli_cmd_run_delete
+ /**
+ * Deleting execution
+ *
+ * Execute the deleting of the file from the phar archive.
+ */
+ public function cli_cmd_run_delete()
+ {
+ $phar = $this->args['f']['val'];
+ $entry = $this->args['e']['val'];
+
+ $phar->startBuffering();
+ unset($phar[$entry]);
+ $phar->stopBuffering();
+ }
+ // }}}
+ // {{{ static function cli_cmd_inf_add
+ /**
+ * Client comment add file information
+ *
+ * @return string The description of the feature
+ */
+ static function cli_cmd_inf_add()
+ {
+ return "Add entries to a PHAR package.";
+ }
+ // }}}
+ // {{{ static function cli_cmd_arg_add
+ /**
+ * Add a file arguments
+ */
+ static function cli_cmd_arg_add()
+ {
+ $args = self::phar_args('acFilx', 'phar');
+ $args[''] = array(
+ 'type' => 'any',
+ 'val' => NULL,
+ 'required' => 1,
+ 'inf' => ' Any number of input files and directories. If -i is in use then ONLY files and matching the given regular expression are being packed. If -x is given then files matching that regular expression are NOT being packed.',
+ );
+ return $args;
+ }
+ // }}}
+ // {{{ public functio cli_cmd_run_add
+ /**
+ * Add a file
+ *
+ * Run the action of adding a file to
+ * a phar archive.
+ */
+ public function cli_cmd_run_add()
+ {
+ $compress= $this->args['c']['val'];
+ $phar = $this->args['f']['val'];
+ $regex = $this->args['i']['val'];
+ $level = $this->args['l']['val'];
+ $invregex= $this->args['x']['val'];
+ $input = $this->args['']['val'];
+
+ $phar->startBuffering();
+
+ if (!is_array($input)) {
+ $this->phar_add($phar, $level, $input, $regex, $invregex, NULL, $compress);
+ } else {
+ foreach($input as $i) {
+ $this->phar_add($phar, $level, $i, $regex, $invregex, NULL, $compress);
+ }
+ }
+ $phar->stopBuffering();
+ exit(0);
+ }
+ // }}}
+ // {{{ public function cli_cmd_inf_stub_set
+ /**
+ * Set the stup of a phar file.
+ *
+ * @return string The stub set description.
+ */
+ public function cli_cmd_inf_stub_set()
+ {
+ return "Set the stub of a PHAR file. " .
+ "If no input file is specified as stub then stdin is being used.";
+ }
+ // }}}
+ // {{{ public function cli_cmd_arg_stub_set
+ /**
+ * Set the argument stub
+ *
+ * @return string arguments for a stub
+ */
+ public function cli_cmd_arg_stub_set()
+ {
+ $args = self::phar_args('bFps', 'phar');
+ $args['s']['val'] = 'php://stdin';
+ return $args;
+ }
+ // }}}
+ // {{{ public function cli_cmd_run_stub_set
+ /**
+ * Cli Command run stub set
+ *
+ * @see $phar->setStub()
+ */
+ public function cli_cmd_run_stub_set()
+ {
+ $hashbang = $this->args['b']['val'];
+ $phar = $this->args['f']['val'];
+ $stub = $this->args['s']['val'];
+ $loader = $this->args['p']['val'];
+
+ $this->phar_set_stub_begin($phar, $stub, $loader, $hashbang);
+ $this->phar_set_stub_end($phar, $stub, $loader);
+ }
+ // }}}
+ // {{{ public function cli_cmd_inf_stub_get
+ /**
+ * Get the command stub infos.
+ *
+ * @return string a description of the stub of a Phar file.
+ */
+ public function cli_cmd_inf_stub_get()
+ {
+ return "Get the stub of a PHAR file. " .
+ "If no output file is specified as stub then stdout is being used.";
+ }
+ // }}}
+ // {{{ public function cli_cmd_arg_stub_get
+ /**
+ * Get the argument stub
+ *
+ * @return array $args The arguments passed to the stub.
+ */
+ public function cli_cmd_arg_stub_get()
+ {
+ $args = self::phar_args('Fs', 'phar');
+ $args['s']['val'] = 'php://stdin';
+ return $args;
+ }
+ // }}}
+ // {{{ public function cli_cmd_run_stub_get
+ /**
+ * Cli Command Run Stub
+ *
+ * Get arguments and store them into a stub.
+ *
+ * @param arguments $args
+ * @see $this->args
+ */
+ public function cli_cmd_run_stub_get($args)
+ {
+ $phar = $this->args['f']['val'];
+ $stub = $this->args['s']['val'];
+
+ file_put_contents($stub, $phar->getStub());
+ }
+ // }}}
+ // {{{ public function cli_cmd_inf_compress
+ /**
+ * Cli Command Inf Compress
+ *
+ * Cli Command compress information
+ *
+ * @return string A description of the command.
+ */
+ public function cli_cmd_inf_compress()
+ {
+ return "Compress or uncompress all files or a selected entry.";
+ }
+ // }}}
+ // {{{ public function cli_cmd_arg_cmpress
+ /**
+ * Cli Command Arg Compress
+ *
+ * @return array The arguments for compress
+ */
+ public function cli_cmd_arg_compress()
+ {
+ return self::phar_args('FCe', 'phar');
+ }
+ // }}}
+ // {{{ public function cli_cmd_run_compress
+ /**
+ * Cli Command Run Compress
+ *
+ * @see $this->args
+ */
+ public function cli_cmd_run_compress()
+ {
+ $phar = $this->args['f']['val'];
+ $entry = $this->args['e']['val'];
+
+ switch($this->args['c']['val']) {
+ case 'gz':
+ case 'gzip':
+ if (isset($entry)) {
+ $phar[$entry]->compress(Phar::GZ);
+ } else {
+ $phar->compressFiles(Phar::GZ);
+ }
+ break;
+ case 'bz2':
+ case 'bzip2':
+ if (isset($entry)) {
+ $phar[$entry]->compress(Phar::BZ2);
+ } else {
+ $phar->compressFiles(Phar::BZ2);
+ }
+ break;
+ default:
+ if (isset($entry)) {
+ $phar[$entry]->decompress();
+ } else {
+ $phar->decompressFiles();
+ }
+ break;
+ }
+ }
+ // }}}
+ // {{{ public function cli_cmd_inf_sign
+ /**
+ * Cli Command Info Signature
+ *
+ * @return string A description of the signature arguments.
+ */
+ public function cli_cmd_inf_sign()
+ {
+ return "Set signature hash algorithm.";
+ }
+ // }}}
+ // {{{ public function cli_cmd_arg_sign
+ /**
+ * Cli Command Argument Sign
+ *
+ * @return array Arguments for Signature
+ */
+ public function cli_cmd_arg_sign()
+ {
+ return self::phar_args('FHy', 'phar');
+ }
+ // }}}
+ // {{{ public function cli_cmd_run_sign
+ /**
+ * Cli Command Run Signature
+ *
+ * @see $phar->setSignaturealgorithm
+ */
+ public function cli_cmd_run_sign()
+ {
+ $phar = $this->args['f']['val'];
+ $hash = $this->args['h']['val'];
+ $privkey = $this->args['y']['val'];
+
+ $hash = self::phar_check_hash($hash, $privkey);
+
+ $phar->setSignatureAlgorithm($hash, $privkey);
+ }
+ // }}}
+ // {{{ public function cli_cmd_inf_meta_set
+ /**
+ * Cli Command Inf Meta Set
+ *
+ * @return string A description
+ */
+ public function cli_cmd_inf_meta_set()
+ {
+ return "Set meta data of a PHAR entry or a PHAR package using serialized input. " .
+ "If no input file is specified for meta data then stdin is being used." .
+ "You can also specify a particular index using -k. In that case the metadata is " .
+ "expected to be an array and the value of the given index is being set. If " .
+ "the metadata is not present or empty a new array will be created. If the " .
+ "metadata is present and a flat value then the return value is 1. Also using -k " .
+ "the input is been taken directly rather then being serialized.";
+ }
+ // }}}
+ // {{{ public function cli_cmd_arg_meta_set
+ /**
+ * Cli Command Argument Meta Set
+ *
+ * @return array The arguments for meta set
+ */
+ public function cli_cmd_arg_meta_set()
+ {
+ return self::phar_args('FekM', 'phar');
+ }
+ // }}}
+ // {{{ public function cli_cmd_run_met_set
+ /**
+ * Cli Command Run Metaset
+ *
+ * @see $phar->startBuffering
+ * @see $phar->setMetadata
+ * @see $phar->stopBuffering
+ */
+ public function cli_cmd_run_meta_set()
+ {
+ $phar = $this->args['f']['val'];
+ $entry = $this->args['e']['val'];
+ $index = $this->args['k']['val'];
+ $meta = $this->args['m']['val'];
+
+ $phar->startBuffering();
+
+ if (isset($index)) {
+ if (isset($entry)) {
+ if ($phar[$entry]->hasMetadata()) {
+ $old = $phar[$entry]->getMetadata();
+ } else {
+ $old = array();
+ }
+ } else {
+ if ($phar->hasMetadata()) {
+ $old = $phar->getMetadata();
+ } else {
+ $old = array();
+ }
+ }
+
+ if (!is_array($old)) {
+ self::error('Metadata is a flat value while an index operation was issued.');
+ }
+
+ $old[$index] = $meta;
+ $meta = $old;
+ } else {
+ $meta = unserialize($meta);
+ }
+
+ if (isset($entry)) {
+ $phar[$entry]->setMetadata($meta);
+ } else {
+ $phar->setMetadata($meta);
+ }
+ $phar->stopBuffering();
+ }
+ // }}}
+ // {{{ public function cli_cmd_inf_met_get
+ /**
+ * Cli Command Inf Metaget
+ *
+ * @return string A description of the metaget arguments
+ */
+ public function cli_cmd_inf_meta_get()
+ {
+ return "Get meta information of a PHAR entry or a PHAR package in serialized from. " .
+ "If no output file is specified for meta data then stdout is being used.\n" .
+ "You can also specify a particular index using -k. In that case the metadata is " .
+ "expected to be an array and the value of the given index is returned using echo " .
+ "rather than using serialize. If that index does not exist or no meta data is " .
+ "present then the return value is 1.";
+ }
+ // }}}
+ // {{{ public function cli_cmd_arg_meta_get
+ /**
+ * Cli Command arg metaget
+ *
+ * @return array The arguments for meta get.
+ */
+ public function cli_cmd_arg_meta_get()
+ {
+ return self::phar_args('Fek', 'phar');
+ }
+ // }}}
+ // {{{ public function cli_cmd_run_meta_get
+ /**
+ * Cli Command Run Metaget
+ *
+ * @see $this->args
+ * @see $phar[$x]->hasMetadata()
+ * @see $phar->getMetadata()
+ */
+ public function cli_cmd_run_meta_get()
+ {
+ $phar = $this->args['f']['val'];
+ $entry = $this->args['e']['val'];
+ $index = $this->args['k']['val'];
+
+ if (isset($entry)) {
+ if (!$phar[$entry]->hasMetadata()) {
+ echo "No Metadata\n";
+ exit(1);
+ }
+ echo serialize($phar[$entry]->getMetadata());
+ } else {
+ if (!$phar->hasMetadata()) {
+ echo "No Metadata\n";
+ exit(1);
+ }
+ $meta = $phar->getMetadata();
+ }
+
+ if (isset($index)) {
+ if (isset($index)) {
+ if (isset($meta[$index])) {
+ echo $meta[$index];
+ exit(0);
+ } else {
+ echo "No Metadata\n";
+ exit(1);
+ }
+ } else {
+ echo serialize($meta);
+ }
+ }
+ }
+ // }}}
+ // {{{ public function cli_cmd_inf_meta_del
+ /**
+ * Cli Command Inf Metadel
+ *
+ * @return string A description of the metadel function
+ */
+ public function cli_cmd_inf_meta_del()
+ {
+ return "Delete meta information of a PHAR entry or a PHAR package.\n" .
+ "If -k is given then the metadata is expected to be an array " .
+ "and the given index is being deleted.\n" .
+ "If something was deleted the return value is 0 otherwise it is 1.";
+ }
+ // }}}
+ // {{{ public function cli_cmd_arg_meta_del
+ /**
+ * CliC ommand Arg Metadelete
+ *
+ * @return array The arguments for metadel
+ */
+ public function cli_cmd_arg_meta_del()
+ {
+ return self::phar_args('Fek', 'phar');
+ }
+ // }}}
+ // {{{ public function cli_cmd_run_meta_del
+ /**
+ * Cli Command Run MetaDel
+ *
+ * @see $phar[$x]->delMetadata()
+ * @see $phar->delMetadata()
+ */
+ public function cli_cmd_run_meta_del()
+ {
+ $phar = $this->args['f']['val'];
+ $entry = $this->args['e']['val'];
+ $index = $this->args['k']['val'];
+
+ if (isset($entry)) {
+ if (isset($index)) {
+ if (!$phar[$entry]->hasMetadata()) {
+ exit(1);
+ }
+ $meta = $phar[$entry]->getMetadata();
+
+ // @todo add error message here.
+ if (!is_array($meta)) {
+ exit(1);
+ }
+
+ unset($meta[$index]);
+ $phar[$entry]->setMetadata($meta);
+ } else {
+ exit($phar[$entry]->delMetadata() ? 0 : 1);
+ }
+ } else {
+ if (isset($index)) {
+ if (!$phar->hasMetadata()) {
+ exit(1);
+ }
+
+ $meta = $phar->getMetadata();
+
+ // @todo Add error message
+ if (!is_array($meta)) {
+ exit(1);
+ }
+
+ unset($meta[$index]);
+ $phar->setMetadata($meta);
+ } else {
+ exit($phar->delMetadata() ? 0 : 1);
+ }
+ }
+ }
+ // }}}
+ // {{{ public function cli_cmd_inf_info
+ /**
+ * CLi Command Inf Info
+ *
+ * @return string A description about the info commands.
+ */
+ public function cli_cmd_inf_info()
+ {
+ return "Get information about a PHAR package.\n" .
+ "By using -k it is possible to return a single value.";
+ }
+ // }}}
+ // {{{ public function cli_cmd_arg_info
+ /**
+ * Cli Command Arg Infos
+ *
+ * @return array The arguments for info command.
+ */
+ public function cli_cmd_arg_info()
+ {
+ return self::phar_args('Fk', 'phar');
+ }
+ // }}}
+ // {{{ public function cli_cmd_run_info
+ /**
+ * Cli Command Run Info
+ *
+ * @param args $args
+ */
+ public function cli_cmd_run_info()
+ {
+ $phar = $this->args['f']['val'];
+ $index = $this->args['k']['val'];
+
+ $hash = $phar->getSignature();
+ $infos = array();
+
+ if ($phar->getAlias()) {
+ $infos['Alias'] = $phar->getAlias();
+ }
+
+ if (!$hash) {
+ $infos['Hash-type'] = 'NONE';
+ } else {
+ $infos['Hash-type'] = $hash['hash_type'];
+ $infos['Hash'] = $hash['hash'];
+ }
+
+ $csize = 0;
+ $usize = 0;
+ $count = 0;
+ $ccount = 0;
+ $ucount = 0;
+ $mcount = 0;
+ $compalg = array('GZ'=>0, 'BZ2'=>0);
+
+ foreach(new RecursiveIteratorIterator($phar) as $ent) {
+ $count++;
+ if ($ent->isCompressed()) {
+ $ccount++;
+ $csize += $ent->getCompressedSize();
+ if ($ent->isCompressed(Phar::GZ)) {
+ $compalg['GZ']++;
+ } elseif ($ent->isCompressed(Phar::BZ2)) {
+ $compalg['BZ2']++;
+ }
+ } else {
+ $ucount++;
+ $csize += $ent->getSize();
+ }
+
+ $usize += $ent->getSize();
+
+ if ($ent->hasMetadata()) {
+ $mcount++;
+ }
+ }
+
+ $infos['Entries'] = $count;
+ $infos['Uncompressed-files'] = $ucount;
+ $infos['Compressed-files'] = $ccount;
+ $infos['Compressed-gz'] = $compalg['GZ'];
+ $infos['Compressed-bz2'] = $compalg['BZ2'];
+ $infos['Uncompressed-size'] = $usize;
+ $infos['Compressed-size'] = $csize;
+ $infos['Compression-ratio'] = sprintf('%.3g%%', $usize ? ($csize * 100) / $usize : 100);
+ $infos['Metadata-global'] = $phar->hasMetadata() * 1;
+ $infos['Metadata-files'] = $mcount;
+ $infos['Stub-size'] = strlen($phar->getStub());
+
+ if (isset($index)) {
+ if (!isset($infos[$index])) {
+ self::error("Requested value does not exist.\n");
+ }
+
+ echo $infos[$index];
+ exit(0);
+ }
+
+ $l = 0;
+ foreach($infos as $which => $val) {
+ $l = max(strlen($which), $l);
+ }
+
+ foreach($infos as $which => $val) {
+ echo $which . ':' . str_repeat(' ', $l + 1 - strlen($which)) . $val . "\n";
+ }
+ }
+ // }}}
+ // {{{ public function cli_cmd_inf_version
+ /**
+ * CLi Command Inf Version
+ *
+ * @return string A description about the info commands.
+ */
+ public function cli_cmd_inf_version()
+ {
+ return "Get information about the PHAR environment and the tool version.";
+ }
+ // }}}
+ // {{{ public function cli_cmd_arg_version
+ /**
+ * Cli Command Arg Version
+ *
+ * @return array The arguments for version command.
+ */
+ public function cli_cmd_arg_version()
+ {
+ return self::phar_args('', NULL);
+ }
+ // }}}
+ // {{{ public function cli_cmd_run_info
+ /**
+ * Cli Command Run Info
+ *
+ * @param args $args
+ */
+ public function cli_cmd_run_version()
+ {
+ $use_ext = extension_loaded('phar');
+ $version = array(
+ 'PHP Version' => phpversion(),
+ 'phar.phar version' => '$Id$',
+ 'Phar EXT version' => $use_ext ? phpversion('phar') : 'Not available',
+ 'Phar API version' => Phar::apiVersion(),
+ 'Phar-based phar archives' => true,
+ 'Tar-based phar archives' => $use_ext,
+ 'ZIP-based phar archives' => $use_ext,
+ 'gzip compression' => extension_loaded('zlib'),
+ 'bzip2 compression' => extension_loaded('bz2'),
+ 'supported signatures' => $use_ext ? join(', ', Phar::getSupportedSignatures()) : '',
+ );
+ $klen = 0;
+ foreach($version as $k => $v)
+ {
+ $klen = max($klen, strlen($k));
+ }
+ ++$klen;
+ foreach($version as $k => $v) {
+ if (is_bool($v)) {
+ $v = $v ? 'enabled' : 'disabled';
+ }
+ printf("%-${klen}s %s\n", $k.':', $v);
+ }
+ }
+ // }}}
}
// }}}
?>
diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c
index 6cf097e36f..027c78a18c 100644
--- a/ext/phar/phar_object.c
+++ b/ext/phar/phar_object.c
@@ -19,6 +19,7 @@
#include "phar_internal.h"
#include "func_interceptors.h"
+#include "phar_object_arginfo.h"
static zend_class_entry *phar_ce_archive;
static zend_class_entry *phar_ce_data;
@@ -398,7 +399,7 @@ PHP_METHOD(Phar, running)
zend_bool retphar = 1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &retphar) == FAILURE) {
- return;
+ RETURN_THROWS();
}
fname = (char*)zend_get_executed_filename();
@@ -440,7 +441,7 @@ PHP_METHOD(Phar, mount)
#endif
if (zend_parse_parameters(ZEND_NUM_ARGS(), "pp", &path, &path_len, &actual, &actual_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
fname = (char*)zend_get_executed_filename();
@@ -553,7 +554,7 @@ PHP_METHOD(Phar, webPhar)
size_t sapi_mod_name_len = strlen(sapi_module.name);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!s!saz", &alias, &alias_len, &index_php, &index_php_len, &f404, &f404_len, &mimeoverride, &rewrite) == FAILURE) {
- return;
+ RETURN_THROWS();
}
phar_request_initialize();
@@ -685,7 +686,7 @@ PHP_METHOD(Phar, webPhar)
}
efree(pt);
- return;
+ RETURN_THROWS();
}
fci.param_count = 1;
@@ -703,7 +704,7 @@ PHP_METHOD(Phar, webPhar)
}
efree(pt);
- return;
+ RETURN_THROWS();
}
if (Z_TYPE_P(fci.retval) == IS_UNDEF || Z_TYPE(retval) == IS_UNDEF) {
@@ -712,7 +713,7 @@ PHP_METHOD(Phar, webPhar)
}
zend_throw_exception_ex(phar_ce_PharException, 0, "phar error: rewrite callback must return a string or false");
efree(pt);
- return;
+ RETURN_THROWS();
}
switch (Z_TYPE(retval)) {
@@ -739,7 +740,7 @@ PHP_METHOD(Phar, webPhar)
efree(pt);
zend_throw_exception_ex(phar_ce_PharException, 0, "phar error: rewrite callback must return a string or false");
- return;
+ RETURN_THROWS();
}
}
@@ -841,7 +842,7 @@ PHP_METHOD(Phar, webPhar)
#ifdef PHP_WIN32
efree(fname);
#endif
- RETURN_FALSE;
+ RETURN_THROWS();
}
break;
case IS_STRING:
@@ -858,7 +859,7 @@ PHP_METHOD(Phar, webPhar)
#ifdef PHP_WIN32
efree(fname);
#endif
- RETURN_FALSE;
+ RETURN_THROWS();
}
}
}
@@ -882,17 +883,17 @@ PHP_METHOD(Phar, mungServer)
zval *mungvalues, *data;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &mungvalues) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!zend_hash_num_elements(Z_ARRVAL_P(mungvalues))) {
zend_throw_exception_ex(phar_ce_PharException, 0, "No values passed to Phar::mungServer(), expecting an array of any of these strings: PHP_SELF, REQUEST_URI, SCRIPT_FILENAME, SCRIPT_NAME");
- return;
+ RETURN_THROWS();
}
if (zend_hash_num_elements(Z_ARRVAL_P(mungvalues)) > 4) {
zend_throw_exception_ex(phar_ce_PharException, 0, "Too many values passed to Phar::mungServer(), expecting an array of any of these strings: PHP_SELF, REQUEST_URI, SCRIPT_FILENAME, SCRIPT_NAME");
- return;
+ RETURN_THROWS();
}
phar_request_initialize();
@@ -901,7 +902,7 @@ PHP_METHOD(Phar, mungServer)
if (Z_TYPE_P(data) != IS_STRING) {
zend_throw_exception_ex(phar_ce_PharException, 0, "Non-string value passed to Phar::mungServer(), expecting an array of any of these strings: PHP_SELF, REQUEST_URI, SCRIPT_FILENAME, SCRIPT_NAME");
- return;
+ RETURN_THROWS();
}
if (Z_STRLEN_P(data) == sizeof("PHP_SELF")-1 && !strncmp(Z_STRVAL_P(data), "PHP_SELF", sizeof("PHP_SELF")-1)) {
@@ -935,7 +936,7 @@ PHP_METHOD(Phar, mungServer)
PHP_METHOD(Phar, interceptFileFuncs)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
phar_intercept_functions();
}
@@ -953,7 +954,7 @@ PHP_METHOD(Phar, createDefaultStub)
size_t index_len = 0, webindex_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|pp", &index, &index_len, &webindex, &webindex_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
stub = phar_create_default_stub(index, webindex, &error);
@@ -961,7 +962,7 @@ PHP_METHOD(Phar, createDefaultStub)
if (error) {
zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error);
efree(error);
- return;
+ RETURN_THROWS();
}
RETURN_NEW_STR(stub);
}
@@ -976,7 +977,7 @@ PHP_METHOD(Phar, mapPhar)
zend_long dataoffset = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!l", &alias, &alias_len, &dataoffset) == FAILURE) {
- return;
+ RETURN_THROWS();
}
phar_request_initialize();
@@ -997,7 +998,7 @@ PHP_METHOD(Phar, loadPhar)
size_t fname_len, alias_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|s!", &fname, &fname_len, &alias, &alias_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
phar_request_initialize();
@@ -1015,7 +1016,7 @@ PHP_METHOD(Phar, loadPhar)
PHP_METHOD(Phar, apiVersion)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_STRINGL(PHP_PHAR_API_VERSION, sizeof(PHP_PHAR_API_VERSION)-1);
}
@@ -1028,7 +1029,7 @@ PHP_METHOD(Phar, canCompress)
zend_long method = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &method) == FAILURE) {
- return;
+ RETURN_THROWS();
}
phar_request_initialize();
@@ -1060,7 +1061,7 @@ PHP_METHOD(Phar, canCompress)
PHP_METHOD(Phar, canWrite)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_BOOL(!PHAR_G(readonly));
}
@@ -1078,7 +1079,7 @@ PHP_METHOD(Phar, isValidPharFilename)
zend_bool executable = 1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|b", &fname, &fname_len, &executable) == FAILURE) {
- return;
+ RETURN_THROWS();
}
is_executable = executable;
@@ -1145,18 +1146,18 @@ PHP_METHOD(Phar, __construct)
is_data = instanceof_function(Z_OBJCE_P(zobj), phar_ce_data);
if (is_data) {
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "p|ls!l", &fname, &fname_len, &flags, &alias, &alias_len, &format) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|ls!l", &fname, &fname_len, &flags, &alias, &alias_len, &format) == FAILURE) {
+ RETURN_THROWS();
}
} else {
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "p|ls!", &fname, &fname_len, &flags, &alias, &alias_len) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|ls!", &fname, &fname_len, &flags, &alias, &alias_len) == FAILURE) {
+ RETURN_THROWS();
}
}
if (phar_obj->archive) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Cannot call constructor twice");
- return;
+ RETURN_THROWS();
}
save_fname = fname;
@@ -1197,7 +1198,7 @@ PHP_METHOD(Phar, __construct)
"Phar creation or opening failed");
}
- return;
+ RETURN_THROWS();
}
if (is_data && phar_data->is_tar && phar_data->is_brandnew && format == PHAR_FORMAT_ZIP) {
@@ -1219,7 +1220,7 @@ PHP_METHOD(Phar, __construct)
"Phar class can only be used for executable tar and zip archives");
}
efree(entry);
- return;
+ RETURN_THROWS();
}
is_data = phar_data->is_data;
@@ -1241,7 +1242,7 @@ PHP_METHOD(Phar, __construct)
ZVAL_STRINGL(&arg1, fname, fname_len);
ZVAL_LONG(&arg2, flags);
- zend_call_method_with_2_params(zobj, Z_OBJCE_P(zobj),
+ zend_call_method_with_2_params(Z_OBJ_P(zobj), Z_OBJCE_P(zobj),
&spl_ce_RecursiveDirectoryIterator->constructor, "__construct", NULL, &arg1, &arg2);
zval_ptr_dtor(&arg1);
@@ -1264,7 +1265,7 @@ PHP_METHOD(Phar, __construct)
PHP_METHOD(Phar, getSupportedSignatures)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
array_init(return_value);
@@ -1289,7 +1290,7 @@ PHP_METHOD(Phar, getSupportedSignatures)
PHP_METHOD(Phar, getSupportedCompression)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
array_init(return_value);
@@ -1316,12 +1317,12 @@ PHP_METHOD(Phar, unlinkArchive)
phar_archive_data *phar;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &fname, &fname_len) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (!fname_len) {
zend_throw_exception_ex(phar_ce_PharException, 0, "Unknown phar archive \"\"");
- return;
+ RETURN_THROWS();
}
if (FAILURE == phar_open_from_filename(fname, fname_len, NULL, 0, REPORT_ERRORS, &phar, &error)) {
@@ -1331,7 +1332,7 @@ PHP_METHOD(Phar, unlinkArchive)
} else {
zend_throw_exception_ex(phar_ce_PharException, 0, "Unknown phar archive \"%s\"", fname);
}
- return;
+ RETURN_THROWS();
}
zname = (char*)zend_get_executed_filename();
@@ -1342,7 +1343,7 @@ PHP_METHOD(Phar, unlinkArchive)
zend_throw_exception_ex(phar_ce_PharException, 0, "phar archive \"%s\" cannot be unlinked from within itself", fname);
efree(arch);
efree(entry);
- return;
+ RETURN_THROWS();
}
efree(arch);
efree(entry);
@@ -1350,12 +1351,12 @@ PHP_METHOD(Phar, unlinkArchive)
if (phar->is_persistent) {
zend_throw_exception_ex(phar_ce_PharException, 0, "phar archive \"%s\" is in phar.cache_list, cannot unlinkArchive()", fname);
- return;
+ RETURN_THROWS();
}
if (phar->refcount) {
zend_throw_exception_ex(phar_ce_PharException, 0, "phar archive \"%s\" has open file handles or objects. fclose() all file handles, and unset() all objects prior to calling unlinkArchive()", fname);
- return;
+ RETURN_THROWS();
}
fname = estrndup(phar->fname, phar->fname_len);
@@ -1377,7 +1378,7 @@ PHP_METHOD(Phar, unlinkArchive)
if (!phar_obj->archive) { \
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, \
"Cannot call method on an uninitialized Phar object"); \
- return; \
+ RETURN_THROWS(); \
}
/* {{{ proto Phar::__destruct()
@@ -1388,6 +1389,10 @@ PHP_METHOD(Phar, __destruct)
zval *zobj = ZEND_THIS;
phar_archive_object *phar_obj = (phar_archive_object*)((char*)Z_OBJ_P(zobj) - Z_OBJ_P(zobj)->handlers->offset);
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
if (phar_obj->archive && phar_obj->archive->is_persistent) {
zend_hash_str_del(&PHAR_G(phar_persist_map), (const char *) phar_obj->archive, sizeof(phar_obj->archive));
}
@@ -1728,11 +1733,11 @@ PHP_METHOD(Phar, buildFromDirectory)
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot write to archive - write operations restricted by INI setting");
- return;
+ RETURN_THROWS();
}
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|s", &dir, &dir_len, &regex, &regex_len) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (ZEND_SIZE_T_UINT_OVFL(dir_len)) {
@@ -1742,35 +1747,35 @@ PHP_METHOD(Phar, buildFromDirectory)
if (SUCCESS != object_init_ex(&iter, spl_ce_RecursiveDirectoryIterator)) {
zval_ptr_dtor(&iter);
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Unable to instantiate directory iterator for %s", phar_obj->archive->fname);
- RETURN_FALSE;
+ RETURN_THROWS();
}
ZVAL_STRINGL(&arg, dir, dir_len);
ZVAL_LONG(&arg2, SPL_FILE_DIR_SKIPDOTS|SPL_FILE_DIR_UNIXPATHS);
- zend_call_method_with_2_params(&iter, spl_ce_RecursiveDirectoryIterator,
+ zend_call_method_with_2_params(Z_OBJ(iter), spl_ce_RecursiveDirectoryIterator,
&spl_ce_RecursiveDirectoryIterator->constructor, "__construct", NULL, &arg, &arg2);
zval_ptr_dtor(&arg);
if (EG(exception)) {
zval_ptr_dtor(&iter);
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (SUCCESS != object_init_ex(&iteriter, spl_ce_RecursiveIteratorIterator)) {
zval_ptr_dtor(&iter);
zval_ptr_dtor(&iteriter);
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Unable to instantiate directory iterator for %s", phar_obj->archive->fname);
- RETURN_FALSE;
+ RETURN_THROWS();
}
- zend_call_method_with_1_params(&iteriter, spl_ce_RecursiveIteratorIterator,
+ zend_call_method_with_1_params(Z_OBJ(iteriter), spl_ce_RecursiveIteratorIterator,
&spl_ce_RecursiveIteratorIterator->constructor, "__construct", NULL, &iter);
if (EG(exception)) {
zval_ptr_dtor(&iter);
zval_ptr_dtor(&iteriter);
- RETURN_FALSE;
+ RETURN_THROWS();
}
zval_ptr_dtor(&iter);
@@ -1782,12 +1787,12 @@ PHP_METHOD(Phar, buildFromDirectory)
zval_ptr_dtor(&iteriter);
zval_ptr_dtor(&regexiter);
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Unable to instantiate regex iterator for %s", phar_obj->archive->fname);
- RETURN_FALSE;
+ RETURN_THROWS();
}
ZVAL_STRINGL(&arg2, regex, regex_len);
- zend_call_method_with_2_params(&regexiter, spl_ce_RegexIterator,
+ zend_call_method_with_2_params(Z_OBJ(regexiter), spl_ce_RegexIterator,
&spl_ce_RegexIterator->constructor, "__construct", NULL, &iteriter, &arg2);
zval_ptr_dtor(&arg2);
}
@@ -1803,7 +1808,7 @@ PHP_METHOD(Phar, buildFromDirectory)
pass.fp = php_stream_fopen_tmpfile();
if (pass.fp == NULL) {
zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" unable to create temporary file", phar_obj->archive->fname);
- return;
+ RETURN_THROWS();
}
if (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive))) {
@@ -1813,7 +1818,7 @@ PHP_METHOD(Phar, buildFromDirectory)
}
php_stream_close(pass.fp);
zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
- return;
+ RETURN_THROWS();
}
if (SUCCESS == spl_iterator_apply((apply_reg ? &regexiter : &iteriter), (spl_iterator_apply_func_t) phar_build, (void *) &pass)) {
@@ -1864,11 +1869,11 @@ PHP_METHOD(Phar, buildFromIterator)
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot write out phar archive, phar is read-only");
- return;
+ RETURN_THROWS();
}
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O|s", &obj, zend_ce_traversable, &base, &base_len) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (ZEND_SIZE_T_UINT_OVFL(base_len)) {
@@ -1877,7 +1882,7 @@ PHP_METHOD(Phar, buildFromIterator)
if (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive))) {
zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
- return;
+ RETURN_THROWS();
}
array_init(return_value);
@@ -1891,7 +1896,7 @@ PHP_METHOD(Phar, buildFromIterator)
pass.fp = php_stream_fopen_tmpfile();
if (pass.fp == NULL) {
zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\": unable to create temporary file", phar_obj->archive->fname);
- return;
+ RETURN_THROWS();
}
if (SUCCESS == spl_iterator_apply(obj, (spl_iterator_apply_func_t) phar_build, (void *) &pass)) {
@@ -1917,7 +1922,7 @@ PHP_METHOD(Phar, count)
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &mode) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
RETURN_LONG(zend_hash_num_elements(&phar_obj->archive->manifest));
@@ -1934,7 +1939,7 @@ PHP_METHOD(Phar, isFileFormat)
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &type) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
switch (type) {
@@ -2240,7 +2245,7 @@ its_ok:
ZVAL_STRINGL(&arg1, phar->fname, phar->fname_len);
- zend_call_method_with_1_params(&ret, ce, &ce->constructor, "__construct", NULL, &arg1);
+ zend_call_method_with_1_params(Z_OBJ(ret), ce, &ce->constructor, "__construct", NULL, &arg1);
zval_ptr_dtor(&arg1);
return Z_OBJ(ret);
}
@@ -2377,13 +2382,13 @@ PHP_METHOD(Phar, convertToExecutable)
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|lls", &format, &method, &ext, &ext_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (PHAR_G(readonly)) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot write out executable phar archive, phar is read-only");
- return;
+ RETURN_THROWS();
}
switch (format) {
@@ -2405,7 +2410,7 @@ PHP_METHOD(Phar, convertToExecutable)
default:
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Unknown file format specified, please pass one of Phar::PHAR, Phar::TAR or Phar::ZIP");
- return;
+ RETURN_THROWS();
}
switch (method) {
@@ -2419,13 +2424,13 @@ PHP_METHOD(Phar, convertToExecutable)
if (format == PHAR_FORMAT_ZIP) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress entire archive with gzip, zip archives do not support whole-archive compression");
- return;
+ RETURN_THROWS();
}
if (!PHAR_G(has_zlib)) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress entire archive with gzip, enable ext/zlib in php.ini");
- return;
+ RETURN_THROWS();
}
flags = PHAR_FILE_COMPRESSED_GZ;
@@ -2434,13 +2439,13 @@ PHP_METHOD(Phar, convertToExecutable)
if (format == PHAR_FORMAT_ZIP) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress entire archive with bz2, zip archives do not support whole-archive compression");
- return;
+ RETURN_THROWS();
}
if (!PHAR_G(has_bz2)) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress entire archive with bz2, enable ext/bz2 in php.ini");
- return;
+ RETURN_THROWS();
}
flags = PHAR_FILE_COMPRESSED_BZ2;
@@ -2448,7 +2453,7 @@ PHP_METHOD(Phar, convertToExecutable)
default:
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Unknown compression specified, please pass one of Phar::GZ or Phar::BZ2");
- return;
+ RETURN_THROWS();
}
is_data = phar_obj->archive->is_data;
@@ -2481,7 +2486,7 @@ PHP_METHOD(Phar, convertToData)
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|lls", &format, &method, &ext, &ext_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
switch (format) {
@@ -2495,20 +2500,20 @@ PHP_METHOD(Phar, convertToData)
} else {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot write out data phar archive, use Phar::TAR or Phar::ZIP");
- return;
+ RETURN_THROWS();
}
break;
case PHAR_FORMAT_PHAR:
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot write out data phar archive, use Phar::TAR or Phar::ZIP");
- return;
+ RETURN_THROWS();
case PHAR_FORMAT_TAR:
case PHAR_FORMAT_ZIP:
break;
default:
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Unknown file format specified, please pass one of Phar::TAR or Phar::ZIP");
- return;
+ RETURN_THROWS();
}
switch (method) {
@@ -2522,13 +2527,13 @@ PHP_METHOD(Phar, convertToData)
if (format == PHAR_FORMAT_ZIP) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress entire archive with gzip, zip archives do not support whole-archive compression");
- return;
+ RETURN_THROWS();
}
if (!PHAR_G(has_zlib)) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress entire archive with gzip, enable ext/zlib in php.ini");
- return;
+ RETURN_THROWS();
}
flags = PHAR_FILE_COMPRESSED_GZ;
@@ -2537,13 +2542,13 @@ PHP_METHOD(Phar, convertToData)
if (format == PHAR_FORMAT_ZIP) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress entire archive with bz2, zip archives do not support whole-archive compression");
- return;
+ RETURN_THROWS();
}
if (!PHAR_G(has_bz2)) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress entire archive with bz2, enable ext/bz2 in php.ini");
- return;
+ RETURN_THROWS();
}
flags = PHAR_FILE_COMPRESSED_BZ2;
@@ -2551,7 +2556,7 @@ PHP_METHOD(Phar, convertToData)
default:
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Unknown compression specified, please pass one of Phar::GZ or Phar::BZ2");
- return;
+ RETURN_THROWS();
}
is_data = phar_obj->archive->is_data;
@@ -2576,7 +2581,7 @@ PHP_METHOD(Phar, isCompressed)
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (phar_obj->archive->flags & PHAR_FILE_COMPRESSED_GZ) {
@@ -2600,7 +2605,7 @@ PHP_METHOD(Phar, isWritable)
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!phar_obj->archive->is_writeable) {
@@ -2633,16 +2638,16 @@ PHP_METHOD(Phar, delete)
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot write out phar archive, phar is read-only");
- return;
+ RETURN_THROWS();
}
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &fname, &fname_len) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive))) {
zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
- return;
+ RETURN_THROWS();
}
if (zend_hash_str_exists(&phar_obj->archive->manifest, fname, (uint32_t) fname_len)) {
if (NULL != (entry = zend_hash_str_find_ptr(&phar_obj->archive->manifest, fname, (uint32_t) fname_len))) {
@@ -2657,13 +2662,14 @@ PHP_METHOD(Phar, delete)
}
} else {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Entry %s does not exist and cannot be deleted", fname);
- RETURN_FALSE;
+ RETURN_THROWS();
}
phar_flush(phar_obj->archive, NULL, 0, 0, &error);
if (error) {
zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error);
efree(error);
+ RETURN_THROWS();
}
RETURN_TRUE;
@@ -2678,7 +2684,7 @@ PHP_METHOD(Phar, getAlias)
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (phar_obj->archive->alias && phar_obj->archive->alias != phar_obj->archive->fname) {
@@ -2695,7 +2701,7 @@ PHP_METHOD(Phar, getPath)
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_STRINGL(phar_obj->archive->fname, phar_obj->archive->fname_len);
@@ -2718,7 +2724,7 @@ PHP_METHOD(Phar, setAlias)
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot write out phar archive, phar is read-only");
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* invalidate phar cache */
@@ -2733,7 +2739,7 @@ PHP_METHOD(Phar, setAlias)
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"A Phar alias cannot be set in a plain zip archive");
}
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &alias, &alias_len) == SUCCESS) {
@@ -2748,17 +2754,17 @@ PHP_METHOD(Phar, setAlias)
}
zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error);
efree(error);
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (!phar_validate_alias(alias, alias_len)) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Invalid alias \"%s\" specified for phar \"%s\"", alias, phar_obj->archive->fname);
- RETURN_FALSE;
+ RETURN_THROWS();
}
valid_alias:
if (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive))) {
zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
- return;
+ RETURN_THROWS();
}
if (phar_obj->archive->alias_len && NULL != (fd_ptr = zend_hash_str_find_ptr(&(PHAR_G(phar_alias_map)), phar_obj->archive->alias, phar_obj->archive->alias_len))) {
zend_hash_str_del(&(PHAR_G(phar_alias_map)), phar_obj->archive->alias, phar_obj->archive->alias_len);
@@ -2788,7 +2794,7 @@ valid_alias:
zend_hash_str_add_ptr(&(PHAR_G(phar_alias_map)), oldalias, oldalias_len, phar_obj->archive);
}
efree(error);
- RETURN_FALSE;
+ RETURN_THROWS();
}
zend_hash_str_add_ptr(&(PHAR_G(phar_alias_map)), alias, alias_len, phar_obj->archive);
@@ -2812,7 +2818,7 @@ PHP_METHOD(Phar, getVersion)
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_STRING(phar_obj->archive->version);
@@ -2827,7 +2833,7 @@ PHP_METHOD(Phar, startBuffering)
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
phar_obj->archive->donotflush = 1;
@@ -2842,7 +2848,7 @@ PHP_METHOD(Phar, isBuffering)
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_BOOL(phar_obj->archive->donotflush);
@@ -2859,13 +2865,13 @@ PHP_METHOD(Phar, stopBuffering)
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot write out phar archive, phar is read-only");
- return;
+ RETURN_THROWS();
}
phar_obj->archive->donotflush = 0;
@@ -2894,7 +2900,7 @@ PHP_METHOD(Phar, setStub)
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot change stub, phar is read-only");
- return;
+ RETURN_THROWS();
}
if (phar_obj->archive->is_data) {
@@ -2905,7 +2911,7 @@ PHP_METHOD(Phar, setStub)
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"A Phar stub cannot be set in a plain zip archive");
}
- return;
+ RETURN_THROWS();
}
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "r|l", &zstub, &len) == SUCCESS) {
@@ -2917,7 +2923,7 @@ PHP_METHOD(Phar, setStub)
}
if (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive))) {
zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
- return;
+ RETURN_THROWS();
}
phar_flush(phar_obj->archive, (char *) zstub, len, 0, &error);
if (error) {
@@ -2932,13 +2938,14 @@ PHP_METHOD(Phar, setStub)
} else if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &stub, &stub_len) == SUCCESS) {
if (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive))) {
zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
- return;
+ RETURN_THROWS();
}
phar_flush(phar_obj->archive, stub, stub_len, 0, &error);
if (error) {
zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error);
efree(error);
+ RETURN_THROWS();
}
RETURN_TRUE;
@@ -2977,22 +2984,22 @@ PHP_METHOD(Phar, setDefaultStub)
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"A Phar stub cannot be set in a plain zip archive");
}
- return;
+ RETURN_THROWS();
}
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!s", &index, &index_len, &webindex, &webindex_len) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (ZEND_NUM_ARGS() > 0 && (phar_obj->archive->is_tar || phar_obj->archive->is_zip)) {
- php_error_docref(NULL, E_WARNING, "method accepts no arguments for a tar- or zip-based phar stub, %d given", ZEND_NUM_ARGS());
+ php_error_docref(NULL, E_WARNING, "Method accepts no arguments for a tar- or zip-based phar stub, %d given", ZEND_NUM_ARGS());
RETURN_FALSE;
}
if (PHAR_G(readonly)) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot change stub: phar.readonly=1");
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (!phar_obj->archive->is_tar && !phar_obj->archive->is_zip) {
@@ -3004,7 +3011,7 @@ PHP_METHOD(Phar, setDefaultStub)
if (stub) {
zend_string_free(stub);
}
- RETURN_FALSE;
+ RETURN_THROWS();
}
created_stub = 1;
@@ -3012,7 +3019,7 @@ PHP_METHOD(Phar, setDefaultStub)
if (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive))) {
zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
- return;
+ RETURN_THROWS();
}
phar_flush(phar_obj->archive, stub ? ZSTR_VAL(stub) : 0, stub ? ZSTR_LEN(stub) : 0, 1, &error);
@@ -3023,7 +3030,7 @@ PHP_METHOD(Phar, setDefaultStub)
if (error) {
zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error);
efree(error);
- RETURN_FALSE;
+ RETURN_THROWS();
}
RETURN_TRUE;
@@ -3047,7 +3054,7 @@ PHP_METHOD(Phar, setSignatureAlgorithm)
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot set signature algorithm, phar is read-only");
- return;
+ RETURN_THROWS();
}
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "l|s", &algo, &key, &key_len) != SUCCESS) {
@@ -3062,7 +3069,7 @@ PHP_METHOD(Phar, setSignatureAlgorithm)
case PHAR_SIG_OPENSSL:
if (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive))) {
zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
- return;
+ RETURN_THROWS();
}
phar_obj->archive->sig_flags = (php_uint32)algo;
phar_obj->archive->is_modified = 1;
@@ -3090,7 +3097,7 @@ PHP_METHOD(Phar, getSignature)
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (phar_obj->archive->signature) {
@@ -3133,7 +3140,7 @@ PHP_METHOD(Phar, getModified)
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_BOOL(phar_obj->archive->is_modified);
@@ -3212,19 +3219,19 @@ PHP_METHOD(Phar, compress)
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|s", &method, &ext, &ext_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot compress phar archive, phar is read-only");
- return;
+ RETURN_THROWS();
}
if (phar_obj->archive->is_zip) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot compress zip-based archives with whole-archive compression");
- return;
+ RETURN_THROWS();
}
switch (method) {
@@ -3235,7 +3242,7 @@ PHP_METHOD(Phar, compress)
if (!PHAR_G(has_zlib)) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress entire archive with gzip, enable ext/zlib in php.ini");
- return;
+ RETURN_THROWS();
}
flags = PHAR_FILE_COMPRESSED_GZ;
break;
@@ -3251,7 +3258,7 @@ PHP_METHOD(Phar, compress)
default:
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Unknown compression specified, please pass one of Phar::GZ or Phar::BZ2");
- return;
+ RETURN_THROWS();
}
if (phar_obj->archive->is_tar) {
@@ -3279,19 +3286,19 @@ PHP_METHOD(Phar, decompress)
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &ext, &ext_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot decompress phar archive, phar is read-only");
- return;
+ RETURN_THROWS();
}
if (phar_obj->archive->is_zip) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot decompress zip-based archives with whole-archive compression");
- return;
+ RETURN_THROWS();
}
if (phar_obj->archive->is_tar) {
@@ -3321,13 +3328,13 @@ PHP_METHOD(Phar, compressFiles)
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &method) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Phar is readonly, cannot change compression");
- return;
+ RETURN_THROWS();
}
switch (method) {
@@ -3335,7 +3342,7 @@ PHP_METHOD(Phar, compressFiles)
if (!PHAR_G(has_zlib)) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress files within archive with gzip, enable ext/zlib in php.ini");
- return;
+ RETURN_THROWS();
}
flags = PHAR_ENT_COMPRESSED_GZ;
break;
@@ -3344,20 +3351,20 @@ PHP_METHOD(Phar, compressFiles)
if (!PHAR_G(has_bz2)) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress files within archive with bz2, enable ext/bz2 in php.ini");
- return;
+ RETURN_THROWS();
}
flags = PHAR_ENT_COMPRESSED_BZ2;
break;
default:
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Unknown compression specified, please pass one of Phar::GZ or Phar::BZ2");
- return;
+ RETURN_THROWS();
}
if (phar_obj->archive->is_tar) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress with Gzip compression, tar archives cannot compress individual files, use compress() to compress the whole archive");
- return;
+ RETURN_THROWS();
}
if (!pharobj_cancompress(&phar_obj->archive->manifest)) {
@@ -3368,12 +3375,12 @@ PHP_METHOD(Phar, compressFiles)
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress all files as Bzip2, some are compressed as gzip and cannot be decompressed");
}
- return;
+ RETURN_THROWS();
}
if (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive))) {
zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
- return;
+ RETURN_THROWS();
}
pharobj_set_compression(&phar_obj->archive->manifest, flags);
phar_obj->archive->is_modified = 1;
@@ -3395,19 +3402,19 @@ PHP_METHOD(Phar, decompressFiles)
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Phar is readonly, cannot change compression");
- return;
+ RETURN_THROWS();
}
if (!pharobj_cancompress(&phar_obj->archive->manifest)) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot decompress all files, some are compressed as bzip2 or gzip and cannot be decompressed");
- return;
+ RETURN_THROWS();
}
if (phar_obj->archive->is_tar) {
@@ -3415,7 +3422,7 @@ PHP_METHOD(Phar, decompressFiles)
} else {
if (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive))) {
zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
- return;
+ RETURN_THROWS();
}
pharobj_set_compression(&phar_obj->archive->manifest, PHAR_ENT_COMPRESSED_NONE);
}
@@ -3446,39 +3453,39 @@ PHP_METHOD(Phar, copy)
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters(ZEND_NUM_ARGS(), "pp", &oldfile, &oldfile_len, &newfile, &newfile_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot copy \"%s\" to \"%s\", phar is read-only", oldfile, newfile);
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (oldfile_len >= sizeof(".phar")-1 && !memcmp(oldfile, ".phar", sizeof(".phar")-1)) {
/* can't copy a meta file */
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"file \"%s\" cannot be copied to file \"%s\", cannot copy Phar meta-file in %s", oldfile, newfile, phar_obj->archive->fname);
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (newfile_len >= sizeof(".phar")-1 && !memcmp(newfile, ".phar", sizeof(".phar")-1)) {
/* can't copy a meta file */
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"file \"%s\" cannot be copied to file \"%s\", cannot copy to Phar meta-file in %s", oldfile, newfile, phar_obj->archive->fname);
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (!zend_hash_str_exists(&phar_obj->archive->manifest, oldfile, (uint32_t) oldfile_len) || NULL == (oldentry = zend_hash_str_find_ptr(&phar_obj->archive->manifest, oldfile, (uint32_t) oldfile_len)) || oldentry->is_deleted) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"file \"%s\" cannot be copied to file \"%s\", file does not exist in %s", oldfile, newfile, phar_obj->archive->fname);
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (zend_hash_str_exists(&phar_obj->archive->manifest, newfile, (uint32_t) newfile_len)) {
if (NULL != (temp = zend_hash_str_find_ptr(&phar_obj->archive->manifest, newfile, (uint32_t) newfile_len)) || !temp->is_deleted) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"file \"%s\" cannot be copied to file \"%s\", file must not already exist in phar %s", oldfile, newfile, phar_obj->archive->fname);
- RETURN_FALSE;
+ RETURN_THROWS();
}
}
@@ -3486,14 +3493,14 @@ PHP_METHOD(Phar, copy)
if (phar_path_check(&newfile, &tmp_len, &pcr_error) > pcr_is_ok) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"file \"%s\" contains invalid characters %s, cannot be copied from \"%s\" in phar %s", newfile, pcr_error, oldfile, phar_obj->archive->fname);
- RETURN_FALSE;
+ RETURN_THROWS();
}
newfile_len = tmp_len;
if (phar_obj->archive->is_persistent) {
if (FAILURE == phar_copy_on_write(&(phar_obj->archive))) {
zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
- return;
+ RETURN_THROWS();
}
/* re-populate with copied-on-write entry */
oldentry = zend_hash_str_find_ptr(&phar_obj->archive->manifest, oldfile, (uint32_t) oldfile_len);
@@ -3516,7 +3523,7 @@ PHP_METHOD(Phar, copy)
php_stream_close(newentry.fp);
zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error);
efree(error);
- return;
+ RETURN_THROWS();
}
}
@@ -3533,7 +3540,7 @@ PHP_METHOD(Phar, copy)
}
/* }}} */
-/* {{{ proto int Phar::offsetExists(string entry)
+/* {{{ proto bool Phar::offsetExists(string entry)
* determines whether a file exists in the phar
*/
PHP_METHOD(Phar, offsetExists)
@@ -3545,7 +3552,7 @@ PHP_METHOD(Phar, offsetExists)
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &fname, &fname_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (zend_hash_str_exists(&phar_obj->archive->manifest, fname, (uint32_t) fname_len)) {
@@ -3570,7 +3577,7 @@ PHP_METHOD(Phar, offsetExists)
}
/* }}} */
-/* {{{ proto int Phar::offsetGet(string entry)
+/* {{{ proto PharFileInfo Phar::offsetGet(string entry)
* get a PharFileInfo object for a specific file
*/
PHP_METHOD(Phar, offsetGet)
@@ -3583,7 +3590,7 @@ PHP_METHOD(Phar, offsetGet)
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &fname, &fname_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
/* security is 0 here so that we can get a better error message than "entry doesn't exist" */
@@ -3592,17 +3599,17 @@ PHP_METHOD(Phar, offsetGet)
} else {
if (fname_len == sizeof(".phar/stub.php")-1 && !memcmp(fname, ".phar/stub.php", sizeof(".phar/stub.php")-1)) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Cannot get stub \".phar/stub.php\" directly in phar \"%s\", use getStub", phar_obj->archive->fname);
- return;
+ RETURN_THROWS();
}
if (fname_len == sizeof(".phar/alias.txt")-1 && !memcmp(fname, ".phar/alias.txt", sizeof(".phar/alias.txt")-1)) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Cannot get alias \".phar/alias.txt\" directly in phar \"%s\", use getAlias", phar_obj->archive->fname);
- return;
+ RETURN_THROWS();
}
if (fname_len >= sizeof(".phar")-1 && !memcmp(fname, ".phar", sizeof(".phar")-1)) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Cannot directly get any files or directories in magic \".phar\" directory");
- return;
+ RETURN_THROWS();
}
if (entry->is_temp_dir) {
@@ -3750,7 +3757,7 @@ static void phar_mkdir(phar_archive_data **pphar, char *dirname, size_t dirname_
}
/* }}} */
-/* {{{ proto int Phar::offsetSet(string entry, string value)
+/* {{{ proto void Phar::offsetSet(string entry, string value)
* set the contents of an internal file to those of an external file
*/
PHP_METHOD(Phar, offsetSet)
@@ -3762,33 +3769,33 @@ PHP_METHOD(Phar, offsetSet)
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Write operations disabled by the php.ini setting phar.readonly");
- return;
+ RETURN_THROWS();
}
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "pr", &fname, &fname_len, &zresource) == FAILURE
&& zend_parse_parameters(ZEND_NUM_ARGS(), "ps", &fname, &fname_len, &cont_str, &cont_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (fname_len == sizeof(".phar/stub.php")-1 && !memcmp(fname, ".phar/stub.php", sizeof(".phar/stub.php")-1)) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Cannot set stub \".phar/stub.php\" directly in phar \"%s\", use setStub", phar_obj->archive->fname);
- return;
+ RETURN_THROWS();
}
if (fname_len == sizeof(".phar/alias.txt")-1 && !memcmp(fname, ".phar/alias.txt", sizeof(".phar/alias.txt")-1)) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Cannot set alias \".phar/alias.txt\" directly in phar \"%s\", use setAlias", phar_obj->archive->fname);
- return;
+ RETURN_THROWS();
}
if (fname_len >= sizeof(".phar")-1 && !memcmp(fname, ".phar", sizeof(".phar")-1)) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Cannot set any files or directories in magic \".phar\" directory");
- return;
+ RETURN_THROWS();
}
phar_add_file(&(phar_obj->archive), fname, fname_len, cont_str, cont_len, zresource);
}
/* }}} */
-/* {{{ proto int Phar::offsetUnset(string entry)
+/* {{{ proto bool Phar::offsetUnset(string entry)
* remove a file from a phar
*/
PHP_METHOD(Phar, offsetUnset)
@@ -3800,11 +3807,11 @@ PHP_METHOD(Phar, offsetUnset)
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Write operations disabled by the php.ini setting phar.readonly");
- return;
+ RETURN_THROWS();
}
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &fname, &fname_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (zend_hash_str_exists(&phar_obj->archive->manifest, fname, (uint32_t) fname_len)) {
@@ -3817,7 +3824,7 @@ PHP_METHOD(Phar, offsetUnset)
if (phar_obj->archive->is_persistent) {
if (FAILURE == phar_copy_on_write(&(phar_obj->archive))) {
zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
- return;
+ RETURN_THROWS();
}
/* re-populate entry after copy on write */
entry = zend_hash_str_find_ptr(&phar_obj->archive->manifest, fname, (uint32_t) fname_len);
@@ -3851,12 +3858,12 @@ PHP_METHOD(Phar, addEmptyDir)
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &dirname, &dirname_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (dirname_len >= sizeof(".phar")-1 && !memcmp(dirname, ".phar", sizeof(".phar")-1)) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Cannot create a directory in magic \".phar\" directory");
- return;
+ RETURN_THROWS();
}
phar_mkdir(&phar_obj->archive, dirname, dirname_len);
@@ -3876,17 +3883,17 @@ PHP_METHOD(Phar, addFile)
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|s", &fname, &fname_len, &localname, &localname_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!strstr(fname, "://") && php_check_open_basedir(fname)) {
zend_throw_exception_ex(spl_ce_RuntimeException, 0, "phar error: unable to open file \"%s\" to add to phar archive, open_basedir restrictions prevent this", fname);
- return;
+ RETURN_THROWS();
}
if (!(resource = php_stream_open_wrapper(fname, "rb", 0, NULL))) {
zend_throw_exception_ex(spl_ce_RuntimeException, 0, "phar error: unable to open file \"%s\" to add to phar archive", fname);
- return;
+ RETURN_THROWS();
}
if (localname) {
@@ -3911,7 +3918,7 @@ PHP_METHOD(Phar, addFromString)
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ps", &localname, &localname_len, &cont_str, &cont_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
phar_add_file(&(phar_obj->archive), localname, localname_len, cont_str, cont_len, NULL);
@@ -3932,7 +3939,7 @@ PHP_METHOD(Phar, getStub)
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (phar_obj->archive->is_tar || phar_obj->archive->is_zip) {
@@ -3943,7 +3950,7 @@ PHP_METHOD(Phar, getStub)
} else {
if (!(fp = php_stream_open_wrapper(phar_obj->archive->fname, "rb", 0, NULL))) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "phar error: unable to open phar \"%s\"", phar_obj->archive->fname);
- return;
+ RETURN_THROWS();
}
if (stub->flags & PHAR_ENT_COMPRESSION_MASK) {
char *filter_name;
@@ -3955,7 +3962,7 @@ PHP_METHOD(Phar, getStub)
}
if (!filter) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "phar error: unable to read stub of phar \"%s\" (cannot create %s filter)", phar_obj->archive->fname, phar_decompress_filter(stub, 1));
- return;
+ RETURN_THROWS();
}
php_stream_filter_append(&fp->readfilters, filter);
}
@@ -3964,7 +3971,7 @@ PHP_METHOD(Phar, getStub)
if (!fp) {
zend_throw_exception_ex(spl_ce_RuntimeException, 0,
"Unable to read stub");
- return;
+ RETURN_THROWS();
}
php_stream_seek(fp, stub->offset_abs, SEEK_SET);
@@ -3985,7 +3992,7 @@ PHP_METHOD(Phar, getStub)
if (!fp) {
zend_throw_exception_ex(spl_ce_RuntimeException, 0,
"Unable to read stub");
- return;
+ RETURN_THROWS();
}
php_stream_rewind(fp);
@@ -3999,7 +4006,7 @@ carry_on:
zend_throw_exception_ex(spl_ce_RuntimeException, 0,
"Unable to read stub");
zend_string_release_ex(buf, 0);
- return;
+ RETURN_THROWS();
}
if (filter) {
@@ -4024,6 +4031,10 @@ PHP_METHOD(Phar, hasMetadata)
{
PHAR_ARCHIVE_OBJECT();
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
RETURN_BOOL(Z_TYPE(phar_obj->archive->metadata) != IS_UNDEF);
}
/* }}} */
@@ -4036,7 +4047,7 @@ PHP_METHOD(Phar, getMetadata)
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (Z_TYPE(phar_obj->archive->metadata) != IS_UNDEF) {
@@ -4064,16 +4075,16 @@ PHP_METHOD(Phar, setMetadata)
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Write operations disabled by the php.ini setting phar.readonly");
- return;
+ RETURN_THROWS();
}
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &metadata) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive))) {
zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
- return;
+ RETURN_THROWS();
}
if (Z_TYPE(phar_obj->archive->metadata) != IS_UNDEF) {
zval_ptr_dtor(&phar_obj->archive->metadata);
@@ -4102,7 +4113,11 @@ PHP_METHOD(Phar, delMetadata)
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Write operations disabled by the php.ini setting phar.readonly");
- return;
+ RETURN_THROWS();
+ }
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
}
if (Z_TYPE(phar_obj->archive->metadata) != IS_UNDEF) {
@@ -4114,7 +4129,7 @@ PHP_METHOD(Phar, delMetadata)
if (error) {
zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error);
efree(error);
- RETURN_FALSE;
+ RETURN_THROWS();
} else {
RETURN_TRUE;
}
@@ -4355,7 +4370,7 @@ PHP_METHOD(Phar, extractTo)
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|z!b", &pathto, &pathto_len, &zval_files, &overwrite) == FAILURE) {
- return;
+ RETURN_THROWS();
}
fp = php_stream_open_wrapper(phar_obj->archive->fname, "rb", IGNORE_URL|STREAM_MUST_SEEK, NULL);
@@ -4363,7 +4378,7 @@ PHP_METHOD(Phar, extractTo)
if (!fp) {
zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0,
"Invalid argument, %s cannot be found", phar_obj->archive->fname);
- return;
+ RETURN_THROWS();
}
php_stream_close(fp);
@@ -4371,7 +4386,7 @@ PHP_METHOD(Phar, extractTo)
if (pathto_len < 1) {
zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0,
"Invalid argument, extraction path must be non-zero length");
- return;
+ RETURN_THROWS();
}
if (pathto_len >= MAXPATHLEN) {
@@ -4379,7 +4394,7 @@ PHP_METHOD(Phar, extractTo)
/* truncate for error message */
zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Cannot extract to \"%s...\", destination directory is too long for filesystem", tmp);
efree(tmp);
- return;
+ RETURN_THROWS();
}
if (php_stream_stat_path(pathto, &ssb) < 0) {
@@ -4387,12 +4402,12 @@ PHP_METHOD(Phar, extractTo)
if (!ret) {
zend_throw_exception_ex(spl_ce_RuntimeException, 0,
"Unable to create path \"%s\" for extraction", pathto);
- return;
+ RETURN_THROWS();
}
} else if (!(ssb.sb.st_mode & S_IFDIR)) {
zend_throw_exception_ex(spl_ce_RuntimeException, 0,
"Unable to use path \"%s\" for extraction, it is a file, must be a directory", pathto);
- return;
+ RETURN_THROWS();
}
if (zval_files) {
@@ -4413,26 +4428,26 @@ PHP_METHOD(Phar, extractTo)
if (IS_STRING != Z_TYPE_P(zval_file)) {
zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0,
"Invalid argument, array of filenames to extract contains non-string value");
- return;
+ RETURN_THROWS();
}
switch (extract_helper(phar_obj->archive, Z_STR_P(zval_file), pathto, pathto_len, overwrite, &error)) {
case -1:
zend_throw_exception_ex(phar_ce_PharException, 0, "Extraction from phar \"%s\" failed: %s",
phar_obj->archive->fname, error);
efree(error);
- return;
+ RETURN_THROWS();
case 0:
zend_throw_exception_ex(phar_ce_PharException, 0,
- "Phar Error: attempted to extract non-existent file or directory \"%s\" from phar \"%s\"",
+ "phar error: attempted to extract non-existent file or directory \"%s\" from phar \"%s\"",
ZSTR_VAL(Z_STR_P(zval_file)), phar_obj->archive->fname);
- return;
+ RETURN_THROWS();
}
} ZEND_HASH_FOREACH_END();
RETURN_TRUE;
default:
zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0,
"Invalid argument, expected a filename (string) or array of filenames");
- return;
+ RETURN_THROWS();
}
} else {
filename = NULL;
@@ -4445,7 +4460,7 @@ PHP_METHOD(Phar, extractTo)
efree(error);
} else if (0 == ret && NULL != filename) {
zend_throw_exception_ex(phar_ce_PharException, 0,
- "Phar Error: attempted to extract non-existent file or directory \"%s\" from phar \"%s\"",
+ "phar error: attempted to extract non-existent file or directory \"%s\" from phar \"%s\"",
ZSTR_VAL(filename), phar_obj->archive->fname);
} else {
RETURN_TRUE;
@@ -4467,21 +4482,21 @@ PHP_METHOD(PharFileInfo, __construct)
phar_archive_data *phar_data;
zval *zobj = ZEND_THIS, arg1;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "p", &fname, &fname_len) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &fname, &fname_len) == FAILURE) {
+ RETURN_THROWS();
}
entry_obj = (phar_entry_object*)((char*)Z_OBJ_P(zobj) - Z_OBJ_P(zobj)->handlers->offset);
if (entry_obj->entry) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Cannot call constructor twice");
- return;
+ RETURN_THROWS();
}
if (fname_len < 7 || memcmp(fname, "phar://", 7) || phar_split_fname(fname, fname_len, &arch, &arch_len, &entry, &entry_len, 2, 0) == FAILURE) {
zend_throw_exception_ex(spl_ce_RuntimeException, 0,
"'%s' is not a valid phar archive URL (must have at least phar://filename.phar)", fname);
- return;
+ RETURN_THROWS();
}
if (phar_open_from_filename(arch, arch_len, NULL, 0, REPORT_ERRORS, &phar_data, &error) == FAILURE) {
@@ -4495,7 +4510,7 @@ PHP_METHOD(PharFileInfo, __construct)
zend_throw_exception_ex(spl_ce_RuntimeException, 0,
"Cannot open phar file '%s'", fname);
}
- return;
+ RETURN_THROWS();
}
if ((entry_info = phar_get_entry_info_dir(phar_data, entry, entry_len, 1, &error, 1)) == NULL) {
@@ -4503,7 +4518,7 @@ PHP_METHOD(PharFileInfo, __construct)
"Cannot access phar file entry '%s' in archive '%s'%s%s", entry, arch, error ? ", " : "", error ? error : "");
efree(arch);
efree(entry);
- return;
+ RETURN_THROWS();
}
efree(arch);
@@ -4513,7 +4528,7 @@ PHP_METHOD(PharFileInfo, __construct)
ZVAL_STRINGL(&arg1, fname, fname_len);
- zend_call_method_with_1_params(zobj, Z_OBJCE_P(zobj),
+ zend_call_method_with_1_params(Z_OBJ_P(zobj), Z_OBJCE_P(zobj),
&spl_ce_SplFileInfo->constructor, "__construct", NULL, &arg1);
zval_ptr_dtor(&arg1);
@@ -4526,7 +4541,7 @@ PHP_METHOD(PharFileInfo, __construct)
if (!entry_obj->entry) { \
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, \
"Cannot call method on an uninitialized PharFileInfo object"); \
- return; \
+ RETURN_THROWS(); \
}
/* {{{ proto PharFileInfo::__destruct()
@@ -4557,7 +4572,7 @@ PHP_METHOD(PharFileInfo, getCompressedSize)
PHAR_ENTRY_OBJECT();
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_LONG(entry_obj->entry->compressed_filesize);
@@ -4574,7 +4589,7 @@ PHP_METHOD(PharFileInfo, isCompressed)
PHAR_ENTRY_OBJECT();
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &method) == FAILURE) {
- return;
+ RETURN_THROWS();
}
switch (method) {
@@ -4599,13 +4614,13 @@ PHP_METHOD(PharFileInfo, getCRC32)
PHAR_ENTRY_OBJECT();
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (entry_obj->entry->is_dir) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, \
"Phar entry is a directory, does not have a CRC"); \
- return;
+ RETURN_THROWS();
}
if (entry_obj->entry->is_crc_checked) {
@@ -4625,7 +4640,7 @@ PHP_METHOD(PharFileInfo, isCRCChecked)
PHAR_ENTRY_OBJECT();
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_BOOL(entry_obj->entry->is_crc_checked);
@@ -4640,7 +4655,7 @@ PHP_METHOD(PharFileInfo, getPharFlags)
PHAR_ENTRY_OBJECT();
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_LONG(entry_obj->entry->flags & ~(PHAR_ENT_PERM_MASK|PHAR_ENT_COMPRESSION_MASK));
@@ -4659,16 +4674,16 @@ PHP_METHOD(PharFileInfo, chmod)
if (entry_obj->entry->is_temp_dir) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, \
"Phar entry \"%s\" is a temporary directory (not an actual entry in the archive), cannot chmod", entry_obj->entry->filename); \
- return;
+ RETURN_THROWS();
}
if (PHAR_G(readonly) && !entry_obj->entry->phar->is_data) {
zend_throw_exception_ex(phar_ce_PharException, 0, "Cannot modify permissions for file \"%s\" in phar \"%s\", write operations are prohibited", entry_obj->entry->filename, entry_obj->entry->phar->fname);
- return;
+ RETURN_THROWS();
}
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &perms) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (entry_obj->entry->is_persistent) {
@@ -4676,7 +4691,7 @@ PHP_METHOD(PharFileInfo, chmod)
if (FAILURE == phar_copy_on_write(&phar)) {
zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar->fname);
- return;
+ RETURN_THROWS();
}
/* re-populate after copy-on-write */
entry_obj->entry = zend_hash_str_find_ptr(&phar->manifest, entry_obj->entry->filename, entry_obj->entry->filename_len);
@@ -4718,7 +4733,7 @@ PHP_METHOD(PharFileInfo, hasMetadata)
PHAR_ENTRY_OBJECT();
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_BOOL(Z_TYPE(entry_obj->entry->metadata) != IS_UNDEF);
@@ -4733,7 +4748,7 @@ PHP_METHOD(PharFileInfo, getMetadata)
PHAR_ENTRY_OBJECT();
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (Z_TYPE(entry_obj->entry->metadata) != IS_UNDEF) {
@@ -4761,17 +4776,17 @@ PHP_METHOD(PharFileInfo, setMetadata)
if (PHAR_G(readonly) && !entry_obj->entry->phar->is_data) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Write operations disabled by the php.ini setting phar.readonly");
- return;
+ RETURN_THROWS();
}
if (entry_obj->entry->is_temp_dir) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, \
"Phar entry is a temporary directory (not an actual entry in the archive), cannot set metadata"); \
- return;
+ RETURN_THROWS();
}
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &metadata) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (entry_obj->entry->is_persistent) {
@@ -4779,7 +4794,7 @@ PHP_METHOD(PharFileInfo, setMetadata)
if (FAILURE == phar_copy_on_write(&phar)) {
zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar->fname);
- return;
+ RETURN_THROWS();
}
/* re-populate after copy-on-write */
entry_obj->entry = zend_hash_str_find_ptr(&phar->manifest, entry_obj->entry->filename, entry_obj->entry->filename_len);
@@ -4812,18 +4827,18 @@ PHP_METHOD(PharFileInfo, delMetadata)
PHAR_ENTRY_OBJECT();
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (PHAR_G(readonly) && !entry_obj->entry->phar->is_data) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Write operations disabled by the php.ini setting phar.readonly");
- return;
+ RETURN_THROWS();
}
if (entry_obj->entry->is_temp_dir) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, \
"Phar entry is a temporary directory (not an actual entry in the archive), cannot delete metadata"); \
- return;
+ RETURN_THROWS();
}
if (Z_TYPE(entry_obj->entry->metadata) != IS_UNDEF) {
@@ -4832,7 +4847,7 @@ PHP_METHOD(PharFileInfo, delMetadata)
if (FAILURE == phar_copy_on_write(&phar)) {
zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar->fname);
- return;
+ RETURN_THROWS();
}
/* re-populate after copy-on-write */
entry_obj->entry = zend_hash_str_find_ptr(&phar->manifest, entry_obj->entry->filename, entry_obj->entry->filename_len);
@@ -4847,7 +4862,7 @@ PHP_METHOD(PharFileInfo, delMetadata)
if (error) {
zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error);
efree(error);
- RETURN_FALSE;
+ RETURN_THROWS();
} else {
RETURN_TRUE;
}
@@ -4871,13 +4886,13 @@ PHP_METHOD(PharFileInfo, getContent)
PHAR_ENTRY_OBJECT();
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (entry_obj->entry->is_dir) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
- "Phar error: Cannot retrieve contents, \"%s\" in phar \"%s\" is a directory", entry_obj->entry->filename, entry_obj->entry->phar->fname);
- return;
+ "phar error: Cannot retrieve contents, \"%s\" in phar \"%s\" is a directory", entry_obj->entry->filename, entry_obj->entry->phar->fname);
+ RETURN_THROWS();
}
link = phar_get_link_source(entry_obj->entry);
@@ -4888,15 +4903,15 @@ PHP_METHOD(PharFileInfo, getContent)
if (SUCCESS != phar_open_entry_fp(link, &error, 0)) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
- "Phar error: Cannot retrieve contents, \"%s\" in phar \"%s\": %s", entry_obj->entry->filename, entry_obj->entry->phar->fname, error);
+ "phar error: Cannot retrieve contents, \"%s\" in phar \"%s\": %s", entry_obj->entry->filename, entry_obj->entry->phar->fname, error);
efree(error);
- return;
+ RETURN_THROWS();
}
if (!(fp = phar_get_efp(link, 0))) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
- "Phar error: Cannot retrieve contents of \"%s\" in phar \"%s\"", entry_obj->entry->filename, entry_obj->entry->phar->fname);
- return;
+ "phar error: Cannot retrieve contents of \"%s\" in phar \"%s\"", entry_obj->entry->filename, entry_obj->entry->phar->fname);
+ RETURN_THROWS();
}
phar_seek_efp(link, 0, SEEK_SET, 0, 0);
@@ -4919,31 +4934,31 @@ PHP_METHOD(PharFileInfo, compress)
PHAR_ENTRY_OBJECT();
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &method) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (entry_obj->entry->is_tar) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress with Gzip compression, not possible with tar-based phar archives");
- return;
+ RETURN_THROWS();
}
if (entry_obj->entry->is_dir) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, \
"Phar entry is a directory, cannot set compression"); \
- return;
+ RETURN_THROWS();
}
if (PHAR_G(readonly) && !entry_obj->entry->phar->is_data) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Phar is readonly, cannot change compression");
- return;
+ RETURN_THROWS();
}
if (entry_obj->entry->is_deleted) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress deleted file");
- return;
+ RETURN_THROWS();
}
if (entry_obj->entry->is_persistent) {
@@ -4951,7 +4966,7 @@ PHP_METHOD(PharFileInfo, compress)
if (FAILURE == phar_copy_on_write(&phar)) {
zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar->fname);
- return;
+ RETURN_THROWS();
}
/* re-populate after copy-on-write */
entry_obj->entry = zend_hash_str_find_ptr(&phar->manifest, entry_obj->entry->filename, entry_obj->entry->filename_len);
@@ -4966,22 +4981,22 @@ PHP_METHOD(PharFileInfo, compress)
if (!PHAR_G(has_bz2)) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress with gzip compression, file is already compressed with bzip2 compression and bz2 extension is not enabled, cannot decompress");
- return;
+ RETURN_THROWS();
}
/* decompress this file indirectly */
if (SUCCESS != phar_open_entry_fp(entry_obj->entry, &error, 1)) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
- "Phar error: Cannot decompress bzip2-compressed file \"%s\" in phar \"%s\" in order to compress with gzip: %s", entry_obj->entry->filename, entry_obj->entry->phar->fname, error);
+ "phar error: Cannot decompress bzip2-compressed file \"%s\" in phar \"%s\" in order to compress with gzip: %s", entry_obj->entry->filename, entry_obj->entry->phar->fname, error);
efree(error);
- return;
+ RETURN_THROWS();
}
}
if (!PHAR_G(has_zlib)) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress with gzip compression, zlib extension is not enabled");
- return;
+ RETURN_THROWS();
}
entry_obj->entry->old_flags = entry_obj->entry->flags;
@@ -4997,22 +5012,22 @@ PHP_METHOD(PharFileInfo, compress)
if (!PHAR_G(has_zlib)) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress with bzip2 compression, file is already compressed with gzip compression and zlib extension is not enabled, cannot decompress");
- return;
+ RETURN_THROWS();
}
/* decompress this file indirectly */
if (SUCCESS != phar_open_entry_fp(entry_obj->entry, &error, 1)) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
- "Phar error: Cannot decompress gzip-compressed file \"%s\" in phar \"%s\" in order to compress with bzip2: %s", entry_obj->entry->filename, entry_obj->entry->phar->fname, error);
+ "phar error: Cannot decompress gzip-compressed file \"%s\" in phar \"%s\" in order to compress with bzip2: %s", entry_obj->entry->filename, entry_obj->entry->phar->fname, error);
efree(error);
- return;
+ RETURN_THROWS();
}
}
if (!PHAR_G(has_bz2)) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress with bzip2 compression, bz2 extension is not enabled");
- return;
+ RETURN_THROWS();
}
entry_obj->entry->old_flags = entry_obj->entry->flags;
entry_obj->entry->flags &= ~PHAR_ENT_COMPRESSION_MASK;
@@ -5030,6 +5045,7 @@ PHP_METHOD(PharFileInfo, compress)
if (error) {
zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error);
efree(error);
+ RETURN_THROWS();
}
RETURN_TRUE;
@@ -5046,13 +5062,13 @@ PHP_METHOD(PharFileInfo, decompress)
PHAR_ENTRY_OBJECT();
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (entry_obj->entry->is_dir) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, \
"Phar entry is a directory, cannot set compression"); \
- return;
+ RETURN_THROWS();
}
if ((entry_obj->entry->flags & PHAR_ENT_COMPRESSION_MASK) == 0) {
@@ -5062,25 +5078,25 @@ PHP_METHOD(PharFileInfo, decompress)
if (PHAR_G(readonly) && !entry_obj->entry->phar->is_data) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Phar is readonly, cannot decompress");
- return;
+ RETURN_THROWS();
}
if (entry_obj->entry->is_deleted) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress deleted file");
- return;
+ RETURN_THROWS();
}
if ((entry_obj->entry->flags & PHAR_ENT_COMPRESSED_GZ) != 0 && !PHAR_G(has_zlib)) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot decompress Gzip-compressed file, zlib extension is not enabled");
- return;
+ RETURN_THROWS();
}
if ((entry_obj->entry->flags & PHAR_ENT_COMPRESSED_BZ2) != 0 && !PHAR_G(has_bz2)) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot decompress Bzip2-compressed file, bz2 extension is not enabled");
- return;
+ RETURN_THROWS();
}
if (entry_obj->entry->is_persistent) {
@@ -5088,7 +5104,7 @@ PHP_METHOD(PharFileInfo, decompress)
if (FAILURE == phar_copy_on_write(&phar)) {
zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar->fname);
- return;
+ RETURN_THROWS();
}
/* re-populate after copy-on-write */
entry_obj->entry = zend_hash_str_find_ptr(&phar->manifest, entry_obj->entry->filename, entry_obj->entry->filename_len);
@@ -5103,7 +5119,7 @@ PHP_METHOD(PharFileInfo, decompress)
default:
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot decompress file compressed with unknown compression type");
- return;
+ RETURN_THROWS();
}
/* decompress this file indirectly */
if (SUCCESS != phar_open_entry_fp(entry_obj->entry, &error, 1)) {
@@ -5122,318 +5138,153 @@ PHP_METHOD(PharFileInfo, decompress)
if (error) {
zend_throw_exception_ex(phar_ce_PharException, 0, "%s", error);
efree(error);
+ RETURN_THROWS();
}
+
RETURN_TRUE;
}
/* }}} */
/* {{{ phar methods */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phar___construct, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, flags)
- ZEND_ARG_INFO(0, alias)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_createDS, 0, 0, 0)
- ZEND_ARG_INFO(0, index)
- ZEND_ARG_INFO(0, webindex)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_cancompress, 0, 0, 0)
- ZEND_ARG_INFO(0, method)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_isvalidpharfilename, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, executable)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_loadPhar, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, alias)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_mapPhar, 0, 0, 0)
- ZEND_ARG_INFO(0, alias)
- ZEND_ARG_INFO(0, offset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_mount, 0, 0, 2)
- ZEND_ARG_INFO(0, inphar)
- ZEND_ARG_INFO(0, externalfile)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_mungServer, 0, 0, 1)
- ZEND_ARG_INFO(0, munglist)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_webPhar, 0, 0, 0)
- ZEND_ARG_INFO(0, alias)
- ZEND_ARG_INFO(0, index)
- ZEND_ARG_INFO(0, f404)
- ZEND_ARG_INFO(0, mimetypes)
- ZEND_ARG_INFO(0, rewrites)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_running, 0, 0, 0)
- ZEND_ARG_INFO(0, retphar)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_ua, 0, 0, 1)
- ZEND_ARG_INFO(0, archive)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_build, 0, 0, 1)
- ZEND_ARG_INFO(0, iterator)
- ZEND_ARG_INFO(0, base_directory)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_conv, 0, 0, 0)
- ZEND_ARG_INFO(0, format)
- ZEND_ARG_INFO(0, compression_type)
- ZEND_ARG_INFO(0, file_ext)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_comps, 0, 0, 1)
- ZEND_ARG_INFO(0, compression_type)
- ZEND_ARG_INFO(0, file_ext)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_decomp, 0, 0, 0)
- ZEND_ARG_INFO(0, file_ext)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_comp, 0, 0, 1)
- ZEND_ARG_INFO(0, compression_type)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_compo, 0, 0, 0)
- ZEND_ARG_INFO(0, compression_type)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_copy, 0, 0, 2)
- ZEND_ARG_INFO(0, newfile)
- ZEND_ARG_INFO(0, oldfile)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_delete, 0, 0, 1)
- ZEND_ARG_INFO(0, entry)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_fromdir, 0, 0, 1)
- ZEND_ARG_INFO(0, base_dir)
- ZEND_ARG_INFO(0, regex)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_offsetExists, 0, 0, 1)
- ZEND_ARG_INFO(0, entry)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_offsetSet, 0, 0, 2)
- ZEND_ARG_INFO(0, entry)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_setAlias, 0, 0, 1)
- ZEND_ARG_INFO(0, alias)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_setMetadata, 0, 0, 1)
- ZEND_ARG_INFO(0, metadata)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_setSigAlgo, 0, 0, 1)
- ZEND_ARG_INFO(0, algorithm)
- ZEND_ARG_INFO(0, privatekey)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_setStub, 0, 0, 1)
- ZEND_ARG_INFO(0, newstub)
- ZEND_ARG_INFO(0, maxlen)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_emptydir, 0, 0, 0)
- ZEND_ARG_INFO(0, dirname)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_extract, 0, 0, 1)
- ZEND_ARG_INFO(0, pathto)
- ZEND_ARG_INFO(0, files)
- ZEND_ARG_INFO(0, overwrite)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_addfile, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, localname)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_fromstring, 0, 0, 1)
- ZEND_ARG_INFO(0, localname)
- ZEND_ARG_INFO(0, contents)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_isff, 0, 0, 1)
- ZEND_ARG_INFO(0, fileformat)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_phar__void, 0)
-ZEND_END_ARG_INFO()
-
static const zend_function_entry php_archive_methods[] = {
- PHP_ME(Phar, __construct, arginfo_phar___construct, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, __destruct, arginfo_phar__void, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, addEmptyDir, arginfo_phar_emptydir, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, addFile, arginfo_phar_addfile, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, addFromString, arginfo_phar_fromstring, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, buildFromDirectory, arginfo_phar_fromdir, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, buildFromIterator, arginfo_phar_build, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, compressFiles, arginfo_phar_comp, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, decompressFiles, arginfo_phar__void, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, compress, arginfo_phar_comps, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, decompress, arginfo_phar_decomp, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, convertToExecutable, arginfo_phar_conv, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, convertToData, arginfo_phar_conv, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, copy, arginfo_phar_copy, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, count, arginfo_phar__void, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, delete, arginfo_phar_delete, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, delMetadata, arginfo_phar__void, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, extractTo, arginfo_phar_extract, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, getAlias, arginfo_phar__void, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, getPath, arginfo_phar__void, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, getMetadata, arginfo_phar__void, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, getModified, arginfo_phar__void, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, getSignature, arginfo_phar__void, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, getStub, arginfo_phar__void, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, getVersion, arginfo_phar__void, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, hasMetadata, arginfo_phar__void, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, isBuffering, arginfo_phar__void, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, isCompressed, arginfo_phar__void, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, isFileFormat, arginfo_phar_isff, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, isWritable, arginfo_phar__void, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, offsetExists, arginfo_phar_offsetExists, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, offsetGet, arginfo_phar_offsetExists, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, offsetSet, arginfo_phar_offsetSet, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, offsetUnset, arginfo_phar_offsetExists, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, setAlias, arginfo_phar_setAlias, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, setDefaultStub, arginfo_phar_createDS, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, setMetadata, arginfo_phar_setMetadata, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, setSignatureAlgorithm, arginfo_phar_setSigAlgo, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, setStub, arginfo_phar_setStub, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, startBuffering, arginfo_phar__void, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, stopBuffering, arginfo_phar__void, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, __construct, arginfo_class_Phar___construct, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, __destruct, arginfo_class_Phar___destruct, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, addEmptyDir, arginfo_class_Phar_addEmptyDir, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, addFile, arginfo_class_Phar_addFile, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, addFromString, arginfo_class_Phar_addFromString, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, buildFromDirectory, arginfo_class_Phar_buildFromDirectory, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, buildFromIterator, arginfo_class_Phar_buildFromIterator, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, compressFiles, arginfo_class_Phar_compressFiles, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, decompressFiles, arginfo_class_Phar_decompressFiles, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, compress, arginfo_class_Phar_compress, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, decompress, arginfo_class_Phar_decompress, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, convertToExecutable, arginfo_class_Phar_convertToExecutable, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, convertToData, arginfo_class_Phar_convertToData, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, copy, arginfo_class_Phar_copy, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, count, arginfo_class_Phar_count, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, delete, arginfo_class_Phar_delete, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, delMetadata, arginfo_class_Phar_delMetadata, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, extractTo, arginfo_class_Phar_extractTo, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, getAlias, arginfo_class_Phar_getAlias, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, getPath, arginfo_class_Phar_getPath, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, getMetadata, arginfo_class_Phar_getMetadata, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, getModified, arginfo_class_Phar_getModified, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, getSignature, arginfo_class_Phar_getSignature, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, getStub, arginfo_class_Phar_getStub, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, getVersion, arginfo_class_Phar_getVersion, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, hasMetadata, arginfo_class_Phar_hasMetadata, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, isBuffering, arginfo_class_Phar_isBuffering, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, isCompressed, arginfo_class_Phar_isCompressed, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, isFileFormat, arginfo_class_Phar_isFileFormat, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, isWritable, arginfo_class_Phar_isWritable, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, offsetExists, arginfo_class_Phar_offsetExists, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, offsetGet, arginfo_class_Phar_offsetGet, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, offsetSet, arginfo_class_Phar_offsetSet, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, offsetUnset, arginfo_class_Phar_offsetUnset, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, setAlias, arginfo_class_Phar_setAlias, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, setDefaultStub, arginfo_class_Phar_setDefaultStub, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, setMetadata, arginfo_class_Phar_setMetadata, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, setSignatureAlgorithm, arginfo_class_Phar_setSignatureAlgorithm, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, setStub, arginfo_class_Phar_setStub, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, startBuffering, arginfo_class_Phar_startBuffering, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, stopBuffering, arginfo_class_Phar_stopBuffering, ZEND_ACC_PUBLIC)
/* static member functions */
- PHP_ME(Phar, apiVersion, arginfo_phar__void, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
- PHP_ME(Phar, canCompress, arginfo_phar_cancompress, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
- PHP_ME(Phar, canWrite, arginfo_phar__void, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
- PHP_ME(Phar, createDefaultStub, arginfo_phar_createDS, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
- PHP_ME(Phar, getSupportedCompression,arginfo_phar__void, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
- PHP_ME(Phar, getSupportedSignatures,arginfo_phar__void, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
- PHP_ME(Phar, interceptFileFuncs, arginfo_phar__void, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
- PHP_ME(Phar, isValidPharFilename, arginfo_phar_isvalidpharfilename, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
- PHP_ME(Phar, loadPhar, arginfo_phar_loadPhar, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
- PHP_ME(Phar, mapPhar, arginfo_phar_mapPhar, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
- PHP_ME(Phar, running, arginfo_phar_running, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
- PHP_ME(Phar, mount, arginfo_phar_mount, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
- PHP_ME(Phar, mungServer, arginfo_phar_mungServer, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
- PHP_ME(Phar, unlinkArchive, arginfo_phar_ua, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
- PHP_ME(Phar, webPhar, arginfo_phar_webPhar, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
+ PHP_ME(Phar, apiVersion, arginfo_class_Phar_apiVersion, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
+ PHP_ME(Phar, canCompress, arginfo_class_Phar_canCompress, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
+ PHP_ME(Phar, canWrite, arginfo_class_Phar_canWrite, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
+ PHP_ME(Phar, createDefaultStub, arginfo_class_Phar_createDefaultStub, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
+ PHP_ME(Phar, getSupportedCompression,arginfo_class_Phar_getSupportedCompression, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
+ PHP_ME(Phar, getSupportedSignatures,arginfo_class_Phar_getSupportedSignatures, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
+ PHP_ME(Phar, interceptFileFuncs, arginfo_class_Phar_interceptFileFuncs, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
+ PHP_ME(Phar, isValidPharFilename, arginfo_class_Phar_isValidPharFilename, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
+ PHP_ME(Phar, loadPhar, arginfo_class_Phar_loadPhar, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
+ PHP_ME(Phar, mapPhar, arginfo_class_Phar_mapPhar, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
+ PHP_ME(Phar, running, arginfo_class_Phar_running, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
+ PHP_ME(Phar, mount, arginfo_class_Phar_mount, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
+ PHP_ME(Phar, mungServer, arginfo_class_Phar_mungServer, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
+ PHP_ME(Phar, unlinkArchive, arginfo_class_Phar_unlinkArchive, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
+ PHP_ME(Phar, webPhar, arginfo_class_Phar_webPhar, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
PHP_FE_END
};
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_data___construct, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, flags)
- ZEND_ARG_INFO(0, alias)
- ZEND_ARG_INFO(0, fileformat)
-ZEND_END_ARG_INFO()
-
static const zend_function_entry php_data_methods[] = {
- PHP_ME(Phar, __construct, arginfo_data___construct, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, __destruct, arginfo_phar__void, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, addEmptyDir, arginfo_phar_emptydir, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, addFile, arginfo_phar_addfile, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, addFromString, arginfo_phar_fromstring, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, buildFromDirectory, arginfo_phar_fromdir, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, buildFromIterator, arginfo_phar_build, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, compressFiles, arginfo_phar_comp, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, decompressFiles, arginfo_phar__void, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, compress, arginfo_phar_comps, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, decompress, arginfo_phar_decomp, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, convertToExecutable, arginfo_phar_conv, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, convertToData, arginfo_phar_conv, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, copy, arginfo_phar_copy, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, count, arginfo_phar__void, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, delete, arginfo_phar_delete, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, delMetadata, arginfo_phar__void, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, extractTo, arginfo_phar_extract, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, getAlias, arginfo_phar__void, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, getPath, arginfo_phar__void, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, getMetadata, arginfo_phar__void, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, getModified, arginfo_phar__void, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, getSignature, arginfo_phar__void, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, getStub, arginfo_phar__void, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, getVersion, arginfo_phar__void, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, hasMetadata, arginfo_phar__void, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, isBuffering, arginfo_phar__void, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, isCompressed, arginfo_phar__void, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, isFileFormat, arginfo_phar_isff, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, isWritable, arginfo_phar__void, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, offsetExists, arginfo_phar_offsetExists, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, offsetGet, arginfo_phar_offsetExists, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, offsetSet, arginfo_phar_offsetSet, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, offsetUnset, arginfo_phar_offsetExists, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, setAlias, arginfo_phar_setAlias, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, setDefaultStub, arginfo_phar_createDS, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, setMetadata, arginfo_phar_setMetadata, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, setSignatureAlgorithm, arginfo_phar_setSigAlgo, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, setStub, arginfo_phar_setStub, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, startBuffering, arginfo_phar__void, ZEND_ACC_PUBLIC)
- PHP_ME(Phar, stopBuffering, arginfo_phar__void, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, __construct, arginfo_class_PharData___construct, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, __destruct, arginfo_class_PharData___destruct, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, addEmptyDir, arginfo_class_PharData_addEmptyDir, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, addFile, arginfo_class_PharData_addFile, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, addFromString, arginfo_class_PharData_addFromString, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, buildFromDirectory, arginfo_class_PharData_buildFromDirectory, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, buildFromIterator, arginfo_class_PharData_buildFromIterator, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, compressFiles, arginfo_class_PharData_compressFiles, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, decompressFiles, arginfo_class_PharData_decompressFiles, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, compress, arginfo_class_PharData_compress, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, decompress, arginfo_class_PharData_decompress, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, convertToExecutable, arginfo_class_PharData_convertToExecutable, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, convertToData, arginfo_class_PharData_convertToData, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, copy, arginfo_class_PharData_copy, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, count, arginfo_class_PharData_count, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, delete, arginfo_class_PharData_delete, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, delMetadata, arginfo_class_PharData_delMetadata, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, extractTo, arginfo_class_PharData_extractTo, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, getAlias, arginfo_class_PharData_getAlias, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, getPath, arginfo_class_PharData_getPath, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, getMetadata, arginfo_class_PharData_getMetadata, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, getModified, arginfo_class_PharData_getModified, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, getSignature, arginfo_class_PharData_getSignature, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, getStub, arginfo_class_PharData_getStub, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, getVersion, arginfo_class_PharData_getVersion, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, hasMetadata, arginfo_class_PharData_hasMetadata, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, isBuffering, arginfo_class_PharData_isBuffering, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, isCompressed, arginfo_class_PharData_isCompressed, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, isFileFormat, arginfo_class_PharData_isFileFormat, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, isWritable, arginfo_class_PharData_isWritable, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, offsetExists, arginfo_class_PharData_offsetExists, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, offsetGet, arginfo_class_PharData_offsetGet, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, offsetSet, arginfo_class_PharData_offsetSet, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, offsetUnset, arginfo_class_PharData_offsetUnset, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, setAlias, arginfo_class_PharData_setAlias, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, setDefaultStub, arginfo_class_PharData_setDefaultStub, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, setMetadata, arginfo_class_PharData_setMetadata, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, setSignatureAlgorithm, arginfo_class_PharData_setSignatureAlgorithm, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, setStub, arginfo_class_PharData_setStub, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, startBuffering, arginfo_class_PharData_startBuffering, ZEND_ACC_PUBLIC)
+ PHP_ME(Phar, stopBuffering, arginfo_class_PharData_stopBuffering, ZEND_ACC_PUBLIC)
/* static member functions */
- PHP_ME(Phar, apiVersion, arginfo_phar__void, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
- PHP_ME(Phar, canCompress, arginfo_phar_cancompress, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
- PHP_ME(Phar, canWrite, arginfo_phar__void, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
- PHP_ME(Phar, createDefaultStub, arginfo_phar_createDS, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
- PHP_ME(Phar, getSupportedCompression,arginfo_phar__void, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
- PHP_ME(Phar, getSupportedSignatures,arginfo_phar__void, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
- PHP_ME(Phar, interceptFileFuncs, arginfo_phar__void, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
- PHP_ME(Phar, isValidPharFilename, arginfo_phar_isvalidpharfilename, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
- PHP_ME(Phar, loadPhar, arginfo_phar_loadPhar, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
- PHP_ME(Phar, mapPhar, arginfo_phar_mapPhar, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
- PHP_ME(Phar, running, arginfo_phar_running, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
- PHP_ME(Phar, mount, arginfo_phar_mount, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
- PHP_ME(Phar, mungServer, arginfo_phar_mungServer, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
- PHP_ME(Phar, unlinkArchive, arginfo_phar_ua, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
- PHP_ME(Phar, webPhar, arginfo_phar_webPhar, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
+ PHP_ME(Phar, apiVersion, arginfo_class_PharData_apiVersion, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
+ PHP_ME(Phar, canCompress, arginfo_class_PharData_canCompress, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
+ PHP_ME(Phar, canWrite, arginfo_class_PharData_canWrite, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
+ PHP_ME(Phar, createDefaultStub, arginfo_class_PharData_createDefaultStub, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
+ PHP_ME(Phar, getSupportedCompression,arginfo_class_PharData_getSupportedCompression, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
+ PHP_ME(Phar, getSupportedSignatures,arginfo_class_PharData_getSupportedSignatures, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
+ PHP_ME(Phar, interceptFileFuncs, arginfo_class_PharData_interceptFileFuncs, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
+ PHP_ME(Phar, isValidPharFilename, arginfo_class_PharData_isValidPharFilename, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
+ PHP_ME(Phar, loadPhar, arginfo_class_PharData_loadPhar, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
+ PHP_ME(Phar, mapPhar, arginfo_class_PharData_mapPhar, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
+ PHP_ME(Phar, running, arginfo_class_PharData_running, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
+ PHP_ME(Phar, mount, arginfo_class_PharData_mount, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
+ PHP_ME(Phar, mungServer, arginfo_class_PharData_mungServer, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
+ PHP_ME(Phar, unlinkArchive, arginfo_class_PharData_unlinkArchive, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
+ PHP_ME(Phar, webPhar, arginfo_class_PharData_webPhar, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
PHP_FE_END
};
-ZEND_BEGIN_ARG_INFO_EX(arginfo_entry___construct, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_entry_chmod, 0, 0, 1)
- ZEND_ARG_INFO(0, perms)
-ZEND_END_ARG_INFO()
-
static const zend_function_entry php_entry_methods[] = {
- PHP_ME(PharFileInfo, __construct, arginfo_entry___construct, ZEND_ACC_PUBLIC)
- PHP_ME(PharFileInfo, __destruct, arginfo_phar__void, ZEND_ACC_PUBLIC)
- PHP_ME(PharFileInfo, chmod, arginfo_entry_chmod, ZEND_ACC_PUBLIC)
- PHP_ME(PharFileInfo, compress, arginfo_phar_comp, ZEND_ACC_PUBLIC)
- PHP_ME(PharFileInfo, decompress, arginfo_phar__void, ZEND_ACC_PUBLIC)
- PHP_ME(PharFileInfo, delMetadata, arginfo_phar__void, ZEND_ACC_PUBLIC)
- PHP_ME(PharFileInfo, getCompressedSize, arginfo_phar__void, ZEND_ACC_PUBLIC)
- PHP_ME(PharFileInfo, getCRC32, arginfo_phar__void, ZEND_ACC_PUBLIC)
- PHP_ME(PharFileInfo, getContent, arginfo_phar__void, ZEND_ACC_PUBLIC)
- PHP_ME(PharFileInfo, getMetadata, arginfo_phar__void, ZEND_ACC_PUBLIC)
- PHP_ME(PharFileInfo, getPharFlags, arginfo_phar__void, ZEND_ACC_PUBLIC)
- PHP_ME(PharFileInfo, hasMetadata, arginfo_phar__void, ZEND_ACC_PUBLIC)
- PHP_ME(PharFileInfo, isCompressed, arginfo_phar_compo, ZEND_ACC_PUBLIC)
- PHP_ME(PharFileInfo, isCRCChecked, arginfo_phar__void, ZEND_ACC_PUBLIC)
- PHP_ME(PharFileInfo, setMetadata, arginfo_phar_setMetadata, ZEND_ACC_PUBLIC)
+ PHP_ME(PharFileInfo, __construct, arginfo_class_PharFileInfo___construct, ZEND_ACC_PUBLIC)
+ PHP_ME(PharFileInfo, __destruct, arginfo_class_PharFileInfo___destruct, ZEND_ACC_PUBLIC)
+ PHP_ME(PharFileInfo, chmod, arginfo_class_PharFileInfo_chmod, ZEND_ACC_PUBLIC)
+ PHP_ME(PharFileInfo, compress, arginfo_class_PharFileInfo_compress, ZEND_ACC_PUBLIC)
+ PHP_ME(PharFileInfo, decompress, arginfo_class_PharFileInfo_decompress, ZEND_ACC_PUBLIC)
+ PHP_ME(PharFileInfo, delMetadata, arginfo_class_PharFileInfo_delMetadata, ZEND_ACC_PUBLIC)
+ PHP_ME(PharFileInfo, getCompressedSize, arginfo_class_PharFileInfo_getCompressedSize, ZEND_ACC_PUBLIC)
+ PHP_ME(PharFileInfo, getCRC32, arginfo_class_PharFileInfo_getCRC32, ZEND_ACC_PUBLIC)
+ PHP_ME(PharFileInfo, getContent, arginfo_class_PharFileInfo_getContent, ZEND_ACC_PUBLIC)
+ PHP_ME(PharFileInfo, getMetadata, arginfo_class_PharFileInfo_getMetadata, ZEND_ACC_PUBLIC)
+ PHP_ME(PharFileInfo, getPharFlags, arginfo_class_PharFileInfo_getPharFlags, ZEND_ACC_PUBLIC)
+ PHP_ME(PharFileInfo, hasMetadata, arginfo_class_PharFileInfo_hasMetadata, ZEND_ACC_PUBLIC)
+ PHP_ME(PharFileInfo, isCompressed, arginfo_class_PharFileInfo_isCompressed, ZEND_ACC_PUBLIC)
+ PHP_ME(PharFileInfo, isCRCChecked, arginfo_class_PharFileInfo_isCRCChecked, ZEND_ACC_PUBLIC)
+ PHP_ME(PharFileInfo, setMetadata, arginfo_class_PharFileInfo_setMetadata, ZEND_ACC_PUBLIC)
PHP_FE_END
};
diff --git a/ext/phar/phar_object.stub.php b/ext/phar/phar_object.stub.php
new file mode 100644
index 0000000000..2af9d5bc5e
--- /dev/null
+++ b/ext/phar/phar_object.stub.php
@@ -0,0 +1,422 @@
+<?php
+
+class Phar extends RecursiveDirectoryIterator implements Countable, ArrayAccess
+{
+ public function __construct(string $filename, int $flags = FilesystemIterator::SKIP_DOTS|FilesystemIterator::UNIX_PATHS, ?string $alias = null) {}
+
+ public function __destruct() {}
+
+ /** @return void */
+ public function addEmptyDir(string $dirname) {}
+
+ /** @return void */
+ public function addFile(string $filename, string $localname = UNKNOWN) {}
+
+ /** @return void */
+ public function addFromString(string $localname, string $contents) {}
+
+ /** @return array|false */
+ public function buildFromDirectory(string $base_dir, string $regex = UNKNOWN) {}
+
+ /** @return array|false */
+ public function buildFromIterator(Traversable $iterator, string $base_directory = UNKNOWN) {}
+
+ /** @return void */
+ public function compressFiles(int $compression_type) {}
+
+ /** @return bool */
+ public function decompressFiles() {}
+
+ /** @return ?Phar */
+ public function compress(int $compression_type, string $file_ext = UNKNOWN) {}
+
+ /** @return ?Phar */
+ public function decompress(string $file_ext = UNKNOWN) {}
+
+ /** @return ?Phar */
+ public function convertToExecutable(int $format = 9021976, int $compression_type = 9021976, string $file_ext = UNKNOWN) {}
+
+ /** @return ?Phar */
+ public function convertToData(int $format = 9021976, int $compression_type = 9021976, string $file_ext = UNKNOWN) {}
+
+ /** @return bool */
+ public function copy(string $newfile, string $oldfile) {}
+
+ /** @return int */
+ public function count(int $mode = UNKNOWN) {}
+
+ /** @return bool */
+ public function delete(string $entry) {}
+
+ /** @return bool */
+ public function delMetadata() {}
+
+ /** @return bool */
+ public function extractTo(string $pathto, $files = null, bool $overwrite = false) {}
+
+ /** @return ?string */
+ public function getAlias() {}
+
+ /** @return string */
+ public function getPath() {}
+
+ /** @return mixed */
+ public function getMetadata() {}
+
+ /** @return bool */
+ public function getModified() {}
+
+ /** @return array|false */
+ public function getSignature() {}
+
+ /** @return string */
+ public function getStub() {}
+
+ /** @return string */
+ public function getVersion() {}
+
+ /** @return bool */
+ public function hasMetadata() {}
+
+ /** @return bool */
+ public function isBuffering() {}
+
+ /** @return int|false */
+ public function isCompressed() {}
+
+ /** @return bool */
+ public function isFileFormat(int $fileformat) {}
+
+ /** @return bool */
+ public function isWritable() {}
+
+ /**
+ * @param string $entry
+ * @return bool
+ */
+ public function offsetExists($entry) {}
+
+ /**
+ * @param string $entry
+ * @return PharFileInfo
+ */
+ public function offsetGet($entry) {}
+
+ /**
+ * @param string $entry
+ * @param resource|string $value
+ * @return void
+ */
+ public function offsetSet($entry, $value) {}
+
+ /**
+ * @param string $entry
+ * @return bool
+ */
+ public function offsetUnset($entry) {}
+
+ /** @return bool */
+ public function setAlias(string $alias) {}
+
+ /** @return bool */
+ public function setDefaultStub(?string $index = null, string $webindex = UNKNOWN) {}
+
+ /**
+ * @param mixed $metadata
+ * @return void
+ */
+ public function setMetadata($metadata) {}
+
+ /** @return void */
+ public function setSignatureAlgorithm(int $algorithm, string $privatekey = UNKNOWN) {}
+
+ /**
+ * @param resource $newstub
+ * @return bool
+ */
+ public function setStub($newstub, $maxlen = -1) {}
+
+ /** @return void */
+ public function startBuffering() {}
+
+ /** @return void */
+ public function stopBuffering() {}
+
+ /** @return string */
+ final public static function apiVersion() {}
+
+ /** @return bool */
+ final public static function canCompress(int $method = 0) {}
+
+ /** @return bool */
+ final public static function canWrite() {}
+
+ /** @return string */
+ final public static function createDefaultStub(string $index = UNKNOWN, string $webindex = UNKNOWN) {}
+
+ /** @return array */
+ final public static function getSupportedCompression() {}
+
+ /** @return array */
+ final public static function getSupportedSignatures() {}
+
+ /** @return void */
+ final public static function interceptFileFuncs() {}
+
+ /** @return bool */
+ final public static function isValidPharFilename(string $filename, bool $executable = true) {}
+
+ /** @return bool */
+ final public static function loadPhar(string $filename, ?string $alias = null) {}
+
+ /** @return bool */
+ final public static function mapPhar(?string $alias = null, int $offset = 0) {}
+
+ /** @return string */
+ final public static function running(bool $retphar = true) {}
+
+ /** @return void */
+ final public static function mount(string $inphar, string $externalfile) {}
+
+ /** @return void */
+ final public static function mungServer(array $munglist) {}
+
+ /** @return bool */
+ final public static function unlinkArchive(string $archive) {}
+
+ /** @return void */
+ final public static function webPhar(?string $alias = null, ?string $index = null, string $f404 = UNKNOWN, array $mimetypes = [], $rewrites = UNKNOWN) {}
+}
+
+class PharData extends RecursiveDirectoryIterator implements Countable, ArrayAccess
+{
+ public function __construct(string $filename, int $flags = FilesystemIterator::SKIP_DOTS|FilesystemIterator::UNIX_PATHS, ?string $alias = null, $fileformat = 0) {}
+
+ public function __destruct() {}
+
+ /** @return void */
+ public function addEmptyDir(string $dirname) {}
+
+ /** @return void */
+ public function addFile(string $filename, string $localname = UNKNOWN) {}
+
+ /** @return void */
+ public function addFromString(string $localname, string $contents) {}
+
+ /** @return array|false */
+ public function buildFromDirectory(string $base_dir, string $regex = UNKNOWN) {}
+
+ /** @return array|false */
+ public function buildFromIterator(Traversable $iterator, string $base_directory = UNKNOWN) {}
+
+ /** @return void */
+ public function compressFiles(int $compression_type) {}
+
+ /** @return bool */
+ public function decompressFiles() {}
+
+ /** @return ?Phar */
+ public function compress(int $compression_type, string $file_ext = UNKNOWN) {}
+
+ /** @return ?Phar */
+ public function decompress(string $file_ext = UNKNOWN) {}
+
+ /** @return ?Phar */
+ public function convertToExecutable(int $format = 9021976, int $compression_type = 9021976, string $file_ext = UNKNOWN) {}
+
+ /** @return ?Phar */
+ public function convertToData(int $format = 9021976, int $compression_type = 9021976, string $file_ext = UNKNOWN) {}
+
+ /** @return bool */
+ public function copy(string $newfile, string $oldfile) {}
+
+ /** @return int */
+ public function count(int $mode = UNKNOWN) {}
+
+ /** @return bool */
+ public function delete(string $entry) {}
+
+ /** @return bool */
+ public function delMetadata() {}
+
+ /** @return bool */
+ public function extractTo(string $pathto, $files = null, bool $overwrite = false) {}
+
+ /** @return ?string */
+ public function getAlias() {}
+
+ /** @return string */
+ public function getPath() {}
+
+ /** @return mixed */
+ public function getMetadata() {}
+
+ /** @return bool */
+ public function getModified() {}
+
+ /** @return array|false */
+ public function getSignature() {}
+
+ /** @return string */
+ public function getStub() {}
+
+ /** @return string */
+ public function getVersion() {}
+
+ /** @return bool */
+ public function hasMetadata() {}
+
+ /** @return bool */
+ public function isBuffering() {}
+
+ /** @return int|false */
+ public function isCompressed() {}
+
+ /** @return bool */
+ public function isFileFormat(int $fileformat) {}
+
+ /** @return bool */
+ public function isWritable() {}
+
+ /**
+ * @param string $entry
+ * @return bool
+ */
+ public function offsetExists($entry) {}
+
+ /**
+ * @param string $entry
+ * @return PharFileInfo
+ */
+ public function offsetGet($entry) {}
+
+ /**
+ * @param string $entry
+ * @param resource|string $value
+ * @return void
+ */
+ public function offsetSet($entry, $value) {}
+
+ /**
+ * @param string $entry
+ * @return bool
+ */
+ public function offsetUnset($entry) {}
+
+ /** @return bool */
+ public function setAlias(string $alias) {}
+
+ /** @return bool */
+ public function setDefaultStub(?string $index = null, string $webindex = UNKNOWN) {}
+
+ /**
+ * @param mixed $metadata
+ * @return void
+ */
+ public function setMetadata($metadata) {}
+
+ /** @return void */
+ public function setSignatureAlgorithm(int $algorithm, string $privatekey = UNKNOWN) {}
+
+ /**
+ * @param resource $newstub
+ * @return bool
+ */
+ public function setStub($newstub, $maxlen = -1) {}
+
+ /** @return void */
+ public function startBuffering() {}
+
+ /** @return void */
+ public function stopBuffering() {}
+
+ /** @return string */
+ final public static function apiVersion() {}
+
+ /** @return bool */
+ final public static function canCompress(int $method = 0) {}
+
+ /** @return bool */
+ final public static function canWrite() {}
+
+ /** @return string */
+ final public static function createDefaultStub(string $index = UNKNOWN, string $webindex = UNKNOWN) {}
+
+ /** @return array */
+ final public static function getSupportedCompression() {}
+
+ /** @return array */
+ final public static function getSupportedSignatures() {}
+
+ /** @return void */
+ final public static function interceptFileFuncs() {}
+
+ /** @return bool */
+ final public static function isValidPharFilename(string $filename, bool $executable = true) {}
+
+ /** @return bool */
+ final public static function loadPhar(string $filename, ?string $alias = null) {}
+
+ /** @return bool */
+ final public static function mapPhar(?string $alias = null, int $offset = 0) {}
+
+ /** @return string */
+ final public static function running(bool $retphar = true) {}
+
+ /** @return void */
+ final public static function mount(string $inphar, string $externalfile) {}
+
+ /** @return void */
+ final public static function mungServer(array $munglist) {}
+
+ /** @return bool */
+ final public static function unlinkArchive(string $archive) {}
+
+ /** @return void */
+ final public static function webPhar(?string $alias = null, ?string $index = null, string $f404 = UNKNOWN, array $mimetypes = [], $rewrites = UNKNOWN) {}
+}
+
+class PharFileInfo extends SplFileInfo
+{
+ public function __construct(string $filename) {}
+
+ public function __destruct() {}
+
+ /** @return void */
+ public function chmod(int $perms) {}
+
+ /** @return bool */
+ public function compress(int $compression_type) {}
+
+ /** @return bool */
+ public function decompress() {}
+
+ /** @return bool */
+ public function delMetadata() {}
+
+ /** @return int */
+ public function getCompressedSize() {}
+
+ /** @return int */
+ public function getCRC32() {}
+
+ /** @return string */
+ public function getContent() {}
+
+ public function getMetadata() {}
+
+ /** @return int */
+ public function getPharFlags() {}
+
+ /** @return bool */
+ public function hasMetadata() {}
+
+ /** @return bool */
+ public function isCompressed($compression_type = 9021976) {}
+
+ /** @return bool */
+ public function isCRCChecked() {}
+
+ /** @return void */
+ public function setMetadata($metadata) {}
+}
diff --git a/ext/phar/phar_object_arginfo.h b/ext/phar/phar_object_arginfo.h
new file mode 100644
index 0000000000..ef19b6e018
--- /dev/null
+++ b/ext/phar/phar_object_arginfo.h
@@ -0,0 +1,356 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar___construct, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, alias, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar___destruct, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar_addEmptyDir, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, dirname, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar_addFile, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, localname, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar_addFromString, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, localname, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, contents, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar_buildFromDirectory, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, base_dir, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, regex, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar_buildFromIterator, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, iterator, Traversable, 0)
+ ZEND_ARG_TYPE_INFO(0, base_directory, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar_compressFiles, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, compression_type, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_Phar_decompressFiles arginfo_class_Phar___destruct
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar_compress, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, compression_type, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, file_ext, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar_decompress, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, file_ext, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar_convertToExecutable, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, format, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, compression_type, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, file_ext, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_Phar_convertToData arginfo_class_Phar_convertToExecutable
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar_copy, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, newfile, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, oldfile, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar_count, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar_delete, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, entry, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_Phar_delMetadata arginfo_class_Phar___destruct
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar_extractTo, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, pathto, IS_STRING, 0)
+ ZEND_ARG_INFO(0, files)
+ ZEND_ARG_TYPE_INFO(0, overwrite, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_Phar_getAlias arginfo_class_Phar___destruct
+
+#define arginfo_class_Phar_getPath arginfo_class_Phar___destruct
+
+#define arginfo_class_Phar_getMetadata arginfo_class_Phar___destruct
+
+#define arginfo_class_Phar_getModified arginfo_class_Phar___destruct
+
+#define arginfo_class_Phar_getSignature arginfo_class_Phar___destruct
+
+#define arginfo_class_Phar_getStub arginfo_class_Phar___destruct
+
+#define arginfo_class_Phar_getVersion arginfo_class_Phar___destruct
+
+#define arginfo_class_Phar_hasMetadata arginfo_class_Phar___destruct
+
+#define arginfo_class_Phar_isBuffering arginfo_class_Phar___destruct
+
+#define arginfo_class_Phar_isCompressed arginfo_class_Phar___destruct
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar_isFileFormat, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, fileformat, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_Phar_isWritable arginfo_class_Phar___destruct
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar_offsetExists, 0, 0, 1)
+ ZEND_ARG_INFO(0, entry)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_Phar_offsetGet arginfo_class_Phar_offsetExists
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar_offsetSet, 0, 0, 2)
+ ZEND_ARG_INFO(0, entry)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_Phar_offsetUnset arginfo_class_Phar_offsetExists
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar_setAlias, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, alias, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar_setDefaultStub, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, index, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, webindex, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar_setMetadata, 0, 0, 1)
+ ZEND_ARG_INFO(0, metadata)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar_setSignatureAlgorithm, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, algorithm, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, privatekey, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar_setStub, 0, 0, 1)
+ ZEND_ARG_INFO(0, newstub)
+ ZEND_ARG_INFO(0, maxlen)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_Phar_startBuffering arginfo_class_Phar___destruct
+
+#define arginfo_class_Phar_stopBuffering arginfo_class_Phar___destruct
+
+#define arginfo_class_Phar_apiVersion arginfo_class_Phar___destruct
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar_canCompress, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, method, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_Phar_canWrite arginfo_class_Phar___destruct
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar_createDefaultStub, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, index, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, webindex, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_Phar_getSupportedCompression arginfo_class_Phar___destruct
+
+#define arginfo_class_Phar_getSupportedSignatures arginfo_class_Phar___destruct
+
+#define arginfo_class_Phar_interceptFileFuncs arginfo_class_Phar___destruct
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar_isValidPharFilename, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, executable, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar_loadPhar, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, alias, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar_mapPhar, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, alias, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar_running, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, retphar, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar_mount, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, inphar, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, externalfile, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar_mungServer, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, munglist, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar_unlinkArchive, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, archive, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Phar_webPhar, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, alias, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, index, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, f404, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mimetypes, IS_ARRAY, 0)
+ ZEND_ARG_INFO(0, rewrites)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PharData___construct, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, alias, IS_STRING, 1)
+ ZEND_ARG_INFO(0, fileformat)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_PharData___destruct arginfo_class_Phar___destruct
+
+#define arginfo_class_PharData_addEmptyDir arginfo_class_Phar_addEmptyDir
+
+#define arginfo_class_PharData_addFile arginfo_class_Phar_addFile
+
+#define arginfo_class_PharData_addFromString arginfo_class_Phar_addFromString
+
+#define arginfo_class_PharData_buildFromDirectory arginfo_class_Phar_buildFromDirectory
+
+#define arginfo_class_PharData_buildFromIterator arginfo_class_Phar_buildFromIterator
+
+#define arginfo_class_PharData_compressFiles arginfo_class_Phar_compressFiles
+
+#define arginfo_class_PharData_decompressFiles arginfo_class_Phar___destruct
+
+#define arginfo_class_PharData_compress arginfo_class_Phar_compress
+
+#define arginfo_class_PharData_decompress arginfo_class_Phar_decompress
+
+#define arginfo_class_PharData_convertToExecutable arginfo_class_Phar_convertToExecutable
+
+#define arginfo_class_PharData_convertToData arginfo_class_Phar_convertToExecutable
+
+#define arginfo_class_PharData_copy arginfo_class_Phar_copy
+
+#define arginfo_class_PharData_count arginfo_class_Phar_count
+
+#define arginfo_class_PharData_delete arginfo_class_Phar_delete
+
+#define arginfo_class_PharData_delMetadata arginfo_class_Phar___destruct
+
+#define arginfo_class_PharData_extractTo arginfo_class_Phar_extractTo
+
+#define arginfo_class_PharData_getAlias arginfo_class_Phar___destruct
+
+#define arginfo_class_PharData_getPath arginfo_class_Phar___destruct
+
+#define arginfo_class_PharData_getMetadata arginfo_class_Phar___destruct
+
+#define arginfo_class_PharData_getModified arginfo_class_Phar___destruct
+
+#define arginfo_class_PharData_getSignature arginfo_class_Phar___destruct
+
+#define arginfo_class_PharData_getStub arginfo_class_Phar___destruct
+
+#define arginfo_class_PharData_getVersion arginfo_class_Phar___destruct
+
+#define arginfo_class_PharData_hasMetadata arginfo_class_Phar___destruct
+
+#define arginfo_class_PharData_isBuffering arginfo_class_Phar___destruct
+
+#define arginfo_class_PharData_isCompressed arginfo_class_Phar___destruct
+
+#define arginfo_class_PharData_isFileFormat arginfo_class_Phar_isFileFormat
+
+#define arginfo_class_PharData_isWritable arginfo_class_Phar___destruct
+
+#define arginfo_class_PharData_offsetExists arginfo_class_Phar_offsetExists
+
+#define arginfo_class_PharData_offsetGet arginfo_class_Phar_offsetExists
+
+#define arginfo_class_PharData_offsetSet arginfo_class_Phar_offsetSet
+
+#define arginfo_class_PharData_offsetUnset arginfo_class_Phar_offsetExists
+
+#define arginfo_class_PharData_setAlias arginfo_class_Phar_setAlias
+
+#define arginfo_class_PharData_setDefaultStub arginfo_class_Phar_setDefaultStub
+
+#define arginfo_class_PharData_setMetadata arginfo_class_Phar_setMetadata
+
+#define arginfo_class_PharData_setSignatureAlgorithm arginfo_class_Phar_setSignatureAlgorithm
+
+#define arginfo_class_PharData_setStub arginfo_class_Phar_setStub
+
+#define arginfo_class_PharData_startBuffering arginfo_class_Phar___destruct
+
+#define arginfo_class_PharData_stopBuffering arginfo_class_Phar___destruct
+
+#define arginfo_class_PharData_apiVersion arginfo_class_Phar___destruct
+
+#define arginfo_class_PharData_canCompress arginfo_class_Phar_canCompress
+
+#define arginfo_class_PharData_canWrite arginfo_class_Phar___destruct
+
+#define arginfo_class_PharData_createDefaultStub arginfo_class_Phar_createDefaultStub
+
+#define arginfo_class_PharData_getSupportedCompression arginfo_class_Phar___destruct
+
+#define arginfo_class_PharData_getSupportedSignatures arginfo_class_Phar___destruct
+
+#define arginfo_class_PharData_interceptFileFuncs arginfo_class_Phar___destruct
+
+#define arginfo_class_PharData_isValidPharFilename arginfo_class_Phar_isValidPharFilename
+
+#define arginfo_class_PharData_loadPhar arginfo_class_Phar_loadPhar
+
+#define arginfo_class_PharData_mapPhar arginfo_class_Phar_mapPhar
+
+#define arginfo_class_PharData_running arginfo_class_Phar_running
+
+#define arginfo_class_PharData_mount arginfo_class_Phar_mount
+
+#define arginfo_class_PharData_mungServer arginfo_class_Phar_mungServer
+
+#define arginfo_class_PharData_unlinkArchive arginfo_class_Phar_unlinkArchive
+
+#define arginfo_class_PharData_webPhar arginfo_class_Phar_webPhar
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PharFileInfo___construct, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_PharFileInfo___destruct arginfo_class_Phar___destruct
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PharFileInfo_chmod, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, perms, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_PharFileInfo_compress arginfo_class_Phar_compressFiles
+
+#define arginfo_class_PharFileInfo_decompress arginfo_class_Phar___destruct
+
+#define arginfo_class_PharFileInfo_delMetadata arginfo_class_Phar___destruct
+
+#define arginfo_class_PharFileInfo_getCompressedSize arginfo_class_Phar___destruct
+
+#define arginfo_class_PharFileInfo_getCRC32 arginfo_class_Phar___destruct
+
+#define arginfo_class_PharFileInfo_getContent arginfo_class_Phar___destruct
+
+#define arginfo_class_PharFileInfo_getMetadata arginfo_class_Phar___destruct
+
+#define arginfo_class_PharFileInfo_getPharFlags arginfo_class_Phar___destruct
+
+#define arginfo_class_PharFileInfo_hasMetadata arginfo_class_Phar___destruct
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_PharFileInfo_isCompressed, 0, 0, 0)
+ ZEND_ARG_INFO(0, compression_type)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_PharFileInfo_isCRCChecked arginfo_class_Phar___destruct
+
+#define arginfo_class_PharFileInfo_setMetadata arginfo_class_Phar_setMetadata
diff --git a/ext/phar/tests/001.phpt b/ext/phar/tests/001.phpt
index 1205e4e1aa..b370bef746 100644
--- a/ext/phar/tests/001.phpt
+++ b/ext/phar/tests/001.phpt
@@ -6,7 +6,5 @@ Phar::apiVersion
<?php
var_dump(Phar::apiVersion());
?>
-===DONE===
--EXPECT--
string(5) "1.1.1"
-===DONE===
diff --git a/ext/phar/tests/002.phpt b/ext/phar/tests/002.phpt
index 41cb9be716..cfd8cc5e66 100644
--- a/ext/phar/tests/002.phpt
+++ b/ext/phar/tests/002.phpt
@@ -5,13 +5,17 @@ Phar::mapPhar truncated manifest/improper params
--FILE--
<?php
try {
-Phar::mapPhar(5, 'hio', 'hi');
+ Phar::mapPhar(5, 'hio', 'hi');
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
-Phar::mapPhar();
+try {
+ Phar::mapPhar();
} catch (Exception $e) {
- echo $e->getMessage();
+ echo $e->getMessage(), "\n";
}
__HALT_COMPILER(); ?>
--EXPECTF--
-Warning: Phar::mapPhar() expects at most 2 parameters, 3 given in %s002.php on line %d
+Phar::mapPhar() expects at most 2 parameters, 3 given
internal corruption of phar "%s002.php" (truncated manifest at manifest length)
diff --git a/ext/phar/tests/003.phpt b/ext/phar/tests/003.phpt
index fcc95a8481..6d57ebd400 100644
--- a/ext/phar/tests/003.phpt
+++ b/ext/phar/tests/003.phpt
@@ -6,8 +6,8 @@ Phar::canCompress
<?php
/* check this works and actually returns the boolean value */
var_dump(Phar::canCompress() == (
- extension_loaded("zlib") || extension_loaded("bz2")
- ));
+ extension_loaded("zlib") || extension_loaded("bz2")
+ ));
?>
--EXPECT--
bool(true)
diff --git a/ext/phar/tests/003a.phpt b/ext/phar/tests/003a.phpt
index 37e31072d4..20f178972a 100644
--- a/ext/phar/tests/003a.phpt
+++ b/ext/phar/tests/003a.phpt
@@ -7,8 +7,6 @@ Phar::canCompress, specific
var_dump(Phar::canCompress(Phar::GZ) == extension_loaded("zlib"));
var_dump(Phar::canCompress(Phar::BZ2) == extension_loaded("bz2"));
?>
-===DONE===
--EXPECT--
bool(true)
bool(true)
-===DONE===
diff --git a/ext/phar/tests/011.phpt b/ext/phar/tests/011.phpt
index 481086474c..b35e979d3f 100644
--- a/ext/phar/tests/011.phpt
+++ b/ext/phar/tests/011.phpt
@@ -12,7 +12,7 @@ $file = "<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";
-// compressed file length does not match incompressed lentgh for an uncompressed file
+// compressed file length does not match incompressed length for an uncompressed file
$files = array();
$files['a'] = array('cont'=>'a','ulen'=>1,'clen'=>2);
diff --git a/ext/phar/tests/013.phpt b/ext/phar/tests/013.phpt
index 7667a98db9..e486a560bc 100644
--- a/ext/phar/tests/013.phpt
+++ b/ext/phar/tests/013.phpt
@@ -20,4 +20,4 @@ echo file_get_contents($pname.'/a');
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
-Warning: file_get_contents(phar://%s/a): failed to open stream: phar error: internal corruption of phar "%s" (%s file "a") in %s on line %d
+Warning: file_get_contents(phar://%s/a): Failed to open stream: phar error: internal corruption of phar "%s" (%s file "a") in %s on line %d
diff --git a/ext/phar/tests/014.phpt b/ext/phar/tests/014.phpt
index 08247d1743..4ecee19e90 100644
--- a/ext/phar/tests/014.phpt
+++ b/ext/phar/tests/014.phpt
@@ -20,4 +20,4 @@ echo file_get_contents($pname.'/a');
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
-Warning: file_get_contents(phar://%s/a): failed to open stream: phar error: internal corruption of phar "%s" (crc32 mismatch on file "a") in %s on line %d
+Warning: file_get_contents(phar://%s/a): Failed to open stream: phar error: internal corruption of phar "%s" (crc32 mismatch on file "a") in %s on line %d
diff --git a/ext/phar/tests/016.phpt b/ext/phar/tests/016.phpt
index e94a17f059..e9f6458243 100644
--- a/ext/phar/tests/016.phpt
+++ b/ext/phar/tests/016.phpt
@@ -28,12 +28,12 @@ var_dump(file_get_contents($pname . '/d'));
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
-Warning: file_get_contents(phar://%s/a): failed to open stream: phar error: internal corruption of phar "%s" (actual filesize mismatch on file "a") in %s on line %d
+Warning: file_get_contents(phar://%s/a): Failed to open stream: phar error: internal corruption of phar "%s" (actual filesize mismatch on file "a") in %s on line %d
bool(false)
-Warning: file_get_contents(phar://%s/b): failed to open stream: phar error: internal corruption of phar "%s" (actual filesize mismatch on file "b") in %s on line %d
+Warning: file_get_contents(phar://%s/b): Failed to open stream: phar error: internal corruption of phar "%s" (actual filesize mismatch on file "b") in %s on line %d
bool(false)
string(1) "*"
-Warning: file_get_contents(phar://%s/d): failed to open stream: phar error: internal corruption of phar "%s" (actual filesize mismatch on file "d") in %s on line %d
+Warning: file_get_contents(phar://%s/d): Failed to open stream: phar error: internal corruption of phar "%s" (actual filesize mismatch on file "d") in %s on line %d
bool(false)
diff --git a/ext/phar/tests/016b.phpt b/ext/phar/tests/016b.phpt
index fa2727bede..465f94936d 100644
--- a/ext/phar/tests/016b.phpt
+++ b/ext/phar/tests/016b.phpt
@@ -21,4 +21,4 @@ echo file_get_contents($pname . '/a');
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
-Warning: file_get_contents(phar://%s/a): failed to open stream: phar error: internal corruption of phar "%s" (actual filesize mismatch on file "a") in %s on line %d
+Warning: file_get_contents(phar://%s/a): Failed to open stream: phar error: internal corruption of phar "%s" (actual filesize mismatch on file "a") in %s on line %d
diff --git a/ext/phar/tests/017.phpt b/ext/phar/tests/017.phpt
index 69169b7a0b..54c2eef13b 100644
--- a/ext/phar/tests/017.phpt
+++ b/ext/phar/tests/017.phpt
@@ -29,5 +29,5 @@ $dir = opendir('phar://hio');
string(%d) "%s017.phar.php"
bool(true)
-Warning: opendir(phar://hio): failed to open dir: phar error: no directory in "phar://hio", must have at least phar://hio/ for root directory (always use full path to a new phar)
+Warning: opendir(phar://hio): Failed to open directory: phar error: no directory in "phar://hio", must have at least phar://hio/ for root directory (always use full path to a new phar)
phar url "phar://hio" is unknown in %s017.php on line %d
diff --git a/ext/phar/tests/018.phpt b/ext/phar/tests/018.phpt
index 0f97b361d5..2b61b7e739 100644
--- a/ext/phar/tests/018.phpt
+++ b/ext/phar/tests/018.phpt
@@ -22,8 +22,8 @@ include 'files/phar_test.inc';
include $fname;
$dir = opendir('phar://hio/');
while (false !== ($a = readdir($dir))) {
- var_dump($a);
- var_dump(is_dir('phar://hio/' . $a));
+ var_dump($a);
+ var_dump(is_dir('phar://hio/' . $a));
}
?>
--CLEAN--
diff --git a/ext/phar/tests/019.phpt b/ext/phar/tests/019.phpt
index 44e2580f18..92f7b51f88 100644
--- a/ext/phar/tests/019.phpt
+++ b/ext/phar/tests/019.phpt
@@ -25,10 +25,10 @@ include $fname;
$dir = opendir('phar://hio/b');
if ($dir) {
- while (false !== ($a = readdir($dir))) {
- var_dump($a);
- var_dump(is_dir('phar://hio/b/' . $a));
- }
+ while (false !== ($a = readdir($dir))) {
+ var_dump($a);
+ var_dump(is_dir('phar://hio/b/' . $a));
+ }
}
?>
diff --git a/ext/phar/tests/019b.phpt b/ext/phar/tests/019b.phpt
index 99415eaa95..34404966b9 100644
--- a/ext/phar/tests/019b.phpt
+++ b/ext/phar/tests/019b.phpt
@@ -24,21 +24,21 @@ include $fname;
function dump($phar, $base)
{
- var_dump($phar . $base);
- $dir = opendir($phar . $base);
- if ($base == '/')
- {
- $base = '';
- }
- while (false !== ($entry = readdir($dir))) {
- $entry = $base . '/' . $entry;
- var_dump($entry);
- var_dump(is_dir($phar . $entry));
- if (is_dir($phar . $entry))
- {
- dump($phar, $entry);
- }
- }
+ var_dump($phar . $base);
+ $dir = opendir($phar . $base);
+ if ($base == '/')
+ {
+ $base = '';
+ }
+ while (false !== ($entry = readdir($dir))) {
+ $entry = $base . '/' . $entry;
+ var_dump($entry);
+ var_dump(is_dir($phar . $entry));
+ if (is_dir($phar . $entry))
+ {
+ dump($phar, $entry);
+ }
+ }
}
dump('phar://hio', '/');
diff --git a/ext/phar/tests/019c.phpt b/ext/phar/tests/019c.phpt
index 5eaac90ac7..460b8f5397 100644
--- a/ext/phar/tests/019c.phpt
+++ b/ext/phar/tests/019c.phpt
@@ -24,25 +24,25 @@ include $fname;
function dump($phar, $base)
{
- var_dump($phar . $base);
- $dir = opendir($phar . $base);
- if ($base == '/')
- {
- $base = '';
- }
- while (false !== ($entry = readdir($dir))) {
- $entry = $base . '/' . $entry;
- var_dump($entry);
- var_dump(is_dir($phar . $entry));
- if (is_dir($phar . $entry))
- {
- dump($phar, $entry);
- }
- else
- {
- var_dump(file_get_contents($phar . $entry));
- }
- }
+ var_dump($phar . $base);
+ $dir = opendir($phar . $base);
+ if ($base == '/')
+ {
+ $base = '';
+ }
+ while (false !== ($entry = readdir($dir))) {
+ $entry = $base . '/' . $entry;
+ var_dump($entry);
+ var_dump(is_dir($phar . $entry));
+ if (is_dir($phar . $entry))
+ {
+ dump($phar, $entry);
+ }
+ else
+ {
+ var_dump(file_get_contents($phar . $entry));
+ }
+ }
}
dump('phar://hio', '/');
diff --git a/ext/phar/tests/023.phpt b/ext/phar/tests/023.phpt
index f6920a48e0..e16e870b59 100644
--- a/ext/phar/tests/023.phpt
+++ b/ext/phar/tests/023.phpt
@@ -22,11 +22,9 @@ var_dump(file_get_contents($pname . '/b.php'));
var_dump(file_get_contents($pname . '/b/c.php'));
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECT--
string(28) "<?php echo "This is a\n"; ?>"
string(28) "<?php echo "This is b\n"; ?>"
string(30) "<?php echo "This is b/c\n"; ?>"
-===DONE===
diff --git a/ext/phar/tests/024-opcache-win32.phpt b/ext/phar/tests/024-opcache-win32.phpt
index 81eedd9668..b9d80929cc 100644
--- a/ext/phar/tests/024-opcache-win32.phpt
+++ b/ext/phar/tests/024-opcache-win32.phpt
@@ -39,23 +39,21 @@ include $pname . '/b/c.php';
$cache_dir = ini_get("opcache.file_cache");
if (is_dir($cache_dir)) {
- $it = new RecursiveIteratorIterator(
- new RecursiveDirectoryIterator($cache_dir, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST
- );
- foreach ($it as $fi) {
- $fn = ($fi->isDir() ? 'rmdir' : 'unlink');
- $fn($fi->getRealPath());
- }
-
- rmdir($cache_dir);
+ $it = new RecursiveIteratorIterator(
+ new RecursiveDirectoryIterator($cache_dir, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST
+ );
+ foreach ($it as $fi) {
+ $fn = ($fi->isDir() ? 'rmdir' : 'unlink');
+ $fn($fi->getRealPath());
+ }
+
+ rmdir($cache_dir);
}
?>
-===DONE===
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECT--
This is a
This is b
This is b/c
-===DONE===
diff --git a/ext/phar/tests/024.phpt b/ext/phar/tests/024.phpt
index 8ec0911e74..f0477dee42 100644
--- a/ext/phar/tests/024.phpt
+++ b/ext/phar/tests/024.phpt
@@ -22,11 +22,9 @@ include $pname . '/b.php';
include $pname . '/b/c.php';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECT--
This is a
This is b
This is b/c
-===DONE===
diff --git a/ext/phar/tests/025.phpt b/ext/phar/tests/025.phpt
index 76f2b1eb77..de2030448e 100644
--- a/ext/phar/tests/025.phpt
+++ b/ext/phar/tests/025.phpt
@@ -22,11 +22,9 @@ include $pname . '/b';
include $pname . '/b/b';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECT--
This is a
This is b
This is b/b
-===DONE===
diff --git a/ext/phar/tests/026.phpt b/ext/phar/tests/026.phpt
index d58555343f..05e11f6a58 100644
--- a/ext/phar/tests/026.phpt
+++ b/ext/phar/tests/026.phpt
@@ -22,7 +22,6 @@ include 'files/phar_test.inc';
require $pname . '/a.php';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECT--
@@ -31,4 +30,3 @@ This is b
This is b/c
This is b/d
This is e
-===DONE===
diff --git a/ext/phar/tests/027.phpt b/ext/phar/tests/027.phpt
index 89b7252727..4820c74c2e 100644
--- a/ext/phar/tests/027.phpt
+++ b/ext/phar/tests/027.phpt
@@ -23,21 +23,21 @@ include 'files/phar_test.inc';
function dump($phar, $base)
{
- var_dump(str_replace(__DIR__, '*', $phar) . $base);
- $dir = opendir($phar . $base);
- if ($base == '/')
- {
- $base = '';
- }
- while (false !== ($entry = readdir($dir))) {
- $entry = $base . '/' . $entry;
- var_dump($entry);
- var_dump(is_dir($phar . $entry));
- if (is_dir($phar . $entry))
- {
- dump($phar, $entry);
- }
- }
+ var_dump(str_replace(__DIR__, '*', $phar) . $base);
+ $dir = opendir($phar . $base);
+ if ($base == '/')
+ {
+ $base = '';
+ }
+ while (false !== ($entry = readdir($dir))) {
+ $entry = $base . '/' . $entry;
+ var_dump($entry);
+ var_dump(is_dir($phar . $entry));
+ if (is_dir($phar . $entry))
+ {
+ dump($phar, $entry);
+ }
+ }
}
dump($pname, '/');
@@ -56,7 +56,6 @@ echo "opendir edge cases\n";
var_dump(opendir("phar://"));
var_dump(opendir("phar://foo.phar/hi"));
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
@@ -86,11 +85,10 @@ bool(false)
bool(false)
opendir edge cases
-Warning: opendir(phar://): failed to open dir: phar error: no directory in "phar://", must have at least phar:/// for root directory (always use full path to a new phar)
+Warning: opendir(phar://): Failed to open directory: phar error: no directory in "phar://", must have at least phar:/// for root directory (always use full path to a new phar)
phar url "phar://" is unknown in %s027.php on line %d
bool(false)
-Warning: opendir(phar://foo.phar/hi): failed to open dir: phar error: invalid url or non-existent phar "phar://foo.phar/hi"
+Warning: opendir(phar://foo.phar/hi): Failed to open directory: phar error: invalid url or non-existent phar "phar://foo.phar/hi"
phar url "phar://foo.phar/hi" is unknown in %s027.php on line %d
bool(false)
-===DONE===
diff --git a/ext/phar/tests/028.phpt b/ext/phar/tests/028.phpt
index 19f1d988a3..89789381e0 100644
--- a/ext/phar/tests/028.phpt
+++ b/ext/phar/tests/028.phpt
@@ -29,7 +29,6 @@ echo "======\n";
include $pname . '/a.php';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECT--
@@ -44,4 +43,3 @@ This is b
This is b/c
This is b/d
This is e
-===DONE===
diff --git a/ext/phar/tests/029.phpt b/ext/phar/tests/029.phpt
index dc7f3acb63..470516ef76 100644
--- a/ext/phar/tests/029.phpt
+++ b/ext/phar/tests/029.phpt
@@ -29,15 +29,14 @@ var_dump(Phar::loadPhar($fname1, 'copy'));
$a = new Phar($fname1);
try
{
- var_dump(Phar::loadPhar($fname2, 'copy'));
+ var_dump(Phar::loadPhar($fname2, 'copy'));
}
catch (Exception $e)
{
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.1.phar.php');
@@ -47,4 +46,3 @@ unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.2.phar.php');
bool(true)
bool(true)
alias "copy" is already used for archive "%s029.1.phar.php" cannot be overloaded with "%s029.2.phar.php"
-===DONE===
diff --git a/ext/phar/tests/030.phpt b/ext/phar/tests/030.phpt
index 7132383d80..3ab5292c25 100644
--- a/ext/phar/tests/030.phpt
+++ b/ext/phar/tests/030.phpt
@@ -32,7 +32,6 @@ $p['.phar/test'];
echo $e->getMessage(),"\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
@@ -45,4 +44,3 @@ This is b/d
This is e
bool(false)
Cannot directly get any files or directories in magic ".phar" directory
-===DONE===
diff --git a/ext/phar/tests/033.phpt b/ext/phar/tests/033.phpt
index 9beb281912..4d3582ae11 100644
--- a/ext/phar/tests/033.phpt
+++ b/ext/phar/tests/033.phpt
@@ -30,7 +30,6 @@ var_dump($a['dir']->isReadable());
$a['dir']->chmod(0666);
var_dump($a['dir']->isReadable());
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.1.phar.php');
@@ -44,4 +43,3 @@ bool(true)
bool(true)
bool(false)
bool(true)
-===DONE===
diff --git a/ext/phar/tests/033a.phpt b/ext/phar/tests/033a.phpt
index 548121f842..3186c1853b 100644
--- a/ext/phar/tests/033a.phpt
+++ b/ext/phar/tests/033a.phpt
@@ -15,17 +15,16 @@ $files = array();
$files['a.php'] = '<?php echo "This is a\n"; include "'.$pname.'/b.php"; ?>';
include 'files/phar_test.inc';
try {
- $a = new Phar($fname);
- var_dump($a['a.php']->isExecutable());
- $a['a.php']->chmod(0777);
- var_dump($a['a.php']->isExecutable());
- $a['a.php']->chmod(0666);
- var_dump($a['a.php']->isExecutable());
+ $a = new Phar($fname);
+ var_dump($a['a.php']->isExecutable());
+ $a['a.php']->chmod(0777);
+ var_dump($a['a.php']->isExecutable());
+ $a['a.php']->chmod(0666);
+ var_dump($a['a.php']->isExecutable());
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.1.phar.php');
@@ -33,4 +32,3 @@ unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.1.phar.php');
--EXPECTF--
bool(false)
Cannot modify permissions for file "a.php" in phar "%s033a.1.phar.php", write operations are prohibited
-===DONE===
diff --git a/ext/phar/tests/addfuncs.phpt b/ext/phar/tests/addfuncs.phpt
index a099dc4ed9..17073ab17e 100644
--- a/ext/phar/tests/addfuncs.phpt
+++ b/ext/phar/tests/addfuncs.phpt
@@ -39,7 +39,6 @@ $phar->addFromString('.phar/stub.php', 'hi');
echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
@@ -50,4 +49,3 @@ Entry a does not exist and cannot be created: phar error: file "a" in phar "%sad
phar error: unable to open file "%s/does/not/exist" to add to phar archive
Cannot create any files in magic ".phar" directory
Cannot create any files in magic ".phar" directory
-===DONE===
diff --git a/ext/phar/tests/alias_acrobatics.phpt b/ext/phar/tests/alias_acrobatics.phpt
index 56391def63..c30b2a3b07 100644
--- a/ext/phar/tests/alias_acrobatics.phpt
+++ b/ext/phar/tests/alias_acrobatics.phpt
@@ -32,7 +32,6 @@ $b = new Phar($fname, 0, 'another');
echo $e->getMessage(),"\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar');
@@ -43,4 +42,3 @@ alias "foo" is already used for archive "%salias_acrobatics.phar" cannot be over
2
Cannot open archive "%salias_acrobatics.2.phar", alias is already in use by existing archive
alias "another" is already used for archive "%salias_acrobatics.phar" cannot be overloaded with "%salias_acrobatics.phar"
-===DONE===
diff --git a/ext/phar/tests/badparameters.phpt b/ext/phar/tests/badparameters.phpt
index c5ea1d216f..3ee49890c9 100644
--- a/ext/phar/tests/badparameters.phpt
+++ b/ext/phar/tests/badparameters.phpt
@@ -8,200 +8,261 @@ phar.readonly=0
<?php
ini_set('phar.readonly', 1);
-function print_exception($e) {
- echo "\nException: " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine() . "\n";
+try {
+ Phar::mungServer('hi');
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ Phar::createDefaultStub(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ Phar::loadPhar(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ Phar::canCompress('hi');
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
}
-
-Phar::mungServer('hi');
-Phar::createDefaultStub(array());
-Phar::loadPhar(array());
-Phar::canCompress('hi');
try {
- $a = new Phar(array());
+ $a = new Phar(array());
} catch (TypeError $e) {
- print_exception($e);
+ echo $e->getMessage(), "\n";
}
try {
- $a = new Phar(__DIR__ . '/files/frontcontroller10.phar');
+ $a = new Phar(__DIR__ . '/files/frontcontroller10.phar');
} catch (PharException $e) {
- print_exception($e);
+ echo $e->getMessage(), "\n";
+}
+try {
+ $a->convertToExecutable(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
}
-$a->convertToExecutable(array());
-$a->convertToData(array());
try {
- $b = new PharData(__DIR__ . '/whatever.tar');
+ $a->convertToData(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $b = new PharData(__DIR__ . '/whatever.tar');
} catch (PharException $e) {
- print_exception($e);
+ echo $e->getMessage(), "\n";
}
try {
- $c = new PharData(__DIR__ . '/whatever.zip');
+ $c = new PharData(__DIR__ . '/whatever.zip');
} catch (PharException $e) {
- print_exception($e);
+ echo $e->getMessage(), "\n";
}
-$b->delete(array());
try {
-$a->delete('oops');
+ $b->delete(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $a->delete('oops');
} catch (Exception $e) {
-echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
-$b->delete('oops');
+ $b->delete('oops');
} catch (Exception $e) {
-echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
+}
+try {
+ echo $a->getPath() . "\n";
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
}
-echo $a->getPath() . "\n";
try {
-$a->setAlias('oops');
+ $a->setAlias('oops');
} catch (Exception $e) {
-echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
-$b->setAlias('oops');
+ $b->setAlias('oops');
} catch (Exception $e) {
-echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
ini_set('phar.readonly', 0);
-$a->setAlias(array());
+try {
+ $a->setAlias(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
ini_set('phar.readonly', 1);
try {
-$b->stopBuffering();
+ $b->stopBuffering();
} catch (Exception $e) {
-echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
-$a->setStub('oops');
+ $a->setStub('oops');
} catch (Exception $e) {
-echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
-$b->setStub('oops');
+ $b->setStub('oops');
} catch (Exception $e) {
-echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
ini_set('phar.readonly', 0);
-$a->setStub(array());
+try {
+ $a->setStub(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
ini_set('phar.readonly', 1);
try {
-$b->setDefaultStub('oops');
+ $b->setDefaultStub('oops');
} catch (Exception $e) {
-echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
+}
+try {
+ $a->setDefaultStub(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
}
-$a->setDefaultStub(array());
try {
-$a->setDefaultStub('oops');
+ $a->setDefaultStub('oops');
} catch (Exception $e) {
-echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
-$a->setSignatureAlgorithm(Phar::MD5);
+ $a->setSignatureAlgorithm(Phar::MD5);
} catch (Exception $e) {
-echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
-$a->compress(array());
try {
-$a->compress(1);
+ $a->compress(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $a->compress(1);
} catch (Exception $e) {
-echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
+}
+try {
+ $a->compressFiles(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
}
-$a->compressFiles(array());
try {
-$a->decompressFiles();
+ $a->decompressFiles();
} catch (Exception $e) {
-echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
-$a->copy(array());
try {
-$a->copy('a', 'b');
+ $a->copy(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $a->copy('a', 'b');
} catch (Exception $e) {
-echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
+}
+try {
+ $a->offsetExists(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $a->offsetGet(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
}
-$a->offsetExists(array());
-$a->offsetGet(array());
ini_set('phar.readonly', 0);
-$a->offsetSet(array());
+try {
+ $a->offsetSet(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
ini_set('phar.readonly', 1);
-$b->offsetUnset(array());
try {
-$a->offsetUnset('a');
+ $b->offsetUnset(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $a->offsetUnset('a');
} catch (Exception $e) {
-echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
+}
+try {
+ $a->addEmptyDir(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $a->addFile(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
}
-$a->addEmptyDir(array());
-$a->addFile(array());
-$a->addFromString(array());
try {
-$a->setMetadata('a');
+ $a->addFromString(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $a->setMetadata('a');
} catch (Exception $e) {
-echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
ini_set('phar.readonly', 0);
-$a->setMetadata(1,2);
+try {
+ $a->setMetadata(1,2);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
ini_set('phar.readonly', 1);
try {
-$a->delMetadata();
+ $a->delMetadata();
} catch (Exception $e) {
-echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--EXPECTF--
-Warning: Phar::mungServer() expects parameter 1 to be array, string given in %sbadparameters.php on line %d
-
-Warning: Phar::createDefaultStub() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
-
-Warning: Phar::loadPhar() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
-
-Warning: Phar::canCompress() expects parameter 1 to be int, string given in %sbadparameters.php on line %d
-
-Exception: Phar::__construct() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
-
-Warning: Phar::convertToExecutable() expects parameter 1 to be int, array given in %sbadparameters.php on line %d
-
-Warning: Phar::convertToData() expects parameter 1 to be int, array given in %sbadparameters.php on line %d
-
-Warning: PharData::delete() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
+Phar::mungServer() expects parameter 1 to be array, string given
+Phar::createDefaultStub() expects parameter 1 to be a valid path, array given
+Phar::loadPhar() expects parameter 1 to be a valid path, array given
+Phar::canCompress() expects parameter 1 to be int, string given
+Phar::__construct() expects parameter 1 to be a valid path, array given
+Phar::convertToExecutable() expects parameter 1 to be int, array given
+Phar::convertToData() expects parameter 1 to be int, array given
+PharData::delete() expects parameter 1 to be a valid path, array given
Cannot write out phar archive, phar is read-only
Entry oops does not exist and cannot be deleted
-%sfiles/frontcontroller10.phar
+%sfrontcontroller10.phar
Cannot write out phar archive, phar is read-only
A Phar alias cannot be set in a plain tar archive
-
-Warning: Phar::setAlias() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
+Phar::setAlias() expects parameter 1 to be string, array given
Cannot change stub, phar is read-only
A Phar stub cannot be set in a plain tar archive
-
-Warning: Phar::setStub() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
+Phar::setStub() expects parameter 1 to be string, array given
A Phar stub cannot be set in a plain tar archive
-
-Warning: Phar::setDefaultStub() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
+Phar::setDefaultStub() expects parameter 1 to be string, array given
Cannot change stub: phar.readonly=1
Cannot set signature algorithm, phar is read-only
-
-Warning: Phar::compress() expects parameter 1 to be int, array given in %sbadparameters.php on line %d
+Phar::compress() expects parameter 1 to be int, array given
Cannot compress phar archive, phar is read-only
-
-Warning: Phar::compressFiles() expects parameter 1 to be int, array given in %sbadparameters.php on line %d
+Phar::compressFiles() expects parameter 1 to be int, array given
Phar is readonly, cannot change compression
-
-Warning: Phar::copy() expects exactly 2 parameters, 1 given in %sbadparameters.php on line %d
+Phar::copy() expects exactly 2 parameters, 1 given
Cannot copy "a" to "b", phar is read-only
-
-Warning: Phar::offsetExists() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
-
-Warning: Phar::offsetGet() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
-
-Warning: Phar::offsetSet() expects exactly 2 parameters, 1 given in %sbadparameters.php on line %d
-
-Warning: PharData::offsetUnset() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
+Phar::offsetExists() expects parameter 1 to be a valid path, array given
+Phar::offsetGet() expects parameter 1 to be a valid path, array given
+Phar::offsetSet() expects exactly 2 parameters, 1 given
+PharData::offsetUnset() expects parameter 1 to be a valid path, array given
Write operations disabled by the php.ini setting phar.readonly
-
-Warning: Phar::addEmptyDir() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
-
-Warning: Phar::addFile() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
-
-Warning: Phar::addFromString() expects exactly 2 parameters, 1 given in %sbadparameters.php on line %d
+Phar::addEmptyDir() expects parameter 1 to be a valid path, array given
+Phar::addFile() expects parameter 1 to be a valid path, array given
+Phar::addFromString() expects exactly 2 parameters, 1 given
Write operations disabled by the php.ini setting phar.readonly
-
-Warning: Phar::setMetadata() expects exactly 1 parameter, 2 given in %sbadparameters.php on line %d
+Phar::setMetadata() expects exactly 1 parameter, 2 given
Write operations disabled by the php.ini setting phar.readonly
-===DONE===
diff --git a/ext/phar/tests/bug13727.phpt b/ext/phar/tests/bug13727.phpt
index 2db6637efc..ea406a4d8f 100644
--- a/ext/phar/tests/bug13727.phpt
+++ b/ext/phar/tests/bug13727.phpt
@@ -14,15 +14,14 @@ $pname = 'phar://' . $fname;
$pArchive="DataArchive.phar";
$p = new Phar($fname, 0, $pArchive);
for ($i = 0; $i < 4*1024; $i++){
- echo("$i\n");
- if (!is_dir($fileDir="$dirName/test_data"))
- mkdir($fileDir, 0777, true);
- file_put_contents("$fileDir/$i", "");
- $p->addFile("$fileDir/$i", "$dirName");
+ echo("$i\n");
+ if (!is_dir($fileDir="$dirName/test_data"))
+ mkdir($fileDir, 0777, true);
+ file_put_contents("$fileDir/$i", "");
+ $p->addFile("$fileDir/$i", "$dirName");
}
echo("\n Written Files($i)\n");
?>
-===DONE===
--CLEAN--
<?php
$dirName = __DIR__;
@@ -4133,4 +4132,3 @@ __HALT_COMPILER();
4095
Written Files(4096)
-===DONE===
diff --git a/ext/phar/tests/bug13786.phpt b/ext/phar/tests/bug13786.phpt
index 1fc1cfd502..76f05ef1fc 100644
--- a/ext/phar/tests/bug13786.phpt
+++ b/ext/phar/tests/bug13786.phpt
@@ -10,13 +10,13 @@ phar.readonly=0
try {
for ($i = 0; $i < 2; $i++) {
- $fname = "DataArchive.phar";
- $path = __DIR__ . DIRECTORY_SEPARATOR . $fname;
- $phar = new Phar($path);
- $phar->addFromString($i, "file $i in $fname");
- var_dump(file_get_contents($phar[$i]));
- unset($phar);
- unlink($path);
+ $fname = "DataArchive.phar";
+ $path = __DIR__ . DIRECTORY_SEPARATOR . $fname;
+ $phar = new Phar($path);
+ $phar->addFromString($i, "file $i in $fname");
+ var_dump(file_get_contents($phar[$i]));
+ unset($phar);
+ unlink($path);
}
echo("\nWritten files: $i\n");
@@ -25,8 +25,6 @@ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--EXPECTF--
string(26) "file 0 in DataArchive.phar"
unable to seek to start of file "0" while creating new phar "%sDataArchive.phar"
-===DONE===
diff --git a/ext/phar/tests/bug45218_SLOWTEST.phpt b/ext/phar/tests/bug45218_SLOWTEST.phpt
index c71a2be618..aee2aae788 100644
--- a/ext/phar/tests/bug45218_SLOWTEST.phpt
+++ b/ext/phar/tests/bug45218_SLOWTEST.phpt
@@ -39,19 +39,18 @@ class myIterator implements Iterator
}
}
try {
- chdir(__DIR__);
- $phar = new Phar($fname);
- $ret = $phar->buildFromIterator(new myIterator);
- foreach ($ret as $a => $val) {
- $ret[$a] = str_replace(dirname($fname2) . DIRECTORY_SEPARATOR, '*', $val);
- }
- var_dump($ret);
+ chdir(__DIR__);
+ $phar = new Phar($fname);
+ $ret = $phar->buildFromIterator(new myIterator);
+ foreach ($ret as $a => $val) {
+ $ret[$a] = str_replace(dirname($fname2) . DIRECTORY_SEPARATOR, '*', $val);
+ }
+ var_dump($ret);
} catch (Exception $e) {
- var_dump(get_class($e));
- echo $e->getMessage() . "\n";
+ var_dump(get_class($e));
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
@@ -6088,4 +6087,3 @@ array(2999) {
["f2999"]=>
string(22) "*bug45218_SLOWTEST.txt"
}
-===DONE===
diff --git a/ext/phar/tests/bug46032.phpt b/ext/phar/tests/bug46032.phpt
index a20e95d3ed..8f21bf4d59 100644
--- a/ext/phar/tests/bug46032.phpt
+++ b/ext/phar/tests/bug46032.phpt
@@ -9,13 +9,13 @@ Phar: bug #46032: PharData::__construct wrong memory read
$a = __DIR__ .'/mytest';
try {
- new phar($a);
+ new phar($a);
} catch (exception $e) { }
var_dump($a);
try {
- new phar($a);
+ new phar($a);
} catch (exception $e) { }
var_dump($a);
diff --git a/ext/phar/tests/bug46060.phpt b/ext/phar/tests/bug46060.phpt
index 02a4a7e867..f2df7ab60b 100644
--- a/ext/phar/tests/bug46060.phpt
+++ b/ext/phar/tests/bug46060.phpt
@@ -19,7 +19,6 @@ $phar = new PharData($fname2);
var_dump($phar['blah']->isDir(), $phar['test']->isDir());
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.tar');
@@ -29,4 +28,3 @@ __HALT_COMPILER();
--EXPECT--
bool(true)
bool(false)
-===DONE===
diff --git a/ext/phar/tests/bug47085.phpt b/ext/phar/tests/bug47085.phpt
index d1fcf506f6..9e8c3b9f5b 100644
--- a/ext/phar/tests/bug47085.phpt
+++ b/ext/phar/tests/bug47085.phpt
@@ -15,10 +15,8 @@ unset($phar);
rename("phar://a.phar/x", "phar://a.phar/y");
var_dump(rename("phar://a.phar/x", "phar://a.phar/y"));
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar');?>
--EXPECTF--
Warning: rename(): phar error: cannot rename "phar://a.phar/x" to "phar://a.phar/y" from extracted phar archive, source does not exist in %sbug47085.php on line %d
bool(false)
-===DONE===
diff --git a/ext/phar/tests/bug48377.2.phpt b/ext/phar/tests/bug48377.2.phpt
index 130aaa8646..cdc8a42953 100644
--- a/ext/phar/tests/bug48377.2.phpt
+++ b/ext/phar/tests/bug48377.2.phpt
@@ -12,14 +12,12 @@ $fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.zip';
$phar = new PharData($fname);
$phar['x'] = 'hi';
try {
- $phar->convertToData(Phar::ZIP, Phar::NONE, 'phar.zip');
+ $phar->convertToData(Phar::ZIP, Phar::NONE, 'phar.zip');
} catch (BadMethodCallException $e) {
- echo $e->getMessage(),"\n";
+ echo $e->getMessage(),"\n";
}
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.zip');?>
--EXPECTF--
data phar "%sbug48377.2.phar.zip" has invalid extension phar.zip
-===DONE===
diff --git a/ext/phar/tests/bug48377.phpt b/ext/phar/tests/bug48377.phpt
index 6c16654ef1..338d98a52f 100644
--- a/ext/phar/tests/bug48377.phpt
+++ b/ext/phar/tests/bug48377.phpt
@@ -15,15 +15,13 @@ touch($fname2);
$phar = new Phar($fname, 0, 'a.phar');
$phar['x'] = 'hi';
try {
- $phar->convertToData(Phar::ZIP, Phar::NONE, 'zip');
+ $phar->convertToData(Phar::ZIP, Phar::NONE, 'zip');
} catch (BadMethodCallException $e) {
- echo $e->getMessage(),"\n";
+ echo $e->getMessage(),"\n";
}
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar');?>
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.zip');?>
--EXPECTF--
phar "%sbug48377.zip" exists and must be unlinked prior to conversion
-===DONE===
diff --git a/ext/phar/tests/bug54395.phpt b/ext/phar/tests/bug54395.phpt
index a3d90a1b3e..fb041bc6ff 100644
--- a/ext/phar/tests/bug54395.phpt
+++ b/ext/phar/tests/bug54395.phpt
@@ -6,9 +6,9 @@ Bug #54395 (Phar::mount() crashes when calling with wrong parameters)
<?php
try {
- phar::mount(1,1);
+ phar::mount(1,1);
} catch (Exception $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
?>
diff --git a/ext/phar/tests/bug60164.phpt b/ext/phar/tests/bug60164.phpt
index 83883b6ee5..8cc2eceaa0 100644
--- a/ext/phar/tests/bug60164.phpt
+++ b/ext/phar/tests/bug60164.phpt
@@ -14,8 +14,6 @@ foreach (new RecursiveIteratorIterator(new Phar($phar, null, 'stuboflength1041.p
var_dump($item->getFileName());
}
?>
-===DONE===
--EXPECT--
string(5) "a.php"
string(5) "b.php"
-===DONE===
diff --git a/ext/phar/tests/bug60261.phpt b/ext/phar/tests/bug60261.phpt
index 31baa82394..7f32bf6482 100644
--- a/ext/phar/tests/bug60261.phpt
+++ b/ext/phar/tests/bug60261.phpt
@@ -7,9 +7,9 @@ Bug #60261 (phar dos null pointer)
try {
$nx = new Phar();
- $nx->getLinkTarget();
+ $nx->getLinkTarget();
} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+ echo $e->getMessage(), "\n";
}
?>
diff --git a/ext/phar/tests/bug64931/bug64931.phpt b/ext/phar/tests/bug64931/bug64931.phpt
index 4439fcf792..6bf3bea7c3 100644
--- a/ext/phar/tests/bug64931/bug64931.phpt
+++ b/ext/phar/tests/bug64931/bug64931.phpt
@@ -13,37 +13,36 @@ echo "Test\n";
$phar = new Phar(__DIR__."/bug64931.phar");
$phar->addFile(__DIR__."/src/.pharignore", ".pharignore");
try {
- $phar->addFile(__DIR__."/src/.pharignore", ".phar/gotcha");
+ $phar->addFile(__DIR__."/src/.pharignore", ".phar/gotcha");
} catch (Exception $e) {
- echo "CAUGHT: ". $e->getMessage() ."\n";
+ echo "CAUGHT: ". $e->getMessage() ."\n";
}
try {
- $phar->addFromString(".phar", "gotcha");
+ $phar->addFromString(".phar", "gotcha");
} catch (Exception $e) {
- echo "CAUGHT: ". $e->getMessage() ."\n";
+ echo "CAUGHT: ". $e->getMessage() ."\n";
}
try {
- $phar->addFromString(".phar//", "gotcha");
+ $phar->addFromString(".phar//", "gotcha");
} catch (Exception $e) {
- echo "CAUGHT: ". $e->getMessage() ."\n";
+ echo "CAUGHT: ". $e->getMessage() ."\n";
}
try {
- $phar->addFromString(".phar\\", "gotcha");
+ $phar->addFromString(".phar\\", "gotcha");
} catch (Exception $e) {
- echo "CAUGHT: ". $e->getMessage() ."\n";
+ echo "CAUGHT: ". $e->getMessage() ."\n";
}
try {
- $phar->addFromString(".phar\0", "gotcha");
-} catch (Exception $e) {
- echo "CAUGHT: ". $e->getMessage() ."\n";
+ $phar->addFromString(".phar\0", "gotcha");
+} catch (TypeError $e) {
+ echo "CAUGHT: ". $e->getMessage() ."\n";
}
?>
-===DONE===
--CLEAN--
<?php
@unlink(__DIR__."/bug64931.phar");
@@ -54,6 +53,4 @@ CAUGHT: Cannot create any files in magic ".phar" directory
CAUGHT: Cannot create any files in magic ".phar" directory
CAUGHT: Cannot create any files in magic ".phar" directory
CAUGHT: Cannot create any files in magic ".phar" directory
-
-Warning: Phar::addFromString() expects parameter 1 to be a valid path, string given in %s%ebug64931.php on line %d
-===DONE===
+CAUGHT: Phar::addFromString() expects parameter 1 to be a valid path, string given
diff --git a/ext/phar/tests/bug65028.phpt b/ext/phar/tests/bug65028.phpt
index 7d24ead69d..106b3ad633 100644
--- a/ext/phar/tests/bug65028.phpt
+++ b/ext/phar/tests/bug65028.phpt
@@ -8,120 +8,120 @@ phar.readonly=0
<?php
$files = array(
- "lib/widgets/Widgets.php",
- "lib/events/FormBeginEventArgs.php",
- "lib/events/FormEndEventArgs.php",
- "lib/Core.php",
- "lib/database/MySqlDatabase.php",
- "lib/utils/DateUtil.php",
- "js/global.js",
- "files/_emptyDirectory",
- "files/search/schema.xml",
- "vendor/Fusonic/Linq/Internal/WhereIterator.php",
- "vendor/Fusonic/Linq/Internal/SelectManyIterator.php",
- "vendor/Fusonic/Linq/Internal/SelectIterator.php",
- "vendor/Fusonic/Linq/Internal/DiffIterator.php",
- "vendor/Fusonic/Linq/Internal/GroupIterator.php",
- "vendor/Fusonic/Linq/Internal/DistinctIterator.php",
- "vendor/Fusonic/Linq/Internal/LinqHelper.php",
- "vendor/Fusonic/Linq/Internal/OrderIterator.php",
- "vendor/Fusonic/Linq/Internal/IntersectIterator.php",
- "vendor/Fusonic/Linq/GroupedLinq.php",
- "vendor/Fusonic/Linq.php",
- "vendor/Fusonic/UI/Widgets/Forms/FormBegin.php",
- "vendor/Fusonic/UI/Widgets/Forms/FormSectionBuilder.php",
- "vendor/Fusonic/UI/Widgets/Forms/AutoSelect.php",
- "vendor/Fusonic/UI/Widgets/Forms/ControlGroup.php",
- "vendor/Fusonic/UI/Widgets/Forms/FormEnd.php",
- "vendor/Fusonic/UI/Widgets/WidgetBase.php",
- "modules/calendar/ajax/calendarGetInvitedUsersContentAjaxHandler.php",
- "modules/calendar/js/calendarAppointmentForm.js",
- "modules/calendar/misc/calendarAppointment.php",
- "modules/calendar/pages/forms/calendarAppointmentForm.php",
- "modules/calendar/setup/config.xml",
- "modules/cmt/js/cmtMicroCommentsWidget.js",
- "modules/cmt/setup/config.xml",
- "modules/meta/misc/metaContentHelper.php",
- "modules/meta/setup/config.xml",
- "modules/brd/misc/brdPostStreamFormatter.php",
- "modules/brd/misc/brdPost.php",
- "modules/brd/setup/config/streamContents.xml",
- "modules/brd/setup/resources/lang/en.xml",
- "modules/brd/setup/resources/lang/de.xml",
- "modules/brd/setup/config.xml",
- "modules/auth/misc/authLoginService.php",
- "modules/auth/setup/config.xml",
- "modules/bwd/cache/bwdWordCacheCreator.php",
- "modules/bwd/bwd.php",
- "modules/bwd/setup/config.xml",
- "modules/nws/templates/pages/forms/nwsNewsForm.tpl",
- "modules/nws/templates/pages/nwsShowNewsPage.tpl",
- "modules/nws/pages/forms/nwsNewsForm.php",
- "modules/nws/pages/nwsShowNewsPage.php",
- "modules/nws/setup/config.xml",
- "modules/gmp/cache/gmpMarkersCacheCreator.php",
- "modules/gmp/select/gmpMapContentSelect.php",
- "modules/gmp/templates/gmpShowAppointmentPage.tpl",
- "modules/gmp/templates/gmpShowLinkPage.tpl",
- "modules/gmp/setup/config.xml",
- "modules/mul/cache/mulVideoPortalCacheCreator.php",
- "modules/mul/misc/mulPermissionHelper.php",
- "modules/mul/templates/widgets/mulFileEmbedWidget_Video_Flv.tpl",
- "modules/mul/setup/config/mulUploadVideoPortalMatches.xml",
- "modules/mul/setup/config.xml",
- "modules/cat/select/catCategorySelect.php",
- "modules/cat/misc/catCategory.php",
- "modules/cat/templates/pages/forms/catCategoryForm.tpl",
- "modules/cat/pages/forms/catEditCategoryForm.php",
- "modules/cat/pages/forms/catAddCategoryForm.php",
- "modules/cat/setup/config.xml",
- "modules/sty/events/styPageShowEventHandler.php",
- "modules/sty/misc/styBox.php",
- "modules/sty/templates/pages/forms/styLayoutForm.tpl",
- "modules/sty/templates/pages/forms/styBoxForm.tpl",
- "modules/sty/templates/pages/forms/styVariantForm.tpl",
- "modules/sty/setup/resources/lang/en.xml",
- "modules/sty/setup/resources/lang/de.xml",
- "modules/sty/setup/config.xml",
- "modules/reg/misc/regRegistrationHelper.php",
- "modules/reg/setup/config.xml",
- "modules/not/misc/notEmailNotificationProvider.php",
- "modules/not/setup/config.xml",
- "modules/styfusonic/setup/config.xml",
- "modules/sys/ajax/sysUserAutoSuggestSelectAjaxHandler.php",
- "modules/sys/js/sysUserAutoSuggestSelect.js",
- "modules/sys/select/sysPermissionSelect.php",
- "modules/sys/misc/sysHtaccessConfigWriter.php",
- "modules/sys/misc/sysUserRepository.php",
- "modules/sys/setup/resources/lang/en.xml",
- "modules/sys/setup/resources/lang/de.xml",
- "modules/sys/setup/config.xml",
- "modules/igr/boxes/igrGreatestEntriesBoxTab.php",
- "modules/igr/boxes/igrTopRatedEntriesBoxTab.php",
- "modules/igr/setup/config.xml",
- "modules/rat/ajax/ratRateAjaxHandler.php",
- "modules/rat/ajax/ratUnlikeAjaxHandler.php",
- "modules/rat/setup/config.xml",
- "modules/search/select/searchModuleSelect.php",
- "modules/search/select/searchOrderSelect.php",
- "modules/search/misc/searchResultFormatter.php",
- "modules/search/misc/searchProviderSolr.php",
- "modules/search/misc/searchProviderLucene.php",
- "modules/search/misc/searchResultItem.php",
- "modules/search/misc/searchProviderBase.php",
- "modules/search/misc/searchIProvider.php",
- "modules/search/templates/misc/searchResultFormatter.tpl",
- "modules/search/templates/pages/searchIndexPage.tpl",
- "modules/search/templates/pages/forms/searchSearchForm.tpl",
- "modules/search/pages/forms/searchSearchForm.php",
- "modules/search/css/searchResultFormatter.css",
- "modules/search/setup/config/sysSettings.xml",
- "modules/search/setup/resources/lang/en.xml",
- "modules/search/setup/resources/lang/de.xml",
- "modules/search/setup/config.xml",
- "style/Fusonic/40components.css",
- "style/_emptyDirectory",
- "index.php",
+ "lib/widgets/Widgets.php",
+ "lib/events/FormBeginEventArgs.php",
+ "lib/events/FormEndEventArgs.php",
+ "lib/Core.php",
+ "lib/database/MySqlDatabase.php",
+ "lib/utils/DateUtil.php",
+ "js/global.js",
+ "files/_emptyDirectory",
+ "files/search/schema.xml",
+ "vendor/Fusonic/Linq/Internal/WhereIterator.php",
+ "vendor/Fusonic/Linq/Internal/SelectManyIterator.php",
+ "vendor/Fusonic/Linq/Internal/SelectIterator.php",
+ "vendor/Fusonic/Linq/Internal/DiffIterator.php",
+ "vendor/Fusonic/Linq/Internal/GroupIterator.php",
+ "vendor/Fusonic/Linq/Internal/DistinctIterator.php",
+ "vendor/Fusonic/Linq/Internal/LinqHelper.php",
+ "vendor/Fusonic/Linq/Internal/OrderIterator.php",
+ "vendor/Fusonic/Linq/Internal/IntersectIterator.php",
+ "vendor/Fusonic/Linq/GroupedLinq.php",
+ "vendor/Fusonic/Linq.php",
+ "vendor/Fusonic/UI/Widgets/Forms/FormBegin.php",
+ "vendor/Fusonic/UI/Widgets/Forms/FormSectionBuilder.php",
+ "vendor/Fusonic/UI/Widgets/Forms/AutoSelect.php",
+ "vendor/Fusonic/UI/Widgets/Forms/ControlGroup.php",
+ "vendor/Fusonic/UI/Widgets/Forms/FormEnd.php",
+ "vendor/Fusonic/UI/Widgets/WidgetBase.php",
+ "modules/calendar/ajax/calendarGetInvitedUsersContentAjaxHandler.php",
+ "modules/calendar/js/calendarAppointmentForm.js",
+ "modules/calendar/misc/calendarAppointment.php",
+ "modules/calendar/pages/forms/calendarAppointmentForm.php",
+ "modules/calendar/setup/config.xml",
+ "modules/cmt/js/cmtMicroCommentsWidget.js",
+ "modules/cmt/setup/config.xml",
+ "modules/meta/misc/metaContentHelper.php",
+ "modules/meta/setup/config.xml",
+ "modules/brd/misc/brdPostStreamFormatter.php",
+ "modules/brd/misc/brdPost.php",
+ "modules/brd/setup/config/streamContents.xml",
+ "modules/brd/setup/resources/lang/en.xml",
+ "modules/brd/setup/resources/lang/de.xml",
+ "modules/brd/setup/config.xml",
+ "modules/auth/misc/authLoginService.php",
+ "modules/auth/setup/config.xml",
+ "modules/bwd/cache/bwdWordCacheCreator.php",
+ "modules/bwd/bwd.php",
+ "modules/bwd/setup/config.xml",
+ "modules/nws/templates/pages/forms/nwsNewsForm.tpl",
+ "modules/nws/templates/pages/nwsShowNewsPage.tpl",
+ "modules/nws/pages/forms/nwsNewsForm.php",
+ "modules/nws/pages/nwsShowNewsPage.php",
+ "modules/nws/setup/config.xml",
+ "modules/gmp/cache/gmpMarkersCacheCreator.php",
+ "modules/gmp/select/gmpMapContentSelect.php",
+ "modules/gmp/templates/gmpShowAppointmentPage.tpl",
+ "modules/gmp/templates/gmpShowLinkPage.tpl",
+ "modules/gmp/setup/config.xml",
+ "modules/mul/cache/mulVideoPortalCacheCreator.php",
+ "modules/mul/misc/mulPermissionHelper.php",
+ "modules/mul/templates/widgets/mulFileEmbedWidget_Video_Flv.tpl",
+ "modules/mul/setup/config/mulUploadVideoPortalMatches.xml",
+ "modules/mul/setup/config.xml",
+ "modules/cat/select/catCategorySelect.php",
+ "modules/cat/misc/catCategory.php",
+ "modules/cat/templates/pages/forms/catCategoryForm.tpl",
+ "modules/cat/pages/forms/catEditCategoryForm.php",
+ "modules/cat/pages/forms/catAddCategoryForm.php",
+ "modules/cat/setup/config.xml",
+ "modules/sty/events/styPageShowEventHandler.php",
+ "modules/sty/misc/styBox.php",
+ "modules/sty/templates/pages/forms/styLayoutForm.tpl",
+ "modules/sty/templates/pages/forms/styBoxForm.tpl",
+ "modules/sty/templates/pages/forms/styVariantForm.tpl",
+ "modules/sty/setup/resources/lang/en.xml",
+ "modules/sty/setup/resources/lang/de.xml",
+ "modules/sty/setup/config.xml",
+ "modules/reg/misc/regRegistrationHelper.php",
+ "modules/reg/setup/config.xml",
+ "modules/not/misc/notEmailNotificationProvider.php",
+ "modules/not/setup/config.xml",
+ "modules/styfusonic/setup/config.xml",
+ "modules/sys/ajax/sysUserAutoSuggestSelectAjaxHandler.php",
+ "modules/sys/js/sysUserAutoSuggestSelect.js",
+ "modules/sys/select/sysPermissionSelect.php",
+ "modules/sys/misc/sysHtaccessConfigWriter.php",
+ "modules/sys/misc/sysUserRepository.php",
+ "modules/sys/setup/resources/lang/en.xml",
+ "modules/sys/setup/resources/lang/de.xml",
+ "modules/sys/setup/config.xml",
+ "modules/igr/boxes/igrGreatestEntriesBoxTab.php",
+ "modules/igr/boxes/igrTopRatedEntriesBoxTab.php",
+ "modules/igr/setup/config.xml",
+ "modules/rat/ajax/ratRateAjaxHandler.php",
+ "modules/rat/ajax/ratUnlikeAjaxHandler.php",
+ "modules/rat/setup/config.xml",
+ "modules/search/select/searchModuleSelect.php",
+ "modules/search/select/searchOrderSelect.php",
+ "modules/search/misc/searchResultFormatter.php",
+ "modules/search/misc/searchProviderSolr.php",
+ "modules/search/misc/searchProviderLucene.php",
+ "modules/search/misc/searchResultItem.php",
+ "modules/search/misc/searchProviderBase.php",
+ "modules/search/misc/searchIProvider.php",
+ "modules/search/templates/misc/searchResultFormatter.tpl",
+ "modules/search/templates/pages/searchIndexPage.tpl",
+ "modules/search/templates/pages/forms/searchSearchForm.tpl",
+ "modules/search/pages/forms/searchSearchForm.php",
+ "modules/search/css/searchResultFormatter.css",
+ "modules/search/setup/config/sysSettings.xml",
+ "modules/search/setup/resources/lang/en.xml",
+ "modules/search/setup/resources/lang/de.xml",
+ "modules/search/setup/config.xml",
+ "style/Fusonic/40components.css",
+ "style/_emptyDirectory",
+ "index.php",
// "a", // This will make the test pass
);
@@ -129,7 +129,7 @@ $files = array(
$phar = new Phar(__DIR__ . "/bug65028.phar");
foreach($files as $file)
{
- $phar->addFromString($file, "");
+ $phar->addFromString($file, "");
}
// Copy phar
@@ -138,12 +138,12 @@ copy(__DIR__ . "/bug65028.phar", __DIR__ . "/bug65028-copy.phar");
// Open phar
try
{
- $phar = new Phar(__DIR__ . "/bug65028-copy.phar");
- echo "No exception thrown.\n";
+ $phar = new Phar(__DIR__ . "/bug65028-copy.phar");
+ echo "No exception thrown.\n";
}
catch(UnexpectedValueException $ex)
{
- echo "Exception thrown: " . $ex->getMessage() . "\n";
+ echo "Exception thrown: " . $ex->getMessage() . "\n";
}
?>
--CLEAN--
diff --git a/ext/phar/tests/bug69324.phpt b/ext/phar/tests/bug69324.phpt
index b3311c8651..1735fc8afe 100644
--- a/ext/phar/tests/bug69324.phpt
+++ b/ext/phar/tests/bug69324.phpt
@@ -11,7 +11,7 @@ $p = new Phar(__DIR__.'/bug69324.phar', 0);
$meta=$p->getMetadata();
var_dump($meta);
} catch(Exception $e) {
- echo $e->getMessage();
+ echo $e->getMessage();
}
--EXPECTF--
internal corruption of phar "%s" (truncated manifest entry)
diff --git a/ext/phar/tests/bug69441.phpt b/ext/phar/tests/bug69441.phpt
index 91e2dcf146..4dd136c506 100644
--- a/ext/phar/tests/bug69441.phpt
+++ b/ext/phar/tests/bug69441.phpt
@@ -8,14 +8,12 @@ $fname = __DIR__ . '/bug69441.phar';
try {
$r = new Phar($fname, 0);
} catch(UnexpectedValueException $e) {
- echo $e;
+ echo $e;
}
?>
-==DONE==
--EXPECTF--
UnexpectedValueException: phar error: corrupted central directory entry, no magic signature in zip-based phar "%sbug69441.phar" in %sbug69441.php:%d
Stack trace:
#0 %s%ebug69441.php(%d): Phar->__construct('%s', 0)
#1 {main}
-==DONE==
diff --git a/ext/phar/tests/bug69453.phpt b/ext/phar/tests/bug69453.phpt
index 3309d367c6..18b4a3949f 100644
--- a/ext/phar/tests/bug69453.phpt
+++ b/ext/phar/tests/bug69453.phpt
@@ -8,14 +8,12 @@ $fname = __DIR__ . '/bug69453.tar.phar';
try {
$r = new Phar($fname, 0);
} catch(UnexpectedValueException $e) {
- echo $e;
+ echo $e;
}
?>
-==DONE==
--EXPECTF--
UnexpectedValueException: phar error: "%s%ebug69453.tar.phar" is a corrupted tar file (checksum mismatch of file "") in %s:%d
Stack trace:
#0 %s%ebug69453.php(%d): Phar->__construct('%s', 0)
#1 {main}
-==DONE==
diff --git a/ext/phar/tests/bug69720.phpt b/ext/phar/tests/bug69720.phpt
index c0f76c7a0e..cdb4741ff8 100644
--- a/ext/phar/tests/bug69720.phpt
+++ b/ext/phar/tests/bug69720.phpt
@@ -8,13 +8,13 @@ try {
// open an existing phar
$p = new Phar(__DIR__."/bug69720.phar",0);
// Phar extends SPL's DirectoryIterator class
- echo $p->getMetadata();
+ echo $p->getMetadata();
foreach (new RecursiveIteratorIterator($p) as $file) {
// $file is a PharFileInfo class, and inherits from SplFileInfo
- $temp="";
+ $temp="";
$temp= $file->getFileName() . "\n";
$temp.=file_get_contents($file->getPathName()) . "\n"; // display contents
- var_dump($file->getMetadata());
+ var_dump($file->getMetadata());
}
}
catch (Exception $e) {
@@ -24,7 +24,7 @@ try {
--EXPECTF--
MY_METADATA_NULL
-Warning: file_get_contents(phar://%s): failed to open stream: phar error: "test.php" is not a file in phar "%s.phar" in %s.php on line %d
+Warning: file_get_contents(phar://%s): Failed to open stream: phar error: "test.php" is not a file in phar "%s.phar" in %s.php on line %d
array(1) {
["whatever"]=>
int(123)
diff --git a/ext/phar/tests/bug70019.phpt b/ext/phar/tests/bug70019.phpt
index edd77125e1..cc1fa3083d 100644
--- a/ext/phar/tests/bug70019.phpt
+++ b/ext/phar/tests/bug70019.phpt
@@ -12,7 +12,6 @@ if(!is_dir($dir)) {
$phar->extractTo($dir);
var_dump(file_exists("$dir/ThisIsATestFile.txt"));
?>
-===DONE===
--CLEAN--
<?php
$dir = __DIR__."/bug70019";
@@ -21,4 +20,3 @@ rmdir($dir);
?>
--EXPECT--
bool(true)
-===DONE===
diff --git a/ext/phar/tests/bug71498.phpt b/ext/phar/tests/bug71498.phpt
index 4157ac20b6..af24724e5c 100644
--- a/ext/phar/tests/bug71498.phpt
+++ b/ext/phar/tests/bug71498.phpt
@@ -7,7 +7,7 @@ Phar: bug #71498: Out-of-Bound Read in phar_parse_zipfile()
try {
$p = new PharData(__DIR__."/bug71498.zip");
} catch(UnexpectedValueException $e) {
- echo $e->getMessage();
+ echo $e->getMessage();
}
?>
diff --git a/ext/phar/tests/bug72321.phpt b/ext/phar/tests/bug72321.phpt
index 6e63da42d9..05413a0295 100644
--- a/ext/phar/tests/bug72321.phpt
+++ b/ext/phar/tests/bug72321.phpt
@@ -12,7 +12,7 @@ $phar = new PharData("72321_2.zip");
try {
$phar->extractTo("test72321");
} catch(PharException $e) {
- print $e->getMessage()."\n";
+ print $e->getMessage()."\n";
}
?>
DONE
diff --git a/ext/phar/tests/bug72928.phpt b/ext/phar/tests/bug72928.phpt
index 1277e88711..6d0e0ff623 100644
--- a/ext/phar/tests/bug72928.phpt
+++ b/ext/phar/tests/bug72928.phpt
@@ -9,7 +9,7 @@ try {
$phar = new PharData('bug72928.zip');
var_dump($phar);
} catch(UnexpectedValueException $e) {
- print $e->getMessage()."\n";
+ print $e->getMessage()."\n";
}
?>
DONE
diff --git a/ext/phar/tests/bug73035.phpt b/ext/phar/tests/bug73035.phpt
index ffdd36c52e..fefd0583bd 100644
--- a/ext/phar/tests/bug73035.phpt
+++ b/ext/phar/tests/bug73035.phpt
@@ -9,7 +9,7 @@ try {
$phar = new PharData('bug73035.tar');
var_dump($phar);
} catch(UnexpectedValueException $e) {
- print $e->getMessage()."\n";
+ print $e->getMessage()."\n";
}
?>
DONE
diff --git a/ext/phar/tests/bug73764.phpt b/ext/phar/tests/bug73764.phpt
index baff083265..fdabd78bbf 100644
--- a/ext/phar/tests/bug73764.phpt
+++ b/ext/phar/tests/bug73764.phpt
@@ -9,7 +9,7 @@ try {
$p = Phar::LoadPhar('bug73764.phar', 'alias.phar');
echo "OK\n";
} catch(PharException $e) {
- echo $e->getMessage();
+ echo $e->getMessage();
}
?>
--EXPECTF--
diff --git a/ext/phar/tests/bug73768.phpt b/ext/phar/tests/bug73768.phpt
index 3062268b80..cdaa6fa723 100644
--- a/ext/phar/tests/bug73768.phpt
+++ b/ext/phar/tests/bug73768.phpt
@@ -9,7 +9,7 @@ try {
$p = Phar::LoadPhar('bug73768.phar', 'alias.phar');
echo "OK\n";
} catch(PharException $e) {
- echo $e->getMessage();
+ echo $e->getMessage();
}
?>
--EXPECTF--
diff --git a/ext/phar/tests/bug74386.phpt b/ext/phar/tests/bug74386.phpt
index 0e60e00009..f5ff2d3cca 100644
--- a/ext/phar/tests/bug74386.phpt
+++ b/ext/phar/tests/bug74386.phpt
@@ -12,10 +12,8 @@ $r = new ReflectionMethod(PharData::class, '__construct');
var_dump($r->getNumberOfRequiredParameters());
var_dump($r->getNumberOfParameters());
?>
-===DONE===
--EXPECT--
int(1)
int(3)
int(1)
int(4)
-===DONE===
diff --git a/ext/phar/tests/bug77022.phpt b/ext/phar/tests/bug77022.phpt
index c78d1bdafd..c287bb339f 100644
--- a/ext/phar/tests/bug77022.phpt
+++ b/ext/phar/tests/bug77022.phpt
@@ -14,16 +14,16 @@ $sFile = tempnam(__DIR__, 'test77022');
var_dump(decoct(stat($sFile)['mode']));
foreach([Phar::TAR => 'tar', Phar::ZIP => 'zip'] as $mode => $ext) {
- clearstatcache();
- $phar = new PharData(__DIR__ . '/test77022.' . $ext, null, null, $mode);
- $phar->addFile($sFile, 'test-file-phar');
- $phar->addFromString("test-from-string", 'test-file-phar');
- $phar->extractTo(__DIR__);
- var_dump(decoct(stat(__DIR__ . '/test-file-phar')['mode']));
- var_dump(decoct(stat(__DIR__ . '/test-from-string')['mode']));
- unlink(__DIR__ . '/test-file-phar');
- unlink(__DIR__ . '/test-from-string');
- unlink(__DIR__ . '/test77022.' . $ext);
+ clearstatcache();
+ $phar = new PharData(__DIR__ . '/test77022.' . $ext, null, null, $mode);
+ $phar->addFile($sFile, 'test-file-phar');
+ $phar->addFromString("test-from-string", 'test-file-phar');
+ $phar->extractTo(__DIR__);
+ var_dump(decoct(stat(__DIR__ . '/test-file-phar')['mode']));
+ var_dump(decoct(stat(__DIR__ . '/test-from-string')['mode']));
+ unlink(__DIR__ . '/test-file-phar');
+ unlink(__DIR__ . '/test-from-string');
+ unlink(__DIR__ . '/test77022.' . $ext);
}
unlink($sFile);
?>
diff --git a/ext/phar/tests/bug77143.phpt b/ext/phar/tests/bug77143.phpt
index f9f80fc4f4..c19c9ed610 100644
--- a/ext/phar/tests/bug77143.phpt
+++ b/ext/phar/tests/bug77143.phpt
@@ -11,7 +11,7 @@ try {
var_dump(new Phar('bug77143.phar',0,'project.phar'));
echo "OK\n";
} catch(UnexpectedValueException $e) {
- echo $e->getMessage();
+ echo $e->getMessage();
}
?>
--EXPECTF--
diff --git a/ext/phar/tests/bug77247.phpt b/ext/phar/tests/bug77247.phpt
index 588975f9f2..3f7949293d 100644
--- a/ext/phar/tests/bug77247.phpt
+++ b/ext/phar/tests/bug77247.phpt
@@ -7,7 +7,7 @@ PHP bug #77247 (heap buffer overflow in phar_detect_phar_fname_ext)
try {
var_dump(new Phar('a/.b', 0,'test.phar'));
} catch(UnexpectedValueException $e) {
- echo "OK";
+ echo "OK";
}
?>
--EXPECT--
diff --git a/ext/phar/tests/cache_list/copyonwrite4a.phpt b/ext/phar/tests/cache_list/copyonwrite4a.phpt
index 948edced47..e0da5e7b8a 100644
--- a/ext/phar/tests/cache_list/copyonwrite4a.phpt
+++ b/ext/phar/tests/cache_list/copyonwrite4a.phpt
@@ -12,9 +12,7 @@ var_dump(file_exists('phar://' . __DIR__ . '/files/write4.phar/testit.txt'));
Phar::mount('phar://' . __DIR__ . '/files/write4.phar/testit.txt', 'phar://' . __DIR__ . '/files/write4.phar/tobemounted');
var_dump(file_exists('phar://' . __DIR__ . '/files/write4.phar/testit.txt'), file_get_contents('phar://' . __DIR__ . '/files/write4.phar/testit.txt'));
?>
-===DONE===
--EXPECT--
bool(false)
bool(true)
string(2) "hi"
-===DONE===
diff --git a/ext/phar/tests/cache_list/files/blog.phar.inc b/ext/phar/tests/cache_list/files/blog.phar.inc
index 62d86c5c3f..a73f0c89ce 100644
--- a/ext/phar/tests/cache_list/files/blog.phar.inc
+++ b/ext/phar/tests/cache_list/files/blog.phar.inc
@@ -10,8 +10,8 @@ $phar->setStub('<?php if(file_exists(dirname(__FILE__) . "/files/config.xml")) {
Phar::webPhar("blog", "index.php");
__HALT_COMPILER(); ?>');
$phar['index.php'] = '<?php if (!file_exists("config.xml")) {
- include "install.php";
- exit;
+ include "install.php";
+ exit;
}
var_dump(file_get_contents("config.xml"));
?>';
diff --git a/ext/phar/tests/cache_list/files/phar_oo_test.inc b/ext/phar/tests/cache_list/files/phar_oo_test.inc
index 0691e4dc80..38443add61 100644
--- a/ext/phar/tests/cache_list/files/phar_oo_test.inc
+++ b/ext/phar/tests/cache_list/files/phar_oo_test.inc
@@ -12,23 +12,23 @@ if (!isset($pharconfig)) $pharconfig = 0;
switch($pharconfig)
{
- default:
- case 0:
- $files['a.php'] = '<?php echo "This is a.php\n"; ?>';
- $files['b.php'] = '<?php echo "This is b.php\n"; ?>';
- $files['b/c.php'] = '<?php echo "This is b/c.php\n"; ?>';
- $files['b/d.php'] = '<?php echo "This is b/d.php\n"; ?>';
- $files['e.php'] = '<?php echo "This is e.php\n"; ?>';
- break;
- case 1:
- $files['a.csv'] =<<<EOF
+ default:
+ case 0:
+ $files['a.php'] = '<?php echo "This is a.php\n"; ?>';
+ $files['b.php'] = '<?php echo "This is b.php\n"; ?>';
+ $files['b/c.php'] = '<?php echo "This is b/c.php\n"; ?>';
+ $files['b/d.php'] = '<?php echo "This is b/d.php\n"; ?>';
+ $files['e.php'] = '<?php echo "This is e.php\n"; ?>';
+ break;
+ case 1:
+ $files['a.csv'] =<<<EOF
1,2,3
2,a,b
3,"c","'e'"
EOF;
- break;
- case 2:
- $files['a.csv'] =<<<EOF
+ break;
+ case 2:
+ $files['a.csv'] =<<<EOF
1,2,3
2,a,b
3,"c","'e'"
@@ -37,10 +37,10 @@ EOF;
7,777
EOF;
- break;
- case 3:
- $files['a.php'] = '<?php echo new new class;';
- break;
+ break;
+ case 3:
+ $files['a.php'] = '<?php echo new new class;';
+ break;
}
$ftime = mktime(12, 0, 0, 3, 1, 2006);
diff --git a/ext/phar/tests/cache_list/files/phar_test.inc b/ext/phar/tests/cache_list/files/phar_test.inc
index 5f0031f560..bae9415aac 100644
--- a/ext/phar/tests/cache_list/files/phar_test.inc
+++ b/ext/phar/tests/cache_list/files/phar_test.inc
@@ -7,43 +7,43 @@ $glags = 0;
foreach($files as $name => $cont)
{
- global $gflags, $files;
-
- $comp = NULL;
- $crc32= NULL;
- $clen = NULL;
- $ulen = NULL;
- $time = isset($ftime) ? $ftime : @mktime(12, 0, 0, 3, 1, 2006);
- $flags= 0;
- $perm = 0x000001B6;
- $meta = NULL;
-
- // overwrite if array
- if (is_array($cont))
- {
- foreach(array('comp','crc32','clen','ulen','time','flags','perm','meta','cont') as $what)
- {
- if (isset($cont[$what]))
- {
- $$what = $cont[$what];
- }
- }
- }
-
- // create if not yet done
- if (empty($comp)) $comp = $cont;
- if (empty($ulen)) $ulen = strlen($cont);
- if (empty($clen)) $clen = strlen($comp);
- if (empty($crc32))$crc32= crc32((binary)$cont);
- if (isset($meta)) $meta = serialize($meta);
-
- // write manifest entry
- $manifest .= pack('V', strlen($name)) . (binary)$name;
- $manifest .= pack('VVVVVV', $ulen, $time, $clen, $crc32, $flags|$perm, strlen($meta)) . (binary)$meta;
-
- // globals
- $gflags |= $flags;
- $files[$name] = $comp;
+ global $gflags, $files;
+
+ $comp = NULL;
+ $crc32= NULL;
+ $clen = NULL;
+ $ulen = NULL;
+ $time = isset($ftime) ? $ftime : @mktime(12, 0, 0, 3, 1, 2006);
+ $flags= 0;
+ $perm = 0x000001B6;
+ $meta = NULL;
+
+ // overwrite if array
+ if (is_array($cont))
+ {
+ foreach(array('comp','crc32','clen','ulen','time','flags','perm','meta','cont') as $what)
+ {
+ if (isset($cont[$what]))
+ {
+ $$what = $cont[$what];
+ }
+ }
+ }
+
+ // create if not yet done
+ if (empty($comp)) $comp = $cont;
+ if (empty($ulen)) $ulen = strlen($cont);
+ if (empty($clen)) $clen = strlen($comp);
+ if (empty($crc32))$crc32= crc32((binary)$cont);
+ if (isset($meta)) $meta = serialize($meta);
+
+ // write manifest entry
+ $manifest .= pack('V', strlen($name)) . (binary)$name;
+ $manifest .= pack('VVVVVV', $ulen, $time, $clen, $crc32, $flags|$perm, strlen($meta)) . (binary)$meta;
+
+ // globals
+ $gflags |= $flags;
+ $files[$name] = $comp;
}
if (!isset($alias)) $alias = 'hio';
@@ -56,21 +56,21 @@ $file .= pack('V', strlen($manifest)) . $manifest;
foreach($files as $cont)
{
- $file .= (binary)$cont;
+ $file .= (binary)$cont;
}
file_put_contents($fname, $file);
if (@$gzip) {
- $fp = gzopen($fname, 'w');
- fwrite($fp, $file);
- fclose($fp);
+ $fp = gzopen($fname, 'w');
+ fwrite($fp, $file);
+ fclose($fp);
}
if (@$bz2) {
- $fp = bzopen($fname, 'w');
- fwrite($fp, $file);
- fclose($fp);
+ $fp = bzopen($fname, 'w');
+ fwrite($fp, $file);
+ fclose($fp);
}
?>
diff --git a/ext/phar/tests/cache_list/files/write5.phar.inc b/ext/phar/tests/cache_list/files/write5.phar.inc
index 5e7b9bb886..1cb6b4e4c0 100644
--- a/ext/phar/tests/cache_list/files/write5.phar.inc
+++ b/ext/phar/tests/cache_list/files/write5.phar.inc
@@ -16,11 +16,11 @@ var_dump($arr);
$phar2 = new Phar(__FILE__);
$arr = array();
foreach ($phar2 as $name => $file) {
- $arr[$name] = $file->getContent();
+ $arr[$name] = $file->getContent();
}
ksort($arr);
foreach ($arr as $name => $content) {
- echo $name, " ", $content;
+ echo $name, " ", $content;
}
echo "ok\n";
__HALT_COMPILER();
diff --git a/ext/phar/tests/cache_list/files/write6.phar.inc b/ext/phar/tests/cache_list/files/write6.phar.inc
index 3ba5db3c54..543568f5ee 100644
--- a/ext/phar/tests/cache_list/files/write6.phar.inc
+++ b/ext/phar/tests/cache_list/files/write6.phar.inc
@@ -17,11 +17,11 @@ var_dump($arr);
$phar2 = new Phar(__FILE__);
$arr = array();
foreach ($phar2 as $name => $file) {
- $arr[$name] = $file->getContent();
+ $arr[$name] = $file->getContent();
}
ksort($arr);
foreach ($arr as $name => $content) {
- echo $name, " ", $content;
+ echo $name, " ", $content;
}
echo "ok\n";
__HALT_COMPILER();
diff --git a/ext/phar/tests/cache_list/frontcontroller22.phpt b/ext/phar/tests/cache_list/frontcontroller22.phpt
index f0d659b4c3..a6cbc4ae25 100644
--- a/ext/phar/tests/cache_list/frontcontroller22.phpt
+++ b/ext/phar/tests/cache_list/frontcontroller22.phpt
@@ -17,6 +17,6 @@ Content-type: text/html; charset=UTF-8
string(4) "test"
string(12) "oof/test.php"
-Warning: include(./hi.php): failed to open stream: No such file or directory in phar://%s/oof/test.php on line %d
+Warning: include(./hi.php): Failed to open stream: No such file or directory in phar://%s/oof/test.php on line %d
Warning: include(): Failed opening './hi.php' for inclusion (include_path='%s') in phar://%soof/test.php on line %d
diff --git a/ext/phar/tests/cached_manifest_1.phpt b/ext/phar/tests/cached_manifest_1.phpt
index d9c40723ae..f3d065e56f 100644
--- a/ext/phar/tests/cached_manifest_1.phpt
+++ b/ext/phar/tests/cached_manifest_1.phpt
@@ -15,13 +15,12 @@ while (false !== ($b = readdir($a))) {
var_dump($b);
}
foreach (new RecursiveIteratorIterator(new Phar($pname)) as $f) {
- var_dump($f->getPathName());
+ var_dump($f->getPathName());
}
var_dump(is_dir($pname . '/b'));
var_dump(is_dir($pname . '/d'));
var_dump(is_dir($pname . '/b/c.php'));
?>
-===DONE===
--EXPECTF--
string(131) "<?php echo "in b\n";$a = fopen("index.php", "r", true);echo stream_get_contents($a);fclose($a);include dirname(__FILE__) . "/../d";"
string(1) "b"
@@ -35,4 +34,3 @@ string(%d) "phar://%snophar.phar%cweb.php"
bool(true)
bool(false)
bool(false)
-===DONE===
diff --git a/ext/phar/tests/create_new_and_modify.phpt b/ext/phar/tests/create_new_and_modify.phpt
index 5aa840e383..738efb797f 100644
--- a/ext/phar/tests/create_new_and_modify.phpt
+++ b/ext/phar/tests/create_new_and_modify.phpt
@@ -44,7 +44,6 @@ include $pname . '/a.php';
include $pname . '/b.php';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
@@ -54,4 +53,3 @@ string(40) "%s"
bool(true)
modified!
another!
-===DONE===
diff --git a/ext/phar/tests/create_new_phar.phpt b/ext/phar/tests/create_new_phar.phpt
index 79724b9b74..73aca42528 100644
--- a/ext/phar/tests/create_new_phar.phpt
+++ b/ext/phar/tests/create_new_phar.phpt
@@ -9,19 +9,17 @@ phar.require_hash=1
<?php
file_put_contents('phar://' . __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php/a.php',
- "brand new!\n");
+ "brand new!\n");
include 'phar://' . __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php/a.php';
$fileName = "ChineseFile\xE5\x84\xB7\xE9\xBB\x91.php";
file_put_contents('phar://' . __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php/$fileName.php',
- 'Text in utf8 file.');
+ 'Text in utf8 file.');
include 'phar://' . __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php/$fileName.php';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECT--
brand new!
Text in utf8 file.
-===DONE===
diff --git a/ext/phar/tests/create_new_phar_b.phpt b/ext/phar/tests/create_new_phar_b.phpt
index 8b0d6e26dc..3a531fd1e4 100644
--- a/ext/phar/tests/create_new_phar_b.phpt
+++ b/ext/phar/tests/create_new_phar_b.phpt
@@ -9,18 +9,16 @@ phar.require_hash=1
<?php
file_put_contents('phar://' . __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php/a.php',
- 'brand new!');
+ 'brand new!');
include 'phar://' . __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php/a.php';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
-Warning: file_put_contents(phar://%screate_new_phar_b.phar.php/a.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %screate_new_phar_b.php on line %d
+Warning: file_put_contents(phar://%screate_new_phar_b.phar.php/a.php): Failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %screate_new_phar_b.php on line %d
-Warning: include(phar://%screate_new_phar_b.phar.php/a.php): failed to open stream: %s in %screate_new_phar_b.php on line %d
+Warning: include(phar://%screate_new_phar_b.phar.php/a.php): Failed to open stream: %s in %screate_new_phar_b.php on line %d
Warning: include(): Failed opening 'phar://%screate_new_phar_b.phar.php/a.php' for inclusion (include_path='%s') in %screate_new_phar_b.php on line %d
-===DONE===
diff --git a/ext/phar/tests/create_new_phar_c.phpt b/ext/phar/tests/create_new_phar_c.phpt
index 19a4c81751..547544d758 100644
--- a/ext/phar/tests/create_new_phar_c.phpt
+++ b/ext/phar/tests/create_new_phar_c.phpt
@@ -9,13 +9,12 @@ phar.require_hash=1
<?php
file_put_contents('phar://' . __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php/a.php',
- 'brand new!');
+ 'brand new!');
$phar = new Phar(__DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php');
var_dump($phar->getSignature());
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
@@ -25,4 +24,3 @@ array(2) {
["hash_type"]=>
string(5) "SHA-1"
}
-===DONE===
diff --git a/ext/phar/tests/create_path_error.phpt b/ext/phar/tests/create_path_error.phpt
index 047e7e3806..ff4fa4530a 100644
--- a/ext/phar/tests/create_path_error.phpt
+++ b/ext/phar/tests/create_path_error.phpt
@@ -21,7 +21,7 @@ var_dump(file_get_contents($pname . '/b.php'));
function error_handler($errno, $errmsg)
{
- echo "Error: $errmsg";
+ echo "Error: $errmsg";
}
set_error_handler('error_handler');
@@ -39,44 +39,43 @@ $checks = array(
);
foreach($checks as $check)
{
- $count++;
- echo "$count:";
- file_put_contents($pname . '/' . $check, "error");
- echo "\n";
+ $count++;
+ echo "$count:";
+ file_put_contents($pname . '/' . $check, "error");
+ echo "\n";
}
$phar = new Phar($fname);
$checks = array("a\0");
foreach($checks as $check)
{
- try
- {
- $phar[$check] = 'error';
- }
- catch(Exception $e)
- {
- echo 'Exception: ' . $e->getMessage() . "\n";
- }
+ try
+ {
+ $phar[$check] = 'error';
+ }
+ catch (TypeError $e)
+ {
+ echo 'Exception: ' . $e->getMessage() . "\n";
+ }
}
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
string(5) "query"
string(5) "query"
-1:Error: file_put_contents(phar://%s//): failed to open stream: phar error: file "" in phar "%s" cannot be empty
-2:Error: file_put_contents(phar://%s/.): failed to open stream: phar error: file "" in phar "%s" cannot be empty
-3:Error: file_put_contents(phar://%s/../): failed to open stream: phar error: file "" in phar "%s" cannot be empty
-4:Error: file_put_contents(phar://%s/a/..): failed to open stream: phar error: file "" in phar "%s" cannot be empty
+1:Error: file_put_contents(phar://%s//): Failed to open stream: phar error: file "" in phar "%s" cannot be empty
+2:Error: file_put_contents(phar://%s/.): Failed to open stream: phar error: file "" in phar "%s" cannot be empty
+3:Error: file_put_contents(phar://%s/../): Failed to open stream: phar error: file "" in phar "%s" cannot be empty
+4:Error: file_put_contents(phar://%s/a/..): Failed to open stream: phar error: file "" in phar "%s" cannot be empty
5:
6:
7:
8:
-9:Error: file_put_contents(phar://%s): failed to open stream: phar error: invalid path "%s" contains illegal character
-10:Error: file_put_contents(phar://%s): failed to open stream: phar error: invalid path "%s" contains illegal character
-11:Error: file_put_contents(phar://%s): failed to open stream: phar error: invalid path "%s" contains illegal character
-12:Error: file_put_contents(phar://%s): failed to open stream: phar error: invalid path "%s" contains illegal character
-13:Error: file_put_contents(phar://%s): failed to open stream: phar error: invalid path "%s" contains illegal character
-Error: Phar::offsetSet() expects parameter 1 to be a valid path, string given===DONE===
+9:Error: file_put_contents(phar://%s): Failed to open stream: phar error: invalid path "%s" contains illegal character
+10:Error: file_put_contents(phar://%s): Failed to open stream: phar error: invalid path "%s" contains illegal character
+11:Error: file_put_contents(phar://%s): Failed to open stream: phar error: invalid path "%s" contains illegal character
+12:Error: file_put_contents(phar://%s): Failed to open stream: phar error: invalid path "%s" contains illegal character
+13:Error: file_put_contents(phar://%s): Failed to open stream: phar error: invalid path "%s" contains illegal character
+Exception: Phar::offsetSet() expects parameter 1 to be a valid path, string given
diff --git a/ext/phar/tests/delete.phpt b/ext/phar/tests/delete.phpt
index 56559777d7..5a1059cc7a 100644
--- a/ext/phar/tests/delete.phpt
+++ b/ext/phar/tests/delete.phpt
@@ -28,4 +28,4 @@ echo file_get_contents($pname . '/a') . "\n";
--EXPECTF--
a
-Warning: file_get_contents(phar://%sdelete.phar.php/a): failed to open stream: phar error: "a" is not a file in phar "%sdelete.phar.php" in %sdelete.php on line 16
+Warning: file_get_contents(phar://%sdelete.phar.php/a): Failed to open stream: phar error: "a" is not a file in phar "%sdelete.phar.php" in %sdelete.php on line 16
diff --git a/ext/phar/tests/delete_in_phar.phpt b/ext/phar/tests/delete_in_phar.phpt
index 0d904d57bb..4cf2f3b439 100644
--- a/ext/phar/tests/delete_in_phar.phpt
+++ b/ext/phar/tests/delete_in_phar.phpt
@@ -30,7 +30,6 @@ include $pname . '/b.php';
include $pname . '/b/c.php';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
@@ -41,8 +40,7 @@ This is b/c
This is a
This is b
-Warning: include(%sdelete_in_phar.phar.php/b/c.php): failed to open stream: phar error: "b/c.php" is not a file in phar "%sdelete_in_phar.phar.php" in %sdelete_in_phar.php on line %d
+Warning: include(%sdelete_in_phar.phar.php/b/c.php): Failed to open stream: phar error: "b/c.php" is not a file in phar "%sdelete_in_phar.phar.php" in %sdelete_in_phar.php on line %d
Warning: include(): Failed opening 'phar://%sdelete_in_phar.phar.php/b/c.php' for inclusion (include_path='%s') in %sdelete_in_phar.php on line %d
-===DONE===
diff --git a/ext/phar/tests/delete_in_phar_b.phpt b/ext/phar/tests/delete_in_phar_b.phpt
index 8d5d78debc..ce45b03c84 100644
--- a/ext/phar/tests/delete_in_phar_b.phpt
+++ b/ext/phar/tests/delete_in_phar_b.phpt
@@ -29,7 +29,6 @@ include $pname . '/b.php';
include $pname . '/b/c.php';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
@@ -43,4 +42,3 @@ This is a
This is b
This is b/c
-===DONE===
diff --git a/ext/phar/tests/delete_in_phar_confirm.phpt b/ext/phar/tests/delete_in_phar_confirm.phpt
index 1f8015f0cb..90401bb5cc 100644
--- a/ext/phar/tests/delete_in_phar_confirm.phpt
+++ b/ext/phar/tests/delete_in_phar_confirm.phpt
@@ -34,7 +34,6 @@ include 'phar://' . __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php/b.ph
include 'phar://' . __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php/b/c.php';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
@@ -45,8 +44,7 @@ This is b/c
This is a
This is b
-Warning: include(%sdelete_in_phar_confirm.phar.php/b/c.php): failed to open stream: phar error: "b/c.php" is not a file in phar "%sdelete_in_phar_confirm.phar.php" in %sdelete_in_phar_confirm.php on line %d
+Warning: include(%sdelete_in_phar_confirm.phar.php/b/c.php): Failed to open stream: phar error: "b/c.php" is not a file in phar "%sdelete_in_phar_confirm.phar.php" in %sdelete_in_phar_confirm.php on line %d
Warning: include(): Failed opening 'phar://%sdelete_in_phar_confirm.phar.php/b/c.php' for inclusion (include_path='%s') in %sdelete_in_phar_confirm.php on line %d
-===DONE===
diff --git a/ext/phar/tests/dir.phpt b/ext/phar/tests/dir.phpt
index c34f01a7f1..964c437298 100644
--- a/ext/phar/tests/dir.phpt
+++ b/ext/phar/tests/dir.phpt
@@ -50,7 +50,6 @@ rmdir($pname);
rmdir($pname . '/');
mkdir($pname . '/');
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
<?php unlink(__DIR__ . '/ok.phar'); ?>
@@ -89,4 +88,3 @@ Warning: rmdir(): phar error: cannot remove directory "" in phar "%sdir.phar.php
Warning: rmdir(): phar error: cannot remove directory "" in phar "%sdir.phar.php", directory does not exist in %sdir.php on line %d
Warning: mkdir(): phar error: cannot create directory "" in phar "%sdir.phar.php", phar error: invalid path "" must not be empty in %sdir.php on line %d
-===DONE===
diff --git a/ext/phar/tests/fatal_error_webphar.phpt b/ext/phar/tests/fatal_error_webphar.phpt
index ce3e8980ad..21df0775b0 100644
--- a/ext/phar/tests/fatal_error_webphar.phpt
+++ b/ext/phar/tests/fatal_error_webphar.phpt
@@ -1,5 +1,7 @@
--TEST--
Phar web-based phar with fatal error
+--XFAIL--
+Uses no longer supported __autoload() function, new phar needed
--INI--
default_charset=UTF-8
--SKIPIF--
diff --git a/ext/phar/tests/fgc_edgecases.phpt b/ext/phar/tests/fgc_edgecases.phpt
index 11916603e3..aa037ca5f8 100644
--- a/ext/phar/tests/fgc_edgecases.phpt
+++ b/ext/phar/tests/fgc_edgecases.phpt
@@ -14,7 +14,11 @@ Phar::interceptFileFuncs();
$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
-file_get_contents(array());
+try {
+ file_get_contents(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
chdir(__DIR__);
file_put_contents($fname, "blah\n");
file_put_contents("fgc_edgecases.txt", "test\n");
@@ -40,13 +44,12 @@ echo file_get_contents("./hi", 0, $context, 0, 0);
include $pname . '/foo/hi';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
<?php rmdir(__DIR__ . '/poo'); ?>
<?php unlink(__DIR__ . '/fgc_edgecases.txt'); ?>
--EXPECTF--
-Warning: file_get_contents() expects parameter 1 to be a valid path, array given in %sfgc_edgecases.php on line %d
+file_get_contents() expects parameter 1 to be a valid path, array given
blah
<?php
echo file_get_contents("foo/" . basename(__FILE__));
@@ -62,7 +65,7 @@ echo file_get_contents("./hi");
echo file_get_contents("./hi", 0, $context, 0, 0);
?>
-Warning: file_get_contents(): length must be greater than or equal to zero in phar://%sfgc_edgecases.phar.php/foo/hi on line %d
+Warning: file_get_contents(): Length must be greater than or equal to zero in phar://%sfgc_edgecases.phar.php/foo/hi on line %d
test
test
<?php
@@ -79,7 +82,7 @@ echo file_get_contents("./hi");
echo file_get_contents("./hi", 0, $context, 0, 0);
?>
-Warning: file_get_contents(phar://%sfgc_edgecases.phar.php/oops): failed to open stream: phar error: path "oops" is a directory in phar://%sfgc_edgecases.phar.php/foo/hi on line %d
+Warning: file_get_contents(phar://%sfgc_edgecases.phar.php/oops): Failed to open stream: phar error: path "oops" is a directory in phar://%sfgc_edgecases.phar.php/foo/hi on line %d
Warning: file_get_contents(): Failed to seek to position 50000 in the stream in phar://%sfgc_edgecases.phar.php/foo/hi on line %d
<?php
@@ -95,4 +98,3 @@ echo file_get_contents("./hi", 0, $context, 50000);
echo file_get_contents("./hi");
echo file_get_contents("./hi", 0, $context, 0, 0);
?>
-===DONE===
diff --git a/ext/phar/tests/files/blog.phar.inc b/ext/phar/tests/files/blog.phar.inc
index c2599abef8..a3b4a82f20 100644
--- a/ext/phar/tests/files/blog.phar.inc
+++ b/ext/phar/tests/files/blog.phar.inc
@@ -12,8 +12,8 @@ if(file_exists(dirname(__FILE__) . "/files/config.xml")) {
Phar::webPhar("blog", "index.php");
__HALT_COMPILER(); ?>');
$phar['index.php'] = '<?php if (!file_exists("config.xml")) {
- include "install.php";
- exit;
+ include "install.php";
+ exit;
}
var_dump(str_replace("\r\n", "\n", file_get_contents("config.xml")));
?>';
diff --git a/ext/phar/tests/files/phar_oo_test.inc b/ext/phar/tests/files/phar_oo_test.inc
index 3883d494c1..a6f4cee5ee 100644
--- a/ext/phar/tests/files/phar_oo_test.inc
+++ b/ext/phar/tests/files/phar_oo_test.inc
@@ -13,23 +13,23 @@ if (!isset($pharconfig)) $pharconfig = 0;
switch($pharconfig)
{
- default:
- case 0:
- $files['a.php'] = '<?php echo "This is a.php\n"; ?>';
- $files['b.php'] = '<?php echo "This is b.php\n"; ?>';
- $files['b/c.php'] = '<?php echo "This is b/c.php\n"; ?>';
- $files['b/d.php'] = '<?php echo "This is b/d.php\n"; ?>';
- $files['e.php'] = '<?php echo "This is e.php\n"; ?>';
- break;
- case 1:
- $files['a.csv'] =<<<EOF
+ default:
+ case 0:
+ $files['a.php'] = '<?php echo "This is a.php\n"; ?>';
+ $files['b.php'] = '<?php echo "This is b.php\n"; ?>';
+ $files['b/c.php'] = '<?php echo "This is b/c.php\n"; ?>';
+ $files['b/d.php'] = '<?php echo "This is b/d.php\n"; ?>';
+ $files['e.php'] = '<?php echo "This is e.php\n"; ?>';
+ break;
+ case 1:
+ $files['a.csv'] =<<<EOF
1,2,3
2,a,b
3,"c","'e'"
EOF;
- break;
- case 2:
- $files['a.csv'] =<<<EOF
+ break;
+ case 2:
+ $files['a.csv'] =<<<EOF
1,2,3
2,a,b
3,"c","'e'"
@@ -38,10 +38,10 @@ EOF;
7,777
EOF;
- break;
- case 3:
- $files['a.php'] = '<?php echo new new class;';
- break;
+ break;
+ case 3:
+ $files['a.php'] = '<?php echo new new class;';
+ break;
}
$ftime = mktime(12, 0, 0, 3, 1, 2006);
diff --git a/ext/phar/tests/files/phar_test.inc b/ext/phar/tests/files/phar_test.inc
index 6a75334cdd..f5279a93d2 100644
--- a/ext/phar/tests/files/phar_test.inc
+++ b/ext/phar/tests/files/phar_test.inc
@@ -7,43 +7,43 @@ $gflags = 0;
foreach($files as $name => $cont)
{
- global $gflags, $files;
-
- $comp = NULL;
- $crc32= NULL;
- $clen = NULL;
- $ulen = NULL;
- $time = isset($ftime) ? $ftime : @mktime(12, 0, 0, 3, 1, 2006);
- $flags= 0;
- $perm = 0x000001B6;
- $meta = NULL;
-
- // overwrite if array
- if (is_array($cont))
- {
- foreach(array('comp','crc32','clen','ulen','time','flags','perm','meta','cont') as $what)
- {
- if (isset($cont[$what]))
- {
- $$what = $cont[$what];
- }
- }
- }
-
- // create if not yet done
- if (empty($comp)) $comp = $cont;
- if (empty($ulen)) $ulen = strlen($cont);
- if (empty($clen)) $clen = strlen($comp);
- if (empty($crc32))$crc32= crc32((binary)$cont);
- if (isset($meta)) $meta = serialize($meta);
-
- // write manifest entry
- $manifest .= pack('V', strlen($name)) . (binary)$name;
- $manifest .= pack('VVVVVV', $ulen, $time, $clen, $crc32, $flags|$perm, strlen($meta)) . (binary)$meta;
-
- // globals
- $gflags |= $flags;
- $files[$name] = $comp;
+ global $gflags, $files;
+
+ $comp = NULL;
+ $crc32= NULL;
+ $clen = NULL;
+ $ulen = NULL;
+ $time = isset($ftime) ? $ftime : @mktime(12, 0, 0, 3, 1, 2006);
+ $flags= 0;
+ $perm = 0x000001B6;
+ $meta = NULL;
+
+ // overwrite if array
+ if (is_array($cont))
+ {
+ foreach(array('comp','crc32','clen','ulen','time','flags','perm','meta','cont') as $what)
+ {
+ if (isset($cont[$what]))
+ {
+ $$what = $cont[$what];
+ }
+ }
+ }
+
+ // create if not yet done
+ if (empty($comp)) $comp = $cont;
+ if (empty($ulen)) $ulen = strlen($cont);
+ if (empty($clen)) $clen = strlen($comp);
+ if (empty($crc32))$crc32= crc32((binary)$cont);
+ if (isset($meta)) $meta = serialize($meta);
+
+ // write manifest entry
+ $manifest .= pack('V', strlen($name)) . (binary)$name;
+ $manifest .= pack('VVVVVV', $ulen, $time, $clen, $crc32, $flags|$perm, strlen($meta)) . (binary)$meta;
+
+ // globals
+ $gflags |= $flags;
+ $files[$name] = $comp;
}
if (!isset($alias)) $alias = 'hio';
@@ -56,21 +56,21 @@ $file .= pack('V', strlen($manifest)) . $manifest;
foreach($files as $cont)
{
- $file .= (binary)$cont;
+ $file .= (binary)$cont;
}
file_put_contents($fname, $file);
if (@$gzip) {
- $fp = gzopen($fname, 'w');
- fwrite($fp, $file);
- fclose($fp);
+ $fp = gzopen($fname, 'w');
+ fwrite($fp, $file);
+ fclose($fp);
}
if (@$bz2) {
- $fp = bzopen($fname, 'w');
- fwrite($fp, $file);
- fclose($fp);
+ $fp = bzopen($fname, 'w');
+ fwrite($fp, $file);
+ fclose($fp);
}
?>
diff --git a/ext/phar/tests/fopen.phpt b/ext/phar/tests/fopen.phpt
index 528f5c46df..c771b25dd3 100644
--- a/ext/phar/tests/fopen.phpt
+++ b/ext/phar/tests/fopen.phpt
@@ -10,7 +10,6 @@ phar.readonly=0
Phar::interceptFileFuncs();
$a = fopen(__FILE__, 'rb'); // this satisfies 1 line of code coverage
fclose($a);
-$a = fopen(); // this satisfies another line of code coverage
$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php';
$a = new Phar($fname);
@@ -32,11 +31,8 @@ include "index.php";
__HALT_COMPILER();');
include $fname;
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
-Warning: fopen() expects at least 2 parameters, 0 given in %sfopen.php on line %d
hihi
-Warning: fopen(notfound.txt): failed to open stream: No such file or directory in phar://%sfopen.phar.php/index.php on line %d
-===DONE===
+Warning: fopen(notfound.txt): Failed to open stream: No such file or directory in phar://%sfopen.phar.php/index.php on line %d
diff --git a/ext/phar/tests/fopen_edgecases.phpt b/ext/phar/tests/fopen_edgecases.phpt
index 5dce0384ff..72725e14c5 100644
--- a/ext/phar/tests/fopen_edgecases.phpt
+++ b/ext/phar/tests/fopen_edgecases.phpt
@@ -66,22 +66,21 @@ $a = fopen("./notfound.php", "r");
include $pname . '/test.php';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.2.phar.php'); ?>
<?php unlink(__DIR__ . '/fopen_edgetest.phar');
--EXPECTF--
-Warning: fopen(phar://%sfopen_edgecases.phar.php/b/c.php): failed to open stream: phar error: open mode append not supported in %sfopen_edgecases.php on line %d
+Warning: fopen(phar://%sfopen_edgecases.phar.php/b/c.php): Failed to open stream: phar error: open mode append not supported in %sfopen_edgecases.php on line %d
-Warning: fopen(phar://%sfopen_edgecases.phar.php.phar.gz): failed to open stream: phar error: invalid url or non-existent phar "phar://%sfopen_edgecases.phar.php.phar.gz" in %sfopen_edgecases.php on line %d
+Warning: fopen(phar://%sfopen_edgecases.phar.php.phar.gz): Failed to open stream: phar error: invalid url or non-existent phar "phar://%sfopen_edgecases.phar.php.phar.gz" in %sfopen_edgecases.php on line %d
bool(false)
-Warning: fopen(phar://%sfopen_edgecases.2.phar.php/hi): failed to open stream: internal corruption of phar "%sfopen_edgecases.2.phar.php" (truncated manifest at stub end) in %sfopen_edgecases.php on line %d
+Warning: fopen(phar://%sfopen_edgecases.2.phar.php/hi): Failed to open stream: internal corruption of phar "%sfopen_edgecases.2.phar.php" (truncated manifest at stub end) in %sfopen_edgecases.php on line %d
-Warning: fopen(phar://): failed to open stream: phar error: no directory in "phar://", must have at least phar:/// for root directory (always use full path to a new phar) in %sfopen_edgecases.php on line %d
+Warning: fopen(phar://): Failed to open stream: phar error: no directory in "phar://", must have at least phar:/// for root directory (always use full path to a new phar) in %sfopen_edgecases.php on line %d
-Warning: fopen(phar://foo.phar): failed to open stream: %s in %sfopen_edgecases.php on line %d
+Warning: fopen(phar://foo.phar): Failed to open stream: %s in %sfopen_edgecases.php on line %d
int(0)
int(1)
int(0)
@@ -119,6 +118,5 @@ Warning: rename(): phar error: cannot rename "phar://%sfopen_edgecases.phar.php/
Warning: rename(): phar error: cannot rename "phar://%sfopen_edgecases.phar.php/hi" to "phar://%sfopen_edgecases.phar.php/there": invalid or non-writable url "phar://%sfopen_edgecases.phar.php/hi" in %sfopen_edgecases.php on line %d
-Warning: fopen(./notfound.php): failed to open stream: No such file or directory in phar://%sfopen_edgecases.phar.php/test.php on line %d
+Warning: fopen(./notfound.php): Failed to open stream: No such file or directory in phar://%sfopen_edgecases.phar.php/test.php on line %d
-===DONE===
diff --git a/ext/phar/tests/fopen_edgecases2.phpt b/ext/phar/tests/fopen_edgecases2.phpt
index b32755bf9e..5b520ad0ca 100644
--- a/ext/phar/tests/fopen_edgecases2.phpt
+++ b/ext/phar/tests/fopen_edgecases2.phpt
@@ -10,7 +10,11 @@ Phar::interceptFileFuncs();
$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
-fopen(array(), 'r');
+try {
+ fopen(array(), 'r');
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
chdir(__DIR__);
file_put_contents($fname, "blah\n");
file_put_contents("fopen_edgecases2.txt", "test\n");
@@ -29,15 +33,13 @@ fopen("../oops", "r");
');
include $pname . '/foo/hi';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
<?php rmdir(__DIR__ . '/poo'); ?>
<?php unlink(__DIR__ . '/fopen_edgecases2.txt'); ?>
--EXPECTF--
-Warning: fopen() expects parameter 1 to be a valid path, array given in %sfopen_edgecases2.php on line %d
+fopen() expects parameter 1 to be a valid path, array given
blah
test
-Warning: fopen(phar://%sfopen_edgecases2.phar.php/oops): failed to open stream: phar error: path "oops" is a directory in phar://%sfopen_edgecases2.phar.php/foo/hi on line %d
-===DONE===
+Warning: fopen(phar://%sfopen_edgecases2.phar.php/oops): Failed to open stream: phar error: path "oops" is a directory in phar://%sfopen_edgecases2.phar.php/foo/hi on line %d
diff --git a/ext/phar/tests/frontcontroller22.phpt b/ext/phar/tests/frontcontroller22.phpt
index b482164396..b9f1717b0b 100644
--- a/ext/phar/tests/frontcontroller22.phpt
+++ b/ext/phar/tests/frontcontroller22.phpt
@@ -16,6 +16,6 @@ Content-type: text/html; charset=UTF-8
string(4) "test"
string(12) "oof/test.php"
-Warning: include(./hi.php): failed to open stream: No such file or directory in phar://%s/oof/test.php on line %d
+Warning: include(./hi.php): Failed to open stream: No such file or directory in phar://%s/oof/test.php on line %d
Warning: include(): Failed opening './hi.php' for inclusion (include_path='%s') in phar://%soof/test.php on line %d
diff --git a/ext/phar/tests/include_path.phpt b/ext/phar/tests/include_path.phpt
index 7831fc72e3..c2c9387ea4 100644
--- a/ext/phar/tests/include_path.phpt
+++ b/ext/phar/tests/include_path.phpt
@@ -21,7 +21,6 @@ set_include_path('.' . PATH_SEPARATOR . 'phar://' . $fname . '/test');
include 'file1.php';
include 'file2.php';
?>
-===DONE===
--CLEAN--
<?php
@unlink(__DIR__ . '/tempmanifest1.phar.php');
@@ -30,7 +29,6 @@ include 'file2.php';
file1.php
test/file1.php
-Warning: include(file2.php): failed to open stream: No such file or directory in %sinclude_path.php on line %d
+Warning: include(file2.php): Failed to open stream: No such file or directory in %sinclude_path.php on line %d
Warning: include(): Failed opening 'file2.php' for inclusion (include_path='%sphar://%stempmanifest1.phar.php/test') in %sinclude_path.php on line %d
-===DONE===
diff --git a/ext/phar/tests/ini_set_off.phpt b/ext/phar/tests/ini_set_off.phpt
index 127a07a7ce..7088714a58 100644
--- a/ext/phar/tests/ini_set_off.phpt
+++ b/ext/phar/tests/ini_set_off.phpt
@@ -53,7 +53,6 @@ var_dump(Phar::canWrite());
var_dump(ini_get('phar.require_hash'));
var_dump(ini_get('phar.readonly'));
?>
-===DONE===
--EXPECT--
string(1) "0"
string(1) "0"
@@ -84,4 +83,3 @@ string(4) "true"
bool(true)
string(1) "0"
string(1) "0"
-===DONE===
diff --git a/ext/phar/tests/invalid_alias.phpt b/ext/phar/tests/invalid_alias.phpt
index 7a3cb31575..9039b8aa0d 100644
--- a/ext/phar/tests/invalid_alias.phpt
+++ b/ext/phar/tests/invalid_alias.phpt
@@ -10,29 +10,28 @@ $fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar';
$p = new Phar($fname);
try {
- $p->setAlias('hi/');
+ $p->setAlias('hi/');
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- $p->setAlias('hi\\l');
+ $p->setAlias('hi\\l');
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- $p->setAlias('hil;');
+ $p->setAlias('hil;');
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- $p->setAlias(':hil');
+ $p->setAlias(':hil');
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar');
@@ -42,4 +41,3 @@ Invalid alias "hi/" specified for phar "%sinvalid_alias.phar"
Invalid alias "hi\l" specified for phar "%sinvalid_alias.phar"
Invalid alias "hil;" specified for phar "%sinvalid_alias.phar"
Invalid alias ":hil" specified for phar "%sinvalid_alias.phar"
-===DONE===
diff --git a/ext/phar/tests/invalid_setstubalias.phpt b/ext/phar/tests/invalid_setstubalias.phpt
index 6234df1bff..df1b8c90c9 100644
--- a/ext/phar/tests/invalid_setstubalias.phpt
+++ b/ext/phar/tests/invalid_setstubalias.phpt
@@ -11,29 +11,28 @@ $fname2 = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.zip';
$p = new Phar($fname);
try {
- $p['.phar/stub.php'] = 'hi';
+ $p['.phar/stub.php'] = 'hi';
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- $p['.phar/alias.txt'] = 'hi';
+ $p['.phar/alias.txt'] = 'hi';
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
$p = new Phar($fname2);
try {
- $p['.phar/stub.php'] = 'hi';
+ $p['.phar/stub.php'] = 'hi';
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- $p['.phar/alias.txt'] = 'hi';
+ $p['.phar/alias.txt'] = 'hi';
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar');
@@ -44,4 +43,3 @@ Cannot set stub ".phar/stub.php" directly in phar "%sinvalid_setstubalias.phar.t
Cannot set alias ".phar/alias.txt" directly in phar "%sinvalid_setstubalias.phar.tar", use setAlias
Cannot set stub ".phar/stub.php" directly in phar "%sinvalid_setstubalias.phar.zip", use setStub
Cannot set alias ".phar/alias.txt" directly in phar "%sinvalid_setstubalias.phar.zip", use setAlias
-===DONE===
diff --git a/ext/phar/tests/metadata_read.phpt b/ext/phar/tests/metadata_read.phpt
index 2e23af2a4a..5450dee801 100644
--- a/ext/phar/tests/metadata_read.phpt
+++ b/ext/phar/tests/metadata_read.phpt
@@ -20,21 +20,20 @@ $files['d'] = array('cont' => 'd', 'meta' => array('hi'=>'there','foo'=>'bar'));
include 'files/phar_test.inc';
foreach($files as $name => $cont) {
- var_dump(file_get_contents($pname.'/'.$name));
+ var_dump(file_get_contents($pname.'/'.$name));
}
$phar = new Phar($fname);
foreach($files as $name => $cont) {
- var_dump($phar[$name]->getMetadata());
+ var_dump($phar[$name]->getMetadata());
}
unset($phar);
foreach($files as $name => $cont) {
- var_dump(file_get_contents($pname.'/'.$name));
+ var_dump(file_get_contents($pname.'/'.$name));
}
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECT--
@@ -60,4 +59,3 @@ string(1) "a"
string(1) "b"
string(1) "c"
string(1) "d"
-===DONE===
diff --git a/ext/phar/tests/metadata_write.phpt b/ext/phar/tests/metadata_write.phpt
index 1dea6dfac2..56d2956aab 100644
--- a/ext/phar/tests/metadata_write.phpt
+++ b/ext/phar/tests/metadata_write.phpt
@@ -21,7 +21,7 @@ $files['d'] = array('cont' => 'd', 'meta' => array('hi'=>'there','foo'=>'bar'));
include 'files/phar_test.inc';
foreach($files as $name => $cont) {
- var_dump(file_get_contents($pname.'/'.$name));
+ var_dump(file_get_contents($pname.'/'.$name));
}
$phar = new Phar($fname);
@@ -31,16 +31,15 @@ $phar['c']->setMetadata(array(25, 'foo'=>'bar'));
$phar['d']->setMetadata(true);
foreach($files as $name => $cont) {
- var_dump($phar[$name]->getMetadata());
+ var_dump($phar[$name]->getMetadata());
}
unset($phar);
foreach($files as $name => $cont) {
- var_dump(file_get_contents($pname.'/'.$name));
+ var_dump(file_get_contents($pname.'/'.$name));
}
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECT--
@@ -61,4 +60,3 @@ string(1) "a"
string(1) "b"
string(1) "c"
string(1) "d"
-===DONE===
diff --git a/ext/phar/tests/metadata_write_commit.phpt b/ext/phar/tests/metadata_write_commit.phpt
index def84b06f9..2fdd6fd884 100644
--- a/ext/phar/tests/metadata_write_commit.phpt
+++ b/ext/phar/tests/metadata_write_commit.phpt
@@ -21,7 +21,7 @@ $files['d'] = array('cont' => 'd', 'meta' => array('hi'=>'there','foo'=>'bar'));
include 'files/phar_test.inc';
foreach($files as $name => $cont) {
- var_dump(file_get_contents($pname.'/'.$name));
+ var_dump(file_get_contents($pname.'/'.$name));
}
$phar = new Phar($fname);
@@ -32,7 +32,7 @@ $phar['c']->setMetadata(array(25, 'foo'=>'bar'));
$phar['d']->setMetadata(true);
foreach($files as $name => $cont) {
- var_dump($phar[$name]->getMetadata());
+ var_dump($phar[$name]->getMetadata());
}
$phar->stopBuffering();
@@ -41,14 +41,13 @@ unset($phar);
$phar = new Phar($fname);
foreach($files as $name => $cont) {
- var_dump(file_get_contents($pname.'/'.$name));
+ var_dump(file_get_contents($pname.'/'.$name));
}
foreach($files as $name => $cont) {
- var_dump($phar[$name]->getMetadata());
+ var_dump($phar[$name]->getMetadata());
}
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECT--
@@ -78,4 +77,3 @@ array(2) {
string(3) "bar"
}
bool(true)
-===DONE===
diff --git a/ext/phar/tests/mkdir.phpt b/ext/phar/tests/mkdir.phpt
index 32081b145d..3a5782f3ef 100644
--- a/ext/phar/tests/mkdir.phpt
+++ b/ext/phar/tests/mkdir.phpt
@@ -25,7 +25,6 @@ $a->addEmptyDir('.phar');
echo $e->getMessage(),"\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
@@ -44,4 +43,3 @@ Warning: rmdir(): phar error: cannot remove directory "" in phar "foo.phar", dir
Warning: rmdir(): phar error: cannot remove directory "a" in phar "%smkdir.phar.php", phar error: path "a" exists and is a not a directory in %smkdir.php on line %d
Cannot create a directory in magic ".phar" directory
-===DONE===
diff --git a/ext/phar/tests/mounteddir.phpt b/ext/phar/tests/mounteddir.phpt
index 0a89e586ed..fe28a56919 100644
--- a/ext/phar/tests/mounteddir.phpt
+++ b/ext/phar/tests/mounteddir.phpt
@@ -47,19 +47,19 @@ include $fname;
$a = opendir($pname . '/testit');
$out = array();
while (false !== ($b = readdir($a))) {
- $out[] = $b;
+ $out[] = $b;
}
sort($out);
foreach ($out as $b) {
- echo "$b\n";
+ echo "$b\n";
}
$out = array();
foreach (new Phar($pname . '/testit') as $b) {
- $out[] = $b->getPathName();
+ $out[] = $b->getPathName();
}
sort($out);
foreach ($out as $b) {
- echo "$b\n";
+ echo "$b\n";
}
try {
Phar::mount($pname . '/testit', 'another\\..\\mistake');
@@ -82,7 +82,6 @@ Phar::mount($pname . '/testit/extfile.php', __DIR__);
echo $e->getMessage(), "\n";
}
?>
-===DONE===
--CLEAN--
<?php
@unlink(__DIR__ . '/tempmanifest1.phar.php');
@@ -98,7 +97,7 @@ string(%d) "%sextfile.php"
var_dump(__FILE__);
?>
-Warning: file_get_contents(phar://%stempmanifest1.phar.php/testit/directory): failed to open stream: phar error: path "testit/directory" is a directory in phar://%stempmanifest1.phar.php/index.php on line %d
+Warning: file_get_contents(phar://%stempmanifest1.phar.php/testit/directory): Failed to open stream: phar error: path "testit/directory" is a directory in phar://%stempmanifest1.phar.php/index.php on line %d
oops
string(%d) "phar://%sextfile.php"
@@ -116,4 +115,3 @@ Mounting of /testit to another\..\mistake within phar %stempmanifest1.phar.php f
Mounting of /notfound to %stests/this/does/not/exist within phar %stempmanifest1.phar.php failed
Mounting of /testit to %stests within phar %stests/tempmanifest1.phar.php failed
Mounting of /testit/extfile.php to %stests within phar %stests/tempmanifest1.phar.php failed
-===DONE===
diff --git a/ext/phar/tests/nophar.phpt b/ext/phar/tests/nophar.phpt
index e9cff950f4..46285796d4 100644
--- a/ext/phar/tests/nophar.phpt
+++ b/ext/phar/tests/nophar.phpt
@@ -6,9 +6,7 @@ Phar: phar run without ext/phar with default stub
<?php
include __DIR__ . '/files/nophar.phar';
?>
-===DONE===
--EXPECT--
in b
<?php include "b/c.php";
in d
-===DONE===
diff --git a/ext/phar/tests/open_for_write_existing.phpt b/ext/phar/tests/open_for_write_existing.phpt
index e1648568e0..bd4988ece9 100644
--- a/ext/phar/tests/open_for_write_existing.phpt
+++ b/ext/phar/tests/open_for_write_existing.phpt
@@ -23,9 +23,7 @@ fclose($fp);
include $pname . '/b/c.php';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECT--
extra
-===DONE===
diff --git a/ext/phar/tests/open_for_write_existing_b.phpt b/ext/phar/tests/open_for_write_existing_b.phpt
index d7ed20fd06..d124ddd84b 100644
--- a/ext/phar/tests/open_for_write_existing_b.phpt
+++ b/ext/phar/tests/open_for_write_existing_b.phpt
@@ -19,19 +19,12 @@ $files['b.php'] = '<?php echo "This is b\n"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
include 'files/phar_test.inc';
-$fp = fopen($pname . '/b/c.php', 'wb');
-fwrite($fp, 'extra');
-fclose($fp);
+var_dump(fopen($pname . '/b/c.php', 'wb'));
include $pname . '/b/c.php';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
-Warning: fopen(phar://%sopen_for_write_existing_b.phar.php/b/c.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_existing_b.php on line %d
-
-Warning: fwrite() expects parameter 1 to be resource, bool given in %sopen_for_write_existing_b.php on line %d
-
-Warning: fclose() expects parameter 1 to be resource, bool given in %sopen_for_write_existing_b.php on line %d
+Warning: fopen(phar://%sopen_for_write_existing_b.phar.php/b/c.php): Failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_existing_b.php on line %d
+bool(false)
This is b/c
-===DONE===
diff --git a/ext/phar/tests/open_for_write_existing_c.phpt b/ext/phar/tests/open_for_write_existing_c.phpt
index 2809d46c81..945f3ebb29 100644
--- a/ext/phar/tests/open_for_write_existing_c.phpt
+++ b/ext/phar/tests/open_for_write_existing_c.phpt
@@ -19,19 +19,12 @@ $files['b.php'] = '<?php echo "This is b\n"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
include 'files/phar_test.inc';
-$fp = fopen($pname . '/b/c.php', 'wb');
-fwrite($fp, 'extra');
-fclose($fp);
+var_dump(fopen($pname . '/b/c.php', 'wb'));
include $pname . '/b/c.php';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
-Warning: fopen(phar://%sopen_for_write_existing_c.phar.php/b/c.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_existing_c.php on line %d
-
-Warning: fwrite() expects parameter 1 to be resource, bool given in %spen_for_write_existing_c.php on line %d
-
-Warning: fclose() expects parameter 1 to be resource, bool given in %spen_for_write_existing_c.php on line %d
+Warning: fopen(phar://%sopen_for_write_existing_c.phar.php/b/c.php): Failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_existing_c.php on line %d
+bool(false)
This is b/c
-===DONE===
diff --git a/ext/phar/tests/open_for_write_newfile.phpt b/ext/phar/tests/open_for_write_newfile.phpt
index bd54a13397..57b7be090d 100644
--- a/ext/phar/tests/open_for_write_newfile.phpt
+++ b/ext/phar/tests/open_for_write_newfile.phpt
@@ -24,10 +24,8 @@ include $pname . '/b/c.php';
include $pname . '/b/new.php';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECT--
This is b/c
extra
-===DONE===
diff --git a/ext/phar/tests/open_for_write_newfile_b.phpt b/ext/phar/tests/open_for_write_newfile_b.phpt
index 7822492498..58bd08974e 100644
--- a/ext/phar/tests/open_for_write_newfile_b.phpt
+++ b/ext/phar/tests/open_for_write_newfile_b.phpt
@@ -19,26 +19,19 @@ $files['b.php'] = '<?php echo "This is b\n"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
include 'files/phar_test.inc';
-$fp = fopen($pname . '/b/new.php', 'wb');
-fwrite($fp, 'extra');
-fclose($fp);
+var_dump(fopen($pname . '/b/new.php', 'wb'));
include $pname . '/b/c.php';
include $pname . '/b/new.php';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
-Warning: fopen(phar://%sopen_for_write_newfile_b.phar.php/b/new.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_newfile_b.php on line %d
-
-Warning: fwrite() expects parameter 1 to be resource, bool given in %sopen_for_write_newfile_b.php on line %d
-
-Warning: fclose() expects parameter 1 to be resource, bool given in %sopen_for_write_newfile_b.php on line %d
+Warning: fopen(phar://%sopen_for_write_newfile_b.phar.php/b/new.php): Failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_newfile_b.php on line %d
+bool(false)
This is b/c
-Warning: include(phar://%sopen_for_write_newfile_b.phar.php/b/new.php): failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_b.phar.php" in %sopen_for_write_newfile_b.php on line %d
+Warning: include(phar://%sopen_for_write_newfile_b.phar.php/b/new.php): Failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_b.phar.php" in %sopen_for_write_newfile_b.php on line %d
Warning: include(): Failed opening 'phar://%sopen_for_write_newfile_b.phar.php/b/new.php' for inclusion (include_path='%s') in %sopen_for_write_newfile_b.php on line %d
-===DONE===
diff --git a/ext/phar/tests/open_for_write_newfile_c.phpt b/ext/phar/tests/open_for_write_newfile_c.phpt
index aa288d1110..3955b39361 100644
--- a/ext/phar/tests/open_for_write_newfile_c.phpt
+++ b/ext/phar/tests/open_for_write_newfile_c.phpt
@@ -19,26 +19,19 @@ $files['b.php'] = '<?php echo "This is b\n"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
include 'files/phar_test.inc';
-$fp = fopen($pname . '/b/new.php', 'wb');
-fwrite($fp, 'extra');
-fclose($fp);
+var_dump(fopen($pname . '/b/new.php', 'wb'));
include $pname . '/b/c.php';
include $pname . '/b/new.php';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
-Warning: fopen(phar://%sopen_for_write_newfile_c.phar.php/b/new.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_newfile_c.php on line %d
-
-Warning: fwrite() expects parameter 1 to be resource, bool given in %sopen_for_write_newfile_c.php on line %d
-
-Warning: fclose() expects parameter 1 to be resource, bool given in %sopen_for_write_newfile_c.php on line %d
+Warning: fopen(phar://%sopen_for_write_newfile_c.phar.php/b/new.php): Failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_newfile_c.php on line %d
+bool(false)
This is b/c
-Warning: include(phar://%sopen_for_write_newfile_c.phar.php/b/new.php): failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_c.phar.php" in %sopen_for_write_newfile_c.php on line %d
+Warning: include(phar://%sopen_for_write_newfile_c.phar.php/b/new.php): Failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_c.phar.php" in %sopen_for_write_newfile_c.php on line %d
Warning: include(): Failed opening 'phar://%sopen_for_write_newfile_c.phar.php/b/new.php' for inclusion (include_path='%s') in %sopen_for_write_newfile_c.php on line %d
-===DONE===
diff --git a/ext/phar/tests/opendir.phpt b/ext/phar/tests/opendir.phpt
index 2f5f6635d7..3bccb5c4a2 100644
--- a/ext/phar/tests/opendir.phpt
+++ b/ext/phar/tests/opendir.phpt
@@ -12,9 +12,9 @@ $a = new Phar($fname);
$a['index.php'] = '<?php
$a = opendir("dir");
if ($a) {
- while (false !== ($e = readdir($a))) {
- echo $e;
- }
+ while (false !== ($e = readdir($a))) {
+ echo $e;
+ }
}
?>';
$a['dir/file1.txt'] = 'hi';
@@ -30,15 +30,13 @@ echo "\n";
opendir('phar://');
opendir('phar://hi.phar');
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
file1.txtfile2.txtfile3.txt
-Warning: opendir(phar://): failed to open dir: phar error: no directory in "phar://", must have at least phar:/// for root directory (always use full path to a new phar)
+Warning: opendir(phar://): Failed to open directory: phar error: no directory in "phar://", must have at least phar:/// for root directory (always use full path to a new phar)
phar url "phar://" is unknown in %sopendir.php on line %d
-Warning: opendir(phar://hi.phar): failed to open dir: phar error: invalid url or non-existent phar "phar://hi.phar"
+Warning: opendir(phar://hi.phar): Failed to open directory: phar error: invalid url or non-existent phar "phar://hi.phar"
phar url "phar://hi.phar" is unknown in %sopendir.php on line %d
-===DONE===
diff --git a/ext/phar/tests/opendir_edgecases.phpt b/ext/phar/tests/opendir_edgecases.phpt
index c3303705cb..30c137baf2 100644
--- a/ext/phar/tests/opendir_edgecases.phpt
+++ b/ext/phar/tests/opendir_edgecases.phpt
@@ -12,7 +12,11 @@ Phar::interceptFileFuncs();
$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
-opendir(array());
+try {
+ opendir(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
mkdir(__DIR__ . '/poo');
chdir(__DIR__);
@@ -47,15 +51,13 @@ opendir("oops");
include $pname . '/foo';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
<?php rmdir(__DIR__ . '/poo');
--EXPECTF--
-Warning: opendir() expects parameter 1 to be a valid path, array given in %sopendir_edgecases.php on line %d
+opendir() expects parameter 1 to be a valid path, array given
.
..
foo
-Warning: opendir(phar://%sopendir_edgecases.phar.php/oops): failed to open dir: %s in phar://%sopendir_edgecases.phar.php/foo on line %d
-===DONE===
+Warning: opendir(phar://%sopendir_edgecases.phar.php/oops): Failed to open directory: %s in phar://%sopendir_edgecases.phar.php/foo on line %d
diff --git a/ext/phar/tests/phar_begin_setstub_commit.phpt b/ext/phar/tests/phar_begin_setstub_commit.phpt
index fffef0bdbf..44ebaabd64 100644
--- a/ext/phar/tests/phar_begin_setstub_commit.phpt
+++ b/ext/phar/tests/phar_begin_setstub_commit.phpt
@@ -29,7 +29,6 @@ include 'phar://phar_begin_setstub_commit.phar/a.php';
include 'phar://phar_begin_setstub_commit.phar/b.php';
var_dump($p->getStub());
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/phar_begin_setstub_commit.phar');
@@ -49,4 +48,3 @@ string(5) "Hello"
string(5) "World"
string(%d) "<?php var_dump("Second"); Phar::mapPhar("phar_begin_setstub_commit.phar"); __HALT_COMPILER(); ?>
"
-===DONE===
diff --git a/ext/phar/tests/phar_buildfromdirectory1.phpt b/ext/phar/tests/phar_buildfromdirectory1.phpt
index b7f7338e23..62a3689072 100644
--- a/ext/phar/tests/phar_buildfromdirectory1.phpt
+++ b/ext/phar/tests/phar_buildfromdirectory1.phpt
@@ -9,14 +9,13 @@ phar.readonly=0
<?php
$phar = new Phar(__DIR__ . '/buildfromdirectory1.phar');
try {
- ini_set('phar.readonly', 1);
- $phar->buildFromDirectory(1);
+ ini_set('phar.readonly', 1);
+ $phar->buildFromDirectory(1);
} catch (Exception $e) {
- var_dump(get_class($e));
- echo $e->getMessage() . "\n";
+ var_dump(get_class($e));
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/buildfromdirectory1.phar');
@@ -25,4 +24,3 @@ __HALT_COMPILER();
--EXPECTF--
%s(24) "UnexpectedValueException"
Cannot write to archive - write operations restricted by INI setting
-===DONE===
diff --git a/ext/phar/tests/phar_buildfromdirectory2-win.phpt b/ext/phar/tests/phar_buildfromdirectory2-win.phpt
index fd552302ae..e67d036388 100644
--- a/ext/phar/tests/phar_buildfromdirectory2-win.phpt
+++ b/ext/phar/tests/phar_buildfromdirectory2-win.phpt
@@ -11,14 +11,13 @@ phar.readonly=0
--FILE--
<?php
try {
- $phar = new Phar(__DIR__ . '/buildfromdirectory2.phar');
- $phar->buildFromDirectory(1);
+ $phar = new Phar(__DIR__ . '/buildfromdirectory2.phar');
+ $phar->buildFromDirectory(1);
} catch (Exception $e) {
- var_dump(get_class($e));
- echo $e->getMessage() . "\n";
+ var_dump(get_class($e));
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/buildfromdirectory2.phar');
@@ -27,4 +26,3 @@ __HALT_COMPILER();
--EXPECTF--
%s(24) "UnexpectedValueException"
RecursiveDirectoryIterator::__construct(1,1): %s (code: 2)
-===DONE===
diff --git a/ext/phar/tests/phar_buildfromdirectory2.phpt b/ext/phar/tests/phar_buildfromdirectory2.phpt
index 0105d1967c..d02d6146d6 100644
--- a/ext/phar/tests/phar_buildfromdirectory2.phpt
+++ b/ext/phar/tests/phar_buildfromdirectory2.phpt
@@ -11,14 +11,13 @@ phar.readonly=0
--FILE--
<?php
try {
- $phar = new Phar(__DIR__ . '/buildfromdirectory2.phar');
- $phar->buildFromDirectory(1);
+ $phar = new Phar(__DIR__ . '/buildfromdirectory2.phar');
+ $phar->buildFromDirectory(1);
} catch (Exception $e) {
- var_dump(get_class($e));
- echo $e->getMessage() . "\n";
+ var_dump(get_class($e));
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/buildfromdirectory2.phar');
@@ -26,5 +25,4 @@ __HALT_COMPILER();
?>
--EXPECTF--
%s(24) "UnexpectedValueException"
-RecursiveDirectoryIterator::__construct(1): failed to open dir: No such file or directory
-===DONE===
+RecursiveDirectoryIterator::__construct(1): Failed to open directory: No such file or directory
diff --git a/ext/phar/tests/phar_buildfromdirectory4.phpt b/ext/phar/tests/phar_buildfromdirectory4.phpt
index 610e67719a..a492592c55 100644
--- a/ext/phar/tests/phar_buildfromdirectory4.phpt
+++ b/ext/phar/tests/phar_buildfromdirectory4.phpt
@@ -15,19 +15,18 @@ foreach(range(1, 4) as $i) {
}
try {
- $phar = new Phar(__DIR__ . '/buildfromdirectory4.phar');
- $a = $phar->buildFromDirectory(__DIR__ . '/testdir4');
- asort($a);
- var_dump($a);
+ $phar = new Phar(__DIR__ . '/buildfromdirectory4.phar');
+ $a = $phar->buildFromDirectory(__DIR__ . '/testdir4');
+ asort($a);
+ var_dump($a);
} catch (Exception $e) {
- var_dump(get_class($e));
- echo $e->getMessage() . "\n";
+ var_dump(get_class($e));
+ echo $e->getMessage() . "\n";
}
var_dump(file_exists(__DIR__ . '/buildfromdirectory4.phar'));
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/buildfromdirectory4.phar');
@@ -48,4 +47,3 @@ array(4) {
string(%d) "%stestdir4%cfile4.txt"
}
bool(true)
-===DONE===
diff --git a/ext/phar/tests/phar_buildfromdirectory5.phpt b/ext/phar/tests/phar_buildfromdirectory5.phpt
index b7434968a4..f5c48ee163 100644
--- a/ext/phar/tests/phar_buildfromdirectory5.phpt
+++ b/ext/phar/tests/phar_buildfromdirectory5.phpt
@@ -14,19 +14,18 @@ foreach(range(1, 4) as $i) {
}
try {
- $phar = new Phar(__DIR__ . '/buildfromdirectory5.phar');
- $a = $phar->buildFromDirectory(__DIR__ . '/testdir5', '/\.txt/');
- asort($a);
- var_dump($a);
+ $phar = new Phar(__DIR__ . '/buildfromdirectory5.phar');
+ $a = $phar->buildFromDirectory(__DIR__ . '/testdir5', '/\.txt/');
+ asort($a);
+ var_dump($a);
} catch (Exception $e) {
- var_dump(get_class($e));
- echo $e->getMessage() . "\n";
+ var_dump(get_class($e));
+ echo $e->getMessage() . "\n";
}
var_dump(file_exists(__DIR__ . '/buildfromdirectory5.phar'));
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/buildfromdirectory5.phar');
@@ -47,4 +46,3 @@ array(4) {
string(%d) "%stestdir5%cfile4.txt"
}
bool(true)
-===DONE===
diff --git a/ext/phar/tests/phar_buildfromdirectory6.phpt b/ext/phar/tests/phar_buildfromdirectory6.phpt
index 1d3491e659..e25439a64b 100644
--- a/ext/phar/tests/phar_buildfromdirectory6.phpt
+++ b/ext/phar/tests/phar_buildfromdirectory6.phpt
@@ -14,17 +14,16 @@ foreach(range(1, 4) as $i) {
}
try {
- $phar = new Phar(__DIR__ . '/buildfromdirectory6.phar');
- var_dump($phar->buildFromDirectory(__DIR__ . '/testdir6', '/\.php$/'));
+ $phar = new Phar(__DIR__ . '/buildfromdirectory6.phar');
+ var_dump($phar->buildFromDirectory(__DIR__ . '/testdir6', '/\.php$/'));
} catch (Exception $e) {
- var_dump(get_class($e));
- echo $e->getMessage() . "\n";
+ var_dump(get_class($e));
+ echo $e->getMessage() . "\n";
}
var_dump(file_exists(__DIR__ . '/buildfromdirectory6.phar'));
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/buildfromdirectory6.phar');
@@ -37,4 +36,3 @@ rmdir(__DIR__ . '/testdir6');
array(0) {
}
bool(false)
-===DONE===
diff --git a/ext/phar/tests/phar_buildfromiterator1.phpt b/ext/phar/tests/phar_buildfromiterator1.phpt
index 774ef658fa..aac85ff33e 100644
--- a/ext/phar/tests/phar_buildfromiterator1.phpt
+++ b/ext/phar/tests/phar_buildfromiterator1.phpt
@@ -9,14 +9,13 @@ phar.readonly=0
<?php
$phar = new Phar(__DIR__ . '/buildfromiterator1.phar');
try {
- ini_set('phar.readonly', 1);
- $phar->buildFromIterator(1);
+ ini_set('phar.readonly', 1);
+ $phar->buildFromIterator(1);
} catch (Exception $e) {
- var_dump(get_class($e));
- echo $e->getMessage() . "\n";
+ var_dump(get_class($e));
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/buildfromiterator1.phar');
@@ -25,4 +24,3 @@ __HALT_COMPILER();
--EXPECTF--
%s(24) "UnexpectedValueException"
Cannot write out phar archive, phar is read-only
-===DONE===
diff --git a/ext/phar/tests/phar_buildfromiterator10.phpt b/ext/phar/tests/phar_buildfromiterator10.phpt
index a7b9c8701b..6db0c93cdd 100644
--- a/ext/phar/tests/phar_buildfromiterator10.phpt
+++ b/ext/phar/tests/phar_buildfromiterator10.phpt
@@ -10,19 +10,18 @@ phar.readonly=0
--FILE--
<?php
try {
- chdir(__DIR__);
- $phar = new Phar(__DIR__ . '/buildfromiterator10.phar');
- $dir = new RecursiveDirectoryIterator('.');
- $iter = new RecursiveIteratorIterator($dir);
- $a = $phar->buildFromIterator(new RegexIterator($iter, '/_\d{3}\.phpt$/'), __DIR__ . DIRECTORY_SEPARATOR);
- asort($a);
- var_dump($a);
+ chdir(__DIR__);
+ $phar = new Phar(__DIR__ . '/buildfromiterator10.phar');
+ $dir = new RecursiveDirectoryIterator('.');
+ $iter = new RecursiveIteratorIterator($dir);
+ $a = $phar->buildFromIterator(new RegexIterator($iter, '/_\d{3}\.phpt$/'), __DIR__ . DIRECTORY_SEPARATOR);
+ asort($a);
+ var_dump($a);
} catch (Exception $e) {
- var_dump(get_class($e));
- echo $e->getMessage() . "\n";
+ var_dump(get_class($e));
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/buildfromiterator10.phar');
@@ -99,4 +98,3 @@ array(34) {
["zip/corrupt_010.phpt"]=>
string(%d) "%szip%ccorrupt_010.phpt"
}
-===DONE===
diff --git a/ext/phar/tests/phar_buildfromiterator4.phpt b/ext/phar/tests/phar_buildfromiterator4.phpt
index fc42d77d4e..fbe51fd1a3 100644
--- a/ext/phar/tests/phar_buildfromiterator4.phpt
+++ b/ext/phar/tests/phar_buildfromiterator4.phpt
@@ -36,22 +36,21 @@ class myIterator implements Iterator
}
}
try {
- chdir(__DIR__);
- $phar = new Phar(__DIR__ . '/buildfromiterator4.phar');
- var_dump($phar->buildFromIterator(new myIterator(
- array(
- 'a' => basename(__FILE__, 'php') . 'phpt',
- // demonstrate that none of these are added
- '.phar/stub.php' => basename(__FILE__, 'php') . 'phpt',
- '.phar/alias.txt' => basename(__FILE__, 'php') . 'phpt',
- '.phar/oops' => basename(__FILE__, 'php') . 'phpt',
- ))));
+ chdir(__DIR__);
+ $phar = new Phar(__DIR__ . '/buildfromiterator4.phar');
+ var_dump($phar->buildFromIterator(new myIterator(
+ array(
+ 'a' => basename(__FILE__, 'php') . 'phpt',
+ // demonstrate that none of these are added
+ '.phar/stub.php' => basename(__FILE__, 'php') . 'phpt',
+ '.phar/alias.txt' => basename(__FILE__, 'php') . 'phpt',
+ '.phar/oops' => basename(__FILE__, 'php') . 'phpt',
+ ))));
} catch (Exception $e) {
- var_dump(get_class($e));
- echo $e->getMessage() . "\n";
+ var_dump(get_class($e));
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/buildfromiterator4.phar');
@@ -80,4 +79,3 @@ array(1) {
["a"]=>
string(%d) "%sphar_buildfromiterator4.phpt"
}
-===DONE===
diff --git a/ext/phar/tests/phar_buildfromiterator5.phpt b/ext/phar/tests/phar_buildfromiterator5.phpt
index a83e1c0d38..57b1328293 100644
--- a/ext/phar/tests/phar_buildfromiterator5.phpt
+++ b/ext/phar/tests/phar_buildfromiterator5.phpt
@@ -36,15 +36,14 @@ class myIterator implements Iterator
}
}
try {
- chdir(__DIR__);
- $phar = new Phar(__DIR__ . '/buildfromiterator5.phar');
- var_dump($phar->buildFromIterator(new myIterator(array('a' => new stdClass))));
+ chdir(__DIR__);
+ $phar = new Phar(__DIR__ . '/buildfromiterator5.phar');
+ var_dump($phar->buildFromIterator(new myIterator(array('a' => new stdClass))));
} catch (Exception $e) {
- var_dump(get_class($e));
- echo $e->getMessage() . "\n";
+ var_dump(get_class($e));
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/buildfromiterator5.phar');
@@ -56,4 +55,3 @@ valid
current
%s(24) "UnexpectedValueException"
Iterator myIterator returned an invalid value (must return a string)
-===DONE===
diff --git a/ext/phar/tests/phar_buildfromiterator6.phpt b/ext/phar/tests/phar_buildfromiterator6.phpt
index 0b99e54611..612b114e9b 100644
--- a/ext/phar/tests/phar_buildfromiterator6.phpt
+++ b/ext/phar/tests/phar_buildfromiterator6.phpt
@@ -36,15 +36,14 @@ class myIterator implements Iterator
}
}
try {
- chdir(__DIR__);
- $phar = new Phar(__DIR__ . '/buildfromiterator6.phar');
- var_dump($phar->buildFromIterator(new myIterator(array(basename(__FILE__, 'php') . 'phpt'))));
+ chdir(__DIR__);
+ $phar = new Phar(__DIR__ . '/buildfromiterator6.phar');
+ var_dump($phar->buildFromIterator(new myIterator(array(basename(__FILE__, 'php') . 'phpt'))));
} catch (Exception $e) {
- var_dump(get_class($e));
- echo $e->getMessage() . "\n";
+ var_dump(get_class($e));
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/buildfromiterator6.phar');
@@ -57,4 +56,3 @@ current
key
%s(24) "UnexpectedValueException"
Iterator myIterator returned an invalid key (must return a string)
-===DONE===
diff --git a/ext/phar/tests/phar_buildfromiterator7.phpt b/ext/phar/tests/phar_buildfromiterator7.phpt
index bc0fa6ee4a..d3fa437a18 100644
--- a/ext/phar/tests/phar_buildfromiterator7.phpt
+++ b/ext/phar/tests/phar_buildfromiterator7.phpt
@@ -36,15 +36,14 @@ class myIterator implements Iterator
}
}
try {
- chdir(__DIR__);
- $phar = new Phar(__DIR__ . '/buildfromiterator7.phar');
- var_dump($phar->buildFromIterator(new myIterator(array('a' => basename(__FILE__, 'php') . '/oopsie/there.phpt'))));
+ chdir(__DIR__);
+ $phar = new Phar(__DIR__ . '/buildfromiterator7.phar');
+ var_dump($phar->buildFromIterator(new myIterator(array('a' => basename(__FILE__, 'php') . '/oopsie/there.phpt'))));
} catch (Exception $e) {
- var_dump(get_class($e));
- echo $e->getMessage() . "\n";
+ var_dump(get_class($e));
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/buildfromiterator7.phar');
@@ -57,4 +56,3 @@ current
key
%s(24) "UnexpectedValueException"
Iterator myIterator returned a file that could not be opened "phar_buildfromiterator7./oopsie/there.phpt"
-===DONE===
diff --git a/ext/phar/tests/phar_buildfromiterator8.phpt b/ext/phar/tests/phar_buildfromiterator8.phpt
index cbee1a536a..b3dc947d9e 100644
--- a/ext/phar/tests/phar_buildfromiterator8.phpt
+++ b/ext/phar/tests/phar_buildfromiterator8.phpt
@@ -7,17 +7,16 @@ phar.readonly=0
--FILE--
<?php
try {
- chdir(__DIR__);
- $phar = new Phar(__DIR__ . '/buildfromiterator8.phar');
- $a = $phar->buildFromIterator(new RegexIterator(new DirectoryIterator('.'), '/^\d{0,3}\.phpt\\z|^\.\\z|^\.\.\\z/'), __DIR__ . DIRECTORY_SEPARATOR);
- asort($a);
- var_dump($a);
+ chdir(__DIR__);
+ $phar = new Phar(__DIR__ . '/buildfromiterator8.phar');
+ $a = $phar->buildFromIterator(new RegexIterator(new DirectoryIterator('.'), '/^\d{0,3}\.phpt\\z|^\.\\z|^\.\.\\z/'), __DIR__ . DIRECTORY_SEPARATOR);
+ asort($a);
+ var_dump($a);
} catch (Exception $e) {
- var_dump(get_class($e));
- echo $e->getMessage() . "\n";
+ var_dump(get_class($e));
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/buildfromiterator8.phar');
@@ -92,4 +91,3 @@ array(33) {
["033.phpt"]=>
string(%d) "%s033.phpt"
}
-===DONE===
diff --git a/ext/phar/tests/phar_buildfromiterator9.phpt b/ext/phar/tests/phar_buildfromiterator9.phpt
index 28febccf81..20637453e0 100644
--- a/ext/phar/tests/phar_buildfromiterator9.phpt
+++ b/ext/phar/tests/phar_buildfromiterator9.phpt
@@ -36,16 +36,15 @@ class myIterator implements Iterator
}
}
try {
- chdir(__DIR__);
- $phar = new Phar(__DIR__ . '/buildfromiterator9.phar');
- var_dump($phar->buildFromIterator(new myIterator(array('a' => $a = fopen(basename(__FILE__, 'php') . 'phpt', 'r')))));
- fclose($a);
+ chdir(__DIR__);
+ $phar = new Phar(__DIR__ . '/buildfromiterator9.phar');
+ var_dump($phar->buildFromIterator(new myIterator(array('a' => $a = fopen(basename(__FILE__, 'php') . 'phpt', 'r')))));
+ fclose($a);
} catch (Exception $e) {
- var_dump(get_class($e));
- echo $e->getMessage() . "\n";
+ var_dump(get_class($e));
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/buildfromiterator9.phar');
@@ -62,4 +61,3 @@ array(1) {
["a"]=>
string(%d) "[stream]"
}
-===DONE===
diff --git a/ext/phar/tests/phar_bz2.phpt b/ext/phar/tests/phar_bz2.phpt
index 8b2d539db0..f70e2ae9eb 100644
--- a/ext/phar/tests/phar_bz2.phpt
+++ b/ext/phar/tests/phar_bz2.phpt
@@ -40,14 +40,12 @@ $b = new Phar($fname2);
var_dump($b->isFileFormat(Phar::PHAR));
var_dump($b->isCompressed() == Phar::BZ2);
// additional code coverage
-$b->isFileFormat(array());
try {
$b->isFileFormat(25);
} catch (Exception $e) {
echo $e->getMessage(),"\n";
}
?>
-===DONE===
--CLEAN--
<?php
@unlink(__DIR__ . '/phar_bz2.phar');
@@ -58,7 +56,4 @@ string(9) "it worked"
string(%d) "phar://%sphar_bz2.phar/tar_004.php"
bool(true)
bool(true)
-
-Warning: Phar::isFileFormat() expects parameter 1 to be int, array given in %sphar_bz2.php on line %d
Unknown file format specified
-===DONE===
diff --git a/ext/phar/tests/phar_commitwrite.phpt b/ext/phar/tests/phar_commitwrite.phpt
index 7e5c6a3998..5891d4b081 100644
--- a/ext/phar/tests/phar_commitwrite.phpt
+++ b/ext/phar/tests/phar_commitwrite.phpt
@@ -12,17 +12,15 @@ $p['file1.txt'] = 'hi';
$p->stopBuffering();
var_dump(strlen($p->getStub()));
$p->setStub("<?php
-function __autoload(\$class)
-{
+spl_autoload_register(function(\$class) {
include 'phar://' . str_replace('_', '/', \$class);
-}
+});
Phar::mapPhar('phar_commitwrite.phar');
include 'phar://phar_commitwrite.phar/startup.php';
__HALT_COMPILER();
?>");
var_dump($p->getStub());
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/phar_commitwrite.phar');
@@ -31,12 +29,10 @@ __HALT_COMPILER();
--EXPECTF--
int(6641)
string(%d) "<?php
-function __autoload($class)
-{
+spl_autoload_register(function($class) {
include 'phar://' . str_replace('_', '/', $class);
-}
+});
Phar::mapPhar('phar_commitwrite.phar');
include 'phar://phar_commitwrite.phar/startup.php';
__HALT_COMPILER(); ?>
"
-===DONE===
diff --git a/ext/phar/tests/phar_construct_invalidurl.phpt b/ext/phar/tests/phar_construct_invalidurl.phpt
index 30a4687289..2b39cc7659 100644
--- a/ext/phar/tests/phar_construct_invalidurl.phpt
+++ b/ext/phar/tests/phar_construct_invalidurl.phpt
@@ -7,24 +7,22 @@ default_charset=UTF-8
--FILE--
<?php
try {
- $a = new Phar('http://should.fail.com');
+ $a = new Phar('http://should.fail.com');
} catch (UnexpectedValueException $e) {
- echo $e->getMessage(),"\n";
+ echo $e->getMessage(),"\n";
}
try {
- $a = new Phar('http://');
+ $a = new Phar('http://');
} catch (UnexpectedValueException $e) {
- echo $e->getMessage(),"\n";
+ echo $e->getMessage(),"\n";
}
try {
- $a = new Phar('http:/');
+ $a = new Phar('http:/');
} catch (UnexpectedValueException $e) {
- echo $e->getMessage(),"\n";
+ echo $e->getMessage(),"\n";
}
?>
-===DONE===
--EXPECT--
Cannot create a phar archive from a URL like "http://should.fail.com". Phar objects can only be created from local files
Cannot create a phar archive from a URL like "http://". Phar objects can only be created from local files
Cannot create phar 'http:/', file extension (or combination) not recognised or the directory does not exist
-===DONE===
diff --git a/ext/phar/tests/phar_convert_again.phpt b/ext/phar/tests/phar_convert_again.phpt
index 126e6a64b3..82dc739efb 100644
--- a/ext/phar/tests/phar_convert_again.phpt
+++ b/ext/phar/tests/phar_convert_again.phpt
@@ -152,7 +152,6 @@ $tgz->convertToData(Phar::TAR, Phar::GZ, '.phar/.tgz.oops');
echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar');
@@ -202,4 +201,3 @@ A Phar stub cannot be set in a plain tar archive
data phar "%sphar_convert_again2.phar.tgz.oops" has invalid extension phar.tgz.oops
phar "%sphar_convert_again2.tgz.oops" has invalid extension tgz.oops
data phar "%sphar_convert_again2.phar/.tgz.oops" has invalid extension phar/.tgz.oops
-===DONE===
diff --git a/ext/phar/tests/phar_convert_repeated.phpt b/ext/phar/tests/phar_convert_repeated.phpt
index 94b5bf47ff..f7553f489d 100644
--- a/ext/phar/tests/phar_convert_repeated.phpt
+++ b/ext/phar/tests/phar_convert_repeated.phpt
@@ -85,7 +85,6 @@ var_dump($phar->getStub());
var_dump($phar->getAlias());
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip');
@@ -146,4 +145,3 @@ bool(true)
string(60) "<?php // zip-based phar archive stub file
__HALT_COMPILER();"
NULL
-===DONE===
diff --git a/ext/phar/tests/phar_convert_repeated_b.phpt b/ext/phar/tests/phar_convert_repeated_b.phpt
index faa372d071..4bb3e81bcf 100644
--- a/ext/phar/tests/phar_convert_repeated_b.phpt
+++ b/ext/phar/tests/phar_convert_repeated_b.phpt
@@ -43,14 +43,14 @@ var_dump($phar->getAlias());
echo "================= convertToPhar() ====================\n";
try {
- $phar = $phar->convertToExecutable(Phar::PHAR);
- var_dump($phar->isFileFormat(Phar::PHAR));
- var_dump($phar->isFileFormat(Phar::TAR));
- var_dump($phar->isFileFormat(Phar::ZIP));
- var_dump(strlen($phar->getStub()));
- var_dump($phar->getAlias());
+ $phar = $phar->convertToExecutable(Phar::PHAR);
+ var_dump($phar->isFileFormat(Phar::PHAR));
+ var_dump($phar->isFileFormat(Phar::TAR));
+ var_dump($phar->isFileFormat(Phar::ZIP));
+ var_dump(strlen($phar->getStub()));
+ var_dump($phar->getAlias());
} catch(Exception $e) {
- echo $e->getMessage()."\n";
+ echo $e->getMessage()."\n";
}
echo "================ convertToTar(GZ) ====================\n";
@@ -65,17 +65,16 @@ var_dump($phar->getAlias());
echo "================= convertToPhar() ====================\n";
try {
- $phar = $phar->convertToExecutable(Phar::PHAR);
- var_dump($phar->isFileFormat(Phar::PHAR));
- var_dump($phar->isFileFormat(Phar::TAR));
- var_dump($phar->isFileFormat(Phar::ZIP));
- var_dump(strlen($phar->getStub()));
- var_dump($phar->getAlias());
+ $phar = $phar->convertToExecutable(Phar::PHAR);
+ var_dump($phar->isFileFormat(Phar::PHAR));
+ var_dump($phar->isFileFormat(Phar::TAR));
+ var_dump($phar->isFileFormat(Phar::ZIP));
+ var_dump(strlen($phar->getStub()));
+ var_dump($phar->getAlias());
} catch(Exception $e) {
- echo $e->getMessage()."\n";
+ echo $e->getMessage()."\n";
}
?>
-===DONE===
--CLEAN--
<?php
echo __DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.gz' . "\n";
@@ -117,4 +116,3 @@ string(0) ""
NULL
================= convertToPhar() ====================
Cannot write out executable phar archive, phar is read-only
-===DONE===
diff --git a/ext/phar/tests/phar_convert_tar.phpt b/ext/phar/tests/phar_convert_tar.phpt
index 5efbe9bed5..d4a7f3c8bc 100644
--- a/ext/phar/tests/phar_convert_tar.phpt
+++ b/ext/phar/tests/phar_convert_tar.phpt
@@ -37,7 +37,6 @@ var_dump($phar->isFileFormat(Phar::TAR));
var_dump($phar->getStub());
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar');
@@ -54,4 +53,3 @@ __HALT_COMPILER();"
bool(true)
string(60) "<?php // tar-based phar archive stub file
__HALT_COMPILER();"
-===DONE===
diff --git a/ext/phar/tests/phar_convert_tar2.phpt b/ext/phar/tests/phar_convert_tar2.phpt
index 5b7eb8cc8a..54130aec99 100644
--- a/ext/phar/tests/phar_convert_tar2.phpt
+++ b/ext/phar/tests/phar_convert_tar2.phpt
@@ -41,7 +41,6 @@ var_dump($phar->isCompressed() == Phar::GZ);
var_dump($phar->getStub());
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar.gz');
@@ -61,4 +60,3 @@ bool(true)
bool(true)
string(60) "<?php // tar-based phar archive stub file
__HALT_COMPILER();"
-===DONE===
diff --git a/ext/phar/tests/phar_convert_tar3.phpt b/ext/phar/tests/phar_convert_tar3.phpt
index bc737d5483..031303241a 100644
--- a/ext/phar/tests/phar_convert_tar3.phpt
+++ b/ext/phar/tests/phar_convert_tar3.phpt
@@ -41,7 +41,6 @@ var_dump($phar->isCompressed() == Phar::BZ2);
var_dump($phar->getStub());
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar.bz2');
@@ -62,4 +61,3 @@ bool(true)
bool(true)
string(60) "<?php // tar-based phar archive stub file
__HALT_COMPILER();"
-===DONE===
diff --git a/ext/phar/tests/phar_convert_zip.phpt b/ext/phar/tests/phar_convert_zip.phpt
index 8f8ef415b1..584e58ee99 100644
--- a/ext/phar/tests/phar_convert_zip.phpt
+++ b/ext/phar/tests/phar_convert_zip.phpt
@@ -36,7 +36,6 @@ $phar = new Phar($fname3);
var_dump($phar->isFileFormat(Phar::ZIP));
var_dump($phar->getStub());
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip');
@@ -53,4 +52,3 @@ __HALT_COMPILER();"
bool(true)
string(60) "<?php // zip-based phar archive stub file
__HALT_COMPILER();"
-===DONE===
diff --git a/ext/phar/tests/phar_copy.phpt b/ext/phar/tests/phar_copy.phpt
index 2f5c2d5bd2..c450efaba5 100644
--- a/ext/phar/tests/phar_copy.phpt
+++ b/ext/phar/tests/phar_copy.phpt
@@ -20,21 +20,21 @@ $p = new Phar($fname);
try
{
- $p['a'] = 'hi';
- $p->startBuffering();
- $p->copy('a', 'b');
- echo file_get_contents($p['b']->getPathName());
- $p['a']->compress(Phar::GZ);
- $p['b']->setMetadata('a');
- $p->copy('b', 'c');
- $p->stopBuffering();
- echo file_get_contents($p['c']->getPathName());
- copy($fname, $fname2);
- $p->copy('a', $ename);
+ $p['a'] = 'hi';
+ $p->startBuffering();
+ $p->copy('a', 'b');
+ echo file_get_contents($p['b']->getPathName());
+ $p['a']->compress(Phar::GZ);
+ $p['b']->setMetadata('a');
+ $p->copy('b', 'c');
+ $p->stopBuffering();
+ echo file_get_contents($p['c']->getPathName());
+ copy($fname, $fname2);
+ $p->copy('a', $ename);
}
catch(Exception $e)
{
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
ini_set('phar.readonly',1);
$p2 = new Phar($fname2);
@@ -67,7 +67,6 @@ $p2->copy('.phar/stub.php', 'd');
echo $e->getMessage(),"\n";
}
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '2.phar.php'); ?>
@@ -80,4 +79,3 @@ file "a" cannot be copied to file "b", file must not already exist in phar %spha
hi
file "d" cannot be copied to file ".phar/stub.php", cannot copy to Phar meta-file in %sphar_copy2.phar.php
file ".phar/stub.php" cannot be copied to file "d", cannot copy Phar meta-file in %sphar_copy2.phar.php
-===DONE===
diff --git a/ext/phar/tests/phar_create_in_cwd.phpt b/ext/phar/tests/phar_create_in_cwd.phpt
index 4fb142ec2e..2f5af26c41 100644
--- a/ext/phar/tests/phar_create_in_cwd.phpt
+++ b/ext/phar/tests/phar_create_in_cwd.phpt
@@ -9,24 +9,22 @@ phar.readonly=0
<?php
chdir(__DIR__);
try {
- $p = new Phar('phar_create_in_cwd.phar');
- $p['file1.txt'] = 'hi';
- var_dump(strlen($p->getStub()));
- $p->setStub("<?php
-function __autoload(\$class)
-{
+ $p = new Phar('phar_create_in_cwd.phar');
+ $p['file1.txt'] = 'hi';
+ var_dump(strlen($p->getStub()));
+ $p->setStub("<?php
+spl_autoload_register(function(\$class) {
include 'phar://' . str_replace('_', '/', \$class);
-}
+});
Phar::mapPhar('phar_create_in_cwd.phar');
include 'phar://phar_create_in_cwd.phar/startup.php';
__HALT_COMPILER();
?>");
- var_dump($p->getStub());
+ var_dump($p->getStub());
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/phar_create_in_cwd.phar');
@@ -34,12 +32,10 @@ unlink(__DIR__ . '/phar_create_in_cwd.phar');
--EXPECTF--
int(6641)
string(%d) "<?php
-function __autoload($class)
-{
+spl_autoload_register(function($class) {
include 'phar://' . str_replace('_', '/', $class);
-}
+});
Phar::mapPhar('phar_create_in_cwd.phar');
include 'phar://phar_create_in_cwd.phar/startup.php';
__HALT_COMPILER(); ?>
"
-===DONE===
diff --git a/ext/phar/tests/phar_createdefaultstub.phpt b/ext/phar/tests/phar_createdefaultstub.phpt
index e074d649bd..0ed5abfb69 100644
--- a/ext/phar/tests/phar_createdefaultstub.phpt
+++ b/ext/phar/tests/phar_createdefaultstub.phpt
@@ -32,7 +32,6 @@ var_dump(Phar::createDefaultStub('hio', str_repeat('a', 401)));
echo $e->getMessage() . "\n";
}
?>
-===DONE===
--EXPECT--
string(6641) "<?php
@@ -926,4 +925,3 @@ __HALT_COMPILER(); ?>"
============================================================================
int(7032)
Illegal web filename passed in for stub creation, was 401 characters long, and only 400 or less is allowed
-===DONE===
diff --git a/ext/phar/tests/phar_ctx_001.phpt b/ext/phar/tests/phar_ctx_001.phpt
index 8aba1259a1..96402333a7 100644
--- a/ext/phar/tests/phar_ctx_001.phpt
+++ b/ext/phar/tests/phar_ctx_001.phpt
@@ -58,7 +58,6 @@ var_dump(file_get_contents($pname . '/b'));
var_dump($phar['b']->isCompressed());
var_dump($phar['b']->getMetaData());
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
@@ -97,4 +96,3 @@ array(1) {
[0]=>
int(4)
}
-===DONE===
diff --git a/ext/phar/tests/phar_decompress.phpt b/ext/phar/tests/phar_decompress.phpt
index dbd58abd7f..6f5e33452b 100644
--- a/ext/phar/tests/phar_decompress.phpt
+++ b/ext/phar/tests/phar_decompress.phpt
@@ -32,21 +32,19 @@ $unc2 = $gz->decompress();
echo $unc2->getPath() . "\n";
$unc3 = $gz->decompress('hooba.phar');
echo $unc3->getPath() . "\n";
-$gz->decompress(array());
$zip = $phar->convertToData(Phar::ZIP);
ini_set('phar.readonly', 1);
try {
-$gz->decompress();
+ $gz->decompress();
} catch (Exception $e) {
-echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
-$zip->decompress();
+ $zip->decompress();
} catch (Exception $e) {
-echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
@@ -62,8 +60,5 @@ int(4096)
%sphar_decompress2.phar
%sphar_decompress.phar
%sphar_decompress.hooba.phar
-
-Warning: Phar::decompress() expects parameter 1 to be %string, array given in %sphar_decompress.php on line %d
Cannot decompress phar archive, phar is read-only
Cannot decompress zip-based archives with whole-archive compression
-===DONE===
diff --git a/ext/phar/tests/phar_dir_iterate.phpt b/ext/phar/tests/phar_dir_iterate.phpt
index 754ae44600..bc5132aade 100644
--- a/ext/phar/tests/phar_dir_iterate.phpt
+++ b/ext/phar/tests/phar_dir_iterate.phpt
@@ -15,10 +15,9 @@ $phar['sub/top.txt'] = 'there';
$phar['another.file.txt'] = 'wowee';
$newphar = new Phar($fname);
foreach (new RecursiveIteratorIterator($newphar) as $path => $obj) {
- var_dump($obj->getPathName());
+ var_dump($obj->getPathName());
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
@@ -28,4 +27,3 @@ __halt_compiler();
string(%d) "phar://%sphar_dir_iterate.phar.php%canother.file.txt"
string(%d) "phar://%sphar_dir_iterate.phar.php/sub%ctop.txt"
string(%d) "phar://%sphar_dir_iterate.phar.php%ctop.txt"
-===DONE===
diff --git a/ext/phar/tests/phar_dotted_path.phpt b/ext/phar/tests/phar_dotted_path.phpt
index 9f7fb217fc..0315da5e28 100644
--- a/ext/phar/tests/phar_dotted_path.phpt
+++ b/ext/phar/tests/phar_dotted_path.phpt
@@ -29,7 +29,6 @@ foreach ($phar as $entry) {
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/broken.dirname/dotted_path.phar');
@@ -38,4 +37,3 @@ rmdir(__DIR__ . '/broken.dirname');
--EXPECT--
this is a
this is b
-===DONE===
diff --git a/ext/phar/tests/phar_extract.phpt b/ext/phar/tests/phar_extract.phpt
index b8cdef7c79..a354e0a608 100644
--- a/ext/phar/tests/phar_extract.phpt
+++ b/ext/phar/tests/phar_extract.phpt
@@ -25,13 +25,13 @@ $a->extractTo(__DIR__ . '/extract');
$out = array();
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator(__DIR__ . '/extract', 0x00003000), RecursiveIteratorIterator::CHILD_FIRST) as $p => $b) {
- $out[] = $p;
+ $out[] = $p;
}
sort($out);
foreach ($out as $b) {
- echo "$b\n";
+ echo "$b\n";
}
$a->extractTo(__DIR__ . '/extract1', 'file1.txt');
@@ -45,37 +45,41 @@ var_dump(file_get_contents(__DIR__ . '/extract1-2/file2.txt'));
var_dump(is_dir(__DIR__ . '/extract1-2/one/level'));
try {
- $a->extractTo(__DIR__ . '/whatever', 134);
+ $a->extractTo(__DIR__ . '/whatever', 134);
} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+ echo $e->getMessage(), "\n";
}
-$a->extractTo(array());
+try {
+ $a->extractTo(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
try {
- $a->extractTo('');
+ $a->extractTo('');
} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+ echo $e->getMessage(), "\n";
}
file_put_contents(__DIR__ . '/oops', 'I is file');
try {
- $a->extractTo(__DIR__ . '/oops', 'file1.txt');
+ $a->extractTo(__DIR__ . '/oops', 'file1.txt');
} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+ echo $e->getMessage(), "\n";
}
try {
- $a->extractTo(__DIR__ . '/oops1', array(array(), 'file1.txt'));
+ $a->extractTo(__DIR__ . '/oops1', array(array(), 'file1.txt'));
} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+ echo $e->getMessage(), "\n";
}
try {
- $a->extractTo(__DIR__ . '/extract', 'file1.txt');
+ $a->extractTo(__DIR__ . '/extract', 'file1.txt');
} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+ echo $e->getMessage(), "\n";
}
file_put_contents(__DIR__ . '/extract/file1.txt', 'first');
@@ -85,21 +89,20 @@ $a->extractTo(__DIR__ . '/extract', 'file1.txt', true);
var_dump(file_get_contents(__DIR__ . '/extract/file1.txt'));
try {
- $a->extractTo(str_repeat('a', 20000), 'file1.txt');
+ $a->extractTo(str_repeat('a', 20000), 'file1.txt');
} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+ echo $e->getMessage(), "\n";
}
$a[str_repeat('a', 20000)] = 'long';
try {
- $a->extractTo(__DIR__ . '/extract', str_repeat('a', 20000));
+ $a->extractTo(__DIR__ . '/extract', str_repeat('a', 20000));
} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+ echo $e->getMessage(), "\n";
}
?>
-===DONE===
--CLEAN--
<?php
@rmdir(__DIR__ . '/whatever');
@@ -139,8 +142,7 @@ string(3) "hi3"
string(3) "hi2"
bool(false)
Invalid argument, expected a filename (string) or array of filenames
-
-Warning: Phar::extractTo() expects parameter 1 to be a valid path, array given in %sphar_extract.php on line %d
+Phar::extractTo() expects parameter 1 to be a valid path, array given
Invalid argument, extraction path must be non-zero length
Unable to use path "%soops" for extraction, it is a file, must be a directory
Invalid argument, array of filenames to extract contains non-string value
@@ -149,4 +151,3 @@ string(5) "first"
string(2) "hi"
Cannot extract to "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...", destination directory is too long for filesystem
Extraction from phar "%stempmanifest1.phar.php" failed: Cannot extract "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa..." to "%s...", extracted filename is too long for filesystem
-===DONE===
diff --git a/ext/phar/tests/phar_extract2.phpt b/ext/phar/tests/phar_extract2.phpt
index dd41f38660..8692358827 100644
--- a/ext/phar/tests/phar_extract2.phpt
+++ b/ext/phar/tests/phar_extract2.phpt
@@ -24,17 +24,16 @@ $phar->extractTo(__DIR__ . '/extract2');
$out = array();
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator(__DIR__ . '/extract2', 0x00003000), RecursiveIteratorIterator::CHILD_FIRST) as $path => $file) {
- $extracted[] = $path;
+ $extracted[] = $path;
}
sort($extracted);
foreach ($extracted as $out) {
- echo "$out\n";
+ echo "$out\n";
}
?>
-===DONE===
--CLEAN--
<?php
@unlink(__DIR__ . '/tempmanifest2.phar.php');
@@ -57,4 +56,3 @@ $dir = __DIR__ . '/extract1/';
%sextract2%csubdir
%sextract2%csubdir%cectory
%sextract2%csubdir%cectory%cfile.txt
-===DONE===
diff --git a/ext/phar/tests/phar_extract3.phpt b/ext/phar/tests/phar_extract3.phpt
index ffd31a4201..6a7e6e0815 100644
--- a/ext/phar/tests/phar_extract3.phpt
+++ b/ext/phar/tests/phar_extract3.phpt
@@ -14,24 +14,23 @@ $extract = __DIR__ . '/test-extract3';
$phar = new PharData($fname);
try {
- $phar->extractTo($extract);
+ $phar->extractTo($extract);
} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+ echo $e->getMessage(), "\n";
}
$phar = new PharData($fname2);
foreach ($phar as $filename) {
- echo "$filename\n";
+ echo "$filename\n";
}
try {
- $phar->extractTo($extract);
+ $phar->extractTo($extract);
} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+ echo $e->getMessage(), "\n";
}
?>
-===DONE===
--CLEAN--
<?php
$dir = __DIR__ . '/test-extract3/';
@@ -43,4 +42,3 @@ $dir = __DIR__ . '/test-extract3/';
Invalid argument, %sfiles/bogus.zip cannot be found
phar://%sfiles/notbogus.zip%cnonsense.txt
phar://%sfiles/notbogus.zip%cstuff.txt
-===DONE===
diff --git a/ext/phar/tests/phar_get_supported_signatures_002.phpt b/ext/phar/tests/phar_get_supported_signatures_002.phpt
index d55785264d..86740d5411 100644
--- a/ext/phar/tests/phar_get_supported_signatures_002.phpt
+++ b/ext/phar/tests/phar_get_supported_signatures_002.phpt
@@ -13,8 +13,6 @@ phar.readonly=0
<?php
var_dump(Phar::getSupportedSignatures());
?>
-===DONE===
-?>
--EXPECT--
array(4) {
[0]=>
@@ -26,4 +24,3 @@ array(4) {
[3]=>
string(7) "SHA-512"
}
-===DONE===
diff --git a/ext/phar/tests/phar_get_supported_signatures_002a.phpt b/ext/phar/tests/phar_get_supported_signatures_002a.phpt
index 391ee600cc..c8e4989dd1 100644
--- a/ext/phar/tests/phar_get_supported_signatures_002a.phpt
+++ b/ext/phar/tests/phar_get_supported_signatures_002a.phpt
@@ -13,7 +13,6 @@ phar.readonly=0
<?php
var_dump(Phar::getSupportedSignatures());
?>
-===DONE===
--EXPECT--
array(5) {
[0]=>
@@ -27,4 +26,3 @@ array(5) {
[4]=>
string(7) "OpenSSL"
}
-===DONE===
diff --git a/ext/phar/tests/phar_get_supportedcomp1.phpt b/ext/phar/tests/phar_get_supportedcomp1.phpt
index fecb806f2e..2dcbd72df2 100644
--- a/ext/phar/tests/phar_get_supportedcomp1.phpt
+++ b/ext/phar/tests/phar_get_supportedcomp1.phpt
@@ -10,7 +10,6 @@ phar.require_hash=0
<?php
var_dump(Phar::getSupportedCompression());
?>
-===DONE===
--EXPECT--
array(2) {
[0]=>
@@ -18,4 +17,3 @@ array(2) {
[1]=>
string(5) "BZIP2"
}
-===DONE===
diff --git a/ext/phar/tests/phar_get_supportedcomp2.phpt b/ext/phar/tests/phar_get_supportedcomp2.phpt
index aa941d0e4b..c08a55ed52 100644
--- a/ext/phar/tests/phar_get_supportedcomp2.phpt
+++ b/ext/phar/tests/phar_get_supportedcomp2.phpt
@@ -10,10 +10,8 @@ phar.require_hash=0
<?php
var_dump(Phar::getSupportedCompression());
?>
-===DONE===
--EXPECT--
array(1) {
[0]=>
string(5) "BZIP2"
}
-===DONE===
diff --git a/ext/phar/tests/phar_get_supportedcomp3.phpt b/ext/phar/tests/phar_get_supportedcomp3.phpt
index fadb482042..4fbc442215 100644
--- a/ext/phar/tests/phar_get_supportedcomp3.phpt
+++ b/ext/phar/tests/phar_get_supportedcomp3.phpt
@@ -10,10 +10,8 @@ phar.require_hash=0
<?php
var_dump(Phar::getSupportedCompression());
?>
-===DONE===
--EXPECT--
array(1) {
[0]=>
string(2) "GZ"
}
-===DONE===
diff --git a/ext/phar/tests/phar_get_supportedcomp4.phpt b/ext/phar/tests/phar_get_supportedcomp4.phpt
index 1d953e2e38..91137989ba 100644
--- a/ext/phar/tests/phar_get_supportedcomp4.phpt
+++ b/ext/phar/tests/phar_get_supportedcomp4.phpt
@@ -8,8 +8,6 @@ Phar::getSupportedCompression() (none)
<?php
var_dump(Phar::getSupportedCompression());
?>
-===DONE===
--EXPECT--
array(0) {
}
-===DONE===
diff --git a/ext/phar/tests/phar_gobyebye-win32.phpt b/ext/phar/tests/phar_gobyebye-win32.phpt
index ff7b685aac..f4120902b3 100644
--- a/ext/phar/tests/phar_gobyebye-win32.phpt
+++ b/ext/phar/tests/phar_gobyebye-win32.phpt
@@ -24,16 +24,15 @@ opendir("foo/hi");
');
include $pname . '/foo/hi';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.2.php'); ?>
--EXPECTF--
-Warning: readfile(foo/hi): failed to open stream: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
+Warning: readfile(foo/hi): Failed to open stream: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
-Warning: fopen(foo/hi): failed to open stream: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
+Warning: fopen(foo/hi): Failed to open stream: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
-Warning: file_get_contents(foo/hi): failed to open stream: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
+Warning: file_get_contents(foo/hi): Failed to open stream: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
Warning: stat(): stat failed for foo/hi in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
bool(false)
@@ -44,5 +43,4 @@ bool(false)
Warning: opendir(foo/hi,foo/hi): %s (code: 3) in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
-Warning: opendir(foo/hi): failed to open dir: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
-===DONE===
+Warning: opendir(foo/hi): Failed to open directory: No such file or directory in phar://%sphar_gobyebye-win32.phar.php/foo/hi on line %d
diff --git a/ext/phar/tests/phar_gobyebye.phpt b/ext/phar/tests/phar_gobyebye.phpt
index 753562571d..0abe70ee52 100644
--- a/ext/phar/tests/phar_gobyebye.phpt
+++ b/ext/phar/tests/phar_gobyebye.phpt
@@ -25,16 +25,15 @@ opendir("foo/hi");
');
include $pname . '/foo/hi';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.2.php'); ?>
--EXPECTF--
-Warning: readfile(foo/hi): failed to open stream: No such file or directory in phar://%sphar_gobyebye.phar.php/foo/hi on line %d
+Warning: readfile(foo/hi): Failed to open stream: No such file or directory in phar://%sphar_gobyebye.phar.php/foo/hi on line %d
-Warning: fopen(foo/hi): failed to open stream: No such file or directory in phar://%sphar_gobyebye.phar.php/foo/hi on line %d
+Warning: fopen(foo/hi): Failed to open stream: No such file or directory in phar://%sphar_gobyebye.phar.php/foo/hi on line %d
-Warning: file_get_contents(foo/hi): failed to open stream: No such file or directory in phar://%sphar_gobyebye.phar.php/foo/hi on line %d
+Warning: file_get_contents(foo/hi): Failed to open stream: No such file or directory in phar://%sphar_gobyebye.phar.php/foo/hi on line %d
Warning: stat(): stat failed for foo/hi in phar://%sphar_gobyebye.phar.php/foo/hi on line %d
bool(false)
@@ -43,5 +42,4 @@ bool(false)
bool(false)
bool(false)
-Warning: opendir(foo/hi): failed to open dir: No such file or directory in phar://%sphar_gobyebye.phar.php/foo/hi on line %d
-===DONE===
+Warning: opendir(foo/hi): Failed to open directory: No such file or directory in phar://%sphar_gobyebye.phar.php/foo/hi on line %d
diff --git a/ext/phar/tests/phar_gzip.phpt b/ext/phar/tests/phar_gzip.phpt
index 16821caab6..f31bf03e73 100644
--- a/ext/phar/tests/phar_gzip.phpt
+++ b/ext/phar/tests/phar_gzip.phpt
@@ -40,7 +40,6 @@ $b = new Phar($fname2);
var_dump($b->isFileFormat(Phar::PHAR));
var_dump($b->isCompressed() == Phar::GZ);
?>
-===DONE===
--CLEAN--
<?php
@unlink(__DIR__ . '/phar_gzip.phar');
@@ -51,4 +50,3 @@ string(9) "it worked"
string(%d) "phar://%sphar_gzip.phar/tar_004.php"
bool(true)
bool(true)
-===DONE===
diff --git a/ext/phar/tests/phar_isvalidpharfilename.phpt b/ext/phar/tests/phar_isvalidpharfilename.phpt
index 3a25714556..8b9088b9b3 100644
--- a/ext/phar/tests/phar_isvalidpharfilename.phpt
+++ b/ext/phar/tests/phar_isvalidpharfilename.phpt
@@ -7,8 +7,6 @@ phar.readonly=1
--FILE--
<?php
chdir(__DIR__);
-Phar::isValidPharFilename(array());
-echo "*\n";
var_dump(Phar::isValidPharFilename('*'));
var_dump(Phar::isValidPharFilename('*', true));
var_dump(Phar::isValidPharFilename('*', false));
@@ -71,13 +69,10 @@ var_dump(Phar::isValidPharFilename('dir.phar.php', true));
var_dump(Phar::isValidPharFilename('dir.phar.php', false));
?>
-===DONE===
--CLEAN--
<?php
rmdir(__DIR__ . '/.phar');
--EXPECTF--
-Warning: Phar::isValidPharFilename() expects parameter 1 to be a valid path, array given in %sphar_isvalidpharfilename.php on line %d
-*
bool(false)
bool(false)
bool(false)
@@ -136,4 +131,3 @@ dir.phar.php
bool(true)
bool(true)
bool(false)
-===DONE===
diff --git a/ext/phar/tests/phar_magic.phpt b/ext/phar/tests/phar_magic.phpt
index 42ad3d3c71..72033364f4 100644
--- a/ext/phar/tests/phar_magic.phpt
+++ b/ext/phar/tests/phar_magic.phpt
@@ -18,7 +18,6 @@ include "phar://" . __FILE__ . "/a";
__HALT_COMPILER();');
include $fname;
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
@@ -28,4 +27,3 @@ __HALT_COMPILER();
in b
<?php include "b/c.php";
in d
-===DONE===
diff --git a/ext/phar/tests/phar_metadata_read.phpt b/ext/phar/tests/phar_metadata_read.phpt
index 1c8428adba..428daf38c8 100644
--- a/ext/phar/tests/phar_metadata_read.phpt
+++ b/ext/phar/tests/phar_metadata_read.phpt
@@ -22,7 +22,7 @@ $files['d'] = array('cont' => 'd', 'meta' => array('hi'=>'there','foo'=>'bar'));
include 'files/phar_test.inc';
foreach($files as $name => $cont) {
- var_dump(file_get_contents($pname.'/'.$name));
+ var_dump(file_get_contents($pname.'/'.$name));
}
$phar = new Phar($fname);
@@ -33,20 +33,19 @@ var_dump($phar->getMetaData());
var_dump($phar->delMetaData());
var_dump($phar->getMetaData());
foreach($files as $name => $cont) {
- echo " meta $name\n";
- var_dump($phar[$name]->hasMetadata());
- var_dump($phar[$name]->getMetadata());
- var_dump($phar[$name]->delMetadata());
- var_dump($phar[$name]->getMetadata());
+ echo " meta $name\n";
+ var_dump($phar[$name]->hasMetadata());
+ var_dump($phar[$name]->getMetadata());
+ var_dump($phar[$name]->delMetadata());
+ var_dump($phar[$name]->getMetadata());
}
unset($phar);
foreach($files as $name => $cont) {
- var_dump(file_get_contents($pname.'/'.$name));
+ var_dump(file_get_contents($pname.'/'.$name));
}
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECT--
@@ -94,4 +93,3 @@ string(1) "a"
string(1) "b"
string(1) "c"
string(1) "d"
-===DONE===
diff --git a/ext/phar/tests/phar_metadata_write.phpt b/ext/phar/tests/phar_metadata_write.phpt
index a15d23d4c6..484795ecff 100644
--- a/ext/phar/tests/phar_metadata_write.phpt
+++ b/ext/phar/tests/phar_metadata_write.phpt
@@ -21,7 +21,7 @@ $files['d'] = array('cont' => 'd', 'meta' => array('hi'=>'there','foo'=>'bar'));
include 'files/phar_test.inc';
foreach($files as $name => $cont) {
- var_dump(file_get_contents($pname.'/'.$name));
+ var_dump(file_get_contents($pname.'/'.$name));
}
$phar = new Phar($fname);
@@ -35,16 +35,15 @@ $phar['c']->setMetadata(array(25, 'foo'=>'bar'));
$phar['d']->setMetadata(true);
foreach($files as $name => $cont) {
- var_dump($phar[$name]->getMetadata());
+ var_dump($phar[$name]->getMetadata());
}
unset($phar);
foreach($files as $name => $cont) {
- var_dump(file_get_contents($pname.'/'.$name));
+ var_dump(file_get_contents($pname.'/'.$name));
}
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECT--
@@ -70,4 +69,3 @@ string(1) "a"
string(1) "b"
string(1) "c"
string(1) "d"
-===DONE===
diff --git a/ext/phar/tests/phar_mount.phpt b/ext/phar/tests/phar_mount.phpt
index 73bd489a2d..bffdf76470 100644
--- a/ext/phar/tests/phar_mount.phpt
+++ b/ext/phar/tests/phar_mount.phpt
@@ -49,7 +49,6 @@ echo $e->getMessage(),"\n";
Phar::mount($pname . '/testit2', $pname . '/testit1');
echo substr($a['testit2']->getContent(),0, 50),"\n";
?>
-===DONE===
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar'); ?>
@@ -60,4 +59,3 @@ Mounting of testit to %sphar_mount.php within phar %sphar_mount.phar.tar failed
Mounting of /oops to /home/oops/../../etc/passwd: within phar %sphar_mount.phar.php failed
<?php
$fname = dirname(__FILE__) . '/' . basename(
-===DONE===
diff --git a/ext/phar/tests/phar_offset_check.phpt b/ext/phar/tests/phar_offset_check.phpt
index 493d823a68..415a886446 100644
--- a/ext/phar/tests/phar_offset_check.phpt
+++ b/ext/phar/tests/phar_offset_check.phpt
@@ -18,51 +18,50 @@ $phar['a.txt'] = "first file\n";
$phar['b.txt'] = "second file\n";
try {
- $phar->offsetGet('.phar/stub.php');
+ $phar->offsetGet('.phar/stub.php');
} catch (Exception $e) {
- echo $e->getMessage()."\n";
+ echo $e->getMessage()."\n";
}
try {
- $phar->offsetGet('.phar/alias.txt');
+ $phar->offsetGet('.phar/alias.txt');
} catch (Exception $e) {
- echo $e->getMessage()."\n";
+ echo $e->getMessage()."\n";
}
try {
- $phar->offsetSet('.phar/stub.php', '<?php __HALT_COMPILER(); ?>');
+ $phar->offsetSet('.phar/stub.php', '<?php __HALT_COMPILER(); ?>');
} catch (Exception $e) {
- echo $e->getMessage()."\n";
+ echo $e->getMessage()."\n";
}
var_dump(strlen($phar->getStub()));
try {
- $phar->offsetUnset('.phar/stub.php');
+ $phar->offsetUnset('.phar/stub.php');
} catch (Exception $e) {
- echo $e->getMessage()."\n";
+ echo $e->getMessage()."\n";
}
var_dump(strlen($phar->getStub()));
try {
- $phar->offsetSet('.phar/alias.txt', 'dolly');
+ $phar->offsetSet('.phar/alias.txt', 'dolly');
} catch (Exception $e) {
- echo $e->getMessage()."\n";
+ echo $e->getMessage()."\n";
}
var_dump($phar->getAlias());
try {
- $phar->offsetUnset('.phar/alias.txt');
+ $phar->offsetUnset('.phar/alias.txt');
} catch (Exception $e) {
- echo $e->getMessage()."\n";
+ echo $e->getMessage()."\n";
}
var_dump($phar->getAlias());
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
@@ -74,4 +73,3 @@ int(6643)
Cannot set alias ".phar/alias.txt" directly in phar "%sphar_offset_check.phar.php", use setAlias
string(5) "susan"
string(5) "susan"
-===DONE===
diff --git a/ext/phar/tests/phar_offset_get_error.phpt b/ext/phar/tests/phar_offset_get_error.phpt
index 54dec470c2..6430092846 100644
--- a/ext/phar/tests/phar_offset_get_error.phpt
+++ b/ext/phar/tests/phar_offset_get_error.phpt
@@ -18,11 +18,11 @@ $p[$iname] = "foobar\n";
try
{
- $p[$ename] = "foobar\n";
+ $p[$ename] = "foobar\n";
}
catch(Exception $e)
{
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
include($pname . $iname);
@@ -39,7 +39,6 @@ $a = $p['.phar/stub.php'];
echo $e->getMessage(),"\n";
}
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECT--
@@ -47,4 +46,3 @@ Entry /error/.. does not exist and cannot be created: phar error: invalid path "
foobar
Cannot set any files or directories in magic ".phar" directory
Entry .phar/stub.php does not exist
-===DONE===
diff --git a/ext/phar/tests/phar_oo_001.phpt b/ext/phar/tests/phar_oo_001.phpt
index 83d52eeabf..303e08c15b 100644
--- a/ext/phar/tests/phar_oo_001.phpt
+++ b/ext/phar/tests/phar_oo_001.phpt
@@ -18,30 +18,29 @@ var_dump(count($phar));
class MyPhar extends Phar
{
- function __construct()
- {
- }
+ function __construct()
+ {
+ }
}
try
{
- $phar = new MyPhar();
- var_dump($phar->getVersion());
+ $phar = new MyPhar();
+ var_dump($phar->getVersion());
}
catch (LogicException $e)
{
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
try {
- $phar = new Phar('test.phar');
- $phar->__construct('oops');
+ $phar = new Phar('test.phar');
+ $phar->__construct('oops');
} catch (LogicException $e)
{
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/files/phar_oo_001.phar.php');
@@ -52,4 +51,3 @@ string(5) "1.0.0"
int(5)
string(50) "Cannot call method on an uninitialized Phar object"
string(29) "Cannot call constructor twice"
-===DONE===
diff --git a/ext/phar/tests/phar_oo_002.phpt b/ext/phar/tests/phar_oo_002.phpt
index fdc08c3bfc..85723df9a8 100644
--- a/ext/phar/tests/phar_oo_002.phpt
+++ b/ext/phar/tests/phar_oo_002.phpt
@@ -16,19 +16,19 @@ $phar = new Phar($fname);
$phar->setInfoClass('SplFileInfo');
foreach($phar as $name => $ent)
{
- var_dump(str_replace(str_replace('\\', '/', __DIR__), '*', $name));
- var_dump($ent->getFilename());
- var_dump($ent->getSize());
- var_dump($ent->getType());
- var_dump($ent->isWritable());
- var_dump($ent->isReadable());
- var_dump($ent->isExecutable());
- var_dump($ent->isFile());
- var_dump($ent->isDir());
- var_dump($ent->isLink());
- var_dump($ent->getCTime());
- var_dump($ent->getMTime());
- var_dump($ent->getATime());
+ var_dump(str_replace(str_replace('\\', '/', __DIR__), '*', $name));
+ var_dump($ent->getFilename());
+ var_dump($ent->getSize());
+ var_dump($ent->getType());
+ var_dump($ent->isWritable());
+ var_dump($ent->isReadable());
+ var_dump($ent->isExecutable());
+ var_dump($ent->isFile());
+ var_dump($ent->isDir());
+ var_dump($ent->isLink());
+ var_dump($ent->getCTime());
+ var_dump($ent->getMTime());
+ var_dump($ent->getATime());
}
echo "==RECURSIVE==\n";
@@ -36,16 +36,15 @@ echo "==RECURSIVE==\n";
$phar = new Phar($fname);
foreach(new RecursiveIteratorIterator($phar) as $name => $ent)
{
- var_dump(str_replace(str_replace('\\', '/', __DIR__), '*', $name));
- var_dump(str_replace('\\', '/', $ent->getFilename()));
- var_dump($ent->getCompressedSize());
- var_dump($ent->isCRCChecked());
- var_dump($ent->isCRCChecked() ? $ent->getCRC32() : NULL);
- var_dump($ent->getPharFlags());
+ var_dump(str_replace(str_replace('\\', '/', __DIR__), '*', $name));
+ var_dump(str_replace('\\', '/', $ent->getFilename()));
+ var_dump($ent->getCompressedSize());
+ var_dump($ent->isCRCChecked());
+ var_dump($ent->isCRCChecked() ? $ent->getCRC32() : NULL);
+ var_dump($ent->getPharFlags());
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/files/phar_oo_002.phar.php');
@@ -135,4 +134,3 @@ int(32)
bool(false)
NULL
int(0)
-===DONE===
diff --git a/ext/phar/tests/phar_oo_003.phpt b/ext/phar/tests/phar_oo_003.phpt
index 4ff8361120..8442534152 100644
--- a/ext/phar/tests/phar_oo_003.phpt
+++ b/ext/phar/tests/phar_oo_003.phpt
@@ -13,17 +13,16 @@ $phar = new Phar($fname);
$phar->setInfoClass();
foreach($phar as $name => $ent)
{
- var_dump($ent->getFilename());
- if ($ent->isDir()) {
- var_dump('DIR');
- } else {
- var_dump($ent->openFile()->fgets());
- include $ent->getPathName();
- }
+ var_dump($ent->getFilename());
+ if ($ent->isDir()) {
+ var_dump('DIR');
+ } else {
+ var_dump($ent->openFile()->fgets());
+ include $ent->getPathName();
+ }
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/files/phar_oo_003.phar.php');
@@ -41,4 +40,3 @@ This is b.php
string(5) "e.php"
string(32) "<?php echo "This is e.php\n"; ?>"
This is e.php
-===DONE===
diff --git a/ext/phar/tests/phar_oo_004.phpt b/ext/phar/tests/phar_oo_004.phpt
index 2191e0082b..d1dc4ca78c 100644
--- a/ext/phar/tests/phar_oo_004.phpt
+++ b/ext/phar/tests/phar_oo_004.phpt
@@ -15,10 +15,10 @@ $it = new DirectoryIterator('phar://'.$fname);
foreach($it as $name => $ent)
{
- var_dump($name);
- var_dump($ent->getFilename());
- var_dump($ent->isDir());
- var_dump($ent->isDot());
+ var_dump($name);
+ var_dump($ent->getFilename());
+ var_dump($ent->isDir());
+ var_dump($ent->isDot());
}
?>
@@ -27,53 +27,52 @@ foreach($it as $name => $ent)
class MyDirectoryIterator extends DirectoryIterator
{
- function __construct($dir)
- {
- echo __METHOD__ . "\n";
- parent::__construct($dir);
- }
+ function __construct($dir)
+ {
+ echo __METHOD__ . "\n";
+ parent::__construct($dir);
+ }
- function rewind()
- {
- echo __METHOD__ . "\n";
- parent::rewind();
- }
+ function rewind()
+ {
+ echo __METHOD__ . "\n";
+ parent::rewind();
+ }
- function valid()
- {
- echo __METHOD__ . "\n";
- return parent::valid();
- }
+ function valid()
+ {
+ echo __METHOD__ . "\n";
+ return parent::valid();
+ }
- function key()
- {
- echo __METHOD__ . "\n";
- return parent::key();
- }
+ function key()
+ {
+ echo __METHOD__ . "\n";
+ return parent::key();
+ }
- function current()
- {
- echo __METHOD__ . "\n";
- return parent::current();
- }
+ function current()
+ {
+ echo __METHOD__ . "\n";
+ return parent::current();
+ }
- function next()
- {
- echo __METHOD__ . "\n";
- parent::next();
- }
+ function next()
+ {
+ echo __METHOD__ . "\n";
+ parent::next();
+ }
}
$it = new MyDirectoryIterator('phar://'.$fname);
foreach($it as $name => $ent)
{
- var_dump($name);
- var_dump($ent->getFilename());
+ var_dump($name);
+ var_dump($ent->getFilename());
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/files/phar_oo_004.phar.php');
@@ -124,4 +123,3 @@ int(3)
string(5) "e.php"
MyDirectoryIterator::next
MyDirectoryIterator::valid
-===DONE===
diff --git a/ext/phar/tests/phar_oo_005.phpt b/ext/phar/tests/phar_oo_005.phpt
index 27279ddbbc..83dd3fc16b 100644
--- a/ext/phar/tests/phar_oo_005.phpt
+++ b/ext/phar/tests/phar_oo_005.phpt
@@ -17,16 +17,15 @@ $it = new RecursiveIteratorIterator($it);
foreach($it as $name => $ent)
{
- var_dump(str_replace(array('\\', $fname), array('/', '*'), $name));
- var_dump(str_replace(array('\\', $fname), array('/', '*'), $ent->getPathname()));
- var_dump(str_replace('\\', '/', $it->getSubPath()));
- var_dump(str_replace('\\', '/', $it->getSubPathName()));
- $sub = $it->getPathInfo();
- var_dump(str_replace('\\', '/', $sub->getFilename()));
+ var_dump(str_replace(array('\\', $fname), array('/', '*'), $name));
+ var_dump(str_replace(array('\\', $fname), array('/', '*'), $ent->getPathname()));
+ var_dump(str_replace('\\', '/', $it->getSubPath()));
+ var_dump(str_replace('\\', '/', $it->getSubPathName()));
+ $sub = $it->getPathInfo();
+ var_dump(str_replace('\\', '/', $sub->getFilename()));
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/files/phar_oo_005.phar.php');
@@ -58,4 +57,3 @@ string(14) "phar://*/e.php"
string(0) ""
string(5) "e.php"
string(20) "phar_oo_005.phar.php"
-===DONE===
diff --git a/ext/phar/tests/phar_oo_006.phpt b/ext/phar/tests/phar_oo_006.phpt
index f595c2e412..4b1201cc24 100644
--- a/ext/phar/tests/phar_oo_006.phpt
+++ b/ext/phar/tests/phar_oo_006.phpt
@@ -11,21 +11,21 @@ require_once 'files/phar_oo_test.inc';
class MyFile extends SplFileObject
{
- function __construct($what)
- {
- echo __METHOD__ . "($what)\n";
- parent::__construct($what);
- }
+ function __construct($what)
+ {
+ echo __METHOD__ . "($what)\n";
+ parent::__construct($what);
+ }
}
$phar = new Phar($fname);
try
{
- $phar->setFileClass('SplFileInfo');
+ $phar->setFileClass('SplFileInfo');
}
-catch (UnexpectedValueException $e)
+catch (TypeError $e)
{
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
$phar->setInfoClass('MyFile');
@@ -34,7 +34,6 @@ echo $phar['b/c.php']->getFilename() . "\n";
echo $phar['b.php']->getFilename() . "\n";
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/files/phar_oo_006.phar.php');
@@ -48,4 +47,3 @@ MyFile::__construct(phar://%s/b/c.php)
c.php
MyFile::__construct(phar://%s/b.php)
b.php
-===DONE===
diff --git a/ext/phar/tests/phar_oo_007.phpt b/ext/phar/tests/phar_oo_007.phpt
index 7af8bfa790..14eca23c04 100644
--- a/ext/phar/tests/phar_oo_007.phpt
+++ b/ext/phar/tests/phar_oo_007.phpt
@@ -11,11 +11,11 @@ require_once 'files/phar_oo_test.inc';
class MyFile extends SplFileObject
{
- function __construct($name)
- {
- echo __METHOD__ . "(" . str_replace(str_replace('\\', '/', __DIR__), '*', $name) . ")\n";
- parent::__construct($name);
- }
+ function __construct($name)
+ {
+ echo __METHOD__ . "(" . str_replace(str_replace('\\', '/', __DIR__), '*', $name) . ")\n";
+ parent::__construct($name);
+ }
}
$phar = new Phar($fname);
@@ -55,7 +55,6 @@ var_dump($f->eof());
//unset($f); without unset we check for working refcounting
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/files/phar_oo_007.phar.php');
@@ -83,4 +82,3 @@ int(0)
bool(false)
string(32) "<?php echo "This is a.php\n"; ?>"
bool(true)
-===DONE===
diff --git a/ext/phar/tests/phar_oo_008.phpt b/ext/phar/tests/phar_oo_008.phpt
index e1107df4ef..40027fd97f 100644
--- a/ext/phar/tests/phar_oo_008.phpt
+++ b/ext/phar/tests/phar_oo_008.phpt
@@ -18,7 +18,7 @@ $f = $phar['a.csv'];
echo "===1===\n";
foreach($f as $k => $v)
{
- echo "$k=>$v\n";
+ echo "$k=>$v\n";
}
$f->setFlags(SplFileObject::DROP_NEW_LINE);
@@ -26,15 +26,15 @@ $f->setFlags(SplFileObject::DROP_NEW_LINE);
echo "===2===\n";
foreach($f as $k => $v)
{
- echo "$k=>$v\n";
+ echo "$k=>$v\n";
}
class MyCSVFile extends SplFileObject
{
- function current()
- {
- return parent::fgetcsv(',', '"');
- }
+ function current()
+ {
+ return parent::fgetcsv(',', '"');
+ }
}
$phar->setInfoClass('MyCSVFile');
@@ -43,30 +43,30 @@ $v = $phar['a.csv'];
echo "===3===\n";
while(!$v->eof())
{
- echo $v->key() . "=>" . join('|',$v->fgetcsv()) . "\n";
+ echo $v->key() . "=>" . join('|',$v->fgetcsv()) . "\n";
}
echo "===4===\n";
$v->rewind();
while(!$v->eof())
{
- $l = $v->fgetcsv();
- echo $v->key() . "=>" . join('|',$l) . "\n";
+ $l = $v->fgetcsv();
+ echo $v->key() . "=>" . join('|',$l) . "\n";
}
echo "===5===\n";
foreach($v as $k => $d)
{
- echo "$k=>" . join('|',$d) . "\n";
+ echo "$k=>" . join('|',$d) . "\n";
}
class MyCSVFile2 extends SplFileObject
{
- function getCurrentLine()
- {
- echo __METHOD__ . "\n";
- return parent::fgetcsv(',', '"');
- }
+ function getCurrentLine()
+ {
+ echo __METHOD__ . "\n";
+ return parent::fgetcsv(',', '"');
+ }
}
$phar->setInfoClass('MyCSVFile2');
@@ -75,11 +75,10 @@ $v = $phar['a.csv'];
echo "===6===\n";
foreach($v as $k => $d)
{
- echo "$k=>" . join('|',$d) . "\n";
+ echo "$k=>" . join('|',$d) . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/files/phar_oo_008.phar.php');
@@ -115,4 +114,3 @@ MyCSVFile2::getCurrentLine
3=>2|a|b
MyCSVFile2::getCurrentLine
5=>3|c|'e'
-===DONE===
diff --git a/ext/phar/tests/phar_oo_009.phpt b/ext/phar/tests/phar_oo_009.phpt
index c6898d456d..99c3684523 100644
--- a/ext/phar/tests/phar_oo_009.phpt
+++ b/ext/phar/tests/phar_oo_009.phpt
@@ -19,7 +19,7 @@ $f = $phar['a.csv'];
$f->setFlags(SplFileObject::SKIP_EMPTY | SplFileObject::DROP_NEW_LINE);
foreach($f as $k => $v)
{
- echo "$k=>$v\n";
+ echo "$k=>$v\n";
}
?>
@@ -29,11 +29,10 @@ foreach($f as $k => $v)
$f->setFlags(SplFileObject::SKIP_EMPTY | SplFileObject::DROP_NEW_LINE | SplFileObject::READ_CSV);
foreach($f as $k => $v)
{
- echo "$k=>" . join('|', $v) . "\n";
+ echo "$k=>" . join('|', $v) . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/files/phar_oo_009.phar.php');
@@ -53,4 +52,3 @@ __halt_compiler();
3=>4
4=>5|5
6=>7|777
-===DONE===
diff --git a/ext/phar/tests/phar_oo_010.phpt b/ext/phar/tests/phar_oo_010.phpt
index 243a11e92f..2bd2297310 100644
--- a/ext/phar/tests/phar_oo_010.phpt
+++ b/ext/phar/tests/phar_oo_010.phpt
@@ -32,7 +32,6 @@ var_dump(isset($phar[12]));
var_dump(isset($phar['b']));
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/files/phar_oo_010.phar.php');
@@ -51,4 +50,3 @@ bool(false)
bool(false)
bool(false)
bool(true)
-===DONE===
diff --git a/ext/phar/tests/phar_oo_011.phpt b/ext/phar/tests/phar_oo_011.phpt
index 223a214fe0..03dc452ac7 100644
--- a/ext/phar/tests/phar_oo_011.phpt
+++ b/ext/phar/tests/phar_oo_011.phpt
@@ -22,7 +22,6 @@ echo $phar['hi/f.php'];
echo "\n";
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/files/phar_oo_011.phar.php');
@@ -32,4 +31,3 @@ __halt_compiler();
bool(true)
bool(true)
hi
-===DONE===
diff --git a/ext/phar/tests/phar_oo_011b.phpt b/ext/phar/tests/phar_oo_011b.phpt
index 098742ca7f..a1d2234bba 100644
--- a/ext/phar/tests/phar_oo_011b.phpt
+++ b/ext/phar/tests/phar_oo_011b.phpt
@@ -10,24 +10,23 @@ phar.require_hash=0
try
{
- $pharconfig = 0;
+ $pharconfig = 0;
- require_once 'files/phar_oo_test.inc';
+ require_once 'files/phar_oo_test.inc';
- $phar = new Phar($fname);
+ $phar = new Phar($fname);
- $phar['f.php'] = 'hi';
- var_dump(isset($phar['f.php']));
- echo $phar['f.php'];
- echo "\n";
+ $phar['f.php'] = 'hi';
+ var_dump(isset($phar['f.php']));
+ echo $phar['f.php'];
+ echo "\n";
}
catch (BadMethodCallException $e)
{
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/files/phar_oo_011b.phar.php');
@@ -35,4 +34,3 @@ __halt_compiler();
?>
--EXPECT--
Exception: Write operations disabled by the php.ini setting phar.readonly
-===DONE===
diff --git a/ext/phar/tests/phar_oo_012.phpt b/ext/phar/tests/phar_oo_012.phpt
index 44e0eecdfa..4142b2e291 100644
--- a/ext/phar/tests/phar_oo_012.phpt
+++ b/ext/phar/tests/phar_oo_012.phpt
@@ -23,7 +23,6 @@ unset($phar['f.php']);
var_dump(isset($phar['f.php']));
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/files/phar_oo_012.phar.php');
@@ -33,4 +32,3 @@ __halt_compiler();
bool(true)
hi
bool(false)
-===DONE===
diff --git a/ext/phar/tests/phar_oo_012_confirm.phpt b/ext/phar/tests/phar_oo_012_confirm.phpt
index d69af5d0e6..8475946e1c 100644
--- a/ext/phar/tests/phar_oo_012_confirm.phpt
+++ b/ext/phar/tests/phar_oo_012_confirm.phpt
@@ -26,7 +26,6 @@ if ($md5 == $md52) echo 'File on disk has not changed';
var_dump(isset($phar['f.php']));
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/files/phar_oo_012_confirm.phar.php');
@@ -36,4 +35,3 @@ __halt_compiler();
bool(true)
hi
bool(false)
-===DONE===
diff --git a/ext/phar/tests/phar_oo_012b.phpt b/ext/phar/tests/phar_oo_012b.phpt
index bafd13c489..26cbe65e2a 100644
--- a/ext/phar/tests/phar_oo_012b.phpt
+++ b/ext/phar/tests/phar_oo_012b.phpt
@@ -10,27 +10,26 @@ phar.require_hash=0
try
{
- $pharconfig = 0;
+ $pharconfig = 0;
- require_once 'files/phar_oo_test.inc';
+ require_once 'files/phar_oo_test.inc';
- $phar = new Phar($fname);
- $phar->setInfoClass('SplFileObject');
+ $phar = new Phar($fname);
+ $phar->setInfoClass('SplFileObject');
- $phar['f.php'] = 'hi';
- var_dump(isset($phar['f.php']));
- echo $phar['f.php'];
- echo "\n";
- unset($phar['f.php']);
- var_dump(isset($phar['f.php']));
+ $phar['f.php'] = 'hi';
+ var_dump(isset($phar['f.php']));
+ echo $phar['f.php'];
+ echo "\n";
+ unset($phar['f.php']);
+ var_dump(isset($phar['f.php']));
}
catch (BadMethodCallException $e)
{
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/files/phar_oo_012b.phar.php');
@@ -38,4 +37,3 @@ __halt_compiler();
?>
--EXPECT--
Exception: Write operations disabled by the php.ini setting phar.readonly
-===DONE===
diff --git a/ext/phar/tests/phar_oo_compressallbz2.phpt b/ext/phar/tests/phar_oo_compressallbz2.phpt
index 8a1c5f21b2..6c04052f1d 100644
--- a/ext/phar/tests/phar_oo_compressallbz2.phpt
+++ b/ext/phar/tests/phar_oo_compressallbz2.phpt
@@ -41,7 +41,6 @@ var_dump($phar['c']->isCompressed(Phar::GZ));
var_dump($phar['b']->isCompressed(Phar::BZ2));
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar');
@@ -63,4 +62,3 @@ bool(true)
string(1) "c"
bool(false)
bool(true)
-===DONE===
diff --git a/ext/phar/tests/phar_oo_compressallgz.phpt b/ext/phar/tests/phar_oo_compressallgz.phpt
index a42a92770c..d22f995426 100644
--- a/ext/phar/tests/phar_oo_compressallgz.phpt
+++ b/ext/phar/tests/phar_oo_compressallgz.phpt
@@ -45,7 +45,6 @@ $phar->compressFiles(25);
echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar');
@@ -68,4 +67,3 @@ string(1) "c"
bool(true)
bool(false)
Unknown compression specified, please pass one of Phar::GZ or Phar::BZ2
-===DONE===
diff --git a/ext/phar/tests/phar_oo_compressed_001.phpt b/ext/phar/tests/phar_oo_compressed_001.phpt
index 8b6e96419f..6392b1da57 100644
--- a/ext/phar/tests/phar_oo_compressed_001.phpt
+++ b/ext/phar/tests/phar_oo_compressed_001.phpt
@@ -45,7 +45,6 @@ var_dump(file_get_contents($pname . '/d'));
var_dump($phar['d']->isCompressed());
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
@@ -65,4 +64,3 @@ string(1) "c"
bool(false)
string(5) "new d"
bool(false)
-===DONE===
diff --git a/ext/phar/tests/phar_oo_compressed_001b.phpt b/ext/phar/tests/phar_oo_compressed_001b.phpt
index bd8404638d..cfd9ba8cab 100644
--- a/ext/phar/tests/phar_oo_compressed_001b.phpt
+++ b/ext/phar/tests/phar_oo_compressed_001b.phpt
@@ -45,7 +45,6 @@ var_dump(file_get_contents($pname . '/d'));
var_dump($phar['d']->isCompressed());
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
@@ -65,4 +64,3 @@ string(1) "c"
bool(false)
string(5) "new d"
bool(false)
-===DONE===
diff --git a/ext/phar/tests/phar_oo_compressed_002.phpt b/ext/phar/tests/phar_oo_compressed_002.phpt
index 0f3f6a5d6e..accf32b64f 100644
--- a/ext/phar/tests/phar_oo_compressed_002.phpt
+++ b/ext/phar/tests/phar_oo_compressed_002.phpt
@@ -48,7 +48,6 @@ var_dump(file_get_contents($pname . '/e'));
var_dump($phar['e']->isCompressed());
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
@@ -70,4 +69,3 @@ string(5) "new d"
bool(false)
string(5) "new e"
bool(true)
-===DONE===
diff --git a/ext/phar/tests/phar_oo_compressed_002b.phpt b/ext/phar/tests/phar_oo_compressed_002b.phpt
index 8c4fbc8966..e27887bdbf 100644
--- a/ext/phar/tests/phar_oo_compressed_002b.phpt
+++ b/ext/phar/tests/phar_oo_compressed_002b.phpt
@@ -48,7 +48,6 @@ var_dump(file_get_contents($pname . '/e'));
var_dump($phar['e']->isCompressed());
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
@@ -70,4 +69,3 @@ string(5) "new d"
bool(false)
string(5) "new e"
bool(true)
-===DONE===
diff --git a/ext/phar/tests/phar_oo_getcontents.phpt b/ext/phar/tests/phar_oo_getcontents.phpt
index 35b9a4a887..a63097fafa 100644
--- a/ext/phar/tests/phar_oo_getcontents.phpt
+++ b/ext/phar/tests/phar_oo_getcontents.phpt
@@ -24,7 +24,6 @@ echo $phar['hi']->getContent(), "\n";
echo $e->getMessage(), "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
@@ -33,6 +32,5 @@ __halt_compiler();
--EXPECTF--
file contents
this works
-Phar error: Cannot retrieve contents, "a" in phar "%sphar_oo_getcontents.phar.php" is a directory
-Phar error: Cannot retrieve contents, "hi" in phar "%sphar_oo_getcontents.phar.php" is a directory
-===DONE===
+phar error: Cannot retrieve contents, "a" in phar "%sphar_oo_getcontents.phar.php" is a directory
+phar error: Cannot retrieve contents, "hi" in phar "%sphar_oo_getcontents.phar.php" is a directory
diff --git a/ext/phar/tests/phar_oo_getcontentsgz.phpt b/ext/phar/tests/phar_oo_getcontentsgz.phpt
index e15b177316..7510ac57a6 100644
--- a/ext/phar/tests/phar_oo_getcontentsgz.phpt
+++ b/ext/phar/tests/phar_oo_getcontentsgz.phpt
@@ -19,7 +19,6 @@ $phar2 = new Phar($fname2);
var_dump($phar2['a']->isCompressed());
echo $phar2['a']->getContent() . "\n";
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
@@ -30,4 +29,3 @@ __halt_compiler();
bool(true)
file contents
this works
-===DONE===
diff --git a/ext/phar/tests/phar_oo_getmodified.phpt b/ext/phar/tests/phar_oo_getmodified.phpt
index 7a11b8920c..7622894475 100644
--- a/ext/phar/tests/phar_oo_getmodified.phpt
+++ b/ext/phar/tests/phar_oo_getmodified.phpt
@@ -24,7 +24,6 @@ var_dump($phar->getModified());
$phar->compressFiles(Phar::GZ);
var_dump($phar->getModified());
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar');
@@ -33,4 +32,3 @@ unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
--EXPECT--
bool(false)
bool(true)
-===DONE===
diff --git a/ext/phar/tests/phar_oo_iswriteable.phpt b/ext/phar/tests/phar_oo_iswriteable.phpt
index b87f58f0da..8467ff2f25 100644
--- a/ext/phar/tests/phar_oo_iswriteable.phpt
+++ b/ext/phar/tests/phar_oo_iswriteable.phpt
@@ -56,7 +56,6 @@ var_dump($a->isWritable());
var_dump($b->isWritable());
chmod($fname2, 0666);
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.1.phar.php');
@@ -81,4 +80,3 @@ bool(false)
bool(true)
bool(false)
bool(false)
-===DONE===
diff --git a/ext/phar/tests/phar_oo_nosig.phpt b/ext/phar/tests/phar_oo_nosig.phpt
index acf897490b..b0f18c0441 100644
--- a/ext/phar/tests/phar_oo_nosig.phpt
+++ b/ext/phar/tests/phar_oo_nosig.phpt
@@ -12,7 +12,6 @@ require_once 'files/phar_oo_test.inc';
$phar = new Phar($fname);
var_dump($phar->getSignature());
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/files/phar_oo_test.phar.php');
@@ -20,4 +19,3 @@ __halt_compiler();
?>
--EXPECT--
bool(false)
-===DONE===
diff --git a/ext/phar/tests/phar_oo_uncompressall.phpt b/ext/phar/tests/phar_oo_uncompressall.phpt
index f669f5e8ca..c3e38a649a 100644
--- a/ext/phar/tests/phar_oo_uncompressall.phpt
+++ b/ext/phar/tests/phar_oo_uncompressall.phpt
@@ -49,7 +49,6 @@ var_dump(file_get_contents($pname . '/c'));
var_dump($phar['a']->isCompressed());
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar');
@@ -77,4 +76,3 @@ string(1) "b"
bool(false)
string(1) "c"
bool(false)
-===DONE===
diff --git a/ext/phar/tests/phar_running.phpt b/ext/phar/tests/phar_running.phpt
index 74f26f0cd6..4c7491f463 100644
--- a/ext/phar/tests/phar_running.phpt
+++ b/ext/phar/tests/phar_running.phpt
@@ -11,19 +11,15 @@ $pname = 'phar://' . $fname;
$phar = new Phar($fname);
$phar['index.php'] = '<?php
-Phar::running(array());
var_dump(Phar::running());
var_dump(Phar::running(false));
?>';
include $pname . '/index.php';
var_dump(Phar::running());
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
-Warning: Phar::running() expects parameter 1 to be bool, array given in phar://%sphar_running.phar.php/index.php on line 2
string(%d) "phar://%sphar_running.phar.php"
string(%d) "%sphar_running.phar.php"
string(0) ""
-===DONE===
diff --git a/ext/phar/tests/phar_setalias.phpt b/ext/phar/tests/phar_setalias.phpt
index 7d67d787c5..e193f5f37f 100644
--- a/ext/phar/tests/phar_setalias.phpt
+++ b/ext/phar/tests/phar_setalias.phpt
@@ -23,7 +23,6 @@ echo $phar->getAlias() . "\n";
$phar->setAlias('test');
echo $phar->getAlias() . "\n";
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
@@ -33,4 +32,3 @@ __HALT_COMPILER();
--EXPECT--
hio
test
-===DONE===
diff --git a/ext/phar/tests/phar_setalias2.phpt b/ext/phar/tests/phar_setalias2.phpt
index 4a9d9ea638..82a25f56e1 100644
--- a/ext/phar/tests/phar_setalias2.phpt
+++ b/ext/phar/tests/phar_setalias2.phpt
@@ -25,17 +25,16 @@ echo $phar->getAlias() . "\n";
$b = $phar;
$phar = new Phar(__DIR__ . '/notphar.phar');
try {
- $phar->setAlias('test');
+ $phar->setAlias('test');
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- $b = new Phar(__DIR__ . '/nope.phar', 0, 'test');
+ $b = new Phar(__DIR__ . '/nope.phar', 0, 'test');
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
@@ -48,4 +47,3 @@ hio
test
alias "test" is already used for archive "%sphar_setalias2.phar.php" and cannot be used for other archives
alias "test" is already used for archive "%sphar_setalias2.phar.php" cannot be overloaded with "%snope.phar"
-===DONE===
diff --git a/ext/phar/tests/phar_setdefaultstub.phpt b/ext/phar/tests/phar_setdefaultstub.phpt
index f834f3543e..3aa5b7243a 100644
--- a/ext/phar/tests/phar_setdefaultstub.phpt
+++ b/ext/phar/tests/phar_setdefaultstub.phpt
@@ -35,20 +35,19 @@ echo "==========================================================================
echo "============================================================================\n";
try {
- $phar->setDefaultStub(str_repeat('a', 400));
- $phar->stopBuffering();
- var_dump(strlen($phar->getStub()));
+ $phar->setDefaultStub(str_repeat('a', 400));
+ $phar->stopBuffering();
+ var_dump(strlen($phar->getStub()));
- $phar->setDefaultStub(str_repeat('a', 401));
- $phar->stopBuffering();
- var_dump(strlen($phar->getStub()));
+ $phar->setDefaultStub(str_repeat('a', 401));
+ $phar->stopBuffering();
+ var_dump(strlen($phar->getStub()));
} catch(Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar');
@@ -941,4 +940,3 @@ __HALT_COMPILER(); ?>
============================================================================
int(7034)
Illegal filename passed in for stub creation, was 401 characters long, and only 400 or less is allowed
-===DONE===
diff --git a/ext/phar/tests/phar_setsignaturealgo2.phpt b/ext/phar/tests/phar_setsignaturealgo2.phpt
index 726e756a65..a0d2e03f73 100644
--- a/ext/phar/tests/phar_setsignaturealgo2.phpt
+++ b/ext/phar/tests/phar_setsignaturealgo2.phpt
@@ -43,7 +43,6 @@ var_dump($p->getSignature());
echo $e->getMessage();
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar');
@@ -85,4 +84,3 @@ array(2) {
["hash_type"]=>
string(7) "OpenSSL"
}
-===DONE===
diff --git a/ext/phar/tests/phar_stub.phpt b/ext/phar/tests/phar_stub.phpt
index e5b2f27f1d..cfca8fcb4e 100644
--- a/ext/phar/tests/phar_stub.phpt
+++ b/ext/phar/tests/phar_stub.phpt
@@ -61,7 +61,7 @@ fclose($fp);
$fp = fopen($fname, 'rb');
echo fread($fp, strlen($file)) . "\n";
if (fread($fp, strlen('booya')) == 'booya') {
- echo 'failed - copied booya';
+ echo 'failed - copied booya';
}
fclose($fp);
$phar['testing'] = 'hi';
@@ -70,12 +70,11 @@ $phar['testing'] = 'hi';
$fp = fopen($fname, 'rb');
echo fread($fp, strlen($file)) . "\n";
if (fread($fp, strlen('booya')) == 'booya') {
- echo 'failed - copied booya';
+ echo 'failed - copied booya';
}
fclose($fp);
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
@@ -89,4 +88,3 @@ __HALT_COMPILER();
<?php echo "third stub\n"; __HALT_COMPILER(); ?>booya
<?php echo "third stub\n"; __HALT_COMPILER(); ?>
<?php echo "third stub\n"; __HALT_COMPILER(); ?>
-===DONE===
diff --git a/ext/phar/tests/phar_stub_error.phpt b/ext/phar/tests/phar_stub_error.phpt
index 065078d296..972af851ee 100644
--- a/ext/phar/tests/phar_stub_error.phpt
+++ b/ext/phar/tests/phar_stub_error.phpt
@@ -25,11 +25,11 @@ var_dump($phar->getStub() == $stub);
$newstub = '<?php echo "second stub\n"; _x_HALT_COMPILER(); ?>';
try
{
- $phar->setStub($newstub);
+ $phar->setStub($newstub);
}
catch(exception $e)
{
- echo 'Exception: ' . $e->getMessage() . "\n";
+ echo 'Exception: ' . $e->getMessage() . "\n";
}
var_dump($phar->getStub());
var_dump($phar->getStub() == $stub);
@@ -38,7 +38,6 @@ var_dump($phar->getStub());
var_dump($phar->getStub() == $stub);
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
@@ -53,4 +52,3 @@ string(48) "<?php echo "first stub\n"; __HALT_COMPILER(); ?>"
bool(true)
string(48) "<?php echo "first stub\n"; __HALT_COMPILER(); ?>"
bool(true)
-===DONE===
diff --git a/ext/phar/tests/phar_stub_write.phpt b/ext/phar/tests/phar_stub_write.phpt
index 67bea0ddfe..21853ee3bd 100644
--- a/ext/phar/tests/phar_stub_write.phpt
+++ b/ext/phar/tests/phar_stub_write.phpt
@@ -41,7 +41,6 @@ var_dump($phar->getStub() == $stub);
var_dump($phar->getStub() == $sexp);
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
@@ -61,4 +60,3 @@ bool(false)
bool(true)
bool(false)
bool(true)
-===DONE===
diff --git a/ext/phar/tests/phar_stub_write_file.phpt b/ext/phar/tests/phar_stub_write_file.phpt
index 5589033297..ce615ef0cd 100644
--- a/ext/phar/tests/phar_stub_write_file.phpt
+++ b/ext/phar/tests/phar_stub_write_file.phpt
@@ -42,7 +42,6 @@ var_dump($phar->getStub() == $stub);
var_dump($phar->getStub() == $sexp);
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
@@ -62,4 +61,3 @@ bool(false)
bool(true)
bool(false)
bool(true)
-===DONE===
diff --git a/ext/phar/tests/phar_unlinkarchive.phpt b/ext/phar/tests/phar_unlinkarchive.phpt
index 4597d5aaba..8789c37e79 100644
--- a/ext/phar/tests/phar_unlinkarchive.phpt
+++ b/ext/phar/tests/phar_unlinkarchive.phpt
@@ -28,7 +28,11 @@ Phar::unlinkArchive($pdname);
} catch (Exception $e) {
echo $e->getMessage(),"\n";
}
-Phar::unlinkArchive(array());
+try {
+ Phar::unlinkArchive(array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
$pname = 'phar://' . $fname;
$fname2 = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.zip';
@@ -76,7 +80,6 @@ $phar['another.php'] = "hi\n";
unset($phar);
include $pname . '/evil.php';
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar');
@@ -89,8 +92,7 @@ __HALT_COMPILER();
Unknown phar archive ""
Unknown phar archive "%sphar_unlinkarchive.phar"
Unknown phar archive "%sphar_unlinkarchive.phar.tar": internal corruption of phar "%sphar_unlinkarchive.phar.tar" (truncated entry)
-
-Warning: Phar::unlinkArchive() expects parameter 1 to be a valid path, array given in %sphar_unlinkarchive.php on line %d
+Phar::unlinkArchive() expects parameter 1 to be a valid path, array given
bool(false)
string(48) "<?php echo "first stub\n"; __HALT_COMPILER(); ?>"
phar archive "%sphar_unlinkarchive.phar" has open file handles or objects. fclose() all file handles, and unset() all objects prior to calling unlinkArchive()
@@ -105,4 +107,3 @@ int(0)
phar archive "%sphar_unlinkarchive.phar" cannot be unlinked from within itself
string(%d) "%sphar_unlinkarchive.phar"
hi
-===DONE===
diff --git a/ext/phar/tests/pharfileinfo_chmod.phpt b/ext/phar/tests/pharfileinfo_chmod.phpt
index 357d21e73b..822b5ac628 100644
--- a/ext/phar/tests/pharfileinfo_chmod.phpt
+++ b/ext/phar/tests/pharfileinfo_chmod.phpt
@@ -19,15 +19,10 @@ $phar['a']->chmod(066);
} catch (Exception $e) {
echo $e->getMessage(), "\n";
}
-$b->chmod(array());
lstat($pname . '/a/b'); // sets BG(CurrentLStatFile)
$b->chmod(0666);
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar'); ?>
--EXPECTF--
Phar entry "a" is a temporary directory (not an actual entry in the archive), cannot chmod
-
-Warning: PharFileInfo::chmod() expects parameter 1 to be int, array given in %spharfileinfo_chmod.php on line %d
-===DONE===
diff --git a/ext/phar/tests/pharfileinfo_compression.phpt b/ext/phar/tests/pharfileinfo_compression.phpt
index 95d212dd7f..8abd5a9b2d 100644
--- a/ext/phar/tests/pharfileinfo_compression.phpt
+++ b/ext/phar/tests/pharfileinfo_compression.phpt
@@ -17,7 +17,6 @@ $phar['a/b'] = 'hi there';
$b = $phar['a/b'];
-$b->isCompressed(array());
try {
$b->isCompressed(25);
} catch (Exception $e) {
@@ -71,12 +70,10 @@ var_dump($b->decompress());
var_dump($b->decompress());
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar'); ?>
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.tar'); ?>
--EXPECTF--
-Warning: PharFileInfo::isCompressed() expects parameter 1 to be int, array given in %spharfileinfo_compression.php on line 11
Unknown compression type specified
Unknown compression type specified
Cannot compress with Gzip compression, not possible with tar-based phar archives
@@ -91,4 +88,3 @@ Phar is readonly, cannot decompress
Phar entry is a directory, cannot set compression
bool(true)
bool(true)
-===DONE===
diff --git a/ext/phar/tests/pharfileinfo_construct.phpt b/ext/phar/tests/pharfileinfo_construct.phpt
index 4802e0fb40..4597660d80 100644
--- a/ext/phar/tests/pharfileinfo_construct.phpt
+++ b/ext/phar/tests/pharfileinfo_construct.phpt
@@ -45,7 +45,6 @@ $a = new PharFileInfo(__FILE__);
echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar'); ?>
--EXPECTF--
@@ -54,4 +53,3 @@ PharFileInfo::__construct() expects parameter 1 to be a valid path, array given
Cannot access phar file entry '%s' in archive '%s'
Cannot call constructor twice
'%s' is not a valid phar archive URL (must have at least phar://filename.phar)
-===DONE===
diff --git a/ext/phar/tests/pharfileinfo_getcrc32.phpt b/ext/phar/tests/pharfileinfo_getcrc32.phpt
index 277d96804a..a7b6dcbf7b 100644
--- a/ext/phar/tests/pharfileinfo_getcrc32.phpt
+++ b/ext/phar/tests/pharfileinfo_getcrc32.phpt
@@ -13,7 +13,7 @@ $file = "<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";
-// compressed file length does not match incompressed lentgh for an uncompressed file
+// compressed file length does not match incompressed length for an uncompressed file
$files = array();
$files['a/subdir/here'] = array('cont'=>'a','ulen'=>1,'clen'=>1);
@@ -39,11 +39,9 @@ var_dump($b->getCRC32());
echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar'); ?>
--EXPECTF--
Phar entry is a directory, does not have a CRC
Phar entry was not CRC checked
int(%s)
-===DONE===
diff --git a/ext/phar/tests/pharfileinfo_setmetadata.phpt b/ext/phar/tests/pharfileinfo_setmetadata.phpt
index a0915cb1ac..38e23f706d 100644
--- a/ext/phar/tests/pharfileinfo_setmetadata.phpt
+++ b/ext/phar/tests/pharfileinfo_setmetadata.phpt
@@ -36,10 +36,7 @@ $b->delMetadata();
} catch (Exception $e) {
echo $e->getMessage(), "\n";
}
-ini_set('phar.readonly', 0);
-$b->setMetadata(1,2,3);
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar'); ?>
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.tar'); ?>
@@ -48,6 +45,3 @@ Phar entry is a temporary directory (not an actual entry in the archive), cannot
Phar entry is a temporary directory (not an actual entry in the archive), cannot delete metadata
Write operations disabled by the php.ini setting phar.readonly
Write operations disabled by the php.ini setting phar.readonly
-
-Warning: PharFileInfo::setMetadata() expects exactly 1 parameter, 3 given in %spharfileinfo_setmetadata.php on line %d
-===DONE===
diff --git a/ext/phar/tests/phpinfo_001.phpt b/ext/phar/tests/phpinfo_001.phpt
index be726647a0..dde85f969f 100644
--- a/ext/phar/tests/phpinfo_001.phpt
+++ b/ext/phar/tests/phpinfo_001.phpt
@@ -19,7 +19,6 @@ ini_set('phar.readonly',1);
ini_set('phar.require_hash',1);
phpinfo(INFO_MODULES);
?>
-===DONE===
--EXPECTF--
%aPhar
@@ -61,4 +60,3 @@ phar.cache_list => no value => no value
phar.readonly => On => Off
phar.require_hash => On => Off
%a
-===DONE===
diff --git a/ext/phar/tests/phpinfo_002.phpt b/ext/phar/tests/phpinfo_002.phpt
index 10303e5280..0d12fe938c 100644
--- a/ext/phar/tests/phpinfo_002.phpt
+++ b/ext/phar/tests/phpinfo_002.phpt
@@ -16,7 +16,6 @@ phar.cache_list=
<?php
phpinfo(INFO_MODULES);
?>
-===DONE===
--EXPECTF--
%a
Phar
@@ -39,4 +38,3 @@ phar.cache_list => no value => no value
phar.readonly => On => On
phar.require_hash => On => On
%a
-===DONE===
diff --git a/ext/phar/tests/phpinfo_003.phpt b/ext/phar/tests/phpinfo_003.phpt
index fb27fb6fb9..0636e932ff 100644
--- a/ext/phar/tests/phpinfo_003.phpt
+++ b/ext/phar/tests/phpinfo_003.phpt
@@ -16,7 +16,6 @@ phar.cache_list=
<?php
phpinfo(INFO_MODULES);
?>
-===DONE===
--EXPECTF--
%a
Phar
@@ -39,4 +38,3 @@ phar.cache_list => no value => no value
phar.readonly => On => On
phar.require_hash => On => On
%a
-===DONE===
diff --git a/ext/phar/tests/readfile_edgecases.phpt b/ext/phar/tests/readfile_edgecases.phpt
index 0213f182c6..24969c2cf2 100644
--- a/ext/phar/tests/readfile_edgecases.phpt
+++ b/ext/phar/tests/readfile_edgecases.phpt
@@ -10,7 +10,6 @@ Phar::interceptFileFuncs();
$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
-readfile(array());
chdir(__DIR__);
file_put_contents($fname, "blah\n");
file_put_contents("readfile_edgecases.txt", "test\n");
@@ -29,13 +28,11 @@ readfile("../oops");
');
include $pname . '/foo/hi';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
<?php rmdir(__DIR__ . '/poo'); ?>
<?php unlink(__DIR__ . '/readfile_edgecases.txt'); ?>
--EXPECTF--
-Warning: readfile() expects parameter 1 to be a valid path, array given in %sreadfile_edgecases.php on line %d
blah
<?php
readfile("foo/" . basename(__FILE__));
@@ -58,5 +55,4 @@ readfile("./hi", 0, $context);
readfile("../oops");
?>
-Warning: readfile(phar://%sreadfile_edgecases.phar.php/oops): failed to open stream: phar error: path "oops" is a directory in phar://%sreadfile_edgecases.phar.php/foo/hi on line %d
-===DONE===
+Warning: readfile(phar://%sreadfile_edgecases.phar.php/oops): Failed to open stream: phar error: path "oops" is a directory in phar://%sreadfile_edgecases.phar.php/foo/hi on line %d
diff --git a/ext/phar/tests/refcount1.phpt b/ext/phar/tests/refcount1.phpt
index 8aefc54245..13d776f844 100644
--- a/ext/phar/tests/refcount1.phpt
+++ b/ext/phar/tests/refcount1.phpt
@@ -34,7 +34,6 @@ var_dump(fread($b, 20));
include $pname . '/b/c.php';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
@@ -57,4 +56,3 @@ object(PharFileInfo)#%d (2) {
}
string(5) "extra"
extra
-===DONE===
diff --git a/ext/phar/tests/rename.phpt b/ext/phar/tests/rename.phpt
index 9e3824729a..ec92777363 100644
--- a/ext/phar/tests/rename.phpt
+++ b/ext/phar/tests/rename.phpt
@@ -29,4 +29,4 @@ echo file_get_contents($pname . '/a') . "\n";
a
a
-Warning: file_get_contents(phar://%srename.phar.php/a): failed to open stream: phar error: "a" is not a file in phar "%srename.phar.php" in %srename.php on line %d
+Warning: file_get_contents(phar://%srename.phar.php/a): Failed to open stream: phar error: "a" is not a file in phar "%srename.phar.php" in %srename.php on line %d
diff --git a/ext/phar/tests/rename_dir.phpt b/ext/phar/tests/rename_dir.phpt
index 7283135632..a383b4c541 100644
--- a/ext/phar/tests/rename_dir.phpt
+++ b/ext/phar/tests/rename_dir.phpt
@@ -30,4 +30,4 @@ echo file_get_contents($pname . '/a/x') . "\n";
a
a
-Warning: file_get_contents(phar://%srename_dir.phar.php/a/x): failed to open stream: phar error: "a/x" is not a file in phar "%srename_dir.phar.php" in %srename_dir.php on line %d
+Warning: file_get_contents(phar://%srename_dir.phar.php/a/x): Failed to open stream: phar error: "a/x" is not a file in phar "%srename_dir.phar.php" in %srename_dir.php on line %d
diff --git a/ext/phar/tests/security.phpt b/ext/phar/tests/security.phpt
index 76af2a0e74..81408ae103 100644
--- a/ext/phar/tests/security.phpt
+++ b/ext/phar/tests/security.phpt
@@ -27,10 +27,8 @@ Phar::unlinkArchive($fname);
ini_set('phar.readonly', 1);
include $fname2;
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.1.php'); ?>
--EXPECT--
bool(false)
Write operations disabled by the php.ini setting phar.readonly
-===DONE===
diff --git a/ext/phar/tests/stat.phpt b/ext/phar/tests/stat.phpt
index e8649da235..7b258263ae 100644
--- a/ext/phar/tests/stat.phpt
+++ b/ext/phar/tests/stat.phpt
@@ -68,7 +68,6 @@ include "my/index.php";
__HALT_COMPILER();');
include $fname;
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
--EXPECTF--
@@ -223,4 +222,3 @@ not found 2
Warning: fileperms(): stat failed for not/found in phar://%sstat.phar.php/my/index.php on line %d
bool(false)
-===DONE===
diff --git a/ext/phar/tests/stat2_5.3.phpt b/ext/phar/tests/stat2_5.3.phpt
index 8962d61aa6..19acc3ba99 100644
--- a/ext/phar/tests/stat2_5.3.phpt
+++ b/ext/phar/tests/stat2_5.3.phpt
@@ -8,8 +8,6 @@ phar.require_hash=0
--FILE--
<?php
Phar::interceptFileFuncs();
-is_file();
-is_link();
var_dump(is_file(__FILE__));
$fname2 = __DIR__ . '/' . basename(__FILE__, '.php') . '.tar';
@@ -34,14 +32,10 @@ include "phar://" . __FILE__ . "/foo/stat.php";
__HALT_COMPILER();');
include $fname3;
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar'); ?>
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.tar'); ?>
--EXPECTF--
-Warning: is_file() expects exactly 1 parameter, 0 given in %sstat2_5.3.php on line %d
-
-Warning: is_link() expects exactly 1 parameter, 0 given in %sstat2_5.3.php on line %d
bool(true)
is_link
bool(false)
@@ -57,4 +51,3 @@ bool(false)
dir
bool(true)
bool(false)
-===DONE===
diff --git a/ext/phar/tests/tar/033.phpt b/ext/phar/tests/tar/033.phpt
index f07dd7f48a..cf45cab11d 100644
--- a/ext/phar/tests/tar/033.phpt
+++ b/ext/phar/tests/tar/033.phpt
@@ -18,23 +18,22 @@ $phar->addEmptyDir('test');
$phar->stopBuffering();
try {
- var_dump($phar['a.php']->isExecutable());
- $phar['a.php']->chmod(0777);
- var_dump($phar['a.php']->isExecutable());
- $phar['a.php']->chmod(0666);
- var_dump($phar['a.php']->isExecutable());
- echo "test dir\n";
- var_dump($phar['test']->isReadable());
- $phar['test']->chmod(0000);
- var_dump($phar['test']->isReadable());
- $phar['test']->chmod(0666);
- var_dump($phar['test']->isReadable());
+ var_dump($phar['a.php']->isExecutable());
+ $phar['a.php']->chmod(0777);
+ var_dump($phar['a.php']->isExecutable());
+ $phar['a.php']->chmod(0666);
+ var_dump($phar['a.php']->isExecutable());
+ echo "test dir\n";
+ var_dump($phar['test']->isReadable());
+ $phar['test']->chmod(0000);
+ var_dump($phar['test']->isReadable());
+ $phar['test']->chmod(0666);
+ var_dump($phar['test']->isReadable());
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar');
@@ -47,4 +46,3 @@ test dir
bool(true)
bool(false)
bool(true)
-===DONE===
diff --git a/ext/phar/tests/tar/033a.phpt b/ext/phar/tests/tar/033a.phpt
index 4bb8757314..67216c3317 100644
--- a/ext/phar/tests/tar/033a.phpt
+++ b/ext/phar/tests/tar/033a.phpt
@@ -19,22 +19,21 @@ $phar->stopBuffering();
ini_set('phar.readonly', 1);
try {
- var_dump($phar['a.php']->isExecutable());
- $phar['a.php']->chmod(0777);
- var_dump($phar['a.php']->isExecutable());
- $phar['a.php']->chmod(0666);
- var_dump($phar['a.php']->isExecutable());
- echo "test dir\n";
- var_dump($phar['test']->isReadable());
- $phar['test']->chmod(0000);
- var_dump($phar['test']->isReadable());
- $phar['test']->chmod(0666);
- var_dump($phar['test']->isReadable());
+ var_dump($phar['a.php']->isExecutable());
+ $phar['a.php']->chmod(0777);
+ var_dump($phar['a.php']->isExecutable());
+ $phar['a.php']->chmod(0666);
+ var_dump($phar['a.php']->isExecutable());
+ echo "test dir\n";
+ var_dump($phar['test']->isReadable());
+ $phar['test']->chmod(0000);
+ var_dump($phar['test']->isReadable());
+ $phar['test']->chmod(0666);
+ var_dump($phar['test']->isReadable());
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar');
@@ -42,4 +41,3 @@ unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar');
--EXPECTF--
bool(false)
Cannot modify permissions for file "a.php" in phar "%s033a.phar.tar", write operations are prohibited
-===DONE===
diff --git a/ext/phar/tests/tar/alias_acrobatics.phpt b/ext/phar/tests/tar/alias_acrobatics.phpt
index 7146d054f1..40f20347c6 100644
--- a/ext/phar/tests/tar/alias_acrobatics.phpt
+++ b/ext/phar/tests/tar/alias_acrobatics.phpt
@@ -32,7 +32,6 @@ $b = new Phar($fname, 0, 'another');
echo $e->getMessage(),"\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar');
@@ -43,4 +42,3 @@ alias "foo" is already used for archive "%salias_acrobatics.phar.tar" cannot be
2
phar error: Unable to add tar-based phar "%salias_acrobatics.2.phar.tar", alias is already in use
alias "another" is already used for archive "%salias_acrobatics.phar.tar" cannot be overloaded with "%salias_acrobatics.phar.tar"
-===DONE===
diff --git a/ext/phar/tests/tar/all.phpt b/ext/phar/tests/tar/all.phpt
index 215043e2da..66e9c1e951 100644
--- a/ext/phar/tests/tar/all.phpt
+++ b/ext/phar/tests/tar/all.phpt
@@ -39,7 +39,6 @@ var_dump($phar->getAlias());
var_dump($phar->getMetadata());
var_dump($phar['a']->getMetadata());
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.2.phar.tar.php'); ?>
--EXPECT--
@@ -54,4 +53,3 @@ string(32) "<?php ok __HALT_COMPILER(); ?>
string(4) "hime"
string(8) "hi there"
string(6) "a meta"
-===DONE===
diff --git a/ext/phar/tests/tar/badalias.phpt b/ext/phar/tests/tar/badalias.phpt
index 532aba8c3c..b3ad7accd0 100644
--- a/ext/phar/tests/tar/badalias.phpt
+++ b/ext/phar/tests/tar/badalias.phpt
@@ -15,11 +15,9 @@ echo $ee->getMessage(), "\n";
}
}
?>
-===DONE===
--EXPECTF--
phar error: invalid alias "hi/thereaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa..." in tar-based phar "%sbadalias1.phar.tar"
phar error: invalid alias "hi\there" in tar-based phar "%sbadalias2.phar.tar"
phar error: invalid alias "hi;there" in tar-based phar "%sbadalias3.phar.tar"
phar error: invalid alias "hi:there" in tar-based phar "%sbadalias4.phar.tar"
phar error: tar-based phar "%sbadalias5.phar.tar" has alias that is larger than 511 bytes, cannot process
-===DONE===
diff --git a/ext/phar/tests/tar/badchecksum.phpt b/ext/phar/tests/tar/badchecksum.phpt
index 35b5fc5836..964f602434 100644
--- a/ext/phar/tests/tar/badchecksum.phpt
+++ b/ext/phar/tests/tar/badchecksum.phpt
@@ -14,17 +14,15 @@ $a->addFile('hithere', 'contents', null, 'checksum');
$a->close();
try {
- $p = new PharData($fname);
+ $p = new PharData($fname);
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.tar');
?>
--EXPECTF--
phar error: "%sbadchecksum.tar" is a corrupted tar file (checksum mismatch of file "hithere")
-===DONE===
diff --git a/ext/phar/tests/tar/bignames.phpt b/ext/phar/tests/tar/bignames.phpt
index 3a10ac7547..f4fefcb13e 100644
--- a/ext/phar/tests/tar/bignames.phpt
+++ b/ext/phar/tests/tar/bignames.phpt
@@ -21,26 +21,25 @@ echo $p2[str_repeat('a', 100) . '/b']->getContent() . "\n";
echo $p2[str_repeat('a', 155) . '/' . str_repeat('b', 100)]->getContent() . "\n";
try {
- $p2[str_repeat('a', 400)] = 'yuck';
+ $p2[str_repeat('a', 400)] = 'yuck';
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- $p2 = new PharData($fname3);
- $p2[str_repeat('a', 101)] = 'yuck';
+ $p2 = new PharData($fname3);
+ $p2[str_repeat('a', 101)] = 'yuck';
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- $p2 = new PharData($fname4);
- $p2[str_repeat('b', 160) . '/' . str_repeat('a', 90)] = 'yuck';
+ $p2 = new PharData($fname4);
+ $p2[str_repeat('b', 160) . '/' . str_repeat('a', 90)] = 'yuck';
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.tar');
@@ -54,4 +53,3 @@ hi2
tar-based phar "%sbignames.2.tar" cannot be created, filename "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" is too long for tar file format
tar-based phar "%sbignames.3.tar" cannot be created, filename "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" is too long for tar file format
tar-based phar "%sbignames.4.tar" cannot be created, filename "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" is too long for tar file format
-===DONE===
diff --git a/ext/phar/tests/tar/bignames_overflow.phpt b/ext/phar/tests/tar/bignames_overflow.phpt
index 1d3f9071da..f3bf29a27a 100644
--- a/ext/phar/tests/tar/bignames_overflow.phpt
+++ b/ext/phar/tests/tar/bignames_overflow.phpt
@@ -20,13 +20,12 @@ $tar->close();
$p1 = new PharData($fname);
foreach ($p1 as $file) {
- echo $file->getFileName(), "\n";
+ echo $file->getFileName(), "\n";
}
echo $p1['a/' . str_repeat('a', 100)]->getContent() . "\n";
echo $p1[str_repeat('a', 155) . '/' . str_repeat('a', 100)]->getContent() . "\n";
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.tar');
@@ -37,4 +36,3 @@ a
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
hi
hi2
-===DONE===
diff --git a/ext/phar/tests/tar/bug49910.phpt b/ext/phar/tests/tar/bug49910.phpt
index e03998bc28..04ea485035 100644
--- a/ext/phar/tests/tar/bug49910.phpt
+++ b/ext/phar/tests/tar/bug49910.phpt
@@ -9,11 +9,10 @@ $fname = str_replace('\\', '/', __DIR__ . '/files/Structures_Graph-1.0.3.tgz');
$tar = new PharData($fname);
$files = array();
foreach (new RecursiveIteratorIterator($tar) as $file) {
- $files[] = str_replace($fname, '*', $file->getPathName());
+ $files[] = str_replace($fname, '*', $file->getPathName());
}
print_r($files);
?>
-===DONE===
--EXPECT--
Array
(
@@ -47,4 +46,3 @@ Array
[27] => phar://*/Structures_Graph-1.0.3/tests/testCase/BasicGraph.php
[28] => phar://*/package.xml
)
-===DONE===
diff --git a/ext/phar/tests/tar/bug64343.phpt b/ext/phar/tests/tar/bug64343.phpt
index ed4501dd6a..01fca83900 100644
--- a/ext/phar/tests/tar/bug64343.phpt
+++ b/ext/phar/tests/tar/bug64343.phpt
@@ -10,7 +10,5 @@ echo "Test\n";
$phar = new PharData(__DIR__."/files/bug64343.tar");
?>
-===DONE===
--EXPECT--
Test
-===DONE===
diff --git a/ext/phar/tests/tar/bug67761.phpt b/ext/phar/tests/tar/bug67761.phpt
index 0686881118..add6b06cfa 100644
--- a/ext/phar/tests/tar/bug67761.phpt
+++ b/ext/phar/tests/tar/bug67761.phpt
@@ -1,7 +1,7 @@
--TEST--
Bug #67761 (Phar::mapPhar fails for Phars inside a path containing ".tar")
--SKIPIF--
-<?php extension_loaded("phar") or die("SKIP need ext/phar suppport"); ?>
+<?php extension_loaded("phar") or die("SKIP need ext/phar support"); ?>
--FILE--
<?php
@@ -11,9 +11,7 @@ include __DIR__."/files/bug67761.tar/bug67761.phar";
?>
-===DONE===
--EXPECT--
Test
#!/usr/bin/env php
Test
-===DONE===
diff --git a/ext/phar/tests/tar/bug71317-duplicate-filename.phpt b/ext/phar/tests/tar/bug71317-duplicate-filename.phpt
index ee3219c1db..77fbdd50f2 100644
--- a/ext/phar/tests/tar/bug71317-duplicate-filename.phpt
+++ b/ext/phar/tests/tar/bug71317-duplicate-filename.phpt
@@ -22,17 +22,17 @@ $tar->close();
$fname = str_replace('\\', '/', $testTarFilename);
try {
- mkdir($testDirectory);
- $tar = new PharData($fname);
- $tar->extractTo($testDirectory);
+ mkdir($testDirectory);
+ $tar = new PharData($fname);
+ $tar->extractTo($testDirectory);
- $fileContent = file_get_contents($testDirectory . '/file2.txt');
- $expectedContent = 'file2a';
- if ($fileContent !== $expectedContent) {
- throw new Exception(sprintf('Contents of file2.txt ("%s") is invalid, expected "%s"', $fileContent, $expectedContent));
- }
+ $fileContent = file_get_contents($testDirectory . '/file2.txt');
+ $expectedContent = 'file2a';
+ if ($fileContent !== $expectedContent) {
+ throw new Exception(sprintf('Contents of file2.txt ("%s") is invalid, expected "%s"', $fileContent, $expectedContent));
+ }
} catch(Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
===DONE===
diff --git a/ext/phar/tests/tar/bug71504.phpt b/ext/phar/tests/tar/bug71504.phpt
index fde572beea..9352d80374 100644
--- a/ext/phar/tests/tar/bug71504.phpt
+++ b/ext/phar/tests/tar/bug71504.phpt
@@ -7,9 +7,9 @@ Bug #71504: Parsing of tar file with duplicate filenames causes memory leak
<?php
$fname = str_replace('\\', '/', __DIR__ . '/files/HTML_CSS-1.5.4.tgz');
try {
- $tar = new PharData($fname);
+ $tar = new PharData($fname);
} catch(Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
===DONE===
diff --git a/ext/phar/tests/tar/create_new_and_modify.phpt b/ext/phar/tests/tar/create_new_and_modify.phpt
index d0a954a981..355b69399e 100644
--- a/ext/phar/tests/tar/create_new_and_modify.phpt
+++ b/ext/phar/tests/tar/create_new_and_modify.phpt
@@ -42,7 +42,6 @@ include $pname . '/a.php';
include $pname . '/b.php';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar.php'); ?>
--EXPECT--
@@ -51,4 +50,3 @@ brand new!
bool(true)
modified!
another!
-===DONE===
diff --git a/ext/phar/tests/tar/create_new_phar_b.phpt b/ext/phar/tests/tar/create_new_phar_b.phpt
index 1b41db6134..6d9f3fd009 100644
--- a/ext/phar/tests/tar/create_new_phar_b.phpt
+++ b/ext/phar/tests/tar/create_new_phar_b.phpt
@@ -9,18 +9,16 @@ phar.require_hash=1
<?php
file_put_contents('phar://' . __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.tar/a.php',
- 'brand new!');
+ 'brand new!');
include 'phar://' . __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.tar/a.php';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar'); ?>
--EXPECTF--
-Warning: file_put_contents(phar://%screate_new_phar_b.phar.tar/a.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %screate_new_phar_b.php on line %d
+Warning: file_put_contents(phar://%screate_new_phar_b.phar.tar/a.php): Failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %screate_new_phar_b.php on line %d
-Warning: include(phar://%screate_new_phar_b.phar.tar/a.php): failed to open stream: %s in %screate_new_phar_b.php on line %d
+Warning: include(phar://%screate_new_phar_b.phar.tar/a.php): Failed to open stream: %s in %screate_new_phar_b.php on line %d
Warning: include(): Failed opening 'phar://%screate_new_phar_b.phar.tar/a.php' for inclusion (include_path='%s') in %screate_new_phar_b.php on line %d
-===DONE===
diff --git a/ext/phar/tests/tar/delete.phpt b/ext/phar/tests/tar/delete.phpt
index c34c720d31..f092784356 100644
--- a/ext/phar/tests/tar/delete.phpt
+++ b/ext/phar/tests/tar/delete.phpt
@@ -29,4 +29,4 @@ echo file_get_contents($alias . '/a') . "\n";
--EXPECTF--
a
-Warning: file_get_contents(phar://%sdelete.phar.tar/a): failed to open stream: phar error: "a" is not a file in phar "%sdelete.phar.tar" in %sdelete.php on line %d
+Warning: file_get_contents(phar://%sdelete.phar.tar/a): Failed to open stream: phar error: "a" is not a file in phar "%sdelete.phar.tar" in %sdelete.php on line %d
diff --git a/ext/phar/tests/tar/delete_in_phar.phpt b/ext/phar/tests/tar/delete_in_phar.phpt
index 0b4362aa91..948260b385 100644
--- a/ext/phar/tests/tar/delete_in_phar.phpt
+++ b/ext/phar/tests/tar/delete_in_phar.phpt
@@ -31,7 +31,6 @@ include $alias . '/b.php';
include $alias . '/b/c.php';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar'); ?>
--EXPECTF--
@@ -42,8 +41,7 @@ This is b/c
This is a
This is b
-Warning: include(%sdelete_in_phar.phar.tar/b/c.php): failed to open stream: phar error: "b/c.php" is not a file in phar "%sdelete_in_phar.phar.tar" in %sdelete_in_phar.php on line %d
+Warning: include(%sdelete_in_phar.phar.tar/b/c.php): Failed to open stream: phar error: "b/c.php" is not a file in phar "%sdelete_in_phar.phar.tar" in %sdelete_in_phar.php on line %d
Warning: include(): Failed opening 'phar://%sdelete_in_phar.phar.tar/b/c.php' for inclusion (include_path='%s') in %sdelete_in_phar.php on line %d
-===DONE===
diff --git a/ext/phar/tests/tar/delete_in_phar_b.phpt b/ext/phar/tests/tar/delete_in_phar_b.phpt
index 466ffcdf07..cb9b832e9f 100644
--- a/ext/phar/tests/tar/delete_in_phar_b.phpt
+++ b/ext/phar/tests/tar/delete_in_phar_b.phpt
@@ -32,7 +32,6 @@ include $alias . '/b.php';
include $alias . '/b/c.php';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar'); ?>
--EXPECTF--
@@ -46,4 +45,3 @@ This is a
This is b
This is b/c
-===DONE===
diff --git a/ext/phar/tests/tar/delete_in_phar_confirm.phpt b/ext/phar/tests/tar/delete_in_phar_confirm.phpt
index ec4eec68b1..762ed508da 100644
--- a/ext/phar/tests/tar/delete_in_phar_confirm.phpt
+++ b/ext/phar/tests/tar/delete_in_phar_confirm.phpt
@@ -34,7 +34,6 @@ include 'phar://' . __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.tar/b.ph
include 'phar://' . __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.tar/b/c.php';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar'); ?>
--EXPECTF--
@@ -45,8 +44,7 @@ This is b/c
This is a
This is b
-Warning: include(%sdelete_in_phar_confirm.phar.tar/b/c.php): failed to open stream: phar error: "b/c.php" is not a file in phar "%sdelete_in_phar_confirm.phar.tar" in %sdelete_in_phar_confirm.php on line %d
+Warning: include(%sdelete_in_phar_confirm.phar.tar/b/c.php): Failed to open stream: phar error: "b/c.php" is not a file in phar "%sdelete_in_phar_confirm.phar.tar" in %sdelete_in_phar_confirm.php on line %d
Warning: include(): Failed opening 'phar://%sdelete_in_phar_confirm.phar.tar/b/c.php' for inclusion (include_path='%s') in %sdelete_in_phar_confirm.php on line %d
-===DONE===
diff --git a/ext/phar/tests/tar/exists_as_phar.phpt b/ext/phar/tests/tar/exists_as_phar.phpt
index 66842cbd33..667287f61e 100644
--- a/ext/phar/tests/tar/exists_as_phar.phpt
+++ b/ext/phar/tests/tar/exists_as_phar.phpt
@@ -21,13 +21,12 @@ copy($fname, $tname);
$phar->setAlias('hio2');
try {
- $p = new Phar($tname);
+ $p = new Phar($tname);
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar');
@@ -35,4 +34,3 @@ unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar');
?>
--EXPECTF--
phar tar error: "%sexists_as_phar.phar.tar" already exists as a regular phar and must be deleted from disk prior to creating as a tar-based phar
-===DONE===
diff --git a/ext/phar/tests/tar/files/corrupt_tarmaker.php.inc b/ext/phar/tests/tar/files/corrupt_tarmaker.php.inc
index 4e30dca174..9663d89336 100644
--- a/ext/phar/tests/tar/files/corrupt_tarmaker.php.inc
+++ b/ext/phar/tests/tar/files/corrupt_tarmaker.php.inc
@@ -112,7 +112,7 @@ class corrupt_tarmaker
$checksum = 256; // 8 * ord(' ');
$checksum += array_reduce($checkheader, '_pear2tarchecksum');
- if ($corrupt === 'checksum') $checksum++;
+ if ($corrupt === 'checksum') $checksum++;
$checksum = pack('a8', sprintf('%6s ', decoct($checksum)));
fwrite($this->tmp, $block . $checksum . $blockend, 512);
diff --git a/ext/phar/tests/tar/files/make_invalid_tar.php.inc b/ext/phar/tests/tar/files/make_invalid_tar.php.inc
index 895977bf2f..2ccdf00201 100644
--- a/ext/phar/tests/tar/files/make_invalid_tar.php.inc
+++ b/ext/phar/tests/tar/files/make_invalid_tar.php.inc
@@ -3,7 +3,7 @@ include dirname(__FILE__) . '/tarmaker.php.inc';
class corrupter extends tarmaker {
function close()
{
- fwrite($this->tmp, (binary)'oopsie');
- fclose($this->tmp);
+ fwrite($this->tmp, (binary)'oopsie');
+ fclose($this->tmp);
}
}
diff --git a/ext/phar/tests/tar/links.phpt b/ext/phar/tests/tar/links.phpt
index 0964cd7fab..5af9811f4d 100644
--- a/ext/phar/tests/tar/links.phpt
+++ b/ext/phar/tests/tar/links.phpt
@@ -9,9 +9,9 @@ phar.require_hash=0
$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.tar';
copy(__DIR__ . '/files/links.tar', $fname);
try {
- $p = new PharData($fname);
+ $p = new PharData($fname);
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
var_dump($p['testit/link']->getContent());
var_dump($p['testit/hard']->getContent());
@@ -19,7 +19,6 @@ var_dump($p['testit/file']->getContent());
$p['testit/link'] = 'overwriting';
var_dump($p['testit/link']->getContent());
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.tar');
@@ -32,4 +31,3 @@ string(3) "hi
string(3) "hi
"
string(11) "overwriting"
-===DONE===
diff --git a/ext/phar/tests/tar/links2.phpt b/ext/phar/tests/tar/links2.phpt
index ebeb27732d..bd56fb4761 100644
--- a/ext/phar/tests/tar/links2.phpt
+++ b/ext/phar/tests/tar/links2.phpt
@@ -20,16 +20,14 @@ $a->addFile('hardlink', 'internal/file.txt', array(
$a->close();
try {
- $p = new PharData($fname);
+ $p = new PharData($fname);
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.tar');
?>
--EXPECTF--
phar error: "%slinks2.tar" is a corrupted tar file - hard link to non-existent file "internal/file.txt"
-===DONE===
diff --git a/ext/phar/tests/tar/links3.phpt b/ext/phar/tests/tar/links3.phpt
index 5c41a00ace..78243c7e12 100644
--- a/ext/phar/tests/tar/links3.phpt
+++ b/ext/phar/tests/tar/links3.phpt
@@ -7,15 +7,13 @@ phar.require_hash=0
--FILE--
<?php
try {
- $p = new PharData(__DIR__ . '/files/biglink.tar');
+ $p = new PharData(__DIR__ . '/files/biglink.tar');
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
echo $p['file.txt']->getContent();
echo $p['my/file']->getContent();
?>
-===DONE===
--EXPECT--
my file
my file
-===DONE===
diff --git a/ext/phar/tests/tar/links4.phpt b/ext/phar/tests/tar/links4.phpt
index 638c47f69c..10c3cf6b6e 100644
--- a/ext/phar/tests/tar/links4.phpt
+++ b/ext/phar/tests/tar/links4.phpt
@@ -7,15 +7,13 @@ phar.require_hash=0
--FILE--
<?php
try {
- $p = new PharData(__DIR__ . '/files/tinylink.tar');
+ $p = new PharData(__DIR__ . '/files/tinylink.tar');
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
echo $p['file.txt']->getContent();
echo $p['link.txt']->getContent();
?>
-===DONE===
--EXPECT--
hi
hi
-===DONE===
diff --git a/ext/phar/tests/tar/links5.phpt b/ext/phar/tests/tar/links5.phpt
index 0639b9b415..fdef2da64a 100644
--- a/ext/phar/tests/tar/links5.phpt
+++ b/ext/phar/tests/tar/links5.phpt
@@ -7,15 +7,13 @@ phar.require_hash=0
--FILE--
<?php
try {
- $p = new PharData(__DIR__ . '/files/subdirlink.tar');
+ $p = new PharData(__DIR__ . '/files/subdirlink.tar');
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
echo $p['hi/test.txt']->getContent();
echo $p['hi/link.txt']->getContent();
?>
-===DONE===
--EXPECT--
hi
hi
-===DONE===
diff --git a/ext/phar/tests/tar/links6.phpt b/ext/phar/tests/tar/links6.phpt
index 811272c57a..9958c64da2 100644
--- a/ext/phar/tests/tar/links6.phpt
+++ b/ext/phar/tests/tar/links6.phpt
@@ -16,7 +16,6 @@ $a = fopen('phar://' . __DIR__ . '/files/links.phar.tar/link2', 'r');
fseek($a, 3);
echo fread($a, 10);
?>
-===DONE===
--EXPECT--
hi there
@@ -26,4 +25,3 @@ hi there
there
-===DONE===
diff --git a/ext/phar/tests/tar/open_for_write_existing.phpt b/ext/phar/tests/tar/open_for_write_existing.phpt
index 67b59d4ad7..247f2559ea 100644
--- a/ext/phar/tests/tar/open_for_write_existing.phpt
+++ b/ext/phar/tests/tar/open_for_write_existing.phpt
@@ -21,7 +21,7 @@ $files['b.php'] = '<?php echo "This is b\n"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
foreach ($files as $n => $file) {
- $phar[$n] = $file;
+ $phar[$n] = $file;
}
$phar->stopBuffering();
@@ -34,9 +34,7 @@ include $alias . '/b/c.php';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar'); ?>
--EXPECT--
extra
-===DONE===
diff --git a/ext/phar/tests/tar/open_for_write_existing_b.phpt b/ext/phar/tests/tar/open_for_write_existing_b.phpt
index fda72c36e8..958fb639c4 100644
--- a/ext/phar/tests/tar/open_for_write_existing_b.phpt
+++ b/ext/phar/tests/tar/open_for_write_existing_b.phpt
@@ -23,29 +23,22 @@ $files['b.php'] = '<?php echo "This is b\n"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
foreach ($files as $n => $file) {
- $phar[$n] = $file;
+ $phar[$n] = $file;
}
$phar->stopBuffering();
ini_set('phar.readonly', 1);
-$fp = fopen($alias . '/b/c.php', 'wb');
-fwrite($fp, 'extra');
-fclose($fp);
+var_dump(fopen($alias . '/b/c.php', 'wb'));
include $alias . '/b/c.php';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar'); ?>
--EXPECTF--
-Warning: fopen(phar://%sopen_for_write_existing_b.phar.tar/b/c.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_existing_b.php on line %d
-
-Warning: fwrite() expects parameter 1 to be resource, bool given in %sopen_for_write_existing_b.php on line %d
-
-Warning: fclose() expects parameter 1 to be resource, bool given in %sopen_for_write_existing_b.php on line %d
+Warning: fopen(phar://%sopen_for_write_existing_b.phar.tar/b/c.php): Failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_existing_b.php on line %d
+bool(false)
This is b/c
-===DONE===
diff --git a/ext/phar/tests/tar/open_for_write_existing_c.phpt b/ext/phar/tests/tar/open_for_write_existing_c.phpt
index 03ebf35912..c8871f1f49 100644
--- a/ext/phar/tests/tar/open_for_write_existing_c.phpt
+++ b/ext/phar/tests/tar/open_for_write_existing_c.phpt
@@ -23,29 +23,22 @@ $files['b.php'] = '<?php echo "This is b\n"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
foreach ($files as $n => $file) {
- $phar[$n] = $file;
+ $phar[$n] = $file;
}
$phar->stopBuffering();
ini_set('phar.readonly', 1);
-$fp = fopen($alias . '/b/c.php', 'wb');
-fwrite($fp, 'extra');
-fclose($fp);
+var_dump(fopen($alias . '/b/c.php', 'wb'));
include $alias . '/b/c.php';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar'); ?>
--EXPECTF--
-Warning: fopen(phar://%sopen_for_write_existing_c.phar.tar/b/c.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_existing_c.php on line %d
-
-Warning: fwrite() expects parameter 1 to be resource, bool given in %spen_for_write_existing_c.php on line %d
-
-Warning: fclose() expects parameter 1 to be resource, bool given in %spen_for_write_existing_c.php on line %d
+Warning: fopen(phar://%sopen_for_write_existing_c.phar.tar/b/c.php): Failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_existing_c.php on line %d
+bool(false)
This is b/c
-===DONE===
diff --git a/ext/phar/tests/tar/open_for_write_newfile.phpt b/ext/phar/tests/tar/open_for_write_newfile.phpt
index f2f5d945d7..eb2d2509f3 100644
--- a/ext/phar/tests/tar/open_for_write_newfile.phpt
+++ b/ext/phar/tests/tar/open_for_write_newfile.phpt
@@ -21,7 +21,7 @@ $files['b.php'] = '<?php echo "This is b\n"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
foreach ($files as $n => $file) {
- $phar[$n] = $file;
+ $phar[$n] = $file;
}
$phar->stopBuffering();
@@ -35,10 +35,8 @@ include $alias . '/b/new.php';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar'); ?>
--EXPECT--
This is b/c
extra
-===DONE===
diff --git a/ext/phar/tests/tar/open_for_write_newfile_b.phpt b/ext/phar/tests/tar/open_for_write_newfile_b.phpt
index cc4333150a..9494b867dd 100644
--- a/ext/phar/tests/tar/open_for_write_newfile_b.phpt
+++ b/ext/phar/tests/tar/open_for_write_newfile_b.phpt
@@ -23,34 +23,27 @@ $files['b.php'] = '<?php echo "This is b\n"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
foreach ($files as $n => $file) {
- $phar[$n] = $file;
+ $phar[$n] = $file;
}
$phar->stopBuffering();
ini_set('phar.readonly', 1);
-$fp = fopen($alias . '/b/new.php', 'wb');
-fwrite($fp, 'extra');
-fclose($fp);
+var_dump(fopen($alias . '/b/new.php', 'wb'));
include $alias . '/b/c.php';
include $alias . '/b/new.php';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar'); ?>
--EXPECTF--
-Warning: fopen(phar://%sopen_for_write_newfile_b.phar.tar/b/new.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_newfile_b.php on line %d
-
-Warning: fwrite() expects parameter 1 to be resource, bool given in %sopen_for_write_newfile_b.php on line %d
-
-Warning: fclose() expects parameter 1 to be resource, bool given in %sopen_for_write_newfile_b.php on line %d
+Warning: fopen(phar://%sopen_for_write_newfile_b.phar.tar/b/new.php): Failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_newfile_b.php on line %d
+bool(false)
This is b/c
-Warning: include(phar://%sopen_for_write_newfile_b.phar.tar/b/new.php): failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_b.phar.tar" in %sopen_for_write_newfile_b.php on line %d
+Warning: include(phar://%sopen_for_write_newfile_b.phar.tar/b/new.php): Failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_b.phar.tar" in %sopen_for_write_newfile_b.php on line %d
Warning: include(): Failed opening 'phar://%sopen_for_write_newfile_b.phar.tar/b/new.php' for inclusion (include_path='%s') in %sopen_for_write_newfile_b.php on line %d
-===DONE===
diff --git a/ext/phar/tests/tar/open_for_write_newfile_c.phpt b/ext/phar/tests/tar/open_for_write_newfile_c.phpt
index 36b5a423d1..e5fc583660 100644
--- a/ext/phar/tests/tar/open_for_write_newfile_c.phpt
+++ b/ext/phar/tests/tar/open_for_write_newfile_c.phpt
@@ -23,33 +23,26 @@ $files['b.php'] = '<?php echo "This is b\n"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
foreach ($files as $n => $file) {
- $phar[$n] = $file;
+ $phar[$n] = $file;
}
$phar->stopBuffering();
ini_set('phar.readonly', 1);
-$fp = fopen($alias . '/b/new.php', 'wb');
-fwrite($fp, 'extra');
-fclose($fp);
+var_dump(fopen($alias . '/b/new.php', 'wb'));
include $alias . '/b/c.php';
include $alias . '/b/new.php';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar'); ?>
--EXPECTF--
-Warning: fopen(phar://%sopen_for_write_newfile_c.phar.tar/b/new.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_newfile_c.php on line %d
-
-Warning: fwrite() expects parameter 1 to be resource, bool given in %sopen_for_write_newfile_c.php on line %d
-
-Warning: fclose() expects parameter 1 to be resource, bool given in %sopen_for_write_newfile_c.php on line %d
+Warning: fopen(phar://%sopen_for_write_newfile_c.phar.tar/b/new.php): Failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_newfile_c.php on line %d
+bool(false)
This is b/c
-Warning: include(phar://%sopen_for_write_newfile_c.phar.tar/b/new.php): failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_c.phar.tar" in %sopen_for_write_newfile_c.php on line %d
+Warning: include(phar://%sopen_for_write_newfile_c.phar.tar/b/new.php): Failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_c.phar.tar" in %sopen_for_write_newfile_c.php on line %d
Warning: include(): Failed opening 'phar://%sopen_for_write_newfile_c.phar.tar/b/new.php' for inclusion (include_path='%s') in %sopen_for_write_newfile_c.php on line %d
-===DONE===
diff --git a/ext/phar/tests/tar/phar_begin_setstub_commit.phpt b/ext/phar/tests/tar/phar_begin_setstub_commit.phpt
index 9be6f2cf7b..59f66ed697 100644
--- a/ext/phar/tests/tar/phar_begin_setstub_commit.phpt
+++ b/ext/phar/tests/tar/phar_begin_setstub_commit.phpt
@@ -29,7 +29,6 @@ include 'phar://phar_begin_setstub_commit.phar/a.php';
include 'phar://phar_begin_setstub_commit.phar/b.php';
var_dump($p->getStub());
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/phar_begin_setstub_commit.phar.tar');
@@ -50,4 +49,3 @@ string(5) "Hello"
string(5) "World"
string(%d) "<?php var_dump("Second"); Phar::mapPhar("phar_begin_setstub_commit.phar"); __HALT_COMPILER(); ?>
"
-===DONE===
diff --git a/ext/phar/tests/tar/phar_buildfromiterator4.phpt b/ext/phar/tests/tar/phar_buildfromiterator4.phpt
index 5e82d88550..d78c3a0ed4 100644
--- a/ext/phar/tests/tar/phar_buildfromiterator4.phpt
+++ b/ext/phar/tests/tar/phar_buildfromiterator4.phpt
@@ -36,16 +36,15 @@ class myIterator implements Iterator
}
}
try {
- chdir(__DIR__);
- $phar = new Phar(__DIR__ . '/buildfromiterator.phar.tar');
- var_dump($phar->buildFromIterator(new myIterator(array('a' => basename(__FILE__, 'php') . 'phpt'))));
- var_dump($phar->isFileFormat(Phar::TAR));
+ chdir(__DIR__);
+ $phar = new Phar(__DIR__ . '/buildfromiterator.phar.tar');
+ var_dump($phar->buildFromIterator(new myIterator(array('a' => basename(__FILE__, 'php') . 'phpt'))));
+ var_dump($phar->isFileFormat(Phar::TAR));
} catch (Exception $e) {
- var_dump(get_class($e));
- echo $e->getMessage() . "\n";
+ var_dump(get_class($e));
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/buildfromiterator.phar.tar');
@@ -63,4 +62,3 @@ array(1) {
string(%d) "%sphar_buildfromiterator4.phpt"
}
bool(true)
-===DONE===
diff --git a/ext/phar/tests/tar/phar_buildfromiterator5.phpt b/ext/phar/tests/tar/phar_buildfromiterator5.phpt
index 5467165973..73d23e3218 100644
--- a/ext/phar/tests/tar/phar_buildfromiterator5.phpt
+++ b/ext/phar/tests/tar/phar_buildfromiterator5.phpt
@@ -36,15 +36,14 @@ class myIterator implements Iterator
}
}
try {
- chdir(__DIR__);
- $phar = new Phar(__DIR__ . '/buildfromiterator.phar.tar');
- var_dump($phar->buildFromIterator(new myIterator(array('a' => new stdClass))));
+ chdir(__DIR__);
+ $phar = new Phar(__DIR__ . '/buildfromiterator.phar.tar');
+ var_dump($phar->buildFromIterator(new myIterator(array('a' => new stdClass))));
} catch (Exception $e) {
- var_dump(get_class($e));
- echo $e->getMessage() . "\n";
+ var_dump(get_class($e));
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/buildfromiterator.phar.tar');
@@ -56,4 +55,3 @@ valid
current
%s(24) "UnexpectedValueException"
Iterator myIterator returned an invalid value (must return a string)
-===DONE===
diff --git a/ext/phar/tests/tar/phar_buildfromiterator6.phpt b/ext/phar/tests/tar/phar_buildfromiterator6.phpt
index 981310f15e..5c856f58fa 100644
--- a/ext/phar/tests/tar/phar_buildfromiterator6.phpt
+++ b/ext/phar/tests/tar/phar_buildfromiterator6.phpt
@@ -36,15 +36,14 @@ class myIterator implements Iterator
}
}
try {
- chdir(__DIR__);
- $phar = new Phar(__DIR__ . '/buildfromiterator.phar.tar');
- var_dump($phar->buildFromIterator(new myIterator(array(basename(__FILE__, 'php') . 'phpt'))));
+ chdir(__DIR__);
+ $phar = new Phar(__DIR__ . '/buildfromiterator.phar.tar');
+ var_dump($phar->buildFromIterator(new myIterator(array(basename(__FILE__, 'php') . 'phpt'))));
} catch (Exception $e) {
- var_dump(get_class($e));
- echo $e->getMessage() . "\n";
+ var_dump(get_class($e));
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/buildfromiterator.phar.tar');
@@ -57,4 +56,3 @@ current
key
%s(24) "UnexpectedValueException"
Iterator myIterator returned an invalid key (must return a string)
-===DONE===
diff --git a/ext/phar/tests/tar/phar_buildfromiterator7.phpt b/ext/phar/tests/tar/phar_buildfromiterator7.phpt
index 9f145cdbc8..92be5ebd7a 100644
--- a/ext/phar/tests/tar/phar_buildfromiterator7.phpt
+++ b/ext/phar/tests/tar/phar_buildfromiterator7.phpt
@@ -36,15 +36,14 @@ class myIterator implements Iterator
}
}
try {
- chdir(__DIR__);
- $phar = new Phar(__DIR__ . '/buildfromiterator.phar.tar');
- var_dump($phar->buildFromIterator(new myIterator(array('a' => basename(__FILE__, 'php') . '/oopsie/there.phpt'))));
+ chdir(__DIR__);
+ $phar = new Phar(__DIR__ . '/buildfromiterator.phar.tar');
+ var_dump($phar->buildFromIterator(new myIterator(array('a' => basename(__FILE__, 'php') . '/oopsie/there.phpt'))));
} catch (Exception $e) {
- var_dump(get_class($e));
- echo $e->getMessage() . "\n";
+ var_dump(get_class($e));
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/buildfromiterator.phar.tar');
@@ -57,4 +56,3 @@ current
key
%s(24) "UnexpectedValueException"
Iterator myIterator returned a file that could not be opened "phar_buildfromiterator7./oopsie/there.phpt"
-===DONE===
diff --git a/ext/phar/tests/tar/phar_buildfromiterator8.phpt b/ext/phar/tests/tar/phar_buildfromiterator8.phpt
index 27b480da6f..f9497a01ce 100644
--- a/ext/phar/tests/tar/phar_buildfromiterator8.phpt
+++ b/ext/phar/tests/tar/phar_buildfromiterator8.phpt
@@ -7,18 +7,17 @@ phar.readonly=0
--FILE--
<?php
try {
- chdir(__DIR__);
- $phar = new Phar(__DIR__ . '/buildfromiterator.phar.tar');
- $a = $phar->buildFromIterator(new RegexIterator(new DirectoryIterator('.'), '/^frontcontroller\d{0,2}\.phar\.phpt\\z|^\.\\z|^\.\.\\z/'), __DIR__ . DIRECTORY_SEPARATOR);
- asort($a);
- var_dump($a);
- var_dump($phar->isFileFormat(Phar::TAR));
+ chdir(__DIR__);
+ $phar = new Phar(__DIR__ . '/buildfromiterator.phar.tar');
+ $a = $phar->buildFromIterator(new RegexIterator(new DirectoryIterator('.'), '/^frontcontroller\d{0,2}\.phar\.phpt\\z|^\.\\z|^\.\.\\z/'), __DIR__ . DIRECTORY_SEPARATOR);
+ asort($a);
+ var_dump($a);
+ var_dump($phar->isFileFormat(Phar::TAR));
} catch (Exception $e) {
- var_dump(get_class($e));
- echo $e->getMessage() . "\n";
+ var_dump(get_class($e));
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/buildfromiterator.phar.tar');
@@ -70,4 +69,3 @@ array(21) {
string(%d) "%sfrontcontroller9.phar.phpt"
}
bool(true)
-===DONE===
diff --git a/ext/phar/tests/tar/phar_buildfromiterator9.phpt b/ext/phar/tests/tar/phar_buildfromiterator9.phpt
index 998d6653da..e113d211a8 100644
--- a/ext/phar/tests/tar/phar_buildfromiterator9.phpt
+++ b/ext/phar/tests/tar/phar_buildfromiterator9.phpt
@@ -36,16 +36,15 @@ class myIterator implements Iterator
}
}
try {
- chdir(__DIR__);
- $phar = new Phar(__DIR__ . '/buildfromiterator.phar.tar');
- var_dump($phar->buildFromIterator(new myIterator(array('a' => $a = fopen(basename(__FILE__, 'php') . 'phpt', 'r')))));
- fclose($a);
+ chdir(__DIR__);
+ $phar = new Phar(__DIR__ . '/buildfromiterator.phar.tar');
+ var_dump($phar->buildFromIterator(new myIterator(array('a' => $a = fopen(basename(__FILE__, 'php') . 'phpt', 'r')))));
+ fclose($a);
} catch (Exception $e) {
- var_dump(get_class($e));
- echo $e->getMessage() . "\n";
+ var_dump(get_class($e));
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/buildfromiterator.phar.tar');
@@ -62,4 +61,3 @@ array(1) {
["a"]=>
string(%d) "[stream]"
}
-===DONE===
diff --git a/ext/phar/tests/tar/phar_commitwrite.phpt b/ext/phar/tests/tar/phar_commitwrite.phpt
index 391be219cc..a99eff7f46 100644
--- a/ext/phar/tests/tar/phar_commitwrite.phpt
+++ b/ext/phar/tests/tar/phar_commitwrite.phpt
@@ -12,10 +12,9 @@ $p['file1.txt'] = 'hi';
$p->stopBuffering();
var_dump($p->getStub());
$p->setStub("<?php
-function __autoload(\$class)
-{
+spl_autoload_register(function(\$class) {
include 'phar://' . str_replace('_', '/', \$class);
-}
+});
Phar::mapPhar('phar_commitwrite.phar');
include 'phar://phar_commitwrite.phar/startup.php';
__HALT_COMPILER();
@@ -23,7 +22,6 @@ __HALT_COMPILER();
var_dump($p->getStub());
var_dump($p->isFileFormat(Phar::TAR));
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/phar_commitwrite.phar.tar');
@@ -32,13 +30,11 @@ unlink(__DIR__ . '/phar_commitwrite.phar.tar');
string(60) "<?php // tar-based phar archive stub file
__HALT_COMPILER();"
string(%d) "<?php
-function __autoload($class)
-{
+spl_autoload_register(function($class) {
include 'phar://' . str_replace('_', '/', $class);
-}
+});
Phar::mapPhar('phar_commitwrite.phar');
include 'phar://phar_commitwrite.phar/startup.php';
__HALT_COMPILER(); ?>
"
bool(true)
-===DONE===
diff --git a/ext/phar/tests/tar/phar_convert_phar.phpt b/ext/phar/tests/tar/phar_convert_phar.phpt
index e121cf6f7b..609feda8da 100644
--- a/ext/phar/tests/tar/phar_convert_phar.phpt
+++ b/ext/phar/tests/tar/phar_convert_phar.phpt
@@ -35,7 +35,6 @@ var_dump($phar->isFileFormat(Phar::PHAR));
var_dump(strlen($phar->getStub()));
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar');
@@ -55,4 +54,3 @@ bool(true)
int(6641)
bool(true)
int(6641)
-===DONE===
diff --git a/ext/phar/tests/tar/phar_convert_phar2.phpt b/ext/phar/tests/tar/phar_convert_phar2.phpt
index d8ca717296..eba04fcbb1 100644
--- a/ext/phar/tests/tar/phar_convert_phar2.phpt
+++ b/ext/phar/tests/tar/phar_convert_phar2.phpt
@@ -37,7 +37,6 @@ var_dump($phar->isCompressed() == Phar::GZ);
var_dump(strlen($phar->getStub()));
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar');
@@ -59,4 +58,3 @@ int(6641)
bool(true)
bool(true)
int(6641)
-===DONE===
diff --git a/ext/phar/tests/tar/phar_convert_phar3.phpt b/ext/phar/tests/tar/phar_convert_phar3.phpt
index 443ac26525..8f09068b0a 100644
--- a/ext/phar/tests/tar/phar_convert_phar3.phpt
+++ b/ext/phar/tests/tar/phar_convert_phar3.phpt
@@ -37,7 +37,6 @@ var_dump($phar->isCompressed() == Phar::BZ2);
var_dump(strlen($phar->getStub()));
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.bz2');
@@ -59,4 +58,3 @@ int(6641)
bool(true)
bool(true)
int(6641)
-===DONE===
diff --git a/ext/phar/tests/tar/phar_convert_phar4.phpt b/ext/phar/tests/tar/phar_convert_phar4.phpt
index 2188debbea..858cb5bc6a 100644
--- a/ext/phar/tests/tar/phar_convert_phar4.phpt
+++ b/ext/phar/tests/tar/phar_convert_phar4.phpt
@@ -42,7 +42,6 @@ var_dump(strlen($phar->getStub()));
var_dump($phar->getMetadata());
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.gz');
@@ -68,4 +67,3 @@ bool(true)
bool(true)
int(6641)
string(2) "hi"
-===DONE===
diff --git a/ext/phar/tests/tar/phar_copy.phpt b/ext/phar/tests/tar/phar_copy.phpt
index 61938bf0b5..e760abddd8 100644
--- a/ext/phar/tests/tar/phar_copy.phpt
+++ b/ext/phar/tests/tar/phar_copy.phpt
@@ -20,20 +20,20 @@ $p = new Phar($fname);
try
{
- $p['a'] = 'hi';
- $p->startBuffering();
- $p->copy('a', 'b');
- echo file_get_contents($p['b']->getPathName());
- $p->copy('b', 'c');
- $p->stopBuffering();
- echo file_get_contents($p['c']->getPathName());
- copy($fname, $fname2);
- var_dump($p->isFileFormat(Phar::TAR));
- $p->copy('a', $ename);
+ $p['a'] = 'hi';
+ $p->startBuffering();
+ $p->copy('a', 'b');
+ echo file_get_contents($p['b']->getPathName());
+ $p->copy('b', 'c');
+ $p->stopBuffering();
+ echo file_get_contents($p['c']->getPathName());
+ copy($fname, $fname2);
+ var_dump($p->isFileFormat(Phar::TAR));
+ $p->copy('a', $ename);
}
catch(Exception $e)
{
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
ini_set('phar.readonly',1);
$p2 = new Phar($fname2);
diff --git a/ext/phar/tests/tar/phar_magic.phpt b/ext/phar/tests/tar/phar_magic.phpt
index 0b1f6bcac1..aaf9c547ff 100644
--- a/ext/phar/tests/tar/phar_magic.phpt
+++ b/ext/phar/tests/tar/phar_magic.phpt
@@ -19,7 +19,6 @@ include "phar://" . __FILE__ . "/a";
__HALT_COMPILER();');
include $fname;
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar.php');
@@ -30,4 +29,3 @@ bool(true)
in b
<?php include "b/c.php";
in d
-===DONE===
diff --git a/ext/phar/tests/tar/phar_setalias.phpt b/ext/phar/tests/tar/phar_setalias.phpt
index 59da7bb984..37d0a475e5 100644
--- a/ext/phar/tests/tar/phar_setalias.phpt
+++ b/ext/phar/tests/tar/phar_setalias.phpt
@@ -22,7 +22,7 @@ $files['b'] = 'b';
$files['c'] = 'c';
foreach ($files as $n => $file) {
- $phar[$n] = $file;
+ $phar[$n] = $file;
}
$phar->stopBuffering();
@@ -37,7 +37,6 @@ $a = new Phar($fname2);
echo $a->getAlias() . "\n";
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar');
@@ -48,4 +47,3 @@ __HALT_COMPILER();
hio
test
test
-===DONE===
diff --git a/ext/phar/tests/tar/phar_setalias2.phpt b/ext/phar/tests/tar/phar_setalias2.phpt
index 8179cf2cd5..f9d708d586 100644
--- a/ext/phar/tests/tar/phar_setalias2.phpt
+++ b/ext/phar/tests/tar/phar_setalias2.phpt
@@ -21,7 +21,7 @@ $files['b'] = 'b';
$files['c'] = 'c';
foreach ($files as $n => $file) {
- $phar[$n] = $file;
+ $phar[$n] = $file;
}
$phar->stopBuffering();
@@ -33,13 +33,12 @@ $b = $phar;
$phar = new Phar(__DIR__ . '/notphar.phar');
try {
- $phar->setAlias('test');
+ $phar->setAlias('test');
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar');
@@ -50,4 +49,3 @@ __HALT_COMPILER();
hio
test
alias "test" is already used for archive "%sphar_setalias2.phar.tar" and cannot be used for other archives
-===DONE===
diff --git a/ext/phar/tests/tar/phar_setdefaultstub.phpt b/ext/phar/tests/tar/phar_setdefaultstub.phpt
index bea53cdce3..6811c4c59d 100644
--- a/ext/phar/tests/tar/phar_setdefaultstub.phpt
+++ b/ext/phar/tests/tar/phar_setdefaultstub.phpt
@@ -20,10 +20,10 @@ echo "==========================================================================
echo "============================================================================\n";
try {
- $phar->setDefaultStub();
- $phar->stopBuffering();
+ $phar->setDefaultStub();
+ $phar->stopBuffering();
} catch(Exception $e) {
- echo $e->getMessage(). "\n";
+ echo $e->getMessage(). "\n";
}
var_dump($phar->getStub());
@@ -32,10 +32,10 @@ echo "==========================================================================
echo "============================================================================\n";
try {
- $phar->setDefaultStub('my/custom/thingy.php');
- $phar->stopBuffering();
+ $phar->setDefaultStub('my/custom/thingy.php');
+ $phar->stopBuffering();
} catch(Exception $e) {
- echo $e->getMessage(). "\n";
+ echo $e->getMessage(). "\n";
}
var_dump($phar->getStub());
@@ -44,16 +44,15 @@ echo "==========================================================================
echo "============================================================================\n";
try {
- $phar->setDefaultStub('my/custom/thingy.php', 'the/web.php');
- $phar->stopBuffering();
+ $phar->setDefaultStub('my/custom/thingy.php', 'the/web.php');
+ $phar->stopBuffering();
} catch(Exception $e) {
- echo $e->getMessage(). "\n";
+ echo $e->getMessage(). "\n";
}
var_dump($phar->getStub());
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar');
@@ -68,13 +67,12 @@ __HALT_COMPILER();"
============================================================================
============================================================================
-Warning: Phar::setDefaultStub(): method accepts no arguments for a tar- or zip-based phar stub, 1 given in %sphar_setdefaultstub.php on line %d
+Warning: Phar::setDefaultStub(): Method accepts no arguments for a tar- or zip-based phar stub, 1 given in %sphar_setdefaultstub.php on line %d
string(60) "<?php // tar-based phar archive stub file
__HALT_COMPILER();"
============================================================================
============================================================================
-Warning: Phar::setDefaultStub(): method accepts no arguments for a tar- or zip-based phar stub, 2 given in %sphar_setdefaultstub.php on line %d
+Warning: Phar::setDefaultStub(): Method accepts no arguments for a tar- or zip-based phar stub, 2 given in %sphar_setdefaultstub.php on line %d
string(60) "<?php // tar-based phar archive stub file
__HALT_COMPILER();"
-===DONE===
diff --git a/ext/phar/tests/tar/phar_setsignaturealgo2.phpt b/ext/phar/tests/tar/phar_setsignaturealgo2.phpt
index 28d494e9e8..d67ca49a63 100644
--- a/ext/phar/tests/tar/phar_setsignaturealgo2.phpt
+++ b/ext/phar/tests/tar/phar_setsignaturealgo2.phpt
@@ -42,7 +42,6 @@ var_dump($p->getSignature());
echo $e->getMessage();
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar');
@@ -84,4 +83,3 @@ array(2) {
["hash_type"]=>
string(7) "OpenSSL"
}
-===DONE===
diff --git a/ext/phar/tests/tar/phar_stub.phpt b/ext/phar/tests/tar/phar_stub.phpt
index f6709280bd..1b9f6ecd60 100644
--- a/ext/phar/tests/tar/phar_stub.phpt
+++ b/ext/phar/tests/tar/phar_stub.phpt
@@ -57,7 +57,6 @@ $phar['testing'] = 'hi';
echo $phar->getStub();
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar.php');
@@ -72,4 +71,3 @@ __HALT_COMPILER();
<?php echo "third stub\n"; __HALT_COMPILER(); ?>booya
<?php echo "third stub\n"; __HALT_COMPILER(); ?>
<?php echo "third stub\n"; __HALT_COMPILER(); ?>
-===DONE===
diff --git a/ext/phar/tests/tar/phar_stub_error.phpt b/ext/phar/tests/tar/phar_stub_error.phpt
index b1dc49f927..c7f13858dd 100644
--- a/ext/phar/tests/tar/phar_stub_error.phpt
+++ b/ext/phar/tests/tar/phar_stub_error.phpt
@@ -23,9 +23,9 @@ var_dump($phar->getStub() == $stub);
$newstub = '<?php echo "second stub\n"; _x_HALT_COMPILER(); ?>';
try {
- $phar->setStub($newstub);
+ $phar->setStub($newstub);
} catch(exception $e) {
- echo 'Exception: ' . $e->getMessage() . "\n";
+ echo 'Exception: ' . $e->getMessage() . "\n";
}
var_dump($phar->getStub());
@@ -35,7 +35,6 @@ var_dump($phar->getStub());
var_dump($phar->getStub() == $stub);
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar');
@@ -52,4 +51,3 @@ bool(true)
string(50) "<?php echo "first stub\n"; __HALT_COMPILER(); ?>
"
bool(true)
-===DONE===
diff --git a/ext/phar/tests/tar/refcount1.phpt b/ext/phar/tests/tar/refcount1.phpt
index 9351b566a6..cb8b8241aa 100644
--- a/ext/phar/tests/tar/refcount1.phpt
+++ b/ext/phar/tests/tar/refcount1.phpt
@@ -23,7 +23,7 @@ $files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
$files['.phar/alias.txt'] = 'hio';
foreach ($files as $n => $file) {
- $tar->addFile($n, $file);
+ $tar->addFile($n, $file);
}
$tar->close();
@@ -46,7 +46,6 @@ include $alias . '/b/c.php';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar'); ?>
--EXPECTF--
@@ -69,4 +68,3 @@ object(PharFileInfo)#%d (2) {
}
string(5) "extra"
extra
-===DONE===
diff --git a/ext/phar/tests/tar/rename.phpt b/ext/phar/tests/tar/rename.phpt
index 8774fb2581..430d7fabb5 100644
--- a/ext/phar/tests/tar/rename.phpt
+++ b/ext/phar/tests/tar/rename.phpt
@@ -21,7 +21,7 @@ $files = array();
$files['a'] = 'a';
foreach ($files as $n => $file) {
- $tar->addFile($n, $file);
+ $tar->addFile($n, $file);
}
$tar->close();
@@ -39,4 +39,4 @@ echo file_get_contents($alias . '/a') . "\n";
a
a
-Warning: file_get_contents(phar://%srename.phar.tar/a): failed to open stream: phar error: "a" is not a file in phar "%srename.phar.tar" in %srename.php on line %d
+Warning: file_get_contents(phar://%srename.phar.tar/a): Failed to open stream: phar error: "a" is not a file in phar "%srename.phar.tar" in %srename.php on line %d
diff --git a/ext/phar/tests/tar/rename_dir.phpt b/ext/phar/tests/tar/rename_dir.phpt
index f0b8a9b00e..e4c3afc700 100644
--- a/ext/phar/tests/tar/rename_dir.phpt
+++ b/ext/phar/tests/tar/rename_dir.phpt
@@ -21,7 +21,7 @@ $files = array();
$files['a/x'] = 'a';
foreach ($files as $n => $file) {
- $tar->addFile($n, $file);
+ $tar->addFile($n, $file);
}
$tar->close();
@@ -39,4 +39,4 @@ echo file_get_contents($alias . '/a/x') . "\n";
a
a
-Warning: file_get_contents(phar://%srename_dir.phar.tar/a/x): failed to open stream: phar error: "a/x" is not a file in phar "%srename_dir.phar.tar" in %srename_dir.php on line %d
+Warning: file_get_contents(phar://%srename_dir.phar.tar/a/x): Failed to open stream: phar error: "a/x" is not a file in phar "%srename_dir.phar.tar" in %srename_dir.php on line %d
diff --git a/ext/phar/tests/tar/require_hash.phpt b/ext/phar/tests/tar/require_hash.phpt
index a8bf6eb575..537cadfb31 100644
--- a/ext/phar/tests/tar/require_hash.phpt
+++ b/ext/phar/tests/tar/require_hash.phpt
@@ -21,24 +21,23 @@ $tar->addFile('.phar/stub.php', "__HALT_COMPILER();");
$tar->close();
try {
- $phar = new Phar($fname);
- var_dump($phar->getStub());
+ $phar = new Phar($fname);
+ var_dump($phar->getStub());
} catch (Exception $e) {
- echo $e->getMessage()."\n";
+ echo $e->getMessage()."\n";
}
ini_set('phar.require_hash', 0);
try {
- $phar = new PharData($fname2);
- $phar['file'] = 'hi';
- var_dump($phar->getSignature());
- $phar->setSignatureAlgorithm(Phar::MD5);
- var_dump($phar->getSignature());
+ $phar = new PharData($fname2);
+ $phar['file'] = 'hi';
+ var_dump($phar->getSignature());
+ $phar->setSignatureAlgorithm(Phar::MD5);
+ var_dump($phar->getSignature());
} catch (Exception $e) {
- echo $e->getMessage()."\n";
+ echo $e->getMessage()."\n";
}
?>
-===DONE===
--CLEAN--
<?php
@unlink(__DIR__ . '/require_hash.phar.tar');
@@ -53,4 +52,3 @@ array(2) {
["hash_type"]=>
string(3) "MD5"
}
-===DONE===
diff --git a/ext/phar/tests/tar/rmdir.phpt b/ext/phar/tests/tar/rmdir.phpt
index 8e7b30b0f3..9c48c510c2 100644
--- a/ext/phar/tests/tar/rmdir.phpt
+++ b/ext/phar/tests/tar/rmdir.phpt
@@ -21,7 +21,7 @@ $files = array();
$files['a/x'] = 'a';
foreach ($files as $n => $file) {
- $tar->addFile($n, $file);
+ $tar->addFile($n, $file);
}
$tar->mkdir('a');
diff --git a/ext/phar/tests/tar/tar_001.phpt b/ext/phar/tests/tar/tar_001.phpt
index 5eabc301a9..ec27543494 100644
--- a/ext/phar/tests/tar/tar_001.phpt
+++ b/ext/phar/tests/tar/tar_001.phpt
@@ -13,18 +13,16 @@ $tar->close();
$tar = fopen('phar://' . __DIR__ . '/tar_001.phar.tar/tar_001.phpt', 'rb');
try {
- $phar = new Phar(__DIR__ . '/tar_001.phar.tar');
- echo "should not execute\n";
+ $phar = new Phar(__DIR__ . '/tar_001.phar.tar');
+ echo "should not execute\n";
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
@unlink(__DIR__ . '/tar_001.phar.tar');
?>
--EXPECTF--
-Warning: fopen(phar://%star_001.phar.tar/tar_001.phpt): failed to open stream: phar error: "%star_001.phar.tar" is a corrupted tar file (truncated) in %star_001.php on line 9
+Warning: fopen(phar://%star_001.phar.tar/tar_001.phpt): Failed to open stream: phar error: "%star_001.phar.tar" is a corrupted tar file (truncated) in %star_001.php on line 9
phar error: "%star_001.phar.tar" is a corrupted tar file (truncated)
-===DONE===
diff --git a/ext/phar/tests/tar/tar_002.phpt b/ext/phar/tests/tar/tar_002.phpt
index 38623a4030..188b0abb45 100644
--- a/ext/phar/tests/tar/tar_002.phpt
+++ b/ext/phar/tests/tar/tar_002.phpt
@@ -16,18 +16,16 @@ $tar->close();
$tar = fopen('phar://' . __DIR__ . '/tar_002.phar.tar/tar_002.phpt', 'rb');
try {
- $phar = new Phar(__DIR__ . '/tar_002.phar.tar');
- echo "should not execute\n";
+ $phar = new Phar(__DIR__ . '/tar_002.phar.tar');
+ echo "should not execute\n";
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
@unlink(__DIR__ . '/tar_002.phar.tar');
?>
--EXPECTF--
-Warning: fopen(phar://%star_002.phar.tar/tar_002.phpt): failed to open stream: phar error: "%star_002.phar.tar" is a corrupted tar file (truncated) in %star_002.php on line 9
+Warning: fopen(phar://%star_002.phar.tar/tar_002.phpt): Failed to open stream: phar error: "%star_002.phar.tar" is a corrupted tar file (truncated) in %star_002.php on line 9
phar error: "%star_002.phar.tar" is a corrupted tar file (truncated)
-===DONE===
diff --git a/ext/phar/tests/tar/tar_003.phpt b/ext/phar/tests/tar/tar_003.phpt
index 9cec9451e1..321f3f59cf 100644
--- a/ext/phar/tests/tar/tar_003.phpt
+++ b/ext/phar/tests/tar/tar_003.phpt
@@ -32,8 +32,8 @@ echo $e->getMessage()."\n";
}
while (false !== ($v = readdir($tar))) {
- echo (is_file($alias . '/' . $v) ? "file\n" : "dir\n");
- echo $v . "\n";
+ echo (is_file($alias . '/' . $v) ? "file\n" : "dir\n");
+ echo $v . "\n";
}
closedir($tar);
@@ -41,13 +41,12 @@ closedir($tar);
echo "second round\n";
$tar = opendir($alias . '/');
while (false !== ($v = readdir($tar))) {
- echo (is_file($alias . '/' . $v) ? "file\n" : "dir\n");
- echo $v . "\n";
+ echo (is_file($alias . '/' . $v) ? "file\n" : "dir\n");
+ echo $v . "\n";
}
closedir($tar);
?>
-===DONE===
--CLEAN--
<?php
@unlink(__DIR__ . '/tar_003.phar.tar');
@@ -67,4 +66,3 @@ dir
internal
file
tar_003.phpt
-===DONE===
diff --git a/ext/phar/tests/tar/tar_004.phpt b/ext/phar/tests/tar/tar_004.phpt
index 42473d5818..54db6bede2 100644
--- a/ext/phar/tests/tar/tar_004.phpt
+++ b/ext/phar/tests/tar/tar_004.phpt
@@ -29,7 +29,6 @@ $tar->close();
include $fname;
?>
-===DONE===
--CLEAN--
<?php
@unlink(__DIR__ . '/tar_004.phar.tar');
@@ -37,4 +36,3 @@ include $fname;
--EXPECTF--
string(9) "it worked"
string(%d) "phar://%star_004.phar.tar/tar_004.php"
-===DONE===
diff --git a/ext/phar/tests/tar/tar_bz2.phpt b/ext/phar/tests/tar/tar_bz2.phpt
index 28fd25aa52..f5b9cb9a8c 100644
--- a/ext/phar/tests/tar/tar_bz2.phpt
+++ b/ext/phar/tests/tar/tar_bz2.phpt
@@ -45,7 +45,6 @@ var_dump($phar2->isFileFormat(Phar::TAR));
var_dump($phar2->isCompressed() == Phar::BZ2);
?>
-===DONE===
--CLEAN--
<?php
@unlink(__DIR__ . '/tar_bz2.phar');
@@ -58,4 +57,3 @@ string(9) "it worked"
string(%d) "phar://%star_bz2.phar/tar_004.php"
bool(true)
bool(true)
-===DONE===
diff --git a/ext/phar/tests/tar/tar_gzip.phpt b/ext/phar/tests/tar/tar_gzip.phpt
index 66ab150cb7..dd5cfabc7f 100644
--- a/ext/phar/tests/tar/tar_gzip.phpt
+++ b/ext/phar/tests/tar/tar_gzip.phpt
@@ -38,7 +38,6 @@ $b = new Phar($fname2);
var_dump($b->isFileFormat(Phar::TAR));
var_dump($b->isCompressed() == Phar::GZ);
?>
-===DONE===
--CLEAN--
<?php
@unlink(__DIR__ . '/tar_gzip.phar');
@@ -49,4 +48,3 @@ string(9) "it worked"
string(%d) "phar://%star_gzip.phar/tar_004.php"
bool(true)
bool(true)
-===DONE===
diff --git a/ext/phar/tests/tar/tar_makebz2.phpt b/ext/phar/tests/tar/tar_makebz2.phpt
index 7eccb3f7c3..61901b9a11 100644
--- a/ext/phar/tests/tar/tar_makebz2.phpt
+++ b/ext/phar/tests/tar/tar_makebz2.phpt
@@ -24,7 +24,6 @@ var_dump($phar2->isFileFormat(Phar::TAR));
var_dump($phar2->isCompressed() == Phar::BZ2);
?>
-===DONE===
--CLEAN--
<?php
@unlink(__DIR__ . '/tar_makebz2.phar.bz2');
@@ -36,4 +35,3 @@ var_dump($phar2->isCompressed() == Phar::BZ2);
bool(true)
bool(true)
bool(true)
-===DONE===
diff --git a/ext/phar/tests/tar/tar_makegz.phpt b/ext/phar/tests/tar/tar_makegz.phpt
index 244e465722..f128e2b512 100644
--- a/ext/phar/tests/tar/tar_makegz.phpt
+++ b/ext/phar/tests/tar/tar_makegz.phpt
@@ -25,7 +25,6 @@ var_dump($phar2->isFileFormat(Phar::TAR));
var_dump($phar2->isCompressed() == Phar::GZ);
?>
-===DONE===
--CLEAN--
<?php
@unlink(__DIR__ . '/tar_makegz.phar.gz');
@@ -37,4 +36,3 @@ var_dump($phar2->isCompressed() == Phar::GZ);
bool(true)
bool(true)
bool(true)
-===DONE===
diff --git a/ext/phar/tests/tar/tar_nohash.phpt b/ext/phar/tests/tar/tar_nohash.phpt
index a97f347b3c..07caf79c24 100644
--- a/ext/phar/tests/tar/tar_nohash.phpt
+++ b/ext/phar/tests/tar/tar_nohash.phpt
@@ -9,14 +9,12 @@ phar.require_hash=1
--FILE--
<?php
try {
- $phar = new PharData(__DIR__ . '/files/Net_URL-1.0.15.tgz');
- var_dump($phar->getStub());
+ $phar = new PharData(__DIR__ . '/files/Net_URL-1.0.15.tgz');
+ var_dump($phar->getStub());
} catch (Exception $e) {
- echo $e->getMessage()."\n";
+ echo $e->getMessage()."\n";
}
?>
-===DONE===
--EXPECT--
string(0) ""
-===DONE===
diff --git a/ext/phar/tests/tar/tar_nostub.phpt b/ext/phar/tests/tar/tar_nostub.phpt
index d71f834280..d9ae0cdf83 100644
--- a/ext/phar/tests/tar/tar_nostub.phpt
+++ b/ext/phar/tests/tar/tar_nostub.phpt
@@ -19,30 +19,28 @@ $tar->addFile('internal/file/here', "hi there!\n");
$tar->close();
try {
- $phar = new Phar($fname);
- var_dump($phar->getStub());
+ $phar = new Phar($fname);
+ var_dump($phar->getStub());
} catch (Exception $e) {
- echo $e->getMessage()."\n";
+ echo $e->getMessage()."\n";
}
copy($fname, $fname2);
try {
- $phar = new PharData($fname2);
- var_dump($phar->getStub());
+ $phar = new PharData($fname2);
+ var_dump($phar->getStub());
} catch (Exception $e) {
- echo $e->getMessage()."\n";
+ echo $e->getMessage()."\n";
}
?>
-===DONE===
--CLEAN--
<?php
@unlink(__DIR__ . '/tar_nostub.phar.tar');
@unlink(__DIR__ . '/tar_nostub.tar');
?>
--EXPECTF--
-RecursiveDirectoryIterator::__construct(phar://%star_nostub.phar.tar/): failed to open dir: '%star_nostub.phar.tar' is not a phar archive. Use PharData::__construct() for a standard zip or tar archive
+RecursiveDirectoryIterator::__construct(phar://%star_nostub.phar.tar/): Failed to open directory: '%star_nostub.phar.tar' is not a phar archive. Use PharData::__construct() for a standard zip or tar archive
phar url "phar://%star_nostub.phar.tar/" is unknown
string(0) ""
-===DONE===
diff --git a/ext/phar/tests/tar/tar_openssl_hash.phpt b/ext/phar/tests/tar/tar_openssl_hash.phpt
index 030ee79db4..b6ed80eeac 100644
--- a/ext/phar/tests/tar/tar_openssl_hash.phpt
+++ b/ext/phar/tests/tar/tar_openssl_hash.phpt
@@ -10,9 +10,9 @@ phar.require_hash=1
--FILE--
<?php
try {
- $phar = new PharData(__DIR__ . '/files/P1-1.0.0.tgz');
+ $phar = new PharData(__DIR__ . '/files/P1-1.0.0.tgz');
} catch (Exception $e) {
- echo $e->getMessage()."\n";
+ echo $e->getMessage()."\n";
}
?>
diff --git a/ext/phar/tests/tar/truncated.phpt b/ext/phar/tests/tar/truncated.phpt
index 66148a7d28..f57b4ed5e9 100644
--- a/ext/phar/tests/tar/truncated.phpt
+++ b/ext/phar/tests/tar/truncated.phpt
@@ -5,13 +5,12 @@ Phar: truncated tar
--FILE--
<?php
try {
- $p = new PharData(__DIR__ . '/files/trunc.tar');
+ $p = new PharData(__DIR__ . '/files/trunc.tar');
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.tar');
@@ -19,4 +18,3 @@ unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar');
?>
--EXPECTF--
phar error: "%strunc.tar" is a corrupted tar file (truncated)
-===DONE===
diff --git a/ext/phar/tests/test_alias_unset.phpt b/ext/phar/tests/test_alias_unset.phpt
index fe0ffa970f..72ab3ba7b1 100644
--- a/ext/phar/tests/test_alias_unset.phpt
+++ b/ext/phar/tests/test_alias_unset.phpt
@@ -33,7 +33,6 @@ var_dump($phar2->getAlias());
$a = file_get_contents($pname . '/file1.txt'); // this fails because $fname2 ref exists
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.2.phar.php'); ?>
@@ -41,5 +40,4 @@ $a = file_get_contents($pname . '/file1.txt'); // this fails because $fname2 ref
Cannot open archive "%stest_alias_unset.2.phar.php", alias is already in use by existing archive
string(5) "first"
-Warning: file_get_contents(phar://%sfile1.txt): failed to open stream: Cannot open archive "%stest_alias_unset.phar.php", alias is already in use by existing archive in %stest_alias_unset.php on line %d
-===DONE===
+Warning: file_get_contents(phar://%sfile1.txt): Failed to open stream: Cannot open archive "%stest_alias_unset.phar.php", alias is already in use by existing archive in %stest_alias_unset.php on line %d
diff --git a/ext/phar/tests/test_signaturealgos.phpt b/ext/phar/tests/test_signaturealgos.phpt
index 69fafdb08b..a7e1e8fa47 100644
--- a/ext/phar/tests/test_signaturealgos.phpt
+++ b/ext/phar/tests/test_signaturealgos.phpt
@@ -27,11 +27,9 @@ $a = new Phar(__DIR__ . '/files/openssl.phar');
$r = $a->getSignature();
var_dump($r['hash_type']);
?>
-===DONE===
--EXPECT--
string(5) "SHA-1"
string(7) "SHA-512"
string(7) "SHA-256"
string(3) "MD5"
string(7) "OpenSSL"
-===DONE===
diff --git a/ext/phar/tests/test_unset.phpt b/ext/phar/tests/test_unset.phpt
index a512d71469..d2952b27b5 100644
--- a/ext/phar/tests/test_unset.phpt
+++ b/ext/phar/tests/test_unset.phpt
@@ -31,7 +31,6 @@ var_dump($phar->getAlias());
var_dump(file_exists($fname));
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.2.phar.php'); ?>
@@ -39,4 +38,3 @@ var_dump(file_exists($fname));
NULL
string(%d) "%stest_unset.phar.php"
bool(false)
-===DONE===
diff --git a/ext/phar/tests/withphar.phpt b/ext/phar/tests/withphar.phpt
index 51cfbce01f..6f1c96951d 100644
--- a/ext/phar/tests/withphar.phpt
+++ b/ext/phar/tests/withphar.phpt
@@ -6,9 +6,7 @@ Phar: phar run with ext/phar with default stub
<?php
include __DIR__ . '/files/nophar.phar';
?>
-===DONE===
--EXPECT--
in b
<?php include "b/c.php";
in d
-===DONE===
diff --git a/ext/phar/tests/zf_test.phpt b/ext/phar/tests/zf_test.phpt
index b3d1e4cb9a..0d2d34d6dd 100644
--- a/ext/phar/tests/zf_test.phpt
+++ b/ext/phar/tests/zf_test.phpt
@@ -34,7 +34,6 @@ foreach(new RecursiveIteratorIterator($phar) as $path) {
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/zfapp.tgz');
@@ -47,4 +46,3 @@ phar://%szfapp.phar.tar.gz/application/default/views/scripts/error/error.phtml
phar://%szfapp.phar.tar.gz/application/default/views/scripts/index/index.phtml
phar://%szfapp.phar.tar.gz/html/.htaccess
phar://%szfapp.phar.tar.gz/html/index.php
-===DONE===
diff --git a/ext/phar/tests/zip/033.phpt b/ext/phar/tests/zip/033.phpt
index 2935531987..4554cfcecf 100644
--- a/ext/phar/tests/zip/033.phpt
+++ b/ext/phar/tests/zip/033.phpt
@@ -19,26 +19,25 @@ $phar->addEmptyDir('test');
$phar->stopBuffering();
try {
- var_dump($phar['a.php']->isExecutable());
- $phar['a.php']->chmod(0777);
- copy($fname, $fname2);
- $phar->setAlias('unused');
- $phar2 = new Phar($fname2);
- var_dump($phar2['a.php']->isExecutable());
- $phar['a.php']->chmod(0666);
- var_dump($phar['a.php']->isExecutable());
- echo "test dir\n";
- var_dump($phar['test']->isDir());
- var_dump($phar['test']->isReadable());
- $phar['test']->chmod(0000);
- var_dump($phar['test']->isReadable());
- $phar['test']->chmod(0666);
- var_dump($phar['test']->isReadable());
+ var_dump($phar['a.php']->isExecutable());
+ $phar['a.php']->chmod(0777);
+ copy($fname, $fname2);
+ $phar->setAlias('unused');
+ $phar2 = new Phar($fname2);
+ var_dump($phar2['a.php']->isExecutable());
+ $phar['a.php']->chmod(0666);
+ var_dump($phar['a.php']->isExecutable());
+ echo "test dir\n";
+ var_dump($phar['test']->isDir());
+ var_dump($phar['test']->isReadable());
+ $phar['test']->chmod(0000);
+ var_dump($phar['test']->isReadable());
+ $phar['test']->chmod(0666);
+ var_dump($phar['test']->isReadable());
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip');
@@ -53,4 +52,3 @@ bool(true)
bool(true)
bool(false)
bool(true)
-===DONE===
diff --git a/ext/phar/tests/zip/033a.phpt b/ext/phar/tests/zip/033a.phpt
index e9744b0e3c..5b94c3e224 100644
--- a/ext/phar/tests/zip/033a.phpt
+++ b/ext/phar/tests/zip/033a.phpt
@@ -19,22 +19,21 @@ $phar->stopBuffering();
ini_set('phar.readonly', 1);
try {
- var_dump($phar['a.php']->isExecutable());
- $phar['a.php']->chmod(0777);
- var_dump($phar['a.php']->isExecutable());
- $phar['a.php']->chmod(0666);
- var_dump($phar['a.php']->isExecutable());
- echo "test dir\n";
- var_dump($phar['test']->isExecutable());
- $phar['test']->chmod(0777);
- var_dump($phar['test']->isExecutable());
- $phar['test']->chmod(0666);
- var_dump($phar['test']->isExecutable());
+ var_dump($phar['a.php']->isExecutable());
+ $phar['a.php']->chmod(0777);
+ var_dump($phar['a.php']->isExecutable());
+ $phar['a.php']->chmod(0666);
+ var_dump($phar['a.php']->isExecutable());
+ echo "test dir\n";
+ var_dump($phar['test']->isExecutable());
+ $phar['test']->chmod(0777);
+ var_dump($phar['test']->isExecutable());
+ $phar['test']->chmod(0666);
+ var_dump($phar['test']->isExecutable());
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip');
@@ -42,4 +41,3 @@ unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip');
--EXPECTF--
bool(false)
Cannot modify permissions for file "a.php" in phar "%sa.phar.zip", write operations are prohibited
-===DONE===
diff --git a/ext/phar/tests/zip/alias_acrobatics.phpt b/ext/phar/tests/zip/alias_acrobatics.phpt
index 36fb9058a5..1fb132ddd7 100644
--- a/ext/phar/tests/zip/alias_acrobatics.phpt
+++ b/ext/phar/tests/zip/alias_acrobatics.phpt
@@ -32,7 +32,6 @@ $b = new Phar($fname, 0, 'another');
echo $e->getMessage(),"\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip');
@@ -43,4 +42,3 @@ alias "foo" is already used for archive "%salias_acrobatics.phar.zip" cannot be
2
phar error: Unable to add zip-based phar "%salias_acrobatics.2.phar.zip" with implicit alias, alias is already in use
alias "another" is already used for archive "%salias_acrobatics.phar.zip" cannot be overloaded with "%salias_acrobatics.phar.zip"
-===DONE===
diff --git a/ext/phar/tests/zip/all.phpt b/ext/phar/tests/zip/all.phpt
index cd410be6c7..540f60f01d 100644
--- a/ext/phar/tests/zip/all.phpt
+++ b/ext/phar/tests/zip/all.phpt
@@ -42,7 +42,6 @@ var_dump($phar->getAlias());
var_dump($phar->getMetadata());
var_dump($phar['a']->getMetadata());
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip.php'); ?>
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.2.phar.zip.php'); ?>
@@ -61,4 +60,3 @@ string(32) "<?php ok __HALT_COMPILER(); ?>
string(4) "hime"
string(8) "hi there"
string(6) "a meta"
-===DONE===
diff --git a/ext/phar/tests/zip/badalias.phpt b/ext/phar/tests/zip/badalias.phpt
index 1ca964d1d6..9e7fdf8091 100644
--- a/ext/phar/tests/zip/badalias.phpt
+++ b/ext/phar/tests/zip/badalias.phpt
@@ -15,11 +15,9 @@ echo $ee->getMessage(), "\n";
}
}
?>
-===DONE===
--EXPECTF--
phar error: invalid alias "hi/there" in zip-based phar "%sbadalias1.phar.zip"
phar error: invalid alias "hi\there" in zip-based phar "%sbadalias2.phar.zip"
phar error: invalid alias "hi\there" in zip-based phar "%sbadalias3.phar.zip"
phar error: invalid alias "hi;there" in zip-based phar "%sbadalias4.phar.zip"
phar error: invalid alias "hi:there" in zip-based phar "%sbadalias5.phar.zip"
-===DONE===
diff --git a/ext/phar/tests/zip/bug48791.phpt b/ext/phar/tests/zip/bug48791.phpt
index b888838fe4..6b1726f230 100644
--- a/ext/phar/tests/zip/bug48791.phpt
+++ b/ext/phar/tests/zip/bug48791.phpt
@@ -7,8 +7,6 @@ Phar: Bug #48791: open office documents always reported as corrupted by phar ext
<?php
echo file_get_contents('phar://' . __DIR__ . '/files/test.odt/content.xml'), "\n";
?>
-===DONE===
--EXPECT--
<?xml version="1.0" encoding="UTF-8"?>
<office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:rdfa="http://docs.oasis-open.org/opendocument/meta/rdfa#" office:version="1.2"><office:scripts/><office:font-face-decls><style:font-face style:name="OpenSymbol" svg:font-family="OpenSymbol"/><style:font-face style:name="Tahoma1" svg:font-family="Tahoma"/><style:font-face style:name="Times New Roman" svg:font-family="&apos;Times New Roman&apos;" style:font-family-generic="roman" style:font-pitch="variable"/><style:font-face style:name="Arial" svg:font-family="Arial" style:font-family-generic="swiss" style:font-pitch="variable"/><style:font-face style:name="Arial Unicode MS" svg:font-family="&apos;Arial Unicode MS&apos;" style:font-family-generic="system" style:font-pitch="variable"/><style:font-face style:name="MS Mincho" svg:font-family="&apos;MS Mincho&apos;" style:font-family-generic="system" style:font-pitch="variable"/><style:font-face style:name="Tahoma" svg:font-family="Tahoma" style:font-family-generic="system" style:font-pitch="variable"/></office:font-face-decls><office:automatic-styles><style:style style:name="P1" style:family="paragraph" style:parent-style-name="Standard" style:list-style-name="L1"/><style:style style:name="T1" style:family="text"><style:text-properties style:font-name="Arial"/></style:style><text:list-style style:name="L1"><text:list-level-style-bullet text:level="1" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•"><style:list-level-properties text:list-level-position-and-space-mode="label-alignment"><style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="1.27cm" fo:text-indent="-0.635cm" fo:margin-left="1.27cm"/></style:list-level-properties></text:list-level-style-bullet><text:list-level-style-bullet text:level="2" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="◦"><style:list-level-properties text:list-level-position-and-space-mode="label-alignment"><style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="1.905cm" fo:text-indent="-0.635cm" fo:margin-left="1.905cm"/></style:list-level-properties></text:list-level-style-bullet><text:list-level-style-bullet text:level="3" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="▪"><style:list-level-properties text:list-level-position-and-space-mode="label-alignment"><style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="2.54cm" fo:text-indent="-0.635cm" fo:margin-left="2.54cm"/></style:list-level-properties></text:list-level-style-bullet><text:list-level-style-bullet text:level="4" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•"><style:list-level-properties text:list-level-position-and-space-mode="label-alignment"><style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="3.175cm" fo:text-indent="-0.635cm" fo:margin-left="3.175cm"/></style:list-level-properties></text:list-level-style-bullet><text:list-level-style-bullet text:level="5" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="◦"><style:list-level-properties text:list-level-position-and-space-mode="label-alignment"><style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="3.81cm" fo:text-indent="-0.635cm" fo:margin-left="3.81cm"/></style:list-level-properties></text:list-level-style-bullet><text:list-level-style-bullet text:level="6" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="▪"><style:list-level-properties text:list-level-position-and-space-mode="label-alignment"><style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="4.445cm" fo:text-indent="-0.635cm" fo:margin-left="4.445cm"/></style:list-level-properties></text:list-level-style-bullet><text:list-level-style-bullet text:level="7" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•"><style:list-level-properties text:list-level-position-and-space-mode="label-alignment"><style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="5.08cm" fo:text-indent="-0.635cm" fo:margin-left="5.08cm"/></style:list-level-properties></text:list-level-style-bullet><text:list-level-style-bullet text:level="8" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="◦"><style:list-level-properties text:list-level-position-and-space-mode="label-alignment"><style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="5.715cm" fo:text-indent="-0.635cm" fo:margin-left="5.715cm"/></style:list-level-properties></text:list-level-style-bullet><text:list-level-style-bullet text:level="9" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="▪"><style:list-level-properties text:list-level-position-and-space-mode="label-alignment"><style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="6.35cm" fo:text-indent="-0.635cm" fo:margin-left="6.35cm"/></style:list-level-properties></text:list-level-style-bullet><text:list-level-style-bullet text:level="10" text:style-name="Bullet_20_Symbols" style:num-suffix="." text:bullet-char="•"><style:list-level-properties text:list-level-position-and-space-mode="label-alignment"><style:list-level-label-alignment text:label-followed-by="listtab" text:list-tab-stop-position="6.985cm" fo:text-indent="-0.635cm" fo:margin-left="6.985cm"/></style:list-level-properties></text:list-level-style-bullet></text:list-style></office:automatic-styles><office:body><office:text><text:sequence-decls><text:sequence-decl text:display-outline-level="0" text:name="Illustration"/><text:sequence-decl text:display-outline-level="0" text:name="Table"/><text:sequence-decl text:display-outline-level="0" text:name="Text"/><text:sequence-decl text:display-outline-level="0" text:name="Drawing"/></text:sequence-decls><text:h text:style-name="Heading_20_1" text:outline-level="1">Überschrift</text:h><text:list xml:id="list38593008" text:style-name="L1"><text:list-item><text:p text:style-name="P1"><text:span text:style-name="T1">Name:<text:tab/><text:tab/>$$n_fn$$</text:span></text:p></text:list-item><text:list-item><text:p text:style-name="P1"><text:span text:style-name="T1">Firma:<text:tab/><text:tab/>$$org_name$$</text:span></text:p></text:list-item><text:list-item><text:p text:style-name="P1"><text:span text:style-name="T1">Menge:<text:tab/>$$#menge$$</text:span></text:p></text:list-item></text:list></office:text></office:body></office:document-content>
-===DONE===
diff --git a/ext/phar/tests/zip/bzip2.phpt b/ext/phar/tests/zip/bzip2.phpt
index 551e419b87..13bdde3ea6 100644
--- a/ext/phar/tests/zip/bzip2.phpt
+++ b/ext/phar/tests/zip/bzip2.phpt
@@ -6,17 +6,16 @@ Phar: process bzip2-compressed zip entry
--FILE--
<?php
try {
- $a = new PharData(dirname(__FILE__) . '/files/bzip2.zip');
- foreach ($a as $entry => $file) {
- echo $file->getContent();
- }
- $a = new Phar(dirname(__FILE__) . '/files/bz2_alias.phar.zip');
- var_dump($a->getAlias());
+ $a = new PharData(dirname(__FILE__) . '/files/bzip2.zip');
+ foreach ($a as $entry => $file) {
+ echo $file->getContent();
+ }
+ $a = new Phar(dirname(__FILE__) . '/files/bz2_alias.phar.zip');
+ var_dump($a->getAlias());
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--EXPECT--
<?php
include dirname(__FILE__) . '/corrupt_zipmaker.php.inc';
@@ -79,4 +78,3 @@ $a->addFile('hi', null, 'hii', null, null, 'compress', 'compress', 11);
$a->writeZip(dirname(__FILE__) . '/compress_unsupunknown.zip');
?>
string(175) "hitheresuperlongzipistoostupidtodowhatIsaysoIhavetousethisridiculouslylongaliasbecauseitisstupiddidImentionthatalreadythemadnessdoesnotstopIhateinfozipIhateinfozipIhateinfozip"
-===DONE===
diff --git a/ext/phar/tests/zip/corrupt_001.phpt b/ext/phar/tests/zip/corrupt_001.phpt
index 66d1d62ec9..bccbdc5990 100644
--- a/ext/phar/tests/zip/corrupt_001.phpt
+++ b/ext/phar/tests/zip/corrupt_001.phpt
@@ -5,18 +5,16 @@ Phar: corrupted zip (count mismatch)
--FILE--
<?php
try {
- new PharData(__DIR__ . '/files/count1.zip');
+ new PharData(__DIR__ . '/files/count1.zip');
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- new PharData(__DIR__ . '/files/count2.zip');
+ new PharData(__DIR__ . '/files/count2.zip');
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--EXPECTF--
phar error: corrupt zip archive, conflicting file count in end of central directory record in zip-based phar "%scount1.zip"
phar error: corrupt zip archive, conflicting file count in end of central directory record in zip-based phar "%scount2.zip"
-===DONE===
diff --git a/ext/phar/tests/zip/corrupt_002.phpt b/ext/phar/tests/zip/corrupt_002.phpt
index 7aad946fa8..4144e5e5b7 100644
--- a/ext/phar/tests/zip/corrupt_002.phpt
+++ b/ext/phar/tests/zip/corrupt_002.phpt
@@ -5,12 +5,10 @@ Phar: corrupted zip (no end of zip record)
--FILE--
<?php
try {
- new PharData(__DIR__ . '/files/nozipend.zip');
+ new PharData(__DIR__ . '/files/nozipend.zip');
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--EXPECTF--
phar error: end of central directory not found in zip-based phar "%snozipend.zip"
-===DONE===
diff --git a/ext/phar/tests/zip/corrupt_003.phpt b/ext/phar/tests/zip/corrupt_003.phpt
index e076a4eb8f..6c2aebb928 100644
--- a/ext/phar/tests/zip/corrupt_003.phpt
+++ b/ext/phar/tests/zip/corrupt_003.phpt
@@ -5,12 +5,10 @@ Phar: corrupted zip (truncated file comment)
--FILE--
<?php
try {
- new PharData(__DIR__ . '/files/filecomment.zip');
+ new PharData(__DIR__ . '/files/filecomment.zip');
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--EXPECTF--
phar error: corrupt zip archive, zip file comment truncated in zip-based phar "%sfilecomment.zip"
-===DONE===
diff --git a/ext/phar/tests/zip/corrupt_004.phpt b/ext/phar/tests/zip/corrupt_004.phpt
index 516fe31e5a..c77722ca9b 100644
--- a/ext/phar/tests/zip/corrupt_004.phpt
+++ b/ext/phar/tests/zip/corrupt_004.phpt
@@ -5,12 +5,10 @@ Phar: corrupted zip (central directory offset incorrect)
--FILE--
<?php
try {
- new PharData(__DIR__ . '/files/cdir_offset.zip');
+ new PharData(__DIR__ . '/files/cdir_offset.zip');
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--EXPECTF--
phar error: corrupted central directory entry, no magic signature in zip-based phar "%scdir_offset.zip"
-===DONE===
diff --git a/ext/phar/tests/zip/corrupt_005.phpt b/ext/phar/tests/zip/corrupt_005.phpt
index 00ac1f6b4e..6f46d27e1f 100644
--- a/ext/phar/tests/zip/corrupt_005.phpt
+++ b/ext/phar/tests/zip/corrupt_005.phpt
@@ -5,12 +5,10 @@ Phar: encrypted zip
--FILE--
<?php
try {
- new PharData(__DIR__ . '/files/encrypted.zip');
+ new PharData(__DIR__ . '/files/encrypted.zip');
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--EXPECTF--
phar error: Cannot process encrypted zip files in zip-based phar "%sencrypted.zip"
-===DONE===
diff --git a/ext/phar/tests/zip/corrupt_006.phpt b/ext/phar/tests/zip/corrupt_006.phpt
index aca7bc572b..91642cf6bc 100644
--- a/ext/phar/tests/zip/corrupt_006.phpt
+++ b/ext/phar/tests/zip/corrupt_006.phpt
@@ -5,12 +5,10 @@ Phar: zip with file created from stdin
--FILE--
<?php
try {
- new PharData(__DIR__ . '/files/stdin.zip');
+ new PharData(__DIR__ . '/files/stdin.zip');
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--EXPECTF--
phar error: Cannot process zips created from stdin (zero-length filename) in zip-based phar "%sstdin.zip"
-===DONE===
diff --git a/ext/phar/tests/zip/corrupt_007.phpt b/ext/phar/tests/zip/corrupt_007.phpt
index 35efd5b489..d185d75825 100644
--- a/ext/phar/tests/zip/corrupt_007.phpt
+++ b/ext/phar/tests/zip/corrupt_007.phpt
@@ -5,12 +5,10 @@ Phar: corrupted zip (truncated filename record)
--FILE--
<?php
try {
- new PharData(__DIR__ . '/files/truncfilename.zip');
+ new PharData(__DIR__ . '/files/truncfilename.zip');
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--EXPECTF--
phar error: corrupted central directory entry, no magic signature in zip-based phar "%struncfilename.zip"
-===DONE===
diff --git a/ext/phar/tests/zip/corrupt_008.phpt b/ext/phar/tests/zip/corrupt_008.phpt
index 7385b03183..dd0ffbf478 100644
--- a/ext/phar/tests/zip/corrupt_008.phpt
+++ b/ext/phar/tests/zip/corrupt_008.phpt
@@ -5,82 +5,81 @@ Phar: unsupported compression methods
--FILE--
<?php
try {
- new PharData(__DIR__ . '/files/compress_unsup1.zip');
+ new PharData(__DIR__ . '/files/compress_unsup1.zip');
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- new PharData(__DIR__ . '/files/compress_unsup2.zip');
+ new PharData(__DIR__ . '/files/compress_unsup2.zip');
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- new PharData(__DIR__ . '/files/compress_unsup3.zip');
+ new PharData(__DIR__ . '/files/compress_unsup3.zip');
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- new PharData(__DIR__ . '/files/compress_unsup4.zip');
+ new PharData(__DIR__ . '/files/compress_unsup4.zip');
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- new PharData(__DIR__ . '/files/compress_unsup5.zip');
+ new PharData(__DIR__ . '/files/compress_unsup5.zip');
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- new PharData(__DIR__ . '/files/compress_unsup6.zip');
+ new PharData(__DIR__ . '/files/compress_unsup6.zip');
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- new PharData(__DIR__ . '/files/compress_unsup7.zip');
+ new PharData(__DIR__ . '/files/compress_unsup7.zip');
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- new PharData(__DIR__ . '/files/compress_unsup9.zip');
+ new PharData(__DIR__ . '/files/compress_unsup9.zip');
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- new PharData(__DIR__ . '/files/compress_unsup10.zip');
+ new PharData(__DIR__ . '/files/compress_unsup10.zip');
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- new PharData(__DIR__ . '/files/compress_unsup14.zip');
+ new PharData(__DIR__ . '/files/compress_unsup14.zip');
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- new PharData(__DIR__ . '/files/compress_unsup18.zip');
+ new PharData(__DIR__ . '/files/compress_unsup18.zip');
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- new PharData(__DIR__ . '/files/compress_unsup19.zip');
+ new PharData(__DIR__ . '/files/compress_unsup19.zip');
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- new PharData(__DIR__ . '/files/compress_unsup97.zip');
+ new PharData(__DIR__ . '/files/compress_unsup97.zip');
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- new PharData(__DIR__ . '/files/compress_unsup98.zip');
+ new PharData(__DIR__ . '/files/compress_unsup98.zip');
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- new PharData(__DIR__ . '/files/compress_unsupunknown.zip');
+ new PharData(__DIR__ . '/files/compress_unsupunknown.zip');
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--EXPECTF--
phar error: unsupported compression method (Shrunk) used in this zip in zip-based phar "%scompress_unsup1.zip"
phar error: unsupported compression method (Reduce) used in this zip in zip-based phar "%scompress_unsup2.zip"
@@ -97,4 +96,3 @@ phar error: unsupported compression method (IBM LZ77) used in this zip in zip-ba
phar error: unsupported compression method (WavPack) used in this zip in zip-based phar "%scompress_unsup97.zip"
phar error: unsupported compression method (PPMd) used in this zip in zip-based phar "%scompress_unsup98.zip"
phar error: unsupported compression method (unknown) used in this zip in zip-based phar "%scompress_unsupunknown.zip"
-===DONE===
diff --git a/ext/phar/tests/zip/corrupt_009.phpt b/ext/phar/tests/zip/corrupt_009.phpt
index ab7594ac30..20f85bcd79 100644
--- a/ext/phar/tests/zip/corrupt_009.phpt
+++ b/ext/phar/tests/zip/corrupt_009.phpt
@@ -5,12 +5,10 @@ Phar: corrupted zip (extra field way too long)
--FILE--
<?php
try {
- new PharData(__DIR__ . '/files/extralen_toolong.zip');
+ new PharData(__DIR__ . '/files/extralen_toolong.zip');
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--EXPECTF--
phar error: Unable to process extra field header for file in central directory in zip-based phar "%sextralen_toolong.zip"
-===DONE===
diff --git a/ext/phar/tests/zip/corrupt_010.phpt b/ext/phar/tests/zip/corrupt_010.phpt
index 4643cae070..7850dcafdb 100644
--- a/ext/phar/tests/zip/corrupt_010.phpt
+++ b/ext/phar/tests/zip/corrupt_010.phpt
@@ -5,12 +5,10 @@ Phar: unable to process zip (zip spanning multiple archives)
--FILE--
<?php
try {
- new PharData(__DIR__ . '/files/disknumber.zip');
+ new PharData(__DIR__ . '/files/disknumber.zip');
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--EXPECTF--
phar error: split archives spanning multiple zips cannot be processed in zip-based phar "%sdisknumber.zip"
-===DONE===
diff --git a/ext/phar/tests/zip/create_new_and_modify.phpt b/ext/phar/tests/zip/create_new_and_modify.phpt
index 2a52e8a5ca..38cf305525 100644
--- a/ext/phar/tests/zip/create_new_and_modify.phpt
+++ b/ext/phar/tests/zip/create_new_and_modify.phpt
@@ -42,7 +42,6 @@ include $pname . '/a.php';
include $pname . '/b.php';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip.php'); ?>
--EXPECT--
@@ -51,4 +50,3 @@ brand new!
bool(true)
modified!
another!
-===DONE===
diff --git a/ext/phar/tests/zip/create_new_phar_b.phpt b/ext/phar/tests/zip/create_new_phar_b.phpt
index d8a72c9d42..d14682f3dc 100644
--- a/ext/phar/tests/zip/create_new_phar_b.phpt
+++ b/ext/phar/tests/zip/create_new_phar_b.phpt
@@ -9,18 +9,16 @@ phar.require_hash=1
<?php
file_put_contents('phar://' . __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.zip/a.php',
- 'brand new!');
+ 'brand new!');
include 'phar://' . __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.zip/a.php';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip'); ?>
--EXPECTF--
-Warning: file_put_contents(phar://%screate_new_phar_b.phar.zip/a.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %screate_new_phar_b.php on line %d
+Warning: file_put_contents(phar://%screate_new_phar_b.phar.zip/a.php): Failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %screate_new_phar_b.php on line %d
-Warning: include(phar://%screate_new_phar_b.phar.zip/a.php): failed to open stream: %s in %screate_new_phar_b.php on line %d
+Warning: include(phar://%screate_new_phar_b.phar.zip/a.php): Failed to open stream: %s in %screate_new_phar_b.php on line %d
Warning: include(): Failed opening 'phar://%screate_new_phar_b.phar.zip/a.php' for inclusion (include_path='%s') in %screate_new_phar_b.php on line %d
-===DONE===
diff --git a/ext/phar/tests/zip/delete.phpt b/ext/phar/tests/zip/delete.phpt
index 87536c9666..25b9d2d62a 100644
--- a/ext/phar/tests/zip/delete.phpt
+++ b/ext/phar/tests/zip/delete.phpt
@@ -28,4 +28,4 @@ echo file_get_contents($alias . '/a') . "\n";
--EXPECTF--
a
-Warning: file_get_contents(phar://%sdelete.phar.zip/a): failed to open stream: phar error: "a" is not a file in phar "%sdelete.phar.zip" in %sdelete.php on line %d
+Warning: file_get_contents(phar://%sdelete.phar.zip/a): Failed to open stream: phar error: "a" is not a file in phar "%sdelete.phar.zip" in %sdelete.php on line %d
diff --git a/ext/phar/tests/zip/delete_in_phar.phpt b/ext/phar/tests/zip/delete_in_phar.phpt
index 86a6d4dbd4..5f5d644470 100644
--- a/ext/phar/tests/zip/delete_in_phar.phpt
+++ b/ext/phar/tests/zip/delete_in_phar.phpt
@@ -30,7 +30,6 @@ include $alias . '/b.php';
include $alias . '/b/c.php';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip'); ?>
--EXPECTF--
@@ -41,8 +40,7 @@ This is b/c
This is a
This is b
-Warning: include(%sdelete_in_phar.phar.zip/b/c.php): failed to open stream: phar error: "b/c.php" is not a file in phar "%sdelete_in_phar.phar.zip" in %sdelete_in_phar.php on line %d
+Warning: include(%sdelete_in_phar.phar.zip/b/c.php): Failed to open stream: phar error: "b/c.php" is not a file in phar "%sdelete_in_phar.phar.zip" in %sdelete_in_phar.php on line %d
Warning: include(): Failed opening 'phar://%sdelete_in_phar.phar.zip/b/c.php' for inclusion (include_path='%s') in %sdelete_in_phar.php on line %d
-===DONE===
diff --git a/ext/phar/tests/zip/delete_in_phar_b.phpt b/ext/phar/tests/zip/delete_in_phar_b.phpt
index 65f47e55ba..ac8a0db4dd 100644
--- a/ext/phar/tests/zip/delete_in_phar_b.phpt
+++ b/ext/phar/tests/zip/delete_in_phar_b.phpt
@@ -31,7 +31,6 @@ include $alias . '/b.php';
include $alias . '/b/c.php';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip'); ?>
--EXPECTF--
@@ -45,4 +44,3 @@ This is a
This is b
This is b/c
-===DONE===
diff --git a/ext/phar/tests/zip/delete_in_phar_confirm.phpt b/ext/phar/tests/zip/delete_in_phar_confirm.phpt
index 26ff9b3456..4d2c68720e 100644
--- a/ext/phar/tests/zip/delete_in_phar_confirm.phpt
+++ b/ext/phar/tests/zip/delete_in_phar_confirm.phpt
@@ -35,7 +35,6 @@ include 'phar://' . __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.zip/b.ph
include 'phar://' . __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.zip/b/c.php';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip'); ?>
--EXPECTF--
@@ -46,8 +45,7 @@ This is b/c
This is a
This is b
-Warning: include(%sdelete_in_phar_confirm.phar.zip/b/c.php): failed to open stream: phar error: "b/c.php" is not a file in phar "%sdelete_in_phar_confirm.phar.zip" in %sdelete_in_phar_confirm.php on line %d
+Warning: include(%sdelete_in_phar_confirm.phar.zip/b/c.php): Failed to open stream: phar error: "b/c.php" is not a file in phar "%sdelete_in_phar_confirm.phar.zip" in %sdelete_in_phar_confirm.php on line %d
Warning: include(): Failed opening 'phar://%sdelete_in_phar_confirm.phar.zip/b/c.php' for inclusion (include_path='%s') in %sdelete_in_phar_confirm.php on line %d
-===DONE===
diff --git a/ext/phar/tests/zip/exists_as_phar.phpt b/ext/phar/tests/zip/exists_as_phar.phpt
index 2499e82312..31bec4b970 100644
--- a/ext/phar/tests/zip/exists_as_phar.phpt
+++ b/ext/phar/tests/zip/exists_as_phar.phpt
@@ -21,13 +21,12 @@ copy($fname, $tname);
$phar->setAlias('hio2');
try {
- $p = new Phar($tname);
+ $p = new Phar($tname);
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip');
@@ -35,4 +34,3 @@ unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar');
?>
--EXPECTF--
phar zip error: phar "%sexists_as_phar.phar.zip" already exists as a regular phar and must be deleted from disk prior to creating as a zip-based phar
-===DONE===
diff --git a/ext/phar/tests/zip/files/corrupt_zipmaker.php.inc b/ext/phar/tests/zip/files/corrupt_zipmaker.php.inc
index 80c6a3eab6..fdbf3e2f6c 100644
--- a/ext/phar/tests/zip/files/corrupt_zipmaker.php.inc
+++ b/ext/phar/tests/zip/files/corrupt_zipmaker.php.inc
@@ -34,298 +34,298 @@
*/
class corrupt_zipmaker
{
- /**
- * @var int Current position in the writer
- * @access private
- */
- var $offset = 0;
+ /**
+ * @var int Current position in the writer
+ * @access private
+ */
+ var $offset = 0;
- /**
- * @var string Optional comment to add to the zip
- * @access private
- */
- var $comment = "";
+ /**
+ * @var string Optional comment to add to the zip
+ * @access private
+ */
+ var $comment = "";
- /**
- * @var string Data written at the end of the ZIP file
- * @access private
- */
- var $central = "";
+ /**
+ * @var string Data written at the end of the ZIP file
+ * @access private
+ */
+ var $central = "";
- /**
- * @var string Data written at the start of the ZIP file
- * @access private
- */
- var $start = "";
+ /**
+ * @var string Data written at the start of the ZIP file
+ * @access private
+ */
+ var $start = "";
- /**
- * Set a comment on the ZIP file
- */
- function setComment($comment) { $this->comment = $comment; }
+ /**
+ * Set a comment on the ZIP file
+ */
+ function setComment($comment) { $this->comment = $comment; }
- /**
- * @param int $time Unix timestamp of the date to convert
- * @return the date formatted as a ZIP date
- */
- function getMTime($time)
- {
- $mtime = ($time !== null ? getdate($time) : getdate());
- $mtime = preg_replace(
- "/(..){1}(..){1}(..){1}(..){1}/",
- "\\x\\4\\x\\3\\x\\2\\x\\1",
- dechex(($mtime['year']-1980<<25)|
- ($mtime['mon' ]<<21)|
- ($mtime['mday' ]<<16)|
- ($mtime['hours' ]<<11)|
- ($mtime['minutes']<<5)|
- ($mtime['seconds']>>1)));
- eval('$mtime = "'.$mtime.'";');
- return $mtime;
- }
+ /**
+ * @param int $time Unix timestamp of the date to convert
+ * @return the date formatted as a ZIP date
+ */
+ function getMTime($time)
+ {
+ $mtime = ($time !== null ? getdate($time) : getdate());
+ $mtime = preg_replace(
+ "/(..){1}(..){1}(..){1}(..){1}/",
+ "\\x\\4\\x\\3\\x\\2\\x\\1",
+ dechex(($mtime['year']-1980<<25)|
+ ($mtime['mon' ]<<21)|
+ ($mtime['mday' ]<<16)|
+ ($mtime['hours' ]<<11)|
+ ($mtime['minutes']<<5)|
+ ($mtime['seconds']>>1)));
+ eval('$mtime = "'.$mtime.'";');
+ return $mtime;
+ }
- private function getFileEntry($compmethod, $mtime, $crc32, $complength, $uncomplength, $filename, $data, $corrupt, $fakecomp)
- {
- switch ($corrupt) {
- case null :
- $file = "PK\x03\x04\x14\x00\x00\x00" . pack('v', $compmethod) .
- $mtime .
- pack("VVVvv", $crc32, $complength, $uncomplength, strlen($filename), 0x00) .
- $filename .
- $data;
- break;
- case 'compress' :
- $file = "PK\x03\x04\x14\x00\x00\x00" . pack('v', $fakecomp) .
- $mtime .
- pack("VVVvv", $crc32, $complength, $uncomplength, strlen($filename), 0x00) .
- $filename .
- $data;
- break;
- case 'encrypt' :
- $file = "PK\x03\x04\x14\x00\x01\x00" . pack('v', $compmethod) .
- $mtime .
- pack("VVVvv", $crc32, $complength, $uncomplength, strlen($filename), 0x00) .
- $filename .
- $data;
- break;
- case 'crc32' :
- $file = "PK\x03\x04\x14\x00\x00\x00" . pack('v', $compmethod) .
- $mtime .
- pack("VVVvv", $crc32 + 1, $complength, $uncomplength, strlen($filename), 0x00) .
- $filename .
- $data;
- break;
- case 'complength' :
- $file = "PK\x03\x04\x14\x00\x00\x00" . pack('v', $compmethod) .
- $mtime .
- pack("VVVvv", $crc32, $complength + 1, $uncomplength, strlen($filename), 0x00) .
- $filename .
- $data;
- break;
- case 'uncomplength' :
- $file = "PK\x03\x04\x14\x00\x00\x00" . pack('v', $compmethod) .
- $mtime .
- pack("VVVvv", $crc32, $complength, $uncomplength - 1, strlen($filename), 0x00) .
- $filename .
- $data;
- break;
- case 'filename_len' :
- $file = "PK\x03\x04\x14\x00\x00\x00" . pack('v', $compmethod) .
- $mtime .
- pack("VVVvv", $crc32, $complength, $uncomplength, strlen($filename) - 1, 0x00) .
- $filename .
- $data;
- break;
- case 'extra_len' :
- $file = "PK\x03\x04\x14\x00\x00\x00" . pack('v', $compmethod) .
- $mtime .
- pack("VVVvv", $crc32, $complength, $uncomplength, strlen($filename), 1) .
- $filename .
- $data;
- break;
- case 'filename' :
- $file = "PK\x03\x04\x14\x00\x00\x00" . pack('v', $compmethod) .
- $mtime .
- pack("VVVvv", $crc32, $complength, $uncomplength, strlen($filename), 0x00) .
- substr($filename, 1) .
- $data;
- break;
- case 'data' :
- $file = "PK\x03\x04\x14\x00\x00\x00" . pack('v', $compmethod) .
- $mtime .
- pack("VVVvv", $crc32, $complength, $uncomplength, strlen($filename), 0x00) .
- $filename .
- substr($data, 1);
- break;
- }
- return $file;
- }
+ private function getFileEntry($compmethod, $mtime, $crc32, $complength, $uncomplength, $filename, $data, $corrupt, $fakecomp)
+ {
+ switch ($corrupt) {
+ case null :
+ $file = "PK\x03\x04\x14\x00\x00\x00" . pack('v', $compmethod) .
+ $mtime .
+ pack("VVVvv", $crc32, $complength, $uncomplength, strlen($filename), 0x00) .
+ $filename .
+ $data;
+ break;
+ case 'compress' :
+ $file = "PK\x03\x04\x14\x00\x00\x00" . pack('v', $fakecomp) .
+ $mtime .
+ pack("VVVvv", $crc32, $complength, $uncomplength, strlen($filename), 0x00) .
+ $filename .
+ $data;
+ break;
+ case 'encrypt' :
+ $file = "PK\x03\x04\x14\x00\x01\x00" . pack('v', $compmethod) .
+ $mtime .
+ pack("VVVvv", $crc32, $complength, $uncomplength, strlen($filename), 0x00) .
+ $filename .
+ $data;
+ break;
+ case 'crc32' :
+ $file = "PK\x03\x04\x14\x00\x00\x00" . pack('v', $compmethod) .
+ $mtime .
+ pack("VVVvv", $crc32 + 1, $complength, $uncomplength, strlen($filename), 0x00) .
+ $filename .
+ $data;
+ break;
+ case 'complength' :
+ $file = "PK\x03\x04\x14\x00\x00\x00" . pack('v', $compmethod) .
+ $mtime .
+ pack("VVVvv", $crc32, $complength + 1, $uncomplength, strlen($filename), 0x00) .
+ $filename .
+ $data;
+ break;
+ case 'uncomplength' :
+ $file = "PK\x03\x04\x14\x00\x00\x00" . pack('v', $compmethod) .
+ $mtime .
+ pack("VVVvv", $crc32, $complength, $uncomplength - 1, strlen($filename), 0x00) .
+ $filename .
+ $data;
+ break;
+ case 'filename_len' :
+ $file = "PK\x03\x04\x14\x00\x00\x00" . pack('v', $compmethod) .
+ $mtime .
+ pack("VVVvv", $crc32, $complength, $uncomplength, strlen($filename) - 1, 0x00) .
+ $filename .
+ $data;
+ break;
+ case 'extra_len' :
+ $file = "PK\x03\x04\x14\x00\x00\x00" . pack('v', $compmethod) .
+ $mtime .
+ pack("VVVvv", $crc32, $complength, $uncomplength, strlen($filename), 1) .
+ $filename .
+ $data;
+ break;
+ case 'filename' :
+ $file = "PK\x03\x04\x14\x00\x00\x00" . pack('v', $compmethod) .
+ $mtime .
+ pack("VVVvv", $crc32, $complength, $uncomplength, strlen($filename), 0x00) .
+ substr($filename, 1) .
+ $data;
+ break;
+ case 'data' :
+ $file = "PK\x03\x04\x14\x00\x00\x00" . pack('v', $compmethod) .
+ $mtime .
+ pack("VVVvv", $crc32, $complength, $uncomplength, strlen($filename), 0x00) .
+ $filename .
+ substr($data, 1);
+ break;
+ }
+ return $file;
+ }
- private function getCentralEntry($compmethod, $mtime, $crc32, $complength, $uncomplength, $filename, $comment, $corrupt, &$offset, $fakecomp)
- {
- settype($comment, 'string');
- switch ($corrupt) {
- case null :
- $central = "PK\x01\x02\x00\x00\x14\x00\x00\x00" . pack('v', $compmethod) .
- $mtime .
- pack("VVVvvvvvVV", $crc32, $complength, $uncomplength, strlen($filename), 0x00,strlen($comment),0x00,0x00,
- 0x0000, $this->offset).
- $filename . $comment;
- $offset = strlen($central);
- break;
- case 'encrypt' :
- $central = "PK\x01\x02\x00\x00\x14\x00\x01\x00" . pack('v', $compmethod) .
- $mtime .
- pack("VVVvvvvvVV", $crc32, $complength, $uncomplength, strlen($filename), 0x00,strlen($comment),0x00,0x00,
- 0x0000, $this->offset).
- $filename . $comment;
- $offset = strlen($central);
- break;
- case 'compress' :
- $central = "PK\x01\x02\x00\x00\x14\x00\x00\x00" . pack('v', $fakecomp) .
- $mtime .
- pack("VVVvvvvvVV", $crc32, $complength, $uncomplength, strlen($filename), 0x00,strlen($comment),0x00,0x00,
- 0x0000, $this->offset).
- $filename . $comment;
- $offset = strlen($central);
- break;
- case 'crc32' :
- $central = "PK\x01\x02\x00\x00\x14\x00\x00\x00" . pack('v', $compmethod) .
- $mtime .
- pack("VVVvvvvvVV", $crc32 + 1, $complength, $uncomplength, strlen($filename), 0x00,strlen($comment),0x00,0x00,
- 0x0000, $this->offset).
- $filename . $comment;
- $offset = strlen($central);
- break;
- case 'complength' :
- $central = "PK\x01\x02\x00\x00\x14\x00\x00\x00" . pack('v', $compmethod) .
- $mtime .
- pack("VVVvvvvvVV", $crc32, $complength - 1, $uncomplength, strlen($filename), 0x00,strlen($comment),0x00,0x00,
- 0x0000, $this->offset).
- $filename . $comment;
- $offset = strlen($central);
- break;
- case 'uncomplength' :
- $central = "PK\x01\x02\x00\x00\x14\x00\x00\x00" . pack('v', $compmethod) .
- $mtime .
- pack("VVVvvvvvVV", $crc32, $complength, $uncomplength - 1, strlen($filename), 0x00,strlen($comment),0x00,0x00,
- 0x0000, $this->offset).
- $filename . $comment;
- $offset = strlen($central);
- break;
- case 'filename_len' :
- $central = "PK\x01\x02\x00\x00\x14\x00\x00\x00" . pack('v', $compmethod) .
- $mtime .
- pack("VVVvvvvvVV", $crc32, $complength, $uncomplength, strlen($filename) - 1, 0x00,strlen($comment),0x00,0x00,
- 0x0000, $this->offset).
- $filename . $comment;
- $offset = strlen($central);
- break;
- case 'offset' :
- $central = "PK\x01\x02\x00\x00\x14\x00\x00\x00" . pack('v', $compmethod) .
- $mtime .
- pack("VVVvvvvvVV", $crc32, $complength, $uncomplength, strlen($filename), 0x00,strlen($comment),0x00,0x00,
- 0x0000, $this->offset - 1).
- $filename . $comment;
- $offset = strlen($central) - 1;
- break;
- case 'comment' :
- $central = "PK\x01\x02\x00\x00\x14\x00\x00\x00" . pack('v', $compmethod) .
- $mtime .
- pack("VVVvvvvvVV", $crc32, $complength, $uncomplength, strlen($filename), 0x00,strlen($comment) + 1,0x00,0x00,
- 0x0000, $this->offset).
- $filename . $comment;
- $offset = strlen($central);
- break;
- case 'extralen1' :
- $extra = 'nu' . 0xffff; // way huge size
- $central = "PK\x01\x02\x00\x00\x14\x00\x00\x00" . pack('v', $compmethod) .
- $mtime .
- pack("VVVvvvvvVV", $crc32, $complength, $uncomplength, strlen($filename), strlen($extra),strlen($comment),0x00,0x00,
- 0x0000, $this->offset).
- $filename . $extra . $comment;
- $offset = strlen($central);
- break;
- }
- return $central;
- }
+ private function getCentralEntry($compmethod, $mtime, $crc32, $complength, $uncomplength, $filename, $comment, $corrupt, &$offset, $fakecomp)
+ {
+ settype($comment, 'string');
+ switch ($corrupt) {
+ case null :
+ $central = "PK\x01\x02\x00\x00\x14\x00\x00\x00" . pack('v', $compmethod) .
+ $mtime .
+ pack("VVVvvvvvVV", $crc32, $complength, $uncomplength, strlen($filename), 0x00,strlen($comment),0x00,0x00,
+ 0x0000, $this->offset).
+ $filename . $comment;
+ $offset = strlen($central);
+ break;
+ case 'encrypt' :
+ $central = "PK\x01\x02\x00\x00\x14\x00\x01\x00" . pack('v', $compmethod) .
+ $mtime .
+ pack("VVVvvvvvVV", $crc32, $complength, $uncomplength, strlen($filename), 0x00,strlen($comment),0x00,0x00,
+ 0x0000, $this->offset).
+ $filename . $comment;
+ $offset = strlen($central);
+ break;
+ case 'compress' :
+ $central = "PK\x01\x02\x00\x00\x14\x00\x00\x00" . pack('v', $fakecomp) .
+ $mtime .
+ pack("VVVvvvvvVV", $crc32, $complength, $uncomplength, strlen($filename), 0x00,strlen($comment),0x00,0x00,
+ 0x0000, $this->offset).
+ $filename . $comment;
+ $offset = strlen($central);
+ break;
+ case 'crc32' :
+ $central = "PK\x01\x02\x00\x00\x14\x00\x00\x00" . pack('v', $compmethod) .
+ $mtime .
+ pack("VVVvvvvvVV", $crc32 + 1, $complength, $uncomplength, strlen($filename), 0x00,strlen($comment),0x00,0x00,
+ 0x0000, $this->offset).
+ $filename . $comment;
+ $offset = strlen($central);
+ break;
+ case 'complength' :
+ $central = "PK\x01\x02\x00\x00\x14\x00\x00\x00" . pack('v', $compmethod) .
+ $mtime .
+ pack("VVVvvvvvVV", $crc32, $complength - 1, $uncomplength, strlen($filename), 0x00,strlen($comment),0x00,0x00,
+ 0x0000, $this->offset).
+ $filename . $comment;
+ $offset = strlen($central);
+ break;
+ case 'uncomplength' :
+ $central = "PK\x01\x02\x00\x00\x14\x00\x00\x00" . pack('v', $compmethod) .
+ $mtime .
+ pack("VVVvvvvvVV", $crc32, $complength, $uncomplength - 1, strlen($filename), 0x00,strlen($comment),0x00,0x00,
+ 0x0000, $this->offset).
+ $filename . $comment;
+ $offset = strlen($central);
+ break;
+ case 'filename_len' :
+ $central = "PK\x01\x02\x00\x00\x14\x00\x00\x00" . pack('v', $compmethod) .
+ $mtime .
+ pack("VVVvvvvvVV", $crc32, $complength, $uncomplength, strlen($filename) - 1, 0x00,strlen($comment),0x00,0x00,
+ 0x0000, $this->offset).
+ $filename . $comment;
+ $offset = strlen($central);
+ break;
+ case 'offset' :
+ $central = "PK\x01\x02\x00\x00\x14\x00\x00\x00" . pack('v', $compmethod) .
+ $mtime .
+ pack("VVVvvvvvVV", $crc32, $complength, $uncomplength, strlen($filename), 0x00,strlen($comment),0x00,0x00,
+ 0x0000, $this->offset - 1).
+ $filename . $comment;
+ $offset = strlen($central) - 1;
+ break;
+ case 'comment' :
+ $central = "PK\x01\x02\x00\x00\x14\x00\x00\x00" . pack('v', $compmethod) .
+ $mtime .
+ pack("VVVvvvvvVV", $crc32, $complength, $uncomplength, strlen($filename), 0x00,strlen($comment) + 1,0x00,0x00,
+ 0x0000, $this->offset).
+ $filename . $comment;
+ $offset = strlen($central);
+ break;
+ case 'extralen1' :
+ $extra = 'nu' . 0xffff; // way huge size
+ $central = "PK\x01\x02\x00\x00\x14\x00\x00\x00" . pack('v', $compmethod) .
+ $mtime .
+ pack("VVVvvvvvVV", $crc32, $complength, $uncomplength, strlen($filename), strlen($extra),strlen($comment),0x00,0x00,
+ 0x0000, $this->offset).
+ $filename . $extra . $comment;
+ $offset = strlen($central);
+ break;
+ }
+ return $central;
+ }
- function addFile($filename, $mtime, $data, $comment = null, $compress = null, $filecorrupt = null, $centralcorrupt = null, $fakecomp = 1)
- {
- $mtime = $this->getMTime($mtime ? $mtime : null);
+ function addFile($filename, $mtime, $data, $comment = null, $compress = null, $filecorrupt = null, $centralcorrupt = null, $fakecomp = 1)
+ {
+ $mtime = $this->getMTime($mtime ? $mtime : null);
- $uncomplength = strlen($data);
- $crc32 = crc32($data) & 0xFFFFFFFF;
- $compmethod = 0;
- switch ($compress) {
- case 'gz' :
- $data = gzcompress($data);
- $compmethod = 8;
- break;
- case 'bz2' :
- $data = bzcompress($data);
- $compmethod = 12;
- break;
- }
- $complength = strlen($data);
+ $uncomplength = strlen($data);
+ $crc32 = crc32($data) & 0xFFFFFFFF;
+ $compmethod = 0;
+ switch ($compress) {
+ case 'gz' :
+ $data = gzcompress($data);
+ $compmethod = 8;
+ break;
+ case 'bz2' :
+ $data = bzcompress($data);
+ $compmethod = 12;
+ break;
+ }
+ $complength = strlen($data);
- $this->start .= ($file = $this->getFileEntry($compmethod, $mtime, $crc32, $complength, $uncomplength, $filename, $data, $filecorrupt, $fakecomp));
+ $this->start .= ($file = $this->getFileEntry($compmethod, $mtime, $crc32, $complength, $uncomplength, $filename, $data, $filecorrupt, $fakecomp));
- $offset = 0;
- $this->central .= $this->getCentralEntry($compmethod, $mtime, $crc32, $complength, $uncomplength, $filename, $comment, $centralcorrupt, $offset, $fakecomp);
+ $offset = 0;
+ $this->central .= $this->getCentralEntry($compmethod, $mtime, $crc32, $complength, $uncomplength, $filename, $comment, $centralcorrupt, $offset, $fakecomp);
- $this->offset += $offset;
- $this->count++;
- }
+ $this->offset += $offset;
+ $this->count++;
+ }
- function writeZip($zipfile, $corrupt = null)
- {
- $write = $this->start . $this->central;
- switch ($corrupt) {
- case null :
- $write .= "PK\x05\x06\x00\x00\x00\x00" .
- pack("vvVVv", $this->count, $this->count,
- $this->offset, strlen($this->start),
- strlen($this->comment)) . $this->comment;
- break;
- case 'disknumber' :
- $write .= "PK\x05\x06\x01\x00\x01\x00" .
- pack("vvVVv", $this->count, $this->count,
- $this->offset, strlen($this->start),
- strlen($this->comment)) . $this->comment;
- break;
- case 'count1' :
- $write .= "PK\x05\x06\x00\x00\x00\x00" .
- pack("vvVVv", $this->count + 1, $this->count,
- $this->offset, strlen($this->start),
- strlen($this->comment)) . $this->comment;
- break;
- case 'count2' :
- $write .= "PK\x05\x06\x00\x00\x00\x00" .
- pack("vvVVv", $this->count, $this->count + 1,
- $this->offset, strlen($this->start),
- strlen($this->comment)) . $this->comment;
- break;
- case 'cdir_offset' :
- $write .= "PK\x05\x06\x00\x00\x00\x00" .
- pack("vvVVv", $this->count, $this->count,
- $this->offset, strlen($this->start) - 3,
- strlen($this->comment)) . $this->comment;
- break;
- case 'cdir_len' :
- $write .= "PK\x05\x06\x00\x00\x00\x00" .
- pack("vvVVv", $this->count, $this->count,
- $this->offset - 5, strlen($this->start),
- strlen($this->comment)) . $this->comment;
- break;
- case 'comment' :
- $write .= "PK\x05\x06\x00\x00\x00\x00" .
- pack("vvVVv", $this->count, $this->count,
- strlen($this->start), $this->offset + 1,
- strlen($this->comment) + 1) . $this->comment;
- break;
- case 'none' :
- }
- file_put_contents($zipfile, $write);
- }
+ function writeZip($zipfile, $corrupt = null)
+ {
+ $write = $this->start . $this->central;
+ switch ($corrupt) {
+ case null :
+ $write .= "PK\x05\x06\x00\x00\x00\x00" .
+ pack("vvVVv", $this->count, $this->count,
+ $this->offset, strlen($this->start),
+ strlen($this->comment)) . $this->comment;
+ break;
+ case 'disknumber' :
+ $write .= "PK\x05\x06\x01\x00\x01\x00" .
+ pack("vvVVv", $this->count, $this->count,
+ $this->offset, strlen($this->start),
+ strlen($this->comment)) . $this->comment;
+ break;
+ case 'count1' :
+ $write .= "PK\x05\x06\x00\x00\x00\x00" .
+ pack("vvVVv", $this->count + 1, $this->count,
+ $this->offset, strlen($this->start),
+ strlen($this->comment)) . $this->comment;
+ break;
+ case 'count2' :
+ $write .= "PK\x05\x06\x00\x00\x00\x00" .
+ pack("vvVVv", $this->count, $this->count + 1,
+ $this->offset, strlen($this->start),
+ strlen($this->comment)) . $this->comment;
+ break;
+ case 'cdir_offset' :
+ $write .= "PK\x05\x06\x00\x00\x00\x00" .
+ pack("vvVVv", $this->count, $this->count,
+ $this->offset, strlen($this->start) - 3,
+ strlen($this->comment)) . $this->comment;
+ break;
+ case 'cdir_len' :
+ $write .= "PK\x05\x06\x00\x00\x00\x00" .
+ pack("vvVVv", $this->count, $this->count,
+ $this->offset - 5, strlen($this->start),
+ strlen($this->comment)) . $this->comment;
+ break;
+ case 'comment' :
+ $write .= "PK\x05\x06\x00\x00\x00\x00" .
+ pack("vvVVv", $this->count, $this->count,
+ strlen($this->start), $this->offset + 1,
+ strlen($this->comment) + 1) . $this->comment;
+ break;
+ case 'none' :
+ }
+ file_put_contents($zipfile, $write);
+ }
}
?>
diff --git a/ext/phar/tests/zip/files/make_invalid_tar.php.inc b/ext/phar/tests/zip/files/make_invalid_tar.php.inc
index 4f4758bbb6..78fc06629c 100644
--- a/ext/phar/tests/zip/files/make_invalid_tar.php.inc
+++ b/ext/phar/tests/zip/files/make_invalid_tar.php.inc
@@ -3,10 +3,10 @@ include dirname(__FILE__) . '/tarmaker.php.inc';
class corrupter extends tarmaker {
function close()
{
- parent::close();
- $fp = fopen($this->path, 'r+b');
- fseek($fp, 20);
- fwrite($fp, 'oopsie');
- fclose($fp);
+ parent::close();
+ $fp = fopen($this->path, 'r+b');
+ fseek($fp, 20);
+ fwrite($fp, 'oopsie');
+ fclose($fp);
}
}
diff --git a/ext/phar/tests/zip/getalias.phpt b/ext/phar/tests/zip/getalias.phpt
index 2a2f5c19e6..e8ab8494cf 100644
--- a/ext/phar/tests/zip/getalias.phpt
+++ b/ext/phar/tests/zip/getalias.phpt
@@ -42,7 +42,6 @@ $phar->setAlias('pinocchio');
var_dump($phar->getAlias());
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip');
@@ -56,4 +55,3 @@ string(13) "jiminycricket"
Cannot set alias ".phar/alias.txt" directly in phar "%sgetalias.phar.zip", use setAlias
string(13) "jiminycricket"
string(9) "pinocchio"
-===DONE===
diff --git a/ext/phar/tests/zip/largezip.phpt b/ext/phar/tests/zip/largezip.phpt
index 78ee3d388e..d1f113d0a3 100644
--- a/ext/phar/tests/zip/largezip.phpt
+++ b/ext/phar/tests/zip/largezip.phpt
@@ -20,10 +20,8 @@ copy($fname, $fname2);
$p2 = new Phar($fname2);
var_dump(strlen($p2['big']->getContent()));
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip.php'); ?>
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.2.phar.zip.php'); ?>
--EXPECT--
int(200000)
-===DONE===
diff --git a/ext/phar/tests/zip/metadata_write_commit.phpt b/ext/phar/tests/zip/metadata_write_commit.phpt
index d179b17a5c..e0e09599af 100644
--- a/ext/phar/tests/zip/metadata_write_commit.phpt
+++ b/ext/phar/tests/zip/metadata_write_commit.phpt
@@ -23,7 +23,7 @@ $files['c'] = array('cont' => 'c', 'meta' => array('hi', 'there'));
$files['d'] = array('cont' => 'd', 'meta' => array('hi'=>'there','foo'=>'bar'));
foreach($files as $name => $cont) {
- var_dump(file_get_contents($p2name.'/'.$name));
+ var_dump(file_get_contents($p2name.'/'.$name));
}
copy($f2name, $fname);
@@ -36,7 +36,7 @@ $phar['d']->setMetadata(true);
$phar->setMetadata('hi');
foreach($files as $name => $cont) {
- var_dump($phar[$name]->getMetadata());
+ var_dump($phar[$name]->getMetadata());
}
$phar->stopBuffering();
@@ -45,15 +45,14 @@ unset($phar);
$phar = new Phar($fname);
foreach($files as $name => $cont) {
- var_dump(file_get_contents($pname.'/'.$name));
+ var_dump(file_get_contents($pname.'/'.$name));
}
foreach($files as $name => $cont) {
- var_dump($phar[$name]->getMetadata());
+ var_dump($phar[$name]->getMetadata());
}
var_dump($phar->getMetadata());
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip.php'); ?>
--EXPECT--
@@ -84,4 +83,3 @@ array(2) {
}
bool(true)
string(2) "hi"
-===DONE===
diff --git a/ext/phar/tests/zip/notphar.phpt b/ext/phar/tests/zip/notphar.phpt
index ff30a0c162..f5f049dc5c 100644
--- a/ext/phar/tests/zip/notphar.phpt
+++ b/ext/phar/tests/zip/notphar.phpt
@@ -21,5 +21,5 @@ unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip');
__HALT_COMPILER();
?>
--EXPECTF--
-Warning: include(phar://%snotphar.phar.zip/.phar/stub.php): failed to open stream: '%snotphar.phar.zip' is not a phar archive. Use PharData::__construct() for a standard zip or tar archive in %snotphar.php on line %d
+Warning: include(phar://%snotphar.phar.zip/.phar/stub.php): Failed to open stream: '%snotphar.phar.zip' is not a phar archive. Use PharData::__construct() for a standard zip or tar archive in %snotphar.php on line %d
PK%a
diff --git a/ext/phar/tests/zip/odt.phpt b/ext/phar/tests/zip/odt.phpt
index 5ca6ac8df0..af3a52cc9d 100644
--- a/ext/phar/tests/zip/odt.phpt
+++ b/ext/phar/tests/zip/odt.phpt
@@ -7,20 +7,19 @@ Phar: test a zip archive created by openoffice
<?php
$a = new PharData(__DIR__ . '/files/odt.odt');
foreach (new RecursiveIteratorIterator($a, RecursiveIteratorIterator::LEAVES_ONLY) as $b) {
- if ($b->isDir()) {
- echo "dir " . $b->getPathName() . "\n";
- } else {
- echo $b->getPathName() . "\n";
- }
+ if ($b->isDir()) {
+ echo "dir " . $b->getPathName() . "\n";
+ } else {
+ echo $b->getPathName() . "\n";
+ }
}
// this next line is for increased code coverage
try {
- $b = new Phar(__DIR__ . '/files/odt.odt');
+ $b = new Phar(__DIR__ . '/files/odt.odt');
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--EXPECTF--
phar://%sodt.odt/Configurations2/accelerator%ccurrent.xml
phar://%sodt.odt/META-INF%cmanifest.xml
@@ -31,4 +30,3 @@ phar://%sodt.odt%cmimetype
phar://%sodt.odt%csettings.xml
phar://%sodt.odt%cstyles.xml
Cannot create phar '%sodt.odt', file extension (or combination) not recognised or the directory does not exist
-===DONE===
diff --git a/ext/phar/tests/zip/open_for_write_existing.phpt b/ext/phar/tests/zip/open_for_write_existing.phpt
index fd76d4174e..f679df744e 100644
--- a/ext/phar/tests/zip/open_for_write_existing.phpt
+++ b/ext/phar/tests/zip/open_for_write_existing.phpt
@@ -21,7 +21,7 @@ $files['b.php'] = '<?php echo "This is b\n"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
foreach ($files as $n => $file) {
- $phar[$n] = $file;
+ $phar[$n] = $file;
}
$phar->stopBuffering();
@@ -31,9 +31,7 @@ fclose($fp);
include $alias . '/b/c.php';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip'); ?>
--EXPECT--
extra
-===DONE===
diff --git a/ext/phar/tests/zip/open_for_write_existing_b.phpt b/ext/phar/tests/zip/open_for_write_existing_b.phpt
index 35bd6cf3ec..dd605618ea 100644
--- a/ext/phar/tests/zip/open_for_write_existing_b.phpt
+++ b/ext/phar/tests/zip/open_for_write_existing_b.phpt
@@ -23,25 +23,18 @@ $files['b.php'] = '<?php echo "This is b\n"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
foreach ($files as $n => $file) {
- $phar[$n] = $file;
+ $phar[$n] = $file;
}
$phar->stopBuffering();
ini_set('phar.readonly', 1);
-$fp = fopen($alias . '/b/c.php', 'wb');
-fwrite($fp, 'extra');
-fclose($fp);
+var_dump(fopen($alias . '/b/c.php', 'wb'));
include $alias . '/b/c.php';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip'); ?>
--EXPECTF--
-Warning: fopen(phar://%sopen_for_write_existing_b.phar.zip/b/c.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_existing_b.php on line %d
-
-Warning: fwrite() expects parameter 1 to be resource, bool given in %spen_for_write_existing_b.php on line %d
-
-Warning: fclose() expects parameter 1 to be resource, bool given in %spen_for_write_existing_b.php on line %d
+Warning: fopen(phar://%sopen_for_write_existing_b.phar.zip/b/c.php): Failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_existing_b.php on line %d
+bool(false)
This is b/c
-===DONE===
diff --git a/ext/phar/tests/zip/open_for_write_existing_c.phpt b/ext/phar/tests/zip/open_for_write_existing_c.phpt
index 8c58025608..c4eb78c658 100644
--- a/ext/phar/tests/zip/open_for_write_existing_c.phpt
+++ b/ext/phar/tests/zip/open_for_write_existing_c.phpt
@@ -23,25 +23,18 @@ $files['b.php'] = '<?php echo "This is b\n"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
foreach ($files as $n => $file) {
- $phar[$n] = $file;
+ $phar[$n] = $file;
}
$phar->stopBuffering();
ini_set('phar.readonly', 1);
-$fp = fopen($alias . '/b/c.php', 'wb');
-fwrite($fp, 'extra');
-fclose($fp);
+var_dump(fopen($alias . '/b/c.php', 'wb'));
include $alias . '/b/c.php';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip'); ?>
--EXPECTF--
-Warning: fopen(phar://%sopen_for_write_existing_c.phar.zip/b/c.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_existing_c.php on line %d
-
-Warning: fwrite() expects parameter 1 to be resource, bool given in %spen_for_write_existing_c.php on line %d
-
-Warning: fclose() expects parameter 1 to be resource, bool given in %spen_for_write_existing_c.php on line %d
+Warning: fopen(phar://%sopen_for_write_existing_c.phar.zip/b/c.php): Failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_existing_c.php on line %d
+bool(false)
This is b/c
-===DONE===
diff --git a/ext/phar/tests/zip/open_for_write_newfile.phpt b/ext/phar/tests/zip/open_for_write_newfile.phpt
index 10a69f0dde..3791689a31 100644
--- a/ext/phar/tests/zip/open_for_write_newfile.phpt
+++ b/ext/phar/tests/zip/open_for_write_newfile.phpt
@@ -21,7 +21,7 @@ $files['b.php'] = '<?php echo "This is b\n"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
foreach ($files as $n => $file) {
- $phar[$n] = $file;
+ $phar[$n] = $file;
}
$phar->stopBuffering();
@@ -33,10 +33,8 @@ include $alias . '/b/c.php';
include $alias . '/b/new.php';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip'); ?>
--EXPECT--
This is b/c
extra
-===DONE===
diff --git a/ext/phar/tests/zip/open_for_write_newfile_b.phpt b/ext/phar/tests/zip/open_for_write_newfile_b.phpt
index d39dffb986..167350abd1 100644
--- a/ext/phar/tests/zip/open_for_write_newfile_b.phpt
+++ b/ext/phar/tests/zip/open_for_write_newfile_b.phpt
@@ -23,33 +23,26 @@ $files['b.php'] = '<?php echo "This is b\n"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
foreach ($files as $n => $file) {
- $phar[$n] = $file;
+ $phar[$n] = $file;
}
$phar->stopBuffering();
ini_set('phar.readonly', 1);
-$fp = fopen($alias . '/b/new.php', 'wb');
-fwrite($fp, 'extra');
-fclose($fp);
+var_dump(fopen($alias . '/b/new.php', 'wb'));
include $alias . '/b/c.php';
include $alias . '/b/new.php';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip'); ?>
--EXPECTF--
-Warning: fopen(phar://%sopen_for_write_newfile_b.phar.zip/b/new.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_newfile_b.php on line %d
-
-Warning: fwrite() expects parameter 1 to be resource, bool given in %sopen_for_write_newfile_b.php on line %d
-
-Warning: fclose() expects parameter 1 to be resource, bool given in %sopen_for_write_newfile_b.php on line %d
+Warning: fopen(phar://%sopen_for_write_newfile_b.phar.zip/b/new.php): Failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_newfile_b.php on line %d
+bool(false)
This is b/c
-Warning: include(phar://%sopen_for_write_newfile_b.phar.zip/b/new.php): failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_b.phar.zip" in %sopen_for_write_newfile_b.php on line %d
+Warning: include(phar://%sopen_for_write_newfile_b.phar.zip/b/new.php): Failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_b.phar.zip" in %sopen_for_write_newfile_b.php on line %d
Warning: include(): Failed opening 'phar://%sopen_for_write_newfile_b.phar.zip/b/new.php' for inclusion (include_path='%s') in %sopen_for_write_newfile_b.php on line %d
-===DONE===
diff --git a/ext/phar/tests/zip/open_for_write_newfile_c.phpt b/ext/phar/tests/zip/open_for_write_newfile_c.phpt
index f927a618cc..1c2d345050 100644
--- a/ext/phar/tests/zip/open_for_write_newfile_c.phpt
+++ b/ext/phar/tests/zip/open_for_write_newfile_c.phpt
@@ -23,33 +23,26 @@ $files['b.php'] = '<?php echo "This is b\n"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
foreach ($files as $n => $file) {
- $phar[$n] = $file;
+ $phar[$n] = $file;
}
$phar->stopBuffering();
ini_set('phar.readonly', 1);
-$fp = fopen($alias . '/b/new.php', 'wb');
-fwrite($fp, 'extra');
-fclose($fp);
+var_dump(fopen($alias . '/b/new.php', 'wb'));
include $alias . '/b/c.php';
include $alias . '/b/new.php';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip'); ?>
--EXPECTF--
-Warning: fopen(phar://%sopen_for_write_newfile_c.phar.zip/b/new.php): failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_newfile_c.php on line %d
-
-Warning: fwrite() expects parameter 1 to be resource, bool given in %sopen_for_write_newfile_c.php on line %d
-
-Warning: fclose() expects parameter 1 to be resource, bool given in %sopen_for_write_newfile_c.php on line %d
+Warning: fopen(phar://%sopen_for_write_newfile_c.phar.zip/b/new.php): Failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly in %sopen_for_write_newfile_c.php on line %d
+bool(false)
This is b/c
-Warning: include(phar://%sopen_for_write_newfile_c.phar.zip/b/new.php): failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_c.phar.zip" in %sopen_for_write_newfile_c.php on line %d
+Warning: include(phar://%sopen_for_write_newfile_c.phar.zip/b/new.php): Failed to open stream: phar error: "b/new.php" is not a file in phar "%sopen_for_write_newfile_c.phar.zip" in %sopen_for_write_newfile_c.php on line %d
Warning: include(): Failed opening 'phar://%sopen_for_write_newfile_c.phar.zip/b/new.php' for inclusion (include_path='%s') in %sopen_for_write_newfile_c.php on line %d
-===DONE===
diff --git a/ext/phar/tests/zip/phar_begin_setstub_commit.phpt b/ext/phar/tests/zip/phar_begin_setstub_commit.phpt
index 3adcc9c234..a7c8d76375 100644
--- a/ext/phar/tests/zip/phar_begin_setstub_commit.phpt
+++ b/ext/phar/tests/zip/phar_begin_setstub_commit.phpt
@@ -41,7 +41,6 @@ $p->setStub($a, $c);
var_dump($p->getStub());
fclose($a);
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/phar_begin_setstub_commit.phar.zip');
@@ -67,4 +66,3 @@ string(%d) "<?php var_dump("First resource"); Phar::mapPhar("phar_begin_setstub_
"
string(%d) "<?php var_dump("First resource"); Phar::mapPhar("phar_begin_setstub_commit.phar"); __HALT_COMPILER(); ?>
"
-===DONE===
diff --git a/ext/phar/tests/zip/phar_buildfromiterator4.phpt b/ext/phar/tests/zip/phar_buildfromiterator4.phpt
index 3f2b9f8355..aa1e3596ab 100644
--- a/ext/phar/tests/zip/phar_buildfromiterator4.phpt
+++ b/ext/phar/tests/zip/phar_buildfromiterator4.phpt
@@ -36,16 +36,15 @@ class myIterator implements Iterator
}
}
try {
- chdir(__DIR__);
- $phar = new Phar(__DIR__ . '/buildfromiterator.phar.zip');
- var_dump($phar->buildFromIterator(new myIterator(array('a' => basename(__FILE__, 'php') . 'phpt'))));
- var_dump($phar->isFileFormat(Phar::ZIP));
+ chdir(__DIR__);
+ $phar = new Phar(__DIR__ . '/buildfromiterator.phar.zip');
+ var_dump($phar->buildFromIterator(new myIterator(array('a' => basename(__FILE__, 'php') . 'phpt'))));
+ var_dump($phar->isFileFormat(Phar::ZIP));
} catch (Exception $e) {
- var_dump(get_class($e));
- echo $e->getMessage() . "\n";
+ var_dump(get_class($e));
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/buildfromiterator.phar.zip');
@@ -63,4 +62,3 @@ array(1) {
string(%d) "%sphar_buildfromiterator4.phpt"
}
bool(true)
-===DONE===
diff --git a/ext/phar/tests/zip/phar_buildfromiterator5.phpt b/ext/phar/tests/zip/phar_buildfromiterator5.phpt
index abc9295ad2..329a30a5c3 100644
--- a/ext/phar/tests/zip/phar_buildfromiterator5.phpt
+++ b/ext/phar/tests/zip/phar_buildfromiterator5.phpt
@@ -36,15 +36,14 @@ class myIterator implements Iterator
}
}
try {
- chdir(__DIR__);
- $phar = new Phar(__DIR__ . '/buildfromiterator.phar.zip');
- var_dump($phar->buildFromIterator(new myIterator(array('a' => new stdClass))));
+ chdir(__DIR__);
+ $phar = new Phar(__DIR__ . '/buildfromiterator.phar.zip');
+ var_dump($phar->buildFromIterator(new myIterator(array('a' => new stdClass))));
} catch (Exception $e) {
- var_dump(get_class($e));
- echo $e->getMessage() . "\n";
+ var_dump(get_class($e));
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/buildfromiterator.phar.zip');
@@ -56,4 +55,3 @@ valid
current
%s(24) "UnexpectedValueException"
Iterator myIterator returned an invalid value (must return a string)
-===DONE===
diff --git a/ext/phar/tests/zip/phar_buildfromiterator6.phpt b/ext/phar/tests/zip/phar_buildfromiterator6.phpt
index d478c92f07..a2c49f1d56 100644
--- a/ext/phar/tests/zip/phar_buildfromiterator6.phpt
+++ b/ext/phar/tests/zip/phar_buildfromiterator6.phpt
@@ -36,15 +36,14 @@ class myIterator implements Iterator
}
}
try {
- chdir(__DIR__);
- $phar = new Phar(__DIR__ . '/buildfromiterator.phar.zip');
- var_dump($phar->buildFromIterator(new myIterator(array(basename(__FILE__, 'php') . 'phpt'))));
+ chdir(__DIR__);
+ $phar = new Phar(__DIR__ . '/buildfromiterator.phar.zip');
+ var_dump($phar->buildFromIterator(new myIterator(array(basename(__FILE__, 'php') . 'phpt'))));
} catch (Exception $e) {
- var_dump(get_class($e));
- echo $e->getMessage() . "\n";
+ var_dump(get_class($e));
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/buildfromiterator.phar.zip');
@@ -57,4 +56,3 @@ current
key
%s(24) "UnexpectedValueException"
Iterator myIterator returned an invalid key (must return a string)
-===DONE===
diff --git a/ext/phar/tests/zip/phar_buildfromiterator7.phpt b/ext/phar/tests/zip/phar_buildfromiterator7.phpt
index 06c039bb79..45d36f41e0 100644
--- a/ext/phar/tests/zip/phar_buildfromiterator7.phpt
+++ b/ext/phar/tests/zip/phar_buildfromiterator7.phpt
@@ -36,15 +36,14 @@ class myIterator implements Iterator
}
}
try {
- chdir(__DIR__);
- $phar = new Phar(__DIR__ . '/buildfromiterator.phar.zip');
- var_dump($phar->buildFromIterator(new myIterator(array('a' => basename(__FILE__, 'php') . '/oopsie/there.phpt'))));
+ chdir(__DIR__);
+ $phar = new Phar(__DIR__ . '/buildfromiterator.phar.zip');
+ var_dump($phar->buildFromIterator(new myIterator(array('a' => basename(__FILE__, 'php') . '/oopsie/there.phpt'))));
} catch (Exception $e) {
- var_dump(get_class($e));
- echo $e->getMessage() . "\n";
+ var_dump(get_class($e));
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/buildfromiterator.phar.zip');
@@ -57,4 +56,3 @@ current
key
%s(24) "UnexpectedValueException"
Iterator myIterator returned a file that could not be opened "phar_buildfromiterator7./oopsie/there.phpt"
-===DONE===
diff --git a/ext/phar/tests/zip/phar_buildfromiterator8.phpt b/ext/phar/tests/zip/phar_buildfromiterator8.phpt
index 17c23afa2e..c411e6ee12 100644
--- a/ext/phar/tests/zip/phar_buildfromiterator8.phpt
+++ b/ext/phar/tests/zip/phar_buildfromiterator8.phpt
@@ -7,18 +7,17 @@ phar.readonly=0
--FILE--
<?php
try {
- chdir(__DIR__);
- $phar = new Phar(__DIR__ . '/buildfromiterator.phar.zip');
- $a = $phar->buildFromIterator(new RegexIterator(new DirectoryIterator('.'), '/^frontcontroller\d{0,2}\.phar\.phpt\\z|^\.\\z|^\.\.\\z/'), __DIR__ . DIRECTORY_SEPARATOR);
- asort($a);
- var_dump($a);
- var_dump($phar->isFileFormat(Phar::ZIP));
+ chdir(__DIR__);
+ $phar = new Phar(__DIR__ . '/buildfromiterator.phar.zip');
+ $a = $phar->buildFromIterator(new RegexIterator(new DirectoryIterator('.'), '/^frontcontroller\d{0,2}\.phar\.phpt\\z|^\.\\z|^\.\.\\z/'), __DIR__ . DIRECTORY_SEPARATOR);
+ asort($a);
+ var_dump($a);
+ var_dump($phar->isFileFormat(Phar::ZIP));
} catch (Exception $e) {
- var_dump(get_class($e));
- echo $e->getMessage() . "\n";
+ var_dump(get_class($e));
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/buildfromiterator.phar.zip');
@@ -70,4 +69,3 @@ array(21) {
string(%d) "%sfrontcontroller9.phar.phpt"
}
bool(true)
-===DONE===
diff --git a/ext/phar/tests/zip/phar_buildfromiterator9.phpt b/ext/phar/tests/zip/phar_buildfromiterator9.phpt
index 01bbb150fb..414924d807 100644
--- a/ext/phar/tests/zip/phar_buildfromiterator9.phpt
+++ b/ext/phar/tests/zip/phar_buildfromiterator9.phpt
@@ -36,16 +36,15 @@ class myIterator implements Iterator
}
}
try {
- chdir(__DIR__);
- $phar = new Phar(__DIR__ . '/buildfromiterator.phar');
- var_dump($phar->buildFromIterator(new myIterator(array('a' => $a = fopen(basename(__FILE__, 'php') . 'phpt', 'r')))));
- fclose($a);
+ chdir(__DIR__);
+ $phar = new Phar(__DIR__ . '/buildfromiterator.phar');
+ var_dump($phar->buildFromIterator(new myIterator(array('a' => $a = fopen(basename(__FILE__, 'php') . 'phpt', 'r')))));
+ fclose($a);
} catch (Exception $e) {
- var_dump(get_class($e));
- echo $e->getMessage() . "\n";
+ var_dump(get_class($e));
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/buildfromiterator.phar');
@@ -62,4 +61,3 @@ array(1) {
["a"]=>
string(%d) "[stream]"
}
-===DONE===
diff --git a/ext/phar/tests/zip/phar_commitwrite.phpt b/ext/phar/tests/zip/phar_commitwrite.phpt
index e95413fb24..0d42723e38 100644
--- a/ext/phar/tests/zip/phar_commitwrite.phpt
+++ b/ext/phar/tests/zip/phar_commitwrite.phpt
@@ -12,10 +12,9 @@ $p['file1.txt'] = 'hi';
$p->stopBuffering();
var_dump($p->getStub());
$p->setStub("<?php
-function __autoload(\$class)
-{
+spl_autoload_register(function(\$class) {
include 'phar://' . str_replace('_', '/', \$class);
-}
+});
Phar::mapPhar('phar_commitwrite.phar');
include 'phar://phar_commitwrite.phar/startup.php';
__HALT_COMPILER();
@@ -23,7 +22,6 @@ __HALT_COMPILER();
var_dump($p->getStub());
var_dump($p->isFileFormat(Phar::ZIP));
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/phar_commitwrite.phar.zip');
@@ -32,13 +30,11 @@ unlink(__DIR__ . '/phar_commitwrite.phar.zip');
string(60) "<?php // zip-based phar archive stub file
__HALT_COMPILER();"
string(%d) "<?php
-function __autoload($class)
-{
+spl_autoload_register(function($class) {
include 'phar://' . str_replace('_', '/', $class);
-}
+});
Phar::mapPhar('phar_commitwrite.phar');
include 'phar://phar_commitwrite.phar/startup.php';
__HALT_COMPILER(); ?>
"
bool(true)
-===DONE===
diff --git a/ext/phar/tests/zip/phar_convert_phar.phpt b/ext/phar/tests/zip/phar_convert_phar.phpt
index 494afd9583..ef9d9b35fc 100644
--- a/ext/phar/tests/zip/phar_convert_phar.phpt
+++ b/ext/phar/tests/zip/phar_convert_phar.phpt
@@ -35,7 +35,6 @@ var_dump($phar->isFileFormat(Phar::PHAR));
var_dump(strlen($phar->getStub()));
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar');
@@ -54,4 +53,3 @@ bool(true)
int(6641)
bool(true)
int(6641)
-===DONE===
diff --git a/ext/phar/tests/zip/phar_copy.phpt b/ext/phar/tests/zip/phar_copy.phpt
index f6424936b7..ea4f108dfc 100644
--- a/ext/phar/tests/zip/phar_copy.phpt
+++ b/ext/phar/tests/zip/phar_copy.phpt
@@ -19,20 +19,20 @@ $p = new Phar($fname);
try
{
- $p['a'] = 'hi';
- $p->startBuffering();
- $p->copy('a', 'b');
- echo file_get_contents($p['b']->getPathName());
- $p->copy('b', 'c');
- $p->stopBuffering();
- echo file_get_contents($p['c']->getPathName());
- copy($fname, $fname2);
- var_dump($p->isFileFormat(Phar::ZIP));
- $p->copy('a', $ename);
+ $p['a'] = 'hi';
+ $p->startBuffering();
+ $p->copy('a', 'b');
+ echo file_get_contents($p['b']->getPathName());
+ $p->copy('b', 'c');
+ $p->stopBuffering();
+ echo file_get_contents($p['c']->getPathName());
+ copy($fname, $fname2);
+ var_dump($p->isFileFormat(Phar::ZIP));
+ $p->copy('a', $ename);
}
catch(Exception $e)
{
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
ini_set('phar.readonly',1);
$p2 = new Phar($fname2);
diff --git a/ext/phar/tests/zip/phar_magic.phpt b/ext/phar/tests/zip/phar_magic.phpt
index fd29f06347..34b30d7d7f 100644
--- a/ext/phar/tests/zip/phar_magic.phpt
+++ b/ext/phar/tests/zip/phar_magic.phpt
@@ -24,7 +24,6 @@ include "phar://" . __FILE__ . "/a";
__HALT_COMPILER();');
include $pname;
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip.php');
@@ -37,4 +36,3 @@ bool(true)
in b
<?php include "b/c.php";
in d
-===DONE===
diff --git a/ext/phar/tests/zip/phar_oo_compressallbz2.phpt b/ext/phar/tests/zip/phar_oo_compressallbz2.phpt
index b2306bca61..2062f602f8 100644
--- a/ext/phar/tests/zip/phar_oo_compressallbz2.phpt
+++ b/ext/phar/tests/zip/phar_oo_compressallbz2.phpt
@@ -42,7 +42,6 @@ var_dump($c['a']->isCompressed(Phar::GZ));
var_dump($c['a']->isCompressed(Phar::BZ2));
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip.php');
@@ -67,4 +66,3 @@ bool(true)
string(1) "a"
bool(false)
bool(true)
-===DONE===
diff --git a/ext/phar/tests/zip/phar_oo_compressallgz.phpt b/ext/phar/tests/zip/phar_oo_compressallgz.phpt
index 5daaed48ad..0db97eadf0 100644
--- a/ext/phar/tests/zip/phar_oo_compressallgz.phpt
+++ b/ext/phar/tests/zip/phar_oo_compressallgz.phpt
@@ -34,7 +34,6 @@ var_dump($phar['b']->isCompressed(Phar::BZ2));
var_dump($phar['c']->isCompressed(Phar::GZ));
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip.php');
@@ -55,4 +54,3 @@ bool(true)
string(1) "c"
bool(false)
bool(true)
-===DONE===
diff --git a/ext/phar/tests/zip/phar_setalias.phpt b/ext/phar/tests/zip/phar_setalias.phpt
index cb60a068d6..96453a90ff 100644
--- a/ext/phar/tests/zip/phar_setalias.phpt
+++ b/ext/phar/tests/zip/phar_setalias.phpt
@@ -25,7 +25,7 @@ $files['b'] = 'b';
$files['c'] = 'c';
foreach ($files as $n => $file) {
- $phar[$n] = $file;
+ $phar[$n] = $file;
}
$phar->stopBuffering();
@@ -46,7 +46,6 @@ $p2->setAlias('unused2');
$p3 = new Phar($fname3);
echo $p3->getAlias(), "\n";
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip');
@@ -59,4 +58,3 @@ hio
test
test
test
-===DONE===
diff --git a/ext/phar/tests/zip/phar_setalias2.phpt b/ext/phar/tests/zip/phar_setalias2.phpt
index 8b63551b04..e438e64bb5 100644
--- a/ext/phar/tests/zip/phar_setalias2.phpt
+++ b/ext/phar/tests/zip/phar_setalias2.phpt
@@ -21,7 +21,7 @@ $files['b'] = 'b';
$files['c'] = 'c';
foreach ($files as $n => $file) {
- $phar[$n] = $file;
+ $phar[$n] = $file;
}
$phar->stopBuffering();
@@ -31,12 +31,11 @@ echo $phar->getAlias() . "\n";
$b = $phar;
$phar = new Phar(__DIR__ . '/notphar.phar');
try {
- $phar->setAlias('test');
+ $phar->setAlias('test');
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip');
@@ -46,4 +45,3 @@ __HALT_COMPILER();
hio
test
alias "test" is already used for archive "%sphar_setalias2.phar.zip" and cannot be used for other archives
-===DONE===
diff --git a/ext/phar/tests/zip/phar_setdefaultstub.phpt b/ext/phar/tests/zip/phar_setdefaultstub.phpt
index 4851a90cae..9b5f395957 100644
--- a/ext/phar/tests/zip/phar_setdefaultstub.phpt
+++ b/ext/phar/tests/zip/phar_setdefaultstub.phpt
@@ -20,10 +20,10 @@ echo "==========================================================================
echo "============================================================================\n";
try {
- $phar->setDefaultStub();
- $phar->stopBuffering();
+ $phar->setDefaultStub();
+ $phar->stopBuffering();
} catch(Exception $e) {
- echo $e->getMessage(). "\n";
+ echo $e->getMessage(). "\n";
}
var_dump($phar->getStub());
@@ -32,10 +32,10 @@ echo "==========================================================================
echo "============================================================================\n";
try {
- $phar->setDefaultStub('my/custom/thingy.php');
- $phar->stopBuffering();
+ $phar->setDefaultStub('my/custom/thingy.php');
+ $phar->stopBuffering();
} catch(Exception $e) {
- echo $e->getMessage(). "\n";
+ echo $e->getMessage(). "\n";
}
var_dump($phar->getStub());
@@ -44,16 +44,15 @@ echo "==========================================================================
echo "============================================================================\n";
try {
- $phar->setDefaultStub('my/custom/thingy.php', 'the/web.php');
- $phar->stopBuffering();
+ $phar->setDefaultStub('my/custom/thingy.php', 'the/web.php');
+ $phar->stopBuffering();
} catch(Exception $e) {
- echo $e->getMessage(). "\n";
+ echo $e->getMessage(). "\n";
}
var_dump($phar->getStub());
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip');
@@ -68,13 +67,12 @@ __HALT_COMPILER();"
============================================================================
============================================================================
-Warning: Phar::setDefaultStub(): method accepts no arguments for a tar- or zip-based phar stub, 1 given in %sphar_setdefaultstub.php on line %d
+Warning: Phar::setDefaultStub(): Method accepts no arguments for a tar- or zip-based phar stub, 1 given in %sphar_setdefaultstub.php on line %d
string(60) "<?php // zip-based phar archive stub file
__HALT_COMPILER();"
============================================================================
============================================================================
-Warning: Phar::setDefaultStub(): method accepts no arguments for a tar- or zip-based phar stub, 2 given in %sphar_setdefaultstub.php on line %d
+Warning: Phar::setDefaultStub(): Method accepts no arguments for a tar- or zip-based phar stub, 2 given in %sphar_setdefaultstub.php on line %d
string(60) "<?php // zip-based phar archive stub file
__HALT_COMPILER();"
-===DONE===
diff --git a/ext/phar/tests/zip/phar_setsignaturealgo2.phpt b/ext/phar/tests/zip/phar_setsignaturealgo2.phpt
index 53f9461c98..84c256ba27 100644
--- a/ext/phar/tests/zip/phar_setsignaturealgo2.phpt
+++ b/ext/phar/tests/zip/phar_setsignaturealgo2.phpt
@@ -63,7 +63,6 @@ var_dump($p->getSignature());
echo $e->getMessage();
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip');
@@ -111,4 +110,3 @@ array(2) {
["hash_type"]=>
string(7) "OpenSSL"
}
-===DONE===
diff --git a/ext/phar/tests/zip/phar_stub.phpt b/ext/phar/tests/zip/phar_stub.phpt
index 197cf409a9..c2c41dc4f1 100644
--- a/ext/phar/tests/zip/phar_stub.phpt
+++ b/ext/phar/tests/zip/phar_stub.phpt
@@ -57,7 +57,6 @@ $phar['testing'] = 'hi';
echo $phar->getStub();
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip.php');
@@ -72,4 +71,3 @@ __HALT_COMPILER();
<?php echo "third stub\n"; __HALT_COMPILER(); ?>booya
<?php echo "third stub\n"; __HALT_COMPILER(); ?>
<?php echo "third stub\n"; __HALT_COMPILER(); ?>
-===DONE===
diff --git a/ext/phar/tests/zip/phar_stub_error.phpt b/ext/phar/tests/zip/phar_stub_error.phpt
index 4bab4c2870..d19393f430 100644
--- a/ext/phar/tests/zip/phar_stub_error.phpt
+++ b/ext/phar/tests/zip/phar_stub_error.phpt
@@ -22,11 +22,11 @@ var_dump($phar->getStub() == $stub);
$newstub = '<?php echo "second stub\n"; _x_HALT_COMPILER(); ?>';
try
{
- $phar->setStub($newstub);
+ $phar->setStub($newstub);
}
catch(exception $e)
{
- echo 'Exception: ' . $e->getMessage() . "\n";
+ echo 'Exception: ' . $e->getMessage() . "\n";
}
var_dump($phar->getStub());
var_dump($phar->getStub() == $stub);
@@ -35,7 +35,6 @@ var_dump($phar->getStub());
var_dump($phar->getStub() == $stub);
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip');
@@ -52,4 +51,3 @@ bool(true)
string(50) "<?php echo "first stub\n"; __HALT_COMPILER(); ?>
"
bool(true)
-===DONE===
diff --git a/ext/phar/tests/zip/refcount1.phpt b/ext/phar/tests/zip/refcount1.phpt
index 14fb3b228a..0fd122a79c 100644
--- a/ext/phar/tests/zip/refcount1.phpt
+++ b/ext/phar/tests/zip/refcount1.phpt
@@ -22,7 +22,7 @@ $files['b.php'] = '<?php echo "This is b\n"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
foreach ($files as $n => $file) {
- $phar[$n] = $file;
+ $phar[$n] = $file;
}
$phar->stopBuffering();
@@ -42,7 +42,6 @@ var_dump(fread($b, 20));
include $alias . '/b/c.php';
?>
-===DONE===
--CLEAN--
<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.zip'); ?>
--EXPECTF--
@@ -65,4 +64,3 @@ object(PharFileInfo)#%d (2) {
}
string(5) "extra"
extra
-===DONE===
diff --git a/ext/phar/tests/zip/rename.phpt b/ext/phar/tests/zip/rename.phpt
index 82e2850927..b3ebc98364 100644
--- a/ext/phar/tests/zip/rename.phpt
+++ b/ext/phar/tests/zip/rename.phpt
@@ -31,4 +31,4 @@ echo file_get_contents($alias . '/a') . "\n";
a
a
-Warning: file_get_contents(phar://%srename.phar.zip/a): failed to open stream: phar error: "a" is not a file in phar "%srename.phar.zip" in %srename.php on line %d
+Warning: file_get_contents(phar://%srename.phar.zip/a): Failed to open stream: phar error: "a" is not a file in phar "%srename.phar.zip" in %srename.php on line %d
diff --git a/ext/phar/tests/zip/rename_dir.phpt b/ext/phar/tests/zip/rename_dir.phpt
index a65113c3cf..b53ff8d964 100644
--- a/ext/phar/tests/zip/rename_dir.phpt
+++ b/ext/phar/tests/zip/rename_dir.phpt
@@ -31,4 +31,4 @@ echo file_get_contents($alias . '/a/x') . "\n";
a
a
-Warning: file_get_contents(phar://%srename_dir.phar.zip/a/x): failed to open stream: phar error: "a/x" is not a file in phar "%srename_dir.phar.zip" in %srename_dir.php on line %d
+Warning: file_get_contents(phar://%srename_dir.phar.zip/a/x): Failed to open stream: phar error: "a/x" is not a file in phar "%srename_dir.phar.zip" in %srename_dir.php on line %d
diff --git a/ext/phar/tests/zip/unixzip.phpt b/ext/phar/tests/zip/unixzip.phpt
index 371c34e0c7..f1a51fede8 100644
--- a/ext/phar/tests/zip/unixzip.phpt
+++ b/ext/phar/tests/zip/unixzip.phpt
@@ -6,18 +6,17 @@ Phar: test a zip archive created by unix "zip" command
<?php
$a = new PharData(__DIR__ . '/files/zip.zip');
foreach ($a as $b) {
- if ($b->isDir()) {
- echo "dir " . $b->getPathName() . "\n";
- } else {
- echo $b->getPathName(), "\n";
- echo file_get_contents($b->getPathName()), "\n";
- }
+ if ($b->isDir()) {
+ echo "dir " . $b->getPathName() . "\n";
+ } else {
+ echo $b->getPathName(), "\n";
+ echo file_get_contents($b->getPathName()), "\n";
+ }
}
if (isset($a['notempty/hi.txt'])) {
- echo $a['notempty/hi.txt']->getPathName() . "\n";
+ echo $a['notempty/hi.txt']->getPathName() . "\n";
}
?>
-===DONE===
--EXPECTF--
dir phar://%s/zip.zip%cempty
phar://%s/zip.zip%chi.txt
@@ -25,4 +24,3 @@ hi there
dir phar://%s/zip.zip%cnotempty
phar://%s/zip.zip/notempty%chi.txt
-===DONE===
diff --git a/ext/phar/tests/zip/zlib.phpt b/ext/phar/tests/zip/zlib.phpt
index 1e66e99937..96b63e73a6 100644
--- a/ext/phar/tests/zip/zlib.phpt
+++ b/ext/phar/tests/zip/zlib.phpt
@@ -6,13 +6,11 @@ Phar: process zlib-compressed zip alias
--FILE--
<?php
try {
- $a = new Phar(__DIR__ . '/files/zlib_alias.phar.zip');
- var_dump($a->getAlias());
+ $a = new Phar(__DIR__ . '/files/zlib_alias.phar.zip');
+ var_dump($a->getAlias());
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--EXPECT--
string(175) "hitheresuperlongzipistoostupidtodowhatIsaysoIhavetousethisridiculouslylongaliasbecauseitisstupiddidImentionthatalreadythemadnessdoesnotstopIhateinfozipIhateinfozipIhateinfozip"
-===DONE===
diff --git a/ext/posix/php_posix.h b/ext/posix/php_posix.h
index 17d8b038c2..3f99c1af5f 100644
--- a/ext/posix/php_posix.h
+++ b/ext/posix/php_posix.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/posix/posix.c b/ext/posix/posix.c
index 98dae1ca3c..2d1337eee8 100644
--- a/ext/posix/posix.c
+++ b/ext/posix/posix.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -25,7 +23,7 @@
#include "ext/standard/info.h"
#include "ext/standard/php_string.h"
#include "php_posix.h"
-
+#include "posix_arginfo.h"
#if HAVE_POSIX
@@ -52,172 +50,6 @@
ZEND_DECLARE_MODULE_GLOBALS(posix)
static PHP_MINFO_FUNCTION(posix);
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_kill, 0, 0, 2)
- ZEND_ARG_INFO(0, pid)
- ZEND_ARG_INFO(0, sig)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_posix_getpid, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_posix_getppid, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_posix_getuid, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_setuid, 0, 0, 1)
- ZEND_ARG_INFO(0, uid)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_posix_geteuid, 0)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_SETEUID
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_seteuid, 0, 0, 1)
- ZEND_ARG_INFO(0, uid)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO(arginfo_posix_getgid, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_setgid, 0, 0, 1)
- ZEND_ARG_INFO(0, gid)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_posix_getegid, 0)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_SETEGID
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_setegid, 0, 0, 1)
- ZEND_ARG_INFO(0, gid)
-ZEND_END_ARG_INFO()
-#endif
-
-#ifdef HAVE_GETGROUPS
-ZEND_BEGIN_ARG_INFO(arginfo_posix_getgroups, 0)
-ZEND_END_ARG_INFO()
-#endif
-
-#ifdef HAVE_GETLOGIN
-ZEND_BEGIN_ARG_INFO(arginfo_posix_getlogin, 0)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO(arginfo_posix_getpgrp, 0)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_SETSID
-ZEND_BEGIN_ARG_INFO(arginfo_posix_setsid, 0)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_setpgid, 0, 0, 2)
- ZEND_ARG_INFO(0, pid)
- ZEND_ARG_INFO(0, pgid)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_GETPGID
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_getpgid, 0, 0, 1)
- ZEND_ARG_INFO(0, pid)
-ZEND_END_ARG_INFO()
-#endif
-
-#ifdef HAVE_GETSID
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_getsid, 0, 0, 1)
- ZEND_ARG_INFO(0, pid)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO(arginfo_posix_uname, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_posix_times, 0)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_CTERMID
-ZEND_BEGIN_ARG_INFO(arginfo_posix_ctermid, 0)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_ttyname, 0, 0, 1)
- ZEND_ARG_INFO(0, fd)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_isatty, 0, 0, 1)
- ZEND_ARG_INFO(0, fd)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_posix_getcwd, 0)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_MKFIFO
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_mkfifo, 0, 0, 2)
- ZEND_ARG_INFO(0, pathname)
- ZEND_ARG_INFO(0, mode)
-ZEND_END_ARG_INFO()
-#endif
-
-#ifdef HAVE_MKNOD
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_mknod, 0, 0, 2)
- ZEND_ARG_INFO(0, pathname)
- ZEND_ARG_INFO(0, mode)
- ZEND_ARG_INFO(0, major)
- ZEND_ARG_INFO(0, minor)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_access, 0, 0, 1)
- ZEND_ARG_INFO(0, file)
- ZEND_ARG_INFO(0, mode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_getgrnam, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_getgrgid, 0, 0, 1)
- ZEND_ARG_INFO(0, gid)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_getpwnam, 0, 0, 1)
- ZEND_ARG_INFO(0, username)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_getpwuid, 0, 0, 1)
- ZEND_ARG_INFO(0, uid)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_GETRLIMIT
-ZEND_BEGIN_ARG_INFO(arginfo_posix_getrlimit, 0)
-ZEND_END_ARG_INFO()
-#endif
-
-#ifdef HAVE_SETRLIMIT
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_setrlimit, 0, 0, 3)
- ZEND_ARG_INFO(0, resource)
- ZEND_ARG_INFO(0, softlimit)
- ZEND_ARG_INFO(0, hardlimit)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO(arginfo_posix_get_last_error, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_strerror, 0, 0, 1)
- ZEND_ARG_INFO(0, errno)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_INITGROUPS
-ZEND_BEGIN_ARG_INFO_EX(arginfo_posix_initgroups, 0, 0, 2)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, base_group_id)
-ZEND_END_ARG_INFO()
-#endif
-/* }}} */
-
/* {{{ posix_functions[]
*/
static const zend_function_entry posix_functions[] = {
@@ -302,7 +134,7 @@ static const zend_function_entry posix_functions[] = {
#endif
PHP_FE(posix_get_last_error, arginfo_posix_get_last_error)
- PHP_FALIAS(posix_errno, posix_get_last_error, arginfo_posix_get_last_error)
+ PHP_FALIAS(posix_errno, posix_get_last_error, arginfo_posix_errno)
PHP_FE(posix_strerror, arginfo_posix_strerror)
#ifdef HAVE_INITGROUPS
PHP_FE(posix_initgroups, arginfo_posix_initgroups)
@@ -436,17 +268,15 @@ ZEND_TSRMLS_CACHE_DEFINE()
ZEND_GET_MODULE(posix)
#endif
-#define PHP_POSIX_NO_ARGS if (zend_parse_parameters_none() == FAILURE) return;
-
#define PHP_POSIX_RETURN_LONG_FUNC(func_name) \
- PHP_POSIX_NO_ARGS \
+ ZEND_PARSE_PARAMETERS_NONE(); \
RETURN_LONG(func_name());
#define PHP_POSIX_SINGLE_ARG_FUNC(func_name) \
zend_long val; \
ZEND_PARSE_PARAMETERS_START(1, 1) \
Z_PARAM_LONG(val) \
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); \
+ ZEND_PARSE_PARAMETERS_END(); \
if (func_name(val) < 0) { \
POSIX_G(last_error) = errno; \
RETURN_FALSE; \
@@ -463,7 +293,7 @@ PHP_FUNCTION(posix_kill)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_LONG(pid)
Z_PARAM_LONG(sig)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (kill(pid, sig) < 0) {
POSIX_G(last_error) = errno;
@@ -567,7 +397,7 @@ PHP_FUNCTION(posix_getgroups)
int result;
int i;
- PHP_POSIX_NO_ARGS;
+ ZEND_PARSE_PARAMETERS_NONE();
if ((result = getgroups(NGROUPS_MAX, gidlist)) < 0) {
POSIX_G(last_error) = errno;
@@ -590,7 +420,7 @@ PHP_FUNCTION(posix_getlogin)
{
char *p;
- PHP_POSIX_NO_ARGS;
+ ZEND_PARSE_PARAMETERS_NONE();
if (NULL == (p = getlogin())) {
POSIX_G(last_error) = errno;
@@ -629,7 +459,7 @@ PHP_FUNCTION(posix_setpgid)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_LONG(pid)
Z_PARAM_LONG(pgid)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (setpgid(pid, pgid) < 0) {
POSIX_G(last_error) = errno;
@@ -649,7 +479,7 @@ PHP_FUNCTION(posix_getpgid)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_LONG(val)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if ((val = getpgid(val)) < 0) {
POSIX_G(last_error) = errno;
@@ -669,7 +499,7 @@ PHP_FUNCTION(posix_getsid)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_LONG(val)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if ((val = getsid(val)) < 0) {
POSIX_G(last_error) = errno;
@@ -686,7 +516,7 @@ PHP_FUNCTION(posix_uname)
{
struct utsname u;
- PHP_POSIX_NO_ARGS;
+ ZEND_PARSE_PARAMETERS_NONE();
if (uname(&u) < 0) {
POSIX_G(last_error) = errno;
@@ -718,7 +548,7 @@ PHP_FUNCTION(posix_times)
struct tms t;
clock_t ticks;
- PHP_POSIX_NO_ARGS;
+ ZEND_PARSE_PARAMETERS_NONE();
if ((ticks = times(&t)) == -1) {
POSIX_G(last_error) = errno;
@@ -746,7 +576,7 @@ PHP_FUNCTION(posix_ctermid)
{
char buffer[L_ctermid];
- PHP_POSIX_NO_ARGS;
+ ZEND_PARSE_PARAMETERS_NONE();
if (NULL == ctermid(buffer)) {
/* Found no documentation how the defined behaviour is when this
@@ -769,7 +599,6 @@ static int php_posix_stream_get_fd(zval *zfp, int *fd) /* {{{ */
php_stream_from_zval_no_verify(stream, zfp);
if (stream == NULL) {
- php_error_docref(NULL, E_WARNING, "expects argument 1 to be a valid stream resource");
return 0;
}
if (php_stream_can_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT) == SUCCESS) {
@@ -777,7 +606,7 @@ static int php_posix_stream_get_fd(zval *zfp, int *fd) /* {{{ */
} else if (php_stream_can_cast(stream, PHP_STREAM_AS_FD) == SUCCESS) {
php_stream_cast(stream, PHP_STREAM_AS_FD, (void*)fd, 0);
} else {
- php_error_docref(NULL, E_WARNING, "could not use stream of type '%s'",
+ php_error_docref(NULL, E_WARNING, "Could not use stream of type '%s'",
stream->ops->label);
return 0;
}
@@ -798,7 +627,7 @@ PHP_FUNCTION(posix_ttyname)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_ZVAL(z_fd)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
switch (Z_TYPE_P(z_fd)) {
case IS_RESOURCE:
@@ -842,7 +671,7 @@ PHP_FUNCTION(posix_isatty)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_ZVAL(z_fd)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
switch (Z_TYPE_P(z_fd)) {
case IS_RESOURCE:
@@ -878,7 +707,7 @@ PHP_FUNCTION(posix_getcwd)
char buffer[MAXPATHLEN];
char *p;
- PHP_POSIX_NO_ARGS;
+ ZEND_PARSE_PARAMETERS_NONE();
p = VCWD_GETCWD(buffer, MAXPATHLEN);
if (!p) {
@@ -908,7 +737,7 @@ PHP_FUNCTION(posix_mkfifo)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_PATH_STR(path)
Z_PARAM_LONG(mode)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (php_check_open_basedir_ex(ZSTR_VAL(path), 0)) {
RETURN_FALSE;
@@ -942,7 +771,7 @@ PHP_FUNCTION(posix_mknod)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(major)
Z_PARAM_LONG(minor)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (php_check_open_basedir_ex(ZSTR_VAL(path), 0)) {
RETURN_FALSE;
@@ -1033,7 +862,7 @@ PHP_FUNCTION(posix_access)
Z_PARAM_PATH(filename, filename_len)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(mode)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
path = expand_filepath(filename, NULL);
if (!path) {
@@ -1081,7 +910,7 @@ PHP_FUNCTION(posix_getgrnam)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_STRING(name, name_len)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
#if defined(ZTS) && defined(HAVE_GETGRNAM_R) && defined(_SC_GETGR_R_SIZE_MAX)
buflen = sysconf(_SC_GETGR_R_SIZE_MAX);
@@ -1112,7 +941,7 @@ try_again:
if (!php_posix_group_to_array(g, return_value)) {
zend_array_destroy(Z_ARR_P(return_value));
- php_error_docref(NULL, E_WARNING, "unable to convert posix group to array");
+ php_error_docref(NULL, E_WARNING, "Unable to convert posix group to array");
RETVAL_FALSE;
}
#if defined(ZTS) && defined(HAVE_GETGRNAM_R) && defined(_SC_GETGR_R_SIZE_MAX)
@@ -1137,7 +966,7 @@ PHP_FUNCTION(posix_getgrgid)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_LONG(gid)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
#if defined(ZTS) && defined(HAVE_GETGRGID_R) && defined(_SC_GETGR_R_SIZE_MAX)
@@ -1165,7 +994,7 @@ PHP_FUNCTION(posix_getgrgid)
if (!php_posix_group_to_array(g, return_value)) {
zend_array_destroy(Z_ARR_P(return_value));
- php_error_docref(NULL, E_WARNING, "unable to convert posix group struct to array");
+ php_error_docref(NULL, E_WARNING, "Unable to convert posix group struct to array");
RETVAL_FALSE;
}
#if defined(ZTS) && defined(HAVE_GETGRGID_R) && defined(_SC_GETGR_R_SIZE_MAX)
@@ -1207,7 +1036,7 @@ PHP_FUNCTION(posix_getpwnam)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_STRING(name, name_len)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
#if defined(ZTS) && defined(_SC_GETPW_R_SIZE_MAX) && defined(HAVE_GETPWNAM_R)
buflen = sysconf(_SC_GETPW_R_SIZE_MAX);
@@ -1232,7 +1061,7 @@ PHP_FUNCTION(posix_getpwnam)
if (!php_posix_passwd_to_array(pw, return_value)) {
zend_array_destroy(Z_ARR_P(return_value));
- php_error_docref(NULL, E_WARNING, "unable to convert posix passwd struct to array");
+ php_error_docref(NULL, E_WARNING, "Unable to convert posix passwd struct to array");
RETVAL_FALSE;
}
#if defined(ZTS) && defined(_SC_GETPW_R_SIZE_MAX) && defined(HAVE_GETPWNAM_R)
@@ -1257,7 +1086,7 @@ PHP_FUNCTION(posix_getpwuid)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_LONG(uid)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
#if defined(ZTS) && defined(_SC_GETPW_R_SIZE_MAX) && defined(HAVE_GETPWUID_R)
pwbuflen = sysconf(_SC_GETPW_R_SIZE_MAX);
@@ -1283,7 +1112,7 @@ PHP_FUNCTION(posix_getpwuid)
if (!php_posix_passwd_to_array(pw, return_value)) {
zend_array_destroy(Z_ARR_P(return_value));
- php_error_docref(NULL, E_WARNING, "unable to convert posix passwd struct to array");
+ php_error_docref(NULL, E_WARNING, "Unable to convert posix passwd struct to array");
RETVAL_FALSE;
}
#if defined(ZTS) && defined(_SC_GETPW_R_SIZE_MAX) && defined(HAVE_GETPWUID_R)
@@ -1395,7 +1224,7 @@ PHP_FUNCTION(posix_getrlimit)
{
const struct limitlist *l = NULL;
- PHP_POSIX_NO_ARGS;
+ ZEND_PARSE_PARAMETERS_NONE();
array_init(return_value);
@@ -1422,7 +1251,7 @@ PHP_FUNCTION(posix_setrlimit)
Z_PARAM_LONG(res)
Z_PARAM_LONG(cur)
Z_PARAM_LONG(max)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
rl.rlim_cur = cur;
rl.rlim_max = max;
@@ -1443,7 +1272,7 @@ PHP_FUNCTION(posix_setrlimit)
Retrieve the error number set by the last posix function which failed. */
PHP_FUNCTION(posix_get_last_error)
{
- PHP_POSIX_NO_ARGS;
+ ZEND_PARSE_PARAMETERS_NONE();
RETURN_LONG(POSIX_G(last_error));
}
@@ -1457,7 +1286,7 @@ PHP_FUNCTION(posix_strerror)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_LONG(error)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
RETURN_STRING(strerror(error));
}
@@ -1477,7 +1306,7 @@ PHP_FUNCTION(posix_initgroups)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_STRING(name, name_len)
Z_PARAM_LONG(basegid)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (name_len == 0) {
RETURN_FALSE;
diff --git a/ext/posix/posix.stub.php b/ext/posix/posix.stub.php
new file mode 100644
index 0000000000..008d35f689
--- /dev/null
+++ b/ext/posix/posix.stub.php
@@ -0,0 +1,102 @@
+<?php
+
+function posix_kill(int $pid, int $sig): bool {}
+
+function posix_getpid(): int {}
+
+function posix_getppid(): int {}
+
+function posix_getuid(): int {}
+
+function posix_setuid(int $uid): bool {}
+
+function posix_geteuid(): int {}
+
+#ifdef HAVE_SETEUID
+function posix_seteuid(int $uid): bool {}
+#endif
+
+function posix_getgid(): int {}
+
+function posix_setgid(int $gid): bool {}
+
+function posix_getegid(): int {}
+
+#ifdef HAVE_SETEGID
+function posix_setegid(int $gid): bool {}
+#endif
+
+#ifdef HAVE_GETGROUPS
+function posix_getgroups(): array|false {}
+#endif
+
+#ifdef HAVE_GETLOGIN
+function posix_getlogin(): string|false {}
+#endif
+
+function posix_getpgrp(): int {}
+
+#ifdef HAVE_SETSID
+function posix_setsid(): int {}
+#endif
+
+function posix_setpgid(int $pid, int $pgid): bool {}
+
+#ifdef HAVE_GETPGID
+function posix_getpgid(int $pid): int|false {}
+#endif
+
+#ifdef HAVE_GETSID
+function posix_getsid(int $pid): int|false {}
+#endif
+
+function posix_uname(): array|false {}
+
+function posix_times(): array|false {}
+
+
+#ifdef HAVE_CTERMID
+function posix_ctermid(): string|false {}
+#endif
+
+function posix_ttyname($fd): string|false {}
+
+function posix_isatty($fd): bool {}
+
+function posix_getcwd(): string|false {}
+
+#ifdef HAVE_MKFIFO
+function posix_mkfifo(string $pathname, int $mode): bool {}
+#endif
+
+#ifdef HAVE_MKNOD
+function posix_mknod(string $pathname, int $mode, int $major = 0, int $minor = 0): bool {}
+#endif
+
+function posix_access(string $file, int $mode = 0): bool {}
+
+function posix_getgrnam(string $name): array|false {}
+
+function posix_getgrgid(int $gid): array|false {}
+
+function posix_getpwnam(string $username): array|false {}
+
+function posix_getpwuid(int $uid): array|false {}
+
+#ifdef HAVE_GETRLIMIT
+function posix_getrlimit(): array|false {}
+#endif
+
+#ifdef HAVE_SETRLIMIT
+function posix_setrlimit(int $resource, int $softlimit, int $hardlimit): bool {}
+#endif
+
+function posix_get_last_error(): int {}
+
+function posix_errno(): int {}
+
+function posix_strerror(int $errno): string {}
+
+#ifdef HAVE_INITGROUPS
+function posix_initgroups(string $name, int $base_group_id): bool {}
+#endif
diff --git a/ext/posix/posix_arginfo.h b/ext/posix/posix_arginfo.h
new file mode 100644
index 0000000000..8997b409bf
--- /dev/null
+++ b/ext/posix/posix_arginfo.h
@@ -0,0 +1,159 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_kill, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, pid, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, sig, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_getpid, 0, 0, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_posix_getppid arginfo_posix_getpid
+
+#define arginfo_posix_getuid arginfo_posix_getpid
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_setuid, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, uid, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_posix_geteuid arginfo_posix_getpid
+
+#if defined(HAVE_SETEUID)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_seteuid, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, uid, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#define arginfo_posix_getgid arginfo_posix_getpid
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_setgid, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, gid, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_posix_getegid arginfo_posix_getpid
+
+#if defined(HAVE_SETEGID)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_setegid, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, gid, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_GETGROUPS)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_posix_getgroups, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_GETLOGIN)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_posix_getlogin, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
+ZEND_END_ARG_INFO()
+#endif
+
+#define arginfo_posix_getpgrp arginfo_posix_getpid
+
+#if defined(HAVE_SETSID)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_setsid, 0, 0, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_setpgid, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, pid, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, pgid, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_GETPGID)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_posix_getpgid, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, pid, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_GETSID)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_posix_getsid, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, pid, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_posix_uname, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE)
+ZEND_END_ARG_INFO()
+
+#define arginfo_posix_times arginfo_posix_uname
+
+#if defined(HAVE_CTERMID)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_posix_ctermid, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_posix_ttyname, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, fd)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_isatty, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, fd)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_posix_getcwd, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_MKFIFO)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_mkfifo, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, pathname, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_MKNOD)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_mknod, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, pathname, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, major, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, minor, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_access, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, file, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_posix_getgrnam, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_posix_getgrgid, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, gid, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_posix_getpwnam, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, username, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_posix_getpwuid, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, uid, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_GETRLIMIT)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_posix_getrlimit, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_SETRLIMIT)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_setrlimit, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, resource, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, softlimit, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, hardlimit, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#define arginfo_posix_get_last_error arginfo_posix_getpid
+
+#define arginfo_posix_errno arginfo_posix_getpid
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_strerror, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, errno, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_INITGROUPS)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_initgroups, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, base_group_id, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
diff --git a/ext/posix/tests/bug75696.phpt b/ext/posix/tests/bug75696.phpt
index e37f8077ce..022e781b4e 100644
--- a/ext/posix/tests/bug75696.phpt
+++ b/ext/posix/tests/bug75696.phpt
@@ -11,7 +11,5 @@ $name = posix_getgrgid($gid)['name'];
$info = posix_getgrnam($name);
var_dump(is_array($info));
?>
-===DONE===
--EXPECT--
bool(true)
-===DONE===
diff --git a/ext/posix/tests/posix_ctermid.phpt b/ext/posix/tests/posix_ctermid.phpt
index ccf850d776..1d277659c4 100644
--- a/ext/posix/tests/posix_ctermid.phpt
+++ b/ext/posix/tests/posix_ctermid.phpt
@@ -20,7 +20,5 @@ PHP Testfest Berlin 2009-05-10
<?php
var_dump(posix_ctermid());
?>
-===DONE===
--EXPECTF--
string(%d) "%s"
-===DONE===
diff --git a/ext/posix/tests/posix_errno_error.phpt b/ext/posix/tests/posix_errno_error.phpt
deleted file mode 100644
index 0a77fb0009..0000000000
--- a/ext/posix/tests/posix_errno_error.phpt
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-Test function posix_errno() by calling it with its expected arguments
---SKIPIF--
-<?php
- if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
-?>
---CREDITS--
-Morten Amundsen mor10am@gmail.com
-Francesco Fullone ff@ideato.it
-#PHPTestFest Cesena Italia on 2009-06-20
---FILE--
-<?php
-
-echo "*** Test by calling method or function with more than expected arguments ***\n";
-
-// test without any error
-var_dump(posix_errno('bar'));
-
-?>
---EXPECTF--
-*** Test by calling method or function with more than expected arguments ***
-
-Warning: posix_errno() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
diff --git a/ext/posix/tests/posix_getcwd.phpt b/ext/posix/tests/posix_getcwd.phpt
index 20f7b0372e..f6f180925a 100644
--- a/ext/posix/tests/posix_getcwd.phpt
+++ b/ext/posix/tests/posix_getcwd.phpt
@@ -9,11 +9,7 @@ if (!function_exists('posix_getcwd')) die('skip posix_getcwd() not found');
<?php
var_dump(posix_getcwd());
-var_dump(posix_getcwd(1));
?>
--EXPECTF--
string(%d) "%s"
-
-Warning: posix_getcwd() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
diff --git a/ext/posix/tests/posix_getgrgid.phpt b/ext/posix/tests/posix_getgrgid.phpt
index 0209d09732..b10c77a693 100644
--- a/ext/posix/tests/posix_getgrgid.phpt
+++ b/ext/posix/tests/posix_getgrgid.phpt
@@ -39,7 +39,5 @@ if (!isset($grp['gid'])) {
}
var_dump($grp['gid']);
?>
-===DONE===
--EXPECT--
int(0)
-===DONE===
diff --git a/ext/posix/tests/posix_getgrgid_basic.phpt b/ext/posix/tests/posix_getgrgid_basic.phpt
index 61ec8ab0fc..e630ea852e 100644
--- a/ext/posix/tests/posix_getgrgid_basic.phpt
+++ b/ext/posix/tests/posix_getgrgid_basic.phpt
@@ -6,7 +6,7 @@ Test posix_getgrgid() function : basic functionality
?>
--FILE--
<?php
- echo "Basic test of POSIX getgid and getgrid fucntions\n";
+ echo "Basic test of POSIX getgid and getgrid functions\n";
$gid = posix_getgid();
$groupinfo = posix_getgrgid($gid);
@@ -14,9 +14,8 @@ Test posix_getgrgid() function : basic functionality
print_r($groupinfo);
?>
-===DONE===
--EXPECTF--
-Basic test of POSIX getgid and getgrid fucntions
+Basic test of POSIX getgid and getgrid functions
Array
(
[name] => %s
@@ -26,4 +25,3 @@ Array
[gid] => %d
)
-===DONE===
diff --git a/ext/posix/tests/posix_getgrgid_error.phpt b/ext/posix/tests/posix_getgrgid_error.phpt
index ef7fa57a9d..e9dbe2a6ce 100644
--- a/ext/posix/tests/posix_getgrgid_error.phpt
+++ b/ext/posix/tests/posix_getgrgid_error.phpt
@@ -14,17 +14,6 @@ Test posix_getgrgid() function : error conditions
echo "*** Testing posix_getgrgid() : error conditions ***\n";
-// Zero arguments
-echo "\n-- Testing posix_getgrgid() function with Zero arguments --\n";
-var_dump( posix_getgrgid() );
-
-//Test posix_getgrgid with one more than the expected number of arguments
-echo "\n-- Testing posix_getgrgid() function with more than expected no. of arguments --\n";
-
-$extra_arg = 10;
-$gid = 0;
-var_dump( posix_getgrgid($gid, $extra_arg) );
-
echo "\n-- Testing posix_getgrgid() function with a negative group id --\n";
$gid = -999;
var_dump( posix_getgrgid($gid));
@@ -34,16 +23,6 @@ echo "Done";
--EXPECTF--
*** Testing posix_getgrgid() : error conditions ***
--- Testing posix_getgrgid() function with Zero arguments --
-
-Warning: posix_getgrgid() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
--- Testing posix_getgrgid() function with more than expected no. of arguments --
-
-Warning: posix_getgrgid() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
-
-- Testing posix_getgrgid() function with a negative group id --
bool(false)
Done
diff --git a/ext/posix/tests/posix_getgrgid_macosx.phpt b/ext/posix/tests/posix_getgrgid_macosx.phpt
index f9e6cc1d53..ff1858f7bf 100644
--- a/ext/posix/tests/posix_getgrgid_macosx.phpt
+++ b/ext/posix/tests/posix_getgrgid_macosx.phpt
@@ -17,7 +17,5 @@ if (strtolower(PHP_OS) != 'darwin') {
$grp = posix_getgrgid(-1);
var_dump($grp['name']);
?>
-===DONE===
--EXPECT--
string(7) "nogroup"
-===DONE===
diff --git a/ext/posix/tests/posix_getgroups_basic.phpt b/ext/posix/tests/posix_getgroups_basic.phpt
index dd17fd447f..7a877d7663 100644
--- a/ext/posix/tests/posix_getgroups_basic.phpt
+++ b/ext/posix/tests/posix_getgroups_basic.phpt
@@ -11,14 +11,12 @@ Test posix_getgroups() function : basic functionality
$groups = posix_getgroups();
if (!is_array($groups)) {
- echo "TEST FAILED - array result expected\n";
+ echo "TEST FAILED - array result expected\n";
} else {
- echo "TEST PASSED\n";
+ echo "TEST PASSED\n";
}
?>
-===DONE===
--EXPECT--
Basic test of POSIX getgroups
TEST PASSED
-===DONE===
diff --git a/ext/posix/tests/posix_getpgid_error.phpt b/ext/posix/tests/posix_getpgid_error.phpt
index 88d68554ee..19e306b2ee 100644
--- a/ext/posix/tests/posix_getpgid_error.phpt
+++ b/ext/posix/tests/posix_getpgid_error.phpt
@@ -16,14 +16,6 @@ if((!extension_loaded("posix")) || (!function_exists("posix_getpgid"))) {
echo "*** Testing posix_getpgid() : error conditions ***\n";
-echo "\n-- Testing posix_getpgid() function no arguments --\n";
-var_dump( posix_getpgid() );
-
-echo "\n-- Testing posix_getpgid() with one extra argument --\n";
-$pid = 10;
-$extra_arg = 20;
-var_dump( posix_getpgid($pid, $extra_arg) );
-
echo "\n-- Testing posix_getpgid() with negative pid --\n";
$pid = -99;
var_dump( posix_getpgid($pid) );
@@ -33,16 +25,6 @@ echo "Done";
--EXPECTF--
*** Testing posix_getpgid() : error conditions ***
--- Testing posix_getpgid() function no arguments --
-
-Warning: posix_getpgid() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
--- Testing posix_getpgid() with one extra argument --
-
-Warning: posix_getpgid() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
-
-- Testing posix_getpgid() with negative pid --
bool(false)
Done
diff --git a/ext/posix/tests/posix_getpwuid_error.phpt b/ext/posix/tests/posix_getpwuid_error.phpt
index 440edf6a76..365033b689 100644
--- a/ext/posix/tests/posix_getpwuid_error.phpt
+++ b/ext/posix/tests/posix_getpwuid_error.phpt
@@ -14,14 +14,6 @@ Test posix_getpwuid() function : error conditions
echo "*** Testing posix_getpwuid() : error conditions ***\n";
-echo "\n-- Testing posix_getpwuid() function with Zero arguments --\n";
-var_dump( posix_getpwuid() );
-
-echo "\n-- Testing posix_getpwuid() function with more than expected no. of arguments --\n";
-$uid = posix_getuid();
-$extra_arg = 10;
-var_dump( posix_getpwuid($uid, $extra_arg) );
-
echo "\n-- Testing posix_getpwuid() function negative uid --\n";
$uid = -99;
var_dump( posix_getpwuid($uid) );
@@ -31,16 +23,6 @@ echo "Done";
--EXPECTF--
*** Testing posix_getpwuid() : error conditions ***
--- Testing posix_getpwuid() function with Zero arguments --
-
-Warning: posix_getpwuid() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
--- Testing posix_getpwuid() function with more than expected no. of arguments --
-
-Warning: posix_getpwuid() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
-
-- Testing posix_getpwuid() function negative uid --
bool(false)
Done
diff --git a/ext/posix/tests/posix_getsid.phpt b/ext/posix/tests/posix_getsid.phpt
index 6f707d067f..c538f61d7e 100644
--- a/ext/posix/tests/posix_getsid.phpt
+++ b/ext/posix/tests/posix_getsid.phpt
@@ -19,10 +19,8 @@ echo "\n-- Testing posix_getsid() function with current process pid --\n";
var_dump( is_long(posix_getsid($pid)) );
?>
-===DONE===
--EXPECT--
*** Testing posix_getsid() : function test ***
-- Testing posix_getsid() function with current process pid --
bool(true)
-===DONE===
diff --git a/ext/posix/tests/posix_getsid_error.phpt b/ext/posix/tests/posix_getsid_error.phpt
index 6013a40b96..8e05a23496 100644
--- a/ext/posix/tests/posix_getsid_error.phpt
+++ b/ext/posix/tests/posix_getsid_error.phpt
@@ -13,16 +13,7 @@ PHP Testfest Berlin 2009-05-10
?>
--FILE--
<?php
-var_dump( posix_getsid() );
-var_dump( posix_getsid(array()) );
var_dump( posix_getsid(-1) );
?>
-===DONE===
--EXPECTF--
-Warning: posix_getsid() expects exactly 1 parameter, 0 given in %s on line %d
bool(false)
-
-Warning: posix_getsid() expects parameter 1 to be int, array given in %s on line %d
-bool(false)
-bool(false)
-===DONE===
diff --git a/ext/posix/tests/posix_initgroups.phpt b/ext/posix/tests/posix_initgroups.phpt
index 5b0ec8adad..20cf8cef8b 100644
--- a/ext/posix/tests/posix_initgroups.phpt
+++ b/ext/posix/tests/posix_initgroups.phpt
@@ -8,11 +8,8 @@ if (!function_exists('posix_initgroups')) die('skip posix_initgroups() not found
--FILE--
<?php
-var_dump(posix_initgroups('foo', 'bar'));
var_dump(posix_initgroups(NULL, NULL));
?>
--EXPECTF--
-Warning: posix_initgroups() expects parameter 2 to be int, string given in %s on line %d
-bool(false)
bool(false)
diff --git a/ext/posix/tests/posix_kill_basic.phpt b/ext/posix/tests/posix_kill_basic.phpt
index 4ce50ca497..6e48ebed3b 100644
--- a/ext/posix/tests/posix_kill_basic.phpt
+++ b/ext/posix/tests/posix_kill_basic.phpt
@@ -8,24 +8,24 @@ Test posix_kill(), posix_get_last_error and posix_strerror() functions : basic f
<?php
echo "Basic test of POSIX getpgid(), kill(), get_last_error() and strerror() functions\n";
- // Don't rely on PCNTL extension being around
- $SIGKILL = 9;
+ // Don't rely on PCNTL extension being around
+ $SIGKILL = 9;
- // TODO Once we have PS open working beef up this test to create a process and kill it
- // for now start at a low pid and find first pid which does not exist.
- $pid = 999;
- do {
- $pid += 1;
- $result = shell_exec("ps -p " . $pid);
- } while (stripos($result, (string)$pid) != FALSE);
+ // TODO Once we have PS open working beef up this test to create a process and kill it
+ // for now start at a low pid and find first pid which does not exist.
+ $pid = 999;
+ do {
+ $pid += 1;
+ $result = shell_exec("ps -p " . $pid);
+ } while (stripos($result, (string)$pid) != FALSE);
- echo "Kill pid=" . $pid . "\n";
- var_dump(posix_kill($pid,$SIGKILL));
+ echo "Kill pid=" . $pid . "\n";
+ var_dump(posix_kill($pid,$SIGKILL));
- $errno = posix_get_last_error();
+ $errno = posix_get_last_error();
- var_dump($errno);
- var_dump(posix_strerror($errno));
+ var_dump($errno);
+ var_dump(posix_strerror($errno));
?>
===DONE====
diff --git a/ext/posix/tests/posix_kill_error.phpt b/ext/posix/tests/posix_kill_error.phpt
index 0c8f6ef642..89474c4994 100644
--- a/ext/posix/tests/posix_kill_error.phpt
+++ b/ext/posix/tests/posix_kill_error.phpt
@@ -16,16 +16,6 @@ Test posix_kill() function : error conditions
echo "*** Testing posix_kill() : error conditions ***\n";
-echo "\n-- Testing posix_kill() function with more than expected no. of arguments --\n";
-$pid = posix_getpid();
-$sig = 9;
-$extra_arg = 10;
-var_dump( posix_kill($pid, $sig, $extra_arg) );
-
-echo "\n-- Testing posix_kill() function with less than expected no. of arguments --\n";
-$pid = posix_getpid();
-var_dump( posix_kill($pid) );
-
echo "\n-- Testing posix_kill() function with invalid signal --\n";
$pid = posix_getpid();
$sig = 999;
@@ -41,16 +31,6 @@ echo "Done";
--EXPECTF--
*** Testing posix_kill() : error conditions ***
--- Testing posix_kill() function with more than expected no. of arguments --
-
-Warning: posix_kill() expects exactly 2 parameters, 3 given in %s on line %d
-bool(false)
-
--- Testing posix_kill() function with less than expected no. of arguments --
-
-Warning: posix_kill() expects exactly 2 parameters, 1 given in %s on line %d
-bool(false)
-
-- Testing posix_kill() function with invalid signal --
bool(false)
diff --git a/ext/posix/tests/posix_seteuid_variation4.phpt b/ext/posix/tests/posix_seteuid_variation4.phpt
deleted file mode 100644
index 4224bafa82..0000000000
--- a/ext/posix/tests/posix_seteuid_variation4.phpt
+++ /dev/null
@@ -1,46 +0,0 @@
---TEST--
-Test function posix_seteuid() by substituting argument 1 with float values.
---SKIPIF--
-<?php
- PHP_INT_SIZE == 4 or die("skip - 32-bit only");
- if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
- if(posix_geteuid() == 0) print "skip - Cannot run test as root.";
-?>
---CREDITS--
-Marco Fabbri mrfabbri@gmail.com
-Francesco Fullone ff@ideato.it
-#PHPTestFest Cesena Italia on 2009-06-20
---FILE--
-<?php
-
-
-echo "*** Test substituting argument 1 with float values ***\n";
-
-$myUid = posix_getuid();
-
-$myUid = $myUid - 1.1;
-
-$variation_array = array(
- 'float '.$myUid => $myUid,
- 'float -'.$myUid => -$myUid,
- 'float 12.3456789000e10' => 12.3456789000e10,
- 'float -12.3456789000e10' => -12.3456789000e10,
- 'float .5' => .5,
- );
-
-
-foreach ( $variation_array as $var ) {
- var_dump(posix_seteuid( $var ) );
-}
-?>
---EXPECTF--
-*** Test substituting argument 1 with float values ***
-bool(false)
-bool(false)
-
-Warning: posix_seteuid() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-
-Warning: posix_seteuid() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-bool(false)
diff --git a/ext/posix/tests/posix_setgid_basic.phpt b/ext/posix/tests/posix_setgid_basic.phpt
index d619476677..5984caa58b 100644
--- a/ext/posix/tests/posix_setgid_basic.phpt
+++ b/ext/posix/tests/posix_setgid_basic.phpt
@@ -19,9 +19,7 @@ var_dump(posix_setgid( $gid ) );
?>
-===DONE===
--EXPECT--
*** Test by calling method or function with its expected arguments ***
bool(true)
-===DONE===
diff --git a/ext/posix/tests/posix_setgid_variation2.phpt b/ext/posix/tests/posix_setgid_variation2.phpt
index 5a1b5a13a1..eac869e7e1 100644
--- a/ext/posix/tests/posix_setgid_variation2.phpt
+++ b/ext/posix/tests/posix_setgid_variation2.phpt
@@ -29,11 +29,9 @@ foreach ( $variation_array as $var ) {
var_dump(posix_setgid( $var ) );
}
?>
-===DONE===
--EXPECT--
*** Test substituting argument 1 with boolean values ***
bool(false)
bool(false)
bool(false)
bool(false)
-===DONE===
diff --git a/ext/posix/tests/posix_setgid_variation4.phpt b/ext/posix/tests/posix_setgid_variation4.phpt
deleted file mode 100644
index d85b5a900a..0000000000
--- a/ext/posix/tests/posix_setgid_variation4.phpt
+++ /dev/null
@@ -1,46 +0,0 @@
---TEST--
-Test function posix_setgid() by substituting argument 1 with float values.
---SKIPIF--
-<?php
- PHP_INT_SIZE == 4 or die("skip - 32-bit only");
- if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
- if(posix_geteuid() == 0) print "skip - Cannot run test as root.";
-?>
---CREDITS--
-Marco Fabbri mrfabbri@gmail.com
-Francesco Fullone ff@ideato.it
-#PHPTestFest Cesena Italia on 2009-06-20
---FILE--
-<?php
-
-
-echo "*** Test substituting argument 1 with float values ***\n";
-
-
-
-$variation_array = array(
- 'float 10.5' => 10.5,
- 'float -10.5' => -10.5,
- 'float 12.3456789000e10' => 12.3456789000e10,
- 'float -12.3456789000e10' => -12.3456789000e10,
- 'float .5' => .5,
- );
-
-
-foreach ( $variation_array as $var ) {
- var_dump(posix_setgid( $var ) );
-}
-?>
-===DONE===
---EXPECTF--
-*** Test substituting argument 1 with float values ***
-bool(false)
-bool(false)
-
-Warning: posix_setgid() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-
-Warning: posix_setgid() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-bool(false)
-===DONE===
diff --git a/ext/posix/tests/posix_setgid_variation5.phpt b/ext/posix/tests/posix_setgid_variation5.phpt
index ad9c79bd2b..35187d44a5 100644
--- a/ext/posix/tests/posix_setgid_variation5.phpt
+++ b/ext/posix/tests/posix_setgid_variation5.phpt
@@ -28,10 +28,8 @@ foreach ( $variation_array as $var ) {
var_dump(posix_setgid( $var ) );
}
?>
-===DONE===
--EXPECT--
*** Test substituting argument 1 with int values ***
bool(false)
bool(false)
bool(false)
-===DONE===
diff --git a/ext/posix/tests/posix_setuid_variation4.phpt b/ext/posix/tests/posix_setuid_variation4.phpt
deleted file mode 100644
index 7423ba324e..0000000000
--- a/ext/posix/tests/posix_setuid_variation4.phpt
+++ /dev/null
@@ -1,46 +0,0 @@
---TEST--
-Test function posix_setuid() by substituting argument 1 with float values.
---SKIPIF--
-<?php
- PHP_INT_SIZE == 4 or die("skip - 32-bit only");
- if(!extension_loaded("posix")) print "skip - POSIX extension not loaded";
- if(posix_geteuid() == 0) print "skip - Cannot run test as root.";
-?>
---CREDITS--
-Marco Fabbri mrfabbri@gmail.com
-Francesco Fullone ff@ideato.it
-#PHPTestFest Cesena Italia on 2009-06-20
---FILE--
-<?php
-
-
-echo "*** Test substituting argument 1 with float values ***\n";
-
-$myUid = posix_getuid();
-
-$myUid = $myUid - 1.1;
-
-$variation_array = array(
- 'float '.$myUid => $myUid,
- 'float -'.$myUid => -$myUid,
- 'float 12.3456789000e10' => 12.3456789000e10,
- 'float -12.3456789000e10' => -12.3456789000e10,
- 'float .5' => .5,
- );
-
-
-foreach ( $variation_array as $var ) {
- var_dump(posix_setuid( $var ) );
-}
-?>
---EXPECTF--
-*** Test substituting argument 1 with float values ***
-bool(false)
-bool(false)
-
-Warning: posix_setuid() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-
-Warning: posix_setuid() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
-bool(false)
diff --git a/ext/posix/tests/posix_strerror_error.phpt b/ext/posix/tests/posix_strerror_error.phpt
index 3007f976c6..60b096656a 100644
--- a/ext/posix/tests/posix_strerror_error.phpt
+++ b/ext/posix/tests/posix_strerror_error.phpt
@@ -14,14 +14,6 @@ Test posix_strerror() function : error conditions
echo "*** Testing posix_strerror() : error conditions ***\n";
-echo "\n-- Testing posix_strerror() function with Zero arguments --\n";
-var_dump( posix_strerror() );
-
-echo "\n-- Testing posix_strerror() function with more than expected no. of arguments --\n";
-$errno = posix_get_last_error();
-$extra_arg = 10;
-var_dump( posix_strerror($errno, $extra_arg) );
-
echo "\n-- Testing posix_strerror() function with invalid error number --\n";
$errno = -999;
echo gettype( posix_strerror($errno) )."\n";
@@ -31,16 +23,6 @@ echo "Done";
--EXPECTF--
*** Testing posix_strerror() : error conditions ***
--- Testing posix_strerror() function with Zero arguments --
-
-Warning: posix_strerror() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
--- Testing posix_strerror() function with more than expected no. of arguments --
-
-Warning: posix_strerror() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
-
-- Testing posix_strerror() function with invalid error number --
string
Done
diff --git a/ext/posix/tests/posix_times.phpt b/ext/posix/tests/posix_times.phpt
index f75caa7920..4f069b2d8d 100644
--- a/ext/posix/tests/posix_times.phpt
+++ b/ext/posix/tests/posix_times.phpt
@@ -16,7 +16,6 @@ PHP Testfest Berlin 2009-05-10
<?php
var_dump(posix_times());
?>
-===DONE===
--EXPECTF--
array(5) {
["ticks"]=>
@@ -30,4 +29,3 @@ array(5) {
["cstime"]=>
int(%d)
}
-===DONE===
diff --git a/ext/posix/tests/posix_times_basic.phpt b/ext/posix/tests/posix_times_basic.phpt
index ad37834fd9..49da6b8aeb 100644
--- a/ext/posix/tests/posix_times_basic.phpt
+++ b/ext/posix/tests/posix_times_basic.phpt
@@ -14,8 +14,8 @@ Test posix_times() function : basic functionality
if ($times == FALSE) {
- $errno= posix_get_last_error();
- var_dump(posix_strerror($errno));
+ $errno= posix_get_last_error();
+ var_dump(posix_strerror($errno));
}
?>
diff --git a/ext/posix/tests/posix_ttyname.phpt b/ext/posix/tests/posix_ttyname.phpt
index a1f806bd50..c63fe27ec9 100644
--- a/ext/posix/tests/posix_ttyname.phpt
+++ b/ext/posix/tests/posix_ttyname.phpt
@@ -18,9 +18,7 @@ PHP Testfest Berlin 2009-05-10
var_dump(posix_ttyname(STDERR));
var_dump(posix_ttyname(STDOUT));
?>
-===DONE===
--EXPECT--
bool(false)
bool(false)
bool(false)
-===DONE===
diff --git a/ext/posix/tests/posix_ttyname_error_wrongparams.phpt b/ext/posix/tests/posix_ttyname_error_wrongparams.phpt
index 158a2d0ca7..92cf671c1d 100644
--- a/ext/posix/tests/posix_ttyname_error_wrongparams.phpt
+++ b/ext/posix/tests/posix_ttyname_error_wrongparams.phpt
@@ -3,6 +3,7 @@ Test posix_ttyname() with wrong parameters
--DESCRIPTION--
Gets the absolute path to the current terminal device that is open on a given file descriptor.
Source code: ext/posix/posix.c
+
--CREDITS--
Falko Menge, mail at falko-menge dot de
PHP Testfest Berlin 2009-05-10
@@ -11,27 +12,20 @@ PHP Testfest Berlin 2009-05-10
if (!extension_loaded('posix')) {
die('SKIP - POSIX extension not available');
}
- if (!extension_loaded('gd')) {
- die('SKIP - GD extension not available');
- }
- if (!function_exists('imagecreate')) {
- die('SKIP - Function imagecreate() not available');
+
+ if (!function_exists('curl_init')) {
+ die('SKIP - Function curl_init() not available');
}
?>
--FILE--
<?php
- var_dump(posix_ttyname()); // param missing
- var_dump(posix_ttyname(0)); // param not a ressource
- var_dump(posix_ttyname(imagecreate(1, 1))); // wrong resource type
+var_dump(posix_ttyname(0)); // param not a resource
+try {
+ var_dump(posix_ttyname(curl_init())); // wrong resource type
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
-===DONE===
---EXPECTF--
-Warning: posix_ttyname() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-bool(false)
-
-Warning: posix_ttyname(): supplied resource is not a valid stream resource in %s on line %d
-
-Warning: posix_ttyname(): expects argument 1 to be a valid stream resource in %s on line %d
+--EXPECT--
bool(false)
-===DONE===
+posix_ttyname(): supplied resource is not a valid stream resource
diff --git a/ext/posix/tests/posix_ttyname_variation6.phpt b/ext/posix/tests/posix_ttyname_variation6.phpt
index eecae6769e..691c5eea7e 100644
--- a/ext/posix/tests/posix_ttyname_variation6.phpt
+++ b/ext/posix/tests/posix_ttyname_variation6.phpt
@@ -18,7 +18,7 @@ echo "*** Test substituting argument 1 with object values ***\n";
-function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+function test_error_handler($err_no, $err_msg, $filename, $linenum) {
if (error_reporting() != 0) {
// report non-silenced errors
echo "Error: $err_no - $err_msg, $filename($linenum)\n";
diff --git a/ext/pspell/php_pspell.h b/ext/pspell/php_pspell.h
index aa0fe0b8e6..85d7eb5b15 100644
--- a/ext/pspell/php_pspell.h
+++ b/ext/pspell/php_pspell.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/pspell/pspell.c b/ext/pspell/pspell.c
index 4e5e34e6b5..30f91dee4b 100644
--- a/ext/pspell/pspell.c
+++ b/ext/pspell/pspell.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -34,6 +32,7 @@
#include "php_pspell.h"
#include <pspell.h>
#include "ext/standard/info.h"
+#include "pspell_arginfo.h"
#define PSPELL_FAST 1L
#define PSPELL_NORMAL 2L
@@ -68,110 +67,6 @@ static PHP_FUNCTION(pspell_config_data_dir);
static PHP_FUNCTION(pspell_config_repl);
static PHP_FUNCTION(pspell_config_save_repl);
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_new, 0, 0, 1)
- ZEND_ARG_INFO(0, language)
- ZEND_ARG_INFO(0, spelling)
- ZEND_ARG_INFO(0, jargon)
- ZEND_ARG_INFO(0, encoding)
- ZEND_ARG_INFO(0, mode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_new_personal, 0, 0, 2)
- ZEND_ARG_INFO(0, personal)
- ZEND_ARG_INFO(0, language)
- ZEND_ARG_INFO(0, spelling)
- ZEND_ARG_INFO(0, jargon)
- ZEND_ARG_INFO(0, encoding)
- ZEND_ARG_INFO(0, mode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_new_config, 0, 0, 1)
- ZEND_ARG_INFO(0, config)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_check, 0, 0, 2)
- ZEND_ARG_INFO(0, pspell)
- ZEND_ARG_INFO(0, word)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_suggest, 0, 0, 2)
- ZEND_ARG_INFO(0, pspell)
- ZEND_ARG_INFO(0, word)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_store_replacement, 0, 0, 3)
- ZEND_ARG_INFO(0, pspell)
- ZEND_ARG_INFO(0, misspell)
- ZEND_ARG_INFO(0, correct)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_add_to_personal, 0, 0, 2)
- ZEND_ARG_INFO(0, pspell)
- ZEND_ARG_INFO(0, word)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_add_to_session, 0, 0, 2)
- ZEND_ARG_INFO(0, pspell)
- ZEND_ARG_INFO(0, word)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_clear_session, 0, 0, 1)
- ZEND_ARG_INFO(0, pspell)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_save_wordlist, 0, 0, 1)
- ZEND_ARG_INFO(0, pspell)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_config_create, 0, 0, 1)
- ZEND_ARG_INFO(0, language)
- ZEND_ARG_INFO(0, spelling)
- ZEND_ARG_INFO(0, jargon)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_config_runtogether, 0, 0, 2)
- ZEND_ARG_INFO(0, conf)
- ZEND_ARG_INFO(0, runtogether)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_config_mode, 0, 0, 2)
- ZEND_ARG_INFO(0, conf)
- ZEND_ARG_INFO(0, mode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_config_ignore, 0, 0, 2)
- ZEND_ARG_INFO(0, conf)
- ZEND_ARG_INFO(0, ignore)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_config_personal, 0, 0, 2)
- ZEND_ARG_INFO(0, conf)
- ZEND_ARG_INFO(0, personal)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_config_dict_dir, 0, 0, 2)
- ZEND_ARG_INFO(0, conf)
- ZEND_ARG_INFO(0, directory)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_config_data_dir, 0, 0, 2)
- ZEND_ARG_INFO(0, conf)
- ZEND_ARG_INFO(0, directory)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_config_repl, 0, 0, 2)
- ZEND_ARG_INFO(0, conf)
- ZEND_ARG_INFO(0, repl)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_config_save_repl, 0, 0, 2)
- ZEND_ARG_INFO(0, conf)
- ZEND_ARG_INFO(0, save)
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ pspell_functions[]
*/
static const zend_function_entry pspell_functions[] = {
@@ -279,7 +174,7 @@ static PHP_FUNCTION(pspell_new)
if (zend_parse_parameters(argc, "s|sssl", &language, &language_len, &spelling, &spelling_len,
&jargon, &jargon_len, &encoding, &encoding_len, &mode) == FAILURE) {
- return;
+ RETURN_THROWS();
}
config = new_pspell_config();
@@ -376,7 +271,7 @@ static PHP_FUNCTION(pspell_new_personal)
if (zend_parse_parameters(argc, "ps|sssl", &personal, &personal_len, &language, &language_len,
&spelling, &spelling_len, &jargon, &jargon_len, &encoding, &encoding_len, &mode) == FAILURE) {
- return;
+ RETURN_THROWS();
}
config = new_pspell_config();
@@ -468,7 +363,7 @@ static PHP_FUNCTION(pspell_new_config)
PspellConfig *config;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &conf) == FAILURE) {
- return;
+ RETURN_THROWS();
}
PSPELL_FETCH_CONFIG;
@@ -497,7 +392,7 @@ static PHP_FUNCTION(pspell_check)
PspellManager *manager;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &scin, &word, &word_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
PSPELL_FETCH_MANAGER;
@@ -522,7 +417,7 @@ static PHP_FUNCTION(pspell_suggest)
const char *sug;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &scin, &word, &word_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
PSPELL_FETCH_MANAGER;
@@ -553,7 +448,7 @@ static PHP_FUNCTION(pspell_store_replacement)
PspellManager *manager;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lss", &scin, &miss, &miss_len, &corr, &corr_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
PSPELL_FETCH_MANAGER;
@@ -578,7 +473,7 @@ static PHP_FUNCTION(pspell_add_to_personal)
PspellManager *manager;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &scin, &word, &word_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
PSPELL_FETCH_MANAGER;
@@ -608,7 +503,7 @@ static PHP_FUNCTION(pspell_add_to_session)
PspellManager *manager;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &scin, &word, &word_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
PSPELL_FETCH_MANAGER;
@@ -636,7 +531,7 @@ static PHP_FUNCTION(pspell_clear_session)
PspellManager *manager;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &scin) == FAILURE) {
- return;
+ RETURN_THROWS();
}
PSPELL_FETCH_MANAGER;
@@ -659,7 +554,7 @@ static PHP_FUNCTION(pspell_save_wordlist)
PspellManager *manager;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &scin) == FAILURE) {
- return;
+ RETURN_THROWS();
}
PSPELL_FETCH_MANAGER;
@@ -695,7 +590,7 @@ static PHP_FUNCTION(pspell_config_create)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|sss", &language, &language_len, &spelling, &spelling_len,
&jargon, &jargon_len, &encoding, &encoding_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
config = new_pspell_config();
@@ -753,7 +648,7 @@ static PHP_FUNCTION(pspell_config_runtogether)
PspellConfig *config;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lb", &conf, &runtogether) == FAILURE) {
- return;
+ RETURN_THROWS();
}
PSPELL_FETCH_CONFIG;
@@ -772,7 +667,7 @@ static PHP_FUNCTION(pspell_config_mode)
PspellConfig *config;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll", &conf, &mode) == FAILURE) {
- return;
+ RETURN_THROWS();
}
PSPELL_FETCH_CONFIG;
@@ -799,7 +694,7 @@ static PHP_FUNCTION(pspell_config_ignore)
PspellConfig *config;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll", &conf, &ignore) == FAILURE) {
- return;
+ RETURN_THROWS();
}
PSPELL_FETCH_CONFIG;
@@ -819,7 +714,7 @@ static void pspell_config_path(INTERNAL_FUNCTION_PARAMETERS, char *option)
PspellConfig *config;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lp", &conf, &value, &value_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
PSPELL_FETCH_CONFIG;
@@ -867,7 +762,7 @@ static PHP_FUNCTION(pspell_config_repl)
PspellConfig *config;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lp", &conf, &repl, &repl_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
PSPELL_FETCH_CONFIG;
@@ -893,7 +788,7 @@ static PHP_FUNCTION(pspell_config_save_repl)
PspellConfig *config;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lb", &conf, &save) == FAILURE) {
- return;
+ RETURN_THROWS();
}
PSPELL_FETCH_CONFIG;
diff --git a/ext/pspell/pspell.stub.php b/ext/pspell/pspell.stub.php
new file mode 100644
index 0000000000..bf49093e85
--- /dev/null
+++ b/ext/pspell/pspell.stub.php
@@ -0,0 +1,39 @@
+<?php
+
+function pspell_new(string $language, string $spelling = UNKNOWN, string $jargon = UNKNOWN, string $encoding = UNKNOWN, int $mode = 0): int|false {}
+
+function pspell_new_personal(string $personal, string $language, string $spelling = UNKNOWN, string $jargon = UNKNOWN, string $encoding = UNKNOWN, $mode = 0): int|false {}
+
+function pspell_new_config(int $config): int|false {}
+
+function pspell_check(int $pspell, string $word): bool {}
+
+function pspell_suggest(int $pspell, string $word): array|false {}
+
+function pspell_store_replacement(int $pspell, string $misspell, string $correct): bool {}
+
+function pspell_add_to_personal(int $pspell, string $word): bool {}
+
+function pspell_add_to_session(int $pspell, string $word): bool {}
+
+function pspell_clear_session(int $pspell): bool {}
+
+function pspell_save_wordlist(int $pspell): bool {}
+
+function pspell_config_create(string $language, string $spelling = UNKNOWN, string $jargon = UNKNOWN, string $encoding = UNKNOWN): int {}
+
+function pspell_config_runtogether(int $conf, bool $runtogether): bool {}
+
+function pspell_config_mode(int $conf, int $mode): bool {}
+
+function pspell_config_ignore(int $conf, int $ignore): bool {}
+
+function pspell_config_personal(int $conf, string $personal): bool {}
+
+function pspell_config_dict_dir(int $conf, string $directory): bool {}
+
+function pspell_config_data_dir(int $conf, string $directory): bool {}
+
+function pspell_config_repl(int $conf, string $repl): bool {}
+
+function pspell_config_save_repl(int $conf, bool $save): bool {}
diff --git a/ext/pspell/pspell_arginfo.h b/ext/pspell/pspell_arginfo.h
new file mode 100644
index 0000000000..688aea3f6f
--- /dev/null
+++ b/ext/pspell/pspell_arginfo.h
@@ -0,0 +1,92 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pspell_new, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, language, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, spelling, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, jargon, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pspell_new_personal, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, personal, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, language, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, spelling, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, jargon, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ ZEND_ARG_INFO(0, mode)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pspell_new_config, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, config, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pspell_check, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, pspell, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, word, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pspell_suggest, 0, 2, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, pspell, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, word, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pspell_store_replacement, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, pspell, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, misspell, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, correct, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_pspell_add_to_personal arginfo_pspell_check
+
+#define arginfo_pspell_add_to_session arginfo_pspell_check
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pspell_clear_session, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, pspell, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_pspell_save_wordlist arginfo_pspell_clear_session
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pspell_config_create, 0, 1, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, language, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, spelling, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, jargon, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pspell_config_runtogether, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, conf, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, runtogether, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pspell_config_mode, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, conf, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pspell_config_ignore, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, conf, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, ignore, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pspell_config_personal, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, conf, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, personal, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pspell_config_dict_dir, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, conf, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, directory, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_pspell_config_data_dir arginfo_pspell_config_dict_dir
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pspell_config_repl, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, conf, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, repl, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pspell_config_save_repl, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, conf, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, save, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/pspell/tests/002.phpt b/ext/pspell/tests/002.phpt
index 1b0dc2cdfa..34913ae826 100644
--- a/ext/pspell/tests/002.phpt
+++ b/ext/pspell/tests/002.phpt
@@ -10,33 +10,25 @@ if (!@pspell_new('en')) die('skip English dictionary is not available');
$p = pspell_new('en');
-var_dump(pspell_check('a'));
var_dump(pspell_check($p, 'somebogusword'));
var_dump(pspell_add_to_session($p, ''));
var_dump(pspell_add_to_session($p, 'somebogusword'));
var_dump(pspell_check($p, 'somebogusword'));
-var_dump(pspell_clear_session(new stdclass));
-
$res = @pspell_clear_session($p);
if ($res) {
- var_dump($res);
- var_dump(pspell_check($p, 'somebogusword'));
+ var_dump($res);
+ var_dump(pspell_check($p, 'somebogusword'));
} else {
- echo "bool(true)\n";
- echo "bool(false)\n";
+ echo "bool(true)\n";
+ echo "bool(false)\n";
}
?>
--EXPECTF--
-Warning: pspell_check() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
bool(false)
bool(false)
bool(true)
bool(true)
-
-Warning: pspell_clear_session() expects parameter 1 to be int, object given in %s on line %d
-NULL
bool(true)
bool(false)
diff --git a/ext/readline/php_readline.h b/ext/readline/php_readline.h
index 8d55228a7f..28772e79af 100644
--- a/ext/readline/php_readline.h
+++ b/ext/readline/php_readline.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/readline/readline.c b/ext/readline/readline.c
index 174556d4d3..8a82f67c85 100644
--- a/ext/readline/readline.c
+++ b/ext/readline/readline.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -25,6 +23,7 @@
#include "php.h"
#include "php_readline.h"
#include "readline_cli.h"
+#include "readline_arginfo.h"
#if HAVE_LIBREADLINE || HAVE_LIBEDIT
@@ -71,62 +70,6 @@ PHP_MINFO_FUNCTION(readline);
/* }}} */
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_readline, 0, 0, 0)
- ZEND_ARG_INFO(0, prompt)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_readline_info, 0, 0, 0)
- ZEND_ARG_INFO(0, varname)
- ZEND_ARG_INFO(0, newvalue)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_readline_add_history, 0, 0, 1)
- ZEND_ARG_INFO(0, prompt)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_readline_clear_history, 0)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_HISTORY_LIST
-ZEND_BEGIN_ARG_INFO(arginfo_readline_list_history, 0)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_readline_read_history, 0, 0, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_readline_write_history, 0, 0, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_readline_completion_function, 0, 0, 1)
- ZEND_ARG_INFO(0, funcname)
-ZEND_END_ARG_INFO()
-
-#if HAVE_RL_CALLBACK_READ_CHAR
-ZEND_BEGIN_ARG_INFO_EX(arginfo_readline_callback_handler_install, 0, 0, 2)
- ZEND_ARG_INFO(0, prompt)
- ZEND_ARG_INFO(0, callback)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_readline_callback_read_char, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_readline_callback_handler_remove, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_readline_redisplay, 0)
-ZEND_END_ARG_INFO()
-
-#if HAVE_RL_ON_NEW_LINE
-ZEND_BEGIN_ARG_INFO(arginfo_readline_on_new_line, 0)
-ZEND_END_ARG_INFO()
-#endif
-#endif
-/* }}} */
-
/* {{{ module stuff */
static const zend_function_entry php_readline_functions[] = {
PHP_FE(readline, arginfo_readline)
@@ -217,7 +160,7 @@ PHP_FUNCTION(readline)
char *result;
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "|s!", &prompt, &prompt_len)) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
result = readline(prompt);
@@ -244,7 +187,7 @@ PHP_FUNCTION(readline_info)
char *oldstr;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|sz", &what, &what_len, &value) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!what) {
@@ -280,7 +223,7 @@ PHP_FUNCTION(readline_info)
if (value) {
/* XXX if (rl_line_buffer) free(rl_line_buffer); */
if (!try_convert_to_string(value)) {
- return;
+ RETURN_THROWS();
}
rl_line_buffer = strdup(Z_STRVAL_P(value));
}
@@ -305,7 +248,7 @@ PHP_FUNCTION(readline_info)
oldval = rl_pending_input;
if (value) {
if (!try_convert_to_string(value)) {
- return;
+ RETURN_THROWS();
}
rl_pending_input = Z_STRVAL_P(value)[0];
}
@@ -324,7 +267,7 @@ PHP_FUNCTION(readline_info)
oldval = rl_completion_append_character;
if (value) {
if (!try_convert_to_string(value)) {
- return;
+ RETURN_THROWS();
}
rl_completion_append_character = (int)Z_STRVAL_P(value)[0];
}
@@ -349,7 +292,7 @@ PHP_FUNCTION(readline_info)
if (value) {
/* XXX if (rl_readline_name) free(rl_readline_name); */
if (!try_convert_to_string(value)) {
- return;
+ RETURN_THROWS();
}
rl_readline_name = strdup(Z_STRVAL_P(value));
}
@@ -374,7 +317,7 @@ PHP_FUNCTION(readline_add_history)
size_t arg_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &arg, &arg_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
add_history(arg);
@@ -388,7 +331,7 @@ PHP_FUNCTION(readline_add_history)
PHP_FUNCTION(readline_clear_history)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
#if HAVE_LIBEDIT
@@ -411,7 +354,7 @@ PHP_FUNCTION(readline_list_history)
HIST_ENTRY **history;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
array_init(return_value);
@@ -466,7 +409,7 @@ PHP_FUNCTION(readline_read_history)
size_t arg_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|p", &arg, &arg_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (arg && php_check_open_basedir(arg)) {
@@ -491,7 +434,7 @@ PHP_FUNCTION(readline_write_history)
size_t arg_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|p", &arg, &arg_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (arg && php_check_open_basedir(arg)) {
@@ -579,7 +522,7 @@ PHP_FUNCTION(readline_completion_function)
zval *arg;
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "z", &arg)) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (!zend_is_callable(arg, 0, NULL)) {
@@ -627,7 +570,7 @@ PHP_FUNCTION(readline_callback_handler_install)
size_t prompt_len;
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "sz", &prompt, &prompt_len, &callback)) {
- return;
+ RETURN_THROWS();
}
if (!zend_is_callable(callback, 0, NULL)) {
@@ -655,7 +598,7 @@ PHP_FUNCTION(readline_callback_handler_install)
PHP_FUNCTION(readline_callback_read_char)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (Z_TYPE(_prepped_callback) != IS_UNDEF) {
@@ -669,7 +612,7 @@ PHP_FUNCTION(readline_callback_read_char)
PHP_FUNCTION(readline_callback_handler_remove)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (Z_TYPE(_prepped_callback) != IS_UNDEF) {
@@ -687,7 +630,7 @@ PHP_FUNCTION(readline_callback_handler_remove)
PHP_FUNCTION(readline_redisplay)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
#if HAVE_LIBEDIT
@@ -707,7 +650,7 @@ PHP_FUNCTION(readline_redisplay)
PHP_FUNCTION(readline_on_new_line)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
rl_on_new_line();
diff --git a/ext/readline/readline.stub.php b/ext/readline/readline.stub.php
new file mode 100644
index 0000000000..ed383561d1
--- /dev/null
+++ b/ext/readline/readline.stub.php
@@ -0,0 +1,41 @@
+<?php
+
+function readline(?string $prompt = null): string|false {}
+
+/** @return mixed */
+function readline_info(string $varname = UNKNOWN, string $newvalue = UNKNOWN) {}
+
+function readline_add_history(string $prompt): bool {}
+
+function readline_clear_history(): bool {}
+
+#ifdef HAVE_HISTORY_LIST
+function readline_list_history(): array {}
+#endif
+
+function readline_read_history(string $filename = UNKNOWN): bool {}
+
+function readline_write_history(string $filename = UNKNOWN): bool {}
+
+/**
+ * @param callable $funcname
+ */
+function readline_completion_function($funcname): bool {}
+
+
+#if HAVE_RL_CALLBACK_READ_CHAR
+/**
+ * @param callable $callback
+ */
+function readline_callback_handler_install(string $prompt, $callback): bool {}
+
+function readline_callback_read_char(): void {}
+
+function readline_callback_handler_remove(): bool {}
+
+function readline_redisplay(): void {}
+
+#if HAVE_RL_ON_NEW_LINE
+function readline_on_new_line(): void {}
+#endif
+#endif
diff --git a/ext/readline/readline_arginfo.h b/ext/readline/readline_arginfo.h
new file mode 100644
index 0000000000..b57a41d900
--- /dev/null
+++ b/ext/readline/readline_arginfo.h
@@ -0,0 +1,58 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_readline, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, prompt, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_readline_info, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, varname, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, newvalue, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_readline_add_history, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, prompt, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_readline_clear_history, 0, 0, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_HISTORY_LIST)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_readline_list_history, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_readline_read_history, 0, 0, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_readline_write_history arginfo_readline_read_history
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_readline_completion_function, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, funcname)
+ZEND_END_ARG_INFO()
+
+#if HAVE_RL_CALLBACK_READ_CHAR
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_readline_callback_handler_install, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, prompt, IS_STRING, 0)
+ ZEND_ARG_INFO(0, callback)
+ZEND_END_ARG_INFO()
+#endif
+
+#if HAVE_RL_CALLBACK_READ_CHAR
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_readline_callback_read_char, 0, 0, IS_VOID, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if HAVE_RL_CALLBACK_READ_CHAR
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_readline_callback_handler_remove, 0, 0, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if HAVE_RL_CALLBACK_READ_CHAR
+#define arginfo_readline_redisplay arginfo_readline_callback_read_char
+#endif
+
+#if HAVE_RL_CALLBACK_READ_CHAR && HAVE_RL_ON_NEW_LINE
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_readline_on_new_line, 0, 0, IS_VOID, 0)
+ZEND_END_ARG_INFO()
+#endif
diff --git a/ext/readline/readline_cli.c b/ext/readline/readline_cli.c
index d7d96b59e1..cfbf6d564f 100644
--- a/ext/readline/readline_cli.c
+++ b/ext/readline/readline_cli.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/readline/readline_cli.h b/ext/readline/readline_cli.h
index 05c70c1dac..81e73d1e4d 100644
--- a/ext/readline/readline_cli.h
+++ b/ext/readline/readline_cli.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/readline/tests/bug77812-libedit.phpt b/ext/readline/tests/bug77812-libedit.phpt
index 478274a19a..0c68a2d5c8 100644
--- a/ext/readline/tests/bug77812-libedit.phpt
+++ b/ext/readline/tests/bug77812-libedit.phpt
@@ -29,6 +29,9 @@ bar
xx
xxx
-Warning: Use of undefined constant FOO - assumed 'FOO' (this will throw an Error in a future version of PHP) in php shell code on line %d
+Warning: Uncaught Error: Undefined constant 'FOO' in php shell code:1
+Stack trace:
+#0 {main}
+ thrown in php shell code on line 1
FOOL1
FOO42
diff --git a/ext/readline/tests/bug77812-readline.phpt b/ext/readline/tests/bug77812-readline.phpt
index 32d9f4d960..a3917ccaba 100644
--- a/ext/readline/tests/bug77812-readline.phpt
+++ b/ext/readline/tests/bug77812-readline.phpt
@@ -40,7 +40,10 @@ xxx
php > FOO
php > ;
-Warning: Use of undefined constant FOO - assumed 'FOO' (this will throw an Error in a future version of PHP) in php shell code on line %d
+Warning: Uncaught Error: Undefined constant 'FOO' in php shell code:1
+Stack trace:
+#0 {main}
+ thrown in php shell code on line 1
php > echo <<<FOO
<<< > FOOL
<<< > FOO
diff --git a/ext/readline/tests/libedit_callback_handler_install_001.phpt b/ext/readline/tests/libedit_callback_handler_install_001.phpt
index b5d921e279..c4cfced627 100644
--- a/ext/readline/tests/libedit_callback_handler_install_001.phpt
+++ b/ext/readline/tests/libedit_callback_handler_install_001.phpt
@@ -8,12 +8,11 @@ if (READLINE_LIB != "libedit") die("skip libedit only");
<?php
function foo() {
- readline_callback_handler_remove();
+ readline_callback_handler_remove();
}
var_dump(readline_callback_handler_install('testing: ', 'foo'));
var_dump(readline_callback_handler_install('testing: ', 'foobar!'));
-var_dump(readline_callback_handler_install('testing: '));
?>
--EXPECTF--
@@ -21,6 +20,3 @@ bool(true)
Warning: readline_callback_handler_install(): foobar! is not callable in %s on line %d
bool(false)
-
-Warning: readline_callback_handler_install() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
diff --git a/ext/readline/tests/readline_add_history_001.phpt b/ext/readline/tests/readline_add_history_001.phpt
index a4bd524736..fe7c8c406e 100644
--- a/ext/readline/tests/readline_add_history_001.phpt
+++ b/ext/readline/tests/readline_add_history_001.phpt
@@ -10,7 +10,6 @@ var_dump(readline_list_history());
var_dump(readline_add_history(NULL));
var_dump(readline_list_history());
var_dump(readline_clear_history());
-var_dump(readline_add_history());
?>
--EXPECTF--
@@ -27,6 +26,3 @@ array(2) {
string(0) ""
}
bool(true)
-
-Warning: readline_add_history() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
diff --git a/ext/readline/tests/readline_callback_handler_install_001.phpt b/ext/readline/tests/readline_callback_handler_install_001.phpt
index cc054b0aa6..7f908ee393 100644
--- a/ext/readline/tests/readline_callback_handler_install_001.phpt
+++ b/ext/readline/tests/readline_callback_handler_install_001.phpt
@@ -8,12 +8,11 @@ if (READLINE_LIB == "libedit") die("skip readline only");
<?php
function foo() {
- readline_callback_handler_remove();
+ readline_callback_handler_remove();
}
var_dump(readline_callback_handler_install('testing: ', 'foo'));
var_dump(readline_callback_handler_install('testing: ', 'foobar!'));
-var_dump(readline_callback_handler_install('testing: '));
?>
--EXPECTF--
@@ -21,6 +20,3 @@ var_dump(readline_callback_handler_install('testing: '));
Warning: readline_callback_handler_install(): foobar! is not callable in %s on line %d
bool(false)
-
-Warning: readline_callback_handler_install() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
diff --git a/ext/readline/tests/readline_clear_history_001.phpt b/ext/readline/tests/readline_clear_history_001.phpt
index 5df1ae77a0..8dea376ccf 100644
--- a/ext/readline/tests/readline_clear_history_001.phpt
+++ b/ext/readline/tests/readline_clear_history_001.phpt
@@ -6,11 +6,7 @@ readline_clear_history(): Basic test
<?php
var_dump(readline_clear_history());
-var_dump(readline_clear_history(1));
?>
--EXPECTF--
bool(true)
-
-Warning: readline_clear_history() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
diff --git a/ext/readline/tests/readline_completion_function_001.phpt b/ext/readline/tests/readline_completion_function_001.phpt
index 828636cd83..6ba88756b8 100644
--- a/ext/readline/tests/readline_completion_function_001.phpt
+++ b/ext/readline/tests/readline_completion_function_001.phpt
@@ -8,14 +8,14 @@ readline_completion_function(): Basic test
function foo() { }
$data = array(
- 'foo',
- 'strtolower',
- 1,
- 1.1231
+ 'foo',
+ 'strtolower',
+ 1,
+ 1.1231
);
foreach ($data as $callback) {
- readline_completion_function($callback);
+ readline_completion_function($callback);
}
?>
diff --git a/ext/readline/tests/readline_list_history_001.phpt b/ext/readline/tests/readline_list_history_001.phpt
index 2f6f9525d2..37e1b0af17 100644
--- a/ext/readline/tests/readline_list_history_001.phpt
+++ b/ext/readline/tests/readline_list_history_001.phpt
@@ -6,12 +6,8 @@ readline_list_history(): Basic test
<?php
var_dump(readline_list_history());
-var_dump(readline_list_history(1));
?>
--EXPECTF--
array(0) {
}
-
-Warning: readline_list_history() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index dbfb67386e..95c4859e94 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -43,6 +41,7 @@
#include "zend_extensions.h"
#include "zend_builtin_functions.h"
#include "zend_smart_str.h"
+#include "php_reflection_arginfo.h"
/* Key used to avoid leaking addresses in ReflectionProperty::getId() */
#define REFLECTION_KEY_LEN 16
@@ -76,6 +75,7 @@ PHPAPI zend_class_entry *reflection_generator_ptr;
PHPAPI zend_class_entry *reflection_parameter_ptr;
PHPAPI zend_class_entry *reflection_type_ptr;
PHPAPI zend_class_entry *reflection_named_type_ptr;
+PHPAPI zend_class_entry *reflection_union_type_ptr;
PHPAPI zend_class_entry *reflection_class_ptr;
PHPAPI zend_class_entry *reflection_object_ptr;
PHPAPI zend_class_entry *reflection_method_ptr;
@@ -93,10 +93,10 @@ PHPAPI zend_class_entry *reflection_reference_ptr;
intern = Z_REFLECTION_P(ZEND_THIS); \
if (intern->ptr == NULL) { \
if (EG(exception) && EG(exception)->ce == reflection_exception_ptr) { \
- return; \
+ RETURN_THROWS(); \
} \
zend_throw_error(NULL, "Internal error: Failed to retrieve the reflection object"); \
- return; \
+ RETURN_THROWS(); \
} \
} while (0)
@@ -113,9 +113,8 @@ PHPAPI zend_class_entry *reflection_reference_ptr;
/* Struct for properties */
typedef struct _property_reference {
- zend_property_info prop;
+ zend_property_info *prop;
zend_string *unmangled_name;
- zend_bool dynamic;
} property_reference;
/* Struct for parameters */
@@ -129,6 +128,8 @@ typedef struct _parameter_reference {
/* Struct for type hints */
typedef struct _type_reference {
zend_type type;
+ /* Whether to use backwards compatible null representation */
+ zend_bool legacy_behavior;
} type_reference;
typedef enum {
@@ -160,6 +161,10 @@ static inline reflection_object *reflection_object_from_obj(zend_object *obj) {
static zend_object_handlers reflection_object_handlers;
+static zend_always_inline uint32_t prop_get_flags(property_reference *ref) {
+ return ref->prop ? ref->prop->flags : ZEND_ACC_PUBLIC;
+}
+
static inline zend_bool is_closure_invoke(zend_class_entry *ce, zend_string *lcname) {
return ce == zend_ce_closure
&& zend_string_equals_literal(lcname, ZEND_INVOKE_FUNC_NAME);
@@ -226,7 +231,7 @@ static void reflection_free_objects_storage(zend_object *object) /* {{{ */
case REF_TYPE_TYPE:
{
type_reference *type_ref = intern->ptr;
- if (ZEND_TYPE_IS_NAME(type_ref->type)) {
+ if (ZEND_TYPE_HAS_NAME(type_ref->type)) {
zend_string_release(ZEND_TYPE_NAME(type_ref->type));
}
efree(type_ref);
@@ -252,9 +257,9 @@ static void reflection_free_objects_storage(zend_object *object) /* {{{ */
}
/* }}} */
-static HashTable *reflection_get_gc(zval *obj, zval **gc_data, int *gc_data_count) /* {{{ */
+static HashTable *reflection_get_gc(zend_object *obj, zval **gc_data, int *gc_data_count) /* {{{ */
{
- reflection_object *intern = Z_REFLECTION_P(obj);
+ reflection_object *intern = reflection_object_from_obj(obj);
*gc_data = &intern->obj;
*gc_data_count = 1;
return zend_std_get_properties(obj);
@@ -281,7 +286,7 @@ static zval *reflection_instantiate(zend_class_entry *pce, zval *object) /* {{{
static void _const_string(smart_str *str, char *name, zval *value, char *indent);
static void _function_string(smart_str *str, zend_function *fptr, zend_class_entry *scope, char* indent);
-static void _property_string(smart_str *str, zend_property_info *prop, const char *prop_name, char* indent, zend_bool dynamic);
+static void _property_string(smart_str *str, zend_property_info *prop, const char *prop_name, char* indent);
static void _class_const_string(smart_str *str, char *name, zend_class_constant *c, char* indent);
static void _class_string(smart_str *str, zend_class_entry *ce, zval *obj, char *indent);
static void _extension_string(smart_str *str, zend_module_entry *module, char *indent);
@@ -396,7 +401,7 @@ static void _class_string(smart_str *str, zend_class_entry *ce, zval *obj, char
ZEND_HASH_FOREACH_PTR(&ce->properties_info, prop) {
if ((prop->flags & ZEND_ACC_STATIC) && (!(prop->flags & ZEND_ACC_PRIVATE) || prop->ce == ce)) {
- _property_string(str, prop, NULL, ZSTR_VAL(sub_indent), 0);
+ _property_string(str, prop, NULL, ZSTR_VAL(sub_indent));
}
} ZEND_HASH_FOREACH_END();
}
@@ -444,14 +449,14 @@ static void _class_string(smart_str *str, zend_class_entry *ce, zval *obj, char
ZEND_HASH_FOREACH_PTR(&ce->properties_info, prop) {
if (!(prop->flags & ZEND_ACC_STATIC)
&& (!(prop->flags & ZEND_ACC_PRIVATE) || prop->ce == ce)) {
- _property_string(str, prop, NULL, ZSTR_VAL(sub_indent), 0);
+ _property_string(str, prop, NULL, ZSTR_VAL(sub_indent));
}
} ZEND_HASH_FOREACH_END();
}
smart_str_append_printf(str, "%s }\n", indent);
if (obj && Z_TYPE_P(obj) == IS_OBJECT) {
- HashTable *properties = Z_OBJ_HT_P(obj)->get_properties(obj);
+ HashTable *properties = Z_OBJ_HT_P(obj)->get_properties(Z_OBJ_P(obj));
zend_string *prop_name;
smart_str prop_str = {0};
@@ -461,7 +466,7 @@ static void _class_string(smart_str *str, zend_class_entry *ce, zval *obj, char
if (prop_name && ZSTR_LEN(prop_name) && ZSTR_VAL(prop_name)[0]) { /* skip all private and protected properties */
if (!zend_hash_exists(&ce->properties_info, prop_name)) {
count++;
- _property_string(&prop_str, NULL, ZSTR_VAL(prop_name), ZSTR_VAL(sub_indent), 0);
+ _property_string(&prop_str, NULL, ZSTR_VAL(prop_name), ZSTR_VAL(sub_indent));
}
}
} ZEND_HASH_FOREACH_END();
@@ -518,7 +523,7 @@ static void _class_string(smart_str *str, zend_class_entry *ce, zval *obj, char
/* {{{ _const_string */
static void _const_string(smart_str *str, char *name, zval *value, char *indent)
{
- char *type = zend_zval_type_name(value);
+ const char *type = zend_zval_type_name(value);
if (Z_TYPE_P(value) == IS_ARRAY) {
smart_str_append_printf(str, "%s Constant [ %s %s ] { Array }\n",
@@ -540,7 +545,7 @@ static void _const_string(smart_str *str, char *name, zval *value, char *indent)
static void _class_const_string(smart_str *str, char *name, zend_class_constant *c, char *indent)
{
char *visibility = zend_visibility_string(Z_ACCESS_FLAGS(c->value));
- char *type;
+ const char *type;
zval_update_constant_ex(&c->value, c->ce);
type = zend_zval_type_name(&c->value);
@@ -588,22 +593,15 @@ static void _parameter_string(smart_str *str, zend_function *fptr, struct _zend_
} else {
smart_str_append_printf(str, "<required> ");
}
- if (ZEND_TYPE_IS_CLASS(arg_info->type)) {
- smart_str_append_printf(str, "%s ",
- ZSTR_VAL(ZEND_TYPE_NAME(arg_info->type)));
- if (ZEND_TYPE_ALLOW_NULL(arg_info->type)) {
- smart_str_append_printf(str, "or NULL ");
- }
- } else if (ZEND_TYPE_IS_CODE(arg_info->type)) {
- smart_str_append_printf(str, "%s ", zend_get_type_by_const(ZEND_TYPE_CODE(arg_info->type)));
- if (ZEND_TYPE_ALLOW_NULL(arg_info->type)) {
- smart_str_append_printf(str, "or NULL ");
- }
+ if (ZEND_TYPE_IS_SET(arg_info->type)) {
+ zend_string *type_str = zend_type_to_string(arg_info->type);
+ smart_str_append_printf(str, "%s ", ZSTR_VAL(type_str));
+ zend_string_release(type_str);
}
- if (arg_info->pass_by_reference) {
+ if (ZEND_ARG_SEND_MODE(arg_info)) {
smart_str_appendc(str, '&');
}
- if (arg_info->is_variadic) {
+ if (ZEND_ARG_IS_VARIADIC(arg_info)) {
smart_str_appends(str, "...");
}
if (arg_info->name) {
@@ -808,17 +806,10 @@ static void _function_string(smart_str *str, zend_function *fptr, zend_class_ent
smart_str_free(&param_indent);
if (fptr->op_array.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) {
smart_str_append_printf(str, " %s- Return [ ", indent);
- if (ZEND_TYPE_IS_CLASS(fptr->common.arg_info[-1].type)) {
- smart_str_append_printf(str, "%s ",
- ZSTR_VAL(ZEND_TYPE_NAME(fptr->common.arg_info[-1].type)));
- if (ZEND_TYPE_ALLOW_NULL(fptr->common.arg_info[-1].type)) {
- smart_str_appends(str, "or NULL ");
- }
- } else if (ZEND_TYPE_IS_CODE(fptr->common.arg_info[-1].type)) {
- smart_str_append_printf(str, "%s ", zend_get_type_by_const(ZEND_TYPE_CODE(fptr->common.arg_info[-1].type)));
- if (ZEND_TYPE_ALLOW_NULL(fptr->common.arg_info[-1].type)) {
- smart_str_appends(str, "or NULL ");
- }
+ if (ZEND_TYPE_IS_SET(fptr->common.arg_info[-1].type)) {
+ zend_string *type_str = zend_type_to_string(fptr->common.arg_info[-1].type);
+ smart_str_append_printf(str, "%s ", ZSTR_VAL(type_str));
+ zend_string_release(type_str);
}
smart_str_appends(str, "]\n");
}
@@ -827,18 +818,14 @@ static void _function_string(smart_str *str, zend_function *fptr, zend_class_ent
/* }}} */
/* {{{ _property_string */
-static void _property_string(smart_str *str, zend_property_info *prop, const char *prop_name, char* indent, zend_bool dynamic)
+static void _property_string(smart_str *str, zend_property_info *prop, const char *prop_name, char* indent)
{
smart_str_append_printf(str, "%sProperty [ ", indent);
if (!prop) {
smart_str_append_printf(str, "<dynamic> public $%s", prop_name);
} else {
if (!(prop->flags & ZEND_ACC_STATIC)) {
- if (dynamic) {
- smart_str_appends(str, "<implicit> ");
- } else {
- smart_str_appends(str, "<default> ");
- }
+ smart_str_appends(str, "<default> ");
}
/* These are mutually exclusive */
@@ -1064,7 +1051,7 @@ static void _function_check_flag(INTERNAL_FUNCTION_PARAMETERS, int mask)
zend_function *mptr;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(mptr);
RETURN_BOOL(mptr->common.fn_flags & mask);
@@ -1146,22 +1133,46 @@ static void reflection_parameter_factory(zend_function *fptr, zval *closure_obje
}
/* }}} */
+/* For backwards compatibility reasons, we need to return T|null style unions
+ * as a ReflectionNamedType. Here we determine what counts as a union type and
+ * what doesn't. */
+static zend_bool is_union_type(zend_type type) {
+ if (ZEND_TYPE_HAS_LIST(type)) {
+ return 1;
+ }
+ uint32_t type_mask_without_null = ZEND_TYPE_PURE_MASK_WITHOUT_NULL(type);
+ if (ZEND_TYPE_HAS_CLASS(type)) {
+ return type_mask_without_null != 0;
+ }
+ if (type_mask_without_null == MAY_BE_BOOL) {
+ return 0;
+ }
+ /* Check that only one bit is set. */
+ return (type_mask_without_null & (type_mask_without_null - 1)) != 0;
+}
+
/* {{{ reflection_type_factory */
-static void reflection_type_factory(zend_type type, zval *object)
+static void reflection_type_factory(zend_type type, zval *object, zend_bool legacy_behavior)
{
reflection_object *intern;
type_reference *reference;
+ zend_bool is_union = is_union_type(type);
- reflection_instantiate(reflection_named_type_ptr, object);
+ reflection_instantiate(
+ is_union ? reflection_union_type_ptr : reflection_named_type_ptr, object);
intern = Z_REFLECTION_P(object);
reference = (type_reference*) emalloc(sizeof(type_reference));
reference->type = type;
+ reference->legacy_behavior = legacy_behavior && !is_union;
intern->ptr = reference;
intern->ref_type = REF_TYPE_TYPE;
- /* Property types may be resolved during the lifetime of the ReflectionType,
- * so we need to make sure that the strings we reference are not released. */
- if (ZEND_TYPE_IS_NAME(type)) {
+ /* Property types may be resolved during the lifetime of the ReflectionType.
+ * If we reference a string, make sure it doesn't get released. However, only
+ * do this for the top-level type, as resolutions inside type lists will be
+ * fully visible to us (we'd have to do a fully copy of the type if we wanted
+ * to prevent that). */
+ if (ZEND_TYPE_HAS_NAME(type)) {
zend_string_addref(ZEND_TYPE_NAME(type));
}
}
@@ -1207,47 +1218,29 @@ static void reflection_method_factory(zend_class_entry *ce, zend_function *metho
/* }}} */
/* {{{ reflection_property_factory */
-static void reflection_property_factory(zend_class_entry *ce, zend_string *name, zend_property_info *prop, zval *object, zend_bool dynamic)
+static void reflection_property_factory(zend_class_entry *ce, zend_string *name, zend_property_info *prop, zval *object)
{
reflection_object *intern;
property_reference *reference;
- if (!(prop->flags & ZEND_ACC_PRIVATE)) {
- /* we have to search the class hierarchy for this (implicit) public or protected property */
- zend_class_entry *tmp_ce = ce, *store_ce = ce;
- zend_property_info *tmp_info = NULL;
-
- while (tmp_ce && (tmp_info = zend_hash_find_ptr(&tmp_ce->properties_info, name)) == NULL) {
- ce = tmp_ce;
- tmp_ce = tmp_ce->parent;
- }
-
- if (tmp_info && (!(tmp_info->flags & ZEND_ACC_PRIVATE) || tmp_info->ce == tmp_ce)) { /* found something and it's not a parent's private */
- prop = tmp_info;
- } else { /* not found, use initial value */
- ce = store_ce;
- }
- }
-
reflection_instantiate(reflection_property_ptr, object);
intern = Z_REFLECTION_P(object);
reference = (property_reference*) emalloc(sizeof(property_reference));
- reference->prop = *prop;
+ reference->prop = prop;
reference->unmangled_name = zend_string_copy(name);
- reference->dynamic = dynamic;
intern->ptr = reference;
intern->ref_type = REF_TYPE_PROPERTY;
intern->ce = ce;
intern->ignore_visibility = 0;
ZVAL_STR_COPY(reflection_prop_name(object), name);
- ZVAL_STR_COPY(reflection_prop_class(object), prop->ce->name);
+ ZVAL_STR_COPY(reflection_prop_class(object), prop ? prop->ce->name : ce->name);
}
/* }}} */
static void reflection_property_factory_str(zend_class_entry *ce, const char *name_str, size_t name_len, zend_property_info *prop, zval *object)
{
zend_string *name = zend_string_init(name_str, name_len, 0);
- reflection_property_factory(ce, name, prop, object, 0);
+ reflection_property_factory(ce, name, prop, object);
zend_string_release(name);
}
@@ -1279,7 +1272,7 @@ static void reflection_export_impl(zval *return_value, zval *object, zend_bool r
if (result == FAILURE) {
_DO_THROW("Invocation of method __toString() failed");
- return;
+ RETURN_THROWS();
}
if (Z_TYPE(retval) == IS_UNDEF) {
@@ -1310,13 +1303,13 @@ static void _reflection_export(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *c
if (ctor_argc == 1) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|b", &argument_ptr, &return_output) == FAILURE) {
- return;
+ RETURN_THROWS();
}
ZVAL_COPY_VALUE(&params[0], argument_ptr);
ZVAL_NULL(&params[1]);
} else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz|b", &argument_ptr, &argument2_ptr, &return_output) == FAILURE) {
- return;
+ RETURN_THROWS();
}
ZVAL_COPY_VALUE(&params[0], argument_ptr);
ZVAL_COPY_VALUE(&params[1], argument2_ptr);
@@ -1325,7 +1318,7 @@ static void _reflection_export(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *c
/* Create object */
if (object_init_ex(&reflector, ce_ptr) == FAILURE) {
_DO_THROW("Could not create reflector");
- return;
+ RETURN_THROWS();
}
/* Call __construct() */
@@ -1348,12 +1341,12 @@ static void _reflection_export(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry *c
if (EG(exception)) {
zval_ptr_dtor(&reflector);
- return;
+ RETURN_THROWS();
}
if (result == FAILURE) {
zval_ptr_dtor(&reflector);
_DO_THROW("Could not create reflector");
- return;
+ RETURN_THROWS();
}
reflection_export_impl(return_value, &reflector, return_output);
@@ -1439,7 +1432,7 @@ ZEND_METHOD(reflection, getModifierNames)
zend_long modifiers;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &modifiers) == FAILURE) {
- return;
+ RETURN_THROWS();
}
array_init(return_value);
@@ -1497,8 +1490,8 @@ ZEND_METHOD(reflection_function, __construct)
} else {
ALLOCA_FLAG(use_heap)
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "S", &fname) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &fname) == FAILURE) {
+ RETURN_THROWS();
}
if (UNEXPECTED(ZSTR_VAL(fname)[0] == '\\')) {
@@ -1516,7 +1509,7 @@ ZEND_METHOD(reflection_function, __construct)
if (fptr == NULL) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Function %s() does not exist", ZSTR_VAL(fname));
- return;
+ RETURN_THROWS();
}
}
@@ -1541,7 +1534,7 @@ ZEND_METHOD(reflection_function, __toString)
smart_str str = {0};
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(fptr);
_function_string(&str, fptr, intern->ce, "");
@@ -1554,7 +1547,7 @@ ZEND_METHOD(reflection_function, __toString)
ZEND_METHOD(reflection_function, getName)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
_default_get_name(ZEND_THIS, return_value);
}
@@ -1568,7 +1561,7 @@ ZEND_METHOD(reflection_function, isClosure)
zend_function *fptr;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(fptr);
RETURN_BOOL(fptr->common.fn_flags & ZEND_ACC_CLOSURE);
@@ -1583,7 +1576,7 @@ ZEND_METHOD(reflection_function, getClosureThis)
zval* closure_this;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT();
if (!Z_ISUNDEF(intern->obj)) {
@@ -1604,7 +1597,7 @@ ZEND_METHOD(reflection_function, getClosureScopeClass)
const zend_function *closure_func;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT();
if (!Z_ISUNDEF(intern->obj)) {
@@ -1624,7 +1617,7 @@ ZEND_METHOD(reflection_function, getClosure)
zend_function *fptr;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(fptr);
@@ -1646,7 +1639,7 @@ ZEND_METHOD(reflection_function, isInternal)
zend_function *fptr;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(fptr);
RETURN_BOOL(fptr->type == ZEND_INTERNAL_FUNCTION);
@@ -1661,7 +1654,7 @@ ZEND_METHOD(reflection_function, isUserDefined)
zend_function *fptr;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(fptr);
RETURN_BOOL(fptr->type == ZEND_USER_FUNCTION);
@@ -1676,6 +1669,11 @@ ZEND_METHOD(reflection_function, isDisabled)
zend_function *fptr;
GET_REFLECTION_OBJECT_PTR(fptr);
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
RETURN_BOOL(fptr->type == ZEND_INTERNAL_FUNCTION && fptr->internal_function.handler == zif_display_disabled_function);
}
/* }}} */
@@ -1688,7 +1686,7 @@ ZEND_METHOD(reflection_function, getFileName)
zend_function *fptr;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(fptr);
if (fptr->type == ZEND_USER_FUNCTION) {
@@ -1706,7 +1704,7 @@ ZEND_METHOD(reflection_function, getStartLine)
zend_function *fptr;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(fptr);
if (fptr->type == ZEND_USER_FUNCTION) {
@@ -1724,7 +1722,7 @@ ZEND_METHOD(reflection_function, getEndLine)
zend_function *fptr;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(fptr);
if (fptr->type == ZEND_USER_FUNCTION) {
@@ -1742,7 +1740,7 @@ ZEND_METHOD(reflection_function, getDocComment)
zend_function *fptr;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(fptr);
if (fptr->type == ZEND_USER_FUNCTION && fptr->op_array.doc_comment) {
@@ -1761,7 +1759,7 @@ ZEND_METHOD(reflection_function, getStaticVariables)
zval *val;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(fptr);
@@ -1803,7 +1801,7 @@ ZEND_METHOD(reflection_function, invoke)
GET_REFLECTION_OBJECT_PTR(fptr);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "*", &params, &num_args) == FAILURE) {
- return;
+ RETURN_THROWS();
}
fci.size = sizeof(fci);
@@ -1820,7 +1818,7 @@ ZEND_METHOD(reflection_function, invoke)
if (!Z_ISUNDEF(intern->obj)) {
Z_OBJ_HT(intern->obj)->get_closure(
- &intern->obj, &fcc.called_scope, &fcc.function_handler, &fcc.object);
+ Z_OBJ(intern->obj), &fcc.called_scope, &fcc.function_handler, &fcc.object, 0);
}
result = zend_call_function(&fci, &fcc);
@@ -1828,7 +1826,7 @@ ZEND_METHOD(reflection_function, invoke)
if (result == FAILURE) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Invocation of function %s() failed", ZSTR_VAL(fptr->common.function_name));
- return;
+ RETURN_THROWS();
}
if (Z_TYPE(retval) != IS_UNDEF) {
@@ -1857,7 +1855,7 @@ ZEND_METHOD(reflection_function, invokeArgs)
GET_REFLECTION_OBJECT_PTR(fptr);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &param_array) == FAILURE) {
- return;
+ RETURN_THROWS();
}
argc = zend_hash_num_elements(Z_ARRVAL_P(param_array));
@@ -1883,7 +1881,7 @@ ZEND_METHOD(reflection_function, invokeArgs)
if (!Z_ISUNDEF(intern->obj)) {
Z_OBJ_HT(intern->obj)->get_closure(
- &intern->obj, &fcc.called_scope, &fcc.function_handler, &fcc.object);
+ Z_OBJ(intern->obj), &fcc.called_scope, &fcc.function_handler, &fcc.object, 0);
}
result = zend_call_function(&fci, &fcc);
@@ -1896,7 +1894,7 @@ ZEND_METHOD(reflection_function, invokeArgs)
if (result == FAILURE) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Invocation of function %s() failed", ZSTR_VAL(fptr->common.function_name));
- return;
+ RETURN_THROWS();
}
if (Z_TYPE(retval) != IS_UNDEF) {
@@ -1917,6 +1915,10 @@ ZEND_METHOD(reflection_function, returnsReference)
GET_REFLECTION_OBJECT_PTR(fptr);
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
RETURN_BOOL((fptr->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0);
}
/* }}} */
@@ -1931,6 +1933,10 @@ ZEND_METHOD(reflection_function, getNumberOfParameters)
GET_REFLECTION_OBJECT_PTR(fptr);
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
num_args = fptr->common.num_args;
if (fptr->common.fn_flags & ZEND_ACC_VARIADIC) {
num_args++;
@@ -1949,6 +1955,10 @@ ZEND_METHOD(reflection_function, getNumberOfRequiredParameters)
GET_REFLECTION_OBJECT_PTR(fptr);
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
RETURN_LONG(fptr->common.required_num_args);
}
/* }}} */
@@ -1964,6 +1974,10 @@ ZEND_METHOD(reflection_function, getParameters)
GET_REFLECTION_OBJECT_PTR(fptr);
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
arg_info= fptr->common.arg_info;
num_args = fptr->common.num_args;
if (fptr->common.fn_flags & ZEND_ACC_VARIADIC) {
@@ -2003,6 +2017,10 @@ ZEND_METHOD(reflection_function, getExtension)
GET_REFLECTION_OBJECT_PTR(fptr);
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
if (fptr->type != ZEND_INTERNAL_FUNCTION) {
RETURN_NULL();
}
@@ -2026,6 +2044,10 @@ ZEND_METHOD(reflection_function, getExtensionName)
GET_REFLECTION_OBJECT_PTR(fptr);
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
if (fptr->type != ZEND_INTERNAL_FUNCTION) {
RETURN_FALSE;
}
@@ -2049,14 +2071,14 @@ ZEND_METHOD(reflection_generator, __construct)
object = ZEND_THIS;
intern = Z_REFLECTION_P(object);
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "O", &generator, zend_ce_generator) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &generator, zend_ce_generator) == FAILURE) {
+ RETURN_THROWS();
}
ex = ((zend_generator *) Z_OBJ_P(generator))->execute_data;
if (!ex) {
_DO_THROW("Cannot create ReflectionGenerator based on a terminated Generator");
- return;
+ RETURN_THROWS();
}
intern->ref_type = REF_TYPE_GENERATOR;
@@ -2069,7 +2091,7 @@ ZEND_METHOD(reflection_generator, __construct)
#define REFLECTION_CHECK_VALID_GENERATOR(ex) \
if (!ex) { \
_DO_THROW("Cannot fetch information from a terminated Generator"); \
- return; \
+ RETURN_THROWS(); \
}
/* {{{ proto public array ReflectionGenerator::getTrace($options = DEBUG_BACKTRACE_PROVIDE_OBJECT) */
@@ -2083,7 +2105,7 @@ ZEND_METHOD(reflection_generator, getTrace)
zend_execute_data *root_prev = NULL, *cur_prev;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &options) == FAILURE) {
- return;
+ RETURN_THROWS();
}
REFLECTION_CHECK_VALID_GENERATOR(ex)
@@ -2115,7 +2137,7 @@ ZEND_METHOD(reflection_generator, getExecutingLine)
zend_execute_data *ex = generator->execute_data;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
REFLECTION_CHECK_VALID_GENERATOR(ex)
@@ -2131,7 +2153,7 @@ ZEND_METHOD(reflection_generator, getExecutingFile)
zend_execute_data *ex = generator->execute_data;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
REFLECTION_CHECK_VALID_GENERATOR(ex)
@@ -2147,7 +2169,7 @@ ZEND_METHOD(reflection_generator, getFunction)
zend_execute_data *ex = generator->execute_data;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
REFLECTION_CHECK_VALID_GENERATOR(ex)
@@ -2171,7 +2193,7 @@ ZEND_METHOD(reflection_generator, getThis)
zend_execute_data *ex = generator->execute_data;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
REFLECTION_CHECK_VALID_GENERATOR(ex)
@@ -2193,7 +2215,7 @@ ZEND_METHOD(reflection_generator, getExecutingGenerator)
zend_generator *current;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
REFLECTION_CHECK_VALID_GENERATOR(ex)
@@ -2229,8 +2251,8 @@ ZEND_METHOD(reflection_parameter, __construct)
zend_class_entry *ce = NULL;
zend_bool is_closure = 0;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "zz", &reference, &parameter) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &reference, &parameter) == FAILURE) {
+ RETURN_THROWS();
}
object = ZEND_THIS;
@@ -2246,7 +2268,7 @@ ZEND_METHOD(reflection_parameter, __construct)
if (!fptr) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Function %s() does not exist", Z_STRVAL_P(reference));
- return;
+ RETURN_THROWS();
}
ce = fptr->common.scope;
}
@@ -2261,7 +2283,7 @@ ZEND_METHOD(reflection_parameter, __construct)
|| ((method = zend_hash_index_find(Z_ARRVAL_P(reference), 1)) == NULL))
{
_DO_THROW("Expected array($object, $method) or array($classname, $method)");
- return;
+ RETURN_THROWS();
}
if (Z_TYPE_P(classref) == IS_OBJECT) {
@@ -2275,7 +2297,7 @@ ZEND_METHOD(reflection_parameter, __construct)
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Class %s does not exist", ZSTR_VAL(name));
zend_string_release(name);
- return;
+ RETURN_THROWS();
}
zend_string_release(name);
}
@@ -2296,7 +2318,7 @@ ZEND_METHOD(reflection_parameter, __construct)
zend_string_release(lcname);
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Method %s::%s() does not exist", ZSTR_VAL(ce->name), Z_STRVAL_P(method));
- return;
+ RETURN_THROWS();
}
zend_string_release(name);
zend_string_release(lcname);
@@ -2313,14 +2335,14 @@ ZEND_METHOD(reflection_parameter, __construct)
} else if ((fptr = zend_hash_find_ptr(&ce->function_table, ZSTR_KNOWN(ZEND_STR_MAGIC_INVOKE))) == NULL) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Method %s::%s() does not exist", ZSTR_VAL(ce->name), ZEND_INVOKE_FUNC_NAME);
- return;
+ RETURN_THROWS();
}
}
break;
default:
_DO_THROW("The parameter class is expected to be either a string, an array(class, method) or a callable object");
- return;
+ RETURN_THROWS();
}
/* Now, search for the parameter */
@@ -2398,9 +2420,7 @@ ZEND_METHOD(reflection_parameter, __construct)
failure:
if (fptr->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) {
- if (fptr->type != ZEND_OVERLOADED_FUNCTION) {
- zend_string_release_ex(fptr->common.function_name, 0);
- }
+ zend_string_release_ex(fptr->common.function_name, 0);
zend_free_trampoline(fptr);
}
if (is_closure) {
@@ -2418,7 +2438,7 @@ ZEND_METHOD(reflection_parameter, __toString)
smart_str str = {0};
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(param);
_parameter_string(&str, param->fptr, param->arg_info, param->offset, param->required, "");
@@ -2432,7 +2452,7 @@ ZEND_METHOD(reflection_parameter, __toString)
ZEND_METHOD(reflection_parameter, getName)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
_default_get_name(ZEND_THIS, return_value);
}
@@ -2446,7 +2466,7 @@ ZEND_METHOD(reflection_parameter, getDeclaringFunction)
parameter_reference *param;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(param);
@@ -2466,7 +2486,7 @@ ZEND_METHOD(reflection_parameter, getDeclaringClass)
parameter_reference *param;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(param);
@@ -2485,11 +2505,12 @@ ZEND_METHOD(reflection_parameter, getClass)
zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(param);
- if (ZEND_TYPE_IS_CLASS(param->arg_info->type)) {
+ // TODO: This is going to return null for union types, which is rather odd.
+ if (ZEND_TYPE_HAS_NAME(param->arg_info->type)) {
/* Class name is stored as a string, we might also get "self" or "parent"
* - For "self", simply use the function scope. If scope is NULL then
* the function is global and thus self does not make any sense
@@ -2510,19 +2531,19 @@ ZEND_METHOD(reflection_parameter, getClass)
if (!ce) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Parameter uses 'self' as type hint but function is not a class member!");
- return;
+ RETURN_THROWS();
}
} else if (0 == zend_binary_strcasecmp(ZSTR_VAL(class_name), ZSTR_LEN(class_name), "parent", sizeof("parent")- 1)) {
ce = param->fptr->common.scope;
if (!ce) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Parameter uses 'parent' as type hint but function is not a class member!");
- return;
+ RETURN_THROWS();
}
if (!ce->parent) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Parameter uses 'parent' as type hint although class does not have a parent!");
- return;
+ RETURN_THROWS();
}
ce = ce->parent;
} else {
@@ -2530,7 +2551,7 @@ ZEND_METHOD(reflection_parameter, getClass)
if (!ce) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Class %s does not exist", ZSTR_VAL(class_name));
- return;
+ RETURN_THROWS();
}
}
zend_reflection_class_factory(ce, return_value);
@@ -2546,7 +2567,7 @@ ZEND_METHOD(reflection_parameter, hasType)
parameter_reference *param;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(param);
@@ -2562,14 +2583,14 @@ ZEND_METHOD(reflection_parameter, getType)
parameter_reference *param;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(param);
if (!ZEND_TYPE_IS_SET(param->arg_info->type)) {
RETURN_NULL();
}
- reflection_type_factory(param->arg_info->type, return_value);
+ reflection_type_factory(param->arg_info->type, return_value, 1);
}
/* }}} */
@@ -2579,13 +2600,15 @@ ZEND_METHOD(reflection_parameter, isArray)
{
reflection_object *intern;
parameter_reference *param;
+ uint32_t type_mask;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(param);
- RETVAL_BOOL(ZEND_TYPE_CODE(param->arg_info->type) == IS_ARRAY);
+ type_mask = ZEND_TYPE_PURE_MASK_WITHOUT_NULL(param->arg_info->type);
+ RETVAL_BOOL(type_mask == MAY_BE_ARRAY);
}
/* }}} */
@@ -2595,13 +2618,15 @@ ZEND_METHOD(reflection_parameter, isCallable)
{
reflection_object *intern;
parameter_reference *param;
+ uint32_t type_mask;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(param);
- RETVAL_BOOL(ZEND_TYPE_CODE(param->arg_info->type) == IS_CALLABLE);
+ type_mask = ZEND_TYPE_PURE_MASK_WITHOUT_NULL(param->arg_info->type);
+ RETVAL_BOOL(type_mask == MAY_BE_CALLABLE);
}
/* }}} */
@@ -2613,11 +2638,12 @@ ZEND_METHOD(reflection_parameter, allowsNull)
parameter_reference *param;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(param);
- RETVAL_BOOL(ZEND_TYPE_ALLOW_NULL(param->arg_info->type));
+ RETVAL_BOOL(!ZEND_TYPE_IS_SET(param->arg_info->type)
+ || ZEND_TYPE_ALLOW_NULL(param->arg_info->type));
}
/* }}} */
@@ -2629,11 +2655,11 @@ ZEND_METHOD(reflection_parameter, isPassedByReference)
parameter_reference *param;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(param);
- RETVAL_BOOL(param->arg_info->pass_by_reference);
+ RETVAL_BOOL(ZEND_ARG_SEND_MODE(param->arg_info));
}
/* }}} */
@@ -2645,12 +2671,12 @@ ZEND_METHOD(reflection_parameter, canBePassedByValue)
parameter_reference *param;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(param);
/* true if it's ZEND_SEND_BY_VAL or ZEND_SEND_PREFER_REF */
- RETVAL_BOOL(param->arg_info->pass_by_reference != ZEND_SEND_BY_REF);
+ RETVAL_BOOL(ZEND_ARG_SEND_MODE(param->arg_info) != ZEND_SEND_BY_REF);
}
/* }}} */
@@ -2662,7 +2688,7 @@ ZEND_METHOD(reflection_parameter, getPosition)
parameter_reference *param;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(param);
@@ -2678,7 +2704,7 @@ ZEND_METHOD(reflection_parameter, isOptional)
parameter_reference *param;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(param);
@@ -2695,7 +2721,7 @@ ZEND_METHOD(reflection_parameter, isDefaultValueAvailable)
zend_op *precv;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(param);
@@ -2720,7 +2746,7 @@ ZEND_METHOD(reflection_parameter, getDefaultValue)
zend_op *precv;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
param = _reflection_param_get_default_param(INTERNAL_FUNCTION_PARAM_PASSTHRU);
@@ -2748,7 +2774,7 @@ ZEND_METHOD(reflection_parameter, isDefaultValueConstant)
parameter_reference *param;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
param = _reflection_param_get_default_param(INTERNAL_FUNCTION_PARAM_PASSTHRU);
@@ -2778,7 +2804,7 @@ ZEND_METHOD(reflection_parameter, getDefaultValueConstantName)
parameter_reference *param;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
param = _reflection_param_get_default_param(INTERNAL_FUNCTION_PARAM_PASSTHRU);
@@ -2807,11 +2833,11 @@ ZEND_METHOD(reflection_parameter, isVariadic)
parameter_reference *param;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(param);
- RETVAL_BOOL(param->arg_info->is_variadic);
+ RETVAL_BOOL(ZEND_ARG_IS_VARIADIC(param->arg_info));
}
/* }}} */
@@ -2823,7 +2849,7 @@ ZEND_METHOD(reflection_type, allowsNull)
type_reference *param;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(param);
@@ -2831,64 +2857,130 @@ ZEND_METHOD(reflection_type, allowsNull)
}
/* }}} */
-/* {{{ proto public bool ReflectionType::isBuiltin()
- Returns whether parameter is a builtin type */
-ZEND_METHOD(reflection_type, isBuiltin)
+static zend_string *zend_type_to_string_without_null(zend_type type) {
+ ZEND_TYPE_FULL_MASK(type) &= ~MAY_BE_NULL;
+ return zend_type_to_string(type);
+}
+
+/* {{{ proto public string ReflectionType::__toString()
+ Return the text of the type hint */
+ZEND_METHOD(reflection_type, __toString)
{
reflection_object *intern;
type_reference *param;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(param);
- RETVAL_BOOL(ZEND_TYPE_IS_CODE(param->type));
+ RETURN_STR(zend_type_to_string(param->type));
}
/* }}} */
-/* {{{ reflection_type_name */
-static zend_string *reflection_type_name(type_reference *param) {
- if (ZEND_TYPE_IS_NAME(param->type)) {
- return zend_string_copy(ZEND_TYPE_NAME(param->type));
- } else if (ZEND_TYPE_IS_CE(param->type)) {
- return zend_string_copy(ZEND_TYPE_CE(param->type)->name);
- } else {
- char *name = zend_get_type_by_const(ZEND_TYPE_CODE(param->type));
- return zend_string_init(name, strlen(name), 0);
+/* {{{ proto public string ReflectionNamedType::getName()
+ Return the name of the type */
+ZEND_METHOD(reflection_named_type, getName)
+{
+ reflection_object *intern;
+ type_reference *param;
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
}
+ GET_REFLECTION_OBJECT_PTR(param);
+
+ if (param->legacy_behavior) {
+ RETURN_STR(zend_type_to_string_without_null(param->type));
+ }
+ RETURN_STR(zend_type_to_string(param->type));
}
/* }}} */
-/* {{{ proto public string ReflectionType::__toString()
- Return the text of the type hint */
-ZEND_METHOD(reflection_type, __toString)
+/* {{{ proto public bool ReflectionNamedType::isBuiltin()
+ Returns whether type is a builtin type */
+ZEND_METHOD(reflection_named_type, isBuiltin)
{
reflection_object *intern;
type_reference *param;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(param);
- RETURN_STR(reflection_type_name(param));
+ RETVAL_BOOL(ZEND_TYPE_IS_ONLY_MASK(param->type));
}
/* }}} */
-/* {{{ proto public string ReflectionNamedType::getName()
- Return the text of the type hint */
-ZEND_METHOD(reflection_named_type, getName)
+static void append_type(zval *return_value, zend_type type) {
+ zval reflection_type;
+ reflection_type_factory(type, &reflection_type, 0);
+ zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &reflection_type);
+}
+
+static void append_type_mask(zval *return_value, uint32_t type_mask) {
+ append_type(return_value, (zend_type) ZEND_TYPE_INIT_MASK(type_mask));
+}
+
+/* {{{ proto public string ReflectionUnionType::getTypes()
+ Returns the types that are part of this union type */
+ZEND_METHOD(reflection_union_type, getTypes)
{
reflection_object *intern;
type_reference *param;
+ uint32_t type_mask;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(param);
- RETURN_STR(reflection_type_name(param));
+ array_init(return_value);
+ if (ZEND_TYPE_HAS_LIST(param->type)) {
+ zend_type *list_type;
+ ZEND_TYPE_LIST_FOREACH(ZEND_TYPE_LIST(param->type), list_type) {
+ append_type(return_value, *list_type);
+ } ZEND_TYPE_LIST_FOREACH_END();
+ } else if (ZEND_TYPE_HAS_NAME(param->type)) {
+ append_type(return_value,
+ (zend_type) ZEND_TYPE_INIT_CLASS(ZEND_TYPE_NAME(param->type), 0, 0));
+ } else if (ZEND_TYPE_HAS_CE(param->type)) {
+ append_type(return_value,
+ (zend_type) ZEND_TYPE_INIT_CE(ZEND_TYPE_CE(param->type), 0, 0));
+ }
+
+ type_mask = ZEND_TYPE_PURE_MASK(param->type);
+ ZEND_ASSERT(!(type_mask & MAY_BE_VOID));
+ if (type_mask & MAY_BE_CALLABLE) {
+ append_type_mask(return_value, MAY_BE_CALLABLE);
+ }
+ if (type_mask & MAY_BE_ITERABLE) {
+ append_type_mask(return_value, MAY_BE_ITERABLE);
+ }
+ if (type_mask & MAY_BE_OBJECT) {
+ append_type_mask(return_value, MAY_BE_OBJECT);
+ }
+ if (type_mask & MAY_BE_ARRAY) {
+ append_type_mask(return_value, MAY_BE_ARRAY);
+ }
+ if (type_mask & MAY_BE_STRING) {
+ append_type_mask(return_value, MAY_BE_STRING);
+ }
+ if (type_mask & MAY_BE_LONG) {
+ append_type_mask(return_value, MAY_BE_LONG);
+ }
+ if (type_mask & MAY_BE_DOUBLE) {
+ append_type_mask(return_value, MAY_BE_DOUBLE);
+ }
+ if ((type_mask & MAY_BE_BOOL) == MAY_BE_BOOL) {
+ append_type_mask(return_value, MAY_BE_BOOL);
+ } else if (type_mask & MAY_BE_FALSE) {
+ append_type_mask(return_value, MAY_BE_FALSE);
+ }
+ if (type_mask & MAY_BE_NULL) {
+ append_type_mask(return_value, MAY_BE_NULL);
+ }
}
/* }}} */
@@ -2915,14 +3007,14 @@ ZEND_METHOD(reflection_method, __construct)
zval ztmp;
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "zs", &classname, &name_str, &name_len) == FAILURE) {
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "s", &name_str, &name_len) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name_str, &name_len) == FAILURE) {
+ RETURN_THROWS();
}
if ((tmp = strstr(name_str, "::")) == NULL) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Invalid method name %s", name_str);
- return;
+ RETURN_THROWS();
}
classname = &ztmp;
tmp_len = tmp - name_str;
@@ -2950,7 +3042,7 @@ ZEND_METHOD(reflection_method, __construct)
if (classname == &ztmp) {
zval_ptr_dtor_str(&ztmp);
}
- return;
+ RETURN_THROWS();
}
break;
@@ -2963,7 +3055,7 @@ ZEND_METHOD(reflection_method, __construct)
zval_ptr_dtor_str(&ztmp);
}
_DO_THROW("The parameter class is expected to be either a string or an object");
- return;
+ RETURN_THROWS();
}
if (classname == &ztmp) {
@@ -2981,7 +3073,7 @@ ZEND_METHOD(reflection_method, __construct)
efree(lcname);
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Method %s::%s() does not exist", ZSTR_VAL(ce->name), name_str);
- return;
+ RETURN_THROWS();
}
efree(lcname);
@@ -3002,7 +3094,7 @@ ZEND_METHOD(reflection_method, __toString)
smart_str str = {0};
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(mptr);
_function_string(&str, mptr, intern->ce, "");
@@ -3024,12 +3116,12 @@ ZEND_METHOD(reflection_method, getClosure)
zend_create_fake_closure(return_value, mptr, mptr->common.scope, mptr->common.scope, NULL);
} else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &obj) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!instanceof_function(Z_OBJCE_P(obj), mptr->common.scope)) {
_DO_THROW("Given object is not an instance of the class this method was declared in");
- return;
+ RETURN_THROWS();
}
/* This is an original closure object and __invoke is to be called. */
@@ -3064,7 +3156,7 @@ static void reflection_method_invoke(INTERNAL_FUNCTION_PARAMETERS, int variadic)
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Trying to invoke abstract method %s::%s()",
ZSTR_VAL(mptr->common.scope->name), ZSTR_VAL(mptr->common.function_name));
- return;
+ RETURN_THROWS();
}
if (!(mptr->common.fn_flags & ZEND_ACC_PUBLIC) && intern->ignore_visibility == 0) {
@@ -3073,16 +3165,16 @@ static void reflection_method_invoke(INTERNAL_FUNCTION_PARAMETERS, int variadic)
mptr->common.fn_flags & ZEND_ACC_PROTECTED ? "protected" : "private",
ZSTR_VAL(mptr->common.scope->name), ZSTR_VAL(mptr->common.function_name),
ZSTR_VAL(Z_OBJCE_P(ZEND_THIS)->name));
- return;
+ RETURN_THROWS();
}
if (variadic) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "o!*", &object, &params, &argc) == FAILURE) {
- return;
+ RETURN_THROWS();
}
} else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "o!a", &object, &param_array) == FAILURE) {
- return;
+ RETURN_THROWS();
}
argc = zend_hash_num_elements(Z_ARRVAL_P(param_array));
@@ -3109,7 +3201,7 @@ static void reflection_method_invoke(INTERNAL_FUNCTION_PARAMETERS, int variadic)
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Trying to invoke non static method %s::%s() without an object",
ZSTR_VAL(mptr->common.scope->name), ZSTR_VAL(mptr->common.function_name));
- return;
+ RETURN_THROWS();
}
obj_ce = Z_OBJCE_P(object);
@@ -3119,7 +3211,7 @@ static void reflection_method_invoke(INTERNAL_FUNCTION_PARAMETERS, int variadic)
efree(params);
}
_DO_THROW("Given object is not an instance of the class this method was declared in");
- return;
+ RETURN_THROWS();
}
}
@@ -3154,7 +3246,7 @@ static void reflection_method_invoke(INTERNAL_FUNCTION_PARAMETERS, int variadic)
if (result == FAILURE) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Invocation of method %s::%s() failed", ZSTR_VAL(mptr->common.scope->name), ZSTR_VAL(mptr->common.function_name));
- return;
+ RETURN_THROWS();
}
if (Z_TYPE(retval) != IS_UNDEF) {
@@ -3166,7 +3258,7 @@ static void reflection_method_invoke(INTERNAL_FUNCTION_PARAMETERS, int variadic)
}
/* }}} */
-/* {{{ proto public mixed ReflectionMethod::invoke(mixed object, mixed* args)
+/* {{{ proto public mixed ReflectionMethod::invoke(mixed object, [mixed* args])
Invokes the method. */
ZEND_METHOD(reflection_method, invoke)
{
@@ -3262,7 +3354,7 @@ ZEND_METHOD(reflection_function, inNamespace)
const char *backslash;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((name = _default_load_name(ZEND_THIS)) == NULL) {
RETURN_FALSE;
@@ -3285,7 +3377,7 @@ ZEND_METHOD(reflection_function, getNamespaceName)
const char *backslash;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((name = _default_load_name(ZEND_THIS)) == NULL) {
RETURN_FALSE;
@@ -3308,7 +3400,7 @@ ZEND_METHOD(reflection_function, getShortName)
const char *backslash;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((name = _default_load_name(ZEND_THIS)) == NULL) {
RETURN_FALSE;
@@ -3331,7 +3423,7 @@ ZEND_METHOD(reflection_function, hasReturnType)
zend_function *fptr;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(fptr);
@@ -3348,7 +3440,7 @@ ZEND_METHOD(reflection_function, getReturnType)
zend_function *fptr;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(fptr);
@@ -3357,7 +3449,7 @@ ZEND_METHOD(reflection_function, getReturnType)
RETURN_NULL();
}
- reflection_type_factory(fptr->common.arg_info[-1].type, return_value);
+ reflection_type_factory(fptr->common.arg_info[-1].type, return_value, 1);
}
/* }}} */
@@ -3369,7 +3461,7 @@ ZEND_METHOD(reflection_method, isConstructor)
zend_function *mptr;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(mptr);
/* we need to check if the ctor is the ctor of the class level we we
@@ -3387,7 +3479,7 @@ ZEND_METHOD(reflection_method, isDestructor)
zend_function *mptr;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(mptr);
RETURN_BOOL(mptr->common.fn_flags & ZEND_ACC_DTOR);
@@ -3404,7 +3496,7 @@ ZEND_METHOD(reflection_method, getModifiers)
| ZEND_ACC_STATIC | ZEND_ACC_ABSTRACT | ZEND_ACC_FINAL;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(mptr);
@@ -3422,7 +3514,7 @@ ZEND_METHOD(reflection_method, getDeclaringClass)
GET_REFLECTION_OBJECT_PTR(mptr);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
zend_reflection_class_factory(mptr->common.scope, return_value);
@@ -3439,13 +3531,13 @@ ZEND_METHOD(reflection_method, getPrototype)
GET_REFLECTION_OBJECT_PTR(mptr);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!mptr->common.prototype) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Method %s::%s does not have a prototype", ZSTR_VAL(intern->ce->name), ZSTR_VAL(mptr->common.function_name));
- return;
+ RETURN_THROWS();
}
reflection_method_factory(mptr->common.prototype->common.scope, mptr->common.prototype, NULL, return_value);
@@ -3460,7 +3552,7 @@ ZEND_METHOD(reflection_method, setAccessible)
zend_bool visible;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &visible) == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern = Z_REFLECTION_P(ZEND_THIS);
@@ -3479,8 +3571,8 @@ ZEND_METHOD(reflection_class_constant, __construct)
zend_class_entry *ce;
zend_class_constant *constant = NULL;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "zS", &classname, &constname) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "zS", &classname, &constname) == FAILURE) {
+ RETURN_THROWS();
}
object = ZEND_THIS;
@@ -3492,7 +3584,7 @@ ZEND_METHOD(reflection_class_constant, __construct)
if ((ce = zend_lookup_class(Z_STR_P(classname))) == NULL) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Class %s does not exist", Z_STRVAL_P(classname));
- return;
+ RETURN_THROWS();
}
break;
@@ -3502,12 +3594,12 @@ ZEND_METHOD(reflection_class_constant, __construct)
default:
_DO_THROW("The parameter class is expected to be either a string or an object");
- return;
+ RETURN_THROWS();
}
if ((constant = zend_hash_find_ptr(&ce->constants_table, constname)) == NULL) {
zend_throw_exception_ex(reflection_exception_ptr, 0, "Class Constant %s::%s does not exist", ZSTR_VAL(ce->name), ZSTR_VAL(constname));
- return;
+ RETURN_THROWS();
}
intern->ptr = constant;
@@ -3529,7 +3621,7 @@ ZEND_METHOD(reflection_class_constant, __toString)
zval name;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ref);
_default_get_name(ZEND_THIS, &name);
@@ -3544,7 +3636,7 @@ ZEND_METHOD(reflection_class_constant, __toString)
ZEND_METHOD(reflection_class_constant, getName)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
_default_get_name(ZEND_THIS, return_value);
}
@@ -3556,7 +3648,7 @@ static void _class_constant_check_flag(INTERNAL_FUNCTION_PARAMETERS, int mask) /
zend_class_constant *ref;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ref);
RETURN_BOOL(Z_ACCESS_FLAGS(ref->value) & mask);
@@ -3595,7 +3687,7 @@ ZEND_METHOD(reflection_class_constant, getModifiers)
zend_class_constant *ref;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ref);
@@ -3611,7 +3703,7 @@ ZEND_METHOD(reflection_class_constant, getValue)
zend_class_constant *ref;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ref);
@@ -3630,7 +3722,7 @@ ZEND_METHOD(reflection_class_constant, getDeclaringClass)
zend_class_constant *ref;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ref);
@@ -3646,7 +3738,7 @@ ZEND_METHOD(reflection_class_constant, getDocComment)
zend_class_constant *ref;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ref);
if (ref->doc_comment) {
@@ -3693,14 +3785,14 @@ static void reflection_class_object_ctor(INTERNAL_FUNCTION_PARAMETERS, int is_ob
}
} else {
if (!try_convert_to_string(argument)) {
- return;
+ RETURN_THROWS();
}
if ((ce = zend_lookup_class(Z_STR_P(argument))) == NULL) {
if (!EG(exception)) {
zend_throw_exception_ex(reflection_exception_ptr, -1, "Class %s does not exist", Z_STRVAL_P(argument));
}
- return;
+ RETURN_THROWS();
}
ZVAL_STR_COPY(reflection_prop_name(object), ce->name);
@@ -3739,7 +3831,7 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value
} else if (!statics && (prop_info->flags & ZEND_ACC_STATIC) == 0) {
prop = &ce->default_properties_table[OBJ_PROP_TO_NUM(prop_info->offset)];
}
- if (!prop || (prop_info->type && Z_ISUNDEF_P(prop))) {
+ if (!prop || (ZEND_TYPE_IS_SET(prop_info->type) && Z_ISUNDEF_P(prop))) {
continue;
}
@@ -3768,7 +3860,7 @@ ZEND_METHOD(reflection_class, getStaticProperties)
zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
@@ -3792,7 +3884,7 @@ ZEND_METHOD(reflection_class, getStaticPropertyValue)
zval *prop, *def_value = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|z", &name, &def_value) == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
@@ -3826,7 +3918,7 @@ ZEND_METHOD(reflection_class, setStaticPropertyValue)
zval *variable_ptr, *value;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sz", &name, &value) == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
@@ -3839,7 +3931,7 @@ ZEND_METHOD(reflection_class, setStaticPropertyValue)
zend_clear_exception();
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Class %s does not have a property named %s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
- return;
+ RETURN_THROWS();
}
if (Z_ISREF_P(variable_ptr)) {
@@ -3851,7 +3943,7 @@ ZEND_METHOD(reflection_class, setStaticPropertyValue)
}
}
- if (prop_info->type && !zend_verify_property_type(prop_info, value, 0)) {
+ if (ZEND_TYPE_IS_SET(prop_info->type) && !zend_verify_property_type(prop_info, value, 0)) {
return;
}
@@ -3869,7 +3961,7 @@ ZEND_METHOD(reflection_class, getDefaultProperties)
zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
array_init(return_value);
@@ -3890,7 +3982,7 @@ ZEND_METHOD(reflection_class, __toString)
smart_str str = {0};
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
_class_string(&str, ce, &intern->obj, "");
@@ -3903,7 +3995,7 @@ ZEND_METHOD(reflection_class, __toString)
ZEND_METHOD(reflection_class, getName)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
_default_get_name(ZEND_THIS, return_value);
}
@@ -3917,7 +4009,7 @@ ZEND_METHOD(reflection_class, isInternal)
zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
RETURN_BOOL(ce->type == ZEND_INTERNAL_CLASS);
@@ -3932,7 +4024,7 @@ ZEND_METHOD(reflection_class, isUserDefined)
zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
RETURN_BOOL(ce->type == ZEND_USER_CLASS);
@@ -3947,7 +4039,7 @@ ZEND_METHOD(reflection_class, isAnonymous)
zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
RETURN_BOOL(ce->ce_flags & ZEND_ACC_ANON_CLASS);
@@ -3962,7 +4054,7 @@ ZEND_METHOD(reflection_class, getFileName)
zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
if (ce->type == ZEND_USER_CLASS) {
@@ -3980,7 +4072,7 @@ ZEND_METHOD(reflection_class, getStartLine)
zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
if (ce->type == ZEND_USER_CLASS) {
@@ -3998,7 +4090,7 @@ ZEND_METHOD(reflection_class, getEndLine)
zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
if (ce->type == ZEND_USER_CLASS) {
@@ -4016,7 +4108,7 @@ ZEND_METHOD(reflection_class, getDocComment)
zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
if (ce->type == ZEND_USER_CLASS && ce->info.user.doc_comment) {
@@ -4034,7 +4126,7 @@ ZEND_METHOD(reflection_class, getConstructor)
zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
@@ -4055,7 +4147,7 @@ ZEND_METHOD(reflection_class, hasMethod)
zend_string *name, *lc_name;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &name) == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
@@ -4076,7 +4168,7 @@ ZEND_METHOD(reflection_class, getMethod)
zend_string *name, *lc_name;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &name) == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
@@ -4125,7 +4217,7 @@ ZEND_METHOD(reflection_class, getMethods)
zend_bool filter_is_null = 1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l!", &filter, &filter_is_null) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (filter_is_null) {
@@ -4168,10 +4260,9 @@ ZEND_METHOD(reflection_class, hasProperty)
zend_property_info *property_info;
zend_class_entry *ce;
zend_string *name;
- zval property;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &name) == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
@@ -4182,12 +4273,9 @@ ZEND_METHOD(reflection_class, hasProperty)
RETURN_TRUE;
} else {
if (Z_TYPE(intern->obj) != IS_UNDEF) {
- ZVAL_STR_COPY(&property, name);
- if (Z_OBJ_HANDLER(intern->obj, has_property)(&intern->obj, &property, 2, NULL)) {
- zval_ptr_dtor(&property);
+ if (Z_OBJ_HANDLER(intern->obj, has_property)(Z_OBJ(intern->obj), name, 2, NULL)) {
RETURN_TRUE;
}
- zval_ptr_dtor(&property);
}
RETURN_FALSE;
}
@@ -4206,25 +4294,19 @@ ZEND_METHOD(reflection_class, getProperty)
size_t classname_len, str_name_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &name) == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
if ((property_info = zend_hash_find_ptr(&ce->properties_info, name)) != NULL) {
if (!(property_info->flags & ZEND_ACC_PRIVATE) || property_info->ce == ce) {
- reflection_property_factory(ce, name, property_info, return_value, 0);
+ reflection_property_factory(ce, name, property_info, return_value);
return;
}
} else if (Z_TYPE(intern->obj) != IS_UNDEF) {
/* Check for dynamic properties */
- if (zend_hash_exists(Z_OBJ_HT(intern->obj)->get_properties(&intern->obj), name)) {
- zend_property_info property_info_tmp;
- property_info_tmp.flags = ZEND_ACC_PUBLIC;
- property_info_tmp.name = name;
- property_info_tmp.doc_comment = NULL;
- property_info_tmp.ce = ce;
-
- reflection_property_factory(ce, name, &property_info_tmp, return_value, 1);
+ if (zend_hash_exists(Z_OBJ_HT(intern->obj)->get_properties(Z_OBJ(intern->obj)), name)) {
+ reflection_property_factory(ce, name, NULL, return_value);
return;
}
}
@@ -4243,13 +4325,13 @@ ZEND_METHOD(reflection_class, getProperty)
zend_throw_exception_ex(reflection_exception_ptr, -1, "Class %s does not exist", ZSTR_VAL(classname));
}
zend_string_release_ex(classname, 0);
- return;
+ RETURN_THROWS();
}
zend_string_release_ex(classname, 0);
if (!instanceof_function(ce, ce2)) {
zend_throw_exception_ex(reflection_exception_ptr, -1, "Fully qualified property name %s::%s does not specify a base class of %s", ZSTR_VAL(ce2->name), str_name, ZSTR_VAL(ce->name));
- return;
+ RETURN_THROWS();
}
ce = ce2;
@@ -4275,7 +4357,7 @@ static void _addproperty(zend_property_info *pptr, zend_string *key, zend_class_
if (pptr->flags & filter) {
zval property;
- reflection_property_factory(ce, key, pptr, &property, 0);
+ reflection_property_factory(ce, key, pptr, &property);
add_next_index_zval(retval, &property);
}
}
@@ -4284,7 +4366,6 @@ static void _addproperty(zend_property_info *pptr, zend_string *key, zend_class_
/* {{{ _adddynproperty */
static void _adddynproperty(zval *ptr, zend_string *key, zend_class_entry *ce, zval *retval)
{
- zend_property_info property_info;
zval property;
/* under some circumstances, the properties hash table may contain numeric
@@ -4299,12 +4380,7 @@ static void _adddynproperty(zval *ptr, zend_string *key, zend_class_entry *ce, z
return;
}
- property_info.doc_comment = NULL;
- property_info.flags = ZEND_ACC_PUBLIC;
- property_info.name = key;
- property_info.ce = ce;
- property_info.offset = -1;
- reflection_property_factory(ce, key, &property_info, &property, 1);
+ reflection_property_factory(ce, key, NULL, &property);
add_next_index_zval(retval, &property);
}
/* }}} */
@@ -4321,7 +4397,7 @@ ZEND_METHOD(reflection_class, getProperties)
zend_bool filter_is_null = 1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l!", &filter, &filter_is_null) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (filter_is_null) {
@@ -4336,7 +4412,7 @@ ZEND_METHOD(reflection_class, getProperties)
} ZEND_HASH_FOREACH_END();
if (Z_TYPE(intern->obj) != IS_UNDEF && (filter & ZEND_ACC_PUBLIC) != 0) {
- HashTable *properties = Z_OBJ_HT(intern->obj)->get_properties(&intern->obj);
+ HashTable *properties = Z_OBJ_HT(intern->obj)->get_properties(Z_OBJ(intern->obj));
zval *prop;
ZEND_HASH_FOREACH_STR_KEY_VAL(properties, key, prop) {
_adddynproperty(prop, key, ce, return_value);
@@ -4354,7 +4430,7 @@ ZEND_METHOD(reflection_class, hasConstant)
zend_string *name;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &name) == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
@@ -4377,7 +4453,7 @@ ZEND_METHOD(reflection_class, getConstants)
zval val;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
array_init(return_value);
@@ -4402,7 +4478,7 @@ ZEND_METHOD(reflection_class, getReflectionConstants)
zend_class_constant *constant;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
array_init(return_value);
@@ -4424,7 +4500,7 @@ ZEND_METHOD(reflection_class, getConstant)
zend_string *name;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &name) == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
@@ -4451,7 +4527,7 @@ ZEND_METHOD(reflection_class, getReflectionConstant)
GET_REFLECTION_OBJECT_PTR(ce);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &name) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((constant = zend_hash_find_ptr(&ce->constants_table, name)) == NULL) {
@@ -4468,7 +4544,7 @@ static void _class_check_flag(INTERNAL_FUNCTION_PARAMETERS, int mask)
zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
RETVAL_BOOL(ce->ce_flags & mask);
@@ -4483,7 +4559,7 @@ ZEND_METHOD(reflection_class, isInstantiable)
zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
if (ce->ce_flags & (ZEND_ACC_INTERFACE | ZEND_ACC_TRAIT | ZEND_ACC_EXPLICIT_ABSTRACT_CLASS | ZEND_ACC_IMPLICIT_ABSTRACT_CLASS)) {
@@ -4509,7 +4585,7 @@ ZEND_METHOD(reflection_class, isCloneable)
zval obj;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
if (ce->ce_flags & (ZEND_ACC_INTERFACE | ZEND_ACC_TRAIT | ZEND_ACC_EXPLICIT_ABSTRACT_CLASS | ZEND_ACC_IMPLICIT_ABSTRACT_CLASS)) {
@@ -4579,7 +4655,7 @@ ZEND_METHOD(reflection_class, getModifiers)
| ZEND_ACC_EXPLICIT_ABSTRACT_CLASS;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
@@ -4596,14 +4672,14 @@ ZEND_METHOD(reflection_class, isInstance)
zval *object;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &object) == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
RETURN_BOOL(instanceof_function(Z_OBJCE_P(object), ce));
}
/* }}} */
-/* {{{ proto public object ReflectionClass::newInstance(mixed* args, ...)
+/* {{{ proto public object ReflectionClass::newInstance([mixed* args], ...)
Returns an instance of this class */
ZEND_METHOD(reflection_class, newInstance)
{
@@ -4638,7 +4714,7 @@ ZEND_METHOD(reflection_class, newInstance)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "*", &params, &num_args) == FAILURE) {
zval_ptr_dtor(return_value);
- RETURN_FALSE;
+ RETURN_THROWS();
}
for (i = 0; i < num_args; i++) {
@@ -4686,10 +4762,14 @@ ZEND_METHOD(reflection_class, newInstanceWithoutConstructor)
GET_REFLECTION_OBJECT_PTR(ce);
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
if (ce->type == ZEND_INTERNAL_CLASS
&& ce->create_object != NULL && (ce->ce_flags & ZEND_ACC_FINAL)) {
zend_throw_exception_ex(reflection_exception_ptr, 0, "Class %s is an internal class marked as final that cannot be instantiated without invoking its constructor", ZSTR_VAL(ce->name));
- return;
+ RETURN_THROWS();
}
object_init_ex(return_value, ce);
@@ -4710,7 +4790,7 @@ ZEND_METHOD(reflection_class, newInstanceArgs)
GET_REFLECTION_OBJECT_PTR(ce);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|h", &args) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (ZEND_NUM_ARGS() > 0) {
@@ -4791,7 +4871,7 @@ ZEND_METHOD(reflection_class, getInterfaces)
zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
@@ -4820,7 +4900,7 @@ ZEND_METHOD(reflection_class, getInterfaceNames)
uint32_t i;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
@@ -4847,7 +4927,7 @@ ZEND_METHOD(reflection_class, getTraits)
uint32_t i;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
@@ -4879,7 +4959,7 @@ ZEND_METHOD(reflection_class, getTraitNames)
uint32_t i;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
@@ -4903,7 +4983,7 @@ ZEND_METHOD(reflection_class, getTraitAliases)
zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
@@ -4938,7 +5018,7 @@ ZEND_METHOD(reflection_class, getParentClass)
zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
@@ -4961,7 +5041,7 @@ ZEND_METHOD(reflection_class, isSubclassOf)
GET_REFLECTION_OBJECT_PTR(ce);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &class_name) == FAILURE) {
- return;
+ RETURN_THROWS();
}
switch (Z_TYPE_P(class_name)) {
@@ -4969,7 +5049,7 @@ ZEND_METHOD(reflection_class, isSubclassOf)
if ((class_ce = zend_lookup_class(Z_STR_P(class_name))) == NULL) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Class %s does not exist", Z_STRVAL_P(class_name));
- return;
+ RETURN_THROWS();
}
break;
case IS_OBJECT:
@@ -4977,7 +5057,7 @@ ZEND_METHOD(reflection_class, isSubclassOf)
argument = Z_REFLECTION_P(class_name);
if (argument->ptr == NULL) {
zend_throw_error(NULL, "Internal error: Failed to retrieve the argument's reflection object");
- return;
+ RETURN_THROWS();
}
class_ce = argument->ptr;
break;
@@ -4986,7 +5066,7 @@ ZEND_METHOD(reflection_class, isSubclassOf)
default:
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Parameter one must either be a string or a ReflectionClass object");
- return;
+ RETURN_THROWS();
}
RETURN_BOOL((ce != class_ce && instanceof_function(ce, class_ce)));
@@ -5004,7 +5084,7 @@ ZEND_METHOD(reflection_class, implementsInterface)
GET_REFLECTION_OBJECT_PTR(ce);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &interface) == FAILURE) {
- return;
+ RETURN_THROWS();
}
switch (Z_TYPE_P(interface)) {
@@ -5012,7 +5092,7 @@ ZEND_METHOD(reflection_class, implementsInterface)
if ((interface_ce = zend_lookup_class(Z_STR_P(interface))) == NULL) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Interface %s does not exist", Z_STRVAL_P(interface));
- return;
+ RETURN_THROWS();
}
break;
case IS_OBJECT:
@@ -5020,7 +5100,7 @@ ZEND_METHOD(reflection_class, implementsInterface)
argument = Z_REFLECTION_P(interface);
if (argument->ptr == NULL) {
zend_throw_error(NULL, "Internal error: Failed to retrieve the argument's reflection object");
- return;
+ RETURN_THROWS();
}
interface_ce = argument->ptr;
break;
@@ -5029,13 +5109,13 @@ ZEND_METHOD(reflection_class, implementsInterface)
default:
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Parameter one must either be a string or a ReflectionClass object");
- return;
+ RETURN_THROWS();
}
if (!(interface_ce->ce_flags & ZEND_ACC_INTERFACE)) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"%s is not an interface", ZSTR_VAL(interface_ce->name));
- return;
+ RETURN_THROWS();
}
RETURN_BOOL(instanceof_function(ce, interface_ce));
}
@@ -5049,7 +5129,7 @@ ZEND_METHOD(reflection_class, isIterable)
zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
@@ -5071,7 +5151,7 @@ ZEND_METHOD(reflection_class, getExtension)
zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
@@ -5090,7 +5170,7 @@ ZEND_METHOD(reflection_class, getExtensionName)
zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ce);
@@ -5111,7 +5191,7 @@ ZEND_METHOD(reflection_class, inNamespace)
const char *backslash;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((name = _default_load_name(ZEND_THIS)) == NULL) {
RETURN_FALSE;
@@ -5134,7 +5214,7 @@ ZEND_METHOD(reflection_class, getNamespaceName)
const char *backslash;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((name = _default_load_name(ZEND_THIS)) == NULL) {
RETURN_FALSE;
@@ -5157,7 +5237,7 @@ ZEND_METHOD(reflection_class, getShortName)
const char *backslash;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((name = _default_load_name(ZEND_THIS)) == NULL) {
RETURN_FALSE;
@@ -5217,8 +5297,8 @@ ZEND_METHOD(reflection_property, __construct)
zend_property_info *property_info = NULL;
property_reference *reference;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "zS", &classname, &name) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "zS", &classname, &name) == FAILURE) {
+ RETURN_THROWS();
}
object = ZEND_THIS;
@@ -5230,7 +5310,7 @@ ZEND_METHOD(reflection_property, __construct)
if ((ce = zend_lookup_class(Z_STR_P(classname))) == NULL) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Class %s does not exist", Z_STRVAL_P(classname));
- return;
+ RETURN_THROWS();
}
break;
@@ -5240,7 +5320,7 @@ ZEND_METHOD(reflection_property, __construct)
default:
_DO_THROW("The parameter class is expected to be either a string or an object");
- return;
+ RETURN_THROWS();
}
property_info = zend_hash_find_ptr(&ce->properties_info, name);
@@ -5249,25 +5329,13 @@ ZEND_METHOD(reflection_property, __construct)
&& property_info->ce != ce)) {
/* Check for dynamic properties */
if (property_info == NULL && Z_TYPE_P(classname) == IS_OBJECT) {
- if (zend_hash_exists(Z_OBJ_HT_P(classname)->get_properties(classname), name)) {
+ if (zend_hash_exists(Z_OBJ_HT_P(classname)->get_properties(Z_OBJ_P(classname)), name)) {
dynam_prop = 1;
}
}
if (dynam_prop == 0) {
zend_throw_exception_ex(reflection_exception_ptr, 0, "Property %s::$%s does not exist", ZSTR_VAL(ce->name), ZSTR_VAL(name));
- return;
- }
- }
-
- if (dynam_prop == 0 && (property_info->flags & ZEND_ACC_PRIVATE) == 0) {
- /* we have to search the class hierarchy for this (implicit) public or protected property */
- zend_class_entry *tmp_ce = ce;
- zend_property_info *tmp_info;
-
- while (tmp_ce && (tmp_info = zend_hash_find_ptr(&tmp_ce->properties_info, name)) == NULL) {
- ce = tmp_ce;
- property_info = tmp_info;
- tmp_ce = tmp_ce->parent;
+ RETURN_THROWS();
}
}
@@ -5279,16 +5347,7 @@ ZEND_METHOD(reflection_property, __construct)
}
reference = (property_reference*) emalloc(sizeof(property_reference));
- if (dynam_prop) {
- reference->prop.flags = ZEND_ACC_PUBLIC;
- reference->prop.name = name;
- reference->prop.doc_comment = NULL;
- reference->prop.ce = ce;
- reference->dynamic = 1;
- } else {
- reference->prop = *property_info;
- reference->dynamic = 0;
- }
+ reference->prop = dynam_prop ? NULL : property_info;
reference->unmangled_name = zend_string_copy(name);
intern->ptr = reference;
intern->ref_type = REF_TYPE_PROPERTY;
@@ -5306,10 +5365,10 @@ ZEND_METHOD(reflection_property, __toString)
smart_str str = {0};
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ref);
- _property_string(&str, &ref->prop, ZSTR_VAL(ref->unmangled_name), "", ref->dynamic);
+ _property_string(&str, ref->prop, ZSTR_VAL(ref->unmangled_name), "");
RETURN_STR(smart_str_extract(&str));
}
/* }}} */
@@ -5319,7 +5378,7 @@ ZEND_METHOD(reflection_property, __toString)
ZEND_METHOD(reflection_property, getName)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
_default_get_name(ZEND_THIS, return_value);
}
@@ -5331,10 +5390,10 @@ static void _property_check_flag(INTERNAL_FUNCTION_PARAMETERS, int mask) /* {{{
property_reference *ref;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ref);
- RETURN_BOOL(ref->prop.flags & mask);
+ RETURN_BOOL(prop_get_flags(ref) & mask);
}
/* }}} */
@@ -5378,10 +5437,10 @@ ZEND_METHOD(reflection_property, isDefault)
property_reference *ref;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ref);
- RETURN_BOOL(!ref->dynamic);
+ RETURN_BOOL(ref->prop != NULL);
}
/* }}} */
@@ -5394,11 +5453,11 @@ ZEND_METHOD(reflection_property, getModifiers)
uint32_t keep_flags = ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ref);
- RETURN_LONG((ref->prop.flags & keep_flags));
+ RETURN_LONG(prop_get_flags(ref) & keep_flags);
}
/* }}} */
@@ -5408,19 +5467,23 @@ ZEND_METHOD(reflection_property, getValue)
{
reflection_object *intern;
property_reference *ref;
- zval *object, *name;
+ zval *object = NULL, *name;
zval *member_p = NULL;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|o!", &object) == FAILURE) {
+ RETURN_THROWS();
+ }
+
GET_REFLECTION_OBJECT_PTR(ref);
- if (!(ref->prop.flags & ZEND_ACC_PUBLIC) && intern->ignore_visibility == 0) {
+ if (!(prop_get_flags(ref) & ZEND_ACC_PUBLIC) && intern->ignore_visibility == 0) {
name = _default_load_name(ZEND_THIS);
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Cannot access non-public member %s::$%s", ZSTR_VAL(intern->ce->name), Z_STRVAL_P(name));
- return;
+ RETURN_THROWS();
}
- if (ref->prop.flags & ZEND_ACC_STATIC) {
+ if (prop_get_flags(ref) & ZEND_ACC_STATIC) {
member_p = zend_read_static_property_ex(intern->ce, ref->unmangled_name, 0);
if (member_p) {
ZVAL_COPY_DEREF(return_value, member_p);
@@ -5428,13 +5491,15 @@ ZEND_METHOD(reflection_property, getValue)
} else {
zval rv;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &object) == FAILURE) {
- return;
+ if (!object) {
+ zend_type_error("No object provided for getValue() on instance property");
+ RETURN_THROWS();
}
- if (!instanceof_function(Z_OBJCE_P(object), ref->prop.ce)) {
+ /* TODO: Should this always use intern->ce? */
+ if (!instanceof_function(Z_OBJCE_P(object), ref->prop ? ref->prop->ce : intern->ce)) {
_DO_THROW("Given object is not an instance of the class this property was declared in");
- return;
+ RETURN_THROWS();
}
member_p = zend_read_property_ex(intern->ce, object, ref->unmangled_name, 0, &rv);
@@ -5462,24 +5527,24 @@ ZEND_METHOD(reflection_property, setValue)
GET_REFLECTION_OBJECT_PTR(ref);
- if (!(ref->prop.flags & ZEND_ACC_PUBLIC) && intern->ignore_visibility == 0) {
+ if (!(prop_get_flags(ref) & ZEND_ACC_PUBLIC) && intern->ignore_visibility == 0) {
name = _default_load_name(ZEND_THIS);
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Cannot access non-public member %s::$%s", ZSTR_VAL(intern->ce->name), Z_STRVAL_P(name));
- return;
+ RETURN_THROWS();
}
- if (ref->prop.flags & ZEND_ACC_STATIC) {
+ if (prop_get_flags(ref) & ZEND_ACC_STATIC) {
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "z", &value) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &tmp, &value) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
zend_update_static_property_ex(intern->ce, ref->unmangled_name, value);
} else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "oz", &object, &value) == FAILURE) {
- return;
+ RETURN_THROWS();
}
zend_update_property_ex(intern->ce, object, ref->unmangled_name, value);
@@ -5493,42 +5558,46 @@ ZEND_METHOD(reflection_property, isInitialized)
{
reflection_object *intern;
property_reference *ref;
- zval *object, *name;
+ zval *object = NULL, *name;
zval *member_p = NULL;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|o!", &object) == FAILURE) {
+ RETURN_THROWS();
+ }
+
GET_REFLECTION_OBJECT_PTR(ref);
- if (!(ref->prop.flags & ZEND_ACC_PUBLIC) && intern->ignore_visibility == 0) {
+ if (!(prop_get_flags(ref) & ZEND_ACC_PUBLIC) && intern->ignore_visibility == 0) {
name = _default_load_name(getThis());
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Cannot access non-public member %s::$%s", ZSTR_VAL(intern->ce->name), Z_STRVAL_P(name));
- return;
+ RETURN_THROWS();
}
- if (ref->prop.flags & ZEND_ACC_STATIC) {
+ if (prop_get_flags(ref) & ZEND_ACC_STATIC) {
member_p = zend_read_static_property_ex(intern->ce, ref->unmangled_name, 1);
if (member_p) {
- RETURN_BOOL(!Z_ISUNDEF_P(member_p))
+ RETURN_BOOL(!Z_ISUNDEF_P(member_p));
}
RETURN_FALSE;
} else {
- zval name_zv;
zend_class_entry *old_scope;
int retval;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &object) == FAILURE) {
- return;
+ if (!object) {
+ zend_type_error("No object provided for isInitialized() on instance property");
+ RETURN_THROWS();
}
- if (!instanceof_function(Z_OBJCE_P(object), ref->prop.ce)) {
+ /* TODO: Should this always use intern->ce? */
+ if (!instanceof_function(Z_OBJCE_P(object), ref->prop ? ref->prop->ce : intern->ce)) {
_DO_THROW("Given object is not an instance of the class this property was declared in");
- return;
+ RETURN_THROWS();
}
old_scope = EG(fake_scope);
EG(fake_scope) = intern->ce;
- ZVAL_STR(&name_zv, ref->unmangled_name);
- retval = Z_OBJ_HT_P(object)->has_property(object, &name_zv, ZEND_PROPERTY_EXISTS, NULL);
+ retval = Z_OBJ_HT_P(object)->has_property(Z_OBJ_P(object), ref->unmangled_name, ZEND_PROPERTY_EXISTS, NULL);
EG(fake_scope) = old_scope;
RETVAL_BOOL(retval);
@@ -5542,28 +5611,14 @@ ZEND_METHOD(reflection_property, getDeclaringClass)
{
reflection_object *intern;
property_reference *ref;
- zend_class_entry *tmp_ce, *ce;
- zend_property_info *tmp_info;
+ zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ref);
- ce = tmp_ce = intern->ce;
- while (tmp_ce && (tmp_info = zend_hash_find_ptr(&tmp_ce->properties_info, ref->unmangled_name)) != NULL) {
- if (tmp_info->flags & ZEND_ACC_PRIVATE) {
- /* it's a private property, so it can't be inherited */
- break;
- }
- ce = tmp_ce;
- if (tmp_ce == tmp_info->ce) {
- /* declared in this class, done */
- break;
- }
- tmp_ce = tmp_ce->parent;
- }
-
+ ce = ref->prop ? ref->prop->ce : intern->ce;
zend_reflection_class_factory(ce, return_value);
}
/* }}} */
@@ -5576,11 +5631,11 @@ ZEND_METHOD(reflection_property, getDocComment)
property_reference *ref;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ref);
- if (ref->prop.doc_comment) {
- RETURN_STR_COPY(ref->prop.doc_comment);
+ if (ref->prop && ref->prop->doc_comment) {
+ RETURN_STR_COPY(ref->prop->doc_comment);
}
RETURN_FALSE;
}
@@ -5594,7 +5649,7 @@ ZEND_METHOD(reflection_property, setAccessible)
zend_bool visible;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &visible) == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern = Z_REFLECTION_P(ZEND_THIS);
@@ -5611,16 +5666,16 @@ ZEND_METHOD(reflection_property, getType)
property_reference *ref;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ref);
- if (!ZEND_TYPE_IS_SET(ref->prop.type)) {
+ if (!ref->prop || !ZEND_TYPE_IS_SET(ref->prop->type)) {
RETURN_NULL();
}
- reflection_type_factory(ref->prop.type, return_value);
+ reflection_type_factory(ref->prop->type, return_value, 1);
}
/* }}} */
@@ -5632,12 +5687,96 @@ ZEND_METHOD(reflection_property, hasType)
property_reference *ref;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
+ }
+
+ GET_REFLECTION_OBJECT_PTR(ref);
+
+ RETVAL_BOOL(ref->prop && ZEND_TYPE_IS_SET(ref->prop->type));
+}
+/* }}} */
+
+/* {{{ proto public bool ReflectionProperty::hasDefaultValue()
+ Returns whether property has a default value */
+ZEND_METHOD(reflection_property, hasDefaultValue)
+{
+ reflection_object *intern;
+ property_reference *ref;
+ zend_property_info *prop_info;
+ zval *prop;
+ zend_class_entry *ce;
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
+ GET_REFLECTION_OBJECT_PTR(ref);
+
+ prop_info = ref->prop;
+
+ if (prop_info == NULL) {
+ RETURN_FALSE;
+ }
+
+ ce = prop_info->ce;
+
+ if ((prop_info->flags & ZEND_ACC_STATIC) != 0) {
+ prop = &ce->default_static_members_table[prop_info->offset];
+ ZVAL_DEINDIRECT(prop);
+ } else {
+ prop = &ce->default_properties_table[OBJ_PROP_TO_NUM(prop_info->offset)];
+ }
+
+ RETURN_BOOL(!Z_ISUNDEF_P(prop));
+}
+/* }}} */
+
+/* {{{ proto public mixed ReflectionProperty::getDefaultValue()
+ Returns the default value of a property */
+ZEND_METHOD(reflection_property, getDefaultValue)
+{
+ reflection_object *intern;
+ property_reference *ref;
+ zend_property_info *prop_info;
+ zval *prop;
+ zend_class_entry *ce;
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(ref);
- RETVAL_BOOL(ZEND_TYPE_IS_SET(ref->prop.type));
+ prop_info = ref->prop;
+
+ if (prop_info == NULL) {
+ return; // throw exception?
+ }
+
+ ce = prop_info->ce;
+
+ if ((prop_info->flags & ZEND_ACC_STATIC) != 0) {
+ prop = &ce->default_static_members_table[prop_info->offset];
+ ZVAL_DEINDIRECT(prop);
+ } else {
+ prop = &ce->default_properties_table[OBJ_PROP_TO_NUM(prop_info->offset)];
+ }
+
+ if (Z_ISUNDEF_P(prop)) {
+ return;
+ }
+
+ /* copy: enforce read only access */
+ ZVAL_DEREF(prop);
+ ZVAL_COPY_OR_DUP(return_value, prop);
+
+ /* this is necessary to make it able to work with default array
+ * properties, returned to user */
+ if (Z_TYPE_P(return_value) == IS_CONSTANT_AST) {
+ if (UNEXPECTED(zval_update_constant_ex(return_value, ce) != SUCCESS)) {
+ RETURN_THROWS();
+ }
+ }
}
/* }}} */
@@ -5661,8 +5800,8 @@ ZEND_METHOD(reflection_extension, __construct)
size_t name_len;
ALLOCA_FLAG(use_heap)
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "s", &name_str, &name_len) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name_str, &name_len) == FAILURE) {
+ RETURN_THROWS();
}
object = ZEND_THIS;
@@ -5673,7 +5812,7 @@ ZEND_METHOD(reflection_extension, __construct)
free_alloca(lcname, use_heap);
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Extension %s does not exist", name_str);
- return;
+ RETURN_THROWS();
}
free_alloca(lcname, use_heap);
ZVAL_STRING(reflection_prop_name(object), module->name);
@@ -5692,7 +5831,7 @@ ZEND_METHOD(reflection_extension, __toString)
smart_str str = {0};
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(module);
_extension_string(&str, module, "");
@@ -5705,7 +5844,7 @@ ZEND_METHOD(reflection_extension, __toString)
ZEND_METHOD(reflection_extension, getName)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
_default_get_name(ZEND_THIS, return_value);
}
@@ -5719,7 +5858,7 @@ ZEND_METHOD(reflection_extension, getVersion)
zend_module_entry *module;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(module);
@@ -5742,7 +5881,7 @@ ZEND_METHOD(reflection_extension, getFunctions)
zend_function *fptr;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(module);
@@ -5766,7 +5905,7 @@ ZEND_METHOD(reflection_extension, getConstants)
zend_constant *constant;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(module);
@@ -5805,7 +5944,7 @@ ZEND_METHOD(reflection_extension, getINIEntries)
zend_ini_entry *ini_entry;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(module);
@@ -5850,7 +5989,7 @@ ZEND_METHOD(reflection_extension, getClasses)
zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(module);
@@ -5871,7 +6010,7 @@ ZEND_METHOD(reflection_extension, getClassNames)
zend_class_entry *ce;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(module);
@@ -5891,7 +6030,7 @@ ZEND_METHOD(reflection_extension, getDependencies)
const zend_module_dep *dep;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(module);
@@ -5956,7 +6095,7 @@ ZEND_METHOD(reflection_extension, info)
zend_module_entry *module;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(module);
@@ -5972,7 +6111,7 @@ ZEND_METHOD(reflection_extension, isPersistent)
zend_module_entry *module;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(module);
@@ -5988,7 +6127,7 @@ ZEND_METHOD(reflection_extension, isTemporary)
zend_module_entry *module;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(module);
@@ -6014,8 +6153,8 @@ ZEND_METHOD(reflection_zend_extension, __construct)
char *name_str;
size_t name_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "s", &name_str, &name_len) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name_str, &name_len) == FAILURE) {
+ RETURN_THROWS();
}
object = ZEND_THIS;
@@ -6025,7 +6164,7 @@ ZEND_METHOD(reflection_zend_extension, __construct)
if (!extension) {
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Zend Extension %s does not exist", name_str);
- return;
+ RETURN_THROWS();
}
ZVAL_STRING(reflection_prop_name(object), extension->name);
intern->ptr = extension;
@@ -6043,7 +6182,7 @@ ZEND_METHOD(reflection_zend_extension, __toString)
smart_str str = {0};
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(extension);
_zend_extension_string(&str, extension, "");
@@ -6059,7 +6198,7 @@ ZEND_METHOD(reflection_zend_extension, getName)
zend_extension *extension;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(extension);
@@ -6075,7 +6214,7 @@ ZEND_METHOD(reflection_zend_extension, getVersion)
zend_extension *extension;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(extension);
@@ -6095,7 +6234,7 @@ ZEND_METHOD(reflection_zend_extension, getAuthor)
zend_extension *extension;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(extension);
@@ -6115,7 +6254,7 @@ ZEND_METHOD(reflection_zend_extension, getURL)
zend_extension *extension;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(extension);
@@ -6135,7 +6274,7 @@ ZEND_METHOD(reflection_zend_extension, getCopyright)
zend_extension *extension;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
GET_REFLECTION_OBJECT_PTR(extension);
@@ -6176,8 +6315,8 @@ ZEND_METHOD(reflection_reference, fromArrayElement)
zval *key, *item;
reflection_object *intern;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "hz", &ht, &key) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "hz", &ht, &key) == FAILURE) {
+ RETURN_THROWS();
}
if (Z_TYPE_P(key) == IS_LONG) {
@@ -6186,12 +6325,12 @@ ZEND_METHOD(reflection_reference, fromArrayElement)
item = zend_symtable_find(ht, Z_STR_P(key));
} else {
zend_type_error("Key must be array or string");
- return;
+ RETURN_THROWS();
}
if (!item) {
_DO_THROW("Array key not found");
- return;
+ RETURN_THROWS();
}
if (Z_TYPE_P(item) != IS_REFERENCE || is_ignorable_reference(ht, item)) {
@@ -6215,18 +6354,18 @@ ZEND_METHOD(reflection_reference, getId)
PHP_SHA1_CTX context;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern = Z_REFLECTION_P(getThis());
if (Z_TYPE(intern->obj) != IS_REFERENCE) {
_DO_THROW("Corrupted ReflectionReference object");
- return;
+ RETURN_THROWS();
}
if (!REFLECTION_G(key_initialized)) {
if (php_random_bytes_throw(&REFLECTION_G(key_initialized), 16) == FAILURE) {
- return;
+ RETURN_THROWS();
}
REFLECTION_G(key_initialized) = 1;
@@ -6247,493 +6386,279 @@ static const zend_function_entry reflection_exception_functions[] = {
PHP_FE_END
};
-ZEND_BEGIN_ARG_INFO(arginfo_reflection__void, 0)
-ZEND_END_ARG_INFO()
-
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_getModifierNames, 0)
- ZEND_ARG_INFO(0, modifiers)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_export, 0, 0, 1)
- ZEND_ARG_OBJ_INFO(0, reflector, Reflector, 0)
- ZEND_ARG_INFO(0, return)
-ZEND_END_ARG_INFO()
-
static const zend_function_entry reflection_functions[] = {
- ZEND_ME(reflection, getModifierNames, arginfo_reflection_getModifierNames, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- ZEND_DEP_ME(reflection, export, arginfo_reflection_export, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_ME(reflection, getModifierNames, arginfo_class_Reflection_getModifierNames, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_DEP_ME(reflection, export, arginfo_class_Reflection_export, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
PHP_FE_END
};
static const zend_function_entry reflector_functions[] = {
- ZEND_ABSTRACT_ME(reflector, __toString, arginfo_reflection__void)
+ ZEND_ABSTRACT_ME(reflector, __toString, arginfo_class_Reflector___toString)
PHP_FE_END
};
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_function_export, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, return)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_function___construct, 0)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_function_invoke, 0, 0, 0)
- ZEND_ARG_INFO(0, args)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_function_invokeArgs, 0)
- ZEND_ARG_ARRAY_INFO(0, args, 0)
-ZEND_END_ARG_INFO()
-
static const zend_function_entry reflection_function_abstract_functions[] = {
- ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
- ZEND_ME(reflection_function, inNamespace, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, isClosure, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, isDeprecated, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, isInternal, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, isUserDefined, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, isGenerator, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, isVariadic, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, getClosureThis, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, getClosureScopeClass, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, getDocComment, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, getEndLine, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, getExtension, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, getExtensionName, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, getFileName, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, getName, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, getNamespaceName, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, getNumberOfParameters, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, getNumberOfRequiredParameters, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, getParameters, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, getShortName, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, getStartLine, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, getStaticVariables, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, returnsReference, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, hasReturnType, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, getReturnType, arginfo_reflection__void, 0)
+ ZEND_ME(reflection, __clone, arginfo_class_ReflectionFunctionAbstract___clone, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
+ ZEND_ME(reflection_function, inNamespace, arginfo_class_ReflectionFunctionAbstract_inNamespace, 0)
+ ZEND_ME(reflection_function, isClosure, arginfo_class_ReflectionFunctionAbstract_isClosure, 0)
+ ZEND_ME(reflection_function, isDeprecated, arginfo_class_ReflectionFunctionAbstract_isDeprecated, 0)
+ ZEND_ME(reflection_function, isInternal, arginfo_class_ReflectionFunctionAbstract_isInternal, 0)
+ ZEND_ME(reflection_function, isUserDefined, arginfo_class_ReflectionFunctionAbstract_isUserDefined, 0)
+ ZEND_ME(reflection_function, isGenerator, arginfo_class_ReflectionFunctionAbstract_isGenerator, 0)
+ ZEND_ME(reflection_function, isVariadic, arginfo_class_ReflectionFunctionAbstract_isVariadic, 0)
+ ZEND_ME(reflection_function, getClosureThis, arginfo_class_ReflectionFunctionAbstract_getClosureThis, 0)
+ ZEND_ME(reflection_function, getClosureScopeClass, arginfo_class_ReflectionFunctionAbstract_getClosureScopeClass, 0)
+ ZEND_ME(reflection_function, getDocComment, arginfo_class_ReflectionFunctionAbstract_getDocComment, 0)
+ ZEND_ME(reflection_function, getEndLine, arginfo_class_ReflectionFunctionAbstract_getEndLine, 0)
+ ZEND_ME(reflection_function, getExtension, arginfo_class_ReflectionFunctionAbstract_getExtension, 0)
+ ZEND_ME(reflection_function, getExtensionName, arginfo_class_ReflectionFunctionAbstract_getExtensionName, 0)
+ ZEND_ME(reflection_function, getFileName, arginfo_class_ReflectionFunctionAbstract_getFileName, 0)
+ ZEND_ME(reflection_function, getName, arginfo_class_ReflectionFunctionAbstract_getName, 0)
+ ZEND_ME(reflection_function, getNamespaceName, arginfo_class_ReflectionFunctionAbstract_getNamespaceName, 0)
+ ZEND_ME(reflection_function, getNumberOfParameters, arginfo_class_ReflectionFunctionAbstract_getNumberOfParameters, 0)
+ ZEND_ME(reflection_function, getNumberOfRequiredParameters, arginfo_class_ReflectionFunctionAbstract_getNumberOfRequiredParameters, 0)
+ ZEND_ME(reflection_function, getParameters, arginfo_class_ReflectionFunctionAbstract_getParameters, 0)
+ ZEND_ME(reflection_function, getShortName, arginfo_class_ReflectionFunctionAbstract_getShortName, 0)
+ ZEND_ME(reflection_function, getStartLine, arginfo_class_ReflectionFunctionAbstract_getStartLine, 0)
+ ZEND_ME(reflection_function, getStaticVariables, arginfo_class_ReflectionFunctionAbstract_getStaticVariables, 0)
+ ZEND_ME(reflection_function, returnsReference, arginfo_class_ReflectionFunctionAbstract_returnsReference, 0)
+ ZEND_ME(reflection_function, hasReturnType, arginfo_class_ReflectionFunctionAbstract_hasReturnType, 0)
+ ZEND_ME(reflection_function, getReturnType, arginfo_class_ReflectionFunctionAbstract_getReturnType, 0)
PHP_FE_END
};
static const zend_function_entry reflection_function_functions[] = {
- ZEND_ME(reflection_function, __construct, arginfo_reflection_function___construct, 0)
- ZEND_ME(reflection_function, __toString, arginfo_reflection__void, 0)
- ZEND_DEP_ME(reflection_function, export, arginfo_reflection_function_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
- ZEND_ME(reflection_function, isDisabled, arginfo_reflection__void, 0)
- ZEND_ME(reflection_function, invoke, arginfo_reflection_function_invoke, 0)
- ZEND_ME(reflection_function, invokeArgs, arginfo_reflection_function_invokeArgs, 0)
- ZEND_ME(reflection_function, getClosure, arginfo_reflection__void, 0)
+ ZEND_ME(reflection_function, __construct, arginfo_class_ReflectionFunction___construct, 0)
+ ZEND_ME(reflection_function, __toString, arginfo_class_ReflectionFunction___toString, 0)
+ ZEND_DEP_ME(reflection_function, export, arginfo_class_ReflectionFunction_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
+ ZEND_ME(reflection_function, isDisabled, arginfo_class_ReflectionFunction_isDisabled, 0)
+ ZEND_ME(reflection_function, invoke, arginfo_class_ReflectionFunction_invoke, 0)
+ ZEND_ME(reflection_function, invokeArgs, arginfo_class_ReflectionFunction_invokeArgs, 0)
+ ZEND_ME(reflection_function, getClosure, arginfo_class_ReflectionFunction_getClosure, 0)
PHP_FE_END
};
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_generator___construct, 0)
- ZEND_ARG_INFO(0, generator)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_generator_trace, 0, 0, 0)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
static const zend_function_entry reflection_generator_functions[] = {
- ZEND_ME(reflection_generator, __construct, arginfo_reflection_generator___construct, 0)
- ZEND_ME(reflection_generator, getExecutingLine, arginfo_reflection__void, 0)
- ZEND_ME(reflection_generator, getExecutingFile, arginfo_reflection__void, 0)
- ZEND_ME(reflection_generator, getTrace, arginfo_reflection_generator_trace, 0)
- ZEND_ME(reflection_generator, getFunction, arginfo_reflection__void, 0)
- ZEND_ME(reflection_generator, getThis, arginfo_reflection__void, 0)
- ZEND_ME(reflection_generator, getExecutingGenerator, arginfo_reflection__void, 0)
+ ZEND_ME(reflection_generator, __construct, arginfo_class_ReflectionGenerator___construct, 0)
+ ZEND_ME(reflection_generator, getExecutingLine, arginfo_class_ReflectionGenerator_getExecutingLine, 0)
+ ZEND_ME(reflection_generator, getExecutingFile, arginfo_class_ReflectionGenerator_getExecutingFile, 0)
+ ZEND_ME(reflection_generator, getTrace, arginfo_class_ReflectionGenerator_getTrace, 0)
+ ZEND_ME(reflection_generator, getFunction, arginfo_class_ReflectionGenerator_getFunction, 0)
+ ZEND_ME(reflection_generator, getThis, arginfo_class_ReflectionGenerator_getThis, 0)
+ ZEND_ME(reflection_generator, getExecutingGenerator, arginfo_class_ReflectionGenerator_getExecutingGenerator, 0)
PHP_FE_END
};
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_method_export, 0, 0, 2)
- ZEND_ARG_INFO(0, class)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, return)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_method___construct, 0, 0, 1)
- ZEND_ARG_INFO(0, class_or_method)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_method_invoke, 0)
- ZEND_ARG_INFO(0, object)
- ZEND_ARG_INFO(0, args)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_method_invokeArgs, 0)
- ZEND_ARG_INFO(0, object)
- ZEND_ARG_ARRAY_INFO(0, args, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_method_setAccessible, 0)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_method_getClosure, 0, 0, 0)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
static const zend_function_entry reflection_method_functions[] = {
- ZEND_DEP_ME(reflection_method, export, arginfo_reflection_method_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
- ZEND_ME(reflection_method, __construct, arginfo_reflection_method___construct, 0)
- ZEND_ME(reflection_method, __toString, arginfo_reflection__void, 0)
- ZEND_ME(reflection_method, isPublic, arginfo_reflection__void, 0)
- ZEND_ME(reflection_method, isPrivate, arginfo_reflection__void, 0)
- ZEND_ME(reflection_method, isProtected, arginfo_reflection__void, 0)
- ZEND_ME(reflection_method, isAbstract, arginfo_reflection__void, 0)
- ZEND_ME(reflection_method, isFinal, arginfo_reflection__void, 0)
- ZEND_ME(reflection_method, isStatic, arginfo_reflection__void, 0)
- ZEND_ME(reflection_method, isConstructor, arginfo_reflection__void, 0)
- ZEND_ME(reflection_method, isDestructor, arginfo_reflection__void, 0)
- ZEND_ME(reflection_method, getClosure, arginfo_reflection_method_getClosure, 0)
- ZEND_ME(reflection_method, getModifiers, arginfo_reflection__void, 0)
- ZEND_ME(reflection_method, invoke, arginfo_reflection_method_invoke, 0)
- ZEND_ME(reflection_method, invokeArgs, arginfo_reflection_method_invokeArgs, 0)
- ZEND_ME(reflection_method, getDeclaringClass, arginfo_reflection__void, 0)
- ZEND_ME(reflection_method, getPrototype, arginfo_reflection__void, 0)
- ZEND_ME(reflection_method, setAccessible, arginfo_reflection_method_setAccessible, 0)
+ ZEND_DEP_ME(reflection_method, export, arginfo_class_ReflectionMethod_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
+ ZEND_ME(reflection_method, __construct, arginfo_class_ReflectionMethod___construct, 0)
+ ZEND_ME(reflection_method, __toString, arginfo_class_ReflectionMethod___toString, 0)
+ ZEND_ME(reflection_method, isPublic, arginfo_class_ReflectionMethod_isPublic, 0)
+ ZEND_ME(reflection_method, isPrivate, arginfo_class_ReflectionMethod_isPrivate, 0)
+ ZEND_ME(reflection_method, isProtected, arginfo_class_ReflectionMethod_isProtected, 0)
+ ZEND_ME(reflection_method, isAbstract, arginfo_class_ReflectionMethod_isAbstract, 0)
+ ZEND_ME(reflection_method, isFinal, arginfo_class_ReflectionMethod_isFinal, 0)
+ ZEND_ME(reflection_method, isStatic, arginfo_class_ReflectionMethod_isStatic, 0)
+ ZEND_ME(reflection_method, isConstructor, arginfo_class_ReflectionMethod_isConstructor, 0)
+ ZEND_ME(reflection_method, isDestructor, arginfo_class_ReflectionMethod_isDestructor, 0)
+ ZEND_ME(reflection_method, getClosure, arginfo_class_ReflectionMethod_getClosure, 0)
+ ZEND_ME(reflection_method, getModifiers, arginfo_class_ReflectionMethod_getModifiers, 0)
+ ZEND_ME(reflection_method, invoke, arginfo_class_ReflectionMethod_invoke, 0)
+ ZEND_ME(reflection_method, invokeArgs, arginfo_class_ReflectionMethod_invokeArgs, 0)
+ ZEND_ME(reflection_method, getDeclaringClass, arginfo_class_ReflectionMethod_getDeclaringClass, 0)
+ ZEND_ME(reflection_method, getPrototype, arginfo_class_ReflectionMethod_getPrototype, 0)
+ ZEND_ME(reflection_method, setAccessible, arginfo_class_ReflectionMethod_setAccessible, 0)
PHP_FE_END
};
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_class_export, 0, 0, 1)
- ZEND_ARG_INFO(0, argument)
- ZEND_ARG_INFO(0, return)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_class___construct, 0)
- ZEND_ARG_INFO(0, argument)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_class_getStaticPropertyValue, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, default)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_setStaticPropertyValue, 0)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_hasMethod, 0)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_getMethod, 0)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_class_getMethods, 0, 0, 0)
- ZEND_ARG_INFO(0, filter)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_hasProperty, 0)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_getProperty, 0)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_class_getProperties, 0, 0, 0)
- ZEND_ARG_INFO(0, filter)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_hasConstant, 0)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_getConstant, 0)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_isInstance, 0)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_newInstance, 0)
- ZEND_ARG_INFO(0, args)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_newInstanceWithoutConstructor, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_class_newInstanceArgs, 0, 0, 0)
- ZEND_ARG_ARRAY_INFO(0, args, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_isSubclassOf, 0)
- ZEND_ARG_INFO(0, class)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_class_implementsInterface, 0)
- ZEND_ARG_INFO(0, interface)
-ZEND_END_ARG_INFO()
-
static const zend_function_entry reflection_class_functions[] = {
- ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
- ZEND_DEP_ME(reflection_class, export, arginfo_reflection_class_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
- ZEND_ME(reflection_class, __construct, arginfo_reflection_class___construct, 0)
- ZEND_ME(reflection_class, __toString, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, getName, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, isInternal, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, isUserDefined, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, isAnonymous, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, isInstantiable, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, isCloneable, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, getFileName, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, getStartLine, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, getEndLine, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, getDocComment, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, getConstructor, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, hasMethod, arginfo_reflection_class_hasMethod, 0)
- ZEND_ME(reflection_class, getMethod, arginfo_reflection_class_getMethod, 0)
- ZEND_ME(reflection_class, getMethods, arginfo_reflection_class_getMethods, 0)
- ZEND_ME(reflection_class, hasProperty, arginfo_reflection_class_hasProperty, 0)
- ZEND_ME(reflection_class, getProperty, arginfo_reflection_class_getProperty, 0)
- ZEND_ME(reflection_class, getProperties, arginfo_reflection_class_getProperties, 0)
- ZEND_ME(reflection_class, hasConstant, arginfo_reflection_class_hasConstant, 0)
- ZEND_ME(reflection_class, getConstants, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, getReflectionConstants, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, getConstant, arginfo_reflection_class_getConstant, 0)
- ZEND_ME(reflection_class, getReflectionConstant, arginfo_reflection_class_getConstant, 0)
- ZEND_ME(reflection_class, getInterfaces, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, getInterfaceNames, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, isInterface, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, getTraits, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, getTraitNames, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, getTraitAliases, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, isTrait, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, isAbstract, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, isFinal, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, getModifiers, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, isInstance, arginfo_reflection_class_isInstance, 0)
- ZEND_ME(reflection_class, newInstance, arginfo_reflection_class_newInstance, 0)
- ZEND_ME(reflection_class, newInstanceWithoutConstructor, arginfo_reflection_class_newInstanceWithoutConstructor, 0)
- ZEND_ME(reflection_class, newInstanceArgs, arginfo_reflection_class_newInstanceArgs, 0)
- ZEND_ME(reflection_class, getParentClass, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, isSubclassOf, arginfo_reflection_class_isSubclassOf, 0)
- ZEND_ME(reflection_class, getStaticProperties, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, getStaticPropertyValue, arginfo_reflection_class_getStaticPropertyValue, 0)
- ZEND_ME(reflection_class, setStaticPropertyValue, arginfo_reflection_class_setStaticPropertyValue, 0)
- ZEND_ME(reflection_class, getDefaultProperties, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, isIterable, arginfo_reflection__void, 0)
- ZEND_MALIAS(reflection_class, isIterateable, isIterable, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, implementsInterface, arginfo_reflection_class_implementsInterface, 0)
- ZEND_ME(reflection_class, getExtension, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, getExtensionName, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, inNamespace, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, getNamespaceName, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class, getShortName, arginfo_reflection__void, 0)
+ ZEND_ME(reflection, __clone, arginfo_class_ReflectionClass___clone, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
+ ZEND_DEP_ME(reflection_class, export, arginfo_class_ReflectionClass_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
+ ZEND_ME(reflection_class, __construct, arginfo_class_ReflectionClass___construct, 0)
+ ZEND_ME(reflection_class, __toString, arginfo_class_ReflectionClass___toString, 0)
+ ZEND_ME(reflection_class, getName, arginfo_class_ReflectionClass_getName, 0)
+ ZEND_ME(reflection_class, isInternal, arginfo_class_ReflectionClass_isInternal, 0)
+ ZEND_ME(reflection_class, isUserDefined, arginfo_class_ReflectionClass_isUserDefined, 0)
+ ZEND_ME(reflection_class, isAnonymous, arginfo_class_ReflectionClass_isAnonymous, 0)
+ ZEND_ME(reflection_class, isInstantiable, arginfo_class_ReflectionClass_isInstantiable, 0)
+ ZEND_ME(reflection_class, isCloneable, arginfo_class_ReflectionClass_isCloneable, 0)
+ ZEND_ME(reflection_class, getFileName, arginfo_class_ReflectionClass_getFileName, 0)
+ ZEND_ME(reflection_class, getStartLine, arginfo_class_ReflectionClass_getStartLine, 0)
+ ZEND_ME(reflection_class, getEndLine, arginfo_class_ReflectionClass_getEndLine, 0)
+ ZEND_ME(reflection_class, getDocComment, arginfo_class_ReflectionClass_getDocComment, 0)
+ ZEND_ME(reflection_class, getConstructor, arginfo_class_ReflectionClass_getConstructor, 0)
+ ZEND_ME(reflection_class, hasMethod, arginfo_class_ReflectionClass_hasMethod, 0)
+ ZEND_ME(reflection_class, getMethod, arginfo_class_ReflectionClass_getMethod, 0)
+ ZEND_ME(reflection_class, getMethods, arginfo_class_ReflectionClass_getMethods, 0)
+ ZEND_ME(reflection_class, hasProperty, arginfo_class_ReflectionClass_hasProperty, 0)
+ ZEND_ME(reflection_class, getProperty, arginfo_class_ReflectionClass_getProperty, 0)
+ ZEND_ME(reflection_class, getProperties, arginfo_class_ReflectionClass_getProperties, 0)
+ ZEND_ME(reflection_class, hasConstant, arginfo_class_ReflectionClass_hasConstant, 0)
+ ZEND_ME(reflection_class, getConstants, arginfo_class_ReflectionClass_getConstants, 0)
+ ZEND_ME(reflection_class, getReflectionConstants, arginfo_class_ReflectionClass_getReflectionConstants, 0)
+ ZEND_ME(reflection_class, getConstant, arginfo_class_ReflectionClass_getConstant, 0)
+ ZEND_ME(reflection_class, getReflectionConstant, arginfo_class_ReflectionClass_getReflectionConstant, 0)
+ ZEND_ME(reflection_class, getInterfaces, arginfo_class_ReflectionClass_getInterfaces, 0)
+ ZEND_ME(reflection_class, getInterfaceNames, arginfo_class_ReflectionClass_getInterfaceNames, 0)
+ ZEND_ME(reflection_class, isInterface, arginfo_class_ReflectionClass_isInterface, 0)
+ ZEND_ME(reflection_class, getTraits, arginfo_class_ReflectionClass_getTraits, 0)
+ ZEND_ME(reflection_class, getTraitNames, arginfo_class_ReflectionClass_getTraitNames, 0)
+ ZEND_ME(reflection_class, getTraitAliases, arginfo_class_ReflectionClass_getTraitAliases, 0)
+ ZEND_ME(reflection_class, isTrait, arginfo_class_ReflectionClass_isTrait, 0)
+ ZEND_ME(reflection_class, isAbstract, arginfo_class_ReflectionClass_isAbstract, 0)
+ ZEND_ME(reflection_class, isFinal, arginfo_class_ReflectionClass_isFinal, 0)
+ ZEND_ME(reflection_class, getModifiers, arginfo_class_ReflectionClass_getModifiers, 0)
+ ZEND_ME(reflection_class, isInstance, arginfo_class_ReflectionClass_isIntance, 0)
+ ZEND_ME(reflection_class, newInstance, arginfo_class_ReflectionClass_newInstance, 0)
+ ZEND_ME(reflection_class, newInstanceWithoutConstructor, arginfo_class_ReflectionClass_newInstanceWithoutConstructor, 0)
+ ZEND_ME(reflection_class, newInstanceArgs, arginfo_class_ReflectionClass_newInstanceArgs, 0)
+ ZEND_ME(reflection_class, getParentClass, arginfo_class_ReflectionClass_getParentClass, 0)
+ ZEND_ME(reflection_class, isSubclassOf, arginfo_class_ReflectionClass_isSubclassOf, 0)
+ ZEND_ME(reflection_class, getStaticProperties, arginfo_class_ReflectionClass_getStaticProperties, 0)
+ ZEND_ME(reflection_class, getStaticPropertyValue, arginfo_class_ReflectionClass_getStaticPropertyValue, 0)
+ ZEND_ME(reflection_class, setStaticPropertyValue, arginfo_class_ReflectionClass_setStaticPropertyValue, 0)
+ ZEND_ME(reflection_class, getDefaultProperties, arginfo_class_ReflectionClass_getDefaultProperties, 0)
+ ZEND_ME(reflection_class, isIterable, arginfo_class_ReflectionClass_isIterable, 0)
+ ZEND_MALIAS(reflection_class, isIterateable, isIterable, arginfo_class_ReflectionClass_isIterateable, 0)
+ ZEND_ME(reflection_class, implementsInterface, arginfo_class_ReflectionClass_implementsInterface, 0)
+ ZEND_ME(reflection_class, getExtension, arginfo_class_ReflectionClass_getExtension, 0)
+ ZEND_ME(reflection_class, getExtensionName, arginfo_class_ReflectionClass_getExtensionName, 0)
+ ZEND_ME(reflection_class, inNamespace, arginfo_class_ReflectionClass_inNamespace, 0)
+ ZEND_ME(reflection_class, getNamespaceName, arginfo_class_ReflectionClass_getNamespaceName, 0)
+ ZEND_ME(reflection_class, getShortName, arginfo_class_ReflectionClass_getShortName, 0)
PHP_FE_END
};
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_object_export, 0, 0, 1)
- ZEND_ARG_INFO(0, argument)
- ZEND_ARG_INFO(0, return)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_object___construct, 0)
- ZEND_ARG_INFO(0, argument)
-ZEND_END_ARG_INFO()
-
static const zend_function_entry reflection_object_functions[] = {
- ZEND_DEP_ME(reflection_object, export, arginfo_reflection_object_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
- ZEND_ME(reflection_object, __construct, arginfo_reflection_object___construct, 0)
+ ZEND_DEP_ME(reflection_object, export, arginfo_class_ReflectionObject_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
+ ZEND_ME(reflection_object, __construct, arginfo_class_ReflectionObject___construct, 0)
PHP_FE_END
};
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_property_export, 0, 0, 2)
- ZEND_ARG_INFO(0, class)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, return)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_property___construct, 0, 0, 2)
- ZEND_ARG_INFO(0, class)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_property_getValue, 0, 0, 0)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_property_setValue, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_property_isInitialized, 0, 0, 0)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_property_setAccessible, 0)
- ZEND_ARG_INFO(0, visible)
-ZEND_END_ARG_INFO()
-
static const zend_function_entry reflection_property_functions[] = {
- ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
- ZEND_DEP_ME(reflection_property, export, arginfo_reflection_property_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
- ZEND_ME(reflection_property, __construct, arginfo_reflection_property___construct, 0)
- ZEND_ME(reflection_property, __toString, arginfo_reflection__void, 0)
- ZEND_ME(reflection_property, getName, arginfo_reflection__void, 0)
- ZEND_ME(reflection_property, getValue, arginfo_reflection_property_getValue, 0)
- ZEND_ME(reflection_property, setValue, arginfo_reflection_property_setValue, 0)
- ZEND_ME(reflection_property, isInitialized, arginfo_reflection_property_isInitialized, 0)
- ZEND_ME(reflection_property, isPublic, arginfo_reflection__void, 0)
- ZEND_ME(reflection_property, isPrivate, arginfo_reflection__void, 0)
- ZEND_ME(reflection_property, isProtected, arginfo_reflection__void, 0)
- ZEND_ME(reflection_property, isStatic, arginfo_reflection__void, 0)
- ZEND_ME(reflection_property, isDefault, arginfo_reflection__void, 0)
- ZEND_ME(reflection_property, getModifiers, arginfo_reflection__void, 0)
- ZEND_ME(reflection_property, getDeclaringClass, arginfo_reflection__void, 0)
- ZEND_ME(reflection_property, getDocComment, arginfo_reflection__void, 0)
- ZEND_ME(reflection_property, setAccessible, arginfo_reflection_property_setAccessible, 0)
- ZEND_ME(reflection_property, getType, arginfo_reflection__void, 0)
- ZEND_ME(reflection_property, hasType, arginfo_reflection__void, 0)
+ ZEND_ME(reflection, __clone, arginfo_class_ReflectionProperty___clone, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
+ ZEND_DEP_ME(reflection_property, export, arginfo_class_ReflectionProperty_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
+ ZEND_ME(reflection_property, __construct, arginfo_class_ReflectionProperty___construct, 0)
+ ZEND_ME(reflection_property, __toString, arginfo_class_ReflectionProperty___toString, 0)
+ ZEND_ME(reflection_property, getName, arginfo_class_ReflectionProperty_getName, 0)
+ ZEND_ME(reflection_property, getValue, arginfo_class_ReflectionProperty_getValue, 0)
+ ZEND_ME(reflection_property, setValue, arginfo_class_ReflectionProperty_setValue, 0)
+ ZEND_ME(reflection_property, isInitialized, arginfo_class_ReflectionProperty_isInitialized, 0)
+ ZEND_ME(reflection_property, isPublic, arginfo_class_ReflectionProperty_isPublic, 0)
+ ZEND_ME(reflection_property, isPrivate, arginfo_class_ReflectionProperty_isPrivate, 0)
+ ZEND_ME(reflection_property, isProtected, arginfo_class_ReflectionProperty_isProtected, 0)
+ ZEND_ME(reflection_property, isStatic, arginfo_class_ReflectionProperty_isStatic, 0)
+ ZEND_ME(reflection_property, isDefault, arginfo_class_ReflectionProperty_isDefault, 0)
+ ZEND_ME(reflection_property, getModifiers, arginfo_class_ReflectionProperty_getModifiers, 0)
+ ZEND_ME(reflection_property, getDeclaringClass, arginfo_class_ReflectionProperty_getDeclaringClass, 0)
+ ZEND_ME(reflection_property, getDocComment, arginfo_class_ReflectionProperty_getDocComment, 0)
+ ZEND_ME(reflection_property, setAccessible, arginfo_class_ReflectionProperty_setAccessible, 0)
+ ZEND_ME(reflection_property, getType, arginfo_class_ReflectionProperty_getType, 0)
+ ZEND_ME(reflection_property, hasType, arginfo_class_ReflectionProperty_hasType, 0)
+ ZEND_ME(reflection_property, hasDefaultValue, arginfo_class_ReflectionProperty_hasDefaultValue, 0)
+ ZEND_ME(reflection_property, getDefaultValue, arginfo_class_ReflectionProperty_getDefaultValue, 0)
PHP_FE_END
};
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_class_constant_export, 0, 0, 2)
- ZEND_ARG_INFO(0, class)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, return)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_class_constant___construct, 0, 0, 2)
- ZEND_ARG_INFO(0, class)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
static const zend_function_entry reflection_class_constant_functions[] = {
- ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
- ZEND_DEP_ME(reflection_class_constant, export, arginfo_reflection_class_constant_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
- ZEND_ME(reflection_class_constant, __construct, arginfo_reflection_class_constant___construct, 0)
- ZEND_ME(reflection_class_constant, __toString, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class_constant, getName, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class_constant, getValue, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class_constant, isPublic, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class_constant, isPrivate, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class_constant, isProtected, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class_constant, getModifiers, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class_constant, getDeclaringClass, arginfo_reflection__void, 0)
- ZEND_ME(reflection_class_constant, getDocComment, arginfo_reflection__void, 0)
+ ZEND_ME(reflection, __clone, arginfo_class_ReflectionClassConstant___clone, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
+ ZEND_DEP_ME(reflection_class_constant, export, arginfo_class_ReflectionClassConstant_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
+ ZEND_ME(reflection_class_constant, __construct, arginfo_class_ReflectionClassConstant___construct, 0)
+ ZEND_ME(reflection_class_constant, __toString, arginfo_class_ReflectionClassConstant___toString, 0)
+ ZEND_ME(reflection_class_constant, getName, arginfo_class_ReflectionClassConstant_getName, 0)
+ ZEND_ME(reflection_class_constant, getValue, arginfo_class_ReflectionClassConstant_getValue, 0)
+ ZEND_ME(reflection_class_constant, isPublic, arginfo_class_ReflectionClassConstant_isPublic, 0)
+ ZEND_ME(reflection_class_constant, isPrivate, arginfo_class_ReflectionClassConstant_isPrivate, 0)
+ ZEND_ME(reflection_class_constant, isProtected, arginfo_class_ReflectionClassConstant_isProtected, 0)
+ ZEND_ME(reflection_class_constant, getModifiers, arginfo_class_ReflectionClassConstant_getModifiers, 0)
+ ZEND_ME(reflection_class_constant, getDeclaringClass, arginfo_class_ReflectionClassConstant_getDeclaringClass, 0)
+ ZEND_ME(reflection_class_constant, getDocComment, arginfo_class_ReflectionClassConstant_getDocComment, 0)
PHP_FE_END
};
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_parameter_export, 0, 0, 2)
- ZEND_ARG_INFO(0, function)
- ZEND_ARG_INFO(0, parameter)
- ZEND_ARG_INFO(0, return)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_parameter___construct, 0)
- ZEND_ARG_INFO(0, function)
- ZEND_ARG_INFO(0, parameter)
-ZEND_END_ARG_INFO()
-
static const zend_function_entry reflection_parameter_functions[] = {
- ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
- ZEND_DEP_ME(reflection_parameter, export, arginfo_reflection_parameter_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
- ZEND_ME(reflection_parameter, __construct, arginfo_reflection_parameter___construct, 0)
- ZEND_ME(reflection_parameter, __toString, arginfo_reflection__void, 0)
- ZEND_ME(reflection_parameter, getName, arginfo_reflection__void, 0)
- ZEND_ME(reflection_parameter, isPassedByReference, arginfo_reflection__void, 0)
- ZEND_ME(reflection_parameter, canBePassedByValue, arginfo_reflection__void, 0)
- ZEND_ME(reflection_parameter, getDeclaringFunction, arginfo_reflection__void, 0)
- ZEND_ME(reflection_parameter, getDeclaringClass, arginfo_reflection__void, 0)
- ZEND_ME(reflection_parameter, getClass, arginfo_reflection__void, 0)
- ZEND_ME(reflection_parameter, hasType, arginfo_reflection__void, 0)
- ZEND_ME(reflection_parameter, getType, arginfo_reflection__void, 0)
- ZEND_ME(reflection_parameter, isArray, arginfo_reflection__void, 0)
- ZEND_ME(reflection_parameter, isCallable, arginfo_reflection__void, 0)
- ZEND_ME(reflection_parameter, allowsNull, arginfo_reflection__void, 0)
- ZEND_ME(reflection_parameter, getPosition, arginfo_reflection__void, 0)
- ZEND_ME(reflection_parameter, isOptional, arginfo_reflection__void, 0)
- ZEND_ME(reflection_parameter, isDefaultValueAvailable, arginfo_reflection__void, 0)
- ZEND_ME(reflection_parameter, getDefaultValue, arginfo_reflection__void, 0)
- ZEND_ME(reflection_parameter, isDefaultValueConstant, arginfo_reflection__void, 0)
- ZEND_ME(reflection_parameter, getDefaultValueConstantName, arginfo_reflection__void, 0)
- ZEND_ME(reflection_parameter, isVariadic, arginfo_reflection__void, 0)
+ ZEND_ME(reflection, __clone, arginfo_class_ReflectionParameter___clone, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
+ ZEND_DEP_ME(reflection_parameter, export, arginfo_class_ReflectionParameter_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
+ ZEND_ME(reflection_parameter, __construct, arginfo_class_ReflectionParameter___construct, 0)
+ ZEND_ME(reflection_parameter, __toString, arginfo_class_ReflectionParameter___toString, 0)
+ ZEND_ME(reflection_parameter, getName, arginfo_class_ReflectionParameter_getName, 0)
+ ZEND_ME(reflection_parameter, isPassedByReference, arginfo_class_ReflectionParameter_isPassedByReference, 0)
+ ZEND_ME(reflection_parameter, canBePassedByValue, arginfo_class_ReflectionParameter_canBePassedByValue, 0)
+ ZEND_ME(reflection_parameter, getDeclaringFunction, arginfo_class_ReflectionParameter_getDeclaringFunction, 0)
+ ZEND_ME(reflection_parameter, getDeclaringClass, arginfo_class_ReflectionParameter_getDeclaringClass, 0)
+ ZEND_ME(reflection_parameter, getClass, arginfo_class_ReflectionParameter_getClass, 0)
+ ZEND_ME(reflection_parameter, hasType, arginfo_class_ReflectionParameter_hasType, 0)
+ ZEND_ME(reflection_parameter, getType, arginfo_class_ReflectionParameter_getType, 0)
+ ZEND_ME(reflection_parameter, isArray, arginfo_class_ReflectionParameter_isArray, 0)
+ ZEND_ME(reflection_parameter, isCallable, arginfo_class_ReflectionParameter_isCallable, 0)
+ ZEND_ME(reflection_parameter, allowsNull, arginfo_class_ReflectionParameter_allowsNull, 0)
+ ZEND_ME(reflection_parameter, getPosition, arginfo_class_ReflectionParameter_getPosition, 0)
+ ZEND_ME(reflection_parameter, isOptional, arginfo_class_ReflectionParameter_isOptional, 0)
+ ZEND_ME(reflection_parameter, isDefaultValueAvailable, arginfo_class_ReflectionParameter_isDefaultValueAvailable, 0)
+ ZEND_ME(reflection_parameter, getDefaultValue, arginfo_class_ReflectionParameter_getDefaultValue, 0)
+ ZEND_ME(reflection_parameter, isDefaultValueConstant, arginfo_class_ReflectionParameter_isDefaultValueConstant, 0)
+ ZEND_ME(reflection_parameter, getDefaultValueConstantName, arginfo_class_ReflectionParameter_getDefaultValueConstantName, 0)
+ ZEND_ME(reflection_parameter, isVariadic, arginfo_class_ReflectionParameter_isVariadic, 0)
PHP_FE_END
};
static const zend_function_entry reflection_type_functions[] = {
- ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
- ZEND_ME(reflection_type, allowsNull, arginfo_reflection__void, 0)
- ZEND_ME(reflection_type, isBuiltin, arginfo_reflection__void, 0)
- ZEND_ME(reflection_type, __toString, arginfo_reflection__void, ZEND_ACC_DEPRECATED)
+ ZEND_ME(reflection, __clone, arginfo_class_ReflectionType___clone, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
+ ZEND_ME(reflection_type, allowsNull, arginfo_class_ReflectionType_allowsNull, 0)
+ ZEND_ME(reflection_type, __toString, arginfo_class_ReflectionType___toString, 0)
PHP_FE_END
};
static const zend_function_entry reflection_named_type_functions[] = {
- ZEND_ME(reflection_named_type, getName, arginfo_reflection__void, 0)
+ ZEND_ME(reflection_named_type, getName, arginfo_class_ReflectionNamedType_getName, 0)
+ ZEND_ME(reflection_named_type, isBuiltin, arginfo_class_ReflectionNamedType_isBuiltin, 0)
PHP_FE_END
};
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_extension_export, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, return)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_extension___construct, 0)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
+static const zend_function_entry reflection_union_type_functions[] = {
+ ZEND_ME(reflection_union_type, getTypes, arginfo_class_ReflectionUnionType_getTypes, 0)
+ PHP_FE_END
+};
static const zend_function_entry reflection_extension_functions[] = {
- ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
- ZEND_DEP_ME(reflection_extension, export, arginfo_reflection_extension_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
- ZEND_ME(reflection_extension, __construct, arginfo_reflection_extension___construct, 0)
- ZEND_ME(reflection_extension, __toString, arginfo_reflection__void, 0)
- ZEND_ME(reflection_extension, getName, arginfo_reflection__void, 0)
- ZEND_ME(reflection_extension, getVersion, arginfo_reflection__void, 0)
- ZEND_ME(reflection_extension, getFunctions, arginfo_reflection__void, 0)
- ZEND_ME(reflection_extension, getConstants, arginfo_reflection__void, 0)
- ZEND_ME(reflection_extension, getINIEntries, arginfo_reflection__void, 0)
- ZEND_ME(reflection_extension, getClasses, arginfo_reflection__void, 0)
- ZEND_ME(reflection_extension, getClassNames, arginfo_reflection__void, 0)
- ZEND_ME(reflection_extension, getDependencies, arginfo_reflection__void, 0)
- ZEND_ME(reflection_extension, info, arginfo_reflection__void, 0)
- ZEND_ME(reflection_extension, isPersistent, arginfo_reflection__void, 0)
- ZEND_ME(reflection_extension, isTemporary, arginfo_reflection__void, 0)
+ ZEND_ME(reflection, __clone, arginfo_class_ReflectionExtension___clone, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
+ ZEND_DEP_ME(reflection_extension, export, arginfo_class_ReflectionExtension_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
+ ZEND_ME(reflection_extension, __construct, arginfo_class_ReflectionExtension___construct, 0)
+ ZEND_ME(reflection_extension, __toString, arginfo_class_ReflectionExtension___toString, 0)
+ ZEND_ME(reflection_extension, getName, arginfo_class_ReflectionExtension_getName, 0)
+ ZEND_ME(reflection_extension, getVersion, arginfo_class_ReflectionExtension_getVersion, 0)
+ ZEND_ME(reflection_extension, getFunctions, arginfo_class_ReflectionExtension_getFunctions, 0)
+ ZEND_ME(reflection_extension, getConstants, arginfo_class_ReflectionExtension_getConstants, 0)
+ ZEND_ME(reflection_extension, getINIEntries, arginfo_class_ReflectionExtension_getINIEntries, 0)
+ ZEND_ME(reflection_extension, getClasses, arginfo_class_ReflectionExtension_getClasses, 0)
+ ZEND_ME(reflection_extension, getClassNames, arginfo_class_ReflectionExtension_getClassNames, 0)
+ ZEND_ME(reflection_extension, getDependencies, arginfo_class_ReflectionExtension_getDependencies, 0)
+ ZEND_ME(reflection_extension, info, arginfo_class_ReflectionExtension_info, 0)
+ ZEND_ME(reflection_extension, isPersistent, arginfo_class_ReflectionExtension_isPersistent, 0)
+ ZEND_ME(reflection_extension, isTemporary, arginfo_class_ReflectionExtension_isTemporary, 0)
PHP_FE_END
};
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_zend_extension___construct, 0)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
static const zend_function_entry reflection_zend_extension_functions[] = {
- ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
- ZEND_DEP_ME(reflection_zend_extension, export, arginfo_reflection_extension_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
- ZEND_ME(reflection_zend_extension, __construct, arginfo_reflection_zend_extension___construct, 0)
- ZEND_ME(reflection_zend_extension, __toString, arginfo_reflection__void, 0)
- ZEND_ME(reflection_zend_extension, getName, arginfo_reflection__void, 0)
- ZEND_ME(reflection_zend_extension, getVersion, arginfo_reflection__void, 0)
- ZEND_ME(reflection_zend_extension, getAuthor, arginfo_reflection__void, 0)
- ZEND_ME(reflection_zend_extension, getURL, arginfo_reflection__void, 0)
- ZEND_ME(reflection_zend_extension, getCopyright, arginfo_reflection__void, 0)
+ ZEND_ME(reflection, __clone, arginfo_class_ReflectionZendExtension___clone, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
+ ZEND_DEP_ME(reflection_zend_extension, export, arginfo_class_ReflectionZendExtension_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
+ ZEND_ME(reflection_zend_extension, __construct, arginfo_class_ReflectionZendExtension___construct, 0)
+ ZEND_ME(reflection_zend_extension, __toString, arginfo_class_ReflectionZendExtension___toString, 0)
+ ZEND_ME(reflection_zend_extension, getName, arginfo_class_ReflectionZendExtension_getName, 0)
+ ZEND_ME(reflection_zend_extension, getVersion, arginfo_class_ReflectionZendExtension_getVersion, 0)
+ ZEND_ME(reflection_zend_extension, getAuthor, arginfo_class_ReflectionZendExtension_getAuthor, 0)
+ ZEND_ME(reflection_zend_extension, getURL, arginfo_class_ReflectionZendExtension_getURL, 0)
+ ZEND_ME(reflection_zend_extension, getCopyright, arginfo_class_ReflectionZendExtension_getCopyright, 0)
PHP_FE_END
};
-ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_reference_fromArrayElement, 0, 0, 2)
- ZEND_ARG_INFO(0, array)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO()
-
static const zend_function_entry reflection_reference_functions[] = {
- ZEND_ME(reflection_reference, fromArrayElement, arginfo_reflection_reference_fromArrayElement, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- ZEND_ME(reflection_reference, getId, arginfo_reflection__void, ZEND_ACC_PUBLIC)
+ ZEND_ME(reflection_reference, fromArrayElement, arginfo_class_ReflectionReference_fromArrayElement, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_ME(reflection_reference, getId, arginfo_class_ReflectionReference_getId, ZEND_ACC_PUBLIC)
/* Always throwing dummy methods */
- ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE)
- ZEND_ME(reflection_reference, __construct, arginfo_reflection__void, ZEND_ACC_PRIVATE)
+ ZEND_ME(reflection, __clone, arginfo_class_ReflectionReference___clone, ZEND_ACC_PRIVATE)
+ ZEND_ME(reflection_reference, __construct, arginfo_class_ReflectionReference___construct, ZEND_ACC_PRIVATE)
PHP_FE_END
};
/* }}} */
@@ -6743,20 +6668,19 @@ static const zend_function_entry reflection_ext_functions[] = { /* {{{ */
}; /* }}} */
/* {{{ _reflection_write_property */
-static zval *_reflection_write_property(zval *object, zval *member, zval *value, void **cache_slot)
+static zval *_reflection_write_property(zend_object *object, zend_string *name, zval *value, void **cache_slot)
{
- if ((Z_TYPE_P(member) == IS_STRING)
- && zend_hash_exists(&Z_OBJCE_P(object)->properties_info, Z_STR_P(member))
- && ((Z_STRLEN_P(member) == sizeof("name") - 1 && !memcmp(Z_STRVAL_P(member), "name", sizeof("name")))
- || (Z_STRLEN_P(member) == sizeof("class") - 1 && !memcmp(Z_STRVAL_P(member), "class", sizeof("class")))))
+ if (zend_hash_exists(&object->ce->properties_info, name)
+ && ((ZSTR_LEN(name) == sizeof("name") - 1 && !memcmp(ZSTR_VAL(name), "name", sizeof("name")))
+ || (ZSTR_LEN(name) == sizeof("class") - 1 && !memcmp(ZSTR_VAL(name), "class", sizeof("class")))))
{
zend_throw_exception_ex(reflection_exception_ptr, 0,
- "Cannot set read-only property %s::$%s", ZSTR_VAL(Z_OBJCE_P(object)->name), Z_STRVAL_P(member));
+ "Cannot set read-only property %s::$%s", ZSTR_VAL(object->ce->name), ZSTR_VAL(name));
return &EG(uninitialized_zval);
}
else
{
- return zend_std_write_property(object, member, value, cache_slot);
+ return zend_std_write_property(object, name, value, cache_slot);
}
}
/* }}} */
@@ -6813,11 +6737,16 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */
INIT_CLASS_ENTRY(_reflection_entry, "ReflectionType", reflection_type_functions);
reflection_init_class_handlers(&_reflection_entry);
reflection_type_ptr = zend_register_internal_class(&_reflection_entry);
+ reflection_type_ptr->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS;
INIT_CLASS_ENTRY(_reflection_entry, "ReflectionNamedType", reflection_named_type_functions);
reflection_init_class_handlers(&_reflection_entry);
reflection_named_type_ptr = zend_register_internal_class_ex(&_reflection_entry, reflection_type_ptr);
+ INIT_CLASS_ENTRY(_reflection_entry, "ReflectionUnionType", reflection_union_type_functions);
+ reflection_init_class_handlers(&_reflection_entry);
+ reflection_union_type_ptr = zend_register_internal_class_ex(&_reflection_entry, reflection_type_ptr);
+
INIT_CLASS_ENTRY(_reflection_entry, "ReflectionMethod", reflection_method_functions);
reflection_init_class_handlers(&_reflection_entry);
reflection_method_ptr = zend_register_internal_class_ex(&_reflection_entry, reflection_function_abstract_ptr);
diff --git a/ext/reflection/php_reflection.h b/ext/reflection/php_reflection.h
index b1d5717e3f..e4e08c16e6 100644
--- a/ext/reflection/php_reflection.h
+++ b/ext/reflection/php_reflection.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/reflection/php_reflection.stub.php b/ext/reflection/php_reflection.stub.php
new file mode 100644
index 0000000000..76cbe75dd7
--- /dev/null
+++ b/ext/reflection/php_reflection.stub.php
@@ -0,0 +1,647 @@
+<?php
+
+class ReflectionException extends Exception
+{
+}
+
+class Reflection
+{
+ /** @return string[] */
+ public static function getModifierNames(int $modifiers) {}
+
+ public static function export(Reflector $reflector, bool $return = false) {}
+}
+
+interface Reflector
+{
+ /** @return string */
+ public function __toString();
+}
+
+abstract class ReflectionFunctionAbstract implements Reflector
+{
+ final private function __clone() {}
+
+ /** @return bool */
+ public function inNamespace() {}
+
+ /** @return bool */
+ public function isClosure() {}
+
+ /** @return bool */
+ public function isDeprecated() {}
+
+ /** @return bool */
+ public function isInternal() {}
+
+ /** @return bool */
+ public function isUserDefined() {}
+
+ /** @return bool */
+ public function isGenerator() {}
+
+ /** @return bool */
+ public function isVariadic() {}
+
+ /** @return ?object */
+ public function getClosureThis() {}
+
+ /** @return ?ReflectionClass */
+ public function getClosureScopeClass() {}
+
+ /** @return string|false */
+ public function getDocComment() {}
+
+ /** @return int|false */
+ public function getEndLine() {}
+
+ /** @return ?ReflectionExtension */
+ public function getExtension() {}
+
+ /** @return string|false */
+ public function getExtensionName() {}
+
+ /** @return string|false */
+ public function getFileName() {}
+
+ /** @return string|false */
+ public function getName() {}
+
+ /** @return string|false */
+ public function getNamespaceName() {}
+
+ /** @return int */
+ public function getNumberOfParameters() {}
+
+ /** @return int */
+ public function getNumberOfRequiredParameters() {}
+
+ /** @return ReflectionParameter[] */
+ public function getParameters() {}
+
+ /** @return string|false */
+ public function getShortName() {}
+
+ /** @return int|false */
+ public function getStartLine() {}
+
+ /** @return array */
+ public function getStaticVariables() {}
+
+ /** @return bool */
+ public function returnsReference() {}
+
+ /** @return bool */
+ public function hasReturnType() {}
+
+ /** @return ?ReflectionType */
+ public function getReturnType() {}
+}
+
+class ReflectionFunction extends ReflectionFunctionAbstract
+{
+ /** @param string|Closure $name */
+ public function __construct($name) {}
+
+ /** @return string */
+ public function __toString() {}
+
+ public static function export($name, bool $return = false) {}
+
+ /** @return bool */
+ public function isDisabled() {}
+
+ public function invoke(...$args) {}
+
+ public function invokeArgs(array $args) {}
+
+ /** @return Closure */
+ public function getClosure() {}
+}
+
+class ReflectionGenerator
+{
+ public function __construct(Generator $generator) {}
+
+ /** @return int */
+ public function getExecutingLine() {}
+
+ /** @return string */
+ public function getExecutingFile() {}
+
+ /** @return array */
+ public function getTrace(int $options = DEBUG_BACKTRACE_PROVIDE_OBJECT) {}
+
+ /** @return ReflectionFunctionAbstract */
+ public function getFunction() {}
+
+ /** @return ?object */
+ public function getThis() {}
+
+ /** @return Generator */
+ public function getExecutingGenerator() {}
+}
+
+class ReflectionMethod extends ReflectionFunctionAbstract
+{
+ /** @param object|string $class_or_method */
+ public function __construct($class_or_method, string $name = UNKNOWN) {}
+
+ /** @return string */
+ public function __toString() {}
+
+ public static function export($class, $name, bool $return = false) {}
+
+ /** @return bool */
+ public function isPublic() {}
+
+ /** @return bool */
+ public function isPrivate() {}
+
+ /** @return bool */
+ public function isProtected() {}
+
+ /** @return bool */
+ public function isAbstract() {}
+
+ /** @return bool */
+ public function isFinal() {}
+
+ /** @return bool */
+ public function isStatic() {}
+
+ /** @return bool */
+ public function isConstructor() {}
+
+ /** @return bool */
+ public function isDestructor() {}
+
+ /** @return Closure */
+ public function getClosure($object = UNKNOWN) {}
+
+ /** @return int */
+ public function getModifiers() {}
+
+ public function invoke(?object $object = null, ...$args) {}
+
+ public function invokeArgs(?object $object, array $args) {}
+
+ /** @return ReflectionClass */
+ public function getDeclaringClass() {}
+
+ /** @return ReflectionMethod */
+ public function getPrototype() {}
+
+ /** @return void */
+ public function setAccessible(bool $visible) {}
+}
+
+class ReflectionClass implements Reflector
+{
+ final private function __clone() {}
+
+ public static function export($argument, bool $return = false) {}
+
+ /** @param object|string $argument */
+ public function __construct($argument) {}
+
+ /** @return string */
+ public function __toString() {}
+
+ /** @return string|false */
+ public function getName() {}
+
+ /** @return bool */
+ public function isInternal() {}
+
+ /** @return bool */
+ public function isUserDefined() {}
+
+ /** @return bool */
+ public function isAnonymous() {}
+
+ /** @return bool */
+ public function isInstantiable() {}
+
+ /** @return bool */
+ public function isCloneable() {}
+
+ /** @return string|false */
+ public function getFileName() {}
+
+ /** @return int|false */
+ public function getStartLine() {}
+
+ /** @return int|false */
+ public function getEndLine() {}
+
+ /** @return string|false */
+ public function getDocComment() {}
+
+ /** @return ?ReflectionMethod */
+ public function getConstructor() {}
+
+ /** @return bool */
+ public function hasMethod(string $name) {}
+
+ /** @return ReflectionMethod */
+ public function getMethod(string $name) {}
+
+ /** @return ReflectionMethod[] */
+ public function getMethods(?int $filter = null) {}
+
+ /** @return bool */
+ public function hasProperty(string $name) {}
+
+ /** @return ReflectionProperty */
+ public function getProperty(string $name) {}
+
+ /** @return ReflectionProperty[] */
+ public function getProperties(?int $filter = null) {}
+
+ /** @return bool */
+ public function hasConstant(string $name) {}
+
+ /** @return ?array */
+ public function getConstants() {}
+
+ /** @return ReflectionClassConstant[] */
+ public function getReflectionConstants() {}
+
+ public function getConstant(string $name) {}
+
+ /** @return ReflectionClassConstant|false */
+ public function getReflectionConstant(string $name) {}
+
+ /** @return ReflectionClass[] */
+ public function getInterfaces() {}
+
+ /** @return string[] */
+ public function getInterfaceNames() {}
+
+ /** @return bool */
+ public function isInterface() {}
+
+ /** @return ReflectionClass[] */
+ public function getTraits() {}
+
+ /** @return string[] */
+ public function getTraitNames() {}
+
+ /** @return string[] */
+ public function getTraitAliases() {}
+
+ /** @return bool */
+ public function isTrait() {}
+
+ /** @return bool */
+ public function isAbstract() {}
+
+ /** @return bool */
+ public function isFinal() {}
+
+ /** @return int */
+ public function getModifiers() {}
+
+ /** @return bool */
+ public function isIntance(object $object) {}
+
+ /** @return object */
+ public function newInstance(...$args) {}
+
+ /** @return object */
+ public function newInstanceWithoutConstructor() {}
+
+ /** @return object */
+ public function newInstanceArgs(array $args = []) {}
+
+ /** @return ReflectionClass|false */
+ public function getParentClass() {}
+
+ /**
+ * @param string|ReflectionClass $class
+ * @return bool
+ */
+ public function isSubclassOf($class) {}
+
+ /** @return ?array */
+ public function getStaticProperties() {}
+
+ public function getStaticPropertyValue(string $name, $default = UNKNOWN) {}
+
+ /** @return void */
+ public function setStaticPropertyValue(string $name, $value) {}
+
+ /** @return array */
+ public function getDefaultProperties() {}
+
+ /** @return bool */
+ public function isIterable() {}
+
+ /** @return bool */
+ public function isIterateable() {}
+
+ /**
+ * @param string|ReflectionClass $interface
+ * @return bool
+ */
+ public function implementsInterface($interface) {}
+
+ /** @return ?ReflectionExtension */
+ public function getExtension() {}
+
+ /** @return string|false */
+ public function getExtensionName() {}
+
+ /** @return bool */
+ public function inNamespace() {}
+
+ /** @return string|false */
+ public function getNamespaceName() {}
+
+ /** @return string|false */
+ public function getShortName() {}
+}
+
+class ReflectionObject extends ReflectionClass
+{
+ public function __construct(object $argument) {}
+
+ public static function export($argument, bool $return = false) {}
+}
+
+class ReflectionProperty implements Reflector
+{
+ final private function __clone() {}
+
+ public static function export($class, $name, bool $return = false) {}
+
+ /** @param string|object $class */
+ public function __construct($class, string $name) {}
+
+ /** @return string */
+ public function __toString() {}
+
+ /** @return string|false */
+ public function getName() {}
+
+ public function getValue(?object $object = null) {}
+
+ /** @return void */
+ public function setValue($object_or_value, $value = UNKNOWN) {}
+
+ /** @return bool */
+ public function isInitialized(?object $object = null) {}
+
+ /** @return bool */
+ public function isPublic() {}
+
+ /** @return bool */
+ public function isPrivate() {}
+
+ /** @return bool */
+ public function isProtected() {}
+
+ /** @return bool */
+ public function isStatic() {}
+
+ /** @return bool */
+ public function isDefault() {}
+
+ /** @return int */
+ public function getModifiers() {}
+
+ /** @return ReflectionClass */
+ public function getDeclaringClass() {}
+
+ /** @return string|false */
+ public function getDocComment() {}
+
+ /** @return void */
+ public function setAccessible(bool $visible) {}
+
+ /** @return ?ReflectionType */
+ public function getType() {}
+
+ /** @return bool */
+ public function hasType() {}
+
+ public function hasDefaultValue(): bool {}
+
+ /** @return mixed */
+ public function getDefaultValue() {}
+}
+
+class ReflectionClassConstant implements Reflector
+{
+ final private function __clone() {}
+
+ public static function export($class, $name, bool $return = false) {}
+
+ /** @return string|object */
+ public function __construct($class, string $name) {}
+
+ /** @return string */
+ public function __toString() {}
+
+ /** @return string|false */
+ public function getName() {}
+
+ public function getValue() {}
+
+ /** @return bool */
+ public function isPublic() {}
+
+ /** @return bool */
+ public function isPrivate() {}
+
+ /** @return bool */
+ public function isProtected() {}
+
+ /** @return int */
+ public function getModifiers() {}
+
+ /** @return ReflectionClass */
+ public function getDeclaringClass() {}
+
+ /** @return string|false */
+ public function getDocComment() {}
+}
+
+class ReflectionParameter implements Reflector
+{
+ final private function __clone() {}
+
+ public static function export($function, $parameter, bool $return = false) {}
+
+ /**
+ * @param string|array|object
+ * @param int|string
+ */
+ public function __construct($function, $parameter) {}
+
+ /** @return string */
+ public function __toString() {}
+
+ /** @return string|false */
+ public function getName() {}
+
+ /** @return bool */
+ public function isPassedByReference() {}
+
+ /** @return bool */
+ public function canBePassedByValue() {}
+
+ /** @return ReflectionFunctionAbstract */
+ public function getDeclaringFunction() {}
+
+ /** @return ?ReflectionClass */
+ public function getDeclaringClass() {}
+
+ /** @return ?ReflectionClass */
+ public function getClass() {}
+
+ /** @return bool */
+ public function hasType() {}
+
+ /** @return ?ReflectionType */
+ public function getType() {}
+
+ /** @return bool */
+ public function isArray() {}
+
+ /** @return bool */
+ public function isCallable() {}
+
+ /** @return bool */
+ public function allowsNull() {}
+
+ /** @return int */
+ public function getPosition() {}
+
+ /** @return bool */
+ public function isOptional() {}
+
+ /** @return bool */
+ public function isDefaultValueAvailable() {}
+
+ public function getDefaultValue() {}
+
+ /** @return bool */
+ public function isDefaultValueConstant() {}
+
+ /** @return ?string */
+ public function getDefaultValueConstantName() {}
+
+ /** @return bool */
+ public function isVariadic() {}
+}
+
+abstract class ReflectionType
+{
+ final private function __clone() {}
+
+ /** @return bool */
+ public function allowsNull() {}
+
+ /** @return string */
+ public function __toString() {}
+}
+
+class ReflectionNamedType extends ReflectionType
+{
+ /** @return string */
+ public function getName() {}
+
+ /** @return bool */
+ public function isBuiltin() {}
+}
+
+class ReflectionUnionType extends ReflectionType
+{
+ public function getTypes(): array {}
+}
+
+class ReflectionExtension implements Reflector
+{
+ final private function __clone() {}
+
+ public static function export($name, bool $return = false) {}
+
+ public function __construct(string $name) {}
+
+ /** @return string */
+ public function __toString() {}
+
+ /** @return string|false */
+ public function getName() {}
+
+ /** @return ?string */
+ public function getVersion() {}
+
+ /** @return ReflectionFunction[] */
+ public function getFunctions() {}
+
+ /** @return array */
+ public function getConstants() {}
+
+ /** @return array */
+ public function getINIEntries() {}
+
+ /** @return ReflectionClass[] */
+ public function getClasses() {}
+
+ /** @return string[] */
+ public function getClassNames() {}
+
+ /** @return array */
+ public function getDependencies() {}
+
+ /** @return void */
+ public function info() {}
+
+ /** @return bool */
+ public function isPersistent() {}
+
+ /** @return bool */
+ public function isTemporary() {}
+}
+
+class ReflectionZendExtension implements Reflector
+{
+ final private function __clone() {}
+
+ public static function export($name, bool $return = false) {}
+
+ public function __construct(string $name) {}
+
+ /** @return string */
+ public function __toString() {}
+
+ /** @return string */
+ public function getName() {}
+
+ /** @return string */
+ public function getVersion() {}
+
+ /** @return string */
+ public function getAuthor() {}
+
+ /** @return string */
+ public function getURL() {}
+
+ /** @return string */
+ public function getCopyright() {}
+}
+
+final class ReflectionReference
+{
+ /** @param int|string $key */
+ public static function fromArrayElement(array $array, $key): ?ReflectionReference {}
+
+ public function getId(): string {}
+
+ private function __clone() {}
+
+ private function __construct() {}
+}
diff --git a/ext/reflection/php_reflection_arginfo.h b/ext/reflection/php_reflection_arginfo.h
new file mode 100644
index 0000000000..35ee713732
--- /dev/null
+++ b/ext/reflection/php_reflection_arginfo.h
@@ -0,0 +1,495 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Reflection_getModifierNames, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, modifiers, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Reflection_export, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, reflector, Reflector, 0)
+ ZEND_ARG_TYPE_INFO(0, return, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Reflector___toString, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionFunctionAbstract___clone arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionFunctionAbstract_inNamespace arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionFunctionAbstract_isClosure arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionFunctionAbstract_isDeprecated arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionFunctionAbstract_isInternal arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionFunctionAbstract_isUserDefined arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionFunctionAbstract_isGenerator arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionFunctionAbstract_isVariadic arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionFunctionAbstract_getClosureThis arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionFunctionAbstract_getClosureScopeClass arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionFunctionAbstract_getDocComment arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionFunctionAbstract_getEndLine arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionFunctionAbstract_getExtension arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionFunctionAbstract_getExtensionName arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionFunctionAbstract_getFileName arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionFunctionAbstract_getName arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionFunctionAbstract_getNamespaceName arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionFunctionAbstract_getNumberOfParameters arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionFunctionAbstract_getNumberOfRequiredParameters arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionFunctionAbstract_getParameters arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionFunctionAbstract_getShortName arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionFunctionAbstract_getStartLine arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionFunctionAbstract_getStaticVariables arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionFunctionAbstract_returnsReference arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionFunctionAbstract_hasReturnType arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionFunctionAbstract_getReturnType arginfo_class_Reflector___toString
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionFunction___construct, 0, 0, 1)
+ ZEND_ARG_INFO(0, name)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionFunction___toString arginfo_class_Reflector___toString
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionFunction_export, 0, 0, 1)
+ ZEND_ARG_INFO(0, name)
+ ZEND_ARG_TYPE_INFO(0, return, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionFunction_isDisabled arginfo_class_Reflector___toString
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionFunction_invoke, 0, 0, 0)
+ ZEND_ARG_VARIADIC_INFO(0, args)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionFunction_invokeArgs, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, args, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionFunction_getClosure arginfo_class_Reflector___toString
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionGenerator___construct, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, generator, Generator, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionGenerator_getExecutingLine arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionGenerator_getExecutingFile arginfo_class_Reflector___toString
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionGenerator_getTrace, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionGenerator_getFunction arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionGenerator_getThis arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionGenerator_getExecutingGenerator arginfo_class_Reflector___toString
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionMethod___construct, 0, 0, 1)
+ ZEND_ARG_INFO(0, class_or_method)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionMethod___toString arginfo_class_Reflector___toString
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionMethod_export, 0, 0, 2)
+ ZEND_ARG_INFO(0, class)
+ ZEND_ARG_INFO(0, name)
+ ZEND_ARG_TYPE_INFO(0, return, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionMethod_isPublic arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionMethod_isPrivate arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionMethod_isProtected arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionMethod_isAbstract arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionMethod_isFinal arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionMethod_isStatic arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionMethod_isConstructor arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionMethod_isDestructor arginfo_class_Reflector___toString
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionMethod_getClosure, 0, 0, 0)
+ ZEND_ARG_INFO(0, object)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionMethod_getModifiers arginfo_class_Reflector___toString
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionMethod_invoke, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, object, IS_OBJECT, 1)
+ ZEND_ARG_VARIADIC_INFO(0, args)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionMethod_invokeArgs, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, object, IS_OBJECT, 1)
+ ZEND_ARG_TYPE_INFO(0, args, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionMethod_getDeclaringClass arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionMethod_getPrototype arginfo_class_Reflector___toString
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionMethod_setAccessible, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, visible, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionClass___clone arginfo_class_Reflector___toString
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionClass_export, 0, 0, 1)
+ ZEND_ARG_INFO(0, argument)
+ ZEND_ARG_TYPE_INFO(0, return, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionClass___construct, 0, 0, 1)
+ ZEND_ARG_INFO(0, argument)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionClass___toString arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionClass_getName arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionClass_isInternal arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionClass_isUserDefined arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionClass_isAnonymous arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionClass_isInstantiable arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionClass_isCloneable arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionClass_getFileName arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionClass_getStartLine arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionClass_getEndLine arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionClass_getDocComment arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionClass_getConstructor arginfo_class_Reflector___toString
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionClass_hasMethod, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionClass_getMethod arginfo_class_ReflectionClass_hasMethod
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionClass_getMethods, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, filter, IS_LONG, 1)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionClass_hasProperty arginfo_class_ReflectionClass_hasMethod
+
+#define arginfo_class_ReflectionClass_getProperty arginfo_class_ReflectionClass_hasMethod
+
+#define arginfo_class_ReflectionClass_getProperties arginfo_class_ReflectionClass_getMethods
+
+#define arginfo_class_ReflectionClass_hasConstant arginfo_class_ReflectionClass_hasMethod
+
+#define arginfo_class_ReflectionClass_getConstants arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionClass_getReflectionConstants arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionClass_getConstant arginfo_class_ReflectionClass_hasMethod
+
+#define arginfo_class_ReflectionClass_getReflectionConstant arginfo_class_ReflectionClass_hasMethod
+
+#define arginfo_class_ReflectionClass_getInterfaces arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionClass_getInterfaceNames arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionClass_isInterface arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionClass_getTraits arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionClass_getTraitNames arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionClass_getTraitAliases arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionClass_isTrait arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionClass_isAbstract arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionClass_isFinal arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionClass_getModifiers arginfo_class_Reflector___toString
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionClass_isIntance, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, object, IS_OBJECT, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionClass_newInstance arginfo_class_ReflectionFunction_invoke
+
+#define arginfo_class_ReflectionClass_newInstanceWithoutConstructor arginfo_class_Reflector___toString
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionClass_newInstanceArgs, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, args, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionClass_getParentClass arginfo_class_Reflector___toString
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionClass_isSubclassOf, 0, 0, 1)
+ ZEND_ARG_INFO(0, class)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionClass_getStaticProperties arginfo_class_Reflector___toString
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionClass_getStaticPropertyValue, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_INFO(0, default)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionClass_setStaticPropertyValue, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionClass_getDefaultProperties arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionClass_isIterable arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionClass_isIterateable arginfo_class_Reflector___toString
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionClass_implementsInterface, 0, 0, 1)
+ ZEND_ARG_INFO(0, interface)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionClass_getExtension arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionClass_getExtensionName arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionClass_inNamespace arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionClass_getNamespaceName arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionClass_getShortName arginfo_class_Reflector___toString
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionObject___construct, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, argument, IS_OBJECT, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionObject_export arginfo_class_ReflectionClass_export
+
+#define arginfo_class_ReflectionProperty___clone arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionProperty_export arginfo_class_ReflectionMethod_export
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionProperty___construct, 0, 0, 2)
+ ZEND_ARG_INFO(0, class)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionProperty___toString arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionProperty_getName arginfo_class_Reflector___toString
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionProperty_getValue, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, object, IS_OBJECT, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionProperty_setValue, 0, 0, 1)
+ ZEND_ARG_INFO(0, object_or_value)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionProperty_isInitialized arginfo_class_ReflectionProperty_getValue
+
+#define arginfo_class_ReflectionProperty_isPublic arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionProperty_isPrivate arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionProperty_isProtected arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionProperty_isStatic arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionProperty_isDefault arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionProperty_getModifiers arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionProperty_getDeclaringClass arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionProperty_getDocComment arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionProperty_setAccessible arginfo_class_ReflectionMethod_setAccessible
+
+#define arginfo_class_ReflectionProperty_getType arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionProperty_hasType arginfo_class_Reflector___toString
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_ReflectionProperty_hasDefaultValue, 0, 0, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionProperty_getDefaultValue arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionClassConstant___clone arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionClassConstant_export arginfo_class_ReflectionMethod_export
+
+#define arginfo_class_ReflectionClassConstant___construct arginfo_class_ReflectionProperty___construct
+
+#define arginfo_class_ReflectionClassConstant___toString arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionClassConstant_getName arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionClassConstant_getValue arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionClassConstant_isPublic arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionClassConstant_isPrivate arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionClassConstant_isProtected arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionClassConstant_getModifiers arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionClassConstant_getDeclaringClass arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionClassConstant_getDocComment arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionParameter___clone arginfo_class_Reflector___toString
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionParameter_export, 0, 0, 2)
+ ZEND_ARG_INFO(0, function)
+ ZEND_ARG_INFO(0, parameter)
+ ZEND_ARG_TYPE_INFO(0, return, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ReflectionParameter___construct, 0, 0, 2)
+ ZEND_ARG_INFO(0, function)
+ ZEND_ARG_INFO(0, parameter)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionParameter___toString arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionParameter_getName arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionParameter_isPassedByReference arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionParameter_canBePassedByValue arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionParameter_getDeclaringFunction arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionParameter_getDeclaringClass arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionParameter_getClass arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionParameter_hasType arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionParameter_getType arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionParameter_isArray arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionParameter_isCallable arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionParameter_allowsNull arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionParameter_getPosition arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionParameter_isOptional arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionParameter_isDefaultValueAvailable arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionParameter_getDefaultValue arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionParameter_isDefaultValueConstant arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionParameter_getDefaultValueConstantName arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionParameter_isVariadic arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionType___clone arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionType_allowsNull arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionType___toString arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionNamedType_getName arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionNamedType_isBuiltin arginfo_class_Reflector___toString
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_ReflectionUnionType_getTypes, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionExtension___clone arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionExtension_export arginfo_class_ReflectionFunction_export
+
+#define arginfo_class_ReflectionExtension___construct arginfo_class_ReflectionClass_hasMethod
+
+#define arginfo_class_ReflectionExtension___toString arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionExtension_getName arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionExtension_getVersion arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionExtension_getFunctions arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionExtension_getConstants arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionExtension_getINIEntries arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionExtension_getClasses arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionExtension_getClassNames arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionExtension_getDependencies arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionExtension_info arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionExtension_isPersistent arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionExtension_isTemporary arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionZendExtension___clone arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionZendExtension_export arginfo_class_ReflectionFunction_export
+
+#define arginfo_class_ReflectionZendExtension___construct arginfo_class_ReflectionClass_hasMethod
+
+#define arginfo_class_ReflectionZendExtension___toString arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionZendExtension_getName arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionZendExtension_getVersion arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionZendExtension_getAuthor arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionZendExtension_getURL arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionZendExtension_getCopyright arginfo_class_Reflector___toString
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_ReflectionReference_fromArrayElement, 0, 2, ReflectionReference, 1)
+ ZEND_ARG_TYPE_INFO(0, array, IS_ARRAY, 0)
+ ZEND_ARG_INFO(0, key)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_ReflectionReference_getId, 0, 0, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ReflectionReference___clone arginfo_class_Reflector___toString
+
+#define arginfo_class_ReflectionReference___construct arginfo_class_Reflector___toString
diff --git a/ext/reflection/tests/001.phpt b/ext/reflection/tests/001.phpt
index f68afc950e..d476013653 100644
--- a/ext/reflection/tests/001.phpt
+++ b/ext/reflection/tests/001.phpt
@@ -5,17 +5,17 @@ Reflection inheritance
class ReflectionClassEx extends ReflectionClass
{
- public $bla;
+ public $bla;
- function getMethodNames()
- {
- $res = array();
- foreach($this->getMethods() as $m)
- {
- $res[] = $m->class . '::' . $m->name;
- }
- return $res;
- }
+ function getMethodNames()
+ {
+ $res = array();
+ foreach($this->getMethods() as $m)
+ {
+ $res[] = $m->class . '::' . $m->name;
+ }
+ return $res;
+ }
}
$r = new ReflectionClassEx('ReflectionClassEx');
@@ -62,10 +62,10 @@ $res = $r->getMethodNames();
foreach($exp as $m)
{
- if (!in_array($m, $exp))
- {
- $miss[] = $m;
- }
+ if (!in_array($m, $exp))
+ {
+ $miss[] = $m;
+ }
}
var_dump($miss);
@@ -75,7 +75,6 @@ sort($props);
var_dump($props);
var_dump($r->name);
?>
-===DONE===
--EXPECT--
array(0) {
}
@@ -86,4 +85,3 @@ array(2) {
string(4) "name"
}
string(17) "ReflectionClassEx"
-===DONE===
diff --git a/ext/reflection/tests/002.phpt b/ext/reflection/tests/002.phpt
index d0fcb32bea..b10013d2a9 100644
--- a/ext/reflection/tests/002.phpt
+++ b/ext/reflection/tests/002.phpt
@@ -5,13 +5,13 @@ Reflection properties are read only
class ReflectionMethodEx extends ReflectionMethod
{
- public $foo = "xyz";
+ public $foo = "xyz";
- function __construct($c,$m)
- {
- echo __METHOD__ . "\n";
- parent::__construct($c,$m);
- }
+ function __construct($c,$m)
+ {
+ echo __METHOD__ . "\n";
+ parent::__construct($c,$m);
+ }
}
$r = new ReflectionMethodEx('ReflectionMethodEx','getName');
@@ -23,11 +23,11 @@ var_dump($r->foo);
try
{
- $r->class = 'bullshit';
+ $r->class = 'bullshit';
}
catch(ReflectionException $e)
{
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try
{
@@ -35,7 +35,7 @@ $r->name = 'bullshit';
}
catch(ReflectionException $e)
{
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
$r->foo = 'bar';
@@ -47,7 +47,6 @@ var_dump($r->foo);
var_dump($r->bar);
?>
-===DONE===
--EXPECT--
ReflectionMethodEx::__construct
string(26) "ReflectionFunctionAbstract"
@@ -60,4 +59,3 @@ string(26) "ReflectionFunctionAbstract"
string(7) "getName"
string(3) "bar"
string(3) "baz"
-===DONE===
diff --git a/ext/reflection/tests/003.phpt b/ext/reflection/tests/003.phpt
index 80bf0a6513..dbafebfb8d 100644
--- a/ext/reflection/tests/003.phpt
+++ b/ext/reflection/tests/003.phpt
@@ -5,18 +5,18 @@ ReflectionMethod::invoke() with base class method
class Foo
{
- function Test()
- {
- echo __METHOD__ . "\n";
- }
+ function Test()
+ {
+ echo __METHOD__ . "\n";
+ }
}
class Bar extends Foo
{
- function Test()
- {
- echo __METHOD__ . "\n";
- }
+ function Test()
+ {
+ echo __METHOD__ . "\n";
+ }
}
$o = new Bar;
@@ -25,7 +25,5 @@ $r = new ReflectionMethod('Foo','Test');
$r->invoke($o);
?>
-===DONE===
--EXPECT--
Foo::Test
-===DONE===
diff --git a/ext/reflection/tests/004.phpt b/ext/reflection/tests/004.phpt
index 36ae406b43..3739d2e55c 100644
--- a/ext/reflection/tests/004.phpt
+++ b/ext/reflection/tests/004.phpt
@@ -4,8 +4,8 @@ ReflectionMethod::invoke() with non object or null value
<?php
class a {
- function a(){
- }
+ function __construct(){
+ }
}
class b {
}
@@ -13,7 +13,7 @@ class b {
$b = new b();
$a=new ReflectionClass("a");
-$m=$a->getMethod("a");
+$m=$a->getMethod("__construct");
try {
$m->invoke(null);
@@ -35,9 +35,7 @@ try {
echo $E->getMessage()."\n";
}
-echo "===DONE===\n";?>
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; a has a deprecated constructor in %s on line %d
-Trying to invoke non static method a::a() without an object
+?>
+--EXPECT--
+Trying to invoke non static method a::__construct() without an object
Given object is not an instance of the class this method was declared in
-===DONE===
diff --git a/ext/reflection/tests/005.phpt b/ext/reflection/tests/005.phpt
index e40fcc3099..58411f98c8 100644
--- a/ext/reflection/tests/005.phpt
+++ b/ext/reflection/tests/005.phpt
@@ -7,18 +7,18 @@ opcache.save_comments=1
function strip_doc_comment($c)
{
- if (!strlen($c) || $c === false) return $c;
- return trim(substr($c, 3, -2));
+ if (!strlen($c) || $c === false) return $c;
+ return trim(substr($c, 3, -2));
}
/** Comment for class A */
class A
{
- /** Method A::bla()
- */
- function bla()
- {
- }
+ /** Method A::bla()
+ */
+ function bla()
+ {
+ }
function foo() {
/**
@@ -42,15 +42,13 @@ var_dump(strip_doc_comment($r->getDocComment()));
foreach($r->getMethods() as $m)
{
- var_dump(strip_doc_comment($m->getDocComment()));
+ var_dump(strip_doc_comment($m->getDocComment()));
}
?>
-===DONE===
--EXPECT--
string(19) "Comment for class A"
string(15) "Method A::bla()"
bool(false)
bool(false)
string(22) "* Comment for A::baz()"
-===DONE===
diff --git a/ext/reflection/tests/006.phpt b/ext/reflection/tests/006.phpt
index ab22f5c5c9..c21aa5af8b 100644
--- a/ext/reflection/tests/006.phpt
+++ b/ext/reflection/tests/006.phpt
@@ -9,81 +9,79 @@ ReflectionClass::[gs]etStaticPropertyValue
Class Test
{
- static public $pub = 'pub';
- static protected $pro = 'pro';
- static private $pri = 'pri';
+ static public $pub = 'pub';
+ static protected $pro = 'pro';
+ static private $pri = 'pri';
- static function testing()
- {
- $ref = new ReflectionClass('Test');
+ static function testing()
+ {
+ $ref = new ReflectionClass('Test');
- foreach(array('pub', 'pro', 'pri') as $name)
- {
- try
- {
- var_dump($ref->getStaticPropertyValue($name));
- var_dump($ref->getStaticPropertyValue($name));
- $ref->setStaticPropertyValue($name, 'updated');
- var_dump($ref->getStaticPropertyValue($name));
- }
- catch(Exception $e)
- {
- echo "EXCEPTION\n";
- }
- }
- }
+ foreach(array('pub', 'pro', 'pri') as $name)
+ {
+ try
+ {
+ var_dump($ref->getStaticPropertyValue($name));
+ var_dump($ref->getStaticPropertyValue($name));
+ $ref->setStaticPropertyValue($name, 'updated');
+ var_dump($ref->getStaticPropertyValue($name));
+ }
+ catch(Exception $e)
+ {
+ echo "EXCEPTION\n";
+ }
+ }
+ }
}
Class TestDerived extends Test
{
// static public $pub = 'pub';
// static protected $pro = 'pro';
- static private $pri = 'pri';
+ static private $pri = 'pri';
- static function testing()
- {
- $ref = new ReflectionClass('Test');
+ static function testing()
+ {
+ $ref = new ReflectionClass('Test');
- foreach(array('pub', 'pro', 'pri') as $name)
- {
- try
- {
- var_dump($ref->getStaticPropertyValue($name));
- var_dump($ref->getStaticPropertyValue($name));
- $ref->setStaticPropertyValue($name, 'updated');
- var_dump($ref->getStaticPropertyValue($name));
- }
- catch(Exception $e)
- {
- echo "EXCEPTION\n";
- }
- }
- }
+ foreach(array('pub', 'pro', 'pri') as $name)
+ {
+ try
+ {
+ var_dump($ref->getStaticPropertyValue($name));
+ var_dump($ref->getStaticPropertyValue($name));
+ $ref->setStaticPropertyValue($name, 'updated');
+ var_dump($ref->getStaticPropertyValue($name));
+ }
+ catch(Exception $e)
+ {
+ echo "EXCEPTION\n";
+ }
+ }
+ }
}
$ref = new ReflectionClass('Test');
foreach(array('pub', 'pro', 'pri') as $name)
{
- try
- {
- var_dump($ref->getStaticPropertyValue($name));
- var_dump($ref->getStaticPropertyValue($name));
- $ref->setStaticPropertyValue($name, 'updated');
- var_dump($ref->getStaticPropertyValue($name));
- }
- catch(Exception $e)
- {
- echo "EXCEPTION\n";
- }
+ try
+ {
+ var_dump($ref->getStaticPropertyValue($name));
+ var_dump($ref->getStaticPropertyValue($name));
+ $ref->setStaticPropertyValue($name, 'updated');
+ var_dump($ref->getStaticPropertyValue($name));
+ }
+ catch(Exception $e)
+ {
+ echo "EXCEPTION\n";
+ }
}
Test::testing();
TestDerived::testing();
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
string(3) "pub"
string(3) "pub"
@@ -100,4 +98,3 @@ string(7) "updated"
string(7) "updated"
EXCEPTION
EXCEPTION
-===DONE===
diff --git a/ext/reflection/tests/007.phpt b/ext/reflection/tests/007.phpt
index 8babf24282..df1d97eea9 100644
--- a/ext/reflection/tests/007.phpt
+++ b/ext/reflection/tests/007.phpt
@@ -5,56 +5,56 @@ ReflectionClass::newInstance[Args]
function test($class)
{
- echo "====>$class\n";
- try
- {
- $ref = new ReflectionClass($class);
- }
- catch (ReflectionException $e)
- {
- var_dump($e->getMessage());
- return; // only here
- }
-
- echo "====>newInstance()\n";
- try
- {
- var_dump($ref->newInstance());
- }
- catch (ReflectionException $e)
- {
- var_dump($e->getMessage());
- }
- catch (Throwable $e)
- {
- echo "Exception: " . $e->getMessage() . "\n";
- }
-
- echo "====>newInstance(25)\n";
- try
- {
- var_dump($ref->newInstance(25));
- }
- catch (ReflectionException $e)
- {
- var_dump($e->getMessage());
- }
-
- echo "====>newInstance(25, 42)\n";
- try
- {
- var_dump($ref->newInstance(25, 42));
- }
- catch (ReflectionException $e)
- {
- var_dump($e->getMessage());
- }
-
- echo "\n";
+ echo "====>$class\n";
+ try
+ {
+ $ref = new ReflectionClass($class);
+ }
+ catch (ReflectionException $e)
+ {
+ var_dump($e->getMessage());
+ return; // only here
+ }
+
+ echo "====>newInstance()\n";
+ try
+ {
+ var_dump($ref->newInstance());
+ }
+ catch (ReflectionException $e)
+ {
+ var_dump($e->getMessage());
+ }
+ catch (Throwable $e)
+ {
+ echo "Exception: " . $e->getMessage() . "\n";
+ }
+
+ echo "====>newInstance(25)\n";
+ try
+ {
+ var_dump($ref->newInstance(25));
+ }
+ catch (ReflectionException $e)
+ {
+ var_dump($e->getMessage());
+ }
+
+ echo "====>newInstance(25, 42)\n";
+ try
+ {
+ var_dump($ref->newInstance(25, 42));
+ }
+ catch (ReflectionException $e)
+ {
+ var_dump($e->getMessage());
+ }
+
+ echo "\n";
}
spl_autoload_register(function ($class) {
- echo __FUNCTION__ . "($class)\n";
+ echo __FUNCTION__ . "($class)\n";
});
test('Class_does_not_exist');
@@ -67,29 +67,27 @@ test('NoCtor');
Class WithCtor
{
- function __construct()
- {
- echo __METHOD__ . "()\n";
- var_dump(func_get_args());
- }
+ function __construct()
+ {
+ echo __METHOD__ . "()\n";
+ var_dump(func_get_args());
+ }
}
test('WithCtor');
Class WithCtorWithArgs
{
- function __construct($arg)
- {
- echo __METHOD__ . "($arg)\n";
- var_dump(func_get_args());
- }
+ function __construct($arg)
+ {
+ echo __METHOD__ . "($arg)\n";
+ var_dump(func_get_args());
+ }
}
test('WithCtorWithArgs');
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
====>Class_does_not_exist
{closure}(Class_does_not_exist)
@@ -151,4 +149,3 @@ array(2) {
object(WithCtorWithArgs)#%d (0) {
}
-===DONE===
diff --git a/ext/reflection/tests/008.phpt b/ext/reflection/tests/008.phpt
index 80a4a39218..10806b0015 100644
--- a/ext/reflection/tests/008.phpt
+++ b/ext/reflection/tests/008.phpt
@@ -6,22 +6,22 @@ ReflectionMethod::__construct() tests
$a = array("", 1, "::", "a::", "::b", "a::b");
foreach ($a as $val) {
- try {
- new ReflectionMethod($val);
- } catch (Exception $e) {
- var_dump($e->getMessage());
- }
+ try {
+ new ReflectionMethod($val);
+ } catch (Exception $e) {
+ var_dump($e->getMessage());
+ }
}
$a = array("", 1, "");
$b = array("", "", 1);
foreach ($a as $key=>$val) {
- try {
- new ReflectionMethod($val, $b[$key]);
- } catch (Exception $e) {
- var_dump($e->getMessage());
- }
+ try {
+ new ReflectionMethod($val, $b[$key]);
+ } catch (Exception $e) {
+ var_dump($e->getMessage());
+ }
}
echo "Done\n";
diff --git a/ext/reflection/tests/009.phpt b/ext/reflection/tests/009.phpt
index d582623cbd..8a57ed9d1d 100644
--- a/ext/reflection/tests/009.phpt
+++ b/ext/reflection/tests/009.phpt
@@ -9,7 +9,7 @@ opcache.save_comments=1
hoho
*/
function test ($a, $b = 1, $c = "") {
- static $var = 1;
+ static $var = 1;
}
$func = new ReflectionFunction("test");
diff --git a/ext/reflection/tests/010.phpt b/ext/reflection/tests/010.phpt
index 8345dc35bf..ae1e4dff0b 100644
--- a/ext/reflection/tests/010.phpt
+++ b/ext/reflection/tests/010.phpt
@@ -1,14 +1,14 @@
--TEST--
-ReflectionMethod::__toString() tests (overriden method)
+ReflectionMethod::__toString() tests (overridden method)
--FILE--
<?php
class Foo {
- function func() {
- }
+ function func() {
+ }
}
class Bar extends Foo {
- function func() {
- }
+ function func() {
+ }
}
$m = new ReflectionMethod("Bar::func");
echo $m;
diff --git a/ext/reflection/tests/012.phpt b/ext/reflection/tests/012.phpt
index d2d1c5f384..4eeeb98f3d 100644
--- a/ext/reflection/tests/012.phpt
+++ b/ext/reflection/tests/012.phpt
@@ -3,7 +3,7 @@ ReflectionClass::getDefaultProperties()
--FILE--
<?php
class Foo {
- public $test = "ok";
+ public $test = "ok";
}
$class = new ReflectionClass("Foo");
$props = $class->getDefaultProperties();
diff --git a/ext/reflection/tests/017.phpt b/ext/reflection/tests/017.phpt
index 322065bf20..be306b53c6 100644
--- a/ext/reflection/tests/017.phpt
+++ b/ext/reflection/tests/017.phpt
@@ -3,7 +3,7 @@ ReflectionClass::__toString() (constants)
--FILE--
<?php
class Foo {
- const test = "ok";
+ const test = "ok";
}
$class = new ReflectionClass("Foo");
echo $class;
diff --git a/ext/reflection/tests/020.phpt b/ext/reflection/tests/020.phpt
index 13ae6fe275..491eed7d1f 100644
--- a/ext/reflection/tests/020.phpt
+++ b/ext/reflection/tests/020.phpt
@@ -3,14 +3,14 @@ ReflectionObject::hasProperty
--FILE--
<?php
class Foo {
- public $p1;
- protected $p2;
- private $p3;
+ public $p1;
+ protected $p2;
+ private $p3;
- function __isset($name) {
- var_dump($name);
- return false;
- }
+ function __isset($name) {
+ var_dump($name);
+ return false;
+ }
}
$obj = new ReflectionObject(new Foo());
var_dump($obj->hasProperty("p1"));
diff --git a/ext/reflection/tests/021.phpt b/ext/reflection/tests/021.phpt
index 42d11cc445..fefcf34e78 100644
--- a/ext/reflection/tests/021.phpt
+++ b/ext/reflection/tests/021.phpt
@@ -3,7 +3,7 @@ ReflectionClass::hasConstant
--FILE--
<?php
class Foo {
- const c1 = 1;
+ const c1 = 1;
}
$class = new ReflectionClass("Foo");
var_dump($class->hasConstant("c1"));
diff --git a/ext/reflection/tests/022.phpt b/ext/reflection/tests/022.phpt
index 2cfd603dad..4a6738f97c 100644
--- a/ext/reflection/tests/022.phpt
+++ b/ext/reflection/tests/022.phpt
@@ -3,7 +3,7 @@ ReflectionClass::getConstant
--FILE--
<?php
class Foo {
- const c1 = 1;
+ const c1 = 1;
}
$class = new ReflectionClass("Foo");
var_dump($class->getConstant("c1"));
diff --git a/ext/reflection/tests/023.phpt b/ext/reflection/tests/023.phpt
index fe10b2531a..7f8c500015 100644
--- a/ext/reflection/tests/023.phpt
+++ b/ext/reflection/tests/023.phpt
@@ -3,14 +3,14 @@ ReflectionClass::getDefaultProperties (filtering parent privates)
--FILE--
<?php
class C1 {
- private $p1 = 1;
- protected $p2 = 2;
- public $p3 = 3;
+ private $p1 = 1;
+ protected $p2 = 2;
+ public $p3 = 3;
}
class C2 extends C1 {
- private $p4 = 4;
- protected $p5 = 5;
- public $p6 = 6;
+ private $p4 = 4;
+ protected $p5 = 5;
+ public $p6 = 6;
}
$class = new ReflectionClass("C2");
var_dump($class->getDefaultProperties());
diff --git a/ext/reflection/tests/024.phpt b/ext/reflection/tests/024.phpt
index 2b894d3f31..0fb1cd6fe2 100644
--- a/ext/reflection/tests/024.phpt
+++ b/ext/reflection/tests/024.phpt
@@ -3,9 +3,9 @@ ReflectionObject::__toString (filtering privates/protected dynamic properties)
--FILE--
<?php
class C1 {
- private $p1 = 1;
- protected $p2 = 2;
- public $p3 = 3;
+ private $p1 = 1;
+ protected $p2 = 2;
+ public $p3 = 3;
}
$x = new C1();
diff --git a/ext/reflection/tests/025.phpt b/ext/reflection/tests/025.phpt
index c18a0f5b8e..2e3316d3c0 100644
--- a/ext/reflection/tests/025.phpt
+++ b/ext/reflection/tests/025.phpt
@@ -9,7 +9,7 @@ opcache.save_comments=1
hoho
*/
function test ($a, $b = 1, $c = "") {
- static $var = 1;
+ static $var = 1;
}
$func = new ReflectionFunction("test");
diff --git a/ext/reflection/tests/027.phpt b/ext/reflection/tests/027.phpt
index e750682ab6..add38f1476 100644
--- a/ext/reflection/tests/027.phpt
+++ b/ext/reflection/tests/027.phpt
@@ -4,7 +4,7 @@ ReflectionGenerator::getTrace()
<?php
function foo()
{
- yield 1;
+ yield 1;
}
$g = foo();
@@ -13,9 +13,9 @@ $r = new ReflectionGenerator($g);
$g->next();
try {
- $r->getTrace();
+ $r->getTrace();
} catch (ReflectionException $e) {
- echo $e->getMessage();
+ echo $e->getMessage();
}
?>
--EXPECT--
diff --git a/ext/reflection/tests/028.phpt b/ext/reflection/tests/028.phpt
index ed6950fce3..bf16785c18 100644
--- a/ext/reflection/tests/028.phpt
+++ b/ext/reflection/tests/028.phpt
@@ -4,16 +4,16 @@ ReflectionGenerator::__construct()
<?php
function foo()
{
- yield 1;
+ yield 1;
}
$g = foo();
$g->next();
try {
- $r = new ReflectionGenerator($g);
+ $r = new ReflectionGenerator($g);
} catch (ReflectionException $e) {
- echo "Done!\n";
+ echo "Done!\n";
}
?>
--EXPECT--
diff --git a/ext/reflection/tests/ReflectionClass_constructor_001.phpt b/ext/reflection/tests/ReflectionClass_constructor_001.phpt
index 1a70fe1f59..0d4fa670c3 100644
--- a/ext/reflection/tests/ReflectionClass_constructor_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_constructor_001.phpt
@@ -8,10 +8,10 @@ $myInstance = new stdClass;
$r2 = new ReflectionClass($myInstance);
class TrickClass {
- function __toString() {
- //Return the name of another class
- return "Exception";
- }
+ function __toString() {
+ //Return the name of another class
+ return "Exception";
+ }
}
$myTrickClass = new TrickClass;
$r3 = new ReflectionClass($myTrickClass);
diff --git a/ext/reflection/tests/ReflectionClass_constructor_002.phpt b/ext/reflection/tests/ReflectionClass_constructor_002.phpt
index c463bb72c1..3744fec06c 100644
--- a/ext/reflection/tests/ReflectionClass_constructor_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_constructor_002.phpt
@@ -3,64 +3,55 @@ ReflectionClass::__constructor() - bad arguments
--FILE--
<?php
try {
- var_dump(new ReflectionClass());
-} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump(new ReflectionClass());
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
try {
- var_dump(new ReflectionClass(null));
+ var_dump(new ReflectionClass(null));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump(new ReflectionClass(true));
+ var_dump(new ReflectionClass(true));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump(new ReflectionClass(1));
+ var_dump(new ReflectionClass(1));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump(new ReflectionClass(array(1,2,3)));
+ var_dump(new ReflectionClass(array(1,2,3)));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump(new ReflectionClass("stdClass", 1));
-} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump(new ReflectionClass("stdClass", 1));
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
try {
- var_dump(new ReflectionClass("X"));
+ var_dump(new ReflectionClass("X"));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
--EXPECTF--
-Warning: ReflectionClass::__construct() expects exactly 1 parameter, 0 given in %s on line 3
-object(ReflectionClass)#%d (1) {
- ["name"]=>
- string(0) ""
-}
+ReflectionClass::__construct() expects exactly 1 parameter, 0 given
Class does not exist
Class 1 does not exist
Class 1 does not exist
-Notice: Array to string conversion in %s on line 27
+Warning: Array to string conversion in %s on line %d
Class Array does not exist
-
-Warning: ReflectionClass::__construct() expects exactly 1 parameter, 2 given in %s on line 33
-object(ReflectionClass)#%d (1) {
- ["name"]=>
- string(0) ""
-}
+ReflectionClass::__construct() expects exactly 1 parameter, 2 given
Class X does not exist
diff --git a/ext/reflection/tests/ReflectionClass_export_array_bug72222.phpt b/ext/reflection/tests/ReflectionClass_export_array_bug72222.phpt
index 80d2be2585..2e050af209 100644
--- a/ext/reflection/tests/ReflectionClass_export_array_bug72222.phpt
+++ b/ext/reflection/tests/ReflectionClass_export_array_bug72222.phpt
@@ -3,8 +3,8 @@ ReflectionClass::__toString() - array constants
--FILE--
<?php
Class A {
- const A = 8;
- const B = ["a", "b"];
+ const A = 8;
+ const B = ["a", "b"];
}
echo new ReflectionClass("A"), "\n";
?>
diff --git a/ext/reflection/tests/ReflectionClass_export_basic1.phpt b/ext/reflection/tests/ReflectionClass_export_basic1.phpt
index d9183442c4..318e47b355 100644
--- a/ext/reflection/tests/ReflectionClass_export_basic1.phpt
+++ b/ext/reflection/tests/ReflectionClass_export_basic1.phpt
@@ -3,15 +3,15 @@ ReflectionClass::__toString() - various parameters
--FILE--
<?php
Class A {
- public function privf(Exception $a) {}
- public function pubf(A $a,
- $b,
- C $c = null,
- $d = K,
- $e = "15 chars long -",
- $f = null,
- $g = false,
- array $h = null) {}
+ public function privf(Exception $a) {}
+ public function pubf(A $a,
+ $b,
+ C $c = null,
+ $d = K,
+ $e = "15 chars long -",
+ $f = null,
+ $g = false,
+ array $h = null) {}
}
Class C extends A { }
@@ -50,12 +50,12 @@ Class [ <user> class C extends A ] {
- Parameters [8] {
Parameter #0 [ <required> A $a ]
Parameter #1 [ <required> $b ]
- Parameter #2 [ <optional> C or NULL $c = NULL ]
+ Parameter #2 [ <optional> ?C $c = NULL ]
Parameter #3 [ <optional> $d = '16 chars long -...' ]
Parameter #4 [ <optional> $e = '15 chars long -' ]
Parameter #5 [ <optional> $f = NULL ]
Parameter #6 [ <optional> $g = false ]
- Parameter #7 [ <optional> array or NULL $h = NULL ]
+ Parameter #7 [ <optional> ?array $h = NULL ]
}
}
}
diff --git a/ext/reflection/tests/ReflectionClass_export_basic2.phpt b/ext/reflection/tests/ReflectionClass_export_basic2.phpt
index 12cee4e6e3..c91c5d1d73 100644
--- a/ext/reflection/tests/ReflectionClass_export_basic2.phpt
+++ b/ext/reflection/tests/ReflectionClass_export_basic2.phpt
@@ -3,8 +3,8 @@ ReflectionClass::__toString() - ensure inherited private props are hidden.
--FILE--
<?php
Class c {
- private $a;
- static private $b;
+ private $a;
+ static private $b;
}
class d extends c {}
diff --git a/ext/reflection/tests/ReflectionClass_getConstant_basic.phpt b/ext/reflection/tests/ReflectionClass_getConstant_basic.phpt
index cbed1252fa..b8906b2070 100644
--- a/ext/reflection/tests/ReflectionClass_getConstant_basic.phpt
+++ b/ext/reflection/tests/ReflectionClass_getConstant_basic.phpt
@@ -3,24 +3,24 @@ ReflectionClass::getConstants()
--FILE--
<?php
class C {
- const a = 'hello from C';
+ const a = 'hello from C';
}
class D extends C {
}
class E extends D {
}
class F extends E {
- const a = 'hello from F';
+ const a = 'hello from F';
}
class X {
}
$classes = array("C", "D", "E", "F", "X");
foreach($classes as $class) {
- echo "Reflecting on class $class: \n";
- $rc = new ReflectionClass($class);
- var_dump($rc->getConstant('a'));
- var_dump($rc->getConstant('doesntexist'));
+ echo "Reflecting on class $class: \n";
+ $rc = new ReflectionClass($class);
+ var_dump($rc->getConstant('a'));
+ var_dump($rc->getConstant('doesnotexist'));
}
?>
--EXPECT--
diff --git a/ext/reflection/tests/ReflectionClass_getConstant_error.phpt b/ext/reflection/tests/ReflectionClass_getConstant_error.phpt
index 5260e719a3..ca9bc0ce2d 100644
--- a/ext/reflection/tests/ReflectionClass_getConstant_error.phpt
+++ b/ext/reflection/tests/ReflectionClass_getConstant_error.phpt
@@ -3,35 +3,19 @@ ReflectionClass::getConstant() - bad params
--FILE--
<?php
class C {
- const myConst = 1;
+ const myConst = 1;
}
$rc = new ReflectionClass("C");
echo "Check invalid params:\n";
-var_dump($rc->getConstant());
-var_dump($rc->getConstant("myConst", "myConst"));
var_dump($rc->getConstant(null));
var_dump($rc->getConstant(1));
var_dump($rc->getConstant(1.5));
var_dump($rc->getConstant(true));
-var_dump($rc->getConstant(array(1,2,3)));
-var_dump($rc->getConstant(new C));
?>
---EXPECTF--
+--EXPECT--
Check invalid params:
-
-Warning: ReflectionClass::getConstant() expects exactly 1 parameter, 0 given in %s on line 8
-NULL
-
-Warning: ReflectionClass::getConstant() expects exactly 1 parameter, 2 given in %s on line 9
-NULL
bool(false)
bool(false)
bool(false)
bool(false)
-
-Warning: ReflectionClass::getConstant() expects parameter 1 to be string, array given in %s on line 14
-NULL
-
-Warning: ReflectionClass::getConstant() expects parameter 1 to be string, object given in %s on line 15
-NULL
diff --git a/ext/reflection/tests/ReflectionClass_getConstants_basic.phpt b/ext/reflection/tests/ReflectionClass_getConstants_basic.phpt
index a9c0cd4225..c4d2c5267f 100644
--- a/ext/reflection/tests/ReflectionClass_getConstants_basic.phpt
+++ b/ext/reflection/tests/ReflectionClass_getConstants_basic.phpt
@@ -3,23 +3,23 @@ ReflectionClass::getConstants()
--FILE--
<?php
class C {
- const a = 'hello from C';
+ const a = 'hello from C';
}
class D extends C {
}
class E extends D {
}
class F extends E {
- const a = 'hello from F';
+ const a = 'hello from F';
}
class X {
}
$classes = array('C', 'D', 'E', 'F', 'X');
foreach($classes as $class) {
- echo "Constants from class $class: \n";
- $rc = new ReflectionClass($class);
- var_dump($rc->getConstants());
+ echo "Constants from class $class: \n";
+ $rc = new ReflectionClass($class);
+ var_dump($rc->getConstants());
}
?>
--EXPECT--
diff --git a/ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt b/ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt
index 5db9d8f3d3..bbf26e04a5 100644
--- a/ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt
+++ b/ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt
@@ -3,81 +3,25 @@ ReflectionClass::getConstructor()
--FILE--
<?php
class NewCtor {
- function __construct() {}
+ function __construct() {}
}
class ExtendsNewCtor extends NewCtor {
}
-class OldCtor {
- function OldCtor() {}
-}
-
-class ExtendsOldCtor extends OldCtor {
-}
-
-
-class X {
- function Y() {}
-}
-
-class Y extends X {
-}
-
-class OldAndNewCtor {
- function OldAndNewCtor() {}
- function __construct() {}
-}
-
-class NewAndOldCtor {
- function __construct() {}
- function NewAndOldCtor() {}
-}
-class B {
- function B() {}
-}
-
-class C extends B {
- function C() {}
-}
-
-class D1 extends C {
- function __construct() {}
-}
-
-class D2 extends C {
-}
-
-$classes = array('NewCtor', 'ExtendsNewCtor', 'OldCtor', 'ExtendsOldCtor',
- 'OldAndNewCtor', 'NewAndOldCtor', 'B', 'C', 'D1', 'D2', 'X', 'Y');
-
+$classes = array('NewCtor', 'ExtendsNewCtor');
foreach ($classes as $class) {
- $rc = new ReflectionClass($class);
- $rm = $rc->getConstructor();
- if ($rm != null) {
- echo "Constructor of $class: " . $rm->getName() . "\n";
- } else {
- echo "No constructor for $class\n";
- }
+ $rc = new ReflectionClass($class);
+ $rm = $rc->getConstructor();
+ if ($rm != null) {
+ echo "Constructor of $class: " . $rm->getName() . "\n";
+ } else {
+ echo "No constructor for $class\n";
+ }
}
?>
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; OldCtor has a deprecated constructor in %s on line %d
-
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; B has a deprecated constructor in %s on line %d
-
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; C has a deprecated constructor in %s on line %d
+--EXPECT--
Constructor of NewCtor: __construct
Constructor of ExtendsNewCtor: __construct
-Constructor of OldCtor: OldCtor
-Constructor of ExtendsOldCtor: OldCtor
-Constructor of OldAndNewCtor: __construct
-Constructor of NewAndOldCtor: __construct
-Constructor of B: B
-Constructor of C: C
-Constructor of D1: __construct
-Constructor of D2: C
-No constructor for X
-No constructor for Y
diff --git a/ext/reflection/tests/ReflectionClass_getDefaultProperties_001.phpt b/ext/reflection/tests/ReflectionClass_getDefaultProperties_001.phpt
index 3778adb403..0adbd34335 100644
--- a/ext/reflection/tests/ReflectionClass_getDefaultProperties_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_getDefaultProperties_001.phpt
@@ -8,68 +8,68 @@ Steve Seear <stevseea@php.net>
class A {
- static public $statPubC = "stat pubC in A";
- static protected $statProtC = "stat protC in A";
- static private $statPrivC = "stat privC in A";
+ static public $statPubC = "stat pubC in A";
+ static protected $statProtC = "stat protC in A";
+ static private $statPrivC = "stat privC in A";
- static public $statPubA = "stat pubA in A";
- static protected $statProtA = "stat protA in A";
- static private $statPrivA = "stat privA in A";
+ static public $statPubA = "stat pubA in A";
+ static protected $statProtA = "stat protA in A";
+ static private $statPrivA = "stat privA in A";
- public $pubC = "pubC in A";
- protected $protC = "protC in A";
- private $privC = "privC in A";
+ public $pubC = "pubC in A";
+ protected $protC = "protC in A";
+ private $privC = "privC in A";
- public $pubA = "pubA in A";
- protected $protA = "protA in A";
- private $privA = "privA in A";
+ public $pubA = "pubA in A";
+ protected $protA = "protA in A";
+ private $privA = "privA in A";
}
class B extends A {
- static public $statPubC = "stat pubC in B";
- static protected $statProtC = "stat protC in B";
- static private $statPrivC = "stat privC in B";
+ static public $statPubC = "stat pubC in B";
+ static protected $statProtC = "stat protC in B";
+ static private $statPrivC = "stat privC in B";
- static public $statPubB = "stat pubB in B";
- static protected $statProtB = "stat protB in B";
- static private $statPrivB = "stat privB in B";
+ static public $statPubB = "stat pubB in B";
+ static protected $statProtB = "stat protB in B";
+ static private $statPrivB = "stat privB in B";
- public $pubC = "pubC in B";
- protected $protC = "protC in B";
- private $privC = "privC in B";
+ public $pubC = "pubC in B";
+ protected $protC = "protC in B";
+ private $privC = "privC in B";
- public $pubB = "pubB in B";
- protected $protB = "protB in B";
- private $privB = "privB in B";
+ public $pubB = "pubB in B";
+ protected $protB = "protB in B";
+ private $privB = "privB in B";
}
class C extends B {
- static public $statPubC = "stat pubC in C";
- static protected $statProtC = "stat protC in C";
- static private $statPrivC = "stat privC in C";
+ static public $statPubC = "stat pubC in C";
+ static protected $statProtC = "stat protC in C";
+ static private $statPrivC = "stat privC in C";
- public $pubC = "pubC in C";
- protected $protC = "protC in C";
- private $privC = "privC in C";
+ public $pubC = "pubC in C";
+ protected $protC = "protC in C";
+ private $privC = "privC in C";
}
class X {
- static public $statPubC = "stat pubC in X";
- static protected $statProtC = "stat protC in X";
- static private $statPrivC = "stat privC in X";
+ static public $statPubC = "stat pubC in X";
+ static protected $statProtC = "stat protC in X";
+ static private $statPrivC = "stat privC in X";
- public $pubC = "pubC in X";
- protected $protC = "protC in X";
- private $privC = "privC in X";
+ public $pubC = "pubC in X";
+ protected $protC = "protC in X";
+ private $privC = "privC in X";
}
$classes = array('A', 'B', 'C', 'X');
foreach ($classes as $class) {
- $rc = new ReflectionClass($class);
- echo "\n\n---- Static properties in $class ----\n";
- print_r($rc->getStaticProperties());
- echo "\n\n---- Default properties in $class ----\n";
- print_r($rc->getDefaultProperties());
+ $rc = new ReflectionClass($class);
+ echo "\n\n---- Static properties in $class ----\n";
+ print_r($rc->getStaticProperties());
+ echo "\n\n---- Default properties in $class ----\n";
+ print_r($rc->getDefaultProperties());
}
?>
diff --git a/ext/reflection/tests/ReflectionClass_getDocComment_001.phpt b/ext/reflection/tests/ReflectionClass_getDocComment_001.phpt
index 9171a8dd25..28b92abedb 100644
--- a/ext/reflection/tests/ReflectionClass_getDocComment_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_getDocComment_001.phpt
@@ -10,9 +10,9 @@ opcache.save_comments=1
/**
- My
+ My
Doc
- * Comment
+ * Comment
for A
* */
@@ -48,9 +48,9 @@ final class G extends C implements I {} {}
$classes = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'I');
foreach ($classes as $class) {
- echo "\n\n---> Doc comment for class $class:\n";
- $rc = new ReflectionClass($class);
- var_dump($rc->getDocComment());
+ echo "\n\n---> Doc comment for class $class:\n";
+ $rc = new ReflectionClass($class);
+ var_dump($rc->getDocComment());
}
@@ -60,9 +60,9 @@ foreach ($classes as $class) {
string(%d) "/**
- My
+ My
Doc
- * Comment
+ * Comment
for A
* */"
diff --git a/ext/reflection/tests/ReflectionClass_getExtensionName_basic.phpt b/ext/reflection/tests/ReflectionClass_getExtensionName_basic.phpt
index 310b22e695..84e38b0802 100644
--- a/ext/reflection/tests/ReflectionClass_getExtensionName_basic.phpt
+++ b/ext/reflection/tests/ReflectionClass_getExtensionName_basic.phpt
@@ -7,8 +7,8 @@ Rein Velt <rein@velt.org>
#testFest Roosendaal 2008-05-10
--FILE--
<?php
- $rc=new reflectionClass('domDocument');
- var_dump( $rc->getExtensionName()) ;
+ $rc=new reflectionClass('domDocument');
+ var_dump( $rc->getExtensionName()) ;
?>
--EXPECT--
string(3) "dom"
diff --git a/ext/reflection/tests/ReflectionClass_getExtensionName_variation.phpt b/ext/reflection/tests/ReflectionClass_getExtensionName_variation.phpt
index 4f78343081..4b4ed125a4 100644
--- a/ext/reflection/tests/ReflectionClass_getExtensionName_variation.phpt
+++ b/ext/reflection/tests/ReflectionClass_getExtensionName_variation.phpt
@@ -6,13 +6,13 @@ Rein Velt <rein@velt.org>
--FILE--
<?php
- class myClass
- {
- public $varX;
- public $varY;
- }
- $rc=new reflectionClass('myClass');
- var_dump( $rc->getExtensionName()) ;
+ class myClass
+ {
+ public $varX;
+ public $varY;
+ }
+ $rc=new reflectionClass('myClass');
+ var_dump( $rc->getExtensionName()) ;
?>
--EXPECT--
bool(false)
diff --git a/ext/reflection/tests/ReflectionClass_getExtension_basic.phpt b/ext/reflection/tests/ReflectionClass_getExtension_basic.phpt
index dbe157acd6..8cd1caad74 100644
--- a/ext/reflection/tests/ReflectionClass_getExtension_basic.phpt
+++ b/ext/reflection/tests/ReflectionClass_getExtension_basic.phpt
@@ -7,8 +7,8 @@ Rein Velt <rein@velt.org>
#testFest Roosendaal 2008-05-10
--FILE--
<?php
- $rc=new reflectionClass('domDocument');
- var_dump($rc->getExtension()) ;
+ $rc=new reflectionClass('domDocument');
+ var_dump($rc->getExtension()) ;
?>
--EXPECTF--
object(ReflectionExtension)#%d (1) {
diff --git a/ext/reflection/tests/ReflectionClass_getExtension_variation.phpt b/ext/reflection/tests/ReflectionClass_getExtension_variation.phpt
index f3697792db..b8a881f9b3 100644
--- a/ext/reflection/tests/ReflectionClass_getExtension_variation.phpt
+++ b/ext/reflection/tests/ReflectionClass_getExtension_variation.phpt
@@ -6,13 +6,13 @@ Rein Velt <rein@velt.org>
--FILE--
<?php
- class myClass
- {
- public $varX;
- public $varY;
- }
- $rc=new reflectionClass('myClass');
- var_dump( $rc->getExtension()) ;
+ class myClass
+ {
+ public $varX;
+ public $varY;
+ }
+ $rc=new reflectionClass('myClass');
+ var_dump( $rc->getExtension()) ;
?>
--EXPECT--
NULL
diff --git a/ext/reflection/tests/ReflectionClass_getInterfaces_001.phpt b/ext/reflection/tests/ReflectionClass_getInterfaces_001.phpt
index 6f7561c462..feaa703c98 100644
--- a/ext/reflection/tests/ReflectionClass_getInterfaces_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_getInterfaces_001.phpt
@@ -29,16 +29,16 @@ class C6 implements I1, I2, I3, I4, I5, I6, I7 {}
$classes = array( 'A0', 'A1', 'B0', 'B1',
- 'I0', 'I1', 'I2', 'I3', 'I4', 'I5', 'I6', 'I7',
- 'C0', 'C1', 'C2', 'C3', 'C4', 'C5', 'C6' );
+ 'I0', 'I1', 'I2', 'I3', 'I4', 'I5', 'I6', 'I7',
+ 'C0', 'C1', 'C2', 'C3', 'C4', 'C5', 'C6' );
foreach ($classes as $class) {
- echo "---( Interfaces implemented by $class )---\n ";
- $rc = new ReflectionClass($class);
- $interfaces = $rc->getInterfaces();
- // Sort interfaces so that tests do not fail because of wrong order.
- ksort($interfaces);
- print_r($interfaces);
+ echo "---( Interfaces implemented by $class )---\n ";
+ $rc = new ReflectionClass($class);
+ $interfaces = $rc->getInterfaces();
+ // Sort interfaces so that tests do not fail because of wrong order.
+ ksort($interfaces);
+ print_r($interfaces);
}
?>
diff --git a/ext/reflection/tests/ReflectionClass_getMethod_001.phpt b/ext/reflection/tests/ReflectionClass_getMethod_001.phpt
index 59887991ec..c8a2ed14ed 100644
--- a/ext/reflection/tests/ReflectionClass_getMethod_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_getMethod_001.phpt
@@ -6,43 +6,43 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
class pubf {
- public function f() {}
- static public function s() {}
+ public function f() {}
+ static public function s() {}
}
class subpubf extends pubf {
}
class protf {
- protected function f() {}
- static protected function s() {}
+ protected function f() {}
+ static protected function s() {}
}
class subprotf extends protf {
}
class privf {
- private function f() {}
- static private function s() {}
+ private function f() {}
+ static private function s() {}
}
class subprivf extends privf {
}
$classes = array("pubf", "subpubf", "protf", "subprotf",
- "privf", "subprivf");
+ "privf", "subprivf");
foreach($classes as $class) {
- echo "Reflecting on class $class: \n";
- $rc = new ReflectionClass($class);
- echo " --> Check for f(): ";
- var_dump($rc->getMethod("f"));
- echo " --> Check for s(): ";
- var_dump($rc->getMethod("s"));
- echo " --> Check for F(): ";
- var_dump($rc->getMethod("F"));
- echo " --> Check for doesntExist(): ";
- try {
- var_dump($rc->getMethod("doesntExist"));
- } catch (Exception $e) {
- echo $e->getMessage() . "\n";
- }
+ echo "Reflecting on class $class: \n";
+ $rc = new ReflectionClass($class);
+ echo " --> Check for f(): ";
+ var_dump($rc->getMethod("f"));
+ echo " --> Check for s(): ";
+ var_dump($rc->getMethod("s"));
+ echo " --> Check for F(): ";
+ var_dump($rc->getMethod("F"));
+ echo " --> Check for doesNotExist(): ";
+ try {
+ var_dump($rc->getMethod("doesNotExist"));
+ } catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+ }
}
?>
--EXPECTF--
@@ -65,7 +65,7 @@ Reflecting on class pubf:
["class"]=>
string(4) "pubf"
}
- --> Check for doesntExist(): Method doesntExist does not exist
+ --> Check for doesNotExist(): Method doesNotExist does not exist
Reflecting on class subpubf:
--> Check for f(): object(ReflectionMethod)#%d (2) {
["name"]=>
@@ -85,7 +85,7 @@ Reflecting on class subpubf:
["class"]=>
string(4) "pubf"
}
- --> Check for doesntExist(): Method doesntExist does not exist
+ --> Check for doesNotExist(): Method doesNotExist does not exist
Reflecting on class protf:
--> Check for f(): object(ReflectionMethod)#%d (2) {
["name"]=>
@@ -105,7 +105,7 @@ Reflecting on class protf:
["class"]=>
string(5) "protf"
}
- --> Check for doesntExist(): Method doesntExist does not exist
+ --> Check for doesNotExist(): Method doesNotExist does not exist
Reflecting on class subprotf:
--> Check for f(): object(ReflectionMethod)#%d (2) {
["name"]=>
@@ -125,7 +125,7 @@ Reflecting on class subprotf:
["class"]=>
string(5) "protf"
}
- --> Check for doesntExist(): Method doesntExist does not exist
+ --> Check for doesNotExist(): Method doesNotExist does not exist
Reflecting on class privf:
--> Check for f(): object(ReflectionMethod)#%d (2) {
["name"]=>
@@ -145,7 +145,7 @@ Reflecting on class privf:
["class"]=>
string(5) "privf"
}
- --> Check for doesntExist(): Method doesntExist does not exist
+ --> Check for doesNotExist(): Method doesNotExist does not exist
Reflecting on class subprivf:
--> Check for f(): object(ReflectionMethod)#%d (2) {
["name"]=>
@@ -165,4 +165,4 @@ Reflecting on class subprivf:
["class"]=>
string(5) "privf"
}
- --> Check for doesntExist(): Method doesntExist does not exist
+ --> Check for doesNotExist(): Method doesNotExist does not exist
diff --git a/ext/reflection/tests/ReflectionClass_getMethod_002.phpt b/ext/reflection/tests/ReflectionClass_getMethod_002.phpt
index 1eb084214b..cebb5cd089 100644
--- a/ext/reflection/tests/ReflectionClass_getMethod_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_getMethod_002.phpt
@@ -6,69 +6,61 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
class C {
- function f() {}
+ function f() {}
}
$rc = new ReflectionClass("C");
echo "Check invalid params:\n";
try {
- var_dump($rc->getMethod());
-} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump($rc->getMethod());
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->getMethod("f", "f"));
-} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump($rc->getMethod("f", "f"));
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->getMethod(null));
+ var_dump($rc->getMethod(null));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->getMethod(1));
+ var_dump($rc->getMethod(1));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->getMethod(1.5));
+ var_dump($rc->getMethod(1.5));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->getMethod(true));
+ var_dump($rc->getMethod(true));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->getMethod(array(1,2,3)));
-} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump($rc->getMethod(array(1,2,3)));
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->getMethod(new C));
-} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump($rc->getMethod(new C));
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
?>
---EXPECTF--
+--EXPECT--
Check invalid params:
-
-Warning: ReflectionClass::getMethod() expects exactly 1 parameter, 0 given in %s on line 9
-NULL
-
-Warning: ReflectionClass::getMethod() expects exactly 1 parameter, 2 given in %s on line 14
-NULL
+ReflectionClass::getMethod() expects exactly 1 parameter, 0 given
+ReflectionClass::getMethod() expects exactly 1 parameter, 2 given
Method does not exist
Method 1 does not exist
Method 1.5 does not exist
Method 1 does not exist
-
-Warning: ReflectionClass::getMethod() expects parameter 1 to be string, array given in %s on line 39
-NULL
-
-Warning: ReflectionClass::getMethod() expects parameter 1 to be string, object given in %s on line 44
-NULL
+ReflectionClass::getMethod() expects parameter 1 to be string, array given
+ReflectionClass::getMethod() expects parameter 1 to be string, object given
diff --git a/ext/reflection/tests/ReflectionClass_getMethods_001.phpt b/ext/reflection/tests/ReflectionClass_getMethods_001.phpt
index dca9adb56d..1f2ed55ffb 100644
--- a/ext/reflection/tests/ReflectionClass_getMethods_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_getMethods_001.phpt
@@ -6,32 +6,32 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
class pubf {
- public function f() {}
- static public function s() {}
+ public function f() {}
+ static public function s() {}
}
class subpubf extends pubf {
}
class protf {
- protected function f() {}
- static protected function s() {}
+ protected function f() {}
+ static protected function s() {}
}
class subprotf extends protf {
}
class privf {
- private function f() {}
- static private function s() {}
+ private function f() {}
+ static private function s() {}
}
class subprivf extends privf {
}
$classes = array("pubf", "subpubf", "protf", "subprotf",
- "privf", "subprivf");
+ "privf", "subprivf");
foreach($classes as $class) {
- echo "Reflecting on class $class: \n";
- $rc = new ReflectionClass($class);
- var_dump($rc->getMethods());
+ echo "Reflecting on class $class: \n";
+ $rc = new ReflectionClass($class);
+ var_dump($rc->getMethods());
}
?>
diff --git a/ext/reflection/tests/ReflectionClass_getMethods_003.phpt b/ext/reflection/tests/ReflectionClass_getMethods_003.phpt
index b08fcaa4d4..d40e0b9122 100644
--- a/ext/reflection/tests/ReflectionClass_getMethods_003.phpt
+++ b/ext/reflection/tests/ReflectionClass_getMethods_003.phpt
@@ -6,14 +6,14 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
class C {
- public function pubf1() {}
- public function pubf2() {}
- private function privf1() {}
- private function privf2() {}
- static public function pubsf1() {}
- static public function pubsf2() {}
- static private function privsf1() {}
- static private function privsf2() {}
+ public function pubf1() {}
+ public function pubf2() {}
+ private function privf1() {}
+ private function privf2() {}
+ static public function pubsf1() {}
+ static public function pubsf2() {}
+ static private function privsf1() {}
+ static private function privsf2() {}
}
$rc = new ReflectionClass("C");
diff --git a/ext/reflection/tests/ReflectionClass_getModifierNames_basic.phpt b/ext/reflection/tests/ReflectionClass_getModifierNames_basic.phpt
index 91a0a18f1a..f792031a01 100644
--- a/ext/reflection/tests/ReflectionClass_getModifierNames_basic.phpt
+++ b/ext/reflection/tests/ReflectionClass_getModifierNames_basic.phpt
@@ -11,34 +11,34 @@ final class c {}
class x
{
- function __construct() {}
- function __destruct() {}
- private function a() {}
- private static function b() {}
- protected function c() {}
- protected static function d() {}
- public function e() {}
- public static function f() {}
- final function g() {}
- function h() {}
+ function __construct() {}
+ function __destruct() {}
+ private function a() {}
+ private static function b() {}
+ protected function c() {}
+ protected static function d() {}
+ public function e() {}
+ public static function f() {}
+ final function g() {}
+ function h() {}
}
abstract class y
{
- abstract function a();
- abstract protected function b();
+ abstract function a();
+ abstract protected function b();
}
function dump_modifierNames($class) {
- $obj = new ReflectionClass($class);
- var_dump($obj->getName(), Reflection::getModifierNames($obj->getModifiers()));
+ $obj = new ReflectionClass($class);
+ var_dump($obj->getName(), Reflection::getModifierNames($obj->getModifiers()));
}
function dump_methodModifierNames($class) {
- $obj = new ReflectionClass($class);
- foreach($obj->getMethods() as $method) {
- var_dump($obj->getName() . "::" . $method->getName(), Reflection::getModifierNames($method->getModifiers()));
- }
+ $obj = new ReflectionClass($class);
+ foreach($obj->getMethods() as $method) {
+ var_dump($obj->getName() . "::" . $method->getName(), Reflection::getModifierNames($method->getModifiers()));
+ }
}
dump_modifierNames('a');
@@ -49,7 +49,6 @@ dump_methodModifierNames('x');
dump_methodModifierNames('y');
?>
-==DONE==
--EXPECT--
string(1) "a"
array(0) {
@@ -136,4 +135,3 @@ array(2) {
[1]=>
string(9) "protected"
}
-==DONE==
diff --git a/ext/reflection/tests/ReflectionClass_getModifiers_basic.phpt b/ext/reflection/tests/ReflectionClass_getModifiers_basic.phpt
index ffe8876133..447f8d2edc 100644
--- a/ext/reflection/tests/ReflectionClass_getModifiers_basic.phpt
+++ b/ext/reflection/tests/ReflectionClass_getModifiers_basic.phpt
@@ -14,8 +14,8 @@ interface f extends d {}
class g extends b {}
function dump_modifiers($class) {
- $obj = new ReflectionClass($class);
- var_dump($obj->getModifiers());
+ $obj = new ReflectionClass($class);
+ var_dump($obj->getModifiers());
}
dump_modifiers('a');
diff --git a/ext/reflection/tests/ReflectionClass_getName_basic.phpt b/ext/reflection/tests/ReflectionClass_getName_basic.phpt
index 37cec4bc81..f230165f0d 100644
--- a/ext/reflection/tests/ReflectionClass_getName_basic.phpt
+++ b/ext/reflection/tests/ReflectionClass_getName_basic.phpt
@@ -3,10 +3,10 @@ ReflectionClass::getName()
--FILE--
<?php
class TrickClass {
- function __toString() {
- //Return the name of another class
- return "Exception";
- }
+ function __toString() {
+ //Return the name of another class
+ return "Exception";
+ }
}
$r1 = new ReflectionClass("stdClass");
diff --git a/ext/reflection/tests/ReflectionClass_getParentClass.phpt b/ext/reflection/tests/ReflectionClass_getParentClass.phpt
index 382948d3d3..ef64de5ecb 100644
--- a/ext/reflection/tests/ReflectionClass_getParentClass.phpt
+++ b/ext/reflection/tests/ReflectionClass_getParentClass.phpt
@@ -10,11 +10,14 @@ class Foo {}
class Bar extends Foo {}
-$rc1 = new ReflectionClass("Bar");
-var_dump($rc1->getParentClass());
+$rc = new ReflectionClass("Bar");
+$parent = $rc->getParentClass();
+$grandParent = $parent->getParentClass();
+var_dump($parent, $grandParent);
?>
--EXPECTF--
object(ReflectionClass)#%d (1) {
["name"]=>
string(3) "Foo"
}
+bool(false)
diff --git a/ext/reflection/tests/ReflectionClass_getParentClass_001.phpt b/ext/reflection/tests/ReflectionClass_getParentClass_001.phpt
deleted file mode 100644
index be50dbb730..0000000000
--- a/ext/reflection/tests/ReflectionClass_getParentClass_001.phpt
+++ /dev/null
@@ -1,38 +0,0 @@
---TEST--
-ReflectionClass::getParentClass()
---CREDITS--
-Robin Fernandes <robinf@php.net>
-Steve Seear <stevseea@php.net>
---FILE--
-<?php
-class A {}
-class B extends A {}
-
-$rc = new ReflectionClass('B');
-$parent = $rc->getParentClass();
-$grandParent = $parent->getParentClass();
-var_dump($parent, $grandParent);
-
-echo "\nTest bad params:\n";
-var_dump($rc->getParentClass(null));
-var_dump($rc->getParentClass('x'));
-var_dump($rc->getParentClass('x', 123));
-
-?>
---EXPECTF--
-object(ReflectionClass)#%d (1) {
- ["name"]=>
- string(1) "A"
-}
-bool(false)
-
-Test bad params:
-
-Warning: ReflectionClass::getParentClass() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionClass::getParentClass() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionClass::getParentClass() expects exactly 0 parameters, 2 given in %s on line %d
-NULL
diff --git a/ext/reflection/tests/ReflectionClass_getProperties_001.phpt b/ext/reflection/tests/ReflectionClass_getProperties_001.phpt
index 3554af3890..0607822a20 100644
--- a/ext/reflection/tests/ReflectionClass_getProperties_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_getProperties_001.phpt
@@ -6,32 +6,32 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
class pubf {
- public $a;
- static public $s;
+ public $a;
+ static public $s;
}
class subpubf extends pubf {
}
class protf {
- protected $a;
- static protected $s;
+ protected $a;
+ static protected $s;
}
class subprotf extends protf {
}
class privf {
- private $a;
- static private $s;
+ private $a;
+ static private $s;
}
class subprivf extends privf {
}
$classes = array("pubf", "subpubf", "protf", "subprotf",
- "privf", "subprivf");
+ "privf", "subprivf");
foreach($classes as $class) {
- echo "Reflecting on class $class: \n";
- $rc = new ReflectionClass($class);
- var_dump($rc->getProperties());
+ echo "Reflecting on class $class: \n";
+ $rc = new ReflectionClass($class);
+ var_dump($rc->getProperties());
}
?>
diff --git a/ext/reflection/tests/ReflectionClass_getProperties_003.phpt b/ext/reflection/tests/ReflectionClass_getProperties_003.phpt
index fe3792a30f..63d5d476b4 100644
--- a/ext/reflection/tests/ReflectionClass_getProperties_003.phpt
+++ b/ext/reflection/tests/ReflectionClass_getProperties_003.phpt
@@ -6,14 +6,14 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
class C {
- public $pub1;
- public $pub2;
- private $priv1;
- private $priv2;
- static public $pubs;
- static public $pubs2;
- static private $privs1;
- static private $privs2;
+ public $pub1;
+ public $pub2;
+ private $priv1;
+ private $priv2;
+ static public $pubs;
+ static public $pubs2;
+ static private $privs1;
+ static private $privs2;
}
$rc = new ReflectionClass("C");
diff --git a/ext/reflection/tests/ReflectionClass_getProperty_001.phpt b/ext/reflection/tests/ReflectionClass_getProperty_001.phpt
index 830608e0ca..2d5494b264 100644
--- a/ext/reflection/tests/ReflectionClass_getProperty_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_getProperty_001.phpt
@@ -6,55 +6,55 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
class pubf {
- public $a;
- static public $s;
+ public $a;
+ static public $s;
}
class subpubf extends pubf {
}
class protf {
- protected $a;
- static protected $s;
+ protected $a;
+ static protected $s;
}
class subprotf extends protf {
}
class privf {
- private $a;
- static protected $s;
+ private $a;
+ static protected $s;
}
class subprivf extends privf {
}
$classes = array("pubf", "subpubf", "protf", "subprotf",
- "privf", "subprivf");
+ "privf", "subprivf");
foreach($classes as $class) {
- echo "Reflecting on class $class: \n";
- $rc = new ReflectionClass($class);
- try {
- echo " --> Check for s: ";
- var_dump($rc->getProperty("s"));
- } catch (exception $e) {
- echo $e->getMessage() . "\n";
- }
- try {
- echo " --> Check for a: ";
- var_dump($rc->getProperty("a"));
- } catch (exception $e) {
- echo $e->getMessage() . "\n";
- }
- try {
- echo " --> Check for A: ";
- var_dump($rc->getProperty("A"));
- } catch (exception $e) {
- echo $e->getMessage() . "\n";
- }
- try {
- echo " --> Check for doesntExist: ";
- var_dump($rc->getProperty("doesntExist"));
- } catch (exception $e) {
- echo $e->getMessage() . "\n";
- }
+ echo "Reflecting on class $class: \n";
+ $rc = new ReflectionClass($class);
+ try {
+ echo " --> Check for s: ";
+ var_dump($rc->getProperty("s"));
+ } catch (exception $e) {
+ echo $e->getMessage() . "\n";
+ }
+ try {
+ echo " --> Check for a: ";
+ var_dump($rc->getProperty("a"));
+ } catch (exception $e) {
+ echo $e->getMessage() . "\n";
+ }
+ try {
+ echo " --> Check for A: ";
+ var_dump($rc->getProperty("A"));
+ } catch (exception $e) {
+ echo $e->getMessage() . "\n";
+ }
+ try {
+ echo " --> Check for doesNotExist: ";
+ var_dump($rc->getProperty("doesNotExist"));
+ } catch (exception $e) {
+ echo $e->getMessage() . "\n";
+ }
}
?>
@@ -73,7 +73,7 @@ Reflecting on class pubf:
string(4) "pubf"
}
--> Check for A: Property A does not exist
- --> Check for doesntExist: Property doesntExist does not exist
+ --> Check for doesNotExist: Property doesNotExist does not exist
Reflecting on class subpubf:
--> Check for s: object(ReflectionProperty)#%d (2) {
["name"]=>
@@ -88,7 +88,7 @@ Reflecting on class subpubf:
string(4) "pubf"
}
--> Check for A: Property A does not exist
- --> Check for doesntExist: Property doesntExist does not exist
+ --> Check for doesNotExist: Property doesNotExist does not exist
Reflecting on class protf:
--> Check for s: object(ReflectionProperty)#%d (2) {
["name"]=>
@@ -103,7 +103,7 @@ Reflecting on class protf:
string(5) "protf"
}
--> Check for A: Property A does not exist
- --> Check for doesntExist: Property doesntExist does not exist
+ --> Check for doesNotExist: Property doesNotExist does not exist
Reflecting on class subprotf:
--> Check for s: object(ReflectionProperty)#%d (2) {
["name"]=>
@@ -118,7 +118,7 @@ Reflecting on class subprotf:
string(5) "protf"
}
--> Check for A: Property A does not exist
- --> Check for doesntExist: Property doesntExist does not exist
+ --> Check for doesNotExist: Property doesNotExist does not exist
Reflecting on class privf:
--> Check for s: object(ReflectionProperty)#%d (2) {
["name"]=>
@@ -133,7 +133,7 @@ Reflecting on class privf:
string(5) "privf"
}
--> Check for A: Property A does not exist
- --> Check for doesntExist: Property doesntExist does not exist
+ --> Check for doesNotExist: Property doesNotExist does not exist
Reflecting on class subprivf:
--> Check for s: object(ReflectionProperty)#%d (2) {
["name"]=>
@@ -143,4 +143,4 @@ Reflecting on class subprivf:
}
--> Check for a: Property a does not exist
--> Check for A: Property A does not exist
- --> Check for doesntExist: Property doesntExist does not exist
+ --> Check for doesNotExist: Property doesNotExist does not exist
diff --git a/ext/reflection/tests/ReflectionClass_getProperty_002.phpt b/ext/reflection/tests/ReflectionClass_getProperty_002.phpt
index 68522e097a..904162b263 100644
--- a/ext/reflection/tests/ReflectionClass_getProperty_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_getProperty_002.phpt
@@ -6,67 +6,59 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
class C {
- public $a;
+ public $a;
}
$rc = new ReflectionClass("C");
echo "Check invalid params:\n";
try {
- var_dump($rc->getProperty());
-} catch (exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump($rc->getProperty());
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->getProperty("a", "a"));
-} catch (exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump($rc->getProperty("a", "a"));
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->getProperty(null));
+ var_dump($rc->getProperty(null));
} catch (exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->getProperty(1));
+ var_dump($rc->getProperty(1));
} catch (exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->getProperty(1.5));
+ var_dump($rc->getProperty(1.5));
} catch (exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->getProperty(true));
+ var_dump($rc->getProperty(true));
} catch (exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->getProperty(array(1,2,3)));
-} catch (exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump($rc->getProperty(array(1,2,3)));
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->getProperty(new C));
-} catch (exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump($rc->getProperty(new C));
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
?>
---EXPECTF--
+--EXPECT--
Check invalid params:
-
-Warning: ReflectionClass::getProperty() expects exactly 1 parameter, 0 given in %s on line 9
-NULL
-
-Warning: ReflectionClass::getProperty() expects exactly 1 parameter, 2 given in %s on line 14
-NULL
+ReflectionClass::getProperty() expects exactly 1 parameter, 0 given
+ReflectionClass::getProperty() expects exactly 1 parameter, 2 given
Property does not exist
Property 1 does not exist
Property 1.5 does not exist
Property 1 does not exist
-
-Warning: ReflectionClass::getProperty() expects parameter 1 to be string, array given in %s on line 39
-NULL
-
-Warning: ReflectionClass::getProperty() expects parameter 1 to be string, object given in %s on line 44
-NULL
+ReflectionClass::getProperty() expects parameter 1 to be string, array given
+ReflectionClass::getProperty() expects parameter 1 to be string, object given
diff --git a/ext/reflection/tests/ReflectionClass_getProperty_003.phpt b/ext/reflection/tests/ReflectionClass_getProperty_003.phpt
index 61d63362dc..34ade2fc5e 100644
--- a/ext/reflection/tests/ReflectionClass_getProperty_003.phpt
+++ b/ext/reflection/tests/ReflectionClass_getProperty_003.phpt
@@ -6,56 +6,56 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
class A {
- static public $pubC = "pubC in A";
- static protected $protC = "protC in A";
- static private $privC = "privC in A";
+ static public $pubC = "pubC in A";
+ static protected $protC = "protC in A";
+ static private $privC = "privC in A";
- static public $pubA = "pubA in A";
- static protected $protA = "protA in A";
- static private $privA = "privA in A";
+ static public $pubA = "pubA in A";
+ static protected $protA = "protA in A";
+ static private $privA = "privA in A";
}
class B extends A {
- static public $pubC = "pubC in B";
- static protected $protC = "protC in B";
- static private $privC = "privC in B";
+ static public $pubC = "pubC in B";
+ static protected $protC = "protC in B";
+ static private $privC = "privC in B";
- static public $pubB = "pubB in B";
- static protected $protB = "protB in B";
- static private $privB = "privB in B";
+ static public $pubB = "pubB in B";
+ static protected $protB = "protB in B";
+ static private $privB = "privB in B";
}
class C extends B {
- static public $pubC = "pubC in C";
- static protected $protC = "protC in C";
- static private $privC = "privC in C";
+ static public $pubC = "pubC in C";
+ static protected $protC = "protC in C";
+ static private $privC = "privC in C";
}
class X {
- static public $pubC = "pubC in X";
- static protected $protC = "protC in X";
- static private $privC = "privC in X";
+ static public $pubC = "pubC in X";
+ static protected $protC = "protC in X";
+ static private $privC = "privC in X";
}
$myC = new C;
$rc = new ReflectionClass("C");
function showInfo($name) {
- global $rc, $myC;
- echo "--- (Reflecting on $name) ---\n";
- try {
- $rp = $rc->getProperty($name);
- } catch (Exception $e) {
- echo $e->getMessage() . "\n";
- return;
- }
- try {
- var_dump($rp);
- var_dump($rp->getValue($myC));
- } catch (Exception $e) {
- echo $e->getMessage() . "\n";
- return;
- }
+ global $rc, $myC;
+ echo "--- (Reflecting on $name) ---\n";
+ try {
+ $rp = $rc->getProperty($name);
+ } catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+ return;
+ }
+ try {
+ var_dump($rp);
+ var_dump($rp->getValue($myC));
+ } catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+ return;
+ }
}
@@ -70,7 +70,7 @@ showInfo("privB");
showInfo("pubC");
showInfo("protC");
showInfo("privC");
-showInfo("doesntExist");
+showInfo("doesNotExist");
showInfo("A::pubC");
showInfo("A::protC");
@@ -89,9 +89,9 @@ showInfo("C::privC");
showInfo("X::pubC");
showInfo("X::protC");
showInfo("X::privC");
-showInfo("X::doesntExist");
+showInfo("X::doesNotExist");
-showInfo("doesntexist::doesntExist");
+showInfo("doesNotexist::doesNotExist");
?>
--EXPECTF--
@@ -155,8 +155,8 @@ object(ReflectionProperty)#%d (2) {
string(1) "C"
}
Cannot access non-public member C::$privC
---- (Reflecting on doesntExist) ---
-Property doesntExist does not exist
+--- (Reflecting on doesNotExist) ---
+Property doesNotExist does not exist
--- (Reflecting on A::pubC) ---
object(ReflectionProperty)#%d (2) {
["name"]=>
@@ -245,7 +245,7 @@ Fully qualified property name X::pubC does not specify a base class of C
Fully qualified property name X::protC does not specify a base class of C
--- (Reflecting on X::privC) ---
Fully qualified property name X::privC does not specify a base class of C
---- (Reflecting on X::doesntExist) ---
-Fully qualified property name X::doesntExist does not specify a base class of C
---- (Reflecting on doesntexist::doesntExist) ---
-Class doesntexist does not exist
+--- (Reflecting on X::doesNotExist) ---
+Fully qualified property name X::doesNotExist does not specify a base class of C
+--- (Reflecting on doesNotexist::doesNotExist) ---
+Class doesnotexist does not exist
diff --git a/ext/reflection/tests/ReflectionClass_getProperty_004.phpt b/ext/reflection/tests/ReflectionClass_getProperty_004.phpt
index ce2aa57871..b5396aae40 100644
--- a/ext/reflection/tests/ReflectionClass_getProperty_004.phpt
+++ b/ext/reflection/tests/ReflectionClass_getProperty_004.phpt
@@ -6,56 +6,56 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
class A {
- public $pubC = "pubC in A";
- protected $protC = "protC in A";
- private $privC = "privC in A";
+ public $pubC = "pubC in A";
+ protected $protC = "protC in A";
+ private $privC = "privC in A";
- public $pubA = "pubA in A";
- protected $protA = "protA in A";
- private $privA = "privA in A";
+ public $pubA = "pubA in A";
+ protected $protA = "protA in A";
+ private $privA = "privA in A";
}
class B extends A {
- public $pubC = "pubC in B";
- protected $protC = "protC in B";
- private $privC = "privC in B";
+ public $pubC = "pubC in B";
+ protected $protC = "protC in B";
+ private $privC = "privC in B";
- public $pubB = "pubB in B";
- protected $protB = "protB in B";
- private $privB = "privB in B";
+ public $pubB = "pubB in B";
+ protected $protB = "protB in B";
+ private $privB = "privB in B";
}
class C extends B {
- public $pubC = "pubC in C";
- protected $protC = "protC in C";
- private $privC = "privC in C";
+ public $pubC = "pubC in C";
+ protected $protC = "protC in C";
+ private $privC = "privC in C";
}
class X {
- public $pubC = "pubC in X";
- protected $protC = "protC in X";
- private $privC = "privC in X";
+ public $pubC = "pubC in X";
+ protected $protC = "protC in X";
+ private $privC = "privC in X";
}
$myC = new C;
$rc = new ReflectionClass("C");
function showInfo($name) {
- global $rc, $myC;
- echo "--- (Reflecting on $name) ---\n";
- try {
- $rp = $rc->getProperty($name);
- } catch (Exception $e) {
- echo $e->getMessage() . "\n";
- return;
- }
- try {
- var_dump($rp);
- var_dump($rp->getValue($myC));
- } catch (Exception $e) {
- echo $e->getMessage() . "\n";
- return;
- }
+ global $rc, $myC;
+ echo "--- (Reflecting on $name) ---\n";
+ try {
+ $rp = $rc->getProperty($name);
+ } catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+ return;
+ }
+ try {
+ var_dump($rp);
+ var_dump($rp->getValue($myC));
+ } catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+ return;
+ }
}
@@ -70,7 +70,7 @@ showInfo("privB");
showInfo("pubC");
showInfo("protC");
showInfo("privC");
-showInfo("doesntExist");
+showInfo("doesNotExist");
showInfo("A::pubC");
showInfo("A::protC");
@@ -89,9 +89,9 @@ showInfo("C::privC");
showInfo("X::pubC");
showInfo("X::protC");
showInfo("X::privC");
-showInfo("X::doesntExist");
+showInfo("X::doesNotExist");
-showInfo("doesntexist::doesntExist");
+showInfo("doesNotexist::doesNotExist");
?>
--EXPECTF--
@@ -155,8 +155,8 @@ object(ReflectionProperty)#%d (2) {
string(1) "C"
}
Cannot access non-public member C::$privC
---- (Reflecting on doesntExist) ---
-Property doesntExist does not exist
+--- (Reflecting on doesNotExist) ---
+Property doesNotExist does not exist
--- (Reflecting on A::pubC) ---
object(ReflectionProperty)#%d (2) {
["name"]=>
@@ -245,7 +245,7 @@ Fully qualified property name X::pubC does not specify a base class of C
Fully qualified property name X::protC does not specify a base class of C
--- (Reflecting on X::privC) ---
Fully qualified property name X::privC does not specify a base class of C
---- (Reflecting on X::doesntExist) ---
-Fully qualified property name X::doesntExist does not specify a base class of C
---- (Reflecting on doesntexist::doesntExist) ---
-Class doesntexist does not exist
+--- (Reflecting on X::doesNotExist) ---
+Fully qualified property name X::doesNotExist does not specify a base class of C
+--- (Reflecting on doesNotexist::doesNotExist) ---
+Class doesnotexist does not exist
diff --git a/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_001.phpt b/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_001.phpt
index 365ec89ff1..b11d2ec0d7 100644
--- a/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_001.phpt
@@ -6,15 +6,15 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
class A {
- static private $privateOverridden = "original private";
- static protected $protectedOverridden = "original protected";
- static public $publicOverridden = "original public";
+ static private $privateOverridden = "original private";
+ static protected $protectedOverridden = "original protected";
+ static public $publicOverridden = "original public";
}
class B extends A {
- static private $privateOverridden = "changed private";
- static protected $protectedOverridden = "changed protected";
- static public $publicOverridden = "changed public";
+ static private $privateOverridden = "changed private";
+ static protected $protectedOverridden = "changed protected";
+ static public $publicOverridden = "changed public";
}
echo "Retrieving static values from A:\n";
@@ -34,17 +34,17 @@ var_dump($rcB->getStaticPropertyValue("publicOverridden"));
echo "\nRetrieving non-existent values from A with no default value:\n";
try {
- var_dump($rcA->getStaticPropertyValue("protectedOverridden"));
- echo "you should not see this";
+ var_dump($rcA->getStaticPropertyValue("protectedOverridden"));
+ echo "you should not see this";
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rcA->getStaticPropertyValue("privateOverridden"));
- echo "you should not see this";
+ var_dump($rcA->getStaticPropertyValue("privateOverridden"));
+ echo "you should not see this";
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
diff --git a/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_002.phpt b/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_002.phpt
index 52fa378eb6..672c7f3e1d 100644
--- a/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_getStaticPropertyValue_002.phpt
@@ -6,46 +6,41 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
class C {
- public static $x;
+ public static $x;
}
$rc = new ReflectionClass('C');
try {
- var_dump($rc->getStaticPropertyValue("x", "default value", 'blah'));
-} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump($rc->getStaticPropertyValue("x", "default value", 'blah'));
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->getStaticPropertyValue());
-} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump($rc->getStaticPropertyValue());
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->getStaticPropertyValue(null));
+ var_dump($rc->getStaticPropertyValue(null));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->getStaticPropertyValue(1.5, 'def'));
+ var_dump($rc->getStaticPropertyValue(1.5, 'def'));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->getStaticPropertyValue(array(1,2,3)));
-} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump($rc->getStaticPropertyValue(array(1,2,3)));
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
?>
---EXPECTF--
-Warning: ReflectionClass::getStaticPropertyValue() expects at most 2 parameters, 3 given in %s on line 8
-NULL
-
-Warning: ReflectionClass::getStaticPropertyValue() expects at least 1 parameter, 0 given in %s on line 13
-NULL
+--EXPECT--
+ReflectionClass::getStaticPropertyValue() expects at most 2 parameters, 3 given
+ReflectionClass::getStaticPropertyValue() expects at least 1 parameter, 0 given
Class C does not have a property named
string(3) "def"
-
-Warning: ReflectionClass::getStaticPropertyValue() expects parameter 1 to be string, array given in %s on line 28
-NULL
+ReflectionClass::getStaticPropertyValue() expects parameter 1 to be string, array given
diff --git a/ext/reflection/tests/ReflectionClass_hasConstant_001.phpt b/ext/reflection/tests/ReflectionClass_hasConstant_001.phpt
index 84e334ba19..5783b2b506 100644
--- a/ext/reflection/tests/ReflectionClass_hasConstant_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_hasConstant_001.phpt
@@ -6,7 +6,7 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
class C {
- const myConst = 1;
+ const myConst = 1;
}
class D extends C {
@@ -19,14 +19,14 @@ var_dump($rc->hasConstant("myConst"));
echo "Check existing constant, different case: ";
var_dump($rc->hasConstant("MyCoNsT"));
echo "Check absent constant: ";
-var_dump($rc->hasConstant("doesntExist"));
+var_dump($rc->hasConstant("doesNotExist"));
$rd = new ReflectionClass("D");
echo "Check inherited constant: ";
var_dump($rd->hasConstant("myConst"));
echo "Check absent constant: ";
-var_dump($rd->hasConstant("doesntExist"));
+var_dump($rd->hasConstant("doesNotExist"));
?>
--EXPECT--
Check existing constant: bool(true)
diff --git a/ext/reflection/tests/ReflectionClass_hasConstant_002.phpt b/ext/reflection/tests/ReflectionClass_hasConstant_002.phpt
index 14c847401d..5dcc7df173 100644
--- a/ext/reflection/tests/ReflectionClass_hasConstant_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_hasConstant_002.phpt
@@ -6,35 +6,19 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
class C {
- const myConst = 1;
+ const myConst = 1;
}
$rc = new ReflectionClass("C");
echo "Check invalid params:\n";
-var_dump($rc->hasConstant());
-var_dump($rc->hasConstant("myConst", "myConst"));
var_dump($rc->hasConstant(null));
var_dump($rc->hasConstant(1));
var_dump($rc->hasConstant(1.5));
var_dump($rc->hasConstant(true));
-var_dump($rc->hasConstant(array(1,2,3)));
-var_dump($rc->hasConstant(new C));
?>
---EXPECTF--
+--EXPECT--
Check invalid params:
-
-Warning: ReflectionClass::hasConstant() expects exactly 1 parameter, 0 given in %s on line 8
-NULL
-
-Warning: ReflectionClass::hasConstant() expects exactly 1 parameter, 2 given in %s on line 9
-NULL
bool(false)
bool(false)
bool(false)
bool(false)
-
-Warning: ReflectionClass::hasConstant() expects parameter 1 to be string, array given in %s on line 14
-NULL
-
-Warning: ReflectionClass::hasConstant() expects parameter 1 to be string, object given in %s on line 15
-NULL
diff --git a/ext/reflection/tests/ReflectionClass_hasMethod_001.phpt b/ext/reflection/tests/ReflectionClass_hasMethod_001.phpt
index dec76febe1..d987897a6e 100644
--- a/ext/reflection/tests/ReflectionClass_hasMethod_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_hasMethod_001.phpt
@@ -6,39 +6,39 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
class pubf {
- public function f() {}
- static public function s() {}
+ public function f() {}
+ static public function s() {}
}
class subpubf extends pubf {
}
class protf {
- protected function f() {}
- static protected function s() {}
+ protected function f() {}
+ static protected function s() {}
}
class subprotf extends protf {
}
class privf {
- private function f() {}
- static private function s() {}
+ private function f() {}
+ static private function s() {}
}
class subprivf extends privf {
}
$classes = array("pubf", "subpubf", "protf", "subprotf",
- "privf", "subprivf");
+ "privf", "subprivf");
foreach($classes as $class) {
- echo "Reflecting on class $class: \n";
- $rc = new ReflectionClass($class);
- echo " --> Check for f(): ";
- var_dump($rc->hasMethod("f"));
- echo " --> Check for s(): ";
- var_dump($rc->hasMethod("s"));
- echo " --> Check for F(): ";
- var_dump($rc->hasMethod("F"));
- echo " --> Check for doesntExist(): ";
- var_dump($rc->hasMethod("doesntExist"));
+ echo "Reflecting on class $class: \n";
+ $rc = new ReflectionClass($class);
+ echo " --> Check for f(): ";
+ var_dump($rc->hasMethod("f"));
+ echo " --> Check for s(): ";
+ var_dump($rc->hasMethod("s"));
+ echo " --> Check for F(): ";
+ var_dump($rc->hasMethod("F"));
+ echo " --> Check for doesNotExist(): ";
+ var_dump($rc->hasMethod("doesNotExist"));
}
?>
--EXPECT--
@@ -46,30 +46,30 @@ Reflecting on class pubf:
--> Check for f(): bool(true)
--> Check for s(): bool(true)
--> Check for F(): bool(true)
- --> Check for doesntExist(): bool(false)
+ --> Check for doesNotExist(): bool(false)
Reflecting on class subpubf:
--> Check for f(): bool(true)
--> Check for s(): bool(true)
--> Check for F(): bool(true)
- --> Check for doesntExist(): bool(false)
+ --> Check for doesNotExist(): bool(false)
Reflecting on class protf:
--> Check for f(): bool(true)
--> Check for s(): bool(true)
--> Check for F(): bool(true)
- --> Check for doesntExist(): bool(false)
+ --> Check for doesNotExist(): bool(false)
Reflecting on class subprotf:
--> Check for f(): bool(true)
--> Check for s(): bool(true)
--> Check for F(): bool(true)
- --> Check for doesntExist(): bool(false)
+ --> Check for doesNotExist(): bool(false)
Reflecting on class privf:
--> Check for f(): bool(true)
--> Check for s(): bool(true)
--> Check for F(): bool(true)
- --> Check for doesntExist(): bool(false)
+ --> Check for doesNotExist(): bool(false)
Reflecting on class subprivf:
--> Check for f(): bool(true)
--> Check for s(): bool(true)
--> Check for F(): bool(true)
- --> Check for doesntExist(): bool(false)
+ --> Check for doesNotExist(): bool(false)
diff --git a/ext/reflection/tests/ReflectionClass_hasMethod_002.phpt b/ext/reflection/tests/ReflectionClass_hasMethod_002.phpt
index 63fe8791fc..2bbc84551e 100644
--- a/ext/reflection/tests/ReflectionClass_hasMethod_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_hasMethod_002.phpt
@@ -6,35 +6,19 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
class C {
- function f() {}
+ function f() {}
}
$rc = new ReflectionClass("C");
echo "Check invalid params:\n";
-var_dump($rc->hasMethod());
-var_dump($rc->hasMethod("f", "f"));
var_dump($rc->hasMethod(null));
var_dump($rc->hasMethod(1));
var_dump($rc->hasMethod(1.5));
var_dump($rc->hasMethod(true));
-var_dump($rc->hasMethod(array(1,2,3)));
-var_dump($rc->hasMethod(new C));
?>
---EXPECTF--
+--EXPECT--
Check invalid params:
-
-Warning: ReflectionClass::hasMethod() expects exactly 1 parameter, 0 given in %s on line 8
-NULL
-
-Warning: ReflectionClass::hasMethod() expects exactly 1 parameter, 2 given in %s on line 9
-NULL
bool(false)
bool(false)
bool(false)
bool(false)
-
-Warning: ReflectionClass::hasMethod() expects parameter 1 to be string, array given in %s on line 14
-NULL
-
-Warning: ReflectionClass::hasMethod() expects parameter 1 to be string, object given in %s on line 15
-NULL
diff --git a/ext/reflection/tests/ReflectionClass_hasProperty_001.phpt b/ext/reflection/tests/ReflectionClass_hasProperty_001.phpt
index a6c3753a78..12040658ba 100644
--- a/ext/reflection/tests/ReflectionClass_hasProperty_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_hasProperty_001.phpt
@@ -6,39 +6,39 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
class pubf {
- public $a;
- static public $s;
+ public $a;
+ static public $s;
}
class subpubf extends pubf {
}
class protf {
- protected $a;
- static protected $s;
+ protected $a;
+ static protected $s;
}
class subprotf extends protf {
}
class privf {
- private $a;
- static protected $s;
+ private $a;
+ static protected $s;
}
class subprivf extends privf {
}
$classes = array("pubf", "subpubf", "protf", "subprotf",
- "privf", "subprivf");
+ "privf", "subprivf");
foreach($classes as $class) {
- echo "Reflecting on class $class: \n";
- $rc = new ReflectionClass($class);
- echo " --> Check for s: ";
- var_dump($rc->hasProperty("s"));
- echo " --> Check for a: ";
- var_dump($rc->hasProperty("a"));
- echo " --> Check for A: ";
- var_dump($rc->hasProperty("A"));
- echo " --> Check for doesntExist: ";
- var_dump($rc->hasProperty("doesntExist"));
+ echo "Reflecting on class $class: \n";
+ $rc = new ReflectionClass($class);
+ echo " --> Check for s: ";
+ var_dump($rc->hasProperty("s"));
+ echo " --> Check for a: ";
+ var_dump($rc->hasProperty("a"));
+ echo " --> Check for A: ";
+ var_dump($rc->hasProperty("A"));
+ echo " --> Check for doesNotExist: ";
+ var_dump($rc->hasProperty("doesNotExist"));
}
?>
--EXPECT--
@@ -46,29 +46,29 @@ Reflecting on class pubf:
--> Check for s: bool(true)
--> Check for a: bool(true)
--> Check for A: bool(false)
- --> Check for doesntExist: bool(false)
+ --> Check for doesNotExist: bool(false)
Reflecting on class subpubf:
--> Check for s: bool(true)
--> Check for a: bool(true)
--> Check for A: bool(false)
- --> Check for doesntExist: bool(false)
+ --> Check for doesNotExist: bool(false)
Reflecting on class protf:
--> Check for s: bool(true)
--> Check for a: bool(true)
--> Check for A: bool(false)
- --> Check for doesntExist: bool(false)
+ --> Check for doesNotExist: bool(false)
Reflecting on class subprotf:
--> Check for s: bool(true)
--> Check for a: bool(true)
--> Check for A: bool(false)
- --> Check for doesntExist: bool(false)
+ --> Check for doesNotExist: bool(false)
Reflecting on class privf:
--> Check for s: bool(true)
--> Check for a: bool(true)
--> Check for A: bool(false)
- --> Check for doesntExist: bool(false)
+ --> Check for doesNotExist: bool(false)
Reflecting on class subprivf:
--> Check for s: bool(true)
--> Check for a: bool(false)
--> Check for A: bool(false)
- --> Check for doesntExist: bool(false)
+ --> Check for doesNotExist: bool(false)
diff --git a/ext/reflection/tests/ReflectionClass_hasProperty_002.phpt b/ext/reflection/tests/ReflectionClass_hasProperty_002.phpt
index 753890394f..a135939052 100644
--- a/ext/reflection/tests/ReflectionClass_hasProperty_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_hasProperty_002.phpt
@@ -6,35 +6,19 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
class C {
- public $a;
+ public $a;
}
$rc = new ReflectionClass("C");
echo "Check invalid params:\n";
-var_dump($rc->hasProperty());
-var_dump($rc->hasProperty("a", "a"));
var_dump($rc->hasProperty(null));
var_dump($rc->hasProperty(1));
var_dump($rc->hasProperty(1.5));
var_dump($rc->hasProperty(true));
-var_dump($rc->hasProperty(array(1,2,3)));
-var_dump($rc->hasProperty(new C));
?>
--EXPECTF--
Check invalid params:
-
-Warning: ReflectionClass::hasProperty() expects exactly 1 parameter, 0 given in %s on line 8
-NULL
-
-Warning: ReflectionClass::hasProperty() expects exactly 1 parameter, 2 given in %s on line 9
-NULL
bool(false)
bool(false)
bool(false)
bool(false)
-
-Warning: ReflectionClass::hasProperty() expects parameter 1 to be string, array given in %s on line 14
-NULL
-
-Warning: ReflectionClass::hasProperty() expects parameter 1 to be string, object given in %s on line 15
-NULL
diff --git a/ext/reflection/tests/ReflectionClass_implementsInterface_001.phpt b/ext/reflection/tests/ReflectionClass_implementsInterface_001.phpt
index d1cbc8ae47..7f28198dfa 100644
--- a/ext/reflection/tests/ReflectionClass_implementsInterface_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_implementsInterface_001.phpt
@@ -15,54 +15,54 @@ class C implements I2 {}
$classNames = array('A', 'B', 'C', 'I1', 'I2');
foreach ($classNames as $className) {
- $rcs[$className] = new ReflectionClass($className);
+ $rcs[$className] = new ReflectionClass($className);
}
foreach ($rcs as $childName => $child) {
- foreach ($rcs as $parentName => $parent) {
- echo "Does " . $childName . " implement " . $parentName . "? \n";
- echo " - Using object argument: ";
- try {
- var_dump($child->implementsInterface($parent));
- } catch (Exception $e) {
- echo $e->getMessage() . "\n";
- }
- echo " - Using string argument: ";
- try {
- var_dump($child->implementsInterface($parentName));
- } catch (Exception $e) {
- echo $e->getMessage() . "\n";
- }
- }
+ foreach ($rcs as $parentName => $parent) {
+ echo "Does " . $childName . " implement " . $parentName . "? \n";
+ echo " - Using object argument: ";
+ try {
+ var_dump($child->implementsInterface($parent));
+ } catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+ }
+ echo " - Using string argument: ";
+ try {
+ var_dump($child->implementsInterface($parentName));
+ } catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+ }
+ }
}
echo "\n\nTest bad arguments:\n";
try {
- var_dump($rcs['A']->implementsInterface());
-} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump($rcs['A']->implementsInterface());
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rcs['A']->implementsInterface('C', 'C'));
-} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump($rcs['A']->implementsInterface('C', 'C'));
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rcs['A']->implementsInterface(null));
+ var_dump($rcs['A']->implementsInterface(null));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rcs['A']->implementsInterface('ThisClassDoesNotExist'));
+ var_dump($rcs['A']->implementsInterface('ThisClassDoesNotExist'));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rcs['A']->implementsInterface(2));
+ var_dump($rcs['A']->implementsInterface(2));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
--EXPECTF--
@@ -144,12 +144,8 @@ Does I2 implement I2?
Test bad arguments:
-
-Warning: ReflectionClass::implementsInterface() expects exactly 1 parameter, 0 given in %s on line 37
-NULL
-
-Warning: ReflectionClass::implementsInterface() expects exactly 1 parameter, 2 given in %s on line 42
-NULL
+ReflectionClass::implementsInterface() expects exactly 1 parameter, 0 given
+ReflectionClass::implementsInterface() expects exactly 1 parameter, 2 given
Parameter one must either be a string or a ReflectionClass object
Interface ThisClassDoesNotExist does not exist
Parameter one must either be a string or a ReflectionClass object
diff --git a/ext/reflection/tests/ReflectionClass_isCloneable_001.phpt b/ext/reflection/tests/ReflectionClass_isCloneable_001.phpt
index 361708a315..caf55fa648 100644
--- a/ext/reflection/tests/ReflectionClass_isCloneable_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_isCloneable_001.phpt
@@ -17,8 +17,8 @@ var_dump($obj->isCloneable());
$h = clone $foo;
class bar {
- private function __clone() {
- }
+ private function __clone() {
+ }
}
$bar = new bar;
print "User class - private __clone\n";
diff --git a/ext/reflection/tests/ReflectionClass_isInstance_basic.phpt b/ext/reflection/tests/ReflectionClass_isInstance_basic.phpt
index a108718894..e34176fe51 100644
--- a/ext/reflection/tests/ReflectionClass_isInstance_basic.phpt
+++ b/ext/reflection/tests/ReflectionClass_isInstance_basic.phpt
@@ -13,17 +13,17 @@ class X {}
$classes = array("A", "B", "C", "I", "X");
$instances = array( "myA" => new A,
- "myB" => new B,
- "myC" => new C,
- "myX" => new X );
+ "myB" => new B,
+ "myC" => new C,
+ "myX" => new X );
foreach ($classes as $class) {
- $rc = new ReflectionClass($class);
+ $rc = new ReflectionClass($class);
- foreach ($instances as $name => $instance) {
- echo "is $name a $class? ";
- var_dump($rc->isInstance($instance));
- }
+ foreach ($instances as $name => $instance) {
+ echo "is $name a $class? ";
+ var_dump($rc->isInstance($instance));
+ }
}
diff --git a/ext/reflection/tests/ReflectionClass_isInstantiable_basic.phpt b/ext/reflection/tests/ReflectionClass_isInstantiable_basic.phpt
index ef179721dc..3bc79b3e79 100644
--- a/ext/reflection/tests/ReflectionClass_isInstantiable_basic.phpt
+++ b/ext/reflection/tests/ReflectionClass_isInstantiable_basic.phpt
@@ -6,28 +6,28 @@ class C {
}
interface iface {
- function f1();
+ function f1();
}
class ifaceImpl implements iface {
- function f1() {}
+ function f1() {}
}
abstract class abstractClass {
- function f1() {}
- abstract function f2();
+ function f1() {}
+ abstract function f2();
}
class D extends abstractClass {
- function f2() {}
+ function f2() {}
}
$classes = array("C", "iface", "ifaceImpl", "abstractClass", "D");
foreach($classes as $class ) {
- $reflectionClass = new ReflectionClass($class);
- echo "Is $class instantiable? ";
- var_dump($reflectionClass->IsInstantiable());
+ $reflectionClass = new ReflectionClass($class);
+ echo "Is $class instantiable? ";
+ var_dump($reflectionClass->IsInstantiable());
}
diff --git a/ext/reflection/tests/ReflectionClass_isInstantiable_variation.phpt b/ext/reflection/tests/ReflectionClass_isInstantiable_variation.phpt
index 1378edd3d2..cdfaf911e4 100644
--- a/ext/reflection/tests/ReflectionClass_isInstantiable_variation.phpt
+++ b/ext/reflection/tests/ReflectionClass_isInstantiable_variation.phpt
@@ -6,50 +6,27 @@ class noCtor {
}
class publicCtorNew {
- public function __construct() {}
+ public function __construct() {}
}
class protectedCtorNew {
- protected function __construct() {}
+ protected function __construct() {}
}
class privateCtorNew {
- private function __construct() {}
+ private function __construct() {}
}
-class publicCtorOld {
- public function publicCtorOld() {}
-}
-
-class protectedCtorOld {
- protected function protectedCtorOld() {}
-}
-
-class privateCtorOld {
- private function privateCtorOld() {}
-}
-
-
-$classes = array("noCtor", "publicCtorNew", "protectedCtorNew", "privateCtorNew",
- "publicCtorOld", "protectedCtorOld", "privateCtorOld");
-
-foreach($classes as $class ) {
- $reflectionClass = new ReflectionClass($class);
- echo "Is $class instantiable? ";
- var_dump($reflectionClass->IsInstantiable());
+$classes = array("noCtor", "publicCtorNew", "protectedCtorNew", "privateCtorNew");
+foreach ($classes as $class) {
+ $reflectionClass = new ReflectionClass($class);
+ echo "Is $class instantiable? ";
+ var_dump($reflectionClass->IsInstantiable());
}
?>
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; publicCtorOld has a deprecated constructor in %s on line %d
-
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; protectedCtorOld has a deprecated constructor in %s on line %d
-
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; privateCtorOld has a deprecated constructor in %s on line %d
+--EXPECT--
Is noCtor instantiable? bool(true)
Is publicCtorNew instantiable? bool(true)
Is protectedCtorNew instantiable? bool(false)
Is privateCtorNew instantiable? bool(false)
-Is publicCtorOld instantiable? bool(true)
-Is protectedCtorOld instantiable? bool(false)
-Is privateCtorOld instantiable? bool(false)
diff --git a/ext/reflection/tests/ReflectionClass_isInternal_basic.phpt b/ext/reflection/tests/ReflectionClass_isInternal_basic.phpt
index 9c656a38b6..48f0c963ea 100644
--- a/ext/reflection/tests/ReflectionClass_isInternal_basic.phpt
+++ b/ext/reflection/tests/ReflectionClass_isInternal_basic.phpt
@@ -12,7 +12,7 @@ $r4 = new ReflectionClass("Exception");
$r5 = new ReflectionClass("C");
var_dump($r1->isInternal(), $r2->isInternal(), $r3->isInternal(),
- $r4->isInternal(), $r5->isInternal());
+ $r4->isInternal(), $r5->isInternal());
?>
--EXPECT--
bool(true)
diff --git a/ext/reflection/tests/ReflectionClass_isIterateable_001.phpt b/ext/reflection/tests/ReflectionClass_isIterateable_001.phpt
index 10a86d9136..ca3e4a8e8f 100644
--- a/ext/reflection/tests/ReflectionClass_isIterateable_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_isIterateable_001.phpt
@@ -10,14 +10,14 @@ Interface ExtendsIterator extends Iterator {
Interface ExtendsIteratorAggregate extends IteratorAggregate {
}
Class IteratorImpl implements Iterator {
- public function next() {}
- public function key() {}
- public function rewind() {}
- public function current() {}
- public function valid() {}
+ public function next() {}
+ public function key() {}
+ public function rewind() {}
+ public function current() {}
+ public function valid() {}
}
Class IterarorAggregateImpl implements IteratorAggregate {
- public function getIterator() {}
+ public function getIterator() {}
}
Class ExtendsIteratorImpl extends IteratorImpl {
}
@@ -27,24 +27,14 @@ Class A {
}
$classes = array('Traversable', 'Iterator', 'IteratorAggregate', 'ExtendsIterator', 'ExtendsIteratorAggregate',
- 'IteratorImpl', 'IterarorAggregateImpl', 'ExtendsIteratorImpl', 'ExtendsIteratorAggregateImpl', 'A');
+ 'IteratorImpl', 'IterarorAggregateImpl', 'ExtendsIteratorImpl', 'ExtendsIteratorAggregateImpl', 'A');
foreach($classes as $class) {
- $rc = new ReflectionClass($class);
- echo "Is $class iterable? ";
- var_dump($rc->isIterateable());
+ $rc = new ReflectionClass($class);
+ echo "Is $class iterable? ";
+ var_dump($rc->isIterateable());
}
-echo "\nTest invalid params:\n";
-$rc = new ReflectionClass('IteratorImpl');
-var_dump($rc->isIterateable(null));
-var_dump($rc->isIterateable(null, null));
-var_dump($rc->isIterateable(1));
-var_dump($rc->isIterateable(1.5));
-var_dump($rc->isIterateable(true));
-var_dump($rc->isIterateable('X'));
-var_dump($rc->isIterateable(null));
-
echo "\nTest static invocation:\n";
ReflectionClass::isIterateable();
@@ -61,32 +51,9 @@ Is ExtendsIteratorImpl iterable? bool(true)
Is ExtendsIteratorAggregateImpl iterable? bool(true)
Is A iterable? bool(false)
-Test invalid params:
-
-Warning: ReflectionClass::isIterateable() expects exactly 0 parameters, 1 given in %s on line 34
-NULL
-
-Warning: ReflectionClass::isIterateable() expects exactly 0 parameters, 2 given in %s on line 35
-NULL
-
-Warning: ReflectionClass::isIterateable() expects exactly 0 parameters, 1 given in %s on line 36
-NULL
-
-Warning: ReflectionClass::isIterateable() expects exactly 0 parameters, 1 given in %s on line 37
-NULL
-
-Warning: ReflectionClass::isIterateable() expects exactly 0 parameters, 1 given in %s on line 38
-NULL
-
-Warning: ReflectionClass::isIterateable() expects exactly 0 parameters, 1 given in %s on line 39
-NULL
-
-Warning: ReflectionClass::isIterateable() expects exactly 0 parameters, 1 given in %s on line 40
-NULL
-
Test static invocation:
-Fatal error: Uncaught Error: Non-static method ReflectionClass::isIterateable() cannot be called statically in %s:43
+Fatal error: Uncaught Error: Non-static method ReflectionClass::isIterateable() cannot be called statically in %s:%d
Stack trace:
#0 {main}
- thrown in %s on line 43
+ thrown in %s on line %d
diff --git a/ext/reflection/tests/ReflectionClass_isIterateable_basic.phpt b/ext/reflection/tests/ReflectionClass_isIterateable_basic.phpt
index 8b65b9a0bd..f11433eced 100644
--- a/ext/reflection/tests/ReflectionClass_isIterateable_basic.phpt
+++ b/ext/reflection/tests/ReflectionClass_isIterateable_basic.phpt
@@ -6,25 +6,25 @@ Felix De Vliegher <felix.devliegher@gmail.com>, Marc Veldman <marc@ibuildings.nl
<?php
class IteratorClass implements Iterator {
- public function __construct() { }
- public function key() {}
- public function current() {}
- function next() {}
- function valid() {}
- function rewind() {}
+ public function __construct() { }
+ public function key() {}
+ public function current() {}
+ function next() {}
+ function valid() {}
+ function rewind() {}
}
class DerivedClass extends IteratorClass {}
class NonIterator {}
function dump_iterateable($class) {
- $reflection = new ReflectionClass($class);
- var_dump($reflection->isIterateable());
+ $reflection = new ReflectionClass($class);
+ var_dump($reflection->isIterateable());
}
$classes = array("ArrayObject", "IteratorClass", "DerivedClass", "NonIterator");
foreach ($classes as $class) {
- echo "Is $class iterateable? ";
- dump_iterateable($class);
+ echo "Is $class iterateable? ";
+ dump_iterateable($class);
}
?>
--EXPECT--
diff --git a/ext/reflection/tests/ReflectionClass_isIterateable_variation1.phpt b/ext/reflection/tests/ReflectionClass_isIterateable_variation1.phpt
index f6d0d5346a..839867893a 100644
--- a/ext/reflection/tests/ReflectionClass_isIterateable_variation1.phpt
+++ b/ext/reflection/tests/ReflectionClass_isIterateable_variation1.phpt
@@ -9,8 +9,8 @@ class BasicClass {}
function dump_iterateable($obj)
{
- $reflection = new ReflectionClass($obj);
- var_dump($reflection->isIterateable());
+ $reflection = new ReflectionClass($obj);
+ var_dump($reflection->isIterateable());
}
$basicClass = new BasicClass();
diff --git a/ext/reflection/tests/ReflectionClass_isSubclassOf_002.phpt b/ext/reflection/tests/ReflectionClass_isSubclassOf_002.phpt
index 368ea7d7ec..b86b70018d 100644
--- a/ext/reflection/tests/ReflectionClass_isSubclassOf_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_isSubclassOf_002.phpt
@@ -10,39 +10,35 @@ $rc = new ReflectionClass('A');
echo "\n\nTest bad arguments:\n";
try {
- var_dump($rc->isSubclassOf());
-} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump($rc->isSubclassOf());
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->isSubclassOf('C', 'C'));
-} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump($rc->isSubclassOf('C', 'C'));
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->isSubclassOf(null));
+ var_dump($rc->isSubclassOf(null));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->isSubclassOf('ThisClassDoesNotExist'));
+ var_dump($rc->isSubclassOf('ThisClassDoesNotExist'));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->isSubclassOf(2));
+ var_dump($rc->isSubclassOf(2));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
---EXPECTF--
+--EXPECT--
Test bad arguments:
-
-Warning: ReflectionClass::isSubclassOf() expects exactly 1 parameter, 0 given in %s on line 7
-NULL
-
-Warning: ReflectionClass::isSubclassOf() expects exactly 1 parameter, 2 given in %s on line 12
-NULL
+ReflectionClass::isSubclassOf() expects exactly 1 parameter, 0 given
+ReflectionClass::isSubclassOf() expects exactly 1 parameter, 2 given
Parameter one must either be a string or a ReflectionClass object
Class ThisClassDoesNotExist does not exist
Parameter one must either be a string or a ReflectionClass object
diff --git a/ext/reflection/tests/ReflectionClass_isSubclassOf_basic.phpt b/ext/reflection/tests/ReflectionClass_isSubclassOf_basic.phpt
index c05ec27ccd..a52611fb21 100644
--- a/ext/reflection/tests/ReflectionClass_isSubclassOf_basic.phpt
+++ b/ext/reflection/tests/ReflectionClass_isSubclassOf_basic.phpt
@@ -12,17 +12,17 @@ class X implements I {}
$classNames = array('A', 'B', 'C', 'I', 'X');
foreach ($classNames as $className) {
- $rcs[$className] = new ReflectionClass($className);
+ $rcs[$className] = new ReflectionClass($className);
}
foreach ($rcs as $childName => $child) {
- foreach ($rcs as $parentName => $parent) {
- echo "Is " . $childName . " a subclass of " . $parentName . "? \n";
- echo " - Using object argument: ";
- var_dump($child->isSubclassOf($parent));
- echo " - Using string argument: ";
- var_dump($child->isSubclassOf($parentName));
- }
+ foreach ($rcs as $parentName => $parent) {
+ echo "Is " . $childName . " a subclass of " . $parentName . "? \n";
+ echo " - Using object argument: ";
+ var_dump($child->isSubclassOf($parent));
+ echo " - Using string argument: ";
+ var_dump($child->isSubclassOf($parentName));
+ }
}
?>
--EXPECT--
diff --git a/ext/reflection/tests/ReflectionClass_isUserDefined_basic.phpt b/ext/reflection/tests/ReflectionClass_isUserDefined_basic.phpt
index e9537c1e8a..ee2206177d 100644
--- a/ext/reflection/tests/ReflectionClass_isUserDefined_basic.phpt
+++ b/ext/reflection/tests/ReflectionClass_isUserDefined_basic.phpt
@@ -12,7 +12,7 @@ $r4 = new ReflectionClass("Exception");
$r5 = new ReflectionClass("C");
var_dump($r1->isUserDefined(), $r2->isUserDefined(), $r3->isUserDefined(),
- $r4->isUserDefined(), $r5->isUserDefined());
+ $r4->isUserDefined(), $r5->isUserDefined());
?>
--EXPECT--
bool(false)
diff --git a/ext/reflection/tests/ReflectionClass_modifiers_001.phpt b/ext/reflection/tests/ReflectionClass_modifiers_001.phpt
index 1370228f04..cb2a6555f1 100644
--- a/ext/reflection/tests/ReflectionClass_modifiers_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_modifiers_001.phpt
@@ -14,11 +14,11 @@ interface I {}
$classes = array("A", "B", "C", "D", "I");
foreach ($classes as $class) {
- $rc = new ReflectionClass($class);
- var_dump($rc->isFinal());
- var_dump($rc->isInterface());
- var_dump($rc->isAbstract());
- var_dump($rc->getModifiers());
+ $rc = new ReflectionClass($class);
+ var_dump($rc->isFinal());
+ var_dump($rc->isInterface());
+ var_dump($rc->isAbstract());
+ var_dump($rc->getModifiers());
}
?>
--EXPECT--
diff --git a/ext/reflection/tests/ReflectionClass_newInstanceArgs_001.phpt b/ext/reflection/tests/ReflectionClass_newInstanceArgs_001.phpt
index 068710311d..7dded54d3f 100644
--- a/ext/reflection/tests/ReflectionClass_newInstanceArgs_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_newInstanceArgs_001.phpt
@@ -5,93 +5,66 @@ Robin Fernandes <robinf@php.net>
Steve Seear <stevseea@php.net>
--FILE--
<?php
-class A {
- public function A() {
- echo "In constructor of class A\n";
- }
-}
class B {
- public function __construct($a, $b) {
- echo "In constructor of class B with args $a, $b\n";
- }
+ public function __construct($a, $b) {
+ echo "In constructor of class B with args $a, $b\n";
+ }
}
class C {
- protected function __construct() {
- echo "In constructor of class C\n";
- }
+ protected function __construct() {
+ echo "In constructor of class C\n";
+ }
}
class D {
- private function __construct() {
- echo "In constructor of class D\n";
- }
+ private function __construct() {
+ echo "In constructor of class D\n";
+ }
}
class E {
}
-$rcA = new ReflectionClass('A');
$rcB = new ReflectionClass('B');
$rcC = new ReflectionClass('C');
$rcD = new ReflectionClass('D');
$rcE = new ReflectionClass('E');
try {
- var_dump($rcA->newInstanceArgs());
-} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
-}
-try {
- var_dump($rcA->newInstanceArgs(array('x')));
+ $rcB->newInstanceArgs();
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
-try {
- var_dump($rcB->newInstanceArgs());
-} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
-}
-try {
- var_dump($rcB->newInstanceArgs(array('x', 123)));
-} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
-}
+var_dump($rcB->newInstanceArgs(array('x', 123)));
try {
- $rcC->newInstanceArgs();
- echo "you should not see this\n";
+ $rcC->newInstanceArgs();
+ echo "you should not see this\n";
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- $rcD->newInstanceArgs();
- echo "you should not see this\n";
+ $rcD->newInstanceArgs();
+ echo "you should not see this\n";
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
$e1 = $rcE->newInstanceArgs();
var_dump($e1);
try {
- $e2 = $rcE->newInstanceArgs(array('x'));
- echo "you should not see this\n";
+ $e2 = $rcE->newInstanceArgs(array('x'));
+ echo "you should not see this\n";
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\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
-In constructor of class A
-object(A)#%d (0) {
-}
-In constructor of class A
-object(A)#%d (0) {
-}
Exception: Too few arguments to function B::__construct(), 0 passed and exactly 2 expected
In constructor of class B with args x, 123
object(B)#%d (0) {
diff --git a/ext/reflection/tests/ReflectionClass_newInstanceArgs_002.phpt b/ext/reflection/tests/ReflectionClass_newInstanceArgs_002.phpt
index bd27dfc173..3295f06108 100644
--- a/ext/reflection/tests/ReflectionClass_newInstanceArgs_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_newInstanceArgs_002.phpt
@@ -6,9 +6,9 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
class A {
- public function __construct($a, $b) {
- echo "In constructor of class B with arg $a\n";
- }
+ public function __construct($a, $b) {
+ echo "In constructor of class B with arg $a\n";
+ }
}
$rc = new ReflectionClass('A');
$a = $rc->newInstanceArgs('x');
@@ -16,8 +16,8 @@ var_dump($a);
?>
--EXPECTF--
-Fatal error: Uncaught TypeError: Argument 1 passed to ReflectionClass::newInstanceArgs() must be of the type array, string given in %s:8
+Fatal error: Uncaught TypeError: ReflectionClass::newInstanceArgs() expects parameter 1 to be array, string given in %s:%d
Stack trace:
#0 %s(%d): ReflectionClass->newInstanceArgs('x')
#1 {main}
- thrown in %s on line 8
+ thrown in %s on line %d
diff --git a/ext/reflection/tests/ReflectionClass_newInstance_001.phpt b/ext/reflection/tests/ReflectionClass_newInstance_001.phpt
index c91d2ee958..22d06e3282 100644
--- a/ext/reflection/tests/ReflectionClass_newInstance_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_newInstance_001.phpt
@@ -5,86 +5,69 @@ Robin Fernandes <robinf@php.net>
Steve Seear <stevseea@php.net>
--FILE--
<?php
-class A {
- public function A() {
- echo "In constructor of class A\n";
- }
-}
class B {
- public function __construct($a, $b) {
- echo "In constructor of class B with args $a, $b\n";
- }
+ public function __construct($a, $b) {
+ echo "In constructor of class B with args $a, $b\n";
+ }
}
class C {
- protected function __construct() {
- echo "In constructor of class C\n";
- }
+ protected function __construct() {
+ echo "In constructor of class C\n";
+ }
}
class D {
- private function __construct() {
- echo "In constructor of class D\n";
- }
+ private function __construct() {
+ echo "In constructor of class D\n";
+ }
}
+
class E {
}
-
-$rcA = new ReflectionClass('A');
$rcB = new ReflectionClass('B');
$rcC = new ReflectionClass('C');
$rcD = new ReflectionClass('D');
$rcE = new ReflectionClass('E');
-$a1 = $rcA->newInstance();
-$a2 = $rcA->newInstance('x');
-var_dump($a1, $a2);
-
try {
- var_dump($rcB->newInstance());
+ var_dump($rcB->newInstance());
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
try {
- var_dump($rcB->newInstance('x', 123));
+ var_dump($rcB->newInstance('x', 123));
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
try {
- $rcC->newInstance();
- echo "you should not see this\n";
+ $rcC->newInstance();
+ echo "you should not see this\n";
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- $rcD->newInstance();
- echo "you should not see this\n";
+ $rcD->newInstance();
+ echo "you should not see this\n";
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
$e1 = $rcE->newInstance();
var_dump($e1);
try {
- $e2 = $rcE->newInstance('x');
- echo "you should not see this\n";
+ $e2 = $rcE->newInstance('x');
+ echo "you should not see this\n";
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\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
-In constructor of class A
-In constructor of class A
-object(A)#%d (0) {
-}
-object(A)#%d (0) {
-}
Exception: Too few arguments to function B::__construct(), 0 passed and exactly 2 expected
In constructor of class B with args x, 123
object(B)#%d (0) {
diff --git a/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_001.phpt b/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_001.phpt
index bfefce369e..f51f4136b1 100644
--- a/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_001.phpt
@@ -6,15 +6,15 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
class A {
- static private $privateOverridden = "original private";
- static protected $protectedOverridden = "original protected";
- static public $publicOverridden = "original public";
+ static private $privateOverridden = "original private";
+ static protected $protectedOverridden = "original protected";
+ static public $publicOverridden = "original public";
}
class B extends A {
- static private $privateOverridden = "changed private";
- static protected $protectedOverridden = "changed protected";
- static public $publicOverridden = "changed public";
+ static private $privateOverridden = "changed private";
+ static protected $protectedOverridden = "changed protected";
+ static public $publicOverridden = "changed public";
}
echo "Set static values in A:\n";
@@ -35,17 +35,17 @@ print_r($rcB->getStaticProperties());
echo "\nSet non-existent values from A with no default value:\n";
try {
- var_dump($rcA->setStaticPropertyValue("protectedOverridden", "new value 8"));
- echo "you should not see this";
+ var_dump($rcA->setStaticPropertyValue("protectedOverridden", "new value 8"));
+ echo "you should not see this";
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rcA->setStaticPropertyValue("privateOverridden", "new value 9"));
- echo "you should not see this";
+ var_dump($rcA->setStaticPropertyValue("privateOverridden", "new value 9"));
+ echo "you should not see this";
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
diff --git a/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt b/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt
index fb472681ca..9e4c69b489 100644
--- a/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt
@@ -6,54 +6,47 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
class C {
- public static $x;
+ public static $x;
}
$rc = new ReflectionClass('C');
try {
- var_dump($rc->setStaticPropertyValue("x", "default value", 'blah'));
-} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump($rc->setStaticPropertyValue("x", "default value", 'blah'));
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->setStaticPropertyValue());
-} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump($rc->setStaticPropertyValue());
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->setStaticPropertyValue(null));
-} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump($rc->setStaticPropertyValue(null));
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->setStaticPropertyValue(null,null));
+ var_dump($rc->setStaticPropertyValue(null,null));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->setStaticPropertyValue(1.5, 'def'));
+ var_dump($rc->setStaticPropertyValue(1.5, 'def'));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($rc->setStaticPropertyValue(array(1,2,3), 'blah'));
-} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump($rc->setStaticPropertyValue(array(1,2,3), 'blah'));
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
?>
---EXPECTF--
-Warning: ReflectionClass::setStaticPropertyValue() expects exactly 2 parameters, 3 given in %s on line 8
-NULL
-
-Warning: ReflectionClass::setStaticPropertyValue() expects exactly 2 parameters, 0 given in %s on line 13
-NULL
-
-Warning: ReflectionClass::setStaticPropertyValue() expects exactly 2 parameters, 1 given in %s on line 18
-NULL
+--EXPECT--
+ReflectionClass::setStaticPropertyValue() expects exactly 2 parameters, 3 given
+ReflectionClass::setStaticPropertyValue() expects exactly 2 parameters, 0 given
+ReflectionClass::setStaticPropertyValue() expects exactly 2 parameters, 1 given
Class C does not have a property named
Class C does not have a property named 1.5
-
-Warning: ReflectionClass::setStaticPropertyValue() expects parameter 1 to be string, array given in %s on line 33
-NULL
+ReflectionClass::setStaticPropertyValue() expects parameter 1 to be string, array given
diff --git a/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_003.phpt b/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_003.phpt
index a83900a123..959cc1bea0 100644
--- a/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_003.phpt
+++ b/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_003.phpt
@@ -11,7 +11,7 @@ class Test {
$rc = new ReflectionClass('Test');
try {
- $rc->setStaticPropertyValue("y", "foo");
+ $rc->setStaticPropertyValue("y", "foo");
} catch (TypeError $e) { echo $e->getMessage(), "\n"; }
var_dump(Test::$y);
@@ -22,7 +22,7 @@ var_dump(Test::$y);
Test::$x =& Test::$y;
try {
- $rc->setStaticPropertyValue("x", "foo");
+ $rc->setStaticPropertyValue("x", "foo");
} catch (TypeError $e) { echo $e->getMessage(), "\n"; }
var_dump(Test::$y);
@@ -31,7 +31,7 @@ var_dump(Test::$y);
?>
--EXPECT--
-Typed property Test::$y must be int, string used
+Cannot assign string to property Test::$y of type int
int(2)
int(21)
Cannot assign string to reference held by property Test::$y of type int
diff --git a/ext/reflection/tests/ReflectionClass_toString_001.phpt b/ext/reflection/tests/ReflectionClass_toString_001.phpt
index 2cfd808cb8..a70e09fa68 100644
--- a/ext/reflection/tests/ReflectionClass_toString_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_toString_001.phpt
@@ -25,7 +25,7 @@ Class [ <internal:Reflection> class ReflectionClass implements Reflector ] {
- Parameters [2] {
Parameter #0 [ <required> $argument ]
- Parameter #1 [ <optional> $return ]
+ Parameter #1 [ <optional> bool $return ]
}
}
}
@@ -123,49 +123,49 @@ Class [ <internal:Reflection> class ReflectionClass implements Reflector ] {
Method [ <internal:Reflection> public method hasMethod ] {
- Parameters [1] {
- Parameter #0 [ <required> $name ]
+ Parameter #0 [ <required> string $name ]
}
}
Method [ <internal:Reflection> public method getMethod ] {
- Parameters [1] {
- Parameter #0 [ <required> $name ]
+ Parameter #0 [ <required> string $name ]
}
}
Method [ <internal:Reflection> public method getMethods ] {
- Parameters [1] {
- Parameter #0 [ <optional> $filter ]
+ Parameter #0 [ <optional> ?int $filter ]
}
}
Method [ <internal:Reflection> public method hasProperty ] {
- Parameters [1] {
- Parameter #0 [ <required> $name ]
+ Parameter #0 [ <required> string $name ]
}
}
Method [ <internal:Reflection> public method getProperty ] {
- Parameters [1] {
- Parameter #0 [ <required> $name ]
+ Parameter #0 [ <required> string $name ]
}
}
Method [ <internal:Reflection> public method getProperties ] {
- Parameters [1] {
- Parameter #0 [ <optional> $filter ]
+ Parameter #0 [ <optional> ?int $filter ]
}
}
Method [ <internal:Reflection> public method hasConstant ] {
- Parameters [1] {
- Parameter #0 [ <required> $name ]
+ Parameter #0 [ <required> string $name ]
}
}
@@ -184,14 +184,14 @@ Class [ <internal:Reflection> class ReflectionClass implements Reflector ] {
Method [ <internal:Reflection> public method getConstant ] {
- Parameters [1] {
- Parameter #0 [ <required> $name ]
+ Parameter #0 [ <required> string $name ]
}
}
Method [ <internal:Reflection> public method getReflectionConstant ] {
- Parameters [1] {
- Parameter #0 [ <required> $name ]
+ Parameter #0 [ <required> string $name ]
}
}
@@ -258,14 +258,14 @@ Class [ <internal:Reflection> class ReflectionClass implements Reflector ] {
Method [ <internal:Reflection> public method isInstance ] {
- Parameters [1] {
- Parameter #0 [ <required> $object ]
+ Parameter #0 [ <required> object $object ]
}
}
Method [ <internal:Reflection> public method newInstance ] {
- Parameters [1] {
- Parameter #0 [ <required> $args ]
+ Parameter #0 [ <optional> ...$args ]
}
}
@@ -304,7 +304,7 @@ Class [ <internal:Reflection> class ReflectionClass implements Reflector ] {
Method [ <internal:Reflection> public method getStaticPropertyValue ] {
- Parameters [2] {
- Parameter #0 [ <required> $name ]
+ Parameter #0 [ <required> string $name ]
Parameter #1 [ <optional> $default ]
}
}
@@ -312,7 +312,7 @@ Class [ <internal:Reflection> class ReflectionClass implements Reflector ] {
Method [ <internal:Reflection> public method setStaticPropertyValue ] {
- Parameters [2] {
- Parameter #0 [ <required> $name ]
+ Parameter #0 [ <required> string $name ]
Parameter #1 [ <required> $value ]
}
}
diff --git a/ext/reflection/tests/ReflectionClass_toString_002.phpt b/ext/reflection/tests/ReflectionClass_toString_002.phpt
index 5395ae66b9..a6824e540d 100644
--- a/ext/reflection/tests/ReflectionClass_toString_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_toString_002.phpt
@@ -6,21 +6,21 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
Class A {
- function f() {}
+ function f() {}
}
Class B extends A {
- function f() {}
+ function f() {}
}
Class C extends B {
}
Class D extends C {
- function f() {}
+ function f() {}
}
foreach (array('A', 'B', 'C', 'D') as $class) {
- echo "\n\n----( Reflection class $class: )----\n";
- $rc = new ReflectionClass($class);
- echo $rc;
+ echo "\n\n----( Reflection class $class: )----\n";
+ $rc = new ReflectionClass($class);
+ echo $rc;
}
?>
diff --git a/ext/reflection/tests/ReflectionClass_toString_003.phpt b/ext/reflection/tests/ReflectionClass_toString_003.phpt
index 1ce1fddf91..a67d0bfac5 100644
--- a/ext/reflection/tests/ReflectionClass_toString_003.phpt
+++ b/ext/reflection/tests/ReflectionClass_toString_003.phpt
@@ -6,21 +6,21 @@ Steve Seear <stevseea@php.net>
--FILE--
<?php
Class A {
- private function f() {}
+ private function f() {}
}
Class B extends A {
- private function f() {}
+ private function f() {}
}
Class C extends B {
}
Class D extends C {
- private function f() {}
+ private function f() {}
}
foreach (array('A', 'B', 'C', 'D') as $class) {
- echo "\n\n----( Reflection class $class: )----\n";
- $rc = new ReflectionClass($class);
- echo $rc;
+ echo "\n\n----( Reflection class $class: )----\n";
+ $rc = new ReflectionClass($class);
+ echo $rc;
}
?>
diff --git a/ext/reflection/tests/ReflectionExtension_bug66218.phpt b/ext/reflection/tests/ReflectionExtension_bug66218.phpt
index 77f3d230b3..f42967c089 100644
--- a/ext/reflection/tests/ReflectionExtension_bug66218.phpt
+++ b/ext/reflection/tests/ReflectionExtension_bug66218.phpt
@@ -2,7 +2,6 @@
ReflectionExtension::getFunctions() ##6218 zend_register_functions breaks reflection
--SKIPIF--
<?php
-if (PHP_SAPI != "cli") die("skip CLI only test");
if (!function_exists("dl")) die("skip need dl");
?>
--FILE--
diff --git a/ext/reflection/tests/ReflectionExtension_constructor_basic.phpt b/ext/reflection/tests/ReflectionExtension_constructor_basic.phpt
index 72c8ac6bd8..25a4bbf4b8 100644
--- a/ext/reflection/tests/ReflectionExtension_constructor_basic.phpt
+++ b/ext/reflection/tests/ReflectionExtension_constructor_basic.phpt
@@ -9,7 +9,5 @@ $obj = new ReflectionExtension('reflection');
$test = $obj instanceof ReflectionExtension;
var_dump($test);
?>
-==DONE==
--EXPECT--
bool(true)
-==DONE==
diff --git a/ext/reflection/tests/ReflectionExtension_constructor_error.phpt b/ext/reflection/tests/ReflectionExtension_constructor_error.phpt
index 94071de5ab..9f25858402 100644
--- a/ext/reflection/tests/ReflectionExtension_constructor_error.phpt
+++ b/ext/reflection/tests/ReflectionExtension_constructor_error.phpt
@@ -6,28 +6,26 @@ Leon Luijkx <leon@phpgg.nl>
--FILE--
<?php
try {
- $obj = new ReflectionExtension();
+ $obj = new ReflectionExtension();
} catch (TypeError $re) {
- echo "Ok - ".$re->getMessage().PHP_EOL;
+ echo "Ok - ".$re->getMessage().PHP_EOL;
}
try {
- $obj = new ReflectionExtension('foo', 'bar');
+ $obj = new ReflectionExtension('foo', 'bar');
} catch (TypeError $re) {
- echo "Ok - ".$re->getMessage().PHP_EOL;
+ echo "Ok - ".$re->getMessage().PHP_EOL;
}
try {
- $obj = new ReflectionExtension([]);
+ $obj = new ReflectionExtension([]);
} catch (TypeError $re) {
- echo "Ok - ".$re->getMessage().PHP_EOL;
+ echo "Ok - ".$re->getMessage().PHP_EOL;
}
?>
-==DONE==
--EXPECTF--
Ok - ReflectionExtension::__construct() expects exactly %d parameter, %d given
Ok - ReflectionExtension::__construct() expects exactly %d parameter, %d given
Ok - ReflectionExtension::__construct() expects parameter 1 to be string, array given
-==DONE==
diff --git a/ext/reflection/tests/ReflectionExtension_export_basic.phpt b/ext/reflection/tests/ReflectionExtension_export_basic.phpt
index 4652a409a1..42972f1574 100644
--- a/ext/reflection/tests/ReflectionExtension_export_basic.phpt
+++ b/ext/reflection/tests/ReflectionExtension_export_basic.phpt
@@ -11,8 +11,6 @@ ReflectionExtension::export("reflection", false);
$test = ob_get_clean();
var_dump(empty($test));
?>
-==DONE==
--EXPECTF--
Deprecated: Function ReflectionExtension::export() is deprecated in %s on line %d
bool(false)
-==DONE==
diff --git a/ext/reflection/tests/ReflectionExtension_getClassNames_basic.phpt b/ext/reflection/tests/ReflectionExtension_getClassNames_basic.phpt
index 3fea08c43f..e90209ee67 100644
--- a/ext/reflection/tests/ReflectionExtension_getClassNames_basic.phpt
+++ b/ext/reflection/tests/ReflectionExtension_getClassNames_basic.phpt
@@ -7,7 +7,6 @@ Felix De Vliegher <felix.devliegher@gmail.com>
$standard = new ReflectionExtension('standard');
var_dump($standard->getClassNames());
?>
-==DONE==
--EXPECTF--
array(4) {
[0]=>
@@ -19,4 +18,3 @@ array(4) {
[3]=>
%s(14) "AssertionError"
}
-==DONE==
diff --git a/ext/reflection/tests/ReflectionExtension_getClassNames_variation1.phpt b/ext/reflection/tests/ReflectionExtension_getClassNames_variation1.phpt
index 91912b9220..34f6112d98 100644
--- a/ext/reflection/tests/ReflectionExtension_getClassNames_variation1.phpt
+++ b/ext/reflection/tests/ReflectionExtension_getClassNames_variation1.phpt
@@ -11,8 +11,6 @@ extension_loaded('ctype') or die("skip Requires 'ctype' extension");
$extension = new ReflectionExtension('ctype');
var_dump($extension->getClassNames());
?>
-==DONE==
--EXPECT--
array(0) {
}
-==DONE==
diff --git a/ext/reflection/tests/ReflectionExtension_getClasses_basic.phpt b/ext/reflection/tests/ReflectionExtension_getClasses_basic.phpt
index 5877f88e27..61a0d24b08 100644
--- a/ext/reflection/tests/ReflectionExtension_getClasses_basic.phpt
+++ b/ext/reflection/tests/ReflectionExtension_getClasses_basic.phpt
@@ -7,9 +7,8 @@ Thijs Lensselink <tl@lenss.nl>
$ext = new ReflectionExtension('reflection');
var_dump($ext->getClasses());
?>
-==DONE==
--EXPECT--
-array(17) {
+array(18) {
["ReflectionException"]=>
object(ReflectionClass)#2 (1) {
["name"]=>
@@ -55,45 +54,49 @@ array(17) {
["name"]=>
string(19) "ReflectionNamedType"
}
- ["ReflectionMethod"]=>
+ ["ReflectionUnionType"]=>
object(ReflectionClass)#11 (1) {
["name"]=>
+ string(19) "ReflectionUnionType"
+ }
+ ["ReflectionMethod"]=>
+ object(ReflectionClass)#12 (1) {
+ ["name"]=>
string(16) "ReflectionMethod"
}
["ReflectionClass"]=>
- object(ReflectionClass)#12 (1) {
+ object(ReflectionClass)#13 (1) {
["name"]=>
string(15) "ReflectionClass"
}
["ReflectionObject"]=>
- object(ReflectionClass)#13 (1) {
+ object(ReflectionClass)#14 (1) {
["name"]=>
string(16) "ReflectionObject"
}
["ReflectionProperty"]=>
- object(ReflectionClass)#14 (1) {
+ object(ReflectionClass)#15 (1) {
["name"]=>
string(18) "ReflectionProperty"
}
["ReflectionClassConstant"]=>
- object(ReflectionClass)#15 (1) {
+ object(ReflectionClass)#16 (1) {
["name"]=>
string(23) "ReflectionClassConstant"
}
["ReflectionExtension"]=>
- object(ReflectionClass)#16 (1) {
+ object(ReflectionClass)#17 (1) {
["name"]=>
string(19) "ReflectionExtension"
}
["ReflectionZendExtension"]=>
- object(ReflectionClass)#17 (1) {
+ object(ReflectionClass)#18 (1) {
["name"]=>
string(23) "ReflectionZendExtension"
}
["ReflectionReference"]=>
- object(ReflectionClass)#18 (1) {
+ object(ReflectionClass)#19 (1) {
["name"]=>
string(19) "ReflectionReference"
}
}
-==DONE==
diff --git a/ext/reflection/tests/ReflectionExtension_getDependencies_basic.phpt b/ext/reflection/tests/ReflectionExtension_getDependencies_basic.phpt
index 8b5293a48f..306380c9d1 100644
--- a/ext/reflection/tests/ReflectionExtension_getDependencies_basic.phpt
+++ b/ext/reflection/tests/ReflectionExtension_getDependencies_basic.phpt
@@ -11,7 +11,6 @@ if (!extension_loaded("dom")) die("skip no dom extension");
$dom = new ReflectionExtension('dom');
var_dump($dom->getDependencies());
?>
-==DONE==
--EXPECTF--
array(2) {
["libxml"]=>
@@ -19,4 +18,3 @@ array(2) {
["domxml"]=>
%s(9) "Conflicts"
}
-==DONE==
diff --git a/ext/reflection/tests/ReflectionExtension_getDependencies_variation2.phpt b/ext/reflection/tests/ReflectionExtension_getDependencies_variation2.phpt
index 5b0ade5da2..be13fe27a8 100644
--- a/ext/reflection/tests/ReflectionExtension_getDependencies_variation2.phpt
+++ b/ext/reflection/tests/ReflectionExtension_getDependencies_variation2.phpt
@@ -7,10 +7,8 @@ Felix De Vliegher <felix.devliegher@gmail.com>
$standard = new ReflectionExtension('standard');
var_dump($standard->getDependencies());
?>
-==DONE==
--EXPECTF--
array(1) {
["session"]=>
%s(8) "Optional"
}
-==DONE==
diff --git a/ext/reflection/tests/ReflectionExtension_getName_basic.phpt b/ext/reflection/tests/ReflectionExtension_getName_basic.phpt
index 9dae1f3a6b..c26044f710 100644
--- a/ext/reflection/tests/ReflectionExtension_getName_basic.phpt
+++ b/ext/reflection/tests/ReflectionExtension_getName_basic.phpt
@@ -8,7 +8,5 @@ Leon Luijkx <leon@phpgg.nl>
$obj = new ReflectionExtension('reflection');
var_dump($obj->getName());
?>
-==DONE==
--EXPECT--
string(10) "Reflection"
-==DONE==
diff --git a/ext/reflection/tests/ReflectionExtension_getVersion_basic.phpt b/ext/reflection/tests/ReflectionExtension_getVersion_basic.phpt
index 19dee82710..0139a1c4ae 100644
--- a/ext/reflection/tests/ReflectionExtension_getVersion_basic.phpt
+++ b/ext/reflection/tests/ReflectionExtension_getVersion_basic.phpt
@@ -10,7 +10,5 @@ $var = $obj->getVersion() ? $obj->getVersion() : null;
$test = floatval($var) == $var ? true : false;
var_dump($test);
?>
-==DONE==
--EXPECT--
bool(true)
-==DONE==
diff --git a/ext/reflection/tests/ReflectionExtension_info_basic.phpt b/ext/reflection/tests/ReflectionExtension_info_basic.phpt
index 48f6a65099..6eac5a56e7 100644
--- a/ext/reflection/tests/ReflectionExtension_info_basic.phpt
+++ b/ext/reflection/tests/ReflectionExtension_info_basic.phpt
@@ -12,8 +12,6 @@ $testb = ob_get_clean();
var_dump($testa);
var_dump(strlen($testb) > 24);
?>
-==DONE==
--EXPECT--
NULL
bool(true)
-==DONE==
diff --git a/ext/reflection/tests/ReflectionExtension_isPersistant.phpt b/ext/reflection/tests/ReflectionExtension_isPersistant.phpt
index a78a8bbc3d..642a79bd3b 100644
--- a/ext/reflection/tests/ReflectionExtension_isPersistant.phpt
+++ b/ext/reflection/tests/ReflectionExtension_isPersistant.phpt
@@ -5,7 +5,5 @@ ReflectionExtension::isPersistent()
$obj = new ReflectionExtension('reflection');
var_dump($obj->isPersistent());
?>
-==DONE==
--EXPECT--
bool(true)
-==DONE==
diff --git a/ext/reflection/tests/ReflectionExtension_isTemporary.phpt b/ext/reflection/tests/ReflectionExtension_isTemporary.phpt
index be97641be1..791662ff13 100644
--- a/ext/reflection/tests/ReflectionExtension_isTemporary.phpt
+++ b/ext/reflection/tests/ReflectionExtension_isTemporary.phpt
@@ -5,7 +5,5 @@ ReflectionExtension::isTemporary()
$obj = new ReflectionExtension('reflection');
var_dump($obj->isTemporary());
?>
-==DONE==
--EXPECT--
bool(false)
-==DONE==
diff --git a/ext/reflection/tests/ReflectionFunction_001.phpt b/ext/reflection/tests/ReflectionFunction_001.phpt
index 6785e5d0b1..4c0a58ca9d 100644
--- a/ext/reflection/tests/ReflectionFunction_001.phpt
+++ b/ext/reflection/tests/ReflectionFunction_001.phpt
@@ -10,10 +10,10 @@ Steve Seear <stevseea@php.net>
* my doc comment
*/
function foo () {
- static $c;
- static $a = 1;
- static $b = "hello";
- $d = 5;
+ static $c;
+ static $a = 1;
+ static $b = "hello";
+ $d = 5;
}
/***
@@ -23,13 +23,13 @@ function bar () {}
function dumpFuncInfo($name) {
- $funcInfo = new ReflectionFunction($name);
- var_dump($funcInfo->getName());
- var_dump($funcInfo->isInternal());
- var_dump($funcInfo->isUserDefined());
- var_dump($funcInfo->getStartLine());
- var_dump($funcInfo->getEndLine());
- var_dump($funcInfo->getStaticVariables());
+ $funcInfo = new ReflectionFunction($name);
+ var_dump($funcInfo->getName());
+ var_dump($funcInfo->isInternal());
+ var_dump($funcInfo->isUserDefined());
+ var_dump($funcInfo->getStartLine());
+ var_dump($funcInfo->getEndLine());
+ var_dump($funcInfo->getStaticVariables());
}
dumpFuncInfo('foo');
diff --git a/ext/reflection/tests/ReflectionFunction_construct.001.phpt b/ext/reflection/tests/ReflectionFunction_construct.001.phpt
index eab542e005..945060b073 100644
--- a/ext/reflection/tests/ReflectionFunction_construct.001.phpt
+++ b/ext/reflection/tests/ReflectionFunction_construct.001.phpt
@@ -7,30 +7,30 @@ Steve Seear <stevseea@php.net>
<?php
try {
- $a = new ReflectionFunction(array(1, 2, 3));
- echo "exception not thrown.".PHP_EOL;
+ $a = new ReflectionFunction(array(1, 2, 3));
+ echo "exception not thrown.".PHP_EOL;
} catch (TypeError $re) {
- echo "Ok - ".$re->getMessage().PHP_EOL;
+ echo "Ok - ".$re->getMessage().PHP_EOL;
}
try {
- $a = new ReflectionFunction('nonExistentFunction');
+ $a = new ReflectionFunction('nonExistentFunction');
} catch (ReflectionException $e) {
- echo $e->getMessage().PHP_EOL;
+ echo $e->getMessage().PHP_EOL;
}
try {
- $a = new ReflectionFunction();
+ $a = new ReflectionFunction();
} catch (TypeError $re) {
- echo "Ok - ".$re->getMessage().PHP_EOL;
+ echo "Ok - ".$re->getMessage().PHP_EOL;
}
try {
- $a = new ReflectionFunction(1, 2);
+ $a = new ReflectionFunction(1, 2);
} catch (TypeError $re) {
- echo "Ok - ".$re->getMessage().PHP_EOL;
+ echo "Ok - ".$re->getMessage().PHP_EOL;
}
try {
- $a = new ReflectionFunction([]);
+ $a = new ReflectionFunction([]);
} catch (TypeError $re) {
- echo "Ok - ".$re->getMessage().PHP_EOL;
+ echo "Ok - ".$re->getMessage().PHP_EOL;
}
?>
diff --git a/ext/reflection/tests/ReflectionFunction_getClosureScopeClass.phpt b/ext/reflection/tests/ReflectionFunction_getClosureScopeClass.phpt
index b8b969b0bc..f7cb6b36ec 100644
--- a/ext/reflection/tests/ReflectionFunction_getClosureScopeClass.phpt
+++ b/ext/reflection/tests/ReflectionFunction_getClosureScopeClass.phpt
@@ -7,9 +7,9 @@ $rf = new ReflectionFunction($closure);
var_dump($rf->getClosureScopeClass());
Class A {
- public static function getClosure() {
- return function($param) { return "this is a closure"; };
- }
+ public static function getClosure() {
+ return function($param) { return "this is a closure"; };
+ }
}
$closure = A::getClosure();
diff --git a/ext/reflection/tests/ReflectionFunction_getClosure_basic.phpt b/ext/reflection/tests/ReflectionFunction_getClosure_basic.phpt
index 4c76959aec..7772da0509 100644
--- a/ext/reflection/tests/ReflectionFunction_getClosure_basic.phpt
+++ b/ext/reflection/tests/ReflectionFunction_getClosure_basic.phpt
@@ -12,12 +12,12 @@ echo "*** Testing ReflectionFunction::getClosure() : basic functionality ***\n";
function foo()
{
- var_dump( "Inside foo function" );
+ var_dump( "Inside foo function" );
}
function bar( $arg )
{
- var_dump( "Arg is " . $arg );
+ var_dump( "Arg is " . $arg );
}
$func = new ReflectionFunction( 'foo' );
@@ -29,9 +29,7 @@ $closure = $func->getClosure();
$closure( 'succeeded' );
?>
-===DONE===
--EXPECT--
*** Testing ReflectionFunction::getClosure() : basic functionality ***
string(19) "Inside foo function"
string(16) "Arg is succeeded"
-===DONE===
diff --git a/ext/reflection/tests/ReflectionFunction_getDocComment.001.phpt b/ext/reflection/tests/ReflectionFunction_getDocComment.001.phpt
index 03cec2ee79..590f5cfa10 100644
--- a/ext/reflection/tests/ReflectionFunction_getDocComment.001.phpt
+++ b/ext/reflection/tests/ReflectionFunction_getDocComment.001.phpt
@@ -12,10 +12,10 @@ opcache.save_comments=1
* my doc comment
*/
function foo () {
- static $c;
- static $a = 1;
- static $b = "hello";
- $d = 5;
+ static $c;
+ static $a = 1;
+ static $b = "hello";
+ $d = 5;
}
/***
@@ -25,8 +25,8 @@ function bar () {}
function dumpFuncInfo($name) {
- $funcInfo = new ReflectionFunction($name);
- var_dump($funcInfo->getDocComment());
+ $funcInfo = new ReflectionFunction($name);
+ var_dump($funcInfo->getDocComment());
}
dumpFuncInfo('foo');
diff --git a/ext/reflection/tests/ReflectionFunction_getFileName.002.phpt b/ext/reflection/tests/ReflectionFunction_getFileName.002.phpt
index cd75418584..39fa48a3ff 100644
--- a/ext/reflection/tests/ReflectionFunction_getFileName.002.phpt
+++ b/ext/reflection/tests/ReflectionFunction_getFileName.002.phpt
@@ -10,10 +10,10 @@ Steve Seear <stevseea@php.net>
* my doc comment
*/
function foo () {
- static $c;
- static $a = 1;
- static $b = "hello";
- $d = 5;
+ static $c;
+ static $a = 1;
+ static $b = "hello";
+ $d = 5;
}
/***
@@ -23,8 +23,8 @@ function bar () {}
function dumpFuncInfo($name) {
- $funcInfo = new ReflectionFunction($name);
- var_dump($funcInfo->getFileName());
+ $funcInfo = new ReflectionFunction($name);
+ var_dump($funcInfo->getFileName());
}
dumpFuncInfo('foo');
diff --git a/ext/reflection/tests/ReflectionFunction_isGenerator_basic.phpt b/ext/reflection/tests/ReflectionFunction_isGenerator_basic.phpt
index 8bbbfa516f..b9a84d49c4 100644
--- a/ext/reflection/tests/ReflectionFunction_isGenerator_basic.phpt
+++ b/ext/reflection/tests/ReflectionFunction_isGenerator_basic.phpt
@@ -5,7 +5,7 @@ ReflectionFunction::isGenerator()
$closure1 = function() {return "this is a closure"; };
$closure2 = function($param) {
- yield $param;
+ yield $param;
};
$rf1 = new ReflectionFunction($closure1);
@@ -15,11 +15,11 @@ $rf2 = new ReflectionFunction($closure2);
var_dump($rf2->isGenerator());
function func1() {
- return 'func1';
+ return 'func1';
}
function func2() {
- yield 'func2';
+ yield 'func2';
}
$rf1 = new ReflectionFunction('func1');
@@ -30,17 +30,17 @@ var_dump($rf2->isGenerator());
class Foo {
- public function f1() {
- }
+ public function f1() {
+ }
- public function f2() {
- yield;
- }
+ public function f2() {
+ yield;
+ }
}
$rc = new ReflectionClass('Foo');
foreach($rc->getMethods() as $m) {
- var_dump($m->isGenerator());
+ var_dump($m->isGenerator());
}
?>
--EXPECT--
diff --git a/ext/reflection/tests/ReflectionGenerator_basic.phpt b/ext/reflection/tests/ReflectionGenerator_basic.phpt
index 6f35b6c244..f9ecc8e90e 100644
--- a/ext/reflection/tests/ReflectionGenerator_basic.phpt
+++ b/ext/reflection/tests/ReflectionGenerator_basic.phpt
@@ -4,33 +4,33 @@ ReflectionGenerator basic test
<?php
function foo() {
- yield;
+ yield;
}
$gens = [
- (new class() {
- function a() {
- yield from foo();
- }
- })->a(),
- (function() {
- yield;
- })(),
- foo(),
+ (new class() {
+ function a() {
+ yield from foo();
+ }
+ })->a(),
+ (function() {
+ yield;
+ })(),
+ foo(),
];
foreach ($gens as $gen) {
- var_dump($gen);
+ var_dump($gen);
- $gen->valid(); // start Generator
- $ref = new ReflectionGenerator($gen);
+ $gen->valid(); // start Generator
+ $ref = new ReflectionGenerator($gen);
- var_dump($ref->getTrace());
- var_dump($ref->getExecutingLine());
- var_dump($ref->getExecutingFile());
- var_dump($ref->getExecutingGenerator());
- var_dump($ref->getFunction());
- var_dump($ref->getThis());
+ var_dump($ref->getTrace());
+ var_dump($ref->getExecutingLine());
+ var_dump($ref->getExecutingFile());
+ var_dump($ref->getExecutingGenerator());
+ var_dump($ref->getFunction());
+ var_dump($ref->getThis());
}
?>
diff --git a/ext/reflection/tests/ReflectionGenerator_getTrace.phpt b/ext/reflection/tests/ReflectionGenerator_getTrace.phpt
index 05a46009e8..91b7160d4b 100644
--- a/ext/reflection/tests/ReflectionGenerator_getTrace.phpt
+++ b/ext/reflection/tests/ReflectionGenerator_getTrace.phpt
@@ -4,8 +4,8 @@ ReflectionGenerator::getTrace() over multiple Generators
<?php
function foo() {
- yield 1;
- yield 2;
+ yield 1;
+ yield 2;
}
function bar()
diff --git a/ext/reflection/tests/ReflectionGenerator_in_Generator.phpt b/ext/reflection/tests/ReflectionGenerator_in_Generator.phpt
index a227e1a213..a665d45c30 100644
--- a/ext/reflection/tests/ReflectionGenerator_in_Generator.phpt
+++ b/ext/reflection/tests/ReflectionGenerator_in_Generator.phpt
@@ -4,31 +4,31 @@ ReflectionGenerator while being currently executed
<?php
function call(ReflectionGenerator $ref, $method, $rec = true) {
- if ($rec) {
- call($ref, $method, false);
- return;
- }
- var_dump($ref->$method());
+ if ($rec) {
+ call($ref, $method, false);
+ return;
+ }
+ var_dump($ref->$method());
}
function doCalls(ReflectionGenerator $ref) {
- call($ref, "getTrace");
- call($ref, "getExecutingLine");
- call($ref, "getExecutingFile");
- call($ref, "getExecutingGenerator");
- call($ref, "getFunction");
- call($ref, "getThis");
+ call($ref, "getTrace");
+ call($ref, "getExecutingLine");
+ call($ref, "getExecutingFile");
+ call($ref, "getExecutingGenerator");
+ call($ref, "getFunction");
+ call($ref, "getThis");
}
($gen = (function() use (&$gen) {
- $ref = new ReflectionGenerator($gen);
+ $ref = new ReflectionGenerator($gen);
- doCalls($ref);
+ doCalls($ref);
- yield from (function() use ($ref) {
- doCalls($ref);
- yield; // Generator !
- })();
+ yield from (function() use ($ref) {
+ doCalls($ref);
+ yield; // Generator !
+ })();
})())->next();
?>
diff --git a/ext/reflection/tests/ReflectionMethod_006.phpt b/ext/reflection/tests/ReflectionMethod_006.phpt
index 627dc96f32..bb29b1cbed 100644
--- a/ext/reflection/tests/ReflectionMethod_006.phpt
+++ b/ext/reflection/tests/ReflectionMethod_006.phpt
@@ -7,89 +7,17 @@ Steve Seear <stevseea@php.net>
<?php
try {
- new ReflectionMethod();
+ new ReflectionMethod();
} catch (TypeError $re) {
- echo "Ok - ".$re->getMessage().PHP_EOL;
+ echo "Ok - ".$re->getMessage().PHP_EOL;
}
try {
- new ReflectionMethod('a', 'b', 'c');
+ new ReflectionMethod('a', 'b', 'c');
} catch (TypeError $re) {
- echo "Ok - ".$re->getMessage().PHP_EOL;
+ echo "Ok - ".$re->getMessage().PHP_EOL;
}
-class C {
- public function f() {}
-}
-
-$rm = new ReflectionMethod('C', 'f');
-
-var_dump($rm->isFinal(1));
-var_dump($rm->isAbstract(1));
-var_dump($rm->isPrivate(1));
-var_dump($rm->isProtected(1));
-var_dump($rm->isPublic(1));
-var_dump($rm->isStatic(1));
-var_dump($rm->isConstructor(1));
-var_dump($rm->isDestructor(1));
-var_dump($rm->getModifiers(1));
-var_dump($rm->isInternal(1));
-var_dump($rm->isUserDefined(1));
-var_dump($rm->getFileName(1));
-var_dump($rm->getStartLine(1));
-var_dump($rm->getEndLine(1));
-var_dump($rm->getStaticVariables(1));
-var_dump($rm->getName(1));
-
-
?>
---EXPECTF--
+--EXPECT--
Ok - ReflectionMethod::__construct() expects exactly 1 parameter, 0 given
Ok - ReflectionMethod::__construct() expects exactly 1 parameter, 3 given
-
-Warning: ReflectionMethod::isFinal() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionMethod::isAbstract() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionMethod::isPrivate() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionMethod::isProtected() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionMethod::isPublic() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionMethod::isStatic() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionMethod::isConstructor() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionMethod::isDestructor() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionMethod::getModifiers() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionFunctionAbstract::isInternal() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionFunctionAbstract::isUserDefined() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionFunctionAbstract::getFileName() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionFunctionAbstract::getStartLine() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionFunctionAbstract::getEndLine() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionFunctionAbstract::getStaticVariables() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionFunctionAbstract::getName() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
diff --git a/ext/reflection/tests/ReflectionMethod_basic2.phpt b/ext/reflection/tests/ReflectionMethod_basic2.phpt
index 71ef9e95d9..46abc6b816 100644
--- a/ext/reflection/tests/ReflectionMethod_basic2.phpt
+++ b/ext/reflection/tests/ReflectionMethod_basic2.phpt
@@ -166,7 +166,7 @@ string(%d) "Method [ <internal:Reflection, ctor> public method __construct ] {
- Parameters [2] {
Parameter #0 [ <required> $class ]
- Parameter #1 [ <required> $name ]
+ Parameter #1 [ <required> string $name ]
}
}
"
@@ -178,7 +178,7 @@ string(%d) "Method [ <internal:Reflection, ctor> public method __construct ] {
- Parameters [2] {
Parameter #0 [ <required> $class ]
- Parameter #1 [ <required> $name ]
+ Parameter #1 [ <required> string $name ]
}
}
"
diff --git a/ext/reflection/tests/ReflectionMethod_constructor_basic.phpt b/ext/reflection/tests/ReflectionMethod_constructor_basic.phpt
index 243c59504b..da108d258d 100644
--- a/ext/reflection/tests/ReflectionMethod_constructor_basic.phpt
+++ b/ext/reflection/tests/ReflectionMethod_constructor_basic.phpt
@@ -19,21 +19,6 @@ echo "\nInherited new-style constructor\n";
$methodInfo = new ReflectionMethod("ExtendsNewCtor::__construct");
var_dump($methodInfo->isConstructor());
-class OldCtor {
- function OldCtor() {
- echo "In " . __METHOD__ . "\n";
- }
-}
-echo "\nOld-style constructor:\n";
-$methodInfo = new ReflectionMethod("OldCtor::OldCtor");
-var_dump($methodInfo->isConstructor());
-
-class ExtendsOldCtor extends OldCtor {
-}
-echo "\nInherited old-style constructor:\n";
-$methodInfo = new ReflectionMethod("ExtendsOldCtor::OldCtor");
-var_dump($methodInfo->isConstructor());
-
class X {
function Y() {
echo "In " . __METHOD__ . "\n";
@@ -49,69 +34,16 @@ echo "\nInherited method of the same name as the class:\n";
$methodInfo = new ReflectionMethod("Y::Y");
var_dump($methodInfo->isConstructor());
-class OldAndNewCtor {
- function OldAndNewCtor() {
- echo "In " . __METHOD__ . "\n";
- }
-
- function __construct() {
- echo "In " . __METHOD__ . "\n";
- }
-}
-echo "\nOld-style constructor:\n";
-$methodInfo = new ReflectionMethod("OldAndNewCtor::OldAndNewCtor");
-var_dump($methodInfo->isConstructor());
-
-echo "\nRedefined constructor:\n";
-$methodInfo = new ReflectionMethod("OldAndNewCtor::__construct");
-var_dump($methodInfo->isConstructor());
-
-class NewAndOldCtor {
- function __construct() {
- echo "In " . __METHOD__ . "\n";
- }
-
- function NewAndOldCtor() {
- echo "In " . __METHOD__ . "\n";
- }
-}
-echo "\nNew-style constructor:\n";
-$methodInfo = new ReflectionMethod("NewAndOldCtor::__construct");
-var_dump($methodInfo->isConstructor());
-
-echo "\nRedefined old-style constructor:\n";
-$methodInfo = new ReflectionMethod("NewAndOldCtor::NewAndOldCtor");
-var_dump($methodInfo->isConstructor());
-
?>
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; OldCtor has a deprecated constructor in %s on line %d
+--EXPECT--
New-style constructor:
bool(true)
Inherited new-style constructor
bool(true)
-Old-style constructor:
-bool(true)
-
-Inherited old-style constructor:
-bool(true)
-
Not a constructor:
bool(false)
Inherited method of the same name as the class:
bool(false)
-
-Old-style constructor:
-bool(false)
-
-Redefined constructor:
-bool(true)
-
-New-style constructor:
-bool(true)
-
-Redefined old-style constructor:
-bool(false)
diff --git a/ext/reflection/tests/ReflectionMethod_constructor_error1.phpt b/ext/reflection/tests/ReflectionMethod_constructor_error1.phpt
index 5c980536b9..186c61b2b0 100644
--- a/ext/reflection/tests/ReflectionMethod_constructor_error1.phpt
+++ b/ext/reflection/tests/ReflectionMethod_constructor_error1.phpt
@@ -14,52 +14,52 @@ class TestClass
try {
- echo "\nWrong type of argument (bool):\n";
- $methodInfo = new ReflectionMethod(true);
+ echo "\nWrong type of argument (bool):\n";
+ $methodInfo = new ReflectionMethod(true);
} catch (Exception $e) {
- print $e->__toString();
+ print $e->__toString();
}
try {
- echo "\nWrong type of argument (int):\n";
- $methodInfo = new ReflectionMethod(3);
+ echo "\nWrong type of argument (int):\n";
+ $methodInfo = new ReflectionMethod(3);
} catch (Exception $e) {
- print $e->__toString();
+ print $e->__toString();
}
try {
- echo "\nWrong type of argument (bool, string):\n";
- $methodInfo = new ReflectionMethod(true, "foo");
+ echo "\nWrong type of argument (bool, string):\n";
+ $methodInfo = new ReflectionMethod(true, "foo");
} catch (Exception $e) {
- print $e->__toString();
+ print $e->__toString();
}
try {
- echo "\nWrong type of argument (string, bool):\n";
- $methodInfo = new ReflectionMethod('TestClass', true);
+ echo "\nWrong type of argument (string, bool):\n";
+ $methodInfo = new ReflectionMethod('TestClass', true);
} catch (Exception $e) {
- print $e->__toString();
+ print $e->__toString();
}
try {
- echo "\nNo method given:\n";
- $methodInfo = new ReflectionMethod("TestClass");
+ echo "\nNo method given:\n";
+ $methodInfo = new ReflectionMethod("TestClass");
} catch (Exception $e) {
- print $e->__toString();
+ print $e->__toString();
}
try {
- echo "\nClass and Method in same string, bad method name:\n";
- $methodInfo = new ReflectionMethod("TestClass::foop::dedoop");
+ echo "\nClass and Method in same string, bad method name:\n";
+ $methodInfo = new ReflectionMethod("TestClass::foop::dedoop");
} catch (Exception $e) {
- print $e->__toString();
+ print $e->__toString();
}
try {
- echo "\nClass and Method in same string, bad class name:\n";
- $methodInfo = new ReflectionMethod("TestCla::foo");
+ echo "\nClass and Method in same string, bad class name:\n";
+ $methodInfo = new ReflectionMethod("TestCla::foo");
} catch (Exception $e) {
- print $e->__toString();
+ print $e->__toString();
}
try {
- echo "\nClass and Method in same string (ok):\n";
- $methodInfo = new ReflectionMethod("TestClass::foo");
+ echo "\nClass and Method in same string (ok):\n";
+ $methodInfo = new ReflectionMethod("TestClass::foo");
} catch (Exception $e) {
- print $e->__toString();
+ print $e->__toString();
}
?>
diff --git a/ext/reflection/tests/ReflectionMethod_constructor_error2.phpt b/ext/reflection/tests/ReflectionMethod_constructor_error2.phpt
index 723ab00f84..d84fa5dcff 100644
--- a/ext/reflection/tests/ReflectionMethod_constructor_error2.phpt
+++ b/ext/reflection/tests/ReflectionMethod_constructor_error2.phpt
@@ -14,39 +14,39 @@ class TestClass
try {
- echo "Too few arguments:\n";
- $methodInfo = new ReflectionMethod();
+ echo "Too few arguments:\n";
+ $methodInfo = new ReflectionMethod();
} catch (TypeError $re) {
- echo "Ok - ".$re->getMessage().PHP_EOL;
+ echo "Ok - ".$re->getMessage().PHP_EOL;
}
try {
- echo "\nToo many arguments:\n";
- $methodInfo = new ReflectionMethod("TestClass", "foo", true);
+ echo "\nToo many arguments:\n";
+ $methodInfo = new ReflectionMethod("TestClass", "foo", true);
} catch (TypeError $re) {
- echo "Ok - ".$re->getMessage().PHP_EOL;
+ echo "Ok - ".$re->getMessage().PHP_EOL;
}
try {
- //invalid class
- $methodInfo = new ReflectionMethod("InvalidClassName", "foo");
+ //invalid class
+ $methodInfo = new ReflectionMethod("InvalidClassName", "foo");
} catch (ReflectionException $re) {
- echo "Ok - ".$re->getMessage().PHP_EOL;
+ echo "Ok - ".$re->getMessage().PHP_EOL;
}
try {
- //invalid 1st param
- $methodInfo = new ReflectionMethod([], "foo");
+ //invalid 1st param
+ $methodInfo = new ReflectionMethod([], "foo");
} catch (ReflectionException $re) {
- echo "Ok - ".$re->getMessage().PHP_EOL;
+ echo "Ok - ".$re->getMessage().PHP_EOL;
}
try{
- //invalid 2nd param
- $methodInfo = new ReflectionMethod("TestClass", []);
+ //invalid 2nd param
+ $methodInfo = new ReflectionMethod("TestClass", []);
} catch (TypeError $re) {
- echo "Ok - ".$re->getMessage().PHP_EOL;
+ echo "Ok - ".$re->getMessage().PHP_EOL;
}
?>
diff --git a/ext/reflection/tests/ReflectionMethod_defaultArg.phpt b/ext/reflection/tests/ReflectionMethod_defaultArg.phpt
index 1c04cade5f..521f29da58 100644
--- a/ext/reflection/tests/ReflectionMethod_defaultArg.phpt
+++ b/ext/reflection/tests/ReflectionMethod_defaultArg.phpt
@@ -3,17 +3,17 @@ ReflectionMethod and RECV_INIT (bug #70957 and #70958)
--FILE--
<?php
Abstract class F {
- private function bar($a = self::class) {}
+ private function bar($a = self::class) {}
}
Trait T
{
- private function bar($a = self::class) {}
+ private function bar($a = self::class) {}
}
class B {
- use T;
+ use T;
}
echo new \ReflectionMethod('F', 'bar');
diff --git a/ext/reflection/tests/ReflectionMethod_getClosureThis.phpt b/ext/reflection/tests/ReflectionMethod_getClosureThis.phpt
index 3a931172f1..656fde814d 100644
--- a/ext/reflection/tests/ReflectionMethod_getClosureThis.phpt
+++ b/ext/reflection/tests/ReflectionMethod_getClosureThis.phpt
@@ -4,19 +4,19 @@ Reflection::getClosureThis()
<?php
class StaticExample
{
- static function foo()
- {
- var_dump( "Static Example class, Hello World!" );
- }
+ static function foo()
+ {
+ var_dump( "Static Example class, Hello World!" );
+ }
}
class Example
{
- public $bar = 42;
- public function foo()
- {
- var_dump( "Example class, bar: " . $this->bar );
- }
+ public $bar = 42;
+ public function foo()
+ {
+ var_dump( "Example class, bar: " . $this->bar );
+ }
}
// Initialize classes
diff --git a/ext/reflection/tests/ReflectionMethod_getClosure_basic.phpt b/ext/reflection/tests/ReflectionMethod_getClosure_basic.phpt
index bf1bcf3603..3b0074e5a9 100644
--- a/ext/reflection/tests/ReflectionMethod_getClosure_basic.phpt
+++ b/ext/reflection/tests/ReflectionMethod_getClosure_basic.phpt
@@ -12,19 +12,19 @@ echo "*** Testing ReflectionMethod::getClosure() : basic functionality ***\n";
class StaticExample
{
- static function foo()
- {
- var_dump( "Static Example class, Hello World!" );
- }
+ static function foo()
+ {
+ var_dump( "Static Example class, Hello World!" );
+ }
}
class Example
{
- public $bar = 42;
- public function foo()
- {
- var_dump( "Example class, bar: " . $this->bar );
- }
+ public $bar = 42;
+ public function foo()
+ {
+ var_dump( "Example class, bar: " . $this->bar );
+ }
}
// Initialize classes
@@ -46,10 +46,8 @@ $object->bar = 34;
$closure();
?>
-===DONE===
--EXPECT--
*** Testing ReflectionMethod::getClosure() : basic functionality ***
string(34) "Static Example class, Hello World!"
string(22) "Example class, bar: 42"
string(22) "Example class, bar: 34"
-===DONE===
diff --git a/ext/reflection/tests/ReflectionMethod_getClosure_error.phpt b/ext/reflection/tests/ReflectionMethod_getClosure_error.phpt
index d3b9ca3c81..728ddf9265 100644
--- a/ext/reflection/tests/ReflectionMethod_getClosure_error.phpt
+++ b/ext/reflection/tests/ReflectionMethod_getClosure_error.phpt
@@ -12,19 +12,19 @@ echo "*** Testing ReflectionMethod::getClosure() : error conditions ***\n";
class StaticExample
{
- static function foo()
- {
- var_dump( "Static Example class, Hello World!" );
- }
+ static function foo()
+ {
+ var_dump( "Static Example class, Hello World!" );
+ }
}
class Example
{
- public $bar = 42;
- public function foo()
- {
- var_dump( "Example class, bar: " . $this->bar );
- }
+ public $bar = 42;
+ public function foo()
+ {
+ var_dump( "Example class, bar: " . $this->bar );
+ }
}
// Initialize classes
@@ -35,15 +35,7 @@ $staticmethod = $staticclass->getMethod( 'foo' );
$object = new Example();
$fakeobj = new StdClass();
-echo "\n-- Testing ReflectionMethod::getClosure() function with more than expected no. of arguments --\n";
-var_dump( $staticmethod->getClosure( 'foobar' ) );
-var_dump( $staticmethod->getClosure( 'foo', 'bar' ) );
-var_dump( $method->getClosure( $object, 'foobar' ) );
-
-echo "\n-- Testing ReflectionMethod::getClosure() function with Zero arguments --\n";
-$closure = $method->getClosure();
-
-echo "\n-- Testing ReflectionMethod::getClosure() function with Zero arguments --\n";
+echo "\n-- Testing ReflectionMethod::getClosure() function with invalid object --\n";
try {
var_dump( $method->getClosure( $fakeobj ) );
} catch( Exception $e ) {
@@ -51,23 +43,8 @@ try {
}
?>
-===DONE===
--EXPECTF--
*** Testing ReflectionMethod::getClosure() : error conditions ***
--- Testing ReflectionMethod::getClosure() function with more than expected no. of arguments --
-object(Closure)#%d (0) {
-}
-object(Closure)#%d (0) {
-}
-
-Warning: ReflectionMethod::getClosure() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
--- Testing ReflectionMethod::getClosure() function with Zero arguments --
-
-Warning: ReflectionMethod::getClosure() expects exactly 1 parameter, 0 given in %s on line %d
-
--- Testing ReflectionMethod::getClosure() function with Zero arguments --
+-- Testing ReflectionMethod::getClosure() function with invalid object --
string(72) "Given object is not an instance of the class this method was declared in"
-===DONE===
diff --git a/ext/reflection/tests/ReflectionMethod_getDocComment_basic.phpt b/ext/reflection/tests/ReflectionMethod_getDocComment_basic.phpt
index f999b72812..7cda871c18 100644
--- a/ext/reflection/tests/ReflectionMethod_getDocComment_basic.phpt
+++ b/ext/reflection/tests/ReflectionMethod_getDocComment_basic.phpt
@@ -25,7 +25,7 @@ class A {
* My Doc Comment for A::finalStatPubf
*/
- final static public function finalStatPubf() {}
+ final static public function finalStatPubf() {}
}
diff --git a/ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt b/ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt
index d1a19c7116..00c1514fd9 100644
--- a/ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt
+++ b/ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt
@@ -60,12 +60,12 @@ class TestClass
class DerivedClass extends TestClass {}
interface TestInterface {
- public function int();
- public function __clone();
+ public function int();
+ public function __clone();
}
abstract class AbstractClass {
- public abstract function foo();
+ public abstract function foo();
}
@@ -75,13 +75,9 @@ reflectMethodModifiers("DerivedClass");
reflectMethodModifiers("TestInterface");
reflectMethodModifiers("AbstractClass");
-echo "Wrong number of params:\n";
-$a = new ReflectionMethod('TestClass::foo');
-$a->getModifiers(1);
-
$a = new ReflectionMethod('ReflectionMethod::getModifiers');
-echo "\nReflectionMethod::getModifiers() modifiers:\n";
+echo "ReflectionMethod::getModifiers() modifiers:\n";
printf("0x%08x\n", $a->getModifiers());
?>
@@ -234,9 +230,5 @@ Modifiers for method AbstractClass::foo():
0x00000041
-Wrong number of params:
-
-Warning: ReflectionMethod::getModifiers() expects exactly 0 parameters, 1 given in %s on line %d
-
ReflectionMethod::getModifiers() modifiers:
0x00000001
diff --git a/ext/reflection/tests/ReflectionMethod_invokeArgs_error2.phpt b/ext/reflection/tests/ReflectionMethod_invokeArgs_error2.phpt
index 6c81728f91..34e73c9a69 100644
--- a/ext/reflection/tests/ReflectionMethod_invokeArgs_error2.phpt
+++ b/ext/reflection/tests/ReflectionMethod_invokeArgs_error2.phpt
@@ -24,4 +24,4 @@ try {
?>
--EXPECT--
-string(89) "Argument 2 passed to ReflectionMethod::invokeArgs() must be of the type array, bool given"
+string(74) "ReflectionMethod::invokeArgs() expects parameter 2 to be array, bool given"
diff --git a/ext/reflection/tests/ReflectionMethod_invokeArgs_error3.phpt b/ext/reflection/tests/ReflectionMethod_invokeArgs_error3.phpt
index 0c87a66153..113cabbbeb 100644
--- a/ext/reflection/tests/ReflectionMethod_invokeArgs_error3.phpt
+++ b/ext/reflection/tests/ReflectionMethod_invokeArgs_error3.phpt
@@ -15,10 +15,10 @@ class TestClass {
public static function staticMethod() {
echo "Called staticMethod()\n";
try {
- var_dump($this);
- } catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
- }
+ var_dump($this);
+ } catch (Throwable $e) {
+ echo "Exception: " . $e->getMessage() . "\n";
+ }
}
private static function privateMethod() {
@@ -37,10 +37,6 @@ $foo = new ReflectionMethod($testClassInstance, 'foo');
$staticMethod = new ReflectionMethod('TestClass::staticMethod');
$privateMethod = new ReflectionMethod("TestClass::privateMethod");
-echo "Wrong number of parameters:\n";
-var_dump($foo->invokeArgs());
-var_dump($foo->invokeArgs(true));
-
echo "\nNon-instance:\n";
try {
var_dump($foo->invokeArgs(new stdClass(), array()));
@@ -48,14 +44,8 @@ try {
var_dump($e->getMessage());
}
-echo "\nNon-object:\n";
-var_dump($foo->invokeArgs(true, array()));
-
echo "\nStatic method:\n";
-var_dump($staticMethod->invokeArgs());
-var_dump($staticMethod->invokeArgs(true));
-var_dump($staticMethod->invokeArgs(true, array()));
var_dump($staticMethod->invokeArgs(null, array()));
echo "\nPrivate method:\n";
@@ -80,32 +70,10 @@ try {
?>
--EXPECTF--
-Wrong number of parameters:
-
-Warning: ReflectionMethod::invokeArgs() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: ReflectionMethod::invokeArgs() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
Non-instance:
string(72) "Given object is not an instance of the class this method was declared in"
-Non-object:
-
-Warning: ReflectionMethod::invokeArgs() expects parameter 1 to be object, bool given in %s on line %d
-NULL
-
Static method:
-
-Warning: ReflectionMethod::invokeArgs() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: ReflectionMethod::invokeArgs() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionMethod::invokeArgs() expects parameter 1 to be object, bool given in %s on line %d
-NULL
Called staticMethod()
Exception: Using $this when not in object context
NULL
diff --git a/ext/reflection/tests/ReflectionMethod_invoke_basic.phpt b/ext/reflection/tests/ReflectionMethod_invoke_basic.phpt
index 0a2b15fb83..3ff1052a0a 100644
--- a/ext/reflection/tests/ReflectionMethod_invoke_basic.phpt
+++ b/ext/reflection/tests/ReflectionMethod_invoke_basic.phpt
@@ -23,10 +23,10 @@ class TestClass {
public static function staticMethod() {
echo "Called staticMethod()\n";
try {
- var_dump($this);
- } catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
- }
+ var_dump($this);
+ } catch (Throwable $e) {
+ echo "Exception: " . $e->getMessage() . "\n";
+ }
}
private static function privateMethod() {
@@ -60,15 +60,23 @@ var_dump($methodWithArgs->invoke($testClassInstance, 1, "arg2", 3));
echo "\nStatic method:\n";
-var_dump($staticMethod->invoke());
-var_dump($staticMethod->invoke(true));
+try {
+ var_dump($staticMethod->invoke());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump($staticMethod->invoke(true));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump($staticMethod->invoke(new stdClass()));
echo "\nMethod that throws an exception:\n";
try {
- var_dump($methodThatThrows->invoke($testClassInstance));
+ var_dump($methodThatThrows->invoke($testClassInstance));
} catch (Exception $exc) {
- var_dump($exc->getMessage());
+ var_dump($exc->getMessage());
}
?>
@@ -94,12 +102,8 @@ Called methodWithArgs(1, arg2)
NULL
Static method:
-
-Warning: ReflectionMethod::invoke() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: ReflectionMethod::invoke() expects parameter 1 to be object, bool given in %s on line %d
-NULL
+ReflectionMethod::invoke() expects at least 1 parameter, 0 given
+ReflectionMethod::invoke() expects parameter 1 to be object, bool given
Called staticMethod()
Exception: Using $this when not in object context
NULL
diff --git a/ext/reflection/tests/ReflectionMethod_invoke_error1.phpt b/ext/reflection/tests/ReflectionMethod_invoke_error1.phpt
index 411299f0c7..4fa86eb363 100644
--- a/ext/reflection/tests/ReflectionMethod_invoke_error1.phpt
+++ b/ext/reflection/tests/ReflectionMethod_invoke_error1.phpt
@@ -30,7 +30,7 @@ $testClassInstance->prop = "Hello";
echo "invoke() on a non-object:\n";
try {
var_dump($foo->invoke(true));
-} catch (ReflectionException $e) {
+} catch (TypeError $e) {
var_dump($e->getMessage());
}
@@ -59,9 +59,7 @@ try {
?>
--EXPECTF--
invoke() on a non-object:
-
-Warning: ReflectionMethod::invoke() expects parameter 1 to be object, bool given in %s%eReflectionMethod_invoke_error1.php on line %d
-NULL
+string(71) "ReflectionMethod::invoke() expects parameter 1 to be object, bool given"
invoke() on a non-instance:
string(72) "Given object is not an instance of the class this method was declared in"
diff --git a/ext/reflection/tests/ReflectionNamedType.phpt b/ext/reflection/tests/ReflectionNamedType.phpt
index afb592127c..5677d22cf2 100644
--- a/ext/reflection/tests/ReflectionNamedType.phpt
+++ b/ext/reflection/tests/ReflectionNamedType.phpt
@@ -4,11 +4,11 @@ ReflectionNamedType::getName() and ReflectionNamedType::__toString()
<?php
function testInternalTypes(?Traversable $traversable): ?string {
- return 'test';
+ return 'test';
}
function testUserDefinedTypes(?Test $traversable): ?Test {
- return new Test;
+ return new Test;
}
$function = new ReflectionFunction('testInternalTypes');
@@ -30,20 +30,12 @@ var_dump($return->getName());
var_dump((string) $return);
?>
---EXPECTF--
+--EXPECT--
string(11) "Traversable"
-
-Deprecated: Function ReflectionType::__toString() is deprecated in %s on line %d
-string(11) "Traversable"
-string(6) "string"
-
-Deprecated: Function ReflectionType::__toString() is deprecated in %s on line %d
+string(12) "?Traversable"
string(6) "string"
+string(7) "?string"
string(4) "Test"
-
-Deprecated: Function ReflectionType::__toString() is deprecated in %s on line %d
-string(4) "Test"
-string(4) "Test"
-
-Deprecated: Function ReflectionType::__toString() is deprecated in %s on line %d
+string(5) "?Test"
string(4) "Test"
+string(5) "?Test"
diff --git a/ext/reflection/tests/ReflectionObject___toString_basic1.phpt b/ext/reflection/tests/ReflectionObject___toString_basic1.phpt
index 43210ea686..fdd25739bb 100644
--- a/ext/reflection/tests/ReflectionObject___toString_basic1.phpt
+++ b/ext/reflection/tests/ReflectionObject___toString_basic1.phpt
@@ -4,7 +4,7 @@ ReflectionObject::__toString() : very basic test with no dynamic properties
<?php
class Foo {
- public $bar = 1;
+ public $bar = 1;
}
$f = new foo;
diff --git a/ext/reflection/tests/ReflectionObject___toString_basic2.phpt b/ext/reflection/tests/ReflectionObject___toString_basic2.phpt
index 970d07b432..db119c92b6 100644
--- a/ext/reflection/tests/ReflectionObject___toString_basic2.phpt
+++ b/ext/reflection/tests/ReflectionObject___toString_basic2.phpt
@@ -4,7 +4,7 @@ ReflectionObject::__toString() : very basic test with dynamic properties
<?php
class Foo {
- public $bar = 1;
+ public $bar = 1;
}
$f = new foo;
$f->dynProp = 'hello';
diff --git a/ext/reflection/tests/ReflectionObject_export_basic1.phpt b/ext/reflection/tests/ReflectionObject_export_basic1.phpt
index 43210ea686..fdd25739bb 100644
--- a/ext/reflection/tests/ReflectionObject_export_basic1.phpt
+++ b/ext/reflection/tests/ReflectionObject_export_basic1.phpt
@@ -4,7 +4,7 @@ ReflectionObject::__toString() : very basic test with no dynamic properties
<?php
class Foo {
- public $bar = 1;
+ public $bar = 1;
}
$f = new foo;
diff --git a/ext/reflection/tests/ReflectionObject_export_basic2.phpt b/ext/reflection/tests/ReflectionObject_export_basic2.phpt
index 970d07b432..db119c92b6 100644
--- a/ext/reflection/tests/ReflectionObject_export_basic2.phpt
+++ b/ext/reflection/tests/ReflectionObject_export_basic2.phpt
@@ -4,7 +4,7 @@ ReflectionObject::__toString() : very basic test with dynamic properties
<?php
class Foo {
- public $bar = 1;
+ public $bar = 1;
}
$f = new foo;
$f->dynProp = 'hello';
diff --git a/ext/reflection/tests/ReflectionObject_export_basic3.phpt b/ext/reflection/tests/ReflectionObject_export_basic3.phpt
index a92c2d4921..612bfa5916 100644
--- a/ext/reflection/tests/ReflectionObject_export_basic3.phpt
+++ b/ext/reflection/tests/ReflectionObject_export_basic3.phpt
@@ -3,7 +3,7 @@ ReflectionObject::__toString() - ensure dynamic property with same name as inher
--FILE--
<?php
class C {
- private $p = 1;
+ private $p = 1;
}
class D extends C{
diff --git a/ext/reflection/tests/ReflectionObject_getConstant_basic.phpt b/ext/reflection/tests/ReflectionObject_getConstant_basic.phpt
index 7f9bc1f35c..c132f1121a 100644
--- a/ext/reflection/tests/ReflectionObject_getConstant_basic.phpt
+++ b/ext/reflection/tests/ReflectionObject_getConstant_basic.phpt
@@ -3,24 +3,24 @@ ReflectionObject::getConstant() basic function test
--FILE--
<?php
class C {
- const a = 'hello from C';
+ const a = 'hello from C';
}
class D extends C {
}
class E extends D {
}
class F extends E {
- const a = 'hello from F';
+ const a = 'hello from F';
}
class X {
}
$classes = array("C", "D", "E", "F", "X");
foreach($classes as $class) {
- echo "Reflecting on instance of class $class: \n";
- $rc = new ReflectionObject(new $class);
- var_dump($rc->getConstant('a'));
- var_dump($rc->getConstant('doesntexist'));
+ echo "Reflecting on instance of class $class: \n";
+ $rc = new ReflectionObject(new $class);
+ var_dump($rc->getConstant('a'));
+ var_dump($rc->getConstant('doesNotexist'));
}
?>
--EXPECT--
diff --git a/ext/reflection/tests/ReflectionObject_getConstants_basic.phpt b/ext/reflection/tests/ReflectionObject_getConstants_basic.phpt
index 0ecbde7991..f5acde8be4 100644
--- a/ext/reflection/tests/ReflectionObject_getConstants_basic.phpt
+++ b/ext/reflection/tests/ReflectionObject_getConstants_basic.phpt
@@ -3,23 +3,23 @@ ReflectionObject::getConstants() - basic function test
--FILE--
<?php
class C {
- const a = 'hello from C';
+ const a = 'hello from C';
}
class D extends C {
}
class E extends D {
}
class F extends E {
- const a = 'hello from F';
+ const a = 'hello from F';
}
class X {
}
$classes = array("C", "D", "E", "F", "X");
foreach($classes as $class) {
- echo "Reflecting on instance of class $class: \n";
- $rc = new ReflectionObject(new $class);
- var_dump($rc->getConstants());
+ echo "Reflecting on instance of class $class: \n";
+ $rc = new ReflectionObject(new $class);
+ var_dump($rc->getConstants());
}
?>
diff --git a/ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt b/ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt
index aecc9b97d2..0401ed1e0c 100644
--- a/ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt
+++ b/ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt
@@ -3,81 +3,55 @@ ReflectionObject::getConstructor() - basic function test
--FILE--
<?php
class NewCtor {
- function __construct() {}
+ function __construct() {}
}
class ExtendsNewCtor extends NewCtor {
}
-class OldCtor {
- function OldCtor() {}
-}
-
-class ExtendsOldCtor extends OldCtor {
-}
-
-
class X {
- function Y() {}
+ function Y() {}
}
class Y extends X {
}
-class OldAndNewCtor {
- function OldAndNewCtor() {}
- function __construct() {}
-}
-
-class NewAndOldCtor {
- function __construct() {}
- function NewAndOldCtor() {}
-}
class B {
- function B() {}
+ function B() {}
}
class C extends B {
- function C() {}
+ function C() {}
}
class D1 extends C {
- function __construct() {}
+ function __construct() {}
}
class D2 extends C {
}
-$classes = array('NewCtor', 'ExtendsNewCtor', 'OldCtor', 'ExtendsOldCtor',
- 'OldAndNewCtor', 'NewAndOldCtor', 'B', 'C', 'D1', 'D2', 'X', 'Y');
+$classes = array('NewCtor', 'ExtendsNewCtor',
+ 'B', 'C', 'D1', 'D2', 'X', 'Y');
foreach ($classes as $class) {
- $rc = new ReflectionObject(new $class);
- $rm = $rc->getConstructor();
- if ($rm != null) {
- echo "Constructor of $class: " . $rm->getName() . "\n";
- } else {
- echo "No constructor for $class\n";
- }
+ $rc = new ReflectionObject(new $class);
+ $rm = $rc->getConstructor();
+ if ($rm != null) {
+ echo "Constructor of $class: " . $rm->getName() . "\n";
+ } else {
+ echo "No constructor for $class\n";
+ }
}
?>
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; OldCtor has a deprecated constructor in %s on line %d
-
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; B has a deprecated constructor in %s on line %d
-
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; C has a deprecated constructor in %s on line %d
+--EXPECT--
Constructor of NewCtor: __construct
Constructor of ExtendsNewCtor: __construct
-Constructor of OldCtor: OldCtor
-Constructor of ExtendsOldCtor: OldCtor
-Constructor of OldAndNewCtor: __construct
-Constructor of NewAndOldCtor: __construct
-Constructor of B: B
-Constructor of C: C
+No constructor for B
+No constructor for C
Constructor of D1: __construct
-Constructor of D2: C
+No constructor for D2
No constructor for X
No constructor for Y
diff --git a/ext/reflection/tests/ReflectionObject_getName_basic.phpt b/ext/reflection/tests/ReflectionObject_getName_basic.phpt
index 68cea6a1cd..1885695cb1 100644
--- a/ext/reflection/tests/ReflectionObject_getName_basic.phpt
+++ b/ext/reflection/tests/ReflectionObject_getName_basic.phpt
@@ -2,8 +2,6 @@
ReflectionObject::getName() - basic function test
--FILE--
<?php
-$r0 = new ReflectionObject();
-var_dump($r0->getName());
$r1 = new ReflectionObject(new stdClass);
var_dump($r1->getName());
@@ -18,8 +16,6 @@ var_dump($r3->getName());
?>
--EXPECTF--
-Warning: ReflectionObject::__construct() expects exactly 1 parameter, 0 given in %s on line 2
-string(0) ""
string(8) "stdClass"
string(1) "C"
string(16) "ReflectionObject"
diff --git a/ext/reflection/tests/ReflectionObject_isInstance_basic.phpt b/ext/reflection/tests/ReflectionObject_isInstance_basic.phpt
index ff310df09b..146ac5ccd9 100644
--- a/ext/reflection/tests/ReflectionObject_isInstance_basic.phpt
+++ b/ext/reflection/tests/ReflectionObject_isInstance_basic.phpt
@@ -9,15 +9,15 @@ class X {}
$classes = array("A", "B", "X");
$instances = array( "myA" => new A,
- "myB" => new B,
- "myX" => new X );
+ "myB" => new B,
+ "myX" => new X );
foreach ($classes as $class) {
- $ro = new ReflectionObject(new $class);
- foreach ($instances as $name => $instance) {
- echo "is $name a $class? ";
- var_dump($ro->isInstance($instance));
- }
+ $ro = new ReflectionObject(new $class);
+ foreach ($instances as $name => $instance) {
+ echo "is $name a $class? ";
+ var_dump($ro->isInstance($instance));
+ }
}
?>
diff --git a/ext/reflection/tests/ReflectionObject_isInstantiable_basic.phpt b/ext/reflection/tests/ReflectionObject_isInstantiable_basic.phpt
index 982580fc56..1b30debc9d 100644
--- a/ext/reflection/tests/ReflectionObject_isInstantiable_basic.phpt
+++ b/ext/reflection/tests/ReflectionObject_isInstantiable_basic.phpt
@@ -6,28 +6,28 @@ class C {
}
interface iface {
- function f1();
+ function f1();
}
class ifaceImpl implements iface {
- function f1() {}
+ function f1() {}
}
abstract class abstractClass {
- function f1() {}
- abstract function f2();
+ function f1() {}
+ abstract function f2();
}
class D extends abstractClass {
- function f2() {}
+ function f2() {}
}
$classes = array("C", "ifaceImpl", "D");
foreach($classes as $class ) {
- $ro = new ReflectionObject(new $class);
- echo "Is $class instantiable? ";
- var_dump($ro->IsInstantiable());
+ $ro = new ReflectionObject(new $class);
+ echo "Is $class instantiable? ";
+ var_dump($ro->IsInstantiable());
}
?>
--EXPECT--
diff --git a/ext/reflection/tests/ReflectionObject_isInstantiable_variation.phpt b/ext/reflection/tests/ReflectionObject_isInstantiable_variation.phpt
index 675bbdde8d..dada6ffc78 100644
--- a/ext/reflection/tests/ReflectionObject_isInstantiable_variation.phpt
+++ b/ext/reflection/tests/ReflectionObject_isInstantiable_variation.phpt
@@ -4,80 +4,47 @@ ReflectionObject::IsInstantiable() - variation - constructors
<?php
class noCtor {
- public static function reflectionObjectFactory() {
- return new ReflectionObject(new self);
- }
+ public static function reflectionObjectFactory() {
+ return new ReflectionObject(new self);
+ }
}
class publicCtorNew {
- public function __construct() {}
- public static function reflectionObjectFactory() {
- return new ReflectionObject(new self);
- }
+ public function __construct() {}
+ public static function reflectionObjectFactory() {
+ return new ReflectionObject(new self);
+ }
}
class protectedCtorNew {
- protected function __construct() {}
- public static function reflectionObjectFactory() {
- return new ReflectionObject(new self);
- }
+ protected function __construct() {}
+ public static function reflectionObjectFactory() {
+ return new ReflectionObject(new self);
+ }
}
class privateCtorNew {
- private function __construct() {}
- public static function reflectionObjectFactory() {
- return new ReflectionObject(new self);
- }
+ private function __construct() {}
+ public static function reflectionObjectFactory() {
+ return new ReflectionObject(new self);
+ }
}
-class publicCtorOld {
- public function publicCtorOld() {}
- public static function reflectionObjectFactory() {
- return new ReflectionObject(new self);
- }
-}
-
-class protectedCtorOld {
- protected function protectedCtorOld() {}
- public static function reflectionObjectFactory() {
- return new ReflectionObject(new self);
- }
-}
-
-class privateCtorOld {
- private function privateCtorOld() {}
- public static function reflectionObjectFactory() {
- return new ReflectionObject(new self);
- }
-}
-
-
$reflectionObjects = array(
- noCtor::reflectionObjectFactory(),
- publicCtorNew::reflectionObjectFactory(),
- protectedCtorNew::reflectionObjectFactory(),
- privateCtorNew::reflectionObjectFactory(),
- publicCtorOld::reflectionObjectFactory(),
- protectedCtorOld::reflectionObjectFactory(),
- privateCtorOld::reflectionObjectFactory()
- );
+ noCtor::reflectionObjectFactory(),
+ publicCtorNew::reflectionObjectFactory(),
+ protectedCtorNew::reflectionObjectFactory(),
+ privateCtorNew::reflectionObjectFactory(),
+ );
-foreach($reflectionObjects as $reflectionObject ) {
- $name = $reflectionObject->getName();
- echo "Is $name instantiable? ";
- var_dump($reflectionObject->IsInstantiable());
+foreach ($reflectionObjects as $reflectionObject) {
+ $name = $reflectionObject->getName();
+ echo "Is $name instantiable? ";
+ var_dump($reflectionObject->IsInstantiable());
}
?>
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; publicCtorOld has a deprecated constructor in %s on line %d
-
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; protectedCtorOld has a deprecated constructor in %s on line %d
-
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; privateCtorOld has a deprecated constructor in %s on line %d
+--EXPECT--
Is noCtor instantiable? bool(true)
Is publicCtorNew instantiable? bool(true)
Is protectedCtorNew instantiable? bool(false)
Is privateCtorNew instantiable? bool(false)
-Is publicCtorOld instantiable? bool(true)
-Is protectedCtorOld instantiable? bool(false)
-Is privateCtorOld instantiable? bool(false)
diff --git a/ext/reflection/tests/ReflectionObject_isInternal_basic.phpt b/ext/reflection/tests/ReflectionObject_isInternal_basic.phpt
index 234b8eb27e..8f1c6fc841 100644
--- a/ext/reflection/tests/ReflectionObject_isInternal_basic.phpt
+++ b/ext/reflection/tests/ReflectionObject_isInternal_basic.phpt
@@ -12,7 +12,7 @@ $r4 = new ReflectionObject(new Exception);
$r5 = new ReflectionObject(new C);
var_dump($r1->isInternal(), $r2->isInternal(), $r3->isInternal(),
- $r4->isInternal(), $r5->isInternal());
+ $r4->isInternal(), $r5->isInternal());
?>
--EXPECT--
diff --git a/ext/reflection/tests/ReflectionObject_isSubclassOf.002.phpt b/ext/reflection/tests/ReflectionObject_isSubclassOf.002.phpt
index f05197ebaf..5cebd43016 100644
--- a/ext/reflection/tests/ReflectionObject_isSubclassOf.002.phpt
+++ b/ext/reflection/tests/ReflectionObject_isSubclassOf.002.phpt
@@ -10,39 +10,35 @@ $ro = new ReflectionObject(new C);
echo "\n\nTest bad arguments:\n";
try {
- var_dump($ro->isSubclassOf());
-} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump($ro->isSubclassOf());
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($ro->isSubclassOf('C', 'C'));
-} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ var_dump($ro->isSubclassOf('C', 'C'));
+} catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($ro->isSubclassOf(null));
+ var_dump($ro->isSubclassOf(null));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($ro->isSubclassOf('ThisClassDoesNotExist'));
+ var_dump($ro->isSubclassOf('ThisClassDoesNotExist'));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- var_dump($ro->isSubclassOf(2));
+ var_dump($ro->isSubclassOf(2));
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
---EXPECTF--
+--EXPECT--
Test bad arguments:
-
-Warning: ReflectionClass::isSubclassOf() expects exactly 1 parameter, 0 given in %s on line 7
-NULL
-
-Warning: ReflectionClass::isSubclassOf() expects exactly 1 parameter, 2 given in %s on line 12
-NULL
+ReflectionClass::isSubclassOf() expects exactly 1 parameter, 0 given
+ReflectionClass::isSubclassOf() expects exactly 1 parameter, 2 given
Parameter one must either be a string or a ReflectionClass object
Class ThisClassDoesNotExist does not exist
Parameter one must either be a string or a ReflectionClass object
diff --git a/ext/reflection/tests/ReflectionObject_isSubclassOf_basic.phpt b/ext/reflection/tests/ReflectionObject_isSubclassOf_basic.phpt
index 25c29c7534..095c59fa34 100644
--- a/ext/reflection/tests/ReflectionObject_isSubclassOf_basic.phpt
+++ b/ext/reflection/tests/ReflectionObject_isSubclassOf_basic.phpt
@@ -13,28 +13,28 @@ $classNames = array('A', 'B', 'C', 'I', 'X');
//Create ReflectionClasses
foreach ($classNames as $className) {
- $rcs[$className] = new ReflectionClass($className);
+ $rcs[$className] = new ReflectionClass($className);
}
//Create ReflectionObjects
foreach ($classNames as $className) {
- if ($rcs[$className]->isInstantiable()) {
- $ros[$className] = new ReflectionObject(new $className);
- }
+ if ($rcs[$className]->isInstantiable()) {
+ $ros[$className] = new ReflectionObject(new $className);
+ }
}
foreach ($ros as $childName => $child) {
- foreach ($rcs as $parentName => $parent) {
- echo "Is " . $childName . " a subclass of " . $parentName . "? \n";
- echo " - Using ReflectionClass object argument: ";
- var_dump($child->isSubclassOf($parent));
- if ($parent->isInstantiable()) {
- echo " - Using ReflectionObject object argument: ";
- var_dump($child->isSubclassOf($ros[$parentName]));
- }
- echo " - Using string argument: ";
- var_dump($child->isSubclassOf($parentName));
- }
+ foreach ($rcs as $parentName => $parent) {
+ echo "Is " . $childName . " a subclass of " . $parentName . "? \n";
+ echo " - Using ReflectionClass object argument: ";
+ var_dump($child->isSubclassOf($parent));
+ if ($parent->isInstantiable()) {
+ echo " - Using ReflectionObject object argument: ";
+ var_dump($child->isSubclassOf($ros[$parentName]));
+ }
+ echo " - Using string argument: ";
+ var_dump($child->isSubclassOf($parentName));
+ }
}
?>
--EXPECT--
diff --git a/ext/reflection/tests/ReflectionObject_isSubclassOf_error.phpt b/ext/reflection/tests/ReflectionObject_isSubclassOf_error.phpt
index 11994ed705..582bcffe65 100644
--- a/ext/reflection/tests/ReflectionObject_isSubclassOf_error.phpt
+++ b/ext/reflection/tests/ReflectionObject_isSubclassOf_error.phpt
@@ -5,20 +5,12 @@ ReflectionObject::isSubclassOf() - invalid params
class A {}
$ro = new ReflectionObject(new A);
-var_dump($ro->isSubclassOf());
-var_dump($ro->isSubclassOf('A',5));
var_dump($ro->isSubclassOf('X'));
?>
--EXPECTF--
-Warning: ReflectionClass::isSubclassOf() expects exactly 1 parameter, 0 given in %s on line 5
-NULL
-
-Warning: ReflectionClass::isSubclassOf() expects exactly 1 parameter, 2 given in %s on line 6
-NULL
-
-Fatal error: Uncaught ReflectionException: Class X does not exist in %s:7
+Fatal error: Uncaught ReflectionException: Class X does not exist in %s:%d
Stack trace:
-#0 %s(7): ReflectionClass->isSubclassOf('X')
+#0 %s(%d): ReflectionClass->isSubclassOf('X')
#1 {main}
- thrown in %s on line 7
+ thrown in %s on line %d
diff --git a/ext/reflection/tests/ReflectionObject_isUserDefined_basic.phpt b/ext/reflection/tests/ReflectionObject_isUserDefined_basic.phpt
index 1a9dea3aba..f561b909e4 100644
--- a/ext/reflection/tests/ReflectionObject_isUserDefined_basic.phpt
+++ b/ext/reflection/tests/ReflectionObject_isUserDefined_basic.phpt
@@ -12,7 +12,7 @@ $r4 = new ReflectionObject(new Exception);
$r5 = new ReflectionObject(new C);
var_dump($r1->isUserDefined(), $r2->isUserDefined(), $r3->isUserDefined(),
- $r4->isUserDefined(), $r5->isUserDefined());
+ $r4->isUserDefined(), $r5->isUserDefined());
?>
--EXPECT--
diff --git a/ext/reflection/tests/ReflectionParameter_001.phpt b/ext/reflection/tests/ReflectionParameter_001.phpt
index 822da2fe9a..b2b5218724 100644
--- a/ext/reflection/tests/ReflectionParameter_001.phpt
+++ b/ext/reflection/tests/ReflectionParameter_001.phpt
@@ -11,11 +11,11 @@ class ReflectTestClass {
}
public function oneArgNonStatic($theParam) {
- $theParam--;
+ $theParam--;
}
public function noArgs() {
- echo "No arg function\n";
+ echo "No arg function\n";
}
}
@@ -25,18 +25,18 @@ $method = new ReflectionMethod('ReflectTestClass', 'twoArgFunction');
$parameters = $method->getParameters();
echo "Parameters from twoArgMethod:\n\n";
foreach($parameters as $parameter) {
- var_dump($parameter);
- $name = $parameter->getName();
- echo "\n";
+ var_dump($parameter);
+ $name = $parameter->getName();
+ echo "\n";
}
$method = new ReflectionMethod('ReflectTestClass', 'oneArgNonStatic');
$parameters = $method->getParameters();
echo "Parameters from oneArgNonStatic:\n\n";
foreach($parameters as $parameter) {
- var_dump($parameter);
- $name = $parameter->getName();
- echo "\n";
+ var_dump($parameter);
+ $name = $parameter->getName();
+ echo "\n";
}
@@ -45,9 +45,9 @@ $parameters = $method->getParameters();
echo "Parameters from noArgs:\n\n";
var_dump($parameters);
foreach($parameters as $parameter) {
- var_dump($parameter);
- $name = $parameter->getName();
- echo "\n";
+ var_dump($parameter);
+ $name = $parameter->getName();
+ echo "\n";
}
echo "done\n";
diff --git a/ext/reflection/tests/ReflectionParameter_002.phpt b/ext/reflection/tests/ReflectionParameter_002.phpt
index 571edac7a9..7ff12c2d33 100644
--- a/ext/reflection/tests/ReflectionParameter_002.phpt
+++ b/ext/reflection/tests/ReflectionParameter_002.phpt
@@ -21,11 +21,11 @@ $method = new ReflectionMethod('ReflectTestClass', 'staticMethod');
$parameters = $method->getParameters();
echo "Parameters from staticMethod:\n\n";
foreach($parameters as $parameter) {
- var_dump($parameter);
+ var_dump($parameter);
if($parameter->isPassedByReference()) {
- echo "This param is passed by reference\n";
+ echo "This param is passed by reference\n";
} else {
- echo "This param is not passed by reference\n";
+ echo "This param is not passed by reference\n";
}
echo "\n";
}
@@ -36,11 +36,11 @@ $method = new ReflectionMethod('ReflectTestClass', 'instanceMethod');
$parameters = $method->getParameters();
echo "Parameters from instanceMethod:\n\n";
foreach($parameters as $parameter) {
- var_dump($parameter);
+ var_dump($parameter);
if($parameter->isPassedByReference()) {
- echo "This param is passed by reference\n";
+ echo "This param is passed by reference\n";
} else {
- echo "This param is not passed by reference\n";
+ echo "This param is not passed by reference\n";
}
echo "\n";
}
diff --git a/ext/reflection/tests/ReflectionParameter_003.phpt b/ext/reflection/tests/ReflectionParameter_003.phpt
index cc092bffcc..8396eeb97c 100644
--- a/ext/reflection/tests/ReflectionParameter_003.phpt
+++ b/ext/reflection/tests/ReflectionParameter_003.phpt
@@ -24,31 +24,31 @@ $refParameters = $refMethod->getParameters();
echo "parameter names from staticMethod method:\n\n";
foreach($refParameters as $parameter) {
- var_dump($parameter);
- if($parameter->isOptional()) {
- echo "this parameter is optional\n";
- } else {
- echo "this parameter is not optional\n";
- }
+ var_dump($parameter);
+ if($parameter->isOptional()) {
+ echo "this parameter is optional\n";
+ } else {
+ echo "this parameter is not optional\n";
+ }
- if($parameter->isDefaultValueAvailable()) {
- echo "this parameter has a default value\n";
- } else {
- echo "this parameter has no default value\n";
- }
+ if($parameter->isDefaultValueAvailable()) {
+ echo "this parameter has a default value\n";
+ } else {
+ echo "this parameter has no default value\n";
+ }
- /*
- $val = 0;
- try {
- $val = $parameter->getDefaultValue();
- var_dump($val);
- } catch (ReflectionException $e) {
- print $e->getMessage();
- echo "\n";
- }
- */
+ /*
+ $val = 0;
+ try {
+ $val = $parameter->getDefaultValue();
+ var_dump($val);
+ } catch (ReflectionException $e) {
+ print $e->getMessage();
+ echo "\n";
+ }
+ */
- echo "\n";
+ echo "\n";
}
?>
@@ -56,7 +56,7 @@ foreach($refParameters as $parameter) {
hello from test
third is jack
-Notice: Undefined variable: theIncrement in %s on line 8
+Warning: Undefined variable: theIncrement in %s on line %d
parameter names from staticMethod method:
object(ReflectionParameter)#%d (1) {
diff --git a/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic1.phpt b/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic1.phpt
index 20f4c95dc7..4f3f114bad 100644
--- a/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic1.phpt
+++ b/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic1.phpt
@@ -6,30 +6,30 @@ ReflectionParameter::isDefaultValueConstant() && getDefaultValueConstantName()
define("CONST_TEST_1", "const1");
function ReflectionParameterTest($test1=array(), $test2 = CONST_TEST_1, $test3 = CASE_LOWER) {
- echo $test;
+ echo $test;
}
$reflect = new ReflectionFunction('ReflectionParameterTest');
foreach($reflect->getParameters() as $param) {
- if($param->getName() == 'test1') {
- var_dump($param->isDefaultValueConstant());
- }
- if($param->getName() == 'test2') {
- var_dump($param->isDefaultValueConstant());
- }
- if($param->isDefaultValueAvailable() && $param->isDefaultValueConstant()) {
- var_dump($param->getDefaultValueConstantName());
- }
+ if($param->getName() == 'test1') {
+ var_dump($param->isDefaultValueConstant());
+ }
+ if($param->getName() == 'test2') {
+ var_dump($param->isDefaultValueConstant());
+ }
+ if($param->isDefaultValueAvailable() && $param->isDefaultValueConstant()) {
+ var_dump($param->getDefaultValueConstantName());
+ }
}
class Foo2 {
- const bar = 'Foo2::bar';
+ const bar = 'Foo2::bar';
}
class Foo {
- const bar = 'Foo::bar';
+ const bar = 'Foo::bar';
- public function baz($param1 = self::bar, $param2=Foo2::bar, $param3=CONST_TEST_1) {
- }
+ public function baz($param1 = self::bar, $param2=Foo2::bar, $param3=CONST_TEST_1) {
+ }
}
$method = new ReflectionMethod('Foo', 'baz');
@@ -41,7 +41,6 @@ foreach ($params as $param) {
}
}
?>
-==DONE==
--EXPECT--
bool(false)
bool(true)
@@ -50,4 +49,3 @@ string(10) "CASE_LOWER"
string(9) "self::bar"
string(9) "Foo2::bar"
string(12) "CONST_TEST_1"
-==DONE==
diff --git a/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic2.phpt b/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic2.phpt
index 1ee9e93735..28aeceeb2f 100644
--- a/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic2.phpt
+++ b/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_basic2.phpt
@@ -4,24 +4,24 @@ ReflectionParameter::isDefaultValueConstant() && getDefaultValueConstantName() f
<?php
namespace ReflectionTestNamespace {
- CONST TEST_CONST_1 = "Test Const 1";
+ CONST TEST_CONST_1 = "Test Const 1";
- class TestClass {
- const TEST_CONST_2 = "Test Const 2 in class";
- }
+ class TestClass {
+ const TEST_CONST_2 = "Test Const 2 in class";
+ }
}
namespace {
- function ReflectionParameterTest($test=ReflectionTestNamespace\TestClass::TEST_CONST_2, $test2 = ReflectionTestNamespace\CONST_TEST_1) {
- echo $test;
- }
- $reflect = new ReflectionFunction('ReflectionParameterTest');
- foreach($reflect->getParameters() as $param) {
- if($param->isDefaultValueAvailable() && $param->isDefaultValueConstant()) {
- echo $param->getDefaultValueConstantName() . "\n";
- }
- }
- echo "==DONE==";
+ function ReflectionParameterTest($test=ReflectionTestNamespace\TestClass::TEST_CONST_2, $test2 = ReflectionTestNamespace\CONST_TEST_1) {
+ echo $test;
+ }
+ $reflect = new ReflectionFunction('ReflectionParameterTest');
+ foreach($reflect->getParameters() as $param) {
+ if($param->isDefaultValueAvailable() && $param->isDefaultValueConstant()) {
+ echo $param->getDefaultValueConstantName() . "\n";
+ }
+ }
+ echo "==DONE==";
}
?>
--EXPECT--
diff --git a/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_error.phpt b/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_error.phpt
index a2c2d24582..7f1451bbdb 100644
--- a/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_error.phpt
+++ b/ext/reflection/tests/ReflectionParameter_DefaultValueConstant_error.phpt
@@ -6,16 +6,16 @@ ReflectionParameter::getDefaultValueConstant() should raise exception on non opt
define("CONST_TEST_1", "const1");
function ReflectionParameterTest($test, $test2 = CONST_TEST_1) {
- echo $test;
+ echo $test;
}
$reflect = new ReflectionFunction('ReflectionParameterTest');
foreach($reflect->getParameters() as $param) {
- try {
- echo $param->getDefaultValueConstantName() . "\n";
- }
- catch(ReflectionException $e) {
- echo $e->getMessage() . "\n";
- }
+ try {
+ echo $param->getDefaultValueConstantName() . "\n";
+ }
+ catch(ReflectionException $e) {
+ echo $e->getMessage() . "\n";
+ }
}
?>
--EXPECT--
diff --git a/ext/reflection/tests/ReflectionParameter_export_basic.phpt b/ext/reflection/tests/ReflectionParameter_export_basic.phpt
index 6f3d16a5ff..22b25de663 100644
--- a/ext/reflection/tests/ReflectionParameter_export_basic.phpt
+++ b/ext/reflection/tests/ReflectionParameter_export_basic.phpt
@@ -5,15 +5,13 @@ Stefan Koopmanschap <stefan@stefankoopmanschap.nl>
--FILE--
<?php
function ReflectionParameterTest($test, $test2 = null) {
- echo $test;
+ echo $test;
}
$reflect = new ReflectionFunction('ReflectionParameterTest');
foreach($reflect->getParameters() as $key => $value) {
- echo new ReflectionParameter('ReflectionParameterTest', $key), "\n";
+ echo new ReflectionParameter('ReflectionParameterTest', $key), "\n";
}
?>
-==DONE==
--EXPECTF--
Parameter #0 [ <required> $test ]
Parameter #1 [ <optional> $test2 = NULL ]
-==DONE==
diff --git a/ext/reflection/tests/ReflectionParameter_export_error2.phpt b/ext/reflection/tests/ReflectionParameter_export_error2.phpt
index 38cd99171b..3def577e06 100644
--- a/ext/reflection/tests/ReflectionParameter_export_error2.phpt
+++ b/ext/reflection/tests/ReflectionParameter_export_error2.phpt
@@ -5,25 +5,25 @@ Stefan Koopmanschap <stefan@stefankoopmanschap.nl>
--FILE--
<?php
function ReflectionParameterTest($test, $test2 = null) {
- echo $test;
+ echo $test;
}
$reflect = new ReflectionFunction('ReflectionParameterTest');
$params = $reflect->getParameters();
try {
- foreach($params as $key => $value) {
- ReflectionParameter::export($reflect, $key);
- }
+ foreach($params as $key => $value) {
+ ReflectionParameter::export($reflect, $key);
+ }
}
catch (ReflectionException $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- foreach($params as $key => $value) {
- ReflectionParameter::export(42, $key);
- }
+ foreach($params as $key => $value) {
+ ReflectionParameter::export(42, $key);
+ }
}
catch (ReflectionException $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
--EXPECTF--
diff --git a/ext/reflection/tests/ReflectionParameter_export_error3.phpt b/ext/reflection/tests/ReflectionParameter_export_error3.phpt
index b098a9251d..822fca0032 100644
--- a/ext/reflection/tests/ReflectionParameter_export_error3.phpt
+++ b/ext/reflection/tests/ReflectionParameter_export_error3.phpt
@@ -5,12 +5,12 @@ Stefan Koopmanschap <stefan@stefankoopmanschap.nl>
--FILE--
<?php
function ReflectionParameterTest($test, $test2 = null) {
- echo $test;
+ echo $test;
}
$reflect = new ReflectionFunction('ReflectionParameterTest');
$params = $reflect->getParameters();
foreach($params as $key => $value) {
- ReflectionParameter::export('ReflectionParameterTest', 'incorrect_parameter');
+ ReflectionParameter::export('ReflectionParameterTest', 'incorrect_parameter');
}
--EXPECTF--
Deprecated: Function ReflectionParameter::export() is deprecated in %s on line %d
diff --git a/ext/reflection/tests/ReflectionParameter_getDeclaringFunction_basic.phpt b/ext/reflection/tests/ReflectionParameter_getDeclaringFunction_basic.phpt
index 59e15a7054..7cbef67292 100644
--- a/ext/reflection/tests/ReflectionParameter_getDeclaringFunction_basic.phpt
+++ b/ext/reflection/tests/ReflectionParameter_getDeclaringFunction_basic.phpt
@@ -6,15 +6,14 @@ Stefan Koopmanschap <stefan@stefankoopmanschap.nl>
--FILE--
<?php
function ReflectionParameterTest($test, $test2 = null) {
- echo $test;
+ echo $test;
}
$reflect = new ReflectionFunction('ReflectionParameterTest');
$params = $reflect->getParameters();
foreach($params as $key => $value) {
- echo $value->getDeclaringFunction() . "\n";
+ echo $value->getDeclaringFunction() . "\n";
}
?>
-==DONE==
--EXPECTF--
Function [ <user> function ReflectionParameterTest ] {
@@ %s.php %d - %d
@@ -34,4 +33,3 @@ Function [ <user> function ReflectionParameterTest ] {
}
}
-==DONE==
diff --git a/ext/reflection/tests/ReflectionParameter_getPosition_basic.phpt b/ext/reflection/tests/ReflectionParameter_getPosition_basic.phpt
index 2807bdf66d..485ca37a2b 100644
--- a/ext/reflection/tests/ReflectionParameter_getPosition_basic.phpt
+++ b/ext/reflection/tests/ReflectionParameter_getPosition_basic.phpt
@@ -6,16 +6,14 @@ Stefan Koopmanschap <stefan@stefankoopmanschap.nl>
--FILE--
<?php
function ReflectionParameterTest($test, $test2 = null) {
- echo $test;
+ echo $test;
}
$reflect = new ReflectionFunction('ReflectionParameterTest');
$params = $reflect->getParameters();
foreach($params as $key => $value) {
- var_dump($value->getPosition());
+ var_dump($value->getPosition());
}
?>
-==DONE==
--EXPECT--
int(0)
int(1)
-==DONE==
diff --git a/ext/reflection/tests/ReflectionParameter_invalidMethodInConstructor.phpt b/ext/reflection/tests/ReflectionParameter_invalidMethodInConstructor.phpt
index eb6d4644a0..ee6ae86cba 100644
--- a/ext/reflection/tests/ReflectionParameter_invalidMethodInConstructor.phpt
+++ b/ext/reflection/tests/ReflectionParameter_invalidMethodInConstructor.phpt
@@ -5,17 +5,17 @@ ReflectionParameter::__construct(): Invalid method as constructor
// Invalid class name
try {
- new ReflectionParameter (array ('A', 'b'), 0);
+ new ReflectionParameter (array ('A', 'b'), 0);
} catch (ReflectionException $e) { echo $e->getMessage()."\n"; }
// Invalid class method
try {
- new ReflectionParameter (array ('C', 'b'), 0);
+ new ReflectionParameter (array ('C', 'b'), 0);
} catch (ReflectionException $e) { echo $e->getMessage ()."\n"; }
// Invalid object method
try {
- new ReflectionParameter (array (new C, 'b'), 0);
+ new ReflectionParameter (array (new C, 'b'), 0);
} catch (ReflectionException $e) { echo $e->getMessage ()."\n"; }
@@ -23,17 +23,17 @@ class C {
}
try {
- new ReflectionParameter(array ('A', 'b'));
+ new ReflectionParameter(array ('A', 'b'));
}
catch(TypeError $e) {
- printf( "Ok - %s\n", $e->getMessage());
+ printf( "Ok - %s\n", $e->getMessage());
}
try {
- new ReflectionParameter(0, 0);
+ new ReflectionParameter(0, 0);
}
catch(ReflectionException $e) {
- printf( "Ok - %s\n", $e->getMessage());
+ printf( "Ok - %s\n", $e->getMessage());
}
echo "Done.\n";
diff --git a/ext/reflection/tests/ReflectionParameter_isDefault.phpt b/ext/reflection/tests/ReflectionParameter_isDefault.phpt
index d8b4f0edc0..ea95878170 100644
--- a/ext/reflection/tests/ReflectionParameter_isDefault.phpt
+++ b/ext/reflection/tests/ReflectionParameter_isDefault.phpt
@@ -23,7 +23,6 @@ $prop2 = new ReflectionProperty($a, 'myprop');
var_dump($prop1->isDefault());
var_dump($prop2->isDefault());
?>
-==DONE==
--EXPECT--
bool(true)
bool(false)
@@ -31,4 +30,3 @@ bool(true)
bool(false)
bool(true)
bool(false)
-==DONE==
diff --git a/ext/reflection/tests/ReflectionParameter_toString_basic.phpt b/ext/reflection/tests/ReflectionParameter_toString_basic.phpt
index d1a23c758d..053c3918db 100644
--- a/ext/reflection/tests/ReflectionParameter_toString_basic.phpt
+++ b/ext/reflection/tests/ReflectionParameter_toString_basic.phpt
@@ -5,17 +5,15 @@ Stefan Koopmanschap <stefan@stefankoopmanschap.nl>
--FILE--
<?php
function ReflectionParameterTest($test, $test2 = null, ...$test3) {
- echo $test;
+ echo $test;
}
$reflect = new ReflectionFunction('ReflectionParameterTest');
$params = $reflect->getParameters();
foreach($params as $key => $value) {
- echo $value->__toString() . "\n";
+ echo $value->__toString() . "\n";
}
?>
-==DONE==
--EXPECT--
Parameter #0 [ <required> $test ]
Parameter #1 [ <optional> $test2 = NULL ]
Parameter #2 [ <optional> ...$test3 ]
-==DONE==
diff --git a/ext/reflection/tests/ReflectionProperty_constructor_variation1.phpt b/ext/reflection/tests/ReflectionProperty_constructor_variation1.phpt
index 6f39f9db6c..4456960dc7 100644
--- a/ext/reflection/tests/ReflectionProperty_constructor_variation1.phpt
+++ b/ext/reflection/tests/ReflectionProperty_constructor_variation1.phpt
@@ -4,27 +4,27 @@ ReflectionProperty::__construct(): ensure inherited private props can't be acces
<?php
class C {
- private $p = 1;
-
- static function testFromC() {
- try {
- $rp = new ReflectionProperty("D", "p");
- var_dump($rp);
- } catch (Exception $e) {
- echo $e->getMessage();
- }
- }
+ private $p = 1;
+
+ static function testFromC() {
+ try {
+ $rp = new ReflectionProperty("D", "p");
+ var_dump($rp);
+ } catch (Exception $e) {
+ echo $e->getMessage();
+ }
+ }
}
class D extends C{
- static function testFromD() {
- try {
- $rp = new ReflectionProperty("D", "p");
- var_dump($rp);
- } catch (Exception $e) {
- echo $e->getMessage();
- }
- }
+ static function testFromD() {
+ try {
+ $rp = new ReflectionProperty("D", "p");
+ var_dump($rp);
+ } catch (Exception $e) {
+ echo $e->getMessage();
+ }
+ }
}
echo "--> Reflect inherited private from global scope:\n";
@@ -32,7 +32,7 @@ try {
$rp = new ReflectionProperty("D", "p");
var_dump($rp);
} catch (Exception $e) {
- echo $e->getMessage();
+ echo $e->getMessage();
}
echo "\n\n--> Reflect inherited private from declaring scope:\n";
diff --git a/ext/reflection/tests/ReflectionProperty_error.phpt b/ext/reflection/tests/ReflectionProperty_error.phpt
index c8a2f11ee1..052bfcb97c 100644
--- a/ext/reflection/tests/ReflectionProperty_error.phpt
+++ b/ext/reflection/tests/ReflectionProperty_error.phpt
@@ -8,55 +8,24 @@ class C {
}
try {
- new ReflectionProperty();
+ new ReflectionProperty();
} catch (TypeError $re) {
- echo "Ok - ".$re->getMessage().PHP_EOL;
+ echo "Ok - ".$re->getMessage().PHP_EOL;
}
try {
- new ReflectionProperty('C::p');
+ new ReflectionProperty('C::p');
} catch (TypeError $re) {
- echo "Ok - ".$re->getMessage().PHP_EOL;
+ echo "Ok - ".$re->getMessage().PHP_EOL;
}
try {
- new ReflectionProperty('C', 'p', 'x');
+ new ReflectionProperty('C', 'p', 'x');
} catch (TypeError $re) {
- echo "Ok - ".$re->getMessage().PHP_EOL;
+ echo "Ok - ".$re->getMessage().PHP_EOL;
}
-
-$rp = new ReflectionProperty('C', 'p');
-var_dump($rp->getName(1));
-var_dump($rp->isPrivate(1));
-var_dump($rp->isProtected(1));
-var_dump($rp->isPublic(1));
-var_dump($rp->isStatic(1));
-var_dump($rp->getModifiers(1));
-var_dump($rp->isDefault(1));
-
?>
---EXPECTF--
+--EXPECT--
Ok - ReflectionProperty::__construct() expects exactly 2 parameters, 0 given
Ok - ReflectionProperty::__construct() expects exactly 2 parameters, 1 given
Ok - ReflectionProperty::__construct() expects exactly 2 parameters, 3 given
-
-Warning: ReflectionProperty::getName() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionProperty::isPrivate() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionProperty::isProtected() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionProperty::isPublic() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionProperty::isStatic() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionProperty::getModifiers() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ReflectionProperty::isDefault() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
diff --git a/ext/reflection/tests/ReflectionProperty_export_error.phpt b/ext/reflection/tests/ReflectionProperty_export_error.phpt
index 114b4c0ac8..446fedf0a3 100644
--- a/ext/reflection/tests/ReflectionProperty_export_error.phpt
+++ b/ext/reflection/tests/ReflectionProperty_export_error.phpt
@@ -32,10 +32,6 @@ catch(Exception $e) {
echo $e->getMessage();
}
-echo "\n\nIncorrect number of args:\n";
-ReflectionProperty::export();
-ReflectionProperty::export('TestClass', "nonExistentProperty", true, false);
-
?>
--EXPECTF--
Non-existent class:
@@ -52,13 +48,3 @@ Non-existent property:
Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d
Property TestClass::$nonExistentProperty does not exist
-
-Incorrect number of args:
-
-Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d
-
-Warning: ReflectionProperty::export() expects at least 2 parameters, 0 given in %s on line %d
-
-Deprecated: Function ReflectionProperty::export() is deprecated in %s on line %d
-
-Warning: ReflectionProperty::export() expects at most 3 parameters, 4 given in %s on line %d
diff --git a/ext/reflection/tests/ReflectionProperty_getDeclaringClass_variation1.phpt b/ext/reflection/tests/ReflectionProperty_getDeclaringClass_variation1.phpt
index c7c9366471..7ee787a348 100644
--- a/ext/reflection/tests/ReflectionProperty_getDeclaringClass_variation1.phpt
+++ b/ext/reflection/tests/ReflectionProperty_getDeclaringClass_variation1.phpt
@@ -13,15 +13,9 @@ class B extends A {
$propInfo = new ReflectionProperty('B', 'prop');
var_dump($propInfo->getDeclaringClass());
-echo "Wrong number of params:\n";
-$propInfo->getDeclaringClass(1);
-
?>
--EXPECTF--
object(ReflectionClass)#%d (1) {
["name"]=>
string(1) "A"
}
-Wrong number of params:
-
-Warning: ReflectionProperty::getDeclaringClass() expects exactly 0 parameters, 1 given in %s on line %d
diff --git a/ext/reflection/tests/ReflectionProperty_getDefaultValue.phpt b/ext/reflection/tests/ReflectionProperty_getDefaultValue.phpt
new file mode 100644
index 0000000000..26614f5c60
--- /dev/null
+++ b/ext/reflection/tests/ReflectionProperty_getDefaultValue.phpt
@@ -0,0 +1,73 @@
+--TEST--
+reflection: ReflectionProperty::getDefaultValue
+--FILE--
+<?php
+
+define('FOO', 42);
+
+class TestClass
+{
+ public $foo;
+ public $bar = 'baz';
+
+ public static $static1;
+ public static $static2 = 1234;
+
+ public int $val1;
+ public int $val2 = 1234;
+
+ public ?int $nullable;
+ public ?int $nullable2 = null;
+
+ public $constantAst = 2 * 2;
+ public $constantRuntimeAst = FOO;
+}
+
+$property = new ReflectionProperty(TestClass::class, 'foo');
+var_dump($property->getDefaultValue());
+
+$property = new ReflectionProperty(TestClass::class, 'bar');
+var_dump($property->getDefaultValue());
+
+$property = new ReflectionProperty(TestClass::class, 'static1');
+var_dump($property->getDefaultValue());
+
+$property = new ReflectionProperty(TestClass::class, 'static2');
+var_dump($property->getDefaultValue());
+
+$property = new ReflectionProperty(TestClass::class, 'val1');
+var_dump($property->getDefaultValue());
+
+$property = new ReflectionProperty(TestClass::class, 'val2');
+var_dump($property->getDefaultValue());
+
+$property = new ReflectionProperty(TestClass::class, 'nullable');
+var_dump($property->getDefaultValue());
+
+$property = new ReflectionProperty(TestClass::class, 'nullable2');
+var_dump($property->getDefaultValue());
+
+$property = new ReflectionProperty(TestClass::class, 'constantAst');
+var_dump($property->getDefaultValue());
+
+$property = new ReflectionProperty(TestClass::class, 'constantRuntimeAst');
+var_dump($property->getDefaultValue());
+
+$test = new TestClass;
+$test->dynamic = null;
+$property = new ReflectionProperty($test, 'dynamic');
+var_dump($property->getDefaultValue());
+
+?>
+--EXPECT--
+NULL
+string(3) "baz"
+NULL
+int(1234)
+NULL
+int(1234)
+NULL
+NULL
+int(4)
+int(42)
+NULL
diff --git a/ext/reflection/tests/ReflectionProperty_getModifiers.001.phpt b/ext/reflection/tests/ReflectionProperty_getModifiers.001.phpt
index a297a10436..da6cf71b9c 100644
--- a/ext/reflection/tests/ReflectionProperty_getModifiers.001.phpt
+++ b/ext/reflection/tests/ReflectionProperty_getModifiers.001.phpt
@@ -7,15 +7,15 @@ Steve Seear <stevseea@php.net>
<?php
function reflectProperty($class, $property) {
- $propInfo = new ReflectionProperty($class, $property);
+ $propInfo = new ReflectionProperty($class, $property);
- echo "**********************************\n";
- echo "Reflecting on property $class::$property\n\n";
+ echo "**********************************\n";
+ echo "Reflecting on property $class::$property\n\n";
- echo "getModifiers():\n";
- var_dump($propInfo->getModifiers());
+ echo "getModifiers():\n";
+ var_dump($propInfo->getModifiers());
- echo "\n**********************************\n";
+ echo "\n**********************************\n";
}
class TestClass
@@ -23,8 +23,8 @@ class TestClass
public $pub;
static public $stat = "static property";
/**
- * This property has a comment.
- */
+ * This property has a comment.
+ */
protected $prot = 4;
private $priv = "keepOut";
}
diff --git a/ext/reflection/tests/ReflectionProperty_getValue_error.phpt b/ext/reflection/tests/ReflectionProperty_getValue_error.phpt
index 3bca85e4b6..c5da067c32 100644
--- a/ext/reflection/tests/ReflectionProperty_getValue_error.phpt
+++ b/ext/reflection/tests/ReflectionProperty_getValue_error.phpt
@@ -18,23 +18,15 @@ $instance = new TestClass();
$invalidInstance = new AnotherClass();
$propInfo = new ReflectionProperty('TestClass', 'pub2');
-echo "Too few args:\n";
-var_dump($propInfo->getValue());
-
-echo "\nToo many args:\n";
-var_dump($propInfo->getValue($instance, true));
-
-echo "\nWrong type of arg:\n";
-var_dump($propInfo->getValue(true));
-
echo "\nInstance without property:\n";
$propInfo = new ReflectionProperty('TestClass', 'stat');
echo "\nStatic property / too many args:\n";
-var_dump($propInfo->getValue($instance, true));
-
-echo "\nStatic property / wrong type of arg:\n";
-var_dump($propInfo->getValue(true));
+try {
+ var_dump($propInfo->getValue($instance, true));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "\nProtected property:\n";
try {
@@ -47,40 +39,31 @@ catch(Exception $exc) {
echo "\n\nInvalid instance:\n";
$propInfo = new ReflectionProperty('TestClass', 'pub2');
-var_dump($propInfo->getValue($invalidInstance));
-
-?>
---EXPECTF--
-Too few args:
-
-Warning: ReflectionProperty::getValue() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Too many args:
-
-Warning: ReflectionProperty::getValue() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Wrong type of arg:
+try {
+ var_dump($propInfo->getValue($invalidInstance));
+} catch (ReflectionException $e) {
+ echo $e->getMessage();
+}
-Warning: ReflectionProperty::getValue() expects parameter 1 to be object, bool given in %s on line %d
-NULL
+echo "\n\nMissing instance:\n";
+try {
+ var_dump($propInfo->getValue());
+} catch (TypeError $e) {
+ echo $e->getMessage();
+}
+?>
+--EXPECT--
Instance without property:
Static property / too many args:
-string(15) "static property"
-
-Static property / wrong type of arg:
-string(15) "static property"
+ReflectionProperty::getValue() expects at most 1 parameter, 2 given
Protected property:
Cannot access non-public member TestClass::$prot
Invalid instance:
+Given object is not an instance of the class this property was declared in
-Fatal error: Uncaught ReflectionException: Given object is not an instance of the class this property was declared in in %s:47
-Stack trace:
-#0 %s(47): ReflectionProperty->getValue(Object(AnotherClass))
-#1 {main}
- thrown in %s on line 47
+Missing instance:
+No object provided for getValue() on instance property
diff --git a/ext/reflection/tests/ReflectionProperty_hasDefaultValue.phpt b/ext/reflection/tests/ReflectionProperty_hasDefaultValue.phpt
new file mode 100644
index 0000000000..5709000370
--- /dev/null
+++ b/ext/reflection/tests/ReflectionProperty_hasDefaultValue.phpt
@@ -0,0 +1,60 @@
+--TEST--
+reflection: ReflectionProperty::hasDefaultValue
+--FILE--
+<?php
+
+class TestClass
+{
+ public $foo;
+ public $bar = 'baz';
+
+ public static $static1;
+ public static $static2 = 1234;
+
+ public int $val1;
+ public int $val2 = 1234;
+
+ public ?int $nullable;
+ public ?int $nullable2 = null;
+}
+
+$property = new ReflectionProperty(TestClass::class, 'foo');
+var_dump($property->hasDefaultValue());
+
+$property = new ReflectionProperty(TestClass::class, 'bar');
+var_dump($property->hasDefaultValue());
+
+$property = new ReflectionProperty(TestClass::class, 'static1');
+var_dump($property->hasDefaultValue());
+
+$property = new ReflectionProperty(TestClass::class, 'static2');
+var_dump($property->hasDefaultValue());
+
+$property = new ReflectionProperty(TestClass::class, 'val1');
+var_dump($property->hasDefaultValue());
+
+$property = new ReflectionProperty(TestClass::class, 'val2');
+var_dump($property->hasDefaultValue());
+
+$property = new ReflectionProperty(TestClass::class, 'nullable');
+var_dump($property->hasDefaultValue());
+
+$property = new ReflectionProperty(TestClass::class, 'nullable2');
+var_dump($property->hasDefaultValue());
+
+$test = new TestClass;
+$test->dynamic = null;
+$property = new ReflectionProperty($test, 'dynamic');
+var_dump($property->hasDefaultValue());
+
+?>
+--EXPECT--
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+bool(false)
diff --git a/ext/reflection/tests/ReflectionProperty_isDefault_basic.phpt b/ext/reflection/tests/ReflectionProperty_isDefault_basic.phpt
index 2aa630d9d0..1472615178 100644
--- a/ext/reflection/tests/ReflectionProperty_isDefault_basic.phpt
+++ b/ext/reflection/tests/ReflectionProperty_isDefault_basic.phpt
@@ -24,10 +24,6 @@ reflectProperty("TestClass", "stat");
reflectProperty("TestClass", "prot");
reflectProperty("TestClass", "priv");
-echo "Wrong number of params:\n";
-$propInfo = new ReflectionProperty('TestClass', 'pub');
-$propInfo->isDefault(1);
-
?>
--EXPECTF--
**********************************
@@ -58,6 +54,3 @@ isDefault():
bool(true)
**********************************
-Wrong number of params:
-
-Warning: ReflectionProperty::isDefault() expects exactly 0 parameters, 1 given in %s on line %d
diff --git a/ext/reflection/tests/ReflectionProperty_isInitialized.phpt b/ext/reflection/tests/ReflectionProperty_isInitialized.phpt
index f1f6e53ebd..29541e405b 100644
--- a/ext/reflection/tests/ReflectionProperty_isInitialized.phpt
+++ b/ext/reflection/tests/ReflectionProperty_isInitialized.phpt
@@ -4,12 +4,12 @@ Test ReflectionProperty::isInitialized()
<?php
class A {
- public static ?string $ssv = null;
- public static ?string $ss;
- public static $s;
- public ?int $iv = null;
- public ?int $i;
- public $n;
+ public static ?string $ssv = null;
+ public static ?string $ss;
+ public static $s;
+ public ?int $iv = null;
+ public ?int $i;
+ public $n;
private int $p;
}
@@ -62,6 +62,12 @@ try {
echo $e->getMessage(), "\n";
}
+try {
+ var_dump($rp->isInitialized());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+
class WithMagic {
public $prop;
public int $intProp;
@@ -108,6 +114,7 @@ bool(false)
Object type:
bool(false)
Given object is not an instance of the class this property was declared in
+No object provided for isInitialized() on instance property
Class with __isset:
bool(false)
bool(false)
diff --git a/ext/reflection/tests/ReflectionProperty_setValue_error.phpt b/ext/reflection/tests/ReflectionProperty_setValue_error.phpt
index 0bf223daa7..f58590b3ea 100644
--- a/ext/reflection/tests/ReflectionProperty_setValue_error.phpt
+++ b/ext/reflection/tests/ReflectionProperty_setValue_error.phpt
@@ -18,30 +18,6 @@ $instance = new TestClass();
$instanceWithNoProperties = new AnotherClass();
$propInfo = new ReflectionProperty('TestClass', 'pub2');
-echo "Too few args:\n";
-var_dump($propInfo->setValue());
-var_dump($propInfo->setValue($instance));
-
-echo "\nToo many args:\n";
-var_dump($propInfo->setValue($instance, "NewValue", true));
-
-echo "\nWrong type of arg:\n";
-var_dump($propInfo->setValue(true, "NewValue"));
-$propInfo = new ReflectionProperty('TestClass', 'stat');
-
-echo "\nStatic property / too many args:\n";
-var_dump($propInfo->setValue($instance, "NewValue", true));
-
-echo "\nStatic property / too few args:\n";
-var_dump($propInfo->setValue("A new value"));
-var_dump(TestClass::$stat);
-var_dump($propInfo->setValue());
-var_dump(TestClass::$stat);
-
-echo "\nStatic property / wrong type of arg:\n";
-var_dump($propInfo->setValue(true, "Another new value"));
-var_dump(TestClass::$stat);
-
echo "\nProtected property:\n";
try {
$propInfo = new ReflectionProperty('TestClass', 'prot');
@@ -57,41 +33,6 @@ var_dump($propInfo->setValue($instanceWithNoProperties, "NewValue"));
var_dump($instanceWithNoProperties->pub2);
?>
--EXPECTF--
-Too few args:
-
-Warning: ReflectionProperty::setValue() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: ReflectionProperty::setValue() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
-Too many args:
-
-Warning: ReflectionProperty::setValue() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-Wrong type of arg:
-
-Warning: ReflectionProperty::setValue() expects parameter 1 to be object, bool given in %s on line %d
-NULL
-
-Static property / too many args:
-
-Warning: ReflectionProperty::setValue() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-Static property / too few args:
-NULL
-string(11) "A new value"
-
-Warning: ReflectionProperty::setValue() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-string(11) "A new value"
-
-Static property / wrong type of arg:
-NULL
-string(17) "Another new value"
-
Protected property:
Cannot access non-public member TestClass::$prot
diff --git a/ext/reflection/tests/ReflectionProperty_typed_static.phpt b/ext/reflection/tests/ReflectionProperty_typed_static.phpt
index 77f95d77ef..eaf4209644 100644
--- a/ext/reflection/tests/ReflectionProperty_typed_static.phpt
+++ b/ext/reflection/tests/ReflectionProperty_typed_static.phpt
@@ -45,7 +45,7 @@ var_dump($rp->getValue());
int(42)
Typed static property Test::$y must not be accessed before initialization
int(24)
-Typed property Test::$y must be int, string used
+Cannot assign string to property Test::$y of type int
int(24)
Cannot assign string to reference held by property Test::$y of type int
int(24)
diff --git a/ext/reflection/tests/ReflectionType_001.phpt b/ext/reflection/tests/ReflectionType_001.phpt
index 1eb521317c..e31dc11348 100644
--- a/ext/reflection/tests/ReflectionType_001.phpt
+++ b/ext/reflection/tests/ReflectionType_001.phpt
@@ -77,22 +77,22 @@ foreach ([
echo "\n*** property types\n";
class PropTypeTest {
- public int $int;
- public string $string;
- public array $arr;
- public iterable $iterable;
- public stdClass $std;
- public OtherThing $other;
- public $mixed;
+ public int $int;
+ public string $string;
+ public array $arr;
+ public iterable $iterable;
+ public stdClass $std;
+ public OtherThing $other;
+ public $mixed;
}
$reflector = new ReflectionClass(PropTypeTest::class);
foreach ($reflector->getProperties() as $name => $property) {
- if ($property->hasType()) {
- printf("public %s $%s;\n",
- $property->getType()->getName(), $property->getName());
- } else printf("public $%s;\n", $property->getName());
+ if ($property->hasType()) {
+ printf("public %s $%s;\n",
+ $property->getType()->getName(), $property->getName());
+ } else printf("public $%s;\n", $property->getName());
}
echo "*** resolved property types\n";
diff --git a/ext/reflection/tests/ReflectionZendExtension_error.phpt b/ext/reflection/tests/ReflectionZendExtension_error.phpt
index efce02640b..cd06b96465 100644
--- a/ext/reflection/tests/ReflectionZendExtension_error.phpt
+++ b/ext/reflection/tests/ReflectionZendExtension_error.phpt
@@ -1,5 +1,5 @@
--TEST--
-Test ReflectionZendExtension class erros
+Test ReflectionZendExtension class errors
--CREDITS--
Gabriel Caruso (carusogabriel34@gmail.com)
--SKIPIF--
diff --git a/ext/reflection/tests/bug26640.phpt b/ext/reflection/tests/bug26640.phpt
index 8a93d72247..203785f1dc 100644
--- a/ext/reflection/tests/bug26640.phpt
+++ b/ext/reflection/tests/bug26640.phpt
@@ -4,19 +4,19 @@ Reflection Bug #26640 (__autoload() not invoked by Reflection classes)
<?php
spl_autoload_register(function ($c) {
- class autoload_class
- {
- public function __construct()
- {
- print "autoload success\n";
- }
- }
+ class autoload_class
+ {
+ public function __construct()
+ {
+ print "autoload success\n";
+ }
+ }
});
$a = new ReflectionClass('autoload_class');
if (is_object($a)) {
- echo "OK\n";
+ echo "OK\n";
}
?>
diff --git a/ext/reflection/tests/bug26695.phpt b/ext/reflection/tests/bug26695.phpt
index e429f766e9..ab61ee929f 100644
--- a/ext/reflection/tests/bug26695.phpt
+++ b/ext/reflection/tests/bug26695.phpt
@@ -19,7 +19,5 @@ $class = $params[0]->getClass();
var_dump($class->getName());
?>
-===DONE===
--EXPECT--
string(3) "Foo"
-===DONE===
diff --git a/ext/reflection/tests/bug29268.phpt b/ext/reflection/tests/bug29268.phpt
index 9166bd3aa9..596d3aba1e 100644
--- a/ext/reflection/tests/bug29268.phpt
+++ b/ext/reflection/tests/bug29268.phpt
@@ -3,21 +3,21 @@ Reflection Bug #29268 (__autoload() not called with reflectionProperty->getClass
--FILE--
<?php
spl_autoload_register(function ($classname) {
- echo "__autoload($classname)\n";
- eval("class $classname {}");
+ echo "__autoload($classname)\n";
+ eval("class $classname {}");
});
class B{
- public function doit(A $a){
- }
+ public function doit(A $a){
+ }
}
$ref = new reflectionMethod('B','doit');
$parameters = $ref->getParameters();
foreach($parameters as $parameter)
{
- $class = $parameter->getClass();
- echo $class->name."\n";
+ $class = $parameter->getClass();
+ echo $class->name."\n";
}
echo "ok\n";
?>
diff --git a/ext/reflection/tests/bug29523.phpt b/ext/reflection/tests/bug29523.phpt
index fafc93ef40..a85612935e 100644
--- a/ext/reflection/tests/bug29523.phpt
+++ b/ext/reflection/tests/bug29523.phpt
@@ -16,15 +16,15 @@ $numberOfNotOptionalParameters = 0;
$numberOfOptionalParameters = 0;
foreach($function->getParameters() as $parameter)
{
- var_dump($parameter->isOptional());
- if ($parameter->isOptional())
- {
- ++$numberOfOptionalParameters;
- }
- else
- {
- ++$numberOfNotOptionalParameters;
- }
+ var_dump($parameter->isOptional());
+ if ($parameter->isOptional())
+ {
+ ++$numberOfOptionalParameters;
+ }
+ else
+ {
+ ++$numberOfNotOptionalParameters;
+ }
}
var_dump($function->getNumberOfRequiredParameters());
var_dump($numberOfNotOptionalParameters);
diff --git a/ext/reflection/tests/bug29828.phpt b/ext/reflection/tests/bug29828.phpt
index 43e32d2116..15c1229cc0 100644
--- a/ext/reflection/tests/bug29828.phpt
+++ b/ext/reflection/tests/bug29828.phpt
@@ -5,15 +5,15 @@ Reflection Bug #29828 (Interfaces no longer work)
interface Bla
{
- function bla();
+ function bla();
}
class BlaMore implements Bla
{
- function bla()
- {
- echo "Hello\n";
- }
+ function bla()
+ {
+ echo "Hello\n";
+ }
}
$r = new ReflectionClass('BlaMore');
@@ -26,10 +26,8 @@ $o=new BlaMore;
$o->bla();
?>
-===DONE===
--EXPECT--
int(1)
bool(false)
bool(false)
Hello
-===DONE===
diff --git a/ext/reflection/tests/bug30146.phpt b/ext/reflection/tests/bug30146.phpt
index 3f621414f1..d2e54324a7 100644
--- a/ext/reflection/tests/bug30146.phpt
+++ b/ext/reflection/tests/bug30146.phpt
@@ -15,9 +15,7 @@ var_dump($r->getValue());
$r->setValue(3);
var_dump($r->getValue());
?>
-===DONE===
--EXPECT--
int(1)
int(2)
int(3)
-===DONE===
diff --git a/ext/reflection/tests/bug30148.phpt b/ext/reflection/tests/bug30148.phpt
deleted file mode 100644
index 27c31ca6ae..0000000000
--- a/ext/reflection/tests/bug30148.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Reflection Bug #30148 (ReflectionMethod->isConstructor() fails for inherited classes)
---FILE--
-<?php
-
-class Root
-{
- function Root() {}
-}
-class Base extends Root
-{
- function __construct() {}
-}
-class Derived extends Base
-{
-}
-$a = new ReflectionMethod('Root','Root');
-$b = new ReflectionMethod('Base','Root');
-$c = new ReflectionMethod('Base','__construct');
-$d = new ReflectionMethod('Derived','Root');
-$e = new ReflectionMethod('Derived','__construct');
-var_dump($a->isConstructor());
-var_dump($b->isConstructor());
-var_dump($c->isConstructor());
-var_dump($d->isConstructor());
-var_dump($e->isConstructor());
-?>
-===DONE===
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Root has a deprecated constructor in %s on line %d
-bool(true)
-bool(false)
-bool(true)
-bool(false)
-bool(true)
-===DONE===
diff --git a/ext/reflection/tests/bug30209.phpt b/ext/reflection/tests/bug30209.phpt
index bc1f6c7e86..0dc453e6c0 100644
--- a/ext/reflection/tests/bug30209.phpt
+++ b/ext/reflection/tests/bug30209.phpt
@@ -5,27 +5,25 @@ Reflection Bug #30209 (ReflectionClass::getMethod() lowercases attribute)
class Foo
{
- private $name = 'testBAR';
+ private $name = 'testBAR';
- public function testBAR()
- {
- try
- {
- $class = new ReflectionClass($this);
- var_dump($this->name);
- $method = $class->getMethod($this->name);
- var_dump($this->name);
- }
+ public function testBAR()
+ {
+ try
+ {
+ $class = new ReflectionClass($this);
+ var_dump($this->name);
+ $method = $class->getMethod($this->name);
+ var_dump($this->name);
+ }
- catch (Exception $e) {}
- }
+ catch (Exception $e) {}
+ }
}
$foo = new Foo;
$foo->testBAR();
?>
-===DONE===
--EXPECT--
string(7) "testBAR"
string(7) "testBAR"
-===DONE===
diff --git a/ext/reflection/tests/bug30856.phpt b/ext/reflection/tests/bug30856.phpt
index 39fc1104ab..23d50b17a7 100644
--- a/ext/reflection/tests/bug30856.phpt
+++ b/ext/reflection/tests/bug30856.phpt
@@ -11,10 +11,8 @@ $class = new ReflectionClass('bogus');
var_dump($class->getStaticProperties());
?>
-===DONE===
--EXPECT--
array(1) {
["a"]=>
string(4) "test"
}
-===DONE===
diff --git a/ext/reflection/tests/bug31651.phpt b/ext/reflection/tests/bug31651.phpt
index 59f19eae5d..e356baf148 100644
--- a/ext/reflection/tests/bug31651.phpt
+++ b/ext/reflection/tests/bug31651.phpt
@@ -5,7 +5,7 @@ Reflection Bug #31651 (ReflectionClass::getDefaultProperties segfaults with arra
class Test
{
- public $a = array('a' => 1);
+ public $a = array('a' => 1);
}
$ref = new ReflectionClass('Test');
diff --git a/ext/reflection/tests/bug32981.phpt b/ext/reflection/tests/bug32981.phpt
index 5735674585..fc6960866f 100644
--- a/ext/reflection/tests/bug32981.phpt
+++ b/ext/reflection/tests/bug32981.phpt
@@ -5,23 +5,22 @@ Reflection Bug #32981 (ReflectionMethod::getStaticVariables() causes apache2.0.5
class TestClass
{
- static function test()
- {
- static $enabled = true;
- }
+ static function test()
+ {
+ static $enabled = true;
+ }
}
$class = new ReflectionClass('TestClass');
foreach ($class->getMethods() as $method)
{
- var_dump($method->getName());
- $arr_static_vars[] = $method->getStaticVariables();
+ var_dump($method->getName());
+ $arr_static_vars[] = $method->getStaticVariables();
}
var_dump($arr_static_vars);
?>
-===DONE===
--EXPECT--
string(4) "test"
array(1) {
@@ -31,4 +30,3 @@ array(1) {
bool(true)
}
}
-===DONE===
diff --git a/ext/reflection/tests/bug36434.phpt b/ext/reflection/tests/bug36434.phpt
index 502ac741a9..04cdcbf01d 100644
--- a/ext/reflection/tests/bug36434.phpt
+++ b/ext/reflection/tests/bug36434.phpt
@@ -5,24 +5,24 @@ Reflection Bug #36434 (Properties from parent class fail to indetify their true
class ancester
{
public $ancester = 0;
- function __construct()
- {
- return $this->ancester;
- }
+ function __construct()
+ {
+ return $this->ancester;
+ }
}
class foo extends ancester
{
public $bar = "1";
- function __construct()
- {
- return $this->bar;
- }
+ function __construct()
+ {
+ return $this->bar;
+ }
}
$r = new ReflectionClass('foo');
foreach ($r->GetProperties() as $p)
{
- echo $p->getName(). " ". $p->getDeclaringClass()->getName()."\n";
+ echo $p->getName(). " ". $p->getDeclaringClass()->getName()."\n";
}
?>
diff --git a/ext/reflection/tests/bug37816.phpt b/ext/reflection/tests/bug37816.phpt
index 89ca3238b6..eec6f09411 100644
--- a/ext/reflection/tests/bug37816.phpt
+++ b/ext/reflection/tests/bug37816.phpt
@@ -5,7 +5,7 @@ Bug #37816 (ReflectionProperty does not throw exception when accessing protected
class TestClass
{
- protected $p = 2;
+ protected $p = 2;
}
$o = new TestClass;
@@ -14,15 +14,13 @@ $r = new ReflectionProperty($o, 'p');
try
{
- $x = $r->getValue($o);
+ $x = $r->getValue($o);
}
catch (Exception $e)
{
- echo 'Caught: ' . $e->getMessage() . "\n";
+ echo 'Caught: ' . $e->getMessage() . "\n";
}
?>
-===DONE===
--EXPECT--
Caught: Cannot access non-public member TestClass::$p
-===DONE===
diff --git a/ext/reflection/tests/bug37964.phpt b/ext/reflection/tests/bug37964.phpt
index f3ebe9f72a..59b5f85590 100644
--- a/ext/reflection/tests/bug37964.phpt
+++ b/ext/reflection/tests/bug37964.phpt
@@ -4,19 +4,19 @@ Reflection Bug #37964 (Reflection shows private methods of parent class)
<?php
abstract class foobar {
- private function test2() {
- }
+ private function test2() {
+ }
}
class foo extends foobar {
- private $foo = 1;
- private function test() {
- }
- protected function test3() {
- }
+ private $foo = 1;
+ private function test() {
+ }
+ protected function test3() {
+ }
}
class bar extends foo {
- private function foobar() {
- }
+ private function foobar() {
+ }
}
echo new ReflectionClass(new bar);
diff --git a/ext/reflection/tests/bug38132.phpt b/ext/reflection/tests/bug38132.phpt
index 16e56411f2..e500616604 100644
--- a/ext/reflection/tests/bug38132.phpt
+++ b/ext/reflection/tests/bug38132.phpt
@@ -3,8 +3,8 @@ Reflection Bug #38132 (ReflectionClass::getStaticProperties() retains \0 in key
--FILE--
<?php
class foo {
- static protected $bar = 'baz';
- static public $a = 'a';
+ static protected $bar = 'baz';
+ static public $a = 'a';
}
$class = new ReflectionClass('foo');
diff --git a/ext/reflection/tests/bug38217.phpt b/ext/reflection/tests/bug38217.phpt
index 46f2dc3e0e..cc7525c813 100644
--- a/ext/reflection/tests/bug38217.phpt
+++ b/ext/reflection/tests/bug38217.phpt
@@ -4,24 +4,24 @@ Bug #38217 (ReflectionClass::newInstanceArgs() tries to allocate too much memory
<?php
class ObjectOne {
- public function __construct() {
- }
+ public function __construct() {
+ }
}
$class= new ReflectionClass('ObjectOne');
var_dump($class->newInstanceArgs());
class ObjectTwo {
- public function __construct($var) {
- var_dump($var);
- }
+ public function __construct($var) {
+ var_dump($var);
+ }
}
$class= new ReflectionClass('ObjectTwo');
try {
- var_dump($class->newInstanceArgs());
+ var_dump($class->newInstanceArgs());
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
var_dump($class->newInstanceArgs(array('test')));
diff --git a/ext/reflection/tests/bug38653.phpt b/ext/reflection/tests/bug38653.phpt
index 64b1aad15b..36504e7c7b 100644
--- a/ext/reflection/tests/bug38653.phpt
+++ b/ext/reflection/tests/bug38653.phpt
@@ -4,9 +4,9 @@ Bug #38653 (memory leak in ReflectionClass::getConstant())
<?php
class foo {
- const cons = 10;
- const cons1 = "";
- const cons2 = "test";
+ const cons = 10;
+ const cons1 = "";
+ const cons2 = "test";
}
class bar extends foo {
diff --git a/ext/reflection/tests/bug38942.phpt b/ext/reflection/tests/bug38942.phpt
deleted file mode 100644
index 6dbe396ae6..0000000000
--- a/ext/reflection/tests/bug38942.phpt
+++ /dev/null
@@ -1,35 +0,0 @@
---TEST--
-Bug #38942 (Double old-style-ctor inheritance)
---FILE--
-<?php
-class foo {
- public function foo() {}
-}
-
-class bar extends foo {
-}
-echo new ReflectionClass("bar");
-?>
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; foo has a deprecated constructor in %s on line %d
-Class [ <user> class bar extends foo ] {
- @@ %sbug38942.php 6-7
-
- - Constants [0] {
- }
-
- - Static properties [0] {
- }
-
- - Static methods [0] {
- }
-
- - Properties [0] {
- }
-
- - Methods [1] {
- Method [ <user, inherits foo, ctor> public method foo ] {
- @@ %sbug38942.php 3 - 3
- }
- }
-}
diff --git a/ext/reflection/tests/bug39001.phpt b/ext/reflection/tests/bug39001.phpt
index ec4b7a5d1b..1e390341e7 100644
--- a/ext/reflection/tests/bug39001.phpt
+++ b/ext/reflection/tests/bug39001.phpt
@@ -7,8 +7,8 @@ class Meta {
}
class CParent extends Meta {
- public $publicVar;
- protected $protectedVar;
+ public $publicVar;
+ protected $protectedVar;
}
class Child extends CParent {
diff --git a/ext/reflection/tests/bug39067.phpt b/ext/reflection/tests/bug39067.phpt
index f549f794e0..05ce90be46 100644
--- a/ext/reflection/tests/bug39067.phpt
+++ b/ext/reflection/tests/bug39067.phpt
@@ -4,15 +4,15 @@ Bug #39067 (getDeclaringClass() and private properties)
<?php
class A {
- private $x;
+ private $x;
}
class B extends A {
- private $x;
+ private $x;
}
class C extends B {
- private $x;
+ private $x;
}
$rc = new ReflectionClass('C');
@@ -25,11 +25,11 @@ $rc = new ReflectionClass('A');
var_dump($rc->getProperty('x')->getDeclaringClass()->getName());
class Test {
- private $x;
+ private $x;
}
class Test2 extends Test {
- public $x;
+ public $x;
}
$rc = new ReflectionClass('Test2');
diff --git a/ext/reflection/tests/bug40431.phpt b/ext/reflection/tests/bug40431.phpt
index 637b1457cd..41620a3926 100644
--- a/ext/reflection/tests/bug40431.phpt
+++ b/ext/reflection/tests/bug40431.phpt
@@ -56,7 +56,7 @@ var_dump($props[0]->isProtected());
echo "=== 4th test ===\n";
class test5 {
- private $value = 1;
+ private $value = 1;
}
class test4 extends test5{
diff --git a/ext/reflection/tests/bug40794.phpt b/ext/reflection/tests/bug40794.phpt
index c1830ddcd2..1f1bb61c58 100644
--- a/ext/reflection/tests/bug40794.phpt
+++ b/ext/reflection/tests/bug40794.phpt
@@ -13,7 +13,7 @@ $reflect = new ReflectionObject($obj);
$array = array();
foreach($reflect->getProperties() as $prop)
{
- $array[$prop->getName()] = $prop->getValue($obj);
+ $array[$prop->getName()] = $prop->getValue($obj);
}
var_dump($array);
diff --git a/ext/reflection/tests/bug41061.phpt b/ext/reflection/tests/bug41061.phpt
index 027b872be9..df807566db 100644
--- a/ext/reflection/tests/bug41061.phpt
+++ b/ext/reflection/tests/bug41061.phpt
@@ -14,8 +14,6 @@ class bar {
echo new ReflectionFunction('foo'), "\n";
echo new ReflectionMethod('bar', 'foo'), "\n";
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Function [ <user> function foo ] {
@@ %sbug41061.php 3 - 4
@@ -25,4 +23,3 @@ Method [ <user> private method foo ] {
@@ %sbug41061.php 7 - 8
}
-===DONE===
diff --git a/ext/reflection/tests/bug41884.phpt b/ext/reflection/tests/bug41884.phpt
index 25d2b7cb74..ae9655765e 100644
--- a/ext/reflection/tests/bug41884.phpt
+++ b/ext/reflection/tests/bug41884.phpt
@@ -5,8 +5,8 @@ Bug #41884 (ReflectionClass::getDefaultProperties() does not handle static attri
class Foo
{
- protected static $fooStatic = 'foo';
- protected $foo = 'foo';
+ protected static $fooStatic = 'foo';
+ protected $foo = 'foo';
}
$class = new ReflectionClass('Foo');
diff --git a/ext/reflection/tests/bug42976.phpt b/ext/reflection/tests/bug42976.phpt
index 0b147aa811..d8ab797b92 100644
--- a/ext/reflection/tests/bug42976.phpt
+++ b/ext/reflection/tests/bug42976.phpt
@@ -4,9 +4,9 @@ Bug #42976 (Crash when constructor for newInstance() or newInstanceArgs() fails)
<?php
Class C {
- function __construct(&$x) {
- $x = "x.changed";
- }
+ function __construct(&$x) {
+ $x = "x.changed";
+ }
}
$x = "x.original";
diff --git a/ext/reflection/tests/bug45139.phpt b/ext/reflection/tests/bug45139.phpt
index 6aa84263c6..5a8f62d0cd 100644
--- a/ext/reflection/tests/bug45139.phpt
+++ b/ext/reflection/tests/bug45139.phpt
@@ -4,19 +4,19 @@ Bug #45139 (ReflectionProperty returns incorrect declaring class)
<?php
class A {
- private $foo;
+ private $foo;
}
class B extends A {
- protected $bar;
- private $baz;
- private $quux;
+ protected $bar;
+ private $baz;
+ private $quux;
}
class C extends B {
- public $foo;
- private $baz;
- protected $quux;
+ public $foo;
+ private $baz;
+ protected $quux;
}
$rc = new ReflectionClass('C');
diff --git a/ext/reflection/tests/bug45571.phpt b/ext/reflection/tests/bug45571.phpt
index 74245fc24c..aa482193a7 100644
--- a/ext/reflection/tests/bug45571.phpt
+++ b/ext/reflection/tests/bug45571.phpt
@@ -4,12 +4,12 @@ Bug #45571 (ReflectionClass::__toString() shows superclasses' private static met
<?php
Class A {
- static private $a = 0;
- static protected $b = 1;
- static public $c = 2;
+ static private $a = 0;
+ static protected $b = 1;
+ static public $c = 2;
- private function f() {}
- private static function sf() {}
+ private function f() {}
+ private static function sf() {}
}
Class C extends A { }
diff --git a/ext/reflection/tests/bug45765.phpt b/ext/reflection/tests/bug45765.phpt
index 5c33faca2b..af8dd9b47a 100644
--- a/ext/reflection/tests/bug45765.phpt
+++ b/ext/reflection/tests/bug45765.phpt
@@ -4,23 +4,23 @@ Fixed bug #45765 (ReflectionObject with default parameters of self::xxx cause an
<?php
class foo2 {
- const BAR = 'foobar';
+ const BAR = 'foobar';
}
class foo extends foo2 {
- const BAR = "foo's bar";
+ const BAR = "foo's bar";
- function test($a = self::BAR) {
- }
+ function test($a = self::BAR) {
+ }
- function test2($a = parent::BAR) {
- }
+ function test2($a = parent::BAR) {
+ }
- function test3($a = foo::BAR) {
- }
+ function test3($a = foo::BAR) {
+ }
- function test4($a = foo2::BAR) {
- }
+ function test4($a = foo2::BAR) {
+ }
}
echo new ReflectionObject(new foo);
diff --git a/ext/reflection/tests/bug46064.phpt b/ext/reflection/tests/bug46064.phpt
index d8ee411905..4a97b3b22a 100644
--- a/ext/reflection/tests/bug46064.phpt
+++ b/ext/reflection/tests/bug46064.phpt
@@ -4,7 +4,7 @@ Bug #46064 (Exception when creating ReflectionProperty object on dynamicly creat
<?php
class x {
- public $zzz = 2;
+ public $zzz = 2;
}
$o = new x;
@@ -21,31 +21,30 @@ var_dump($h->getValue($o));
print "---------------------------\n";
try {
- var_dump(new reflectionproperty($o, 'zz'));
+ var_dump(new reflectionproperty($o, 'zz'));
} catch (Exception $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
var_dump(new reflectionproperty($o, 'zzz'));
class test {
- protected $a = 1;
+ protected $a = 1;
}
class bar extends test {
- public function __construct() {
- $this->foobar = 2;
- $this->a = 200;
+ public function __construct() {
+ $this->foobar = 2;
+ $this->a = 200;
- $p = new reflectionproperty($this, 'foobar');
- var_dump($p->getValue($this), $p->isDefault(), $p->isPublic());
- }
+ $p = new reflectionproperty($this, 'foobar');
+ var_dump($p->getValue($this), $p->isDefault(), $p->isPublic());
+ }
}
new bar;
?>
-===DONE===
--EXPECTF--
object(ReflectionProperty)#%d (2) {
["name"]=>
@@ -73,4 +72,3 @@ object(ReflectionProperty)#%d (2) {
int(2)
bool(false)
bool(true)
-===DONE===
diff --git a/ext/reflection/tests/bug46064_2.phpt b/ext/reflection/tests/bug46064_2.phpt
index 65afa836b7..f1aac5b5c0 100644
--- a/ext/reflection/tests/bug46064_2.phpt
+++ b/ext/reflection/tests/bug46064_2.phpt
@@ -15,28 +15,27 @@ var_dump($p->getProperty('test'));
class bar {
- public function __construct() {
- $this->a = 1;
- }
+ public function __construct() {
+ $this->a = 1;
+ }
}
class test extends bar {
- private $b = 2;
+ private $b = 2;
- public function __construct() {
- parent::__construct();
+ public function __construct() {
+ parent::__construct();
- $p = new reflectionobject($this);
- var_dump($h = $p->getProperty('a'));
- var_dump($h->isDefault(), $h->isProtected(), $h->isPrivate(), $h->isPublic(), $h->isStatic());
- var_dump($p->getProperties());
- }
+ $p = new reflectionobject($this);
+ var_dump($h = $p->getProperty('a'));
+ var_dump($h->isDefault(), $h->isProtected(), $h->isPrivate(), $h->isPublic(), $h->isStatic());
+ var_dump($p->getProperties());
+ }
}
new test;
?>
-===DONE===
--EXPECTF--
object(ReflectionProperty)#%d (2) {
["name"]=>
@@ -71,4 +70,3 @@ array(2) {
string(4) "test"
}
}
-===DONE===
diff --git a/ext/reflection/tests/bug46205.phpt b/ext/reflection/tests/bug46205.phpt
index 5ca8ac1cd0..78e381370e 100644
--- a/ext/reflection/tests/bug46205.phpt
+++ b/ext/reflection/tests/bug46205.phpt
@@ -6,7 +6,7 @@ $x = new reflectionmethod('reflectionparameter', 'export');
$y = function() { };
try {
- $x->invokeArgs(new reflectionparameter('trim', 'str'), array($y, 1));
+ $x->invokeArgs(new reflectionparameter('trim', 'str'), array($y, 1));
} catch (Exception $e) { }
?>
ok
diff --git a/ext/reflection/tests/bug47254.phpt b/ext/reflection/tests/bug47254.phpt
index e3ce114c9c..6330d6603f 100644
--- a/ext/reflection/tests/bug47254.phpt
+++ b/ext/reflection/tests/bug47254.phpt
@@ -8,13 +8,13 @@ Testfest 2009 Munich
<?php
class A
{
- protected function a() {}
+ protected function a() {}
}
class B extends A
{
- public function b() {}
+ public function b() {}
}
$B = new B();
@@ -23,10 +23,7 @@ $m = $R->getMethods();
print_r($m);
?>
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in %s on line %d
-
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; B has a deprecated constructor in %s on line %d
+--EXPECT--
Array
(
[0] => ReflectionMethod Object
diff --git a/ext/reflection/tests/bug48757.phpt b/ext/reflection/tests/bug48757.phpt
index a5ced91d3a..45393470d3 100644
--- a/ext/reflection/tests/bug48757.phpt
+++ b/ext/reflection/tests/bug48757.phpt
@@ -3,11 +3,11 @@ Bug #48757 (ReflectionFunction::invoke() parameter issues)
--FILE--
<?php
function test() {
- echo "Hello World\n";
+ echo "Hello World\n";
}
function another_test($parameter) {
- var_dump($parameter);
+ var_dump($parameter);
}
$func = new ReflectionFunction('test');
diff --git a/ext/reflection/tests/bug49074.phpt b/ext/reflection/tests/bug49074.phpt
index 7ce23b41e4..b39814cdf6 100644
--- a/ext/reflection/tests/bug49074.phpt
+++ b/ext/reflection/tests/bug49074.phpt
@@ -3,13 +3,13 @@ Bug #49074 (private class static fields can be modified by using reflection)
--FILE--
<?php
class Test {
- private static $data1 = 1;
- private static $data4 = 4;
+ private static $data1 = 1;
+ private static $data4 = 4;
}
class Test2 extends Test {
- private static $data2 = 2;
- public static $data3 = 3;
+ private static $data2 = 2;
+ public static $data3 = 3;
}
$r = new ReflectionClass('Test2');
diff --git a/ext/reflection/tests/bug49719.phpt b/ext/reflection/tests/bug49719.phpt
index 6211b6b543..37f6ae38af 100644
--- a/ext/reflection/tests/bug49719.phpt
+++ b/ext/reflection/tests/bug49719.phpt
@@ -4,30 +4,30 @@ Bug #49719 (ReflectionClass::hasProperty returns true for a private property in
<?php
class A {
- private $a;
+ private $a;
}
class B extends A {
- private $b;
+ private $b;
}
try {
- $b = new B;
- $ref = new ReflectionClass($b);
+ $b = new B;
+ $ref = new ReflectionClass($b);
- var_dump(property_exists('b', 'a'));
- var_dump(property_exists($b, 'a'));
- var_dump($ref->hasProperty('a'));
- var_dump($ref->getProperty('a'));
+ var_dump(property_exists('b', 'a'));
+ var_dump(property_exists($b, 'a'));
+ var_dump($ref->hasProperty('a'));
+ var_dump($ref->getProperty('a'));
} catch (Exception $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
class A2 {
- private $a = 1;
+ private $a = 1;
}
class B2 extends A2 {
- private $a = 2;
+ private $a = 2;
}
$b2 = new ReflectionClass('B2');
diff --git a/ext/reflection/tests/bug51905.phpt b/ext/reflection/tests/bug51905.phpt
index 8969924e45..2d956386a5 100644
--- a/ext/reflection/tests/bug51905.phpt
+++ b/ext/reflection/tests/bug51905.phpt
@@ -4,12 +4,12 @@ Bug #51905 (ReflectionParameter fails if default value is an array with an acces
<?php
class Bar {
- const Y = 20;
+ const Y = 20;
}
class Foo extends Bar {
- const X = 12;
- public function x($x = 1, $y = array(self::X), $z = parent::Y) {}
+ const X = 12;
+ public function x($x = 1, $y = array(self::X), $z = parent::Y) {}
}
$clazz = new ReflectionClass('Foo');
diff --git a/ext/reflection/tests/bug52854.phpt b/ext/reflection/tests/bug52854.phpt
index 255522de5d..2d174bc11e 100644
--- a/ext/reflection/tests/bug52854.phpt
+++ b/ext/reflection/tests/bug52854.phpt
@@ -11,9 +11,9 @@ var_dump($c->newInstance());
var_dump($c->newInstanceArgs(array()));
try {
- var_dump($c->newInstanceArgs(array(1)));
+ var_dump($c->newInstanceArgs(array(1)));
} catch(ReflectionException $e) {
- echo $e->getMessage()."\n";
+ echo $e->getMessage()."\n";
}
?>
--EXPECTF--
diff --git a/ext/reflection/tests/bug53366.phpt b/ext/reflection/tests/bug53366.phpt
index 5fb119d820..61493d5302 100644
--- a/ext/reflection/tests/bug53366.phpt
+++ b/ext/reflection/tests/bug53366.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #53366 (Reflection doesnt get dynamic property value from getProperty())
+Bug #53366 (Reflection doesn't get dynamic property value from getProperty())
--FILE--
<?php
diff --git a/ext/reflection/tests/bug53915.phpt b/ext/reflection/tests/bug53915.phpt
index f2f2ae5675..f4df7cc839 100644
--- a/ext/reflection/tests/bug53915.phpt
+++ b/ext/reflection/tests/bug53915.phpt
@@ -4,8 +4,8 @@ Bug #53915 - ReflectionClass::getConstant(s) emits fatal error on selfreferencin
<?php
Class Foo
{
- const A = 1;
- const B = self::A;
+ const A = 1;
+ const B = self::A;
}
$rc = new ReflectionClass('Foo');
diff --git a/ext/reflection/tests/bug60367.phpt b/ext/reflection/tests/bug60367.phpt
index 3834445733..afc67ccc47 100644
--- a/ext/reflection/tests/bug60367.phpt
+++ b/ext/reflection/tests/bug60367.phpt
@@ -4,17 +4,17 @@ Bug #60367 (Reflection and Late Static Binding)
<?php
abstract class A {
- const WHAT = 'A';
+ const WHAT = 'A';
- public static function call() {
- echo static::WHAT;
- }
+ public static function call() {
+ echo static::WHAT;
+ }
}
class B extends A {
- const WHAT = 'B';
+ const WHAT = 'B';
}
diff --git a/ext/reflection/tests/bug64239.phpt b/ext/reflection/tests/bug64239.phpt
index 9acdc1987b..100c09d2eb 100644
--- a/ext/reflection/tests/bug64239.phpt
+++ b/ext/reflection/tests/bug64239.phpt
@@ -3,11 +3,11 @@ Bug #64239 (ReflectionClass::getMethods() changed behavior)
--FILE--
<?php
class A {
- use T2 { t2method as Bmethod; }
+ use T2 { t2method as Bmethod; }
}
trait T2 {
- public function t2method() {
- }
+ public function t2method() {
+ }
}
class B extends A{
diff --git a/ext/reflection/tests/bug64936.phpt b/ext/reflection/tests/bug64936.phpt
index c3e781805e..ae63d43008 100644
--- a/ext/reflection/tests/bug64936.phpt
+++ b/ext/reflection/tests/bug64936.phpt
@@ -9,8 +9,8 @@ opcache.save_comments=1
function strip_doc_comment($c)
{
- if (!strlen($c) || $c === false) return $c;
- return trim(substr($c, 3, -2));
+ if (!strlen($c) || $c === false) return $c;
+ return trim(substr($c, 3, -2));
}
token_get_all("<?php\n/**\n * Foo\n */"); // doc_comment compiler global now contains this Foo comment
@@ -28,8 +28,6 @@ $rb = new ReflectionClass('B');
var_dump(strip_doc_comment($rb->getDocComment()));
?>
-===DONE===
--EXPECT--
bool(false)
bool(false)
-===DONE===
diff --git a/ext/reflection/tests/bug66430.phpt b/ext/reflection/tests/bug66430.phpt
index 921e2c99d8..bd3100b47b 100644
--- a/ext/reflection/tests/bug66430.phpt
+++ b/ext/reflection/tests/bug66430.phpt
@@ -4,11 +4,11 @@ Bug #66430: ReflectionFunction::invoke does not invoke closure with object scope
<?php
class Alpha {
- public $message = "Valid representation";
+ public $message = "Valid representation";
- public function bravo() {
- return $this->message;
- }
+ public function bravo() {
+ return $this->message;
+ }
}
$alpha = new Alpha();
diff --git a/ext/reflection/tests/bug70982.phpt b/ext/reflection/tests/bug70982.phpt
index d530846f64..644531e373 100644
--- a/ext/reflection/tests/bug70982.phpt
+++ b/ext/reflection/tests/bug70982.phpt
@@ -3,11 +3,11 @@ Bug #70982 (setStaticPropertyValue behaviors inconsistently with 5.6)
--FILE--
<?php
class Foo {
- static $abc;
- function __construct()
- {
- var_dump(self::$abc);
- }
+ static $abc;
+ function __construct()
+ {
+ var_dump(self::$abc);
+ }
}
class Bar extends Foo {
diff --git a/ext/reflection/tests/bug72661.phpt b/ext/reflection/tests/bug72661.phpt
index 46ba048078..b1cb764beb 100644
--- a/ext/reflection/tests/bug72661.phpt
+++ b/ext/reflection/tests/bug72661.phpt
@@ -6,6 +6,5 @@ function test(iterable $arg) { }
var_dump((string)(new ReflectionParameter("test", 0))->getType());
?>
---EXPECTF--
-Deprecated: Function ReflectionType::__toString() is deprecated in %s on line %d
+--EXPECT--
string(8) "iterable"
diff --git a/ext/reflection/tests/bug74454.inc b/ext/reflection/tests/bug74454.inc
index 5136591367..e668e88643 100644
--- a/ext/reflection/tests/bug74454.inc
+++ b/ext/reflection/tests/bug74454.inc
@@ -1,4 +1,4 @@
<?php
class A {
- if (wrongsyntax)
+ if (wrongsyntax)
}
diff --git a/ext/reflection/tests/bug74454.phpt b/ext/reflection/tests/bug74454.phpt
index 9e0332d893..e311ab3beb 100644
--- a/ext/reflection/tests/bug74454.phpt
+++ b/ext/reflection/tests/bug74454.phpt
@@ -4,16 +4,14 @@ Bug #74454 (Wrong exception being thrown when using ReflectionMethod)
<?php
spl_autoload_register('load_file');
try {
- $x = new ReflectionMethod('A', 'b');
+ $x = new ReflectionMethod('A', 'b');
} catch (\Throwable $e) {
- echo get_class($e), ': ', $e->getMessage(), PHP_EOL;
+ echo get_class($e), ': ', $e->getMessage(), PHP_EOL;
}
function load_file() {
- require __DIR__ . '/bug74454.inc';
+ require __DIR__ . '/bug74454.inc';
}
?>
-===DONE===
--EXPECT--
ParseError: syntax error, unexpected 'if' (T_IF), expecting function (T_FUNCTION) or const (T_CONST)
-===DONE===
diff --git a/ext/reflection/tests/bug74673.phpt b/ext/reflection/tests/bug74673.phpt
index 47f7604e8b..321195c16e 100644
--- a/ext/reflection/tests/bug74673.phpt
+++ b/ext/reflection/tests/bug74673.phpt
@@ -3,15 +3,11 @@ Bug #74673 (Segfault when cast Reflection object to string with undefined consta
--FILE--
<?php
-set_error_handler(function() {
- throw new Exception();
-});
-
class A
{
- public function method($test = PHP_SELF + 1)
- {
- }
+ public function method($test = PHP_SELF + 1)
+ {
+ }
}
$class = new ReflectionClass('A');
@@ -19,9 +15,8 @@ $class = new ReflectionClass('A');
echo $class;
?>
--EXPECTF--
-Fatal error: Uncaught Exception in %s:%d
+Fatal error: Uncaught Error: Undefined constant 'PHP_SELF' in %s:%d
Stack trace:
-#0 [internal function]: {closure}(2, 'Use of undefine...', %s, %d, Array)
-#1 %s(%d): ReflectionClass->__toString()
-#2 {main}
+#0 %s(%d): ReflectionClass->__toString()
+#1 {main}
thrown in %s on line %d
diff --git a/ext/reflection/tests/bug74949.phpt b/ext/reflection/tests/bug74949.phpt
index 2970c5911f..20e0fc00e1 100644
--- a/ext/reflection/tests/bug74949.phpt
+++ b/ext/reflection/tests/bug74949.phpt
@@ -12,9 +12,9 @@ unset($f);
echo $r, "\n";
try {
- echo $r->getPrototype();
+ echo $r->getPrototype();
} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+ echo $e->getMessage(), "\n";
}
?>
--EXPECT--
diff --git a/ext/reflection/tests/bug76536.phpt b/ext/reflection/tests/bug76536.phpt
index 9f3b3fdb31..aa32781e16 100644
--- a/ext/reflection/tests/bug76536.phpt
+++ b/ext/reflection/tests/bug76536.phpt
@@ -2,7 +2,7 @@
Bug #76536 (PHP crashes with core dump when throwing exception in error handler)
--FILE--
<?php
-class SomeConstants {const SOME_CONSTANT = SOME_NONSENSE;}
+class SomeConstants {const SOME_CONSTANT = "foo" % 5; }
function handleError() {throw new ErrorException();}
diff --git a/ext/reflection/tests/bug77882.phpt b/ext/reflection/tests/bug77882.phpt
index ff1d212861..71e430d178 100644
--- a/ext/reflection/tests/bug77882.phpt
+++ b/ext/reflection/tests/bug77882.phpt
@@ -7,7 +7,7 @@ class Test {
public function __construct() {
throw new Exception();
}
-
+
public function __destruct() {
echo "__destruct\n";
}
diff --git a/ext/reflection/tests/bug78774.phpt b/ext/reflection/tests/bug78774.phpt
index 1e419b1138..7f72039e07 100644
--- a/ext/reflection/tests/bug78774.phpt
+++ b/ext/reflection/tests/bug78774.phpt
@@ -5,18 +5,24 @@ Bug #78774: ReflectionNamedType on Typed Properties Crash
class Test {
public stdClass $prop;
+ public stdClass|Foo $prop2;
}
$rc = new ReflectionClass(Test::class);
$rp = $rc->getProperty('prop');
$rt = $rp->getType();
+$rp2 = $rc->getProperty('prop2');
+$rt2 = $rp2->getType();
// Force a resolution of the property type
$test = new Test;
$test->prop = new stdClass;
+$test->prop2 = new stdClass;
var_dump($rt->getName());
+var_dump((string) $rt2);
?>
--EXPECT--
string(8) "stdClass"
+string(12) "stdClass|Foo"
diff --git a/ext/reflection/tests/bug78895.phpt b/ext/reflection/tests/bug78895.phpt
index 7e616c4456..b5f84e2d02 100644
--- a/ext/reflection/tests/bug78895.phpt
+++ b/ext/reflection/tests/bug78895.phpt
@@ -3,18 +3,18 @@ Fixed bug #78895 (Reflection detects abstract non-static class as abstract stati
--FILE--
<?php
abstract class Foo {
- abstract public function f1();
+ abstract public function f1();
}
interface I {
- public function f2();
+ public function f2();
}
trait T {
- abstract public function f2();
+ abstract public function f2();
}
class Bar extends Foo implements I {
- use T;
- function f1() {}
- function f2() {}
+ use T;
+ function f1() {}
+ function f2() {}
}
$ref = new ReflectionClass(Foo::class);
var_dump(Reflection::getModifierNames($ref->getModifiers()));
diff --git a/ext/reflection/tests/closures_001.phpt b/ext/reflection/tests/closures_001.phpt
index 57c1b4e3f6..56581c05b8 100644
--- a/ext/reflection/tests/closures_001.phpt
+++ b/ext/reflection/tests/closures_001.phpt
@@ -11,10 +11,10 @@ var_dump($rm->getNumberOfParameters());
var_dump($rm->getNumberOfRequiredParameters());
$rms = $ro->getMethods();
foreach($rms as $rm) {
- if ($rm->getName() == '__invoke') {
- var_dump($rm->getNumberOfParameters());
- var_dump($rm->getNumberOfRequiredParameters());
- }
+ if ($rm->getName() == '__invoke') {
+ var_dump($rm->getNumberOfParameters());
+ var_dump($rm->getNumberOfRequiredParameters());
+ }
}
echo "---\n";
@@ -47,7 +47,6 @@ $rp = new ReflectionParameter($closure, 'b');
var_dump($rp->isOptional());
?>
-===DONE===
--EXPECT--
int(2)
int(1)
@@ -67,4 +66,3 @@ bool(false)
bool(true)
bool(false)
bool(true)
-===DONE===
diff --git a/ext/reflection/tests/closures_002.phpt b/ext/reflection/tests/closures_002.phpt
index ed973b56c1..9e606857b6 100644
--- a/ext/reflection/tests/closures_002.phpt
+++ b/ext/reflection/tests/closures_002.phpt
@@ -1,10 +1,10 @@
--TEST--
-Reflection on invokable objects
+Reflection on invocable objects
--FILE--
<?php
class Test {
- function __invoke($a, $b = 0) { }
+ function __invoke($a, $b = 0) { }
}
$rm = new ReflectionMethod(new Test, '__invoke');
@@ -19,11 +19,9 @@ $rp = new ReflectionParameter(array(new Test, '__invoke'), 1);
var_dump($rp->isOptional());
?>
-===DONE===
--EXPECT--
string(8) "__invoke"
int(2)
int(1)
bool(false)
bool(true)
-===DONE===
diff --git a/ext/reflection/tests/closures_003.phpt b/ext/reflection/tests/closures_003.phpt
index 57245cacde..e50d9c466f 100644
--- a/ext/reflection/tests/closures_003.phpt
+++ b/ext/reflection/tests/closures_003.phpt
@@ -18,8 +18,6 @@ unset ($parameter);
echo $method->getName ()."\n";
?>
-===DONE===
--EXPECT--
__invoke
__invoke
-===DONE===
diff --git a/ext/reflection/tests/closures_003_v1.phpt b/ext/reflection/tests/closures_003_v1.phpt
index cf853a00fd..1ae5502a39 100644
--- a/ext/reflection/tests/closures_003_v1.phpt
+++ b/ext/reflection/tests/closures_003_v1.phpt
@@ -18,8 +18,6 @@ unset ($parameter);
echo $method->getName ()."\n";
?>
-===DONE===
--EXPECT--
{closure}
{closure}
-===DONE===
diff --git a/ext/reflection/tests/closures_004.phpt b/ext/reflection/tests/closures_004.phpt
index e2b52c5429..479c7c3e67 100644
--- a/ext/reflection/tests/closures_004.phpt
+++ b/ext/reflection/tests/closures_004.phpt
@@ -30,7 +30,6 @@ $closure2 ();
$closure2->__invoke ();
?>
-===DONE===
--EXPECT--
Invoked!
Invoked!
@@ -40,4 +39,3 @@ Invoked!
Invoked!
Invoked!
Invoked!
-===DONE===
diff --git a/ext/reflection/tests/included4.inc b/ext/reflection/tests/included4.inc
index 313fc5feca..7b64eb29cf 100644
--- a/ext/reflection/tests/included4.inc
+++ b/ext/reflection/tests/included4.inc
@@ -3,7 +3,7 @@ echo __FILE__ . "\n";
echo __LINE__ . "\n";
function g() {
- echo __FILE__ . "\n";
- echo __LINE__ . "\n";
+ echo __FILE__ . "\n";
+ echo __LINE__ . "\n";
}
?>
diff --git a/ext/reflection/tests/parameters_001.phpt b/ext/reflection/tests/parameters_001.phpt
index 972b97c1c7..6c57b2c307 100644
--- a/ext/reflection/tests/parameters_001.phpt
+++ b/ext/reflection/tests/parameters_001.phpt
@@ -4,8 +4,8 @@ ReflectionParameter Check for parameter being optional
<?php
class Test {
- function func($x, $y = NULL){
- }
+ function func($x, $y = NULL){
+ }
}
@@ -20,19 +20,17 @@ $p = new ReflectionParameter(array('Test', 'func'), 'y');
var_dump($p->isOptional());
try {
- $p = new ReflectionParameter(array('Test', 'func'), 'z');
- var_dump($p->isOptional());
+ $p = new ReflectionParameter(array('Test', 'func'), 'z');
+ var_dump($p->isOptional());
}
catch (Exception $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
?>
-===DONE===
--EXPECT--
int(2)
int(1)
bool(false)
bool(true)
string(54) "The parameter specified by its name could not be found"
-===DONE===
diff --git a/ext/reflection/tests/parameters_002.phpt b/ext/reflection/tests/parameters_002.phpt
index ae924323a0..14cb7fdefb 100644
--- a/ext/reflection/tests/parameters_002.phpt
+++ b/ext/reflection/tests/parameters_002.phpt
@@ -10,61 +10,61 @@ function test($nix, Array $ar, &$ref, stdClass $std,
class test
{
- function method($nix, Array $ar, &$ref, stdClass $std,
+ function method($nix, Array $ar, &$ref, stdClass $std,
NonExistingClass $na, stdClass $opt = NULL, $def = "FooBar")
- {
- }
+ {
+ }
}
function check_params_decl_func($r, $f)
{
- $c = $r->$f();
+ $c = $r->$f();
$sep = $c instanceof ReflectionMethod ? $c->class . '::' : '';
- echo $f . ': ' . ($c ? $sep . $c->name : 'NULL') . "()\n";
+ echo $f . ': ' . ($c ? $sep . $c->name : 'NULL') . "()\n";
}
function check_params_decl_class($r, $f)
{
- $c = $r->$f();
- echo $f . ': ' . ($c ? $c->name : 'NULL') . "\n";
+ $c = $r->$f();
+ echo $f . ': ' . ($c ? $c->name : 'NULL') . "\n";
}
function check_params_func($r, $f)
{
- echo $f . ': ';
- $v = $r->$f();
- var_dump($v);
+ echo $f . ': ';
+ $v = $r->$f();
+ var_dump($v);
}
function check_params($r)
{
- echo "#####" . ($r instanceof ReflectionMethod ? $r->class . '::' : '') . $r->name . "()#####\n";
- $i = 0;
- foreach($r->getParameters() as $p)
- {
- echo "===" . $i . "===\n";
- $i++;
- check_params_func($p, 'getName');
- check_params_func($p, 'isPassedByReference');
- try
- {
- check_params_decl_class($p, 'getClass');
- }
- catch(ReflectionException $e)
- {
- echo $e->getMessage() . "\n";
- }
- check_params_decl_class($p, 'getDeclaringClass');
+ echo "#####" . ($r instanceof ReflectionMethod ? $r->class . '::' : '') . $r->name . "()#####\n";
+ $i = 0;
+ foreach($r->getParameters() as $p)
+ {
+ echo "===" . $i . "===\n";
+ $i++;
+ check_params_func($p, 'getName');
+ check_params_func($p, 'isPassedByReference');
+ try
+ {
+ check_params_decl_class($p, 'getClass');
+ }
+ catch(ReflectionException $e)
+ {
+ echo $e->getMessage() . "\n";
+ }
+ check_params_decl_class($p, 'getDeclaringClass');
// check_params_decl_func($p, 'getDeclaringFunction');
- check_params_func($p, 'isArray');
- check_params_func($p, 'allowsNull');
- check_params_func($p, 'isOptional');
- check_params_func($p, 'isDefaultValueAvailable');
- if ($p->isOptional())
- {
- check_params_func($p, 'getDefaultValue');
- }
- }
+ check_params_func($p, 'isArray');
+ check_params_func($p, 'allowsNull');
+ check_params_func($p, 'isOptional');
+ check_params_func($p, 'isDefaultValueAvailable');
+ if ($p->isOptional())
+ {
+ check_params_func($p, 'getDefaultValue');
+ }
+ }
}
check_params(new ReflectionFunction('test'));
@@ -72,8 +72,6 @@ check_params(new ReflectionFunction('test'));
check_params(new ReflectionMethod('test::method'));
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
#####test()#####
===0===
@@ -207,4 +205,3 @@ allowsNull: bool(true)
isOptional: bool(true)
isDefaultValueAvailable: bool(true)
getDefaultValue: string(6) "FooBar"
-===DONE===
diff --git a/ext/reflection/tests/property_exists.phpt b/ext/reflection/tests/property_exists.phpt
index d7ecefb775..a740589bab 100644
--- a/ext/reflection/tests/property_exists.phpt
+++ b/ext/reflection/tests/property_exists.phpt
@@ -5,54 +5,54 @@ Reflection and property_exists()
class A
{
- public $a = 1;
- protected $b = 2;
- private $c = 3;
+ public $a = 1;
+ protected $b = 2;
+ private $c = 3;
- public $empty;
- public $init = 1;
+ public $empty;
+ public $init = 1;
- function __toString()
- {
- return 'obj(' . get_class($this) . ')';
- }
+ function __toString()
+ {
+ return 'obj(' . get_class($this) . ')';
+ }
- static function test($oc, $props)
- {
- echo '===' . __CLASS__ . "===\n";
- foreach($props as $p2) {
- echo $oc, '::$' , $p2, "\n";
- var_dump(property_exists($oc, $p2));
- }
- }
+ static function test($oc, $props)
+ {
+ echo '===' . __CLASS__ . "===\n";
+ foreach($props as $p2) {
+ echo $oc, '::$' , $p2, "\n";
+ var_dump(property_exists($oc, $p2));
+ }
+ }
}
class B extends A
{
- private $c = 4;
+ private $c = 4;
- static function test($oc, $props)
- {
- echo '===' . __CLASS__ . "===\n";
- foreach($props as $p2) {
- echo $oc, '::$' , $p2, "\n";
- var_dump(property_exists($oc, $p2));
- }
- }
+ static function test($oc, $props)
+ {
+ echo '===' . __CLASS__ . "===\n";
+ foreach($props as $p2) {
+ echo $oc, '::$' , $p2, "\n";
+ var_dump(property_exists($oc, $p2));
+ }
+ }
}
class C extends B
{
- private $d = 5;
+ private $d = 5;
- static function test($oc, $props)
- {
- echo '===' . __CLASS__ . "===\n";
- foreach($props as $p2) {
- echo $oc, '::$' , $p2, "\n";
- var_dump(property_exists($oc, $p2));
- }
- }
+ static function test($oc, $props)
+ {
+ echo '===' . __CLASS__ . "===\n";
+ foreach($props as $p2) {
+ echo $oc, '::$' , $p2, "\n";
+ var_dump(property_exists($oc, $p2));
+ }
+ }
}
$oA = new A;
@@ -64,17 +64,17 @@ $pc = array($oA, 'A', 'B', 'C', $oC);
$pr = array('a', 'b', 'c', 'd', 'e');
foreach($pc as $p1) {
- if (is_object($p1)) {
- $p1->test($p1, $pr);
- } else {
- $r = new ReflectionMethod($p1, 'test');
- $r->invoke(NULL, $p1, $pr);
- }
- echo "===GLOBAL===\n";
- foreach($pr as $p2) {
- echo $p1, '::$' , $p2, "\n";
- var_dump(property_exists($p1, $p2));
- }
+ if (is_object($p1)) {
+ $p1->test($p1, $pr);
+ } else {
+ $r = new ReflectionMethod($p1, 'test');
+ $r->invoke(NULL, $p1, $pr);
+ }
+ echo "===GLOBAL===\n";
+ foreach($pr as $p2) {
+ echo $p1, '::$' , $p2, "\n";
+ var_dump(property_exists($p1, $p2));
+ }
}
echo "===PROBLEMS===\n";
@@ -90,8 +90,6 @@ var_dump(property_exists(new A, '123'));
var_dump(property_exists(new A, 'init'));
var_dump(property_exists(new A, 'empty'));
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
===A===
obj(A)::$a
@@ -219,4 +217,3 @@ bool(false)
bool(false)
bool(true)
bool(true)
-===DONE===
diff --git a/ext/reflection/tests/request38992.phpt b/ext/reflection/tests/request38992.phpt
index 8c0052fd85..e6eab83415 100644
--- a/ext/reflection/tests/request38992.phpt
+++ b/ext/reflection/tests/request38992.phpt
@@ -11,12 +11,17 @@ class MyClass
}
$r = new ReflectionMethod('MyClass', 'doSomething');
-$r->invoke('WTF?');
-$r->invokeArgs('WTF?', array());
+try {
+ $r->invoke('WTF?');
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $r->invokeArgs('WTF?', array());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
-===DONE===
---EXPECTF--
-Warning: ReflectionMethod::invoke() expects parameter 1 to be object, string given in %s%erequest38992.php on line %d
-
-Warning: ReflectionMethod::invokeArgs() expects parameter 1 to be object, string given in %s%erequest38992.php on line %d
-===DONE===
+--EXPECT--
+ReflectionMethod::invoke() expects parameter 1 to be object, string given
+ReflectionMethod::invokeArgs() expects parameter 1 to be object, string given
diff --git a/ext/reflection/tests/static_properties_002.phpt b/ext/reflection/tests/static_properties_002.phpt
index 0e3baa9530..126aa784a0 100644
--- a/ext/reflection/tests/static_properties_002.phpt
+++ b/ext/reflection/tests/static_properties_002.phpt
@@ -4,29 +4,29 @@ Reflection and inheriting static properties
<?php
class base {
- static protected $prop = 2;
+ static protected $prop = 2;
- static function show() {
- echo __METHOD__ . '(' . self::$prop . ")\n";
- }
+ static function show() {
+ echo __METHOD__ . '(' . self::$prop . ")\n";
+ }
- static function inc() {
- base::$prop++;
- echo __METHOD__ . "()\n";
- }
+ static function inc() {
+ base::$prop++;
+ echo __METHOD__ . "()\n";
+ }
}
class derived extends base {
- static public $prop = 2;
+ static public $prop = 2;
- static function show() {
- echo __METHOD__ . '(' . self::$prop . ")\n";
- }
+ static function show() {
+ echo __METHOD__ . '(' . self::$prop . ")\n";
+ }
- static function inc() {
- derived::$prop++;
- echo __METHOD__ . "()\n";
- }
+ static function inc() {
+ derived::$prop++;
+ echo __METHOD__ . "()\n";
+ }
}
base::show();
diff --git a/ext/reflection/tests/union_types.phpt b/ext/reflection/tests/union_types.phpt
new file mode 100644
index 0000000000..042ba0759d
--- /dev/null
+++ b/ext/reflection/tests/union_types.phpt
@@ -0,0 +1,112 @@
+--TEST--
+Union types in reflection
+--INI--
+error_reporting=E_ALL&~E_DEPRECATED
+--FILE--
+<?php
+
+function dumpType(ReflectionUnionType $rt) {
+ echo "Type $rt:\n";
+ echo "Allows null: " . ($rt->allowsNull() ? "true" : "false") . "\n";
+ foreach ($rt->getTypes() as $type) {
+ echo " Name: " . $type->getName() . "\n";
+ echo " String: " . (string) $type . "\n";
+ echo " Allows Null: " . ($type->allowsNull() ? "true" : "false") . "\n";
+ }
+}
+
+function test1(): X|Y|int|float|false|null { }
+function test2(): X|iterable|bool { }
+
+class Test {
+ public X|Y|int $prop;
+}
+
+dumpType((new ReflectionFunction('test1'))->getReturnType());
+dumpType((new ReflectionFunction('test2'))->getReturnType());
+
+$rc = new ReflectionClass(Test::class);
+$rp = $rc->getProperty('prop');
+dumpType($rp->getType());
+
+/* Force CE resolution of the property type */
+
+class x {}
+$test = new Test;
+$test->prop = new x;
+
+$rp = $rc->getProperty('prop');
+dumpType($rp->getType());
+
+class y {}
+$test->prop = new y;
+
+$rp = $rc->getProperty('prop');
+dumpType($rp->getType());
+
+?>
+--EXPECT--
+Type X|Y|int|float|false|null:
+Allows null: true
+ Name: X
+ String: X
+ Allows Null: false
+ Name: Y
+ String: Y
+ Allows Null: false
+ Name: int
+ String: int
+ Allows Null: false
+ Name: float
+ String: float
+ Allows Null: false
+ Name: false
+ String: false
+ Allows Null: false
+ Name: null
+ String: null
+ Allows Null: true
+Type X|iterable|bool:
+Allows null: false
+ Name: X
+ String: X
+ Allows Null: false
+ Name: iterable
+ String: iterable
+ Allows Null: false
+ Name: bool
+ String: bool
+ Allows Null: false
+Type X|Y|int:
+Allows null: false
+ Name: X
+ String: X
+ Allows Null: false
+ Name: Y
+ String: Y
+ Allows Null: false
+ Name: int
+ String: int
+ Allows Null: false
+Type x|Y|int:
+Allows null: false
+ Name: x
+ String: x
+ Allows Null: false
+ Name: Y
+ String: Y
+ Allows Null: false
+ Name: int
+ String: int
+ Allows Null: false
+Type x|y|int:
+Allows null: false
+ Name: x
+ String: x
+ Allows Null: false
+ Name: y
+ String: y
+ Allows Null: false
+ Name: int
+ String: int
+ Allows Null: false
diff --git a/ext/session/config.m4 b/ext/session/config.m4
index 198c94c739..7abc8813b7 100644
--- a/ext/session/config.m4
+++ b/ext/session/config.m4
@@ -31,9 +31,9 @@ if test "$PHP_MM" != "no"; then
AC_MSG_ERROR(cannot find mm library)
fi
- if test "$enable_maintainer_zts" = "yes"; then
+ if test "$enable_zts" = "yes"; then
dnl The mm library is not thread-safe, and mod_mm.c refuses to compile.
- AC_MSG_ERROR(--with-mm cannot be combined with --enable-maintainer-zts)
+ AC_MSG_ERROR(--with-mm cannot be combined with --enable-zts)
fi
PHP_ADD_LIBRARY_WITH_PATH(mm, $MM_DIR/$PHP_LIBDIR, SESSION_SHARED_LIBADD)
diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c
index cb8138e60a..5d5dcb1ca3 100644
--- a/ext/session/mod_files.c
+++ b/ext/session/mod_files.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -271,9 +269,9 @@ static int ps_files_write(ps_files *data, zend_string *key, zend_string *val)
if (n != ZSTR_LEN(val)) {
if (n == (size_t)-1) {
- php_error_docref(NULL, E_WARNING, "write failed: %s (%d)", strerror(errno), errno);
+ php_error_docref(NULL, E_WARNING, "Write failed: %s (%d)", strerror(errno), errno);
} else {
- php_error_docref(NULL, E_WARNING, "write wrote less bytes than requested");
+ php_error_docref(NULL, E_WARNING, "Write wrote less bytes than requested");
}
return FAILURE;
}
@@ -523,9 +521,9 @@ PS_READ_FUNC(files)
if (n != (zend_long)sbuf.st_size) {
if (n == -1) {
- php_error_docref(NULL, E_WARNING, "read failed: %s (%d)", strerror(errno), errno);
+ php_error_docref(NULL, E_WARNING, "Read failed: %s (%d)", strerror(errno), errno);
} else {
- php_error_docref(NULL, E_WARNING, "read returned less bytes than requested");
+ php_error_docref(NULL, E_WARNING, "Read returned less bytes than requested");
}
zend_string_release_ex(*val, 0);
*val = ZSTR_EMPTY_ALLOC();
diff --git a/ext/session/mod_files.h b/ext/session/mod_files.h
index fc12f6d96e..120a2e8a0a 100644
--- a/ext/session/mod_files.h
+++ b/ext/session/mod_files.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/session/mod_mm.c b/ext/session/mod_mm.c
index 93cfde7633..6698c307e0 100644
--- a/ext/session/mod_mm.c
+++ b/ext/session/mod_mm.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -403,7 +401,7 @@ PS_WRITE_FUNC(mm)
if (!sd->data) {
ps_sd_destroy(data, sd);
- php_error_docref(NULL, E_WARNING, "cannot allocate new data segment");
+ php_error_docref(NULL, E_WARNING, "Cannot allocate new data segment");
sd = NULL;
}
}
diff --git a/ext/session/mod_mm.h b/ext/session/mod_mm.h
index b09b39f62b..125f32a4a6 100644
--- a/ext/session/mod_mm.h
+++ b/ext/session/mod_mm.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/session/mod_user.c b/ext/session/mod_user.c
index b66ac26c81..c3e5c608aa 100644
--- a/ext/session/mod_user.c
+++ b/ext/session/mod_user.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/session/mod_user.h b/ext/session/mod_user.h
index af002c01f9..897d825adc 100644
--- a/ext/session/mod_user.h
+++ b/ext/session/mod_user.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/session/mod_user_class.c b/ext/session/mod_user_class.c
index 5452dd3c7b..1415b407a5 100644
--- a/ext/session/mod_user_class.c
+++ b/ext/session/mod_user_class.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -47,7 +45,7 @@ PHP_METHOD(SessionHandler, open)
PS_SANITY_CHECK;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &save_path, &save_path_len, &session_name, &session_name_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
PS(mod_user_is_open) = 1;
@@ -98,7 +96,7 @@ PHP_METHOD(SessionHandler, read)
PS_SANITY_CHECK_IS_OPEN;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &key) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (PS(default_mod)->s_read(&PS(mod_data), key, &val, PS(gc_maxlifetime)) == FAILURE) {
@@ -118,7 +116,7 @@ PHP_METHOD(SessionHandler, write)
PS_SANITY_CHECK_IS_OPEN;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS", &key, &val) == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_BOOL(SUCCESS == PS(default_mod)->s_write(&PS(mod_data), key, val, PS(gc_maxlifetime)));
@@ -134,7 +132,7 @@ PHP_METHOD(SessionHandler, destroy)
PS_SANITY_CHECK_IS_OPEN;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &key) == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_BOOL(SUCCESS == PS(default_mod)->s_destroy(&PS(mod_data), key));
@@ -151,7 +149,7 @@ PHP_METHOD(SessionHandler, gc)
PS_SANITY_CHECK_IS_OPEN;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &maxlifetime) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (PS(default_mod)->s_gc(&PS(mod_data), maxlifetime, &nrdels) == FAILURE) {
@@ -170,7 +168,7 @@ PHP_METHOD(SessionHandler, create_sid)
PS_SANITY_CHECK;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
id = PS(default_mod)->s_create_sid(&PS(mod_data));
@@ -188,7 +186,7 @@ PHP_METHOD(SessionHandler, validateId)
PS_SANITY_CHECK_IS_OPEN;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &key) == FAILURE) {
- return;
+ RETURN_THROWS();
}
/* Legacy save handler may not support validate_sid API. Return TRUE. */
@@ -205,7 +203,7 @@ PHP_METHOD(SessionHandler, updateTimestamp)
PS_SANITY_CHECK_IS_OPEN;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS", &key, &val) == FAILURE) {
- return;
+ RETURN_THROWS();
}
/* Legacy save handler may not support update_timestamp API. Just write. */
diff --git a/ext/session/php_session.h b/ext/session/php_session.h
index 4c795fdb68..34987992ea 100644
--- a/ext/session/php_session.h
+++ b/ext/session/php_session.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/session/session.c b/ext/session/session.c
index 7c7e4841e4..0470ba1fc6 100644
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -38,6 +36,7 @@
#include "rfc1867.h"
#include "php_variables.h"
#include "php_session.h"
+#include "session_arginfo.h"
#include "ext/standard/php_random.h"
#include "ext/standard/php_var.h"
#include "ext/date/php_date.h"
@@ -1829,7 +1828,7 @@ cleanup:
static PHP_FUNCTION(session_get_cookie_params)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
array_init(return_value);
@@ -1851,7 +1850,7 @@ static PHP_FUNCTION(session_name)
zend_string *ini_name;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|S", &name) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (name && PS(session_status) == php_session_active) {
@@ -1882,7 +1881,7 @@ static PHP_FUNCTION(session_module_name)
zend_string *ini_name;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|S", &name) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (name && PS(session_status) == php_session_active) {
@@ -1946,7 +1945,7 @@ static PHP_FUNCTION(session_set_save_handler)
zend_bool register_shutdown = 1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O|b", &obj, php_session_iface_entry, &register_shutdown) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* For compatibility reason, implemented interface is not checked */
@@ -2048,7 +2047,7 @@ static PHP_FUNCTION(session_set_save_handler)
}
if (zend_parse_parameters(argc, "+", &args, &num_args) == FAILURE) {
- return;
+ RETURN_THROWS();
}
/* remove shutdown function */
@@ -2093,7 +2092,7 @@ static PHP_FUNCTION(session_save_path)
zend_string *ini_name;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|S", &name) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (name && PS(session_status) == php_session_active) {
@@ -2129,7 +2128,7 @@ static PHP_FUNCTION(session_id)
int argc = ZEND_NUM_ARGS();
if (zend_parse_parameters(argc, "|S", &name) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (name && PS(use_cookies) && SG(headers_sent)) {
@@ -2172,7 +2171,7 @@ static PHP_FUNCTION(session_regenerate_id)
zend_string *data;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &del_ses) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (PS(session_status) != php_session_active) {
@@ -2222,14 +2221,14 @@ static PHP_FUNCTION(session_regenerate_id)
if (PS(mod)->s_open(&PS(mod_data), PS(save_path), PS(session_name)) == FAILURE) {
PS(session_status) = php_session_none;
zend_throw_error(NULL, "Failed to open session: %s (path: %s)", PS(mod)->s_name, PS(save_path));
- RETURN_FALSE;
+ RETURN_THROWS();
}
PS(id) = PS(mod)->s_create_sid(&PS(mod_data));
if (!PS(id)) {
PS(session_status) = php_session_none;
zend_throw_error(NULL, "Failed to create new session ID: %s (path: %s)", PS(mod)->s_name, PS(save_path));
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (PS(use_strict_mode) && PS(mod)->s_validate_sid &&
PS(mod)->s_validate_sid(&PS(mod_data), PS(id)) == FAILURE) {
@@ -2239,7 +2238,7 @@ static PHP_FUNCTION(session_regenerate_id)
PS(mod)->s_close(&PS(mod_data));
PS(session_status) = php_session_none;
zend_throw_error(NULL, "Failed to create session ID by collision: %s (path: %s)", PS(mod)->s_name, PS(save_path));
- RETURN_FALSE;
+ RETURN_THROWS();
}
}
/* Read is required to make new session data at this point. */
@@ -2247,7 +2246,7 @@ static PHP_FUNCTION(session_regenerate_id)
PS(mod)->s_close(&PS(mod_data));
PS(session_status) = php_session_none;
zend_throw_error(NULL, "Failed to create(read) session ID: %s (path: %s)", PS(mod)->s_name, PS(save_path));
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (data) {
zend_string_release_ex(data, 0);
@@ -2273,7 +2272,7 @@ static PHP_FUNCTION(session_create_id)
smart_str id = {0};
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|S", &prefix) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (prefix && ZSTR_LEN(prefix)) {
@@ -2327,7 +2326,7 @@ static PHP_FUNCTION(session_cache_limiter)
zend_string *ini_name;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|S", &limiter) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (limiter && PS(session_status) == php_session_active) {
@@ -2354,33 +2353,31 @@ static PHP_FUNCTION(session_cache_limiter)
Return the current cache expire. If new_cache_expire is given, the current cache_expire is replaced with new_cache_expire */
static PHP_FUNCTION(session_cache_expire)
{
- zval *expires = NULL;
- zend_string *ini_name;
+ zend_long expires;
+ zend_bool expires_is_null = 1;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|z", &expires) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l!", &expires, &expires_is_null) == FAILURE) {
+ RETURN_THROWS();
}
- if (expires && PS(session_status) == php_session_active) {
+ if (!expires_is_null && PS(session_status) == php_session_active) {
php_error_docref(NULL, E_WARNING, "Cannot change cache expire when session is active");
RETURN_LONG(PS(cache_expire));
}
- if (expires && SG(headers_sent)) {
+ if (!expires_is_null && SG(headers_sent)) {
php_error_docref(NULL, E_WARNING, "Cannot change cache expire when headers already sent");
RETURN_FALSE;
}
RETVAL_LONG(PS(cache_expire));
- if (expires) {
- if (!try_convert_to_string(expires)) {
- return;
- }
-
- ini_name = zend_string_init("session.cache_expire", sizeof("session.cache_expire") - 1, 0);
- zend_alter_ini_entry(ini_name, Z_STR_P(expires), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
+ if (!expires_is_null) {
+ zend_string *ini_name = zend_string_init("session.cache_expire", sizeof("session.cache_expire") - 1, 0);
+ zend_string *ini_value = zend_long_to_str(expires);
+ zend_alter_ini_entry(ini_name, ini_value, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
zend_string_release_ex(ini_name, 0);
+ zend_string_release_ex(ini_value, 0);
}
}
/* }}} */
@@ -2392,7 +2389,7 @@ static PHP_FUNCTION(session_encode)
zend_string *enc;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
enc = php_session_encode();
@@ -2411,7 +2408,7 @@ static PHP_FUNCTION(session_decode)
zend_string *str = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &str) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (PS(session_status) != php_session_active) {
@@ -2449,7 +2446,7 @@ static PHP_FUNCTION(session_start)
zend_long read_and_close = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|a", &options) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (PS(session_status) == php_session_active) {
@@ -2521,7 +2518,7 @@ static PHP_FUNCTION(session_start)
static PHP_FUNCTION(session_destroy)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_BOOL(php_session_destroy() == SUCCESS);
@@ -2533,7 +2530,7 @@ static PHP_FUNCTION(session_destroy)
static PHP_FUNCTION(session_unset)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (PS(session_status) != php_session_active) {
@@ -2558,7 +2555,7 @@ static PHP_FUNCTION(session_gc)
zend_long num;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (PS(session_status) != php_session_active) {
@@ -2581,7 +2578,7 @@ static PHP_FUNCTION(session_gc)
static PHP_FUNCTION(session_write_close)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (PS(session_status) != php_session_active) {
@@ -2597,7 +2594,7 @@ static PHP_FUNCTION(session_write_close)
static PHP_FUNCTION(session_abort)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (PS(session_status) != php_session_active) {
@@ -2613,7 +2610,7 @@ static PHP_FUNCTION(session_abort)
static PHP_FUNCTION(session_reset)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (PS(session_status) != php_session_active) {
@@ -2629,7 +2626,7 @@ static PHP_FUNCTION(session_reset)
static PHP_FUNCTION(session_status)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_LONG(PS(session_status));
@@ -2642,6 +2639,8 @@ static PHP_FUNCTION(session_register_shutdown)
{
php_shutdown_function_entry shutdown_function_entry;
+ ZEND_PARSE_PARAMETERS_NONE();
+
/* This function is registered itself as a shutdown function by
* session_set_save_handler($obj). The reason we now register another
* shutdown function is in case the user registered their own shutdown
@@ -2670,108 +2669,6 @@ static PHP_FUNCTION(session_register_shutdown)
}
/* }}} */
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_session_name, 0, 0, 0)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_session_module_name, 0, 0, 0)
- ZEND_ARG_INFO(0, module)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_session_save_path, 0, 0, 0)
- ZEND_ARG_INFO(0, path)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_session_id, 0, 0, 0)
- ZEND_ARG_INFO(0, id)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_session_create_id, 0, 0, 0)
- ZEND_ARG_INFO(0, prefix)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_session_regenerate_id, 0, 0, 0)
- ZEND_ARG_INFO(0, delete_old_session)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_session_decode, 0, 0, 1)
- ZEND_ARG_INFO(0, data)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_session_void, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_session_set_save_handler, 0, 0, 1)
- ZEND_ARG_INFO(0, open)
- ZEND_ARG_INFO(0, close)
- ZEND_ARG_INFO(0, read)
- ZEND_ARG_INFO(0, write)
- ZEND_ARG_INFO(0, destroy)
- ZEND_ARG_INFO(0, gc)
- ZEND_ARG_INFO(0, create_sid)
- ZEND_ARG_INFO(0, validate_sid)
- ZEND_ARG_INFO(0, update_timestamp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_session_cache_limiter, 0, 0, 0)
- ZEND_ARG_INFO(0, cache_limiter)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_session_cache_expire, 0, 0, 0)
- ZEND_ARG_INFO(0, new_cache_expire)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_session_set_cookie_params, 0, 0, 1)
- ZEND_ARG_INFO(0, lifetime_or_options)
- ZEND_ARG_INFO(0, path)
- ZEND_ARG_INFO(0, domain)
- ZEND_ARG_INFO(0, secure)
- ZEND_ARG_INFO(0, httponly)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_session_class_open, 0)
- ZEND_ARG_INFO(0, save_path)
- ZEND_ARG_INFO(0, session_name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_session_class_close, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_session_class_read, 0)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_session_class_write, 0)
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, val)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_session_class_destroy, 0)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_session_class_gc, 0)
- ZEND_ARG_INFO(0, maxlifetime)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_session_class_create_sid, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_session_class_validateId, 0)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_session_class_updateTimestamp, 0)
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, val)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_session_start, 0, 0, 0)
- ZEND_ARG_INFO(0, options) /* array */
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ session_functions[]
*/
static const zend_function_entry session_functions[] = {
@@ -2782,22 +2679,22 @@ static const zend_function_entry session_functions[] = {
PHP_FE(session_create_id, arginfo_session_create_id)
PHP_FE(session_regenerate_id, arginfo_session_regenerate_id)
PHP_FE(session_decode, arginfo_session_decode)
- PHP_FE(session_encode, arginfo_session_void)
+ PHP_FE(session_encode, arginfo_session_encode)
PHP_FE(session_start, arginfo_session_start)
- PHP_FE(session_destroy, arginfo_session_void)
- PHP_FE(session_unset, arginfo_session_void)
- PHP_FE(session_gc, arginfo_session_void)
+ PHP_FE(session_destroy, arginfo_session_destroy)
+ PHP_FE(session_unset, arginfo_session_unset)
+ PHP_FE(session_gc, arginfo_session_gc)
PHP_FE(session_set_save_handler, arginfo_session_set_save_handler)
PHP_FE(session_cache_limiter, arginfo_session_cache_limiter)
PHP_FE(session_cache_expire, arginfo_session_cache_expire)
PHP_FE(session_set_cookie_params, arginfo_session_set_cookie_params)
- PHP_FE(session_get_cookie_params, arginfo_session_void)
- PHP_FE(session_write_close, arginfo_session_void)
- PHP_FE(session_abort, arginfo_session_void)
- PHP_FE(session_reset, arginfo_session_void)
- PHP_FE(session_status, arginfo_session_void)
- PHP_FE(session_register_shutdown, arginfo_session_void)
- PHP_FALIAS(session_commit, session_write_close, arginfo_session_void)
+ PHP_FE(session_get_cookie_params, arginfo_session_get_cookie_params)
+ PHP_FE(session_write_close, arginfo_session_write_close)
+ PHP_FE(session_abort, arginfo_session_abort)
+ PHP_FE(session_reset, arginfo_session_reset)
+ PHP_FE(session_status, arginfo_session_status)
+ PHP_FE(session_register_shutdown, arginfo_session_register_shutdown)
+ PHP_FALIAS(session_commit, session_write_close, arginfo_session_commit)
PHP_FE_END
};
/* }}} */
@@ -2805,12 +2702,12 @@ static const zend_function_entry session_functions[] = {
/* {{{ SessionHandlerInterface functions[]
*/
static const zend_function_entry php_session_iface_functions[] = {
- PHP_ABSTRACT_ME(SessionHandlerInterface, open, arginfo_session_class_open)
- PHP_ABSTRACT_ME(SessionHandlerInterface, close, arginfo_session_class_close)
- PHP_ABSTRACT_ME(SessionHandlerInterface, read, arginfo_session_class_read)
- PHP_ABSTRACT_ME(SessionHandlerInterface, write, arginfo_session_class_write)
- PHP_ABSTRACT_ME(SessionHandlerInterface, destroy, arginfo_session_class_destroy)
- PHP_ABSTRACT_ME(SessionHandlerInterface, gc, arginfo_session_class_gc)
+ PHP_ABSTRACT_ME(SessionHandlerInterface, open, arginfo_class_SessionHandlerInterface_open)
+ PHP_ABSTRACT_ME(SessionHandlerInterface, close, arginfo_class_SessionHandlerInterface_close)
+ PHP_ABSTRACT_ME(SessionHandlerInterface, read, arginfo_class_SessionHandlerInterface_read)
+ PHP_ABSTRACT_ME(SessionHandlerInterface, write, arginfo_class_SessionHandlerInterface_write)
+ PHP_ABSTRACT_ME(SessionHandlerInterface, destroy, arginfo_class_SessionHandlerInterface_destroy)
+ PHP_ABSTRACT_ME(SessionHandlerInterface, gc, arginfo_class_SessionHandlerInterface_gc)
PHP_FE_END
};
/* }}} */
@@ -2818,7 +2715,7 @@ static const zend_function_entry php_session_iface_functions[] = {
/* {{{ SessionIdInterface functions[]
*/
static const zend_function_entry php_session_id_iface_functions[] = {
- PHP_ABSTRACT_ME(SessionIdInterface, create_sid, arginfo_session_class_create_sid)
+ PHP_ABSTRACT_ME(SessionIdInterface, create_sid, arginfo_class_SessionIdInterface_create_sid)
PHP_FE_END
};
/* }}} */
@@ -2826,8 +2723,8 @@ static const zend_function_entry php_session_id_iface_functions[] = {
/* {{{ SessionUpdateTimestampHandler functions[]
*/
static const zend_function_entry php_session_update_timestamp_iface_functions[] = {
- PHP_ABSTRACT_ME(SessionUpdateTimestampHandlerInterface, validateId, arginfo_session_class_validateId)
- PHP_ABSTRACT_ME(SessionUpdateTimestampHandlerInterface, updateTimestamp, arginfo_session_class_updateTimestamp)
+ PHP_ABSTRACT_ME(SessionUpdateTimestampHandlerInterface, validateId, arginfo_class_SessionUpdateTimestampHandlerInterface_validateId)
+ PHP_ABSTRACT_ME(SessionUpdateTimestampHandlerInterface, updateTimestamp, arginfo_class_SessionUpdateTimestampHandlerInterface_updateTimestamp)
PHP_FE_END
};
/* }}} */
@@ -2835,13 +2732,13 @@ static const zend_function_entry php_session_update_timestamp_iface_functions[]
/* {{{ SessionHandler functions[]
*/
static const zend_function_entry php_session_class_functions[] = {
- PHP_ME(SessionHandler, open, arginfo_session_class_open, ZEND_ACC_PUBLIC)
- PHP_ME(SessionHandler, close, arginfo_session_class_close, ZEND_ACC_PUBLIC)
- PHP_ME(SessionHandler, read, arginfo_session_class_read, ZEND_ACC_PUBLIC)
- PHP_ME(SessionHandler, write, arginfo_session_class_write, ZEND_ACC_PUBLIC)
- PHP_ME(SessionHandler, destroy, arginfo_session_class_destroy, ZEND_ACC_PUBLIC)
- PHP_ME(SessionHandler, gc, arginfo_session_class_gc, ZEND_ACC_PUBLIC)
- PHP_ME(SessionHandler, create_sid, arginfo_session_class_create_sid, ZEND_ACC_PUBLIC)
+ PHP_ME(SessionHandler, open, arginfo_class_SessionHandlerInterface_open, ZEND_ACC_PUBLIC)
+ PHP_ME(SessionHandler, close, arginfo_class_SessionHandlerInterface_close, ZEND_ACC_PUBLIC)
+ PHP_ME(SessionHandler, read, arginfo_class_SessionHandlerInterface_read, ZEND_ACC_PUBLIC)
+ PHP_ME(SessionHandler, write, arginfo_class_SessionHandlerInterface_write, ZEND_ACC_PUBLIC)
+ PHP_ME(SessionHandler, destroy, arginfo_class_SessionHandlerInterface_destroy, ZEND_ACC_PUBLIC)
+ PHP_ME(SessionHandler, gc, arginfo_class_SessionHandlerInterface_gc, ZEND_ACC_PUBLIC)
+ PHP_ME(SessionHandler, create_sid, arginfo_class_SessionIdInterface_create_sid, ZEND_ACC_PUBLIC)
PHP_FE_END
};
/* }}} */
diff --git a/ext/session/session.stub.php b/ext/session/session.stub.php
new file mode 100644
index 0000000000..e343fc8901
--- /dev/null
+++ b/ext/session/session.stub.php
@@ -0,0 +1,83 @@
+<?php
+
+function session_name(string $name = UNKNOWN): string|false {}
+
+function session_module_name(string $module = UNKNOWN): string|false {}
+
+function session_save_path(string $path = UNKNOWN): string|false {}
+
+function session_id(string $id = UNKNOWN): string|false {}
+
+function session_create_id(string $prefix = ""): string|false {}
+
+function session_regenerate_id(bool $delete_old_session = false): bool {}
+
+function session_decode(string $data): bool {}
+
+function session_encode(): string|false {}
+
+function session_destroy(): bool {}
+
+function session_unset(): bool {}
+
+function session_gc(): int|false {}
+
+function session_get_cookie_params(): array {}
+
+function session_write_close(): bool {}
+
+function session_abort(): bool {}
+
+function session_reset(): bool {}
+
+function session_status(): int {}
+
+function session_register_shutdown(): void {}
+
+function session_commit(): bool {}
+
+function session_set_save_handler($open, $close = null, $read = null, $write = null, $destroy = null, $gc = null, $create_sid = null, $validate_sid = null, $update_timestamp = null): bool {}
+
+function session_cache_limiter(string $cache_limiter = UNKNOWN): string|false {}
+
+function session_cache_expire(?int $new_cache_expire = null): int|false {}
+
+function session_set_cookie_params($lifetime_or_options, string $path = UNKNOWN, string $domain = "", ?bool $secure = null, ?bool $httponly = null): bool {}
+
+function session_start(array $options = []): bool {}
+
+interface SessionHandlerInterface
+{
+ /** @return bool */
+ function open(string $save_path, string $session_name);
+
+ /** @return bool */
+ function close();
+
+ /** @return string */
+ function read(string $key);
+
+ /** @return bool */
+ function write(string $key, string $val);
+
+ /** @return bool */
+ function destroy(string $key);
+
+ /** @return int|bool */
+ function gc(int $maxlifetime);
+}
+
+interface SessionIdInterface
+{
+ /** @return string */
+ function create_sid();
+}
+
+interface SessionUpdateTimestampHandlerInterface
+{
+ /** @return bool */
+ function validateId(string $key);
+
+ /** @return bool */
+ function updateTimestamp(string $key, string $val);
+}
diff --git a/ext/session/session_arginfo.h b/ext/session/session_arginfo.h
new file mode 100644
index 0000000000..60c17c1916
--- /dev/null
+++ b/ext/session/session_arginfo.h
@@ -0,0 +1,118 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_session_name, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_session_module_name, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, module, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_session_save_path, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_session_id, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, id, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_session_create_id, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, prefix, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_session_regenerate_id, 0, 0, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, delete_old_session, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_session_decode, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_session_encode, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_session_destroy, 0, 0, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_session_unset arginfo_session_destroy
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_session_gc, 0, 0, MAY_BE_LONG|MAY_BE_FALSE)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_session_get_cookie_params, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_session_write_close arginfo_session_destroy
+
+#define arginfo_session_abort arginfo_session_destroy
+
+#define arginfo_session_reset arginfo_session_destroy
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_session_status, 0, 0, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_session_register_shutdown, 0, 0, IS_VOID, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_session_commit arginfo_session_destroy
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_session_set_save_handler, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, open)
+ ZEND_ARG_INFO(0, close)
+ ZEND_ARG_INFO(0, read)
+ ZEND_ARG_INFO(0, write)
+ ZEND_ARG_INFO(0, destroy)
+ ZEND_ARG_INFO(0, gc)
+ ZEND_ARG_INFO(0, create_sid)
+ ZEND_ARG_INFO(0, validate_sid)
+ ZEND_ARG_INFO(0, update_timestamp)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_session_cache_limiter, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, cache_limiter, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_session_cache_expire, 0, 0, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, new_cache_expire, IS_LONG, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_session_set_cookie_params, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, lifetime_or_options)
+ ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, domain, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, secure, _IS_BOOL, 1)
+ ZEND_ARG_TYPE_INFO(0, httponly, _IS_BOOL, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_session_start, 0, 0, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SessionHandlerInterface_open, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, save_path, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, session_name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SessionHandlerInterface_close, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SessionHandlerInterface_read, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SessionHandlerInterface_write, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, val, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SessionHandlerInterface_destroy arginfo_class_SessionHandlerInterface_read
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SessionHandlerInterface_gc, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, maxlifetime, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SessionIdInterface_create_sid arginfo_class_SessionHandlerInterface_close
+
+#define arginfo_class_SessionUpdateTimestampHandlerInterface_validateId arginfo_class_SessionHandlerInterface_read
+
+#define arginfo_class_SessionUpdateTimestampHandlerInterface_updateTimestamp arginfo_class_SessionHandlerInterface_write
diff --git a/ext/session/tests/001.phpt b/ext/session/tests/001.phpt
index 0643dce51f..adf63c5f6a 100644
--- a/ext/session/tests/001.phpt
+++ b/ext/session/tests/001.phpt
@@ -12,9 +12,9 @@ session.save_handler=files
error_reporting(E_ALL);
class foo {
- public $bar = "ok";
+ public $bar = "ok";
- function method() { $this->yes = "done"; }
+ function method() { $this->yes = "done"; }
}
$baz = new foo;
diff --git a/ext/session/tests/003.phpt b/ext/session/tests/003.phpt
index eae636593d..a20bc9940d 100644
--- a/ext/session/tests/003.phpt
+++ b/ext/session/tests/003.phpt
@@ -13,8 +13,8 @@ session.save_handler=files
error_reporting(E_ALL);
class foo {
- public $bar = "ok";
- function method() { $this->yes++; }
+ public $bar = "ok";
+ function method() { $this->yes++; }
}
session_id("abtest");
diff --git a/ext/session/tests/004.phpt b/ext/session/tests/004.phpt
index 9e34b7123f..4b81a088b2 100644
--- a/ext/session/tests/004.phpt
+++ b/ext/session/tests/004.phpt
@@ -33,7 +33,7 @@ class handler {
function write($key, $val)
{
print "WRITE: $key, $val\n";
- $GLOBALS["hnd"]->data = $val;
+ $GLOBALS["hnd"]->data = $val;
return true;
}
diff --git a/ext/session/tests/005.phpt b/ext/session/tests/005.phpt
index 4046b3aebc..a7b42de7fa 100644
--- a/ext/session/tests/005.phpt
+++ b/ext/session/tests/005.phpt
@@ -14,7 +14,7 @@ error_reporting(E_ALL);
ob_start();
class handler {
- public $data = 'baz|O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:1;}arr|a:1:{i:3;O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:1;}}';
+ public $data = 'baz|O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:1;}arr|a:1:{i:3;O:3:"foo":2:{s:3:"bar";s:2:"ok";s:3:"yes";i:1;}}';
function open($save_path, $session_name)
{
print "OPEN: $session_name\n";
@@ -22,7 +22,7 @@ class handler {
}
function close()
{
- print "CLOSE\n";
+ print "CLOSE\n";
return true;
}
function read($key)
@@ -34,7 +34,7 @@ class handler {
function write($key, $val)
{
print "WRITE: $key, $val\n";
- $GLOBALS["hnd"]->data = $val;
+ $GLOBALS["hnd"]->data = $val;
return true;
}
diff --git a/ext/session/tests/017.phpt b/ext/session/tests/017.phpt
index baf7df8c57..957fcb2e45 100644
--- a/ext/session/tests/017.phpt
+++ b/ext/session/tests/017.phpt
@@ -13,10 +13,10 @@ session.save_handler=files
error_reporting(E_ALL);
class Kill {
- function __construct() {
- global $HTTP_SESSION_VARS;
- session_start();
- }
+ function __construct() {
+ global $HTTP_SESSION_VARS;
+ session_start();
+ }
}
$k = new Kill();
diff --git a/ext/session/tests/019.phpt b/ext/session/tests/019.phpt
index 5846291769..d9a478245b 100644
--- a/ext/session/tests/019.phpt
+++ b/ext/session/tests/019.phpt
@@ -14,13 +14,13 @@ session.save_handler=files
error_reporting(E_ALL);
class TFoo {
- public $c;
- function __construct($c) {
- $this->c = $c;
- }
- function inc() {
- $this->c++;
- }
+ public $c;
+ function __construct($c) {
+ $this->c = $c;
+ }
+ function inc() {
+ $this->c++;
+ }
}
session_id("abtest");
diff --git a/ext/session/tests/022.phpt b/ext/session/tests/022.phpt
index 5923bbe0bf..e7e26f88b0 100644
--- a/ext/session/tests/022.phpt
+++ b/ext/session/tests/022.phpt
@@ -12,9 +12,9 @@ session.save_handler=files
error_reporting(E_ALL);
class foo {
- public $bar = "ok";
+ public $bar = "ok";
- function method() { $this->yes = "done"; }
+ function method() { $this->yes = "done"; }
}
$baz = new foo;
diff --git a/ext/session/tests/023.phpt b/ext/session/tests/023.phpt
index 592b4a8c3b..828358dc78 100644
--- a/ext/session/tests/023.phpt
+++ b/ext/session/tests/023.phpt
@@ -13,8 +13,8 @@ session.save_handler=files
error_reporting(E_ALL);
class foo {
- public $bar = "ok";
- function method() { $this->yes++; }
+ public $bar = "ok";
+ function method() { $this->yes++; }
}
session_id("abtest");
diff --git a/ext/session/tests/024.phpt b/ext/session/tests/024.phpt
index d417a82ca1..174f2e2639 100644
--- a/ext/session/tests/024.phpt
+++ b/ext/session/tests/024.phpt
@@ -34,7 +34,7 @@ class handler {
function write($key, $val)
{
print "WRITE: $key, $val\n";
- $GLOBALS["hnd"]->data = $val;
+ $GLOBALS["hnd"]->data = $val;
return true;
}
diff --git a/ext/session/tests/025.phpt b/ext/session/tests/025.phpt
index aa1f995c49..172ea579c6 100644
--- a/ext/session/tests/025.phpt
+++ b/ext/session/tests/025.phpt
@@ -23,7 +23,7 @@ class handler {
}
function close()
{
- print "CLOSE\n";
+ print "CLOSE\n";
return true;
}
function read($key)
diff --git a/ext/session/tests/bug31454.phpt b/ext/session/tests/bug31454.phpt
index 24da588aa4..9e99135e5f 100644
--- a/ext/session/tests/bug31454.phpt
+++ b/ext/session/tests/bug31454.phpt
@@ -6,12 +6,12 @@ Bug #31454 (session_set_save_handler crashes PHP when supplied non-existent obje
<?php
session_set_save_handler(
- array(&$arf, 'open'),
- array(&$arf, 'close'),
- array(&$arf, 'read'),
- array(&$arf, 'write'),
- array(&$arf, 'destroy'),
- array(&$arf, 'gc'));
+ array(&$arf, 'open'),
+ array(&$arf, 'close'),
+ array(&$arf, 'read'),
+ array(&$arf, 'write'),
+ array(&$arf, 'destroy'),
+ array(&$arf, 'gc'));
echo "Done\n";
?>
diff --git a/ext/session/tests/bug32330.phpt b/ext/session/tests/bug32330.phpt
index 4d432ef1d4..4240ff7160 100644
--- a/ext/session/tests/bug32330.phpt
+++ b/ext/session/tests/bug32330.phpt
@@ -16,38 +16,38 @@ error_reporting(E_ALL);
function sOpen($path, $name)
{
- echo "open: path = {$path}, name = {$name}\n";
- return TRUE;
+ echo "open: path = {$path}, name = {$name}\n";
+ return TRUE;
}
function sClose()
{
- echo "close\n";
- return TRUE;
+ echo "close\n";
+ return TRUE;
}
function sRead($id)
{
- echo "read: id = {$id}\n";
- return '';
+ echo "read: id = {$id}\n";
+ return '';
}
function sWrite($id, $data)
{
- echo "write: id = {$id}, data = {$data}\n";
- return TRUE;
+ echo "write: id = {$id}, data = {$data}\n";
+ return TRUE;
}
function sDestroy($id)
{
- echo "destroy: id = {$id}\n";
- return TRUE;
+ echo "destroy: id = {$id}\n";
+ return TRUE;
}
function sGC($maxlifetime)
{
- echo "gc: maxlifetime = {$maxlifetime}\n";
- return TRUE;
+ echo "gc: maxlifetime = {$maxlifetime}\n";
+ return TRUE;
}
session_set_save_handler( 'sOpen', 'sClose', 'sRead', 'sWrite', 'sDestroy', 'sGC' );
diff --git a/ext/session/tests/bug60634.phpt b/ext/session/tests/bug60634.phpt
index 064f29a0d2..b303134e5b 100644
--- a/ext/session/tests/bug60634.phpt
+++ b/ext/session/tests/bug60634.phpt
@@ -16,15 +16,15 @@ function open($save_path, $session_name) {
}
function close() {
- die("close: goodbye cruel world\n");
+ die("close: goodbye cruel world\n");
}
function read($id) {
- return '';
+ return '';
}
function write($id, $session_data) {
- die("write: goodbye cruel world\n");
+ die("write: goodbye cruel world\n");
}
function destroy($id) {
diff --git a/ext/session/tests/bug60634_error_1.phpt b/ext/session/tests/bug60634_error_1.phpt
index c573b65e36..9a1d2288a3 100644
--- a/ext/session/tests/bug60634_error_1.phpt
+++ b/ext/session/tests/bug60634_error_1.phpt
@@ -16,17 +16,17 @@ function open($save_path, $session_name) {
}
function close() {
- echo "close: goodbye cruel world\n";
- return true;
+ echo "close: goodbye cruel world\n";
+ return true;
}
function read($id) {
- return '';
+ return '';
}
function write($id, $session_data) {
- echo "write: goodbye cruel world\n";
- undefined_function();
+ echo "write: goodbye cruel world\n";
+ undefined_function();
}
function destroy($id) {
diff --git a/ext/session/tests/bug60634_error_2.phpt b/ext/session/tests/bug60634_error_2.phpt
index 4ca598b4e7..ef06095692 100644
--- a/ext/session/tests/bug60634_error_2.phpt
+++ b/ext/session/tests/bug60634_error_2.phpt
@@ -16,17 +16,17 @@ function open($save_path, $session_name) {
}
function close() {
- echo "close: goodbye cruel world\n";
- return true;
+ echo "close: goodbye cruel world\n";
+ return true;
}
function read($id) {
- return '';
+ return '';
}
function write($id, $session_data) {
- echo "write: goodbye cruel world\n";
- throw new Exception;
+ echo "write: goodbye cruel world\n";
+ throw new Exception;
}
function destroy($id) {
diff --git a/ext/session/tests/bug60634_error_3.phpt b/ext/session/tests/bug60634_error_3.phpt
index f97da00dce..1909fc8ada 100644
--- a/ext/session/tests/bug60634_error_3.phpt
+++ b/ext/session/tests/bug60634_error_3.phpt
@@ -16,17 +16,17 @@ function open($save_path, $session_name) {
}
function close() {
- echo "close: goodbye cruel world\n";
- exit;
+ echo "close: goodbye cruel world\n";
+ exit;
}
function read($id) {
- return '';
+ return '';
}
function write($id, $session_data) {
- echo "write: goodbye cruel world\n";
- undefined_function();
+ echo "write: goodbye cruel world\n";
+ undefined_function();
}
function destroy($id) {
diff --git a/ext/session/tests/bug60634_error_4.phpt b/ext/session/tests/bug60634_error_4.phpt
index ca8672e4f4..e3834f262c 100644
--- a/ext/session/tests/bug60634_error_4.phpt
+++ b/ext/session/tests/bug60634_error_4.phpt
@@ -16,17 +16,17 @@ function open($save_path, $session_name) {
}
function close() {
- echo "close: goodbye cruel world\n";
- exit;
+ echo "close: goodbye cruel world\n";
+ exit;
}
function read($id) {
- return '';
+ return '';
}
function write($id, $session_data) {
- echo "write: goodbye cruel world\n";
- throw new Exception;
+ echo "write: goodbye cruel world\n";
+ throw new Exception;
}
function destroy($id) {
diff --git a/ext/session/tests/bug60634_error_5.phpt b/ext/session/tests/bug60634_error_5.phpt
index 5728d3a90c..333c86c67f 100644
--- a/ext/session/tests/bug60634_error_5.phpt
+++ b/ext/session/tests/bug60634_error_5.phpt
@@ -16,16 +16,16 @@ function open($save_path, $session_name) {
}
function close() {
- echo "close: goodbye cruel world\n";
- undefined_function();
+ echo "close: goodbye cruel world\n";
+ undefined_function();
}
function read($id) {
- return '';
+ return '';
}
function write($id, $session_data) {
- return true;
+ return true;
}
function destroy($id) {
diff --git a/ext/session/tests/bug71162.phpt b/ext/session/tests/bug71162.phpt
index 31d3370499..b475ae6080 100644
--- a/ext/session/tests/bug71162.phpt
+++ b/ext/session/tests/bug71162.phpt
@@ -36,13 +36,13 @@ class MySessionHandler extends SessionHandler implements SessionUpdateTimestampH
return TRUE;
}
- public function create_sid() {
- return sha1(random_bytes(32));
- }
+ public function create_sid() {
+ return sha1(random_bytes(32));
+ }
- public function validateId($sid) {
- return TRUE;
- }
+ public function validateId($sid) {
+ return TRUE;
+ }
public function updateTimestamp($sessid, $sessdata) {
echo __FUNCTION__, PHP_EOL;
diff --git a/ext/session/tests/bug71972.phpt b/ext/session/tests/bug71972.phpt
index e4c5c6b6d3..1384cae21e 100644
--- a/ext/session/tests/bug71972.phpt
+++ b/ext/session/tests/bug71972.phpt
@@ -13,13 +13,13 @@ $_SESSION['boogie'] = 1;
$_SESSION['obj1'] = new stdClass();
for ( $x=2; $x < 20; $x++) {
- cyclic_ref($x);
+ cyclic_ref($x);
}
function cyclic_ref($num) {
- $_SESSION['obj'.$num] = new stdClass();
- $_SESSION['obj'.$num]->test = new stdClass();//NOTE: No bug if try commenting out this too.
- $_SESSION['obj'.$num]->obj1 = $_SESSION['obj1'];
+ $_SESSION['obj'.$num] = new stdClass();
+ $_SESSION['obj'.$num]->test = new stdClass();//NOTE: No bug if try commenting out this too.
+ $_SESSION['obj'.$num]->obj1 = $_SESSION['obj1'];
}
var_dump(session_decode(session_encode()) == $_SESSION);
diff --git a/ext/session/tests/bug72562.phpt b/ext/session/tests/bug72562.phpt
index b36cf6df25..8421e8940a 100644
--- a/ext/session/tests/bug72562.phpt
+++ b/ext/session/tests/bug72562.phpt
@@ -27,12 +27,12 @@ var_dump($out_2);
function ptr2str($ptr)
{
- $out = '';
- for ($i = 0; $i < 8; $i++) {
- $out .= chr($ptr & 0xff);
- $ptr >>= 8;
- }
- return $out;
+ $out = '';
+ for ($i = 0; $i < 8; $i++) {
+ $out .= chr($ptr & 0xff);
+ $ptr >>= 8;
+ }
+ return $out;
}
?>
--EXPECTF--
diff --git a/ext/session/tests/bug74514.phpt b/ext/session/tests/bug74514.phpt
index f7c8d46998..5ff86c1bfb 100644
--- a/ext/session/tests/bug74514.phpt
+++ b/ext/session/tests/bug74514.phpt
@@ -23,7 +23,6 @@ var_dump(session_save_path());
var_dump(session_cache_limiter());
var_dump(session_cache_expire());
?>
-===DONE===
--EXPECT--
string(9) "PHPSESSID"
string(3) "foo"
@@ -31,4 +30,3 @@ string(5) "files"
string(0) ""
string(7) "nocache"
int(180)
-===DONE===
diff --git a/ext/session/tests/bug74541.phpt b/ext/session/tests/bug74541.phpt
index dec2f25b5d..ccdfdbffde 100644
--- a/ext/session/tests/bug74541.phpt
+++ b/ext/session/tests/bug74541.phpt
@@ -10,8 +10,6 @@ $r = new ReflectionFunction('session_start');
var_dump($r->getNumberOfParameters());
var_dump($r->getNumberOfRequiredParameters());
?>
-===DONE===
--EXPECT--
int(1)
int(0)
-===DONE===
diff --git a/ext/session/tests/bug74833.phpt b/ext/session/tests/bug74833.phpt
index fa167a1f3a..d299f4ee96 100644
--- a/ext/session/tests/bug74833.phpt
+++ b/ext/session/tests/bug74833.phpt
@@ -15,7 +15,5 @@ var_dump(isset($c['session']['SID']));
ob_end_flush();
?>
-==DONE==
--EXPECT--
bool(true)
-==DONE==
diff --git a/ext/session/tests/bug74892.phpt b/ext/session/tests/bug74892.phpt
index 0947df7761..3b11ec20a7 100644
--- a/ext/session/tests/bug74892.phpt
+++ b/ext/session/tests/bug74892.phpt
@@ -16,10 +16,8 @@ session_start();
<p><a href="index.php#place">External link with anchor</a></p>
<p><a href="http://php.net#foo">External link with anchor 2</a></p>
<p><a href="#place">Internal link</a></p>
-===DONE===
--EXPECT--
<p><a href="index.php?PHPSESSID=sessionidhere">Click This Anchor Tag!</a></p>
<p><a href="index.php?PHPSESSID=sessionidhere#place">External link with anchor</a></p>
<p><a href="http://php.net?PHPSESSID=sessionidhere#foo">External link with anchor 2</a></p>
<p><a href="#place">Internal link</a></p>
-===DONE===
diff --git a/ext/session/tests/bug74936.phpt b/ext/session/tests/bug74936.phpt
index aee7493c6c..7b502c85b5 100644
--- a/ext/session/tests/bug74936.phpt
+++ b/ext/session/tests/bug74936.phpt
@@ -12,9 +12,7 @@ var_dump(session_cache_expire());
var_dump(session_cache_limiter());
var_dump(session_save_path());
?>
-===DONE===
--EXPECT--
int(180)
string(7) "nocache"
string(0) ""
-===DONE===
diff --git a/ext/session/tests/bug74941.phpt b/ext/session/tests/bug74941.phpt
index 953d642b10..59b57e1b4d 100644
--- a/ext/session/tests/bug74941.phpt
+++ b/ext/session/tests/bug74941.phpt
@@ -15,8 +15,6 @@ echo ".\n";
session_id('BUG74941');
var_dump(session_start());
?>
-===DONE===
--EXPECT--
.
bool(true)
-===DONE===
diff --git a/ext/session/tests/save_handler_closures.inc b/ext/session/tests/save_handler_closures.inc
index 50f33c1098..acf72f00f6 100644
--- a/ext/session/tests/save_handler_closures.inc
+++ b/ext/session/tests/save_handler_closures.inc
@@ -3,7 +3,7 @@
require_once 'save_handler.inc';
foreach (array ('open', 'close', 'read', 'write', 'destroy', 'gc') as $fn) {
- ${$fn.'_closure'} = function () use ($fn) { return call_user_func_array ($fn, func_get_args ()); };
+ ${$fn.'_closure'} = function () use ($fn) { return call_user_func_array ($fn, func_get_args ()); };
}
?>
diff --git a/ext/session/tests/session_cache_expire_error.phpt b/ext/session/tests/session_cache_expire_error.phpt
deleted file mode 100644
index 5ae5d95637..0000000000
--- a/ext/session/tests/session_cache_expire_error.phpt
+++ /dev/null
@@ -1,169 +0,0 @@
---TEST--
-Test session_cache_expire() function : error functionality
---SKIPIF--
-<?php include('skipif.inc'); ?>
---FILE--
-<?php
-
-ob_start();
-
-/*
- * Prototype : int session_cache_expire([int $new_cache_expire])
- * Description : Return current cache expire
- * Source code : ext/session/session.c
- */
-
-echo "*** Testing session_cache_expire() : error functionality ***\n";
-
-// Get an unset variable
-$unset_var = 10;
-unset($unset_var);
-
-class classA
-{
- public function __toString() {
- return "Hello World!";
- }
-}
-
-$heredoc = <<<EOT
-Hello World!
-EOT;
-
-$fp = fopen(__FILE__, "r");
-
-// Unexpected values to be passed as arguments
-$inputs = array(
-
- // Integer data
-/*1*/ 0,
- 1,
- 12345,
- -2345,
-
- // Float data
-/*5*/ 10.5,
- -10.5,
- 12.3456789000e10,
- 12.3456789000E-10,
- .5,
-
- // Null data
-/*10*/ NULL,
- null,
-
- // Boolean data
-/*12*/ true,
- false,
- TRUE,
- FALSE,
-
- // Empty strings
-/*16*/ "",
- '',
-
- // Invalid string data
-/*18*/ "Nothing",
- 'Nothing',
- $heredoc,
-
- // Object data
-/*21*/ new classA(),
-
- // Undefined data
-/*22*/ @$undefined_var,
-
- // Unset data
-/*23*/ @$unset_var,
-
- // Resource variable
-/*24*/ $fp
-);
-
-
-$iterator = 1;
-foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump(session_cache_expire($input));
- $iterator++;
-};
-
-fclose($fp);
-echo "Done";
-ob_end_flush();
-?>
---EXPECTF--
-*** Testing session_cache_expire() : error functionality ***
-
--- Iteration 1 --
-int(180)
-
--- Iteration 2 --
-int(0)
-
--- Iteration 3 --
-int(1)
-
--- Iteration 4 --
-int(12345)
-
--- Iteration 5 --
-int(-2345)
-
--- Iteration 6 --
-int(10)
-
--- Iteration 7 --
-int(-10)
-
--- Iteration 8 --
-int(%s)
-
--- Iteration 9 --
-int(1)
-
--- Iteration 10 --
-int(0)
-
--- Iteration 11 --
-int(0)
-
--- Iteration 12 --
-int(0)
-
--- Iteration 13 --
-int(1)
-
--- Iteration 14 --
-int(0)
-
--- Iteration 15 --
-int(1)
-
--- Iteration 16 --
-int(0)
-
--- Iteration 17 --
-int(0)
-
--- Iteration 18 --
-int(0)
-
--- Iteration 19 --
-int(0)
-
--- Iteration 20 --
-int(0)
-
--- Iteration 21 --
-int(0)
-
--- Iteration 22 --
-int(0)
-
--- Iteration 23 --
-int(0)
-
--- Iteration 24 --
-int(0)
-Done
diff --git a/ext/session/tests/session_cache_limiter_error.phpt b/ext/session/tests/session_cache_limiter_error.phpt
index 42b2cb0694..284649e277 100644
--- a/ext/session/tests/session_cache_limiter_error.phpt
+++ b/ext/session/tests/session_cache_limiter_error.phpt
@@ -75,9 +75,6 @@ $inputs = array(
// Unset data
/*23*/ @$unset_var,
-
- // Resource variable
-/*24*/ $fp
);
@@ -163,9 +160,4 @@ string(12) "Hello World!"
-- Iteration 23 --
string(0) ""
-
--- Iteration 24 --
-
-Warning: session_cache_limiter() expects parameter 1 to be string, resource given in %s on line %d
-NULL
Done
diff --git a/ext/session/tests/session_decode_error2.phpt b/ext/session/tests/session_decode_error2.phpt
index ff4e618a5e..20415c7a63 100644
--- a/ext/session/tests/session_decode_error2.phpt
+++ b/ext/session/tests/session_decode_error2.phpt
@@ -18,7 +18,7 @@ $data = "foo|a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}guff|R:1;blah|R:1;";
var_dump(session_start());
for($index = 0; $index < strlen($data); $index++) {
- if(session_status() != PHP_SESSION_ACTIVE) { session_start(); }
+ if(session_status() != PHP_SESSION_ACTIVE) { session_start(); }
echo "\n-- Iteration $index --\n";
$encoded = substr($data, 0, $index);
var_dump(session_decode($encoded));
diff --git a/ext/session/tests/session_decode_variation3.phpt b/ext/session/tests/session_decode_variation3.phpt
index a50feb0cf0..b926de323e 100644
--- a/ext/session/tests/session_decode_variation3.phpt
+++ b/ext/session/tests/session_decode_variation3.phpt
@@ -37,7 +37,7 @@ ob_end_flush();
Warning: session_start(): Cannot find serialization handler 'blah' - session startup failed in %s on line %d
bool(false)
-Notice: Undefined variable: _SESSION in %s on line %d
+Warning: Undefined variable: _SESSION in %s on line %d
NULL
array(3) {
["foo"]=>
diff --git a/ext/session/tests/session_encode_error2.phpt b/ext/session/tests/session_encode_error2.phpt
index 1a87eb14a3..a947eab54e 100644
--- a/ext/session/tests/session_encode_error2.phpt
+++ b/ext/session/tests/session_encode_error2.phpt
@@ -84,7 +84,11 @@ $iterator = 1;
foreach($inputs as $input) {
echo "\n-- Iteration $iterator --\n";
var_dump(session_start());
- $_SESSION[$input] = "Hello World!";
+ try {
+ $_SESSION[$input] = "Hello World!";
+ } catch (Error $e) {
+ echo $e->getMessage(), "\n";
+ }
var_dump(session_encode());
var_dump(session_destroy());
$iterator++;
@@ -225,8 +229,7 @@ bool(true)
-- Iteration 21 --
bool(true)
-
-Warning: Illegal offset type in %s on line 82
+Illegal offset type
bool(false)
bool(true)
@@ -243,7 +246,7 @@ bool(true)
-- Iteration 24 --
bool(true)
-Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
+Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
Notice: session_encode(): Skipping numeric key %d in %s on line %d
bool(false)
diff --git a/ext/session/tests/session_regenerate_id_cookie.phpt b/ext/session/tests/session_regenerate_id_cookie.phpt
index c3c5464860..76667cdbcc 100644
--- a/ext/session/tests/session_regenerate_id_cookie.phpt
+++ b/ext/session/tests/session_regenerate_id_cookie.phpt
@@ -32,16 +32,16 @@ file_put_contents($file, '<?php
ob_start();
function find_cookie_header() {
- $headers = headers_list();
- $target = "Set-Cookie: PHPSESSID=";
- foreach ($headers as $h) {
- if (strstr($h, $target) !== FALSE) {
- echo $h."\n";
- return TRUE;
- }
- }
- var_dump($headers);
- return FALSE;
+ $headers = headers_list();
+ $target = "Set-Cookie: PHPSESSID=";
+ foreach ($headers as $h) {
+ if (strstr($h, $target) !== FALSE) {
+ echo $h."\n";
+ return TRUE;
+ }
+ }
+ var_dump($headers);
+ return FALSE;
}
var_dump(session_start());
@@ -64,7 +64,7 @@ echo "Done";
?>
--EXPECTF--
*** Testing session_regenerate_id() : basic functionality for cookie ***
-string(%d) "X-Powered-By: PHP/7.%s
+string(%d) "X-Powered-By: PHP/%d.%d.%s
Expires: %s
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
diff --git a/ext/session/tests/session_save_path_variation4.phpt b/ext/session/tests/session_save_path_variation4.phpt
index 1cb86e1c30..a95b990dbc 100644
--- a/ext/session/tests/session_save_path_variation4.phpt
+++ b/ext/session/tests/session_save_path_variation4.phpt
@@ -26,7 +26,7 @@ chdir($initdir);
// Delete the existing directory
if (file_exists($sessions) === TRUE) {
- @rmdir($sessions);
+ @rmdir($sessions);
}
var_dump(mkdir($sessions));
diff --git a/ext/session/tests/session_save_path_variation5.phpt b/ext/session/tests/session_save_path_variation5.phpt
index 557634c903..b97badf7f6 100644
--- a/ext/session/tests/session_save_path_variation5.phpt
+++ b/ext/session/tests/session_save_path_variation5.phpt
@@ -27,7 +27,7 @@ chdir($directory);
ini_set('open_basedir', '.');
// Delete the existing directory
if (file_exists($sessions) === TRUE) {
- @rmdir($sessions);
+ @rmdir($sessions);
}
var_dump(mkdir($sessions));
diff --git a/ext/session/tests/session_set_save_handler_class_001.phpt b/ext/session/tests/session_set_save_handler_class_001.phpt
index ea8fc81d74..33d2a76425 100644
--- a/ext/session/tests/session_set_save_handler_class_001.phpt
+++ b/ext/session/tests/session_set_save_handler_class_001.phpt
@@ -20,57 +20,57 @@ ob_start();
echo "*** Testing session_set_save_handler() : basic class wrapping existing handler ***\n";
class MySession extends SessionHandler {
- public $i = 0;
- public function open($path, $name) {
- ++$this->i;
- echo 'Open ', session_id(), "\n";
- return parent::open($path, $name);
- }
- public function create_sid() {
- // This method should be removed when 5.5 become unsupported.
- ++$this->i;
- echo 'Old Create SID ', session_id(), "\n";
- return parent::create_sid();
- }
- public function read($key) {
- ++$this->i;
- echo 'Read ', session_id(), "\n";
- return parent::read($key);
- }
- public function write($key, $data) {
- ++$this->i;
- echo 'Write ', session_id(), "\n";
- return parent::write($key, $data);
- }
- public function close() {
- ++$this->i;
- echo 'Close ', session_id(), "\n";
- return parent::close();
- }
- public function createSid() {
- // User should use this rather than create_sid()
- // If both create_sid() and createSid() exists,
- // createSid() is used.
- ++$this->i;
- echo 'New Create ID ', session_id(), "\n";
- return parent::create_sid();
- }
- public function validateId($key) {
- ++$this->i;
- echo 'Validate ID ', session_id(), "\n";
- return TRUE;
- // User must implement their own method and
- // cannot call parent as follows.
- // return parent::validateSid($key);
- }
- public function updateTimestamp($key, $data) {
- ++$this->i;
- echo 'Update Timestamp ', session_id(), "\n";
- return parent::write($key, $data);
- // User must implement their own method and
- // cannot call parent as follows
- // return parent::updateTimestamp($key, $data);
- }
+ public $i = 0;
+ public function open($path, $name) {
+ ++$this->i;
+ echo 'Open ', session_id(), "\n";
+ return parent::open($path, $name);
+ }
+ public function create_sid() {
+ // This method should be removed when 5.5 become unsupported.
+ ++$this->i;
+ echo 'Old Create SID ', session_id(), "\n";
+ return parent::create_sid();
+ }
+ public function read($key) {
+ ++$this->i;
+ echo 'Read ', session_id(), "\n";
+ return parent::read($key);
+ }
+ public function write($key, $data) {
+ ++$this->i;
+ echo 'Write ', session_id(), "\n";
+ return parent::write($key, $data);
+ }
+ public function close() {
+ ++$this->i;
+ echo 'Close ', session_id(), "\n";
+ return parent::close();
+ }
+ public function createSid() {
+ // User should use this rather than create_sid()
+ // If both create_sid() and createSid() exists,
+ // createSid() is used.
+ ++$this->i;
+ echo 'New Create ID ', session_id(), "\n";
+ return parent::create_sid();
+ }
+ public function validateId($key) {
+ ++$this->i;
+ echo 'Validate ID ', session_id(), "\n";
+ return TRUE;
+ // User must implement their own method and
+ // cannot call parent as follows.
+ // return parent::validateSid($key);
+ }
+ public function updateTimestamp($key, $data) {
+ ++$this->i;
+ echo 'Update Timestamp ', session_id(), "\n";
+ return parent::write($key, $data);
+ // User must implement their own method and
+ // cannot call parent as follows
+ // return parent::updateTimestamp($key, $data);
+ }
}
$oldHandler = ini_get('session.save_handler');
diff --git a/ext/session/tests/session_set_save_handler_class_002.phpt b/ext/session/tests/session_set_save_handler_class_002.phpt
index 29b1d270c6..6343cfdc0e 100644
--- a/ext/session/tests/session_set_save_handler_class_002.phpt
+++ b/ext/session/tests/session_set_save_handler_class_002.phpt
@@ -19,46 +19,46 @@ ob_start();
echo "*** Testing session_set_save_handler() : full handler implementation ***\n";
class MySession2 extends SessionHandler {
- public $path;
-
- public function open($path, $name) {
- if (!$path) {
- $path = sys_get_temp_dir();
- }
- $this->path = $path . '/u_sess_' . $name;
- return true;
- }
-
- public function close() {
- return true;
- }
-
- public function read($id) {
- return (string)@file_get_contents($this->path . $id);
- }
-
- public function write($id, $data) {
- return (bool)file_put_contents($this->path . $id, $data);
- }
-
- public function destroy($id) {
- @unlink($this->path . $id);
- return true;
- }
-
- public function gc($maxlifetime) {
- foreach (glob($this->path . '*') as $filename) {
- if (filemtime($filename) + $maxlifetime < time()) {
- @unlink($filename);
- }
- }
- return true;
- }
+ public $path;
+
+ public function open($path, $name) {
+ if (!$path) {
+ $path = sys_get_temp_dir();
+ }
+ $this->path = $path . '/u_sess_' . $name;
+ return true;
+ }
+
+ public function close() {
+ return true;
+ }
+
+ public function read($id) {
+ return (string)@file_get_contents($this->path . $id);
+ }
+
+ public function write($id, $data) {
+ return (bool)file_put_contents($this->path . $id, $data);
+ }
+
+ public function destroy($id) {
+ @unlink($this->path . $id);
+ return true;
+ }
+
+ public function gc($maxlifetime) {
+ foreach (glob($this->path . '*') as $filename) {
+ if (filemtime($filename) + $maxlifetime < time()) {
+ @unlink($filename);
+ }
+ }
+ return true;
+ }
}
$handler = new MySession2;
session_set_save_handler(array($handler, 'open'), array($handler, 'close'),
- array($handler, 'read'), array($handler, 'write'), array($handler, 'destroy'), array($handler, 'gc'));
+ array($handler, 'read'), array($handler, 'write'), array($handler, 'destroy'), array($handler, 'gc'));
session_start();
$_SESSION['foo'] = "hello";
diff --git a/ext/session/tests/session_set_save_handler_class_003.phpt b/ext/session/tests/session_set_save_handler_class_003.phpt
index ba0311b96b..b3aba74989 100644
--- a/ext/session/tests/session_set_save_handler_class_003.phpt
+++ b/ext/session/tests/session_set_save_handler_class_003.phpt
@@ -19,22 +19,22 @@ ob_start();
echo "*** Testing session_set_save_handler() : inheritance ***\n";
class MySession3 extends SessionHandler {
- public $i = 0;
- public function open($path, $name) {
- ++$this->i;
- return parent::open($path, $name);
- }
- public function read($key) {
- ++$this->i;
- return parent::read($key);
- }
+ public $i = 0;
+ public function open($path, $name) {
+ ++$this->i;
+ return parent::open($path, $name);
+ }
+ public function read($key) {
+ ++$this->i;
+ return parent::read($key);
+ }
}
class MySession4 extends MySession3 {
- public function write($id, $data) {
- $this->i = "hai";
- return parent::write($id, $data);
- }
+ public function write($id, $data) {
+ $this->i = "hai";
+ return parent::write($id, $data);
+ }
}
$handler = new MySession3;
diff --git a/ext/session/tests/session_set_save_handler_class_005.phpt b/ext/session/tests/session_set_save_handler_class_005.phpt
index bada7f52c5..c6f8dfe622 100644
--- a/ext/session/tests/session_set_save_handler_class_005.phpt
+++ b/ext/session/tests/session_set_save_handler_class_005.phpt
@@ -20,15 +20,15 @@ ob_start();
echo "*** Testing session_set_save_handler() : incomplete implementation ***\n";
class MySession6 extends SessionHandler {
- public function open($path, $name) {
- // don't call parent
- return true;
- }
-
- public function read($id) {
- // should error because parent::open hasn't been called
- return parent::read($id);
- }
+ public function open($path, $name) {
+ // don't call parent
+ return true;
+ }
+
+ public function read($id) {
+ // should error because parent::open hasn't been called
+ return parent::read($id);
+ }
}
$handler = new MySession6;
diff --git a/ext/session/tests/session_set_save_handler_class_006.phpt b/ext/session/tests/session_set_save_handler_class_006.phpt
index 3f86437207..5b7d3be084 100644
--- a/ext/session/tests/session_set_save_handler_class_006.phpt
+++ b/ext/session/tests/session_set_save_handler_class_006.phpt
@@ -19,19 +19,19 @@ ob_start();
echo "*** Testing session_set_save_handler() : using objects in close ***\n";
class MySession7_Foo {
- public $state = 'ok';
- function __destruct() {
- $this->state = 'destroyed';
- }
+ public $state = 'ok';
+ function __destruct() {
+ $this->state = 'destroyed';
+ }
}
class MySession7 extends SessionHandler {
- public $foo;
- public function close() {
- var_dump($this->foo);
- @var_dump($GLOBALS['bar']);
- return parent::close();
- }
+ public $foo;
+ public function close() {
+ var_dump($this->foo);
+ @var_dump($GLOBALS['bar']);
+ return parent::close();
+ }
}
$bar = new MySession7_Foo;
diff --git a/ext/session/tests/session_set_save_handler_class_007.phpt b/ext/session/tests/session_set_save_handler_class_007.phpt
index 0416a894c6..b2ad9eee34 100644
--- a/ext/session/tests/session_set_save_handler_class_007.phpt
+++ b/ext/session/tests/session_set_save_handler_class_007.phpt
@@ -19,28 +19,28 @@ ob_start();
echo "*** Testing session_set_save_handler() : manual shutdown, reopen ***\n";
class MySession extends SessionHandler {
- public $num;
- public function __construct($num) {
- $this->num = $num;
- echo "(#$this->num) constructor called\n";
- }
- public function __destruct() {
- echo "(#$this->num) destructor called\n";
- }
- public function finish() {
- $id = session_id();
- echo "(#$this->num) finish called $id\n";
- session_write_close();
- }
- public function write($id, $data) {
- echo "(#$this->num) writing $id = $data\n";
- return parent::write($id, $data);
- }
- public function close() {
- $id = session_id();
- echo "(#$this->num) closing $id\n";
- return parent::close();
- }
+ public $num;
+ public function __construct($num) {
+ $this->num = $num;
+ echo "(#$this->num) constructor called\n";
+ }
+ public function __destruct() {
+ echo "(#$this->num) destructor called\n";
+ }
+ public function finish() {
+ $id = session_id();
+ echo "(#$this->num) finish called $id\n";
+ session_write_close();
+ }
+ public function write($id, $data) {
+ echo "(#$this->num) writing $id = $data\n";
+ return parent::write($id, $data);
+ }
+ public function close() {
+ $id = session_id();
+ echo "(#$this->num) closing $id\n";
+ return parent::close();
+ }
}
$handler = new MySession(1);
diff --git a/ext/session/tests/session_set_save_handler_class_008.phpt b/ext/session/tests/session_set_save_handler_class_008.phpt
index da9611a8c7..1d39fbd535 100644
--- a/ext/session/tests/session_set_save_handler_class_008.phpt
+++ b/ext/session/tests/session_set_save_handler_class_008.phpt
@@ -19,28 +19,28 @@ ob_start();
echo "*** Testing session_set_save_handler() : manual shutdown ***\n";
class MySession extends SessionHandler {
- public $num;
- public function __construct($num) {
- $this->num = $num;
- echo "(#$this->num) constructor called\n";
- }
- public function __destruct() {
- echo "(#$this->num) destructor called\n";
- }
- public function finish() {
- $id = session_id();
- echo "(#$this->num) finish called $id\n";
- session_write_close();
- }
- public function write($id, $data) {
- echo "(#$this->num) writing $id = $data\n";
- return parent::write($id, $data);
- }
- public function close() {
- $id = session_id();
- echo "(#$this->num) closing $id\n";
- return parent::close();
- }
+ public $num;
+ public function __construct($num) {
+ $this->num = $num;
+ echo "(#$this->num) constructor called\n";
+ }
+ public function __destruct() {
+ echo "(#$this->num) destructor called\n";
+ }
+ public function finish() {
+ $id = session_id();
+ echo "(#$this->num) finish called $id\n";
+ session_write_close();
+ }
+ public function write($id, $data) {
+ echo "(#$this->num) writing $id = $data\n";
+ return parent::write($id, $data);
+ }
+ public function close() {
+ $id = session_id();
+ echo "(#$this->num) closing $id\n";
+ return parent::close();
+ }
}
$handler = new MySession(1);
diff --git a/ext/session/tests/session_set_save_handler_class_009.phpt b/ext/session/tests/session_set_save_handler_class_009.phpt
index d878450540..6969542251 100644
--- a/ext/session/tests/session_set_save_handler_class_009.phpt
+++ b/ext/session/tests/session_set_save_handler_class_009.phpt
@@ -19,28 +19,28 @@ ob_start();
echo "*** Testing session_set_save_handler() : implicit shutdown ***\n";
class MySession extends SessionHandler {
- public $num;
- public function __construct($num) {
- $this->num = $num;
- echo "(#$this->num) constructor called\n";
- }
- public function __destruct() {
- echo "(#$this->num) destructor called\n";
- }
- public function finish() {
- $id = session_id();
- echo "(#$this->num) finish called $id\n";
- $this->shutdown();
- }
- public function write($id, $data) {
- echo "(#$this->num) writing $id = $data\n";
- return parent::write($id, $data);
- }
- public function close() {
- $id = session_id();
- echo "(#$this->num) closing $id\n";
- return parent::close();
- }
+ public $num;
+ public function __construct($num) {
+ $this->num = $num;
+ echo "(#$this->num) constructor called\n";
+ }
+ public function __destruct() {
+ echo "(#$this->num) destructor called\n";
+ }
+ public function finish() {
+ $id = session_id();
+ echo "(#$this->num) finish called $id\n";
+ $this->shutdown();
+ }
+ public function write($id, $data) {
+ echo "(#$this->num) writing $id = $data\n";
+ return parent::write($id, $data);
+ }
+ public function close() {
+ $id = session_id();
+ echo "(#$this->num) closing $id\n";
+ return parent::close();
+ }
}
$handler = new MySession(1);
diff --git a/ext/session/tests/session_set_save_handler_class_010.phpt b/ext/session/tests/session_set_save_handler_class_010.phpt
index 2424a08d68..8734f71f9f 100644
--- a/ext/session/tests/session_set_save_handler_class_010.phpt
+++ b/ext/session/tests/session_set_save_handler_class_010.phpt
@@ -19,28 +19,28 @@ ob_start();
echo "*** Testing session_set_save_handler() : manual shutdown function ***\n";
class MySession extends SessionHandler {
- public $num;
- public function __construct($num) {
- $this->num = $num;
- echo "(#$this->num) constructor called\n";
- }
- public function __destruct() {
- echo "(#$this->num) destructor called\n";
- }
- public function finish() {
- $id = session_id();
- echo "(#$this->num) finish called $id\n";
- session_write_close();
- }
- public function write($id, $data) {
- echo "(#$this->num) writing $id = $data\n";
- return parent::write($id, $data);
- }
- public function close() {
- $id = session_id();
- echo "(#$this->num) closing $id\n";
- return parent::close();
- }
+ public $num;
+ public function __construct($num) {
+ $this->num = $num;
+ echo "(#$this->num) constructor called\n";
+ }
+ public function __destruct() {
+ echo "(#$this->num) destructor called\n";
+ }
+ public function finish() {
+ $id = session_id();
+ echo "(#$this->num) finish called $id\n";
+ session_write_close();
+ }
+ public function write($id, $data) {
+ echo "(#$this->num) writing $id = $data\n";
+ return parent::write($id, $data);
+ }
+ public function close() {
+ $id = session_id();
+ echo "(#$this->num) closing $id\n";
+ return parent::close();
+ }
}
$handler = new MySession(1);
diff --git a/ext/session/tests/session_set_save_handler_class_011.phpt b/ext/session/tests/session_set_save_handler_class_011.phpt
index 05a84a359a..396bdbc59f 100644
--- a/ext/session/tests/session_set_save_handler_class_011.phpt
+++ b/ext/session/tests/session_set_save_handler_class_011.phpt
@@ -19,33 +19,33 @@ ob_start();
echo "*** Testing session_set_save_handler() : shutdown failure ***\n";
class MySession extends SessionHandler {
- public $num;
- public $destroyed = false;
- public function __construct($num) {
- $this->num = $num;
- echo "(#$this->num) constructor called\n";
- }
- public function __destruct() {
- echo "(#$this->num) destructor called\n";
- $this->destroyed = true;
- }
- public function write($id, $data) {
- if ($this->destroyed) {
- echo "(#$this->num) destroyed, cannot write\n";
- } else {
- echo "(#$this->num) writing $id = $data\n";
- }
- return parent::write($id, $data);
- }
- public function close() {
- $id = session_id();
- if ($this->destroyed) {
- echo "(#$this->num) destroyed, cannot write\n";
- } else {
- echo "(#$this->num) closing $id\n";
- }
- return parent::close();
- }
+ public $num;
+ public $destroyed = false;
+ public function __construct($num) {
+ $this->num = $num;
+ echo "(#$this->num) constructor called\n";
+ }
+ public function __destruct() {
+ echo "(#$this->num) destructor called\n";
+ $this->destroyed = true;
+ }
+ public function write($id, $data) {
+ if ($this->destroyed) {
+ echo "(#$this->num) destroyed, cannot write\n";
+ } else {
+ echo "(#$this->num) writing $id = $data\n";
+ }
+ return parent::write($id, $data);
+ }
+ public function close() {
+ $id = session_id();
+ if ($this->destroyed) {
+ echo "(#$this->num) destroyed, cannot write\n";
+ } else {
+ echo "(#$this->num) closing $id\n";
+ }
+ return parent::close();
+ }
}
$handler = new MySession(1);
diff --git a/ext/session/tests/session_set_save_handler_class_012.phpt b/ext/session/tests/session_set_save_handler_class_012.phpt
index b7bcc3fca6..f81207d2a7 100644
--- a/ext/session/tests/session_set_save_handler_class_012.phpt
+++ b/ext/session/tests/session_set_save_handler_class_012.phpt
@@ -20,43 +20,41 @@ ob_start();
echo "*** Testing session_set_save_handler() : incorrect arguments for existing handler open ***\n";
class MySession extends SessionHandler {
- public $i = 0;
- public function open($path, $name) {
- ++$this->i;
- echo 'Open ', session_id(), "\n";
- // This test was written for broken return value handling
- // Mimmick what was actually being tested by returning true here
- return (null === parent::open());
- }
- public function read($key) {
- ++$this->i;
- echo 'Read ', session_id(), "\n";
- return parent::read($key);
- }
+ public $i = 0;
+ public function open($path, $name) {
+ ++$this->i;
+ echo 'Open ', session_id(), "\n";
+ // This test was written for broken return value handling
+ // Mimmick what was actually being tested by returning true here
+ return (null === parent::open());
+ }
+ public function read($key) {
+ ++$this->i;
+ echo 'Read ', session_id(), "\n";
+ return parent::read($key);
+ }
}
$oldHandler = ini_get('session.save_handler');
$handler = new MySession;
session_set_save_handler($handler);
-var_dump(session_start());
+try {
+ var_dump(session_start());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump(session_id(), $oldHandler, ini_get('session.save_handler'), $handler->i, $_SESSION);
--EXPECTF--
*** Testing session_set_save_handler() : incorrect arguments for existing handler open ***
Open
-Warning: SessionHandler::open() expects exactly 2 parameters, 0 given in %s on line %d
-Read %s
-
-Warning: SessionHandler::read(): Parent session handler is not open in %s on line %d
+Warning: session_start(): Failed to initialize storage module: user (path: ) in %s on line %d
+SessionHandler::open() expects exactly 2 parameters, 0 given
-Warning: SessionHandler::close(): Parent session handler is not open in %s on line %d
-
-Warning: session_start(): Failed to read session data: user (%s) in %s on line %d
-bool(false)
+Warning: Undefined variable: _SESSION in %s on line %d
string(0) ""
string(5) "files"
string(4) "user"
-int(2)
-array(0) {
-}
+int(1)
+NULL
diff --git a/ext/session/tests/session_set_save_handler_class_013.phpt b/ext/session/tests/session_set_save_handler_class_013.phpt
index 28e49c9f98..886d6440a7 100644
--- a/ext/session/tests/session_set_save_handler_class_013.phpt
+++ b/ext/session/tests/session_set_save_handler_class_013.phpt
@@ -19,20 +19,20 @@ ob_start();
echo "*** Testing session_set_save_handler() : incorrect arguments for existing handler close ***\n";
class MySession extends SessionHandler {
- public $i = 0;
- public function open($path, $name) {
- ++$this->i;
- echo 'Open ', session_id(), "\n";
- return parent::open($path, $name);
- }
- public function read($key) {
- ++$this->i;
- echo 'Read ', session_id(), "\n";
- return parent::read($key);
- }
- public function close() {
- return parent::close(false);
- }
+ public $i = 0;
+ public function open($path, $name) {
+ ++$this->i;
+ echo 'Open ', session_id(), "\n";
+ return parent::open($path, $name);
+ }
+ public function read($key) {
+ ++$this->i;
+ echo 'Read ', session_id(), "\n";
+ return parent::read($key);
+ }
+ public function close() {
+ return parent::close(false);
+ }
}
$oldHandler = ini_get('session.save_handler');
@@ -41,6 +41,7 @@ session_set_save_handler($handler);
session_start();
var_dump(session_id(), $oldHandler, ini_get('session.save_handler'), $handler->i, $_SESSION);
+?>
--EXPECTF--
*** Testing session_set_save_handler() : incorrect arguments for existing handler close ***
Open
@@ -52,4 +53,10 @@ int(2)
array(0) {
}
-Warning: SessionHandler::close() expects exactly 0 parameters, 1 given in %s on line %d
+Fatal error: Uncaught ArgumentCountError: SessionHandler::close() expects exactly 0 parameters, 1 given in %s:%d
+Stack trace:
+#0 %s(%d): SessionHandler->close(false)
+#1 [internal function]: MySession->close()
+#2 [internal function]: session_write_close()
+#3 {main}
+ thrown in %s on line %d
diff --git a/ext/session/tests/session_set_save_handler_class_016.phpt b/ext/session/tests/session_set_save_handler_class_016.phpt
index eadfead304..03bb8eaf95 100644
--- a/ext/session/tests/session_set_save_handler_class_016.phpt
+++ b/ext/session/tests/session_set_save_handler_class_016.phpt
@@ -19,44 +19,44 @@ ob_start();
echo "*** Testing session_set_save_handler() function: class with create_sid ***\n";
class MySession2 extends SessionHandler {
- public $path;
-
- public function open($path, $name) {
- if (!$path) {
- $path = sys_get_temp_dir();
- }
- $this->path = $path . '/u_sess_' . $name;
- return true;
- }
-
- public function close() {
- return true;
- }
-
- public function read($id) {
- return (string)@file_get_contents($this->path . $id);
- }
-
- public function write($id, $data) {
- return (bool)file_put_contents($this->path . $id, $data);
- }
-
- public function destroy($id) {
- @unlink($this->path . $id);
- }
-
- public function gc($maxlifetime) {
- foreach (glob($this->path . '*') as $filename) {
- if (filemtime($filename) + $maxlifetime < time()) {
- @unlink($filename);
- }
- }
- return true;
- }
-
- public function create_sid() {
- return parent::create_sid();
- }
+ public $path;
+
+ public function open($path, $name) {
+ if (!$path) {
+ $path = sys_get_temp_dir();
+ }
+ $this->path = $path . '/u_sess_' . $name;
+ return true;
+ }
+
+ public function close() {
+ return true;
+ }
+
+ public function read($id) {
+ return (string)@file_get_contents($this->path . $id);
+ }
+
+ public function write($id, $data) {
+ return (bool)file_put_contents($this->path . $id, $data);
+ }
+
+ public function destroy($id) {
+ @unlink($this->path . $id);
+ }
+
+ public function gc($maxlifetime) {
+ foreach (glob($this->path . '*') as $filename) {
+ if (filemtime($filename) + $maxlifetime < time()) {
+ @unlink($filename);
+ }
+ }
+ return true;
+ }
+
+ public function create_sid() {
+ return parent::create_sid();
+ }
}
$handler = new MySession2;
diff --git a/ext/session/tests/session_set_save_handler_class_017.phpt b/ext/session/tests/session_set_save_handler_class_017.phpt
index 460552a620..563d86c013 100644
--- a/ext/session/tests/session_set_save_handler_class_017.phpt
+++ b/ext/session/tests/session_set_save_handler_class_017.phpt
@@ -19,44 +19,44 @@ ob_start();
echo "*** Testing session_set_save_handler() function: class with create_sid ***\n";
class MySession2 extends SessionHandler {
- public $path;
-
- public function open($path, $name) {
- if (!$path) {
- $path = sys_get_temp_dir();
- }
- $this->path = $path . '/u_sess_' . $name;
- return true;
- }
-
- public function close() {
- return true;
- }
-
- public function read($id) {
- return (string)@file_get_contents($this->path . $id);
- }
-
- public function write($id, $data) {
- return (bool)file_put_contents($this->path . $id, $data);
- }
-
- public function destroy($id) {
- @unlink($this->path . $id);
- }
-
- public function gc($maxlifetime) {
- foreach (glob($this->path . '*') as $filename) {
- if (filemtime($filename) + $maxlifetime < time()) {
- @unlink($filename);
- }
- }
- return true;
- }
-
- public function create_sid() {
- return 'my_sid';
- }
+ public $path;
+
+ public function open($path, $name) {
+ if (!$path) {
+ $path = sys_get_temp_dir();
+ }
+ $this->path = $path . '/u_sess_' . $name;
+ return true;
+ }
+
+ public function close() {
+ return true;
+ }
+
+ public function read($id) {
+ return (string)@file_get_contents($this->path . $id);
+ }
+
+ public function write($id, $data) {
+ return (bool)file_put_contents($this->path . $id, $data);
+ }
+
+ public function destroy($id) {
+ @unlink($this->path . $id);
+ }
+
+ public function gc($maxlifetime) {
+ foreach (glob($this->path . '*') as $filename) {
+ if (filemtime($filename) + $maxlifetime < time()) {
+ @unlink($filename);
+ }
+ }
+ return true;
+ }
+
+ public function create_sid() {
+ return pathinfo(__FILE__)['filename'];
+ }
}
$handler = new MySession2;
@@ -72,12 +72,12 @@ session_unset();
session_start();
var_dump($_SESSION);
-
-session_write_close();
-session_unset();
---EXPECTF--
+--CLEAN--
+<?php
+@unlink(session_save_path().'/u_sess_PHPSESSIDsession_set_save_handler_class_017');
+--EXPECT--
*** Testing session_set_save_handler() function: class with create_sid ***
-string(%d) "my_sid"
+string(34) "session_set_save_handler_class_017"
string(4) "user"
array(1) {
["foo"]=>
diff --git a/ext/session/tests/session_set_save_handler_class_018.phpt b/ext/session/tests/session_set_save_handler_class_018.phpt
index c0b2eb61bf..30d72b4708 100644
--- a/ext/session/tests/session_set_save_handler_class_018.phpt
+++ b/ext/session/tests/session_set_save_handler_class_018.phpt
@@ -19,48 +19,48 @@ ob_start();
echo "*** Testing session_set_save_handler() function: class with validate_sid ***\n";
class MySession2 extends SessionHandler {
- public $path;
-
- public function open($path, $name) {
- if (!$path) {
- $path = sys_get_temp_dir();
- }
- $this->path = $path . '/u_sess_' . $name;
- return true;
- }
-
- public function close() {
- return true;
- }
-
- public function read($id) {
- return @file_get_contents($this->path . $id);
- }
-
- public function write($id, $data) {
- return file_put_contents($this->path . $id, $data)===FALSE ? FALSE : TRUE ;
- }
-
- public function destroy($id) {
- @unlink($this->path . $id);
- }
-
- public function gc($maxlifetime) {
- foreach (glob($this->path . '*') as $filename) {
- if (filemtime($filename) + $maxlifetime < time()) {
- @unlink($filename);
- }
- }
- return true;
- }
-
- public function create_sid() {
- return 'my_sid';
- }
-
- public function validate_sid($id) {
- return 'my_sid'===$id;
- }
+ public $path;
+
+ public function open($path, $name) {
+ if (!$path) {
+ $path = sys_get_temp_dir();
+ }
+ $this->path = $path . '/u_sess_' . $name;
+ return true;
+ }
+
+ public function close() {
+ return true;
+ }
+
+ public function read($id) {
+ return (string)@file_get_contents($this->path . $id);
+ }
+
+ public function write($id, $data) {
+ return file_put_contents($this->path . $id, $data)===FALSE ? FALSE : TRUE ;
+ }
+
+ public function destroy($id) {
+ @unlink($this->path . $id);
+ }
+
+ public function gc($maxlifetime) {
+ foreach (glob($this->path . '*') as $filename) {
+ if (filemtime($filename) + $maxlifetime < time()) {
+ @unlink($filename);
+ }
+ }
+ return true;
+ }
+
+ public function create_sid() {
+ return pathinfo(__FILE__)['filename'];
+ }
+
+ public function validate_sid($id) {
+ return pathinfo(__FILE__)['filename']===$id;
+ }
}
$handler = new MySession2;
@@ -76,12 +76,12 @@ session_unset();
session_start();
var_dump($_SESSION);
-
-session_write_close();
-session_unset();
---EXPECTF--
+--CLEAN--
+<?php
+@unlink(session_save_path().'/u_sess_PHPSESSIDsession_set_save_handler_class_018');
+--EXPECT--
*** Testing session_set_save_handler() function: class with validate_sid ***
-string(%d) "my_sid"
+string(34) "session_set_save_handler_class_018"
string(4) "user"
array(1) {
["foo"]=>
diff --git a/ext/session/tests/session_set_save_handler_iface_001.phpt b/ext/session/tests/session_set_save_handler_iface_001.phpt
index 362ad90dd6..c1981c91b0 100644
--- a/ext/session/tests/session_set_save_handler_iface_001.phpt
+++ b/ext/session/tests/session_set_save_handler_iface_001.phpt
@@ -19,45 +19,45 @@ ob_start();
echo "*** Testing session_set_save_handler() function: interface ***\n";
class MySession2 implements SessionHandlerInterface {
- public $path;
-
- public function open($path, $name) {
- if (!$path) {
- $path = sys_get_temp_dir();
- }
- $this->path = $path . '/u_sess_' . $name;
- return true;
- }
-
- public function close() {
- return true;
- }
-
- public function read($id) {
- return (string)@file_get_contents($this->path . $id);
- }
-
- public function write($id, $data) {
- return (bool)file_put_contents($this->path . $id, $data);
- }
-
- public function destroy($id) {
- @unlink($this->path . $id);
- }
-
- public function gc($maxlifetime) {
- foreach (glob($this->path . '*') as $filename) {
- if (filemtime($filename) + $maxlifetime < time()) {
- @unlink($filename);
- }
- }
- return true;
- }
+ public $path;
+
+ public function open($path, $name) {
+ if (!$path) {
+ $path = sys_get_temp_dir();
+ }
+ $this->path = $path . '/u_sess_' . $name;
+ return true;
+ }
+
+ public function close() {
+ return true;
+ }
+
+ public function read($id) {
+ return (string)@file_get_contents($this->path . $id);
+ }
+
+ public function write($id, $data) {
+ return (bool)file_put_contents($this->path . $id, $data);
+ }
+
+ public function destroy($id) {
+ @unlink($this->path . $id);
+ }
+
+ public function gc($maxlifetime) {
+ foreach (glob($this->path . '*') as $filename) {
+ if (filemtime($filename) + $maxlifetime < time()) {
+ @unlink($filename);
+ }
+ }
+ return true;
+ }
}
$handler = new MySession2;
session_set_save_handler(array($handler, 'open'), array($handler, 'close'),
- array($handler, 'read'), array($handler, 'write'), array($handler, 'destroy'), array($handler, 'gc'));
+ array($handler, 'read'), array($handler, 'write'), array($handler, 'destroy'), array($handler, 'gc'));
session_start();
$_SESSION['foo'] = "hello";
diff --git a/ext/session/tests/session_set_save_handler_iface_002.phpt b/ext/session/tests/session_set_save_handler_iface_002.phpt
index bc9f801a5e..cd8f6af9d9 100644
--- a/ext/session/tests/session_set_save_handler_iface_002.phpt
+++ b/ext/session/tests/session_set_save_handler_iface_002.phpt
@@ -19,71 +19,72 @@ ob_start();
echo "*** Testing session_set_save_handler() function: interface wrong ***\n";
interface MySessionHandlerInterface {
- public function open($path, $name);
- public function close();
- public function read($id);
- public function write($id, $data);
- public function destroy($id);
- public function gc($maxlifetime);
+ public function open($path, $name);
+ public function close();
+ public function read($id);
+ public function write($id, $data);
+ public function destroy($id);
+ public function gc($maxlifetime);
}
class MySession2 implements MySessionHandlerInterface {
- public $path;
-
- public function open($path, $name) {
- if (!$path) {
- $path = sys_get_temp_dir();
- }
- $this->path = $path . '/u_sess_' . $name;
- return true;
- }
-
- public function close() {
- return true;
- }
-
- public function read($id) {
- return (string)@file_get_contents($this->path . $id);
- }
-
- public function write($id, $data) {
- echo "Unsupported session handler in use\n";
- }
-
- public function destroy($id) {
- @unlink($this->path . $id);
- }
-
- public function gc($maxlifetime) {
- foreach (glob($this->path . '*') as $filename) {
- if (filemtime($filename) + $maxlifetime < time()) {
- @unlink($filename);
- }
- }
- return true;
- }
+ public $path;
+
+ public function open($path, $name) {
+ if (!$path) {
+ $path = sys_get_temp_dir();
+ }
+ $this->path = $path . '/u_sess_' . $name;
+ return true;
+ }
+
+ public function close() {
+ return true;
+ }
+
+ public function read($id) {
+ return (string)@file_get_contents($this->path . $id);
+ }
+
+ public function write($id, $data) {
+ echo "Unsupported session handler in use\n";
+ }
+
+ public function destroy($id) {
+ @unlink($this->path . $id);
+ }
+
+ public function gc($maxlifetime) {
+ foreach (glob($this->path . '*') as $filename) {
+ if (filemtime($filename) + $maxlifetime < time()) {
+ @unlink($filename);
+ }
+ }
+ return true;
+ }
}
function good_write($id, $data) {
- global $handler;
- echo "good handler writing\n";
- return file_put_contents($handler->path . $id, $data);
+ global $handler;
+ echo "good handler writing\n";
+ return file_put_contents($handler->path . $id, $data);
}
$handler = new MySession2;
$ret = session_set_save_handler(array($handler, 'open'), array($handler, 'close'),
- array($handler, 'read'), 'good_write', array($handler, 'destroy'), array($handler, 'gc'));
+ array($handler, 'read'), 'good_write', array($handler, 'destroy'), array($handler, 'gc'));
var_dump($ret);
-$ret = session_set_save_handler($handler);
-var_dump($ret);
+try {
+ $ret = session_set_save_handler($handler);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
session_start();
--EXPECTF--
*** Testing session_set_save_handler() function: interface wrong ***
bool(true)
-
-Warning: session_set_save_handler() expects parameter 1 to be SessionHandlerInterface, object given in %s
-bool(false)
+session_set_save_handler() expects parameter 1 to be SessionHandlerInterface, object given
good handler writing
diff --git a/ext/session/tests/session_set_save_handler_iface_003.phpt b/ext/session/tests/session_set_save_handler_iface_003.phpt
index 5a73d6d5f5..61714e0bb3 100644
--- a/ext/session/tests/session_set_save_handler_iface_003.phpt
+++ b/ext/session/tests/session_set_save_handler_iface_003.phpt
@@ -19,45 +19,45 @@ ob_start();
echo "*** Testing session_set_save_handler() function: id interface ***\n";
class MySession2 implements SessionHandlerInterface, SessionIdInterface {
- public $path;
-
- public function open($path, $name) {
- if (!$path) {
- $path = sys_get_temp_dir();
- }
- $this->path = $path . '/u_sess_' . $name;
- return true;
- }
-
- public function close() {
- return true;
- }
-
- public function read($id) {
- return @file_get_contents($this->path . $id);
- }
-
- public function write($id, $data) {
- // Empty $data = 0 = false
- return (bool)file_put_contents($this->path . $id, $data);
- }
-
- public function destroy($id) {
- @unlink($this->path . $id);
- }
-
- public function gc($maxlifetime) {
- foreach (glob($this->path . '*') as $filename) {
- if (filemtime($filename) + $maxlifetime < time()) {
- @unlink($filename);
- }
- }
- return true;
- }
-
- public function create_sid() {
- return 'my_sid';
- }
+ public $path;
+
+ public function open($path, $name) {
+ if (!$path) {
+ $path = sys_get_temp_dir();
+ }
+ $this->path = $path . '/u_sess_' . $name;
+ return true;
+ }
+
+ public function close() {
+ return true;
+ }
+
+ public function read($id) {
+ return (string)@file_get_contents($this->path . $id);
+ }
+
+ public function write($id, $data) {
+ // Empty $data = 0 = false
+ return (bool)file_put_contents($this->path . $id, $data);
+ }
+
+ public function destroy($id) {
+ @unlink($this->path . $id);
+ }
+
+ public function gc($maxlifetime) {
+ foreach (glob($this->path . '*') as $filename) {
+ if (filemtime($filename) + $maxlifetime < time()) {
+ @unlink($filename);
+ }
+ }
+ return true;
+ }
+
+ public function create_sid() {
+ return pathinfo(__FILE__)['filename'];
+ }
}
$handler = new MySession2;
@@ -73,12 +73,12 @@ session_unset();
session_start();
var_dump($_SESSION);
-
-session_write_close();
-session_unset();
---EXPECTF--
+--CLEAN--
+<?php
+@unlink(session_save_path().'/u_sess_PHPSESSIDsession_set_save_handler_iface_003');
+--EXPECT--
*** Testing session_set_save_handler() function: id interface ***
-string(%d) "my_sid"
+string(34) "session_set_save_handler_iface_003"
string(4) "user"
array(1) {
["foo"]=>
diff --git a/ext/session/tests/session_set_save_handler_sid_001.phpt b/ext/session/tests/session_set_save_handler_sid_001.phpt
index 4d297d98f7..d4097158ed 100644
--- a/ext/session/tests/session_set_save_handler_sid_001.phpt
+++ b/ext/session/tests/session_set_save_handler_sid_001.phpt
@@ -13,50 +13,50 @@ ob_start();
echo "*** Testing session_set_save_handler() function: create_sid ***\n";
class MySession2 {
- public $path;
-
- public function open($path, $name) {
- if (!$path) {
- $path = sys_get_temp_dir();
- }
- $this->path = $path . '/u_sess_' . $name;
- return true;
- }
-
- public function close() {
- return true;
- }
-
- public function read($id) {
- return @file_get_contents($this->path . $id);
- }
-
- public function write($id, $data) {
- // Empty $data = 0 = false
- return (bool)file_put_contents($this->path . $id, $data);
- }
-
- public function destroy($id) {
- @unlink($this->path . $id);
- }
-
- public function gc($maxlifetime) {
- foreach (glob($this->path . '*') as $filename) {
- if (filemtime($filename) + $maxlifetime < time()) {
- @unlink($filename);
- }
- }
- return true;
- }
-
- public function create_sid() {
- return 'my_sid';
- }
+ public $path;
+
+ public function open($path, $name) {
+ if (!$path) {
+ $path = sys_get_temp_dir();
+ }
+ $this->path = $path . '/u_sess_' . $name;
+ return true;
+ }
+
+ public function close() {
+ return true;
+ }
+
+ public function read($id) {
+ return (string)@file_get_contents($this->path . $id);
+ }
+
+ public function write($id, $data) {
+ // Empty $data = 0 = false
+ return (bool)file_put_contents($this->path . $id, $data);
+ }
+
+ public function destroy($id) {
+ @unlink($this->path . $id);
+ }
+
+ public function gc($maxlifetime) {
+ foreach (glob($this->path . '*') as $filename) {
+ if (filemtime($filename) + $maxlifetime < time()) {
+ @unlink($filename);
+ }
+ }
+ return true;
+ }
+
+ public function create_sid() {
+ return pathinfo(__FILE__)['filename'];
+ }
}
$handler = new MySession2;
session_set_save_handler(array($handler, 'open'), array($handler, 'close'),
- array($handler, 'read'), array($handler, 'write'), array($handler, 'destroy'), array($handler, 'gc'), array($handler, 'create_sid'));
+ array($handler, 'read'), array($handler, 'write'), array($handler, 'destroy'), array($handler, 'gc'), array($handler, 'create_sid'));
session_start();
$_SESSION['foo'] = "hello";
@@ -68,12 +68,12 @@ session_unset();
session_start();
var_dump($_SESSION);
-
-session_write_close();
-session_unset();
---EXPECTF--
+--CLEAN--
+<?php
+@unlink(session_save_path().'/u_sess_PHPSESSIDsession_set_save_handler_sid_001');
+--EXPECT--
*** Testing session_set_save_handler() function: create_sid ***
-string(%d) "my_sid"
+string(32) "session_set_save_handler_sid_001"
string(4) "user"
array(1) {
["foo"]=>
diff --git a/ext/session/tests/session_set_save_handler_sid_002.phpt b/ext/session/tests/session_set_save_handler_sid_002.phpt
index 76ffb63991..faa7663655 100644
--- a/ext/session/tests/session_set_save_handler_sid_002.phpt
+++ b/ext/session/tests/session_set_save_handler_sid_002.phpt
@@ -14,49 +14,49 @@ ob_start();
echo "*** Testing session_set_save_handler() function: create_sid ***\n";
class MySession2 {
- public $path;
-
- public function open($path, $name) {
- if (!$path) {
- $path = sys_get_temp_dir();
- }
- $this->path = $path . '/u_sess_' . $name;
- return true;
- }
-
- public function close() {
- return true;
- }
-
- public function read($id) {
- return @file_get_contents($this->path . $id);
- }
-
- public function write($id, $data) {
- return file_put_contents($this->path . $id, $data);
- }
-
- public function destroy($id) {
- @unlink($this->path . $id);
- }
-
- public function gc($maxlifetime) {
- foreach (glob($this->path . '*') as $filename) {
- if (filemtime($filename) + $maxlifetime < time()) {
- @unlink($filename);
- }
- }
- return true;
- }
-
- public function create_sid() {
- return null;
- }
+ public $path;
+
+ public function open($path, $name) {
+ if (!$path) {
+ $path = sys_get_temp_dir();
+ }
+ $this->path = $path . '/u_sess_' . $name;
+ return true;
+ }
+
+ public function close() {
+ return true;
+ }
+
+ public function read($id) {
+ return @file_get_contents($this->path . $id);
+ }
+
+ public function write($id, $data) {
+ return file_put_contents($this->path . $id, $data);
+ }
+
+ public function destroy($id) {
+ @unlink($this->path . $id);
+ }
+
+ public function gc($maxlifetime) {
+ foreach (glob($this->path . '*') as $filename) {
+ if (filemtime($filename) + $maxlifetime < time()) {
+ @unlink($filename);
+ }
+ }
+ return true;
+ }
+
+ public function create_sid() {
+ return null;
+ }
}
$handler = new MySession2;
session_set_save_handler(array($handler, 'open'), array($handler, 'close'),
- array($handler, 'read'), array($handler, 'write'), array($handler, 'destroy'), array($handler, 'gc'), array($handler, 'create_sid'));
+ array($handler, 'read'), array($handler, 'write'), array($handler, 'destroy'), array($handler, 'gc'), array($handler, 'create_sid'));
session_start();
$_SESSION['foo'] = "hello";
diff --git a/ext/session/tests/session_set_save_handler_variation4.phpt b/ext/session/tests/session_set_save_handler_variation4.phpt
index bf74385839..abe3abbeb2 100644
--- a/ext/session/tests/session_set_save_handler_variation4.phpt
+++ b/ext/session/tests/session_set_save_handler_variation4.phpt
@@ -23,9 +23,9 @@ ob_start();
echo "*** Testing session_set_save_handler() : variation ***\n";
function noisy_gc($maxlifetime) {
- echo("GC [".$maxlifetime."]\n");
- echo gc($maxlifetime)." deleted\n";
- return true;
+ echo("GC [".$maxlifetime."]\n");
+ echo gc($maxlifetime)." deleted\n";
+ return true;
}
require_once "save_handler.inc";
diff --git a/ext/session/tests/session_set_save_handler_variation5.phpt b/ext/session/tests/session_set_save_handler_variation5.phpt
index 23847aadf4..ad11729b94 100644
--- a/ext/session/tests/session_set_save_handler_variation5.phpt
+++ b/ext/session/tests/session_set_save_handler_variation5.phpt
@@ -22,9 +22,9 @@ ob_start();
*/
function noisy_gc($maxlifetime) {
- echo("GC [".$maxlifetime."]\n");
- echo gc($maxlifetime)." deleted\n";
- return true;
+ echo("GC [".$maxlifetime."]\n");
+ echo gc($maxlifetime)." deleted\n";
+ return true;
}
echo "*** Testing session_set_save_handler() : variation ***\n";
diff --git a/ext/session/tests/skipif.inc b/ext/session/tests/skipif.inc
index e63f963c5c..c259d9eaca 100644
--- a/ext/session/tests/skipif.inc
+++ b/ext/session/tests/skipif.inc
@@ -9,17 +9,17 @@ if (!extension_loaded("session")) {
}
$save_path = ini_get("session.save_path");
if ($save_path) {
- if (!file_exists($save_path)) {
- die("skip Session save_path doesn't exist");
- }
+ if (!file_exists($save_path)) {
+ die("skip Session save_path doesn't exist");
+ }
- if ($save_path && !@is_writable($save_path)) {
- if (($p = strpos($save_path, ';')) !== false) {
- $save_path = substr($save_path, ++$p);
- }
- if (!@is_writable($save_path)) {
- die("skip session.save_path $save_path is not writable\n");
- }
- }
+ if ($save_path && !@is_writable($save_path)) {
+ if (($p = strpos($save_path, ';')) !== false) {
+ $save_path = substr($save_path, ++$p);
+ }
+ if (!@is_writable($save_path)) {
+ die("skip session.save_path $save_path is not writable\n");
+ }
+ }
}
?>
diff --git a/ext/shmop/php_shmop.h b/ext/shmop/php_shmop.h
index 1aafa6c6f4..2181e21893 100644
--- a/ext/shmop/php_shmop.h
+++ b/ext/shmop/php_shmop.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/shmop/shmop.c b/ext/shmop/shmop.c
index 8a4c0b8763..446c309458 100644
--- a/ext/shmop/shmop.c
+++ b/ext/shmop/shmop.c
@@ -24,6 +24,8 @@
#include "php.h"
#include "php_ini.h"
#include "php_shmop.h"
+#include "shmop_arginfo.h"
+
# ifndef PHP_WIN32
# include <sys/ipc.h>
# include <sys/shm.h>
@@ -44,39 +46,6 @@ php_shmop_globals shmop_globals;
int shm_type;
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_shmop_open, 0, 0, 4)
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, flags)
- ZEND_ARG_INFO(0, mode)
- ZEND_ARG_INFO(0, size)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_shmop_read, 0, 0, 3)
- ZEND_ARG_INFO(0, shmid)
- ZEND_ARG_INFO(0, start)
- ZEND_ARG_INFO(0, count)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_shmop_close, 0, 0, 1)
- ZEND_ARG_INFO(0, shmid)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_shmop_size, 0, 0, 1)
- ZEND_ARG_INFO(0, shmid)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_shmop_write, 0, 0, 3)
- ZEND_ARG_INFO(0, shmid)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, offset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_shmop_delete, 0, 0, 1)
- ZEND_ARG_INFO(0, shmid)
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ shmop_functions[]
*/
static const zend_function_entry shmop_functions[] = {
@@ -152,7 +121,7 @@ PHP_FUNCTION(shmop_open)
size_t flags_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lsll", &key, &flags, &flags_len, &mode, &size) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (flags_len != 1) {
@@ -186,7 +155,7 @@ PHP_FUNCTION(shmop_open)
*/
break;
default:
- php_error_docref(NULL, E_WARNING, "invalid access mode");
+ php_error_docref(NULL, E_WARNING, "Invalid access mode");
goto err;
}
@@ -197,19 +166,19 @@ PHP_FUNCTION(shmop_open)
shmop->shmid = shmget(shmop->key, shmop->size, shmop->shmflg);
if (shmop->shmid == -1) {
- php_error_docref(NULL, E_WARNING, "unable to attach or create shared memory segment '%s'", strerror(errno));
+ php_error_docref(NULL, E_WARNING, "Unable to attach or create shared memory segment '%s'", strerror(errno));
goto err;
}
if (shmctl(shmop->shmid, IPC_STAT, &shm)) {
/* please do not add coverage here: the segment would be leaked and impossible to delete via php */
- php_error_docref(NULL, E_WARNING, "unable to get shared memory segment information '%s'", strerror(errno));
+ php_error_docref(NULL, E_WARNING, "Unable to get shared memory segment information '%s'", strerror(errno));
goto err;
}
shmop->addr = shmat(shmop->shmid, 0, shmop->shmatflg);
if (shmop->addr == (char*) -1) {
- php_error_docref(NULL, E_WARNING, "unable to attach to shared memory segment '%s'", strerror(errno));
+ php_error_docref(NULL, E_WARNING, "Unable to attach to shared memory segment '%s'", strerror(errno));
goto err;
}
@@ -234,20 +203,20 @@ PHP_FUNCTION(shmop_read)
zend_string *return_string;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rll", &shmid, &start, &count) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((shmop = (struct php_shmop *)zend_fetch_resource(Z_RES_P(shmid), "shmop", shm_type)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (start < 0 || start > shmop->size) {
- php_error_docref(NULL, E_WARNING, "start is out of range");
+ php_error_docref(NULL, E_WARNING, "Start is out of range");
RETURN_FALSE;
}
if (count < 0 || start > (INT_MAX - count) || start + count > shmop->size) {
- php_error_docref(NULL, E_WARNING, "count is out of range");
+ php_error_docref(NULL, E_WARNING, "Count is out of range");
RETURN_FALSE;
}
@@ -268,12 +237,12 @@ PHP_FUNCTION(shmop_close)
struct php_shmop *shmop;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &shmid) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((shmop = (struct php_shmop *)zend_fetch_resource(Z_RES_P(shmid), "shmop", shm_type)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
zend_list_close(Z_RES_P(shmid));
@@ -288,11 +257,11 @@ PHP_FUNCTION(shmop_size)
struct php_shmop *shmop;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &shmid) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((shmop = (struct php_shmop *)zend_fetch_resource(Z_RES_P(shmid), "shmop", shm_type)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
RETURN_LONG(shmop->size);
@@ -310,20 +279,20 @@ PHP_FUNCTION(shmop_write)
zval *shmid;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rSl", &shmid, &data, &offset) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((shmop = (struct php_shmop *)zend_fetch_resource(Z_RES_P(shmid), "shmop", shm_type)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ((shmop->shmatflg & SHM_RDONLY) == SHM_RDONLY) {
- php_error_docref(NULL, E_WARNING, "trying to write to a read only segment");
+ php_error_docref(NULL, E_WARNING, "Trying to write to a read only segment");
RETURN_FALSE;
}
if (offset < 0 || offset > shmop->size) {
- php_error_docref(NULL, E_WARNING, "offset out of range");
+ php_error_docref(NULL, E_WARNING, "Offset out of range");
RETURN_FALSE;
}
@@ -342,15 +311,15 @@ PHP_FUNCTION(shmop_delete)
struct php_shmop *shmop;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &shmid) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((shmop = (struct php_shmop *)zend_fetch_resource(Z_RES_P(shmid), "shmop", shm_type)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (shmctl(shmop->shmid, IPC_RMID, NULL)) {
- php_error_docref(NULL, E_WARNING, "can't mark segment for deletion (are you the owner?)");
+ php_error_docref(NULL, E_WARNING, "Can't mark segment for deletion (are you the owner?)");
RETURN_FALSE;
}
diff --git a/ext/shmop/shmop.stub.php b/ext/shmop/shmop.stub.php
new file mode 100644
index 0000000000..8ee2eeba9d
--- /dev/null
+++ b/ext/shmop/shmop.stub.php
@@ -0,0 +1,19 @@
+<?php
+
+/** @return resource|false */
+function shmop_open(int $key, string $flags, int $mode, int $size) {}
+
+/** @param resource $shmid */
+function shmop_read($shmid, int $start, int $count): string|false {}
+
+/** @param resource $shmid */
+function shmop_close($shmid): void {}
+
+/** @param resource $shmid */
+function shmop_size($shmid): int {}
+
+/** @param resource $shmid */
+function shmop_write($shmid, string $data, int $offset): int|false {}
+
+/** @param resource $shmid */
+function shmop_delete($shmid): bool {}
diff --git a/ext/shmop/shmop_arginfo.h b/ext/shmop/shmop_arginfo.h
new file mode 100644
index 0000000000..49afa595db
--- /dev/null
+++ b/ext/shmop/shmop_arginfo.h
@@ -0,0 +1,32 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_shmop_open, 0, 0, 4)
+ ZEND_ARG_TYPE_INFO(0, key, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, size, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_shmop_read, 0, 3, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, shmid)
+ ZEND_ARG_TYPE_INFO(0, start, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, count, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_shmop_close, 0, 1, IS_VOID, 0)
+ ZEND_ARG_INFO(0, shmid)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_shmop_size, 0, 1, IS_LONG, 0)
+ ZEND_ARG_INFO(0, shmid)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_shmop_write, 0, 3, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, shmid)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_shmop_delete, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, shmid)
+ZEND_END_ARG_INFO()
diff --git a/ext/shmop/tests/001.phpt b/ext/shmop/tests/001.phpt
index a5ad01c302..48e722d2f0 100644
--- a/ext/shmop/tests/001.phpt
+++ b/ext/shmop/tests/001.phpt
@@ -8,73 +8,73 @@ shmop extension test
?>
--FILE--
<?php
- $hex_shm_id = 0xff3;
- $write_d1 = "test #1 of the shmop() extension";
- $write_d2 = "test #2 append data to shared memory segment";
+ $hex_shm_id = 0xff3;
+ $write_d1 = "test #1 of the shmop() extension";
+ $write_d2 = "test #2 append data to shared memory segment";
- echo "shm open for create: ";
- $shm_id = shmop_open($hex_shm_id, "n", 0644, 1024);
- if (!$shm_id) {
- die("failed\n");
- } else {
- echo "ok\n";
- }
+ echo "shm open for create: ";
+ $shm_id = shmop_open($hex_shm_id, "n", 0644, 1024);
+ if (!$shm_id) {
+ die("failed\n");
+ } else {
+ echo "ok\n";
+ }
- echo "shm size is: " . ($shm_size = shmop_size($shm_id)) . "\n";
+ echo "shm size is: " . ($shm_size = shmop_size($shm_id)) . "\n";
- echo "shm write test #1: ";
- $written = shmop_write($shm_id, $write_d1, 0);
- if ($written != strlen($write_d1)) {
- echo "failed\n";
- } else {
- echo "ok\n";
- }
+ echo "shm write test #1: ";
+ $written = shmop_write($shm_id, $write_d1, 0);
+ if ($written != strlen($write_d1)) {
+ echo "failed\n";
+ } else {
+ echo "ok\n";
+ }
- echo "data in memory is: " . shmop_read($shm_id, 0, $written) . "\n";
+ echo "data in memory is: " . shmop_read($shm_id, 0, $written) . "\n";
- shmop_close($shm_id);
+ shmop_close($shm_id);
- echo "shm open for read only: ";
- $shm_id = shmop_open($hex_shm_id, "a", 0644, 1024);
- if (!$shm_id) {
- echo "failed\n";
- } else {
- echo "ok\n";
- }
+ echo "shm open for read only: ";
+ $shm_id = shmop_open($hex_shm_id, "a", 0644, 1024);
+ if (!$shm_id) {
+ echo "failed\n";
+ } else {
+ echo "ok\n";
+ }
- echo "data in memory is: " . shmop_read($shm_id, 0, $written) . "\n";
+ echo "data in memory is: " . shmop_read($shm_id, 0, $written) . "\n";
- /* try to append data to the shared memory segment, this should fail */
- shmop_write($shm_id, $write_d1, $written);
+ /* try to append data to the shared memory segment, this should fail */
+ shmop_write($shm_id, $write_d1, $written);
- shmop_close($shm_id);
+ shmop_close($shm_id);
- echo "shm open for read only: ";
- $shm_id = shmop_open($hex_shm_id, "w", 0644, 1024);
- if (!$shm_id) {
- echo "failed\n";
- } else {
- echo "ok\n";
- }
+ echo "shm open for read only: ";
+ $shm_id = shmop_open($hex_shm_id, "w", 0644, 1024);
+ if (!$shm_id) {
+ echo "failed\n";
+ } else {
+ echo "ok\n";
+ }
- echo "shm write test #1: ";
- $written = shmop_write($shm_id, $write_d2, $written);
- if ($written != strlen($write_d2)) {
- die("failed\n");
- } else {
- echo "ok\n";
- }
+ echo "shm write test #1: ";
+ $written = shmop_write($shm_id, $write_d2, $written);
+ if ($written != strlen($write_d2)) {
+ die("failed\n");
+ } else {
+ echo "ok\n";
+ }
- echo "data in memory is: " . shmop_read($shm_id, 0, strlen($write_d1 . $write_d2)) . "\n";
+ echo "data in memory is: " . shmop_read($shm_id, 0, strlen($write_d1 . $write_d2)) . "\n";
- echo "deletion of shm segment: ";
- if (!shmop_delete($shm_id)) {
- echo "failed\n";
- } else {
- echo "ok\n";
- }
+ echo "deletion of shm segment: ";
+ if (!shmop_delete($shm_id)) {
+ echo "failed\n";
+ } else {
+ echo "ok\n";
+ }
- shmop_close($shm_id);
+ shmop_close($shm_id);
?>
--EXPECTF--
shm open for create: ok
@@ -84,7 +84,7 @@ data in memory is: test #1 of the shmop() extension
shm open for read only: ok
data in memory is: test #1 of the shmop() extension
-Warning: shmop_write(): trying to write to a read only segment in %s on line %d
+Warning: shmop_write(): Trying to write to a read only segment in %s on line %d
shm open for read only: ok
shm write test #1: ok
data in memory is: test #1 of the shmop() extensiontest #2 append data to shared memory segment
diff --git a/ext/shmop/tests/002.phpt b/ext/shmop/tests/002.phpt
index 3206f90776..c69c79391f 100644
--- a/ext/shmop/tests/002.phpt
+++ b/ext/shmop/tests/002.phpt
@@ -13,103 +13,61 @@ edgarsandi - <edgar.r.sandi@gmail.com>
?>
--FILE--
<?php
- $hex_shm_id = function(){
- return mt_rand(1338, 9999);
- };
+ $hex_shm_id = function(){
+ return mt_rand(1338, 9999);
+ };
echo PHP_EOL, '## shmop_open function tests ##';
- // warning outputs: 4 parameters expected
- var_dump($shm_id = shmop_open());
+ // warning outputs: invalid flag when the flags length != 1
+ var_dump(shmop_open($hex_shm_id(), '', 0644, 1024));
- // warning outputs: invalid flag when the flags length != 1
- var_dump(shmop_open($hex_shm_id(), '', 0644, 1024));
+ // warning outputs: invalid access mode
+ var_dump(shmop_open($hex_shm_id(), 'b', 0644, 1024));
- // warning outputs: invalid access mode
- var_dump(shmop_open($hex_shm_id(), 'b', 0644, 1024));
+ // warning outputs: unable to attach or create shared memory segment
+ var_dump(shmop_open(null, 'a', 0644, 1024));
- // warning outputs: unable to attach or create shared memory segment
- var_dump(shmop_open(null, 'a', 0644, 1024));
-
- // warning outputs: Shared memory segment size must be greater than zero
- var_dump(shmop_open($hex_shm_id(), "c", 0666, 0));
+ // warning outputs: Shared memory segment size must be greater than zero
+ var_dump(shmop_open($hex_shm_id(), "c", 0666, 0));
echo PHP_EOL, '## shmop_read function tests ##';
- // warning outputs: 3 parameters expected
- var_dump(shmop_read());
-
- // warning outputs: start is out of range
- $shm_id = shmop_open($hex_shm_id(), 'n', 0600, 1024);
- var_dump(shmop_read($shm_id, -10, 0));
- shmop_delete($shm_id);
+ // warning outputs: start is out of range
+ $shm_id = shmop_open($hex_shm_id(), 'n', 0600, 1024);
+ var_dump(shmop_read($shm_id, -10, 0));
+ shmop_delete($shm_id);
- // warning outputs: count is out of range
- $shm_id = shmop_open($hex_shm_id(), 'n', 0600, 1024);
- var_dump(shmop_read($shm_id, 0, -10));
- shmop_delete($shm_id);
+ // warning outputs: count is out of range
+ $shm_id = shmop_open($hex_shm_id(), 'n', 0600, 1024);
+ var_dump(shmop_read($shm_id, 0, -10));
+ shmop_delete($shm_id);
echo PHP_EOL, '## shmop_write function tests ##';
- // warning outputs: 3 parameters expected
- var_dump(shmop_write());
-
- // warning outputs: offset out of range
- $shm_id = shmop_open($hex_shm_id(), 'n', 0600, 1024);
- var_dump(shmop_write($shm_id, 'text to try write', -10));
- shmop_delete($shm_id);
-
-echo PHP_EOL, '## shmop_size function tests ##';
- // warning outputs: 1 parameter expected
- var_dump(shmop_size());
-
-echo PHP_EOL, '## shmop_delete function tests ##';
- // warning outputs: 1 parameter expected
- var_dump(shmop_delete());
-
-echo PHP_EOL, '## shmop_close function tests ##';
- // warning outputs: 1 parameter expected
- var_dump(shmop_close());
+ // warning outputs: offset out of range
+ $shm_id = shmop_open($hex_shm_id(), 'n', 0600, 1024);
+ var_dump(shmop_write($shm_id, 'text to try write', -10));
+ shmop_delete($shm_id);
?>
--EXPECTF--
## shmop_open function tests ##
-Warning: shmop_open() expects exactly 4 parameters, 0 given in %s on line %d
-NULL
-
Warning: shmop_open(): is not a valid flag in %s on line %d
bool(false)
-Warning: shmop_open(): invalid access mode in %s on line %d
+Warning: shmop_open(): Invalid access mode in %s on line %d
bool(false)
-Warning: shmop_open(): unable to attach or create shared memory segment 'Invalid argument' in %s on line %d
+Warning: shmop_open(): Unable to attach or create shared memory segment 'Invalid argument' in %s on line %d
bool(false)
Warning: shmop_open(): Shared memory segment size must be greater than zero in %s on line %d
bool(false)
## shmop_read function tests ##
-Warning: shmop_read() expects exactly 3 parameters, 0 given in %s on line %d
-NULL
-
-Warning: shmop_read(): start is out of range in %s on line %d
+Warning: shmop_read(): Start is out of range in %s on line %d
bool(false)
-Warning: shmop_read(): count is out of range in %s on line %d
+Warning: shmop_read(): Count is out of range in %s on line %d
bool(false)
## shmop_write function tests ##
-Warning: shmop_write() expects exactly 3 parameters, 0 given in %s on line %d
-NULL
-
-Warning: shmop_write(): offset out of range in %s on line %d
+Warning: shmop_write(): Offset out of range in %s on line %d
bool(false)
-
-## shmop_size function tests ##
-Warning: shmop_size() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-## shmop_delete function tests ##
-Warning: shmop_delete() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-## shmop_close function tests ##
-Warning: shmop_close() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
diff --git a/ext/simplexml/php_simplexml.h b/ext/simplexml/php_simplexml.h
index 09752229ac..164525d7b6 100644
--- a/ext/simplexml/php_simplexml.h
+++ b/ext/simplexml/php_simplexml.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/simplexml/php_simplexml_exports.h b/ext/simplexml/php_simplexml_exports.h
index 20e9785162..748a59317d 100644
--- a/ext/simplexml/php_simplexml_exports.h
+++ b/ext/simplexml/php_simplexml_exports.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
index 2cdff0e648..4e922e3ef0 100644
--- a/ext/simplexml/simplexml.c
+++ b/ext/simplexml/simplexml.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -30,6 +28,7 @@
#include "ext/standard/php_string.h"
#include "php_simplexml.h"
#include "php_simplexml_exports.h"
+#include "simplexml_arginfo.h"
#include "zend_exceptions.h"
#include "zend_interfaces.h"
#include "sxe.h"
@@ -50,13 +49,13 @@ PHP_SXE_API zend_class_entry *sxe_get_element_class_entry() /* {{{ */
static php_sxe_object* php_sxe_object_new(zend_class_entry *ce, zend_function *fptr_count);
static xmlNodePtr php_sxe_reset_iterator(php_sxe_object *sxe, int use_data);
static xmlNodePtr php_sxe_iterator_fetch(php_sxe_object *sxe, xmlNodePtr node, int use_data);
-static zval *sxe_get_value(zval *z, zval *rv);
static void php_sxe_iterator_dtor(zend_object_iterator *iter);
static int php_sxe_iterator_valid(zend_object_iterator *iter);
static zval *php_sxe_iterator_current_data(zend_object_iterator *iter);
static void php_sxe_iterator_current_key(zend_object_iterator *iter, zval *key);
static void php_sxe_iterator_move_forward(zend_object_iterator *iter);
static void php_sxe_iterator_rewind(zend_object_iterator *iter);
+static int sxe_object_cast_ex(zend_object *readobj, zval *writeobj, int type);
/* {{{ _node_as_zval()
*/
@@ -228,7 +227,7 @@ next_iter:
/* {{{ sxe_prop_dim_read()
*/
-static zval *sxe_prop_dim_read(zval *object, zval *member, zend_bool elements, zend_bool attribs, int type, zval *rv)
+static zval *sxe_prop_dim_read(zend_object *object, zval *member, zend_bool elements, zend_bool attribs, int type, zval *rv)
{
php_sxe_object *sxe;
char *name;
@@ -238,7 +237,7 @@ static zval *sxe_prop_dim_read(zval *object, zval *member, zend_bool elements, z
int nodendx = 0;
int test = 0;
- sxe = Z_SXEOBJ_P(object);
+ sxe = php_sxe_fetch_object(object);
if (!member) {
if (sxe->iter.type == SXE_ITER_ATTRLIST) {
@@ -369,15 +368,17 @@ long_dim:
/* {{{ sxe_property_read()
*/
-static zval *sxe_property_read(zval *object, zval *member, int type, void **cache_slot, zval *rv)
+static zval *sxe_property_read(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv)
{
- return sxe_prop_dim_read(object, member, 1, 0, type, rv);
+ zval member;
+ ZVAL_STR(&member, name);
+ return sxe_prop_dim_read(object, &member, 1, 0, type, rv);
}
/* }}} */
/* {{{ sxe_dimension_read()
*/
-static zval *sxe_dimension_read(zval *object, zval *offset, int type, zval *rv)
+static zval *sxe_dimension_read(zend_object *object, zval *offset, int type, zval *rv)
{
return sxe_prop_dim_read(object, offset, 0, 1, type, rv);
}
@@ -419,7 +420,7 @@ static void change_node_zval(xmlNodePtr node, zval *value)
/* {{{ sxe_property_write()
*/
-static zval *sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool elements, zend_bool attribs, xmlNodePtr *pnewnode)
+static zval *sxe_prop_dim_write(zend_object *object, zval *member, zval *value, zend_bool elements, zend_bool attribs, xmlNodePtr *pnewnode)
{
php_sxe_object *sxe;
xmlNodePtr node;
@@ -436,7 +437,7 @@ static zval *sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bo
zval tmp_zv, zval_copy;
zend_string *trim_str;
- sxe = Z_SXEOBJ_P(object);
+ sxe = php_sxe_fetch_object(object);
if (!member) {
if (sxe->iter.type == SXE_ITER_ATTRLIST) {
@@ -525,7 +526,12 @@ long_dim:
break;
case IS_OBJECT:
if (Z_OBJCE_P(value) == sxe_class_entry) {
- value = sxe_get_value(value, &zval_copy);
+ if (sxe_object_cast_ex(Z_OBJ_P(value), &zval_copy, IS_STRING) == FAILURE) {
+ zend_error(E_ERROR, "Unable to cast node to string");
+ /* FIXME: Should not be fatal */
+ }
+
+ value = &zval_copy;
new_value = 1;
break;
}
@@ -656,42 +662,41 @@ next_iter:
/* {{{ sxe_property_write()
*/
-static zval *sxe_property_write(zval *object, zval *member, zval *value, void **cache_slot)
+static zval *sxe_property_write(zend_object *object, zend_string *name, zval *value, void **cache_slot)
{
- zval *retval = sxe_prop_dim_write(object, member, value, 1, 0, NULL);
-
+ zval member;
+ ZVAL_STR(&member, name);
+ zval *retval = sxe_prop_dim_write(object, &member, value, 1, 0, NULL);
return retval == &EG(error_zval) ? &EG(uninitialized_zval) : retval;
}
/* }}} */
/* {{{ sxe_dimension_write()
*/
-static void sxe_dimension_write(zval *object, zval *offset, zval *value)
+static void sxe_dimension_write(zend_object *object, zval *offset, zval *value)
{
sxe_prop_dim_write(object, offset, value, 0, 1, NULL);
}
/* }}} */
-static zval *sxe_property_get_adr(zval *object, zval *member, int fetch_type, void **cache_slot) /* {{{ */
+static zval *sxe_property_get_adr(zend_object *object, zend_string *zname, int fetch_type, void **cache_slot) /* {{{ */
{
php_sxe_object *sxe;
xmlNodePtr node;
zval ret;
char *name;
SXE_ITER type;
+ zval member;
- if (!try_convert_to_string(member)) {
- return NULL;
- }
-
- sxe = Z_SXEOBJ_P(object);
+ sxe = php_sxe_fetch_object(object);
GET_NODE(sxe, node);
- name = Z_STRVAL_P(member);
+ name = ZSTR_VAL(zname);
node = sxe_get_element_by_name(sxe, node, &name, &type);
if (node) {
return NULL;
}
- if (sxe_prop_dim_write(object, member, NULL, 1, 0, &node) == &EG(error_zval)) {
+ ZVAL_STR(&member, zname);
+ if (sxe_prop_dim_write(object, &member, NULL, 1, 0, &node) == &EG(error_zval)) {
return NULL;
}
type = SXE_ITER_NONE;
@@ -711,7 +716,7 @@ static zval *sxe_property_get_adr(zval *object, zval *member, int fetch_type, vo
/* {{{ sxe_prop_dim_exists()
*/
-static int sxe_prop_dim_exists(zval *object, zval *member, int check_empty, zend_bool elements, zend_bool attribs)
+static int sxe_prop_dim_exists(zend_object *object, zval *member, int check_empty, zend_bool elements, zend_bool attribs)
{
php_sxe_object *sxe;
xmlNodePtr node;
@@ -729,7 +734,7 @@ static int sxe_prop_dim_exists(zval *object, zval *member, int check_empty, zend
member = &tmp_zv;
}
- sxe = Z_SXEOBJ_P(object);
+ sxe = php_sxe_fetch_object(object);
GET_NODE(sxe, node);
@@ -817,15 +822,17 @@ static int sxe_prop_dim_exists(zval *object, zval *member, int check_empty, zend
/* {{{ sxe_property_exists()
*/
-static int sxe_property_exists(zval *object, zval *member, int check_empty, void **cache_slot)
+static int sxe_property_exists(zend_object *object, zend_string *name, int check_empty, void **cache_slot)
{
- return sxe_prop_dim_exists(object, member, check_empty, 1, 0);
+ zval member;
+ ZVAL_STR(&member, name);
+ return sxe_prop_dim_exists(object, &member, check_empty, 1, 0);
}
/* }}} */
/* {{{ sxe_dimension_exists()
*/
-static int sxe_dimension_exists(zval *object, zval *member, int check_empty)
+static int sxe_dimension_exists(zend_object *object, zval *member, int check_empty)
{
return sxe_prop_dim_exists(object, member, check_empty, 0, 1);
}
@@ -833,7 +840,7 @@ static int sxe_dimension_exists(zval *object, zval *member, int check_empty)
/* {{{ sxe_prop_dim_delete()
*/
-static void sxe_prop_dim_delete(zval *object, zval *member, zend_bool elements, zend_bool attribs)
+static void sxe_prop_dim_delete(zend_object *object, zval *member, zend_bool elements, zend_bool attribs)
{
php_sxe_object *sxe;
xmlNodePtr node;
@@ -852,7 +859,7 @@ static void sxe_prop_dim_delete(zval *object, zval *member, zend_bool elements,
member = &tmp_zv;
}
- sxe = Z_SXEOBJ_P(object);
+ sxe = php_sxe_fetch_object(object);
GET_NODE(sxe, node);
@@ -944,15 +951,17 @@ next_iter:
/* {{{ sxe_property_delete()
*/
-static void sxe_property_delete(zval *object, zval *member, void **cache_slot)
+static void sxe_property_delete(zend_object *object, zend_string *name, void **cache_slot)
{
- sxe_prop_dim_delete(object, member, 1, 0);
+ zval member;
+ ZVAL_STR(&member, name);
+ sxe_prop_dim_delete(object, &member, 1, 0);
}
/* }}} */
/* {{{ sxe_dimension_unset()
*/
-static void sxe_dimension_delete(zval *object, zval *offset)
+static void sxe_dimension_delete(zend_object *object, zval *offset)
{
sxe_prop_dim_delete(object, offset, 0, 1);
}
@@ -1026,7 +1035,7 @@ static void sxe_properties_add(HashTable *rv, char *name, int namelen, zval *val
}
/* }}} */
-static int sxe_prop_is_empty(zval *object) /* {{{ */
+static int sxe_prop_is_empty(zend_object *object) /* {{{ */
{
php_sxe_object *sxe;
xmlNodePtr node;
@@ -1036,7 +1045,7 @@ static int sxe_prop_is_empty(zval *object) /* {{{ */
int is_empty;
int use_iter = 0;
- sxe = Z_SXEOBJ_P(object);
+ sxe = php_sxe_fetch_object(object);
GET_NODE(sxe, node);
if (!node) {
@@ -1119,7 +1128,7 @@ next_iter:
}
/* }}} */
-static HashTable *sxe_get_prop_hash(zval *object, int is_debug) /* {{{ */
+static HashTable *sxe_get_prop_hash(zend_object *object, int is_debug) /* {{{ */
{
zval value;
zval zattr;
@@ -1135,7 +1144,7 @@ static HashTable *sxe_get_prop_hash(zval *object, int is_debug) /* {{{ */
use_iter = 0;
- sxe = Z_SXEOBJ_P(object);
+ sxe = php_sxe_fetch_object(object);
if (is_debug) {
rv = zend_new_array(0);
@@ -1249,9 +1258,9 @@ next_iter:
}
/* }}} */
-static HashTable *sxe_get_gc(zval *object, zval **table, int *n) /* {{{ */ {
+static HashTable *sxe_get_gc(zend_object *object, zval **table, int *n) /* {{{ */ {
php_sxe_object *sxe;
- sxe = Z_SXEOBJ_P(object);
+ sxe = php_sxe_fetch_object(object);
*table = NULL;
*n = 0;
@@ -1259,13 +1268,13 @@ static HashTable *sxe_get_gc(zval *object, zval **table, int *n) /* {{{ */ {
}
/* }}} */
-static HashTable *sxe_get_properties(zval *object) /* {{{ */
+static HashTable *sxe_get_properties(zend_object *object) /* {{{ */
{
return sxe_get_prop_hash(object, 0);
}
/* }}} */
-static HashTable * sxe_get_debug_info(zval *object, int *is_temp) /* {{{ */
+static HashTable * sxe_get_debug_info(zend_object *object, int *is_temp) /* {{{ */
{
*is_temp = 1;
return sxe_get_prop_hash(object, 1);
@@ -1277,6 +1286,8 @@ static int sxe_objects_compare(zval *object1, zval *object2) /* {{{ */
php_sxe_object *sxe1;
php_sxe_object *sxe2;
+ ZEND_COMPARE_OBJECTS_FALLBACK(object1, object2);
+
sxe1 = Z_SXEOBJ_P(object1);
sxe2 = Z_SXEOBJ_P(object2);
@@ -1309,7 +1320,7 @@ SXE_METHOD(xpath)
xmlNodePtr nodeptr;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &query, &query_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
sxe = Z_SXEOBJ_P(ZEND_THIS);
@@ -1394,7 +1405,7 @@ SXE_METHOD(registerXPathNamespace)
char *prefix, *ns_uri;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &prefix, &prefix_len, &ns_uri, &ns_uri_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
sxe = Z_SXEOBJ_P(ZEND_THIS);
@@ -1403,7 +1414,7 @@ SXE_METHOD(registerXPathNamespace)
}
if (xmlXPathRegisterNs(sxe->xpath, (xmlChar *)prefix, (xmlChar *)ns_uri) != 0) {
- RETURN_FALSE
+ RETURN_FALSE;
}
RETURN_TRUE;
}
@@ -1419,88 +1430,76 @@ SXE_METHOD(asXML)
xmlOutputBufferPtr outbuf;
xmlChar *strval;
int strval_len;
- char *filename;
+ char *filename = NULL;
size_t filename_len;
- if (ZEND_NUM_ARGS() > 1) {
- RETURN_FALSE;
- }
-
- if (ZEND_NUM_ARGS() == 1) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &filename, &filename_len) == FAILURE) {
- RETURN_FALSE;
- }
-
- sxe = Z_SXEOBJ_P(ZEND_THIS);
- GET_NODE(sxe, node);
- node = php_sxe_get_first_node(sxe, node);
-
- if (node) {
- if (node->parent && (XML_DOCUMENT_NODE == node->parent->type)) {
- int bytes;
- bytes = xmlSaveFile(filename, (xmlDocPtr) sxe->document->ptr);
- if (bytes == -1) {
- RETURN_FALSE;
- } else {
- RETURN_TRUE;
- }
- } else {
- outbuf = xmlOutputBufferCreateFilename(filename, NULL, 0);
-
- if (outbuf == NULL) {
- RETURN_FALSE;
- }
-
- xmlNodeDumpOutput(outbuf, (xmlDocPtr) sxe->document->ptr, node, 0, 0, NULL);
- xmlOutputBufferClose(outbuf);
- RETURN_TRUE;
- }
- } else {
- RETURN_FALSE;
- }
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|p", &filename, &filename_len) == FAILURE) {
+ RETURN_THROWS();
}
sxe = Z_SXEOBJ_P(ZEND_THIS);
GET_NODE(sxe, node);
node = php_sxe_get_first_node(sxe, node);
- if (node) {
+ if (!node) {
+ RETURN_FALSE;
+ }
+
+ if (filename) {
if (node->parent && (XML_DOCUMENT_NODE == node->parent->type)) {
- xmlDocDumpMemoryEnc((xmlDocPtr) sxe->document->ptr, &strval, &strval_len, (const char *) ((xmlDocPtr) sxe->document->ptr)->encoding);
- if (!strval) {
- RETVAL_FALSE;
+ int bytes;
+ bytes = xmlSaveFile(filename, (xmlDocPtr) sxe->document->ptr);
+ if (bytes == -1) {
+ RETURN_FALSE;
} else {
- RETVAL_STRINGL((char *)strval, strval_len);
+ RETURN_TRUE;
}
- xmlFree(strval);
} else {
- char *return_content;
- size_t return_len;
- /* Should we be passing encoding information instead of NULL? */
- outbuf = xmlAllocOutputBuffer(NULL);
+ outbuf = xmlOutputBufferCreateFilename(filename, NULL, 0);
if (outbuf == NULL) {
RETURN_FALSE;
}
- xmlNodeDumpOutput(outbuf, (xmlDocPtr) sxe->document->ptr, node, 0, 0, (const char *) ((xmlDocPtr) sxe->document->ptr)->encoding);
- xmlOutputBufferFlush(outbuf);
+ xmlNodeDumpOutput(outbuf, (xmlDocPtr) sxe->document->ptr, node, 0, 0, NULL);
+ xmlOutputBufferClose(outbuf);
+ RETURN_TRUE;
+ }
+ }
+
+ if (node->parent && (XML_DOCUMENT_NODE == node->parent->type)) {
+ xmlDocDumpMemoryEnc((xmlDocPtr) sxe->document->ptr, &strval, &strval_len, (const char *) ((xmlDocPtr) sxe->document->ptr)->encoding);
+ if (!strval) {
+ RETVAL_FALSE;
+ } else {
+ RETVAL_STRINGL((char *)strval, strval_len);
+ }
+ xmlFree(strval);
+ } else {
+ char *return_content;
+ size_t return_len;
+ /* Should we be passing encoding information instead of NULL? */
+ outbuf = xmlAllocOutputBuffer(NULL);
+
+ if (outbuf == NULL) {
+ RETURN_FALSE;
+ }
+
+ xmlNodeDumpOutput(outbuf, (xmlDocPtr) sxe->document->ptr, node, 0, 0, (const char *) ((xmlDocPtr) sxe->document->ptr)->encoding);
+ xmlOutputBufferFlush(outbuf);
#ifdef LIBXML2_NEW_BUFFER
- return_content = (char *)xmlOutputBufferGetContent(outbuf);
- return_len = xmlOutputBufferGetSize(outbuf);
+ return_content = (char *)xmlOutputBufferGetContent(outbuf);
+ return_len = xmlOutputBufferGetSize(outbuf);
#else
- return_content = (char *)outbuf->buffer->content;
- return_len = outbuf->buffer->use;
+ return_content = (char *)outbuf->buffer->content;
+ return_len = outbuf->buffer->use;
#endif
- if (!return_content) {
- RETVAL_FALSE;
- } else {
- RETVAL_STRINGL(return_content, return_len);
- }
- xmlOutputBufferClose(outbuf);
+ if (!return_content) {
+ RETVAL_FALSE;
+ } else {
+ RETVAL_STRINGL(return_content, return_len);
}
- } else {
- RETVAL_FALSE;
+ xmlOutputBufferClose(outbuf);
}
}
/* }}} */
@@ -1557,7 +1556,7 @@ SXE_METHOD(getNamespaces)
xmlNodePtr node;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &recursive) == FAILURE) {
- return;
+ RETURN_THROWS();
}
array_init(return_value);
@@ -1606,7 +1605,7 @@ SXE_METHOD(getDocNamespaces)
xmlNodePtr node;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|bb", &recursive, &from_root) == FAILURE) {
- return;
+ RETURN_THROWS();
}
sxe = Z_SXEOBJ_P(ZEND_THIS);
@@ -1636,7 +1635,7 @@ SXE_METHOD(children)
zend_bool isprefix = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!b", &nsprefix, &nsprefix_len, &isprefix) == FAILURE) {
- return;
+ RETURN_THROWS();
}
sxe = Z_SXEOBJ_P(ZEND_THIS);
@@ -1661,6 +1660,10 @@ SXE_METHOD(getName)
xmlNodePtr node;
int namelen;
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
sxe = Z_SXEOBJ_P(ZEND_THIS);
GET_NODE(sxe, node);
@@ -1685,7 +1688,7 @@ SXE_METHOD(attributes)
zend_bool isprefix = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!b", &nsprefix, &nsprefix_len, &isprefix) == FAILURE) {
- return;
+ RETURN_THROWS();
}
sxe = Z_SXEOBJ_P(ZEND_THIS);
@@ -1714,7 +1717,7 @@ SXE_METHOD(addChild)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s!s!",
&qname, &qname_len, &value, &value_len, &nsuri, &nsuri_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (qname_len == 0) {
@@ -1780,7 +1783,7 @@ SXE_METHOD(addAttribute)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|s!",
&qname, &qname_len, &value, &value_len, &nsuri, &nsuri_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (qname_len == 0) {
@@ -1875,14 +1878,14 @@ static int cast_object(zval *object, int type, char *contents)
/* {{{ sxe_object_cast()
*/
-static int sxe_object_cast_ex(zval *readobj, zval *writeobj, int type)
+static int sxe_object_cast_ex(zend_object *readobj, zval *writeobj, int type)
{
php_sxe_object *sxe;
xmlChar *contents = NULL;
xmlNodePtr node;
int rv;
- sxe = Z_SXEOBJ_P(readobj);
+ sxe = php_sxe_fetch_object(readobj);
if (type == _IS_BOOL) {
node = php_sxe_get_first_node(sxe, NULL);
@@ -1924,7 +1927,7 @@ static int sxe_object_cast_ex(zval *readobj, zval *writeobj, int type)
/* }}} */
/* {{{ Variant of sxe_object_cast_ex that handles overwritten __toString() method */
-static int sxe_object_cast(zval *readobj, zval *writeobj, int type)
+static int sxe_object_cast(zend_object *readobj, zval *writeobj, int type)
{
if (type == IS_STRING
&& zend_std_cast_object_tostring(readobj, writeobj, IS_STRING) == SUCCESS
@@ -1940,7 +1943,11 @@ static int sxe_object_cast(zval *readobj, zval *writeobj, int type)
Returns the string content */
SXE_METHOD(__toString)
{
- if (sxe_object_cast_ex(ZEND_THIS, return_value, IS_STRING) != SUCCESS) {
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
+ if (sxe_object_cast_ex(Z_OBJ_P(ZEND_THIS), return_value, IS_STRING) != SUCCESS) {
zval_ptr_dtor(return_value);
RETURN_EMPTY_STRING();
}
@@ -1974,10 +1981,10 @@ static int php_sxe_count_elements_helper(php_sxe_object *sxe, zend_long *count)
}
/* }}} */
-static int sxe_count_elements(zval *object, zend_long *count) /* {{{ */
+static int sxe_count_elements(zend_object *object, zend_long *count) /* {{{ */
{
php_sxe_object *intern;
- intern = Z_SXEOBJ_P(object);
+ intern = php_sxe_fetch_object(object);
if (intern->fptr_count) {
zval rv;
zend_call_method_with_0_params(object, intern->zo.ce, &intern->fptr_count, "count", &rv);
@@ -2000,7 +2007,7 @@ SXE_METHOD(count)
php_sxe_object *sxe = Z_SXEOBJ_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
php_sxe_count_elements_helper(sxe, &count);
@@ -2009,25 +2016,14 @@ SXE_METHOD(count)
}
/* }}} */
-static zval *sxe_get_value(zval *z, zval *rv) /* {{{ */
-{
- if (sxe_object_cast_ex(z, rv, IS_STRING) == FAILURE) {
- zend_error(E_ERROR, "Unable to cast node to string");
- /* FIXME: Should not be fatal */
- }
-
- return rv;
-}
-/* }}} */
-
static zend_object_handlers sxe_object_handlers;
/* {{{ sxe_object_clone()
*/
static zend_object *
-sxe_object_clone(zval *object)
+sxe_object_clone(zend_object *object)
{
- php_sxe_object *sxe = Z_SXEOBJ_P(object);
+ php_sxe_object *sxe = php_sxe_fetch_object(object);
php_sxe_object *clone;
xmlNodePtr nodep = NULL;
xmlDocPtr docp = NULL;
@@ -2186,7 +2182,7 @@ PHP_FUNCTION(simplexml_load_file)
zend_bool isprefix = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|C!lsb", &filename, &filename_len, &ce, &options, &ns, &ns_len, &isprefix) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (ZEND_LONG_EXCEEDS_INT(options)) {
@@ -2232,7 +2228,7 @@ PHP_FUNCTION(simplexml_load_string)
zend_bool isprefix = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|C!lsb", &data, &data_len, &ce, &options, &ns, &ns_len, &isprefix) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (ZEND_SIZE_T_INT_OVFL(data_len)) {
@@ -2281,21 +2277,21 @@ SXE_METHOD(__construct)
zend_long options = 0;
zend_bool is_url = 0, isprefix = 0;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "s|lbsb", &data, &data_len, &options, &is_url, &ns, &ns_len, &isprefix) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|lbsb", &data, &data_len, &options, &is_url, &ns, &ns_len, &isprefix) == FAILURE) {
+ RETURN_THROWS();
}
if (ZEND_SIZE_T_INT_OVFL(data_len)) {
zend_throw_exception(zend_ce_exception, "Data is too long", 0);
- return;
+ RETURN_THROWS();
}
if (ZEND_SIZE_T_INT_OVFL(ns_len)) {
zend_throw_exception(zend_ce_exception, "Namespace is too long", 0);
- return;
+ RETURN_THROWS();
}
if (ZEND_LONG_EXCEEDS_INT(options)) {
zend_throw_exception(zend_ce_exception, "Invalid options", 0);
- return;
+ RETURN_THROWS();
}
docp = is_url ? xmlReadFile(data, NULL, (int)options) : xmlReadMemory(data, (int)data_len, NULL, NULL, (int)options);
@@ -2303,7 +2299,7 @@ SXE_METHOD(__construct)
if (!docp) {
((php_libxml_node_object *)sxe)->document = NULL;
zend_throw_exception(zend_ce_exception, "String could not be parsed as XML", 0);
- return;
+ RETURN_THROWS();
}
sxe->iter.nsprefix = ns_len ? (xmlChar*)estrdup(ns) : NULL;
@@ -2535,7 +2531,7 @@ PHP_FUNCTION(simplexml_import_dom)
zend_function *fptr_count;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "o|C!", &node, &ce) == FAILURE) {
- return;
+ RETURN_THROWS();
}
object = Z_LIBXML_NODE_P(node);
@@ -2572,73 +2568,6 @@ PHP_FUNCTION(simplexml_import_dom)
}
/* }}} */
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_simplexml_load_file, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, class_name)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, ns)
- ZEND_ARG_INFO(0, is_prefix)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_simplexml_load_string, 0, 0, 1)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, class_name)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, ns)
- ZEND_ARG_INFO(0, is_prefix)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_simplexml_import_dom, 0, 0, 1)
- ZEND_ARG_INFO(0, node)
- ZEND_ARG_INFO(0, class_name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_simplexmlelement_xpath, 0, 0, 1)
- ZEND_ARG_INFO(0, path)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_simplexmlelement_registerxpathnamespace, 0, 0, 2)
- ZEND_ARG_INFO(0, prefix)
- ZEND_ARG_INFO(0, ns)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_simplexmlelement_asxml, 0, 0, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_simplexmlelement_getnamespaces, 0, 0, 0)
- ZEND_ARG_INFO(0, recursve)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_simplexmlelement_getdocnamespaces, 0, 0, 0)
- ZEND_ARG_INFO(0, recursve)
- ZEND_ARG_INFO(0, from_root)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_simplexmlelement_children, 0, 0, 0)
- ZEND_ARG_INFO(0, ns)
- ZEND_ARG_INFO(0, is_prefix)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_simplexmlelement__construct, 0, 0, 1)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, data_is_url)
- ZEND_ARG_INFO(0, ns)
- ZEND_ARG_INFO(0, is_prefix)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_simplexmlelement__void, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_simplexmlelement_addchild, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, value)
- ZEND_ARG_INFO(0, ns)
-ZEND_END_ARG_INFO()
-/* }}} */
-
static const zend_function_entry simplexml_functions[] = { /* {{{ */
PHP_FE(simplexml_load_file, arginfo_simplexml_load_file)
PHP_FE(simplexml_load_string, arginfo_simplexml_load_string)
@@ -2676,20 +2605,20 @@ ZEND_GET_MODULE(simplexml)
/* the method table */
/* each method can have its own parameters and visibility */
static const zend_function_entry sxe_functions[] = { /* {{{ */
- SXE_ME(__construct, arginfo_simplexmlelement__construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) /* must be called */
- SXE_ME(asXML, arginfo_simplexmlelement_asxml, ZEND_ACC_PUBLIC)
- SXE_MALIAS(saveXML, asXML, arginfo_simplexmlelement_asxml, ZEND_ACC_PUBLIC)
- SXE_ME(xpath, arginfo_simplexmlelement_xpath, ZEND_ACC_PUBLIC)
- SXE_ME(registerXPathNamespace, arginfo_simplexmlelement_registerxpathnamespace, ZEND_ACC_PUBLIC)
- SXE_ME(attributes, arginfo_simplexmlelement_children, ZEND_ACC_PUBLIC)
- SXE_ME(children, arginfo_simplexmlelement_children, ZEND_ACC_PUBLIC)
- SXE_ME(getNamespaces, arginfo_simplexmlelement_getnamespaces, ZEND_ACC_PUBLIC)
- SXE_ME(getDocNamespaces, arginfo_simplexmlelement_getdocnamespaces, ZEND_ACC_PUBLIC)
- SXE_ME(getName, arginfo_simplexmlelement__void, ZEND_ACC_PUBLIC)
- SXE_ME(addChild, arginfo_simplexmlelement_addchild, ZEND_ACC_PUBLIC)
- SXE_ME(addAttribute, arginfo_simplexmlelement_addchild, ZEND_ACC_PUBLIC)
- SXE_ME(__toString, arginfo_simplexmlelement__void, ZEND_ACC_PUBLIC)
- SXE_ME(count, arginfo_simplexmlelement__void, ZEND_ACC_PUBLIC)
+ SXE_ME(__construct, arginfo_class_SimpleXMLElement___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) /* must be called */
+ SXE_ME(asXML, arginfo_class_SimpleXMLElement_asXML, ZEND_ACC_PUBLIC)
+ SXE_MALIAS(saveXML, asXML, arginfo_class_SimpleXMLElement_saveXML, ZEND_ACC_PUBLIC)
+ SXE_ME(xpath, arginfo_class_SimpleXMLElement_xpath, ZEND_ACC_PUBLIC)
+ SXE_ME(registerXPathNamespace, arginfo_class_SimpleXMLElement_registerXPathNamespace, ZEND_ACC_PUBLIC)
+ SXE_ME(attributes, arginfo_class_SimpleXMLElement_attributes, ZEND_ACC_PUBLIC)
+ SXE_ME(children, arginfo_class_SimpleXMLElement_children, ZEND_ACC_PUBLIC)
+ SXE_ME(getNamespaces, arginfo_class_SimpleXMLElement_getNamespaces, ZEND_ACC_PUBLIC)
+ SXE_ME(getDocNamespaces, arginfo_class_SimpleXMLElement_getDocNamespaces, ZEND_ACC_PUBLIC)
+ SXE_ME(getName, arginfo_class_SimpleXMLElement_getName, ZEND_ACC_PUBLIC)
+ SXE_ME(addChild, arginfo_class_SimpleXMLElement_addChild, ZEND_ACC_PUBLIC)
+ SXE_ME(addAttribute, arginfo_class_SimpleXMLElement_addAttribute, ZEND_ACC_PUBLIC)
+ SXE_ME(__toString, arginfo_class_SimpleXMLElement___toString, ZEND_ACC_PUBLIC)
+ SXE_ME(count, arginfo_class_SimpleXMLElement_count, ZEND_ACC_PUBLIC)
PHP_FE_END
};
/* }}} */
@@ -2716,13 +2645,12 @@ PHP_MINIT_FUNCTION(simplexml)
sxe_object_handlers.read_dimension = sxe_dimension_read;
sxe_object_handlers.write_dimension = sxe_dimension_write;
sxe_object_handlers.get_property_ptr_ptr = sxe_property_get_adr;
- sxe_object_handlers.get = sxe_get_value;
sxe_object_handlers.has_property = sxe_property_exists;
sxe_object_handlers.unset_property = sxe_property_delete;
sxe_object_handlers.has_dimension = sxe_dimension_exists;
sxe_object_handlers.unset_dimension = sxe_dimension_delete;
sxe_object_handlers.get_properties = sxe_get_properties;
- sxe_object_handlers.compare_objects = sxe_objects_compare;
+ sxe_object_handlers.compare = sxe_objects_compare;
sxe_object_handlers.cast_object = sxe_object_cast;
sxe_object_handlers.count_elements = sxe_count_elements;
sxe_object_handlers.get_debug_info = sxe_get_debug_info;
diff --git a/ext/simplexml/simplexml.stub.php b/ext/simplexml/simplexml.stub.php
new file mode 100644
index 0000000000..3a1d0d51f4
--- /dev/null
+++ b/ext/simplexml/simplexml.stub.php
@@ -0,0 +1,51 @@
+<?php
+
+function simplexml_load_file(string $filename, ?string $class_name = SimpleXMLElement::class, int $options = 0, string $ns = '', bool $is_prefix = false): SimpleXMLElement|false {}
+
+function simplexml_load_string(string $data, ?string $class_name = SimpleXMLElement::class, int $options = 0, string $ns = '', bool $is_prefix = false): SimpleXMLElement|false {}
+
+function simplexml_import_dom(DOMNode $node, ?string $class_name = SimpleXMLElement::class): ?SimpleXMLElement {}
+
+class SimpleXMLElement
+{
+ /** @return array|false */
+ public function xpath(string $path) {}
+
+ /** @return bool */
+ public function registerXPathNamespace(string $prefix, string $ns) {}
+
+ /** @return string|bool */
+ public function asXML(string $filename = UNKNOWN) {}
+
+ /** @return string|bool */
+ public function saveXML(string $filename = UNKNOWN) {}
+
+ /** @return array */
+ public function getNamespaces(bool $recursive = false) {}
+
+ /** @return array|false */
+ public function getDocNamespaces(bool $recursive = false, bool $from_root = true) {}
+
+ /** @return SimpleXMLIterator */
+ public function children(?string $ns = null, bool $is_prefix = false) {}
+
+ /** @return SimpleXMLIterator */
+ public function attributes(?string $ns = null, bool $is_prefix = false) {}
+
+ public function __construct(string $data, int $options = 0, bool $data_is_url = false, string $ns = '', bool $is_prefix = false) {}
+
+ /** @return SimpleXMLElement */
+ public function addChild(string $name, ?string $value = null, ?string $ns = null) {}
+
+ /** @return SimpleXMLElement */
+ public function addAttribute(string $name, ?string $value = null, ?string $ns = null) {}
+
+ /** @return string */
+ public function getName() {}
+
+ /** @return string */
+ public function __toString() {}
+
+ /** @return int */
+ public function count() {}
+}
diff --git a/ext/simplexml/simplexml_arginfo.h b/ext/simplexml/simplexml_arginfo.h
new file mode 100644
index 0000000000..b44426beeb
--- /dev/null
+++ b/ext/simplexml/simplexml_arginfo.h
@@ -0,0 +1,76 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_simplexml_load_file, 0, 1, SimpleXMLElement, MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, class_name, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, ns, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, is_prefix, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_simplexml_load_string, 0, 1, SimpleXMLElement, MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, class_name, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, ns, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, is_prefix, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_simplexml_import_dom, 0, 1, SimpleXMLElement, 1)
+ ZEND_ARG_OBJ_INFO(0, node, DOMNode, 0)
+ ZEND_ARG_TYPE_INFO(0, class_name, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SimpleXMLElement_xpath, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SimpleXMLElement_registerXPathNamespace, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, prefix, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, ns, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SimpleXMLElement_asXML, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SimpleXMLElement_saveXML arginfo_class_SimpleXMLElement_asXML
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SimpleXMLElement_getNamespaces, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, recursive, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SimpleXMLElement_getDocNamespaces, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, recursive, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, from_root, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SimpleXMLElement_children, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, ns, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, is_prefix, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SimpleXMLElement_attributes arginfo_class_SimpleXMLElement_children
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SimpleXMLElement___construct, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, data_is_url, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, ns, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, is_prefix, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SimpleXMLElement_addChild, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, ns, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SimpleXMLElement_addAttribute arginfo_class_SimpleXMLElement_addChild
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SimpleXMLElement_getName, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SimpleXMLElement___toString arginfo_class_SimpleXMLElement_getName
+
+#define arginfo_class_SimpleXMLElement_count arginfo_class_SimpleXMLElement_getName
diff --git a/ext/simplexml/sxe.c b/ext/simplexml/sxe.c
index c60e37e264..8c9d050dcb 100644
--- a/ext/simplexml/sxe.c
+++ b/ext/simplexml/sxe.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -29,6 +27,7 @@
#include "ext/spl/php_spl.h"
#include "ext/spl/spl_iterators.h"
#include "sxe.h"
+#include "sxe_arginfo.h"
PHP_SXE_API zend_class_entry *ce_SimpleXMLIterator = NULL;
PHP_SXE_API zend_class_entry *ce_SimpleXMLElement;
@@ -40,7 +39,7 @@ PHP_SXE_API zend_class_entry *ce_SimpleXMLElement;
PHP_METHOD(ce_SimpleXMLIterator, rewind)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
php_sxe_rewind_iterator(Z_SXEOBJ_P(ZEND_THIS));
@@ -54,7 +53,7 @@ PHP_METHOD(ce_SimpleXMLIterator, valid)
php_sxe_object *sxe = Z_SXEOBJ_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_BOOL(!Z_ISUNDEF(sxe->iter.data));
@@ -69,7 +68,7 @@ PHP_METHOD(ce_SimpleXMLIterator, current)
zval *data;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (Z_ISUNDEF(sxe->iter.data)) {
@@ -90,7 +89,7 @@ PHP_METHOD(ce_SimpleXMLIterator, key)
php_sxe_object *sxe = Z_SXEOBJ_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (Z_ISUNDEF(sxe->iter.data)) {
@@ -112,7 +111,7 @@ PHP_METHOD(ce_SimpleXMLIterator, key)
PHP_METHOD(ce_SimpleXMLIterator, next)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
php_sxe_move_forward_iterator(Z_SXEOBJ_P(ZEND_THIS));
@@ -128,7 +127,7 @@ PHP_METHOD(ce_SimpleXMLIterator, hasChildren)
xmlNodePtr node;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (Z_ISUNDEF(sxe->iter.data) || sxe->iter.type == SXE_ITER_ATTRLIST) {
@@ -155,7 +154,7 @@ PHP_METHOD(ce_SimpleXMLIterator, getChildren)
zval *data;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (Z_ISUNDEF(sxe->iter.data) || sxe->iter.type == SXE_ITER_ATTRLIST) {
@@ -166,19 +165,14 @@ PHP_METHOD(ce_SimpleXMLIterator, getChildren)
ZVAL_COPY_DEREF(return_value, data);
}
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO(arginfo_simplexmliterator__void, 0)
-ZEND_END_ARG_INFO()
-/* }}} */
-
static const zend_function_entry funcs_SimpleXMLIterator[] = {
- PHP_ME(ce_SimpleXMLIterator, rewind, arginfo_simplexmliterator__void, ZEND_ACC_PUBLIC)
- PHP_ME(ce_SimpleXMLIterator, valid, arginfo_simplexmliterator__void, ZEND_ACC_PUBLIC)
- PHP_ME(ce_SimpleXMLIterator, current, arginfo_simplexmliterator__void, ZEND_ACC_PUBLIC)
- PHP_ME(ce_SimpleXMLIterator, key, arginfo_simplexmliterator__void, ZEND_ACC_PUBLIC)
- PHP_ME(ce_SimpleXMLIterator, next, arginfo_simplexmliterator__void, ZEND_ACC_PUBLIC)
- PHP_ME(ce_SimpleXMLIterator, hasChildren, arginfo_simplexmliterator__void, ZEND_ACC_PUBLIC)
- PHP_ME(ce_SimpleXMLIterator, getChildren, arginfo_simplexmliterator__void, ZEND_ACC_PUBLIC)
+ PHP_ME(ce_SimpleXMLIterator, rewind, arginfo_class_SimpleXMLIterator_rewind, ZEND_ACC_PUBLIC)
+ PHP_ME(ce_SimpleXMLIterator, valid, arginfo_class_SimpleXMLIterator_valid, ZEND_ACC_PUBLIC)
+ PHP_ME(ce_SimpleXMLIterator, current, arginfo_class_SimpleXMLIterator_current, ZEND_ACC_PUBLIC)
+ PHP_ME(ce_SimpleXMLIterator, key, arginfo_class_SimpleXMLIterator_key, ZEND_ACC_PUBLIC)
+ PHP_ME(ce_SimpleXMLIterator, next, arginfo_class_SimpleXMLIterator_next, ZEND_ACC_PUBLIC)
+ PHP_ME(ce_SimpleXMLIterator, hasChildren, arginfo_class_SimpleXMLIterator_hasChildren, ZEND_ACC_PUBLIC)
+ PHP_ME(ce_SimpleXMLIterator, getChildren, arginfo_class_SimpleXMLIterator_getChildren, ZEND_ACC_PUBLIC)
PHP_FE_END
};
/* }}} */
diff --git a/ext/simplexml/sxe.h b/ext/simplexml/sxe.h
index 6806553acc..771ddea4bb 100644
--- a/ext/simplexml/sxe.h
+++ b/ext/simplexml/sxe.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/simplexml/sxe.stub.php b/ext/simplexml/sxe.stub.php
new file mode 100644
index 0000000000..98ea3327ba
--- /dev/null
+++ b/ext/simplexml/sxe.stub.php
@@ -0,0 +1,25 @@
+<?php
+
+class SimpleXMLIterator
+{
+ /** @return void */
+ public function rewind() {}
+
+ /** @return bool */
+ public function valid() {}
+
+ /** @return ?SimpleXMLElement */
+ public function current() {}
+
+ /** @return string|false */
+ public function key() {}
+
+ /** @return void */
+ public function next() {}
+
+ /** @return bool */
+ public function hasChildren() {}
+
+ /** @return ?SimpleXMLIterator */
+ public function getChildren() {}
+}
diff --git a/ext/simplexml/sxe_arginfo.h b/ext/simplexml/sxe_arginfo.h
new file mode 100644
index 0000000000..d3b0c6c479
--- /dev/null
+++ b/ext/simplexml/sxe_arginfo.h
@@ -0,0 +1,16 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SimpleXMLIterator_rewind, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SimpleXMLIterator_valid arginfo_class_SimpleXMLIterator_rewind
+
+#define arginfo_class_SimpleXMLIterator_current arginfo_class_SimpleXMLIterator_rewind
+
+#define arginfo_class_SimpleXMLIterator_key arginfo_class_SimpleXMLIterator_rewind
+
+#define arginfo_class_SimpleXMLIterator_next arginfo_class_SimpleXMLIterator_rewind
+
+#define arginfo_class_SimpleXMLIterator_hasChildren arginfo_class_SimpleXMLIterator_rewind
+
+#define arginfo_class_SimpleXMLIterator_getChildren arginfo_class_SimpleXMLIterator_rewind
diff --git a/ext/simplexml/tests/000.phpt b/ext/simplexml/tests/000.phpt
index d70a038ffa..453865ef34 100644
--- a/ext/simplexml/tests/000.phpt
+++ b/ext/simplexml/tests/000.phpt
@@ -9,12 +9,12 @@ $sxe = simplexml_load_file(__DIR__.'/000.xml');
function test($what)
{
- global $sxe;
- echo "===$what\n";
- eval("var_dump(isset(\$$what));");
- eval("var_dump((bool)\$$what);");
- eval("if (isset(\$$what)) var_dump(count(\$$what));");
- eval("var_dump(\$$what);");
+ global $sxe;
+ echo "===$what\n";
+ eval("var_dump(isset(\$$what));");
+ eval("var_dump((bool)\$$what);");
+ eval("if (isset(\$$what)) var_dump(count(\$$what));");
+ eval("var_dump(\$$what);");
}
test('sxe');
@@ -35,8 +35,6 @@ test('sxe->elem22->attr22');
test('sxe->elem22["attr22"]');
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
===sxe
bool(true)
@@ -244,4 +242,3 @@ NULL
bool(false)
bool(false)
NULL
-===DONE===
diff --git a/ext/simplexml/tests/001-mb.phpt b/ext/simplexml/tests/001-mb.phpt
index ada0f7d352..860f5e0974 100644
--- a/ext/simplexml/tests/001-mb.phpt
+++ b/ext/simplexml/tests/001-mb.phpt
@@ -8,7 +8,6 @@ SimpleXML: Simple document
var_dump(simplexml_load_file(__DIR__.'/sxeç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.xml'));
?>
-===DONE===
--EXPECTF--
object(SimpleXMLElement)#%d (2) {
["@attributes"]=>
@@ -40,4 +39,3 @@ object(SimpleXMLElement)#%d (2) {
}
}
}
-===DONE===
diff --git a/ext/simplexml/tests/001.phpt b/ext/simplexml/tests/001.phpt
index 5820c55325..37f94363c5 100644
--- a/ext/simplexml/tests/001.phpt
+++ b/ext/simplexml/tests/001.phpt
@@ -8,7 +8,6 @@ SimpleXML: Simple document
var_dump(simplexml_load_file(__DIR__.'/sxe.xml'));
?>
-===DONE===
--EXPECTF--
object(SimpleXMLElement)#%d (2) {
["@attributes"]=>
@@ -40,4 +39,3 @@ object(SimpleXMLElement)#%d (2) {
}
}
}
-===DONE===
diff --git a/ext/simplexml/tests/002.phpt b/ext/simplexml/tests/002.phpt
index 1d8ba4032a..108ddb6424 100644
--- a/ext/simplexml/tests/002.phpt
+++ b/ext/simplexml/tests/002.phpt
@@ -29,7 +29,6 @@ $copy = clone $sxe;
var_dump($copy);
?>
-===DONE===
--EXPECTF--
object(SimpleXMLElement)#%d (2) {
["@attributes"]=>
@@ -61,4 +60,3 @@ object(SimpleXMLElement)#%d (2) {
}
}
}
-===DONE===
diff --git a/ext/simplexml/tests/003.phpt b/ext/simplexml/tests/003.phpt
index 5b989b85d4..55a74a55ba 100644
--- a/ext/simplexml/tests/003.phpt
+++ b/ext/simplexml/tests/003.phpt
@@ -29,7 +29,6 @@ EOF;
var_dump(simplexml_load_string($xml));
?>
-===DONE===
--EXPECTF--
object(SimpleXMLElement)#%d (2) {
["@attributes"]=>
@@ -66,4 +65,3 @@ object(SimpleXMLElement)#%d (2) {
}
}
}
-===DONE===
diff --git a/ext/simplexml/tests/004.phpt b/ext/simplexml/tests/004.phpt
index ffb4db0db6..b4493a3c5d 100644
--- a/ext/simplexml/tests/004.phpt
+++ b/ext/simplexml/tests/004.phpt
@@ -32,7 +32,6 @@ $elem2 = $elem1->elem2;
var_dump(trim((string)$elem2));
?>
-===DONE===
--EXPECTF--
object(SimpleXMLElement)#%d (2) {
["@attributes"]=>
@@ -65,4 +64,3 @@ object(SimpleXMLElement)#%d (2) {
}
}
string(11) "CDATA block"
-===DONE===
diff --git a/ext/simplexml/tests/006.phpt b/ext/simplexml/tests/006.phpt
index bf4270f449..5798e913c0 100644
--- a/ext/simplexml/tests/006.phpt
+++ b/ext/simplexml/tests/006.phpt
@@ -34,33 +34,32 @@ EOF
);
foreach($sxe as $name => $data) {
- var_dump($name);
- var_dump(trim($data));
+ var_dump($name);
+ var_dump(trim($data));
}
echo "===CLONE===\n";
foreach(clone $sxe as $name => $data) {
- var_dump($name);
- var_dump(trim($data));
+ var_dump($name);
+ var_dump(trim($data));
}
echo "===ELEMENT===\n";
foreach($sxe->elem11 as $name => $data) {
- var_dump($name);
- var_dump(trim($data));
+ var_dump($name);
+ var_dump(trim($data));
}
echo "===COMMENT===\n";
foreach($sxe->elem1 as $name => $data) {
- var_dump($name);
- var_dump(trim($data));
+ var_dump($name);
+ var_dump(trim($data));
}
?>
-===DONE===
--EXPECT--
string(5) "elem1"
string(10) "Bla bla 1."
@@ -77,4 +76,3 @@ string(10) "Bla bla 2."
===COMMENT===
string(5) "elem1"
string(10) "Bla bla 1."
-===DONE===
diff --git a/ext/simplexml/tests/007.phpt b/ext/simplexml/tests/007.phpt
index 065e794c48..fbd9439dca 100644
--- a/ext/simplexml/tests/007.phpt
+++ b/ext/simplexml/tests/007.phpt
@@ -45,7 +45,6 @@ var_dump($a);
$dummy = $sxe->elem1[$a];
var_dump($a);
?>
-===Done===
--EXPECTF--
===Property===
object(SimpleXMLElement)#%d (3) {
@@ -94,4 +93,3 @@ NULL
===Misc.===
int(4)
int(4)
-===Done===
diff --git a/ext/simplexml/tests/009.phpt b/ext/simplexml/tests/009.phpt
index 2800f3add9..4b2e685c36 100644
--- a/ext/simplexml/tests/009.phpt
+++ b/ext/simplexml/tests/009.phpt
@@ -29,12 +29,11 @@ $sxe = simplexml_load_string(<<<EOF
EOF
);
foreach($sxe->children() as $name=>$val) {
- var_dump($name);
- var_dump(get_class($val));
- var_dump(trim($val));
+ var_dump($name);
+ var_dump(get_class($val));
+ var_dump(trim($val));
}
?>
-===DONE===
--EXPECT--
string(5) "elem1"
string(16) "SimpleXMLElement"
@@ -42,4 +41,3 @@ string(10) "Bla bla 1."
string(6) "elem11"
string(16) "SimpleXMLElement"
string(10) "Bla bla 2."
-===DONE===
diff --git a/ext/simplexml/tests/009b.phpt b/ext/simplexml/tests/009b.phpt
index fd920e2e26..bc651fe744 100644
--- a/ext/simplexml/tests/009b.phpt
+++ b/ext/simplexml/tests/009b.phpt
@@ -18,8 +18,6 @@ EOF
);
var_dump($sxe->children());
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
object(SimpleXMLElement)#%d (3) {
["@attributes"]=>
@@ -32,4 +30,3 @@ object(SimpleXMLElement)#%d (3) {
["elem11"]=>
string(10) "Bla bla 2."
}
-===DONE===
diff --git a/ext/simplexml/tests/010.phpt b/ext/simplexml/tests/010.phpt
index 63daf800d1..e251472d15 100644
--- a/ext/simplexml/tests/010.phpt
+++ b/ext/simplexml/tests/010.phpt
@@ -29,7 +29,6 @@ EOF;
var_dump(simplexml_load_string($xml, 'simplexml_inherited'));
?>
-===DONE===
--EXPECTF--
object(simplexml_inherited)#%d (2) {
["@attributes"]=>
@@ -61,4 +60,3 @@ object(simplexml_inherited)#%d (2) {
}
}
}
-===DONE===
diff --git a/ext/simplexml/tests/011.phpt b/ext/simplexml/tests/011.phpt
index 1d5c193f3b..06f3e791c3 100644
--- a/ext/simplexml/tests/011.phpt
+++ b/ext/simplexml/tests/011.phpt
@@ -34,7 +34,6 @@ echo "===BAZ1===\n";
print $sxe->baz[1];
echo "\n";
?>
-===DONE===
--EXPECT--
===BAR===
bar
@@ -44,4 +43,3 @@ baz1
baz1
===BAZ1===
baz2
-===DONE===
diff --git a/ext/simplexml/tests/013.phpt b/ext/simplexml/tests/013.phpt
index cf58461451..59e6672a1f 100644
--- a/ext/simplexml/tests/013.phpt
+++ b/ext/simplexml/tests/013.phpt
@@ -17,7 +17,5 @@ $sxe = simplexml_load_string($xml);
var_dump((string)$sxe);
?>
-===DONE===
--EXPECT--
string(6) "barbar"
-===DONE===
diff --git a/ext/simplexml/tests/014.phpt b/ext/simplexml/tests/014.phpt
index b0c1dd952f..b1681582f9 100644
--- a/ext/simplexml/tests/014.phpt
+++ b/ext/simplexml/tests/014.phpt
@@ -29,7 +29,6 @@ var_dump($people->person['age']);
$people->person['age'] += 5;
var_dump($people->person['age']);
?>
-===DONE===
--EXPECTF--
object(SimpleXMLElement)#%d (1) {
[0]=>
@@ -57,4 +56,3 @@ object(SimpleXMLElement)#%d (1) {
[0]=>
string(2) "35"
}
-===DONE===
diff --git a/ext/simplexml/tests/014a.phpt b/ext/simplexml/tests/014a.phpt
index f778c25f12..98fda260c8 100644
--- a/ext/simplexml/tests/014a.phpt
+++ b/ext/simplexml/tests/014a.phpt
@@ -28,7 +28,6 @@ var_dump($people->person[0]['age']);
$people->person['age'] += 5;
var_dump($people->person[0]['age']);
?>
-===DONE===
--EXPECTF--
object(SimpleXMLElement)#%d (1) {
[0]=>
@@ -53,4 +52,3 @@ object(SimpleXMLElement)#%d (1) {
[0]=>
string(1) "5"
}
-===DONE===
diff --git a/ext/simplexml/tests/014b.phpt b/ext/simplexml/tests/014b.phpt
index 0daa9c5c97..14d45491df 100644
--- a/ext/simplexml/tests/014b.phpt
+++ b/ext/simplexml/tests/014b.phpt
@@ -28,7 +28,6 @@ echo "---Unsupported---\n";
$people->person[1]['age'] += 5;
var_dump($people->person[1]['age']);
?>
-===DONE===
--EXPECTF--
object(SimpleXMLElement)#%d (1) {
[0]=>
@@ -52,4 +51,3 @@ object(SimpleXMLElement)#%d (1) {
[0]=>
string(1) "5"
}
-===DONE===
diff --git a/ext/simplexml/tests/015.phpt b/ext/simplexml/tests/015.phpt
index d80d4d114c..977eab756a 100644
--- a/ext/simplexml/tests/015.phpt
+++ b/ext/simplexml/tests/015.phpt
@@ -35,7 +35,6 @@ $people = simplexml_load_string($xml2);
var_dump($people->person[0]['name']);
var_dump($people->person[1]['name']);
?>
-===DONE===
--EXPECTF--
object(SimpleXMLElement)#%d (1) {
[0]=>
@@ -53,4 +52,3 @@ object(SimpleXMLElement)#%d (1) {
[0]=>
string(3) "Boe"
}
-===DONE===
diff --git a/ext/simplexml/tests/016.phpt b/ext/simplexml/tests/016.phpt
index 97981214db..59b64e0b48 100644
--- a/ext/simplexml/tests/016.phpt
+++ b/ext/simplexml/tests/016.phpt
@@ -27,7 +27,6 @@ $people->person[0]['name'] .= 'Bar';
var_dump($people->person[0]['name']);
?>
-===DONE===
--EXPECTF--
object(SimpleXMLElement)#%d (1) {
[0]=>
@@ -54,4 +53,3 @@ object(SimpleXMLElement)#%d (1) {
[0]=>
string(9) "JoeFooBar"
}
-===DONE===
diff --git a/ext/simplexml/tests/016a.phpt b/ext/simplexml/tests/016a.phpt
index 7cc8b33123..06dbfeb303 100644
--- a/ext/simplexml/tests/016a.phpt
+++ b/ext/simplexml/tests/016a.phpt
@@ -16,7 +16,6 @@ $people->person['name'] .= 'Bar';
var_dump($people->person['name']);
?>
-===DONE===
--EXPECTF--
object(SimpleXMLElement)#%d (1) {
[0]=>
@@ -26,4 +25,3 @@ object(SimpleXMLElement)#%d (1) {
[0]=>
string(6) "FooBar"
}
-===DONE===
diff --git a/ext/simplexml/tests/017.phpt b/ext/simplexml/tests/017.phpt
index 42d6e3eccc..3b399149cd 100644
--- a/ext/simplexml/tests/017.phpt
+++ b/ext/simplexml/tests/017.phpt
@@ -52,7 +52,6 @@ print_xml2(simplexml_load_string($xml));
echo "---22---\n";
print_xml2(simplexml_load_string($xml1));
?>
-===DONE===
--EXPECT--
---11---
person: Joe
@@ -74,4 +73,3 @@ person: Boe
---22---
person: Joe
child: Ann
-===DONE===
diff --git a/ext/simplexml/tests/019.phpt b/ext/simplexml/tests/019.phpt
index db15a69ff7..47bb9aa571 100644
--- a/ext/simplexml/tests/019.phpt
+++ b/ext/simplexml/tests/019.phpt
@@ -34,33 +34,32 @@ EOF
);
foreach($sxe->children() as $name => $data) {
- var_dump($name);
- var_dump(trim($data));
+ var_dump($name);
+ var_dump(trim($data));
}
echo "===CLONE===\n";
foreach(clone $sxe->children() as $name => $data) {
- var_dump($name);
- var_dump(trim($data));
+ var_dump($name);
+ var_dump(trim($data));
}
echo "===ELEMENT===\n";
foreach($sxe->elem11->children() as $name => $data) {
- var_dump($name);
- var_dump(trim($data));
+ var_dump($name);
+ var_dump(trim($data));
}
echo "===COMMENT===\n";
foreach($sxe->elem1->children() as $name => $data) {
- var_dump($name);
- var_dump(trim($data));
+ var_dump($name);
+ var_dump(trim($data));
}
?>
-===DONE===
--EXPECT--
string(5) "elem1"
string(10) "Bla bla 1."
@@ -77,4 +76,3 @@ string(7) "Foo Bar"
===COMMENT===
string(5) "elem2"
string(28) "Here we have some text data."
-===DONE===
diff --git a/ext/simplexml/tests/020.phpt b/ext/simplexml/tests/020.phpt
index 40d04a7927..028b917f04 100644
--- a/ext/simplexml/tests/020.phpt
+++ b/ext/simplexml/tests/020.phpt
@@ -14,8 +14,6 @@ if ($doc->name["attr"] == "foo") {
print "Error\n";
}
?>
-===DONE===
--EXPECT--
foo
Works
-===DONE===
diff --git a/ext/simplexml/tests/021.phpt b/ext/simplexml/tests/021.phpt
index c2b38d30ae..ac5a589e9b 100644
--- a/ext/simplexml/tests/021.phpt
+++ b/ext/simplexml/tests/021.phpt
@@ -8,10 +8,10 @@ SimpleXML: Element check
$ok = 1;
$doc = simplexml_load_string('<root><exists>foo</exists></root>');
if(!isset($doc->exists)) {
- $ok *= 0;
+ $ok *= 0;
}
if(isset($doc->doesnotexist)) {
- $ok *= 0;
+ $ok *= 0;
}
if ($ok) {
print "Works\n";
@@ -19,7 +19,5 @@ if ($ok) {
print "Error\n";
}
?>
-===DONE===
--EXPECT--
Works
-===DONE===
diff --git a/ext/simplexml/tests/022.phpt b/ext/simplexml/tests/022.phpt
index 338b61d0ed..de4663fd41 100644
--- a/ext/simplexml/tests/022.phpt
+++ b/ext/simplexml/tests/022.phpt
@@ -21,12 +21,11 @@ var_dump($sxe->content->file);
echo "===FOREACH===\n";
foreach($sxe->content->file as $file)
{
- var_dump($file);
- var_dump($file['glob']);
+ var_dump($file);
+ var_dump($file['glob']);
}
?>
-===DONE===
--EXPECTF--
===CONTENT===
object(SimpleXMLElement)#%d (1) {
@@ -59,4 +58,3 @@ object(SimpleXMLElement)#%d (1) {
[0]=>
string(11) "slide_*.xml"
}
-===DONE===
diff --git a/ext/simplexml/tests/023.phpt b/ext/simplexml/tests/023.phpt
index 9ae6ec8813..59ea90dc02 100644
--- a/ext/simplexml/tests/023.phpt
+++ b/ext/simplexml/tests/023.phpt
@@ -20,7 +20,6 @@ $sxe = simplexml_load_string($xml);
var_dump($sxe);
var_dump($sxe['attr']);
?>
-===DONE===
--EXPECTF--
object(SimpleXMLElement)#%d (1) {
["@attributes"]=>
@@ -33,4 +32,3 @@ object(SimpleXMLElement)#%d (1) {
[0]=>
string(%d) "foo%sbar%sbaz"
}
-===DONE===
diff --git a/ext/simplexml/tests/024.phpt b/ext/simplexml/tests/024.phpt
index 9f31fd5e93..2c52ddbc91 100644
--- a/ext/simplexml/tests/024.phpt
+++ b/ext/simplexml/tests/024.phpt
@@ -18,10 +18,10 @@ $sxe = simplexml_load_string($xml);
function test($xpath)
{
- global $sxe;
+ global $sxe;
- echo "===$xpath===\n";
- var_dump($sxe->xpath($xpath));
+ echo "===$xpath===\n";
+ var_dump($sxe->xpath($xpath));
}
test('elem/@attr2');
@@ -30,7 +30,6 @@ test('//@*');
test('elem[2]/@attr2');
?>
-===DONE===
--EXPECTF--
===elem/@attr2===
array(3) {
@@ -172,4 +171,3 @@ array(1) {
}
}
}
-===DONE===
diff --git a/ext/simplexml/tests/025.phpt b/ext/simplexml/tests/025.phpt
index 955410a5ee..a4acdc7331 100644
--- a/ext/simplexml/tests/025.phpt
+++ b/ext/simplexml/tests/025.phpt
@@ -46,8 +46,6 @@ var_dump($sxe->getNamespaces());
var_dump($sxe->getDocNamespaces());
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
array(1) {
["xhtml"]=>
@@ -89,4 +87,3 @@ array(0) {
}
array(0) {
}
-===DONE===
diff --git a/ext/simplexml/tests/026.phpt b/ext/simplexml/tests/026.phpt
index cf17c7d513..d93cd1fe79 100644
--- a/ext/simplexml/tests/026.phpt
+++ b/ext/simplexml/tests/026.phpt
@@ -31,10 +31,8 @@ $people = simplexml_load_string($xml);
traverse_xml($people);
?>
-===DONE===
--EXPECT--
<people>
<person>Jane
</person>
</people>
-===DONE===
diff --git a/ext/simplexml/tests/027.phpt b/ext/simplexml/tests/027.phpt
index 193456aace..4cb60d7793 100644
--- a/ext/simplexml/tests/027.phpt
+++ b/ext/simplexml/tests/027.phpt
@@ -42,7 +42,6 @@ traverse_xml($people);
$people->person[3]['gender'] = 'error';
traverse_xml($people);
?>
-===DONE===
--EXPECTF--
<people>
</people>
@@ -80,4 +79,3 @@ Warning: main(): Cannot add element person number 3 when only 2 such elements ex
<person gender="error">
</person>
</people>
-===DONE===
diff --git a/ext/simplexml/tests/028.phpt b/ext/simplexml/tests/028.phpt
index c68cfd21b9..4199d36804 100644
--- a/ext/simplexml/tests/028.phpt
+++ b/ext/simplexml/tests/028.phpt
@@ -31,7 +31,6 @@ $people->person['name'] = 'John';
traverse_xml($people);
?>
-===DONE===
--EXPECT--
<people>
</people>
@@ -39,4 +38,3 @@ traverse_xml($people);
<person name="John">
</person>
</people>
-===DONE===
diff --git a/ext/simplexml/tests/029.phpt b/ext/simplexml/tests/029.phpt
index 5a31c7d197..2b9193bc4b 100644
--- a/ext/simplexml/tests/029.phpt
+++ b/ext/simplexml/tests/029.phpt
@@ -20,13 +20,12 @@ $people = simplexml_load_string($xml);
foreach($people as $person)
{
- var_dump((string)$person['name']);
- var_dump(count($people));
- var_dump(count($person));
+ var_dump((string)$person['name']);
+ var_dump(count($people));
+ var_dump(count($person));
}
?>
-===DONE===
--EXPECT--
string(3) "Joe"
int(3)
@@ -37,4 +36,3 @@ int(1)
string(4) "Jane"
int(3)
int(0)
-===DONE===
diff --git a/ext/simplexml/tests/030.phpt b/ext/simplexml/tests/030.phpt
index 4d27f40ed1..7bd8a03491 100644
--- a/ext/simplexml/tests/030.phpt
+++ b/ext/simplexml/tests/030.phpt
@@ -5,7 +5,7 @@ SimpleXML: isset and unset by offset
--FILE--
<?php
$xml =<<<EOF
-<root s:att1="b" att1="a"
+<root s:att1="b" att1="a"
xmlns:s="urn::test" xmlns:t="urn::test-t">
<child1>test</child1>
<child1>test 2</child1>
@@ -30,7 +30,6 @@ var_dump(isset($atts[0]));
var_dump(isset($atts[TRUE]));
?>
-===DONE===
--EXPECT--
test
test 2
@@ -41,4 +40,3 @@ bool(false)
bool(true)
bool(false)
bool(false)
-===DONE===
diff --git a/ext/simplexml/tests/031.phpt b/ext/simplexml/tests/031.phpt
index 143e57f59e..c370f9ad18 100644
--- a/ext/simplexml/tests/031.phpt
+++ b/ext/simplexml/tests/031.phpt
@@ -5,7 +5,7 @@ SimpleXML: addChild and addAttribute
--FILE--
<?php
$xml =<<<EOF
-<root s:att1="b" att1="a"
+<root s:att1="b" att1="a"
xmlns:s="urn::test" xmlns:t="urn::test-t">
<child1>test</child1>
<child1>test 2</child1>
@@ -43,7 +43,6 @@ $sxe->addChild('s:test5', 'myval');
echo $sxe->asXML();
?>
-===DONE===
--EXPECTF--
Warning: SimpleXMLElement::addAttribute(): Attribute already exists in %s031.php on line %d
@@ -54,4 +53,3 @@ Warning: SimpleXMLElement::addChild(): Cannot add element to attributes in %s031
<child1>test 2</child1>
<s:child3/>
<s:test1>myval</s:test1><m:test2 xmlns:m="urn::testnew">myval</m:test2><test3 xmlns="urn::testnew">myval</test3><test4>myval</test4><test5>myval</test5></root>
-===DONE===
diff --git a/ext/simplexml/tests/032.phpt b/ext/simplexml/tests/032.phpt
index c1d0b88b62..d09281d057 100644
--- a/ext/simplexml/tests/032.phpt
+++ b/ext/simplexml/tests/032.phpt
@@ -37,9 +37,7 @@ var_dump($people2 == $people);
var_dump($people2 == $people1);
?>
-===DONE===
--EXPECT--
bool(false)
bool(false)
bool(false)
-===DONE===
diff --git a/ext/simplexml/tests/033.phpt b/ext/simplexml/tests/033.phpt
index ba01b21555..437af7d41f 100644
--- a/ext/simplexml/tests/033.phpt
+++ b/ext/simplexml/tests/033.phpt
@@ -35,7 +35,6 @@ var_dump((object)$foo);
var_dump((object)$people);
?>
-===DONE===
--EXPECTF--
bool(false)
bool(true)
@@ -134,4 +133,3 @@ object(SimpleXMLElement)#%d (1) {
}
}
}
-===DONE===
diff --git a/ext/simplexml/tests/035.phpt b/ext/simplexml/tests/035.phpt
index 2162c865f3..f6e911962c 100644
--- a/ext/simplexml/tests/035.phpt
+++ b/ext/simplexml/tests/035.phpt
@@ -18,9 +18,7 @@ echo $p."\n";
echo $p->__toString()."\n";
echo $p."\n";
?>
-==Done==
--EXPECT--
Blah 1
Blah 1
Blah 1
-==Done==
diff --git a/ext/simplexml/tests/036.phpt b/ext/simplexml/tests/036.phpt
index 24bfe60e7d..acd67c01c6 100644
--- a/ext/simplexml/tests/036.phpt
+++ b/ext/simplexml/tests/036.phpt
@@ -1,5 +1,5 @@
--TEST--
-SimpleXML: overriden count() method
+SimpleXML: overridden count() method
--SKIPIF--
<?php if (!extension_loaded("simplexml")) print "skip"; ?>
--FILE--
@@ -15,8 +15,6 @@ $str = '<xml><c>asdf</c><c>ghjk</c></xml>';
$sxe = new SXE($str);
var_dump(count($sxe));
?>
-==Done==
--EXPECT--
Called Count!
int(2)
-==Done==
diff --git a/ext/simplexml/tests/037.phpt b/ext/simplexml/tests/037.phpt
index 7a141658c7..b18b7fec41 100644
--- a/ext/simplexml/tests/037.phpt
+++ b/ext/simplexml/tests/037.phpt
@@ -9,7 +9,5 @@ $str = '<xml></xml>';
$sxe = new SimpleXmlElement($str);
var_dump($sxe instanceof Countable);
?>
-==Done==
--EXPECT--
bool(true)
-==Done==
diff --git a/ext/simplexml/tests/SimpleXMLElement_addAttribute_basic.phpt b/ext/simplexml/tests/SimpleXMLElement_addAttribute_basic.phpt
index 52f6222eea..8c512c6252 100644
--- a/ext/simplexml/tests/SimpleXMLElement_addAttribute_basic.phpt
+++ b/ext/simplexml/tests/SimpleXMLElement_addAttribute_basic.phpt
@@ -4,11 +4,11 @@ SimpleXMLElement->addAttribute()
<?php if (!extension_loaded("simplexml")) die("skip"); ?>
--FILE--
<?php
- $simple = simplexml_load_file(__DIR__."/book.xml");
- $simple->addAttribute('type','novels');
+ $simple = simplexml_load_file(__DIR__."/book.xml");
+ $simple->addAttribute('type','novels');
- var_dump($simple->attributes());
- echo "Done";
+ var_dump($simple->attributes());
+ echo "Done";
?>
--EXPECT--
object(SimpleXMLElement)#2 (1) {
diff --git a/ext/simplexml/tests/SimpleXMLElement_xpath_3.phpt b/ext/simplexml/tests/SimpleXMLElement_xpath_3.phpt
deleted file mode 100644
index 8682cf818d..0000000000
--- a/ext/simplexml/tests/SimpleXMLElement_xpath_3.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-Testing xpath() with invalid XML
---SKIPIF--
-<?php
-if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platforms only");
-?>
---FILE--
-<?php
-$xml = simplexml_load_string("XXXXXXX^",$x,0x6000000000000001);
-var_dump($xml->xpath("BBBB"));
-?>
---EXPECTF--
-Notice: Undefined variable: x in %s on line %d
-
-Warning: simplexml_load_string() expects parameter 3 to be int, float given in %s on line %d
-
-Fatal error: Uncaught Error: Call to a member function xpath() on null in %s:%d
-Stack trace:
-#0 {main}
- thrown in %s on line %d
diff --git a/ext/simplexml/tests/SimpleXMLElement_xpath_4.phpt b/ext/simplexml/tests/SimpleXMLElement_xpath_4.phpt
index 28e0517651..c050ca2dd4 100644
--- a/ext/simplexml/tests/SimpleXMLElement_xpath_4.phpt
+++ b/ext/simplexml/tests/SimpleXMLElement_xpath_4.phpt
@@ -11,7 +11,7 @@ $xml = simplexml_load_string("XXXXXXX^",$x,0x6000000000000001);
var_dump($xml);
?>
--EXPECTF--
-Notice: Undefined variable: x in %s on line %d
+Warning: Undefined variable: x in %s on line %d
Warning: simplexml_load_string(): Invalid options in %s on line %d
bool(false)
diff --git a/ext/simplexml/tests/bug24392.phpt b/ext/simplexml/tests/bug24392.phpt
index 08d73c630d..0a0c16b9a9 100644
--- a/ext/simplexml/tests/bug24392.phpt
+++ b/ext/simplexml/tests/bug24392.phpt
@@ -6,7 +6,7 @@ Bug #24392 (empty namespaces causing confusion)
<?php
$s = simplexml_load_file(__DIR__.'/bug24392.xml');
foreach ($s->item as $item) {
- echo $item->title . "\n";
+ echo $item->title . "\n";
}
?>
--EXPECT--
diff --git a/ext/simplexml/tests/bug27010.phpt b/ext/simplexml/tests/bug27010.phpt
index 364ca4675f..e512fbd7b2 100644
--- a/ext/simplexml/tests/bug27010.phpt
+++ b/ext/simplexml/tests/bug27010.phpt
@@ -25,10 +25,8 @@ foreach ($sxe->children('http://www.example.com/hot') as $element_name => $eleme
}
?>
-===DONE===
--EXPECT--
drink is Cola
drink is Juice
drink is Coffee
drink is Tea
-===DONE===
diff --git a/ext/simplexml/tests/bug35785.phpt b/ext/simplexml/tests/bug35785.phpt
index 10bae9ca10..420515bb03 100644
--- a/ext/simplexml/tests/bug35785.phpt
+++ b/ext/simplexml/tests/bug35785.phpt
@@ -16,8 +16,6 @@ $xml = simplexml_load_string("<root></root>");
$xml->bla->posts[]->name = "FooBar";
echo $xml->asXML();
?>
-===DONE===
-<?php exit(0); __halt_compiler(); ?>
--EXPECT--
<?xml version="1.0"?>
<root><bla><posts><name>FooBar</name></posts></bla></root>
@@ -26,4 +24,3 @@ bool(false)
<root><bla><posts><name>FooBar</name></posts></bla></root>
<?xml version="1.0"?>
<root><bla><posts><name>FooBar</name></posts></bla></root>
-===DONE===
diff --git a/ext/simplexml/tests/bug36611.phpt b/ext/simplexml/tests/bug36611.phpt
index 34c92ce0bc..672e11c750 100644
--- a/ext/simplexml/tests/bug36611.phpt
+++ b/ext/simplexml/tests/bug36611.phpt
@@ -23,8 +23,6 @@ $xml->pos["act_idx"] = $val;
var_dump($val);
?>
-===DONE===
--EXPECT--
int(1)
int(1)
-===DONE===
diff --git a/ext/simplexml/tests/bug37076.phpt b/ext/simplexml/tests/bug37076.phpt
index c7f19b3cc2..41e2f9a4c2 100644
--- a/ext/simplexml/tests/bug37076.phpt
+++ b/ext/simplexml/tests/bug37076.phpt
@@ -9,8 +9,6 @@ $xml->foo = "foo";
$xml->foo .= "bar";
print $xml->asXML();
?>
-===DONE===
--EXPECT--
<?xml version="1.0"?>
<root><foo>foobar</foo></root>
-===DONE===
diff --git a/ext/simplexml/tests/bug37076_1.phpt b/ext/simplexml/tests/bug37076_1.phpt
index d4f4e03337..019915a1b4 100644
--- a/ext/simplexml/tests/bug37076_1.phpt
+++ b/ext/simplexml/tests/bug37076_1.phpt
@@ -8,11 +8,9 @@ $xml = simplexml_load_string("<root><foo /></root>");
$xml->{""} .= "bar";
print $xml->asXML();
?>
-===DONE===
--EXPECTF--
Warning: main(): Cannot write or create unnamed element in %s on line %d
Warning: main(): Cannot write or create unnamed element in %s on line %d
<?xml version="1.0"?>
<root><foo/></root>
-===DONE===
diff --git a/ext/simplexml/tests/bug37565.phpt b/ext/simplexml/tests/bug37565.phpt
index 41e42cb907..53508dc9b6 100644
--- a/ext/simplexml/tests/bug37565.phpt
+++ b/ext/simplexml/tests/bug37565.phpt
@@ -6,7 +6,7 @@ Bug #37565 (Using reflection::export with simplexml causing a crash)
<?php
function my_error_handler($errno, $errstr, $errfile, $errline) {
- echo "Error: $errstr\n";
+ echo "Error: $errstr\n";
}
set_error_handler('my_error_handler');
@@ -16,24 +16,18 @@ class Setting extends ReflectionObject
}
try {
- Reflection::export(simplexml_load_string('<test/>', 'Setting'));
+ Reflection::export(simplexml_load_string('<test/>', 'Setting'));
} catch (Error $e) {
- my_error_handler($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
+ my_error_handler($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
}
try {
- Reflection::export(simplexml_load_file('data:,<test/>', 'Setting'));
+ Reflection::export(simplexml_load_file('data:,<test/>', 'Setting'));
} catch (Error $e) {
- my_error_handler($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
+ my_error_handler($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
}
?>
-===DONE===
--EXPECT--
Error: simplexml_load_string() expects parameter 2 to be a class name derived from SimpleXMLElement, 'Setting' given
-Error: Function Reflection::export() is deprecated
-Error: Argument 1 passed to Reflection::export() must implement interface Reflector, null given
Error: simplexml_load_file() expects parameter 2 to be a class name derived from SimpleXMLElement, 'Setting' given
-Error: Function Reflection::export() is deprecated
-Error: Argument 1 passed to Reflection::export() must implement interface Reflector, null given
-===DONE===
diff --git a/ext/simplexml/tests/bug38354.phpt b/ext/simplexml/tests/bug38354.phpt
index 7bd18fe649..9554280177 100644
--- a/ext/simplexml/tests/bug38354.phpt
+++ b/ext/simplexml/tests/bug38354.phpt
@@ -7,20 +7,20 @@ Bug #38354 (Unwanted reformatting of XML when using AsXML)
$xml = simplexml_load_string(
'<code>
- <a href="javascript:alert(\'1\');"><strong>Item Two</strong></a>
+ <a href="javascript:alert(\'1\');"><strong>Item Two</strong></a>
</code>'
);
foreach ($xml->xpath("//*") as $element) {
- var_dump($element->asXML());
+ var_dump($element->asXML());
}
echo "Done\n";
?>
--EXPECT--
-string(101) "<?xml version="1.0"?>
+string(104) "<?xml version="1.0"?>
<code>
- <a href="javascript:alert('1');"><strong>Item Two</strong></a>
+ <a href="javascript:alert('1');"><strong>Item Two</strong></a>
</code>
"
string(62) "<a href="javascript:alert('1');"><strong>Item Two</strong></a>"
diff --git a/ext/simplexml/tests/bug38406.phpt b/ext/simplexml/tests/bug38406.phpt
index ea92229496..51a716cbd3 100644
--- a/ext/simplexml/tests/bug38406.phpt
+++ b/ext/simplexml/tests/bug38406.phpt
@@ -27,7 +27,7 @@ object(SimpleXMLElement)#%d (1) {
string(9) "something"
}
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
Warning: It is not yet possible to assign complex types to properties in %s on line %d
Done
diff --git a/ext/simplexml/tests/bug40451.phpt b/ext/simplexml/tests/bug40451.phpt
index cf44926a5e..7cb01c031f 100644
--- a/ext/simplexml/tests/bug40451.phpt
+++ b/ext/simplexml/tests/bug40451.phpt
@@ -7,9 +7,9 @@ Bug #40451 (addAttribute() may crash when used with non-existent child node)
$string = <<<XML
<?xml version="1.0"?>
- <Host enable="true">
- <Name>host.server.com</Name>
- </Host>
+ <Host enable="true">
+ <Name>host.server.com</Name>
+ </Host>
XML;
$xml = simplexml_load_string($string);
@@ -18,7 +18,5 @@ $add = $xml->addChild('Host');
$add->Host->addAttribute('enable', 'true');
?>
-===DONE===
--EXPECTF--
Warning: SimpleXMLElement::addAttribute(): Unable to locate parent Element in %s on line %d
-===DONE===
diff --git a/ext/simplexml/tests/bug41175.phpt b/ext/simplexml/tests/bug41175.phpt
index ae0204e05a..587eecd265 100644
--- a/ext/simplexml/tests/bug41175.phpt
+++ b/ext/simplexml/tests/bug41175.phpt
@@ -11,8 +11,6 @@ $xml->addAttribute("alt", "");
echo $xml->asXML();
?>
-===DONE===
--EXPECT--
<?xml version="1.0"?>
<img src="foo" alt=""/>
-===DONE===
diff --git a/ext/simplexml/tests/bug41582.phpt b/ext/simplexml/tests/bug41582.phpt
index 8733810d71..b270f3b639 100644
--- a/ext/simplexml/tests/bug41582.phpt
+++ b/ext/simplexml/tests/bug41582.phpt
@@ -13,8 +13,6 @@ $xml->movie[]->characters->character[0]->name = 'Miss Coder';
echo($xml->asXml());
?>
-===DONE===
--EXPECT--
<?xml version="1.0" standalone="yes"?>
<collection><movie><characters><character><name>Miss Coder</name></character></characters></movie></collection>
-===DONE===
diff --git a/ext/simplexml/tests/bug41861.phpt b/ext/simplexml/tests/bug41861.phpt
index 607d301f7b..f87c061449 100644
--- a/ext/simplexml/tests/bug41861.phpt
+++ b/ext/simplexml/tests/bug41861.phpt
@@ -6,11 +6,11 @@ Bug #41861 (getNamespaces() returns the namespaces of a node's siblings)
<?php
$xml = simplexml_load_string('<root>
- <first_node_no_ns />
- <ns1:node1 xmlns:ns1="#ns1" />
- <ns2:node2 xmlns:ns2="#ns2" />
- <ns3:node3 xmlns:ns3="#ns3" />
- <last_node_no_ns />
+ <first_node_no_ns />
+ <ns1:node1 xmlns:ns1="#ns1" />
+ <ns2:node2 xmlns:ns2="#ns2" />
+ <ns3:node3 xmlns:ns3="#ns3" />
+ <last_node_no_ns />
</root>');
$name = $xml->getName();
@@ -21,16 +21,15 @@ echo "root(non-recursive): '$name' -- namespaces: ", implode(', ', $namespaces),
foreach (array(null, '#ns1', '#ns2', '#ns3') as $ns)
{
- foreach ($xml->children($ns) as $child)
- {
- $name = $child->getName();
- $namespaces = $child->getNamespaces(false);
+ foreach ($xml->children($ns) as $child)
+ {
+ $name = $child->getName();
+ $namespaces = $child->getNamespaces(false);
- echo "children($ns): '$name' -- namespaces: ", implode(', ', $namespaces), "\n";
- }
+ echo "children($ns): '$name' -- namespaces: ", implode(', ', $namespaces), "\n";
+ }
}
?>
-===DONE===
--EXPECT--
root(recursive): 'root' -- namespaces: #ns1, #ns2, #ns3
root(non-recursive): 'root' -- namespaces:
@@ -39,4 +38,3 @@ children(): 'last_node_no_ns' -- namespaces:
children(#ns1): 'node1' -- namespaces: #ns1
children(#ns2): 'node2' -- namespaces: #ns2
children(#ns3): 'node3' -- namespaces: #ns3
-===DONE===
diff --git a/ext/simplexml/tests/bug41867.phpt b/ext/simplexml/tests/bug41867.phpt
index 33e2de9e22..4c0b3ac1b5 100644
--- a/ext/simplexml/tests/bug41867.phpt
+++ b/ext/simplexml/tests/bug41867.phpt
@@ -10,9 +10,7 @@ echo $a->getName()."\n";
echo $a->b->getName()."\n";
echo $a->b->c->getName()."\n";
?>
-===DONE===
--EXPECT--
a
b
c
-===DONE===
diff --git a/ext/simplexml/tests/bug41947.phpt b/ext/simplexml/tests/bug41947.phpt
index 0b974ce4f5..69e1ed0283 100644
--- a/ext/simplexml/tests/bug41947.phpt
+++ b/ext/simplexml/tests/bug41947.phpt
@@ -12,7 +12,5 @@ if (count($gchild) > 0) {
echo $gchild[0]."\n";
}
?>
-===DONE===
--EXPECT--
hello
-===DONE===
diff --git a/ext/simplexml/tests/bug42259.phpt b/ext/simplexml/tests/bug42259.phpt
index 19c02a577a..f817291cdd 100644
--- a/ext/simplexml/tests/bug42259.phpt
+++ b/ext/simplexml/tests/bug42259.phpt
@@ -37,7 +37,6 @@ foreach ($rit as $child) {
echo count($ancestry) . ' steps: ' . $path . PHP_EOL;
}
?>
-===DONE===
--EXPECT--
3 steps: xml/fieldset1/field1
3 steps: xml/fieldset1/field2
@@ -46,4 +45,3 @@ foreach ($rit as $child) {
4 steps: xml/fieldset2/options/option3
3 steps: xml/fieldset2/field1
3 steps: xml/fieldset2/field2
-===DONE===
diff --git a/ext/simplexml/tests/bug42369.phpt b/ext/simplexml/tests/bug42369.phpt
index f8e030526c..44781b76d3 100644
--- a/ext/simplexml/tests/bug42369.phpt
+++ b/ext/simplexml/tests/bug42369.phpt
@@ -18,8 +18,6 @@ Bug #42369 (Implicit conversion to string leaks memory)
}
?>
-===DONE===
--EXPECT--
explicit conversion
no conversion
-===DONE===
diff --git a/ext/simplexml/tests/bug43221.phpt b/ext/simplexml/tests/bug43221.phpt
index bac2277597..a0ef582ec0 100644
--- a/ext/simplexml/tests/bug43221.phpt
+++ b/ext/simplexml/tests/bug43221.phpt
@@ -11,10 +11,8 @@ $n->addAttribute("c", "d", "http://bar.com");
$n->addAttribute("foo:e", "f", "http://bar.com");
print_r($xml->asXml());
?>
-===DONE===
--EXPECTF--
Warning: SimpleXMLElement::addAttribute(): Attribute requires prefix for namespace in %sbug43221.php on line %d
<?xml version="1.0" encoding="utf-8"?>
<root><node xmlns:foo="http://bar.com" a="b" foo:e="f">value</node></root>
-===DONE===
diff --git a/ext/simplexml/tests/bug44478.phpt b/ext/simplexml/tests/bug44478.phpt
index 34630593f8..013fceb235 100644
--- a/ext/simplexml/tests/bug44478.phpt
+++ b/ext/simplexml/tests/bug44478.phpt
@@ -17,7 +17,6 @@ print $xml_element->node2."\n";
print $xml_element->asXML();
?>
-===DONE===
--EXPECT--
a &#38; b
a &#38; b
@@ -25,5 +24,4 @@ a & b
a & b
<?xml version="1.0"?>
<root><node1>a &amp;#38; b</node1><node2>a &amp; b</node2></root>
-===DONE===
diff --git a/ext/simplexml/tests/bug45553.phpt b/ext/simplexml/tests/bug45553.phpt
index 9147fdaba1..f4737bdc86 100644
--- a/ext/simplexml/tests/bug45553.phpt
+++ b/ext/simplexml/tests/bug45553.phpt
@@ -25,12 +25,10 @@ echo $atts[0] . "\n";
$atts = $x->xpath("/xml/data/@label");
echo $atts[0] . "\n";
?>
-===DONE===
--EXPECT--
I am A
I am a:Nothing
I am a:A
I am a:Nothing
I am Nothing
-===DONE===
diff --git a/ext/simplexml/tests/bug46003.phpt b/ext/simplexml/tests/bug46003.phpt
index 1a67c6e9ee..619148e108 100644
--- a/ext/simplexml/tests/bug46003.phpt
+++ b/ext/simplexml/tests/bug46003.phpt
@@ -23,7 +23,6 @@ var_dump(isset($x->o->zz));
var_dump(isset($x->o->text));
var_dump(isset($x->o->xx));
?>
-===DONE===
--EXPECT--
bool(true)
bool(false)
@@ -31,5 +30,4 @@ bool(true)
bool(false)
bool(false)
bool(true)
-===DONE===
diff --git a/ext/simplexml/tests/bug46047.phpt b/ext/simplexml/tests/bug46047.phpt
index 921da30bd1..b8899a4312 100644
--- a/ext/simplexml/tests/bug46047.phpt
+++ b/ext/simplexml/tests/bug46047.phpt
@@ -14,7 +14,6 @@ print_r($xml);
$xml = new SimpleXMLElement('<foo><bar/><baz/></foo>');
print_r($xml);
?>
-===DONE===
--EXPECT--
SimpleXMLElement Object
(
@@ -49,5 +48,4 @@ SimpleXMLElement Object
)
)
-===DONE===
diff --git a/ext/simplexml/tests/bug46048.phpt b/ext/simplexml/tests/bug46048.phpt
index 3a3e7d54ef..35a9a56625 100644
--- a/ext/simplexml/tests/bug46048.phpt
+++ b/ext/simplexml/tests/bug46048.phpt
@@ -12,7 +12,6 @@ $xml = '
$obj = simplexml_load_string($xml);
print_r(get_object_vars($obj));
?>
-===DONE===
--EXPECT--
Array
(
@@ -23,4 +22,3 @@ Array
[key] => value
)
-===DONE===
diff --git a/ext/simplexml/tests/bug51615.phpt b/ext/simplexml/tests/bug51615.phpt
index b935414b80..d5759b21fc 100644
--- a/ext/simplexml/tests/bug51615.phpt
+++ b/ext/simplexml/tests/bug51615.phpt
@@ -14,7 +14,7 @@ $html = simplexml_import_dom($dom);
var_dump($html->body->span);
foreach ($html->body->span as $obj) {
- var_dump((string)$obj->title);
+ var_dump((string)$obj->title);
}
?>
diff --git a/ext/simplexml/tests/bug69169.phpt b/ext/simplexml/tests/bug69169.phpt
index 08cf299290..ff0d0e9410 100644
--- a/ext/simplexml/tests/bug69169.phpt
+++ b/ext/simplexml/tests/bug69169.phpt
@@ -8,12 +8,12 @@ if (!extension_loaded("simplexml")) die("skip SimpleXML not available");
<?php
$a = '<?xml version="1.0" encoding="UTF-8"?>
<root a="b">
- <row b="y">
- <item s="t" />
- </row>
- <row p="c">
- <item y="n" />
- </row>
+ <row b="y">
+ <item s="t" />
+ </row>
+ <row p="c">
+ <item y="n" />
+ </row>
</root>';
$b = str_replace(array("\n", "\r", "\t"), "", $a);
$simple_xml = simplexml_load_string($b);
diff --git a/ext/simplexml/tests/bug72588.phpt b/ext/simplexml/tests/bug72588.phpt
index f32ec25104..1f17695054 100644
--- a/ext/simplexml/tests/bug72588.phpt
+++ b/ext/simplexml/tests/bug72588.phpt
@@ -13,16 +13,16 @@ $dummy = &$tpnb;
$xmlStruct = <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<templates>
- <object type="obj_1" label="Label for object 1"></object>
- <object type="obj_2" label="Label for object 2"></object>
- <object type="obj_3" label="Label for object 3"></object>
- <object type="obj_4" label="Label for object 4"></object>
- <object type="obj_5" label="Label for object 5"></object>
- <object type="obj_6" label="Label for object 6"></object>
- <object type="obj_7" label="Label for object 7"></object>
- <object type="obj_8" label="Label for object 8"></object>
- <object type="obj_9" label="Label for object 9"></object>
- <object type="obj_10" label="Label for object 10"></object>
+ <object type="obj_1" label="Label for object 1"></object>
+ <object type="obj_2" label="Label for object 2"></object>
+ <object type="obj_3" label="Label for object 3"></object>
+ <object type="obj_4" label="Label for object 4"></object>
+ <object type="obj_5" label="Label for object 5"></object>
+ <object type="obj_6" label="Label for object 6"></object>
+ <object type="obj_7" label="Label for object 7"></object>
+ <object type="obj_8" label="Label for object 8"></object>
+ <object type="obj_9" label="Label for object 9"></object>
+ <object type="obj_10" label="Label for object 10"></object>
</templates>
EOF;
$tplxml = simplexml_load_string($xmlStruct);
diff --git a/ext/simplexml/tests/bug75245.phpt b/ext/simplexml/tests/bug75245.phpt
index 4a7a7caf0b..fa795ff685 100644
--- a/ext/simplexml/tests/bug75245.phpt
+++ b/ext/simplexml/tests/bug75245.phpt
@@ -8,7 +8,6 @@ if (!extension_loaded('simplexml')) die('skip simplexml not available');
<?php
var_dump(simplexml_load_string('<test1><test2> </test2><test3></test3></test1>'));
?>
-===DONE===
--EXPECT--
object(SimpleXMLElement)#1 (2) {
["test2"]=>
@@ -18,4 +17,3 @@ object(SimpleXMLElement)#1 (2) {
object(SimpleXMLElement)#3 (0) {
}
}
-===DONE===
diff --git a/ext/simplexml/tests/bug76712.phpt b/ext/simplexml/tests/bug76712.phpt
index efd34b56e2..44bc0be068 100644
--- a/ext/simplexml/tests/bug76712.phpt
+++ b/ext/simplexml/tests/bug76712.phpt
@@ -15,10 +15,8 @@ $sxe->addChild('bar');
$sxe->bar = '';
echo $sxe->asXML();
?>
-===DONE===
--EXPECT--
<?xml version="1.0"?>
<foo><bar/></foo>
<?xml version="1.0"?>
<foo><bar/></foo>
-===DONE===
diff --git a/ext/simplexml/tests/feature55218.phpt b/ext/simplexml/tests/feature55218.phpt
index 5aac70ea2a..bef8e2a9b8 100644
--- a/ext/simplexml/tests/feature55218.phpt
+++ b/ext/simplexml/tests/feature55218.phpt
@@ -48,7 +48,6 @@ var_dump( $x->person[0]->getDocNamespaces(false, false) );
var_dump( $x->person[1]->getDocNamespaces(false, false) );
?>
-===DONE===
--EXPECT--
getDocNamespaces
@@ -114,4 +113,3 @@ array(1) {
}
array(0) {
}
-===DONE===
diff --git a/ext/simplexml/tests/profile02.phpt b/ext/simplexml/tests/profile02.phpt
index f2e952bc36..1ec0894d3b 100644
--- a/ext/simplexml/tests/profile02.phpt
+++ b/ext/simplexml/tests/profile02.phpt
@@ -12,7 +12,7 @@ $root = simplexml_load_string('<?xml version="1.0"?>
');
foreach ($root->child as $child) {
- echo "$child ";
+ echo "$child ";
}
echo "\n---Done---\n";
?>
diff --git a/ext/simplexml/tests/profile11.phpt b/ext/simplexml/tests/profile11.phpt
index 54c31bf710..7d95f44a09 100644
--- a/ext/simplexml/tests/profile11.phpt
+++ b/ext/simplexml/tests/profile11.phpt
@@ -18,7 +18,6 @@ var_dump((string)$root->children('reserved-ns')->child);
var_dump((string)$root->children('special-ns')->child);
var_dump($root->child);
?>
-===DONE===
--EXPECTF--
object(SimpleXMLElement)#%d (1) {
[0]=>
@@ -32,4 +31,3 @@ string(5) "Hello"
string(5) "World"
object(SimpleXMLElement)#%d (0) {
}
-===DONE===
diff --git a/ext/simplexml/tests/profile12.phpt b/ext/simplexml/tests/profile12.phpt
index 51a0d35531..973508d777 100644
--- a/ext/simplexml/tests/profile12.phpt
+++ b/ext/simplexml/tests/profile12.phpt
@@ -8,15 +8,15 @@ SimpleXML [profile]: Accessing namespaced root and non namespaced children
$xml =<<<EOF
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
-xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
-xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>
<soap:Body>
<businessList foo="bar">
<businessInfo businessKey="bla"/>
</businessList>
-</soap:Body>
+</soap:Body>
</soap:Envelope>
EOF;
@@ -30,7 +30,6 @@ var_dump($sxe->Body->children(''));
var_dump($sxe->Body->children('')->businessList);
?>
-===DONE===
--EXPECTF--
array(1) {
["soap"]=>
@@ -71,4 +70,3 @@ object(SimpleXMLElement)#%s (2) {
}
}
}
-===DONE===
diff --git a/ext/simplexml/tests/profile13.phpt b/ext/simplexml/tests/profile13.phpt
index 2ae89e7449..80aad0f453 100644
--- a/ext/simplexml/tests/profile13.phpt
+++ b/ext/simplexml/tests/profile13.phpt
@@ -8,15 +8,15 @@ SimpleXML [profile]: Accessing by namespace prefix
$xml =<<<EOF
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
-xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
-xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>
<soap:Body>
<businessList foo="bar">
<businessInfo businessKey="bla"/>
</businessList>
-</soap:Body>
+</soap:Body>
</soap:Envelope>
EOF;
@@ -29,8 +29,6 @@ var_dump($sxe->Body->children(''));
var_dump($sxe->Body->children('')->businessList);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
object(SimpleXMLElement)#%d (1) {
["Body"]=>
@@ -72,4 +70,3 @@ object(SimpleXMLElement)#%d (2) {
}
}
}
-===DONE===
diff --git a/ext/simplexml/tests/simplexml_import_dom.phpt b/ext/simplexml/tests/simplexml_import_dom.phpt
index 02fbcdb4dd..82c80e81bc 100644
--- a/ext/simplexml/tests/simplexml_import_dom.phpt
+++ b/ext/simplexml/tests/simplexml_import_dom.phpt
@@ -14,7 +14,7 @@ if(!$dom) {
$s = simplexml_import_dom($dom);
$books = $s->book;
foreach ($books as $book) {
- echo "{$book->title} was written by {$book->author}\n";
+ echo "{$book->title} was written by {$book->author}\n";
}
?>
--EXPECT--
diff --git a/ext/simplexml/tests/simplexml_load_file.phpt b/ext/simplexml/tests/simplexml_load_file.phpt
index 50ee4e9033..80a2a09550 100644
--- a/ext/simplexml/tests/simplexml_load_file.phpt
+++ b/ext/simplexml/tests/simplexml_load_file.phpt
@@ -4,10 +4,10 @@ simplexml_load_file()
<?php if (!extension_loaded("simplexml")) die("skip"); ?>
--FILE--
<?php
- $simple = simplexml_load_file(__DIR__."/book.xml");
+ $simple = simplexml_load_file(__DIR__."/book.xml");
- var_dump($simple);
- echo "Done";
+ var_dump($simple);
+ echo "Done";
?>
--EXPECT--
object(SimpleXMLElement)#1 (1) {
diff --git a/ext/simplexml/tests/sxe_001.phpt b/ext/simplexml/tests/sxe_001.phpt
index fdc0335bd5..2c1edd0100 100644
--- a/ext/simplexml/tests/sxe_001.phpt
+++ b/ext/simplexml/tests/sxe_001.phpt
@@ -28,7 +28,6 @@ EOF;
var_dump(simplexml_load_string($xml, 'SimpleXMLIterator'));
?>
-===DONE===
--EXPECTF--
object(SimpleXMLIterator)#%d (2) {
["@attributes"]=>
@@ -60,4 +59,3 @@ object(SimpleXMLIterator)#%d (2) {
}
}
}
-===DONE===
diff --git a/ext/simplexml/tests/sxe_002.phpt b/ext/simplexml/tests/sxe_002.phpt
index 73db596789..b3f1b242df 100644
--- a/ext/simplexml/tests/sxe_002.phpt
+++ b/ext/simplexml/tests/sxe_002.phpt
@@ -38,9 +38,9 @@ EOF;
$sxe = simplexml_load_string($xml, 'SimpleXMLIterator');
foreach(new RecursiveIteratorIterator($sxe, 1) as $name => $data) {
- var_dump($name);
- var_dump(get_class($data));
- var_dump(trim($data));
+ var_dump($name);
+ var_dump(get_class($data));
+ var_dump(trim($data));
}
echo "===DUMP===\n";
@@ -49,7 +49,6 @@ var_dump(get_class($sxe));
var_dump(trim($sxe->elem1));
?>
-===DONE===
--EXPECT--
string(5) "elem1"
string(17) "SimpleXMLIterator"
@@ -72,4 +71,3 @@ string(7) "Foo Bar"
===DUMP===
string(17) "SimpleXMLIterator"
string(10) "Bla bla 1."
-===DONE===
diff --git a/ext/simplexml/tests/sxe_003.phpt b/ext/simplexml/tests/sxe_003.phpt
index f3a2e5c5bc..37a4e554d2 100644
--- a/ext/simplexml/tests/sxe_003.phpt
+++ b/ext/simplexml/tests/sxe_003.phpt
@@ -38,26 +38,25 @@ EOF;
$sxe = simplexml_load_string($xml, 'SimpleXMLIterator');
foreach($sxe->getChildren() as $name => $data) {
- var_dump($name);
- var_dump(get_class($data));
- var_dump(trim($data));
+ var_dump($name);
+ var_dump(get_class($data));
+ var_dump(trim($data));
}
echo "===RESET===\n";
for ($sxe->rewind(); $sxe->valid(); $sxe->next()) {
- var_dump($sxe->hasChildren());
- var_dump(trim($sxe->key()));
- var_dump(trim($sxe->current()));
- foreach($sxe->getChildren() as $name => $data) {
- var_dump($name);
- var_dump(get_class($data));
- var_dump(trim($data));
- }
+ var_dump($sxe->hasChildren());
+ var_dump(trim($sxe->key()));
+ var_dump(trim($sxe->current()));
+ foreach($sxe->getChildren() as $name => $data) {
+ var_dump($name);
+ var_dump(get_class($data));
+ var_dump(trim($data));
+ }
}
?>
-===DONE===
--EXPECTF--
Warning: Invalid argument supplied for foreach() in %ssxe_003.php on line %d
===RESET===
@@ -73,4 +72,3 @@ string(10) "Bla bla 2."
string(7) "elem111"
string(17) "SimpleXMLIterator"
string(7) "Foo Bar"
-===DONE===
diff --git a/ext/simplexml/tests/sxe_004.phpt b/ext/simplexml/tests/sxe_004.phpt
index 8b86eff375..5e103cba5b 100644
--- a/ext/simplexml/tests/sxe_004.phpt
+++ b/ext/simplexml/tests/sxe_004.phpt
@@ -37,53 +37,52 @@ EOF;
class SXETest extends SimpleXMLIterator
{
- function rewind()
- {
- echo __METHOD__ . "\n";
- return parent::rewind();
- }
- function valid()
- {
- echo __METHOD__ . "\n";
- return parent::valid();
- }
- function current()
- {
- echo __METHOD__ . "\n";
- return parent::current();
- }
- function key()
- {
- echo __METHOD__ . "\n";
- return parent::key();
- }
- function next()
- {
- echo __METHOD__ . "\n";
- return parent::next();
- }
- function hasChildren()
- {
- echo __METHOD__ . "\n";
- return parent::hasChildren();
- }
- function getChildren()
- {
- echo __METHOD__ . "\n";
- return parent::getChildren();
- }
+ function rewind()
+ {
+ echo __METHOD__ . "\n";
+ return parent::rewind();
+ }
+ function valid()
+ {
+ echo __METHOD__ . "\n";
+ return parent::valid();
+ }
+ function current()
+ {
+ echo __METHOD__ . "\n";
+ return parent::current();
+ }
+ function key()
+ {
+ echo __METHOD__ . "\n";
+ return parent::key();
+ }
+ function next()
+ {
+ echo __METHOD__ . "\n";
+ return parent::next();
+ }
+ function hasChildren()
+ {
+ echo __METHOD__ . "\n";
+ return parent::hasChildren();
+ }
+ function getChildren()
+ {
+ echo __METHOD__ . "\n";
+ return parent::getChildren();
+ }
}
$sxe = new SXETest($xml);
$rit = new RecursiveIteratorIterator($sxe, RecursiveIteratorIterator::SELF_FIRST);
foreach($rit as $data) {
- var_dump(get_class($data));
- var_dump(trim($data));
+ var_dump(get_class($data));
+ var_dump(trim($data));
}
?>
-===DONE===
--EXPECT--
SXETest::rewind
SXETest::valid
@@ -142,4 +141,3 @@ SXETest::valid
SXETest::next
SXETest::valid
SXETest::valid
-===DONE===
diff --git a/ext/simplexml/tests/sxe_005.phpt b/ext/simplexml/tests/sxe_005.phpt
index d13d3d73d4..59fe1d2f9c 100644
--- a/ext/simplexml/tests/sxe_005.phpt
+++ b/ext/simplexml/tests/sxe_005.phpt
@@ -1,5 +1,5 @@
--TEST--
-SPL: SimpleXMLIterator and overriden count()
+SPL: SimpleXMLIterator and overridden count()
--SKIPIF--
<?php
if (!extension_loaded('simplexml')) print 'skip';
@@ -19,11 +19,11 @@ EOF;
class SXETest extends SimpleXMLIterator
{
- function count()
- {
- echo __METHOD__ . "\n";
- return parent::count();
- }
+ function count()
+ {
+ echo __METHOD__ . "\n";
+ return parent::count();
+ }
}
$sxe = new SXETest($xml);
@@ -33,7 +33,6 @@ var_dump(count($sxe->elem1));
var_dump(count($sxe->elem2));
?>
-===DONE===
--EXPECT--
SXETest::count
int(3)
@@ -41,4 +40,3 @@ SXETest::count
int(1)
SXETest::count
int(2)
-===DONE===
diff --git a/ext/skeleton/skeleton.c b/ext/skeleton/skeleton.c
index 2c03ea9fd5..0bd99f3d41 100644
--- a/ext/skeleton/skeleton.c
+++ b/ext/skeleton/skeleton.c
@@ -7,6 +7,7 @@
#include "php.h"
#include "ext/standard/info.h"
#include "php_%EXTNAME%.h"
+#include "%EXTNAME%_arginfo.h"
/* For compatibility with older PHP versions */
#ifndef ZEND_PARSE_PARAMETERS_NONE
@@ -66,16 +67,6 @@ PHP_MINFO_FUNCTION(%EXTNAME%)
}
/* }}} */
-/* {{{ arginfo
- */
-ZEND_BEGIN_ARG_INFO(arginfo_%EXTNAME%_test1, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_%EXTNAME%_test2, 0)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ %EXTNAME%_functions[]
*/
static const zend_function_entry %EXTNAME%_functions[] = {
diff --git a/ext/skeleton/skeleton.stub.php b/ext/skeleton/skeleton.stub.php
new file mode 100644
index 0000000000..4bddcf37aa
--- /dev/null
+++ b/ext/skeleton/skeleton.stub.php
@@ -0,0 +1,5 @@
+<?php
+
+function %EXTNAME%_test1(): void {}
+
+function %EXTNAME%_test2(string $str = ""): string {}
diff --git a/ext/snmp/php_snmp.h b/ext/snmp/php_snmp.h
index d65757258a..45c8ae3d0f 100644
--- a/ext/snmp/php_snmp.h
+++ b/ext/snmp/php_snmp.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c
index f2f55d19b5..ac630871bd 100644
--- a/ext/snmp/snmp.c
+++ b/ext/snmp/snmp.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -32,6 +30,7 @@
#include "zend_exceptions.h"
#include "ext/spl/spl_exceptions.h"
+#include "snmp_arginfo.h"
#if HAVE_SNMP
@@ -125,229 +124,6 @@ zend_class_entry *php_snmp_exception_ce;
/* Class object properties */
static HashTable php_snmp_properties;
-/* {{{ arginfo */
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmpget, 0, 0, 3)
- ZEND_ARG_INFO(0, host)
- ZEND_ARG_INFO(0, community)
- ZEND_ARG_INFO(0, object_id)
- ZEND_ARG_INFO(0, timeout)
- ZEND_ARG_INFO(0, retries)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmpgetnext, 0, 0, 3)
- ZEND_ARG_INFO(0, host)
- ZEND_ARG_INFO(0, community)
- ZEND_ARG_INFO(0, object_id)
- ZEND_ARG_INFO(0, timeout)
- ZEND_ARG_INFO(0, retries)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmpwalk, 0, 0, 3)
- ZEND_ARG_INFO(0, host)
- ZEND_ARG_INFO(0, community)
- ZEND_ARG_INFO(0, object_id)
- ZEND_ARG_INFO(0, timeout)
- ZEND_ARG_INFO(0, retries)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmprealwalk, 0, 0, 3)
- ZEND_ARG_INFO(0, host)
- ZEND_ARG_INFO(0, community)
- ZEND_ARG_INFO(0, object_id)
- ZEND_ARG_INFO(0, timeout)
- ZEND_ARG_INFO(0, retries)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmpset, 0, 0, 5)
- ZEND_ARG_INFO(0, host)
- ZEND_ARG_INFO(0, community)
- ZEND_ARG_INFO(0, object_id)
- ZEND_ARG_INFO(0, type)
- ZEND_ARG_INFO(0, value)
- ZEND_ARG_INFO(0, timeout)
- ZEND_ARG_INFO(0, retries)
-ZEND_END_ARG_INFO()
-
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp_get_quick_print, 0, 0, 1)
- ZEND_ARG_INFO(0, d)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp_set_quick_print, 0, 0, 1)
- ZEND_ARG_INFO(0, quick_print)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp_set_enum_print, 0, 0, 1)
- ZEND_ARG_INFO(0, enum_print)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp_set_oid_output_format, 0, 0, 1)
- ZEND_ARG_INFO(0, oid_format)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp2_get, 0, 0, 3)
- ZEND_ARG_INFO(0, host)
- ZEND_ARG_INFO(0, community)
- ZEND_ARG_INFO(0, object_id)
- ZEND_ARG_INFO(0, timeout)
- ZEND_ARG_INFO(0, retries)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp2_getnext, 0, 0, 3)
- ZEND_ARG_INFO(0, host)
- ZEND_ARG_INFO(0, community)
- ZEND_ARG_INFO(0, object_id)
- ZEND_ARG_INFO(0, timeout)
- ZEND_ARG_INFO(0, retries)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp2_walk, 0, 0, 3)
- ZEND_ARG_INFO(0, host)
- ZEND_ARG_INFO(0, community)
- ZEND_ARG_INFO(0, object_id)
- ZEND_ARG_INFO(0, timeout)
- ZEND_ARG_INFO(0, retries)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp2_real_walk, 0, 0, 3)
- ZEND_ARG_INFO(0, host)
- ZEND_ARG_INFO(0, community)
- ZEND_ARG_INFO(0, object_id)
- ZEND_ARG_INFO(0, timeout)
- ZEND_ARG_INFO(0, retries)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp2_set, 0, 0, 5)
- ZEND_ARG_INFO(0, host)
- ZEND_ARG_INFO(0, community)
- ZEND_ARG_INFO(0, object_id)
- ZEND_ARG_INFO(0, type)
- ZEND_ARG_INFO(0, value)
- ZEND_ARG_INFO(0, timeout)
- ZEND_ARG_INFO(0, retries)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp3_get, 0, 0, 8)
- ZEND_ARG_INFO(0, host)
- ZEND_ARG_INFO(0, sec_name)
- ZEND_ARG_INFO(0, sec_level)
- ZEND_ARG_INFO(0, auth_protocol)
- ZEND_ARG_INFO(0, auth_passphrase)
- ZEND_ARG_INFO(0, priv_protocol)
- ZEND_ARG_INFO(0, priv_passphrase)
- ZEND_ARG_INFO(0, object_id)
- ZEND_ARG_INFO(0, timeout)
- ZEND_ARG_INFO(0, retries)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp3_getnext, 0, 0, 8)
- ZEND_ARG_INFO(0, host)
- ZEND_ARG_INFO(0, sec_name)
- ZEND_ARG_INFO(0, sec_level)
- ZEND_ARG_INFO(0, auth_protocol)
- ZEND_ARG_INFO(0, auth_passphrase)
- ZEND_ARG_INFO(0, priv_protocol)
- ZEND_ARG_INFO(0, priv_passphrase)
- ZEND_ARG_INFO(0, object_id)
- ZEND_ARG_INFO(0, timeout)
- ZEND_ARG_INFO(0, retries)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp3_walk, 0, 0, 8)
- ZEND_ARG_INFO(0, host)
- ZEND_ARG_INFO(0, sec_name)
- ZEND_ARG_INFO(0, sec_level)
- ZEND_ARG_INFO(0, auth_protocol)
- ZEND_ARG_INFO(0, auth_passphrase)
- ZEND_ARG_INFO(0, priv_protocol)
- ZEND_ARG_INFO(0, priv_passphrase)
- ZEND_ARG_INFO(0, object_id)
- ZEND_ARG_INFO(0, timeout)
- ZEND_ARG_INFO(0, retries)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp3_real_walk, 0, 0, 8)
- ZEND_ARG_INFO(0, host)
- ZEND_ARG_INFO(0, sec_name)
- ZEND_ARG_INFO(0, sec_level)
- ZEND_ARG_INFO(0, auth_protocol)
- ZEND_ARG_INFO(0, auth_passphrase)
- ZEND_ARG_INFO(0, priv_protocol)
- ZEND_ARG_INFO(0, priv_passphrase)
- ZEND_ARG_INFO(0, object_id)
- ZEND_ARG_INFO(0, timeout)
- ZEND_ARG_INFO(0, retries)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp3_set, 0, 0, 10)
- ZEND_ARG_INFO(0, host)
- ZEND_ARG_INFO(0, sec_name)
- ZEND_ARG_INFO(0, sec_level)
- ZEND_ARG_INFO(0, auth_protocol)
- ZEND_ARG_INFO(0, auth_passphrase)
- ZEND_ARG_INFO(0, priv_protocol)
- ZEND_ARG_INFO(0, priv_passphrase)
- ZEND_ARG_INFO(0, object_id)
- ZEND_ARG_INFO(0, type)
- ZEND_ARG_INFO(0, value)
- ZEND_ARG_INFO(0, timeout)
- ZEND_ARG_INFO(0, retries)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp_set_valueretrieval, 0, 0, 1)
- ZEND_ARG_INFO(0, method)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_snmp_get_valueretrieval, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp_read_mib, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-/* OO arginfo */
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp_create, 0, 0, 3)
- ZEND_ARG_INFO(0, version)
- ZEND_ARG_INFO(0, host)
- ZEND_ARG_INFO(0, community)
- ZEND_ARG_INFO(0, timeout)
- ZEND_ARG_INFO(0, retries)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_snmp_void, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp_setSecurity, 0, 0, 8)
- ZEND_ARG_INFO(0, sec_level)
- ZEND_ARG_INFO(0, auth_protocol)
- ZEND_ARG_INFO(0, auth_passphrase)
- ZEND_ARG_INFO(0, priv_protocol)
- ZEND_ARG_INFO(0, priv_passphrase)
- ZEND_ARG_INFO(0, contextName)
- ZEND_ARG_INFO(0, contextEngineID)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp_get, 0, 0, 1)
- ZEND_ARG_INFO(0, object_id)
- ZEND_ARG_INFO(0, use_orignames)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp_walk, 0, 0, 4)
- ZEND_ARG_INFO(0, object_id)
- ZEND_ARG_INFO(0, suffix_keys)
- ZEND_ARG_INFO(0, max_repetitions)
- ZEND_ARG_INFO(0, non_repeaters)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp_set, 0, 0, 3)
- ZEND_ARG_INFO(0, object_id)
- ZEND_ARG_INFO(0, type)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-/* }}} */
-
struct objid_query {
int count;
int offset;
@@ -367,13 +143,13 @@ static const zend_function_entry snmp_functions[] = {
PHP_FE(snmpgetnext, arginfo_snmpgetnext)
PHP_FE(snmpwalk, arginfo_snmpwalk)
PHP_FE(snmprealwalk, arginfo_snmprealwalk)
- PHP_FALIAS(snmpwalkoid, snmprealwalk, arginfo_snmprealwalk)
+ PHP_FALIAS(snmpwalkoid, snmprealwalk, arginfo_snmpwalkoid)
PHP_FE(snmpset, arginfo_snmpset)
PHP_FE(snmp_get_quick_print, arginfo_snmp_get_quick_print)
PHP_FE(snmp_set_quick_print, arginfo_snmp_set_quick_print)
PHP_FE(snmp_set_enum_print, arginfo_snmp_set_enum_print)
PHP_FE(snmp_set_oid_output_format, arginfo_snmp_set_oid_output_format)
- PHP_FALIAS(snmp_set_oid_numeric_print, snmp_set_oid_output_format, arginfo_snmp_set_oid_output_format)
+ PHP_FALIAS(snmp_set_oid_numeric_print, snmp_set_oid_output_format, arginfo_snmp_set_oid_numeric_print)
PHP_FE(snmp2_get, arginfo_snmp2_get)
PHP_FE(snmp2_getnext, arginfo_snmp2_getnext)
@@ -532,7 +308,7 @@ static void php_snmp_getvalue(struct variable_list *vars, zval *snmpval, int val
int buflen = sizeof(sbuf) - 1;
int val_len = vars->val_len;
- /* use emalloc() for large values, use static array otherwize */
+ /* use emalloc() for large values, use static array otherwise */
/* There is no way to know the size of buffer snprint_value() needs in order to print a value there.
* So we are forced to probe it
@@ -1103,7 +879,7 @@ static int netsnmp_session_init(php_snmp_session **session_p, int version, char
}
*pptr = '\0';
} else {
- php_error_docref(NULL, E_WARNING, "malformed IPv6 address, closing square bracket missing");
+ php_error_docref(NULL, E_WARNING, "Malformed IPv6 address, closing square bracket missing");
return (-1);
}
} else { /* IPv4 address */
@@ -1359,7 +1135,7 @@ static int netsnmp_session_set_security(struct snmp_session *session, char *sec_
*/
static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st, int version)
{
- zval *oid, *value, *type;
+ zval *oid, *value = NULL, *type = NULL;
char *a1, *a2, *a3, *a4, *a5, *a6, *a7;
size_t a1_len, a2_len, a3_len, a4_len, a5_len, a6_len, a7_len;
zend_bool use_orignames = 0, suffix_keys = 0;
@@ -1382,7 +1158,7 @@ static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st, int version)
if (st & SNMP_CMD_SET) {
if (zend_parse_parameters(argc, "ssssssszzz|ll", &a1, &a1_len, &a2, &a2_len, &a3, &a3_len,
&a4, &a4_len, &a5, &a5_len, &a6, &a6_len, &a7, &a7_len, &oid, &type, &value, &timeout, &retries) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
} else {
/* SNMP_CMD_GET
@@ -1391,13 +1167,13 @@ static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st, int version)
*/
if (zend_parse_parameters(argc, "sssssssz|ll", &a1, &a1_len, &a2, &a2_len, &a3, &a3_len,
&a4, &a4_len, &a5, &a5_len, &a6, &a6_len, &a7, &a7_len, &oid, &timeout, &retries) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
}
} else {
if (st & SNMP_CMD_SET) {
if (zend_parse_parameters(argc, "sszzz|ll", &a1, &a1_len, &a2, &a2_len, &oid, &type, &value, &timeout, &retries) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
} else {
/* SNMP_CMD_GET
@@ -1405,25 +1181,25 @@ static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st, int version)
* SNMP_CMD_WALK
*/
if (zend_parse_parameters(argc, "ssz|ll", &a1, &a1_len, &a2, &a2_len, &oid, &timeout, &retries) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
}
}
} else {
if (st & SNMP_CMD_SET) {
if (zend_parse_parameters(argc, "zzz", &oid, &type, &value) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
} else if (st & SNMP_CMD_WALK) {
if (zend_parse_parameters(argc, "z|bll", &oid, &suffix_keys, &(objid_query.max_repetitions), &(objid_query.non_repeaters)) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (suffix_keys) {
st |= SNMP_USE_SUFFIX_AS_KEYS;
}
} else if (st & SNMP_CMD_GET) {
if (zend_parse_parameters(argc, "z|b", &oid, &use_orignames) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (use_orignames) {
st |= SNMP_ORIGINAL_NAMES_AS_KEYS;
@@ -1432,7 +1208,7 @@ static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st, int version)
/* SNMP_CMD_GETNEXT
*/
if (zend_parse_parameters(argc, "z", &oid) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
}
}
@@ -1542,7 +1318,7 @@ PHP_FUNCTION(snmpset)
PHP_FUNCTION(snmp_get_quick_print)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_BOOL(netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT));
@@ -1556,7 +1332,7 @@ PHP_FUNCTION(snmp_set_quick_print)
zend_long a1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &a1) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT, (int)a1);
@@ -1571,7 +1347,7 @@ PHP_FUNCTION(snmp_set_enum_print)
zend_long a1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &a1) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_PRINT_NUMERIC_ENUM, (int) a1);
@@ -1586,7 +1362,7 @@ PHP_FUNCTION(snmp_set_oid_output_format)
zend_long a1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &a1) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
switch((int) a1) {
@@ -1694,7 +1470,7 @@ PHP_FUNCTION(snmp_set_valueretrieval)
zend_long method;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &method) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (method >= 0 && method <= (SNMP_VALUE_LIBRARY|SNMP_VALUE_PLAIN|SNMP_VALUE_OBJECT)) {
@@ -1712,7 +1488,7 @@ PHP_FUNCTION(snmp_set_valueretrieval)
PHP_FUNCTION(snmp_get_valueretrieval)
{
if (zend_parse_parameters_none() == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
RETURN_LONG(SNMP_G(valueretrieval));
@@ -1727,7 +1503,7 @@ PHP_FUNCTION(snmp_read_mib)
size_t filename_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &filename, &filename_len) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (!read_mib(filename)) {
@@ -1754,8 +1530,8 @@ PHP_METHOD(snmp, __construct)
snmp_object = Z_SNMP_P(object);
- if (zend_parse_parameters_throw(argc, "lss|ll", &version, &a1, &a1_len, &a2, &a2_len, &timeout, &retries) == FAILURE) {
- return;
+ if (zend_parse_parameters(argc, "lss|ll", &version, &a1, &a1_len, &a2, &a2_len, &timeout, &retries) == FAILURE) {
+ RETURN_THROWS();
}
switch (version) {
@@ -1765,7 +1541,7 @@ PHP_METHOD(snmp, __construct)
break;
default:
zend_throw_exception(zend_ce_exception, "Unknown SNMP protocol version", 0);
- return;
+ RETURN_THROWS();
}
/* handle re-open of snmp session */
@@ -1796,7 +1572,7 @@ PHP_METHOD(snmp, close)
snmp_object = Z_SNMP_P(object);
if (zend_parse_parameters_none() == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
netsnmp_session_free(&(snmp_object->session));
@@ -1851,7 +1627,7 @@ PHP_METHOD(snmp, setSecurity)
if (zend_parse_parameters(argc, "s|ssssss", &a1, &a1_len, &a2, &a2_len, &a3, &a3_len,
&a4, &a4_len, &a5, &a5_len, &a6, &a6_len, &a7, &a7_len) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (netsnmp_session_set_security(snmp_object->session, a1, a2, a3, a4, a5, a6, a7)) {
@@ -1871,6 +1647,10 @@ PHP_METHOD(snmp, getErrno)
snmp_object = Z_SNMP_P(object);
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
RETVAL_LONG(snmp_object->snmp_errno);
return;
}
@@ -1885,6 +1665,10 @@ PHP_METHOD(snmp, getError)
snmp_object = Z_SNMP_P(object);
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
RETURN_STRING(snmp_object->snmp_errstr);
}
/* }}} */
@@ -1907,26 +1691,15 @@ void php_snmp_add_property(HashTable *h, const char *name, size_t name_length, p
/* {{{ php_snmp_read_property(zval *object, zval *member, int type[, const zend_literal *key])
Generic object property reader */
-zval *php_snmp_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv)
+zval *php_snmp_read_property(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv)
{
- zval tmp_member;
zval *retval;
php_snmp_object *obj;
php_snmp_prop_handler *hnd;
int ret;
- obj = Z_SNMP_P(object);
-
- if (Z_TYPE_P(member) != IS_STRING) {
- zend_string *str = zval_try_get_string_func(member);
- if (UNEXPECTED(!str)) {
- return &EG(uninitialized_zval);
- }
- ZVAL_STR(&tmp_member, str);
- member = &tmp_member;
- }
-
- hnd = zend_hash_find_ptr(&php_snmp_properties, Z_STR_P(member));
+ obj = php_snmp_fetch_object(object);
+ hnd = zend_hash_find_ptr(&php_snmp_properties, name);
if (hnd && hnd->read_func) {
ret = hnd->read_func(obj, rv);
@@ -1936,11 +1709,7 @@ zval *php_snmp_read_property(zval *object, zval *member, int type, void **cache_
retval = &EG(uninitialized_zval);
}
} else {
- retval = zend_std_read_property(object, member, type, cache_slot, rv);
- }
-
- if (member == &tmp_member) {
- zval_ptr_dtor(member);
+ retval = zend_std_read_property(object, name, type, cache_slot, rv);
}
return retval;
@@ -1949,24 +1718,13 @@ zval *php_snmp_read_property(zval *object, zval *member, int type, void **cache_
/* {{{ php_snmp_write_property(zval *object, zval *member, zval *value[, const zend_literal *key])
Generic object property writer */
-zval *php_snmp_write_property(zval *object, zval *member, zval *value, void **cache_slot)
+zval *php_snmp_write_property(zend_object *object, zend_string *name, zval *value, void **cache_slot)
{
- zval tmp_member;
php_snmp_object *obj;
php_snmp_prop_handler *hnd;
- if (Z_TYPE_P(member) != IS_STRING) {
- zend_string *str = zval_try_get_string_func(member);
- if (UNEXPECTED(!str)) {
- return value;
- }
- ZVAL_STR(&tmp_member, str);
- member = &tmp_member;
- }
-
- obj = Z_SNMP_P(object);
-
- hnd = zend_hash_find_ptr(&php_snmp_properties, Z_STR_P(member));
+ obj = php_snmp_fetch_object(object);
+ hnd = zend_hash_find_ptr(&php_snmp_properties, name);
if (hnd && hnd->write_func) {
hnd->write_func(obj, value);
@@ -1977,11 +1735,7 @@ zval *php_snmp_write_property(zval *object, zval *member, zval *value, void **ca
}
*/
} else {
- value = zend_std_write_property(object, member, value, cache_slot);
- }
-
- if (member == &tmp_member) {
- zval_ptr_dtor(member);
+ value = zend_std_write_property(object, name, value, cache_slot);
}
return value;
@@ -1990,19 +1744,19 @@ zval *php_snmp_write_property(zval *object, zval *member, zval *value, void **ca
/* {{{ php_snmp_has_property(zval *object, zval *member, int has_set_exists[, const zend_literal *key])
Generic object property checker */
-static int php_snmp_has_property(zval *object, zval *member, int has_set_exists, void **cache_slot)
+static int php_snmp_has_property(zend_object *object, zend_string *name, int has_set_exists, void **cache_slot)
{
zval rv;
php_snmp_prop_handler *hnd;
int ret = 0;
- if ((hnd = zend_hash_find_ptr(&php_snmp_properties, Z_STR_P(member))) != NULL) {
+ if ((hnd = zend_hash_find_ptr(&php_snmp_properties, name)) != NULL) {
switch (has_set_exists) {
case ZEND_PROPERTY_EXISTS:
ret = 1;
break;
case ZEND_PROPERTY_ISSET: {
- zval *value = php_snmp_read_property(object, member, BP_VAR_IS, cache_slot, &rv);
+ zval *value = php_snmp_read_property(object, name, BP_VAR_IS, cache_slot, &rv);
if (value != &EG(uninitialized_zval)) {
ret = Z_TYPE_P(value) != IS_NULL? 1 : 0;
zval_ptr_dtor(value);
@@ -2010,7 +1764,7 @@ static int php_snmp_has_property(zval *object, zval *member, int has_set_exists,
break;
}
default: {
- zval *value = php_snmp_read_property(object, member, BP_VAR_IS, cache_slot, &rv);
+ zval *value = php_snmp_read_property(object, name, BP_VAR_IS, cache_slot, &rv);
if (value != &EG(uninitialized_zval)) {
convert_to_boolean(value);
ret = Z_TYPE_P(value) == IS_TRUE? 1:0;
@@ -2019,13 +1773,13 @@ static int php_snmp_has_property(zval *object, zval *member, int has_set_exists,
}
}
} else {
- ret = zend_std_has_property(object, member, has_set_exists, cache_slot);
+ ret = zend_std_has_property(object, name, has_set_exists, cache_slot);
}
return ret;
}
/* }}} */
-static HashTable *php_snmp_get_gc(zval *object, zval **gc_data, int *gc_data_count) /* {{{ */
+static HashTable *php_snmp_get_gc(zend_object *object, zval **gc_data, int *gc_data_count) /* {{{ */
{
*gc_data = NULL;
*gc_data_count = 0;
@@ -2035,7 +1789,7 @@ static HashTable *php_snmp_get_gc(zval *object, zval **gc_data, int *gc_data_cou
/* {{{ php_snmp_get_properties(zval *object)
Returns all object properties. Injects SNMP properties into object on first call */
-static HashTable *php_snmp_get_properties(zval *object)
+static HashTable *php_snmp_get_properties(zend_object *object)
{
php_snmp_object *obj;
php_snmp_prop_handler *hnd;
@@ -2043,7 +1797,7 @@ static HashTable *php_snmp_get_properties(zval *object)
zval rv;
zend_string *key;
- obj = Z_SNMP_P(object);
+ obj = php_snmp_fetch_object(object);
props = zend_std_get_properties(object);
ZEND_HASH_FOREACH_STR_KEY_PTR(&php_snmp_properties, key, hnd) {
@@ -2227,16 +1981,16 @@ static void free_php_snmp_properties(zval *el) /* {{{ */
/* {{{ php_snmp_class_methods[] */
static const zend_function_entry php_snmp_class_methods[] = {
- PHP_ME(snmp, __construct, arginfo_snmp_create, ZEND_ACC_PUBLIC)
- PHP_ME(snmp, close, arginfo_snmp_void, ZEND_ACC_PUBLIC)
- PHP_ME(snmp, setSecurity, arginfo_snmp_setSecurity, ZEND_ACC_PUBLIC)
-
- PHP_ME(snmp, get, arginfo_snmp_get, ZEND_ACC_PUBLIC)
- PHP_ME(snmp, getnext, arginfo_snmp_get, ZEND_ACC_PUBLIC)
- PHP_ME(snmp, walk, arginfo_snmp_walk, ZEND_ACC_PUBLIC)
- PHP_ME(snmp, set, arginfo_snmp_set, ZEND_ACC_PUBLIC)
- PHP_ME(snmp, getErrno, arginfo_snmp_void, ZEND_ACC_PUBLIC)
- PHP_ME(snmp, getError, arginfo_snmp_void, ZEND_ACC_PUBLIC)
+ PHP_ME(snmp, __construct, arginfo_class_SNMP___construct, ZEND_ACC_PUBLIC)
+ PHP_ME(snmp, close, arginfo_class_SNMP_close, ZEND_ACC_PUBLIC)
+ PHP_ME(snmp, setSecurity, arginfo_class_SNMP_setSecurity, ZEND_ACC_PUBLIC)
+
+ PHP_ME(snmp, get, arginfo_class_SNMP_get, ZEND_ACC_PUBLIC)
+ PHP_ME(snmp, getnext, arginfo_class_SNMP_getnext, ZEND_ACC_PUBLIC)
+ PHP_ME(snmp, walk, arginfo_class_SNMP_walk, ZEND_ACC_PUBLIC)
+ PHP_ME(snmp, set, arginfo_class_SNMP_set, ZEND_ACC_PUBLIC)
+ PHP_ME(snmp, getErrno, arginfo_class_SNMP_getErrno, ZEND_ACC_PUBLIC)
+ PHP_ME(snmp, getError, arginfo_class_SNMP_getError, ZEND_ACC_PUBLIC)
PHP_FE_END
};
diff --git a/ext/snmp/snmp.stub.php b/ext/snmp/snmp.stub.php
new file mode 100644
index 0000000000..ce085637be
--- /dev/null
+++ b/ext/snmp/snmp.stub.php
@@ -0,0 +1,120 @@
+<?php
+
+/** @param array|string $object_id */
+function snmpget(string $host, string $community, $object_id, int $timeout = UNKNOWN, int $retries = UNKNOWN): array|bool {}
+
+/** @param array|string $object_id */
+function snmpgetnext(string $host, string $community, $object_id, int $timeout = UNKNOWN, int $retries = UNKNOWN): array|bool {}
+
+/** @param array|string $object_id */
+function snmpwalk(string $host, string $community, $object_id, int $timeout = UNKNOWN, int $retries = UNKNOWN): array|bool {}
+
+/** @param array|string $object_id */
+function snmprealwalk(string $host, string $community, $object_id, int $timeout = UNKNOWN, int $retries = UNKNOWN): array|bool {}
+
+/** @param array|string $object_id */
+function snmpwalkoid(string $host, string $community, $object_id, int $timeout = UNKNOWN, int $retries = UNKNOWN): array|bool {}
+
+/**
+ * @param array|string $object_id
+ * @param array|string $type
+ * @param array|string $value
+ */
+function snmpset(string $host, string $community, $object_id, $type, $value, int $timeout = UNKNOWN, int $retries = UNKNOWN): array|bool {}
+
+function snmp_get_quick_print(): bool {}
+
+function snmp_set_quick_print(int $quick_print): bool {}
+
+function snmp_set_enum_print(int $enum_print): bool {}
+
+function snmp_set_oid_output_format(int $oid_format): bool {}
+
+function snmp_set_oid_numeric_print(int $oid_format): bool {}
+
+/** @param array|string $object_id */
+function snmp2_get(string $host, string $community, $object_id, int $timeout = UNKNOWN, int $retries = UNKNOWN): array|bool {}
+
+/** @param array|string $object_id */
+function snmp2_getnext(string $host, string $community, $object_id, int $timeout = UNKOWN, int $retries = UNKNOWN): array|bool {}
+
+/** @param array|string $object_id */
+function snmp2_walk(string $host, string $community, $object_id, int $timeout = UNKNOWN, int $retries = UNKNOWN): array|bool {}
+
+/** @param array|string $object_id */
+function snmp2_real_walk(string $host, string $community, $object_id, int $timeout = UNKNOWN, int $retries = UNKNOWN): array|bool {}
+
+/**
+ * @param array|string $object_id
+ * @param array|string $type
+ * @param array|string $value
+ */
+function snmp2_set(string $host, string $community, $object_id, $type, $value, int $timeout = UNKNOWN, int $retries = UNKNOWN): array|bool {}
+
+/** @param array|string $object_id */
+function snmp3_get(string $host, string $sec_name, string $sec_level, string $auth_protocol, string $auth_passphrase, string $priv_protocol, string $priv_passphrase, $object_id, int $timeout = UNKNOWN, int $retries = UNKNOWN): array|bool {}
+
+/** @param array|string $object_id */
+function snmp3_getnext(string $host, string $sec_name, string $sec_level, string $auth_protocol, string $auth_passphrase, string $priv_protocol, string $priv_passphrase, $object_id, int $timeout = UNKNOWN, int $retries = UNKOWN): array|bool {}
+
+/** @param array|string $object_id */
+function snmp3_walk(string $host, string $sec_name, string $sec_level, string $auth_protocol, string $auth_passphrase, string $priv_protocol, string $priv_passphrase, $object_id, int $timeout = UNKNOWN, int $retries = UNKNOWN): array|bool {}
+
+/** @param array|string $object_id */
+function snmp3_real_walk(string $host, string $sec_name, string $sec_level, string $auth_protocol, string $auth_passphrase, string $priv_protocol, string $priv_passphrase, $object_id, int $timeout = UNKNOWN, int $retries = UNKNOWN): array|bool {}
+
+/**
+ * @param array|string $object_id
+ * @param array|string $type
+ * @param array|string $value
+ */
+function snmp3_set(string $host, string $sec_name, string $sec_level, string $auth_protocol, string $auth_passphrase, string $priv_protocol, string $priv_passphrase, $object_id, $type, $value, int $timeout = UNKNOWN, int $retries = UNKNOWN): array|bool {}
+
+function snmp_set_valueretrieval(int $method): bool {}
+
+function snmp_get_valueretrieval(): int {}
+
+function snmp_read_mib(string $filename): bool {}
+
+class SNMP
+{
+ function __construct(int $version, string $host, string $community, int $timeout = UNKNOWN, int $retries = UNKNOWN) {}
+
+ /** @return bool */
+ function close() {}
+
+ /** @return bool */
+ function setSecurity(string $sec_level, string $auth_protocol = '', string $auth_passphrase = '', string $priv_protocol = '', string $priv_passphrase = '', string $contextName = '', string $contextEngineID = '') {}
+
+ /**
+ * @param array|string $object_id
+ * @return array|bool
+ */
+ function get($object_id, bool $use_orignames = false) {}
+
+ /**
+ * @param array|string $object_id
+ * @return array|bool
+ */
+ function getnext($object_id) {}
+
+ /**
+ * @param array|string $object_id
+ * @return array|bool
+ */
+ function walk($object_id, bool $suffix_keys = false, int $max_repetitions = UNKNOWN, int $non_repeaters = UNKNOWN) {}
+
+ /**
+ * @param array|string $object_id
+ * @param array|string $type
+ * @param array|string $value
+ * @return array|bool
+ */
+ function set($object_id, $type, $value) {}
+
+ /** @return int */
+ function getErrno() {}
+
+ /** @return string */
+ function getError() {}
+}
diff --git a/ext/snmp/snmp_arginfo.h b/ext/snmp/snmp_arginfo.h
new file mode 100644
index 0000000000..fdafded7d3
--- /dev/null
+++ b/ext/snmp/snmp_arginfo.h
@@ -0,0 +1,146 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_snmpget, 0, 3, MAY_BE_ARRAY|MAY_BE_BOOL)
+ ZEND_ARG_TYPE_INFO(0, host, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, community, IS_STRING, 0)
+ ZEND_ARG_INFO(0, object_id)
+ ZEND_ARG_TYPE_INFO(0, timeout, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, retries, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_snmpgetnext arginfo_snmpget
+
+#define arginfo_snmpwalk arginfo_snmpget
+
+#define arginfo_snmprealwalk arginfo_snmpget
+
+#define arginfo_snmpwalkoid arginfo_snmpget
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_snmpset, 0, 5, MAY_BE_ARRAY|MAY_BE_BOOL)
+ ZEND_ARG_TYPE_INFO(0, host, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, community, IS_STRING, 0)
+ ZEND_ARG_INFO(0, object_id)
+ ZEND_ARG_INFO(0, type)
+ ZEND_ARG_INFO(0, value)
+ ZEND_ARG_TYPE_INFO(0, timeout, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, retries, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_snmp_get_quick_print, 0, 0, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_snmp_set_quick_print, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, quick_print, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_snmp_set_enum_print, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, enum_print, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_snmp_set_oid_output_format, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, oid_format, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_snmp_set_oid_numeric_print arginfo_snmp_set_oid_output_format
+
+#define arginfo_snmp2_get arginfo_snmpget
+
+#define arginfo_snmp2_getnext arginfo_snmpget
+
+#define arginfo_snmp2_walk arginfo_snmpget
+
+#define arginfo_snmp2_real_walk arginfo_snmpget
+
+#define arginfo_snmp2_set arginfo_snmpset
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_snmp3_get, 0, 8, MAY_BE_ARRAY|MAY_BE_BOOL)
+ ZEND_ARG_TYPE_INFO(0, host, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, sec_name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, sec_level, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, auth_protocol, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, auth_passphrase, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, priv_protocol, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, priv_passphrase, IS_STRING, 0)
+ ZEND_ARG_INFO(0, object_id)
+ ZEND_ARG_TYPE_INFO(0, timeout, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, retries, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_snmp3_getnext arginfo_snmp3_get
+
+#define arginfo_snmp3_walk arginfo_snmp3_get
+
+#define arginfo_snmp3_real_walk arginfo_snmp3_get
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_snmp3_set, 0, 10, MAY_BE_ARRAY|MAY_BE_BOOL)
+ ZEND_ARG_TYPE_INFO(0, host, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, sec_name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, sec_level, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, auth_protocol, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, auth_passphrase, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, priv_protocol, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, priv_passphrase, IS_STRING, 0)
+ ZEND_ARG_INFO(0, object_id)
+ ZEND_ARG_INFO(0, type)
+ ZEND_ARG_INFO(0, value)
+ ZEND_ARG_TYPE_INFO(0, timeout, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, retries, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_snmp_set_valueretrieval, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, method, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_snmp_get_valueretrieval, 0, 0, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_snmp_read_mib, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SNMP___construct, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, version, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, host, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, community, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, timeout, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, retries, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SNMP_close, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SNMP_setSecurity, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, sec_level, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, auth_protocol, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, auth_passphrase, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, priv_protocol, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, priv_passphrase, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, contextName, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, contextEngineID, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SNMP_get, 0, 0, 1)
+ ZEND_ARG_INFO(0, object_id)
+ ZEND_ARG_TYPE_INFO(0, use_orignames, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SNMP_getnext, 0, 0, 1)
+ ZEND_ARG_INFO(0, object_id)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SNMP_walk, 0, 0, 1)
+ ZEND_ARG_INFO(0, object_id)
+ ZEND_ARG_TYPE_INFO(0, suffix_keys, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, max_repetitions, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, non_repeaters, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SNMP_set, 0, 0, 3)
+ ZEND_ARG_INFO(0, object_id)
+ ZEND_ARG_INFO(0, type)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SNMP_getErrno arginfo_class_SNMP_close
+
+#define arginfo_class_SNMP_getError arginfo_class_SNMP_close
diff --git a/ext/snmp/tests/bug60749.phpt b/ext/snmp/tests/bug60749.phpt
index 1ada8102c4..b12aa37614 100644
--- a/ext/snmp/tests/bug60749.phpt
+++ b/ext/snmp/tests/bug60749.phpt
@@ -13,14 +13,14 @@ require_once(__DIR__.'/snmp_include.inc');
$hostname = "php.net";
$ip = gethostbyname($hostname);
if (ip2long($ip) === FALSE) {
- echo "Could not resolve $hostname properly!\n";
- exit(1);
+ echo "Could not resolve $hostname properly!\n";
+ exit(1);
}
$port = 1161;
$session = new SNMP(SNMP::VERSION_1, "$hostname:$port", $community, $timeout, $retries);
$info = $session->info;
if (strcmp($info["hostname"], "$ip:$port") !== 0) {
- echo "'" . $info["hostname"] . "' != '$ip:$port'\n";
+ echo "'" . $info["hostname"] . "' != '$ip:$port'\n";
}
var_dump($session->close());
?>
diff --git a/ext/snmp/tests/ipv6.phpt b/ext/snmp/tests/ipv6.phpt
index 37d15542e7..38bf7ffcb6 100644
--- a/ext/snmp/tests/ipv6.phpt
+++ b/ext/snmp/tests/ipv6.phpt
@@ -25,5 +25,5 @@ var_dump(snmpget('[dead:beef::', $community, '.1.3.6.1.2.1.1.1.0'));
--EXPECTF--
string(%d) "%s"
-Warning: snmpget(): malformed IPv6 address, closing square bracket missing in %s on line %d
+Warning: snmpget(): Malformed IPv6 address, closing square bracket missing in %s on line %d
bool(false)
diff --git a/ext/snmp/tests/reflection.phpt b/ext/snmp/tests/reflection.phpt
index 7943dcf5be..53fc063be6 100644
--- a/ext/snmp/tests/reflection.phpt
+++ b/ext/snmp/tests/reflection.phpt
@@ -19,17 +19,15 @@ echo new reflectionmethod('snmp', 'getError');
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Method [ <internal:snmp, ctor> public method __construct ] {
- Parameters [5] {
- Parameter #0 [ <required> $version ]
- Parameter #1 [ <required> $host ]
- Parameter #2 [ <required> $community ]
- Parameter #3 [ <optional> $timeout ]
- Parameter #4 [ <optional> $retries ]
+ Parameter #0 [ <required> int $version ]
+ Parameter #1 [ <required> string $host ]
+ Parameter #2 [ <required> string $community ]
+ Parameter #3 [ <optional> int $timeout ]
+ Parameter #4 [ <optional> int $retries ]
}
}
Method [ <internal:snmp> public method close ] {
@@ -40,36 +38,35 @@ Method [ <internal:snmp> public method close ] {
Method [ <internal:snmp> public method setSecurity ] {
- Parameters [7] {
- Parameter #0 [ <required> $sec_level ]
- Parameter #1 [ <required> $auth_protocol ]
- Parameter #2 [ <required> $auth_passphrase ]
- Parameter #3 [ <required> $priv_protocol ]
- Parameter #4 [ <required> $priv_passphrase ]
- Parameter #5 [ <required> $contextName ]
- Parameter #6 [ <required> $contextEngineID ]
+ Parameter #0 [ <required> string $sec_level ]
+ Parameter #1 [ <optional> string $auth_protocol ]
+ Parameter #2 [ <optional> string $auth_passphrase ]
+ Parameter #3 [ <optional> string $priv_protocol ]
+ Parameter #4 [ <optional> string $priv_passphrase ]
+ Parameter #5 [ <optional> string $contextName ]
+ Parameter #6 [ <optional> string $contextEngineID ]
}
}
Method [ <internal:snmp> public method get ] {
- Parameters [2] {
Parameter #0 [ <required> $object_id ]
- Parameter #1 [ <optional> $use_orignames ]
+ Parameter #1 [ <optional> bool $use_orignames ]
}
}
Method [ <internal:snmp> public method getnext ] {
- - Parameters [2] {
+ - Parameters [1] {
Parameter #0 [ <required> $object_id ]
- Parameter #1 [ <optional> $use_orignames ]
}
}
Method [ <internal:snmp> public method walk ] {
- Parameters [4] {
Parameter #0 [ <required> $object_id ]
- Parameter #1 [ <required> $suffix_keys ]
- Parameter #2 [ <required> $max_repetitions ]
- Parameter #3 [ <required> $non_repeaters ]
+ Parameter #1 [ <optional> bool $suffix_keys ]
+ Parameter #2 [ <optional> int $max_repetitions ]
+ Parameter #3 [ <optional> int $non_repeaters ]
}
}
Method [ <internal:snmp> public method set ] {
@@ -90,4 +87,3 @@ Method [ <internal:snmp> public method getError ] {
- Parameters [0] {
}
}
-===DONE===
diff --git a/ext/snmp/tests/skipif.inc b/ext/snmp/tests/skipif.inc
index 41ac99ffe4..f3fe225e5d 100644
--- a/ext/snmp/tests/skipif.inc
+++ b/ext/snmp/tests/skipif.inc
@@ -8,5 +8,5 @@ require_once (dirname(__FILE__).'/snmp_include.inc');
//snmpget ( string $hostname , string $community ,
//string $object_id [, int $timeout [, int $retries ]] )
-if (snmpget($hostname, $community, '.1.3.6.1.2.1.1.1.0', $timeout) === false)
- die('skip NO SNMPD on this host or community invalid');
+if (@snmpget($hostname, $community, '.1.3.6.1.2.1.1.1.0', $timeout) === false)
+ die('skip NO SNMPD on this host or community invalid');
diff --git a/ext/snmp/tests/snmp-object-error.phpt b/ext/snmp/tests/snmp-object-error.phpt
index 4e6bd04ea6..606a8cf7b0 100644
--- a/ext/snmp/tests/snmp-object-error.phpt
+++ b/ext/snmp/tests/snmp-object-error.phpt
@@ -15,40 +15,40 @@ snmp_set_quick_print(false);
snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
try {
- var_dump(new SNMP(SNMP::VERSION_1, $hostname));
+ var_dump(new SNMP(SNMP::VERSION_1, $hostname));
} catch (TypeError $e) {
- print $e->getMessage() . "\n";
+ print $e->getMessage() . "\n";
}
try {
- var_dump(new SNMP(SNMP::VERSION_1, $hostname, $community, ''));
+ var_dump(new SNMP(SNMP::VERSION_1, $hostname, $community, ''));
} catch (TypeError $e) {
- print $e->getMessage() . "\n";
+ print $e->getMessage() . "\n";
}
try {
- var_dump(new SNMP(SNMP::VERSION_1, $hostname, $community, $timeout, ''));
+ var_dump(new SNMP(SNMP::VERSION_1, $hostname, $community, $timeout, ''));
} catch (TypeError $e) {
- print $e->getMessage() . "\n";
+ print $e->getMessage() . "\n";
}
try {
- var_dump(new SNMP(7, $hostname, $community));
+ var_dump(new SNMP(7, $hostname, $community));
} catch (Exception $e) {
- print $e->getMessage() . "\n";
+ print $e->getMessage() . "\n";
}
echo "Exception handling\n";
$session = new SNMP(SNMP::VERSION_3, $hostname, $user_noauth, $timeout, $retries);
try {
- var_dump($session->get('.1.3.6.1.2.1.1.1..0'));
+ var_dump($session->get('.1.3.6.1.2.1.1.1..0'));
} catch (SNMPException $e) {
- var_dump($e->getCode());
- var_dump($e->getMessage());
+ var_dump($e->getCode());
+ var_dump($e->getMessage());
}
$session->exceptions_enabled = SNMP::ERRNO_ANY;
try {
- var_dump($session->get('.1.3.6.1.2.1.1.1..0'));
+ var_dump($session->get('.1.3.6.1.2.1.1.1..0'));
} catch (SNMPException $e) {
- var_dump($e->getCode());
- var_dump($e->getMessage());
+ var_dump($e->getCode());
+ var_dump($e->getMessage());
}
var_dump($session->close());
@@ -57,17 +57,11 @@ $session = new SNMP(SNMP::VERSION_3, $hostname, $user_noauth, $timeout, $retries
$session->valueretrieval = 67;
var_dump($session->valueretrieval);
echo "Closing session\n";
-var_dump($session->close(''));
var_dump($session->close());
var_dump($session->get('.1.3.6.1.2.1.1.1.0'));
var_dump($session->close());
$session = new SNMP(SNMP::VERSION_2c, $hostname, $community, $timeout, $retries);
-var_dump($session->walk('.1.3.6.1.2.1.1', FALSE, ''));
-var_dump($session->walk('.1.3.6.1.2.1.1', FALSE, 30, ''));
-var_dump($session->get());
-var_dump($session->getnext());
-var_dump($session->set());
var_dump($session->max_oids);
$session->max_oids = "ttt";
@@ -91,29 +85,11 @@ Open normal session
Warning: main(): Unknown SNMP value retrieval method '67' in %s on line %d
int(%d)
Closing session
-
-Warning: SNMP::close() expects exactly 0 parameters, 1 given in %s on line %d
-bool(false)
bool(true)
Warning: SNMP::get(): Invalid or uninitialized SNMP object in %s on line %d
bool(false)
bool(true)
-
-Warning: SNMP::walk() expects parameter 3 to be int, string given in %s on line %d
-bool(false)
-
-Warning: SNMP::walk() expects parameter 4 to be int, string given in %s on line %d
-bool(false)
-
-Warning: SNMP::get() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: SNMP::getnext() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: SNMP::set() expects exactly 3 parameters, 0 given in %s on line %d
-bool(false)
NULL
Warning: main(): max_oids should be positive integer or NULL, got 0 in %s on line %d
diff --git a/ext/snmp/tests/snmp-object-setSecurity_error.phpt b/ext/snmp/tests/snmp-object-setSecurity_error.phpt
index f43e699a31..819642d957 100644
--- a/ext/snmp/tests/snmp-object-setSecurity_error.phpt
+++ b/ext/snmp/tests/snmp-object-setSecurity_error.phpt
@@ -18,7 +18,6 @@ $session = new SNMP(SNMP::VERSION_3, $hostname, $user_noauth, $timeout, $retries
$session->setSecurity('noAuthNoPriv');
#echo "Checking error handling\n";
-var_dump($session->setSecurity());
var_dump($session->setSecurity(''));
var_dump($session->setSecurity('bugusPriv'));
var_dump($session->setSecurity('authNoPriv', 'TTT'));
@@ -33,9 +32,6 @@ var_dump($session->close());
?>
--EXPECTF--
-Warning: SNMP::setSecurity() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
-
Warning: SNMP::setSecurity(): Invalid security level '' in %s on line %d
bool(false)
diff --git a/ext/snmp/tests/snmp-object.phpt b/ext/snmp/tests/snmp-object.phpt
index 4f22b452f0..22a77947b1 100644
--- a/ext/snmp/tests/snmp-object.phpt
+++ b/ext/snmp/tests/snmp-object.phpt
@@ -35,7 +35,7 @@ $session = new SNMP(SNMP::VERSION_2c, $hostname, $community, $timeout, $retries)
$orig = array('.1.3.6.1.2.1.1.1.0', '.1.3.6.1.2.1.1.5.0');
$result = $session->get($orig, TRUE);
foreach($orig as $oid){
- var_dump($result[$oid]);
+ var_dump($result[$oid]);
}
var_dump($session->close());
diff --git a/ext/snmp/tests/snmp2_get.phpt b/ext/snmp/tests/snmp2_get.phpt
index 12276f9952..04a8fc0347 100644
--- a/ext/snmp/tests/snmp2_get.phpt
+++ b/ext/snmp/tests/snmp2_get.phpt
@@ -15,8 +15,6 @@ snmp_set_quick_print(false);
snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
echo "Checking error handling\n";
-var_dump(snmp2_get($hostname, $community, '.1.3.6.1.2.1.1.1.0', ''));
-var_dump(snmp2_get($hostname, $community, '.1.3.6.1.2.1.1.1.0', $timeout, ''));
echo "Empty OID array\n";
var_dump(snmp2_get($hostname, $community, array(), $timeout, $retries));
@@ -48,12 +46,6 @@ var_dump(snmp2_get($hostname, $community, array('.1.3.6.1.2.1.1.1.0', '.1.3.6.1.
?>
--EXPECTF--
Checking error handling
-
-Warning: snmp2_get() expects parameter 4 to be int,%s given in %s on line %d
-bool(false)
-
-Warning: snmp2_get() expects parameter 5 to be int,%s given in %s on line %d
-bool(false)
Empty OID array
Warning: snmp2_get(): Got empty OID array in %s on line %d
diff --git a/ext/snmp/tests/snmp2_real_walk.phpt b/ext/snmp/tests/snmp2_real_walk.phpt
index 5a66312ebd..d98c2c4c04 100644
--- a/ext/snmp/tests/snmp2_real_walk.phpt
+++ b/ext/snmp/tests/snmp2_real_walk.phpt
@@ -14,10 +14,6 @@ require_once(__DIR__.'/snmp_include.inc');
snmp_set_quick_print(false);
snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
-echo "Checking error handling\n";
-var_dump(snmp2_real_walk($hostname, $community, '.1.3.6.1.2.1.1', ''));
-var_dump(snmp2_real_walk($hostname, $community, '.1.3.6.1.2.1.1', $timeout, ''));
-
echo "Checking working\n";
echo "Single OID\n";
$return = snmp2_real_walk($hostname, $community, '.1.3.6.1.2.1.1', $timeout, $retries);
@@ -50,13 +46,6 @@ var_dump($return);
?>
--EXPECTF--
-Checking error handling
-
-Warning: snmp2_real_walk() expects parameter 4 to be int, %s given in %s on line %d
-bool(false)
-
-Warning: snmp2_real_walk() expects parameter 5 to be int, %s given in %s on line %d
-bool(false)
Checking working
Single OID
string(5) "array"
diff --git a/ext/snmp/tests/snmp2_set.phpt b/ext/snmp/tests/snmp2_set.phpt
index 4f4d5d7a51..01c66d96f5 100644
--- a/ext/snmp/tests/snmp2_set.phpt
+++ b/ext/snmp/tests/snmp2_set.phpt
@@ -15,10 +15,6 @@ snmp_set_quick_print(false);
snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
echo "Check error handing\n";
-echo "4args (5 needed)\n";
-$z = snmp2_set($hostname, $communityWrite, 'SNMPv2-MIB::sysLocation.0');
-var_dump($z);
-
echo "No type & no value (timeout & retries instead)\n";
$z = snmp2_set($hostname, $communityWrite, 'SNMPv2-MIB::sysLocation.0', $timeout, $retries);
var_dump($z);
@@ -109,7 +105,7 @@ var_dump($z);
var_dump((snmpget($hostname, $communityWrite, $oid1, $timeout, $retries) === $oldvalue1));
var_dump((snmpget($hostname, $communityWrite, $oid2, $timeout, $retries) === $oldvalue2));
-echo "Multiple OID & type, singe value in array\n";
+echo "Multiple OID & type, single value in array\n";
$z = snmp2_set($hostname, $communityWrite, array($oid1, $oid2), array('s', 's'), array($newvalue1), $timeout, $retries);
var_dump($z);
var_dump((snmpget($hostname, $communityWrite, $oid1, $timeout, $retries) === $oldvalue1));
@@ -142,10 +138,6 @@ var_dump((snmpget($hostname, $communityWrite, $oid2, $timeout, $retries) === $ol
?>
--EXPECTF--
Check error handing
-4args (5 needed)
-
-Warning: snmp2_set() expects at least 5 parameters, 3 given in %s on line %d
-bool(false)
No type & no value (timeout & retries instead)
Warning: snmp2_set(): Bogus type '-1', should be single char, got 2 in %s on line %d
@@ -216,7 +208,7 @@ Warning: snmp2_set(): '%s': no type set in %s on line %d
bool(false)
bool(true)
bool(true)
-Multiple OID & type, singe value in array
+Multiple OID & type, single value in array
Warning: snmp2_set(): '%s': no value set in %s on line %d
bool(false)
diff --git a/ext/snmp/tests/snmp2_walk.phpt b/ext/snmp/tests/snmp2_walk.phpt
index ccccf76dc8..326e0a71cd 100644
--- a/ext/snmp/tests/snmp2_walk.phpt
+++ b/ext/snmp/tests/snmp2_walk.phpt
@@ -14,10 +14,6 @@ require_once(__DIR__.'/snmp_include.inc');
snmp_set_quick_print(false);
snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
-echo "Checking error handling\n";
-var_dump(snmp2_walk($hostname, $community, '.1.3.6.1.2.1.1', ''));
-var_dump(snmp2_walk($hostname, $community, '.1.3.6.1.2.1.1', $timeout, ''));
-
echo "Checking working\n";
echo "Single OID\n";
$return = snmp2_walk($hostname, $community, '.1.3.6.1.2.1.1', $timeout, $retries);
@@ -58,13 +54,6 @@ var_dump($return);
?>
--EXPECTF--
-Checking error handling
-
-Warning: snmp2_walk() expects parameter 4 to be int, %s given in %s on line %d
-bool(false)
-
-Warning: snmp2_walk() expects parameter 5 to be int, %s given in %s on line %d
-bool(false)
Checking working
Single OID
string(5) "array"
diff --git a/ext/snmp/tests/snmp3-error.phpt b/ext/snmp/tests/snmp3-error.phpt
index 58e02dc7c5..cbebf69f62 100644
--- a/ext/snmp/tests/snmp3-error.phpt
+++ b/ext/snmp/tests/snmp3-error.phpt
@@ -16,7 +16,6 @@ echo "Checking error handling\n";
// string auth_passphrase, string priv_protocol, string priv_passphrase,
// string object_id [, int timeout [, int retries]]);
-var_dump(snmp3_get($hostname, $community, '', '', '', '', ''));
var_dump(snmp3_get($hostname, $community, '', '', '', '', '', '.1.3.6.1.2.1.1.1.0'));
var_dump(snmp3_get($hostname, $community, 'bugusPriv', '', '', '', '', '.1.3.6.1.2.1.1.1.0'));
var_dump(snmp3_get($hostname, $community, 'authNoPriv', 'TTT', '', '', '', '.1.3.6.1.2.1.1.1.0'));
@@ -27,8 +26,6 @@ var_dump(snmp3_get($hostname, $community, 'authPriv', 'MD5', $auth_pass, 'AES',
var_dump(snmp3_get($hostname, $community, 'authPriv', 'MD5', $auth_pass, 'AES', 'ty', '.1.3.6.1.2.1.1.1.0'));
var_dump(snmp3_get($hostname, 'somebogususer', 'authPriv', 'MD5', $auth_pass, 'AES', $priv_pass, '.1.3.6.1.2.1.1.1.0', $timeout, $retries));
-var_dump(snmp3_set($hostname, $community, 'authPriv', 'MD5', $auth_pass, 'AES', $priv_pass, '', 's'));
-
var_dump(snmp3_set($hostname, $rwuser, 'authPriv', 'MD5', $auth_pass, 'AES', $priv_pass, '.1.3.6.777...7.5.3', 's', 'ttt', $timeout, $retries));
var_dump(snmp3_set($hostname, $rwuser, 'authPriv', 'MD5', $auth_pass, 'AES', $priv_pass, '.1.3.6.777.7.5.3', array('s'), 'yyy', $timeout, $retries));
@@ -36,9 +33,6 @@ var_dump(snmp3_set($hostname, $rwuser, 'authPriv', 'MD5', $auth_pass, 'AES', $pr
--EXPECTF--
Checking error handling
-Warning: snmp3_get() expects at least 8 parameters, 7 given in %s on line %d
-bool(false)
-
Warning: snmp3_get(): Invalid security level '' in %s on line %d
bool(false)
@@ -66,9 +60,6 @@ bool(false)
Warning: snmp3_get(): Fatal error: Unknown user name in %s on line %d
bool(false)
-Warning: snmp3_set() expects at least 10 parameters, 9 given in %s on line %d
-bool(false)
-
Warning: snmp3_set(): Invalid object identifier: .1.3.6.777...7.5.3 in %s on line %d
bool(false)
diff --git a/ext/snmp/tests/snmp3.phpt b/ext/snmp/tests/snmp3.phpt
index 68c14d058f..91f563df90 100644
--- a/ext/snmp/tests/snmp3.phpt
+++ b/ext/snmp/tests/snmp3.phpt
@@ -20,13 +20,13 @@ echo "GET single: noAuthNoPriv\n";
var_dump(snmp3_get($hostname, $user_noauth, 'noAuthNoPriv', '', '', '', '', '.1.3.6.1.2.1.1.1.0', $timeout, $retries));
foreach(array('MD5', 'SHA') as $signalg) {
- echo "GET single: $signalg\n";
- var_dump(snmp3_get($hostname, $user_auth_prefix . $signalg, 'authNoPriv', $signalg, $auth_pass, '', '', '.1.3.6.1.2.1.1.1.0', $timeout, $retries));
+ echo "GET single: $signalg\n";
+ var_dump(snmp3_get($hostname, $user_auth_prefix . $signalg, 'authNoPriv', $signalg, $auth_pass, '', '', '.1.3.6.1.2.1.1.1.0', $timeout, $retries));
}
foreach(array('AES', 'DES', 'AES128') as $chipher) {
- echo "GET single: MD5/$chipher\n";
- var_dump(snmp3_get($hostname, $user_auth_prefix . 'MD5' . $chipher, 'authPriv', 'MD5', $auth_pass, $chipher, $priv_pass, '.1.3.6.1.2.1.1.1.0', $timeout, $retries));
+ echo "GET single: MD5/$chipher\n";
+ var_dump(snmp3_get($hostname, $user_auth_prefix . 'MD5' . $chipher, 'authPriv', 'MD5', $auth_pass, $chipher, $priv_pass, '.1.3.6.1.2.1.1.1.0', $timeout, $retries));
}
$username = $user_auth_prefix . 'MD5';
echo "GET multiple\n";
diff --git a/ext/snmp/tests/snmp_get_quick_print.phpt b/ext/snmp/tests/snmp_get_quick_print.phpt
index 630f7b544a..bce2aca461 100644
--- a/ext/snmp/tests/snmp_get_quick_print.phpt
+++ b/ext/snmp/tests/snmp_get_quick_print.phpt
@@ -10,11 +10,6 @@ require_once(__DIR__.'/skipif.inc');
<?php
require_once(__DIR__.'/snmp_include.inc');
-echo "Checking error handling\n";
-var_dump(snmp_get_quick_print('noarg'));
-var_dump(snmp_set_quick_print('noarg'));
-var_dump(snmp_set_quick_print());
-
echo "Checking working\n";
var_dump(snmp_get_quick_print());
snmp_set_quick_print(false);
@@ -24,16 +19,6 @@ var_dump(snmp_get_quick_print());
?>
--EXPECTF--
-Checking error handling
-
-Warning: snmp_get_quick_print() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: snmp_set_quick_print() expects parameter 1 to be int, %s given in %s on line %d
-bool(false)
-
-Warning: snmp_set_quick_print() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
Checking working
bool(%s)
bool(false)
diff --git a/ext/snmp/tests/snmp_get_valueretrieval.phpt b/ext/snmp/tests/snmp_get_valueretrieval.phpt
index ca07ecaa55..5d2242c1cd 100644
--- a/ext/snmp/tests/snmp_get_valueretrieval.phpt
+++ b/ext/snmp/tests/snmp_get_valueretrieval.phpt
@@ -11,9 +11,6 @@ require_once(__DIR__.'/skipif.inc');
require_once(__DIR__.'/snmp_include.inc');
echo "Checking error handling\n";
-var_dump(snmp_get_valueretrieval('noarg'));
-var_dump(snmp_set_valueretrieval());
-var_dump(snmp_set_valueretrieval('noarg'));
var_dump(snmp_set_valueretrieval(67));
echo "Checking working\n";
@@ -33,15 +30,6 @@ var_dump(snmp_get_valueretrieval() === (SNMP_VALUE_LIBRARY|SNMP_VALUE_OBJECT));
--EXPECTF--
Checking error handling
-Warning: snmp_get_valueretrieval() expects exactly 0 parameters, 1 given in %s on line %d
-bool(false)
-
-Warning: snmp_set_valueretrieval() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: snmp_set_valueretrieval() expects parameter 1 to be int, %s given in %s on line %d
-bool(false)
-
Warning: snmp_set_valueretrieval(): Unknown SNMP value retrieval method '67' in %s on line %d
bool(false)
Checking working
diff --git a/ext/snmp/tests/snmp_include.inc b/ext/snmp/tests/snmp_include.inc
index d14de3effe..b31384f7cf 100644
--- a/ext/snmp/tests/snmp_include.inc
+++ b/ext/snmp/tests/snmp_include.inc
@@ -18,9 +18,9 @@ $timeout = getenv('SNMP_TIMEOUT') ?: -1;
$retries = getenv('SNMP_RETRIES') ?: 1;
if (stristr(PHP_OS, "FreeBSD")) {
- $mibdir = getenv('SNMP_MIBDIR') ?: "/usr/local/share/snmp/mibs";
+ $mibdir = getenv('SNMP_MIBDIR') ?: "/usr/local/share/snmp/mibs";
} else {
- $mibdir = getenv('SNMP_MIBDIR') ?: "/usr/share/snmp/mibs";
+ $mibdir = getenv('SNMP_MIBDIR') ?: "/usr/share/snmp/mibs";
}
diff --git a/ext/snmp/tests/snmp_read_mib.phpt b/ext/snmp/tests/snmp_read_mib.phpt
index 00203bb4e5..65ce16d209 100644
--- a/ext/snmp/tests/snmp_read_mib.phpt
+++ b/ext/snmp/tests/snmp_read_mib.phpt
@@ -15,7 +15,6 @@ if (!file_exists($mibdir . '/SNMPv2-MIB.txt')) die('skip MIB file not in the sys
require_once(__DIR__.'/snmp_include.inc');
echo "Checking error handling\n";
-var_dump(snmp_read_mib());
var_dump(snmp_read_mib(__DIR__.'/cannotfindthisfile'));
echo "Checking working\n";
@@ -25,9 +24,6 @@ var_dump(snmp_read_mib($mibdir . '/SNMPv2-MIB.txt'));
--EXPECTF--
Checking error handling
-Warning: snmp_read_mib() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
Warning: snmp_read_mib(): Error while reading MIB file '%s': No such file or directory in %s on line %d
bool(false)
Checking working
diff --git a/ext/snmp/tests/snmp_set_enum_print.phpt b/ext/snmp/tests/snmp_set_enum_print.phpt
index d67f19aee3..ed92119080 100644
--- a/ext/snmp/tests/snmp_set_enum_print.phpt
+++ b/ext/snmp/tests/snmp_set_enum_print.phpt
@@ -11,18 +11,11 @@ if (!function_exists('snmp_set_enum_print')) die('skip This function is only ava
<?php
require_once(__DIR__.'/snmp_include.inc');
-echo "Checking error handling\n";
-var_dump(snmp_set_enum_print());
-
echo "Checking working\n";
var_dump(snmp_set_enum_print(0));
var_dump(snmp_set_enum_print(1));
?>
--EXPECTF--
-Checking error handling
-
-Warning: snmp_set_enum_print() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
Checking working
bool(true)
bool(true)
diff --git a/ext/snmp/tests/snmp_set_oid_output_format.phpt b/ext/snmp/tests/snmp_set_oid_output_format.phpt
index 3d74fc40b9..3ad5f16458 100644
--- a/ext/snmp/tests/snmp_set_oid_output_format.phpt
+++ b/ext/snmp/tests/snmp_set_oid_output_format.phpt
@@ -12,7 +12,6 @@ if (!function_exists('snmp_set_oid_output_format')) die('skip This function is o
require_once(__DIR__.'/snmp_include.inc');
echo "Checking error handling\n";
-var_dump(snmp_set_oid_output_format());
var_dump(snmp_set_oid_output_format(123));
echo "Checking working\n";
@@ -22,9 +21,6 @@ var_dump(snmp_set_oid_output_format(SNMP_OID_OUTPUT_NUMERIC));
--EXPECTF--
Checking error handling
-Warning: snmp_set_oid_output_format() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
Warning: snmp_set_oid_output_format(): Unknown SNMP output print format '123' in %s on line %d
bool(false)
Checking working
diff --git a/ext/snmp/tests/snmpget.phpt b/ext/snmp/tests/snmpget.phpt
index c710420965..9875f31f65 100644
--- a/ext/snmp/tests/snmpget.phpt
+++ b/ext/snmp/tests/snmpget.phpt
@@ -14,10 +14,6 @@ require_once(__DIR__.'/snmp_include.inc');
snmp_set_quick_print(false);
snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
-echo "Checking error handling\n";
-var_dump(snmpget($hostname, $community, '.1.3.6.1.2.1.1.1.0', ''));
-var_dump(snmpget($hostname, $community, '.1.3.6.1.2.1.1.1.0', $timeout, ''));
-
echo "Checking working\n";
echo "Single OID, default timeout and retries\n";
var_dump(snmpget($hostname, $community, '.1.3.6.1.2.1.1.1.0'));
@@ -49,13 +45,6 @@ var_dump(snmpget($hostname, $community, array('.1.3.6.1.2.1.1.1.0', '.1.3.6.1.2.
?>
--EXPECTF--
-Checking error handling
-
-Warning: snmpget() expects parameter 4 to be int,%s given in %s on line %d
-bool(false)
-
-Warning: snmpget() expects parameter 5 to be int,%s given in %s on line %d
-bool(false)
Checking working
Single OID, default timeout and retries
string(%d) "%s"
diff --git a/ext/snmp/tests/snmprealwalk.phpt b/ext/snmp/tests/snmprealwalk.phpt
index ba5a304240..b3e7576466 100644
--- a/ext/snmp/tests/snmprealwalk.phpt
+++ b/ext/snmp/tests/snmprealwalk.phpt
@@ -14,10 +14,6 @@ require_once(__DIR__.'/snmp_include.inc');
snmp_set_quick_print(false);
snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
-echo "Checking error handling\n";
-var_dump(snmprealwalk($hostname, $community, '.1.3.6.1.2.1.1', ''));
-var_dump(snmprealwalk($hostname, $community, '.1.3.6.1.2.1.1', $timeout, ''));
-
echo "Checking working\n";
echo "Single OID\n";
$return = snmprealwalk($hostname, $community, '.1.3.6.1.2.1.1', $timeout, $retries);
@@ -50,13 +46,6 @@ var_dump($return);
?>
--EXPECTF--
-Checking error handling
-
-Warning: snmprealwalk() expects parameter 4 to be int, %s given in %s on line %d
-bool(false)
-
-Warning: snmprealwalk() expects parameter 5 to be int, %s given in %s on line %d
-bool(false)
Checking working
Single OID
string(5) "array"
diff --git a/ext/snmp/tests/snmpset.phpt b/ext/snmp/tests/snmpset.phpt
index 809016444d..a870ab1ca6 100644
--- a/ext/snmp/tests/snmpset.phpt
+++ b/ext/snmp/tests/snmpset.phpt
@@ -15,10 +15,6 @@ snmp_set_quick_print(false);
snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
echo "Check error handing\n";
-echo "4args (5 needed)\n";
-$z = snmpset($hostname, $communityWrite, 'SNMPv2-MIB::sysLocation.0');
-var_dump($z);
-
echo "No type & no value (timeout & retries instead)\n";
$z = snmpset($hostname, $communityWrite, 'SNMPv2-MIB::sysLocation.0', $timeout, $retries);
var_dump($z);
@@ -109,7 +105,7 @@ var_dump($z);
var_dump((snmpget($hostname, $communityWrite, $oid1, $timeout, $retries) === $oldvalue1));
var_dump((snmpget($hostname, $communityWrite, $oid2, $timeout, $retries) === $oldvalue2));
-echo "Multiple OID & type, singe value in array\n";
+echo "Multiple OID & type, single value in array\n";
$z = snmpset($hostname, $communityWrite, array($oid1, $oid2), array('s', 's'), array($newvalue1), $timeout, $retries);
var_dump($z);
var_dump((snmpget($hostname, $communityWrite, $oid1, $timeout, $retries) === $oldvalue1));
@@ -142,10 +138,6 @@ var_dump((snmpget($hostname, $communityWrite, $oid2, $timeout, $retries) === $ol
?>
--EXPECTF--
Check error handing
-4args (5 needed)
-
-Warning: snmpset() expects at least 5 parameters, 3 given in %s on line %d
-bool(false)
No type & no value (timeout & retries instead)
Warning: snmpset(): Bogus type '-1', should be single char, got 2 in %s on line %d
@@ -216,7 +208,7 @@ Warning: snmpset(): '%s': no type set in %s on line %d
bool(false)
bool(true)
bool(true)
-Multiple OID & type, singe value in array
+Multiple OID & type, single value in array
Warning: snmpset(): '%s': no value set in %s on line %d
bool(false)
diff --git a/ext/snmp/tests/snmpwalk.phpt b/ext/snmp/tests/snmpwalk.phpt
index 1cdfc6d1e5..b7ed803fd3 100644
--- a/ext/snmp/tests/snmpwalk.phpt
+++ b/ext/snmp/tests/snmpwalk.phpt
@@ -14,10 +14,6 @@ require_once(__DIR__.'/snmp_include.inc');
snmp_set_quick_print(false);
snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
-echo "Checking error handling\n";
-var_dump(snmpwalk($hostname, $community, '.1.3.6.1.2.1.1', ''));
-var_dump(snmpwalk($hostname, $community, '.1.3.6.1.2.1.1', $timeout, ''));
-
echo "Checking working\n";
echo "Single OID\n";
$return = snmpwalk($hostname, $community, '.1.3.6.1.2.1.1', $timeout, $retries);
@@ -58,13 +54,6 @@ var_dump($return);
?>
--EXPECTF--
-Checking error handling
-
-Warning: snmpwalk() expects parameter 4 to be int, %s given in %s on line %d
-bool(false)
-
-Warning: snmpwalk() expects parameter 5 to be int, %s given in %s on line %d
-bool(false)
Checking working
Single OID
string(5) "array"
diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c
index c44fec3ab0..4a7dc2ad80 100644
--- a/ext/soap/php_encoding.c
+++ b/ext/soap/php_encoding.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -2719,7 +2717,7 @@ static zval *to_zval_map(zval *ret, encodeTypePtr type, xmlNodePtr data)
} else if (Z_TYPE(key) == IS_LONG) {
zend_hash_index_update(Z_ARRVAL_P(ret), Z_LVAL(key), &value);
} else {
- soap_error0(E_ERROR, "Encoding: Can't decode apache map, only Strings or Longs are allowd as keys");
+ soap_error0(E_ERROR, "Encoding: Can't decode apache map, only Strings or Longs are allowed as keys");
}
zval_ptr_dtor(&key);
}
diff --git a/ext/soap/php_encoding.h b/ext/soap/php_encoding.h
index cab46ddf29..978012f668 100644
--- a/ext/soap/php_encoding.h
+++ b/ext/soap/php_encoding.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c
index 299fe23a82..8b251155fd 100644
--- a/ext/soap/php_http.c
+++ b/ext/soap/php_http.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/soap/php_http.h b/ext/soap/php_http.h
index 887e28fe69..8065fef7c9 100644
--- a/ext/soap/php_http.h
+++ b/ext/soap/php_http.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/soap/php_packet_soap.c b/ext/soap/php_packet_soap.c
index 685a474e82..0e3a519737 100644
--- a/ext/soap/php_packet_soap.c
+++ b/ext/soap/php_packet_soap.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/soap/php_packet_soap.h b/ext/soap/php_packet_soap.h
index 4d47071634..7a2a842537 100644
--- a/ext/soap/php_packet_soap.h
+++ b/ext/soap/php_packet_soap.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/soap/php_schema.c b/ext/soap/php_schema.c
index 33793704ad..fc80b4a79c 100644
--- a/ext/soap/php_schema.c
+++ b/ext/soap/php_schema.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/soap/php_schema.h b/ext/soap/php_schema.h
index d7b51aa4b7..9e597700ee 100644
--- a/ext/soap/php_schema.h
+++ b/ext/soap/php_schema.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/soap/php_sdl.c b/ext/soap/php_sdl.c
index 82fbd3bb20..a331e7be01 100644
--- a/ext/soap/php_sdl.c
+++ b/ext/soap/php_sdl.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/soap/php_sdl.h b/ext/soap/php_sdl.h
index f57b079f86..bd55a9618c 100644
--- a/ext/soap/php_sdl.h
+++ b/ext/soap/php_sdl.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/soap/php_soap.h b/ext/soap/php_soap.h
index 8e8adb87d2..ffc352a8f2 100644
--- a/ext/soap/php_soap.h
+++ b/ext/soap/php_soap.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/soap/php_xml.c b/ext/soap/php_xml.c
index b606030179..df55678159 100644
--- a/ext/soap/php_xml.c
+++ b/ext/soap/php_xml.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/soap/php_xml.h b/ext/soap/php_xml.h
index ac92aa9755..436b1ad28b 100644
--- a/ext/soap/php_xml.h
+++ b/ext/soap/php_xml.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
index 1383055370..3cede8417d 100644
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -25,6 +23,7 @@
#if HAVE_PHP_SESSION && !defined(COMPILE_DL_SESSION)
#include "ext/session/php_session.h"
#endif
+#include "soap_arginfo.h"
#include "zend_exceptions.h"
@@ -197,7 +196,7 @@ PHP_FUNCTION(is_soap_fault);
/* Server Functions */
-PHP_METHOD(SoapServer, SoapServer);
+PHP_METHOD(SoapServer, __construct);
PHP_METHOD(SoapServer, setClass);
PHP_METHOD(SoapServer, setObject);
PHP_METHOD(SoapServer, addFunction);
@@ -208,7 +207,7 @@ PHP_METHOD(SoapServer, fault);
PHP_METHOD(SoapServer, addSoapHeader);
/* Client Functions */
-PHP_METHOD(SoapClient, SoapClient);
+PHP_METHOD(SoapClient, __construct);
PHP_METHOD(SoapClient, __call);
PHP_METHOD(SoapClient, __getLastRequest);
PHP_METHOD(SoapClient, __getLastResponse);
@@ -223,220 +222,73 @@ PHP_METHOD(SoapClient, __setLocation);
PHP_METHOD(SoapClient, __setSoapHeaders);
/* SoapVar Functions */
-PHP_METHOD(SoapVar, SoapVar);
+PHP_METHOD(SoapVar, __construct);
/* SoapFault Functions */
-PHP_METHOD(SoapFault, SoapFault);
+PHP_METHOD(SoapFault, __construct);
PHP_METHOD(SoapFault, __toString);
/* SoapParam Functions */
-PHP_METHOD(SoapParam, SoapParam);
+PHP_METHOD(SoapParam, __construct);
/* SoapHeader Functions */
-PHP_METHOD(SoapHeader, SoapHeader);
-
-#define SOAP_CTOR(class_name, func_name, arginfo, flags) PHP_ME(class_name, func_name, arginfo, flags)
-
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO(arginfo_soap__void, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_soapparam_soapparam, 0, 0, 2)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_soapheader_soapheader, 0, 0, 2)
- ZEND_ARG_INFO(0, namespace)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, mustunderstand)
- ZEND_ARG_INFO(0, actor)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_soapfault_soapfault, 0, 0, 2)
- ZEND_ARG_INFO(0, faultcode)
- ZEND_ARG_INFO(0, faultstring)
- ZEND_ARG_INFO(0, faultactor)
- ZEND_ARG_INFO(0, detail)
- ZEND_ARG_INFO(0, faultname)
- ZEND_ARG_INFO(0, headerfault)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_soapvar_soapvar, 0, 0, 2)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, encoding)
- ZEND_ARG_INFO(0, type_name)
- ZEND_ARG_INFO(0, type_namespace)
- ZEND_ARG_INFO(0, node_name)
- ZEND_ARG_INFO(0, node_namespace)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_soapserver_fault, 0, 0, 2)
- ZEND_ARG_INFO(0, code)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, actor)
- ZEND_ARG_INFO(0, details)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_soapserver_addsoapheader, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_soapserver_soapserver, 0, 0, 1)
- ZEND_ARG_INFO(0, wsdl)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_soapserver_setpersistence, 0, 0, 1)
- ZEND_ARG_INFO(0, mode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_soapserver_setclass, 0, 0, 1)
- ZEND_ARG_INFO(0, class_name)
- ZEND_ARG_VARIADIC_INFO(0, args)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_soapserver_setobject, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_soapserver_getfunctions, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_soapserver_addfunction, 0, 0, 1)
- ZEND_ARG_INFO(0, functions)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_soapserver_handle, 0, 0, 0)
- ZEND_ARG_INFO(0, soap_request)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_soapclient_soapclient, 0, 0, 1)
- ZEND_ARG_INFO(0, wsdl)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_soapclient___call, 0, 0, 2)
- ZEND_ARG_INFO(0, function_name)
- ZEND_ARG_INFO(0, arguments)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_soapclient___soapcall, 0, 0, 2)
- ZEND_ARG_INFO(0, function_name)
- ZEND_ARG_INFO(0, arguments)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, input_headers)
- ZEND_ARG_INFO(1, output_headers)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_soapclient___getfunctions, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_soapclient___gettypes, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_soapclient___getlastrequest, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_soapclient___getlastresponse, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_soapclient___getlastrequestheaders, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_soapclient___getlastresponseheaders, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_soapclient___dorequest, 0, 0, 4)
- ZEND_ARG_INFO(0, request)
- ZEND_ARG_INFO(0, location)
- ZEND_ARG_INFO(0, action)
- ZEND_ARG_INFO(0, version)
- ZEND_ARG_INFO(0, one_way)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_soapclient___setcookie, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_soapclient___getcookies, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_soapclient___setsoapheaders, 0, 0, 0)
- ZEND_ARG_INFO(0, soapheaders)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_soapclient___setlocation, 0, 0, 0)
- ZEND_ARG_INFO(0, new_location)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_soap_use_soap_error_handler, 0, 0, 0)
- ZEND_ARG_INFO(0, handler)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_soap_is_soap_fault, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-/* }}} */
+PHP_METHOD(SoapHeader, __construct);
static const zend_function_entry soap_functions[] = {
- PHP_FE(use_soap_error_handler, arginfo_soap_use_soap_error_handler)
- PHP_FE(is_soap_fault, arginfo_soap_is_soap_fault)
+ PHP_FE(use_soap_error_handler, arginfo_use_soap_error_handler)
+ PHP_FE(is_soap_fault, arginfo_is_soap_fault)
PHP_FE_END
};
static const zend_function_entry soap_fault_functions[] = {
- SOAP_CTOR(SoapFault, SoapFault, arginfo_soapfault_soapfault, 0)
- PHP_ME(SoapFault, __toString, arginfo_soap__void, 0)
+ PHP_ME(SoapFault, __construct, arginfo_class_SoapFault___construct, 0)
+ PHP_ME(SoapFault, __toString, arginfo_class_SoapFault___toString, 0)
PHP_FE_END
};
static const zend_function_entry soap_server_functions[] = {
- SOAP_CTOR(SoapServer, SoapServer, arginfo_soapserver_soapserver, 0)
- PHP_ME(SoapServer, setPersistence, arginfo_soapserver_setpersistence, 0)
- PHP_ME(SoapServer, setClass, arginfo_soapserver_setclass, 0)
- PHP_ME(SoapServer, setObject, arginfo_soapserver_setobject, 0)
- PHP_ME(SoapServer, addFunction, arginfo_soapserver_addfunction, 0)
- PHP_ME(SoapServer, getFunctions, arginfo_soapserver_getfunctions, 0)
- PHP_ME(SoapServer, handle, arginfo_soapserver_handle, 0)
- PHP_ME(SoapServer, fault, arginfo_soapserver_fault, 0)
- PHP_ME(SoapServer, addSoapHeader, arginfo_soapserver_addsoapheader, 0)
+ PHP_ME(SoapServer, __construct, arginfo_class_SoapServer___construct, 0)
+ PHP_ME(SoapServer, setPersistence, arginfo_class_SoapServer_setPersistence, 0)
+ PHP_ME(SoapServer, setClass, arginfo_class_SoapServer_setClass, 0)
+ PHP_ME(SoapServer, setObject, arginfo_class_SoapServer_setObject, 0)
+ PHP_ME(SoapServer, addFunction, arginfo_class_SoapServer_addFunction, 0)
+ PHP_ME(SoapServer, getFunctions, arginfo_class_SoapServer_getFunctions, 0)
+ PHP_ME(SoapServer, handle, arginfo_class_SoapServer_handle, 0)
+ PHP_ME(SoapServer, fault, arginfo_class_SoapServer_fault, 0)
+ PHP_ME(SoapServer, addSoapHeader, arginfo_class_SoapServer_addSoapHeader, 0)
PHP_FE_END
};
static const zend_function_entry soap_client_functions[] = {
- SOAP_CTOR(SoapClient, SoapClient, arginfo_soapclient_soapclient, 0)
- PHP_ME(SoapClient, __call, arginfo_soapclient___call, 0)
- ZEND_NAMED_ME(__soapCall, ZEND_MN(SoapClient___call), arginfo_soapclient___soapcall, 0)
- PHP_ME(SoapClient, __getLastRequest, arginfo_soapclient___getlastrequest, 0)
- PHP_ME(SoapClient, __getLastResponse, arginfo_soapclient___getlastresponse, 0)
- PHP_ME(SoapClient, __getLastRequestHeaders, arginfo_soapclient___getlastrequestheaders, 0)
- PHP_ME(SoapClient, __getLastResponseHeaders, arginfo_soapclient___getlastresponseheaders, 0)
- PHP_ME(SoapClient, __getFunctions, arginfo_soapclient___getfunctions, 0)
- PHP_ME(SoapClient, __getTypes, arginfo_soapclient___gettypes, 0)
- PHP_ME(SoapClient, __doRequest, arginfo_soapclient___dorequest, 0)
- PHP_ME(SoapClient, __setCookie, arginfo_soapclient___setcookie, 0)
- PHP_ME(SoapClient, __getCookies, arginfo_soapclient___getcookies, 0)
- PHP_ME(SoapClient, __setLocation, arginfo_soapclient___setlocation, 0)
- PHP_ME(SoapClient, __setSoapHeaders, arginfo_soapclient___setsoapheaders, 0)
+ PHP_ME(SoapClient, __construct, arginfo_class_SoapClient___construct, 0)
+ PHP_ME(SoapClient, __call, arginfo_class_SoapClient___call, 0)
+ ZEND_NAMED_ME(__soapCall, ZEND_MN(SoapClient___call), arginfo_class_SoapClient___soapCall, 0)
+ PHP_ME(SoapClient, __getLastRequest, arginfo_class_SoapClient___getLastRequest, 0)
+ PHP_ME(SoapClient, __getLastResponse, arginfo_class_SoapClient___getLastResponse, 0)
+ PHP_ME(SoapClient, __getLastRequestHeaders, arginfo_class_SoapClient___getLastRequestHeaders, 0)
+ PHP_ME(SoapClient, __getLastResponseHeaders, arginfo_class_SoapClient___getLastResponseHeaders, 0)
+ PHP_ME(SoapClient, __getFunctions, arginfo_class_SoapClient___getFunctions, 0)
+ PHP_ME(SoapClient, __getTypes, arginfo_class_SoapClient___getTypes, 0)
+ PHP_ME(SoapClient, __doRequest, arginfo_class_SoapClient___doRequest, 0)
+ PHP_ME(SoapClient, __setCookie, arginfo_class_SoapClient___setCookie, 0)
+ PHP_ME(SoapClient, __getCookies, arginfo_class_SoapClient___getCookies, 0)
+ PHP_ME(SoapClient, __setLocation, arginfo_class_SoapClient___setLocation, 0)
+ PHP_ME(SoapClient, __setSoapHeaders, arginfo_class_SoapClient___setSoapHeaders, 0)
PHP_FE_END
};
static const zend_function_entry soap_var_functions[] = {
- SOAP_CTOR(SoapVar, SoapVar, arginfo_soapvar_soapvar, 0)
+ PHP_ME(SoapVar, __construct, arginfo_class_SoapVar___construct, 0)
PHP_FE_END
};
static const zend_function_entry soap_param_functions[] = {
- SOAP_CTOR(SoapParam, SoapParam, arginfo_soapparam_soapparam, 0)
+ PHP_ME(SoapParam, __construct, arginfo_class_SoapParam___construct, 0)
PHP_FE_END
};
static const zend_function_entry soap_header_functions[] = {
- SOAP_CTOR(SoapHeader, SoapHeader, arginfo_soapheader_soapheader, 0)
+ PHP_ME(SoapHeader, __construct, arginfo_class_SoapHeader___construct, 0)
PHP_FE_END
};
@@ -785,17 +637,17 @@ PHP_MINFO_FUNCTION(soap)
}
-/* {{{ proto object SoapParam::SoapParam(mixed data, string name)
+/* {{{ proto object SoapParam::__construct(mixed data, string name)
SoapParam constructor */
-PHP_METHOD(SoapParam, SoapParam)
+PHP_METHOD(SoapParam, __construct)
{
zval *data;
char *name;
size_t name_length;
zval *this_ptr;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "zs", &data, &name, &name_length) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "zs", &data, &name, &name_length) == FAILURE) {
+ RETURN_THROWS();
}
if (name_length == 0) {
php_error_docref(NULL, E_WARNING, "Invalid parameter name");
@@ -809,9 +661,9 @@ PHP_METHOD(SoapParam, SoapParam)
/* }}} */
-/* {{{ proto object SoapHeader::SoapHeader(string namespace, string name [, mixed data [, bool mustUnderstand [, mixed actor]]])
+/* {{{ proto object SoapHeader::__construct(string namespace, string name [, mixed data [, bool mustUnderstand [, mixed actor]]])
SoapHeader constructor */
-PHP_METHOD(SoapHeader, SoapHeader)
+PHP_METHOD(SoapHeader, __construct)
{
zval *data = NULL, *actor = NULL;
char *name, *ns;
@@ -819,8 +671,8 @@ PHP_METHOD(SoapHeader, SoapHeader)
zend_bool must_understand = 0;
zval *this_ptr;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "ss|zbz", &ns, &ns_len, &name, &name_len, &data, &must_understand, &actor) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|zbz", &ns, &ns_len, &name, &name_len, &data, &must_understand, &actor) == FAILURE) {
+ RETURN_THROWS();
}
if (ns_len == 0) {
php_error_docref(NULL, E_WARNING, "Invalid namespace");
@@ -852,20 +704,20 @@ PHP_METHOD(SoapHeader, SoapHeader)
}
/* }}} */
-/* {{{ proto object SoapFault::SoapFault(string faultcode, string faultstring [, string faultactor [, mixed detail [, string faultname [, mixed headerfault]]]])
+/* {{{ proto object SoapFault::__construct(string faultcode, string faultstring [, string faultactor [, mixed detail [, string faultname [, mixed headerfault]]]])
SoapFault constructor */
-PHP_METHOD(SoapFault, SoapFault)
+PHP_METHOD(SoapFault, __construct)
{
char *fault_string = NULL, *fault_code = NULL, *fault_actor = NULL, *name = NULL, *fault_code_ns = NULL;
size_t fault_string_len, fault_actor_len = 0, name_len = 0, fault_code_len = 0;
zval *code = NULL, *details = NULL, *headerfault = NULL, *this_ptr;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "zs|s!z!s!z",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "zs|s!z!s!z!",
&code,
&fault_string, &fault_string_len,
&fault_actor, &fault_actor_len,
&details, &name, &name_len, &headerfault) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (Z_TYPE_P(code) == IS_NULL) {
@@ -915,7 +767,7 @@ PHP_METHOD(SoapFault, __toString)
zend_long line_val;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
this_ptr = ZEND_THIS;
@@ -955,16 +807,16 @@ PHP_METHOD(SoapFault, __toString)
}
/* }}} */
-/* {{{ proto object SoapVar::SoapVar(mixed data, int encoding [, string type_name [, string type_namespace [, string node_name [, string node_namespace]]]])
+/* {{{ proto object SoapVar::__construct(mixed data, int encoding [, string type_name [, string type_namespace [, string node_name [, string node_namespace]]]])
SoapVar constructor */
-PHP_METHOD(SoapVar, SoapVar)
+PHP_METHOD(SoapVar, __construct)
{
zval *data, *type, *this_ptr;
char *stype = NULL, *ns = NULL, *name = NULL, *namens = NULL;
size_t stype_len = 0, ns_len = 0, name_len = 0, namens_len = 0;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "z!z|ssss", &data, &type, &stype, &stype_len, &ns, &ns_len, &name, &name_len, &namens, &namens_len) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "z!z|ssss", &data, &type, &stype, &stype_len, &ns, &ns_len, &name, &name_len, &namens, &namens_len) == FAILURE) {
+ RETURN_THROWS();
}
this_ptr = ZEND_THIS;
@@ -1102,9 +954,9 @@ static HashTable* soap_create_typemap(sdlPtr sdl, HashTable *ht) /* {{{ */
}
/* }}} */
-/* {{{ proto object SoapServer::SoapServer(mixed wsdl [, array options])
+/* {{{ proto object SoapServer::__construct(mixed wsdl [, array options])
SoapServer constructor */
-PHP_METHOD(SoapServer, SoapServer)
+PHP_METHOD(SoapServer, __construct)
{
soapServicePtr service;
zval *wsdl = NULL, *options = NULL;
@@ -1113,12 +965,12 @@ PHP_METHOD(SoapServer, SoapServer)
zend_long cache_wsdl;
HashTable *typemap_ht = NULL;
- SOAP_SERVER_BEGIN_CODE();
-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|a", &wsdl, &options) == FAILURE) {
- php_error_docref(NULL, E_ERROR, "Invalid parameters");
+ RETURN_THROWS();
}
+ SOAP_SERVER_BEGIN_CODE();
+
if (Z_TYPE_P(wsdl) != IS_STRING && Z_TYPE_P(wsdl) != IS_NULL) {
php_error_docref(NULL, E_ERROR, "Invalid parameters");
}
@@ -1276,7 +1128,7 @@ PHP_METHOD(SoapServer, setClass)
FETCH_THIS_SERVICE(service);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S*", &classname, &argv, &num_args) == FAILURE) {
- return;
+ RETURN_THROWS();
}
ce = zend_lookup_class(classname);
@@ -1316,7 +1168,7 @@ PHP_METHOD(SoapServer, setObject)
FETCH_THIS_SERVICE(service);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &obj) == FAILURE) {
- return;
+ RETURN_THROWS();
}
service->type = SOAP_OBJECT;
@@ -1339,7 +1191,7 @@ PHP_METHOD(SoapServer, getFunctions)
SOAP_SERVER_BEGIN_CODE();
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
FETCH_THIS_SERVICE(service);
@@ -1385,7 +1237,7 @@ PHP_METHOD(SoapServer, addFunction)
FETCH_THIS_SERVICE(service);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &function_name) == FAILURE) {
- return;
+ RETURN_THROWS();
}
/* TODO: could use zend_is_callable here */
@@ -1506,7 +1358,7 @@ PHP_METHOD(SoapServer, handle)
SOAP_GLOBAL(soap_version) = service->version;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &arg, &arg_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (ZEND_NUM_ARGS() > 0 && ZEND_SIZE_T_INT_OVFL(arg_len)) {
@@ -1995,7 +1847,7 @@ PHP_METHOD(SoapServer, fault)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|szs",
&code, &code_len, &string, &string_len, &actor, &actor_len, &details,
&name, &name_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
soap_server_fault(code, string, actor, details, name);
@@ -2014,6 +1866,10 @@ PHP_METHOD(SoapServer, addSoapHeader)
SOAP_SERVER_BEGIN_CODE();
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &fault, soap_header_class_entry) == FAILURE) {
+ RETURN_THROWS();
+ }
+
FETCH_THIS_SERVICE(service);
if (!service || !service->soap_headers_ptr) {
@@ -2021,10 +1877,6 @@ PHP_METHOD(SoapServer, addSoapHeader)
return;
}
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &fault, soap_header_class_entry) == FAILURE) {
- return;
- }
-
p = service->soap_headers_ptr;
while (*p != NULL) {
p = &(*p)->next;
@@ -2265,15 +2117,15 @@ PHP_FUNCTION(is_soap_fault)
instanceof_function(Z_OBJCE_P(fault), soap_fault_class_entry)) {
RETURN_TRUE;
}
- RETURN_FALSE
+ RETURN_FALSE;
}
/* }}} */
/* SoapClient functions */
-/* {{{ proto object SoapClient::SoapClient(mixed wsdl [, array options])
+/* {{{ proto object SoapClient::__construct(mixed wsdl [, array options])
SoapClient constructor */
-PHP_METHOD(SoapClient, SoapClient)
+PHP_METHOD(SoapClient, __construct)
{
zval *wsdl, *options = NULL;
@@ -2284,12 +2136,12 @@ PHP_METHOD(SoapClient, SoapClient)
HashTable *typemap_ht = NULL;
zval *this_ptr = ZEND_THIS;
- SOAP_CLIENT_BEGIN_CODE();
-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|a", &wsdl, &options) == FAILURE) {
- php_error_docref(NULL, E_ERROR, "Invalid parameters");
+ RETURN_THROWS();
}
+ SOAP_CLIENT_BEGIN_CODE();
+
if (Z_TYPE_P(wsdl) != IS_STRING && Z_TYPE_P(wsdl) != IS_NULL) {
php_error_docref(NULL, E_ERROR, "$wsdl must be string or null");
}
@@ -2836,7 +2688,7 @@ PHP_METHOD(SoapClient, __call)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sa|a!zz",
&function, &function_len, &args, &options, &headers, &output_headers) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (options) {
@@ -2935,7 +2787,7 @@ PHP_METHOD(SoapClient, __getFunctions)
FETCH_THIS_SDL(sdl);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (sdl) {
@@ -2962,7 +2814,7 @@ PHP_METHOD(SoapClient, __getTypes)
FETCH_THIS_SDL(sdl);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (sdl) {
@@ -2989,7 +2841,7 @@ PHP_METHOD(SoapClient, __getLastRequest)
zval *tmp;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(ZEND_THIS), "__last_request", sizeof("__last_request")-1)) != NULL &&
@@ -3008,7 +2860,7 @@ PHP_METHOD(SoapClient, __getLastResponse)
zval *tmp;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(ZEND_THIS), "__last_response", sizeof("__last_response")-1)) != NULL &&
@@ -3027,7 +2879,7 @@ PHP_METHOD(SoapClient, __getLastRequestHeaders)
zval *tmp;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(ZEND_THIS), "__last_request_headers", sizeof("__last_request_headers")-1)) != NULL &&
@@ -3046,7 +2898,7 @@ PHP_METHOD(SoapClient, __getLastResponseHeaders)
zval *tmp;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(ZEND_THIS), "__last_response_headers", sizeof("__last_response_headers")-1)) != NULL &&
@@ -3074,7 +2926,7 @@ PHP_METHOD(SoapClient, __doRequest)
&location, &location_size,
&action, &action_size,
&version, &one_way) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (SOAP_GLOBAL(features) & SOAP_WAIT_ONE_WAY_CALLS) {
one_way = 0;
@@ -3103,8 +2955,8 @@ PHP_METHOD(SoapClient, __setCookie)
zval *cookies;
zval *this_ptr = ZEND_THIS;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", &name, &name_len, &val, &val_len) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s!", &name, &name_len, &val, &val_len) == FAILURE) {
+ RETURN_THROWS();
}
if (val == NULL) {
@@ -3137,7 +2989,7 @@ PHP_METHOD(SoapClient, __getCookies)
zval *cookies;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
@@ -3160,7 +3012,7 @@ PHP_METHOD(SoapClient, __setSoapHeaders)
zval *this_ptr = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|z", &headers) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (headers == NULL || Z_TYPE_P(headers) == IS_NULL) {
@@ -3198,7 +3050,7 @@ PHP_METHOD(SoapClient, __setLocation)
zval *this_ptr = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &location, &location_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "location", sizeof("location")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) {
diff --git a/ext/soap/soap.stub.php b/ext/soap/soap.stub.php
new file mode 100644
index 0000000000..15ea54f660
--- /dev/null
+++ b/ext/soap/soap.stub.php
@@ -0,0 +1,101 @@
+<?php
+
+function use_soap_error_handler(bool $handler = true): bool {}
+
+function is_soap_fault($object): bool {}
+
+class SoapParam
+{
+ function __construct($data, string $name);
+}
+
+class SoapHeader
+{
+ function __construct(string $namespace, string $name, $data = UNKNOWN, bool $mustunderstand = false, $actor = UNKNOWN);
+}
+
+class SoapFault extends Exception
+{
+ function __construct($faultcode, string $faultstring, ?string $faultactor = null, $detail = null, ?string $faultname = null, $headerfault = null);
+
+ /** @return string */
+ function __toString();
+}
+
+class SoapVar
+{
+ function __construct($data, $encoding, string $type_name = "", string $type_namespace = "", string $node_name = "", string $node_namespace = "");
+}
+
+class SoapServer
+{
+ function __construct($wsdl, array $options = []);
+
+ /** @return void */
+ function fault(string $code, string $string, string $actor = "", $details = null, string $name = "");
+
+ /** @return void */
+ function addSoapHeader(SoapHeader $object);
+
+ /** @return void */
+ function setPersistence(int $mode);
+
+ /** @return void */
+ function setClass(string $class_name, ...$argv);
+
+ /** @return void */
+ function setObject(object $object);
+
+ /** @return array */
+ function getFunctions();
+
+ /** @return void */
+ function addFunction($functions);
+
+ /** @return void */
+ function handle(string $soap_request = UNKNOWN);
+}
+
+class SoapClient
+{
+ function __construct($wsdl, array $options = []);
+
+ /** @return mixed */
+ function __call(string $function_name, array $arguments);
+
+ /** @return mixed */
+ function __soapCall(string $function_name, array $arguments, ?array $options = null, $input_headers = null, $output_headers = null);
+
+ /** @return array|null */
+ function __getFunctions();
+
+ /** @return array|null */
+ function __getTypes();
+
+ /** @return ?string */
+ function __getLastRequest();
+
+ /** @return ?string */
+ function __getLastResponse();
+
+ /** @return ?string */
+ function __getLastRequestHeaders();
+
+ /** @return ?string */
+ function __getLastResponseHeaders();
+
+ /** @return ?string */
+ function __doRequest(string $request, string $location, string $action, int $version, int $one_way = 0);
+
+ /** @return void */
+ function __setCookie(string $name, ?string $value = null);
+
+ /** @return array */
+ function __getCookies();
+
+ /** @return bool */
+ function __setSoapHeaders($soapheaders = null);
+
+ /** @return ?string */
+ function __setLocation(string $new_location = "");
+}
diff --git a/ext/soap/soap_arginfo.h b/ext/soap/soap_arginfo.h
new file mode 100644
index 0000000000..69079b82eb
--- /dev/null
+++ b/ext/soap/soap_arginfo.h
@@ -0,0 +1,133 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_use_soap_error_handler, 0, 0, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, handler, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_is_soap_fault, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, object)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapParam___construct, 0, 0, 2)
+ ZEND_ARG_INFO(0, data)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapHeader___construct, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, namespace, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_INFO(0, data)
+ ZEND_ARG_TYPE_INFO(0, mustunderstand, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, actor)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapFault___construct, 0, 0, 2)
+ ZEND_ARG_INFO(0, faultcode)
+ ZEND_ARG_TYPE_INFO(0, faultstring, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, faultactor, IS_STRING, 1)
+ ZEND_ARG_INFO(0, detail)
+ ZEND_ARG_TYPE_INFO(0, faultname, IS_STRING, 1)
+ ZEND_ARG_INFO(0, headerfault)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapFault___toString, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapVar___construct, 0, 0, 2)
+ ZEND_ARG_INFO(0, data)
+ ZEND_ARG_INFO(0, encoding)
+ ZEND_ARG_TYPE_INFO(0, type_name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, type_namespace, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, node_name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, node_namespace, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapServer___construct, 0, 0, 1)
+ ZEND_ARG_INFO(0, wsdl)
+ ZEND_ARG_TYPE_INFO(0, options, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapServer_fault, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, code, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, actor, IS_STRING, 0)
+ ZEND_ARG_INFO(0, details)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapServer_addSoapHeader, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, object, SoapHeader, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapServer_setPersistence, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapServer_setClass, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, class_name, IS_STRING, 0)
+ ZEND_ARG_VARIADIC_INFO(0, argv)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapServer_setObject, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, object, IS_OBJECT, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SoapServer_getFunctions arginfo_class_SoapFault___toString
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapServer_addFunction, 0, 0, 1)
+ ZEND_ARG_INFO(0, functions)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapServer_handle, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, soap_request, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SoapClient___construct arginfo_class_SoapServer___construct
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapClient___call, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, function_name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, arguments, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapClient___soapCall, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, function_name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, arguments, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_ARRAY, 1)
+ ZEND_ARG_INFO(0, input_headers)
+ ZEND_ARG_INFO(0, output_headers)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SoapClient___getFunctions arginfo_class_SoapFault___toString
+
+#define arginfo_class_SoapClient___getTypes arginfo_class_SoapFault___toString
+
+#define arginfo_class_SoapClient___getLastRequest arginfo_class_SoapFault___toString
+
+#define arginfo_class_SoapClient___getLastResponse arginfo_class_SoapFault___toString
+
+#define arginfo_class_SoapClient___getLastRequestHeaders arginfo_class_SoapFault___toString
+
+#define arginfo_class_SoapClient___getLastResponseHeaders arginfo_class_SoapFault___toString
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapClient___doRequest, 0, 0, 4)
+ ZEND_ARG_TYPE_INFO(0, request, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, location, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, action, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, version, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, one_way, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapClient___setCookie, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SoapClient___getCookies arginfo_class_SoapFault___toString
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapClient___setSoapHeaders, 0, 0, 0)
+ ZEND_ARG_INFO(0, soapheaders)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SoapClient___setLocation, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, new_location, IS_STRING, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/soap/tests/any.phpt b/ext/soap/tests/any.phpt
index d84443b06f..af9696bf51 100644
--- a/ext/soap/tests/any.phpt
+++ b/ext/soap/tests/any.phpt
@@ -17,15 +17,15 @@ class SOAPComplexType {
$struct = new SOAPComplexType('arg',34,325.325);
function echoAnyElement($x) {
- global $g;
+ global $g;
- $g = $x;
- $struct = $x->inputAny->any["SOAPComplexType"];
- if ($struct instanceof SOAPComplexType) {
- return array("return" => array("any" => array("SOAPComplexType"=>new SoapVar($struct, SOAP_ENC_OBJECT, "SOAPComplexType", "http://soapinterop.org/xsd", "SOAPComplexType", "http://soapinterop.org/"))));
- } else {
- return "?";
- }
+ $g = $x;
+ $struct = $x->inputAny->any["SOAPComplexType"];
+ if ($struct instanceof SOAPComplexType) {
+ return array("return" => array("any" => array("SOAPComplexType"=>new SoapVar($struct, SOAP_ENC_OBJECT, "SOAPComplexType", "http://soapinterop.org/xsd", "SOAPComplexType", "http://soapinterop.org/"))));
+ } else {
+ return "?";
+ }
}
class TestSoapClient extends SoapClient {
diff --git a/ext/soap/tests/bug46760.phpt b/ext/soap/tests/bug46760.phpt
index 95cb58867f..f591e1b3d6 100644
--- a/ext/soap/tests/bug46760.phpt
+++ b/ext/soap/tests/bug46760.phpt
@@ -8,9 +8,9 @@ Bug #46760 (SoapClient doRequest fails when proxy is used)
$client = new SoapClient(null, array('proxy_host' => "localhost",
'proxy_port' => '8080',
'login' => "user",
- 'password' => "test",
- 'uri' => 'mo:http://www.w3.org/',
- 'location' => 'http://some.url'));
+ 'password' => "test",
+ 'uri' => 'mo:http://www.w3.org/',
+ 'location' => 'http://some.url'));
var_dump($client->_proxy_port);
?>
diff --git a/ext/soap/tests/bug48557.phpt b/ext/soap/tests/bug48557.phpt
index aa20c14610..e4c4e89342 100644
--- a/ext/soap/tests/bug48557.phpt
+++ b/ext/soap/tests/bug48557.phpt
@@ -9,7 +9,7 @@ ini_set('display_errors', 1);
ini_set("soap.wsdl_cache_enabled", 0);
function test($map) {
- var_dump($map, $map[1], $map[2]);die;
+ var_dump($map, $map[1], $map[2]);die;
}
$y = new SoapServer(__DIR__ . '/bug48557.wsdl');
@@ -17,36 +17,36 @@ $y->addfunction("test");
$request = <<<XML
<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://test-uri/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns2="http://xml.apache.org/xml-soap" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
- <SOAP-ENV:Body>
- <ns1:test>
- <testParam xsi:type="ns2:Map">
- <item>
- <key xsi:type="xsd:int">1</key>
- <value xsi:type="xsd:int">123</value>
- </item>
- <item>
- <key xsi:type="xsd:int">-1000</key>
- <value xsi:type="xsd:string">123</value>
- </item>
- <item>
- <key xsi:type="xsd:string">2</key>
- <value xsi:type="xsd:float">123.5</value>
- </item>
- <item>
- <key xsi:type="xsd:string">-2000</key>
- <value xsi:type="xsd:float">123.5</value>
- </item>
- <item>
- <key xsi:type="xsd:string">011</key>
- <value xsi:type="xsd:float">123.5</value>
- </item>
- <item>
- <key xsi:type="xsd:int">012</key>
- <value xsi:type="xsd:float">123.5</value>
- </item>
- </testParam>
- </ns1:test>
- </SOAP-ENV:Body>
+ <SOAP-ENV:Body>
+ <ns1:test>
+ <testParam xsi:type="ns2:Map">
+ <item>
+ <key xsi:type="xsd:int">1</key>
+ <value xsi:type="xsd:int">123</value>
+ </item>
+ <item>
+ <key xsi:type="xsd:int">-1000</key>
+ <value xsi:type="xsd:string">123</value>
+ </item>
+ <item>
+ <key xsi:type="xsd:string">2</key>
+ <value xsi:type="xsd:float">123.5</value>
+ </item>
+ <item>
+ <key xsi:type="xsd:string">-2000</key>
+ <value xsi:type="xsd:float">123.5</value>
+ </item>
+ <item>
+ <key xsi:type="xsd:string">011</key>
+ <value xsi:type="xsd:float">123.5</value>
+ </item>
+ <item>
+ <key xsi:type="xsd:int">012</key>
+ <value xsi:type="xsd:float">123.5</value>
+ </item>
+ </testParam>
+ </ns1:test>
+ </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
XML;
diff --git a/ext/soap/tests/bug69137.phpt b/ext/soap/tests/bug69137.phpt
index 9160b91c25..d34ba13e3e 100644
--- a/ext/soap/tests/bug69137.phpt
+++ b/ext/soap/tests/bug69137.phpt
@@ -26,9 +26,9 @@ $client = new SoapClient($testServiceWsdl);
unset($client);
$parameters = [
- 'proxy_host' => $proxyHost,
- 'proxy_port' => $proxyPort,
- 'trace' => 1,
+ 'proxy_host' => $proxyHost,
+ 'proxy_port' => $proxyPort,
+ 'trace' => 1,
];
$client = new SoapClient($testServiceWsdl, $parameters);
@@ -39,7 +39,7 @@ $lookup->ipAddress = '72.52.91.14';
$result = $client->ResolveIP($lookup);
if ($result && is_object($result) && $result->ResolveIPResult && is_object($result->ResolveIPResult)) {
- print "successful lookup";
+ print "successful lookup";
}
?>
--EXPECT--
diff --git a/ext/soap/tests/bug70388.phpt b/ext/soap/tests/bug70388.phpt
index 6c0d1081de..fc67de1142 100644
--- a/ext/soap/tests/bug70388.phpt
+++ b/ext/soap/tests/bug70388.phpt
@@ -6,10 +6,10 @@ Bug #70388 (SOAP serialize_function_call() type confusion / RCE)
<?php
$dummy = unserialize('O:10:"SoapClient":3:{s:3:"uri";s:1:"X";s:8:"location";s:22:"http://localhost/a.xml";s:17:"__default_headers";a:1:{i:1;s:1337:"'.str_repeat("X", 1337).'";}}');
try {
- var_dump($dummy->notexisting());
+ var_dump($dummy->notexisting());
} catch(Exception $e) {
- var_dump($e->getMessage());
- var_dump(get_class($e));
+ var_dump($e->getMessage());
+ var_dump(get_class($e));
}
?>
--EXPECTF--
diff --git a/ext/soap/tests/bug70875.phpt b/ext/soap/tests/bug70875.phpt
index 6f10462bfc..86a16697ce 100644
--- a/ext/soap/tests/bug70875.phpt
+++ b/ext/soap/tests/bug70875.phpt
@@ -9,19 +9,19 @@ soap.wsdl_cache_enabled=0
class bug70875 extends SOAPClient
{
- public function __doRequest($request, $location, $action, $version, $one_way = 0)
- {
- die("no SIGSEGV");
- }
+ public function __doRequest($request, $location, $action, $version, $one_way = 0)
+ {
+ die("no SIGSEGV");
+ }
}
$c = new bug70875(__DIR__.'/bug70875.wsdl', [
- 'trace' => 1,
- 'classmap' => [
- 'TestService' => 'TestService',
- 'TestServiceRQ' => 'TestServiceRQ',
- 'RqHeader' => 'RqHeader',
- ],
+ 'trace' => 1,
+ 'classmap' => [
+ 'TestService' => 'TestService',
+ 'TestServiceRQ' => 'TestServiceRQ',
+ 'RqHeader' => 'RqHeader',
+ ],
]);
@@ -32,7 +32,7 @@ class TestService
class TestServiceRQ
{
- public $RqHeader;
+ public $RqHeader;
}
class RqHeader
diff --git a/ext/soap/tests/bug71610.phpt b/ext/soap/tests/bug71610.phpt
index f00d57700a..f88124d50c 100644
--- a/ext/soap/tests/bug71610.phpt
+++ b/ext/soap/tests/bug71610.phpt
@@ -11,7 +11,7 @@ $exploit = unserialize('O:10:"SoapClient":3:{s:3:"uri";s:1:"a";s:8:"location";s:
try {
$exploit->blahblah();
} catch(SoapFault $e) {
- echo $e->getMessage()."\n";
+ echo $e->getMessage()."\n";
}
?>
--EXPECT--
diff --git a/ext/soap/tests/bug73037.phpt b/ext/soap/tests/bug73037.phpt
index 897aec89d0..d835f2a280 100644
--- a/ext/soap/tests/bug73037.phpt
+++ b/ext/soap/tests/bug73037.phpt
@@ -20,46 +20,46 @@ include __DIR__ . "/../../../sapi/cli/tests/php_cli_server.inc";
function get_data($max)
{
- $piece = "<CD>
- <TITLE>Empire Burlesque</TITLE>
- <ARTIST>Bob Dylan</ARTIST>
- <COUNTRY>USA</COUNTRY>
- <COMPANY>Columbia</COMPANY>
- <PRICE>10.90</PRICE>
- <YEAR>1985</YEAR>
- </CD>";
-
- $begin = '<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><CATALOG>';
- $end = '</CATALOG></soapenv:Body></soapenv:Envelope>';
-
- $min = strlen($begin) + strlen($piece) + strlen($end);
- $max = $max < $min ? $min : $max;
-
- $data = $begin;
- $data .= $piece;
- while (strlen($data) + strlen($end) < $max) {
- /* Randomize a bit, taking gzip in account. */
- $tmp = str_replace(
- array(
- "Empire Burlesque",
- "Bob Dylan",
- ),
- array(
- md5(uniqid()),
- sha1(uniqid()),
- ),
- $piece
- );
-
- if (strlen($begin) + strlen($tmp) + strlen($end) > $max) {
- break;
- }
-
- $data .= $tmp;
- }
- $data .= $end;
-
- return $data;
+ $piece = "<CD>
+ <TITLE>Empire Burlesque</TITLE>
+ <ARTIST>Bob Dylan</ARTIST>
+ <COUNTRY>USA</COUNTRY>
+ <COMPANY>Columbia</COMPANY>
+ <PRICE>10.90</PRICE>
+ <YEAR>1985</YEAR>
+ </CD>";
+
+ $begin = '<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><CATALOG>';
+ $end = '</CATALOG></soapenv:Body></soapenv:Envelope>';
+
+ $min = strlen($begin) + strlen($piece) + strlen($end);
+ $max = $max < $min ? $min : $max;
+
+ $data = $begin;
+ $data .= $piece;
+ while (strlen($data) + strlen($end) < $max) {
+ /* Randomize a bit, taking gzip in account. */
+ $tmp = str_replace(
+ array(
+ "Empire Burlesque",
+ "Bob Dylan",
+ ),
+ array(
+ md5(uniqid()),
+ sha1(uniqid()),
+ ),
+ $piece
+ );
+
+ if (strlen($begin) + strlen($tmp) + strlen($end) > $max) {
+ break;
+ }
+
+ $data .= $tmp;
+ }
+ $data .= $end;
+
+ return $data;
}
$router = "bug73037_server.php";
@@ -74,19 +74,19 @@ PHP;
php_cli_server_start($code, $router, $args);
foreach (array(1024-1, 1024*8-3, 1024*9+1, 1024*16-1, 1024*32-5, 1024*64+3, 1024*128-7) as $k => $i) {
- echo "Iteration $k\n\n";
+ echo "Iteration $k\n\n";
- /* with and without compression */
- foreach (array(false, true) as $b) {
- $data = get_data($i);
- if ($b) {
- $data = gzencode($data);
- }
- $len = strlen($data);
+ /* with and without compression */
+ foreach (array(false, true) as $b) {
+ $data = get_data($i);
+ if ($b) {
+ $data = gzencode($data);
+ }
+ $len = strlen($data);
- //echo "len=$len\n";
+ //echo "len=$len\n";
- $hdrs = <<<HDRS
+ $hdrs = <<<HDRS
POST /bug73037_server.php HTTP/1.1
Content-Type: application/soap+xml; charset=UTF-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
@@ -94,45 +94,44 @@ SOAPAction: "urn:adressen#adressen#SetAda"
Expect: 100-continue
Content-Length: ${len}
HDRS;
- if ($b) {
- $hdrs .="\nContent-Encoding: gzip";
- }
- //echo "Headers sent:\n$hdrs\n\n";
- $fp = fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT, $errno, $errstr, 5);
- if (!$fp) {
- die("connect failed");
- }
-
- if(fwrite($fp, "$hdrs\n\n$data")) {
- $out = "";
- while (!feof($fp)) {
- $out .= fread($fp, 1024);
- }
-
- $pos = strpos($out, "<env:Text>");
- if (false === $pos) {
- echo $out;
- goto cleanup;
- }
- $pos0 = $pos + strlen("<env:Text>");
- $pos = strpos($out, "</env:Text>");
- if (false === $pos) {
- echo $out;
- goto cleanup;
- }
- $len = $pos - $pos0;
- echo substr($out, $pos0, $len);
- }
+ if ($b) {
+ $hdrs .="\nContent-Encoding: gzip";
+ }
+ //echo "Headers sent:\n$hdrs\n\n";
+ $fp = fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT, $errno, $errstr, 5);
+ if (!$fp) {
+ die("connect failed");
+ }
+
+ if(fwrite($fp, "$hdrs\n\n$data")) {
+ $out = "";
+ while (!feof($fp)) {
+ $out .= fread($fp, 1024);
+ }
+
+ $pos = strpos($out, "<env:Text>");
+ if (false === $pos) {
+ echo $out;
+ goto cleanup;
+ }
+ $pos0 = $pos + strlen("<env:Text>");
+ $pos = strpos($out, "</env:Text>");
+ if (false === $pos) {
+ echo $out;
+ goto cleanup;
+ }
+ $len = $pos - $pos0;
+ echo substr($out, $pos0, $len);
+ }
cleanup:
- fclose($fp);
+ fclose($fp);
- echo "\n\n";
- }
+ echo "\n\n";
+ }
}
?>
-==DONE==
--CLEAN--
<?php
unlink(__DIR__ . DIRECTORY_SEPARATOR . "bug73037_server.php");
@@ -180,4 +179,3 @@ Function 'CATALOG' doesn't exist
Function 'CATALOG' doesn't exist
-==DONE==
diff --git a/ext/soap/tests/bug77088.phpt b/ext/soap/tests/bug77088.phpt
index 0c1a604f2e..17945e136f 100644
--- a/ext/soap/tests/bug77088.phpt
+++ b/ext/soap/tests/bug77088.phpt
@@ -11,19 +11,18 @@ try
{
$options = NULL;
$sClient = new SoapClient("test.wsdl", $options);
-}
-catch(SoapFault $e)
+}
+catch(TypeError $e)
{
var_dump($e);
}
?>
--EXPECTF--
-Warning: SoapClient::SoapClient() expects parameter 2 to be array, null given in %sbug77088.php on line %d
-object(SoapFault)#%d (%d) {
+object(TypeError)#%d (%d) {
["message":protected]=>
- string(44) "SoapClient::SoapClient(): Invalid parameters"
- ["string":"Exception":private]=>
+ string(%d) "SoapClient::__construct() expects parameter 2 to be array, null given"
+ ["string":"Error":private]=>
string(0) ""
["code":protected]=>
int(0)
@@ -31,7 +30,7 @@ object(SoapFault)#%d (%d) {
string(%d) "%sbug77088.php"
["line":protected]=>
int(6)
- ["trace":"Exception":private]=>
+ ["trace":"Error":private]=>
array(1) {
[0]=>
array(6) {
@@ -40,7 +39,7 @@ object(SoapFault)#%d (%d) {
["line"]=>
int(6)
["function"]=>
- string(10) "SoapClient"
+ string(11) "__construct"
["class"]=>
string(10) "SoapClient"
["type"]=>
@@ -54,12 +53,6 @@ object(SoapFault)#%d (%d) {
}
}
}
- ["previous":"Exception":private]=>
+ ["previous":"Error":private]=>
NULL
- ["faultstring"]=>
- string(44) "SoapClient::SoapClient(): Invalid parameters"
- ["faultcode"]=>
- string(6) "Client"
- ["faultcodens"]=>
- string(41) "http://schemas.xmlsoap.org/soap/envelope/"
}
diff --git a/ext/soap/tests/bug77410.phpt b/ext/soap/tests/bug77410.phpt
index 2b74102523..4c36e6e9da 100644
--- a/ext/soap/tests/bug77410.phpt
+++ b/ext/soap/tests/bug77410.phpt
@@ -11,7 +11,7 @@ $client = new class(__DIR__ . '/bug77410.wsdl', [
]) extends SoapClient {
public function __doRequest($request, $location, $action, $version, $one_way = 0) {
echo $request, "\n";
- return '';
+ return '';
}
};
diff --git a/ext/soap/tests/bugs/bug28751.phpt b/ext/soap/tests/bugs/bug28751.phpt
index 88187eb109..4b64b62a06 100644
--- a/ext/soap/tests/bugs/bug28751.phpt
+++ b/ext/soap/tests/bugs/bug28751.phpt
@@ -5,11 +5,11 @@ Bug #28751 (SoapServer does not call _autoload())
--FILE--
<?php
spl_autoload_register(function ($className) {
- class SoapServerActions {
+ class SoapServerActions {
function test() {
return "Hello World";
}
- }
+ }
});
$server = new SoapServer(NULL, array('uri'=>"http://testuri.org"));
diff --git a/ext/soap/tests/bugs/bug29795.phpt b/ext/soap/tests/bugs/bug29795.phpt
index fce064ef43..38d4da3a8d 100644
--- a/ext/soap/tests/bugs/bug29795.phpt
+++ b/ext/soap/tests/bugs/bug29795.phpt
@@ -14,9 +14,9 @@ class LocalSoapClient extends SoapClient {
function __doRequest($request, $location, $action, $version, $one_way = 0) {
return <<<EOF
-<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
-xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
-xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
+xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"><SOAP-ENV:Body><Price><Amount>3995</Amount><CurrencyCode>USD</CurrencyCode></Price></SOAP-ENV:Body></SOAP-ENV:Envelope>
EOF;
}
diff --git a/ext/soap/tests/bugs/bug30045.phpt b/ext/soap/tests/bugs/bug30045.phpt
index 21889c2fd1..63fbadc639 100644
--- a/ext/soap/tests/bugs/bug30045.phpt
+++ b/ext/soap/tests/bugs/bug30045.phpt
@@ -42,12 +42,12 @@ $soap = new LocalSoapClient(NULL, array("uri"=>"http://test-uri", "location"=>"t
function test($type, $num) {
global $soap;
try {
- printf(" %0.0f\n ", $num);
- $ret = $soap->foo($type, new SoapVar($num, $type));
- printf(" %0.0f\n", $ret);
- } catch (SoapFault $ex) {
- var_dump($ex);
- }
+ printf(" %0.0f\n ", $num);
+ $ret = $soap->foo($type, new SoapVar($num, $type));
+ printf(" %0.0f\n", $ret);
+ } catch (SoapFault $ex) {
+ var_dump($ex);
+ }
}
/*
echo "byte\n";
diff --git a/ext/soap/tests/bugs/bug30106.phpt b/ext/soap/tests/bugs/bug30106.phpt
index b02b1bded2..96709d6aa3 100644
--- a/ext/soap/tests/bugs/bug30106.phpt
+++ b/ext/soap/tests/bugs/bug30106.phpt
@@ -7,25 +7,25 @@ Bug #30106 (SOAP cannot not parse 'ref' element. Causes Uncaught SoapFault excep
ini_set("soap.wsdl_cache_enabled", 0);
function getContinentList() {
- return array("getContinentListResult"=>array(
- "schema"=>"<xsd:schema><element name=\"test\" type=\"xsd:string\"/></xsd:schema>",
- "any"=>"<test>Hello World!</test><test>Bye World!</test>"));
+ return array("getContinentListResult"=>array(
+ "schema"=>"<xsd:schema><element name=\"test\" type=\"xsd:string\"/></xsd:schema>",
+ "any"=>"<test>Hello World!</test><test>Bye World!</test>"));
}
class LocalSoapClient extends SoapClient {
function __construct($wsdl, $options=array()) {
parent::__construct($wsdl, $options);
$this->server = new SoapServer($wsdl, $options);
- $this->server->addFunction("getContinentList");
+ $this->server->addFunction("getContinentList");
}
function __doRequest($request, $location, $action, $version, $one_way = 0) {
- echo $request;
+ echo $request;
ob_start();
$this->server->handle($request);
$response = ob_get_contents();
ob_end_clean();
- echo $response;
+ echo $response;
return $response;
}
}
diff --git a/ext/soap/tests/bugs/bug30799.phpt b/ext/soap/tests/bugs/bug30799.phpt
index 92fd40f452..81079efbb7 100644
--- a/ext/soap/tests/bugs/bug30799.phpt
+++ b/ext/soap/tests/bugs/bug30799.phpt
@@ -5,9 +5,9 @@ Bug #30799 (SoapServer doesn't handle private or protected properties)
--FILE--
<?php
class foo {
- public $a="a";
- private $b="b";
- protected $c="c";
+ public $a="a";
+ private $b="b";
+ protected $c="c";
}
diff --git a/ext/soap/tests/bugs/bug30928.phpt b/ext/soap/tests/bugs/bug30928.phpt
index ace71764f9..89b61cc019 100644
--- a/ext/soap/tests/bugs/bug30928.phpt
+++ b/ext/soap/tests/bugs/bug30928.phpt
@@ -7,9 +7,9 @@ Bug #30928 (When Using WSDL, SoapServer doesn't handle private or protected prop
ini_set("soap.wsdl_cache_enabled", 0);
class foo {
- public $a="a";
- private $b="b";
- protected $c="c";
+ public $a="a";
+ private $b="b";
+ protected $c="c";
}
function test($x) {
diff --git a/ext/soap/tests/bugs/bug30994.phpt b/ext/soap/tests/bugs/bug30994.phpt
index afd5018a38..d91783cfd0 100644
--- a/ext/soap/tests/bugs/bug30994.phpt
+++ b/ext/soap/tests/bugs/bug30994.phpt
@@ -7,28 +7,28 @@ Bug #30994 (SOAP server unable to handle request with references)
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:tns="http://spock/kunta/kunta"
- xmlns:types="http://spock/kunta/kunta/encodedTypes"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
+ xmlns:tns="http://spock/kunta/kunta"
+ xmlns:types="http://spock/kunta/kunta/encodedTypes"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
- <q1:bassCall xmlns:q1="http://spock/bass/types/kunta">
- <system xsi:type="xsd:string">XXX</system>
- <function xsi:type="xsd:string">TASKTEST</function>
- <parameter href="#id1" />
- </q1:bassCall>
+ <q1:bassCall xmlns:q1="http://spock/bass/types/kunta">
+ <system xsi:type="xsd:string">XXX</system>
+ <function xsi:type="xsd:string">TASKTEST</function>
+ <parameter href="#id1" />
+ </q1:bassCall>
- <soapenc:Array id="id1" soapenc:arrayType="tns:Item[1]">
- <Item href="#id2" />
- </soapenc:Array>
+ <soapenc:Array id="id1" soapenc:arrayType="tns:Item[1]">
+ <Item href="#id2" />
+ </soapenc:Array>
- <tns:Item id="id2" xsi:type="tns:Item">
- <key xsi:type="xsd:string">ABCabc123</key>
- <val xsi:type="xsd:string">123456</val>
- </tns:Item>
+ <tns:Item id="id2" xsi:type="tns:Item">
+ <key xsi:type="xsd:string">ABCabc123</key>
+ <val xsi:type="xsd:string">123456</val>
+ </tns:Item>
</soap:Body>
</soap:Envelope>
diff --git a/ext/soap/tests/bugs/bug31422.phpt b/ext/soap/tests/bugs/bug31422.phpt
index 4889b10d8e..c653d5e2f3 100644
--- a/ext/soap/tests/bugs/bug31422.phpt
+++ b/ext/soap/tests/bugs/bug31422.phpt
@@ -10,8 +10,8 @@ error_log=
--FILE--
<?php
function Add($x,$y) {
- fopen();
- user_error("Hello", E_USER_ERROR);
+ fopen();
+ user_error("Hello", E_USER_ERROR);
return $x+$y;
}
@@ -39,7 +39,6 @@ $server->handle($HTTP_RAW_POST_DATA);
echo "ok\n";
?>
--EXPECTF--
-PHP Warning: fopen() expects at least 2 parameters, 0 given in %sbug31422.php on line %d
-PHP Fatal error: Hello in %sbug31422.php on line %d
<?xml version="1.0" encoding="UTF-8"?>
-<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode><faultstring>Hello</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode><faultstring>fopen() expects at least 2 parameters, 0 given</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
+ok
diff --git a/ext/soap/tests/bugs/bug31695.phpt b/ext/soap/tests/bugs/bug31695.phpt
index 708d489a0d..abf4168c30 100644
--- a/ext/soap/tests/bugs/bug31695.phpt
+++ b/ext/soap/tests/bugs/bug31695.phpt
@@ -7,18 +7,18 @@ Bug #31695 (Cannot redefine endpoint when using WSDL)
ini_set("soap.wsdl_cache_enabled", 0);
function Test($x) {
- return $x;
+ return $x;
}
class LocalSoapClient extends SoapClient {
function __construct($wsdl, $options=array()) {
parent::__construct($wsdl, $options);
$this->server = new SoapServer($wsdl, $options);
- $this->server->addFunction("Test");
+ $this->server->addFunction("Test");
}
function __doRequest($request, $location, $action, $version, $one_way = 0) {
- echo "$location\n";
+ echo "$location\n";
ob_start();
$this->server->handle($request);
$response = ob_get_contents();
diff --git a/ext/soap/tests/bugs/bug31755.phpt b/ext/soap/tests/bugs/bug31755.phpt
index 1d65b3a42b..600fd43058 100644
--- a/ext/soap/tests/bugs/bug31755.phpt
+++ b/ext/soap/tests/bugs/bug31755.phpt
@@ -14,6 +14,6 @@ $response= $client->__call('function', array(), null, $header);
print $client->__getLastRequest();
?>
--EXPECTF--
-Warning: SoapHeader::SoapHeader(): Invalid namespace in %s on line %d
+Warning: SoapHeader::__construct(): Invalid namespace in %s on line %d
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="myNS" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Header/><SOAP-ENV:Body><ns1:function/></SOAP-ENV:Body></SOAP-ENV:Envelope>
diff --git a/ext/soap/tests/bugs/bug32776.phpt b/ext/soap/tests/bugs/bug32776.phpt
index 316b0e15ed..978dce877d 100644
--- a/ext/soap/tests/bugs/bug32776.phpt
+++ b/ext/soap/tests/bugs/bug32776.phpt
@@ -10,8 +10,8 @@ soap.wsdl_cache_enabled=0
$d = null;
function test($x) {
- global $d;
- $d = $x;
+ global $d;
+ $d = $x;
}
class LocalSoapClient extends SoapClient {
diff --git a/ext/soap/tests/bugs/bug32941.phpt b/ext/soap/tests/bugs/bug32941.phpt
index cbab7008d7..59bd06992b 100644
--- a/ext/soap/tests/bugs/bug32941.phpt
+++ b/ext/soap/tests/bugs/bug32941.phpt
@@ -6,28 +6,28 @@ Bug #32941 (Sending structured exception kills a php)
<?php
class TestSoapClient extends SoapClient {
function __doRequest($request, $location, $action, $version, $one_way = 0) {
- return <<<EOF
+ return <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <soapenv:Body>
- <soapenv:Fault>
- <faultcode>soapenv:Server.userException</faultcode>
- <faultstring>service.EchoServiceException</faultstring>
- <detail>
- <service.EchoServiceException xsi:type="ns1:EchoServiceException" xmlns:ns1="urn:service.EchoService">
- <intParameter xsi:type="xsd:int">105</intParameter>
- <parameter xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">string param</parameter>
- </service.EchoServiceException>
- <ns2:hostname xmlns:ns2="http://xml.apache.org/axis/">steckovic</ns2:hostname>
- </detail>
- </soapenv:Fault>
- </soapenv:Body>
+ <soapenv:Body>
+ <soapenv:Fault>
+ <faultcode>soapenv:Server.userException</faultcode>
+ <faultstring>service.EchoServiceException</faultstring>
+ <detail>
+ <service.EchoServiceException xsi:type="ns1:EchoServiceException" xmlns:ns1="urn:service.EchoService">
+ <intParameter xsi:type="xsd:int">105</intParameter>
+ <parameter xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">string param</parameter>
+ </service.EchoServiceException>
+ <ns2:hostname xmlns:ns2="http://xml.apache.org/axis/">steckovic</ns2:hostname>
+ </detail>
+ </soapenv:Fault>
+ </soapenv:Body>
</soapenv:Envelope>
EOF;
- }
+ }
}
ini_set("soap.wsdl_cache_enabled", 1);
diff --git a/ext/soap/tests/bugs/bug34449.phpt b/ext/soap/tests/bugs/bug34449.phpt
index f5766e29bc..f4aa222477 100644
--- a/ext/soap/tests/bugs/bug34449.phpt
+++ b/ext/soap/tests/bugs/bug34449.phpt
@@ -6,8 +6,8 @@ Bug #34449 (ext/soap: XSD_ANYXML functionality not exposed)
<?php
class TestSoapClient extends SoapClient {
function __doRequest($request, $location, $action, $version, $one_way = 0) {
- echo "$request\n";
- exit;
+ echo "$request\n";
+ exit;
}
}
diff --git a/ext/soap/tests/bugs/bug34643.phpt b/ext/soap/tests/bugs/bug34643.phpt
index 7430b34474..a4acfa35d6 100644
--- a/ext/soap/tests/bugs/bug34643.phpt
+++ b/ext/soap/tests/bugs/bug34643.phpt
@@ -9,9 +9,9 @@ soap.wsdl_cache_enabled=0
ini_set("soap.wsdl_cache_enabled", 0);
class fp {
- public function get_it($opt="zzz") {
- return $opt;
- }
+ public function get_it($opt="zzz") {
+ return $opt;
+ }
}
class LocalSoapClient extends SoapClient {
diff --git a/ext/soap/tests/bugs/bug34657.phpt b/ext/soap/tests/bugs/bug34657.phpt
index 8c182ad7d4..ddf5d2fee0 100644
--- a/ext/soap/tests/bugs/bug34657.phpt
+++ b/ext/soap/tests/bugs/bug34657.phpt
@@ -7,14 +7,14 @@ require_once('skipif.inc');
--FILE--
<?php
try {
- $client = new SoapClient('http://i_dont_exist.com/some.wsdl');
- echo "?\n";
+ $client = new SoapClient('http://i_dont_exist.com/some.wsdl');
+ echo "?\n";
} catch (SoapFault $e) {
- echo get_class($e)."\n";
- echo $e->faultstring."\n";
- echo "ok\n";
+ echo get_class($e)."\n";
+ echo $e->faultstring."\n";
+ echo "ok\n";
} catch (Exception $e) {
- echo get_class($e)."\n";
+ echo get_class($e)."\n";
}
?>
--EXPECTF--
diff --git a/ext/soap/tests/bugs/bug35142.phpt b/ext/soap/tests/bugs/bug35142.phpt
index f10885767c..840dc8e9a8 100644
--- a/ext/soap/tests/bugs/bug35142.phpt
+++ b/ext/soap/tests/bugs/bug35142.phpt
@@ -11,8 +11,8 @@ $timestamp = "2005-11-08T11:22:07+03:00";
$wsdl = __DIR__."/bug35142.wsdl";
function PostEvents($x) {
- var_dump($x);
- exit();
+ var_dump($x);
+ exit();
return $x;
}
@@ -25,7 +25,7 @@ class TestSoapClient extends SoapClient {
}
function __doRequest($request, $location, $action, $version, $one_way = 0) {
- echo "$request\n";
+ echo "$request\n";
$this->server->handle($request);
return $response;
}
@@ -33,10 +33,10 @@ class TestSoapClient extends SoapClient {
}
$soapClient = new TestSoapClient($wsdl,
- array('trace' => 1, 'exceptions' => 0,
- 'classmap' => array('logOnEvent' => 'LogOnEvent',
- 'logOffEvent' => 'LogOffEvent',
- 'events' => 'IVREvents')));
+ array('trace' => 1, 'exceptions' => 0,
+ 'classmap' => array('logOnEvent' => 'LogOnEvent',
+ 'logOffEvent' => 'LogOffEvent',
+ 'events' => 'IVREvents')));
$logOnEvent = new LogOnEvent(34567, $timestamp);
$logOffEvents[] = new LogOffEvent(34567, $timestamp, "Smoked");
diff --git a/ext/soap/tests/bugs/bug35273.phpt b/ext/soap/tests/bugs/bug35273.phpt
index f04dc68646..72c44adbb3 100644
--- a/ext/soap/tests/bugs/bug35273.phpt
+++ b/ext/soap/tests/bugs/bug35273.phpt
@@ -8,9 +8,9 @@ soap.wsdl_cache_enabled=0
<?php
class TestSoapClient extends SoapClient {
function __doRequest($request, $location, $action, $version, $one_way = 0) {
- echo $request;
- exit;
- }
+ echo $request;
+ exit;
+ }
}
ini_set("soap.wsdl_cache_enabled", 0);
diff --git a/ext/soap/tests/bugs/bug36226.phpt b/ext/soap/tests/bugs/bug36226.phpt
index a54b687f95..5bb3db9fe7 100644
--- a/ext/soap/tests/bugs/bug36226.phpt
+++ b/ext/soap/tests/bugs/bug36226.phpt
@@ -11,8 +11,8 @@ $timestamp = "2005-11-08T11:22:07+03:00";
$wsdl = __DIR__."/bug35142.wsdl";
function PostEvents($x) {
- var_dump($x);
- exit();
+ var_dump($x);
+ exit();
return $x;
}
@@ -25,7 +25,7 @@ class TestSoapClient extends SoapClient {
}
function __doRequest($request, $location, $action, $version, $one_way = 0) {
- echo "$request\n";
+ echo "$request\n";
$this->server->handle($request);
return $response;
}
@@ -33,11 +33,11 @@ class TestSoapClient extends SoapClient {
}
$soapClient = new TestSoapClient($wsdl,
- array('trace' => 1, 'exceptions' => 0,
- 'classmap' => array('logOnEvent' => 'LogOnEvent',
- 'logOffEvent' => 'LogOffEvent',
- 'events' => 'IVREvents'),
- 'features' => SOAP_SINGLE_ELEMENT_ARRAYS));
+ array('trace' => 1, 'exceptions' => 0,
+ 'classmap' => array('logOnEvent' => 'LogOnEvent',
+ 'logOffEvent' => 'LogOffEvent',
+ 'events' => 'IVREvents'),
+ 'features' => SOAP_SINGLE_ELEMENT_ARRAYS));
$logOnEvent = new LogOnEvent(34567, $timestamp);
$logOffEvents[] = new LogOffEvent(34567, $timestamp, "Smoked");
diff --git a/ext/soap/tests/bugs/bug36575.phpt b/ext/soap/tests/bugs/bug36575.phpt
index 8e5f469546..dd5a5d99f1 100644
--- a/ext/soap/tests/bugs/bug36575.phpt
+++ b/ext/soap/tests/bugs/bug36575.phpt
@@ -7,24 +7,24 @@ soap.wsdl_cache_enabled=0
--FILE--
<?php
abstract class CT_A1 {
- public $var1;
+ public $var1;
}
class CT_A2 extends CT_A1 {
- public $var2;
+ public $var2;
}
class CT_A3 extends CT_A2 {
- public $var3;
+ public $var3;
}
// returns A2 in WSDL
function test( $a1 ) {
- $a3 = new CT_A3();
- $a3->var1 = $a1->var1;
- $a3->var2 = "var two";
- $a3->var3 = "var three";
- return $a3;
+ $a3 = new CT_A3();
+ $a3->var1 = $a1->var1;
+ $a3->var2 = "var two";
+ $a3->var3 = "var three";
+ return $a3;
}
$classMap = array("A1" => "CT_A1", "A2" => "CT_A2", "A3" => "CT_A3");
diff --git a/ext/soap/tests/bugs/bug36999.phpt b/ext/soap/tests/bugs/bug36999.phpt
index 443e90418f..c9d03f57bd 100644
--- a/ext/soap/tests/bugs/bug36999.phpt
+++ b/ext/soap/tests/bugs/bug36999.phpt
@@ -36,12 +36,12 @@ $soap = new LocalSoapClient(__DIR__."/bug36999.wsdl");
function test($num) {
global $soap;
try {
- printf("%s %0.0f\n", gettype($num), $num);
- $ret = $soap->echoLong($num);
- printf("%s %0.0f\n", gettype($ret), $ret);
- } catch (SoapFault $ex) {
- var_dump($ex);
- }
+ printf("%s %0.0f\n", gettype($num), $num);
+ $ret = $soap->echoLong($num);
+ printf("%s %0.0f\n", gettype($ret), $ret);
+ } catch (SoapFault $ex) {
+ var_dump($ex);
+ }
}
test(3706790240);
?>
diff --git a/ext/soap/tests/bugs/bug37083.phpt b/ext/soap/tests/bugs/bug37083.phpt
index cfd698e4be..89b808eaa1 100644
--- a/ext/soap/tests/bugs/bug37083.phpt
+++ b/ext/soap/tests/bugs/bug37083.phpt
@@ -7,8 +7,8 @@ soap.wsdl_cache=3
--FILE--
<?php
class TestSoapClient extends SoapClient {
- function __doRequest($request, $location, $action, $version, $one_way = 0) {
- return <<<EOF
+ function __doRequest($request, $location, $action, $version, $one_way = 0) {
+ return <<<EOF
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
@@ -38,19 +38,19 @@ class TestSoapClient extends SoapClient {
<multiRef id="id12" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns22:Map" xmlns:ns22="http://xml.apache.org/xml-soap" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"><item><key xsi:type="soapenc:string">maxDateTime</key><value soapenc:arrayType="xsd:anyType[1]" xsi:type="soapenc:Array"><value xsi:type="xsd:dateTime">2038-12-31T22:59:59.000Z</value></value></item><item><key xsi:type="soapenc:string">minDateTime</key><value soapenc:arrayType="xsd:anyType[1]" xsi:type="soapenc:Array"><value xsi:type="xsd:dateTime">2004-11-01T16:58:00.000Z</value></value></item><item><key xsi:type="soapenc:string">minLongitude</key><value soapenc:arrayType="xsd:anyType[1]" xsi:type="soapenc:Array"><value xsi:type="soapenc:double">108.11</value></value></item><item><key xsi:type="soapenc:string">maxLongitude</key><value soapenc:arrayType="xsd:anyType[1]" xsi:type="soapenc:Array"><value xsi:type="soapenc:double">113.383</value></value></item><item><key xsi:type="soapenc:string">maxLatitude</key><value soapenc:arrayType="xsd:anyType[1]" xsi:type="soapenc:Array"><value xsi:type="soapenc:double">-31.666</value></value></item><item><key xsi:type="soapenc:string">minLatitude</key><value soapenc:arrayType="xsd:anyType[1]" xsi:type="soapenc:Array"><value xsi:type="soapenc:double">-35.075</value></value></item></multiRef>
</soapenv:Body></soapenv:Envelope>
EOF;
- }
+ }
}
for ($i = 0; $i < 10; $i++) {
- $ws=new TestSoapClient(__DIR__.'/bug37083.wsdl',
+ $ws=new TestSoapClient(__DIR__.'/bug37083.wsdl',
array('encoding'=>'ISO-8859-1',
'cache_wsdl'=>WSDL_CACHE_BOTH));
- $search=new stdClass();
- $search->queryString='argo';
- $search->ranges[]=$r=new stdClass();
- $r->field='maxDateTime';
- $r->min='2003-04-01';
- $search->index='all';
- $res=$ws->search($search,0,10);
+ $search=new stdClass();
+ $search->queryString='argo';
+ $search->ranges[]=$r=new stdClass();
+ $r->field='maxDateTime';
+ $r->min='2003-04-01';
+ $search->index='all';
+ $res=$ws->search($search,0,10);
}
echo "ok\n";
?>
diff --git a/ext/soap/tests/bugs/bug38004.phpt b/ext/soap/tests/bugs/bug38004.phpt
index 43d3e86d02..81b8ffc503 100644
--- a/ext/soap/tests/bugs/bug38004.phpt
+++ b/ext/soap/tests/bugs/bug38004.phpt
@@ -7,9 +7,9 @@ soap.wsdl_cache_enabled=0
--FILE--
<?php
function Test($param) {
- global $g;
- $g = $param->strA."\n".$param->strB."\n";
- return $g;
+ global $g;
+ $g = $param->strA."\n".$param->strB."\n";
+ return $g;
}
class TestSoapClient extends SoapClient {
diff --git a/ext/soap/tests/bugs/bug38005.phpt b/ext/soap/tests/bugs/bug38005.phpt
index 6557867277..6219141ab9 100644
--- a/ext/soap/tests/bugs/bug38005.phpt
+++ b/ext/soap/tests/bugs/bug38005.phpt
@@ -7,7 +7,7 @@ soap.wsdl_cache_enabled=0
--FILE--
<?php
function Test($param=NULL) {
- return new SoapFault('Test', 'This is our fault: Ä');
+ return new SoapFault('Test', 'This is our fault: Ä');
}
class TestSoapClient extends SoapClient {
@@ -28,11 +28,11 @@ class TestSoapClient extends SoapClient {
$client = new TestSoapClient(NULL, array(
'encoding' => 'ISO-8859-1',
- 'uri' => "test://",
- 'location' => "test://",
- 'soap_version'=>SOAP_1_2,
- 'trace'=>1,
- 'exceptions'=>0));
+ 'uri' => "test://",
+ 'location' => "test://",
+ 'soap_version'=>SOAP_1_2,
+ 'trace'=>1,
+ 'exceptions'=>0));
$res = $client->Test();
echo($res->faultstring."\n");
echo($client->__getLastResponse());
diff --git a/ext/soap/tests/bugs/bug38055.phpt b/ext/soap/tests/bugs/bug38055.phpt
index 7b5ed49a27..df97e1034d 100644
--- a/ext/soap/tests/bugs/bug38055.phpt
+++ b/ext/soap/tests/bugs/bug38055.phpt
@@ -7,10 +7,10 @@ soap.wsdl_cache_enabled=0
--FILE--
<?php
function Test($param) {
- global $g1, $g2;
- $g1 = $param->boolA;
- $g2 = $param->boolB;
- return 1;
+ global $g1, $g2;
+ $g1 = $param->boolA;
+ $g2 = $param->boolB;
+ return 1;
}
class TestSoapClient extends SoapClient {
diff --git a/ext/soap/tests/bugs/bug38067.phpt b/ext/soap/tests/bugs/bug38067.phpt
index 7664135de3..0b935f30c2 100644
--- a/ext/soap/tests/bugs/bug38067.phpt
+++ b/ext/soap/tests/bugs/bug38067.phpt
@@ -7,9 +7,9 @@ soap.wsdl_cache_enabled=0
--FILE--
<?php
function Test($param) {
- global $g;
- $g = $param->str;
- return $g;
+ global $g;
+ $g = $param->str;
+ return $g;
}
class TestSoapClient extends SoapClient {
@@ -29,7 +29,7 @@ class TestSoapClient extends SoapClient {
}
$client = new TestSoapClient(__DIR__.'/bug38067.wsdl',
- array('encoding' => 'ISO-8859-1'));
+ array('encoding' => 'ISO-8859-1'));
$str = 'test: Ä';
$res = $client->Test(array('str'=>$str));
echo $str."\n";
diff --git a/ext/soap/tests/bugs/bug41004.phpt b/ext/soap/tests/bugs/bug41004.phpt
index c38bf0d62b..442e147bbc 100644
--- a/ext/soap/tests/bugs/bug41004.phpt
+++ b/ext/soap/tests/bugs/bug41004.phpt
@@ -7,17 +7,17 @@ Bug #41004 (minOccurs="0" and null class member variable)
ini_set('soap.wsdl_cache_enabled', false);
class EchoBean{
- public $mandatoryElement;
- public $optionalElement;
+ public $mandatoryElement;
+ public $optionalElement;
}
class EchoRequest{
- public $in;
+ public $in;
}
class EchoResponse{
- public $out;
+ public $out;
}
$wsdl = __DIR__."/bug41004.wsdl";
diff --git a/ext/soap/tests/bugs/bug41566.phpt b/ext/soap/tests/bugs/bug41566.phpt
index 03ecdde043..557c61780a 100644
--- a/ext/soap/tests/bugs/bug41566.phpt
+++ b/ext/soap/tests/bugs/bug41566.phpt
@@ -44,8 +44,8 @@ echo "ok\n";
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
- xmlns:ns1="http://testuri.org"
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
+ xmlns:ns1="http://testuri.org"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:enc="http://www.w3.org/2003/05/soap-encoding">
<env:Body>
diff --git a/ext/soap/tests/bugs/bug42086.phpt b/ext/soap/tests/bugs/bug42086.phpt
index bdaf55ac83..0d4d30486f 100644
--- a/ext/soap/tests/bugs/bug42086.phpt
+++ b/ext/soap/tests/bugs/bug42086.phpt
@@ -12,17 +12,17 @@ $request = <<<EOF
EOF;
class firstFunctionWithoutParamResponse {
- public $param;
+ public $param;
}
function firstFunctionWithoutParam() {
- $ret = new firstFunctionWithoutParamResponse();
- $ret->param = "firstFunctionWithoutParam";
- return $ret;
+ $ret = new firstFunctionWithoutParamResponse();
+ $ret->param = "firstFunctionWithoutParam";
+ return $ret;
}
$server = new SoapServer(__DIR__.'/bug42086.wsdl',
- array('features'=>SOAP_SINGLE_ELEMENT_ARRAYS));
+ array('features'=>SOAP_SINGLE_ELEMENT_ARRAYS));
$server->addFunction('firstFunctionWithoutParam');
$server->handle($request);
?>
diff --git a/ext/soap/tests/bugs/bug42151.phpt b/ext/soap/tests/bugs/bug42151.phpt
index ee53e6d525..f945a8753e 100644
--- a/ext/soap/tests/bugs/bug42151.phpt
+++ b/ext/soap/tests/bugs/bug42151.phpt
@@ -5,23 +5,23 @@ Bug #42151 (__destruct functions not called after catching a SoapFault exception
--FILE--
<?php
class foo {
- function __construct(){
- $foo = @ new SoapClient('httpx://');
- }
- function __destruct(){
- echo 'I never get executed.' . "\n";
- }
+ function __construct(){
+ $foo = @ new SoapClient('httpx://');
+ }
+ function __destruct(){
+ echo 'I never get executed.' . "\n";
+ }
}
class bar {
- function __destruct(){
- echo 'I don\'t get executed either.' . "\n";
- }
+ function __destruct(){
+ echo 'I don\'t get executed either.' . "\n";
+ }
}
try {
- $bar = new bar();
- $foo = new foo();
+ $bar = new bar();
+ $foo = new foo();
} catch (Exception $e){
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
echo "ok\n";
?>
diff --git a/ext/soap/tests/bugs/bug42183.phpt b/ext/soap/tests/bugs/bug42183.phpt
index 043487c964..0fed7f1d54 100644
--- a/ext/soap/tests/bugs/bug42183.phpt
+++ b/ext/soap/tests/bugs/bug42183.phpt
@@ -13,11 +13,11 @@ $req = <<<EOF
EOF;
function test() {
- return new PHPObject();
+ return new PHPObject();
}
$server = new SoapServer(NULL, array('uri' => 'http://ws.sit.com',
- 'classmap' => array('Object' => 'PHPObject')));
+ 'classmap' => array('Object' => 'PHPObject')));
$server->addFunction("test");
ob_start();
$server->handle($req);
diff --git a/ext/soap/tests/bugs/bug42214.phpt b/ext/soap/tests/bugs/bug42214.phpt
index a31f16dcb4..64cd631bc7 100644
--- a/ext/soap/tests/bugs/bug42214.phpt
+++ b/ext/soap/tests/bugs/bug42214.phpt
@@ -10,12 +10,12 @@ $request = <<<EOF
EOF;
function test() {
- $a = $b;
- obvious_error(); // will cause an error
+ $a = $b;
+ obvious_error(); // will cause an error
}
$server = new SoapServer(NULL, array('uri' =>'http://localhost/server.php',
- 'send_errors'=>0));
+ 'send_errors'=>0));
$server->addFunction('test');
$server->handle($request);
?>
diff --git a/ext/soap/tests/bugs/bug42692.phpt b/ext/soap/tests/bugs/bug42692.phpt
index b221a3a862..0a1310ab9e 100644
--- a/ext/soap/tests/bugs/bug42692.phpt
+++ b/ext/soap/tests/bugs/bug42692.phpt
@@ -7,32 +7,32 @@ Bug #42692 (Procedure 'int1' not present with doc/lit SoapServer)
ini_set('soap.wsdl_cache_enabled','0');
function checkAuth($peid,$auth) {
- return $peid;
+ return $peid;
}
class TestSoap extends SoapClient {
- function __construct($wsdl, $options) {
- parent::__construct($wsdl, $options);
- $this->server = new SoapServer($wsdl, $options);
- $this->server->addFunction("checkAuth");
- }
+ function __construct($wsdl, $options) {
+ parent::__construct($wsdl, $options);
+ $this->server = new SoapServer($wsdl, $options);
+ $this->server->addFunction("checkAuth");
+ }
- function __doRequest($request, $location, $action, $version, $one_way = 0) {
- ob_start();
- $this->server->handle($request);
- $response = ob_get_contents();
- ob_end_clean();
- return $response;
- }
+ function __doRequest($request, $location, $action, $version, $one_way = 0) {
+ ob_start();
+ $this->server->handle($request);
+ $response = ob_get_contents();
+ ob_end_clean();
+ return $response;
+ }
}
$client = new TestSoap(__DIR__ . "/bug42692.wsdl", array("trace"=>1));
try {
- $result = $client->checkAuth(1,"two");
- echo "Auth for 1 is $result\n";
+ $result = $client->checkAuth(1,"two");
+ echo "Auth for 1 is $result\n";
} catch (Exception $e) {
- echo $e->getMessage();
+ echo $e->getMessage();
}
?>
--EXPECT--
diff --git a/ext/soap/tests/bugs/bug43045.phpt b/ext/soap/tests/bugs/bug43045.phpt
index f4f3983800..9c2139276d 100644
--- a/ext/soap/tests/bugs/bug43045.phpt
+++ b/ext/soap/tests/bugs/bug43045.phpt
@@ -36,11 +36,11 @@ xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
}
}
$client = new TestSoapClient(NULL, array(
- "location" => "test://",
- "uri" => 'urn:TestSOAP',
- "style" => SOAP_RPC,
- "use" => SOAP_ENCODED
- ));
+ "location" => "test://",
+ "uri" => 'urn:TestSOAP',
+ "style" => SOAP_RPC,
+ "use" => SOAP_ENCODED
+ ));
var_dump($client->test(0.1));
var_dump($client->test(NAN));
var_dump($response = $client->test(INF));
diff --git a/ext/soap/tests/bugs/bug44882.phpt b/ext/soap/tests/bugs/bug44882.phpt
index 128011722f..8357b0c979 100644
--- a/ext/soap/tests/bugs/bug44882.phpt
+++ b/ext/soap/tests/bugs/bug44882.phpt
@@ -9,10 +9,10 @@ soap.wsdl_cache_enabled=0
class TestSoapClient extends SoapClient
{
public function __doRequest($req, $loc, $act, $ver, $one_way = 0)
- {
- return <<<XML
+ {
+ return <<<XML
<?xml version="1.0" encoding="UTF-8"?>
-<SOAP-ENV:Envelope
+<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ns="urn:ebay:api:PayPalAPI">
@@ -35,7 +35,7 @@ class TestSoapClient extends SoapClient
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
XML;
- }
+ }
}
$client = new TestSoapClient(__DIR__.'/bug44882.wsdl');
diff --git a/ext/soap/tests/bugs/bug46427.phpt b/ext/soap/tests/bugs/bug46427.phpt
index 38d53518b8..3d0b1a4d51 100644
--- a/ext/soap/tests/bugs/bug46427.phpt
+++ b/ext/soap/tests/bugs/bug46427.phpt
@@ -8,10 +8,10 @@ Bug #46427 (SoapClient() stumbles over its "stream_context" parameter)
function getSoapClient_1() {
$ctx = stream_context_create();
return new SoapClient(NULL, array(
- 'stream_context' => $ctx,
- 'location' => 'test://',
- 'uri' => 'test://',
- 'exceptions' => false));
+ 'stream_context' => $ctx,
+ 'location' => 'test://',
+ 'uri' => 'test://',
+ 'exceptions' => false));
}
getSoapClient_1()->__soapCall('Help', array());
diff --git a/ext/soap/tests/bugs/bug47049.phpt b/ext/soap/tests/bugs/bug47049.phpt
index 467df2b901..7ffc15d0cd 100644
--- a/ext/soap/tests/bugs/bug47049.phpt
+++ b/ext/soap/tests/bugs/bug47049.phpt
@@ -7,7 +7,7 @@ soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(__DIR__ . '/bug47049.wsdl',
- array('trace' => 1 , 'exceptions' => 0));
+ array('trace' => 1 , 'exceptions' => 0));
$host = array('uuid' => 'foo');
$software_list = array(array('name' => 'package', 'version' => '1.2.3', 'state' => 'installed'));
$updates = array();
diff --git a/ext/soap/tests/bugs/bug47273.phpt b/ext/soap/tests/bugs/bug47273.phpt
index c23bb5a592..a393b701ab 100644
--- a/ext/soap/tests/bugs/bug47273.phpt
+++ b/ext/soap/tests/bugs/bug47273.phpt
@@ -16,12 +16,12 @@ EOF;
class SoapFaultTest
{
public function test1() {
- // Test #1
+ // Test #1
return 'Test #1 exception with some special chars: Äßö';
}
public function test2() {
// Test #2
- //throw new SoapFault('Server', 'Test #2 exception with some special chars: Äßö');
+ //throw new SoapFault('Server', 'Test #2 exception with some special chars: Äßö');
throw new Exception('Test #2 exception with some special chars: Äßö');
}
}
@@ -32,9 +32,9 @@ $server = new SoapServer(null, array(
$server->setClass('SoapFaultTest');
try {
- $server->handle($request1);
+ $server->handle($request1);
} catch (Exception $e) {
- $server->fault("Sender", $e->getMessage());
+ $server->fault("Sender", $e->getMessage());
}
try {
$server->handle($request2);
diff --git a/ext/soap/tests/bugs/bug50675.phpt b/ext/soap/tests/bugs/bug50675.phpt
index 017671620b..00350b1000 100644
--- a/ext/soap/tests/bugs/bug50675.phpt
+++ b/ext/soap/tests/bugs/bug50675.phpt
@@ -13,29 +13,29 @@ class TestSoapClient extends SoapClient {
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <soapenv:Body>
- <soapenv:Fault>
- <faultcode>soapenv:Server.userException</faultcode>
- <faultstring>service.EchoServiceException</faultstring>
- <detail>
- <service.EchoServiceException xsi:type="ns1:EchoServiceException" xmlns:ns1="urn:service.EchoService">
- <intParameter xsi:type="xsd:int">105</intParameter>
- <parameter xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">string param</parameter>
- </service.EchoServiceException>
- <ns2:hostname xmlns:ns2="http://xml.apache.org/axis/">steckovic</ns2:hostname>
- </detail>
- </soapenv:Fault>
- </soapenv:Body>
+ <soapenv:Body>
+ <soapenv:Fault>
+ <faultcode>soapenv:Server.userException</faultcode>
+ <faultstring>service.EchoServiceException</faultstring>
+ <detail>
+ <service.EchoServiceException xsi:type="ns1:EchoServiceException" xmlns:ns1="urn:service.EchoService">
+ <intParameter xsi:type="xsd:int">105</intParameter>
+ <parameter xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">string param</parameter>
+ </service.EchoServiceException>
+ <ns2:hostname xmlns:ns2="http://xml.apache.org/axis/">steckovic</ns2:hostname>
+ </detail>
+ </soapenv:Fault>
+ </soapenv:Body>
</soapenv:Envelope>
EOF;
- }
+ }
}
ini_set('soap.wsdl_cache_enabled', 0);
$parameters = [
- 'trace' => 1,
- 'exceptions' => 0,
+ 'trace' => 1,
+ 'exceptions' => 0,
];
$client = new TestSoapClient(__DIR__ . '/bug50675.wsdl', $parameters);
diff --git a/ext/soap/tests/bugs/bug50698_1.phpt b/ext/soap/tests/bugs/bug50698_1.phpt
index 6f97b62e06..064ef1eea8 100644
--- a/ext/soap/tests/bugs/bug50698_1.phpt
+++ b/ext/soap/tests/bugs/bug50698_1.phpt
@@ -1,5 +1,5 @@
--TEST--
-Request #50698_1 (SoapClient should handle wsdls with some incompatiable endpoints)
+Request #50698_1 (SoapClient should handle wsdls with some incompatible endpoints)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--INI--
diff --git a/ext/soap/tests/bugs/bug50698_2.phpt b/ext/soap/tests/bugs/bug50698_2.phpt
index 994d78dce9..ac2214e830 100644
--- a/ext/soap/tests/bugs/bug50698_2.phpt
+++ b/ext/soap/tests/bugs/bug50698_2.phpt
@@ -1,5 +1,5 @@
--TEST--
-Request #50698_2 (SoapClient should handle wsdls with some incompatiable endpoints -- EDGECASE: Large mix of compatible and incompatiable endpoints.)
+Request #50698_2 (SoapClient should handle wsdls with some incompatible endpoints -- EDGECASE: Large mix of compatible and incompatible endpoints.)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--INI--
diff --git a/ext/soap/tests/bugs/bug50698_3.phpt b/ext/soap/tests/bugs/bug50698_3.phpt
index c2f66a1618..b29ab2b9c8 100644
--- a/ext/soap/tests/bugs/bug50698_3.phpt
+++ b/ext/soap/tests/bugs/bug50698_3.phpt
@@ -1,5 +1,5 @@
--TEST--
-Request #50698_3 (SoapClient should handle wsdls with some incompatiable endpoints -- EDGECASE: Large set of endpoints all incompatiable.)
+Request #50698_3 (SoapClient should handle wsdls with some incompatible endpoints -- EDGECASE: Large set of endpoints all incompatible.)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--INI--
diff --git a/ext/soap/tests/bugs/bug50698_4.phpt b/ext/soap/tests/bugs/bug50698_4.phpt
index 6240d11892..aea3204661 100644
--- a/ext/soap/tests/bugs/bug50698_4.phpt
+++ b/ext/soap/tests/bugs/bug50698_4.phpt
@@ -1,5 +1,5 @@
--TEST--
-Request #50698_4 (SoapClient should handle wsdls with some incompatiable endpoints)
+Request #50698_4 (SoapClient should handle wsdls with some incompatible endpoints)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--INI--
diff --git a/ext/soap/tests/bugs/bug50762.phpt b/ext/soap/tests/bugs/bug50762.phpt
index c48c761ea2..d8ed9ce544 100644
--- a/ext/soap/tests/bugs/bug50762.phpt
+++ b/ext/soap/tests/bugs/bug50762.phpt
@@ -5,13 +5,13 @@ Bug #50762 (in WSDL mode Soap Header handler function only being called if defin
--FILE--
<?php
class testSoap {
- private $auth;
- public function authToken($token){
- $this->auth=true;
- }
- public function testHeader($param){
- return 'header handler ' . ($this->auth ? 'called' : 'not called');
- }
+ private $auth;
+ public function authToken($token){
+ $this->auth=true;
+ }
+ public function testHeader($param){
+ return 'header handler ' . ($this->auth ? 'called' : 'not called');
+ }
}
class LocalSoapClient extends SoapClient {
@@ -19,7 +19,7 @@ class LocalSoapClient extends SoapClient {
function __construct($wsdl, $options) {
parent::__construct($wsdl, $options);
$this->server = new SoapServer($wsdl, $options);
- $this->server->setObject(new testSoap());
+ $this->server->setObject(new testSoap());
}
function __doRequest($request, $location, $action, $version, $one_way = 0) {
@@ -35,9 +35,9 @@ class LocalSoapClient extends SoapClient {
$cl = new LocalSoapClient(__DIR__.'/bug50762.wsdl', array('cache_wsdl'=>WSDL_CACHE_NONE, 'trace'=>true));
class authToken{
- public function __construct($token){
- $this->authToken=$token;
- }
+ public function __construct($token){
+ $this->authToken=$token;
+ }
}
$cl->__setSoapHeaders(array(new SoapHeader('http://sova.pronto.ru/', 'authToken', new authToken('tokendata'))));
diff --git a/ext/soap/tests/bugs/bug65018.phpt b/ext/soap/tests/bugs/bug65018.phpt
index bbb9b5e42d..762f4f6ec4 100644
--- a/ext/soap/tests/bugs/bug65018.phpt
+++ b/ext/soap/tests/bugs/bug65018.phpt
@@ -4,24 +4,24 @@ Bug #65018 (SoapHeader problems with SoapServer)
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
- class Tool{
- public function TOKEN($id){
- return new SoapHeader('namespace1', 'TOKEN', $id, true);
- }
- public function Method(){}
- }
+ class Tool{
+ public function TOKEN($id){
+ return new SoapHeader('namespace1', 'TOKEN', $id, true);
+ }
+ public function Method(){}
+ }
- $input = $input =
- '<?xml version="1.0"?>'.PHP_EOL.
- '<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="namespace1"'.
- ' xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'.
- ' xmlns:xsd="http://www.w3.org/2001/XMLSchema">'.
- '<SOAP-ENV:Header><ns1:TOKEN soapenv:mustUnderstand="1">abc</ns1:TOKEN></SOAP-ENV:Header>'.
- '<SOAP-ENV:Body><ns1:Method /></SOAP-ENV:Body></SOAP-ENV:Envelope>';
+ $input = $input =
+ '<?xml version="1.0"?>'.PHP_EOL.
+ '<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="namespace1"'.
+ ' xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'.
+ ' xmlns:xsd="http://www.w3.org/2001/XMLSchema">'.
+ '<SOAP-ENV:Header><ns1:TOKEN soapenv:mustUnderstand="1">abc</ns1:TOKEN></SOAP-ENV:Header>'.
+ '<SOAP-ENV:Body><ns1:Method /></SOAP-ENV:Body></SOAP-ENV:Envelope>';
- $soap = new SoapServer(null, array('uri' => '127.0.0.1'));
- $soap->setClass('Tool');
- $soap->handle($input);
+ $soap = new SoapServer(null, array('uri' => '127.0.0.1'));
+ $soap->setClass('Tool');
+ $soap->handle($input);
?>
--EXPECT--
<?xml version="1.0" encoding="UTF-8"?>
diff --git a/ext/soap/tests/bugs/bug66112.phpt b/ext/soap/tests/bugs/bug66112.phpt
index 743297ac23..7dd067d614 100644
--- a/ext/soap/tests/bugs/bug66112.phpt
+++ b/ext/soap/tests/bugs/bug66112.phpt
@@ -8,12 +8,12 @@ soap.wsdl_cache_enabled=0
<?php
define('WSDL', __DIR__."/bug66112.wsdl");
function Mist($p) {
- $client=new soapclient(WSDL, array('typemap'=>array(array("type_ns"=>"uri:mist", "type_name"=>"A"))));
- try{
- $client->Mist(array("XX"=>"xx"));
- }catch(SoapFault $x){
- }
- return array("A"=>"ABC","B"=>"sss");
+ $client=new soapclient(WSDL, array('typemap'=>array(array("type_ns"=>"uri:mist", "type_name"=>"A"))));
+ try{
+ $client->Mist(array("XX"=>"xx"));
+ }catch(SoapFault $x){
+ }
+ return array("A"=>"ABC","B"=>"sss");
}
$s = new SoapServer(WSDL, array('typemap'=>array(array("type_ns"=>"uri:mist", "type_name"=>"A"))));
$s->addFunction("Mist");
diff --git a/ext/soap/tests/bugs/bug69085.phpt b/ext/soap/tests/bugs/bug69085.phpt
index cb27cfd89e..7d7f36e9bd 100644
--- a/ext/soap/tests/bugs/bug69085.phpt
+++ b/ext/soap/tests/bugs/bug69085.phpt
@@ -9,9 +9,9 @@ soap.wsdl_cache_enabled=0
$dummy = unserialize('O:10:"SoapClient":5:{s:3:"uri";s:1:"a";s:8:"location";s:22:"http://localhost/a.xml";s:17:"__default_headers";i:1337;s:15:"__last_response";s:1:"a";s:5:"trace";s:1:"x";}');
try {
- $dummy->whatever();
+ $dummy->whatever();
} catch (Exception $e) {
- echo "okey";
+ echo "okey";
}
--EXPECT--
okey
diff --git a/ext/soap/tests/bugs/bug69462.phpt b/ext/soap/tests/bugs/bug69462.phpt
index eecd8d6749..003d62e495 100644
--- a/ext/soap/tests/bugs/bug69462.phpt
+++ b/ext/soap/tests/bugs/bug69462.phpt
@@ -9,18 +9,18 @@ $namespace = "http://example.com/ns";
$client = new SoapClient(null, [ 'exceptions' => 1, 'location' => "", 'uri' => $namespace ]);
$soapvar = new SoapVar(
- array(
- new SoapVar('value', XSD_STRING, null, null, null, $namespace)
- ),
- SOAP_ENC_OBJECT, null, null, 'name', $namespace
+ array(
+ new SoapVar('value', XSD_STRING, null, null, null, $namespace)
+ ),
+ SOAP_ENC_OBJECT, null, null, 'name', $namespace
);
try {
- $client->__soapCall('method', array($soapvar));
+ $client->__soapCall('method', array($soapvar));
}
catch (Exception $e) {
- /* ignore any errors, we're testing for segmentation fault anyway */
- echo "good";
+ /* ignore any errors, we're testing for segmentation fault anyway */
+ echo "good";
}
?>
--EXPECT--
diff --git a/ext/soap/tests/bugs/bug70469.phpt b/ext/soap/tests/bugs/bug70469.phpt
index 1186cc003f..b3f4ba01a7 100644
--- a/ext/soap/tests/bugs/bug70469.phpt
+++ b/ext/soap/tests/bugs/bug70469.phpt
@@ -7,7 +7,7 @@ Bug #70469 (SoapClient should not generate E_ERROR if exceptions enabled)
try {
$x = new SoapClient('http://i_dont_exist.com/some.wsdl');
} catch (SoapFault $e) {
- echo "catched\n";
+ echo "caught\n";
}
$error = error_get_last();
@@ -16,5 +16,5 @@ if ($error === null) {
}
?>
--EXPECT--
-catched
+caught
ok
diff --git a/ext/soap/tests/bugs/bug77141.phpt b/ext/soap/tests/bugs/bug77141.phpt
index fa38cc6959..268e3e049c 100644
--- a/ext/soap/tests/bugs/bug77141.phpt
+++ b/ext/soap/tests/bugs/bug77141.phpt
@@ -20,8 +20,6 @@ ini_set('precision', -1);
$soap->call(1.1);
echo $soap->__getLastRequest();
?>
-===DONE===
--EXPECT--
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://localhost/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:call><param0 xsi:type="xsd:float">1.1</param0></ns1:call></SOAP-ENV:Body></SOAP-ENV:Envelope>
-===DONE===
diff --git a/ext/soap/tests/bugs/multiport.phpt b/ext/soap/tests/bugs/multiport.phpt
index 53e281130f..549a5b3c72 100644
--- a/ext/soap/tests/bugs/multiport.phpt
+++ b/ext/soap/tests/bugs/multiport.phpt
@@ -7,7 +7,7 @@ soap.wsdl_cache_enabled=0
--FILE--
<?php
$client = new SoapClient(__DIR__.'/multiport.wsdl',
- array('trace' => true, 'exceptions' => false));
+ array('trace' => true, 'exceptions' => false));
$response = $client->GetSessionId(array('userId'=>'user', 'password'=>'password'));
echo $client->__getLastRequest();
?>
diff --git a/ext/soap/tests/classmap001.phpt b/ext/soap/tests/classmap001.phpt
index 1a3a472c27..c3f5301f46 100644
--- a/ext/soap/tests/classmap001.phpt
+++ b/ext/soap/tests/classmap001.phpt
@@ -7,11 +7,11 @@ soap.wsdl_cache_enabled=0
--FILE--
<?php
$GLOBALS['HTTP_RAW_POST_DATA']="
-<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"
- xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
- xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
- xmlns:enc=\"http://schemas.xmlsoap.org/soap/encoding/\"
- xmlns:ns1=\"http://schemas.nothing.com\"
+<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"
+ xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
+ xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
+ xmlns:enc=\"http://schemas.xmlsoap.org/soap/encoding/\"
+ xmlns:ns1=\"http://schemas.nothing.com\"
>
<env:Body>
<dotest>
@@ -25,21 +25,21 @@ $GLOBALS['HTTP_RAW_POST_DATA']="
</env:Envelope>";
class test{
- function dotest(book $book){
- $classname=get_class($book);
- return "Classname: ".$classname;
- }
+ function dotest(book $book){
+ $classname=get_class($book);
+ return "Classname: ".$classname;
+ }
}
class book{
- public $a="a";
- public $b="c";
+ public $a="a";
+ public $b="c";
}
$options=Array(
- 'actor' =>'http://schema.nothing.com',
- 'classmap' => array('book'=>'book', 'wsdltype2'=>'classname2')
- );
+ 'actor' =>'http://schema.nothing.com',
+ 'classmap' => array('book'=>'book', 'wsdltype2'=>'classname2')
+ );
$server = new SoapServer(__DIR__."/classmap.wsdl",$options);
$server->setClass("test");
diff --git a/ext/soap/tests/classmap002.phpt b/ext/soap/tests/classmap002.phpt
index 2f16cf506a..cf3dd78e3f 100644
--- a/ext/soap/tests/classmap002.phpt
+++ b/ext/soap/tests/classmap002.phpt
@@ -8,7 +8,7 @@ soap.wsdl_cache_enabled=0
<?php
class TestSoapClient extends SoapClient{
function __doRequest($request, $location, $action, $version, $one_way = 0) {
- return <<<EOF
+ return <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.nothing.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body>
<ns1:dotest2Response><res xsi:type="ns1:book">
@@ -17,19 +17,19 @@ class TestSoapClient extends SoapClient{
</res>
</ns1:dotest2Response></SOAP-ENV:Body></SOAP-ENV:Envelope>
EOF;
- }
+ }
}
class book{
- public $a="a";
- public $b="c";
+ public $a="a";
+ public $b="c";
}
$options=Array(
- 'actor' =>'http://schema.nothing.com',
- 'classmap' => array('book'=>'book', 'wsdltype2'=>'classname2')
- );
+ 'actor' =>'http://schema.nothing.com',
+ 'classmap' => array('book'=>'book', 'wsdltype2'=>'classname2')
+ );
$client = new TestSoapClient(__DIR__."/classmap.wsdl",$options);
$ret = $client->dotest2("???");
diff --git a/ext/soap/tests/custom_content_type.phpt b/ext/soap/tests/custom_content_type.phpt
index ef95be4ffc..7a92a76607 100644
--- a/ext/soap/tests/custom_content_type.phpt
+++ b/ext/soap/tests/custom_content_type.phpt
@@ -73,8 +73,6 @@ if (strpos($headers, 'Content-Type: application/soap+xml; charset=utf-8; action=
else
printf("Content-Type Default OK" . PHP_EOL);
?>
-==DONE==
--EXPECT--
Content-Type OK
Content-Type Default OK
-==DONE==
diff --git a/ext/soap/tests/fault_warning.phpt b/ext/soap/tests/fault_warning.phpt
index 98d2d269ea..f92cc81b2e 100644
--- a/ext/soap/tests/fault_warning.phpt
+++ b/ext/soap/tests/fault_warning.phpt
@@ -11,18 +11,18 @@ echo get_class($fault) . "\n";
$fault = new SoapFault(null, "message");
echo get_class($fault) . "\n";
$fault = new SoapFault(["more"], "message"); // two elements in array required
-$fault = new SoapFault(["m", "more", "superflous"], "message"); // two required
+$fault = new SoapFault(["m", "more", "superfluous"], "message"); // two required
$fault = new SoapFault(["more-ns", "Sender"], "message"); // two given
echo get_class($fault);
?>
--EXPECTF--
-Warning: SoapFault::SoapFault(): Invalid fault code in %s on line %d
+Warning: SoapFault::__construct(): Invalid fault code in %s on line %d
-Warning: SoapFault::SoapFault(): Invalid fault code in %s on line %d
+Warning: SoapFault::__construct(): Invalid fault code in %s on line %d
SoapFault
SoapFault
-Warning: SoapFault::SoapFault(): Invalid fault code in %s on line %d
+Warning: SoapFault::__construct(): Invalid fault code in %s on line %d
-Warning: SoapFault::SoapFault(): Invalid fault code in %s on line %d
+Warning: SoapFault::__construct(): Invalid fault code in %s on line %d
SoapFault
diff --git a/ext/soap/tests/interop/Round2/Base/r2_base_014s.phpt b/ext/soap/tests/interop/Round2/Base/r2_base_014s.phpt
index 681f604e6a..f81a0c13f4 100644
--- a/ext/soap/tests/interop/Round2/Base/r2_base_014s.phpt
+++ b/ext/soap/tests/interop/Round2/Base/r2_base_014s.phpt
@@ -7,9 +7,9 @@ precision=14
--FILE--
<?php
$param = new SoapParam(new SoapVar(array(
- new SoapVar('arg', XSD_STRING, null, null, 'varString'),
- new SoapVar('34', XSD_INT, null, null, 'varInt'),
- new SoapVar('325.325', XSD_FLOAT, null, null, 'varFloat')
+ new SoapVar('arg', XSD_STRING, null, null, 'varString'),
+ new SoapVar('34', XSD_INT, null, null, 'varInt'),
+ new SoapVar('325.325', XSD_FLOAT, null, null, 'varFloat')
),SOAP_ENC_OBJECT,"SOAPStruct","http://soapinterop.org/xsd"), "inputStruct");
$client = new SoapClient(NULL,array("location"=>"test://","uri"=>"http://soapinterop.org/","trace"=>1,"exceptions"=>0));
$client->__soapCall("echoStruct", array($param), array("soapaction"=>"http://soapinterop.org/","uri"=>"http://soapinterop.org/"));
diff --git a/ext/soap/tests/interop/Round2/Base/r2_base_015s.phpt b/ext/soap/tests/interop/Round2/Base/r2_base_015s.phpt
index efbad5a121..c167556f12 100644
--- a/ext/soap/tests/interop/Round2/Base/r2_base_015s.phpt
+++ b/ext/soap/tests/interop/Round2/Base/r2_base_015s.phpt
@@ -15,14 +15,14 @@ class SOAPStruct {
}
$struct1 = new SoapVar(array(
- new SoapVar('arg', XSD_STRING, null, null, 'varString'),
- new SoapVar('34', XSD_INT, null, null, 'varInt'),
- new SoapVar('325.325', XSD_FLOAT, null, null, 'varFloat')
+ new SoapVar('arg', XSD_STRING, null, null, 'varString'),
+ new SoapVar('34', XSD_INT, null, null, 'varInt'),
+ new SoapVar('325.325', XSD_FLOAT, null, null, 'varFloat')
),SOAP_ENC_OBJECT,"SOAPStruct","http://soapinterop.org/xsd");
$struct2 = new SoapVar(array(
- new SoapVar('arg', XSD_STRING, null, null, 'varString'),
- new SoapVar('34', XSD_INT, null, null, 'varInt'),
- new SoapVar('325.325', XSD_FLOAT, null, null, 'varFloat')
+ new SoapVar('arg', XSD_STRING, null, null, 'varString'),
+ new SoapVar('34', XSD_INT, null, null, 'varInt'),
+ new SoapVar('325.325', XSD_FLOAT, null, null, 'varFloat')
),SOAP_ENC_OBJECT,"SOAPStruct","http://soapinterop.org/xsd");
$param = new SoapParam(new SoapVar(array(
diff --git a/ext/soap/tests/interop/Round2/GroupB/r2_groupB_004s.phpt b/ext/soap/tests/interop/Round2/GroupB/r2_groupB_004s.phpt
index 126bdff26d..fe9d90c509 100644
--- a/ext/soap/tests/interop/Round2/GroupB/r2_groupB_004s.phpt
+++ b/ext/soap/tests/interop/Round2/GroupB/r2_groupB_004s.phpt
@@ -11,7 +11,7 @@ $param = new SoapParam(new SoapVar(array(
new SoapVar(34, XSD_INT, null, null, "varInt"),
new SoapVar(123.45, XSD_FLOAT, null, null, "varFloat"),
new SoapVar(array(
- new SoapVar("arg2", XSD_STRING, null, null, "varString"),
+ new SoapVar("arg2", XSD_STRING, null, null, "varString"),
new SoapVar(342, XSD_INT, null, null, "varInt"),
new SoapVar(123.452, XSD_FLOAT, null, null, "varFloat")
), SOAP_ENC_OBJECT, "SOAPStruct", "http://soapinterop.org/xsd", 'varStruct')
diff --git a/ext/soap/tests/interop/Round2/GroupB/r2_groupB_005s.phpt b/ext/soap/tests/interop/Round2/GroupB/r2_groupB_005s.phpt
index e8cacfacbb..20d1d1426b 100644
--- a/ext/soap/tests/interop/Round2/GroupB/r2_groupB_005s.phpt
+++ b/ext/soap/tests/interop/Round2/GroupB/r2_groupB_005s.phpt
@@ -11,9 +11,9 @@ $param = new SoapParam(new SoapVar(array(
new SoapVar(34, XSD_INT, null, null, "varInt"),
new SoapVar(325.325, XSD_FLOAT, null, null, "varFloat"),
new SoapVar(array(
- new SoapVar("red", XSD_STRING),
- new SoapVar("blue", XSD_STRING),
- new SoapVar("green", XSD_STRING),
+ new SoapVar("red", XSD_STRING),
+ new SoapVar("blue", XSD_STRING),
+ new SoapVar("green", XSD_STRING),
), SOAP_ENC_ARRAY, "ArrayOfString", "http://soapinterop.org/xsd", 'varArray')
), SOAP_ENC_OBJECT, "SOAPArrayStruct", "http://soapinterop.org/xsd"), "inputStruct");
$client = new SoapClient(NULL,array("location"=>"test://","uri"=>"http://soapinterop.org/","trace"=>1,"exceptions"=>0));
diff --git a/ext/soap/tests/interop/Round2/GroupB/round2_groupB.inc b/ext/soap/tests/interop/Round2/GroupB/round2_groupB.inc
index 77b81271c9..c8fc93aaa3 100644
--- a/ext/soap/tests/interop/Round2/GroupB/round2_groupB.inc
+++ b/ext/soap/tests/interop/Round2/GroupB/round2_groupB.inc
@@ -11,8 +11,8 @@ class SOAP_Interop_GroupB {
function echoSimpleTypesAsStruct($string, $int, $float)
{
return (object)array("varString" => $string,
- "varInt" => $int,
- "varFloat" => $float);
+ "varInt" => $int,
+ "varFloat" => $float);
}
function echoNestedStruct($struct)
diff --git a/ext/soap/tests/interop/Round4/GroupH/round4_groupH_complex_doclit.inc b/ext/soap/tests/interop/Round4/GroupH/round4_groupH_complex_doclit.inc
index a27f96e279..845d96d644 100644
--- a/ext/soap/tests/interop/Round4/GroupH/round4_groupH_complex_doclit.inc
+++ b/ext/soap/tests/interop/Round4/GroupH/round4_groupH_complex_doclit.inc
@@ -14,21 +14,21 @@ class SOAP_Interop_GroupH {
}
function echoMultipleFaults1($input) {
- if ($input->whichFault == 2) {
- return new SoapFault("Server", "Fault in response to 'echoMultipleFaults1'.", null, $input->param2, "ComplexFault2");
- } else {
- return new SoapFault("Server", "Fault in response to 'echoMultipleFaults1'.", null, array("soapStruct"=>$input->param1), "ComplexFault1");
- }
+ if ($input->whichFault == 2) {
+ return new SoapFault("Server", "Fault in response to 'echoMultipleFaults1'.", null, $input->param2, "ComplexFault2");
+ } else {
+ return new SoapFault("Server", "Fault in response to 'echoMultipleFaults1'.", null, array("soapStruct"=>$input->param1), "ComplexFault1");
+ }
}
function echoMultipleFaults2($input) {
- if ($input->whichFault == 2) {
- return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $input->param2, "ComplexFault2");
- } else if ($input->whichFault == 3) {
- return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $input->param3, "ComplexFault3");
- } else {
- return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $input->param1, "ComplexFault1");
- }
+ if ($input->whichFault == 2) {
+ return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $input->param2, "ComplexFault2");
+ } else if ($input->whichFault == 3) {
+ return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $input->param3, "ComplexFault3");
+ } else {
+ return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $input->param1, "ComplexFault1");
+ }
}
}
diff --git a/ext/soap/tests/interop/Round4/GroupH/round4_groupH_complex_rpcenc.inc b/ext/soap/tests/interop/Round4/GroupH/round4_groupH_complex_rpcenc.inc
index 52165ba56e..1e403e4488 100644
--- a/ext/soap/tests/interop/Round4/GroupH/round4_groupH_complex_rpcenc.inc
+++ b/ext/soap/tests/interop/Round4/GroupH/round4_groupH_complex_rpcenc.inc
@@ -14,21 +14,21 @@ class SOAP_Interop_GroupH {
}
function echoMultipleFaults1($which, $s1, $s2) {
- if ($which == 2) {
- return new SoapFault("Server", "Fault in response to 'echoMultipleFaults1'.", null, $s2, "ComplexFault2");
- } else {
- return new SoapFault("Server", "Fault in response to 'echoMultipleFaults1'.", null, array("soapStruct"=>$s1), "ComplexFault1");
- }
+ if ($which == 2) {
+ return new SoapFault("Server", "Fault in response to 'echoMultipleFaults1'.", null, $s2, "ComplexFault2");
+ } else {
+ return new SoapFault("Server", "Fault in response to 'echoMultipleFaults1'.", null, array("soapStruct"=>$s1), "ComplexFault1");
+ }
}
function echoMultipleFaults2($which, $s1, $s2, $s3) {
- if ($which == 2) {
- return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $s2, "ComplexFault2");
- } else if ($which == 3) {
- return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $s3, "ComplexFault3");
- } else {
- return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $s1, "ComplexFault1");
- }
+ if ($which == 2) {
+ return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $s2, "ComplexFault2");
+ } else if ($which == 3) {
+ return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $s3, "ComplexFault3");
+ } else {
+ return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $s1, "ComplexFault1");
+ }
}
}
diff --git a/ext/soap/tests/interop/Round4/GroupH/round4_groupH_simple_doclit.inc b/ext/soap/tests/interop/Round4/GroupH/round4_groupH_simple_doclit.inc
index e0e35f1821..17bcd9c41d 100644
--- a/ext/soap/tests/interop/Round4/GroupH/round4_groupH_simple_doclit.inc
+++ b/ext/soap/tests/interop/Round4/GroupH/round4_groupH_simple_doclit.inc
@@ -14,39 +14,39 @@ class SOAP_Interop_GroupH {
}
function echoMultipleFaults1($input) {
- if ($input->whichFault == 2) {
- return new SoapFault("Server", "Fault in response to 'echoMultipleFaults1'.", null, $input->param1, "SimpleFault2");
- } else if ($input->whichFault == 3) {
- return new SoapFault("Server", "Fault in response to 'echoMultipleFaults1'.", null, $input->param2, "SimpleFault3");
- } else {
- return new SoapFault("Server", "Fault in response to 'echoMultipleFaults1'.", null, null, "SimpleFault1");
- }
+ if ($input->whichFault == 2) {
+ return new SoapFault("Server", "Fault in response to 'echoMultipleFaults1'.", null, $input->param1, "SimpleFault2");
+ } else if ($input->whichFault == 3) {
+ return new SoapFault("Server", "Fault in response to 'echoMultipleFaults1'.", null, $input->param2, "SimpleFault3");
+ } else {
+ return new SoapFault("Server", "Fault in response to 'echoMultipleFaults1'.", null, null, "SimpleFault1");
+ }
}
function echoMultipleFaults2($input) {
- if ($input->whichFault == 2) {
- return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $input->param1, "SimpleFault1");
- } else if ($input->whichFault == 3) {
- return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $input->param3, "SimpleFault3");
- } else {
- return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $input->param2, "SimpleFault2");
- }
+ if ($input->whichFault == 2) {
+ return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $input->param1, "SimpleFault1");
+ } else if ($input->whichFault == 3) {
+ return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $input->param3, "SimpleFault3");
+ } else {
+ return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $input->param2, "SimpleFault2");
+ }
}
function echoMultipleFaults3($input) {
- if ($input->whichFault == 2) {
- return new SoapFault("Server", "Fault in response to 'echoMultipleFaults3'.", null, $input->param2, "SimpleFault2");
- } else {
- return new SoapFault("Server", "Fault in response to 'echoMultipleFaults3'.", null, $input->param1, "SimpleFault1");
- }
+ if ($input->whichFault == 2) {
+ return new SoapFault("Server", "Fault in response to 'echoMultipleFaults3'.", null, $input->param2, "SimpleFault2");
+ } else {
+ return new SoapFault("Server", "Fault in response to 'echoMultipleFaults3'.", null, $input->param1, "SimpleFault1");
+ }
}
function echoMultipleFaults4($input) {
- if ($input->whichFault == 2) {
- return new SoapFault("Server", "Fault in response to 'echoMultipleFaults4'.", null, $input->param2, "SimpleFault2");
- } else {
- return new SoapFault("Server", "Fault in response to 'echoMultipleFaults4'.", null, $input->param1, "SimpleFault1");
- }
+ if ($input->whichFault == 2) {
+ return new SoapFault("Server", "Fault in response to 'echoMultipleFaults4'.", null, $input->param2, "SimpleFault2");
+ } else {
+ return new SoapFault("Server", "Fault in response to 'echoMultipleFaults4'.", null, $input->param1, "SimpleFault1");
+ }
}
}
diff --git a/ext/soap/tests/interop/Round4/GroupH/round4_groupH_simple_rpcenc.inc b/ext/soap/tests/interop/Round4/GroupH/round4_groupH_simple_rpcenc.inc
index d39f060963..01b9870a1a 100644
--- a/ext/soap/tests/interop/Round4/GroupH/round4_groupH_simple_rpcenc.inc
+++ b/ext/soap/tests/interop/Round4/GroupH/round4_groupH_simple_rpcenc.inc
@@ -14,39 +14,39 @@ class SOAP_Interop_GroupH {
}
function echoMultipleFaults1($param, $string, $floats) {
- if ($param == 2) {
- return new SoapFault("Server", "Fault in response to 'echoMultipleFaults1'.", null, $string, "SimpleFault2");
- } else if ($param == 3) {
- return new SoapFault("Server", "Fault in response to 'echoMultipleFaults1'.", null, $floats, "SimpleFault3");
- } else {
- return new SoapFault("Server", "Fault in response to 'echoMultipleFaults1'.", null, null, "SimpleFault1");
- }
+ if ($param == 2) {
+ return new SoapFault("Server", "Fault in response to 'echoMultipleFaults1'.", null, $string, "SimpleFault2");
+ } else if ($param == 3) {
+ return new SoapFault("Server", "Fault in response to 'echoMultipleFaults1'.", null, $floats, "SimpleFault3");
+ } else {
+ return new SoapFault("Server", "Fault in response to 'echoMultipleFaults1'.", null, null, "SimpleFault1");
+ }
}
function echoMultipleFaults2($param, $string, $float, $strings) {
- if ($param == 2) {
- return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $string, "SimpleFault1");
- } else if ($param == 3) {
- return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $strings, "SimpleFault3");
- } else {
- return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $float, "SimpleFault2");
- }
+ if ($param == 2) {
+ return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $string, "SimpleFault1");
+ } else if ($param == 3) {
+ return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $strings, "SimpleFault3");
+ } else {
+ return new SoapFault("Server", "Fault in response to 'echoMultipleFaults2'.", null, $float, "SimpleFault2");
+ }
}
function echoMultipleFaults3($param, $param1, $param2) {
- if ($param == 2) {
- return new SoapFault("Server", "Fault in response to 'echoMultipleFaults3'.", null, $param2, "SimpleFault2");
- } else {
- return new SoapFault("Server", "Fault in response to 'echoMultipleFaults3'.", null, $param1, "SimpleFault1");
- }
+ if ($param == 2) {
+ return new SoapFault("Server", "Fault in response to 'echoMultipleFaults3'.", null, $param2, "SimpleFault2");
+ } else {
+ return new SoapFault("Server", "Fault in response to 'echoMultipleFaults3'.", null, $param1, "SimpleFault1");
+ }
}
function echoMultipleFaults4($param, $int, $enum) {
- if ($param == 2) {
- return new SoapFault("Server", "Fault in response to 'echoMultipleFaults4'.", null, $enum, "SimpleFault2");
- } else {
- return new SoapFault("Server", "Fault in response to 'echoMultipleFaults4'.", null, $int, "SimpleFault1");
- }
+ if ($param == 2) {
+ return new SoapFault("Server", "Fault in response to 'echoMultipleFaults4'.", null, $enum, "SimpleFault2");
+ } else {
+ return new SoapFault("Server", "Fault in response to 'echoMultipleFaults4'.", null, $int, "SimpleFault1");
+ }
}
}
diff --git a/ext/soap/tests/interop/Round4/GroupI/round4_groupI_xsd.inc b/ext/soap/tests/interop/Round4/GroupI/round4_groupI_xsd.inc
index af74db7c74..c736bcde4b 100644
--- a/ext/soap/tests/interop/Round4/GroupI/round4_groupI_xsd.inc
+++ b/ext/soap/tests/interop/Round4/GroupI/round4_groupI_xsd.inc
@@ -3,11 +3,11 @@ class SOAP_Interop_GroupI {
function echoString($inputString)
{
- if (isset($inputString->inputString)) {
- return array("return"=>$inputString->inputString);
- } else {
- return $inputString;
- }
+ if (isset($inputString->inputString)) {
+ return array("return"=>$inputString->inputString);
+ } else {
+ return $inputString;
+ }
}
function echoInteger($inputInteger)
@@ -26,11 +26,11 @@ class SOAP_Interop_GroupI {
function echoBase64($inputBase64)
{
- if (isset($inputBase64->inputBase64)) {
- return array("return"=>$inputBase64->inputBase64);
- } else {
- return $inputBase64;
- }
+ if (isset($inputBase64->inputBase64)) {
+ return array("return"=>$inputBase64->inputBase64);
+ } else {
+ return $inputBase64;
+ }
}
function echoDate($timeInstant)
@@ -40,56 +40,56 @@ class SOAP_Interop_GroupI {
function echoComplexType($inputComplexType)
{
- if (isset($inputComplexType->inputComplexType)) {
- return array("return"=>$inputComplexType->inputComplexType);
- } else {
- return $inputComplexType;
- }
+ if (isset($inputComplexType->inputComplexType)) {
+ return array("return"=>$inputComplexType->inputComplexType);
+ } else {
+ return $inputComplexType;
+ }
}
function echoIntegerMultiOccurs($input)
{
- if (isset($input->inputIntegerMultiOccurs->int)) {
- return array("return"=>$input->inputIntegerMultiOccurs->int);
- } else {
- return array();
- }
+ if (isset($input->inputIntegerMultiOccurs->int)) {
+ return array("return"=>$input->inputIntegerMultiOccurs->int);
+ } else {
+ return array();
+ }
}
function echoFloatMultiOccurs($input)
{
- if (isset($input->inputFloatMultiOccurs->float)) {
- return array("return"=>$input->inputFloatMultiOccurs->float);
- } else {
- return array();
- }
+ if (isset($input->inputFloatMultiOccurs->float)) {
+ return array("return"=>$input->inputFloatMultiOccurs->float);
+ } else {
+ return array();
+ }
}
function echoStringMultiOccurs($input)
{
- if (isset($input->inputStringMultiOccurs->string)) {
- return array("return"=>$input->inputStringMultiOccurs->string);
- } else {
- return array();
- }
+ if (isset($input->inputStringMultiOccurs->string)) {
+ return array("return"=>$input->inputStringMultiOccurs->string);
+ } else {
+ return array();
+ }
}
function echoComplexTypeMultiOccurs($input)
{
- if (isset($input->inputComplexTypeMultiOccurs->SOAPComplexType)) {
- return array("return"=>$input->inputComplexTypeMultiOccurs->SOAPComplexType);
- } else {
- return array();
- }
+ if (isset($input->inputComplexTypeMultiOccurs->SOAPComplexType)) {
+ return array("return"=>$input->inputComplexTypeMultiOccurs->SOAPComplexType);
+ } else {
+ return array();
+ }
}
function echoHexBinary($hb)
{
- if (isset($hb->inputHexBinary)) {
- return array("return"=>$hb->inputHexBinary);
- } else {
- return $hb;
- }
+ if (isset($hb->inputHexBinary)) {
+ return array("return"=>$hb->inputHexBinary);
+ } else {
+ return $hb;
+ }
}
function echoDecimal($dec)
@@ -104,53 +104,53 @@ class SOAP_Interop_GroupI {
function echoComplexTypeAsSimpleTypes($input)
{
- if (isset($input->inputComplexType)) {
- $ret = array("outputInteger" => $input->inputComplexType->varInt,
- "outputFloat" => $input->inputComplexType->varFloat);
- if (isset($input->inputComplexType->varString)) {
- $ret["outputString"] = $input->inputComplexType->varString;
- }
- return $ret;
- } else {
- return array();
- }
- }
+ if (isset($input->inputComplexType)) {
+ $ret = array("outputInteger" => $input->inputComplexType->varInt,
+ "outputFloat" => $input->inputComplexType->varFloat);
+ if (isset($input->inputComplexType->varString)) {
+ $ret["outputString"] = $input->inputComplexType->varString;
+ }
+ return $ret;
+ } else {
+ return array();
+ }
+ }
function echoSimpleTypesAsComplexType($input)
{
- $ret = array("varInt" => $input->inputInteger,
- "varFloat" => $input->inputFloat);
- if (isset($input->inputString)) {
- $ret["varString"] = $input->inputString;
- }
- return array("return"=>$ret);
+ $ret = array("varInt" => $input->inputInteger,
+ "varFloat" => $input->inputFloat);
+ if (isset($input->inputString)) {
+ $ret["varString"] = $input->inputString;
+ }
+ return array("return"=>$ret);
}
function echoNestedComplexType($inputComplexType)
{
- if (isset($inputComplexType->inputComplexType)) {
- return array("return"=>$inputComplexType->inputComplexType);
- } else {
- return $inputComplexType;
- }
+ if (isset($inputComplexType->inputComplexType)) {
+ return array("return"=>$inputComplexType->inputComplexType);
+ } else {
+ return $inputComplexType;
+ }
}
function echoNestedMultiOccurs($inputComplexType)
{
- if (isset($inputComplexType->inputComplexType)) {
- return array("return"=>$inputComplexType->inputComplexType);
- } else {
- return $inputComplexType;
- }
+ if (isset($inputComplexType->inputComplexType)) {
+ return array("return"=>$inputComplexType->inputComplexType);
+ } else {
+ return $inputComplexType;
+ }
}
function echoChoice($input)
{
- if (isset($input->inputChoice)) {
- return array("return"=>$input->inputChoice);
- } else {
- return $input;
- }
+ if (isset($input->inputChoice)) {
+ return array("return"=>$input->inputChoice);
+ } else {
+ return $input;
+ }
}
function echoEnum($input)
@@ -160,20 +160,20 @@ class SOAP_Interop_GroupI {
function echoAnyType($input)
{
- if (isset($input->inputAnyType)) {
- return array("return"=>$input->inputAnyType);
- } else {
- return $input;
- }
+ if (isset($input->inputAnyType)) {
+ return array("return"=>$input->inputAnyType);
+ } else {
+ return $input;
+ }
}
function echoAnyElement($input)
{
- if (isset($input->inputAny)) {
- return array("return"=>$input->inputAny);
- } else {
- return $input;
- }
+ if (isset($input->inputAny)) {
+ return array("return"=>$input->inputAny);
+ } else {
+ return $input;
+ }
}
function echoVoidSoapHeader()
diff --git a/ext/soap/tests/interop/Round4/GroupI/round4_groupI_xsd.wsdl b/ext/soap/tests/interop/Round4/GroupI/round4_groupI_xsd.wsdl
index 454f879fd3..908a49789e 100644
--- a/ext/soap/tests/interop/Round4/GroupI/round4_groupI_xsd.wsdl
+++ b/ext/soap/tests/interop/Round4/GroupI/round4_groupI_xsd.wsdl
@@ -1102,7 +1102,7 @@
</operation>
</binding>
<service name="Round4XSDTest">
- <documentation>These operations implement DOC/LIT SOAP operations, for interop testing. Please email johnko@microsoft.com with any questions/coments.</documentation>
+ <documentation>These operations implement DOC/LIT SOAP operations, for interop testing. Please email johnko@microsoft.com with any questions/comments.</documentation>
<port name="Round4XSDTestSoap" binding="s0:Round4XSDTestSoap">
<soap:address location="test://" />
</port>
diff --git a/ext/soap/tests/schema/schema001.phpt b/ext/soap/tests/schema/schema001.phpt
index 9f2b7e5235..cb031e6ac6 100644
--- a/ext/soap/tests/schema/schema001.phpt
+++ b/ext/soap/tests/schema/schema001.phpt
@@ -6,9 +6,9 @@ SOAP XML Schema 1: simpleType/restriction
<?php
include "test_schema.inc";
$schema = <<<EOF
- <simpleType name="testType">
- <restriction base="xsd:int"/>
- </simpleType>
+ <simpleType name="testType">
+ <restriction base="xsd:int"/>
+ </simpleType>
EOF;
test_schema($schema,'type="tns:testType"',123.5);
echo "ok";
diff --git a/ext/soap/tests/schema/schema002.phpt b/ext/soap/tests/schema/schema002.phpt
index 41f3bbe3fa..66485aa205 100644
--- a/ext/soap/tests/schema/schema002.phpt
+++ b/ext/soap/tests/schema/schema002.phpt
@@ -6,12 +6,12 @@ SOAP XML Schema 2: simpleType/restriction (reference to type)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <simpleType name="testType2">
- <restriction base="xsd:int"/>
- </simpleType>
- <simpleType name="testType">
- <restriction base="tns:testType2"/>
- </simpleType>
+ <simpleType name="testType2">
+ <restriction base="xsd:int"/>
+ </simpleType>
+ <simpleType name="testType">
+ <restriction base="tns:testType2"/>
+ </simpleType>
EOF;
test_schema($schema,'type="tns:testType"',123.5);
echo "ok";
diff --git a/ext/soap/tests/schema/schema003.phpt b/ext/soap/tests/schema/schema003.phpt
index 75991001e0..d32dd2434e 100644
--- a/ext/soap/tests/schema/schema003.phpt
+++ b/ext/soap/tests/schema/schema003.phpt
@@ -6,12 +6,12 @@ SOAP XML Schema 3: simpleType/restriction (reference to type, that is not define
<?php
include "test_schema.inc";
$schema = <<<EOF
- <simpleType name="testType">
- <restriction base="tns:testType2"/>
- </simpleType>
- <simpleType name="testType2">
- <restriction base="xsd:int"/>
- </simpleType>
+ <simpleType name="testType">
+ <restriction base="tns:testType2"/>
+ </simpleType>
+ <simpleType name="testType2">
+ <restriction base="xsd:int"/>
+ </simpleType>
EOF;
test_schema($schema,'type="tns:testType"',123.5);
echo "ok";
diff --git a/ext/soap/tests/schema/schema004.phpt b/ext/soap/tests/schema/schema004.phpt
index 93ed1d17f1..b930e40b4c 100644
--- a/ext/soap/tests/schema/schema004.phpt
+++ b/ext/soap/tests/schema/schema004.phpt
@@ -8,9 +8,9 @@ precision=14
<?php
include "test_schema.inc";
$schema = <<<EOF
- <simpleType name="testType">
- <restriction base="tns:testType2"/>
- </simpleType>
+ <simpleType name="testType">
+ <restriction base="tns:testType2"/>
+ </simpleType>
EOF;
test_schema($schema,'type="tns:testType"',123.5);
echo "ok";
diff --git a/ext/soap/tests/schema/schema005.phpt b/ext/soap/tests/schema/schema005.phpt
index 1db0c62f99..ddfa92555b 100644
--- a/ext/soap/tests/schema/schema005.phpt
+++ b/ext/soap/tests/schema/schema005.phpt
@@ -6,13 +6,13 @@ SOAP XML Schema 5: simpleType/restriction (inline type)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <simpleType name="testType">
- <restriction>
- <simpleType name="testType2">
- <restriction base="xsd:int"/>
- </simpleType>
- </restriction>
- </simpleType>
+ <simpleType name="testType">
+ <restriction>
+ <simpleType name="testType2">
+ <restriction base="xsd:int"/>
+ </simpleType>
+ </restriction>
+ </simpleType>
EOF;
test_schema($schema,'type="tns:testType"',123.5);
echo "ok";
diff --git a/ext/soap/tests/schema/schema006.phpt b/ext/soap/tests/schema/schema006.phpt
index e41f27545b..9255626581 100644
--- a/ext/soap/tests/schema/schema006.phpt
+++ b/ext/soap/tests/schema/schema006.phpt
@@ -6,14 +6,14 @@ SOAP XML Schema 6: simpleType/restriction (referenced by ellement)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <simpleType name="testType">
- <restriction>
- <simpleType name="testType2">
- <restriction base="xsd:int"/>
- </simpleType>
- </restriction>
- </simpleType>
- <element name="testElement" type="tns:testType"/>
+ <simpleType name="testType">
+ <restriction>
+ <simpleType name="testType2">
+ <restriction base="xsd:int"/>
+ </simpleType>
+ </restriction>
+ </simpleType>
+ <element name="testElement" type="tns:testType"/>
EOF;
test_schema($schema,'element="tns:testElement"',123.5);
echo "ok";
diff --git a/ext/soap/tests/schema/schema007.phpt b/ext/soap/tests/schema/schema007.phpt
index fd93c7aa8e..bf088e7b2d 100644
--- a/ext/soap/tests/schema/schema007.phpt
+++ b/ext/soap/tests/schema/schema007.phpt
@@ -6,14 +6,14 @@ SOAP XML Schema 7: simpleType/restriction (referenced by ellement)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <element name="testElement" type="tns:testType"/>
- <simpleType name="testType">
- <restriction>
- <simpleType name="testType2">
- <restriction base="xsd:int"/>
- </simpleType>
- </restriction>
- </simpleType>
+ <element name="testElement" type="tns:testType"/>
+ <simpleType name="testType">
+ <restriction>
+ <simpleType name="testType2">
+ <restriction base="xsd:int"/>
+ </simpleType>
+ </restriction>
+ </simpleType>
EOF;
test_schema($schema,'element="tns:testElement"',123.5);
echo "ok";
diff --git a/ext/soap/tests/schema/schema008.phpt b/ext/soap/tests/schema/schema008.phpt
index 7d8a440dd9..3a9b998580 100644
--- a/ext/soap/tests/schema/schema008.phpt
+++ b/ext/soap/tests/schema/schema008.phpt
@@ -7,13 +7,13 @@ SOAP XML Schema 8: simpleType/restriction (anonymous, inside an ellement)
include "test_schema.inc";
$schema = <<<EOF
<element name="testElement">
- <simpleType>
- <restriction>
- <simpleType name="testType2">
- <restriction base="xsd:int"/>
- </simpleType>
- </restriction>
- </simpleType>
+ <simpleType>
+ <restriction>
+ <simpleType name="testType2">
+ <restriction base="xsd:int"/>
+ </simpleType>
+ </restriction>
+ </simpleType>
</element>
EOF;
test_schema($schema,'element="tns:testElement"',123.5);
diff --git a/ext/soap/tests/schema/schema009.phpt b/ext/soap/tests/schema/schema009.phpt
index f7d10242cc..2de815f455 100644
--- a/ext/soap/tests/schema/schema009.phpt
+++ b/ext/soap/tests/schema/schema009.phpt
@@ -6,9 +6,9 @@ SOAP XML Schema 9: simpleType/list (as string)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <simpleType name="testType">
- <list itemType="token"/>
- </simpleType>
+ <simpleType name="testType">
+ <list itemType="token"/>
+ </simpleType>
EOF;
test_schema($schema,'type="tns:testType"',"one two");
echo "ok";
diff --git a/ext/soap/tests/schema/schema010.phpt b/ext/soap/tests/schema/schema010.phpt
index 49136b9fe4..b50a5eeb97 100644
--- a/ext/soap/tests/schema/schema010.phpt
+++ b/ext/soap/tests/schema/schema010.phpt
@@ -6,9 +6,9 @@ SOAP XML Schema 10: simpleType/list (as array)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <simpleType name="testType">
- <list itemType="token"/>
- </simpleType>
+ <simpleType name="testType">
+ <list itemType="token"/>
+ </simpleType>
EOF;
test_schema($schema,'type="tns:testType"',array("one","two"));
echo "ok";
diff --git a/ext/soap/tests/schema/schema011.phpt b/ext/soap/tests/schema/schema011.phpt
index 8296311a46..fca39291f3 100644
--- a/ext/soap/tests/schema/schema011.phpt
+++ b/ext/soap/tests/schema/schema011.phpt
@@ -6,13 +6,13 @@ SOAP XML Schema 11: simpleType/list (inline type) (as string)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <simpleType name="testType">
- <list>
- <simpleType>
- <restriction base="int"/>
- </simpleType>
- </list>
- </simpleType>
+ <simpleType name="testType">
+ <list>
+ <simpleType>
+ <restriction base="int"/>
+ </simpleType>
+ </list>
+ </simpleType>
EOF;
test_schema($schema,'type="tns:testType"',"123 456.7");
echo "ok";
diff --git a/ext/soap/tests/schema/schema012.phpt b/ext/soap/tests/schema/schema012.phpt
index 1d542d81d8..d947980c00 100644
--- a/ext/soap/tests/schema/schema012.phpt
+++ b/ext/soap/tests/schema/schema012.phpt
@@ -6,13 +6,13 @@ SOAP XML Schema 12: simpleType/list (inline type) (as array)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <simpleType name="testType">
- <list>
- <simpleType>
- <restriction base="int"/>
- </simpleType>
- </list>
- </simpleType>
+ <simpleType name="testType">
+ <list>
+ <simpleType>
+ <restriction base="int"/>
+ </simpleType>
+ </list>
+ </simpleType>
EOF;
test_schema($schema,'type="tns:testType"',array(123,456.7));
echo "ok";
diff --git a/ext/soap/tests/schema/schema013.phpt b/ext/soap/tests/schema/schema013.phpt
index 4794d2d0f1..9c93ae4d2e 100644
--- a/ext/soap/tests/schema/schema013.phpt
+++ b/ext/soap/tests/schema/schema013.phpt
@@ -6,9 +6,9 @@ SOAP XML Schema 13: simpleType/union
<?php
include "test_schema.inc";
$schema = <<<EOF
- <simpleType name="testType">
- <union memberTypes="string int float"/>
- </simpleType>
+ <simpleType name="testType">
+ <union memberTypes="string int float"/>
+ </simpleType>
EOF;
test_schema($schema,'type="tns:testType"',"str");
echo "ok";
diff --git a/ext/soap/tests/schema/schema014.phpt b/ext/soap/tests/schema/schema014.phpt
index 3dab5f350b..b2639fc1e2 100644
--- a/ext/soap/tests/schema/schema014.phpt
+++ b/ext/soap/tests/schema/schema014.phpt
@@ -8,9 +8,9 @@ precision=14
<?php
include "test_schema.inc";
$schema = <<<EOF
- <simpleType name="testType">
- <union memberTypes="string int float"/>
- </simpleType>
+ <simpleType name="testType">
+ <union memberTypes="string int float"/>
+ </simpleType>
EOF;
test_schema($schema,'type="tns:testType"',123.5);
echo "ok";
diff --git a/ext/soap/tests/schema/schema015.phpt b/ext/soap/tests/schema/schema015.phpt
index fe9b96b8cf..6f280e78a9 100644
--- a/ext/soap/tests/schema/schema015.phpt
+++ b/ext/soap/tests/schema/schema015.phpt
@@ -6,19 +6,19 @@ SOAP XML Schema 15: simpleType/union (inline type)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <simpleType name="testType">
- <union>
- <simpleType>
- <restriction base="string"/>
- </simpleType>
- <simpleType>
- <restriction base="int"/>
- </simpleType>
- <simpleType>
- <restriction base="float"/>
- </simpleType>
- </union>
- </simpleType>
+ <simpleType name="testType">
+ <union>
+ <simpleType>
+ <restriction base="string"/>
+ </simpleType>
+ <simpleType>
+ <restriction base="int"/>
+ </simpleType>
+ <simpleType>
+ <restriction base="float"/>
+ </simpleType>
+ </union>
+ </simpleType>
EOF;
test_schema($schema,'type="tns:testType"',"str");
echo "ok";
diff --git a/ext/soap/tests/schema/schema016.phpt b/ext/soap/tests/schema/schema016.phpt
index 11e9436bcb..4878b710c5 100644
--- a/ext/soap/tests/schema/schema016.phpt
+++ b/ext/soap/tests/schema/schema016.phpt
@@ -8,19 +8,19 @@ precision=14
<?php
include "test_schema.inc";
$schema = <<<EOF
- <simpleType name="testType">
- <union>
- <simpleType>
- <restriction base="string"/>
- </simpleType>
- <simpleType>
- <restriction base="int"/>
- </simpleType>
- <simpleType>
- <restriction base="float"/>
- </simpleType>
- </union>
- </simpleType>
+ <simpleType name="testType">
+ <union>
+ <simpleType>
+ <restriction base="string"/>
+ </simpleType>
+ <simpleType>
+ <restriction base="int"/>
+ </simpleType>
+ <simpleType>
+ <restriction base="float"/>
+ </simpleType>
+ </union>
+ </simpleType>
EOF;
test_schema($schema,'type="tns:testType"',123.5);
echo "ok";
diff --git a/ext/soap/tests/schema/schema017.phpt b/ext/soap/tests/schema/schema017.phpt
index 6689c363ed..25a1da054a 100644
--- a/ext/soap/tests/schema/schema017.phpt
+++ b/ext/soap/tests/schema/schema017.phpt
@@ -8,16 +8,16 @@ precision=14
<?php
include "test_schema.inc";
$schema = <<<EOF
- <simpleType name="testType">
- <union>
- <simpleType>
- <restriction base="float"/>
- </simpleType>
- <simpleType>
- <list itemType="int"/>
- </simpleType>
- </union>
- </simpleType>
+ <simpleType name="testType">
+ <union>
+ <simpleType>
+ <restriction base="float"/>
+ </simpleType>
+ <simpleType>
+ <list itemType="int"/>
+ </simpleType>
+ </union>
+ </simpleType>
EOF;
test_schema($schema,'type="tns:testType"',123.5);
echo "ok";
diff --git a/ext/soap/tests/schema/schema018.phpt b/ext/soap/tests/schema/schema018.phpt
index 0f3e8b84ac..8b85ea8af3 100644
--- a/ext/soap/tests/schema/schema018.phpt
+++ b/ext/soap/tests/schema/schema018.phpt
@@ -6,16 +6,16 @@ SOAP XML Schema 18: union with list
<?php
include "test_schema.inc";
$schema = <<<EOF
- <simpleType name="testType">
- <union>
- <simpleType>
- <restriction base="float"/>
- </simpleType>
- <simpleType>
- <list itemType="int"/>
- </simpleType>
- </union>
- </simpleType>
+ <simpleType name="testType">
+ <union>
+ <simpleType>
+ <restriction base="float"/>
+ </simpleType>
+ <simpleType>
+ <list itemType="int"/>
+ </simpleType>
+ </union>
+ </simpleType>
EOF;
test_schema($schema,'type="tns:testType"',"123.5");
echo "ok";
diff --git a/ext/soap/tests/schema/schema019.phpt b/ext/soap/tests/schema/schema019.phpt
index 0d2d753764..afcae9b1b6 100644
--- a/ext/soap/tests/schema/schema019.phpt
+++ b/ext/soap/tests/schema/schema019.phpt
@@ -6,16 +6,16 @@ SOAP XML Schema 19: union with list
<?php
include "test_schema.inc";
$schema = <<<EOF
- <simpleType name="testType">
- <union>
- <simpleType>
- <restriction base="float"/>
- </simpleType>
- <simpleType>
- <list itemType="int"/>
- </simpleType>
- </union>
- </simpleType>
+ <simpleType name="testType">
+ <union>
+ <simpleType>
+ <restriction base="float"/>
+ </simpleType>
+ <simpleType>
+ <list itemType="int"/>
+ </simpleType>
+ </union>
+ </simpleType>
EOF;
test_schema($schema,'type="tns:testType"',"123.5 456.7");
echo "ok";
diff --git a/ext/soap/tests/schema/schema020.phpt b/ext/soap/tests/schema/schema020.phpt
index 344757a327..e8ebf500e1 100644
--- a/ext/soap/tests/schema/schema020.phpt
+++ b/ext/soap/tests/schema/schema020.phpt
@@ -8,16 +8,16 @@ precision=14
<?php
include "test_schema.inc";
$schema = <<<EOF
- <simpleType name="testType">
- <union>
- <simpleType>
- <restriction base="float"/>
- </simpleType>
- <simpleType>
- <list itemType="int"/>
- </simpleType>
- </union>
- </simpleType>
+ <simpleType name="testType">
+ <union>
+ <simpleType>
+ <restriction base="float"/>
+ </simpleType>
+ <simpleType>
+ <list itemType="int"/>
+ </simpleType>
+ </union>
+ </simpleType>
EOF;
test_schema($schema,'type="tns:testType"',array(123.5,456.7));
echo "ok";
diff --git a/ext/soap/tests/schema/schema021.phpt b/ext/soap/tests/schema/schema021.phpt
index 0628c6b3b8..18e1394775 100644
--- a/ext/soap/tests/schema/schema021.phpt
+++ b/ext/soap/tests/schema/schema021.phpt
@@ -6,13 +6,13 @@ SOAP XML Schema 21: list of unions
<?php
include "test_schema.inc";
$schema = <<<EOF
- <simpleType name="testType">
- <list>
- <simpleType>
- <union memberTypes="int float str"/>
- </simpleType>
- </list>
- </simpleType>
+ <simpleType name="testType">
+ <list>
+ <simpleType>
+ <union memberTypes="int float str"/>
+ </simpleType>
+ </list>
+ </simpleType>
EOF;
test_schema($schema,'type="tns:testType"',"123 123.5 456.7 str");
echo "ok";
diff --git a/ext/soap/tests/schema/schema022.phpt b/ext/soap/tests/schema/schema022.phpt
index a8f5bb9cad..45bcd29c6e 100644
--- a/ext/soap/tests/schema/schema022.phpt
+++ b/ext/soap/tests/schema/schema022.phpt
@@ -8,13 +8,13 @@ precision=14
<?php
include "test_schema.inc";
$schema = <<<EOF
- <simpleType name="testType">
- <list>
- <simpleType>
- <union memberTypes="int float str"/>
- </simpleType>
- </list>
- </simpleType>
+ <simpleType name="testType">
+ <list>
+ <simpleType>
+ <union memberTypes="int float str"/>
+ </simpleType>
+ </list>
+ </simpleType>
EOF;
test_schema($schema,'type="tns:testType"',array(123,123.5,'str'));
echo "ok";
diff --git a/ext/soap/tests/schema/schema023.phpt b/ext/soap/tests/schema/schema023.phpt
index 550bacfe84..31bfe9ae6f 100644
--- a/ext/soap/tests/schema/schema023.phpt
+++ b/ext/soap/tests/schema/schema023.phpt
@@ -6,13 +6,13 @@ SOAP XML Schema 23: SOAP 1.1 Array
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <complexContent>
- <restriction base="SOAP-ENC:Array">
- <attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="int[]"/>
- </restriction>
+ <complexType name="testType">
+ <complexContent>
+ <restriction base="SOAP-ENC:Array">
+ <attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="int[]"/>
+ </restriction>
</complexContent>
- </complexType>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',array(123,123.5));
echo "ok";
diff --git a/ext/soap/tests/schema/schema024.phpt b/ext/soap/tests/schema/schema024.phpt
index af836d1ffb..cd58f7efb5 100644
--- a/ext/soap/tests/schema/schema024.phpt
+++ b/ext/soap/tests/schema/schema024.phpt
@@ -6,15 +6,15 @@ SOAP XML Schema 24: SOAP 1.1 Array (second way)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <complexContent>
- <restriction base="SOAP-ENC:Array">
- <all>
- <element name="x_item" type="int" maxOccurs="unbounded"/>
- </all>
- </restriction>
+ <complexType name="testType">
+ <complexContent>
+ <restriction base="SOAP-ENC:Array">
+ <all>
+ <element name="x_item" type="int" maxOccurs="unbounded"/>
+ </all>
+ </restriction>
</complexContent>
- </complexType>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',array(123,123.5));
echo "ok";
diff --git a/ext/soap/tests/schema/schema025.phpt b/ext/soap/tests/schema/schema025.phpt
index 748e45804d..5237e8979e 100644
--- a/ext/soap/tests/schema/schema025.phpt
+++ b/ext/soap/tests/schema/schema025.phpt
@@ -6,14 +6,14 @@ SOAP XML Schema 25: SOAP 1.2 Array
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <complexContent>
- <restriction base="enc12:Array" xmlns:enc12="http://www.w3.org/2003/05/soap-encoding">
- <attribute ref="enc12:itemType" wsdl:itemType="int"/>
- <attribute ref="enc12:arraySize" wsdl:arraySize="*"/>
- </restriction>
+ <complexType name="testType">
+ <complexContent>
+ <restriction base="enc12:Array" xmlns:enc12="http://www.w3.org/2003/05/soap-encoding">
+ <attribute ref="enc12:itemType" wsdl:itemType="int"/>
+ <attribute ref="enc12:arraySize" wsdl:arraySize="*"/>
+ </restriction>
</complexContent>
- </complexType>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',array(123,123.5));
echo "ok";
diff --git a/ext/soap/tests/schema/schema026.phpt b/ext/soap/tests/schema/schema026.phpt
index e17b5ac60b..983ee8e5ef 100644
--- a/ext/soap/tests/schema/schema026.phpt
+++ b/ext/soap/tests/schema/schema026.phpt
@@ -6,15 +6,15 @@ SOAP XML Schema 26: SOAP 1.2 Array (second way)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <complexContent>
- <restriction base="enc12:Array" xmlns:enc12="http://www.w3.org/2003/05/soap-encoding">
- <all>
- <element name="x_item" type="int" maxOccurs="unbounded"/>
- </all>
- </restriction>
+ <complexType name="testType">
+ <complexContent>
+ <restriction base="enc12:Array" xmlns:enc12="http://www.w3.org/2003/05/soap-encoding">
+ <all>
+ <element name="x_item" type="int" maxOccurs="unbounded"/>
+ </all>
+ </restriction>
</complexContent>
- </complexType>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',array(123,123.5));
echo "ok";
diff --git a/ext/soap/tests/schema/schema027.phpt b/ext/soap/tests/schema/schema027.phpt
index e3b382ebe9..39ca3dc3cd 100644
--- a/ext/soap/tests/schema/schema027.phpt
+++ b/ext/soap/tests/schema/schema027.phpt
@@ -6,13 +6,13 @@ SOAP XML Schema 27: SOAP 1.1 Multidimensional array
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <complexContent>
- <restriction base="SOAP-ENC:Array">
- <attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="int[,]"/>
- </restriction>
+ <complexType name="testType">
+ <complexContent>
+ <restriction base="SOAP-ENC:Array">
+ <attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="int[,]"/>
+ </restriction>
</complexContent>
- </complexType>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',array(array(123),array(123.5)));
echo "ok";
diff --git a/ext/soap/tests/schema/schema028.phpt b/ext/soap/tests/schema/schema028.phpt
index 7cc4ba568a..84a059b602 100644
--- a/ext/soap/tests/schema/schema028.phpt
+++ b/ext/soap/tests/schema/schema028.phpt
@@ -6,14 +6,14 @@ SOAP XML Schema 28: SOAP 1.2 Multidimensional array
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <complexContent>
- <restriction base="enc12:Array" xmlns:enc12="http://www.w3.org/2003/05/soap-encoding">
- <attribute ref="enc12:itemType" wsdl:itemType="int"/>
- <attribute ref="enc12:arraySize" wsdl:arraySize="* 1"/>
- </restriction>
+ <complexType name="testType">
+ <complexContent>
+ <restriction base="enc12:Array" xmlns:enc12="http://www.w3.org/2003/05/soap-encoding">
+ <attribute ref="enc12:itemType" wsdl:itemType="int"/>
+ <attribute ref="enc12:arraySize" wsdl:arraySize="* 1"/>
+ </restriction>
</complexContent>
- </complexType>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',array(array(123),array(123.5)));
echo "ok";
diff --git a/ext/soap/tests/schema/schema029.phpt b/ext/soap/tests/schema/schema029.phpt
index 2081affc6d..70f1b21e91 100644
--- a/ext/soap/tests/schema/schema029.phpt
+++ b/ext/soap/tests/schema/schema029.phpt
@@ -6,16 +6,16 @@ SOAP XML Schema 29: SOAP 1.2 Multidimensional array (second way)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <complexContent>
- <restriction base="enc12:Array" xmlns:enc12="http://www.w3.org/2003/05/soap-encoding">
- <all>
- <element name="x_item" type="int" maxOccurs="unbounded"/>
- </all>
- <attribute ref="enc12:arraySize" wsdl:arraySize="* 1"/>
- </restriction>
+ <complexType name="testType">
+ <complexContent>
+ <restriction base="enc12:Array" xmlns:enc12="http://www.w3.org/2003/05/soap-encoding">
+ <all>
+ <element name="x_item" type="int" maxOccurs="unbounded"/>
+ </all>
+ <attribute ref="enc12:arraySize" wsdl:arraySize="* 1"/>
+ </restriction>
</complexContent>
- </complexType>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',array(array(123),array(123.5)));
echo "ok";
diff --git a/ext/soap/tests/schema/schema030.phpt b/ext/soap/tests/schema/schema030.phpt
index e468613916..1047119295 100644
--- a/ext/soap/tests/schema/schema030.phpt
+++ b/ext/soap/tests/schema/schema030.phpt
@@ -6,12 +6,12 @@ SOAP XML Schema 30: Structure (sequence)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <sequence>
- <element name="int" type="int"/>
- <element name="str" type="string"/>
- </sequence>
- </complexType>
+ <complexType name="testType">
+ <sequence>
+ <element name="int" type="int"/>
+ <element name="str" type="string"/>
+ </sequence>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',(object)array("str"=>"str","int"=>123.5));
echo "ok";
diff --git a/ext/soap/tests/schema/schema031.phpt b/ext/soap/tests/schema/schema031.phpt
index 479abfee9d..4b03358372 100644
--- a/ext/soap/tests/schema/schema031.phpt
+++ b/ext/soap/tests/schema/schema031.phpt
@@ -6,12 +6,12 @@ SOAP XML Schema 31: Structure (all)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <all>
- <element name="int" type="int"/>
- <element name="str" type="string"/>
- </all>
- </complexType>
+ <complexType name="testType">
+ <all>
+ <element name="int" type="int"/>
+ <element name="str" type="string"/>
+ </all>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',(object)array("str"=>"str","int"=>123.5));
echo "ok";
diff --git a/ext/soap/tests/schema/schema032.phpt b/ext/soap/tests/schema/schema032.phpt
index 47b4af121c..397636083c 100644
--- a/ext/soap/tests/schema/schema032.phpt
+++ b/ext/soap/tests/schema/schema032.phpt
@@ -6,12 +6,12 @@ SOAP XML Schema 32: Structure (choice)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <choice>
- <element name="int" type="int"/>
- <element name="str" type="string"/>
- </choice>
- </complexType>
+ <complexType name="testType">
+ <choice>
+ <element name="int" type="int"/>
+ <element name="str" type="string"/>
+ </choice>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',(object)array("int"=>123.5));
echo "ok";
diff --git a/ext/soap/tests/schema/schema033.phpt b/ext/soap/tests/schema/schema033.phpt
index b504bc077a..7c1ce0fc8a 100644
--- a/ext/soap/tests/schema/schema033.phpt
+++ b/ext/soap/tests/schema/schema033.phpt
@@ -6,17 +6,17 @@ SOAP XML Schema 33: Nested complex types
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType2">
- <sequence>
- <element name="int" type="int"/>
- </sequence>
- </complexType>
- <complexType name="testType">
- <sequence>
- <element name="int" type="int"/>
- <element name="nest" type="tns:testType2"/>
- </sequence>
- </complexType>
+ <complexType name="testType2">
+ <sequence>
+ <element name="int" type="int"/>
+ </sequence>
+ </complexType>
+ <complexType name="testType">
+ <sequence>
+ <element name="int" type="int"/>
+ <element name="nest" type="tns:testType2"/>
+ </sequence>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',(object)array("int"=>123.5,"nest"=>array("int"=>123.5)));
echo "ok";
diff --git a/ext/soap/tests/schema/schema034.phpt b/ext/soap/tests/schema/schema034.phpt
index a83d6ea846..42536d89c3 100644
--- a/ext/soap/tests/schema/schema034.phpt
+++ b/ext/soap/tests/schema/schema034.phpt
@@ -6,18 +6,18 @@ SOAP XML Schema 34: Nested complex types (element ref)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <element name="testType2" type="tns:testType2"/>
- <complexType name="testType2">
- <sequence>
- <element name="int" type="int"/>
- </sequence>
- </complexType>
- <complexType name="testType">
- <sequence>
- <element name="int" type="int"/>
- <element ref="tns:testType2"/>
- </sequence>
- </complexType>
+ <element name="testType2" type="tns:testType2"/>
+ <complexType name="testType2">
+ <sequence>
+ <element name="int" type="int"/>
+ </sequence>
+ </complexType>
+ <complexType name="testType">
+ <sequence>
+ <element name="int" type="int"/>
+ <element ref="tns:testType2"/>
+ </sequence>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',(object)array("int"=>123.5,"testType2"=>array("int"=>123.5)));
echo "ok";
diff --git a/ext/soap/tests/schema/schema035.phpt b/ext/soap/tests/schema/schema035.phpt
index 8974ed00c5..d62dfbc98e 100644
--- a/ext/soap/tests/schema/schema035.phpt
+++ b/ext/soap/tests/schema/schema035.phpt
@@ -6,19 +6,19 @@ SOAP XML Schema 35: Nested complex types (element ref + anonymous type)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <element name="testType2">
- <complexType>
- <sequence>
- <element name="int" type="int"/>
- </sequence>
- </complexType>
- </element>
- <complexType name="testType">
- <sequence>
- <element name="int" type="int"/>
- <element ref="tns:testType2"/>
- </sequence>
- </complexType>
+ <element name="testType2">
+ <complexType>
+ <sequence>
+ <element name="int" type="int"/>
+ </sequence>
+ </complexType>
+ </element>
+ <complexType name="testType">
+ <sequence>
+ <element name="int" type="int"/>
+ <element ref="tns:testType2"/>
+ </sequence>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',(object)array("int"=>123.5,"testType2"=>array("int"=>123.5)));
echo "ok";
diff --git a/ext/soap/tests/schema/schema036.phpt b/ext/soap/tests/schema/schema036.phpt
index 9d6dac4534..12c5c40e0b 100644
--- a/ext/soap/tests/schema/schema036.phpt
+++ b/ext/soap/tests/schema/schema036.phpt
@@ -6,18 +6,18 @@ SOAP XML Schema 36: Nested complex types (inline)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <sequence>
- <element name="int" type="int"/>
- <element name="testType2">
- <complexType>
- <sequence>
- <element name="int" type="int"/>
- </sequence>
- </complexType>
- </element>
- </sequence>
- </complexType>
+ <complexType name="testType">
+ <sequence>
+ <element name="int" type="int"/>
+ <element name="testType2">
+ <complexType>
+ <sequence>
+ <element name="int" type="int"/>
+ </sequence>
+ </complexType>
+ </element>
+ </sequence>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',(object)array("int"=>123.5,"testType2"=>array("int"=>123.5)));
echo "ok";
diff --git a/ext/soap/tests/schema/schema037.phpt b/ext/soap/tests/schema/schema037.phpt
index 4e59981fc9..dbc5dc38c8 100644
--- a/ext/soap/tests/schema/schema037.phpt
+++ b/ext/soap/tests/schema/schema037.phpt
@@ -6,12 +6,12 @@ SOAP XML Schema 37: Structure with attributes
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <sequence>
- <element name="str" type="string"/>
- </sequence>
- <attribute name="int" type="int"/>
- </complexType>
+ <complexType name="testType">
+ <sequence>
+ <element name="str" type="string"/>
+ </sequence>
+ <attribute name="int" type="int"/>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',(object)array("str"=>"str","int"=>123.5));
echo "ok";
diff --git a/ext/soap/tests/schema/schema038.phpt b/ext/soap/tests/schema/schema038.phpt
index 2d37e89e0b..70b5b207ee 100644
--- a/ext/soap/tests/schema/schema038.phpt
+++ b/ext/soap/tests/schema/schema038.phpt
@@ -6,13 +6,13 @@ SOAP XML Schema 38: Structure with attributes (ref)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <sequence>
- <element name="str" type="string"/>
- </sequence>
- <attribute ref="tns:int"/>
- </complexType>
- <attribute name="int" type="int"/>
+ <complexType name="testType">
+ <sequence>
+ <element name="str" type="string"/>
+ </sequence>
+ <attribute ref="tns:int"/>
+ </complexType>
+ <attribute name="int" type="int"/>
EOF;
test_schema($schema,'type="tns:testType"',(object)array("str"=>"str","int"=>123.5));
echo "ok";
diff --git a/ext/soap/tests/schema/schema039.phpt b/ext/soap/tests/schema/schema039.phpt
index 0b7ef5afc4..5b3f454bf9 100644
--- a/ext/soap/tests/schema/schema039.phpt
+++ b/ext/soap/tests/schema/schema039.phpt
@@ -6,15 +6,15 @@ SOAP XML Schema 39: Structure with attributes (attributeGroup)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <sequence>
- <element name="str" type="string"/>
- </sequence>
- <attributeGroup ref="tns:intGroup"/>
- </complexType>
- <attributeGroup name="intGroup">
- <attribute name="int" type="int"/>
- </attributeGroup>
+ <complexType name="testType">
+ <sequence>
+ <element name="str" type="string"/>
+ </sequence>
+ <attributeGroup ref="tns:intGroup"/>
+ </complexType>
+ <attributeGroup name="intGroup">
+ <attribute name="int" type="int"/>
+ </attributeGroup>
EOF;
test_schema($schema,'type="tns:testType"',(object)array("str"=>"str","int"=>123.5));
echo "ok";
diff --git a/ext/soap/tests/schema/schema040.phpt b/ext/soap/tests/schema/schema040.phpt
index f7ddc04546..51bcd776e1 100644
--- a/ext/soap/tests/schema/schema040.phpt
+++ b/ext/soap/tests/schema/schema040.phpt
@@ -6,16 +6,16 @@ SOAP XML Schema 40: Structure with attributes (inline types)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <sequence>
- <element name="str" type="string"/>
- </sequence>
- <attribute name="int">
- <simpleType>
- <restriction base="int"/>
- </simpleType>
- </attribute>
- </complexType>
+ <complexType name="testType">
+ <sequence>
+ <element name="str" type="string"/>
+ </sequence>
+ <attribute name="int">
+ <simpleType>
+ <restriction base="int"/>
+ </simpleType>
+ </attribute>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',(object)array("str"=>"str","int"=>123.5));
echo "ok";
diff --git a/ext/soap/tests/schema/schema041.phpt b/ext/soap/tests/schema/schema041.phpt
index 1264cf5c90..4613f15729 100644
--- a/ext/soap/tests/schema/schema041.phpt
+++ b/ext/soap/tests/schema/schema041.phpt
@@ -6,15 +6,15 @@ SOAP XML Schema 41: Structure (group)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <group ref="tns:testGroup"/>
- </complexType>
- <group name="testGroup">
- <sequence>
- <element name="int" type="int"/>
- <element name="str" type="string"/>
- </sequence>
- </group>
+ <complexType name="testType">
+ <group ref="tns:testGroup"/>
+ </complexType>
+ <group name="testGroup">
+ <sequence>
+ <element name="int" type="int"/>
+ <element name="str" type="string"/>
+ </sequence>
+ </group>
EOF;
test_schema($schema,'type="tns:testType"',(object)array("str"=>"str","int"=>123.5));
echo "ok";
diff --git a/ext/soap/tests/schema/schema042.phpt b/ext/soap/tests/schema/schema042.phpt
index a8aa8857d9..c0a938aa27 100644
--- a/ext/soap/tests/schema/schema042.phpt
+++ b/ext/soap/tests/schema/schema042.phpt
@@ -6,13 +6,13 @@ SOAP XML Schema 42: Extension of simple type
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <simpleContent>
- <extension base="int">
- <attribute name="int" type="int"/>
- </extension>
- </simpleContent>
- </complexType>
+ <complexType name="testType">
+ <simpleContent>
+ <extension base="int">
+ <attribute name="int" type="int"/>
+ </extension>
+ </simpleContent>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',(object)array("_"=>123.5,"int"=>123.5));
echo "ok";
diff --git a/ext/soap/tests/schema/schema043.phpt b/ext/soap/tests/schema/schema043.phpt
index 08c2996363..cc628eefea 100644
--- a/ext/soap/tests/schema/schema043.phpt
+++ b/ext/soap/tests/schema/schema043.phpt
@@ -6,20 +6,20 @@ SOAP XML Schema 43: Extension of simple type (2)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType2">
- <simpleContent>
- <extension base="int">
- <attribute name="int" type="int"/>
- </extension>
- </simpleContent>
- </complexType>
- <complexType name="testType">
- <simpleContent>
- <extension base="tns:testType2">
- <attribute name="int2" type="int"/>
- </extension>
- </simpleContent>
- </complexType>
+ <complexType name="testType2">
+ <simpleContent>
+ <extension base="int">
+ <attribute name="int" type="int"/>
+ </extension>
+ </simpleContent>
+ </complexType>
+ <complexType name="testType">
+ <simpleContent>
+ <extension base="tns:testType2">
+ <attribute name="int2" type="int"/>
+ </extension>
+ </simpleContent>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',(object)array("_"=>123.5,"int"=>123.5,"int2"=>123.5));
echo "ok";
diff --git a/ext/soap/tests/schema/schema044.phpt b/ext/soap/tests/schema/schema044.phpt
index 8fc0705518..3158d46049 100644
--- a/ext/soap/tests/schema/schema044.phpt
+++ b/ext/soap/tests/schema/schema044.phpt
@@ -6,13 +6,13 @@ SOAP XML Schema 44: Restriction of simple type
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <simpleContent>
- <restriction base="int">
- <attribute name="int" type="int"/>
- </restriction>
- </simpleContent>
- </complexType>
+ <complexType name="testType">
+ <simpleContent>
+ <restriction base="int">
+ <attribute name="int" type="int"/>
+ </restriction>
+ </simpleContent>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',(object)array("_"=>123.5,"int"=>123.5));
echo "ok";
diff --git a/ext/soap/tests/schema/schema045.phpt b/ext/soap/tests/schema/schema045.phpt
index 346a929d85..8055b39914 100644
--- a/ext/soap/tests/schema/schema045.phpt
+++ b/ext/soap/tests/schema/schema045.phpt
@@ -6,20 +6,20 @@ SOAP XML Schema 45: Restriction of simple type (2)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType2">
- <simpleContent>
- <extension base="int">
- <attribute name="int" type="int"/>
- </extension>
- </simpleContent>
- </complexType>
- <complexType name="testType">
- <simpleContent>
- <restriction base="tns:testType2">
- <attribute name="int2" type="int"/>
- </restriction>
- </simpleContent>
- </complexType>
+ <complexType name="testType2">
+ <simpleContent>
+ <extension base="int">
+ <attribute name="int" type="int"/>
+ </extension>
+ </simpleContent>
+ </complexType>
+ <complexType name="testType">
+ <simpleContent>
+ <restriction base="tns:testType2">
+ <attribute name="int2" type="int"/>
+ </restriction>
+ </simpleContent>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',(object)array("_"=>123.5,"int"=>123.5,"int2"=>123.5));
echo "ok";
diff --git a/ext/soap/tests/schema/schema046.phpt b/ext/soap/tests/schema/schema046.phpt
index 3f9d03afad..9f3efd79ca 100644
--- a/ext/soap/tests/schema/schema046.phpt
+++ b/ext/soap/tests/schema/schema046.phpt
@@ -6,20 +6,20 @@ SOAP XML Schema 46: Extension of complex type
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType2">
- <simpleContent>
- <extension base="int">
- <attribute name="int" type="int"/>
- </extension>
- </simpleContent>
- </complexType>
- <complexType name="testType">
- <complexContent>
- <extension base="tns:testType2">
- <attribute name="int2" type="int"/>
- </extension>
- </complexContent>
- </complexType>
+ <complexType name="testType2">
+ <simpleContent>
+ <extension base="int">
+ <attribute name="int" type="int"/>
+ </extension>
+ </simpleContent>
+ </complexType>
+ <complexType name="testType">
+ <complexContent>
+ <extension base="tns:testType2">
+ <attribute name="int2" type="int"/>
+ </extension>
+ </complexContent>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',(object)array("_"=>123.5,"int"=>123.5,"int2"=>123.5));
echo "ok";
diff --git a/ext/soap/tests/schema/schema047.phpt b/ext/soap/tests/schema/schema047.phpt
index 1265cfd3a3..a67973eeb0 100644
--- a/ext/soap/tests/schema/schema047.phpt
+++ b/ext/soap/tests/schema/schema047.phpt
@@ -6,18 +6,18 @@ SOAP XML Schema 47: Extension of complex type (2)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType2">
- <sequence>
- <element name="int" type="int"/>
- </sequence>
- </complexType>
- <complexType name="testType">
- <complexContent>
- <extension base="tns:testType2">
- <attribute name="int2" type="int"/>
- </extension>
- </complexContent>
- </complexType>
+ <complexType name="testType2">
+ <sequence>
+ <element name="int" type="int"/>
+ </sequence>
+ </complexType>
+ <complexType name="testType">
+ <complexContent>
+ <extension base="tns:testType2">
+ <attribute name="int2" type="int"/>
+ </extension>
+ </complexContent>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',(object)array("_"=>123.5,"int"=>123.5,"int2"=>123.5));
echo "ok";
diff --git a/ext/soap/tests/schema/schema048.phpt b/ext/soap/tests/schema/schema048.phpt
index 98d4d4be44..c2a372e1d1 100644
--- a/ext/soap/tests/schema/schema048.phpt
+++ b/ext/soap/tests/schema/schema048.phpt
@@ -6,20 +6,20 @@ SOAP XML Schema 48: Restriction of complex type
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType2">
- <simpleContent>
- <extension base="int">
- <attribute name="int" type="int"/>
- </extension>
- </simpleContent>
- </complexType>
- <complexType name="testType">
- <complexContent>
- <restriction base="tns:testType2">
- <attribute name="int2" type="int"/>
- </restriction>
- </complexContent>
- </complexType>
+ <complexType name="testType2">
+ <simpleContent>
+ <extension base="int">
+ <attribute name="int" type="int"/>
+ </extension>
+ </simpleContent>
+ </complexType>
+ <complexType name="testType">
+ <complexContent>
+ <restriction base="tns:testType2">
+ <attribute name="int2" type="int"/>
+ </restriction>
+ </complexContent>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',(object)array("_"=>123.5,"int"=>123.5,"int2"=>123.5));
echo "ok";
diff --git a/ext/soap/tests/schema/schema049.phpt b/ext/soap/tests/schema/schema049.phpt
index 7268a4b67a..84b22fe5e7 100644
--- a/ext/soap/tests/schema/schema049.phpt
+++ b/ext/soap/tests/schema/schema049.phpt
@@ -6,21 +6,21 @@ SOAP XML Schema 49: Restriction of complex type (2)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType2">
- <sequence>
- <element name="int" type="int"/>
- <element name="int2" type="int"/>
- </sequence>
- </complexType>
- <complexType name="testType">
- <complexContent>
- <restriction base="tns:testType2">
- <sequence>
- <element name="int2" type="int"/>
- </sequence>
- </restriction>
- </complexContent>
- </complexType>
+ <complexType name="testType2">
+ <sequence>
+ <element name="int" type="int"/>
+ <element name="int2" type="int"/>
+ </sequence>
+ </complexType>
+ <complexType name="testType">
+ <complexContent>
+ <restriction base="tns:testType2">
+ <sequence>
+ <element name="int2" type="int"/>
+ </sequence>
+ </restriction>
+ </complexContent>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',(object)array("_"=>123.5,"int"=>123.5,"int2"=>123.5));
echo "ok";
diff --git a/ext/soap/tests/schema/schema050.phpt b/ext/soap/tests/schema/schema050.phpt
index 6c735125b7..0bb3d35dc9 100644
--- a/ext/soap/tests/schema/schema050.phpt
+++ b/ext/soap/tests/schema/schema050.phpt
@@ -6,12 +6,12 @@ SOAP XML Schema 50: Array in complex type (maxOccurs > 1, one value)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <sequence>
- <element name="int" type="int"/>
- <element name="int2" type="int" maxOccurs="unbounded"/>
- </sequence>
- </complexType>
+ <complexType name="testType">
+ <sequence>
+ <element name="int" type="int"/>
+ <element name="int2" type="int" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',(object)array("int"=>123.5,"int2"=>123.5));
echo "ok";
diff --git a/ext/soap/tests/schema/schema051.phpt b/ext/soap/tests/schema/schema051.phpt
index 9636399814..0f5ad8b718 100644
--- a/ext/soap/tests/schema/schema051.phpt
+++ b/ext/soap/tests/schema/schema051.phpt
@@ -6,12 +6,12 @@ SOAP XML Schema 51: Array in complex type (maxOccurs > 1, array)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <sequence>
- <element name="int" type="int"/>
- <element name="int2" type="int" maxOccurs="unbounded"/>
- </sequence>
- </complexType>
+ <complexType name="testType">
+ <sequence>
+ <element name="int" type="int"/>
+ <element name="int2" type="int" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',(object)array("int"=>123.5,"int2"=>array(123.5,456.7)));
echo "ok";
diff --git a/ext/soap/tests/schema/schema052.phpt b/ext/soap/tests/schema/schema052.phpt
index 8e7121ae2d..5e30c8287e 100644
--- a/ext/soap/tests/schema/schema052.phpt
+++ b/ext/soap/tests/schema/schema052.phpt
@@ -6,12 +6,12 @@ SOAP XML Schema 52: Array in complex type (maxOccurs > 1, array with one value)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <sequence>
- <element name="int" type="int"/>
- <element name="int2" type="int" maxOccurs="unbounded"/>
- </sequence>
- </complexType>
+ <complexType name="testType">
+ <sequence>
+ <element name="int" type="int"/>
+ <element name="int2" type="int" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',(object)array("int"=>123.5,"int2"=>array(123.5)));
echo "ok";
diff --git a/ext/soap/tests/schema/schema053.phpt b/ext/soap/tests/schema/schema053.phpt
index 8893bf5df3..f276978a4c 100644
--- a/ext/soap/tests/schema/schema053.phpt
+++ b/ext/soap/tests/schema/schema053.phpt
@@ -6,12 +6,12 @@ SOAP XML Schema 52: Array in complex type (maxOccurs > 1, empty array)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <sequence>
- <element name="int" type="int"/>
- <element name="int2" type="int" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- </complexType>
+ <complexType name="testType">
+ <sequence>
+ <element name="int" type="int"/>
+ <element name="int2" type="int" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',(object)array("int"=>123.5,"int2"=>array()));
echo "ok";
diff --git a/ext/soap/tests/schema/schema055.phpt b/ext/soap/tests/schema/schema055.phpt
index 14dbdb7c1d..1a23e2fa6e 100644
--- a/ext/soap/tests/schema/schema055.phpt
+++ b/ext/soap/tests/schema/schema055.phpt
@@ -8,12 +8,12 @@ precision=14
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <complexContent>
- <extension base="apache:Map" xmlns:apache="http://xml.apache.org/xml-soap">
- </extension>
+ <complexType name="testType">
+ <complexContent>
+ <extension base="apache:Map" xmlns:apache="http://xml.apache.org/xml-soap">
+ </extension>
</complexContent>
- </complexType>
+ </complexType>
EOF;
test_schema($schema,'type="testType"',array('a'=>123,'b'=>123.5));
echo "ok";
diff --git a/ext/soap/tests/schema/schema056.phpt b/ext/soap/tests/schema/schema056.phpt
index 1ada78ea2a..d2aac098d0 100644
--- a/ext/soap/tests/schema/schema056.phpt
+++ b/ext/soap/tests/schema/schema056.phpt
@@ -6,13 +6,13 @@ SOAP XML Schema 56: SOAP 1.1 Array (literal encoding)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <complexContent>
- <restriction base="SOAP-ENC:Array">
- <attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="int[]"/>
- </restriction>
+ <complexType name="testType">
+ <complexContent>
+ <restriction base="SOAP-ENC:Array">
+ <attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="int[]"/>
+ </restriction>
</complexContent>
- </complexType>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',array(123,123.5),'rpc','literal');
echo "ok";
diff --git a/ext/soap/tests/schema/schema057.phpt b/ext/soap/tests/schema/schema057.phpt
index 1848b9c24a..13521b2a60 100644
--- a/ext/soap/tests/schema/schema057.phpt
+++ b/ext/soap/tests/schema/schema057.phpt
@@ -6,15 +6,15 @@ SOAP XML Schema 57: SOAP 1.1 Array (second way, literal encoding)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <complexContent>
- <restriction base="SOAP-ENC:Array">
- <all>
- <element name="x_item" type="int" maxOccurs="unbounded"/>
- </all>
- </restriction>
+ <complexType name="testType">
+ <complexContent>
+ <restriction base="SOAP-ENC:Array">
+ <all>
+ <element name="x_item" type="int" maxOccurs="unbounded"/>
+ </all>
+ </restriction>
</complexContent>
- </complexType>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',array(123,123.5),'rpc','literal');
echo "ok";
diff --git a/ext/soap/tests/schema/schema058.phpt b/ext/soap/tests/schema/schema058.phpt
index b96fc9fcca..aee0a96111 100644
--- a/ext/soap/tests/schema/schema058.phpt
+++ b/ext/soap/tests/schema/schema058.phpt
@@ -6,14 +6,14 @@ SOAP XML Schema 58: SOAP 1.2 Array (literal encoding)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <complexContent>
- <restriction base="enc12:Array" xmlns:enc12="http://www.w3.org/2003/05/soap-encoding">
- <attribute ref="enc12:itemType" wsdl:itemType="int"/>
- <attribute ref="enc12:arraySize" wsdl:arraySize="*"/>
- </restriction>
+ <complexType name="testType">
+ <complexContent>
+ <restriction base="enc12:Array" xmlns:enc12="http://www.w3.org/2003/05/soap-encoding">
+ <attribute ref="enc12:itemType" wsdl:itemType="int"/>
+ <attribute ref="enc12:arraySize" wsdl:arraySize="*"/>
+ </restriction>
</complexContent>
- </complexType>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',array(123,123.5),'rpc','literal');
echo "ok";
diff --git a/ext/soap/tests/schema/schema059.phpt b/ext/soap/tests/schema/schema059.phpt
index 875bae9868..bbed854fbb 100644
--- a/ext/soap/tests/schema/schema059.phpt
+++ b/ext/soap/tests/schema/schema059.phpt
@@ -6,15 +6,15 @@ SOAP XML Schema 59: SOAP 1.2 Array (second way, literal encoding)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <complexContent>
- <restriction base="enc12:Array" xmlns:enc12="http://www.w3.org/2003/05/soap-encoding">
- <all>
- <element name="x_item" type="int" maxOccurs="unbounded"/>
- </all>
- </restriction>
+ <complexType name="testType">
+ <complexContent>
+ <restriction base="enc12:Array" xmlns:enc12="http://www.w3.org/2003/05/soap-encoding">
+ <all>
+ <element name="x_item" type="int" maxOccurs="unbounded"/>
+ </all>
+ </restriction>
</complexContent>
- </complexType>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',array(123,123.5),'rpc','literal');
echo "ok";
diff --git a/ext/soap/tests/schema/schema060.phpt b/ext/soap/tests/schema/schema060.phpt
index 4daa83c191..9029a470e4 100644
--- a/ext/soap/tests/schema/schema060.phpt
+++ b/ext/soap/tests/schema/schema060.phpt
@@ -6,14 +6,14 @@ SOAP XML Schema 60: SOAP 1.2 Multidimensional array (literal encoding)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <complexContent>
- <restriction base="enc12:Array" xmlns:enc12="http://www.w3.org/2003/05/soap-encoding">
- <attribute ref="enc12:itemType" wsdl:itemType="int"/>
- <attribute ref="enc12:arraySize" wsdl:arraySize="* 1"/>
- </restriction>
+ <complexType name="testType">
+ <complexContent>
+ <restriction base="enc12:Array" xmlns:enc12="http://www.w3.org/2003/05/soap-encoding">
+ <attribute ref="enc12:itemType" wsdl:itemType="int"/>
+ <attribute ref="enc12:arraySize" wsdl:arraySize="* 1"/>
+ </restriction>
</complexContent>
- </complexType>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',array(array(123),array(123.5)),'rpc','literal');
echo "ok";
diff --git a/ext/soap/tests/schema/schema061.phpt b/ext/soap/tests/schema/schema061.phpt
index bbd2aa6579..73cf1546d9 100644
--- a/ext/soap/tests/schema/schema061.phpt
+++ b/ext/soap/tests/schema/schema061.phpt
@@ -6,16 +6,16 @@ SOAP XML Schema 61: SOAP 1.2 Multidimensional array (second way, literal encodin
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <complexContent>
- <restriction base="enc12:Array" xmlns:enc12="http://www.w3.org/2003/05/soap-encoding">
- <all>
- <element name="x_item" type="int" maxOccurs="unbounded"/>
- </all>
- <attribute ref="enc12:arraySize" wsdl:arraySize="* 1"/>
- </restriction>
+ <complexType name="testType">
+ <complexContent>
+ <restriction base="enc12:Array" xmlns:enc12="http://www.w3.org/2003/05/soap-encoding">
+ <all>
+ <element name="x_item" type="int" maxOccurs="unbounded"/>
+ </all>
+ <attribute ref="enc12:arraySize" wsdl:arraySize="* 1"/>
+ </restriction>
</complexContent>
- </complexType>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',array(array(123),array(123.5)),'rpc','literal');
echo "ok";
diff --git a/ext/soap/tests/schema/schema062.phpt b/ext/soap/tests/schema/schema062.phpt
index 60b06568ed..ae26c7b1cd 100644
--- a/ext/soap/tests/schema/schema062.phpt
+++ b/ext/soap/tests/schema/schema062.phpt
@@ -6,13 +6,13 @@ SOAP XML Schema 62: NULL with attributes
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <simpleContent>
- <restriction base="int">
- <attribute name="int" type="int"/>
- </restriction>
- </simpleContent>
- </complexType>
+ <complexType name="testType">
+ <simpleContent>
+ <restriction base="int">
+ <attribute name="int" type="int"/>
+ </restriction>
+ </simpleContent>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',(object)array("_"=>NULL,"int"=>123.5));
echo "ok";
diff --git a/ext/soap/tests/schema/schema064.phpt b/ext/soap/tests/schema/schema064.phpt
index 913cbd16e0..88f58cf8ce 100644
--- a/ext/soap/tests/schema/schema064.phpt
+++ b/ext/soap/tests/schema/schema064.phpt
@@ -10,30 +10,30 @@ require_once('skipif.inc'); ?>
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <sequence>
- <element name="dateTime" type="dateTime"/>
- <element name="time" type="time"/>
- <element name="date" type="date"/>
- <element name="gYearMonth" type="gYearMonth"/>
- <element name="gYear" type="gYear"/>
- <element name="gMonthDay" type="gMonthDay"/>
- <element name="gDay" type="gDay"/>
- <element name="gMonth" type="gMonth"/>
- </sequence>
- </complexType>
+ <complexType name="testType">
+ <sequence>
+ <element name="dateTime" type="dateTime"/>
+ <element name="time" type="time"/>
+ <element name="date" type="date"/>
+ <element name="gYearMonth" type="gYearMonth"/>
+ <element name="gYear" type="gYear"/>
+ <element name="gMonthDay" type="gMonthDay"/>
+ <element name="gDay" type="gDay"/>
+ <element name="gMonth" type="gMonth"/>
+ </sequence>
+ </complexType>
EOF;
$date = gmmktime(1,2,3,4,5,1976);
putenv('TZ=GMT');
test_schema($schema,'type="tns:testType"',array(
- 'dateTime' => $date,
- 'time' => $date,
- 'date' => $date,
- 'gYearMonth' => $date,
- 'gYear' => $date,
- 'gMonthDay' => $date,
- 'gDay' => $date,
- 'gMonth' => $date
+ 'dateTime' => $date,
+ 'time' => $date,
+ 'date' => $date,
+ 'gYearMonth' => $date,
+ 'gYear' => $date,
+ 'gMonthDay' => $date,
+ 'gDay' => $date,
+ 'gMonth' => $date
));
echo "ok";
?>
diff --git a/ext/soap/tests/schema/schema065.phpt b/ext/soap/tests/schema/schema065.phpt
index 3199a6bc8f..0e5a66cd3f 100644
--- a/ext/soap/tests/schema/schema065.phpt
+++ b/ext/soap/tests/schema/schema065.phpt
@@ -6,10 +6,10 @@ SOAP XML Schema 65: Attribute with default value
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <attribute name="str" type="string"/>
- <attribute name="int" type="int" default="5"/>
- </complexType>
+ <complexType name="testType">
+ <attribute name="str" type="string"/>
+ <attribute name="int" type="int" default="5"/>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',(object)array("str"=>"str"));
echo "ok";
diff --git a/ext/soap/tests/schema/schema066.phpt b/ext/soap/tests/schema/schema066.phpt
index 7fe47bbd2c..c6692535a6 100644
--- a/ext/soap/tests/schema/schema066.phpt
+++ b/ext/soap/tests/schema/schema066.phpt
@@ -6,10 +6,10 @@ SOAP XML Schema 66: Attribute with fixed value (1)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <attribute name="str" type="string"/>
- <attribute name="int" type="int" fixed="5"/>
- </complexType>
+ <complexType name="testType">
+ <attribute name="str" type="string"/>
+ <attribute name="int" type="int" fixed="5"/>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',(object)array("str"=>"str"));
echo "ok";
diff --git a/ext/soap/tests/schema/schema067.phpt b/ext/soap/tests/schema/schema067.phpt
index 5ee0036ebe..7fb7eff233 100644
--- a/ext/soap/tests/schema/schema067.phpt
+++ b/ext/soap/tests/schema/schema067.phpt
@@ -6,10 +6,10 @@ SOAP XML Schema 67: Attribute with fixed value (2)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <attribute name="str" type="string"/>
- <attribute name="int" type="int" fixed="5"/>
- </complexType>
+ <complexType name="testType">
+ <attribute name="str" type="string"/>
+ <attribute name="int" type="int" fixed="5"/>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',(object)array("str"=>"str","int"=>5));
echo "ok";
diff --git a/ext/soap/tests/schema/schema068.phpt b/ext/soap/tests/schema/schema068.phpt
index 5ab63be097..4372cdfa23 100644
--- a/ext/soap/tests/schema/schema068.phpt
+++ b/ext/soap/tests/schema/schema068.phpt
@@ -6,10 +6,10 @@ SOAP XML Schema 68: Attribute with fixed value (3)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <attribute name="str" type="string"/>
- <attribute name="int" type="int" fixed="5"/>
- </complexType>
+ <complexType name="testType">
+ <attribute name="str" type="string"/>
+ <attribute name="int" type="int" fixed="5"/>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',(object)array("str"=>"str","int"=>4));
echo "ok";
diff --git a/ext/soap/tests/schema/schema069.phpt b/ext/soap/tests/schema/schema069.phpt
index ccaa342406..d944765e32 100644
--- a/ext/soap/tests/schema/schema069.phpt
+++ b/ext/soap/tests/schema/schema069.phpt
@@ -6,11 +6,11 @@ SOAP XML Schema 69: Attribute with default value (reference)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <attribute name="str" type="string"/>
- <attribute ref="tns:int"/>
- </complexType>
- <attribute name="int" type="int" default="5"/>
+ <complexType name="testType">
+ <attribute name="str" type="string"/>
+ <attribute ref="tns:int"/>
+ </complexType>
+ <attribute name="int" type="int" default="5"/>
EOF;
test_schema($schema,'type="tns:testType"',(object)array("str"=>"str"));
echo "ok";
diff --git a/ext/soap/tests/schema/schema070.phpt b/ext/soap/tests/schema/schema070.phpt
index 0c1e249392..3135183398 100644
--- a/ext/soap/tests/schema/schema070.phpt
+++ b/ext/soap/tests/schema/schema070.phpt
@@ -6,13 +6,13 @@ SOAP XML Schema 70: Attribute with default value (attributeGroup)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <attribute name="str" type="string"/>
- <attributeGroup ref="tns:int_group"/>
- </complexType>
- <attributeGroup name="int_group">
- <attribute name="int" type="int" default="5"/>
- </attributeGroup>
+ <complexType name="testType">
+ <attribute name="str" type="string"/>
+ <attributeGroup ref="tns:int_group"/>
+ </complexType>
+ <attributeGroup name="int_group">
+ <attribute name="int" type="int" default="5"/>
+ </attributeGroup>
EOF;
test_schema($schema,'type="tns:testType"',(object)array("str"=>"str"));
echo "ok";
diff --git a/ext/soap/tests/schema/schema071.phpt b/ext/soap/tests/schema/schema071.phpt
index 1991f7ad8e..65ea47bf9e 100644
--- a/ext/soap/tests/schema/schema071.phpt
+++ b/ext/soap/tests/schema/schema071.phpt
@@ -6,13 +6,13 @@ SOAP XML Schema 71: SOAP 1.1 Array (document style)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <complexContent>
- <restriction base="SOAP-ENC:Array">
- <attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="int[]"/>
- </restriction>
+ <complexType name="testType">
+ <complexContent>
+ <restriction base="SOAP-ENC:Array">
+ <attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="int[]"/>
+ </restriction>
</complexContent>
- </complexType>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',array(123,123.5),'document','literal');
echo "ok";
diff --git a/ext/soap/tests/schema/schema072.phpt b/ext/soap/tests/schema/schema072.phpt
index 89a0ed3597..cbf08db00b 100644
--- a/ext/soap/tests/schema/schema072.phpt
+++ b/ext/soap/tests/schema/schema072.phpt
@@ -6,15 +6,15 @@ SOAP XML Schema 72: SOAP 1.1 Array (document style, element with inline type)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <element name="testElement">
- <complexType name="testType">
- <complexContent>
- <restriction base="SOAP-ENC:Array">
- <attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="int[]"/>
- </restriction>
+ <element name="testElement">
+ <complexType name="testType">
+ <complexContent>
+ <restriction base="SOAP-ENC:Array">
+ <attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="int[]"/>
+ </restriction>
</complexContent>
- </complexType>
- </element>
+ </complexType>
+ </element>
EOF;
test_schema($schema,'element="tns:testElement"',array(123,123.5),'document','literal');
echo "ok";
diff --git a/ext/soap/tests/schema/schema073.phpt b/ext/soap/tests/schema/schema073.phpt
index 22dd9e2604..3338684a9b 100644
--- a/ext/soap/tests/schema/schema073.phpt
+++ b/ext/soap/tests/schema/schema073.phpt
@@ -6,14 +6,14 @@ SOAP XML Schema 73: SOAP 1.1 Array (document style, element with type ref)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <element name="testElement" type="tns:testType"/>
- <complexType name="testType">
- <complexContent>
- <restriction base="SOAP-ENC:Array">
- <attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="int[]"/>
- </restriction>
+ <element name="testElement" type="tns:testType"/>
+ <complexType name="testType">
+ <complexContent>
+ <restriction base="SOAP-ENC:Array">
+ <attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="int[]"/>
+ </restriction>
</complexContent>
- </complexType>
+ </complexType>
EOF;
test_schema($schema,'element="tns:testElement"',array(123,123.5),'document','literal');
echo "ok";
diff --git a/ext/soap/tests/schema/schema074.phpt b/ext/soap/tests/schema/schema074.phpt
index 3dbba0cd25..4735957bfa 100644
--- a/ext/soap/tests/schema/schema074.phpt
+++ b/ext/soap/tests/schema/schema074.phpt
@@ -6,12 +6,12 @@ SOAP XML Schema 74: Structure with attributes and qualified elements
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <sequence>
- <element name="str" type="string"/>
- </sequence>
- <attribute name="int" type="int"/>
- </complexType>
+ <complexType name="testType">
+ <sequence>
+ <element name="str" type="string"/>
+ </sequence>
+ <attribute name="int" type="int"/>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',(object)array("str"=>"str","int"=>123.5), "rpc", "encoded", 'attributeFormDefault="qualified"');
diff --git a/ext/soap/tests/schema/schema075.phpt b/ext/soap/tests/schema/schema075.phpt
index 5867e55a7c..eb3729a9b2 100644
--- a/ext/soap/tests/schema/schema075.phpt
+++ b/ext/soap/tests/schema/schema075.phpt
@@ -6,11 +6,11 @@ SOAP XML Schema 75: Attributes form qualified/unqualified (attributeFormDefault=
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <attribute name="int1" type="int"/>
- <attribute name="int2" type="int" form="qualified"/>
- <attribute name="int3" type="int" form="unqualified"/>
- </complexType>
+ <complexType name="testType">
+ <attribute name="int1" type="int"/>
+ <attribute name="int2" type="int" form="qualified"/>
+ <attribute name="int3" type="int" form="unqualified"/>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',(object)array("int1"=>1.1,"int2"=>2.2,"int3"=>3.3), "rpc", "encoded", 'attributeFormDefault="qualified"');
diff --git a/ext/soap/tests/schema/schema076.phpt b/ext/soap/tests/schema/schema076.phpt
index 3ad2eae33a..d4940deb6b 100644
--- a/ext/soap/tests/schema/schema076.phpt
+++ b/ext/soap/tests/schema/schema076.phpt
@@ -6,11 +6,11 @@ SOAP XML Schema 76: Attributes form qualified/unqualified (attributeFormDefault=
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <attribute name="int1" type="int"/>
- <attribute name="int2" type="int" form="qualified"/>
- <attribute name="int3" type="int" form="unqualified"/>
- </complexType>
+ <complexType name="testType">
+ <attribute name="int1" type="int"/>
+ <attribute name="int2" type="int" form="qualified"/>
+ <attribute name="int3" type="int" form="unqualified"/>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',(object)array("int1"=>1.1,"int2"=>2.2,"int3"=>3.3), "rpc", "encoded", 'attributeFormDefault="unqualified"');
diff --git a/ext/soap/tests/schema/schema077.phpt b/ext/soap/tests/schema/schema077.phpt
index 16057cfcf9..7da8b4a1a2 100644
--- a/ext/soap/tests/schema/schema077.phpt
+++ b/ext/soap/tests/schema/schema077.phpt
@@ -6,11 +6,11 @@ SOAP XML Schema 77: Attributes form qualified/unqualified (attributeFormDefault
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <attribute name="int1" type="int"/>
- <attribute name="int2" type="int" form="qualified"/>
- <attribute name="int3" type="int" form="unqualified"/>
- </complexType>
+ <complexType name="testType">
+ <attribute name="int1" type="int"/>
+ <attribute name="int2" type="int" form="qualified"/>
+ <attribute name="int3" type="int" form="unqualified"/>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',(object)array("int1"=>1.1,"int2"=>2.2,"int3"=>3.3), "rpc", "encoded");
diff --git a/ext/soap/tests/schema/schema078.phpt b/ext/soap/tests/schema/schema078.phpt
index 7636a78f93..a051acd8f2 100644
--- a/ext/soap/tests/schema/schema078.phpt
+++ b/ext/soap/tests/schema/schema078.phpt
@@ -6,13 +6,13 @@ SOAP XML Schema 78: Element form qualified/unqualified (elementFormDefault="qual
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <sequence>
- <element name="int1" type="int"/>
- <element name="int2" type="int" form="qualified"/>
- <element name="int3" type="int" form="unqualified"/>
- </sequence>
- </complexType>
+ <complexType name="testType">
+ <sequence>
+ <element name="int1" type="int"/>
+ <element name="int2" type="int" form="qualified"/>
+ <element name="int3" type="int" form="unqualified"/>
+ </sequence>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',(object)array("int1"=>1.1,"int2"=>2.2,"int3"=>3.3), "rpc", "literal", 'elementFormDefault="qualified"');
diff --git a/ext/soap/tests/schema/schema079.phpt b/ext/soap/tests/schema/schema079.phpt
index 34dcd9bee7..de1a4480fe 100644
--- a/ext/soap/tests/schema/schema079.phpt
+++ b/ext/soap/tests/schema/schema079.phpt
@@ -6,13 +6,13 @@ SOAP XML Schema 79: Element form qualified/unqualified (elementFormDefault="unqu
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <sequence>
- <element name="int1" type="int"/>
- <element name="int2" type="int" form="qualified"/>
- <element name="int3" type="int" form="unqualified"/>
- </sequence>
- </complexType>
+ <complexType name="testType">
+ <sequence>
+ <element name="int1" type="int"/>
+ <element name="int2" type="int" form="qualified"/>
+ <element name="int3" type="int" form="unqualified"/>
+ </sequence>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',(object)array("int1"=>1.1,"int2"=>2.2,"int3"=>3.3), "rpc", "literal", 'elementFormDefault="unqualified"');
diff --git a/ext/soap/tests/schema/schema080.phpt b/ext/soap/tests/schema/schema080.phpt
index 7519d6a30d..926bc8ae22 100644
--- a/ext/soap/tests/schema/schema080.phpt
+++ b/ext/soap/tests/schema/schema080.phpt
@@ -6,13 +6,13 @@ SOAP XML Schema 80: Element form qualified/unqualified (elementFormDefault - def
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <sequence>
- <element name="int1" type="int"/>
- <element name="int2" type="int" form="qualified"/>
- <element name="int3" type="int" form="unqualified"/>
- </sequence>
- </complexType>
+ <complexType name="testType">
+ <sequence>
+ <element name="int1" type="int"/>
+ <element name="int2" type="int" form="qualified"/>
+ <element name="int3" type="int" form="unqualified"/>
+ </sequence>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',(object)array("int1"=>1.1,"int2"=>2.2,"int3"=>3.3), "rpc", "literal");
diff --git a/ext/soap/tests/schema/schema081.phpt b/ext/soap/tests/schema/schema081.phpt
index 337f081261..976d95baf8 100644
--- a/ext/soap/tests/schema/schema081.phpt
+++ b/ext/soap/tests/schema/schema081.phpt
@@ -6,13 +6,13 @@ SOAP XML Schema 81: SOAP 1.1 Array with SOAP_USE_XSI_ARRAY_TYPE
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <complexContent>
- <restriction base="SOAP-ENC:Array">
- <attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="int[]"/>
- </restriction>
+ <complexType name="testType">
+ <complexContent>
+ <restriction base="SOAP-ENC:Array">
+ <attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="int[]"/>
+ </restriction>
</complexContent>
- </complexType>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',array(123,123.5),"rpc","encoded",'',SOAP_USE_XSI_ARRAY_TYPE);
echo "ok";
diff --git a/ext/soap/tests/schema/schema082.phpt b/ext/soap/tests/schema/schema082.phpt
index 34c4c76c25..229e566afc 100644
--- a/ext/soap/tests/schema/schema082.phpt
+++ b/ext/soap/tests/schema/schema082.phpt
@@ -6,15 +6,15 @@ SOAP XML Schema 82: SOAP 1.1 Array with SOAP_USE_XSI_ARRAY_TYPE (second way)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <complexContent>
- <restriction base="SOAP-ENC:Array">
- <all>
- <element name="x_item" type="int" maxOccurs="unbounded"/>
- </all>
- </restriction>
+ <complexType name="testType">
+ <complexContent>
+ <restriction base="SOAP-ENC:Array">
+ <all>
+ <element name="x_item" type="int" maxOccurs="unbounded"/>
+ </all>
+ </restriction>
</complexContent>
- </complexType>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',array(123,123.5),"rpc","encoded",'',SOAP_USE_XSI_ARRAY_TYPE);
echo "ok";
diff --git a/ext/soap/tests/schema/schema083.phpt b/ext/soap/tests/schema/schema083.phpt
index 854c4f9ff6..8bcf602305 100644
--- a/ext/soap/tests/schema/schema083.phpt
+++ b/ext/soap/tests/schema/schema083.phpt
@@ -6,14 +6,14 @@ SOAP XML Schema 83: SOAP 1.2 Array with SOAP_USE_XSI_ARRAY_TYPE
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <complexContent>
- <restriction base="enc12:Array" xmlns:enc12="http://www.w3.org/2003/05/soap-encoding">
- <attribute ref="enc12:itemType" wsdl:itemType="int"/>
- <attribute ref="enc12:arraySize" wsdl:arraySize="*"/>
- </restriction>
+ <complexType name="testType">
+ <complexContent>
+ <restriction base="enc12:Array" xmlns:enc12="http://www.w3.org/2003/05/soap-encoding">
+ <attribute ref="enc12:itemType" wsdl:itemType="int"/>
+ <attribute ref="enc12:arraySize" wsdl:arraySize="*"/>
+ </restriction>
</complexContent>
- </complexType>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',array(123,123.5),"rpc","encoded",'',SOAP_USE_XSI_ARRAY_TYPE);
echo "ok";
diff --git a/ext/soap/tests/schema/schema084.phpt b/ext/soap/tests/schema/schema084.phpt
index 94a9551faf..62804c9ccc 100644
--- a/ext/soap/tests/schema/schema084.phpt
+++ b/ext/soap/tests/schema/schema084.phpt
@@ -6,15 +6,15 @@ SOAP XML Schema 84: SOAP 1.2 Array with SOAP_USE_XSI_ARRAY_TYPE (second way)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType">
- <complexContent>
- <restriction base="enc12:Array" xmlns:enc12="http://www.w3.org/2003/05/soap-encoding">
- <all>
- <element name="x_item" type="int" maxOccurs="unbounded"/>
- </all>
- </restriction>
+ <complexType name="testType">
+ <complexContent>
+ <restriction base="enc12:Array" xmlns:enc12="http://www.w3.org/2003/05/soap-encoding">
+ <all>
+ <element name="x_item" type="int" maxOccurs="unbounded"/>
+ </all>
+ </restriction>
</complexContent>
- </complexType>
+ </complexType>
EOF;
test_schema($schema,'type="tns:testType"',array(123,123.5),"rpc","encoded",'',SOAP_USE_XSI_ARRAY_TYPE);
echo "ok";
diff --git a/ext/soap/tests/schema/schema085.phpt b/ext/soap/tests/schema/schema085.phpt
index 1a1ab15999..206553bb51 100644
--- a/ext/soap/tests/schema/schema085.phpt
+++ b/ext/soap/tests/schema/schema085.phpt
@@ -6,20 +6,20 @@ SOAP XML Schema 85: Extension of complex type (elements order)
<?php
include "test_schema.inc";
$schema = <<<EOF
- <complexType name="testType2">
- <sequence>
- <element name="int" type="int"/>
- </sequence>
- </complexType>
- <complexType name="testType">
- <complexContent>
- <extension base="tns:testType2">
- <sequence>
- <element name="int2" type="int"/>
- </sequence>
- </extension>
- </complexContent>
- </complexType>
+ <complexType name="testType2">
+ <sequence>
+ <element name="int" type="int"/>
+ </sequence>
+ </complexType>
+ <complexType name="testType">
+ <complexContent>
+ <extension base="tns:testType2">
+ <sequence>
+ <element name="int2" type="int"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
EOF;
class A {
public $int = 1;
diff --git a/ext/soap/tests/schema/test_schema.inc b/ext/soap/tests/schema/test_schema.inc
index 7afc4e697c..a0ba2c4dc1 100644
--- a/ext/soap/tests/schema/test_schema.inc
+++ b/ext/soap/tests/schema/test_schema.inc
@@ -2,8 +2,8 @@
$val = null;
function test($input) {
- global $val;
- $val = $input;
+ global $val;
+ $val = $input;
}
function test_schema($schema,$type,$param,$style="rpc",$use="encoded", $attributeFormDefault='',$features=0) {
@@ -22,27 +22,27 @@ $wsdl = <<<EOF
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://test-uri/" $attributeFormDefault>
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
- $schema
+ $schema
</schema>
</types>
<message name="testMessage">
- <part name="testParam" $type/>
+ <part name="testParam" $type/>
</message>
- <portType name="testPortType">
- <operation name="test">
- <input message="testMessage"/>
- </operation>
- </portType>
- <binding name="testBinding" type="testPortType">
- <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
- <operation name="test">
- <soap:operation soapAction="#test" style="$style"/>
- <input>
- <soap:body use="$use" namespace="http://test-uri/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- </input>
- </operation>
- </binding>
- <service name="testService">
+ <portType name="testPortType">
+ <operation name="test">
+ <input message="testMessage"/>
+ </operation>
+ </portType>
+ <binding name="testBinding" type="testPortType">
+ <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <operation name="test">
+ <soap:operation soapAction="#test" style="$style"/>
+ <input>
+ <soap:body use="$use" namespace="http://test-uri/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </input>
+ </operation>
+ </binding>
+ <service name="testService">
<port name="testPort" binding="tns:testBinding">
<soap:address location="test://" />
</port>
@@ -57,7 +57,7 @@ EOF;
ini_set("soap.wsdl_cache_enabled",0);
$x = new SoapClient($fname, array("trace"=>1,"exceptions"=>0,"features"=>$features));
$y = new SoapServer($fname, array("features"=>$features));
- $y->addfunction("test");
+ $y->addfunction("test");
unlink($fname);
$x->test($param);
diff --git a/ext/soap/tests/server011.phpt b/ext/soap/tests/server011.phpt
index 1c367d7d56..53c6521314 100644
--- a/ext/soap/tests/server011.phpt
+++ b/ext/soap/tests/server011.phpt
@@ -20,7 +20,7 @@ ob_end_clean();
if ($wsdl == file_get_contents(__DIR__."/test.wsdl")) {
echo "ok\n";
} else {
- echo "fail\n";
+ echo "fail\n";
}
?>
--EXPECT--
diff --git a/ext/soap/tests/server016.phpt b/ext/soap/tests/server016.phpt
index 8934f46afe..acef045a46 100644
--- a/ext/soap/tests/server016.phpt
+++ b/ext/soap/tests/server016.phpt
@@ -5,8 +5,8 @@ SOAP Server 16: user fault
--FILE--
<?php
function test() {
- global $server;
- $server->fault("MyFault","My fault string");
+ global $server;
+ $server->fault("MyFault","My fault string");
}
$server = new soapserver(null,array('uri'=>"http://testuri.org"));
diff --git a/ext/soap/tests/server017.phpt b/ext/soap/tests/server017.phpt
index 3ff0acb4e9..a635065750 100644
--- a/ext/soap/tests/server017.phpt
+++ b/ext/soap/tests/server017.phpt
@@ -5,7 +5,7 @@ SOAP Server 17: user fault (through return)
--FILE--
<?php
function test() {
- return new SoapFault("MyFault","My fault string");
+ return new SoapFault("MyFault","My fault string");
}
$server = new soapserver(null,array('uri'=>"http://testuri.org"));
diff --git a/ext/soap/tests/server018.phpt b/ext/soap/tests/server018.phpt
index b033ed9c57..2c379d85dd 100644
--- a/ext/soap/tests/server018.phpt
+++ b/ext/soap/tests/server018.phpt
@@ -5,7 +5,7 @@ SOAP Server 18: user fault (through throw)
--FILE--
<?php
function test() {
- throw new SoapFault("MyFault","My fault string");
+ throw new SoapFault("MyFault","My fault string");
}
$server = new soapserver(null,array('uri'=>"http://testuri.org"));
diff --git a/ext/soap/tests/server022.phpt b/ext/soap/tests/server022.phpt
index ff79a1518f..82270f8eef 100644
--- a/ext/soap/tests/server022.phpt
+++ b/ext/soap/tests/server022.phpt
@@ -5,14 +5,14 @@ SOAP Server 22: user fault (through throw of subclass)
--FILE--
<?php
class MyFault extends SoapFault {
- function __construct() {
- parent::__construct("MyFault","My fault string");
- }
+ function __construct() {
+ parent::__construct("MyFault","My fault string");
+ }
}
function test() {
- throw new MyFault;
+ throw new MyFault;
}
$server = new soapserver(null,array('uri'=>"http://testuri.org"));
diff --git a/ext/soap/tests/server023.phpt b/ext/soap/tests/server023.phpt
index 5614599f3a..07f3aea554 100644
--- a/ext/soap/tests/server023.phpt
+++ b/ext/soap/tests/server023.phpt
@@ -5,10 +5,10 @@ SOAP Server 23: Send SOAP headers those were not received
--FILE--
<?php
function test() {
- global $server;
- $server->addSoapHeader(new SoapHeader("http://testuri.org", "Test1", "Hello Header!"));
- $server->addSoapHeader(new SoapHeader("http://testuri.org", "Test2", "Hello Header!"));
- return "Hello Body!";
+ global $server;
+ $server->addSoapHeader(new SoapHeader("http://testuri.org", "Test1", "Hello Header!"));
+ $server->addSoapHeader(new SoapHeader("http://testuri.org", "Test2", "Hello Header!"));
+ return "Hello Body!";
}
$server = new soapserver(null,array('uri'=>"http://testuri.org"));
diff --git a/ext/soap/tests/server024.phpt b/ext/soap/tests/server024.phpt
index 7db30621d3..63cf06cd02 100644
--- a/ext/soap/tests/server024.phpt
+++ b/ext/soap/tests/server024.phpt
@@ -5,22 +5,22 @@ SOAP Server 24: Send SOAP headers those were not received
--FILE--
<?php
class TestHeader1 extends SoapHeader {
- function __construct($data) {
- parent::__construct("http://testuri.org", "Test1", $data);
- }
+ function __construct($data) {
+ parent::__construct("http://testuri.org", "Test1", $data);
+ }
}
class TestHeader2 extends SoapHeader {
- function __construct($data) {
- parent::__construct("http://testuri.org", "Test2", $data);
- }
+ function __construct($data) {
+ parent::__construct("http://testuri.org", "Test2", $data);
+ }
}
function test() {
- global $server;
- $server->addSoapHeader(new TestHeader1("Hello Header!"));
- $server->addSoapHeader(new TestHeader2("Hello Header!"));
- return "Hello Body!";
+ global $server;
+ $server->addSoapHeader(new TestHeader1("Hello Header!"));
+ $server->addSoapHeader(new TestHeader2("Hello Header!"));
+ return "Hello Body!";
}
$server = new soapserver(null,array('uri'=>"http://testuri.org"));
diff --git a/ext/soap/tests/server025.phpt b/ext/soap/tests/server025.phpt
index 5366c7ad91..871134f935 100644
--- a/ext/soap/tests/server025.phpt
+++ b/ext/soap/tests/server025.phpt
@@ -7,22 +7,22 @@ soap.wsdl_cache_enabled=0
--FILE--
<?php
class TestHeader1 extends SoapHeader {
- function __construct($data) {
- parent::__construct("http://testuri.org", "Test1", $data);
- }
+ function __construct($data) {
+ parent::__construct("http://testuri.org", "Test1", $data);
+ }
}
class TestHeader2 extends SoapHeader {
- function __construct($data) {
- parent::__construct("http://testuri.org", "Test2", $data);
- }
+ function __construct($data) {
+ parent::__construct("http://testuri.org", "Test2", $data);
+ }
}
function test() {
- global $server;
- $server->addSoapHeader(new TestHeader1("Hello Header!"));
- $server->addSoapHeader(new TestHeader2("Hello Header!"));
- return "Hello Body!";
+ global $server;
+ $server->addSoapHeader(new TestHeader1("Hello Header!"));
+ $server->addSoapHeader(new TestHeader2("Hello Header!"));
+ return "Hello Body!";
}
$server = new soapserver(__DIR__."/server025.wsdl");
diff --git a/ext/soap/tests/server031.phpt b/ext/soap/tests/server031.phpt
index c9f8d95f8e..987ad4ab59 100644
--- a/ext/soap/tests/server031.phpt
+++ b/ext/soap/tests/server031.phpt
@@ -7,11 +7,11 @@ soap.wsdl_cache_enabled=0
--FILE--
<?php
class ItemArray implements Iterator {
- private $a = array();
+ private $a = array();
- public function __construct(array $a) {
- $this->a = $a;
- }
+ public function __construct(array $a) {
+ $this->a = $a;
+ }
public function rewind() { return reset($this->a); }
public function current() { return current($this->a); }
@@ -23,26 +23,26 @@ class ItemArray implements Iterator {
class Item {
public $text;
- public function __construct($n) {
- $this->text = 'text'.$n;
- }
+ public function __construct($n) {
+ $this->text = 'text'.$n;
+ }
}
class handlerClass {
public function getItems()
{
return new ItemArray(array(
- new Item(0),
- new Item(1),
- new Item(2),
- new Item(3),
- new Item(4),
- new Item(5),
- new Item(6),
- new Item(7),
- new Item(8),
- new Item(9)
- ));
+ new Item(0),
+ new Item(1),
+ new Item(2),
+ new Item(3),
+ new Item(4),
+ new Item(5),
+ new Item(6),
+ new Item(7),
+ new Item(8),
+ new Item(9)
+ ));
}
}
diff --git a/ext/soap/tests/soap12/T01.phpt b/ext/soap/tests/soap12/T01.phpt
index d584812d09..45aadbad86 100644
--- a/ext/soap/tests/soap12/T01.phpt
+++ b/ext/soap/tests/soap12/T01.phpt
@@ -6,7 +6,7 @@ SOAP 1.2: T01 echoOk
<?php
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' ?>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header>
<test:echoOk xmlns:test="http://example.org/ts-tests"
env:role="http://www.w3.org/2003/05/soap-envelope/role/next">foo</test:echoOk>
diff --git a/ext/soap/tests/soap12/T02.phpt b/ext/soap/tests/soap12/T02.phpt
index db2c260684..d7f9880143 100644
--- a/ext/soap/tests/soap12/T02.phpt
+++ b/ext/soap/tests/soap12/T02.phpt
@@ -6,7 +6,7 @@ SOAP 1.2: T02 echoOk
<?php
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' ?>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header>
<test:echoOk xmlns:test="http://example.org/ts-tests"
env:role="http://example.org/ts-tests/C">foo</test:echoOk>
diff --git a/ext/soap/tests/soap12/T03.phpt b/ext/soap/tests/soap12/T03.phpt
index 19c29dd3dd..1d7aa3b0d3 100644
--- a/ext/soap/tests/soap12/T03.phpt
+++ b/ext/soap/tests/soap12/T03.phpt
@@ -6,7 +6,7 @@ SOAP 1.2: T03 echoOk
<?php
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' ?>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header>
<test:echoOk xmlns:test="http://example.org/ts-tests">foo</test:echoOk>
</env:Header>
diff --git a/ext/soap/tests/soap12/T04.phpt b/ext/soap/tests/soap12/T04.phpt
index 7445caedee..2bef7626d8 100644
--- a/ext/soap/tests/soap12/T04.phpt
+++ b/ext/soap/tests/soap12/T04.phpt
@@ -6,7 +6,7 @@ SOAP 1.2: T04 echoOk
<?php
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' ?>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header>
<test:echoOk xmlns:test="http://example.org/ts-tests"
env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver">foo</test:echoOk>
diff --git a/ext/soap/tests/soap12/T05.phpt b/ext/soap/tests/soap12/T05.phpt
index 187eb2ee83..c5e0054eb3 100644
--- a/ext/soap/tests/soap12/T05.phpt
+++ b/ext/soap/tests/soap12/T05.phpt
@@ -6,7 +6,7 @@ SOAP 1.2: T05 echoOk
<?php
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' ?>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header>
<test:echoOk xmlns:test="http://example.org/ts-tests"
env:role="http://example.org/ts-tests/B">foo</test:echoOk>
diff --git a/ext/soap/tests/soap12/T10.phpt b/ext/soap/tests/soap12/T10.phpt
index 54186f6a0d..6c2a3ea417 100644
--- a/ext/soap/tests/soap12/T10.phpt
+++ b/ext/soap/tests/soap12/T10.phpt
@@ -6,9 +6,9 @@ SOAP 1.2: T10 unknownHdr
<?php
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' ?>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header>
- <test:Unknown xmlns:test="http://example.org/ts-tests"
+ <test:Unknown xmlns:test="http://example.org/ts-tests"
env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver">foo</test:Unknown>
</env:Header>
<env:Body>
diff --git a/ext/soap/tests/soap12/T11.phpt b/ext/soap/tests/soap12/T11.phpt
index 3423d54329..d805596bed 100644
--- a/ext/soap/tests/soap12/T11.phpt
+++ b/ext/soap/tests/soap12/T11.phpt
@@ -6,7 +6,7 @@ SOAP 1.2: T11 unknownHdr
<?php
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' ?>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header>
<test:Unknown xmlns:test="http://example.org/ts-tests"
env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver"
diff --git a/ext/soap/tests/soap12/T12.phpt b/ext/soap/tests/soap12/T12.phpt
index c67917f0e3..7a1cc56bec 100644
--- a/ext/soap/tests/soap12/T12.phpt
+++ b/ext/soap/tests/soap12/T12.phpt
@@ -6,7 +6,7 @@ SOAP 1.2: T12 unknownHdr
<?php
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' ?>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header>
<test:Unknown xmlns:test="http://example.org/ts-tests"
env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver"
diff --git a/ext/soap/tests/soap12/T13.phpt b/ext/soap/tests/soap12/T13.phpt
index 95e1c8ad4e..2d7fec0757 100644
--- a/ext/soap/tests/soap12/T13.phpt
+++ b/ext/soap/tests/soap12/T13.phpt
@@ -6,7 +6,7 @@ SOAP 1.2: T13 unknownHdr
<?php
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' ?>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header>
<test:Unknown xmlns:test="http://example.org/ts-tests"
env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver"
diff --git a/ext/soap/tests/soap12/T14.phpt b/ext/soap/tests/soap12/T14.phpt
index dbf4e1bab5..1bed2aa2d0 100644
--- a/ext/soap/tests/soap12/T14.phpt
+++ b/ext/soap/tests/soap12/T14.phpt
@@ -6,7 +6,7 @@ SOAP 1.2: T14 echoOk
<?php
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' ?>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header>
<test:echoOk xmlns:test="http://example.org/ts-tests"
env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver"
diff --git a/ext/soap/tests/soap12/T15.phpt b/ext/soap/tests/soap12/T15.phpt
index 546f94237f..d68d43c097 100644
--- a/ext/soap/tests/soap12/T15.phpt
+++ b/ext/soap/tests/soap12/T15.phpt
@@ -6,7 +6,7 @@ SOAP 1.2: T15 unknownHdr
<?php
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' ?>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header>
<test:Unknown xmlns:test="http://example.org/ts-tests"
env:role="http://example.org/ts-tests/B"
diff --git a/ext/soap/tests/soap12/T19.phpt b/ext/soap/tests/soap12/T19.phpt
index 8ddb5b4f8b..2f5e132f01 100644
--- a/ext/soap/tests/soap12/T19.phpt
+++ b/ext/soap/tests/soap12/T19.phpt
@@ -6,7 +6,7 @@ SOAP 1.2: T19 echoOk
<?php
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' ?>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header>
<test:echoOk xmlns:test="http://example.org/ts-tests"
env:role="http://www.w3.org/2003/05/soap-envelope/role/none"
diff --git a/ext/soap/tests/soap12/T22.phpt b/ext/soap/tests/soap12/T22.phpt
index 5844550ced..2976bc577a 100644
--- a/ext/soap/tests/soap12/T22.phpt
+++ b/ext/soap/tests/soap12/T22.phpt
@@ -6,9 +6,9 @@ SOAP 1.2: T22 echoOk
<?php
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' ?>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header>
- <test:echoOk xmlns:test="http://example.org/ts-tests"
+ <test:echoOk xmlns:test="http://example.org/ts-tests"
env:mustUnderstand = "1">foo</test:echoOk>
</env:Header>
<env:Body>
diff --git a/ext/soap/tests/soap12/T23.phpt b/ext/soap/tests/soap12/T23.phpt
index c676fb176c..095e5e725f 100644
--- a/ext/soap/tests/soap12/T23.phpt
+++ b/ext/soap/tests/soap12/T23.phpt
@@ -6,11 +6,11 @@ SOAP 1.2: T23 echoOk
<?php
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' ?>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header>
- <test:Unknown xmlns:test="http://example.org/ts-tests"
+ <test:Unknown xmlns:test="http://example.org/ts-tests"
env:mustUnderstand="1">foo</test:Unknown>
- <test:echoOk xmlns:test="http://example.org/ts-tests"
+ <test:echoOk xmlns:test="http://example.org/ts-tests"
env:mustUnderstand="wrong">foo</test:echoOk>
</env:Header>
<env:Body>
diff --git a/ext/soap/tests/soap12/T24.phpt b/ext/soap/tests/soap12/T24.phpt
index ebee3b764a..97bd56cf47 100644
--- a/ext/soap/tests/soap12/T24.phpt
+++ b/ext/soap/tests/soap12/T24.phpt
@@ -6,7 +6,7 @@ SOAP 1.2: T24 echoOk
<?php
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' ?>
-<env:Envelope xmlns:env="http://wrong-version/">
+<env:Envelope xmlns:env="http://wrong-version/">
<env:Body>
<test:echoOk xmlns:test="http://example.org/ts-tests">
foo
diff --git a/ext/soap/tests/soap12/T25.phpt b/ext/soap/tests/soap12/T25.phpt
index ac45e9c52d..ac5e1a0efd 100644
--- a/ext/soap/tests/soap12/T25.phpt
+++ b/ext/soap/tests/soap12/T25.phpt
@@ -7,7 +7,7 @@ SOAP 1.2: T25 echoOk
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' ?>
<!DOCTYPE env:Envelope SYSTEM "env.dtd"[]>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Body>
<test:echoOk xmlns:test="http://example.org/ts-tests">
foo
diff --git a/ext/soap/tests/soap12/T26.phpt b/ext/soap/tests/soap12/T26.phpt
index 53c8cec495..8b23ba7b63 100644
--- a/ext/soap/tests/soap12/T26.phpt
+++ b/ext/soap/tests/soap12/T26.phpt
@@ -6,7 +6,7 @@ SOAP 1.2: T26 echoOk
<?php
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' ?>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<?xml-stylesheet href="http://example.org/ts-tests/sub.xsl" type = "text/xsl"?>
<env:Body>
<test:echoOk xmlns:test="http://example.org/ts-tests">foo</test:echoOk>
diff --git a/ext/soap/tests/soap12/T27.phpt b/ext/soap/tests/soap12/T27.phpt
index 81db8ee5bc..3cb42940be 100644
--- a/ext/soap/tests/soap12/T27.phpt
+++ b/ext/soap/tests/soap12/T27.phpt
@@ -9,14 +9,14 @@ $HTTP_RAW_POST_DATA = <<<EOF
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<env:Body>
- <test:echoStringArray xmlns:test="http://example.org/ts-tests"
+ <test:echoStringArray xmlns:test="http://example.org/ts-tests"
xmlns:enc="http://www.w3.org/2003/05/soap-encoding"
env:encodingStyle="http://www.w3.org/2003/05/soap-encoding">
<test:array enc:itemType="xs:string" enc:arraySize="1">
<a>
<b>1</b>
</a>
- </test:array>
+ </test:array>
</test:echoStringArray>
</env:Body>
</env:Envelope>
diff --git a/ext/soap/tests/soap12/T28.phpt b/ext/soap/tests/soap12/T28.phpt
index 751df133db..019cabcdb9 100644
--- a/ext/soap/tests/soap12/T28.phpt
+++ b/ext/soap/tests/soap12/T28.phpt
@@ -6,7 +6,7 @@ SOAP 1.2: T28 echoOk
<?php
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' ?>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Body env:encodingStyle="http://www.w3.org/2003/05/soap-encoding">
<test:echoOk xmlns:test="http://example.org/ts-tests" >
foo
diff --git a/ext/soap/tests/soap12/T29.phpt b/ext/soap/tests/soap12/T29.phpt
index 3784da4030..85a3a61ae1 100644
--- a/ext/soap/tests/soap12/T29.phpt
+++ b/ext/soap/tests/soap12/T29.phpt
@@ -6,7 +6,7 @@ SOAP 1.2: T29 echoOk
<?php
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' ?>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header>
<test:echoOk xmlns:test="http://example.org/ts-tests"
env:role="http://example.org/ts-tests/Czzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz">foo</test:echoOk>
diff --git a/ext/soap/tests/soap12/T31.phpt b/ext/soap/tests/soap12/T31.phpt
index f00e25a59a..689f62bd00 100644
--- a/ext/soap/tests/soap12/T31.phpt
+++ b/ext/soap/tests/soap12/T31.phpt
@@ -6,7 +6,7 @@ SOAP 1.2: T31 returnVoid
<?php
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' ?>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Body>
<test:returnVoid xmlns:test="http://example.org/ts-tests">
</test:returnVoid>
diff --git a/ext/soap/tests/soap12/T32.phpt b/ext/soap/tests/soap12/T32.phpt
index 8f77873f4c..7d9dc1006a 100644
--- a/ext/soap/tests/soap12/T32.phpt
+++ b/ext/soap/tests/soap12/T32.phpt
@@ -6,7 +6,7 @@ SOAP 1.2: T32 echoHeader
<?php
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' ?>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header>
<test:requiredHeader xmlns:test="http://example.org/ts-tests"
env:mustUnderstand="true">foo</test:requiredHeader>
diff --git a/ext/soap/tests/soap12/T33.phpt b/ext/soap/tests/soap12/T33.phpt
index 00ded875b5..76f90bce1b 100644
--- a/ext/soap/tests/soap12/T33.phpt
+++ b/ext/soap/tests/soap12/T33.phpt
@@ -6,7 +6,7 @@ SOAP 1.2: T33 nonexistentMethod
<?php
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' ?>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Body>
<test:DoesNotExist xmlns:test="http://example.org/ts-tests">
</test:DoesNotExist>
diff --git a/ext/soap/tests/soap12/T34.phpt b/ext/soap/tests/soap12/T34.phpt
index 39e0095d43..873013cbc8 100644
--- a/ext/soap/tests/soap12/T34.phpt
+++ b/ext/soap/tests/soap12/T34.phpt
@@ -6,9 +6,9 @@ SOAP 1.2: T34 unknownHdr
<?php
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' ?>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header>
- <test:Unknown xmlns:test="http://example.org/ts-tests"
+ <test:Unknown xmlns:test="http://example.org/ts-tests"
xmlns:env1="http://schemas.xmlsoap.org/soap/envelope/"
env1:mustUnderstand="true">foo</test:Unknown>
</env:Header>
diff --git a/ext/soap/tests/soap12/T35.phpt b/ext/soap/tests/soap12/T35.phpt
index a736010ce0..b6511e8e80 100644
--- a/ext/soap/tests/soap12/T35.phpt
+++ b/ext/soap/tests/soap12/T35.phpt
@@ -6,7 +6,7 @@ SOAP 1.2: T35 unknownHdr
<?php
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' ?>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header>
<test:Unknown xmlns:test="http://example.org/ts-tests"
env:mustUnderstand="1">
diff --git a/ext/soap/tests/soap12/T36.phpt b/ext/soap/tests/soap12/T36.phpt
index d625813942..b1efaeaf90 100644
--- a/ext/soap/tests/soap12/T36.phpt
+++ b/ext/soap/tests/soap12/T36.phpt
@@ -6,10 +6,10 @@ SOAP 1.2: T36 unknownHdr
<?php
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' ?>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header>
<test:Unknown xmlns:test="http://example.org/ts-tests"
- env:mustUnderstand="1"
+ env:mustUnderstand="1"
env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver">foo</test:Unknown>
</env:Header>
<env:Body>
diff --git a/ext/soap/tests/soap12/T37.phpt b/ext/soap/tests/soap12/T37.phpt
index cdce8a4429..848c0a4aa4 100644
--- a/ext/soap/tests/soap12/T37.phpt
+++ b/ext/soap/tests/soap12/T37.phpt
@@ -6,7 +6,7 @@ SOAP 1.2: T37 unknownHdr
<?php
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' ?>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header>
<test:Unknown xmlns:test="http://example.org/ts-tests"
env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver">foo</test:Unknown>
diff --git a/ext/soap/tests/soap12/T38_1.phpt b/ext/soap/tests/soap12/T38_1.phpt
index 30007e55ef..8bc8cf185b 100644
--- a/ext/soap/tests/soap12/T38_1.phpt
+++ b/ext/soap/tests/soap12/T38_1.phpt
@@ -6,13 +6,13 @@ SOAP 1.2: T38.1 doubleHdr
<?php
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' ?>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header>
<test:Unknown xmlns:test="http://example.org/ts-tests"
- env:mustUnderstand="false"
+ env:mustUnderstand="false"
env:role="http://example.org/ts-tests/C">foo</test:Unknown>
<test:echoOk xmlns:test="http://example.org/ts-tests"
- env:mustUnderstand="0"
+ env:mustUnderstand="0"
env:role="http://example.org/ts-tests/C">foo</test:echoOk>
</env:Header>
<env:Body>
diff --git a/ext/soap/tests/soap12/T38_2.phpt b/ext/soap/tests/soap12/T38_2.phpt
index efff2f4db3..8408ab783f 100644
--- a/ext/soap/tests/soap12/T38_2.phpt
+++ b/ext/soap/tests/soap12/T38_2.phpt
@@ -6,13 +6,13 @@ SOAP 1.2: T38.2 doubleHdr
<?php
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' ?>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header>
<test:echoOk xmlns:test="http://example.org/ts-tests"
- env:mustUnderstand="true"
+ env:mustUnderstand="true"
env:role="http://example.org/ts-tests/C">foo</test:echoOk>
<test:echoOk xmlns:test="http://example.org/ts-tests"
- env:mustUnderstand="1"
+ env:mustUnderstand="1"
env:role="http://example.org/ts-tests/C">bar</test:echoOk>
</env:Header>
<env:Body>
diff --git a/ext/soap/tests/soap12/T39.phpt b/ext/soap/tests/soap12/T39.phpt
index 2b29562aba..f4ddcc9d20 100644
--- a/ext/soap/tests/soap12/T39.phpt
+++ b/ext/soap/tests/soap12/T39.phpt
@@ -6,7 +6,7 @@ SOAP 1.2: T39 unknownHdr
<?php
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' ?>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header>
<test:Unknown xmlns:test="http://example.org/ts-tests"
env:mustUnderstand="9">foo</test:Unknown>
diff --git a/ext/soap/tests/soap12/T40.phpt b/ext/soap/tests/soap12/T40.phpt
index 332e5768dd..2814309321 100644
--- a/ext/soap/tests/soap12/T40.phpt
+++ b/ext/soap/tests/soap12/T40.phpt
@@ -6,10 +6,10 @@ SOAP 1.2: T40 echoOK
<?php
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' ?>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header>
<test:Unknown xmlns:test="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]/ts-tests"
- env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver"
+ env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver"
env:mustUnderstand="false">
foo
</test:Unknown>
diff --git a/ext/soap/tests/soap12/T46.phpt b/ext/soap/tests/soap12/T46.phpt
index 8098ef72e7..fbbf543fdf 100644
--- a/ext/soap/tests/soap12/T46.phpt
+++ b/ext/soap/tests/soap12/T46.phpt
@@ -10,7 +10,7 @@ $HTTP_RAW_POST_DATA = <<<EOF
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<env:Body>
- <test:echoNestedArray xmlns:test="http://exaple.org/ts-tests"
+ <test:echoNestedArray xmlns:test="http://example.org/ts-tests"
env:encodingStyle="http://www.w3.org/2003/05/soap-encoding">
<inputStruct xsi:type="ns1:SOAPArrayStruct"
xmlns:ns1="http://example.org/ts-tests/xsd">
@@ -18,7 +18,7 @@ $HTTP_RAW_POST_DATA = <<<EOF
<varFloat xsi:type="xsd:float">0.005</varFloat>
<varString xsi:type="xsd:string">hello world</varString>
<varArray enc:itemType="xsd:string" enc:arraySize="3"
- xmlns:enc="http://www.w3.org/2003/05/soap-encoding">
+ xmlns:enc="http://www.w3.org/2003/05/soap-encoding">
<item xsi:type="xsd:string">red</item>
<item xsi:type="xsd:string">blue</item>
<item xsi:type="xsd:string">green</item>
diff --git a/ext/soap/tests/soap12/T49.phpt b/ext/soap/tests/soap12/T49.phpt
index 9687d03b94..01ac0e679f 100644
--- a/ext/soap/tests/soap12/T49.phpt
+++ b/ext/soap/tests/soap12/T49.phpt
@@ -7,7 +7,7 @@ SOAP 1.2: T49 echoStringArray
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version="1.0"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<env:Body>
<test:echoStringArray xmlns:test="http://example.org/ts-tests"
diff --git a/ext/soap/tests/soap12/T50.phpt b/ext/soap/tests/soap12/T50.phpt
index e3fcc0c316..66263abcb7 100644
--- a/ext/soap/tests/soap12/T50.phpt
+++ b/ext/soap/tests/soap12/T50.phpt
@@ -7,7 +7,7 @@ SOAP 1.2: T50 echoIntegerArray
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version="1.0"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<env:Body>
<test:echoIntegerArray xmlns:test="http://example.org/ts-tests"
diff --git a/ext/soap/tests/soap12/T52.phpt b/ext/soap/tests/soap12/T52.phpt
index 9d75fb9823..7cd229b741 100644
--- a/ext/soap/tests/soap12/T52.phpt
+++ b/ext/soap/tests/soap12/T52.phpt
@@ -7,7 +7,7 @@ SOAP 1.2: T52 echoBoolean
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version="1.0"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<env:Body>
<test:echoBoolean xmlns:test="http://example.org/ts-tests"
diff --git a/ext/soap/tests/soap12/T53.phpt b/ext/soap/tests/soap12/T53.phpt
index c1c8fe63aa..5bff2c775f 100644
--- a/ext/soap/tests/soap12/T53.phpt
+++ b/ext/soap/tests/soap12/T53.phpt
@@ -7,7 +7,7 @@ SOAP 1.2: T53 echoDate
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<env:Body>
<test:echoDate xmlns:test="http://example.org/ts-tests"
diff --git a/ext/soap/tests/soap12/T54.phpt b/ext/soap/tests/soap12/T54.phpt
index ba3ed35526..ac33859a75 100644
--- a/ext/soap/tests/soap12/T54.phpt
+++ b/ext/soap/tests/soap12/T54.phpt
@@ -7,7 +7,7 @@ SOAP 1.2: T54 echoDecimal
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<env:Body>
<test:echoDecimal xmlns:test="http://example.org/ts-tests"
diff --git a/ext/soap/tests/soap12/T55.phpt b/ext/soap/tests/soap12/T55.phpt
index 1c12e504f2..5e362854f9 100644
--- a/ext/soap/tests/soap12/T55.phpt
+++ b/ext/soap/tests/soap12/T55.phpt
@@ -7,7 +7,7 @@ SOAP 1.2: T55 echoFloat
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version="1.0"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<env:Body>
<test:echoFloat xmlns:test="http://example.org/ts-tests"
diff --git a/ext/soap/tests/soap12/T58.phpt b/ext/soap/tests/soap12/T58.phpt
index aa53985486..9878baeacf 100644
--- a/ext/soap/tests/soap12/T58.phpt
+++ b/ext/soap/tests/soap12/T58.phpt
@@ -6,16 +6,16 @@ SOAP 1.2: T58 echoIntegerArray
<?php
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' ?>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<env:Body>
- <test:echoIntegerArray xmlns:test="http://example.org/ts-tests"
+ <test:echoIntegerArray xmlns:test="http://example.org/ts-tests"
env:encodingStyle="http://www.w3.org/2003/05/soap-encoding">
<inputIntegerArray enc:itemType="xsd:int" enc:arraySize="1"
xmlns:enc="http://www.w3.org/2003/05/soap-encoding">
<a><b>1</b></a>
- </inputIntegerArray>
+ </inputIntegerArray>
</test:echoIntegerArray>
</env:Body>
</env:Envelope>
diff --git a/ext/soap/tests/soap12/T59.phpt b/ext/soap/tests/soap12/T59.phpt
index 2ceef325bb..4c0ec5a382 100644
--- a/ext/soap/tests/soap12/T59.phpt
+++ b/ext/soap/tests/soap12/T59.phpt
@@ -7,12 +7,12 @@ SOAP 1.2: T59 echoStringArray
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version="1.0"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<env:Body>
<test:echoStringArray xmlns:test="http://example.org/ts-tests"
env:encodingStyle="http://www.w3.org/2003/05/soap-encoding">
- <inputStringArray enc:itemType="xsd:string"
+ <inputStringArray enc:itemType="xsd:string"
xmlns:enc="http://www.w3.org/2003/05/soap-encoding">
<item enc:id="data" xsi:type="xsd:string" enc:ref="#data">hello</item>
<item>world</item>
diff --git a/ext/soap/tests/soap12/T63.phpt b/ext/soap/tests/soap12/T63.phpt
index 5a41ef0109..72b9ca35f5 100644
--- a/ext/soap/tests/soap12/T63.phpt
+++ b/ext/soap/tests/soap12/T63.phpt
@@ -6,7 +6,7 @@ SOAP 1.2: T63 validateCountryCode
<?php
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' ?>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header>
<test:validateCountryCode xmlns:test="http://example.org/ts-tests"
env:role="http://example.org/ts-tests/C"
diff --git a/ext/soap/tests/soap12/T64.phpt b/ext/soap/tests/soap12/T64.phpt
index 24e62ecb6b..932c112d83 100644
--- a/ext/soap/tests/soap12/T64.phpt
+++ b/ext/soap/tests/soap12/T64.phpt
@@ -9,7 +9,7 @@ $HTTP_RAW_POST_DATA = <<<EOF
<!DOCTYPE DOC [
<!NOTATION application_xml SYSTEM 'http://www.isi.edu/in-notes/iana/assignments/media-types/application/xml'>
]>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Body>
<test:echoOk xmlns:test="http://example.org/ts-tests">
foo
diff --git a/ext/soap/tests/soap12/T65.phpt b/ext/soap/tests/soap12/T65.phpt
index cd96d4a82f..e89ce995d8 100644
--- a/ext/soap/tests/soap12/T65.phpt
+++ b/ext/soap/tests/soap12/T65.phpt
@@ -11,7 +11,7 @@ $HTTP_RAW_POST_DATA = <<<EOF
<!ELEMENT Body (echoOk) >
<!ELEMENT echoOk (#PCDATA) >
]>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Body>
<test:echoOk xmlns:test="http://example.org/ts-tests">
foo
diff --git a/ext/soap/tests/soap12/T66.phpt b/ext/soap/tests/soap12/T66.phpt
index cc7cc2e3e3..23586b8ee7 100644
--- a/ext/soap/tests/soap12/T66.phpt
+++ b/ext/soap/tests/soap12/T66.phpt
@@ -6,7 +6,7 @@ SOAP 1.2: T66 echoOk
<?php
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' encoding='UTF8'?>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header>
<test:echoOk xmlns:test="http://example.org/ts-tests"
env:role="http://www.w3.org/2003/05/soap-envelope/role/next">foo</test:echoOk>
diff --git a/ext/soap/tests/soap12/T67.phpt b/ext/soap/tests/soap12/T67.phpt
index ddc527a6ec..dd197a1b82 100644
--- a/ext/soap/tests/soap12/T67.phpt
+++ b/ext/soap/tests/soap12/T67.phpt
@@ -6,7 +6,7 @@ SOAP 1.2: T67 echoOk
<?php
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' standalone='yes'?>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header>
<test:echoOk xmlns:test="http://example.org/ts-tests"
env:role="http://www.w3.org/2003/05/soap-envelope/role/next">foo</test:echoOk>
diff --git a/ext/soap/tests/soap12/T68.phpt b/ext/soap/tests/soap12/T68.phpt
index acf4230973..0dfa08ff16 100644
--- a/ext/soap/tests/soap12/T68.phpt
+++ b/ext/soap/tests/soap12/T68.phpt
@@ -5,7 +5,7 @@ SOAP 1.2: T68 echoOk
--FILE--
<?php
$HTTP_RAW_POST_DATA = <<<EOF
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header >
diff --git a/ext/soap/tests/soap12/T69.phpt b/ext/soap/tests/soap12/T69.phpt
index 0fb02dec06..8a64745f95 100644
--- a/ext/soap/tests/soap12/T69.phpt
+++ b/ext/soap/tests/soap12/T69.phpt
@@ -8,7 +8,7 @@ $HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' ?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header>
- <test:echoOk xmlns:test="http://example.org/ts-tests">foo</test:echoOk>
+ <test:echoOk xmlns:test="http://example.org/ts-tests">foo</test:echoOk>
</env:Header>
</env:Envelope>
EOF;
diff --git a/ext/soap/tests/soap12/T70.phpt b/ext/soap/tests/soap12/T70.phpt
index 3622c320e7..9b665bf176 100644
--- a/ext/soap/tests/soap12/T70.phpt
+++ b/ext/soap/tests/soap12/T70.phpt
@@ -8,7 +8,7 @@ $HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' ?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header>
- <test:echoOk xmlns:test="http://example.org/ts-tests">foo</test:echoOk>
+ <test:echoOk xmlns:test="http://example.org/ts-tests">foo</test:echoOk>
</env:Header>
<env:Body>
</env:Body>
diff --git a/ext/soap/tests/soap12/T71.phpt b/ext/soap/tests/soap12/T71.phpt
index fdb5b8d460..dffaf585d3 100644
--- a/ext/soap/tests/soap12/T71.phpt
+++ b/ext/soap/tests/soap12/T71.phpt
@@ -9,7 +9,7 @@ $HTTP_RAW_POST_DATA = <<<EOF
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
attr1="a-value">
<env:Header>
- <test:echoOk xmlns:test="http://example.org/ts-tests">
+ <test:echoOk xmlns:test="http://example.org/ts-tests">
foo
</test:echoOk>
</env:Header>
diff --git a/ext/soap/tests/soap12/T72.phpt b/ext/soap/tests/soap12/T72.phpt
index b8f5060c6b..3b4db8c3f3 100644
--- a/ext/soap/tests/soap12/T72.phpt
+++ b/ext/soap/tests/soap12/T72.phpt
@@ -6,7 +6,7 @@ SOAP 1.2: T72 echoOk
<?php
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' ?>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
env:encodingStyle="http://www.w3.org/2003/05/soap-encoding">
<env:Body>
<test:echoOk xmlns:test="http://example.org/ts-tests">
diff --git a/ext/soap/tests/soap12/T74.phpt b/ext/soap/tests/soap12/T74.phpt
index 703e1870a6..4f210b642e 100644
--- a/ext/soap/tests/soap12/T74.phpt
+++ b/ext/soap/tests/soap12/T74.phpt
@@ -6,12 +6,12 @@ SOAP 1.2: T74 doubleHdr
<?php
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' ?>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header>
<test:echoOk xmlns:test="http://example.org/ts-tests"
env:role="http://www.w3.org/2003/05/soap-envelope/role/next">foo</test:echoOk>
<test:Unknown xmlns:test="http://example.org/ts-tests">
- <test:raiseFault env:mustUnderstand="1"
+ <test:raiseFault env:mustUnderstand="1"
env:role="http://www.w3.org/2003/05/soap-envelope/role/next">
</test:raiseFault>
</test:Unknown>
diff --git a/ext/soap/tests/soap12/T75.phpt b/ext/soap/tests/soap12/T75.phpt
index 3e2166d957..cdee965db0 100644
--- a/ext/soap/tests/soap12/T75.phpt
+++ b/ext/soap/tests/soap12/T75.phpt
@@ -6,7 +6,7 @@ SOAP 1.2: T75 echoResolvedRef
<?php
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' ?>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header>
<test:echoResolvedRef xmlns:test="http://example.org/ts-tests"
env:role="http://www.w3.org/2003/05/soap-envelope/role/next"
diff --git a/ext/soap/tests/soap12/T76_1.phpt b/ext/soap/tests/soap12/T76_1.phpt
index e97c179768..87f4c55f09 100644
--- a/ext/soap/tests/soap12/T76_1.phpt
+++ b/ext/soap/tests/soap12/T76_1.phpt
@@ -6,7 +6,7 @@ SOAP 1.2: T76.1 echoString
<?php
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' ?>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<env:Body>
diff --git a/ext/soap/tests/soap12/T77_1.phpt b/ext/soap/tests/soap12/T77_1.phpt
index d847b6cfd8..3cf3f4358a 100644
--- a/ext/soap/tests/soap12/T77_1.phpt
+++ b/ext/soap/tests/soap12/T77_1.phpt
@@ -6,7 +6,7 @@ SOAP 1.2: T77.1 isNil
<?php
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' ?>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<env:Body>
diff --git a/ext/soap/tests/soap12/T77_2.phpt b/ext/soap/tests/soap12/T77_2.phpt
index c829b57892..4d18b374dc 100644
--- a/ext/soap/tests/soap12/T77_2.phpt
+++ b/ext/soap/tests/soap12/T77_2.phpt
@@ -6,7 +6,7 @@ SOAP 1.2: T77.2 isNil
<?php
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' ?>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<env:Body>
diff --git a/ext/soap/tests/soap12/T77_3.phpt b/ext/soap/tests/soap12/T77_3.phpt
index 0e1355a5a2..1242daf0ea 100644
--- a/ext/soap/tests/soap12/T77_3.phpt
+++ b/ext/soap/tests/soap12/T77_3.phpt
@@ -6,7 +6,7 @@ SOAP 1.2: T77.3 isNul
<?php
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' ?>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<env:Body>
diff --git a/ext/soap/tests/soap12/T78.phpt b/ext/soap/tests/soap12/T78.phpt
index 63d13c7cae..228a88ad43 100644
--- a/ext/soap/tests/soap12/T78.phpt
+++ b/ext/soap/tests/soap12/T78.phpt
@@ -6,7 +6,7 @@ SOAP 1.2: T78 echoOk
<?php
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version='1.0' ?>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header>
<test:echoOk xmlns:test="http://example.org/ts-tests"
env:role="http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver">foo</test:echoOk>
diff --git a/ext/soap/tests/soap12/T80.phpt b/ext/soap/tests/soap12/T80.phpt
index 1ac114ba32..e987338ea8 100644
--- a/ext/soap/tests/soap12/T80.phpt
+++ b/ext/soap/tests/soap12/T80.phpt
@@ -6,7 +6,7 @@ SOAP 1.2: T80 echoOk
<?php
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version="1.0"?>
-<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Body>
<test:echoOk xmlns:test="http://example.org/ts-tests" env:encodingStyle="http://example.org/PoisonEncoding">foo</test:echoOk>
</env:Body>
diff --git a/ext/soap/tests/soap12/soap12-test.inc b/ext/soap/tests/soap12/soap12-test.inc
index e27712241f..550494e516 100644
--- a/ext/soap/tests/soap12/soap12-test.inc
+++ b/ext/soap/tests/soap12/soap12-test.inc
@@ -1,124 +1,124 @@
<?php
class Soap12test {
- public $header;
+ public $header;
- function echoOk($x) {
- return $x;
- }
+ function echoOk($x) {
+ return $x;
+ }
- function echoString($inputString) {
- return $inputString;
- }
+ function echoString($inputString) {
+ return $inputString;
+ }
- function echoStringArray($inputStringArray) {
- return $inputStringArray;
- }
+ function echoStringArray($inputStringArray) {
+ return $inputStringArray;
+ }
- function echoInteger($inputInteger) {
- return $inputInteger;
- }
+ function echoInteger($inputInteger) {
+ return $inputInteger;
+ }
- function echoIntegerArray($inputIntegerArray) {
- return $inputIntegerArray;
- }
+ function echoIntegerArray($inputIntegerArray) {
+ return $inputIntegerArray;
+ }
- function echoFloat($inputFloat) {
- return $inputFloat;
- }
+ function echoFloat($inputFloat) {
+ return $inputFloat;
+ }
- function echoFloatArray($inputFloatArray) {
- return $inputFloatArray;
+ function echoFloatArray($inputFloatArray) {
+ return $inputFloatArray;
}
- function echoStruct($x) {
- return $x;
- }
+ function echoStruct($x) {
+ return $x;
+ }
- function echoStructArray($x) {
- return $x;
- }
+ function echoStructArray($x) {
+ return $x;
+ }
- function echoVoid() {
- return NULL;
- }
+ function echoVoid() {
+ return NULL;
+ }
- function echoBase64($b_encoded) {
- return $b_encoded;
+ function echoBase64($b_encoded) {
+ return $b_encoded;
}
- function echoDate($timeInstant) {
- return $timeInstant;
- }
-
- function echoHexBinary($hb) {
- return $hb;
- }
-
- function echoDecimal($dec) {
- return $dec;
- }
-
- function echoBoolean($boolean) {
- return $boolean;
- }
-
- function echoStructAsSimpleTypes ($struct) {
- return array('outputString' => $struct->varString,
- 'outputInteger' => $struct->varInt,
- 'outputFloat' => $struct->varFloat);
- }
-
- function echoSimpleTypesAsStruct($string, $int, $float) {
- return (object)array("varString" => $string,
- "varInt" => $int,
- "varFloat" => $float);
- }
-
- function echoNestedStruct($struct) {
- return $struct;
- }
-
- function echo2DStringArray($ary) {
- return $ary;
- }
-
- function echoNestedArray($ary) {
- return $ary;
- }
-
- function countItems($input) {
- return count($input);
- }
-
- function isNil($input=NULL) {
- return is_null($input);
- }
-
- function returnVoid() {
- }
-
- function emptyBody() {
- }
-
- function requiredHeader($x) {
- $this->header = $x;
- }
-
- function echoHeader() {
- return $this->header;
- }
-
- function echoResolvedRef($ref) {
- return $ref->RelativeReference->base.$ref->RelativeReference->href;
- }
-
- function validateCountryCode($code) {
- if (strlen($code) != 2) {
- return new SoapFault("Client", "Not a valid country code", NULL, NULL, NULL, new SoapHeader("http://example.org/ts-tests", "validateCountryCodeFault", "Country code must be 2 letters."));
- } else {
- return "OK";
- }
- }
+ function echoDate($timeInstant) {
+ return $timeInstant;
+ }
+
+ function echoHexBinary($hb) {
+ return $hb;
+ }
+
+ function echoDecimal($dec) {
+ return $dec;
+ }
+
+ function echoBoolean($boolean) {
+ return $boolean;
+ }
+
+ function echoStructAsSimpleTypes ($struct) {
+ return array('outputString' => $struct->varString,
+ 'outputInteger' => $struct->varInt,
+ 'outputFloat' => $struct->varFloat);
+ }
+
+ function echoSimpleTypesAsStruct($string, $int, $float) {
+ return (object)array("varString" => $string,
+ "varInt" => $int,
+ "varFloat" => $float);
+ }
+
+ function echoNestedStruct($struct) {
+ return $struct;
+ }
+
+ function echo2DStringArray($ary) {
+ return $ary;
+ }
+
+ function echoNestedArray($ary) {
+ return $ary;
+ }
+
+ function countItems($input) {
+ return count($input);
+ }
+
+ function isNil($input=NULL) {
+ return is_null($input);
+ }
+
+ function returnVoid() {
+ }
+
+ function emptyBody() {
+ }
+
+ function requiredHeader($x) {
+ $this->header = $x;
+ }
+
+ function echoHeader() {
+ return $this->header;
+ }
+
+ function echoResolvedRef($ref) {
+ return $ref->RelativeReference->base.$ref->RelativeReference->href;
+ }
+
+ function validateCountryCode($code) {
+ if (strlen($code) != 2) {
+ return new SoapFault("Client", "Not a valid country code", NULL, NULL, NULL, new SoapHeader("http://example.org/ts-tests", "validateCountryCodeFault", "Country code must be 2 letters."));
+ } else {
+ return "OK";
+ }
+ }
}
diff --git a/ext/soap/tests/typemap001.phpt b/ext/soap/tests/typemap001.phpt
index c582406f41..04c72eb836 100644
--- a/ext/soap/tests/typemap001.phpt
+++ b/ext/soap/tests/typemap001.phpt
@@ -8,11 +8,11 @@ soap.wsdl_cache_enabled=0
--FILE--
<?php
$GLOBALS['HTTP_RAW_POST_DATA']="
-<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"
- xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
- xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
- xmlns:enc=\"http://schemas.xmlsoap.org/soap/encoding/\"
- xmlns:ns1=\"http://schemas.nothing.com\"
+<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"
+ xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
+ xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
+ xmlns:enc=\"http://schemas.xmlsoap.org/soap/encoding/\"
+ xmlns:ns1=\"http://schemas.nothing.com\"
>
<env:Body>
<ns1:dotest>
@@ -26,31 +26,31 @@ $GLOBALS['HTTP_RAW_POST_DATA']="
</env:Envelope>";
function book_from_xml($xml) {
- $sxe = simplexml_load_string($xml);
- $obj = new book;
- $obj->a = (string)$sxe->a;
- $obj->b = (string)$sxe->b;
- return $obj;
+ $sxe = simplexml_load_string($xml);
+ $obj = new book;
+ $obj->a = (string)$sxe->a;
+ $obj->b = (string)$sxe->b;
+ return $obj;
}
class test{
- function dotest($book){
- $classname=get_class($book);
- return "Object: ".$classname. "(".$book->a.",".$book->b.")";
- }
+ function dotest($book){
+ $classname=get_class($book);
+ return "Object: ".$classname. "(".$book->a.",".$book->b.")";
+ }
}
class book{
- public $a="a";
- public $b="c";
+ public $a="a";
+ public $b="c";
}
$options=Array(
- 'actor' =>'http://schemas.nothing.com',
- 'typemap' => array(array("type_ns" => "http://schemas.nothing.com",
- "type_name" => "book",
- "from_xml" => "book_from_xml"))
- );
+ 'actor' =>'http://schemas.nothing.com',
+ 'typemap' => array(array("type_ns" => "http://schemas.nothing.com",
+ "type_name" => "book",
+ "from_xml" => "book_from_xml"))
+ );
$server = new SoapServer(__DIR__."/classmap.wsdl",$options);
$server->setClass("test");
diff --git a/ext/soap/tests/typemap002.phpt b/ext/soap/tests/typemap002.phpt
index 84ef043ac3..551d8ee71f 100644
--- a/ext/soap/tests/typemap002.phpt
+++ b/ext/soap/tests/typemap002.phpt
@@ -7,11 +7,11 @@ soap.wsdl_cache_enabled=0
--FILE--
<?php
$GLOBALS['HTTP_RAW_POST_DATA']="
-<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"
- xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
- xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
- xmlns:enc=\"http://schemas.xmlsoap.org/soap/encoding/\"
- xmlns:ns1=\"http://schemas.nothing.com\"
+<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"
+ xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
+ xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
+ xmlns:enc=\"http://schemas.xmlsoap.org/soap/encoding/\"
+ xmlns:ns1=\"http://schemas.nothing.com\"
>
<env:Body>
<ns1:dotest2>
@@ -22,30 +22,30 @@ $GLOBALS['HTTP_RAW_POST_DATA']="
</env:Envelope>";
function book_to_xml($book) {
- return '<book xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><a xsi:type="xsd:string">'.$book->a.'!</a><b xsi:type="xsd:string">'.$book->b.'!</b></book>';
+ return '<book xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><a xsi:type="xsd:string">'.$book->a.'!</a><b xsi:type="xsd:string">'.$book->b.'!</b></book>';
}
class test{
- function dotest2($str){
- $book = new book;
- $book->a = "foo";
- $book->b = "bar";
- return $book;
- }
+ function dotest2($str){
+ $book = new book;
+ $book->a = "foo";
+ $book->b = "bar";
+ return $book;
+ }
}
class book{
- public $a="a";
- public $b="c";
+ public $a="a";
+ public $b="c";
}
$options=Array(
- 'actor' =>'http://schemas.nothing.com',
- 'typemap' => array(array("type_ns" => "http://schemas.nothing.com",
- "type_name" => "book",
- "to_xml" => "book_to_xml"))
- );
+ 'actor' =>'http://schemas.nothing.com',
+ 'typemap' => array(array("type_ns" => "http://schemas.nothing.com",
+ "type_name" => "book",
+ "to_xml" => "book_to_xml"))
+ );
$server = new SoapServer(__DIR__."/classmap.wsdl",$options);
$server->setClass("test");
diff --git a/ext/soap/tests/typemap003.phpt b/ext/soap/tests/typemap003.phpt
index 0770d1be67..2cd0ac64e4 100644
--- a/ext/soap/tests/typemap003.phpt
+++ b/ext/soap/tests/typemap003.phpt
@@ -9,7 +9,7 @@ soap.wsdl_cache_enabled=0
<?php
class TestSoapClient extends SoapClient{
function __doRequest($request, $location, $action, $version, $one_way = 0) {
- return <<<EOF
+ return <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.nothing.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body>
<ns1:dotest2Response><res xsi:type="ns1:book">
@@ -18,29 +18,29 @@ class TestSoapClient extends SoapClient{
</res>
</ns1:dotest2Response></SOAP-ENV:Body></SOAP-ENV:Envelope>
EOF;
- }
+ }
}
class book{
- public $a="a";
- public $b="c";
+ public $a="a";
+ public $b="c";
}
function book_from_xml($xml) {
- $sxe = simplexml_load_string($xml);
- $obj = new book;
- $obj->a = (string)$sxe->a;
- $obj->b = (string)$sxe->b;
- return $obj;
+ $sxe = simplexml_load_string($xml);
+ $obj = new book;
+ $obj->a = (string)$sxe->a;
+ $obj->b = (string)$sxe->b;
+ return $obj;
}
$options=Array(
- 'actor' =>'http://schemas.nothing.com',
- 'typemap' => array(array("type_ns" => "http://schemas.nothing.com",
- "type_name" => "book",
- "from_xml" => "book_from_xml"))
- );
+ 'actor' =>'http://schemas.nothing.com',
+ 'typemap' => array(array("type_ns" => "http://schemas.nothing.com",
+ "type_name" => "book",
+ "from_xml" => "book_from_xml"))
+ );
$client = new TestSoapClient(__DIR__."/classmap.wsdl",$options);
$ret = $client->dotest2("???");
diff --git a/ext/soap/tests/typemap004.phpt b/ext/soap/tests/typemap004.phpt
index 07d489db95..bf0a643abe 100644
--- a/ext/soap/tests/typemap004.phpt
+++ b/ext/soap/tests/typemap004.phpt
@@ -8,27 +8,27 @@ soap.wsdl_cache_enabled=0
<?php
class TestSoapClient extends SoapClient{
function __doRequest($request, $location, $action, $version, $one_way = 0) {
- echo $request;
- exit;
- }
+ echo $request;
+ exit;
+ }
}
class book{
- public $a="a";
- public $b="c";
+ public $a="a";
+ public $b="c";
}
function book_to_xml($book) {
- return '<book xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><a xsi:type="xsd:string">'.$book->a.'!</a><b xsi:type="xsd:string">'.$book->b.'!</b></book>';
+ return '<book xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><a xsi:type="xsd:string">'.$book->a.'!</a><b xsi:type="xsd:string">'.$book->b.'!</b></book>';
}
$options=Array(
- 'actor' =>'http://schemas.nothing.com',
- 'typemap' => array(array("type_ns" => "http://schemas.nothing.com",
- "type_name" => "book",
- "to_xml" => "book_to_xml"))
- );
+ 'actor' =>'http://schemas.nothing.com',
+ 'typemap' => array(array("type_ns" => "http://schemas.nothing.com",
+ "type_name" => "book",
+ "to_xml" => "book_to_xml"))
+ );
$client = new TestSoapClient(__DIR__."/classmap.wsdl",$options);
$book = new book();
diff --git a/ext/soap/tests/typemap005.phpt b/ext/soap/tests/typemap005.phpt
index 5a8319fab7..4a4c81c118 100644
--- a/ext/soap/tests/typemap005.phpt
+++ b/ext/soap/tests/typemap005.phpt
@@ -8,11 +8,11 @@ soap.wsdl_cache_enabled=0
--FILE--
<?php
$GLOBALS['HTTP_RAW_POST_DATA']="
-<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"
- xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
- xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
- xmlns:enc=\"http://schemas.xmlsoap.org/soap/encoding/\"
- xmlns:ns1=\"http://schemas.nothing.com\"
+<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"
+ xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
+ xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
+ xmlns:enc=\"http://schemas.xmlsoap.org/soap/encoding/\"
+ xmlns:ns1=\"http://schemas.nothing.com\"
>
<env:Body>
<ns1:dotest>
@@ -26,32 +26,32 @@ $GLOBALS['HTTP_RAW_POST_DATA']="
</env:Envelope>";
function book_from_xml($xml) {
- $sxe = simplexml_load_string($xml);
- $obj = new book;
- $obj->a = (string)$sxe->a;
- $obj->b = (string)$sxe->b;
- return $obj;
+ $sxe = simplexml_load_string($xml);
+ $obj = new book;
+ $obj->a = (string)$sxe->a;
+ $obj->b = (string)$sxe->b;
+ return $obj;
}
class test{
- function dotest($book){
- $classname=get_class($book);
- return "Object: ".$classname. "(".$book->a.",".$book->b.")";
- }
+ function dotest($book){
+ $classname=get_class($book);
+ return "Object: ".$classname. "(".$book->a.",".$book->b.")";
+ }
}
class book{
- public $a="a";
- public $b="c";
+ public $a="a";
+ public $b="c";
}
$options=Array(
- 'uri' => "http://schemas.nothing.com",
- 'actor' => 'http://schemas.nothing.com',
- 'typemap' => array(array("type_ns" => "http://schemas.nothing.com",
- "type_name" => "book",
- "from_xml" => "book_from_xml"))
- );
+ 'uri' => "http://schemas.nothing.com",
+ 'actor' => 'http://schemas.nothing.com',
+ 'typemap' => array(array("type_ns" => "http://schemas.nothing.com",
+ "type_name" => "book",
+ "from_xml" => "book_from_xml"))
+ );
$server = new SoapServer(NULL,$options);
$server->setClass("test");
diff --git a/ext/soap/tests/typemap006.phpt b/ext/soap/tests/typemap006.phpt
index 9de9e245d2..ca8c3351e8 100644
--- a/ext/soap/tests/typemap006.phpt
+++ b/ext/soap/tests/typemap006.phpt
@@ -7,11 +7,11 @@ soap.wsdl_cache_enabled=0
--FILE--
<?php
$GLOBALS['HTTP_RAW_POST_DATA']="
-<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"
- xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
- xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
- xmlns:enc=\"http://schemas.xmlsoap.org/soap/encoding/\"
- xmlns:ns1=\"http://schemas.nothing.com\"
+<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"
+ xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
+ xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
+ xmlns:enc=\"http://schemas.xmlsoap.org/soap/encoding/\"
+ xmlns:ns1=\"http://schemas.nothing.com\"
>
<env:Body>
<ns1:dotest2>
@@ -22,31 +22,31 @@ $GLOBALS['HTTP_RAW_POST_DATA']="
</env:Envelope>";
function book_to_xml($book) {
- return '<book xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><a xsi:type="xsd:string">'.$book->a.'!</a><b xsi:type="xsd:string">'.$book->b.'!</b></book>';
+ return '<book xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><a xsi:type="xsd:string">'.$book->a.'!</a><b xsi:type="xsd:string">'.$book->b.'!</b></book>';
}
class test{
- function dotest2($str){
- $book = new book;
- $book->a = "foo";
- $book->b = "bar";
- return new SoapVar($book, null, "book", "http://schemas.nothing.com");
- }
+ function dotest2($str){
+ $book = new book;
+ $book->a = "foo";
+ $book->b = "bar";
+ return new SoapVar($book, null, "book", "http://schemas.nothing.com");
+ }
}
class book{
- public $a="a";
- public $b="c";
+ public $a="a";
+ public $b="c";
}
$options=Array(
- 'uri' => "http://schemas.nothing.com",
- 'actor' => 'http://schemas.nothing.com',
- 'typemap' => array(array("type_ns" => "http://schemas.nothing.com",
- "type_name" => "book",
- "to_xml" => "book_to_xml"))
- );
+ 'uri' => "http://schemas.nothing.com",
+ 'actor' => 'http://schemas.nothing.com',
+ 'typemap' => array(array("type_ns" => "http://schemas.nothing.com",
+ "type_name" => "book",
+ "to_xml" => "book_to_xml"))
+ );
$server = new SoapServer(NULL,$options);
$server->setClass("test");
diff --git a/ext/soap/tests/typemap007.phpt b/ext/soap/tests/typemap007.phpt
index 1dd2becb61..5b7cbd10d7 100644
--- a/ext/soap/tests/typemap007.phpt
+++ b/ext/soap/tests/typemap007.phpt
@@ -9,7 +9,7 @@ soap.wsdl_cache_enabled=0
<?php
class TestSoapClient extends SoapClient{
function __doRequest($request, $location, $action, $version, $one_way = 0) {
- return <<<EOF
+ return <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.nothing.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body>
<ns1:dotest2Response><res xsi:type="ns1:book">
@@ -18,31 +18,31 @@ class TestSoapClient extends SoapClient{
</res>
</ns1:dotest2Response></SOAP-ENV:Body></SOAP-ENV:Envelope>
EOF;
- }
+ }
}
class book{
- public $a="a";
- public $b="c";
+ public $a="a";
+ public $b="c";
}
function book_from_xml($xml) {
- $sxe = simplexml_load_string($xml);
- $obj = new book;
- $obj->a = (string)$sxe->a;
- $obj->b = (string)$sxe->b;
- return $obj;
+ $sxe = simplexml_load_string($xml);
+ $obj = new book;
+ $obj->a = (string)$sxe->a;
+ $obj->b = (string)$sxe->b;
+ return $obj;
}
$options=Array(
'uri' => 'http://schemas.nothing.com',
'location' => 'test://',
- 'actor' => 'http://schemas.nothing.com',
- 'typemap' => array(array("type_ns" => "http://schemas.nothing.com",
- "type_name" => "book",
- "from_xml" => "book_from_xml"))
- );
+ 'actor' => 'http://schemas.nothing.com',
+ 'typemap' => array(array("type_ns" => "http://schemas.nothing.com",
+ "type_name" => "book",
+ "from_xml" => "book_from_xml"))
+ );
$client = new TestSoapClient(NULL, $options);
$ret = $client->dotest2("???");
diff --git a/ext/soap/tests/typemap008.phpt b/ext/soap/tests/typemap008.phpt
index 4ba1fb5bef..c4bd649f51 100644
--- a/ext/soap/tests/typemap008.phpt
+++ b/ext/soap/tests/typemap008.phpt
@@ -8,29 +8,29 @@ soap.wsdl_cache_enabled=0
<?php
class TestSoapClient extends SoapClient{
function __doRequest($request, $location, $action, $version, $one_way = 0) {
- echo $request;
- exit;
- }
+ echo $request;
+ exit;
+ }
}
class book{
- public $a="a";
- public $b="c";
+ public $a="a";
+ public $b="c";
}
function book_to_xml($book) {
- return '<book xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><a xsi:type="xsd:string">'.$book->a.'!</a><b xsi:type="xsd:string">'.$book->b.'!</b></book>';
+ return '<book xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><a xsi:type="xsd:string">'.$book->a.'!</a><b xsi:type="xsd:string">'.$book->b.'!</b></book>';
}
$options=Array(
'uri' => 'http://schemas.nothing.com',
'location' => 'test://',
- 'actor' => 'http://schemas.nothing.com',
- 'typemap' => array(array("type_ns" => "http://schemas.nothing.com",
- "type_name" => "book",
- "to_xml" => "book_to_xml"))
- );
+ 'actor' => 'http://schemas.nothing.com',
+ 'typemap' => array(array("type_ns" => "http://schemas.nothing.com",
+ "type_name" => "book",
+ "to_xml" => "book_to_xml"))
+ );
$client = new TestSoapClient(NULL, $options);
$book = new book();
diff --git a/ext/soap/tests/typemap009.phpt b/ext/soap/tests/typemap009.phpt
index 37e73edeca..a36a64136f 100644
--- a/ext/soap/tests/typemap009.phpt
+++ b/ext/soap/tests/typemap009.phpt
@@ -7,11 +7,11 @@ soap.wsdl_cache_enabled=0
--FILE--
<?php
$GLOBALS['HTTP_RAW_POST_DATA']="
-<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"
- xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
- xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
- xmlns:enc=\"http://schemas.xmlsoap.org/soap/encoding/\"
- xmlns:ns1=\"http://schemas.nothing.com\"
+<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"
+ xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
+ xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
+ xmlns:enc=\"http://schemas.xmlsoap.org/soap/encoding/\"
+ xmlns:ns1=\"http://schemas.nothing.com\"
>
<env:Body>
<ns1:dotest>
@@ -25,27 +25,27 @@ $GLOBALS['HTTP_RAW_POST_DATA']="
</env:Envelope>";
function book_from_xml($xml) {
- throw new SoapFault("Server", "Conversion Failed");
+ throw new SoapFault("Server", "Conversion Failed");
}
class test{
- function dotest($book){
- $classname=get_class($book);
- return "Object: ".$classname. "(".$book->a.",".$book->b.")";
- }
+ function dotest($book){
+ $classname=get_class($book);
+ return "Object: ".$classname. "(".$book->a.",".$book->b.")";
+ }
}
class book{
- public $a="a";
- public $b="c";
+ public $a="a";
+ public $b="c";
}
$options=Array(
- 'actor' =>'http://schemas.nothing.com',
- 'typemap' => array(array("type_ns" => "http://schemas.nothing.com",
- "type_name" => "book",
- "from_xml" => "book_from_xml"))
- );
+ 'actor' =>'http://schemas.nothing.com',
+ 'typemap' => array(array("type_ns" => "http://schemas.nothing.com",
+ "type_name" => "book",
+ "from_xml" => "book_from_xml"))
+ );
$server = new SoapServer(__DIR__."/classmap.wsdl",$options);
$server->setClass("test");
diff --git a/ext/soap/tests/typemap010.phpt b/ext/soap/tests/typemap010.phpt
index 46e9909a62..fde89a4603 100644
--- a/ext/soap/tests/typemap010.phpt
+++ b/ext/soap/tests/typemap010.phpt
@@ -7,11 +7,11 @@ soap.wsdl_cache_enabled=0
--FILE--
<?php
$GLOBALS['HTTP_RAW_POST_DATA']="
-<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"
- xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
- xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
- xmlns:enc=\"http://schemas.xmlsoap.org/soap/encoding/\"
- xmlns:ns1=\"http://schemas.nothing.com\"
+<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"
+ xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
+ xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
+ xmlns:enc=\"http://schemas.xmlsoap.org/soap/encoding/\"
+ xmlns:ns1=\"http://schemas.nothing.com\"
>
<env:Body>
<ns1:dotest2>
@@ -22,30 +22,30 @@ $GLOBALS['HTTP_RAW_POST_DATA']="
</env:Envelope>";
function book_to_xml($book) {
- throw new SoapFault("Server", "Conversion Fault");
+ throw new SoapFault("Server", "Conversion Fault");
}
class test{
- function dotest2($str){
- $book = new book;
- $book->a = "foo";
- $book->b = "bar";
- return $book;
- }
+ function dotest2($str){
+ $book = new book;
+ $book->a = "foo";
+ $book->b = "bar";
+ return $book;
+ }
}
class book{
- public $a="a";
- public $b="c";
+ public $a="a";
+ public $b="c";
}
$options=Array(
- 'actor' =>'http://schemas.nothing.com',
- 'typemap' => array(array("type_ns" => "http://schemas.nothing.com",
- "type_name" => "book",
- "to_xml" => "book_to_xml"))
- );
+ 'actor' =>'http://schemas.nothing.com',
+ 'typemap' => array(array("type_ns" => "http://schemas.nothing.com",
+ "type_name" => "book",
+ "to_xml" => "book_to_xml"))
+ );
$server = new SoapServer(__DIR__."/classmap.wsdl",$options);
$server->setClass("test");
diff --git a/ext/soap/tests/typemap011.phpt b/ext/soap/tests/typemap011.phpt
index ac6b9f3924..b0c75ce0c7 100644
--- a/ext/soap/tests/typemap011.phpt
+++ b/ext/soap/tests/typemap011.phpt
@@ -8,7 +8,7 @@ soap.wsdl_cache_enabled=0
<?php
class TestSoapClient extends SoapClient{
function __doRequest($request, $location, $action, $version, $one_way = 0) {
- return <<<EOF
+ return <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.nothing.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body>
<ns1:dotest2Response><res xsi:type="ns1:book">
@@ -17,31 +17,31 @@ class TestSoapClient extends SoapClient{
</res>
</ns1:dotest2Response></SOAP-ENV:Body></SOAP-ENV:Envelope>
EOF;
- }
+ }
}
class book{
- public $a="a";
- public $b="c";
+ public $a="a";
+ public $b="c";
}
function book_from_xml($xml) {
- throw new SoapFault("Client", "Conversion Error");
+ throw new SoapFault("Client", "Conversion Error");
}
$options=Array(
- 'actor' =>'http://schemas.nothing.com',
- 'typemap' => array(array("type_ns" => "http://schemas.nothing.com",
- "type_name" => "book",
- "from_xml" => "book_from_xml"))
- );
+ 'actor' =>'http://schemas.nothing.com',
+ 'typemap' => array(array("type_ns" => "http://schemas.nothing.com",
+ "type_name" => "book",
+ "from_xml" => "book_from_xml"))
+ );
$client = new TestSoapClient(__DIR__."/classmap.wsdl",$options);
try {
- $ret = $client->dotest2("???");
+ $ret = $client->dotest2("???");
} catch (SoapFault $e) {
- $ret = "SoapFault = " . $e->faultcode . " - " . $e->faultstring;
+ $ret = "SoapFault = " . $e->faultcode . " - " . $e->faultstring;
}
var_dump($ret);
echo "ok\n";
diff --git a/ext/soap/tests/typemap012.phpt b/ext/soap/tests/typemap012.phpt
index 837ae1fd80..039a4f9ba7 100644
--- a/ext/soap/tests/typemap012.phpt
+++ b/ext/soap/tests/typemap012.phpt
@@ -8,36 +8,36 @@ soap.wsdl_cache_enabled=0
<?php
class TestSoapClient extends SoapClient{
function __doRequest($request, $location, $action, $version, $one_way = 0) {
- echo $request;
- exit;
- }
+ echo $request;
+ exit;
+ }
}
class book{
- public $a="a";
- public $b="c";
+ public $a="a";
+ public $b="c";
}
function book_to_xml($book) {
- throw new SoapFault("Client", "Conversion Error");
+ throw new SoapFault("Client", "Conversion Error");
}
$options=Array(
- 'actor' =>'http://schemas.nothing.com',
- 'typemap' => array(array("type_ns" => "http://schemas.nothing.com",
- "type_name" => "book",
- "to_xml" => "book_to_xml"))
- );
+ 'actor' =>'http://schemas.nothing.com',
+ 'typemap' => array(array("type_ns" => "http://schemas.nothing.com",
+ "type_name" => "book",
+ "to_xml" => "book_to_xml"))
+ );
$client = new TestSoapClient(__DIR__."/classmap.wsdl",$options);
$book = new book();
$book->a = "foo";
$book->b = "bar";
try {
- $ret = $client->dotest($book);
+ $ret = $client->dotest($book);
} catch (SoapFault $e) {
- $ret = "SoapFault = " . $e->faultcode . " - " . $e->faultstring;
+ $ret = "SoapFault = " . $e->faultcode . " - " . $e->faultstring;
}
var_dump($ret);
echo "ok\n";
diff --git a/ext/soap/tests/typemap013.phpt b/ext/soap/tests/typemap013.phpt
index 6d414fdbc0..f73a257d75 100644
--- a/ext/soap/tests/typemap013.phpt
+++ b/ext/soap/tests/typemap013.phpt
@@ -7,11 +7,11 @@ soap.wsdl_cache_enabled=0
--FILE--
<?php
$GLOBALS['HTTP_RAW_POST_DATA']="
-<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"
- xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
- xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
- xmlns:enc=\"http://schemas.xmlsoap.org/soap/encoding/\"
- xmlns:ns1=\"http://schemas.nothing.com\"
+<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"
+ xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
+ xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
+ xmlns:enc=\"http://schemas.xmlsoap.org/soap/encoding/\"
+ xmlns:ns1=\"http://schemas.nothing.com\"
>
<env:Body>
<ns1:dotest2>
@@ -22,30 +22,30 @@ $GLOBALS['HTTP_RAW_POST_DATA']="
</env:Envelope>";
function book_to_xml($book) {
- return '<book xmlns="http://schemas.nothing.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><a xsi:type="xsd:string">'.$book->a.'!</a><b xsi:type="xsd:string">'.$book->b.'!</b></book>';
+ return '<book xmlns="http://schemas.nothing.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><a xsi:type="xsd:string">'.$book->a.'!</a><b xsi:type="xsd:string">'.$book->b.'!</b></book>';
}
class test{
- function dotest2($str){
- $book = new book;
- $book->a = "foo";
- $book->b = "bar";
- return $book;
- }
+ function dotest2($str){
+ $book = new book;
+ $book->a = "foo";
+ $book->b = "bar";
+ return $book;
+ }
}
class book{
- public $a="a";
- public $b="c";
+ public $a="a";
+ public $b="c";
}
$options=Array(
- 'actor' =>'http://schemas.nothing.com',
- 'typemap' => array(array("type_ns" => "http://schemas.nothing.com",
- "type_name" => "book",
- "to_xml" => "book_to_xml"))
- );
+ 'actor' =>'http://schemas.nothing.com',
+ 'typemap' => array(array("type_ns" => "http://schemas.nothing.com",
+ "type_name" => "book",
+ "to_xml" => "book_to_xml"))
+ );
$server = new SoapServer(__DIR__."/classmap.wsdl",$options);
$server->setClass("test");
diff --git a/ext/sockets/conversions.c b/ext/sockets/conversions.c
index b7dae45407..c23b04c591 100644
--- a/ext/sockets/conversions.c
+++ b/ext/sockets/conversions.c
@@ -36,16 +36,6 @@ struct _WSAMSG {
WSABUF Control; //void *msg_control, size_t msg_controllen
DWORD dwFlags; //int msg_flags
}
-struct __WSABUF {
- u_long len; //size_t iov_len (2nd member)
- char FAR *buf; //void *iov_base (1st member)
-}
-struct _WSACMSGHDR {
- UINT cmsg_len; //socklen_t cmsg_len
- INT cmsg_level; //int cmsg_level
- INT cmsg_type; //int cmsg_type;
- followed by UCHAR cmsg_data[]
-}
*/
# define msg_name name
# define msg_namelen namelen
@@ -57,7 +47,6 @@ struct _WSACMSGHDR {
# define iov_base buf
# define iov_len len
-# define cmsghdr _WSACMSGHDR
# ifdef CMSG_DATA
# undef CMSG_DATA
# endif
diff --git a/ext/sockets/multicast.c b/ext/sockets/multicast.c
index c6aa9f0c78..9c2ede219d 100644
--- a/ext/sockets/multicast.c
+++ b/ext/sockets/multicast.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -69,7 +67,7 @@ int php_string_to_if_index(const char *val, unsigned *out)
ind = if_nametoindex(val);
if (ind == 0) {
php_error_docref(NULL, E_WARNING,
- "no interface with name \"%s\" could be found", val);
+ "No interface with name \"%s\" could be found", val);
return FAILURE;
} else {
*out = ind;
@@ -77,7 +75,7 @@ int php_string_to_if_index(const char *val, unsigned *out)
}
#else
php_error_docref(NULL, E_WARNING,
- "this platform does not support looking up an interface by "
+ "This platform does not support looking up an interface by "
"name, an integer interface index must be supplied instead");
return FAILURE;
#endif
@@ -90,7 +88,7 @@ static int php_get_if_index_from_zval(zval *val, unsigned *out)
if (Z_TYPE_P(val) == IS_LONG) {
if (Z_LVAL_P(val) < 0 || (zend_ulong)Z_LVAL_P(val) > UINT_MAX) {
php_error_docref(NULL, E_WARNING,
- "the interface index cannot be negative or larger than %u;"
+ "The interface index cannot be negative or larger than %u;"
" given " ZEND_LONG_FMT, UINT_MAX, Z_LVAL_P(val));
ret = FAILURE;
} else {
@@ -129,7 +127,7 @@ static int php_get_address_from_array(const HashTable *ht, const char *key,
zend_string *str, *tmp_str;
if ((val = zend_hash_str_find(ht, key, strlen(key))) == NULL) {
- php_error_docref(NULL, E_WARNING, "no key \"%s\" passed in optval", key);
+ php_error_docref(NULL, E_WARNING, "No key \"%s\" passed in optval", key);
return FAILURE;
}
str = zval_get_tmp_string(val, &tmp_str);
@@ -223,7 +221,7 @@ mcast_req_fun:
#endif
default:
php_error_docref(NULL, E_WARNING,
- "unexpected option in php_do_mcast_opt (level %d, option %d). "
+ "Unexpected option in php_do_mcast_opt (level %d, option %d). "
"This is a bug.", level, optname);
return FAILURE;
}
diff --git a/ext/sockets/multicast.h b/ext/sockets/multicast.h
index 256af0c66c..98a19ba54c 100644
--- a/ext/sockets/multicast.h
+++ b/ext/sockets/multicast.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/sockets/php_sockets.h b/ext/sockets/php_sockets.h
index c1aba9dc98..7f67040ce3 100644
--- a/ext/sockets/php_sockets.h
+++ b/ext/sockets/php_sockets.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/sockets/sendrecvmsg.c b/ext/sockets/sendrecvmsg.c
index 86556a308f..7786f70721 100644
--- a/ext/sockets/sendrecvmsg.c
+++ b/ext/sockets/sendrecvmsg.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -176,14 +174,14 @@ PHP_FUNCTION(socket_sendmsg)
/* zmsg should be passed by ref */
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ra|l", &zsocket, &zmsg, &flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
LONG_CHECK_VALID_INT(flags);
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(zsocket),
php_sockets_le_socket_name, php_sockets_le_socket())) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
msghdr = from_zval_run_conversions(zmsg, php_sock, from_zval_write_msghdr_send,
@@ -221,14 +219,14 @@ PHP_FUNCTION(socket_recvmsg)
//ssize_t recvmsg(int sockfd, struct msghdr *msg, int flags);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ra|l",
&zsocket, &zmsg, &flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
LONG_CHECK_VALID_INT(flags);
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(zsocket),
php_sockets_le_socket_name, php_sockets_le_socket())) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
msghdr = from_zval_run_conversions(zmsg, php_sock, from_zval_write_msghdr_recv,
@@ -267,7 +265,7 @@ PHP_FUNCTION(socket_recvmsg)
}
} else {
SOCKETS_G(last_error) = errno;
- php_error_docref(NULL, E_WARNING, "error in recvmsg [%d]: %s",
+ php_error_docref(NULL, E_WARNING, "Error in recvmsg [%d]: %s",
errno, sockets_strerror(errno));
RETURN_FALSE;
}
@@ -284,7 +282,7 @@ PHP_FUNCTION(socket_cmsg_space)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll|l",
&level, &type, &n) == FAILURE) {
- return;
+ RETURN_THROWS();
}
LONG_CHECK_VALID_INT(level);
diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c
index dd0023f46c..2f0184097f 100644
--- a/ext/sockets/sockets.c
+++ b/ext/sockets/sockets.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -65,6 +63,7 @@
#include "sockaddr_conv.h"
#include "multicast.h"
#include "sendrecvmsg.h"
+#include "sockets_arginfo.h"
ZEND_DECLARE_MODULE_GLOBALS(sockets)
@@ -99,215 +98,6 @@ static int le_socket;
static int le_addrinfo;
#define le_addrinfo_name php_sockets_le_addrinfo_name
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_select, 0, 0, 4)
- ZEND_ARG_INFO(1, read_fds)
- ZEND_ARG_INFO(1, write_fds)
- ZEND_ARG_INFO(1, except_fds)
- ZEND_ARG_INFO(0, tv_sec)
- ZEND_ARG_INFO(0, tv_usec)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_create_listen, 0, 0, 1)
- ZEND_ARG_INFO(0, port)
- ZEND_ARG_INFO(0, backlog)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_accept, 0, 0, 1)
- ZEND_ARG_INFO(0, socket)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_set_nonblock, 0, 0, 1)
- ZEND_ARG_INFO(0, socket)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_set_block, 0, 0, 1)
- ZEND_ARG_INFO(0, socket)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_listen, 0, 0, 1)
- ZEND_ARG_INFO(0, socket)
- ZEND_ARG_INFO(0, backlog)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_close, 0, 0, 1)
- ZEND_ARG_INFO(0, socket)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_write, 0, 0, 2)
- ZEND_ARG_INFO(0, socket)
- ZEND_ARG_INFO(0, buf)
- ZEND_ARG_INFO(0, length)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_read, 0, 0, 2)
- ZEND_ARG_INFO(0, socket)
- ZEND_ARG_INFO(0, length)
- ZEND_ARG_INFO(0, type)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_getsockname, 0, 0, 2)
- ZEND_ARG_INFO(0, socket)
- ZEND_ARG_INFO(1, addr)
- ZEND_ARG_INFO(1, port)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_getpeername, 0, 0, 2)
- ZEND_ARG_INFO(0, socket)
- ZEND_ARG_INFO(1, addr)
- ZEND_ARG_INFO(1, port)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_create, 0, 0, 3)
- ZEND_ARG_INFO(0, domain)
- ZEND_ARG_INFO(0, type)
- ZEND_ARG_INFO(0, protocol)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_connect, 0, 0, 2)
- ZEND_ARG_INFO(0, socket)
- ZEND_ARG_INFO(0, addr)
- ZEND_ARG_INFO(0, port)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_strerror, 0, 0, 1)
- ZEND_ARG_INFO(0, errno)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_bind, 0, 0, 2)
- ZEND_ARG_INFO(0, socket)
- ZEND_ARG_INFO(0, addr)
- ZEND_ARG_INFO(0, port)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_recv, 0, 0, 4)
- ZEND_ARG_INFO(0, socket)
- ZEND_ARG_INFO(1, buf)
- ZEND_ARG_INFO(0, len)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_send, 0, 0, 4)
- ZEND_ARG_INFO(0, socket)
- ZEND_ARG_INFO(0, buf)
- ZEND_ARG_INFO(0, len)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_recvfrom, 0, 0, 5)
- ZEND_ARG_INFO(0, socket)
- ZEND_ARG_INFO(1, buf)
- ZEND_ARG_INFO(0, len)
- ZEND_ARG_INFO(0, flags)
- ZEND_ARG_INFO(1, name)
- ZEND_ARG_INFO(1, port)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_sendto, 0, 0, 5)
- ZEND_ARG_INFO(0, socket)
- ZEND_ARG_INFO(0, buf)
- ZEND_ARG_INFO(0, len)
- ZEND_ARG_INFO(0, flags)
- ZEND_ARG_INFO(0, addr)
- ZEND_ARG_INFO(0, port)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_get_option, 0, 0, 3)
- ZEND_ARG_INFO(0, socket)
- ZEND_ARG_INFO(0, level)
- ZEND_ARG_INFO(0, optname)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_set_option, 0, 0, 4)
- ZEND_ARG_INFO(0, socket)
- ZEND_ARG_INFO(0, level)
- ZEND_ARG_INFO(0, optname)
- ZEND_ARG_INFO(0, optval)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_SOCKETPAIR
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_create_pair, 0, 0, 4)
- ZEND_ARG_INFO(0, domain)
- ZEND_ARG_INFO(0, type)
- ZEND_ARG_INFO(0, protocol)
- ZEND_ARG_INFO(1, fd)
-ZEND_END_ARG_INFO()
-#endif
-
-#ifdef HAVE_SHUTDOWN
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_shutdown, 0, 0, 1)
- ZEND_ARG_INFO(0, socket)
- ZEND_ARG_INFO(0, how)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_last_error, 0, 0, 0)
- ZEND_ARG_INFO(0, socket)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_clear_error, 0, 0, 0)
- ZEND_ARG_INFO(0, socket)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_import_stream, 0, 0, 1)
- ZEND_ARG_INFO(0, stream)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_export_stream, 0, 0, 1)
- ZEND_ARG_INFO(0, socket)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_sendmsg, 0, 0, 3)
- ZEND_ARG_INFO(0, socket)
- ZEND_ARG_INFO(0, msghdr)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_recvmsg, 0, 0, 3)
- ZEND_ARG_INFO(0, socket)
- ZEND_ARG_INFO(1, msghdr)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_cmsg_space, 0, 0, 2)
- ZEND_ARG_INFO(0, level)
- ZEND_ARG_INFO(0, type)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_addrinfo_lookup, 0, 0, 1)
- ZEND_ARG_INFO(0, host)
- ZEND_ARG_INFO(0, service)
- ZEND_ARG_INFO(0, hints)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_addrinfo_connect, 0, 0, 1)
- ZEND_ARG_INFO(0, addr)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_addrinfo_bind, 0, 0, 1)
- ZEND_ARG_INFO(0, addr)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_addrinfo_explain, 0, 0, 1)
- ZEND_ARG_INFO(0, addr)
-ZEND_END_ARG_INFO()
-
-#ifdef PHP_WIN32
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_wsaprotocol_info_export, 0, 0, 2)
- ZEND_ARG_INFO(0, socket)
- ZEND_ARG_INFO(0, target_pid)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_wsaprotocol_info_import, 0, 0, 1)
- ZEND_ARG_INFO(0, info_id)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_wsaprotocol_info_release, 0, 0, 1)
- ZEND_ARG_INFO(0, info_id)
-ZEND_END_ARG_INFO()
-#endif
-/* }}} */
-
static PHP_GINIT_FUNCTION(sockets);
static PHP_GSHUTDOWN_FUNCTION(sockets);
static PHP_MINIT_FUNCTION(sockets);
@@ -850,8 +640,6 @@ static PHP_MINIT_FUNCTION(sockets)
#if HAVE_AI_IDN
REGISTER_LONG_CONSTANT("AI_IDN", AI_IDN, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("AI_CANONIDN", AI_CANONIDN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("AI_IDN_ALLOW_UNASSIGNED", AI_IDN_ALLOW_UNASSIGNED, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("AI_IDN_USE_STD3_ASCII_RULES", AI_IDN_USE_STD3_ASCII_RULES, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef AI_NUMERICSERV
REGISTER_LONG_CONSTANT("AI_NUMERICSERV", AI_NUMERICSERV, CONST_CS | CONST_PERSISTENT);
@@ -906,7 +694,7 @@ static int php_sock_array_to_fd_set(zval *sock_array, fd_set *fds, PHP_SOCKET *m
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(sock_array), element) {
ZVAL_DEREF(element);
php_sock = (php_socket*) zend_fetch_resource_ex(element, le_socket_name, le_socket);
- if (!php_sock) continue; /* If element is not a resource, skip it */
+ if (!php_sock) return -1; /* If element is not a resource, bail out */
PHP_SAFE_FD_SET(php_sock->bsd_socket, fds);
if (php_sock->bsd_socket > *max_fd) {
@@ -935,7 +723,7 @@ static int php_sock_array_from_fd_set(zval *sock_array, fd_set *fds) /* {{{ */
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(sock_array), num_key, key, element) {
ZVAL_DEREF(element);
php_sock = (php_socket*) zend_fetch_resource_ex(element, le_socket_name, le_socket);
- if (!php_sock) continue; /* If element is not a resource, skip it */
+ ZEND_ASSERT(php_sock); /* element is supposed to be resource */
if (PHP_SAFE_FD_ISSET(php_sock->bsd_socket, fds)) {
/* Add fd to new array */
@@ -964,43 +752,57 @@ static int php_sock_array_from_fd_set(zval *sock_array, fd_set *fds) /* {{{ */
Runs the select() system call on the sets mentioned with a timeout specified by tv_sec and tv_usec */
PHP_FUNCTION(socket_select)
{
- zval *r_array, *w_array, *e_array, *sec;
+ zval *r_array, *w_array, *e_array;
struct timeval tv;
struct timeval *tv_p = NULL;
fd_set rfds, wfds, efds;
PHP_SOCKET max_fd = 0;
int retval, sets = 0;
- zend_long usec = 0;
+ zend_long sec, usec = 0;
+ zend_bool sec_is_null = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "a!a!a!z!|l", &r_array, &w_array, &e_array, &sec, &usec) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "a!a!a!l!|l", &r_array, &w_array, &e_array, &sec, &sec_is_null, &usec) == FAILURE) {
+ RETURN_THROWS();
}
FD_ZERO(&rfds);
FD_ZERO(&wfds);
FD_ZERO(&efds);
- if (r_array != NULL) sets += php_sock_array_to_fd_set(r_array, &rfds, &max_fd);
- if (w_array != NULL) sets += php_sock_array_to_fd_set(w_array, &wfds, &max_fd);
- if (e_array != NULL) sets += php_sock_array_to_fd_set(e_array, &efds, &max_fd);
+ if (r_array != NULL) {
+ sets += retval = php_sock_array_to_fd_set(r_array, &rfds, &max_fd);
+ if (retval == -1) {
+ return;
+ }
+ }
+ if (w_array != NULL) {
+ sets += retval = php_sock_array_to_fd_set(w_array, &wfds, &max_fd);
+ if (retval == -1) {
+ return;
+ }
+ }
+ if (e_array != NULL) {
+ sets += retval = php_sock_array_to_fd_set(e_array, &efds, &max_fd);
+ if (retval == -1) {
+ return;
+ }
+ }
if (!sets) {
- php_error_docref(NULL, E_WARNING, "no resource arrays were passed to select");
+ php_error_docref(NULL, E_WARNING, "No resource arrays were passed to select");
RETURN_FALSE;
}
PHP_SAFE_MAX_FD(max_fd, 0); /* someone needs to make this look more like stream_socket_select */
/* If seconds is not set to null, build the timeval, else we wait indefinitely */
- if (sec != NULL) {
- zend_long s = zval_get_long(sec);
-
+ if (!sec_is_null) {
/* Solaris + BSD do not like microsecond values which are >= 1 sec */
if (usec > 999999) {
- tv.tv_sec = s + (usec / 1000000);
+ tv.tv_sec = sec + (usec / 1000000);
tv.tv_usec = usec % 1000000;
} else {
- tv.tv_sec = s;
+ tv.tv_sec = sec;
tv.tv_usec = usec;
}
@@ -1011,7 +813,7 @@ PHP_FUNCTION(socket_select)
if (retval == -1) {
SOCKETS_G(last_error) = errno;
- php_error_docref(NULL, E_WARNING, "unable to select [%d]: %s", errno, sockets_strerror(errno));
+ php_error_docref(NULL, E_WARNING, "Unable to select [%d]: %s", errno, sockets_strerror(errno));
RETURN_FALSE;
}
@@ -1031,7 +833,7 @@ PHP_FUNCTION(socket_create_listen)
zend_long port, backlog = 128;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l", &port, &backlog) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!php_open_listen_sock(&php_sock, port, backlog)) {
@@ -1055,11 +857,11 @@ PHP_FUNCTION(socket_accept)
socklen_t php_sa_len = sizeof(sa);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &arg1) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(arg1), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (!php_accept_connect(php_sock, &new_sock, (struct sockaddr*)&sa, &php_sa_len)) {
@@ -1078,11 +880,11 @@ PHP_FUNCTION(socket_set_nonblock)
php_socket *php_sock;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &arg1) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(arg1), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (!Z_ISUNDEF(php_sock->zstream)) {
@@ -1116,11 +918,11 @@ PHP_FUNCTION(socket_set_block)
php_socket *php_sock;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &arg1) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(arg1), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* if socket was created from a stream, give the stream a chance to take
@@ -1157,11 +959,11 @@ PHP_FUNCTION(socket_listen)
zend_long backlog = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|l", &arg1, &backlog) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(arg1), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (listen(php_sock->bsd_socket, backlog) != 0) {
@@ -1180,11 +982,11 @@ PHP_FUNCTION(socket_close)
php_socket *php_sock;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &arg1) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(arg1), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (!Z_ISUNDEF(php_sock->zstream)) {
@@ -1214,7 +1016,7 @@ PHP_FUNCTION(socket_write)
char *str;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|l", &arg1, &str, &str_len, &length) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (length < 0) {
@@ -1223,7 +1025,7 @@ PHP_FUNCTION(socket_write)
}
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(arg1), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (ZEND_NUM_ARGS() < 3) {
@@ -1256,7 +1058,7 @@ PHP_FUNCTION(socket_read)
zend_long length, type = PHP_BINARY_READ;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl|l", &arg1, &length, &type) == FAILURE) {
- return;
+ RETURN_THROWS();
}
/* overflow check */
@@ -1267,7 +1069,7 @@ PHP_FUNCTION(socket_read)
tmpbuf = zend_string_alloc(length, 0);
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(arg1), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (type == PHP_NORMAL_READ) {
@@ -1323,11 +1125,11 @@ PHP_FUNCTION(socket_getsockname)
socklen_t salen = sizeof(php_sockaddr_storage);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz|z", &arg1, &addr, &port) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(arg1), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
sa = (struct sockaddr *) &sa_storage;
@@ -1397,11 +1199,11 @@ PHP_FUNCTION(socket_getpeername)
socklen_t salen = sizeof(php_sockaddr_storage);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz|z", &arg1, &arg2, &arg3) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(arg1), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
sa = (struct sockaddr *) &sa_storage;
@@ -1465,7 +1267,7 @@ PHP_FUNCTION(socket_create)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lll", &arg1, &arg2, &arg3) == FAILURE) {
efree(php_sock);
- return;
+ RETURN_THROWS();
}
if (arg1 != AF_UNIX
@@ -1473,12 +1275,12 @@ PHP_FUNCTION(socket_create)
&& arg1 != AF_INET6
#endif
&& arg1 != AF_INET) {
- php_error_docref(NULL, E_WARNING, "invalid socket domain [" ZEND_LONG_FMT "] specified for argument 1, assuming AF_INET", arg1);
+ php_error_docref(NULL, E_WARNING, "Invalid socket domain [" ZEND_LONG_FMT "] specified for argument 1, assuming AF_INET", arg1);
arg1 = AF_INET;
}
if (arg2 > 10) {
- php_error_docref(NULL, E_WARNING, "invalid socket type [" ZEND_LONG_FMT "] specified for argument 2, assuming SOCK_STREAM", arg2);
+ php_error_docref(NULL, E_WARNING, "Invalid socket type [" ZEND_LONG_FMT "] specified for argument 2, assuming SOCK_STREAM", arg2);
arg2 = SOCK_STREAM;
}
@@ -1512,11 +1314,11 @@ PHP_FUNCTION(socket_connect)
int argc = ZEND_NUM_ARGS();
if (zend_parse_parameters(argc, "rs|l", &arg1, &addr, &addr_len, &port) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(arg1), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
switch(php_sock->type) {
@@ -1597,7 +1399,7 @@ PHP_FUNCTION(socket_strerror)
zend_long arg1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &arg1) == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_STRING(sockets_strerror(arg1));
@@ -1618,11 +1420,11 @@ PHP_FUNCTION(socket_bind)
zend_long retval = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|l", &arg1, &addr, &addr_len, &port) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(arg1), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
switch(php_sock->type) {
@@ -1676,7 +1478,7 @@ PHP_FUNCTION(socket_bind)
}
#endif
default:
- php_error_docref(NULL, E_WARNING, "unsupported socket type '%d', must be AF_UNIX, AF_INET, or AF_INET6", php_sock->type);
+ php_error_docref(NULL, E_WARNING, "Unsupported socket type '%d', must be AF_UNIX, AF_INET, or AF_INET6", php_sock->type);
RETURN_FALSE;
}
@@ -1700,11 +1502,11 @@ PHP_FUNCTION(socket_recv)
zend_long len, flags;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rzll", &php_sock_res, &buf, &len, &flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(php_sock_res), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* overflow check */
@@ -1743,7 +1545,7 @@ PHP_FUNCTION(socket_send)
char *buf;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsll", &arg1, &buf, &buf_len, &len, &flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (len < 0) {
@@ -1752,7 +1554,7 @@ PHP_FUNCTION(socket_send)
}
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(arg1), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
retval = send(php_sock->bsd_socket, buf, (buf_len < (size_t)len ? buf_len : (size_t)len), flags);
@@ -1785,11 +1587,11 @@ PHP_FUNCTION(socket_recvfrom)
zend_string *recv_buf;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rzllz|z", &arg1, &arg2, &arg3, &arg4, &arg5, &arg6) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(arg1), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* overflow check */
@@ -1901,7 +1703,7 @@ PHP_FUNCTION(socket_sendto)
int argc = ZEND_NUM_ARGS();
if (zend_parse_parameters(argc, "rslls|l", &arg1, &buf, &buf_len, &len, &flags, &addr, &addr_len, &port) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (len < 0) {
@@ -1910,14 +1712,14 @@ PHP_FUNCTION(socket_sendto)
}
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(arg1), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
switch (php_sock->type) {
case AF_UNIX:
memset(&s_un, 0, sizeof(s_un));
s_un.sun_family = AF_UNIX;
- snprintf(s_un.sun_path, 108, "%s", addr);
+ snprintf(s_un.sun_path, sizeof(s_un.sun_path), "%s", addr);
retval = sendto(php_sock->bsd_socket, buf, ((size_t)len > buf_len) ? buf_len : (size_t)len, flags, (struct sockaddr *) &s_un, SUN_LEN(&s_un));
break;
@@ -1984,11 +1786,11 @@ PHP_FUNCTION(socket_get_option)
zend_long level, optname;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rll", &arg1, &level, &optname) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(arg1), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (level == IPPROTO_IP) {
@@ -2099,11 +1901,11 @@ PHP_FUNCTION(socket_set_option)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rllz", &arg1, &level, &optname, &arg4) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(arg1), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
set_errno(0);
@@ -2140,11 +1942,11 @@ PHP_FUNCTION(socket_set_option)
opt_ht = Z_ARRVAL_P(arg4);
if ((l_onoff = zend_hash_str_find(opt_ht, l_onoff_key, sizeof(l_onoff_key) - 1)) == NULL) {
- php_error_docref(NULL, E_WARNING, "no key \"%s\" passed in optval", l_onoff_key);
+ php_error_docref(NULL, E_WARNING, "No key \"%s\" passed in optval", l_onoff_key);
RETURN_FALSE;
}
if ((l_linger = zend_hash_str_find(opt_ht, l_linger_key, sizeof(l_linger_key) - 1)) == NULL) {
- php_error_docref(NULL, E_WARNING, "no key \"%s\" passed in optval", l_linger_key);
+ php_error_docref(NULL, E_WARNING, "No key \"%s\" passed in optval", l_linger_key);
RETURN_FALSE;
}
@@ -2168,11 +1970,11 @@ PHP_FUNCTION(socket_set_option)
opt_ht = Z_ARRVAL_P(arg4);
if ((sec = zend_hash_str_find(opt_ht, sec_key, sizeof(sec_key) - 1)) == NULL) {
- php_error_docref(NULL, E_WARNING, "no key \"%s\" passed in optval", sec_key);
+ php_error_docref(NULL, E_WARNING, "No key \"%s\" passed in optval", sec_key);
RETURN_FALSE;
}
if ((usec = zend_hash_str_find(opt_ht, usec_key, sizeof(usec_key) - 1)) == NULL) {
- php_error_docref(NULL, E_WARNING, "no key \"%s\" passed in optval", usec_key);
+ php_error_docref(NULL, E_WARNING, "No key \"%s\" passed in optval", usec_key);
RETURN_FALSE;
}
@@ -2234,7 +2036,7 @@ PHP_FUNCTION(socket_create_pair)
zend_long domain, type, protocol;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lllz", &domain, &type, &protocol, &fds_array_zval) == FAILURE) {
- return;
+ RETURN_THROWS();
}
php_sock[0] = php_create_socket();
@@ -2245,18 +2047,18 @@ PHP_FUNCTION(socket_create_pair)
&& domain != AF_INET6
#endif
&& domain != AF_UNIX) {
- php_error_docref(NULL, E_WARNING, "invalid socket domain [" ZEND_LONG_FMT "] specified for argument 1, assuming AF_INET", domain);
+ php_error_docref(NULL, E_WARNING, "Invalid socket domain [" ZEND_LONG_FMT "] specified for argument 1, assuming AF_INET", domain);
domain = AF_INET;
}
if (type > 10) {
- php_error_docref(NULL, E_WARNING, "invalid socket type [" ZEND_LONG_FMT "] specified for argument 2, assuming SOCK_STREAM", type);
+ php_error_docref(NULL, E_WARNING, "Invalid socket type [" ZEND_LONG_FMT "] specified for argument 2, assuming SOCK_STREAM", type);
type = SOCK_STREAM;
}
if (socketpair(domain, type, protocol, fds_array) != 0) {
SOCKETS_G(last_error) = errno;
- php_error_docref(NULL, E_WARNING, "unable to create socket pair [%d]: %s", errno, sockets_strerror(errno));
+ php_error_docref(NULL, E_WARNING, "Unable to create socket pair [%d]: %s", errno, sockets_strerror(errno));
efree(php_sock[0]);
efree(php_sock[1]);
RETURN_FALSE;
@@ -2266,7 +2068,7 @@ PHP_FUNCTION(socket_create_pair)
if (!fds_array_zval) {
efree(php_sock[0]);
efree(php_sock[1]);
- return;
+ RETURN_THROWS();
}
php_sock[0]->bsd_socket = fds_array[0];
@@ -2299,11 +2101,11 @@ PHP_FUNCTION(socket_shutdown)
php_socket *php_sock;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|l", &arg1, &how_shutdown) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(arg1), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (shutdown(php_sock->bsd_socket, how_shutdown) != 0) {
@@ -2324,12 +2126,12 @@ PHP_FUNCTION(socket_last_error)
php_socket *php_sock;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|r", &arg1) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (arg1) {
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(arg1), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
RETVAL_LONG(php_sock->error);
} else {
@@ -2346,12 +2148,12 @@ PHP_FUNCTION(socket_clear_error)
php_socket *php_sock;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|r", &arg1) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (arg1) {
if ((php_sock = (php_socket *)zend_fetch_resource(Z_RES_P(arg1), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
php_sock->error = 0;
} else {
@@ -2419,7 +2221,7 @@ PHP_FUNCTION(socket_import_stream)
PHP_SOCKET socket; /* fd */
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zstream) == FAILURE) {
- return;
+ RETURN_THROWS();
}
php_stream_from_zval(stream, zstream);
@@ -2467,16 +2269,16 @@ PHP_FUNCTION(socket_export_stream)
size_t protocollen = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zsocket) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((socket = (php_socket *) zend_fetch_resource(Z_RES_P(zsocket), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* Either we already exported a stream or the socket came from an import,
* just return the existing stream */
if (!Z_ISUNDEF(socket->zstream)) {
- RETURN_ZVAL(&socket->zstream, 1, 0);
+ RETURN_COPY(&socket->zstream);
}
/* Determine if socket is using a protocol with one of the default registered
@@ -2535,7 +2337,7 @@ PHP_FUNCTION(socket_export_stream)
stream = php_stream_sock_open_from_socket(socket->bsd_socket, 0);
if (stream == NULL) {
- php_error_docref(NULL, E_WARNING, "failed to create stream");
+ php_error_docref(NULL, E_WARNING, "Failed to create stream");
RETURN_FALSE;
}
}
@@ -2548,7 +2350,7 @@ PHP_FUNCTION(socket_export_stream)
php_stream_to_zval(stream, &socket->zstream);
- RETURN_ZVAL(&socket->zstream, 1, 0);
+ RETURN_COPY(&socket->zstream);
}
/* }}} */
@@ -2566,21 +2368,14 @@ PHP_FUNCTION(socket_addrinfo_lookup)
memset(&hints, 0, sizeof(hints));
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|sa", &hostname, &service, &service_len, &zhints) == FAILURE) {
- RETURN_NULL();
+ RETURN_THROWS();
}
if (zhints) {
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(zhints), key, hint) {
if (key) {
if (zend_string_equals_literal(key, "ai_flags")) {
- zend_long flags = zval_get_long(hint);
-#if HAVE_AI_IDN
- if (flags & (AI_IDN_ALLOW_UNASSIGNED | AI_IDN_USE_STD3_ASCII_RULES)) {
- php_error_docref(NULL, E_DEPRECATED,
- "AI_IDN_ALLOW_UNASSIGNED and AI_IDN_USE_STD3_ASCII_RULES are deprecated");
- }
-#endif
- hints.ai_flags = flags;
+ hints.ai_flags = zval_get_long(hint);
} else if (zend_string_equals_literal(key, "ai_socktype")) {
hints.ai_socktype = zval_get_long(hint);
} else if (zend_string_equals_literal(key, "ai_protocol")) {
@@ -2630,11 +2425,11 @@ PHP_FUNCTION(socket_addrinfo_bind)
php_socket *php_sock;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &arg1) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((ai = (struct addrinfo *) zend_fetch_resource(Z_RES_P(arg1), le_addrinfo_name, le_addrinfo)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
php_sock = php_create_socket();
@@ -2669,14 +2464,14 @@ PHP_FUNCTION(socket_addrinfo_bind)
break;
}
default:
- php_error_docref(NULL, E_WARNING, "unsupported socket type '%d', must be AF_UNIX, AF_INET, or AF_INET6", php_sock->type);
+ php_error_docref(NULL, E_WARNING, "Unsupported socket type '%d', must be AF_UNIX, AF_INET, or AF_INET6", php_sock->type);
close(php_sock->bsd_socket);
efree(php_sock);
RETURN_FALSE;
}
if (retval != 0) {
- PHP_SOCKET_ERROR(php_sock, "unable to bind address", errno);
+ PHP_SOCKET_ERROR(php_sock, "Unable to bind address", errno);
close(php_sock->bsd_socket);
efree(php_sock);
RETURN_FALSE;
@@ -2696,11 +2491,11 @@ PHP_FUNCTION(socket_addrinfo_connect)
php_socket *php_sock;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &arg1) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((ai = (struct addrinfo *) zend_fetch_resource(Z_RES_P(arg1), le_addrinfo_name, le_addrinfo)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
php_sock = php_create_socket();
@@ -2735,14 +2530,14 @@ PHP_FUNCTION(socket_addrinfo_connect)
break;
}
default:
- php_error_docref(NULL, E_WARNING, "unsupported socket type '%d', must be AF_UNIX, AF_INET, or AF_INET6", php_sock->type);
+ php_error_docref(NULL, E_WARNING, "Unsupported socket type '%d', must be AF_UNIX, AF_INET, or AF_INET6", php_sock->type);
close(php_sock->bsd_socket);
efree(php_sock);
RETURN_FALSE;
}
if (retval != 0) {
- PHP_SOCKET_ERROR(php_sock, "unable to connect address", errno);
+ PHP_SOCKET_ERROR(php_sock, "Unable to connect address", errno);
close(php_sock->bsd_socket);
efree(php_sock);
RETURN_FALSE;
@@ -2760,11 +2555,11 @@ PHP_FUNCTION(socket_addrinfo_explain)
struct addrinfo *ai;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &arg1) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((ai = (struct addrinfo *) zend_fetch_resource(Z_RES_P(arg1), le_addrinfo_name, le_addrinfo)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
array_init(return_value);
@@ -2821,10 +2616,10 @@ PHP_FUNCTION(socket_wsaprotocol_info_export)
HANDLE map;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &zsocket, &target_pid) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((socket = (php_socket *) zend_fetch_resource(Z_RES_P(zsocket), le_socket_name, le_socket)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (SOCKET_ERROR == WSADuplicateSocket(socket->bsd_socket, (DWORD)target_pid, &wi)) {
@@ -2877,7 +2672,7 @@ PHP_FUNCTION(socket_wsaprotocol_info_import)
HANDLE map;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &id, &id_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
map = OpenFileMapping(FILE_MAP_READ, FALSE, id);
@@ -2932,7 +2727,7 @@ PHP_FUNCTION(socket_wsaprotocol_info_release)
size_t id_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &id, &id_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_BOOL(SUCCESS == zend_hash_str_del(&(SOCKETS_G(wsa_info)), id, id_len));
diff --git a/ext/sockets/sockets.stub.php b/ext/sockets/sockets.stub.php
new file mode 100644
index 0000000000..d79cb7ac7a
--- /dev/null
+++ b/ext/sockets/sockets.stub.php
@@ -0,0 +1,124 @@
+<?php
+
+function socket_select(?array &$read_fds, ?array &$write_fds, ?array &$except_fds, ?int $tv_sec, int $tv_usec = 0): int|false {}
+
+/** @return resource|false */
+function socket_create_listen(int $port, int $backlog = 128) {}
+
+/**
+ * @param resource $socket
+ * @return resource|false
+ */
+function socket_accept($socket) {}
+
+/** @param resource $socket */
+function socket_set_nonblock($socket): bool {}
+
+/** @param resource $socket */
+function socket_set_block($socket): bool {}
+
+/** @param resource $socket */
+function socket_listen($socket, int $backlog = 0): bool {}
+
+/** @param resource $socket */
+function socket_close($socket): void {}
+
+/** @param resource $socket */
+function socket_write($socket, string $buf, int $length = 0): int|false {}
+
+/** @param resource $socket */
+function socket_read($socket, int $length, int $type = PHP_BINARY_READ): string|false {}
+
+/** @param resource $socket */
+function socket_getsockname($socket, &$addr, &$port = UNKNOWN): bool {}
+
+/** @param resource $socket */
+function socket_getpeername($socket, &$addr, &$port = UNKNOWN): bool {}
+
+/** @return resource|false */
+function socket_create(int $domain, int $type, int $protocol) {}
+
+/** @param resource $socket */
+function socket_connect($socket, string $addr, int $port = 0): bool {}
+
+function socket_strerror(int $errno): string {}
+
+/** @param resource $socket */
+function socket_bind($socket, string $addr, int $port = 0): bool {}
+
+/** @param resource $socket */
+function socket_recv($socket, &$buf, int $len, int $flags): int|false {}
+
+/** @param resource $socket */
+function socket_send($socket, string $buf, int $len, int $flags): int|false {}
+
+/** @param resource $socket */
+function socket_recvfrom($socket, &$buf, int $len, int $flags, &$name, &$port = UNKNOWN): int|false {}
+
+/** @param resource $socket */
+function socket_sendto($socket, string $buf, int $len, int $flags, string $addr, int $port = 0): int|false {}
+
+/** @param resource $socket */
+function socket_get_option($socket, int $level, int $optname): array|int|false {}
+
+/** @param resource $socket */
+function socket_set_option($socket, int $level, int $optname, $optval): bool {}
+
+#ifdef HAVE_SOCKETPAIR
+function socket_create_pair(int $domain, int $type, int $protocol, &$fd): bool|null {}
+#endif
+
+#ifdef HAVE_SHUTDOWN
+/** @param resource $socket */
+function socket_shutdown($socket, int $how = 2): bool {}
+#endif
+
+/** @param resource $socket */
+function socket_last_error($socket = UNKNOWN): int {}
+
+/** @param resource $socket */
+function socket_clear_error($socket = UNKNOWN): void {}
+
+/**
+ * @param resource $stream
+ * @return resource|false
+ */
+function socket_import_stream($stream) {}
+
+/** @param resource $socket */
+function socket_export_stream($socket) {}
+
+/** @param resource $socket */
+function socket_sendmsg($socket, array $msghdr, int $flags = 0): int|false {}
+
+/** @param resource $socket */
+function socket_recvmsg($socket, array &$msghdr, int $flags = 0): int|false {}
+
+function socket_cmsg_space(int $level, int $type, int $n = 0): ?int {}
+
+function socket_addrinfo_lookup(string $host, string $service = UNKNOWN, array $hints = UNKNOWN): array|false {}
+
+/**
+ * @param resource $addr
+ * @return resource|false
+ */
+function socket_addrinfo_connect($addr) {}
+
+/**
+ * @param resource $addr
+ * @return resource|false
+ */
+function socket_addrinfo_bind($addr) {}
+
+/** @param resource $addr */
+function socket_addrinfo_explain($addr): array {}
+
+#ifdef PHP_WIN32
+/** @param resource $socket */
+function socket_wsaprotocol_info_export($socket, int $target_pid): string|false {}
+
+/** @return resource|false */
+function socket_wsaprotocol_info_import(string $info_id) {}
+
+function socket_wsaprotocol_info_release(string $info_id): bool {}
+#endif
diff --git a/ext/sockets/sockets_arginfo.h b/ext/sockets/sockets_arginfo.h
new file mode 100644
index 0000000000..397c2e5683
--- /dev/null
+++ b/ext/sockets/sockets_arginfo.h
@@ -0,0 +1,199 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_socket_select, 0, 4, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(1, read_fds, IS_ARRAY, 1)
+ ZEND_ARG_TYPE_INFO(1, write_fds, IS_ARRAY, 1)
+ ZEND_ARG_TYPE_INFO(1, except_fds, IS_ARRAY, 1)
+ ZEND_ARG_TYPE_INFO(0, tv_sec, IS_LONG, 1)
+ ZEND_ARG_TYPE_INFO(0, tv_usec, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_create_listen, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, port, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, backlog, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_accept, 0, 0, 1)
+ ZEND_ARG_INFO(0, socket)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_socket_set_nonblock, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, socket)
+ZEND_END_ARG_INFO()
+
+#define arginfo_socket_set_block arginfo_socket_set_nonblock
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_socket_listen, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, socket)
+ ZEND_ARG_TYPE_INFO(0, backlog, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_socket_close, 0, 1, IS_VOID, 0)
+ ZEND_ARG_INFO(0, socket)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_socket_write, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, socket)
+ ZEND_ARG_TYPE_INFO(0, buf, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_socket_read, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, socket)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_socket_getsockname, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, socket)
+ ZEND_ARG_INFO(1, addr)
+ ZEND_ARG_INFO(1, port)
+ZEND_END_ARG_INFO()
+
+#define arginfo_socket_getpeername arginfo_socket_getsockname
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_create, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, domain, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, protocol, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_socket_connect, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, socket)
+ ZEND_ARG_TYPE_INFO(0, addr, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, port, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_socket_strerror, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, errno, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_socket_bind arginfo_socket_connect
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_socket_recv, 0, 4, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, socket)
+ ZEND_ARG_INFO(1, buf)
+ ZEND_ARG_TYPE_INFO(0, len, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_socket_send, 0, 4, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, socket)
+ ZEND_ARG_TYPE_INFO(0, buf, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, len, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_socket_recvfrom, 0, 5, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, socket)
+ ZEND_ARG_INFO(1, buf)
+ ZEND_ARG_TYPE_INFO(0, len, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ ZEND_ARG_INFO(1, name)
+ ZEND_ARG_INFO(1, port)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_socket_sendto, 0, 5, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, socket)
+ ZEND_ARG_TYPE_INFO(0, buf, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, len, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, addr, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, port, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_socket_get_option, 0, 3, MAY_BE_ARRAY|MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, socket)
+ ZEND_ARG_TYPE_INFO(0, level, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, optname, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_socket_set_option, 0, 4, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, socket)
+ ZEND_ARG_TYPE_INFO(0, level, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, optname, IS_LONG, 0)
+ ZEND_ARG_INFO(0, optval)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_SOCKETPAIR)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_socket_create_pair, 0, 4, _IS_BOOL, 1)
+ ZEND_ARG_TYPE_INFO(0, domain, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, protocol, IS_LONG, 0)
+ ZEND_ARG_INFO(1, fd)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_SHUTDOWN)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_socket_shutdown, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, socket)
+ ZEND_ARG_TYPE_INFO(0, how, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_socket_last_error, 0, 0, IS_LONG, 0)
+ ZEND_ARG_INFO(0, socket)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_socket_clear_error, 0, 0, IS_VOID, 0)
+ ZEND_ARG_INFO(0, socket)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_import_stream, 0, 0, 1)
+ ZEND_ARG_INFO(0, stream)
+ZEND_END_ARG_INFO()
+
+#define arginfo_socket_export_stream arginfo_socket_accept
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_socket_sendmsg, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, socket)
+ ZEND_ARG_TYPE_INFO(0, msghdr, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_socket_recvmsg, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, socket)
+ ZEND_ARG_TYPE_INFO(1, msghdr, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_socket_cmsg_space, 0, 2, IS_LONG, 1)
+ ZEND_ARG_TYPE_INFO(0, level, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, n, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_socket_addrinfo_lookup, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, host, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, service, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, hints, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_addrinfo_connect, 0, 0, 1)
+ ZEND_ARG_INFO(0, addr)
+ZEND_END_ARG_INFO()
+
+#define arginfo_socket_addrinfo_bind arginfo_socket_addrinfo_connect
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_socket_addrinfo_explain, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_INFO(0, addr)
+ZEND_END_ARG_INFO()
+
+#if defined(PHP_WIN32)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_socket_wsaprotocol_info_export, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, socket)
+ ZEND_ARG_TYPE_INFO(0, target_pid, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(PHP_WIN32)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_socket_wsaprotocol_info_import, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, info_id, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(PHP_WIN32)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_socket_wsaprotocol_info_release, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, info_id, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
diff --git a/ext/sockets/tests/ai_idn_deprecation.phpt b/ext/sockets/tests/ai_idn_deprecation.phpt
deleted file mode 100644
index 02a6965d26..0000000000
--- a/ext/sockets/tests/ai_idn_deprecation.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-AI_IDN_ALLOW_UNASSIGNED and AI_IDN_USE_STD3_ASCII_RULES are deprecated
---SKIPIF--
-<?php
-if (!extension_loaded('sockets')) die('skip The sockets extension is not loaded');
-if (!defined('AI_IDN_ALLOW_UNASSIGNED')) die('skip AI_IDN_ALLOW_UNASSIGNED not defined');
-?>
---FILE--
-<?php
-$addrinfo = socket_addrinfo_lookup('127.0.0.1', 2000, array(
- 'ai_family' => AF_INET,
- 'ai_socktype' => SOCK_DGRAM,
- 'ai_flags' => AI_IDN_ALLOW_UNASSIGNED,
-));
-var_dump(socket_addrinfo_connect($addrinfo[0]));
-echo "Done";
---EXPECTF--
-Deprecated: socket_addrinfo_lookup(): AI_IDN_ALLOW_UNASSIGNED and AI_IDN_USE_STD3_ASCII_RULES are deprecated in %s on line %d
-resource(%d) of type (Socket)
-Done
diff --git a/ext/sockets/tests/bug76839.phpt b/ext/sockets/tests/bug76839.phpt
index d63370cc31..49aff731f7 100644
--- a/ext/sockets/tests/bug76839.phpt
+++ b/ext/sockets/tests/bug76839.phpt
@@ -12,7 +12,7 @@ if (!extension_loaded('sockets')) {
<?php
// This bug only occurs when a specific portion of memory is unclean.
-// Unforunately, looping around 10 times and using random paths is the
+// Unfortunately, looping around 10 times and using random paths is the
// best way I could manage to reproduce this problem without modifying php itself :-/
for ($i = 0; $i < 10; $i++) {
diff --git a/ext/sockets/tests/ipv4loop.phpt b/ext/sockets/tests/ipv4loop.phpt
index 7d72992012..4e5d15453b 100644
--- a/ext/sockets/tests/ipv4loop.phpt
+++ b/ext/sockets/tests/ipv4loop.phpt
@@ -8,45 +8,45 @@ IPv4 Loopback test
?>
--FILE--
<?php
- /* Setup socket server */
- $server = socket_create(AF_INET, SOCK_STREAM, getprotobyname('tcp'));
- if (!$server) {
- die('Unable to create AF_INET socket [server]');
- }
-
- if (!socket_bind($server, '127.0.0.1', 0)) {
- die("Unable to bind to 127.0.0.1");
- }
-
- if (!socket_listen($server, 2)) {
- die('Unable to listen on socket');
- }
-
- socket_getsockname($server, $unused, $port);
-
- /* Connect to it */
- $client = socket_create(AF_INET, SOCK_STREAM, getprotobyname('tcp'));
- if (!$client) {
- die('Unable to create AF_INET socket [client]');
- }
- if (!socket_connect($client, '127.0.0.1', $port)) {
- die('Unable to connect to server socket');
- }
-
- /* Accept that connection */
- $socket = socket_accept($server);
- if (!$socket) {
- die('Unable to accept connection');
- }
-
- socket_write($client, "ABCdef123\n");
-
- $data = socket_read($socket, 10, PHP_BINARY_READ);
- var_dump($data);
-
- socket_close($client);
- socket_close($socket);
- socket_close($server);
+ /* Setup socket server */
+ $server = socket_create(AF_INET, SOCK_STREAM, getprotobyname('tcp'));
+ if (!$server) {
+ die('Unable to create AF_INET socket [server]');
+ }
+
+ if (!socket_bind($server, '127.0.0.1', 0)) {
+ die("Unable to bind to 127.0.0.1");
+ }
+
+ if (!socket_listen($server, 2)) {
+ die('Unable to listen on socket');
+ }
+
+ socket_getsockname($server, $unused, $port);
+
+ /* Connect to it */
+ $client = socket_create(AF_INET, SOCK_STREAM, getprotobyname('tcp'));
+ if (!$client) {
+ die('Unable to create AF_INET socket [client]');
+ }
+ if (!socket_connect($client, '127.0.0.1', $port)) {
+ die('Unable to connect to server socket');
+ }
+
+ /* Accept that connection */
+ $socket = socket_accept($server);
+ if (!$socket) {
+ die('Unable to accept connection');
+ }
+
+ socket_write($client, "ABCdef123\n");
+
+ $data = socket_read($socket, 10, PHP_BINARY_READ);
+ var_dump($data);
+
+ socket_close($client);
+ socket_close($socket);
+ socket_close($server);
?>
--EXPECT--
string(10) "ABCdef123
diff --git a/ext/sockets/tests/ipv6_skipif.inc b/ext/sockets/tests/ipv6_skipif.inc
index 8c723a0b20..b2a28bfb02 100644
--- a/ext/sockets/tests/ipv6_skipif.inc
+++ b/ext/sockets/tests/ipv6_skipif.inc
@@ -1,7 +1,7 @@
<?php
if (getenv("CI_NO_IPV6") || !defined("AF_INET6")) {
- die('skip no IPv6 support');
+ die('skip no IPv6 support');
}
if (@stream_socket_client('udp://[::1]:8888') === false)
- die('skip no IPv6 support');
+ die('skip no IPv6 support');
diff --git a/ext/sockets/tests/ipv6loop.phpt b/ext/sockets/tests/ipv6loop.phpt
index 24e2b6d4f6..109da5bc2d 100644
--- a/ext/sockets/tests/ipv6loop.phpt
+++ b/ext/sockets/tests/ipv6loop.phpt
@@ -9,48 +9,48 @@ IPv6 Loopback test
?>
--FILE--
<?php
- /* Setup socket server */
- $server = socket_create(AF_INET6, SOCK_STREAM, getprotobyname('tcp'));
- if (!$server) {
- die('Unable to create AF_INET6 socket [server]');
- }
- $bound = false;
- for($port = 31337; $port < 31357; ++$port) {
- if (@socket_bind($server, '::1', $port)) {
- $bound = true;
- break;
- }
- }
- if (!$bound) {
- die("Unable to bind to [::1]:$port");
- }
- if (!socket_listen($server, 2)) {
- die('Unable to listen on socket');
- }
+ /* Setup socket server */
+ $server = socket_create(AF_INET6, SOCK_STREAM, getprotobyname('tcp'));
+ if (!$server) {
+ die('Unable to create AF_INET6 socket [server]');
+ }
+ $bound = false;
+ for($port = 31337; $port < 31357; ++$port) {
+ if (@socket_bind($server, '::1', $port)) {
+ $bound = true;
+ break;
+ }
+ }
+ if (!$bound) {
+ die("Unable to bind to [::1]:$port");
+ }
+ if (!socket_listen($server, 2)) {
+ die('Unable to listen on socket');
+ }
- /* Connect to it */
- $client = socket_create(AF_INET6, SOCK_STREAM, getprotobyname('tcp'));
- if (!$client) {
- die('Unable to create AF_INET6 socket [client]');
- }
- if (!socket_connect($client, '::1', $port)) {
- die('Unable to connect to server socket');
- }
+ /* Connect to it */
+ $client = socket_create(AF_INET6, SOCK_STREAM, getprotobyname('tcp'));
+ if (!$client) {
+ die('Unable to create AF_INET6 socket [client]');
+ }
+ if (!socket_connect($client, '::1', $port)) {
+ die('Unable to connect to server socket');
+ }
- /* Accept that connection */
- $socket = socket_accept($server);
- if (!$socket) {
- die('Unable to accept connection');
- }
+ /* Accept that connection */
+ $socket = socket_accept($server);
+ if (!$socket) {
+ die('Unable to accept connection');
+ }
- socket_write($client, "ABCdef123\n");
+ socket_write($client, "ABCdef123\n");
- $data = socket_read($socket, 10, PHP_BINARY_READ);
- var_dump($data);
+ $data = socket_read($socket, 10, PHP_BINARY_READ);
+ var_dump($data);
- socket_close($client);
- socket_close($socket);
- socket_close($server);
+ socket_close($client);
+ socket_close($socket);
+ socket_close($server);
?>
--EXPECT--
string(10) "ABCdef123
diff --git a/ext/sockets/tests/mcast_helpers.php.inc b/ext/sockets/tests/mcast_helpers.php.inc
index ad65a3f9d6..7b73a9d77a 100644
--- a/ext/sockets/tests/mcast_helpers.php.inc
+++ b/ext/sockets/tests/mcast_helpers.php.inc
@@ -1,8 +1,8 @@
<?php
function checktimeout($sock, $limit) {
- $readfs = array($sock);
- $writefs = $exceptfs = array();
- if (socket_select($readfs, $writefs, $exceptfs, 0, $limit*1000) != 1) {
- die("Socket read timeout hit. Can be a bug, a test bug, or a firewall issue.");
- }
+ $readfs = array($sock);
+ $writefs = $exceptfs = array();
+ if (socket_select($readfs, $writefs, $exceptfs, 0, $limit*1000) != 1) {
+ die("Socket read timeout hit. Can be a bug, a test bug, or a firewall issue.");
+ }
}
diff --git a/ext/sockets/tests/mcast_ipv4_recv.phpt b/ext/sockets/tests/mcast_ipv4_recv.phpt
index f56b21a2fa..16e2e91b62 100644
--- a/ext/sockets/tests/mcast_ipv4_recv.phpt
+++ b/ext/sockets/tests/mcast_ipv4_recv.phpt
@@ -8,7 +8,7 @@ if (!extension_loaded('sockets')) {
if (getenv('SKIP_ONLINE_TESTS')) die('skip online test');
$s = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
$br = socket_bind($s, '0.0.0.0', 3000);
-$so = socket_set_option($s, IPPROTO_IP, MCAST_JOIN_GROUP, array(
+$so = @socket_set_option($s, IPPROTO_IP, MCAST_JOIN_GROUP, array(
"group" => '224.0.0.23',
"interface" => 'lo',
));
@@ -43,8 +43,8 @@ $br = socket_bind($s, '0.0.0.0', 3000);
var_dump($br);
$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
+ "group" => $mcastaddr,
+ "interface" => $interface,
));
var_dump($so);
@@ -54,101 +54,101 @@ var_dump($r);
$i = 0;
checktimeout($s, 500);
while (($str = socket_read($s, 3000)) !== FALSE) {
- $i++;
- echo "$i> ", $str, "\n";
+ $i++;
+ echo "$i> ", $str, "\n";
if ($i == 1) {
- echo "leaving group\n";
- $so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
- $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);
- var_dump($r);
+ echo "leaving group\n";
+ $so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
+ "group" => $mcastaddr,
+ "interface" => $interface,
+ ));
+ var_dump($so);
+ $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
+ var_dump($r);
+ $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);
+ var_dump($r);
}
if ($i == 2) {
- echo "re-joining group\n";
- $so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- ));
- var_dump($so);
- $r = socket_sendto($sends2, $m = "ignored mcast packet (different interface)", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
- $r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
+ echo "re-joining group\n";
+ $so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
+ "group" => $mcastaddr,
+ "interface" => $interface,
+ ));
+ var_dump($so);
+ $r = socket_sendto($sends2, $m = "ignored mcast packet (different interface)", strlen($m), 0, $mcastaddr, 3000);
+ var_dump($r);
+ $r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);
+ var_dump($r);
}
if ($i == 3) {
- echo "blocking source\n";
- $so = socket_set_option($s, $level, MCAST_BLOCK_SOURCE, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- "source" => $sblock,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "ignored packet (blocked source)", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
- $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);
- var_dump($r);
+ echo "blocking source\n";
+ $so = socket_set_option($s, $level, MCAST_BLOCK_SOURCE, array(
+ "group" => $mcastaddr,
+ "interface" => $interface,
+ "source" => $sblock,
+ ));
+ var_dump($so);
+ $r = socket_sendto($sends1, $m = "ignored packet (blocked source)", strlen($m), 0, $mcastaddr, 3000);
+ var_dump($r);
+ $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);
+ var_dump($r);
}
if ($i == 4) {
- echo "unblocking source\n";
- $so = socket_set_option($s, $level, MCAST_UNBLOCK_SOURCE, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- "source" => $sblock,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "mcast packet from 127.0.0.1", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
+ echo "unblocking source\n";
+ $so = socket_set_option($s, $level, MCAST_UNBLOCK_SOURCE, array(
+ "group" => $mcastaddr,
+ "interface" => $interface,
+ "source" => $sblock,
+ ));
+ var_dump($so);
+ $r = socket_sendto($sends1, $m = "mcast packet from 127.0.0.1", strlen($m), 0, $mcastaddr, 3000);
+ var_dump($r);
}
if ($i == 5) {
- echo "leaving group\n";
- $so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
- $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);
- var_dump($r);
+ echo "leaving group\n";
+ $so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
+ "group" => $mcastaddr,
+ "interface" => $interface,
+ ));
+ var_dump($so);
+ $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
+ var_dump($r);
+ $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);
+ var_dump($r);
}
if ($i == 6) {
- echo "joining source group\n";
- $so = socket_set_option($s, $level, MCAST_JOIN_SOURCE_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- "source" => $sblock,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "mcast packet from 127.0.0.1", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
+ echo "joining source group\n";
+ $so = socket_set_option($s, $level, MCAST_JOIN_SOURCE_GROUP, array(
+ "group" => $mcastaddr,
+ "interface" => $interface,
+ "source" => $sblock,
+ ));
+ var_dump($so);
+ $r = socket_sendto($sends1, $m = "mcast packet from 127.0.0.1", strlen($m), 0, $mcastaddr, 3000);
+ var_dump($r);
}
if ($i == 7) {
- echo "leaving source group\n";
- $so = socket_set_option($s, $level, MCAST_LEAVE_SOURCE_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- "source" => $sblock,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
- $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);
- var_dump($r);
+ echo "leaving source group\n";
+ $so = socket_set_option($s, $level, MCAST_LEAVE_SOURCE_GROUP, array(
+ "group" => $mcastaddr,
+ "interface" => $interface,
+ "source" => $sblock,
+ ));
+ var_dump($so);
+ $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
+ var_dump($r);
+ $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "127.0.0.1", 3000);
+ var_dump($r);
}
if ($i == 8) {
/* echo "rjsg\n";
- $so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- ));
- var_dump($so);*/
- break;
+ $so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
+ "group" => $mcastaddr,
+ "interface" => $interface,
+ ));
+ var_dump($so);*/
+ break;
}
}
diff --git a/ext/sockets/tests/mcast_ipv6_recv.phpt b/ext/sockets/tests/mcast_ipv6_recv.phpt
index 62fa1a9c4d..10233b49a5 100644
--- a/ext/sockets/tests/mcast_ipv6_recv.phpt
+++ b/ext/sockets/tests/mcast_ipv6_recv.phpt
@@ -63,8 +63,8 @@ $br = socket_bind($s, '::0', 3000) or die("err");
var_dump($br);
$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
+ "group" => $mcastaddr,
+ "interface" => $interface,
)) or die("err");
var_dump($so);
@@ -81,100 +81,100 @@ var_dump($r);
$i = 0;
checktimeout($s, 500);
while (($str = socket_read($s, 3000)) !== FALSE) {
- $i++;
- echo "$i> ", $str, "\n";
+ $i++;
+ echo "$i> ", $str, "\n";
if ($i == 1) {
- echo "leaving group\n";
- $so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
- $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
- var_dump($r);
+ echo "leaving group\n";
+ $so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
+ "group" => $mcastaddr,
+ "interface" => $interface,
+ ));
+ var_dump($so);
+ $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
+ var_dump($r);
+ $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
+ var_dump($r);
}
if ($i == 2) {
- echo "re-joining group\n";
- $so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
+ echo "re-joining group\n";
+ $so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
+ "group" => $mcastaddr,
+ "interface" => $interface,
+ ));
+ var_dump($so);
+ $r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);
+ var_dump($r);
}
if ($i == 3) {
- echo "blocking source\n";
- $so = socket_set_option($s, $level, MCAST_BLOCK_SOURCE, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- "source" => $sblock,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "ignored packet (blocked source)", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
- $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
- var_dump($r);
+ echo "blocking source\n";
+ $so = socket_set_option($s, $level, MCAST_BLOCK_SOURCE, array(
+ "group" => $mcastaddr,
+ "interface" => $interface,
+ "source" => $sblock,
+ ));
+ var_dump($so);
+ $r = socket_sendto($sends1, $m = "ignored packet (blocked source)", strlen($m), 0, $mcastaddr, 3000);
+ var_dump($r);
+ $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
+ var_dump($r);
}
if ($i == 4) {
- echo "unblocking source\n";
- $so = socket_set_option($s, $level, MCAST_UNBLOCK_SOURCE, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- "source" => $sblock,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
+ echo "unblocking source\n";
+ $so = socket_set_option($s, $level, MCAST_UNBLOCK_SOURCE, array(
+ "group" => $mcastaddr,
+ "interface" => $interface,
+ "source" => $sblock,
+ ));
+ var_dump($so);
+ $r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);
+ var_dump($r);
}
if ($i == 5) {
- echo "leaving group\n";
- $so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
- $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
- var_dump($r);
+ echo "leaving group\n";
+ $so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
+ "group" => $mcastaddr,
+ "interface" => $interface,
+ ));
+ var_dump($so);
+ $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
+ var_dump($r);
+ $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
+ var_dump($r);
}
if ($i == 6) {
- echo "joining source group\n";
- $so = socket_set_option($s, $level, MCAST_JOIN_SOURCE_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- "source" => $sblock,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "mcast packet from desired source", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
+ echo "joining source group\n";
+ $so = socket_set_option($s, $level, MCAST_JOIN_SOURCE_GROUP, array(
+ "group" => $mcastaddr,
+ "interface" => $interface,
+ "source" => $sblock,
+ ));
+ var_dump($so);
+ $r = socket_sendto($sends1, $m = "mcast packet from desired source", strlen($m), 0, $mcastaddr, 3000);
+ var_dump($r);
}
if ($i == 7) {
- echo "leaving source group\n";
- $so = socket_set_option($s, $level, MCAST_LEAVE_SOURCE_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- "source" => $sblock,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
- $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
- var_dump($r);
+ echo "leaving source group\n";
+ $so = socket_set_option($s, $level, MCAST_LEAVE_SOURCE_GROUP, array(
+ "group" => $mcastaddr,
+ "interface" => $interface,
+ "source" => $sblock,
+ ));
+ var_dump($so);
+ $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
+ var_dump($r);
+ $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
+ var_dump($r);
}
if ($i == 8) {
- /*echo "joining source group\n";
- $so = socket_set_option($s, $level, MCAST_JOIN_SOURCE_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- "source" => $sblock,
- ));
- var_dump($so);*/
- break;
+ /*echo "joining source group\n";
+ $so = socket_set_option($s, $level, MCAST_JOIN_SOURCE_GROUP, array(
+ "group" => $mcastaddr,
+ "interface" => $interface,
+ "source" => $sblock,
+ ));
+ var_dump($so);*/
+ break;
}
}
diff --git a/ext/sockets/tests/mcast_ipv6_recv_limited.phpt b/ext/sockets/tests/mcast_ipv6_recv_limited.phpt
index c739264062..87b38c144c 100644
--- a/ext/sockets/tests/mcast_ipv6_recv_limited.phpt
+++ b/ext/sockets/tests/mcast_ipv6_recv_limited.phpt
@@ -58,8 +58,8 @@ $br = socket_bind($s, '::0', 3000) or die("err");
var_dump($br);
$so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
+ "group" => $mcastaddr,
+ "interface" => $interface,
)) or die("err");
var_dump($so);
@@ -76,33 +76,33 @@ var_dump($r);
$i = 0;
checktimeout($s, 500);
while (($str = socket_read($s, 3000, 500)) !== FALSE) {
- $i++;
- echo "$i> ", $str, "\n";
+ $i++;
+ echo "$i> ", $str, "\n";
if ($i == 1) {
- echo "leaving group\n";
- $so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
- $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
- var_dump($r);
+ echo "leaving group\n";
+ $so = socket_set_option($s, $level, MCAST_LEAVE_GROUP, array(
+ "group" => $mcastaddr,
+ "interface" => $interface,
+ ));
+ var_dump($so);
+ $r = socket_sendto($sends1, $m = "ignored mcast packet", strlen($m), 0, $mcastaddr, 3000);
+ var_dump($r);
+ $r = socket_sendto($sends1, $m = "unicast packet", strlen($m), 0, "::1", 3000);
+ var_dump($r);
}
if ($i == 2) {
- echo "re-joining group\n";
- $so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
- "group" => $mcastaddr,
- "interface" => $interface,
- ));
- var_dump($so);
- $r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);
- var_dump($r);
+ echo "re-joining group\n";
+ $so = socket_set_option($s, $level, MCAST_JOIN_GROUP, array(
+ "group" => $mcastaddr,
+ "interface" => $interface,
+ ));
+ var_dump($so);
+ $r = socket_sendto($sends1, $m = "mcast packet", strlen($m), 0, $mcastaddr, 3000);
+ var_dump($r);
}
if ($i == 3) {
- break;
+ break;
}
}
diff --git a/ext/sockets/tests/socket_abstract_path.phpt b/ext/sockets/tests/socket_abstract_path.phpt
index 4c89dc4238..bbe4debeaa 100644
--- a/ext/sockets/tests/socket_abstract_path.phpt
+++ b/ext/sockets/tests/socket_abstract_path.phpt
@@ -28,8 +28,8 @@ socket_connect($clients, $path) or die("Error connecting");
$conns = socket_accept($servers) or die("Could not accept connection");
$r = socket_sendmsg($clients, [
- //"name" => [ "addr" => $path, ],
- "iov" => ["test ", "thing", "\n"],
+ //"name" => [ "addr" => $path, ],
+ "iov" => ["test ", "thing", "\n"],
], 0);
var_dump($r);
checktimeout($conns, 500);
diff --git a/ext/sockets/tests/socket_abstract_path_sendmsg.phpt b/ext/sockets/tests/socket_abstract_path_sendmsg.phpt
index e8499e021c..ca9ab3f534 100644
--- a/ext/sockets/tests/socket_abstract_path_sendmsg.phpt
+++ b/ext/sockets/tests/socket_abstract_path_sendmsg.phpt
@@ -24,8 +24,8 @@ $s = socket_create(AF_UNIX, SOCK_DGRAM, 0) or die("err");
socket_bind($s, $path) or die("err");
$r = socket_sendmsg($sends1, [
- "name" => [ "path" => $path],
- "iov" => ["test ", "thing", "\n"],
+ "name" => [ "path" => $path],
+ "iov" => ["test ", "thing", "\n"],
], 0);
var_dump($r);
checktimeout($s, 500);
diff --git a/ext/sockets/tests/socket_connect_params.phpt b/ext/sockets/tests/socket_connect_params.phpt
index 94c38de1cb..f1fdf55a81 100644
--- a/ext/sockets/tests/socket_connect_params.phpt
+++ b/ext/sockets/tests/socket_connect_params.phpt
@@ -14,8 +14,11 @@ fa@php.net
$rand = rand(1,999);
$s_c = socket_create_listen(31330+$rand);
// wrong parameter count
- $s_w = socket_connect();
- $s_w = socket_connect($s_c);
+ try {
+ $s_w = socket_connect($s_c);
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$s_w = socket_connect($s_c, '0.0.0.0');
$s_w = socket_connect($s_c, '0.0.0.0', 31330+$rand);
@@ -23,9 +26,7 @@ fa@php.net
?>
--EXPECTF--
-Warning: socket_connect() expects at least 2 parameters, 0 given in %s on line %d
-
-Warning: socket_connect() expects at least 2 parameters, 1 given in %s on line %d
+socket_connect() expects at least 2 parameters, 1 given
Warning: socket_connect(): Socket of type AF_INET requires 3 arguments in %s on line %d
diff --git a/ext/sockets/tests/socket_create_listen_used.phpt b/ext/sockets/tests/socket_create_listen_used.phpt
index b41e2caefc..2dfec4fbf7 100644
--- a/ext/sockets/tests/socket_create_listen_used.phpt
+++ b/ext/sockets/tests/socket_create_listen_used.phpt
@@ -18,7 +18,6 @@ fa@php.net
// default invocation
$s_c_l2 = socket_create_listen(31330+$rand);
var_dump($s_c_l2);
- socket_close($s_c_l2);
socket_close($s_c_l);
?>
--EXPECTF--
@@ -26,5 +25,3 @@ resource(%i) of type (Socket)
Warning: socket_create_listen(): unable to bind to given address [%i]: %a in %s on line %d
bool(false)
-
-Warning: socket_close() expects parameter 1 to be resource, bool given in %s on line %d
diff --git a/ext/sockets/tests/socket_create_pair-wrongparams-win32.phpt b/ext/sockets/tests/socket_create_pair-wrongparams-win32.phpt
index 554819ac99..9216a87046 100644
--- a/ext/sockets/tests/socket_create_pair-wrongparams-win32.phpt
+++ b/ext/sockets/tests/socket_create_pair-wrongparams-win32.phpt
@@ -10,10 +10,6 @@ if (!extension_loaded('sockets')) {
}
--FILE--
<?php
-var_dump(socket_create_pair(AF_INET, null, null));
-
-$domain = 'unknown';
-var_dump(socket_create_pair($domain, SOCK_STREAM, 0, $sockets));
var_dump(socket_create_pair(AF_INET, null, null, $sockets));
@@ -21,17 +17,12 @@ var_dump(socket_create_pair(31337, null, null, $sockets));
var_dump(socket_create_pair(AF_INET, 31337, 0, $sockets));
--EXPECTF--
-Warning: socket_create_pair() expects exactly 4 parameters, 3 given in %s on line %d
-NULL
-
-Warning: socket_create_pair() expects parameter 1 to be int, string given in %s on line %d
-NULL
bool(true)
-Warning: socket_create_pair(): invalid socket domain [31337] specified for argument 1, assuming AF_INET in %s on line %d
+Warning: socket_create_pair(): Invalid socket domain [31337] specified for argument 1, assuming AF_INET in %s on line %d
bool(true)
-Warning: socket_create_pair(): invalid socket type [31337] specified for argument 2, assuming SOCK_STREAM in %s on line %d
+Warning: socket_create_pair(): Invalid socket type [31337] specified for argument 2, assuming SOCK_STREAM in %s on line %d
bool(true)
--CREDITS--
Till Klampaeckel, till@php.net
diff --git a/ext/sockets/tests/socket_create_pair-wrongparams.phpt b/ext/sockets/tests/socket_create_pair-wrongparams.phpt
index 856d2cdc52..a7bc17b86b 100644
--- a/ext/sockets/tests/socket_create_pair-wrongparams.phpt
+++ b/ext/sockets/tests/socket_create_pair-wrongparams.phpt
@@ -10,34 +10,26 @@ if (!extension_loaded('sockets')) {
}
--FILE--
<?php
-var_dump(socket_create_pair(AF_INET, null, null));
-
-$domain = 'unknown';
-var_dump(socket_create_pair($domain, SOCK_STREAM, 0, $sockets));
var_dump(socket_create_pair(AF_INET, null, null, $sockets));
var_dump(socket_create_pair(31337, null, null, $sockets));
var_dump(socket_create_pair(AF_INET, 31337, 0, $sockets));
---EXPECTF--
-Warning: socket_create_pair() expects exactly 4 parameters, 3 given in %s on line %d
-NULL
-Warning: socket_create_pair() expects parameter 1 to be int, string given in %s on line %d
-NULL
-
-Warning: socket_create_pair(): unable to create socket pair [%d]: %s not supported in %s on line %d
+?>
+--EXPECTF--
+Warning: socket_create_pair(): Unable to create socket pair [%d]: %s not supported in %s on line %d
bool(false)
-Warning: socket_create_pair(): invalid socket domain [31337] specified for argument 1, assuming AF_INET in %s on line %d
+Warning: socket_create_pair(): Invalid socket domain [31337] specified for argument 1, assuming AF_INET in %s on line %d
-Warning: socket_create_pair(): unable to create socket pair [%d]: %s not supported in %s on line %d
+Warning: socket_create_pair(): Unable to create socket pair [%d]: %s not supported in %s on line %d
bool(false)
-Warning: socket_create_pair(): invalid socket type [31337] specified for argument 2, assuming SOCK_STREAM in %s on line %d
+Warning: socket_create_pair(): Invalid socket type [31337] specified for argument 2, assuming SOCK_STREAM in %s on line %d
-Warning: socket_create_pair(): unable to create socket pair [%d]: %s not supported %s on line %d
+Warning: socket_create_pair(): Unable to create socket pair [%d]: %s not supported %s on line %d
bool(false)
--CREDITS--
Till Klampaeckel, till@php.net
diff --git a/ext/sockets/tests/socket_export_stream-2.phpt b/ext/sockets/tests/socket_export_stream-2.phpt
index d3db5e36c8..e95945038a 100644
--- a/ext/sockets/tests/socket_export_stream-2.phpt
+++ b/ext/sockets/tests/socket_export_stream-2.phpt
@@ -8,39 +8,31 @@ if (!extension_loaded('sockets')) {
--FILE--
<?php
-var_dump(socket_export_stream());
-var_dump(socket_export_stream(1, 2));
-var_dump(socket_export_stream(1));
-var_dump(socket_export_stream(new stdclass));
-var_dump(socket_export_stream(fopen(__FILE__, "rb")));
-var_dump(socket_export_stream(stream_socket_server("udp://127.0.0.1:58392", $errno, $errstr, STREAM_SERVER_BIND)));
+try {
+ var_dump(socket_export_stream(fopen(__FILE__, "rb")));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(socket_export_stream(stream_socket_server("udp://127.0.0.1:58392", $errno, $errstr, STREAM_SERVER_BIND)));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
$s = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
var_dump($s);
socket_close($s);
-var_dump(socket_export_stream($s));
+try {
+ var_dump(socket_export_stream($s));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done.";
+?>
--EXPECTF--
-Warning: socket_export_stream() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: socket_export_stream() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: socket_export_stream() expects parameter 1 to be resource, int given in %s on line %d
-NULL
-
-Warning: socket_export_stream() expects parameter 1 to be resource, object given in %s on line %d
-NULL
-
-Warning: socket_export_stream(): supplied resource is not a valid Socket resource in %s on line %d
-bool(false)
-
-Warning: socket_export_stream(): supplied resource is not a valid Socket resource in %s on line %d
-bool(false)
+socket_export_stream(): supplied resource is not a valid Socket resource
+socket_export_stream(): supplied resource is not a valid Socket resource
resource(%d) of type (Socket)
-
-Warning: socket_export_stream(): supplied resource is not a valid Socket resource in %s on line %d
-bool(false)
+socket_export_stream(): supplied resource is not a valid Socket resource
Done.
diff --git a/ext/sockets/tests/socket_export_stream-3.phpt b/ext/sockets/tests/socket_export_stream-3.phpt
index 69b0ebe47d..ac48d865b9 100644
--- a/ext/sockets/tests/socket_export_stream-3.phpt
+++ b/ext/sockets/tests/socket_export_stream-3.phpt
@@ -6,7 +6,7 @@ if (!extension_loaded('sockets')) {
die('SKIP sockets extension not available.');
}
$s = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
-$br = socket_bind($s, '0.0.0.0', 58393);
+$br = @socket_bind($s, '0.0.0.0', 58393);
if ($br === false)
die("SKIP IPv4/port 58393 not available");
$so = @socket_set_option($s, IPPROTO_IP, MCAST_JOIN_GROUP, array(
@@ -23,8 +23,8 @@ socket_bind($sock, '0.0.0.0', 58393);
$stream = socket_export_stream($sock);
var_dump($stream);
$so = socket_set_option($sock, IPPROTO_IP, MCAST_JOIN_GROUP, array(
- "group" => '224.0.0.23',
- "interface" => "lo",
+ "group" => '224.0.0.23',
+ "interface" => "lo",
));
var_dump($so);
diff --git a/ext/sockets/tests/socket_export_stream-4-win.phpt b/ext/sockets/tests/socket_export_stream-4-win.phpt
index 3b80092c18..24fc604f6e 100644
--- a/ext/sockets/tests/socket_export_stream-4-win.phpt
+++ b/ext/sockets/tests/socket_export_stream-4-win.phpt
@@ -12,20 +12,32 @@ if(substr(PHP_OS, 0, 3) != 'WIN' ) {
<?php
function test($stream, $sock) {
- if ($stream !== null) {
- echo "stream_set_blocking ";
- print_r(stream_set_blocking($stream, 0));
- echo "\n";
- }
- if ($sock !== null) {
- echo "socket_set_block ";
- print_r(socket_set_block($sock));
- echo "\n";
- echo "socket_get_option ";
- print_r(socket_get_option($sock, SOL_SOCKET, SO_TYPE));
- echo "\n";
- }
- echo "\n";
+ if ($stream !== null) {
+ echo "stream_set_blocking ";
+ try {
+ print_r(stream_set_blocking($stream, 0));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ echo "\n";
+ }
+ if ($sock !== null) {
+ echo "socket_set_block ";
+ try {
+ print_r(socket_set_block($sock));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ echo "\n";
+ echo "socket_get_option ";
+ try {
+ print_r(socket_get_option($sock, SOL_SOCKET, SO_TYPE));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ echo "\n";
+ }
+ echo "\n";
}
echo "normal\n";
@@ -80,8 +92,7 @@ stream_set_blocking 1
close stream
-stream_set_blocking
-Warning: stream_set_blocking(): supplied resource is not a valid stream resource in %s on line %d
+stream_set_blocking stream_set_blocking(): supplied resource is not a valid stream resource
socket_set_block
Warning: socket_set_block(): unable to set blocking mode [%d]: An operation was attempted on something that is not a socket.
@@ -94,14 +105,11 @@ Warning: socket_get_option(): unable to retrieve socket option [%d]: An operatio
close socket
-stream_set_blocking
-Warning: stream_set_blocking(): supplied resource is not a valid stream resource in %s on line %d
+stream_set_blocking stream_set_blocking(): supplied resource is not a valid stream resource
-socket_set_block
-Warning: socket_set_block(): supplied resource is not a valid Socket resource in %s on line %d
+socket_set_block socket_set_block(): supplied resource is not a valid Socket resource
-socket_get_option
-Warning: socket_get_option(): supplied resource is not a valid Socket resource in %s on line %d
+socket_get_option socket_get_option(): supplied resource is not a valid Socket resource
Done.
diff --git a/ext/sockets/tests/socket_export_stream-4.phpt b/ext/sockets/tests/socket_export_stream-4.phpt
index ff329ec795..a42c31e123 100644
--- a/ext/sockets/tests/socket_export_stream-4.phpt
+++ b/ext/sockets/tests/socket_export_stream-4.phpt
@@ -12,20 +12,32 @@ if(substr(PHP_OS, 0, 3) == 'WIN' ) {
<?php
function test($stream, $sock) {
- if ($stream !== null) {
- echo "stream_set_blocking ";
- print_r(stream_set_blocking($stream, 0));
- echo "\n";
- }
- if ($sock !== null) {
- echo "socket_set_block ";
- print_r(socket_set_block($sock));
- echo "\n";
- echo "socket_get_option ";
- print_r(socket_get_option($sock, SOL_SOCKET, SO_TYPE));
- echo "\n";
- }
- echo "\n";
+ if ($stream !== null) {
+ echo "stream_set_blocking ";
+ try {
+ print_r(stream_set_blocking($stream, 0));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ echo "\n";
+ }
+ if ($sock !== null) {
+ echo "socket_set_block ";
+ try {
+ print_r(socket_set_block($sock));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ echo "\n";
+ echo "socket_get_option ";
+ try {
+ print_r(socket_get_option($sock, SOL_SOCKET, SO_TYPE));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ echo "\n";
+ }
+ echo "\n";
}
echo "normal\n";
@@ -80,8 +92,7 @@ stream_set_blocking 1
close stream
-stream_set_blocking
-Warning: stream_set_blocking(): supplied resource is not a valid stream resource in %s on line %d
+stream_set_blocking stream_set_blocking(): supplied resource is not a valid stream resource
socket_set_block
Warning: socket_set_block(): unable to set blocking mode [%d]: %s in %s on line %d
@@ -92,14 +103,11 @@ Warning: socket_get_option(): unable to retrieve socket option [%d]: %s in %s on
close socket
-stream_set_blocking
-Warning: stream_set_blocking(): supplied resource is not a valid stream resource in %s on line %d
+stream_set_blocking stream_set_blocking(): supplied resource is not a valid stream resource
-socket_set_block
-Warning: socket_set_block(): supplied resource is not a valid Socket resource in %s on line %d
+socket_set_block socket_set_block(): supplied resource is not a valid Socket resource
-socket_get_option
-Warning: socket_get_option(): supplied resource is not a valid Socket resource in %s on line %d
+socket_get_option socket_get_option(): supplied resource is not a valid Socket resource
Done.
diff --git a/ext/sockets/tests/socket_getpeername_ipv4loop.phpt b/ext/sockets/tests/socket_getpeername_ipv4loop.phpt
index c7eb1003e0..0c242e75c1 100644
--- a/ext/sockets/tests/socket_getpeername_ipv4loop.phpt
+++ b/ext/sockets/tests/socket_getpeername_ipv4loop.phpt
@@ -11,8 +11,8 @@ Tatjana Andersen tatjana.andersen@redpill-linpro.com
?>
--FILE--
<?php
- /* Bind and connect sockets to localhost */
- $localhost = '127.0.0.1';
+ /* Bind and connect sockets to localhost */
+ $localhost = '127.0.0.1';
/* Setup socket server */
$server = socket_create(AF_INET, SOCK_STREAM, getprotobyname('tcp'));
@@ -20,16 +20,16 @@ Tatjana Andersen tatjana.andersen@redpill-linpro.com
die('Unable to create AF_INET socket [server]');
}
- $minport = 31337;
- $maxport = 31356;
- $bound = false;
- for($port = $minport; $port <= $maxport; ++$port) {
- if (@socket_bind($server, $localhost, $port)) {
- $bound = true;
- break;
- }
- }
- if (!$bound) {
+ $minport = 31337;
+ $maxport = 31356;
+ $bound = false;
+ for($port = $minport; $port <= $maxport; ++$port) {
+ if (@socket_bind($server, $localhost, $port)) {
+ $bound = true;
+ break;
+ }
+ }
+ if (!$bound) {
die('Unable to bind to '.$localhost);
}
if (!socket_listen($server, 2)) {
@@ -51,9 +51,9 @@ Tatjana Andersen tatjana.andersen@redpill-linpro.com
die('Unable to accept connection');
}
- if (!socket_getpeername($client, $address, $peerport)) {
- die('Unable to retrieve peer name');
- }
+ if (!socket_getpeername($client, $address, $peerport)) {
+ die('Unable to retrieve peer name');
+ }
var_dump($address, $port === $peerport);
socket_close($client);
diff --git a/ext/sockets/tests/socket_getpeername_ipv6loop.phpt b/ext/sockets/tests/socket_getpeername_ipv6loop.phpt
index 73a5a66410..3dab562bbb 100644
--- a/ext/sockets/tests/socket_getpeername_ipv6loop.phpt
+++ b/ext/sockets/tests/socket_getpeername_ipv6loop.phpt
@@ -12,8 +12,8 @@ require 'ipv6_skipif.inc';
?>
--FILE--
<?php
- /* Bind and connect sockets to localhost */
- $localhost = '::1';
+ /* Bind and connect sockets to localhost */
+ $localhost = '::1';
/* Setup socket server */
$server = socket_create(AF_INET6, SOCK_STREAM, getprotobyname('tcp'));
@@ -21,16 +21,16 @@ require 'ipv6_skipif.inc';
die('Unable to create AF_INET6 socket [server]');
}
- $minport = 31337;
- $maxport = 31356;
- $bound = false;
- for($port = $minport; $port <= $maxport; ++$port) {
- if (@socket_bind($server, $localhost, $port)) {
- $bound = true;
- break;
- }
- }
- if (!$bound) {
+ $minport = 31337;
+ $maxport = 31356;
+ $bound = false;
+ for($port = $minport; $port <= $maxport; ++$port) {
+ if (@socket_bind($server, $localhost, $port)) {
+ $bound = true;
+ break;
+ }
+ }
+ if (!$bound) {
die('Unable to bind to '.$localhost);
}
if (!socket_listen($server, 2)) {
@@ -49,12 +49,12 @@ require 'ipv6_skipif.inc';
/* Accept that connection */
$socket = socket_accept($server);
if (!$socket) {
- die('Unable to accept connection');
+ die('Unable to accept connection');
}
- if (!socket_getpeername($client, $address, $peerport)) {
- die('Unable to retrieve peer name');
- }
+ if (!socket_getpeername($client, $address, $peerport)) {
+ die('Unable to retrieve peer name');
+ }
var_dump($address, $port === $peerport);
socket_close($client);
diff --git a/ext/sockets/tests/socket_import_stream-2.phpt b/ext/sockets/tests/socket_import_stream-2.phpt
index c9eb583a3d..16c25f2307 100644
--- a/ext/sockets/tests/socket_import_stream-2.phpt
+++ b/ext/sockets/tests/socket_import_stream-2.phpt
@@ -8,40 +8,28 @@ if (!extension_loaded('sockets')) {
--FILE--
<?php
-var_dump(socket_import_stream());
-var_dump(socket_import_stream(1, 2));
-var_dump(socket_import_stream(1));
-var_dump(socket_import_stream(new stdclass));
var_dump(socket_import_stream(fopen(__FILE__, "rb")));
-var_dump(socket_import_stream(socket_create(AF_INET, SOCK_DGRAM, SOL_UDP)));
+try {
+ var_dump(socket_import_stream(socket_create(AF_INET, SOCK_DGRAM, SOL_UDP)));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
$s = stream_socket_server("udp://127.0.0.1:58394", $errno, $errstr, STREAM_SERVER_BIND);
var_dump($s);
var_dump(fclose($s));
-var_dump(socket_import_stream($s));
-
+try {
+ var_dump(socket_import_stream($s));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done.";
+?>
--EXPECTF--
-Warning: socket_import_stream() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: socket_import_stream() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: socket_import_stream() expects parameter 1 to be resource, int given in %s on line %d
-NULL
-
-Warning: socket_import_stream() expects parameter 1 to be resource, object given in %s on line %d
-NULL
-
-Warning: socket_import_stream(): cannot represent a stream of type STDIO as a Socket Descriptor in %s on line %d
-bool(false)
-
-Warning: socket_import_stream(): supplied resource is not a valid stream resource in %s on line %d
+Warning: socket_import_stream(): Cannot represent a stream of type STDIO as a Socket Descriptor in %s on line %d
bool(false)
+socket_import_stream(): supplied resource is not a valid stream resource
resource(%d) of type (stream)
bool(true)
-
-Warning: socket_import_stream(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+socket_import_stream(): supplied resource is not a valid stream resource
Done.
diff --git a/ext/sockets/tests/socket_import_stream-3.phpt b/ext/sockets/tests/socket_import_stream-3.phpt
index f83e8a487b..4f8668ec87 100644
--- a/ext/sockets/tests/socket_import_stream-3.phpt
+++ b/ext/sockets/tests/socket_import_stream-3.phpt
@@ -6,7 +6,7 @@ if (!extension_loaded('sockets')) {
die('SKIP sockets extension not available.');
}
$s = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
-$br = socket_bind($s, '0.0.0.0', 58379);
+$br = @socket_bind($s, '0.0.0.0', 58379);
if ($br === false)
die("SKIP IPv4/port 58379 not available");
$so = @socket_set_option($s, IPPROTO_IP, MCAST_JOIN_GROUP, array(
@@ -22,8 +22,8 @@ $stream = stream_socket_server("udp://0.0.0.0:58379", $errno, $errstr, STREAM_SE
$sock = socket_import_stream($stream);
var_dump($sock);
$so = socket_set_option($sock, IPPROTO_IP, MCAST_JOIN_GROUP, array(
- "group" => '224.0.0.23',
- "interface" => "lo",
+ "group" => '224.0.0.23',
+ "interface" => "lo",
));
var_dump($so);
diff --git a/ext/sockets/tests/socket_import_stream-4-win.phpt b/ext/sockets/tests/socket_import_stream-4-win.phpt
index e14e94c122..16a9c0087e 100644
--- a/ext/sockets/tests/socket_import_stream-4-win.phpt
+++ b/ext/sockets/tests/socket_import_stream-4-win.phpt
@@ -12,20 +12,32 @@ if(substr(PHP_OS, 0, 3) != 'WIN' ) {
<?php
function test($stream, $sock) {
- if ($stream !== null) {
- echo "stream_set_blocking ";
- print_r(stream_set_blocking($stream, 0));
- echo "\n";
- }
- if ($sock !== null) {
- echo "socket_set_block ";
- print_r(socket_set_block($sock));
- echo "\n";
- echo "socket_get_option ";
- print_r(socket_get_option($sock, SOL_SOCKET, SO_TYPE));
- echo "\n";
- }
- echo "\n";
+ if ($stream !== null) {
+ echo "stream_set_blocking ";
+ try {
+ print_r(stream_set_blocking($stream, 0));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ echo "\n";
+ }
+ if ($sock !== null) {
+ echo "socket_set_block ";
+ try {
+ print_r(socket_set_block($sock));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ echo "\n";
+ echo "socket_get_option ";
+ try {
+ print_r(socket_get_option($sock, SOL_SOCKET, SO_TYPE));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ echo "\n";
+ }
+ echo "\n";
}
echo "normal\n";
@@ -75,8 +87,7 @@ stream_set_blocking 1
close stream
-stream_set_blocking
-Warning: stream_set_blocking(): supplied resource is not a valid stream resource in %s on line %d
+stream_set_blocking stream_set_blocking(): supplied resource is not a valid stream resource
socket_set_block
Warning: socket_set_block(): unable to set blocking mode [10038]: %s
@@ -89,14 +100,11 @@ Warning: socket_get_option(): unable to retrieve socket option [10038]: %s
close socket
-stream_set_blocking
-Warning: stream_set_blocking(): supplied resource is not a valid stream resource in %s on line %d
+stream_set_blocking stream_set_blocking(): supplied resource is not a valid stream resource
-socket_set_block
-Warning: socket_set_block(): supplied resource is not a valid Socket resource in %s on line %d
+socket_set_block socket_set_block(): supplied resource is not a valid Socket resource
-socket_get_option
-Warning: socket_get_option(): supplied resource is not a valid Socket resource in %s on line %d
+socket_get_option socket_get_option(): supplied resource is not a valid Socket resource
Done.
diff --git a/ext/sockets/tests/socket_import_stream-4.phpt b/ext/sockets/tests/socket_import_stream-4.phpt
index f124161e10..d0ccf6b71e 100644
--- a/ext/sockets/tests/socket_import_stream-4.phpt
+++ b/ext/sockets/tests/socket_import_stream-4.phpt
@@ -12,20 +12,32 @@ if(substr(PHP_OS, 0, 3) == 'WIN' ) {
<?php
function test($stream, $sock) {
- if ($stream !== null) {
- echo "stream_set_blocking ";
- print_r(stream_set_blocking($stream, 0));
- echo "\n";
- }
- if ($sock !== null) {
- echo "socket_set_block ";
- print_r(socket_set_block($sock));
- echo "\n";
- echo "socket_get_option ";
- print_r(socket_get_option($sock, SOL_SOCKET, SO_TYPE));
- echo "\n";
- }
- echo "\n";
+ if ($stream !== null) {
+ echo "stream_set_blocking ";
+ try {
+ print_r(stream_set_blocking($stream, 0));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ echo "\n";
+ }
+ if ($sock !== null) {
+ echo "socket_set_block ";
+ try {
+ print_r(socket_set_block($sock));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ echo "\n";
+ echo "socket_get_option ";
+ try {
+ print_r(socket_get_option($sock, SOL_SOCKET, SO_TYPE));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ echo "\n";
+ }
+ echo "\n";
}
echo "normal\n";
@@ -75,8 +87,7 @@ stream_set_blocking 1
close stream
-stream_set_blocking
-Warning: stream_set_blocking(): supplied resource is not a valid stream resource in %s on line %d
+stream_set_blocking stream_set_blocking(): supplied resource is not a valid stream resource
socket_set_block
Warning: socket_set_block(): unable to set blocking mode [%d]: %s in %s on line %d
@@ -87,14 +98,11 @@ Warning: socket_get_option(): unable to retrieve socket option [%d]: %s in %s on
close socket
-stream_set_blocking
-Warning: stream_set_blocking(): supplied resource is not a valid stream resource in %s on line %d
+stream_set_blocking stream_set_blocking(): supplied resource is not a valid stream resource
-socket_set_block
-Warning: socket_set_block(): supplied resource is not a valid Socket resource in %s on line %d
+socket_set_block socket_set_block(): supplied resource is not a valid Socket resource
-socket_get_option
-Warning: socket_get_option(): supplied resource is not a valid Socket resource in %s on line %d
+socket_get_option socket_get_option(): supplied resource is not a valid Socket resource
Done.
diff --git a/ext/sockets/tests/socket_listen-wrongparams.phpt b/ext/sockets/tests/socket_listen-wrongparams.phpt
index 41d7ac1f10..b5715a5ff5 100644
--- a/ext/sockets/tests/socket_listen-wrongparams.phpt
+++ b/ext/sockets/tests/socket_listen-wrongparams.phpt
@@ -10,13 +10,9 @@ if (!extension_loaded('sockets')) {
}
--FILE--
<?php
-var_dump(socket_listen(null));
$socket = socket_create(AF_UNIX, SOCK_STREAM, 0);
var_dump(socket_listen($socket));
--EXPECTF--
-Warning: socket_listen() expects parameter 1 to be resource, null given in %s on line %d
-NULL
-
Warning: socket_listen(): unable to listen on socket [%d]: Invalid argument in %s on line %d
bool(false)
--CREDITS--
diff --git a/ext/sockets/tests/socket_select-wrongparams-1.phpt b/ext/sockets/tests/socket_select-wrongparams-1.phpt
index 848088fe45..2658063e36 100644
--- a/ext/sockets/tests/socket_select-wrongparams-1.phpt
+++ b/ext/sockets/tests/socket_select-wrongparams-1.phpt
@@ -19,7 +19,7 @@ $except = null;
$time = -1;
var_dump(socket_select($sockets, $write, $except, $time));
--EXPECTF--
-Warning: socket_select(): unable to select [%d]: Invalid argument in %s on line %d
+Warning: socket_select(): Unable to select [%d]: Invalid argument in %s on line %d
bool(false)
--CREDITS--
Till Klampaeckel, till@php.net
diff --git a/ext/sockets/tests/socket_select-wrongparams-2.phpt b/ext/sockets/tests/socket_select-wrongparams-2.phpt
index c149973e70..d45bc4c44a 100644
--- a/ext/sockets/tests/socket_select-wrongparams-2.phpt
+++ b/ext/sockets/tests/socket_select-wrongparams-2.phpt
@@ -12,12 +12,9 @@ $write = null;
$except = null;
$time = 0;
var_dump(socket_select($sockets, $write, $except, $time));
-socket_select($sockets, $write, $except);
--EXPECTF--
-Warning: socket_select(): no resource arrays were passed to select in %s on line %d
+Warning: socket_select(): No resource arrays were passed to select in %s on line %d
bool(false)
-
-Warning: socket_select() expects at least 4 parameters, 3 given in %s on line %d
--CREDITS--
Till Klampaeckel, till@php.net
Berlin TestFest 2009
diff --git a/ext/sockets/tests/socket_select-wrongparams-3.phpt b/ext/sockets/tests/socket_select-wrongparams-3.phpt
deleted file mode 100644
index 51686f9ccc..0000000000
--- a/ext/sockets/tests/socket_select-wrongparams-3.phpt
+++ /dev/null
@@ -1,28 +0,0 @@
---TEST--
-Test parameter handling in socket_select().
---DESCRIPTION--
-Time must be long, otherwise it's casted.
---SKIPIF--
-<?php
-if (!extension_loaded('sockets')) {
- die('SKIP The sockets extension is not loaded.');
-}
---FILE--
-<?php
-$sockets = array();
-if (strtolower(substr(PHP_OS, 0, 3)) == 'win') {
- $domain = AF_INET;
-} else {
- $domain = AF_UNIX;
-}
-socket_create_pair($domain, SOCK_STREAM, 0, $sockets);
-
-$write = null;
-$except = null;
-$time = array();
-var_dump(socket_select($sockets, $write, $except, $time));
---EXPECT--
-int(0)
---CREDITS--
-Till Klampaeckel, till@php.net
-Berlin TestFest 2009
diff --git a/ext/sockets/tests/socket_select_error.phpt b/ext/sockets/tests/socket_select_error.phpt
new file mode 100644
index 0000000000..48acb33020
--- /dev/null
+++ b/ext/sockets/tests/socket_select_error.phpt
@@ -0,0 +1,17 @@
+--TEST--
+socket_select() error conditions
+--SKIPIF--
+<?php
+if (!extension_loaded('sockets')) die('skip socket extension not available');
+?>
+--FILE--
+<?php
+$r = $w = $e = ['no resource'];
+try {
+ socket_select($r, $w, $e, 1);
+} catch (TypeError $ex) {
+ echo $ex->getMessage(), PHP_EOL;
+}
+?>
+--EXPECT--
+socket_select(): supplied argument is not a valid Socket resource
diff --git a/ext/sockets/tests/socket_sendrecvmsg_multi_msg-unix.phpt b/ext/sockets/tests/socket_sendrecvmsg_multi_msg-unix.phpt
index be42447f58..2de272356a 100644
--- a/ext/sockets/tests/socket_sendrecvmsg_multi_msg-unix.phpt
+++ b/ext/sockets/tests/socket_sendrecvmsg_multi_msg-unix.phpt
@@ -41,13 +41,13 @@ socket_set_option($s, IPPROTO_IPV6, IPV6_RECVPKTINFO, 1) or die("err");
socket_set_option($s, IPPROTO_IPV6, IPV6_RECVTCLASS, 1) or die("err");
$r = socket_sendmsg($sends1, [
- "name" => [ "addr" => "::1", "port" => 3002],
- "iov" => ["test ", "thing", "\n"],
- "control" => [[
- "level" => IPPROTO_IPV6,
- "type" => IPV6_TCLASS,
- "data" => 40,
- ]]
+ "name" => [ "addr" => "::1", "port" => 3002],
+ "iov" => ["test ", "thing", "\n"],
+ "control" => [[
+ "level" => IPPROTO_IPV6,
+ "type" => IPV6_TCLASS,
+ "data" => 40,
+ ]]
], 0);
var_dump($r);
checktimeout($s, 500);
@@ -56,7 +56,7 @@ $data = [
"name" => ["family" => AF_INET6, "addr" => "::1"],
"buffer_size" => 2000,
"controllen" => socket_cmsg_space(IPPROTO_IPV6, IPV6_PKTINFO) +
- socket_cmsg_space(IPPROTO_IPV6, IPV6_TCLASS),
+ socket_cmsg_space(IPPROTO_IPV6, IPV6_TCLASS),
];
if (!socket_recvmsg($s, $data, 0)) die("recvmsg");
print_r($data);
diff --git a/ext/sockets/tests/socket_sendrecvmsg_multi_msg.phpt b/ext/sockets/tests/socket_sendrecvmsg_multi_msg.phpt
index 88654e1973..ff61d3a230 100644
--- a/ext/sockets/tests/socket_sendrecvmsg_multi_msg.phpt
+++ b/ext/sockets/tests/socket_sendrecvmsg_multi_msg.phpt
@@ -8,8 +8,8 @@ if (!defined('IPPROTO_IPV6'))
die('skip IPv6 not available.');
/* Windows supports IPV6_RECVTCLASS and is able to receive the tclass via
* WSARecvMsg (though only the top 6 bits seem to reported), but WSASendMsg
- * does not accept IPV6_TCLASS messages. We still test that sendmsg() works
- * corectly by sending an IPV6_PKTINFO message that will have no effect */
+ * does not accept IPV6_TCLASS messages. We still test that sendmsg() works
+ * correctly by sending an IPV6_PKTINFO message that will have no effect */
--FILE--
<?php
include __DIR__."/mcast_helpers.php.inc";
@@ -32,16 +32,16 @@ socket_set_option($s, IPPROTO_IPV6, IPV6_RECVPKTINFO, 1) or die("err");
socket_set_option($s, IPPROTO_IPV6, IPV6_RECVTCLASS, 1) or die("err");
$r = socket_sendmsg($sends1, [
- "name" => [ "addr" => "::1", "port" => 3003],
- "iov" => ["test ", "thing", "\n"],
- "control" => [[
- "level" => IPPROTO_IPV6,
- "type" => IPV6_PKTINFO,
- "data" => [
- 'addr' => '::1',
+ "name" => [ "addr" => "::1", "port" => 3003],
+ "iov" => ["test ", "thing", "\n"],
+ "control" => [[
+ "level" => IPPROTO_IPV6,
+ "type" => IPV6_PKTINFO,
+ "data" => [
+ 'addr' => '::1',
'ifindex' => 1 /* we're assuming loopback is 1. Is this a safe assumption? */
- ],
- ]]
+ ],
+ ]]
], 0);
var_dump($r);
checktimeout($s, 500);
@@ -50,7 +50,7 @@ $data = [
"name" => ["family" => AF_INET6, "addr" => "::1"],
"buffer_size" => 2000,
"controllen" => socket_cmsg_space(IPPROTO_IPV6, IPV6_PKTINFO) +
- socket_cmsg_space(IPPROTO_IPV6, IPV6_TCLASS),
+ socket_cmsg_space(IPPROTO_IPV6, IPV6_TCLASS),
];
if (!socket_recvmsg($s, $data, 0)) die("recvmsg");
print_r($data);
diff --git a/ext/sockets/tests/socket_sentto_recvfrom_ipv6_udp-win32.phpt b/ext/sockets/tests/socket_sentto_recvfrom_ipv6_udp-win32.phpt
index 8754028f84..fbc4da3861 100644
--- a/ext/sockets/tests/socket_sentto_recvfrom_ipv6_udp-win32.phpt
+++ b/ext/sockets/tests/socket_sentto_recvfrom_ipv6_udp-win32.phpt
@@ -20,7 +20,6 @@ require 'ipv6_skipif.inc';
}
socket_recvfrom($socket, $buf, 12, 0, $from, $port); // cause warning
$address = '::1';
- socket_sendto($socket, '', 1, 0, $address); // cause warning
if (!socket_bind($socket, $address, 1223)) {
die("Unable to bind to $address:1223");
}
@@ -36,8 +35,6 @@ require 'ipv6_skipif.inc';
$from = "";
$port = 0;
- socket_recvfrom($socket, $buf, 12, 0); // cause warning
- socket_recvfrom($socket, $buf, 12, 0, $from); // cause warning
$bytes_received = socket_recvfrom($socket, $buf, 12, 0, $from, $port);
if ($bytes_received == -1) {
die('An error occurred while receiving from the socket');
@@ -50,12 +47,6 @@ require 'ipv6_skipif.inc';
--EXPECTF--
Warning: socket_recvfrom(): unable to recvfrom [10022]: %s
in %s on line %d
-
-Warning: Wrong parameter count for socket_sendto() in %s on line %d
-
-Warning: socket_recvfrom() expects at least 5 parameters, 4 given in %s on line %d
-
-Warning: Wrong parameter count for socket_recvfrom() in %s on line %d
Received Ping! from remote address ::1 and remote port 1223
--CREDITS--
Falko Menge <mail at falko-menge dot de>
diff --git a/ext/sockets/tests/socket_sentto_recvfrom_unix.phpt b/ext/sockets/tests/socket_sentto_recvfrom_unix.phpt
index e25bf4df1a..6e063c5b52 100644
--- a/ext/sockets/tests/socket_sentto_recvfrom_unix.phpt
+++ b/ext/sockets/tests/socket_sentto_recvfrom_unix.phpt
@@ -26,13 +26,12 @@ if (!extension_loaded('sockets')) {
$msg = "Ping!";
$len = strlen($msg);
- $bytes_sent = socket_sendto($socket, $msg, $len, 0); // cause warning
$bytes_sent = socket_sendto($socket, $msg, $len, 0, $address);
if ($bytes_sent == -1) {
- @unlink($address);
+ @unlink($address);
die('An error occurred while sending to the socket');
} else if ($bytes_sent != $len) {
- @unlink($address);
+ @unlink($address);
die($bytes_sent . ' bytes have been sent instead of the ' . $len . ' bytes expected');
}
@@ -40,22 +39,20 @@ if (!extension_loaded('sockets')) {
var_dump(socket_recvfrom($socket, $buf, 0, 0, $from)); // expect false
$bytes_received = socket_recvfrom($socket, $buf, 12, 0, $from);
if ($bytes_received == -1) {
- @unlink($address);
+ @unlink($address);
die('An error occurred while receiving from the socket');
} else if ($bytes_received != $len) {
- @unlink($address);
+ @unlink($address);
die($bytes_received . ' bytes have been received instead of the ' . $len . ' bytes expected');
}
echo "Received $buf";
socket_close($socket);
- @unlink($address);
+ @unlink($address);
?>
--EXPECTF--
Warning: socket_create(): Unable to create socket [%d]: Protocol not supported in %s on line %d
bool(false)
-
-Warning: socket_sendto() expects at least 5 parameters, 4 given in %s on line %d
bool(false)
Received Ping!
--CREDITS--
diff --git a/ext/sockets/tests/socket_set_block-retval.phpt b/ext/sockets/tests/socket_set_block-retval.phpt
index 88e0029989..89dcc7ab4f 100644
--- a/ext/sockets/tests/socket_set_block-retval.phpt
+++ b/ext/sockets/tests/socket_set_block-retval.phpt
@@ -15,14 +15,16 @@ socket_close($socket);
$socket2 = socket_create_listen(31340);
socket_close($socket2);
-var_dump(socket_set_block($socket2));
+try {
+ var_dump(socket_set_block($socket2));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
+--EXPECT--
bool(true)
-
-Warning: socket_set_block(): supplied resource is not a valid Socket resource in %s on line %d
-bool(false)
+socket_set_block(): supplied resource is not a valid Socket resource
--CREDITS--
Robin Mehner, robin@coding-robin.de
PHP Testfest Berlin 2009-05-09
diff --git a/ext/sockets/tests/socket_set_nonblock-retval.phpt b/ext/sockets/tests/socket_set_nonblock-retval.phpt
index c9bb1150ab..fb0e593810 100644
--- a/ext/sockets/tests/socket_set_nonblock-retval.phpt
+++ b/ext/sockets/tests/socket_set_nonblock-retval.phpt
@@ -15,14 +15,16 @@ socket_close($socket);
$socket2 = socket_create_listen(31340);
socket_close($socket2);
-var_dump(socket_set_nonblock($socket2));
+try {
+ var_dump(socket_set_nonblock($socket2));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
+--EXPECT--
bool(true)
-
-Warning: socket_set_nonblock(): supplied resource is not a valid Socket resource in %s on line %d
-bool(false)
+socket_set_nonblock(): supplied resource is not a valid Socket resource
--CREDITS--
Robin Mehner, robin@coding-robin.de
PHP Testfest Berlin 2009-05-09
diff --git a/ext/sockets/tests/socket_set_option_rcvtimeo.phpt b/ext/sockets/tests/socket_set_option_rcvtimeo.phpt
index a27d4075db..07238aa9e4 100644
--- a/ext/sockets/tests/socket_set_option_rcvtimeo.phpt
+++ b/ext/sockets/tests/socket_set_option_rcvtimeo.phpt
@@ -30,7 +30,7 @@ var_dump($retval_3 === $options);
socket_close($socket);
?>
--EXPECTF--
-Warning: socket_set_option(): no key "sec" passed in optval in %s on line %d
+Warning: socket_set_option(): No key "sec" passed in optval in %s on line %d
bool(true)
bool(true)
--CREDITS--
diff --git a/ext/sockets/tests/socket_set_option_seolinger.phpt b/ext/sockets/tests/socket_set_option_seolinger.phpt
index 4d171fc70a..d284a37f63 100644
--- a/ext/sockets/tests/socket_set_option_seolinger.phpt
+++ b/ext/sockets/tests/socket_set_option_seolinger.phpt
@@ -37,9 +37,9 @@ var_dump((bool)$retval_3["l_onoff"] === (bool)$options["l_onoff"]);
socket_close($socket);
?>
--EXPECTF--
-Warning: socket_set_option(): no key "l_onoff" passed in optval in %s on line %d
+Warning: socket_set_option(): No key "l_onoff" passed in optval in %s on line %d
-Warning: socket_set_option(): no key "l_linger" passed in optval in %s on line %d
+Warning: socket_set_option(): No key "l_linger" passed in optval in %s on line %d
bool(false)
bool(true)
bool(true)
diff --git a/ext/sockets/tests/socket_set_option_sndtimeo.phpt b/ext/sockets/tests/socket_set_option_sndtimeo.phpt
index 1b4fb5570d..9c79fd8270 100644
--- a/ext/sockets/tests/socket_set_option_sndtimeo.phpt
+++ b/ext/sockets/tests/socket_set_option_sndtimeo.phpt
@@ -30,7 +30,7 @@ var_dump($retval_3 === $options);
socket_close($socket);
?>
--EXPECTF--
-Warning: socket_set_option(): no key "sec" passed in optval in %s on line %d
+Warning: socket_set_option(): No key "sec" passed in optval in %s on line %d
bool(true)
bool(true)
--CREDITS--
diff --git a/ext/sockets/tests/socket_strerror.phpt b/ext/sockets/tests/socket_strerror.phpt
index aef56e5a84..4f1237e890 100644
--- a/ext/sockets/tests/socket_strerror.phpt
+++ b/ext/sockets/tests/socket_strerror.phpt
@@ -14,13 +14,11 @@ fa@php.net
?>
--FILE--
<?php
- $s_s = socket_strerror();
for ($i=0;$i<=132;$i++) {
var_dump(socket_strerror($i));
}
?>
--EXPECTF--
-Warning: socket_strerror() expects exactly 1 parameter, 0 given in %s on line %d
string(7) "Success"
string(23) "Operation not permitted"
string(25) "No such file or directory"
diff --git a/ext/sockets/tests/unixloop.phpt b/ext/sockets/tests/unixloop.phpt
index cd4afd65c7..31740c97c6 100644
--- a/ext/sockets/tests/unixloop.phpt
+++ b/ext/sockets/tests/unixloop.phpt
@@ -11,47 +11,47 @@ if (substr(PHP_OS, 0, 3) == 'WIN') {
?>
--FILE--
<?php
- $sock_path = sprintf("/tmp/%s.sock", uniqid());
+ $sock_path = sprintf("/tmp/%s.sock", uniqid());
- if (file_exists($sock_path))
- die('Temporary socket already exists.');
+ if (file_exists($sock_path))
+ die('Temporary socket already exists.');
- /* Setup socket server */
- $server = socket_create(AF_UNIX, SOCK_STREAM, 0);
- if (!$server) {
- die('Unable to create AF_UNIX socket [server]');
- }
- if (!socket_bind($server, $sock_path)) {
- die("Unable to bind to $sock_path");
- }
- if (!socket_listen($server, 2)) {
- die('Unable to listen on socket');
- }
+ /* Setup socket server */
+ $server = socket_create(AF_UNIX, SOCK_STREAM, 0);
+ if (!$server) {
+ die('Unable to create AF_UNIX socket [server]');
+ }
+ if (!socket_bind($server, $sock_path)) {
+ die("Unable to bind to $sock_path");
+ }
+ if (!socket_listen($server, 2)) {
+ die('Unable to listen on socket');
+ }
- /* Connect to it */
- $client = socket_create(AF_UNIX, SOCK_STREAM, 0);
- if (!$client) {
- die('Unable to create AF_UNIX socket [client]');
- }
- if (!socket_connect($client, $sock_path)) {
- die('Unable to connect to server socket');
- }
+ /* Connect to it */
+ $client = socket_create(AF_UNIX, SOCK_STREAM, 0);
+ if (!$client) {
+ die('Unable to create AF_UNIX socket [client]');
+ }
+ if (!socket_connect($client, $sock_path)) {
+ die('Unable to connect to server socket');
+ }
- /* Accept that connection */
- $socket = socket_accept($server);
- if (!$socket) {
- die('Unable to accept connection');
- }
+ /* Accept that connection */
+ $socket = socket_accept($server);
+ if (!$socket) {
+ die('Unable to accept connection');
+ }
- socket_write($client, "ABCdef123\n");
+ socket_write($client, "ABCdef123\n");
- $data = socket_read($socket, 10, PHP_BINARY_READ);
- var_dump($data);
+ $data = socket_read($socket, 10, PHP_BINARY_READ);
+ var_dump($data);
- socket_close($client);
- socket_close($socket);
- socket_close($server);
- @unlink($sock_path);
+ socket_close($client);
+ socket_close($socket);
+ socket_close($server);
+ @unlink($sock_path);
?>
--EXPECT--
string(10) "ABCdef123
diff --git a/ext/sockets/tests/wsaprotocol_info_0.phpt b/ext/sockets/tests/wsaprotocol_info_0.phpt
index 2750b32080..3e251914ed 100644
--- a/ext/sockets/tests/wsaprotocol_info_0.phpt
+++ b/ext/sockets/tests/wsaprotocol_info_0.phpt
@@ -11,40 +11,40 @@ if (!extension_loaded('sockets')) {
?>
--FILE--
<?php
- $address = 'localhost';
- $port = 10000;
+ $address = 'localhost';
+ $port = 10000;
- if (($sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) === false) {
- fprintf(STDERR, "socket_create() failed: reason: " . socket_strerror(socket_last_error()) . "\n");
- }
+ if (($sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) === false) {
+ fprintf(STDERR, "socket_create() failed: reason: " . socket_strerror(socket_last_error()) . "\n");
+ }
- if (socket_bind($sock, $address, $port) === false) {
- fprintf(STDERR, "socket_bind() failed: reason: " . socket_strerror(socket_last_error($sock)) . "\n");
- }
+ if (socket_bind($sock, $address, $port) === false) {
+ fprintf(STDERR, "socket_bind() failed: reason: " . socket_strerror(socket_last_error($sock)) . "\n");
+ }
- if (socket_listen($sock, 5) === false) {
- fprintf(STDERR, "socket_listen() failed: reason: " . socket_strerror(socket_last_error($sock)) . "\n");
- }
+ if (socket_listen($sock, 5) === false) {
+ fprintf(STDERR, "socket_listen() failed: reason: " . socket_strerror(socket_last_error($sock)) . "\n");
+ }
- /* Duplicate socket in the same process. */
- $pid = getmypid();
- $info = socket_wsaprotocol_info_export($sock, $pid);
- $sock2 = socket_wsaprotocol_info_import($info);
- var_dump(socket_wsaprotocol_info_release($info));
+ /* Duplicate socket in the same process. */
+ $pid = getmypid();
+ $info = socket_wsaprotocol_info_export($sock, $pid);
+ $sock2 = socket_wsaprotocol_info_import($info);
+ var_dump(socket_wsaprotocol_info_release($info));
- var_dump($sock, $sock2);
+ var_dump($sock, $sock2);
- /* Close duplicated socket, teh orig is still valid. */
- socket_close($sock2);
- var_dump($sock, $sock2);
+ /* Close duplicated socket, the original is still valid. */
+ socket_close($sock2);
+ var_dump($sock, $sock2);
- /* Using invalid PID. */
- $info = socket_wsaprotocol_info_export($sock, 123412341);
+ /* Using invalid PID. */
+ $info = socket_wsaprotocol_info_export($sock, 123412341);
- socket_close($sock);
+ socket_close($sock);
- /* Importing with invalid identifier. */
- $sock2 = socket_wsaprotocol_info_import("garbage");
+ /* Importing with invalid identifier. */
+ $sock2 = socket_wsaprotocol_info_import("garbage");
?>
--EXPECTF--
bool(true)
diff --git a/ext/sockets/unix_socket_constants.h b/ext/sockets/unix_socket_constants.h
index a8a276ccbf..53763b6aa1 100644
--- a/ext/sockets/unix_socket_constants.h
+++ b/ext/sockets/unix_socket_constants.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/sockets/win32_socket_constants.h b/ext/sockets/win32_socket_constants.h
index e2adf8cacf..656b530a29 100644
--- a/ext/sockets/win32_socket_constants.h
+++ b/ext/sockets/win32_socket_constants.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/sockets/windows_common.h b/ext/sockets/windows_common.h
index 771d07d752..2923503556 100644
--- a/ext/sockets/windows_common.h
+++ b/ext/sockets/windows_common.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/sodium/libsodium.c b/ext/sodium/libsodium.c
index 60bdd29aca..02a3537b27 100644
--- a/ext/sodium/libsodium.c
+++ b/ext/sodium/libsodium.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -34,190 +32,13 @@
static zend_class_entry *sodium_exception_ce;
-ZEND_BEGIN_ARG_INFO_EX(AI_None, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_FirstArgByReference, 0, 0, 1)
- ZEND_ARG_INFO(1, reference)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_String, 0, 0, 1)
- ZEND_ARG_INFO(0, string)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_StringRef, 0, 0, 1)
- ZEND_ARG_INFO(1, string)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_TwoStrings, 0, 0, 2)
- ZEND_ARG_INFO(0, string_1)
- ZEND_ARG_INFO(0, string_2)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_StringAndMaybeString, 0, 0, 1)
- ZEND_ARG_INFO(0, string_1)
- /* optional */
- ZEND_ARG_INFO(0, string_2)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_StringAndIdAndMaybeString, 0, 0, 2)
- ZEND_ARG_INFO(0, string_1)
- ZEND_ARG_INFO(0, id)
- /* optional */
- ZEND_ARG_INFO(0, string_2)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_StringRefAndString, 0, 0, 2)
- ZEND_ARG_INFO(1, string_1)
- ZEND_ARG_INFO(0, string_2)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_StringAndKey, 0, 0, 2)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_StringAndLength, 0, 0, 2)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, length)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_StringAndId, 0, 0, 2)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, id)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_StringAndKeyPair, 0, 0, 2)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, keypair)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_SignatureAndStringAndKey, 0, 0, 3)
- ZEND_ARG_INFO(0, signature)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_Key, 0, 0, 1)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_SecretKeyAndPublicKey, 0, 0, 2)
- ZEND_ARG_INFO(0, secret_key)
- ZEND_ARG_INFO(0, public_key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_LengthAndNonceAndKey, 0, 0, 3)
- ZEND_ARG_INFO(0, length)
- ZEND_ARG_INFO(0, nonce)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_StringAndNonceAndKey, 0, 0, 3)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, nonce)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_StringAndNonceAndKeyPair, 0, 0, 3)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, nonce)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_StringAndMaybeKeyAndLength, 0, 0, 1)
- ZEND_ARG_INFO(0, string)
- /* optional */
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, length)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_LengthAndPasswordAndSaltAndOpsLimitAndMemLimit, 0, 0, 5)
- ZEND_ARG_INFO(0, length)
- ZEND_ARG_INFO(0, password)
- ZEND_ARG_INFO(0, salt)
- ZEND_ARG_INFO(0, opslimit)
- ZEND_ARG_INFO(0, memlimit)
- /* optional */
- ZEND_ARG_INFO(0, alg)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_PasswordAndOpsLimitAndMemLimit, 0, 0, 3)
- ZEND_ARG_INFO(0, password)
- ZEND_ARG_INFO(0, opslimit)
- ZEND_ARG_INFO(0, memlimit)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_HashAndPassword, 0, 0, 2)
- ZEND_ARG_INFO(0, hash)
- ZEND_ARG_INFO(0, password)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_StringAndADAndNonceAndKey, 0, 0, 4)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, ad)
- ZEND_ARG_INFO(0, nonce)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_StateByReference, 0, 0, 1)
- ZEND_ARG_INFO(1, state)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_StateByReferenceAndStringAndMaybeStringAndLong, 0, 0, 2)
- ZEND_ARG_INFO(1, state)
- ZEND_ARG_INFO(0, string)
- /* optional */
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, long)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_StateByReferenceAndStringAndMaybeString, 0, 0, 2)
- ZEND_ARG_INFO(1, state)
- ZEND_ARG_INFO(0, string)
- /* optional */
- ZEND_ARG_INFO(0, string)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_StateByReferenceAndMaybeLength, 0, 0, 1)
- ZEND_ARG_INFO(1, state)
- /* optional */
- ZEND_ARG_INFO(0, length)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_StateByReferenceAndString, 0, 0, 2)
- ZEND_ARG_INFO(1, state)
- ZEND_ARG_INFO(0, string)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_MaybeKeyAndLength, 0, 0, 0)
- /* optional */
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, length)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_KXClientSession, 0, 0, 2)
- ZEND_ARG_INFO(0, client_keypair)
- ZEND_ARG_INFO(0, server_key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_KXServerSession, 0, 0, 2)
- ZEND_ARG_INFO(0, server_keypair)
- ZEND_ARG_INFO(0, client_key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(AI_KDF, 0, 0, 4)
- ZEND_ARG_INFO(0, subkey_len)
- ZEND_ARG_INFO(0, subkey_id)
- ZEND_ARG_INFO(0, context)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO()
-
#if (defined(__amd64) || defined(__amd64__) || defined(__x86_64__) || defined(__i386__) || \
defined(_M_AMD64) || defined(_M_IX86))
# define HAVE_AESGCM 1
#endif
+#include "libsodium_arginfo.h"
+
#ifndef crypto_aead_chacha20poly1305_IETF_KEYBYTES
# define crypto_aead_chacha20poly1305_IETF_KEYBYTES crypto_aead_chacha20poly1305_KEYBYTES
#endif
@@ -246,114 +67,114 @@ ZEND_END_ARG_INFO()
#endif
static const zend_function_entry sodium_functions[] = {
- PHP_FE(sodium_crypto_aead_aes256gcm_is_available, AI_None)
+ PHP_FE(sodium_crypto_aead_aes256gcm_is_available, arginfo_sodium_crypto_aead_aes256gcm_is_available)
#ifdef HAVE_AESGCM
- PHP_FE(sodium_crypto_aead_aes256gcm_decrypt, AI_StringAndADAndNonceAndKey)
- PHP_FE(sodium_crypto_aead_aes256gcm_encrypt, AI_StringAndADAndNonceAndKey)
- PHP_FE(sodium_crypto_aead_aes256gcm_keygen, AI_None)
+ PHP_FE(sodium_crypto_aead_aes256gcm_decrypt, arginfo_sodium_crypto_aead_aes256gcm_decrypt)
+ PHP_FE(sodium_crypto_aead_aes256gcm_encrypt, arginfo_sodium_crypto_aead_aes256gcm_encrypt)
+ PHP_FE(sodium_crypto_aead_aes256gcm_keygen, arginfo_sodium_crypto_aead_aes256gcm_keygen)
#endif
- PHP_FE(sodium_crypto_aead_chacha20poly1305_decrypt, AI_StringAndADAndNonceAndKey)
- PHP_FE(sodium_crypto_aead_chacha20poly1305_encrypt, AI_StringAndADAndNonceAndKey)
- PHP_FE(sodium_crypto_aead_chacha20poly1305_keygen, AI_None)
- PHP_FE(sodium_crypto_aead_chacha20poly1305_ietf_decrypt, AI_StringAndADAndNonceAndKey)
- PHP_FE(sodium_crypto_aead_chacha20poly1305_ietf_encrypt, AI_StringAndADAndNonceAndKey)
- PHP_FE(sodium_crypto_aead_chacha20poly1305_ietf_keygen, AI_None)
+ PHP_FE(sodium_crypto_aead_chacha20poly1305_decrypt, arginfo_sodium_crypto_aead_chacha20poly1305_decrypt)
+ PHP_FE(sodium_crypto_aead_chacha20poly1305_encrypt, arginfo_sodium_crypto_aead_chacha20poly1305_encrypt)
+ PHP_FE(sodium_crypto_aead_chacha20poly1305_keygen, arginfo_sodium_crypto_aead_chacha20poly1305_keygen)
+ PHP_FE(sodium_crypto_aead_chacha20poly1305_ietf_decrypt, arginfo_sodium_crypto_aead_chacha20poly1305_ietf_decrypt)
+ PHP_FE(sodium_crypto_aead_chacha20poly1305_ietf_encrypt, arginfo_sodium_crypto_aead_chacha20poly1305_ietf_encrypt)
+ PHP_FE(sodium_crypto_aead_chacha20poly1305_ietf_keygen, arginfo_sodium_crypto_aead_chacha20poly1305_ietf_keygen)
#ifdef crypto_aead_xchacha20poly1305_IETF_NPUBBYTES
- PHP_FE(sodium_crypto_aead_xchacha20poly1305_ietf_decrypt, AI_StringAndADAndNonceAndKey)
- PHP_FE(sodium_crypto_aead_xchacha20poly1305_ietf_keygen, AI_None)
- PHP_FE(sodium_crypto_aead_xchacha20poly1305_ietf_encrypt, AI_StringAndADAndNonceAndKey)
+ PHP_FE(sodium_crypto_aead_xchacha20poly1305_ietf_decrypt, arginfo_sodium_crypto_aead_xchacha20poly1305_ietf_decrypt)
+ PHP_FE(sodium_crypto_aead_xchacha20poly1305_ietf_keygen, arginfo_sodium_crypto_aead_xchacha20poly1305_ietf_keygen)
+ PHP_FE(sodium_crypto_aead_xchacha20poly1305_ietf_encrypt, arginfo_sodium_crypto_aead_xchacha20poly1305_ietf_encrypt)
#endif
- PHP_FE(sodium_crypto_auth, AI_StringAndKey)
- PHP_FE(sodium_crypto_auth_keygen, AI_None)
- PHP_FE(sodium_crypto_auth_verify, AI_SignatureAndStringAndKey)
- PHP_FE(sodium_crypto_box, AI_StringAndNonceAndKeyPair)
- PHP_FE(sodium_crypto_box_keypair, AI_None)
- PHP_FE(sodium_crypto_box_seed_keypair, AI_Key)
- PHP_FE(sodium_crypto_box_keypair_from_secretkey_and_publickey, AI_SecretKeyAndPublicKey)
- PHP_FE(sodium_crypto_box_open, AI_StringAndNonceAndKey)
- PHP_FE(sodium_crypto_box_publickey, AI_Key)
- PHP_FE(sodium_crypto_box_publickey_from_secretkey, AI_Key)
- PHP_FE(sodium_crypto_box_seal, AI_StringAndKey)
- PHP_FE(sodium_crypto_box_seal_open, AI_StringAndKey)
- PHP_FE(sodium_crypto_box_secretkey, AI_Key)
- PHP_FE(sodium_crypto_kx_keypair, AI_None)
- PHP_FE(sodium_crypto_kx_publickey, AI_Key)
- PHP_FE(sodium_crypto_kx_secretkey, AI_Key)
- PHP_FE(sodium_crypto_kx_seed_keypair, AI_String)
- PHP_FE(sodium_crypto_kx_client_session_keys, AI_KXClientSession)
- PHP_FE(sodium_crypto_kx_server_session_keys, AI_KXServerSession)
- PHP_FE(sodium_crypto_generichash, AI_StringAndMaybeKeyAndLength)
- PHP_FE(sodium_crypto_generichash_keygen, AI_None)
- PHP_FE(sodium_crypto_generichash_init, AI_MaybeKeyAndLength)
- PHP_FE(sodium_crypto_generichash_update, AI_StateByReferenceAndString)
- PHP_FE(sodium_crypto_generichash_final, AI_StateByReferenceAndMaybeLength)
- PHP_FE(sodium_crypto_kdf_derive_from_key, AI_KDF)
- PHP_FE(sodium_crypto_kdf_keygen, AI_None)
+ PHP_FE(sodium_crypto_auth, arginfo_sodium_crypto_auth)
+ PHP_FE(sodium_crypto_auth_keygen, arginfo_sodium_crypto_auth_keygen)
+ PHP_FE(sodium_crypto_auth_verify, arginfo_sodium_crypto_auth_verify)
+ PHP_FE(sodium_crypto_box, arginfo_sodium_crypto_box)
+ PHP_FE(sodium_crypto_box_keypair, arginfo_sodium_crypto_box_keypair)
+ PHP_FE(sodium_crypto_box_seed_keypair, arginfo_sodium_crypto_box_seed_keypair)
+ PHP_FE(sodium_crypto_box_keypair_from_secretkey_and_publickey, arginfo_sodium_crypto_box_keypair_from_secretkey_and_publickey)
+ PHP_FE(sodium_crypto_box_open, arginfo_sodium_crypto_box_open)
+ PHP_FE(sodium_crypto_box_publickey, arginfo_sodium_crypto_box_publickey)
+ PHP_FE(sodium_crypto_box_publickey_from_secretkey, arginfo_sodium_crypto_box_publickey_from_secretkey)
+ PHP_FE(sodium_crypto_box_seal, arginfo_sodium_crypto_box_seal)
+ PHP_FE(sodium_crypto_box_seal_open, arginfo_sodium_crypto_box_seal_open)
+ PHP_FE(sodium_crypto_box_secretkey, arginfo_sodium_crypto_box_secretkey)
+ PHP_FE(sodium_crypto_kx_keypair, arginfo_sodium_crypto_kx_keypair)
+ PHP_FE(sodium_crypto_kx_publickey, arginfo_sodium_crypto_kx_publickey)
+ PHP_FE(sodium_crypto_kx_secretkey, arginfo_sodium_crypto_kx_secretkey)
+ PHP_FE(sodium_crypto_kx_seed_keypair, arginfo_sodium_crypto_kx_seed_keypair)
+ PHP_FE(sodium_crypto_kx_client_session_keys, arginfo_sodium_crypto_kx_client_session_keys)
+ PHP_FE(sodium_crypto_kx_server_session_keys, arginfo_sodium_crypto_kx_server_session_keys)
+ PHP_FE(sodium_crypto_generichash, arginfo_sodium_crypto_generichash)
+ PHP_FE(sodium_crypto_generichash_keygen, arginfo_sodium_crypto_generichash_keygen)
+ PHP_FE(sodium_crypto_generichash_init, arginfo_sodium_crypto_generichash_init)
+ PHP_FE(sodium_crypto_generichash_update, arginfo_sodium_crypto_generichash_update)
+ PHP_FE(sodium_crypto_generichash_final, arginfo_sodium_crypto_generichash_final)
+ PHP_FE(sodium_crypto_kdf_derive_from_key, arginfo_sodium_crypto_kdf_derive_from_key)
+ PHP_FE(sodium_crypto_kdf_keygen, arginfo_sodium_crypto_kdf_keygen)
#ifdef crypto_pwhash_SALTBYTES
- PHP_FE(sodium_crypto_pwhash, AI_LengthAndPasswordAndSaltAndOpsLimitAndMemLimit)
- PHP_FE(sodium_crypto_pwhash_str, AI_PasswordAndOpsLimitAndMemLimit)
- PHP_FE(sodium_crypto_pwhash_str_verify, AI_HashAndPassword)
+ PHP_FE(sodium_crypto_pwhash, arginfo_sodium_crypto_pwhash)
+ PHP_FE(sodium_crypto_pwhash_str, arginfo_sodium_crypto_pwhash_str)
+ PHP_FE(sodium_crypto_pwhash_str_verify, arginfo_sodium_crypto_pwhash_str_verify)
#endif
#if SODIUM_LIBRARY_VERSION_MAJOR > 9 || (SODIUM_LIBRARY_VERSION_MAJOR == 9 && SODIUM_LIBRARY_VERSION_MINOR >= 6)
- PHP_FE(sodium_crypto_pwhash_str_needs_rehash, AI_PasswordAndOpsLimitAndMemLimit)
+ PHP_FE(sodium_crypto_pwhash_str_needs_rehash, arginfo_sodium_crypto_pwhash_str_needs_rehash)
#endif
#ifdef crypto_pwhash_scryptsalsa208sha256_SALTBYTES
- PHP_FE(sodium_crypto_pwhash_scryptsalsa208sha256, AI_LengthAndPasswordAndSaltAndOpsLimitAndMemLimit)
- PHP_FE(sodium_crypto_pwhash_scryptsalsa208sha256_str, AI_PasswordAndOpsLimitAndMemLimit)
- PHP_FE(sodium_crypto_pwhash_scryptsalsa208sha256_str_verify, AI_HashAndPassword)
+ PHP_FE(sodium_crypto_pwhash_scryptsalsa208sha256, arginfo_sodium_crypto_pwhash_scryptsalsa208sha256)
+ PHP_FE(sodium_crypto_pwhash_scryptsalsa208sha256_str, arginfo_sodium_crypto_pwhash_scryptsalsa208sha256_str)
+ PHP_FE(sodium_crypto_pwhash_scryptsalsa208sha256_str_verify, arginfo_sodium_crypto_pwhash_scryptsalsa208sha256_str_verify)
#endif
- PHP_FE(sodium_crypto_scalarmult, AI_TwoStrings)
- PHP_FE(sodium_crypto_secretbox, AI_StringAndNonceAndKey)
- PHP_FE(sodium_crypto_secretbox_keygen, AI_None)
- PHP_FE(sodium_crypto_secretbox_open, AI_StringAndNonceAndKey)
+ PHP_FE(sodium_crypto_scalarmult, arginfo_sodium_crypto_scalarmult)
+ PHP_FE(sodium_crypto_secretbox, arginfo_sodium_crypto_secretbox)
+ PHP_FE(sodium_crypto_secretbox_keygen, arginfo_sodium_crypto_secretbox_keygen)
+ PHP_FE(sodium_crypto_secretbox_open, arginfo_sodium_crypto_secretbox_open)
#ifdef crypto_secretstream_xchacha20poly1305_ABYTES
- PHP_FE(sodium_crypto_secretstream_xchacha20poly1305_keygen, AI_None)
- PHP_FE(sodium_crypto_secretstream_xchacha20poly1305_init_push, AI_Key)
- PHP_FE(sodium_crypto_secretstream_xchacha20poly1305_push, AI_StateByReferenceAndStringAndMaybeStringAndLong)
- PHP_FE(sodium_crypto_secretstream_xchacha20poly1305_init_pull, AI_StringAndKey)
- PHP_FE(sodium_crypto_secretstream_xchacha20poly1305_pull, AI_StateByReferenceAndStringAndMaybeString)
- PHP_FE(sodium_crypto_secretstream_xchacha20poly1305_rekey, AI_StateByReference)
+ PHP_FE(sodium_crypto_secretstream_xchacha20poly1305_keygen, arginfo_sodium_crypto_secretstream_xchacha20poly1305_keygen)
+ PHP_FE(sodium_crypto_secretstream_xchacha20poly1305_init_push, arginfo_sodium_crypto_secretstream_xchacha20poly1305_init_push)
+ PHP_FE(sodium_crypto_secretstream_xchacha20poly1305_push, arginfo_sodium_crypto_secretstream_xchacha20poly1305_push)
+ PHP_FE(sodium_crypto_secretstream_xchacha20poly1305_init_pull, arginfo_sodium_crypto_secretstream_xchacha20poly1305_init_pull)
+ PHP_FE(sodium_crypto_secretstream_xchacha20poly1305_pull, arginfo_sodium_crypto_secretstream_xchacha20poly1305_pull)
+ PHP_FE(sodium_crypto_secretstream_xchacha20poly1305_rekey, arginfo_sodium_crypto_secretstream_xchacha20poly1305_rekey)
#endif
- PHP_FE(sodium_crypto_shorthash, AI_StringAndKey)
- PHP_FE(sodium_crypto_shorthash_keygen, AI_None)
- PHP_FE(sodium_crypto_sign, AI_StringAndKeyPair)
- PHP_FE(sodium_crypto_sign_detached, AI_StringAndKeyPair)
- PHP_FE(sodium_crypto_sign_ed25519_pk_to_curve25519, AI_Key)
- PHP_FE(sodium_crypto_sign_ed25519_sk_to_curve25519, AI_Key)
- PHP_FE(sodium_crypto_sign_keypair, AI_None)
- PHP_FE(sodium_crypto_sign_keypair_from_secretkey_and_publickey, AI_SecretKeyAndPublicKey)
- PHP_FE(sodium_crypto_sign_open, AI_StringAndKeyPair)
- PHP_FE(sodium_crypto_sign_publickey, AI_Key)
- PHP_FE(sodium_crypto_sign_secretkey, AI_Key)
- PHP_FE(sodium_crypto_sign_publickey_from_secretkey, AI_Key)
- PHP_FE(sodium_crypto_sign_seed_keypair, AI_Key)
- PHP_FE(sodium_crypto_sign_verify_detached, AI_SignatureAndStringAndKey)
- PHP_FE(sodium_crypto_stream, AI_LengthAndNonceAndKey)
- PHP_FE(sodium_crypto_stream_keygen, AI_None)
- PHP_FE(sodium_crypto_stream_xor, AI_StringAndNonceAndKey)
+ PHP_FE(sodium_crypto_shorthash, arginfo_sodium_crypto_shorthash)
+ PHP_FE(sodium_crypto_shorthash_keygen, arginfo_sodium_crypto_shorthash_keygen)
+ PHP_FE(sodium_crypto_sign, arginfo_sodium_crypto_sign)
+ PHP_FE(sodium_crypto_sign_detached, arginfo_sodium_crypto_sign_detached)
+ PHP_FE(sodium_crypto_sign_ed25519_pk_to_curve25519, arginfo_sodium_crypto_sign_ed25519_pk_to_curve25519)
+ PHP_FE(sodium_crypto_sign_ed25519_sk_to_curve25519, arginfo_sodium_crypto_sign_ed25519_sk_to_curve25519)
+ PHP_FE(sodium_crypto_sign_keypair, arginfo_sodium_crypto_sign_keypair)
+ PHP_FE(sodium_crypto_sign_keypair_from_secretkey_and_publickey, arginfo_sodium_crypto_sign_keypair_from_secretkey_and_publickey)
+ PHP_FE(sodium_crypto_sign_open, arginfo_sodium_crypto_sign_open)
+ PHP_FE(sodium_crypto_sign_publickey, arginfo_sodium_crypto_sign_publickey)
+ PHP_FE(sodium_crypto_sign_secretkey, arginfo_sodium_crypto_sign_secretkey)
+ PHP_FE(sodium_crypto_sign_publickey_from_secretkey, arginfo_sodium_crypto_sign_publickey_from_secretkey)
+ PHP_FE(sodium_crypto_sign_seed_keypair, arginfo_sodium_crypto_sign_seed_keypair)
+ PHP_FE(sodium_crypto_sign_verify_detached, arginfo_sodium_crypto_sign_verify_detached)
+ PHP_FE(sodium_crypto_stream, arginfo_sodium_crypto_stream)
+ PHP_FE(sodium_crypto_stream_keygen, arginfo_sodium_crypto_stream_keygen)
+ PHP_FE(sodium_crypto_stream_xor, arginfo_sodium_crypto_stream_xor)
/* helpers */
- PHP_FE(sodium_add, AI_StringRefAndString)
- PHP_FE(sodium_compare, AI_TwoStrings)
- PHP_FE(sodium_increment, AI_StringRef)
- PHP_FE(sodium_memcmp, AI_TwoStrings)
- PHP_FE(sodium_memzero, AI_FirstArgByReference)
- PHP_FE(sodium_pad, AI_StringAndLength)
- PHP_FE(sodium_unpad, AI_StringAndLength)
+ PHP_FE(sodium_add, arginfo_sodium_add)
+ PHP_FE(sodium_compare, arginfo_sodium_compare)
+ PHP_FE(sodium_increment, arginfo_sodium_increment)
+ PHP_FE(sodium_memcmp, arginfo_sodium_memcmp)
+ PHP_FE(sodium_memzero, arginfo_sodium_memzero)
+ PHP_FE(sodium_pad, arginfo_sodium_pad)
+ PHP_FE(sodium_unpad, arginfo_sodium_unpad)
/* codecs */
- PHP_FE(sodium_bin2hex, AI_String)
- PHP_FE(sodium_hex2bin, AI_StringAndMaybeString)
+ PHP_FE(sodium_bin2hex, arginfo_sodium_bin2hex)
+ PHP_FE(sodium_hex2bin, arginfo_sodium_hex2bin)
#ifdef sodium_base64_VARIANT_ORIGINAL
- PHP_FE(sodium_bin2base64, AI_StringAndId)
- PHP_FE(sodium_base642bin, AI_StringAndIdAndMaybeString)
+ PHP_FE(sodium_bin2base64, arginfo_sodium_bin2base64)
+ PHP_FE(sodium_base642bin, arginfo_sodium_base642bin)
#endif
/* aliases */
- PHP_FALIAS(sodium_crypto_scalarmult_base, sodium_crypto_box_publickey_from_secretkey, AI_TwoStrings)
+ PHP_FALIAS(sodium_crypto_scalarmult_base, sodium_crypto_box_publickey_from_secretkey, arginfo_sodium_crypto_scalarmult_base)
PHP_FE_END
};
@@ -671,15 +492,15 @@ PHP_FUNCTION(sodium_memzero)
{
zval *buf_zv;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(),
+ if (zend_parse_parameters(ZEND_NUM_ARGS(),
"z", &buf_zv) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
ZVAL_DEREF(buf_zv);
if (Z_TYPE_P(buf_zv) != IS_STRING) {
zend_throw_exception(sodium_exception_ce, "a PHP string is required", 0);
- return;
+ RETURN_THROWS();
}
if (Z_REFCOUNTED_P(buf_zv) && Z_REFCOUNT_P(buf_zv) == 1) {
char *buf = Z_STRVAL(*buf_zv);
@@ -697,15 +518,15 @@ PHP_FUNCTION(sodium_increment)
unsigned char *val;
size_t val_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(),
+ if (zend_parse_parameters(ZEND_NUM_ARGS(),
"z", &val_zv) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
ZVAL_DEREF(val_zv);
if (Z_TYPE_P(val_zv) != IS_STRING) {
zend_throw_exception(sodium_exception_ce, "a PHP string is required", 0);
- return;
+ RETURN_THROWS();
}
sodium_separate_string(val_zv);
@@ -722,15 +543,15 @@ PHP_FUNCTION(sodium_add)
size_t val_len;
size_t addv_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(),
+ if (zend_parse_parameters(ZEND_NUM_ARGS(),
"zs", &val_zv, &addv, &addv_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
ZVAL_DEREF(val_zv);
if (Z_TYPE_P(val_zv) != IS_STRING) {
zend_throw_exception(sodium_exception_ce, "PHP strings are required", 0);
- return;
+ RETURN_THROWS();
}
sodium_separate_string(val_zv);
@@ -738,7 +559,7 @@ PHP_FUNCTION(sodium_add)
val_len = Z_STRLEN(*val_zv);
if (val_len != addv_len) {
zend_throw_exception(sodium_exception_ce, "values must have the same length", 0);
- return;
+ RETURN_THROWS();
}
sodium_add(val, addv, val_len);
}
@@ -750,15 +571,15 @@ PHP_FUNCTION(sodium_memcmp)
size_t len1;
size_t len2;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "ss",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss",
&buf1, &len1,
&buf2, &len2) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (len1 != len2) {
zend_throw_exception(sodium_exception_ce, "arguments have different sizes", 0);
- return;
+ RETURN_THROWS();
}
RETURN_LONG(sodium_memcmp(buf1, buf2, len1));
}
@@ -771,24 +592,24 @@ PHP_FUNCTION(sodium_crypto_shorthash)
size_t key_len;
size_t msg_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "ss",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss",
&msg, &msg_len,
&key, &key_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (key_len != crypto_shorthash_KEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"key size should be SODIUM_CRYPTO_SHORTHASH_KEYBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
hash = zend_string_alloc(crypto_shorthash_BYTES, 0);
if (crypto_shorthash((unsigned char *) ZSTR_VAL(hash), msg,
(unsigned long long) msg_len, key) != 0) {
zend_string_efree(hash);
zend_throw_exception(sodium_exception_ce, "internal error", 0);
- return;
+ RETURN_THROWS();
}
ZSTR_VAL(hash)[crypto_shorthash_BYTES] = 0;
@@ -805,28 +626,28 @@ PHP_FUNCTION(sodium_crypto_secretbox)
size_t msg_len;
size_t nonce_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "sss",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sss",
&msg, &msg_len,
&nonce, &nonce_len,
&key, &key_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (nonce_len != crypto_secretbox_NONCEBYTES) {
zend_throw_exception(sodium_exception_ce,
"nonce size should be SODIUM_CRYPTO_SECRETBOX_NONCEBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
if (key_len != crypto_secretbox_KEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"key size should be SODIUM_CRYPTO_SECRETBOX_KEYBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
if (SIZE_MAX - msg_len <= crypto_secretbox_MACBYTES) {
zend_throw_exception(sodium_exception_ce, "arithmetic overflow", 0);
- return;
+ RETURN_THROWS();
}
ciphertext = zend_string_alloc((size_t) msg_len + crypto_secretbox_MACBYTES, 0);
if (crypto_secretbox_easy((unsigned char *) ZSTR_VAL(ciphertext),
@@ -834,7 +655,7 @@ PHP_FUNCTION(sodium_crypto_secretbox)
nonce, key) != 0) {
zend_string_efree(ciphertext);
zend_throw_exception(sodium_exception_ce, "internal error", 0);
- return;
+ RETURN_THROWS();
}
ZSTR_VAL(ciphertext)[msg_len + crypto_secretbox_MACBYTES] = 0;
@@ -851,24 +672,24 @@ PHP_FUNCTION(sodium_crypto_secretbox_open)
size_t ciphertext_len;
size_t nonce_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "sss",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sss",
&ciphertext, &ciphertext_len,
&nonce, &nonce_len,
&key, &key_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (nonce_len != crypto_secretbox_NONCEBYTES) {
zend_throw_exception(sodium_exception_ce,
"nonce size should be SODIUM_CRYPTO_SECRETBOX_NONCEBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
if (key_len != crypto_secretbox_KEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"key size should be SODIUM_CRYPTO_SECRETBOX_KEYBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
if (ciphertext_len < crypto_secretbox_MACBYTES) {
RETURN_FALSE;
@@ -895,23 +716,23 @@ PHP_FUNCTION(sodium_crypto_generichash)
size_t key_len = 0;
size_t msg_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "s|sl",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|sl",
&msg, &msg_len,
&key, &key_len,
&hash_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (hash_len < crypto_generichash_BYTES_MIN ||
hash_len > crypto_generichash_BYTES_MAX) {
zend_throw_exception(sodium_exception_ce, "unsupported output length", 0);
- return;
+ RETURN_THROWS();
}
if (key_len != 0 &&
(key_len < crypto_generichash_KEYBYTES_MIN ||
key_len > crypto_generichash_KEYBYTES_MAX)) {
zend_throw_exception(sodium_exception_ce, "unsupported key length", 0);
- return;
+ RETURN_THROWS();
}
hash = zend_string_alloc(hash_len, 0);
if (crypto_generichash((unsigned char *) ZSTR_VAL(hash), (size_t) hash_len,
@@ -919,7 +740,7 @@ PHP_FUNCTION(sodium_crypto_generichash)
key, (size_t) key_len) != 0) {
zend_string_efree(hash);
zend_throw_exception(sodium_exception_ce, "internal error", 0);
- return;
+ RETURN_THROWS();
}
ZSTR_VAL(hash)[hash_len] = 0;
@@ -935,28 +756,28 @@ PHP_FUNCTION(sodium_crypto_generichash_init)
zend_long hash_len = crypto_generichash_BYTES;
size_t key_len = 0;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "|sl",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|sl",
&key, &key_len,
&hash_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (hash_len < crypto_generichash_BYTES_MIN ||
hash_len > crypto_generichash_BYTES_MAX) {
zend_throw_exception(sodium_exception_ce, "unsupported output length", 0);
- return;
+ RETURN_THROWS();
}
if (key_len != 0 &&
(key_len < crypto_generichash_KEYBYTES_MIN ||
key_len > crypto_generichash_KEYBYTES_MAX)) {
zend_throw_exception(sodium_exception_ce, "unsupported key length", 0);
- return;
+ RETURN_THROWS();
}
memset(&state_tmp, 0, sizeof state_tmp);
if (crypto_generichash_init((void *) &state_tmp, key, (size_t) key_len,
(size_t) hash_len) != 0) {
zend_throw_exception(sodium_exception_ce, "internal error", 0);
- return;
+ RETURN_THROWS();
}
state = zend_string_alloc(state_len, 0);
memcpy(ZSTR_VAL(state), &state_tmp, state_len);
@@ -975,29 +796,29 @@ PHP_FUNCTION(sodium_crypto_generichash_update)
size_t msg_len;
size_t state_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "zs",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "zs",
&state_zv, &msg, &msg_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
ZVAL_DEREF(state_zv);
if (Z_TYPE_P(state_zv) != IS_STRING) {
zend_throw_exception(sodium_exception_ce, "a reference to a state is required", 0);
- return;
+ RETURN_THROWS();
}
sodium_separate_string(state_zv);
state = (unsigned char *) Z_STRVAL(*state_zv);
state_len = Z_STRLEN(*state_zv);
if (state_len != sizeof (crypto_generichash_state)) {
zend_throw_exception(sodium_exception_ce, "incorrect state length", 0);
- return;
+ RETURN_THROWS();
}
memcpy(&state_tmp, state, sizeof state_tmp);
if (crypto_generichash_update((void *) &state_tmp, msg,
(unsigned long long) msg_len) != 0) {
sodium_memzero(&state_tmp, sizeof state_tmp);
zend_throw_exception(sodium_exception_ce, "internal error", 0);
- return;
+ RETURN_THROWS();
}
memcpy(state, &state_tmp, state_len);
sodium_memzero(&state_tmp, sizeof state_tmp);
@@ -1014,27 +835,27 @@ PHP_FUNCTION(sodium_crypto_generichash_final)
size_t state_len;
zend_long hash_len = crypto_generichash_BYTES;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "z|l",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|l",
&state_zv, &hash_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
ZVAL_DEREF(state_zv);
if (Z_TYPE_P(state_zv) != IS_STRING) {
zend_throw_exception(sodium_exception_ce, "a reference to a state is required", 0);
- return;
+ RETURN_THROWS();
}
sodium_separate_string(state_zv);
state = (unsigned char *) Z_STRVAL(*state_zv);
state_len = Z_STRLEN(*state_zv);
if (state_len != sizeof (crypto_generichash_state)) {
zend_throw_exception(sodium_exception_ce, "incorrect state length", 0);
- return;
+ RETURN_THROWS();
}
if (hash_len < crypto_generichash_BYTES_MIN ||
hash_len > crypto_generichash_BYTES_MAX) {
zend_throw_exception(sodium_exception_ce, "unsupported output length", 0);
- return;
+ RETURN_THROWS();
}
hash = zend_string_alloc(hash_len, 0);
memcpy(&state_tmp, state, sizeof state_tmp);
@@ -1044,7 +865,7 @@ PHP_FUNCTION(sodium_crypto_generichash_final)
sodium_memzero(&state_tmp, sizeof state_tmp);
zend_string_efree(hash);
zend_throw_exception(sodium_exception_ce, "internal error", 0);
- return;
+ RETURN_THROWS();
}
sodium_memzero(&state_tmp, sizeof state_tmp);
sodium_memzero(state, state_len);
@@ -1060,7 +881,7 @@ PHP_FUNCTION(sodium_crypto_box_keypair)
size_t keypair_len;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
keypair_len = crypto_box_SECRETKEYBYTES + crypto_box_PUBLICKEYBYTES;
keypair = zend_string_alloc(keypair_len, 0);
@@ -1069,7 +890,7 @@ PHP_FUNCTION(sodium_crypto_box_keypair)
(unsigned char *) ZSTR_VAL(keypair)) != 0) {
zend_string_efree(keypair);
zend_throw_exception(sodium_exception_ce, "internal error", 0);
- return;
+ RETURN_THROWS();
}
ZSTR_VAL(keypair)[keypair_len] = 0;
@@ -1083,16 +904,16 @@ PHP_FUNCTION(sodium_crypto_box_seed_keypair)
size_t keypair_len;
size_t seed_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "s",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",
&seed, &seed_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (seed_len != crypto_box_SEEDBYTES) {
zend_throw_exception(sodium_exception_ce,
"seed should be SODIUM_CRYPTO_BOX_SEEDBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
keypair_len = crypto_box_SECRETKEYBYTES + crypto_box_PUBLICKEYBYTES;
keypair = zend_string_alloc(keypair_len, 0);
@@ -1102,7 +923,7 @@ PHP_FUNCTION(sodium_crypto_box_seed_keypair)
seed) != 0) {
zend_string_efree(keypair);
zend_throw_exception(sodium_exception_ce, "internal error", 0);
- return;
+ RETURN_THROWS();
}
ZSTR_VAL(keypair)[keypair_len] = 0;
@@ -1118,23 +939,23 @@ PHP_FUNCTION(sodium_crypto_box_keypair_from_secretkey_and_publickey)
size_t publickey_len;
size_t secretkey_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "ss",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss",
&secretkey, &secretkey_len,
&publickey, &publickey_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (secretkey_len != crypto_box_SECRETKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"secretkey should be SODIUM_CRYPTO_BOX_SECRETKEYBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
if (publickey_len != crypto_box_PUBLICKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"publickey should be SODIUM_CRYPTO_BOX_PUBLICKEYBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
keypair_len = crypto_box_SECRETKEYBYTES + crypto_box_PUBLICKEYBYTES;
keypair = zend_string_alloc(keypair_len, 0);
@@ -1152,17 +973,17 @@ PHP_FUNCTION(sodium_crypto_box_secretkey)
unsigned char *keypair;
size_t keypair_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "s",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",
&keypair, &keypair_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (keypair_len !=
crypto_box_SECRETKEYBYTES + crypto_box_PUBLICKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"keypair should be SODIUM_CRYPTO_BOX_KEYPAIRBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
secretkey = zend_string_alloc(crypto_box_SECRETKEYBYTES, 0);
memcpy(ZSTR_VAL(secretkey), keypair, crypto_box_SECRETKEYBYTES);
@@ -1177,17 +998,17 @@ PHP_FUNCTION(sodium_crypto_box_publickey)
unsigned char *keypair;
size_t keypair_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "s",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",
&keypair, &keypair_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (keypair_len !=
crypto_box_SECRETKEYBYTES + crypto_box_PUBLICKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"keypair should be SODIUM_CRYPTO_BOX_KEYPAIRBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
publickey = zend_string_alloc(crypto_box_PUBLICKEYBYTES, 0);
memcpy(ZSTR_VAL(publickey), keypair + crypto_box_SECRETKEYBYTES,
@@ -1203,16 +1024,16 @@ PHP_FUNCTION(sodium_crypto_box_publickey_from_secretkey)
unsigned char *secretkey;
size_t secretkey_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "s",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",
&secretkey, &secretkey_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (secretkey_len != crypto_box_SECRETKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"key should be SODIUM_CRYPTO_BOX_SECRETKEYBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
publickey = zend_string_alloc(crypto_box_PUBLICKEYBYTES, 0);
(void) sizeof(int[crypto_scalarmult_BYTES ==
@@ -1237,30 +1058,30 @@ PHP_FUNCTION(sodium_crypto_box)
size_t msg_len;
size_t nonce_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "sss",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sss",
&msg, &msg_len,
&nonce, &nonce_len,
&keypair, &keypair_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (nonce_len != crypto_box_NONCEBYTES) {
zend_throw_exception(sodium_exception_ce,
"nonce size should be SODIUM_CRYPTO_BOX_NONCEBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
if (keypair_len != crypto_box_SECRETKEYBYTES + crypto_box_PUBLICKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"keypair size should be SODIUM_CRYPTO_BOX_KEYPAIRBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
secretkey = keypair;
publickey = keypair + crypto_box_SECRETKEYBYTES;
if (SIZE_MAX - msg_len <= crypto_box_MACBYTES) {
zend_throw_exception(sodium_exception_ce, "arithmetic overflow", 0);
- return;
+ RETURN_THROWS();
}
ciphertext = zend_string_alloc((size_t) msg_len + crypto_box_MACBYTES, 0);
if (crypto_box_easy((unsigned char *) ZSTR_VAL(ciphertext), msg,
@@ -1268,7 +1089,7 @@ PHP_FUNCTION(sodium_crypto_box)
nonce, publickey, secretkey) != 0) {
zend_string_efree(ciphertext);
zend_throw_exception(sodium_exception_ce, "internal error", 0);
- return;
+ RETURN_THROWS();
}
ZSTR_VAL(ciphertext)[msg_len + crypto_box_MACBYTES] = 0;
@@ -1287,24 +1108,24 @@ PHP_FUNCTION(sodium_crypto_box_open)
size_t keypair_len;
size_t nonce_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "sss",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sss",
&ciphertext, &ciphertext_len,
&nonce, &nonce_len,
&keypair, &keypair_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (nonce_len != crypto_box_NONCEBYTES) {
zend_throw_exception(sodium_exception_ce,
"nonce size should be SODIUM_CRYPTO_BOX_NONCEBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
if (keypair_len != crypto_box_SECRETKEYBYTES + crypto_box_PUBLICKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"keypair size should be SODIUM_CRYPTO_BOX_KEYPAIRBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
secretkey = keypair;
publickey = keypair + crypto_box_SECRETKEYBYTES;
@@ -1331,28 +1152,28 @@ PHP_FUNCTION(sodium_crypto_box_seal)
size_t msg_len;
size_t publickey_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "ss",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss",
&msg, &msg_len,
&publickey, &publickey_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (publickey_len != crypto_box_PUBLICKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"public key size should be SODIUM_CRYPTO_BOX_PUBLICKEYBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
if (SIZE_MAX - msg_len <= crypto_box_SEALBYTES) {
zend_throw_exception(sodium_exception_ce, "arithmetic overflow", 0);
- return;
+ RETURN_THROWS();
}
ciphertext = zend_string_alloc((size_t) msg_len + crypto_box_SEALBYTES, 0);
if (crypto_box_seal((unsigned char *) ZSTR_VAL(ciphertext), msg,
(unsigned long long) msg_len, publickey) != 0) {
zend_string_efree(ciphertext);
zend_throw_exception(sodium_exception_ce, "internal error", 0);
- return;
+ RETURN_THROWS();
}
ZSTR_VAL(ciphertext)[msg_len + crypto_box_SEALBYTES] = 0;
@@ -1369,17 +1190,17 @@ PHP_FUNCTION(sodium_crypto_box_seal_open)
size_t ciphertext_len;
size_t keypair_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "ss",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss",
&ciphertext, &ciphertext_len,
&keypair, &keypair_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (keypair_len != crypto_box_SECRETKEYBYTES + crypto_box_PUBLICKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"keypair size should be SODIUM_CRYPTO_BOX_KEYPAIRBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
secretkey = keypair;
publickey = keypair + crypto_box_SECRETKEYBYTES;
@@ -1404,7 +1225,7 @@ PHP_FUNCTION(sodium_crypto_sign_keypair)
size_t keypair_len;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
keypair_len = crypto_sign_SECRETKEYBYTES + crypto_sign_PUBLICKEYBYTES;
keypair = zend_string_alloc(keypair_len, 0);
@@ -1413,7 +1234,7 @@ PHP_FUNCTION(sodium_crypto_sign_keypair)
(unsigned char *) ZSTR_VAL(keypair)) != 0) {
zend_string_efree(keypair);
zend_throw_exception(sodium_exception_ce, "internal error", 0);
- return;
+ RETURN_THROWS();
}
ZSTR_VAL(keypair)[keypair_len] = 0;
@@ -1427,16 +1248,16 @@ PHP_FUNCTION(sodium_crypto_sign_seed_keypair)
size_t keypair_len;
size_t seed_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "s",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",
&seed, &seed_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (seed_len != crypto_sign_SEEDBYTES) {
zend_throw_exception(sodium_exception_ce,
"seed should be SODIUM_CRYPTO_SIGN_SEEDBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
keypair_len = crypto_sign_SECRETKEYBYTES + crypto_sign_PUBLICKEYBYTES;
keypair = zend_string_alloc(keypair_len, 0);
@@ -1446,7 +1267,7 @@ PHP_FUNCTION(sodium_crypto_sign_seed_keypair)
seed) != 0) {
zend_string_efree(keypair);
zend_throw_exception(sodium_exception_ce, "internal error", 0);
- return;
+ RETURN_THROWS();
}
ZSTR_VAL(keypair)[keypair_len] = 0;
@@ -1462,23 +1283,23 @@ PHP_FUNCTION(sodium_crypto_sign_keypair_from_secretkey_and_publickey)
size_t publickey_len;
size_t secretkey_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "ss",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss",
&secretkey, &secretkey_len,
&publickey, &publickey_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (secretkey_len != crypto_sign_SECRETKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"secretkey should be SODIUM_CRYPTO_SIGN_SECRETKEYBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
if (publickey_len != crypto_sign_PUBLICKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"publickey should be SODIUM_CRYPTO_SIGN_PUBLICKEYBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
keypair_len = crypto_sign_SECRETKEYBYTES + crypto_sign_PUBLICKEYBYTES;
keypair = zend_string_alloc(keypair_len, 0);
@@ -1496,16 +1317,16 @@ PHP_FUNCTION(sodium_crypto_sign_publickey_from_secretkey)
char *secretkey;
size_t secretkey_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "s",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",
&secretkey, &secretkey_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (secretkey_len != crypto_sign_SECRETKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"secretkey should be SODIUM_CRYPTO_SIGN_SECRETKEYBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
publickey = zend_string_alloc(crypto_sign_PUBLICKEYBYTES, 0);
@@ -1513,7 +1334,7 @@ PHP_FUNCTION(sodium_crypto_sign_publickey_from_secretkey)
(const unsigned char *) secretkey) != 0) {
zend_throw_exception(sodium_exception_ce,
"internal error", 0);
- return;
+ RETURN_THROWS();
}
ZSTR_VAL(publickey)[crypto_sign_PUBLICKEYBYTES] = 0;
@@ -1526,17 +1347,17 @@ PHP_FUNCTION(sodium_crypto_sign_secretkey)
unsigned char *keypair;
size_t keypair_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "s",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",
&keypair, &keypair_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (keypair_len !=
crypto_sign_SECRETKEYBYTES + crypto_sign_PUBLICKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"keypair should be SODIUM_CRYPTO_SIGN_KEYPAIRBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
secretkey = zend_string_alloc(crypto_sign_SECRETKEYBYTES, 0);
memcpy(ZSTR_VAL(secretkey), keypair, crypto_sign_SECRETKEYBYTES);
@@ -1551,17 +1372,17 @@ PHP_FUNCTION(sodium_crypto_sign_publickey)
unsigned char *keypair;
size_t keypair_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "s",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",
&keypair, &keypair_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (keypair_len !=
crypto_sign_SECRETKEYBYTES + crypto_sign_PUBLICKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"keypair should be SODIUM_CRYPTO_SIGN_KEYPAIRBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
publickey = zend_string_alloc(crypto_sign_PUBLICKEYBYTES, 0);
memcpy(ZSTR_VAL(publickey), keypair + crypto_sign_SECRETKEYBYTES,
@@ -1581,21 +1402,21 @@ PHP_FUNCTION(sodium_crypto_sign)
size_t msg_signed_len;
size_t secretkey_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "ss",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss",
&msg, &msg_len,
&secretkey, &secretkey_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (secretkey_len != crypto_sign_SECRETKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"secret key size should be SODIUM_CRYPTO_SIGN_SECRETKEYBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
if (SIZE_MAX - msg_len <= crypto_sign_BYTES) {
zend_throw_exception(sodium_exception_ce, "arithmetic overflow", 0);
- return;
+ RETURN_THROWS();
}
msg_signed_len = msg_len + crypto_sign_BYTES;
msg_signed = zend_string_alloc((size_t) msg_signed_len, 0);
@@ -1604,12 +1425,12 @@ PHP_FUNCTION(sodium_crypto_sign)
(unsigned long long) msg_len, secretkey) != 0) {
zend_string_efree(msg_signed);
zend_throw_exception(sodium_exception_ce, "internal error", 0);
- return;
+ RETURN_THROWS();
}
if (msg_signed_real_len >= SIZE_MAX || msg_signed_real_len > msg_signed_len) {
zend_string_efree(msg_signed);
zend_throw_exception(sodium_exception_ce, "arithmetic overflow", 0);
- return;
+ RETURN_THROWS();
}
PHP_SODIUM_ZSTR_TRUNCATE(msg_signed, (size_t) msg_signed_real_len);
ZSTR_VAL(msg_signed)[msg_signed_real_len] = 0;
@@ -1627,22 +1448,22 @@ PHP_FUNCTION(sodium_crypto_sign_open)
size_t msg_signed_len;
size_t publickey_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "ss",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss",
&msg_signed, &msg_signed_len,
&publickey, &publickey_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (publickey_len != crypto_sign_PUBLICKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"public key size should be SODIUM_CRYPTO_SIGN_PUBLICKEYBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
msg_len = msg_signed_len;
if (msg_len >= SIZE_MAX) {
zend_throw_exception(sodium_exception_ce, "arithmetic overflow", 0);
- return;
+ RETURN_THROWS();
}
msg = zend_string_alloc((size_t) msg_len, 0);
if (crypto_sign_open((unsigned char *) ZSTR_VAL(msg), &msg_real_len,
@@ -1654,7 +1475,7 @@ PHP_FUNCTION(sodium_crypto_sign_open)
if (msg_real_len >= SIZE_MAX || msg_real_len > msg_signed_len) {
zend_string_efree(msg);
zend_throw_exception(sodium_exception_ce, "arithmetic overflow", 0);
- return;
+ RETURN_THROWS();
}
PHP_SODIUM_ZSTR_TRUNCATE(msg, (size_t) msg_real_len);
ZSTR_VAL(msg)[msg_real_len] = 0;
@@ -1671,17 +1492,17 @@ PHP_FUNCTION(sodium_crypto_sign_detached)
size_t msg_len;
size_t secretkey_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "ss",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss",
&msg, &msg_len,
&secretkey, &secretkey_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (secretkey_len != crypto_sign_SECRETKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"secret key size should be SODIUM_CRYPTO_SIGN_SECRETKEYBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
signature = zend_string_alloc((size_t) crypto_sign_BYTES, 0);
memset(ZSTR_VAL(signature), 0, (size_t) crypto_sign_BYTES);
@@ -1690,12 +1511,12 @@ PHP_FUNCTION(sodium_crypto_sign_detached)
(unsigned long long) msg_len, secretkey) != 0) {
zend_string_efree(signature);
zend_throw_exception(sodium_exception_ce, "signature creation failed", 0);
- return;
+ RETURN_THROWS();
}
if (signature_real_len <= 0U || signature_real_len > crypto_sign_BYTES) {
zend_string_efree(signature);
zend_throw_exception(sodium_exception_ce, "signature has a bogus size", 0);
- return;
+ RETURN_THROWS();
}
PHP_SODIUM_ZSTR_TRUNCATE(signature, (size_t) signature_real_len);
ZSTR_VAL(signature)[signature_real_len] = 0;
@@ -1712,24 +1533,24 @@ PHP_FUNCTION(sodium_crypto_sign_verify_detached)
size_t publickey_len;
size_t signature_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "sss",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sss",
&signature, &signature_len,
&msg, &msg_len,
&publickey, &publickey_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (signature_len != crypto_sign_BYTES) {
zend_throw_exception(sodium_exception_ce,
"signature size should be SODIUM_CRYPTO_SIGN_BYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
if (publickey_len != crypto_sign_PUBLICKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"public key size should be SODIUM_CRYPTO_SIGN_PUBLICKEYBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
if (crypto_sign_verify_detached(signature,
msg, (unsigned long long) msg_len,
@@ -1748,31 +1569,31 @@ PHP_FUNCTION(sodium_crypto_stream)
size_t key_len;
size_t nonce_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "lss",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "lss",
&ciphertext_len,
&nonce, &nonce_len,
&key, &key_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (ciphertext_len <= 0 || ciphertext_len >= SIZE_MAX) {
zend_throw_exception(sodium_exception_ce, "ciphertext length must be greater than 0", 0);
- return;
+ RETURN_THROWS();
}
if (nonce_len != crypto_stream_NONCEBYTES) {
zend_throw_exception(sodium_exception_ce, "nonce should be SODIUM_CRYPTO_STREAM_NONCEBYTES bytes", 0);
- return;
+ RETURN_THROWS();
}
if (key_len != crypto_stream_KEYBYTES) {
zend_throw_exception(sodium_exception_ce, "key should be SODIUM_CRYPTO_STREAM_KEYBYTES bytes", 0);
- return;
+ RETURN_THROWS();
}
ciphertext = zend_string_alloc((size_t) ciphertext_len, 0);
if (crypto_stream((unsigned char *) ZSTR_VAL(ciphertext),
(unsigned long long) ciphertext_len, nonce, key) != 0) {
zend_string_efree(ciphertext);
zend_throw_exception(sodium_exception_ce, "internal error", 0);
- return;
+ RETURN_THROWS();
}
ZSTR_VAL(ciphertext)[ciphertext_len] = 0;
@@ -1790,20 +1611,20 @@ PHP_FUNCTION(sodium_crypto_stream_xor)
size_t msg_len;
size_t nonce_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "sss",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sss",
&msg, &msg_len,
&nonce, &nonce_len,
&key, &key_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (nonce_len != crypto_stream_NONCEBYTES) {
zend_throw_exception(sodium_exception_ce, "nonce should be SODIUM_CRYPTO_STREAM_NONCEBYTES bytes", 0);
- return;
+ RETURN_THROWS();
}
if (key_len != crypto_stream_KEYBYTES) {
zend_throw_exception(sodium_exception_ce, "key should be SODIUM_CRYPTO_STREAM_KEYBYTES bytes", 0);
- return;
+ RETURN_THROWS();
}
ciphertext_len = msg_len;
ciphertext = zend_string_alloc((size_t) ciphertext_len, 0);
@@ -1811,7 +1632,7 @@ PHP_FUNCTION(sodium_crypto_stream_xor)
(unsigned long long) msg_len, nonce, key) != 0) {
zend_string_efree(ciphertext);
zend_throw_exception(sodium_exception_ce, "internal error", 0);
- return;
+ RETURN_THROWS();
}
ZSTR_VAL(ciphertext)[ciphertext_len] = 0;
@@ -1833,29 +1654,29 @@ PHP_FUNCTION(sodium_crypto_pwhash)
int ret;
alg = (zend_long) crypto_pwhash_ALG_DEFAULT;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "lssll|l",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "lssll|l",
&hash_len,
&passwd, &passwd_len,
&salt, &salt_len,
&opslimit, &memlimit, &alg) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (hash_len <= 0 || hash_len >= 0xffffffff) {
zend_throw_exception(sodium_exception_ce, "hash length must be greater than 0", 0);
- return;
+ RETURN_THROWS();
}
if (passwd_len >= 0xffffffff) {
zend_throw_exception(sodium_exception_ce, "unsupported password length", 0);
- return;
+ RETURN_THROWS();
}
if (opslimit <= 0) {
zend_throw_exception(sodium_exception_ce, "ops limit must be greater than 0", 0);
- return;
+ RETURN_THROWS();
}
if (memlimit <= 0 || memlimit > SIZE_MAX) {
zend_throw_exception(sodium_exception_ce, "memory limit must be greater than 0", 0);
- return;
+ RETURN_THROWS();
}
if (alg != crypto_pwhash_ALG_ARGON2I13
# ifdef crypto_pwhash_ALG_ARGON2ID13
@@ -1863,19 +1684,19 @@ PHP_FUNCTION(sodium_crypto_pwhash)
# endif
&& alg != crypto_pwhash_ALG_DEFAULT) {
zend_throw_exception(sodium_exception_ce, "unsupported password hashing algorithm", 0);
- return;
+ RETURN_THROWS();
}
if (passwd_len <= 0) {
zend_error(E_WARNING, "empty password");
}
if (salt_len != crypto_pwhash_SALTBYTES) {
zend_throw_exception(sodium_exception_ce, "salt should be SODIUM_CRYPTO_PWHASH_SALTBYTES bytes", 0);
- return;
+ RETURN_THROWS();
}
if (opslimit < crypto_pwhash_OPSLIMIT_MIN) {
zend_throw_exception(sodium_exception_ce,
"number of operations for the password hashing function is too low", 0);
- return;
+ RETURN_THROWS();
}
if (memlimit < crypto_pwhash_MEMLIMIT_MIN) {
zend_throw_exception(sodium_exception_ce,
@@ -1900,7 +1721,7 @@ PHP_FUNCTION(sodium_crypto_pwhash)
if (ret != 0) {
zend_string_efree(hash);
zend_throw_exception(sodium_exception_ce, "internal error", 0);
- return;
+ RETURN_THROWS();
}
ZSTR_VAL(hash)[hash_len] = 0;
@@ -1916,23 +1737,23 @@ PHP_FUNCTION(sodium_crypto_pwhash_str)
size_t passwd_len;
size_t len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "sll",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sll",
&passwd, &passwd_len,
&opslimit, &memlimit) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (opslimit <= 0) {
zend_throw_exception(sodium_exception_ce, "ops limit must be greater than 0", 0);
- return;
+ RETURN_THROWS();
}
if (memlimit <= 0 || memlimit > SIZE_MAX) {
zend_throw_exception(sodium_exception_ce, "memory limit must be greater than 0", 0);
- return;
+ RETURN_THROWS();
}
if (passwd_len >= 0xffffffff) {
zend_throw_exception(sodium_exception_ce, "unsupported password length", 0);
- return;
+ RETURN_THROWS();
}
if (passwd_len <= 0) {
zend_error(E_WARNING, "empty password");
@@ -1951,7 +1772,7 @@ PHP_FUNCTION(sodium_crypto_pwhash_str)
(unsigned long long) opslimit, (size_t) memlimit) != 0) {
zend_string_efree(hash_str);
zend_throw_exception(sodium_exception_ce, "internal error", 0);
- return;
+ RETURN_THROWS();
}
ZSTR_VAL(hash_str)[crypto_pwhash_STRBYTES - 1] = 0;
@@ -1969,10 +1790,10 @@ PHP_FUNCTION(sodium_crypto_pwhash_str_needs_rehash)
zend_long opslimit;
size_t hash_str_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "sll",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sll",
&hash_str, &hash_str_len, &opslimit, &memlimit) == FAILURE) {
zend_throw_exception(sodium_exception_ce, "a PHP string is required", 0);
- return;
+ RETURN_THROWS();
}
if (crypto_pwhash_str_needs_rehash(hash_str, opslimit, memlimit) == 0) {
RETURN_FALSE;
@@ -1988,16 +1809,16 @@ PHP_FUNCTION(sodium_crypto_pwhash_str_verify)
size_t hash_str_len;
size_t passwd_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "ss",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss",
&hash_str, &hash_str_len,
&passwd, &passwd_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (passwd_len >= 0xffffffff) {
zend_throw_exception(sodium_exception_ce,
"unsupported password length", 0);
- return;
+ RETURN_THROWS();
}
if (passwd_len <= 0) {
zend_error(E_WARNING, "empty password");
@@ -2022,25 +1843,25 @@ PHP_FUNCTION(sodium_crypto_pwhash_scryptsalsa208sha256)
size_t passwd_len;
size_t salt_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "lssll",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "lssll",
&hash_len,
&passwd, &passwd_len,
&salt, &salt_len,
&opslimit, &memlimit) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (hash_len <= 0 || hash_len >= SIZE_MAX || hash_len > 0x1fffffffe0ULL) {
zend_throw_exception(sodium_exception_ce, "hash length must be greater than 0", 0);
- return;
+ RETURN_THROWS();
}
if (opslimit <= 0) {
zend_throw_exception(sodium_exception_ce, "ops limit must be greater than 0", 0);
- return;
+ RETURN_THROWS();
}
if (memlimit <= 0 || memlimit > SIZE_MAX) {
zend_throw_exception(sodium_exception_ce, "memory limit must be greater than 0", 0);
- return;
+ RETURN_THROWS();
}
if (passwd_len <= 0) {
zend_error(E_WARNING, "empty password");
@@ -2049,7 +1870,7 @@ PHP_FUNCTION(sodium_crypto_pwhash_scryptsalsa208sha256)
zend_throw_exception(sodium_exception_ce,
"salt should be SODIUM_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_SALTBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
if (opslimit < crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE) {
zend_throw_exception(sodium_exception_ce,
@@ -2066,7 +1887,7 @@ PHP_FUNCTION(sodium_crypto_pwhash_scryptsalsa208sha256)
(unsigned long long) opslimit, (size_t) memlimit) != 0) {
zend_string_efree(hash);
zend_throw_exception(sodium_exception_ce, "internal error", 0);
- return;
+ RETURN_THROWS();
}
ZSTR_VAL(hash)[hash_len] = 0;
@@ -2081,19 +1902,19 @@ PHP_FUNCTION(sodium_crypto_pwhash_scryptsalsa208sha256_str)
zend_long opslimit;
size_t passwd_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "sll",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sll",
&passwd, &passwd_len,
&opslimit, &memlimit) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (opslimit <= 0) {
zend_throw_exception(sodium_exception_ce, "ops limit must be greater than 0", 0);
- return;
+ RETURN_THROWS();
}
if (memlimit <= 0 || memlimit > SIZE_MAX) {
zend_throw_exception(sodium_exception_ce, "memory limit must be greater than 0", 0);
- return;
+ RETURN_THROWS();
}
if (passwd_len <= 0) {
zend_error(E_WARNING, "empty password");
@@ -2113,7 +1934,7 @@ PHP_FUNCTION(sodium_crypto_pwhash_scryptsalsa208sha256_str)
(unsigned long long) opslimit, (size_t) memlimit) != 0) {
zend_string_efree(hash_str);
zend_throw_exception(sodium_exception_ce, "internal error", 0);
- return;
+ RETURN_THROWS();
}
ZSTR_VAL(hash_str)[crypto_pwhash_scryptsalsa208sha256_STRBYTES - 1] = 0;
@@ -2127,11 +1948,11 @@ PHP_FUNCTION(sodium_crypto_pwhash_scryptsalsa208sha256_str_verify)
size_t hash_str_len;
size_t passwd_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "ss",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss",
&hash_str, &hash_str_len,
&passwd, &passwd_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (passwd_len <= 0) {
zend_error(E_WARNING, "empty password");
@@ -2151,7 +1972,7 @@ PHP_FUNCTION(sodium_crypto_pwhash_scryptsalsa208sha256_str_verify)
PHP_FUNCTION(sodium_crypto_aead_aes256gcm_is_available)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
#ifdef HAVE_AESGCM
RETURN_BOOL(crypto_aead_aes256gcm_is_available());
@@ -2175,35 +1996,35 @@ PHP_FUNCTION(sodium_crypto_aead_aes256gcm_encrypt)
size_t npub_len;
size_t secretkey_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "ssss",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ssss",
&msg, &msg_len,
&ad, &ad_len,
&npub, &npub_len,
&secretkey, &secretkey_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (npub_len != crypto_aead_aes256gcm_NPUBBYTES) {
zend_throw_exception(sodium_exception_ce,
"public nonce size should be "
"SODIUM_CRYPTO_AEAD_AES256GCM_NPUBBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
if (secretkey_len != crypto_aead_aes256gcm_KEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"secret key size should be "
"SODIUM_CRYPTO_AEAD_AES256GCM_KEYBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
if (SIZE_MAX - msg_len <= crypto_aead_aes256gcm_ABYTES) {
zend_throw_exception(sodium_exception_ce, "arithmetic overflow", 0);
- return;
+ RETURN_THROWS();
}
if ((unsigned long long) msg_len > (16ULL * ((1ULL << 32) - 2ULL)) - crypto_aead_aes256gcm_ABYTES) {
zend_throw_exception(sodium_exception_ce, "message too long for a single key", 0);
- return;
+ RETURN_THROWS();
}
ciphertext_len = msg_len + crypto_aead_aes256gcm_ABYTES;
ciphertext = zend_string_alloc((size_t) ciphertext_len, 0);
@@ -2213,13 +2034,13 @@ PHP_FUNCTION(sodium_crypto_aead_aes256gcm_encrypt)
ad, (unsigned long long) ad_len, NULL, npub, secretkey) != 0) {
zend_string_efree(ciphertext);
zend_throw_exception(sodium_exception_ce, "internal error", 0);
- return;
+ RETURN_THROWS();
}
if (ciphertext_real_len <= 0U || ciphertext_real_len >= SIZE_MAX ||
ciphertext_real_len > ciphertext_len) {
zend_string_efree(ciphertext);
zend_throw_exception(sodium_exception_ce, "arithmetic overflow", 0);
- return;
+ RETURN_THROWS();
}
PHP_SODIUM_ZSTR_TRUNCATE(ciphertext, (size_t) ciphertext_real_len);
ZSTR_VAL(ciphertext)[ciphertext_real_len] = 0;
@@ -2241,39 +2062,39 @@ PHP_FUNCTION(sodium_crypto_aead_aes256gcm_decrypt)
size_t npub_len;
size_t secretkey_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "ssss",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ssss",
&ciphertext, &ciphertext_len,
&ad, &ad_len,
&npub, &npub_len,
&secretkey, &secretkey_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (npub_len != crypto_aead_aes256gcm_NPUBBYTES) {
zend_throw_exception(sodium_exception_ce,
"public nonce size should be "
"SODIUM_CRYPTO_AEAD_AES256GCM_NPUBBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
if (secretkey_len != crypto_aead_aes256gcm_KEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"secret key size should be "
"SODIUM_CRYPTO_AEAD_AES256GCM_KEYBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
if (ciphertext_len < crypto_aead_aes256gcm_ABYTES) {
RETURN_FALSE;
}
if (ciphertext_len - crypto_aead_aes256gcm_ABYTES > 16ULL * ((1ULL << 32) - 2ULL)) {
zend_throw_exception(sodium_exception_ce, "message too long for a single key", 0);
- return;
+ RETURN_THROWS();
}
msg_len = ciphertext_len;
if (msg_len >= SIZE_MAX) {
zend_throw_exception(sodium_exception_ce, "arithmetic overflow", 0);
- return;
+ RETURN_THROWS();
}
msg = zend_string_alloc((size_t) msg_len, 0);
if (crypto_aead_aes256gcm_decrypt
@@ -2286,7 +2107,7 @@ PHP_FUNCTION(sodium_crypto_aead_aes256gcm_decrypt)
if (msg_real_len >= SIZE_MAX || msg_real_len > msg_len) {
zend_string_efree(msg);
zend_throw_exception(sodium_exception_ce, "arithmetic overflow", 0);
- return;
+ RETURN_THROWS();
}
PHP_SODIUM_ZSTR_TRUNCATE(msg, (size_t) msg_real_len);
ZSTR_VAL(msg)[msg_real_len] = 0;
@@ -2309,31 +2130,31 @@ PHP_FUNCTION(sodium_crypto_aead_chacha20poly1305_encrypt)
size_t npub_len;
size_t secretkey_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "ssss",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ssss",
&msg, &msg_len,
&ad, &ad_len,
&npub, &npub_len,
&secretkey, &secretkey_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (npub_len != crypto_aead_chacha20poly1305_NPUBBYTES) {
zend_throw_exception(sodium_exception_ce,
"public nonce size should be "
"SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_NPUBBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
if (secretkey_len != crypto_aead_chacha20poly1305_KEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"secret key size should be "
"SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_KEYBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
if (SIZE_MAX - msg_len <= crypto_aead_chacha20poly1305_ABYTES) {
zend_throw_exception(sodium_exception_ce, "arithmetic overflow", 0);
- return;
+ RETURN_THROWS();
}
ciphertext_len = msg_len + crypto_aead_chacha20poly1305_ABYTES;
ciphertext = zend_string_alloc((size_t) ciphertext_len, 0);
@@ -2343,13 +2164,13 @@ PHP_FUNCTION(sodium_crypto_aead_chacha20poly1305_encrypt)
ad, (unsigned long long) ad_len, NULL, npub, secretkey) != 0) {
zend_string_efree(ciphertext);
zend_throw_exception(sodium_exception_ce, "internal error", 0);
- return;
+ RETURN_THROWS();
}
if (ciphertext_real_len <= 0U || ciphertext_real_len >= SIZE_MAX ||
ciphertext_real_len > ciphertext_len) {
zend_string_efree(ciphertext);
zend_throw_exception(sodium_exception_ce, "arithmetic overflow", 0);
- return;
+ RETURN_THROWS();
}
PHP_SODIUM_ZSTR_TRUNCATE(ciphertext, (size_t) ciphertext_real_len);
ZSTR_VAL(ciphertext)[ciphertext_real_len] = 0;
@@ -2371,27 +2192,27 @@ PHP_FUNCTION(sodium_crypto_aead_chacha20poly1305_decrypt)
size_t npub_len;
size_t secretkey_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "ssss",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ssss",
&ciphertext, &ciphertext_len,
&ad, &ad_len,
&npub, &npub_len,
&secretkey, &secretkey_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (npub_len != crypto_aead_chacha20poly1305_NPUBBYTES) {
zend_throw_exception(sodium_exception_ce,
"public nonce size should be "
"SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_NPUBBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
if (secretkey_len != crypto_aead_chacha20poly1305_KEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"secret key size should be "
"SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_KEYBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
if (ciphertext_len < crypto_aead_chacha20poly1305_ABYTES) {
RETURN_FALSE;
@@ -2399,7 +2220,7 @@ PHP_FUNCTION(sodium_crypto_aead_chacha20poly1305_decrypt)
msg_len = ciphertext_len;
if (msg_len >= SIZE_MAX) {
zend_throw_exception(sodium_exception_ce, "arithmetic overflow", 0);
- return;
+ RETURN_THROWS();
}
msg = zend_string_alloc((size_t) msg_len, 0);
if (crypto_aead_chacha20poly1305_decrypt
@@ -2412,7 +2233,7 @@ PHP_FUNCTION(sodium_crypto_aead_chacha20poly1305_decrypt)
if (msg_real_len >= SIZE_MAX || msg_real_len > msg_len) {
zend_string_efree(msg);
zend_throw_exception(sodium_exception_ce, "arithmetic overflow", 0);
- return;
+ RETURN_THROWS();
}
PHP_SODIUM_ZSTR_TRUNCATE(msg, (size_t) msg_real_len);
ZSTR_VAL(msg)[msg_real_len] = 0;
@@ -2434,35 +2255,35 @@ PHP_FUNCTION(sodium_crypto_aead_chacha20poly1305_ietf_encrypt)
size_t npub_len;
size_t secretkey_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "ssss",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ssss",
&msg, &msg_len,
&ad, &ad_len,
&npub, &npub_len,
&secretkey, &secretkey_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (npub_len != crypto_aead_chacha20poly1305_IETF_NPUBBYTES) {
zend_throw_exception(sodium_exception_ce,
"public nonce size should be "
"SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_IETF_NPUBBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
if (secretkey_len != crypto_aead_chacha20poly1305_IETF_KEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"secret key size should be "
"SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_IETF_KEYBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
if (SIZE_MAX - msg_len <= crypto_aead_chacha20poly1305_IETF_ABYTES) {
zend_throw_exception(sodium_exception_ce, "arithmetic overflow", 0);
- return;
+ RETURN_THROWS();
}
if ((unsigned long long) msg_len > 64ULL * (1ULL << 32) - 64ULL) {
zend_throw_exception(sodium_exception_ce, "message too long for a single key", 0);
- return;
+ RETURN_THROWS();
}
ciphertext_len = msg_len + crypto_aead_chacha20poly1305_IETF_ABYTES;
ciphertext = zend_string_alloc((size_t) ciphertext_len, 0);
@@ -2472,13 +2293,13 @@ PHP_FUNCTION(sodium_crypto_aead_chacha20poly1305_ietf_encrypt)
ad, (unsigned long long) ad_len, NULL, npub, secretkey) != 0) {
zend_string_efree(ciphertext);
zend_throw_exception(sodium_exception_ce, "internal error", 0);
- return;
+ RETURN_THROWS();
}
if (ciphertext_real_len <= 0U || ciphertext_real_len >= SIZE_MAX ||
ciphertext_real_len > ciphertext_len) {
zend_string_efree(ciphertext);
zend_throw_exception(sodium_exception_ce, "arithmetic overflow", 0);
- return;
+ RETURN_THROWS();
}
PHP_SODIUM_ZSTR_TRUNCATE(ciphertext, (size_t) ciphertext_real_len);
ZSTR_VAL(ciphertext)[ciphertext_real_len] = 0;
@@ -2500,32 +2321,32 @@ PHP_FUNCTION(sodium_crypto_aead_chacha20poly1305_ietf_decrypt)
size_t npub_len;
size_t secretkey_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "ssss",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ssss",
&ciphertext, &ciphertext_len,
&ad, &ad_len,
&npub, &npub_len,
&secretkey, &secretkey_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (npub_len != crypto_aead_chacha20poly1305_IETF_NPUBBYTES) {
zend_throw_exception(sodium_exception_ce,
"public nonce size should be "
"SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_IETF_NPUBBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
if (secretkey_len != crypto_aead_chacha20poly1305_IETF_KEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"secret key size should be "
"SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_IETF_KEYBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
msg_len = ciphertext_len;
if (msg_len >= SIZE_MAX) {
zend_throw_exception(sodium_exception_ce, "arithmetic overflow", 0);
- return;
+ RETURN_THROWS();
}
if (ciphertext_len < crypto_aead_chacha20poly1305_IETF_ABYTES) {
RETURN_FALSE;
@@ -2533,7 +2354,7 @@ PHP_FUNCTION(sodium_crypto_aead_chacha20poly1305_ietf_decrypt)
if ((unsigned long long) ciphertext_len -
crypto_aead_chacha20poly1305_IETF_ABYTES > 64ULL * (1ULL << 32) - 64ULL) {
zend_throw_exception(sodium_exception_ce, "message too long for a single key", 0);
- return;
+ RETURN_THROWS();
}
msg = zend_string_alloc((size_t) msg_len, 0);
if (crypto_aead_chacha20poly1305_ietf_decrypt
@@ -2546,7 +2367,7 @@ PHP_FUNCTION(sodium_crypto_aead_chacha20poly1305_ietf_decrypt)
if (msg_real_len >= SIZE_MAX || msg_real_len > msg_len) {
zend_string_efree(msg);
zend_throw_exception(sodium_exception_ce, "arithmetic overflow", 0);
- return;
+ RETURN_THROWS();
}
PHP_SODIUM_ZSTR_TRUNCATE(msg, (size_t) msg_real_len);
ZSTR_VAL(msg)[msg_real_len] = 0;
@@ -2569,31 +2390,31 @@ PHP_FUNCTION(sodium_crypto_aead_xchacha20poly1305_ietf_encrypt)
size_t npub_len;
size_t secretkey_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "ssss",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ssss",
&msg, &msg_len,
&ad, &ad_len,
&npub, &npub_len,
&secretkey, &secretkey_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (npub_len != crypto_aead_xchacha20poly1305_IETF_NPUBBYTES) {
zend_throw_exception(sodium_exception_ce,
"public nonce size should be "
"SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
if (secretkey_len != crypto_aead_xchacha20poly1305_IETF_KEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"secret key size should be "
"SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_KEYBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
if (SIZE_MAX - msg_len <= crypto_aead_xchacha20poly1305_IETF_ABYTES) {
zend_throw_exception(sodium_exception_ce, "arithmetic overflow", 0);
- return;
+ RETURN_THROWS();
}
ciphertext_len = msg_len + crypto_aead_xchacha20poly1305_IETF_ABYTES;
ciphertext = zend_string_alloc((size_t) ciphertext_len, 0);
@@ -2603,13 +2424,13 @@ PHP_FUNCTION(sodium_crypto_aead_xchacha20poly1305_ietf_encrypt)
ad, (unsigned long long) ad_len, NULL, npub, secretkey) != 0) {
zend_string_efree(ciphertext);
zend_throw_exception(sodium_exception_ce, "internal error", 0);
- return;
+ RETURN_THROWS();
}
if (ciphertext_real_len <= 0U || ciphertext_real_len >= SIZE_MAX ||
ciphertext_real_len > ciphertext_len) {
zend_string_efree(ciphertext);
zend_throw_exception(sodium_exception_ce, "arithmetic overflow", 0);
- return;
+ RETURN_THROWS();
}
PHP_SODIUM_ZSTR_TRUNCATE(ciphertext, (size_t) ciphertext_real_len);
ZSTR_VAL(ciphertext)[ciphertext_real_len] = 0;
@@ -2631,27 +2452,27 @@ PHP_FUNCTION(sodium_crypto_aead_xchacha20poly1305_ietf_decrypt)
size_t npub_len;
size_t secretkey_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "ssss",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ssss",
&ciphertext, &ciphertext_len,
&ad, &ad_len,
&npub, &npub_len,
&secretkey, &secretkey_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (npub_len != crypto_aead_xchacha20poly1305_IETF_NPUBBYTES) {
zend_throw_exception(sodium_exception_ce,
"public nonce size should be "
"SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
if (secretkey_len != crypto_aead_xchacha20poly1305_IETF_KEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"secret key size should be "
"SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_KEYBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
if (ciphertext_len < crypto_aead_xchacha20poly1305_IETF_ABYTES) {
RETURN_FALSE;
@@ -2659,12 +2480,12 @@ PHP_FUNCTION(sodium_crypto_aead_xchacha20poly1305_ietf_decrypt)
msg_len = ciphertext_len;
if (msg_len - crypto_aead_xchacha20poly1305_IETF_ABYTES >= SIZE_MAX) {
zend_throw_exception(sodium_exception_ce, "arithmetic overflow", 0);
- return;
+ RETURN_THROWS();
}
if ((unsigned long long) ciphertext_len -
crypto_aead_xchacha20poly1305_IETF_ABYTES > 64ULL * (1ULL << 32) - 64ULL) {
zend_throw_exception(sodium_exception_ce, "arithmetic overflow", 0);
- return;
+ RETURN_THROWS();
}
msg = zend_string_alloc((size_t) msg_len, 0);
if (crypto_aead_xchacha20poly1305_ietf_decrypt
@@ -2677,7 +2498,7 @@ PHP_FUNCTION(sodium_crypto_aead_xchacha20poly1305_ietf_decrypt)
if (msg_real_len >= SIZE_MAX || msg_real_len > msg_len) {
zend_string_efree(msg);
zend_throw_exception(sodium_exception_ce, "arithmetic overflow", 0);
- return;
+ RETURN_THROWS();
}
PHP_SODIUM_ZSTR_TRUNCATE(msg, (size_t) msg_real_len);
ZSTR_VAL(msg)[msg_real_len] = 0;
@@ -2693,14 +2514,14 @@ PHP_FUNCTION(sodium_bin2hex)
size_t bin_len;
size_t hex_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "s",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",
&bin, &bin_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (bin_len >= SIZE_MAX / 2U) {
zend_throw_exception(sodium_exception_ce, "arithmetic overflow", 0);
- return;
+ RETURN_THROWS();
}
hex_len = bin_len * 2U;
hex = zend_string_alloc((size_t) hex_len, 0);
@@ -2721,11 +2542,11 @@ PHP_FUNCTION(sodium_hex2bin)
size_t hex_len;
size_t ignore_len = 0;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "s|s",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s",
&hex, &hex_len,
&ignore, &ignore_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
bin_len = hex_len / 2;
bin = zend_string_alloc(bin_len, 0);
@@ -2734,12 +2555,12 @@ PHP_FUNCTION(sodium_hex2bin)
end != hex + hex_len) {
zend_string_efree(bin);
zend_throw_exception(sodium_exception_ce, "invalid hex string", 0);
- return;
+ RETURN_THROWS();
}
if (bin_real_len >= SIZE_MAX || bin_real_len > bin_len) {
zend_string_efree(bin);
zend_throw_exception(sodium_exception_ce, "arithmetic overflow", 0);
- return;
+ RETURN_THROWS();
}
PHP_SODIUM_ZSTR_TRUNCATE(bin, (size_t) bin_real_len);
ZSTR_VAL(bin)[bin_real_len] = 0;
@@ -2756,19 +2577,19 @@ PHP_FUNCTION(sodium_bin2base64)
size_t bin_len;
size_t b64_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "sl",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl",
&bin, &bin_len, &variant) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if ((((unsigned int) variant) & ~ 0x6U) != 0x1U) {
zend_throw_exception(sodium_exception_ce,
"invalid base64 variant identifier", 0);
- return;
+ RETURN_THROWS();
}
if (bin_len >= SIZE_MAX / 4U * 3U - 3U - 1U) {
zend_throw_exception(sodium_exception_ce, "arithmetic overflow", 0);
- return;
+ RETURN_THROWS();
}
b64_len = sodium_base64_ENCODED_LEN(bin_len, variant);
b64 = zend_string_alloc((size_t) b64_len - 1U, 0);
@@ -2789,16 +2610,16 @@ PHP_FUNCTION(sodium_base642bin)
size_t b64_len;
size_t ignore_len = 0;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "sl|s",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl|s",
&b64, &b64_len, &variant,
&ignore, &ignore_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if ((((unsigned int) variant) & ~ 0x6U) != 0x1U) {
zend_throw_exception(sodium_exception_ce,
"invalid base64 variant identifier", 0);
- return;
+ RETURN_THROWS();
}
bin_len = b64_len / 4U * 3U + 2U;
bin = zend_string_alloc(bin_len, 0);
@@ -2808,12 +2629,12 @@ PHP_FUNCTION(sodium_base642bin)
end != b64 + b64_len) {
zend_string_efree(bin);
zend_throw_exception(sodium_exception_ce, "invalid base64 string", 0);
- return;
+ RETURN_THROWS();
}
if (bin_real_len >= SIZE_MAX || bin_real_len > bin_len) {
zend_string_efree(bin);
zend_throw_exception(sodium_exception_ce, "arithmetic overflow", 0);
- return;
+ RETURN_THROWS();
}
PHP_SODIUM_ZSTR_TRUNCATE(bin, (size_t) bin_real_len);
ZSTR_VAL(bin)[bin_real_len] = 0;
@@ -2830,23 +2651,23 @@ PHP_FUNCTION(sodium_crypto_scalarmult)
size_t n_len;
size_t p_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "ss",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss",
&n, &n_len, &p, &p_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (n_len != crypto_scalarmult_SCALARBYTES ||
p_len != crypto_scalarmult_BYTES) {
zend_throw_exception(sodium_exception_ce, "scalar and point must be "
"SODIUM_CRYPTO_SCALARMULT_SCALARBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
q = zend_string_alloc(crypto_scalarmult_BYTES, 0);
if (crypto_scalarmult((unsigned char *) ZSTR_VAL(q), n, p) != 0) {
zend_string_efree(q);
zend_throw_exception(sodium_exception_ce, "internal error", 0);
- return;
+ RETURN_THROWS();
}
ZSTR_VAL(q)[crypto_scalarmult_BYTES] = 0;
@@ -2861,14 +2682,14 @@ PHP_FUNCTION(sodium_crypto_kx_seed_keypair)
size_t seed_len;
zend_string *keypair;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "s",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",
&seed, &seed_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (seed_len != crypto_kx_SEEDBYTES) {
zend_throw_exception(sodium_exception_ce, "seed must be SODIUM_CRYPTO_KX_SEEDBYTES bytes", 0);
- return;
+ RETURN_THROWS();
}
(void) sizeof(int[crypto_scalarmult_SCALARBYTES == crypto_kx_PUBLICKEYBYTES ? 1 : -1]);
(void) sizeof(int[crypto_scalarmult_SCALARBYTES == crypto_kx_SECRETKEYBYTES ? 1 : -1]);
@@ -2879,7 +2700,7 @@ PHP_FUNCTION(sodium_crypto_kx_seed_keypair)
seed, crypto_kx_SEEDBYTES, NULL, 0);
if (crypto_scalarmult_base(pk, sk) != 0) {
zend_throw_exception(sodium_exception_ce, "internal error", 0);
- return;
+ RETURN_THROWS();
}
ZSTR_VAL(keypair)[crypto_kx_SECRETKEYBYTES + crypto_kx_PUBLICKEYBYTES] = 0;
RETURN_STR(keypair);
@@ -2892,7 +2713,7 @@ PHP_FUNCTION(sodium_crypto_kx_keypair)
zend_string *keypair;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
keypair = zend_string_alloc(crypto_kx_SECRETKEYBYTES + crypto_kx_PUBLICKEYBYTES, 0);
sk = (unsigned char *) ZSTR_VAL(keypair);
@@ -2900,7 +2721,7 @@ PHP_FUNCTION(sodium_crypto_kx_keypair)
randombytes_buf(sk, crypto_kx_SECRETKEYBYTES);
if (crypto_scalarmult_base(pk, sk) != 0) {
zend_throw_exception(sodium_exception_ce, "internal error", 0);
- return;
+ RETURN_THROWS();
}
RETURN_STR(keypair);
}
@@ -2911,17 +2732,17 @@ PHP_FUNCTION(sodium_crypto_kx_secretkey)
unsigned char *keypair;
size_t keypair_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "s",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",
&keypair, &keypair_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (keypair_len !=
crypto_kx_SECRETKEYBYTES + crypto_kx_PUBLICKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"keypair should be SODIUM_CRYPTO_KX_KEYPAIRBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
secretkey = zend_string_alloc(crypto_kx_SECRETKEYBYTES, 0);
memcpy(ZSTR_VAL(secretkey), keypair, crypto_kx_SECRETKEYBYTES);
@@ -2936,17 +2757,17 @@ PHP_FUNCTION(sodium_crypto_kx_publickey)
unsigned char *keypair;
size_t keypair_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "s",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",
&keypair, &keypair_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (keypair_len !=
crypto_kx_SECRETKEYBYTES + crypto_kx_PUBLICKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"keypair should be SODIUM_CRYPTO_KX_KEYPAIRBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
publickey = zend_string_alloc(crypto_kx_PUBLICKEYBYTES, 0);
memcpy(ZSTR_VAL(publickey), keypair + crypto_kx_SECRETKEYBYTES,
@@ -2968,19 +2789,19 @@ PHP_FUNCTION(sodium_crypto_kx_client_session_keys)
size_t keypair_len;
size_t server_pk_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "ss",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss",
&keypair, &keypair_len,
&server_pk, &server_pk_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (keypair_len != crypto_kx_SECRETKEYBYTES + crypto_kx_PUBLICKEYBYTES) {
zend_throw_exception(sodium_exception_ce, "keypair must be SODIUM_CRYPTO_KX_KEYPAIRBYTES bytes", 0);
- return;
+ RETURN_THROWS();
}
if (server_pk_len != crypto_kx_PUBLICKEYBYTES) {
zend_throw_exception(sodium_exception_ce, "public keys must be SODIUM_CRYPTO_KX_PUBLICKEYBYTES bytes", 0);
- return;
+ RETURN_THROWS();
}
client_sk = &keypair[0];
client_pk = &keypair[crypto_kx_SECRETKEYBYTES];
@@ -2988,7 +2809,7 @@ PHP_FUNCTION(sodium_crypto_kx_client_session_keys)
(void) sizeof(int[crypto_scalarmult_SCALARBYTES == crypto_kx_SECRETKEYBYTES ? 1 : -1]);
if (crypto_scalarmult(q, client_sk, server_pk) != 0) {
zend_throw_exception(sodium_exception_ce, "internal error", 0);
- return;
+ RETURN_THROWS();
}
crypto_generichash_init(&h, NULL, 0U, 2 * crypto_kx_SESSIONKEYBYTES);
crypto_generichash_update(&h, q, sizeof q);
@@ -3018,19 +2839,19 @@ PHP_FUNCTION(sodium_crypto_kx_server_session_keys)
size_t keypair_len;
size_t client_pk_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "ss",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss",
&keypair, &keypair_len,
&client_pk, &client_pk_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (keypair_len != crypto_kx_SECRETKEYBYTES + crypto_kx_PUBLICKEYBYTES) {
zend_throw_exception(sodium_exception_ce, "keypair must be SODIUM_CRYPTO_KX_KEYPAIRBYTES bytes", 0);
- return;
+ RETURN_THROWS();
}
if (client_pk_len != crypto_kx_PUBLICKEYBYTES) {
zend_throw_exception(sodium_exception_ce, "public keys must be SODIUM_CRYPTO_KX_PUBLICKEYBYTES bytes", 0);
- return;
+ RETURN_THROWS();
}
server_sk = &keypair[0];
server_pk = &keypair[crypto_kx_SECRETKEYBYTES];
@@ -3038,7 +2859,7 @@ PHP_FUNCTION(sodium_crypto_kx_server_session_keys)
(void) sizeof(int[crypto_scalarmult_SCALARBYTES == crypto_kx_SECRETKEYBYTES ? 1 : -1]);
if (crypto_scalarmult(q, server_sk, client_pk) != 0) {
zend_throw_exception(sodium_exception_ce, "internal error", 0);
- return;
+ RETURN_THROWS();
}
crypto_generichash_init(&h, NULL, 0U, 2 * crypto_kx_SESSIONKEYBYTES);
crypto_generichash_update(&h, q, sizeof q);
@@ -3064,22 +2885,22 @@ PHP_FUNCTION(sodium_crypto_auth)
size_t msg_len;
size_t key_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "ss",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss",
&msg, &msg_len,
&key, &key_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (key_len != crypto_auth_KEYBYTES) {
zend_throw_exception(sodium_exception_ce, "key must be SODIUM_CRYPTO_AUTH_KEYBYTES bytes", 0);
- return;
+ RETURN_THROWS();
}
mac = zend_string_alloc(crypto_auth_BYTES, 0);
if (crypto_auth((unsigned char *) ZSTR_VAL(mac),
(const unsigned char *) msg, msg_len,
(const unsigned char *) key) != 0) {
zend_throw_exception(sodium_exception_ce, "internal error", 0);
- return;
+ RETURN_THROWS();
}
ZSTR_VAL(mac)[crypto_auth_BYTES] = 0;
@@ -3095,20 +2916,20 @@ PHP_FUNCTION(sodium_crypto_auth_verify)
size_t msg_len;
size_t key_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "sss",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sss",
&mac, &mac_len,
&msg, &msg_len,
&key, &key_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (key_len != crypto_auth_KEYBYTES) {
zend_throw_exception(sodium_exception_ce, "key must be SODIUM_CRYPTO_AUTH_KEYBYTES bytes", 0);
- return;
+ RETURN_THROWS();
}
if (mac_len != crypto_auth_BYTES) {
zend_throw_exception(sodium_exception_ce, "authentication tag must be SODIUM_CRYPTO_AUTH_BYTES bytes", 0);
- return;
+ RETURN_THROWS();
}
if (crypto_auth_verify((const unsigned char *) mac,
(const unsigned char *) msg, msg_len,
@@ -3124,23 +2945,23 @@ PHP_FUNCTION(sodium_crypto_sign_ed25519_sk_to_curve25519)
char *eddsakey;
size_t eddsakey_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "s",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",
&eddsakey, &eddsakey_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (eddsakey_len != crypto_sign_SECRETKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"Ed25519 key should be SODIUM_CRYPTO_SIGN_SECRETKEYBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
ecdhkey = zend_string_alloc(crypto_box_SECRETKEYBYTES, 0);
if (crypto_sign_ed25519_sk_to_curve25519((unsigned char *) ZSTR_VAL(ecdhkey),
(const unsigned char *) eddsakey) != 0) {
zend_throw_exception(sodium_exception_ce, "conversion failed", 0);
- return;
+ RETURN_THROWS();
}
ZSTR_VAL(ecdhkey)[crypto_box_SECRETKEYBYTES] = 0;
@@ -3153,23 +2974,23 @@ PHP_FUNCTION(sodium_crypto_sign_ed25519_pk_to_curve25519)
char *eddsakey;
size_t eddsakey_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "s",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",
&eddsakey, &eddsakey_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (eddsakey_len != crypto_sign_PUBLICKEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"Ed25519 key should be SODIUM_CRYPTO_SIGN_PUBLICKEYBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
ecdhkey = zend_string_alloc(crypto_sign_PUBLICKEYBYTES, 0);
if (crypto_sign_ed25519_pk_to_curve25519((unsigned char *) ZSTR_VAL(ecdhkey),
(const unsigned char *) eddsakey) != 0) {
zend_throw_exception(sodium_exception_ce, "conversion failed", 0);
- return;
+ RETURN_THROWS();
}
ZSTR_VAL(ecdhkey)[crypto_box_PUBLICKEYBYTES] = 0;
@@ -3183,15 +3004,15 @@ PHP_FUNCTION(sodium_compare)
size_t len1;
size_t len2;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "ss",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss",
&buf1, &len1,
&buf2, &len2) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (len1 != len2) {
zend_throw_exception(sodium_exception_ce, "arguments have different sizes", 0);
- return;
+ RETURN_THROWS();
} else {
RETURN_LONG(sodium_compare((const unsigned char *) buf1,
(const unsigned char *) buf2, (size_t) len1));
@@ -3204,7 +3025,7 @@ PHP_FUNCTION(sodium_crypto_aead_aes256gcm_keygen)
unsigned char key[crypto_aead_aes256gcm_KEYBYTES];
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
randombytes_buf(key, sizeof key);
RETURN_STRINGL((const char *) key, sizeof key);
@@ -3216,7 +3037,7 @@ PHP_FUNCTION(sodium_crypto_aead_chacha20poly1305_keygen)
unsigned char key[crypto_aead_chacha20poly1305_KEYBYTES];
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
randombytes_buf(key, sizeof key);
RETURN_STRINGL((const char *) key, sizeof key);
@@ -3227,7 +3048,7 @@ PHP_FUNCTION(sodium_crypto_aead_chacha20poly1305_ietf_keygen)
unsigned char key[crypto_aead_chacha20poly1305_IETF_KEYBYTES];
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
randombytes_buf(key, sizeof key);
RETURN_STRINGL((const char *) key, sizeof key);
@@ -3239,7 +3060,7 @@ PHP_FUNCTION(sodium_crypto_aead_xchacha20poly1305_ietf_keygen)
unsigned char key[crypto_aead_xchacha20poly1305_IETF_KEYBYTES];
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
randombytes_buf(key, sizeof key);
RETURN_STRINGL((const char *) key, sizeof key);
@@ -3251,7 +3072,7 @@ PHP_FUNCTION(sodium_crypto_auth_keygen)
unsigned char key[crypto_auth_KEYBYTES];
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
randombytes_buf(key, sizeof key);
RETURN_STRINGL((const char *) key, sizeof key);
@@ -3262,7 +3083,7 @@ PHP_FUNCTION(sodium_crypto_generichash_keygen)
unsigned char key[crypto_generichash_KEYBYTES];
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
randombytes_buf(key, sizeof key);
RETURN_STRINGL((const char *) key, sizeof key);
@@ -3273,7 +3094,7 @@ PHP_FUNCTION(sodium_crypto_kdf_keygen)
unsigned char key[crypto_kdf_KEYBYTES];
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
randombytes_buf(key, sizeof key);
RETURN_STRINGL((const char *) key, sizeof key);
@@ -3284,7 +3105,7 @@ PHP_FUNCTION(sodium_crypto_secretbox_keygen)
unsigned char key[crypto_secretbox_KEYBYTES];
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
randombytes_buf(key, sizeof key);
RETURN_STRINGL((const char *) key, sizeof key);
@@ -3295,7 +3116,7 @@ PHP_FUNCTION(sodium_crypto_shorthash_keygen)
unsigned char key[crypto_shorthash_KEYBYTES];
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
randombytes_buf(key, sizeof key);
RETURN_STRINGL((const char *) key, sizeof key);
@@ -3306,7 +3127,7 @@ PHP_FUNCTION(sodium_crypto_stream_keygen)
unsigned char key[crypto_stream_KEYBYTES];
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
randombytes_buf(key, sizeof key);
RETURN_STRINGL((const char *) key, sizeof key);
@@ -3326,33 +3147,33 @@ PHP_FUNCTION(sodium_crypto_kdf_derive_from_key)
size_t ctx_len;
size_t key_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "llss",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "llss",
&subkey_len,
&subkey_id,
&ctx, &ctx_len,
&key, &key_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (subkey_len < crypto_kdf_BYTES_MIN) {
zend_throw_exception(sodium_exception_ce, "subkey cannot be smaller than SODIUM_CRYPTO_KDF_BYTES_MIN", 0);
- return;
+ RETURN_THROWS();
}
if (subkey_len > crypto_kdf_BYTES_MAX || subkey_len > SIZE_MAX) {
zend_throw_exception(sodium_exception_ce, "subkey cannot be larger than SODIUM_CRYPTO_KDF_BYTES_MAX", 0);
- return;
+ RETURN_THROWS();
}
if (subkey_id < 0) {
zend_throw_exception(sodium_exception_ce, "subkey_id cannot be negative", 0);
- return;
+ RETURN_THROWS();
}
if (ctx_len != crypto_kdf_CONTEXTBYTES) {
zend_throw_exception(sodium_exception_ce, "context should be SODIUM_CRYPTO_KDF_CONTEXTBYTES bytes", 0);
- return;
+ RETURN_THROWS();
}
if (key_len != crypto_kdf_KEYBYTES) {
zend_throw_exception(sodium_exception_ce, "key should be SODIUM_CRYPTO_KDF_KEYBYTES bytes", 0);
- return;
+ RETURN_THROWS();
}
memcpy(ctx_padded, ctx, crypto_kdf_CONTEXTBYTES);
memset(ctx_padded + crypto_kdf_CONTEXTBYTES, 0, sizeof ctx_padded - crypto_kdf_CONTEXTBYTES);
@@ -3394,18 +3215,18 @@ PHP_FUNCTION(sodium_pad)
size_t xpadlen;
size_t xpadded_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "sl",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl",
&unpadded, &unpadded_len, &blocksize) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (blocksize <= 0) {
zend_throw_exception(sodium_exception_ce, "block size cannot be less than 1", 0);
- return;
+ RETURN_THROWS();
}
if (blocksize > SIZE_MAX) {
zend_throw_exception(sodium_exception_ce, "block size is too large", 0);
- return;
+ RETURN_THROWS();
}
xpadlen = blocksize - 1U;
if ((blocksize & (blocksize - 1U)) == 0U) {
@@ -3415,7 +3236,7 @@ PHP_FUNCTION(sodium_pad)
}
if ((size_t) SIZE_MAX - unpadded_len <= xpadlen) {
zend_throw_exception(sodium_exception_ce, "input is too large", 0);
- return;
+ RETURN_THROWS();
}
xpadded_len = unpadded_len + xpadlen;
padded = zend_string_alloc(xpadded_len + 1U, 0);
@@ -3435,7 +3256,7 @@ PHP_FUNCTION(sodium_pad)
if (sodium_pad(NULL, (unsigned char *) ZSTR_VAL(padded), unpadded_len,
(size_t) blocksize, xpadded_len + 1U) != 0) {
zend_throw_exception(sodium_exception_ce, "internal error", 0);
- return;
+ RETURN_THROWS();
}
#else
{
@@ -3467,22 +3288,22 @@ PHP_FUNCTION(sodium_unpad)
zend_long blocksize;
int ret;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "sl",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl",
&padded, &padded_len, &blocksize) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (blocksize <= 0) {
zend_throw_exception(sodium_exception_ce, "block size cannot be less than 1", 0);
- return;
+ RETURN_THROWS();
}
if (blocksize > SIZE_MAX) {
zend_throw_exception(sodium_exception_ce, "block size is too large", 0);
- return;
+ RETURN_THROWS();
}
if (padded_len < blocksize) {
zend_throw_exception(sodium_exception_ce, "invalid padding", 0);
- return;
+ RETURN_THROWS();
}
#if SODIUM_LIBRARY_VERSION_MAJOR > 9 || (SODIUM_LIBRARY_VERSION_MAJOR == 9 && SODIUM_LIBRARY_VERSION_MINOR >= 6)
@@ -3514,7 +3335,7 @@ PHP_FUNCTION(sodium_unpad)
#endif
if (ret != 0 || unpadded_len > LONG_MAX) {
zend_throw_exception(sodium_exception_ce, "invalid padding", 0);
- return;
+ RETURN_THROWS();
}
unpadded = zend_string_init(padded, padded_len, 0);
PHP_SODIUM_ZSTR_TRUNCATE(unpadded, unpadded_len);
@@ -3528,7 +3349,7 @@ PHP_FUNCTION(sodium_crypto_secretstream_xchacha20poly1305_keygen)
unsigned char key[crypto_secretstream_xchacha20poly1305_KEYBYTES];
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
randombytes_buf(key, sizeof key);
RETURN_STRINGL((const char *) key, sizeof key);
@@ -3541,21 +3362,21 @@ PHP_FUNCTION(sodium_crypto_secretstream_xchacha20poly1305_init_push)
unsigned char *key;
size_t key_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "s",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",
&key, &key_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (key_len != crypto_secretstream_xchacha20poly1305_KEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"key size should be SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_KEYBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
if (crypto_secretstream_xchacha20poly1305_init_push(&state,
header, key) != 0) {
zend_throw_exception(sodium_exception_ce, "internal error", 0);
- return;
+ RETURN_THROWS();
}
array_init(return_value);
add_next_index_stringl(return_value, (const char *) &state, sizeof state);
@@ -3576,32 +3397,32 @@ PHP_FUNCTION(sodium_crypto_secretstream_xchacha20poly1305_push)
size_t msg_len;
size_t state_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "zs|sl",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "zs|sl",
&state_zv,
&msg, &msg_len, &ad, &ad_len, &tag) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
ZVAL_DEREF(state_zv);
if (Z_TYPE_P(state_zv) != IS_STRING) {
zend_throw_exception(sodium_exception_ce, "a reference to a state is required", 0);
- return;
+ RETURN_THROWS();
}
sodium_separate_string(state_zv);
state = (unsigned char *) Z_STRVAL(*state_zv);
state_len = Z_STRLEN(*state_zv);
if (state_len != sizeof (crypto_secretstream_xchacha20poly1305_state)) {
zend_throw_exception(sodium_exception_ce, "incorrect state length", 0);
- return;
+ RETURN_THROWS();
}
if (msg_len > crypto_secretstream_xchacha20poly1305_MESSAGEBYTES_MAX ||
msg_len > SIZE_MAX - crypto_secretstream_xchacha20poly1305_ABYTES) {
zend_throw_exception(sodium_exception_ce, "message cannot be larger than SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_MESSAGEBYTES_MAX bytes", 0);
- return;
+ RETURN_THROWS();
}
if (tag < 0 || tag > 255) {
zend_throw_exception(sodium_exception_ce, "unsupported value for the tag", 0);
- return;
+ RETURN_THROWS();
}
c_len = msg_len + crypto_secretstream_xchacha20poly1305_ABYTES;
c = zend_string_alloc((size_t) c_len, 0);
@@ -3611,12 +3432,12 @@ PHP_FUNCTION(sodium_crypto_secretstream_xchacha20poly1305_push)
(unsigned char) tag) != 0) {
zend_string_efree(c);
zend_throw_exception(sodium_exception_ce, "internal error", 0);
- return;
+ RETURN_THROWS();
}
if (c_real_len <= 0U || c_real_len >= SIZE_MAX || c_real_len > c_len) {
zend_string_efree(c);
zend_throw_exception(sodium_exception_ce, "arithmetic overflow", 0);
- return;
+ RETURN_THROWS();
}
PHP_SODIUM_ZSTR_TRUNCATE(c, (size_t) c_real_len);
ZSTR_VAL(c)[c_real_len] = 0;
@@ -3632,28 +3453,28 @@ PHP_FUNCTION(sodium_crypto_secretstream_xchacha20poly1305_init_pull)
size_t header_len;
size_t key_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "ss",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss",
&header, &header_len,
&key, &key_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
if (header_len != crypto_secretstream_xchacha20poly1305_HEADERBYTES) {
zend_throw_exception(sodium_exception_ce,
"header size should be SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_HEADERBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
if (key_len != crypto_secretstream_xchacha20poly1305_KEYBYTES) {
zend_throw_exception(sodium_exception_ce,
"key size should be SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_KEYBYTES bytes",
0);
- return;
+ RETURN_THROWS();
}
if (crypto_secretstream_xchacha20poly1305_init_pull(&state,
header, key) != 0) {
zend_throw_exception(sodium_exception_ce, "internal error", 0);
- return;
+ RETURN_THROWS();
}
RETURN_STRINGL((const char *) &state, sizeof state);
}
@@ -3672,23 +3493,23 @@ PHP_FUNCTION(sodium_crypto_secretstream_xchacha20poly1305_pull)
size_t state_len;
unsigned char tag;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "zs|s",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "zs|s",
&state_zv,
&c, &c_len, &ad, &ad_len) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
ZVAL_DEREF(state_zv);
if (Z_TYPE_P(state_zv) != IS_STRING) {
zend_throw_exception(sodium_exception_ce, "a reference to a state is required", 0);
- return;
+ RETURN_THROWS();
}
sodium_separate_string(state_zv);
state = (unsigned char *) Z_STRVAL(*state_zv);
state_len = Z_STRLEN(*state_zv);
if (state_len != sizeof (crypto_secretstream_xchacha20poly1305_state)) {
zend_throw_exception(sodium_exception_ce, "incorrect state length", 0);
- return;
+ RETURN_THROWS();
}
if (c_len < crypto_secretstream_xchacha20poly1305_ABYTES) {
RETURN_FALSE;
@@ -3704,7 +3525,7 @@ PHP_FUNCTION(sodium_crypto_secretstream_xchacha20poly1305_pull)
if (msg_real_len >= SIZE_MAX || msg_real_len > msg_len) {
zend_string_efree(msg);
zend_throw_exception(sodium_exception_ce, "arithmetic overflow", 0);
- return;
+ RETURN_THROWS();
}
PHP_SODIUM_ZSTR_TRUNCATE(msg, (size_t) msg_real_len);
ZSTR_VAL(msg)[msg_real_len] = 0;
@@ -3719,21 +3540,21 @@ PHP_FUNCTION(sodium_crypto_secretstream_xchacha20poly1305_rekey)
unsigned char *state;
size_t state_len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "z", &state_zv) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &state_zv) == FAILURE) {
sodium_remove_param_values_from_backtrace(EG(exception));
- return;
+ RETURN_THROWS();
}
ZVAL_DEREF(state_zv);
if (Z_TYPE_P(state_zv) != IS_STRING) {
zend_throw_exception(sodium_exception_ce, "a reference to a state is required", 0);
- return;
+ RETURN_THROWS();
}
sodium_separate_string(state_zv);
state = (unsigned char *) Z_STRVAL(*state_zv);
state_len = Z_STRLEN(*state_zv);
if (state_len != sizeof (crypto_secretstream_xchacha20poly1305_state)) {
zend_throw_exception(sodium_exception_ce, "incorrect state length", 0);
- return;
+ RETURN_THROWS();
}
crypto_secretstream_xchacha20poly1305_rekey((void *) state);
}
diff --git a/ext/sodium/libsodium.stub.php b/ext/sodium/libsodium.stub.php
new file mode 100644
index 0000000000..1af1e98a7f
--- /dev/null
+++ b/ext/sodium/libsodium.stub.php
@@ -0,0 +1,185 @@
+<?php
+
+function sodium_crypto_aead_aes256gcm_is_available(): bool {}
+
+#ifdef HAVE_AESGCM
+function sodium_crypto_aead_aes256gcm_decrypt(string $string, string $ad, string $nonce, string $key): string|false {}
+
+function sodium_crypto_aead_aes256gcm_encrypt(string $string, string $ad, string $nonce, string $key): string {}
+
+function sodium_crypto_aead_aes256gcm_keygen(): string {}
+#endif
+
+function sodium_crypto_aead_chacha20poly1305_decrypt(string $string, string $ad, string $nonce, string $key): string|false {}
+
+function sodium_crypto_aead_chacha20poly1305_encrypt(string $string, string $ad, string $nonce, string $key): string {}
+
+function sodium_crypto_aead_chacha20poly1305_keygen(): string {}
+
+function sodium_crypto_aead_chacha20poly1305_ietf_decrypt(string $string, string $ad, string $nonce, string $key): string|false {}
+
+function sodium_crypto_aead_chacha20poly1305_ietf_encrypt(string $string, string $ad, string $nonce, string $key): string {}
+
+function sodium_crypto_aead_chacha20poly1305_ietf_keygen(): string {}
+
+#ifdef crypto_aead_xchacha20poly1305_IETF_NPUBBYTES
+function sodium_crypto_aead_xchacha20poly1305_ietf_decrypt(string $string, string $ad, string $nonce, string $key): string|false {}
+
+function sodium_crypto_aead_xchacha20poly1305_ietf_keygen(): string {}
+
+function sodium_crypto_aead_xchacha20poly1305_ietf_encrypt(string $string, string $ad, string $nonce, string $key): string {}
+#endif
+
+function sodium_crypto_auth(string $string, string $key): string {}
+
+function sodium_crypto_auth_keygen(): string {}
+
+function sodium_crypto_auth_verify(string $signature, string $string, string $key): bool {}
+
+function sodium_crypto_box(string $string, string $nonce, string $key): string {}
+
+function sodium_crypto_box_keypair(): string {}
+
+function sodium_crypto_box_seed_keypair(string $key): string {}
+
+function sodium_crypto_box_keypair_from_secretkey_and_publickey(string $secret_key, string $public_key): string {}
+
+function sodium_crypto_box_open(string $string, string $nonce, string $key): string|false {}
+
+function sodium_crypto_box_publickey(string $key): string {}
+
+function sodium_crypto_box_publickey_from_secretkey(string $key): string {}
+
+function sodium_crypto_box_seal(string $string, string $key): string {}
+
+function sodium_crypto_box_seal_open(string $string, string $key): string|false {}
+
+function sodium_crypto_box_secretkey(string $key): string {}
+
+function sodium_crypto_kx_keypair(): string {}
+
+function sodium_crypto_kx_publickey(string $key): string {}
+
+function sodium_crypto_kx_secretkey(string $key): string {}
+
+function sodium_crypto_kx_seed_keypair(string $string): string {}
+
+function sodium_crypto_kx_client_session_keys(string $client_keypair, string $server_key): array {}
+
+function sodium_crypto_kx_server_session_keys(string $server_keypair, string $client_key): array {}
+
+function sodium_crypto_generichash(string $string, string $key = "", int $length = SODIUM_CRYPTO_GENERICHASH_BYTES): string {}
+
+function sodium_crypto_generichash_keygen(): string {}
+
+function sodium_crypto_generichash_init(string $key = "", int $length = SODIUM_CRYPTO_GENERICHASH_BYTES): string {}
+
+function sodium_crypto_generichash_update(string &$state, string $string): bool {}
+
+function sodium_crypto_generichash_final(string &$state, $length = SODIUM_CRYPTO_GENERICHASH_BYTES): string {}
+
+function sodium_crypto_kdf_derive_from_key(int $subkey_len, int $subkey_id, string $context, string $key): string {}
+
+function sodium_crypto_kdf_keygen(): string {}
+
+#ifdef crypto_pwhash_SALTBYTES
+function sodium_crypto_pwhash(int $length, string $password, string $salt, int $opslimit, int $memlimit, int $alg = SODIUM_CRYPTO_PWHASH_ALG_DEFAULT): string {}
+
+function sodium_crypto_pwhash_str(string $password, int $opslimit, int $memlimit): string {}
+
+function sodium_crypto_pwhash_str_verify(string $hash, string $password): bool {}
+#endif
+
+#if SODIUM_LIBRARY_VERSION_MAJOR > 9 || (SODIUM_LIBRARY_VERSION_MAJOR == 9 && SODIUM_LIBRARY_VERSION_MINOR >= 6)
+function sodium_crypto_pwhash_str_needs_rehash(string $password, int $opslimit, int $memlimit): bool {}
+#endif
+
+#ifdef crypto_pwhash_scryptsalsa208sha256_SALTBYTES
+function sodium_crypto_pwhash_scryptsalsa208sha256(int $length, string $password, string $salt, int $opslimit, int $memlimit): string {}
+
+function sodium_crypto_pwhash_scryptsalsa208sha256_str(string $password, int $opslimit, int $memlimit): string {}
+
+function sodium_crypto_pwhash_scryptsalsa208sha256_str_verify(string $hash, string $password): bool {}
+#endif
+
+function sodium_crypto_scalarmult(string $string_1, string $string_2): string {}
+
+function sodium_crypto_secretbox(string $string, string $nonce, string $key): string {}
+
+function sodium_crypto_secretbox_keygen(): string {}
+
+function sodium_crypto_secretbox_open(string $string, string $nonce, string $key): string|false {}
+
+#ifdef crypto_secretstream_xchacha20poly1305_ABYTES
+function sodium_crypto_secretstream_xchacha20poly1305_keygen(): string {}
+
+function sodium_crypto_secretstream_xchacha20poly1305_init_push(string $key): array {}
+
+function sodium_crypto_secretstream_xchacha20poly1305_push(string &$state, string $msg, string $ad = "", int $tag = SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_MESSAGE): string {}
+
+function sodium_crypto_secretstream_xchacha20poly1305_init_pull(string $string, string $key): string {}
+
+function sodium_crypto_secretstream_xchacha20poly1305_pull(string &$state, string $c, string $ad = ""): array|false {}
+
+function sodium_crypto_secretstream_xchacha20poly1305_rekey(string &$state): void {}
+#endif
+
+function sodium_crypto_shorthash(string $string, string $key): string {}
+
+function sodium_crypto_shorthash_keygen(): string {}
+
+function sodium_crypto_sign(string $string, string $keypair): string {}
+
+function sodium_crypto_sign_detached(string $string, string $keypair): string {}
+
+function sodium_crypto_sign_ed25519_pk_to_curve25519(string $key): string {}
+
+function sodium_crypto_sign_ed25519_sk_to_curve25519(string $key): string {}
+
+function sodium_crypto_sign_keypair(): string {}
+
+function sodium_crypto_sign_keypair_from_secretkey_and_publickey(string $secret_key, string $public_key): string {}
+
+function sodium_crypto_sign_open(string $string, string $keypair): string|false {}
+
+function sodium_crypto_sign_publickey(string $key): string {}
+
+function sodium_crypto_sign_secretkey(string $key): string {}
+
+function sodium_crypto_sign_publickey_from_secretkey(string $key): string {}
+
+function sodium_crypto_sign_seed_keypair(string $key): string {}
+
+function sodium_crypto_sign_verify_detached(string $signature, string $string, string $key): bool {}
+
+function sodium_crypto_stream(int $length, string $nonce, string $key): string {}
+
+function sodium_crypto_stream_keygen(): string {}
+
+function sodium_crypto_stream_xor(string $string, string $nonce, string $key): string {}
+
+function sodium_add(string &$string_1, string $string_2): void {}
+
+function sodium_compare(string $string_1, string $string_2): int {}
+
+function sodium_increment(string &$string): void {}
+
+function sodium_memcmp(string $string_1, string $string_2): int {}
+
+function sodium_memzero(string &$reference): void {}
+
+function sodium_pad(string $string, int $length): string {}
+
+function sodium_unpad(string $string, int $length): string {}
+
+function sodium_bin2hex(string $string): string {}
+
+function sodium_hex2bin(string $string, $ignore = ""): string {}
+
+#ifdef sodium_base64_VARIANT_ORIGINAL
+function sodium_bin2base64(string $string, int $id): string {}
+
+function sodium_base642bin(string $string, int $id, string $ignore = ""): string {}
+#endif
+
+function sodium_crypto_scalarmult_base(string $key): string {}
diff --git a/ext/sodium/libsodium_arginfo.h b/ext/sodium/libsodium_arginfo.h
new file mode 100644
index 0000000000..90b1d2d5fd
--- /dev/null
+++ b/ext/sodium/libsodium_arginfo.h
@@ -0,0 +1,380 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_aead_aes256gcm_is_available, 0, 0, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_AESGCM)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_sodium_crypto_aead_aes256gcm_decrypt, 0, 4, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, ad, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, nonce, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_AESGCM)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_aead_aes256gcm_encrypt, 0, 4, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, ad, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, nonce, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_AESGCM)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_aead_aes256gcm_keygen, 0, 0, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_sodium_crypto_aead_chacha20poly1305_decrypt, 0, 4, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, ad, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, nonce, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_aead_chacha20poly1305_encrypt, 0, 4, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, ad, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, nonce, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_aead_chacha20poly1305_keygen, 0, 0, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_sodium_crypto_aead_chacha20poly1305_ietf_decrypt arginfo_sodium_crypto_aead_chacha20poly1305_decrypt
+
+#define arginfo_sodium_crypto_aead_chacha20poly1305_ietf_encrypt arginfo_sodium_crypto_aead_chacha20poly1305_encrypt
+
+#define arginfo_sodium_crypto_aead_chacha20poly1305_ietf_keygen arginfo_sodium_crypto_aead_chacha20poly1305_keygen
+
+#if defined(crypto_aead_xchacha20poly1305_IETF_NPUBBYTES)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_sodium_crypto_aead_xchacha20poly1305_ietf_decrypt, 0, 4, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, ad, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, nonce, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(crypto_aead_xchacha20poly1305_IETF_NPUBBYTES)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_aead_xchacha20poly1305_ietf_keygen, 0, 0, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(crypto_aead_xchacha20poly1305_IETF_NPUBBYTES)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_aead_xchacha20poly1305_ietf_encrypt, 0, 4, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, ad, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, nonce, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_auth, 0, 2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_sodium_crypto_auth_keygen arginfo_sodium_crypto_aead_chacha20poly1305_keygen
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_auth_verify, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, signature, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_box, 0, 3, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, nonce, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_sodium_crypto_box_keypair arginfo_sodium_crypto_aead_chacha20poly1305_keygen
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_box_seed_keypair, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_box_keypair_from_secretkey_and_publickey, 0, 2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, secret_key, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, public_key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_sodium_crypto_box_open, 0, 3, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, nonce, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_sodium_crypto_box_publickey arginfo_sodium_crypto_box_seed_keypair
+
+#define arginfo_sodium_crypto_box_publickey_from_secretkey arginfo_sodium_crypto_box_seed_keypair
+
+#define arginfo_sodium_crypto_box_seal arginfo_sodium_crypto_auth
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_sodium_crypto_box_seal_open, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_sodium_crypto_box_secretkey arginfo_sodium_crypto_box_seed_keypair
+
+#define arginfo_sodium_crypto_kx_keypair arginfo_sodium_crypto_aead_chacha20poly1305_keygen
+
+#define arginfo_sodium_crypto_kx_publickey arginfo_sodium_crypto_box_seed_keypair
+
+#define arginfo_sodium_crypto_kx_secretkey arginfo_sodium_crypto_box_seed_keypair
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_kx_seed_keypair, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_kx_client_session_keys, 0, 2, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, client_keypair, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, server_key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_kx_server_session_keys, 0, 2, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, server_keypair, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, client_key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_generichash, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_sodium_crypto_generichash_keygen arginfo_sodium_crypto_aead_chacha20poly1305_keygen
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_generichash_init, 0, 0, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_generichash_update, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(1, state, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_generichash_final, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(1, state, IS_STRING, 0)
+ ZEND_ARG_INFO(0, length)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_kdf_derive_from_key, 0, 4, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, subkey_len, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, subkey_id, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, context, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_sodium_crypto_kdf_keygen arginfo_sodium_crypto_aead_chacha20poly1305_keygen
+
+#if defined(crypto_pwhash_SALTBYTES)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_pwhash, 0, 5, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, salt, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, opslimit, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, memlimit, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, alg, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(crypto_pwhash_SALTBYTES)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_pwhash_str, 0, 3, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, opslimit, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, memlimit, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(crypto_pwhash_SALTBYTES)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_pwhash_str_verify, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, hash, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if SODIUM_LIBRARY_VERSION_MAJOR > 9 || (SODIUM_LIBRARY_VERSION_MAJOR == 9 && SODIUM_LIBRARY_VERSION_MINOR >= 6)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_pwhash_str_needs_rehash, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, opslimit, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, memlimit, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(crypto_pwhash_scryptsalsa208sha256_SALTBYTES)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_pwhash_scryptsalsa208sha256, 0, 5, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, salt, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, opslimit, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, memlimit, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(crypto_pwhash_scryptsalsa208sha256_SALTBYTES)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_pwhash_scryptsalsa208sha256_str, 0, 3, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, opslimit, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, memlimit, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(crypto_pwhash_scryptsalsa208sha256_SALTBYTES)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_pwhash_scryptsalsa208sha256_str_verify, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, hash, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_scalarmult, 0, 2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string_1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string_2, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_sodium_crypto_secretbox arginfo_sodium_crypto_box
+
+#define arginfo_sodium_crypto_secretbox_keygen arginfo_sodium_crypto_aead_chacha20poly1305_keygen
+
+#define arginfo_sodium_crypto_secretbox_open arginfo_sodium_crypto_box_open
+
+#if defined(crypto_secretstream_xchacha20poly1305_ABYTES)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_secretstream_xchacha20poly1305_keygen, 0, 0, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(crypto_secretstream_xchacha20poly1305_ABYTES)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_secretstream_xchacha20poly1305_init_push, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(crypto_secretstream_xchacha20poly1305_ABYTES)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_secretstream_xchacha20poly1305_push, 0, 2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(1, state, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, msg, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, ad, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, tag, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(crypto_secretstream_xchacha20poly1305_ABYTES)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_secretstream_xchacha20poly1305_init_pull, 0, 2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(crypto_secretstream_xchacha20poly1305_ABYTES)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_sodium_crypto_secretstream_xchacha20poly1305_pull, 0, 2, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(1, state, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, c, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, ad, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(crypto_secretstream_xchacha20poly1305_ABYTES)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_secretstream_xchacha20poly1305_rekey, 0, 1, IS_VOID, 0)
+ ZEND_ARG_TYPE_INFO(1, state, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#define arginfo_sodium_crypto_shorthash arginfo_sodium_crypto_auth
+
+#define arginfo_sodium_crypto_shorthash_keygen arginfo_sodium_crypto_aead_chacha20poly1305_keygen
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_sign, 0, 2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, keypair, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_sodium_crypto_sign_detached arginfo_sodium_crypto_sign
+
+#define arginfo_sodium_crypto_sign_ed25519_pk_to_curve25519 arginfo_sodium_crypto_box_seed_keypair
+
+#define arginfo_sodium_crypto_sign_ed25519_sk_to_curve25519 arginfo_sodium_crypto_box_seed_keypair
+
+#define arginfo_sodium_crypto_sign_keypair arginfo_sodium_crypto_aead_chacha20poly1305_keygen
+
+#define arginfo_sodium_crypto_sign_keypair_from_secretkey_and_publickey arginfo_sodium_crypto_box_keypair_from_secretkey_and_publickey
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_sodium_crypto_sign_open, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, keypair, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_sodium_crypto_sign_publickey arginfo_sodium_crypto_box_seed_keypair
+
+#define arginfo_sodium_crypto_sign_secretkey arginfo_sodium_crypto_box_seed_keypair
+
+#define arginfo_sodium_crypto_sign_publickey_from_secretkey arginfo_sodium_crypto_box_seed_keypair
+
+#define arginfo_sodium_crypto_sign_seed_keypair arginfo_sodium_crypto_box_seed_keypair
+
+#define arginfo_sodium_crypto_sign_verify_detached arginfo_sodium_crypto_auth_verify
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_crypto_stream, 0, 3, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, nonce, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_sodium_crypto_stream_keygen arginfo_sodium_crypto_aead_chacha20poly1305_keygen
+
+#define arginfo_sodium_crypto_stream_xor arginfo_sodium_crypto_box
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_add, 0, 2, IS_VOID, 0)
+ ZEND_ARG_TYPE_INFO(1, string_1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string_2, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_compare, 0, 2, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, string_1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string_2, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_increment, 0, 1, IS_VOID, 0)
+ ZEND_ARG_TYPE_INFO(1, string, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_sodium_memcmp arginfo_sodium_compare
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_memzero, 0, 1, IS_VOID, 0)
+ ZEND_ARG_TYPE_INFO(1, reference, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_pad, 0, 2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_sodium_unpad arginfo_sodium_pad
+
+#define arginfo_sodium_bin2hex arginfo_sodium_crypto_kx_seed_keypair
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_hex2bin, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_INFO(0, ignore)
+ZEND_END_ARG_INFO()
+
+#if defined(sodium_base64_VARIANT_ORIGINAL)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_bin2base64, 0, 2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, id, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(sodium_base64_VARIANT_ORIGINAL)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sodium_base642bin, 0, 2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, id, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, ignore, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#define arginfo_sodium_crypto_scalarmult_base arginfo_sodium_crypto_box_seed_keypair
diff --git a/ext/sodium/php_libsodium.h b/ext/sodium/php_libsodium.h
index f0ec64ca77..1a8d3ef907 100644
--- a/ext/sodium/php_libsodium.h
+++ b/ext/sodium/php_libsodium.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/sodium/sodium_pwhash.c b/ext/sodium/sodium_pwhash.c
index 2b284c7116..e58a9514cc 100644
--- a/ext/sodium/sodium_pwhash.c
+++ b/ext/sodium/sodium_pwhash.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -52,7 +50,7 @@ static inline int get_options(zend_array *options, size_t *memlimit, size_t *ops
zend_long smemlimit = zval_get_long(opt);
if ((smemlimit < 0) || (smemlimit < crypto_pwhash_MEMLIMIT_MIN >> 10) || (smemlimit > (crypto_pwhash_MEMLIMIT_MAX >> 10))) {
- php_error_docref(NULL, E_WARNING, "Memory cost is outside of allowed memory range");
+ zend_value_error("Memory cost is outside of allowed memory range");
return FAILURE;
}
*memlimit = smemlimit << 10;
@@ -60,12 +58,12 @@ static inline int get_options(zend_array *options, size_t *memlimit, size_t *ops
if ((opt = zend_hash_str_find(options, "time_cost", strlen("time_cost")))) {
*opslimit = zval_get_long(opt);
if ((*opslimit < crypto_pwhash_OPSLIMIT_MIN) || (*opslimit > crypto_pwhash_OPSLIMIT_MAX)) {
- php_error_docref(NULL, E_WARNING, "Time cost is outside of allowed time range");
+ zend_value_error("Time cost is outside of allowed time range");
return FAILURE;
}
}
if ((opt = zend_hash_str_find(options, "threads", strlen("threads"))) && (zval_get_long(opt) != 1)) {
- php_error_docref(NULL, E_WARNING, "A thread value other than 1 is not supported by this implementation");
+ zend_value_error("A thread value other than 1 is not supported by this implementation");
return FAILURE;
}
return SUCCESS;
@@ -76,7 +74,7 @@ static zend_string *php_sodium_argon2_hash(const zend_string *password, zend_arr
zend_string *ret;
if ((ZSTR_LEN(password) >= 0xffffffff)) {
- php_error_docref(NULL, E_WARNING, "Password is too long");
+ zend_value_error("Password is too long");
return NULL;
}
@@ -86,7 +84,7 @@ static zend_string *php_sodium_argon2_hash(const zend_string *password, zend_arr
ret = zend_string_alloc(crypto_pwhash_STRBYTES - 1, 0);
if (crypto_pwhash_str_alg(ZSTR_VAL(ret), ZSTR_VAL(password), ZSTR_LEN(password), opslimit, memlimit, alg)) {
- php_error_docref(NULL, E_WARNING, "Unexpected failure hashing password");
+ zend_value_error("Unexpected failure hashing password");
zend_string_release(ret);
return NULL;
}
diff --git a/ext/sodium/tests/installed.phpt b/ext/sodium/tests/installed.phpt
index e6101ed509..f004efa714 100644
--- a/ext/sodium/tests/installed.phpt
+++ b/ext/sodium/tests/installed.phpt
@@ -9,7 +9,7 @@ echo "sodium extension is available";
you can add regression tests for your extension here
the output of your test code has to be equal to the
- text in the --EXPECT-- section below for the tests
+ text in the--EXPECT-- section below for the tests
to pass, differences between the output and the
expected text are interpreted as failure
*/
diff --git a/ext/sodium/tests/pwhash_scrypt.phpt b/ext/sodium/tests/pwhash_scrypt.phpt
index 92db7ac7e0..8e02f7ba0e 100644
--- a/ext/sodium/tests/pwhash_scrypt.phpt
+++ b/ext/sodium/tests/pwhash_scrypt.phpt
@@ -9,9 +9,9 @@ $passwd = 'test';
$hash = sodium_crypto_pwhash_scryptsalsa208sha256_str
($passwd, SODIUM_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_OPSLIMIT_INTERACTIVE,
- SODIUM_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_MEMLIMIT_INTERACTIVE);
+ SODIUM_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_MEMLIMIT_INTERACTIVE);
var_dump(substr($hash, 0, 3) ===
- SODIUM_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_STRPREFIX);
+ SODIUM_CRYPTO_PWHASH_SCRYPTSALSA208SHA256_STRPREFIX);
$c = sodium_crypto_pwhash_scryptsalsa208sha256_str_verify($hash, $passwd);
var_dump($c);
diff --git a/ext/sodium/tests/utils.phpt b/ext/sodium/tests/utils.phpt
index 5823ab0b7f..eeca5363e1 100644
--- a/ext/sodium/tests/utils.phpt
+++ b/ext/sodium/tests/utils.phpt
@@ -93,7 +93,7 @@ if (defined('SODIUM_BASE64_VARIANT_ORIGINAL')) {
var_dump('base64("O") case passed');
var_dump('abcd');
}
-
+
function sodium_foo()
{
throw new SodiumException('test');
diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c
index b147a96128..3fd3604072 100644
--- a/ext/spl/php_spl.c
+++ b/ext/spl/php_spl.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -25,6 +23,7 @@
#include "php_main.h"
#include "ext/standard/info.h"
#include "php_spl.h"
+#include "php_spl_arginfo.h"
#include "spl_functions.h"
#include "spl_engine.h"
#include "spl_array.h"
@@ -90,12 +89,12 @@ PHP_FUNCTION(class_parents)
zend_bool autoload = 1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|b", &obj, &autoload) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (Z_TYPE_P(obj) != IS_OBJECT && Z_TYPE_P(obj) != IS_STRING) {
- php_error_docref(NULL, E_WARNING, "object or string expected");
- RETURN_FALSE;
+ zend_type_error("Object or string expected");
+ RETURN_THROWS();
}
if (Z_TYPE_P(obj) == IS_STRING) {
@@ -124,11 +123,11 @@ PHP_FUNCTION(class_implements)
zend_class_entry *ce;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|b", &obj, &autoload) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (Z_TYPE_P(obj) != IS_OBJECT && Z_TYPE_P(obj) != IS_STRING) {
- php_error_docref(NULL, E_WARNING, "object or string expected");
- RETURN_FALSE;
+ zend_type_error("Object or string expected");
+ RETURN_THROWS();
}
if (Z_TYPE_P(obj) == IS_STRING) {
@@ -153,11 +152,11 @@ PHP_FUNCTION(class_uses)
zend_class_entry *ce;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|b", &obj, &autoload) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (Z_TYPE_P(obj) != IS_OBJECT && Z_TYPE_P(obj) != IS_STRING) {
- php_error_docref(NULL, E_WARNING, "object or string expected");
- RETURN_FALSE;
+ zend_type_error("Object or string expected");
+ RETURN_THROWS();
}
if (Z_TYPE_P(obj) == IS_STRING) {
@@ -238,7 +237,7 @@ PHP_FUNCTION(class_uses)
PHP_FUNCTION(spl_classes)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
array_init(return_value);
@@ -306,7 +305,7 @@ static int spl_autoload(zend_string *class_name, zend_string *lc_name, const cha
} /* }}} */
/* {{{ proto void spl_autoload(string class_name [, string file_extensions])
- Default implementation for __autoload() */
+ Default autoloader implementation */
PHP_FUNCTION(spl_autoload)
{
int pos_len, pos1_len;
@@ -314,7 +313,7 @@ PHP_FUNCTION(spl_autoload)
zend_string *class_name, *lc_name, *file_exts = SPL_G(autoload_extensions);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|S", &class_name, &file_exts) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (file_exts == NULL) { /* autoload_extensions is not initialized, set to defaults */
@@ -349,7 +348,7 @@ PHP_FUNCTION(spl_autoload_extensions)
zend_string *file_exts = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|S", &file_exts) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (file_exts) {
if (SPL_G(autoload_extensions)) {
@@ -399,7 +398,7 @@ PHP_FUNCTION(spl_autoload_call)
autoload_func_info *alfi;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &class_name) == FAILURE || Z_TYPE_P(class_name) != IS_STRING) {
- return;
+ RETURN_THROWS();
}
if (SPL_G(autoload_functions)) {
@@ -498,7 +497,7 @@ PHP_FUNCTION(spl_autoload_call)
} while (0)
/* {{{ proto bool spl_autoload_register([mixed autoload_function [, bool throw [, bool prepend]]])
- Register given function as __autoload() implementation */
+ Register given function as autoloader */
PHP_FUNCTION(spl_autoload_register)
{
zend_string *func_name;
@@ -512,12 +511,12 @@ PHP_FUNCTION(spl_autoload_register)
zend_object *obj_ptr;
zend_fcall_info_cache fcc;
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "|zbb", &zcallable, &do_throw, &prepend) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|zbb", &zcallable, &do_throw, &prepend) == FAILURE) {
+ RETURN_THROWS();
}
if (ZEND_NUM_ARGS()) {
- if (!zend_is_callable_ex(zcallable, NULL, IS_CALLABLE_STRICT, &func_name, &fcc, &error)) {
+ if (!zend_is_callable_ex(zcallable, NULL, 0, &func_name, &fcc, &error)) {
alfi.ce = fcc.calling_scope;
alfi.func_ptr = fcc.function_handler;
obj_ptr = fcc.object;
@@ -672,7 +671,7 @@ skip:
} /* }}} */
/* {{{ proto bool spl_autoload_unregister(mixed autoload_function)
- Unregister given function as __autoload() implementation */
+ Unregister given function as autoloader */
PHP_FUNCTION(spl_autoload_unregister)
{
zend_string *func_name = NULL;
@@ -685,7 +684,7 @@ PHP_FUNCTION(spl_autoload_unregister)
zend_fcall_info_cache fcc;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &zcallable) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!zend_is_callable_ex(zcallable, NULL, IS_CALLABLE_CHECK_SYNTAX_ONLY, &func_name, &fcc, &error)) {
@@ -756,25 +755,17 @@ PHP_FUNCTION(spl_autoload_unregister)
} /* }}} */
/* {{{ proto false|array spl_autoload_functions()
- Return all registered __autoload() functionns */
+ Return all registered autoloader functions */
PHP_FUNCTION(spl_autoload_functions)
{
zend_function *fptr;
autoload_func_info *alfi;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!EG(autoload_func)) {
- if ((fptr = zend_hash_find_ptr(EG(function_table), ZSTR_KNOWN(ZEND_STR_MAGIC_AUTOLOAD)))) {
- zval tmp;
-
- array_init(return_value);
- ZVAL_STR_COPY(&tmp, ZSTR_KNOWN(ZEND_STR_MAGIC_AUTOLOAD));
- zend_hash_next_index_insert_new(Z_ARR_P(return_value), &tmp);
- return;
- }
RETURN_FALSE;
}
@@ -821,7 +812,7 @@ PHP_FUNCTION(spl_object_hash)
zval *obj;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &obj) == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_NEW_STR(php_spl_object_hash(obj));
@@ -902,76 +893,6 @@ PHP_MINFO_FUNCTION(spl)
}
/* }}} */
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_iterator_to_array, 0, 0, 1)
- ZEND_ARG_OBJ_INFO(0, iterator, Traversable, 0)
- ZEND_ARG_INFO(0, use_keys)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO(arginfo_iterator, 0)
- ZEND_ARG_OBJ_INFO(0, iterator, Traversable, 0)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_iterator_apply, 0, 0, 2)
- ZEND_ARG_OBJ_INFO(0, iterator, Traversable, 0)
- ZEND_ARG_INFO(0, function)
- ZEND_ARG_ARRAY_INFO(0, args, 1)
-ZEND_END_ARG_INFO();
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_class_parents, 0, 0, 1)
- ZEND_ARG_INFO(0, instance)
- ZEND_ARG_INFO(0, autoload)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_class_implements, 0, 0, 1)
- ZEND_ARG_INFO(0, what)
- ZEND_ARG_INFO(0, autoload)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_class_uses, 0, 0, 1)
- ZEND_ARG_INFO(0, what)
- ZEND_ARG_INFO(0, autoload)
-ZEND_END_ARG_INFO()
-
-
-ZEND_BEGIN_ARG_INFO(arginfo_spl_classes, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_spl_autoload_functions, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_spl_autoload, 0, 0, 1)
- ZEND_ARG_INFO(0, class_name)
- ZEND_ARG_INFO(0, file_extensions)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_spl_autoload_extensions, 0, 0, 0)
- ZEND_ARG_INFO(0, file_extensions)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_spl_autoload_call, 0, 0, 1)
- ZEND_ARG_INFO(0, class_name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_spl_autoload_register, 0, 0, 0)
- ZEND_ARG_INFO(0, autoload_function)
- ZEND_ARG_INFO(0, throw)
- ZEND_ARG_INFO(0, prepend)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_spl_autoload_unregister, 0, 0, 1)
- ZEND_ARG_INFO(0, autoload_function)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_spl_object_hash, 0, 0, 1)
- ZEND_ARG_INFO(0, obj)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_spl_object_id, 0, 0, 1)
- ZEND_ARG_INFO(0, obj)
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ spl_functions
*/
static const zend_function_entry spl_functions[] = {
@@ -988,7 +909,7 @@ static const zend_function_entry spl_functions[] = {
PHP_FE(spl_object_hash, arginfo_spl_object_hash)
PHP_FE(spl_object_id, arginfo_spl_object_id)
PHP_FE(iterator_to_array, arginfo_iterator_to_array)
- PHP_FE(iterator_count, arginfo_iterator)
+ PHP_FE(iterator_count, arginfo_iterator_count)
PHP_FE(iterator_apply, arginfo_iterator_apply)
PHP_FE_END
};
diff --git a/ext/spl/php_spl.h b/ext/spl/php_spl.h
index 69ff65f72c..61fc80ac1d 100644
--- a/ext/spl/php_spl.h
+++ b/ext/spl/php_spl.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/spl/php_spl.stub.php b/ext/spl/php_spl.stub.php
new file mode 100755
index 0000000000..8bf6e79c74
--- /dev/null
+++ b/ext/spl/php_spl.stub.php
@@ -0,0 +1,35 @@
+<?php
+
+/* ext/spl/php_spl.c */
+
+function class_implements($what, bool $autoload = true): array|false {}
+
+function class_parents($instance, bool $autoload = true): array|false {}
+
+function class_uses($what, bool $autoload = true): array|false {}
+
+function spl_autoload(string $class_name, string $file_extensions = UNKNOWN): void {}
+
+// This silently ignores non-string class names
+function spl_autoload_call($class_name): void {}
+
+function spl_autoload_extensions(string $file_extensions = UNKNOWN): string {}
+
+function spl_autoload_functions(): array|false {}
+
+function spl_autoload_register($autoload_function = null, bool $throw = true, bool $prepend = false): bool {}
+
+function spl_autoload_unregister($autoload_function): bool {}
+
+function spl_classes(): array {}
+
+function spl_object_hash(object $obj): string {}
+
+function spl_object_id(object $obj): int {}
+
+/* ext/spl/spl_iterators.c */
+function iterator_apply(Traversable $iterator, callable $function, ?array $args = null): int {}
+
+function iterator_count(Traversable $iterator): int {}
+
+function iterator_to_array(Traversable $iterator, bool $use_keys = true): array {}
diff --git a/ext/spl/php_spl_arginfo.h b/ext/spl/php_spl_arginfo.h
new file mode 100644
index 0000000000..cc60ff97ba
--- /dev/null
+++ b/ext/spl/php_spl_arginfo.h
@@ -0,0 +1,65 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_class_implements, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, what)
+ ZEND_ARG_TYPE_INFO(0, autoload, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_class_parents, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, instance)
+ ZEND_ARG_TYPE_INFO(0, autoload, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_uses arginfo_class_implements
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_spl_autoload, 0, 1, IS_VOID, 0)
+ ZEND_ARG_TYPE_INFO(0, class_name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, file_extensions, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_spl_autoload_call, 0, 1, IS_VOID, 0)
+ ZEND_ARG_INFO(0, class_name)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_spl_autoload_extensions, 0, 0, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, file_extensions, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_spl_autoload_functions, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_spl_autoload_register, 0, 0, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, autoload_function)
+ ZEND_ARG_TYPE_INFO(0, throw, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, prepend, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_spl_autoload_unregister, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, autoload_function)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_spl_classes, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_spl_object_hash, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, obj, IS_OBJECT, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_spl_object_id, 0, 1, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, obj, IS_OBJECT, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_iterator_apply, 0, 2, IS_LONG, 0)
+ ZEND_ARG_OBJ_INFO(0, iterator, Traversable, 0)
+ ZEND_ARG_TYPE_INFO(0, function, IS_CALLABLE, 0)
+ ZEND_ARG_TYPE_INFO(0, args, IS_ARRAY, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_iterator_count, 0, 1, IS_LONG, 0)
+ ZEND_ARG_OBJ_INFO(0, iterator, Traversable, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_iterator_to_array, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_OBJ_INFO(0, iterator, Traversable, 0)
+ ZEND_ARG_TYPE_INFO(0, use_keys, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
index 90861b49c6..bc1713ee84 100644
--- a/ext/spl/spl_array.c
+++ b/ext/spl/spl_array.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -165,7 +163,7 @@ static void spl_array_object_free_storage(zend_object *object)
zend_object_iterator *spl_array_get_iterator(zend_class_entry *ce, zval *object, int by_ref);
/* {{{ spl_array_object_new_ex */
-static zend_object *spl_array_object_new_ex(zend_class_entry *class_type, zval *orig, int clone_orig)
+static zend_object *spl_array_object_new_ex(zend_class_entry *class_type, zend_object *orig, int clone_orig)
{
spl_array_object *intern;
zend_class_entry *parent = class_type;
@@ -179,7 +177,7 @@ static zend_object *spl_array_object_new_ex(zend_class_entry *class_type, zval *
intern->ar_flags = 0;
intern->ce_get_iterator = spl_ce_ArrayIterator;
if (orig) {
- spl_array_object *other = Z_SPLARRAY_P(orig);
+ spl_array_object *other = spl_array_from_obj(orig);
intern->ar_flags &= ~ SPL_ARRAY_CLONE_MASK;
intern->ar_flags |= (other->ar_flags & SPL_ARRAY_CLONE_MASK);
@@ -187,16 +185,18 @@ static zend_object *spl_array_object_new_ex(zend_class_entry *class_type, zval *
if (clone_orig) {
if (other->ar_flags & SPL_ARRAY_IS_SELF) {
ZVAL_UNDEF(&intern->array);
- } else if (Z_OBJ_HT_P(orig) == &spl_handler_ArrayObject) {
+ } else if (orig->handlers == &spl_handler_ArrayObject) {
ZVAL_ARR(&intern->array,
zend_array_dup(spl_array_get_hash_table(other)));
} else {
- ZEND_ASSERT(Z_OBJ_HT_P(orig) == &spl_handler_ArrayIterator);
- ZVAL_COPY(&intern->array, orig);
+ ZEND_ASSERT(orig->handlers == &spl_handler_ArrayIterator);
+ GC_ADDREF(orig);
+ ZVAL_OBJ(&intern->array, orig);
intern->ar_flags |= SPL_ARRAY_USE_OTHER;
}
} else {
- ZVAL_COPY(&intern->array, orig);
+ GC_ADDREF(orig);
+ ZVAL_OBJ(&intern->array, orig);
intern->ar_flags |= SPL_ARRAY_USE_OTHER;
}
} else {
@@ -273,13 +273,11 @@ static zend_object *spl_array_object_new(zend_class_entry *class_type)
/* }}} */
/* {{{ spl_array_object_clone */
-static zend_object *spl_array_object_clone(zval *zobject)
+static zend_object *spl_array_object_clone(zend_object *old_object)
{
- zend_object *old_object;
zend_object *new_object;
- old_object = Z_OBJ_P(zobject);
- new_object = spl_array_object_new_ex(old_object->ce, zobject, 1);
+ new_object = spl_array_object_new_ex(old_object->ce, old_object, 1);
zend_objects_clone_members(new_object, old_object);
@@ -350,7 +348,7 @@ fetch_dim_string:
}
return retval;
case IS_RESOURCE:
- zend_error(E_NOTICE, "Resource ID#%d used as offset, casting to integer (%d)", Z_RES_P(offset)->handle, Z_RES_P(offset)->handle);
+ zend_error(E_WARNING, "Resource ID#%d used as offset, casting to integer (%d)", Z_RES_P(offset)->handle, Z_RES_P(offset)->handle);
index = Z_RES_P(offset)->handle;
goto num_index;
case IS_DOUBLE:
@@ -393,11 +391,11 @@ num_index:
}
} /* }}} */
-static int spl_array_has_dimension(zval *object, zval *offset, int check_empty);
+static int spl_array_has_dimension(zend_object *object, zval *offset, int check_empty);
-static zval *spl_array_read_dimension_ex(int check_inherited, zval *object, zval *offset, int type, zval *rv) /* {{{ */
+static zval *spl_array_read_dimension_ex(int check_inherited, zend_object *object, zval *offset, int type, zval *rv) /* {{{ */
{
- spl_array_object *intern = Z_SPLARRAY_P(object);
+ spl_array_object *intern = spl_array_from_obj(object);
zval *ret;
if (check_inherited &&
@@ -416,7 +414,7 @@ static zval *spl_array_read_dimension_ex(int check_inherited, zval *object, zval
} else {
SEPARATE_ARG_IF_REF(offset);
}
- zend_call_method_with_1_params(object, Z_OBJCE_P(object), &intern->fptr_offset_get, "offsetGet", rv, offset);
+ zend_call_method_with_1_params(object, object->ce, &intern->fptr_offset_get, "offsetGet", rv, offset);
zval_ptr_dtor(offset);
if (!Z_ISUNDEF_P(rv)) {
@@ -442,14 +440,14 @@ static zval *spl_array_read_dimension_ex(int check_inherited, zval *object, zval
return ret;
} /* }}} */
-static zval *spl_array_read_dimension(zval *object, zval *offset, int type, zval *rv) /* {{{ */
+static zval *spl_array_read_dimension(zend_object *object, zval *offset, int type, zval *rv) /* {{{ */
{
return spl_array_read_dimension_ex(1, object, offset, type, rv);
} /* }}} */
-static void spl_array_write_dimension_ex(int check_inherited, zval *object, zval *offset, zval *value) /* {{{ */
+static void spl_array_write_dimension_ex(int check_inherited, zend_object *object, zval *offset, zval *value) /* {{{ */
{
- spl_array_object *intern = Z_SPLARRAY_P(object);
+ spl_array_object *intern = spl_array_from_obj(object);
zend_long index;
HashTable *ht;
@@ -462,7 +460,7 @@ static void spl_array_write_dimension_ex(int check_inherited, zval *object, zval
} else {
SEPARATE_ARG_IF_REF(offset);
}
- zend_call_method_with_2_params(object, Z_OBJCE_P(object), &intern->fptr_offset_set, "offsetSet", NULL, offset, value);
+ zend_call_method_with_2_params(object, object->ce, &intern->fptr_offset_set, "offsetSet", NULL, offset, value);
zval_ptr_dtor(offset);
return;
}
@@ -517,20 +515,20 @@ num_index:
}
} /* }}} */
-static void spl_array_write_dimension(zval *object, zval *offset, zval *value) /* {{{ */
+static void spl_array_write_dimension(zend_object *object, zval *offset, zval *value) /* {{{ */
{
spl_array_write_dimension_ex(1, object, offset, value);
} /* }}} */
-static void spl_array_unset_dimension_ex(int check_inherited, zval *object, zval *offset) /* {{{ */
+static void spl_array_unset_dimension_ex(int check_inherited, zend_object *object, zval *offset) /* {{{ */
{
zend_long index;
HashTable *ht;
- spl_array_object *intern = Z_SPLARRAY_P(object);
+ spl_array_object *intern = spl_array_from_obj(object);
if (check_inherited && intern->fptr_offset_del) {
SEPARATE_ARG_IF_REF(offset);
- zend_call_method_with_1_params(object, Z_OBJCE_P(object), &intern->fptr_offset_del, "offsetUnset", NULL, offset);
+ zend_call_method_with_1_params(object, object->ce, &intern->fptr_offset_del, "offsetUnset", NULL, offset);
zval_ptr_dtor(offset);
return;
}
@@ -602,20 +600,20 @@ num_index:
}
} /* }}} */
-static void spl_array_unset_dimension(zval *object, zval *offset) /* {{{ */
+static void spl_array_unset_dimension(zend_object *object, zval *offset) /* {{{ */
{
spl_array_unset_dimension_ex(1, object, offset);
} /* }}} */
-static int spl_array_has_dimension_ex(int check_inherited, zval *object, zval *offset, int check_empty) /* {{{ */
+static int spl_array_has_dimension_ex(int check_inherited, zend_object *object, zval *offset, int check_empty) /* {{{ */
{
- spl_array_object *intern = Z_SPLARRAY_P(object);
+ spl_array_object *intern = spl_array_from_obj(object);
zend_long index;
zval rv, *value = NULL, *tmp;
if (check_inherited && intern->fptr_offset_has) {
SEPARATE_ARG_IF_REF(offset);
- zend_call_method_with_1_params(object, Z_OBJCE_P(object), &intern->fptr_offset_has, "offsetExists", &rv, offset);
+ zend_call_method_with_1_params(object, object->ce, &intern->fptr_offset_has, "offsetExists", &rv, offset);
zval_ptr_dtor(offset);
if (zend_is_true(&rv)) {
@@ -693,7 +691,7 @@ num_index:
}
} /* }}} */
-static int spl_array_has_dimension(zval *object, zval *offset, int check_empty) /* {{{ */
+static int spl_array_has_dimension(zend_object *object, zval *offset, int check_empty) /* {{{ */
{
return spl_array_has_dimension_ex(1, object, offset, check_empty);
} /* }}} */
@@ -705,9 +703,9 @@ SPL_METHOD(Array, offsetExists)
{
zval *index;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &index) == FAILURE) {
- return;
+ RETURN_THROWS();
}
- RETURN_BOOL(spl_array_has_dimension_ex(0, ZEND_THIS, index, 2));
+ RETURN_BOOL(spl_array_has_dimension_ex(0, Z_OBJ_P(ZEND_THIS), index, 2));
} /* }}} */
/* {{{ proto mixed ArrayObject::offsetGet(mixed $index)
@@ -717,9 +715,9 @@ SPL_METHOD(Array, offsetGet)
{
zval *value, *index;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &index) == FAILURE) {
- return;
+ RETURN_THROWS();
}
- value = spl_array_read_dimension_ex(0, ZEND_THIS, index, BP_VAR_R, return_value);
+ value = spl_array_read_dimension_ex(0, Z_OBJ_P(ZEND_THIS), index, BP_VAR_R, return_value);
if (value != return_value) {
ZVAL_COPY_DEREF(return_value, value);
}
@@ -732,9 +730,9 @@ SPL_METHOD(Array, offsetSet)
{
zval *index, *value;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &index, &value) == FAILURE) {
- return;
+ RETURN_THROWS();
}
- spl_array_write_dimension_ex(0, ZEND_THIS, index, value);
+ spl_array_write_dimension_ex(0, Z_OBJ_P(ZEND_THIS), index, value);
} /* }}} */
void spl_array_iterator_append(zval *object, zval *append_value) /* {{{ */
@@ -746,7 +744,7 @@ void spl_array_iterator_append(zval *object, zval *append_value) /* {{{ */
return;
}
- spl_array_write_dimension(object, NULL, append_value);
+ spl_array_write_dimension(Z_OBJ_P(object), NULL, append_value);
} /* }}} */
/* {{{ proto void ArrayObject::append(mixed $newval)
@@ -757,7 +755,7 @@ SPL_METHOD(Array, append)
zval *value;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &value) == FAILURE) {
- return;
+ RETURN_THROWS();
}
spl_array_iterator_append(ZEND_THIS, value);
} /* }}} */
@@ -769,9 +767,9 @@ SPL_METHOD(Array, offsetUnset)
{
zval *index;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &index) == FAILURE) {
- return;
+ RETURN_THROWS();
}
- spl_array_unset_dimension_ex(0, ZEND_THIS, index);
+ spl_array_unset_dimension_ex(0, Z_OBJ_P(ZEND_THIS), index);
} /* }}} */
/* {{{ proto array ArrayObject::getArrayCopy()
@@ -785,9 +783,9 @@ SPL_METHOD(Array, getArrayCopy)
RETURN_ARR(zend_array_dup(spl_array_get_hash_table(intern)));
} /* }}} */
-static HashTable *spl_array_get_properties_for(zval *object, zend_prop_purpose purpose) /* {{{ */
+static HashTable *spl_array_get_properties_for(zend_object *object, zend_prop_purpose purpose) /* {{{ */
{
- spl_array_object *intern = Z_SPLARRAY_P(object);
+ spl_array_object *intern = spl_array_from_obj(object);
HashTable *ht;
zend_bool dup;
@@ -806,7 +804,6 @@ static HashTable *spl_array_get_properties_for(zval *object, zend_prop_purpose p
break;
case ZEND_PROP_PURPOSE_VAR_EXPORT:
case ZEND_PROP_PURPOSE_JSON:
- case _ZEND_PROP_PURPOSE_ARRAY_KEY_EXISTS:
dup = 0;
break;
default:
@@ -822,12 +819,12 @@ static HashTable *spl_array_get_properties_for(zval *object, zend_prop_purpose p
return ht;
} /* }}} */
-static HashTable* spl_array_get_debug_info(zval *obj, int *is_temp) /* {{{ */
+static HashTable* spl_array_get_debug_info(zend_object *obj, int *is_temp) /* {{{ */
{
zval *storage;
zend_string *zname;
zend_class_entry *base;
- spl_array_object *intern = Z_SPLARRAY_P(obj);
+ spl_array_object *intern = spl_array_from_obj(obj);
if (!intern->std.properties) {
rebuild_object_properties(&intern->std);
@@ -846,7 +843,7 @@ static HashTable* spl_array_get_debug_info(zval *obj, int *is_temp) /* {{{ */
storage = &intern->array;
Z_TRY_ADDREF_P(storage);
- base = Z_OBJ_HT_P(obj) == &spl_handler_ArrayIterator
+ base = obj->handlers == &spl_handler_ArrayIterator
? spl_ce_ArrayIterator : spl_ce_ArrayObject;
zname = spl_gen_private_prop_name(base, "storage", sizeof("storage")-1);
zend_symtable_update(debug_info, zname, storage);
@@ -857,75 +854,85 @@ static HashTable* spl_array_get_debug_info(zval *obj, int *is_temp) /* {{{ */
}
/* }}} */
-static HashTable *spl_array_get_gc(zval *obj, zval **gc_data, int *gc_data_count) /* {{{ */
+static HashTable *spl_array_get_gc(zend_object *obj, zval **gc_data, int *gc_data_count) /* {{{ */
{
- spl_array_object *intern = Z_SPLARRAY_P(obj);
+ spl_array_object *intern = spl_array_from_obj(obj);
*gc_data = &intern->array;
*gc_data_count = 1;
return zend_std_get_properties(obj);
}
/* }}} */
-static zval *spl_array_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) /* {{{ */
+static zval *spl_array_read_property(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv) /* {{{ */
{
- spl_array_object *intern = Z_SPLARRAY_P(object);
+ spl_array_object *intern = spl_array_from_obj(object);
if ((intern->ar_flags & SPL_ARRAY_ARRAY_AS_PROPS) != 0
- && !zend_std_has_property(object, member, ZEND_PROPERTY_EXISTS, NULL)) {
- return spl_array_read_dimension(object, member, type, rv);
+ && !zend_std_has_property(object, name, ZEND_PROPERTY_EXISTS, NULL)) {
+ zval member;
+ ZVAL_STR(&member, name);
+ return spl_array_read_dimension(object, &member, type, rv);
}
- return zend_std_read_property(object, member, type, cache_slot, rv);
+ return zend_std_read_property(object, name, type, cache_slot, rv);
} /* }}} */
-static zval *spl_array_write_property(zval *object, zval *member, zval *value, void **cache_slot) /* {{{ */
+static zval *spl_array_write_property(zend_object *object, zend_string *name, zval *value, void **cache_slot) /* {{{ */
{
- spl_array_object *intern = Z_SPLARRAY_P(object);
+ spl_array_object *intern = spl_array_from_obj(object);
if ((intern->ar_flags & SPL_ARRAY_ARRAY_AS_PROPS) != 0
- && !zend_std_has_property(object, member, ZEND_PROPERTY_EXISTS, NULL)) {
- spl_array_write_dimension(object, member, value);
+ && !zend_std_has_property(object, name, ZEND_PROPERTY_EXISTS, NULL)) {
+ zval member;
+ ZVAL_STR(&member, name);
+ spl_array_write_dimension(object, &member, value);
return value;
}
- return zend_std_write_property(object, member, value, cache_slot);
+ return zend_std_write_property(object, name, value, cache_slot);
} /* }}} */
-static zval *spl_array_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) /* {{{ */
+static zval *spl_array_get_property_ptr_ptr(zend_object *object, zend_string *name, int type, void **cache_slot) /* {{{ */
{
- spl_array_object *intern = Z_SPLARRAY_P(object);
+ spl_array_object *intern = spl_array_from_obj(object);
if ((intern->ar_flags & SPL_ARRAY_ARRAY_AS_PROPS) != 0
- && !zend_std_has_property(object, member, ZEND_PROPERTY_EXISTS, NULL)) {
+ && !zend_std_has_property(object, name, ZEND_PROPERTY_EXISTS, NULL)) {
/* If object has offsetGet() overridden, then fallback to read_property,
* which will call offsetGet(). */
+ zval member;
if (intern->fptr_offset_get) {
return NULL;
}
- return spl_array_get_dimension_ptr(1, intern, member, type);
+ ZVAL_STR(&member, name);
+ return spl_array_get_dimension_ptr(1, intern, &member, type);
}
- return zend_std_get_property_ptr_ptr(object, member, type, cache_slot);
+ return zend_std_get_property_ptr_ptr(object, name, type, cache_slot);
} /* }}} */
-static int spl_array_has_property(zval *object, zval *member, int has_set_exists, void **cache_slot) /* {{{ */
+static int spl_array_has_property(zend_object *object, zend_string *name, int has_set_exists, void **cache_slot) /* {{{ */
{
- spl_array_object *intern = Z_SPLARRAY_P(object);
+ spl_array_object *intern = spl_array_from_obj(object);
if ((intern->ar_flags & SPL_ARRAY_ARRAY_AS_PROPS) != 0
- && !zend_std_has_property(object, member, ZEND_PROPERTY_EXISTS, NULL)) {
- return spl_array_has_dimension(object, member, has_set_exists);
+ && !zend_std_has_property(object, name, ZEND_PROPERTY_EXISTS, NULL)) {
+ zval member;
+ ZVAL_STR(&member, name);
+ return spl_array_has_dimension(object, &member, has_set_exists);
}
- return zend_std_has_property(object, member, has_set_exists, cache_slot);
+ return zend_std_has_property(object, name, has_set_exists, cache_slot);
} /* }}} */
-static void spl_array_unset_property(zval *object, zval *member, void **cache_slot) /* {{{ */
+static void spl_array_unset_property(zend_object *object, zend_string *name, void **cache_slot) /* {{{ */
{
- spl_array_object *intern = Z_SPLARRAY_P(object);
+ spl_array_object *intern = spl_array_from_obj(object);
if ((intern->ar_flags & SPL_ARRAY_ARRAY_AS_PROPS) != 0
- && !zend_std_has_property(object, member, ZEND_PROPERTY_EXISTS, NULL)) {
- spl_array_unset_dimension(object, member);
+ && !zend_std_has_property(object, name, ZEND_PROPERTY_EXISTS, NULL)) {
+ zval member;
+ ZVAL_STR(&member, name);
+ spl_array_unset_dimension(object, &member);
return;
}
- zend_std_unset_property(object, member, cache_slot);
+ zend_std_unset_property(object, name, cache_slot);
} /* }}} */
static int spl_array_compare_objects(zval *o1, zval *o2) /* {{{ */
@@ -936,6 +943,8 @@ static int spl_array_compare_objects(zval *o1, zval *o2) /* {{{ */
*intern2;
int result = 0;
+ ZEND_COMPARE_OBJECTS_FALLBACK(o1, o2);
+
intern1 = Z_SPLARRAY_P(o1);
intern2 = Z_SPLARRAY_P(o2);
ht1 = spl_array_get_hash_table(intern1);
@@ -1187,8 +1196,8 @@ SPL_METHOD(Array, __construct)
return; /* nothing to do */
}
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "z|lC", &array, &ar_flags, &ce_get_iterator) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|lC", &array, &ar_flags, &ce_get_iterator) == FAILURE) {
+ RETURN_THROWS();
}
intern = Z_SPLARRAY_P(object);
@@ -1216,8 +1225,8 @@ SPL_METHOD(ArrayIterator, __construct)
return; /* nothing to do */
}
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "z|l", &array, &ar_flags) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|l", &array, &ar_flags) == FAILURE) {
+ RETURN_THROWS();
}
intern = Z_SPLARRAY_P(object);
@@ -1252,7 +1261,7 @@ SPL_METHOD(Array, getIteratorClass)
spl_array_object *intern = Z_SPLARRAY_P(object);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
zend_string_addref(intern->ce_get_iterator->name);
@@ -1268,7 +1277,7 @@ SPL_METHOD(Array, getFlags)
spl_array_object *intern = Z_SPLARRAY_P(object);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_LONG(intern->ar_flags & ~SPL_ARRAY_INT_MASK);
@@ -1284,7 +1293,7 @@ SPL_METHOD(Array, setFlags)
zend_long ar_flags = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &ar_flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern->ar_flags = (intern->ar_flags & SPL_ARRAY_INT_MASK) | (ar_flags & ~SPL_ARRAY_INT_MASK);
@@ -1299,7 +1308,7 @@ SPL_METHOD(Array, exchangeArray)
spl_array_object *intern = Z_SPLARRAY_P(object);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &array) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (intern->nApplyCount > 0) {
@@ -1320,10 +1329,10 @@ SPL_METHOD(Array, getIterator)
spl_array_object *intern = Z_SPLARRAY_P(object);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
- ZVAL_OBJ(return_value, spl_array_object_new_ex(intern->ce_get_iterator, object, 0));
+ ZVAL_OBJ(return_value, spl_array_object_new_ex(intern->ce_get_iterator, Z_OBJ_P(object), 0));
}
/* }}} */
@@ -1335,7 +1344,7 @@ SPL_METHOD(Array, rewind)
spl_array_object *intern = Z_SPLARRAY_P(object);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
spl_array_rewind(intern);
@@ -1353,7 +1362,7 @@ SPL_METHOD(Array, seek)
int result;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &position) == FAILURE) {
- return;
+ RETURN_THROWS();
}
opos = position;
@@ -1392,9 +1401,9 @@ static zend_long spl_array_object_count_elements_helper(spl_array_object *intern
}
} /* }}} */
-int spl_array_object_count_elements(zval *object, zend_long *count) /* {{{ */
+int spl_array_object_count_elements(zend_object *object, zend_long *count) /* {{{ */
{
- spl_array_object *intern = Z_SPLARRAY_P(object);
+ spl_array_object *intern = spl_array_from_obj(object);
if (intern->fptr_count) {
zval rv;
@@ -1419,7 +1428,7 @@ SPL_METHOD(Array, count)
spl_array_object *intern = Z_SPLARRAY_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_LONG(spl_array_object_count_elements_helper(intern));
@@ -1523,7 +1532,7 @@ SPL_METHOD(Array, current)
HashTable *aht = spl_array_get_hash_table(intern);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((entry = zend_hash_get_current_data_ex(aht, spl_array_get_pos_ptr(aht, intern))) == NULL) {
@@ -1544,7 +1553,7 @@ SPL_METHOD(Array, current)
SPL_METHOD(Array, key)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
spl_array_iterator_key(ZEND_THIS, return_value);
@@ -1568,7 +1577,7 @@ SPL_METHOD(Array, next)
HashTable *aht = spl_array_get_hash_table(intern);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
spl_array_next_ex(intern, aht);
@@ -1584,7 +1593,7 @@ SPL_METHOD(Array, valid)
HashTable *aht = spl_array_get_hash_table(intern);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_BOOL(zend_hash_has_more_elements_ex(aht, spl_array_get_pos_ptr(aht, intern)) == SUCCESS);
@@ -1600,7 +1609,7 @@ SPL_METHOD(Array, hasChildren)
HashTable *aht = spl_array_get_hash_table(intern);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((entry = zend_hash_get_current_data_ex(aht, spl_array_get_pos_ptr(aht, intern))) == NULL) {
@@ -1625,7 +1634,7 @@ SPL_METHOD(Array, getChildren)
HashTable *aht = spl_array_get_hash_table(intern);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((entry = zend_hash_get_current_data_ex(aht, spl_array_get_pos_ptr(aht, intern))) == NULL) {
@@ -1716,7 +1725,7 @@ SPL_METHOD(Array, unserialize)
zend_long flags;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &buf, &buf_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (buf_len == 0) {
@@ -1810,7 +1819,7 @@ SPL_METHOD(Array, unserialize)
outexcept:
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Error at offset " ZEND_LONG_FMT " of %zd bytes", (zend_long)((char*)p - buf), buf_len);
- return;
+ RETURN_THROWS();
} /* }}} */
@@ -1820,8 +1829,8 @@ SPL_METHOD(Array, __serialize)
spl_array_object *intern = Z_SPLARRAY_P(ZEND_THIS);
zval tmp;
- if (zend_parse_parameters_none_throw() == FAILURE) {
- return;
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
}
array_init(return_value);
@@ -1839,7 +1848,7 @@ SPL_METHOD(Array, __serialize)
zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &tmp);
/* members */
- ZVAL_ARR(&tmp, zend_std_get_properties(ZEND_THIS));
+ ZVAL_ARR(&tmp, zend_std_get_properties(&intern->std));
Z_TRY_ADDREF(tmp);
zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &tmp);
}
@@ -1854,8 +1863,8 @@ SPL_METHOD(Array, __unserialize)
zval *flags_zv, *storage_zv, *members_zv;
zend_long flags;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "h", &data) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "h", &data) == FAILURE) {
+ RETURN_THROWS();
}
flags_zv = zend_hash_index_find(data, 0);
@@ -1865,7 +1874,7 @@ SPL_METHOD(Array, __unserialize)
Z_TYPE_P(flags_zv) != IS_LONG || Z_TYPE_P(members_zv) != IS_ARRAY) {
zend_throw_exception(spl_ce_UnexpectedValueException,
"Incomplete or ill-typed serialization data", 0);
- return;
+ RETURN_THROWS();
}
flags = Z_LVAL_P(flags_zv);
@@ -2031,7 +2040,7 @@ PHP_MINIT_FUNCTION(spl_array)
spl_handler_ArrayObject.has_property = spl_array_has_property;
spl_handler_ArrayObject.unset_property = spl_array_unset_property;
- spl_handler_ArrayObject.compare_objects = spl_array_compare_objects;
+ spl_handler_ArrayObject.compare = spl_array_compare_objects;
spl_handler_ArrayObject.dtor_obj = zend_objects_destroy_object;
spl_handler_ArrayObject.free_obj = spl_array_object_free_storage;
diff --git a/ext/spl/spl_array.h b/ext/spl/spl_array.h
index ed5dec3e62..c98a6d02b6 100644
--- a/ext/spl/spl_array.h
+++ b/ext/spl/spl_array.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c
index d7995bd7fa..18b17ea0f2 100644
--- a/ext/spl/spl_directory.c
+++ b/ext/spl/spl_directory.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -217,7 +215,7 @@ static inline void spl_filesystem_object_get_file_name(spl_filesystem_object *in
if (intern->file_name) {
efree(intern->file_name);
}
- /* if there is parent path, ammend it, otherwise just use the given path as is */
+ /* if there is parent path, ammnd it, otherwise just use the given path as is */
if (path_len == 0) {
intern->file_name_len = spprintf(
&intern->file_name, 0, "%s", intern->u.dir.entry.d_name);
@@ -345,15 +343,13 @@ static int spl_filesystem_file_open(spl_filesystem_object *intern, int use_inclu
Open the directory
Clone other members (properties)
*/
-static zend_object *spl_filesystem_object_clone(zval *zobject)
+static zend_object *spl_filesystem_object_clone(zend_object *old_object)
{
- zend_object *old_object;
zend_object *new_object;
spl_filesystem_object *intern;
spl_filesystem_object *source;
int index, skip_dots;
- old_object = Z_OBJ_P(zobject);
source = spl_filesystem_from_obj(old_object);
new_object = spl_filesystem_object_new_ex(old_object->ce);
intern = spl_filesystem_from_obj(new_object);
@@ -464,7 +460,7 @@ static spl_filesystem_object *spl_filesystem_object_create_info(spl_filesystem_o
if (ce->constructor->common.scope != spl_ce_SplFileInfo) {
ZVAL_STRINGL(&arg1, file_path, file_path_len);
- zend_call_method_with_1_params(return_value, ce, &ce->constructor, "__construct", NULL, &arg1);
+ zend_call_method_with_1_params(Z_OBJ_P(return_value), ce, &ce->constructor, "__construct", NULL, &arg1);
zval_ptr_dtor(&arg1);
} else {
spl_filesystem_info_set_filename(intern, file_path, file_path_len, use_copy);
@@ -509,7 +505,7 @@ static spl_filesystem_object *spl_filesystem_object_create_type(int ht, spl_file
spl_filesystem_object_get_file_name(source);
if (ce->constructor->common.scope != spl_ce_SplFileInfo) {
ZVAL_STRINGL(&arg1, source->file_name, source->file_name_len);
- zend_call_method_with_1_params(return_value, ce, &ce->constructor, "__construct", NULL, &arg1);
+ zend_call_method_with_1_params(Z_OBJ_P(return_value), ce, &ce->constructor, "__construct", NULL, &arg1);
zval_ptr_dtor(&arg1);
} else {
intern->file_name = estrndup(source->file_name, source->file_name_len);
@@ -534,7 +530,7 @@ static spl_filesystem_object *spl_filesystem_object_create_type(int ht, spl_file
if (ce->constructor->common.scope != spl_ce_SplFileObject) {
ZVAL_STRINGL(&arg1, source->file_name, source->file_name_len);
ZVAL_STRINGL(&arg2, "r", 1);
- zend_call_method_with_2_params(return_value, ce, &ce->constructor, "__construct", NULL, &arg1, &arg2);
+ zend_call_method_with_2_params(Z_OBJ_P(return_value), ce, &ce->constructor, "__construct", NULL, &arg1, &arg2);
zval_ptr_dtor(&arg1);
zval_ptr_dtor(&arg2);
} else {
@@ -598,9 +594,9 @@ static char *spl_filesystem_object_get_pathname(spl_filesystem_object *intern, s
}
/* }}} */
-static HashTable *spl_filesystem_object_get_debug_info(zval *object, int *is_temp) /* {{{ */
+static HashTable *spl_filesystem_object_get_debug_info(zend_object *object, int *is_temp) /* {{{ */
{
- spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(object);
+ spl_filesystem_object *intern = spl_filesystem_from_obj(object);
zval tmp;
HashTable *rv;
zend_string *pnstr;
@@ -770,7 +766,7 @@ SPL_METHOD(DirectoryIterator, rewind)
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern->u.dir.index = 0;
@@ -788,7 +784,7 @@ SPL_METHOD(DirectoryIterator, key)
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (intern->u.dir.dirp) {
@@ -804,7 +800,7 @@ SPL_METHOD(DirectoryIterator, key)
SPL_METHOD(DirectoryIterator, current)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
ZVAL_OBJ(return_value, Z_OBJ_P(ZEND_THIS));
Z_ADDREF_P(return_value);
@@ -819,7 +815,7 @@ SPL_METHOD(DirectoryIterator, next)
int skip_dots = SPL_HAS_FLAG(intern->flags, SPL_FILE_DIR_SKIPDOTS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern->u.dir.index++;
@@ -842,24 +838,24 @@ SPL_METHOD(DirectoryIterator, seek)
zend_long pos;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &pos) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (intern->u.dir.index > pos) {
/* we first rewind */
- zend_call_method_with_0_params(ZEND_THIS, Z_OBJCE_P(ZEND_THIS), &intern->u.dir.func_rewind, "rewind", NULL);
+ zend_call_method_with_0_params(Z_OBJ_P(ZEND_THIS), Z_OBJCE_P(ZEND_THIS), &intern->u.dir.func_rewind, "rewind", NULL);
}
while (intern->u.dir.index < pos) {
int valid = 0;
- zend_call_method_with_0_params(ZEND_THIS, Z_OBJCE_P(ZEND_THIS), &intern->u.dir.func_valid, "valid", &retval);
+ zend_call_method_with_0_params(Z_OBJ_P(ZEND_THIS), Z_OBJCE_P(ZEND_THIS), &intern->u.dir.func_valid, "valid", &retval);
valid = zend_is_true(&retval);
zval_ptr_dtor(&retval);
if (!valid) {
zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0, "Seek position " ZEND_LONG_FMT " is out of range", pos);
- return;
+ RETURN_THROWS();
}
- zend_call_method_with_0_params(ZEND_THIS, Z_OBJCE_P(ZEND_THIS), &intern->u.dir.func_next, "next", NULL);
+ zend_call_method_with_0_params(Z_OBJ_P(ZEND_THIS), Z_OBJCE_P(ZEND_THIS), &intern->u.dir.func_next, "next", NULL);
}
} /* }}} */
@@ -870,7 +866,7 @@ SPL_METHOD(DirectoryIterator, valid)
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_BOOL(intern->u.dir.entry.d_name[0] != '\0');
@@ -886,7 +882,7 @@ SPL_METHOD(SplFileInfo, getPath)
size_t path_len;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
path = spl_filesystem_object_get_path(intern, &path_len);
@@ -906,7 +902,7 @@ SPL_METHOD(SplFileInfo, getFilename)
size_t path_len;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
spl_filesystem_object_get_path(intern, &path_len);
@@ -926,7 +922,7 @@ SPL_METHOD(DirectoryIterator, getFilename)
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_STRING(intern->u.dir.entry.d_name);
@@ -946,7 +942,7 @@ SPL_METHOD(SplFileInfo, getExtension)
zend_string *ret;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
spl_filesystem_object_get_path(intern, &path_len);
@@ -984,7 +980,7 @@ SPL_METHOD(DirectoryIterator, getExtension)
zend_string *fname;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
fname = php_basename(intern->u.dir.entry.d_name, strlen(intern->u.dir.entry.d_name), NULL, 0);
@@ -1011,7 +1007,7 @@ SPL_METHOD(SplFileInfo, getBasename)
size_t slen = 0, path_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &suffix, &slen) == FAILURE) {
- return;
+ RETURN_THROWS();
}
spl_filesystem_object_get_path(intern, &path_len);
@@ -1038,7 +1034,7 @@ SPL_METHOD(DirectoryIterator, getBasename)
zend_string *fname;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &suffix, &slen) == FAILURE) {
- return;
+ RETURN_THROWS();
}
fname = php_basename(intern->u.dir.entry.d_name, strlen(intern->u.dir.entry.d_name), suffix, slen);
@@ -1056,7 +1052,7 @@ SPL_METHOD(SplFileInfo, getPathname)
size_t path_len;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
path = spl_filesystem_object_get_pathname(intern, &path_len);
if (path != NULL) {
@@ -1074,7 +1070,7 @@ SPL_METHOD(FilesystemIterator, key)
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (SPL_FILE_DIR_KEY(intern, SPL_FILE_DIR_KEY_AS_FILENAME)) {
@@ -1093,7 +1089,7 @@ SPL_METHOD(FilesystemIterator, current)
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (SPL_FILE_DIR_CURRENT(intern, SPL_FILE_DIR_CURRENT_AS_PATHNAME)) {
@@ -1117,7 +1113,7 @@ SPL_METHOD(DirectoryIterator, isDot)
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_BOOL(spl_filesystem_is_dot(intern->u.dir.entry.d_name));
@@ -1135,8 +1131,8 @@ SPL_METHOD(SplFileInfo, __construct)
char *path;
size_t len;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "p", &path, &len) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &path, &len) == FAILURE) {
+ RETURN_THROWS();
}
intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
@@ -1154,7 +1150,7 @@ SPL_METHOD(SplFileInfo, func_name) \
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS); \
zend_error_handling error_handling; \
if (zend_parse_parameters_none() == FAILURE) { \
- return; \
+ RETURN_THROWS(); \
} \
\
zend_replace_error_handling(EH_THROW, spl_ce_RuntimeException, &error_handling);\
@@ -1249,7 +1245,7 @@ SPL_METHOD(SplFileInfo, getLinkTarget)
zend_error_handling error_handling;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
zend_replace_error_handling(EH_THROW, spl_ce_RuntimeException, &error_handling);
@@ -1300,7 +1296,7 @@ SPL_METHOD(SplFileInfo, getRealPath)
zend_error_handling error_handling;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
zend_replace_error_handling(EH_THROW, spl_ce_RuntimeException, &error_handling);
@@ -1348,15 +1344,12 @@ SPL_METHOD(SplFileInfo, setFileClass)
{
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
zend_class_entry *ce = spl_ce_SplFileObject;
- zend_error_handling error_handling;
- zend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, &error_handling);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|C", &ce) == SUCCESS) {
- intern->file_class = ce;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|C", &ce) == FAILURE) {
+ RETURN_THROWS();
}
- zend_restore_error_handling(&error_handling);
+ intern->file_class = ce;
}
/* }}} */
@@ -1366,15 +1359,12 @@ SPL_METHOD(SplFileInfo, setInfoClass)
{
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
zend_class_entry *ce = spl_ce_SplFileInfo;
- zend_error_handling error_handling;
- zend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, &error_handling );
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|C", &ce) == SUCCESS) {
- intern->info_class = ce;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|C", &ce) == FAILURE) {
+ RETURN_THROWS();
}
- zend_restore_error_handling(&error_handling);
+ intern->info_class = ce;
}
/* }}} */
@@ -1384,15 +1374,12 @@ SPL_METHOD(SplFileInfo, getFileInfo)
{
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
zend_class_entry *ce = intern->info_class;
- zend_error_handling error_handling;
- zend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, &error_handling);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|C", &ce) == SUCCESS) {
- spl_filesystem_object_create_type(ZEND_NUM_ARGS(), intern, SPL_FS_INFO, ce, return_value);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|C", &ce) == FAILURE) {
+ RETURN_THROWS();
}
- zend_restore_error_handling(&error_handling);
+ spl_filesystem_object_create_type(ZEND_NUM_ARGS(), intern, SPL_FS_INFO, ce, return_value);
}
/* }}} */
@@ -1402,22 +1389,20 @@ SPL_METHOD(SplFileInfo, getPathInfo)
{
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
zend_class_entry *ce = intern->info_class;
- zend_error_handling error_handling;
-
- zend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, &error_handling);
+ size_t path_len;
+ char *path;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|C", &ce) == SUCCESS) {
- size_t path_len;
- char *path = spl_filesystem_object_get_pathname(intern, &path_len);
- if (path) {
- char *dpath = estrndup(path, path_len);
- path_len = php_dirname(dpath, path_len);
- spl_filesystem_object_create_info(intern, dpath, path_len, 1, ce, return_value);
- efree(dpath);
- }
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|C", &ce) == FAILURE) {
+ RETURN_THROWS();
}
- zend_restore_error_handling(&error_handling);
+ path = spl_filesystem_object_get_pathname(intern, &path_len);
+ if (path) {
+ char *dpath = estrndup(path, path_len);
+ path_len = php_dirname(dpath, path_len);
+ spl_filesystem_object_create_info(intern, dpath, path_len, 1, ce, return_value);
+ efree(dpath);
+ }
}
/* }}} */
@@ -1446,7 +1431,7 @@ SPL_METHOD(FilesystemIterator, rewind)
int skip_dots = SPL_HAS_FLAG(intern->flags, SPL_FILE_DIR_SKIPDOTS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern->u.dir.index = 0;
@@ -1466,7 +1451,7 @@ SPL_METHOD(FilesystemIterator, getFlags)
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_LONG(intern->flags & (SPL_FILE_DIR_KEY_MODE_MASK | SPL_FILE_DIR_CURRENT_MODE_MASK | SPL_FILE_DIR_OTHERS_MASK));
@@ -1480,7 +1465,7 @@ SPL_METHOD(FilesystemIterator, setFlags)
zend_long flags;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern->flags &= ~(SPL_FILE_DIR_KEY_MODE_MASK|SPL_FILE_DIR_CURRENT_MODE_MASK|SPL_FILE_DIR_OTHERS_MASK);
@@ -1495,7 +1480,7 @@ SPL_METHOD(RecursiveDirectoryIterator, hasChildren)
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &allow_links) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (spl_filesystem_is_invalid_or_dot(intern->u.dir.entry.d_name)) {
RETURN_FALSE;
@@ -1522,7 +1507,7 @@ SPL_METHOD(RecursiveDirectoryIterator, getChildren)
char slash = SPL_HAS_FLAG(intern->flags, SPL_FILE_DIR_UNIXPATHS) ? '/' : DEFAULT_SLASH;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
spl_filesystem_object_get_file_name(intern);
@@ -1554,7 +1539,7 @@ SPL_METHOD(RecursiveDirectoryIterator, getSubPath)
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (intern->u.dir.sub_path) {
@@ -1573,7 +1558,7 @@ SPL_METHOD(RecursiveDirectoryIterator, getSubPathname)
char slash = SPL_HAS_FLAG(intern->flags, SPL_FILE_DIR_UNIXPATHS) ? '/' : DEFAULT_SLASH;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (intern->u.dir.sub_path) {
@@ -1608,7 +1593,7 @@ SPL_METHOD(GlobIterator, count)
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (intern->u.dir.dirp && php_stream_is(intern->u.dir.dirp ,&php_glob_stream_ops)) {
@@ -1864,12 +1849,12 @@ zend_object_iterator *spl_filesystem_tree_get_iterator(zend_class_entry *ce, zva
/* }}} */
/* {{{ spl_filesystem_object_cast */
-static int spl_filesystem_object_cast(zval *readobj, zval *writeobj, int type)
+static int spl_filesystem_object_cast(zend_object *readobj, zval *writeobj, int type)
{
- spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(readobj);
+ spl_filesystem_object *intern = spl_filesystem_from_obj(readobj);
if (type == IS_STRING) {
- if (Z_OBJCE_P(readobj)->__tostring) {
+ if (readobj->ce->__tostring) {
return zend_std_cast_object_tostring(readobj, writeobj, type);
}
@@ -2068,7 +2053,7 @@ static int spl_filesystem_file_call(spl_filesystem_object *intern, zend_function
{
zend_fcall_info fci;
zend_fcall_info_cache fcic;
- zval *zresource_ptr = &intern->u.file.zresource, retval;
+ zval *zresource_ptr = &intern->u.file.zresource;
int result;
int num_args = pass_num_args + (arg2 ? 2 : 1);
@@ -2085,11 +2070,9 @@ static int spl_filesystem_file_call(spl_filesystem_object *intern, zend_function
WRONG_PARAM_COUNT_WITH_RETVAL(FAILURE);
}
- ZVAL_UNDEF(&retval);
-
fci.size = sizeof(fci);
fci.object = NULL;
- fci.retval = &retval;
+ fci.retval = return_value;
fci.param_count = num_args;
fci.params = params;
fci.no_separation = 1;
@@ -2101,10 +2084,8 @@ static int spl_filesystem_file_call(spl_filesystem_object *intern, zend_function
result = zend_call_function(&fci, &fcic);
- if (result == FAILURE || Z_ISUNDEF(retval)) {
+ if (result == FAILURE || Z_ISUNDEF_P(return_value)) {
RETVAL_FALSE;
- } else {
- ZVAL_ZVAL(return_value, &retval, 0, 0);
}
efree(params);
@@ -2166,7 +2147,7 @@ static int spl_filesystem_file_read_line_ex(zval * this_ptr, spl_filesystem_obje
return spl_filesystem_file_read_csv(intern, intern->u.file.delimiter, intern->u.file.enclosure, intern->u.file.escape, NULL);
} else {
zend_execute_data *execute_data = EG(current_execute_data);
- zend_call_method_with_0_params(this_ptr, Z_OBJCE_P(ZEND_THIS), &intern->u.file.func_getCurr, "getCurrentLine", &retval);
+ zend_call_method_with_0_params(Z_OBJ_P(this_ptr), Z_OBJCE_P(ZEND_THIS), &intern->u.file.func_getCurr, "getCurrentLine", &retval);
}
if (!Z_ISUNDEF(retval)) {
if (intern->u.file.current_line || !Z_ISUNDEF(intern->u.file.current_zval)) {
@@ -2267,13 +2248,13 @@ SPL_METHOD(SplFileObject, __construct)
intern->u.file.open_mode = NULL;
intern->u.file.open_mode_len = 0;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "p|sbr!",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|sbr!",
&intern->file_name, &intern->file_name_len,
&intern->u.file.open_mode, &intern->u.file.open_mode_len,
&use_include_path, &intern->u.file.zcontext) == FAILURE) {
intern->u.file.open_mode = NULL;
intern->file_name = NULL;
- return;
+ RETURN_THROWS();
}
if (intern->u.file.open_mode == NULL) {
@@ -2322,8 +2303,8 @@ SPL_METHOD(SplTempFileObject, __construct)
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
zend_error_handling error_handling;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "|l", &max_memory) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &max_memory) == FAILURE) {
+ RETURN_THROWS();
}
if (max_memory < 0) {
@@ -2354,7 +2335,7 @@ SPL_METHOD(SplFileObject, rewind)
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
spl_filesystem_file_rewind(ZEND_THIS, intern);
@@ -2367,12 +2348,12 @@ SPL_METHOD(SplFileObject, eof)
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if(!intern->u.file.stream) {
zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Object not initialized");
- return;
+ RETURN_THROWS();
}
RETURN_BOOL(php_stream_eof(intern->u.file.stream));
@@ -2385,7 +2366,7 @@ SPL_METHOD(SplFileObject, valid)
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (SPL_HAS_FLAG(intern->flags, SPL_FILE_OBJECT_READ_AHEAD)) {
@@ -2405,12 +2386,12 @@ SPL_METHOD(SplFileObject, fgets)
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if(!intern->u.file.stream) {
zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Object not initialized");
- return;
+ RETURN_THROWS();
}
if (spl_filesystem_file_read(intern, 0) == FAILURE) {
@@ -2426,12 +2407,12 @@ SPL_METHOD(SplFileObject, current)
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if(!intern->u.file.stream) {
zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Object not initialized");
- return;
+ RETURN_THROWS();
}
if (!intern->u.file.current_line && Z_ISUNDEF(intern->u.file.current_zval)) {
@@ -2455,7 +2436,7 @@ SPL_METHOD(SplFileObject, key)
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
/* Do not read the next line to support correct counting with fgetc()
@@ -2472,7 +2453,7 @@ SPL_METHOD(SplFileObject, next)
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
spl_filesystem_file_free_line(intern);
@@ -2489,7 +2470,7 @@ SPL_METHOD(SplFileObject, setFlags)
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &intern->flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
} /* }}} */
@@ -2500,7 +2481,7 @@ SPL_METHOD(SplFileObject, getFlags)
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_LONG(intern->flags & SPL_FILE_OBJECT_MASK);
@@ -2515,12 +2496,12 @@ SPL_METHOD(SplFileObject, setMaxLineLen)
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &max_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (max_len < 0) {
zend_throw_exception_ex(spl_ce_DomainException, 0, "Maximum line length must be greater than or equal zero");
- return;
+ RETURN_THROWS();
}
intern->u.file.max_line_len = max_len;
@@ -2533,7 +2514,7 @@ SPL_METHOD(SplFileObject, getMaxLineLen)
spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_LONG((zend_long)intern->u.file.max_line_len);
@@ -2544,7 +2525,7 @@ SPL_METHOD(SplFileObject, getMaxLineLen)
SPL_METHOD(SplFileObject, hasChildren)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_FALSE;
@@ -2555,7 +2536,7 @@ SPL_METHOD(SplFileObject, hasChildren)
SPL_METHOD(SplFileObject, getChildren)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
/* return NULL */
} /* }}} */
@@ -2583,7 +2564,7 @@ SPL_METHOD(SplFileObject, fgetcsv)
if(!intern->u.file.stream) {
zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Object not initialized");
- return;
+ RETURN_THROWS();
}
switch(ZEND_NUM_ARGS())
@@ -2765,7 +2746,7 @@ SPL_METHOD(SplFileObject, fflush)
if(!intern->u.file.stream) {
zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Object not initialized");
- return;
+ RETURN_THROWS();
}
RETURN_BOOL(!php_stream_flush(intern->u.file.stream));
@@ -2780,7 +2761,7 @@ SPL_METHOD(SplFileObject, ftell)
if(!intern->u.file.stream) {
zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Object not initialized");
- return;
+ RETURN_THROWS();
}
ret = php_stream_tell(intern->u.file.stream);
@@ -2800,12 +2781,12 @@ SPL_METHOD(SplFileObject, fseek)
zend_long pos, whence = SEEK_SET;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l", &pos, &whence) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if(!intern->u.file.stream) {
zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Object not initialized");
- return;
+ RETURN_THROWS();
}
spl_filesystem_file_free_line(intern);
@@ -2822,7 +2803,7 @@ SPL_METHOD(SplFileObject, fgetc)
if(!intern->u.file.stream) {
zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Object not initialized");
- return;
+ RETURN_THROWS();
}
spl_filesystem_file_free_line(intern);
@@ -2842,30 +2823,6 @@ SPL_METHOD(SplFileObject, fgetc)
}
} /* }}} */
-/* {{{ proto string SplFileObject::fgetss([string allowable_tags])
- Get a line from file pointer and strip HTML tags */
-SPL_METHOD(SplFileObject, fgetss)
-{
- spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(ZEND_THIS);
- zval arg2;
-
- if(!intern->u.file.stream) {
- zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Object not initialized");
- return;
- }
-
- if (intern->u.file.max_line_len > 0) {
- ZVAL_LONG(&arg2, intern->u.file.max_line_len);
- } else {
- ZVAL_LONG(&arg2, 1024);
- }
-
- spl_filesystem_file_free_line(intern);
- intern->u.file.current_line_num++;
-
- FileFunctionCall(fgetss, ZEND_NUM_ARGS(), &arg2);
-} /* }}} */
-
/* {{{ proto int SplFileObject::fpassthru()
Output all remaining data from a file pointer */
SPL_METHOD(SplFileObject, fpassthru)
@@ -2874,7 +2831,7 @@ SPL_METHOD(SplFileObject, fpassthru)
if(!intern->u.file.stream) {
zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Object not initialized");
- return;
+ RETURN_THROWS();
}
RETURN_LONG(php_stream_passthru(intern->u.file.stream));
@@ -2888,7 +2845,7 @@ SPL_METHOD(SplFileObject, fscanf)
if(!intern->u.file.stream) {
zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Object not initialized");
- return;
+ RETURN_THROWS();
}
spl_filesystem_file_free_line(intern);
@@ -2909,12 +2866,12 @@ SPL_METHOD(SplFileObject, fwrite)
ssize_t written;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &str, &str_len, &length) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if(!intern->u.file.stream) {
zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Object not initialized");
- return;
+ RETURN_THROWS();
}
if (ZEND_NUM_ARGS() > 1) {
@@ -2943,12 +2900,12 @@ SPL_METHOD(SplFileObject, fread)
zend_string *str;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &length) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if(!intern->u.file.stream) {
zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Object not initialized");
- return;
+ RETURN_THROWS();
}
if (length <= 0) {
@@ -2976,17 +2933,17 @@ SPL_METHOD(SplFileObject, ftruncate)
zend_long size;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &size) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if(!intern->u.file.stream) {
zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Object not initialized");
- return;
+ RETURN_THROWS();
}
if (!php_stream_truncate_supported(intern->u.file.stream)) {
zend_throw_exception_ex(spl_ce_LogicException, 0, "Can't truncate file %s", intern->file_name);
- RETURN_FALSE;
+ RETURN_THROWS();
}
RETURN_BOOL(0 == php_stream_truncate_set_size(intern->u.file.stream, size));
@@ -3000,16 +2957,16 @@ SPL_METHOD(SplFileObject, seek)
zend_long line_pos;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &line_pos) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if(!intern->u.file.stream) {
zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Object not initialized");
- return;
+ RETURN_THROWS();
}
if (line_pos < 0) {
zend_throw_exception_ex(spl_ce_LogicException, 0, "Can't seek file %s to negative line " ZEND_LONG_FMT, intern->file_name, line_pos);
- RETURN_FALSE;
+ RETURN_THROWS();
}
spl_filesystem_file_rewind(ZEND_THIS, intern);
@@ -3060,10 +3017,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fseek, 0, 0, 1)
ZEND_ARG_INFO(0, whence)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fgetss, 0, 0, 0)
- ZEND_ARG_INFO(0, allowable_tags)
-ZEND_END_ARG_INFO()
-
ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fscanf, 0, 0, 1)
ZEND_ARG_INFO(0, format)
ZEND_ARG_VARIADIC_INFO(1, vars)
@@ -3102,7 +3055,6 @@ static const zend_function_entry spl_SplFileObject_functions[] = {
SPL_ME(SplFileObject, fseek, arginfo_file_object_fseek, ZEND_ACC_PUBLIC)
SPL_ME(SplFileObject, fgetc, arginfo_splfileinfo_void, ZEND_ACC_PUBLIC)
SPL_ME(SplFileObject, fpassthru, arginfo_splfileinfo_void, ZEND_ACC_PUBLIC)
- SPL_ME(SplFileObject, fgetss, arginfo_file_object_fgetss, ZEND_ACC_PUBLIC)
SPL_ME(SplFileObject, fscanf, arginfo_file_object_fscanf, ZEND_ACC_PUBLIC)
SPL_ME(SplFileObject, fwrite, arginfo_file_object_fwrite, ZEND_ACC_PUBLIC)
SPL_ME(SplFileObject, fread, arginfo_file_object_fread, ZEND_ACC_PUBLIC)
diff --git a/ext/spl/spl_directory.h b/ext/spl/spl_directory.h
index 90e8945a16..88fbd0f052 100644
--- a/ext/spl/spl_directory.h
+++ b/ext/spl/spl_directory.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c
index 168034906a..bed5f6a336 100644
--- a/ext/spl/spl_dllist.c
+++ b/ext/spl/spl_dllist.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -367,7 +365,7 @@ static void spl_dllist_object_free_storage(zend_object *object) /* {{{ */
zend_object_iterator *spl_dllist_get_iterator(zend_class_entry *ce, zval *object, int by_ref);
-static zend_object *spl_dllist_object_new_ex(zend_class_entry *class_type, zval *orig, int clone_orig) /* {{{ */
+static zend_object *spl_dllist_object_new_ex(zend_class_entry *class_type, zend_object *orig, int clone_orig) /* {{{ */
{
spl_dllist_object *intern;
zend_class_entry *parent = class_type;
@@ -382,7 +380,7 @@ static zend_object *spl_dllist_object_new_ex(zend_class_entry *class_type, zval
intern->traverse_position = 0;
if (orig) {
- spl_dllist_object *other = Z_SPLDLLIST_P(orig);
+ spl_dllist_object *other = spl_dllist_from_obj(orig);
intern->ce_get_iterator = other->ce_get_iterator;
if (clone_orig) {
@@ -457,13 +455,9 @@ static zend_object *spl_dllist_object_new(zend_class_entry *class_type) /* {{{ *
}
/* }}} */
-static zend_object *spl_dllist_object_clone(zval *zobject) /* {{{ */
+static zend_object *spl_dllist_object_clone(zend_object *old_object) /* {{{ */
{
- zend_object *old_object;
- zend_object *new_object;
-
- old_object = Z_OBJ_P(zobject);
- new_object = spl_dllist_object_new_ex(old_object->ce, zobject, 1);
+ zend_object *new_object = spl_dllist_object_new_ex(old_object->ce, old_object, 1);
zend_objects_clone_members(new_object, old_object);
@@ -471,9 +465,9 @@ static zend_object *spl_dllist_object_clone(zval *zobject) /* {{{ */
}
/* }}} */
-static int spl_dllist_object_count_elements(zval *object, zend_long *count) /* {{{ */
+static int spl_dllist_object_count_elements(zend_object *object, zend_long *count) /* {{{ */
{
- spl_dllist_object *intern = Z_SPLDLLIST_P(object);
+ spl_dllist_object *intern = spl_dllist_from_obj(object);
if (intern->fptr_count) {
zval rv;
@@ -492,9 +486,9 @@ static int spl_dllist_object_count_elements(zval *object, zend_long *count) /* {
}
/* }}} */
-static HashTable* spl_dllist_object_get_debug_info(zval *obj, int *is_temp) /* {{{{ */
+static HashTable* spl_dllist_object_get_debug_info(zend_object *obj, int *is_temp) /* {{{{ */
{
- spl_dllist_object *intern = Z_SPLDLLIST_P(obj);
+ spl_dllist_object *intern = spl_dllist_from_obj(obj);
spl_ptr_llist_element *current = intern->llist->head, *next;
zval tmp, dllist_array;
zend_string *pnstr;
@@ -536,9 +530,9 @@ static HashTable* spl_dllist_object_get_debug_info(zval *obj, int *is_temp) /* {
}
/* }}}} */
-static HashTable *spl_dllist_object_get_gc(zval *obj, zval **gc_data, int *gc_data_count) /* {{{ */
+static HashTable *spl_dllist_object_get_gc(zend_object *obj, zval **gc_data, int *gc_data_count) /* {{{ */
{
- spl_dllist_object *intern = Z_SPLDLLIST_P(obj);
+ spl_dllist_object *intern = spl_dllist_from_obj(obj);
spl_ptr_llist_element *current = intern->llist->head;
int i = 0;
@@ -566,7 +560,7 @@ SPL_METHOD(SplDoublyLinkedList, push)
spl_dllist_object *intern;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &value) == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern = Z_SPLDLLIST_P(ZEND_THIS);
@@ -584,7 +578,7 @@ SPL_METHOD(SplDoublyLinkedList, unshift)
spl_dllist_object *intern;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &value) == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern = Z_SPLDLLIST_P(ZEND_THIS);
@@ -601,7 +595,7 @@ SPL_METHOD(SplDoublyLinkedList, pop)
spl_dllist_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern = Z_SPLDLLIST_P(ZEND_THIS);
@@ -609,7 +603,7 @@ SPL_METHOD(SplDoublyLinkedList, pop)
if (Z_ISUNDEF_P(return_value)) {
zend_throw_exception(spl_ce_RuntimeException, "Can't pop from an empty datastructure", 0);
- RETURN_NULL();
+ RETURN_THROWS();
}
}
/* }}} */
@@ -621,7 +615,7 @@ SPL_METHOD(SplDoublyLinkedList, shift)
spl_dllist_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern = Z_SPLDLLIST_P(ZEND_THIS);
@@ -629,7 +623,7 @@ SPL_METHOD(SplDoublyLinkedList, shift)
if (Z_ISUNDEF_P(return_value)) {
zend_throw_exception(spl_ce_RuntimeException, "Can't shift from an empty datastructure", 0);
- RETURN_NULL();
+ RETURN_THROWS();
}
}
/* }}} */
@@ -642,7 +636,7 @@ SPL_METHOD(SplDoublyLinkedList, top)
spl_dllist_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern = Z_SPLDLLIST_P(ZEND_THIS);
@@ -650,7 +644,7 @@ SPL_METHOD(SplDoublyLinkedList, top)
if (value == NULL || Z_ISUNDEF_P(value)) {
zend_throw_exception(spl_ce_RuntimeException, "Can't peek at an empty datastructure", 0);
- return;
+ RETURN_THROWS();
}
ZVAL_COPY_DEREF(return_value, value);
@@ -665,7 +659,7 @@ SPL_METHOD(SplDoublyLinkedList, bottom)
spl_dllist_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern = Z_SPLDLLIST_P(ZEND_THIS);
@@ -673,7 +667,7 @@ SPL_METHOD(SplDoublyLinkedList, bottom)
if (value == NULL || Z_ISUNDEF_P(value)) {
zend_throw_exception(spl_ce_RuntimeException, "Can't peek at an empty datastructure", 0);
- return;
+ RETURN_THROWS();
}
ZVAL_COPY_DEREF(return_value, value);
@@ -688,7 +682,7 @@ SPL_METHOD(SplDoublyLinkedList, count)
spl_dllist_object *intern = Z_SPLDLLIST_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
count = spl_ptr_llist_count(intern->llist);
@@ -703,10 +697,10 @@ SPL_METHOD(SplDoublyLinkedList, isEmpty)
zend_long count;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
- spl_dllist_object_count_elements(ZEND_THIS, &count);
+ spl_dllist_object_count_elements(Z_OBJ_P(ZEND_THIS), &count);
RETURN_BOOL(count == 0);
}
/* }}} */
@@ -719,7 +713,7 @@ SPL_METHOD(SplDoublyLinkedList, setIteratorMode)
spl_dllist_object *intern;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &value) == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern = Z_SPLDLLIST_P(ZEND_THIS);
@@ -727,7 +721,7 @@ SPL_METHOD(SplDoublyLinkedList, setIteratorMode)
if (intern->flags & SPL_DLLIST_IT_FIX
&& (intern->flags & SPL_DLLIST_IT_LIFO) != (value & SPL_DLLIST_IT_LIFO)) {
zend_throw_exception(spl_ce_RuntimeException, "Iterators' LIFO/FIFO modes for SplStack/SplQueue objects are frozen", 0);
- return;
+ RETURN_THROWS();
}
intern->flags = (value & SPL_DLLIST_IT_MASK) | (intern->flags & SPL_DLLIST_IT_FIX);
@@ -743,7 +737,7 @@ SPL_METHOD(SplDoublyLinkedList, getIteratorMode)
spl_dllist_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern = Z_SPLDLLIST_P(ZEND_THIS);
@@ -761,7 +755,7 @@ SPL_METHOD(SplDoublyLinkedList, offsetExists)
zend_long index;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &zindex) == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern = Z_SPLDLLIST_P(ZEND_THIS);
@@ -780,7 +774,7 @@ SPL_METHOD(SplDoublyLinkedList, offsetGet)
spl_ptr_llist_element *element;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &zindex) == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern = Z_SPLDLLIST_P(ZEND_THIS);
@@ -788,7 +782,7 @@ SPL_METHOD(SplDoublyLinkedList, offsetGet)
if (index < 0 || index >= intern->llist->count) {
zend_throw_exception(spl_ce_OutOfRangeException, "Offset invalid or out of range", 0);
- return;
+ RETURN_THROWS();
}
element = spl_ptr_llist_offset(intern->llist, index, intern->flags & SPL_DLLIST_IT_LIFO);
@@ -810,7 +804,7 @@ SPL_METHOD(SplDoublyLinkedList, offsetSet)
spl_dllist_object *intern;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &zindex, &value) == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern = Z_SPLDLLIST_P(ZEND_THIS);
@@ -827,7 +821,7 @@ SPL_METHOD(SplDoublyLinkedList, offsetSet)
if (index < 0 || index >= intern->llist->count) {
zend_throw_exception(spl_ce_OutOfRangeException, "Offset invalid or out of range", 0);
- return;
+ RETURN_THROWS();
}
element = spl_ptr_llist_offset(intern->llist, index, intern->flags & SPL_DLLIST_IT_LIFO);
@@ -850,7 +844,7 @@ SPL_METHOD(SplDoublyLinkedList, offsetSet)
} else {
zval_ptr_dtor(value);
zend_throw_exception(spl_ce_OutOfRangeException, "Offset invalid", 0);
- return;
+ RETURN_THROWS();
}
}
} /* }}} */
@@ -866,7 +860,7 @@ SPL_METHOD(SplDoublyLinkedList, offsetUnset)
spl_ptr_llist *llist;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &zindex) == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern = Z_SPLDLLIST_P(ZEND_THIS);
@@ -875,7 +869,7 @@ SPL_METHOD(SplDoublyLinkedList, offsetUnset)
if (index < 0 || index >= intern->llist->count) {
zend_throw_exception(spl_ce_OutOfRangeException, "Offset out of range", 0);
- return;
+ RETURN_THROWS();
}
element = spl_ptr_llist_offset(intern->llist, index, intern->flags & SPL_DLLIST_IT_LIFO);
@@ -916,7 +910,7 @@ SPL_METHOD(SplDoublyLinkedList, offsetUnset)
SPL_LLIST_DELREF(element);
} else {
zend_throw_exception(spl_ce_OutOfRangeException, "Offset invalid", 0);
- return;
+ RETURN_THROWS();
}
} /* }}} */
@@ -1039,7 +1033,7 @@ SPL_METHOD(SplDoublyLinkedList, key)
spl_dllist_object *intern = Z_SPLDLLIST_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_LONG(intern->traverse_position);
@@ -1053,7 +1047,7 @@ SPL_METHOD(SplDoublyLinkedList, prev)
spl_dllist_object *intern = Z_SPLDLLIST_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
spl_dllist_it_helper_move_forward(&intern->traverse_pointer, &intern->traverse_position, intern->llist, intern->flags ^ SPL_DLLIST_IT_LIFO);
@@ -1067,7 +1061,7 @@ SPL_METHOD(SplDoublyLinkedList, next)
spl_dllist_object *intern = Z_SPLDLLIST_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
spl_dllist_it_helper_move_forward(&intern->traverse_pointer, &intern->traverse_position, intern->llist, intern->flags);
@@ -1081,7 +1075,7 @@ SPL_METHOD(SplDoublyLinkedList, valid)
spl_dllist_object *intern = Z_SPLDLLIST_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_BOOL(intern->traverse_pointer != NULL);
@@ -1095,7 +1089,7 @@ SPL_METHOD(SplDoublyLinkedList, rewind)
spl_dllist_object *intern = Z_SPLDLLIST_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
spl_dllist_it_helper_rewind(&intern->traverse_pointer, &intern->traverse_position, intern->llist, intern->flags);
@@ -1110,7 +1104,7 @@ SPL_METHOD(SplDoublyLinkedList, current)
spl_ptr_llist_element *element = intern->traverse_pointer;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (element == NULL || Z_ISUNDEF(element->data)) {
@@ -1134,7 +1128,7 @@ SPL_METHOD(SplDoublyLinkedList, serialize)
php_serialize_data_t var_hash;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
PHP_VAR_SERIALIZE_INIT(var_hash);
@@ -1178,7 +1172,7 @@ SPL_METHOD(SplDoublyLinkedList, unserialize)
php_unserialize_data_t var_hash;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &buf, &buf_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (buf_len == 0) {
@@ -1218,7 +1212,7 @@ SPL_METHOD(SplDoublyLinkedList, unserialize)
error:
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Error at offset %zd of %zd bytes", ((char*)p - buf), buf_len);
- return;
+ RETURN_THROWS();
} /* }}} */
@@ -1229,8 +1223,8 @@ SPL_METHOD(SplDoublyLinkedList, __serialize)
spl_ptr_llist_element *current = intern->llist->head;
zval tmp;
- if (zend_parse_parameters_none_throw() == FAILURE) {
- return;
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
}
array_init(return_value);
@@ -1249,7 +1243,7 @@ SPL_METHOD(SplDoublyLinkedList, __serialize)
zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &tmp);
/* members */
- ZVAL_ARR(&tmp, zend_std_get_properties(ZEND_THIS));
+ ZVAL_ARR(&tmp, zend_std_get_properties(&intern->std));
Z_TRY_ADDREF(tmp);
zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &tmp);
} /* }}} */
@@ -1260,8 +1254,8 @@ SPL_METHOD(SplDoublyLinkedList, __unserialize) {
HashTable *data;
zval *flags_zv, *storage_zv, *members_zv, *elem;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "h", &data) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "h", &data) == FAILURE) {
+ RETURN_THROWS();
}
flags_zv = zend_hash_index_find(data, 0);
@@ -1272,7 +1266,7 @@ SPL_METHOD(SplDoublyLinkedList, __unserialize) {
Z_TYPE_P(members_zv) != IS_ARRAY) {
zend_throw_exception(spl_ce_UnexpectedValueException,
"Incomplete or ill-typed serialization data", 0);
- return;
+ RETURN_THROWS();
}
intern->flags = (int) Z_LVAL_P(flags_zv);
@@ -1294,7 +1288,7 @@ SPL_METHOD(SplDoublyLinkedList, add)
zend_long index;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &zindex, &value) == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern = Z_SPLDLLIST_P(ZEND_THIS);
@@ -1302,7 +1296,7 @@ SPL_METHOD(SplDoublyLinkedList, add)
if (index < 0 || index > intern->llist->count) {
zend_throw_exception(spl_ce_OutOfRangeException, "Offset invalid or out of range", 0);
- return;
+ RETURN_THROWS();
}
Z_TRY_ADDREF_P(value);
diff --git a/ext/spl/spl_dllist.h b/ext/spl/spl_dllist.h
index 3f53864d25..b42e55fcb6 100644
--- a/ext/spl/spl_dllist.h
+++ b/ext/spl/spl_dllist.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/spl/spl_engine.c b/ext/spl/spl_engine.c
index 7bedefe2c4..2420e8d49a 100644
--- a/ext/spl/spl_engine.c
+++ b/ext/spl/spl_engine.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/spl/spl_engine.h b/ext/spl/spl_engine.h
index c5614a691d..44c6867e03 100644
--- a/ext/spl/spl_engine.h
+++ b/ext/spl/spl_engine.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -33,7 +31,7 @@ static inline int spl_instantiate_arg_ex1(zend_class_entry *pce, zval *retval, z
zend_function *func = pce->constructor;
spl_instantiate(pce, retval);
- zend_call_method(retval, pce, &func, ZSTR_VAL(func->common.function_name), ZSTR_LEN(func->common.function_name), NULL, 1, arg1, NULL);
+ zend_call_method(Z_OBJ_P(retval), pce, &func, ZSTR_VAL(func->common.function_name), ZSTR_LEN(func->common.function_name), NULL, 1, arg1, NULL);
return 0;
}
/* }}} */
@@ -44,7 +42,7 @@ static inline int spl_instantiate_arg_ex2(zend_class_entry *pce, zval *retval, z
zend_function *func = pce->constructor;
spl_instantiate(pce, retval);
- zend_call_method(retval, pce, &func, ZSTR_VAL(func->common.function_name), ZSTR_LEN(func->common.function_name), NULL, 2, arg1, arg2);
+ zend_call_method(Z_OBJ_P(retval), pce, &func, ZSTR_VAL(func->common.function_name), ZSTR_LEN(func->common.function_name), NULL, 2, arg1, arg2);
return 0;
}
/* }}} */
diff --git a/ext/spl/spl_exceptions.c b/ext/spl/spl_exceptions.c
index abe70c2b34..e176776a1f 100644
--- a/ext/spl/spl_exceptions.c
+++ b/ext/spl/spl_exceptions.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/spl/spl_exceptions.h b/ext/spl/spl_exceptions.h
index 2c36287bbb..34962dd625 100644
--- a/ext/spl/spl_exceptions.h
+++ b/ext/spl/spl_exceptions.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/spl/spl_fixedarray.c b/ext/spl/spl_fixedarray.c
index d80509f851..b423774d8e 100644
--- a/ext/spl/spl_fixedarray.c
+++ b/ext/spl/spl_fixedarray.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -78,12 +76,19 @@ static inline spl_fixedarray_object *spl_fixed_array_from_obj(zend_object *obj)
#define Z_SPLFIXEDARRAY_P(zv) spl_fixed_array_from_obj(Z_OBJ_P((zv)))
+static inline void spl_fixedarray_init_elems(spl_fixedarray *array, size_t from, size_t to) {
+ for (size_t i = from; i < to; i++) {
+ ZVAL_NULL(&array->elements[i]);
+ }
+}
+
static void spl_fixedarray_init(spl_fixedarray *array, zend_long size) /* {{{ */
{
if (size > 0) {
array->size = 0; /* reset size in case ecalloc() fails */
- array->elements = ecalloc(size, sizeof(zval));
+ array->elements = safe_emalloc(size, sizeof(zval), 0);
array->size = size;
+ spl_fixedarray_init_elems(array, 0, size);
} else {
array->elements = NULL;
array->size = 0;
@@ -118,7 +123,7 @@ static void spl_fixedarray_resize(spl_fixedarray *array, zend_long size) /* {{{
}
} else if (size > array->size) {
array->elements = safe_erealloc(array->elements, size, sizeof(zval), 0);
- memset(array->elements + array->size, '\0', sizeof(zval) * (size - array->size));
+ spl_fixedarray_init_elems(array, array->size, size);
} else { /* size < array->size */
zend_long i;
@@ -141,9 +146,9 @@ static void spl_fixedarray_copy(spl_fixedarray *to, spl_fixedarray *from) /* {{{
}
/* }}} */
-static HashTable* spl_fixedarray_object_get_gc(zval *obj, zval **table, int *n) /* {{{{ */
+static HashTable* spl_fixedarray_object_get_gc(zend_object *obj, zval **table, int *n) /* {{{{ */
{
- spl_fixedarray_object *intern = Z_SPLFIXEDARRAY_P(obj);
+ spl_fixedarray_object *intern = spl_fixed_array_from_obj(obj);
HashTable *ht = zend_std_get_properties(obj);
*table = intern->array.elements;
@@ -153,9 +158,9 @@ static HashTable* spl_fixedarray_object_get_gc(zval *obj, zval **table, int *n)
}
/* }}}} */
-static HashTable* spl_fixedarray_object_get_properties(zval *obj) /* {{{{ */
+static HashTable* spl_fixedarray_object_get_properties(zend_object *obj) /* {{{{ */
{
- spl_fixedarray_object *intern = Z_SPLFIXEDARRAY_P(obj);
+ spl_fixedarray_object *intern = spl_fixed_array_from_obj(obj);
HashTable *ht = zend_std_get_properties(obj);
zend_long i = 0;
@@ -163,12 +168,8 @@ static HashTable* spl_fixedarray_object_get_properties(zval *obj) /* {{{{ */
zend_long j = zend_hash_num_elements(ht);
for (i = 0; i < intern->array.size; i++) {
- if (!Z_ISUNDEF(intern->array.elements[i])) {
- zend_hash_index_update(ht, i, &intern->array.elements[i]);
- Z_TRY_ADDREF(intern->array.elements[i]);
- } else {
- zend_hash_index_update(ht, i, &EG(uninitialized_zval));
- }
+ zend_hash_index_update(ht, i, &intern->array.elements[i]);
+ Z_TRY_ADDREF(intern->array.elements[i]);
}
if (j > intern->array.size) {
for (i = intern->array.size; i < j; ++i) {
@@ -202,7 +203,7 @@ static void spl_fixedarray_object_free_storage(zend_object *object) /* {{{ */
zend_object_iterator *spl_fixedarray_get_iterator(zend_class_entry *ce, zval *object, int by_ref);
-static zend_object *spl_fixedarray_object_new_ex(zend_class_entry *class_type, zval *orig, int clone_orig) /* {{{ */
+static zend_object *spl_fixedarray_object_new_ex(zend_class_entry *class_type, zend_object *orig, int clone_orig) /* {{{ */
{
spl_fixedarray_object *intern;
zend_class_entry *parent = class_type;
@@ -218,7 +219,7 @@ static zend_object *spl_fixedarray_object_new_ex(zend_class_entry *class_type, z
intern->flags = 0;
if (orig && clone_orig) {
- spl_fixedarray_object *other = Z_SPLFIXEDARRAY_P(orig);
+ spl_fixedarray_object *other = spl_fixed_array_from_obj(orig);
intern->ce_get_iterator = other->ce_get_iterator;
spl_fixedarray_init(&intern->array, other->array.size);
spl_fixedarray_copy(&intern->array, &other->array);
@@ -295,13 +296,9 @@ static zend_object *spl_fixedarray_new(zend_class_entry *class_type) /* {{{ */
}
/* }}} */
-static zend_object *spl_fixedarray_object_clone(zval *zobject) /* {{{ */
+static zend_object *spl_fixedarray_object_clone(zend_object *old_object) /* {{{ */
{
- zend_object *old_object;
- zend_object *new_object;
-
- old_object = Z_OBJ_P(zobject);
- new_object = spl_fixedarray_object_new_ex(old_object->ce, zobject, 1);
+ zend_object *new_object = spl_fixedarray_object_new_ex(old_object->ce, old_object, 1);
zend_objects_clone_members(new_object, old_object);
@@ -329,19 +326,17 @@ static inline zval *spl_fixedarray_object_read_dimension_helper(spl_fixedarray_o
if (index < 0 || index >= intern->array.size) {
zend_throw_exception(spl_ce_RuntimeException, "Index invalid or out of range", 0);
return NULL;
- } else if (Z_ISUNDEF(intern->array.elements[index])) {
- return NULL;
} else {
return &intern->array.elements[index];
}
}
/* }}} */
-static zval *spl_fixedarray_object_read_dimension(zval *object, zval *offset, int type, zval *rv) /* {{{ */
+static zval *spl_fixedarray_object_read_dimension(zend_object *object, zval *offset, int type, zval *rv) /* {{{ */
{
spl_fixedarray_object *intern;
- intern = Z_SPLFIXEDARRAY_P(object);
+ intern = spl_fixed_array_from_obj(object);
if (type == BP_VAR_IS && intern->fptr_offset_has) {
SEPARATE_ARG_IF_REF(offset);
@@ -398,20 +393,18 @@ static inline void spl_fixedarray_object_write_dimension_helper(spl_fixedarray_o
zend_throw_exception(spl_ce_RuntimeException, "Index invalid or out of range", 0);
return;
} else {
- if (!Z_ISUNDEF(intern->array.elements[index])) {
- zval_ptr_dtor(&(intern->array.elements[index]));
- }
+ zval_ptr_dtor(&(intern->array.elements[index]));
ZVAL_COPY_DEREF(&intern->array.elements[index], value);
}
}
/* }}} */
-static void spl_fixedarray_object_write_dimension(zval *object, zval *offset, zval *value) /* {{{ */
+static void spl_fixedarray_object_write_dimension(zend_object *object, zval *offset, zval *value) /* {{{ */
{
spl_fixedarray_object *intern;
zval tmp;
- intern = Z_SPLFIXEDARRAY_P(object);
+ intern = spl_fixed_array_from_obj(object);
if (intern->fptr_offset_set) {
if (!offset) {
@@ -446,16 +439,16 @@ static inline void spl_fixedarray_object_unset_dimension_helper(spl_fixedarray_o
return;
} else {
zval_ptr_dtor(&(intern->array.elements[index]));
- ZVAL_UNDEF(&intern->array.elements[index]);
+ ZVAL_NULL(&intern->array.elements[index]);
}
}
/* }}} */
-static void spl_fixedarray_object_unset_dimension(zval *object, zval *offset) /* {{{ */
+static void spl_fixedarray_object_unset_dimension(zend_object *object, zval *offset) /* {{{ */
{
spl_fixedarray_object *intern;
- intern = Z_SPLFIXEDARRAY_P(object);
+ intern = spl_fixed_array_from_obj(object);
if (intern->fptr_offset_del) {
SEPARATE_ARG_IF_REF(offset);
@@ -465,7 +458,6 @@ static void spl_fixedarray_object_unset_dimension(zval *object, zval *offset) /*
}
spl_fixedarray_object_unset_dimension_helper(intern, offset);
-
}
/* }}} */
@@ -483,16 +475,10 @@ static inline int spl_fixedarray_object_has_dimension_helper(spl_fixedarray_obje
if (index < 0 || index >= intern->array.size) {
retval = 0;
} else {
- if (Z_ISUNDEF(intern->array.elements[index])) {
- retval = 0;
- } else if (check_empty) {
- if (zend_is_true(&intern->array.elements[index])) {
- retval = 1;
- } else {
- retval = 0;
- }
- } else { /* != NULL and !check_empty */
- retval = 1;
+ if (check_empty) {
+ retval = zend_is_true(&intern->array.elements[index]);
+ } else {
+ retval = Z_TYPE(intern->array.elements[index]) != IS_NULL;
}
}
@@ -500,11 +486,11 @@ static inline int spl_fixedarray_object_has_dimension_helper(spl_fixedarray_obje
}
/* }}} */
-static int spl_fixedarray_object_has_dimension(zval *object, zval *offset, int check_empty) /* {{{ */
+static int spl_fixedarray_object_has_dimension(zend_object *object, zval *offset, int check_empty) /* {{{ */
{
spl_fixedarray_object *intern;
- intern = Z_SPLFIXEDARRAY_P(object);
+ intern = spl_fixed_array_from_obj(object);
if (intern->fptr_offset_has) {
zval rv;
@@ -522,11 +508,11 @@ static int spl_fixedarray_object_has_dimension(zval *object, zval *offset, int c
}
/* }}} */
-static int spl_fixedarray_object_count_elements(zval *object, zend_long *count) /* {{{ */
+static int spl_fixedarray_object_count_elements(zend_object *object, zend_long *count) /* {{{ */
{
spl_fixedarray_object *intern;
- intern = Z_SPLFIXEDARRAY_P(object);
+ intern = spl_fixed_array_from_obj(object);
if (intern->fptr_count) {
zval rv;
zend_call_method_with_0_params(object, intern->std.ce, &intern->fptr_count, "count", &rv);
@@ -551,13 +537,13 @@ SPL_METHOD(SplFixedArray, __construct)
spl_fixedarray_object *intern;
zend_long size = 0;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "|l", &size) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &size) == FAILURE) {
+ RETURN_THROWS();
}
if (size < 0) {
zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "array size cannot be less than zero");
- return;
+ RETURN_THROWS();
}
intern = Z_SPLFIXEDARRAY_P(object);
@@ -576,11 +562,11 @@ SPL_METHOD(SplFixedArray, __construct)
SPL_METHOD(SplFixedArray, __wakeup)
{
spl_fixedarray_object *intern = Z_SPLFIXEDARRAY_P(ZEND_THIS);
- HashTable *intern_ht = zend_std_get_properties(ZEND_THIS);
+ HashTable *intern_ht = zend_std_get_properties(Z_OBJ_P(ZEND_THIS));
zval *data;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (intern->array.size == 0) {
@@ -609,7 +595,7 @@ SPL_METHOD(SplFixedArray, count)
spl_fixedarray_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern = Z_SPLFIXEDARRAY_P(object);
@@ -624,7 +610,7 @@ SPL_METHOD(SplFixedArray, toArray)
spl_fixedarray_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern = Z_SPLFIXEDARRAY_P(ZEND_THIS);
@@ -634,12 +620,8 @@ SPL_METHOD(SplFixedArray, toArray)
array_init(return_value);
for (; i < intern->array.size; i++) {
- if (!Z_ISUNDEF(intern->array.elements[i])) {
- zend_hash_index_update(Z_ARRVAL_P(return_value), i, &intern->array.elements[i]);
- Z_TRY_ADDREF(intern->array.elements[i]);
- } else {
- zend_hash_index_update(Z_ARRVAL_P(return_value), i, &EG(uninitialized_zval));
- }
+ zend_hash_index_update(Z_ARRVAL_P(return_value), i, &intern->array.elements[i]);
+ Z_TRY_ADDREF(intern->array.elements[i]);
}
} else {
RETURN_EMPTY_ARRAY();
@@ -658,7 +640,7 @@ SPL_METHOD(SplFixedArray, fromArray)
zend_bool save_indexes = 1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "a|b", &data, &save_indexes) == FAILURE) {
- return;
+ RETURN_THROWS();
}
num = zend_hash_num_elements(Z_ARRVAL_P(data));
@@ -672,7 +654,7 @@ SPL_METHOD(SplFixedArray, fromArray)
ZEND_HASH_FOREACH_KEY(Z_ARRVAL_P(data), num_index, str_index) {
if (str_index != NULL || (zend_long)num_index < 0) {
zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "array must contain only positive integer keys");
- return;
+ RETURN_THROWS();
}
if (num_index > max_index) {
@@ -683,7 +665,7 @@ SPL_METHOD(SplFixedArray, fromArray)
tmp = max_index + 1;
if (tmp <= 0) {
zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "integer overflow detected");
- return;
+ RETURN_THROWS();
}
spl_fixedarray_init(&array, tmp);
@@ -720,7 +702,7 @@ SPL_METHOD(SplFixedArray, getSize)
spl_fixedarray_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern = Z_SPLFIXEDARRAY_P(object);
@@ -737,12 +719,12 @@ SPL_METHOD(SplFixedArray, setSize)
zend_long size;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &size) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (size < 0) {
zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "array size cannot be less than zero");
- return;
+ RETURN_THROWS();
}
intern = Z_SPLFIXEDARRAY_P(object);
@@ -760,7 +742,7 @@ SPL_METHOD(SplFixedArray, offsetExists)
spl_fixedarray_object *intern;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &zindex) == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern = Z_SPLFIXEDARRAY_P(ZEND_THIS);
@@ -776,7 +758,7 @@ SPL_METHOD(SplFixedArray, offsetGet)
spl_fixedarray_object *intern;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &zindex) == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern = Z_SPLFIXEDARRAY_P(ZEND_THIS);
@@ -797,7 +779,7 @@ SPL_METHOD(SplFixedArray, offsetSet)
spl_fixedarray_object *intern;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &zindex, &value) == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern = Z_SPLFIXEDARRAY_P(ZEND_THIS);
@@ -813,7 +795,7 @@ SPL_METHOD(SplFixedArray, offsetUnset)
spl_fixedarray_object *intern;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &zindex) == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern = Z_SPLFIXEDARRAY_P(ZEND_THIS);
@@ -912,7 +894,7 @@ SPL_METHOD(SplFixedArray, key)
spl_fixedarray_object *intern = Z_SPLFIXEDARRAY_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_LONG(intern->current);
@@ -926,7 +908,7 @@ SPL_METHOD(SplFixedArray, next)
spl_fixedarray_object *intern = Z_SPLFIXEDARRAY_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern->current++;
@@ -940,7 +922,7 @@ SPL_METHOD(SplFixedArray, valid)
spl_fixedarray_object *intern = Z_SPLFIXEDARRAY_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_BOOL(intern->current >= 0 && intern->current < intern->array.size);
@@ -954,7 +936,7 @@ SPL_METHOD(SplFixedArray, rewind)
spl_fixedarray_object *intern = Z_SPLFIXEDARRAY_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern->current = 0;
@@ -969,7 +951,7 @@ SPL_METHOD(SplFixedArray, current)
spl_fixedarray_object *intern = Z_SPLFIXEDARRAY_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
ZVAL_LONG(&zindex, intern->current);
diff --git a/ext/spl/spl_fixedarray.h b/ext/spl/spl_fixedarray.h
index 9be62d4b89..de9225c05e 100644
--- a/ext/spl/spl_fixedarray.h
+++ b/ext/spl/spl_fixedarray.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/spl/spl_functions.c b/ext/spl/spl_functions.c
index 74d7e75667..6a44ab3cfb 100644
--- a/ext/spl/spl_functions.c
+++ b/ext/spl/spl_functions.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/spl/spl_functions.h b/ext/spl/spl_functions.h
index 2b9ff7890d..8d23eda474 100644
--- a/ext/spl/spl_functions.h
+++ b/ext/spl/spl_functions.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/spl/spl_heap.c b/ext/spl/spl_heap.c
index 8191c2901d..d7df5bd5e5 100644
--- a/ext/spl/spl_heap.c
+++ b/ext/spl/spl_heap.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -128,7 +126,7 @@ static void spl_ptr_heap_pqueue_elem_ctor(void *elem) { /* {{{ */
static int spl_ptr_heap_cmp_cb_helper(zval *object, spl_heap_object *heap_object, zval *a, zval *b, zend_long *result) { /* {{{ */
zval zresult;
- zend_call_method_with_2_params(object, heap_object->std.ce, &heap_object->fptr_cmp, "compare", &zresult, a, b);
+ zend_call_method_with_2_params(Z_OBJ_P(object), heap_object->std.ce, &heap_object->fptr_cmp, "compare", &zresult, a, b);
if (EG(exception)) {
return FAILURE;
@@ -168,7 +166,6 @@ static void spl_pqueue_extract_helper(zval *result, spl_pqueue_elem *elem, int f
static int spl_ptr_heap_zval_max_cmp(void *x, void *y, zval *object) { /* {{{ */
zval *a = x, *b = y;
- zval result;
if (EG(exception)) {
return 0;
@@ -186,14 +183,12 @@ static int spl_ptr_heap_zval_max_cmp(void *x, void *y, zval *object) { /* {{{ */
}
}
- compare_function(&result, a, b);
- return (int)Z_LVAL(result);
+ return zend_compare(a, b);
}
/* }}} */
static int spl_ptr_heap_zval_min_cmp(void *x, void *y, zval *object) { /* {{{ */
zval *a = x, *b = y;
- zval result;
if (EG(exception)) {
return 0;
@@ -211,8 +206,7 @@ static int spl_ptr_heap_zval_min_cmp(void *x, void *y, zval *object) { /* {{{ */
}
}
- compare_function(&result, b, a);
- return (int)Z_LVAL(result);
+ return zend_compare(b, a);
}
/* }}} */
@@ -221,7 +215,6 @@ static int spl_ptr_pqueue_elem_cmp(void *x, void *y, zval *object) { /* {{{ */
spl_pqueue_elem *b = y;
zval *a_priority_p = &a->priority;
zval *b_priority_p = &b->priority;
- zval result;
if (EG(exception)) {
return 0;
@@ -239,8 +232,7 @@ static int spl_ptr_pqueue_elem_cmp(void *x, void *y, zval *object) { /* {{{ */
}
}
- compare_function(&result, a_priority_p, b_priority_p);
- return (int)Z_LVAL(result);
+ return zend_compare(a_priority_p, b_priority_p);
}
/* }}} */
@@ -391,7 +383,7 @@ static void spl_heap_object_free_storage(zend_object *object) /* {{{ */
}
/* }}} */
-static zend_object *spl_heap_object_new_ex(zend_class_entry *class_type, zval *orig, int clone_orig) /* {{{ */
+static zend_object *spl_heap_object_new_ex(zend_class_entry *class_type, zend_object *orig, int clone_orig) /* {{{ */
{
spl_heap_object *intern;
zend_class_entry *parent = class_type;
@@ -403,7 +395,7 @@ static zend_object *spl_heap_object_new_ex(zend_class_entry *class_type, zval *o
object_properties_init(&intern->std, class_type);
if (orig) {
- spl_heap_object *other = Z_SPLHEAP_P(orig);
+ spl_heap_object *other = spl_heap_from_obj(orig);
intern->std.handlers = other->std.handlers;
intern->ce_get_iterator = other->ce_get_iterator;
@@ -465,13 +457,9 @@ static zend_object *spl_heap_object_new(zend_class_entry *class_type) /* {{{ */
}
/* }}} */
-static zend_object *spl_heap_object_clone(zval *zobject) /* {{{ */
+static zend_object *spl_heap_object_clone(zend_object *old_object) /* {{{ */
{
- zend_object *old_object;
- zend_object *new_object;
-
- old_object = Z_OBJ_P(zobject);
- new_object = spl_heap_object_new_ex(old_object->ce, zobject, 1);
+ zend_object *new_object = spl_heap_object_new_ex(old_object->ce, old_object, 1);
zend_objects_clone_members(new_object, old_object);
@@ -479,9 +467,9 @@ static zend_object *spl_heap_object_clone(zval *zobject) /* {{{ */
}
/* }}} */
-static int spl_heap_object_count_elements(zval *object, zend_long *count) /* {{{ */
+static int spl_heap_object_count_elements(zend_object *object, zend_long *count) /* {{{ */
{
- spl_heap_object *intern = Z_SPLHEAP_P(object);
+ spl_heap_object *intern = spl_heap_from_obj(object);
if (intern->fptr_count) {
zval rv;
@@ -501,8 +489,8 @@ static int spl_heap_object_count_elements(zval *object, zend_long *count) /* {{{
}
/* }}} */
-static HashTable* spl_heap_object_get_debug_info_helper(zend_class_entry *ce, zval *obj, int *is_temp) { /* {{{ */
- spl_heap_object *intern = Z_SPLHEAP_P(obj);
+static HashTable* spl_heap_object_get_debug_info_helper(zend_class_entry *ce, zend_object *obj, int *is_temp) { /* {{{ */
+ spl_heap_object *intern = spl_heap_from_obj(obj);
zval tmp, heap_array;
zend_string *pnstr;
HashTable *debug_info;
@@ -550,9 +538,9 @@ static HashTable* spl_heap_object_get_debug_info_helper(zend_class_entry *ce, zv
}
/* }}} */
-static HashTable *spl_heap_object_get_gc(zval *obj, zval **gc_data, int *gc_data_count) /* {{{ */
+static HashTable *spl_heap_object_get_gc(zend_object *obj, zval **gc_data, int *gc_data_count) /* {{{ */
{
- spl_heap_object *intern = Z_SPLHEAP_P(obj);
+ spl_heap_object *intern = spl_heap_from_obj(obj);
*gc_data = (zval *) intern->heap->elements;
*gc_data_count = intern->heap->count;
@@ -560,9 +548,9 @@ static HashTable *spl_heap_object_get_gc(zval *obj, zval **gc_data, int *gc_data
}
/* }}} */
-static HashTable *spl_pqueue_object_get_gc(zval *obj, zval **gc_data, int *gc_data_count) /* {{{ */
+static HashTable *spl_pqueue_object_get_gc(zend_object *obj, zval **gc_data, int *gc_data_count) /* {{{ */
{
- spl_heap_object *intern = Z_SPLHEAP_P(obj);
+ spl_heap_object *intern = spl_heap_from_obj(obj);
*gc_data = (zval *) intern->heap->elements;
/* Two zvals (value and priority) per pqueue entry */
*gc_data_count = 2 * intern->heap->count;
@@ -571,13 +559,13 @@ static HashTable *spl_pqueue_object_get_gc(zval *obj, zval **gc_data, int *gc_da
}
/* }}} */
-static HashTable* spl_heap_object_get_debug_info(zval *obj, int *is_temp) /* {{{ */
+static HashTable* spl_heap_object_get_debug_info(zend_object *obj, int *is_temp) /* {{{ */
{
return spl_heap_object_get_debug_info_helper(spl_ce_SplHeap, obj, is_temp);
}
/* }}} */
-static HashTable* spl_pqueue_object_get_debug_info(zval *obj, int *is_temp) /* {{{ */
+static HashTable* spl_pqueue_object_get_debug_info(zend_object *obj, int *is_temp) /* {{{ */
{
return spl_heap_object_get_debug_info_helper(spl_ce_SplPriorityQueue, obj, is_temp);
}
@@ -591,7 +579,7 @@ SPL_METHOD(SplHeap, count)
spl_heap_object *intern = Z_SPLHEAP_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
count = spl_ptr_heap_count(intern->heap);
@@ -606,7 +594,7 @@ SPL_METHOD(SplHeap, isEmpty)
spl_heap_object *intern = Z_SPLHEAP_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_BOOL(spl_ptr_heap_count(intern->heap) == 0);
@@ -621,14 +609,14 @@ SPL_METHOD(SplHeap, insert)
spl_heap_object *intern;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &value) == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern = Z_SPLHEAP_P(ZEND_THIS);
if (intern->heap->flags & SPL_HEAP_CORRUPTED) {
zend_throw_exception(spl_ce_RuntimeException, "Heap is corrupted, heap properties are no longer ensured.", 0);
- return;
+ RETURN_THROWS();
}
Z_TRY_ADDREF_P(value);
@@ -645,19 +633,19 @@ SPL_METHOD(SplHeap, extract)
spl_heap_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern = Z_SPLHEAP_P(ZEND_THIS);
if (intern->heap->flags & SPL_HEAP_CORRUPTED) {
zend_throw_exception(spl_ce_RuntimeException, "Heap is corrupted, heap properties are no longer ensured.", 0);
- return;
+ RETURN_THROWS();
}
if (spl_ptr_heap_delete_top(intern->heap, return_value, ZEND_THIS) == FAILURE) {
zend_throw_exception(spl_ce_RuntimeException, "Can't extract from an empty heap", 0);
- return;
+ RETURN_THROWS();
}
}
/* }}} */
@@ -671,14 +659,14 @@ SPL_METHOD(SplPriorityQueue, insert)
spl_pqueue_elem elem;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &data, &priority) == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern = Z_SPLHEAP_P(ZEND_THIS);
if (intern->heap->flags & SPL_HEAP_CORRUPTED) {
zend_throw_exception(spl_ce_RuntimeException, "Heap is corrupted, heap properties are no longer ensured.", 0);
- return;
+ RETURN_THROWS();
}
ZVAL_COPY(&elem.data, data);
@@ -698,19 +686,19 @@ SPL_METHOD(SplPriorityQueue, extract)
spl_heap_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern = Z_SPLHEAP_P(ZEND_THIS);
if (intern->heap->flags & SPL_HEAP_CORRUPTED) {
zend_throw_exception(spl_ce_RuntimeException, "Heap is corrupted, heap properties are no longer ensured.", 0);
- return;
+ RETURN_THROWS();
}
if (spl_ptr_heap_delete_top(intern->heap, &elem, ZEND_THIS) == FAILURE) {
zend_throw_exception(spl_ce_RuntimeException, "Can't extract from an empty heap", 0);
- return;
+ RETURN_THROWS();
}
spl_pqueue_extract_helper(return_value, &elem, intern->flags);
@@ -726,21 +714,21 @@ SPL_METHOD(SplPriorityQueue, top)
spl_pqueue_elem *elem;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern = Z_SPLHEAP_P(ZEND_THIS);
if (intern->heap->flags & SPL_HEAP_CORRUPTED) {
zend_throw_exception(spl_ce_RuntimeException, "Heap is corrupted, heap properties are no longer ensured.", 0);
- return;
+ RETURN_THROWS();
}
elem = spl_ptr_heap_top(intern->heap);
if (!elem) {
zend_throw_exception(spl_ce_RuntimeException, "Can't peek at an empty heap", 0);
- return;
+ RETURN_THROWS();
}
spl_pqueue_extract_helper(return_value, elem, intern->flags);
@@ -756,13 +744,13 @@ SPL_METHOD(SplPriorityQueue, setExtractFlags)
spl_heap_object *intern;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &value) == FAILURE) {
- return;
+ RETURN_THROWS();
}
value &= SPL_PQUEUE_EXTR_MASK;
if (!value) {
zend_throw_exception(spl_ce_RuntimeException, "Must specify at least one extract flag", 0);
- return;
+ RETURN_THROWS();
}
intern = Z_SPLHEAP_P(ZEND_THIS);
@@ -778,7 +766,7 @@ SPL_METHOD(SplPriorityQueue, getExtractFlags)
spl_heap_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern = Z_SPLHEAP_P(ZEND_THIS);
@@ -794,7 +782,7 @@ SPL_METHOD(SplHeap, recoverFromCorruption)
spl_heap_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern = Z_SPLHEAP_P(ZEND_THIS);
@@ -812,7 +800,7 @@ SPL_METHOD(SplHeap, isCorrupted)
spl_heap_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern = Z_SPLHEAP_P(ZEND_THIS);
@@ -828,7 +816,7 @@ SPL_METHOD(SplPriorityQueue, compare)
zval *a, *b;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &a, &b) == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_LONG(spl_ptr_heap_zval_max_cmp(a, b, NULL));
@@ -843,21 +831,21 @@ SPL_METHOD(SplHeap, top)
spl_heap_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern = Z_SPLHEAP_P(ZEND_THIS);
if (intern->heap->flags & SPL_HEAP_CORRUPTED) {
zend_throw_exception(spl_ce_RuntimeException, "Heap is corrupted, heap properties are no longer ensured.", 0);
- return;
+ RETURN_THROWS();
}
value = spl_ptr_heap_top(intern->heap);
if (!value) {
zend_throw_exception(spl_ce_RuntimeException, "Can't peek at an empty heap", 0);
- return;
+ RETURN_THROWS();
}
ZVAL_COPY_DEREF(return_value, value);
@@ -871,7 +859,7 @@ SPL_METHOD(SplMinHeap, compare)
zval *a, *b;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &a, &b) == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_LONG(spl_ptr_heap_zval_min_cmp(a, b, NULL));
@@ -885,7 +873,7 @@ SPL_METHOD(SplMaxHeap, compare)
zval *a, *b;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &a, &b) == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_LONG(spl_ptr_heap_zval_max_cmp(a, b, NULL));
@@ -981,7 +969,7 @@ SPL_METHOD(SplHeap, key)
spl_heap_object *intern = Z_SPLHEAP_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_LONG(intern->heap->count - 1);
@@ -995,7 +983,7 @@ SPL_METHOD(SplHeap, next)
spl_heap_object *intern = Z_SPLHEAP_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
spl_ptr_heap_delete_top(intern->heap, NULL, ZEND_THIS);
@@ -1009,7 +997,7 @@ SPL_METHOD(SplHeap, valid)
spl_heap_object *intern = Z_SPLHEAP_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_BOOL(intern->heap->count != 0);
@@ -1021,7 +1009,7 @@ SPL_METHOD(SplHeap, valid)
SPL_METHOD(SplHeap, rewind)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
/* do nothing, the iterator always points to the top element */
}
@@ -1034,7 +1022,7 @@ SPL_METHOD(SplHeap, current)
spl_heap_object *intern = Z_SPLHEAP_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!intern->heap->count) {
@@ -1053,7 +1041,7 @@ SPL_METHOD(SplPriorityQueue, current)
spl_heap_object *intern = Z_SPLHEAP_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!intern->heap->count) {
@@ -1199,7 +1187,7 @@ static const zend_function_entry spl_funcs_SplHeap[] = {
SPL_ME(SplHeap, valid, arginfo_splheap_void, ZEND_ACC_PUBLIC)
SPL_ME(SplHeap, recoverFromCorruption, arginfo_splheap_void, ZEND_ACC_PUBLIC)
SPL_ME(SplHeap, isCorrupted, arginfo_splheap_void, ZEND_ACC_PUBLIC)
- ZEND_FENTRY(compare, NULL, NULL, ZEND_ACC_PROTECTED|ZEND_ACC_ABSTRACT)
+ ZEND_FENTRY(compare, NULL, arginfo_heap_compare, ZEND_ACC_PROTECTED|ZEND_ACC_ABSTRACT)
PHP_FE_END
};
/* }}} */
diff --git a/ext/spl/spl_heap.h b/ext/spl/spl_heap.h
index d73fca545e..512e94783d 100644
--- a/ext/spl/spl_heap.h
+++ b/ext/spl/spl_heap.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c
index cce9477ed5..666f3ebf64 100644
--- a/ext/spl/spl_iterators.c
+++ b/ext/spl/spl_iterators.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -137,7 +135,7 @@ static inline spl_recursive_it_object *spl_recursive_it_from_obj(zend_object *ob
if (it->dit_type == DIT_Unknown) { \
zend_throw_exception_ex(spl_ce_LogicException, 0, \
"The object is in an invalid state as the parent constructor was not called"); \
- return; \
+ RETURN_THROWS(); \
} \
(var) = it; \
} while (0)
@@ -157,7 +155,7 @@ static inline spl_recursive_it_object *spl_recursive_it_from_obj(zend_object *ob
if(!(object)->iterators) { \
zend_throw_exception_ex(spl_ce_LogicException, 0, \
"The object is in an invalid state as the parent constructor was not called"); \
- return; \
+ RETURN_THROWS(); \
} \
(var) = &(object)->iterators[(object)->level].element; \
} while (0)
@@ -201,7 +199,7 @@ static int spl_recursive_it_valid_ex(spl_recursive_it_object *object, zval *zthi
level--;
}
if (object->endIteration && object->in_iteration) {
- zend_call_method_with_0_params(zthis, object->ce, &object->endIteration, "endIteration", NULL);
+ zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->endIteration, "endIteration", NULL);
}
object->in_iteration = 0;
return FAILURE;
@@ -267,9 +265,9 @@ next_step:
ce = object->iterators[object->level].ce;
zobject = &object->iterators[object->level].zobject;
if (object->callHasChildren) {
- zend_call_method_with_0_params(zthis, object->ce, &object->callHasChildren, "callHasChildren", &retval);
+ zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->callHasChildren, "callHasChildren", &retval);
} else {
- zend_call_method_with_0_params(zobject, ce, NULL, "haschildren", &retval);
+ zend_call_method_with_0_params(Z_OBJ_P(zobject), ce, NULL, "haschildren", &retval);
}
if (EG(exception)) {
if (!(object->flags & RIT_CATCH_GET_CHILD)) {
@@ -304,7 +302,7 @@ next_step:
}
}
if (object->nextElement) {
- zend_call_method_with_0_params(zthis, object->ce, &object->nextElement, "nextelement", NULL);
+ zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->nextElement, "nextelement", NULL);
}
object->iterators[object->level].state = RS_NEXT;
if (EG(exception)) {
@@ -317,7 +315,7 @@ next_step:
return /* self */;
case RS_SELF:
if (object->nextElement && (object->mode == RIT_SELF_FIRST || object->mode == RIT_CHILD_FIRST)) {
- zend_call_method_with_0_params(zthis, object->ce, &object->nextElement, "nextelement", NULL);
+ zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->nextElement, "nextelement", NULL);
}
if (object->mode == RIT_SELF_FIRST) {
object->iterators[object->level].state = RS_CHILD;
@@ -329,9 +327,9 @@ next_step:
ce = object->iterators[object->level].ce;
zobject = &object->iterators[object->level].zobject;
if (object->callGetChildren) {
- zend_call_method_with_0_params(zthis, object->ce, &object->callGetChildren, "callGetChildren", &child);
+ zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->callGetChildren, "callGetChildren", &child);
} else {
- zend_call_method_with_0_params(zobject, ce, NULL, "getchildren", &child);
+ zend_call_method_with_0_params(Z_OBJ_P(zobject), ce, NULL, "getchildren", &child);
}
if (EG(exception)) {
@@ -367,7 +365,7 @@ next_step:
sub_iter->funcs->rewind(sub_iter);
}
if (object->beginChildren) {
- zend_call_method_with_0_params(zthis, object->ce, &object->beginChildren, "beginchildren", NULL);
+ zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->beginChildren, "beginchildren", NULL);
if (EG(exception)) {
if (!(object->flags & RIT_CATCH_GET_CHILD)) {
return;
@@ -381,7 +379,7 @@ next_step:
/* no more elements */
if (object->level > 0) {
if (object->endChildren) {
- zend_call_method_with_0_params(zthis, object->ce, &object->endChildren, "endchildren", NULL);
+ zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->endChildren, "endchildren", NULL);
if (EG(exception)) {
if (!(object->flags & RIT_CATCH_GET_CHILD)) {
return;
@@ -415,7 +413,7 @@ static void spl_recursive_it_rewind_ex(spl_recursive_it_object *object, zval *zt
zend_iterator_dtor(sub_iter);
zval_ptr_dtor(&object->iterators[object->level--].zobject);
if (!EG(exception) && (!object->endChildren || object->endChildren->common.scope != spl_ce_RecursiveIteratorIterator)) {
- zend_call_method_with_0_params(zthis, object->ce, &object->endChildren, "endchildren", NULL);
+ zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->endChildren, "endchildren", NULL);
}
}
object->iterators = erealloc(object->iterators, sizeof(spl_sub_iterator));
@@ -425,7 +423,7 @@ static void spl_recursive_it_rewind_ex(spl_recursive_it_object *object, zval *zt
sub_iter->funcs->rewind(sub_iter);
}
if (!EG(exception) && object->beginIteration && !object->in_iteration) {
- zend_call_method_with_0_params(zthis, object->ce, &object->beginIteration, "beginIteration", NULL);
+ zend_call_method_with_0_params(Z_OBJ_P(zthis), object->ce, &object->beginIteration, "beginIteration", NULL);
}
object->in_iteration = 1;
spl_recursive_it_move_forward_ex(object, zthis);
@@ -495,7 +493,7 @@ static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_cla
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "o|lzl", &iterator, &flags, &user_caching_it_flags, &mode) == SUCCESS) {
if (instanceof_function(Z_OBJCE_P(iterator), zend_ce_aggregate)) {
- zend_call_method_with_0_params(iterator, Z_OBJCE_P(iterator), &Z_OBJCE_P(iterator)->iterator_funcs_ptr->zf_new_iterator, "getiterator", &aggregate_retval);
+ zend_call_method_with_0_params(Z_OBJ_P(iterator), Z_OBJCE_P(iterator), &Z_OBJCE_P(iterator)->iterator_funcs_ptr->zf_new_iterator, "getiterator", &aggregate_retval);
iterator = &aggregate_retval;
} else {
Z_ADDREF_P(iterator);
@@ -523,7 +521,7 @@ static void spl_recursive_it_it_construct(INTERNAL_FUNCTION_PARAMETERS, zend_cla
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "o|ll", &iterator, &mode, &flags) == SUCCESS) {
if (instanceof_function(Z_OBJCE_P(iterator), zend_ce_aggregate)) {
- zend_call_method_with_0_params(iterator, Z_OBJCE_P(iterator), &Z_OBJCE_P(iterator)->iterator_funcs_ptr->zf_new_iterator, "getiterator", &aggregate_retval);
+ zend_call_method_with_0_params(Z_OBJ_P(iterator), Z_OBJCE_P(iterator), &Z_OBJCE_P(iterator)->iterator_funcs_ptr->zf_new_iterator, "getiterator", &aggregate_retval);
iterator = &aggregate_retval;
} else {
Z_ADDREF_P(iterator);
@@ -616,7 +614,7 @@ SPL_METHOD(RecursiveIteratorIterator, rewind)
spl_recursive_it_object *object = Z_SPLRECURSIVE_IT_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
spl_recursive_it_rewind_ex(object, ZEND_THIS);
@@ -629,7 +627,7 @@ SPL_METHOD(RecursiveIteratorIterator, valid)
spl_recursive_it_object *object = Z_SPLRECURSIVE_IT_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_BOOL(spl_recursive_it_valid_ex(object, ZEND_THIS) == SUCCESS);
@@ -643,7 +641,7 @@ SPL_METHOD(RecursiveIteratorIterator, key)
zend_object_iterator *iterator;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_SUB_ITERATOR(iterator, object);
@@ -664,7 +662,7 @@ SPL_METHOD(RecursiveIteratorIterator, current)
zval *data;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_SUB_ITERATOR(iterator, object);
@@ -682,7 +680,7 @@ SPL_METHOD(RecursiveIteratorIterator, next)
spl_recursive_it_object *object = Z_SPLRECURSIVE_IT_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
spl_recursive_it_move_forward_ex(object, ZEND_THIS);
@@ -695,7 +693,7 @@ SPL_METHOD(RecursiveIteratorIterator, getDepth)
spl_recursive_it_object *object = Z_SPLRECURSIVE_IT_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_LONG(object->level);
@@ -710,7 +708,7 @@ SPL_METHOD(RecursiveIteratorIterator, getSubIterator)
zval *value;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &level) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (level < 0 || level > object->level) {
RETURN_NULL();
@@ -719,7 +717,7 @@ SPL_METHOD(RecursiveIteratorIterator, getSubIterator)
if(!object->iterators) {
zend_throw_exception_ex(spl_ce_LogicException, 0,
"The object is in an invalid state as the parent constructor was not called");
- return;
+ RETURN_THROWS();
}
value = &object->iterators[level].zobject;
@@ -734,7 +732,7 @@ SPL_METHOD(RecursiveIteratorIterator, getInnerIterator)
zval *zobject;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_SUB_ELEMENT_ADDR(zobject, object, zobject);
@@ -747,7 +745,7 @@ SPL_METHOD(RecursiveIteratorIterator, getInnerIterator)
SPL_METHOD(RecursiveIteratorIterator, beginIteration)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
/* nothing to do */
} /* }}} */
@@ -757,7 +755,7 @@ SPL_METHOD(RecursiveIteratorIterator, beginIteration)
SPL_METHOD(RecursiveIteratorIterator, endIteration)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
/* nothing to do */
} /* }}} */
@@ -771,7 +769,7 @@ SPL_METHOD(RecursiveIteratorIterator, callHasChildren)
zval *zobject;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!object->iterators) {
@@ -784,7 +782,7 @@ SPL_METHOD(RecursiveIteratorIterator, callHasChildren)
if (Z_TYPE_P(zobject) == IS_UNDEF) {
RETURN_FALSE;
} else {
- zend_call_method_with_0_params(zobject, ce, NULL, "haschildren", return_value);
+ zend_call_method_with_0_params(Z_OBJ_P(zobject), ce, NULL, "haschildren", return_value);
if (Z_TYPE_P(return_value) == IS_UNDEF) {
RETURN_FALSE;
}
@@ -800,7 +798,7 @@ SPL_METHOD(RecursiveIteratorIterator, callGetChildren)
zval *zobject;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_SUB_ELEMENT(ce, object, ce);
@@ -809,7 +807,7 @@ SPL_METHOD(RecursiveIteratorIterator, callGetChildren)
if (Z_TYPE_P(zobject) == IS_UNDEF) {
return;
} else {
- zend_call_method_with_0_params(zobject, ce, NULL, "getchildren", return_value);
+ zend_call_method_with_0_params(Z_OBJ_P(zobject), ce, NULL, "getchildren", return_value);
if (Z_TYPE_P(return_value) == IS_UNDEF) {
RETURN_NULL();
}
@@ -821,7 +819,7 @@ SPL_METHOD(RecursiveIteratorIterator, callGetChildren)
SPL_METHOD(RecursiveIteratorIterator, beginChildren)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
/* nothing to do */
} /* }}} */
@@ -831,7 +829,7 @@ SPL_METHOD(RecursiveIteratorIterator, beginChildren)
SPL_METHOD(RecursiveIteratorIterator, endChildren)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
/* nothing to do */
} /* }}} */
@@ -841,7 +839,7 @@ SPL_METHOD(RecursiveIteratorIterator, endChildren)
SPL_METHOD(RecursiveIteratorIterator, nextElement)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
/* nothing to do */
} /* }}} */
@@ -854,11 +852,11 @@ SPL_METHOD(RecursiveIteratorIterator, setMaxDepth)
zend_long max_depth = -1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &max_depth) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (max_depth < -1) {
zend_throw_exception(spl_ce_OutOfRangeException, "Parameter max_depth must be >= -1", 0);
- return;
+ RETURN_THROWS();
} else if (max_depth > INT_MAX) {
max_depth = INT_MAX;
}
@@ -873,7 +871,7 @@ SPL_METHOD(RecursiveIteratorIterator, getMaxDepth)
spl_recursive_it_object *object = Z_SPLRECURSIVE_IT_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (object->max_depth == -1) {
@@ -1036,7 +1034,7 @@ static void spl_recursive_tree_iterator_get_prefix(spl_recursive_it_object *obje
smart_str_appendl(&str, ZSTR_VAL(object->prefix[0].s), ZSTR_LEN(object->prefix[0].s));
for (level = 0; level < object->level; ++level) {
- zend_call_method_with_0_params(&object->iterators[level].zobject, object->iterators[level].ce, NULL, "hasnext", &has_next);
+ zend_call_method_with_0_params(Z_OBJ(object->iterators[level].zobject), object->iterators[level].ce, NULL, "hasnext", &has_next);
if (Z_TYPE(has_next) != IS_UNDEF) {
if (Z_TYPE(has_next) == IS_TRUE) {
smart_str_appendl(&str, ZSTR_VAL(object->prefix[1].s), ZSTR_LEN(object->prefix[1].s));
@@ -1046,7 +1044,7 @@ static void spl_recursive_tree_iterator_get_prefix(spl_recursive_it_object *obje
zval_ptr_dtor(&has_next);
}
}
- zend_call_method_with_0_params(&object->iterators[level].zobject, object->iterators[level].ce, NULL, "hasnext", &has_next);
+ zend_call_method_with_0_params(Z_OBJ(object->iterators[level].zobject), object->iterators[level].ce, NULL, "hasnext", &has_next);
if (Z_TYPE(has_next) != IS_UNDEF) {
if (Z_TYPE(has_next) == IS_TRUE) {
smart_str_appendl(&str, ZSTR_VAL(object->prefix[3].s), ZSTR_LEN(object->prefix[3].s));
@@ -1103,12 +1101,12 @@ SPL_METHOD(RecursiveTreeIterator, setPrefixPart)
spl_recursive_it_object *object = Z_SPLRECURSIVE_IT_P(ZEND_THIS);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &part, &prefix, &prefix_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (0 > part || part > 5) {
zend_throw_exception_ex(spl_ce_OutOfRangeException, 0, "Use RecursiveTreeIterator::PREFIX_* constant");
- return;
+ RETURN_THROWS();
}
smart_str_free(&object->prefix[part]);
@@ -1122,13 +1120,13 @@ SPL_METHOD(RecursiveTreeIterator, getPrefix)
spl_recursive_it_object *object = Z_SPLRECURSIVE_IT_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if(!object->iterators) {
zend_throw_exception_ex(spl_ce_LogicException, 0,
"The object is in an invalid state as the parent constructor was not called");
- return;
+ RETURN_THROWS();
}
spl_recursive_tree_iterator_get_prefix(object, return_value);
@@ -1143,7 +1141,7 @@ SPL_METHOD(RecursiveTreeIterator, setPostfix)
size_t postfix_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &postfix, &postfix_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
smart_str_free(&object->postfix[0]);
@@ -1157,13 +1155,13 @@ SPL_METHOD(RecursiveTreeIterator, getEntry)
spl_recursive_it_object *object = Z_SPLRECURSIVE_IT_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if(!object->iterators) {
zend_throw_exception_ex(spl_ce_LogicException, 0,
"The object is in an invalid state as the parent constructor was not called");
- return;
+ RETURN_THROWS();
}
spl_recursive_tree_iterator_get_entry(object, return_value);
@@ -1176,13 +1174,13 @@ SPL_METHOD(RecursiveTreeIterator, getPostfix)
spl_recursive_it_object *object = Z_SPLRECURSIVE_IT_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if(!object->iterators) {
zend_throw_exception_ex(spl_ce_LogicException, 0,
"The object is in an invalid state as the parent constructor was not called");
- return;
+ RETURN_THROWS();
}
spl_recursive_tree_iterator_get_postfix(object, return_value);
@@ -1198,13 +1196,13 @@ SPL_METHOD(RecursiveTreeIterator, current)
zend_string *str;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if(!object->iterators) {
zend_throw_exception_ex(spl_ce_LogicException, 0,
"The object is in an invalid state as the parent constructor was not called");
- return;
+ RETURN_THROWS();
}
if (object->flags & RTIT_BYPASS_CURRENT) {
@@ -1261,7 +1259,7 @@ SPL_METHOD(RecursiveTreeIterator, key)
zend_string *str;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_SUB_ITERATOR(iterator, object);
@@ -1273,8 +1271,7 @@ SPL_METHOD(RecursiveTreeIterator, key)
}
if (object->flags & RTIT_BYPASS_KEY) {
- RETVAL_ZVAL(&key, 1, 1);
- return;
+ RETURN_COPY_VALUE(&key);
}
if (Z_TYPE(key) != IS_STRING) {
@@ -1363,52 +1360,11 @@ static zend_function *spl_dual_it_get_method(zend_object **object, zend_string *
return function_handler;
}
-#if MBO_0
-int spl_dual_it_call_method(char *method, INTERNAL_FUNCTION_PARAMETERS)
-{
- zval ***func_params, func;
- zval retval;
- int arg_count;
- int current = 0;
- int success;
- void **p;
- spl_dual_it_object *intern;
-
- intern = Z_SPLDUAL_IT_P(ZEND_THIS);
-
- ZVAL_STRING(&func, method, 0);
-
- p = EG(argument_stack).top_element-2;
- arg_count = (zend_ulong) *p;
-
- func_params = safe_emalloc(sizeof(zval **), arg_count, 0);
-
- current = 0;
- while (arg_count-- > 0) {
- func_params[current] = (zval **) p - (arg_count-current);
- current++;
- }
- arg_count = current; /* restore */
-
- if (call_user_function_ex(EG(function_table), NULL, &func, &retval, arg_count, func_params, 0, NULL) == SUCCESS && Z_TYPE(retval) != IS_UNDEF) {
- RETURN_ZVAL(&retval, 0, 0);
-
- success = SUCCESS;
- } else {
- zend_throw_error(NULL, "Unable to call %s::%s()", intern->inner.ce->name, method);
- success = FAILURE;
- }
-
- efree(func_params);
- return success;
-}
-#endif
-
#define SPL_CHECK_CTOR(intern, classname) \
if (intern->dit_type == DIT_Unknown) { \
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Classes derived from %s must call %s::__construct()", \
ZSTR_VAL((spl_ce_##classname)->name), ZSTR_VAL((spl_ce_##classname)->name)); \
- return; \
+ RETURN_THROWS(); \
}
#define APPENDIT_CHECK_CTOR(intern) SPL_CHECK_CTOR(intern, AppendIterator)
@@ -1447,7 +1403,7 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z
case DIT_LimitIterator: {
intern->u.limit.offset = 0; /* start at beginning */
intern->u.limit.count = -1; /* get all */
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "O|ll", &zobject, ce_inner, &intern->u.limit.offset, &intern->u.limit.count) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O|ll", &zobject, ce_inner, &intern->u.limit.offset, &intern->u.limit.count) == FAILURE) {
return NULL;
}
if (intern->u.limit.offset < 0) {
@@ -1463,7 +1419,7 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z
case DIT_CachingIterator:
case DIT_RecursiveCachingIterator: {
zend_long flags = CIT_CALL_TOSTRING;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "O|l", &zobject, ce_inner, &flags) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O|l", &zobject, ce_inner, &flags) == FAILURE) {
return NULL;
}
if (spl_cit_check_flags(flags) != SUCCESS) {
@@ -1478,7 +1434,7 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z
zend_class_entry *ce_cast;
zend_string *class_name;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "O|S", &zobject, ce_inner, &class_name) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O|S", &zobject, ce_inner, &class_name) == FAILURE) {
return NULL;
}
ce = Z_OBJCE_P(zobject);
@@ -1494,7 +1450,7 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z
ce = ce_cast;
}
if (instanceof_function(ce, zend_ce_aggregate)) {
- zend_call_method_with_0_params(zobject, ce, &ce->iterator_funcs_ptr->zf_new_iterator, "getiterator", &retval);
+ zend_call_method_with_0_params(Z_OBJ_P(zobject), ce, &ce->iterator_funcs_ptr->zf_new_iterator, "getiterator", &retval);
if (EG(exception)) {
zval_ptr_dtor(&retval);
return NULL;
@@ -1513,7 +1469,7 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z
case DIT_AppendIterator:
zend_replace_error_handling(EH_THROW, spl_ce_InvalidArgumentException, &error_handling);
spl_instantiate(spl_ce_ArrayIterator, &intern->u.append.zarrayit);
- zend_call_method_with_0_params(&intern->u.append.zarrayit, spl_ce_ArrayIterator, &spl_ce_ArrayIterator->constructor, "__construct", NULL);
+ zend_call_method_with_0_params(Z_OBJ(intern->u.append.zarrayit), spl_ce_ArrayIterator, &spl_ce_ArrayIterator->constructor, "__construct", NULL);
intern->u.append.iterator = spl_ce_ArrayIterator->get_iterator(spl_ce_ArrayIterator, &intern->u.append.zarrayit, 0);
zend_restore_error_handling(&error_handling);
return intern;
@@ -1525,7 +1481,7 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z
intern->u.regex.use_flags = ZEND_NUM_ARGS() >= 5;
intern->u.regex.flags = 0;
intern->u.regex.preg_flags = 0;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "OS|lll", &zobject, ce_inner, &regex, &mode, &intern->u.regex.flags, &intern->u.regex.preg_flags) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "OS|lll", &zobject, ce_inner, &regex, &mode, &intern->u.regex.flags, &intern->u.regex.preg_flags) == FAILURE) {
return NULL;
}
if (mode < 0 || mode >= REGIT_MODE_MAX) {
@@ -1550,7 +1506,7 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z
case DIT_RecursiveCallbackFilterIterator: {
_spl_cbfilter_it_intern *cfi = emalloc(sizeof(*cfi));
cfi->fci.object = NULL;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "Of", &zobject, ce_inner, &cfi->fci, &cfi->fcc) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Of", &zobject, ce_inner, &cfi->fci, &cfi->fcc) == FAILURE) {
efree(cfi);
return NULL;
}
@@ -1561,7 +1517,7 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z
break;
}
default:
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "O", &zobject, ce_inner) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &zobject, ce_inner) == FAILURE) {
return NULL;
}
break;
@@ -1603,7 +1559,7 @@ SPL_METHOD(dual_it, getInnerIterator)
spl_dual_it_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
@@ -1706,7 +1662,7 @@ SPL_METHOD(dual_it, rewind)
spl_dual_it_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
@@ -1725,7 +1681,7 @@ SPL_METHOD(dual_it, valid)
spl_dual_it_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
@@ -1746,7 +1702,7 @@ SPL_METHOD(dual_it, key)
spl_dual_it_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
@@ -1772,7 +1728,7 @@ SPL_METHOD(dual_it, current)
spl_dual_it_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
@@ -1795,7 +1751,7 @@ SPL_METHOD(dual_it, next)
spl_dual_it_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
@@ -1809,7 +1765,7 @@ static inline void spl_filter_it_fetch(zval *zthis, spl_dual_it_object *intern)
zval retval;
while (spl_dual_it_fetch(intern, 1) == SUCCESS) {
- zend_call_method_with_0_params(zthis, intern->std.ce, NULL, "accept", &retval);
+ zend_call_method_with_0_params(Z_OBJ_P(zthis), intern->std.ce, NULL, "accept", &retval);
if (Z_TYPE(retval) != IS_UNDEF) {
if (zend_is_true(&retval)) {
zval_ptr_dtor(&retval);
@@ -1844,7 +1800,7 @@ SPL_METHOD(FilterIterator, rewind)
spl_dual_it_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
@@ -1858,7 +1814,7 @@ SPL_METHOD(FilterIterator, next)
spl_dual_it_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
@@ -1885,20 +1841,14 @@ SPL_METHOD(RecursiveFilterIterator, __construct)
SPL_METHOD(RecursiveFilterIterator, hasChildren)
{
spl_dual_it_object *intern;
- zval retval;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
- zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "haschildren", &retval);
- if (Z_TYPE(retval) != IS_UNDEF) {
- RETURN_ZVAL(&retval, 0, 1);
- } else {
- RETURN_FALSE;
- }
+ zend_call_method_with_0_params(Z_OBJ(intern->inner.zobject), intern->inner.ce, NULL, "haschildren", return_value);
} /* }}} */
/* {{{ proto RecursiveFilterIterator RecursiveFilterIterator::getChildren()
@@ -1909,12 +1859,12 @@ SPL_METHOD(RecursiveFilterIterator, getChildren)
zval retval;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
- zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "getchildren", &retval);
+ zend_call_method_with_0_params(Z_OBJ(intern->inner.zobject), intern->inner.ce, NULL, "getchildren", &retval);
if (!EG(exception) && Z_TYPE(retval) != IS_UNDEF) {
spl_instantiate_arg_ex1(Z_OBJCE_P(ZEND_THIS), return_value, &retval);
}
@@ -1929,12 +1879,12 @@ SPL_METHOD(RecursiveCallbackFilterIterator, getChildren)
zval retval;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
- zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "getchildren", &retval);
+ zend_call_method_with_0_params(Z_OBJ(intern->inner.zobject), intern->inner.ce, NULL, "getchildren", &retval);
if (!EG(exception) && Z_TYPE(retval) != IS_UNDEF) {
spl_instantiate_arg_ex2(Z_OBJCE_P(ZEND_THIS), return_value, &retval, &intern->u.cbfilter->fci.function_name);
}
@@ -1964,7 +1914,7 @@ SPL_METHOD(CallbackFilterIterator, accept)
zval params[3];
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (Z_TYPE(intern->current.data) == IS_UNDEF || Z_TYPE(intern->current.key) == IS_UNDEF) {
@@ -1985,7 +1935,7 @@ SPL_METHOD(CallbackFilterIterator, accept)
}
if (EG(exception)) {
- RETURN_NULL();
+ RETURN_THROWS();
}
/* zend_call_function may change args to IS_REF */
@@ -2007,7 +1957,7 @@ SPL_METHOD(RegexIterator, accept)
int rc;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
@@ -2027,7 +1977,7 @@ SPL_METHOD(RegexIterator, accept)
/* Exception during string conversion. */
if (EG(exception)) {
- return;
+ RETURN_THROWS();
}
switch (intern->u.regex.mode)
@@ -2096,7 +2046,7 @@ SPL_METHOD(RegexIterator, getRegex)
spl_dual_it_object *intern = Z_SPLDUAL_IT_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_STR_COPY(intern->u.regex.regex);
@@ -2109,7 +2059,7 @@ SPL_METHOD(RegexIterator, getMode)
spl_dual_it_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
@@ -2125,12 +2075,12 @@ SPL_METHOD(RegexIterator, setMode)
zend_long mode;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &mode) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (mode < 0 || mode >= REGIT_MODE_MAX) {
zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Illegal mode " ZEND_LONG_FMT, mode);
- return;/* NULL */
+ RETURN_THROWS();
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
@@ -2145,7 +2095,7 @@ SPL_METHOD(RegexIterator, getFlags)
spl_dual_it_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
@@ -2161,7 +2111,7 @@ SPL_METHOD(RegexIterator, setFlags)
zend_long flags;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
@@ -2176,7 +2126,7 @@ SPL_METHOD(RegexIterator, getPregFlags)
spl_dual_it_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
@@ -2196,7 +2146,7 @@ SPL_METHOD(RegexIterator, setPregFlags)
zend_long preg_flags;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &preg_flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
@@ -2220,12 +2170,12 @@ SPL_METHOD(RecursiveRegexIterator, getChildren)
zval retval;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
- zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "getchildren", &retval);
+ zend_call_method_with_0_params(Z_OBJ(intern->inner.zobject), intern->inner.ce, NULL, "getchildren", &retval);
if (!EG(exception)) {
zval args[5];
@@ -2248,7 +2198,7 @@ SPL_METHOD(RecursiveRegexIterator, accept)
spl_dual_it_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
@@ -2259,7 +2209,7 @@ SPL_METHOD(RecursiveRegexIterator, accept)
RETURN_BOOL(zend_hash_num_elements(Z_ARRVAL(intern->current.data)) > 0);
}
- zend_call_method_with_0_params(ZEND_THIS, spl_ce_RegexIterator, NULL, "accept", return_value);
+ zend_call_method_with_0_params(Z_OBJ_P(ZEND_THIS), spl_ce_RegexIterator, NULL, "accept", return_value);
}
/* {{{ spl_dual_it_dtor */
@@ -2471,7 +2421,7 @@ static inline void spl_limit_it_seek(spl_dual_it_object *intern, zend_long pos)
if (pos != intern->current.pos && instanceof_function(intern->inner.ce, spl_ce_SeekableIterator)) {
ZVAL_LONG(&zpos, pos);
spl_dual_it_free(intern);
- zend_call_method_with_1_params(&intern->inner.zobject, intern->inner.ce, NULL, "seek", NULL, &zpos);
+ zend_call_method_with_1_params(Z_OBJ(intern->inner.zobject), intern->inner.ce, NULL, "seek", NULL, &zpos);
if (!EG(exception)) {
intern->current.pos = pos;
if (spl_limit_it_valid(intern) == SUCCESS) {
@@ -2545,7 +2495,7 @@ SPL_METHOD(LimitIterator, seek)
zend_long pos;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &pos) == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
@@ -2621,7 +2571,7 @@ static inline void spl_caching_it_next(spl_dual_it_object *intern)
/* Recursion ? */
if (intern->dit_type == DIT_RecursiveCachingIterator) {
zval retval, zchildren, zflags;
- zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "haschildren", &retval);
+ zend_call_method_with_0_params(Z_OBJ(intern->inner.zobject), intern->inner.ce, NULL, "haschildren", &retval);
if (EG(exception)) {
zval_ptr_dtor(&retval);
if (intern->u.caching.flags & CIT_CATCH_GET_CHILD) {
@@ -2631,7 +2581,7 @@ static inline void spl_caching_it_next(spl_dual_it_object *intern)
}
} else {
if (zend_is_true(&retval)) {
- zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "getchildren", &zchildren);
+ zend_call_method_with_0_params(Z_OBJ(intern->inner.zobject), intern->inner.ce, NULL, "getchildren", &zchildren);
if (EG(exception)) {
zval_ptr_dtor(&zchildren);
if (intern->u.caching.flags & CIT_CATCH_GET_CHILD) {
@@ -2698,7 +2648,7 @@ SPL_METHOD(CachingIterator, rewind)
spl_dual_it_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
@@ -2713,7 +2663,7 @@ SPL_METHOD(CachingIterator, valid)
spl_dual_it_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
@@ -2728,7 +2678,7 @@ SPL_METHOD(CachingIterator, next)
spl_dual_it_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
@@ -2743,7 +2693,7 @@ SPL_METHOD(CachingIterator, hasNext)
spl_dual_it_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
@@ -2761,7 +2711,7 @@ SPL_METHOD(CachingIterator, __toString)
if (!(intern->u.caching.flags & (CIT_CALL_TOSTRING|CIT_TOSTRING_USE_KEY|CIT_TOSTRING_USE_CURRENT|CIT_TOSTRING_USE_INNER))) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s does not fetch string value (see CachingIterator::__construct)", ZSTR_VAL(Z_OBJCE_P(ZEND_THIS)->name));
- return;
+ RETURN_THROWS();
}
if (intern->u.caching.flags & CIT_TOSTRING_USE_KEY) {
ZVAL_COPY(return_value, &intern->current.key);
@@ -2791,11 +2741,11 @@ SPL_METHOD(CachingIterator, offsetSet)
if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s does not use a full cache (see CachingIterator::__construct)", ZSTR_VAL(Z_OBJCE_P(ZEND_THIS)->name));
- return;
+ RETURN_THROWS();
}
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sz", &key, &value) == FAILURE) {
- return;
+ RETURN_THROWS();
}
Z_TRY_ADDREF_P(value);
@@ -2815,11 +2765,11 @@ SPL_METHOD(CachingIterator, offsetGet)
if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s does not use a full cache (see CachingIterator::__construct)", ZSTR_VAL(Z_OBJCE_P(ZEND_THIS)->name));
- return;
+ RETURN_THROWS();
}
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &key) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((value = zend_symtable_find(Z_ARRVAL(intern->u.caching.zcache), key)) == NULL) {
@@ -2842,11 +2792,11 @@ SPL_METHOD(CachingIterator, offsetUnset)
if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s does not use a full cache (see CachingIterator::__construct)", ZSTR_VAL(Z_OBJCE_P(ZEND_THIS)->name));
- return;
+ RETURN_THROWS();
}
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &key) == FAILURE) {
- return;
+ RETURN_THROWS();
}
zend_symtable_del(Z_ARRVAL(intern->u.caching.zcache), key);
@@ -2864,11 +2814,11 @@ SPL_METHOD(CachingIterator, offsetExists)
if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s does not use a full cache (see CachingIterator::__construct)", ZSTR_VAL(Z_OBJCE_P(ZEND_THIS)->name));
- return;
+ RETURN_THROWS();
}
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &key) == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_BOOL(zend_symtable_exists(Z_ARRVAL(intern->u.caching.zcache), key));
@@ -2882,14 +2832,14 @@ SPL_METHOD(CachingIterator, getCache)
spl_dual_it_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s does not use a full cache (see CachingIterator::__construct)", ZSTR_VAL(Z_OBJCE_P(ZEND_THIS)->name));
- return;
+ RETURN_THROWS();
}
ZVAL_COPY(return_value, &intern->u.caching.zcache);
@@ -2903,7 +2853,7 @@ SPL_METHOD(CachingIterator, getFlags)
spl_dual_it_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
@@ -2922,20 +2872,20 @@ SPL_METHOD(CachingIterator, setFlags)
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (spl_cit_check_flags(flags) != SUCCESS) {
zend_throw_exception(spl_ce_InvalidArgumentException , "Flags must contain only one of CALL_TOSTRING, TOSTRING_USE_KEY, TOSTRING_USE_CURRENT, TOSTRING_USE_INNER", 0);
- return;
+ RETURN_THROWS();
}
if ((intern->u.caching.flags & CIT_CALL_TOSTRING) != 0 && (flags & CIT_CALL_TOSTRING) == 0) {
zend_throw_exception(spl_ce_InvalidArgumentException, "Unsetting flag CALL_TO_STRING is not possible", 0);
- return;
+ RETURN_THROWS();
}
if ((intern->u.caching.flags & CIT_TOSTRING_USE_INNER) != 0 && (flags & CIT_TOSTRING_USE_INNER) == 0) {
zend_throw_exception(spl_ce_InvalidArgumentException, "Unsetting flag TOSTRING_USE_INNER is not possible", 0);
- return;
+ RETURN_THROWS();
}
if ((flags & CIT_FULL_CACHE) != 0 && (intern->u.caching.flags & CIT_FULL_CACHE) == 0) {
/* clear on (re)enable */
@@ -2952,14 +2902,14 @@ SPL_METHOD(CachingIterator, count)
spl_dual_it_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s does not use a full cache (see CachingIterator::__construct)", ZSTR_VAL(Z_OBJCE_P(ZEND_THIS)->name));
- return;
+ RETURN_THROWS();
}
RETURN_LONG(zend_hash_num_elements(Z_ARRVAL(intern->u.caching.zcache)));
@@ -3019,7 +2969,7 @@ SPL_METHOD(RecursiveCachingIterator, hasChildren)
spl_dual_it_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
@@ -3034,7 +2984,7 @@ SPL_METHOD(RecursiveCachingIterator, getChildren)
spl_dual_it_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
@@ -3094,7 +3044,7 @@ SPL_METHOD(NoRewindIterator, __construct)
SPL_METHOD(NoRewindIterator, rewind)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
/* nothing to do */
} /* }}} */
@@ -3106,7 +3056,7 @@ SPL_METHOD(NoRewindIterator, valid)
spl_dual_it_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
@@ -3120,7 +3070,7 @@ SPL_METHOD(NoRewindIterator, key)
spl_dual_it_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
@@ -3140,7 +3090,7 @@ SPL_METHOD(NoRewindIterator, current)
zval *data;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
@@ -3157,7 +3107,7 @@ SPL_METHOD(NoRewindIterator, next)
spl_dual_it_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
@@ -3193,7 +3143,7 @@ SPL_METHOD(InfiniteIterator, next)
spl_dual_it_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
@@ -3220,7 +3170,7 @@ static const zend_function_entry spl_funcs_InfiniteIterator[] = {
SPL_METHOD(EmptyIterator, rewind)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
} /* }}} */
@@ -3229,7 +3179,7 @@ SPL_METHOD(EmptyIterator, rewind)
SPL_METHOD(EmptyIterator, valid)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_FALSE;
} /* }}} */
@@ -3239,7 +3189,7 @@ SPL_METHOD(EmptyIterator, valid)
SPL_METHOD(EmptyIterator, key)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
zend_throw_exception(spl_ce_BadMethodCallException, "Accessing the key of an EmptyIterator", 0);
} /* }}} */
@@ -3249,7 +3199,7 @@ SPL_METHOD(EmptyIterator, key)
SPL_METHOD(EmptyIterator, current)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
zend_throw_exception(spl_ce_BadMethodCallException, "Accessing the value of an EmptyIterator", 0);
} /* }}} */
@@ -3259,7 +3209,7 @@ SPL_METHOD(EmptyIterator, current)
SPL_METHOD(EmptyIterator, next)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
} /* }}} */
@@ -3334,8 +3284,8 @@ SPL_METHOD(AppendIterator, append)
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "O", &it, zend_ce_iterator) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &it, zend_ce_iterator) == FAILURE) {
+ RETURN_THROWS();
}
if (intern->u.append.iterator->funcs->valid(intern->u.append.iterator) == SUCCESS && spl_dual_it_valid(intern) != SUCCESS) {
spl_array_iterator_append(&intern->u.append.zarrayit, it);
@@ -3362,7 +3312,7 @@ SPL_METHOD(AppendIterator, current)
spl_dual_it_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
@@ -3384,7 +3334,7 @@ SPL_METHOD(AppendIterator, rewind)
spl_dual_it_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
@@ -3402,7 +3352,7 @@ SPL_METHOD(AppendIterator, valid)
spl_dual_it_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
@@ -3417,7 +3367,7 @@ SPL_METHOD(AppendIterator, next)
spl_dual_it_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
@@ -3432,7 +3382,7 @@ SPL_METHOD(AppendIterator, getIteratorIndex)
spl_dual_it_object *intern;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
@@ -3449,7 +3399,7 @@ SPL_METHOD(AppendIterator, getArrayIterator)
zval *value;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
@@ -3569,7 +3519,7 @@ PHP_FUNCTION(iterator_to_array)
zend_bool use_keys = 1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O|b", &obj, zend_ce_traversable, &use_keys) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
array_init(return_value);
@@ -3591,7 +3541,7 @@ PHP_FUNCTION(iterator_count)
zend_long count = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &obj, zend_ce_traversable) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (spl_iterator_apply(obj, spl_iterator_count_apply, (void*)&count) == FAILURE) {
@@ -3632,7 +3582,7 @@ PHP_FUNCTION(iterator_apply)
apply_info.args = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Of|a!", &apply_info.obj, zend_ce_traversable, &apply_info.fci, &apply_info.fcc, &apply_info.args) == FAILURE) {
- return;
+ RETURN_THROWS();
}
apply_info.count = 0;
@@ -3672,7 +3622,6 @@ PHP_MINIT_FUNCTION(spl_iterators)
memcpy(&spl_handlers_dual_it, &std_object_handlers, sizeof(zend_object_handlers));
spl_handlers_dual_it.offset = XtOffsetOf(spl_dual_it_object, std);
spl_handlers_dual_it.get_method = spl_dual_it_get_method;
- /*spl_handlers_dual_it.call_method = spl_dual_it_call_method;*/
spl_handlers_dual_it.clone_obj = NULL;
spl_handlers_dual_it.dtor_obj = spl_dual_it_dtor;
spl_handlers_dual_it.free_obj = spl_dual_it_free_storage;
diff --git a/ext/spl/spl_iterators.h b/ext/spl/spl_iterators.h
index af2f815538..a3b02bf8bc 100644
--- a/ext/spl/spl_iterators.h
+++ b/ext/spl/spl_iterators.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/spl/spl_observer.c b/ext/spl/spl_observer.c
index ba29e0311e..2e08645d31 100644
--- a/ext/spl/spl_observer.c
+++ b/ext/spl/spl_observer.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -115,10 +113,11 @@ void spl_SplObjectStorage_free_storage(zend_object *object) /* {{{ */
} /* }}} */
-static int spl_object_storage_get_hash(zend_hash_key *key, spl_SplObjectStorage *intern, zval *this, zval *obj) {
+static int spl_object_storage_get_hash(zend_hash_key *key, spl_SplObjectStorage *intern, zval *obj) {
if (intern->fptr_get_hash) {
zval rv;
- zend_call_method_with_1_params(this, intern->std.ce, &intern->fptr_get_hash, "getHash", &rv, obj);
+ zend_call_method_with_1_params(
+ &intern->std, intern->std.ce, &intern->fptr_get_hash, "getHash", &rv, obj);
if (!Z_ISUNDEF(rv)) {
if (Z_TYPE(rv) == IS_STRING) {
key->key = Z_STR(rv);
@@ -162,11 +161,11 @@ static spl_SplObjectStorageElement* spl_object_storage_get(spl_SplObjectStorage
}
} /* }}} */
-spl_SplObjectStorageElement *spl_object_storage_attach(spl_SplObjectStorage *intern, zval *this, zval *obj, zval *inf) /* {{{ */
+spl_SplObjectStorageElement *spl_object_storage_attach(spl_SplObjectStorage *intern, zval *obj, zval *inf) /* {{{ */
{
spl_SplObjectStorageElement *pelement, element;
zend_hash_key key;
- if (spl_object_storage_get_hash(&key, intern, this, obj) == FAILURE) {
+ if (spl_object_storage_get_hash(&key, intern, obj) == FAILURE) {
return NULL;
}
@@ -198,11 +197,11 @@ spl_SplObjectStorageElement *spl_object_storage_attach(spl_SplObjectStorage *int
return pelement;
} /* }}} */
-static int spl_object_storage_detach(spl_SplObjectStorage *intern, zval *this, zval *obj) /* {{{ */
+static int spl_object_storage_detach(spl_SplObjectStorage *intern, zval *obj) /* {{{ */
{
int ret = FAILURE;
zend_hash_key key;
- if (spl_object_storage_get_hash(&key, intern, this, obj) == FAILURE) {
+ if (spl_object_storage_get_hash(&key, intern, obj) == FAILURE) {
return ret;
}
if (key.key) {
@@ -215,17 +214,17 @@ static int spl_object_storage_detach(spl_SplObjectStorage *intern, zval *this, z
return ret;
} /* }}}*/
-void spl_object_storage_addall(spl_SplObjectStorage *intern, zval *this, spl_SplObjectStorage *other) { /* {{{ */
+void spl_object_storage_addall(spl_SplObjectStorage *intern, spl_SplObjectStorage *other) { /* {{{ */
spl_SplObjectStorageElement *element;
ZEND_HASH_FOREACH_PTR(&other->storage, element) {
- spl_object_storage_attach(intern, this, &element->obj, &element->inf);
+ spl_object_storage_attach(intern, &element->obj, &element->inf);
} ZEND_HASH_FOREACH_END();
intern->index = 0;
} /* }}} */
-static zend_object *spl_object_storage_new_ex(zend_class_entry *class_type, zval *orig) /* {{{ */
+static zend_object *spl_object_storage_new_ex(zend_class_entry *class_type, zend_object *orig) /* {{{ */
{
spl_SplObjectStorage *intern;
zend_class_entry *parent = class_type;
@@ -256,8 +255,8 @@ static zend_object *spl_object_storage_new_ex(zend_class_entry *class_type, zval
}
if (orig) {
- spl_SplObjectStorage *other = Z_SPLOBJSTORAGE_P(orig);
- spl_object_storage_addall(intern, orig, other);
+ spl_SplObjectStorage *other = spl_object_storage_from_obj(orig);
+ spl_object_storage_addall(intern, other);
}
return &intern->std;
@@ -265,13 +264,11 @@ static zend_object *spl_object_storage_new_ex(zend_class_entry *class_type, zval
/* }}} */
/* {{{ spl_object_storage_clone */
-static zend_object *spl_object_storage_clone(zval *zobject)
+static zend_object *spl_object_storage_clone(zend_object *old_object)
{
- zend_object *old_object;
zend_object *new_object;
- old_object = Z_OBJ_P(zobject);
- new_object = spl_object_storage_new_ex(old_object->ce, zobject);
+ new_object = spl_object_storage_new_ex(old_object->ce, old_object);
zend_objects_clone_members(new_object, old_object);
@@ -279,9 +276,9 @@ static zend_object *spl_object_storage_clone(zval *zobject)
}
/* }}} */
-static HashTable* spl_object_storage_debug_info(zval *obj, int *is_temp) /* {{{ */
+static HashTable* spl_object_storage_debug_info(zend_object *obj, int *is_temp) /* {{{ */
{
- spl_SplObjectStorage *intern = Z_SPLOBJSTORAGE_P(obj);
+ spl_SplObjectStorage *intern = spl_object_storage_from_obj(obj);
spl_SplObjectStorageElement *element;
HashTable *props;
zval tmp, storage;
@@ -291,7 +288,7 @@ static HashTable* spl_object_storage_debug_info(zval *obj, int *is_temp) /* {{{
*is_temp = 1;
- props = Z_OBJPROP_P(obj);
+ props = obj->handlers->get_properties(obj);
debug_info = zend_new_array(zend_hash_num_elements(props) + 1);
zend_hash_copy(debug_info, props, (copy_ctor_func_t)zval_add_ref);
@@ -319,10 +316,10 @@ static HashTable* spl_object_storage_debug_info(zval *obj, int *is_temp) /* {{{
/* }}} */
/* overridden for garbage collection */
-static HashTable *spl_object_storage_get_gc(zval *obj, zval **table, int *n) /* {{{ */
+static HashTable *spl_object_storage_get_gc(zend_object *obj, zval **table, int *n) /* {{{ */
{
int i = 0;
- spl_SplObjectStorage *intern = Z_SPLOBJSTORAGE_P(obj);
+ spl_SplObjectStorage *intern = spl_object_storage_from_obj(obj);
spl_SplObjectStorageElement *element;
if (intern->storage.nNumOfElements * 2 > intern->gcdata_num) {
@@ -346,20 +343,20 @@ static int spl_object_storage_compare_info(zval *e1, zval *e2) /* {{{ */
{
spl_SplObjectStorageElement *s1 = (spl_SplObjectStorageElement*)Z_PTR_P(e1);
spl_SplObjectStorageElement *s2 = (spl_SplObjectStorageElement*)Z_PTR_P(e2);
- zval result;
-
- if (compare_function(&result, &s1->inf, &s2->inf) == FAILURE) {
- return 1;
- }
- return ZEND_NORMALIZE_BOOL(Z_LVAL(result));
+ return zend_compare(&s1->inf, &s2->inf);
}
/* }}} */
static int spl_object_storage_compare_objects(zval *o1, zval *o2) /* {{{ */
{
- zend_object *zo1 = (zend_object *)Z_OBJ_P(o1);
- zend_object *zo2 = (zend_object *)Z_OBJ_P(o2);
+ zend_object *zo1;
+ zend_object *zo2;
+
+ ZEND_COMPARE_OBJECTS_FALLBACK(o1, o2);
+
+ zo1 = (zend_object *)Z_OBJ_P(o1);
+ zo2 = (zend_object *)Z_OBJ_P(o2);
if (zo1->ce != spl_ce_SplObjectStorage || zo2->ce != spl_ce_SplObjectStorage) {
return 1;
@@ -376,11 +373,11 @@ static zend_object *spl_SplObjectStorage_new(zend_class_entry *class_type)
}
/* }}} */
-int spl_object_storage_contains(spl_SplObjectStorage *intern, zval *this, zval *obj) /* {{{ */
+int spl_object_storage_contains(spl_SplObjectStorage *intern, zval *obj) /* {{{ */
{
int found;
zend_hash_key key;
- if (spl_object_storage_get_hash(&key, intern, this, obj) == FAILURE) {
+ if (spl_object_storage_get_hash(&key, intern, obj) == FAILURE) {
return 0;
}
@@ -402,9 +399,9 @@ SPL_METHOD(SplObjectStorage, attach)
spl_SplObjectStorage *intern = Z_SPLOBJSTORAGE_P(ZEND_THIS);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "o|z!", &obj, &inf) == FAILURE) {
- return;
+ RETURN_THROWS();
}
- spl_object_storage_attach(intern, ZEND_THIS, obj, inf);
+ spl_object_storage_attach(intern, obj, inf);
} /* }}} */
/* {{{ proto void SplObjectStorage::detach(object obj)
@@ -415,9 +412,9 @@ SPL_METHOD(SplObjectStorage, detach)
spl_SplObjectStorage *intern = Z_SPLOBJSTORAGE_P(ZEND_THIS);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &obj) == FAILURE) {
- return;
+ RETURN_THROWS();
}
- spl_object_storage_detach(intern, ZEND_THIS, obj);
+ spl_object_storage_detach(intern, obj);
zend_hash_internal_pointer_reset_ex(&intern->storage, &intern->pos);
intern->index = 0;
@@ -430,7 +427,7 @@ SPL_METHOD(SplObjectStorage, getHash)
zval *obj;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &obj) == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_NEW_STR(php_spl_object_hash(obj));
@@ -447,10 +444,10 @@ SPL_METHOD(SplObjectStorage, offsetGet)
zend_hash_key key;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &obj) == FAILURE) {
- return;
+ RETURN_THROWS();
}
- if (spl_object_storage_get_hash(&key, intern, ZEND_THIS, obj) == FAILURE) {
+ if (spl_object_storage_get_hash(&key, intern, obj) == FAILURE) {
return;
}
@@ -475,12 +472,12 @@ SPL_METHOD(SplObjectStorage, addAll)
spl_SplObjectStorage *other;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &obj, spl_ce_SplObjectStorage) == FAILURE) {
- return;
+ RETURN_THROWS();
}
other = Z_SPLOBJSTORAGE_P(obj);
- spl_object_storage_addall(intern, ZEND_THIS, other);
+ spl_object_storage_addall(intern, other);
RETURN_LONG(zend_hash_num_elements(&intern->storage));
} /* }}} */
@@ -495,14 +492,14 @@ SPL_METHOD(SplObjectStorage, removeAll)
spl_SplObjectStorageElement *element;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &obj, spl_ce_SplObjectStorage) == FAILURE) {
- return;
+ RETURN_THROWS();
}
other = Z_SPLOBJSTORAGE_P(obj);
zend_hash_internal_pointer_reset(&other->storage);
while ((element = zend_hash_get_current_data_ptr(&other->storage)) != NULL) {
- if (spl_object_storage_detach(intern, ZEND_THIS, &element->obj) == FAILURE) {
+ if (spl_object_storage_detach(intern, &element->obj) == FAILURE) {
zend_hash_move_forward(&other->storage);
}
}
@@ -523,14 +520,14 @@ SPL_METHOD(SplObjectStorage, removeAllExcept)
spl_SplObjectStorageElement *element;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &obj, spl_ce_SplObjectStorage) == FAILURE) {
- return;
+ RETURN_THROWS();
}
other = Z_SPLOBJSTORAGE_P(obj);
ZEND_HASH_FOREACH_PTR(&intern->storage, element) {
- if (!spl_object_storage_contains(other, ZEND_THIS, &element->obj)) {
- spl_object_storage_detach(intern, ZEND_THIS, &element->obj);
+ if (!spl_object_storage_contains(other, &element->obj)) {
+ spl_object_storage_detach(intern, &element->obj);
}
} ZEND_HASH_FOREACH_END();
@@ -542,16 +539,16 @@ SPL_METHOD(SplObjectStorage, removeAllExcept)
/* }}} */
/* {{{ proto bool SplObjectStorage::contains(object obj)
- Determine whethe an object is contained in the storage */
+ Determine whether an object is contained in the storage */
SPL_METHOD(SplObjectStorage, contains)
{
zval *obj;
spl_SplObjectStorage *intern = Z_SPLOBJSTORAGE_P(ZEND_THIS);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &obj) == FAILURE) {
- return;
+ RETURN_THROWS();
}
- RETURN_BOOL(spl_object_storage_contains(intern, ZEND_THIS, obj));
+ RETURN_BOOL(spl_object_storage_contains(intern, obj));
} /* }}} */
/* {{{ proto int SplObjectStorage::count()
@@ -562,7 +559,7 @@ SPL_METHOD(SplObjectStorage, count)
zend_long mode = COUNT_NORMAL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &mode) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (mode == COUNT_RECURSIVE) {
@@ -588,7 +585,7 @@ SPL_METHOD(SplObjectStorage, rewind)
spl_SplObjectStorage *intern = Z_SPLOBJSTORAGE_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
zend_hash_internal_pointer_reset_ex(&intern->storage, &intern->pos);
@@ -602,7 +599,7 @@ SPL_METHOD(SplObjectStorage, valid)
spl_SplObjectStorage *intern = Z_SPLOBJSTORAGE_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_BOOL(zend_hash_has_more_elements_ex(&intern->storage, &intern->pos) == SUCCESS);
@@ -615,7 +612,7 @@ SPL_METHOD(SplObjectStorage, key)
spl_SplObjectStorage *intern = Z_SPLOBJSTORAGE_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_LONG(intern->index);
@@ -629,7 +626,7 @@ SPL_METHOD(SplObjectStorage, current)
spl_SplObjectStorage *intern = Z_SPLOBJSTORAGE_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((element = zend_hash_get_current_data_ptr_ex(&intern->storage, &intern->pos)) == NULL) {
@@ -646,7 +643,7 @@ SPL_METHOD(SplObjectStorage, getInfo)
spl_SplObjectStorage *intern = Z_SPLOBJSTORAGE_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((element = zend_hash_get_current_data_ptr_ex(&intern->storage, &intern->pos)) == NULL) {
@@ -664,7 +661,7 @@ SPL_METHOD(SplObjectStorage, setInfo)
zval *inf;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &inf) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((element = zend_hash_get_current_data_ptr_ex(&intern->storage, &intern->pos)) == NULL) {
@@ -681,7 +678,7 @@ SPL_METHOD(SplObjectStorage, next)
spl_SplObjectStorage *intern = Z_SPLOBJSTORAGE_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
zend_hash_move_forward_ex(&intern->storage, &intern->pos);
@@ -701,7 +698,7 @@ SPL_METHOD(SplObjectStorage, serialize)
smart_str buf = {0};
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
PHP_VAR_SERIALIZE_INIT(var_hash);
@@ -729,7 +726,7 @@ SPL_METHOD(SplObjectStorage, serialize)
/* members */
smart_str_appendl(&buf, "m:", 2);
- ZVAL_ARR(&members, zend_array_dup(zend_std_get_properties(ZEND_THIS)));
+ ZVAL_ARR(&members, zend_array_dup(zend_std_get_properties(Z_OBJ_P(ZEND_THIS))));
php_var_serialize(&buf, &members, &var_hash); /* finishes the string */
zval_ptr_dtor(&members);
@@ -760,7 +757,7 @@ SPL_METHOD(SplObjectStorage, unserialize)
zend_long count;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &buf, &buf_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (buf_len == 0) {
@@ -820,7 +817,7 @@ SPL_METHOD(SplObjectStorage, unserialize)
goto outexcept;
}
- if (spl_object_storage_get_hash(&key, intern, ZEND_THIS, &entry) == FAILURE) {
+ if (spl_object_storage_get_hash(&key, intern, &entry) == FAILURE) {
zval_ptr_dtor(&entry);
zval_ptr_dtor(&inf);
goto outexcept;
@@ -835,7 +832,7 @@ SPL_METHOD(SplObjectStorage, unserialize)
var_push_dtor(&var_hash, &pelement->obj);
}
}
- element = spl_object_storage_attach(intern, ZEND_THIS, &entry, Z_ISUNDEF(inf)?NULL:&inf);
+ element = spl_object_storage_attach(intern, &entry, Z_ISUNDEF(inf)?NULL:&inf);
var_replace(&var_hash, &entry, &element->obj);
var_replace(&var_hash, &inf, &element->inf);
zval_ptr_dtor(&entry);
@@ -869,7 +866,7 @@ SPL_METHOD(SplObjectStorage, unserialize)
outexcept:
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Error at offset %zd of %zd bytes", ((char*)p - buf), buf_len);
- return;
+ RETURN_THROWS();
} /* }}} */
@@ -880,8 +877,8 @@ SPL_METHOD(SplObjectStorage, __serialize)
spl_SplObjectStorageElement *elem;
zval tmp;
- if (zend_parse_parameters_none_throw() == FAILURE) {
- return;
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
}
array_init(return_value);
@@ -897,7 +894,7 @@ SPL_METHOD(SplObjectStorage, __serialize)
zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &tmp);
/* members */
- ZVAL_ARR(&tmp, zend_std_get_properties(ZEND_THIS));
+ ZVAL_ARR(&tmp, zend_std_get_properties(&intern->std));
Z_TRY_ADDREF(tmp);
zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &tmp);
} /* }}} */
@@ -909,8 +906,8 @@ SPL_METHOD(SplObjectStorage, __unserialize)
HashTable *data;
zval *storage_zv, *members_zv, *key, *val;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "h", &data) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "h", &data) == FAILURE) {
+ RETURN_THROWS();
}
storage_zv = zend_hash_index_find(data, 0);
@@ -919,12 +916,12 @@ SPL_METHOD(SplObjectStorage, __unserialize)
Z_TYPE_P(storage_zv) != IS_ARRAY || Z_TYPE_P(members_zv) != IS_ARRAY) {
zend_throw_exception(spl_ce_UnexpectedValueException,
"Incomplete or ill-typed serialization data", 0);
- return;
+ RETURN_THROWS();
}
if (zend_hash_num_elements(Z_ARRVAL_P(storage_zv)) % 2 != 0) {
zend_throw_exception(spl_ce_UnexpectedValueException, "Odd number of elements", 0);
- return;
+ RETURN_THROWS();
}
key = NULL;
@@ -932,10 +929,10 @@ SPL_METHOD(SplObjectStorage, __unserialize)
if (key) {
if (Z_TYPE_P(key) != IS_OBJECT) {
zend_throw_exception(spl_ce_UnexpectedValueException, "Non-object key", 0);
- return;
+ RETURN_THROWS();
}
- spl_object_storage_attach(intern, ZEND_THIS, key, val);
+ spl_object_storage_attach(intern, key, val);
key = NULL;
} else {
key = val;
@@ -1021,8 +1018,8 @@ SPL_METHOD(MultipleIterator, __construct)
spl_SplObjectStorage *intern;
zend_long flags = MIT_NEED_ALL|MIT_KEYS_NUMERIC;
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "|l", &flags) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &flags) == FAILURE) {
+ RETURN_THROWS();
}
intern = Z_SPLOBJSTORAGE_P(ZEND_THIS);
@@ -1037,7 +1034,7 @@ SPL_METHOD(MultipleIterator, getFlags)
spl_SplObjectStorage *intern = Z_SPLOBJSTORAGE_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_LONG(intern->flags);
}
@@ -1051,7 +1048,7 @@ SPL_METHOD(MultipleIterator, setFlags)
intern = Z_SPLOBJSTORAGE_P(ZEND_THIS);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &intern->flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
/* }}} */
@@ -1064,7 +1061,7 @@ SPL_METHOD(MultipleIterator, attachIterator)
zval *iterator = NULL, *info = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O|z!", &iterator, zend_ce_iterator, &info) == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern = Z_SPLOBJSTORAGE_P(ZEND_THIS);
@@ -1074,20 +1071,20 @@ SPL_METHOD(MultipleIterator, attachIterator)
if (Z_TYPE_P(info) != IS_LONG && Z_TYPE_P(info) != IS_STRING) {
zend_throw_exception(spl_ce_InvalidArgumentException, "Info must be NULL, integer or string", 0);
- return;
+ RETURN_THROWS();
}
zend_hash_internal_pointer_reset_ex(&intern->storage, &intern->pos);
while ((element = zend_hash_get_current_data_ptr_ex(&intern->storage, &intern->pos)) != NULL) {
if (fast_is_identical_function(info, &element->inf)) {
zend_throw_exception(spl_ce_InvalidArgumentException, "Key duplication error", 0);
- return;
+ RETURN_THROWS();
}
zend_hash_move_forward_ex(&intern->storage, &intern->pos);
}
}
- spl_object_storage_attach(intern, ZEND_THIS, iterator, info);
+ spl_object_storage_attach(intern, iterator, info);
}
/* }}} */
@@ -1102,13 +1099,13 @@ SPL_METHOD(MultipleIterator, rewind)
intern = Z_SPLOBJSTORAGE_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
zend_hash_internal_pointer_reset_ex(&intern->storage, &intern->pos);
while ((element = zend_hash_get_current_data_ptr_ex(&intern->storage, &intern->pos)) != NULL && !EG(exception)) {
it = &element->obj;
- zend_call_method_with_0_params(it, Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_rewind, "rewind", NULL);
+ zend_call_method_with_0_params(Z_OBJ_P(it), Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_rewind, "rewind", NULL);
zend_hash_move_forward_ex(&intern->storage, &intern->pos);
}
}
@@ -1125,13 +1122,13 @@ SPL_METHOD(MultipleIterator, next)
intern = Z_SPLOBJSTORAGE_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
zend_hash_internal_pointer_reset_ex(&intern->storage, &intern->pos);
while ((element = zend_hash_get_current_data_ptr_ex(&intern->storage, &intern->pos)) != NULL && !EG(exception)) {
it = &element->obj;
- zend_call_method_with_0_params(it, Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_next, "next", NULL);
+ zend_call_method_with_0_params(Z_OBJ_P(it), Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_next, "next", NULL);
zend_hash_move_forward_ex(&intern->storage, &intern->pos);
}
}
@@ -1149,7 +1146,7 @@ SPL_METHOD(MultipleIterator, valid)
intern = Z_SPLOBJSTORAGE_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!zend_hash_num_elements(&intern->storage)) {
@@ -1161,7 +1158,7 @@ SPL_METHOD(MultipleIterator, valid)
zend_hash_internal_pointer_reset_ex(&intern->storage, &intern->pos);
while ((element = zend_hash_get_current_data_ptr_ex(&intern->storage, &intern->pos)) != NULL && !EG(exception)) {
it = &element->obj;
- zend_call_method_with_0_params(it, Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_valid, "valid", &retval);
+ zend_call_method_with_0_params(Z_OBJ_P(it), Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_valid, "valid", &retval);
if (!Z_ISUNDEF(retval)) {
valid = (Z_TYPE(retval) == IS_TRUE);
@@ -1197,7 +1194,7 @@ static void spl_multiple_iterator_get_all(spl_SplObjectStorage *intern, int get_
zend_hash_internal_pointer_reset_ex(&intern->storage, &intern->pos);
while ((element = zend_hash_get_current_data_ptr_ex(&intern->storage, &intern->pos)) != NULL && !EG(exception)) {
it = &element->obj;
- zend_call_method_with_0_params(it, Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_valid, "valid", &retval);
+ zend_call_method_with_0_params(Z_OBJ_P(it), Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_valid, "valid", &retval);
if (!Z_ISUNDEF(retval)) {
valid = Z_TYPE(retval) == IS_TRUE;
@@ -1208,9 +1205,9 @@ static void spl_multiple_iterator_get_all(spl_SplObjectStorage *intern, int get_
if (valid) {
if (SPL_MULTIPLE_ITERATOR_GET_ALL_CURRENT == get_type) {
- zend_call_method_with_0_params(it, Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_current, "current", &retval);
+ zend_call_method_with_0_params(Z_OBJ_P(it), Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_current, "current", &retval);
} else {
- zend_call_method_with_0_params(it, Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_key, "key", &retval);
+ zend_call_method_with_0_params(Z_OBJ_P(it), Z_OBJCE_P(it), &Z_OBJCE_P(it)->iterator_funcs_ptr->zf_key, "key", &retval);
}
if (Z_ISUNDEF(retval)) {
zend_throw_exception(spl_ce_RuntimeException, "Failed to call sub iterator method", 0);
@@ -1257,7 +1254,7 @@ SPL_METHOD(MultipleIterator, current)
intern = Z_SPLOBJSTORAGE_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
spl_multiple_iterator_get_all(intern, SPL_MULTIPLE_ITERATOR_GET_ALL_CURRENT, return_value);
@@ -1272,7 +1269,7 @@ SPL_METHOD(MultipleIterator, key)
intern = Z_SPLOBJSTORAGE_P(ZEND_THIS);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
spl_multiple_iterator_get_all(intern, SPL_MULTIPLE_ITERATOR_GET_ALL_KEY, return_value);
@@ -1296,8 +1293,12 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_MultipleIterator_setflags, 0, 0, 1)
ZEND_ARG_INFO(0, flags)
ZEND_END_ARG_INFO();
+ZEND_BEGIN_ARG_INFO_EX(arginfo_MultipleIterator_construct, 0, 0, 0)
+ ZEND_ARG_INFO(0, flags)
+ZEND_END_ARG_INFO();
+
static const zend_function_entry spl_funcs_MultipleIterator[] = {
- SPL_ME(MultipleIterator, __construct, arginfo_MultipleIterator_setflags, 0)
+ SPL_ME(MultipleIterator, __construct, arginfo_MultipleIterator_construct, 0)
SPL_ME(MultipleIterator, getFlags, arginfo_splobject_void, 0)
SPL_ME(MultipleIterator, setFlags, arginfo_MultipleIterator_setflags, 0)
SPL_ME(MultipleIterator, attachIterator, arginfo_MultipleIterator_attachIterator, 0)
@@ -1324,7 +1325,7 @@ PHP_MINIT_FUNCTION(spl_observer)
spl_handler_SplObjectStorage.offset = XtOffsetOf(spl_SplObjectStorage, std);
spl_handler_SplObjectStorage.get_debug_info = spl_object_storage_debug_info;
- spl_handler_SplObjectStorage.compare_objects = spl_object_storage_compare_objects;
+ spl_handler_SplObjectStorage.compare = spl_object_storage_compare_objects;
spl_handler_SplObjectStorage.clone_obj = spl_object_storage_clone;
spl_handler_SplObjectStorage.get_gc = spl_object_storage_get_gc;
spl_handler_SplObjectStorage.dtor_obj = zend_objects_destroy_object;
diff --git a/ext/spl/spl_observer.h b/ext/spl/spl_observer.h
index 50d65f63ab..dab2ab7e1e 100644
--- a/ext/spl/spl_observer.h
+++ b/ext/spl/spl_observer.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/spl/tests/CallbackFilterIteratorTest-002.phpt b/ext/spl/tests/CallbackFilterIteratorTest-002.phpt
index 6a05aa0aa2..62beb88cd5 100644
--- a/ext/spl/tests/CallbackFilterIteratorTest-002.phpt
+++ b/ext/spl/tests/CallbackFilterIteratorTest-002.phpt
@@ -4,45 +4,45 @@ CallbackFilterIterator 002
<?php
set_error_handler(function($errno, $errstr){
- echo $errstr . "\n";
- return true;
+ echo $errstr . "\n";
+ return true;
});
try {
- new CallbackFilterIterator();
+ new CallbackFilterIterator();
} catch (TypeError $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- new CallbackFilterIterator(null);
+ new CallbackFilterIterator(null);
} catch (TypeError $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- new CallbackFilterIterator(new ArrayIterator(array()), null);
+ new CallbackFilterIterator(new ArrayIterator(array()), null);
} catch (TypeError $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- new CallbackFilterIterator(new ArrayIterator(array()), array());
+ new CallbackFilterIterator(new ArrayIterator(array()), array());
} catch (TypeError $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
$it = new CallbackFilterIterator(new ArrayIterator(array(1)), function() {
- throw new Exception("some message");
+ throw new Exception("some message");
});
try {
- foreach($it as $e);
+ foreach($it as $e);
} catch(Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
--EXPECT--
CallbackFilterIterator::__construct() expects exactly 2 parameters, 0 given
-Argument 1 passed to CallbackFilterIterator::__construct() must implement interface Iterator, null given
+CallbackFilterIterator::__construct() expects exactly 2 parameters, 1 given
CallbackFilterIterator::__construct() expects parameter 2 to be a valid callback, no array or string given
CallbackFilterIterator::__construct() expects parameter 2 to be a valid callback, array must have exactly two members
some message
diff --git a/ext/spl/tests/CallbackFilterIteratorTest.phpt b/ext/spl/tests/CallbackFilterIteratorTest.phpt
index 36bc770a95..bf8f85b8db 100644
--- a/ext/spl/tests/CallbackFilterIteratorTest.phpt
+++ b/ext/spl/tests/CallbackFilterIteratorTest.phpt
@@ -16,13 +16,13 @@ class B {
}
function test($value, $key, $inner) {
- printf("%s / %s / %d / %d\n"
- , $value
- , $key
- , $value == $inner->current()
- , $key == $inner->key()
- );
- return $value === 1 || $value === 4;
+ printf("%s / %s / %d / %d\n"
+ , $value
+ , $key
+ , $value == $inner->current()
+ , $key == $inner->key()
+ );
+ return $value === 1 || $value === 4;
}
$tests = array(
@@ -45,7 +45,7 @@ foreach($tests as $name => $test) {
echo "=> $value\n";
}
- // same test, with no reference to callback
+ // same test, with no reference to callback
$it = new ArrayIterator(range(1, 5));
$it = new CallbackFilterIterator($it, $test());
diff --git a/ext/spl/tests/DirectoryIterator_by_reference.phpt b/ext/spl/tests/DirectoryIterator_by_reference.phpt
index 570d09f406..0f28262190 100644
--- a/ext/spl/tests/DirectoryIterator_by_reference.phpt
+++ b/ext/spl/tests/DirectoryIterator_by_reference.phpt
@@ -7,7 +7,7 @@ Havard Eide <nucleuz@gmail.com>
<?php
$it = new DirectoryIterator(__DIR__);
foreach( $it as &$file ) {
- echo $file . "\n";
+ echo $file . "\n";
}
?>
--EXPECTF--
diff --git a/ext/spl/tests/RecursiveCallbackFilterIteratorTest.phpt b/ext/spl/tests/RecursiveCallbackFilterIteratorTest.phpt
index f55afd8202..7620138eb9 100644
--- a/ext/spl/tests/RecursiveCallbackFilterIteratorTest.phpt
+++ b/ext/spl/tests/RecursiveCallbackFilterIteratorTest.phpt
@@ -16,16 +16,16 @@ class B {
}
function test($value, $key, $inner) {
- if ($inner->hasChildren()) {
- return true;
- }
- printf("%s / %s / %d / %d\n"
- , print_r($value, true)
- , $key
- , $value == $inner->current()
- , $key == $inner->key()
- );
- return $value === 1 || $value === 4;
+ if ($inner->hasChildren()) {
+ return true;
+ }
+ printf("%s / %s / %d / %d\n"
+ , print_r($value, true)
+ , $key
+ , $value == $inner->current()
+ , $key == $inner->key()
+ );
+ return $value === 1 || $value === 4;
}
$tests = array(
@@ -41,7 +41,7 @@ foreach($tests as $name => $test) {
$callback = $test();
$it = new RecursiveArrayIterator(array(1, array(2, 3), array(4, 5)));
$it = new RecursiveCallbackFilterIterator($it, $callback);
- $it = new RecursiveIteratorIterator($it);
+ $it = new RecursiveIteratorIterator($it);
echo " = $name =\n";
@@ -49,11 +49,11 @@ foreach($tests as $name => $test) {
echo "=> $value\n";
}
- // same test, with no reference to callback
+ // same test, with no reference to callback
$it = new RecursiveArrayIterator(array(1, array(2, 3), array(4, 5)));
$it = new RecursiveCallbackFilterIterator($it, $test());
- $it = new RecursiveIteratorIterator($it);
+ $it = new RecursiveIteratorIterator($it);
unset($callback);
foreach($it as $value) {
diff --git a/ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt b/ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt
index 4d8c1394b6..c050f2e79e 100644
--- a/ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt
+++ b/ext/spl/tests/RecursiveDirectoryIterator_getSubPath_basic.phpt
@@ -21,7 +21,7 @@ while($it->valid()) {
}
asort($list);
foreach ($list as $item) {
- echo $item . "\n";
+ echo $item . "\n";
}
?>
--CLEAN--
diff --git a/ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt b/ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt
index 6527d84bfe..e7238252f0 100644
--- a/ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt
+++ b/ext/spl/tests/RecursiveDirectoryIterator_getSubPathname_basic.phpt
@@ -24,7 +24,7 @@ while($it->valid()) {
}
asort($list);
foreach ($list as $item) {
- echo $item . "\n";
+ echo $item . "\n";
}
?>
--CLEAN--
diff --git a/ext/spl/tests/SplDoublyLinkedList_add_invalid_offset.phpt b/ext/spl/tests/SplDoublyLinkedList_add_invalid_offset.phpt
index fa38d93425..401d8ae1b3 100644
--- a/ext/spl/tests/SplDoublyLinkedList_add_invalid_offset.phpt
+++ b/ext/spl/tests/SplDoublyLinkedList_add_invalid_offset.phpt
@@ -3,10 +3,10 @@ Check that SplDoublyLinkedList::add throws an exception with an invalid offset a
--FILE--
<?php
try {
- $dll = new SplDoublyLinkedList();
- var_dump($dll->add(12,'Offset 12 should not exist'));
+ $dll = new SplDoublyLinkedList();
+ var_dump($dll->add(12,'Offset 12 should not exist'));
} catch (OutOfRangeException $e) {
- echo "Exception: ".$e->getMessage()."\n";
+ echo "Exception: ".$e->getMessage()."\n";
}
?>
--EXPECT--
diff --git a/ext/spl/tests/SplDoublyLinkedList_add_null_offset.phpt b/ext/spl/tests/SplDoublyLinkedList_add_null_offset.phpt
index b14c9ab013..f8c58d9c70 100644
--- a/ext/spl/tests/SplDoublyLinkedList_add_null_offset.phpt
+++ b/ext/spl/tests/SplDoublyLinkedList_add_null_offset.phpt
@@ -3,10 +3,10 @@ Check that SplDoublyLinkedList::add throws an exception with an invalid offset a
--FILE--
<?php
try {
- $dll = new SplDoublyLinkedList();
- var_dump($dll->add(NULL,2));
+ $dll = new SplDoublyLinkedList();
+ var_dump($dll->add(NULL,2));
} catch (OutOfRangeException $e) {
- echo "Exception: ".$e->getMessage()."\n";
+ echo "Exception: ".$e->getMessage()."\n";
}
?>
--EXPECT--
diff --git a/ext/spl/tests/SplDoublyLinkedList_debug-info.phpt b/ext/spl/tests/SplDoublyLinkedList_debug-info.phpt
index c5d10919ff..b008715eef 100644
--- a/ext/spl/tests/SplDoublyLinkedList_debug-info.phpt
+++ b/ext/spl/tests/SplDoublyLinkedList_debug-info.phpt
@@ -4,16 +4,16 @@ Check that SplDoublyLinkedList returns debug info when print_r is used.
PHPNW Testfest 2009 - Paul Court ( g@rgoyle.com )
--FILE--
<?php
- // Create a new Doubly Linked List
- $dll = new SplDoublyLinkedList();
+ // Create a new Doubly Linked List
+ $dll = new SplDoublyLinkedList();
- // Add some items to the list
- $dll->push(1);
- $dll->push(2);
- $dll->push(3);
+ // Add some items to the list
+ $dll->push(1);
+ $dll->push(2);
+ $dll->push(3);
- // Check the debug info
- print_r($dll);
+ // Check the debug info
+ print_r($dll);
?>
--EXPECT--
SplDoublyLinkedList Object
diff --git a/ext/spl/tests/SplDoublyLinkedList_isEmpty_empty.phpt b/ext/spl/tests/SplDoublyLinkedList_isEmpty_empty.phpt
index 4e9e2b33de..8c8012202e 100644
--- a/ext/spl/tests/SplDoublyLinkedList_isEmpty_empty.phpt
+++ b/ext/spl/tests/SplDoublyLinkedList_isEmpty_empty.phpt
@@ -4,10 +4,10 @@ Check that SplDoublyLinkedList->isEmpty() correctly returns true for an empty li
PHPNW Testfest 2009 - Paul Court ( g@rgoyle.com )
--FILE--
<?php
- // Create a new Doubly Linked List
- $dll = new SplDoublyLinkedList();
+ // Create a new Doubly Linked List
+ $dll = new SplDoublyLinkedList();
- var_dump($dll->isEmpty());
+ var_dump($dll->isEmpty());
?>
--EXPECT--
bool(true)
diff --git a/ext/spl/tests/SplDoublyLinkedList_isEmpty_not-empty.phpt b/ext/spl/tests/SplDoublyLinkedList_isEmpty_not-empty.phpt
index 4b308f345b..0d26da14d5 100644
--- a/ext/spl/tests/SplDoublyLinkedList_isEmpty_not-empty.phpt
+++ b/ext/spl/tests/SplDoublyLinkedList_isEmpty_not-empty.phpt
@@ -4,16 +4,16 @@ Check that SplDoublyLinkedList->isEmpty() correctly returns true for a non-empty
PHPNW Testfest 2009 - Paul Court ( g@rgoyle.com )
--FILE--
<?php
- // Create a new Doubly Linked List
- $dll = new SplDoublyLinkedList();
+ // Create a new Doubly Linked List
+ $dll = new SplDoublyLinkedList();
- // Add some items to the list
- $dll->push(1);
- $dll->push(2);
- $dll->push(3);
- //var_dump($dll);
+ // Add some items to the list
+ $dll->push(1);
+ $dll->push(2);
+ $dll->push(3);
+ //var_dump($dll);
- var_dump($dll->isEmpty());
+ var_dump($dll->isEmpty());
?>
--EXPECT--
bool(false)
diff --git a/ext/spl/tests/SplDoublyLinkedList_offsetExists_success.phpt b/ext/spl/tests/SplDoublyLinkedList_offsetExists_success.phpt
index fc8c4b7dcd..a6c5db200e 100644
--- a/ext/spl/tests/SplDoublyLinkedList_offsetExists_success.phpt
+++ b/ext/spl/tests/SplDoublyLinkedList_offsetExists_success.phpt
@@ -12,17 +12,17 @@ $list->push('def');
// Validate that we can see the first value
if($list->offsetExists(0) === true) {
- echo "PASS\n";
+ echo "PASS\n";
}
// Validate that we can see the second value
if($list->offsetExists(1) === true) {
- echo "PASS\n";
+ echo "PASS\n";
}
// Check that there is no third value
if($list->offsetExists(2) === false) {
- echo "PASS\n";
+ echo "PASS\n";
}
?>
--EXPECT--
diff --git a/ext/spl/tests/SplDoublyLinkedList_offsetUnset_negative-parameter.phpt b/ext/spl/tests/SplDoublyLinkedList_offsetUnset_negative-parameter.phpt
index 838100be1e..364eb5ca79 100644
--- a/ext/spl/tests/SplDoublyLinkedList_offsetUnset_negative-parameter.phpt
+++ b/ext/spl/tests/SplDoublyLinkedList_offsetUnset_negative-parameter.phpt
@@ -4,20 +4,20 @@ Check that SplDoublyLinkedList->offsetUnset() returns an error message when the
PHPNW Testfest 2009 - Paul Court ( g@rgoyle.com )
--FILE--
<?php
- // Create a new Doubly Linked List
- $dll = new SplDoublyLinkedList();
+ // Create a new Doubly Linked List
+ $dll = new SplDoublyLinkedList();
- // Add some items to the list
- $dll->push(1);
- $dll->push(2);
- $dll->push(3);
+ // Add some items to the list
+ $dll->push(1);
+ $dll->push(2);
+ $dll->push(3);
- try {
- $dll->offsetUnset(-1);
- }
- catch (Exception $e) {
- echo $e->getMessage() . "\n";
- }
+ try {
+ $dll->offsetUnset(-1);
+ }
+ catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+ }
?>
--EXPECT--
Offset out of range
diff --git a/ext/spl/tests/SplDoublyLinkedList_offsetUnset_parameter-larger-num-elements.phpt b/ext/spl/tests/SplDoublyLinkedList_offsetUnset_parameter-larger-num-elements.phpt
index cd77f11aef..5ba7b27e56 100644
--- a/ext/spl/tests/SplDoublyLinkedList_offsetUnset_parameter-larger-num-elements.phpt
+++ b/ext/spl/tests/SplDoublyLinkedList_offsetUnset_parameter-larger-num-elements.phpt
@@ -4,20 +4,20 @@ Check that SplDoublyLinkedList->offsetUnset() returns an error message when the
PHPNW Testfest 2009 - Paul Court ( g@rgoyle.com )
--FILE--
<?php
- // Create a new Doubly Linked List
- $dll = new SplDoublyLinkedList();
+ // Create a new Doubly Linked List
+ $dll = new SplDoublyLinkedList();
- // Add some items to the list
- $dll->push(1);
- $dll->push(2);
- $dll->push(3);
+ // Add some items to the list
+ $dll->push(1);
+ $dll->push(2);
+ $dll->push(3);
- try {
- $dll->offsetUnset(3);
- }
- catch (Exception $e) {
- echo $e->getMessage() . "\n";
- }
+ try {
+ $dll->offsetUnset(3);
+ }
+ catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+ }
?>
--EXPECT--
Offset out of range
diff --git a/ext/spl/tests/SplFileInfo_setFileClass_error.phpt b/ext/spl/tests/SplFileInfo_setFileClass_error.phpt
index 7443998013..db0186f218 100644
--- a/ext/spl/tests/SplFileInfo_setFileClass_error.phpt
+++ b/ext/spl/tests/SplFileInfo_setFileClass_error.phpt
@@ -7,7 +7,7 @@ $info = new SplFileInfo(__FILE__);
try {
$info->setFileClass('stdClass');
-} catch (UnexpectedValueException $e) {
+} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
diff --git a/ext/spl/tests/SplFileInfo_setInfoClass_error.phpt b/ext/spl/tests/SplFileInfo_setInfoClass_error.phpt
index a280a6e147..9a2e71defe 100644
--- a/ext/spl/tests/SplFileInfo_setInfoClass_error.phpt
+++ b/ext/spl/tests/SplFileInfo_setInfoClass_error.phpt
@@ -7,7 +7,7 @@ $info = new SplFileInfo(__FILE__);
try {
$info->setInfoClass('stdClass');
-} catch (UnexpectedValueException $e) {
+} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
diff --git a/ext/spl/tests/SplFileObject_fgetcsv_basic.phpt b/ext/spl/tests/SplFileObject_fgetcsv_basic.phpt
index 28901050d3..2580021426 100644
--- a/ext/spl/tests/SplFileObject_fgetcsv_basic.phpt
+++ b/ext/spl/tests/SplFileObject_fgetcsv_basic.phpt
@@ -4,10 +4,10 @@ SplFileObject::fgetcsv default path
<?php
$fp = fopen('SplFileObject__fgetcsv1.csv', 'w+');
fputcsv($fp, array(
- 'field1',
- 'field2',
- 'field3',
- 5
+ 'field1',
+ 'field2',
+ 'field3',
+ 5
));
fclose($fp);
diff --git a/ext/spl/tests/SplFileObject_fgetcsv_delimiter_basic.phpt b/ext/spl/tests/SplFileObject_fgetcsv_delimiter_basic.phpt
index 585e0b6e39..6bf5b43f6b 100644
--- a/ext/spl/tests/SplFileObject_fgetcsv_delimiter_basic.phpt
+++ b/ext/spl/tests/SplFileObject_fgetcsv_delimiter_basic.phpt
@@ -4,10 +4,10 @@ SplFileObject::fgetcsv with alternative delimiter
<?php
$fp = fopen('SplFileObject__fgetcsv2.csv', 'w+');
fputcsv($fp, array(
- 'field1',
- 'field2',
- 'field3',
- 5
+ 'field1',
+ 'field2',
+ 'field3',
+ 5
), '|');
fclose($fp);
diff --git a/ext/spl/tests/SplFileObject_fgetcsv_delimiter_error.phpt b/ext/spl/tests/SplFileObject_fgetcsv_delimiter_error.phpt
index 169ded7dc3..2db10f989a 100644
--- a/ext/spl/tests/SplFileObject_fgetcsv_delimiter_error.phpt
+++ b/ext/spl/tests/SplFileObject_fgetcsv_delimiter_error.phpt
@@ -4,10 +4,10 @@ SplFileObject::fgetcsv with alternative delimiter
<?php
$fp = fopen('SplFileObject__fgetcsv3.csv', 'w+');
fputcsv($fp, array(
- 'field1',
- 'field2',
- 'field3',
- 5
+ 'field1',
+ 'field2',
+ 'field3',
+ 5
), '|');
fclose($fp);
diff --git a/ext/spl/tests/SplFileObject_fgetcsv_enclosure_basic.phpt b/ext/spl/tests/SplFileObject_fgetcsv_enclosure_basic.phpt
index 32527a9238..971e44ba4d 100644
--- a/ext/spl/tests/SplFileObject_fgetcsv_enclosure_basic.phpt
+++ b/ext/spl/tests/SplFileObject_fgetcsv_enclosure_basic.phpt
@@ -4,10 +4,10 @@ SplFileObject::fgetcsv with alternative delimiter
<?php
$fp = fopen('SplFileObject__fgetcsv4.csv', 'w+');
fputcsv($fp, array(
- 'field1',
- 'field2',
- 'field3',
- 5
+ 'field1',
+ 'field2',
+ 'field3',
+ 5
), ',', '"');
fclose($fp);
diff --git a/ext/spl/tests/SplFileObject_fgetcsv_enclosure_error.phpt b/ext/spl/tests/SplFileObject_fgetcsv_enclosure_error.phpt
index f8c14f0e35..6dd0a593c5 100644
--- a/ext/spl/tests/SplFileObject_fgetcsv_enclosure_error.phpt
+++ b/ext/spl/tests/SplFileObject_fgetcsv_enclosure_error.phpt
@@ -4,10 +4,10 @@ SplFileObject::fgetcsv with alternative delimiter
<?php
$fp = fopen('SplFileObject__fgetcsv5.csv', 'w+');
fputcsv($fp, array(
- 'field1',
- 'field2',
- 'field3',
- 5
+ 'field1',
+ 'field2',
+ 'field3',
+ 5
), ',', '"');
fclose($fp);
diff --git a/ext/spl/tests/SplFileObject_fgetcsv_escape_empty.phpt b/ext/spl/tests/SplFileObject_fgetcsv_escape_empty.phpt
index cbc539c323..0498b6c912 100644
--- a/ext/spl/tests/SplFileObject_fgetcsv_escape_empty.phpt
+++ b/ext/spl/tests/SplFileObject_fgetcsv_escape_empty.phpt
@@ -14,7 +14,6 @@ while (($data = $file->fgetcsv(',', '"', ''))) {
print_r($data);
}
?>
-===DONE===
--EXPECT--
Array
(
@@ -28,4 +27,3 @@ Array
[0] => \\\line1
line2\\\
)
-===DONE===
diff --git a/ext/spl/tests/SplFileObject_fputcsv.phpt b/ext/spl/tests/SplFileObject_fputcsv.phpt
index 66fdbfd1b9..ec32ae686b 100644
--- a/ext/spl/tests/SplFileObject_fputcsv.phpt
+++ b/ext/spl/tests/SplFileObject_fputcsv.phpt
@@ -29,14 +29,14 @@ $list = array (
);
foreach ($list as $v) {
- $fo->fputcsv(explode(',', $v));
+ $fo->fputcsv(explode(',', $v));
}
unset($fo);
$res = file($file);
foreach($res as &$val)
{
- $val = substr($val, 0, -1);
+ $val = substr($val, 0, -1);
}
echo '$list = ';var_export($res);echo ";\n";
@@ -44,15 +44,13 @@ $fp = fopen($file, "r");
$res = array();
while($l=fgetcsv($fp))
{
- $res[] = join(',',$l);
+ $res[] = join(',',$l);
}
fclose($fp);
echo '$list = ';var_export($res);echo ";\n";
?>
-===DONE===
-<?php exit(0); ?>
--CLEAN--
<?php
$file = __DIR__ . '/SplFileObject_fputcsv.csv';
@@ -103,4 +101,3 @@ $list = array (
18 => '"\\"","aaa"',
19 => '"\\""",aaa',
);
-===DONE===
diff --git a/ext/spl/tests/SplFileObject_fputcsv_002.phpt b/ext/spl/tests/SplFileObject_fputcsv_002.phpt
index fdd4112ee6..77f6d76bbf 100644
--- a/ext/spl/tests/SplFileObject_fputcsv_002.phpt
+++ b/ext/spl/tests/SplFileObject_fputcsv_002.phpt
@@ -16,7 +16,7 @@ $file = __DIR__ . '/SplFileObject_fputcsv1.csv';
unlink($file);
?>
--EXPECTF--
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
array(7) {
[0]=>
int(1)
diff --git a/ext/spl/tests/SplFileObject_fputcsv_variation15.phpt b/ext/spl/tests/SplFileObject_fputcsv_variation15.phpt
index 1cde292e28..0762af9f21 100644
--- a/ext/spl/tests/SplFileObject_fputcsv_variation15.phpt
+++ b/ext/spl/tests/SplFileObject_fputcsv_variation15.phpt
@@ -15,8 +15,6 @@ foreach ($file as $line) {
echo $line;
}
?>
-===DONE===
--EXPECT--
\
"\"""
-===DONE===
diff --git a/ext/spl/tests/SplFileObject_ftruncate_error_001.phpt b/ext/spl/tests/SplFileObject_ftruncate_error_001.phpt
index 831e855b85..4e0642c6ae 100644
--- a/ext/spl/tests/SplFileObject_ftruncate_error_001.phpt
+++ b/ext/spl/tests/SplFileObject_ftruncate_error_001.phpt
@@ -23,9 +23,9 @@ $ftruncate_test = "";
//open an SplFileObject using the above test stream
$obj = New SplFileObject("SPLtest://ftruncate_test");
try {
- $obj->ftruncate(1);
+ $obj->ftruncate(1);
} catch (LogicException $e) {
- echo($e->getMessage());
+ echo($e->getMessage());
}
?>
--EXPECTF--
diff --git a/ext/spl/tests/SplFileObject_fwrite_variation_001.phpt b/ext/spl/tests/SplFileObject_fwrite_variation_001.phpt
index a8e36cd046..999adaa3c8 100644
--- a/ext/spl/tests/SplFileObject_fwrite_variation_001.phpt
+++ b/ext/spl/tests/SplFileObject_fwrite_variation_001.phpt
@@ -4,7 +4,7 @@ SplFileObject::fwrite function - writing with two parameters length < input stri
<?php
$file = __DIR__.'/SplFileObject_fwrite_variation_001.txt';
if(file_exists($file)) {
- unlink($file);
+ unlink($file);
}
$obj = New SplFileObject($file,'w');
$obj->fwrite('test_write',4);
diff --git a/ext/spl/tests/SplFileObject_fwrite_variation_002.phpt b/ext/spl/tests/SplFileObject_fwrite_variation_002.phpt
index cea92a349c..6c061eed84 100644
--- a/ext/spl/tests/SplFileObject_fwrite_variation_002.phpt
+++ b/ext/spl/tests/SplFileObject_fwrite_variation_002.phpt
@@ -4,7 +4,7 @@ SplFileObject::fwrite function - writing with two parameters, length > input str
<?php
$file = __DIR__.'/SplFileObject_fwrite_variation_002.txt';
if(file_exists($file)) {
- unlink($file);
+ unlink($file);
}
$obj = New SplFileObject($file,'w');
$obj->fwrite('test_write',12);
diff --git a/ext/spl/tests/SplFileObject_seek_error_001.phpt b/ext/spl/tests/SplFileObject_seek_error_001.phpt
index 4de5bcdd4d..acebb66f41 100644
--- a/ext/spl/tests/SplFileObject_seek_error_001.phpt
+++ b/ext/spl/tests/SplFileObject_seek_error_001.phpt
@@ -2,17 +2,12 @@
SplFileObject::seek function - test parameters
--FILE--
<?php
-$obj = New SplFileObject(__FILE__);
-$obj->seek(1,2);
-$obj->seek();
+$obj = new SplFileObject(__FILE__);
try {
- $obj->seek(-1);
+ $obj->seek(-1);
} catch (LogicException $e) {
- echo($e->getMessage());
+ echo($e->getMessage());
}
?>
--EXPECTF--
-Warning: SplFileObject::seek() expects exactly 1 parameter, 2 given in %s
-
-Warning: SplFileObject::seek() expects exactly 1 parameter, 0 given in %s
-Can't seek file %s to negative line %s
+Can't seek file %s to negative line -1
diff --git a/ext/spl/tests/SplFileObject_setCsvControl_variation002.phpt b/ext/spl/tests/SplFileObject_setCsvControl_variation002.phpt
index 6d3a76ce94..39b526a86a 100644
--- a/ext/spl/tests/SplFileObject_setCsvControl_variation002.phpt
+++ b/ext/spl/tests/SplFileObject_setCsvControl_variation002.phpt
@@ -6,7 +6,6 @@ $file = new SplTempFileObject;
$file->setCsvControl(',', '"', '');
var_dump($file->getCsvControl());
?>
-===DONE===
--EXPECT--
array(3) {
[0]=>
@@ -16,4 +15,3 @@ array(3) {
[2]=>
string(0) ""
}
-===DONE===
diff --git a/ext/spl/tests/SplFixedArray__construct_param_array.phpt b/ext/spl/tests/SplFixedArray__construct_param_array.phpt
index 89983c377e..15e1c0c438 100644
--- a/ext/spl/tests/SplFixedArray__construct_param_array.phpt
+++ b/ext/spl/tests/SplFixedArray__construct_param_array.phpt
@@ -6,9 +6,9 @@ PHPNW Test Fest 2009 - Jordan Hatch
<?php
try {
- $array = new SplFixedArray( array("string", 1) );
+ $array = new SplFixedArray( array("string", 1) );
} catch (TypeError $iae) {
- echo "Ok - ".$iae->getMessage().PHP_EOL;
+ echo "Ok - ".$iae->getMessage().PHP_EOL;
}
?>
diff --git a/ext/spl/tests/SplFixedArray__construct_param_string.phpt b/ext/spl/tests/SplFixedArray__construct_param_string.phpt
index bfec39de32..654ac4b95f 100644
--- a/ext/spl/tests/SplFixedArray__construct_param_string.phpt
+++ b/ext/spl/tests/SplFixedArray__construct_param_string.phpt
@@ -5,9 +5,9 @@ PHPNW Test Fest 2009 - Jordan Hatch
--FILE--
<?php
try {
- $array = new SplFixedArray( "string" );
+ $array = new SplFixedArray( "string" );
} catch (TypeError $iae) {
- echo "Ok - ".$iae->getMessage().PHP_EOL;
+ echo "Ok - ".$iae->getMessage().PHP_EOL;
}
diff --git a/ext/spl/tests/SplFixedArray_construct_param_SplFixedArray.phpt b/ext/spl/tests/SplFixedArray_construct_param_SplFixedArray.phpt
index af9f5f3ee8..efb1d0e65d 100644
--- a/ext/spl/tests/SplFixedArray_construct_param_SplFixedArray.phpt
+++ b/ext/spl/tests/SplFixedArray_construct_param_SplFixedArray.phpt
@@ -5,9 +5,9 @@ Philip Norton philipnorton42@gmail.com
--FILE--
<?php
try {
- $array = new SplFixedArray(new SplFixedArray(3));
+ $array = new SplFixedArray(new SplFixedArray(3));
} catch (TypeError $iae) {
- echo "Ok - ".$iae->getMessage().PHP_EOL;
+ echo "Ok - ".$iae->getMessage().PHP_EOL;
}
?>
diff --git a/ext/spl/tests/SplFixedArray_fromarray_indexes.phpt b/ext/spl/tests/SplFixedArray_fromarray_indexes.phpt
index c649e3b6c3..8ec02b8d49 100644
--- a/ext/spl/tests/SplFixedArray_fromarray_indexes.phpt
+++ b/ext/spl/tests/SplFixedArray_fromarray_indexes.phpt
@@ -5,8 +5,8 @@ Philip Norton philipnorton42@gmail.com
--FILE--
<?php
$array = SplFixedArray::fromArray(array(1 => 1,
- 2 => '2',
- 3 => false));
+ 2 => '2',
+ 3 => false));
var_dump($array);
?>
--EXPECT--
diff --git a/ext/spl/tests/SplFixedArray_fromarray_non_indexes.phpt b/ext/spl/tests/SplFixedArray_fromarray_non_indexes.phpt
index b3e7497397..af5f663f33 100644
--- a/ext/spl/tests/SplFixedArray_fromarray_non_indexes.phpt
+++ b/ext/spl/tests/SplFixedArray_fromarray_non_indexes.phpt
@@ -5,9 +5,9 @@ Philip Norton philipnorton42@gmail.com
--FILE--
<?php
$array = SplFixedArray::fromArray(array(1 => 1,
- 2 => '2',
- 3 => false),
- false);
+ 2 => '2',
+ 3 => false),
+ false);
var_dump($array);
?>
--EXPECT--
diff --git a/ext/spl/tests/SplFixedArray_indirect_modification.phpt b/ext/spl/tests/SplFixedArray_indirect_modification.phpt
new file mode 100644
index 0000000000..ab85b3a09e
--- /dev/null
+++ b/ext/spl/tests/SplFixedArray_indirect_modification.phpt
@@ -0,0 +1,14 @@
+--TEST--
+SplFixedArray indirect modification notice
+--FILE--
+<?php
+$a = new SplFixedArray(1);
+$a[0][] = 3;
+var_dump($a);
+?>
+--EXPECTF--
+Notice: Indirect modification of overloaded element of SplFixedArray has no effect in %s on line %d
+object(SplFixedArray)#1 (1) {
+ [0]=>
+ NULL
+}
diff --git a/ext/spl/tests/SplFixedArray_key_setsize.phpt b/ext/spl/tests/SplFixedArray_key_setsize.phpt
index 091c4650e2..5c035e71c7 100644
--- a/ext/spl/tests/SplFixedArray_key_setsize.phpt
+++ b/ext/spl/tests/SplFixedArray_key_setsize.phpt
@@ -12,7 +12,7 @@ $array[1] = "world";
$array[2] = "elePHPant";
foreach ( $array as $value ) {
- echo $array->key( );
+ echo $array->key( );
}
?>
diff --git a/ext/spl/tests/SplFixedArray_offsetExists_less_than_zero.phpt b/ext/spl/tests/SplFixedArray_offsetExists_less_than_zero.phpt
index 9bfda34073..da6acd15ca 100644
--- a/ext/spl/tests/SplFixedArray_offsetExists_less_than_zero.phpt
+++ b/ext/spl/tests/SplFixedArray_offsetExists_less_than_zero.phpt
@@ -6,7 +6,7 @@ PHPNW TestFest 2009 - Ben Longden
<?php
$array = new SplFixedArray(5);
if($array->offsetExists(-10) === false) {
- echo 'PASS';
+ echo 'PASS';
}
?>
--EXPECT--
diff --git a/ext/spl/tests/SplFixedArray_offsetUnset_string.phpt b/ext/spl/tests/SplFixedArray_offsetUnset_string.phpt
index 3b0e6bb222..1d7c50d39e 100644
--- a/ext/spl/tests/SplFixedArray_offsetUnset_string.phpt
+++ b/ext/spl/tests/SplFixedArray_offsetUnset_string.phpt
@@ -4,18 +4,18 @@ Check removing an item from an array when the offset is not an integer.
PHPNW Testfest 2009 - Paul Court ( g@rgoyle.com )
--FILE--
<?php
- // Create a fixed array
- $fixedArray = new SplFixedArray(5);
+ // Create a fixed array
+ $fixedArray = new SplFixedArray(5);
- // Fill it up
- for ($i=0; $i < 5; $i++) {
- $fixedArray[$i] = "PHPNW Testfest";
- }
+ // Fill it up
+ for ($i=0; $i < 5; $i++) {
+ $fixedArray[$i] = "PHPNW Testfest";
+ }
- // remove an item
- $fixedArray->offsetUnset("4");
+ // remove an item
+ $fixedArray->offsetUnset("4");
- var_dump($fixedArray);
+ var_dump($fixedArray);
?>
--EXPECT--
diff --git a/ext/spl/tests/SplObjectStorage_getHash.phpt b/ext/spl/tests/SplObjectStorage_getHash.phpt
index f309b3d84f..85cdcb4e7a 100644
--- a/ext/spl/tests/SplObjectStorage_getHash.phpt
+++ b/ext/spl/tests/SplObjectStorage_getHash.phpt
@@ -49,7 +49,6 @@ $s3[$o2] = $o2;
var_dump($s3[$o1] === $s3[$o2]);
?>
-===DONE===
--EXPECT--
some_value
caught
@@ -57,4 +56,3 @@ caught
object(stdClass)#2 (0) {
}
bool(true)
-===DONE===
diff --git a/ext/spl/tests/SplObjectStorage_offsetGet_missing_object.phpt b/ext/spl/tests/SplObjectStorage_offsetGet_missing_object.phpt
index fa2c7aabe9..54fcc23d4d 100644
--- a/ext/spl/tests/SplObjectStorage_offsetGet_missing_object.phpt
+++ b/ext/spl/tests/SplObjectStorage_offsetGet_missing_object.phpt
@@ -9,9 +9,9 @@ $s = new SplObjectStorage();
$o1 = new stdClass();
try {
- $s->offsetGet($o1);
+ $s->offsetGet($o1);
} catch (UnexpectedValueException $e) {
- echo $e->getMessage();
+ echo $e->getMessage();
}
?>
diff --git a/ext/spl/tests/SplObjectStorage_unserialize_bad.phpt b/ext/spl/tests/SplObjectStorage_unserialize_bad.phpt
index a5678eab40..a0f3e8c93d 100644
--- a/ext/spl/tests/SplObjectStorage_unserialize_bad.phpt
+++ b/ext/spl/tests/SplObjectStorage_unserialize_bad.phpt
@@ -15,7 +15,7 @@ try {
$so->unserialize($blob);
var_dump($so);
} catch(UnexpectedValueException $e) {
- echo $e->getMessage()."\n";
+ echo $e->getMessage()."\n";
}
}
echo "DONE\n";
diff --git a/ext/spl/tests/SplObjectStorage_unserialize_invalid_parameter2.phpt b/ext/spl/tests/SplObjectStorage_unserialize_invalid_parameter2.phpt
index 8ea0b6656e..0ff158c85c 100644
--- a/ext/spl/tests/SplObjectStorage_unserialize_invalid_parameter2.phpt
+++ b/ext/spl/tests/SplObjectStorage_unserialize_invalid_parameter2.phpt
@@ -15,7 +15,7 @@ $data_provider = array(
foreach($data_provider as $input) {
- $s = new SplObjectStorage();
+ $s = new SplObjectStorage();
try {
$s->unserialize($input);
diff --git a/ext/spl/tests/SplQueue_setIteratorMode_param_lifo.phpt b/ext/spl/tests/SplQueue_setIteratorMode_param_lifo.phpt
index c3071f2399..255f0cd2e4 100644
--- a/ext/spl/tests/SplQueue_setIteratorMode_param_lifo.phpt
+++ b/ext/spl/tests/SplQueue_setIteratorMode_param_lifo.phpt
@@ -7,11 +7,11 @@ PHPNW Test Fest 2009 - Jeremy Coates jeremy@phpnw.org.uk
try {
- $dll = new SplQueue();
- $dll->setIteratorMode(SplDoublyLinkedList::IT_MODE_LIFO);
+ $dll = new SplQueue();
+ $dll->setIteratorMode(SplDoublyLinkedList::IT_MODE_LIFO);
} catch (Exception $e) {
- echo $e->getMessage();
+ echo $e->getMessage();
}
?>
diff --git a/ext/spl/tests/arrayObject___construct_basic2.phpt b/ext/spl/tests/arrayObject___construct_basic2.phpt
index 9295f40e51..2e5970004e 100644
--- a/ext/spl/tests/arrayObject___construct_basic2.phpt
+++ b/ext/spl/tests/arrayObject___construct_basic2.phpt
@@ -3,11 +3,11 @@ SPL: ArrayObject::__construct basic usage.
--FILE--
<?php
class C {
- public $prop = 'C::prop.orig';
+ public $prop = 'C::prop.orig';
}
class MyArrayObject extends ArrayObject {
- public $prop = 'MyArrayObject::prop.orig';
+ public $prop = 'MyArrayObject::prop.orig';
}
echo "--> Access prop on instance of ArrayObject:\n";
@@ -21,29 +21,29 @@ $ao = new MyArrayObject($c);
testAccess($c, $ao);
function testAccess($c, $ao) {
- echo " - Iteration:\n";
- foreach ($ao as $key=>$value) {
- echo " $key=>$value\n";
- }
+ echo " - Iteration:\n";
+ foreach ($ao as $key=>$value) {
+ echo " $key=>$value\n";
+ }
- echo " - Read:\n";
- @var_dump($ao->prop, $ao['prop']);
+ echo " - Read:\n";
+ @var_dump($ao->prop, $ao['prop']);
- echo " - Write:\n";
- $ao->prop = 'changed1';
- $ao['prop'] = 'changed2';
- var_dump($ao->prop, $ao['prop']);
+ echo " - Write:\n";
+ $ao->prop = 'changed1';
+ $ao['prop'] = 'changed2';
+ var_dump($ao->prop, $ao['prop']);
- echo " - Isset:\n";
- var_dump(isset($ao->prop), isset($ao['prop']));
+ echo " - Isset:\n";
+ var_dump(isset($ao->prop), isset($ao['prop']));
- echo " - Unset:\n";
- unset($ao->prop);
- unset($ao['prop']);
- var_dump($ao->prop, $ao['prop']);
+ echo " - Unset:\n";
+ unset($ao->prop);
+ unset($ao['prop']);
+ var_dump($ao->prop, $ao['prop']);
- echo " - After:\n";
- var_dump($ao, $c);
+ echo " - After:\n";
+ var_dump($ao, $c);
}
?>
--EXPECTF--
@@ -61,7 +61,7 @@ bool(true)
bool(true)
- Unset:
-Notice: Undefined property: ArrayObject::$prop in %s on line 40
+Warning: Undefined property: ArrayObject::$prop in %s on line %d
Notice: Undefined index: prop in %s on line 40
NULL
@@ -89,7 +89,7 @@ bool(true)
bool(true)
- Unset:
-Notice: Undefined property: MyArrayObject::$prop in %s on line 40
+Warning: Undefined property: MyArrayObject::$prop in %s on line %d
Notice: Undefined index: prop in %s on line 40
NULL
diff --git a/ext/spl/tests/arrayObject___construct_basic3.phpt b/ext/spl/tests/arrayObject___construct_basic3.phpt
index fcd369af84..2628c991a7 100644
--- a/ext/spl/tests/arrayObject___construct_basic3.phpt
+++ b/ext/spl/tests/arrayObject___construct_basic3.phpt
@@ -3,11 +3,11 @@ SPL: ArrayObject::__construct basic usage with ArrayObject::STD_PROP_LIST.
--FILE--
<?php
class C {
- public $prop = 'C::prop.orig';
+ public $prop = 'C::prop.orig';
}
class MyArrayObject extends ArrayObject {
- public $prop = 'MyArrayObject::prop.orig';
+ public $prop = 'MyArrayObject::prop.orig';
}
echo "\n--> Access prop on instance of ArrayObject with ArrayObject::STD_PROP_LIST:\n";
@@ -21,29 +21,29 @@ $ao = new MyArrayObject($c, ArrayObject::STD_PROP_LIST);
testAccess($c, $ao);
function testAccess($c, $ao) {
- echo " - Iteration:\n";
- foreach ($ao as $key=>$value) {
- echo " $key=>$value\n";
- }
+ echo " - Iteration:\n";
+ foreach ($ao as $key=>$value) {
+ echo " $key=>$value\n";
+ }
- echo " - Read:\n";
- @var_dump($ao->prop, $ao['prop']);
+ echo " - Read:\n";
+ @var_dump($ao->prop, $ao['prop']);
- echo " - Write:\n";
- $ao->prop = 'changed1';
- $ao['prop'] = 'changed2';
- var_dump($ao->prop, $ao['prop']);
+ echo " - Write:\n";
+ $ao->prop = 'changed1';
+ $ao['prop'] = 'changed2';
+ var_dump($ao->prop, $ao['prop']);
- echo " - Isset:\n";
- var_dump(isset($ao->prop), isset($ao['prop']));
+ echo " - Isset:\n";
+ var_dump(isset($ao->prop), isset($ao['prop']));
- echo " - Unset:\n";
- unset($ao->prop);
- unset($ao['prop']);
- var_dump($ao->prop, $ao['prop']);
+ echo " - Unset:\n";
+ unset($ao->prop);
+ unset($ao['prop']);
+ var_dump($ao->prop, $ao['prop']);
- echo " - After:\n";
- var_dump($ao, $c);
+ echo " - After:\n";
+ var_dump($ao, $c);
}
?>
--EXPECTF--
@@ -61,7 +61,7 @@ bool(true)
bool(true)
- Unset:
-Notice: Undefined property: ArrayObject::$prop in %s on line 40
+Warning: Undefined property: ArrayObject::$prop in %s on line %d
Notice: Undefined index: prop in %s on line 40
NULL
@@ -89,7 +89,7 @@ bool(true)
bool(true)
- Unset:
-Notice: Undefined property: MyArrayObject::$prop in %s on line 40
+Warning: Undefined property: MyArrayObject::$prop in %s on line %d
Notice: Undefined index: prop in %s on line 40
NULL
diff --git a/ext/spl/tests/arrayObject___construct_basic4.phpt b/ext/spl/tests/arrayObject___construct_basic4.phpt
index c136c949e2..ba0ab08ff6 100644
--- a/ext/spl/tests/arrayObject___construct_basic4.phpt
+++ b/ext/spl/tests/arrayObject___construct_basic4.phpt
@@ -3,11 +3,11 @@ SPL: ArrayObject::__construct basic usage with ArrayObject::ARRAY_AS_PROPS. Curr
--FILE--
<?php
class C {
- public $prop = 'C::prop.orig';
+ public $prop = 'C::prop.orig';
}
class MyArrayObject extends ArrayObject {
- public $prop = 'MyArrayObject::prop.orig';
+ public $prop = 'MyArrayObject::prop.orig';
}
echo "\n--> Access prop on instance of ArrayObject with ArrayObject::ARRAY_AS_PROPS:\n";
@@ -21,29 +21,29 @@ $ao = new MyArrayObject($c, ArrayObject::ARRAY_AS_PROPS);
testAccess($c, $ao);
function testAccess($c, $ao) {
- echo " - Iteration:\n";
- foreach ($ao as $key=>$value) {
- echo " $key=>$value\n";
- }
+ echo " - Iteration:\n";
+ foreach ($ao as $key=>$value) {
+ echo " $key=>$value\n";
+ }
- echo " - Read:\n";
- @var_dump($ao->prop, $ao['prop']);
+ echo " - Read:\n";
+ @var_dump($ao->prop, $ao['prop']);
- echo " - Write:\n";
- $ao->prop = 'changed1';
- $ao['prop'] = 'changed2';
- var_dump($ao->prop, $ao['prop']);
+ echo " - Write:\n";
+ $ao->prop = 'changed1';
+ $ao['prop'] = 'changed2';
+ var_dump($ao->prop, $ao['prop']);
- echo " - Isset:\n";
- var_dump(isset($ao->prop), isset($ao['prop']));
+ echo " - Isset:\n";
+ var_dump(isset($ao->prop), isset($ao['prop']));
- echo " - Unset:\n";
- unset($ao->prop);
- unset($ao['prop']);
- var_dump($ao->prop, $ao['prop']);
+ echo " - Unset:\n";
+ unset($ao->prop);
+ unset($ao['prop']);
+ var_dump($ao->prop, $ao['prop']);
- echo " - After:\n";
- var_dump($ao, $c);
+ echo " - After:\n";
+ var_dump($ao, $c);
}
?>
--EXPECTF--
diff --git a/ext/spl/tests/arrayObject___construct_basic5.phpt b/ext/spl/tests/arrayObject___construct_basic5.phpt
index 0eb8904bac..93fcf256ee 100644
--- a/ext/spl/tests/arrayObject___construct_basic5.phpt
+++ b/ext/spl/tests/arrayObject___construct_basic5.phpt
@@ -3,11 +3,11 @@ SPL: ArrayObject::__construct basic usage with ArrayObject::STD_PROP_LIST|ArrayO
--FILE--
<?php
class C {
- public $prop = 'C::prop.orig';
+ public $prop = 'C::prop.orig';
}
class MyArrayObject extends ArrayObject {
- public $prop = 'MyArrayObject::prop.orig';
+ public $prop = 'MyArrayObject::prop.orig';
}
echo "\n--> Access prop on instance of ArrayObject with ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS:\n";
@@ -21,29 +21,29 @@ $ao = new MyArrayObject($c, ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PRO
testAccess($c, $ao);
function testAccess($c, $ao) {
- echo " - Iteration:\n";
- foreach ($ao as $key=>$value) {
- echo " $key=>$value\n";
- }
+ echo " - Iteration:\n";
+ foreach ($ao as $key=>$value) {
+ echo " $key=>$value\n";
+ }
- echo " - Read:\n";
- @var_dump($ao->prop, $ao['prop']);
+ echo " - Read:\n";
+ @var_dump($ao->prop, $ao['prop']);
- echo " - Write:\n";
- $ao->prop = 'changed1';
- $ao['prop'] = 'changed2';
- var_dump($ao->prop, $ao['prop']);
+ echo " - Write:\n";
+ $ao->prop = 'changed1';
+ $ao['prop'] = 'changed2';
+ var_dump($ao->prop, $ao['prop']);
- echo " - Isset:\n";
- var_dump(isset($ao->prop), isset($ao['prop']));
+ echo " - Isset:\n";
+ var_dump(isset($ao->prop), isset($ao['prop']));
- echo " - Unset:\n";
- unset($ao->prop);
- unset($ao['prop']);
- var_dump($ao->prop, $ao['prop']);
+ echo " - Unset:\n";
+ unset($ao->prop);
+ unset($ao['prop']);
+ var_dump($ao->prop, $ao['prop']);
- echo " - After:\n";
- var_dump($ao, $c);
+ echo " - After:\n";
+ var_dump($ao, $c);
}
?>
--EXPECTF--
diff --git a/ext/spl/tests/arrayObject___construct_basic6.phpt b/ext/spl/tests/arrayObject___construct_basic6.phpt
index befa6eab3c..681e6e0d31 100644
--- a/ext/spl/tests/arrayObject___construct_basic6.phpt
+++ b/ext/spl/tests/arrayObject___construct_basic6.phpt
@@ -3,8 +3,8 @@ SPL: ArrayObject::__construct: check impact of ArrayObject::STD_PROP_LIST on var
--FILE--
<?php
class MyArrayObject extends ArrayObject {
- private $priv1 = 'secret1';
- public $pub1 = 'public1';
+ private $priv1 = 'secret1';
+ public $pub1 = 'public1';
}
$ao = new ArrayObject(array(1,2,3));
diff --git a/ext/spl/tests/arrayObject___construct_error2.phpt b/ext/spl/tests/arrayObject___construct_error2.phpt
index ec01f57e34..742512e02c 100644
--- a/ext/spl/tests/arrayObject___construct_error2.phpt
+++ b/ext/spl/tests/arrayObject___construct_error2.phpt
@@ -4,11 +4,11 @@ SPL: ArrayObject::__construct with too many arguments.
<?php
echo "Too many arguments:\n";
Class C implements Iterator {
- function current() {}
- function next() {}
- function key() {}
- function valid() {}
- function rewind() {}
+ function current() {}
+ function next() {}
+ function key() {}
+ function valid() {}
+ function rewind() {}
}
try {
diff --git a/ext/spl/tests/arrayObject_asort_basic1.phpt b/ext/spl/tests/arrayObject_asort_basic1.phpt
index 6c6fd2949f..0ec5269692 100644
--- a/ext/spl/tests/arrayObject_asort_basic1.phpt
+++ b/ext/spl/tests/arrayObject_asort_basic1.phpt
@@ -15,12 +15,15 @@ $ao1 = new ArrayObject(array(4,2,3));
$ao2 = new ArrayObject(array('a'=>4,'b'=>2,'c'=>3));
var_dump($ao1->asort());
var_dump($ao1);
-var_dump($ao2->asort('blah'));
+try {
+ var_dump($ao2->asort('blah'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump($ao2);
var_dump($ao2->asort(SORT_NUMERIC));
var_dump($ao2);
?>
-===DONE===
--EXPECTF--
*** Testing ArrayObject::asort() : basic functionality ***
bool(true)
@@ -35,9 +38,7 @@ object(ArrayObject)#%d (1) {
int(4)
}
}
-
-Warning: asort() expects parameter 2 to be int, string given in %sarrayObject_asort_basic1.php on line %d
-bool(false)
+asort() expects parameter 2 to be int, string given
object(ArrayObject)#%d (1) {
["storage":"ArrayObject":private]=>
array(3) {
@@ -61,4 +62,3 @@ object(ArrayObject)#%d (1) {
int(4)
}
}
-===DONE===
diff --git a/ext/spl/tests/arrayObject_asort_basic2.phpt b/ext/spl/tests/arrayObject_asort_basic2.phpt
index a736365dbd..80248cbeb3 100644
--- a/ext/spl/tests/arrayObject_asort_basic2.phpt
+++ b/ext/spl/tests/arrayObject_asort_basic2.phpt
@@ -11,10 +11,10 @@ SPL: Test ArrayObject::asort() function : basic functionality with object based
echo "*** Testing ArrayObject::asort() : basic functionality ***\n";
Class C {
- public $prop1 = 'x';
- public $prop2 = 'z';
- private $prop3 = 'a';
- public $prop4 = 'x';
+ public $prop1 = 'x';
+ public $prop2 = 'z';
+ private $prop3 = 'a';
+ public $prop4 = 'x';
}
$c = new C;
@@ -22,7 +22,6 @@ $ao1 = new ArrayObject($c);
var_dump($ao1->asort());
var_dump($ao1, $c);
?>
-===DONE===
--EXPECT--
*** Testing ArrayObject::asort() : basic functionality ***
bool(true)
@@ -49,4 +48,3 @@ object(C)#1 (4) {
["prop2"]=>
string(1) "z"
}
-===DONE===
diff --git a/ext/spl/tests/arrayObject_clone_basic3.phpt b/ext/spl/tests/arrayObject_clone_basic3.phpt
index 27f2098740..f348043c0b 100644
--- a/ext/spl/tests/arrayObject_clone_basic3.phpt
+++ b/ext/spl/tests/arrayObject_clone_basic3.phpt
@@ -3,7 +3,7 @@ SPL: Cloning nested ArrayObjects.
--FILE--
<?php
class C {
- public $p = 'C::p.orig';
+ public $p = 'C::p.orig';
}
$wrappedObject = new C;
diff --git a/ext/spl/tests/arrayObject_count_basic1.phpt b/ext/spl/tests/arrayObject_count_basic1.phpt
index 41e1527f93..3271090d08 100644
--- a/ext/spl/tests/arrayObject_count_basic1.phpt
+++ b/ext/spl/tests/arrayObject_count_basic1.phpt
@@ -25,9 +25,6 @@ var_dump(count($c), count($ao));
unset($c[0]);
unset($ao[0]);
var_dump($c->count(), $ao->count());
-
-//Extra args are ignored.
-var_dump($ao->count('blah'));
?>
==ArrayIterator==
<?php
@@ -53,11 +50,8 @@ var_dump(count($c), count($ao));
unset($c[0]);
unset($ao[0]);
var_dump($c->count(), $ao->count());
-
-//Extra args are ignored.
-var_dump($ao->count('blah'));
?>
---EXPECTF--
+--EXPECT--
==ArrayObject==
int(99)
int(0)
@@ -67,9 +61,6 @@ int(99)
int(2)
int(99)
int(1)
-
-Warning: ArrayObject::count() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
==ArrayIterator==
int(99)
int(0)
@@ -79,6 +70,3 @@ int(99)
int(2)
int(99)
int(1)
-
-Warning: ArrayIterator::count() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
diff --git a/ext/spl/tests/arrayObject_exchangeArray_basic3.phpt b/ext/spl/tests/arrayObject_exchangeArray_basic3.phpt
index 823256edbc..1dc93ceaa9 100644
--- a/ext/spl/tests/arrayObject_exchangeArray_basic3.phpt
+++ b/ext/spl/tests/arrayObject_exchangeArray_basic3.phpt
@@ -4,7 +4,7 @@ SPL: ArrayObject::exchangeArray() basic usage with object as underlying data sto
<?php
class C {
- public $pub1 = 'public1';
+ public $pub1 = 'public1';
}
echo "--> exchangeArray() with objects:\n";
@@ -12,10 +12,10 @@ $original = new C;
$ao = new ArrayObject($original);
$swapIn = new C;
try {
- $copy = $ao->exchangeArray($swapIn);
- $copy['addedToCopy'] = 'added To Copy';
+ $copy = $ao->exchangeArray($swapIn);
+ $copy['addedToCopy'] = 'added To Copy';
} catch (Exception $e) {
- echo "Exception:" . $e->getMessage() . "\n";
+ echo "Exception:" . $e->getMessage() . "\n";
}
$swapIn->addedToSwapIn = 'added To Swap-In';
$original->addedToOriginal = 'added To Original';
@@ -27,10 +27,10 @@ unset($original, $ao, $swapIn, $copy);
$original = new C;
$ao = new ArrayObject($original);
try {
- $copy = $ao->exchangeArray();
- $copy['addedToCopy'] = 'added To Copy';
-} catch (Exception $e) {
- echo "Exception:" . $e->getMessage() . "\n";
+ $copy = $ao->exchangeArray();
+ $copy['addedToCopy'] = 'added To Copy';
+} catch (TypeError $e) {
+ echo "Exception: " . $e->getMessage() . "\n";
}
$original->addedToOriginal = 'added To Original';
var_dump($ao, $original, $copy);
@@ -40,10 +40,10 @@ unset($original, $ao, $swapIn, $copy);
$original = new C;
$ao = new ArrayObject($original);
try {
- $copy = $ao->exchangeArray(null);
- $copy['addedToCopy'] = 'added To Copy';
+ $copy = $ao->exchangeArray(null);
+ $copy['addedToCopy'] = 'added To Copy';
} catch (Exception $e) {
- echo "Exception:" . $e->getMessage() . "\n";
+ echo "Exception:" . $e->getMessage() . "\n";
}
$original->addedToOriginal = 'added To Original';
var_dump($ao, $original, $copy);
@@ -81,8 +81,9 @@ array(2) {
--> exchangeArray() with no arg:
+Exception: ArrayObject::exchangeArray() expects exactly 1 parameter, 0 given
-Warning: ArrayObject::exchangeArray() expects exactly 1 parameter, 0 given in %s on line 27
+Warning: Undefined variable: copy in %s on line %d
object(ArrayObject)#2 (1) {
["storage":"ArrayObject":private]=>
object(C)#3 (2) {
@@ -98,16 +99,13 @@ object(C)#3 (2) {
["addedToOriginal"]=>
string(17) "added To Original"
}
-array(1) {
- ["addedToCopy"]=>
- string(13) "added To Copy"
-}
+NULL
--> exchangeArray() with bad arg type:
Exception:Passed variable is not an array or object
-Notice: Undefined variable: copy in %s on line 46
+Warning: Undefined variable: copy in %s on line %d
object(ArrayObject)#3 (1) {
["storage":"ArrayObject":private]=>
object(C)#2 (2) {
diff --git a/ext/spl/tests/arrayObject_getIteratorClass_basic1.phpt b/ext/spl/tests/arrayObject_getIteratorClass_basic1.phpt
index e6e950c628..58419c06bd 100644
--- a/ext/spl/tests/arrayObject_getIteratorClass_basic1.phpt
+++ b/ext/spl/tests/arrayObject_getIteratorClass_basic1.phpt
@@ -4,40 +4,40 @@ SPL: ArrayObject::getIteratorClass and ArrayObject::setIteratorClass basic funct
<?php
class MyIterator extends ArrayIterator {
- function __construct() {
- $args = func_get_args();
- echo " In " . __METHOD__ . "(" . implode(',', $args) . ")\n";
- }
+ function __construct() {
+ $args = func_get_args();
+ echo " In " . __METHOD__ . "(" . implode(',', $args) . ")\n";
+ }
- function rewind() {
- $args = func_get_args();
- echo " In " . __METHOD__ . "(" . implode(',', $args) . ")\n";
- return parent::rewind();
- }
+ function rewind() {
+ $args = func_get_args();
+ echo " In " . __METHOD__ . "(" . implode(',', $args) . ")\n";
+ return parent::rewind();
+ }
- function valid() {
- $args = func_get_args();
- echo " In " . __METHOD__ . "(" . implode(',', $args) . ")\n";
- return parent::valid();
- }
+ function valid() {
+ $args = func_get_args();
+ echo " In " . __METHOD__ . "(" . implode(',', $args) . ")\n";
+ return parent::valid();
+ }
- function current() {
- $args = func_get_args();
- echo " In " . __METHOD__ . "(" . implode(',', $args) . ")\n";
- return parent::current();
- }
+ function current() {
+ $args = func_get_args();
+ echo " In " . __METHOD__ . "(" . implode(',', $args) . ")\n";
+ return parent::current();
+ }
- function next() {
- $args = func_get_args();
- echo " In " . __METHOD__ . "(" . implode(',', $args) . ")\n";
- return parent::next();
- }
+ function next() {
+ $args = func_get_args();
+ echo " In " . __METHOD__ . "(" . implode(',', $args) . ")\n";
+ return parent::next();
+ }
- function key() {
- $args = func_get_args();
- echo " In " . __METHOD__ . "(" . implode(',', $args) . ")\n";
- return parent::key();
- }
+ function key() {
+ $args = func_get_args();
+ echo " In " . __METHOD__ . "(" . implode(',', $args) . ")\n";
+ return parent::key();
+ }
}
$ao = new ArrayObject(array('a'=>1,'b'=>2,'c'=>3), 0, "MyIterator");
@@ -46,7 +46,7 @@ echo "--> Access using MyIterator:\n";
var_dump($ao->getIteratorClass());
var_dump($ao->getIterator());
foreach($ao as $key=>$value) {
- echo " $key=>$value\n";
+ echo " $key=>$value\n";
}
echo "\n\n--> Access using ArrayIterator:\n";
@@ -54,7 +54,7 @@ var_dump($ao->setIteratorClass("ArrayIterator"));
var_dump($ao->getIteratorClass());
var_dump($ao->getIterator());
foreach($ao as $key=>$value) {
- echo "$key=>$value\n";
+ echo "$key=>$value\n";
}
?>
diff --git a/ext/spl/tests/arrayObject_ksort_basic1.phpt b/ext/spl/tests/arrayObject_ksort_basic1.phpt
index 1692a02ef1..01375b7277 100644
--- a/ext/spl/tests/arrayObject_ksort_basic1.phpt
+++ b/ext/spl/tests/arrayObject_ksort_basic1.phpt
@@ -14,12 +14,15 @@ $ao1 = new ArrayObject(array(4,2,3));
$ao2 = new ArrayObject(array('b'=>4,'a'=>2,'q'=>3, 99=>'x'));
var_dump($ao1->ksort());
var_dump($ao1);
-var_dump($ao2->ksort('blah'));
+try {
+ var_dump($ao2->ksort('blah'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump($ao2);
var_dump($ao2->ksort(SORT_STRING));
var_dump($ao2);
?>
-===DONE===
--EXPECTF--
*** Testing ArrayObject::ksort() : basic functionality ***
bool(true)
@@ -34,9 +37,7 @@ object(ArrayObject)#%d (1) {
int(3)
}
}
-
-Warning: ksort() expects parameter 2 to be int, string given in %sarrayObject_ksort_basic1.php on line %d
-bool(false)
+ksort() expects parameter 2 to be int, string given
object(ArrayObject)#2 (1) {
["storage":"ArrayObject":private]=>
array(4) {
@@ -64,4 +65,3 @@ object(ArrayObject)#%d (1) {
int(3)
}
}
-===DONE===
diff --git a/ext/spl/tests/arrayObject_ksort_basic2.phpt b/ext/spl/tests/arrayObject_ksort_basic2.phpt
index 21cb74cf39..6ef06b331b 100644
--- a/ext/spl/tests/arrayObject_ksort_basic2.phpt
+++ b/ext/spl/tests/arrayObject_ksort_basic2.phpt
@@ -11,10 +11,10 @@ SPL: Test ArrayObject::ksort() function : basic functionality with object base s
echo "*** Testing ArrayObject::ksort() : basic functionality ***\n";
Class C {
- public $x = 'prop1';
- public $z = 'prop2';
- public $a = 'prop3';
- private $b = 'prop4';
+ public $x = 'prop1';
+ public $z = 'prop2';
+ public $a = 'prop3';
+ private $b = 'prop4';
}
$c = new C;
@@ -22,7 +22,6 @@ $ao1 = new ArrayObject($c);
var_dump($ao1->ksort());
var_dump($ao1, $c);
?>
-===DONE===
--EXPECT--
*** Testing ArrayObject::ksort() : basic functionality ***
bool(true)
@@ -49,4 +48,3 @@ object(C)#1 (4) {
["z"]=>
string(5) "prop2"
}
-===DONE===
diff --git a/ext/spl/tests/arrayObject_magicMethods1.phpt b/ext/spl/tests/arrayObject_magicMethods1.phpt
index 351f68214a..dbe75bff24 100644
--- a/ext/spl/tests/arrayObject_magicMethods1.phpt
+++ b/ext/spl/tests/arrayObject_magicMethods1.phpt
@@ -3,28 +3,28 @@ SPL: ArrayObject: ensure a wrapped object's magic methods for property access ar
--FILE--
<?php
class UsesMagic {
- public $a = 1;
- public $b = 2;
- public $c = 3;
+ public $a = 1;
+ public $b = 2;
+ public $c = 3;
- private $priv = 'secret';
+ private $priv = 'secret';
- function __get($name) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
- function __set($name, $value) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
- function __isset($name) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
- function __unset($name) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
+ function __get($name) {
+ $args = func_get_args();
+ echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
+ }
+ function __set($name, $value) {
+ $args = func_get_args();
+ echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
+ }
+ function __isset($name) {
+ $args = func_get_args();
+ echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
+ }
+ function __unset($name) {
+ $args = func_get_args();
+ echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
+ }
}
diff --git a/ext/spl/tests/arrayObject_magicMethods2.phpt b/ext/spl/tests/arrayObject_magicMethods2.phpt
index 18f0520fcd..13b91e6e86 100644
--- a/ext/spl/tests/arrayObject_magicMethods2.phpt
+++ b/ext/spl/tests/arrayObject_magicMethods2.phpt
@@ -3,28 +3,28 @@ SPL: ArrayObject: ensure a wrapped object's magic methods for property access ar
--FILE--
<?php
class UsesMagic {
- public $a = 1;
- public $b = 2;
- public $c = 3;
+ public $a = 1;
+ public $b = 2;
+ public $c = 3;
- private $priv = 'secret';
+ private $priv = 'secret';
- function __get($name) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
- function __set($name, $value) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
- function __isset($name) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
- function __unset($name) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
+ function __get($name) {
+ $args = func_get_args();
+ echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
+ }
+ function __set($name, $value) {
+ $args = func_get_args();
+ echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
+ }
+ function __isset($name) {
+ $args = func_get_args();
+ echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
+ }
+ function __unset($name) {
+ $args = func_get_args();
+ echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
+ }
}
@@ -102,7 +102,7 @@ object(ArrayObject)#2 (3) {
--> Read existent, non-existent and dynamic:
string(7) "changed"
-Notice: Undefined property: ArrayObject::$nonexistent in %s on line 42
+Warning: Undefined property: ArrayObject::$nonexistent in %s on line %d
NULL
string(11) "new.changed"
Original wrapped object:
diff --git a/ext/spl/tests/arrayObject_magicMethods3.phpt b/ext/spl/tests/arrayObject_magicMethods3.phpt
index 6771c46800..f8b2c2e41c 100644
--- a/ext/spl/tests/arrayObject_magicMethods3.phpt
+++ b/ext/spl/tests/arrayObject_magicMethods3.phpt
@@ -3,28 +3,28 @@ SPL: ArrayObject: ensure a wrapped object's magic methods for property access ar
--FILE--
<?php
class UsesMagic {
- public $a = 1;
- public $b = 2;
- public $c = 3;
+ public $a = 1;
+ public $b = 2;
+ public $c = 3;
- private $priv = 'secret';
+ private $priv = 'secret';
- function __get($name) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
- function __set($name, $value) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
- function __isset($name) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
- function __unset($name) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
+ function __get($name) {
+ $args = func_get_args();
+ echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
+ }
+ function __set($name, $value) {
+ $args = func_get_args();
+ echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
+ }
+ function __isset($name) {
+ $args = func_get_args();
+ echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
+ }
+ function __unset($name) {
+ $args = func_get_args();
+ echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
+ }
}
diff --git a/ext/spl/tests/arrayObject_magicMethods4.phpt b/ext/spl/tests/arrayObject_magicMethods4.phpt
index d6a6292fc0..e038a1e09c 100644
--- a/ext/spl/tests/arrayObject_magicMethods4.phpt
+++ b/ext/spl/tests/arrayObject_magicMethods4.phpt
@@ -3,33 +3,33 @@ SPL: ArrayObject: ensure the magic methods for property access of a subclass of
--FILE--
<?php
class C {
- public $a = 1;
- public $b = 2;
- public $c = 3;
+ public $a = 1;
+ public $b = 2;
+ public $c = 3;
- private $priv = 'secret';
+ private $priv = 'secret';
}
class UsesMagic extends ArrayObject {
- public $b = "This should not be in the storage";
+ public $b = "This should not be in the storage";
- function __get($name) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
- function __set($name, $value) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
- function __isset($name) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
- function __unset($name) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
+ function __get($name) {
+ $args = func_get_args();
+ echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
+ }
+ function __set($name, $value) {
+ $args = func_get_args();
+ echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
+ }
+ function __isset($name) {
+ $args = func_get_args();
+ echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
+ }
+ function __unset($name) {
+ $args = func_get_args();
+ echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
+ }
}
$obj = new C;
diff --git a/ext/spl/tests/arrayObject_magicMethods5.phpt b/ext/spl/tests/arrayObject_magicMethods5.phpt
index 6d2ced3a71..c0393ffea4 100644
--- a/ext/spl/tests/arrayObject_magicMethods5.phpt
+++ b/ext/spl/tests/arrayObject_magicMethods5.phpt
@@ -3,33 +3,33 @@ SPL: ArrayObject: ensure the magic methods for property access of a subclass of
--FILE--
<?php
class C {
- public $a = 1;
- public $b = 2;
- public $c = 3;
+ public $a = 1;
+ public $b = 2;
+ public $c = 3;
- private $priv = 'secret';
+ private $priv = 'secret';
}
class UsesMagic extends ArrayObject {
- public $b = "This should appear in storage";
+ public $b = "This should appear in storage";
- function __get($name) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode(',', $args) . ")\n";
- }
- function __set($name, $value) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode(',', $args) . ")\n";
- }
- function __isset($name) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode(',', $args) . ")\n";
- }
- function __unset($name) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode(',', $args) . ")\n";
- }
+ function __get($name) {
+ $args = func_get_args();
+ echo "In " . __METHOD__ . "(" . implode(',', $args) . ")\n";
+ }
+ function __set($name, $value) {
+ $args = func_get_args();
+ echo "In " . __METHOD__ . "(" . implode(',', $args) . ")\n";
+ }
+ function __isset($name) {
+ $args = func_get_args();
+ echo "In " . __METHOD__ . "(" . implode(',', $args) . ")\n";
+ }
+ function __unset($name) {
+ $args = func_get_args();
+ echo "In " . __METHOD__ . "(" . implode(',', $args) . ")\n";
+ }
}
$obj = new C;
diff --git a/ext/spl/tests/arrayObject_magicMethods6.phpt b/ext/spl/tests/arrayObject_magicMethods6.phpt
index 243e0f53a8..e0ccb43dd4 100644
--- a/ext/spl/tests/arrayObject_magicMethods6.phpt
+++ b/ext/spl/tests/arrayObject_magicMethods6.phpt
@@ -3,33 +3,33 @@ SPL: ArrayObject: ensure the magic methods for property access of a subclass of
--FILE--
<?php
class C {
- public $a = 1;
- public $b = 2;
- public $c = 3;
+ public $a = 1;
+ public $b = 2;
+ public $c = 3;
- private $priv = 'secret';
+ private $priv = 'secret';
}
class UsesMagic extends ArrayObject {
- public $b = "This should never appear in storage";
+ public $b = "This should never appear in storage";
- function __get($name) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
- function __set($name, $value) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
- function __isset($name) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
- function __unset($name) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
+ function __get($name) {
+ $args = func_get_args();
+ echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
+ }
+ function __set($name, $value) {
+ $args = func_get_args();
+ echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
+ }
+ function __isset($name) {
+ $args = func_get_args();
+ echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
+ }
+ function __unset($name) {
+ $args = func_get_args();
+ echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
+ }
}
$obj = new C;
diff --git a/ext/spl/tests/arrayObject_natcasesort_basic1.phpt b/ext/spl/tests/arrayObject_natcasesort_basic1.phpt
index 7e7095fe38..bbd47ae199 100644
--- a/ext/spl/tests/arrayObject_natcasesort_basic1.phpt
+++ b/ext/spl/tests/arrayObject_natcasesort_basic1.phpt
@@ -18,7 +18,6 @@ var_dump($ao1);
var_dump($ao2->natcasesort('blah'));
var_dump($ao2);
?>
-===DONE===
--EXPECT--
*** Testing ArrayObject::natcasesort() : basic functionality ***
bool(true)
@@ -53,4 +52,3 @@ object(ArrayObject)#2 (1) {
string(5) "boo22"
}
}
-===DONE===
diff --git a/ext/spl/tests/arrayObject_natsort_basic1.phpt b/ext/spl/tests/arrayObject_natsort_basic1.phpt
index 1bd1d0b6e8..8c4f5b8aec 100644
--- a/ext/spl/tests/arrayObject_natsort_basic1.phpt
+++ b/ext/spl/tests/arrayObject_natsort_basic1.phpt
@@ -18,7 +18,6 @@ var_dump($ao1);
var_dump($ao2->natsort('blah'));
var_dump($ao2);
?>
-===DONE===
--EXPECT--
*** Testing ArrayObject::natsort() : basic functionality ***
bool(true)
@@ -53,4 +52,3 @@ object(ArrayObject)#2 (1) {
string(5) "boo22"
}
}
-===DONE===
diff --git a/ext/spl/tests/arrayObject_setFlags_basic1.phpt b/ext/spl/tests/arrayObject_setFlags_basic1.phpt
index b8bf099dd6..173836cebc 100644
--- a/ext/spl/tests/arrayObject_setFlags_basic1.phpt
+++ b/ext/spl/tests/arrayObject_setFlags_basic1.phpt
@@ -3,7 +3,7 @@ SPL: ArrayObject::setFlags basic usage with ArrayObject::ARRAY_AS_PROPS. Current
--FILE--
<?php
class C extends ArrayObject {
- public $p = 'object property';
+ public $p = 'object property';
}
function access_p($ao) {
diff --git a/ext/spl/tests/arrayObject_setFlags_basic2.phpt b/ext/spl/tests/arrayObject_setFlags_basic2.phpt
index fe9111c90b..452ce799bb 100644
--- a/ext/spl/tests/arrayObject_setFlags_basic2.phpt
+++ b/ext/spl/tests/arrayObject_setFlags_basic2.phpt
@@ -3,11 +3,11 @@ SPL: Ensure access to non-visible properties falls back to dimension access with
--FILE--
<?php
class C extends ArrayObject {
- private $x = 'secret';
+ private $x = 'secret';
- static function go($c) {
- var_dump($c->x);
- }
+ static function go($c) {
+ var_dump($c->x);
+ }
}
$c = new C(array('x'=>'public'));
diff --git a/ext/spl/tests/arrayObject_setIteratorClass_error1.phpt b/ext/spl/tests/arrayObject_setIteratorClass_error1.phpt
index 89efdb6a9f..591f84c3d4 100644
--- a/ext/spl/tests/arrayObject_setIteratorClass_error1.phpt
+++ b/ext/spl/tests/arrayObject_setIteratorClass_error1.phpt
@@ -8,8 +8,8 @@ try {
foreach($ao as $key=>$value) {
echo " $key=>$value\n";
}
-} catch (Exception $e) {
- var_dump($e->getMessage());
+} catch (TypeError $e) {
+ var_dump($e->getMessage());
}
try {
@@ -18,8 +18,8 @@ try {
foreach($ao as $key=>$value) {
echo " $key=>$value\n";
}
-} catch (Exception $e) {
- var_dump($e->getMessage());
+} catch (TypeError $e) {
+ var_dump($e->getMessage());
}
@@ -29,7 +29,7 @@ try {
echo " $key=>$value\n";
}
} catch (TypeError $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
try {
@@ -38,19 +38,12 @@ try {
echo " $key=>$value\n";
}
} catch (TypeError $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
?>
--EXPECTF--
-Warning: ArrayObject::setIteratorClass() expects parameter 1 to be a class name derived from Iterator, 'nonExistentClass' given in %s on line 4
- a=>1
- b=>2
- c=>3
-
-Warning: ArrayObject::setIteratorClass() expects parameter 1 to be a class name derived from Iterator, 'stdClass' given in %s on line 14
- a=>1
- b=>2
- c=>3
+string(118) "ArrayObject::setIteratorClass() expects parameter 1 to be a class name derived from Iterator, 'nonExistentClass' given"
+string(110) "ArrayObject::setIteratorClass() expects parameter 1 to be a class name derived from Iterator, 'stdClass' given"
string(113) "ArrayObject::__construct() expects parameter 3 to be a class name derived from Iterator, 'nonExistentClass' given"
string(105) "ArrayObject::__construct() expects parameter 3 to be a class name derived from Iterator, 'stdClass' given"
diff --git a/ext/spl/tests/arrayObject_uasort_basic1.phpt b/ext/spl/tests/arrayObject_uasort_basic1.phpt
index b07aec206b..06f6d43ef5 100644
--- a/ext/spl/tests/arrayObject_uasort_basic1.phpt
+++ b/ext/spl/tests/arrayObject_uasort_basic1.phpt
@@ -27,7 +27,6 @@ $ao = new ArrayObject(array(2,3,1));
$ao->uasort('cmp');
var_dump($ao);
?>
-===DONE===
--EXPECT--
*** Testing ArrayObject::uasort() : basic functionality ***
object(ArrayObject)#1 (1) {
@@ -41,4 +40,3 @@ object(ArrayObject)#1 (1) {
int(1)
}
}
-===DONE===
diff --git a/ext/spl/tests/arrayObject_uasort_error1.phpt b/ext/spl/tests/arrayObject_uasort_error1.phpt
index e8b52f9e59..5dc63373ef 100644
--- a/ext/spl/tests/arrayObject_uasort_error1.phpt
+++ b/ext/spl/tests/arrayObject_uasort_error1.phpt
@@ -12,19 +12,17 @@ Test ArrayObject::uasort() function : wrong arg count
$ao = new ArrayObject();
try {
- $ao->uasort();
+ $ao->uasort();
} catch (BadMethodCallException $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- $ao->uasort(1,2);
+ $ao->uasort(1,2);
} catch (BadMethodCallException $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--EXPECT--
Function expects exactly one argument
Function expects exactly one argument
-===DONE===
diff --git a/ext/spl/tests/arrayObject_uksort_basic1.phpt b/ext/spl/tests/arrayObject_uksort_basic1.phpt
index b770f1fe1d..5a0f8d0bd3 100644
--- a/ext/spl/tests/arrayObject_uksort_basic1.phpt
+++ b/ext/spl/tests/arrayObject_uksort_basic1.phpt
@@ -26,7 +26,6 @@ $ao = new ArrayObject(array(3=>0, 2=>1, 5=>2, 6=>3, 1=>4));
$ao->uksort('cmp');
var_dump($ao);
?>
-===DONE===
--EXPECT--
*** Testing ArrayObject::uksort() : basic functionality ***
object(ArrayObject)#1 (1) {
@@ -44,4 +43,3 @@ object(ArrayObject)#1 (1) {
int(4)
}
}
-===DONE===
diff --git a/ext/spl/tests/arrayObject_uksort_error1.phpt b/ext/spl/tests/arrayObject_uksort_error1.phpt
index e72eec0bf9..e2bbf9968c 100644
--- a/ext/spl/tests/arrayObject_uksort_error1.phpt
+++ b/ext/spl/tests/arrayObject_uksort_error1.phpt
@@ -12,19 +12,17 @@ Test ArrayObject::uksort() function : wrong arg count
$ao = new ArrayObject();
try {
- $ao->uksort();
+ $ao->uksort();
} catch (BadMethodCallException $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try {
- $ao->uksort(1,2);
+ $ao->uksort(1,2);
} catch (BadMethodCallException $e) {
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
--EXPECT--
Function expects exactly one argument
Function expects exactly one argument
-===DONE===
diff --git a/ext/spl/tests/array_001.phpt b/ext/spl/tests/array_001.phpt
index b55fcba1fd..14543f472f 100644
--- a/ext/spl/tests/array_001.phpt
+++ b/ext/spl/tests/array_001.phpt
@@ -33,8 +33,6 @@ $ar[] = 4;
var_dump($ar);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
object(ArrayObject)#%d (1) {
["storage":"ArrayObject":private]=>
@@ -110,4 +108,3 @@ object(ArrayObject)#%d (1) {
int(4)
}
}
-===DONE===
diff --git a/ext/spl/tests/array_002.phpt b/ext/spl/tests/array_002.phpt
index 55935882f8..94559f5bf7 100644
--- a/ext/spl/tests/array_002.phpt
+++ b/ext/spl/tests/array_002.phpt
@@ -17,8 +17,6 @@ $arrayObject[] = 'five';
var_dump($arrayObject);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
object(ArrayObject)#%d (1) {
["storage":"ArrayObject":private]=>
@@ -38,4 +36,3 @@ object(ArrayObject)#%d (1) {
}
}
}
-===DONE===
diff --git a/ext/spl/tests/array_003.phpt b/ext/spl/tests/array_003.phpt
index e82953be70..e4c0a1f9f8 100644
--- a/ext/spl/tests/array_003.phpt
+++ b/ext/spl/tests/array_003.phpt
@@ -9,14 +9,14 @@ SPL: ArrayObject from object
class test
{
- public $pub = "public";
- protected $pro = "protected";
- private $pri = "private";
-
- function __construct()
- {
- $this->imp = "implicit";
- }
+ public $pub = "public";
+ protected $pro = "protected";
+ private $pri = "private";
+
+ function __construct()
+ {
+ $this->imp = "implicit";
+ }
};
$test = new test;
@@ -30,12 +30,10 @@ print_r($object);
foreach($test as $key => $val)
{
- echo "$key => $val\n";
+ echo "$key => $val\n";
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
test Object
(
@@ -60,4 +58,3 @@ ArrayObject Object
pub => public
imp => implicit
dyn => dynamic
-===DONE===
diff --git a/ext/spl/tests/array_004.phpt b/ext/spl/tests/array_004.phpt
index c976bdd87b..e962477a9e 100644
--- a/ext/spl/tests/array_004.phpt
+++ b/ext/spl/tests/array_004.phpt
@@ -7,12 +7,12 @@ $arr = array(0=>0, 1=>1, 2=>2);
$obj = new ArrayObject($arr);
foreach($obj as $ak=>$av) {
- foreach($obj as $bk=>$bv) {
- if ($ak==0 && $bk==0) {
- $arr[0] = "modify";
- }
- echo "$ak=>$av - $bk=>$bv\n";
- }
+ foreach($obj as $bk=>$bv) {
+ if ($ak==0 && $bk==0) {
+ $arr[0] = "modify";
+ }
+ echo "$ak=>$av - $bk=>$bv\n";
+ }
}
echo "Done\n";
diff --git a/ext/spl/tests/array_005.phpt b/ext/spl/tests/array_005.phpt
index b0175e7e7a..cae8f422a7 100644
--- a/ext/spl/tests/array_005.phpt
+++ b/ext/spl/tests/array_005.phpt
@@ -5,73 +5,73 @@ SPL: ArrayObject/Iterator interaction
class Student
{
- private $id;
- private $name;
+ private $id;
+ private $name;
public function __construct($id, $name)
{
- $this->id = $id;
- $this->name = $name;
+ $this->id = $id;
+ $this->name = $name;
}
- public function __toString()
- {
- return $this->id . ', ' . $this->name;
- }
+ public function __toString()
+ {
+ return $this->id . ', ' . $this->name;
+ }
- public function getId()
- {
- return $this->id;
- }
+ public function getId()
+ {
+ return $this->id;
+ }
}
class StudentIdFilter extends FilterIterator
{
- private $id;
+ private $id;
- public function __construct(ArrayObject $students, Student $other)
- {
- FilterIterator::__construct($students->getIterator());
- $this->id = $other->getId();
- }
+ public function __construct(ArrayObject $students, Student $other)
+ {
+ FilterIterator::__construct($students->getIterator());
+ $this->id = $other->getId();
+ }
- public function accept()
- {
- echo "ACCEPT ".$this->current()->getId()." == ".$this->id."\n";
- return $this->current()->getId() == $this->id;
- }
+ public function accept()
+ {
+ echo "ACCEPT ".$this->current()->getId()." == ".$this->id."\n";
+ return $this->current()->getId() == $this->id;
+ }
}
class StudentList implements IteratorAggregate
{
- private $students;
+ private $students;
- public function __construct()
- {
- $this->students = new ArrayObject(array());
- }
+ public function __construct()
+ {
+ $this->students = new ArrayObject(array());
+ }
- public function add(Student $student)
- {
- if (!$this->contains($student)) {
- $this->students[] = $student;
- }
- }
+ public function add(Student $student)
+ {
+ if (!$this->contains($student)) {
+ $this->students[] = $student;
+ }
+ }
- public function contains(Student $student)
- {
- foreach ($this->students as $s)
- {
- if ($s->getId() == $student->getId()) {
- return true;
- }
- }
- return false;
- }
+ public function contains(Student $student)
+ {
+ foreach ($this->students as $s)
+ {
+ if ($s->getId() == $student->getId()) {
+ return true;
+ }
+ }
+ return false;
+ }
- public function getIterator() {
- return $this->students->getIterator();
- }
+ public function getIterator() {
+ return $this->students->getIterator();
+ }
}
$students = new StudentList();
@@ -80,12 +80,9 @@ $students->add(new Student('00000014', 'Bob'));
$students->add(new Student('00000014', 'Foo'));
foreach ($students as $student) {
- echo $student, "\n";
+ echo $student, "\n";
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
01234123, Joe
00000014, Bob
-===DONE===
diff --git a/ext/spl/tests/array_006.phpt b/ext/spl/tests/array_006.phpt
index 2735432e26..e46ca25cc3 100644
--- a/ext/spl/tests/array_006.phpt
+++ b/ext/spl/tests/array_006.phpt
@@ -11,20 +11,17 @@ $arr = array(0=>0, 1=>1, 2=>2);
$obj = new ArrayIterator($arr);
foreach($obj as $ak=>$av) {
- foreach($obj as $bk=>$bv) {
- if ($ak==0 && $bk==0) {
- $arr[0] = "modify";
- }
- echo "$ak=>$av - $bk=>$bv\n";
- }
+ foreach($obj as $bk=>$bv) {
+ if ($ak==0 && $bk==0) {
+ $arr[0] = "modify";
+ }
+ echo "$ak=>$av - $bk=>$bv\n";
+ }
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
==Normal==
0=>0 - 0=>0
0=>0 - 1=>1
0=>0 - 2=>2
-===DONE===
diff --git a/ext/spl/tests/array_007.phpt b/ext/spl/tests/array_007.phpt
index 5b7d89068d..13d841792c 100644
--- a/ext/spl/tests/array_007.phpt
+++ b/ext/spl/tests/array_007.phpt
@@ -9,20 +9,20 @@ SPL: ArrayObject/Iterator from IteratorAggregate
class test implements IteratorAggregate
{
- public $pub = "public";
- protected $pro = "protected";
- private $pri = "private";
+ public $pub = "public";
+ protected $pro = "protected";
+ private $pri = "private";
- function __construct()
- {
- $this->imp = "implicit";
- }
+ function __construct()
+ {
+ $this->imp = "implicit";
+ }
- function getIterator()
- {
- $it = new ArrayObject($this);
- return $it->getIterator();
- }
+ function getIterator()
+ {
+ $it = new ArrayObject($this);
+ return $it->getIterator();
+ }
};
$test = new test;
@@ -34,12 +34,10 @@ print_r($test->getIterator());
foreach($test as $key => $val)
{
- echo "$key => $val\n";
+ echo "$key => $val\n";
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
test Object
(
@@ -68,4 +66,3 @@ ArrayIterator Object
pub => public
imp => implicit
dyn => dynamic
-===DONE===
diff --git a/ext/spl/tests/array_008.phpt b/ext/spl/tests/array_008.phpt
index 01b2290e50..6b4f42262d 100644
--- a/ext/spl/tests/array_008.phpt
+++ b/ext/spl/tests/array_008.phpt
@@ -7,17 +7,15 @@ $arr = array(0=>0, 1=>1, 2=>2);
$obj = new ArrayObject($arr);
foreach($obj as $ak=>&$av) {
- foreach($obj as $bk=>&$bv) {
- if ($ak==0 && $bk==0) {
- $bv = "modify";
- }
- echo "$ak=>$av - $bk=>$bv\n";
- }
+ foreach($obj as $bk=>&$bv) {
+ if ($ak==0 && $bk==0) {
+ $bv = "modify";
+ }
+ echo "$ak=>$av - $bk=>$bv\n";
+ }
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
0=>modify - 0=>modify
0=>modify - 1=>1
@@ -28,4 +26,3 @@ foreach($obj as $ak=>&$av) {
2=>2 - 0=>modify
2=>2 - 1=>1
2=>2 - 2=>2
-===DONE===
diff --git a/ext/spl/tests/array_009.phpt b/ext/spl/tests/array_009.phpt
index fc0d60baa9..05c53e9b44 100644
--- a/ext/spl/tests/array_009.phpt
+++ b/ext/spl/tests/array_009.phpt
@@ -8,12 +8,10 @@ $array = array(1, 2 => array(21, 22 => array(221, 222), 23 => array(231)), 3);
$dir = new RecursiveIteratorIterator(new RecursiveArrayIterator($array), RecursiveIteratorIterator::LEAVES_ONLY);
foreach ($dir as $file) {
- print "$file\n";
+ print "$file\n";
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
1
21
@@ -21,4 +19,3 @@ foreach ($dir as $file) {
222
231
3
-===DONE===
diff --git a/ext/spl/tests/array_009a.phpt b/ext/spl/tests/array_009a.phpt
index f2078bcd41..451c22b565 100644
--- a/ext/spl/tests/array_009a.phpt
+++ b/ext/spl/tests/array_009a.phpt
@@ -5,15 +5,15 @@ SPL: ArrayIterator implementing RecursiveIterator
class MyRecursiveArrayIterator extends ArrayIterator implements RecursiveIterator
{
- function hasChildren()
- {
- return is_array($this->current());
- }
+ function hasChildren()
+ {
+ return is_array($this->current());
+ }
- function getChildren()
- {
- return new MyRecursiveArrayIterator($this->current());
- }
+ function getChildren()
+ {
+ return new MyRecursiveArrayIterator($this->current());
+ }
}
$array = array(1, 2 => array(21, 22 => array(221, 222), 23 => array(231)), 3);
@@ -21,12 +21,10 @@ $array = array(1, 2 => array(21, 22 => array(221, 222), 23 => array(231)), 3);
$dir = new RecursiveIteratorIterator(new MyRecursiveArrayIterator($array), RecursiveIteratorIterator::LEAVES_ONLY);
foreach ($dir as $file) {
- print "$file\n";
+ print "$file\n";
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
1
21
@@ -34,4 +32,3 @@ foreach ($dir as $file) {
222
231
3
-===DONE===
diff --git a/ext/spl/tests/array_010.phpt b/ext/spl/tests/array_010.phpt
index d2f3de7f6d..1df3be5acb 100644
--- a/ext/spl/tests/array_010.phpt
+++ b/ext/spl/tests/array_010.phpt
@@ -61,8 +61,6 @@ unset($obj['8th']);
var_dump($obj->getArrayCopy());
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
array(4) {
[0]=>
@@ -141,4 +139,3 @@ array(4) {
[6]=>
string(9) "changed 6"
}
-===DONE===
diff --git a/ext/spl/tests/array_011.phpt b/ext/spl/tests/array_011.phpt
index 0c5ad55d68..647e1ed3ba 100644
--- a/ext/spl/tests/array_011.phpt
+++ b/ext/spl/tests/array_011.phpt
@@ -7,12 +7,10 @@ $a = array('zero' => 0, 'one' => 1, 'two' => 2, 'three' => 3, 'four' => 4, 'five
//foreach (new ArrayIterator($a) as $k => $v)
foreach (new LimitIterator(new ArrayIterator($a), 1, 3) as $k => $v)
{
- var_dump(array($k, $v));
+ var_dump(array($k, $v));
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
array(2) {
[0]=>
@@ -32,4 +30,3 @@ array(2) {
[1]=>
int(3)
}
-===DONE===
diff --git a/ext/spl/tests/array_012.phpt b/ext/spl/tests/array_012.phpt
index 2ee9724d28..5d5993d936 100644
--- a/ext/spl/tests/array_012.phpt
+++ b/ext/spl/tests/array_012.phpt
@@ -11,8 +11,8 @@ $it = new ArrayIterator($a);
var_dump($it->count());
foreach($it as $key => $val)
{
- echo "$key=>$val\n";
- var_dump($it->count());
+ echo "$key=>$val\n";
+ var_dump($it->count());
}
var_dump($it->count());
@@ -20,11 +20,11 @@ echo "===Object===\n";
class test
{
- public $zero = 0;
- protected $pro;
- public $one = 1;
- private $pri;
- public $two = 2;
+ public $zero = 0;
+ protected $pro;
+ public $one = 1;
+ private $pri;
+ public $two = 2;
}
$o = new test;
@@ -33,14 +33,12 @@ $it = new ArrayIterator($o);
var_dump($it->count());
foreach($it as $key => $val)
{
- echo "$key=>$val\n";
- var_dump($it->count());
+ echo "$key=>$val\n";
+ var_dump($it->count());
}
var_dump($it->count());
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
===Array===
int(3)
@@ -60,4 +58,3 @@ int(3)
two=>2
int(3)
int(3)
-===DONE===
diff --git a/ext/spl/tests/array_013.phpt b/ext/spl/tests/array_013.phpt
index 1f0c631c02..9ad11c8f38 100644
--- a/ext/spl/tests/array_013.phpt
+++ b/ext/spl/tests/array_013.phpt
@@ -5,7 +5,7 @@ SPL: ArrayIterator::append
if (!class_exists('NoRewindIterator', false))
{
- require_once(__DIR__ . '/../examples/norewinditerator.inc');
+ require_once(__DIR__ . '/../examples/norewinditerator.inc');
}
echo "===Array===\n";
@@ -15,7 +15,7 @@ $it = new ArrayIterator($a);
foreach($it as $key => $val)
{
- echo "$key=>$val\n";
+ echo "$key=>$val\n";
}
echo "===Append===\n";
@@ -25,18 +25,18 @@ $it->append('four');
foreach(new NoRewindIterator($it) as $key => $val)
{
- echo "$key=>$val\n";
+ echo "$key=>$val\n";
}
echo "===Object===\n";
class test
{
- public $zero = 0;
- protected $pro;
- public $one = 1;
- private $pri;
- public $two = 2;
+ public $zero = 0;
+ protected $pro;
+ public $one = 1;
+ private $pri;
+ public $two = 2;
}
$o = new test;
@@ -44,7 +44,7 @@ $it = new ArrayIterator($o);
foreach($it as $key => $val)
{
- echo "$key=>$val\n";
+ echo "$key=>$val\n";
}
echo "===Append===\n";
@@ -54,14 +54,13 @@ $it->append('four');
foreach(new NoRewindIterator($it) as $key => $val)
{
- echo "$key=>$val\n";
+ echo "$key=>$val\n";
}
var_dump($o->{0}); /* doesn't wotk anyway */
?>
===DONE===
-<?php exit(0); ?>
--EXPECTF--
===Array===
0=>zero
diff --git a/ext/spl/tests/array_014.phpt b/ext/spl/tests/array_014.phpt
index 4bf0b83c9c..37ed9abad5 100644
--- a/ext/spl/tests/array_014.phpt
+++ b/ext/spl/tests/array_014.phpt
@@ -11,34 +11,32 @@ $it->seek(4);
var_dump($it->current());
try
{
- $it->seek(-1);
- var_dump($it->current());
+ $it->seek(-1);
+ var_dump($it->current());
}
catch(Exception $e)
{
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try
{
- $it->seek(12);
- var_dump($it->current());
+ $it->seek(12);
+ var_dump($it->current());
}
catch(Exception $e)
{
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
$pos = 0;
foreach($it as $v)
{
- $it->seek($pos++);
- var_dump($v);
+ $it->seek($pos++);
+ var_dump($v);
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
int(11)
int(5)
@@ -56,4 +54,3 @@ int(7)
int(8)
int(9)
int(10)
-===DONE===
diff --git a/ext/spl/tests/array_015.phpt b/ext/spl/tests/array_015.phpt
index cd3ce5f45a..45cf466b76 100644
--- a/ext/spl/tests/array_015.phpt
+++ b/ext/spl/tests/array_015.phpt
@@ -23,23 +23,21 @@ var_dump($ar);
foreach($it as $k => $v)
{
- $ar->offsetUnset($k+1);
- echo "$k=>$v\n";
+ $ar->offsetUnset($k+1);
+ echo "$k=>$v\n";
}
var_dump($ar);
foreach($it as $k => $v)
{
- $ar->offsetUnset($k);
- echo "$k=>$v\n";
+ $ar->offsetUnset($k);
+ echo "$k=>$v\n";
}
var_dump($ar);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
object(ArrayObject)#%d (1) {
%s"storage"%s"ArrayObject":private]=>
@@ -89,4 +87,3 @@ object(ArrayObject)#%d (1) {
int(4)
}
}
-===DONE===
diff --git a/ext/spl/tests/array_016.phpt b/ext/spl/tests/array_016.phpt
index 0a6edea01c..a40d4d5b8a 100644
--- a/ext/spl/tests/array_016.phpt
+++ b/ext/spl/tests/array_016.phpt
@@ -7,19 +7,17 @@ $it = new ArrayIterator(range(0,3));
foreach(new IteratorIterator($it) as $v)
{
- var_dump($v);
+ var_dump($v);
}
$it = new ArrayObject(range(0,3));
foreach(new IteratorIterator($it) as $v)
{
- var_dump($v);
+ var_dump($v);
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
int(0)
int(1)
@@ -29,4 +27,3 @@ int(0)
int(1)
int(2)
int(3)
-===DONE===
diff --git a/ext/spl/tests/array_017.phpt b/ext/spl/tests/array_017.phpt
index 3074a76417..1165133b35 100644
--- a/ext/spl/tests/array_017.phpt
+++ b/ext/spl/tests/array_017.phpt
@@ -5,113 +5,113 @@ SPL: ArrayObject::exchangeArray($this)
class ArrayIteratorEx extends ArrayIterator
{
- public $pub2 = 1;
- protected $pro2 = 2;
- private $pri2 = 3;
+ public $pub2 = 1;
+ protected $pro2 = 2;
+ private $pri2 = 3;
- function __construct($ar, $flags = 0)
- {
- echo __METHOD__ . "()\n";
- parent::__construct($ar, $flags);
- $this->imp2 = 4;
- }
+ function __construct($ar, $flags = 0)
+ {
+ echo __METHOD__ . "()\n";
+ parent::__construct($ar, $flags);
+ $this->imp2 = 4;
+ }
- function dump()
- {
- echo __METHOD__ . "()\n";
- var_dump(array('Flags'=>$this->getFlags()
- ,'OVars'=>get_object_vars($this)
- ,'$this'=>$this));
- }
+ function dump()
+ {
+ echo __METHOD__ . "()\n";
+ var_dump(array('Flags'=>$this->getFlags()
+ ,'OVars'=>get_object_vars($this)
+ ,'$this'=>$this));
+ }
- function setFlags($flags)
- {
- echo __METHOD__ . "($flags)\n";
- ArrayIterator::setFlags($flags);
- }
+ function setFlags($flags)
+ {
+ echo __METHOD__ . "($flags)\n";
+ ArrayIterator::setFlags($flags);
+ }
}
class ArrayObjectEx extends ArrayObject
{
- public $pub1 = 1;
- protected $pro1 = 2;
- private $pri1 = 3;
+ public $pub1 = 1;
+ protected $pro1 = 2;
+ private $pri1 = 3;
- function __construct($ar = array(), $flags = 0)
- {
- echo __METHOD__ . "()\n";
- parent::__construct($ar, $flags);
- $this->imp1 = 4;
- }
+ function __construct($ar = array(), $flags = 0)
+ {
+ echo __METHOD__ . "()\n";
+ parent::__construct($ar, $flags);
+ $this->imp1 = 4;
+ }
- function exchange()
- {
- echo __METHOD__ . "()\n";
- $this->exchangeArray($this);
- }
+ function exchange()
+ {
+ echo __METHOD__ . "()\n";
+ $this->exchangeArray($this);
+ }
- function dump()
- {
- echo __METHOD__ . "()\n";
- var_dump(array('Flags'=>$this->getFlags()
- ,'OVars'=>get_object_vars($this)
- ,'$this'=>$this));
- }
+ function dump()
+ {
+ echo __METHOD__ . "()\n";
+ var_dump(array('Flags'=>$this->getFlags()
+ ,'OVars'=>get_object_vars($this)
+ ,'$this'=>$this));
+ }
- function show()
- {
- echo __METHOD__ . "()\n";
- foreach($this as $n => $v)
- {
- var_dump(array($n => $v));
- }
- }
+ function show()
+ {
+ echo __METHOD__ . "()\n";
+ foreach($this as $n => $v)
+ {
+ var_dump(array($n => $v));
+ }
+ }
- function setFlags($flags)
- {
- echo __METHOD__ . "($flags)\n";
- ArrayObject::setFlags($flags);
- }
+ function setFlags($flags)
+ {
+ echo __METHOD__ . "($flags)\n";
+ ArrayObject::setFlags($flags);
+ }
- function getIterator()
- {
- echo __METHOD__ . "()\n";
- $it = new ArrayIteratorEx($this, $this->getFlags());
- $it->dyn2 = 5;
- $it->dump();
- return $it;
- }
+ function getIterator()
+ {
+ echo __METHOD__ . "()\n";
+ $it = new ArrayIteratorEx($this, $this->getFlags());
+ $it->dyn2 = 5;
+ $it->dump();
+ return $it;
+ }
}
function check($obj, $flags)
{
- echo "===CHECK===\n";
+ echo "===CHECK===\n";
- $obj->setFlags($flags);
- $obj->dump();
- $obj->show();
+ $obj->setFlags($flags);
+ $obj->dump();
+ $obj->show();
- echo "===FOREACH===\n";
+ echo "===FOREACH===\n";
- $it = $obj->getIterator();
- foreach($it as $n => $v)
- {
- var_dump(array($n => $v));
- }
+ $it = $obj->getIterator();
+ foreach($it as $n => $v)
+ {
+ var_dump(array($n => $v));
+ }
- echo "===PROPERTY===\n";
+ echo "===PROPERTY===\n";
- var_dump($obj->pub1);
- var_dump(isset($obj->a));
- $obj->setFlags($flags | 2);
- var_dump($obj->pub1);
- var_dump(isset($obj->a));
+ var_dump($obj->pub1);
+ var_dump(isset($obj->a));
+ $obj->setFlags($flags | 2);
+ var_dump($obj->pub1);
+ var_dump(isset($obj->a));
- var_dump($it->pub2);
- var_dump(isset($it->pub1));
- $it->setFlags($flags | 2);
- var_dump($it->pub2);
- var_dump(isset($it->pub1));
+ var_dump($it->pub2);
+ var_dump(isset($it->pub1));
+ $it->setFlags($flags | 2);
+ var_dump($it->pub2);
+ var_dump(isset($it->pub1));
}
$obj = new ArrayObjectEx(array(0=>1,'a'=>25, 'pub1'=>42), 0);
@@ -128,8 +128,6 @@ check($obj, 0);
check($obj, 1);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
ArrayObjectEx::__construct()
===CHECK===
@@ -836,4 +834,3 @@ bool(false)
ArrayIteratorEx::setFlags(3)
int(1)
bool(true)
-===DONE===
diff --git a/ext/spl/tests/array_018.phpt b/ext/spl/tests/array_018.phpt
index 9d20ae47a9..8da46a24db 100644
--- a/ext/spl/tests/array_018.phpt
+++ b/ext/spl/tests/array_018.phpt
Binary files differ
diff --git a/ext/spl/tests/array_019.phpt b/ext/spl/tests/array_019.phpt
index 30cc9972af..2a86e70589 100644
--- a/ext/spl/tests/array_019.phpt
+++ b/ext/spl/tests/array_019.phpt
@@ -9,10 +9,10 @@ $ar = new RecursiveArrayIterator(array(3)); foreach($ar as &$v) var_dump($v);
class ArrayIteratorEx extends ArrayIterator
{
- function current()
- {
- return ArrayIterator::current();
- }
+ function current()
+ {
+ return ArrayIterator::current();
+ }
}
$ar = new ArrayIteratorEx(array(4)); foreach($ar as $v) var_dump($v);
@@ -20,7 +20,6 @@ $ar = new ArrayIteratorEx(array(5)); foreach($ar as &$v) var_dump($v);
?>
===DONE===
-<?php exit(0); ?>
--EXPECTF--
int(1)
int(2)
diff --git a/ext/spl/tests/array_020.phpt b/ext/spl/tests/array_020.phpt
index 3258c7f16c..fa96f92ab3 100644
--- a/ext/spl/tests/array_020.phpt
+++ b/ext/spl/tests/array_020.phpt
@@ -5,47 +5,45 @@ SPL: ArrayIterator overloading
class ArrayIteratorEx extends ArrayIterator
{
- function rewind()
- {
- echo __METHOD__ . "\n";
- ArrayIterator::rewind();
- }
+ function rewind()
+ {
+ echo __METHOD__ . "\n";
+ ArrayIterator::rewind();
+ }
- function valid()
- {
- echo __METHOD__ . "\n";
- return ArrayIterator::valid();
- }
+ function valid()
+ {
+ echo __METHOD__ . "\n";
+ return ArrayIterator::valid();
+ }
- function key()
- {
- echo __METHOD__ . "\n";
- return ArrayIterator::key();
- }
+ function key()
+ {
+ echo __METHOD__ . "\n";
+ return ArrayIterator::key();
+ }
- function current()
- {
- echo __METHOD__ . "\n";
- return ArrayIterator::current();
- }
+ function current()
+ {
+ echo __METHOD__ . "\n";
+ return ArrayIterator::current();
+ }
- function next()
- {
- echo __METHOD__ . "\n";
- return ArrayIterator::next();
- }
+ function next()
+ {
+ echo __METHOD__ . "\n";
+ return ArrayIterator::next();
+ }
}
$ar = new ArrayIteratorEx(array(1,2));
foreach($ar as $k => $v)
{
- var_dump($k);
- var_dump($v);
+ var_dump($k);
+ var_dump($v);
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
ArrayIteratorEx::rewind
ArrayIteratorEx::valid
@@ -61,4 +59,3 @@ int(1)
int(2)
ArrayIteratorEx::next
ArrayIteratorEx::valid
-===DONE===
diff --git a/ext/spl/tests/array_021.phpt b/ext/spl/tests/array_021.phpt
index cfe2bcb77d..620347dcd7 100644
--- a/ext/spl/tests/array_021.phpt
+++ b/ext/spl/tests/array_021.phpt
@@ -5,27 +5,25 @@ SPL: ArrayObject::seek() and exceptions
class foo extends ArrayObject
{
- public function seek($key)
- {
- echo __METHOD__ . "($key)\n";
- throw new Exception("hi");
- }
+ public function seek($key)
+ {
+ echo __METHOD__ . "($key)\n";
+ throw new Exception("hi");
+ }
}
$test = new foo(array(1,2,3));
try
{
- $test->seek('bar');
+ $test->seek('bar');
}
catch (Exception $e)
{
- echo "got exception\n";
+ echo "got exception\n";
}
?>
-===DONE===
--EXPECT--
foo::seek(bar)
got exception
-===DONE===
diff --git a/ext/spl/tests/array_022.phpt b/ext/spl/tests/array_022.phpt
index 75eeb8884f..f7407bf602 100644
--- a/ext/spl/tests/array_022.phpt
+++ b/ext/spl/tests/array_022.phpt
@@ -6,11 +6,11 @@ SPL: ArrayObject/Iterator and reference to self
class MyArrayObject extends ArrayObject
{
- public function __construct()
- {
- parent::__construct($this);
- $this['bar'] = 'baz';
- }
+ public function __construct()
+ {
+ parent::__construct($this);
+ $this['bar'] = 'baz';
+ }
}
$a = new MyArrayObject;
@@ -27,11 +27,11 @@ var_dump($b);
class MyArrayIterator extends ArrayIterator
{
- public function __construct()
- {
- parent::__construct($this);
- $this['bar'] = 'baz';
- }
+ public function __construct()
+ {
+ parent::__construct($this);
+ $this['bar'] = 'baz';
+ }
}
$a = new MyArrayIterator;
@@ -43,7 +43,6 @@ var_dump($a);
var_dump($b);
?>
-===DONE===
--EXPECTF--
==ArrayObject===
object(MyArrayObject)#%d (1) {
@@ -67,4 +66,3 @@ object(MyArrayIterator)#%d (2) {
["baz"]=>
string(3) "Foo"
}
-===DONE===
diff --git a/ext/spl/tests/array_024.phpt b/ext/spl/tests/array_024.phpt
index 0c073bfe78..6223b8072e 100644
--- a/ext/spl/tests/array_024.phpt
+++ b/ext/spl/tests/array_024.phpt
@@ -1,5 +1,5 @@
--TEST--
-SPL: ArrayObject with overriden count()
+SPL: ArrayObject with overridden count()
--FILE--
<?php
$obj = new ArrayObject(array(1,2));
diff --git a/ext/spl/tests/array_026.phpt b/ext/spl/tests/array_026.phpt
index 8ff6aafb93..7a1784e30e 100644
--- a/ext/spl/tests/array_026.phpt
+++ b/ext/spl/tests/array_026.phpt
@@ -8,9 +8,9 @@ $test['d1']['d3'] = 'world';
var_dump($test, $test3['mmmmm']);
?>
--EXPECTF--
-Notice: Undefined variable: test3 in %s on line %d
+Warning: Undefined variable: test3 in %s on line %d
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
object(ArrayObject)#1 (1) {
["storage":"ArrayObject":private]=>
array(1) {
diff --git a/ext/spl/tests/bug28822.phpt b/ext/spl/tests/bug28822.phpt
index 7114edac9f..327681416e 100644
--- a/ext/spl/tests/bug28822.phpt
+++ b/ext/spl/tests/bug28822.phpt
@@ -9,8 +9,6 @@ var_dump($array->offsetExists('key'));
var_dump($array->offsetExists('nokey'));
?>
-===DONE===
--EXPECT--
bool(true)
bool(false)
-===DONE===
diff --git a/ext/spl/tests/bug31185.phpt b/ext/spl/tests/bug31185.phpt
index aa410ebaae..88cb3dbf7c 100644
--- a/ext/spl/tests/bug31185.phpt
+++ b/ext/spl/tests/bug31185.phpt
@@ -4,25 +4,25 @@ Bug #31185 (Crash when exceptions thrown from ArrayAccess::offsetUnset())
<?php
class FooBar implements ArrayAccess {
- private $array = array();
+ private $array = array();
- public function offsetExists($index) {
- return isset($this->array[$index]);
- }
+ public function offsetExists($index) {
+ return isset($this->array[$index]);
+ }
- public function offsetGet($index) {
- return $this->array[$index];
- }
+ public function offsetGet($index) {
+ return $this->array[$index];
+ }
- public function offsetSet($index, $value) {
- echo __METHOD__ . "($index, $value)\n";
- $this->array[$index] = $value;
- }
+ public function offsetSet($index, $value) {
+ echo __METHOD__ . "($index, $value)\n";
+ $this->array[$index] = $value;
+ }
- public function offsetUnset($index) {
- throw new Exception('FAIL');
- unset($this->array[$index]);
- }
+ public function offsetUnset($index) {
+ throw new Exception('FAIL');
+ unset($this->array[$index]);
+ }
}
@@ -33,16 +33,15 @@ $foo[$j++] = $i++;
$foo[$j++] = $i++;
try
{
- unset($foo[1]);
+ unset($foo[1]);
}
catch (Exception $e)
{
- echo "CAUGHT: " . $e->getMessage() . "\n";
+ echo "CAUGHT: " . $e->getMessage() . "\n";
}
print_R($foo);
?>
-===DONE===
--EXPECT--
FooBar::offsetSet(0, 0)
FooBar::offsetSet(1, 1)
@@ -58,4 +57,3 @@ FooBar Object
)
)
-===DONE===
diff --git a/ext/spl/tests/bug32134.phpt b/ext/spl/tests/bug32134.phpt
index 7c3f810401..a81924ed1d 100644
--- a/ext/spl/tests/bug32134.phpt
+++ b/ext/spl/tests/bug32134.phpt
@@ -13,7 +13,7 @@ class myArray extends ArrayIterator
public function offsetGet($index)
{
- static $i = 0;
+ static $i = 0;
echo __METHOD__ . "($index)\n";
if (++$i > 3) exit(1);
return parent::offsetGet($index);
@@ -36,8 +36,6 @@ $myArray['two'] = 'two';
var_dump($myArray['two']);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
myArray::offsetSet(one,one)
myArray::offsetGet(one)
@@ -45,4 +43,3 @@ string(3) "one"
myArray::offsetSet(two,two)
myArray::offsetGet(two)
string(3) "two"
-===DONE===
diff --git a/ext/spl/tests/bug32394.phpt b/ext/spl/tests/bug32394.phpt
index 8189b23f7a..519b0b049e 100644
--- a/ext/spl/tests/bug32394.phpt
+++ b/ext/spl/tests/bug32394.phpt
@@ -8,7 +8,7 @@ $object->append(1);
foreach($object as $key => $value)
{
- $object->offsetUnset($key);
+ $object->offsetUnset($key);
}
?>
diff --git a/ext/spl/tests/bug33136.phpt b/ext/spl/tests/bug33136.phpt
index 4d9a1506ca..8b52eae599 100644
--- a/ext/spl/tests/bug33136.phpt
+++ b/ext/spl/tests/bug33136.phpt
@@ -5,25 +5,25 @@ Bug #33136 (method offsetSet in class extended from ArrayObject crash PHP)
class Collection extends ArrayObject
{
- private $data;
+ private $data;
- function __construct()
- {
- $this->data = array();
- parent::__construct($this->data);
- }
+ function __construct()
+ {
+ $this->data = array();
+ parent::__construct($this->data);
+ }
- function offsetGet($index)
- {
- echo __METHOD__ . "($index)\n";
- return parent::offsetGet($index);
- }
+ function offsetGet($index)
+ {
+ echo __METHOD__ . "($index)\n";
+ return parent::offsetGet($index);
+ }
- function offsetSet($index, $value)
- {
- echo __METHOD__ . "(" . (is_null($index) ? "NULL" : $index) . ",$value)\n";
- parent::offsetSet($index, $value);
- }
+ function offsetSet($index, $value)
+ {
+ echo __METHOD__ . "(" . (is_null($index) ? "NULL" : $index) . ",$value)\n";
+ parent::offsetSet($index, $value);
+ }
}
echo "\n\nInitiate Obj\n";
@@ -46,8 +46,6 @@ print_r($arrayObj);
var_dump(count($arrayObj));
?>
-===DONE===
-<?php //exit(0); ?>
--EXPECT--
Initiate Obj
Assign values
@@ -77,4 +75,3 @@ Collection Object
)
int(3)
-===DONE===
diff --git a/ext/spl/tests/bug34548.phpt b/ext/spl/tests/bug34548.phpt
index 399aa33788..4615b1306b 100644
--- a/ext/spl/tests/bug34548.phpt
+++ b/ext/spl/tests/bug34548.phpt
@@ -5,15 +5,15 @@ Bug #34548 (Method append() in class extended from ArrayObject crashes PHP)
class Collection extends ArrayObject
{
- public function add($dataArray)
- {
- foreach($dataArray as $value) $this->append($value);
- }
+ public function add($dataArray)
+ {
+ foreach($dataArray as $value) $this->append($value);
+ }
- public function offsetSet($index, $value)
- {
- parent::offsetSet($index, $value);
- }
+ public function offsetSet($index, $value)
+ {
+ parent::offsetSet($index, $value);
+ }
}
$data1=array('one', 'two', 'three');
diff --git a/ext/spl/tests/bug36258.phpt b/ext/spl/tests/bug36258.phpt
index 428158c858..5e61b29928 100644
--- a/ext/spl/tests/bug36258.phpt
+++ b/ext/spl/tests/bug36258.phpt
@@ -6,14 +6,12 @@ Bug #36258 (SplFileObject::getPath() may lead to segfault)
$diriter = new RecursiveIteratorIterator( new RecursiveDirectoryIterator('.') );
foreach ($diriter as $key => $file) {
- var_dump($file->getFilename());
- var_dump($file->getPath());
- break;
+ var_dump($file->getFilename());
+ var_dump($file->getPath());
+ break;
}
?>
-===DONE===
--EXPECTF--
string(%d) "%s"
string(%d) "%s"
-===DONE===
diff --git a/ext/spl/tests/bug36287.phpt b/ext/spl/tests/bug36287.phpt
index 0c3f287d4f..0fa6e1bc1e 100644
--- a/ext/spl/tests/bug36287.phpt
+++ b/ext/spl/tests/bug36287.phpt
@@ -8,18 +8,17 @@ $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator("."), true);
$idx = 0;
foreach($it as $file)
{
- echo "First\n";
- var_Dump($file->getFilename());
- echo "Second\n";
- var_dump($file->getFilename());
- if (++$idx > 1)
- {
- break;
- }
+ echo "First\n";
+ var_Dump($file->getFilename());
+ echo "Second\n";
+ var_dump($file->getFilename());
+ if (++$idx > 1)
+ {
+ break;
+ }
}
?>
-===DONE===
--EXPECTF--
First
string(%d) "%s"
@@ -29,4 +28,3 @@ First
string(%d) "%s"
Second
string(%d) "%s"
-===DONE===
diff --git a/ext/spl/tests/bug36825.phpt b/ext/spl/tests/bug36825.phpt
index 3b68167204..072009cf84 100644
--- a/ext/spl/tests/bug36825.phpt
+++ b/ext/spl/tests/bug36825.phpt
@@ -5,27 +5,25 @@ Bug #36825 (Exceptions thrown in ArrayObject::offsetGet cause segfault)
class foo extends ArrayObject
{
- public function offsetGet($key)
- {
- echo __METHOD__ . "($key)\n";
- throw new Exception("hi");
- }
+ public function offsetGet($key)
+ {
+ echo __METHOD__ . "($key)\n";
+ throw new Exception("hi");
+ }
}
$test = new foo();
try
{
- var_dump($test['bar']);
+ var_dump($test['bar']);
}
catch (Exception $e)
{
- echo "got exception\n";
+ echo "got exception\n";
}
?>
-===DONE===
--EXPECT--
foo::offsetGet(bar)
got exception
-===DONE===
diff --git a/ext/spl/tests/bug36941.phpt b/ext/spl/tests/bug36941.phpt
index 528ba4a462..a21381da0a 100644
--- a/ext/spl/tests/bug36941.phpt
+++ b/ext/spl/tests/bug36941.phpt
@@ -27,7 +27,6 @@ var_dump($a[0], $b[0]);
$b[0] = 3;
var_dump($a[0], $b[0]);
?>
-===DONE===
--EXPECT--
===ArrayObject===
int(1)
@@ -43,4 +42,3 @@ int(2)
int(2)
int(3)
int(3)
-===DONE===
diff --git a/ext/spl/tests/bug37457.phpt b/ext/spl/tests/bug37457.phpt
index 4c92bbc357..792d5ae2a7 100644
--- a/ext/spl/tests/bug37457.phpt
+++ b/ext/spl/tests/bug37457.phpt
@@ -5,51 +5,51 @@ Bug #37457 (Crash when an exception is thrown in accept() method of FilterIterat
class Collection implements Iterator
{
- protected $array, $valid = false;
+ protected $array, $valid = false;
- public function __construct(array $a)
- {
- echo __METHOD__ . "\n";
- $this->array = $a;
- }
+ public function __construct(array $a)
+ {
+ echo __METHOD__ . "\n";
+ $this->array = $a;
+ }
- public function current()
- {
- echo __METHOD__ . "\n";
- return current($this->array);
- }
+ public function current()
+ {
+ echo __METHOD__ . "\n";
+ return current($this->array);
+ }
- public function key()
- {
- echo __METHOD__ . "\n";
- return key($this->array);
- }
+ public function key()
+ {
+ echo __METHOD__ . "\n";
+ return key($this->array);
+ }
- public function next()
- {
- echo __METHOD__ . "\n";
- $this->valid = (false !== next($this->array));
- }
+ public function next()
+ {
+ echo __METHOD__ . "\n";
+ $this->valid = (false !== next($this->array));
+ }
- public function valid()
- {
- echo __METHOD__ . "\n";
- return $this->valid;
- }
+ public function valid()
+ {
+ echo __METHOD__ . "\n";
+ return $this->valid;
+ }
- public function rewind()
- {
- echo __METHOD__ . "\n";
- $this->valid = (false !== reset($this->array));
- }
+ public function rewind()
+ {
+ echo __METHOD__ . "\n";
+ $this->valid = (false !== reset($this->array));
+ }
}
class TestFilter extends FilterIterator
{
public function accept()
{
- echo __METHOD__ . "\n";
- throw new Exception("Failure in Accept");
+ echo __METHOD__ . "\n";
+ throw new Exception("Failure in Accept");
}
}
@@ -57,18 +57,17 @@ $test = new TestFilter(new Collection(array(0)));
try
{
- foreach ($test as $item)
- {
- echo $item;
- }
+ foreach ($test as $item)
+ {
+ echo $item;
+ }
}
catch (Exception $e)
{
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
?>
-===DONE===
--EXPECT--
Collection::__construct
Collection::rewind
@@ -77,4 +76,3 @@ Collection::current
Collection::key
TestFilter::accept
string(17) "Failure in Accept"
-===DONE===
diff --git a/ext/spl/tests/bug38618.phpt b/ext/spl/tests/bug38618.phpt
index 097d169a98..71a09111a4 100644
--- a/ext/spl/tests/bug38618.phpt
+++ b/ext/spl/tests/bug38618.phpt
@@ -84,10 +84,6 @@ test_array($array, 'Protected Property');
test_array($array, 'Public Property New', RecursiveArrayIterator::CHILD_ARRAYS_ONLY);
test_array($array, 'Protected Property New', RecursiveArrayIterator::CHILD_ARRAYS_ONLY);
?>
-===DONE===
-<?php exit(0); ?>
-?>
-===DONE===
--EXPECT--
===Default with array===
1 => apple
@@ -102,4 +98,3 @@ title => grape
===Protected Property New===
1 => apple
1 => grape
-===DONE===
diff --git a/ext/spl/tests/bug40036.phpt b/ext/spl/tests/bug40036.phpt
index 8180c038ce..27757092bd 100644
--- a/ext/spl/tests/bug40036.phpt
+++ b/ext/spl/tests/bug40036.phpt
@@ -24,9 +24,7 @@ if (empty($view['baz']) || empty($view->baz)) {
echo "View::baz empty\n";
}
?>
-===DONE===
--EXPECT--
View::foo empty
View::bar empty
View::baz empty
-===DONE===
diff --git a/ext/spl/tests/bug40091.phpt b/ext/spl/tests/bug40091.phpt
index eb157e72ae..3bb1bbf152 100644
--- a/ext/spl/tests/bug40091.phpt
+++ b/ext/spl/tests/bug40091.phpt
@@ -3,10 +3,10 @@ Bug #40091 (issue with spl_autoload_register() and 2 instances of the same class
--FILE--
<?php
class MyAutoloader {
- function __construct($directory_to_use) {}
- function autoload($class_name) {
- // code to autoload based on directory
- }
+ function __construct($directory_to_use) {}
+ function autoload($class_name) {
+ // code to autoload based on directory
+ }
}
$autloader1 = new MyAutoloader('dir1');
@@ -17,7 +17,6 @@ spl_autoload_register(array($autloader2, 'autoload'));
print_r(spl_autoload_functions());
?>
-===DONE===
--EXPECT--
Array
(
@@ -40,4 +39,3 @@ Array
)
)
-===DONE===
diff --git a/ext/spl/tests/bug40442.phpt b/ext/spl/tests/bug40442.phpt
index fbeb22d2b3..d5968119e6 100644
--- a/ext/spl/tests/bug40442.phpt
+++ b/ext/spl/tests/bug40442.phpt
@@ -6,7 +6,5 @@ $a = new ArrayObject();
$a->offsetSet('property', 0);
var_dump($a->offsetExists('property'));
?>
-===DONE===
--EXPECT--
bool(true)
-===DONE===
diff --git a/ext/spl/tests/bug40872.phpt b/ext/spl/tests/bug40872.phpt
index a48fe74feb..77c0063de4 100644
--- a/ext/spl/tests/bug40872.phpt
+++ b/ext/spl/tests/bug40872.phpt
@@ -2,29 +2,27 @@
Bug #40872 (inconsistency in offsetSet, offsetExists treatment of string enclosed integers)
--FILE--
<?php
- class Project {
- public $id;
+ class Project {
+ public $id;
- function __construct($id) {
- $this->id = $id;
- }
- }
+ function __construct($id) {
+ $this->id = $id;
+ }
+ }
- class ProjectsList extends ArrayIterator {
- public function add(Project $item) {
- $this->offsetSet($item->id, $item);
- }
- }
+ class ProjectsList extends ArrayIterator {
+ public function add(Project $item) {
+ $this->offsetSet($item->id, $item);
+ }
+ }
- $projects = new ProjectsList();
- $projects->add(new Project('1'));
- $projects->add(new Project(2));
+ $projects = new ProjectsList();
+ $projects->add(new Project('1'));
+ $projects->add(new Project(2));
- var_dump($projects->offsetExists(1));
- var_dump($projects->offsetExists('2'));
+ var_dump($projects->offsetExists(1));
+ var_dump($projects->offsetExists('2'));
?>
-===DONE===
--EXPECT--
bool(true)
bool(true)
-===DONE===
diff --git a/ext/spl/tests/bug41691.phpt b/ext/spl/tests/bug41691.phpt
index d1c53a6fe6..93af430b48 100644
--- a/ext/spl/tests/bug41691.phpt
+++ b/ext/spl/tests/bug41691.phpt
@@ -4,12 +4,12 @@ Bug #41691 (ArrayObject::exchangeArray hangs Apache)
<?php
class A extends ArrayObject {
- public function __construct($dummy, $flags) {
- parent::__construct($this, $flags);
- }
- public $a;
- public $b;
- public $c;
+ public function __construct($dummy, $flags) {
+ parent::__construct($this, $flags);
+ }
+ public $a;
+ public $b;
+ public $c;
}
$a = new A(null, ArrayObject::ARRAY_AS_PROPS );
diff --git a/ext/spl/tests/bug42364.phpt b/ext/spl/tests/bug42364.phpt
index 4d00a18222..96afb22a02 100644
--- a/ext/spl/tests/bug42364.phpt
+++ b/ext/spl/tests/bug42364.phpt
@@ -20,7 +20,6 @@ if ($count > 0) {
echo "Found $count entries!\n";
}
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__ . '/bug42364/test');
@@ -28,4 +27,3 @@ rmdir(__DIR__ . '/bug42364');
?>
--EXPECTF--
Found %i entries!
-===DONE===
diff --git a/ext/spl/tests/bug42703.phpt b/ext/spl/tests/bug42703.phpt
index ab4ee5ed50..b54425c310 100644
--- a/ext/spl/tests/bug42703.phpt
+++ b/ext/spl/tests/bug42703.phpt
@@ -4,20 +4,20 @@ Bug #42703 (Exception raised in an iterator::current() causes segfault in Filter
<?php
class BlaIterator implements Iterator
{
- public function rewind() { }
+ public function rewind() { }
- public function next() { }
+ public function next() { }
- public function valid() {
- return true;
- }
+ public function valid() {
+ return true;
+ }
- public function current()
- {
- throw new Exception('boo');
- }
+ public function current()
+ {
+ throw new Exception('boo');
+ }
- public function key() { }
+ public function key() { }
}
$it = new BlaIterator();
@@ -25,11 +25,11 @@ $itit = new IteratorIterator($it);
try {
foreach($itit as $key => $value) {
- echo $key, $value;
+ echo $key, $value;
}
}
catch (Exception $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
var_dump($itit->current());
diff --git a/ext/spl/tests/bug45216.phpt b/ext/spl/tests/bug45216.phpt
deleted file mode 100644
index e8b04cb1fb..0000000000
--- a/ext/spl/tests/bug45216.phpt
+++ /dev/null
@@ -1,25 +0,0 @@
---TEST--
-SPL: SplFileObject::fgetss (bug 45216)
---CREDITS--
-Perrick Penet <perrick@noparking.net>
-#testfest phpcampparis 2008-06-07
---FILE--
-<?php
-$file = __DIR__ . '/foo.html';
-file_put_contents($file, 'text 0<div class="tested">text 1</div>');
-$handle = fopen($file, 'r');
-
-$object = new SplFileObject($file);
-var_dump($object->fgetss());
-var_dump(fgetss($handle));
-?>
---CLEAN--
-<?php
-unlink(__DIR__ . '/foo.html');
-?>
---EXPECTF--
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(12) "text 0text 1"
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(12) "text 0text 1"
diff --git a/ext/spl/tests/bug45614.phpt b/ext/spl/tests/bug45614.phpt
index d9e9207d28..8c688555d3 100644
--- a/ext/spl/tests/bug45614.phpt
+++ b/ext/spl/tests/bug45614.phpt
@@ -3,12 +3,12 @@ SPL: Bug#45614 (ArrayIterator can show 1st private prop of wrapped object)
--FILE--
<?php
class C {
- private $priv1 = 'secret1';
- private $priv2 = 'secret2';
- public $pub1 = 'public1';
- public $pub2 = 'public2';
- public $pub3 = 'public3';
- public $pub4 = 'public4';
+ private $priv1 = 'secret1';
+ private $priv2 = 'secret2';
+ public $pub1 = 'public1';
+ public $pub2 = 'public2';
+ public $pub3 = 'public3';
+ public $pub4 = 'public4';
}
function showFirstTwoItems($it) {
diff --git a/ext/spl/tests/bug45622.phpt b/ext/spl/tests/bug45622.phpt
index e2a7b905d5..ad84dda1d2 100644
--- a/ext/spl/tests/bug45622.phpt
+++ b/ext/spl/tests/bug45622.phpt
@@ -4,7 +4,7 @@ SPL: Bug #45622 (isset($arrayObject->p) misbehaves with ArrayObject::ARRAY_AS_PR
<?php
class C extends ArrayObject {
- public $p = 'object property';
+ public $p = 'object property';
}
$ao = new C(array('p'=>'array element'));
diff --git a/ext/spl/tests/bug45622b.phpt b/ext/spl/tests/bug45622b.phpt
index bf0ab8242e..c829b185dd 100644
--- a/ext/spl/tests/bug45622b.phpt
+++ b/ext/spl/tests/bug45622b.phpt
@@ -3,10 +3,10 @@ Ensure fix to bug45622 doesn't cause __isset() to be called when ArrayObject::AR
--FILE--
<?php
class UsesMagic extends ArrayObject {
- function __get($n) { echo "In " . __METHOD__ . "!\n"; }
- function __set($n, $v) { echo "In " . __METHOD__ . "!\n"; }
- function __isset($n) { echo "In " . __METHOD__ . "!\n"; }
- function __unset($n) { echo "In " . __METHOD__ . "!\n"; }
+ function __get($n) { echo "In " . __METHOD__ . "!\n"; }
+ function __set($n, $v) { echo "In " . __METHOD__ . "!\n"; }
+ function __isset($n) { echo "In " . __METHOD__ . "!\n"; }
+ function __unset($n) { echo "In " . __METHOD__ . "!\n"; }
}
$ao = new UsesMagic(array(), ArrayObject::ARRAY_AS_PROPS);
diff --git a/ext/spl/tests/bug46051.phpt b/ext/spl/tests/bug46051.phpt
index e993951ffa..d53f87bc47 100644
--- a/ext/spl/tests/bug46051.phpt
+++ b/ext/spl/tests/bug46051.phpt
@@ -6,8 +6,8 @@ Bug #46051 (SplFileInfo::openFile - memory overlap)
$x = new splfileinfo(__FILE__);
try {
-$x->openFile(NULL, NULL, NULL);
-} catch (Exception $e) { }
+ $x->openFile(NULL, NULL, NULL);
+} catch (TypeError $e) { }
var_dump($x->getPathName());
--EXPECTF--
diff --git a/ext/spl/tests/bug46160.phpt b/ext/spl/tests/bug46160.phpt
index e4dbdff192..3e03f094d3 100644
--- a/ext/spl/tests/bug46160.phpt
+++ b/ext/spl/tests/bug46160.phpt
@@ -4,8 +4,8 @@ Bug #46160 (SPL - Memory leak when exception is throwed in offsetSet method)
<?php
try {
- $x = new splqueue;
- $x->offsetSet(0, 0);
+ $x = new splqueue;
+ $x->offsetSet(0, 0);
} catch (Exception $e) { }
?>
diff --git a/ext/spl/tests/bug48361.phpt b/ext/spl/tests/bug48361.phpt
index 61c62c7b3f..3414c3b229 100644
--- a/ext/spl/tests/bug48361.phpt
+++ b/ext/spl/tests/bug48361.phpt
@@ -6,8 +6,6 @@ $info = new SplFileInfo(__FILE__);
var_dump($info->getRealPath());
var_dump($info->getPathInfo()->getRealPath());
?>
-===DONE===
--EXPECTF--
string(%d) "%stests%sbug48361.php"
string(%d) "%stests"
-===DONE===
diff --git a/ext/spl/tests/bug49263.phpt b/ext/spl/tests/bug49263.phpt
index 4d9e8e1d60..5a6c63178f 100644
--- a/ext/spl/tests/bug49263.phpt
+++ b/ext/spl/tests/bug49263.phpt
@@ -15,7 +15,6 @@ unset($s,$o1,$o2);
echo $ss."\n";
var_dump(unserialize($ss));
?>
-===DONE===
--EXPECTF--
O:16:"SplObjectStorage":2:{i:0;a:4:{i:0;O:8:"stdClass":0:{}i:1;a:2:{s:4:"prev";i:2;s:4:"next";O:8:"stdClass":0:{}}i:2;r:6;i:3;a:1:{s:4:"prev";r:3;}}i:1;a:0:{}}
object(SplObjectStorage)#2 (1) {
@@ -49,4 +48,3 @@ object(SplObjectStorage)#2 (1) {
}
}
}
-===DONE===
diff --git a/ext/spl/tests/bug50579.phpt b/ext/spl/tests/bug50579.phpt
index 7bc5deede8..fcf75b4b8d 100644
--- a/ext/spl/tests/bug50579.phpt
+++ b/ext/spl/tests/bug50579.phpt
@@ -4,30 +4,30 @@ Bug #50579 (RegexIterator::REPLACE doesn't work)
<?php
class foo extends ArrayIterator {
- public function __construct( ) {
- parent::__construct(array(
- 'test1'=>'test888',
- 'test2'=>'what?',
- 'test3'=>'test999'));
- }
+ public function __construct( ) {
+ parent::__construct(array(
+ 'test1'=>'test888',
+ 'test2'=>'what?',
+ 'test3'=>'test999'));
+ }
}
$h = new foo;
$i = new RegexIterator($h, '/^test(.*)/', RegexIterator::REPLACE);
$i->replacement = '[$0]';
foreach ($i as $name=>$value) {
- echo $name . '=>' . $value . "\n";
+ echo $name . '=>' . $value . "\n";
}
$i->replacement = '$1';
foreach ($i as $name=>$value) {
- echo $name . '=>' . $value . "\n";
+ echo $name . '=>' . $value . "\n";
}
$h = new foo;
$i = new RegexIterator($h, '/^test(.*)/', RegexIterator::REPLACE);
$i->replacement = '[$1]';
foreach ($i as $name=>$value) {
- echo $name . '=>' . $value . "\n";
+ echo $name . '=>' . $value . "\n";
}
?>
diff --git a/ext/spl/tests/bug51068.phpt b/ext/spl/tests/bug51068.phpt
index 0263536cc3..fd49c03be3 100644
--- a/ext/spl/tests/bug51068.phpt
+++ b/ext/spl/tests/bug51068.phpt
@@ -7,8 +7,8 @@ mkdir('bug.51068.dir');
touch('bug.51068.dir/lvl2.bug.51068');
$iter = new DirectoryIterator('glob://*.51068');
foreach ($iter as $f) {
- var_dump($f->getFilename());
- var_dump($f->getSize());
+ var_dump($f->getFilename());
+ var_dump($f->getSize());
}
$iter = new DirectoryIterator('glob://bug.51068.dir/*.51068');
foreach ($iter as $f) {
diff --git a/ext/spl/tests/bug51119.phpt b/ext/spl/tests/bug51119.phpt
index 441aa1280a..aba523dc62 100644
--- a/ext/spl/tests/bug51119.phpt
+++ b/ext/spl/tests/bug51119.phpt
@@ -25,10 +25,8 @@ try {
}
?>
-===DONE===
--EXPECT--
a
b
c
Parameter offset must be >= 0
-===DONE===
diff --git a/ext/spl/tests/bug51374.phpt b/ext/spl/tests/bug51374.phpt
index a4d285322d..0ce95e9c21 100644
--- a/ext/spl/tests/bug51374.phpt
+++ b/ext/spl/tests/bug51374.phpt
@@ -12,8 +12,6 @@ $file = $fileInfo->openFile('r');
print var_dump($file->bam); // is null or UNKNOWN:0
?>
-===DONE===
--EXPECT--
array(0) {
}
-===DONE===
diff --git a/ext/spl/tests/bug53071.phpt b/ext/spl/tests/bug53071.phpt
index 4a2450e201..9ab108cfd5 100644
--- a/ext/spl/tests/bug53071.phpt
+++ b/ext/spl/tests/bug53071.phpt
@@ -5,16 +5,16 @@ Bug #53071 (Usage of SPLObjectStorage defeats gc_collect_cycles)
gc_enable();
class myClass
{
- public $member;
+ public $member;
}
function LimitedScope()
{
- $myA = new myClass();
- $myB = new SplObjectStorage();
- $myC = new myClass();
- $myC->member = $myA; // myC has a reference to myA
- $myB->Attach($myC); // myB attaches myC
- $myA->member = $myB; // myA has myB, comleting the cycle
+ $myA = new myClass();
+ $myB = new SplObjectStorage();
+ $myC = new myClass();
+ $myC->member = $myA; // myC has a reference to myA
+ $myB->Attach($myC); // myB attaches myC
+ $myA->member = $myB; // myA has myB, comleting the cycle
}
LimitedScope();
var_dump(gc_collect_cycles());
diff --git a/ext/spl/tests/bug53362.phpt b/ext/spl/tests/bug53362.phpt
index 7ae74ce559..eec1f037eb 100644
--- a/ext/spl/tests/bug53362.phpt
+++ b/ext/spl/tests/bug53362.phpt
@@ -4,9 +4,9 @@ Bug #53362 (Segmentation fault when extending SplFixedArray)
<?php
class obj extends SplFixedArray{
- public function offsetSet($offset, $value) {
- var_dump($offset);
- }
+ public function offsetSet($offset, $value) {
+ var_dump($offset);
+ }
}
$obj = new obj;
diff --git a/ext/spl/tests/bug54281.phpt b/ext/spl/tests/bug54281.phpt
index 1d83699e14..5d214d9b18 100644
--- a/ext/spl/tests/bug54281.phpt
+++ b/ext/spl/tests/bug54281.phpt
@@ -4,7 +4,7 @@ Bug #54281 (Crash in spl_recursive_it_rewind_ex)
<?php
class RecursiveArrayIteratorIterator extends RecursiveIteratorIterator {
- function __construct($it, $max_depth) { }
+ function __construct($it, $max_depth) { }
}
$it = new RecursiveArrayIteratorIterator(new RecursiveArrayIterator(array()), 2);
diff --git a/ext/spl/tests/bug54291.phpt b/ext/spl/tests/bug54291.phpt
index b4c1a2dc4b..9f3bd49912 100644
--- a/ext/spl/tests/bug54291.phpt
+++ b/ext/spl/tests/bug54291.phpt
@@ -5,7 +5,7 @@ Bug #54291 (Crash iterating DirectoryIterator for dir name starting with \0)
$dir = new DirectoryIterator("\x00/abc");
$dir->isFile();
--EXPECTF--
-Fatal error: Uncaught UnexpectedValueException: DirectoryIterator::__construct() expects parameter 1 to be a valid path, string given in %s:%d
+Fatal error: Uncaught TypeError: DirectoryIterator::__construct() expects parameter 1 to be a valid path, string given in %s:%d
Stack trace:
#0 %s(%d): DirectoryIterator->__construct('\x00/abc')
#1 {main}
diff --git a/ext/spl/tests/bug54292.phpt b/ext/spl/tests/bug54292.phpt
index ffbbcc3220..ac0cee10d4 100644
--- a/ext/spl/tests/bug54292.phpt
+++ b/ext/spl/tests/bug54292.phpt
@@ -4,9 +4,9 @@ Bug #54292 (Wrong parameter causes crash in SplFileObject::__construct())
<?php
try {
- new SplFileObject('foo', array());
+ new SplFileObject('foo', array());
} catch (TypeError $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
?>
diff --git a/ext/spl/tests/bug54304.phpt b/ext/spl/tests/bug54304.phpt
index 143c26e153..5c6991a1ad 100644
--- a/ext/spl/tests/bug54304.phpt
+++ b/ext/spl/tests/bug54304.phpt
@@ -3,10 +3,10 @@ Bug #54304 (Setting replacement value for RegexIterator doesn't work)
--FILE--
<?php
class foo extends ArrayIterator {
- public function __construct( ) {
- parent::__construct(array(
- 'test3'=>'test999'));
- }
+ public function __construct( ) {
+ parent::__construct(array(
+ 'test3'=>'test999'));
+ }
}
$h = new foo;
@@ -14,7 +14,7 @@ $i = new RegexIterator($h, '/^test(.*)/', RegexIterator::REPLACE);
$i->replacement = 42;
var_dump($i->replacement);
foreach ($i as $name=>$value) {
- var_dump($name, $value);
+ var_dump($name, $value);
}
var_dump($i->replacement);
?>
diff --git a/ext/spl/tests/bug54323.phpt b/ext/spl/tests/bug54323.phpt
index df6416a0f1..a2e2522393 100644
--- a/ext/spl/tests/bug54323.phpt
+++ b/ext/spl/tests/bug54323.phpt
@@ -17,7 +17,7 @@ function testAccess($c, $ao) {
var_dump($c->prop, $ao['prop']);
}
--EXPECTF--
-Notice: Undefined property: C::$prop in %sbug54323.php on line 14
+Warning: Undefined property: C::$prop in %s on line %d
Notice: Undefined index: prop in %sbug54323.php on line 14
NULL
diff --git a/ext/spl/tests/bug54384.phpt b/ext/spl/tests/bug54384.phpt
index a9dae2e736..581845a43a 100644
--- a/ext/spl/tests/bug54384.phpt
+++ b/ext/spl/tests/bug54384.phpt
@@ -4,12 +4,12 @@ Bug #54384: Several SPL classes crash when the parent constructor is not called
<?php
function test($f) {
- try {
- $f();
- echo "ran normally (unexpected)\n\n";
- } catch (LogicException $e) {
- echo "exception (expected)\n";
- }
+ try {
+ $f();
+ echo "ran normally (unexpected)\n\n";
+ } catch (LogicException $e) {
+ echo "exception (expected)\n";
+ }
}
echo "IteratorIterator... ";
@@ -17,8 +17,8 @@ class IteratorIteratorTest extends IteratorIterator {
function __construct(){}
}
test( function() {
- $o = new IteratorIteratorTest;
- $o->rewind();
+ $o = new IteratorIteratorTest;
+ $o->rewind();
} );
echo "FilterIterator... ";
@@ -27,8 +27,8 @@ class FilterIteratorTest extends FilterIterator {
function accept(){}
}
test( function() {
- $o = new FilterIteratorTest;
- $o->rewind();
+ $o = new FilterIteratorTest;
+ $o->rewind();
} );
echo "RecursiveFilterIterator... ";
diff --git a/ext/spl/tests/bug55701.phpt b/ext/spl/tests/bug55701.phpt
index 28713700d1..6574b41652 100644
--- a/ext/spl/tests/bug55701.phpt
+++ b/ext/spl/tests/bug55701.phpt
@@ -5,7 +5,7 @@ Bug #55701 (GlobIterator throws LogicException with message 'The parent construc
//
// Some methods of GlobIterator do not throw a RuntimeException when the glob pattern doesn't match any file.
-// Most methods of GlobIterator throw a RuntimeException when the glob pattern does't match any file
+// Most methods of GlobIterator throw a RuntimeException when the glob pattern doesn't match any file
// because they get the properties of the current file
function testBaseClass($f) {
// The tested iterator is in an invalid state; the behaviour of most of its methods is undefined
diff --git a/ext/spl/tests/bug60201.phpt b/ext/spl/tests/bug60201.phpt
index 351b0b08a5..4087efcbc9 100644
--- a/ext/spl/tests/bug60201.phpt
+++ b/ext/spl/tests/bug60201.phpt
@@ -8,7 +8,6 @@ $params = $method->getParameters();
var_dump($params);
?>
-===DONE===
--EXPECTF--
array(3) {
[0]=>
@@ -27,4 +26,3 @@ array(3) {
string(6) "escape"
}
}
-===DONE===
diff --git a/ext/spl/tests/bug61347.phpt b/ext/spl/tests/bug61347.phpt
index 410d65b7e9..b83f48f7ff 100644
--- a/ext/spl/tests/bug61347.phpt
+++ b/ext/spl/tests/bug61347.phpt
@@ -12,7 +12,6 @@ var_dump(isset($b['no_exists'])); //false
var_dump(empty($b['b'])); //true
var_dump(empty($b[37])); //true
-var_dump(array_key_exists('b', $b)); //true
var_dump($b['b']);
$a = array('b' => '', 37 => false);
@@ -29,9 +28,6 @@ bool(false)
bool(false)
bool(true)
bool(true)
-
-Deprecated: array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead in %s on line %d
-bool(true)
NULL
bool(true)
bool(true)
diff --git a/ext/spl/tests/bug61453.phpt b/ext/spl/tests/bug61453.phpt
index e5b1387fd2..92312d542f 100644
--- a/ext/spl/tests/bug61453.phpt
+++ b/ext/spl/tests/bug61453.phpt
@@ -5,13 +5,13 @@ Bug #61453: SplObjectStorage does not identify objects correctly
$limit = 1000;
$objects = new SplObjectStorage;
for($i = 0; $i < $limit; $i++){
- $object = new StdClass;
+ $object = new StdClass;
- if(isset($objects[$object])){
- die("this should never happen, but did after $i iteration");
- }
+ if(isset($objects[$object])){
+ die("this should never happen, but did after $i iteration");
+ }
- $objects[$object] = 1;
+ $objects[$object] = 1;
}
?>
==DONE==
diff --git a/ext/spl/tests/bug62978.phpt b/ext/spl/tests/bug62978.phpt
index 972bd07ce1..7e61d27b89 100644
--- a/ext/spl/tests/bug62978.phpt
+++ b/ext/spl/tests/bug62978.phpt
@@ -31,9 +31,9 @@ NULL
Notice: Undefined index: epic_magic in %sbug62978.php on line %d
NULL
-Notice: Undefined variable: c in %sbug62978.php on line %d
+Warning: Undefined variable: c in %s on line %d
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
NULL
Notice: Undefined index: epic_magic in %sbug62978.php on line %d
@@ -46,7 +46,7 @@ Notice: Undefined index: epic_magic in %sbug62978.php on line %d
NULL
bool(false)
-Notice: Resource ID#%d used as offset, casting to integer (%d) in %sbug62978.php on line %d
+Warning: Resource ID#%d used as offset, casting to integer (%d) in %sbug62978.php on line %d
Notice: Undefined offset: %d in %sbug62978.php on line %d
NULL
diff --git a/ext/spl/tests/bug64023.phpt b/ext/spl/tests/bug64023.phpt
index cb98445279..82924659e0 100644
--- a/ext/spl/tests/bug64023.phpt
+++ b/ext/spl/tests/bug64023.phpt
@@ -4,7 +4,7 @@ Bug #64023: Overloading __toString() in SplFileInfo has no effect
<?php
class A extends \SplFileInfo
{
- public function __toString() {return ' -expected- ';}
+ public function __toString() {return ' -expected- ';}
}
$a = new A('/');
diff --git a/ext/spl/tests/bug65213.phpt b/ext/spl/tests/bug65213.phpt
index 5e34d9549c..d190941a0e 100644
--- a/ext/spl/tests/bug65213.phpt
+++ b/ext/spl/tests/bug65213.phpt
@@ -7,7 +7,5 @@ $o = new SplFileInfo('.');
var_dump((bool) $o);
?>
-===DONE===
--EXPECT--
bool(true)
-===DONE===
diff --git a/ext/spl/tests/bug65545.phpt b/ext/spl/tests/bug65545.phpt
index 76c29cbf48..bd5a7f06db 100644
--- a/ext/spl/tests/bug65545.phpt
+++ b/ext/spl/tests/bug65545.phpt
@@ -6,9 +6,6 @@ $obj = new SplFileObject(__FILE__, 'r');
$data = $obj->fread(5);
var_dump($data);
-$data = $obj->fread();
-var_dump($data);
-
$data = $obj->fread(0);
var_dump($data);
@@ -20,9 +17,6 @@ var_dump(strlen($data) === filesize(__FILE__) - 5);
--EXPECTF--
string(5) "<?php"
-Warning: SplFileObject::fread() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
Warning: SplFileObject::fread(): Length parameter must be greater than 0 in %s on line %d
bool(false)
bool(true)
diff --git a/ext/spl/tests/bug66834.phpt b/ext/spl/tests/bug66834.phpt
index eed26c815f..0ff909f422 100644
--- a/ext/spl/tests/bug66834.phpt
+++ b/ext/spl/tests/bug66834.phpt
@@ -6,47 +6,47 @@ SPL: Bug #66834
// overrides both offsetExists and offsetGet
class ArrayObjectBoth extends ArrayObject
{
- public function offsetExists($offset) {
- var_dump('Called: '.__METHOD__);
- return parent::offsetExists($offset);
- }
+ public function offsetExists($offset) {
+ var_dump('Called: '.__METHOD__);
+ return parent::offsetExists($offset);
+ }
- public function offsetGet($offset) {
- var_dump('Called: '.__METHOD__);
- return parent::offsetGet($offset);
- }
+ public function offsetGet($offset) {
+ var_dump('Called: '.__METHOD__);
+ return parent::offsetGet($offset);
+ }
}
// overrides only offsetExists
class ArrayObjectExists extends ArrayObject
{
- public function offsetExists($offset) {
- var_dump('Called: '.__METHOD__);
- return parent::offsetExists($offset);
- }
+ public function offsetExists($offset) {
+ var_dump('Called: '.__METHOD__);
+ return parent::offsetExists($offset);
+ }
}
// overrides only offsetGet
class ArrayObjectGet extends ArrayObject
{
- public function offsetGet($offset) {
- var_dump('Called: '.__METHOD__);
- return parent::offsetGet($offset);
- }
+ public function offsetGet($offset) {
+ var_dump('Called: '.__METHOD__);
+ return parent::offsetGet($offset);
+ }
}
// overrides only offsetGet and offsetSet
class ArrayObjectGetSet extends ArrayObject
{
- public function offsetGet($offset)
- {
- return parent::offsetGet(str_rot13($offset));
- }
+ public function offsetGet($offset)
+ {
+ return parent::offsetGet(str_rot13($offset));
+ }
- public function offsetSet($offset, $value)
- {
- return parent::offsetSet(str_rot13($offset), $value);
- }
+ public function offsetSet($offset, $value)
+ {
+ return parent::offsetSet(str_rot13($offset), $value);
+ }
}
$values = ['foo' => '', 'bar' => null, 'baz' => 42];
diff --git a/ext/spl/tests/bug67359.phpt b/ext/spl/tests/bug67359.phpt
index 3e8f30cd2b..3a867f1f87 100644
--- a/ext/spl/tests/bug67359.phpt
+++ b/ext/spl/tests/bug67359.phpt
@@ -4,20 +4,20 @@ Bug #67359 (Segfault in recursiveDirectoryIterator)
<?php
try
{
- $rdi = new recursiveDirectoryIterator(__DIR__, FilesystemIterator::SKIP_DOTS | FilesystemIterator::UNIX_PATHS);
- $it = new recursiveIteratorIterator( $rdi );
- $it->seek(1);
- while( $it->valid())
- {
- if( $it->isFile() )
- {
- $it->current();
- }
+ $rdi = new recursiveDirectoryIterator(__DIR__, FilesystemIterator::SKIP_DOTS | FilesystemIterator::UNIX_PATHS);
+ $it = new recursiveIteratorIterator( $rdi );
+ $it->seek(1);
+ while( $it->valid())
+ {
+ if( $it->isFile() )
+ {
+ $it->current();
+ }
- $it->next();
- }
+ $it->next();
+ }
- $it->current();
+ $it->current();
}
catch(Exception $e)
{
diff --git a/ext/spl/tests/bug67582.phpt b/ext/spl/tests/bug67582.phpt
index b22f615034..331accbe7e 100644
--- a/ext/spl/tests/bug67582.phpt
+++ b/ext/spl/tests/bug67582.phpt
@@ -4,8 +4,8 @@ Bug #67582: Cloned SplObjectStorage with overwritten getHash fails offsetExists(
<?php
class MyObjectStorage extends SplObjectStorage {
- // Overwrite getHash() with just some (working) test-method
- public function getHash($object) { return get_class($object); }
+ // Overwrite getHash() with just some (working) test-method
+ public function getHash($object) { return get_class($object); }
}
class TestObject {}
diff --git a/ext/spl/tests/bug68128.phpt b/ext/spl/tests/bug68128.phpt
index 5ac7f8b2fb..69d63a890a 100644
--- a/ext/spl/tests/bug68128.phpt
+++ b/ext/spl/tests/bug68128.phpt
@@ -21,13 +21,13 @@ foreach ($rRegexIterator as $key1 => $value1) {
// print all children
echo "Children: ";
foreach ($rRegexIterator->getChildren() as $key => $value) {
- print_r($value);
+ print_r($value);
}
echo "\n";
} else {
echo "No children ";
- print_r($value1);
- echo "\n";
+ print_r($value1);
+ echo "\n";
}
}
diff --git a/ext/spl/tests/bug68175.phpt b/ext/spl/tests/bug68175.phpt
index bba769b23b..109a2cee26 100644
--- a/ext/spl/tests/bug68175.phpt
+++ b/ext/spl/tests/bug68175.phpt
@@ -10,9 +10,7 @@ var_dump(
$regex->getPregFlags()
);
?>
-===DONE===
--EXPECT--
int(0)
int(0)
int(0)
-===DONE===
diff --git a/ext/spl/tests/bug68479.phpt b/ext/spl/tests/bug68479.phpt
index 5d2aacb346..0ce7c96968 100644
--- a/ext/spl/tests/bug68479.phpt
+++ b/ext/spl/tests/bug68479.phpt
@@ -8,7 +8,6 @@ $params = $method->getParameters();
var_dump($params);
?>
-===DONE===
--EXPECT--
array(4) {
[0]=>
@@ -32,4 +31,3 @@ array(4) {
string(6) "escape"
}
}
-===DONE===
diff --git a/ext/spl/tests/bug68825.phpt b/ext/spl/tests/bug68825.phpt
index e662503611..4cd3af2fba 100644
--- a/ext/spl/tests/bug68825.phpt
+++ b/ext/spl/tests/bug68825.phpt
@@ -17,10 +17,8 @@ foreach ($di as $entry) {
}
}
?>
-===DONE===
--EXPECTF--
string(%d) "%s%eext%espl%etests%ebug68825.php"
-===DONE===
--CLEAN--
<?php
$dir = __DIR__ . '/bug68825';
diff --git a/ext/spl/tests/bug69108.phpt b/ext/spl/tests/bug69108.phpt
index 1829e9b2a2..3122da599c 100644
--- a/ext/spl/tests/bug69108.phpt
+++ b/ext/spl/tests/bug69108.phpt
@@ -7,9 +7,9 @@ zend.enable_gc=1
$a = array();
$b = new SplObjectStorage();
for ($i = 10000; $i > 0; $i--) {
- $object = new StdClass();
- $a[] = $object;
- $b->attach($object);
+ $object = new StdClass();
+ $a[] = $object;
+ $b->attach($object);
}
$c = serialize(array($a, $b));
diff --git a/ext/spl/tests/bug69335.phpt b/ext/spl/tests/bug69335.phpt
index 3b065b6473..acd5588b3e 100644
--- a/ext/spl/tests/bug69335.phpt
+++ b/ext/spl/tests/bug69335.phpt
@@ -6,10 +6,10 @@ $a = array(1=>1, 3=>3, 5=>5, 7=>7);
$a = new ArrayObject($a);
foreach ($a as $k => $v) {
- var_dump("$k => $v");
- if ($k == 3) {
- $a['a'] = "?";
- }
+ var_dump("$k => $v");
+ if ($k == 3) {
+ $a['a'] = "?";
+ }
}
?>
--EXPECT--
diff --git a/ext/spl/tests/bug69845.phpt b/ext/spl/tests/bug69845.phpt
index db88a8e10d..09c9f2356d 100644
--- a/ext/spl/tests/bug69845.phpt
+++ b/ext/spl/tests/bug69845.phpt
@@ -3,9 +3,9 @@ Fixed bug #69845 (ArrayObject with ARRAY_AS_PROPS broken)
--FILE--
<?php
for ($i = 0; $i<2; $i++) {
- $data = new \ArrayObject(new stdClass(), ArrayObject::ARRAY_AS_PROPS);
- $data->itemType = 'bulletin';
- var_dump(!is_null($data['itemType']));
+ $data = new \ArrayObject(new stdClass(), ArrayObject::ARRAY_AS_PROPS);
+ $data->itemType = 'bulletin';
+ var_dump(!is_null($data['itemType']));
}
?>
--EXPECT--
diff --git a/ext/spl/tests/bug69970.phpt b/ext/spl/tests/bug69970.phpt
index a488037b8c..c82d0b58c6 100644
--- a/ext/spl/tests/bug69970.phpt
+++ b/ext/spl/tests/bug69970.phpt
@@ -10,12 +10,12 @@ class RecursiveArrayIteratorIterator extends RecursiveIteratorIterator {
echo "dummy\n";
}
function endChildren() {
- global $count;
- echo $this->getDepth();
- if (--$count > 0) {
- // Trigger use-after-free
- parent::rewind();
- }
+ global $count;
+ echo $this->getDepth();
+ if (--$count > 0) {
+ // Trigger use-after-free
+ parent::rewind();
+ }
}
}
$arr = array("a", array("ba", array("bba", "bbb")));
diff --git a/ext/spl/tests/bug70068.phpt b/ext/spl/tests/bug70068.phpt
index dc949da8fa..54f3cca449 100644
--- a/ext/spl/tests/bug70068.phpt
+++ b/ext/spl/tests/bug70068.phpt
@@ -5,7 +5,7 @@ Bug #70068 (Dangling pointer in the unserialization of ArrayObject items)
try {
$a = unserialize('a:3:{i:0;C:11:"ArrayObject":20:{x:i:0;r:3;;m:a:0:{};}i:1;d:11;i:2;S:31:"AAAAAAAABBBBCCCC\01\00\00\00\04\00\00\00\00\00\00\00\00\00\00";}');
} catch(Exception $e) {
- print $e->getMessage()."\n";
+ print $e->getMessage()."\n";
}
?>
OK
diff --git a/ext/spl/tests/bug70166.phpt b/ext/spl/tests/bug70166.phpt
index 51a35965a5..a990a33a6a 100644
--- a/ext/spl/tests/bug70166.phpt
+++ b/ext/spl/tests/bug70166.phpt
@@ -13,7 +13,6 @@ for($i = 0; $i < 5; $i++) {
var_dump($data);
?>
-===DONE===
--EXPECTF--
array(2) {
[0]=>
@@ -26,4 +25,3 @@ array(2) {
array(0) {
}
}
-===DONE===
diff --git a/ext/spl/tests/bug70168.phpt b/ext/spl/tests/bug70168.phpt
index e1f7e9f820..d0cfc50e20 100644
--- a/ext/spl/tests/bug70168.phpt
+++ b/ext/spl/tests/bug70168.phpt
@@ -13,7 +13,6 @@ for($i = 0; $i < 5; $i++) {
var_dump($data);
?>
-===DONE===
--EXPECTF--
array(2) {
[0]=>
@@ -33,4 +32,3 @@ array(2) {
[1]=>
int(1)
}
-===DONE===
diff --git a/ext/spl/tests/bug70169.phpt b/ext/spl/tests/bug70169.phpt
index 9d814be5fa..418b4f4d0a 100644
--- a/ext/spl/tests/bug70169.phpt
+++ b/ext/spl/tests/bug70169.phpt
@@ -13,7 +13,6 @@ for($i = 0; $i < 5; $i++) {
var_dump($data);
?>
-===DONE===
--EXPECTF--
array(2) {
[0]=>
@@ -27,4 +26,3 @@ array(2) {
[1]=>
int(1)
}
-===DONE===
diff --git a/ext/spl/tests/bug70365.phpt b/ext/spl/tests/bug70365.phpt
index c18110e3ca..06786aaf16 100644
--- a/ext/spl/tests/bug70365.phpt
+++ b/ext/spl/tests/bug70365.phpt
@@ -3,10 +3,10 @@ SPL: Bug #70365 use-after-free vulnerability in unserialize() with SplObjectStor
--FILE--
<?php
class obj {
- var $ryat;
- function __wakeup() {
- $this->ryat = 1;
- }
+ var $ryat;
+ function __wakeup() {
+ $this->ryat = 1;
+ }
}
$fakezval = ptr2str(1122334455);
@@ -25,12 +25,12 @@ var_dump($data);
function ptr2str($ptr)
{
- $out = '';
- for ($i = 0; $i < 8; $i++) {
- $out .= chr($ptr & 0xff);
- $ptr >>= 8;
- }
- return $out;
+ $out = '';
+ for ($i = 0; $i < 8; $i++) {
+ $out .= chr($ptr & 0xff);
+ $ptr >>= 8;
+ }
+ return $out;
}
--EXPECTF--
array(5) {
diff --git a/ext/spl/tests/bug70366.phpt b/ext/spl/tests/bug70366.phpt
index da4cc2d389..d3d3317bff 100644
--- a/ext/spl/tests/bug70366.phpt
+++ b/ext/spl/tests/bug70366.phpt
@@ -3,10 +3,10 @@ SPL: Bug #70366 use-after-free vulnerability in unserialize() with SplDoublyLink
--FILE--
<?php
class obj {
- var $ryat;
- function __wakeup() {
- $this->ryat = 1;
- }
+ var $ryat;
+ function __wakeup() {
+ $this->ryat = 1;
+ }
}
$fakezval = ptr2str(1122334455);
@@ -25,12 +25,12 @@ var_dump($data);
function ptr2str($ptr)
{
- $out = '';
- for ($i = 0; $i < 8; $i++) {
- $out .= chr($ptr & 0xff);
- $ptr >>= 8;
- }
- return $out;
+ $out = '';
+ for ($i = 0; $i < 8; $i++) {
+ $out .= chr($ptr & 0xff);
+ $ptr >>= 8;
+ }
+ return $out;
}
?>
--EXPECTF--
diff --git a/ext/spl/tests/bug70730.phpt b/ext/spl/tests/bug70730.phpt
index 5710c9586d..9d52238426 100644
--- a/ext/spl/tests/bug70730.phpt
+++ b/ext/spl/tests/bug70730.phpt
@@ -4,20 +4,20 @@ Bug #70730 (Incorrect ArrayObject serialization if unset is called in serialize(
<?php
class A extends \ArrayObject
{
- protected $foo;
+ protected $foo;
- public function __construct()
- {
- $this->foo = 'bar';
- }
+ public function __construct()
+ {
+ $this->foo = 'bar';
+ }
- public function serialize()
- {
- unset($this->foo);
- $result = parent::serialize();
- $this->foo = 'bar';
- return $result;
- }
+ public function serialize()
+ {
+ unset($this->foo);
+ $result = parent::serialize();
+ $this->foo = 'bar';
+ return $result;
+ }
}
$a = new A();
diff --git a/ext/spl/tests/bug70852.phpt b/ext/spl/tests/bug70852.phpt
index 2b23ce4e09..463f9d1b43 100644
--- a/ext/spl/tests/bug70852.phpt
+++ b/ext/spl/tests/bug70852.phpt
@@ -7,11 +7,9 @@ $y = new ArrayObject();
var_dump($y[NULL]);
var_dump($y[NULL]++);
?>
-===DONE===
--EXPECTF--
Notice: Undefined index: in %s on line %d
NULL
Notice: Undefined index: in %s on line %d
NULL
-===DONE===
diff --git a/ext/spl/tests/bug70959.phpt b/ext/spl/tests/bug70959.phpt
index 541807ae16..fde022ab92 100644
--- a/ext/spl/tests/bug70959.phpt
+++ b/ext/spl/tests/bug70959.phpt
@@ -3,15 +3,15 @@ Bug #70959 (ArrayObject unserialize does not restore protected fields)
--FILE--
<?php
class testObject extends ArrayObject {
- protected $test;
+ protected $test;
- public function getTest() {
- return $this->test;
- }
+ public function getTest() {
+ return $this->test;
+ }
- public function setTest($test) {
- $this->test = $test;
- }
+ public function setTest($test) {
+ $this->test = $test;
+ }
}
$obj = new testObject();
diff --git a/ext/spl/tests/bug71028.phpt b/ext/spl/tests/bug71028.phpt
index b8f0cc962f..20aa4467e9 100644
--- a/ext/spl/tests/bug71028.phpt
+++ b/ext/spl/tests/bug71028.phpt
@@ -3,7 +3,7 @@ Bug #71028 (Undefined index with ArrayIterator)
--FILE--
<?php
function cast(&$a) {
- $a = (int)$a;
+ $a = (int)$a;
}
$a = new ArrayIterator;
diff --git a/ext/spl/tests/bug71202.phpt b/ext/spl/tests/bug71202.phpt
index d26d7e1f35..84c9b60944 100644
--- a/ext/spl/tests/bug71202.phpt
+++ b/ext/spl/tests/bug71202.phpt
@@ -4,34 +4,34 @@ Bug #71202 (Autoload function registered by another not activated immediately)
<?php
function inner_autoload ($name){
- if ($name == 'A') {
- class A {
- function __construct(){
- echo "okey, ";
- }
- }
- } else {
- class B {
- function __construct() {
- die("error");
- }
- }
- }
+ if ($name == 'A') {
+ class A {
+ function __construct(){
+ echo "okey, ";
+ }
+ }
+ } else {
+ class B {
+ function __construct() {
+ die("error");
+ }
+ }
+ }
}
spl_autoload_register(function ($name) {
- if ($name == 'A') {
- spl_autoload_register("inner_autoload");
- } else {
- spl_autoload_unregister("inner_autoload");
- }
+ if ($name == 'A') {
+ spl_autoload_register("inner_autoload");
+ } else {
+ spl_autoload_unregister("inner_autoload");
+ }
});
$c = new A();
try {
- $c = new B();
+ $c = new B();
} catch (Error $e) {
- echo "done";
+ echo "done";
}
?>
--EXPECT--
diff --git a/ext/spl/tests/bug71204.phpt b/ext/spl/tests/bug71204.phpt
index 64fa13bfb1..a984690fcb 100644
--- a/ext/spl/tests/bug71204.phpt
+++ b/ext/spl/tests/bug71204.phpt
@@ -4,7 +4,7 @@ Bug #71204 (segfault if clean spl_autoload_funcs while autoloading )
<?php
spl_autoload_register(function ($name) {
- spl_autoload_unregister("spl_autoload_call");
+ spl_autoload_unregister("spl_autoload_call");
});
spl_autoload_register(function ($name) {
diff --git a/ext/spl/tests/bug71617.phpt b/ext/spl/tests/bug71617.phpt
index 412f83f541..cc0c105a96 100644
--- a/ext/spl/tests/bug71617.phpt
+++ b/ext/spl/tests/bug71617.phpt
@@ -6,23 +6,23 @@ Bug #71617: private properties lost when unserializing ArrayObject
class Test extends ArrayObject
{
- private $name = null;
-
- public function __construct(array $input)
- {
- parent::__construct($input, ArrayObject::ARRAY_AS_PROPS);
- }
-
- public function setName($name)
- {
- $this->name = $name;
- return $this;
- }
-
- public function getName()
- {
- return $this->name;
- }
+ private $name = null;
+
+ public function __construct(array $input)
+ {
+ parent::__construct($input, ArrayObject::ARRAY_AS_PROPS);
+ }
+
+ public function setName($name)
+ {
+ $this->name = $name;
+ return $this;
+ }
+
+ public function getName()
+ {
+ return $this->name;
+ }
}
$test = new Test(['a' => 'a', 'b' => 'b']);
diff --git a/ext/spl/tests/bug71735.phpt b/ext/spl/tests/bug71735.phpt
index 1134b5d6dd..fd89cade78 100644
--- a/ext/spl/tests/bug71735.phpt
+++ b/ext/spl/tests/bug71735.phpt
@@ -6,10 +6,8 @@ try {
$var_1=new SplStack();
$var_1->offsetSet(100,new DateTime('2000-01-01'));
} catch(OutOfRangeException $e) {
- print $e->getMessage()."\n";
+ print $e->getMessage()."\n";
}
?>
-===DONE===
--EXPECT--
Offset invalid or out of range
-===DONE===
diff --git a/ext/spl/tests/bug72051.phpt b/ext/spl/tests/bug72051.phpt
index 1dfc056d7e..b0fe05169a 100644
--- a/ext/spl/tests/bug72051.phpt
+++ b/ext/spl/tests/bug72051.phpt
@@ -4,12 +4,12 @@ Bug #72051 (The reference in CallbackFilterIterator doesn't work as expected)
<?php
$data = [
- [1,2]
+ [1,2]
];
$callbackTest = new CallbackFilterIterator(new ArrayIterator($data), function (&$current) {
- $current['message'] = 'Test message';
- return true;
+ $current['message'] = 'Test message';
+ return true;
});
$callbackTest->rewind();
diff --git a/ext/spl/tests/bug72684.phpt b/ext/spl/tests/bug72684.phpt
index 7a99901f53..06665efdaa 100644
--- a/ext/spl/tests/bug72684.phpt
+++ b/ext/spl/tests/bug72684.phpt
@@ -11,9 +11,9 @@ $appendIterator->append($generator);
iterator_to_array($appendIterator);
try {
- iterator_to_array($appendIterator);
+ iterator_to_array($appendIterator);
} catch (\Exception $e) {
- echo $e->getMessage();
+ echo $e->getMessage();
}
?>
diff --git a/ext/spl/tests/bug72888.phpt b/ext/spl/tests/bug72888.phpt
index d354490f88..5e1aa2344b 100644
--- a/ext/spl/tests/bug72888.phpt
+++ b/ext/spl/tests/bug72888.phpt
@@ -5,14 +5,14 @@ Bug #72888 (Segfault on clone on splFileObject)
$x = new SplFileObject(__FILE__);
try {
- $y=clone $x;
+ $y=clone $x;
} catch (Error $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
var_dump($y);
?>
--EXPECTF--
string(60) "Trying to clone an uncloneable object of class SplFileObject"
-Notice: Undefined variable: y in %sbug72888.php on line %d
+Warning: Undefined variable: y in %s on line %d
NULL
diff --git a/ext/spl/tests/bug73029.phpt b/ext/spl/tests/bug73029.phpt
index 8789e91df2..5c3cd8420d 100644
--- a/ext/spl/tests/bug73029.phpt
+++ b/ext/spl/tests/bug73029.phpt
@@ -7,7 +7,7 @@ $a = 'C:11:"ArrayObject":19:0x:i:0;r:2;;m:a:0:{}}';
$m = unserialize($a);
$x = $m[2];
} catch(UnexpectedValueException $e) {
- print $e->getMessage() . "\n";
+ print $e->getMessage() . "\n";
}
?>
DONE
diff --git a/ext/spl/tests/bug73423.phpt b/ext/spl/tests/bug73423.phpt
index 549ceabb8a..451748e52b 100644
--- a/ext/spl/tests/bug73423.phpt
+++ b/ext/spl/tests/bug73423.phpt
@@ -48,7 +48,7 @@ class fooIterator extends \RecursiveFilterIterator
{
public Function __destruct ()
{
- eval("class A extends NotExists {}");
+ eval("class A extends NotExists {}");
/* CRASH */
}
diff --git a/ext/spl/tests/bug73629.phpt b/ext/spl/tests/bug73629.phpt
index 9ad0cec60f..f66c319ca1 100644
--- a/ext/spl/tests/bug73629.phpt
+++ b/ext/spl/tests/bug73629.phpt
@@ -14,7 +14,5 @@ try {
echo 'expected exception: ' . $e->getMessage() . "\n";
}
?>
-===DONE===
--EXPECT--
expected exception: Iterators' LIFO/FIFO modes for SplStack/SplQueue objects are frozen
-===DONE===
diff --git a/ext/spl/tests/bug73686.phpt b/ext/spl/tests/bug73686.phpt
index ae9a59c4aa..51858bc33c 100644
--- a/ext/spl/tests/bug73686.phpt
+++ b/ext/spl/tests/bug73686.phpt
@@ -7,8 +7,8 @@ $ao = new ArrayObject;
foreach ([1, 2, 3] as $i => $var)
{
- settype($var, 'string');
- $ao[$i] = $var;
+ settype($var, 'string');
+ $ao[$i] = $var;
}
var_dump($ao);
@@ -16,7 +16,7 @@ $ao = new ArrayObject;
foreach ([1, 2, 3] as $i => $var)
{
- $ao[$i] = &$var;
+ $ao[$i] = &$var;
}
var_dump($ao);
?>
diff --git a/ext/spl/tests/bug73896.phpt b/ext/spl/tests/bug73896.phpt
index 08d8f1e6c8..18e54644a9 100644
--- a/ext/spl/tests/bug73896.phpt
+++ b/ext/spl/tests/bug73896.phpt
@@ -18,7 +18,7 @@ class teLoader {
}
protected function autoload($class) {
- die("Protected autoload() called!\n");
+ die("Protected autoload() called!\n");
}
public function doSomething() {
@@ -29,9 +29,9 @@ class teLoader {
$teLoader = new teLoader();
try {
- new teChild();
+ new teChild();
} catch (Throwable $e) {
- echo "Exception: ", $e->getMessage() , "\n";
+ echo "Exception: ", $e->getMessage() , "\n";
}
?>
--EXPECT--
diff --git a/ext/spl/tests/bug74519.phpt b/ext/spl/tests/bug74519.phpt
index 6492997b1a..5a2b958d01 100644
--- a/ext/spl/tests/bug74519.phpt
+++ b/ext/spl/tests/bug74519.phpt
@@ -10,14 +10,12 @@ $iterator->append($events);
$events->next();
while($iterator->valid()) {
- echo $iterator->current(), "\n";
- $iterator->next();
+ echo $iterator->current(), "\n";
+ $iterator->next();
}
?>
-===DONE===
--EXPECT--
2
3
4
5
-===DONE===
diff --git a/ext/spl/tests/bug75049.phpt b/ext/spl/tests/bug75049.phpt
index eafdb84541..cf1f80367c 100644
--- a/ext/spl/tests/bug75049.phpt
+++ b/ext/spl/tests/bug75049.phpt
@@ -9,7 +9,7 @@ echo (int)spl_autoload_register($autoloader);
echo (int)spl_autoload_unregister($autoloader);
echo (int)spl_autoload_register($autoloader);
foreach (spl_autoload_functions() as $loader) {
- echo (int)spl_autoload_unregister($loader);
+ echo (int)spl_autoload_unregister($loader);
}
echo (int)count(spl_autoload_functions());
--EXPECT--
diff --git a/ext/spl/tests/bug75717.phpt b/ext/spl/tests/bug75717.phpt
index 485b9d8bc4..77226e1099 100644
--- a/ext/spl/tests/bug75717.phpt
+++ b/ext/spl/tests/bug75717.phpt
@@ -8,7 +8,7 @@ function flatten(array $nestedArraysAndStrings){
$iter = new RecursiveIteratorIterator(
new RecursiveArrayIterator($nestedArraysAndStrings));
foreach($iter as $leaf){ $flat[] = $leaf; }
- return join(NULL, $flat);
+ return join(null, $flat);
}
$noRefs = [[[['some']]],[' nested '],"items"];
diff --git a/ext/spl/tests/bug76367.phpt b/ext/spl/tests/bug76367.phpt
index 38aefbc922..7e9d7e66ba 100644
--- a/ext/spl/tests/bug76367.phpt
+++ b/ext/spl/tests/bug76367.phpt
@@ -7,7 +7,7 @@ $arr = [1,3,55,66,43,6];
$iter = new NoRewindIterator(new ArrayIterator($arr));
while($iter->valid()) {
- $iter->next();
+ $iter->next();
}
var_dump($iter->current());
diff --git a/ext/spl/tests/bug78863.phpt b/ext/spl/tests/bug78863.phpt
index dc88d98dee..c08c88a5d7 100644
--- a/ext/spl/tests/bug78863.phpt
+++ b/ext/spl/tests/bug78863.phpt
@@ -16,7 +16,7 @@ foreach ($it as $fileinfo) {
}
?>
--EXPECTF--
-Fatal error: Uncaught UnexpectedValueException: DirectoryIterator::__construct() expects parameter 1 to be a valid path, string given in %s:%d
+Fatal error: Uncaught TypeError: DirectoryIterator::__construct() expects parameter 1 to be a valid path, string given in %s:%d
Stack trace:
#0 %s(%d): DirectoryIterator->__construct('%s')
#1 {main}
diff --git a/ext/spl/tests/class_implements_basic.phpt b/ext/spl/tests/class_implements_basic.phpt
index 986b81e8bc..1d8801899b 100644
--- a/ext/spl/tests/class_implements_basic.phpt
+++ b/ext/spl/tests/class_implements_basic.phpt
@@ -19,7 +19,6 @@ var_dump(class_implements('bar'));
?>
-===DONE===
--EXPECT--
*** Testing class_implements() : basic ***
array(1) {
@@ -30,4 +29,3 @@ array(1) {
["foo"]=>
string(3) "foo"
}
-===DONE===
diff --git a/ext/spl/tests/class_implements_basic2.phpt b/ext/spl/tests/class_implements_basic2.phpt
index 6eb3af4556..4c8a2bf03e 100644
--- a/ext/spl/tests/class_implements_basic2.phpt
+++ b/ext/spl/tests/class_implements_basic2.phpt
@@ -36,7 +36,6 @@ function s_var_dump($arr) {
var_dump($arr);
}
?>
-===DONE===
--EXPECT--
*** Testing class_implements() : basic ***
array(2) {
@@ -71,4 +70,3 @@ array(1) {
["foo"]=>
string(3) "foo"
}
-===DONE===
diff --git a/ext/spl/tests/class_implements_variation.phpt b/ext/spl/tests/class_implements_variation.phpt
index 7498a14559..f0e510c056 100644
--- a/ext/spl/tests/class_implements_variation.phpt
+++ b/ext/spl/tests/class_implements_variation.phpt
@@ -24,7 +24,6 @@ var_dump(class_implements('non_existent'));
var_dump(class_implements('non_existent2', false));
?>
-===DONE===
--EXPECTF--
*** Testing class_implements() : variation ***
--- testing no interfaces ---
@@ -41,4 +40,3 @@ bool(false)
Warning: class_implements(): Class non_existent2 does not exist in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/spl/tests/class_implements_variation1.phpt b/ext/spl/tests/class_implements_variation1.phpt
index 9d876d3a36..65fbe1a58a 100644
--- a/ext/spl/tests/class_implements_variation1.phpt
+++ b/ext/spl/tests/class_implements_variation1.phpt
@@ -12,11 +12,11 @@ echo "*** Testing class_implements() : variation ***\n";
// Define error handler
-function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
- if (error_reporting() != 0) {
- // report non-silenced errors
- echo "Error: $err_no - $err_msg, $filename($linenum)\n";
- }
+function test_error_handler($err_no, $err_msg, $filename, $linenum) {
+ if (error_reporting() & $err_no) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ }
}
set_error_handler('test_error_handler');
@@ -33,9 +33,9 @@ unset ($unset_var);
// define some classes
class classWithToString
{
- public function __toString() {
- return "Class A object";
- }
+ public function __toString() {
+ return "Class A object";
+ }
}
class classWithoutToString
@@ -105,91 +105,75 @@ $inputs = array(
foreach($inputs as $key =>$value) {
echo "\n--$key--\n";
- var_dump( class_implements($value, $autoload) );
+ try {
+ var_dump( class_implements($value, $autoload) );
+ } catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
};
fclose($res);
?>
-===DONE===
--EXPECTF--
*** Testing class_implements() : variation ***
--int 0--
-Error: 2 - class_implements(): object or string expected, %s(%d)
-bool(false)
+Object or string expected
--int 1--
-Error: 2 - class_implements(): object or string expected, %s(%d)
-bool(false)
+Object or string expected
--int 12345--
-Error: 2 - class_implements(): object or string expected, %s(%d)
-bool(false)
+Object or string expected
--int -12345--
-Error: 2 - class_implements(): object or string expected, %s(%d)
-bool(false)
+Object or string expected
--float 10.5--
-Error: 2 - class_implements(): object or string expected, %s(%d)
-bool(false)
+Object or string expected
--float -10.5--
-Error: 2 - class_implements(): object or string expected, %s(%d)
-bool(false)
+Object or string expected
--float 12.3456789000e10--
-Error: 2 - class_implements(): object or string expected, %s(%d)
-bool(false)
+Object or string expected
--float -12.3456789000e10--
-Error: 2 - class_implements(): object or string expected, %s(%d)
-bool(false)
+Object or string expected
--float .5--
-Error: 2 - class_implements(): object or string expected, %s(%d)
-bool(false)
+Object or string expected
--empty array--
-Error: 2 - class_implements(): object or string expected, %s(%d)
-bool(false)
+Object or string expected
--int indexed array--
-Error: 2 - class_implements(): object or string expected, %s(%d)
-bool(false)
+Object or string expected
--associative array--
-Error: 2 - class_implements(): object or string expected, %s(%d)
-bool(false)
+Object or string expected
--nested arrays--
-Error: 2 - class_implements(): object or string expected, %s(%d)
-bool(false)
+Object or string expected
--uppercase NULL--
-Error: 2 - class_implements(): object or string expected, %s(%d)
-bool(false)
+Object or string expected
--lowercase null--
-Error: 2 - class_implements(): object or string expected, %s(%d)
-bool(false)
+Object or string expected
--lowercase true--
-Error: 2 - class_implements(): object or string expected, %s(%d)
-bool(false)
+Object or string expected
--lowercase false--
-Error: 2 - class_implements(): object or string expected, %s(%d)
-bool(false)
+Object or string expected
--uppercase TRUE--
-Error: 2 - class_implements(): object or string expected, %s(%d)
-bool(false)
+Object or string expected
--uppercase FALSE--
-Error: 2 - class_implements(): object or string expected, %s(%d)
-bool(false)
+Object or string expected
--empty string DQ--
Error: 2 - class_implements(): Class does not exist and could not be loaded, %s(%d)
@@ -208,14 +192,10 @@ array(0) {
}
--undefined var--
-Error: 2 - class_implements(): object or string expected, %s(%d)
-bool(false)
+Object or string expected
--unset var--
-Error: 2 - class_implements(): object or string expected, %s(%d)
-bool(false)
+Object or string expected
--resource--
-Error: 2 - class_implements(): object or string expected, %s(%d)
-bool(false)
-===DONE===
+Object or string expected
diff --git a/ext/spl/tests/class_uses_basic.phpt b/ext/spl/tests/class_uses_basic.phpt
index 8cad9cab07..9ebbe7b0f2 100644
--- a/ext/spl/tests/class_uses_basic.phpt
+++ b/ext/spl/tests/class_uses_basic.phpt
@@ -19,7 +19,6 @@ var_dump(class_uses('bar'));
?>
-===DONE===
--EXPECT--
*** Testing class_uses() : basic ***
array(1) {
@@ -30,4 +29,3 @@ array(1) {
["foo"]=>
string(3) "foo"
}
-===DONE===
diff --git a/ext/spl/tests/class_uses_basic2.phpt b/ext/spl/tests/class_uses_basic2.phpt
index be4bfa08d0..941d967fa7 100644
--- a/ext/spl/tests/class_uses_basic2.phpt
+++ b/ext/spl/tests/class_uses_basic2.phpt
@@ -20,7 +20,7 @@ class barUser { use bar; }
class foobarUser { use foo, bar; }
/** There is no semantics for traits in the inheritance chain.
- Traits are flattend into a class, and that semantics is nothing
+ Traits are flattened into a class, and that semantics is nothing
like a type, or interface, and thus, not propergated. */
class fooViaBarUser extends barUser { use foo; }
@@ -39,7 +39,6 @@ function s_var_dump($arr) {
var_dump($arr);
}
?>
-===DONE===
--EXPECT--
*** Testing class_uses() : basic ***
array(2) {
@@ -66,4 +65,3 @@ array(0) {
}
array(0) {
}
-===DONE===
diff --git a/ext/spl/tests/class_uses_variation.phpt b/ext/spl/tests/class_uses_variation.phpt
index 5df38cc2a4..8e0d716f6c 100644
--- a/ext/spl/tests/class_uses_variation.phpt
+++ b/ext/spl/tests/class_uses_variation.phpt
@@ -24,7 +24,6 @@ var_dump(class_uses('non_existent'));
var_dump(class_uses('non_existent2', false));
?>
-===DONE===
--EXPECTF--
*** Testing class_uses() : variation ***
--- testing no traits ---
@@ -41,4 +40,3 @@ bool(false)
Warning: class_uses(): Class non_existent2 does not exist in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/spl/tests/class_uses_variation1.phpt b/ext/spl/tests/class_uses_variation1.phpt
index be6aa9ac7f..c26fb67e0f 100644
--- a/ext/spl/tests/class_uses_variation1.phpt
+++ b/ext/spl/tests/class_uses_variation1.phpt
@@ -12,11 +12,11 @@ echo "*** Testing class_uses() : variation ***\n";
// Define error handler
-function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
- if (error_reporting() != 0) {
- // report non-silenced errors
- echo "Error: $err_no - $err_msg, $filename($linenum)\n";
- }
+function test_error_handler($err_no, $err_msg, $filename, $linenum) {
+ if (error_reporting() & $err_no) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ }
}
set_error_handler('test_error_handler');
@@ -33,9 +33,9 @@ unset ($unset_var);
// define some classes
class classWithToString
{
- public function __toString() {
- return "Class A object";
- }
+ public function __toString() {
+ return "Class A object";
+ }
}
class classWithoutToString
@@ -105,91 +105,75 @@ $inputs = array(
foreach($inputs as $key =>$value) {
echo "\n--$key--\n";
- var_dump( class_uses($value, $autoload) );
+ try {
+ var_dump( class_uses($value, $autoload) );
+ } catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
};
fclose($res);
?>
-===DONE===
--EXPECTF--
*** Testing class_uses() : variation ***
--int 0--
-Error: 2 - class_uses(): object or string expected, %s(%d)
-bool(false)
+Object or string expected
--int 1--
-Error: 2 - class_uses(): object or string expected, %s(%d)
-bool(false)
+Object or string expected
--int 12345--
-Error: 2 - class_uses(): object or string expected, %s(%d)
-bool(false)
+Object or string expected
--int -12345--
-Error: 2 - class_uses(): object or string expected, %s(%d)
-bool(false)
+Object or string expected
--float 10.5--
-Error: 2 - class_uses(): object or string expected, %s(%d)
-bool(false)
+Object or string expected
--float -10.5--
-Error: 2 - class_uses(): object or string expected, %s(%d)
-bool(false)
+Object or string expected
--float 12.3456789000e10--
-Error: 2 - class_uses(): object or string expected, %s(%d)
-bool(false)
+Object or string expected
--float -12.3456789000e10--
-Error: 2 - class_uses(): object or string expected, %s(%d)
-bool(false)
+Object or string expected
--float .5--
-Error: 2 - class_uses(): object or string expected, %s(%d)
-bool(false)
+Object or string expected
--empty array--
-Error: 2 - class_uses(): object or string expected, %s(%d)
-bool(false)
+Object or string expected
--int indexed array--
-Error: 2 - class_uses(): object or string expected, %s(%d)
-bool(false)
+Object or string expected
--associative array--
-Error: 2 - class_uses(): object or string expected, %s(%d)
-bool(false)
+Object or string expected
--nested arrays--
-Error: 2 - class_uses(): object or string expected, %s(%d)
-bool(false)
+Object or string expected
--uppercase NULL--
-Error: 2 - class_uses(): object or string expected, %s(%d)
-bool(false)
+Object or string expected
--lowercase null--
-Error: 2 - class_uses(): object or string expected, %s(%d)
-bool(false)
+Object or string expected
--lowercase true--
-Error: 2 - class_uses(): object or string expected, %s(%d)
-bool(false)
+Object or string expected
--lowercase false--
-Error: 2 - class_uses(): object or string expected, %s(%d)
-bool(false)
+Object or string expected
--uppercase TRUE--
-Error: 2 - class_uses(): object or string expected, %s(%d)
-bool(false)
+Object or string expected
--uppercase FALSE--
-Error: 2 - class_uses(): object or string expected, %s(%d)
-bool(false)
+Object or string expected
--empty string DQ--
Error: 2 - class_uses(): Class does not exist and could not be loaded, %s(%d)
@@ -208,14 +192,10 @@ array(0) {
}
--undefined var--
-Error: 2 - class_uses(): object or string expected, %s(%d)
-bool(false)
+Object or string expected
--unset var--
-Error: 2 - class_uses(): object or string expected, %s(%d)
-bool(false)
+Object or string expected
--resource--
-Error: 2 - class_uses(): object or string expected, %s(%d)
-bool(false)
-===DONE===
+Object or string expected
diff --git a/ext/spl/tests/countable_count_variation1.phpt b/ext/spl/tests/countable_count_variation1.phpt
index 0a99399329..8ce29410d9 100644
--- a/ext/spl/tests/countable_count_variation1.phpt
+++ b/ext/spl/tests/countable_count_variation1.phpt
@@ -4,32 +4,32 @@ SPL: Countable::count() with wrong return types and exception.
<?php
Class returnNull implements Countable {
- function count() {
- }
+ function count() {
+ }
}
Class returnString implements Countable {
- function count() {
- return "hello";
- }
+ function count() {
+ return "hello";
+ }
}
Class returnObject implements Countable {
- function count() {
- return new returnObject;
- }
+ function count() {
+ return new returnObject;
+ }
}
Class returnArray implements Countable {
- function count() {
- return array(1,2,3);
- }
+ function count() {
+ return array(1,2,3);
+ }
}
Class throwException implements Countable {
- function count() {
- throw new Exception('Thrown from count');
- }
+ function count() {
+ throw new Exception('Thrown from count');
+ }
}
@@ -47,9 +47,9 @@ var_dump(count(new returnArray));
echo "Count throws an exception:\n";
try {
- echo count(new throwException);
+ echo count(new throwException);
} catch (Exception $e) {
- echo $e->getMessage();
+ echo $e->getMessage();
}
?>
diff --git a/ext/spl/tests/dit_001.phpt b/ext/spl/tests/dit_001.phpt
index a56166def0..6d21abbf49 100644
--- a/ext/spl/tests/dit_001.phpt
+++ b/ext/spl/tests/dit_001.phpt
@@ -11,7 +11,6 @@ var_dump(is_string($d));
preg_match('/x/', $d);
var_dump(is_string($d));
?>
-===DONE===
--EXPECTF--
object(DirectoryIterator)#%d (4) {
%s"pathName"%s"SplFileInfo":private]=>
@@ -25,4 +24,3 @@ object(DirectoryIterator)#%d (4) {
}
bool(false)
bool(false)
-===DONE===
diff --git a/ext/spl/tests/dit_001_noglob.phpt b/ext/spl/tests/dit_001_noglob.phpt
index 00deac36b8..a1996ef85e 100644
--- a/ext/spl/tests/dit_001_noglob.phpt
+++ b/ext/spl/tests/dit_001_noglob.phpt
@@ -11,7 +11,6 @@ var_dump(is_string($d));
preg_match('/x/', $d);
var_dump(is_string($d));
?>
-===DONE===
--EXPECTF--
object(DirectoryIterator)#%d (3) {
%s"pathName"%s"SplFileInfo":private]=>
@@ -23,4 +22,3 @@ object(DirectoryIterator)#%d (3) {
}
bool(false)
bool(false)
-===DONE===
diff --git a/ext/spl/tests/dit_002.phpt b/ext/spl/tests/dit_002.phpt
index f4cd3ab058..f456101ed2 100644
--- a/ext/spl/tests/dit_002.phpt
+++ b/ext/spl/tests/dit_002.phpt
@@ -6,44 +6,43 @@ SPL: DirectoryIterator defaults
<?php
$classes = array(
- 'DirectoryIterator' => 0,
- 'FilesystemIterator' => 1,
- 'RecursiveDirectoryIterator' => 1,
- 'GlobIterator' => 1,
+ 'DirectoryIterator' => 0,
+ 'FilesystemIterator' => 1,
+ 'RecursiveDirectoryIterator' => 1,
+ 'GlobIterator' => 1,
);
foreach ($classes as $class => $flags) {
- echo "===$class===\n";
- $ref = new ReflectionClass($class);
- $obj = $ref->newInstance('glob://*');
- echo get_class($obj->current()) . "\n";
- if ($flags)
- {
- var_dump($obj->getFlags());
- $flags = array(
- FilesystemIterator::CURRENT_AS_FILEINFO => 0,
- FilesystemIterator::CURRENT_AS_SELF => 0,
- FilesystemIterator::CURRENT_AS_PATHNAME => 1,
- );
- foreach($flags as $flag => $isstring) {
- $obj->setFlags($flag);
- $obj->rewind();
- var_dump($obj->getFlags());
- if ($isstring) {
- $val = $obj->current();
- if (is_string($val)) {
- var_dump(true);
- } else {
- var_dump($val);
- }
- } else {
- echo get_class($obj->current()) . "\n";
- }
- }
- }
+ echo "===$class===\n";
+ $ref = new ReflectionClass($class);
+ $obj = $ref->newInstance('glob://*');
+ echo get_class($obj->current()) . "\n";
+ if ($flags)
+ {
+ var_dump($obj->getFlags());
+ $flags = array(
+ FilesystemIterator::CURRENT_AS_FILEINFO => 0,
+ FilesystemIterator::CURRENT_AS_SELF => 0,
+ FilesystemIterator::CURRENT_AS_PATHNAME => 1,
+ );
+ foreach($flags as $flag => $isstring) {
+ $obj->setFlags($flag);
+ $obj->rewind();
+ var_dump($obj->getFlags());
+ if ($isstring) {
+ $val = $obj->current();
+ if (is_string($val)) {
+ var_dump(true);
+ } else {
+ var_dump($val);
+ }
+ } else {
+ echo get_class($obj->current()) . "\n";
+ }
+ }
+ }
}
?>
-===DONE===
--EXPECTF--
===DirectoryIterator===
DirectoryIterator
@@ -74,4 +73,3 @@ int(16)
GlobIterator
int(32)
bool(true)
-===DONE===
diff --git a/ext/spl/tests/dit_003.phpt b/ext/spl/tests/dit_003.phpt
index 507ed49f0e..f943075878 100644
--- a/ext/spl/tests/dit_003.phpt
+++ b/ext/spl/tests/dit_003.phpt
@@ -5,11 +5,9 @@ SPL: FilesystemIterator and foreach
$count = 0;
foreach(new FilesystemIterator(__DIR__) as $ent)
{
- ++$count;
+ ++$count;
}
var_dump($count > 0);
?>
-===DONE===
--EXPECT--
bool(true)
-===DONE===
diff --git a/ext/spl/tests/dit_004.phpt b/ext/spl/tests/dit_004.phpt
index d9f1912283..9d7069e525 100644
--- a/ext/spl/tests/dit_004.phpt
+++ b/ext/spl/tests/dit_004.phpt
@@ -13,7 +13,6 @@ $c = clone $a;
var_dump((string)$c == (string)$a);
var_dump($a->key(), $c->key());
?>
-===DONE===
--EXPECT--
bool(true)
int(0)
@@ -21,4 +20,3 @@ int(0)
bool(true)
int(3)
int(3)
-===DONE===
diff --git a/ext/spl/tests/dit_005.phpt b/ext/spl/tests/dit_005.phpt
index 942a58d4ae..ebdc56e031 100644
--- a/ext/spl/tests/dit_005.phpt
+++ b/ext/spl/tests/dit_005.phpt
@@ -14,10 +14,8 @@ $c = clone $a;
var_dump((string)$c == (string)$a);
var_dump($a->key() == $c->key());
?>
-===DONE===
--EXPECT--
bool(true)
bool(true)
bool(true)
bool(true)
-===DONE===
diff --git a/ext/spl/tests/dit_006.phpt b/ext/spl/tests/dit_006.phpt
index ed1ceffc05..42a2309c99 100644
--- a/ext/spl/tests/dit_006.phpt
+++ b/ext/spl/tests/dit_006.phpt
@@ -40,7 +40,6 @@ try {
var_dump($n !== $m, $m === $o, $p === 0);
?>
-===DONE===
--EXPECTF--
With seek(2) we get %d
With seek(0) we get %d
@@ -49,4 +48,3 @@ Seek position %d is out of range
bool(true)
bool(true)
bool(true)
-===DONE===
diff --git a/ext/spl/tests/dllist_001.phpt b/ext/spl/tests/dllist_001.phpt
index 4a18cf2322..e6ac2468af 100644
--- a/ext/spl/tests/dllist_001.phpt
+++ b/ext/spl/tests/dllist_001.phpt
@@ -46,8 +46,6 @@ $dll_clone = clone $dll;
$dll_clone->pop();
echo count($dll)."\n";
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Exception: Can't pop from an empty datastructure
Exception: Can't shift from an empty datastructure
@@ -60,4 +58,3 @@ Exception: Can't shift from an empty datastructure
NULL
NULL
1
-===DONE===
diff --git a/ext/spl/tests/dllist_002.phpt b/ext/spl/tests/dllist_002.phpt
index e1287718de..61836ac889 100644
--- a/ext/spl/tests/dllist_002.phpt
+++ b/ext/spl/tests/dllist_002.phpt
@@ -33,8 +33,6 @@ foreach($dll2 as $k=>$v) {
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
0=>2
->0=>2
@@ -57,4 +55,3 @@ foreach($dll2 as $k=>$v) {
popped 4
1=>3
popped 3
-===DONE===
diff --git a/ext/spl/tests/dllist_003.phpt b/ext/spl/tests/dllist_003.phpt
index 53dd7cb752..0eff4aa036 100644
--- a/ext/spl/tests/dllist_003.phpt
+++ b/ext/spl/tests/dllist_003.phpt
@@ -26,8 +26,6 @@ foreach ($dll as $k => $v) {
var_dump($dll->count());
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
2=>4
1=>3
@@ -40,4 +38,3 @@ int(3)
0=>3
0=>4
int(0)
-===DONE===
diff --git a/ext/spl/tests/dllist_004.phpt b/ext/spl/tests/dllist_004.phpt
index 0a74d59892..8ac028ebf8 100644
--- a/ext/spl/tests/dllist_004.phpt
+++ b/ext/spl/tests/dllist_004.phpt
@@ -44,8 +44,6 @@ $stack_clone = clone $stack;
$stack_clone->pop();
echo count($stack)."\n";
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Exception: Can't pop from an empty datastructure
Exception: Can't shift from an empty datastructure
@@ -58,4 +56,3 @@ Exception: Can't shift from an empty datastructure
NULL
NULL
3
-===DONE===
diff --git a/ext/spl/tests/dllist_005.phpt b/ext/spl/tests/dllist_005.phpt
index 2e2058f76a..805f81a68a 100644
--- a/ext/spl/tests/dllist_005.phpt
+++ b/ext/spl/tests/dllist_005.phpt
@@ -44,8 +44,6 @@ $queue_clone = clone $queue;
$queue_clone->dequeue();
echo count($queue)."\n";
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Exception: Can't shift from an empty datastructure
Exception: Can't shift from an empty datastructure
@@ -58,4 +56,3 @@ Exception: Can't shift from an empty datastructure
int(1)
int(2)
3
-===DONE===
diff --git a/ext/spl/tests/dllist_006.phpt b/ext/spl/tests/dllist_006.phpt
index d5590642ea..88190573e4 100644
--- a/ext/spl/tests/dllist_006.phpt
+++ b/ext/spl/tests/dllist_006.phpt
@@ -45,8 +45,6 @@ try {
echo "Exception: ".$e->getMessage()."\n";
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
int(1)
int(2)
@@ -59,4 +57,3 @@ int(2)
Exception: Offset invalid or out of range
int(1)
Exception: Offset invalid or out of range
-===DONE===
diff --git a/ext/spl/tests/dllist_007.phpt b/ext/spl/tests/dllist_007.phpt
index d15e064ac4..2ccadf99ca 100644
--- a/ext/spl/tests/dllist_007.phpt
+++ b/ext/spl/tests/dllist_007.phpt
@@ -12,8 +12,6 @@ while ($a->valid()) {
var_dump($a->current(), $a->next());
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
int(1)
NULL
@@ -21,4 +19,3 @@ int(2)
NULL
int(3)
NULL
-===DONE===
diff --git a/ext/spl/tests/dllist_008.phpt b/ext/spl/tests/dllist_008.phpt
index ab37d83afa..114b50c4f5 100644
--- a/ext/spl/tests/dllist_008.phpt
+++ b/ext/spl/tests/dllist_008.phpt
@@ -1,5 +1,5 @@
--TEST--
-SPL: SplDoublyLinkedList with overriden count()
+SPL: SplDoublyLinkedList with overridden count()
--FILE--
<?php
$obj = new SplDoublyLinkedList();
diff --git a/ext/spl/tests/dllist_010.phpt b/ext/spl/tests/dllist_010.phpt
index 7e389559e2..7fd7e8993f 100644
--- a/ext/spl/tests/dllist_010.phpt
+++ b/ext/spl/tests/dllist_010.phpt
@@ -23,11 +23,9 @@ $dll->prev();
var_dump($dll->current());
?>
-===DONE===
--EXPECT--
NULL
int(1)
int(2)
int(4)
int(3)
-===DONE===
diff --git a/ext/spl/tests/dllist_011.phpt b/ext/spl/tests/dllist_011.phpt
index b9be872555..bd1b0d3161 100644
--- a/ext/spl/tests/dllist_011.phpt
+++ b/ext/spl/tests/dllist_011.phpt
@@ -7,7 +7,5 @@ $dll->rewind();
$dll->prev();
var_dump($dll->current());
?>
-===DONE===
--EXPECT--
NULL
-===DONE===
diff --git a/ext/spl/tests/dllist_012.phpt b/ext/spl/tests/dllist_012.phpt
index 4eec9bda3b..c9b9f2cf25 100644
--- a/ext/spl/tests/dllist_012.phpt
+++ b/ext/spl/tests/dllist_012.phpt
@@ -7,7 +7,6 @@ $a[] = $a;
var_dump($a);
?>
-===DONE===
--EXPECTF--
object(SplDoublyLinkedList)#%d (2) {
["flags":"SplDoublyLinkedList":private]=>
@@ -18,4 +17,3 @@ object(SplDoublyLinkedList)#%d (2) {
*RECURSION*
}
}
-===DONE===
diff --git a/ext/spl/tests/dllist_013.phpt b/ext/spl/tests/dllist_013.phpt
index b9a4ef7648..49b89d39a8 100644
--- a/ext/spl/tests/dllist_013.phpt
+++ b/ext/spl/tests/dllist_013.phpt
@@ -5,9 +5,9 @@ SPL: DoublyLinkedList: insert operations
$dll = new SplDoublyLinkedList();
// errors
try {
- $dll->add(2,5);
+ $dll->add(2,5);
} catch (OutOfRangeException $e) {
- echo "Exception: ".$e->getMessage()."\n";
+ echo "Exception: ".$e->getMessage()."\n";
}
$dll->add(0,6); // 6
@@ -30,8 +30,6 @@ echo $dll->pop()."\n";
echo $dll->pop()."\n";
echo $dll->pop()."\n";
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Exception: Offset invalid or out of range
7
@@ -42,4 +40,3 @@ Exception: Offset invalid or out of range
3
2
1
-===DONE===
diff --git a/ext/spl/tests/dllist_memleak.phpt b/ext/spl/tests/dllist_memleak.phpt
index a52d2887d0..142206f0a7 100644
--- a/ext/spl/tests/dllist_memleak.phpt
+++ b/ext/spl/tests/dllist_memleak.phpt
@@ -16,9 +16,6 @@ $dll->next();
echo $dll->current()."\n";
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
1
3
-===DONE===
diff --git a/ext/spl/tests/dualiterator.inc b/ext/spl/tests/dualiterator.inc
index eeb8ae869c..0830ebe644 100644
--- a/ext/spl/tests/dualiterator.inc
+++ b/ext/spl/tests/dualiterator.inc
@@ -16,195 +16,195 @@
*/
class DualIterator implements Iterator
{
- const CURRENT_LHS = 0x01;
- const CURRENT_RHS = 0x02;
- const CURRENT_ARRAY = 0x03;
- const CURRENT_0 = 0x00;
-
- const KEY_LHS = 0x10;
- const KEY_RHS = 0x20;
- const KEY_0 = 0x00;
-
- const DEFAULT_FLAGS = 0x13;
-
- private $lhs;
- private $rhs;
- private $flags;
-
- /** construct iterator from two iterators
- *
- * @param lhs Left Hand Side Iterator
- * @param rhs Right Hand Side Iterator
- * @param flags iteration flags
- */
- function __construct(Iterator $lhs, Iterator $rhs,
- $flags = 0x13 /*DualIterator::DEFAULT_FLAGS*/)
- {
- $this->lhs = $lhs;
- $this->rhs = $rhs;
- $this->flags = $flags;
- }
-
- /** @return Left Hand Side Iterator
- */
- function getLHS()
- {
- return $this->lhs;
- }
-
- /** @return Right Hand Side Iterator
- */
- function getRHS()
- {
- return $this->rhs;
- }
-
- /** @param flags new flags
- */
- function setFlags($flags)
- {
- $this->flags = $flags;
- }
-
- /** @return current flags
- */
- function getFlags()
- {
- return $this->flags;
- }
-
- /** rewind both inner iterators
- */
- function rewind()
- {
- $this->lhs->rewind();
- $this->rhs->rewind();
- }
-
- /** @return whether both inner iterators are valid
- */
- function valid()
- {
- return $this->lhs->valid() && $this->rhs->valid();
- }
-
- /** @return current value depending on CURRENT_* flags
- */
- function current()
- {
- switch($this->flags & 0x0F)
- {
- default:
- case self::CURRENT_ARRAY:
- return array($this->lhs->current(), $this->rhs->current());
- case self::CURRENT_LHS:
- return $this->lhs->current();
- case self::CURRENT_RHS:
- return $this->rhs->current();
- case self::CURRENT_0:
- return NULL;
- }
- }
-
- /** @return key value depending on KEY_* flags
- */
- function key()
- {
- switch($this->flags & 0xF0)
- {
- default:
- case self::KEY_LHS:
- return $this->lhs->key();
- case self::KEY_RHS:
- return $this->rhs->key();
- case self::KEY_0:
- return NULL;
- }
- }
-
- /** move both inner iterators forward
- */
- function next()
- {
- $this->lhs->next();
- $this->rhs->next();
- }
-
- /** @return whether both inner iterators are valid and have identical
- * current and key values or both are non valid.
- */
- function areIdentical()
- {
- return $this->valid()
- ? $this->lhs->current() === $this->rhs->current()
- && $this->lhs->key() === $this->rhs->key()
- : $this->lhs->valid() == $this->rhs->valid();
- }
-
- /** @return whether both inner iterators are valid and have equal current
- * and key values or both are non valid.
- */
- function areEqual()
- {
- return $this->valid()
- ? $this->lhs->current() == $this->rhs->current()
- && $this->lhs->key() == $this->rhs->key()
- : $this->lhs->valid() == $this->rhs->valid();
- }
-
- /** Compare two iterators
- *
- * @param lhs Left Hand Side Iterator
- * @param rhs Right Hand Side Iterator
- * @param identical whether to use areEqual() or areIdentical()
- * @return whether both iterators are equal/identical
- *
- * @note If one implements RecursiveIterator the other must do as well.
- * And if both do then a recursive comparison is being used.
- */
- static function compareIterators(Iterator $lhs, Iterator $rhs,
- $identical = false)
- {
- if ($lhs instanceof RecursiveIterator)
- {
- if ($rhs instanceof RecursiveIterator)
- {
- $it = new RecursiveDualIterator($lhs, $rhs,
- self::CURRENT_0 | self::KEY_0);
- $it = new RecursiveCompareDualIterator($it);
- }
- else
- {
- return false;
- }
- }
- else
- {
- $it = new DualIterator($lhs, $rhs, self::CURRENT_0 | self::KEY_0);
- }
-
- if ($identical)
- {
- foreach($it as $n)
- {
- if (!$it->areIdentical())
- {
- return false;
- }
- }
- }
- else
- {
- foreach($it as $n)
- {
- if (!$it->areEqual())
- {
- return false;
- }
- }
- }
- return $identical ? $it->areIdentical() : $it->areEqual();
- }
+ const CURRENT_LHS = 0x01;
+ const CURRENT_RHS = 0x02;
+ const CURRENT_ARRAY = 0x03;
+ const CURRENT_0 = 0x00;
+
+ const KEY_LHS = 0x10;
+ const KEY_RHS = 0x20;
+ const KEY_0 = 0x00;
+
+ const DEFAULT_FLAGS = 0x13;
+
+ private $lhs;
+ private $rhs;
+ private $flags;
+
+ /** construct iterator from two iterators
+ *
+ * @param lhs Left Hand Side Iterator
+ * @param rhs Right Hand Side Iterator
+ * @param flags iteration flags
+ */
+ function __construct(Iterator $lhs, Iterator $rhs,
+ $flags = 0x13 /*DualIterator::DEFAULT_FLAGS*/)
+ {
+ $this->lhs = $lhs;
+ $this->rhs = $rhs;
+ $this->flags = $flags;
+ }
+
+ /** @return Left Hand Side Iterator
+ */
+ function getLHS()
+ {
+ return $this->lhs;
+ }
+
+ /** @return Right Hand Side Iterator
+ */
+ function getRHS()
+ {
+ return $this->rhs;
+ }
+
+ /** @param flags new flags
+ */
+ function setFlags($flags)
+ {
+ $this->flags = $flags;
+ }
+
+ /** @return current flags
+ */
+ function getFlags()
+ {
+ return $this->flags;
+ }
+
+ /** rewind both inner iterators
+ */
+ function rewind()
+ {
+ $this->lhs->rewind();
+ $this->rhs->rewind();
+ }
+
+ /** @return whether both inner iterators are valid
+ */
+ function valid()
+ {
+ return $this->lhs->valid() && $this->rhs->valid();
+ }
+
+ /** @return current value depending on CURRENT_* flags
+ */
+ function current()
+ {
+ switch($this->flags & 0x0F)
+ {
+ default:
+ case self::CURRENT_ARRAY:
+ return array($this->lhs->current(), $this->rhs->current());
+ case self::CURRENT_LHS:
+ return $this->lhs->current();
+ case self::CURRENT_RHS:
+ return $this->rhs->current();
+ case self::CURRENT_0:
+ return NULL;
+ }
+ }
+
+ /** @return key value depending on KEY_* flags
+ */
+ function key()
+ {
+ switch($this->flags & 0xF0)
+ {
+ default:
+ case self::KEY_LHS:
+ return $this->lhs->key();
+ case self::KEY_RHS:
+ return $this->rhs->key();
+ case self::KEY_0:
+ return NULL;
+ }
+ }
+
+ /** move both inner iterators forward
+ */
+ function next()
+ {
+ $this->lhs->next();
+ $this->rhs->next();
+ }
+
+ /** @return whether both inner iterators are valid and have identical
+ * current and key values or both are non valid.
+ */
+ function areIdentical()
+ {
+ return $this->valid()
+ ? $this->lhs->current() === $this->rhs->current()
+ && $this->lhs->key() === $this->rhs->key()
+ : $this->lhs->valid() == $this->rhs->valid();
+ }
+
+ /** @return whether both inner iterators are valid and have equal current
+ * and key values or both are non valid.
+ */
+ function areEqual()
+ {
+ return $this->valid()
+ ? $this->lhs->current() == $this->rhs->current()
+ && $this->lhs->key() == $this->rhs->key()
+ : $this->lhs->valid() == $this->rhs->valid();
+ }
+
+ /** Compare two iterators
+ *
+ * @param lhs Left Hand Side Iterator
+ * @param rhs Right Hand Side Iterator
+ * @param identical whether to use areEqual() or areIdentical()
+ * @return whether both iterators are equal/identical
+ *
+ * @note If one implements RecursiveIterator the other must do as well.
+ * And if both do then a recursive comparison is being used.
+ */
+ static function compareIterators(Iterator $lhs, Iterator $rhs,
+ $identical = false)
+ {
+ if ($lhs instanceof RecursiveIterator)
+ {
+ if ($rhs instanceof RecursiveIterator)
+ {
+ $it = new RecursiveDualIterator($lhs, $rhs,
+ self::CURRENT_0 | self::KEY_0);
+ $it = new RecursiveCompareDualIterator($it);
+ }
+ else
+ {
+ return false;
+ }
+ }
+ else
+ {
+ $it = new DualIterator($lhs, $rhs, self::CURRENT_0 | self::KEY_0);
+ }
+
+ if ($identical)
+ {
+ foreach($it as $n)
+ {
+ if (!$it->areIdentical())
+ {
+ return false;
+ }
+ }
+ }
+ else
+ {
+ foreach($it as $n)
+ {
+ if (!$it->areEqual())
+ {
+ return false;
+ }
+ }
+ }
+ return $identical ? $it->areIdentical() : $it->areEqual();
+ }
}
?>
diff --git a/ext/spl/tests/dualiterator_001.phpt b/ext/spl/tests/dualiterator_001.phpt
index 934f28abee..2bbdc0c56f 100644
--- a/ext/spl/tests/dualiterator_001.phpt
+++ b/ext/spl/tests/dualiterator_001.phpt
@@ -5,17 +5,17 @@ SPL: DualIterator
function spl_examples_autoload($classname)
{
- include(__DIR__ . '/' . strtolower($classname) . '.inc');
+ include(__DIR__ . '/' . strtolower($classname) . '.inc');
}
spl_autoload_register('spl_examples_autoload');
function test($a, $b, $identical = false)
{
- var_dump(DualIterator::compareIterators(
- new RecursiveArrayIterator($a),
- new RecursiveArrayIterator($b),
- $identical));
+ var_dump(DualIterator::compareIterators(
+ new RecursiveArrayIterator($a),
+ new RecursiveArrayIterator($b),
+ $identical));
}
test(array(1,2,3), array(1,2,3));
@@ -30,8 +30,6 @@ test(array(1,array(21,22),3), array(1,array(21,"22"),3), false);
test(array(1,array(21,22),3), array(1,array(21,"22"),3), true);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
bool(true)
bool(false)
@@ -43,4 +41,3 @@ bool(true)
bool(false)
bool(true)
bool(false)
-===DONE===
diff --git a/ext/spl/tests/fileobject_001.phpt b/ext/spl/tests/fileobject_001.phpt
index 4059310bba..5c2240b3c5 100644
--- a/ext/spl/tests/fileobject_001.phpt
+++ b/ext/spl/tests/fileobject_001.phpt
@@ -27,7 +27,7 @@ var_dump($o->key());
echo "===A===\n";
foreach($o as $n => $l)
{
- var_dump($n, $l);
+ var_dump($n, $l);
}
echo "===B===\n";
@@ -35,11 +35,10 @@ $o = new SplFileObject(__DIR__ . '/fileobject_001b.txt');
$o->setFlags(SplFileObject::DROP_NEW_LINE);
foreach($o as $n => $l)
{
- var_dump($n, $l);
+ var_dump($n, $l);
}
?>
-===DONE===
--EXPECTF--
int(0)
string(%d) "0
@@ -85,4 +84,3 @@ int(4)
string(1) "4"
int(5)
string(1) "5"
-===DONE===
diff --git a/ext/spl/tests/fileobject_002.phpt b/ext/spl/tests/fileobject_002.phpt
index 2f43949966..ba30caf23a 100644
--- a/ext/spl/tests/fileobject_002.phpt
+++ b/ext/spl/tests/fileobject_002.phpt
@@ -5,31 +5,29 @@ SPL: SplFileObject::fgetc
function test($name)
{
- echo "===$name===\n";
+ echo "===$name===\n";
- $o = new SplFileObject(__DIR__ . '/' . $name);
+ $o = new SplFileObject(__DIR__ . '/' . $name);
- var_dump($o->key());
- while(($c = $o->fgetc()) !== false)
- {
+ var_dump($o->key());
+ while(($c = $o->fgetc()) !== false)
+ {
// Kinda ugly but works around new lines mess
if ($c === "\r") {
continue;
}
- var_dump($o->key(), $c, $o->eof());
- }
- echo "===EOF?===\n";
- var_dump($o->eof());
- var_dump($o->key());
- var_dump($o->eof());
+ var_dump($o->key(), $c, $o->eof());
+ }
+ echo "===EOF?===\n";
+ var_dump($o->eof());
+ var_dump($o->key());
+ var_dump($o->eof());
}
test('fileobject_001a.txt');
test('fileobject_001b.txt');
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
===fileobject_001a.txt===
int(0)
@@ -123,4 +121,3 @@ bool(false)
bool(true)
int(5)
bool(true)
-===DONE===
diff --git a/ext/spl/tests/fileobject_003.phpt b/ext/spl/tests/fileobject_003.phpt
index c3452bc93f..4f33065d42 100644
--- a/ext/spl/tests/fileobject_003.phpt
+++ b/ext/spl/tests/fileobject_003.phpt
@@ -5,40 +5,40 @@ SPL: SplFileInfo cloning
function test($name, $lc, $lp)
{
- static $i = 0;
- echo "===$i===\n";
- $i++;
+ static $i = 0;
+ echo "===$i===\n";
+ $i++;
- $o = new SplFileInfo($name);
+ $o = new SplFileInfo($name);
- var_dump($o);
- $c = clone $o;
- var_dump($c);
- var_dump($o === $c);
- var_dump($o == $c);
- var_dump($o->getPathname() == $c->getPathname());
+ var_dump($o);
+ $c = clone $o;
+ var_dump($c);
+ var_dump($o === $c);
+ var_dump($o == $c);
+ var_dump($o->getPathname() == $c->getPathname());
- try {
- $f = new SplFileObject($name);
- var_dump($name);
- var_dump($f->getPathName());
- $l = substr($f->getPathName(), -1);
- var_dump($l != '/' && $l != '\\' && $l == $lc);
- var_dump($f->getFileName());
- $l = substr($f->getFileName(), -1);
- var_dump($l != '/' && $l != '\\' && $l == $lc);
- var_dump($f->getPath());
- $l = substr($f->getPath(), -1);
- var_dump($l != '/' && $l != '\\' && $l == $lp);
- } catch (LogicException $e) {
- echo "LogicException: ".$e->getMessage()."\n";
- }
- try {
- $fo = $o->openFile();
- var_dump($fo->getPathName(), $fo->getFileName(), $fo->getPath());
- } catch (LogicException $e) {
- echo "LogicException: ".$e->getMessage()."\n";
- }
+ try {
+ $f = new SplFileObject($name);
+ var_dump($name);
+ var_dump($f->getPathName());
+ $l = substr($f->getPathName(), -1);
+ var_dump($l != '/' && $l != '\\' && $l == $lc);
+ var_dump($f->getFileName());
+ $l = substr($f->getFileName(), -1);
+ var_dump($l != '/' && $l != '\\' && $l == $lc);
+ var_dump($f->getPath());
+ $l = substr($f->getPath(), -1);
+ var_dump($l != '/' && $l != '\\' && $l == $lp);
+ } catch (LogicException $e) {
+ echo "LogicException: ".$e->getMessage()."\n";
+ }
+ try {
+ $fo = $o->openFile();
+ var_dump($fo->getPathName(), $fo->getFileName(), $fo->getPath());
+ } catch (LogicException $e) {
+ echo "LogicException: ".$e->getMessage()."\n";
+ }
}
test(__DIR__ . '/' . 'fileobject_001a.txt', 't', substr(__DIR__,-1));
@@ -46,8 +46,6 @@ test(__DIR__ . '/', substr(__DIR__,-1), 'l');
test(__DIR__, substr(__DIR__,-1), 'l');
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
===0===
object(SplFileInfo)#%d (2) {
@@ -111,4 +109,3 @@ bool(true)
bool(true)
LogicException: Cannot use SplFileObject with directories
LogicException: Cannot use SplFileObject with directories
-===DONE===
diff --git a/ext/spl/tests/fileobject_004.phpt b/ext/spl/tests/fileobject_004.phpt
index fad87298ca..f446674dd8 100644
--- a/ext/spl/tests/fileobject_004.phpt
+++ b/ext/spl/tests/fileobject_004.phpt
@@ -14,9 +14,7 @@ var_dump($fo->getPath());
var_dump($fo->getFilename());
var_dump($fo->getRealPath());
?>
-==DONE==
--EXPECTF--
string(%d) "%sspl%stests"
string(19) "fileobject_004.phpt"
string(%d) "%sspl%stests%sfileobject_004.phpt"
-==DONE==
diff --git a/ext/spl/tests/fileobject_005.phpt b/ext/spl/tests/fileobject_005.phpt
index 41a04dd118..e26a8d7aea 100644
--- a/ext/spl/tests/fileobject_005.phpt
+++ b/ext/spl/tests/fileobject_005.phpt
@@ -16,16 +16,12 @@ $fo->fwrite("blahlubba");
var_dump($fo->ftruncate(4));
$fo->rewind();
-var_dump($fo->fgets(8));
+var_dump($fo->fgets());
$fo->rewind();
$fo->fwrite("blahlubba");
-// This should throw a warning and return NULL since an argument is missing
-var_dump($fo->ftruncate());
-
?>
-==DONE==
--CLEAN--
<?php
$path = __DIR__.DIRECTORY_SEPARATOR.'fileobject_005.txt';
@@ -33,10 +29,4 @@ unlink($path);
?>
--EXPECTF--
bool(true)
-
-Warning: SplFileObject::fgets() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: SplFileObject::ftruncate() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-==DONE==
+string(4) "blah"
diff --git a/ext/spl/tests/filesystemiterator_flags.phpt b/ext/spl/tests/filesystemiterator_flags.phpt
index c74129760c..1a8cce034e 100644
--- a/ext/spl/tests/filesystemiterator_flags.phpt
+++ b/ext/spl/tests/filesystemiterator_flags.phpt
@@ -9,19 +9,19 @@ $it = new FileSystemIterator(".");
printflags($it);
$it->setFlags(FileSystemIterator::CURRENT_AS_SELF |
- FileSystemIterator::KEY_AS_FILENAME |
- FileSystemIterator::SKIP_DOTS |
- FileSystemIterator::UNIX_PATHS);
+ FileSystemIterator::KEY_AS_FILENAME |
+ FileSystemIterator::SKIP_DOTS |
+ FileSystemIterator::UNIX_PATHS);
printflags($it);
$it->setFlags(-1);
printflags($it);
function printflags($it) {
- printf("%08X\n", $it->getFlags());
- printf("%08X\n", ($it->getFlags() & FileSystemIterator::CURRENT_MODE_MASK));
- printf("%08X\n", ($it->getFlags() & FileSystemIterator::KEY_MODE_MASK));
- printf("%08X\n", ($it->getFlags() & FileSystemIterator::OTHER_MODE_MASK));
+ printf("%08X\n", $it->getFlags());
+ printf("%08X\n", ($it->getFlags() & FileSystemIterator::CURRENT_MODE_MASK));
+ printf("%08X\n", ($it->getFlags() & FileSystemIterator::KEY_MODE_MASK));
+ printf("%08X\n", ($it->getFlags() & FileSystemIterator::OTHER_MODE_MASK));
}
?>
diff --git a/ext/spl/tests/fixedarray_001.phpt b/ext/spl/tests/fixedarray_001.phpt
index c85d9e8dcc..0c080a5fa1 100644
--- a/ext/spl/tests/fixedarray_001.phpt
+++ b/ext/spl/tests/fixedarray_001.phpt
@@ -44,7 +44,6 @@ $b = clone $a;
$a[0] = "valueNew";
var_dump($b[0]);
?>
-===DONE===
--EXPECT--
Exception: Index invalid or out of range
Exception: Index invalid or out of range
@@ -57,4 +56,3 @@ int(10)
int(10)
bool(true)
string(6) "value0"
-===DONE===
diff --git a/ext/spl/tests/fixedarray_002.phpt b/ext/spl/tests/fixedarray_002.phpt
index ade6b7decf..f111dd1bfc 100644
--- a/ext/spl/tests/fixedarray_002.phpt
+++ b/ext/spl/tests/fixedarray_002.phpt
@@ -3,8 +3,8 @@ SPL: FixedArray: overloading
--FILE--
<?php
class A extends SplFixedArray {
- public $prop1 = NULL;
- public $prop2 = NULL;
+ public $prop1 = NULL;
+ public $prop2 = NULL;
public function count() {
return 2;
@@ -67,7 +67,6 @@ var_dump($a[0], $a[2], $a[3], $a[4]);
var_dump(count($a), $a->getSize(), count($a) == $a->getSize());
?>
-===DONE===
--EXPECT--
A::offsetSet
Exception: Index invalid or out of range
@@ -100,4 +99,3 @@ string(6) "value4"
int(2)
int(10)
bool(false)
-===DONE===
diff --git a/ext/spl/tests/fixedarray_003.phpt b/ext/spl/tests/fixedarray_003.phpt
index 33043a80e3..d2f8a78fdf 100644
--- a/ext/spl/tests/fixedarray_003.phpt
+++ b/ext/spl/tests/fixedarray_003.phpt
@@ -3,8 +3,8 @@ SPL: FixedArray: Iterators
--FILE--
<?php
class A extends SplFixedArray {
- public $prop1 = "dummy";
- public $prop2 = "dummy";
+ public $prop1 = "dummy";
+ public $prop2 = "dummy";
public function current() {
echo "A::current\n";
@@ -49,7 +49,6 @@ foreach ($a as $k => $v) {
echo "$k => $v\n";
}
?>
-===DONE===
--EXPECT--
==Direct instance==
0 => a
@@ -85,4 +84,3 @@ A::key
4 => f
A::next
A::valid
-===DONE===
diff --git a/ext/spl/tests/fixedarray_004.phpt b/ext/spl/tests/fixedarray_004.phpt
index fb32c2fd52..054fb3d9b5 100644
--- a/ext/spl/tests/fixedarray_004.phpt
+++ b/ext/spl/tests/fixedarray_004.phpt
@@ -6,13 +6,11 @@ SPL: FixedArray: adding new elements
$a = new SplFixedArray(10);
try {
- $a[] = 1;
+ $a[] = 1;
} catch (Exception $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
?>
-===DONE===
--EXPECT--
string(29) "Index invalid or out of range"
-===DONE===
diff --git a/ext/spl/tests/fixedarray_005.phpt b/ext/spl/tests/fixedarray_005.phpt
index 7240c0abc6..7295a317ab 100644
--- a/ext/spl/tests/fixedarray_005.phpt
+++ b/ext/spl/tests/fixedarray_005.phpt
@@ -4,27 +4,25 @@ SPL: FixedArray: Invalid arguments
<?php
try {
- $a = new SplFixedArray(new stdClass);
+ $a = new SplFixedArray(new stdClass);
} catch (TypeError $iae) {
- echo "Ok - ".$iae->getMessage().PHP_EOL;
+ echo "Ok - ".$iae->getMessage().PHP_EOL;
}
try {
- $a = new SplFixedArray('FOO');
+ $a = new SplFixedArray('FOO');
} catch (TypeError $iae) {
- echo "Ok - ".$iae->getMessage().PHP_EOL;
+ echo "Ok - ".$iae->getMessage().PHP_EOL;
}
try {
- $a = new SplFixedArray('');
+ $a = new SplFixedArray('');
} catch (TypeError $iae) {
- echo "Ok - ".$iae->getMessage().PHP_EOL;
+ echo "Ok - ".$iae->getMessage().PHP_EOL;
}
?>
-===DONE===
--EXPECT--
Ok - SplFixedArray::__construct() expects parameter 1 to be int, object given
Ok - SplFixedArray::__construct() expects parameter 1 to be int, string given
Ok - SplFixedArray::__construct() expects parameter 1 to be int, string given
-===DONE===
diff --git a/ext/spl/tests/fixedarray_006.phpt b/ext/spl/tests/fixedarray_006.phpt
index 8641821ae3..2e762467c4 100644
--- a/ext/spl/tests/fixedarray_006.phpt
+++ b/ext/spl/tests/fixedarray_006.phpt
@@ -7,11 +7,11 @@ $b = 10000;
$a = new SplFixedArray($b);
try {
- for ($i = 0; $i < 100; $i++) {
- $a[] = new stdClass;
- }
+ for ($i = 0; $i < 100; $i++) {
+ $a[] = new stdClass;
+ }
} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+ echo $e->getMessage(), "\n";
}
print "ok\n";
diff --git a/ext/spl/tests/fixedarray_007.phpt b/ext/spl/tests/fixedarray_007.phpt
index 308ce315a5..65b4dad90e 100644
--- a/ext/spl/tests/fixedarray_007.phpt
+++ b/ext/spl/tests/fixedarray_007.phpt
@@ -7,15 +7,15 @@ $b = 10;
$a = new SplFixedArray($b);
try {
- $a[1] = $a;
+ $a[1] = $a;
} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+ echo $e->getMessage(), "\n";
}
foreach ($a as $c) {
- if ($c) {
- echo $c->getSize(), "\n";
- }
+ if ($c) {
+ echo $c->getSize(), "\n";
+ }
}
print "ok\n";
diff --git a/ext/spl/tests/fixedarray_008.phpt b/ext/spl/tests/fixedarray_008.phpt
index 6d9c9cbf09..8bac0824d1 100644
--- a/ext/spl/tests/fixedarray_008.phpt
+++ b/ext/spl/tests/fixedarray_008.phpt
@@ -13,11 +13,11 @@ $a[2] = $a;
$a[2][0] = 3;
foreach ($a as $x) {
- if (is_object($x)) {
- var_dump($x[0]);
- } else {
- var_dump($x);
- }
+ if (is_object($x)) {
+ var_dump($x[0]);
+ } else {
+ var_dump($x);
+ }
}
var_dump($a->getSize());
diff --git a/ext/spl/tests/fixedarray_009.phpt b/ext/spl/tests/fixedarray_009.phpt
index 185b9d1acc..71d6a42a6f 100644
--- a/ext/spl/tests/fixedarray_009.phpt
+++ b/ext/spl/tests/fixedarray_009.phpt
@@ -1,12 +1,12 @@
--TEST--
-SPL: FixedArray: Trying to instantiate passing string to construtor parameter
+SPL: FixedArray: Trying to instantiate passing string to constructor parameter
--FILE--
<?php
try {
- $a = new SplFixedArray('FOO');
+ $a = new SplFixedArray('FOO');
} catch (TypeError $iae) {
- echo "Ok - ".$iae->getMessage().PHP_EOL;
+ echo "Ok - ".$iae->getMessage().PHP_EOL;
}
?>
--EXPECT--
diff --git a/ext/spl/tests/fixedarray_012.phpt b/ext/spl/tests/fixedarray_012.phpt
index 3461b3a9b5..df725aad46 100644
--- a/ext/spl/tests/fixedarray_012.phpt
+++ b/ext/spl/tests/fixedarray_012.phpt
@@ -6,9 +6,9 @@ SPL: FixedArray: Assigning the object to another variable using []
$a = new SplFixedArray(100);
try {
- $b = &$a[];
+ $b = &$a[];
} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+ echo $e->getMessage(), "\n";
}
print "ok\n";
diff --git a/ext/spl/tests/fixedarray_013.phpt b/ext/spl/tests/fixedarray_013.phpt
index 52ae3c161e..cf43b3c7e7 100644
--- a/ext/spl/tests/fixedarray_013.phpt
+++ b/ext/spl/tests/fixedarray_013.phpt
@@ -7,13 +7,13 @@ $a = new SplFixedArray(100);
function test(SplFixedArray &$arr) {
- print "ok\n";
+ print "ok\n";
}
try {
- test($a[]);
+ test($a[]);
} catch (Exception $e) {
- echo $e->getMessage(), "\n";
+ echo $e->getMessage(), "\n";
}
?>
diff --git a/ext/spl/tests/fixedarray_014.phpt b/ext/spl/tests/fixedarray_014.phpt
index de8e214dc0..a6f2fc188c 100644
--- a/ext/spl/tests/fixedarray_014.phpt
+++ b/ext/spl/tests/fixedarray_014.phpt
@@ -4,10 +4,10 @@ SPL: FixedArray: Trying to access inexistent item
<?php
try {
- $a = new SplFixedArray(NULL);
- echo $a[0]++;
+ $a = new SplFixedArray(NULL);
+ echo $a[0]++;
} catch (Exception $e) {
- echo $e->getMessage();
+ echo $e->getMessage();
}
?>
diff --git a/ext/spl/tests/fixedarray_015.phpt b/ext/spl/tests/fixedarray_015.phpt
index 3fedd35090..2a2d5a26f7 100644
--- a/ext/spl/tests/fixedarray_015.phpt
+++ b/ext/spl/tests/fixedarray_015.phpt
@@ -4,9 +4,9 @@ SPL: FixedArray: accessing uninitialized array
<?php
try {
- $a = new SplFixedArray('');
+ $a = new SplFixedArray('');
} catch (TypeError $iae) {
- echo "Ok - ".$iae->getMessage().PHP_EOL;
+ echo "Ok - ".$iae->getMessage().PHP_EOL;
}
echo "Done\n";
diff --git a/ext/spl/tests/fixedarray_018.phpt b/ext/spl/tests/fixedarray_018.phpt
index 84ab109195..aa02fb5de1 100644
--- a/ext/spl/tests/fixedarray_018.phpt
+++ b/ext/spl/tests/fixedarray_018.phpt
@@ -1,5 +1,5 @@
--TEST--
-SPL: FixedArray: overriden count()
+SPL: FixedArray: overridden count()
--FILE--
<?php
$obj = new SplFixedArray(2);
diff --git a/ext/spl/tests/fixedarray_019.phpt b/ext/spl/tests/fixedarray_019.phpt
index f28edfda41..9414e97304 100644
--- a/ext/spl/tests/fixedarray_019.phpt
+++ b/ext/spl/tests/fixedarray_019.phpt
@@ -1,5 +1,5 @@
--TEST--
-SPL: FixedArray: overriden iterator methods
+SPL: FixedArray: overridden iterator methods
--FILE--
<?php
class SplFixedArray2 extends SplFixedArray {
diff --git a/ext/spl/tests/fixedarray_021.phpt b/ext/spl/tests/fixedarray_021.phpt
index 97b0a70f13..db4962ef48 100644
--- a/ext/spl/tests/fixedarray_021.phpt
+++ b/ext/spl/tests/fixedarray_021.phpt
@@ -11,17 +11,17 @@ var_dump($a->count());
/* negative init value */
try {
- $b = new SplFixedArray(-10);
+ $b = new SplFixedArray(-10);
} catch (Exception $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
/* resize and negative value */
$b = new SplFixedArray();
try {
- $b->setSize(-5);
+ $b->setSize(-5);
} catch (Exception $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
/* calling __construct() twice */
@@ -43,11 +43,11 @@ $e[1] = 5;
$e[2] = 10;
try {
- foreach ($e as $k=>&$v) {
- var_dump($v);
- }
+ foreach ($e as $k=>&$v) {
+ var_dump($v);
+ }
} catch (Exception $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
//non-long indexes
@@ -60,7 +60,6 @@ var_dump(isset($a["0"], $a[-1]), $a["1"]);
var_dump(empty($a["3"]));
?>
-==DONE==
--EXPECTF--
int(0)
int(0)
@@ -75,4 +74,3 @@ string(52) "An iterator cannot be used with foreach by reference"
bool(false)
string(3) "foo"
bool(true)
-==DONE==
diff --git a/ext/spl/tests/heap_001.phpt b/ext/spl/tests/heap_001.phpt
index f9cfd68710..33f091838b 100644
--- a/ext/spl/tests/heap_001.phpt
+++ b/ext/spl/tests/heap_001.phpt
@@ -36,8 +36,6 @@ $h2 = clone $h;
echo $h->extract()."\n";
echo $h2->extract()."\n";
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Exception: Can't extract from an empty heap
5
@@ -50,4 +48,3 @@ Exception: Can't extract from an empty heap
--
4
4
-===DONE===
diff --git a/ext/spl/tests/heap_002.phpt b/ext/spl/tests/heap_002.phpt
index 578d15b21c..452fdf189a 100644
--- a/ext/spl/tests/heap_002.phpt
+++ b/ext/spl/tests/heap_002.phpt
@@ -34,8 +34,6 @@ $b = 5;
echo $h->extract()."\n";
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Exception: Can't extract from an empty heap
5
@@ -47,4 +45,3 @@ Exception: Can't extract from an empty heap
0
--
4
-===DONE===
diff --git a/ext/spl/tests/heap_003.phpt b/ext/spl/tests/heap_003.phpt
index 4a4bcff5ff..69620af8ef 100644
--- a/ext/spl/tests/heap_003.phpt
+++ b/ext/spl/tests/heap_003.phpt
@@ -27,8 +27,6 @@ foreach ($h as $out) {
echo $out."\n";
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
10
9
@@ -41,4 +39,3 @@ foreach ($h as $out) {
2
1
0
-===DONE===
diff --git a/ext/spl/tests/heap_004.phpt b/ext/spl/tests/heap_004.phpt
index e493d20fac..892da20fb7 100644
--- a/ext/spl/tests/heap_004.phpt
+++ b/ext/spl/tests/heap_004.phpt
@@ -53,8 +53,6 @@ try {
echo "Exception: ".$e->getMessage()."\n";
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
inserted 1
Exception: foo
@@ -64,4 +62,3 @@ Exception: Heap is corrupted, heap properties are no longer ensured.
Recovering..
int(1)
int(2)
-===DONE===
diff --git a/ext/spl/tests/heap_005.phpt b/ext/spl/tests/heap_005.phpt
index 8621f09aa4..39a9e81ebb 100644
--- a/ext/spl/tests/heap_005.phpt
+++ b/ext/spl/tests/heap_005.phpt
@@ -15,8 +15,6 @@ foreach ($h as $k => $o) {
echo "$k => $o\n";
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
99 => 1
98 => 2
@@ -118,4 +116,3 @@ foreach ($h as $k => $o) {
2 => 98
1 => 99
0 => 100
-===DONE===
diff --git a/ext/spl/tests/heap_006.phpt b/ext/spl/tests/heap_006.phpt
index 41c7b84638..998c07c91e 100644
--- a/ext/spl/tests/heap_006.phpt
+++ b/ext/spl/tests/heap_006.phpt
@@ -15,8 +15,6 @@ foreach ($h as $k => $o) {
echo "$k => $o\n";
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
99 => 100
98 => 99
@@ -118,4 +116,3 @@ foreach ($h as $k => $o) {
2 => 3
1 => 2
0 => 1
-===DONE===
diff --git a/ext/spl/tests/heap_007.phpt b/ext/spl/tests/heap_007.phpt
index 27bd66edf1..291f27d69f 100644
--- a/ext/spl/tests/heap_007.phpt
+++ b/ext/spl/tests/heap_007.phpt
@@ -20,8 +20,6 @@ while ($h->valid()) {
$h->next();
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
count($h) = 4
$h->count() = 4
@@ -29,4 +27,3 @@ $h->count() = 4
2=>4
1=>1
0=>0
-===DONE===
diff --git a/ext/spl/tests/heap_008.phpt b/ext/spl/tests/heap_008.phpt
index 3a746b2e6f..419726e6ff 100644
--- a/ext/spl/tests/heap_008.phpt
+++ b/ext/spl/tests/heap_008.phpt
@@ -11,8 +11,6 @@ $h->insert(4);
var_dump($h);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
object(SplMaxHeap)#1 (3) {
["flags":"SplHeap":private]=>
@@ -31,4 +29,3 @@ object(SplMaxHeap)#1 (3) {
int(1)
}
}
-===DONE===
diff --git a/ext/spl/tests/heap_009.phpt b/ext/spl/tests/heap_009.phpt
index f660b24d89..39d0a19f4b 100644
--- a/ext/spl/tests/heap_009.phpt
+++ b/ext/spl/tests/heap_009.phpt
@@ -17,20 +17,20 @@ function testForException( $heap )
}
}
-// 1. SplMinHeap emtpy
+// 1. SplMinHeap empty
$heap = new SplMinHeap;
testForException( $heap );
-// 2. SplMinHeap non-emtpy
+// 2. SplMinHeap non-empty
$heap = new SplMinHeap;
$heap->insert( 1 );
testForException( $heap );
-// 3. SplMaxHeap emtpy
+// 3. SplMaxHeap empty
$heap = new SplMaxHeap;
testForException( $heap );
-// 4. SplMaxHeap non-emtpy
+// 4. SplMaxHeap non-empty
$heap = new SplMaxHeap;
$heap->insert( 1 );
testForException( $heap );
@@ -45,7 +45,6 @@ $heap->insert( 1, 2 );
testForException( $heap );
?>
-==DONE==
--EXPECT--
An iterator cannot be used with foreach by reference
An iterator cannot be used with foreach by reference
@@ -53,4 +52,3 @@ An iterator cannot be used with foreach by reference
An iterator cannot be used with foreach by reference
An iterator cannot be used with foreach by reference
An iterator cannot be used with foreach by reference
-==DONE==
diff --git a/ext/spl/tests/heap_010.phpt b/ext/spl/tests/heap_010.phpt
index 8c7d8d5c96..81e71c2398 100644
--- a/ext/spl/tests/heap_010.phpt
+++ b/ext/spl/tests/heap_010.phpt
@@ -1,5 +1,5 @@
--TEST--
-SPL: SplHeap with overriden count()
+SPL: SplHeap with overridden count()
--FILE--
<?php
$obj = new SplMaxHeap();
diff --git a/ext/spl/tests/heap_011.phpt b/ext/spl/tests/heap_011.phpt
index 1689abfae1..fae62585b0 100644
--- a/ext/spl/tests/heap_011.phpt
+++ b/ext/spl/tests/heap_011.phpt
@@ -1,5 +1,5 @@
--TEST--
-SPL: SplHeap with overriden compare()
+SPL: SplHeap with overridden compare()
--FILE--
<?php
class SplMinHeap2 extends SplMinHeap {
diff --git a/ext/spl/tests/heap_012.phpt b/ext/spl/tests/heap_012.phpt
index f86f14f4d0..69f3708868 100644
--- a/ext/spl/tests/heap_012.phpt
+++ b/ext/spl/tests/heap_012.phpt
@@ -6,7 +6,6 @@ $a = new SplMaxHeap;
$a->insert($a);
var_dump($a)
?>
-===DONE===
--EXPECTF--
object(SplMaxHeap)#%d (3) {
["flags":"SplHeap":private]=>
@@ -19,4 +18,3 @@ object(SplMaxHeap)#%d (3) {
*RECURSION*
}
}
-===DONE===
diff --git a/ext/spl/tests/heap_corruption.phpt b/ext/spl/tests/heap_corruption.phpt
index 47e8d008c0..9b14a0fe0b 100644
--- a/ext/spl/tests/heap_corruption.phpt
+++ b/ext/spl/tests/heap_corruption.phpt
@@ -8,30 +8,30 @@ Mike Sullivan <mikesul@php.net>
class myHeap extends SplHeap
{
- public $allow_compare = true;
+ public $allow_compare = true;
- public function compare($v1, $v2)
- {
- if ($this->allow_compare == true)
- {
- if ($v1 > $v2)
- {
- return 1;
- }
- else if ($v1 < $v2)
- {
- return -1;
- }
- else
- {
- return 0;
- }
- }
- else
- {
- throw new Exception('Compare exception');
- }
- }
+ public function compare($v1, $v2)
+ {
+ if ($this->allow_compare == true)
+ {
+ if ($v1 > $v2)
+ {
+ return 1;
+ }
+ else if ($v1 < $v2)
+ {
+ return -1;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ else
+ {
+ throw new Exception('Compare exception');
+ }
+ }
}
$heap = new myHeap();
@@ -45,17 +45,17 @@ $heap->allow_compare = false;
var_dump($heap->isCorrupted());
try {
- $heap->extract();
+ $heap->extract();
}
catch (Exception $e) {
- echo "Compare Exception: " . $e->getMessage() . PHP_EOL;
+ echo "Compare Exception: " . $e->getMessage() . PHP_EOL;
}
try {
- $heap->top();
+ $heap->top();
}
catch (Exception $e) {
- echo "Corruption Exception: " . $e->getMessage() . PHP_EOL;
+ echo "Corruption Exception: " . $e->getMessage() . PHP_EOL;
}
var_dump($heap->isCorrupted());
diff --git a/ext/spl/tests/heap_current_variation_001.phpt b/ext/spl/tests/heap_current_variation_001.phpt
index f67eb428c3..a55bb486e9 100644
--- a/ext/spl/tests/heap_current_variation_001.phpt
+++ b/ext/spl/tests/heap_current_variation_001.phpt
@@ -8,10 +8,10 @@ Mike Sullivan <mikesul@php.net>
class myHeap extends SplHeap
{
- public function compare($v1, $v2)
- {
- throw new Exception('');
- }
+ public function compare($v1, $v2)
+ {
+ throw new Exception('');
+ }
}
$heap = new myHeap();
diff --git a/ext/spl/tests/heap_top_variation_002.phpt b/ext/spl/tests/heap_top_variation_002.phpt
index 4d6bdd593a..add363eab3 100644
--- a/ext/spl/tests/heap_top_variation_002.phpt
+++ b/ext/spl/tests/heap_top_variation_002.phpt
@@ -7,9 +7,9 @@ TestFest London May 2009
<?php
// override heap to force corruption by throwing exception in compare
class SplMinHeap2 extends SplMinHeap {
- public function compare($a, $b) {
- throw new Exception('Corrupt heap');
- }
+ public function compare($a, $b) {
+ throw new Exception('Corrupt heap');
+ }
}
$h = new SplMinHeap2();
@@ -17,14 +17,14 @@ $h = new SplMinHeap2();
// insert 2 elements to hit our overridden compare
$h->insert(4);
try {
- $h->insert(5);
+ $h->insert(5);
} catch (Exception $e) {}
// call top, should fail with corrupted heap
try {
- $h->top();
+ $h->top();
} catch (Exception $e) {
- echo $e->getMessage();
+ echo $e->getMessage();
}
?>
--EXPECT--
diff --git a/ext/spl/tests/heap_top_variation_003.phpt b/ext/spl/tests/heap_top_variation_003.phpt
index c2ea2bcd95..40d70c5966 100644
--- a/ext/spl/tests/heap_top_variation_003.phpt
+++ b/ext/spl/tests/heap_top_variation_003.phpt
@@ -7,9 +7,9 @@ TestFest London May 2009
<?php
$h = new SplMinHeap();
try {
- $h->top();
+ $h->top();
} catch (Exception $e) {
- echo $e->getMessage();
+ echo $e->getMessage();
}
?>
--EXPECT--
diff --git a/ext/spl/tests/iterator_001.phpt b/ext/spl/tests/iterator_001.phpt
index f5bb6974d9..c8151533a8 100644
--- a/ext/spl/tests/iterator_001.phpt
+++ b/ext/spl/tests/iterator_001.phpt
@@ -5,69 +5,69 @@ SPL: Iterator aggregating inner iterator's methods
class NumericArrayIterator implements Iterator
{
- protected $a;
- protected $i = 0;
+ protected $a;
+ protected $i = 0;
- public function __construct($a)
- {
- echo __METHOD__ . "\n";
- $this->a = $a;
- }
+ public function __construct($a)
+ {
+ echo __METHOD__ . "\n";
+ $this->a = $a;
+ }
- public function rewind()
- {
- echo __METHOD__ . "\n";
- $this->i = 0;
- }
+ public function rewind()
+ {
+ echo __METHOD__ . "\n";
+ $this->i = 0;
+ }
- public function valid()
- {
- $ret = $this->i < count($this->a);
- echo __METHOD__ . '(' . ($ret ? 'true' : 'false') . ")\n";
- return $ret;
- }
+ public function valid()
+ {
+ $ret = $this->i < count($this->a);
+ echo __METHOD__ . '(' . ($ret ? 'true' : 'false') . ")\n";
+ return $ret;
+ }
- public function key()
- {
- echo __METHOD__ . "\n";
- return $this->i;
- }
+ public function key()
+ {
+ echo __METHOD__ . "\n";
+ return $this->i;
+ }
- public function current()
- {
- echo __METHOD__ . "\n";
- return $this->a[$this->i];
- }
+ public function current()
+ {
+ echo __METHOD__ . "\n";
+ return $this->a[$this->i];
+ }
- public function next()
- {
- echo __METHOD__ . "\n";
- $this->i++;
- }
+ public function next()
+ {
+ echo __METHOD__ . "\n";
+ $this->i++;
+ }
- public function greaterThan($comp)
- {
- echo get_class($this) . '::' . __FUNCTION__ . '(' . $comp . ")\n";
- return $this->current() > $comp;
- }
+ public function greaterThan($comp)
+ {
+ echo get_class($this) . '::' . __FUNCTION__ . '(' . $comp . ")\n";
+ return $this->current() > $comp;
+ }
}
class SeekableNumericArrayIterator extends NumericArrayIterator implements SeekableIterator
{
- public function seek($index)
- {
- if ($index < count($this->a)) {
- $this->i = $index;
- }
- echo __METHOD__ . '(' . $index . ")\n";
- }
+ public function seek($index)
+ {
+ if ($index < count($this->a)) {
+ $this->i = $index;
+ }
+ echo __METHOD__ . '(' . $index . ")\n";
+ }
}
$a = array(1, 2, 3, 4, 5);
$it = new LimitIterator(new NumericArrayIterator($a), 1, 3);
foreach ($it as $v)
{
- print $v . ' is ' . ($it->greaterThan(2) ? 'greater than 2' : 'less than or equal 2') . "\n";
+ print $v . ' is ' . ($it->greaterThan(2) ? 'greater than 2' : 'less than or equal 2') . "\n";
}
echo "===SEEKABLE===\n";
@@ -75,7 +75,7 @@ $a = array(1, 2, 3, 4, 5);
$it = new LimitIterator(new SeekableNumericArrayIterator($a), 1, 3);
foreach($it as $v)
{
- print $v . ' is ' . ($it->greaterThan(2) ? 'greater than 2' : 'less than or equal 2') . "\n";
+ print $v . ' is ' . ($it->greaterThan(2) ? 'greater than 2' : 'less than or equal 2') . "\n";
}
echo "===STACKED===\n";
@@ -84,12 +84,10 @@ $a = array(1, 2, 3, 4, 5);
$it = new CachingIterator(new LimitIterator(new SeekableNumericArrayIterator($a), 1, 3));
foreach($it as $v)
{
- print $v . ' is ' . ($it->greaterThan(2) ? 'greater than 2' : 'less than or equal 2') . "\n";
+ print $v . ' is ' . ($it->greaterThan(2) ? 'greater than 2' : 'less than or equal 2') . "\n";
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
NumericArrayIterator::__construct
NumericArrayIterator::rewind
@@ -168,4 +166,3 @@ NumericArrayIterator::next
SeekableNumericArrayIterator::greaterThan(2)
NumericArrayIterator::current
4 is greater than 2
-===DONE===
diff --git a/ext/spl/tests/iterator_002.phpt b/ext/spl/tests/iterator_002.phpt
index 61765421f1..da790988fc 100644
--- a/ext/spl/tests/iterator_002.phpt
+++ b/ext/spl/tests/iterator_002.phpt
@@ -5,33 +5,33 @@ SPL: Iterator using getInnerIterator
class RecursiceArrayIterator extends ArrayIterator implements RecursiveIterator
{
- function hasChildren()
- {
- return is_array($this->current());
- }
-
- function getChildren()
- {
- return new RecursiceArrayIterator($this->current());
- }
+ function hasChildren()
+ {
+ return is_array($this->current());
+ }
+
+ function getChildren()
+ {
+ return new RecursiceArrayIterator($this->current());
+ }
}
class CrashIterator extends FilterIterator implements RecursiveIterator
{
- function accept()
- {
- return true;
- }
-
- function hasChildren()
- {
- return $this->getInnerIterator()->hasChildren();
- }
-
- function getChildren()
- {
- return new RecursiceArrayIterator($this->getInnerIterator()->current());
- }
+ function accept()
+ {
+ return true;
+ }
+
+ function hasChildren()
+ {
+ return $this->getInnerIterator()->hasChildren();
+ }
+
+ function getChildren()
+ {
+ return new RecursiceArrayIterator($this->getInnerIterator()->current());
+ }
}
$array = array(1, 2 => array(21, 22 => array(221, 222), 23 => array(231)), 3);
@@ -39,12 +39,10 @@ $array = array(1, 2 => array(21, 22 => array(221, 222), 23 => array(231)), 3);
$dir = new RecursiveIteratorIterator(new CrashIterator(new RecursiceArrayIterator($array)), RecursiveIteratorIterator::LEAVES_ONLY);
foreach ($dir as $file) {
- print "$file\n";
+ print "$file\n";
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
1
21
@@ -52,4 +50,3 @@ foreach ($dir as $file) {
222
231
3
-===DONE===
diff --git a/ext/spl/tests/iterator_003.phpt b/ext/spl/tests/iterator_003.phpt
index f119661f57..b7b331a496 100644
--- a/ext/spl/tests/iterator_003.phpt
+++ b/ext/spl/tests/iterator_003.phpt
@@ -5,73 +5,73 @@ SPL: CachingIterator and __toString()
class Student
{
- private $id;
- private $name;
+ private $id;
+ private $name;
public function __construct($id, $name)
{
- $this->id = $id;
- $this->name = $name;
+ $this->id = $id;
+ $this->name = $name;
}
- public function __toString()
- {
- return $this->id . ', ' . $this->name;
- }
+ public function __toString()
+ {
+ return $this->id . ', ' . $this->name;
+ }
- public function getId()
- {
- return $this->id;
- }
+ public function getId()
+ {
+ return $this->id;
+ }
}
class StudentIdFilter extends FilterIterator
{
- private $id;
+ private $id;
- public function __construct(ArrayObject $students, Student $other)
- {
- FilterIterator::__construct($students->getIterator());
- $this->id = $other->getId();
- }
+ public function __construct(ArrayObject $students, Student $other)
+ {
+ FilterIterator::__construct($students->getIterator());
+ $this->id = $other->getId();
+ }
- public function accept()
- {
- echo "ACCEPT ".$this->current()->getId()." == ".$this->id."\n";
- return $this->current()->getId() == $this->id;
- }
+ public function accept()
+ {
+ echo "ACCEPT ".$this->current()->getId()." == ".$this->id."\n";
+ return $this->current()->getId() == $this->id;
+ }
}
class StudentList implements IteratorAggregate
{
- private $students;
+ private $students;
- public function __construct()
- {
- $this->students = new ArrayObject(array());
- }
+ public function __construct()
+ {
+ $this->students = new ArrayObject(array());
+ }
- public function add(Student $student)
- {
- if (!$this->contains($student)) {
- $this->students[] = $student;
- }
- }
+ public function add(Student $student)
+ {
+ if (!$this->contains($student)) {
+ $this->students[] = $student;
+ }
+ }
- public function contains(Student $student)
- {
- foreach ($this->students as $s)
- {
- if ($s->getId() == $student->getId()) {
- return true;
- }
- }
- return false;
- }
+ public function contains(Student $student)
+ {
+ foreach ($this->students as $s)
+ {
+ if ($s->getId() == $student->getId()) {
+ return true;
+ }
+ }
+ return false;
+ }
- public function getIterator() {
- return new CachingIterator($this->students->getIterator(), true);
- }
+ public function getIterator() {
+ return new CachingIterator($this->students->getIterator(), true);
+ }
}
$students = new StudentList();
@@ -84,12 +84,9 @@ $students->add(new Student('00000014', 'Foo'));
// iterator's __toString() method.
$it = $students->getIterator();
foreach ($it as $student) {
- echo $it->__toString(), "\n";
+ echo $it->__toString(), "\n";
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
01234123, Joe
00000014, Bob
-===DONE===
diff --git a/ext/spl/tests/iterator_004.phpt b/ext/spl/tests/iterator_004.phpt
index e07cd32c39..d131593ad2 100644
--- a/ext/spl/tests/iterator_004.phpt
+++ b/ext/spl/tests/iterator_004.phpt
@@ -5,69 +5,69 @@ SPL: SeekableIterator and string keys
class NumericArrayIterator implements Iterator
{
- protected $a;
- protected $i;
+ protected $a;
+ protected $i;
- public function __construct($a)
- {
- echo __METHOD__ . "\n";
- $this->a = $a;
- }
+ public function __construct($a)
+ {
+ echo __METHOD__ . "\n";
+ $this->a = $a;
+ }
- public function rewind()
- {
- echo __METHOD__ . "\n";
- $this->i = 0;
- }
+ public function rewind()
+ {
+ echo __METHOD__ . "\n";
+ $this->i = 0;
+ }
- public function valid()
- {
- $ret = $this->i < count($this->a);
- echo __METHOD__ . '(' . ($ret ? 'true' : 'false') . ")\n";
- return $ret;
- }
+ public function valid()
+ {
+ $ret = $this->i < count($this->a);
+ echo __METHOD__ . '(' . ($ret ? 'true' : 'false') . ")\n";
+ return $ret;
+ }
- public function key()
- {
- echo __METHOD__ . "\n";
- return $this->i;
- }
+ public function key()
+ {
+ echo __METHOD__ . "\n";
+ return $this->i;
+ }
- public function current()
- {
- echo __METHOD__ . "\n";
- return $this->a[$this->i];
- }
+ public function current()
+ {
+ echo __METHOD__ . "\n";
+ return $this->a[$this->i];
+ }
- public function next()
- {
- echo __METHOD__ . "\n";
- $this->i++;
- }
+ public function next()
+ {
+ echo __METHOD__ . "\n";
+ $this->i++;
+ }
}
class SeekableNumericArrayIterator extends NumericArrayIterator implements SeekableIterator
{
- public function seek($index)
- {
- if ($index < count($this->a)) {
- $this->i = $index;
- }
- echo __METHOD__ . '(' . $index . ")\n";
- }
+ public function seek($index)
+ {
+ if ($index < count($this->a)) {
+ $this->i = $index;
+ }
+ echo __METHOD__ . '(' . $index . ")\n";
+ }
}
$a = array(1, 2, 3, 4, 5);
foreach (new LimitIterator(new NumericArrayIterator($a), 1, 3) as $v)
{
- print "$v\n";
+ print "$v\n";
}
echo "===SEEKABLE===\n";
$a = array(1, 2, 3, 4, 5);
foreach(new LimitIterator(new SeekableNumericArrayIterator($a), 1, 3) as $v)
{
- print "$v\n";
+ print "$v\n";
}
echo "===SEEKING===\n";
@@ -75,13 +75,11 @@ $a = array(1, 2, 3, 4, 5);
$l = new LimitIterator(new SeekableNumericArrayIterator($a));
for($i = 1; $i < 4; $i++)
{
- $l->seek($i);
- print $l->current() . "\n";
+ $l->seek($i);
+ print $l->current() . "\n";
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
NumericArrayIterator::__construct
NumericArrayIterator::rewind
@@ -139,4 +137,3 @@ NumericArrayIterator::valid(true)
NumericArrayIterator::current
NumericArrayIterator::key
4
-===DONE===
diff --git a/ext/spl/tests/iterator_005.phpt b/ext/spl/tests/iterator_005.phpt
index cacf006c5a..9f13889a18 100644
--- a/ext/spl/tests/iterator_005.phpt
+++ b/ext/spl/tests/iterator_005.phpt
@@ -5,39 +5,37 @@ SPL: IteratorIterator and ArrayIterator/Object
class ArrayIteratorEx extends ArrayIterator
{
- function rewind()
- {
- echo __METHOD__ . "\n";
- return parent::rewind();
- }
+ function rewind()
+ {
+ echo __METHOD__ . "\n";
+ return parent::rewind();
+ }
}
$it = new ArrayIteratorEx(range(0,3));
foreach(new IteratorIterator($it) as $v)
{
- var_dump($v);
+ var_dump($v);
}
class ArrayObjectEx extends ArrayObject
{
- function getIterator()
- {
- echo __METHOD__ . "\n";
- return parent::getIterator();
- }
+ function getIterator()
+ {
+ echo __METHOD__ . "\n";
+ return parent::getIterator();
+ }
}
$it = new ArrayObjectEx(range(0,3));
foreach(new IteratorIterator($it) as $v)
{
- var_dump($v);
+ var_dump($v);
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
ArrayIteratorEx::rewind
int(0)
@@ -49,4 +47,3 @@ int(0)
int(1)
int(2)
int(3)
-===DONE===
diff --git a/ext/spl/tests/iterator_006.phpt b/ext/spl/tests/iterator_006.phpt
index 794eca0da9..78c597a795 100644
--- a/ext/spl/tests/iterator_006.phpt
+++ b/ext/spl/tests/iterator_006.phpt
@@ -13,12 +13,9 @@ $root = simplexml_load_string('<?xml version="1.0"?>
');
foreach (new IteratorIterator($root->child) as $child) {
- echo $child."\n";
+ echo $child."\n";
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Hello
World
-===DONE===
diff --git a/ext/spl/tests/iterator_007.phpt b/ext/spl/tests/iterator_007.phpt
index d26c01ef79..8fb503c79a 100644
--- a/ext/spl/tests/iterator_007.phpt
+++ b/ext/spl/tests/iterator_007.phpt
@@ -5,72 +5,72 @@ SPL: NoRewindIterator
class ArrayIteratorEx extends ArrayIterator
{
- function rewind()
- {
- echo __METHOD__ . "\n";
- parent::rewind();
- }
- function valid()
- {
- echo __METHOD__ . "\n";
- return parent::valid();
- }
- function current()
- {
- echo __METHOD__ . "\n";
- return parent::current();
- }
- function key()
- {
- echo __METHOD__ . "\n";
- return parent::key();
- }
- function next()
- {
- echo __METHOD__ . "\n";
- parent::next();
- }
+ function rewind()
+ {
+ echo __METHOD__ . "\n";
+ parent::rewind();
+ }
+ function valid()
+ {
+ echo __METHOD__ . "\n";
+ return parent::valid();
+ }
+ function current()
+ {
+ echo __METHOD__ . "\n";
+ return parent::current();
+ }
+ function key()
+ {
+ echo __METHOD__ . "\n";
+ return parent::key();
+ }
+ function next()
+ {
+ echo __METHOD__ . "\n";
+ parent::next();
+ }
}
class NoRewindIteratorEx extends NoRewindIterator
{
- function rewind()
- {
- echo __METHOD__ . "\n";
- parent::rewind();
- }
- function valid()
- {
- echo __METHOD__ . "\n";
- return parent::valid();
- }
- function current()
- {
- echo __METHOD__ . "\n";
- return parent::current();
- }
- function key()
- {
- echo __METHOD__ . "\n";
- return parent::key();
- }
- function next()
- {
- echo __METHOD__ . "\n";
- parent::next();
- }
+ function rewind()
+ {
+ echo __METHOD__ . "\n";
+ parent::rewind();
+ }
+ function valid()
+ {
+ echo __METHOD__ . "\n";
+ return parent::valid();
+ }
+ function current()
+ {
+ echo __METHOD__ . "\n";
+ return parent::current();
+ }
+ function key()
+ {
+ echo __METHOD__ . "\n";
+ return parent::key();
+ }
+ function next()
+ {
+ echo __METHOD__ . "\n";
+ parent::next();
+ }
}
$it = new NoRewindIteratorEx(new ArrayIteratorEx(range(0,3)));
echo "===0===\n";
foreach ($it->getInnerIterator() as $v) {
- var_dump($v);
+ var_dump($v);
}
echo "===1===\n";
foreach ($it as $v) {
- var_dump($v);
+ var_dump($v);
}
$pos =0;
@@ -79,24 +79,22 @@ $it = new NoRewindIteratorEx(new ArrayIteratorEx(range(0,3)));
echo "===2===\n";
foreach ($it as $v) {
- var_dump($v);
- if ($pos++ > 1) {
- break;
- }
+ var_dump($v);
+ if ($pos++ > 1) {
+ break;
+ }
}
echo "===3===\n";
foreach ($it as $v) {
- var_dump($v);
+ var_dump($v);
}
echo "===4===\n";
foreach ($it as $v) {
- var_dump($v);
+ var_dump($v);
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
===0===
ArrayIteratorEx::rewind
@@ -163,4 +161,3 @@ ArrayIteratorEx::valid
NoRewindIteratorEx::rewind
NoRewindIteratorEx::valid
ArrayIteratorEx::valid
-===DONE===
diff --git a/ext/spl/tests/iterator_008.phpt b/ext/spl/tests/iterator_008.phpt
index 04f8c00348..19c6038e3c 100644
--- a/ext/spl/tests/iterator_008.phpt
+++ b/ext/spl/tests/iterator_008.phpt
@@ -5,31 +5,31 @@ SPL: InfiniteIterator
class ArrayIteratorEx extends ArrayIterator
{
- function rewind()
- {
- echo __METHOD__ . "\n";
- parent::rewind();
- }
- function valid()
- {
- echo __METHOD__ . "\n";
- return parent::valid();
- }
- function current()
- {
- echo __METHOD__ . "\n";
- return parent::current();
- }
- function key()
- {
- echo __METHOD__ . "\n";
- return parent::key();
- }
- function next()
- {
- echo __METHOD__ . "\n";
- parent::next();
- }
+ function rewind()
+ {
+ echo __METHOD__ . "\n";
+ parent::rewind();
+ }
+ function valid()
+ {
+ echo __METHOD__ . "\n";
+ return parent::valid();
+ }
+ function current()
+ {
+ echo __METHOD__ . "\n";
+ return parent::current();
+ }
+ function key()
+ {
+ echo __METHOD__ . "\n";
+ return parent::key();
+ }
+ function next()
+ {
+ echo __METHOD__ . "\n";
+ parent::next();
+ }
}
$it = new InfiniteIterator(new ArrayIteratorEx(range(0,2)));
@@ -37,15 +37,13 @@ $it = new InfiniteIterator(new ArrayIteratorEx(range(0,2)));
$pos =0;
foreach ($it as $v) {
- var_dump($v);
- if ($pos++ > 5) {
- break;
- }
+ var_dump($v);
+ if ($pos++ > 5) {
+ break;
+ }
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
ArrayIteratorEx::rewind
ArrayIteratorEx::valid
@@ -86,4 +84,3 @@ ArrayIteratorEx::valid
ArrayIteratorEx::current
ArrayIteratorEx::key
int(0)
-===DONE===
diff --git a/ext/spl/tests/iterator_009.phpt b/ext/spl/tests/iterator_009.phpt
index 0bfe74ef7f..19447deac4 100644
--- a/ext/spl/tests/iterator_009.phpt
+++ b/ext/spl/tests/iterator_009.phpt
@@ -5,41 +5,38 @@ SPL: EmptyIterator
class EmptyIteratorEx extends EmptyIterator
{
- function rewind()
- {
- echo __METHOD__ . "\n";
- parent::rewind();
- }
- function valid()
- {
- echo __METHOD__ . "\n";
- return parent::valid();
- }
- function current()
- {
- echo __METHOD__ . "\n";
- return parent::current();
- }
- function key()
- {
- echo __METHOD__ . "\n";
- return parent::key();
- }
- function next()
- {
- echo __METHOD__ . "\n";
- parent::next();
- }
+ function rewind()
+ {
+ echo __METHOD__ . "\n";
+ parent::rewind();
+ }
+ function valid()
+ {
+ echo __METHOD__ . "\n";
+ return parent::valid();
+ }
+ function current()
+ {
+ echo __METHOD__ . "\n";
+ return parent::current();
+ }
+ function key()
+ {
+ echo __METHOD__ . "\n";
+ return parent::key();
+ }
+ function next()
+ {
+ echo __METHOD__ . "\n";
+ parent::next();
+ }
}
foreach (new EmptyIteratorEx() as $v) {
- var_dump($v);
+ var_dump($v);
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
EmptyIteratorEx::rewind
EmptyIteratorEx::valid
-===DONE===
diff --git a/ext/spl/tests/iterator_010.phpt b/ext/spl/tests/iterator_010.phpt
index b8013d7311..17e901f0c1 100644
--- a/ext/spl/tests/iterator_010.phpt
+++ b/ext/spl/tests/iterator_010.phpt
@@ -7,12 +7,9 @@ echo "===EmptyIterator===\n";
foreach(new LimitIterator(new EmptyIterator(), 0, 3) as $key => $val)
{
- echo "$key=>$val\n";
+ echo "$key=>$val\n";
}
?>
-===DONE===
-<?php exit(0);
--EXPECT--
===EmptyIterator===
-===DONE===
diff --git a/ext/spl/tests/iterator_011.phpt b/ext/spl/tests/iterator_011.phpt
index 62b8ed8ea9..5d814ce1f7 100644
--- a/ext/spl/tests/iterator_011.phpt
+++ b/ext/spl/tests/iterator_011.phpt
@@ -7,7 +7,7 @@ echo "===EmptyIterator===\n";
foreach(new LimitIterator(new InfiniteIterator(new EmptyIterator()), 0, 3) as $key=>$val)
{
- echo "$key=>$val\n";
+ echo "$key=>$val\n";
}
echo "===InfiniteIterator===\n";
@@ -17,7 +17,7 @@ $it = new InfiniteIterator($it);
$it = new LimitIterator($it, 2, 5);
foreach($it as $val=>$key)
{
- echo "$val=>$key\n";
+ echo "$val=>$key\n";
}
echo "===Infinite/LimitIterator===\n";
@@ -28,12 +28,10 @@ $it = new InfiniteIterator($it);
$it = new LimitIterator($it, 2, 5);
foreach($it as $val=>$key)
{
- echo "$val=>$key\n";
+ echo "$val=>$key\n";
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
===EmptyIterator===
===InfiniteIterator===
@@ -48,4 +46,3 @@ foreach($it as $val=>$key)
1=>B
2=>C
1=>B
-===DONE===
diff --git a/ext/spl/tests/iterator_012.phpt b/ext/spl/tests/iterator_012.phpt
index 63a3fce8bf..733dc10a12 100644
--- a/ext/spl/tests/iterator_012.phpt
+++ b/ext/spl/tests/iterator_012.phpt
@@ -17,12 +17,10 @@ echo "===Foreach===\n";
foreach($it as $key=>$val)
{
- echo "$key=>$val\n";
+ echo "$key=>$val\n";
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
===Current===
0=>A
@@ -30,4 +28,3 @@ foreach($it as $key=>$val)
===Foreach===
1=>B
2=>C
-===DONE===
diff --git a/ext/spl/tests/iterator_013.phpt b/ext/spl/tests/iterator_013.phpt
index 6da31e391d..daab33ab7e 100644
--- a/ext/spl/tests/iterator_013.phpt
+++ b/ext/spl/tests/iterator_013.phpt
@@ -9,7 +9,7 @@ $it = new AppendIterator;
foreach($it as $key=>$val)
{
- echo "$key=>$val\n";
+ echo "$key=>$val\n";
}
echo "===Append===\n";
@@ -18,14 +18,14 @@ $it->append(new ArrayIterator(array(0 => 'A', 1 => 'B')));
foreach($it as $key=>$val)
{
- echo "$key=>$val\n";
+ echo "$key=>$val\n";
}
echo "===Rewind===\n";
foreach($it as $key=>$val)
{
- echo "$key=>$val\n";
+ echo "$key=>$val\n";
}
echo "===Append===\n";
@@ -34,19 +34,17 @@ $it->append(new ArrayIterator(array(2 => 'C', 3 => 'D')));
foreach(new NoRewindIterator($it) as $key=>$val)
{
- echo "$key=>$val\n";
+ echo "$key=>$val\n";
}
echo "===Rewind===\n";
foreach($it as $key=>$val)
{
- echo "$key=>$val\n";
+ echo "$key=>$val\n";
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
===Empty===
===Append===
@@ -63,4 +61,3 @@ foreach($it as $key=>$val)
1=>B
2=>C
3=>D
-===DONE===
diff --git a/ext/spl/tests/iterator_014.phpt b/ext/spl/tests/iterator_014.phpt
index 119fad05fb..363b2916fe 100644
--- a/ext/spl/tests/iterator_014.phpt
+++ b/ext/spl/tests/iterator_014.phpt
@@ -5,76 +5,74 @@ SPL: RecursiveIteratorIterator and beginChildren/endChildren
class MyRecursiveArrayIterator extends RecursiveArrayIterator
{
- function valid()
- {
- if (!parent::valid())
- {
- echo __METHOD__ . " = false\n";
- return false;
- }
- else
- {
- return true;
- }
- }
+ function valid()
+ {
+ if (!parent::valid())
+ {
+ echo __METHOD__ . " = false\n";
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
- function getChildren()
- {
- echo __METHOD__ . "\n";
- return parent::getChildren();
- }
+ function getChildren()
+ {
+ echo __METHOD__ . "\n";
+ return parent::getChildren();
+ }
}
class RecursiveArrayIteratorIterator extends RecursiveIteratorIterator
{
- function rewind()
- {
- echo __METHOD__ . "\n";
- parent::rewind();
- }
+ function rewind()
+ {
+ echo __METHOD__ . "\n";
+ parent::rewind();
+ }
- function valid()
- {
- echo __METHOD__ . "\n";
- return parent::valid();
- }
+ function valid()
+ {
+ echo __METHOD__ . "\n";
+ return parent::valid();
+ }
- function current()
- {
- echo __METHOD__ . "\n";
- return parent::current();
- }
+ function current()
+ {
+ echo __METHOD__ . "\n";
+ return parent::current();
+ }
- function key()
- {
- echo __METHOD__ . "\n";
- return parent::key();
- }
+ function key()
+ {
+ echo __METHOD__ . "\n";
+ return parent::key();
+ }
- function next()
- {
- echo __METHOD__ . "\n";
- parent::next();
- }
+ function next()
+ {
+ echo __METHOD__ . "\n";
+ parent::next();
+ }
- function beginChildren()
- {
- echo __METHOD__ . "(".$this->getDepth().")\n";
- }
+ function beginChildren()
+ {
+ echo __METHOD__ . "(".$this->getDepth().")\n";
+ }
- function endChildren()
- {
- echo __METHOD__ . "(".$this->getDepth().")\n";
- }
+ function endChildren()
+ {
+ echo __METHOD__ . "(".$this->getDepth().")\n";
+ }
}
foreach(new RecursiveArrayIteratorIterator(new MyRecursiveArrayIterator(array("a", array("ba", array("bba", "bbb"), array(array("bcaa"))), array("ca"), "d"))) as $k=>$v)
{
- echo "$k=>$v\n";
+ echo "$k=>$v\n";
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
RecursiveArrayIteratorIterator::rewind
RecursiveArrayIteratorIterator::valid
@@ -135,4 +133,3 @@ RecursiveArrayIteratorIterator::next
MyRecursiveArrayIterator::valid = false
RecursiveArrayIteratorIterator::valid
MyRecursiveArrayIterator::valid = false
-===DONE===
diff --git a/ext/spl/tests/iterator_015.phpt b/ext/spl/tests/iterator_015.phpt
index bce00ae4d5..f83366bb1c 100644
--- a/ext/spl/tests/iterator_015.phpt
+++ b/ext/spl/tests/iterator_015.phpt
@@ -5,28 +5,28 @@ SPL: RecursiveIteratorIterator and beginChildren/endChildren
class RecursiveArrayIteratorIterator extends RecursiveIteratorIterator
{
- function rewind()
- {
- echo "<ul>\n";
- parent::rewind();
- }
- function beginChildren()
- {
- echo str_repeat(' ',$this->getDepth())."<ul>\n";
- }
+ function rewind()
+ {
+ echo "<ul>\n";
+ parent::rewind();
+ }
+ function beginChildren()
+ {
+ echo str_repeat(' ',$this->getDepth())."<ul>\n";
+ }
- function endChildren()
- {
- echo str_repeat(' ',$this->getDepth())."</ul>\n";
- }
- function valid()
- {
- if (!parent::valid()) {
- echo "<ul>\n";
- return false;
- }
- return true;
- }
+ function endChildren()
+ {
+ echo str_repeat(' ',$this->getDepth())."</ul>\n";
+ }
+ function valid()
+ {
+ if (!parent::valid()) {
+ echo "<ul>\n";
+ return false;
+ }
+ return true;
+ }
}
$arr = array("a", array("ba", array("bba", "bbb"), array(array("bcaa"))), array("ca"), "d");
@@ -34,11 +34,9 @@ $obj = new RecursiveArrayIterator($arr);
$rit = new RecursiveArrayIteratorIterator($obj);
foreach($rit as $k=>$v)
{
- echo str_repeat(' ',$rit->getDepth()+1)."$k=>$v\n";
+ echo str_repeat(' ',$rit->getDepth()+1)."$k=>$v\n";
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
<ul>
0=>a
@@ -59,4 +57,3 @@ foreach($rit as $k=>$v)
</ul>
3=>d
<ul>
-===DONE===
diff --git a/ext/spl/tests/iterator_016.phpt b/ext/spl/tests/iterator_016.phpt
index 77ffae83b0..966c05d989 100644
--- a/ext/spl/tests/iterator_016.phpt
+++ b/ext/spl/tests/iterator_016.phpt
@@ -5,41 +5,41 @@ SPL: RecursiveIteratorIterator and beginChildren/endChildren
class Menu extends ArrayObject
{
- function getIterator()
- {
- echo __METHOD__ . "\n";
- return new RecursiveArrayIterator($this);
- }
+ function getIterator()
+ {
+ echo __METHOD__ . "\n";
+ return new RecursiveArrayIterator($this);
+ }
}
class MenuOutput extends RecursiveIteratorIterator
{
- function __construct(Menu $it)
- {
- parent::__construct($it);
- }
- function rewind()
- {
- echo "<ul>\n";
- parent::rewind();
- }
- function beginChildren()
- {
- echo str_repeat(' ',$this->getDepth())."<ul>\n";
- }
+ function __construct(Menu $it)
+ {
+ parent::__construct($it);
+ }
+ function rewind()
+ {
+ echo "<ul>\n";
+ parent::rewind();
+ }
+ function beginChildren()
+ {
+ echo str_repeat(' ',$this->getDepth())."<ul>\n";
+ }
- function endChildren()
- {
- echo str_repeat(' ',$this->getDepth())."</ul>\n";
- }
- function valid()
- {
- if (!parent::valid()) {
- echo "<ul>\n";
- return false;
- }
- return true;
- }
+ function endChildren()
+ {
+ echo str_repeat(' ',$this->getDepth())."</ul>\n";
+ }
+ function valid()
+ {
+ if (!parent::valid()) {
+ echo "<ul>\n";
+ return false;
+ }
+ return true;
+ }
}
$arr = array("a", array("ba", array("bba", "bbb"), array(array("bcaa"))), array("ca"), "d");
@@ -47,11 +47,9 @@ $obj = new Menu($arr);
$rit = new MenuOutput($obj);
foreach($rit as $k=>$v)
{
- echo str_repeat(' ',$rit->getDepth()+1)."$k=>$v\n";
+ echo str_repeat(' ',$rit->getDepth()+1)."$k=>$v\n";
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Menu::getIterator
<ul>
@@ -73,4 +71,3 @@ Menu::getIterator
</ul>
3=>d
<ul>
-===DONE===
diff --git a/ext/spl/tests/iterator_018.phpt b/ext/spl/tests/iterator_018.phpt
index 618988630d..5d814ce1f7 100644
--- a/ext/spl/tests/iterator_018.phpt
+++ b/ext/spl/tests/iterator_018.phpt
@@ -7,7 +7,7 @@ echo "===EmptyIterator===\n";
foreach(new LimitIterator(new InfiniteIterator(new EmptyIterator()), 0, 3) as $key=>$val)
{
- echo "$key=>$val\n";
+ echo "$key=>$val\n";
}
echo "===InfiniteIterator===\n";
@@ -17,7 +17,7 @@ $it = new InfiniteIterator($it);
$it = new LimitIterator($it, 2, 5);
foreach($it as $val=>$key)
{
- echo "$val=>$key\n";
+ echo "$val=>$key\n";
}
echo "===Infinite/LimitIterator===\n";
@@ -28,12 +28,10 @@ $it = new InfiniteIterator($it);
$it = new LimitIterator($it, 2, 5);
foreach($it as $val=>$key)
{
- echo "$val=>$key\n";
+ echo "$val=>$key\n";
}
?>
-===DONE===
-<?php exit(0);
--EXPECT--
===EmptyIterator===
===InfiniteIterator===
@@ -48,4 +46,3 @@ foreach($it as $val=>$key)
1=>B
2=>C
1=>B
-===DONE===
diff --git a/ext/spl/tests/iterator_021.phpt b/ext/spl/tests/iterator_021.phpt
index 4f2395a8e5..433ced95e7 100644
--- a/ext/spl/tests/iterator_021.phpt
+++ b/ext/spl/tests/iterator_021.phpt
@@ -5,109 +5,107 @@ SPL: RecursiveIteratorIterator and hasChildren
class MyRecursiveArrayIterator extends RecursiveArrayIterator
{
- function valid()
- {
- if (!parent::valid())
- {
- echo __METHOD__ . " = false\n";
- return false;
- }
- else
- {
- return true;
- }
- }
+ function valid()
+ {
+ if (!parent::valid())
+ {
+ echo __METHOD__ . " = false\n";
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
- function getChildren()
- {
- echo __METHOD__ . "\n";
- return parent::getChildren();
- }
+ function getChildren()
+ {
+ echo __METHOD__ . "\n";
+ return parent::getChildren();
+ }
}
class RecursiveArrayIteratorIterator extends RecursiveIteratorIterator
{
- private $max_depth;
- private $over = 0;
- private $skip = false;
+ private $max_depth;
+ private $over = 0;
+ private $skip = false;
- function __construct($it, $max_depth)
- {
- $this->max_depth = $max_depth;
- parent::__construct($it);
- }
+ function __construct($it, $max_depth)
+ {
+ $this->max_depth = $max_depth;
+ parent::__construct($it);
+ }
- function rewind()
- {
- echo __METHOD__ . "\n";
- $this->skip = false;
- parent::rewind();
- }
+ function rewind()
+ {
+ echo __METHOD__ . "\n";
+ $this->skip = false;
+ parent::rewind();
+ }
- function valid()
- {
- echo __METHOD__ . "\n";
- if ($this->skip)
- {
- $this->skip = false;
- $this->next();
- }
- return parent::valid();
- }
+ function valid()
+ {
+ echo __METHOD__ . "\n";
+ if ($this->skip)
+ {
+ $this->skip = false;
+ $this->next();
+ }
+ return parent::valid();
+ }
- function current()
- {
- echo __METHOD__ . "\n";
- return parent::current();
- }
+ function current()
+ {
+ echo __METHOD__ . "\n";
+ return parent::current();
+ }
- function key()
- {
- echo __METHOD__ . "\n";
- return parent::key();
- }
+ function key()
+ {
+ echo __METHOD__ . "\n";
+ return parent::key();
+ }
- function next()
- {
- echo __METHOD__ . "\n";
- parent::next();
- }
+ function next()
+ {
+ echo __METHOD__ . "\n";
+ parent::next();
+ }
- function callHasChildren()
- {
- $this->skip = false;
- $has = parent::callHasChildren();
- $res = $this->getDepth() < $this->max_depth && $has;
- echo __METHOD__ . "(".$this->getDepth().") = ".($res?"yes":"no")."/".($has?"yes":"no")."\n";
- if ($has && !$res)
- {
- $this->over++;
- if ($this->over == 2) {
- $this->skip = true;
- }
- }
- return $res;
- }
+ function callHasChildren()
+ {
+ $this->skip = false;
+ $has = parent::callHasChildren();
+ $res = $this->getDepth() < $this->max_depth && $has;
+ echo __METHOD__ . "(".$this->getDepth().") = ".($res?"yes":"no")."/".($has?"yes":"no")."\n";
+ if ($has && !$res)
+ {
+ $this->over++;
+ if ($this->over == 2) {
+ $this->skip = true;
+ }
+ }
+ return $res;
+ }
- function beginChildren()
- {
- echo __METHOD__ . "(".$this->getDepth().")\n";
- }
+ function beginChildren()
+ {
+ echo __METHOD__ . "(".$this->getDepth().")\n";
+ }
- function endChildren()
- {
- echo __METHOD__ . "(".$this->getDepth().")\n";
- }
+ function endChildren()
+ {
+ echo __METHOD__ . "(".$this->getDepth().")\n";
+ }
}
foreach(new RecursiveArrayIteratorIterator(new MyRecursiveArrayIterator(array("a", array("ba", array("bba", "bbb"), array(array("bcaa"), array("bcba"))), array("ca"), "d")), 2) as $k=>$v)
{
- if (is_array($v)) $v = join('',$v);
- echo "$k=>$v\n";
+ if (is_array($v)) $v = join('',$v);
+ echo "$k=>$v\n";
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
RecursiveArrayIteratorIterator::rewind
RecursiveArrayIteratorIterator::callHasChildren(0) = no/no
@@ -177,4 +175,3 @@ RecursiveArrayIteratorIterator::next
MyRecursiveArrayIterator::valid = false
RecursiveArrayIteratorIterator::valid
MyRecursiveArrayIterator::valid = false
-===DONE===
diff --git a/ext/spl/tests/iterator_022.phpt b/ext/spl/tests/iterator_022.phpt
index f0831d5799..ae79932828 100644
--- a/ext/spl/tests/iterator_022.phpt
+++ b/ext/spl/tests/iterator_022.phpt
@@ -5,128 +5,126 @@ SPL: RecursiveIteratorIterator and callHasChildren/callGetChildren
class MyRecursiveArrayIterator extends RecursiveArrayIterator
{
- function getChildren()
- {
- echo __METHOD__ . "\n";
- return $this->current();
- }
+ function getChildren()
+ {
+ echo __METHOD__ . "\n";
+ return $this->current();
+ }
- function valid()
- {
- if (!parent::valid())
- {
- echo __METHOD__ . " = false\n";
- return false;
- }
- else
- {
- return true;
- }
- }
+ function valid()
+ {
+ if (!parent::valid())
+ {
+ echo __METHOD__ . " = false\n";
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
}
class RecursiveArrayIteratorIterator extends RecursiveIteratorIterator
{
- private $max_depth;
- private $over = 0;
- private $skip = false;
+ private $max_depth;
+ private $over = 0;
+ private $skip = false;
- function __construct($it, $max_depth)
- {
- $this->max_depth = $max_depth;
- parent::__construct($it);
- }
+ function __construct($it, $max_depth)
+ {
+ $this->max_depth = $max_depth;
+ parent::__construct($it);
+ }
- function rewind()
- {
- echo __METHOD__ . "\n";
- $this->skip = false;
- parent::rewind();
- }
+ function rewind()
+ {
+ echo __METHOD__ . "\n";
+ $this->skip = false;
+ parent::rewind();
+ }
- function valid()
- {
- echo __METHOD__ . "\n";
- if ($this->skip)
- {
- $this->skip = false;
- $this->next();
- }
- return parent::valid();
- }
+ function valid()
+ {
+ echo __METHOD__ . "\n";
+ if ($this->skip)
+ {
+ $this->skip = false;
+ $this->next();
+ }
+ return parent::valid();
+ }
- function current()
- {
- echo __METHOD__ . "\n";
- return parent::current();
- }
+ function current()
+ {
+ echo __METHOD__ . "\n";
+ return parent::current();
+ }
- function key()
- {
- echo __METHOD__ . "\n";
- return parent::key();
- }
+ function key()
+ {
+ echo __METHOD__ . "\n";
+ return parent::key();
+ }
- function next()
- {
- echo __METHOD__ . "\n";
- parent::next();
- }
+ function next()
+ {
+ echo __METHOD__ . "\n";
+ parent::next();
+ }
- function callHasChildren()
- {
- $this->skip = false;
- $has = parent::callHasChildren();
- $res = $this->getDepth() < $this->max_depth && $has;
- echo __METHOD__ . "(".$this->getDepth().") = ".($res?"yes":"no")."/".($has?"yes":"no")."\n";
- if ($has && !$res)
- {
- $this->over++;
- if ($this->over == 2) {
- $this->skip = true;
- }
- }
- return $res;
- }
+ function callHasChildren()
+ {
+ $this->skip = false;
+ $has = parent::callHasChildren();
+ $res = $this->getDepth() < $this->max_depth && $has;
+ echo __METHOD__ . "(".$this->getDepth().") = ".($res?"yes":"no")."/".($has?"yes":"no")."\n";
+ if ($has && !$res)
+ {
+ $this->over++;
+ if ($this->over == 2) {
+ $this->skip = true;
+ }
+ }
+ return $res;
+ }
- function callGetChildren()
- {
- if ($this->over == 2)
- {
- echo __METHOD__ . "(skip)\n";
- return NULL;
- }
- echo __METHOD__ . "(ok:{$this->over})\n";
- return new MyRecursiveArrayIterator($this->current());
- }
+ function callGetChildren()
+ {
+ if ($this->over == 2)
+ {
+ echo __METHOD__ . "(skip)\n";
+ return NULL;
+ }
+ echo __METHOD__ . "(ok:{$this->over})\n";
+ return new MyRecursiveArrayIterator($this->current());
+ }
- function beginChildren()
- {
- echo __METHOD__ . "(".$this->getDepth().")\n";
- }
+ function beginChildren()
+ {
+ echo __METHOD__ . "(".$this->getDepth().")\n";
+ }
- function endChildren()
- {
- echo __METHOD__ . "(".$this->getDepth().")\n";
- }
+ function endChildren()
+ {
+ echo __METHOD__ . "(".$this->getDepth().")\n";
+ }
}
try
{
- foreach(new RecursiveArrayIteratorIterator(new MyRecursiveArrayIterator(array("a", array("ba", array("bba", "bbb"), array(array("bcaa"), array("bcba"))), array("ca"), "d")), 2) as $k=>$v)
- {
- if (is_array($v)) $v = join('',$v);
- echo "$k=>$v\n";
- }
+ foreach(new RecursiveArrayIteratorIterator(new MyRecursiveArrayIterator(array("a", array("ba", array("bba", "bbb"), array(array("bcaa"), array("bcba"))), array("ca"), "d")), 2) as $k=>$v)
+ {
+ if (is_array($v)) $v = join('',$v);
+ echo "$k=>$v\n";
+ }
}
catch(UnexpectedValueException $e)
{
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
RecursiveArrayIteratorIterator::rewind
RecursiveArrayIteratorIterator::callHasChildren(0) = no/no
@@ -183,4 +181,3 @@ RecursiveArrayIteratorIterator::endChildren(1)
RecursiveArrayIteratorIterator::callHasChildren(0) = yes/yes
RecursiveArrayIteratorIterator::callGetChildren(skip)
Objects returned by RecursiveIterator::getChildren() must implement RecursiveIterator
-===DONE===
diff --git a/ext/spl/tests/iterator_023.phpt b/ext/spl/tests/iterator_023.phpt
index c11a7355cf..b75b2bcb7a 100644
--- a/ext/spl/tests/iterator_023.phpt
+++ b/ext/spl/tests/iterator_023.phpt
@@ -5,128 +5,126 @@ SPL: RecursiveIteratorIterator and catch getChildren
class MyRecursiveArrayIterator extends RecursiveArrayIterator
{
- function getChildren()
- {
- echo __METHOD__ . "\n";
- return $this->current();
- }
+ function getChildren()
+ {
+ echo __METHOD__ . "\n";
+ return $this->current();
+ }
- function valid()
- {
- if (!parent::valid())
- {
- echo __METHOD__ . " = false\n";
- return false;
- }
- else
- {
- return true;
- }
- }
+ function valid()
+ {
+ if (!parent::valid())
+ {
+ echo __METHOD__ . " = false\n";
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
}
class RecursiveArrayIteratorIterator extends RecursiveIteratorIterator
{
- private $max_depth;
- private $over = 0;
- private $skip = false;
+ private $max_depth;
+ private $over = 0;
+ private $skip = false;
- function __construct($it, $max_depth)
- {
- $this->max_depth = $max_depth;
- parent::__construct($it, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
- }
+ function __construct($it, $max_depth)
+ {
+ $this->max_depth = $max_depth;
+ parent::__construct($it, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
+ }
- function rewind()
- {
- echo __METHOD__ . "\n";
- $this->skip = false;
- parent::rewind();
- }
+ function rewind()
+ {
+ echo __METHOD__ . "\n";
+ $this->skip = false;
+ parent::rewind();
+ }
- function valid()
- {
- echo __METHOD__ . "\n";
- if ($this->skip)
- {
- $this->skip = false;
- $this->next();
- }
- return parent::valid();
- }
+ function valid()
+ {
+ echo __METHOD__ . "\n";
+ if ($this->skip)
+ {
+ $this->skip = false;
+ $this->next();
+ }
+ return parent::valid();
+ }
- function current()
- {
- echo __METHOD__ . "\n";
- return parent::current();
- }
+ function current()
+ {
+ echo __METHOD__ . "\n";
+ return parent::current();
+ }
- function key()
- {
- echo __METHOD__ . "\n";
- return parent::key();
- }
+ function key()
+ {
+ echo __METHOD__ . "\n";
+ return parent::key();
+ }
- function next()
- {
- echo __METHOD__ . "\n";
- parent::next();
- }
+ function next()
+ {
+ echo __METHOD__ . "\n";
+ parent::next();
+ }
- function callHasChildren()
- {
- $this->skip = false;
- $has = parent::callHasChildren();
- $res = $this->getDepth() < $this->max_depth && $has;
- echo __METHOD__ . "(".$this->getDepth().") = ".($res?"yes":"no")."/".($has?"yes":"no")."\n";
- if ($has && !$res)
- {
- $this->over++;
- if ($this->over == 2) {
- $this->skip = true;
- }
- }
- return $res;
- }
+ function callHasChildren()
+ {
+ $this->skip = false;
+ $has = parent::callHasChildren();
+ $res = $this->getDepth() < $this->max_depth && $has;
+ echo __METHOD__ . "(".$this->getDepth().") = ".($res?"yes":"no")."/".($has?"yes":"no")."\n";
+ if ($has && !$res)
+ {
+ $this->over++;
+ if ($this->over == 2) {
+ $this->skip = true;
+ }
+ }
+ return $res;
+ }
- function callGetChildren()
- {
- if ($this->over == 2)
- {
- echo __METHOD__ . "(throw)\n";
- throw new Exception("Thrown in callGetChildren()");
- }
- echo __METHOD__ . "(ok:{$this->over})\n";
- return new MyRecursiveArrayIterator($this->current());
- }
+ function callGetChildren()
+ {
+ if ($this->over == 2)
+ {
+ echo __METHOD__ . "(throw)\n";
+ throw new Exception("Thrown in callGetChildren()");
+ }
+ echo __METHOD__ . "(ok:{$this->over})\n";
+ return new MyRecursiveArrayIterator($this->current());
+ }
- function beginChildren()
- {
- echo __METHOD__ . "(".$this->getDepth().")\n";
- }
+ function beginChildren()
+ {
+ echo __METHOD__ . "(".$this->getDepth().")\n";
+ }
- function endChildren()
- {
- echo __METHOD__ . "(".$this->getDepth().")\n";
- }
+ function endChildren()
+ {
+ echo __METHOD__ . "(".$this->getDepth().")\n";
+ }
}
try
{
- foreach(new RecursiveArrayIteratorIterator(new MyRecursiveArrayIterator(array("a", array("ba", array("bba", "bbb"), array(array("bcaa"), array("bcba"))), array("ca"), "d")), 2) as $k=>$v)
- {
- if (is_array($v)) $v = join('',$v);
- echo "$k=>$v\n";
- }
+ foreach(new RecursiveArrayIteratorIterator(new MyRecursiveArrayIterator(array("a", array("ba", array("bba", "bbb"), array(array("bcaa"), array("bcba"))), array("ca"), "d")), 2) as $k=>$v)
+ {
+ if (is_array($v)) $v = join('',$v);
+ echo "$k=>$v\n";
+ }
}
catch(UnexpectedValueException $e)
{
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
RecursiveArrayIteratorIterator::rewind
RecursiveArrayIteratorIterator::callHasChildren(0) = no/no
@@ -190,4 +188,3 @@ RecursiveArrayIteratorIterator::next
MyRecursiveArrayIterator::valid = false
RecursiveArrayIteratorIterator::valid
MyRecursiveArrayIterator::valid = false
-===DONE===
diff --git a/ext/spl/tests/iterator_024.phpt b/ext/spl/tests/iterator_024.phpt
index 0c7dea15bc..21f0216d9b 100644
--- a/ext/spl/tests/iterator_024.phpt
+++ b/ext/spl/tests/iterator_024.phpt
@@ -12,11 +12,11 @@ var_dump($it->getIteratorClass());
try
{
- foreach(new RecursiveIteratorIterator(new ArrayObject($ar)) as $v) echo "$v\n";
+ foreach(new RecursiveIteratorIterator(new ArrayObject($ar)) as $v) echo "$v\n";
}
catch (InvalidArgumentException $e)
{
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
echo "===MANUAL===\n";
@@ -27,8 +27,6 @@ foreach(new RecursiveIteratorIterator($it) as $v) echo "$v\n";
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
1
2
@@ -46,4 +44,3 @@ string(22) "RecursiveArrayIterator"
32
331
4
-===DONE===
diff --git a/ext/spl/tests/iterator_025.phpt b/ext/spl/tests/iterator_025.phpt
index 623a4cbcf4..f3df902a64 100644
--- a/ext/spl/tests/iterator_025.phpt
+++ b/ext/spl/tests/iterator_025.phpt
@@ -5,15 +5,15 @@ SPL: RecursiveIteratorIterator and begin/endIteration()
class MyRecursiveIteratorIterator extends RecursiveIteratorIterator
{
- function beginIteration()
- {
- echo __METHOD__ . "()\n";
- }
+ function beginIteration()
+ {
+ echo __METHOD__ . "()\n";
+ }
- function endIteration()
- {
- echo __METHOD__ . "()\n";
- }
+ function endIteration()
+ {
+ echo __METHOD__ . "()\n";
+ }
}
$ar = array(1, 2, array(31, 32, array(331)), 4);
@@ -37,20 +37,18 @@ echo "===MANUAL===\n";
$it->rewind();
while($it->valid())
{
- echo $it->current() . "\n";
- $it->next();
- break;
+ echo $it->current() . "\n";
+ $it->next();
+ break;
}
$it->rewind();
while($it->valid())
{
- echo $it->current() . "\n";
- $it->next();
+ echo $it->current() . "\n";
+ $it->next();
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
MyRecursiveIteratorIterator::beginIteration()
1
@@ -89,4 +87,3 @@ MyRecursiveIteratorIterator::beginIteration()
331
4
MyRecursiveIteratorIterator::endIteration()
-===DONE===
diff --git a/ext/spl/tests/iterator_026.phpt b/ext/spl/tests/iterator_026.phpt
index 8eb77a7baf..1117b65f8a 100644
--- a/ext/spl/tests/iterator_026.phpt
+++ b/ext/spl/tests/iterator_026.phpt
@@ -11,28 +11,25 @@ $it = new RecursiveIteratorIterator($it);
foreach($it as $k=>$v)
{
- echo "$k=>$v\n";
- echo "hasNext: " . ($it->getInnerIterator()->hasNext() ? "yes" : "no") . "\n";
+ echo "$k=>$v\n";
+ echo "hasNext: " . ($it->getInnerIterator()->hasNext() ? "yes" : "no") . "\n";
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
0=>1
hasNext: yes
1=>2
hasNext: yes
-Notice: Array to string conversion in %siterator_026.php on line %d
+Warning: Array to string conversion in %s on line %d
0=>31
hasNext: yes
1=>32
hasNext: yes
-Notice: Array to string conversion in %siterator_026.php on line %d
+Warning: Array to string conversion in %s on line %d
0=>331
hasNext: no
3=>4
hasNext: no
-===DONE===
diff --git a/ext/spl/tests/iterator_027.phpt b/ext/spl/tests/iterator_027.phpt
index fd9ba70c0f..1bd6990493 100644
--- a/ext/spl/tests/iterator_027.phpt
+++ b/ext/spl/tests/iterator_027.phpt
@@ -11,17 +11,17 @@ $it = new CachingIterator($it, CachingIterator::FULL_CACHE);
foreach($it as $k=>$v)
{
- echo "$k=>$v\n";
+ echo "$k=>$v\n";
}
echo "===CHECK===\n";
for ($i = 0; $i < 4; $i++)
{
- if (isset($it[$i]))
- {
- var_dump($i, $it[$i]);
- }
+ if (isset($it[$i]))
+ {
+ var_dump($i, $it[$i]);
+ }
}
$it[2] = 'foo';
@@ -51,8 +51,6 @@ var_dump(isset($it[2])); // unset
var_dump(isset($it[3])); // deleted
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
0=>1
1=>2
@@ -80,4 +78,3 @@ bool(true)
bool(false)
bool(false)
bool(false)
-===DONE===
diff --git a/ext/spl/tests/iterator_028.phpt b/ext/spl/tests/iterator_028.phpt
index 8b53b2123a..5d681ccac0 100644
--- a/ext/spl/tests/iterator_028.phpt
+++ b/ext/spl/tests/iterator_028.phpt
@@ -41,17 +41,15 @@ $it->setMaxDepth(-1);
var_dump($it->getMaxDepth());
try
{
- $it->setMaxDepth(4);
- $it->setMaxDepth(-2);
+ $it->setMaxDepth(4);
+ $it->setMaxDepth(-2);
}
catch(Exception $e)
{
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
var_dump($it->getMaxDepth());
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
===?===
bool(false)
@@ -109,4 +107,3 @@ int(0)
bool(false)
string(33) "Parameter max_depth must be >= -1"
int(4)
-===DONE===
diff --git a/ext/spl/tests/iterator_029.phpt b/ext/spl/tests/iterator_029.phpt
index e5bfde0219..a6f79343c7 100644
--- a/ext/spl/tests/iterator_029.phpt
+++ b/ext/spl/tests/iterator_029.phpt
@@ -7,7 +7,7 @@ $ar = array(0, "123", 123, 22 => "abc", "a2b", 22, "a2d" => 7, 42);
foreach(new RegexIterator(new ArrayIterator($ar), "/2/") as $k => $v)
{
- echo "$k=>$v\n";
+ echo "$k=>$v\n";
}
?>
@@ -16,12 +16,10 @@ foreach(new RegexIterator(new ArrayIterator($ar), "/2/") as $k => $v)
foreach(new RegexIterator(new ArrayIterator($ar), "/2/", 0, RegexIterator::USE_KEY) as $k => $v)
{
- echo "$k=>$v\n";
+ echo "$k=>$v\n";
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
1=>123
2=>123
@@ -35,4 +33,3 @@ foreach(new RegexIterator(new ArrayIterator($ar), "/2/", 0, RegexIterator::USE_K
24=>22
a2d=>7
25=>42
-===DONE===
diff --git a/ext/spl/tests/iterator_030.phpt b/ext/spl/tests/iterator_030.phpt
index 29d147f12b..6a684ec300 100644
--- a/ext/spl/tests/iterator_030.phpt
+++ b/ext/spl/tests/iterator_030.phpt
@@ -13,27 +13,25 @@ var_dump($it->valid());
try
{
- var_dump($it->key());
+ var_dump($it->key());
}
catch(BadMethodCallException $e)
{
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
try
{
- var_dump($it->current());
+ var_dump($it->current());
}
catch(BadMethodCallException $e)
{
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
var_dump($it->valid());
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
bool(false)
bool(false)
@@ -41,4 +39,3 @@ bool(false)
Accessing the key of an EmptyIterator
Accessing the value of an EmptyIterator
bool(false)
-===DONE===
diff --git a/ext/spl/tests/iterator_031.phpt b/ext/spl/tests/iterator_031.phpt
index da91469f08..247e13bfff 100644
--- a/ext/spl/tests/iterator_031.phpt
+++ b/ext/spl/tests/iterator_031.phpt
@@ -5,71 +5,71 @@ SPL: AppendIterator::append() rewinds when necessary
class MyArrayIterator extends ArrayIterator
{
- function rewind()
- {
- echo __METHOD__ . "\n";
- parent::rewind();
- }
+ function rewind()
+ {
+ echo __METHOD__ . "\n";
+ parent::rewind();
+ }
}
$it = new MyArrayIterator(array(1,2));
foreach($it as $k=>$v)
{
- echo "$k=>$v\n";
+ echo "$k=>$v\n";
}
class MyAppendIterator extends AppendIterator
{
- function __construct()
- {
- echo __METHOD__ . "\n";
- }
+ function __construct()
+ {
+ echo __METHOD__ . "\n";
+ }
- function rewind()
- {
- echo __METHOD__ . "\n";
- parent::rewind();
- }
+ function rewind()
+ {
+ echo __METHOD__ . "\n";
+ parent::rewind();
+ }
- function valid()
- {
- echo __METHOD__ . "\n";
- return parent::valid();
- }
+ function valid()
+ {
+ echo __METHOD__ . "\n";
+ return parent::valid();
+ }
- function append(Iterator $what)
- {
- echo __METHOD__ . "\n";
- parent::append($what);
- }
+ function append(Iterator $what)
+ {
+ echo __METHOD__ . "\n";
+ parent::append($what);
+ }
- function parent__construct()
- {
- parent::__construct();
- }
+ function parent__construct()
+ {
+ parent::__construct();
+ }
}
$ap = new MyAppendIterator;
try
{
- $ap->append($it);
+ $ap->append($it);
}
catch(LogicException $e)
{
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
$ap->parent__construct();
try
{
- $ap->parent__construct($it);
+ $ap->parent__construct($it);
}
catch(BadMethodCallException $e)
{
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
$ap->append($it);
@@ -78,12 +78,10 @@ $ap->append($it);
foreach($ap as $k=>$v)
{
- echo "$k=>$v\n";
+ echo "$k=>$v\n";
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
MyArrayIterator::rewind
0=>1
@@ -113,4 +111,3 @@ MyAppendIterator::valid
MyAppendIterator::valid
1=>2
MyAppendIterator::valid
-===DONE===
diff --git a/ext/spl/tests/iterator_032.phpt b/ext/spl/tests/iterator_032.phpt
index 84eb8e61fb..9f56d7574d 100644
--- a/ext/spl/tests/iterator_032.phpt
+++ b/ext/spl/tests/iterator_032.phpt
@@ -7,17 +7,17 @@ $it = new LimitIterator(new ArrayIterator(array(1,2,3,4)), 1, 2);
foreach($it as $k=>$v)
{
- echo "$k=>$v\n";
- var_dump($it->getPosition());
+ echo "$k=>$v\n";
+ var_dump($it->getPosition());
}
try
{
- $it->seek(0);
+ $it->seek(0);
}
catch(OutOfBoundsException $e)
{
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
$it->seek(2);
@@ -25,19 +25,17 @@ var_dump($it->current());
try
{
- $it->seek(3);
+ $it->seek(3);
}
catch(OutOfBoundsException $e)
{
- echo $e->getMessage() . "\n";
+ echo $e->getMessage() . "\n";
}
$it->next();
var_dump($it->valid());
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
1=>2
int(1)
@@ -47,4 +45,3 @@ Cannot seek to 0 which is below the offset 1
int(3)
Cannot seek to 3 which is behind offset 1 plus count 2
bool(false)
-===DONE===
diff --git a/ext/spl/tests/iterator_033.phpt b/ext/spl/tests/iterator_033.phpt
index 548759ccbb..7e1f93a6ee 100644
--- a/ext/spl/tests/iterator_033.phpt
+++ b/ext/spl/tests/iterator_033.phpt
@@ -7,21 +7,19 @@ $it = new ParentIterator(new RecursiveArrayIterator(array(1,array(21,22, array(2
foreach(new RecursiveIteratorIterator($it) as $k=>$v)
{
- var_dump($k);
- var_dump($v);
+ var_dump($k);
+ var_dump($v);
}
echo "==SECOND==\n";
foreach(new RecursiveIteratorIterator($it, 1) as $k=>$v)
{
- var_dump($k);
- var_dump($v);
+ var_dump($k);
+ var_dump($v);
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
==SECOND==
int(1)
@@ -41,4 +39,3 @@ array(1) {
[0]=>
int(231)
}
-===DONE===
diff --git a/ext/spl/tests/iterator_034.phpt b/ext/spl/tests/iterator_034.phpt
index 84b15d4eec..76cc9589ce 100644
--- a/ext/spl/tests/iterator_034.phpt
+++ b/ext/spl/tests/iterator_034.phpt
@@ -5,106 +5,106 @@ SPL: RecursiveIteratorIterator and break deep
class MyRecursiveArrayIterator extends RecursiveArrayIterator
{
- function valid()
- {
- if (!parent::valid())
- {
- echo __METHOD__ . "() = false\n";
- return false;
- }
- else
- {
- return true;
- }
- }
-
- function getChildren()
- {
- echo __METHOD__ . "()\n";
- return parent::getChildren();
- }
-
- function rewind()
- {
- echo __METHOD__ . "()\n";
- parent::rewind();
- }
+ function valid()
+ {
+ if (!parent::valid())
+ {
+ echo __METHOD__ . "() = false\n";
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+
+ function getChildren()
+ {
+ echo __METHOD__ . "()\n";
+ return parent::getChildren();
+ }
+
+ function rewind()
+ {
+ echo __METHOD__ . "()\n";
+ parent::rewind();
+ }
}
class RecursiveArrayIteratorIterator extends RecursiveIteratorIterator
{
- private $max_depth;
- private $over = 0;
-
- function __construct($it, $max_depth)
- {
- $this->max_depth = $max_depth;
- parent::__construct($it);
- }
-
- function rewind()
- {
- echo __METHOD__ . "() - BEGIN\n";
- parent::rewind();
- echo __METHOD__ . "() - DONE\n";
- }
-
- function valid()
- {
- echo __METHOD__ . "()\n";
- return parent::valid();
- }
-
- function current()
- {
- echo __METHOD__ . "()\n";
- return parent::current();
- }
-
- function key()
- {
- echo __METHOD__ . "()\n";
- return parent::key();
- }
-
- function next()
- {
- echo __METHOD__ . "()\n";
- parent::next();
- }
-
- function callHasChildren()
- {
- $has = parent::callHasChildren();
- $res = $this->getDepth() < $this->max_depth && $has;
- echo __METHOD__ . "(".$this->getDepth().") = ".($res?"yes":"no")."/".($has?"yes":"no")."\n";
- return $res;
- }
-
- function beginChildren()
- {
- echo __METHOD__ . "(".$this->getDepth().")\n";
- parent::beginChildren();
- }
-
- function endChildren()
- {
- echo __METHOD__ . "(".$this->getDepth().")\n";
- parent::endChildren();
- }
+ private $max_depth;
+ private $over = 0;
+
+ function __construct($it, $max_depth)
+ {
+ $this->max_depth = $max_depth;
+ parent::__construct($it);
+ }
+
+ function rewind()
+ {
+ echo __METHOD__ . "() - BEGIN\n";
+ parent::rewind();
+ echo __METHOD__ . "() - DONE\n";
+ }
+
+ function valid()
+ {
+ echo __METHOD__ . "()\n";
+ return parent::valid();
+ }
+
+ function current()
+ {
+ echo __METHOD__ . "()\n";
+ return parent::current();
+ }
+
+ function key()
+ {
+ echo __METHOD__ . "()\n";
+ return parent::key();
+ }
+
+ function next()
+ {
+ echo __METHOD__ . "()\n";
+ parent::next();
+ }
+
+ function callHasChildren()
+ {
+ $has = parent::callHasChildren();
+ $res = $this->getDepth() < $this->max_depth && $has;
+ echo __METHOD__ . "(".$this->getDepth().") = ".($res?"yes":"no")."/".($has?"yes":"no")."\n";
+ return $res;
+ }
+
+ function beginChildren()
+ {
+ echo __METHOD__ . "(".$this->getDepth().")\n";
+ parent::beginChildren();
+ }
+
+ function endChildren()
+ {
+ echo __METHOD__ . "(".$this->getDepth().")\n";
+ parent::endChildren();
+ }
}
$p = 0;
$it = new RecursiveArrayIteratorIterator(new MyRecursiveArrayIterator(array("a", array("ba", array("bba", "bbb"), array(array("bcaa"), array("bcba"))), array("ca"), "d")), 2);
foreach($it as $k=>$v)
{
- if (is_array($v)) $v = join('',$v);
- echo "$k=>$v\n";
- if ($p++ == 5)
- {
- echo "===BREAK===\n";
- break;
- }
+ if (is_array($v)) $v = join('',$v);
+ echo "$k=>$v\n";
+ if ($p++ == 5)
+ {
+ echo "===BREAK===\n";
+ break;
+ }
}
echo "===FOREND===\n";
@@ -117,8 +117,6 @@ var_dump($it->valid());
var_dump($it->current() == "a");
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
RecursiveArrayIteratorIterator::rewind() - BEGIN
MyRecursiveArrayIterator::rewind()
@@ -185,4 +183,3 @@ RecursiveArrayIteratorIterator::valid()
bool(true)
RecursiveArrayIteratorIterator::current()
bool(true)
-===DONE===
diff --git a/ext/spl/tests/iterator_036.phpt b/ext/spl/tests/iterator_036.phpt
index 07a1f79134..bfe1825abe 100644
--- a/ext/spl/tests/iterator_036.phpt
+++ b/ext/spl/tests/iterator_036.phpt
@@ -5,10 +5,10 @@ SPL: CachingIterator and __toString and flags = 0
function test($it)
{
- foreach($it as $v)
- {
- var_dump((string)$it);
- }
+ foreach($it as $v)
+ {
+ var_dump((string)$it);
+ }
}
$ar = new ArrayIterator(array(1, 2, 3));
diff --git a/ext/spl/tests/iterator_037.phpt b/ext/spl/tests/iterator_037.phpt
index da8c465ca9..1792b1cb66 100644
--- a/ext/spl/tests/iterator_037.phpt
+++ b/ext/spl/tests/iterator_037.phpt
@@ -5,51 +5,51 @@ SPL: CachingIterator and __toString
function test($ar, $flags)
{
- echo "===$flags===\n";
- $it = new CachingIterator($ar, 0);
- try
- {
- $it->setFlags($flags);
- }
- catch (Exception $e)
- {
- echo 'Exception: ' . $e->getMessage() . "\n";
- var_dump($it->getFlags());
- return;
- }
- var_dump($it->getFlags());
- try
- {
- foreach($it as $v)
- {
- var_dump((string)$it);
- }
- }
- catch (Exception $e)
- {
- echo 'Exception: ' . $e->getMessage() . "\n";
- }
+ echo "===$flags===\n";
+ $it = new CachingIterator($ar, 0);
+ try
+ {
+ $it->setFlags($flags);
+ }
+ catch (Exception $e)
+ {
+ echo 'Exception: ' . $e->getMessage() . "\n";
+ var_dump($it->getFlags());
+ return;
+ }
+ var_dump($it->getFlags());
+ try
+ {
+ foreach($it as $v)
+ {
+ var_dump((string)$it);
+ }
+ }
+ catch (Exception $e)
+ {
+ echo 'Exception: ' . $e->getMessage() . "\n";
+ }
}
class MyItem
{
- function __construct($value)
- {
- $this->value = $value;
- }
+ function __construct($value)
+ {
+ $this->value = $value;
+ }
- function __toString()
- {
- return (string)$this->value;
- }
+ function __toString()
+ {
+ return (string)$this->value;
+ }
}
class MyArrayIterator extends ArrayIterator
{
- function __toString()
- {
- return $this->key() . ':' . $this->current();
- }
+ function __toString()
+ {
+ return $this->key() . ':' . $this->current();
+ }
}
$ar = new MyArrayIterator(array(1, 2, 3));
@@ -70,25 +70,24 @@ test($ar, CachingIterator::TOSTRING_USE_KEY | CachingIterator::TOSTRING_USE_INNE
echo "===X===\n";
try
{
- $it = new CachingIterator($ar, CachingIterator::CALL_TOSTRING);
- $it->setFlags(0);
+ $it = new CachingIterator($ar, CachingIterator::CALL_TOSTRING);
+ $it->setFlags(0);
}
catch (Exception $e)
{
- echo 'Exception: ' . $e->getMessage() . "\n";
+ echo 'Exception: ' . $e->getMessage() . "\n";
}
try
{
- $it = new CachingIterator($ar, CachingIterator::TOSTRING_USE_INNER);
- $it->setFlags(0);
+ $it = new CachingIterator($ar, CachingIterator::TOSTRING_USE_INNER);
+ $it->setFlags(0);
}
catch (Exception $e)
{
- echo 'Exception: ' . $e->getMessage() . "\n";
+ echo 'Exception: ' . $e->getMessage() . "\n";
}
?>
-===DONE===
--EXPECT--
===1===
int(1)
@@ -128,4 +127,3 @@ int(0)
===X===
Exception: Unsetting flag CALL_TO_STRING is not possible
Exception: Unsetting flag TOSTRING_USE_INNER is not possible
-===DONE===
diff --git a/ext/spl/tests/iterator_038.phpt b/ext/spl/tests/iterator_038.phpt
index 9b890e2662..cb4d3a3795 100644
--- a/ext/spl/tests/iterator_038.phpt
+++ b/ext/spl/tests/iterator_038.phpt
@@ -5,15 +5,13 @@ SPL: RoRewindIterator and string keys
foreach(new NoRewindIterator(new ArrayIterator(array('Hello'=>0, 'World'=>1))) as $k => $v)
{
- var_dump($v);
- var_dump($k);
+ var_dump($v);
+ var_dump($k);
}
?>
-===DONE===
--EXPECT--
int(0)
string(5) "Hello"
int(1)
string(5) "World"
-===DONE===
diff --git a/ext/spl/tests/iterator_039.phpt b/ext/spl/tests/iterator_039.phpt
index 17c9bc1ca5..18f9a24168 100644
--- a/ext/spl/tests/iterator_039.phpt
+++ b/ext/spl/tests/iterator_039.phpt
@@ -5,52 +5,52 @@ SPL: LimitIterator and backward seeking
class NumericArrayIterator implements Iterator
{
- protected $a;
- protected $i = 0;
+ protected $a;
+ protected $i = 0;
- public function __construct($a)
- {
- echo __METHOD__ . "\n";
- $this->a = $a;
- }
+ public function __construct($a)
+ {
+ echo __METHOD__ . "\n";
+ $this->a = $a;
+ }
- public function valid()
- {
- echo __METHOD__ . "\n";
- return $this->i < count($this->a);
- }
+ public function valid()
+ {
+ echo __METHOD__ . "\n";
+ return $this->i < count($this->a);
+ }
- public function rewind()
- {
- echo __METHOD__ . "\n";
- $this->i = 0;
- }
+ public function rewind()
+ {
+ echo __METHOD__ . "\n";
+ $this->i = 0;
+ }
- public function key()
- {
- echo __METHOD__ . "\n";
- return $this->i;
- }
+ public function key()
+ {
+ echo __METHOD__ . "\n";
+ return $this->i;
+ }
- public function current()
- {
- echo __METHOD__ . "\n";
- return $this->a[$this->i];
- }
+ public function current()
+ {
+ echo __METHOD__ . "\n";
+ return $this->a[$this->i];
+ }
- public function next()
- {
- echo __METHOD__ . "\n";
- $this->i++;
- }
+ public function next()
+ {
+ echo __METHOD__ . "\n";
+ $this->i++;
+ }
}
$it = new LimitIterator(new NumericArrayIterator(array(12, 25, 42, 56)));
foreach($it as $k => $v)
{
- var_dump($k);
- var_dump($v);
+ var_dump($k);
+ var_dump($v);
}
echo "===SEEK===\n";
@@ -61,13 +61,11 @@ echo "===LOOP===\n";
foreach(new NoRewindIterator($it) as $k => $v)
{
- var_dump($k);
- var_dump($v);
+ var_dump($k);
+ var_dump($v);
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
NumericArrayIterator::__construct
NumericArrayIterator::rewind
@@ -118,4 +116,3 @@ int(3)
int(56)
NumericArrayIterator::next
NumericArrayIterator::valid
-===DONE===
diff --git a/ext/spl/tests/iterator_040.phpt b/ext/spl/tests/iterator_040.phpt
index ae00c81df3..1e8bd55764 100644
--- a/ext/spl/tests/iterator_040.phpt
+++ b/ext/spl/tests/iterator_040.phpt
@@ -5,10 +5,10 @@ SPL: RecursiveFilterIterator
class MyRecursiveFilterIterator extends RecursiveFilterIterator
{
- function accept()
- {
- return true;
- }
+ function accept()
+ {
+ return true;
+ }
}
$ar = array(1, array(21, 22), 3);
@@ -18,15 +18,13 @@ $it = new RecursiveIteratorIterator($it);
foreach($it as $k => $v)
{
- echo "===\n";
- var_dump($it->getDepth());
- var_dump($k);
- var_dump($v);
+ echo "===\n";
+ var_dump($it->getDepth());
+ var_dump($k);
+ var_dump($v);
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
===
int(0)
@@ -44,4 +42,3 @@ int(22)
int(0)
int(2)
int(3)
-===DONE===
diff --git a/ext/spl/tests/iterator_041.phpt b/ext/spl/tests/iterator_041.phpt
index e00ac6bc2b..98892c87e0 100644
--- a/ext/spl/tests/iterator_041.phpt
+++ b/ext/spl/tests/iterator_041.phpt
@@ -5,93 +5,91 @@ SPL: iterator_to_array() and exceptions
class MyArrayIterator extends ArrayIterator
{
- static protected $fail = 0;
- public $state;
+ static protected $fail = 0;
+ public $state;
- static function fail($state, $method)
- {
- if (self::$fail == $state)
- {
- throw new Exception("State $state: $method()");
- }
- }
+ static function fail($state, $method)
+ {
+ if (self::$fail == $state)
+ {
+ throw new Exception("State $state: $method()");
+ }
+ }
- function __construct()
- {
- $this->state = MyArrayIterator::$fail;
- self::fail(0, __FUNCTION__);
- parent::__construct(array(1, 2));
- self::fail(1, __FUNCTION__);
- }
+ function __construct()
+ {
+ $this->state = MyArrayIterator::$fail;
+ self::fail(0, __FUNCTION__);
+ parent::__construct(array(1, 2));
+ self::fail(1, __FUNCTION__);
+ }
- function rewind()
- {
- self::fail(2, __FUNCTION__);
- return parent::rewind();
- }
+ function rewind()
+ {
+ self::fail(2, __FUNCTION__);
+ return parent::rewind();
+ }
- function valid()
- {
- self::fail(3, __FUNCTION__);
- return parent::valid();
- }
+ function valid()
+ {
+ self::fail(3, __FUNCTION__);
+ return parent::valid();
+ }
- function current()
- {
- self::fail(4, __FUNCTION__);
- return parent::current();
- }
+ function current()
+ {
+ self::fail(4, __FUNCTION__);
+ return parent::current();
+ }
- function key()
- {
- self::fail(5, __FUNCTION__);
- return parent::key();
- }
+ function key()
+ {
+ self::fail(5, __FUNCTION__);
+ return parent::key();
+ }
- function next()
- {
- self::fail(6, __FUNCTION__);
- return parent::next();
- }
+ function next()
+ {
+ self::fail(6, __FUNCTION__);
+ return parent::next();
+ }
- function __destruct()
- {
+ function __destruct()
+ {
// self::fail(7, __FUNCTION__);
- }
+ }
- static function test($func, $skip = null)
- {
- echo "===$func===\n";
- self::$fail = 0;
- while(self::$fail < 10)
- {
- try
- {
- var_dump($func(new MyArrayIterator()));
- break;
- }
- catch (Exception $e)
- {
- echo $e->getMessage() . "\n";
- }
- if (isset($skip[self::$fail]))
- {
- self::$fail = $skip[self::$fail];
- }
- else
- {
- self::$fail++;
- }
- }
- }
+ static function test($func, $skip = null)
+ {
+ echo "===$func===\n";
+ self::$fail = 0;
+ while(self::$fail < 10)
+ {
+ try
+ {
+ var_dump($func(new MyArrayIterator()));
+ break;
+ }
+ catch (Exception $e)
+ {
+ echo $e->getMessage() . "\n";
+ }
+ if (isset($skip[self::$fail]))
+ {
+ self::$fail = $skip[self::$fail];
+ }
+ else
+ {
+ self::$fail++;
+ }
+ }
+ }
}
MyArrayIterator::test('iterator_to_array');
MyArrayIterator::test('iterator_count', array(3 => 6));
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
===iterator_to_array===
State 0: __construct()
@@ -114,4 +112,3 @@ State 2: rewind()
State 3: valid()
State 6: next()
int(2)
-===DONE===
diff --git a/ext/spl/tests/iterator_041a.phpt b/ext/spl/tests/iterator_041a.phpt
index ec999a5dae..37b4341297 100644
--- a/ext/spl/tests/iterator_041a.phpt
+++ b/ext/spl/tests/iterator_041a.phpt
@@ -5,93 +5,91 @@ SPL: iterator_to_array() and exceptions from destruct
class MyArrayIterator extends ArrayIterator
{
- static protected $fail = 0;
- public $state;
+ static protected $fail = 0;
+ public $state;
- static function fail($state, $method)
- {
- if (self::$fail == $state)
- {
- throw new Exception("State $state: $method()");
- }
- }
+ static function fail($state, $method)
+ {
+ if (self::$fail == $state)
+ {
+ throw new Exception("State $state: $method()");
+ }
+ }
- function __construct()
- {
- $this->state = MyArrayIterator::$fail;
- self::fail(0, __FUNCTION__);
- parent::__construct(array(1, 2));
- self::fail(1, __FUNCTION__);
- }
+ function __construct()
+ {
+ $this->state = MyArrayIterator::$fail;
+ self::fail(0, __FUNCTION__);
+ parent::__construct(array(1, 2));
+ self::fail(1, __FUNCTION__);
+ }
- function rewind()
- {
- self::fail(2, __FUNCTION__);
- return parent::rewind();
- }
+ function rewind()
+ {
+ self::fail(2, __FUNCTION__);
+ return parent::rewind();
+ }
- function valid()
- {
- self::fail(3, __FUNCTION__);
- return parent::valid();
- }
+ function valid()
+ {
+ self::fail(3, __FUNCTION__);
+ return parent::valid();
+ }
- function current()
- {
- self::fail(4, __FUNCTION__);
- return parent::current();
- }
+ function current()
+ {
+ self::fail(4, __FUNCTION__);
+ return parent::current();
+ }
- function key()
- {
- self::fail(5, __FUNCTION__);
- return parent::key();
- }
+ function key()
+ {
+ self::fail(5, __FUNCTION__);
+ return parent::key();
+ }
- function next()
- {
- self::fail(6, __FUNCTION__);
- return parent::next();
- }
+ function next()
+ {
+ self::fail(6, __FUNCTION__);
+ return parent::next();
+ }
- function __destruct()
- {
- self::fail(7, __FUNCTION__);
- }
+ function __destruct()
+ {
+ self::fail(7, __FUNCTION__);
+ }
- static function test($func, $skip = null)
- {
- echo "===$func===\n";
- self::$fail = 7;
- while(self::$fail < 10)
- {
- try
- {
- var_dump($func(new MyArrayIterator()));
- break;
- }
- catch (Exception $e)
- {
- echo $e->getMessage() . "\n";
- }
- if (isset($skip[self::$fail]))
- {
- self::$fail = $skip[self::$fail];
- }
- else
- {
- self::$fail++;
- }
- }
- }
+ static function test($func, $skip = null)
+ {
+ echo "===$func===\n";
+ self::$fail = 7;
+ while(self::$fail < 10)
+ {
+ try
+ {
+ var_dump($func(new MyArrayIterator()));
+ break;
+ }
+ catch (Exception $e)
+ {
+ echo $e->getMessage() . "\n";
+ }
+ if (isset($skip[self::$fail]))
+ {
+ self::$fail = $skip[self::$fail];
+ }
+ else
+ {
+ self::$fail++;
+ }
+ }
+ }
}
MyArrayIterator::test('iterator_to_array');
MyArrayIterator::test('iterator_count', array(3 => 6));
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
===iterator_to_array===
State 7: __destruct()
@@ -104,4 +102,3 @@ array(2) {
===iterator_count===
State 7: __destruct()
int(2)
-===DONE===
diff --git a/ext/spl/tests/iterator_041b.phpt b/ext/spl/tests/iterator_041b.phpt
index 8f55ade319..517b8fc5e4 100644
--- a/ext/spl/tests/iterator_041b.phpt
+++ b/ext/spl/tests/iterator_041b.phpt
@@ -5,97 +5,95 @@ SPL: iterator_to_array() and exceptions from delayed destruct
class MyArrayIterator extends ArrayIterator
{
- static protected $fail = 0;
- public $state;
+ static protected $fail = 0;
+ public $state;
- static function fail($state, $method)
- {
- if (self::$fail == $state)
- {
- throw new Exception("State $state: $method()");
- }
- }
+ static function fail($state, $method)
+ {
+ if (self::$fail == $state)
+ {
+ throw new Exception("State $state: $method()");
+ }
+ }
- function __construct()
- {
- $this->state = MyArrayIterator::$fail;
- self::fail(0, __FUNCTION__);
- parent::__construct(array(1, 2));
- self::fail(1, __FUNCTION__);
- }
+ function __construct()
+ {
+ $this->state = MyArrayIterator::$fail;
+ self::fail(0, __FUNCTION__);
+ parent::__construct(array(1, 2));
+ self::fail(1, __FUNCTION__);
+ }
- function rewind()
- {
- self::fail(2, __FUNCTION__);
- return parent::rewind();
- }
+ function rewind()
+ {
+ self::fail(2, __FUNCTION__);
+ return parent::rewind();
+ }
- function valid()
- {
- self::fail(3, __FUNCTION__);
- return parent::valid();
- }
+ function valid()
+ {
+ self::fail(3, __FUNCTION__);
+ return parent::valid();
+ }
- function current()
- {
- self::fail(4, __FUNCTION__);
- return parent::current();
- }
+ function current()
+ {
+ self::fail(4, __FUNCTION__);
+ return parent::current();
+ }
- function key()
- {
- self::fail(5, __FUNCTION__);
- return parent::key();
- }
+ function key()
+ {
+ self::fail(5, __FUNCTION__);
+ return parent::key();
+ }
- function next()
- {
- self::fail(6, __FUNCTION__);
- return parent::next();
- }
+ function next()
+ {
+ self::fail(6, __FUNCTION__);
+ return parent::next();
+ }
- function __destruct()
- {
- self::fail(7, __FUNCTION__);
- }
+ function __destruct()
+ {
+ self::fail(7, __FUNCTION__);
+ }
- static function test($func, $skip = null)
- {
- echo "===$func===\n";
- self::$fail = 0;
- while(self::$fail < 10)
- {
- try
- {
- var_dump($func(new MyArrayIterator()));
- break;
- }
- catch (Exception $e)
- {
- echo $e->getMessage() . "\n";
- }
- if (isset($skip[self::$fail]))
- {
- self::$fail = $skip[self::$fail];
- }
- else
- {
- self::$fail++;
- }
- try {
- $e = null;
- } catch (Exception $e) {
- }
- }
- }
+ static function test($func, $skip = null)
+ {
+ echo "===$func===\n";
+ self::$fail = 0;
+ while(self::$fail < 10)
+ {
+ try
+ {
+ var_dump($func(new MyArrayIterator()));
+ break;
+ }
+ catch (Exception $e)
+ {
+ echo $e->getMessage() . "\n";
+ }
+ if (isset($skip[self::$fail]))
+ {
+ self::$fail = $skip[self::$fail];
+ }
+ else
+ {
+ self::$fail++;
+ }
+ try {
+ $e = null;
+ } catch (Exception $e) {
+ }
+ }
+ }
}
MyArrayIterator::test('iterator_to_array');
MyArrayIterator::test('iterator_count', array(3 => 6));
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
===iterator_to_array===
State 0: __construct()
@@ -120,4 +118,3 @@ State 3: valid()
State 6: next()
State 7: __destruct()
int(2)
-===DONE===
diff --git a/ext/spl/tests/iterator_042.phpt b/ext/spl/tests/iterator_042.phpt
index a344d60e33..2c14fc3d40 100644
--- a/ext/spl/tests/iterator_042.phpt
+++ b/ext/spl/tests/iterator_042.phpt
@@ -5,8 +5,8 @@ SPL: AppendIterator and its ArrayIterator
function test_error_handler($errno, $msg, $filename, $linenum)
{
- echo "Error $msg in $filename on line $linenum\n";
- return true;
+ echo "Error $msg in $filename on line $linenum\n";
+ return true;
}
set_error_handler('test_error_handler');
@@ -14,9 +14,9 @@ set_error_handler('test_error_handler');
$it = new AppendIterator;
try {
- $it->append(array());
+ $it->append(array());
} catch (Error $e) {
- test_error_handler($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
+ test_error_handler($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
}
$it->append(new ArrayIterator(array(1)));
$it->append(new ArrayIterator(array(21, 22)));
@@ -31,17 +31,15 @@ $idx = 0;
foreach($it as $k => $v)
{
- echo '===' . $idx++ . "===\n";
- var_dump($it->getIteratorIndex());
- var_dump($k);
- var_dump($v);
+ echo '===' . $idx++ . "===\n";
+ var_dump($it->getIteratorIndex());
+ var_dump($k);
+ var_dump($v);
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
-Error Argument 1 passed to AppendIterator::append() must implement interface Iterator, array given in %siterator_042.php on line %d
+Error AppendIterator::append() expects parameter 1 to be Iterator, array given in %s on line %d
object(ArrayIterator)#%d (1) {
%s"storage"%s"ArrayIterator":private]=>
array(2) {
@@ -124,4 +122,3 @@ int(32)
int(2)
int(2)
int(33)
-===DONE===
diff --git a/ext/spl/tests/iterator_043.phpt b/ext/spl/tests/iterator_043.phpt
index 6dbbfdd97b..2ee75a1080 100644
--- a/ext/spl/tests/iterator_043.phpt
+++ b/ext/spl/tests/iterator_043.phpt
@@ -10,9 +10,6 @@ $it->rewind();
var_dump($it->getChildren());
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
NULL
NULL
-===DONE===
diff --git a/ext/spl/tests/iterator_044.phpt b/ext/spl/tests/iterator_044.phpt
index 1271ccaa64..89d8bef772 100644
--- a/ext/spl/tests/iterator_044.phpt
+++ b/ext/spl/tests/iterator_044.phpt
@@ -5,56 +5,61 @@ SPL: CachingIterator and offsetGet/Exists using flag FULL_CACHE
class MyFoo
{
- function __toString()
- {
- return 'foo';
- }
+ function __toString()
+ {
+ return 'foo';
+ }
}
class MyCachingIterator extends CachingIterator
{
- function __construct(Iterator $it, $flags = 0)
- {
- parent::__construct($it, $flags);
- }
-
- function test($ar)
- {
- foreach($ar as $k => $v)
- {
- echo "===$k===\n";
- var_dump($v);
- var_dump($this->offsetExists($v));
- var_dump($this->offsetGet($v));
- }
- }
+ function __construct(Iterator $it, $flags = 0)
+ {
+ parent::__construct($it, $flags);
+ }
+
+ function test($ar)
+ {
+ foreach($ar as $k => $v)
+ {
+ echo "===$k===\n";
+ var_dump($v);
+ try {
+ var_dump($this->offsetExists($v));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ try {
+ var_dump($this->offsetGet($v));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ }
+ }
}
$it = new MyCachingIterator(new ArrayIterator(array(0, 'foo'=>1, 2, 'bar'=>3, 4)));
try
{
- var_dump($it->offsetExists(0));
+ var_dump($it->offsetExists(0));
}
catch(Exception $e)
{
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
try
{
- var_dump($it->offsetGet(0));
+ var_dump($it->offsetGet(0));
}
catch(Exception $e)
{
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
$it = new MyCachingIterator(new ArrayIterator(array(0, 'foo'=>1, 2, 'bar'=>3, 4)), CachingIterator::FULL_CACHE);
-var_dump($it->offsetExists());
-var_dump($it->offsetGet());
-
$checks = array(0, new stdClass, new MyFoo, NULL, 2, 'foo', 3);
$it->test($checks);
@@ -66,17 +71,9 @@ foreach($it as $v); // read all into cache
$it->test($checks);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Exception: MyCachingIterator does not use a full cache (see CachingIterator::__construct)
Exception: MyCachingIterator does not use a full cache (see CachingIterator::__construct)
-
-Warning: CachingIterator::offsetExists() expects exactly 1 parameter, 0 given in %siterator_044.php on line %d
-NULL
-
-Warning: CachingIterator::offsetGet() expects exactly 1 parameter, 0 given in %siterator_044.php on line %d
-NULL
===0===
int(0)
bool(false)
@@ -86,12 +83,8 @@ NULL
===1===
object(stdClass)#%d (0) {
}
-
-Warning: CachingIterator::offsetExists() expects parameter 1 to be string, object given in %siterator_044.php on line %d
-NULL
-
-Warning: CachingIterator::offsetGet() expects parameter 1 to be string, object given in %siterator_044.php on line %d
-NULL
+CachingIterator::offsetExists() expects parameter 1 to be string, object given
+CachingIterator::offsetGet() expects parameter 1 to be string, object given
===2===
object(MyFoo)#%d (0) {
}
@@ -131,12 +124,8 @@ int(0)
===1===
object(stdClass)#1 (0) {
}
-
-Warning: CachingIterator::offsetExists() expects parameter 1 to be string, object given in %siterator_044.php on line %d
-NULL
-
-Warning: CachingIterator::offsetGet() expects parameter 1 to be string, object given in %siterator_044.php on line %d
-NULL
+CachingIterator::offsetExists() expects parameter 1 to be string, object given
+CachingIterator::offsetGet() expects parameter 1 to be string, object given
===2===
object(MyFoo)#2 (0) {
}
@@ -162,4 +151,3 @@ bool(false)
Notice: Undefined index: 3 in %siterator_044.php on line %d
NULL
-===DONE===
diff --git a/ext/spl/tests/iterator_045.phpt b/ext/spl/tests/iterator_045.phpt
index c8ffae77a5..63d78cc78e 100644
--- a/ext/spl/tests/iterator_045.phpt
+++ b/ext/spl/tests/iterator_045.phpt
@@ -5,78 +5,74 @@ SPL: CachingIterator and offsetSet/Unset, getCache using flag FULL_CACHE
class MyFoo
{
- function __toString()
- {
- return 'foo';
- }
+ function __toString()
+ {
+ return 'foo';
+ }
}
class MyCachingIterator extends CachingIterator
{
- function __construct(Iterator $it, $flags = 0)
- {
- parent::__construct($it, $flags);
- }
-
- function testSet($ar)
- {
- echo __METHOD__ . "()\n";
- foreach($ar as $k => $v)
- {
- echo "set($k,$v)\n";
- $this->offsetSet($k, $v);
- }
- }
-
- function testUnset($ar)
- {
- echo __METHOD__ . "()\n";
- foreach($ar as $k => $v)
- {
- echo "unset($v)\n";
- $this->offsetUnset($v);
- }
- }
-
- function fill()
- {
- echo __METHOD__ . "()\n";
- foreach($this as $v) ;
- }
-
- function show()
- {
- echo __METHOD__ . "()\n";
- var_dump($this->getCache());
- }
+ function __construct(Iterator $it, $flags = 0)
+ {
+ parent::__construct($it, $flags);
+ }
+
+ function testSet($ar)
+ {
+ echo __METHOD__ . "()\n";
+ foreach($ar as $k => $v)
+ {
+ echo "set($k,$v)\n";
+ $this->offsetSet($k, $v);
+ }
+ }
+
+ function testUnset($ar)
+ {
+ echo __METHOD__ . "()\n";
+ foreach($ar as $k => $v)
+ {
+ echo "unset($v)\n";
+ $this->offsetUnset($v);
+ }
+ }
+
+ function fill()
+ {
+ echo __METHOD__ . "()\n";
+ foreach($this as $v) ;
+ }
+
+ function show()
+ {
+ echo __METHOD__ . "()\n";
+ var_dump($this->getCache());
+ }
}
$it = new MyCachingIterator(new ArrayIterator(array(0, 'foo'=>1, 2, 'bar'=>3, 4)));
try
{
- var_dump($it->offsetSet(0, 0));
+ var_dump($it->offsetSet(0, 0));
}
catch(Exception $e)
{
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
try
{
- var_dump($it->offsetUnset(0));
+ var_dump($it->offsetUnset(0));
}
catch(Exception $e)
{
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
$it = new MyCachingIterator(new ArrayIterator(array(0, 1, 2, 3)), CachingIterator::FULL_CACHE);
-var_dump($it->offsetSet());
-var_dump($it->offsetSet(0));
-var_dump($it->offsetUnset());
-
$checks = array(0 => 25, 1 => 42, 3 => 'FooBar');
$unsets = array(0, 2);
@@ -92,20 +88,9 @@ $it->testUnset($unsets);
$it->show();
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Exception: MyCachingIterator does not use a full cache (see CachingIterator::__construct)
Exception: MyCachingIterator does not use a full cache (see CachingIterator::__construct)
-
-Warning: CachingIterator::offsetSet() expects exactly 2 parameters, 0 given in %siterator_045.php on line %d
-NULL
-
-Warning: CachingIterator::offsetSet() expects exactly 2 parameters, 1 given in %siterator_045.php on line %d
-NULL
-
-Warning: CachingIterator::offsetUnset() expects exactly 1 parameter, 0 given in %siterator_045.php on line %d
-NULL
MyCachingIterator::testSet()
set(0,25)
set(1,42)
@@ -166,4 +151,3 @@ array(2) {
[3]=>
string(6) "FooBar"
}
-===DONE===
diff --git a/ext/spl/tests/iterator_046.phpt b/ext/spl/tests/iterator_046.phpt
index b31e3bc533..e377dcb731 100644
--- a/ext/spl/tests/iterator_046.phpt
+++ b/ext/spl/tests/iterator_046.phpt
@@ -5,33 +5,33 @@ SPL: CachingIterator and __toString using bypassed string keys
class MyFoo
{
- function __toString()
- {
- return 'foo';
- }
+ function __toString()
+ {
+ return 'foo';
+ }
}
class MyCachingIterator extends CachingIterator
{
- function __construct(Iterator $it, $flags = 0)
- {
- parent::__construct($it, $flags);
- }
+ function __construct(Iterator $it, $flags = 0)
+ {
+ parent::__construct($it, $flags);
+ }
- function fill()
- {
- echo __METHOD__ . "()\n";
- foreach($this as $v) ;
- }
+ function fill()
+ {
+ echo __METHOD__ . "()\n";
+ foreach($this as $v) ;
+ }
- function show()
- {
- echo __METHOD__ . "()\n";
- foreach($this as $v)
- {
- var_dump((string)$this);
- }
- }
+ function show()
+ {
+ echo __METHOD__ . "()\n";
+ foreach($this as $v)
+ {
+ var_dump((string)$this);
+ }
+ }
}
$it = new MyCachingIterator(new ArrayIterator(array(0, 'foo'=>1, 'bar'=>2)), CachingIterator::TOSTRING_USE_KEY);
@@ -40,12 +40,9 @@ $it->fill();
$it->show();
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
MyCachingIterator::fill()
MyCachingIterator::show()
string(1) "0"
string(3) "foo"
string(3) "bar"
-===DONE===
diff --git a/ext/spl/tests/iterator_047.phpt b/ext/spl/tests/iterator_047.phpt
index 548f486528..9d7586bf4e 100644
--- a/ext/spl/tests/iterator_047.phpt
+++ b/ext/spl/tests/iterator_047.phpt
@@ -5,54 +5,54 @@ SPL: RecursiveCachingIterator and exception in has/getChildren
class MyRecursiveArrayIterator extends RecursiveArrayIterator
{
- static public $fail = 0;
+ static public $fail = 0;
- static function fail($state, $method)
- {
- if (self::$fail == $state)
- {
- throw new Exception("State $state: $method()");
- }
- }
+ static function fail($state, $method)
+ {
+ if (self::$fail == $state)
+ {
+ throw new Exception("State $state: $method()");
+ }
+ }
- function hasChildren()
- {
- echo __METHOD__ . "()\n";
- self::fail(1, __METHOD__);
- return parent::hasChildren();
- }
+ function hasChildren()
+ {
+ echo __METHOD__ . "()\n";
+ self::fail(1, __METHOD__);
+ return parent::hasChildren();
+ }
- function getChildren()
- {
- echo __METHOD__ . "()\n";
- self::fail(2, __METHOD__);
- return parent::getChildren();
- }
+ function getChildren()
+ {
+ echo __METHOD__ . "()\n";
+ self::fail(2, __METHOD__);
+ return parent::getChildren();
+ }
}
class MyRecursiveCachingIterator extends RecursiveCachingIterator
{
- function show()
- {
- MyRecursiveArrayIterator::$fail = 0;
- while(MyRecursiveArrayIterator::$fail < 4)
- {
- echo "===" . MyRecursiveArrayIterator::$fail . "===\n";
- try
- {
- foreach(new RecursiveIteratorIterator($this) as $k => $v)
- {
- var_dump($k);
- var_dump($v);
- }
- }
- catch (Exception $e)
- {
- echo "Exception: " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine() . "\n";
- }
- MyRecursiveArrayIterator::$fail++;
- }
- }
+ function show()
+ {
+ MyRecursiveArrayIterator::$fail = 0;
+ while(MyRecursiveArrayIterator::$fail < 4)
+ {
+ echo "===" . MyRecursiveArrayIterator::$fail . "===\n";
+ try
+ {
+ foreach(new RecursiveIteratorIterator($this) as $k => $v)
+ {
+ var_dump($k);
+ var_dump($v);
+ }
+ }
+ catch (Exception $e)
+ {
+ echo "Exception: " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine() . "\n";
+ }
+ MyRecursiveArrayIterator::$fail++;
+ }
+ }
}
$it = new MyRecursiveArrayIterator(array(0, array(10), 2, array(30), 4));
@@ -61,8 +61,6 @@ $it = new MyRecursiveCachingIterator($it);
$it->show();
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
===0===
MyRecursiveArrayIterator::hasChildren()
@@ -71,7 +69,7 @@ int(0)
MyRecursiveArrayIterator::hasChildren()
MyRecursiveArrayIterator::getChildren()
-Notice: Array to string conversion in %siterator_047.php on line %d
+Warning: Array to string conversion in %s on line %d
MyRecursiveArrayIterator::hasChildren()
int(0)
int(10)
@@ -81,7 +79,7 @@ int(2)
MyRecursiveArrayIterator::hasChildren()
MyRecursiveArrayIterator::getChildren()
-Notice: Array to string conversion in %siterator_047.php on line %d
+Warning: Array to string conversion in %s on line %d
MyRecursiveArrayIterator::hasChildren()
int(0)
int(30)
@@ -105,7 +103,7 @@ int(0)
MyRecursiveArrayIterator::hasChildren()
MyRecursiveArrayIterator::getChildren()
-Notice: Array to string conversion in %siterator_047.php on line %d
+Warning: Array to string conversion in %s on line %d
MyRecursiveArrayIterator::hasChildren()
int(0)
int(10)
@@ -115,11 +113,10 @@ int(2)
MyRecursiveArrayIterator::hasChildren()
MyRecursiveArrayIterator::getChildren()
-Notice: Array to string conversion in %siterator_047.php on line %d
+Warning: Array to string conversion in %s on line %d
MyRecursiveArrayIterator::hasChildren()
int(0)
int(30)
MyRecursiveArrayIterator::hasChildren()
int(4)
int(4)
-===DONE===
diff --git a/ext/spl/tests/iterator_048.phpt b/ext/spl/tests/iterator_048.phpt
index de13e5b6b2..ce5a06993a 100644
--- a/ext/spl/tests/iterator_048.phpt
+++ b/ext/spl/tests/iterator_048.phpt
@@ -5,14 +5,14 @@ SPL: RecursiveRegexIterator and exception in has/getChildren
class MyRecursiveRegexIterator extends RecursiveRegexIterator
{
- function show()
- {
- foreach(new RecursiveIteratorIterator($this) as $k => $v)
- {
- var_dump($k);
- var_dump($v);
- }
- }
+ function show()
+ {
+ foreach(new RecursiveIteratorIterator($this) as $k => $v)
+ {
+ var_dump($k);
+ var_dump($v);
+ }
+ }
}
$ar = new RecursiveArrayIterator(array('Foo', array('Bar'), 'FooBar', array('Baz'), 'Biz'));
@@ -21,11 +21,8 @@ $it = new MyRecursiveRegexIterator($ar, '/Bar/');
$it->show();
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
int(0)
string(3) "Bar"
int(2)
string(6) "FooBar"
-===DONE===
diff --git a/ext/spl/tests/iterator_049.phpt b/ext/spl/tests/iterator_049.phpt
index b9ab2c30ac..e9b81fbff3 100644
--- a/ext/spl/tests/iterator_049.phpt
+++ b/ext/spl/tests/iterator_049.phpt
@@ -8,8 +8,6 @@ $ar = new ArrayIterator(array(NULL=>NULL));
var_dump($ar->getArrayCopy());
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
object(ArrayIterator)#%d (1) {
["storage":"ArrayIterator":private]=>
@@ -22,4 +20,3 @@ array(1) {
[""]=>
NULL
}
-===DONE===
diff --git a/ext/spl/tests/iterator_049b.phpt b/ext/spl/tests/iterator_049b.phpt
index 5175f41c0c..54a2c2e040 100644
--- a/ext/spl/tests/iterator_049b.phpt
+++ b/ext/spl/tests/iterator_049b.phpt
Binary files differ
diff --git a/ext/spl/tests/iterator_050.phpt b/ext/spl/tests/iterator_050.phpt
index 63d8fbfa9a..dd8ad544b8 100644
--- a/ext/spl/tests/iterator_050.phpt
+++ b/ext/spl/tests/iterator_050.phpt
@@ -5,14 +5,14 @@ SPL: RegexIterator::GET_MATCH
class MyRegexIterator extends RegexIterator
{
- function show()
- {
- foreach($this as $k => $v)
- {
- var_dump($k);
- var_dump($v);
- }
- }
+ function show()
+ {
+ foreach($this as $k => $v)
+ {
+ var_dump($k);
+ var_dump($v);
+ }
+ }
}
$ar = new ArrayIterator(array('1','1,2','1,2,3','',NULL,array(),'FooBar',',',',,'));
@@ -25,8 +25,6 @@ $it->show();
var_dump($ar);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
int(1)
array(3) {
@@ -91,4 +89,3 @@ object(ArrayIterator)#%d (1) {
%s(2) ",,"
}
}
-===DONE===
diff --git a/ext/spl/tests/iterator_051.phpt b/ext/spl/tests/iterator_051.phpt
index 2d198db520..8b3c6563d1 100644
--- a/ext/spl/tests/iterator_051.phpt
+++ b/ext/spl/tests/iterator_051.phpt
@@ -5,14 +5,14 @@ SPL: RegexIterator::GET_MATCH, USE_KEY
class MyRegexIterator extends RegexIterator
{
- function show()
- {
- foreach($this as $k => $v)
- {
- var_dump($k);
- var_dump($v);
- }
- }
+ function show()
+ {
+ foreach($this as $k => $v)
+ {
+ var_dump($k);
+ var_dump($v);
+ }
+ }
}
$ar = new ArrayIterator(array('1'=>0,'1,2'=>1,'1,2,3'=>2,0=>3,'FooBar'=>4,','=>5,',,'=>6));
@@ -25,8 +25,6 @@ $it->show();
var_dump($ar);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
string(3) "1,2"
array(3) {
@@ -93,4 +91,3 @@ object(ArrayIterator)#%d (1) {
int(6)
}
}
-===DONE===
diff --git a/ext/spl/tests/iterator_052.phpt b/ext/spl/tests/iterator_052.phpt
index 4c8191fab7..e73d40203d 100644
--- a/ext/spl/tests/iterator_052.phpt
+++ b/ext/spl/tests/iterator_052.phpt
@@ -5,31 +5,31 @@ SPL: RegexIterator::ALL_MATCHES
class MyRegexIterator extends RegexIterator
{
- public $uk, $re;
+ public $uk, $re;
- function __construct($it, $re, $mode, $flags = 0)
- {
- $this->uk = $flags & self::USE_KEY;
- $this->re = $re;
- parent::__construct($it, $re, $mode, $flags);
- }
+ function __construct($it, $re, $mode, $flags = 0)
+ {
+ $this->uk = $flags & self::USE_KEY;
+ $this->re = $re;
+ parent::__construct($it, $re, $mode, $flags);
+ }
- function show()
- {
- foreach($this as $k => $v)
- {
- var_dump($k);
- var_dump($v);
- }
- }
+ function show()
+ {
+ foreach($this as $k => $v)
+ {
+ var_dump($k);
+ var_dump($v);
+ }
+ }
- function accept()
- {
- @preg_match_all($this->re, (string)($this->uk ? $this->key() : $this->current()), $sub);
- $ret = parent::accept();
- var_dump($sub == $this->current());
- return $ret;
- }
+ function accept()
+ {
+ @preg_match_all($this->re, (string)($this->uk ? $this->key() : $this->current()), $sub);
+ $ret = parent::accept();
+ var_dump($sub == $this->current());
+ return $ret;
+ }
}
$ar = new ArrayIterator(array('1','1,2','1,2,3','',NULL,array(),'FooBar',',',',,'));
@@ -42,8 +42,6 @@ $it->show();
var_dump($ar);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
bool(true)
bool(true)
@@ -174,4 +172,3 @@ object(ArrayIterator)#%d (1) {
%s(2) ",,"
}
}
-===DONE===
diff --git a/ext/spl/tests/iterator_053.phpt b/ext/spl/tests/iterator_053.phpt
index fb8e1e5f14..ac8f438a04 100644
--- a/ext/spl/tests/iterator_053.phpt
+++ b/ext/spl/tests/iterator_053.phpt
@@ -5,31 +5,31 @@ SPL: RegexIterator::ALL_MATCHES
class MyRegexIterator extends RegexIterator
{
- public $uk, $re;
+ public $uk, $re;
- function __construct($it, $re, $mode, $flags = 0)
- {
- $this->uk = $flags & self::USE_KEY;
- $this->re = $re;
- parent::__construct($it, $re, $mode, $flags);
- }
+ function __construct($it, $re, $mode, $flags = 0)
+ {
+ $this->uk = $flags & self::USE_KEY;
+ $this->re = $re;
+ parent::__construct($it, $re, $mode, $flags);
+ }
- function show()
- {
- foreach($this as $k => $v)
- {
- var_dump($k);
- var_dump($v);
- }
- }
+ function show()
+ {
+ foreach($this as $k => $v)
+ {
+ var_dump($k);
+ var_dump($v);
+ }
+ }
- function accept()
- {
- @preg_match_all($this->re, (string)($this->uk ? $this->key() : $this->current()), $sub);
- $ret = parent::accept();
- var_dump($sub == $this->current());
- return $ret;
- }
+ function accept()
+ {
+ @preg_match_all($this->re, (string)($this->uk ? $this->key() : $this->current()), $sub);
+ $ret = parent::accept();
+ var_dump($sub == $this->current());
+ return $ret;
+ }
}
$ar = new ArrayIterator(array('1','1,2','1,2,3','',NULL,array(),'FooBar',',',',,'));
@@ -42,8 +42,6 @@ $it->show();
var_dump($ar);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
bool(true)
bool(true)
@@ -204,4 +202,3 @@ object(ArrayIterator)#%d (1) {
%s(2) ",,"
}
}
-===DONE===
diff --git a/ext/spl/tests/iterator_054.phpt b/ext/spl/tests/iterator_054.phpt
index 91266c9571..f40639dd36 100644
--- a/ext/spl/tests/iterator_054.phpt
+++ b/ext/spl/tests/iterator_054.phpt
@@ -5,14 +5,14 @@ SPL: RegexIterator::SPLIT
class MyRegexIterator extends RegexIterator
{
- function show()
- {
- foreach($this as $k => $v)
- {
- var_dump($k);
- var_dump($v);
- }
- }
+ function show()
+ {
+ foreach($this as $k => $v)
+ {
+ var_dump($k);
+ var_dump($v);
+ }
+ }
}
$ar = new ArrayIterator(array('1','1,2','1,2,3','',NULL,array(),'FooBar',',',',,'));
@@ -23,8 +23,6 @@ $it->show();
var_dump($ar);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
int(1)
array(2) {
@@ -82,4 +80,3 @@ object(ArrayIterator)#%d (1) {
%s(2) ",,"
}
}
-===DONE===
diff --git a/ext/spl/tests/iterator_055.phpt b/ext/spl/tests/iterator_055.phpt
index dec68a463b..58d710c04a 100644
--- a/ext/spl/tests/iterator_055.phpt
+++ b/ext/spl/tests/iterator_055.phpt
@@ -5,14 +5,14 @@ SPL: RegexIterator::SPLIT, USE_KEY
class MyRegexIterator extends RegexIterator
{
- function show()
- {
- foreach($this as $k => $v)
- {
- var_dump($k);
- var_dump($v);
- }
- }
+ function show()
+ {
+ foreach($this as $k => $v)
+ {
+ var_dump($k);
+ var_dump($v);
+ }
+ }
}
$ar = new ArrayIterator(array('1'=>0,'1,2'=>1,'1,2,3'=>2,0=>3,'FooBar'=>4,','=>5,',,'=>6));
@@ -23,8 +23,6 @@ $it->show();
var_dump($ar);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
string(3) "1,2"
array(2) {
@@ -59,4 +57,3 @@ object(ArrayIterator)#%d (1) {
int(6)
}
}
-===DONE===
diff --git a/ext/spl/tests/iterator_056.phpt b/ext/spl/tests/iterator_056.phpt
index ec49e6b740..28dd444856 100644
--- a/ext/spl/tests/iterator_056.phpt
+++ b/ext/spl/tests/iterator_056.phpt
@@ -6,7 +6,7 @@ Sebastian Schürmann
<?php
class myFilterIterator extends FilterIterator {
- function accept() { }
+ function accept() { }
}
class myCachingIterator extends CachingIterator { }
@@ -20,36 +20,36 @@ class myLimitIterator extends LimitIterator { }
class myNoRewindIterator extends NoRewindIterator {}
try {
- $it = new myFilterIterator();
+ $it = new myFilterIterator();
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
try {
- $it = new myCachingIterator();
+ $it = new myCachingIterator();
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
try {
- $it = new myRecursiveCachingIterator();
+ $it = new myRecursiveCachingIterator();
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
try {
- $it = new myParentIterator();
+ $it = new myParentIterator();
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
try {
- $it = new myLimitIterator();
+ $it = new myLimitIterator();
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
try {
- $it = new myNoRewindIterator();
+ $it = new myNoRewindIterator();
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
diff --git a/ext/spl/tests/iterator_057.phpt b/ext/spl/tests/iterator_057.phpt
index 61c1dfced6..e88e6a92b0 100644
--- a/ext/spl/tests/iterator_057.phpt
+++ b/ext/spl/tests/iterator_057.phpt
@@ -11,9 +11,9 @@ Sebastian Schürmann
class myArrayIterator extends ArrayIterator {
}
try {
- $it = new myArrayIterator();
+ $it = new myArrayIterator();
} catch (InvalidArgumentException $e) {
- echo 'InvalidArgumentException thrown';
+ echo 'InvalidArgumentException thrown';
}
echo 'no Exception thrown'
?>
diff --git a/ext/spl/tests/iterator_058.phpt b/ext/spl/tests/iterator_058.phpt
index 83d9d91feb..ebe7a1ed2c 100644
--- a/ext/spl/tests/iterator_058.phpt
+++ b/ext/spl/tests/iterator_058.phpt
@@ -6,17 +6,17 @@ Sebastian Schürmann
<?php
class myIterator implements Iterator {
- function current() {}
- function next() {}
- function key() {}
- function valid() {}
- function rewind() {}
+ function current() {}
+ function next() {}
+ function key() {}
+ function valid() {}
+ function rewind() {}
}
try {
- $it = new myIterator();
+ $it = new myIterator();
} catch (InvalidArgumentException $e) {
- echo 'InvalidArgumentException thrown';
+ echo 'InvalidArgumentException thrown';
}
echo 'no Exception thrown';
?>
diff --git a/ext/spl/tests/iterator_062.phpt b/ext/spl/tests/iterator_062.phpt
index 3694cf1956..30011343d2 100644
--- a/ext/spl/tests/iterator_062.phpt
+++ b/ext/spl/tests/iterator_062.phpt
@@ -9,9 +9,9 @@ class myRecursiveIteratorIterator extends RecursiveIteratorIterator {
}
try {
- $it = new myRecursiveIteratorIterator();
+ $it = new myRecursiveIteratorIterator();
} catch (InvalidArgumentException $e) {
- echo 'InvalidArgumentException thrown';
+ echo 'InvalidArgumentException thrown';
}
?>
--EXPECT--
diff --git a/ext/spl/tests/iterator_067.phpt b/ext/spl/tests/iterator_067.phpt
index e05a48d4e0..3c35bd06f7 100644
--- a/ext/spl/tests/iterator_067.phpt
+++ b/ext/spl/tests/iterator_067.phpt
@@ -6,10 +6,10 @@ Sebastian Schürmann
<?php
class myAppendIterator extends AppendIterator {}
try {
- $it = new myAppendIterator();
- echo "no exception";
+ $it = new myAppendIterator();
+ echo "no exception";
} catch (InvalidArgumentException $e) {
- echo 'InvalidArgumentException thrown';
+ echo 'InvalidArgumentException thrown';
}
?>
--EXPECT--
diff --git a/ext/spl/tests/iterator_068.phpt b/ext/spl/tests/iterator_068.phpt
index 4845708d43..00006a3b60 100644
--- a/ext/spl/tests/iterator_068.phpt
+++ b/ext/spl/tests/iterator_068.phpt
@@ -4,21 +4,21 @@ SPL: Iterator: Overloaded object and destruction
<?php
class Test implements Iterator {
- function foo() {
- echo __METHOD__ . "()\n";
- }
- function rewind() {}
- function valid() {}
- function current() {}
- function key() {}
- function next() {}
+ function foo() {
+ echo __METHOD__ . "()\n";
+ }
+ function rewind() {}
+ function valid() {}
+ function current() {}
+ function key() {}
+ function next() {}
}
class TestIteratorIterator extends IteratorIterator {
- function __destruct() {
- echo __METHOD__ . "()\n";
- $this->foo();
- }
+ function __destruct() {
+ echo __METHOD__ . "()\n";
+ $this->foo();
+ }
}
$obj = new TestIteratorIterator(new Test);
@@ -26,9 +26,7 @@ $obj->foo();
unset($obj);
?>
-===DONE===
--EXPECT--
Test::foo()
TestIteratorIterator::__destruct()
Test::foo()
-===DONE===
diff --git a/ext/spl/tests/iterator_070.phpt b/ext/spl/tests/iterator_070.phpt
index 681e327523..94dea30db5 100644
--- a/ext/spl/tests/iterator_070.phpt
+++ b/ext/spl/tests/iterator_070.phpt
@@ -1,5 +1,5 @@
--TEST--
-SPL: RecursiveIteratorIterator - Ensure that non-overriden methods execute problem free.
+SPL: RecursiveIteratorIterator - Ensure that non-overridden methods execute problem free.
--FILE--
<?php
diff --git a/ext/spl/tests/iterator_071.phpt b/ext/spl/tests/iterator_071.phpt
index 9f48f6ee14..501771119a 100644
--- a/ext/spl/tests/iterator_071.phpt
+++ b/ext/spl/tests/iterator_071.phpt
@@ -11,7 +11,7 @@ $recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
function nextelement() {
- echo __METHOD__."\n";
+ echo __METHOD__."\n";
}
}
diff --git a/ext/spl/tests/iterator_count.phpt b/ext/spl/tests/iterator_count.phpt
index c0dad0f422..a115a7329c 100644
--- a/ext/spl/tests/iterator_count.phpt
+++ b/ext/spl/tests/iterator_count.phpt
@@ -9,21 +9,11 @@ $array=array('a','b');
$iterator = new ArrayIterator($array);
-iterator_count();
-
-
-iterator_count($iterator,'1');
-
iterator_count('1');
-
?>
--EXPECTF--
-Warning: iterator_count() expects exactly 1 parameter, 0 given in %s
-
-Warning: iterator_count() expects exactly 1 parameter, 2 given in %s
-
-Fatal error: Uncaught TypeError: Argument 1 passed to iterator_count() must implement interface Traversable, string given in %s:%d
+Fatal error: Uncaught TypeError: iterator_count() expects parameter 1 to be Traversable, string given in %s:%d
Stack trace:
#0 %s(%d): iterator_count('1')
#1 {main}
diff --git a/ext/spl/tests/iterator_to_array.phpt b/ext/spl/tests/iterator_to_array.phpt
index f36b99db23..9225f03c00 100644
--- a/ext/spl/tests/iterator_to_array.phpt
+++ b/ext/spl/tests/iterator_to_array.phpt
@@ -9,20 +9,11 @@ $array=array('a','b');
$iterator = new ArrayIterator($array);
-iterator_to_array();
-
-
-iterator_to_array($iterator,'test','test');
-
iterator_to_array('test','test');
?>
--EXPECTF--
-Warning: iterator_to_array() expects at least 1 parameter, 0 given in %s
-
-Warning: iterator_to_array() expects at most 2 parameters, 3 given in %s
-
-Fatal error: Uncaught TypeError: Argument 1 passed to iterator_to_array() must implement interface Traversable, string given in %s:%d
+Fatal error: Uncaught TypeError: iterator_to_array() expects parameter 1 to be Traversable, string given in %s:%d
Stack trace:
#0 %s(%d): iterator_to_array('test', 'test')
#1 {main}
diff --git a/ext/spl/tests/iterator_to_array_nonscalar_keys.phpt b/ext/spl/tests/iterator_to_array_nonscalar_keys.phpt
index 4ca9485faf..1920b31639 100644
--- a/ext/spl/tests/iterator_to_array_nonscalar_keys.phpt
+++ b/ext/spl/tests/iterator_to_array_nonscalar_keys.phpt
@@ -12,20 +12,12 @@ function gen() {
yield new stdClass => 5;
}
-var_dump(iterator_to_array(gen()));
+try {
+ var_dump(iterator_to_array(gen()));
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Warning: Illegal offset type in %s on line %d
-
-Warning: Illegal offset type in %s on line %d
-array(4) {
- ["foo"]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
- [""]=>
- int(3)
-}
+--EXPECT--
+Illegal offset type
diff --git a/ext/spl/tests/multiple_iterator_001.phpt b/ext/spl/tests/multiple_iterator_001.phpt
index be7eeeac7e..56a08da272 100644
--- a/ext/spl/tests/multiple_iterator_001.phpt
+++ b/ext/spl/tests/multiple_iterator_001.phpt
@@ -11,7 +11,7 @@ $m = new MultipleIterator();
echo "-- Default flags, no iterators --\n";
foreach($m as $value) {
- var_dump($value);
+ var_dump($value);
}
var_dump($m->current());
@@ -24,17 +24,17 @@ echo "-- Default flags, MultipleIterator::MIT_NEED_ALL | MultipleIterator::MIT_K
var_dump($m->getFlags() === (MultipleIterator::MIT_NEED_ALL | MultipleIterator::MIT_KEYS_NUMERIC));
foreach($m as $key => $value) {
- var_dump($key, $value);
+ var_dump($key, $value);
}
try {
- $m->current();
+ $m->current();
} catch(RuntimeException $e) {
- echo "RuntimeException thrown: " . $e->getMessage() . "\n";
+ echo "RuntimeException thrown: " . $e->getMessage() . "\n";
}
try {
- $m->key();
+ $m->key();
} catch(RuntimeException $e) {
- echo "RuntimeException thrown: " . $e->getMessage() . "\n";
+ echo "RuntimeException thrown: " . $e->getMessage() . "\n";
}
echo "-- Flags = MultipleIterator::MIT_NEED_ANY | MultipleIterator::MIT_KEYS_NUMERIC --\n";
@@ -43,7 +43,7 @@ $m->setFlags(MultipleIterator::MIT_NEED_ANY | MultipleIterator::MIT_KEYS_NUMERIC
var_dump($m->getFlags() === (MultipleIterator::MIT_NEED_ANY | MultipleIterator::MIT_KEYS_NUMERIC));
foreach($m as $key => $value) {
- var_dump($key, $value);
+ var_dump($key, $value);
}
echo "-- Default flags, added element --\n";
@@ -52,7 +52,7 @@ $m->setFlags(MultipleIterator::MIT_NEED_ALL | MultipleIterator::MIT_KEYS_NUMERIC
$iter2[] = 3;
foreach($m as $key => $value) {
- var_dump($key, $value);
+ var_dump($key, $value);
}
echo "-- Flags |= MultipleIterator::MIT_KEYS_ASSOC, with iterator associated with NULL --\n";
@@ -60,9 +60,9 @@ echo "-- Flags |= MultipleIterator::MIT_KEYS_ASSOC, with iterator associated wit
$m->setFlags(MultipleIterator::MIT_NEED_ALL | MultipleIterator::MIT_KEYS_ASSOC);
$m->rewind();
try {
- $m->current();
+ $m->current();
} catch(InvalidArgumentException $e) {
- echo "InvalidArgumentException thrown: " . $e->getMessage() . "\n";
+ echo "InvalidArgumentException thrown: " . $e->getMessage() . "\n";
}
echo "-- Flags |= MultipleIterator::MIT_KEYS_ASSOC --\n";
@@ -72,23 +72,23 @@ $m->attachIterator($iter2, "iter2");
$m->attachIterator($iter3, 3);
foreach($m as $key => $value) {
- var_dump($key, $value);
+ var_dump($key, $value);
}
echo "-- Associate with invalid value --\n";
try {
- $m->attachIterator($iter3, new stdClass());
+ $m->attachIterator($iter3, new stdClass());
} catch(InvalidArgumentException $e) {
- echo "InvalidArgumentException thrown: " . $e->getMessage() . "\n";
+ echo "InvalidArgumentException thrown: " . $e->getMessage() . "\n";
}
echo "-- Associate with duplicate value --\n";
try {
- $m->attachIterator($iter3, "iter1");
+ $m->attachIterator($iter3, "iter1");
} catch(InvalidArgumentException $e) {
- echo "InvalidArgumentException thrown: " . $e->getMessage() . "\n";
+ echo "InvalidArgumentException thrown: " . $e->getMessage() . "\n";
}
echo "-- Count, contains, detach, count, contains, iterate --\n";
@@ -99,7 +99,7 @@ var_dump($m->detachIterator($iter2));
var_dump($m->countIterators());
var_dump($m->containsIterator($iter2));
foreach($m as $key => $value) {
- var_dump($key, $value);
+ var_dump($key, $value);
}
?>
diff --git a/ext/spl/tests/observer_001.phpt b/ext/spl/tests/observer_001.phpt
index 6408406ebf..72feb08a40 100644
--- a/ext/spl/tests/observer_001.phpt
+++ b/ext/spl/tests/observer_001.phpt
@@ -5,66 +5,66 @@ SPL: SplObserver and SplSubject (empty notify)
class ObserverImpl implements SplObserver
{
- protected $name = '';
-
- function __construct($name = 'obj')
- {
- $this->name = '$' . $name;
- }
-
- function update(SplSubject $subject)
- {
- echo $this->name . '->' . __METHOD__ . '(' . $subject->getName() . ");\n";
- }
-
- function getName()
- {
- return $this->name;
- }
+ protected $name = '';
+
+ function __construct($name = 'obj')
+ {
+ $this->name = '$' . $name;
+ }
+
+ function update(SplSubject $subject)
+ {
+ echo $this->name . '->' . __METHOD__ . '(' . $subject->getName() . ");\n";
+ }
+
+ function getName()
+ {
+ return $this->name;
+ }
}
class SubjectImpl implements SplSubject
{
- protected $name = '';
- protected $observers = array();
+ protected $name = '';
+ protected $observers = array();
- function __construct($name = 'sub')
- {
- $this->name = '$' . $name;
- }
+ function __construct($name = 'sub')
+ {
+ $this->name = '$' . $name;
+ }
function attach(SplObserver $observer)
{
- echo '$sub->' . __METHOD__ . '(' . $observer->getName() . ");\n";
- if (!in_array($observer, $this->observers))
- {
- $this->observers[] = $observer;
- }
+ echo '$sub->' . __METHOD__ . '(' . $observer->getName() . ");\n";
+ if (!in_array($observer, $this->observers))
+ {
+ $this->observers[] = $observer;
+ }
}
function detach(SplObserver $observer)
{
- echo '$sub->' . __METHOD__ . '(' . $observer->getName() . ");\n";
- $idx = array_search($observer, $this->observers);
- if ($idx !== false)
- {
- unset($this->observers[$idx]);
- }
+ echo '$sub->' . __METHOD__ . '(' . $observer->getName() . ");\n";
+ $idx = array_search($observer, $this->observers);
+ if ($idx !== false)
+ {
+ unset($this->observers[$idx]);
+ }
}
function notify()
{
- echo '$sub->' . __METHOD__ . "();\n";
- foreach($this->observers as $observer)
- {
- $observer->update($this);
- }
+ echo '$sub->' . __METHOD__ . "();\n";
+ foreach($this->observers as $observer)
+ {
+ $observer->update($this);
+ }
}
- function getName()
- {
- return $this->name;
- }
+ function getName()
+ {
+ return $this->name;
+ }
}
$sub = new SubjectImpl;
@@ -93,7 +93,6 @@ $sub->attach($ob3);
$sub->notify();
?>
-===DONE===
--EXPECT--
$sub->SubjectImpl::attach($ob1);
$sub->SubjectImpl::attach($ob1);
@@ -113,4 +112,3 @@ $sub->SubjectImpl::notify();
$sub->SubjectImpl::attach($ob3);
$sub->SubjectImpl::notify();
$ob3->ObserverImpl::update($sub);
-===DONE===
diff --git a/ext/spl/tests/observer_002.phpt b/ext/spl/tests/observer_002.phpt
index 504e7ca3f3..2642c28bd5 100644
--- a/ext/spl/tests/observer_002.phpt
+++ b/ext/spl/tests/observer_002.phpt
@@ -5,103 +5,103 @@ SPL: SplObjectStorage
class MyObjectStorage extends SplObjectStorage
{
- function rewind()
- {
- echo __METHOD__ . "()\n";
- parent::rewind();
- }
-
- function valid()
- {
- echo __METHOD__ . "(" . (parent::valid() ? 1 : 0) . ")\n";
- return parent::valid();
- }
-
- function key()
- {
- echo __METHOD__ . "(" . parent::key() . ")\n";
- return parent::key();
- }
-
- function current()
- {
- echo __METHOD__ . "(" . parent::current()->getName() . ")\n";
- return parent::current();
- }
-
- function next()
- {
- echo __METHOD__ . "()\n";
- parent::next();
- }
+ function rewind()
+ {
+ echo __METHOD__ . "()\n";
+ parent::rewind();
+ }
+
+ function valid()
+ {
+ echo __METHOD__ . "(" . (parent::valid() ? 1 : 0) . ")\n";
+ return parent::valid();
+ }
+
+ function key()
+ {
+ echo __METHOD__ . "(" . parent::key() . ")\n";
+ return parent::key();
+ }
+
+ function current()
+ {
+ echo __METHOD__ . "(" . parent::current()->getName() . ")\n";
+ return parent::current();
+ }
+
+ function next()
+ {
+ echo __METHOD__ . "()\n";
+ parent::next();
+ }
}
class ObserverImpl implements SplObserver
{
- protected $name = '';
-
- function __construct($name = 'obj')
- {
- $this->name = '$' . $name;
- }
-
- function update(SplSubject $subject)
- {
- echo $this->name . '->' . __METHOD__ . '(' . $subject->getName() . ");\n";
- }
-
- function getName()
- {
- return $this->name;
- }
+ protected $name = '';
+
+ function __construct($name = 'obj')
+ {
+ $this->name = '$' . $name;
+ }
+
+ function update(SplSubject $subject)
+ {
+ echo $this->name . '->' . __METHOD__ . '(' . $subject->getName() . ");\n";
+ }
+
+ function getName()
+ {
+ return $this->name;
+ }
}
class SubjectImpl implements SplSubject
{
- protected $name = '';
- protected $observers;
-
- function __construct($name = 'sub')
- {
- $this->observers = new MyObjectStorage;
- $this->name = '$' . $name;
- }
-
- function attach(SplObserver $observer)
- {
- echo $this->name . '->' . __METHOD__ . '(' . $observer->getName() . ");\n";
- $this->observers->attach($observer);
- }
-
- function detach(SplObserver $observer)
- {
- echo $this->name . '->' . __METHOD__ . '(' . $observer->getName() . ");\n";
- $this->observers->detach($observer);
- }
-
- function count()
- {
- return $this->observers->count();
- }
-
- function notify()
- {
- echo $this->name . '->' . __METHOD__ . "();\n";
- foreach($this->observers as $key => $observer)
- {
- $observer->update($this);
- }
- }
-
- function getName()
- {
- return $this->name;
- }
-
- function contains($obj)
- {
- return $this->observers->contains($obj);
- }
+ protected $name = '';
+ protected $observers;
+
+ function __construct($name = 'sub')
+ {
+ $this->observers = new MyObjectStorage;
+ $this->name = '$' . $name;
+ }
+
+ function attach(SplObserver $observer)
+ {
+ echo $this->name . '->' . __METHOD__ . '(' . $observer->getName() . ");\n";
+ $this->observers->attach($observer);
+ }
+
+ function detach(SplObserver $observer)
+ {
+ echo $this->name . '->' . __METHOD__ . '(' . $observer->getName() . ");\n";
+ $this->observers->detach($observer);
+ }
+
+ function count()
+ {
+ return $this->observers->count();
+ }
+
+ function notify()
+ {
+ echo $this->name . '->' . __METHOD__ . "();\n";
+ foreach($this->observers as $key => $observer)
+ {
+ $observer->update($this);
+ }
+ }
+
+ function getName()
+ {
+ return $this->name;
+ }
+
+ function contains($obj)
+ {
+ return $this->observers->contains($obj);
+ }
}
$sub = new SubjectImpl;
@@ -137,8 +137,6 @@ var_dump($sub->count());
$sub->notify();
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
bool(false)
$sub->SubjectImpl::attach($ob1);
@@ -196,4 +194,3 @@ MyObjectStorage::key(0)
$ob3->ObserverImpl::update($sub);
MyObjectStorage::next()
MyObjectStorage::valid(0)
-===DONE===
diff --git a/ext/spl/tests/observer_003.phpt b/ext/spl/tests/observer_003.phpt
index c7041051b8..36ead92336 100644
--- a/ext/spl/tests/observer_003.phpt
+++ b/ext/spl/tests/observer_003.phpt
@@ -5,12 +5,12 @@ SPL: SplObjectStorage serialization
class TestClass
{
- public $test = 25;
+ public $test = 25;
- public function __construct($test = 42)
- {
- $this->test = $test;
- }
+ public function __construct($test = 42)
+ {
+ $this->test = $test;
+ }
}
$storage = new SplObjectStorage();
@@ -24,7 +24,7 @@ var_dump(count($storage));
foreach($storage as $object)
{
- var_dump($object->test);
+ var_dump($object->test);
}
var_dump(serialize($storage));
@@ -36,12 +36,10 @@ var_dump(count($storage2));
foreach($storage2 as $object)
{
- var_dump($object->test);
+ var_dump($object->test);
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
int(4)
int(1)
@@ -55,4 +53,3 @@ int(1)
string(1) "2"
string(3) "foo"
bool(true)
-===DONE===
diff --git a/ext/spl/tests/observer_004.phpt b/ext/spl/tests/observer_004.phpt
index a56c514615..7da7f1a651 100644
--- a/ext/spl/tests/observer_004.phpt
+++ b/ext/spl/tests/observer_004.phpt
@@ -5,22 +5,22 @@ SPL: SplObjectStorage serialization & overloading
class TestClass
{
- public $test = 25;
+ public $test = 25;
- public function __construct($test = 42)
- {
- $this->test = $test;
- }
+ public function __construct($test = 42)
+ {
+ $this->test = $test;
+ }
}
class MyStorage extends SplObjectStorage
{
- public $bla = 25;
+ public $bla = 25;
- public function __construct($bla = 26)
- {
- $this->bla = $bla;
- }
+ public function __construct($bla = 26)
+ {
+ $this->bla = $bla;
+ }
}
$storage = new MyStorage();
@@ -34,7 +34,7 @@ var_dump(count($storage));
foreach($storage as $object)
{
- var_dump($object->test);
+ var_dump($object->test);
}
var_dump($storage);
@@ -48,14 +48,12 @@ var_dump(count($storage2));
foreach($storage2 as $object)
{
- var_dump($object->test);
+ var_dump($object->test);
}
var_dump($storage2);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
int(2)
int(1)
@@ -119,4 +117,3 @@ object(MyStorage)#%d (2) {
}
}
}
-===DONE===
diff --git a/ext/spl/tests/observer_005.phpt b/ext/spl/tests/observer_005.phpt
index fe490525b8..57f632cfbc 100644
--- a/ext/spl/tests/observer_005.phpt
+++ b/ext/spl/tests/observer_005.phpt
@@ -5,17 +5,17 @@ SPL: SplObjectStorage serialization & visibility
class TestClass
{
- public $def = 24;
- public $pub = 25;
- protected $pro = 26;
- private $pri = 27;
-
- public function __construct($pub = 42, $pro = 43, $pri = 44)
- {
- $this->pub = $pub;
- $this->pro = $pro;
- $this->pri = $pri;
- }
+ public $def = 24;
+ public $pub = 25;
+ protected $pro = 26;
+ private $pri = 27;
+
+ public function __construct($pub = 42, $pro = 43, $pri = 44)
+ {
+ $this->pub = $pub;
+ $this->pro = $pro;
+ $this->pri = $pri;
+ }
}
class ExtTestClass
@@ -24,17 +24,17 @@ class ExtTestClass
class MyStorage extends SplObjectStorage
{
- public $def = 24;
- public $pub = 25;
- protected $pro = 26;
- private $pri = 27;
-
- public function __construct($pub = 52, $pro = 53, $pri = 54)
- {
- $this->pub = $pub;
- $this->pro = $pro;
- $this->pri = $pri;
- }
+ public $def = 24;
+ public $pub = 25;
+ protected $pro = 26;
+ private $pri = 27;
+
+ public function __construct($pub = 52, $pro = 53, $pri = 54)
+ {
+ $this->pub = $pub;
+ $this->pro = $pro;
+ $this->pri = $pri;
+ }
}
class ExtStorage extends MyStorage
@@ -52,7 +52,7 @@ var_dump(count($storage));
foreach($storage as $object)
{
- var_dump($object);
+ var_dump($object);
}
var_dump($storage);
@@ -66,14 +66,12 @@ var_dump(count($storage2));
foreach($storage2 as $object)
{
- var_dump($object);
+ var_dump($object);
}
var_dump($storage2);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
int(2)
object(TestClass)#%d (4) {
@@ -209,4 +207,3 @@ object(MyStorage)#%d (5) {
}
}
}
-===DONE===
diff --git a/ext/spl/tests/observer_006.phpt b/ext/spl/tests/observer_006.phpt
index f021dfb7f2..e130f469ad 100644
--- a/ext/spl/tests/observer_006.phpt
+++ b/ext/spl/tests/observer_006.phpt
@@ -5,22 +5,22 @@ SPL: SplObjectStorage with accociatied information
class TestClass
{
- public $test = 25;
+ public $test = 25;
- public function __construct($test = 42)
- {
- $this->test = $test;
- }
+ public function __construct($test = 42)
+ {
+ $this->test = $test;
+ }
}
class MyStorage extends SplObjectStorage
{
- public $bla = 25;
+ public $bla = 25;
- public function __construct($bla = 26)
- {
- $this->bla = $bla;
- }
+ public function __construct($bla = 26)
+ {
+ $this->bla = $bla;
+ }
}
$storage = new MyStorage();
@@ -34,7 +34,7 @@ var_dump(count($storage));
foreach($storage as $object)
{
- var_dump($object->test);
+ var_dump($object->test);
}
var_dump($storage);
@@ -48,7 +48,7 @@ var_dump(count($storage2));
foreach($storage2 as $object)
{
- var_dump($object->test);
+ var_dump($object->test);
}
var_dump($storage2);
@@ -75,8 +75,6 @@ echo "===UNSERIALIZE4===\n";
var_dump(unserialize(serialize($storage)));
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
int(2)
int(1)
@@ -307,4 +305,3 @@ object(MyStorage)#%d (2) {
}
}
}
-===DONE===
diff --git a/ext/spl/tests/observer_007.phpt b/ext/spl/tests/observer_007.phpt
index 4525edc693..254010cb64 100644
--- a/ext/spl/tests/observer_007.phpt
+++ b/ext/spl/tests/observer_007.phpt
@@ -12,11 +12,8 @@ var_dump($a == $b);
$a[$b] = 3;
var_dump($a == $b);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
bool(true)
bool(false)
bool(true)
bool(false)
-===DONE===
diff --git a/ext/spl/tests/observer_008.phpt b/ext/spl/tests/observer_008.phpt
index 65f3e4da52..a584d5492c 100644
--- a/ext/spl/tests/observer_008.phpt
+++ b/ext/spl/tests/observer_008.phpt
@@ -26,10 +26,7 @@ var_dump($a->count());
$a->removeAll($b);
var_dump($a->count());
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
int(3)
int(2)
int(1)
-===DONE===
diff --git a/ext/spl/tests/observer_009.phpt b/ext/spl/tests/observer_009.phpt
index c55660fa29..58f4998084 100644
--- a/ext/spl/tests/observer_009.phpt
+++ b/ext/spl/tests/observer_009.phpt
@@ -22,9 +22,6 @@ foreach ($storageB as $object) {
}
echo "\n";
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Count storage A: 2 x x
Count storage B: 2 x x
-===DONE===
diff --git a/ext/spl/tests/pqueue_001.phpt b/ext/spl/tests/pqueue_001.phpt
index c9338484b5..2b67ad4a2a 100644
--- a/ext/spl/tests/pqueue_001.phpt
+++ b/ext/spl/tests/pqueue_001.phpt
@@ -59,8 +59,6 @@ foreach ($pq3 as $k=>$v) {
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Exception: Can't extract from an empty heap
2=>b
@@ -93,4 +91,3 @@ EXTR_PRIORITY
2=>2
1=>1
0=>0
-===DONE===
diff --git a/ext/spl/tests/pqueue_002.phpt b/ext/spl/tests/pqueue_002.phpt
index 5e3767f2fd..ee9a5f30ca 100644
--- a/ext/spl/tests/pqueue_002.phpt
+++ b/ext/spl/tests/pqueue_002.phpt
@@ -53,8 +53,6 @@ try {
echo "Exception: ".$e->getMessage()."\n";
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
inserted 1
Exception: foo
@@ -64,4 +62,3 @@ Exception: Heap is corrupted, heap properties are no longer ensured.
Recovering..
int(1)
int(2)
-===DONE===
diff --git a/ext/spl/tests/pqueue_003.phpt b/ext/spl/tests/pqueue_003.phpt
index c90585767f..1e819c6422 100644
--- a/ext/spl/tests/pqueue_003.phpt
+++ b/ext/spl/tests/pqueue_003.phpt
@@ -19,8 +19,6 @@ while ($h->valid()) {
$h->next();
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
count($h) = 4
$h->count() = 4
@@ -28,4 +26,3 @@ $h->count() = 4
2=>4
1=>1
0=>0
-===DONE===
diff --git a/ext/spl/tests/pqueue_004.phpt b/ext/spl/tests/pqueue_004.phpt
index 172cc8e218..86af228ce2 100644
--- a/ext/spl/tests/pqueue_004.phpt
+++ b/ext/spl/tests/pqueue_004.phpt
@@ -11,8 +11,6 @@ $pq->insert("d", -2);
var_dump($pq);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
object(SplPriorityQueue)#1 (3) {
["flags":"SplPriorityQueue":private]=>
@@ -51,4 +49,3 @@ object(SplPriorityQueue)#1 (3) {
}
}
}
-===DONE===
diff --git a/ext/spl/tests/pqueue_compare_basic.phpt b/ext/spl/tests/pqueue_compare_basic.phpt
index bc4085e8dd..ac05b6f292 100644
--- a/ext/spl/tests/pqueue_compare_basic.phpt
+++ b/ext/spl/tests/pqueue_compare_basic.phpt
@@ -10,10 +10,7 @@ var_dump($h->compare(4, 5) < 0);
var_dump($h->compare(5, 5) == 0);
var_dump($h->compare(5, 4) > 0);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
bool(true)
bool(true)
bool(true)
-===DONE===
diff --git a/ext/spl/tests/recursiveIteratorIterator_beginchildren_error.phpt b/ext/spl/tests/recursiveIteratorIterator_beginchildren_error.phpt
index cac0e2c479..e8b71ebb0d 100644
--- a/ext/spl/tests/recursiveIteratorIterator_beginchildren_error.phpt
+++ b/ext/spl/tests/recursiveIteratorIterator_beginchildren_error.phpt
@@ -11,7 +11,7 @@ $recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
function beginchildren() {
- throw new Exception;
+ throw new Exception;
}
}
diff --git a/ext/spl/tests/recursiveIteratorIterator_callHasChildren_error.phpt b/ext/spl/tests/recursiveIteratorIterator_callHasChildren_error.phpt
index 1961517253..df66937525 100644
--- a/ext/spl/tests/recursiveIteratorIterator_callHasChildren_error.phpt
+++ b/ext/spl/tests/recursiveIteratorIterator_callHasChildren_error.phpt
@@ -11,7 +11,7 @@ $recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
function callHasChildren() {
- throw new Exception;
+ throw new Exception;
}
}
diff --git a/ext/spl/tests/recursiveIteratorIterator_endchildren_error.phpt b/ext/spl/tests/recursiveIteratorIterator_endchildren_error.phpt
index 941f92be82..7bd08d444f 100644
--- a/ext/spl/tests/recursiveIteratorIterator_endchildren_error.phpt
+++ b/ext/spl/tests/recursiveIteratorIterator_endchildren_error.phpt
@@ -11,7 +11,7 @@ $recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
function endchildren() {
- throw new Exception;
+ throw new Exception;
}
}
diff --git a/ext/spl/tests/recursiveIteratorIterator_nextelement_error.phpt b/ext/spl/tests/recursiveIteratorIterator_nextelement_error.phpt
index dd4f038710..bd084f54e6 100644
--- a/ext/spl/tests/recursiveIteratorIterator_nextelement_error.phpt
+++ b/ext/spl/tests/recursiveIteratorIterator_nextelement_error.phpt
@@ -11,7 +11,7 @@ $recArrIt = new RecursiveArrayIterator($arrOb->getIterator());
class MyRecursiveIteratorIterator extends RecursiveIteratorIterator {
function nextelement() {
- throw new Exception;
+ throw new Exception;
}
}
diff --git a/ext/spl/tests/recursive_tree_iterator_001.phpt b/ext/spl/tests/recursive_tree_iterator_001.phpt
index ac9f281388..c3172a58b7 100644
--- a/ext/spl/tests/recursive_tree_iterator_001.phpt
+++ b/ext/spl/tests/recursive_tree_iterator_001.phpt
@@ -1,54 +1,51 @@
--TEST--
SPL: RecursiveTreeIterator
---INI--
-error_reporting=E_ALL&~E_NOTICE
--FILE--
<?php
$ary = array(
- 0 => array(
- "a",
- 1,
- ),
- "a" => array(
- 2,
- "b",
- 3 => array(
- 4,
- "c",
- ),
- "3" => array(
- 4,
- "c",
- ),
- ),
+ 0 => array(
+ "a",
+ 1,
+ ),
+ "a" => array(
+ 2,
+ "b",
+ 3 => array(
+ 4,
+ "c",
+ ),
+ "3" => array(
+ 4,
+ "c",
+ ),
+ ),
);
$it = new RecursiveArrayIterator($ary);
echo "-- flags = BYPASS_KEY --\n";
foreach(new RecursiveTreeIterator($it) as $k => $v) {
- echo "[$k] => $v\n";
+ echo "[$k] => $v\n";
}
echo "-- flags = BYPASS_CURRENT --\n";
foreach(new RecursiveTreeIterator($it, RecursiveTreeIterator::BYPASS_CURRENT) as $k => $v) {
- echo "[$k] => $v\n";
+ echo "[$k] => $v\n";
}
echo "-- flags = BYPASS_KEY|BYPASS_KEY --\n";
foreach(new RecursiveTreeIterator($it, RecursiveTreeIterator::BYPASS_CURRENT|RecursiveTreeIterator::BYPASS_KEY) as $k => $v) {
- echo "[$k] => $v\n";
+ echo "[$k] => $v\n";
}
echo "-- flags = 0 --\n";
foreach(new RecursiveTreeIterator($it, 0) as $k => $v) {
- echo "[$k] => $v\n";
+ echo "[$k] => $v\n";
}
echo "-- flags = 0, caching_it_flags = CachingIterator::CATCH_GET_CHILD --\n";
foreach(new RecursiveTreeIterator($it, 0, CachingIterator::CATCH_GET_CHILD) as $k => $v) {
- echo "[$k] => $v\n";
+ echo "[$k] => $v\n";
}
?>
-===DONE===
---EXPECT--
+--EXPECTF--
-- flags = BYPASS_KEY --
[0] => |-Array
[0] => | |-a
@@ -60,22 +57,34 @@ foreach(new RecursiveTreeIterator($it, 0, CachingIterator::CATCH_GET_CHILD) as $
[0] => |-4
[1] => \-c
-- flags = BYPASS_CURRENT --
+
+Warning: Array to string conversion in %s on line %d
[|-0] => Array
[| |-0] => a
[| \-1] => 1
+
+Warning: Array to string conversion in %s on line %d
[\-a] => Array
[ |-0] => 2
[ |-1] => b
+
+Warning: Array to string conversion in %s on line %d
[ \-3] => Array
[ |-0] => 4
[ \-1] => c
-- flags = BYPASS_KEY|BYPASS_KEY --
+
+Warning: Array to string conversion in %s on line %d
[0] => Array
[0] => a
[1] => 1
+
+Warning: Array to string conversion in %s on line %d
[a] => Array
[0] => 2
[1] => b
+
+Warning: Array to string conversion in %s on line %d
[3] => Array
[0] => 4
[1] => c
@@ -99,4 +108,3 @@ foreach(new RecursiveTreeIterator($it, 0, CachingIterator::CATCH_GET_CHILD) as $
[ \-3] => \-Array
[ |-0] => |-4
[ \-1] => \-c
-===DONE===
diff --git a/ext/spl/tests/recursive_tree_iterator_002.phpt b/ext/spl/tests/recursive_tree_iterator_002.phpt
index 7d82b191e2..e32b3bd00e 100644
--- a/ext/spl/tests/recursive_tree_iterator_002.phpt
+++ b/ext/spl/tests/recursive_tree_iterator_002.phpt
@@ -5,12 +5,10 @@ error_reporting=E_ALL&~E_NOTICE
--FILE--
<?php
try {
- new RecursiveTreeIterator();
+ new RecursiveTreeIterator();
} catch (InvalidArgumentException $e) {
- echo "InvalidArgumentException thrown\n";
+ echo "InvalidArgumentException thrown\n";
}
?>
-===DONE===
--EXPECT--
InvalidArgumentException thrown
-===DONE===
diff --git a/ext/spl/tests/recursive_tree_iterator_003.phpt b/ext/spl/tests/recursive_tree_iterator_003.phpt
index 721b67ac02..c87f942f0d 100644
--- a/ext/spl/tests/recursive_tree_iterator_003.phpt
+++ b/ext/spl/tests/recursive_tree_iterator_003.phpt
@@ -3,12 +3,10 @@ SPL: RecursiveTreeIterator(non-traversable)
--FILE--
<?php
try {
- new RecursiveTreeIterator(new ArrayIterator(array()));
+ new RecursiveTreeIterator(new ArrayIterator(array()));
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
?>
-===DONE===
--EXPECT--
RecursiveCachingIterator::__construct() expects parameter 1 to be RecursiveIterator, object given
-===DONE===
diff --git a/ext/spl/tests/recursive_tree_iterator_004.phpt b/ext/spl/tests/recursive_tree_iterator_004.phpt
index 9435db8bbd..28fe8e05f2 100644
--- a/ext/spl/tests/recursive_tree_iterator_004.phpt
+++ b/ext/spl/tests/recursive_tree_iterator_004.phpt
@@ -6,30 +6,29 @@ error_reporting=E_ALL&~E_NOTICE
<?php
$ary = array(
- 0 => array(
- "a",
- 1,
- ),
- "a" => array(
- 2,
- "b",
- 3 => array(
- 4,
- "c",
- ),
- "3" => array(
- 4,
- "c",
- ),
- ),
+ 0 => array(
+ "a",
+ 1,
+ ),
+ "a" => array(
+ 2,
+ "b",
+ 3 => array(
+ 4,
+ "c",
+ ),
+ "3" => array(
+ 4,
+ "c",
+ ),
+ ),
);
$it = new RecursiveTreeIterator(new RecursiveArrayIterator($ary));
foreach($it as $k => $v) {
- echo '[' . $it->key() . '] => ' . $it->getPrefix() . $it->getEntry() . $it->getPostfix() . "\n";
+ echo '[' . $it->key() . '] => ' . $it->getPrefix() . $it->getEntry() . $it->getPostfix() . "\n";
}
?>
-===DONE===
--EXPECT--
[0] => |-Array
[0] => | |-a
@@ -40,4 +39,3 @@ foreach($it as $k => $v) {
[3] => \-Array
[0] => |-4
[1] => \-c
-===DONE===
diff --git a/ext/spl/tests/recursive_tree_iterator_005.phpt b/ext/spl/tests/recursive_tree_iterator_005.phpt
index b14811fbe8..a63b26685c 100644
--- a/ext/spl/tests/recursive_tree_iterator_005.phpt
+++ b/ext/spl/tests/recursive_tree_iterator_005.phpt
@@ -6,40 +6,39 @@ error_reporting=E_ALL&~E_NOTICE
<?php
$ary = array(
- 0 => array(
- (binary) "binary",
- "abc2",
- 1,
- ),
- (binary) "binary" => array(
- 2,
- "b",
- 3 => array(
- 4,
- "c",
- ),
- "4abc" => array(
- 4,
- "c",
- ),
- ),
+ 0 => array(
+ (binary) "binary",
+ "abc2",
+ 1,
+ ),
+ (binary) "binary" => array(
+ 2,
+ "b",
+ 3 => array(
+ 4,
+ "c",
+ ),
+ "4abc" => array(
+ 4,
+ "c",
+ ),
+ ),
);
$it = new RecursiveTreeIterator(new RecursiveArrayIterator($ary), 0);
foreach($it as $k => $v) {
- var_dump($v);
+ var_dump($v);
}
echo "\n----------------\n\n";
foreach($it as $k => $v) {
- var_dump($k);
+ var_dump($k);
}
echo "\n----------------\n\n";
echo "key, getEntry, current:\n";
foreach($it as $k => $v) {
- var_dump($it->key(), $it->getEntry(), $it->current());
+ var_dump($it->key(), $it->getEntry(), $it->current());
}
?>
-===DONE===
--EXPECT--
string(7) "|-Array"
string(10) "| |-binary"
@@ -113,4 +112,3 @@ string(7) " |-4"
string(7) " \-1"
string(1) "c"
string(7) " \-c"
-===DONE===
diff --git a/ext/spl/tests/recursive_tree_iterator_006.phpt b/ext/spl/tests/recursive_tree_iterator_006.phpt
index 1d1891e4a4..ba71586396 100644
--- a/ext/spl/tests/recursive_tree_iterator_006.phpt
+++ b/ext/spl/tests/recursive_tree_iterator_006.phpt
@@ -1,64 +1,61 @@
--TEST--
SPL: RecursiveTreeIterator and IteratorAggregate
---INI--
-error_reporting=E_ALL&~E_NOTICE
--FILE--
<?php
$ary = array(
- 0 => array(
- "a",
- 1,
- ),
- "a" => array(
- 2,
- "b",
- 3 => array(
- 4,
- "c",
- ),
- "3" => array(
- 4,
- "c",
- ),
- ),
+ 0 => array(
+ "a",
+ 1,
+ ),
+ "a" => array(
+ 2,
+ "b",
+ 3 => array(
+ 4,
+ "c",
+ ),
+ "3" => array(
+ 4,
+ "c",
+ ),
+ ),
);
class RecursiveArrayIteratorAggregated implements IteratorAggregate {
- public $it;
- function __construct($it) {
- $this->it = new RecursiveArrayIterator($it);
- }
- function getIterator() {
- return $this->it;
- }
+ public $it;
+ function __construct($it) {
+ $this->it = new RecursiveArrayIterator($it);
+ }
+ function getIterator() {
+ return $this->it;
+ }
}
$it = new RecursiveArrayIteratorAggregated($ary);
echo "-- flags = BYPASS_KEY --\n";
foreach(new RecursiveTreeIterator($it) as $k => $v) {
- echo "[$k] => $v\n";
+ echo "[$k] => $v\n";
}
echo "-- flags = BYPASS_CURRENT --\n";
foreach(new RecursiveTreeIterator($it, RecursiveTreeIterator::BYPASS_CURRENT) as $k => $v) {
- echo "[$k] => $v\n";
+ echo "[$k] => $v\n";
}
echo "-- flags = BYPASS_KEY|BYPASS_KEY --\n";
foreach(new RecursiveTreeIterator($it, RecursiveTreeIterator::BYPASS_CURRENT|RecursiveTreeIterator::BYPASS_KEY) as $k => $v) {
- echo "[$k] => $v\n";
+ echo "[$k] => $v\n";
}
echo "-- flags = 0 --\n";
foreach(new RecursiveTreeIterator($it, 0) as $k => $v) {
- echo "[$k] => $v\n";
+ echo "[$k] => $v\n";
}
echo "-- flags = 0, caching_it_flags = CachingIterator::CATCH_GET_CHILD --\n";
foreach(new RecursiveTreeIterator($it, 0, CachingIterator::CATCH_GET_CHILD) as $k => $v) {
- echo "[$k] => $v\n";
+ echo "[$k] => $v\n";
}
?>
-===DONE===
---EXPECT--
+--EXPECTF--
-- flags = BYPASS_KEY --
[0] => |-Array
[0] => | |-a
@@ -70,22 +67,34 @@ foreach(new RecursiveTreeIterator($it, 0, CachingIterator::CATCH_GET_CHILD) as $
[0] => |-4
[1] => \-c
-- flags = BYPASS_CURRENT --
+
+Warning: Array to string conversion in %s on line %d
[|-0] => Array
[| |-0] => a
[| \-1] => 1
+
+Warning: Array to string conversion in %s on line %d
[\-a] => Array
[ |-0] => 2
[ |-1] => b
+
+Warning: Array to string conversion in %s on line %d
[ \-3] => Array
[ |-0] => 4
[ \-1] => c
-- flags = BYPASS_KEY|BYPASS_KEY --
+
+Warning: Array to string conversion in %s on line %d
[0] => Array
[0] => a
[1] => 1
+
+Warning: Array to string conversion in %s on line %d
[a] => Array
[0] => 2
[1] => b
+
+Warning: Array to string conversion in %s on line %d
[3] => Array
[0] => 4
[1] => c
@@ -109,4 +118,3 @@ foreach(new RecursiveTreeIterator($it, 0, CachingIterator::CATCH_GET_CHILD) as $
[ \-3] => \-Array
[ |-0] => |-4
[ \-1] => \-c
-===DONE===
diff --git a/ext/spl/tests/recursive_tree_iterator_007.phpt b/ext/spl/tests/recursive_tree_iterator_007.phpt
index a017254df0..196f6a1d90 100644
--- a/ext/spl/tests/recursive_tree_iterator_007.phpt
+++ b/ext/spl/tests/recursive_tree_iterator_007.phpt
@@ -8,26 +8,24 @@ error_reporting=E_ALL&~E_NOTICE
$ary = array(new stdClass);
class RecursiveArrayIteratorAggregated implements IteratorAggregate {
- public $it;
- function __construct($it) {
- $this->it = new RecursiveArrayIterator($it);
- }
- function getIterator() {
- return $this->it;
- }
+ public $it;
+ function __construct($it) {
+ $this->it = new RecursiveArrayIterator($it);
+ }
+ function getIterator() {
+ return $this->it;
+ }
}
$it = new RecursiveArrayIteratorAggregated($ary);
try {
- foreach(new RecursiveTreeIterator($it) as $k => $v) {
- echo "[$k] => $v\n";
- }
+ foreach(new RecursiveTreeIterator($it) as $k => $v) {
+ echo "[$k] => $v\n";
+ }
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ echo $e->getMessage(), "\n";
}
?>
-===DONE===
--EXPECT--
Object of class stdClass could not be converted to string
-===DONE===
diff --git a/ext/spl/tests/recursive_tree_iterator_008.phpt b/ext/spl/tests/recursive_tree_iterator_008.phpt
index 6ce555007d..fbdc3a5cb1 100644
--- a/ext/spl/tests/recursive_tree_iterator_008.phpt
+++ b/ext/spl/tests/recursive_tree_iterator_008.phpt
@@ -6,31 +6,30 @@ error_reporting=E_ALL&~E_NOTICE
<?php
$ary = array(
- "a" => array("b"),
- "c" => array("d"),
+ "a" => array("b"),
+ "c" => array("d"),
);
$it = new RecursiveArrayIterator($ary);
$it = new RecursiveTreeIterator($it);
for($i = 0; $i < 6; ++$i) {
- $it->setPrefixPart($i, $i);
+ $it->setPrefixPart($i, $i);
}
foreach($it as $k => $v) {
- echo "[$k] => $v\n";
+ echo "[$k] => $v\n";
}
try {
- $it->setPrefixPart(-1, "");
- $it->setPrefixPart(6, "");
+ $it->setPrefixPart(-1, "");
+ $it->setPrefixPart(6, "");
} catch (OutOfRangeException $e) {
- echo "OutOfRangeException thrown\n";
+ echo "OutOfRangeException thrown\n";
}
try {
- $it->setPrefixPart(6, "");
+ $it->setPrefixPart(6, "");
} catch (OutOfRangeException $e) {
- echo "OutOfRangeException thrown\n";
+ echo "OutOfRangeException thrown\n";
}
?>
-===DONE===
--EXPECT--
[a] => 035Array
[0] => 0145b
@@ -38,4 +37,3 @@ try {
[0] => 0245d
OutOfRangeException thrown
OutOfRangeException thrown
-===DONE===
diff --git a/ext/spl/tests/recursive_tree_iterator_setpostfix.phpt b/ext/spl/tests/recursive_tree_iterator_setpostfix.phpt
index b363c1dd4b..eea4da795a 100644
--- a/ext/spl/tests/recursive_tree_iterator_setpostfix.phpt
+++ b/ext/spl/tests/recursive_tree_iterator_setpostfix.phpt
@@ -6,22 +6,22 @@ Joshua Thijssen (jthijssen@noxlogic.nl)
<?php
$arr = array(
- 0 => array(
- "a",
- 1,
- ),
- "a" => array(
- 2,
- "b",
- 3 => array(
- 4,
- "c",
- ),
- "3" => array(
- 4,
- "c",
- ),
- ),
+ 0 => array(
+ "a",
+ 1,
+ ),
+ "a" => array(
+ 2,
+ "b",
+ 3 => array(
+ 4,
+ "c",
+ ),
+ "3" => array(
+ 4,
+ "c",
+ ),
+ ),
);
$it = new RecursiveArrayIterator($arr);
@@ -38,7 +38,7 @@ echo "\n\n";
echo "----\n";
foreach($it as $k => $v) {
- echo "[$k] => $v\n";
+ echo "[$k] => $v\n";
}
echo "----\n";
@@ -48,13 +48,12 @@ echo "\n\n";
echo "----\n";
foreach($it as $k => $v) {
- echo "[$k] => $v\n";
+ echo "[$k] => $v\n";
}
?>
-===DONE===
--EXPECT--
----
@@ -85,4 +84,3 @@ POSTFIX
[3] => \-Array
[0] => |-4
[1] => \-c
-===DONE===
diff --git a/ext/spl/tests/recursivecomparedualiterator.inc b/ext/spl/tests/recursivecomparedualiterator.inc
index 5b63e9f0b3..ad0657b9bd 100644
--- a/ext/spl/tests/recursivecomparedualiterator.inc
+++ b/ext/spl/tests/recursivecomparedualiterator.inc
@@ -16,54 +16,54 @@
*/
class RecursiveCompareDualIterator extends RecursiveIteratorIterator
{
- /** Used to keep end of recursion equality. That is en leaving a nesting
- * level we need to check whether both child iterators are at their end.
- */
- protected $equal = false;
+ /** Used to keep end of recursion equality. That is en leaving a nesting
+ * level we need to check whether both child iterators are at their end.
+ */
+ protected $equal = false;
- /** Construct from RecursiveDualIterator
- *
- * @param $it RecursiveDualIterator
- * @param $mode should be LEAVES_ONLY
- * @param $flags should be 0
- */
- function __construct(RecursiveDualIterator $it, $mode = self::LEAVES_ONLY, $flags = 0)
- {
- parent::__construct($it);
- }
+ /** Construct from RecursiveDualIterator
+ *
+ * @param $it RecursiveDualIterator
+ * @param $mode should be LEAVES_ONLY
+ * @param $flags should be 0
+ */
+ function __construct(RecursiveDualIterator $it, $mode = self::LEAVES_ONLY, $flags = 0)
+ {
+ parent::__construct($it);
+ }
- /** Rewind iteration andcomparison process. Starting with $equal = true.
- */
- function rewind()
- {
- $this->equal = true;
- parent::rewind();
- }
+ /** Rewind iteration andcomparison process. Starting with $equal = true.
+ */
+ function rewind()
+ {
+ $this->equal = true;
+ parent::rewind();
+ }
- /** Calculate $equal
- * @see $equal
- */
- function endChildren()
- {
- $this->equal &= !$this->getInnerIterator()->getLHS()->valid()
- && !$this->getInnerIterator()->getRHS()->valid();
- }
+ /** Calculate $equal
+ * @see $equal
+ */
+ function endChildren()
+ {
+ $this->equal &= !$this->getInnerIterator()->getLHS()->valid()
+ && !$this->getInnerIterator()->getRHS()->valid();
+ }
- /** @return whether both inner iterators are valid and have identical
- * current and key values or both are non valid.
- */
- function areIdentical()
- {
- return $this->equal && $this->getInnerIterator()->areIdentical();
- }
+ /** @return whether both inner iterators are valid and have identical
+ * current and key values or both are non valid.
+ */
+ function areIdentical()
+ {
+ return $this->equal && $this->getInnerIterator()->areIdentical();
+ }
- /** @return whether both inner iterators are valid and have equal current
- * and key values or both are non valid.
- */
- function areEqual()
- {
- return $this->equal && $this->getInnerIterator()->areEqual();
- }
+ /** @return whether both inner iterators are valid and have equal current
+ * and key values or both are non valid.
+ */
+ function areEqual()
+ {
+ return $this->equal && $this->getInnerIterator()->areEqual();
+ }
}
?>
diff --git a/ext/spl/tests/recursivedualiterator.inc b/ext/spl/tests/recursivedualiterator.inc
index a56984e083..45abf4c8f4 100644
--- a/ext/spl/tests/recursivedualiterator.inc
+++ b/ext/spl/tests/recursivedualiterator.inc
@@ -16,57 +16,57 @@
*/
class RecursiveDualIterator extends DualIterator implements RecursiveIterator
{
- private $ref;
+ private $ref;
- /** construct iterator from two RecursiveIterator instances
- *
- * @param lhs Left Hand Side Iterator
- * @param rhs Right Hand Side Iterator
- * @param flags iteration flags
- */
- function __construct(RecursiveIterator $lhs, RecursiveIterator $rhs,
- $flags = 0x33 /*DualIterator::DEFAULT_FLAGS*/)
- {
- parent::__construct($lhs, $rhs, $flags);
- }
+ /** construct iterator from two RecursiveIterator instances
+ *
+ * @param lhs Left Hand Side Iterator
+ * @param rhs Right Hand Side Iterator
+ * @param flags iteration flags
+ */
+ function __construct(RecursiveIterator $lhs, RecursiveIterator $rhs,
+ $flags = 0x33 /*DualIterator::DEFAULT_FLAGS*/)
+ {
+ parent::__construct($lhs, $rhs, $flags);
+ }
- /** @return whether both LHS and RHS have children
- */
- function hasChildren()
- {
- return $this->getLHS()->hasChildren() && $this->getRHS()->hasChildren();
- }
+ /** @return whether both LHS and RHS have children
+ */
+ function hasChildren()
+ {
+ return $this->getLHS()->hasChildren() && $this->getRHS()->hasChildren();
+ }
- /** @return new RecursiveDualIterator (late binding) for the two inner
- * iterators current children.
- */
- function getChildren()
- {
- if (empty($this->ref))
- {
- $this->ref = new ReflectionClass($this);
- }
- return $this->ref->newInstance(
- $this->getLHS()->getChildren(), $this->getRHS()->getChildren(), $this->getFlags());
- }
+ /** @return new RecursiveDualIterator (late binding) for the two inner
+ * iterators current children.
+ */
+ function getChildren()
+ {
+ if (empty($this->ref))
+ {
+ $this->ref = new ReflectionClass($this);
+ }
+ return $this->ref->newInstance(
+ $this->getLHS()->getChildren(), $this->getRHS()->getChildren(), $this->getFlags());
+ }
- /** @return whether both inner iterators are valid, have same hasChildren()
- * state and identical current and key values or both are non valid.
- */
- function areIdentical()
- {
- return $this->getLHS()->hasChildren() === $this->getRHS()->hasChildren()
- && parent::areIdentical();
- }
+ /** @return whether both inner iterators are valid, have same hasChildren()
+ * state and identical current and key values or both are non valid.
+ */
+ function areIdentical()
+ {
+ return $this->getLHS()->hasChildren() === $this->getRHS()->hasChildren()
+ && parent::areIdentical();
+ }
- /** @return whether both inner iterators are valid, have same hasChildren()
- * state and equal current and key values or both are invalid.
- */
- function areEqual()
- {
- return $this->getLHS()->hasChildren() === $this->getRHS()->hasChildren()
- && parent::areEqual();
- }
+ /** @return whether both inner iterators are valid, have same hasChildren()
+ * state and equal current and key values or both are invalid.
+ */
+ function areEqual()
+ {
+ return $this->getLHS()->hasChildren() === $this->getRHS()->hasChildren()
+ && parent::areEqual();
+ }
}
?>
diff --git a/ext/spl/tests/regexIterator_setMode_error.phpt b/ext/spl/tests/regexIterator_setMode_error.phpt
index 77732b058c..4816896d8a 100644
--- a/ext/spl/tests/regexIterator_setMode_error.phpt
+++ b/ext/spl/tests/regexIterator_setMode_error.phpt
@@ -11,18 +11,14 @@ $regexIterator = new RegexIterator(new ArrayIterator($array), "/f/");
var_dump($regexIterator->getMode());
try {
- $regexIterator->setMode(7);
+ $regexIterator->setMode(7);
} catch (InvalidArgumentException $e) {
- var_dump($e->getMessage());
- var_dump($e->getCode());
+ var_dump($e->getMessage());
+ var_dump($e->getCode());
}
-$regexIterator->setMode('foo');
-
?>
--EXPECTF--
int(0)
string(14) "Illegal mode 7"
int(0)
-
-Warning: RegexIterator::setMode() expects parameter 1 to be int, string given in %s on line %d
diff --git a/ext/spl/tests/spl_001.phpt b/ext/spl/tests/spl_001.phpt
index e101272a84..4fc0be3d0c 100644
--- a/ext/spl/tests/spl_001.phpt
+++ b/ext/spl/tests/spl_001.phpt
@@ -13,11 +13,10 @@ print_r($ar);
foreach($ar as $v)
{
- var_dump($v);
+ var_dump($v);
}
?>
-===DONE===
--EXPECT--
int(4)
Array
@@ -31,4 +30,3 @@ int(1)
int(5)
int(3)
int(4)
-===DONE===
diff --git a/ext/spl/tests/spl_002.phpt b/ext/spl/tests/spl_002.phpt
index d8b71b20cf..5442b1991d 100644
--- a/ext/spl/tests/spl_002.phpt
+++ b/ext/spl/tests/spl_002.phpt
@@ -5,10 +5,10 @@ SPL: Countable
class Test implements Countable
{
- function count()
- {
- return 4;
- }
+ function count()
+ {
+ return 4;
+ }
};
$a = new Test;
@@ -16,7 +16,5 @@ $a = new Test;
var_dump(count($a));
?>
-===DONE===
--EXPECT--
int(4)
-===DONE===
diff --git a/ext/spl/tests/spl_003.phpt b/ext/spl/tests/spl_003.phpt
index 3dd9ab3482..a9080c7298 100644
--- a/ext/spl/tests/spl_003.phpt
+++ b/ext/spl/tests/spl_003.phpt
@@ -30,8 +30,6 @@ var_dump(class_implements(new a),
);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
Warning: class_parents(): Class foo does not exist in %sspl_003.php on line %d
string(3) "foo"
@@ -72,4 +70,3 @@ array(0) {
}
bool(false)
bool(false)
-===DONE===
diff --git a/ext/spl/tests/spl_004.phpt b/ext/spl/tests/spl_004.phpt
index 60de68b82a..570b4ae226 100644
--- a/ext/spl/tests/spl_004.phpt
+++ b/ext/spl/tests/spl_004.phpt
@@ -4,30 +4,30 @@ SPL: iterator_apply()
<?php
function my_error_handler($errno, $errstr, $errfile, $errline) {
- echo "Error: $errstr\n";
+ echo "Error: $errstr\n";
}
set_error_handler('my_error_handler');
function test_arg($arg)
{
- if ($arg instanceof Iterator)
- {
- var_dump($arg->key());
- var_dump($arg->current());
- }
- else
- {
- var_dump($arg);
- }
- return true;
+ if ($arg instanceof Iterator)
+ {
+ var_dump($arg->key());
+ var_dump($arg->current());
+ }
+ else
+ {
+ var_dump($arg);
+ }
+ return true;
}
function test()
{
- static $arg = 0;
- var_dump($arg++);
- return true;
+ static $arg = 0;
+ var_dump($arg++);
+ return true;
}
$it = new RecursiveArrayIterator(array(1, array(21, 22), 3));
@@ -43,16 +43,22 @@ var_dump(iterator_apply($it, 'test'));
echo "===ERRORS===\n";
try {
- var_dump(iterator_apply($it, 'test', 1));
-} catch (Error $e) {
- my_error_handler($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
+ var_dump(iterator_apply($it, 'test', 1));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(iterator_apply($it, 'non_existing_function'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(iterator_apply($it, 'non_existing_function', NULL, 2));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
}
-var_dump(iterator_apply($it, 'non_existing_function'));
-var_dump(iterator_apply($it, 'non_existing_function', NULL, 2));
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
int(0)
int(1)
@@ -78,9 +84,6 @@ int(5)
int(6)
int(4)
===ERRORS===
-Error: Argument 3 passed to iterator_apply() must be of the type array or null, int given
-Error: iterator_apply() expects parameter 2 to be a valid callback, function 'non_existing_function' not found or invalid function name
-NULL
-Error: iterator_apply() expects at most 3 parameters, 4 given
-NULL
-===DONE===
+iterator_apply() expects parameter 3 to be array, int given
+iterator_apply() expects parameter 2 to be a valid callback, function 'non_existing_function' not found or invalid function name
+iterator_apply() expects at most 3 parameters, 4 given
diff --git a/ext/spl/tests/spl_006.phpt b/ext/spl/tests/spl_006.phpt
index 1f5f85fb6d..b56ab67354 100644
--- a/ext/spl/tests/spl_006.phpt
+++ b/ext/spl/tests/spl_006.phpt
@@ -12,7 +12,6 @@ var_dump(iterator_to_array($it, false));
var_dump(iterator_to_array($it, true));
?>
-===DONE===
--EXPECT--
array(2) {
[0]=>
@@ -36,4 +35,3 @@ array(2) {
[1]=>
int(3)
}
-===DONE===
diff --git a/ext/spl/tests/spl_007.phpt b/ext/spl/tests/spl_007.phpt
index 6d4059d0b5..b119684894 100644
--- a/ext/spl/tests/spl_007.phpt
+++ b/ext/spl/tests/spl_007.phpt
@@ -15,10 +15,7 @@ $it = new ArrayIterator(array(1, 2, 3));
iterator_apply($it, array(new Foo, "foobar"));
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
Called foobar.
Called foobar.
Called foobar.
-===DONE===
diff --git a/ext/spl/tests/spl_autoload_001.phpt b/ext/spl/tests/spl_autoload_001.phpt
index fc5f6ed4f7..6025ac6538 100644
--- a/ext/spl/tests/spl_autoload_001.phpt
+++ b/ext/spl/tests/spl_autoload_001.phpt
@@ -17,7 +17,7 @@ if (!class_exists("TestClass")) {
$test_exts = array(NULL, "1", ".inc,,.php.inc", "");
foreach($test_exts as $exts) {
- echo "===($exts)===\n";
+ echo "===($exts)===\n";
spl_autoload("TestClass", $exts);
if (!class_exists("TestClass")) {
echo "Class TestClass could not be loaded\n";
@@ -32,12 +32,12 @@ if (!class_exists("TestClass")) {
function TestFunc1($classname)
{
- echo __METHOD__ . "($classname)\n";
+ echo __METHOD__ . "($classname)\n";
}
function TestFunc2($classname)
{
- echo __METHOD__ . "($classname)\n";
+ echo __METHOD__ . "($classname)\n";
}
echo "===SPL_AUTOLOAD()===\n";
@@ -66,16 +66,14 @@ echo "===NOFUNCTION===\n";
try
{
- spl_autoload_register("unavailable_autoload_function");
+ spl_autoload_register("unavailable_autoload_function");
}
catch(Exception $e)
{
- echo 'Exception: ' . $e->getMessage() . "\n";
+ echo 'Exception: ' . $e->getMessage() . "\n";
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
===EMPTY===
string(9) ".inc,.php"
@@ -106,4 +104,3 @@ TestFunc2(TestClass)
bool(true)
===NOFUNCTION===
Exception: Function 'unavailable_autoload_function' not found (function 'unavailable_autoload_function' not found or invalid function name)
-===DONE===
diff --git a/ext/spl/tests/spl_autoload_002.phpt b/ext/spl/tests/spl_autoload_002.phpt
index 778b22a7d0..98ba09dad8 100644
--- a/ext/spl/tests/spl_autoload_002.phpt
+++ b/ext/spl/tests/spl_autoload_002.phpt
@@ -39,8 +39,6 @@ spl_autoload_unregister('spl_autoload');
var_dump(spl_autoload_functions());
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
bool(false)
array(1) {
@@ -67,4 +65,3 @@ array(1) {
string(12) "spl_autoload"
}
bool(false)
-===DONE===
diff --git a/ext/spl/tests/spl_autoload_003.phpt b/ext/spl/tests/spl_autoload_003.phpt
index 6fe7a38b30..016bcf2394 100644
--- a/ext/spl/tests/spl_autoload_003.phpt
+++ b/ext/spl/tests/spl_autoload_003.phpt
@@ -7,18 +7,18 @@ include_path=.
function TestFunc1($classname)
{
- echo __METHOD__ . "($classname)\n";
+ echo __METHOD__ . "($classname)\n";
}
function TestFunc2($classname)
{
- echo __METHOD__ . "($classname)\n";
- throw new Exception("Class $classname missing");
+ echo __METHOD__ . "($classname)\n";
+ throw new Exception("Class $classname missing");
}
function TestFunc3($classname)
{
- echo __METHOD__ . "($classname)\n";
+ echo __METHOD__ . "($classname)\n";
}
spl_autoload_register("TestFunc1");
@@ -27,18 +27,15 @@ spl_autoload_register("TestFunc3");
try
{
- var_dump(class_exists("TestClass", true));
+ var_dump(class_exists("TestClass", true));
}
catch(Exception $e)
{
- echo 'Exception: ' . $e->getMessage() . "\n";
+ echo 'Exception: ' . $e->getMessage() . "\n";
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
TestFunc1(TestClass)
TestFunc2(TestClass)
Exception: Class TestClass missing
-===DONE===
diff --git a/ext/spl/tests/spl_autoload_004.phpt b/ext/spl/tests/spl_autoload_004.phpt
index 7dac3abcea..8e1eafc37a 100644
--- a/ext/spl/tests/spl_autoload_004.phpt
+++ b/ext/spl/tests/spl_autoload_004.phpt
@@ -8,7 +8,7 @@ include_path=.
class MyAutoLoader {
static function autoLoad($className) {
- echo __METHOD__ . "($className)\n";
+ echo __METHOD__ . "($className)\n";
}
}
@@ -26,8 +26,6 @@ var_dump(spl_autoload_functions());
var_dump(class_exists("TestClass", true));
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
array(1) {
[0]=>
@@ -40,4 +38,3 @@ array(1) {
}
MyAutoLoader::autoLoad(TestClass)
bool(false)
-===DONE===
diff --git a/ext/spl/tests/spl_autoload_005.phpt b/ext/spl/tests/spl_autoload_005.phpt
index ccebf91f04..53fbf27663 100644
--- a/ext/spl/tests/spl_autoload_005.phpt
+++ b/ext/spl/tests/spl_autoload_005.phpt
@@ -9,23 +9,23 @@ class MyAutoLoader {
function autoLoad($className)
{
- echo __METHOD__ . "($className)\n";
+ echo __METHOD__ . "($className)\n";
}
function autoThrow($className)
{
- echo __METHOD__ . "($className)\n";
- throw new Exception("Unavailable");
+ echo __METHOD__ . "($className)\n";
+ throw new Exception("Unavailable");
}
}
try
{
- spl_autoload_register(array('MyAutoLoader', 'autoLoad'), true);
+ spl_autoload_register(array('MyAutoLoader', 'autoLoad'), true);
}
catch(Exception $e)
{
- echo 'Exception: ' . $e->getMessage() . "\n";
+ echo 'Exception: ' . $e->getMessage() . "\n";
}
// and
@@ -37,19 +37,16 @@ spl_autoload_register(array($myAutoLoader, 'autoThrow'));
try
{
- var_dump(class_exists("TestClass", true));
+ var_dump(class_exists("TestClass", true));
}
catch(Exception $e)
{
- echo 'Exception: ' . $e->getMessage() . "\n";
+ echo 'Exception: ' . $e->getMessage() . "\n";
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
-Exception: Passed array specifies a non static method but no object (non-static method MyAutoLoader::autoLoad() should not be called statically)
+Exception: Passed array specifies a non static method but no object (non-static method MyAutoLoader::autoLoad() cannot be called statically)
MyAutoLoader::autoLoad(TestClass)
MyAutoLoader::autoThrow(TestClass)
Exception: Unavailable
-===DONE===
diff --git a/ext/spl/tests/spl_autoload_006.phpt b/ext/spl/tests/spl_autoload_006.phpt
index a8d6619b19..7db2b462ca 100644
--- a/ext/spl/tests/spl_autoload_006.phpt
+++ b/ext/spl/tests/spl_autoload_006.phpt
@@ -8,7 +8,7 @@ include_path=.
class MyAutoLoader {
static function autoLoad($className) {
- echo __METHOD__ . "($className)\n";
+ echo __METHOD__ . "($className)\n";
}
}
@@ -20,8 +20,6 @@ var_dump(spl_autoload_functions());
var_dump(class_exists("TestClass", true));
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
array(1) {
[0]=>
@@ -34,4 +32,3 @@ array(1) {
}
MyAutoLoader::autoLoad(TestClass)
bool(false)
-===DONE===
diff --git a/ext/spl/tests/spl_autoload_007.phpt b/ext/spl/tests/spl_autoload_007.phpt
index 3233120790..db5f394260 100644
--- a/ext/spl/tests/spl_autoload_007.phpt
+++ b/ext/spl/tests/spl_autoload_007.phpt
@@ -8,53 +8,51 @@ include_path=.
class MyAutoLoader {
static protected function noAccess($className) {
- echo __METHOD__ . "($className)\n";
+ echo __METHOD__ . "($className)\n";
}
static function autoLoad($className) {
- echo __METHOD__ . "($className)\n";
+ echo __METHOD__ . "($className)\n";
}
function dynaLoad($className) {
- echo __METHOD__ . "($className)\n";
+ echo __METHOD__ . "($className)\n";
}
}
$obj = new MyAutoLoader;
$funcs = array(
- 'MyAutoLoader::notExist',
- 'MyAutoLoader::noAccess',
- 'MyAutoLoader::autoLoad',
- 'MyAutoLoader::dynaLoad',
- array('MyAutoLoader', 'notExist'),
- array('MyAutoLoader', 'noAccess'),
- array('MyAutoLoader', 'autoLoad'),
- array('MyAutoLoader', 'dynaLoad'),
- array($obj, 'notExist'),
- array($obj, 'noAccess'),
- array($obj, 'autoLoad'),
- array($obj, 'dynaLoad'),
+ 'MyAutoLoader::notExist',
+ 'MyAutoLoader::noAccess',
+ 'MyAutoLoader::autoLoad',
+ 'MyAutoLoader::dynaLoad',
+ array('MyAutoLoader', 'notExist'),
+ array('MyAutoLoader', 'noAccess'),
+ array('MyAutoLoader', 'autoLoad'),
+ array('MyAutoLoader', 'dynaLoad'),
+ array($obj, 'notExist'),
+ array($obj, 'noAccess'),
+ array($obj, 'autoLoad'),
+ array($obj, 'dynaLoad'),
);
foreach($funcs as $idx => $func)
{
- if ($idx) echo "\n";
- try
- {
- var_dump($func);
- spl_autoload_register($func);
- echo "ok\n";
- }
- catch (Exception $e)
- {
- echo $e->getMessage() . "\n";
- }
+ if ($idx) echo "\n";
+ try
+ {
+ var_dump($func);
+ spl_autoload_register($func);
+ echo "ok\n";
+ }
+ catch (Exception $e)
+ {
+ echo $e->getMessage() . "\n";
+ }
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
string(22) "MyAutoLoader::notExist"
Function 'MyAutoLoader::notExist' not found (class 'MyAutoLoader' does not have a method 'notExist')
@@ -66,7 +64,7 @@ string(22) "MyAutoLoader::autoLoad"
ok
string(22) "MyAutoLoader::dynaLoad"
-Function 'MyAutoLoader::dynaLoad' not callable (non-static method MyAutoLoader::dynaLoad() should not be called statically)
+Function 'MyAutoLoader::dynaLoad' not callable (non-static method MyAutoLoader::dynaLoad() cannot be called statically)
array(2) {
[0]=>
@@ -98,7 +96,7 @@ array(2) {
[1]=>
string(8) "dynaLoad"
}
-Passed array specifies a non static method but no object (non-static method MyAutoLoader::dynaLoad() should not be called statically)
+Passed array specifies a non static method but no object (non-static method MyAutoLoader::dynaLoad() cannot be called statically)
array(2) {
[0]=>
@@ -135,4 +133,3 @@ array(2) {
string(8) "dynaLoad"
}
ok
-===DONE===
diff --git a/ext/spl/tests/spl_autoload_008.phpt b/ext/spl/tests/spl_autoload_008.phpt
index df795d02b6..eadc861ca1 100644
--- a/ext/spl/tests/spl_autoload_008.phpt
+++ b/ext/spl/tests/spl_autoload_008.phpt
@@ -7,64 +7,62 @@ include_path=.
function MyAutoLoad($className)
{
- echo __METHOD__ . "($className)\n";
- throw new Exception('Bla');
+ echo __METHOD__ . "($className)\n";
+ throw new Exception('Bla');
}
class MyAutoLoader
{
- static function autoLoad($className)
- {
- echo __METHOD__ . "($className)\n";
- throw new Exception('Bla');
- }
+ static function autoLoad($className)
+ {
+ echo __METHOD__ . "($className)\n";
+ throw new Exception('Bla');
+ }
- function dynaLoad($className)
- {
- echo __METHOD__ . "($className)\n";
- throw new Exception('Bla');
- }
+ function dynaLoad($className)
+ {
+ echo __METHOD__ . "($className)\n";
+ throw new Exception('Bla');
+ }
}
$obj = new MyAutoLoader;
$funcs = array(
- 'MyAutoLoad',
- 'MyAutoLoader::autoLoad',
- 'MyAutoLoader::dynaLoad',
- array('MyAutoLoader', 'autoLoad'),
- array('MyAutoLoader', 'dynaLoad'),
- array($obj, 'autoLoad'),
- array($obj, 'dynaLoad'),
+ 'MyAutoLoad',
+ 'MyAutoLoader::autoLoad',
+ 'MyAutoLoader::dynaLoad',
+ array('MyAutoLoader', 'autoLoad'),
+ array('MyAutoLoader', 'dynaLoad'),
+ array($obj, 'autoLoad'),
+ array($obj, 'dynaLoad'),
);
foreach($funcs as $idx => $func)
{
- echo "====$idx====\n";
+ echo "====$idx====\n";
- try
- {
- var_dump($func);
- spl_autoload_register($func);
- if (count(spl_autoload_functions()))
- {
- echo "registered\n";
+ try
+ {
+ var_dump($func);
+ spl_autoload_register($func);
+ if (count(spl_autoload_functions()))
+ {
+ echo "registered\n";
- var_dump(class_exists("NoExistingTestClass", true));
- }
- }
- catch (Exception $e)
- {
- echo get_class($e) . ": " . $e->getMessage() . "\n";
- }
+ var_dump(class_exists("NoExistingTestClass", true));
+ }
+ }
+ catch (Exception $e)
+ {
+ echo get_class($e) . ": " . $e->getMessage() . "\n";
+ }
- spl_autoload_unregister($func);
- var_dump(count(spl_autoload_functions()));
+ spl_autoload_unregister($func);
+ var_dump(count(spl_autoload_functions()));
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
====0====
string(10) "MyAutoLoad"
@@ -80,7 +78,7 @@ Exception: Bla
int(0)
====2====
string(22) "MyAutoLoader::dynaLoad"
-LogicException: Function 'MyAutoLoader::dynaLoad' not callable (non-static method MyAutoLoader::dynaLoad() should not be called statically)
+LogicException: Function 'MyAutoLoader::dynaLoad' not callable (non-static method MyAutoLoader::dynaLoad() cannot be called statically)
int(0)
====3====
array(2) {
@@ -100,7 +98,7 @@ array(2) {
[1]=>
string(8) "dynaLoad"
}
-LogicException: Passed array specifies a non static method but no object (non-static method MyAutoLoader::dynaLoad() should not be called statically)
+LogicException: Passed array specifies a non static method but no object (non-static method MyAutoLoader::dynaLoad() cannot be called statically)
int(0)
====5====
array(2) {
@@ -126,4 +124,3 @@ registered
MyAutoLoader::dynaLoad(NoExistingTestClass)
Exception: Bla
int(0)
-===DONE===
diff --git a/ext/spl/tests/spl_autoload_009.phpt b/ext/spl/tests/spl_autoload_009.phpt
index d5e54137eb..f12fd0af7e 100644
--- a/ext/spl/tests/spl_autoload_009.phpt
+++ b/ext/spl/tests/spl_autoload_009.phpt
@@ -7,8 +7,8 @@ include_path=.
function my_autoload($name)
{
- require $name . '.class.inc';
- var_dump(class_exists($name));
+ require $name . '.class.inc';
+ var_dump(class_exists($name));
}
spl_autoload_register("spl_autoload");
@@ -17,10 +17,7 @@ spl_autoload_register("my_autoload");
$obj = new testclass;
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
%stestclass.inc
%stestclass.class.inc
bool(true)
-===DONE===
diff --git a/ext/spl/tests/spl_autoload_010.phpt b/ext/spl/tests/spl_autoload_010.phpt
index 239b8366ec..3b0754d8df 100644
--- a/ext/spl/tests/spl_autoload_010.phpt
+++ b/ext/spl/tests/spl_autoload_010.phpt
@@ -21,10 +21,7 @@ spl_autoload_register('autoloadC');
new C;
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
B -> C
A -> C
C -> C
-===DONE===
diff --git a/ext/spl/tests/spl_autoload_011.phpt b/ext/spl/tests/spl_autoload_011.phpt
index f2bc9496f7..771726ee56 100644
--- a/ext/spl/tests/spl_autoload_011.phpt
+++ b/ext/spl/tests/spl_autoload_011.phpt
@@ -23,7 +23,6 @@ unset($a);
var_dump(class_exists("C", true));
?>
===DONE===
-<?php exit(0); ?>
--EXPECT--
var:2
bool(false)
diff --git a/ext/spl/tests/spl_autoload_013.phpt b/ext/spl/tests/spl_autoload_013.phpt
index c956ccd92f..fe71562273 100644
--- a/ext/spl/tests/spl_autoload_013.phpt
+++ b/ext/spl/tests/spl_autoload_013.phpt
@@ -1,5 +1,5 @@
--TEST--
-SPL: spl_autoload_functions() with closures and invokables
+SPL: spl_autoload_functions() with closures and invocables
--FILE--
<?php
$closure = function($class) {
@@ -26,7 +26,6 @@ spl_autoload_register($al2);
var_dump(spl_autoload_functions());
?>
-===DONE===
--EXPECTF--
array(3) {
[0]=>
@@ -48,4 +47,3 @@ array(3) {
string(2) "d2"
}
}
-===DONE===
diff --git a/ext/spl/tests/spl_autoload_014.phpt b/ext/spl/tests/spl_autoload_014.phpt
index 782fe8d07e..3c7cc38f63 100644
--- a/ext/spl/tests/spl_autoload_014.phpt
+++ b/ext/spl/tests/spl_autoload_014.phpt
@@ -1,5 +1,5 @@
--TEST--
-SPL: spl_autoload_unregister() with closures and invokables
+SPL: spl_autoload_unregister() with closures and invocables
--FILE--
<?php
$closure = function($class) {
@@ -38,10 +38,8 @@ spl_autoload_unregister($al1);
$y = new TestY;
?>
-===DONE===
--EXPECT--
closure called with class TestX
Autoloader('d1') called with TestX
WorkingAutoloader() called with TestX
WorkingAutoloader() called with TestY
-===DONE===
diff --git a/ext/spl/tests/spl_autoload_bug48541.phpt b/ext/spl/tests/spl_autoload_bug48541.phpt
index 4936270d3b..acdf36aa71 100644
--- a/ext/spl/tests/spl_autoload_bug48541.phpt
+++ b/ext/spl/tests/spl_autoload_bug48541.phpt
@@ -30,10 +30,8 @@ spl_autoload_register($c);
spl_autoload_register($c2);
$c = new foo;
?>
-===DONE===
--EXPECT--
a called
a2 called
b called
foo
-===DONE===
diff --git a/ext/spl/tests/spl_caching_iterator_constructor_flags.phpt b/ext/spl/tests/spl_caching_iterator_constructor_flags.phpt
index f45625f045..29bae9469d 100644
--- a/ext/spl/tests/spl_caching_iterator_constructor_flags.phpt
+++ b/ext/spl/tests/spl_caching_iterator_constructor_flags.phpt
@@ -19,7 +19,5 @@ $test = new CachingIterator($arrayIterator, 3); // this throws an exception
?>
-===DONE===
--EXPECT--
Flags must contain only one of CALL_TOSTRING, TOSTRING_USE_KEY, TOSTRING_USE_CURRENT, TOSTRING_USE_INNER
-===DONE===
diff --git a/ext/spl/tests/spl_cachingiterator___toString_basic.phpt b/ext/spl/tests/spl_cachingiterator___toString_basic.phpt
index 91948c80b4..a3ad699917 100644
--- a/ext/spl/tests/spl_cachingiterator___toString_basic.phpt
+++ b/ext/spl/tests/spl_cachingiterator___toString_basic.phpt
@@ -9,7 +9,7 @@ Chris Scott chris.scott@nstein.com
$ai = new ArrayIterator(array(new stdClass(), new stdClass()));
$ci = new CachingIterator($ai);
var_dump(
-$ci->__toString() // if conversion to string is done by echo, for example, an exeption is thrown. Invoking __toString explicitly covers different code.
+$ci->__toString() // if conversion to string is done by echo, for example, an exception is thrown. Invoking __toString explicitly covers different code.
);
?>
--EXPECT--
diff --git a/ext/spl/tests/spl_fileinfo_getlinktarget_basic.phpt b/ext/spl/tests/spl_fileinfo_getlinktarget_basic.phpt
index cee557e330..92aae6dc78 100644
--- a/ext/spl/tests/spl_fileinfo_getlinktarget_basic.phpt
+++ b/ext/spl/tests/spl_fileinfo_getlinktarget_basic.phpt
@@ -13,7 +13,7 @@ symlink(__FILE__, $link );
$fileInfo = new SplFileInfo($link);
if ($fileInfo->isLink()) {
- echo $fileInfo->getLinkTarget() == __FILE__ ? 'same' : 'different',PHP_EOL;
+ echo $fileInfo->getLinkTarget() == __FILE__ ? 'same' : 'different',PHP_EOL;
}
var_dump(unlink($link));
?>
diff --git a/ext/spl/tests/spl_heap_count_basic.phpt b/ext/spl/tests/spl_heap_count_basic.phpt
index 3bdd6580dc..2be8c432fc 100644
--- a/ext/spl/tests/spl_heap_count_basic.phpt
+++ b/ext/spl/tests/spl_heap_count_basic.phpt
@@ -24,9 +24,9 @@ class MyHeap extends SplHeap
$heap = new MyHeap();
$heap->insert(1);
try {
- count($heap);// refers to MyHeap->count() method
+ count($heap);// refers to MyHeap->count() method
} catch (Exception $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
?>
diff --git a/ext/spl/tests/spl_heap_is_empty_basic.phpt b/ext/spl/tests/spl_heap_is_empty_basic.phpt
index 47d7ccce9a..4a90734ad4 100644
--- a/ext/spl/tests/spl_heap_is_empty_basic.phpt
+++ b/ext/spl/tests/spl_heap_is_empty_basic.phpt
@@ -21,11 +21,8 @@ $heap->insert(1);
var_dump($heap->isEmpty());
$heap->extract();
var_dump($heap->isEmpty());
-$heap->isEmpty('var');
?>
--EXPECTF--
bool(true)
bool(false)
bool(true)
-
-Warning: SplHeap::isEmpty() expects exactly 0 parameters, 1 given in %s
diff --git a/ext/spl/tests/spl_iterator_apply_error.phpt b/ext/spl/tests/spl_iterator_apply_error.phpt
index 8e7cba483a..c73fe468a1 100644
--- a/ext/spl/tests/spl_iterator_apply_error.phpt
+++ b/ext/spl/tests/spl_iterator_apply_error.phpt
@@ -4,9 +4,9 @@ SPL: Error: iterator_apply when an iterator method (eg rewind) throws exception
<?php
class MyArrayIterator extends ArrayIterator {
- public function rewind() {
- throw new Exception('Make the iterator break');
- }
+ public function rewind() {
+ throw new Exception('Make the iterator break');
+ }
}
function test() {}
@@ -14,9 +14,9 @@ function test() {}
$it = new MyArrayIterator(array(1, 21, 22));
try {
- $res = iterator_apply($it, 'test');
+ $res = iterator_apply($it, 'test');
} catch (Exception $e) {
- echo $e->getMessage();
+ echo $e->getMessage();
}
?>
diff --git a/ext/spl/tests/spl_iterator_apply_error_001.phpt b/ext/spl/tests/spl_iterator_apply_error_001.phpt
index 54663c0da8..9c021cf98f 100644
--- a/ext/spl/tests/spl_iterator_apply_error_001.phpt
+++ b/ext/spl/tests/spl_iterator_apply_error_001.phpt
@@ -4,15 +4,15 @@ SPL: Error: iterator_apply when the callback throws an exception
<?php
function test() {
- throw new Exception('Broken callback');
+ throw new Exception('Broken callback');
}
$it = new RecursiveArrayIterator(array(1, 21, 22));
try {
- iterator_apply($it, 'test');
+ iterator_apply($it, 'test');
} catch (Exception $e) {
- echo $e->getMessage();
+ echo $e->getMessage();
}
?>
diff --git a/ext/spl/tests/spl_iterator_caching_count_basic.phpt b/ext/spl/tests/spl_iterator_caching_count_basic.phpt
index 4d9c90f86b..136704dbd6 100644
--- a/ext/spl/tests/spl_iterator_caching_count_basic.phpt
+++ b/ext/spl/tests/spl_iterator_caching_count_basic.phpt
@@ -11,11 +11,9 @@ foreach ($i as $value) {
echo $i->count()."\n";
}
?>
-===DONE===
--EXPECT--
1
2
3
4
5
-===DONE===
diff --git a/ext/spl/tests/spl_iterator_caching_count_error.phpt b/ext/spl/tests/spl_iterator_caching_count_error.phpt
index 68d92dcf38..f3a91b5cf4 100644
--- a/ext/spl/tests/spl_iterator_caching_count_error.phpt
+++ b/ext/spl/tests/spl_iterator_caching_count_error.phpt
@@ -15,7 +15,5 @@ try {
}
?>
-===DONE===
--EXPECT--
Exception raised
-===DONE===
diff --git a/ext/spl/tests/spl_iterator_caching_getcache_error.phpt b/ext/spl/tests/spl_iterator_caching_getcache_error.phpt
index 9db726df43..61ca47ce57 100644
--- a/ext/spl/tests/spl_iterator_caching_getcache_error.phpt
+++ b/ext/spl/tests/spl_iterator_caching_getcache_error.phpt
@@ -15,7 +15,5 @@ try {
}
?>
-===DONE===
--EXPECT--
Exception raised
-===DONE===
diff --git a/ext/spl/tests/spl_iterator_getcallchildren.phpt b/ext/spl/tests/spl_iterator_getcallchildren.phpt
index 8d825481fb..e14acd12da 100644
--- a/ext/spl/tests/spl_iterator_getcallchildren.phpt
+++ b/ext/spl/tests/spl_iterator_getcallchildren.phpt
@@ -23,7 +23,6 @@ var_dump($output);
?>
-===DONE===
--EXPECT--
array(3) {
[0]=>
@@ -36,4 +35,3 @@ var_dump($output);
int(7)
invalid argument exception
NULL
-===DONE===
diff --git a/ext/spl/tests/spl_iterator_iterator_constructor.phpt b/ext/spl/tests/spl_iterator_iterator_constructor.phpt
index 97ceee219c..95457484c8 100644
--- a/ext/spl/tests/spl_iterator_iterator_constructor.phpt
+++ b/ext/spl/tests/spl_iterator_iterator_constructor.phpt
@@ -20,7 +20,5 @@ try {
}
?>
-===DONE===
--EXPECT--
IteratorIterator::__construct() expects at most 2 parameters, 3 given
-===DONE===
diff --git a/ext/spl/tests/spl_iterator_to_array_error.phpt b/ext/spl/tests/spl_iterator_to_array_error.phpt
index 755ef7b990..2704fea29d 100644
--- a/ext/spl/tests/spl_iterator_to_array_error.phpt
+++ b/ext/spl/tests/spl_iterator_to_array_error.phpt
@@ -4,25 +4,25 @@ SPL: Error: iterator_to_array when the current operation throws an exception
<?php
class MyArrayIterator extends ArrayIterator {
- public function current() {
- throw new Exception('Make the iterator break');
- }
+ public function current() {
+ throw new Exception('Make the iterator break');
+ }
}
$it = new MyArrayIterator(array(4, 6, 2));
try {
- // get keys
- $ar = iterator_to_array($it);
+ // get keys
+ $ar = iterator_to_array($it);
} catch (Exception $e) {
- echo $e->getMessage() . PHP_EOL;
+ echo $e->getMessage() . PHP_EOL;
}
try {
- // get values
- $ar = iterator_to_array($it, false);
+ // get values
+ $ar = iterator_to_array($it, false);
} catch (Exception $e) {
- echo $e->getMessage() . PHP_EOL;
+ echo $e->getMessage() . PHP_EOL;
}
?>
diff --git a/ext/spl/tests/spl_limit_iterator_check_limits.phpt b/ext/spl/tests/spl_limit_iterator_check_limits.phpt
index 03bdb787ae..83b99b5c85 100644
--- a/ext/spl/tests/spl_limit_iterator_check_limits.phpt
+++ b/ext/spl/tests/spl_limit_iterator_check_limits.phpt
@@ -30,8 +30,6 @@ try {
?>
-===DONE===
--EXPECT--
Parameter offset must be >= 0
Parameter count must either be -1 or a value greater than or equal 0
-===DONE===
diff --git a/ext/spl/tests/spl_object_id.phpt b/ext/spl/tests/spl_object_id.phpt
index ca13b03fee..a4e8518eaf 100644
--- a/ext/spl/tests/spl_object_id.phpt
+++ b/ext/spl/tests/spl_object_id.phpt
@@ -4,18 +4,10 @@ SPL: spl_object_id()
<?php
var_dump(spl_object_id(new stdClass));
-var_dump(spl_object_id(42));
-var_dump(spl_object_id());
$a = new stdClass();
var_dump(spl_object_id(new stdClass) === spl_object_id($a));
?>
--EXPECTF--
int(%d)
-
-Warning: spl_object_id() expects parameter 1 to be object, int given in %sspl_object_id.php on line %d
-NULL
-
-Warning: spl_object_id() expects exactly 1 parameter, 0 given in %sspl_object_id.php on line %d
-NULL
bool(false)
diff --git a/ext/spl/tests/spl_pq_top_error_corrupt.phpt b/ext/spl/tests/spl_pq_top_error_corrupt.phpt
index 30b6fde5a1..838e763447 100644
--- a/ext/spl/tests/spl_pq_top_error_corrupt.phpt
+++ b/ext/spl/tests/spl_pq_top_error_corrupt.phpt
@@ -8,13 +8,13 @@ Nathaniel McHugh nat@fishtrap.co.uk
class myPriorityQueue extends SplPriorityQueue{
- public function compare($a, $b){
- if ($b == 2) {
- throw new Exception('ignore me');
- } else {
- return parent::compare($a, $b);
- }
- }
+ public function compare($a, $b){
+ if ($b == 2) {
+ throw new Exception('ignore me');
+ } else {
+ return parent::compare($a, $b);
+ }
+ }
}
$priorityQueue = new myPriorityQueue();
diff --git a/ext/spl/tests/spl_pqueue_gc.phpt b/ext/spl/tests/spl_pqueue_gc.phpt
index cc392cbac2..18c96c5a29 100644
--- a/ext/spl/tests/spl_pqueue_gc.phpt
+++ b/ext/spl/tests/spl_pqueue_gc.phpt
@@ -1,7 +1,7 @@
--TEST--
Bug #78436: Broken GC for SplPriorityQueue
--FILE--
-<?php
+<?php
$pqueue = new SplPriorityQueue();
$pqueue->insert($pqueue, 1);
diff --git a/ext/spl/tests/unserialize.phpt b/ext/spl/tests/unserialize.phpt
index 3232b79678..97031ceac4 100644
--- a/ext/spl/tests/unserialize.phpt
+++ b/ext/spl/tests/unserialize.phpt
@@ -6,19 +6,18 @@ SPL: unserialize with no data (for PHPUnit)
$types = array('SplDoublyLinkedList', 'SplObjectStorage', 'ArrayObject');
foreach ($types as $type) {
- // serialize an empty new object
- $exp = serialize(new $type());
- // hack to instanciate an object without constructor
- $str = sprintf('C:%d:"%s":0:{}', strlen($type), $type);
- $obj = unserialize($str);
- var_dump($obj);
- // serialize result
- $out = serialize($obj);
- // both should match
- var_dump($exp === $out);
+ // serialize an empty new object
+ $exp = serialize(new $type());
+ // hack to instantiate an object without constructor
+ $str = sprintf('C:%d:"%s":0:{}', strlen($type), $type);
+ $obj = unserialize($str);
+ var_dump($obj);
+ // serialize result
+ $out = serialize($obj);
+ // both should match
+ var_dump($exp === $out);
}
?>
-===DONE===
--EXPECTF--
object(SplDoublyLinkedList)#%d (2) {
["flags":"SplDoublyLinkedList":private]=>
@@ -40,4 +39,3 @@ object(ArrayObject)#%d (1) {
}
}
bool(true)
-===DONE===
diff --git a/ext/sqlite3/php_sqlite3.h b/ext/sqlite3/php_sqlite3.h
index ca09e341ab..9dff343f90 100644
--- a/ext/sqlite3/php_sqlite3.h
+++ b/ext/sqlite3/php_sqlite3.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/sqlite3/php_sqlite3_structs.h b/ext/sqlite3/php_sqlite3_structs.h
index f189ea30af..d86f39e431 100644
--- a/ext/sqlite3/php_sqlite3_structs.h
+++ b/ext/sqlite3/php_sqlite3_structs.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -73,6 +71,8 @@ typedef struct _php_sqlite3_db_object {
sqlite3 *db;
php_sqlite3_func *funcs;
php_sqlite3_collation *collations;
+ zend_fcall_info authorizer_fci;
+ zend_fcall_info_cache authorizer_fcc;
zend_bool exception;
diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c
index 910181a3b7..812758433d 100644
--- a/ext/sqlite3/sqlite3.c
+++ b/ext/sqlite3/sqlite3.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -25,6 +23,7 @@
#include "ext/standard/info.h"
#include "php_sqlite3.h"
#include "php_sqlite3_structs.h"
+#include "sqlite3_arginfo.h"
#include "main/SAPI.h"
#include <sqlite3.h>
@@ -36,7 +35,7 @@
ZEND_DECLARE_MODULE_GLOBALS(sqlite3)
static PHP_GINIT_FUNCTION(sqlite3);
-static int php_sqlite3_authorizer(void *autharg, int access_type, const char *arg3, const char *arg4, const char *arg5, const char *arg6);
+static int php_sqlite3_authorizer(void *autharg, int action, const char *arg1, const char *arg2, const char *arg3, const char *arg4);
static void sqlite3_param_dtor(zval *data);
static int php_sqlite3_compare_stmt_zval_free(php_sqlite3_free_list **free_list, zval *statement);
@@ -108,26 +107,26 @@ PHP_METHOD(sqlite3, open)
db_obj = Z_SQLITE3_DB_P(object);
- if (FAILURE == zend_parse_parameters_throw(ZEND_NUM_ARGS(), "p|ls", &filename, &filename_len, &flags, &encryption_key, &encryption_key_len)) {
- return;
+ if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "p|ls", &filename, &filename_len, &flags, &encryption_key, &encryption_key_len)) {
+ RETURN_THROWS();
}
if (db_obj->initialised) {
zend_throw_exception(zend_ce_exception, "Already initialised DB Object", 0);
- return;
+ RETURN_THROWS();
}
if (filename_len != 0 && (filename_len != sizeof(":memory:")-1 ||
memcmp(filename, ":memory:", sizeof(":memory:")-1) != 0)) {
if (!(fullpath = expand_filepath(filename, NULL))) {
zend_throw_exception(zend_ce_exception, "Unable to expand filepath", 0);
- return;
+ RETURN_THROWS();
}
if (php_check_open_basedir(fullpath)) {
zend_throw_exception_ex(zend_ce_exception, 0, "open_basedir prohibits opening %s", fullpath);
efree(fullpath);
- return;
+ RETURN_THROWS();
}
} else {
/* filename equals "" or ":memory:" */
@@ -154,16 +153,16 @@ PHP_METHOD(sqlite3, open)
if (sqlite3_key(db_obj->db, encryption_key, encryption_key_len) != SQLITE_OK) {
sqlite3_close(db_obj->db);
zend_throw_exception_ex(zend_ce_exception, 0, "Unable to open database: %s", sqlite3_errmsg(db_obj->db));
- return;
+ RETURN_THROWS();
}
}
#endif
db_obj->initialised = 1;
+ db_obj->authorizer_fci = empty_fcall_info;
+ db_obj->authorizer_fcc = empty_fcall_info_cache;
- if (PG(open_basedir) && *PG(open_basedir)) {
- sqlite3_set_authorizer(db_obj->db, php_sqlite3_authorizer, NULL);
- }
+ sqlite3_set_authorizer(db_obj->db, php_sqlite3_authorizer, db_obj);
#if SQLITE_VERSION_NUMBER >= 3026000
if (SQLITE3G(dbconfig_defensive)) {
@@ -187,7 +186,7 @@ PHP_METHOD(sqlite3, close)
db_obj = Z_SQLITE3_DB_P(object);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (db_obj->initialised) {
@@ -219,7 +218,7 @@ PHP_METHOD(sqlite3, exec)
SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3)
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "S", &sql)) {
- return;
+ RETURN_THROWS();
}
if (sqlite3_exec(db_obj->db, ZSTR_VAL(sql), NULL, NULL, &errtext) != SQLITE_OK) {
@@ -237,7 +236,7 @@ PHP_METHOD(sqlite3, exec)
PHP_METHOD(sqlite3, version)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
array_init(return_value);
@@ -260,7 +259,7 @@ PHP_METHOD(sqlite3, lastInsertRowID)
SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3)
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_LONG((zend_long) sqlite3_last_insert_rowid(db_obj->db));
@@ -278,7 +277,7 @@ PHP_METHOD(sqlite3, lastErrorCode)
SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->db, SQLite3)
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (db_obj->initialised) {
@@ -300,7 +299,7 @@ PHP_METHOD(sqlite3, lastExtendedErrorCode)
SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->db, SQLite3)
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (db_obj->initialised) {
@@ -324,7 +323,7 @@ PHP_METHOD(sqlite3, enableExtendedResultCodes)
SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->db, SQLite3)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &enable) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (db_obj->initialised) {
@@ -350,7 +349,7 @@ PHP_METHOD(sqlite3, lastErrorMsg)
SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->db, SQLite3)
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (db_obj->initialised) {
@@ -376,7 +375,7 @@ PHP_METHOD(sqlite3, busyTimeout)
SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3)
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "l", &ms)) {
- return;
+ RETURN_THROWS();
}
#ifdef SQLITE_ENABLE_API_ARMOR
@@ -409,7 +408,7 @@ PHP_METHOD(sqlite3, loadExtension)
SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3)
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "s", &extension, &extension_len)) {
- return;
+ RETURN_THROWS();
}
#ifdef ZTS
@@ -479,7 +478,7 @@ PHP_METHOD(sqlite3, changes)
SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3)
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_LONG(sqlite3_changes(db_obj->db));
@@ -494,7 +493,7 @@ PHP_METHOD(sqlite3, escapeString)
char *ret;
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "S", &sql)) {
- return;
+ RETURN_THROWS();
}
if (ZSTR_LEN(sql)) {
@@ -525,7 +524,7 @@ PHP_METHOD(sqlite3, prepare)
SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3)
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "S", &sql)) {
- return;
+ RETURN_THROWS();
}
if (!ZSTR_LEN(sql)) {
@@ -572,7 +571,7 @@ PHP_METHOD(sqlite3, query)
SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3)
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "S", &sql)) {
- return;
+ RETURN_THROWS();
}
if (!ZSTR_LEN(sql)) {
@@ -688,7 +687,7 @@ PHP_METHOD(sqlite3, querySingle)
SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3)
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "S|b", &sql, &entire_row)) {
- return;
+ RETURN_THROWS();
}
if (!ZSTR_LEN(sql)) {
@@ -982,7 +981,7 @@ PHP_METHOD(sqlite3, createFunction)
SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sz|ll", &sql_func, &sql_func_len, &callback_func, &sql_func_num_args, &flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!sql_func_len) {
@@ -1031,7 +1030,7 @@ PHP_METHOD(sqlite3, createAggregate)
SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "szz|l", &sql_func, &sql_func_len, &step_callback, &fini_callback, &sql_func_num_args) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!sql_func_len) {
@@ -1087,7 +1086,7 @@ PHP_METHOD(sqlite3, createCollation)
SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sz", &collation_name, &collation_name_len, &callback_func) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (!collation_name_len) {
@@ -1296,7 +1295,12 @@ PHP_METHOD(sqlite3, openBlob)
SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ssl|sl", &table, &table_len, &column, &column_len, &rowid, &dbname, &dbname_len, &flags) == FAILURE) {
- return;
+ RETURN_THROWS();
+ }
+
+ if (ZEND_NUM_ARGS() >= 4 && CHECK_NULL_PATH(dbname, dbname_len)) {
+ zend_value_error("dbname must not contain null bytes");
+ RETURN_THROWS();
}
sqlite_flags = (flags & SQLITE_OPEN_READWRITE) ? 1 : 0;
@@ -1337,7 +1341,7 @@ PHP_METHOD(sqlite3, enableExceptions)
db_obj = Z_SQLITE3_DB_P(object);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &enableExceptions) == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETVAL_BOOL(db_obj->exception);
@@ -1346,6 +1350,40 @@ PHP_METHOD(sqlite3, enableExceptions)
}
/* }}} */
+/* {{{ proto bool SQLite3::setAuthorizer(mixed callback)
+ Register a callback function to be used as an authorizer by SQLite. The callback should return SQLite3::OK, SQLite3::IGNORE or SQLite3::DENY. */
+PHP_METHOD(sqlite3, setAuthorizer)
+{
+ php_sqlite3_db_object *db_obj;
+ zval *object = ZEND_THIS;
+ db_obj = Z_SQLITE3_DB_P(object);
+ zend_fcall_info fci;
+ zend_fcall_info_cache fcc;
+
+ SQLITE3_CHECK_INITIALIZED(db_obj, db_obj->initialised, SQLite3)
+
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_FUNC_EX(fci, fcc, 1, 0)
+ ZEND_PARSE_PARAMETERS_END();
+
+ /* Clear previously set callback */
+ if (ZEND_FCI_INITIALIZED(db_obj->authorizer_fci)) {
+ zval_ptr_dtor(&db_obj->authorizer_fci.function_name);
+ db_obj->authorizer_fci.size = 0;
+ }
+
+ /* Only enable userland authorizer if argument is not NULL */
+ if (ZEND_FCI_INITIALIZED(fci)) {
+ db_obj->authorizer_fci = fci;
+ Z_ADDREF(db_obj->authorizer_fci.function_name);
+ db_obj->authorizer_fcc = fcc;
+ }
+
+ RETURN_TRUE;
+}
+/* }}} */
+
+
#if SQLITE_VERSION_NUMBER >= 3006011
/* {{{ proto bool SQLite3::backup(SQLite3 destination_db[, string source_dbname = "main"[, string destination_dbname = "main"]])
Backups the current database to another one. */
@@ -1364,7 +1402,14 @@ PHP_METHOD(sqlite3, backup)
SQLITE3_CHECK_INITIALIZED(source_obj, source_obj->initialised, SQLite3)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O|ss", &destination_zval, php_sqlite3_sc_entry, &source_dbname, &source_dbname_length, &destination_dbname, &destination_dbname_length) == FAILURE) {
- return;
+ RETURN_THROWS();
+ }
+
+ if ((ZEND_NUM_ARGS() >= 2 && CHECK_NULL_PATH(source_dbname, source_dbname_length))
+ || (ZEND_NUM_ARGS() >= 3 && CHECK_NULL_PATH(destination_dbname, destination_dbname_length))
+ ) {
+ zend_value_error("dbname must not contain null bytes");
+ RETURN_THROWS();
}
destination_obj = Z_SQLITE3_DB_P(destination_zval);
@@ -1412,7 +1457,7 @@ PHP_METHOD(sqlite3stmt, paramCount)
stmt_obj = Z_SQLITE3_STMT_P(object);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3);
@@ -1431,7 +1476,7 @@ PHP_METHOD(sqlite3stmt, close)
stmt_obj = Z_SQLITE3_STMT_P(object);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3);
@@ -1453,7 +1498,7 @@ PHP_METHOD(sqlite3stmt, reset)
stmt_obj = Z_SQLITE3_STMT_P(object);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3);
@@ -1476,7 +1521,7 @@ PHP_METHOD(sqlite3stmt, clear)
stmt_obj = Z_SQLITE3_STMT_P(object);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3);
@@ -1506,7 +1551,7 @@ PHP_METHOD(sqlite3stmt, readOnly)
stmt_obj = Z_SQLITE3_STMT_P(object);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3);
@@ -1638,7 +1683,7 @@ PHP_METHOD(sqlite3stmt, getSQL)
int bind_rc;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &expanded) == FAILURE) {
- return;
+ RETURN_THROWS();
}
SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3);
@@ -1734,9 +1779,8 @@ static int register_bound_parameter_to_sqlite(struct php_sqlite3_bound_param *pa
}
/* }}} */
-/* {{{ proto bool SQLite3Stmt::bindParam(int parameter_number, mixed parameter [, int type])
- Bind Parameter to a stmt variable. */
-PHP_METHOD(sqlite3stmt, bindParam)
+/* {{{ Common implementation of ::bindParam() and ::bindValue */
+static void sqlite3stmt_bind(INTERNAL_FUNCTION_PARAMETERS)
{
php_sqlite3_stmt *stmt_obj;
zval *object = ZEND_THIS;
@@ -1749,7 +1793,7 @@ PHP_METHOD(sqlite3stmt, bindParam)
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "lz|l", &param.param_number, &parameter, &param.type) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sz|l", &param.name, &parameter, &param.type) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
@@ -1773,42 +1817,19 @@ PHP_METHOD(sqlite3stmt, bindParam)
}
/* }}} */
+/* {{{ proto bool SQLite3Stmt::bindParam(int parameter_number, mixed parameter [, int type])
+ Bind Parameter to a stmt variable. */
+PHP_METHOD(sqlite3stmt, bindParam)
+{
+ sqlite3stmt_bind(INTERNAL_FUNCTION_PARAM_PASSTHRU);
+}
+/* }}} */
+
/* {{{ proto bool SQLite3Stmt::bindValue(int parameter_number, mixed parameter [, int type])
Bind Value of a parameter to a stmt variable. */
PHP_METHOD(sqlite3stmt, bindValue)
{
- php_sqlite3_stmt *stmt_obj;
- zval *object = ZEND_THIS;
- struct php_sqlite3_bound_param param = {0};
- zval *parameter;
- stmt_obj = Z_SQLITE3_STMT_P(object);
-
- param.param_number = -1;
- param.type = SQLITE3_TEXT;
-
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "lz|l", &param.param_number, &parameter, &param.type) == FAILURE) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "Sz|l", &param.name, &parameter, &param.type) == FAILURE) {
- return;
- }
- }
-
- SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3);
- SQLITE3_CHECK_INITIALIZED_STMT(stmt_obj->stmt, SQLite3Stmt);
-
- ZVAL_COPY(&param.parameter, parameter);
-
- if (ZEND_NUM_ARGS() < 3) {
- PHP_SQLITE3_SET_TYPE(parameter, param);
- }
-
- if (!register_bound_parameter_to_sqlite(&param, stmt_obj)) {
- if (!Z_ISUNDEF(param.parameter)) {
- zval_ptr_dtor(&(param.parameter));
- ZVAL_UNDEF(&param.parameter);
- }
- RETURN_FALSE;
- }
- RETURN_TRUE;
+ sqlite3stmt_bind(INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
/* }}} */
@@ -1827,7 +1848,7 @@ PHP_METHOD(sqlite3stmt, execute)
stmt_obj = Z_SQLITE3_STMT_P(object);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3);
@@ -1890,8 +1911,8 @@ PHP_METHOD(sqlite3stmt, __construct)
stmt_obj = Z_SQLITE3_STMT_P(object);
- if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "OS", &db_zval, php_sqlite3_sc_entry, &sql) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "OS", &db_zval, php_sqlite3_sc_entry, &sql) == FAILURE) {
+ RETURN_THROWS();
}
db_obj = Z_SQLITE3_DB_P(db_zval);
@@ -1936,7 +1957,7 @@ PHP_METHOD(sqlite3result, numColumns)
SQLITE3_CHECK_INITIALIZED(result_obj->db_obj, result_obj->stmt_obj->initialised, SQLite3Result)
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_LONG(sqlite3_column_count(result_obj->stmt_obj->stmt));
@@ -1956,7 +1977,7 @@ PHP_METHOD(sqlite3result, columnName)
SQLITE3_CHECK_INITIALIZED(result_obj->db_obj, result_obj->stmt_obj->initialised, SQLite3Result)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &column) == FAILURE) {
- return;
+ RETURN_THROWS();
}
column_name = (char*) sqlite3_column_name(result_obj->stmt_obj->stmt, column);
@@ -1980,7 +2001,7 @@ PHP_METHOD(sqlite3result, columnType)
SQLITE3_CHECK_INITIALIZED(result_obj->db_obj, result_obj->stmt_obj->initialised, SQLite3Result)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &column) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (result_obj->complete) {
@@ -2004,7 +2025,7 @@ PHP_METHOD(sqlite3result, fetchArray)
SQLITE3_CHECK_INITIALIZED(result_obj->db_obj, result_obj->stmt_obj->initialised, SQLite3Result)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &mode) == FAILURE) {
- return;
+ RETURN_THROWS();
}
ret = sqlite3_step(result_obj->stmt_obj->stmt);
@@ -2059,7 +2080,7 @@ PHP_METHOD(sqlite3result, reset)
SQLITE3_CHECK_INITIALIZED(result_obj->db_obj, result_obj->stmt_obj->initialised, SQLite3Result)
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (sqlite3_reset(result_obj->stmt_obj->stmt) != SQLITE_OK) {
@@ -2083,7 +2104,7 @@ PHP_METHOD(sqlite3result, finalize)
SQLITE3_CHECK_INITIALIZED(result_obj->db_obj, result_obj->stmt_obj->initialised, SQLite3Result)
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
/* We need to finalize an internal statement */
@@ -2106,206 +2127,158 @@ PHP_METHOD(sqlite3result, __construct)
}
/* }}} */
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3_open, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, flags)
- ZEND_ARG_INFO(0, encryption_key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_sqlite3_busytimeout, 0)
- ZEND_ARG_INFO(0, ms)
-ZEND_END_ARG_INFO()
-
-#ifndef SQLITE_OMIT_LOAD_EXTENSION
-ZEND_BEGIN_ARG_INFO(arginfo_sqlite3_loadextension, 0)
- ZEND_ARG_INFO(0, shared_library)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3_escapestring, 0, 0, 1)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3_query, 0, 0, 1)
- ZEND_ARG_INFO(0, query)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3_querysingle, 0, 0, 1)
- ZEND_ARG_INFO(0, query)
- ZEND_ARG_INFO(0, entire_row)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3_createfunction, 0, 0, 2)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, callback)
- ZEND_ARG_INFO(0, argument_count)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3_createaggregate, 0, 0, 3)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, step_callback)
- ZEND_ARG_INFO(0, final_callback)
- ZEND_ARG_INFO(0, argument_count)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3_createcollation, 0, 0, 2)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, callback)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3_openblob, 0, 0, 3)
- ZEND_ARG_INFO(0, table)
- ZEND_ARG_INFO(0, column)
- ZEND_ARG_INFO(0, rowid)
- ZEND_ARG_INFO(0, dbname)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3_enableexceptions, 0, 0, 0)
- ZEND_ARG_INFO(0, enableExceptions)
-ZEND_END_ARG_INFO()
-
-#if SQLITE_VERSION_NUMBER >= 3006011
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3_backup, 0, 0, 1)
- ZEND_ARG_INFO(0, destination_db)
- ZEND_ARG_INFO(0, source_dbname)
- ZEND_ARG_INFO(0, destination_dbname)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3stmt_bindparam, 0, 0, 2)
- ZEND_ARG_INFO(0, param_number)
- ZEND_ARG_INFO(1, param)
- ZEND_ARG_INFO(0, type)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3stmt_bindvalue, 0, 0, 2)
- ZEND_ARG_INFO(0, param_number)
- ZEND_ARG_INFO(0, param)
- ZEND_ARG_INFO(0, type)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3stmt_construct, 0, 0, 1)
- ZEND_ARG_INFO(0, sqlite3)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3stmt_getsql, 0, 0, 0)
- ZEND_ARG_INFO(0, expanded)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3result_columnname, 0, 0, 1)
- ZEND_ARG_INFO(0, column_number)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3result_columntype, 0, 0, 1)
- ZEND_ARG_INFO(0, column_number)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3result_fetcharray, 0, 0, 0)
- ZEND_ARG_INFO(0, mode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sqlite3_enableextended, 0, 0, 1)
- ZEND_ARG_INFO(0, enable)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_sqlite3_void, 0)
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ php_sqlite3_class_methods */
static const zend_function_entry php_sqlite3_class_methods[] = {
- PHP_ME(sqlite3, open, arginfo_sqlite3_open, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3, close, arginfo_sqlite3_void, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3, exec, arginfo_sqlite3_query, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3, version, arginfo_sqlite3_void, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- PHP_ME(sqlite3, lastInsertRowID, arginfo_sqlite3_void, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3, lastErrorCode, arginfo_sqlite3_void, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3, lastExtendedErrorCode, arginfo_sqlite3_void, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3, enableExtendedResultCodes, arginfo_sqlite3_enableextended, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3, lastErrorMsg, arginfo_sqlite3_void, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3, busyTimeout, arginfo_sqlite3_busytimeout, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3, open, arginfo_class_SQLite3_open, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3, close, arginfo_class_SQLite3_close, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3, exec, arginfo_class_SQLite3_query, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3, version, arginfo_class_SQLite3_version, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME(sqlite3, lastInsertRowID, arginfo_class_SQLite3_lastInsertRowID, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3, lastErrorCode, arginfo_class_SQLite3_lastErrorCode, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3, lastExtendedErrorCode, arginfo_class_SQLite3_lastExtendedErrorCode, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3, enableExtendedResultCodes, arginfo_class_SQLite3_enableExtendedResultCodes, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3, lastErrorMsg, arginfo_class_SQLite3_lastErrorMsg, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3, busyTimeout, arginfo_class_SQLite3_busyTimeout, ZEND_ACC_PUBLIC)
#ifndef SQLITE_OMIT_LOAD_EXTENSION
- PHP_ME(sqlite3, loadExtension, arginfo_sqlite3_loadextension, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3, loadExtension, arginfo_class_SQLite3_loadExtension, ZEND_ACC_PUBLIC)
#endif
- PHP_ME(sqlite3, changes, arginfo_sqlite3_void, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3, escapeString, arginfo_sqlite3_escapestring, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- PHP_ME(sqlite3, prepare, arginfo_sqlite3_query, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3, query, arginfo_sqlite3_query, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3, querySingle, arginfo_sqlite3_querysingle, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3, createFunction, arginfo_sqlite3_createfunction, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3, createAggregate, arginfo_sqlite3_createaggregate, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3, createCollation, arginfo_sqlite3_createcollation, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3, openBlob, arginfo_sqlite3_openblob, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3, enableExceptions, arginfo_sqlite3_enableexceptions, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3, changes, arginfo_class_SQLite3_changes, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3, escapeString, arginfo_class_SQLite3_escapeString, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME(sqlite3, prepare, arginfo_class_SQLite3_prepare, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3, query, arginfo_class_SQLite3_query, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3, querySingle, arginfo_class_SQLite3_querySingle, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3, createFunction, arginfo_class_SQLite3_createFunction, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3, createAggregate, arginfo_class_SQLite3_createAggregate, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3, createCollation, arginfo_class_SQLite3_createCollation, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3, openBlob, arginfo_class_SQLite3_openBlob, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3, enableExceptions, arginfo_class_SQLite3_enableExceptions, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3, setAuthorizer, arginfo_class_SQLite3_setAuthorizer, ZEND_ACC_PUBLIC)
#if SQLITE_VERSION_NUMBER >= 3006011
- PHP_ME(sqlite3, backup, arginfo_sqlite3_backup, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3, backup, arginfo_class_SQLite3_backup, ZEND_ACC_PUBLIC)
#endif
/* Aliases */
- PHP_MALIAS(sqlite3, __construct, open, arginfo_sqlite3_open, ZEND_ACC_PUBLIC)
+ PHP_MALIAS(sqlite3, __construct, open, arginfo_class_SQLite3___construct, ZEND_ACC_PUBLIC)
PHP_FE_END
};
/* }}} */
/* {{{ php_sqlite3_stmt_class_methods */
static const zend_function_entry php_sqlite3_stmt_class_methods[] = {
- PHP_ME(sqlite3stmt, paramCount, arginfo_sqlite3_void, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3stmt, close, arginfo_sqlite3_void, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3stmt, reset, arginfo_sqlite3_void, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3stmt, clear, arginfo_sqlite3_void, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3stmt, execute, arginfo_sqlite3_void, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3stmt, bindParam, arginfo_sqlite3stmt_bindparam, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3stmt, bindValue, arginfo_sqlite3stmt_bindvalue, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3stmt, readOnly, arginfo_sqlite3_void, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3stmt, getSQL, arginfo_sqlite3stmt_getsql, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3stmt, __construct, arginfo_sqlite3stmt_construct, ZEND_ACC_PRIVATE)
+ PHP_ME(sqlite3stmt, paramCount, arginfo_class_SQLite3Stmt_paramCount, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3stmt, close, arginfo_class_SQLite3Stmt_close, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3stmt, reset, arginfo_class_SQLite3Stmt_reset, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3stmt, clear, arginfo_class_SQLite3Stmt_clear, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3stmt, execute, arginfo_class_SQLite3Stmt_execute, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3stmt, bindParam, arginfo_class_SQLite3Stmt_bindParam, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3stmt, bindValue, arginfo_class_SQLite3Stmt_bindValue, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3stmt, readOnly, arginfo_class_SQLite3Stmt_readOnly, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3stmt, getSQL, arginfo_class_SQLite3Stmt_getSQL, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3stmt, __construct, arginfo_class_SQLite3Stmt___construct, ZEND_ACC_PRIVATE)
PHP_FE_END
};
/* }}} */
/* {{{ php_sqlite3_result_class_methods */
static const zend_function_entry php_sqlite3_result_class_methods[] = {
- PHP_ME(sqlite3result, numColumns, arginfo_sqlite3_void, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3result, columnName, arginfo_sqlite3result_columnname, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3result, columnType, arginfo_sqlite3result_columntype, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3result, fetchArray, arginfo_sqlite3result_fetcharray, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3result, reset, arginfo_sqlite3_void, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3result, finalize, arginfo_sqlite3_void, ZEND_ACC_PUBLIC)
- PHP_ME(sqlite3result, __construct, arginfo_sqlite3_void, ZEND_ACC_PRIVATE)
+ PHP_ME(sqlite3result, numColumns, arginfo_class_SQLite3Result_numColumns, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3result, columnName, arginfo_class_SQLite3Result_columnName, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3result, columnType, arginfo_class_SQLite3Result_columnType, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3result, fetchArray, arginfo_class_SQLite3Result_fetchArray, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3result, reset, arginfo_class_SQLite3Result_reset, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3result, finalize, arginfo_class_SQLite3Result_finalize, ZEND_ACC_PUBLIC)
+ PHP_ME(sqlite3result, __construct, arginfo_class_SQLite3Result___construct, ZEND_ACC_PRIVATE)
PHP_FE_END
};
/* }}} */
/* {{{ Authorization Callback
*/
-static int php_sqlite3_authorizer(void *autharg, int access_type, const char *arg3, const char *arg4, const char *arg5, const char *arg6)
+static int php_sqlite3_authorizer(void *autharg, int action, const char *arg1, const char *arg2, const char *arg3, const char *arg4)
{
- switch (access_type) {
- case SQLITE_ATTACH:
- {
- if (memcmp(arg3, ":memory:", sizeof(":memory:")) && *arg3) {
- if (strncmp(arg3, "file:", 5) == 0) {
+ /* Check open_basedir restrictions first */
+ if (PG(open_basedir) && *PG(open_basedir)) {
+ if (action == SQLITE_ATTACH) {
+ if (memcmp(arg1, ":memory:", sizeof(":memory:")) && *arg1) {
+ if (strncmp(arg1, "file:", 5) == 0) {
/* starts with "file:" */
- if (!arg3[5]) {
+ if (!arg1[5]) {
return SQLITE_DENY;
}
- if (php_check_open_basedir(arg3 + 5)) {
+ if (php_check_open_basedir(arg1 + 5)) {
return SQLITE_DENY;
}
}
- if (php_check_open_basedir(arg3)) {
+ if (php_check_open_basedir(arg1)) {
return SQLITE_DENY;
}
}
- return SQLITE_OK;
}
+ }
- default:
- /* access allowed */
- return SQLITE_OK;
+ php_sqlite3_db_object *db_obj = (php_sqlite3_db_object *)autharg;
+ zend_fcall_info *fci = &db_obj->authorizer_fci;
+
+ /* fallback to access allowed if authorizer callback is not defined */
+ if (fci->size == 0) {
+ return SQLITE_OK;
+ }
+
+ /* call userland authorizer callback, if set */
+ zval retval;
+ zval argv[5];
+
+ ZVAL_LONG(&argv[0], action);
+
+ if (NULL == arg1) {
+ ZVAL_NULL(&argv[1]);
+ } else {
+ ZVAL_STRING(&argv[1], arg1);
+ }
+
+ if (NULL == arg2) {
+ ZVAL_NULL(&argv[2]);
+ } else {
+ ZVAL_STRING(&argv[2], arg2);
+ }
+
+ if (NULL == arg3) {
+ ZVAL_NULL(&argv[3]);
+ } else {
+ ZVAL_STRING(&argv[3], arg3);
}
+
+ if (NULL == arg4) {
+ ZVAL_NULL(&argv[4]);
+ } else {
+ ZVAL_STRING(&argv[4], arg4);
+ }
+
+ fci->retval = &retval;
+ fci->param_count = 5;
+ fci->params = argv;
+ fci->no_separation = 0;
+
+ int authreturn = SQLITE_DENY;
+
+ if (zend_call_function(fci, &db_obj->authorizer_fcc) != SUCCESS || Z_ISUNDEF(retval)) {
+ php_sqlite3_error(db_obj, "An error occurred while invoking the authorizer callback");
+ } else {
+ if (Z_TYPE(retval) != IS_LONG) {
+ php_sqlite3_error(db_obj, "The authorizer callback returned an invalid type: expected int");
+ } else {
+ authreturn = Z_LVAL(retval);
+
+ if (authreturn != SQLITE_OK && authreturn != SQLITE_IGNORE && authreturn != SQLITE_DENY) {
+ php_sqlite3_error(db_obj, "The authorizer callback returned an invalid value");
+ authreturn = SQLITE_DENY;
+ }
+ }
+ }
+
+ zend_fcall_info_args_clear(fci, 0);
+ zval_ptr_dtor(&retval);
+
+ return authreturn;
}
/* }}} */
@@ -2345,6 +2318,11 @@ static void php_sqlite3_object_free_storage(zend_object *object) /* {{{ */
return;
}
+ /* Release function_name from authorizer */
+ if (intern->authorizer_fci.size > 0) {
+ zval_ptr_dtor(&intern->authorizer_fci.function_name);
+ }
+
while (intern->funcs) {
func = intern->funcs;
intern->funcs = func->next;
@@ -2566,6 +2544,51 @@ PHP_MINIT_FUNCTION(sqlite3)
REGISTER_LONG_CONSTANT("SQLITE3_OPEN_READWRITE", SQLITE_OPEN_READWRITE, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SQLITE3_OPEN_CREATE", SQLITE_OPEN_CREATE, CONST_CS | CONST_PERSISTENT);
+ /* Class constants */
+ zend_declare_class_constant_long(php_sqlite3_sc_entry, "OK", sizeof("OK") - 1, SQLITE_OK);
+
+ /* Constants for authorizer return */
+ zend_declare_class_constant_long(php_sqlite3_sc_entry, "DENY", sizeof("DENY") - 1, SQLITE_DENY);
+ zend_declare_class_constant_long(php_sqlite3_sc_entry, "IGNORE", sizeof("IGNORE") - 1, SQLITE_IGNORE);
+
+ /* Constants for authorizer actions */
+ zend_declare_class_constant_long(php_sqlite3_sc_entry, "CREATE_INDEX", sizeof("CREATE_INDEX") - 1, SQLITE_CREATE_INDEX);
+ zend_declare_class_constant_long(php_sqlite3_sc_entry, "CREATE_TABLE", sizeof("CREATE_TABLE") - 1, SQLITE_CREATE_TABLE);
+ zend_declare_class_constant_long(php_sqlite3_sc_entry, "CREATE_TEMP_INDEX", sizeof("CREATE_TEMP_INDEX") - 1, SQLITE_CREATE_TEMP_INDEX);
+ zend_declare_class_constant_long(php_sqlite3_sc_entry, "CREATE_TEMP_TABLE", sizeof("CREATE_TEMP_TABLE") - 1, SQLITE_CREATE_TEMP_TABLE);
+ zend_declare_class_constant_long(php_sqlite3_sc_entry, "CREATE_TEMP_TRIGGER", sizeof("CREATE_TEMP_TRIGGER") - 1, SQLITE_CREATE_TEMP_TRIGGER);
+ zend_declare_class_constant_long(php_sqlite3_sc_entry, "CREATE_TEMP_VIEW", sizeof("CREATE_TEMP_VIEW") - 1, SQLITE_CREATE_TEMP_VIEW);
+ zend_declare_class_constant_long(php_sqlite3_sc_entry, "CREATE_TRIGGER", sizeof("CREATE_TRIGGER") - 1, SQLITE_CREATE_TRIGGER);
+ zend_declare_class_constant_long(php_sqlite3_sc_entry, "CREATE_VIEW", sizeof("CREATE_VIEW") - 1, SQLITE_CREATE_VIEW);
+ zend_declare_class_constant_long(php_sqlite3_sc_entry, "DELETE", sizeof("DELETE") - 1, SQLITE_DELETE);
+ zend_declare_class_constant_long(php_sqlite3_sc_entry, "DROP_INDEX", sizeof("DROP_INDEX") - 1, SQLITE_DROP_INDEX);
+ zend_declare_class_constant_long(php_sqlite3_sc_entry, "DROP_TABLE", sizeof("DROP_TABLE") - 1, SQLITE_DROP_TABLE);
+ zend_declare_class_constant_long(php_sqlite3_sc_entry, "DROP_TEMP_INDEX", sizeof("DROP_TEMP_INDEX") - 1, SQLITE_DROP_TEMP_INDEX);
+ zend_declare_class_constant_long(php_sqlite3_sc_entry, "DROP_TEMP_TABLE", sizeof("DROP_TEMP_TABLE") - 1, SQLITE_DROP_TEMP_TABLE);
+ zend_declare_class_constant_long(php_sqlite3_sc_entry, "DROP_TEMP_TRIGGER", sizeof("DROP_TEMP_TRIGGER") - 1, SQLITE_DROP_TEMP_TRIGGER);
+ zend_declare_class_constant_long(php_sqlite3_sc_entry, "DROP_TEMP_VIEW", sizeof("DROP_TEMP_VIEW") - 1, SQLITE_DROP_TEMP_VIEW);
+ zend_declare_class_constant_long(php_sqlite3_sc_entry, "DROP_TRIGGER", sizeof("DROP_TRIGGER") - 1, SQLITE_DROP_TRIGGER);
+ zend_declare_class_constant_long(php_sqlite3_sc_entry, "DROP_VIEW", sizeof("DROP_VIEW") - 1, SQLITE_DROP_VIEW);
+ zend_declare_class_constant_long(php_sqlite3_sc_entry, "INSERT", sizeof("INSERT") - 1, SQLITE_INSERT);
+ zend_declare_class_constant_long(php_sqlite3_sc_entry, "PRAGMA", sizeof("PRAGMA") - 1, SQLITE_PRAGMA);
+ zend_declare_class_constant_long(php_sqlite3_sc_entry, "READ", sizeof("READ") - 1, SQLITE_READ);
+ zend_declare_class_constant_long(php_sqlite3_sc_entry, "SELECT", sizeof("SELECT") - 1, SQLITE_SELECT);
+ zend_declare_class_constant_long(php_sqlite3_sc_entry, "TRANSACTION", sizeof("TRANSACTION") - 1, SQLITE_TRANSACTION);
+ zend_declare_class_constant_long(php_sqlite3_sc_entry, "UPDATE", sizeof("UPDATE") - 1, SQLITE_UPDATE);
+ zend_declare_class_constant_long(php_sqlite3_sc_entry, "ATTACH", sizeof("ATTACH") - 1, SQLITE_ATTACH);
+ zend_declare_class_constant_long(php_sqlite3_sc_entry, "DETACH", sizeof("DETACH") - 1, SQLITE_DETACH);
+ zend_declare_class_constant_long(php_sqlite3_sc_entry, "ALTER_TABLE", sizeof("ALTER_TABLE") - 1, SQLITE_ALTER_TABLE);
+ zend_declare_class_constant_long(php_sqlite3_sc_entry, "REINDEX", sizeof("REINDEX") - 1, SQLITE_REINDEX);
+ zend_declare_class_constant_long(php_sqlite3_sc_entry, "ANALYZE", sizeof("ANALYZE") - 1, SQLITE_ANALYZE);
+ zend_declare_class_constant_long(php_sqlite3_sc_entry, "CREATE_VTABLE", sizeof("CREATE_VTABLE") - 1, SQLITE_CREATE_VTABLE);
+ zend_declare_class_constant_long(php_sqlite3_sc_entry, "DROP_VTABLE", sizeof("DROP_VTABLE") - 1, SQLITE_DROP_VTABLE);
+ zend_declare_class_constant_long(php_sqlite3_sc_entry, "FUNCTION", sizeof("FUNCTION") - 1, SQLITE_FUNCTION);
+ zend_declare_class_constant_long(php_sqlite3_sc_entry, "SAVEPOINT", sizeof("SAVEPOINT") - 1, SQLITE_SAVEPOINT);
+ zend_declare_class_constant_long(php_sqlite3_sc_entry, "COPY", sizeof("COPY") - 1, SQLITE_COPY);
+#ifdef SQLITE_RECURSIVE
+ zend_declare_class_constant_long(php_sqlite3_sc_entry, "RECURSIVE", sizeof("RECURSIVE") - 1, SQLITE_RECURSIVE);
+#endif
+
#ifdef SQLITE_DETERMINISTIC
REGISTER_LONG_CONSTANT("SQLITE3_DETERMINISTIC", SQLITE_DETERMINISTIC, CONST_CS | CONST_PERSISTENT);
#endif
diff --git a/ext/sqlite3/sqlite3.stub.php b/ext/sqlite3/sqlite3.stub.php
new file mode 100644
index 0000000000..8f3bc4f2dd
--- /dev/null
+++ b/ext/sqlite3/sqlite3.stub.php
@@ -0,0 +1,131 @@
+<?php
+
+class SQLite3
+{
+ function __construct(string $filename, int $flags = SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE, string $encryption_key = '') {}
+
+ /** @return void */
+ function open(string $filename, int $flags = SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE, string $encryption_key = '') {}
+
+ /** @return bool */
+ function close() {}
+
+ /** @return array */
+ function version() {}
+
+ /** @return int */
+ function lastInsertRowID() {}
+
+ /** @return int */
+ function lastErrorCode() {}
+
+ /** @return int */
+ function lastExtendedErrorCode() {}
+
+ /** @return string */
+ function lastErrorMsg() {}
+
+ /** @return int */
+ function changes() {}
+
+ /** @return bool */
+ function busyTimeout(int $ms) {}
+
+#ifndef SQLITE_OMIT_LOAD_EXTENSION
+ /** @return bool */
+ function loadExtension(string $shared_library) {}
+#endif
+
+#if SQLITE_VERSION_NUMBER >= 3006011
+ /** @return bool */
+ function backup(SQLite3 $destination_db, string $source_dbname = "main", string $destination_dbname = "main") {}
+#endif
+
+ /** @return string */
+ function escapeString(string $value) {}
+
+ /** @return SQLite3Stmt|false */
+ function prepare(string $query) {}
+
+ /** @return SQLite3Result|false|null */
+ function query(string $query) {}
+
+ /** @return mixed */
+ function querySingle(string $query, bool $entire_row = false) {}
+
+ /** @return bool */
+ function createFunction(string $name, $callback, int $argument_count = -1, int $flags = 0) {}
+
+ /** @return bool */
+ function createAggregate(string $name, $step_callback, $final_callback, int $argument_count = -1) {}
+
+ /** @return bool */
+ function createCollation(string $name, $callback) {}
+
+ /** @return resource|false */
+ function openBlob(string $table, string $column, int $rowid, string $dbname = "main", int $flags = SQLITE3_OPEN_READONLY) {}
+
+ /** @return bool */
+ function enableExceptions(bool $enableExceptions = false) {}
+
+ /** @return bool */
+ function enableExtendedResultCodes(bool $enable = true) {}
+
+ /** @return bool */
+ function setAuthorizer(?callable $callback) {}
+}
+
+class SQLite3Stmt
+{
+ function __construct(SQLite3 $sqlite3, string $sql) {}
+
+ /** @return bool */
+ function bindParam($param_number, &$param, int $type = UNKNOWN) {}
+
+ /** @return bool */
+ function bindValue($param_number, $param, int $type = UNKNOWN) {}
+
+ /** @return bool */
+ function clear() {}
+
+ /** @return bool */
+ function close() {}
+
+ /** @return SQLite3Result|false */
+ function execute() {}
+
+ /** @return string|false */
+ function getSQL(bool $expanded = false) {}
+
+ /** @return int */
+ function paramCount() {}
+
+ /** @return bool */
+ function readOnly() {}
+
+ /** @return bool */
+ function reset() {}
+}
+
+class SQLite3Result
+{
+ function __construct() {}
+
+ /** @return int */
+ function numColumns() {}
+
+ /** @return string|false */
+ function columnName(int $column_number) {}
+
+ /** @return int|false */
+ function columnType(int $column_number) {}
+
+ /** @return array|false */
+ function fetchArray(int $mode = SQLITE3_BOTH) {}
+
+ /** @return bool */
+ function reset() {}
+
+ /** @return bool */
+ function finalize() {}
+}
diff --git a/ext/sqlite3/sqlite3_arginfo.h b/ext/sqlite3/sqlite3_arginfo.h
new file mode 100644
index 0000000000..9588d4623f
--- /dev/null
+++ b/ext/sqlite3/sqlite3_arginfo.h
@@ -0,0 +1,147 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3___construct, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, encryption_key, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SQLite3_open arginfo_class_SQLite3___construct
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3_close, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SQLite3_version arginfo_class_SQLite3_close
+
+#define arginfo_class_SQLite3_lastInsertRowID arginfo_class_SQLite3_close
+
+#define arginfo_class_SQLite3_lastErrorCode arginfo_class_SQLite3_close
+
+#define arginfo_class_SQLite3_lastExtendedErrorCode arginfo_class_SQLite3_close
+
+#define arginfo_class_SQLite3_lastErrorMsg arginfo_class_SQLite3_close
+
+#define arginfo_class_SQLite3_changes arginfo_class_SQLite3_close
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3_busyTimeout, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, ms, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#if !defined(SQLITE_OMIT_LOAD_EXTENSION)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3_loadExtension, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, shared_library, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if SQLITE_VERSION_NUMBER >= 3006011
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3_backup, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, destination_db, SQLite3, 0)
+ ZEND_ARG_TYPE_INFO(0, source_dbname, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, destination_dbname, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3_escapeString, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3_prepare, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, query, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SQLite3_query arginfo_class_SQLite3_prepare
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3_querySingle, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, query, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, entire_row, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3_createFunction, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_INFO(0, callback)
+ ZEND_ARG_TYPE_INFO(0, argument_count, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3_createAggregate, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_INFO(0, step_callback)
+ ZEND_ARG_INFO(0, final_callback)
+ ZEND_ARG_TYPE_INFO(0, argument_count, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3_createCollation, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_INFO(0, callback)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3_openBlob, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, table, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, column, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, rowid, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, dbname, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3_enableExceptions, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, enableExceptions, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3_enableExtendedResultCodes, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, enable, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3_setAuthorizer, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, callback, IS_CALLABLE, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3Stmt___construct, 0, 0, 2)
+ ZEND_ARG_OBJ_INFO(0, sqlite3, SQLite3, 0)
+ ZEND_ARG_TYPE_INFO(0, sql, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3Stmt_bindParam, 0, 0, 2)
+ ZEND_ARG_INFO(0, param_number)
+ ZEND_ARG_INFO(1, param)
+ ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3Stmt_bindValue, 0, 0, 2)
+ ZEND_ARG_INFO(0, param_number)
+ ZEND_ARG_INFO(0, param)
+ ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SQLite3Stmt_clear arginfo_class_SQLite3_close
+
+#define arginfo_class_SQLite3Stmt_close arginfo_class_SQLite3_close
+
+#define arginfo_class_SQLite3Stmt_execute arginfo_class_SQLite3_close
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3Stmt_getSQL, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, expanded, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SQLite3Stmt_paramCount arginfo_class_SQLite3_close
+
+#define arginfo_class_SQLite3Stmt_readOnly arginfo_class_SQLite3_close
+
+#define arginfo_class_SQLite3Stmt_reset arginfo_class_SQLite3_close
+
+#define arginfo_class_SQLite3Result___construct arginfo_class_SQLite3_close
+
+#define arginfo_class_SQLite3Result_numColumns arginfo_class_SQLite3_close
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3Result_columnName, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, column_number, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SQLite3Result_columnType arginfo_class_SQLite3Result_columnName
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SQLite3Result_fetchArray, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SQLite3Result_reset arginfo_class_SQLite3_close
+
+#define arginfo_class_SQLite3Result_finalize arginfo_class_SQLite3_close
diff --git a/ext/sqlite3/tests/bug45798.phpt b/ext/sqlite3/tests/bug45798.phpt
index 9637c1fc9b..7184d58d54 100644
--- a/ext/sqlite3/tests/bug45798.phpt
+++ b/ext/sqlite3/tests/bug45798.phpt
@@ -18,7 +18,7 @@ $stmt->bindParam(1, $foo, SQLITE3_TEXT);
$results = $stmt->execute();
while ($result = $results->fetchArray(SQLITE3_NUM)) {
- var_dump($result);
+ var_dump($result);
}
$results->finalize();
diff --git a/ext/sqlite3/tests/bug66550.phpt b/ext/sqlite3/tests/bug66550.phpt
index a44515b0d9..de7aae1493 100644
--- a/ext/sqlite3/tests/bug66550.phpt
+++ b/ext/sqlite3/tests/bug66550.phpt
@@ -17,7 +17,5 @@ $db->close();
// Access the sqlite3_stmt object via the php_sqlite3_stmt container
$stmt->reset();
?>
-==DONE==
--EXPECTF--
Warning: SQLite3Stmt::reset(): The SQLite3 object has not been correctly initialised in %s
-==DONE==
diff --git a/ext/sqlite3/tests/bug68760.phpt b/ext/sqlite3/tests/bug68760.phpt
index 7eb97ee013..7cc646780b 100644
--- a/ext/sqlite3/tests/bug68760.phpt
+++ b/ext/sqlite3/tests/bug68760.phpt
@@ -7,8 +7,8 @@ if (!extension_loaded('sqlite3')) die('skip');
--FILE--
<?php
function oopsFunction($a, $b) {
- echo "callback".PHP_EOL;
- throw new \Exception("oops");
+ echo "callback".PHP_EOL;
+ throw new \Exception("oops");
}
$db = new SQLite3(":memory:");
diff --git a/ext/sqlite3/tests/bug72668.phpt b/ext/sqlite3/tests/bug72668.phpt
index 2845fa0a7c..6f566d2df1 100644
--- a/ext/sqlite3/tests/bug72668.phpt
+++ b/ext/sqlite3/tests/bug72668.phpt
@@ -6,33 +6,33 @@ if (!extension_loaded('sqlite3')) die('skip'); ?>
--FILE--
<?php
function my_udf_md5($string) {
- throw new \Exception("test exception\n");
+ throw new \Exception("test exception\n");
}
$db = new SQLite3(':memory:');
$db->createFunction('my_udf_md5', 'my_udf_md5');
try {
- $result = $db->query('SELECT my_udf_md5("test")');
- var_dump($result);
+ $result = $db->query('SELECT my_udf_md5("test")');
+ var_dump($result);
}
catch(\Exception $e) {
- echo "Exception: ".$e->getMessage();
+ echo "Exception: ".$e->getMessage();
}
try {
- $result = $db->querySingle('SELECT my_udf_md5("test")');
- var_dump($result);
+ $result = $db->querySingle('SELECT my_udf_md5("test")');
+ var_dump($result);
}
catch(\Exception $e) {
- echo "Exception: ".$e->getMessage();
+ echo "Exception: ".$e->getMessage();
}
$statement = $db->prepare('SELECT my_udf_md5("test")');
try {
- $result = $statement->execute();
- var_dump($result);
+ $result = $statement->execute();
+ var_dump($result);
}
catch(\Exception $e) {
- echo "Exception: ".$e->getMessage();
+ echo "Exception: ".$e->getMessage();
}
?>
--EXPECT--
diff --git a/ext/sqlite3/tests/bug73333.phpt b/ext/sqlite3/tests/bug73333.phpt
index 8634b67f76..f9521209e8 100644
--- a/ext/sqlite3/tests/bug73333.phpt
+++ b/ext/sqlite3/tests/bug73333.phpt
@@ -19,8 +19,6 @@ while (($row = $res->fetchArray(SQLITE3_NUM)) !== false) {
echo gettype($row[0]), PHP_EOL;
}
?>
-===DONE===
--EXPECT--
integer
integer
-===DONE===
diff --git a/ext/sqlite3/tests/bug76665.phpt b/ext/sqlite3/tests/bug76665.phpt
index 0e1de136f7..f56f358bae 100644
--- a/ext/sqlite3/tests/bug76665.phpt
+++ b/ext/sqlite3/tests/bug76665.phpt
@@ -13,7 +13,5 @@ $stmt->bindValue(':bar', 17, SQLITE3_FLOAT);
$stmt->execute();
var_dump($db->querySingle("SELECT bar FROM foo LIMIT 1"));
?>
-===DONE===
--EXPECT--
float(17)
-===DONE===
diff --git a/ext/sqlite3/tests/skipif.inc b/ext/sqlite3/tests/skipif.inc
index 9614e679b9..0f930332ea 100644
--- a/ext/sqlite3/tests/skipif.inc
+++ b/ext/sqlite3/tests/skipif.inc
@@ -1,7 +1,7 @@
<?php
if (!extension_loaded('sqlite3')) {
- die("skip sqlite3 extension not loaded");
+ die("skip sqlite3 extension not loaded");
}
?>
diff --git a/ext/sqlite3/tests/sqlite3_03_insert.phpt b/ext/sqlite3/tests/sqlite3_03_insert.phpt
index 1a0690a000..60880de880 100644
--- a/ext/sqlite3/tests/sqlite3_03_insert.phpt
+++ b/ext/sqlite3/tests/sqlite3_03_insert.phpt
@@ -19,7 +19,7 @@ echo "SELECTING results\n";
$results = $db->query("SELECT * FROM test ORDER BY id ASC");
while ($result = $results->fetchArray(SQLITE3_NUM))
{
- var_dump($result);
+ var_dump($result);
}
$results->finalize();
diff --git a/ext/sqlite3/tests/sqlite3_04_update.phpt b/ext/sqlite3/tests/sqlite3_04_update.phpt
index 3ce7d9cf8b..fe55464ef6 100644
--- a/ext/sqlite3/tests/sqlite3_04_update.phpt
+++ b/ext/sqlite3/tests/sqlite3_04_update.phpt
@@ -19,7 +19,7 @@ echo "SELECTING results\n";
$results = $db->query("SELECT * FROM test ORDER BY id ASC");
while ($result = $results->fetchArray(SQLITE3_NUM))
{
- var_dump($result);
+ var_dump($result);
}
$results->finalize();
@@ -30,7 +30,7 @@ echo "Checking results\n";
$results = $db->query("SELECT * FROM test ORDER BY id ASC");
while ($result = $results->fetchArray(SQLITE3_NUM))
{
- var_dump($result);
+ var_dump($result);
}
$results->finalize();
diff --git a/ext/sqlite3/tests/sqlite3_05_delete.phpt b/ext/sqlite3/tests/sqlite3_05_delete.phpt
index 9ce50c4789..8768d0b575 100644
--- a/ext/sqlite3/tests/sqlite3_05_delete.phpt
+++ b/ext/sqlite3/tests/sqlite3_05_delete.phpt
@@ -19,7 +19,7 @@ echo "SELECTING results\n";
$results = $db->query("SELECT * FROM test ORDER BY id ASC");
while ($result = $results->fetchArray(SQLITE3_NUM))
{
- var_dump($result);
+ var_dump($result);
}
$results->finalize();
@@ -30,7 +30,7 @@ echo "Checking results\n";
$results = $db->query("SELECT * FROM test ORDER BY id ASC");
while ($result = $results->fetchArray(SQLITE3_NUM))
{
- var_dump($result);
+ var_dump($result);
}
$results->finalize();
diff --git a/ext/sqlite3/tests/sqlite3_06_prepared_stmt.phpt b/ext/sqlite3/tests/sqlite3_06_prepared_stmt.phpt
index 710813e8f5..28fd2d264a 100644
--- a/ext/sqlite3/tests/sqlite3_06_prepared_stmt.phpt
+++ b/ext/sqlite3/tests/sqlite3_06_prepared_stmt.phpt
@@ -24,7 +24,7 @@ $foo = 'a';
$results = $stmt->execute();
while ($result = $results->fetchArray(SQLITE3_NUM))
{
- var_dump($result);
+ var_dump($result);
}
$results->finalize();
diff --git a/ext/sqlite3/tests/sqlite3_07_prepared_stmt.phpt b/ext/sqlite3/tests/sqlite3_07_prepared_stmt.phpt
index d9a2408123..393386fead 100644
--- a/ext/sqlite3/tests/sqlite3_07_prepared_stmt.phpt
+++ b/ext/sqlite3/tests/sqlite3_07_prepared_stmt.phpt
@@ -23,7 +23,7 @@ var_dump($stmt->bindValue(1, $foo, SQLITE3_TEXT));
$results = $stmt->execute();
while ($result = $results->fetchArray(SQLITE3_NUM))
{
- var_dump($result);
+ var_dump($result);
}
$results->finalize();
diff --git a/ext/sqlite3/tests/sqlite3_08_udf.phpt b/ext/sqlite3/tests/sqlite3_08_udf.phpt
index 7f00dbb1c4..24862ddda8 100644
--- a/ext/sqlite3/tests/sqlite3_08_udf.phpt
+++ b/ext/sqlite3/tests/sqlite3_08_udf.phpt
@@ -7,7 +7,7 @@ SQLite3::createFunction
function my_udf_md5($foo)
{
- return md5($foo);
+ return md5($foo);
}
require_once(__DIR__ . '/new_db.inc');
@@ -27,7 +27,7 @@ echo "SELECTING results\n";
$results = $db->query("SELECT my_udf_md5(id) FROM test ORDER BY id ASC");
while ($result = $results->fetchArray(SQLITE3_NUM))
{
- var_dump($result);
+ var_dump($result);
}
$results->finalize();
diff --git a/ext/sqlite3/tests/sqlite3_09_blob_bound_param.phpt b/ext/sqlite3/tests/sqlite3_09_blob_bound_param.phpt
index 994503dd03..27497f7448 100644
--- a/ext/sqlite3/tests/sqlite3_09_blob_bound_param.phpt
+++ b/ext/sqlite3/tests/sqlite3_09_blob_bound_param.phpt
@@ -30,7 +30,7 @@ echo "SELECTING results\n";
$results = $db->query("SELECT id, quote(data) AS data FROM test ORDER BY id ASC");
while ($result = $results->fetchArray(SQLITE3_NUM))
{
- var_dump($result);
+ var_dump($result);
}
$results->finalize();
diff --git a/ext/sqlite3/tests/sqlite3_10_bound_value_name.phpt b/ext/sqlite3/tests/sqlite3_10_bound_value_name.phpt
index 712ad2e539..f7bd34f388 100644
--- a/ext/sqlite3/tests/sqlite3_10_bound_value_name.phpt
+++ b/ext/sqlite3/tests/sqlite3_10_bound_value_name.phpt
@@ -25,7 +25,7 @@ var_dump($stmt->bindValue('id', $foo, SQLITE3_TEXT));
$results = $stmt->execute();
while ($result = $results->fetchArray(SQLITE3_NUM))
{
- var_dump($result);
+ var_dump($result);
}
$results->finalize();
diff --git a/ext/sqlite3/tests/sqlite3_12_unfinalized_stmt_cleanup.phpt b/ext/sqlite3/tests/sqlite3_12_unfinalized_stmt_cleanup.phpt
index eac5a59a8a..e3e67f1ff4 100644
--- a/ext/sqlite3/tests/sqlite3_12_unfinalized_stmt_cleanup.phpt
+++ b/ext/sqlite3/tests/sqlite3_12_unfinalized_stmt_cleanup.phpt
@@ -19,9 +19,9 @@ echo "SELECTING results\n";
$results = $db->query("SELECT * FROM test ORDER BY id ASC");
while ($result = $results->fetchArray(SQLITE3_NUM))
{
- var_dump($result);
- /* Only read one row and break */
- break;
+ var_dump($result);
+ /* Only read one row and break */
+ break;
}
echo "Closing database\n";
diff --git a/ext/sqlite3/tests/sqlite3_13_skip_all_cleanup.phpt b/ext/sqlite3/tests/sqlite3_13_skip_all_cleanup.phpt
index daeacc0832..0bced8c19a 100644
--- a/ext/sqlite3/tests/sqlite3_13_skip_all_cleanup.phpt
+++ b/ext/sqlite3/tests/sqlite3_13_skip_all_cleanup.phpt
@@ -19,7 +19,7 @@ echo "SELECTING results\n";
$results = $db->query("SELECT * FROM test ORDER BY id ASC");
while ($result = $results->fetchArray(SQLITE3_NUM))
{
- var_dump($result);
+ var_dump($result);
}
echo "Done\n";
?>
diff --git a/ext/sqlite3/tests/sqlite3_15_open_error-win.phpt b/ext/sqlite3/tests/sqlite3_15_open_error-win.phpt
index d9c7e2fa41..4b75b3b28f 100644
--- a/ext/sqlite3/tests/sqlite3_15_open_error-win.phpt
+++ b/ext/sqlite3/tests/sqlite3_15_open_error-win.phpt
@@ -19,9 +19,9 @@ $cmd = $icacls . ' ' . $unreadable . ' /inheritance:r /deny ' . $user . ':(F,M,R
exec($cmd);
try {
- $db = new SQLite3($unreadable);
+ $db = new SQLite3($unreadable);
} catch (Exception $e) {
- echo $e . "\n";
+ echo $e . "\n";
}
echo "Done\n";
diff --git a/ext/sqlite3/tests/sqlite3_15_open_error.phpt b/ext/sqlite3/tests/sqlite3_15_open_error.phpt
index 74bcc920d0..0c3e9537db 100644
--- a/ext/sqlite3/tests/sqlite3_15_open_error.phpt
+++ b/ext/sqlite3/tests/sqlite3_15_open_error.phpt
@@ -16,9 +16,9 @@ $unreadable = __DIR__ . '/unreadable.db';
touch($unreadable);
chmod($unreadable, 0200);
try {
- $db = new SQLite3($unreadable);
+ $db = new SQLite3($unreadable);
} catch (Exception $e) {
- echo $e . "\n";
+ echo $e . "\n";
}
echo "Done\n";
unlink($unreadable);
diff --git a/ext/sqlite3/tests/sqlite3_16_select_no_results.phpt b/ext/sqlite3/tests/sqlite3_16_select_no_results.phpt
index 91875b68ad..08fe5eeb24 100644
--- a/ext/sqlite3/tests/sqlite3_16_select_no_results.phpt
+++ b/ext/sqlite3/tests/sqlite3_16_select_no_results.phpt
@@ -15,7 +15,7 @@ echo "SELECTING results\n";
$results = $db->query("SELECT * FROM test ORDER BY id ASC");
while ($result = $results->fetchArray(SQLITE3_NUM))
{
- var_dump($result);
+ var_dump($result);
}
$results->finalize();
diff --git a/ext/sqlite3/tests/sqlite3_19_columninfo.phpt b/ext/sqlite3/tests/sqlite3_19_columninfo.phpt
index 2395c75399..51017bb0bc 100644
--- a/ext/sqlite3/tests/sqlite3_19_columninfo.phpt
+++ b/ext/sqlite3/tests/sqlite3_19_columninfo.phpt
@@ -18,10 +18,10 @@ var_dump($db->exec("INSERT INTO test (time, id) VALUES (" . TIMENOW . ", 'b')"))
echo "SELECTING results\n";
$result = $db->query("SELECT * FROM test ORDER BY id ASC");
while ($row = $result->fetchArray(SQLITE3_NUM)) {
- $totalColumns = $result->numColumns();
- for ($i = 0; $i < $totalColumns; $i++) {
- echo "Name: " . $result->columnName($i) . " - Type: " . $result->columnType($i) . "\n";
- }
+ $totalColumns = $result->numColumns();
+ for ($i = 0; $i < $totalColumns; $i++) {
+ echo "Name: " . $result->columnName($i) . " - Type: " . $result->columnType($i) . "\n";
+ }
}
$result->finalize();
diff --git a/ext/sqlite3/tests/sqlite3_20_error.phpt b/ext/sqlite3/tests/sqlite3_20_error.phpt
index a9324c3999..9b1579a83e 100644
--- a/ext/sqlite3/tests/sqlite3_20_error.phpt
+++ b/ext/sqlite3/tests/sqlite3_20_error.phpt
@@ -10,8 +10,8 @@ require_once(__DIR__ . '/new_db.inc');
echo "SELECTING from invalid table\n";
$result = $db->query("SELECT * FROM non_existent_table");
if (!$result) {
- echo "Error Code: " . $db->lastErrorCode() . "\n";
- echo "Error Msg: " . $db->lastErrorMsg() . "\n";
+ echo "Error Code: " . $db->lastErrorCode() . "\n";
+ echo "Error Msg: " . $db->lastErrorMsg() . "\n";
}
echo "Closing database\n";
var_dump($db->close());
diff --git a/ext/sqlite3/tests/sqlite3_21_security.phpt b/ext/sqlite3/tests/sqlite3_21_security.phpt
index 5221807cd5..407869b3f8 100644
--- a/ext/sqlite3/tests/sqlite3_21_security.phpt
+++ b/ext/sqlite3/tests/sqlite3_21_security.phpt
@@ -19,9 +19,9 @@ unlink($directory . $file);
echo "Above test directory\n";
try {
- $db = new SQLite3('../bad' . $file);
+ $db = new SQLite3('../bad' . $file);
} catch (Exception $e) {
- echo $e . "\n";
+ echo $e . "\n";
}
echo "Done\n";
diff --git a/ext/sqlite3/tests/sqlite3_23_escape_string.phpt b/ext/sqlite3/tests/sqlite3_23_escape_string.phpt
index 6552c222a7..f91213ae64 100644
--- a/ext/sqlite3/tests/sqlite3_23_escape_string.phpt
+++ b/ext/sqlite3/tests/sqlite3_23_escape_string.phpt
@@ -19,7 +19,7 @@ echo "SELECTING results\n";
$results = $db->query("SELECT * FROM test ORDER BY id ASC");
while ($result = $results->fetchArray(SQLITE3_NUM))
{
- var_dump($result);
+ var_dump($result);
}
$results->finalize();
diff --git a/ext/sqlite3/tests/sqlite3_25_create_aggregate.phpt b/ext/sqlite3/tests/sqlite3_25_create_aggregate.phpt
index 84993571ec..c8a033e738 100644
--- a/ext/sqlite3/tests/sqlite3_25_create_aggregate.phpt
+++ b/ext/sqlite3/tests/sqlite3_25_create_aggregate.phpt
@@ -8,17 +8,17 @@ SQLite3::createAggregate() test
require_once(__DIR__ . '/new_db.inc');
function sum_list_step($context, $rows, $string) {
- if (empty($context))
- {
- $context = array('total' => 0, 'values' => array());
- }
- $context['total'] += intval($string);
- $context['values'][] = $context['total'];
- return $context;
+ if (empty($context))
+ {
+ $context = array('total' => 0, 'values' => array());
+ }
+ $context['total'] += intval($string);
+ $context['values'][] = $context['total'];
+ return $context;
}
function sum_list_finalize($context) {
- return implode(',', $context['values']);
+ return implode(',', $context['values']);
}
echo "Creating Table\n";
diff --git a/ext/sqlite3/tests/sqlite3_26_reset_prepared_stmt.phpt b/ext/sqlite3/tests/sqlite3_26_reset_prepared_stmt.phpt
index ffd05d3329..39e9e48676 100644
--- a/ext/sqlite3/tests/sqlite3_26_reset_prepared_stmt.phpt
+++ b/ext/sqlite3/tests/sqlite3_26_reset_prepared_stmt.phpt
@@ -23,11 +23,11 @@ var_dump($stmt->bindParam(1, $foo, SQLITE3_TEXT));
$foo = 'a';
$results = $stmt->execute();
while ($result = $results->fetchArray(SQLITE3_NUM)) {
- var_dump($result);
+ var_dump($result);
}
$stmt->reset();
while ($result = $results->fetchArray(SQLITE3_NUM)) {
- var_dump($result);
+ var_dump($result);
}
$results->finalize();
diff --git a/ext/sqlite3/tests/sqlite3_27_reset_prepared_stmt_result.phpt b/ext/sqlite3/tests/sqlite3_27_reset_prepared_stmt_result.phpt
index 646cb473f3..6257d6483c 100644
--- a/ext/sqlite3/tests/sqlite3_27_reset_prepared_stmt_result.phpt
+++ b/ext/sqlite3/tests/sqlite3_27_reset_prepared_stmt_result.phpt
@@ -23,11 +23,11 @@ var_dump($stmt->bindParam(1, $foo, SQLITE3_TEXT));
$foo = 'a';
$results = $stmt->execute();
while ($result = $results->fetchArray(SQLITE3_NUM)) {
- var_dump($result);
+ var_dump($result);
}
$results->reset();
while ($result = $results->fetchArray(SQLITE3_NUM)) {
- var_dump($result);
+ var_dump($result);
}
$results->finalize();
diff --git a/ext/sqlite3/tests/sqlite3_28_clear_bindings.phpt b/ext/sqlite3/tests/sqlite3_28_clear_bindings.phpt
index a17e1fb3f1..4472b878bc 100644
--- a/ext/sqlite3/tests/sqlite3_28_clear_bindings.phpt
+++ b/ext/sqlite3/tests/sqlite3_28_clear_bindings.phpt
@@ -23,14 +23,14 @@ var_dump($stmt->bindParam(1, $foo, SQLITE3_TEXT));
$foo = 'a';
$results = $stmt->execute();
while ($result = $results->fetchArray(SQLITE3_NUM)) {
- var_dump($result);
+ var_dump($result);
}
$stmt->reset();
$stmt->clear();
var_dump($stmt->bindValue(1, 'b', SQLITE3_TEXT));
$results = $stmt->execute();
while ($result = $results->fetchArray(SQLITE3_NUM)) {
- var_dump($result);
+ var_dump($result);
}
$results->finalize();
diff --git a/ext/sqlite3/tests/sqlite3_33_reset.phpt b/ext/sqlite3/tests/sqlite3_33_reset.phpt
index 531874ceb6..48abc829c7 100644
--- a/ext/sqlite3/tests/sqlite3_33_reset.phpt
+++ b/ext/sqlite3/tests/sqlite3_33_reset.phpt
@@ -15,13 +15,11 @@ $db->exec("INSERT INTO foo (id, bar) VALUES (1, 'This is a test')");
$stmt = $db->prepare('SELECT bar FROM foo WHERE id=:id');
$stmt->bindValue(':id', 1, SQLITE3_INTEGER);
-$stmt->reset("dummy");
$stmt->reset();
//var_dump($db);
//var_dump($db->close());
echo "Done\n";
?>
---EXPECTF--
-Warning: SQLite3Stmt::reset() expects exactly 0 parameters, 1 given in %s on line %d
+--EXPECT--
Done
diff --git a/ext/sqlite3/tests/sqlite3_36_create_collation.phpt b/ext/sqlite3/tests/sqlite3_36_create_collation.phpt
index 90fbd9d37b..644ceb02c6 100644
--- a/ext/sqlite3/tests/sqlite3_36_create_collation.phpt
+++ b/ext/sqlite3/tests/sqlite3_36_create_collation.phpt
@@ -13,8 +13,8 @@ $db->exec('CREATE TABLE t (s varchar(4))');
$stmt = $db->prepare('INSERT INTO t VALUES (?)');
foreach(array('a1', 'a10', 'a2') as $s){
- $stmt->bindParam(1, $s);
- $stmt->execute();
+ $stmt->bindParam(1, $s);
+ $stmt->execute();
}
$defaultSort = $db->query('SELECT s FROM t ORDER BY s'); //memcmp() sort
@@ -22,12 +22,12 @@ $naturalSort = $db->query('SELECT s FROM t ORDER BY s COLLATE NAT'); //strnatcmp
echo "default\n";
while ($row = $defaultSort->fetchArray()){
- echo $row['s'], "\n";
+ echo $row['s'], "\n";
}
echo "natural\n";
while ($row = $naturalSort->fetchArray()){
- echo $row['s'], "\n";
+ echo $row['s'], "\n";
}
$db->close();
diff --git a/ext/sqlite3/tests/sqlite3_40_setauthorizer.phpt b/ext/sqlite3/tests/sqlite3_40_setauthorizer.phpt
new file mode 100644
index 0000000000..994c67e0c3
--- /dev/null
+++ b/ext/sqlite3/tests/sqlite3_40_setauthorizer.phpt
@@ -0,0 +1,104 @@
+--TEST--
+SQLite3 user authorizer callback
+--SKIPIF--
+<?php require_once(__DIR__ . '/skipif.inc'); ?>
+--FILE--
+<?php
+
+$db = new SQLite3(':memory:');
+$db->enableExceptions(true);
+
+$db->setAuthorizer(function (int $action) {
+ if ($action == SQLite3::SELECT) {
+ return SQLite3::OK;
+ }
+
+ return SQLite3::DENY;
+});
+
+// This query should be accepted
+var_dump($db->querySingle('SELECT 1;'));
+
+try {
+ // This one should fail
+ var_dump($db->querySingle('CREATE TABLE test (a, b);'));
+} catch (\Exception $e) {
+ echo $e->getMessage() . "\n";
+}
+
+// Test disabling the authorizer
+$db->setAuthorizer(null);
+
+// This should now succeed
+var_dump($db->exec('CREATE TABLE test (a); INSERT INTO test VALUES (42);'));
+var_dump($db->querySingle('SELECT a FROM test;'));
+
+// Test if we are getting the correct arguments
+$db->setAuthorizer(function (int $action) {
+ $constants = (new ReflectionClass('SQLite3'))->getConstants();
+ $constants = array_flip($constants);
+
+ var_dump($constants[$action], implode(',', array_slice(func_get_args(), 1)));
+ return SQLITE3::OK;
+});
+
+var_dump($db->exec('SELECT * FROM test WHERE a = 42;'));
+var_dump($db->exec('DROP TABLE test;'));
+
+// Try to return something invalid from the authorizer
+$db->setAuthorizer(function () {
+ return 'FAIL';
+});
+
+try {
+ var_dump($db->querySingle('SELECT 1;'));
+} catch (\Exception $e) {
+ echo $e->getMessage() . "\n";
+ echo $e->getPrevious()->getMessage() . "\n";
+}
+
+$db->setAuthorizer(function () {
+ return 4200;
+});
+
+try {
+ var_dump($db->querySingle('SELECT 1;'));
+} catch (\Exception $e) {
+ echo $e->getMessage() . "\n";
+ echo $e->getPrevious()->getMessage() . "\n";
+}
+
+?>
+--EXPECTF--
+int(1)
+Unable to prepare statement: 23, not authorized
+bool(true)
+int(42)
+string(6) "SELECT"
+string(3) ",,,"
+string(4) "READ"
+string(12) "test,a,main,"
+string(4) "READ"
+string(12) "test,a,main,"
+bool(true)
+string(6) "DELETE"
+string(20) "sqlite_master,,main,"
+string(10) "DROP_TABLE"
+string(11) "test,,main,"
+string(6) "DELETE"
+string(11) "test,,main,"
+string(6) "DELETE"
+string(20) "sqlite_master,,main,"
+string(4) "READ"
+string(28) "sqlite_master,tbl_name,main,"
+string(4) "READ"
+string(24) "sqlite_master,type,main,"
+string(6) "UPDATE"
+string(28) "sqlite_master,rootpage,main,"
+string(4) "READ"
+string(28) "sqlite_master,rootpage,main,"
+bool(true)
+Unable to prepare statement: 23, not authorized
+The authorizer callback returned an invalid type: expected int
+Unable to prepare statement: 23, not authorized
+The authorizer callback returned an invalid value
diff --git a/ext/sqlite3/tests/sqlite3_bind_bug68849.phpt b/ext/sqlite3/tests/sqlite3_bind_bug68849.phpt
index 7e4a4e8243..179e04d35d 100644
--- a/ext/sqlite3/tests/sqlite3_bind_bug68849.phpt
+++ b/ext/sqlite3/tests/sqlite3_bind_bug68849.phpt
@@ -8,9 +8,9 @@ Bug #68849 bindValue is not using the right data type
$db = new SQLite3(':memory:');
$db->exec("CREATE TABLE test (a INTEGER, b TEXT, c REAL);" .
- "INSERT INTO test VALUES (1, 'hello', 3.14);" .
- "INSERT INTO test VALUES (3, 'world', 3.15);" .
- "INSERT INTO test VALUES (0, '42', 0.42);"
+ "INSERT INTO test VALUES (1, 'hello', 3.14);" .
+ "INSERT INTO test VALUES (3, 'world', 3.15);" .
+ "INSERT INTO test VALUES (0, '42', 0.42);"
);
$s = $db->prepare('SELECT * FROM test WHERE (a+2) = ?;');
@@ -34,7 +34,6 @@ $r = $s->execute();
var_dump($r->fetchArray(SQLITE3_ASSOC));
?>
-==DONE==
--EXPECT--
array(3) {
["a"]=>
@@ -68,4 +67,3 @@ array(3) {
["c"]=>
float(3.15)
}
-==DONE==
diff --git a/ext/sqlite3/tests/sqlite3_blob_bind_resource.phpt b/ext/sqlite3/tests/sqlite3_blob_bind_resource.phpt
index c35af945db..de7edfbbac 100644
--- a/ext/sqlite3/tests/sqlite3_blob_bind_resource.phpt
+++ b/ext/sqlite3/tests/sqlite3_blob_bind_resource.phpt
@@ -13,10 +13,10 @@ $insert_stmt = $db->prepare("INSERT INTO test (id, data) VALUES (1, ?)");
class HelloWrapper {
- public function stream_open() { return true; }
- public function stream_eof() { return true; }
- public function stream_read() { return NULL; }
- public function stream_stat() { return array(); }
+ public function stream_open() { return true; }
+ public function stream_eof() { return true; }
+ public function stream_read() { return NULL; }
+ public function stream_stat() { return array(); }
}
stream_wrapper_register("hello", "HelloWrapper");
diff --git a/ext/sqlite3/tests/sqlite3_bound_value_at_name.phpt b/ext/sqlite3/tests/sqlite3_bound_value_at_name.phpt
index d0eec87a2f..c441b1bc4a 100644
--- a/ext/sqlite3/tests/sqlite3_bound_value_at_name.phpt
+++ b/ext/sqlite3/tests/sqlite3_bound_value_at_name.phpt
@@ -23,7 +23,7 @@ var_dump($stmt->bindValue('@id', $foo, SQLITE3_TEXT));
$results = $stmt->execute();
while ($result = $results->fetchArray(SQLITE3_NUM))
{
- var_dump($result);
+ var_dump($result);
}
$results->finalize();
diff --git a/ext/sqlite3/tests/sqlite3_enable_exceptions.phpt b/ext/sqlite3/tests/sqlite3_enable_exceptions.phpt
index 767f9d0065..d921b99dd7 100644
--- a/ext/sqlite3/tests/sqlite3_enable_exceptions.phpt
+++ b/ext/sqlite3/tests/sqlite3_enable_exceptions.phpt
@@ -17,7 +17,6 @@ try{
}
var_dump($db->enableExceptions(false));
$db->query("SELECT * FROM non_existent_table");
-var_dump($db->enableExceptions("wrong_type","wrong_type"));
echo "Closing database\n";
var_dump($db->close());
echo "Done\n";
@@ -28,9 +27,6 @@ no such table: non_existent_table
bool(true)
Warning: SQLite3::query(): no such table: non_existent_table in %s on line %d
-
-Warning: SQLite3::enableExceptions() expects at most 1 parameter, 2 given in %s on line %d
-NULL
Closing database
bool(true)
Done
diff --git a/ext/sqlite3/tests/sqlite3_prepare_001.phpt b/ext/sqlite3/tests/sqlite3_prepare_001.phpt
index 5142081b3a..f97eaab021 100644
--- a/ext/sqlite3/tests/sqlite3_prepare_001.phpt
+++ b/ext/sqlite3/tests/sqlite3_prepare_001.phpt
@@ -6,8 +6,8 @@ SQLite3 - memory leak on SQLite3Result and SQLite3Stmt
<?php
function test(&$x) {
- $class = new SQLite3(':memory:');
- $x = $class->prepare('SELECT 1');
+ $class = new SQLite3(':memory:');
+ $x = $class->prepare('SELECT 1');
}
test($foo);
diff --git a/ext/sqlite3/tests/sqlite3stmt_paramCount_basic.phpt b/ext/sqlite3/tests/sqlite3stmt_paramCount_basic.phpt
index a520f5715b..81eae9e566 100644
--- a/ext/sqlite3/tests/sqlite3stmt_paramCount_basic.phpt
+++ b/ext/sqlite3/tests/sqlite3stmt_paramCount_basic.phpt
@@ -16,21 +16,21 @@ var_dump($db->exec("INSERT INTO foobar (id, name, city) VALUES (2, 'doe', 'SF')"
$queryArray = array(
- "SELECT * FROM foobar WHERE id = ? ORDER BY id ASC",
- "SELECT * FROM foobar WHERE id = 2 ORDER BY id ASC",
- "SELECT * FROM foobar WHERE id = :id AND name = :name ORDER BY id ASC",
- "SELECT * FROM foobar WHERE id = 1 AND name = :name ORDER BY id ASC",
+ "SELECT * FROM foobar WHERE id = ? ORDER BY id ASC",
+ "SELECT * FROM foobar WHERE id = 2 ORDER BY id ASC",
+ "SELECT * FROM foobar WHERE id = :id AND name = :name ORDER BY id ASC",
+ "SELECT * FROM foobar WHERE id = 1 AND name = :name ORDER BY id ASC",
);
echo "SELECTING results\n";
foreach($queryArray as $key => $query) {
- $stmt = $db->prepare($query);
+ $stmt = $db->prepare($query);
- echo 'Param count for query ' . ($key + 1) . ":\n";
- var_dump($stmt->paramCount());
+ echo 'Param count for query ' . ($key + 1) . ":\n";
+ var_dump($stmt->paramCount());
- $result = $stmt->execute();
+ $result = $stmt->execute();
}
echo "Closing database\n";
diff --git a/ext/sqlite3/tests/stream_test.inc b/ext/sqlite3/tests/stream_test.inc
index 13fd6f89f9..0d53d0f7be 100644
--- a/ext/sqlite3/tests/stream_test.inc
+++ b/ext/sqlite3/tests/stream_test.inc
@@ -2,42 +2,42 @@
class SQLite3_Test_Stream
{
- private $position;
- public static $string_length = 10;
- public static $string = "abcdefg\0hi";
-
- public function stream_open($path, $mode, $options, &$opened_path)
- {
- $this->position = 0;
- return true;
- }
-
- public function stream_read($count)
- {
- $ret = substr(self::$string, $this->position, $count);
- $this->position += strlen($ret);
- return $ret;
- }
-
- public function stream_write($data)
- {
- return 0;
- }
-
- public function stream_stat()
- {
- return array('size' => self::$string_length);
- }
-
- public function stream_tell()
- {
- return $this->position;
- }
-
- public function stream_eof()
- {
- return ($this->position >= self::$string_length);
- }
+ private $position;
+ public static $string_length = 10;
+ public static $string = "abcdefg\0hi";
+
+ public function stream_open($path, $mode, $options, &$opened_path)
+ {
+ $this->position = 0;
+ return true;
+ }
+
+ public function stream_read($count)
+ {
+ $ret = substr(self::$string, $this->position, $count);
+ $this->position += strlen($ret);
+ return $ret;
+ }
+
+ public function stream_write($data)
+ {
+ return 0;
+ }
+
+ public function stream_stat()
+ {
+ return array('size' => self::$string_length);
+ }
+
+ public function stream_tell()
+ {
+ return $this->position;
+ }
+
+ public function stream_eof()
+ {
+ return ($this->position >= self::$string_length);
+ }
}
stream_wrapper_register('sqliteBlobTest', "SQLite3_Test_Stream") or die("Unable to register sqliteBlobTest stream");
diff --git a/ext/standard/array.c b/ext/standard/array.c
index ec0890478a..9e0af6f07c 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -42,6 +40,7 @@
#include "php_math.h"
#include "zend_smart_str.h"
#include "zend_bitset.h"
+#include "zend_exceptions.h"
#include "ext/spl/spl_array.h"
/* {{{ defines */
@@ -365,7 +364,6 @@ static int php_array_data_compare(const void *a, const void *b) /* {{{ */
{
Bucket *f;
Bucket *s;
- zval result;
zval *first;
zval *second;
@@ -381,12 +379,7 @@ static int php_array_data_compare(const void *a, const void *b) /* {{{ */
if (UNEXPECTED(Z_TYPE_P(second) == IS_INDIRECT)) {
second = Z_INDIRECT_P(second);
}
- if (compare_function(&result, first, second) == FAILURE) {
- return 0;
- }
-
- ZEND_ASSERT(Z_TYPE(result) == IS_LONG);
- return ZEND_NORMALIZE_BOOL(Z_LVAL(result));
+ return zend_compare(first, second);
}
/* }}} */
@@ -696,13 +689,12 @@ PHP_FUNCTION(krsort)
Z_PARAM_ARRAY_EX(array, 0, 1)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(sort_type)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
cmp = php_get_key_compare_func(sort_type, 1);
- if (zend_hash_sort(Z_ARRVAL_P(array), cmp, 0) == FAILURE) {
- RETURN_FALSE;
- }
+ zend_hash_sort(Z_ARRVAL_P(array), cmp, 0);
+
RETURN_TRUE;
}
/* }}} */
@@ -719,13 +711,12 @@ PHP_FUNCTION(ksort)
Z_PARAM_ARRAY_EX(array, 0, 1)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(sort_type)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
cmp = php_get_key_compare_func(sort_type, 0);
- if (zend_hash_sort(Z_ARRVAL_P(array), cmp, 0) == FAILURE) {
- RETURN_FALSE;
- }
+ zend_hash_sort(Z_ARRVAL_P(array), cmp, 0);
+
RETURN_TRUE;
}
/* }}} */
@@ -737,7 +728,7 @@ PHPAPI zend_long php_count_recursive(HashTable *ht) /* {{{ */
if (!(GC_FLAGS(ht) & GC_IMMUTABLE)) {
if (GC_IS_RECURSIVE(ht)) {
- php_error_docref(NULL, E_WARNING, "recursion detected");
+ php_error_docref(NULL, E_WARNING, "Recursion detected");
return 0;
}
GC_PROTECT_RECURSION(ht);
@@ -773,8 +764,14 @@ PHP_FUNCTION(count)
Z_PARAM_LONG(mode)
ZEND_PARSE_PARAMETERS_END();
+ if (mode != COUNT_NORMAL && mode != COUNT_RECURSIVE) {
+ zend_value_error("Mode value is invalid");
+ RETURN_THROWS();
+ }
+
switch (Z_TYPE_P(array)) {
case IS_NULL:
+ /* Intentionally not converted to an exception */
php_error_docref(NULL, E_WARNING, "Parameter must be an array or an object that implements Countable");
RETURN_LONG(0);
break;
@@ -791,16 +788,16 @@ PHP_FUNCTION(count)
/* first, we check if the handler is defined */
if (Z_OBJ_HT_P(array)->count_elements) {
RETVAL_LONG(1);
- if (SUCCESS == Z_OBJ_HT(*array)->count_elements(array, &Z_LVAL_P(return_value))) {
+ if (SUCCESS == Z_OBJ_HT(*array)->count_elements(Z_OBJ_P(array), &Z_LVAL_P(return_value))) {
return;
}
if (EG(exception)) {
- return;
+ RETURN_THROWS();
}
}
/* if not and the object implements Countable we call its count() method */
if (instanceof_function(Z_OBJCE_P(array), zend_ce_countable)) {
- zend_call_method_with_0_params(array, NULL, NULL, "count", &retval);
+ zend_call_method_with_0_params(Z_OBJ_P(array), NULL, NULL, "count", &retval);
if (Z_TYPE(retval) != IS_UNDEF) {
RETVAL_LONG(zval_get_long(&retval));
zval_ptr_dtor(&retval);
@@ -809,11 +806,13 @@ PHP_FUNCTION(count)
}
/* If There's no handler and it doesn't implement Countable then add a warning */
+ /* Intentionally not converted to an exception */
php_error_docref(NULL, E_WARNING, "Parameter must be an array or an object that implements Countable");
RETURN_LONG(1);
break;
}
default:
+ /* Intentionally not converted to an exception */
php_error_docref(NULL, E_WARNING, "Parameter must be an array or an object that implements Countable");
RETURN_LONG(1);
break;
@@ -830,13 +829,9 @@ static void php_natsort(INTERNAL_FUNCTION_PARAMETERS, int fold_case) /* {{{ */
ZEND_PARSE_PARAMETERS_END();
if (fold_case) {
- if (zend_hash_sort(Z_ARRVAL_P(array), php_array_natural_case_compare, 0) == FAILURE) {
- return;
- }
+ zend_hash_sort(Z_ARRVAL_P(array), php_array_natural_case_compare, 0);
} else {
- if (zend_hash_sort(Z_ARRVAL_P(array), php_array_natural_compare, 0) == FAILURE) {
- return;
- }
+ zend_hash_sort(Z_ARRVAL_P(array), php_array_natural_compare, 0);
}
RETURN_TRUE;
@@ -871,13 +866,12 @@ PHP_FUNCTION(asort)
Z_PARAM_ARRAY_EX(array, 0, 1)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(sort_type)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
cmp = php_get_data_compare_func(sort_type, 0);
- if (zend_hash_sort(Z_ARRVAL_P(array), cmp, 0) == FAILURE) {
- RETURN_FALSE;
- }
+ zend_hash_sort(Z_ARRVAL_P(array), cmp, 0);
+
RETURN_TRUE;
}
/* }}} */
@@ -894,13 +888,12 @@ PHP_FUNCTION(arsort)
Z_PARAM_ARRAY_EX(array, 0, 1)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(sort_type)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
cmp = php_get_data_compare_func(sort_type, 1);
- if (zend_hash_sort(Z_ARRVAL_P(array), cmp, 0) == FAILURE) {
- RETURN_FALSE;
- }
+ zend_hash_sort(Z_ARRVAL_P(array), cmp, 0);
+
RETURN_TRUE;
}
/* }}} */
@@ -917,13 +910,12 @@ PHP_FUNCTION(sort)
Z_PARAM_ARRAY_EX(array, 0, 1)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(sort_type)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
cmp = php_get_data_compare_func(sort_type, 0);
- if (zend_hash_sort(Z_ARRVAL_P(array), cmp, 1) == FAILURE) {
- RETURN_FALSE;
- }
+ zend_hash_sort(Z_ARRVAL_P(array), cmp, 1);
+
RETURN_TRUE;
}
/* }}} */
@@ -940,13 +932,12 @@ PHP_FUNCTION(rsort)
Z_PARAM_ARRAY_EX(array, 0, 1)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(sort_type)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
cmp = php_get_data_compare_func(sort_type, 1);
- if (zend_hash_sort(Z_ARRVAL_P(array), cmp, 1) == FAILURE) {
- RETURN_FALSE;
- }
+ zend_hash_sort(Z_ARRVAL_P(array), cmp, 1);
+
RETURN_TRUE;
}
/* }}} */
@@ -1016,7 +1007,6 @@ static void php_usort(INTERNAL_FUNCTION_PARAMETERS, compare_func_t compare_func,
{
zval *array;
zend_array *arr;
- zend_bool retval;
PHP_ARRAY_CMP_FUNC_VARS;
PHP_ARRAY_CMP_FUNC_BACKUP();
@@ -1035,13 +1025,13 @@ static void php_usort(INTERNAL_FUNCTION_PARAMETERS, compare_func_t compare_func,
/* Copy array, so the in-place modifications will not be visible to the callback function */
arr = zend_array_dup(arr);
- retval = zend_hash_sort(arr, compare_func, renumber) != FAILURE;
+ zend_hash_sort(arr, compare_func, renumber);
zval_ptr_dtor(array);
ZVAL_ARR(array, arr);
PHP_ARRAY_CMP_FUNC_RESTORE();
- RETURN_BOOL(retval);
+ RETURN_TRUE;
}
/* }}} */
@@ -1254,7 +1244,9 @@ PHP_FUNCTION(key)
}
/* }}} */
-/* {{{ proto mixed min(mixed arg1 [, mixed arg2 [, mixed ...]])
+/* {{{
+ * proto mixed min(array values)
+ * proto mixed min(mixed arg1 [, mixed arg2 [, mixed ...]])
Return the lowest value in an array or a series of arguments */
PHP_FUNCTION(min)
{
@@ -1270,14 +1262,14 @@ PHP_FUNCTION(min)
zval *result;
if (Z_TYPE(args[0]) != IS_ARRAY) {
- php_error_docref(NULL, E_WARNING, "When only one parameter is given, it must be an array");
- RETVAL_NULL();
+ zend_type_error("When only one parameter is given, it must be an array");
+ RETURN_THROWS();
} else {
if ((result = zend_hash_minmax(Z_ARRVAL(args[0]), php_array_data_compare, 0)) != NULL) {
ZVAL_COPY_DEREF(return_value, result);
} else {
- php_error_docref(NULL, E_WARNING, "Array must contain at least one element");
- RETVAL_FALSE;
+ zend_value_error("Array must contain at least one element");
+ RETURN_THROWS();
}
}
} else {
@@ -1299,7 +1291,9 @@ PHP_FUNCTION(min)
}
/* }}} */
-/* {{{ proto mixed max(mixed arg1 [, mixed arg2 [, mixed ...]])
+/* {{{
+ * proto mixed max(array values)
+ * proto mixed max(mixed arg1 [, mixed arg2 [, mixed ...]])
Return the highest value in an array or a series of arguments */
PHP_FUNCTION(max)
{
@@ -1315,14 +1309,14 @@ PHP_FUNCTION(max)
zval *result;
if (Z_TYPE(args[0]) != IS_ARRAY) {
- php_error_docref(NULL, E_WARNING, "When only one parameter is given, it must be an array");
- RETVAL_NULL();
+ zend_type_error("When only one parameter is given, it must be an array");
+ RETURN_THROWS();
} else {
if ((result = zend_hash_minmax(Z_ARRVAL(args[0]), php_array_data_compare, 1)) != NULL) {
ZVAL_COPY_DEREF(return_value, result);
} else {
- php_error_docref(NULL, E_WARNING, "Array must contain at least one element");
- RETVAL_FALSE;
+ zend_value_error("Array must contain at least one element");
+ RETURN_THROWS();
}
}
} else {
@@ -1409,7 +1403,7 @@ static int php_array_walk(zval *array, zval *userdata, int recursive) /* {{{ */
SEPARATE_ARRAY(zv);
thash = Z_ARRVAL_P(zv);
if (GC_IS_RECURSIVE(thash)) {
- php_error_docref(NULL, E_WARNING, "recursion detected");
+ zend_throw_error(NULL, "Recursion detected");
result = FAILURE;
break;
}
@@ -1460,7 +1454,7 @@ static int php_array_walk(zval *array, zval *userdata, int recursive) /* {{{ */
target_hash = Z_OBJPROP_P(array);
pos = zend_hash_iterator_pos(ht_iter, target_hash);
} else {
- php_error_docref(NULL, E_WARNING, "Iterated value is no longer an array or object");
+ zend_type_error("Iterated value is no longer an array or object");
result = FAILURE;
break;
}
@@ -1716,16 +1710,16 @@ static zend_always_inline int php_valid_var_name(const char *var_name, size_t va
}
/* }}} */
-PHPAPI int php_prefix_varname(zval *result, const zval *prefix, const char *var_name, size_t var_name_len, zend_bool add_underscore) /* {{{ */
+PHPAPI int php_prefix_varname(zval *result, zend_string *prefix, const char *var_name, size_t var_name_len, zend_bool add_underscore) /* {{{ */
{
- ZVAL_NEW_STR(result, zend_string_alloc(Z_STRLEN_P(prefix) + (add_underscore ? 1 : 0) + var_name_len, 0));
- memcpy(Z_STRVAL_P(result), Z_STRVAL_P(prefix), Z_STRLEN_P(prefix));
+ ZVAL_NEW_STR(result, zend_string_alloc(ZSTR_LEN(prefix) + (add_underscore ? 1 : 0) + var_name_len, 0));
+ memcpy(Z_STRVAL_P(result), ZSTR_VAL(prefix), ZSTR_LEN(prefix));
if (add_underscore) {
- Z_STRVAL_P(result)[Z_STRLEN_P(prefix)] = '_';
+ Z_STRVAL_P(result)[ZSTR_LEN(prefix)] = '_';
}
- memcpy(Z_STRVAL_P(result) + Z_STRLEN_P(prefix) + (add_underscore ? 1 : 0), var_name, var_name_len + 1);
+ memcpy(Z_STRVAL_P(result) + ZSTR_LEN(prefix) + (add_underscore ? 1 : 0), var_name, var_name_len + 1);
return SUCCESS;
}
@@ -1904,7 +1898,7 @@ static zend_long php_extract_overwrite(zend_array *arr, zend_array *symbol_table
}
/* }}} */
-static zend_long php_extract_ref_prefix_if_exists(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */
+static zend_long php_extract_ref_prefix_if_exists(zend_array *arr, zend_array *symbol_table, zend_string *prefix) /* {{{ */
{
zend_long count = 0;
zend_string *var_name;
@@ -1960,7 +1954,7 @@ static zend_long php_extract_ref_prefix_if_exists(zend_array *arr, zend_array *s
}
/* }}} */
-static zend_long php_extract_prefix_if_exists(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */
+static zend_long php_extract_prefix_if_exists(zend_array *arr, zend_array *symbol_table, zend_string *prefix) /* {{{ */
{
zend_long count = 0;
zend_string *var_name;
@@ -2011,7 +2005,7 @@ static zend_long php_extract_prefix_if_exists(zend_array *arr, zend_array *symbo
}
/* }}} */
-static zend_long php_extract_ref_prefix_same(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */
+static zend_long php_extract_ref_prefix_same(zend_array *arr, zend_array *symbol_table, zend_string *prefix) /* {{{ */
{
zend_long count = 0;
zend_string *var_name;
@@ -2085,7 +2079,7 @@ prefix:
}
/* }}} */
-static zend_long php_extract_prefix_same(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */
+static zend_long php_extract_prefix_same(zend_array *arr, zend_array *symbol_table, zend_string *prefix) /* {{{ */
{
zend_long count = 0;
zend_string *var_name;
@@ -2151,7 +2145,7 @@ prefix:
}
/* }}} */
-static zend_long php_extract_ref_prefix_all(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */
+static zend_long php_extract_ref_prefix_all(zend_array *arr, zend_array *symbol_table, zend_string *prefix) /* {{{ */
{
zend_long count = 0;
zend_string *var_name;
@@ -2198,7 +2192,7 @@ static zend_long php_extract_ref_prefix_all(zend_array *arr, zend_array *symbol_
}
/* }}} */
-static zend_long php_extract_prefix_all(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */
+static zend_long php_extract_prefix_all(zend_array *arr, zend_array *symbol_table, zend_string *prefix) /* {{{ */
{
zend_long count = 0;
zend_string *var_name;
@@ -2245,7 +2239,7 @@ static zend_long php_extract_prefix_all(zend_array *arr, zend_array *symbol_tabl
}
/* }}} */
-static zend_long php_extract_ref_prefix_invalid(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */
+static zend_long php_extract_ref_prefix_invalid(zend_array *arr, zend_array *symbol_table, zend_string *prefix) /* {{{ */
{
zend_long count = 0;
zend_string *var_name;
@@ -2300,7 +2294,7 @@ static zend_long php_extract_ref_prefix_invalid(zend_array *arr, zend_array *sym
}
/* }}} */
-static zend_long php_extract_prefix_invalid(zend_array *arr, zend_array *symbol_table, zval *prefix) /* {{{ */
+static zend_long php_extract_prefix_invalid(zend_array *arr, zend_array *symbol_table, zend_string *prefix) /* {{{ */
{
zend_long count = 0;
zend_string *var_name;
@@ -2441,9 +2435,10 @@ static zend_long php_extract_skip(zend_array *arr, zend_array *symbol_table) /*
Imports variables into symbol table from an array */
PHP_FUNCTION(extract)
{
- zval *var_array_param, *prefix = NULL;
+ zval *var_array_param;
zend_long extract_refs;
zend_long extract_type = EXTR_OVERWRITE;
+ zend_string *prefix = NULL;
zend_long count;
zend_array *symbol_table;
@@ -2451,7 +2446,7 @@ PHP_FUNCTION(extract)
Z_PARAM_ARRAY_EX2(var_array_param, 0, 1, 0)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(extract_type)
- Z_PARAM_ZVAL(prefix)
+ Z_PARAM_STR(prefix)
ZEND_PARSE_PARAMETERS_END();
extract_refs = (extract_type & EXTR_REFS);
@@ -2461,23 +2456,19 @@ PHP_FUNCTION(extract)
extract_type &= 0xff;
if (extract_type < EXTR_OVERWRITE || extract_type > EXTR_IF_EXISTS) {
- php_error_docref(NULL, E_WARNING, "Invalid extract type");
- return;
+ zend_value_error("Invalid extract type");
+ RETURN_THROWS();
}
if (extract_type > EXTR_SKIP && extract_type <= EXTR_PREFIX_IF_EXISTS && ZEND_NUM_ARGS() < 3) {
- php_error_docref(NULL, E_WARNING, "specified extract type requires the prefix parameter");
- return;
+ zend_value_error("Specified extract type requires the prefix parameter");
+ RETURN_THROWS();
}
if (prefix) {
- if (!try_convert_to_string(prefix)) {
- return;
- }
-
- if (Z_STRLEN_P(prefix) && !php_valid_var_name(Z_STRVAL_P(prefix), Z_STRLEN_P(prefix))) {
- php_error_docref(NULL, E_WARNING, "prefix is not a valid identifier");
- return;
+ if (ZSTR_LEN(prefix) && !php_valid_var_name(ZSTR_VAL(prefix), ZSTR_LEN(prefix))) {
+ zend_value_error("Prefix is not a valid identifier");
+ RETURN_THROWS();
}
}
@@ -2486,6 +2477,7 @@ PHP_FUNCTION(extract)
}
symbol_table = zend_rebuild_symbol_table();
+ ZEND_ASSERT(symbol_table && "A symbol table should always be available here");
if (extract_refs) {
switch (extract_type) {
@@ -2568,7 +2560,7 @@ static void php_compact_var(HashTable *eg_active_symbol_table, zval *return_valu
} else if (Z_TYPE_P(entry) == IS_ARRAY) {
if (Z_REFCOUNTED_P(entry)) {
if (Z_IS_RECURSIVE_P(entry)) {
- php_error_docref(NULL, E_WARNING, "recursion detected");
+ zend_throw_error(NULL, "Recursion detected");
return;
}
Z_PROTECT_RECURSION_P(entry);
@@ -2600,9 +2592,7 @@ PHP_FUNCTION(compact)
}
symbol_table = zend_rebuild_symbol_table();
- if (UNEXPECTED(symbol_table == NULL)) {
- return;
- }
+ ZEND_ASSERT(symbol_table && "A symbol table should always be available here");
/* compact() is probably most used with a single array of var_names
or multiple string names, rather than a combination of both.
@@ -2634,11 +2624,11 @@ PHP_FUNCTION(array_fill)
if (EXPECTED(num > 0)) {
if (sizeof(num) > 4 && UNEXPECTED(EXPECTED(num > 0x7fffffff))) {
- php_error_docref(NULL, E_WARNING, "Too many elements");
- RETURN_FALSE;
+ zend_value_error("Too many elements");
+ RETURN_THROWS();
} else if (UNEXPECTED(start_key > ZEND_LONG_MAX - num + 1)) {
- php_error_docref(NULL, E_WARNING, "Cannot add element to the array as the next element is already occupied");
- RETURN_FALSE;
+ zend_throw_error(NULL, "Cannot add element to the array as the next element is already occupied");
+ RETURN_THROWS();
} else if (EXPECTED(start_key >= 0) && EXPECTED(start_key < num)) {
/* create packed array */
Bucket *p;
@@ -2683,8 +2673,8 @@ PHP_FUNCTION(array_fill)
} else if (EXPECTED(num == 0)) {
RETURN_EMPTY_ARRAY();
} else {
- php_error_docref(NULL, E_WARNING, "Number of elements can't be negative");
- RETURN_FALSE;
+ zend_value_error("Number of elements can't be negative");
+ RETURN_THROWS();
}
}
/* }}} */
@@ -2721,8 +2711,9 @@ PHP_FUNCTION(array_fill_keys)
#define RANGE_CHECK_DOUBLE_INIT_ARRAY(start, end) do { \
double __calc_size = ((start - end) / step) + 1; \
if (__calc_size >= (double)HT_MAX_SIZE) { \
- php_error_docref(NULL, E_WARNING, "The supplied range exceeds the maximum array size: start=%0.0f end=%0.0f", end, start); \
- RETURN_FALSE; \
+ zend_value_error(\
+ "The supplied range exceeds the maximum array size: start=%0.0f end=%0.0f", end, start); \
+ RETURN_THROWS(); \
} \
size = (uint32_t)_php_math_round(__calc_size, 0, PHP_ROUND_HALF_UP); \
array_init_size(return_value, size); \
@@ -2732,8 +2723,9 @@ PHP_FUNCTION(array_fill_keys)
#define RANGE_CHECK_LONG_INIT_ARRAY(start, end) do { \
zend_ulong __calc_size = ((zend_ulong) start - end) / lstep; \
if (__calc_size >= HT_MAX_SIZE - 1) { \
- php_error_docref(NULL, E_WARNING, "The supplied range exceeds the maximum array size: start=" ZEND_LONG_FMT " end=" ZEND_LONG_FMT, end, start); \
- RETURN_FALSE; \
+ zend_value_error(\
+ "The supplied range exceeds the maximum array size: start=" ZEND_LONG_FMT " end=" ZEND_LONG_FMT, end, start); \
+ RETURN_THROWS(); \
} \
size = (uint32_t)(__calc_size + 1); \
array_init_size(return_value, size); \
@@ -2752,24 +2744,11 @@ PHP_FUNCTION(range)
Z_PARAM_ZVAL(zlow)
Z_PARAM_ZVAL(zhigh)
Z_PARAM_OPTIONAL
- Z_PARAM_ZVAL(zstep)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ Z_PARAM_NUMBER(zstep)
+ ZEND_PARSE_PARAMETERS_END();
if (zstep) {
- if (Z_TYPE_P(zstep) == IS_DOUBLE) {
- is_step_double = 1;
- } else if (Z_TYPE_P(zstep) == IS_STRING) {
- int type = is_numeric_string(Z_STRVAL_P(zstep), Z_STRLEN_P(zstep), NULL, NULL, 0);
- if (type == IS_DOUBLE) {
- is_step_double = 1;
- }
- if (type == 0) {
- /* bad number */
- php_error_docref(NULL, E_WARNING, "Invalid range string - must be numeric");
- RETURN_FALSE;
- }
- }
-
+ is_step_double = Z_TYPE_P(zstep) == IS_DOUBLE;
step = zval_get_double(zstep);
/* We only want positive step values. */
@@ -2842,8 +2821,8 @@ double_str:
high = zval_get_double(zhigh);
if (zend_isinf(high) || zend_isinf(low)) {
- php_error_docref(NULL, E_WARNING, "Invalid range supplied: start=%0.0f end=%0.0f", low, high);
- RETURN_FALSE;
+ zend_value_error("Invalid range supplied: start=%0.0f end=%0.0f", low, high);
+ RETURN_THROWS();
}
if (low > high) { /* Negative steps */
@@ -2935,8 +2914,8 @@ long_str:
}
err:
if (err) {
- php_error_docref(NULL, E_WARNING, "step exceeds the specified range");
- RETURN_FALSE;
+ zend_value_error("Step exceeds the specified range");
+ RETURN_THROWS();
}
}
/* }}} */
@@ -3033,7 +3012,7 @@ PHP_FUNCTION(shuffle)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_ARRAY_EX(array, 0, 1)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_array_data_shuffle(array);
@@ -3198,8 +3177,8 @@ PHP_FUNCTION(array_push)
if (zend_hash_next_index_insert(Z_ARRVAL_P(stack), &new_var) == NULL) {
Z_TRY_DELREF(new_var);
- php_error_docref(NULL, E_WARNING, "Cannot add element to the array as the next element is already occupied");
- RETURN_FALSE;
+ zend_throw_error(NULL, "Cannot add element to the array as the next element is already occupied");
+ RETURN_THROWS();
}
}
@@ -3243,7 +3222,7 @@ PHP_FUNCTION(array_pop)
}
ZVAL_COPY_DEREF(return_value, val);
- if (!p->key && Z_ARRVAL_P(stack)->nNextFreeElement > 0 && p->h >= (zend_ulong)(Z_ARRVAL_P(stack)->nNextFreeElement - 1)) {
+ if (!p->key && (zend_long)p->h == (Z_ARRVAL_P(stack)->nNextFreeElement - 1)) {
Z_ARRVAL_P(stack)->nNextFreeElement = Z_ARRVAL_P(stack)->nNextFreeElement - 1;
}
@@ -3431,19 +3410,20 @@ PHP_FUNCTION(array_splice)
HashTable *rem_hash = NULL;
zend_long offset,
length = 0;
+ zend_bool length_is_null = 1;
int num_in; /* Number of elements in the input array */
ZEND_PARSE_PARAMETERS_START(2, 4)
Z_PARAM_ARRAY_EX(array, 0, 1)
Z_PARAM_LONG(offset)
Z_PARAM_OPTIONAL
- Z_PARAM_LONG(length)
+ Z_PARAM_LONG_OR_NULL(length, length_is_null)
Z_PARAM_ZVAL(repl_array)
ZEND_PARSE_PARAMETERS_END();
num_in = zend_hash_num_elements(Z_ARRVAL_P(array));
- if (ZEND_NUM_ARGS() < 3) {
+ if (length_is_null) {
length = num_in;
}
@@ -3474,6 +3454,9 @@ PHP_FUNCTION(array_splice)
/* Initialize return value */
array_init_size(return_value, size > 0 ? (uint32_t)size : 0);
rem_hash = Z_ARRVAL_P(return_value);
+ } else {
+ /* The return value will not be used, but make sure it still has the correct type. */
+ RETVAL_EMPTY_ARRAY();
}
/* Perform splice */
@@ -3481,18 +3464,44 @@ PHP_FUNCTION(array_splice)
}
/* }}} */
+/* {{{ find_bucket_at_offset(HashTable* ht, zend_long offset)
+ Finds the bucket at the given valid offset */
+static inline Bucket* find_bucket_at_offset(HashTable* ht, zend_long offset)
+{
+ zend_long pos;
+ Bucket *bucket;
+ ZEND_ASSERT(offset >= 0 && offset <= ht->nNumOfElements);
+ if (HT_IS_WITHOUT_HOLES(ht)) {
+ /* There's no need to iterate over the array to filter out holes if there are no holes */
+ /* This properly handles both packed and unpacked arrays. */
+ return ht->arData + offset;
+ }
+ /* Otherwise, this code has to iterate over the HashTable and skip holes in the array. */
+ pos = 0;
+ ZEND_HASH_FOREACH_BUCKET(ht, bucket) {
+ if (pos >= offset) {
+ /* This is the bucket of the array element at the requested offset */
+ return bucket;
+ }
+ ++pos;
+ } ZEND_HASH_FOREACH_END();
+
+ /* Return a pointer to the end of the bucket array. */
+ return ht->arData + ht->nNumUsed;
+}
+/* }}} */
+
/* {{{ proto array array_slice(array input, int offset [, int length [, bool preserve_keys]])
Returns elements specified by offset and length */
PHP_FUNCTION(array_slice)
{
- zval *input, /* Input array */
- *z_length = NULL, /* How many elements to get */
- *entry; /* An array entry */
- zend_long offset, /* Offset to get elements from */
- length = 0;
- zend_bool preserve_keys = 0; /* Whether to preserve keys while copying to the new array or not */
- int num_in, /* Number of elements in the input array */
- pos; /* Current position in the array */
+ zval *input; /* Input array */
+ zval *entry; /* An array entry */
+ zend_long offset; /* Offset to get elements from */
+ zend_long length = 0; /* How many elements to get */
+ zend_bool length_is_null = 1; /* Whether an explicit length has been omitted */
+ zend_bool preserve_keys = 0; /* Whether to preserve keys while copying to the new array */
+ uint32_t num_in; /* Number of elements in the input array */
zend_string *string_key;
zend_ulong num_key;
@@ -3500,7 +3509,7 @@ PHP_FUNCTION(array_slice)
Z_PARAM_ARRAY(input)
Z_PARAM_LONG(offset)
Z_PARAM_OPTIONAL
- Z_PARAM_ZVAL(z_length)
+ Z_PARAM_LONG_OR_NULL(length, length_is_null)
Z_PARAM_BOOL(preserve_keys)
ZEND_PARSE_PARAMETERS_END();
@@ -3508,14 +3517,12 @@ PHP_FUNCTION(array_slice)
num_in = zend_hash_num_elements(Z_ARRVAL_P(input));
/* We want all entries from offset to the end if length is not passed or is null */
- if (ZEND_NUM_ARGS() < 3 || Z_TYPE_P(z_length) == IS_NULL) {
+ if (length_is_null) {
length = num_in;
- } else {
- length = zval_get_long(z_length);
}
/* Clamp the offset.. */
- if (offset > num_in) {
+ if (offset > (zend_long) num_in) {
RETURN_EMPTY_ARRAY();
} else if (offset < 0 && (offset = (num_in + offset)) < 0) {
offset = 0;
@@ -3535,50 +3542,61 @@ PHP_FUNCTION(array_slice)
/* Initialize returned array */
array_init_size(return_value, (uint32_t)length);
- /* Start at the beginning and go until we hit offset */
- pos = 0;
- if (HT_IS_PACKED(Z_ARRVAL_P(input)) &&
- (!preserve_keys ||
- (offset == 0 && HT_IS_WITHOUT_HOLES(Z_ARRVAL_P(input))))) {
- zend_hash_real_init_packed(Z_ARRVAL_P(return_value));
- ZEND_HASH_FILL_PACKED(Z_ARRVAL_P(return_value)) {
- ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(input), entry) {
- pos++;
- if (pos <= offset) {
+ // Contains modified variants of ZEND_HASH_FOREACH_VAL
+ {
+ HashTable *ht = Z_ARRVAL_P(input);
+ Bucket *p = find_bucket_at_offset(ht, offset);
+ Bucket *end = ht->arData + ht->nNumUsed;
+
+ /* Start at the beginning and go until we hit offset */
+ if (HT_IS_PACKED(Z_ARRVAL_P(input)) &&
+ (!preserve_keys ||
+ (offset == 0 && HT_IS_WITHOUT_HOLES(Z_ARRVAL_P(input))))) {
+
+ zend_hash_real_init_packed(Z_ARRVAL_P(return_value));
+ ZEND_HASH_FILL_PACKED(Z_ARRVAL_P(return_value)) {
+ for (; p != end; p++) {
+ if (__fill_idx >= length) {
+ break;
+ }
+ entry = &p->val;
+ if (UNEXPECTED(Z_TYPE_P(entry) == IS_UNDEF)) {
+ continue;
+ }
+ if (UNEXPECTED(Z_ISREF_P(entry)) &&
+ UNEXPECTED(Z_REFCOUNT_P(entry) == 1)) {
+ entry = Z_REFVAL_P(entry);
+ }
+ Z_TRY_ADDREF_P(entry);
+ ZEND_HASH_FILL_ADD(entry);
+ }
+ } ZEND_HASH_FILL_END();
+ } else {
+ zend_long n = 0; /* Current number of elements */
+ for (; p != end; p++) {
+ entry = &p->val;
+ if (UNEXPECTED(Z_TYPE_P(entry) == IS_UNDEF)) {
continue;
}
- if (pos > offset + length) {
+ if (n >= length) {
break;
}
- if (UNEXPECTED(Z_ISREF_P(entry)) &&
- UNEXPECTED(Z_REFCOUNT_P(entry) == 1)) {
- entry = Z_REFVAL_P(entry);
- }
- Z_TRY_ADDREF_P(entry);
- ZEND_HASH_FILL_ADD(entry);
- } ZEND_HASH_FOREACH_END();
- } ZEND_HASH_FILL_END();
- } else {
- ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(input), num_key, string_key, entry) {
- pos++;
- if (pos <= offset) {
- continue;
- }
- if (pos > offset + length) {
- break;
- }
+ n++;
+ num_key = p->h;
+ string_key = p->key;
- if (string_key) {
- entry = zend_hash_add_new(Z_ARRVAL_P(return_value), string_key, entry);
- } else {
- if (preserve_keys) {
- entry = zend_hash_index_add_new(Z_ARRVAL_P(return_value), num_key, entry);
+ if (string_key) {
+ entry = zend_hash_add_new(Z_ARRVAL_P(return_value), string_key, entry);
} else {
- entry = zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), entry);
+ if (preserve_keys) {
+ entry = zend_hash_index_add_new(Z_ARRVAL_P(return_value), num_key, entry);
+ } else {
+ entry = zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), entry);
+ }
}
+ zval_add_ref(entry);
}
- zval_add_ref(entry);
- } ZEND_HASH_FOREACH_END();
+ }
}
}
/* }}} */
@@ -3601,7 +3619,7 @@ PHPAPI int php_array_merge_recursive(HashTable *dest, HashTable *src) /* {{{ */
ZVAL_DEREF(dest_zval);
thash = Z_TYPE_P(dest_zval) == IS_ARRAY ? Z_ARRVAL_P(dest_zval) : NULL;
if ((thash && GC_IS_RECURSIVE(thash)) || (src_entry == dest_entry && Z_ISREF_P(dest_entry) && (Z_REFCOUNT_P(dest_entry) % 2))) {
- php_error_docref(NULL, E_WARNING, "recursion detected");
+ zend_throw_error(NULL, "Recursion detected");
return 0;
}
@@ -3722,7 +3740,7 @@ PHPAPI int php_array_replace_recursive(HashTable *dest, HashTable *src) /* {{{ *
if (Z_IS_RECURSIVE_P(dest_zval) ||
Z_IS_RECURSIVE_P(src_zval) ||
(Z_ISREF_P(src_entry) && Z_ISREF_P(dest_entry) && Z_REF_P(src_entry) == Z_REF_P(dest_entry) && (Z_REFCOUNT_P(dest_entry) % 2))) {
- php_error_docref(NULL, E_WARNING, "recursion detected");
+ zend_throw_error(NULL, "Recursion detected");
return 0;
}
@@ -3771,8 +3789,8 @@ static zend_always_inline void php_array_replace_wrapper(INTERNAL_FUNCTION_PARAM
zval *arg = args + i;
if (Z_TYPE_P(arg) != IS_ARRAY) {
- php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(arg));
- RETURN_NULL();
+ zend_type_error("Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(arg));
+ RETURN_THROWS();
}
}
@@ -3815,8 +3833,8 @@ static zend_always_inline void php_array_merge_wrapper(INTERNAL_FUNCTION_PARAMET
zval *arg = args + i;
if (Z_TYPE_P(arg) != IS_ARRAY) {
- php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(arg));
- RETURN_NULL();
+ zend_type_error("Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(arg));
+ RETURN_THROWS();
}
count += zend_hash_num_elements(Z_ARRVAL_P(arg));
}
@@ -3957,7 +3975,7 @@ PHP_FUNCTION(array_keys)
/* Base case: empty input */
if (!elem_count) {
- RETURN_ZVAL(input, 1, 0)
+ RETURN_COPY(input);
}
/* Initialize return array */
@@ -4016,7 +4034,7 @@ PHP_FUNCTION(array_keys)
}
/* }}} */
-/* {{{ proto mixed array_key_first(array stack)
+/* {{{ proto int|string|false array_key_first(array stack)
Get the key of the first element of the array */
PHP_FUNCTION(array_key_first)
{
@@ -4032,7 +4050,7 @@ PHP_FUNCTION(array_key_first)
}
/* }}} */
-/* {{{ proto mixed array_key_last(array stack)
+/* {{{ proto int|string|false array_key_last(array stack)
Get the key of the last element of the array */
PHP_FUNCTION(array_key_last)
{
@@ -4073,7 +4091,7 @@ PHP_FUNCTION(array_values)
/* Return vector-like packed arrays as-is */
if (HT_IS_PACKED(arrval) && HT_IS_WITHOUT_HOLES(arrval) &&
arrval->nNextFreeElement == arrlen) {
- RETURN_ZVAL(input, 1, 0);
+ RETURN_COPY(input);
}
/* Initialize return array */
@@ -4130,7 +4148,7 @@ PHP_FUNCTION(array_count_values)
Z_LVAL_P(tmp)++;
}
} else {
- php_error_docref(NULL, E_WARNING, "Can only count STRING and INTEGER values!");
+ php_error_docref(NULL, E_WARNING, "Can only count string and integer values, entry skipped");
}
} ZEND_HASH_FOREACH_END();
}
@@ -4158,7 +4176,7 @@ zend_bool array_column_param_helper(zval *param,
return 1;
default:
- php_error_docref(NULL, E_WARNING, "The %s key should be either a string or an integer", name);
+ zend_type_error("The %s key should be either a string or an integer", name);
return 0;
}
}
@@ -4172,9 +4190,12 @@ static inline zval *array_column_fetch_prop(zval *data, zval *name, zval *rv) /*
/* The has_property check is first performed in "exists" mode (which returns true for
* properties that are null but exist) and then in "has" mode to handle objects that
* implement __isset (which is not called in "exists" mode). */
- if (Z_OBJ_HANDLER_P(data, has_property)(data, name, ZEND_PROPERTY_EXISTS, NULL)
- || Z_OBJ_HANDLER_P(data, has_property)(data, name, ZEND_PROPERTY_ISSET, NULL)) {
- prop = Z_OBJ_HANDLER_P(data, read_property)(data, name, BP_VAR_R, NULL, rv);
+ zend_string *str, *tmp_str;
+
+ str = zval_get_tmp_string(name, &tmp_str);
+ if (Z_OBJ_HANDLER_P(data, has_property)(Z_OBJ_P(data), str, ZEND_PROPERTY_EXISTS, NULL)
+ || Z_OBJ_HANDLER_P(data, has_property)(Z_OBJ_P(data), str, ZEND_PROPERTY_ISSET, NULL)) {
+ prop = Z_OBJ_HANDLER_P(data, read_property)(Z_OBJ_P(data), str, BP_VAR_R, NULL, rv);
if (prop) {
ZVAL_DEREF(prop);
if (prop != rv) {
@@ -4182,6 +4203,7 @@ static inline zval *array_column_fetch_prop(zval *data, zval *name, zval *rv) /*
}
}
}
+ zend_tmp_string_release(tmp_str);
} else if (Z_TYPE_P(data) == IS_ARRAY) {
if (Z_TYPE_P(name) == IS_STRING) {
prop = zend_symtable_find(Z_ARRVAL_P(data), Z_STR_P(name));
@@ -4217,7 +4239,7 @@ PHP_FUNCTION(array_column)
if ((column && !array_column_param_helper(column, "column")) ||
(index && !array_column_param_helper(index, "index"))) {
- RETURN_FALSE;
+ return;
}
array_init_size(return_value, zend_hash_num_elements(input));
@@ -4372,8 +4394,8 @@ PHP_FUNCTION(array_pad)
input_size = zend_hash_num_elements(Z_ARRVAL_P(input));
pad_size_abs = ZEND_ABS(pad_size);
if (pad_size_abs < 0 || pad_size_abs - input_size > Z_L(1048576)) {
- php_error_docref(NULL, E_WARNING, "You may only pad up to 1048576 elements at a time");
- RETURN_FALSE;
+ zend_value_error("You may only pad up to 1048576 elements at a time");
+ RETURN_THROWS();
}
if (input_size >= pad_size_abs) {
@@ -4469,7 +4491,7 @@ PHP_FUNCTION(array_flip)
}
zend_symtable_update(Z_ARRVAL_P(return_value), Z_STR_P(entry), &data);
} else {
- php_error_docref(NULL, E_WARNING, "Can only flip STRING and INTEGER values!");
+ php_error_docref(NULL, E_WARNING, "Can only flip string and integer values, entry skipped");
}
} ZEND_HASH_FOREACH_END();
}
@@ -4664,8 +4686,6 @@ static int zval_user_compare(zval *a, zval *b) /* {{{ */
static void php_array_intersect_key(INTERNAL_FUNCTION_PARAMETERS, int data_compare_type) /* {{{ */
{
- uint32_t idx;
- Bucket *p;
int argc, i;
zval *args;
int (*intersect_data_compare_func)(zval *, zval *) = NULL;
@@ -4673,6 +4693,8 @@ static void php_array_intersect_key(INTERNAL_FUNCTION_PARAMETERS, int data_compa
zval *val, *data;
int req_args;
char *param_spec;
+ zend_string *key;
+ zend_ulong h;
/* Get the argument count */
argc = ZEND_NUM_ARGS();
@@ -4693,38 +4715,32 @@ static void php_array_intersect_key(INTERNAL_FUNCTION_PARAMETERS, int data_compa
}
if (argc < req_args) {
- php_error_docref(NULL, E_WARNING, "at least %d parameters are required, %d given", req_args, argc);
- return;
+ zend_argument_count_error("At least %d parameters are required, %d given", req_args, argc);
+ RETURN_THROWS();
}
if (zend_parse_parameters(ZEND_NUM_ARGS(), param_spec, &args, &argc, &BG(user_compare_fci), &BG(user_compare_fci_cache)) == FAILURE) {
- return;
+ RETURN_THROWS();
}
for (i = 0; i < argc; i++) {
if (Z_TYPE(args[i]) != IS_ARRAY) {
- php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i]));
- RETURN_NULL();
+ zend_type_error("Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i]));
+ RETURN_THROWS();
}
}
array_init(return_value);
- for (idx = 0; idx < Z_ARRVAL(args[0])->nNumUsed; idx++) {
- p = Z_ARRVAL(args[0])->arData + idx;
- val = &p->val;
- if (Z_TYPE_P(val) == IS_UNDEF) continue;
- if (UNEXPECTED(Z_TYPE_P(val) == IS_INDIRECT)) {
- val = Z_INDIRECT_P(val);
- if (Z_TYPE_P(val) == IS_UNDEF) continue;
- }
+ /* Iterate over keys of the first array (handling possibility of indirects such as in $GLOBALS), to compute keys that are in all of the other arrays. */
+ ZEND_HASH_FOREACH_KEY_VAL_IND(Z_ARRVAL(args[0]), h, key, val) {
if (Z_ISREF_P(val) && Z_REFCOUNT_P(val) == 1) {
val = Z_REFVAL_P(val);
}
- if (p->key == NULL) {
+ if (key == NULL) {
ok = 1;
for (i = 1; i < argc; i++) {
- if ((data = zend_hash_index_find(Z_ARRVAL(args[i]), p->h)) == NULL ||
+ if ((data = zend_hash_index_find(Z_ARRVAL(args[i]), h)) == NULL ||
(intersect_data_compare_func &&
intersect_data_compare_func(val, data) != 0)
) {
@@ -4734,12 +4750,12 @@ static void php_array_intersect_key(INTERNAL_FUNCTION_PARAMETERS, int data_compa
}
if (ok) {
Z_TRY_ADDREF_P(val);
- zend_hash_index_update(Z_ARRVAL_P(return_value), p->h, val);
+ zend_hash_index_add_new(Z_ARRVAL_P(return_value), h, val);
}
} else {
ok = 1;
for (i = 1; i < argc; i++) {
- if ((data = zend_hash_find_ex_ind(Z_ARRVAL(args[i]), p->key, 1)) == NULL ||
+ if ((data = zend_hash_find_ex_ind(Z_ARRVAL(args[i]), key, 1)) == NULL ||
(intersect_data_compare_func &&
intersect_data_compare_func(val, data) != 0)
) {
@@ -4749,10 +4765,10 @@ static void php_array_intersect_key(INTERNAL_FUNCTION_PARAMETERS, int data_compa
}
if (ok) {
Z_TRY_ADDREF_P(val);
- zend_hash_update(Z_ARRVAL_P(return_value), p->key, val);
+ zend_hash_add_new(Z_ARRVAL_P(return_value), key, val);
}
}
- }
+ } ZEND_HASH_FOREACH_END();
}
/* }}} */
@@ -4788,17 +4804,17 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int
param_spec = "+f";
intersect_data_compare_func = php_array_user_compare;
} else {
- php_error_docref(NULL, E_WARNING, "data_compare_type is %d. This should never happen. Please report as a bug", data_compare_type);
+ ZEND_ASSERT(0 && "Invalid data_compare_type");
return;
}
if (ZEND_NUM_ARGS() < req_args) {
- php_error_docref(NULL, E_WARNING, "at least %d parameters are required, %d given", req_args, ZEND_NUM_ARGS());
- return;
+ zend_argument_count_error("At least %d parameters are required, %d given", req_args, ZEND_NUM_ARGS());
+ RETURN_THROWS();
}
if (zend_parse_parameters(ZEND_NUM_ARGS(), param_spec, &args, &arr_argc, &fci1, &fci1_cache) == FAILURE) {
- return;
+ RETURN_THROWS();
}
fci_data = &fci1;
fci_data_cache = &fci1_cache;
@@ -4840,21 +4856,21 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int
fci_key = &fci2;
fci_key_cache = &fci2_cache;
} else {
- php_error_docref(NULL, E_WARNING, "data_compare_type is %d. key_compare_type is %d. This should never happen. Please report as a bug", data_compare_type, key_compare_type);
+ ZEND_ASSERT(0 && "Invalid data_compare_type / key_compare_type");
return;
}
if (ZEND_NUM_ARGS() < req_args) {
- php_error_docref(NULL, E_WARNING, "at least %d parameters are required, %d given", req_args, ZEND_NUM_ARGS());
- return;
+ zend_argument_count_error("At least %d parameters are required, %d given", req_args, ZEND_NUM_ARGS());
+ RETURN_THROWS();
}
if (zend_parse_parameters(ZEND_NUM_ARGS(), param_spec, &args, &arr_argc, &fci1, &fci1_cache, &fci2, &fci2_cache) == FAILURE) {
- return;
+ RETURN_THROWS();
}
} else {
- php_error_docref(NULL, E_WARNING, "behavior is %d. This should never happen. Please report as a bug", behavior);
+ ZEND_ASSERT(0 && "Invalid behavior");
return;
}
@@ -4874,7 +4890,7 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int
for (i = 0; i < arr_argc; i++) {
if (Z_TYPE(args[i]) != IS_ARRAY) {
- php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i]));
+ zend_type_error("Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i]));
arr_argc = i; /* only free up to i - 1 */
goto out;
}
@@ -5080,32 +5096,32 @@ PHP_FUNCTION(array_uintersect_uassoc)
static void php_array_diff_key(INTERNAL_FUNCTION_PARAMETERS, int data_compare_type) /* {{{ */
{
- uint32_t idx;
- Bucket *p;
int argc, i;
zval *args;
int (*diff_data_compare_func)(zval *, zval *) = NULL;
zend_bool ok;
zval *val, *data;
+ zend_string *key;
+ zend_ulong h;
/* Get the argument count */
argc = ZEND_NUM_ARGS();
if (data_compare_type == DIFF_COMP_DATA_USER) {
if (argc < 3) {
- php_error_docref(NULL, E_WARNING, "at least 3 parameters are required, %d given", ZEND_NUM_ARGS());
- return;
+ zend_argument_count_error("At least 3 parameters are required, %d given", ZEND_NUM_ARGS());
+ RETURN_THROWS();
}
if (zend_parse_parameters(ZEND_NUM_ARGS(), "+f", &args, &argc, &BG(user_compare_fci), &BG(user_compare_fci_cache)) == FAILURE) {
- return;
+ RETURN_THROWS();
}
diff_data_compare_func = zval_user_compare;
} else {
if (argc < 2) {
- php_error_docref(NULL, E_WARNING, "at least 2 parameters are required, %d given", ZEND_NUM_ARGS());
- return;
+ zend_argument_count_error("At least 2 parameters are required, %d given", ZEND_NUM_ARGS());
+ RETURN_THROWS();
}
if (zend_parse_parameters(ZEND_NUM_ARGS(), "+", &args, &argc) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (data_compare_type == DIFF_COMP_DATA_INTERNAL) {
diff_data_compare_func = zval_compare;
@@ -5114,28 +5130,22 @@ static void php_array_diff_key(INTERNAL_FUNCTION_PARAMETERS, int data_compare_ty
for (i = 0; i < argc; i++) {
if (Z_TYPE(args[i]) != IS_ARRAY) {
- php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i]));
- RETURN_NULL();
+ zend_type_error("Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i]));
+ RETURN_THROWS();
}
}
array_init(return_value);
- for (idx = 0; idx < Z_ARRVAL(args[0])->nNumUsed; idx++) {
- p = Z_ARRVAL(args[0])->arData + idx;
- val = &p->val;
- if (Z_TYPE_P(val) == IS_UNDEF) continue;
- if (UNEXPECTED(Z_TYPE_P(val) == IS_INDIRECT)) {
- val = Z_INDIRECT_P(val);
- if (Z_TYPE_P(val) == IS_UNDEF) continue;
- }
+ /* Iterate over keys of the first array (handling possibility of indirects such as in $GLOBALS), to compute keys that aren't in the other arrays. */
+ ZEND_HASH_FOREACH_KEY_VAL_IND(Z_ARRVAL(args[0]), h, key, val) {
if (Z_ISREF_P(val) && Z_REFCOUNT_P(val) == 1) {
val = Z_REFVAL_P(val);
}
- if (p->key == NULL) {
+ if (key == NULL) {
ok = 1;
for (i = 1; i < argc; i++) {
- if ((data = zend_hash_index_find(Z_ARRVAL(args[i]), p->h)) != NULL &&
+ if ((data = zend_hash_index_find(Z_ARRVAL(args[i]), h)) != NULL &&
(!diff_data_compare_func ||
diff_data_compare_func(val, data) == 0)
) {
@@ -5145,12 +5155,12 @@ static void php_array_diff_key(INTERNAL_FUNCTION_PARAMETERS, int data_compare_ty
}
if (ok) {
Z_TRY_ADDREF_P(val);
- zend_hash_index_update(Z_ARRVAL_P(return_value), p->h, val);
+ zend_hash_index_add_new(Z_ARRVAL_P(return_value), h, val);
}
} else {
ok = 1;
for (i = 1; i < argc; i++) {
- if ((data = zend_hash_find_ex_ind(Z_ARRVAL(args[i]), p->key, 1)) != NULL &&
+ if ((data = zend_hash_find_ex_ind(Z_ARRVAL(args[i]), key, 1)) != NULL &&
(!diff_data_compare_func ||
diff_data_compare_func(val, data) == 0)
) {
@@ -5160,10 +5170,10 @@ static void php_array_diff_key(INTERNAL_FUNCTION_PARAMETERS, int data_compare_ty
}
if (ok) {
Z_TRY_ADDREF_P(val);
- zend_hash_update(Z_ARRVAL_P(return_value), p->key, val);
+ zend_hash_add_new(Z_ARRVAL_P(return_value), key, val);
}
}
- }
+ } ZEND_HASH_FOREACH_END();
}
/* }}} */
@@ -5199,17 +5209,17 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_
param_spec = "+f";
diff_data_compare_func = php_array_user_compare;
} else {
- php_error_docref(NULL, E_WARNING, "data_compare_type is %d. This should never happen. Please report as a bug", data_compare_type);
+ ZEND_ASSERT(0 && "Invalid data_compare_type");
return;
}
if (ZEND_NUM_ARGS() < req_args) {
- php_error_docref(NULL, E_WARNING, "at least %d parameters are required, %d given", req_args, ZEND_NUM_ARGS());
- return;
+ zend_argument_count_error("At least %d parameters are required, %d given", req_args, ZEND_NUM_ARGS());
+ RETURN_THROWS();
}
if (zend_parse_parameters(ZEND_NUM_ARGS(), param_spec, &args, &arr_argc, &fci1, &fci1_cache) == FAILURE) {
- return;
+ RETURN_THROWS();
}
fci_data = &fci1;
fci_data_cache = &fci1_cache;
@@ -5251,21 +5261,21 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_
fci_key = &fci2;
fci_key_cache = &fci2_cache;
} else {
- php_error_docref(NULL, E_WARNING, "data_compare_type is %d. key_compare_type is %d. This should never happen. Please report as a bug", data_compare_type, key_compare_type);
+ ZEND_ASSERT(0 && "Invalid data_compare_type / key_compare_type");
return;
}
if (ZEND_NUM_ARGS() < req_args) {
- php_error_docref(NULL, E_WARNING, "at least %d parameters are required, %d given", req_args, ZEND_NUM_ARGS());
- return;
+ zend_argument_count_error("At least %d parameters are required, %d given", req_args, ZEND_NUM_ARGS());
+ RETURN_THROWS();
}
if (zend_parse_parameters(ZEND_NUM_ARGS(), param_spec, &args, &arr_argc, &fci1, &fci1_cache, &fci2, &fci2_cache) == FAILURE) {
- return;
+ RETURN_THROWS();
}
} else {
- php_error_docref(NULL, E_WARNING, "behavior is %d. This should never happen. Please report as a bug", behavior);
+ ZEND_ASSERT(0 && "Invalid behavior");
return;
}
@@ -5285,7 +5295,7 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_
for (i = 0; i < arr_argc; i++) {
if (Z_TYPE(args[i]) != IS_ARRAY) {
- php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i]));
+ zend_type_error("Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i]));
arr_argc = i; /* only free up to i - 1 */
goto out;
}
@@ -5453,8 +5463,8 @@ PHP_FUNCTION(array_diff)
zval dummy;
if (ZEND_NUM_ARGS() < 2) {
- php_error_docref(NULL, E_WARNING, "at least 2 parameters are required, %d given", ZEND_NUM_ARGS());
- return;
+ zend_argument_count_error("At least 2 parameters are required, %d given", ZEND_NUM_ARGS());
+ RETURN_THROWS();
}
ZEND_PARSE_PARAMETERS_START(1, -1)
@@ -5462,16 +5472,16 @@ PHP_FUNCTION(array_diff)
ZEND_PARSE_PARAMETERS_END();
if (Z_TYPE(args[0]) != IS_ARRAY) {
- php_error_docref(NULL, E_WARNING, "Expected parameter 1 to be an array, %s given", zend_zval_type_name(&args[0]));
- RETURN_NULL();
+ zend_type_error("Expected parameter 1 to be an array, %s given", zend_zval_type_name(&args[0]));
+ RETURN_THROWS();
}
num = zend_hash_num_elements(Z_ARRVAL(args[0]));
if (num == 0) {
for (i = 1; i < argc; i++) {
if (Z_TYPE(args[i]) != IS_ARRAY) {
- php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i]));
- RETURN_NULL();
+ zend_type_error("Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i]));
+ RETURN_THROWS();
}
}
RETURN_EMPTY_ARRAY();
@@ -5487,8 +5497,8 @@ PHP_FUNCTION(array_diff)
if (!value) {
for (i = 1; i < argc; i++) {
if (Z_TYPE(args[i]) != IS_ARRAY) {
- php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i]));
- RETURN_NULL();
+ zend_type_error("Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i]));
+ RETURN_THROWS();
}
}
RETURN_EMPTY_ARRAY();
@@ -5498,8 +5508,8 @@ PHP_FUNCTION(array_diff)
for (i = 1; i < argc; i++) {
if (Z_TYPE(args[i]) != IS_ARRAY) {
- php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i]));
- RETURN_NULL();
+ zend_type_error("Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i]));
+ RETURN_THROWS();
}
if (!found) {
ZEND_HASH_FOREACH_VAL_IND(Z_ARRVAL(args[i]), value) {
@@ -5528,8 +5538,8 @@ PHP_FUNCTION(array_diff)
num = 0;
for (i = 1; i < argc; i++) {
if (Z_TYPE(args[i]) != IS_ARRAY) {
- php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i]));
- RETURN_NULL();
+ zend_type_error("Expected parameter %d to be an array, %s given", i + 1, zend_zval_type_name(&args[i]));
+ RETURN_THROWS();
}
num += zend_hash_num_elements(Z_ARRVAL(args[i]));
}
@@ -5636,7 +5646,7 @@ PHPAPI int php_multisort_compare(const void *a, const void *b) /* {{{ */
#define MULTISORT_ABORT \
efree(func); \
efree(arrays); \
- RETURN_FALSE;
+ return;
static void array_bucket_p_sawp(void *p, void *q) /* {{{ */ {
Bucket *t;
@@ -5713,7 +5723,7 @@ PHP_FUNCTION(array_multisort)
sort_order = Z_LVAL_P(arg) == PHP_SORT_DESC ? PHP_SORT_DESC : PHP_SORT_ASC;
parse_state[MULTISORT_ORDER] = 0;
} else {
- php_error_docref(NULL, E_WARNING, "Argument #%d is expected to be an array or sorting flag that has not already been specified", i + 1);
+ zend_type_error("Argument #%d is expected to be an array or sorting flag that has not already been specified", i + 1);
MULTISORT_ABORT;
}
break;
@@ -5729,19 +5739,19 @@ PHP_FUNCTION(array_multisort)
sort_type = (int)Z_LVAL_P(arg);
parse_state[MULTISORT_TYPE] = 0;
} else {
- php_error_docref(NULL, E_WARNING, "Argument #%d is expected to be an array or sorting flag that has not already been specified", i + 1);
+ zend_type_error("Argument #%d is expected to be an array or sorting flag that has not already been specified", i + 1);
MULTISORT_ABORT;
}
break;
default:
- php_error_docref(NULL, E_WARNING, "Argument #%d is an unknown sort flag", i + 1);
+ zend_type_error("Argument #%d is an unknown sort flag", i + 1);
MULTISORT_ABORT;
break;
}
} else {
- php_error_docref(NULL, E_WARNING, "Argument #%d is expected to be an array or a sort flag", i + 1);
+ zend_type_error("Argument #%d is expected to be an array or a sort flag", i + 1);
MULTISORT_ABORT;
}
}
@@ -5752,7 +5762,7 @@ PHP_FUNCTION(array_multisort)
array_size = zend_hash_num_elements(Z_ARRVAL_P(arrays[0]));
for (i = 0; i < num_arrays; i++) {
if (zend_hash_num_elements(Z_ARRVAL_P(arrays[i])) != (uint32_t)array_size) {
- php_error_docref(NULL, E_WARNING, "Array sizes are inconsistent");
+ zend_value_error("Array sizes are inconsistent");
MULTISORT_ABORT;
}
}
@@ -5824,7 +5834,7 @@ PHP_FUNCTION(array_multisort)
}
/* }}} */
-/* {{{ proto mixed array_rand(array input [, int num_req])
+/* {{{ proto int|string|array array_rand(array input [, int num_req])
Return key/keys for random entry/entries in the array */
PHP_FUNCTION(array_rand)
{
@@ -5848,8 +5858,8 @@ PHP_FUNCTION(array_rand)
num_avail = zend_hash_num_elements(Z_ARRVAL_P(input));
if (num_avail == 0) {
- php_error_docref(NULL, E_WARNING, "Array is empty");
- return;
+ zend_value_error("Array is empty");
+ RETURN_THROWS();
}
if (num_req == 1) {
@@ -5889,8 +5899,8 @@ PHP_FUNCTION(array_rand)
}
if (num_req <= 0 || num_req > num_avail) {
- php_error_docref(NULL, E_WARNING, "Second argument has to be between 1 and the number of elements in the array");
- return;
+ zend_value_error("Second argument has to be between 1 and the number of elements in the array");
+ RETURN_THROWS();
}
/* Make the return value an array only if we need to pass back more than one result. */
@@ -5935,7 +5945,7 @@ PHP_FUNCTION(array_rand)
}
/* }}} */
-/* {{{ proto mixed array_sum(array input)
+/* {{{ proto int|float array_sum(array input)
Returns the sum of the array entries */
PHP_FUNCTION(array_sum)
{
@@ -5960,7 +5970,7 @@ PHP_FUNCTION(array_sum)
}
/* }}} */
-/* {{{ proto mixed array_product(array input)
+/* {{{ proto int|float array_product(array input)
Returns the product of the array entries */
PHP_FUNCTION(array_product)
{
@@ -6006,7 +6016,6 @@ PHP_FUNCTION(array_reduce)
zval *input;
zval args[2];
zval *operand;
- zval result;
zval retval;
zend_fcall_info fci;
zend_fcall_info_cache fci_cache = empty_fcall_info_cache;
@@ -6022,9 +6031,9 @@ PHP_FUNCTION(array_reduce)
if (ZEND_NUM_ARGS() > 2) {
- ZVAL_COPY(&result, initial);
+ ZVAL_COPY(return_value, initial);
} else {
- ZVAL_NULL(&result);
+ ZVAL_NULL(return_value);
}
/* (zval **)input points to an element of argument stack
@@ -6033,7 +6042,6 @@ PHP_FUNCTION(array_reduce)
htbl = Z_ARRVAL_P(input);
if (zend_hash_num_elements(htbl) == 0) {
- ZVAL_COPY_VALUE(return_value, &result);
zend_release_fcall_info_cache(&fci_cache);
return;
}
@@ -6043,27 +6051,26 @@ PHP_FUNCTION(array_reduce)
fci.no_separation = 0;
ZEND_HASH_FOREACH_VAL(htbl, operand) {
- ZVAL_COPY_VALUE(&args[0], &result);
+ ZVAL_COPY_VALUE(&args[0], return_value);
ZVAL_COPY(&args[1], operand);
fci.params = args;
if (zend_call_function(&fci, &fci_cache) == SUCCESS && Z_TYPE(retval) != IS_UNDEF) {
zval_ptr_dtor(&args[1]);
zval_ptr_dtor(&args[0]);
- ZVAL_COPY_VALUE(&result, &retval);
+ ZVAL_COPY_VALUE(return_value, &retval);
} else {
zval_ptr_dtor(&args[1]);
zval_ptr_dtor(&args[0]);
- return;
+ RETURN_NULL();
}
} ZEND_HASH_FOREACH_END();
zend_release_fcall_info_cache(&fci_cache);
- RETVAL_ZVAL(&result, 1, 1);
}
/* }}} */
-/* {{{ proto array array_filter(array input [, mixed callback])
+/* {{{ proto array array_filter(array input [, mixed callback [, int use_type]])
Filters elements from the array via the callback. */
PHP_FUNCTION(array_filter)
{
@@ -6086,11 +6093,12 @@ PHP_FUNCTION(array_filter)
Z_PARAM_LONG(use_type)
ZEND_PARSE_PARAMETERS_END();
- array_init(return_value);
if (zend_hash_num_elements(Z_ARRVAL_P(array)) == 0) {
+ RETVAL_EMPTY_ARRAY();
zend_release_fcall_info_cache(&fci_cache);
return;
}
+ array_init(return_value);
if (ZEND_NUM_ARGS() > 1) {
have_callback = 1;
@@ -6144,9 +6152,9 @@ PHP_FUNCTION(array_filter)
}
if (string_key) {
- operand = zend_hash_update(Z_ARRVAL_P(return_value), string_key, operand);
+ operand = zend_hash_add_new(Z_ARRVAL_P(return_value), string_key, operand);
} else {
- operand = zend_hash_index_update(Z_ARRVAL_P(return_value), num_key, operand);
+ operand = zend_hash_index_add_new(Z_ARRVAL_P(return_value), num_key, operand);
}
zval_add_ref(operand);
} ZEND_HASH_FOREACH_END();
@@ -6172,8 +6180,6 @@ PHP_FUNCTION(array_map)
Z_PARAM_VARIADIC('+', arrays, n_arrays)
ZEND_PARSE_PARAMETERS_END();
- RETVAL_NULL();
-
if (n_arrays == 1) {
zend_ulong num_key;
zend_string *str_key;
@@ -6181,8 +6187,8 @@ PHP_FUNCTION(array_map)
int ret;
if (Z_TYPE(arrays[0]) != IS_ARRAY) {
- php_error_docref(NULL, E_WARNING, "Expected parameter 2 to be an array, %s given", zend_zval_type_name(&arrays[0]));
- return;
+ zend_type_error("Expected parameter 2 to be an array, %s given", zend_zval_type_name(&arrays[0]));
+ RETURN_THROWS();
}
maxlen = zend_hash_num_elements(Z_ARRVAL(arrays[0]));
@@ -6222,9 +6228,9 @@ PHP_FUNCTION(array_map)
for (i = 0; i < n_arrays; i++) {
if (Z_TYPE(arrays[i]) != IS_ARRAY) {
- php_error_docref(NULL, E_WARNING, "Expected parameter %d to be an array, %s given", i + 2, zend_zval_type_name(&arrays[i]));
+ zend_type_error("Expected parameter %d to be an array, %s given", i + 2, zend_zval_type_name(&arrays[i]));
efree(array_pos);
- return;
+ RETURN_THROWS();
}
if (zend_hash_num_elements(Z_ARRVAL(arrays[i])) > maxlen) {
maxlen = zend_hash_num_elements(Z_ARRVAL(arrays[i]));
@@ -6321,23 +6327,13 @@ PHP_FUNCTION(array_map)
PHP_FUNCTION(array_key_exists)
{
zval *key;
- zval *array;
HashTable *ht;
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_ZVAL(key)
- Z_PARAM_ARRAY_OR_OBJECT(array)
+ Z_PARAM_ARRAY_HT(ht)
ZEND_PARSE_PARAMETERS_END();
- if (EXPECTED(Z_TYPE_P(array) == IS_ARRAY)) {
- ht = Z_ARRVAL_P(array);
- } else {
- ht = zend_get_properties_for(array, ZEND_PROP_PURPOSE_ARRAY_CAST);
- php_error_docref(NULL, E_DEPRECATED,
- "Using array_key_exists() on objects is deprecated. "
- "Use isset() or property_exists() instead");
- }
-
switch (Z_TYPE_P(key)) {
case IS_STRING:
RETVAL_BOOL(zend_symtable_exists_ind(ht, Z_STR_P(key)));
@@ -6348,13 +6344,22 @@ PHP_FUNCTION(array_key_exists)
case IS_NULL:
RETVAL_BOOL(zend_hash_exists_ind(ht, ZSTR_EMPTY_ALLOC()));
break;
+ case IS_DOUBLE:
+ RETVAL_BOOL(zend_hash_index_exists(ht, zend_dval_to_lval(Z_DVAL_P(key))));
+ break;
+ case IS_FALSE:
+ RETVAL_BOOL(zend_hash_index_exists(ht, 0));
+ break;
+ case IS_TRUE:
+ RETVAL_BOOL(zend_hash_index_exists(ht, 1));
+ break;
+ case IS_RESOURCE:
+ zend_error(E_WARNING, "Resource ID#%d used as offset, casting to integer (%d)", Z_RES_HANDLE_P(key), Z_RES_HANDLE_P(key));
+ RETVAL_BOOL(zend_hash_index_exists(ht, Z_RES_HANDLE_P(key)));
+ break;
default:
- php_error_docref(NULL, E_WARNING, "The first argument should be either a string or an integer");
- RETVAL_FALSE;
- }
-
- if (Z_TYPE_P(array) != IS_ARRAY) {
- zend_release_properties(ht);
+ zend_type_error("Illegal offset type");
+ break;
}
}
/* }}} */
@@ -6381,14 +6386,18 @@ PHP_FUNCTION(array_chunk)
/* Do bounds checking for size parameter. */
if (size < 1) {
- php_error_docref(NULL, E_WARNING, "Size parameter expected to be greater than 0");
- return;
+ zend_value_error("Size parameter expected to be greater than 0");
+ RETURN_THROWS();
}
num_in = zend_hash_num_elements(Z_ARRVAL_P(input));
if (size > num_in) {
- size = num_in > 0 ? num_in : 1;
+ if (num_in == 0) {
+ RETVAL_EMPTY_ARRAY();
+ return;
+ }
+ size = num_in;
}
array_init_size(return_value, (uint32_t)(((num_in - 1) / size) + 1));
@@ -6404,9 +6413,9 @@ PHP_FUNCTION(array_chunk)
/* Add entry to the chunk, preserving keys if necessary. */
if (preserve_keys) {
if (str_key) {
- entry = zend_hash_update(Z_ARRVAL(chunk), str_key, entry);
+ entry = zend_hash_add_new(Z_ARRVAL(chunk), str_key, entry);
} else {
- entry = zend_hash_index_update(Z_ARRVAL(chunk), num_key, entry);
+ entry = zend_hash_index_add_new(Z_ARRVAL(chunk), num_key, entry);
}
} else {
entry = zend_hash_next_index_insert(Z_ARRVAL(chunk), entry);
@@ -6446,8 +6455,8 @@ PHP_FUNCTION(array_combine)
num_values = zend_hash_num_elements(values);
if (num_keys != num_values) {
- php_error_docref(NULL, E_WARNING, "Both parameters should have an equal number of elements");
- RETURN_FALSE;
+ zend_value_error("Both parameters should have an equal number of elements");
+ RETURN_THROWS();
}
if (!num_keys) {
diff --git a/ext/standard/assert.c b/ext/standard/assert.c
index 9f315d0581..1995ec1da8 100644
--- a/ext/standard/assert.c
+++ b/ext/standard/assert.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -29,7 +27,6 @@ ZEND_BEGIN_MODULE_GLOBALS(assert)
zend_bool active;
zend_bool bail;
zend_bool warning;
- zend_bool quiet_eval;
zend_bool exception;
ZEND_END_MODULE_GLOBALS(assert)
@@ -46,7 +43,6 @@ enum {
ASSERT_CALLBACK,
ASSERT_BAIL,
ASSERT_WARNING,
- ASSERT_QUIET_EVAL,
ASSERT_EXCEPTION
};
@@ -81,7 +77,6 @@ PHP_INI_BEGIN()
STD_PHP_INI_ENTRY("assert.bail", "0", PHP_INI_ALL, OnUpdateBool, bail, zend_assert_globals, assert_globals)
STD_PHP_INI_ENTRY("assert.warning", "1", PHP_INI_ALL, OnUpdateBool, warning, zend_assert_globals, assert_globals)
PHP_INI_ENTRY("assert.callback", NULL, PHP_INI_ALL, OnChangeCallback)
- STD_PHP_INI_ENTRY("assert.quiet_eval", "0", PHP_INI_ALL, OnUpdateBool, quiet_eval, zend_assert_globals, assert_globals)
STD_PHP_INI_ENTRY("assert.exception", "0", PHP_INI_ALL, OnUpdateBool, exception, zend_assert_globals, assert_globals)
PHP_INI_END()
@@ -104,7 +99,6 @@ PHP_MINIT_FUNCTION(assert) /* {{{ */
REGISTER_LONG_CONSTANT("ASSERT_CALLBACK", ASSERT_CALLBACK, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("ASSERT_BAIL", ASSERT_BAIL, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("ASSERT_WARNING", ASSERT_WARNING, CONST_CS|CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("ASSERT_QUIET_EVAL", ASSERT_QUIET_EVAL, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("ASSERT_EXCEPTION", ASSERT_EXCEPTION, CONST_CS|CONST_PERSISTENT);
INIT_CLASS_ENTRY(ce, "AssertionError", NULL);
@@ -147,9 +141,6 @@ PHP_FUNCTION(assert)
{
zval *assertion;
zval *description = NULL;
- int val;
- char *myeval = NULL;
- char *compiled_string_description;
if (! ASSERTG(active)) {
RETURN_TRUE;
@@ -161,51 +152,7 @@ PHP_FUNCTION(assert)
Z_PARAM_ZVAL(description)
ZEND_PARSE_PARAMETERS_END();
- if (Z_TYPE_P(assertion) == IS_STRING) {
- zval retval;
- int old_error_reporting = 0; /* shut up gcc! */
-
- if (zend_forbid_dynamic_call("assert() with string argument") == FAILURE) {
- RETURN_FALSE;
- }
-
- php_error_docref(NULL, E_DEPRECATED, "Calling assert() with a string argument is deprecated");
-
- myeval = Z_STRVAL_P(assertion);
-
- if (ASSERTG(quiet_eval)) {
- old_error_reporting = EG(error_reporting);
- EG(error_reporting) = 0;
- }
-
- compiled_string_description = zend_make_compiled_string_description("assert code");
- if (zend_eval_stringl(myeval, Z_STRLEN_P(assertion), &retval, compiled_string_description) == FAILURE) {
- efree(compiled_string_description);
- if (!description) {
- zend_throw_error(NULL, "Failure evaluating code: %s%s", PHP_EOL, myeval);
- } else {
- zend_string *str = zval_get_string(description);
- zend_throw_error(NULL, "Failure evaluating code: %s%s:\"%s\"", PHP_EOL, ZSTR_VAL(str), myeval);
- zend_string_release_ex(str, 0);
- }
- if (ASSERTG(bail)) {
- zend_bailout();
- }
- RETURN_FALSE;
- }
- efree(compiled_string_description);
-
- if (ASSERTG(quiet_eval)) {
- EG(error_reporting) = old_error_reporting;
- }
-
- convert_to_boolean(&retval);
- val = Z_TYPE(retval) == IS_TRUE;
- } else {
- val = zend_is_true(assertion);
- }
-
- if (val) {
+ if (zend_is_true(assertion)) {
RETURN_TRUE;
}
@@ -220,8 +167,8 @@ PHP_FUNCTION(assert)
const char *filename = zend_get_executed_filename();
ZVAL_STRING(&args[0], SAFE_STRING(filename));
- ZVAL_LONG (&args[1], lineno);
- ZVAL_STRING(&args[2], SAFE_STRING(myeval));
+ ZVAL_LONG(&args[1], lineno);
+ ZVAL_NULL(&args[2]);
ZVAL_FALSE(&retval);
@@ -255,18 +202,10 @@ PHP_FUNCTION(assert)
}
} else if (ASSERTG(warning)) {
if (!description) {
- if (myeval) {
- php_error_docref(NULL, E_WARNING, "Assertion \"%s\" failed", myeval);
- } else {
- php_error_docref(NULL, E_WARNING, "Assertion failed");
- }
+ php_error_docref(NULL, E_WARNING, "Assertion failed");
} else {
zend_string *str = zval_get_string(description);
- if (myeval) {
- php_error_docref(NULL, E_WARNING, "%s: \"%s\" failed", ZSTR_VAL(str), myeval);
- } else {
- php_error_docref(NULL, E_WARNING, "%s failed", ZSTR_VAL(str));
- }
+ php_error_docref(NULL, E_WARNING, "%s failed", ZSTR_VAL(str));
zend_string_release_ex(str, 0);
}
}
@@ -328,22 +267,6 @@ PHP_FUNCTION(assert_options)
RETURN_LONG(oldint);
break;
- case ASSERT_QUIET_EVAL:
- oldint = ASSERTG(quiet_eval);
- if (ac == 2) {
- zend_string *value_str = zval_try_get_string(value);
- if (UNEXPECTED(!value_str)) {
- return;
- }
-
- key = zend_string_init("assert.quiet_eval", sizeof("assert.quiet_eval")-1, 0);
- zend_alter_ini_entry_ex(key, value_str, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0);
- zend_string_release_ex(key, 0);
- zend_string_release_ex(value_str, 0);
- }
- RETURN_LONG(oldint);
- break;
-
case ASSERT_WARNING:
oldint = ASSERTG(warning);
if (ac == 2) {
@@ -391,10 +314,10 @@ PHP_FUNCTION(assert_options)
break;
default:
- php_error_docref(NULL, E_WARNING, "Unknown value " ZEND_LONG_FMT, what);
+ zend_value_error("Unknown value " ZEND_LONG_FMT, what);
break;
}
- RETURN_FALSE;
+ return;
}
/* }}} */
diff --git a/ext/standard/base64.c b/ext/standard/base64.c
index 0dd4045887..2229af960e 100644
--- a/ext/standard/base64.c
+++ b/ext/standard/base64.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -941,7 +939,7 @@ PHP_FUNCTION(base64_encode)
}
/* }}} */
-/* {{{ proto string base64_decode(string str[, bool strict])
+/* {{{ proto string|false base64_decode(string str[, bool strict])
Decodes string using MIME base64 algorithm */
PHP_FUNCTION(base64_decode)
{
diff --git a/ext/standard/base64.h b/ext/standard/base64.h
index faf245c5d9..17bc45cd8b 100644
--- a/ext/standard/base64.h
+++ b/ext/standard/base64.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index a772cfc275..f6d513f53d 100644..100755
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -30,10 +28,12 @@
#include "php_getopt.h"
#include "ext/standard/info.h"
#include "ext/session/php_session.h"
+#include "zend_exceptions.h"
#include "zend_operators.h"
#include "ext/standard/php_dns.h"
#include "ext/standard/php_uuencode.h"
#include "ext/standard/php_mt_rand.h"
+#include "basic_functions_arginfo.h"
#ifdef PHP_WIN32
#include "win32/php_win32_globals.h"
@@ -121,2611 +121,6 @@ static void user_shutdown_function_dtor(zval *zv);
static void user_tick_function_dtor(user_tick_function_entry *tick_function_entry);
/* {{{ arginfo */
-/* {{{ main/main.c */
-ZEND_BEGIN_ARG_INFO(arginfo_set_time_limit, 0)
- ZEND_ARG_INFO(0, seconds)
-ZEND_END_ARG_INFO()
-/* }}} */
-
-/* {{{ main/sapi.c */
-ZEND_BEGIN_ARG_INFO(arginfo_header_register_callback, 0)
- ZEND_ARG_INFO(0, callback)
-ZEND_END_ARG_INFO()
-/* }}} */
-
-/* {{{ main/output.c */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ob_start, 0, 0, 0)
- ZEND_ARG_INFO(0, user_function)
- ZEND_ARG_INFO(0, chunk_size)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ob_flush, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ob_clean, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ob_end_flush, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ob_end_clean, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ob_get_flush, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ob_get_clean, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ob_get_contents, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ob_get_level, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ob_get_length, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ob_list_handlers, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ob_get_status, 0, 0, 0)
- ZEND_ARG_INFO(0, full_status)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ob_implicit_flush, 0, 0, 0)
- ZEND_ARG_INFO(0, flag)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_output_reset_rewrite_vars, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_output_add_rewrite_var, 0)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ main/streams/userspace.c */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_wrapper_register, 0, 0, 2)
- ZEND_ARG_INFO(0, protocol)
- ZEND_ARG_INFO(0, classname)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_stream_wrapper_unregister, 0)
- ZEND_ARG_INFO(0, protocol)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_stream_wrapper_restore, 0)
- ZEND_ARG_INFO(0, protocol)
-ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ array.c */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_krsort, 0, 0, 1)
- ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */
- ZEND_ARG_INFO(0, sort_flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ksort, 0, 0, 1)
- ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */
- ZEND_ARG_INFO(0, sort_flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_count, 0, 0, 1)
- ZEND_ARG_INFO(0, var)
- ZEND_ARG_INFO(0, mode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_natsort, 0)
- ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_natcasesort, 0)
- ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_asort, 0, 0, 1)
- ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */
- ZEND_ARG_INFO(0, sort_flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_arsort, 0, 0, 1)
- ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */
- ZEND_ARG_INFO(0, sort_flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sort, 0, 0, 1)
- ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */
- ZEND_ARG_INFO(0, sort_flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_rsort, 0, 0, 1)
- ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */
- ZEND_ARG_INFO(0, sort_flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_usort, 0)
- ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */
- ZEND_ARG_INFO(0, cmp_function)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_uasort, 0)
- ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */
- ZEND_ARG_INFO(0, cmp_function)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_uksort, 0)
- ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */
- ZEND_ARG_INFO(0, cmp_function)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_end, 0)
- ZEND_ARG_INFO(1, arg)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_prev, 0)
- ZEND_ARG_INFO(1, arg)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_next, 0)
- ZEND_ARG_INFO(1, arg)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_reset, 0)
- ZEND_ARG_INFO(1, arg)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_current, 0)
- ZEND_ARG_INFO(0, arg)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_key, 0)
- ZEND_ARG_INFO(0, arg)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_min, 0, 0, 1)
- ZEND_ARG_VARIADIC_INFO(0, args)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_max, 0, 0, 1)
- ZEND_ARG_VARIADIC_INFO(0, args)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_walk, 0, 0, 2)
- ZEND_ARG_INFO(1, input) /* ARRAY_INFO(1, arg, 0) */
- ZEND_ARG_INFO(0, funcname)
- ZEND_ARG_INFO(0, userdata)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_walk_recursive, 0, 0, 2)
- ZEND_ARG_INFO(1, input) /* ARRAY_INFO(1, arg, 0) */
- ZEND_ARG_INFO(0, funcname)
- ZEND_ARG_INFO(0, userdata)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_in_array, 0, 0, 2)
- ZEND_ARG_INFO(0, needle)
- ZEND_ARG_INFO(0, haystack) /* ARRAY_INFO(0, haystack, 0) */
- ZEND_ARG_INFO(0, strict)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_search, 0, 0, 2)
- ZEND_ARG_INFO(0, needle)
- ZEND_ARG_INFO(0, haystack) /* ARRAY_INFO(0, haystack, 0) */
- ZEND_ARG_INFO(0, strict)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_extract, 0, 0, 1)
- ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, arg) /* ARRAY_INFO(0, arg, 0) */
- ZEND_ARG_INFO(0, extract_type)
- ZEND_ARG_INFO(0, prefix)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_compact, 0, 0, 1)
- ZEND_ARG_VARIADIC_INFO(0, var_names)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_fill, 0)
- ZEND_ARG_INFO(0, start_key)
- ZEND_ARG_INFO(0, num)
- ZEND_ARG_INFO(0, val)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_fill_keys, 0)
- ZEND_ARG_INFO(0, keys) /* ARRAY_INFO(0, keys, 0) */
- ZEND_ARG_INFO(0, val)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_range, 0, 0, 2)
- ZEND_ARG_INFO(0, low)
- ZEND_ARG_INFO(0, high)
- ZEND_ARG_INFO(0, step)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_shuffle, 0)
- ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_push, 0, 0, 1)
- ZEND_ARG_INFO(1, stack) /* ARRAY_INFO(1, stack, 0) */
- ZEND_ARG_VARIADIC_INFO(0, vars)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_pop, 0)
- ZEND_ARG_INFO(1, stack) /* ARRAY_INFO(1, stack, 0) */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_shift, 0)
- ZEND_ARG_INFO(1, stack) /* ARRAY_INFO(1, stack, 0) */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_unshift, 0, 0, 1)
- ZEND_ARG_INFO(1, stack) /* ARRAY_INFO(1, stack, 0) */
- ZEND_ARG_VARIADIC_INFO(0, vars)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_splice, 0, 0, 2)
- ZEND_ARG_INFO(1, arg) /* ARRAY_INFO(1, arg, 0) */
- ZEND_ARG_INFO(0, offset)
- ZEND_ARG_INFO(0, length)
- ZEND_ARG_INFO(0, replacement) /* ARRAY_INFO(0, arg, 1) */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_slice, 0, 0, 2)
- ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(1, arg, 0) */
- ZEND_ARG_INFO(0, offset)
- ZEND_ARG_INFO(0, length)
- ZEND_ARG_INFO(0, preserve_keys)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_merge, 0, 0, 0)
- ZEND_ARG_VARIADIC_INFO(0, arrays)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_merge_recursive, 0, 0, 0)
- ZEND_ARG_VARIADIC_INFO(0, arrays)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_replace, 0, 0, 1)
- ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg, 0) */
- ZEND_ARG_VARIADIC_INFO(0, arrays)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_replace_recursive, 0, 0, 1)
- ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg, 0) */
- ZEND_ARG_VARIADIC_INFO(0, arrays)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_keys, 0, 0, 1)
- ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
- ZEND_ARG_INFO(0, search_value)
- ZEND_ARG_INFO(0, strict)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_key_first, 0)
- ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_key_last, 0)
- ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
-ZEND_END_ARG_INFO()
-
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_values, 0)
- ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_count_values, 0)
- ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_column, 0, 0, 2)
- ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
- ZEND_ARG_INFO(0, column_key)
- ZEND_ARG_INFO(0, index_key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_reverse, 0, 0, 1)
- ZEND_ARG_INFO(0, input) /* ARRAY_INFO(0, arg, 0) */
- ZEND_ARG_INFO(0, preserve_keys)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_pad, 0)
- ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
- ZEND_ARG_INFO(0, pad_size)
- ZEND_ARG_INFO(0, pad_value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_flip, 0)
- ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_change_key_case, 0, 0, 1)
- ZEND_ARG_INFO(0, input) /* ARRAY_INFO(0, arg, 0) */
- ZEND_ARG_INFO(0, case)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_unique, 0, 0, 1)
- ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_intersect_key, 0, 0, 2)
- ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
- ZEND_ARG_VARIADIC_INFO(0, arrays)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_intersect_ukey, 0)
- ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
- ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */
- ZEND_ARG_INFO(0, callback_key_compare_func)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_intersect, 0, 0, 2)
- ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
- ZEND_ARG_VARIADIC_INFO(0, arrays)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_uintersect, 0)
- ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
- ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */
- ZEND_ARG_INFO(0, callback_data_compare_func)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_intersect_assoc, 0, 0, 2)
- ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
- ZEND_ARG_VARIADIC_INFO(0, arrays)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_uintersect_assoc, 0)
- ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
- ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */
- ZEND_ARG_INFO(0, callback_data_compare_func)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_intersect_uassoc, 0)
- ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
- ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */
- ZEND_ARG_INFO(0, callback_key_compare_func)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_uintersect_uassoc, 0)
- ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
- ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */
- ZEND_ARG_INFO(0, callback_data_compare_func)
- ZEND_ARG_INFO(0, callback_key_compare_func)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_diff_key, 0, 0, 2)
- ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
- ZEND_ARG_VARIADIC_INFO(0, arrays)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_diff_ukey, 0)
- ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
- ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */
- ZEND_ARG_INFO(0, callback_key_comp_func)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_diff, 0, 0, 2)
- ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
- ZEND_ARG_VARIADIC_INFO(0, arrays)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_udiff, 0)
- ZEND_ARG_INFO(0, arr1)
- ZEND_ARG_INFO(0, arr2)
- ZEND_ARG_INFO(0, callback_data_comp_func)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_diff_assoc, 0, 0, 2)
- ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
- ZEND_ARG_VARIADIC_INFO(0, arrays)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_diff_uassoc, 0)
- ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
- ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */
- ZEND_ARG_INFO(0, callback_data_comp_func)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_udiff_assoc, 0)
- ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
- ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */
- ZEND_ARG_INFO(0, callback_key_comp_func)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_udiff_uassoc, 0)
- ZEND_ARG_INFO(0, arr1) /* ARRAY_INFO(0, arg1, 0) */
- ZEND_ARG_INFO(0, arr2) /* ARRAY_INFO(0, arg2, 0) */
- ZEND_ARG_INFO(0, callback_data_comp_func)
- ZEND_ARG_INFO(0, callback_key_comp_func)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_multisort, 0, 0, 1)
- ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, arr1) /* ARRAY_INFO(0, arg1, 0) */
- ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, sort_order)
- ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, sort_flags)
- ZEND_ARG_VARIADIC_INFO(ZEND_SEND_PREFER_REF, arr2)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_rand, 0, 0, 1)
- ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
- ZEND_ARG_INFO(0, num_req)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_sum, 0)
- ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_product, 0)
- ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_reduce, 0, 0, 2)
- ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
- ZEND_ARG_INFO(0, callback)
- ZEND_ARG_INFO(0, initial)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_filter, 0, 0, 1)
- ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
- ZEND_ARG_INFO(0, callback)
- ZEND_ARG_INFO(0, use_keys)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_map, 0, 0, 2)
- ZEND_ARG_INFO(0, callback)
- ZEND_ARG_VARIADIC_INFO(0, arrays)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_key_exists, 0)
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, search)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_array_chunk, 0, 0, 2)
- ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
- ZEND_ARG_INFO(0, size)
- ZEND_ARG_INFO(0, preserve_keys)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_array_combine, 0)
- ZEND_ARG_INFO(0, keys) /* ARRAY_INFO(0, keys, 0) */
- ZEND_ARG_INFO(0, values) /* ARRAY_INFO(0, values, 0) */
-ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ basic_functions.c */
-ZEND_BEGIN_ARG_INFO(arginfo_get_magic_quotes_gpc, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_get_magic_quotes_runtime, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_constant, 0)
- ZEND_ARG_INFO(0, const_name)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_INET_NTOP
-ZEND_BEGIN_ARG_INFO(arginfo_inet_ntop, 0)
- ZEND_ARG_INFO(0, in_addr)
-ZEND_END_ARG_INFO()
-#endif
-
-#ifdef HAVE_INET_PTON
-ZEND_BEGIN_ARG_INFO(arginfo_inet_pton, 0)
- ZEND_ARG_INFO(0, ip_address)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO(arginfo_ip2long, 0)
- ZEND_ARG_INFO(0, ip_address)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_long2ip, 0)
- ZEND_ARG_INFO(0, proper_address)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_getenv, 0, 0, 0)
- ZEND_ARG_INFO(0, varname)
- ZEND_ARG_INFO(0, local_only)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_PUTENV
-ZEND_BEGIN_ARG_INFO(arginfo_putenv, 0)
- ZEND_ARG_INFO(0, setting)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_getopt, 0, 0, 1)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, opts) /* ARRAY_INFO(0, opts, 1) */
- ZEND_ARG_INFO(1, optind)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_flush, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_sleep, 0)
- ZEND_ARG_INFO(0, seconds)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_usleep, 0)
- ZEND_ARG_INFO(0, micro_seconds)
-ZEND_END_ARG_INFO()
-
-#if HAVE_NANOSLEEP
-ZEND_BEGIN_ARG_INFO(arginfo_time_nanosleep, 0)
- ZEND_ARG_INFO(0, seconds)
- ZEND_ARG_INFO(0, nanoseconds)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_time_sleep_until, 0)
- ZEND_ARG_INFO(0, timestamp)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO(arginfo_get_current_user, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_get_cfg_var, 0)
- ZEND_ARG_INFO(0, option_name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_error_log, 0, 0, 1)
- ZEND_ARG_INFO(0, message)
- ZEND_ARG_INFO(0, message_type)
- ZEND_ARG_INFO(0, destination)
- ZEND_ARG_INFO(0, extra_headers)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_error_get_last, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_error_clear_last, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_call_user_func, 0, 0, 1)
- ZEND_ARG_INFO(0, function_name)
- ZEND_ARG_VARIADIC_INFO(0, parameters)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_call_user_func_array, 0, 0, 2)
- ZEND_ARG_INFO(0, function_name)
- ZEND_ARG_INFO(0, parameters) /* ARRAY_INFO(0, parameters, 1) */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_forward_static_call, 0, 0, 1)
- ZEND_ARG_INFO(0, function_name)
- ZEND_ARG_VARIADIC_INFO(0, parameters)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_forward_static_call_array, 0, 0, 2)
- ZEND_ARG_INFO(0, function_name)
- ZEND_ARG_INFO(0, parameters) /* ARRAY_INFO(0, parameters, 1) */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_register_shutdown_function, 0, 0, 1)
- ZEND_ARG_INFO(0, function_name)
- ZEND_ARG_VARIADIC_INFO(0, parameters)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_highlight_file, 0, 0, 1)
- ZEND_ARG_INFO(0, file_name)
- ZEND_ARG_INFO(0, return)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_php_strip_whitespace, 0)
- ZEND_ARG_INFO(0, file_name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_highlight_string, 0, 0, 1)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, return)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ini_get, 0)
- ZEND_ARG_INFO(0, varname)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ini_get_all, 0, 0, 0)
- ZEND_ARG_INFO(0, extension)
- ZEND_ARG_INFO(0, details)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ini_set, 0)
- ZEND_ARG_INFO(0, varname)
- ZEND_ARG_INFO(0, newvalue)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ini_restore, 0)
- ZEND_ARG_INFO(0, varname)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_set_include_path, 0)
- ZEND_ARG_INFO(0, new_include_path)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_get_include_path, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_restore_include_path, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_print_r, 0, 0, 1)
- ZEND_ARG_INFO(0, var)
- ZEND_ARG_INFO(0, return)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_connection_aborted, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_connection_status, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ignore_user_abort, 0, 0, 0)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-#if HAVE_GETSERVBYNAME
-ZEND_BEGIN_ARG_INFO(arginfo_getservbyname, 0)
- ZEND_ARG_INFO(0, service)
- ZEND_ARG_INFO(0, protocol)
-ZEND_END_ARG_INFO()
-#endif
-
-#if HAVE_GETSERVBYPORT
-ZEND_BEGIN_ARG_INFO(arginfo_getservbyport, 0)
- ZEND_ARG_INFO(0, port)
- ZEND_ARG_INFO(0, protocol)
-ZEND_END_ARG_INFO()
-#endif
-
-#if HAVE_GETPROTOBYNAME
-ZEND_BEGIN_ARG_INFO(arginfo_getprotobyname, 0)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-#endif
-
-#if HAVE_GETPROTOBYNUMBER
-ZEND_BEGIN_ARG_INFO(arginfo_getprotobynumber, 0)
- ZEND_ARG_INFO(0, proto)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_register_tick_function, 0, 0, 1)
- ZEND_ARG_INFO(0, function_name)
- ZEND_ARG_VARIADIC_INFO(0, parameters)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_unregister_tick_function, 0)
- ZEND_ARG_INFO(0, function_name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_is_uploaded_file, 0)
- ZEND_ARG_INFO(0, path)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_move_uploaded_file, 0)
- ZEND_ARG_INFO(0, path)
- ZEND_ARG_INFO(0, new_path)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_parse_ini_file, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, process_sections)
- ZEND_ARG_INFO(0, scanner_mode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_parse_ini_string, 0, 0, 1)
- ZEND_ARG_INFO(0, ini_string)
- ZEND_ARG_INFO(0, process_sections)
- ZEND_ARG_INFO(0, scanner_mode)
-ZEND_END_ARG_INFO()
-
-#if ZEND_DEBUG
-ZEND_BEGIN_ARG_INFO(arginfo_config_get_hash, 0)
-ZEND_END_ARG_INFO()
-#endif
-
-#ifdef HAVE_GETLOADAVG
-ZEND_BEGIN_ARG_INFO(arginfo_sys_getloadavg, 0)
-ZEND_END_ARG_INFO()
-#endif
-/* }}} */
-/* {{{ assert.c */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_assert, 0, 0, 1)
- ZEND_ARG_INFO(0, assertion)
- ZEND_ARG_INFO(0, description)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_assert_options, 0, 0, 1)
- ZEND_ARG_INFO(0, what)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ base64.c */
-ZEND_BEGIN_ARG_INFO(arginfo_base64_encode, 0)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_base64_decode, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, strict)
-ZEND_END_ARG_INFO()
-
-/* }}} */
-/* {{{ browscap.c */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_get_browser, 0, 0, 0)
- ZEND_ARG_INFO(0, browser_name)
- ZEND_ARG_INFO(0, return_array)
-ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ crc32.c */
-ZEND_BEGIN_ARG_INFO(arginfo_crc32, 0)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-
-/* }}} */
-/* {{{ crypt.c */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_crypt, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, salt)
-ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ cyr_convert.c */
-ZEND_BEGIN_ARG_INFO(arginfo_convert_cyr_string, 0)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, from)
- ZEND_ARG_INFO(0, to)
-ZEND_END_ARG_INFO()
-
-/* }}} */
-/* {{{ datetime.c */
-#if HAVE_STRPTIME
-ZEND_BEGIN_ARG_INFO(arginfo_strptime, 0)
- ZEND_ARG_INFO(0, timestamp)
- ZEND_ARG_INFO(0, format)
-ZEND_END_ARG_INFO()
-#endif
-/* }}} */
-/* {{{ dir.c */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_opendir, 0, 0, 1)
- ZEND_ARG_INFO(0, path)
- ZEND_ARG_INFO(0, context)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dir, 0, 0, 1)
- ZEND_ARG_INFO(0, directory)
- ZEND_ARG_INFO(0, context)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_closedir, 0, 0, 0)
- ZEND_ARG_INFO(0, dir_handle)
-ZEND_END_ARG_INFO()
-
-#if defined(HAVE_CHROOT) && !defined(ZTS) && ENABLE_CHROOT_FUNC
-ZEND_BEGIN_ARG_INFO(arginfo_chroot, 0)
- ZEND_ARG_INFO(0, directory)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO(arginfo_chdir, 0)
- ZEND_ARG_INFO(0, directory)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_getcwd, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_rewinddir, 0, 0, 0)
- ZEND_ARG_INFO(0, dir_handle)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_readdir, 0, 0, 0)
- ZEND_ARG_INFO(0, dir_handle)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_GLOB
-ZEND_BEGIN_ARG_INFO_EX(arginfo_glob, 0, 0, 1)
- ZEND_ARG_INFO(0, pattern)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_scandir, 0, 0, 1)
- ZEND_ARG_INFO(0, dir)
- ZEND_ARG_INFO(0, sorting_order)
- ZEND_ARG_INFO(0, context)
-ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ dns.c */
-ZEND_BEGIN_ARG_INFO(arginfo_gethostbyaddr, 0)
- ZEND_ARG_INFO(0, ip_address)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_gethostbyname, 0)
- ZEND_ARG_INFO(0, hostname)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_gethostbynamel, 0)
- ZEND_ARG_INFO(0, hostname)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_GETHOSTNAME
-ZEND_BEGIN_ARG_INFO(arginfo_gethostname, 0)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO(arginfo_net_get_interfaces, 0)
-ZEND_END_ARG_INFO()
-
-#if defined(PHP_WIN32) || HAVE_DNS_SEARCH_FUNC
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dns_check_record, 0, 0, 1)
- ZEND_ARG_INFO(0, host)
- ZEND_ARG_INFO(0, type)
-ZEND_END_ARG_INFO()
-
-# if defined(PHP_WIN32) || HAVE_FULL_DNS_FUNCS
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dns_get_record, 0, 0, 1)
- ZEND_ARG_INFO(0, hostname)
- ZEND_ARG_INFO(0, type)
- ZEND_ARG_ARRAY_INFO(1, authns, 1)
- ZEND_ARG_ARRAY_INFO(1, addtl, 1)
- ZEND_ARG_INFO(0, raw)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dns_get_mx, 0, 0, 2)
- ZEND_ARG_INFO(0, hostname)
- ZEND_ARG_INFO(1, mxhosts) /* ARRAY_INFO(1, mxhosts, 1) */
- ZEND_ARG_INFO(1, weight) /* ARRAY_INFO(1, weight, 1) */
-ZEND_END_ARG_INFO()
-# endif
-
-#endif /* defined(PHP_WIN32) || HAVE_DNS_SEARCH_FUNC */
-/* }}} */
-
-/* {{{ exec.c */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_exec, 0, 0, 1)
- ZEND_ARG_INFO(0, command)
- ZEND_ARG_INFO(1, output) /* ARRAY_INFO(1, output, 1) */
- ZEND_ARG_INFO(1, return_value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_system, 0, 0, 1)
- ZEND_ARG_INFO(0, command)
- ZEND_ARG_INFO(1, return_value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_passthru, 0, 0, 1)
- ZEND_ARG_INFO(0, command)
- ZEND_ARG_INFO(1, return_value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_escapeshellcmd, 0)
- ZEND_ARG_INFO(0, command)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_escapeshellarg, 0)
- ZEND_ARG_INFO(0, arg)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_shell_exec, 0)
- ZEND_ARG_INFO(0, cmd)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_NICE
-ZEND_BEGIN_ARG_INFO(arginfo_proc_nice, 0)
- ZEND_ARG_INFO(0, priority)
-ZEND_END_ARG_INFO()
-#endif
-/* }}} */
-/* {{{ file.c */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_flock, 0, 0, 2)
- ZEND_ARG_INFO(0, fp)
- ZEND_ARG_INFO(0, operation)
- ZEND_ARG_INFO(1, wouldblock)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_get_meta_tags, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, use_include_path)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_file_get_contents, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, flags)
- ZEND_ARG_INFO(0, context)
- ZEND_ARG_INFO(0, offset)
- ZEND_ARG_INFO(0, maxlen)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_file_put_contents, 0, 0, 2)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, flags)
- ZEND_ARG_INFO(0, context)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_file, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, flags)
- ZEND_ARG_INFO(0, context)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_tempnam, 0)
- ZEND_ARG_INFO(0, dir)
- ZEND_ARG_INFO(0, prefix)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_tmpfile, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_fopen, 0, 0, 2)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, mode)
- ZEND_ARG_INFO(0, use_include_path)
- ZEND_ARG_INFO(0, context)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_fclose, 0)
- ZEND_ARG_INFO(0, fp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_popen, 0)
- ZEND_ARG_INFO(0, command)
- ZEND_ARG_INFO(0, mode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_pclose, 0)
- ZEND_ARG_INFO(0, fp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_feof, 0)
- ZEND_ARG_INFO(0, fp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_fgets, 0, 0, 1)
- ZEND_ARG_INFO(0, fp)
- ZEND_ARG_INFO(0, length)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_fgetc, 0)
- ZEND_ARG_INFO(0, fp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_fgetss, 0, 0, 1)
- ZEND_ARG_INFO(0, fp)
- ZEND_ARG_INFO(0, length)
- ZEND_ARG_INFO(0, allowable_tags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_fscanf, 0, 0, 2)
- ZEND_ARG_INFO(0, stream)
- ZEND_ARG_INFO(0, format)
- ZEND_ARG_VARIADIC_INFO(1, vars)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_fwrite, 0, 0, 2)
- ZEND_ARG_INFO(0, fp)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, length)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_fflush, 0)
- ZEND_ARG_INFO(0, fp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_rewind, 0)
- ZEND_ARG_INFO(0, fp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftell, 0)
- ZEND_ARG_INFO(0, fp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_fseek, 0, 0, 2)
- ZEND_ARG_INFO(0, fp)
- ZEND_ARG_INFO(0, offset)
- ZEND_ARG_INFO(0, whence)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mkdir, 0, 0, 1)
- ZEND_ARG_INFO(0, pathname)
- ZEND_ARG_INFO(0, mode)
- ZEND_ARG_INFO(0, recursive)
- ZEND_ARG_INFO(0, context)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_rmdir, 0, 0, 1)
- ZEND_ARG_INFO(0, dirname)
- ZEND_ARG_INFO(0, context)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_readfile, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, flags)
- ZEND_ARG_INFO(0, context)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_umask, 0, 0, 0)
- ZEND_ARG_INFO(0, mask)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_fpassthru, 0)
- ZEND_ARG_INFO(0, fp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_rename, 0, 0, 2)
- ZEND_ARG_INFO(0, old_name)
- ZEND_ARG_INFO(0, new_name)
- ZEND_ARG_INFO(0, context)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_unlink, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, context)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ftruncate, 0)
- ZEND_ARG_INFO(0, fp)
- ZEND_ARG_INFO(0, size)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_fstat, 0)
- ZEND_ARG_INFO(0, fp)
-ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(arginfo_copy, 0, 0, 2)
- ZEND_ARG_INFO(0, source_file)
- ZEND_ARG_INFO(0, destination_file)
- ZEND_ARG_INFO(0, context)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_fread, 0)
- ZEND_ARG_INFO(0, fp)
- ZEND_ARG_INFO(0, length)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_fputcsv, 0, 0, 2)
- ZEND_ARG_INFO(0, fp)
- ZEND_ARG_INFO(0, fields) /* ARRAY_INFO(0, fields, 1) */
- ZEND_ARG_INFO(0, delimiter)
- ZEND_ARG_INFO(0, enclosure)
- ZEND_ARG_INFO(0, escape_char)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_fgetcsv, 0, 0, 1)
- ZEND_ARG_INFO(0, fp)
- ZEND_ARG_INFO(0, length)
- ZEND_ARG_INFO(0, delimiter)
- ZEND_ARG_INFO(0, enclosure)
- ZEND_ARG_INFO(0, escape)
-ZEND_END_ARG_INFO()
-
-#if HAVE_REALPATH || defined(ZTS)
-ZEND_BEGIN_ARG_INFO(arginfo_realpath, 0)
- ZEND_ARG_INFO(0, path)
-ZEND_END_ARG_INFO()
-#endif
-
-#ifdef HAVE_FNMATCH
-ZEND_BEGIN_ARG_INFO_EX(arginfo_fnmatch, 0, 0, 2)
- ZEND_ARG_INFO(0, pattern)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO(arginfo_sys_get_temp_dir, 0)
-ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ filestat.c */
-ZEND_BEGIN_ARG_INFO(arginfo_disk_total_space, 0)
- ZEND_ARG_INFO(0, path)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_disk_free_space, 0)
- ZEND_ARG_INFO(0, path)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_chgrp, 0)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, group)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_chown, 0)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, user)
-ZEND_END_ARG_INFO()
-
-#if HAVE_LCHOWN
-ZEND_BEGIN_ARG_INFO(arginfo_lchgrp, 0)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, group)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_lchown, 0)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, user)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO(arginfo_chmod, 0)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, mode)
-ZEND_END_ARG_INFO()
-
-#if HAVE_UTIME
-ZEND_BEGIN_ARG_INFO_EX(arginfo_touch, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, time)
- ZEND_ARG_INFO(0, atime)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_clearstatcache, 0, 0, 0)
- ZEND_ARG_INFO(0, clear_realpath_cache)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_realpath_cache_size, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_realpath_cache_get, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_fileperms, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_fileinode, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_filesize, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_fileowner, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_filegroup, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_fileatime, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_filemtime, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_filectime, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_filetype, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_is_writable, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_is_readable, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_is_executable, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_is_file, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_is_dir, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_is_link, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_file_exists, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_lstat, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_stat, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ formatted_print.c */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sprintf, 0, 0, 1)
- ZEND_ARG_INFO(0, format)
- ZEND_ARG_VARIADIC_INFO(0, args)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_vsprintf, 0)
- ZEND_ARG_INFO(0, format)
- ZEND_ARG_INFO(0, args) /* ARRAY_INFO(0, args, 1) */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_printf, 0, 0, 1)
- ZEND_ARG_INFO(0, format)
- ZEND_ARG_VARIADIC_INFO(0, args)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_vprintf, 0)
- ZEND_ARG_INFO(0, format)
- ZEND_ARG_INFO(0, args) /* ARRAY_INFO(0, args, 1) */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_fprintf, 0, 0, 2)
- ZEND_ARG_INFO(0, stream)
- ZEND_ARG_INFO(0, format)
- ZEND_ARG_VARIADIC_INFO(0, args)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_vfprintf, 0)
- ZEND_ARG_INFO(0, stream)
- ZEND_ARG_INFO(0, format)
- ZEND_ARG_INFO(0, args) /* ARRAY_INFO(0, args, 1) */
-ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ fsock.c */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_fsockopen, 0, 0, 1)
- ZEND_ARG_INFO(0, hostname)
- ZEND_ARG_INFO(0, port)
- ZEND_ARG_INFO(1, errno)
- ZEND_ARG_INFO(1, errstr)
- ZEND_ARG_INFO(0, timeout)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pfsockopen, 0, 0, 1)
- ZEND_ARG_INFO(0, hostname)
- ZEND_ARG_INFO(0, port)
- ZEND_ARG_INFO(1, errno)
- ZEND_ARG_INFO(1, errstr)
- ZEND_ARG_INFO(0, timeout)
-ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ ftok.c */
-#if HAVE_FTOK
-ZEND_BEGIN_ARG_INFO(arginfo_ftok, 0)
- ZEND_ARG_INFO(0, pathname)
- ZEND_ARG_INFO(0, proj)
-ZEND_END_ARG_INFO()
-#endif
-/* }}} */
-/* {{{ head.c */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_header, 0, 0, 1)
- ZEND_ARG_INFO(0, header)
- ZEND_ARG_INFO(0, replace)
- ZEND_ARG_INFO(0, http_response_code)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_header_remove, 0, 0, 0)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_setcookie, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, value)
- ZEND_ARG_INFO(0, expires_or_options)
- ZEND_ARG_INFO(0, path)
- ZEND_ARG_INFO(0, domain)
- ZEND_ARG_INFO(0, secure)
- ZEND_ARG_INFO(0, httponly)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_setrawcookie, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, value)
- ZEND_ARG_INFO(0, expires_or_options)
- ZEND_ARG_INFO(0, path)
- ZEND_ARG_INFO(0, domain)
- ZEND_ARG_INFO(0, secure)
- ZEND_ARG_INFO(0, httponly)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_headers_sent, 0, 0, 0)
- ZEND_ARG_INFO(1, file)
- ZEND_ARG_INFO(1, line)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_headers_list, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_http_response_code, 0, 0, 0)
- ZEND_ARG_INFO(0, response_code)
-ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ hrtime.c */
-ZEND_BEGIN_ARG_INFO(arginfo_hrtime, 0)
- ZEND_ARG_INFO(0, get_as_number)
-ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ html.c */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_htmlspecialchars, 0, 0, 1)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, quote_style)
- ZEND_ARG_INFO(0, encoding)
- ZEND_ARG_INFO(0, double_encode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_htmlspecialchars_decode, 0, 0, 1)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, quote_style)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_html_entity_decode, 0, 0, 1)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, quote_style)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_htmlentities, 0, 0, 1)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, quote_style)
- ZEND_ARG_INFO(0, encoding)
- ZEND_ARG_INFO(0, double_encode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_get_html_translation_table, 0, 0, 0)
- ZEND_ARG_INFO(0, table)
- ZEND_ARG_INFO(0, quote_style)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-/* }}} */
-/* {{{ http.c */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_http_build_query, 0, 0, 1)
- ZEND_ARG_INFO(0, formdata)
- ZEND_ARG_INFO(0, prefix)
- ZEND_ARG_INFO(0, arg_separator)
- ZEND_ARG_INFO(0, enc_type)
-ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ image.c */
-ZEND_BEGIN_ARG_INFO(arginfo_image_type_to_mime_type, 0)
- ZEND_ARG_INFO(0, imagetype)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_image_type_to_extension, 0, 0, 1)
- ZEND_ARG_INFO(0, imagetype)
- ZEND_ARG_INFO(0, include_dot)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_getimagesize, 0, 0, 1)
- ZEND_ARG_INFO(0, imagefile)
- ZEND_ARG_INFO(1, info) /* ARRAY_INFO(1, info, 1) */
-ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ info.c */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phpinfo, 0, 0, 0)
- ZEND_ARG_INFO(0, what)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phpversion, 0, 0, 0)
- ZEND_ARG_INFO(0, extension)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_phpcredits, 0, 0, 0)
- ZEND_ARG_INFO(0, flag)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_php_sapi_name, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_php_uname, 0, 0, 0)
- ZEND_ARG_INFO(0, mode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_php_ini_scanned_files, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_php_ini_loaded_file, 0)
-ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ iptc.c */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_iptcembed, 0, 0, 2)
- ZEND_ARG_INFO(0, iptcdata)
- ZEND_ARG_INFO(0, jpeg_file_name)
- ZEND_ARG_INFO(0, spool)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_iptcparse, 0)
- ZEND_ARG_INFO(0, iptcdata)
-ZEND_END_ARG_INFO()
-/* }}} */
-
-/* {{{ lcg.c */
-ZEND_BEGIN_ARG_INFO(arginfo_lcg_value, 0)
-ZEND_END_ARG_INFO()
-/* }}} */
-
-/* {{{ levenshtein.c */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_levenshtein, 0, 0, 2)
- ZEND_ARG_INFO(0, str1)
- ZEND_ARG_INFO(0, str2)
- ZEND_ARG_INFO(0, cost_ins)
- ZEND_ARG_INFO(0, cost_rep)
- ZEND_ARG_INFO(0, cost_del)
-ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ link.c */
-#if defined(HAVE_SYMLINK) || defined(PHP_WIN32)
-ZEND_BEGIN_ARG_INFO(arginfo_readlink, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_linkinfo, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_symlink, 0)
- ZEND_ARG_INFO(0, target)
- ZEND_ARG_INFO(0, link)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_link, 0)
- ZEND_ARG_INFO(0, target)
- ZEND_ARG_INFO(0, link)
-ZEND_END_ARG_INFO()
-#endif
-/* }}} */
-/* {{{ mail.c */
-ZEND_BEGIN_ARG_INFO(arginfo_ezmlm_hash, 0)
- ZEND_ARG_INFO(0, addr)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mail, 0, 0, 3)
- ZEND_ARG_INFO(0, to)
- ZEND_ARG_INFO(0, subject)
- ZEND_ARG_INFO(0, message)
- ZEND_ARG_INFO(0, additional_headers)
- ZEND_ARG_INFO(0, additional_parameters)
-ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ math.c */
-ZEND_BEGIN_ARG_INFO(arginfo_abs, 0)
- ZEND_ARG_INFO(0, number)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ceil, 0)
- ZEND_ARG_INFO(0, number)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_floor, 0)
- ZEND_ARG_INFO(0, number)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_round, 0, 0, 1)
- ZEND_ARG_INFO(0, number)
- ZEND_ARG_INFO(0, precision)
- ZEND_ARG_INFO(0, mode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_sin, 0)
- ZEND_ARG_INFO(0, number)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_cos, 0)
- ZEND_ARG_INFO(0, number)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_tan, 0)
- ZEND_ARG_INFO(0, number)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_asin, 0)
- ZEND_ARG_INFO(0, number)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_acos, 0)
- ZEND_ARG_INFO(0, number)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_atan, 0)
- ZEND_ARG_INFO(0, number)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_atan2, 0)
- ZEND_ARG_INFO(0, y)
- ZEND_ARG_INFO(0, x)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_sinh, 0)
- ZEND_ARG_INFO(0, number)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_cosh, 0)
- ZEND_ARG_INFO(0, number)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_tanh, 0)
- ZEND_ARG_INFO(0, number)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_asinh, 0)
- ZEND_ARG_INFO(0, number)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_acosh, 0)
- ZEND_ARG_INFO(0, number)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_atanh, 0)
- ZEND_ARG_INFO(0, number)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_pi, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_is_finite, 0)
- ZEND_ARG_INFO(0, val)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_is_infinite, 0)
- ZEND_ARG_INFO(0, val)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_is_nan, 0)
- ZEND_ARG_INFO(0, val)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_pow, 0)
- ZEND_ARG_INFO(0, base)
- ZEND_ARG_INFO(0, exponent)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_exp, 0)
- ZEND_ARG_INFO(0, number)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_expm1, 0)
- ZEND_ARG_INFO(0, number)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_log1p, 0)
- ZEND_ARG_INFO(0, number)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_log, 0, 0, 1)
- ZEND_ARG_INFO(0, number)
- ZEND_ARG_INFO(0, base)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_log10, 0)
- ZEND_ARG_INFO(0, number)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_sqrt, 0)
- ZEND_ARG_INFO(0, number)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_hypot, 0)
- ZEND_ARG_INFO(0, num1)
- ZEND_ARG_INFO(0, num2)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_deg2rad, 0)
- ZEND_ARG_INFO(0, number)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_rad2deg, 0)
- ZEND_ARG_INFO(0, number)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_bindec, 0)
- ZEND_ARG_INFO(0, binary_number)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_hexdec, 0)
- ZEND_ARG_INFO(0, hexadecimal_number)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_octdec, 0)
- ZEND_ARG_INFO(0, octal_number)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_decbin, 0)
- ZEND_ARG_INFO(0, decimal_number)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_decoct, 0)
- ZEND_ARG_INFO(0, decimal_number)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_dechex, 0)
- ZEND_ARG_INFO(0, decimal_number)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_base_convert, 0)
- ZEND_ARG_INFO(0, number)
- ZEND_ARG_INFO(0, frombase)
- ZEND_ARG_INFO(0, tobase)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_number_format, 0, 0, 1)
- ZEND_ARG_INFO(0, number)
- ZEND_ARG_INFO(0, num_decimal_places)
- ZEND_ARG_INFO(0, dec_separator)
- ZEND_ARG_INFO(0, thousands_separator)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_fmod, 0)
- ZEND_ARG_INFO(0, x)
- ZEND_ARG_INFO(0, y)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_intdiv, 0)
- ZEND_ARG_INFO(0, dividend)
- ZEND_ARG_INFO(0, divisor)
-ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ md5.c */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_md5, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, raw_output)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_md5_file, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, raw_output)
-ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ metaphone.c */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_metaphone, 0, 0, 1)
- ZEND_ARG_INFO(0, text)
- ZEND_ARG_INFO(0, phones)
-ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ microtime.c */
-#ifdef HAVE_GETTIMEOFDAY
-ZEND_BEGIN_ARG_INFO_EX(arginfo_microtime, 0, 0, 0)
- ZEND_ARG_INFO(0, get_as_float)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gettimeofday, 0, 0, 0)
- ZEND_ARG_INFO(0, get_as_float)
-ZEND_END_ARG_INFO()
-#endif
-
-#ifdef HAVE_GETRUSAGE
-ZEND_BEGIN_ARG_INFO_EX(arginfo_getrusage, 0, 0, 0)
- ZEND_ARG_INFO(0, who)
-ZEND_END_ARG_INFO()
-#endif
-/* }}} */
-/* {{{ pack.c */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pack, 0, 0, 1)
- ZEND_ARG_INFO(0, format)
- ZEND_ARG_VARIADIC_INFO(0, args)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_unpack, 0, 0, 2)
- ZEND_ARG_INFO(0, format)
- ZEND_ARG_INFO(0, input)
- ZEND_ARG_INFO(0, offset)
-ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ pageinfo.c */
-ZEND_BEGIN_ARG_INFO(arginfo_getmyuid, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_getmygid, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_getmypid, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_getmyinode, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_getlastmod, 0)
-ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ password.c */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_password_hash, 0, 0, 2)
- ZEND_ARG_INFO(0, password)
- ZEND_ARG_INFO(0, algo)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(arginfo_password_get_info, 0, 0, 1)
- ZEND_ARG_INFO(0, hash)
-ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(arginfo_password_needs_rehash, 0, 0, 2)
- ZEND_ARG_INFO(0, hash)
- ZEND_ARG_INFO(0, algo)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(arginfo_password_verify, 0, 0, 2)
- ZEND_ARG_INFO(0, password)
- ZEND_ARG_INFO(0, hash)
-ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_password_algos, 0)
-ZEND_END_ARG_INFO();
-/* }}} */
-/* {{{ proc_open.c */
-#ifdef PHP_CAN_SUPPORT_PROC_OPEN
-ZEND_BEGIN_ARG_INFO_EX(arginfo_proc_terminate, 0, 0, 1)
- ZEND_ARG_INFO(0, process)
- ZEND_ARG_INFO(0, signal)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_proc_close, 0)
- ZEND_ARG_INFO(0, process)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_proc_get_status, 0)
- ZEND_ARG_INFO(0, process)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_proc_open, 0, 0, 3)
- ZEND_ARG_INFO(0, command)
- ZEND_ARG_INFO(0, descriptorspec) /* ARRAY_INFO(0, descriptorspec, 1) */
- ZEND_ARG_INFO(1, pipes) /* ARRAY_INFO(1, pipes, 1) */
- ZEND_ARG_INFO(0, cwd)
- ZEND_ARG_INFO(0, env) /* ARRAY_INFO(0, env, 1) */
- ZEND_ARG_INFO(0, other_options) /* ARRAY_INFO(0, other_options, 1) */
-ZEND_END_ARG_INFO()
-#endif
-/* }}} */
-/* {{{ quot_print.c */
-ZEND_BEGIN_ARG_INFO(arginfo_quoted_printable_decode, 0)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ quot_print.c */
-ZEND_BEGIN_ARG_INFO(arginfo_quoted_printable_encode, 0)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ mt_rand.c */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mt_srand, 0, 0, 0)
- ZEND_ARG_INFO(0, seed)
- ZEND_ARG_INFO(0, mode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mt_rand, 0, 0, 0)
- ZEND_ARG_INFO(0, min)
- ZEND_ARG_INFO(0, max)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_mt_getrandmax, 0)
-ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ random.c */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_random_bytes, 0, 0, 1)
- ZEND_ARG_INFO(0, length)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_random_int, 0, 0, 2)
- ZEND_ARG_INFO(0, min)
- ZEND_ARG_INFO(0, max)
-ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ sha1.c */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sha1, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, raw_output)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sha1_file, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, raw_output)
-ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ soundex.c */
-ZEND_BEGIN_ARG_INFO(arginfo_soundex, 0)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ streamsfuncs.c */
-#if HAVE_SOCKETPAIR
-ZEND_BEGIN_ARG_INFO(arginfo_stream_socket_pair, 0)
- ZEND_ARG_INFO(0, domain)
- ZEND_ARG_INFO(0, type)
- ZEND_ARG_INFO(0, protocol)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_socket_client, 0, 0, 1)
- ZEND_ARG_INFO(0, remoteaddress)
- ZEND_ARG_INFO(1, errcode)
- ZEND_ARG_INFO(1, errstring)
- ZEND_ARG_INFO(0, timeout)
- ZEND_ARG_INFO(0, flags)
- ZEND_ARG_INFO(0, context)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_socket_server, 0, 0, 1)
- ZEND_ARG_INFO(0, localaddress)
- ZEND_ARG_INFO(1, errcode)
- ZEND_ARG_INFO(1, errstring)
- ZEND_ARG_INFO(0, flags)
- ZEND_ARG_INFO(0, context)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_socket_accept, 0, 0, 1)
- ZEND_ARG_INFO(0, serverstream)
- ZEND_ARG_INFO(0, timeout)
- ZEND_ARG_INFO(1, peername)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_stream_socket_get_name, 0)
- ZEND_ARG_INFO(0, stream)
- ZEND_ARG_INFO(0, want_peer)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_socket_sendto, 0, 0, 2)
- ZEND_ARG_INFO(0, stream)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, flags)
- ZEND_ARG_INFO(0, target_addr)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_socket_recvfrom, 0, 0, 2)
- ZEND_ARG_INFO(0, stream)
- ZEND_ARG_INFO(0, amount)
- ZEND_ARG_INFO(0, flags)
- ZEND_ARG_INFO(1, remote_addr)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_get_contents, 0, 0, 1)
- ZEND_ARG_INFO(0, source)
- ZEND_ARG_INFO(0, maxlen)
- ZEND_ARG_INFO(0, offset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_copy_to_stream, 0, 0, 2)
- ZEND_ARG_INFO(0, source)
- ZEND_ARG_INFO(0, dest)
- ZEND_ARG_INFO(0, maxlen)
- ZEND_ARG_INFO(0, pos)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_stream_get_meta_data, 0)
- ZEND_ARG_INFO(0, fp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_stream_get_transports, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_stream_get_wrappers, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_stream_resolve_include_path, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_stream_is_local, 0)
- ZEND_ARG_INFO(0, stream)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_supports_lock, 0, 0, 1)
- ZEND_ARG_INFO(0, stream)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_isatty, 0, 0, 1)
- ZEND_ARG_INFO(0, stream)
-ZEND_END_ARG_INFO()
-
-#ifdef PHP_WIN32
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sapi_windows_vt100_support, 0, 0, 1)
- ZEND_ARG_INFO(0, stream)
- ZEND_ARG_INFO(0, enable)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_select, 0, 0, 4)
- ZEND_ARG_INFO(1, read_streams) /* ARRAY_INFO(1, read_streams, 1) */
- ZEND_ARG_INFO(1, write_streams) /* ARRAY_INFO(1, write_streams, 1) */
- ZEND_ARG_INFO(1, except_streams) /* ARRAY_INFO(1, except_streams, 1) */
- ZEND_ARG_INFO(0, tv_sec)
- ZEND_ARG_INFO(0, tv_usec)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_stream_context_get_options, 0)
- ZEND_ARG_INFO(0, stream_or_context)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_context_set_option, 0, 0, 2)
- ZEND_ARG_INFO(0, stream_or_context)
- ZEND_ARG_INFO(0, wrappername)
- ZEND_ARG_INFO(0, optionname)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_stream_context_set_params, 0)
- ZEND_ARG_INFO(0, stream_or_context)
- ZEND_ARG_INFO(0, options) /* ARRAY_INFO(0, options, 1) */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_context_get_params, 0, ZEND_RETURN_VALUE, 1)
- ZEND_ARG_INFO(0, stream_or_context)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_context_get_default, 0, 0, 0)
- ZEND_ARG_INFO(0, options) /* ARRAY_INFO(0, options, 1) */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_stream_context_set_default, 0)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_context_create, 0, 0, 0)
- ZEND_ARG_INFO(0, options) /* ARRAY_INFO(0, options, 1) */
- ZEND_ARG_INFO(0, params) /* ARRAY_INFO(0, params, 1) */
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_filter_prepend, 0, 0, 2)
- ZEND_ARG_INFO(0, stream)
- ZEND_ARG_INFO(0, filtername)
- ZEND_ARG_INFO(0, read_write)
- ZEND_ARG_INFO(0, filterparams)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_filter_append, 0, 0, 2)
- ZEND_ARG_INFO(0, stream)
- ZEND_ARG_INFO(0, filtername)
- ZEND_ARG_INFO(0, read_write)
- ZEND_ARG_INFO(0, filterparams)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_stream_filter_remove, 0)
- ZEND_ARG_INFO(0, stream_filter)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_get_line, 0, 0, 2)
- ZEND_ARG_INFO(0, stream)
- ZEND_ARG_INFO(0, maxlen)
- ZEND_ARG_INFO(0, ending)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_stream_set_blocking, 0)
- ZEND_ARG_INFO(0, socket)
- ZEND_ARG_INFO(0, mode)
-ZEND_END_ARG_INFO()
-
-#if HAVE_SYS_TIME_H || defined(PHP_WIN32)
-ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_set_timeout, 0, 0, 2)
- ZEND_ARG_INFO(0, stream)
- ZEND_ARG_INFO(0, seconds)
- ZEND_ARG_INFO(0, microseconds)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO(arginfo_stream_set_read_buffer, 0)
- ZEND_ARG_INFO(0, fp)
- ZEND_ARG_INFO(0, buffer)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_stream_set_write_buffer, 0)
- ZEND_ARG_INFO(0, fp)
- ZEND_ARG_INFO(0, buffer)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_stream_set_chunk_size, 0)
- ZEND_ARG_INFO(0, fp)
- ZEND_ARG_INFO(0, chunk_size)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_socket_enable_crypto, 0, 0, 2)
- ZEND_ARG_INFO(0, stream)
- ZEND_ARG_INFO(0, enable)
- ZEND_ARG_INFO(0, cryptokind)
- ZEND_ARG_INFO(0, sessionstream)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_SHUTDOWN
-ZEND_BEGIN_ARG_INFO(arginfo_stream_socket_shutdown, 0)
- ZEND_ARG_INFO(0, stream)
- ZEND_ARG_INFO(0, how)
-ZEND_END_ARG_INFO()
-#endif
-/* }}} */
-/* {{{ string.c */
-ZEND_BEGIN_ARG_INFO(arginfo_bin2hex, 0)
- ZEND_ARG_INFO(0, data)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_hex2bin, 0)
- ZEND_ARG_INFO(0, data)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_strspn, 0, 0, 2)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, mask)
- ZEND_ARG_INFO(0, start)
- ZEND_ARG_INFO(0, len)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_strcspn, 0, 0, 2)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, mask)
- ZEND_ARG_INFO(0, start)
- ZEND_ARG_INFO(0, len)
-ZEND_END_ARG_INFO()
-
-#if HAVE_NL_LANGINFO
-ZEND_BEGIN_ARG_INFO(arginfo_nl_langinfo, 0)
- ZEND_ARG_INFO(0, item)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO(arginfo_strcoll, 0)
- ZEND_ARG_INFO(0, str1)
- ZEND_ARG_INFO(0, str2)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_trim, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, character_mask)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_rtrim, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, character_mask)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ltrim, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, character_mask)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_wordwrap, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, width)
- ZEND_ARG_INFO(0, break)
- ZEND_ARG_INFO(0, cut)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_explode, 0, 0, 2)
- ZEND_ARG_INFO(0, separator)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, limit)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_implode, 0)
- ZEND_ARG_INFO(0, glue)
- ZEND_ARG_INFO(0, pieces)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_strtok, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, token)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_strtoupper, 0)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_strtolower, 0)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_basename, 0, 0, 1)
- ZEND_ARG_INFO(0, path)
- ZEND_ARG_INFO(0, suffix)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dirname, 0, 0, 1)
- ZEND_ARG_INFO(0, path)
- ZEND_ARG_INFO(0, levels)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_pathinfo, 0, 0, 1)
- ZEND_ARG_INFO(0, path)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_stristr, 0, 0, 2)
- ZEND_ARG_INFO(0, haystack)
- ZEND_ARG_INFO(0, needle)
- ZEND_ARG_INFO(0, part)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_strstr, 0, 0, 2)
- ZEND_ARG_INFO(0, haystack)
- ZEND_ARG_INFO(0, needle)
- ZEND_ARG_INFO(0, part)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_strpos, 0, 0, 2)
- ZEND_ARG_INFO(0, haystack)
- ZEND_ARG_INFO(0, needle)
- ZEND_ARG_INFO(0, offset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_stripos, 0, 0, 2)
- ZEND_ARG_INFO(0, haystack)
- ZEND_ARG_INFO(0, needle)
- ZEND_ARG_INFO(0, offset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_strrpos, 0, 0, 2)
- ZEND_ARG_INFO(0, haystack)
- ZEND_ARG_INFO(0, needle)
- ZEND_ARG_INFO(0, offset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_strripos, 0, 0, 2)
- ZEND_ARG_INFO(0, haystack)
- ZEND_ARG_INFO(0, needle)
- ZEND_ARG_INFO(0, offset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_strrchr, 0)
- ZEND_ARG_INFO(0, haystack)
- ZEND_ARG_INFO(0, needle)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_chunk_split, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, chunklen)
- ZEND_ARG_INFO(0, ending)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_substr, 0, 0, 2)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, start)
- ZEND_ARG_INFO(0, length)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_substr_replace, 0, 0, 3)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, replace)
- ZEND_ARG_INFO(0, start)
- ZEND_ARG_INFO(0, length)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_quotemeta, 0)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ord, 0)
- ZEND_ARG_INFO(0, character)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_chr, 0)
- ZEND_ARG_INFO(0, codepoint)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ucfirst, 0)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_lcfirst, 0)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ucwords, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, delimiters)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_strtr, 0, 0, 2)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, from)
- ZEND_ARG_INFO(0, to)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_strrev, 0)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_similar_text, 0, 0, 2)
- ZEND_ARG_INFO(0, str1)
- ZEND_ARG_INFO(0, str2)
- ZEND_ARG_INFO(1, percent)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_addcslashes, 0)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, charlist)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_addslashes, 0)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_stripcslashes, 0)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_stripslashes, 0)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_str_replace, 0, 0, 3)
- ZEND_ARG_INFO(0, search)
- ZEND_ARG_INFO(0, replace)
- ZEND_ARG_INFO(0, subject)
- ZEND_ARG_INFO(1, replace_count)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_str_ireplace, 0, 0, 3)
- ZEND_ARG_INFO(0, search)
- ZEND_ARG_INFO(0, replace)
- ZEND_ARG_INFO(0, subject)
- ZEND_ARG_INFO(1, replace_count)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_hebrev, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, max_chars_per_line)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_hebrevc, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, max_chars_per_line)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_nl2br, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, is_xhtml)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_strip_tags, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, allowable_tags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_setlocale, 0, 0, 2)
- ZEND_ARG_INFO(0, category)
- ZEND_ARG_VARIADIC_INFO(0, locales)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_parse_str, 0, 0, 1)
- ZEND_ARG_INFO(0, encoded_string)
- ZEND_ARG_INFO(1, result)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_str_getcsv, 0, 0, 1)
- ZEND_ARG_INFO(0, string)
- ZEND_ARG_INFO(0, delimiter)
- ZEND_ARG_INFO(0, enclosure)
- ZEND_ARG_INFO(0, escape)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_str_repeat, 0)
- ZEND_ARG_INFO(0, input)
- ZEND_ARG_INFO(0, mult)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_count_chars, 0, 0, 1)
- ZEND_ARG_INFO(0, input)
- ZEND_ARG_INFO(0, mode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_strnatcmp, 0)
- ZEND_ARG_INFO(0, s1)
- ZEND_ARG_INFO(0, s2)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_localeconv, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_strnatcasecmp, 0)
- ZEND_ARG_INFO(0, s1)
- ZEND_ARG_INFO(0, s2)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_substr_count, 0, 0, 2)
- ZEND_ARG_INFO(0, haystack)
- ZEND_ARG_INFO(0, needle)
- ZEND_ARG_INFO(0, offset)
- ZEND_ARG_INFO(0, length)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_str_pad, 0, 0, 2)
- ZEND_ARG_INFO(0, input)
- ZEND_ARG_INFO(0, pad_length)
- ZEND_ARG_INFO(0, pad_string)
- ZEND_ARG_INFO(0, pad_type)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sscanf, 0, 0, 2)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, format)
- ZEND_ARG_VARIADIC_INFO(1, vars)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_str_rot13, 0)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_str_shuffle, 0)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_str_word_count, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, format)
- ZEND_ARG_INFO(0, charlist)
-ZEND_END_ARG_INFO()
-
-#ifdef HAVE_STRFMON
-ZEND_BEGIN_ARG_INFO(arginfo_money_format, 0)
- ZEND_ARG_INFO(0, format)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_str_split, 0, 0, 1)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, split_length)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_strpbrk, 0, 0, 2)
- ZEND_ARG_INFO(0, haystack)
- ZEND_ARG_INFO(0, char_list)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_substr_compare, 0, 0, 3)
- ZEND_ARG_INFO(0, main_str)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, offset)
- ZEND_ARG_INFO(0, length)
- ZEND_ARG_INFO(0, case_sensitivity)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_utf8_encode, 0, 0, 1)
- ZEND_ARG_INFO(0, data)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_utf8_decode, 0, 0, 1)
- ZEND_ARG_INFO(0, data)
-ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ syslog.c */
-#ifdef HAVE_SYSLOG_H
-ZEND_BEGIN_ARG_INFO(arginfo_openlog, 0)
- ZEND_ARG_INFO(0, ident)
- ZEND_ARG_INFO(0, option)
- ZEND_ARG_INFO(0, facility)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_closelog, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_syslog, 0)
- ZEND_ARG_INFO(0, priority)
- ZEND_ARG_INFO(0, message)
-ZEND_END_ARG_INFO()
-#endif
-/* }}} */
-/* {{{ type.c */
-ZEND_BEGIN_ARG_INFO(arginfo_gettype, 0)
- ZEND_ARG_INFO(0, var)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_settype, 0)
- ZEND_ARG_INFO(1, var)
- ZEND_ARG_INFO(0, type)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_intval, 0, 0, 1)
- ZEND_ARG_INFO(0, var)
- ZEND_ARG_INFO(0, base)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_floatval, 0)
- ZEND_ARG_INFO(0, var)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_strval, 0)
- ZEND_ARG_INFO(0, var)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_boolval, 0)
- ZEND_ARG_INFO(0, var)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_is_null, 0)
- ZEND_ARG_INFO(0, var)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_is_resource, 0)
- ZEND_ARG_INFO(0, var)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_is_bool, 0)
- ZEND_ARG_INFO(0, var)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_is_int, 0)
- ZEND_ARG_INFO(0, var)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_is_float, 0)
- ZEND_ARG_INFO(0, var)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_is_string, 0)
- ZEND_ARG_INFO(0, var)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_is_array, 0)
- ZEND_ARG_INFO(0, var)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_is_object, 0)
- ZEND_ARG_INFO(0, var)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_is_numeric, 0)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_is_scalar, 0)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_is_callable, 0, 0, 1)
- ZEND_ARG_INFO(0, var)
- ZEND_ARG_INFO(0, syntax_only)
- ZEND_ARG_INFO(1, callable_name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_is_iterable, 0, 0, 1)
- ZEND_ARG_INFO(0, var)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_is_countable, 0)
- ZEND_ARG_INFO(0, var)
-ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ uniqid.c */
-#ifdef HAVE_GETTIMEOFDAY
-ZEND_BEGIN_ARG_INFO_EX(arginfo_uniqid, 0, 0, 0)
- ZEND_ARG_INFO(0, prefix)
- ZEND_ARG_INFO(0, more_entropy)
-ZEND_END_ARG_INFO()
-#endif
-/* }}} */
-/* {{{ url.c */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_parse_url, 0, 0, 1)
- ZEND_ARG_INFO(0, url)
- ZEND_ARG_INFO(0, component)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_urlencode, 0)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_urldecode, 0)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_rawurlencode, 0)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_rawurldecode, 0)
- ZEND_ARG_INFO(0, str)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_get_headers, 0, 0, 1)
- ZEND_ARG_INFO(0, url)
- ZEND_ARG_INFO(0, format)
- ZEND_ARG_INFO(0, context)
-ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ user_filters.c */
-ZEND_BEGIN_ARG_INFO(arginfo_stream_bucket_make_writeable, 0)
- ZEND_ARG_INFO(0, brigade)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_stream_bucket_prepend, 0)
- ZEND_ARG_INFO(0, brigade)
- ZEND_ARG_INFO(0, bucket)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_stream_bucket_append, 0)
- ZEND_ARG_INFO(0, brigade)
- ZEND_ARG_INFO(0, bucket)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_stream_bucket_new, 0)
- ZEND_ARG_INFO(0, stream)
- ZEND_ARG_INFO(0, buffer)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_stream_get_filters, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_stream_filter_register, 0)
- ZEND_ARG_INFO(0, filtername)
- ZEND_ARG_INFO(0, classname)
-ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ uuencode.c */
-ZEND_BEGIN_ARG_INFO(arginfo_convert_uuencode, 0)
- ZEND_ARG_INFO(0, data)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_convert_uudecode, 0)
- ZEND_ARG_INFO(0, data)
-ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ var.c */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_var_dump, 0, 0, 1)
- ZEND_ARG_VARIADIC_INFO(0, vars)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_debug_zval_dump, 0, 0, 1)
- ZEND_ARG_VARIADIC_INFO(0, vars)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_var_export, 0, 0, 1)
- ZEND_ARG_INFO(0, var)
- ZEND_ARG_INFO(0, return)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_serialize, 0)
- ZEND_ARG_INFO(0, var)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_unserialize, 0, 0, 1)
- ZEND_ARG_INFO(0, variable_representation)
- ZEND_ARG_INFO(0, allowed_classes)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_memory_get_usage, 0, 0, 0)
- ZEND_ARG_INFO(0, real_usage)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_memory_get_peak_usage, 0, 0, 0)
- ZEND_ARG_INFO(0, real_usage)
-ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ versioning.c */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_version_compare, 0, 0, 2)
- ZEND_ARG_INFO(0, ver1)
- ZEND_ARG_INFO(0, ver2)
- ZEND_ARG_INFO(0, oper)
-ZEND_END_ARG_INFO()
-/* }}} */
-/* {{{ win32/codepage.c */
-#ifdef PHP_WIN32
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sapi_windows_cp_set, 0, 0, 1)
- ZEND_ARG_TYPE_INFO(0, code_page, IS_LONG, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sapi_windows_cp_get, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sapi_windows_cp_is_utf8, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sapi_windows_cp_conv, 0, 0, 3)
- ZEND_ARG_INFO(0, in_codepage)
- ZEND_ARG_INFO(0, out_codepage)
- ZEND_ARG_TYPE_INFO(0, subject, IS_STRING, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sapi_windows_set_ctrl_handler, 0, 0, 1)
- ZEND_ARG_INFO(0, callable)
- ZEND_ARG_INFO(0, add)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sapi_windows_generate_ctrl_event, 0, 0, 1)
- ZEND_ARG_INFO(0, event)
- ZEND_ARG_INFO(0, pid)
-ZEND_END_ARG_INFO()
-#endif
-/* }}} */
-/* }}} */
static const zend_function_entry basic_functions[] = { /* {{{ */
PHP_FE(constant, arginfo_constant)
@@ -2758,7 +153,7 @@ static const zend_function_entry basic_functions[] = { /* {{{ */
PHP_FE(iptcparse, arginfo_iptcparse)
PHP_FE(iptcembed, arginfo_iptcembed)
PHP_FE(getimagesize, arginfo_getimagesize)
- PHP_FE(getimagesizefromstring, arginfo_getimagesize)
+ PHP_FE(getimagesizefromstring, arginfo_getimagesizefromstring)
PHP_FE(image_type_to_mime_type, arginfo_image_type_to_mime_type)
PHP_FE(image_type_to_extension, arginfo_image_type_to_extension)
@@ -2784,7 +179,6 @@ static const zend_function_entry basic_functions[] = { /* {{{ */
PHP_FE(strripos, arginfo_strripos)
PHP_FE(strrev, arginfo_strrev)
PHP_FE(hebrev, arginfo_hebrev)
- PHP_DEP_FE(hebrevc, arginfo_hebrevc)
PHP_FE(nl2br, arginfo_nl2br)
PHP_FE(basename, arginfo_basename)
PHP_FE(dirname, arginfo_dirname)
@@ -2803,10 +197,6 @@ static const zend_function_entry basic_functions[] = { /* {{{ */
PHP_FE(utf8_decode, arginfo_utf8_decode)
PHP_FE(strcoll, arginfo_strcoll)
-#ifdef HAVE_STRFMON
- PHP_DEP_FE(money_format, arginfo_money_format)
-#endif
-
PHP_FE(substr, arginfo_substr)
PHP_FE(substr_replace, arginfo_substr_replace)
PHP_FE(quotemeta, arginfo_quotemeta)
@@ -2968,6 +358,7 @@ static const zend_function_entry basic_functions[] = { /* {{{ */
PHP_FE(base_convert, arginfo_base_convert)
PHP_FE(number_format, arginfo_number_format)
PHP_FE(fmod, arginfo_fmod)
+ PHP_FE(fdiv, arginfo_fdiv)
PHP_FE(intdiv, arginfo_intdiv)
#ifdef HAVE_INET_NTOP
PHP_RAW_NAMED_FE(inet_ntop, zif_inet_ntop, arginfo_inet_ntop)
@@ -3005,15 +396,11 @@ static const zend_function_entry basic_functions[] = { /* {{{ */
PHP_FE(quoted_printable_decode, arginfo_quoted_printable_decode)
PHP_FE(quoted_printable_encode, arginfo_quoted_printable_encode)
- PHP_DEP_FE(convert_cyr_string, arginfo_convert_cyr_string)
PHP_FE(get_current_user, arginfo_get_current_user)
PHP_FE(set_time_limit, arginfo_set_time_limit)
PHP_FE(header_register_callback, arginfo_header_register_callback)
PHP_FE(get_cfg_var, arginfo_get_cfg_var)
- PHP_DEP_FE(get_magic_quotes_gpc, arginfo_get_magic_quotes_gpc)
- PHP_DEP_FE(get_magic_quotes_runtime, arginfo_get_magic_quotes_runtime)
-
PHP_FE(error_log, arginfo_error_log)
PHP_FE(error_get_last, arginfo_error_get_last)
PHP_FE(error_clear_last, arginfo_error_clear_last)
@@ -3130,7 +517,6 @@ static const zend_function_entry basic_functions[] = { /* {{{ */
PHP_FE(feof, arginfo_feof)
PHP_FE(fgetc, arginfo_fgetc)
PHP_FE(fgets, arginfo_fgets)
- PHP_DEP_FE(fgetss, arginfo_fgetss)
PHP_FE(fread, arginfo_fread)
PHP_NAMED_FE(fopen, php_if_fopen, arginfo_fopen)
PHP_FE(fpassthru, arginfo_fpassthru)
@@ -3291,7 +677,6 @@ static const zend_function_entry basic_functions[] = { /* {{{ */
/* functions from mail.c */
PHP_FE(mail, arginfo_mail)
- PHP_DEP_FE(ezmlm_hash, arginfo_ezmlm_hash)
/* functions from syslog.c */
#ifdef HAVE_SYSLOG_H
@@ -3900,25 +1285,22 @@ PHP_FUNCTION(constant)
ZEND_PARSE_PARAMETERS_END();
scope = zend_get_executed_scope();
- c = zend_get_constant_ex(const_name, scope, ZEND_FETCH_CLASS_SILENT);
- if (c) {
- ZVAL_COPY_OR_DUP(return_value, c);
- if (Z_TYPE_P(return_value) == IS_CONSTANT_AST) {
- if (UNEXPECTED(zval_update_constant_ex(return_value, scope) != SUCCESS)) {
- return;
- }
- }
- } else {
- if (!EG(exception)) {
- php_error_docref(NULL, E_WARNING, "Couldn't find constant %s", ZSTR_VAL(const_name));
+ c = zend_get_constant_ex(const_name, scope, 0);
+ if (!c) {
+ RETURN_THROWS();
+ }
+
+ ZVAL_COPY_OR_DUP(return_value, c);
+ if (Z_TYPE_P(return_value) == IS_CONSTANT_AST) {
+ if (UNEXPECTED(zval_update_constant_ex(return_value, scope) != SUCCESS)) {
+ RETURN_THROWS();
}
- RETURN_NULL();
}
}
/* }}} */
#ifdef HAVE_INET_NTOP
-/* {{{ proto string inet_ntop(string in_addr)
+/* {{{ proto string|false inet_ntop(string in_addr)
Converts a packed inet address to a human readable IP address string */
PHP_NAMED_FUNCTION(zif_inet_ntop)
{
@@ -3929,7 +1311,7 @@ PHP_NAMED_FUNCTION(zif_inet_ntop)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_STRING(address, address_len)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
#ifdef HAVE_IPV6
if (address_len == 16) {
@@ -3950,7 +1332,7 @@ PHP_NAMED_FUNCTION(zif_inet_ntop)
#endif /* HAVE_INET_NTOP */
#ifdef HAVE_INET_PTON
-/* {{{ proto string inet_pton(string ip_address)
+/* {{{ proto string|false inet_pton(string ip_address)
Converts a human readable IP address to a packed binary string */
PHP_NAMED_FUNCTION(php_inet_pton)
{
@@ -3961,7 +1343,7 @@ PHP_NAMED_FUNCTION(php_inet_pton)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_STRING(address, address_len)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
memset(buffer, 0, sizeof(buffer));
@@ -3985,7 +1367,7 @@ PHP_NAMED_FUNCTION(php_inet_pton)
/* }}} */
#endif /* HAVE_INET_PTON */
-/* {{{ proto int ip2long(string ip_address)
+/* {{{ proto int|false ip2long(string ip_address)
Converts a string containing an (IPv4) Internet Protocol dotted address into a proper address */
PHP_FUNCTION(ip2long)
{
@@ -4023,7 +1405,7 @@ PHP_FUNCTION(ip2long)
}
/* }}} */
-/* {{{ proto string long2ip(int proper_address)
+/* {{{ proto string|false long2ip(int proper_address)
Converts an (IPv4) Internet network address into a string in Internet standard dotted format */
PHP_FUNCTION(long2ip)
{
@@ -4058,7 +1440,7 @@ PHP_FUNCTION(long2ip)
* System Functions *
********************/
-/* {{{ proto string getenv(string varname[, bool local_only]
+/* {{{ proto string|array|false getenv([ string varname[, bool local_only]])
Get the value of an environment variable or every available environment variable
if no varname is present */
PHP_FUNCTION(getenv)
@@ -4071,7 +1453,7 @@ PHP_FUNCTION(getenv)
Z_PARAM_OPTIONAL
Z_PARAM_STRING(str, str_len)
Z_PARAM_BOOL(local_only)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (!str) {
array_init(return_value);
@@ -4174,10 +1556,10 @@ PHP_FUNCTION(putenv)
Z_PARAM_STRING(setting, setting_len)
ZEND_PARSE_PARAMETERS_END();
- if(setting_len == 0 || setting[0] == '=') {
- php_error_docref(NULL, E_WARNING, "Invalid parameter syntax");
- RETURN_FALSE;
- }
+ if (setting_len == 0 || setting[0] == '=') {
+ zend_value_error("Invalid parameter syntax");
+ RETURN_THROWS();
+ }
pe.putenv_string = estrndup(setting, setting_len);
pe.key = estrndup(setting, setting_len);
@@ -4353,7 +1735,7 @@ static int parse_opts(char * opts, opt_struct ** result)
}
/* }}} */
-/* {{{ proto array getopt(string options [, array longopts [, int &optind]])
+/* {{{ proto array|false getopt(string options [, array longopts [, int &optind]])
Get options from the command line argument list */
PHP_FUNCTION(getopt)
{
@@ -4374,7 +1756,7 @@ PHP_FUNCTION(getopt)
Z_PARAM_OPTIONAL
Z_PARAM_ARRAY(p_longopts)
Z_PARAM_ZVAL(zoptind)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
/* Init zoptind to 1 */
if (zoptind) {
@@ -4539,15 +1921,13 @@ PHP_FUNCTION(getopt)
Flush the output buffer */
PHP_FUNCTION(flush)
{
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
sapi_flush();
}
/* }}} */
-/* {{{ proto void sleep(int seconds)
+/* {{{ proto int sleep(int seconds)
Delay for a given number of seconds */
PHP_FUNCTION(sleep)
{
@@ -4555,18 +1935,14 @@ PHP_FUNCTION(sleep)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_LONG(num)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (num < 0) {
- php_error_docref(NULL, E_WARNING, "Number of seconds must be greater than or equal to 0");
- RETURN_FALSE;
+ zend_value_error("Number of seconds must be greater than or equal to 0");
+ RETURN_THROWS();
}
-#ifdef PHP_SLEEP_NON_VOID
- RETURN_LONG(php_sleep((unsigned int)num));
-#else
- php_sleep((unsigned int)num);
-#endif
+ RETURN_LONG(php_sleep((unsigned int)num));
}
/* }}} */
@@ -4582,10 +1958,15 @@ PHP_FUNCTION(usleep)
ZEND_PARSE_PARAMETERS_END();
if (num < 0) {
- php_error_docref(NULL, E_WARNING, "Number of microseconds must be greater than or equal to 0");
- RETURN_FALSE;
+ zend_value_error("Number of microseconds must be greater than or equal to 0");
+ RETURN_THROWS();
+ }
+ if (usleep((unsigned int)num) < 0) {
+#if ZEND_DEBUG
+ php_error_docref(NULL, E_NOTICE, "usleep() failed with errno %d: %s",
+ errno, strerror(errno));
+#endif
}
- usleep((unsigned int)num);
#endif
}
/* }}} */
@@ -4604,12 +1985,12 @@ PHP_FUNCTION(time_nanosleep)
ZEND_PARSE_PARAMETERS_END();
if (tv_sec < 0) {
- php_error_docref(NULL, E_WARNING, "The seconds value must be greater than 0");
- RETURN_FALSE;
+ zend_value_error("The seconds value must be greater than 0");
+ RETURN_THROWS();
}
if (tv_nsec < 0) {
- php_error_docref(NULL, E_WARNING, "The nanoseconds value must be greater than 0");
- RETURN_FALSE;
+ zend_value_error("The nanoseconds value must be greater than 0");
+ RETURN_THROWS();
}
php_req.tv_sec = (time_t) tv_sec;
@@ -4622,14 +2003,15 @@ PHP_FUNCTION(time_nanosleep)
add_assoc_long_ex(return_value, "nanoseconds", sizeof("nanoseconds")-1, php_rem.tv_nsec);
return;
} else if (errno == EINVAL) {
- php_error_docref(NULL, E_WARNING, "nanoseconds was not in the range 0 to 999 999 999 or seconds was negative");
+ zend_value_error("Nanoseconds was not in the range 0 to 999 999 999 or seconds was negative");
+ RETURN_THROWS();
}
RETURN_FALSE;
}
/* }}} */
-/* {{{ proto mixed time_sleep_until(float timestamp)
+/* {{{ proto bool time_sleep_until(float timestamp)
Make the script sleep until the specified time */
PHP_FUNCTION(time_sleep_until)
{
@@ -4676,9 +2058,7 @@ PHP_FUNCTION(time_sleep_until)
Get the name of the owner of the current PHP script */
PHP_FUNCTION(get_current_user)
{
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
RETURN_STRING(php_get_current_user());
}
@@ -4728,7 +2108,7 @@ static void add_config_entries(HashTable *hash, zval *return_value) /* {{{ */
}
/* }}} */
-/* {{{ proto mixed get_cfg_var(string option_name)
+/* {{{ proto string|array|false get_cfg_var(string option_name)
Get the value of a PHP configuration option */
PHP_FUNCTION(get_cfg_var)
{
@@ -4756,28 +2136,6 @@ PHP_FUNCTION(get_cfg_var)
}
/* }}} */
-/* {{{ proto int get_magic_quotes_runtime(void)
- Get the current active configuration setting of magic_quotes_runtime */
-PHP_FUNCTION(get_magic_quotes_runtime)
-{
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto int get_magic_quotes_gpc(void)
- Get the current active configuration setting of magic_quotes_gpc */
-PHP_FUNCTION(get_magic_quotes_gpc)
-{
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
- RETURN_FALSE;
-}
-/* }}} */
-
/*
1st arg = error message
2nd arg = error option
@@ -4878,9 +2236,7 @@ PHPAPI int _php_error_log_ex(int opt_err, char *message, size_t message_len, cha
Get the last occurred error as associative array. Returns NULL if there hasn't been an error yet. */
PHP_FUNCTION(error_get_last)
{
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
if (PG(last_error_message)) {
array_init(return_value);
@@ -4896,9 +2252,7 @@ PHP_FUNCTION(error_get_last)
Clear the last occurred error. */
PHP_FUNCTION(error_clear_last)
{
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
if (PG(last_error_message)) {
PG(last_error_type) = 0;
@@ -4940,7 +2294,7 @@ PHP_FUNCTION(call_user_func)
}
/* }}} */
-/* {{{ proto mixed call_user_func_array(string function_name, array parameters)
+/* {{{ proto mixed call_user_func_array(callable function, array parameters)
Call a user function which is the first parameter with the arguments contained in array
Warning: This function is special-cased by zend_compile.c and so is usually bypassed */
PHP_FUNCTION(call_user_func_array)
@@ -4984,7 +2338,7 @@ PHP_FUNCTION(forward_static_call)
if (!EX(prev_execute_data)->func->common.scope) {
zend_throw_error(NULL, "Cannot call forward_static_call() when no class scope is active");
- return;
+ RETURN_THROWS();
}
fci.retval = &retval;
@@ -5004,8 +2358,8 @@ PHP_FUNCTION(forward_static_call)
}
/* }}} */
-/* {{{ proto mixed call_user_func_array(string function_name, array parameters) U
- Call a user function which is the first parameter with the arguments contained in array */
+/* {{{ proto mixed forward_static_call_array(callable function, array parameters)
+ Call a static method which is the first parameter with the arguments contained in array */
PHP_FUNCTION(forward_static_call_array)
{
zval *params, retval;
@@ -5181,7 +2535,7 @@ PHPAPI void php_free_shutdown_functions(void) /* {{{ */
}
/* }}} */
-/* {{{ proto void register_shutdown_function(callback function) U
+/* {{{ proto false|null register_shutdown_function(callback function) U
Register a user-level function to be called on request termination */
PHP_FUNCTION(register_shutdown_function)
{
@@ -5280,7 +2634,7 @@ PHP_FUNCTION(highlight_file)
Z_PARAM_PATH(filename, filename_len)
Z_PARAM_OPTIONAL
Z_PARAM_BOOL(i)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (php_check_open_basedir(filename)) {
RETURN_FALSE;
@@ -5321,7 +2675,7 @@ PHP_FUNCTION(php_strip_whitespace)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_PATH(filename, filename_len)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_output_start_default();
@@ -5357,10 +2711,10 @@ PHP_FUNCTION(highlight_string)
Z_PARAM_ZVAL(expr)
Z_PARAM_OPTIONAL
Z_PARAM_BOOL(i)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (!try_convert_to_string(expr)) {
- return;
+ RETURN_THROWS();
}
if (i) {
@@ -5394,7 +2748,7 @@ PHP_FUNCTION(highlight_string)
}
/* }}} */
-/* {{{ proto string ini_get(string varname)
+/* {{{ proto string|false ini_get(string varname)
Get a configuration option */
PHP_FUNCTION(ini_get)
{
@@ -5424,7 +2778,7 @@ PHP_FUNCTION(ini_get)
}
/* }}} */
-/* {{{ proto array ini_get_all([string extension[, bool details = true]])
+/* {{{ proto array|false ini_get_all([string extension[, bool details = true]])
Get all configuration options */
PHP_FUNCTION(ini_get_all)
{
@@ -5438,7 +2792,7 @@ PHP_FUNCTION(ini_get_all)
ZEND_PARSE_PARAMETERS_START(0, 2)
Z_PARAM_OPTIONAL
- Z_PARAM_STRING_EX(extname, extname_len, 1, 0)
+ Z_PARAM_STRING_OR_NULL(extname, extname_len)
Z_PARAM_BOOL(details)
ZEND_PARSE_PARAMETERS_END();
@@ -5506,7 +2860,7 @@ static int php_ini_check_path(char *option_name, size_t option_len, char *new_op
}
/* }}} */
-/* {{{ proto string ini_set(string varname, string newvalue)
+/* {{{ proto string|false ini_set(string varname, string newvalue)
Set a configuration option, returns false on error and the old value of the configuration option on success */
PHP_FUNCTION(ini_set)
{
@@ -5576,7 +2930,7 @@ PHP_FUNCTION(ini_restore)
}
/* }}} */
-/* {{{ proto string set_include_path(string new_include_path)
+/* {{{ proto string|false set_include_path(string new_include_path)
Sets the include_path configuration option */
PHP_FUNCTION(set_include_path)
{
@@ -5606,15 +2960,13 @@ PHP_FUNCTION(set_include_path)
}
/* }}} */
-/* {{{ proto string get_include_path()
+/* {{{ proto string|false get_include_path()
Get the current include_path configuration option */
PHP_FUNCTION(get_include_path)
{
char *str;
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
str = zend_ini_string("include_path", sizeof("include_path") - 1, 0);
@@ -5632,9 +2984,8 @@ PHP_FUNCTION(restore_include_path)
{
zend_string *key;
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
+
key = zend_string_init("include_path", sizeof("include_path")-1, 0);
zend_restore_ini_entry(key, PHP_INI_STAGE_RUNTIME);
zend_string_efree(key);
@@ -5652,7 +3003,7 @@ PHP_FUNCTION(print_r)
Z_PARAM_ZVAL(var)
Z_PARAM_OPTIONAL
Z_PARAM_BOOL(do_return)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (do_return) {
RETURN_STR(zend_print_zval_r_to_str(var, 0));
@@ -5667,6 +3018,8 @@ PHP_FUNCTION(print_r)
Returns true if client disconnected */
PHP_FUNCTION(connection_aborted)
{
+ ZEND_PARSE_PARAMETERS_NONE();
+
RETURN_LONG(PG(connection_status) & PHP_CONNECTION_ABORTED);
}
/* }}} */
@@ -5675,6 +3028,8 @@ PHP_FUNCTION(connection_aborted)
Returns the connection status bitfield */
PHP_FUNCTION(connection_status)
{
+ ZEND_PARSE_PARAMETERS_NONE();
+
RETURN_LONG(PG(connection_status));
}
/* }}} */
@@ -5704,7 +3059,7 @@ PHP_FUNCTION(ignore_user_abort)
/* }}} */
#if HAVE_GETSERVBYNAME
-/* {{{ proto int getservbyname(string service, string protocol)
+/* {{{ proto int|false getservbyname(string service, string protocol)
Returns port associated with service. Protocol must be "tcp" or "udp" */
PHP_FUNCTION(getservbyname)
{
@@ -5747,7 +3102,7 @@ PHP_FUNCTION(getservbyname)
#endif
#if HAVE_GETSERVBYPORT
-/* {{{ proto string getservbyport(int port, string protocol)
+/* {{{ proto string|false getservbyport(int port, string protocol)
Returns service name associated with port. Protocol must be "tcp" or "udp" */
PHP_FUNCTION(getservbyport)
{
@@ -5773,7 +3128,7 @@ PHP_FUNCTION(getservbyport)
#endif
#if HAVE_GETPROTOBYNAME
-/* {{{ proto int getprotobyname(string name)
+/* {{{ proto int|false getprotobyname(string name)
Returns protocol number associated with name as per /etc/protocols */
PHP_FUNCTION(getprotobyname)
{
@@ -5797,7 +3152,7 @@ PHP_FUNCTION(getprotobyname)
#endif
#if HAVE_GETPROTOBYNUMBER
-/* {{{ proto string getprotobynumber(int proto)
+/* {{{ proto string|false getprotobynumber(int proto)
Returns protocol name associated with protocol number proto */
PHP_FUNCTION(getprotobynumber)
{
@@ -5843,9 +3198,9 @@ PHP_FUNCTION(register_tick_function)
if (!zend_is_callable(&tick_fe.arguments[0], 0, &function_name)) {
efree(tick_fe.arguments);
- php_error_docref(NULL, E_WARNING, "Invalid tick callback '%s' passed", ZSTR_VAL(function_name));
+ zend_type_error("Invalid tick callback '%s' passed", ZSTR_VAL(function_name));
zend_string_release_ex(function_name, 0);
- RETURN_FALSE;
+ RETURN_THROWS();
} else if (function_name) {
zend_string_release_ex(function_name, 0);
}
@@ -5911,7 +3266,7 @@ PHP_FUNCTION(is_uploaded_file)
}
ZEND_PARSE_PARAMETERS_START(1, 1)
- Z_PARAM_STRING(path, path_len)
+ Z_PARAM_PATH(path, path_len)
ZEND_PARSE_PARAMETERS_END();
if (zend_hash_str_exists(SG(rfc1867_uploaded_files), path, path_len)) {
@@ -6056,7 +3411,7 @@ static void php_ini_parser_cb_with_sections(zval *arg1, zval *arg2, zval *arg3,
}
/* }}} */
-/* {{{ proto array parse_ini_file(string filename [, bool process_sections [, int scanner_mode]])
+/* {{{ proto array|false parse_ini_file(string filename [, bool process_sections [, int scanner_mode]])
Parse configuration file */
PHP_FUNCTION(parse_ini_file)
{
@@ -6072,7 +3427,7 @@ PHP_FUNCTION(parse_ini_file)
Z_PARAM_OPTIONAL
Z_PARAM_BOOL(process_sections)
Z_PARAM_LONG(scanner_mode)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (filename_len == 0) {
php_error_docref(NULL, E_WARNING, "Filename cannot be empty!");
@@ -6098,7 +3453,7 @@ PHP_FUNCTION(parse_ini_file)
}
/* }}} */
-/* {{{ proto array parse_ini_string(string ini_string [, bool process_sections [, int scanner_mode]])
+/* {{{ proto array|false parse_ini_string(string ini_string [, bool process_sections [, int scanner_mode]])
Parse configuration string */
PHP_FUNCTION(parse_ini_string)
{
@@ -6113,7 +3468,7 @@ PHP_FUNCTION(parse_ini_string)
Z_PARAM_OPTIONAL
Z_PARAM_BOOL(process_sections)
Z_PARAM_LONG(scanner_mode)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (INT_MAX - str_len < ZEND_MMAP_AHEAD) {
RETVAL_FALSE;
@@ -6146,6 +3501,8 @@ PHP_FUNCTION(parse_ini_string)
* is not the same as ini_get_all() which returns only registered ini options. Only useful for devs to debug php.ini scanner/parser! */
PHP_FUNCTION(config_get_hash) /* {{{ */
{
+ ZEND_PARSE_PARAMETERS_NONE();
+
HashTable *hash = php_ini_get_configuration_hash();
array_init(return_value);
@@ -6155,15 +3512,13 @@ PHP_FUNCTION(config_get_hash) /* {{{ */
#endif
#ifdef HAVE_GETLOADAVG
-/* {{{ proto array sys_getloadavg()
+/* {{{ proto array|false sys_getloadavg()
*/
PHP_FUNCTION(sys_getloadavg)
{
double load[3];
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
if (getloadavg(load, 3) == -1) {
RETURN_FALSE;
diff --git a/ext/standard/basic_functions.h b/ext/standard/basic_functions.h
index 7e0fa6b7f0..a010db88f6 100644
--- a/ext/standard/basic_functions.h
+++ b/ext/standard/basic_functions.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -74,8 +72,6 @@ PHP_FUNCTION(set_time_limit);
PHP_FUNCTION(header_register_callback);
PHP_FUNCTION(get_cfg_var);
-PHP_FUNCTION(get_magic_quotes_runtime);
-PHP_FUNCTION(get_magic_quotes_gpc);
PHP_FUNCTION(error_log);
PHP_FUNCTION(error_get_last);
@@ -156,7 +152,7 @@ PHP_RSHUTDOWN_FUNCTION(browscap);
/* Left for BC (not binary safe!) */
PHPAPI int _php_error_log(int opt_err, char *message, char *opt, char *headers);
PHPAPI int _php_error_log_ex(int opt_err, char *message, size_t message_len, char *opt, char *headers);
-PHPAPI int php_prefix_varname(zval *result, const zval *prefix, const char *var_name, size_t var_name_len, zend_bool add_underscore);
+PHPAPI int php_prefix_varname(zval *result, zend_string *prefix, const char *var_name, size_t var_name_len, zend_bool add_underscore);
#define MT_N (624)
@@ -221,12 +217,6 @@ typedef struct _php_basic_globals {
HashTable url_adapt_session_hosts_ht;
url_adapt_state_ex_t url_adapt_output_ex;
HashTable url_adapt_output_hosts_ht;
-
-#ifdef HAVE_MMAP
- void *mmap_file;
- size_t mmap_len;
-#endif
-
HashTable *user_filter_map;
/* file.c */
diff --git a/ext/standard/basic_functions.stub.php b/ext/standard/basic_functions.stub.php
new file mode 100755
index 0000000000..2a427b8ab8
--- /dev/null
+++ b/ext/standard/basic_functions.stub.php
@@ -0,0 +1,1472 @@
+<?php
+
+/* main/main.c */
+
+function set_time_limit(int $seconds): bool {}
+
+/* main/SAPI.c */
+
+// TODO: Make this a proper callable argument?
+function header_register_callback($callback): bool {}
+
+/* main/output.c */
+
+function ob_start(
+ $user_function = null, int $chunk_size = 0, int $flags = PHP_OUTPUT_HANDLER_STDFLAGS): bool {}
+
+function ob_flush(): bool {}
+
+function ob_clean(): bool {}
+
+function ob_end_flush(): bool {}
+
+function ob_end_clean(): bool {}
+
+function ob_get_flush(): string|false {}
+
+function ob_get_clean(): string|false {}
+
+function ob_get_contents(): string|false {}
+
+function ob_get_level(): int {}
+
+function ob_get_length(): int|false {}
+
+function ob_list_handlers(): array {}
+
+function ob_get_status(bool $full_status = false): array {}
+
+// TODO: Shouldn't this be a bool argument?
+function ob_implicit_flush(int $flag = 1): void {}
+
+function output_reset_rewrite_vars(): bool {}
+
+function output_add_rewrite_var(string $name, string $value): bool {}
+
+/* main/streams/userspace.c */
+
+function stream_wrapper_register(string $protocol, string $classname, int $flags = 0): bool {}
+
+function stream_wrapper_unregister(string $protocol): bool {}
+
+function stream_wrapper_restore(string $protocol): bool {}
+
+/* array.c */
+
+function array_push(array &$stack, ...$args): int {}
+
+function krsort(array &$arg, int $sort_flags = SORT_REGULAR): bool {}
+
+function ksort(array &$arg, int $sort_flags = SORT_REGULAR): bool {}
+
+/** @param mixed $var */
+function count($var, int $mode = COUNT_NORMAL): int {}
+
+function natsort(array &$arg): bool {}
+
+function natcasesort(array &$arg): bool {}
+
+function asort(array &$arg, int $sort_flags = SORT_REGULAR): bool {}
+
+function arsort(array &$arg, int $sort_flags = SORT_REGULAR): bool {}
+
+function sort(array &$arg, int $sort_flags = SORT_REGULAR): bool {}
+
+function rsort(array &$arg, int $sort_flags = SORT_REGULAR): bool {}
+
+function usort(array &$arg, callable $cmp_function): bool {}
+
+function uasort(array &$arg, callable $cmp_function): bool {}
+
+function uksort(array &$arg, callable $cmp_function): bool {}
+
+/** @return mixed */
+function end(array|object &$arg) {}
+
+/** @return mixed */
+function prev(array|object &$arg) {}
+
+/** @return mixed */
+function next(array|object &$arg) {}
+
+/** @return mixed */
+function reset(array|object &$arg) {}
+
+/** @return mixed */
+function current(array|object $arg) {}
+
+function key(array|object $arg): int|string|null {}
+
+/** @return mixed */
+function min($arg, ...$args) {}
+
+/** @return mixed */
+function max($arg, ...$args) {}
+
+function array_walk(array|object &$input, callable $funcname, $userdata = null): bool {}
+
+function array_walk_recursive(array|object &$input, callable $funcname, $userdata = null): bool {}
+
+function in_array($needle, array $haystack, bool $strict = false): bool {}
+
+function array_search($needle, array $haystack, bool $strict = false): int|string|false {}
+
+/** @prefer-ref $arg */
+function extract(array &$arg, int $extract_type = EXTR_OVERWRITE, string $prefix = ""): int {}
+
+function compact($var_name, ...$var_names): array {}
+
+function array_fill(int $start_key, int $num, $val): array {}
+
+function array_fill_keys(array $keys, $val): array {}
+
+/**
+ * @param int|float|string $low
+ * @param int|float|string $high
+ * @param int|float $step
+ */
+function range($low, $high, $step = 1): array {}
+
+function shuffle(array &$arg): bool {}
+
+/** @return mixed */
+function array_pop(array &$stack) {}
+
+/** @return mixed */
+function array_shift(array &$stack) {}
+
+function array_unshift(array &$stack, ...$vars): int {}
+
+function array_splice(array &$arg, int $offset, ?int $length = null, $replacement = []): array {}
+
+function array_slice(array $arg, int $offset, ?int $length = null, bool $preserve_keys = false): array {}
+
+function array_merge(array ...$arrays): array {}
+
+function array_merge_recursive(array ...$arrays): array {}
+
+function array_replace(array $arr1, array ...$arrays): array {}
+
+function array_replace_recursive(array $arr1, array ...$arrays): array {}
+
+function array_keys(array $arg, $search_value = UNKNOWN, bool $strict = false): array {}
+
+function array_key_first(array $arg): int|string|null {}
+
+function array_key_last(array $arg): int|string|null {}
+
+function array_values(array $arg): array {}
+
+function array_count_values(array $arg): array {}
+
+/**
+ * @param int|string|null $column_key
+ * @param int|string|null $index_key
+ */
+function array_column(array $arg, $column_key, $index_key = null): array {}
+
+function array_reverse(array $input, bool $preserve_keys = false): array {}
+
+function array_pad(array $arg, int $pad_size, $pad_value): array {}
+
+function array_flip(array $arg): array {}
+
+function array_change_key_case(array $input, int $case = CASE_LOWER): array {}
+
+function array_unique(array $arg, int $flags = SORT_STRING): array {}
+
+function array_intersect_key(array $arr1, array $arr2, array ...$arrays): array {}
+
+function array_intersect_ukey(array $arr1, array $arr2, ...$rest): array {}
+
+function array_intersect(array $arr1, array $arr2, array ...$arrays): array {}
+
+function array_uintersect(array $arr1, array $arr2, ...$rest): array {}
+
+function array_intersect_assoc(array $arr1, array $arr2, array ...$arrays): array {}
+
+function array_uintersect_assoc(array $arr1, array $arr2, ...$rest): array {}
+
+function array_intersect_uassoc(array $arr1, array $arr2, ...$rest): array {}
+
+function array_uintersect_uassoc(array $arr1, array $arr2, ...$rest): array {}
+
+function array_diff_key(array $arr1, array $arr2, array ...$arrays): array {}
+
+function array_diff_ukey(array $arr1, array $arr2, ...$rest): array {}
+
+function array_diff(array $arr1, array $arr2, array ...$arrays): array {}
+
+function array_udiff(array $arr1, array $arr2, ...$rest): array {}
+
+function array_diff_assoc(array $arr1, array $arr2, array ...$arrays): array {}
+
+function array_diff_uassoc(array $arr1, array $arr2, ...$rest): array {}
+
+function array_udiff_assoc(array $arr1, array $arr2, ...$rest): array {}
+
+function array_udiff_uassoc(array $arr1, array $arr2, ...$rest): array {}
+
+/**
+ * @prefer-ref $arr1
+ * @prefer-ref $sort_order
+ * @prefer-ref $sort_flags
+ * @prefer-ref $arr2
+ */
+function array_multisort(&$arr1, $sort_order = SORT_ASC, $sort_flags = SORT_REGULAR, &...$arr2): bool {}
+
+function array_rand(array $arg, int $num_req = 1): int|string|array {}
+
+function array_sum(array $arg): int|float {}
+
+function array_product(array $arg): int|float {}
+
+function array_reduce(array $arg, callable $callback, $initial = null) {}
+
+function array_filter(array $arg, callable $callback = UNKNOWN, int $use_keys = 0): array {}
+
+function array_map(?callable $callback, array $arr1, array ...$arrays): array {}
+
+/** @param mixed $key */
+function array_key_exists($key, array $search): bool {}
+
+function array_chunk(array $arg, int $size, bool $preserve_keys = false): array {}
+
+function array_combine(array $keys, array $values): array {}
+
+/* base64.c */
+
+function base64_encode(string $str): string {}
+
+function base64_decode(string $str, bool $strict = false): string|false {}
+
+/* basic_functions.c */
+
+/** @return mixed */
+function constant(string $name) {}
+
+function ip2long(string $ip_address): int|false {}
+
+function long2ip(int $proper_address): string|false {}
+
+function getenv(string $variable = UNKNOWN, bool $local_only = false): string|array|false {}
+
+#ifdef HAVE_PUTENV
+function putenv(string $setting): bool {}
+#endif
+
+function getopt(string $options, array $longopts = [], &$optind = null): array|false {}
+
+function flush(): void {}
+
+function sleep(int $seconds): int {}
+
+function usleep(int $microseconds): void {}
+
+#if HAVE_NANOSLEEP
+function time_nanosleep(int $seconds, int $nanoseconds): array|bool {}
+
+function time_sleep_until(float $timestamp): bool {}
+#endif
+
+function get_current_user(): string {}
+
+function get_cfg_var(string $option_name): string|array|false {}
+
+function error_log(string $message, int $message_type = 0, string $destination = UNKNOWN, string $extra_headers = UNKNOWN): bool {}
+
+function error_get_last(): ?array {}
+
+function error_clear_last(): void {}
+
+/**
+ * @param mixed ...$args
+ * @return mixed
+ */
+function call_user_func(callable $function, ...$args) {}
+
+/** @return mixed */
+function call_user_func_array(callable $function, array $args) {}
+
+/**
+ * @param mixed ...$args
+ * @return mixed
+ */
+function forward_static_call(callable $function, ...$args) {}
+
+/** @return mixed */
+function forward_static_call_array(callable $function, array $args) {}
+
+/**
+ * @param callable $function
+ * @param mixed ...$args
+ */
+function register_shutdown_function($function, ...$args): ?bool {}
+
+function highlight_file(string $filename, bool $return = false): string|bool|null {}
+
+function php_strip_whitespace(string $filename): string {}
+
+function highlight_string(string $string, bool $return = false): string|bool|null {}
+
+function ini_get(string $varname): string|false {}
+
+function ini_get_all(?string $extension = null, bool $details = true): array|false {}
+
+function ini_set(string $varname, string $value): string|false {}
+
+function ini_restore(string $varname): void {}
+
+function set_include_path(string $include_path): string|false {}
+
+function get_include_path(): string|false {}
+
+function restore_include_path(): void {}
+
+/** @param mixed $var */
+function print_r($var, bool $return = false): string|bool {}
+
+function connection_aborted(): int {}
+
+function connection_status(): int {}
+
+function ignore_user_abort(bool $value = UNKNOWN): int {}
+
+#if HAVE_GETSERVBYNAME
+function getservbyname(string $service, string $protocol): int|false {}
+#endif
+
+#if HAVE_GETSERVBYPORT
+function getservbyport(int $port, string $protocol): string|false {}
+#endif
+
+#if HAVE_GETPROTOBYNAME
+function getprotobyname(string $name): int|false {}
+#endif
+
+#if HAVE_GETPROTOBYNUMBER
+function getprotobynumber(int $protocol): string|false {}
+#endif
+
+/** @param mixed $args */
+function register_tick_function(callable $function, ...$args): bool {}
+
+function unregister_tick_function($function): void {}
+
+function is_uploaded_file(string $path): bool {}
+
+function move_uploaded_file(string $path, string $new_path): bool {}
+
+function parse_ini_file(string $filename, bool $process_sections = false, int $scanner_mode = INI_SCANNER_NORMAL): array|false {}
+
+function parse_ini_string(string $ini_string, bool $process_sections = false, int $scanner_mode = INI_SCANNER_NORMAL): array|false {}
+
+#if ZEND_DEBUG
+function config_get_hash(string $ini_string, bool $process_sections = false, int $scanner_mode = INI_SCANNER_NORMAL): array {}
+#endif
+
+#ifdef HAVE_GETLOADAVG
+function sys_getloadavg(): array|false {}
+#endif
+
+/* browscap.c */
+
+function get_browser(?string $browser_name = null, bool $return_array = false): object|array|false {}
+
+/* crc32.c */
+
+function crc32(string $str): int {}
+
+/* crypt.c */
+
+function crypt(string $str, string $salt = UNKNOWN): string {}
+
+/* datetime.c */
+
+#if HAVE_STRPTIME
+function strptime(string $timestamp, string $format): array|false {}
+#endif
+
+/* dns.c */
+
+#ifdef HAVE_GETHOSTNAME
+function gethostname(): string|false {}
+#endif
+
+function gethostbyaddr(string $ip_address): string|false {}
+
+function gethostbyname(string $hostname): string {}
+
+function gethostbynamel(string $hostname): array|false {}
+
+#if defined(PHP_WIN32) || HAVE_DNS_SEARCH_FUNC
+function dns_check_record(string $hostname, string $type = "MX"): bool {}
+
+function dns_get_record(string $hostname, int $type = DNS_ANY, &$authns = null, &$addtl = null, bool $raw = false): array|false {}
+
+function dns_get_mx(string $hostname, &$mxhosts, &$weight = null): bool {}
+#endif
+
+/* net.c */
+
+function net_get_interfaces(): array|false {}
+
+/* ftok.c */
+
+#if HAVE_FTOK
+function ftok(string $pathname, string $proj): int {}
+#endif
+
+/* hrtime.c */
+
+function hrtime(bool $get_as_number = false): array|int|float|false {}
+
+/* lcg.c */
+
+function lcg_value(): float {}
+
+/* md5.c */
+
+function md5(string $str, bool $raw_output = false): string {}
+
+function md5_file(string $filename, bool $raw_output = false): string|false {}
+
+/* pageinfo.c */
+
+function getmyuid(): int|false {}
+
+function getmygid(): int|false {}
+
+function getmypid(): int|false {}
+
+function getmyinode(): int|false {}
+
+function getlastmod(): int {}
+
+/* sha1.c */
+
+function sha1(string $str, bool $raw_output = false): string {}
+
+function sha1_file(string $filename, bool $raw_output = false): string|false {}
+
+/* syslog.c */
+
+#ifdef HAVE_SYSLOG_H
+function openlog(string $ident, int $option, int $facility): bool {}
+
+function closelog(): bool {}
+
+function syslog(int $priority, string $message): bool {}
+#endif
+
+#ifdef HAVE_INET_NTOP
+function inet_ntop(string $in_addr): string|false {}
+#endif
+
+#ifdef HAVE_INET_PTON
+function inet_pton(string $ip_address): string|false {}
+#endif
+
+/* metaphone.c */
+
+function metaphone(string $text, int $phones = 0): string|false {}
+
+/* {{{ head.c */
+function header(string $string, bool $replace = true, int $http_response_code = 0): void {}
+
+function header_remove(string $name = UNKNOWN): void {}
+
+/** @param int|array $expires_or_options */
+function setrawcookie(string $name, string $value = '', $expires_or_options = 0, string $path = '', string $domain = '', bool $secure = false, bool $httponly = false): bool {}
+
+/** @param int|array $expires_or_options */
+function setcookie(string $name, string $value = '', $expires_or_options = 0, string $path = '', string $domain = '', bool $secure = false, bool $httponly = false): bool {}
+
+function http_response_code(int $response_code = 0): int|bool {}
+
+function headers_sent(&$file = null, &$line = null): bool {}
+
+function headers_list(): array {}
+
+/* {{{ html.c */
+
+function htmlspecialchars(string $string, int $quote_style = ENT_COMPAT, ?string $encoding = null, bool $double_encode = true): string {}
+
+function htmlspecialchars_decode(string $string, int $quote_style = ENT_COMPAT): string|false {}
+
+function html_entity_decode(string $string, int $quote_style = ENT_COMPAT, string $encoding = UNKNOWN): string|false {}
+
+function htmlentities(string $string, int $quote_style = ENT_COMPAT, ?string $encoding = null, bool $double_encode = true): string {}
+
+function get_html_translation_table(int $table = HTML_SPECIALCHARS, int $quote_style = ENT_COMPAT, string $encoding = "UTF-8"): array {}
+
+/* }}} */
+
+/* assert.c */
+
+/** @param mixed $assertion */
+function assert($assertion, $description = null): bool {}
+
+function assert_options(int $what, $value = UNKNOWN): array|object|int|string|bool|null {}
+
+/* string.c */
+
+function bin2hex(string $data): string {}
+
+function hex2bin(string $data): string|false {}
+
+function strspn(string $str, string $mask, int $start = 0, int $len = UNKNOWN): int|false {}
+
+function strcspn(string $str, string $mask, int $start = 0, int $len = UNKNOWN): int|false {}
+
+#if HAVE_NL_LANGINFO
+function nl_langinfo(int $item): string|false {}
+#endif
+
+function strcoll(string $str1, string $str2): int {}
+
+function trim(string $str, string $character_mask = " \n\r\t\v\0"): string {}
+
+function rtrim(string $str, string $character_mask = " \n\r\t\v\0"): string {}
+
+function ltrim(string $str, string $character_mask = " \n\r\t\v\0"): string {}
+
+function wordwrap(string $str, int $width = 75, string $break = "\n", bool $cut = false): string {}
+
+function explode(string $separator, string $str, int $limit = PHP_INT_MAX): array {}
+
+function implode(string|array $glue, array $pieces = UNKNOWN): string {}
+
+function strtok(string $str, string $token = UNKNOWN): string|false {}
+
+function strtoupper(string $str): string {}
+
+function strtolower(string $str): string {}
+
+function basename(string $path, string $suffix = ""): string {}
+
+function dirname(string $path, int $levels = 1): string {}
+
+function pathinfo(string $path, int $options = UNKNOWN): array|string {}
+
+function stristr(string $haystack, string $needle, bool $before_needle = false): string|false {}
+
+function strstr(string $haystack, string $needle, bool $before_needle = false): string|false {}
+
+function strpos(string $haystack, string $needle, int $offset = 0): int|false {}
+
+function stripos(string $haystack, string $needle, int $offset = 0): int|false {}
+
+function strrpos(string $haystack, string $needle, int $offset = 0): int|false {}
+
+function strripos(string $haystack, string $needle, int $offset = 0): int|false {}
+
+function strrchr(string $haystack, string $needle): string|false {}
+
+function chunk_split(string $str, int $chunklen = 76, string $ending = "\r\n"): string {}
+
+function substr(string $str, int $start, ?int $length = null): string|false {}
+
+/**
+ * @param mixed $start
+ * @param mixed $length
+ */
+function substr_replace(
+ string|array $str, string|array $replace, $start, $length = UNKNOWN): string|array|false {}
+
+function quotemeta(string $str): string {}
+
+function ord(string $character): int {}
+
+function chr(int $codepoint): string {}
+
+function ucfirst(string $str): string {}
+
+function lcfirst(string $str): string {}
+
+function ucwords(string $str, string $delimiters = " \t\r\n\f\v"): string {}
+
+function strtr(string $str, string|array $from, string $to = UNKNOWN): string {}
+
+function strrev(string $str): string {}
+
+/** @param float $percent */
+function similar_text(string $str1, string $str2, &$percent = null): int {}
+
+function addcslashes(string $str, string $charlist): string {}
+
+function addslashes(string $str): string {}
+
+function stripcslashes(string $str): string {}
+
+function stripslashes(string $str): string {}
+
+/**
+ * @param string|array $search
+ * @param string|array $replace
+ * @param int $replace_count
+ */
+function str_replace(
+ $search, $replace, string|array $subject, &$replace_count = UNKNOWN): string|array {}
+
+/**
+ * @param string|array $search
+ * @param string|array $replace
+ * @param int $replace_count
+ */
+function str_ireplace(
+ $search, $replace, string|array $subject, &$replace_count = UNKNOWN): string|array {}
+
+function hebrev(string $str, int $max_chars_per_line = 0): string {}
+
+function nl2br(string $str, bool $is_xhtml = true): string {}
+
+/** @param mixed $allowable_tags */
+function strip_tags(string $str, $allowable_tags = UNKNOWN): string {}
+
+/**
+ * @param string|array $locales
+ */
+function setlocale(int $category, $locales, ...$rest): string|false {}
+
+/** @param array $result */
+function parse_str(string $encoded_string, &$result): void {}
+
+function str_getcsv(string $string, string $delimiter = ',', string $enclosure = '"', string $escape = '\\'): array {}
+
+function str_repeat(string $input, int $mult): string {}
+
+function count_chars(string $input, int $mode = 0): array|string {}
+
+function strnatcmp(string $s1, string $s2): int {}
+
+function localeconv(): array {}
+
+function strnatcasecmp(string $s1, string $s2): int {}
+
+function substr_count(string $haystack, string $needle, int $offset = 0, ?int $length = null): int|false {}
+
+function str_pad(string $input, int $pad_length, string $pad_string = " ", int $pad_type = STR_PAD_RIGHT): string {}
+
+function sscanf(string $str, string $format, &...$vars): array|int|null {}
+
+function str_rot13(string $str): string {}
+
+function str_shuffle(string $str): string {}
+
+function str_word_count(string $str, int $format = 0, string $charlist = UNKNOWN): array|int {}
+
+function str_split(string $str, int $split_length = 1): array {}
+
+function strpbrk(string $haystack, string $char_list): string|false {}
+
+function substr_compare(string $main_str, string $str, int $offset, ?int $length = null, bool $case_insensitivity = false): int|false {}
+
+function utf8_encode(string $data): string {}
+
+function utf8_decode(string $data): string {}
+
+/* dir.c */
+
+class Directory
+{
+ /**
+ * @param resource $dir_handle
+ * @return void
+ */
+ public function close($dir_handle = UNKNOWN) {}
+
+ /**
+ * @param resource $dir_handle
+ * @return void
+ */
+ public function rewind($dir_handle = UNKNOWN) {}
+
+ /**
+ * @param resource $dir_handle
+ * @return string|false
+ */
+ public function read($dir_handle = UNKNOWN) {}
+}
+
+/**
+ * @param resource $context
+ * @return resource|false
+ */
+function opendir(string $path, $context = UNKNOWN) {}
+
+/** @param resource $context */
+function dir(string $path, $context = UNKNOWN): Directory|false {}
+
+/** @param resource $dir_handle */
+function closedir($dir_handle = UNKNOWN): void {}
+
+function chdir(string $directory): bool {}
+
+#if defined(HAVE_CHROOT) && !defined(ZTS) && ENABLE_CHROOT_FUNC
+function chroot(string $directory): bool {}
+#endif
+
+function getcwd(): string|false {}
+
+/** @param resource $dir_handle */
+function rewinddir($dir_handle = UNKNOWN): void {}
+
+function readdir($dir_handle = UNKNOWN): string|false {}
+
+/** @param resource $context */
+function scandir(string $directory, int $sorting_order = 0, $context = UNKNOWN): array|false {}
+
+#ifdef HAVE_GLOB
+function glob(string $pattern, int $flags = 0): array|false {}
+#endif
+
+/* exec.c */
+
+function exec(string $command, &$output = null, &$result_code = null): string|false {}
+
+function system(string $command, &$result_code = null): string|false {}
+
+function passthru(string $command, &$result_code = null): bool|null {}
+
+function escapeshellcmd(string $command): string {}
+
+function escapeshellarg(string $arg): string {}
+
+function shell_exec(string $command): string|false|null {}
+
+#ifdef HAVE_NICE
+function proc_nice(int $priority): bool {}
+#endif
+
+/* file.c */
+
+/** @param resource $handle */
+function flock($handle, int $operation, &$wouldblock = null): bool {}
+
+function get_meta_tags(string $filename, bool $use_include_path = false): array|false {}
+
+/** @param resource $handle */
+function pclose($handle): int {}
+
+/** @return resource|false */
+function popen(string $command, string $mode) {}
+
+/** @param resource|null $context */
+function readfile(string $filename, bool $use_include_path = false, $context = null): int|false {}
+
+/** @param resource $handle */
+function rewind($handle): bool {}
+
+/** @param resource|null $context */
+function rmdir(string $dirname, $context = null): bool {}
+
+function umask(int $mask = UNKNOWN): int {}
+
+/** @param resource $handle */
+function fclose($handle): bool {}
+
+/** @param resource $handle */
+function feof($handle): bool {}
+
+/** @param resource $handle */
+function fgetc($handle): string|false {}
+
+/** @param resource $handle */
+function fgets($handle, int $length = 1024): string|false {}
+
+/** @param resource $handle */
+function fread($handle, int $length): string|false {}
+
+/**
+ * @param resource|null $context
+ * @return resource|false
+ */
+function fopen(string $filename, string $mode, bool $use_include_path = false, $context = null) {}
+
+/**
+ * @param resource $stream
+ * @param mixed ...$args
+ */
+function fscanf($stream, string $format, &...$args): array|int|false|null {}
+
+/** @param resource $handle */
+function fpassthru($handle): int {}
+
+/** @param resource $handle */
+function ftruncate($handle, int $size): bool {}
+
+/** @param resource $handle */
+function fstat($handle): array|false {}
+
+/** @param resource $handle */
+function fseek($handle, int $offset, int $whence = SEEK_SET): int {}
+
+/** @param resource $handle */
+function ftell($handle): int|false {}
+
+/** @param resource $handle */
+function fflush($handle): bool {}
+
+/** @param resource $handle */
+function fwrite($handle, string $content, int $max_length = UNKNOWN): int|false {}
+
+/** @param resource|null $context */
+function mkdir(string $pathname, int $mode = 0777, bool $recursive = false, $context = null): bool {}
+
+/** @param resource|null $context */
+function rename(string $oldname, string $newname, $context = null): bool {}
+
+/** @param resource|null $context */
+function copy(string $source, string $dest, $context = null): bool {}
+
+function tempnam(string $dir, string $prefix): string|false {}
+
+/** @return resource|false */
+function tmpfile() {}
+
+/** @param resource|null $context */
+function file(string $filename, int $flags = 0, $context = null): array|false {}
+
+/** @param resource|null $context */
+function file_get_contents(string $filename, bool $use_include_path = false, $context = null, int $offset = 0, $maxlen = UNKNOWN): string|false {}
+
+/** @param resource|null $context */
+function unlink(string $filename, $context = null): bool {}
+
+/**
+ * @param mixed $content
+ * @param resource|null $context
+ */
+function file_put_contents(string $filename, $content, int $flags = 0, $context = null): int|false {}
+
+/** @param resource $handle */
+function fputcsv($handle, array $fields, string $delimiter = ",", string $enclosure = "\"", string $escape = "\\"): int|false {}
+
+/** @param resource $handle */
+function fgetcsv($handle, $length = UNKNOWN, string $delimiter = ",", string $enclosure = '"', string $escape = "\\"): array|false {}
+
+#if HAVE_REALPATH || defined(ZTS)
+function realpath(string $path): string|false {}
+#endif
+
+#ifdef HAVE_FNMATCH
+function fnmatch(string $pattern, string $filename, int $flags = 0): bool {}
+#endif
+
+function sys_get_temp_dir(): string {}
+
+/* filestat.c */
+
+function fileatime(string $filename): int|false {}
+
+function filectime(string $filename): int|false {}
+
+function filegroup(string $filename): int|false {}
+
+function fileinode(string $filename): int|false {}
+
+function filemtime(string $filename): int|false {}
+
+function fileowner(string $filename): int|false {}
+
+function fileperms(string $filename): int|false {}
+
+function filesize(string $filename): int|false {}
+
+function filetype(string $filename): string|false {}
+
+function file_exists(string $filename): bool {}
+
+function is_writable(string $filename): bool {}
+
+function is_writeable(string $filename): bool {}
+
+function is_readable(string $filename): bool {}
+
+function is_executable(string $filename): bool {}
+
+function is_file(string $filename): bool {}
+
+function is_dir(string $filename): bool {}
+
+function is_link(string $filename): bool {}
+
+function stat(string $filename): array|false {}
+
+function lstat(string $filename): array|false {}
+
+function chown(string $filename, $user): bool {}
+
+function chgrp(string $filename, $group): bool {}
+
+#if HAVE_LCHOWN
+function lchown(string $filename, $user): bool {}
+
+function lchgrp(string $filename, $group): bool {}
+#endif
+
+function chmod(string $filename, int $mode): bool {}
+
+#if HAVE_UTIME
+function touch(string $filename, int $time = 0, int $atime = 0): bool {}
+#endif
+
+function clearstatcache(bool $clear_realpath_cache = false, string $filename = ""): void {}
+
+function disk_total_space(string $directory): float|false {}
+
+function disk_free_space(string $directory): float|false {}
+
+function diskfreespace(string $directory): float|false {}
+
+function realpath_cache_get(): array {}
+
+function realpath_cache_size(): int {}
+
+/* formatted_print.c */
+
+/** @param mixed ...$args */
+function sprintf(string $format, ...$args): string {}
+
+/** @param mixed ...$args */
+function printf(string $format, ...$args): int {}
+
+/** @param mixed $args */
+function vprintf(string $format, $args): int {}
+
+/** @param mixed $args */
+function vsprintf(string $format, $args): string {}
+
+/**
+ * @param resource $handle
+ * @param mixed ...$args
+ */
+function fprintf($handle, string $format, ...$args): int {}
+
+/**
+ * @param resource $handle
+ * @param mixed $args
+ */
+function vfprintf($handle, string $format, $args): int {}
+
+/* fsock.c */
+
+/** @return resource|false */
+function fsockopen(string $hostname, int $port = -1, &$errno = null, &$errstr = null, float $timeout = UNKNOWN) {}
+
+/** @return resource|false */
+function pfsockopen(string $hostname, int $port = -1, &$errno = null, &$errstr = null, float $timeout = UNKNOWN) {}
+
+/* http.c */
+
+function http_build_query(array|object $data, string $numeric_prefix = "", $arg_separator = UNKNOWN, int $enc_type = PHP_QUERY_RFC1738): string|false {}
+
+/* image.c */
+
+function image_type_to_mime_type(int $image_type): string {}
+
+function image_type_to_extension(int $image_type): string|false {}
+
+function getimagesize(string $image_path, &$image_info = null): array|false {}
+
+function getimagesizefromstring(string $image, &$image_info = null): array|false {}
+
+/* info.c */
+
+function phpinfo(int $what = INFO_ALL): bool {}
+
+function phpversion(string $extension = UNKNOWN): string|false {}
+
+function phpcredits(int $flag = CREDITS_ALL): bool {}
+
+function php_sapi_name(): string|false {}
+
+function php_uname(string $mode = "a"): string {}
+
+function php_ini_scanned_files(): string|false {}
+
+function php_ini_loaded_file(): string|false {}
+
+/* iptc.c */
+
+function iptcembed(string $iptcdata, string $jpeg_file_name, int $spool = 0): string|bool {}
+
+function iptcparse(string $iptcblock): array|false {}
+
+/* levenshtein.c */
+
+function levenshtein(string $str1, string $str2, $cost_ins = UNKNOWN, int $cost_rep = UNKNOWN, int $cost_del = UNKNOWN): int {}
+
+/* link.c */
+
+#if defined(HAVE_SYMLINK) || defined(PHP_WIN32)
+function readlink(string $path): string|false {}
+
+function linkinfo(string $path): int|false {}
+
+function symlink(string $target, string $link): bool {}
+
+function link(string $target, string $link): bool {}
+#endif
+
+/* mail.c */
+
+function mail(string $to, string $subject, string $message, string|array $additional_headers = UNKNOWN, string $additional_parameters = ""): bool {}
+
+/* math.c */
+
+function abs(int|float $number): int|float {}
+
+function ceil(float $number): float {}
+
+function floor(float $number): float {}
+
+function round($number, int $precision = 0, int $mode = PHP_ROUND_HALF_UP): float {}
+
+function sin(float $number): float {}
+
+function cos(float $number): float {}
+
+function tan(float $number): float {}
+
+function asin(float $number): float {}
+
+function acos(float $number): float {}
+
+function atan(float $number): float {}
+
+function atanh(float $number): float {}
+
+function atan2(float $y, float $x): float {}
+
+function sinh(float $number): float {}
+
+function cosh(float $number): float {}
+
+function tanh(float $number): float {}
+
+function asinh(float $number): float {}
+
+function acosh(float $number): float {}
+
+function expm1(float $number): float {}
+
+function log1p(float $number): float {}
+
+function pi(): float {}
+
+function is_finite(float $number): bool {}
+
+function is_nan(float $number): bool {}
+
+function intdiv(int $dividend, int $divisor): int {}
+
+function is_infinite(float $number): bool {}
+
+/** @return mixed */
+function pow($base, $exp) {}
+
+function exp(float $number): float {}
+
+function log(float $number, float $base = M_E): float {}
+
+function log10(float $number): float {}
+
+function sqrt(float $number): float {}
+
+function hypot(float $x, float $y): float {}
+
+function deg2rad(float $number): float {}
+
+function rad2deg(float $number): float {}
+
+function bindec(string $binary_string): int|float {}
+
+function hexdec(string $hex_string): int|float {}
+
+function octdec(string $octal_string): int|float {}
+
+function decbin($number): string {}
+
+function decoct($number): string {}
+
+function dechex($number): string {}
+
+function base_convert($number, int $frombase, int $tobase): string {}
+
+function number_format(float $number, int $decimals = 0, ?string $decimal_point = "." , ?string $thousands_separator = ","): string {}
+
+function fmod(float $x, float $y): float {}
+
+function fdiv(float $dividend, float $divisor): float {}
+
+/* microtime.c */
+
+#ifdef HAVE_GETTIMEOFDAY
+function microtime(bool $get_as_float = false): string|float {}
+
+function gettimeofday(bool $return_float = false): array|float {}
+#endif
+
+#ifdef HAVE_GETRUSAGE
+function getrusage(int $who = 0): array|false {}
+#endif
+
+/* pack.c */
+
+function pack(string $format, ...$args): string|false {}
+
+function unpack(string $format, string $data, int $offset = 0): array|false {}
+
+/* password.c */
+
+function password_get_info(string $hash): ?array {}
+
+function password_hash(string $password, $algo, array $options = []): string {}
+
+function password_needs_rehash(string $hash, $algo, array $options = []): bool {}
+
+function password_verify(string $password, string $hash): bool {}
+
+function password_algos(): array {}
+
+/* proc_open.c */
+
+#ifdef PHP_CAN_SUPPORT_PROC_OPEN
+/** @return resource|false */
+function proc_open($cmd, array $descriptorspec, &$pipes, ?string $cwd = null, ?array $env = null, ?array $other_options = null) {}
+
+/** @param resource $process */
+function proc_close($process): int {}
+
+/** @param resource $process */
+function proc_terminate($process, int $signal = SIGTERM): bool {}
+
+/** @param resource $process */
+function proc_get_status($process): array {}
+#endif
+
+/* quot_print.c */
+
+function quoted_printable_decode(string $str): string {}
+
+function quoted_printable_encode(string $str): string {}
+
+/* mt_rand.c */
+
+function mt_srand(int $seed = 0, int $mode = MT_RAND_MT19937): void {}
+
+function mt_rand(int $min = 0, int $max = PHP_INT_MAX): int {}
+
+function mt_getrandmax(): int {}
+
+/* random.c */
+
+function random_bytes(int $length): string {}
+
+function random_int(int $min, int $max): int {}
+
+/* soundex.c */
+
+function soundex(string $string): string|false {}
+
+/* streamsfuncs.c */
+
+function stream_select(?array &$read, ?array &$write, ?array &$except, ?int $tv_sec, int $tv_usec = 0): int|false {}
+
+/** @return resource */
+function stream_context_create(?array $options = null, ?array $params = null) {}
+
+/** @param resource $context */
+function stream_context_set_params($context, array $params): bool {}
+
+/** @param resource $context */
+function stream_context_get_params($context): array {}
+
+/**
+ * @param resource $context
+ * @param array|string $param2
+ * @param mixed $value
+ */
+function stream_context_set_option($context, $param2, string $option_name = UNKNOWN, $value = UNKNOWN): bool {}
+
+/** @param resource $stream_or_context */
+function stream_context_get_options($stream_or_context): array {}
+
+/** @return resource */
+function stream_context_get_default(array $options = UNKNOWN) {}
+
+/** @return resource */
+function stream_context_set_default(array $options) {}
+
+/**
+ * @param resource $stream
+ * @param mixed $params
+ * @return resource|false
+ */
+function stream_filter_prepend($stream, string $filtername, int $read_write = 0, $params = UNKNOWN) {}
+
+/**
+ * @param resource $stream
+ * @param mixed $params
+ * @return resource|false
+ */
+function stream_filter_append($stream, string $filtername, int $read_write = 0, $params = UNKNOWN) {}
+
+/** @param resource $stream_filter */
+function stream_filter_remove($stream_filter): bool {}
+
+/**
+ * @param resource $context
+ * @return resource|false
+ */
+function stream_socket_client(string $remote_socket, &$errno = null, &$errstr = null, float $timeout = STREAM_CLIENT_CONNECT, int $flags = UNKNOWN, $context = null) {}
+
+/**
+ * @param resource $context
+ * @return resource|false
+ */
+function stream_socket_server(string $local_socket, &$errno = null, &$errstr = null, int $flags = STREAM_SERVER_BIND | STREAM_SERVER_LISTEN, $context = null) {}
+
+/**
+ * @param resource $server_socket
+ * @param float $timeout
+ * @return resource|false
+ */
+function stream_socket_accept($server_socket, float $timeout = UNKNOWN, &$peername = null) {}
+
+/** @param resource $handle */
+function stream_socket_get_name($handle, bool $want_peer): string|false {}
+
+/** @param resource $socket */
+function stream_socket_recvfrom($socket, int $length, int $flags = 0, &$address = null): string|false {}
+
+/** @param resource $socket */
+function stream_socket_sendto($socket, string $data, int $flags = 0, string $address = ""): int|false {}
+
+/**
+ * @param resource $stream
+ * @param resource $session_stream
+ */
+function stream_socket_enable_crypto($stream, bool $enable, ?int $crypto_type = null, $session_stream = null): int|bool {}
+
+#ifdef HAVE_SHUTDOWN
+/** @param resource $stream */
+function stream_socket_shutdown($stream, int $how): bool {}
+#endif
+
+#if HAVE_SOCKETPAIR
+function stream_socket_pair(int $domain, int $type, int $protocol): array|false {}
+#endif
+
+/**
+ * @param resource $source
+ * @param resource $dest
+ */
+function stream_copy_to_stream($source, $dest, int $maxlength = UNKNOWN, int $position = 0): int|false {}
+
+/** @param resource $handle */
+function stream_get_contents($handle, int $maxlength = UNKNOWN, int $position = -1): string|false {}
+
+/** @param resource $stream */
+function stream_supports_lock($stream): bool {}
+
+/** @param resource $stream */
+function stream_set_write_buffer($stream, int $buffer): int {}
+
+/** @param resource $stream */
+function stream_set_read_buffer($stream, int $buffer): int {}
+
+/** @param resource $stream */
+function stream_set_blocking($stream, bool $mode): bool {}
+
+/** @param resource $stream */
+function stream_get_meta_data($stream): array {}
+
+/** @param resource $handle */
+function stream_get_line($handle, int $max_length, string $ending = ""): string|false {}
+
+function stream_resolve_include_path(string $filename): string|false {}
+
+function stream_get_wrappers(): array|false {}
+
+function stream_get_transports(): array|false {}
+
+/** @param mixed $stream */
+function stream_is_local($stream): bool {}
+
+/** @param resource $stream */
+function stream_isatty($stream): bool {}
+
+#ifdef PHP_WIN32
+/** @param resource $stream */
+function sapi_windows_vt100_support($stream, bool $enable): bool {}
+#endif
+
+/** @param resource $stream */
+function stream_set_chunk_size($stream, int $size): int {}
+
+#if HAVE_SYS_TIME_H || defined(PHP_WIN32)
+/** @param resource $socket */
+function stream_set_timeout($socket, int $seconds, int $microseconds = 0): bool {}
+#endif
+
+/* type.c */
+
+/** @param mixed $var */
+function gettype($var): string {}
+
+function settype(&$var, string $type): bool {}
+
+/** @param mixed $value */
+function intval($value, int $base = 10): int {}
+
+/** @param mixed $value */
+function floatval($value): float {}
+
+/** @param mixed $value */
+function boolval($value): bool {}
+
+/** @param mixed $value */
+function strval($value): string {}
+
+/** @param mixed $value */
+function is_null($value): bool {}
+
+/** @param mixed $value */
+function is_resource($value): bool {}
+
+/** @param mixed $value */
+function is_bool($value): bool {}
+
+/** @param mixed $value */
+function is_int($value): bool {}
+
+/** @param mixed $value */
+function is_float($value): bool {}
+
+/** @param mixed $value */
+function is_numeric($value): bool {}
+
+/** @param mixed $value */
+function is_string($value): bool {}
+
+/** @param mixed $value */
+function is_array($value): bool {}
+
+/** @param mixed $value */
+function is_object($value): bool {}
+
+/** @param mixed $value */
+function is_scalar($value): bool {}
+
+/** @param mixed $value */
+function is_callable($value, bool $syntax_only = false, &$callable_name = null) {}
+
+/** @param mixed $value */
+function is_iterable($value): bool {}
+
+/** @param mixed $value */
+function is_countable($value): bool {}
+
+/* uniqid.c */
+
+#ifdef HAVE_GETTIMEOFDAY
+function uniqid(string $prefix = "", bool $more_entropy = false): string {}
+#endif
+
+/* url.c */
+
+/** @return mixed */
+function parse_url(string $url, int $component = -1) {}
+
+function urlencode(string $string): string {}
+
+function urldecode(string $string): string {}
+
+function rawurlencode(string $string): string {}
+
+function rawurldecode(string $string): string {}
+
+/** @param resource $context */
+function get_headers(string $url, int $format = 0, $context = null): array|false {}
+
+/* user_filters.c */
+
+class php_user_filter {
+ public function filter($in, $out, &$consumed, $closing) {}
+
+ /** @return void */
+ public function onCreate() {}
+
+ /** @return void */
+ public function onClose() {}
+}
+
+/** @param resource $brigade */
+function stream_bucket_make_writeable($brigade): ?object {}
+
+/** @param resource $brigade */
+function stream_bucket_prepend($brigade, object $bucket): void {}
+
+/** @param resource $brigade */
+function stream_bucket_append($brigade, object $bucket): void {}
+
+/** @param resource $stream */
+function stream_bucket_new($stream, string $buffer): object|false {}
+
+function stream_get_filters(): array {}
+
+function stream_filter_register(string $filtername, string $classname): bool {}
+
+/* uuencode.c */
+
+function convert_uuencode(string $data): string|false {}
+
+function convert_uudecode(string $data): string|false {}
+
+/* var.c */
+
+/** @param mixed $value */
+function var_dump($value, ...$value): void {}
+
+/** @param mixed $value */
+function var_export($value, bool $return = false): ?string {}
+
+/** @param mixed $value */
+function debug_zval_dump($value, ...$value): void {}
+
+/** @param mixed $value */
+function serialize($value): string {}
+
+/** @return mixed */
+function unserialize(string $value, array $options = []) {}
+
+function memory_get_usage(bool $real_usage = false): int {}
+
+function memory_get_peak_usage(bool $real_usage = false): int {}
+
+/* versioning.c */
+
+function version_compare(string $version1, string $version2, string $operator = UNKNOWN): int|bool {}
+
+/* win32/codepage.c */
+
+function sapi_windows_cp_set(int $cp): bool {}
+
+function sapi_windows_cp_get(string $kind = UNKNOWN): int {}
+
+/**
+ * @param int|string $in_codepage
+ * @param int|string $out_codepage
+ */
+function sapi_windows_cp_conv($in_codepage, $out_codepage, string $subject) {}
+
+function sapi_windows_cp_is_utf8(): bool {}
+
+/** @param callable|null $handler */
+function sapi_windows_set_ctrl_handler($handler, bool $add = true): bool {}
+
+/** @param callable|null $handler */
+function sapi_windows_generate_ctrl_event(int $event, int $pid = 0): bool {}
diff --git a/ext/standard/basic_functions_arginfo.h b/ext/standard/basic_functions_arginfo.h
new file mode 100755
index 0000000000..93e2a5bda6
--- /dev/null
+++ b/ext/standard/basic_functions_arginfo.h
@@ -0,0 +1,2186 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_set_time_limit, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_header_register_callback, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, callback)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ob_start, 0, 0, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, user_function)
+ ZEND_ARG_TYPE_INFO(0, chunk_size, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ob_flush, 0, 0, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_ob_clean arginfo_ob_flush
+
+#define arginfo_ob_end_flush arginfo_ob_flush
+
+#define arginfo_ob_end_clean arginfo_ob_flush
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ob_get_flush, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
+ZEND_END_ARG_INFO()
+
+#define arginfo_ob_get_clean arginfo_ob_get_flush
+
+#define arginfo_ob_get_contents arginfo_ob_get_flush
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ob_get_level, 0, 0, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ob_get_length, 0, 0, MAY_BE_LONG|MAY_BE_FALSE)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ob_list_handlers, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ob_get_status, 0, 0, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, full_status, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ob_implicit_flush, 0, 0, IS_VOID, 0)
+ ZEND_ARG_TYPE_INFO(0, flag, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_output_reset_rewrite_vars arginfo_ob_flush
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_output_add_rewrite_var, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stream_wrapper_register, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, protocol, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, classname, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stream_wrapper_unregister, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, protocol, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_stream_wrapper_restore arginfo_stream_wrapper_unregister
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_push, 0, 1, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(1, stack, IS_ARRAY, 0)
+ ZEND_ARG_VARIADIC_INFO(0, args)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_krsort, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(1, arg, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, sort_flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_ksort arginfo_krsort
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_count, 0, 1, IS_LONG, 0)
+ ZEND_ARG_INFO(0, var)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_natsort, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(1, arg, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_natcasesort arginfo_natsort
+
+#define arginfo_asort arginfo_krsort
+
+#define arginfo_arsort arginfo_krsort
+
+#define arginfo_sort arginfo_krsort
+
+#define arginfo_rsort arginfo_krsort
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_usort, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(1, arg, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, cmp_function, IS_CALLABLE, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_uasort arginfo_usort
+
+#define arginfo_uksort arginfo_usort
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_end, 0, 0, 1)
+ ZEND_ARG_TYPE_MASK(1, arg, MAY_BE_ARRAY|MAY_BE_OBJECT)
+ZEND_END_ARG_INFO()
+
+#define arginfo_prev arginfo_end
+
+#define arginfo_next arginfo_end
+
+#define arginfo_reset arginfo_end
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_current, 0, 0, 1)
+ ZEND_ARG_TYPE_MASK(0, arg, MAY_BE_ARRAY|MAY_BE_OBJECT)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_key, 0, 1, MAY_BE_LONG|MAY_BE_STRING|MAY_BE_NULL)
+ ZEND_ARG_TYPE_MASK(0, arg, MAY_BE_ARRAY|MAY_BE_OBJECT)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_min, 0, 0, 1)
+ ZEND_ARG_INFO(0, arg)
+ ZEND_ARG_VARIADIC_INFO(0, args)
+ZEND_END_ARG_INFO()
+
+#define arginfo_max arginfo_min
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_walk, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_MASK(1, input, MAY_BE_ARRAY|MAY_BE_OBJECT)
+ ZEND_ARG_TYPE_INFO(0, funcname, IS_CALLABLE, 0)
+ ZEND_ARG_INFO(0, userdata)
+ZEND_END_ARG_INFO()
+
+#define arginfo_array_walk_recursive arginfo_array_walk
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_in_array, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, needle)
+ ZEND_ARG_TYPE_INFO(0, haystack, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, strict, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_array_search, 0, 2, MAY_BE_LONG|MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, needle)
+ ZEND_ARG_TYPE_INFO(0, haystack, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, strict, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_extract, 0, 1, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(ZEND_SEND_PREFER_REF, arg, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, extract_type, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, prefix, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_compact, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_INFO(0, var_name)
+ ZEND_ARG_VARIADIC_INFO(0, var_names)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_fill, 0, 3, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, start_key, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, num, IS_LONG, 0)
+ ZEND_ARG_INFO(0, val)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_fill_keys, 0, 2, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, keys, IS_ARRAY, 0)
+ ZEND_ARG_INFO(0, val)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_range, 0, 2, IS_ARRAY, 0)
+ ZEND_ARG_INFO(0, low)
+ ZEND_ARG_INFO(0, high)
+ ZEND_ARG_INFO(0, step)
+ZEND_END_ARG_INFO()
+
+#define arginfo_shuffle arginfo_natsort
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_array_pop, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(1, stack, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_array_shift arginfo_array_pop
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_unshift, 0, 1, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(1, stack, IS_ARRAY, 0)
+ ZEND_ARG_VARIADIC_INFO(0, vars)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_splice, 0, 2, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(1, arg, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 1)
+ ZEND_ARG_INFO(0, replacement)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_slice, 0, 2, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, arg, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 1)
+ ZEND_ARG_TYPE_INFO(0, preserve_keys, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_merge, 0, 0, IS_ARRAY, 0)
+ ZEND_ARG_VARIADIC_TYPE_INFO(0, arrays, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_array_merge_recursive arginfo_array_merge
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_replace, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, arr1, IS_ARRAY, 0)
+ ZEND_ARG_VARIADIC_TYPE_INFO(0, arrays, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_array_replace_recursive arginfo_array_replace
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_keys, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, arg, IS_ARRAY, 0)
+ ZEND_ARG_INFO(0, search_value)
+ ZEND_ARG_TYPE_INFO(0, strict, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_array_key_first, 0, 1, MAY_BE_LONG|MAY_BE_STRING|MAY_BE_NULL)
+ ZEND_ARG_TYPE_INFO(0, arg, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_array_key_last arginfo_array_key_first
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_values, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, arg, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_array_count_values arginfo_array_values
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_column, 0, 2, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, arg, IS_ARRAY, 0)
+ ZEND_ARG_INFO(0, column_key)
+ ZEND_ARG_INFO(0, index_key)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_reverse, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, input, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, preserve_keys, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_pad, 0, 3, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, arg, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, pad_size, IS_LONG, 0)
+ ZEND_ARG_INFO(0, pad_value)
+ZEND_END_ARG_INFO()
+
+#define arginfo_array_flip arginfo_array_values
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_change_key_case, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, input, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, case, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_unique, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, arg, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_intersect_key, 0, 2, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, arr1, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, arr2, IS_ARRAY, 0)
+ ZEND_ARG_VARIADIC_TYPE_INFO(0, arrays, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_intersect_ukey, 0, 2, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, arr1, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, arr2, IS_ARRAY, 0)
+ ZEND_ARG_VARIADIC_INFO(0, rest)
+ZEND_END_ARG_INFO()
+
+#define arginfo_array_intersect arginfo_array_intersect_key
+
+#define arginfo_array_uintersect arginfo_array_intersect_ukey
+
+#define arginfo_array_intersect_assoc arginfo_array_intersect_key
+
+#define arginfo_array_uintersect_assoc arginfo_array_intersect_ukey
+
+#define arginfo_array_intersect_uassoc arginfo_array_intersect_ukey
+
+#define arginfo_array_uintersect_uassoc arginfo_array_intersect_ukey
+
+#define arginfo_array_diff_key arginfo_array_intersect_key
+
+#define arginfo_array_diff_ukey arginfo_array_intersect_ukey
+
+#define arginfo_array_diff arginfo_array_intersect_key
+
+#define arginfo_array_udiff arginfo_array_intersect_ukey
+
+#define arginfo_array_diff_assoc arginfo_array_intersect_key
+
+#define arginfo_array_diff_uassoc arginfo_array_intersect_ukey
+
+#define arginfo_array_udiff_assoc arginfo_array_intersect_ukey
+
+#define arginfo_array_udiff_uassoc arginfo_array_intersect_ukey
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_multisort, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, arr1)
+ ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, sort_order)
+ ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, sort_flags)
+ ZEND_ARG_VARIADIC_INFO(ZEND_SEND_PREFER_REF, arr2)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_array_rand, 0, 1, MAY_BE_LONG|MAY_BE_STRING|MAY_BE_ARRAY)
+ ZEND_ARG_TYPE_INFO(0, arg, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, num_req, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_array_sum, 0, 1, MAY_BE_LONG|MAY_BE_DOUBLE)
+ ZEND_ARG_TYPE_INFO(0, arg, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_array_product arginfo_array_sum
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_array_reduce, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, arg, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, callback, IS_CALLABLE, 0)
+ ZEND_ARG_INFO(0, initial)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_filter, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, arg, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, callback, IS_CALLABLE, 0)
+ ZEND_ARG_TYPE_INFO(0, use_keys, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_map, 0, 2, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, callback, IS_CALLABLE, 1)
+ ZEND_ARG_TYPE_INFO(0, arr1, IS_ARRAY, 0)
+ ZEND_ARG_VARIADIC_TYPE_INFO(0, arrays, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_key_exists, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, key)
+ ZEND_ARG_TYPE_INFO(0, search, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_chunk, 0, 2, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, arg, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, size, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, preserve_keys, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_array_combine, 0, 2, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, keys, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, values, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_base64_encode, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_base64_decode, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, strict, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_constant, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ip2long, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, ip_address, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_long2ip, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, proper_address, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_getenv, 0, 0, MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, variable, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, local_only, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_PUTENV)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_putenv, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, setting, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_getopt, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, options, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, longopts, IS_ARRAY, 0)
+ ZEND_ARG_INFO(1, optind)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_flush, 0, 0, IS_VOID, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sleep, 0, 1, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_usleep, 0, 1, IS_VOID, 0)
+ ZEND_ARG_TYPE_INFO(0, microseconds, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#if HAVE_NANOSLEEP
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_time_nanosleep, 0, 2, MAY_BE_ARRAY|MAY_BE_BOOL)
+ ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, nanoseconds, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if HAVE_NANOSLEEP
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_time_sleep_until, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, timestamp, IS_DOUBLE, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_get_current_user, 0, 0, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_get_cfg_var, 0, 1, MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, option_name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_error_log, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, message, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, message_type, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, destination, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, extra_headers, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_error_get_last, 0, 0, IS_ARRAY, 1)
+ZEND_END_ARG_INFO()
+
+#define arginfo_error_clear_last arginfo_flush
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_call_user_func, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, function, IS_CALLABLE, 0)
+ ZEND_ARG_VARIADIC_INFO(0, args)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_call_user_func_array, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, function, IS_CALLABLE, 0)
+ ZEND_ARG_TYPE_INFO(0, args, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_forward_static_call arginfo_call_user_func
+
+#define arginfo_forward_static_call_array arginfo_call_user_func_array
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_register_shutdown_function, 0, 1, _IS_BOOL, 1)
+ ZEND_ARG_INFO(0, function)
+ ZEND_ARG_VARIADIC_INFO(0, args)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_highlight_file, 0, 1, MAY_BE_STRING|MAY_BE_BOOL|MAY_BE_NULL)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, return, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_php_strip_whitespace, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_highlight_string, 0, 1, MAY_BE_STRING|MAY_BE_BOOL|MAY_BE_NULL)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, return, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ini_get, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, varname, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ini_get_all, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, extension, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, details, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ini_set, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, varname, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ini_restore, 0, 1, IS_VOID, 0)
+ ZEND_ARG_TYPE_INFO(0, varname, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_set_include_path, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, include_path, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_get_include_path arginfo_ob_get_flush
+
+#define arginfo_restore_include_path arginfo_flush
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_print_r, 0, 1, MAY_BE_STRING|MAY_BE_BOOL)
+ ZEND_ARG_INFO(0, var)
+ ZEND_ARG_TYPE_INFO(0, return, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_connection_aborted arginfo_ob_get_level
+
+#define arginfo_connection_status arginfo_ob_get_level
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ignore_user_abort, 0, 0, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, value, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#if HAVE_GETSERVBYNAME
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_getservbyname, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, service, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, protocol, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if HAVE_GETSERVBYPORT
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_getservbyport, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, port, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, protocol, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if HAVE_GETPROTOBYNAME
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_getprotobyname, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if HAVE_GETPROTOBYNUMBER
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_getprotobynumber, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, protocol, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_register_tick_function, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, function, IS_CALLABLE, 0)
+ ZEND_ARG_VARIADIC_INFO(0, args)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_unregister_tick_function, 0, 1, IS_VOID, 0)
+ ZEND_ARG_INFO(0, function)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_is_uploaded_file, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_move_uploaded_file, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, new_path, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_parse_ini_file, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, process_sections, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, scanner_mode, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_parse_ini_string, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, ini_string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, process_sections, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, scanner_mode, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#if ZEND_DEBUG
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_config_get_hash, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, ini_string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, process_sections, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, scanner_mode, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_GETLOADAVG)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_sys_getloadavg, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_get_browser, 0, 0, MAY_BE_OBJECT|MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, browser_name, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, return_array, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_crc32, 0, 1, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_crypt, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, salt, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#if HAVE_STRPTIME
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_strptime, 0, 2, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, timestamp, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_GETHOSTNAME)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_gethostname, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_gethostbyaddr, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, ip_address, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_gethostbyname, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, hostname, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_gethostbynamel, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, hostname, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(PHP_WIN32) || HAVE_DNS_SEARCH_FUNC
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_dns_check_record, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, hostname, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, type, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(PHP_WIN32) || HAVE_DNS_SEARCH_FUNC
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_dns_get_record, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, hostname, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+ ZEND_ARG_INFO(1, authns)
+ ZEND_ARG_INFO(1, addtl)
+ ZEND_ARG_TYPE_INFO(0, raw, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(PHP_WIN32) || HAVE_DNS_SEARCH_FUNC
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_dns_get_mx, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, hostname, IS_STRING, 0)
+ ZEND_ARG_INFO(1, mxhosts)
+ ZEND_ARG_INFO(1, weight)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_net_get_interfaces, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE)
+ZEND_END_ARG_INFO()
+
+#if HAVE_FTOK
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftok, 0, 2, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, pathname, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, proj, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_hrtime, 0, 0, MAY_BE_ARRAY|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, get_as_number, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_lcg_value, 0, 0, IS_DOUBLE, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_md5, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, raw_output, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_md5_file, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, raw_output, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_getmyuid arginfo_ob_get_length
+
+#define arginfo_getmygid arginfo_ob_get_length
+
+#define arginfo_getmypid arginfo_ob_get_length
+
+#define arginfo_getmyinode arginfo_ob_get_length
+
+#define arginfo_getlastmod arginfo_ob_get_level
+
+#define arginfo_sha1 arginfo_md5
+
+#define arginfo_sha1_file arginfo_md5_file
+
+#if defined(HAVE_SYSLOG_H)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_openlog, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, ident, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, facility, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_SYSLOG_H)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_closelog, 0, 0, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_SYSLOG_H)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_syslog, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, priority, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, message, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_INET_NTOP)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_inet_ntop, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, in_addr, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_INET_PTON)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_inet_pton, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, ip_address, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_metaphone, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, text, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, phones, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_header, 0, 1, IS_VOID, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, replace, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, http_response_code, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_header_remove, 0, 0, IS_VOID, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_setrawcookie, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
+ ZEND_ARG_INFO(0, expires_or_options)
+ ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, domain, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, secure, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, httponly, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_setcookie arginfo_setrawcookie
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_http_response_code, 0, 0, MAY_BE_LONG|MAY_BE_BOOL)
+ ZEND_ARG_TYPE_INFO(0, response_code, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_headers_sent, 0, 0, _IS_BOOL, 0)
+ ZEND_ARG_INFO(1, file)
+ ZEND_ARG_INFO(1, line)
+ZEND_END_ARG_INFO()
+
+#define arginfo_headers_list arginfo_ob_list_handlers
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_htmlspecialchars, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, quote_style, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, double_encode, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_htmlspecialchars_decode, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, quote_style, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_html_entity_decode, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, quote_style, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_htmlentities arginfo_htmlspecialchars
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_get_html_translation_table, 0, 0, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, table, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, quote_style, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_assert, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, assertion)
+ ZEND_ARG_INFO(0, description)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_assert_options, 0, 1, MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_LONG|MAY_BE_STRING|MAY_BE_BOOL|MAY_BE_NULL)
+ ZEND_ARG_TYPE_INFO(0, what, IS_LONG, 0)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_bin2hex, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_hex2bin, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_strspn, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mask, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, start, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, len, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_strcspn arginfo_strspn
+
+#if HAVE_NL_LANGINFO
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_nl_langinfo, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, item, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_strcoll, 0, 2, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, str1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, str2, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_trim, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, character_mask, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_rtrim arginfo_trim
+
+#define arginfo_ltrim arginfo_trim
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_wordwrap, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, width, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, break, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, cut, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_explode, 0, 2, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, separator, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, limit, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_implode, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_MASK(0, glue, MAY_BE_STRING|MAY_BE_ARRAY)
+ ZEND_ARG_TYPE_INFO(0, pieces, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_strtok, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, token, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_strtoupper arginfo_base64_encode
+
+#define arginfo_strtolower arginfo_base64_encode
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_basename, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, suffix, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_dirname, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, levels, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pathinfo, 0, 1, MAY_BE_ARRAY|MAY_BE_STRING)
+ ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_stristr, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, haystack, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, needle, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, before_needle, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_strstr arginfo_stristr
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_strpos, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, haystack, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, needle, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_stripos arginfo_strpos
+
+#define arginfo_strrpos arginfo_strpos
+
+#define arginfo_strripos arginfo_strpos
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_strrchr, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, haystack, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, needle, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_chunk_split, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, chunklen, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, ending, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_substr, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, start, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_substr_replace, 0, 3, MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_MASK(0, str, MAY_BE_STRING|MAY_BE_ARRAY)
+ ZEND_ARG_TYPE_MASK(0, replace, MAY_BE_STRING|MAY_BE_ARRAY)
+ ZEND_ARG_INFO(0, start)
+ ZEND_ARG_INFO(0, length)
+ZEND_END_ARG_INFO()
+
+#define arginfo_quotemeta arginfo_base64_encode
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ord, 0, 1, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, character, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_chr, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, codepoint, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_ucfirst arginfo_base64_encode
+
+#define arginfo_lcfirst arginfo_base64_encode
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ucwords, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, delimiters, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_strtr, 0, 2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_MASK(0, from, MAY_BE_STRING|MAY_BE_ARRAY)
+ ZEND_ARG_TYPE_INFO(0, to, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_strrev arginfo_base64_encode
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_similar_text, 0, 2, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, str1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, str2, IS_STRING, 0)
+ ZEND_ARG_INFO(1, percent)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_addcslashes, 0, 2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, charlist, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_addslashes arginfo_base64_encode
+
+#define arginfo_stripcslashes arginfo_base64_encode
+
+#define arginfo_stripslashes arginfo_base64_encode
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_str_replace, 0, 3, MAY_BE_STRING|MAY_BE_ARRAY)
+ ZEND_ARG_INFO(0, search)
+ ZEND_ARG_INFO(0, replace)
+ ZEND_ARG_TYPE_MASK(0, subject, MAY_BE_STRING|MAY_BE_ARRAY)
+ ZEND_ARG_INFO(1, replace_count)
+ZEND_END_ARG_INFO()
+
+#define arginfo_str_ireplace arginfo_str_replace
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hebrev, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, max_chars_per_line, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_nl2br, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, is_xhtml, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_strip_tags, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_INFO(0, allowable_tags)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_setlocale, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, category, IS_LONG, 0)
+ ZEND_ARG_INFO(0, locales)
+ ZEND_ARG_VARIADIC_INFO(0, rest)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_parse_str, 0, 2, IS_VOID, 0)
+ ZEND_ARG_TYPE_INFO(0, encoded_string, IS_STRING, 0)
+ ZEND_ARG_INFO(1, result)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_str_getcsv, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, delimiter, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, enclosure, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, escape, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_str_repeat, 0, 2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, input, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mult, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_count_chars, 0, 1, MAY_BE_ARRAY|MAY_BE_STRING)
+ ZEND_ARG_TYPE_INFO(0, input, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_strnatcmp, 0, 2, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, s1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, s2, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_localeconv arginfo_ob_list_handlers
+
+#define arginfo_strnatcasecmp arginfo_strnatcmp
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_substr_count, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, haystack, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, needle, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_str_pad, 0, 2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, input, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, pad_length, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, pad_string, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, pad_type, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_sscanf, 0, 2, MAY_BE_ARRAY|MAY_BE_LONG|MAY_BE_NULL)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0)
+ ZEND_ARG_VARIADIC_INFO(1, vars)
+ZEND_END_ARG_INFO()
+
+#define arginfo_str_rot13 arginfo_base64_encode
+
+#define arginfo_str_shuffle arginfo_base64_encode
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_str_word_count, 0, 1, MAY_BE_ARRAY|MAY_BE_LONG)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, format, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, charlist, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_str_split, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, split_length, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_strpbrk, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, haystack, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, char_list, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_substr_compare, 0, 3, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, main_str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 1)
+ ZEND_ARG_TYPE_INFO(0, case_insensitivity, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_utf8_encode arginfo_bin2hex
+
+#define arginfo_utf8_decode arginfo_bin2hex
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Directory_close, 0, 0, 0)
+ ZEND_ARG_INFO(0, dir_handle)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_Directory_rewind arginfo_class_Directory_close
+
+#define arginfo_class_Directory_read arginfo_class_Directory_close
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_opendir, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
+ ZEND_ARG_INFO(0, context)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_dir, 0, 1, Directory, MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
+ ZEND_ARG_INFO(0, context)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_closedir, 0, 0, IS_VOID, 0)
+ ZEND_ARG_INFO(0, dir_handle)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_chdir, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, directory, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_CHROOT) && !defined(ZTS) && ENABLE_CHROOT_FUNC
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_chroot, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, directory, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#define arginfo_getcwd arginfo_ob_get_flush
+
+#define arginfo_rewinddir arginfo_closedir
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_readdir, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, dir_handle)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_scandir, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, directory, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, sorting_order, IS_LONG, 0)
+ ZEND_ARG_INFO(0, context)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_GLOB)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_glob, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_exec, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, command, IS_STRING, 0)
+ ZEND_ARG_INFO(1, output)
+ ZEND_ARG_INFO(1, result_code)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_system, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, command, IS_STRING, 0)
+ ZEND_ARG_INFO(1, result_code)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_passthru, 0, 1, _IS_BOOL, 1)
+ ZEND_ARG_TYPE_INFO(0, command, IS_STRING, 0)
+ ZEND_ARG_INFO(1, result_code)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_escapeshellcmd, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, command, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_escapeshellarg, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, arg, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_shell_exec, 0, 1, MAY_BE_STRING|MAY_BE_FALSE|MAY_BE_NULL)
+ ZEND_ARG_TYPE_INFO(0, command, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_NICE)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_proc_nice, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, priority, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_flock, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, handle)
+ ZEND_ARG_TYPE_INFO(0, operation, IS_LONG, 0)
+ ZEND_ARG_INFO(1, wouldblock)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_get_meta_tags, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, use_include_path, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pclose, 0, 1, IS_LONG, 0)
+ ZEND_ARG_INFO(0, handle)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_popen, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, command, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_readfile, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, use_include_path, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, context)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_rewind, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, handle)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_rmdir, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, dirname, IS_STRING, 0)
+ ZEND_ARG_INFO(0, context)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_umask, 0, 0, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, mask, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_fclose arginfo_rewind
+
+#define arginfo_feof arginfo_rewind
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_fgetc, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, handle)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_fgets, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, handle)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_fread, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, handle)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_fopen, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, use_include_path, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, context)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_fscanf, 0, 2, MAY_BE_ARRAY|MAY_BE_LONG|MAY_BE_FALSE|MAY_BE_NULL)
+ ZEND_ARG_INFO(0, stream)
+ ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0)
+ ZEND_ARG_VARIADIC_INFO(1, args)
+ZEND_END_ARG_INFO()
+
+#define arginfo_fpassthru arginfo_pclose
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftruncate, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, handle)
+ ZEND_ARG_TYPE_INFO(0, size, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_fstat, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, handle)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_fseek, 0, 2, IS_LONG, 0)
+ ZEND_ARG_INFO(0, handle)
+ ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, whence, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ftell, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, handle)
+ZEND_END_ARG_INFO()
+
+#define arginfo_fflush arginfo_rewind
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_fwrite, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, handle)
+ ZEND_ARG_TYPE_INFO(0, content, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, max_length, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mkdir, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, pathname, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, recursive, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, context)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_rename, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, oldname, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, newname, IS_STRING, 0)
+ ZEND_ARG_INFO(0, context)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_copy, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, source, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, dest, IS_STRING, 0)
+ ZEND_ARG_INFO(0, context)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_tempnam, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, dir, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, prefix, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_tmpfile, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_file, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ ZEND_ARG_INFO(0, context)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_file_get_contents, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, use_include_path, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, context)
+ ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
+ ZEND_ARG_INFO(0, maxlen)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_unlink, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_INFO(0, context)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_file_put_contents, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_INFO(0, content)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ ZEND_ARG_INFO(0, context)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_fputcsv, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, handle)
+ ZEND_ARG_TYPE_INFO(0, fields, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, delimiter, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, enclosure, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, escape, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_fgetcsv, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, handle)
+ ZEND_ARG_INFO(0, length)
+ ZEND_ARG_TYPE_INFO(0, delimiter, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, enclosure, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, escape, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#if HAVE_REALPATH || defined(ZTS)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_realpath, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_FNMATCH)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_fnmatch, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#define arginfo_sys_get_temp_dir arginfo_get_current_user
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_fileatime, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_filectime arginfo_fileatime
+
+#define arginfo_filegroup arginfo_fileatime
+
+#define arginfo_fileinode arginfo_fileatime
+
+#define arginfo_filemtime arginfo_fileatime
+
+#define arginfo_fileowner arginfo_fileatime
+
+#define arginfo_fileperms arginfo_fileatime
+
+#define arginfo_filesize arginfo_fileatime
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_filetype, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_file_exists, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_is_writable arginfo_file_exists
+
+#define arginfo_is_writeable arginfo_file_exists
+
+#define arginfo_is_readable arginfo_file_exists
+
+#define arginfo_is_executable arginfo_file_exists
+
+#define arginfo_is_file arginfo_file_exists
+
+#define arginfo_is_dir arginfo_file_exists
+
+#define arginfo_is_link arginfo_file_exists
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_stat, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_lstat arginfo_stat
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_chown, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_INFO(0, user)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_chgrp, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_INFO(0, group)
+ZEND_END_ARG_INFO()
+
+#if HAVE_LCHOWN
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_lchown, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_INFO(0, user)
+ZEND_END_ARG_INFO()
+#endif
+
+#if HAVE_LCHOWN
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_lchgrp, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_INFO(0, group)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_chmod, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#if HAVE_UTIME
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_touch, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, time, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, atime, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_clearstatcache, 0, 0, IS_VOID, 0)
+ ZEND_ARG_TYPE_INFO(0, clear_realpath_cache, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_disk_total_space, 0, 1, MAY_BE_DOUBLE|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, directory, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_disk_free_space arginfo_disk_total_space
+
+#define arginfo_diskfreespace arginfo_disk_total_space
+
+#define arginfo_realpath_cache_get arginfo_ob_list_handlers
+
+#define arginfo_realpath_cache_size arginfo_ob_get_level
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sprintf, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0)
+ ZEND_ARG_VARIADIC_INFO(0, args)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_printf, 0, 1, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0)
+ ZEND_ARG_VARIADIC_INFO(0, args)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_vprintf, 0, 2, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0)
+ ZEND_ARG_INFO(0, args)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_vsprintf, 0, 2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0)
+ ZEND_ARG_INFO(0, args)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_fprintf, 0, 2, IS_LONG, 0)
+ ZEND_ARG_INFO(0, handle)
+ ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0)
+ ZEND_ARG_VARIADIC_INFO(0, args)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_vfprintf, 0, 3, IS_LONG, 0)
+ ZEND_ARG_INFO(0, handle)
+ ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0)
+ ZEND_ARG_INFO(0, args)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_fsockopen, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, hostname, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, port, IS_LONG, 0)
+ ZEND_ARG_INFO(1, errno)
+ ZEND_ARG_INFO(1, errstr)
+ ZEND_ARG_TYPE_INFO(0, timeout, IS_DOUBLE, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_pfsockopen arginfo_fsockopen
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_http_build_query, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_MASK(0, data, MAY_BE_ARRAY|MAY_BE_OBJECT)
+ ZEND_ARG_TYPE_INFO(0, numeric_prefix, IS_STRING, 0)
+ ZEND_ARG_INFO(0, arg_separator)
+ ZEND_ARG_TYPE_INFO(0, enc_type, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_image_type_to_mime_type, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, image_type, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_image_type_to_extension, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, image_type, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_getimagesize, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, image_path, IS_STRING, 0)
+ ZEND_ARG_INFO(1, image_info)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_getimagesizefromstring, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, image, IS_STRING, 0)
+ ZEND_ARG_INFO(1, image_info)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phpinfo, 0, 0, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, what, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_phpversion, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, extension, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phpcredits, 0, 0, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, flag, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_php_sapi_name arginfo_ob_get_flush
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_php_uname, 0, 0, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_php_ini_scanned_files arginfo_ob_get_flush
+
+#define arginfo_php_ini_loaded_file arginfo_ob_get_flush
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_iptcembed, 0, 2, MAY_BE_STRING|MAY_BE_BOOL)
+ ZEND_ARG_TYPE_INFO(0, iptcdata, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, jpeg_file_name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, spool, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_iptcparse, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, iptcblock, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_levenshtein, 0, 2, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, str1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, str2, IS_STRING, 0)
+ ZEND_ARG_INFO(0, cost_ins)
+ ZEND_ARG_TYPE_INFO(0, cost_rep, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, cost_del, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_SYMLINK) || defined(PHP_WIN32)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_readlink, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_SYMLINK) || defined(PHP_WIN32)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_linkinfo, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_SYMLINK) || defined(PHP_WIN32)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_symlink, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, target, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, link, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_SYMLINK) || defined(PHP_WIN32)
+#define arginfo_link arginfo_symlink
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mail, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, to, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, subject, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, message, IS_STRING, 0)
+ ZEND_ARG_TYPE_MASK(0, additional_headers, MAY_BE_STRING|MAY_BE_ARRAY)
+ ZEND_ARG_TYPE_INFO(0, additional_parameters, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_abs, 0, 1, MAY_BE_LONG|MAY_BE_DOUBLE)
+ ZEND_ARG_TYPE_MASK(0, number, MAY_BE_LONG|MAY_BE_DOUBLE)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ceil, 0, 1, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, number, IS_DOUBLE, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_floor arginfo_ceil
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_round, 0, 1, IS_DOUBLE, 0)
+ ZEND_ARG_INFO(0, number)
+ ZEND_ARG_TYPE_INFO(0, precision, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_sin arginfo_ceil
+
+#define arginfo_cos arginfo_ceil
+
+#define arginfo_tan arginfo_ceil
+
+#define arginfo_asin arginfo_ceil
+
+#define arginfo_acos arginfo_ceil
+
+#define arginfo_atan arginfo_ceil
+
+#define arginfo_atanh arginfo_ceil
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_atan2, 0, 2, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, y, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, x, IS_DOUBLE, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_sinh arginfo_ceil
+
+#define arginfo_cosh arginfo_ceil
+
+#define arginfo_tanh arginfo_ceil
+
+#define arginfo_asinh arginfo_ceil
+
+#define arginfo_acosh arginfo_ceil
+
+#define arginfo_expm1 arginfo_ceil
+
+#define arginfo_log1p arginfo_ceil
+
+#define arginfo_pi arginfo_lcg_value
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_is_finite, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, number, IS_DOUBLE, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_is_nan arginfo_is_finite
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_intdiv, 0, 2, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, dividend, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, divisor, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_is_infinite arginfo_is_finite
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_pow, 0, 0, 2)
+ ZEND_ARG_INFO(0, base)
+ ZEND_ARG_INFO(0, exp)
+ZEND_END_ARG_INFO()
+
+#define arginfo_exp arginfo_ceil
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_log, 0, 1, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, number, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, base, IS_DOUBLE, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_log10 arginfo_ceil
+
+#define arginfo_sqrt arginfo_ceil
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hypot, 0, 2, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, x, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, y, IS_DOUBLE, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_deg2rad arginfo_ceil
+
+#define arginfo_rad2deg arginfo_ceil
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_bindec, 0, 1, MAY_BE_LONG|MAY_BE_DOUBLE)
+ ZEND_ARG_TYPE_INFO(0, binary_string, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_hexdec, 0, 1, MAY_BE_LONG|MAY_BE_DOUBLE)
+ ZEND_ARG_TYPE_INFO(0, hex_string, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_octdec, 0, 1, MAY_BE_LONG|MAY_BE_DOUBLE)
+ ZEND_ARG_TYPE_INFO(0, octal_string, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_decbin, 0, 1, IS_STRING, 0)
+ ZEND_ARG_INFO(0, number)
+ZEND_END_ARG_INFO()
+
+#define arginfo_decoct arginfo_decbin
+
+#define arginfo_dechex arginfo_decbin
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_base_convert, 0, 3, IS_STRING, 0)
+ ZEND_ARG_INFO(0, number)
+ ZEND_ARG_TYPE_INFO(0, frombase, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, tobase, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_number_format, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, number, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, decimals, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, decimal_point, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, thousands_separator, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+#define arginfo_fmod arginfo_hypot
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_fdiv, 0, 2, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, dividend, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, divisor, IS_DOUBLE, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_GETTIMEOFDAY)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_microtime, 0, 0, MAY_BE_STRING|MAY_BE_DOUBLE)
+ ZEND_ARG_TYPE_INFO(0, get_as_float, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_GETTIMEOFDAY)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_gettimeofday, 0, 0, MAY_BE_ARRAY|MAY_BE_DOUBLE)
+ ZEND_ARG_TYPE_INFO(0, return_float, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_GETRUSAGE)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_getrusage, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, who, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pack, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0)
+ ZEND_ARG_VARIADIC_INFO(0, args)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_unpack, 0, 2, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_password_get_info, 0, 1, IS_ARRAY, 1)
+ ZEND_ARG_TYPE_INFO(0, hash, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_password_hash, 0, 2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0)
+ ZEND_ARG_INFO(0, algo)
+ ZEND_ARG_TYPE_INFO(0, options, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_password_needs_rehash, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, hash, IS_STRING, 0)
+ ZEND_ARG_INFO(0, algo)
+ ZEND_ARG_TYPE_INFO(0, options, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_password_verify, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, hash, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_password_algos arginfo_ob_list_handlers
+
+#if defined(PHP_CAN_SUPPORT_PROC_OPEN)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_proc_open, 0, 0, 3)
+ ZEND_ARG_INFO(0, cmd)
+ ZEND_ARG_TYPE_INFO(0, descriptorspec, IS_ARRAY, 0)
+ ZEND_ARG_INFO(1, pipes)
+ ZEND_ARG_TYPE_INFO(0, cwd, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, env, IS_ARRAY, 1)
+ ZEND_ARG_TYPE_INFO(0, other_options, IS_ARRAY, 1)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(PHP_CAN_SUPPORT_PROC_OPEN)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_proc_close, 0, 1, IS_LONG, 0)
+ ZEND_ARG_INFO(0, process)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(PHP_CAN_SUPPORT_PROC_OPEN)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_proc_terminate, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, process)
+ ZEND_ARG_TYPE_INFO(0, signal, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(PHP_CAN_SUPPORT_PROC_OPEN)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_proc_get_status, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_INFO(0, process)
+ZEND_END_ARG_INFO()
+#endif
+
+#define arginfo_quoted_printable_decode arginfo_base64_encode
+
+#define arginfo_quoted_printable_encode arginfo_base64_encode
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mt_srand, 0, 0, IS_VOID, 0)
+ ZEND_ARG_TYPE_INFO(0, seed, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mt_rand, 0, 0, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, min, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, max, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_mt_getrandmax arginfo_ob_get_level
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_random_bytes, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_random_int, 0, 2, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, min, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, max, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_soundex, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_stream_select, 0, 4, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(1, read, IS_ARRAY, 1)
+ ZEND_ARG_TYPE_INFO(1, write, IS_ARRAY, 1)
+ ZEND_ARG_TYPE_INFO(1, except, IS_ARRAY, 1)
+ ZEND_ARG_TYPE_INFO(0, tv_sec, IS_LONG, 1)
+ ZEND_ARG_TYPE_INFO(0, tv_usec, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_context_create, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_ARRAY, 1)
+ ZEND_ARG_TYPE_INFO(0, params, IS_ARRAY, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stream_context_set_params, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, context)
+ ZEND_ARG_TYPE_INFO(0, params, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stream_context_get_params, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_INFO(0, context)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stream_context_set_option, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, context)
+ ZEND_ARG_INFO(0, param2)
+ ZEND_ARG_TYPE_INFO(0, option_name, IS_STRING, 0)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stream_context_get_options, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_INFO(0, stream_or_context)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_context_get_default, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_context_set_default, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, options, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_filter_prepend, 0, 0, 2)
+ ZEND_ARG_INFO(0, stream)
+ ZEND_ARG_TYPE_INFO(0, filtername, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, read_write, IS_LONG, 0)
+ ZEND_ARG_INFO(0, params)
+ZEND_END_ARG_INFO()
+
+#define arginfo_stream_filter_append arginfo_stream_filter_prepend
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stream_filter_remove, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, stream_filter)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_socket_client, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, remote_socket, IS_STRING, 0)
+ ZEND_ARG_INFO(1, errno)
+ ZEND_ARG_INFO(1, errstr)
+ ZEND_ARG_TYPE_INFO(0, timeout, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ ZEND_ARG_INFO(0, context)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_socket_server, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, local_socket, IS_STRING, 0)
+ ZEND_ARG_INFO(1, errno)
+ ZEND_ARG_INFO(1, errstr)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ ZEND_ARG_INFO(0, context)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_socket_accept, 0, 0, 1)
+ ZEND_ARG_INFO(0, server_socket)
+ ZEND_ARG_TYPE_INFO(0, timeout, IS_DOUBLE, 0)
+ ZEND_ARG_INFO(1, peername)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_stream_socket_get_name, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, handle)
+ ZEND_ARG_TYPE_INFO(0, want_peer, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_stream_socket_recvfrom, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, socket)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ ZEND_ARG_INFO(1, address)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_stream_socket_sendto, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, socket)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, address, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_stream_socket_enable_crypto, 0, 2, MAY_BE_LONG|MAY_BE_BOOL)
+ ZEND_ARG_INFO(0, stream)
+ ZEND_ARG_TYPE_INFO(0, enable, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, crypto_type, IS_LONG, 1)
+ ZEND_ARG_INFO(0, session_stream)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_SHUTDOWN)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stream_socket_shutdown, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, stream)
+ ZEND_ARG_TYPE_INFO(0, how, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if HAVE_SOCKETPAIR
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_stream_socket_pair, 0, 3, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, domain, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, protocol, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_stream_copy_to_stream, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, source)
+ ZEND_ARG_INFO(0, dest)
+ ZEND_ARG_TYPE_INFO(0, maxlength, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, position, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_stream_get_contents, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, handle)
+ ZEND_ARG_TYPE_INFO(0, maxlength, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, position, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stream_supports_lock, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, stream)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stream_set_write_buffer, 0, 2, IS_LONG, 0)
+ ZEND_ARG_INFO(0, stream)
+ ZEND_ARG_TYPE_INFO(0, buffer, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_stream_set_read_buffer arginfo_stream_set_write_buffer
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stream_set_blocking, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, stream)
+ ZEND_ARG_TYPE_INFO(0, mode, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stream_get_meta_data, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_INFO(0, stream)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_stream_get_line, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, handle)
+ ZEND_ARG_TYPE_INFO(0, max_length, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, ending, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_stream_resolve_include_path arginfo_filetype
+
+#define arginfo_stream_get_wrappers arginfo_net_get_interfaces
+
+#define arginfo_stream_get_transports arginfo_net_get_interfaces
+
+#define arginfo_stream_is_local arginfo_stream_supports_lock
+
+#define arginfo_stream_isatty arginfo_stream_supports_lock
+
+#if defined(PHP_WIN32)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sapi_windows_vt100_support, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, stream)
+ ZEND_ARG_TYPE_INFO(0, enable, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stream_set_chunk_size, 0, 2, IS_LONG, 0)
+ ZEND_ARG_INFO(0, stream)
+ ZEND_ARG_TYPE_INFO(0, size, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#if HAVE_SYS_TIME_H || defined(PHP_WIN32)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stream_set_timeout, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, socket)
+ ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, microseconds, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_gettype, 0, 1, IS_STRING, 0)
+ ZEND_ARG_INFO(0, var)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_settype, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(1, var)
+ ZEND_ARG_TYPE_INFO(0, type, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_intval, 0, 1, IS_LONG, 0)
+ ZEND_ARG_INFO(0, value)
+ ZEND_ARG_TYPE_INFO(0, base, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_floatval, 0, 1, IS_DOUBLE, 0)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_boolval, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_strval, 0, 1, IS_STRING, 0)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+#define arginfo_is_null arginfo_boolval
+
+#define arginfo_is_resource arginfo_boolval
+
+#define arginfo_is_bool arginfo_boolval
+
+#define arginfo_is_int arginfo_boolval
+
+#define arginfo_is_float arginfo_boolval
+
+#define arginfo_is_numeric arginfo_boolval
+
+#define arginfo_is_string arginfo_boolval
+
+#define arginfo_is_array arginfo_boolval
+
+#define arginfo_is_object arginfo_boolval
+
+#define arginfo_is_scalar arginfo_boolval
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_is_callable, 0, 0, 1)
+ ZEND_ARG_INFO(0, value)
+ ZEND_ARG_TYPE_INFO(0, syntax_only, _IS_BOOL, 0)
+ ZEND_ARG_INFO(1, callable_name)
+ZEND_END_ARG_INFO()
+
+#define arginfo_is_iterable arginfo_boolval
+
+#define arginfo_is_countable arginfo_boolval
+
+#if defined(HAVE_GETTIMEOFDAY)
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_uniqid, 0, 0, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, prefix, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, more_entropy, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_parse_url, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, url, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, component, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_urlencode, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_urldecode arginfo_urlencode
+
+#define arginfo_rawurlencode arginfo_urlencode
+
+#define arginfo_rawurldecode arginfo_urlencode
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_get_headers, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, url, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, format, IS_LONG, 0)
+ ZEND_ARG_INFO(0, context)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_php_user_filter_filter, 0, 0, 4)
+ ZEND_ARG_INFO(0, in)
+ ZEND_ARG_INFO(0, out)
+ ZEND_ARG_INFO(1, consumed)
+ ZEND_ARG_INFO(0, closing)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_php_user_filter_onCreate arginfo_tmpfile
+
+#define arginfo_class_php_user_filter_onClose arginfo_tmpfile
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stream_bucket_make_writeable, 0, 1, IS_OBJECT, 1)
+ ZEND_ARG_INFO(0, brigade)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stream_bucket_prepend, 0, 2, IS_VOID, 0)
+ ZEND_ARG_INFO(0, brigade)
+ ZEND_ARG_TYPE_INFO(0, bucket, IS_OBJECT, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_stream_bucket_append arginfo_stream_bucket_prepend
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_stream_bucket_new, 0, 2, MAY_BE_OBJECT|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, stream)
+ ZEND_ARG_TYPE_INFO(0, buffer, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_stream_get_filters arginfo_ob_list_handlers
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_stream_filter_register, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, filtername, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, classname, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_convert_uuencode arginfo_hex2bin
+
+#define arginfo_convert_uudecode arginfo_hex2bin
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_var_dump, 0, 1, IS_VOID, 0)
+ ZEND_ARG_INFO(0, value)
+ ZEND_ARG_VARIADIC_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_var_export, 0, 1, IS_STRING, 1)
+ ZEND_ARG_INFO(0, value)
+ ZEND_ARG_TYPE_INFO(0, return, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_debug_zval_dump arginfo_var_dump
+
+#define arginfo_serialize arginfo_strval
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_unserialize, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_memory_get_usage, 0, 0, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, real_usage, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_memory_get_peak_usage arginfo_memory_get_usage
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_version_compare, 0, 2, MAY_BE_LONG|MAY_BE_BOOL)
+ ZEND_ARG_TYPE_INFO(0, version1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, version2, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, operator, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sapi_windows_cp_set, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, cp, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sapi_windows_cp_get, 0, 0, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, kind, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_sapi_windows_cp_conv, 0, 0, 3)
+ ZEND_ARG_INFO(0, in_codepage)
+ ZEND_ARG_INFO(0, out_codepage)
+ ZEND_ARG_TYPE_INFO(0, subject, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_sapi_windows_cp_is_utf8 arginfo_ob_flush
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sapi_windows_set_ctrl_handler, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, handler)
+ ZEND_ARG_TYPE_INFO(0, add, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sapi_windows_generate_ctrl_event, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, event, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, pid, IS_LONG, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c
index 508f725a28..8e99b925db 100644
--- a/ext/standard/browscap.c
+++ b/ext/standard/browscap.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -688,6 +686,12 @@ PHP_FUNCTION(get_browser)
browscap_entry *found_entry = NULL;
HashTable *agent_ht;
+ ZEND_PARSE_PARAMETERS_START(0, 2)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_STR_EX(agent_name, 1, 0)
+ Z_PARAM_BOOL(return_array)
+ ZEND_PARSE_PARAMETERS_END();
+
if (BROWSCAP_G(activation_bdata).filename[0] != '\0') {
bdata = &BROWSCAP_G(activation_bdata);
if (bdata->htab == NULL) { /* not initialized yet */
@@ -703,12 +707,6 @@ PHP_FUNCTION(get_browser)
bdata = &global_bdata;
}
- ZEND_PARSE_PARAMETERS_START(0, 2)
- Z_PARAM_OPTIONAL
- Z_PARAM_STR_EX(agent_name, 1, 0)
- Z_PARAM_BOOL(return_array)
- ZEND_PARSE_PARAMETERS_END();
-
if (agent_name == NULL) {
zval *http_user_agent = NULL;
if (Z_TYPE(PG(http_globals)[TRACK_VARS_SERVER]) == IS_ARRAY
diff --git a/ext/standard/config.m4 b/ext/standard/config.m4
index 9f85ec2b70..854f885cf5 100644
--- a/ext/standard/config.m4
+++ b/ext/standard/config.m4
@@ -5,6 +5,10 @@ AC_CACHE_CHECK([whether flush should be called explicitly after a buffered io],
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdio.h>
#include <stdlib.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <string.h>
int main(int argc, char **argv)
{
@@ -67,6 +71,9 @@ AC_CACHE_CHECK(for standard DES crypt, ac_cv_crypt_des,[
#include <crypt.h>
#endif
+#include <stdlib.h>
+#include <string.h>
+
int main() {
#if HAVE_CRYPT
char *encrypted = crypt("rasmuslerdorf","rl");
@@ -92,6 +99,9 @@ AC_CACHE_CHECK(for extended DES crypt, ac_cv_crypt_ext_des,[
#include <crypt.h>
#endif
+#include <stdlib.h>
+#include <string.h>
+
int main() {
#if HAVE_CRYPT
char *encrypted = crypt("rasmuslerdorf","_J9..rasm");
@@ -117,6 +127,9 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <crypt.h>
#endif
+#include <stdlib.h>
+#include <string.h>
+
int main() {
#if HAVE_CRYPT
char salt[15], answer[40];
@@ -152,6 +165,9 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <crypt.h>
#endif
+#include <stdlib.h>
+#include <string.h>
+
int main() {
#if HAVE_CRYPT
char salt[30], answer[70];
@@ -184,6 +200,9 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <crypt.h>
#endif
+#include <stdlib.h>
+#include <string.h>
+
int main() {
#if HAVE_CRYPT
char salt[21], answer[21+86];
@@ -215,6 +234,9 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <crypt.h>
#endif
+#include <stdlib.h>
+#include <string.h>
+
int main() {
#if HAVE_CRYPT
char salt[21], answer[21+43];
@@ -281,12 +303,6 @@ if test "$ac_cv_attribute_aligned" = "yes"; then
AC_DEFINE([HAVE_ATTRIBUTE_ALIGNED], 1, [whether the compiler supports __attribute__ ((__aligned__))])
fi
-dnl
-dnl Check for available functions
-dnl
-dnl log2 could be used to improve the log function, however it requires C99. The
-dnl check for log2 should be turned on, as soon as we support C99.
-AC_CHECK_FUNCS(asinh acosh atanh log1p hypot)
AC_FUNC_FNMATCH
dnl
@@ -469,7 +485,7 @@ dnl
dnl Setup extension sources
dnl
PHP_NEW_EXTENSION(standard, array.c base64.c basic_functions.c browscap.c crc32.c crypt.c \
- cyr_convert.c datetime.c dir.c dl.c dns.c exec.c file.c filestat.c \
+ datetime.c dir.c dl.c dns.c exec.c file.c filestat.c \
flock_compat.c formatted_print.c fsock.c head.c html.c image.c \
info.c iptc.c lcg.c link.c mail.c math.c md5.c metaphone.c \
microtime.c pack.c pageinfo.c quot_print.c rand.c mt_rand.c \
diff --git a/ext/standard/config.w32 b/ext/standard/config.w32
index 0f47242145..a5737ea853 100644
--- a/ext/standard/config.w32
+++ b/ext/standard/config.w32
@@ -6,11 +6,11 @@ if (PHP_PASSWORD_ARGON2 != "no") {
if (CHECK_LIB("argon2_a.lib;argon2.lib", null, PHP_PASSWORD_ARGON2)
&& CHECK_HEADER_ADD_INCLUDE("argon2.h", "CFLAGS")) {
if (!CHECK_FUNC_IN_HEADER("argon2.h", "argon2id_hash_raw", PHP_PHP_BUILD + "\\include", "CFLAGS")) {
- ERROR("Please verify that Argon2 header and libaries >= 20161029 are installed");
+ ERROR("Please verify that Argon2 header and libraries >= 20161029 are installed");
}
AC_DEFINE('HAVE_ARGON2LIB', 1);
} else {
- WARNING("Argon2 not enabled; libaries and headers not found");
+ WARNING("Argon2 not enabled; libraries and headers not found");
}
}
@@ -26,7 +26,7 @@ ADD_FLAG("LIBS_STANDARD", "iphlpapi.lib");
EXTENSION("standard", "array.c base64.c basic_functions.c browscap.c \
crc32.c crypt.c crypt_freesec.c crypt_blowfish.c crypt_sha256.c \
crypt_sha512.c php_crypt_r.c \
- cyr_convert.c datetime.c dir.c dl.c dns.c dns_win32.c exec.c \
+ datetime.c dir.c dl.c dns.c dns_win32.c exec.c \
file.c filestat.c formatted_print.c fsock.c head.c html.c image.c \
info.c iptc.c lcg.c link.c mail.c math.c md5.c metaphone.c microtime.c \
net.c pack.c pageinfo.c quot_print.c rand.c mt_rand.c soundex.c \
diff --git a/ext/standard/crc32.c b/ext/standard/crc32.c
index c3ca59036c..1393483278 100644
--- a/ext/standard/crc32.c
+++ b/ext/standard/crc32.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/crc32.h b/ext/standard/crc32.h
index 300af378fc..21dd4079c5 100644
--- a/ext/standard/crc32.h
+++ b/ext/standard/crc32.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/credits.c b/ext/standard/credits.c
index 556ffd73dd..9f7cc55039 100644
--- a/ext/standard/credits.c
+++ b/ext/standard/credits.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/credits.h b/ext/standard/credits.h
index dcf4669c44..e4de3ea503 100644
--- a/ext/standard/credits.h
+++ b/ext/standard/credits.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c
index b727575fad..86cddc8e53 100644
--- a/ext/standard/crypt.c
+++ b/ext/standard/crypt.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/css.c b/ext/standard/css.c
index 0e4afd9907..9009d95291 100644
--- a/ext/standard/css.c
+++ b/ext/standard/css.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/css.h b/ext/standard/css.h
index 09fbb43af0..f0b61d397a 100644
--- a/ext/standard/css.h
+++ b/ext/standard/css.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/cyr_convert.c b/ext/standard/cyr_convert.c
deleted file mode 100644
index e9f45eb61f..0000000000
--- a/ext/standard/cyr_convert.c
+++ /dev/null
@@ -1,286 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
- | Copyright (c) The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Kirill Maximov <kir@rus.net> |
- +----------------------------------------------------------------------+
- */
-
-#include <stdlib.h>
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <string.h>
-#include <errno.h>
-
-#include "php.h"
-#include "cyr_convert.h"
-
-#include <stdio.h>
-
-/*****************************************************************************
-* This is codetables for different Cyrillic charsets (relative to koi8-r).
-* Each table contains data for 128-255 symbols from ASCII table.
-* First 256 symbols are for conversion from koi8-r to corresponding charset,
-* second 256 symbols are for reverse conversion, from charset to koi8-r.
-*
-* Here we have the following tables:
-* _cyr_win1251 - for windows-1251 charset
-* _cyr_iso88595 - for iso8859-5 charset
-* _cyr_cp866 - for x-cp866 charset
-* _cyr_mac - for x-mac-cyrillic charset
-*
-*****************************************************************************/
-
-typedef unsigned char _cyr_charset_table[512];
-
-/* {{{ static const _cyr_charset_table _cyr_win1251
- */
-static const _cyr_charset_table _cyr_win1251 = {
-0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
-16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
-32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,
-48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
-64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,
-80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,
-96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,
-112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
-46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,
-46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,
-154,174,190,46,159,189,46,46,179,191,180,157,46,46,156,183,
-46,46,182,166,173,46,46,158,163,152,164,155,46,46,46,167,
-225,226,247,231,228,229,246,250,233,234,235,236,237,238,239,240,
-242,243,244,245,230,232,227,254,251,253,255,249,248,252,224,241,
-193,194,215,199,196,197,214,218,201,202,203,204,205,206,207,208,
-210,211,212,213,198,200,195,222,219,221,223,217,216,220,192,209,
-0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
-16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
-32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,
-48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
-64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,
-80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,
-96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,
-112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
-32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
-32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
-32,32,32,184,186,32,179,191,32,32,32,32,32,180,162,32,
-32,32,32,168,170,32,178,175,32,32,32,32,32,165,161,169,
-254,224,225,246,228,229,244,227,245,232,233,234,235,236,237,238,
-239,255,240,241,242,243,230,226,252,251,231,248,253,249,247,250,
-222,192,193,214,196,197,212,195,213,200,201,202,203,204,205,206,
-207,223,208,209,210,211,198,194,220,219,199,216,221,217,215,218,
-},
-_cyr_cp866 = {
-0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
-16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
-32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,
-48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
-64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,
-80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,
-96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,
-112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
-225,226,247,231,228,229,246,250,233,234,235,236,237,238,239,240,
-242,243,244,245,230,232,227,254,251,253,255,249,248,252,224,241,
-193,194,215,199,196,197,214,218,201,202,203,204,205,206,207,208,
-35,35,35,124,124,124,124,43,43,124,124,43,43,43,43,43,
-43,45,45,124,45,43,124,124,43,43,45,45,124,45,43,45,
-45,45,45,43,43,43,43,43,43,43,43,35,35,124,124,35,
-210,211,212,213,198,200,195,222,219,221,223,217,216,220,192,209,
-179,163,180,164,183,167,190,174,32,149,158,32,152,159,148,154,
-0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
-16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
-32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,
-48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
-64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,
-80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,
-96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,
-112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
-32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
-32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
-205,186,213,241,243,201,32,245,187,212,211,200,190,32,247,198,
-199,204,181,240,242,185,32,244,203,207,208,202,216,32,246,32,
-238,160,161,230,164,165,228,163,229,168,169,170,171,172,173,174,
-175,239,224,225,226,227,166,162,236,235,167,232,237,233,231,234,
-158,128,129,150,132,133,148,131,149,136,137,138,139,140,141,142,
-143,159,144,145,146,147,134,130,156,155,135,152,157,153,151,154,
-},
-_cyr_iso88595 = {
-0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
-16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
-32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,
-48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
-64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,
-80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,
-96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,
-112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
-32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
-32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
-32,179,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
-225,226,247,231,228,229,246,250,233,234,235,236,237,238,239,240,
-242,243,244,245,230,232,227,254,251,253,255,249,248,252,224,241,
-193,194,215,199,196,197,214,218,201,202,203,204,205,206,207,208,
-210,211,212,213,198,200,195,222,219,221,223,217,216,220,192,209,
-32,163,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
-0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
-16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
-32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,
-48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
-64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,
-80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,
-96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,
-112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
-32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
-32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
-32,32,32,241,32,32,32,32,32,32,32,32,32,32,32,32,
-32,32,32,161,32,32,32,32,32,32,32,32,32,32,32,32,
-238,208,209,230,212,213,228,211,229,216,217,218,219,220,221,222,
-223,239,224,225,226,227,214,210,236,235,215,232,237,233,231,234,
-206,176,177,198,180,181,196,179,197,184,185,186,187,188,189,190,
-191,207,192,193,194,195,182,178,204,203,183,200,205,201,199,202,
-},
-_cyr_mac = {
-0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
-16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
-32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,
-48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
-64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,
-80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,
-96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,
-112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
-225,226,247,231,228,229,246,250,233,234,235,236,237,238,239,240,
-242,243,244,245,230,232,227,254,251,253,255,249,248,252,224,241,
-160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,
-176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,
-128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,
-144,145,146,147,148,149,150,151,152,153,154,155,156,179,163,209,
-193,194,215,199,196,197,214,218,201,202,203,204,205,206,207,208,
-210,211,212,213,198,200,195,222,219,221,223,217,216,220,192,255,
-0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
-16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
-32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,
-48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
-64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,
-80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,
-96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,
-112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
-192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,
-208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,
-160,161,162,222,164,165,166,167,168,169,170,171,172,173,174,175,
-176,177,178,221,180,181,182,183,184,185,186,187,188,189,190,191,
-254,224,225,246,228,229,244,227,245,232,233,234,235,236,237,238,
-239,223,240,241,242,243,230,226,252,251,231,248,253,249,247,250,
-158,128,129,150,132,133,148,131,149,136,137,138,139,140,141,142,
-143,159,144,145,146,147,134,130,156,155,135,152,157,153,151,154,
-};
-/* }}} */
-
-/* {{{ static char * php_convert_cyr_string(unsigned char *str, int length, char from, char to)
-* This is the function that performs real in-place conversion of the string
-* between charsets.
-* Parameters:
-* str - string to be converted
-* from,to - one-symbol label of source and destination charset
-* The following symbols are used as labels:
-* k - koi8-r
-* w - windows-1251
-* i - iso8859-5
-* a - x-cp866
-* d - x-cp866
-* m - x-mac-cyrillic
-*****************************************************************************/
-static char * php_convert_cyr_string(unsigned char *str, size_t length, char from, char to)
-{
- const unsigned char *from_table, *to_table;
- unsigned char tmp;
- size_t i;
-
- from_table = NULL;
- to_table = NULL;
-
- switch (toupper((int)(unsigned char)from))
- {
- case 'W':
- from_table = _cyr_win1251;
- break;
- case 'A':
- case 'D':
- from_table = _cyr_cp866;
- break;
- case 'I':
- from_table = _cyr_iso88595;
- break;
- case 'M':
- from_table = _cyr_mac;
- break;
- case 'K':
- break;
- default:
- php_error_docref(NULL, E_WARNING, "Unknown source charset: %c", from);
- break;
- }
-
- switch (toupper((int)(unsigned char)to))
- {
- case 'W':
- to_table = _cyr_win1251;
- break;
- case 'A':
- case 'D':
- to_table = _cyr_cp866;
- break;
- case 'I':
- to_table = _cyr_iso88595;
- break;
- case 'M':
- to_table = _cyr_mac;
- break;
- case 'K':
- break;
- default:
- php_error_docref(NULL, E_WARNING, "Unknown destination charset: %c", to);
- break;
- }
-
-
- if (!str)
- return (char *)str;
-
- for (i = 0; i < length; i++) {
- tmp = (from_table == NULL)? str[i] : from_table[ str[i] ];
- str[i] = (to_table == NULL) ? tmp : to_table[tmp + 256];
- }
- return (char *)str;
-}
-/* }}} */
-
-/* {{{ proto string convert_cyr_string(string str, string from, string to)
- Convert from one Cyrillic character set to another */
-PHP_FUNCTION(convert_cyr_string)
-{
- char *input, *fr_cs, *to_cs;
- size_t input_len, fr_cs_len, to_cs_len;
- zend_string *str;
-
- ZEND_PARSE_PARAMETERS_START(3, 3)
- Z_PARAM_STRING(input, input_len)
- Z_PARAM_STRING(fr_cs, fr_cs_len)
- Z_PARAM_STRING(to_cs, to_cs_len)
- ZEND_PARSE_PARAMETERS_END();
-
- str = zend_string_init(input, input_len, 0);
-
- php_convert_cyr_string((unsigned char *) ZSTR_VAL(str), ZSTR_LEN(str), fr_cs[0], to_cs[0]);
- RETVAL_NEW_STR(str);
-}
-/* }}} */
diff --git a/ext/standard/cyr_convert.h b/ext/standard/cyr_convert.h
deleted file mode 100644
index dcdc023f24..0000000000
--- a/ext/standard/cyr_convert.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
- | Copyright (c) The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Kirill Maximov <kir@rus.net> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef CYR_CONVERT_H
-#define CYR_CONVERT_H
-
-PHP_FUNCTION(convert_cyr_string);
-
-#endif /* CYR_CONVERT_H */
diff --git a/ext/standard/datetime.c b/ext/standard/datetime.c
index b1f0f26557..ba70db4b06 100644
--- a/ext/standard/datetime.c
+++ b/ext/standard/datetime.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -69,7 +67,7 @@ PHPAPI char *php_std_date(time_t t)
char *strptime(const char *s, const char *format, struct tm *tm);
#endif
-/* {{{ proto string strptime(string timestamp, string format)
+/* {{{ proto array|false strptime(string timestamp, string format)
Parse a time/date generated with strftime() */
PHP_FUNCTION(strptime)
{
diff --git a/ext/standard/datetime.h b/ext/standard/datetime.h
index 1718aede4b..afdabd4152 100644
--- a/ext/standard/datetime.h
+++ b/ext/standard/datetime.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/dir.c b/ext/standard/dir.c
index e81855fc29..5554a689b3 100644
--- a/ext/standard/dir.c
+++ b/ext/standard/dir.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -25,6 +23,7 @@
#include "php_string.h"
#include "php_scandir.h"
#include "basic_functions.h"
+#include "basic_functions_arginfo.h"
#if HAVE_UNISTD_H
#include <unistd.h>
@@ -68,34 +67,30 @@ static zend_class_entry *dir_class_entry_ptr;
myself = getThis(); \
if (myself) { \
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(myself), "handle", sizeof("handle")-1)) == NULL) { \
- php_error_docref(NULL, E_WARNING, "Unable to find my handle property"); \
- RETURN_FALSE; \
+ zend_throw_error(NULL, "Unable to find my handle property"); \
+ RETURN_THROWS(); \
} \
if ((dirp = (php_stream *)zend_fetch_resource_ex(tmp, "Directory", php_file_le_stream())) == NULL) { \
- RETURN_FALSE; \
+ RETURN_THROWS(); \
} \
} else { \
- if (!DIRG(default_dir) || \
- (dirp = (php_stream *)zend_fetch_resource(DIRG(default_dir), "Directory", php_file_le_stream())) == NULL) { \
- RETURN_FALSE; \
+ if (!DIRG(default_dir)) { \
+ zend_type_error("No resource supplied"); \
+ RETURN_THROWS(); \
+ } else if ((dirp = (php_stream *)zend_fetch_resource(DIRG(default_dir), "Directory", php_file_le_stream())) == NULL) { \
+ RETURN_THROWS(); \
} \
} \
} else { \
if ((dirp = (php_stream *)zend_fetch_resource(Z_RES_P(id), "Directory", php_file_le_stream())) == NULL) { \
- RETURN_FALSE; \
+ RETURN_THROWS(); \
} \
}
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_dir, 0, 0, 0)
- ZEND_ARG_INFO(0, dir_handle)
-ZEND_END_ARG_INFO()
-/* }}} */
-
static const zend_function_entry php_dir_class_functions[] = {
- PHP_FALIAS(close, closedir, arginfo_dir)
- PHP_FALIAS(rewind, rewinddir, arginfo_dir)
- PHP_NAMED_FE(read, php_if_readdir, arginfo_dir)
+ PHP_FALIAS(close, closedir, arginfo_class_Directory_close)
+ PHP_FALIAS(rewind, rewinddir, arginfo_class_Directory_rewind)
+ PHP_NAMED_FE(read, php_if_readdir, arginfo_class_Directory_read)
PHP_FE_END
};
@@ -239,7 +234,7 @@ static void _php_do_opendir(INTERNAL_FUNCTION_PARAMETERS, int createobject)
}
/* }}} */
-/* {{{ proto mixed opendir(string path[, resource context])
+/* {{{ proto resource|false opendir(string path[, resource context])
Open a directory and return a dir_handle */
PHP_FUNCTION(opendir)
{
@@ -247,7 +242,7 @@ PHP_FUNCTION(opendir)
}
/* }}} */
-/* {{{ proto object dir(string directory[, resource context])
+/* {{{ proto object|false dir(string directory[, resource context])
Directory class with properties, handle and class and methods read, rewind and close */
PHP_FUNCTION(getdir)
{
@@ -255,7 +250,7 @@ PHP_FUNCTION(getdir)
}
/* }}} */
-/* {{{ proto void closedir([resource dir_handle])
+/* {{{ proto bool closedir([resource dir_handle])
Close directory connection identified by the dir_handle */
PHP_FUNCTION(closedir)
{
@@ -266,8 +261,8 @@ PHP_FUNCTION(closedir)
FETCH_DIRP();
if (!(dirp->flags & PHP_STREAM_FLAG_IS_DIR)) {
- php_error_docref(NULL, E_WARNING, "%d is not a valid Directory resource", dirp->res->handle);
- RETURN_FALSE;
+ zend_type_error("%d is not a valid Directory resource", dirp->res->handle);
+ RETURN_THROWS();
}
res = dirp->res;
@@ -290,7 +285,7 @@ PHP_FUNCTION(chroot)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_PATH(str, str_len)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
ret = chroot(str);
if (ret != 0) {
@@ -322,7 +317,7 @@ PHP_FUNCTION(chdir)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_PATH(str, str_len)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (php_check_open_basedir(str)) {
RETURN_FALSE;
@@ -354,9 +349,7 @@ PHP_FUNCTION(getcwd)
char path[MAXPATHLEN];
char *ret=NULL;
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
#if HAVE_GETCWD
ret = VCWD_GETCWD(path, MAXPATHLEN);
@@ -382,15 +375,15 @@ PHP_FUNCTION(rewinddir)
FETCH_DIRP();
if (!(dirp->flags & PHP_STREAM_FLAG_IS_DIR)) {
- php_error_docref(NULL, E_WARNING, "%d is not a valid Directory resource", dirp->res->handle);
- RETURN_FALSE;
+ zend_type_error("%d is not a valid Directory resource", dirp->res->handle);
+ RETURN_THROWS();
}
php_stream_rewinddir(dirp);
}
/* }}} */
-/* {{{ proto string readdir([resource dir_handle])
+/* {{{ proto string|false readdir([resource dir_handle])
Read directory entry from dir_handle */
PHP_NAMED_FUNCTION(php_if_readdir)
{
@@ -401,8 +394,8 @@ PHP_NAMED_FUNCTION(php_if_readdir)
FETCH_DIRP();
if (!(dirp->flags & PHP_STREAM_FLAG_IS_DIR)) {
- php_error_docref(NULL, E_WARNING, "%d is not a valid Directory resource", dirp->res->handle);
- RETURN_FALSE;
+ zend_type_error("%d is not a valid Directory resource", dirp->res->handle);
+ RETURN_THROWS();
}
if (php_stream_readdir(dirp, &entry)) {
@@ -413,7 +406,7 @@ PHP_NAMED_FUNCTION(php_if_readdir)
/* }}} */
#ifdef HAVE_GLOB
-/* {{{ proto array glob(string pattern [, int flags])
+/* {{{ proto array|false glob(string pattern [, int flags])
Find pathnames matching a pattern */
PHP_FUNCTION(glob)
{
@@ -546,7 +539,7 @@ no_results:
/* }}} */
#endif
-/* {{{ proto array scandir(string dir [, int sorting_order [, resource context]])
+/* {{{ proto array|false scandir(string dir [, int sorting_order [, resource context]])
List files & directories inside the specified path */
PHP_FUNCTION(scandir)
{
@@ -566,8 +559,8 @@ PHP_FUNCTION(scandir)
ZEND_PARSE_PARAMETERS_END();
if (dirn_len < 1) {
- php_error_docref(NULL, E_WARNING, "Directory name cannot be empty");
- RETURN_FALSE;
+ zend_value_error("Directory name cannot be empty");
+ RETURN_THROWS();
}
if (zcontext) {
diff --git a/ext/standard/dl.c b/ext/standard/dl.c
index bef2e51e6f..1edfb944fc 100644
--- a/ext/standard/dl.c
+++ b/ext/standard/dl.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/dl.h b/ext/standard/dl.h
index 0255523020..d51df044d2 100644
--- a/ext/standard/dl.h
+++ b/ext/standard/dl.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/dns.c b/ext/standard/dns.c
index d461a39c34..c566f4e6ae 100644
--- a/ext/standard/dns.c
+++ b/ext/standard/dns.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -120,18 +118,16 @@ static zend_string *php_gethostbyaddr(char *ip);
static zend_string *php_gethostbyname(char *name);
#ifdef HAVE_GETHOSTNAME
-/* {{{ proto string gethostname()
+/* {{{ proto string|false gethostname()
Get the host name of the current machine */
PHP_FUNCTION(gethostname)
{
char buf[HOST_NAME_MAX + 1];
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
if (gethostname(buf, sizeof(buf))) {
- php_error_docref(NULL, E_WARNING, "unable to fetch host [%d]: %s", errno, strerror(errno));
+ php_error_docref(NULL, E_WARNING, "Unable to fetch host [%d]: %s", errno, strerror(errno));
RETURN_FALSE;
}
@@ -144,7 +140,7 @@ PHP_FUNCTION(gethostname)
we can have a dns.c, dns_unix.c and dns_win32.c instead of a messy dns.c full of #ifdef
*/
-/* {{{ proto string gethostbyaddr(string ip_address)
+/* {{{ proto string|false gethostbyaddr(string ip_address)
Get the Internet host name corresponding to a given IP address */
PHP_FUNCTION(gethostbyaddr)
{
@@ -227,7 +223,7 @@ PHP_FUNCTION(gethostbyname)
}
/* }}} */
-/* {{{ proto array gethostbynamel(string hostname)
+/* {{{ proto array|false gethostbynamel(string hostname)
Return a list of IP addresses that a given hostname resolves to. */
PHP_FUNCTION(gethostbynamel)
{
@@ -385,8 +381,8 @@ PHP_FUNCTION(dns_check_record)
ZEND_PARSE_PARAMETERS_END();
if (hostname_len == 0) {
- php_error_docref(NULL, E_WARNING, "Host cannot be empty");
- RETURN_FALSE;
+ zend_value_error("Host cannot be empty");
+ RETURN_THROWS();
}
if (rectype) {
@@ -837,13 +833,13 @@ PHP_FUNCTION(dns_get_record)
if (authns) {
authns = zend_try_array_init(authns);
if (!authns) {
- return;
+ RETURN_THROWS();
}
}
if (addtl) {
addtl = zend_try_array_init(addtl);
if (!addtl) {
- return;
+ RETURN_THROWS();
}
}
@@ -868,7 +864,7 @@ PHP_FUNCTION(dns_get_record)
* store_results is used to skip storing the results retrieved in step
* NUMTYPES+1 when results were already fetched.
* - In case of PHP_DNS_ANY we use the directly fetch DNS_T_ANY. (step NUMTYPES+1 )
- * - In case of raw mode, we query only the requestd type instead of looping type by type
+ * - In case of raw mode, we query only the requested type instead of looping type by type
* before going with the additional info stuff.
*/
@@ -1073,13 +1069,13 @@ PHP_FUNCTION(dns_get_mx)
mx_list = zend_try_array_init(mx_list);
if (!mx_list) {
- return;
+ RETURN_THROWS();
}
if (weight_list) {
weight_list = zend_try_array_init(weight_list);
if (!weight_list) {
- return;
+ RETURN_THROWS();
}
}
diff --git a/ext/standard/dns_win32.c b/ext/standard/dns_win32.c
index 9f4b1e768b..b1cf4986fd 100644
--- a/ext/standard/dns_win32.c
+++ b/ext/standard/dns_win32.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -51,7 +49,7 @@ PHP_FUNCTION(dns_get_mx) /* {{{ */
PDNS_RECORD pResult, pRec; /* Pointer to DNS_RECORD structure */
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sz|z", &hostname, &hostname_len, &mx_list, &weight_list) == FAILURE) {
- return;
+ RETURN_THROWS();
}
status = DnsQuery_A(hostname, DNS_TYPE_MX, DNS_QUERY_STANDARD, NULL, &pResult, NULL);
@@ -105,12 +103,12 @@ PHP_FUNCTION(dns_check_record)
PDNS_RECORD pResult; /* Pointer to DNS_RECORD structure */
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", &hostname, &hostname_len, &rectype, &rectype_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (hostname_len == 0) {
- php_error_docref(NULL, E_WARNING, "Host cannot be empty");
- RETURN_FALSE;
+ zend_value_error("Host cannot be empty");
+ RETURN_THROWS();
}
if (rectype) {
@@ -359,19 +357,19 @@ PHP_FUNCTION(dns_get_record)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|lz!z!b",
&hostname, &hostname_len, &type_param, &authns, &addtl, &raw) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (authns) {
authns = zend_try_array_init(authns);
if (!authns) {
- return;
+ RETURN_THROWS();
}
}
if (addtl) {
addtl = zend_try_array_init(addtl);
if (!addtl) {
- return;
+ RETURN_THROWS();
}
}
diff --git a/ext/standard/exec.c b/ext/standard/exec.c
index da8b5712cf..d343abcd00 100644
--- a/ext/standard/exec.c
+++ b/ext/standard/exec.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -199,6 +197,7 @@ done:
return pclose_return;
err:
pclose_return = -1;
+ RETVAL_FALSE;
goto done;
}
/* }}} */
@@ -217,7 +216,7 @@ static void php_exec_ex(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
Z_PARAM_ZVAL(ret_array)
}
Z_PARAM_ZVAL(ret_code)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (!cmd_len) {
php_error_docref(NULL, E_WARNING, "Cannot execute a blank command");
@@ -237,7 +236,7 @@ static void php_exec_ex(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
} else {
ret_array = zend_try_array_init(ret_array);
if (!ret_array) {
- return;
+ RETURN_THROWS();
}
}
@@ -249,7 +248,7 @@ static void php_exec_ex(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
}
/* }}} */
-/* {{{ proto string exec(string command [, array &output [, int &return_value]])
+/* {{{ proto string|false exec(string command [, array &output [, int &return_value]])
Execute an external program */
PHP_FUNCTION(exec)
{
@@ -257,7 +256,7 @@ PHP_FUNCTION(exec)
}
/* }}} */
-/* {{{ proto int system(string command [, int &return_value])
+/* {{{ proto int|false system(string command [, int &return_value])
Execute an external program and display output */
PHP_FUNCTION(system)
{
@@ -265,7 +264,7 @@ PHP_FUNCTION(system)
}
/* }}} */
-/* {{{ proto void passthru(string command [, int &return_value])
+/* {{{ proto bool passthru(string command [, int &return_value])
Execute an external program and display raw output */
PHP_FUNCTION(passthru)
{
@@ -485,8 +484,8 @@ PHP_FUNCTION(escapeshellcmd)
if (command_len) {
if (command_len != strlen(command)) {
- php_error_docref(NULL, E_ERROR, "Input string contains NULL bytes");
- return;
+ zend_type_error("Input string contains NULL bytes");
+ RETURN_THROWS();
}
RETVAL_STR(php_escape_shell_cmd(command));
} else {
@@ -506,17 +505,16 @@ PHP_FUNCTION(escapeshellarg)
Z_PARAM_STRING(argument, argument_len)
ZEND_PARSE_PARAMETERS_END();
- if (argument) {
- if (argument_len != strlen(argument)) {
- php_error_docref(NULL, E_ERROR, "Input string contains NULL bytes");
- return;
- }
- RETVAL_STR(php_escape_shell_arg(argument));
+ if (argument_len != strlen(argument)) {
+ zend_type_error("Input string contains NULL bytes");
+ RETURN_THROWS();
}
+
+ RETVAL_STR(php_escape_shell_arg(argument));
}
/* }}} */
-/* {{{ proto string shell_exec(string cmd)
+/* {{{ proto string|false shell_exec(string cmd)
Execute command via shell and return complete output as string */
PHP_FUNCTION(shell_exec)
{
@@ -558,7 +556,7 @@ PHP_FUNCTION(proc_nice)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_LONG(pri)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
errno = 0;
php_ignore_value(nice(pri));
diff --git a/ext/standard/exec.h b/ext/standard/exec.h
index 4849fe044c..b92c6dce8e 100644
--- a/ext/standard/exec.h
+++ b/ext/standard/exec.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/file.c b/ext/standard/file.c
index 12effbdb29..473d0510c2 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -353,8 +351,8 @@ PHP_FUNCTION(flock)
act = operation & 3;
if (act < 1 || act > 3) {
- php_error_docref(NULL, E_WARNING, "Illegal operation argument");
- RETURN_FALSE;
+ zend_value_error("Illegal operation argument");
+ RETURN_THROWS();
}
if (wouldblock) {
@@ -375,7 +373,7 @@ PHP_FUNCTION(flock)
#define PHP_META_UNSAFE ".\\+*?[^]$() "
-/* {{{ proto array get_meta_tags(string filename [, bool use_include_path])
+/* {{{ proto array|false get_meta_tags(string filename [, bool use_include_path])
Extracts all meta tag content attributes from a file and returns an array */
PHP_FUNCTION(get_meta_tags)
{
@@ -520,7 +518,7 @@ PHP_FUNCTION(get_meta_tags)
}
/* }}} */
-/* {{{ proto string file_get_contents(string filename [, bool use_include_path [, resource context [, int offset [, int maxlen]]]])
+/* {{{ proto string|false file_get_contents(string filename [, bool use_include_path [, resource context [, int offset [, int maxlen]]]])
Read the entire file into a string */
PHP_FUNCTION(file_get_contents)
{
@@ -545,8 +543,8 @@ PHP_FUNCTION(file_get_contents)
ZEND_PARSE_PARAMETERS_END();
if (ZEND_NUM_ARGS() == 5 && maxlen < 0) {
- php_error_docref(NULL, E_WARNING, "length must be greater than or equal to zero");
- RETURN_FALSE;
+ zend_value_error("Length must be greater than or equal to zero");
+ RETURN_THROWS();
}
context = php_stream_context_from_zval(zcontext, 0);
@@ -578,7 +576,7 @@ PHP_FUNCTION(file_get_contents)
}
/* }}} */
-/* {{{ proto int file_put_contents(string file, mixed data [, int flags [, resource context]])
+/* {{{ proto int|false file_put_contents(string file, mixed data [, int flags [, resource context]])
Write/Create a file with contents data and return the number of bytes written */
PHP_FUNCTION(file_put_contents)
{
@@ -694,7 +692,7 @@ PHP_FUNCTION(file_put_contents)
if (Z_OBJ_HT_P(data) != NULL) {
zval out;
- if (zend_std_cast_object_tostring(data, &out, IS_STRING) == SUCCESS) {
+ if (zend_std_cast_object_tostring(Z_OBJ_P(data), &out, IS_STRING) == SUCCESS) {
numbytes = php_stream_write(stream, Z_STRVAL(out), Z_STRLEN(out));
if (numbytes != Z_STRLEN(out)) {
php_error_docref(NULL, E_WARNING, "Only %zd of %zd bytes written, possibly out of free disk space", numbytes, Z_STRLEN(out));
@@ -720,7 +718,7 @@ PHP_FUNCTION(file_put_contents)
#define PHP_FILE_BUF_SIZE 80
-/* {{{ proto array file(string filename [, int flags[, resource context]])
+/* {{{ proto array|false file(string filename [, int flags[, resource context]])
Read entire file into an array */
PHP_FUNCTION(file)
{
@@ -747,8 +745,8 @@ PHP_FUNCTION(file)
ZEND_PARSE_PARAMETERS_END();
if (flags < 0 || flags > (PHP_FILE_USE_INCLUDE_PATH | PHP_FILE_IGNORE_NEW_LINES | PHP_FILE_SKIP_EMPTY_LINES | PHP_FILE_NO_DEFAULT_CONTEXT)) {
- php_error_docref(NULL, E_WARNING, "'" ZEND_LONG_FMT "' flag is not supported", flags);
- RETURN_FALSE;
+ zend_value_error("'" ZEND_LONG_FMT "' flag is not supported", flags);
+ RETURN_THROWS();
}
use_include_path = flags & PHP_FILE_USE_INCLUDE_PATH;
@@ -816,7 +814,7 @@ parse_eol:
}
/* }}} */
-/* {{{ proto string tempnam(string dir, string prefix)
+/* {{{ proto string|false tempnam(string dir, string prefix)
Create a unique filename in a directory */
PHP_FUNCTION(tempnam)
{
@@ -856,9 +854,7 @@ PHP_NAMED_FUNCTION(php_if_tmpfile)
{
php_stream *stream;
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
stream = php_stream_fopen_tmpfile();
@@ -887,7 +883,7 @@ PHP_NAMED_FUNCTION(php_if_fopen)
Z_PARAM_OPTIONAL
Z_PARAM_BOOL(use_include_path)
Z_PARAM_RESOURCE_EX(zcontext, 1, 0)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
context = php_stream_context_from_zval(zcontext, 0);
@@ -910,7 +906,7 @@ PHPAPI PHP_FUNCTION(fclose)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_RESOURCE(res)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
PHP_STREAM_TO_ZVAL(stream, res);
@@ -927,7 +923,7 @@ PHPAPI PHP_FUNCTION(fclose)
}
/* }}} */
-/* {{{ proto resource popen(string command, string mode)
+/* {{{ proto resource|false popen(string command, string mode)
Execute a command and open either a read or a write pipe to it */
PHP_FUNCTION(popen)
{
@@ -981,7 +977,7 @@ PHP_FUNCTION(pclose)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_RESOURCE(res)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
PHP_STREAM_TO_ZVAL(stream, res);
@@ -1001,7 +997,7 @@ PHPAPI PHP_FUNCTION(feof)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_RESOURCE(res)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
PHP_STREAM_TO_ZVAL(stream, res);
@@ -1029,7 +1025,7 @@ PHPAPI PHP_FUNCTION(fgets)
Z_PARAM_RESOURCE(res)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(len)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
PHP_STREAM_TO_ZVAL(stream, res);
@@ -1044,8 +1040,8 @@ PHPAPI PHP_FUNCTION(fgets)
efree(buf);
} else if (argc > 1) {
if (len <= 0) {
- php_error_docref(NULL, E_WARNING, "Length parameter must be greater than 0");
- RETURN_FALSE;
+ zend_value_error("Length parameter must be greater than 0");
+ RETURN_THROWS();
}
str = zend_string_alloc(len, 0);
@@ -1076,7 +1072,7 @@ PHPAPI PHP_FUNCTION(fgetc)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_RESOURCE(res)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
PHP_STREAM_TO_ZVAL(stream, res);
@@ -1093,55 +1089,6 @@ PHPAPI PHP_FUNCTION(fgetc)
}
/* }}} */
-/* {{{ proto string fgetss(resource fp [, int length [, string allowable_tags]])
- Get a line from file pointer and strip HTML tags */
-PHPAPI PHP_FUNCTION(fgetss)
-{
- zval *fd;
- zend_long bytes = 0;
- size_t len = 0;
- size_t actual_len, retval_len;
- char *buf = NULL, *retval;
- php_stream *stream;
- char *allowed_tags=NULL;
- size_t allowed_tags_len=0;
-
- ZEND_PARSE_PARAMETERS_START(1, 3)
- Z_PARAM_RESOURCE(fd)
- Z_PARAM_OPTIONAL
- Z_PARAM_LONG(bytes)
- Z_PARAM_STRING(allowed_tags, allowed_tags_len)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
-
- PHP_STREAM_TO_ZVAL(stream, fd);
-
- if (ZEND_NUM_ARGS() >= 2) {
- if (bytes <= 0) {
- php_error_docref(NULL, E_WARNING, "Length parameter must be greater than 0");
- RETURN_FALSE;
- }
-
- len = (size_t) bytes;
- buf = safe_emalloc(sizeof(char), (len + 1), 0);
- /*needed because recv doesn't set null char at end*/
- memset(buf, 0, len + 1);
- }
-
- if ((retval = php_stream_get_line(stream, buf, len, &actual_len)) == NULL) {
- if (buf != NULL) {
- efree(buf);
- }
- RETURN_FALSE;
- }
-
- retval_len = php_strip_tags(retval, actual_len, &stream->fgetss_state, allowed_tags, allowed_tags_len);
-
- // TODO: avoid reallocation ???
- RETVAL_STRINGL(retval, retval_len);
- efree(retval);
-}
-/* }}} */
-
/* {{{ proto mixed fscanf(resource stream, string format [, string ...])
Implements a mostly ANSI compatible fscanf() */
PHP_FUNCTION(fscanf)
@@ -1166,7 +1113,7 @@ PHP_FUNCTION(fscanf)
* with a leak if we have an invalid filehandle. This needs changing
* if the code behind ZEND_VERIFY_RESOURCE changed. - cc */
if (!what) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
buf = php_stream_get_line((php_stream *) what, NULL, 0, &len);
@@ -1201,7 +1148,7 @@ PHPAPI PHP_FUNCTION(fwrite)
Z_PARAM_STRING(input, inputlen)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(maxlen)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (ZEND_NUM_ARGS() == 2) {
num_bytes = inputlen;
@@ -1236,7 +1183,7 @@ PHPAPI PHP_FUNCTION(fflush)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_RESOURCE(res)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
PHP_STREAM_TO_ZVAL(stream, res);
@@ -1257,7 +1204,7 @@ PHPAPI PHP_FUNCTION(rewind)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_RESOURCE(res)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
PHP_STREAM_TO_ZVAL(stream, res);
@@ -1278,7 +1225,7 @@ PHPAPI PHP_FUNCTION(ftell)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_RESOURCE(res)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
PHP_STREAM_TO_ZVAL(stream, res);
@@ -1303,7 +1250,7 @@ PHPAPI PHP_FUNCTION(fseek)
Z_PARAM_LONG(offset)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(whence)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
PHP_STREAM_TO_ZVAL(stream, res);
@@ -1353,7 +1300,7 @@ PHP_FUNCTION(mkdir)
Z_PARAM_LONG(mode)
Z_PARAM_BOOL(recursive)
Z_PARAM_RESOURCE_EX(zcontext, 1, 0)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
context = php_stream_context_from_zval(zcontext, 0);
@@ -1374,7 +1321,7 @@ PHP_FUNCTION(rmdir)
Z_PARAM_PATH(dir, dir_len)
Z_PARAM_OPTIONAL
Z_PARAM_RESOURCE_EX(zcontext, 1, 0)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
context = php_stream_context_from_zval(zcontext, 0);
@@ -1399,7 +1346,7 @@ PHP_FUNCTION(readfile)
Z_PARAM_OPTIONAL
Z_PARAM_BOOL(use_include_path)
Z_PARAM_RESOURCE_EX(zcontext, 1, 0)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
context = php_stream_context_from_zval(zcontext, 0);
@@ -1430,7 +1377,7 @@ PHP_FUNCTION(umask)
ZEND_PARSE_PARAMETERS_START(0, 1)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(mask)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (ZEND_NUM_ARGS() == 0) {
umask(oldumask);
@@ -1452,7 +1399,7 @@ PHPAPI PHP_FUNCTION(fpassthru)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_RESOURCE(res)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
PHP_STREAM_TO_ZVAL(stream, res);
@@ -1476,7 +1423,7 @@ PHP_FUNCTION(rename)
Z_PARAM_PATH(new_name, new_name_len)
Z_PARAM_OPTIONAL
Z_PARAM_RESOURCE_EX(zcontext, 1, 0)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
wrapper = php_stream_locate_url_wrapper(old_name, NULL, 0);
@@ -1515,7 +1462,7 @@ PHP_FUNCTION(unlink)
Z_PARAM_PATH(filename, filename_len)
Z_PARAM_OPTIONAL
Z_PARAM_RESOURCE_EX(zcontext, 1, 0)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
context = php_stream_context_from_zval(zcontext, 0);
@@ -1545,11 +1492,11 @@ PHP_NAMED_FUNCTION(php_if_ftruncate)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_RESOURCE(fp)
Z_PARAM_LONG(size)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (size < 0) {
- php_error_docref(NULL, E_WARNING, "Negative size is not supported");
- RETURN_FALSE;
+ zend_value_error("Negative size is not supported");
+ RETURN_THROWS();
}
PHP_STREAM_TO_ZVAL(stream, fp);
@@ -1579,7 +1526,7 @@ PHP_NAMED_FUNCTION(php_if_fstat)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_RESOURCE(fp)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
PHP_STREAM_TO_ZVAL(stream, fp);
@@ -1798,13 +1745,13 @@ PHPAPI PHP_FUNCTION(fread)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_RESOURCE(res)
Z_PARAM_LONG(len)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
PHP_STREAM_TO_ZVAL(stream, res);
if (len <= 0) {
- php_error_docref(NULL, E_WARNING, "Length parameter must be greater than 0");
- RETURN_FALSE;
+ zend_value_error("Length parameter must be greater than 0");
+ RETURN_THROWS();
}
str = php_stream_read_to_str(stream, len);
@@ -1817,7 +1764,7 @@ PHPAPI PHP_FUNCTION(fread)
}
/* }}} */
-static const char *php_fgetcsv_lookup_trailing_spaces(const char *ptr, size_t len, const char delimiter) /* {{{ */
+static const char *php_fgetcsv_lookup_trailing_spaces(const char *ptr, size_t len) /* {{{ */
{
int inc_len;
unsigned char last_chars[2] = { 0, 0 };
@@ -1882,8 +1829,8 @@ PHP_FUNCTION(fputcsv)
if (delimiter_str != NULL) {
/* Make sure that there is at least one character in string */
if (delimiter_str_len < 1) {
- php_error_docref(NULL, E_WARNING, "delimiter must be a character");
- RETURN_FALSE;
+ zend_value_error("delimiter must be a character");
+ RETURN_THROWS();
} else if (delimiter_str_len > 1) {
php_error_docref(NULL, E_NOTICE, "delimiter must be a single character");
}
@@ -1894,8 +1841,8 @@ PHP_FUNCTION(fputcsv)
if (enclosure_str != NULL) {
if (enclosure_str_len < 1) {
- php_error_docref(NULL, E_WARNING, "enclosure must be a character");
- RETURN_FALSE;
+ zend_value_error("enclosure must be a character");
+ RETURN_THROWS();
} else if (enclosure_str_len > 1) {
php_error_docref(NULL, E_NOTICE, "enclosure must be a single character");
}
@@ -1986,7 +1933,7 @@ PHPAPI ssize_t php_fputcsv(php_stream *stream, zval *fields, char delimiter, cha
}
/* }}} */
-/* {{{ proto array fgetcsv(resource fp [,int length [, string delimiter [, string enclosure [, string escape]]]])
+/* {{{ proto array|false fgetcsv(resource fp [,int length [, string delimiter [, string enclosure [, string escape]]]])
Get line from file pointer and parse for CSV fields */
PHP_FUNCTION(fgetcsv)
{
@@ -1994,8 +1941,6 @@ PHP_FUNCTION(fgetcsv)
char enclosure = '"'; /* allow this to be set as parameter */
int escape = (unsigned char) '\\';
- /* first section exactly as php_fgetss */
-
zend_long len = 0;
size_t buf_len;
char *buf;
@@ -2022,8 +1967,8 @@ PHP_FUNCTION(fgetcsv)
if (delimiter_str != NULL) {
/* Make sure that there is at least one character in string */
if (delimiter_str_len < 1) {
- php_error_docref(NULL, E_WARNING, "delimiter must be a character");
- RETURN_FALSE;
+ zend_value_error("delimiter must be a character");
+ RETURN_THROWS();
} else if (delimiter_str_len > 1) {
php_error_docref(NULL, E_NOTICE, "delimiter must be a single character");
}
@@ -2034,8 +1979,8 @@ PHP_FUNCTION(fgetcsv)
if (enclosure_str != NULL) {
if (enclosure_str_len < 1) {
- php_error_docref(NULL, E_WARNING, "enclosure must be a character");
- RETURN_FALSE;
+ zend_value_error("enclosure must be a character");
+ RETURN_THROWS();
} else if (enclosure_str_len > 1) {
php_error_docref(NULL, E_NOTICE, "enclosure must be a single character");
}
@@ -2059,8 +2004,8 @@ PHP_FUNCTION(fgetcsv)
if (len_zv != NULL && Z_TYPE_P(len_zv) != IS_NULL) {
len = zval_get_long(len_zv);
if (len < 0) {
- php_error_docref(NULL, E_WARNING, "Length parameter may not be negative");
- RETURN_FALSE;
+ zend_value_error("Length parameter may not be negative");
+ RETURN_THROWS();
} else if (len == 0) {
len = -1;
}
@@ -2104,7 +2049,7 @@ PHPAPI void php_fgetcsv(php_stream *stream, char delimiter, char enclosure, int
/* Strip trailing space from buf, saving end of line in case required for enclosure field */
bptr = buf;
- tptr = (char *)php_fgetcsv_lookup_trailing_spaces(buf, buf_len, delimiter);
+ tptr = (char *)php_fgetcsv_lookup_trailing_spaces(buf, buf_len);
line_end_len = buf_len - (size_t)(tptr - buf);
line_end = limit = tptr;
@@ -2202,7 +2147,7 @@ PHPAPI void php_fgetcsv(php_stream *stream, char delimiter, char enclosure, int
bptr = buf = new_buf;
hunk_begin = buf;
- line_end = limit = (char *)php_fgetcsv_lookup_trailing_spaces(buf, buf_len, delimiter);
+ line_end = limit = (char *)php_fgetcsv_lookup_trailing_spaces(buf, buf_len);
line_end_len = buf_len - (size_t)(limit - buf);
state = 0;
@@ -2329,7 +2274,7 @@ PHPAPI void php_fgetcsv(php_stream *stream, char delimiter, char enclosure, int
memcpy(tptr, hunk_begin, bptr - hunk_begin);
tptr += (bptr - hunk_begin);
- comp_end = (char *)php_fgetcsv_lookup_trailing_spaces(temp, tptr - temp, delimiter);
+ comp_end = (char *)php_fgetcsv_lookup_trailing_spaces(temp, tptr - temp);
if (*bptr == delimiter) {
bptr++;
}
@@ -2349,7 +2294,7 @@ out:
/* }}} */
#if HAVE_REALPATH || defined(ZTS)
-/* {{{ proto string realpath(string path)
+/* {{{ proto string|false realpath(string path)
Return the resolved path */
PHP_FUNCTION(realpath)
{
@@ -2520,9 +2465,8 @@ PHP_FUNCTION(fnmatch)
Returns directory path used for temporary files */
PHP_FUNCTION(sys_get_temp_dir)
{
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
+
RETURN_STRING((char *)php_get_temporary_directory());
}
/* }}} */
diff --git a/ext/standard/file.h b/ext/standard/file.h
index a414f722fd..4e368cf545 100644
--- a/ext/standard/file.h
+++ b/ext/standard/file.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -35,7 +33,6 @@ PHPAPI PHP_FUNCTION(fread);
PHPAPI PHP_FUNCTION(fgetc);
PHPAPI PHP_FUNCTION(fgets);
PHP_FUNCTION(fscanf);
-PHPAPI PHP_FUNCTION(fgetss);
PHP_FUNCTION(fgetcsv);
PHP_FUNCTION(fputcsv);
PHPAPI PHP_FUNCTION(fwrite);
diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c
index bf2bc752b0..ab10bc06e9 100644
--- a/ext/standard/filestat.c
+++ b/ext/standard/filestat.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -178,7 +176,7 @@ static int php_disk_total_space(char *path, double *space) /* {{{ */
/* }}} */
/* }}} */
-/* {{{ proto float disk_total_space(string path)
+/* {{{ proto float|false disk_total_space(string path)
Get total disk space for filesystem that path is on */
PHP_FUNCTION(disk_total_space)
{
@@ -217,8 +215,7 @@ static int php_disk_free_space(char *path, double *space) /* {{{ */
return FAILURE;
}
- /* i know - this is ugly, but i works <thies@thieso.net> */
- *space = FreeBytesAvailableToCaller.HighPart * (double) (((zend_ulong)1) << 31) * 2.0 + FreeBytesAvailableToCaller.LowPart;
+ *space = FreeBytesAvailableToCaller.HighPart * (double) (1ULL << 32) + FreeBytesAvailableToCaller.LowPart;
PHP_WIN32_IOUTIL_CLEANUP_W()
@@ -273,7 +270,7 @@ static int php_disk_free_space(char *path, double *space) /* {{{ */
/* }}} */
/* }}} */
-/* {{{ proto float disk_free_space(string path)
+/* {{{ proto float|false disk_free_space(string path)
Get free disk space for filesystem that path is on */
PHP_FUNCTION(disk_free_space)
{
@@ -342,7 +339,7 @@ static void php_do_chgrp(INTERNAL_FUNCTION_PARAMETERS, int do_lchgrp) /* {{{ */
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_PATH(filename, filename_len)
Z_PARAM_ZVAL(group)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
wrapper = php_stream_locate_url_wrapper(filename, NULL, 0);
if(wrapper != &php_plain_files_wrapper || strncasecmp("file://", filename, 7) == 0) {
@@ -356,8 +353,8 @@ static void php_do_chgrp(INTERNAL_FUNCTION_PARAMETERS, int do_lchgrp) /* {{{ */
option = PHP_STREAM_META_GROUP_NAME;
value = Z_STRVAL_P(group);
} else {
- php_error_docref(NULL, E_WARNING, "parameter 2 should be string or int, %s given", zend_zval_type_name(group));
- RETURN_FALSE;
+ zend_type_error("Parameter 2 should be string or int, %s given", zend_zval_type_name(group));
+ RETURN_THROWS();
}
if(wrapper->wops->stream_metadata(wrapper, filename, option, value, NULL)) {
RETURN_TRUE;
@@ -385,8 +382,8 @@ static void php_do_chgrp(INTERNAL_FUNCTION_PARAMETERS, int do_lchgrp) /* {{{ */
RETURN_FALSE;
}
} else {
- php_error_docref(NULL, E_WARNING, "parameter 2 should be string or int, %s given", zend_zval_type_name(group));
- RETURN_FALSE;
+ zend_type_error("Parameter 2 should be string or int, %s given", zend_zval_type_name(group));
+ RETURN_THROWS();
}
/* Check the basedir */
@@ -492,7 +489,7 @@ static void php_do_chown(INTERNAL_FUNCTION_PARAMETERS, int do_lchown) /* {{{ */
option = PHP_STREAM_META_OWNER_NAME;
value = Z_STRVAL_P(user);
} else {
- php_error_docref(NULL, E_WARNING, "parameter 2 should be string or int, %s given", zend_zval_type_name(user));
+ php_error_docref(NULL, E_WARNING, "Parameter 2 should be string or int, %s given", zend_zval_type_name(user));
RETURN_FALSE;
}
if(wrapper->wops->stream_metadata(wrapper, filename, option, value, NULL)) {
@@ -522,7 +519,7 @@ static void php_do_chown(INTERNAL_FUNCTION_PARAMETERS, int do_lchown) /* {{{ */
RETURN_FALSE;
}
} else {
- php_error_docref(NULL, E_WARNING, "parameter 2 should be string or int, %s given", zend_zval_type_name(user));
+ php_error_docref(NULL, E_WARNING, "Parameter 2 should be string or int, %s given", zend_zval_type_name(user));
RETURN_FALSE;
}
@@ -1089,9 +1086,8 @@ FileFunction(php_if_stat, FS_STAT)
Get current size of realpath cache */
PHP_FUNCTION(realpath_cache_size)
{
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
+
RETURN_LONG(realpath_cache_size());
}
@@ -1101,9 +1097,7 @@ PHP_FUNCTION(realpath_cache_get)
{
realpath_cache_bucket **buckets = realpath_cache_get_buckets(), **end = buckets + realpath_cache_max_buckets();
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
array_init(return_value);
while(buckets < end) {
diff --git a/ext/standard/filters.c b/ext/standard/filters.c
index 83fcf2dcbf..5f7b6af005 100644
--- a/ext/standard/filters.c
+++ b/ext/standard/filters.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -166,136 +164,6 @@ static const php_stream_filter_factory strfilter_tolower_factory = {
};
/* }}} */
-/* {{{ strip_tags filter implementation */
-typedef struct _php_strip_tags_filter {
- const char *allowed_tags;
- int allowed_tags_len;
- uint8_t state;
- uint8_t persistent;
-} php_strip_tags_filter;
-
-static int php_strip_tags_filter_ctor(php_strip_tags_filter *inst, zend_string *allowed_tags, int persistent)
-{
- if (allowed_tags != NULL) {
- if (NULL == (inst->allowed_tags = pemalloc(ZSTR_LEN(allowed_tags) + 1, persistent))) {
- return FAILURE;
- }
- memcpy((char *)inst->allowed_tags, ZSTR_VAL(allowed_tags), ZSTR_LEN(allowed_tags) + 1);
- inst->allowed_tags_len = (int)ZSTR_LEN(allowed_tags);
- } else {
- inst->allowed_tags = NULL;
- }
- inst->state = 0;
- inst->persistent = persistent;
-
- return SUCCESS;
-}
-
-static void php_strip_tags_filter_dtor(php_strip_tags_filter *inst)
-{
- if (inst->allowed_tags != NULL) {
- pefree((void *)inst->allowed_tags, inst->persistent);
- }
-}
-
-static php_stream_filter_status_t strfilter_strip_tags_filter(
- php_stream *stream,
- php_stream_filter *thisfilter,
- php_stream_bucket_brigade *buckets_in,
- php_stream_bucket_brigade *buckets_out,
- size_t *bytes_consumed,
- int flags
- )
-{
- php_stream_bucket *bucket;
- size_t consumed = 0;
- php_strip_tags_filter *inst = (php_strip_tags_filter *) Z_PTR(thisfilter->abstract);
-
- while (buckets_in->head) {
- bucket = php_stream_bucket_make_writeable(buckets_in->head);
- consumed = bucket->buflen;
-
- bucket->buflen = php_strip_tags(bucket->buf, bucket->buflen, &(inst->state), inst->allowed_tags, inst->allowed_tags_len);
-
- php_stream_bucket_append(buckets_out, bucket);
- }
-
- if (bytes_consumed) {
- *bytes_consumed = consumed;
- }
-
- return PSFS_PASS_ON;
-}
-
-static void strfilter_strip_tags_dtor(php_stream_filter *thisfilter)
-{
- assert(Z_PTR(thisfilter->abstract) != NULL);
-
- php_strip_tags_filter_dtor((php_strip_tags_filter *)Z_PTR(thisfilter->abstract));
-
- pefree(Z_PTR(thisfilter->abstract), ((php_strip_tags_filter *)Z_PTR(thisfilter->abstract))->persistent);
-}
-
-static const php_stream_filter_ops strfilter_strip_tags_ops = {
- strfilter_strip_tags_filter,
- strfilter_strip_tags_dtor,
- "string.strip_tags"
-};
-
-static php_stream_filter *strfilter_strip_tags_create(const char *filtername, zval *filterparams, uint8_t persistent)
-{
- php_strip_tags_filter *inst;
- php_stream_filter *filter = NULL;
- zend_string *allowed_tags = NULL;
-
- php_error_docref(NULL, E_DEPRECATED, "The string.strip_tags filter is deprecated");
-
- if (filterparams != NULL) {
- if (Z_TYPE_P(filterparams) == IS_ARRAY) {
- smart_str tags_ss = {0};
- zval *tmp;
-
- ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(filterparams), tmp) {
- convert_to_string_ex(tmp);
- smart_str_appendc(&tags_ss, '<');
- smart_str_append(&tags_ss, Z_STR_P(tmp));
- smart_str_appendc(&tags_ss, '>');
- } ZEND_HASH_FOREACH_END();
- smart_str_0(&tags_ss);
- allowed_tags = tags_ss.s;
- } else {
- allowed_tags = zval_get_string(filterparams);
- }
-
- /* Exception during string conversion. */
- if (EG(exception)) {
- if (allowed_tags) {
- zend_string_release(allowed_tags);
- }
- return NULL;
- }
- }
-
- inst = pemalloc(sizeof(php_strip_tags_filter), persistent);
- if (php_strip_tags_filter_ctor(inst, allowed_tags, persistent) == SUCCESS) {
- filter = php_stream_filter_alloc(&strfilter_strip_tags_ops, inst, persistent);
- } else {
- pefree(inst, persistent);
- }
-
- if (allowed_tags) {
- zend_string_release(allowed_tags);
- }
-
- return filter;
-}
-
-static const php_stream_filter_factory strfilter_strip_tags_factory = {
- strfilter_strip_tags_create
-};
-
-/* }}} */
-
/* {{{ base64 / quoted_printable stream filter implementation */
typedef enum _php_conv_err_t {
@@ -1501,14 +1369,14 @@ static int strfilter_convert_append_bucket(
switch (err) {
case PHP_CONV_ERR_INVALID_SEQ:
- php_error_docref(NULL, E_WARNING, "stream filter (%s): invalid byte sequence", inst->filtername);
+ php_error_docref(NULL, E_WARNING, "Stream filter (%s): invalid byte sequence", inst->filtername);
goto out_failure;
case PHP_CONV_ERR_MORE:
if (ps != NULL) {
if (icnt > 0) {
if (inst->stub_len >= sizeof(inst->stub)) {
- php_error_docref(NULL, E_WARNING, "stream filter (%s): insufficient buffer", inst->filtername);
+ php_error_docref(NULL, E_WARNING, "Stream filter (%s): insufficient buffer", inst->filtername);
goto out_failure;
}
inst->stub[inst->stub_len++] = *(ps++);
@@ -1523,7 +1391,7 @@ static int strfilter_convert_append_bucket(
break;
case PHP_CONV_ERR_UNEXPECTED_EOS:
- php_error_docref(NULL, E_WARNING, "stream filter (%s): unexpected end of stream", inst->filtername);
+ php_error_docref(NULL, E_WARNING, "Stream filter (%s): unexpected end of stream", inst->filtername);
goto out_failure;
case PHP_CONV_ERR_TOO_BIG: {
@@ -1553,7 +1421,7 @@ static int strfilter_convert_append_bucket(
} break;
case PHP_CONV_ERR_UNKNOWN:
- php_error_docref(NULL, E_WARNING, "stream filter (%s): unknown error", inst->filtername);
+ php_error_docref(NULL, E_WARNING, "Stream filter (%s): unknown error", inst->filtername);
goto out_failure;
default:
@@ -1569,13 +1437,13 @@ static int strfilter_convert_append_bucket(
php_conv_convert(inst->cd, &ps, &icnt, &pd, &ocnt)));
switch (err) {
case PHP_CONV_ERR_INVALID_SEQ:
- php_error_docref(NULL, E_WARNING, "stream filter (%s): invalid byte sequence", inst->filtername);
+ php_error_docref(NULL, E_WARNING, "Stream filter (%s): invalid byte sequence", inst->filtername);
goto out_failure;
case PHP_CONV_ERR_MORE:
if (ps != NULL) {
if (icnt > sizeof(inst->stub)) {
- php_error_docref(NULL, E_WARNING, "stream filter (%s): insufficient buffer", inst->filtername);
+ php_error_docref(NULL, E_WARNING, "Stream filter (%s): insufficient buffer", inst->filtername);
goto out_failure;
}
memcpy(inst->stub, ps, icnt);
@@ -1583,7 +1451,7 @@ static int strfilter_convert_append_bucket(
ps += icnt;
icnt = 0;
} else {
- php_error_docref(NULL, E_WARNING, "stream filter (%s): unexpected octet values", inst->filtername);
+ php_error_docref(NULL, E_WARNING, "Stream filter (%s): unexpected octet values", inst->filtername);
goto out_failure;
}
break;
@@ -1615,7 +1483,7 @@ static int strfilter_convert_append_bucket(
} break;
case PHP_CONV_ERR_UNKNOWN:
- php_error_docref(NULL, E_WARNING, "stream filter (%s): unknown error", inst->filtername);
+ php_error_docref(NULL, E_WARNING, "Stream filter (%s): unknown error", inst->filtername);
goto out_failure;
default:
@@ -1715,7 +1583,7 @@ static php_stream_filter *strfilter_convert_create(const char *filtername, zval
int conv_mode = 0;
if (filterparams != NULL && Z_TYPE_P(filterparams) != IS_ARRAY) {
- php_error_docref(NULL, E_WARNING, "stream filter (%s): invalid filter parameter", filtername);
+ php_error_docref(NULL, E_WARNING, "Stream filter (%s): invalid filter parameter", filtername);
return NULL;
}
@@ -2044,7 +1912,6 @@ static const struct {
{ &strfilter_rot13_ops, &strfilter_rot13_factory },
{ &strfilter_toupper_ops, &strfilter_toupper_factory },
{ &strfilter_tolower_ops, &strfilter_tolower_factory },
- { &strfilter_strip_tags_ops, &strfilter_strip_tags_factory },
{ &strfilter_convert_ops, &strfilter_convert_factory },
{ &consumed_filter_ops, &consumed_filter_factory },
{ &chunked_filter_ops, &chunked_filter_factory },
diff --git a/ext/standard/flock_compat.c b/ext/standard/flock_compat.c
index fd9a2e0985..ecf28d8513 100644
--- a/ext/standard/flock_compat.c
+++ b/ext/standard/flock_compat.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/flock_compat.h b/ext/standard/flock_compat.h
index 49a68bf431..7c875792c6 100644
--- a/ext/standard/flock_compat.h
+++ b/ext/standard/flock_compat.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c
index 4ee68adefa..c8d912793a 100644
--- a/ext/standard/formatted_print.c
+++ b/ext/standard/formatted_print.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -389,26 +387,24 @@ php_sprintf_getnumber(char **buffer, size_t *len)
* "x" integer argument is printed as lowercase hexadecimal
* "X" integer argument is printed as uppercase hexadecimal
*
+ * nb_additional_parameters is used for throwing errors:
+ * - -1: ValueError is thrown (for vsprintf where args originates from an array)
+ * - 0 or more: ArgumentCountError is thrown
*/
static zend_string *
-php_formatted_print(zval *z_format, zval *args, int argc)
+php_formatted_print(char *format, size_t format_len, zval *args, int argc, int nb_additional_parameters)
{
size_t size = 240, outpos = 0;
int alignment, currarg, adjusting, argnum, width, precision;
- char *format, *temppos, padding;
+ char *temppos, padding;
zend_string *result;
int always_sign;
- size_t format_len;
-
- if (!try_convert_to_string(z_format)) {
- return NULL;
- }
+ int bad_arg_number = 0;
- format = Z_STRVAL_P(z_format);
- format_len = Z_STRLEN_P(z_format);
result = zend_string_alloc(size, 0);
currarg = 0;
+ argnum = 0;
while (format_len) {
int expprec;
@@ -452,7 +448,7 @@ php_formatted_print(zval *z_format, zval *args, int argc)
if (argnum <= 0) {
zend_string_efree(result);
- php_error_docref(NULL, E_WARNING, "Argument number must be greater than zero");
+ zend_value_error("Argument number must be greater than zero");
return NULL;
}
argnum--;
@@ -493,7 +489,7 @@ php_formatted_print(zval *z_format, zval *args, int argc)
PRINTF_DEBUG(("sprintf: getting width\n"));
if ((width = php_sprintf_getnumber(&format, &format_len)) < 0) {
efree(result);
- php_error_docref(NULL, E_WARNING, "Width must be greater than zero and less than %d", INT_MAX);
+ zend_value_error("Width must be greater than zero and less than %d", INT_MAX);
return NULL;
}
adjusting |= ADJ_WIDTH;
@@ -510,7 +506,7 @@ php_formatted_print(zval *z_format, zval *args, int argc)
if (isdigit((int)*format)) {
if ((precision = php_sprintf_getnumber(&format, &format_len)) < 0) {
efree(result);
- php_error_docref(NULL, E_WARNING, "Precision must be greater than zero and less than %d", INT_MAX);
+ zend_value_error("Precision must be greater than zero and less than %d", INT_MAX);
return NULL;
}
adjusting |= ADJ_PRECISION;
@@ -524,17 +520,17 @@ php_formatted_print(zval *z_format, zval *args, int argc)
PRINTF_DEBUG(("sprintf: precision=%d\n", precision));
}
- if (argnum >= argc) {
- efree(result);
- php_error_docref(NULL, E_WARNING, "Too few arguments");
- return NULL;
- }
-
if (*format == 'l') {
format++;
format_len--;
}
PRINTF_DEBUG(("sprintf: format character='%c'\n", *format));
+
+ if (argnum >= argc) {
+ bad_arg_number = 1;
+ continue;
+ }
+
/* now we expect to find a type specifier */
tmp = &args[argnum];
switch (*format) {
@@ -630,6 +626,16 @@ php_formatted_print(zval *z_format, zval *args, int argc)
}
}
+ if (bad_arg_number == 1) {
+ efree(result);
+ if (nb_additional_parameters == -1) {
+ zend_value_error("The arguments array must contain %d items, %d given", argnum + 1, argc);
+ } else {
+ zend_argument_count_error("%d parameters are required, %d given", argnum + nb_additional_parameters + 1, argc + nb_additional_parameters);
+ }
+ return NULL;
+ }
+
exit:
/* possibly, we have to make sure we have room for the terminating null? */
ZSTR_VAL(result)[outpos]=0;
@@ -667,17 +673,19 @@ php_formatted_print_get_array(zval *array, int *argc)
PHP_FUNCTION(user_sprintf)
{
zend_string *result;
- zval *format, *args;
+ char *format;
+ size_t format_len;
+ zval *args;
int argc;
ZEND_PARSE_PARAMETERS_START(1, -1)
- Z_PARAM_ZVAL(format)
+ Z_PARAM_STRING(format, format_len)
Z_PARAM_VARIADIC('*', args, argc)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
- result = php_formatted_print(format, args, argc);
+ result = php_formatted_print(format, format_len, args, argc, 1);
if (result == NULL) {
- RETURN_FALSE;
+ return;
}
RETVAL_STR(result);
}
@@ -688,20 +696,22 @@ PHP_FUNCTION(user_sprintf)
PHP_FUNCTION(vsprintf)
{
zend_string *result;
- zval *format, *array, *args;
+ char *format;
+ size_t format_len;
+ zval *array, *args;
int argc;
ZEND_PARSE_PARAMETERS_START(2, 2)
- Z_PARAM_ZVAL(format)
+ Z_PARAM_STRING(format, format_len)
Z_PARAM_ZVAL(array)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
args = php_formatted_print_get_array(array, &argc);
- result = php_formatted_print(format, args, argc);
+ result = php_formatted_print(format, format_len, args, argc, -1);
efree(args);
if (result == NULL) {
- RETURN_FALSE;
+ return;
}
RETVAL_STR(result);
}
@@ -713,17 +723,19 @@ PHP_FUNCTION(user_printf)
{
zend_string *result;
size_t rlen;
- zval *format, *args;
+ char *format;
+ size_t format_len;
+ zval *args;
int argc;
ZEND_PARSE_PARAMETERS_START(1, -1)
- Z_PARAM_ZVAL(format)
+ Z_PARAM_STRING(format, format_len)
Z_PARAM_VARIADIC('*', args, argc)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
- result = php_formatted_print(format, args, argc);
+ result = php_formatted_print(format, format_len, args, argc, 1);
if (result == NULL) {
- RETURN_FALSE;
+ return;
}
rlen = PHPWRITE(ZSTR_VAL(result), ZSTR_LEN(result));
zend_string_efree(result);
@@ -737,20 +749,22 @@ PHP_FUNCTION(vprintf)
{
zend_string *result;
size_t rlen;
- zval *format, *array, *args;
+ char *format;
+ size_t format_len;
+ zval *array, *args;
int argc;
ZEND_PARSE_PARAMETERS_START(2, 2)
- Z_PARAM_ZVAL(format)
+ Z_PARAM_STRING(format, format_len)
Z_PARAM_ZVAL(array)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
args = php_formatted_print_get_array(array, &argc);
- result = php_formatted_print(format, args, argc);
+ result = php_formatted_print(format, format_len, args, argc, -1);
efree(args);
if (result == NULL) {
- RETURN_FALSE;
+ return;
}
rlen = PHPWRITE(ZSTR_VAL(result), ZSTR_LEN(result));
zend_string_efree(result);
@@ -763,7 +777,9 @@ PHP_FUNCTION(vprintf)
PHP_FUNCTION(fprintf)
{
php_stream *stream;
- zval *arg1, *format, *args;
+ char *format;
+ size_t format_len;
+ zval *arg1, *args;
int argc;
zend_string *result;
@@ -773,15 +789,15 @@ PHP_FUNCTION(fprintf)
ZEND_PARSE_PARAMETERS_START(2, -1)
Z_PARAM_RESOURCE(arg1)
- Z_PARAM_ZVAL(format)
+ Z_PARAM_STRING(format, format_len)
Z_PARAM_VARIADIC('*', args, argc)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, arg1);
- result = php_formatted_print(format, args, argc);
+ result = php_formatted_print(format, format_len, args, argc, 2);
if (result == NULL) {
- RETURN_FALSE;
+ return;
}
php_stream_write(stream, ZSTR_VAL(result), ZSTR_LEN(result));
@@ -796,7 +812,9 @@ PHP_FUNCTION(fprintf)
PHP_FUNCTION(vfprintf)
{
php_stream *stream;
- zval *arg1, *format, *array, *args;
+ char *format;
+ size_t format_len;
+ zval *arg1, *array, *args;
int argc;
zend_string *result;
@@ -806,18 +824,18 @@ PHP_FUNCTION(vfprintf)
ZEND_PARSE_PARAMETERS_START(3, 3)
Z_PARAM_RESOURCE(arg1)
- Z_PARAM_ZVAL(format)
+ Z_PARAM_STRING(format, format_len)
Z_PARAM_ZVAL(array)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, arg1);
args = php_formatted_print_get_array(array, &argc);
- result = php_formatted_print(format, args, argc);
+ result = php_formatted_print(format, format_len, args, argc, -1);
efree(args);
if (result == NULL) {
- RETURN_FALSE;
+ return;
}
php_stream_write(stream, ZSTR_VAL(result), ZSTR_LEN(result));
diff --git a/ext/standard/fsock.c b/ext/standard/fsock.c
index fe8fbea85c..c0803fbbbb 100644
--- a/ext/standard/fsock.c
+++ b/ext/standard/fsock.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -56,7 +54,7 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent)
Z_PARAM_ZVAL(zerrno)
Z_PARAM_ZVAL(zerrstr)
Z_PARAM_DOUBLE(timeout)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (persistent) {
spprintf(&hashkey, 0, "pfsockopen__%s:" ZEND_LONG_FMT, host, port);
@@ -86,7 +84,7 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent)
efree(hostname);
}
if (stream == NULL) {
- php_error_docref(NULL, E_WARNING, "unable to connect to %s:" ZEND_LONG_FMT " (%s)", host, port, errstr == NULL ? "Unknown error" : ZSTR_VAL(errstr));
+ php_error_docref(NULL, E_WARNING, "Unable to connect to %s:" ZEND_LONG_FMT " (%s)", host, port, errstr == NULL ? "Unknown error" : ZSTR_VAL(errstr));
}
if (hashkey) {
diff --git a/ext/standard/fsock.h b/ext/standard/fsock.h
index b6fee88d89..0547ee6073 100644
--- a/ext/standard/fsock.h
+++ b/ext/standard/fsock.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/ftok.c b/ext/standard/ftok.c
index 9e4af788e3..0e1210acc9 100644
--- a/ext/standard/ftok.c
+++ b/ext/standard/ftok.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c
index 3a7dec4a3b..2c01e88f4f 100644
--- a/ext/standard/ftp_fopen_wrapper.c
+++ b/ext/standard/ftp_fopen_wrapper.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/head.c b/ext/standard/head.c
index 4d15815076..657510de5b 100644
--- a/ext/standard/head.c
+++ b/ext/standard/head.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -390,9 +388,7 @@ static void php_head_apply_header_list_to_hash(void *data, void *arg)
Return list of headers to be sent / already sent */
PHP_FUNCTION(headers_list)
{
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
array_init(return_value);
zend_llist_apply_with_argument(&SG(sapi_headers).headers, php_head_apply_header_list_to_hash, return_value);
diff --git a/ext/standard/head.h b/ext/standard/head.h
index 824a7e8d4f..4e1ae0b4c3 100644
--- a/ext/standard/head.h
+++ b/ext/standard/head.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/hrtime.c b/ext/standard/hrtime.c
index 2a6707f7bd..088bf6d9d8 100644
--- a/ext/standard/hrtime.c
+++ b/ext/standard/hrtime.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -183,7 +181,7 @@ PHP_FUNCTION(hrtime)
add_next_index_long(return_value, (zend_long)(t % (php_hrtime_t)NANO_IN_SEC));
}
#else
- RETURN_FALSE
+ RETURN_FALSE;
#endif
}
/* }}} */
diff --git a/ext/standard/hrtime.h b/ext/standard/hrtime.h
index edd68aaceb..fa47e1c49f 100644
--- a/ext/standard/hrtime.h
+++ b/ext/standard/hrtime.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/html.c b/ext/standard/html.c
index e9c46ba083..b7ca69d74e 100644
--- a/ext/standard/html.c
+++ b/ext/standard/html.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -454,7 +452,7 @@ det_charset:
}
}
if (!found) {
- php_error_docref(NULL, E_WARNING, "charset `%s' not supported, assuming utf-8",
+ php_error_docref(NULL, E_WARNING, "Charset `%s' not supported, assuming utf-8",
charset_hint);
}
}
diff --git a/ext/standard/html.h b/ext/standard/html.h
index df0e9ba377..a43c0c823d 100644
--- a/ext/standard/html.h
+++ b/ext/standard/html.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/html_tables.h b/ext/standard/html_tables.h
index b9daaf7a5f..40d84d3e66 100644
--- a/ext/standard/html_tables.h
+++ b/ext/standard/html_tables.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/html_tables/html_table_gen.php b/ext/standard/html_tables/html_table_gen.php
index 83e123738c..dbc0b4d42c 100755
--- a/ext/standard/html_tables/html_table_gen.php
+++ b/ext/standard/html_tables/html_table_gen.php
@@ -2,8 +2,6 @@
<?php
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -24,8 +22,6 @@
$t = <<<CODE
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/http.c b/ext/standard/http.c
index dbd71add81..4b6866d3f8 100644
--- a/ext/standard/http.c
+++ b/ext/standard/http.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -230,7 +228,7 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
}
/* }}} */
-/* {{{ proto string http_build_query(mixed formdata [, string prefix [, string arg_separator [, int enc_type]]])
+/* {{{ proto string|false http_build_query(mixed formdata [, string prefix [, string arg_separator [, int enc_type]]])
Generates a form-encoded query string from an associative array or object. */
PHP_FUNCTION(http_build_query)
{
@@ -246,7 +244,7 @@ PHP_FUNCTION(http_build_query)
Z_PARAM_STRING(prefix, prefix_len)
Z_PARAM_STRING(arg_sep, arg_sep_len)
Z_PARAM_LONG(enc_type)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (php_url_encode_hash_ex(HASH_OF(formdata), &formstr, prefix, prefix_len, NULL, 0, NULL, 0, (Z_TYPE_P(formdata) == IS_OBJECT ? formdata : NULL), arg_sep, (int)enc_type) == FAILURE) {
if (formstr.s) {
diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c
index 9632bd344e..dfda9d63f8 100644
--- a/ext/standard/http_fopen_wrapper.c
+++ b/ext/standard/http_fopen_wrapper.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/image.c b/ext/standard/image.c
index aaaf81ae9e..e7bc509e91 100644
--- a/ext/standard/image.c
+++ b/ext/standard/image.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -400,7 +398,7 @@ static unsigned int php_next_marker(php_stream * stream, int last_marker, int ff
extraneous++;
}
if (extraneous) {
- php_error_docref(NULL, E_WARNING, "corrupt JPEG data: %zu extraneous bytes before marker", extraneous);
+ php_error_docref(NULL, E_WARNING, "Corrupt JPEG data: %zu extraneous bytes before marker", extraneous);
}
}
a = 1;
@@ -438,7 +436,7 @@ static int php_skip_variable(php_stream * stream)
*/
static int php_read_APP(php_stream * stream, unsigned int marker, zval *info)
{
- unsigned short length;
+ size_t length;
char *buffer;
char markername[16];
zval *tmp;
@@ -449,7 +447,7 @@ static int php_read_APP(php_stream * stream, unsigned int marker, zval *info)
}
length -= 2; /* length includes itself */
- buffer = emalloc((size_t)length);
+ buffer = emalloc(length);
if (php_stream_read(stream, buffer, (size_t) length) != length) {
efree(buffer);
@@ -1223,7 +1221,7 @@ PHP_FUNCTION(image_type_to_mime_type)
}
/* }}} */
-/* {{{ proto string image_type_to_extension(int imagetype [, bool include_dot])
+/* {{{ proto string|false image_type_to_extension(int imagetype [, bool include_dot])
Get file extension for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype */
PHP_FUNCTION(image_type_to_extension)
{
@@ -1235,7 +1233,7 @@ PHP_FUNCTION(image_type_to_extension)
Z_PARAM_LONG(image_type)
Z_PARAM_OPTIONAL
Z_PARAM_BOOL(inc_dot)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
switch (image_type) {
case IMAGE_FILETYPE_GIF:
@@ -1298,14 +1296,14 @@ PHP_FUNCTION(image_type_to_extension)
/* {{{ php_imagetype
detect filetype from first bytes */
-PHPAPI int php_getimagetype(php_stream * stream, char *filetype)
+PHPAPI int php_getimagetype(php_stream * stream, char *input, char *filetype)
{
char tmp[12];
int twelve_bytes_read;
if ( !filetype) filetype = tmp;
if((php_stream_read(stream, filetype, 3)) != 3) {
- php_error_docref(NULL, E_NOTICE, "Read error!");
+ php_error_docref(NULL, E_NOTICE, "Error reading from %s!", input);
return IMAGE_FILETYPE_UNKNOWN;
}
@@ -1316,7 +1314,7 @@ PHPAPI int php_getimagetype(php_stream * stream, char *filetype)
return IMAGE_FILETYPE_JPEG;
} else if (!memcmp(filetype, php_sig_png, 3)) {
if (php_stream_read(stream, filetype+3, 5) != 5) {
- php_error_docref(NULL, E_NOTICE, "Read error!");
+ php_error_docref(NULL, E_NOTICE, "Error reading from %s!", input);
return IMAGE_FILETYPE_UNKNOWN;
}
if (!memcmp(filetype, php_sig_png, 8)) {
@@ -1337,7 +1335,7 @@ PHPAPI int php_getimagetype(php_stream * stream, char *filetype)
return IMAGE_FILETYPE_JPC;
} else if (!memcmp(filetype, php_sig_riff, 3)) {
if (php_stream_read(stream, filetype+3, 9) != 9) {
- php_error_docref(NULL, E_NOTICE, "Read error!");
+ php_error_docref(NULL, E_NOTICE, "Error reading from %s!", input);
return IMAGE_FILETYPE_UNKNOWN;
}
if (!memcmp(filetype+8, php_sig_webp, 4)) {
@@ -1348,7 +1346,7 @@ PHPAPI int php_getimagetype(php_stream * stream, char *filetype)
}
if (php_stream_read(stream, filetype+3, 1) != 1) {
- php_error_docref(NULL, E_NOTICE, "Read error!");
+ php_error_docref(NULL, E_NOTICE, "Error reading from %s!", input);
return IMAGE_FILETYPE_UNKNOWN;
}
/* BYTES READ: 4 */
@@ -1375,7 +1373,7 @@ PHPAPI int php_getimagetype(php_stream * stream, char *filetype)
return IMAGE_FILETYPE_WBMP;
}
if (!twelve_bytes_read) {
- php_error_docref(NULL, E_NOTICE, "Read error!");
+ php_error_docref(NULL, E_NOTICE, "Error reading from %s!", input);
return IMAGE_FILETYPE_UNKNOWN;
}
if (php_get_xbm(stream, NULL)) {
@@ -1385,7 +1383,7 @@ PHPAPI int php_getimagetype(php_stream * stream, char *filetype)
}
/* }}} */
-static void php_getimagesize_from_stream(php_stream *stream, zval *info, INTERNAL_FUNCTION_PARAMETERS) /* {{{ */
+static void php_getimagesize_from_stream(php_stream *stream, char *input, zval *info, INTERNAL_FUNCTION_PARAMETERS) /* {{{ */
{
int itype = 0;
struct gfxinfo *result = NULL;
@@ -1394,7 +1392,7 @@ static void php_getimagesize_from_stream(php_stream *stream, zval *info, INTERNA
RETURN_FALSE;
}
- itype = php_getimagetype(stream, NULL);
+ itype = php_getimagetype(stream, input, NULL);
switch( itype) {
case IMAGE_FILETYPE_GIF:
result = php_handle_gif(stream);
@@ -1499,7 +1497,7 @@ static void php_getimagesize_from_any(INTERNAL_FUNCTION_PARAMETERS, int mode) {
if (argc == 2) {
info = zend_try_array_init(info);
if (!info) {
- return;
+ RETURN_THROWS();
}
}
@@ -1510,15 +1508,15 @@ static void php_getimagesize_from_any(INTERNAL_FUNCTION_PARAMETERS, int mode) {
}
if (!stream) {
- RETURN_FALSE;
+ RETURN_FALSE;
}
- php_getimagesize_from_stream(stream, info, INTERNAL_FUNCTION_PARAM_PASSTHRU);
+ php_getimagesize_from_stream(stream, input, info, INTERNAL_FUNCTION_PARAM_PASSTHRU);
php_stream_close(stream);
}
/* }}} */
-/* {{{ proto array getimagesize(string imagefile [, array info])
+/* {{{ proto array|false getimagesize(string imagefile [, array info])
Get the size of an image as 4-element array */
PHP_FUNCTION(getimagesize)
{
@@ -1526,7 +1524,7 @@ PHP_FUNCTION(getimagesize)
}
/* }}} */
-/* {{{ proto array getimagesizefromstring(string data [, array info])
+/* {{{ proto array|false getimagesizefromstring(string data [, array info])
Get the size of an image as 4-element array */
PHP_FUNCTION(getimagesizefromstring)
{
diff --git a/ext/standard/incomplete_class.c b/ext/standard/incomplete_class.c
index f38fae5f53..c024373e7d 100644
--- a/ext/standard/incomplete_class.c
+++ b/ext/standard/incomplete_class.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -32,7 +30,7 @@ static zend_object_handlers php_incomplete_object_handlers;
/* {{{ incomplete_class_message
*/
-static void incomplete_class_message(zval *object, int error_type)
+static void incomplete_class_message(zend_object *object, int error_type)
{
zend_string *class_name;
@@ -47,7 +45,7 @@ static void incomplete_class_message(zval *object, int error_type)
}
/* }}} */
-static zval *incomplete_class_get_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) /* {{{ */
+static zval *incomplete_class_get_property(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv) /* {{{ */
{
incomplete_class_message(object, E_NOTICE);
@@ -60,27 +58,27 @@ static zval *incomplete_class_get_property(zval *object, zval *member, int type,
}
/* }}} */
-static zval *incomplete_class_write_property(zval *object, zval *member, zval *value, void **cache_slot) /* {{{ */
+static zval *incomplete_class_write_property(zend_object *object, zend_string *member, zval *value, void **cache_slot) /* {{{ */
{
incomplete_class_message(object, E_NOTICE);
return value;
}
/* }}} */
-static zval *incomplete_class_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) /* {{{ */
+static zval *incomplete_class_get_property_ptr_ptr(zend_object *object, zend_string *member, int type, void **cache_slot) /* {{{ */
{
incomplete_class_message(object, E_NOTICE);
return &EG(error_zval);
}
/* }}} */
-static void incomplete_class_unset_property(zval *object, zval *member, void **cache_slot) /* {{{ */
+static void incomplete_class_unset_property(zend_object *object, zend_string *member, void **cache_slot) /* {{{ */
{
incomplete_class_message(object, E_NOTICE);
}
/* }}} */
-static int incomplete_class_has_property(zval *object, zval *member, int check_empty, void **cache_slot) /* {{{ */
+static int incomplete_class_has_property(zend_object *object, zend_string *member, int check_empty, void **cache_slot) /* {{{ */
{
incomplete_class_message(object, E_NOTICE);
return 0;
@@ -89,10 +87,7 @@ static int incomplete_class_has_property(zval *object, zval *member, int check_e
static zend_function *incomplete_class_get_method(zend_object **object, zend_string *method, const zval *key) /* {{{ */
{
- zval zobject;
-
- ZVAL_OBJ(&zobject, *object);
- incomplete_class_message(&zobject, E_ERROR);
+ incomplete_class_message(*object, E_ERROR);
return NULL;
}
/* }}} */
@@ -113,9 +108,10 @@ static zend_object *php_create_incomplete_object(zend_class_entry *class_type)
PHPAPI zend_class_entry *php_create_incomplete_class(void)
{
- zend_class_entry incomplete_class;
+ zend_class_entry incomplete_class, *incomplete_class_entry;
INIT_CLASS_ENTRY(incomplete_class, INCOMPLETE_CLASS, NULL);
+
incomplete_class.create_object = php_create_incomplete_object;
memcpy(&php_incomplete_object_handlers, &std_object_handlers, sizeof(zend_object_handlers));
@@ -126,21 +122,23 @@ PHPAPI zend_class_entry *php_create_incomplete_class(void)
php_incomplete_object_handlers.get_property_ptr_ptr = incomplete_class_get_property_ptr_ptr;
php_incomplete_object_handlers.get_method = incomplete_class_get_method;
- return zend_register_internal_class(&incomplete_class);
+ incomplete_class_entry = zend_register_internal_class(&incomplete_class);
+ incomplete_class_entry->ce_flags |= ZEND_ACC_FINAL;
+
+ return incomplete_class_entry;
}
/* }}} */
/* {{{ php_lookup_class_name
*/
-PHPAPI zend_string *php_lookup_class_name(zval *object)
+PHPAPI zend_string *php_lookup_class_name(zend_object *object)
{
- zval *val;
- HashTable *object_properties;
-
- object_properties = Z_OBJPROP_P(object);
+ if (object->properties) {
+ zval *val = zend_hash_str_find(object->properties, MAGIC_MEMBER, sizeof(MAGIC_MEMBER)-1);
- if ((val = zend_hash_str_find(object_properties, MAGIC_MEMBER, sizeof(MAGIC_MEMBER)-1)) != NULL && Z_TYPE_P(val) == IS_STRING) {
- return zend_string_copy(Z_STR_P(val));
+ if (val != NULL && Z_TYPE_P(val) == IS_STRING) {
+ return zend_string_copy(Z_STR_P(val));
+ }
}
return NULL;
diff --git a/ext/standard/info.c b/ext/standard/info.c
index 1e58b31a0f..71d7139010 100644
--- a/ext/standard/info.c
+++ b/ext/standard/info.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -770,7 +768,7 @@ PHPAPI ZEND_COLD void php_print_info(int flag)
}
if (flag & PHP_INFO_GENERAL) {
- char *zend_version = get_zend_version();
+ const char *zend_version = get_zend_version();
char temp_api[10];
php_uname = php_get_uname('a');
@@ -1245,7 +1243,7 @@ void register_phpinfo_constants(INIT_FUNC_ARGS)
}
/* }}} */
-/* {{{ proto void phpinfo([int what])
+/* {{{ proto bool phpinfo([int what])
Output a page of useful information about PHP and the current request */
PHP_FUNCTION(phpinfo)
{
@@ -1266,7 +1264,7 @@ PHP_FUNCTION(phpinfo)
/* }}} */
-/* {{{ proto string phpversion([string extension])
+/* {{{ proto string|false phpversion([string extension])
Return the current PHP version */
PHP_FUNCTION(phpversion)
{
@@ -1291,7 +1289,7 @@ PHP_FUNCTION(phpversion)
}
/* }}} */
-/* {{{ proto void phpcredits([int flag])
+/* {{{ proto bool phpcredits([int flag])
Prints the list of people who've contributed to the PHP project */
PHP_FUNCTION(phpcredits)
{
@@ -1307,13 +1305,11 @@ PHP_FUNCTION(phpcredits)
}
/* }}} */
-/* {{{ proto string php_sapi_name(void)
+/* {{{ proto string|false php_sapi_name(void)
Return the current SAPI module name */
PHP_FUNCTION(php_sapi_name)
{
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
if (sapi_module.name) {
RETURN_STRING(sapi_module.name);
@@ -1324,7 +1320,7 @@ PHP_FUNCTION(php_sapi_name)
/* }}} */
-/* {{{ proto string php_uname(void)
+/* {{{ proto string php_uname([ string $mode = "a"])
Return information about the system PHP was built on */
PHP_FUNCTION(php_uname)
{
@@ -1341,13 +1337,11 @@ PHP_FUNCTION(php_uname)
/* }}} */
-/* {{{ proto string php_ini_scanned_files(void)
+/* {{{ proto string|false php_ini_scanned_files(void)
Return comma-separated string of .ini files parsed from the additional ini dir */
PHP_FUNCTION(php_ini_scanned_files)
{
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
if (php_ini_scanned_files) {
RETURN_STRING(php_ini_scanned_files);
@@ -1357,13 +1351,11 @@ PHP_FUNCTION(php_ini_scanned_files)
}
/* }}} */
-/* {{{ proto string php_ini_loaded_file(void)
+/* {{{ proto string|false php_ini_loaded_file(void)
Return the actual loaded ini filename */
PHP_FUNCTION(php_ini_loaded_file)
{
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
if (php_ini_opened_path) {
RETURN_STRING(php_ini_opened_path);
diff --git a/ext/standard/info.h b/ext/standard/info.h
index 479e5478c5..b965448a44 100644
--- a/ext/standard/info.h
+++ b/ext/standard/info.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/iptc.c b/ext/standard/iptc.c
index f3c17dadd9..2d4577b462 100644
--- a/ext/standard/iptc.c
+++ b/ext/standard/iptc.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -180,7 +178,7 @@ static int php_iptc_next_marker(FILE *fp, int spool, unsigned char **spoolbuf)
static char psheader[] = "\xFF\xED\0\0Photoshop 3.0\08BIM\x04\x04\0\0\0\0";
-/* {{{ proto array iptcembed(string iptcdata, string jpeg_file_name [, int spool])
+/* {{{ proto string|false iptcembed(string iptcdata, string jpeg_file_name [, int spool])
Embed binary IPTC data into a JPEG image. */
PHP_FUNCTION(iptcembed)
{
@@ -311,7 +309,7 @@ PHP_FUNCTION(iptcembed)
}
/* }}} */
-/* {{{ proto array iptcparse(string iptcdata)
+/* {{{ proto array|false iptcparse(string iptcdata)
Parse binary IPTC-data into associative array */
PHP_FUNCTION(iptcparse)
{
diff --git a/ext/standard/lcg.c b/ext/standard/lcg.c
index c649137eb6..fc81bde4cc 100644
--- a/ext/standard/lcg.c
+++ b/ext/standard/lcg.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -116,9 +114,8 @@ PHP_MINIT_FUNCTION(lcg) /* {{{ */
Returns a value from the combined linear congruential generator */
PHP_FUNCTION(lcg_value)
{
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
+
RETURN_DOUBLE(php_combined_lcg());
}
/* }}} */
diff --git a/ext/standard/levenshtein.c b/ext/standard/levenshtein.c
index a03e3441cb..7135670e83 100644
--- a/ext/standard/levenshtein.c
+++ b/ext/standard/levenshtein.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -101,21 +99,21 @@ PHP_FUNCTION(levenshtein)
switch (argc) {
case 2: /* just two strings: use maximum performance version */
if (zend_parse_parameters(2, "ss", &str1, &str1_len, &str2, &str2_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
distance = reference_levdist(str1, str1_len, str2, str2_len, 1, 1, 1);
break;
case 5: /* more general version: calc cost by ins/rep/del weights */
if (zend_parse_parameters(5, "sslll", &str1, &str1_len, &str2, &str2_len, &cost_ins, &cost_rep, &cost_del) == FAILURE) {
- return;
+ RETURN_THROWS();
}
distance = reference_levdist(str1, str1_len, str2, str2_len, cost_ins, cost_rep, cost_del);
break;
case 3: /* most general version: calc cost by user-supplied function */
if (zend_parse_parameters(3, "sss", &str1, &str1_len, &str2, &str2_len, &callback_name, &callback_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
distance = custom_levdist(str1, str2, callback_name);
break;
diff --git a/ext/standard/link.c b/ext/standard/link.c
index 1117049344..3172b34d66 100644
--- a/ext/standard/link.c
+++ b/ext/standard/link.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -62,7 +60,7 @@
#define VOLUME_NAME_DOS 0x0
#endif
-/* {{{ proto string readlink(string filename)
+/* {{{ proto string|false readlink(string filename)
Return the target of a symbolic link */
PHP_FUNCTION(readlink)
{
@@ -96,7 +94,7 @@ PHP_FUNCTION(readlink)
}
/* }}} */
-/* {{{ proto int linkinfo(string filename)
+/* {{{ proto int|false linkinfo(string filename)
Returns the st_dev field of the UNIX C stat structure describing the link */
PHP_FUNCTION(linkinfo)
{
@@ -130,7 +128,7 @@ PHP_FUNCTION(linkinfo)
}
/* }}} */
-/* {{{ proto int symlink(string target, string link)
+/* {{{ proto bool symlink(string target, string link)
Create a symbolic link */
PHP_FUNCTION(symlink)
{
@@ -189,7 +187,7 @@ PHP_FUNCTION(symlink)
}
/* }}} */
-/* {{{ proto int link(string target, string link)
+/* {{{ proto bool link(string target, string link)
Create a hard link */
PHP_FUNCTION(link)
{
diff --git a/ext/standard/mail.c b/ext/standard/mail.c
index b27923aca1..d08325c3fa 100644
--- a/ext/standard/mail.c
+++ b/ext/standard/mail.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -66,29 +64,6 @@
extern zend_long php_getuid(void);
-/* {{{ proto int ezmlm_hash(string addr)
- Calculate EZMLM list hash value. */
-PHP_FUNCTION(ezmlm_hash)
-{
- char *str = NULL;
- unsigned int h = 5381;
- size_t j, str_len;
-
- ZEND_PARSE_PARAMETERS_START(1, 1)
- Z_PARAM_STRING(str, str_len)
- ZEND_PARSE_PARAMETERS_END();
-
- for (j = 0; j < str_len; j++) {
- h = (h + (h << 5)) ^ (zend_ulong) (unsigned char) tolower(str[j]);
- }
-
- h = (h % 53);
-
- RETURN_LONG((zend_long) h);
-}
-/* }}} */
-
-
static zend_bool php_mail_build_headers_check_field_value(zval *val)
{
size_t len = 0;
@@ -153,7 +128,7 @@ static void php_mail_build_headers_elem(smart_str *s, zend_string *key, zval *va
php_mail_build_headers_elems(s, key, val);
break;
default:
- php_error_docref(NULL, E_WARNING, "headers array elements must be string or array (%s)", ZSTR_VAL(key));
+ php_error_docref(NULL, E_WARNING, "Headers array elements must be string or array (%s)", ZSTR_VAL(key));
}
}
@@ -177,16 +152,14 @@ static void php_mail_build_headers_elems(smart_str *s, zend_string *key, zval *v
}
-PHPAPI zend_string *php_mail_build_headers(zval *headers)
+PHPAPI zend_string *php_mail_build_headers(HashTable *headers)
{
zend_ulong idx;
zend_string *key;
zval *val;
smart_str s = {0};
- ZEND_ASSERT(Z_TYPE_P(headers) == IS_ARRAY);
-
- ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(headers), idx, key, val) {
+ ZEND_HASH_FOREACH_KEY_VAL(headers, idx, key, val) {
if (!key) {
php_error_docref(NULL, E_WARNING, "Found numeric header (" ZEND_LONG_FMT ")", idx);
continue;
@@ -275,14 +248,15 @@ PHPAPI zend_string *php_mail_build_headers(zval *headers)
}
-/* {{{ proto int mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]])
+/* {{{ proto bool mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]])
Send an email message */
PHP_FUNCTION(mail)
{
char *to=NULL, *message=NULL;
char *subject=NULL;
- zend_string *extra_cmd=NULL, *str_headers=NULL, *tmp_headers;
- zval *headers = NULL;
+ zend_string *extra_cmd=NULL;
+ zend_string *headers_str = NULL;
+ HashTable *headers_ht = NULL;
size_t to_len, message_len;
size_t subject_len, i;
char *force_extra_parameters = INI_STR("mail.force_extra_parameters");
@@ -294,7 +268,7 @@ PHP_FUNCTION(mail)
Z_PARAM_STRING(subject, subject_len)
Z_PARAM_STRING(message, message_len)
Z_PARAM_OPTIONAL
- Z_PARAM_ZVAL(headers)
+ Z_PARAM_STR_OR_ARRAY_HT(headers_str, headers_ht)
Z_PARAM_STR(extra_cmd)
ZEND_PARSE_PARAMETERS_END();
@@ -302,22 +276,13 @@ PHP_FUNCTION(mail)
MAIL_ASCIIZ_CHECK(to, to_len);
MAIL_ASCIIZ_CHECK(subject, subject_len);
MAIL_ASCIIZ_CHECK(message, message_len);
- if (headers) {
- switch(Z_TYPE_P(headers)) {
- case IS_STRING:
- tmp_headers = zend_string_init(Z_STRVAL_P(headers), Z_STRLEN_P(headers), 0);
- MAIL_ASCIIZ_CHECK(ZSTR_VAL(tmp_headers), ZSTR_LEN(tmp_headers));
- str_headers = php_trim(tmp_headers, NULL, 0, 2);
- zend_string_release_ex(tmp_headers, 0);
- break;
- case IS_ARRAY:
- str_headers = php_mail_build_headers(headers);
- break;
- default:
- php_error_docref(NULL, E_WARNING, "headers parameter must be string or array");
- RETURN_FALSE;
- }
+ if (headers_str) {
+ MAIL_ASCIIZ_CHECK(ZSTR_VAL(headers_str), ZSTR_LEN(headers_str));
+ headers_str = php_trim(headers_str, NULL, 0, 2);
+ } else if (headers_ht) {
+ headers_str = php_mail_build_headers(headers_ht);
}
+
if (extra_cmd) {
MAIL_ASCIIZ_CHECK(ZSTR_VAL(extra_cmd), ZSTR_LEN(extra_cmd));
}
@@ -368,14 +333,14 @@ PHP_FUNCTION(mail)
extra_cmd = php_escape_shell_cmd(ZSTR_VAL(extra_cmd));
}
- if (php_mail(to_r, subject_r, message, str_headers && ZSTR_LEN(str_headers) ? ZSTR_VAL(str_headers) : NULL, extra_cmd ? ZSTR_VAL(extra_cmd) : NULL)) {
+ if (php_mail(to_r, subject_r, message, headers_str && ZSTR_LEN(headers_str) ? ZSTR_VAL(headers_str) : NULL, extra_cmd ? ZSTR_VAL(extra_cmd) : NULL)) {
RETVAL_TRUE;
} else {
RETVAL_FALSE;
}
- if (str_headers) {
- zend_string_release_ex(str_headers, 0);
+ if (headers_str) {
+ zend_string_release_ex(headers_str, 0);
}
if (extra_cmd) {
diff --git a/ext/standard/math.c b/ext/standard/math.c
index ba7e3944aa..a97e781fd0 100644
--- a/ext/standard/math.c
+++ b/ext/standard/math.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -206,95 +204,16 @@ PHPAPI double _php_math_round(double value, int places, int mode) {
}
/* }}} */
-/* {{{ php_asinh
-*/
-static double php_asinh(double z)
-{
-#ifdef HAVE_ASINH
- return(asinh(z));
-#else
-# ifdef _WIN64
- if (z >= 0) {
- return log(z + sqrt(z * z + 1));
- }
- else {
- return -log(-z + sqrt(z * z + 1));
- }
-# else
- return(log(z + sqrt(1 + pow(z, 2))) / log(M_E));
-# endif
-#endif
-}
-/* }}} */
-
-/* {{{ php_acosh
-*/
-static double php_acosh(double x)
-{
-#ifdef HAVE_ACOSH
- return(acosh(x));
-#else
-# ifdef _WIN64
- if (x >= 1) {
- return log(x + sqrt(x * x - 1));
- } else {
- return ZEND_NAN;
- }
-# else
- return(log(x + sqrt(x * x - 1)));
-# endif
-#endif
-}
-/* }}} */
-
-/* {{{ php_atanh
-*/
-static double php_atanh(double z)
-{
-#ifdef HAVE_ATANH
- return(atanh(z));
-#else
- return(0.5 * log((1 + z) / (1 - z)));
-#endif
-}
-/* }}} */
-
-/* {{{ php_log1p
-*/
-static double php_log1p(double x)
-{
-#ifdef HAVE_LOG1P
- return(log1p(x));
-#else
- return(log(1 + x));
-#endif
-}
-/* }}} */
-
-/* {{{ php_expm1
-*/
-static double php_expm1(double x)
-{
-#ifndef PHP_WIN32
- return(expm1(x));
-#else
- return(exp(x) - 1);
-#endif
-}
-/* }}}*/
-
-/* {{{ proto int abs(int number)
+/* {{{ proto int|float abs(int|float number)
Return the absolute value of the number */
PHP_FUNCTION(abs)
{
zval *value;
ZEND_PARSE_PARAMETERS_START(1, 1)
- Z_PARAM_ZVAL(value)
+ Z_PARAM_NUMBER(value)
ZEND_PARSE_PARAMETERS_END();
- convert_scalar_to_number_ex(value);
-
if (Z_TYPE_P(value) == IS_DOUBLE) {
RETURN_DOUBLE(fabs(Z_DVAL_P(value)));
} else if (Z_TYPE_P(value) == IS_LONG) {
@@ -303,8 +222,9 @@ PHP_FUNCTION(abs)
} else {
RETURN_LONG(Z_LVAL_P(value) < 0 ? -Z_LVAL_P(value) : Z_LVAL_P(value));
}
+ } else {
+ ZEND_ASSERT(0 && "Unexpected type");
}
- RETURN_FALSE;
}
/* }}} */
@@ -315,17 +235,16 @@ PHP_FUNCTION(ceil)
zval *value;
ZEND_PARSE_PARAMETERS_START(1, 1)
- Z_PARAM_ZVAL(value)
+ Z_PARAM_NUMBER(value)
ZEND_PARSE_PARAMETERS_END();
- convert_scalar_to_number_ex(value);
-
if (Z_TYPE_P(value) == IS_DOUBLE) {
RETURN_DOUBLE(ceil(Z_DVAL_P(value)));
} else if (Z_TYPE_P(value) == IS_LONG) {
RETURN_DOUBLE(zval_get_double(value));
+ } else {
+ ZEND_ASSERT(0 && "Unexpected type");
}
- RETURN_FALSE;
}
/* }}} */
@@ -336,17 +255,16 @@ PHP_FUNCTION(floor)
zval *value;
ZEND_PARSE_PARAMETERS_START(1, 1)
- Z_PARAM_ZVAL(value)
+ Z_PARAM_NUMBER(value)
ZEND_PARSE_PARAMETERS_END();
- convert_scalar_to_number_ex(value);
-
if (Z_TYPE_P(value) == IS_DOUBLE) {
RETURN_DOUBLE(floor(Z_DVAL_P(value)));
} else if (Z_TYPE_P(value) == IS_LONG) {
RETURN_DOUBLE(zval_get_double(value));
+ } else {
+ ZEND_ASSERT(0 && "Unexpected type");
}
- RETURN_FALSE;
}
/* }}} */
@@ -361,7 +279,7 @@ PHP_FUNCTION(round)
double return_val;
ZEND_PARSE_PARAMETERS_START(1, 3)
- Z_PARAM_ZVAL(value)
+ Z_PARAM_NUMBER(value)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(precision)
Z_PARAM_LONG(mode)
@@ -378,7 +296,6 @@ PHP_FUNCTION(round)
places = precision;
#endif
}
- convert_scalar_to_number_ex(value);
switch (Z_TYPE_P(value)) {
case IS_LONG:
@@ -394,9 +311,7 @@ PHP_FUNCTION(round)
RETURN_DOUBLE(return_val);
break;
- default:
- RETURN_FALSE;
- break;
+ EMPTY_SWITCH_DEFAULT_CASE()
}
}
/* }}} */
@@ -541,7 +456,7 @@ PHP_FUNCTION(asinh)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_DOUBLE(num)
ZEND_PARSE_PARAMETERS_END();
- RETURN_DOUBLE(php_asinh(num));
+ RETURN_DOUBLE(asinh(num));
}
/* }}} */
@@ -554,7 +469,7 @@ PHP_FUNCTION(acosh)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_DOUBLE(num)
ZEND_PARSE_PARAMETERS_END();
- RETURN_DOUBLE(php_acosh(num));
+ RETURN_DOUBLE(acosh(num));
}
/* }}} */
@@ -567,7 +482,7 @@ PHP_FUNCTION(atanh)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_DOUBLE(num)
ZEND_PARSE_PARAMETERS_END();
- RETURN_DOUBLE(php_atanh(num));
+ RETURN_DOUBLE(atanh(num));
}
/* }}} */
@@ -575,6 +490,8 @@ PHP_FUNCTION(atanh)
Returns an approximation of pi */
PHP_FUNCTION(pi)
{
+ ZEND_PARSE_PARAMETERS_NONE();
+
RETURN_DOUBLE(M_PI);
}
/* }}} */
@@ -648,10 +565,7 @@ PHP_FUNCTION(exp)
/* }}} */
/* {{{ proto float expm1(float number)
- Returns exp(number) - 1, computed in a way that accurate even when the value of number is close to zero */
-/*
- WARNING: this function is expermental: it could change its name or
- disappear in the next version of PHP!
+ Returns exp(number) - 1, computed in a way that accurate even when the value of number is close to zero
*/
PHP_FUNCTION(expm1)
{
@@ -661,15 +575,12 @@ PHP_FUNCTION(expm1)
Z_PARAM_DOUBLE(num)
ZEND_PARSE_PARAMETERS_END();
- RETURN_DOUBLE(php_expm1(num));
+ RETURN_DOUBLE(expm1(num));
}
/* }}} */
/* {{{ proto float log1p(float number)
- Returns log(1 + number), computed in a way that accurate even when the value of number is close to zero */
-/*
- WARNING: this function is expermental: it could change its name or
- disappear in the next version of PHP!
+ Returns log(1 + number), computed in a way that accurate even when the value of number is close to zero
*/
PHP_FUNCTION(log1p)
{
@@ -679,7 +590,7 @@ PHP_FUNCTION(log1p)
Z_PARAM_DOUBLE(num)
ZEND_PARSE_PARAMETERS_END();
- RETURN_DOUBLE(php_log1p(num));
+ RETURN_DOUBLE(log1p(num));
}
/* }}} */
@@ -699,11 +610,9 @@ PHP_FUNCTION(log)
RETURN_DOUBLE(log(num));
}
-#ifdef HAVE_LOG2
if (base == 2.0) {
RETURN_DOUBLE(log2(num));
}
-#endif
if (base == 10.0) {
RETURN_DOUBLE(log10(num));
@@ -714,8 +623,8 @@ PHP_FUNCTION(log)
}
if (base <= 0.0) {
- php_error_docref(NULL, E_WARNING, "base must be greater than 0");
- RETURN_FALSE;
+ zend_value_error("Base must be greater than 0");
+ RETURN_THROWS();
}
RETURN_DOUBLE(log(num) / log(base));
@@ -761,13 +670,7 @@ PHP_FUNCTION(hypot)
Z_PARAM_DOUBLE(num2)
ZEND_PARSE_PARAMETERS_END();
-#if HAVE_HYPOT
RETURN_DOUBLE(hypot(num1, num2));
-#elif defined(_MSC_VER)
- RETURN_DOUBLE(_hypot(num1, num2));
-#else
- RETURN_DOUBLE(sqrt((num1 * num1) + (num2 * num2)));
-#endif
}
/* }}} */
@@ -846,7 +749,7 @@ PHPAPI zend_long _php_math_basetolong(zval *arg, int base)
/*
* Convert a string representation of a base(2-36) number to a zval.
*/
-PHPAPI int _php_math_basetozval(zval *arg, int base, zval *ret)
+PHPAPI void _php_math_basetozval(zend_string *str, int base, zval *ret)
{
zend_long num = 0;
double fnum = 0;
@@ -856,11 +759,8 @@ PHPAPI int _php_math_basetozval(zval *arg, int base, zval *ret)
int cutlim;
int invalidchars = 0;
- if (Z_TYPE_P(arg) != IS_STRING || base < 2 || base > 36) {
- return FAILURE;
- }
- s = Z_STRVAL_P(arg);
- e = s + Z_STRLEN_P(arg);
+ s = ZSTR_VAL(str);
+ e = s + ZSTR_LEN(str);
/* Skip leading whitespace */
while (s < e && isspace(*s)) s++;
@@ -920,7 +820,6 @@ PHPAPI int _php_math_basetozval(zval *arg, int base, zval *ret)
} else {
ZVAL_LONG(ret, num);
}
- return SUCCESS;
}
/* }}} */
@@ -994,54 +893,45 @@ PHPAPI zend_string * _php_math_zvaltobase(zval *arg, int base)
}
/* }}} */
-/* {{{ proto int bindec(string binary_number)
+/* {{{ proto int|float bindec(string binary_number)
Returns the decimal equivalent of the binary number */
PHP_FUNCTION(bindec)
{
- zval *arg;
+ zend_string *arg;
ZEND_PARSE_PARAMETERS_START(1, 1)
- Z_PARAM_ZVAL(arg)
+ Z_PARAM_STR(arg)
ZEND_PARSE_PARAMETERS_END();
- convert_to_string_ex(arg);
- if (_php_math_basetozval(arg, 2, return_value) == FAILURE) {
- RETURN_FALSE;
- }
+ _php_math_basetozval(arg, 2, return_value);
}
/* }}} */
-/* {{{ proto int hexdec(string hexadecimal_number)
+/* {{{ proto int|flat hexdec(string hexadecimal_number)
Returns the decimal equivalent of the hexadecimal number */
PHP_FUNCTION(hexdec)
{
- zval *arg;
+ zend_string *arg;
ZEND_PARSE_PARAMETERS_START(1, 1)
- Z_PARAM_ZVAL(arg)
+ Z_PARAM_STR(arg)
ZEND_PARSE_PARAMETERS_END();
- convert_to_string_ex(arg);
- if (_php_math_basetozval(arg, 16, return_value) == FAILURE) {
- RETURN_FALSE;
- }
+ _php_math_basetozval(arg, 16, return_value);
}
/* }}} */
-/* {{{ proto int octdec(string octal_number)
+/* {{{ proto int|float octdec(string octal_number)
Returns the decimal equivalent of an octal string */
PHP_FUNCTION(octdec)
{
- zval *arg;
+ zend_string *arg;
ZEND_PARSE_PARAMETERS_START(1, 1)
- Z_PARAM_ZVAL(arg)
+ Z_PARAM_STR(arg)
ZEND_PARSE_PARAMETERS_END();
- convert_to_string_ex(arg);
- if (_php_math_basetozval(arg, 8, return_value) == FAILURE) {
- RETURN_FALSE;
- }
+ _php_math_basetozval(arg, 8, return_value);
}
/* }}} */
@@ -1096,7 +986,7 @@ PHP_FUNCTION(dechex)
}
/* }}} */
-/* {{{ proto string base_convert(string number, int frombase, int tobase)
+/* {{{ proto string|false base_convert(string number, int frombase, int tobase)
Converts a number in a string from any base <= 36 to any base <= 36 */
PHP_FUNCTION(base_convert)
{
@@ -1111,21 +1001,19 @@ PHP_FUNCTION(base_convert)
ZEND_PARSE_PARAMETERS_END();
if (!try_convert_to_string(number)) {
- return;
+ RETURN_THROWS();
}
if (frombase < 2 || frombase > 36) {
- php_error_docref(NULL, E_WARNING, "Invalid `from base' (" ZEND_LONG_FMT ")", frombase);
- RETURN_FALSE;
+ zend_value_error("Invalid `from base' (" ZEND_LONG_FMT ")", frombase);
+ RETURN_THROWS();
}
if (tobase < 2 || tobase > 36) {
- php_error_docref(NULL, E_WARNING, "Invalid `to base' (" ZEND_LONG_FMT ")", tobase);
- RETURN_FALSE;
+ zend_value_error("Invalid `to base' (" ZEND_LONG_FMT ")", tobase);
+ RETURN_THROWS();
}
- if(_php_math_basetozval(number, (int)frombase, &temp) == FAILURE) {
- RETURN_FALSE;
- }
+ _php_math_basetozval(Z_STR_P(number), (int)frombase, &temp);
result = _php_math_zvaltobase(&temp, (int)tobase);
RETVAL_STR(result);
}
@@ -1270,8 +1158,8 @@ PHP_FUNCTION(number_format)
Z_PARAM_DOUBLE(num)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(dec)
- Z_PARAM_STRING_EX(dec_point, dec_point_len, 1, 0)
- Z_PARAM_STRING_EX(thousand_sep, thousand_sep_len, 1, 0)
+ Z_PARAM_STRING_OR_NULL(dec_point, dec_point_len)
+ Z_PARAM_STRING_OR_NULL(thousand_sep, thousand_sep_len)
ZEND_PARSE_PARAMETERS_END();
switch(ZEND_NUM_ARGS()) {
@@ -1316,6 +1204,25 @@ PHP_FUNCTION(fmod)
}
/* }}} */
+/* {{{ proto float fdiv(float dividend, float divisor)
+ Perform floating-point division of dividend / divisor
+ with IEEE-754 semantics for division by zero. */
+#ifdef __clang__
+__attribute__((no_sanitize("float-divide-by-zero")))
+#endif
+PHP_FUNCTION(fdiv)
+{
+ double dividend, divisor;
+
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_DOUBLE(dividend)
+ Z_PARAM_DOUBLE(divisor)
+ ZEND_PARSE_PARAMETERS_END();
+
+ RETURN_DOUBLE(dividend / divisor);
+}
+/* }}} */
+
/* {{{ proto int intdiv(int dividend, int divisor)
Returns the integer quotient of the division of dividend by divisor */
PHP_FUNCTION(intdiv)
@@ -1329,12 +1236,12 @@ PHP_FUNCTION(intdiv)
if (divisor == 0) {
zend_throw_exception_ex(zend_ce_division_by_zero_error, 0, "Division by zero");
- return;
+ RETURN_THROWS();
} else if (divisor == -1 && dividend == ZEND_LONG_MIN) {
/* Prevent overflow error/crash ... really should not happen:
We don't return a float here as that violates function contract */
zend_throw_exception_ex(zend_ce_arithmetic_error, 0, "Division of PHP_INT_MIN by -1 is not an integer");
- return;
+ RETURN_THROWS();
}
RETURN_LONG(dividend / divisor);
diff --git a/ext/standard/md5.c b/ext/standard/md5.c
index 463279a497..994ac1a1fe 100644
--- a/ext/standard/md5.c
+++ b/ext/standard/md5.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/md5.h b/ext/standard/md5.h
index 76bb08c5ac..a6aa4e7b0a 100644
--- a/ext/standard/md5.h
+++ b/ext/standard/md5.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/metaphone.c b/ext/standard/metaphone.c
index 16fd149571..aa6fa0e798 100644
--- a/ext/standard/metaphone.c
+++ b/ext/standard/metaphone.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -25,7 +23,7 @@
static int metaphone(unsigned char *word, size_t word_len, zend_long max_phonemes, zend_string **phoned_word, int traditional);
-/* {{{ proto string metaphone(string text[, int phones])
+/* {{{ proto string|false metaphone(string text[, int phones])
Break english phrases down into their phonemes */
PHP_FUNCTION(metaphone)
{
diff --git a/ext/standard/microtime.c b/ext/standard/microtime.c
index 9bd45e188d..8f7ac8b1ec 100644
--- a/ext/standard/microtime.c
+++ b/ext/standard/microtime.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -100,7 +98,7 @@ PHP_FUNCTION(gettimeofday)
/* }}} */
#ifdef HAVE_GETRUSAGE
-/* {{{ proto array getrusage([int who])
+/* {{{ proto array|false getrusage([int who])
Returns an array of usage statistics */
PHP_FUNCTION(getrusage)
{
diff --git a/ext/standard/microtime.h b/ext/standard/microtime.h
index 59fb3e4aba..949d10e50c 100644
--- a/ext/standard/microtime.h
+++ b/ext/standard/microtime.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/mt_rand.c b/ext/standard/mt_rand.c
index a176b95231..d83636ed01 100644
--- a/ext/standard/mt_rand.c
+++ b/ext/standard/mt_rand.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -327,8 +325,8 @@ PHP_FUNCTION(mt_rand)
ZEND_PARSE_PARAMETERS_END();
if (UNEXPECTED(max < min)) {
- php_error_docref(NULL, E_WARNING, "max(" ZEND_LONG_FMT ") is smaller than min(" ZEND_LONG_FMT ")", max, min);
- RETURN_FALSE;
+ zend_value_error("max (" ZEND_LONG_FMT ") is smaller than min (" ZEND_LONG_FMT ")", max, min);
+ RETURN_THROWS();
}
RETURN_LONG(php_mt_rand_common(min, max));
@@ -339,9 +337,7 @@ PHP_FUNCTION(mt_rand)
Returns the maximum value a random number from Mersenne Twister can have */
PHP_FUNCTION(mt_getrandmax)
{
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
/*
* Melo: it could be 2^^32 but we only use 2^^31 to maintain
diff --git a/ext/standard/net.c b/ext/standard/net.c
index 600ef8d0e0..535ab13f00 100644
--- a/ext/standard/net.c
+++ b/ext/standard/net.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/pack.c b/ext/standard/pack.c
index 15464910d9..94e8a304e7 100644
--- a/ext/standard/pack.c
+++ b/ext/standard/pack.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -300,7 +298,7 @@ PHP_FUNCTION(pack)
if (!try_convert_to_string(&argv[currentarg])) {
efree(formatcodes);
efree(formatargs);
- return;
+ RETURN_THROWS();
}
arg = Z_STRLEN(argv[currentarg]);
@@ -718,7 +716,7 @@ static zend_long php_unpack(char *data, size_t size, int issigned, int *map)
* Implemented formats are Z, A, a, h, H, c, C, s, S, i, I, l, L, n, N, q, Q, J, P, f, d, x, X, @.
* Added g, G for little endian float and big endian float, added e, E for little endian double and big endian double.
*/
-/* {{{ proto array unpack(string format, string input)
+/* {{{ proto array|false unpack(string format, string input)
Unpack binary string into named array elements according to format argument */
PHP_FUNCTION(unpack)
{
diff --git a/ext/standard/pack.h b/ext/standard/pack.h
index 3deeb1f270..ed58b9fcec 100644
--- a/ext/standard/pack.h
+++ b/ext/standard/pack.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/pageinfo.c b/ext/standard/pageinfo.c
index e0533efdd0..bdd5560ea5 100644
--- a/ext/standard/pageinfo.c
+++ b/ext/standard/pageinfo.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -96,9 +94,7 @@ PHP_FUNCTION(getmyuid)
{
zend_long uid;
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
uid = php_getuid();
if (uid < 0) {
@@ -115,9 +111,7 @@ PHP_FUNCTION(getmygid)
{
zend_long gid;
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
gid = php_getgid();
if (gid < 0) {
@@ -134,9 +128,7 @@ PHP_FUNCTION(getmypid)
{
zend_long pid;
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
pid = getpid();
if (pid < 0) {
@@ -151,9 +143,7 @@ PHP_FUNCTION(getmypid)
Get the inode of the current script being parsed */
PHP_FUNCTION(getmyinode)
{
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
php_statpage();
if (BG(page_inode) < 0) {
@@ -176,9 +166,7 @@ PHP_FUNCTION(getlastmod)
{
zend_long lm;
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
lm = php_getlastmod();
if (lm < 0) {
diff --git a/ext/standard/pageinfo.h b/ext/standard/pageinfo.h
index db0924c8cd..76543194dc 100644
--- a/ext/standard/pageinfo.h
+++ b/ext/standard/pageinfo.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/password.c b/ext/standard/password.c
index 9fe7fb1a42..cac1637fde 100644
--- a/ext/standard/password.c
+++ b/ext/standard/password.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -52,19 +50,6 @@ void php_password_algo_unregister(const char *ident) {
zend_hash_str_del(&php_password_algos, ident, strlen(ident));
}
-static int php_password_salt_is_alphabet(const char *str, const size_t len) /* {{{ */
-{
- size_t i = 0;
-
- for (i = 0; i < len; i++) {
- if (!((str[i] >= 'A' && str[i] <= 'Z') || (str[i] >= 'a' && str[i] <= 'z') || (str[i] >= '0' && str[i] <= '9') || str[i] == '.' || str[i] == '/')) {
- return FAILURE;
- }
- }
- return SUCCESS;
-}
-/* }}} */
-
static int php_password_salt_to64(const char *str, const size_t str_len, const size_t out_len, char *ret) /* {{{ */
{
size_t pos = 0;
@@ -98,20 +83,20 @@ static zend_string* php_password_make_salt(size_t length) /* {{{ */
zend_string *ret, *buffer;
if (length > (INT_MAX / 3)) {
- php_error_docref(NULL, E_WARNING, "Length is too large to safely generate");
+ zend_value_error("Length is too large to safely generate");
return NULL;
}
buffer = zend_string_alloc(length * 3 / 4 + 1, 0);
if (FAILURE == php_random_bytes_silent(ZSTR_VAL(buffer), ZSTR_LEN(buffer))) {
- php_error_docref(NULL, E_WARNING, "Unable to generate salt");
+ zend_value_error("Unable to generate salt");
zend_string_release_ex(buffer, 0);
return NULL;
}
ret = zend_string_alloc(length, 0);
if (php_password_salt_to64(ZSTR_VAL(buffer), ZSTR_LEN(buffer), length, ZSTR_VAL(ret)) == FAILURE) {
- php_error_docref(NULL, E_WARNING, "Generated salt too short");
+ zend_value_error("Generated salt too short");
zend_string_release_ex(buffer, 0);
zend_string_release_ex(ret, 0);
return NULL;
@@ -123,68 +108,11 @@ static zend_string* php_password_make_salt(size_t length) /* {{{ */
/* }}} */
static zend_string* php_password_get_salt(zval *unused_, size_t required_salt_len, HashTable *options) {
- zend_string *buffer;
- zval *option_buffer;
-
- if (!options || !(option_buffer = zend_hash_str_find(options, "salt", sizeof("salt") - 1))) {
- return php_password_make_salt(required_salt_len);
- }
-
- php_error_docref(NULL, E_DEPRECATED, "Use of the 'salt' option to password_hash is deprecated");
-
- switch (Z_TYPE_P(option_buffer)) {
- case IS_STRING:
- buffer = zend_string_copy(Z_STR_P(option_buffer));
- break;
- case IS_LONG:
- case IS_DOUBLE:
- case IS_OBJECT:
- buffer = zval_try_get_string(option_buffer);
- if (UNEXPECTED(!buffer)) {
- return NULL;
- }
- break;
- case IS_FALSE:
- case IS_TRUE:
- case IS_NULL:
- case IS_RESOURCE:
- case IS_ARRAY:
- default:
- php_error_docref(NULL, E_WARNING, "Non-string salt parameter supplied");
- return NULL;
- }
-
- /* XXX all the crypt related APIs work with int for string length.
- That should be revised for size_t and then we maybe don't require
- the > INT_MAX check. */
- if (ZEND_SIZE_T_INT_OVFL(ZSTR_LEN(buffer))) {
- php_error_docref(NULL, E_WARNING, "Supplied salt is too long");
- zend_string_release_ex(buffer, 0);
- return NULL;
+ if (options && zend_hash_str_exists(options, "salt", sizeof("salt") - 1)) {
+ php_error_docref(NULL, E_WARNING, "The 'salt' option is no longer supported. The provided salt has been been ignored");
}
- if (ZSTR_LEN(buffer) < required_salt_len) {
- php_error_docref(NULL, E_WARNING, "Provided salt is too short: %zd expecting %zd", ZSTR_LEN(buffer), required_salt_len);
- zend_string_release_ex(buffer, 0);
- return NULL;
- }
-
- if (php_password_salt_is_alphabet(ZSTR_VAL(buffer), ZSTR_LEN(buffer)) == FAILURE) {
- zend_string *salt = zend_string_alloc(required_salt_len, 0);
- if (php_password_salt_to64(ZSTR_VAL(buffer), ZSTR_LEN(buffer), required_salt_len, ZSTR_VAL(salt)) == FAILURE) {
- php_error_docref(NULL, E_WARNING, "Provided salt is too short: %zd", ZSTR_LEN(buffer));
- zend_string_release_ex(salt, 0);
- zend_string_release_ex(buffer, 0);
- return NULL;
- }
- zend_string_release_ex(buffer, 0);
- return salt;
- } else {
- zend_string *salt = zend_string_alloc(required_salt_len, 0);
- memcpy(ZSTR_VAL(salt), ZSTR_VAL(buffer), required_salt_len);
- zend_string_release_ex(buffer, 0);
- return salt;
- }
+ return php_password_make_salt(required_salt_len);
}
/* bcrypt implementation */
@@ -265,7 +193,7 @@ static zend_string* php_password_bcrypt_hash(const zend_string *password, zend_a
}
if (cost < 4 || cost > 31) {
- php_error_docref(NULL, E_WARNING, "Invalid bcrypt cost parameter specified: " ZEND_LONG_FMT, cost);
+ zend_value_error("Invalid bcrypt cost parameter specified: " ZEND_LONG_FMT, cost);
return NULL;
}
@@ -388,7 +316,7 @@ static zend_string *php_password_argon2_hash(const zend_string *password, zend_a
}
if (memory_cost > ARGON2_MAX_MEMORY || memory_cost < ARGON2_MIN_MEMORY) {
- php_error_docref(NULL, E_WARNING, "Memory cost is outside of allowed memory range");
+ zend_value_error("Memory cost is outside of allowed memory range");
return NULL;
}
@@ -397,7 +325,7 @@ static zend_string *php_password_argon2_hash(const zend_string *password, zend_a
}
if (time_cost > ARGON2_MAX_TIME || time_cost < ARGON2_MIN_TIME) {
- php_error_docref(NULL, E_WARNING, "Time cost is outside of allowed time range");
+ zend_value_error("Time cost is outside of allowed time range");
return NULL;
}
@@ -406,7 +334,7 @@ static zend_string *php_password_argon2_hash(const zend_string *password, zend_a
}
if (threads > ARGON2_MAX_LANES || threads == 0) {
- php_error_docref(NULL, E_WARNING, "Invalid number of threads");
+ zend_value_error("Invalid number of threads");
return NULL;
}
@@ -446,7 +374,7 @@ static zend_string *php_password_argon2_hash(const zend_string *password, zend_a
if (status != ARGON2_OK) {
zend_string_efree(encoded);
- php_error_docref(NULL, E_WARNING, "%s", argon2_error_message(status));
+ zend_value_error("%s", argon2_error_message(status));
return NULL;
}
@@ -632,7 +560,7 @@ const php_password_algo* php_password_algo_identify_ex(const zend_string* hash,
return (!algo || (algo->valid && !algo->valid(hash))) ? default_algo : algo;
}
-/* {{{ proto array password_get_info(string $hash)
+/* {{{ proto array|null password_get_info(string $hash)
Retrieves information about a given hash */
PHP_FUNCTION(password_get_info)
{
@@ -686,7 +614,7 @@ PHP_FUNCTION(password_needs_rehash)
Z_PARAM_STR(hash)
Z_PARAM_ZVAL(znew_algo)
Z_PARAM_OPTIONAL
- Z_PARAM_ARRAY_OR_OBJECT_HT(options)
+ Z_PARAM_ARRAY_HT(options)
ZEND_PARSE_PARAMETERS_END();
new_algo = php_password_algo_find_zval(znew_algo);
@@ -715,7 +643,7 @@ PHP_FUNCTION(password_verify)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_STR(password)
Z_PARAM_STR(hash)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
algo = php_password_algo_identify(hash);
RETURN_BOOL(algo && (!algo->verify || algo->verify(password, hash)));
@@ -735,21 +663,23 @@ PHP_FUNCTION(password_hash)
Z_PARAM_STR(password)
Z_PARAM_ZVAL(zalgo)
Z_PARAM_OPTIONAL
- Z_PARAM_ARRAY_OR_OBJECT_HT(options)
+ Z_PARAM_ARRAY_HT(options)
ZEND_PARSE_PARAMETERS_END();
algo = php_password_algo_find_zval(zalgo);
if (!algo) {
zend_string *algostr = zval_get_string(zalgo);
- php_error_docref(NULL, E_WARNING, "Unknown password hashing algorithm: %s", ZSTR_VAL(algostr));
+ zend_value_error("Unknown password hashing algorithm: %s", ZSTR_VAL(algostr));
zend_string_release(algostr);
- RETURN_NULL();
+ RETURN_THROWS();
}
digest = algo->hash(password, options);
if (!digest) {
- /* algo->hash should have raised an error. */
- RETURN_NULL();
+ if (!EG(exception)) {
+ zend_throw_error(NULL, "Password hashing failed for unknown reason");
+ }
+ RETURN_THROWS();
}
RETURN_NEW_STR(digest);
diff --git a/ext/standard/php_array.h b/ext/standard/php_array.h
index e15b116802..c8bca740af 100644
--- a/ext/standard/php_array.h
+++ b/ext/standard/php_array.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/php_assert.h b/ext/standard/php_assert.h
index 0cc10f7aa6..1289cc9b30 100644
--- a/ext/standard/php_assert.h
+++ b/ext/standard/php_assert.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/php_browscap.h b/ext/standard/php_browscap.h
index a2add821dd..aa8eafb0a0 100644
--- a/ext/standard/php_browscap.h
+++ b/ext/standard/php_browscap.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/php_crypt.h b/ext/standard/php_crypt.h
index 38410c9d20..d3ee90ee84 100644
--- a/ext/standard/php_crypt.h
+++ b/ext/standard/php_crypt.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/php_crypt_r.c b/ext/standard/php_crypt_r.c
index 479b8c7965..96e5905e5a 100644
--- a/ext/standard/php_crypt_r.c
+++ b/ext/standard/php_crypt_r.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/php_crypt_r.h b/ext/standard/php_crypt_r.h
index e5985e12d2..20cf215dfd 100644
--- a/ext/standard/php_crypt_r.h
+++ b/ext/standard/php_crypt_r.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/php_dir.h b/ext/standard/php_dir.h
index b72ad7b957..9d91e50ef2 100644
--- a/ext/standard/php_dir.h
+++ b/ext/standard/php_dir.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/php_dns.h b/ext/standard/php_dns.h
index 47c1e3ab5d..3f4a61f6d5 100644
--- a/ext/standard/php_dns.h
+++ b/ext/standard/php_dns.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/php_ext_syslog.h b/ext/standard/php_ext_syslog.h
index 3ae078951a..100f4b3ab5 100644
--- a/ext/standard/php_ext_syslog.h
+++ b/ext/standard/php_ext_syslog.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/php_filestat.h b/ext/standard/php_filestat.h
index 2b2e1838ca..d978f46796 100644
--- a/ext/standard/php_filestat.h
+++ b/ext/standard/php_filestat.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -57,7 +55,6 @@ PHP_FUNCTION(chmod);
#if HAVE_UTIME
PHP_FUNCTION(touch);
#endif
-PHP_FUNCTION(clearstatcache);
#ifdef PHP_WIN32
#define S_IRUSR S_IREAD
diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c
index 295751f0db..f525f868e4 100644
--- a/ext/standard/php_fopen_wrapper.c
+++ b/ext/standard/php_fopen_wrapper.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/php_fopen_wrappers.h b/ext/standard/php_fopen_wrappers.h
index 3c49ab4074..021a186448 100644
--- a/ext/standard/php_fopen_wrappers.h
+++ b/ext/standard/php_fopen_wrappers.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/php_ftok.h b/ext/standard/php_ftok.h
index 3f79fa58bc..3726c36bd1 100644
--- a/ext/standard/php_ftok.h
+++ b/ext/standard/php_ftok.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/php_http.h b/ext/standard/php_http.h
index b8ce4b1722..5a0dba0818 100644
--- a/ext/standard/php_http.h
+++ b/ext/standard/php_http.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/php_image.h b/ext/standard/php_image.h
index 5f9b07ddea..4bd972beac 100644
--- a/ext/standard/php_image.h
+++ b/ext/standard/php_image.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -58,7 +56,7 @@ typedef enum
PHP_MINIT_FUNCTION(imagetypes);
-PHPAPI int php_getimagetype(php_stream *stream, char *filetype);
+PHPAPI int php_getimagetype(php_stream *stream, char *input, char *filetype);
PHPAPI char * php_image_type_to_mime_type(int image_type);
diff --git a/ext/standard/php_incomplete_class.h b/ext/standard/php_incomplete_class.h
index d768f25bdb..03bd1daaca 100644
--- a/ext/standard/php_incomplete_class.h
+++ b/ext/standard/php_incomplete_class.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -27,7 +25,7 @@
#define PHP_SET_CLASS_ATTRIBUTES(struc) \
/* OBJECTS_FIXME: Fix for new object model */ \
if (Z_OBJCE_P(struc) == BG(incomplete_class)) { \
- class_name = php_lookup_class_name(struc); \
+ class_name = php_lookup_class_name(Z_OBJ_P(struc)); \
if (!class_name) { \
class_name = zend_string_init(INCOMPLETE_CLASS, sizeof(INCOMPLETE_CLASS) - 1, 0); \
} \
@@ -51,7 +49,7 @@ extern "C" {
#endif
PHPAPI zend_class_entry *php_create_incomplete_class(void);
-PHPAPI zend_string *php_lookup_class_name(zval *object);
+PHPAPI zend_string *php_lookup_class_name(zend_object *object);
PHPAPI void php_store_class_name(zval *object, const char *name, size_t len);
#ifdef __cplusplus
diff --git a/ext/standard/php_iptc.h b/ext/standard/php_iptc.h
index 1636ceaf63..999912599a 100644
--- a/ext/standard/php_iptc.h
+++ b/ext/standard/php_iptc.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/php_lcg.h b/ext/standard/php_lcg.h
index f3d52f138e..4feddb5c9b 100644
--- a/ext/standard/php_lcg.h
+++ b/ext/standard/php_lcg.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/php_link.h b/ext/standard/php_link.h
index 4b20077d5a..fb7d76ba85 100644
--- a/ext/standard/php_link.h
+++ b/ext/standard/php_link.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/php_mail.h b/ext/standard/php_mail.h
index 90e1497e0e..29fb5b77f4 100644
--- a/ext/standard/php_mail.h
+++ b/ext/standard/php_mail.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -20,11 +18,10 @@
#define PHP_MAIL_H
PHP_FUNCTION(mail);
-PHP_FUNCTION(ezmlm_hash);
PHP_MINFO_FUNCTION(mail);
-PHPAPI zend_string *php_mail_build_headers(zval *headers);
+PHPAPI zend_string *php_mail_build_headers(HashTable *headers);
PHPAPI extern int php_mail(char *to, char *subject, char *message, char *headers, char *extra_cmd);
#define PHP_MAIL_BUILD_HEADER_CHECK(target, s, key, val) \
diff --git a/ext/standard/php_math.h b/ext/standard/php_math.h
index 791a01c02d..cdc524f4a2 100644
--- a/ext/standard/php_math.h
+++ b/ext/standard/php_math.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -25,7 +23,7 @@ PHPAPI zend_string *_php_math_number_format(double, int, char, char);
PHPAPI zend_string *_php_math_number_format_ex(double, int, char *, size_t, char *, size_t);
PHPAPI zend_string * _php_math_longtobase(zval *arg, int base);
PHPAPI zend_long _php_math_basetolong(zval *arg, int base);
-PHPAPI int _php_math_basetozval(zval *arg, int base, zval *ret);
+PHPAPI void _php_math_basetozval(zend_string *str, int base, zval *ret);
PHPAPI zend_string * _php_math_zvaltobase(zval *arg, int base);
PHP_FUNCTION(sin);
@@ -61,12 +59,13 @@ PHP_FUNCTION(octdec);
PHP_FUNCTION(base_convert);
PHP_FUNCTION(number_format);
PHP_FUNCTION(fmod);
+PHP_FUNCTION(fdiv);
PHP_FUNCTION(deg2rad);
PHP_FUNCTION(rad2deg);
PHP_FUNCTION(intdiv);
/*
- WARNING: these functions are expermental: they could change their names or
+ WARNING: these functions are experimental: they could change their names or
disappear in the next version of PHP!
*/
PHP_FUNCTION(hypot);
diff --git a/ext/standard/php_metaphone.h b/ext/standard/php_metaphone.h
index 7543b4ef4c..c52bfe66a2 100644
--- a/ext/standard/php_metaphone.h
+++ b/ext/standard/php_metaphone.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/php_mt_rand.h b/ext/standard/php_mt_rand.h
index 9446421dbc..e3d9b652d3 100644
--- a/ext/standard/php_mt_rand.h
+++ b/ext/standard/php_mt_rand.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/php_net.h b/ext/standard/php_net.h
index c0a60eb060..5eb65491aa 100644
--- a/ext/standard/php_net.h
+++ b/ext/standard/php_net.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/php_password.h b/ext/standard/php_password.h
index 97a6bf63a2..d89f563f8f 100644
--- a/ext/standard/php_password.h
+++ b/ext/standard/php_password.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/php_rand.h b/ext/standard/php_rand.h
index 8cd47a5b5f..fdf2fc7d13 100644
--- a/ext/standard/php_rand.h
+++ b/ext/standard/php_rand.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/php_random.h b/ext/standard/php_random.h
index e61a80fa9e..c45a3249b9 100644
--- a/ext/standard/php_random.h
+++ b/ext/standard/php_random.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/php_smart_string.h b/ext/standard/php_smart_string.h
index b1042450ac..fbd1321e73 100644
--- a/ext/standard/php_smart_string.h
+++ b/ext/standard/php_smart_string.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/php_smart_string_public.h b/ext/standard/php_smart_string_public.h
index 5bb0c6c0be..a022b44c9e 100644
--- a/ext/standard/php_smart_string_public.h
+++ b/ext/standard/php_smart_string_public.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/php_standard.h b/ext/standard/php_standard.h
index 615264282e..21926d316f 100644
--- a/ext/standard/php_standard.h
+++ b/ext/standard/php_standard.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -37,7 +35,6 @@
#include "microtime.h"
#include "url.h"
#include "pageinfo.h"
-#include "cyr_convert.h"
#include "php_link.h"
#include "fsock.h"
#include "php_image.h"
diff --git a/ext/standard/php_string.h b/ext/standard/php_string.h
index 0bf88cb741..2c3953b958 100644
--- a/ext/standard/php_string.h
+++ b/ext/standard/php_string.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -54,7 +52,6 @@ PHP_FUNCTION(ucwords);
PHP_FUNCTION(strtr);
PHP_FUNCTION(strrev);
PHP_FUNCTION(hebrev);
-PHP_FUNCTION(hebrevc);
PHP_FUNCTION(user_sprintf);
PHP_FUNCTION(user_printf);
PHP_FUNCTION(vprintf);
@@ -92,9 +89,6 @@ PHP_FUNCTION(substr_compare);
PHP_FUNCTION(utf8_encode);
PHP_FUNCTION(utf8_decode);
PHP_FUNCTION(strcoll);
-#if HAVE_STRFMON
-PHP_FUNCTION(money_format);
-#endif
#if defined(ZTS)
PHP_MINIT_FUNCTION(localeconv);
@@ -129,9 +123,9 @@ PHPAPI char *php_stristr(char *s, char *t, size_t s_len, size_t t_len);
PHPAPI zend_string *php_str_to_str(const char *haystack, size_t length, const char *needle,
size_t needle_len, const char *str, size_t str_len);
PHPAPI zend_string *php_trim(zend_string *str, char *what, size_t what_len, int mode);
-PHPAPI size_t php_strip_tags(char *rbuf, size_t len, uint8_t *state, const char *allow, size_t allow_len);
-PHPAPI size_t php_strip_tags_ex(char *rbuf, size_t len, uint8_t *stateptr, const char *allow, size_t allow_len, zend_bool allow_tag_spaces);
-PHPAPI void php_implode(const zend_string *delim, zval *arr, zval *return_value);
+PHPAPI size_t php_strip_tags(char *rbuf, size_t len, const char *allow, size_t allow_len);
+PHPAPI size_t php_strip_tags_ex(char *rbuf, size_t len, const char *allow, size_t allow_len, zend_bool allow_tag_spaces);
+PHPAPI void php_implode(const zend_string *delim, HashTable *arr, zval *return_value);
PHPAPI void php_explode(const zend_string *delim, zend_string *str, zval *return_value, zend_long limit);
PHPAPI size_t php_strspn(char *s1, char *s2, char *s1_end, char *s2_end);
diff --git a/ext/standard/php_type.h b/ext/standard/php_type.h
index 9cd4cb22fe..be056201db 100644
--- a/ext/standard/php_type.h
+++ b/ext/standard/php_type.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/php_uuencode.h b/ext/standard/php_uuencode.h
index 7c350b4f18..40a1a20b21 100644
--- a/ext/standard/php_uuencode.h
+++ b/ext/standard/php_uuencode.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/php_var.h b/ext/standard/php_var.h
index 1342ae2565..d9abae86d2 100644
--- a/ext/standard/php_var.h
+++ b/ext/standard/php_var.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/php_versioning.h b/ext/standard/php_versioning.h
index 5b1ac2ec64..1c5041e0dc 100644
--- a/ext/standard/php_versioning.h
+++ b/ext/standard/php_versioning.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c
index d99d008771..f6dc9a0584 100644
--- a/ext/standard/proc_open.c
+++ b/ext/standard/proc_open.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -244,10 +242,10 @@ PHP_FUNCTION(proc_terminate)
Z_PARAM_RESOURCE(zproc)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(sig_no)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if ((proc = (struct php_process_handle *)zend_fetch_resource(Z_RES_P(zproc), "process", le_proc_open)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
#ifdef PHP_WIN32
@@ -266,7 +264,7 @@ PHP_FUNCTION(proc_terminate)
}
/* }}} */
-/* {{{ proto int proc_close(resource process)
+/* {{{ proto int|false proc_close(resource process)
close a process opened by proc_open */
PHP_FUNCTION(proc_close)
{
@@ -275,10 +273,10 @@ PHP_FUNCTION(proc_close)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_RESOURCE(zproc)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if ((proc = (struct php_process_handle *)zend_fetch_resource(Z_RES_P(zproc), "process", le_proc_open)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
FG(pclose_wait) = 1;
@@ -288,7 +286,7 @@ PHP_FUNCTION(proc_close)
}
/* }}} */
-/* {{{ proto array proc_get_status(resource process)
+/* {{{ proto array|false proc_get_status(resource process)
get information about a process opened by proc_open */
PHP_FUNCTION(proc_get_status)
{
@@ -305,10 +303,10 @@ PHP_FUNCTION(proc_get_status)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_RESOURCE(zproc)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if ((proc = (struct php_process_handle *)zend_fetch_resource(Z_RES_P(zproc), "process", le_proc_open)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
array_init(return_value);
@@ -403,8 +401,7 @@ static zend_string *get_valid_arg_string(zval *zv, int elem_num) {
}
if (strlen(ZSTR_VAL(str)) != ZSTR_LEN(str)) {
- php_error_docref(NULL, E_WARNING,
- "Command array element %d contains a null byte", elem_num);
+ zend_value_error("Command array element %d contains a null byte", elem_num);
zend_string_release(str);
return NULL;
}
@@ -470,7 +467,7 @@ static char *create_win_command_from_args(HashTable *args) {
}
#endif
-/* {{{ proto resource proc_open(string|array command, array descriptorspec, array &pipes [, string cwd [, array env [, array other_options]]])
+/* {{{ proto resource|false proc_open(string|array command, array descriptorspec, array &pipes [, string cwd [, array env [, array other_options]]])
Run a process with more control over it's file descriptors */
PHP_FUNCTION(proc_open)
{
@@ -520,10 +517,10 @@ PHP_FUNCTION(proc_open)
Z_PARAM_ARRAY(descriptorspec)
Z_PARAM_ZVAL(pipes)
Z_PARAM_OPTIONAL
- Z_PARAM_STRING_EX(cwd, cwd_len, 1, 0)
- Z_PARAM_ARRAY_EX(environment, 1, 0)
- Z_PARAM_ARRAY_EX(other_options, 1, 0)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ Z_PARAM_STRING_OR_NULL(cwd, cwd_len)
+ Z_PARAM_ARRAY_OR_NULL(environment)
+ Z_PARAM_ARRAY_OR_NULL(other_options)
+ ZEND_PARSE_PARAMETERS_END();
memset(&env, 0, sizeof(env));
@@ -531,8 +528,8 @@ PHP_FUNCTION(proc_open)
zval *arg_zv;
uint32_t num_elems = zend_hash_num_elements(Z_ARRVAL_P(command_zv));
if (num_elems == 0) {
- php_error_docref(NULL, E_WARNING, "Command array must have at least one element");
- RETURN_FALSE;
+ zend_value_error("Command array must have at least one element");
+ RETURN_THROWS();
}
#ifdef PHP_WIN32
@@ -624,7 +621,7 @@ PHP_FUNCTION(proc_open)
zval *ztype;
if (str_index) {
- php_error_docref(NULL, E_WARNING, "descriptor spec must be an integer indexed array");
+ zend_value_error("Descriptor spec must be an integer indexed array");
goto exit_fail;
}
@@ -644,20 +641,20 @@ PHP_FUNCTION(proc_open)
#ifdef PHP_WIN32
descriptors[ndesc].childend = dup_fd_as_handle((int)fd);
if (descriptors[ndesc].childend == NULL) {
- php_error_docref(NULL, E_WARNING, "unable to dup File-Handle for descriptor %d", nindex);
+ php_error_docref(NULL, E_WARNING, "Unable to dup File-Handle for descriptor %d", nindex);
goto exit_fail;
}
#else
descriptors[ndesc].childend = dup(fd);
if (descriptors[ndesc].childend < 0) {
- php_error_docref(NULL, E_WARNING, "unable to dup File-Handle for descriptor " ZEND_ULONG_FMT " - %s", nindex, strerror(errno));
+ php_error_docref(NULL, E_WARNING, "Unable to dup File-Handle for descriptor " ZEND_ULONG_FMT " - %s", nindex, strerror(errno));
goto exit_fail;
}
#endif
descriptors[ndesc].mode = DESC_FILE;
} else if (Z_TYPE_P(descitem) != IS_ARRAY) {
- php_error_docref(NULL, E_WARNING, "Descriptor item must be either an array or a File-Handle");
+ zend_value_error("Descriptor item must be either an array or a File-Handle");
goto exit_fail;
} else {
@@ -666,7 +663,7 @@ PHP_FUNCTION(proc_open)
goto exit_fail;
}
} else {
- php_error_docref(NULL, E_WARNING, "Missing handle qualifier in array");
+ zend_value_error("Missing handle qualifier in array");
goto exit_fail;
}
@@ -679,14 +676,14 @@ PHP_FUNCTION(proc_open)
goto exit_fail;
}
} else {
- php_error_docref(NULL, E_WARNING, "Missing mode parameter for 'pipe'");
+ zend_value_error("Missing mode parameter for 'pipe'");
goto exit_fail;
}
descriptors[ndesc].mode = DESC_PIPE;
if (0 != pipe(newpipe)) {
- php_error_docref(NULL, E_WARNING, "unable to create pipe %s", strerror(errno));
+ php_error_docref(NULL, E_WARNING, "Unable to create pipe %s", strerror(errno));
goto exit_fail;
}
@@ -720,7 +717,7 @@ PHP_FUNCTION(proc_open)
goto exit_fail;
}
} else {
- php_error_docref(NULL, E_WARNING, "Missing file name parameter for 'file'");
+ zend_value_error("Missing file name parameter for 'file'");
goto exit_fail;
}
@@ -729,7 +726,7 @@ PHP_FUNCTION(proc_open)
goto exit_fail;
}
} else {
- php_error_docref(NULL, E_WARNING, "Missing mode parameter for 'file'");
+ zend_value_error("Missing mode parameter for 'file'");
goto exit_fail;
}
@@ -762,11 +759,11 @@ PHP_FUNCTION(proc_open)
php_file_descriptor_t childend;
if (!ztarget) {
- php_error_docref(NULL, E_WARNING, "Missing redirection target");
+ zend_value_error("Missing redirection target");
goto exit_fail;
}
if (Z_TYPE_P(ztarget) != IS_LONG) {
- php_error_docref(NULL, E_WARNING, "Redirection target must be an integer");
+ zend_value_error("Redirection target must be an integer");
goto exit_fail;
}
@@ -840,7 +837,7 @@ PHP_FUNCTION(proc_open)
/* open things up */
dev_ptmx = open("/dev/ptmx", O_RDWR);
if (dev_ptmx == -1) {
- php_error_docref(NULL, E_WARNING, "failed to open /dev/ptmx, errno %d", errno);
+ php_error_docref(NULL, E_WARNING, "Failed to open /dev/ptmx, errno %d", errno);
goto exit_fail;
}
grantpt(dev_ptmx);
@@ -848,7 +845,7 @@ PHP_FUNCTION(proc_open)
slave_pty = open(ptsname(dev_ptmx), O_RDWR);
if (slave_pty == -1) {
- php_error_docref(NULL, E_WARNING, "failed to open slave pty, errno %d", errno);
+ php_error_docref(NULL, E_WARNING, "Failed to open slave pty, errno %d", errno);
goto exit_fail;
}
}
@@ -857,7 +854,7 @@ PHP_FUNCTION(proc_open)
descriptors[ndesc].parentend = dup(dev_ptmx);
descriptors[ndesc].mode_flags = O_RDWR;
#else
- php_error_docref(NULL, E_WARNING, "pty pseudo terminal not supported on this system");
+ php_error_docref(NULL, E_WARNING, "PTY pseudo terminal not supported on this system");
goto exit_fail;
#endif
} else {
@@ -1065,7 +1062,7 @@ PHP_FUNCTION(proc_open)
close(descriptors[i].parentend);
}
- php_error_docref(NULL, E_WARNING, "fork failed - %s", strerror(errno));
+ php_error_docref(NULL, E_WARNING, "Fork failed - %s", strerror(errno));
goto exit_fail;
diff --git a/ext/standard/proc_open.h b/ext/standard/proc_open.h
index b7a29220d1..c637e7ba26 100644
--- a/ext/standard/proc_open.h
+++ b/ext/standard/proc_open.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/quot_print.c b/ext/standard/quot_print.c
index 336a4cc0bb..19dc2e652a 100644
--- a/ext/standard/quot_print.c
+++ b/ext/standard/quot_print.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/quot_print.h b/ext/standard/quot_print.h
index 2cdf403a4e..d27f6f1d2d 100644
--- a/ext/standard/quot_print.h
+++ b/ext/standard/quot_print.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/rand.c b/ext/standard/rand.c
index 8c47a89f4f..be4d55c6c0 100644
--- a/ext/standard/rand.c
+++ b/ext/standard/rand.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/random.c b/ext/standard/random.c
index 2ab0e8ed80..a887d97e8a 100644
--- a/ext/standard/random.c
+++ b/ext/standard/random.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -202,20 +200,20 @@ PHP_FUNCTION(random_bytes)
zend_long size;
zend_string *bytes;
- ZEND_PARSE_PARAMETERS_START_EX(ZEND_PARSE_PARAMS_THROW, 1, 1)
+ ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_LONG(size)
ZEND_PARSE_PARAMETERS_END();
if (size < 1) {
zend_throw_exception(zend_ce_error, "Length must be greater than 0", 0);
- return;
+ RETURN_THROWS();
}
bytes = zend_string_alloc(size, 0);
if (php_random_bytes_throw(ZSTR_VAL(bytes), size) == FAILURE) {
zend_string_release_ex(bytes, 0);
- return;
+ RETURN_THROWS();
}
ZSTR_VAL(bytes)[size] = '\0';
@@ -276,18 +274,18 @@ PHP_FUNCTION(random_int)
zend_long max;
zend_long result;
- ZEND_PARSE_PARAMETERS_START_EX(ZEND_PARSE_PARAMS_THROW, 2, 2)
+ ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_LONG(min)
Z_PARAM_LONG(max)
ZEND_PARSE_PARAMETERS_END();
if (min > max) {
zend_throw_exception(zend_ce_error, "Minimum value must be less than or equal to the maximum value", 0);
- return;
+ RETURN_THROWS();
}
if (php_random_int_throw(min, max, &result) == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_LONG(result);
diff --git a/ext/standard/scanf.c b/ext/standard/scanf.c
index fc48315973..1464008243 100644
--- a/ext/standard/scanf.c
+++ b/ext/standard/scanf.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -389,7 +387,7 @@ notXpg:
gotSequential = 1;
if (gotXpg) {
mixedXPG:
- php_error_docref(NULL, E_WARNING, "%s", "cannot mix \"%\" and \"%n$\" conversion specifiers");
+ zend_value_error("%s", "cannot mix \"%\" and \"%n$\" conversion specifiers");
goto error;
}
@@ -471,11 +469,11 @@ xpgCheckDone:
}
break;
badSet:
- php_error_docref(NULL, E_WARNING, "Unmatched [ in format string");
+ zend_value_error("Unmatched [ in format string");
goto error;
default: {
- php_error_docref(NULL, E_WARNING, "Bad scan conversion character \"%c\"", *ch);
+ zend_value_error("Bad scan conversion character \"%c\"", *ch);
goto error;
}
}
@@ -525,14 +523,14 @@ badSet:
}
for (i = 0; i < numVars; i++) {
if (nassign[i] > 1) {
- php_error_docref(NULL, E_WARNING, "%s", "Variable is assigned by multiple \"%n$\" conversion specifiers");
+ zend_value_error("%s", "Variable is assigned by multiple \"%n$\" conversion specifiers");
goto error;
} else if (!xpgSize && (nassign[i] == 0)) {
/*
* If the space is empty, and xpgSize is 0 (means XPG wasn't
* used, and/or numVars != 0), then too many vars were given
*/
- php_error_docref(NULL, E_WARNING, "Variable is not assigned by any conversion specifiers");
+ zend_value_error("Variable is not assigned by any conversion specifiers");
goto error;
}
}
@@ -544,9 +542,9 @@ badSet:
badIndex:
if (gotXpg) {
- php_error_docref(NULL, E_WARNING, "%s", "\"%n$\" argument index out of range");
+ zend_value_error("%s", "\"%n$\" argument index out of range");
} else {
- php_error_docref(NULL, E_WARNING, "Different numbers of variable names and field specifiers");
+ zend_value_error("Different numbers of variable names and field specifiers");
}
error:
@@ -600,10 +598,6 @@ PHPAPI int php_sscanf_internal( char *string, char *format,
numVars = 0;
}
-#if 0
- zend_printf("<br>in sscanf_internal : <br> string is \"%s\", format = \"%s\"<br> NumVars = %d. VarStart = %d<br>-------------------------<br>",
- string, format, numVars, varStart);
-#endif
/*
* Check for errors in the format string.
*/
@@ -619,11 +613,7 @@ PHPAPI int php_sscanf_internal( char *string, char *format,
*/
if (numVars) {
for (i = varStart;i < argCount;i++){
- if ( ! Z_ISREF(args[ i ] ) ) {
- php_error_docref(NULL, E_WARNING, "Parameter %d must be passed by reference", i);
- scan_set_error_return(numVars, return_value);
- return SCAN_ERROR_VAR_PASSED_BYVAL;
- }
+ ZEND_ASSERT(Z_ISREF(args[i]) && "Parameter must be passed by reference");
}
}
diff --git a/ext/standard/scanf.h b/ext/standard/scanf.h
index 7b958e8b23..ea5f2dc2f5 100644
--- a/ext/standard/scanf.h
+++ b/ext/standard/scanf.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -30,10 +28,7 @@
/* can be caused by bad parameters or format*/
/* string. */
#define SCAN_ERROR_INVALID_FORMAT (SCAN_ERROR_EOF - 1)
-#define SCAN_ERROR_VAR_PASSED_BYVAL (SCAN_ERROR_INVALID_FORMAT - 1)
-#define SCAN_ERROR_WRONG_PARAM_COUNT (SCAN_ERROR_VAR_PASSED_BYVAL - 1)
-#define SCAN_ERROR_INTERNAL (SCAN_ERROR_WRONG_PARAM_COUNT - 1)
-
+#define SCAN_ERROR_WRONG_PARAM_COUNT (SCAN_ERROR_INVALID_FORMAT - 1)
/*
* The following are here solely for the benefit of the scanf type functions
diff --git a/ext/standard/sha1.c b/ext/standard/sha1.c
index 148b2dbb24..269fe8a947 100644
--- a/ext/standard/sha1.c
+++ b/ext/standard/sha1.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/sha1.h b/ext/standard/sha1.h
index 594c4a3f3e..b1788a6739 100644
--- a/ext/standard/sha1.h
+++ b/ext/standard/sha1.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/soundex.c b/ext/standard/soundex.c
index 0f46fbfdfe..37cce07601 100644
--- a/ext/standard/soundex.c
+++ b/ext/standard/soundex.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c
index 24d8357d7f..aca0d72928 100644
--- a/ext/standard/streamsfuncs.c
+++ b/ext/standard/streamsfuncs.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -49,7 +47,7 @@ static php_stream_context *decode_context_param(zval *contextresource);
/* Streams based network functions */
#if HAVE_SOCKETPAIR
-/* {{{ proto array stream_socket_pair(int domain, int type, int protocol)
+/* {{{ proto array|false stream_socket_pair(int domain, int type, int protocol)
Creates a pair of connected, indistinguishable socket streams */
PHP_FUNCTION(stream_socket_pair)
{
@@ -61,11 +59,11 @@ PHP_FUNCTION(stream_socket_pair)
Z_PARAM_LONG(domain)
Z_PARAM_LONG(type)
Z_PARAM_LONG(protocol)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (0 != socketpair((int)domain, (int)type, (int)protocol, pair)) {
char errbuf[256];
- php_error_docref(NULL, E_WARNING, "failed to create sockets: [%d]: %s",
+ php_error_docref(NULL, E_WARNING, "Failed to create sockets: [%d]: %s",
php_socket_errno(), php_socket_strerror(php_socket_errno(), errbuf, sizeof(errbuf)));
RETURN_FALSE;
}
@@ -86,7 +84,7 @@ PHP_FUNCTION(stream_socket_pair)
/* }}} */
#endif
-/* {{{ proto resource stream_socket_client(string remoteaddress [, int &errcode [, string &errstring [, double timeout [, int flags [, resource context]]]]])
+/* {{{ proto resource|false stream_socket_client(string remoteaddress [, int &errcode [, string &errstring [, double timeout [, int flags [, resource context]]]]])
Open a client connection to a remote address */
PHP_FUNCTION(stream_socket_client)
{
@@ -112,7 +110,7 @@ PHP_FUNCTION(stream_socket_client)
Z_PARAM_DOUBLE(timeout)
Z_PARAM_LONG(flags)
Z_PARAM_RESOURCE(zcontext)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
context = php_stream_context_from_zval(zcontext, flags & PHP_FILE_NO_DEFAULT_CONTEXT);
@@ -146,7 +144,7 @@ PHP_FUNCTION(stream_socket_client)
/* host might contain binary characters */
zend_string *quoted_host = php_addslashes(host);
- php_error_docref(NULL, E_WARNING, "unable to connect to %s (%s)", ZSTR_VAL(quoted_host), errstr == NULL ? "Unknown error" : ZSTR_VAL(errstr));
+ php_error_docref(NULL, E_WARNING, "Unable to connect to %s (%s)", ZSTR_VAL(quoted_host), errstr == NULL ? "Unknown error" : ZSTR_VAL(errstr));
zend_string_release_ex(quoted_host, 0);
}
@@ -175,7 +173,7 @@ PHP_FUNCTION(stream_socket_client)
}
/* }}} */
-/* {{{ proto resource stream_socket_server(string localaddress [, int &errcode [, string &errstring [, int flags [, resource context]]]])
+/* {{{ proto resource|false stream_socket_server(string localaddress [, int &errcode [, string &errstring [, int flags [, resource context]]]])
Create a server socket bound to localaddress */
PHP_FUNCTION(stream_socket_server)
{
@@ -197,7 +195,7 @@ PHP_FUNCTION(stream_socket_server)
Z_PARAM_ZVAL(zerrstr)
Z_PARAM_LONG(flags)
Z_PARAM_RESOURCE(zcontext)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
context = php_stream_context_from_zval(zcontext, flags & PHP_FILE_NO_DEFAULT_CONTEXT);
@@ -217,7 +215,7 @@ PHP_FUNCTION(stream_socket_server)
NULL, NULL, context, &errstr, &err);
if (stream == NULL) {
- php_error_docref(NULL, E_WARNING, "unable to connect to %s (%s)", host, errstr == NULL ? "Unknown error" : ZSTR_VAL(errstr));
+ php_error_docref(NULL, E_WARNING, "Unable to connect to %s (%s)", host, errstr == NULL ? "Unknown error" : ZSTR_VAL(errstr));
}
if (stream == NULL) {
@@ -240,7 +238,7 @@ PHP_FUNCTION(stream_socket_server)
}
/* }}} */
-/* {{{ proto resource stream_socket_accept(resource serverstream, [ double timeout [, string &peername ]])
+/* {{{ proto resource|false stream_socket_accept(resource serverstream, [ double timeout [, string &peername ]])
Accept a client connection from a server socket */
PHP_FUNCTION(stream_socket_accept)
{
@@ -258,7 +256,7 @@ PHP_FUNCTION(stream_socket_accept)
Z_PARAM_OPTIONAL
Z_PARAM_DOUBLE(timeout)
Z_PARAM_ZVAL(zpeername)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, zstream);
@@ -283,7 +281,7 @@ PHP_FUNCTION(stream_socket_accept)
}
php_stream_to_zval(clistream, return_value);
} else {
- php_error_docref(NULL, E_WARNING, "accept failed: %s", errstr ? ZSTR_VAL(errstr) : "Unknown error");
+ php_error_docref(NULL, E_WARNING, "Accept failed: %s", errstr ? ZSTR_VAL(errstr) : "Unknown error");
RETVAL_FALSE;
}
@@ -293,7 +291,7 @@ PHP_FUNCTION(stream_socket_accept)
}
/* }}} */
-/* {{{ proto string stream_socket_get_name(resource stream, bool want_peer)
+/* {{{ proto string|false stream_socket_get_name(resource stream, bool want_peer)
Returns either the locally bound or remote name for a socket stream */
PHP_FUNCTION(stream_socket_get_name)
{
@@ -305,7 +303,7 @@ PHP_FUNCTION(stream_socket_get_name)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_RESOURCE(zstream)
Z_PARAM_BOOL(want_peer)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, zstream);
@@ -325,7 +323,7 @@ PHP_FUNCTION(stream_socket_get_name)
}
/* }}} */
-/* {{{ proto int stream_socket_sendto(resource stream, string data [, int flags [, string target_addr]])
+/* {{{ proto int|false stream_socket_sendto(resource stream, string data [, int flags [, string target_addr]])
Send data to a socket stream. If target_addr is specified it must be in dotted quad (or [ipv6]) format */
PHP_FUNCTION(stream_socket_sendto)
{
@@ -343,7 +341,7 @@ PHP_FUNCTION(stream_socket_sendto)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(flags)
Z_PARAM_STRING(target_addr, target_addr_len)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, zstream);
if (target_addr_len) {
@@ -358,7 +356,7 @@ PHP_FUNCTION(stream_socket_sendto)
}
/* }}} */
-/* {{{ proto string stream_socket_recvfrom(resource stream, int amount [, int flags [, string &remote_addr]])
+/* {{{ proto string|false stream_socket_recvfrom(resource stream, int amount [, int flags [, string &remote_addr]])
Receives data from a socket stream */
PHP_FUNCTION(stream_socket_recvfrom)
{
@@ -376,7 +374,7 @@ PHP_FUNCTION(stream_socket_recvfrom)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(flags)
Z_PARAM_ZVAL(zremote)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, zstream);
@@ -385,8 +383,8 @@ PHP_FUNCTION(stream_socket_recvfrom)
}
if (to_read <= 0) {
- php_error_docref(NULL, E_WARNING, "Length parameter must be greater than 0");
- RETURN_FALSE;
+ zend_value_error("Length parameter must be greater than 0");
+ RETURN_THROWS();
}
read_buf = zend_string_alloc(to_read, 0);
@@ -409,7 +407,7 @@ PHP_FUNCTION(stream_socket_recvfrom)
}
/* }}} */
-/* {{{ proto string stream_get_contents(resource source [, int maxlen [, int offset]])
+/* {{{ proto string|false stream_get_contents(resource source [, int maxlen [, int offset]])
Reads all remaining bytes (or up to maxlen bytes) from a stream and returns them as a string. */
PHP_FUNCTION(stream_get_contents)
{
@@ -424,7 +422,7 @@ PHP_FUNCTION(stream_get_contents)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(maxlen)
Z_PARAM_LONG(desiredpos)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, zsrc);
@@ -460,7 +458,7 @@ PHP_FUNCTION(stream_get_contents)
}
/* }}} */
-/* {{{ proto int stream_copy_to_stream(resource source, resource dest [, int maxlen [, int pos]])
+/* {{{ proto int|false stream_copy_to_stream(resource source, resource dest [, int maxlen [, int pos]])
Reads up to maxlen bytes from source stream and writes them to dest stream. */
PHP_FUNCTION(stream_copy_to_stream)
{
@@ -476,7 +474,7 @@ PHP_FUNCTION(stream_copy_to_stream)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(maxlen)
Z_PARAM_LONG(pos)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(src, zsrc);
php_stream_from_zval(dest, zdest);
@@ -552,16 +550,14 @@ PHP_FUNCTION(stream_get_meta_data)
}
/* }}} */
-/* {{{ proto array stream_get_transports()
+/* {{{ proto array|false stream_get_transports()
Retrieves list of registered socket transports */
PHP_FUNCTION(stream_get_transports)
{
HashTable *stream_xport_hash;
zend_string *stream_xport;
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
if ((stream_xport_hash = php_stream_xport_get_hash())) {
array_init(return_value);
@@ -574,16 +570,14 @@ PHP_FUNCTION(stream_get_transports)
}
/* }}} */
-/* {{{ proto array stream_get_wrappers()
+/* {{{ proto array|false stream_get_wrappers()
Retrieves list of registered stream wrappers */
PHP_FUNCTION(stream_get_wrappers)
{
HashTable *url_stream_wrappers_hash;
zend_string *stream_protocol;
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
if ((url_stream_wrappers_hash = php_stream_get_url_stream_wrappers_hash())) {
array_init(return_value);
@@ -738,7 +732,7 @@ static int stream_array_emulate_read_fd_set(zval *stream_array)
}
/* }}} */
-/* {{{ proto int stream_select(array &read_streams, array &write_streams, array &except_streams, int tv_sec[, int tv_usec])
+/* {{{ proto int|false stream_select(array &read_streams, array &write_streams, array &except_streams, int tv_sec[, int tv_usec])
Runs the select() system call on the sets of streams with a timeout specified by tv_sec and tv_usec */
PHP_FUNCTION(stream_select)
{
@@ -755,7 +749,7 @@ PHP_FUNCTION(stream_select)
Z_PARAM_ARRAY_EX2(r_array, 1, 1, 0)
Z_PARAM_ARRAY_EX2(w_array, 1, 1, 0)
Z_PARAM_ARRAY_EX2(e_array, 1, 1, 0)
- Z_PARAM_LONG_EX(sec, secnull, 1, 0)
+ Z_PARAM_LONG_OR_NULL(sec, secnull)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(usec)
ZEND_PARSE_PARAMETERS_END();
@@ -786,8 +780,8 @@ PHP_FUNCTION(stream_select)
}
if (!sets) {
- php_error_docref(NULL, E_WARNING, "No stream arrays were passed");
- RETURN_FALSE;
+ zend_value_error("No stream arrays were passed");
+ RETURN_THROWS();
}
PHP_SAFE_MAX_FD(max_fd, max_set_count);
@@ -795,11 +789,11 @@ PHP_FUNCTION(stream_select)
/* If seconds is not set to null, build the timeval, else we wait indefinitely */
if (!secnull) {
if (sec < 0) {
- php_error_docref(NULL, E_WARNING, "The seconds parameter must be greater than 0");
- RETURN_FALSE;
+ zend_value_error("The seconds parameter must be greater than 0");
+ RETURN_THROWS();
} else if (usec < 0) {
- php_error_docref(NULL, E_WARNING, "The microseconds parameter must be greater than 0");
- RETURN_FALSE;
+ zend_value_error("The microseconds parameter must be greater than 0");
+ RETURN_THROWS();
}
/* Windows, Solaris and BSD do not like microsecond values which are >= 1 sec */
@@ -829,7 +823,7 @@ PHP_FUNCTION(stream_select)
retval = php_select(max_fd+1, &rfds, &wfds, &efds, tv_p);
if (retval == -1) {
- php_error_docref(NULL, E_WARNING, "unable to select [%d]: %s (max_fd=%d)",
+ php_error_docref(NULL, E_WARNING, "Unable to select [%d]: %s (max_fd=%d)",
errno, strerror(errno), max_fd);
RETURN_FALSE;
}
@@ -863,7 +857,7 @@ static void user_space_stream_notifier(php_stream_context *context, int notifyco
ZVAL_LONG(&zvs[5], bytes_max);
if (FAILURE == call_user_function_ex(NULL, NULL, callback, &retval, 6, zvs, 0, NULL)) {
- php_error_docref(NULL, E_WARNING, "failed to call user notifier");
+ php_error_docref(NULL, E_WARNING, "Failed to call user notifier");
}
for (i = 0; i < 6; i++) {
zval_ptr_dtor(&zvs[i]);
@@ -894,7 +888,8 @@ static int parse_context_options(php_stream_context *context, zval *options)
}
} ZEND_HASH_FOREACH_END();
} else {
- php_error_docref(NULL, E_WARNING, "options should have the form [\"wrappername\"][\"optionname\"] = $value");
+ zend_value_error("Options should have the form [\"wrappername\"][\"optionname\"] = $value");
+ return FAILURE;
}
} ZEND_HASH_FOREACH_END();
@@ -920,9 +915,10 @@ static int parse_context_params(php_stream_context *context, zval *params)
}
if (NULL != (tmp = zend_hash_str_find(Z_ARRVAL_P(params), "options", sizeof("options")-1))) {
if (Z_TYPE_P(tmp) == IS_ARRAY) {
- parse_context_options(context, tmp);
+ return parse_context_options(context, tmp);
} else {
- php_error_docref(NULL, E_WARNING, "Invalid stream/context parameter");
+ zend_type_error("Invalid stream/context parameter");
+ return FAILURE;
}
}
@@ -968,12 +964,12 @@ PHP_FUNCTION(stream_context_get_options)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_RESOURCE(zcontext)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
context = decode_context_param(zcontext);
if (!context) {
- php_error_docref(NULL, E_WARNING, "Invalid stream/context parameter");
- RETURN_FALSE;
+ zend_type_error("Invalid stream/context parameter");
+ RETURN_THROWS();
}
ZVAL_COPY(return_value, &context->options);
@@ -993,12 +989,12 @@ PHP_FUNCTION(stream_context_set_option)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_RESOURCE(zcontext)
Z_PARAM_ARRAY(options)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
/* figure out where the context is coming from exactly */
if (!(context = decode_context_param(zcontext))) {
- php_error_docref(NULL, E_WARNING, "Invalid stream/context parameter");
- RETURN_FALSE;
+ zend_type_error("Invalid stream/context parameter");
+ RETURN_THROWS();
}
RETURN_BOOL(parse_context_options(context, options) == SUCCESS);
@@ -1012,12 +1008,12 @@ PHP_FUNCTION(stream_context_set_option)
Z_PARAM_STRING(wrappername, wrapperlen)
Z_PARAM_STRING(optionname, optionlen)
Z_PARAM_ZVAL(zvalue)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
/* figure out where the context is coming from exactly */
if (!(context = decode_context_param(zcontext))) {
- php_error_docref(NULL, E_WARNING, "Invalid stream/context parameter");
- RETURN_FALSE;
+ zend_type_error("Invalid stream/context parameter");
+ RETURN_THROWS();
}
RETURN_BOOL(php_stream_context_set_option(context, wrappername, optionname, zvalue) == SUCCESS);
@@ -1035,12 +1031,12 @@ PHP_FUNCTION(stream_context_set_params)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_RESOURCE(zcontext)
Z_PARAM_ARRAY(params)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
context = decode_context_param(zcontext);
if (!context) {
- php_error_docref(NULL, E_WARNING, "Invalid stream/context parameter");
- RETURN_FALSE;
+ zend_type_error("Invalid stream/context parameter");
+ RETURN_THROWS();
}
RETVAL_BOOL(parse_context_params(context, params) == SUCCESS);
@@ -1056,12 +1052,12 @@ PHP_FUNCTION(stream_context_get_params)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_RESOURCE(zcontext)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
context = decode_context_param(zcontext);
if (!context) {
- php_error_docref(NULL, E_WARNING, "Invalid stream/context parameter");
- RETURN_FALSE;
+ zend_type_error("Invalid stream/context parameter");
+ RETURN_THROWS();
}
array_init(return_value);
@@ -1084,7 +1080,7 @@ PHP_FUNCTION(stream_context_get_default)
ZEND_PARSE_PARAMETERS_START(0, 1)
Z_PARAM_OPTIONAL
Z_PARAM_ARRAY(params)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (FG(default_context) == NULL) {
FG(default_context) = php_stream_context_alloc();
@@ -1092,7 +1088,9 @@ PHP_FUNCTION(stream_context_get_default)
context = FG(default_context);
if (params) {
- parse_context_options(context, params);
+ if (parse_context_options(context, params) == FAILURE) {
+ RETURN_THROWS();
+ }
}
php_stream_context_to_zval(context, return_value);
@@ -1115,7 +1113,9 @@ PHP_FUNCTION(stream_context_set_default)
}
context = FG(default_context);
- parse_context_options(context, options);
+ if (parse_context_options(context, options) == FAILURE) {
+ RETURN_THROWS();
+ }
php_stream_context_to_zval(context, return_value);
}
@@ -1130,9 +1130,9 @@ PHP_FUNCTION(stream_context_create)
ZEND_PARSE_PARAMETERS_START(0, 2)
Z_PARAM_OPTIONAL
- Z_PARAM_ARRAY_EX(options, 1, 0)
- Z_PARAM_ARRAY_EX(params, 1, 0)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ Z_PARAM_ARRAY_OR_NULL(options)
+ Z_PARAM_ARRAY_OR_NULL(params)
+ ZEND_PARSE_PARAMETERS_END();
context = php_stream_context_alloc();
@@ -1166,7 +1166,7 @@ static void apply_filter_to_stream(int append, INTERNAL_FUNCTION_PARAMETERS)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(read_write)
Z_PARAM_ZVAL(filterparams)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, zstream);
@@ -1253,12 +1253,11 @@ PHP_FUNCTION(stream_filter_remove)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_RESOURCE(zfilter)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
- filter = zend_fetch_resource(Z_RES_P(zfilter), NULL, php_file_le_stream_filter());
+ filter = zend_fetch_resource(Z_RES_P(zfilter), "stream filter", php_file_le_stream_filter());
if (!filter) {
- php_error_docref(NULL, E_WARNING, "Invalid resource given, not a stream filter");
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (php_stream_filter_flush(filter, 1) == FAILURE) {
@@ -1292,11 +1291,11 @@ PHP_FUNCTION(stream_get_line)
Z_PARAM_LONG(max_length)
Z_PARAM_OPTIONAL
Z_PARAM_STRING(str, str_len)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (max_length < 0) {
- php_error_docref(NULL, E_WARNING, "The maximum allowed length must be greater than or equal to zero");
- RETURN_FALSE;
+ zend_value_error("The maximum allowed length must be greater than or equal to zero");
+ RETURN_THROWS();
}
if (!max_length) {
max_length = PHP_SOCK_CHUNK_SIZE;
@@ -1399,7 +1398,7 @@ PHP_FUNCTION(stream_set_write_buffer)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_RESOURCE(arg1)
Z_PARAM_LONG(arg2)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, arg1);
@@ -1428,19 +1427,19 @@ PHP_FUNCTION(stream_set_chunk_size)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_RESOURCE(zstream)
Z_PARAM_LONG(csize)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (csize <= 0) {
- php_error_docref(NULL, E_WARNING, "The chunk size must be a positive integer, given " ZEND_LONG_FMT, csize);
- RETURN_FALSE;
+ zend_value_error("The chunk size must be a positive integer, " ZEND_LONG_FMT " given", csize);
+ RETURN_THROWS();
}
/* stream.chunk_size is actually a size_t, but php_stream_set_option
* can only use an int to accept the new value and return the old one.
* In any case, values larger than INT_MAX for a chunk size make no sense.
*/
if (csize > INT_MAX) {
- php_error_docref(NULL, E_WARNING, "The chunk size cannot be larger than %d", INT_MAX);
- RETURN_FALSE;
+ zend_value_error("The chunk size cannot be larger than %d", INT_MAX);
+ RETURN_THROWS();
}
php_stream_from_zval(stream, zstream);
@@ -1464,7 +1463,7 @@ PHP_FUNCTION(stream_set_read_buffer)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_RESOURCE(arg1)
Z_PARAM_LONG(arg2)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, arg1);
@@ -1495,9 +1494,9 @@ PHP_FUNCTION(stream_socket_enable_crypto)
Z_PARAM_RESOURCE(zstream)
Z_PARAM_BOOL(enable)
Z_PARAM_OPTIONAL
- Z_PARAM_LONG_EX(cryptokind, cryptokindnull, 1, 0)
+ Z_PARAM_LONG_OR_NULL(cryptokind, cryptokindnull)
Z_PARAM_RESOURCE(zsessstream)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, zstream);
@@ -1506,8 +1505,8 @@ PHP_FUNCTION(stream_socket_enable_crypto)
zval *val;
if (!GET_CTX_OPT(stream, "ssl", "crypto_method", val)) {
- php_error_docref(NULL, E_WARNING, "When enabling encryption you must specify the crypto type");
- RETURN_FALSE;
+ zend_value_error("When enabling encryption you must specify the crypto type");
+ RETURN_THROWS();
}
cryptokind = Z_LVAL_P(val);
@@ -1536,7 +1535,7 @@ PHP_FUNCTION(stream_socket_enable_crypto)
}
/* }}} */
-/* {{{ proto string stream_resolve_include_path(string filename)
+/* {{{ proto string|false stream_resolve_include_path(string filename)
Determine what file will be opened by calls to fopen() with a relative path */
PHP_FUNCTION(stream_resolve_include_path)
{
@@ -1567,7 +1566,7 @@ PHP_FUNCTION(stream_is_local)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_ZVAL(zstream)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (Z_TYPE_P(zstream) == IS_RESOURCE) {
php_stream_from_zval(stream, zstream);
@@ -1577,7 +1576,7 @@ PHP_FUNCTION(stream_is_local)
wrapper = stream->wrapper;
} else {
if (!try_convert_to_string(zstream)) {
- return;
+ RETURN_THROWS();
}
wrapper = php_stream_locate_url_wrapper(Z_STRVAL_P(zstream), NULL, 0);
@@ -1600,7 +1599,7 @@ PHP_FUNCTION(stream_supports_lock)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_RESOURCE(zsrc)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, zsrc);
@@ -1622,7 +1621,7 @@ PHP_FUNCTION(stream_isatty)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_RESOURCE(zsrc)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, zsrc);
@@ -1666,7 +1665,7 @@ PHP_FUNCTION(sapi_windows_vt100_support)
Z_PARAM_RESOURCE(zsrc)
Z_PARAM_OPTIONAL
Z_PARAM_BOOL(enable)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, zsrc);
@@ -1677,12 +1676,11 @@ PHP_FUNCTION(sapi_windows_vt100_support)
php_stream_cast(stream, PHP_STREAM_AS_FD, (void*)&fileno, 0);
}
else {
- zend_internal_type_error(
- ZEND_ARG_USES_STRICT_TYPES(),
+ zend_type_error(
"%s() was not able to analyze the specified stream",
get_active_function_name()
);
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* Check if the file descriptor is a console */
@@ -1727,7 +1725,7 @@ PHP_FUNCTION(stream_socket_shutdown)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_RESOURCE(zstream)
Z_PARAM_LONG(how)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (how != STREAM_SHUT_RD &&
how != STREAM_SHUT_WR &&
diff --git a/ext/standard/streamsfuncs.h b/ext/standard/streamsfuncs.h
index bcd2afdcc4..6a94169dc6 100644
--- a/ext/standard/streamsfuncs.h
+++ b/ext/standard/streamsfuncs.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 622964ded6..6fb9683c5a 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -236,15 +234,11 @@ PHP_FUNCTION(bin2hex)
result = php_bin2hex((unsigned char *)ZSTR_VAL(data), ZSTR_LEN(data));
- if (!result) {
- RETURN_FALSE;
- }
-
RETURN_STR(result);
}
/* }}} */
-/* {{{ proto string hex2bin(string data)
+/* {{{ proto string|false hex2bin(string data)
Converts the hex representation of data to binary */
PHP_FUNCTION(hex2bin)
{
@@ -328,7 +322,7 @@ static void php_spn_common_handler(INTERNAL_FUNCTION_PARAMETERS, int behavior) /
}
/* }}} */
-/* {{{ proto int strspn(string str, string mask [, int start [, int len]])
+/* {{{ proto int|false strspn(string str, string mask [, int start [, int len]])
Finds length of initial segment consisting entirely of characters found in mask. If start or/and length is provided works like strspn(substr($s,$start,$len),$good_chars) */
PHP_FUNCTION(strspn)
{
@@ -336,7 +330,7 @@ PHP_FUNCTION(strspn)
}
/* }}} */
-/* {{{ proto int strcspn(string str, string mask [, int start [, int len]])
+/* {{{ proto int|false strcspn(string str, string mask [, int start [, int len]])
Finds length of initial segment consisting entirely of characters not found in mask. If start or/and length is provide works like strcspn(substr($s,$start,$len),$bad_chars) */
PHP_FUNCTION(strcspn)
{
@@ -514,7 +508,7 @@ PHP_MINIT_FUNCTION(nl_langinfo)
}
/* }}} */
-/* {{{ proto string nl_langinfo(int item)
+/* {{{ proto string|false nl_langinfo(int item)
Query language and locale information */
PHP_FUNCTION(nl_langinfo)
{
@@ -937,13 +931,13 @@ PHP_FUNCTION(wordwrap)
}
if (breakchar_len == 0) {
- php_error_docref(NULL, E_WARNING, "Break string cannot be empty");
- RETURN_FALSE;
+ zend_value_error("Break string cannot be empty");
+ RETURN_THROWS();
}
if (linelength == 0 && docut) {
- php_error_docref(NULL, E_WARNING, "Can't force cut when width is zero");
- RETURN_FALSE;
+ zend_value_error("Can't force cut when width is zero");
+ RETURN_THROWS();
}
/* Special case for a single-character break as it needs no
@@ -1149,14 +1143,14 @@ PHP_FUNCTION(explode)
ZEND_PARSE_PARAMETERS_END();
if (ZSTR_LEN(delim) == 0) {
- php_error_docref(NULL, E_WARNING, "Empty delimiter");
- RETURN_FALSE;
+ zend_value_error("Empty delimiter");
+ RETURN_THROWS();
}
array_init(return_value);
if (ZSTR_LEN(str) == 0) {
- if (limit >= 0) {
+ if (limit >= 0) {
ZVAL_EMPTY_STRING(&tmp);
zend_hash_index_add_new(Z_ARRVAL_P(return_value), 0, &tmp);
}
@@ -1174,13 +1168,13 @@ PHP_FUNCTION(explode)
}
/* }}} */
-/* {{{ proto string join(array src, string glue)
+/* {{{ proto string join([string glue,] array pieces)
An alias for implode */
/* }}} */
/* {{{ php_implode
*/
-PHPAPI void php_implode(const zend_string *glue, zval *pieces, zval *return_value)
+PHPAPI void php_implode(const zend_string *glue, HashTable *pieces, zval *return_value)
{
zval *tmp;
int numelems;
@@ -1193,20 +1187,20 @@ PHPAPI void php_implode(const zend_string *glue, zval *pieces, zval *return_valu
} *strings, *ptr;
ALLOCA_FLAG(use_heap)
- numelems = zend_hash_num_elements(Z_ARRVAL_P(pieces));
+ numelems = zend_hash_num_elements(pieces);
if (numelems == 0) {
RETURN_EMPTY_STRING();
} else if (numelems == 1) {
/* loop to search the first not undefined element... */
- ZEND_HASH_FOREACH_VAL_IND(Z_ARRVAL_P(pieces), tmp) {
+ ZEND_HASH_FOREACH_VAL_IND(pieces, tmp) {
RETURN_STR(zval_get_string(tmp));
} ZEND_HASH_FOREACH_END();
}
ptr = strings = do_alloca((sizeof(*strings)) * numelems, use_heap);
- ZEND_HASH_FOREACH_VAL_IND(Z_ARRVAL_P(pieces), tmp) {
+ ZEND_HASH_FOREACH_VAL_IND(pieces, tmp) {
if (EXPECTED(Z_TYPE_P(tmp) == IS_STRING)) {
ptr->str = Z_STR_P(tmp);
len += ZSTR_LEN(ptr->str);
@@ -1270,47 +1264,38 @@ PHPAPI void php_implode(const zend_string *glue, zval *pieces, zval *return_valu
Joins array elements placing glue string between items and return one string */
PHP_FUNCTION(implode)
{
- zval *arg1, *arg2 = NULL, *pieces;
- zend_string *glue, *tmp_glue;
+ zend_string *arg1_str = NULL;
+ HashTable *arg1_array = NULL;
+ zend_array *pieces = NULL;
ZEND_PARSE_PARAMETERS_START(1, 2)
- Z_PARAM_ZVAL(arg1)
+ Z_PARAM_STR_OR_ARRAY_HT(arg1_str, arg1_array)
Z_PARAM_OPTIONAL
- Z_PARAM_ZVAL(arg2)
+ Z_PARAM_ARRAY_HT(pieces)
ZEND_PARSE_PARAMETERS_END();
- if (arg2 == NULL) {
- if (Z_TYPE_P(arg1) != IS_ARRAY) {
- php_error_docref(NULL, E_WARNING, "Argument must be an array");
- return;
+ if (pieces == NULL) {
+ if (arg1_array == NULL) {
+ zend_type_error("Argument must be an array");
+ RETURN_THROWS();
}
- glue = ZSTR_EMPTY_ALLOC();
- tmp_glue = NULL;
- pieces = arg1;
+ arg1_str = ZSTR_EMPTY_ALLOC();
+ pieces = arg1_array;
} else {
- if (Z_TYPE_P(arg1) == IS_ARRAY) {
- glue = zval_get_tmp_string(arg2, &tmp_glue);
- pieces = arg1;
- php_error_docref(NULL, E_DEPRECATED,
- "Passing glue string after array is deprecated. Swap the parameters");
- } else if (Z_TYPE_P(arg2) == IS_ARRAY) {
- glue = zval_get_tmp_string(arg1, &tmp_glue);
- pieces = arg2;
- } else {
- php_error_docref(NULL, E_WARNING, "Invalid arguments passed");
- return;
+ if (arg1_str == NULL) {
+ zend_type_error("The first argument must be a string");
+ RETURN_THROWS();
}
}
- php_implode(glue, pieces, return_value);
- zend_tmp_string_release(tmp_glue);
+ php_implode(arg1_str, pieces, return_value);
}
/* }}} */
#define STRTOK_TABLE(p) BG(strtok_table)[(unsigned char) *p]
-/* {{{ proto string strtok([string str,] string token)
+/* {{{ proto string|false strtok([string str,] string token)
Tokenize a string */
PHP_FUNCTION(strtok)
{
@@ -1648,9 +1633,9 @@ PHP_FUNCTION(dirname)
ZSTR_LEN(ret) = zend_dirname(ZSTR_VAL(ret), str_len);
#endif
} else if (levels < 1) {
- php_error_docref(NULL, E_WARNING, "Invalid argument, levels must be >= 1");
+ zend_value_error("Invalid argument, levels must be >= 1");
zend_string_efree(ret);
- return;
+ RETURN_THROWS();
} else {
/* Some levels up */
do {
@@ -1666,7 +1651,7 @@ PHP_FUNCTION(dirname)
}
/* }}} */
-/* {{{ proto array pathinfo(string path[, int options])
+/* {{{ proto array|string pathinfo(string path[, int options])
Returns information about a certain string */
PHP_FUNCTION(pathinfo)
{
@@ -1798,76 +1783,28 @@ PHPAPI size_t php_strcspn(char *s1, char *s2, char *s1_end, char *s2_end)
}
/* }}} */
-/* {{{ php_needle_char
- */
-static int php_needle_char(zval *needle, char *target)
-{
- switch (Z_TYPE_P(needle)) {
- case IS_LONG:
- *target = (char)Z_LVAL_P(needle);
- return SUCCESS;
- case IS_NULL:
- case IS_FALSE:
- *target = '\0';
- return SUCCESS;
- case IS_TRUE:
- *target = '\1';
- return SUCCESS;
- case IS_DOUBLE:
- case IS_OBJECT:
- *target = (char) zval_get_long(needle);
- return SUCCESS;
- default:
- php_error_docref(NULL, E_WARNING, "needle is not a string or an integer");
- return FAILURE;
- }
-}
-/* }}} */
-
-/* {{{ proto string stristr(string haystack, string needle[, bool part])
+/* {{{ proto string|false stristr(string haystack, string needle[, bool part])
Finds first occurrence of a string within another, case insensitive */
PHP_FUNCTION(stristr)
{
- zval *needle;
- zend_string *haystack;
+ zend_string *haystack, *needle;
const char *found = NULL;
size_t found_offset;
char *haystack_dup;
- char needle_char[2];
+ char *orig_needle;
zend_bool part = 0;
ZEND_PARSE_PARAMETERS_START(2, 3)
Z_PARAM_STR(haystack)
- Z_PARAM_ZVAL(needle)
+ Z_PARAM_STR(needle)
Z_PARAM_OPTIONAL
Z_PARAM_BOOL(part)
ZEND_PARSE_PARAMETERS_END();
haystack_dup = estrndup(ZSTR_VAL(haystack), ZSTR_LEN(haystack));
-
- if (Z_TYPE_P(needle) == IS_STRING) {
- char *orig_needle;
- if (!Z_STRLEN_P(needle)) {
- php_error_docref(NULL, E_WARNING, "Empty needle");
- efree(haystack_dup);
- RETURN_FALSE;
- }
- orig_needle = estrndup(Z_STRVAL_P(needle), Z_STRLEN_P(needle));
- found = php_stristr(haystack_dup, orig_needle, ZSTR_LEN(haystack), Z_STRLEN_P(needle));
- efree(orig_needle);
- } else {
- if (php_needle_char(needle, needle_char) != SUCCESS) {
- efree(haystack_dup);
- RETURN_FALSE;
- }
- needle_char[1] = 0;
-
- php_error_docref(NULL, E_DEPRECATED,
- "Non-string needles will be interpreted as strings in the future. " \
- "Use an explicit chr() call to preserve the current behavior");
-
- found = php_stristr(haystack_dup, needle_char, ZSTR_LEN(haystack), 1);
- }
+ orig_needle = estrndup(ZSTR_VAL(needle), ZSTR_LEN(needle));
+ found = php_stristr(haystack_dup, orig_needle, ZSTR_LEN(haystack), ZSTR_LEN(needle));
+ efree(orig_needle);
if (found) {
found_offset = found - haystack_dup;
@@ -1884,43 +1821,23 @@ PHP_FUNCTION(stristr)
}
/* }}} */
-/* {{{ proto string strstr(string haystack, string needle[, bool part])
+/* {{{ proto string|false strstr(string haystack, string needle[, bool part])
Finds first occurrence of a string within another */
PHP_FUNCTION(strstr)
{
- zval *needle;
- zend_string *haystack;
+ zend_string *haystack, *needle;
const char *found = NULL;
- char needle_char[2];
zend_long found_offset;
zend_bool part = 0;
ZEND_PARSE_PARAMETERS_START(2, 3)
Z_PARAM_STR(haystack)
- Z_PARAM_ZVAL(needle)
+ Z_PARAM_STR(needle)
Z_PARAM_OPTIONAL
Z_PARAM_BOOL(part)
ZEND_PARSE_PARAMETERS_END();
- if (Z_TYPE_P(needle) == IS_STRING) {
- if (!Z_STRLEN_P(needle)) {
- php_error_docref(NULL, E_WARNING, "Empty needle");
- RETURN_FALSE;
- }
-
- found = php_memnstr(ZSTR_VAL(haystack), Z_STRVAL_P(needle), Z_STRLEN_P(needle), ZSTR_VAL(haystack) + ZSTR_LEN(haystack));
- } else {
- if (php_needle_char(needle, needle_char) != SUCCESS) {
- RETURN_FALSE;
- }
- needle_char[1] = 0;
-
- php_error_docref(NULL, E_DEPRECATED,
- "Non-string needles will be interpreted as strings in the future. " \
- "Use an explicit chr() call to preserve the current behavior");
-
- found = php_memnstr(ZSTR_VAL(haystack), needle_char, 1, ZSTR_VAL(haystack) + ZSTR_LEN(haystack));
- }
+ found = php_memnstr(ZSTR_VAL(haystack), ZSTR_VAL(needle), ZSTR_LEN(needle), ZSTR_VAL(haystack) + ZSTR_LEN(haystack));
if (found) {
found_offset = found - ZSTR_VAL(haystack);
@@ -1938,19 +1855,17 @@ PHP_FUNCTION(strstr)
An alias for strstr */
/* }}} */
-/* {{{ proto int strpos(string haystack, string needle [, int offset])
+/* {{{ proto int|false strpos(string haystack, string needle [, int offset])
Finds position of first occurrence of a string within another */
PHP_FUNCTION(strpos)
{
- zval *needle;
- zend_string *haystack;
+ zend_string *haystack, *needle;
const char *found = NULL;
- char needle_char[2];
- zend_long offset = 0;
+ zend_long offset = 0;
ZEND_PARSE_PARAMETERS_START(2, 3)
Z_PARAM_STR(haystack)
- Z_PARAM_ZVAL(needle)
+ Z_PARAM_STR(needle)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(offset)
ZEND_PARSE_PARAMETERS_END();
@@ -1959,35 +1874,13 @@ PHP_FUNCTION(strpos)
offset += (zend_long)ZSTR_LEN(haystack);
}
if (offset < 0 || (size_t)offset > ZSTR_LEN(haystack)) {
- php_error_docref(NULL, E_WARNING, "Offset not contained in string");
- RETURN_FALSE;
+ zend_value_error("Offset not contained in string");
+ RETURN_THROWS();
}
- if (Z_TYPE_P(needle) == IS_STRING) {
- if (!Z_STRLEN_P(needle)) {
- php_error_docref(NULL, E_WARNING, "Empty needle");
- RETURN_FALSE;
- }
-
- found = (char*)php_memnstr(ZSTR_VAL(haystack) + offset,
- Z_STRVAL_P(needle),
- Z_STRLEN_P(needle),
- ZSTR_VAL(haystack) + ZSTR_LEN(haystack));
- } else {
- if (php_needle_char(needle, needle_char) != SUCCESS) {
- RETURN_FALSE;
- }
- needle_char[1] = 0;
-
- php_error_docref(NULL, E_DEPRECATED,
- "Non-string needles will be interpreted as strings in the future. " \
- "Use an explicit chr() call to preserve the current behavior");
-
- found = (char*)php_memnstr(ZSTR_VAL(haystack) + offset,
- needle_char,
- 1,
- ZSTR_VAL(haystack) + ZSTR_LEN(haystack));
- }
+ found = (char*)php_memnstr(ZSTR_VAL(haystack) + offset,
+ ZSTR_VAL(needle), ZSTR_LEN(needle),
+ ZSTR_VAL(haystack) + ZSTR_LEN(haystack));
if (found) {
RETURN_LONG(found - ZSTR_VAL(haystack));
@@ -1997,20 +1890,18 @@ PHP_FUNCTION(strpos)
}
/* }}} */
-/* {{{ proto int stripos(string haystack, string needle [, int offset])
+/* {{{ proto int|false stripos(string haystack, string needle [, int offset])
Finds position of first occurrence of a string within another, case insensitive */
PHP_FUNCTION(stripos)
{
const char *found = NULL;
- zend_string *haystack;
+ zend_string *haystack, *needle;
zend_long offset = 0;
- char needle_char[2];
- zval *needle;
zend_string *needle_dup = NULL, *haystack_dup;
ZEND_PARSE_PARAMETERS_START(2, 3)
Z_PARAM_STR(haystack)
- Z_PARAM_ZVAL(needle)
+ Z_PARAM_STR(needle)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(offset)
ZEND_PARSE_PARAMETERS_END();
@@ -2019,41 +1910,18 @@ PHP_FUNCTION(stripos)
offset += (zend_long)ZSTR_LEN(haystack);
}
if (offset < 0 || (size_t)offset > ZSTR_LEN(haystack)) {
- php_error_docref(NULL, E_WARNING, "Offset not contained in string");
- RETURN_FALSE;
+ zend_value_error("Offset not contained in string");
+ RETURN_THROWS();
}
- if (ZSTR_LEN(haystack) == 0) {
+ if (ZSTR_LEN(needle) > ZSTR_LEN(haystack)) {
RETURN_FALSE;
}
- if (Z_TYPE_P(needle) == IS_STRING) {
- if (Z_STRLEN_P(needle) == 0 || Z_STRLEN_P(needle) > ZSTR_LEN(haystack)) {
- RETURN_FALSE;
- }
-
- haystack_dup = php_string_tolower(haystack);
- needle_dup = php_string_tolower(Z_STR_P(needle));
- found = (char*)php_memnstr(ZSTR_VAL(haystack_dup) + offset,
- ZSTR_VAL(needle_dup), ZSTR_LEN(needle_dup), ZSTR_VAL(haystack_dup) + ZSTR_LEN(haystack));
- } else {
- if (php_needle_char(needle, needle_char) != SUCCESS) {
- RETURN_FALSE;
- }
-
- php_error_docref(NULL, E_DEPRECATED,
- "Non-string needles will be interpreted as strings in the future. " \
- "Use an explicit chr() call to preserve the current behavior");
-
- haystack_dup = php_string_tolower(haystack);
- needle_char[0] = tolower(needle_char[0]);
- needle_char[1] = '\0';
- found = (char*)php_memnstr(ZSTR_VAL(haystack_dup) + offset,
- needle_char,
- sizeof(needle_char) - 1,
- ZSTR_VAL(haystack_dup) + ZSTR_LEN(haystack));
- }
-
+ haystack_dup = php_string_tolower(haystack);
+ needle_dup = php_string_tolower(needle);
+ found = (char*)php_memnstr(ZSTR_VAL(haystack_dup) + offset,
+ ZSTR_VAL(needle_dup), ZSTR_LEN(needle_dup), ZSTR_VAL(haystack_dup) + ZSTR_LEN(haystack));
if (found) {
RETVAL_LONG(found - ZSTR_VAL(haystack_dup));
@@ -2062,72 +1930,48 @@ PHP_FUNCTION(stripos)
}
zend_string_release_ex(haystack_dup, 0);
- if (needle_dup) {
- zend_string_release_ex(needle_dup, 0);
- }
+ zend_string_release_ex(needle_dup, 0);
}
/* }}} */
-/* {{{ proto int strrpos(string haystack, string needle [, int offset])
+/* {{{ proto int|false strrpos(string haystack, string needle [, int offset])
Finds position of last occurrence of a string within another string */
PHP_FUNCTION(strrpos)
{
- zval *zneedle;
+ zend_string *needle;
zend_string *haystack;
- size_t needle_len;
zend_long offset = 0;
- char ord_needle[2];
- const char *p, *e, *found, *needle;
+ const char *p, *e, *found;
ZEND_PARSE_PARAMETERS_START(2, 3)
Z_PARAM_STR(haystack)
- Z_PARAM_ZVAL(zneedle)
+ Z_PARAM_STR(needle)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(offset)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
-
- if (Z_TYPE_P(zneedle) == IS_STRING) {
- needle = Z_STRVAL_P(zneedle);
- needle_len = Z_STRLEN_P(zneedle);
- } else {
- if (php_needle_char(zneedle, ord_needle) != SUCCESS) {
- RETURN_FALSE;
- }
-
- php_error_docref(NULL, E_DEPRECATED,
- "Non-string needles will be interpreted as strings in the future. " \
- "Use an explicit chr() call to preserve the current behavior");
-
- ord_needle[1] = '\0';
- needle = ord_needle;
- needle_len = 1;
- }
-
- if ((ZSTR_LEN(haystack) == 0) || (needle_len == 0)) {
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_END();
if (offset >= 0) {
if ((size_t)offset > ZSTR_LEN(haystack)) {
- php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string");
- RETURN_FALSE;
+ zend_value_error("Offset not contained in string");
+ RETURN_THROWS();
}
p = ZSTR_VAL(haystack) + (size_t)offset;
e = ZSTR_VAL(haystack) + ZSTR_LEN(haystack);
} else {
- if (offset < -INT_MAX || (size_t)(-offset) > ZSTR_LEN(haystack)) {
- php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string");
- RETURN_FALSE;
+ if (offset < -ZEND_LONG_MAX || (size_t)(-offset) > ZSTR_LEN(haystack)) {
+ zend_value_error("Offset not contained in string");
+ RETURN_THROWS();
}
+
p = ZSTR_VAL(haystack);
- if ((size_t)-offset < needle_len) {
+ if ((size_t)-offset < ZSTR_LEN(needle)) {
e = ZSTR_VAL(haystack) + ZSTR_LEN(haystack);
} else {
- e = ZSTR_VAL(haystack) + ZSTR_LEN(haystack) + offset + needle_len;
+ e = ZSTR_VAL(haystack) + ZSTR_LEN(haystack) + offset + ZSTR_LEN(needle);
}
}
- if ((found = zend_memnrstr(p, needle, needle_len, e))) {
+ if ((found = zend_memnrstr(p, ZSTR_VAL(needle), ZSTR_LEN(needle), e))) {
RETURN_LONG(found - ZSTR_VAL(haystack));
}
@@ -2135,77 +1979,50 @@ PHP_FUNCTION(strrpos)
}
/* }}} */
-/* {{{ proto int strripos(string haystack, string needle [, int offset])
+/* {{{ proto int|false strripos(string haystack, string needle [, int offset])
Finds position of last occurrence of a string within another string */
PHP_FUNCTION(strripos)
{
- zval *zneedle;
zend_string *needle;
zend_string *haystack;
zend_long offset = 0;
const char *p, *e, *found;
- zend_string *needle_dup, *haystack_dup, *ord_needle = NULL;
- ALLOCA_FLAG(use_heap);
+ zend_string *needle_dup, *haystack_dup;
ZEND_PARSE_PARAMETERS_START(2, 3)
Z_PARAM_STR(haystack)
- Z_PARAM_ZVAL(zneedle)
+ Z_PARAM_STR(needle)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(offset)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
-
- ZSTR_ALLOCA_ALLOC(ord_needle, 1, use_heap);
- if (Z_TYPE_P(zneedle) == IS_STRING) {
- needle = Z_STR_P(zneedle);
- } else {
- if (php_needle_char(zneedle, ZSTR_VAL(ord_needle)) != SUCCESS) {
- ZSTR_ALLOCA_FREE(ord_needle, use_heap);
- RETURN_FALSE;
- }
-
- php_error_docref(NULL, E_DEPRECATED,
- "Non-string needles will be interpreted as strings in the future. " \
- "Use an explicit chr() call to preserve the current behavior");
-
- ZSTR_VAL(ord_needle)[1] = '\0';
- needle = ord_needle;
- }
-
- if ((ZSTR_LEN(haystack) == 0) || (ZSTR_LEN(needle) == 0)) {
- ZSTR_ALLOCA_FREE(ord_needle, use_heap);
- RETURN_FALSE;
- }
+ ZEND_PARSE_PARAMETERS_END();
if (ZSTR_LEN(needle) == 1) {
/* Single character search can shortcut memcmps
Can also avoid tolower emallocs */
+ char lowered;
if (offset >= 0) {
if ((size_t)offset > ZSTR_LEN(haystack)) {
- ZSTR_ALLOCA_FREE(ord_needle, use_heap);
- php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string");
- RETURN_FALSE;
+ zend_value_error("Offset not contained in string");
+ RETURN_THROWS();
}
p = ZSTR_VAL(haystack) + (size_t)offset;
e = ZSTR_VAL(haystack) + ZSTR_LEN(haystack) - 1;
} else {
p = ZSTR_VAL(haystack);
- if (offset < -INT_MAX || (size_t)(-offset) > ZSTR_LEN(haystack)) {
- ZSTR_ALLOCA_FREE(ord_needle, use_heap);
- php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string");
- RETURN_FALSE;
+ if (offset < -ZEND_LONG_MAX || (size_t)(-offset) > ZSTR_LEN(haystack)) {
+ zend_value_error("Offset not contained in string");
+ RETURN_THROWS();
}
e = ZSTR_VAL(haystack) + (ZSTR_LEN(haystack) + (size_t)offset);
}
/* Borrow that ord_needle buffer to avoid repeatedly tolower()ing needle */
- *ZSTR_VAL(ord_needle) = tolower(*ZSTR_VAL(needle));
+ lowered = tolower(*ZSTR_VAL(needle));
while (e >= p) {
- if (tolower(*e) == *ZSTR_VAL(ord_needle)) {
- ZSTR_ALLOCA_FREE(ord_needle, use_heap);
+ if (tolower(*e) == lowered) {
RETURN_LONG(e - p + (offset > 0 ? offset : 0));
}
e--;
}
- ZSTR_ALLOCA_FREE(ord_needle, use_heap);
RETURN_FALSE;
}
@@ -2213,19 +2030,18 @@ PHP_FUNCTION(strripos)
if (offset >= 0) {
if ((size_t)offset > ZSTR_LEN(haystack)) {
zend_string_release_ex(haystack_dup, 0);
- ZSTR_ALLOCA_FREE(ord_needle, use_heap);
- php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string");
- RETURN_FALSE;
+ zend_value_error("Offset not contained in string");
+ RETURN_THROWS();
}
p = ZSTR_VAL(haystack_dup) + offset;
e = ZSTR_VAL(haystack_dup) + ZSTR_LEN(haystack);
} else {
- if (offset < -INT_MAX || (size_t)(-offset) > ZSTR_LEN(haystack)) {
+ if (offset < -ZEND_LONG_MAX || (size_t)(-offset) > ZSTR_LEN(haystack)) {
zend_string_release_ex(haystack_dup, 0);
- ZSTR_ALLOCA_FREE(ord_needle, use_heap);
- php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string");
- RETURN_FALSE;
+ zend_value_error("Offset not contained in string");
+ RETURN_THROWS();
}
+
p = ZSTR_VAL(haystack_dup);
if ((size_t)-offset < ZSTR_LEN(needle)) {
e = ZSTR_VAL(haystack_dup) + ZSTR_LEN(haystack);
@@ -2239,45 +2055,28 @@ PHP_FUNCTION(strripos)
RETVAL_LONG(found - ZSTR_VAL(haystack_dup));
zend_string_release_ex(needle_dup, 0);
zend_string_release_ex(haystack_dup, 0);
- ZSTR_ALLOCA_FREE(ord_needle, use_heap);
} else {
zend_string_release_ex(needle_dup, 0);
zend_string_release_ex(haystack_dup, 0);
- ZSTR_ALLOCA_FREE(ord_needle, use_heap);
RETURN_FALSE;
}
}
/* }}} */
-/* {{{ proto string strrchr(string haystack, string needle)
+/* {{{ proto string|false strrchr(string haystack, string needle)
Finds the last occurrence of a character in a string within another */
PHP_FUNCTION(strrchr)
{
- zval *needle;
- zend_string *haystack;
+ zend_string *haystack, *needle;
const char *found = NULL;
zend_long found_offset;
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_STR(haystack)
- Z_PARAM_ZVAL(needle)
+ Z_PARAM_STR(needle)
ZEND_PARSE_PARAMETERS_END();
- if (Z_TYPE_P(needle) == IS_STRING) {
- found = zend_memrchr(ZSTR_VAL(haystack), *Z_STRVAL_P(needle), ZSTR_LEN(haystack));
- } else {
- char needle_chr;
- if (php_needle_char(needle, &needle_chr) != SUCCESS) {
- RETURN_FALSE;
- }
-
- php_error_docref(NULL, E_DEPRECATED,
- "Non-string needles will be interpreted as strings in the future. " \
- "Use an explicit chr() call to preserve the current behavior");
-
- found = zend_memrchr(ZSTR_VAL(haystack), needle_chr, ZSTR_LEN(haystack));
- }
-
+ found = zend_memrchr(ZSTR_VAL(haystack), *ZSTR_VAL(needle), ZSTR_LEN(haystack));
if (found) {
found_offset = found - ZSTR_VAL(haystack);
RETURN_STRINGL(found, ZSTR_LEN(haystack) - found_offset);
@@ -2293,28 +2092,19 @@ static zend_string *php_chunk_split(const char *src, size_t srclen, const char *
{
char *q;
const char *p;
- size_t chunks; /* complete chunks! */
+ size_t chunks;
size_t restlen;
- size_t out_len;
zend_string *dest;
chunks = srclen / chunklen;
restlen = srclen - chunks * chunklen; /* srclen % chunklen */
-
- if (chunks > INT_MAX - 1) {
- return NULL;
- }
- out_len = chunks + 1;
- if (endlen !=0 && out_len > INT_MAX/endlen) {
- return NULL;
- }
- out_len *= endlen;
- if (out_len > INT_MAX - srclen - 1) {
- return NULL;
+ if (restlen) {
+ /* We want chunks to be rounded up rather than rounded down.
+ * Increment can't overflow because chunks <= SIZE_MAX/2 at this point. */
+ chunks++;
}
- out_len += srclen + 1;
- dest = zend_string_alloc(out_len * sizeof(char), 0);
+ dest = zend_string_safe_alloc(chunks, endlen, srclen, 0);
for (p = src, q = ZSTR_VAL(dest); p < (src + srclen - chunklen + 1); ) {
memcpy(q, p, chunklen);
@@ -2332,7 +2122,7 @@ static zend_string *php_chunk_split(const char *src, size_t srclen, const char *
}
*q = '\0';
- ZSTR_LEN(dest) = q - ZSTR_VAL(dest);
+ ZEND_ASSERT(q - ZSTR_VAL(dest) == ZSTR_LEN(dest));
return dest;
}
@@ -2356,8 +2146,8 @@ PHP_FUNCTION(chunk_split)
ZEND_PARSE_PARAMETERS_END();
if (chunklen <= 0) {
- php_error_docref(NULL, E_WARNING, "Chunk length should be greater than zero");
- RETURN_FALSE;
+ zend_value_error("Chunk length should be greater than zero");
+ RETURN_THROWS();
}
if ((size_t)chunklen > ZSTR_LEN(str)) {
@@ -2375,27 +2165,23 @@ PHP_FUNCTION(chunk_split)
result = php_chunk_split(ZSTR_VAL(str), ZSTR_LEN(str), end, endlen, (size_t)chunklen);
- if (result) {
- RETURN_STR(result);
- } else {
- RETURN_FALSE;
- }
+ RETURN_STR(result);
}
/* }}} */
-/* {{{ proto string substr(string str, int start [, int length])
+/* {{{ proto string|false substr(string str, int start [, int length])
Returns part of a string */
PHP_FUNCTION(substr)
{
zend_string *str;
zend_long l = 0, f;
- int argc = ZEND_NUM_ARGS();
+ zend_bool len_is_null = 1;
ZEND_PARSE_PARAMETERS_START(2, 3)
Z_PARAM_STR(str)
Z_PARAM_LONG(f)
Z_PARAM_OPTIONAL
- Z_PARAM_LONG(l)
+ Z_PARAM_LONG_OR_NULL(l, len_is_null)
ZEND_PARSE_PARAMETERS_END();
if (f > (zend_long)ZSTR_LEN(str)) {
@@ -2409,7 +2195,7 @@ PHP_FUNCTION(substr)
} else {
f = (zend_long)ZSTR_LEN(str) + f;
}
- if (argc > 2) {
+ if (!len_is_null) {
if (l < 0) {
/* if "length" position is negative, set it to the length
* needed to stop that many chars from the end of the string
@@ -2429,7 +2215,7 @@ PHP_FUNCTION(substr)
} else {
goto truncate_len;
}
- } else if (argc > 2) {
+ } else if (!len_is_null) {
if (l < 0) {
/* if "length" position is negative, set it to the length
* needed to stop that many chars from the end of the string
@@ -2459,41 +2245,34 @@ truncate_len:
}
/* }}} */
-/* {{{ proto mixed substr_replace(mixed str, mixed repl, mixed start [, mixed length])
+/* {{{ proto string|array|false substr_replace(mixed str, mixed repl, mixed start [, mixed length])
Replaces part of a string with another string */
PHP_FUNCTION(substr_replace)
{
- zval *str;
+ zend_string *str, *repl_str;
+ HashTable *str_ht, *repl_ht;
zval *from;
zval *len = NULL;
- zval *repl;
zend_long l = 0;
zend_long f;
int argc = ZEND_NUM_ARGS();
zend_string *result;
HashPosition from_idx, repl_idx, len_idx;
- zval *tmp_str = NULL, *tmp_from = NULL, *tmp_repl = NULL, *tmp_len= NULL;
+ zval *tmp_str = NULL, *tmp_repl, *tmp_from = NULL, *tmp_len= NULL;
ZEND_PARSE_PARAMETERS_START(3, 4)
- Z_PARAM_ZVAL(str)
- Z_PARAM_ZVAL(repl)
+ Z_PARAM_STR_OR_ARRAY_HT(str, str_ht)
+ Z_PARAM_STR_OR_ARRAY_HT(repl_str, repl_ht)
Z_PARAM_ZVAL(from)
Z_PARAM_OPTIONAL
Z_PARAM_ZVAL(len)
ZEND_PARSE_PARAMETERS_END();
- if (Z_TYPE_P(str) != IS_ARRAY) {
- convert_to_string_ex(str);
- }
- if (Z_TYPE_P(repl) != IS_ARRAY) {
- convert_to_string_ex(repl);
- }
if (Z_TYPE_P(from) != IS_ARRAY) {
convert_to_long_ex(from);
- }
-
- if (EG(exception)) {
- return;
+ if (EG(exception)) {
+ RETURN_THROWS();
+ }
}
if (argc > 3) {
@@ -2502,92 +2281,90 @@ PHP_FUNCTION(substr_replace)
l = Z_LVAL_P(len);
}
} else {
- if (Z_TYPE_P(str) != IS_ARRAY) {
- l = Z_STRLEN_P(str);
+ if (str) {
+ l = ZSTR_LEN(str);
}
}
- if (Z_TYPE_P(str) == IS_STRING) {
+ if (str) {
if (
(argc == 3 && Z_TYPE_P(from) == IS_ARRAY) ||
(argc == 4 && Z_TYPE_P(from) != Z_TYPE_P(len))
) {
php_error_docref(NULL, E_WARNING, "'start' and 'length' should be of same type - numerical or array ");
- RETURN_STR_COPY(Z_STR_P(str));
+ RETURN_STR_COPY(str);
}
if (argc == 4 && Z_TYPE_P(from) == IS_ARRAY) {
if (zend_hash_num_elements(Z_ARRVAL_P(from)) != zend_hash_num_elements(Z_ARRVAL_P(len))) {
php_error_docref(NULL, E_WARNING, "'start' and 'length' should have the same number of elements");
- RETURN_STR_COPY(Z_STR_P(str));
+ RETURN_STR_COPY(str);
}
}
}
- if (Z_TYPE_P(str) != IS_ARRAY) {
+ if (str) {
if (Z_TYPE_P(from) != IS_ARRAY) {
- zend_string *repl_str;
- zend_string *tmp_repl_str = NULL;
f = Z_LVAL_P(from);
/* if "from" position is negative, count start position from the end
* of the string
*/
if (f < 0) {
- f = (zend_long)Z_STRLEN_P(str) + f;
+ f = (zend_long)ZSTR_LEN(str) + f;
if (f < 0) {
f = 0;
}
- } else if ((size_t)f > Z_STRLEN_P(str)) {
- f = Z_STRLEN_P(str);
+ } else if ((size_t)f > ZSTR_LEN(str)) {
+ f = ZSTR_LEN(str);
}
/* if "length" position is negative, set it to the length
* needed to stop that many chars from the end of the string
*/
if (l < 0) {
- l = ((zend_long)Z_STRLEN_P(str) - f) + l;
+ l = ((zend_long)ZSTR_LEN(str) - f) + l;
if (l < 0) {
l = 0;
}
}
- if ((size_t)l > Z_STRLEN_P(str) || (l < 0 && (size_t)(-l) > Z_STRLEN_P(str))) {
- l = Z_STRLEN_P(str);
+ if ((size_t)l > ZSTR_LEN(str) || (l < 0 && (size_t)(-l) > ZSTR_LEN(str))) {
+ l = ZSTR_LEN(str);
}
- if ((f + l) > (zend_long)Z_STRLEN_P(str)) {
- l = Z_STRLEN_P(str) - f;
+ if ((f + l) > (zend_long)ZSTR_LEN(str)) {
+ l = ZSTR_LEN(str) - f;
}
- if (Z_TYPE_P(repl) == IS_ARRAY) {
+
+ zend_string *tmp_repl_str = NULL;
+ if (repl_ht) {
repl_idx = 0;
- while (repl_idx < Z_ARRVAL_P(repl)->nNumUsed) {
- tmp_repl = &Z_ARRVAL_P(repl)->arData[repl_idx].val;
+ while (repl_idx < repl_ht->nNumUsed) {
+ tmp_repl = &repl_ht->arData[repl_idx].val;
if (Z_TYPE_P(tmp_repl) != IS_UNDEF) {
break;
}
repl_idx++;
}
- if (repl_idx < Z_ARRVAL_P(repl)->nNumUsed) {
+ if (repl_idx < repl_ht->nNumUsed) {
repl_str = zval_get_tmp_string(tmp_repl, &tmp_repl_str);
} else {
repl_str = STR_EMPTY_ALLOC();
}
- } else {
- repl_str = Z_STR_P(repl);
}
- result = zend_string_safe_alloc(1, Z_STRLEN_P(str) - l + ZSTR_LEN(repl_str), 0, 0);
+ result = zend_string_safe_alloc(1, ZSTR_LEN(str) - l + ZSTR_LEN(repl_str), 0, 0);
- memcpy(ZSTR_VAL(result), Z_STRVAL_P(str), f);
+ memcpy(ZSTR_VAL(result), ZSTR_VAL(str), f);
if (ZSTR_LEN(repl_str)) {
memcpy((ZSTR_VAL(result) + f), ZSTR_VAL(repl_str), ZSTR_LEN(repl_str));
}
- memcpy((ZSTR_VAL(result) + f + ZSTR_LEN(repl_str)), Z_STRVAL_P(str) + f + l, Z_STRLEN_P(str) - f - l);
+ memcpy((ZSTR_VAL(result) + f + ZSTR_LEN(repl_str)), ZSTR_VAL(str) + f + l, ZSTR_LEN(str) - f - l);
ZSTR_VAL(result)[ZSTR_LEN(result)] = '\0';
zend_tmp_string_release(tmp_repl_str);
RETURN_NEW_STR(result);
} else {
php_error_docref(NULL, E_WARNING, "Functionality of 'start' and 'length' as arrays is not implemented");
- RETURN_STR_COPY(Z_STR_P(str));
+ RETURN_STR_COPY(str);
}
} else { /* str is array of strings */
zend_string *str_index = NULL;
@@ -2598,7 +2375,7 @@ PHP_FUNCTION(substr_replace)
from_idx = len_idx = repl_idx = 0;
- ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(str), num_index, str_index, tmp_str) {
+ ZEND_HASH_FOREACH_KEY_VAL(str_ht, num_index, str_index, tmp_str) {
zend_string *tmp_orig_str;
zend_string *orig_str = zval_get_tmp_string(tmp_str, &tmp_orig_str);
@@ -2670,15 +2447,15 @@ PHP_FUNCTION(substr_replace)
result_len = ZSTR_LEN(orig_str) - l;
- if (Z_TYPE_P(repl) == IS_ARRAY) {
- while (repl_idx < Z_ARRVAL_P(repl)->nNumUsed) {
- tmp_repl = &Z_ARRVAL_P(repl)->arData[repl_idx].val;
- if (Z_TYPE_P(tmp_repl) != IS_UNDEF) {
+ if (repl_ht) {
+ while (repl_idx < repl_ht->nNumUsed) {
+ tmp_repl = &repl_ht->arData[repl_idx].val;
+ if (repl_ht != IS_UNDEF) {
break;
}
repl_idx++;
}
- if (repl_idx < Z_ARRVAL_P(repl)->nNumUsed) {
+ if (repl_idx < repl_ht->nNumUsed) {
zend_string *tmp_repl_str;
zend_string *repl_str = zval_get_tmp_string(tmp_repl, &tmp_repl_str);
@@ -2697,13 +2474,13 @@ PHP_FUNCTION(substr_replace)
memcpy((ZSTR_VAL(result) + f), ZSTR_VAL(orig_str) + f + l, ZSTR_LEN(orig_str) - f - l);
}
} else {
- result_len += Z_STRLEN_P(repl);
+ result_len += ZSTR_LEN(repl_str);
result = zend_string_safe_alloc(1, result_len, 0, 0);
memcpy(ZSTR_VAL(result), ZSTR_VAL(orig_str), f);
- memcpy((ZSTR_VAL(result) + f), Z_STRVAL_P(repl), Z_STRLEN_P(repl));
- memcpy((ZSTR_VAL(result) + f + Z_STRLEN_P(repl)), ZSTR_VAL(orig_str) + f + l, ZSTR_LEN(orig_str) - f - l);
+ memcpy((ZSTR_VAL(result) + f), ZSTR_VAL(repl_str), ZSTR_LEN(repl_str));
+ memcpy((ZSTR_VAL(result) + f + ZSTR_LEN(repl_str)), ZSTR_VAL(orig_str) + f + l, ZSTR_LEN(orig_str) - f - l);
}
ZSTR_VAL(result)[ZSTR_LEN(result)] = '\0';
@@ -2739,8 +2516,8 @@ PHP_FUNCTION(quotemeta)
old_end = ZSTR_VAL(old) + ZSTR_LEN(old);
- if (ZSTR_VAL(old) == old_end) {
- RETURN_FALSE;
+ if (ZSTR_LEN(old) == 0) {
+ RETURN_EMPTY_STRING();
}
str = zend_string_safe_alloc(2, ZSTR_LEN(old), 0, 0);
@@ -2796,7 +2573,7 @@ PHP_FUNCTION(chr)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_LONG(c)
- ZEND_PARSE_PARAMETERS_END_EX(c = 0);
+ ZEND_PARSE_PARAMETERS_END();
c &= 0xff;
ZVAL_INTERNED_STR(return_value, ZSTR_CHAR(c));
@@ -3024,8 +2801,8 @@ static void php_strtr_array(zval *return_value, zend_string *input, HashTable *p
} else {
len = ZSTR_LEN(str_key);
if (UNEXPECTED(len < 1)) {
- efree(num_bitset);
- RETURN_FALSE;
+ php_error_docref(NULL, E_WARNING, "Ignoring replacement of empty string");
+ continue;
} else if (UNEXPECTED(len > slen)) {
/* skip long patterns */
continue;
@@ -3455,26 +3232,29 @@ PHPAPI zend_string *php_str_to_str(const char *haystack, size_t length, const ch
}
/* }}} */
-/* {{{ proto string strtr(string str, string from[, string to])
+/* {{{ proto string|false strtr(string str, string from[, string to])
Translates characters in str using given translation tables */
PHP_FUNCTION(strtr)
{
- zval *from;
- zend_string *str;
+ zend_string *str, *from_str = NULL;
+ HashTable *from_ht = NULL;
char *to = NULL;
size_t to_len = 0;
int ac = ZEND_NUM_ARGS();
ZEND_PARSE_PARAMETERS_START(2, 3)
Z_PARAM_STR(str)
- Z_PARAM_ZVAL(from)
+ Z_PARAM_STR_OR_ARRAY_HT(from_str, from_ht)
Z_PARAM_OPTIONAL
Z_PARAM_STRING(to, to_len)
ZEND_PARSE_PARAMETERS_END();
- if (ac == 2 && Z_TYPE_P(from) != IS_ARRAY) {
- php_error_docref(NULL, E_WARNING, "The second argument is not an array");
- RETURN_FALSE;
+ if (ac == 2 && from_ht == NULL) {
+ zend_type_error("If two arguments are passed, the second argument must be an array");
+ RETURN_THROWS();
+ } else if (ac != 2 && from_str == NULL) {
+ zend_type_error("If three arguments are passed, the second argument must be a string");
+ RETURN_THROWS();
}
/* shortcut for empty string */
@@ -3483,22 +3263,21 @@ PHP_FUNCTION(strtr)
}
if (ac == 2) {
- HashTable *pats = Z_ARRVAL_P(from);
-
- if (zend_hash_num_elements(pats) < 1) {
+ if (zend_hash_num_elements(from_ht) < 1) {
RETURN_STR_COPY(str);
- } else if (zend_hash_num_elements(pats) == 1) {
+ } else if (zend_hash_num_elements(from_ht) == 1) {
zend_long num_key;
zend_string *str_key, *tmp_str, *replace, *tmp_replace;
zval *entry;
- ZEND_HASH_FOREACH_KEY_VAL(pats, num_key, str_key, entry) {
+ ZEND_HASH_FOREACH_KEY_VAL(from_ht, num_key, str_key, entry) {
tmp_str = NULL;
if (UNEXPECTED(!str_key)) {
str_key = tmp_str = zend_long_to_str(num_key);
}
replace = zval_get_tmp_string(entry, &tmp_replace);
if (ZSTR_LEN(str_key) < 1) {
+ php_error_docref(NULL, E_WARNING, "Ignoring replacement of empty string");
RETVAL_STR_COPY(str);
} else if (ZSTR_LEN(str_key) == 1) {
RETVAL_STR(php_char_to_str_ex(str,
@@ -3518,17 +3297,13 @@ PHP_FUNCTION(strtr)
return;
} ZEND_HASH_FOREACH_END();
} else {
- php_strtr_array(return_value, str, pats);
+ php_strtr_array(return_value, str, from_ht);
}
} else {
- if (!try_convert_to_string(from)) {
- return;
- }
-
RETURN_STR(php_strtr_ex(str,
- Z_STRVAL_P(from),
+ ZSTR_VAL(from_str),
to,
- MIN(Z_STRLEN_P(from), to_len)));
+ MIN(ZSTR_LEN(from_str), to_len)));
}
}
/* }}} */
@@ -4354,25 +4129,20 @@ PHPAPI void php_stripslashes(zend_string *str)
/* {{{ php_str_replace_in_subject
*/
-static zend_long php_str_replace_in_subject(zval *search, zval *replace, zval *subject, zval *result, int case_sensitivity)
+static zend_long php_str_replace_in_subject(zval *search, zval *replace, zend_string *subject_str, zval *result, int case_sensitivity)
{
zval *search_entry,
*replace_entry = NULL;
zend_string *tmp_result,
- *tmp_subject_str,
*tmp_replace_entry_str = NULL,
*replace_entry_str;
char *replace_value = NULL;
size_t replace_len = 0;
zend_long replace_count = 0;
- zend_string *subject_str;
zend_string *lc_subject_str = NULL;
uint32_t replace_idx;
- /* Make sure we're dealing with strings. */
- subject_str = zval_get_tmp_string(subject, &tmp_subject_str);
if (ZSTR_LEN(subject_str) == 0) {
- zend_tmp_string_release(tmp_subject_str);
ZVAL_EMPTY_STRING(result);
return 0;
}
@@ -4476,7 +4246,6 @@ static zend_long php_str_replace_in_subject(zval *search, zval *replace, zval *s
if (lc_subject_str) {
zend_string_release_ex(lc_subject_str, 0);
}
- zend_tmp_string_release(tmp_subject_str);
return replace_count;
}
}
@@ -4511,7 +4280,6 @@ static zend_long php_str_replace_in_subject(zval *search, zval *replace, zval *s
ZVAL_STR_COPY(result, subject_str);
}
}
- zend_tmp_string_release(tmp_subject_str);
return replace_count;
}
/* }}} */
@@ -4520,7 +4288,9 @@ static zend_long php_str_replace_in_subject(zval *search, zval *replace, zval *s
*/
static void php_str_replace_common(INTERNAL_FUNCTION_PARAMETERS, int case_sensitivity)
{
- zval *subject, *search, *replace, *subject_entry, *zcount = NULL;
+ zend_string *subject_str;
+ HashTable *subject_ht;
+ zval *search, *replace, *subject_entry, *zcount = NULL;
zval result;
zend_string *string_key;
zend_ulong num_key;
@@ -4530,7 +4300,7 @@ static void php_str_replace_common(INTERNAL_FUNCTION_PARAMETERS, int case_sensit
ZEND_PARSE_PARAMETERS_START(3, 4)
Z_PARAM_ZVAL(search)
Z_PARAM_ZVAL(replace)
- Z_PARAM_ZVAL(subject)
+ Z_PARAM_STR_OR_ARRAY_HT(subject_str, subject_ht)
Z_PARAM_OPTIONAL
Z_PARAM_ZVAL(zcount)
ZEND_PARSE_PARAMETERS_END();
@@ -4546,19 +4316,22 @@ static void php_str_replace_common(INTERNAL_FUNCTION_PARAMETERS, int case_sensit
}
if (EG(exception)) {
- return;
+ RETURN_THROWS();
}
/* if subject is an array */
- if (Z_TYPE_P(subject) == IS_ARRAY) {
+ if (subject_ht) {
array_init(return_value);
/* For each subject entry, convert it to string, then perform replacement
and add the result to the return_value array. */
- ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(subject), num_key, string_key, subject_entry) {
+ ZEND_HASH_FOREACH_KEY_VAL(subject_ht, num_key, string_key, subject_entry) {
ZVAL_DEREF(subject_entry);
if (Z_TYPE_P(subject_entry) != IS_ARRAY && Z_TYPE_P(subject_entry) != IS_OBJECT) {
- count += php_str_replace_in_subject(search, replace, subject_entry, &result, case_sensitivity);
+ zend_string *tmp_subject_str;
+ subject_str = zval_get_tmp_string(subject_entry, &tmp_subject_str);
+ count += php_str_replace_in_subject(search, replace, subject_str, &result, case_sensitivity);
+ zend_tmp_string_release(tmp_subject_str);
} else {
ZVAL_COPY(&result, subject_entry);
}
@@ -4570,7 +4343,7 @@ static void php_str_replace_common(INTERNAL_FUNCTION_PARAMETERS, int case_sensit
}
} ZEND_HASH_FOREACH_END();
} else { /* if subject is not an array */
- count = php_str_replace_in_subject(search, replace, subject, return_value, case_sensitivity);
+ count = php_str_replace_in_subject(search, replace, subject_str, return_value, case_sensitivity);
}
if (argc > 3) {
ZEND_TRY_ASSIGN_REF_LONG(zcount, count);
@@ -4594,12 +4367,9 @@ PHP_FUNCTION(str_ireplace)
}
/* }}} */
-/* {{{ php_hebrev
- *
- * Converts Logical Hebrew text (Hebrew Windows style) to Visual text
- * Cheers/complaints/flames - Zeev Suraski <zeev@php.net>
- */
-static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines)
+/* {{{ proto string hebrev(string str [, int max_chars_per_line])
+ Converts logical Hebrew text to visual text */
+PHP_FUNCTION(hebrev)
{
char *str, *heb_str, *target;
const char *tmp;
@@ -4616,7 +4386,7 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines)
ZEND_PARSE_PARAMETERS_END();
if (str_len == 0) {
- RETURN_FALSE;
+ RETURN_EMPTY_STRING();
}
tmp = str;
@@ -4759,28 +4529,7 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines)
}
efree(heb_str);
- if (convert_newlines) {
- RETVAL_STR(php_char_to_str_ex(broken_str, '\n', "<br />\n", 7, 1, NULL));
- zend_string_release_ex(broken_str, 0);
- } else {
- RETURN_NEW_STR(broken_str);
- }
-}
-/* }}} */
-
-/* {{{ proto string hebrev(string str [, int max_chars_per_line])
- Converts logical Hebrew text to visual text */
-PHP_FUNCTION(hebrev)
-{
- php_hebrev(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto string hebrevc(string str [, int max_chars_per_line])
- Converts logical Hebrew text to visual text with newline conversion */
-PHP_FUNCTION(hebrevc)
-{
- php_hebrev(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
+ RETURN_NEW_STR(broken_str);
}
/* }}} */
@@ -4910,13 +4659,13 @@ PHP_FUNCTION(strip_tags)
}
buf = zend_string_init(ZSTR_VAL(str), ZSTR_LEN(str), 0);
- ZSTR_LEN(buf) = php_strip_tags_ex(ZSTR_VAL(buf), ZSTR_LEN(str), NULL, allowed_tags, allowed_tags_len, 0);
+ ZSTR_LEN(buf) = php_strip_tags_ex(ZSTR_VAL(buf), ZSTR_LEN(str), allowed_tags, allowed_tags_len, 0);
smart_str_free(&tags_ss);
RETURN_NEW_STR(buf);
}
/* }}} */
-/* {{{ proto string setlocale(mixed category, string locale [, string ...])
+/* {{{ proto string|false setlocale(int category, string locale [, string ...])
Set locale information */
PHP_FUNCTION(setlocale)
{
@@ -5029,7 +4778,7 @@ PHP_FUNCTION(setlocale)
}
/* }}} */
-/* {{{ proto void parse_str(string encoded_string [, array &result])
+/* {{{ proto void parse_str(string encoded_string, array &result)
Parses GET/POST/COOKIE data and sets global variables */
PHP_FUNCTION(parse_str)
{
@@ -5038,39 +4787,18 @@ PHP_FUNCTION(parse_str)
char *res = NULL;
size_t arglen;
- ZEND_PARSE_PARAMETERS_START(1, 2)
+ ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_STRING(arg, arglen)
- Z_PARAM_OPTIONAL
Z_PARAM_ZVAL(arrayArg)
ZEND_PARSE_PARAMETERS_END();
- res = estrndup(arg, arglen);
-
- if (arrayArg == NULL) {
- zval tmp;
- zend_array *symbol_table;
- if (zend_forbid_dynamic_call("parse_str() with a single argument") == FAILURE) {
- efree(res);
- return;
- }
-
- php_error_docref(NULL, E_DEPRECATED, "Calling parse_str() without the result argument is deprecated");
-
- symbol_table = zend_rebuild_symbol_table();
- ZVAL_ARR(&tmp, symbol_table);
- sapi_module.treat_data(PARSE_STRING, res, &tmp);
- if (UNEXPECTED(zend_hash_del(symbol_table, ZSTR_KNOWN(ZEND_STR_THIS)) == SUCCESS)) {
- zend_throw_error(NULL, "Cannot re-assign $this");
- }
- } else {
- arrayArg = zend_try_array_init(arrayArg);
- if (!arrayArg) {
- efree(res);
- return;
- }
-
- sapi_module.treat_data(PARSE_STRING, res, arrayArg);
+ arrayArg = zend_try_array_init(arrayArg);
+ if (!arrayArg) {
+ RETURN_THROWS();
}
+
+ res = estrndup(arg, arglen);
+ sapi_module.treat_data(PARSE_STRING, res, arrayArg);
}
/* }}} */
@@ -5141,9 +4869,9 @@ int php_tag_find(char *tag, size_t len, const char *set) {
}
/* }}} */
-PHPAPI size_t php_strip_tags(char *rbuf, size_t len, uint8_t *stateptr, const char *allow, size_t allow_len) /* {{{ */
+PHPAPI size_t php_strip_tags(char *rbuf, size_t len, const char *allow, size_t allow_len) /* {{{ */
{
- return php_strip_tags_ex(rbuf, len, stateptr, allow, allow_len, 0);
+ return php_strip_tags_ex(rbuf, len, allow, allow_len, 0);
}
/* }}} */
@@ -5167,7 +4895,7 @@ PHPAPI size_t php_strip_tags(char *rbuf, size_t len, uint8_t *stateptr, const ch
swm: Added ability to strip <?xml tags without assuming it PHP
code.
*/
-PHPAPI size_t php_strip_tags_ex(char *rbuf, size_t len, uint8_t *stateptr, const char *allow, size_t allow_len, zend_bool allow_tag_spaces)
+PHPAPI size_t php_strip_tags_ex(char *rbuf, size_t len, const char *allow, size_t allow_len, zend_bool allow_tag_spaces)
{
char *tbuf, *tp, *rp, c, lc;
const char *buf, *p, *end;
@@ -5192,18 +4920,6 @@ PHPAPI size_t php_strip_tags_ex(char *rbuf, size_t len, uint8_t *stateptr, const
tbuf = tp = NULL;
}
- if (stateptr) {
- state = *stateptr;
- switch (state) {
- case 1: goto state_1;
- case 2: goto state_2;
- case 3: goto state_3;
- case 4: goto state_4;
- default:
- break;
- }
- }
-
state_0:
if (p >= end) {
goto finish;
@@ -5497,8 +5213,6 @@ finish:
if (allow_free) {
efree(allow_free);
}
- if (stateptr)
- *stateptr = state;
return (size_t)(rp - rbuf);
}
@@ -5547,8 +5261,8 @@ PHP_FUNCTION(str_repeat)
ZEND_PARSE_PARAMETERS_END();
if (mult < 0) {
- php_error_docref(NULL, E_WARNING, "Second argument has to be greater than or equal to 0");
- return;
+ zend_value_error("Second argument has to be greater than or equal to 0");
+ RETURN_THROWS();
}
/* Don't waste our time if it's empty */
@@ -5585,7 +5299,7 @@ PHP_FUNCTION(str_repeat)
}
/* }}} */
-/* {{{ proto mixed count_chars(string input [, int mode])
+/* {{{ proto array|string count_chars(string input [, int mode])
Returns info about what characters are used in input */
PHP_FUNCTION(count_chars)
{
@@ -5605,8 +5319,8 @@ PHP_FUNCTION(count_chars)
ZEND_PARSE_PARAMETERS_END();
if (mymode < 0 || mymode > 4) {
- php_error_docref(NULL, E_WARNING, "Unknown mode");
- RETURN_FALSE;
+ zend_value_error("Unknown mode");
+ RETURN_THROWS();
}
buf = (const unsigned char *) ZSTR_VAL(input);
@@ -5714,10 +5428,7 @@ PHP_FUNCTION(localeconv)
zval grouping, mon_grouping;
int len, i;
- /* We don't need no stinkin' parameters... */
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
array_init(return_value);
array_init(&grouping);
@@ -5773,13 +5484,13 @@ PHP_FUNCTION(strnatcasecmp)
}
/* }}} */
-/* {{{ proto int substr_count(string haystack, string needle [, int offset [, int length]])
+/* {{{ proto int|false substr_count(string haystack, string needle [, int offset [, int length]])
Returns the number of times a substring occurs in the string */
PHP_FUNCTION(substr_count)
{
char *haystack, *needle;
zend_long offset = 0, length = 0;
- int ac = ZEND_NUM_ARGS();
+ zend_bool length_is_null = 1;
zend_long count = 0;
size_t haystack_len, needle_len;
const char *p, *endp;
@@ -5790,12 +5501,12 @@ PHP_FUNCTION(substr_count)
Z_PARAM_STRING(needle, needle_len)
Z_PARAM_OPTIONAL
Z_PARAM_LONG(offset)
- Z_PARAM_LONG(length)
+ Z_PARAM_LONG_OR_NULL(length, length_is_null)
ZEND_PARSE_PARAMETERS_END();
if (needle_len == 0) {
- php_error_docref(NULL, E_WARNING, "Empty substring");
- RETURN_FALSE;
+ zend_value_error("Empty substring");
+ RETURN_THROWS();
}
p = haystack;
@@ -5805,12 +5516,12 @@ PHP_FUNCTION(substr_count)
offset += (zend_long)haystack_len;
}
if ((offset < 0) || ((size_t)offset > haystack_len)) {
- php_error_docref(NULL, E_WARNING, "Offset not contained in string");
- RETURN_FALSE;
+ zend_value_error("Offset not contained in string");
+ RETURN_THROWS();
}
p += offset;
- if (ac == 4) {
+ if (!length_is_null) {
if (length < 0) {
length += (haystack_len - offset);
@@ -5871,21 +5582,16 @@ PHP_FUNCTION(str_pad)
}
if (pad_str_len == 0) {
- php_error_docref(NULL, E_WARNING, "Padding string cannot be empty");
- return;
+ zend_value_error("Padding string cannot be empty");
+ RETURN_THROWS();
}
if (pad_type_val < STR_PAD_LEFT || pad_type_val > STR_PAD_BOTH) {
- php_error_docref(NULL, E_WARNING, "Padding type has to be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH");
- return;
+ zend_value_error("Padding type has to be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH");
+ RETURN_THROWS();
}
num_pad_chars = pad_length - ZSTR_LEN(input);
- if (num_pad_chars >= INT_MAX) {
- php_error_docref(NULL, E_WARNING, "Padding length is too long");
- return;
- }
-
result = zend_string_safe_alloc(1, ZSTR_LEN(input), num_pad_chars, 0);
ZSTR_LEN(result) = 0;
@@ -5925,7 +5631,7 @@ PHP_FUNCTION(str_pad)
}
/* }}} */
-/* {{{ proto mixed sscanf(string str, string format [, string ...])
+/* {{{ proto array|int|null sscanf(string str, string format [, string ...])
Implements an ANSI C compatible sscanf */
PHP_FUNCTION(sscanf)
{
@@ -6083,7 +5789,7 @@ static void php_string_shuffle(char *str, zend_long len) /* {{{ */
}
/* }}} */
-/* {{{ proto void str_shuffle(string str)
+/* {{{ proto string str_shuffle(string str)
Shuffles string. One permutation of all possible is created */
PHP_FUNCTION(str_shuffle)
{
@@ -6100,13 +5806,13 @@ PHP_FUNCTION(str_shuffle)
}
/* }}} */
-/* {{{ proto mixed str_word_count(string str, [int format [, string charlist]])
+
+/* {{{ proto array|int str_word_count(string str, [int format [, string charlist]])
Counts the number of words inside a string. If format of 1 is specified,
then the function will return an array containing all the words
found inside the string. If format of 2 is specified, then the function
will return an associated array where the position of the word is the key
and the word itself is the value.
-
For the purpose of this function, 'word' is defined as a locale dependent
string containing alphabetic characters, which also may contain, but not start
with "'" and "-" characters.
@@ -6141,8 +5847,8 @@ PHP_FUNCTION(str_word_count)
/* nothing to be done */
break;
default:
- php_error_docref(NULL, E_WARNING, "Invalid format value " ZEND_LONG_FMT, type);
- RETURN_FALSE;
+ zend_value_error("Invalid format value " ZEND_LONG_FMT, type);
+ RETURN_THROWS();
}
if (char_list) {
@@ -6190,58 +5896,6 @@ PHP_FUNCTION(str_word_count)
/* }}} */
-#if HAVE_STRFMON
-/* {{{ proto string money_format(string format , float value)
- Convert monetary value(s) to string */
-PHP_FUNCTION(money_format)
-{
- size_t format_len = 0;
- char *format, *p, *e;
- double value;
- zend_bool check = 0;
- zend_string *str;
- ssize_t res_len;
-
- ZEND_PARSE_PARAMETERS_START(2, 2)
- Z_PARAM_STRING(format, format_len)
- Z_PARAM_DOUBLE(value)
- ZEND_PARSE_PARAMETERS_END();
-
- p = format;
- e = p + format_len;
- while ((p = memchr(p, '%', (e - p)))) {
- if (*(p + 1) == '%') {
- p += 2;
- } else if (!check) {
- check = 1;
- p++;
- } else {
- php_error_docref(NULL, E_WARNING, "Only a single %%i or %%n token can be used");
- RETURN_FALSE;
- }
- }
-
- str = zend_string_safe_alloc(format_len, 1, 1024, 0);
- if ((res_len = strfmon(ZSTR_VAL(str), ZSTR_LEN(str), format, value)) < 0) {
- zend_string_efree(str);
- RETURN_FALSE;
- }
-#ifdef _AIX
- /*
- On AIX strfmon seems to include the terminating \0 in the length returned by strfmon,
- despite the documentation indicating it is not included.
- */
- ZSTR_LEN(str) = strlen(ZSTR_VAL(str));
-#else
- ZSTR_LEN(str) = (size_t)res_len;
-#endif
- ZSTR_VAL(str)[ZSTR_LEN(str)] = '\0';
-
- RETURN_NEW_STR(zend_string_truncate(str, ZSTR_LEN(str), 0));
-}
-/* }}} */
-#endif
-
/* {{{ proto array str_split(string str [, int split_length])
Convert a string to an array. If split_length is specified, break the string down into chunks each split_length characters long. */
PHP_FUNCTION(str_split)
@@ -6258,8 +5912,8 @@ PHP_FUNCTION(str_split)
ZEND_PARSE_PARAMETERS_END();
if (split_length <= 0) {
- php_error_docref(NULL, E_WARNING, "The length of each segment must be greater than zero");
- RETURN_FALSE;
+ zend_value_error("The length of each segment must be greater than zero");
+ RETURN_THROWS();
}
@@ -6285,7 +5939,7 @@ PHP_FUNCTION(str_split)
}
/* }}} */
-/* {{{ proto array strpbrk(string haystack, string char_list)
+/* {{{ proto string|false strpbrk(string haystack, string char_list)
Search a string for any of a set of characters */
PHP_FUNCTION(strpbrk)
{
@@ -6295,11 +5949,11 @@ PHP_FUNCTION(strpbrk)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_STR(haystack)
Z_PARAM_STR(char_list)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (!ZSTR_LEN(char_list)) {
- php_error_docref(NULL, E_WARNING, "The character list cannot be empty");
- RETURN_FALSE;
+ zend_value_error("The character list cannot be empty");
+ RETURN_THROWS();
}
for (haystack_ptr = ZSTR_VAL(haystack); haystack_ptr < (ZSTR_VAL(haystack) + ZSTR_LEN(haystack)); ++haystack_ptr) {
@@ -6314,7 +5968,7 @@ PHP_FUNCTION(strpbrk)
}
/* }}} */
-/* {{{ proto int substr_compare(string main_str, string str, int offset [, int length [, bool case_sensitivity]])
+/* {{{ proto int|false substr_compare(string main_str, string str, int offset [, int length [, bool case_sensitivity]])
Binary safe optionally case insensitive comparison of 2 strings from an offset, up to length characters */
PHP_FUNCTION(substr_compare)
{
@@ -6329,16 +5983,16 @@ PHP_FUNCTION(substr_compare)
Z_PARAM_STR(s2)
Z_PARAM_LONG(offset)
Z_PARAM_OPTIONAL
- Z_PARAM_LONG_EX(len, len_is_default, 1, 0)
+ Z_PARAM_LONG_OR_NULL(len, len_is_default)
Z_PARAM_BOOL(cs)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (!len_is_default && len <= 0) {
if (len == 0) {
RETURN_LONG(0L);
} else {
- php_error_docref(NULL, E_WARNING, "The length must be greater than or equal to zero");
- RETURN_FALSE;
+ zend_value_error("The length must be greater than or equal to zero");
+ RETURN_THROWS();
}
}
diff --git a/ext/standard/syslog.c b/ext/standard/syslog.c
index 29967df34a..b07f6d6a51 100644
--- a/ext/standard/syslog.c
+++ b/ext/standard/syslog.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -164,9 +162,7 @@ PHP_FUNCTION(openlog)
Close connection to system logger */
PHP_FUNCTION(closelog)
{
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
closelog();
if (BG(syslog_device)) {
diff --git a/ext/standard/tests/array/002.phpt b/ext/standard/tests/array/002.phpt
index f6aa37b9fb..589514ae03 100644
--- a/ext/standard/tests/array/002.phpt
+++ b/ext/standard/tests/array/002.phpt
@@ -8,16 +8,16 @@ require(__DIR__ . '/data.inc');
function test_sort ($sort_function, $data) {
echo "\n -- Testing $sort_function() -- \n";
- echo "No second argument:\n";
+ echo "No second argument:\n";
$sort_function ($data);
var_dump ($data);
- echo "Using SORT_REGULAR:\n";
+ echo "Using SORT_REGULAR:\n";
$sort_function ($data, SORT_REGULAR);
var_dump ($data);
- echo "Using SORT_NUMERIC:\n";
+ echo "Using SORT_NUMERIC:\n";
$sort_function ($data, SORT_NUMERIC);
var_dump ($data);
- echo "Using SORT_STRING\n";
+ echo "Using SORT_STRING\n";
$sort_function ($data, SORT_STRING);
var_dump ($data);
}
@@ -130,17 +130,17 @@ array(8) {
}
Using SORT_STRING
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
array(8) {
[1000]=>
string(4) "test"
@@ -240,15 +240,15 @@ array(8) {
}
Using SORT_STRING
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
array(8) {
[16777216]=>
float(-0.33333333333333)
@@ -544,17 +544,17 @@ array(8) {
}
Using SORT_STRING
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
array(8) {
[0]=>
string(4) "test"
@@ -654,15 +654,15 @@ array(8) {
}
Using SORT_STRING
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %s002.php on line 16
+Warning: Array to string conversion in %s on line %d
array(8) {
[0]=>
float(-0.33333333333333)
diff --git a/ext/standard/tests/array/004.phpt b/ext/standard/tests/array/004.phpt
index 765637b26c..0f9fc5507c 100644
--- a/ext/standard/tests/array/004.phpt
+++ b/ext/standard/tests/array/004.phpt
@@ -5,11 +5,11 @@ precision=14
--FILE--
<?php
$data = array(
- 'Test1',
- 'teST2'=>0,
- 5=>'test2',
- 'abc'=>'test10',
- 'test21'
+ 'Test1',
+ 'teST2'=>0,
+ 5=>'test2',
+ 'abc'=>'test10',
+ 'test21'
);
var_dump($data);
diff --git a/ext/standard/tests/array/005.phpt b/ext/standard/tests/array/005.phpt
index c82f5f7fd0..c51e98a67b 100644
--- a/ext/standard/tests/array/005.phpt
+++ b/ext/standard/tests/array/005.phpt
@@ -33,18 +33,6 @@ $mixed_array = array(
/* Testing Error Conditions */
echo "\n*** Testing Error Conditions ***\n";
-/* Zero argument */
-var_dump( array_shift() );
-
-/* Scalar argument */
-var_dump( array_shift($number) );
-
-/* String argument */
-var_dump( array_shift($str) );
-
-/* Invalid Number of arguments */
-var_dump( array_shift($mixed_array[1],$mixed_array[2]) );
-
/* Empty Array as argument */
var_dump( array_shift($empty_array) );
@@ -83,18 +71,6 @@ echo"Done";
?>
--EXPECTF--
*** Testing Error Conditions ***
-
-Warning: array_shift() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: array_shift() expects parameter 1 to be array, int given in %s on line %d
-NULL
-
-Warning: array_shift() expects parameter 1 to be array, string given in %s on line %d
-NULL
-
-Warning: array_shift() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
NULL
*** Testing with various array inputs ***
diff --git a/ext/standard/tests/array/007.phpt b/ext/standard/tests/array/007.phpt
index 4a1270eca6..a1c984a18b 100644
--- a/ext/standard/tests/array/007.phpt
+++ b/ext/standard/tests/array/007.phpt
@@ -51,27 +51,27 @@ var_dump(array_diff_assoc($a,$b,$c));
echo "-=-=-=-=-=-=-=-=- New functionality from 5.0.0 -=-=-=-=-=-=-=-\n";
error_reporting(E_ALL);
class cr {
- private $priv_member;
- public $public_member;
- function __construct($val) {
- $this->priv_member = $val;
- $this->public_member = $val;
- }
- static function comp_func_cr($a, $b) {
- if ($a->priv_member === $b->priv_member) return 0;
- return ($a->priv_member > $b->priv_member)? 1:-1;
- }
+ private $priv_member;
+ public $public_member;
+ function __construct($val) {
+ $this->priv_member = $val;
+ $this->public_member = $val;
+ }
+ static function comp_func_cr($a, $b) {
+ if ($a->priv_member === $b->priv_member) return 0;
+ return ($a->priv_member > $b->priv_member)? 1:-1;
+ }
}
function comp_func($a, $b) {
- if ($a === $b) return 0;
- return ($a > $b)? 1:-1;
+ if ($a === $b) return 0;
+ return ($a > $b)? 1:-1;
}
function comp_func_cr($a, $b) {
- if ($a->public_member === $b->public_member) return 0;
- return ($a->public_member > $b->public_member)? 1:-1;
+ if ($a->public_member === $b->public_member) return 0;
+ return ($a->public_member > $b->public_member)? 1:-1;
}
diff --git a/ext/standard/tests/array/009.phpt b/ext/standard/tests/array/009.phpt
index 017456917e..c62be0d27c 100644
--- a/ext/standard/tests/array/009.phpt
+++ b/ext/standard/tests/array/009.phpt
@@ -69,51 +69,6 @@ foreach ($varient_arrays as $sub_array ) {
echo "\n";
}
-/*test these functions on array which is already unset */
-echo "\n-- Testing variation: when array is unset --\n";
-$unset_array = array (1);
-unset($unset_array);
-
-var_dump( current($unset_array) );
-var_dump( key($unset_array) );
-var_dump( next($unset_array) );
-var_dump( reset($unset_array) );
-
-
-echo "\n*** Testing error conditions ***\n";
-//Zero argument, expected 1 argument
-var_dump( key() );
-var_dump( current() );
-var_dump( reset() );
-var_dump( next() );
-
-// args more than expected, expected 1 argument
-$temp_array = array(1);
-var_dump( key($temp_array, $temp_array) );
-var_dump( current($temp_array, $temp_array) );
-var_dump( reset($temp_array, $temp_array) );
-var_dump( next($temp_array, $temp_array) );
-
-// invalid args type, valid argument: array
-$int_var = 1;
-$float_var = 1.5;
-$string = "string";
-var_dump( key($int_var) );
-var_dump( key($float_var) );
-var_dump( key($string) );
-
-var_dump( current($int_var) );
-var_dump( current($float_var) );
-var_dump( current($string) );
-
-var_dump( next($int_var) );
-var_dump( next($float_var) );
-var_dump( next($string) );
-
-var_dump( reset($int_var) );
-var_dump( reset($float_var) );
-var_dump( reset($string) );
-
echo "Done\n";
?>
--EXPECTF--
@@ -456,84 +411,4 @@ array(5) {
string(4) "zero"
}
-
--- Testing variation: when array is unset --
-
-Notice: Undefined variable: unset_array in %s on line %d
-
-Warning: current() expects parameter 1 to be array, null given in %s on line %d
-NULL
-
-Notice: Undefined variable: unset_array in %s on line %d
-
-Warning: key() expects parameter 1 to be array, null given in %s on line %d
-NULL
-
-Warning: next() expects parameter 1 to be array, null given in %s on line %d
-NULL
-
-Warning: reset() expects parameter 1 to be array, null given in %s on line %d
-NULL
-
-*** Testing error conditions ***
-
-Warning: key() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: current() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: reset() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: next() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: key() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: current() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: reset() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: next() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: key() expects parameter 1 to be array, int given in %s on line %d
-NULL
-
-Warning: key() expects parameter 1 to be array, float given in %s on line %d
-NULL
-
-Warning: key() expects parameter 1 to be array, string given in %s on line %d
-NULL
-
-Warning: current() expects parameter 1 to be array, int given in %s on line %d
-NULL
-
-Warning: current() expects parameter 1 to be array, float given in %s on line %d
-NULL
-
-Warning: current() expects parameter 1 to be array, string given in %s on line %d
-NULL
-
-Warning: next() expects parameter 1 to be array, int given in %s on line %d
-NULL
-
-Warning: next() expects parameter 1 to be array, float given in %s on line %d
-NULL
-
-Warning: next() expects parameter 1 to be array, string given in %s on line %d
-NULL
-
-Warning: reset() expects parameter 1 to be array, int given in %s on line %d
-NULL
-
-Warning: reset() expects parameter 1 to be array, float given in %s on line %d
-NULL
-
-Warning: reset() expects parameter 1 to be array, string given in %s on line %d
-NULL
Done
diff --git a/ext/standard/tests/array/array_change_key_case.phpt b/ext/standard/tests/array/array_change_key_case.phpt
index ca9a21128b..115a7096d8 100644
--- a/ext/standard/tests/array/array_change_key_case.phpt
+++ b/ext/standard/tests/array/array_change_key_case.phpt
@@ -52,10 +52,10 @@ echo "*** Testing basic operations ***\n";
$loop_counter = 1;
foreach ($arrays as $item) {
echo "** Iteration $loop_counter **\n"; $loop_counter++;
- var_dump(array_change_key_case($item));
- var_dump(array_change_key_case($item, CASE_UPPER));
- var_dump(array_change_key_case($item, CASE_LOWER));
- echo "\n";
+ var_dump(array_change_key_case($item));
+ var_dump(array_change_key_case($item, CASE_UPPER));
+ var_dump(array_change_key_case($item, CASE_LOWER));
+ echo "\n";
}
echo "end\n";
diff --git a/ext/standard/tests/array/array_change_key_case_variation.phpt b/ext/standard/tests/array/array_change_key_case_variation.phpt
index 3f8d502ffe..f2b185523f 100644
--- a/ext/standard/tests/array/array_change_key_case_variation.phpt
+++ b/ext/standard/tests/array/array_change_key_case_variation.phpt
@@ -6,13 +6,16 @@ Test array_change_key_case() function - 2
$item = array ("one" => 1, "two" => 2, "THREE" => 3, "FOUR" => "four");
/* use 'case' argument other than CASE_LOWER & CASE_UPPER */
-var_dump(array_change_key_case($item, "CASE_UPPER"));
+try {
+ var_dump(array_change_key_case($item, "CASE_UPPER"));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump(array_change_key_case($item, 5));
/* when keys are different in terms of only case */
/* should return one value key pair with key being in lowercase */
var_dump( array_change_key_case( array("ONE" => 1, "one" => 3, "One" => 4) ) );
-var_dump( array_change_key_case( array("ONE" => 1, "one" => 6, "One" => 5), "CASE_UPPER" ) );
/* should return one value key pair with key being in uppercase */
var_dump( array_change_key_case( array("ONE" => 1, "one" => 2, "One" => 3), CASE_UPPER ) );
@@ -21,8 +24,7 @@ var_dump( array_change_key_case( array("ONE" => 1, "one" => 1, "One" => 2), 5 )
echo "end\n";
?>
--EXPECTF--
-Warning: array_change_key_case() expects parameter 2 to be int, string given in %s on line %d
-NULL
+array_change_key_case() expects parameter 2 to be int, string given
array(4) {
["ONE"]=>
int(1)
@@ -37,9 +39,6 @@ array(1) {
["one"]=>
int(4)
}
-
-Warning: array_change_key_case() expects parameter 2 to be int, string given in %s on line %d
-NULL
array(1) {
["ONE"]=>
int(3)
diff --git a/ext/standard/tests/array/array_change_key_case_variation4.phpt b/ext/standard/tests/array/array_change_key_case_variation4.phpt
index 52017177cc..eaacfaac58 100644
--- a/ext/standard/tests/array/array_change_key_case_variation4.phpt
+++ b/ext/standard/tests/array/array_change_key_case_variation4.phpt
@@ -15,9 +15,9 @@ echo "*** Testing array_change_key_case() : usage variations ***\n";
$input = array('One' => 'un', 'TWO' => 'deux', 'three' => 'trois');
for ($i = -5; $i <=5; $i += 1){
- echo "\n-- \$sort argument is $i --\n";
- $temp = $input;
- var_dump(array_change_key_case($temp, $i));
+ echo "\n-- \$sort argument is $i --\n";
+ $temp = $input;
+ var_dump(array_change_key_case($temp, $i));
}
echo "Done";
diff --git a/ext/standard/tests/array/array_change_key_case_variation6.phpt b/ext/standard/tests/array/array_change_key_case_variation6.phpt
index 383993c38c..aa87ee1fb5 100644
--- a/ext/standard/tests/array/array_change_key_case_variation6.phpt
+++ b/ext/standard/tests/array/array_change_key_case_variation6.phpt
@@ -20,7 +20,7 @@ $input = array('English' => array('one' => 1, 'two' => 2, 'three' => 3),
echo "\n-- Pass a two-dimensional array as \$input argument --\n";
var_dump(array_change_key_case($input, CASE_UPPER));
-echo "\n-- Pass a sub-arry as \$input argument --\n";
+echo "\n-- Pass a sub-array as \$input argument --\n";
var_dump(array_change_key_case($input['English'], CASE_UPPER));
echo "Done";
@@ -59,7 +59,7 @@ array(3) {
}
}
--- Pass a sub-arry as $input argument --
+-- Pass a sub-array as $input argument --
array(3) {
["ONE"]=>
int(1)
diff --git a/ext/standard/tests/array/array_change_key_case_variation8.phpt b/ext/standard/tests/array/array_change_key_case_variation8.phpt
index e610ba0e98..17455c54da 100644
--- a/ext/standard/tests/array/array_change_key_case_variation8.phpt
+++ b/ext/standard/tests/array/array_change_key_case_variation8.phpt
@@ -3,7 +3,7 @@ Test array_change_key_case() function : usage variations - Different strings as
--FILE--
<?php
/* Prototype : array array_change_key_case(array $input [, int $case])
- * Description: Retuns an array with all string keys lowercased [or uppercased]
+ * Description: Returns an array with all string keys lowercased [or uppercased]
* Source code: ext/standard/array.c
*/
@@ -14,18 +14,18 @@ Test array_change_key_case() function : usage variations - Different strings as
echo "*** Testing array_change_key_case() : usage variations ***\n";
$inputs = array (
- // group of escape sequences
- array(null => 1, NULL => 2, "\a" => 3, "\cx" => 4, "\e" => 5, "\f" => 6, "\n" => 7, "\t" => 8, "\xhh" => 9, "\ddd" => 10, "\v" => 11),
+ // group of escape sequences
+ array(null => 1, NULL => 2, "\a" => 3, "\cx" => 4, "\e" => 5, "\f" => 6, "\n" => 7, "\t" => 8, "\xhh" => 9, "\ddd" => 10, "\v" => 11),
- // array contains combination of capital/small letters
- array("lemoN" => 1, "Orange" => 2, "banana" => 3, "apple" => 4, "Test" => 5, "TTTT" => 6, "ttt" => 7, "ww" => 8, "x" => 9, "X" => 10, "oraNGe" => 11, "BANANA" => 12)
+ // array contains combination of capital/small letters
+ array("lemoN" => 1, "Orange" => 2, "banana" => 3, "apple" => 4, "Test" => 5, "TTTT" => 6, "ttt" => 7, "ww" => 8, "x" => 9, "X" => 10, "oraNGe" => 11, "BANANA" => 12)
);
foreach($inputs as $input) {
- echo "\n-- \$case = default --\n";
- var_dump(array_change_key_case($input));
- echo "-- \$case = upper --\n";
- var_dump(array_change_key_case($input, CASE_UPPER));
+ echo "\n-- \$case = default --\n";
+ var_dump(array_change_key_case($input));
+ echo "-- \$case = upper --\n";
+ var_dump(array_change_key_case($input, CASE_UPPER));
}
echo "Done";
diff --git a/ext/standard/tests/array/array_chunk.phpt b/ext/standard/tests/array/array_chunk.phpt
deleted file mode 100644
index 2ee77e129c..0000000000
--- a/ext/standard/tests/array/array_chunk.phpt
+++ /dev/null
@@ -1,21 +0,0 @@
---TEST--
-array_chunk()
---FILE--
-<?php
-$array = array ();
-var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
- echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
- echo "\n";
-}
-?>
---EXPECT--
-array(0) {
-}
-[0]
-NULL
-NULL
-NULL
diff --git a/ext/standard/tests/array/array_chunk2.phpt b/ext/standard/tests/array/array_chunk2.phpt
index 6d8b74545e..a49ccc4eae 100644
--- a/ext/standard/tests/array/array_chunk2.phpt
+++ b/ext/standard/tests/array/array_chunk2.phpt
@@ -3,8 +3,19 @@ basic array_chunk test
--FILE--
<?php
$input_array = array('a', 'b', 'c', 'd', 'e');
-var_dump(array_chunk($input_array, 0));
-var_dump(array_chunk($input_array, 0, true));
+
+try {
+ var_dump(array_chunk($input_array, 0));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+}
+
+try {
+ var_dump(array_chunk($input_array, 0, true));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+}
+
var_dump(array_chunk($input_array, 1));
var_dump(array_chunk($input_array, 1, true));
var_dump(array_chunk($input_array, 2));
@@ -12,12 +23,9 @@ var_dump(array_chunk($input_array, 2, true));
var_dump(array_chunk($input_array, 10));
var_dump(array_chunk($input_array, 10, true));
?>
---EXPECTF--
-Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
-NULL
-
-Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
-NULL
+--EXPECT--
+Size parameter expected to be greater than 0
+Size parameter expected to be greater than 0
array(5) {
[0]=>
array(1) {
diff --git a/ext/standard/tests/array/array_chunk_basic1.phpt b/ext/standard/tests/array/array_chunk_basic1.phpt
index b84b0871f4..8bd92eb14e 100644
--- a/ext/standard/tests/array/array_chunk_basic1.phpt
+++ b/ext/standard/tests/array/array_chunk_basic1.phpt
@@ -1,5 +1,5 @@
--TEST--
-Test array_chunk() function : basic functionality - defualt 'preserve_keys'
+Test array_chunk() function : basic functionality - default 'preserve_keys'
--FILE--
<?php
/* Prototype : array array_chunk(array $array, int $size [, bool $preserve_keys])
@@ -24,7 +24,7 @@ $input_arrays = array (
// associative arrays - key as numeric
array(1 => 'one', 2 => "two", 3 => "three"),
- // array containing elements with/witout keys
+ // array containing elements with/without keys
array(1 => 'one','two', 3 => 'three', 4, "five" => 5)
);
diff --git a/ext/standard/tests/array/array_chunk_variation10.phpt b/ext/standard/tests/array/array_chunk_variation10.phpt
index 7b4bee172b..326d7de98f 100644
--- a/ext/standard/tests/array/array_chunk_variation10.phpt
+++ b/ext/standard/tests/array/array_chunk_variation10.phpt
@@ -4,12 +4,12 @@ array_chunk() - variation 10
<?php
$array = array (1 => 1, 2 => 2, 3 => 3);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
- echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
- echo "\n";
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
+ echo "[$i]\n";
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
+ echo "\n";
}
?>
--EXPECT--
@@ -21,11 +21,6 @@ array(3) {
[3]=>
int(3)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(3) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation11.phpt b/ext/standard/tests/array/array_chunk_variation11.phpt
index dca366652d..e3ce445370 100644
--- a/ext/standard/tests/array/array_chunk_variation11.phpt
+++ b/ext/standard/tests/array/array_chunk_variation11.phpt
@@ -5,12 +5,12 @@ array_chunk() - variation 11
$array = array (0 => 0, 3 => 2);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
- echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
- echo "\n";
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
+ echo "[$i]\n";
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
+ echo "\n";
}
?>
--EXPECT--
@@ -20,11 +20,6 @@ array(2) {
[3]=>
int(2)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(2) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation12.phpt b/ext/standard/tests/array/array_chunk_variation12.phpt
index 3b87dbab95..3b0cb79beb 100644
--- a/ext/standard/tests/array/array_chunk_variation12.phpt
+++ b/ext/standard/tests/array/array_chunk_variation12.phpt
@@ -4,12 +4,12 @@ array_chunk() - variation 12
<?php
$array = array (1 => 1, 5 => 2, 8 => 3);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
- echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
- echo "\n";
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
+ echo "[$i]\n";
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
+ echo "\n";
}
?>
--EXPECT--
@@ -21,11 +21,6 @@ array(3) {
[8]=>
int(3)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(3) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation13.phpt b/ext/standard/tests/array/array_chunk_variation13.phpt
index f6369df1c8..f62d309c15 100644
--- a/ext/standard/tests/array/array_chunk_variation13.phpt
+++ b/ext/standard/tests/array/array_chunk_variation13.phpt
@@ -4,12 +4,12 @@ array_chunk() - variation 13
<?php
$array = array (1, 2);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
- echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
- echo "\n";
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
+ echo "[$i]\n";
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
+ echo "\n";
}
?>
--EXPECT--
@@ -19,11 +19,6 @@ array(2) {
[1]=>
int(2)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(2) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation14.phpt b/ext/standard/tests/array/array_chunk_variation14.phpt
index f8d1b11790..64746bf6e7 100644
--- a/ext/standard/tests/array/array_chunk_variation14.phpt
+++ b/ext/standard/tests/array/array_chunk_variation14.phpt
@@ -4,12 +4,12 @@ array_chunk() - variation 14
<?php
$array = array (0, 1, 2);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
- echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
- echo "\n";
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
+ echo "[$i]\n";
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
+ echo "\n";
}
?>
--EXPECT--
@@ -21,11 +21,6 @@ array(3) {
[2]=>
int(2)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(3) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation15.phpt b/ext/standard/tests/array/array_chunk_variation15.phpt
index abec754a3d..294dd9f8f9 100644
--- a/ext/standard/tests/array/array_chunk_variation15.phpt
+++ b/ext/standard/tests/array/array_chunk_variation15.phpt
@@ -4,12 +4,12 @@ array_chunk() - variation 15
<?php
$array = array (1, 2, 3);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
- echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
- echo "\n";
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
+ echo "[$i]\n";
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
+ echo "\n";
}
?>
--EXPECT--
@@ -21,11 +21,6 @@ array(3) {
[2]=>
int(3)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(3) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation16.phpt b/ext/standard/tests/array/array_chunk_variation16.phpt
index 18179c8b07..b7159cba99 100644
--- a/ext/standard/tests/array/array_chunk_variation16.phpt
+++ b/ext/standard/tests/array/array_chunk_variation16.phpt
@@ -4,12 +4,12 @@ array_chunk() - variation 16
<?php
$array = array (0, 1, 2, 3);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
- echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
- echo "\n";
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
+ echo "[$i]\n";
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
+ echo "\n";
}
?>
--EXPECT--
@@ -23,11 +23,6 @@ array(4) {
[3]=>
int(3)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(4) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation17.phpt b/ext/standard/tests/array/array_chunk_variation17.phpt
index 27507ea8cd..07826d06f8 100644
--- a/ext/standard/tests/array/array_chunk_variation17.phpt
+++ b/ext/standard/tests/array/array_chunk_variation17.phpt
@@ -4,12 +4,12 @@ array_chunk() - variation 17
<?php
$array = array (1, 2, 3, 4);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
- echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
- echo "\n";
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
+ echo "[$i]\n";
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
+ echo "\n";
}
?>
--EXPECT--
@@ -23,11 +23,6 @@ array(4) {
[3]=>
int(4)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(4) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation18.phpt b/ext/standard/tests/array/array_chunk_variation18.phpt
index 7f0946f497..1fa9ca6ec4 100644
--- a/ext/standard/tests/array/array_chunk_variation18.phpt
+++ b/ext/standard/tests/array/array_chunk_variation18.phpt
@@ -4,12 +4,12 @@ array_chunk() - variation 18
<?php
$array = array (0, 1, 2, 3, 4);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
- echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
- echo "\n";
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
+ echo "[$i]\n";
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
+ echo "\n";
}
?>
--EXPECT--
@@ -25,11 +25,6 @@ array(5) {
[4]=>
int(4)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(5) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation19.phpt b/ext/standard/tests/array/array_chunk_variation19.phpt
index d51389c9f3..2591db89eb 100644
--- a/ext/standard/tests/array/array_chunk_variation19.phpt
+++ b/ext/standard/tests/array/array_chunk_variation19.phpt
@@ -4,12 +4,12 @@ array_chunk() - variation 19
<?php
$array = array (1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
- echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
- echo "\n";
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
+ echo "[$i]\n";
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
+ echo "\n";
}
?>
--EXPECT--
@@ -35,11 +35,6 @@ array(10) {
[9]=>
int(10)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(10) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation20.phpt b/ext/standard/tests/array/array_chunk_variation20.phpt
index cd5314ff04..ec2e45b104 100644
--- a/ext/standard/tests/array/array_chunk_variation20.phpt
+++ b/ext/standard/tests/array/array_chunk_variation20.phpt
@@ -4,12 +4,12 @@ array_chunk() - variation 20
<?php
$array = array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
- echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
- echo "\n";
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
+ echo "[$i]\n";
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
+ echo "\n";
}
?>
--EXPECT--
@@ -37,11 +37,6 @@ array(11) {
[10]=>
int(10)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(11) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation21.phpt b/ext/standard/tests/array/array_chunk_variation21.phpt
index 678bf16751..ce672a9209 100644
--- a/ext/standard/tests/array/array_chunk_variation21.phpt
+++ b/ext/standard/tests/array/array_chunk_variation21.phpt
@@ -4,12 +4,12 @@ array_chunk() - variation 21
<?php
$array = array ("a" => 1);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
- echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
- echo "\n";
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
+ echo "[$i]\n";
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
+ echo "\n";
}
?>
--EXPECT--
@@ -17,11 +17,6 @@ array(1) {
["a"]=>
int(1)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(1) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation22.phpt b/ext/standard/tests/array/array_chunk_variation22.phpt
index 45c458ebf9..d67269f4e7 100644
--- a/ext/standard/tests/array/array_chunk_variation22.phpt
+++ b/ext/standard/tests/array/array_chunk_variation22.phpt
@@ -4,12 +4,12 @@ array_chunk() - variation 22
<?php
$array = array ("b" => 1, "c" => 2);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
- echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
- echo "\n";
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
+ echo "[$i]\n";
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
+ echo "\n";
}
?>
--EXPECT--
@@ -19,11 +19,6 @@ array(2) {
["c"]=>
int(2)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(2) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation23.phpt b/ext/standard/tests/array/array_chunk_variation23.phpt
index 80b92985b1..99138eaeb3 100644
--- a/ext/standard/tests/array/array_chunk_variation23.phpt
+++ b/ext/standard/tests/array/array_chunk_variation23.phpt
@@ -4,12 +4,12 @@ array_chunk() - variation 23
<?php
$array = array ("p" => 1, "q" => 2, "r" => 3, "s" => 4, "u" => 5, "v" => 6);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
- echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
- echo "\n";
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
+ echo "[$i]\n";
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
+ echo "\n";
}
?>
--EXPECT--
@@ -27,11 +27,6 @@ array(6) {
["v"]=>
int(6)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(6) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation24.phpt b/ext/standard/tests/array/array_chunk_variation24.phpt
index e25f53f6b6..c96d59d874 100644
--- a/ext/standard/tests/array/array_chunk_variation24.phpt
+++ b/ext/standard/tests/array/array_chunk_variation24.phpt
@@ -4,12 +4,12 @@ array_chunk() - variation 24
<?php
$array = array ("a" => "A");
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
- echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
- echo "\n";
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
+ echo "[$i]\n";
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
+ echo "\n";
}
?>
--EXPECT--
@@ -17,11 +17,6 @@ array(1) {
["a"]=>
string(1) "A"
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(1) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation25.phpt b/ext/standard/tests/array/array_chunk_variation25.phpt
index eae89e952b..978588e02c 100644
--- a/ext/standard/tests/array/array_chunk_variation25.phpt
+++ b/ext/standard/tests/array/array_chunk_variation25.phpt
@@ -4,12 +4,12 @@ array_chunk() - variation 25
<?php
$array = array ("p" => "A", "q" => "B", "r" => "C", "s" => "D", "u" => "E", "v" => "F");
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
- echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
- echo "\n";
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
+ echo "[$i]\n";
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
+ echo "\n";
}
?>
--EXPECT--
@@ -27,11 +27,6 @@ array(6) {
["v"]=>
string(1) "F"
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(6) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation26.phpt b/ext/standard/tests/array/array_chunk_variation26.phpt
index 487f6b4f67..7b46215ffb 100644
--- a/ext/standard/tests/array/array_chunk_variation26.phpt
+++ b/ext/standard/tests/array/array_chunk_variation26.phpt
@@ -4,12 +4,12 @@ array_chunk() - variation 26
<?php
$array =array (0);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
- echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
- echo "\n";
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
+ echo "[$i]\n";
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
+ echo "\n";
}
?>
--EXPECT--
@@ -17,11 +17,6 @@ array(1) {
[0]=>
int(0)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(1) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation27.phpt b/ext/standard/tests/array/array_chunk_variation27.phpt
index a83a16b7fb..a91a8b91b9 100644
--- a/ext/standard/tests/array/array_chunk_variation27.phpt
+++ b/ext/standard/tests/array/array_chunk_variation27.phpt
@@ -4,12 +4,12 @@ array_chunk() - variation 27
<?php
$array = array (1);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
- echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
- echo "\n";
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
+ echo "[$i]\n";
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
+ echo "\n";
}
?>
--EXPECT--
@@ -17,11 +17,6 @@ array(1) {
[0]=>
int(1)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(1) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation28.phpt b/ext/standard/tests/array/array_chunk_variation28.phpt
index bdbaf45cbd..707b0cdefc 100644
--- a/ext/standard/tests/array/array_chunk_variation28.phpt
+++ b/ext/standard/tests/array/array_chunk_variation28.phpt
@@ -4,12 +4,12 @@ array_chunk() - variation 28
<?php
$array = array (-1);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
- echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
- echo "\n";
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
+ echo "[$i]\n";
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
+ echo "\n";
}
?>
--EXPECT--
@@ -17,11 +17,6 @@ array(1) {
[0]=>
int(-1)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(1) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation29.phpt b/ext/standard/tests/array/array_chunk_variation29.phpt
index 12f50c1190..07187135be 100644
--- a/ext/standard/tests/array/array_chunk_variation29.phpt
+++ b/ext/standard/tests/array/array_chunk_variation29.phpt
@@ -4,12 +4,12 @@ array_chunk() - variation 29
<?php
$array = array (0, 2);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
- echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
- echo "\n";
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
+ echo "[$i]\n";
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
+ echo "\n";
}
?>
--EXPECT--
@@ -19,11 +19,6 @@ array(2) {
[1]=>
int(2)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(2) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation30.phpt b/ext/standard/tests/array/array_chunk_variation30.phpt
index 281537a876..5400b595eb 100644
--- a/ext/standard/tests/array/array_chunk_variation30.phpt
+++ b/ext/standard/tests/array/array_chunk_variation30.phpt
@@ -4,12 +4,12 @@ array_chunk() - variation 30
<?php
$array = array (1, 2, 3);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
- echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
- echo "\n";
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
+ echo "[$i]\n";
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
+ echo "\n";
}
?>
--EXPECT--
@@ -21,11 +21,6 @@ array(3) {
[2]=>
int(3)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(3) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation31.phpt b/ext/standard/tests/array/array_chunk_variation31.phpt
index 1592679839..ffdfa2bc13 100644
--- a/ext/standard/tests/array/array_chunk_variation31.phpt
+++ b/ext/standard/tests/array/array_chunk_variation31.phpt
@@ -4,12 +4,12 @@ array_chunk() - variation 31
<?php
$array = array (1 => 0);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
- echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
- echo "\n";
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
+ echo "[$i]\n";
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
+ echo "\n";
}
?>
--EXPECT--
@@ -17,11 +17,6 @@ array(1) {
[1]=>
int(0)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(1) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation32.phpt b/ext/standard/tests/array/array_chunk_variation32.phpt
index cf65993c0b..b0a01f209a 100644
--- a/ext/standard/tests/array/array_chunk_variation32.phpt
+++ b/ext/standard/tests/array/array_chunk_variation32.phpt
@@ -4,12 +4,12 @@ array_chunk() - variation 32
<?php
$array = array (2 => 1);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
- echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
- echo "\n";
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
+ echo "[$i]\n";
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
+ echo "\n";
}
?>
--EXPECT--
@@ -17,11 +17,6 @@ array(1) {
[2]=>
int(1)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(1) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation4.phpt b/ext/standard/tests/array/array_chunk_variation4.phpt
index d82f9fcc5f..2396e022f4 100644
--- a/ext/standard/tests/array/array_chunk_variation4.phpt
+++ b/ext/standard/tests/array/array_chunk_variation4.phpt
@@ -23,7 +23,7 @@ $input_array = array (
"array3" => array(1)
);
-echo "\n-- Testing array_chunk() by supplying an array containing different sub arrays & 'preserve_key' as defualt --\n";
+echo "\n-- Testing array_chunk() by supplying an array containing different sub arrays & 'preserve_key' as default --\n";
var_dump( array_chunk($input_array, $size) );
echo "\n-- Testing array_chunk() by supplying an array containing different sub arrays & 'preserve_key' = true --\n";
@@ -37,7 +37,7 @@ echo "Done";
--EXPECT--
*** Testing array_chunk() : usage variations ***
--- Testing array_chunk() by supplying an array containing different sub arrays & 'preserve_key' as defualt --
+-- Testing array_chunk() by supplying an array containing different sub arrays & 'preserve_key' as default --
array(2) {
[0]=>
array(2) {
diff --git a/ext/standard/tests/array/array_chunk_variation5.phpt b/ext/standard/tests/array/array_chunk_variation5.phpt
index 50050892e7..fca31d51c8 100644
--- a/ext/standard/tests/array/array_chunk_variation5.phpt
+++ b/ext/standard/tests/array/array_chunk_variation5.phpt
@@ -26,26 +26,32 @@ $sizes = array(-1, count($input_array) + 1, 0, 1.5);
// loop through the array for size argument
foreach ($sizes as $size){
- echo "\n-- Testing array_chunk() when size = $size --\n";
- var_dump( array_chunk($input_array, $size) );
- var_dump( array_chunk($input_array, $size, true) );
- var_dump( array_chunk($input_array, $size, false) );
+ echo "\n-- Testing array_chunk() when size = $size --\n";
+ try {
+ var_dump( array_chunk($input_array, $size) );
+ } catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+ }
+ try {
+ var_dump( array_chunk($input_array, $size, true) );
+ } catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+ }
+ try {
+ var_dump( array_chunk($input_array, $size, false) );
+ } catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+ }
}
-echo "Done";
?>
---EXPECTF--
+
+--EXPECT--
*** Testing array_chunk() : usage variations ***
-- Testing array_chunk() when size = -1 --
-
-Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
-NULL
-
-Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
-NULL
-
-Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
-NULL
+Size parameter expected to be greater than 0
+Size parameter expected to be greater than 0
+Size parameter expected to be greater than 0
-- Testing array_chunk() when size = 4 --
array(1) {
@@ -83,15 +89,9 @@ array(1) {
}
-- Testing array_chunk() when size = 0 --
-
-Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
-NULL
-
-Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
-NULL
-
-Warning: array_chunk(): Size parameter expected to be greater than 0 in %s on line %d
-NULL
+Size parameter expected to be greater than 0
+Size parameter expected to be greater than 0
+Size parameter expected to be greater than 0
-- Testing array_chunk() when size = 1.5 --
array(3) {
@@ -145,4 +145,3 @@ array(3) {
int(3)
}
}
-Done
diff --git a/ext/standard/tests/array/array_chunk_variation8.phpt b/ext/standard/tests/array/array_chunk_variation8.phpt
index 6a6e752ecb..2d8fa07c97 100644
--- a/ext/standard/tests/array/array_chunk_variation8.phpt
+++ b/ext/standard/tests/array/array_chunk_variation8.phpt
@@ -4,12 +4,12 @@ array_chunk() - variation 8
<?php
$array = array (3 => -1);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
- echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
- echo "\n";
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
+ echo "[$i]\n";
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
+ echo "\n";
}
?>
--EXPECT--
@@ -17,11 +17,6 @@ array(1) {
[3]=>
int(-1)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(1) {
[0]=>
diff --git a/ext/standard/tests/array/array_chunk_variation9.phpt b/ext/standard/tests/array/array_chunk_variation9.phpt
index ec57da4f88..2be7b81e83 100644
--- a/ext/standard/tests/array/array_chunk_variation9.phpt
+++ b/ext/standard/tests/array/array_chunk_variation9.phpt
@@ -4,12 +4,12 @@ array_chunk() - variation 9
<?php
$array = array (1 => 0, 2 => 2);
var_dump ($array);
-for ($i = 0; $i < (sizeof($array) + 1); $i++) {
- echo "[$i]\n";
- var_dump (@array_chunk ($array, $i));
- var_dump (@array_chunk ($array, $i, TRUE));
- var_dump (@array_chunk ($array, $i, FALSE));
- echo "\n";
+for ($i = 1; $i < (sizeof($array) + 1); $i++) {
+ echo "[$i]\n";
+ var_dump (array_chunk ($array, $i));
+ var_dump (array_chunk ($array, $i, TRUE));
+ var_dump (array_chunk ($array, $i, FALSE));
+ echo "\n";
}
?>
--EXPECT--
@@ -19,11 +19,6 @@ array(2) {
[2]=>
int(2)
}
-[0]
-NULL
-NULL
-NULL
-
[1]
array(2) {
[0]=>
diff --git a/ext/standard/tests/array/array_column_basic.phpt b/ext/standard/tests/array/array_column_basic.phpt
index 418f373872..57056b971f 100644
--- a/ext/standard/tests/array/array_column_basic.phpt
+++ b/ext/standard/tests/array/array_column_basic.phpt
@@ -12,21 +12,21 @@ Test array_column() function: basic functionality
echo "*** Testing array_column() : basic functionality ***\n";
/* Array representing a possible record set returned from a database */
$records = array(
- array(
- 'id' => 1,
- 'first_name' => 'John',
- 'last_name' => 'Doe'
- ),
- array(
- 'id' => 2,
- 'first_name' => 'Sally',
- 'last_name' => 'Smith'
- ),
- array(
- 'id' => 3,
- 'first_name' => 'Jane',
- 'last_name' => 'Jones'
- )
+ array(
+ 'id' => 1,
+ 'first_name' => 'John',
+ 'last_name' => 'Doe'
+ ),
+ array(
+ 'id' => 2,
+ 'first_name' => 'Sally',
+ 'last_name' => 'Smith'
+ ),
+ array(
+ 'id' => 3,
+ 'first_name' => 'Jane',
+ 'last_name' => 'Jones'
+ )
);
echo "-- first_name column from recordset --\n";
@@ -44,47 +44,47 @@ var_dump(array_column($records, 'last_name', 'first_name'));
echo "\n*** Testing multiple data types ***\n";
$fh = fopen(__FILE__, 'r', true);
$values = array(
- array(
- 'id' => 1,
- 'value' => new stdClass
- ),
- array(
- 'id' => 2,
- 'value' => 34.2345
- ),
- array(
- 'id' => 3,
- 'value' => true
- ),
- array(
- 'id' => 4,
- 'value' => false
- ),
- array(
- 'id' => 5,
- 'value' => null
- ),
- array(
- 'id' => 6,
- 'value' => 1234
- ),
- array(
- 'id' => 7,
- 'value' => 'Foo'
- ),
- array(
- 'id' => 8,
- 'value' => $fh
- )
+ array(
+ 'id' => 1,
+ 'value' => new stdClass
+ ),
+ array(
+ 'id' => 2,
+ 'value' => 34.2345
+ ),
+ array(
+ 'id' => 3,
+ 'value' => true
+ ),
+ array(
+ 'id' => 4,
+ 'value' => false
+ ),
+ array(
+ 'id' => 5,
+ 'value' => null
+ ),
+ array(
+ 'id' => 6,
+ 'value' => 1234
+ ),
+ array(
+ 'id' => 7,
+ 'value' => 'Foo'
+ ),
+ array(
+ 'id' => 8,
+ 'value' => $fh
+ )
);
var_dump(array_column($values, 'value'));
var_dump(array_column($values, 'value', 'id'));
echo "\n*** Testing numeric column keys ***\n";
$numericCols = array(
- array('aaa', '111'),
- array('bbb', '222'),
- array('ccc', '333', -1 => 'ddd')
+ array('aaa', '111'),
+ array('bbb', '222'),
+ array('ccc', '333', -1 => 'ddd')
);
var_dump(array_column($numericCols, 1));
var_dump(array_column($numericCols, 1, 0));
diff --git a/ext/standard/tests/array/array_column_error.phpt b/ext/standard/tests/array/array_column_error.phpt
index 26a09aff24..6fb5169d45 100644
--- a/ext/standard/tests/array/array_column_error.phpt
+++ b/ext/standard/tests/array/array_column_error.phpt
@@ -10,73 +10,51 @@ Test array_column() function: error conditions
*/
echo "*** Testing array_column() : error conditions ***\n";
-
-echo "\n-- Testing array_column() function with Zero arguments --\n";
-var_dump(array_column());
-
-echo "\n-- Testing array_column() function with One argument --\n";
-var_dump(array_column(array()));
-
-echo "\n-- Testing array_column() function with string as first parameter --\n";
-var_dump(array_column('foo', 0));
-
-echo "\n-- Testing array_column() function with int as first parameter --\n";
-var_dump(array_column(1, 'foo'));
-
echo "\n-- Testing array_column() column key parameter should be a string or an integer (testing bool) --\n";
-var_dump(array_column(array(), true));
+try {
+ var_dump(array_column(array(), true));
+} catch (\TypeError $e) {
+ echo $e->getMessage() . "\n";
+}
+
echo "\n-- Testing array_column() column key parameter should be a string or integer (testing array) --\n";
-var_dump(array_column(array(), array()));
+try {
+ var_dump(array_column(array(), array()));
+} catch (\TypeError $e) {
+ echo $e->getMessage() . "\n";
+}
echo "\n-- Testing array_column() index key parameter should be a string or an integer (testing bool) --\n";
-var_dump(array_column(array(), 'foo', true));
+try {
+ var_dump(array_column(array(), 'foo', true));
+} catch (\TypeError $e) {
+ echo $e->getMessage() . "\n";
+}
echo "\n-- Testing array_column() index key parameter should be a string or integer (testing array) --\n";
-var_dump(array_column(array(), 'foo', array()));
+try {
+ var_dump(array_column(array(), 'foo', array()));
+} catch (\TypeError $e) {
+ echo $e->getMessage() . "\n";
+}
-echo "Done\n";
?>
---EXPECTF--
-*** Testing array_column() : error conditions ***
-
--- Testing array_column() function with Zero arguments --
-
-Warning: array_column() expects at least 2 parameters, 0 given in %s on line %d
-NULL
--- Testing array_column() function with One argument --
-
-Warning: array_column() expects at least 2 parameters, 1 given in %s on line %d
-NULL
-
--- Testing array_column() function with string as first parameter --
-
-Warning: array_column() expects parameter 1 to be array, string given in %s on line %d
-NULL
-
--- Testing array_column() function with int as first parameter --
-
-Warning: array_column() expects parameter 1 to be array, int given in %s on line %d
-NULL
+DONE
+--EXPECT--
+*** Testing array_column() : error conditions ***
-- Testing array_column() column key parameter should be a string or an integer (testing bool) --
-
-Warning: array_column(): The column key should be either a string or an integer in %s on line %d
-bool(false)
+The column key should be either a string or an integer
-- Testing array_column() column key parameter should be a string or integer (testing array) --
-
-Warning: array_column(): The column key should be either a string or an integer in %s on line %d
-bool(false)
+The column key should be either a string or an integer
-- Testing array_column() index key parameter should be a string or an integer (testing bool) --
-
-Warning: array_column(): The index key should be either a string or an integer in %s on line %d
-bool(false)
+The index key should be either a string or an integer
-- Testing array_column() index key parameter should be a string or integer (testing array) --
+The index key should be either a string or an integer
-Warning: array_column(): The index key should be either a string or an integer in %s on line %d
-bool(false)
-Done
+DONE
diff --git a/ext/standard/tests/array/array_column_variant_objects.phpt b/ext/standard/tests/array/array_column_variant_objects.phpt
index dc9c0e7e8f..612573e8fd 100644
--- a/ext/standard/tests/array/array_column_variant_objects.phpt
+++ b/ext/standard/tests/array/array_column_variant_objects.phpt
@@ -5,14 +5,14 @@ Test array_column() function: testing with objects
class User
{
- public $id, $first_name, $last_name;
-
- public function __construct($id, $first_name, $last_name)
- {
- $this->id = $id;
- $this->first_name = $first_name;
- $this->last_name = $last_name;
- }
+ public $id, $first_name, $last_name;
+
+ public function __construct($id, $first_name, $last_name)
+ {
+ $this->id = $id;
+ $this->first_name = $first_name;
+ $this->last_name = $last_name;
+ }
}
function newUser($id, $first_name, $last_name)
@@ -27,15 +27,15 @@ function newUser($id, $first_name, $last_name)
class Something
{
- public function __isset($name)
- {
- return $name == 'first_name';
- }
-
- public function __get($name)
- {
- return new User(4, 'Jack', 'Sparrow');
- }
+ public function __isset($name)
+ {
+ return $name == 'first_name';
+ }
+
+ public function __get($name)
+ {
+ return new User(4, 'Jack', 'Sparrow');
+ }
}
$records = array(
@@ -45,7 +45,7 @@ $records = array(
new User(1, 'John', 'Doe'),
new User(2, 'Sally', 'Smith'),
new User(3, 'Jane', 'Jones'),
- new Something,
+ new Something,
);
echo "*** Testing array_column() : object property fetching (numeric property names) ***\n";
diff --git a/ext/standard/tests/array/array_combine.phpt b/ext/standard/tests/array/array_combine.phpt
index 28eb54929e..b1b707aed6 100644
--- a/ext/standard/tests/array/array_combine.phpt
+++ b/ext/standard/tests/array/array_combine.phpt
@@ -2,30 +2,30 @@
basic array_combine test
--FILE--
<?php
- $array1 = array('green', 'red', 'yellow');
- $array2 = array('1', '2', '3');
- $array3 = array(0, 1, 2);
- $array4 = array(TRUE, FALSE, NULL);
- $a = array_combine($array1, $array1);
- $b = array_combine($array1, $array2);
- $c = array_combine($array1, $array3);
- $d = array_combine($array1, $array4);
- $e = array_combine($array2, $array1);
- $f = array_combine($array2, $array2);
- $g = array_combine($array2, $array3);
- $h = array_combine($array2, $array4);
- $i = array_combine($array3, $array1);
- $j = array_combine($array3, $array2);
- $k = array_combine($array3, $array3);
- $l = array_combine($array3, $array4);
- $m = array_combine($array4, $array1);
- $n = array_combine($array4, $array2);
- $o = array_combine($array4, $array3);
- $p = array_combine($array4, $array4);
- for($letter = "a"; $letter <= "p"; $letter++)
- {
- print_r($$letter);
- }
+ $array1 = array('green', 'red', 'yellow');
+ $array2 = array('1', '2', '3');
+ $array3 = array(0, 1, 2);
+ $array4 = array(TRUE, FALSE, NULL);
+ $a = array_combine($array1, $array1);
+ $b = array_combine($array1, $array2);
+ $c = array_combine($array1, $array3);
+ $d = array_combine($array1, $array4);
+ $e = array_combine($array2, $array1);
+ $f = array_combine($array2, $array2);
+ $g = array_combine($array2, $array3);
+ $h = array_combine($array2, $array4);
+ $i = array_combine($array3, $array1);
+ $j = array_combine($array3, $array2);
+ $k = array_combine($array3, $array3);
+ $l = array_combine($array3, $array4);
+ $m = array_combine($array4, $array1);
+ $n = array_combine($array4, $array2);
+ $o = array_combine($array4, $array3);
+ $p = array_combine($array4, $array4);
+ for($letter = "a"; $letter <= "p"; $letter++)
+ {
+ print_r($$letter);
+ }
?>
--EXPECT--
Array
diff --git a/ext/standard/tests/array/array_combine_error2.phpt b/ext/standard/tests/array/array_combine_error2.phpt
index 2d820a0d21..4eae53c120 100644
--- a/ext/standard/tests/array/array_combine_error2.phpt
+++ b/ext/standard/tests/array/array_combine_error2.phpt
@@ -16,19 +16,30 @@ var_dump( array_combine(array(), array()) );
// Testing array_combine by passing empty array to $keys
echo "\n-- Testing array_combine() function with empty array for \$keys argument --\n";
-var_dump( array_combine(array(), array(1, 2)) );
+try {
+ var_dump( array_combine(array(), array(1, 2)) );
+} catch (\ValueError $e) {
+ echo $e->getMessage();
+}
// Testing array_combine by passing empty array to $values
echo "\n-- Testing array_combine() function with empty array for \$values argument --\n";
-var_dump( array_combine(array(1, 2), array()) );
+try {
+ var_dump( array_combine(array(1, 2), array()) );
+} catch (\ValueError $e) {
+ echo $e->getMessage();
+}
// Testing array_combine with arrays having unequal number of elements
echo "\n-- Testing array_combine() function by passing array with unequal number of elements --\n";
-var_dump( array_combine(array(1, 2), array(1, 2, 3)) );
+try {
+ var_dump( array_combine(array(1, 2), array(1, 2, 3)) );
+} catch (\ValueError $e) {
+ echo $e->getMessage();
+}
-echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing array_combine() : error conditions specific to array_combine() ***
-- Testing array_combine() function with empty arrays --
@@ -36,17 +47,8 @@ array(0) {
}
-- Testing array_combine() function with empty array for $keys argument --
-
-Warning: array_combine(): Both parameters should have an equal number of elements in %s on line %d
-bool(false)
-
+Both parameters should have an equal number of elements
-- Testing array_combine() function with empty array for $values argument --
-
-Warning: array_combine(): Both parameters should have an equal number of elements in %s on line %d
-bool(false)
-
+Both parameters should have an equal number of elements
-- Testing array_combine() function by passing array with unequal number of elements --
-
-Warning: array_combine(): Both parameters should have an equal number of elements in %s on line %d
-bool(false)
-Done
+Both parameters should have an equal number of elements
diff --git a/ext/standard/tests/array/array_combine_variation3.phpt b/ext/standard/tests/array/array_combine_variation3.phpt
index ba349c3921..23b5017570 100644
--- a/ext/standard/tests/array/array_combine_variation3.phpt
+++ b/ext/standard/tests/array/array_combine_variation3.phpt
@@ -69,7 +69,7 @@ $arrays = array (
array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true),
array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6),
- // array with repetative keys
+ // array with repetitive keys
/*19*/ array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3)
);
diff --git a/ext/standard/tests/array/array_combine_variation4.phpt b/ext/standard/tests/array/array_combine_variation4.phpt
index a7ea0a9dc4..5726eb73e6 100644
--- a/ext/standard/tests/array/array_combine_variation4.phpt
+++ b/ext/standard/tests/array/array_combine_variation4.phpt
@@ -60,10 +60,10 @@ $arrays = array (
array("hello", $heredoc => "string"), // heredoc
// array with object, unset variable and resource variable
-/*10*/ array(new classA() => 11, @$unset_var => "hello", $fp => 'resource'),
+/*10*/ array(@$unset_var => "hello", $fp => 'resource'),
// array with mixed keys
-/*11*/ array('hello' => 1, new classA() => 2, "fruit" => 2.2,
+/*11*/ array('hello' => 1, "fruit" => 2.2,
$fp => 'resource', 133 => "int", 444.432 => "float",
@$unset_var => "unset", $heredoc => "heredoc")
);
@@ -71,7 +71,7 @@ $arrays = array (
// array to be passsed to $arr2 argument
$arr2 = array(0 => 0, 2 => "float", 4 => "f3", 33333333 => "f4",
"\tHello" => 111, 2.2, 'color', "Hello world" => "string",
- "pen\n" => 33, new classA() => 11, 133 => "int");
+ "pen\n" => 33, 133 => "int");
// loop through each sub-array within $arrays to check the behavior of array_combine()
// same arrays are passed to both $keys and $values
@@ -90,15 +90,9 @@ echo "Done";
--EXPECTF--
*** Testing array_combine() : assoc array with diff keys to both $keys and $values argument ***
-Warning: Illegal offset type in %s on line %d
+Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
-Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
-
-Warning: Illegal offset type in %s on line %d
-
-Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
-
-Warning: Illegal offset type in %s on line %d
+Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
-- Iteration 1 --
array(0) {
}
diff --git a/ext/standard/tests/array/array_count_values.phpt b/ext/standard/tests/array/array_count_values.phpt
index a6424aab9a..eb51512430 100644
--- a/ext/standard/tests/array/array_count_values.phpt
+++ b/ext/standard/tests/array/array_count_values.phpt
@@ -3,23 +3,23 @@ array_count_values()
--FILE--
<?php
$arrays = array (
- array (),
- array (0),
- array (1),
- array (-1),
- array (0, 0),
- array (0, 1),
- array (1, 1),
- array (1, "hello", 1, "world", "hello"),
- array ("hello", "world", "hello"),
- array ("", "world", "", "hello", "world", "hello", "hello", "world", "hello"),
- array (0, array (1, "hello", 1, "world", "hello")),
- array (1, array (1, "hello", 1, "world", "hello"), array (1, "hello", 1, "world", "hello"), array (1, "hello", 1, "world", "hello")),
+ array (),
+ array (0),
+ array (1),
+ array (-1),
+ array (0, 0),
+ array (0, 1),
+ array (1, 1),
+ array (1, "hello", 1, "world", "hello"),
+ array ("hello", "world", "hello"),
+ array ("", "world", "", "hello", "world", "hello", "hello", "world", "hello"),
+ array (0, array (1, "hello", 1, "world", "hello")),
+ array (1, array (1, "hello", 1, "world", "hello"), array (1, "hello", 1, "world", "hello"), array (1, "hello", 1, "world", "hello")),
);
foreach ($arrays as $item) {
- var_dump (@array_count_values ($item));
- echo "\n";
+ var_dump (@array_count_values ($item));
+ echo "\n";
}
?>
--EXPECT--
diff --git a/ext/standard/tests/array/array_count_values2.phpt b/ext/standard/tests/array/array_count_values2.phpt
index 8aaf445f93..a38b02c8be 100644
--- a/ext/standard/tests/array/array_count_values2.phpt
+++ b/ext/standard/tests/array/array_count_values2.phpt
@@ -3,26 +3,26 @@ basic array_count_values test
--FILE--
<?php
$array1 = array(1,
- "hello",
- 1,
- "world",
- "hello",
- "",
- "rabbit",
- "foo",
- "Foo",
- TRUE,
- FALSE,
- NULL,
- 0);
+ "hello",
+ 1,
+ "world",
+ "hello",
+ "",
+ "rabbit",
+ "foo",
+ "Foo",
+ TRUE,
+ FALSE,
+ NULL,
+ 0);
var_dump(array_count_values($array1));
?>
--EXPECTF--
-Warning: array_count_values(): Can only count STRING and INTEGER values! in %s on line %d
+Warning: array_count_values(): Can only count string and integer values, entry skipped in %s on line %d
-Warning: array_count_values(): Can only count STRING and INTEGER values! in %s on line %d
+Warning: array_count_values(): Can only count string and integer values, entry skipped in %s on line %d
-Warning: array_count_values(): Can only count STRING and INTEGER values! in %s on line %d
+Warning: array_count_values(): Can only count string and integer values, entry skipped in %s on line %d
array(8) {
[1]=>
int(2)
diff --git a/ext/standard/tests/array/array_count_values_variation.phpt b/ext/standard/tests/array/array_count_values_variation.phpt
index 00f13c8a5b..2156db0ad9 100644
--- a/ext/standard/tests/array/array_count_values_variation.phpt
+++ b/ext/standard/tests/array/array_count_values_variation.phpt
@@ -15,9 +15,9 @@ Test array_count_values() function : Test all normal parameter variations
echo "*** Testing array_count_values() : parameter variations ***\n";
class A {
- static function hello() {
- echo "Hello\n";
- }
+ static function hello() {
+ echo "Hello\n";
+ }
}
$ob = new A();
diff --git a/ext/standard/tests/array/array_diff_1.phpt b/ext/standard/tests/array/array_diff_1.phpt
index a7ee015346..2e2b135128 100644
--- a/ext/standard/tests/array/array_diff_1.phpt
+++ b/ext/standard/tests/array/array_diff_1.phpt
@@ -6,10 +6,14 @@ Test array_diff when non-array is passed
$a = array();
$b = 3;
$c = array(5);
-array_diff($a, $b, $c);
+try {
+ array_diff($a, $b, $c);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
//-=-=-=-=-=-
echo "OK!";
?>
--EXPECTF--
-Warning: array_diff(): Expected parameter 2 to be an array, int given in %s
+Expected parameter 2 to be an array, int given
OK!
diff --git a/ext/standard/tests/array/array_diff_assoc_error.phpt b/ext/standard/tests/array/array_diff_assoc_error.phpt
index fc8c70c67c..6aa7864ee9 100644
--- a/ext/standard/tests/array/array_diff_assoc_error.phpt
+++ b/ext/standard/tests/array/array_diff_assoc_error.phpt
@@ -16,13 +16,20 @@ echo "*** Testing array_diff_assoc() : error conditions ***\n";
// Zero arguments
echo "\n-- Testing array_diff_assoc() function with zero arguments --\n";
-var_dump( array_diff_assoc() );
+try {
+ var_dump( array_diff_assoc() );
+} catch (ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
// Testing array_diff_assoc with one less than the expected number of arguments
echo "\n-- Testing array_diff_assoc() function with less than expected no. of arguments --\n";
$arr1 = array(1, 2);
-var_dump( array_diff_assoc($arr1) );
-
+try {
+ var_dump( array_diff_assoc($arr1) );
+} catch (ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done";
?>
@@ -30,12 +37,8 @@ echo "Done";
*** Testing array_diff_assoc() : error conditions ***
-- Testing array_diff_assoc() function with zero arguments --
-
-Warning: array_diff_assoc(): at least 2 parameters are required, 0 given in %s on line %d
-NULL
+At least 2 parameters are required, 0 given
-- Testing array_diff_assoc() function with less than expected no. of arguments --
-
-Warning: array_diff_assoc(): at least 2 parameters are required, 1 given in %s on line %d
-NULL
+At least 2 parameters are required, 1 given
Done
diff --git a/ext/standard/tests/array/array_diff_assoc_variation1.phpt b/ext/standard/tests/array/array_diff_assoc_variation1.phpt
index 2172e695d3..a723930b34 100644
--- a/ext/standard/tests/array/array_diff_assoc_variation1.phpt
+++ b/ext/standard/tests/array/array_diff_assoc_variation1.phpt
@@ -73,7 +73,7 @@ $inputs = array(
// binary data
/*21*/ b"binary",
- (binary)"binary",
+ (binary)"binary",
// object data
/*23*/ new classA(),
@@ -91,143 +91,95 @@ $inputs = array(
// loop through each element of $inputs to check the behavior of array_diff_assoc
$iterator = 1;
foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump( array_diff_assoc($input, $array));
- $iterator++;
+ echo "\n-- Iteration $iterator --\n";
+ try {
+ var_dump(array_diff_assoc($input, $array));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ $iterator++;
};
fclose($fp);
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing array_diff_assoc() : usage variations ***
-- Iteration 1 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
-- Iteration 2 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
-- Iteration 3 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
-- Iteration 4 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
-- Iteration 5 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
-- Iteration 6 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
-- Iteration 7 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
-- Iteration 8 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
-- Iteration 9 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
-- Iteration 10 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
-- Iteration 11 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
-- Iteration 12 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
-- Iteration 13 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
-- Iteration 14 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
-- Iteration 15 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
-- Iteration 16 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
-- Iteration 17 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
-- Iteration 18 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
-- Iteration 19 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
-- Iteration 20 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
-- Iteration 21 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
-- Iteration 22 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
-- Iteration 23 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
+Expected parameter 1 to be an array, object given
-- Iteration 24 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
-- Iteration 25 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
-- Iteration 26 --
-
-Warning: array_diff_assoc(): Expected parameter 1 to be an array, resource given in %s on line %d
-NULL
+Expected parameter 1 to be an array, resource given
Done
diff --git a/ext/standard/tests/array/array_diff_assoc_variation2.phpt b/ext/standard/tests/array/array_diff_assoc_variation2.phpt
index a57f10fce0..dc5e7c87c3 100644
--- a/ext/standard/tests/array/array_diff_assoc_variation2.phpt
+++ b/ext/standard/tests/array/array_diff_assoc_variation2.phpt
@@ -73,7 +73,7 @@ $inputs = array(
// binary data
/*21*/ b"binary",
- (binary)"binary",
+ (binary)"binary",
// object data
/*23*/ new classA(),
@@ -91,143 +91,95 @@ $inputs = array(
// loop through each element of $inputs to check the behavior of array_diff_assoc
$iterator = 1;
foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump( array_diff_assoc($array, $input));
- $iterator++;
+ echo "\n-- Iteration $iterator --\n";
+ try {
+ var_dump(array_diff_assoc($array, $input));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ $iterator++;
};
fclose($fp);
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing array_diff_assoc() : usage variations ***
-- Iteration 1 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
-- Iteration 2 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
-- Iteration 3 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
-- Iteration 4 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
-- Iteration 5 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
-- Iteration 6 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
-- Iteration 7 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
-- Iteration 8 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
-- Iteration 9 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
-- Iteration 10 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
-- Iteration 11 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
-- Iteration 12 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
-- Iteration 13 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
-- Iteration 14 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
-- Iteration 15 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
-- Iteration 16 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
-- Iteration 17 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
-- Iteration 18 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
-- Iteration 19 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
-- Iteration 20 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
-- Iteration 21 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
-- Iteration 22 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
-- Iteration 23 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
+Expected parameter 2 to be an array, object given
-- Iteration 24 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
-- Iteration 25 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
-- Iteration 26 --
-
-Warning: array_diff_assoc(): Expected parameter 2 to be an array, resource given in %s on line %d
-NULL
+Expected parameter 2 to be an array, resource given
Done
diff --git a/ext/standard/tests/array/array_diff_assoc_variation3.phpt b/ext/standard/tests/array/array_diff_assoc_variation3.phpt
index 959ddd5428..023beb1ed0 100644
--- a/ext/standard/tests/array/array_diff_assoc_variation3.phpt
+++ b/ext/standard/tests/array/array_diff_assoc_variation3.phpt
@@ -39,7 +39,7 @@ $inputs = array(
// int data
/*1*/
'int' => array(
- 0,
+ 0,
1,
12345,
-2345),
@@ -84,7 +84,7 @@ $inputs = array(
/*7*/
'binary' => array(
b"binary",
- (binary)"binary"),
+ (binary)"binary"),
// object data
/*8*/
diff --git a/ext/standard/tests/array/array_diff_assoc_variation4.phpt b/ext/standard/tests/array/array_diff_assoc_variation4.phpt
index 8cb05f8562..70ea73f96d 100644
--- a/ext/standard/tests/array/array_diff_assoc_variation4.phpt
+++ b/ext/standard/tests/array/array_diff_assoc_variation4.phpt
@@ -75,7 +75,7 @@ $inputs = array(
/*7*/
'binary' => array(
b"binary1" => 'binary 1',
- (binary)"binary2" => 'binary 2'),
+ (binary)"binary2" => 'binary 2'),
// undefined data
/*8*/
diff --git a/ext/standard/tests/array/array_diff_assoc_variation6.phpt b/ext/standard/tests/array/array_diff_assoc_variation6.phpt
index 2ea2c461c6..b4ef6d2304 100644
--- a/ext/standard/tests/array/array_diff_assoc_variation6.phpt
+++ b/ext/standard/tests/array/array_diff_assoc_variation6.phpt
@@ -28,41 +28,41 @@ $inputs = array (
//numeric keys => string values
/*2*/ array(2 => '2.00000000000001',
- 1 => '1',
- 0 => 'zero',
- 3 => 'a'),
+ 1 => '1',
+ 0 => 'zero',
+ 3 => 'a'),
//string keys => string values
/*3*/ array('2' => '2.00000000000001',
- '1' => '1',
- '0' => 'zero',
- '3' => 'a') ,
+ '1' => '1',
+ '0' => 'zero',
+ '3' => 'a') ,
//default keys => numeric values
/*4*/ array(2, 1, 0),
//numeric keys => numeric values
/*5*/ array(2 => 2,
- 1 => 1,
- 0 => 0),
+ 1 => 1,
+ 0 => 0),
//string keys => numeric values
/*6*/ array('two' => 2,
- '1' => 1,
- '0' => 0),
+ '1' => 1,
+ '0' => 0),
-//defualt keys => float values
+//default keys => float values
/*7*/ array(2.00000000000001, 1.00, 0.01E-9),
//numeric keys => float values
/*8*/ array(2 => 2.00000000000001,
- 1 => 1.00,
- 0 => 0.01E-9),
+ 1 => 1.00,
+ 0 => 0.01E-9),
//string keys => float values
/*9*/ array ('two' => 2.00000000000001,
- '1' => 1.00,
- '0' =>0.01E-9)
+ '1' => 1.00,
+ '0' =>0.01E-9)
);
// loop through each element of $inputs to check the behavior of array_diff_assoc
diff --git a/ext/standard/tests/array/array_diff_error.phpt b/ext/standard/tests/array/array_diff_error.phpt
index 25be6e1c55..d269f010b8 100644
--- a/ext/standard/tests/array/array_diff_error.phpt
+++ b/ext/standard/tests/array/array_diff_error.phpt
@@ -15,13 +15,21 @@ Test array_diff() function : error conditions - too few arguments passed to func
echo "*** Testing array_diff() : error conditions ***\n";
// Zero arguments
echo "\n-- Testing array_diff() function with zero arguments --\n";
-var_dump( array_diff() );
+try {
+ var_dump( array_diff() );
+} catch (ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
// Testing array_diff with one less than the expected number of arguments
echo "\n-- Testing array_diff() function with less than expected no. of arguments --\n";
$arr1 = array(1, 2);
-var_dump( array_diff($arr1) );
+try {
+ var_dump( array_diff($arr1) );
+} catch (ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done";
?>
@@ -29,12 +37,8 @@ echo "Done";
*** Testing array_diff() : error conditions ***
-- Testing array_diff() function with zero arguments --
-
-Warning: array_diff(): at least 2 parameters are required, 0 given in %s on line %d
-NULL
+At least 2 parameters are required, 0 given
-- Testing array_diff() function with less than expected no. of arguments --
-
-Warning: array_diff(): at least 2 parameters are required, 1 given in %s on line %d
-NULL
+At least 2 parameters are required, 1 given
Done
diff --git a/ext/standard/tests/array/array_diff_key_error.phpt b/ext/standard/tests/array/array_diff_key_error.phpt
index 05d5cf3c27..e957abce1c 100644
--- a/ext/standard/tests/array/array_diff_key_error.phpt
+++ b/ext/standard/tests/array/array_diff_key_error.phpt
@@ -14,23 +14,25 @@ $array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4);
// Testing array_diff_key with one less than the expected number of arguments
echo "\n-- Testing array_diff_key() function with less than expected no. of arguments --\n";
-var_dump( array_diff_key($array1) );
+try {
+ var_dump( array_diff_key($array1) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
// Testing array_diff_key with no arguments
echo "\n-- Testing array_diff_key() function with no arguments --\n";
-var_dump( array_diff_key() );
+try {
+ var_dump( array_diff_key() );
+} catch (ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
-===DONE===
--EXPECTF--
*** Testing array_diff_key() : error conditions ***
-- Testing array_diff_key() function with less than expected no. of arguments --
-
-Warning: array_diff_key(): at least 2 parameters are required, 1 given in %s on line %d
-NULL
+At least 2 parameters are required, 1 given
-- Testing array_diff_key() function with no arguments --
-
-Warning: array_diff_key(): at least 2 parameters are required, 0 given in %s on line %d
-NULL
-===DONE===
+At least 2 parameters are required, 0 given
diff --git a/ext/standard/tests/array/array_diff_key_variation1.phpt b/ext/standard/tests/array/array_diff_key_variation1.phpt
index 3e689a0e8f..bdfac2c196 100644
--- a/ext/standard/tests/array/array_diff_key_variation1.phpt
+++ b/ext/standard/tests/array/array_diff_key_variation1.phpt
@@ -23,9 +23,9 @@ $fp = fopen(__FILE__, "r");
// define some classes
class classWithToString
{
- public function __toString() {
- return "Class A object";
- }
+ public function __toString() {
+ return "Class A object";
+ }
}
class classWithoutToString
@@ -89,222 +89,124 @@ $inputs = array(
// loop through each element of the array for arr1
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_diff_key($value, $array2) );
- var_dump( array_diff_key($value, $array2, $array3) );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_diff_key($value, $array2) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ try {
+ var_dump( array_diff_key($value, $array2, $array3) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
fclose($fp);
?>
-===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_diff_key() : usage variation ***
--int 0--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--int 1--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--int 12345--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--int -12345--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--float 10.5--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--float -10.5--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--float .5--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--uppercase NULL--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--lowercase null--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--lowercase true--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--lowercase false--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--empty string DQ--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--empty string SQ--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--string DQ--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--string SQ--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--mixed case string--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--heredoc--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--instance of classWithToString--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
+Expected parameter 1 to be an array, object given
+Expected parameter 1 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
+Expected parameter 1 to be an array, object given
+Expected parameter 1 to be an array, object given
--undefined var--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--unset var--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--resource--
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, resource given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 1 to be an array, resource given in %s on line %d
-NULL
-===DONE===
+Expected parameter 1 to be an array, resource given
+Expected parameter 1 to be an array, resource given
diff --git a/ext/standard/tests/array/array_diff_key_variation2.phpt b/ext/standard/tests/array/array_diff_key_variation2.phpt
index fb0bcd6796..4f84db5dd1 100644
--- a/ext/standard/tests/array/array_diff_key_variation2.phpt
+++ b/ext/standard/tests/array/array_diff_key_variation2.phpt
@@ -23,9 +23,9 @@ $fp = fopen(__FILE__, "r");
// define some classes
class classWithToString
{
- public function __toString() {
- return "Class A object";
- }
+ public function __toString() {
+ return "Class A object";
+ }
}
class classWithoutToString
@@ -90,222 +90,124 @@ $inputs = array(
// loop through each element of the array for arr1
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_diff_key($array1, $value) );
- var_dump( array_diff_key($array1, $value, $array3) );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_diff_key($array1, $value) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ try {
+ var_dump( array_diff_key($array1, $value, $array3) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
fclose($fp);
?>
-===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_diff_key() : usage variation ***
--int 0--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--int 1--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--int 12345--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--int -12345--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--float 10.5--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--float -10.5--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--float .5--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--uppercase NULL--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--lowercase null--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--lowercase true--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--lowercase false--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--empty string DQ--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--empty string SQ--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--string DQ--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--string SQ--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--mixed case string--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--heredoc--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--instance of classWithToString--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
+Expected parameter 2 to be an array, object given
+Expected parameter 2 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
+Expected parameter 2 to be an array, object given
+Expected parameter 2 to be an array, object given
--undefined var--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--unset var--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--resource--
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, resource given in %s on line %d
-NULL
-
-Warning: array_diff_key(): Expected parameter 2 to be an array, resource given in %s on line %d
-NULL
-===DONE===
+Expected parameter 2 to be an array, resource given
+Expected parameter 2 to be an array, resource given
diff --git a/ext/standard/tests/array/array_diff_key_variation3.phpt b/ext/standard/tests/array/array_diff_key_variation3.phpt
deleted file mode 100644
index 36741dba33..0000000000
--- a/ext/standard/tests/array/array_diff_key_variation3.phpt
+++ /dev/null
@@ -1,232 +0,0 @@
---TEST--
-Test array_diff_key() function : usage variation - Passing unexpected values to third optional argument
---FILE--
-<?php
-/* Prototype : array array_diff_key(array arr1, array arr2 [, array ...])
- * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments.
- * Source code: ext/standard/array.c
- */
-
-echo "*** Testing array_diff_key() : usage variation ***\n";
-
-// Initialise function arguments not being substituted (if any)
-$array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4);
-$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8);
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-//resource variable
-$fp = fopen(__FILE__, "r");
-
-// define some classes
-class classWithToString
-{
- public function __toString() {
- return "Class A object";
- }
-}
-
-class classWithoutToString
-{
-}
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-//array of values to iterate over
-$inputs = array(
-
- // int data
- 'int 0' => 0,
- 'int 1' => 1,
- 'int 12345' => 12345,
- 'int -12345' => -12345,
-
- // float data
- 'float 10.5' => 10.5,
- 'float -10.5' => -10.5,
- 'float 12.3456789000e10' => 12.3456789000e10,
- 'float -12.3456789000e10' => -12.3456789000e10,
- 'float .5' => .5,
-
- // null data
- 'uppercase NULL' => NULL,
- 'lowercase null' => null,
-
- // boolean data
- 'lowercase true' => true,
- 'lowercase false' =>false,
- 'uppercase TRUE' =>TRUE,
- 'uppercase FALSE' =>FALSE,
-
- // empty data
- 'empty string DQ' => "",
- 'empty string SQ' => '',
-
- // string data
- 'string DQ' => "string",
- 'string SQ' => 'string',
- 'mixed case string' => "sTrInG",
- 'heredoc' => $heredoc,
-
- // object data
- 'instance of classWithToString' => new classWithToString(),
- 'instance of classWithoutToString' => new classWithoutToString(),
-
- // undefined data
- 'undefined var' => @$undefined_var,
-
- // unset data
- 'unset var' => @$unset_var,
-
- // resource data
- 'resource' => $fp,
-);
-
-// loop through each element of the array for arr1
-
-foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_diff_key($array1, $array2, $value) );
-};
-
-fclose($fp);
-?>
-===DONE===
---EXPECTF--
-*** Testing array_diff_key() : usage variation ***
-
---int 0--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---int 1--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---int 12345--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---int -12345--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---float 10.5--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float -10.5--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float 12.3456789000e10--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float -12.3456789000e10--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float .5--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---uppercase NULL--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---lowercase null--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---lowercase true--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---lowercase false--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---uppercase TRUE--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---uppercase FALSE--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---empty string DQ--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---empty string SQ--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---string DQ--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---string SQ--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---mixed case string--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---heredoc--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---instance of classWithToString--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, object given in %s on line %d
-NULL
-
---instance of classWithoutToString--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, object given in %s on line %d
-NULL
-
---undefined var--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---unset var--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---resource--
-
-Warning: array_diff_key(): Expected parameter 3 to be an array, resource given in %s on line %d
-NULL
-===DONE===
diff --git a/ext/standard/tests/array/array_diff_key_variation4.phpt b/ext/standard/tests/array/array_diff_key_variation4.phpt
index c7171dc440..c4206eaa5c 100644
--- a/ext/standard/tests/array/array_diff_key_variation4.phpt
+++ b/ext/standard/tests/array/array_diff_key_variation4.phpt
@@ -25,7 +25,6 @@ foreach($input_arrays as $key =>$value) {
var_dump( array_diff_key($value, $input_array) );
}
?>
-===DONE===
--EXPECT--
*** Testing array_diff_key() : usage variation ***
@@ -58,4 +57,3 @@ array(1) {
[18]=>
string(4) "0x12"
}
-===DONE===
diff --git a/ext/standard/tests/array/array_diff_key_variation5.phpt b/ext/standard/tests/array/array_diff_key_variation5.phpt
index f5017ba63b..cadb34d6d3 100644
--- a/ext/standard/tests/array/array_diff_key_variation5.phpt
+++ b/ext/standard/tests/array/array_diff_key_variation5.phpt
@@ -18,7 +18,6 @@ echo "\n-- Testing array_diff_key() function with float indexed array --\n";
var_dump( array_diff_key($input_array, $float_indx_array) );
var_dump( array_diff_key($float_indx_array, $input_array) );
?>
-===DONE===
--EXPECT--
*** Testing array_diff_key() : usage variation ***
@@ -31,4 +30,3 @@ array(2) {
}
array(0) {
}
-===DONE===
diff --git a/ext/standard/tests/array/array_diff_key_variation6.phpt b/ext/standard/tests/array/array_diff_key_variation6.phpt
index 7f00c4b3ab..bc7f7a15c9 100644
--- a/ext/standard/tests/array/array_diff_key_variation6.phpt
+++ b/ext/standard/tests/array/array_diff_key_variation6.phpt
@@ -18,7 +18,6 @@ echo "\n-- Testing array_diff_key() function with boolean indexed array --\n";
var_dump( array_diff_key($input_array, $boolean_indx_array) );
var_dump( array_diff_key($boolean_indx_array, $input_array) );
?>
-===DONE===
--EXPECT--
*** Testing array_diff_key() : usage variation ***
@@ -33,4 +32,3 @@ array(3) {
}
array(0) {
}
-===DONE===
diff --git a/ext/standard/tests/array/array_diff_key_variation7.phpt b/ext/standard/tests/array/array_diff_key_variation7.phpt
index 02cf2c9e67..1f9e04b36d 100644
--- a/ext/standard/tests/array/array_diff_key_variation7.phpt
+++ b/ext/standard/tests/array/array_diff_key_variation7.phpt
@@ -29,7 +29,6 @@ foreach($input_arrays as $key =>$value) {
var_dump( array_diff_key($value, $input_array) );
}
?>
-===DONE===
--EXPECT--
*** Testing array_diff_key() : usage variation ***
@@ -56,4 +55,3 @@ array(1) {
}
array(0) {
}
-===DONE===
diff --git a/ext/standard/tests/array/array_diff_key_variation8.phpt b/ext/standard/tests/array/array_diff_key_variation8.phpt
index 349ebbbc6e..65c09557a3 100644
--- a/ext/standard/tests/array/array_diff_key_variation8.phpt
+++ b/ext/standard/tests/array/array_diff_key_variation8.phpt
@@ -12,7 +12,7 @@ echo "*** Testing array_diff_key() : usage variation ***\n";
// Initialise function arguments not being substituted (if any)
$array1 = array(
- 'first' => array('blue' => 1, 'red' => 2),
+ 'first' => array('blue' => 1, 'red' => 2),
'second' => array('yellow' => 7),
@@ -21,7 +21,7 @@ $array1 = array(
$array2 = array (
- 'first' => array('blue' => 1, 'red' => 2,),
+ 'first' => array('blue' => 1, 'red' => 2,),
'second' => array('cyan' => 8),
@@ -32,7 +32,6 @@ echo "\n-- Testing array_diff_key() function with multi dimensional array --\n";
var_dump( array_diff_key($array1, $array2) );
var_dump( array_diff_key($array2, $array1) );
?>
-===DONE===
--EXPECT--
*** Testing array_diff_key() : usage variation ***
@@ -51,4 +50,3 @@ array(1) {
string(3) "two"
}
}
-===DONE===
diff --git a/ext/standard/tests/array/array_diff_uassoc_error.phpt b/ext/standard/tests/array/array_diff_uassoc_error.phpt
index d90c80f20b..33fa0e7bea 100644
--- a/ext/standard/tests/array/array_diff_uassoc_error.phpt
+++ b/ext/standard/tests/array/array_diff_uassoc_error.phpt
@@ -27,36 +27,32 @@ function key_compare_func($a, $b)
//Test array_diff_uassoc with one more than the expected number of arguments
echo "\n-- Testing array_diff_uassoc() function with more than expected no. of arguments --\n";
-var_dump( array_diff_uassoc($array1, $array2, "key_compare_func", $extra_arg) );
-var_dump( array_diff_uassoc($array1, $array2, $array3, $array4, "key_compare_func", $extra_arg) );
+try {
+ var_dump( array_diff_uassoc($array1, $array2, "key_compare_func", $extra_arg) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump( array_diff_uassoc($array1, $array2, $array3, $array4, "key_compare_func", $extra_arg) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
// Testing array_diff_uassoc with one less than the expected number of arguments
echo "\n-- Testing array_diff_uassoc() function with less than expected no. of arguments --\n";
-var_dump( array_diff_uassoc($array1, $array2) );
+try {
+ var_dump( array_diff_uassoc($array1, $array2) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
-// Testing array_diff_uassoc with no arguments
-echo "\n-- Testing array_diff_uassoc() function with no arguments --\n";
-var_dump( array_diff_uassoc() );
?>
-===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_diff_uassoc() : error conditions ***
-- Testing array_diff_uassoc() function with more than expected no. of arguments --
-
-Warning: array_diff_uassoc() expects parameter 4 to be a valid callback, array must have exactly two members in %s on line %d
-NULL
-
-Warning: array_diff_uassoc() expects parameter 6 to be a valid callback, array must have exactly two members in %s on line %d
-NULL
+array_diff_uassoc() expects parameter 4 to be a valid callback, array must have exactly two members
+array_diff_uassoc() expects parameter 6 to be a valid callback, array must have exactly two members
-- Testing array_diff_uassoc() function with less than expected no. of arguments --
-
-Warning: array_diff_uassoc(): at least 3 parameters are required, 2 given in %s on line %d
-NULL
-
--- Testing array_diff_uassoc() function with no arguments --
-
-Warning: array_diff_uassoc(): at least 3 parameters are required, 0 given in %s on line %d
-NULL
-===DONE===
+At least 3 parameters are required, 2 given
diff --git a/ext/standard/tests/array/array_diff_uassoc_variation1.phpt b/ext/standard/tests/array/array_diff_uassoc_variation1.phpt
index aad42705db..0891cd2ee1 100644
--- a/ext/standard/tests/array/array_diff_uassoc_variation1.phpt
+++ b/ext/standard/tests/array/array_diff_uassoc_variation1.phpt
@@ -31,9 +31,9 @@ $fp = fopen(__FILE__, "r");
// define some classes
class classWithToString
{
- public function __toString() {
- return "Class A object";
- }
+ public function __toString() {
+ return "Class A object";
+ }
}
class classWithoutToString
@@ -102,143 +102,93 @@ $inputs = array(
// loop through each element of the array for arr1
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_diff_uassoc($value, $array2, "key_compare_func") );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_diff_uassoc($value, $array2, "key_compare_func") );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
fclose($fp);
?>
-===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_diff_uassoc() : usage variation ***
--int 0--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
--int 1--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
--int 12345--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
--int -12345--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
--float 10.5--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float -10.5--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float .5--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
--uppercase NULL--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
--lowercase null--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
--lowercase true--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--lowercase false--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--empty string DQ--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
--empty string SQ--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
--string DQ--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
--string SQ--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
--mixed case string--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
--heredoc--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
--instance of classWithToString--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
+Expected parameter 1 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
+Expected parameter 1 to be an array, object given
--undefined var--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
--unset var--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
--resource--
-
-Warning: array_diff_uassoc(): Expected parameter 1 to be an array, resource given in %s on line %d
-NULL
-===DONE===
+Expected parameter 1 to be an array, resource given
diff --git a/ext/standard/tests/array/array_diff_uassoc_variation10.phpt b/ext/standard/tests/array/array_diff_uassoc_variation10.phpt
index a32d566062..2b103f2c69 100644
--- a/ext/standard/tests/array/array_diff_uassoc_variation10.phpt
+++ b/ext/standard/tests/array/array_diff_uassoc_variation10.phpt
@@ -19,7 +19,6 @@ var_dump( array_diff_uassoc($input_array, $float_indx_array, "strcasecmp") );
var_dump( array_diff_uassoc($float_indx_array, $input_array, "strcasecmp") );
?>
-===DONE===
--EXPECT--
*** Testing array_diff_uassoc() : usage variation ***
@@ -44,4 +43,3 @@ array(3) {
[-10]=>
string(5) "-10.5"
}
-===DONE===
diff --git a/ext/standard/tests/array/array_diff_uassoc_variation11.phpt b/ext/standard/tests/array/array_diff_uassoc_variation11.phpt
index d317bfcde0..6101d6e300 100644
--- a/ext/standard/tests/array/array_diff_uassoc_variation11.phpt
+++ b/ext/standard/tests/array/array_diff_uassoc_variation11.phpt
@@ -19,7 +19,6 @@ var_dump( array_diff_uassoc($input_array, $boolean_indx_array, "strcasecmp") );
var_dump( array_diff_uassoc($boolean_indx_array, $input_array, "strcasecmp") );
?>
-===DONE===
--EXPECT--
*** Testing array_diff_uassoc() : usage variation ***
@@ -42,4 +41,3 @@ array(2) {
[0]=>
string(5) "boolF"
}
-===DONE===
diff --git a/ext/standard/tests/array/array_diff_uassoc_variation12.phpt b/ext/standard/tests/array/array_diff_uassoc_variation12.phpt
index c0f88f5051..c5de67a5cb 100644
--- a/ext/standard/tests/array/array_diff_uassoc_variation12.phpt
+++ b/ext/standard/tests/array/array_diff_uassoc_variation12.phpt
@@ -30,7 +30,6 @@ foreach($input_arrays as $key =>$value) {
}
?>
-===DONE===
--EXPECT--
*** Testing array_diff_uassoc() : usage variation ***
@@ -57,4 +56,3 @@ array(1) {
}
array(0) {
}
-===DONE===
diff --git a/ext/standard/tests/array/array_diff_uassoc_variation13.phpt b/ext/standard/tests/array/array_diff_uassoc_variation13.phpt
index 53a45ee278..2f70787487 100644
--- a/ext/standard/tests/array/array_diff_uassoc_variation13.phpt
+++ b/ext/standard/tests/array/array_diff_uassoc_variation13.phpt
@@ -32,7 +32,6 @@ var_dump( array_diff_uassoc($array1, $array2, "strcasecmp") );
var_dump( array_diff_uassoc($array2, $array1, "strcasecmp") );
?>
-===DONE===
--EXPECT--
*** Testing array_diff_uassoc() : usage variation ***
@@ -65,4 +64,3 @@ array(0) {
}
array(0) {
}
-===DONE===
diff --git a/ext/standard/tests/array/array_diff_uassoc_variation2.phpt b/ext/standard/tests/array/array_diff_uassoc_variation2.phpt
index ae664f9812..0d5271d6ec 100644
--- a/ext/standard/tests/array/array_diff_uassoc_variation2.phpt
+++ b/ext/standard/tests/array/array_diff_uassoc_variation2.phpt
@@ -31,9 +31,9 @@ $fp = fopen(__FILE__, "r");
// define some classes
class classWithToString
{
- public function __toString() {
- return "Class A object";
- }
+ public function __toString() {
+ return "Class A object";
+ }
}
class classWithoutToString
@@ -102,143 +102,93 @@ $inputs = array(
// loop through each element of the array for arr2
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_diff_uassoc($array1, $value, "key_compare_func") );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_diff_uassoc($array1, $value, "key_compare_func") );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
fclose($fp);
?>
-===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_diff_uassoc() : usage variation ***
--int 0--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
--int 1--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
--int 12345--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
--int -12345--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
--float 10.5--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float -10.5--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float .5--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
--uppercase NULL--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
--lowercase null--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
--lowercase true--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--lowercase false--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--empty string DQ--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
--empty string SQ--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
--string DQ--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
--string SQ--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
--mixed case string--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
--heredoc--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
--instance of classWithToString--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
+Expected parameter 2 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
+Expected parameter 2 to be an array, object given
--undefined var--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
--unset var--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
--resource--
-
-Warning: array_diff_uassoc(): Expected parameter 2 to be an array, resource given in %s on line %d
-NULL
-===DONE===
+Expected parameter 2 to be an array, resource given
diff --git a/ext/standard/tests/array/array_diff_uassoc_variation4.phpt b/ext/standard/tests/array/array_diff_uassoc_variation4.phpt
deleted file mode 100644
index 8ea51a4103..0000000000
--- a/ext/standard/tests/array/array_diff_uassoc_variation4.phpt
+++ /dev/null
@@ -1,246 +0,0 @@
---TEST--
-Test array_diff_uassoc() function : usage variation -Passing unexpected values as third optional argument
---FILE--
-<?php
-/* Prototype : array array_diff_uassoc(array arr1, array arr2 [, array ...], callback key_comp_func)
- * Description: Computes the difference of arrays with additional index check which is performed by a
- * user supplied callback function
- * Source code: ext/standard/array.c
- */
-
-echo "*** Testing array_diff_uassoc() : usage variation ***\n";
-
-//Initialize variables
-$array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red");
-$array2 = array("a" => "green", "yellow", "red");
-
-
-function key_compare_func($a, $b)
-{
- if ($a === $b) {
- return 0;
- }
- return ($a > $b)? 1:-1;
-}
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-//resource variable
-$fp = fopen(__FILE__, "r");
-
-// define some classes
-class classWithToString
-{
- public function __toString() {
- return "Class A object";
- }
-}
-
-class classWithoutToString
-{
-}
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-// add arrays
-$index_array = array (1, 2, 3);
-$assoc_array = array ('one' => 1, 'two' => 2);
-
-//array of values to iterate over
-$inputs = array(
-
- // int data
- 'int 0' => 0,
- 'int 1' => 1,
- 'int 12345' => 12345,
- 'int -12345' => -12345,
-
- // float data
- 'float 10.5' => 10.5,
- 'float -10.5' => -10.5,
- 'float 12.3456789000e10' => 12.3456789000e10,
- 'float -12.3456789000e10' => -12.3456789000e10,
- 'float .5' => .5,
-
- // null data
- 'uppercase NULL' => NULL,
- 'lowercase null' => null,
-
- // boolean data
- 'lowercase true' => true,
- 'lowercase false' =>false,
- 'uppercase TRUE' =>TRUE,
- 'uppercase FALSE' =>FALSE,
-
- // empty data
- 'empty string DQ' => "",
- 'empty string SQ' => '',
-
- // string data
- 'string DQ' => "string",
- 'string SQ' => 'string',
- 'mixed case string' => "sTrInG",
- 'heredoc' => $heredoc,
-
- // object data
- 'instance of classWithToString' => new classWithToString(),
- 'instance of classWithoutToString' => new classWithoutToString(),
-
- // undefined data
- 'undefined var' => @$undefined_var,
-
- // unset data
- 'unset var' => @$unset_var,
-
- // resource data
- 'resource' => $fp,
-);
-
-// loop through each element of the array for arr2
-
-foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_diff_uassoc($array1, $array2, $value, "key_compare_func") );
-};
-
-fclose($fp);
-?>
-===DONE===
---EXPECTF--
-*** Testing array_diff_uassoc() : usage variation ***
-
---int 0--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---int 1--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---int 12345--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---int -12345--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---float 10.5--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float -10.5--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float 12.3456789000e10--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float -12.3456789000e10--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float .5--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---uppercase NULL--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---lowercase null--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---lowercase true--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---lowercase false--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---uppercase TRUE--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---uppercase FALSE--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---empty string DQ--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---empty string SQ--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---string DQ--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---string SQ--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---mixed case string--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---heredoc--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---instance of classWithToString--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, object given in %s on line %d
-NULL
-
---instance of classWithoutToString--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, object given in %s on line %d
-NULL
-
---undefined var--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---unset var--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---resource--
-
-Warning: array_diff_uassoc(): Expected parameter 3 to be an array, resource given in %s on line %d
-NULL
-===DONE===
diff --git a/ext/standard/tests/array/array_diff_uassoc_variation5.phpt b/ext/standard/tests/array/array_diff_uassoc_variation5.phpt
index 9cd44cf1d8..81f173c72b 100644
--- a/ext/standard/tests/array/array_diff_uassoc_variation5.phpt
+++ b/ext/standard/tests/array/array_diff_uassoc_variation5.phpt
@@ -28,7 +28,6 @@ var_dump( array_diff_uassoc($arr_default_int, $arr_float, "key_compare_func") );
var_dump( array_diff_uassoc($arr_float, $arr_default_int, "key_compare_func") );
?>
-===DONE===
--EXPECT--
*** Testing array_diff_uassoc() : usage variation ***
@@ -37,4 +36,3 @@ array(0) {
}
array(0) {
}
-===DONE===
diff --git a/ext/standard/tests/array/array_diff_uassoc_variation6.phpt b/ext/standard/tests/array/array_diff_uassoc_variation6.phpt
index 463ca80d5c..e96c893b46 100644
--- a/ext/standard/tests/array/array_diff_uassoc_variation6.phpt
+++ b/ext/standard/tests/array/array_diff_uassoc_variation6.phpt
@@ -32,7 +32,6 @@ var_dump( array_diff_uassoc($arr_float, $arr_string_float, "key_compare_func") )
var_dump( array_diff_uassoc($arr_string_float, $arr_float, "key_compare_func") );
?>
-===DONE===
--EXPECT--
*** Testing array_diff_uassoc() : usage variation ***
@@ -55,4 +54,3 @@ array(2) {
["1.00"]=>
string(4) "2.00"
}
-===DONE===
diff --git a/ext/standard/tests/array/array_diff_uassoc_variation7.phpt b/ext/standard/tests/array/array_diff_uassoc_variation7.phpt
index 4312688c59..2efaa1f830 100644
--- a/ext/standard/tests/array/array_diff_uassoc_variation7.phpt
+++ b/ext/standard/tests/array/array_diff_uassoc_variation7.phpt
@@ -27,7 +27,6 @@ var_dump( array_diff_uassoc($arr_string_int, $arr_string_float, "key_compare_fun
var_dump( array_diff_uassoc($arr_string_float, $arr_string_int, "key_compare_func") );
?>
-===DONE===
--EXPECT--
*** Testing array_diff_uassoc() : usage variation ***
@@ -44,4 +43,3 @@ array(2) {
["1.00"]=>
string(4) "2.00"
}
-===DONE===
diff --git a/ext/standard/tests/array/array_diff_uassoc_variation8.phpt b/ext/standard/tests/array/array_diff_uassoc_variation8.phpt
index 7bbe12212b..bdb2407296 100644
--- a/ext/standard/tests/array/array_diff_uassoc_variation8.phpt
+++ b/ext/standard/tests/array/array_diff_uassoc_variation8.phpt
@@ -32,7 +32,6 @@ var_dump( array_diff_uassoc($arr_default_int, $arr_string_float, "key_compare_fu
var_dump( array_diff_uassoc($arr_string_float, $arr_default_int, "key_compare_func") );
?>
-===DONE===
--EXPECT--
*** Testing array_diff_uassoc() : usage variation ***
@@ -59,4 +58,3 @@ array(2) {
["1.00"]=>
string(4) "2.00"
}
-===DONE===
diff --git a/ext/standard/tests/array/array_diff_uassoc_variation9.phpt b/ext/standard/tests/array/array_diff_uassoc_variation9.phpt
index fa36ea3ac2..7f9d8178ee 100644
--- a/ext/standard/tests/array/array_diff_uassoc_variation9.phpt
+++ b/ext/standard/tests/array/array_diff_uassoc_variation9.phpt
@@ -26,7 +26,6 @@ foreach($input_arrays as $key =>$value) {
}
?>
-===DONE===
--EXPECT--
*** Testing array_diff_uassoc() : usage variation ***
@@ -59,4 +58,3 @@ array(1) {
[-7]=>
int(-7)
}
-===DONE===
diff --git a/ext/standard/tests/array/array_diff_ukey_variation1.phpt b/ext/standard/tests/array/array_diff_ukey_variation1.phpt
index bbf349c4fd..a48ad44fd1 100644
--- a/ext/standard/tests/array/array_diff_ukey_variation1.phpt
+++ b/ext/standard/tests/array/array_diff_ukey_variation1.phpt
@@ -31,9 +31,9 @@ $fp = fopen(__FILE__, "r");
// define some classes
class classWithToString
{
- public function __toString() {
- return "Class A object";
- }
+ public function __toString() {
+ return "Class A object";
+ }
}
class classWithoutToString
@@ -97,222 +97,124 @@ $inputs = array(
// loop through each element of the array for arr1
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_diff_ukey($value, $array2, 'key_compare_func') );
- var_dump( array_diff_ukey($value, $array2, $array3, 'key_compare_func') );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_diff_ukey($value, $array2, 'key_compare_func') );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ try {
+ var_dump( array_diff_ukey($value, $array2, $array3, 'key_compare_func') );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
fclose($fp);
?>
-===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_diff_ukey() : usage variation ***
--int 0--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--int 1--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--int 12345--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--int -12345--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--float 10.5--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--float -10.5--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--float .5--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--uppercase NULL--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--lowercase null--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--lowercase true--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--lowercase false--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--empty string DQ--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--empty string SQ--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--string DQ--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--string SQ--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--mixed case string--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--heredoc--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--instance of classWithToString--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
+Expected parameter 1 to be an array, object given
+Expected parameter 1 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
+Expected parameter 1 to be an array, object given
+Expected parameter 1 to be an array, object given
--undefined var--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--unset var--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--resource--
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, resource given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 1 to be an array, resource given in %s on line %d
-NULL
-===DONE===
+Expected parameter 1 to be an array, resource given
+Expected parameter 1 to be an array, resource given
diff --git a/ext/standard/tests/array/array_diff_ukey_variation10.phpt b/ext/standard/tests/array/array_diff_ukey_variation10.phpt
index 09b4a70237..b2304bb446 100644
--- a/ext/standard/tests/array/array_diff_ukey_variation10.phpt
+++ b/ext/standard/tests/array/array_diff_ukey_variation10.phpt
@@ -14,27 +14,21 @@ $array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red");
$array2 = array("a" => "green", "yellow", "red");
//function name within double quotes
-var_dump( array_diff_ukey($array1, $array1, "unknown_function") );
+try {
+ var_dump( array_diff_ukey($array1, $array1, "unknown_function") );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
//function name within single quotes
-var_dump( array_diff_ukey($array1, $array1, 'unknown_function') );
-
-//function name without quotes
-var_dump( array_diff_ukey($array1, $array1, unknown_function) );
+try {
+ var_dump( array_diff_ukey($array1, $array1, 'unknown_function') );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
-===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_diff_ukey() : usage variation ***
-
-Warning: array_diff_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d
-NULL
-
-Warning: array_diff_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d
-NULL
-
-Warning: Use of undefined constant unknown_function - assumed 'unknown_function' (this will throw an Error in a future version of PHP) in %s on line %d
-
-Warning: array_diff_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d
-NULL
-===DONE===
+array_diff_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name
+array_diff_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name
diff --git a/ext/standard/tests/array/array_diff_ukey_variation2.phpt b/ext/standard/tests/array/array_diff_ukey_variation2.phpt
index 38141a430c..d39453086d 100644
--- a/ext/standard/tests/array/array_diff_ukey_variation2.phpt
+++ b/ext/standard/tests/array/array_diff_ukey_variation2.phpt
@@ -33,9 +33,9 @@ $fp = fopen(__FILE__, "r");
// define some classes
class classWithToString
{
- public function __toString() {
- return "Class A object";
- }
+ public function __toString() {
+ return "Class A object";
+ }
}
class classWithoutToString
@@ -101,222 +101,124 @@ $inputs = array(
// loop through each element of the array for arr2
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_diff_ukey($array1, $value, 'key_compare_func') );
- var_dump( array_diff_ukey($array1, $value, $array3, 'key_compare_func') );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_diff_ukey($array1, $value, 'key_compare_func') );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ try {
+ var_dump( array_diff_ukey($array1, $value, $array3, 'key_compare_func') );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
fclose($fp);
?>
-===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_diff_ukey() : usage variation ***
--int 0--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--int 1--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--int 12345--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--int -12345--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--float 10.5--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--float -10.5--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--float .5--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--uppercase NULL--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--lowercase null--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--lowercase true--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--lowercase false--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--empty string DQ--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--empty string SQ--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--string DQ--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--string SQ--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--mixed case string--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--heredoc--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--instance of classWithToString--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
+Expected parameter 2 to be an array, object given
+Expected parameter 2 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
+Expected parameter 2 to be an array, object given
+Expected parameter 2 to be an array, object given
--undefined var--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--unset var--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--resource--
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, resource given in %s on line %d
-NULL
-
-Warning: array_diff_ukey(): Expected parameter 2 to be an array, resource given in %s on line %d
-NULL
-===DONE===
+Expected parameter 2 to be an array, resource given
+Expected parameter 2 to be an array, resource given
diff --git a/ext/standard/tests/array/array_diff_ukey_variation3.phpt b/ext/standard/tests/array/array_diff_ukey_variation3.phpt
deleted file mode 100644
index 572061d697..0000000000
--- a/ext/standard/tests/array/array_diff_ukey_variation3.phpt
+++ /dev/null
@@ -1,240 +0,0 @@
---TEST--
-Test array_diff_ukey() function : usage variation - Passing unexpected values to third optional argument
---FILE--
-<?php
-/* Prototype : array array_diff_ukey(array arr1, array arr2 [, array ...], callback key_comp_func)
- * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments.
- * Source code: ext/standard/array.c
- */
-
-echo "*** Testing array_diff_ukey() : usage variation ***\n";
-
-// Initialise function arguments not being substituted (if any)
-$array1 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8);
-$array2 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4);
-
-function key_compare_func($key1, $key2)
-{
- if ($key1 == $key2) {
- return 0;
- }
- return ($key1 > $key2)? 1:-1;
-}
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-// resource variable
-$fp = fopen(__FILE__, "r");
-
-// define some classes
-class classWithToString
-{
- public function __toString() {
- return "Class A object";
- }
-}
-
-class classWithoutToString
-{
-}
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-//array of values to iterate over
-$inputs = array(
-
- // int data
- 'int 0' => 0,
- 'int 1' => 1,
- 'int 12345' => 12345,
- 'int -12345' => -2345,
-
- // float data
- 'float 10.5' => 10.5,
- 'float -10.5' => -10.5,
- 'float 12.3456789000e10' => 12.3456789000e10,
- 'float -12.3456789000e10' => -12.3456789000e10,
- 'float .5' => .5,
-
- // null data
- 'uppercase NULL' => NULL,
- 'lowercase null' => null,
-
- // boolean data
- 'lowercase true' => true,
- 'lowercase false' =>false,
- 'uppercase TRUE' =>TRUE,
- 'uppercase FALSE' =>FALSE,
-
- // empty data
- 'empty string DQ' => "",
- 'empty string SQ' => '',
-
- // string data
- 'string DQ' => "string",
- 'string SQ' => 'string',
- 'mixed case string' => "sTrInG",
- 'heredoc' => $heredoc,
-
- // object data
- 'instance of classWithToString' => new classWithToString(),
- 'instance of classWithoutToString' => new classWithoutToString(),
-
- // undefined data
- 'undefined var' => @$undefined_var,
-
- // unset data
- 'unset var' => @$unset_var,
-
- // resource data
- 'resource' => $fp,
-);
-
-// loop through each element of the array for key_comp_func
-
-foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_diff_ukey($array1, $array2, $value, 'key_compare_func') );
-};
-
-fclose($fp);
-?>
-===DONE===
---EXPECTF--
-*** Testing array_diff_ukey() : usage variation ***
-
---int 0--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---int 1--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---int 12345--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---int -12345--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---float 10.5--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float -10.5--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float 12.3456789000e10--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float -12.3456789000e10--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float .5--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---uppercase NULL--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---lowercase null--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---lowercase true--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---lowercase false--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---uppercase TRUE--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---uppercase FALSE--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---empty string DQ--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---empty string SQ--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---string DQ--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---string SQ--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---mixed case string--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---heredoc--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---instance of classWithToString--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, object given in %s on line %d
-NULL
-
---instance of classWithoutToString--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, object given in %s on line %d
-NULL
-
---undefined var--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---unset var--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---resource--
-
-Warning: array_diff_ukey(): Expected parameter 3 to be an array, resource given in %s on line %d
-NULL
-===DONE===
diff --git a/ext/standard/tests/array/array_diff_ukey_variation5.phpt b/ext/standard/tests/array/array_diff_ukey_variation5.phpt
index 7606212023..97ccfaab44 100644
--- a/ext/standard/tests/array/array_diff_ukey_variation5.phpt
+++ b/ext/standard/tests/array/array_diff_ukey_variation5.phpt
@@ -12,7 +12,7 @@ echo "*** Testing array_diff_ukey() : usage variation ***\n";
// Initialise function arguments not being substituted (if any)
$array1 = array(
- 'first' => array('blue' => 1, 'red' => 2),
+ 'first' => array('blue' => 1, 'red' => 2),
'second' => array('yellow' => 7),
@@ -21,7 +21,7 @@ $array1 = array(
$array2 = array (
- 'first' => array('blue' => 1, 'red' => 2,),
+ 'first' => array('blue' => 1, 'red' => 2,),
'second' => array('cyan' => 8),
@@ -32,7 +32,6 @@ echo "\n-- Testing array_diff_ukey() function with multi dimensional array --\n"
var_dump( array_diff_ukey($array1, $array2, 'strcasecmp') );
var_dump( array_diff_ukey($array2, $array1, 'strcasecmp') );
?>
-===DONE===
--EXPECT--
*** Testing array_diff_ukey() : usage variation ***
@@ -51,4 +50,3 @@ array(1) {
string(3) "two"
}
}
-===DONE===
diff --git a/ext/standard/tests/array/array_diff_ukey_variation6.phpt b/ext/standard/tests/array/array_diff_ukey_variation6.phpt
index 1131922fc8..e4ac13899b 100644
--- a/ext/standard/tests/array/array_diff_ukey_variation6.phpt
+++ b/ext/standard/tests/array/array_diff_ukey_variation6.phpt
@@ -29,7 +29,6 @@ foreach($input_arrays as $key =>$value) {
var_dump( array_diff_ukey($input_array, $value, 'key_compare_func') );
}
?>
-===DONE===
--EXPECT--
*** Testing array_diff_ukey() : usage variation ***
@@ -62,4 +61,3 @@ array(1) {
[10]=>
string(3) "0xA"
}
-===DONE===
diff --git a/ext/standard/tests/array/array_diff_ukey_variation7.phpt b/ext/standard/tests/array/array_diff_ukey_variation7.phpt
index 16ba89e9f1..3a2935bef7 100644
--- a/ext/standard/tests/array/array_diff_ukey_variation7.phpt
+++ b/ext/standard/tests/array/array_diff_ukey_variation7.phpt
@@ -24,7 +24,6 @@ var_dump( array_diff_ukey($float_indx_array, $input_array, 'key_compare_func') )
var_dump( array_diff_ukey($input_array, $float_indx_array, 'key_compare_func') );
?>
-===DONE===
--EXPECT--
*** Testing array_diff_ukey() : usage variation ***
@@ -39,4 +38,3 @@ array(2) {
[20]=>
string(2) "20"
}
-===DONE===
diff --git a/ext/standard/tests/array/array_diff_ukey_variation8.phpt b/ext/standard/tests/array/array_diff_ukey_variation8.phpt
index 0048bbb3fa..fc15526273 100644
--- a/ext/standard/tests/array/array_diff_ukey_variation8.phpt
+++ b/ext/standard/tests/array/array_diff_ukey_variation8.phpt
@@ -24,7 +24,6 @@ var_dump( array_diff_ukey($boolean_indx_array, $input_array, 'key_compare_func')
var_dump( array_diff_ukey($input_array, $boolean_indx_array, 'key_compare_func') );
?>
-===DONE===
--EXPECT--
*** Testing array_diff_ukey() : usage variation ***
@@ -39,4 +38,3 @@ array(3) {
["false"]=>
int(0)
}
-===DONE===
diff --git a/ext/standard/tests/array/array_diff_ukey_variation9.phpt b/ext/standard/tests/array/array_diff_ukey_variation9.phpt
index 5fdb0d4e24..ac825cffa7 100644
--- a/ext/standard/tests/array/array_diff_ukey_variation9.phpt
+++ b/ext/standard/tests/array/array_diff_ukey_variation9.phpt
@@ -29,7 +29,6 @@ foreach($input_arrays as $key =>$value) {
}
?>
-===DONE===
--EXPECT--
*** Testing array_diff_ukey() : usage variation ***
@@ -56,4 +55,3 @@ array(1) {
[10]=>
string(2) "10"
}
-===DONE===
diff --git a/ext/standard/tests/array/array_diff_variation1.phpt b/ext/standard/tests/array/array_diff_variation1.phpt
index e162c523d6..765fae39cd 100644
--- a/ext/standard/tests/array/array_diff_variation1.phpt
+++ b/ext/standard/tests/array/array_diff_variation1.phpt
@@ -73,7 +73,7 @@ $inputs = array(
// binary data
/*21*/ b"binary",
- (binary)"binary",
+ (binary)"binary",
// object data
/*23*/ new classA(),
@@ -91,118 +91,70 @@ $inputs = array(
// loop through each element of $inputs to check the behavior of array_diff
$iterator = 1;
foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --";
- var_dump( array_diff($input, $array));
- $iterator++;
+ echo "\n-- Iteration $iterator --";
+ try {
+ var_dump( array_diff($input, $array));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ $iterator++;
};
fclose($fp);
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing array_diff() : usage variations ***
--- Iteration 1 --
-Warning: array_diff(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+-- Iteration 1 --Expected parameter 1 to be an array, int given
--- Iteration 2 --
-Warning: array_diff(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+-- Iteration 2 --Expected parameter 1 to be an array, int given
--- Iteration 3 --
-Warning: array_diff(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+-- Iteration 3 --Expected parameter 1 to be an array, int given
--- Iteration 4 --
-Warning: array_diff(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+-- Iteration 4 --Expected parameter 1 to be an array, int given
--- Iteration 5 --
-Warning: array_diff(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+-- Iteration 5 --Expected parameter 1 to be an array, float given
--- Iteration 6 --
-Warning: array_diff(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+-- Iteration 6 --Expected parameter 1 to be an array, float given
--- Iteration 7 --
-Warning: array_diff(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+-- Iteration 7 --Expected parameter 1 to be an array, float given
--- Iteration 8 --
-Warning: array_diff(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+-- Iteration 8 --Expected parameter 1 to be an array, float given
--- Iteration 9 --
-Warning: array_diff(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+-- Iteration 9 --Expected parameter 1 to be an array, float given
--- Iteration 10 --
-Warning: array_diff(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+-- Iteration 10 --Expected parameter 1 to be an array, null given
--- Iteration 11 --
-Warning: array_diff(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+-- Iteration 11 --Expected parameter 1 to be an array, null given
--- Iteration 12 --
-Warning: array_diff(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 12 --Expected parameter 1 to be an array, bool given
--- Iteration 13 --
-Warning: array_diff(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 13 --Expected parameter 1 to be an array, bool given
--- Iteration 14 --
-Warning: array_diff(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 14 --Expected parameter 1 to be an array, bool given
--- Iteration 15 --
-Warning: array_diff(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 15 --Expected parameter 1 to be an array, bool given
--- Iteration 16 --
-Warning: array_diff(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iteration 16 --Expected parameter 1 to be an array, string given
--- Iteration 17 --
-Warning: array_diff(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iteration 17 --Expected parameter 1 to be an array, string given
--- Iteration 18 --
-Warning: array_diff(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iteration 18 --Expected parameter 1 to be an array, string given
--- Iteration 19 --
-Warning: array_diff(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iteration 19 --Expected parameter 1 to be an array, string given
--- Iteration 20 --
-Warning: array_diff(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iteration 20 --Expected parameter 1 to be an array, string given
--- Iteration 21 --
-Warning: array_diff(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iteration 21 --Expected parameter 1 to be an array, string given
--- Iteration 22 --
-Warning: array_diff(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iteration 22 --Expected parameter 1 to be an array, string given
--- Iteration 23 --
-Warning: array_diff(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
+-- Iteration 23 --Expected parameter 1 to be an array, object given
--- Iteration 24 --
-Warning: array_diff(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+-- Iteration 24 --Expected parameter 1 to be an array, null given
--- Iteration 25 --
-Warning: array_diff(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+-- Iteration 25 --Expected parameter 1 to be an array, null given
--- Iteration 26 --
-Warning: array_diff(): Expected parameter 1 to be an array, resource given in %s on line %d
-NULL
+-- Iteration 26 --Expected parameter 1 to be an array, resource given
Done
diff --git a/ext/standard/tests/array/array_diff_variation2.phpt b/ext/standard/tests/array/array_diff_variation2.phpt
index 5f8183b88d..0bceeea1f0 100644
--- a/ext/standard/tests/array/array_diff_variation2.phpt
+++ b/ext/standard/tests/array/array_diff_variation2.phpt
@@ -73,7 +73,7 @@ $inputs = array(
// binary data
/*21*/ b"binary",
- (binary)"binary",
+ (binary)"binary",
// object data
/*23*/ new classA(),
@@ -91,117 +91,69 @@ $inputs = array(
// loop through each element of $inputs to check the behavior of array_diff
$iterator = 1;
foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --";
- var_dump( array_diff($array, $input));
- $iterator++;
+ echo "\n-- Iteration $iterator --";
+ try {
+ var_dump( array_diff($array, $input));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ $iterator++;
};
fclose($fp);
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing array_diff() : usage variations ***
--- Iteration 1 --
-Warning: array_diff(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+-- Iteration 1 --Expected parameter 2 to be an array, int given
--- Iteration 2 --
-Warning: array_diff(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+-- Iteration 2 --Expected parameter 2 to be an array, int given
--- Iteration 3 --
-Warning: array_diff(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+-- Iteration 3 --Expected parameter 2 to be an array, int given
--- Iteration 4 --
-Warning: array_diff(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+-- Iteration 4 --Expected parameter 2 to be an array, int given
--- Iteration 5 --
-Warning: array_diff(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+-- Iteration 5 --Expected parameter 2 to be an array, float given
--- Iteration 6 --
-Warning: array_diff(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+-- Iteration 6 --Expected parameter 2 to be an array, float given
--- Iteration 7 --
-Warning: array_diff(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+-- Iteration 7 --Expected parameter 2 to be an array, float given
--- Iteration 8 --
-Warning: array_diff(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+-- Iteration 8 --Expected parameter 2 to be an array, float given
--- Iteration 9 --
-Warning: array_diff(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+-- Iteration 9 --Expected parameter 2 to be an array, float given
--- Iteration 10 --
-Warning: array_diff(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+-- Iteration 10 --Expected parameter 2 to be an array, null given
--- Iteration 11 --
-Warning: array_diff(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+-- Iteration 11 --Expected parameter 2 to be an array, null given
--- Iteration 12 --
-Warning: array_diff(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 12 --Expected parameter 2 to be an array, bool given
--- Iteration 13 --
-Warning: array_diff(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 13 --Expected parameter 2 to be an array, bool given
--- Iteration 14 --
-Warning: array_diff(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 14 --Expected parameter 2 to be an array, bool given
--- Iteration 15 --
-Warning: array_diff(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 15 --Expected parameter 2 to be an array, bool given
--- Iteration 16 --
-Warning: array_diff(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 16 --Expected parameter 2 to be an array, string given
--- Iteration 17 --
-Warning: array_diff(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 17 --Expected parameter 2 to be an array, string given
--- Iteration 18 --
-Warning: array_diff(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 18 --Expected parameter 2 to be an array, string given
--- Iteration 19 --
-Warning: array_diff(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 19 --Expected parameter 2 to be an array, string given
--- Iteration 20 --
-Warning: array_diff(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 20 --Expected parameter 2 to be an array, string given
--- Iteration 21 --
-Warning: array_diff(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 21 --Expected parameter 2 to be an array, string given
--- Iteration 22 --
-Warning: array_diff(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 22 --Expected parameter 2 to be an array, string given
--- Iteration 23 --
-Warning: array_diff(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
+-- Iteration 23 --Expected parameter 2 to be an array, object given
--- Iteration 24 --
-Warning: array_diff(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+-- Iteration 24 --Expected parameter 2 to be an array, null given
--- Iteration 25 --
-Warning: array_diff(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+-- Iteration 25 --Expected parameter 2 to be an array, null given
--- Iteration 26 --
-Warning: array_diff(): Expected parameter 2 to be an array, resource given in %s on line %d
-NULL
+-- Iteration 26 --Expected parameter 2 to be an array, resource given
Done
diff --git a/ext/standard/tests/array/array_diff_variation3.phpt b/ext/standard/tests/array/array_diff_variation3.phpt
index b7c842f21b..073d6ca5c9 100644
--- a/ext/standard/tests/array/array_diff_variation3.phpt
+++ b/ext/standard/tests/array/array_diff_variation3.phpt
@@ -80,7 +80,7 @@ $values = array(
"binary" => array(
// binary data
b"binary",
- (binary)"binary"),
+ (binary)"binary"),
/*9*/
"undefined" => array(
diff --git a/ext/standard/tests/array/array_diff_variation4.phpt b/ext/standard/tests/array/array_diff_variation4.phpt
index 3b02c21b36..07bb7293bc 100644
--- a/ext/standard/tests/array/array_diff_variation4.phpt
+++ b/ext/standard/tests/array/array_diff_variation4.phpt
@@ -80,7 +80,7 @@ $values = array(
"binary" => array(
// binary data
b"binary",
- (binary)"binary"),
+ (binary)"binary"),
/*9*/
"undefined" => array(
diff --git a/ext/standard/tests/array/array_diff_variation8.phpt b/ext/standard/tests/array/array_diff_variation8.phpt
index 9d768fa731..db06ee6473 100644
--- a/ext/standard/tests/array/array_diff_variation8.phpt
+++ b/ext/standard/tests/array/array_diff_variation8.phpt
@@ -1,5 +1,5 @@
--TEST--
-Test array_diff() function : usage variations - associative arrays contianing different data types
+Test array_diff() function : usage variations - associative arrays containing different data types
--FILE--
<?php
/* Prototype : array array_diff(array $arr1, array $arr2 [, array ...])
diff --git a/ext/standard/tests/array/array_diff_variation9.phpt b/ext/standard/tests/array/array_diff_variation9.phpt
index 05b6a1eb02..3d85bc1832 100644
--- a/ext/standard/tests/array/array_diff_variation9.phpt
+++ b/ext/standard/tests/array/array_diff_variation9.phpt
@@ -1,7 +1,5 @@
--TEST--
Test array_diff() function : usage variations - multidimensional arrays
---INI--
-error_reporting=E_ALL & ~E_NOTICE
--FILE--
<?php
/* Prototype : array array_diff(array $arr1, array $arr2 [, array ...])
@@ -38,11 +36,27 @@ var_dump(array_diff($array1, $array2['sub_arraya']));
echo "Done";
?>
---EXPECT--
+--EXPECTF--
*** Testing array_diff() : usage variations ***
-- Compare two 2-D arrays --
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
array(0) {
}
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
array(0) {
}
@@ -71,6 +85,10 @@ array(3) {
}
-- Compare a subarray from one 2-D array and one 2-D array --
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
array(3) {
[0]=>
int(1)
@@ -79,6 +97,10 @@ array(3) {
[2]=>
int(3)
}
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
array(2) {
["sub_array1"]=>
array(3) {
diff --git a/ext/standard/tests/array/array_fill.phpt b/ext/standard/tests/array/array_fill.phpt
index 230fe61652..4f2aa41b01 100644
--- a/ext/standard/tests/array/array_fill.phpt
+++ b/ext/standard/tests/array/array_fill.phpt
@@ -11,15 +11,13 @@ foreach($array1 as $start)
foreach($array2 as $value)
{
echo '==========================='."\n";
- echo 'start: '.$start.' num: '.$num.' value: '.$value."\n";
- $output = array_fill($start, $num, $value);
- var_dump($output);
+ echo 'start: '.$start.' num: '.$num.' value: '.$value."\n";
+ $output = array_fill($start, $num, $value);
+ var_dump($output);
}
}
}
-echo '== Done ==';
?>
-===============Done====================
--EXPECT--
===========================
start: 0 num: 0 value: 1
@@ -345,4 +343,3 @@ array(2) {
[3]=>
string(1) "f"
}
-== Done =================Done====================
diff --git a/ext/standard/tests/array/array_fill_error.phpt b/ext/standard/tests/array/array_fill_error.phpt
index 2fbdb850c3..3a9423e2b8 100644
--- a/ext/standard/tests/array/array_fill_error.phpt
+++ b/ext/standard/tests/array/array_fill_error.phpt
@@ -10,45 +10,18 @@ Test array_fill() function : error conditions
echo "*** Testing array_fill() : error conditions ***\n";
-// Zero arguments
-echo "-- Testing array_fill() function with Zero arguments --\n";
-var_dump( array_fill() );
-
-// More than expected number of arguments
-echo "-- Testing array_fill() function with more than expected no. of arguments --\n";
+// calling array_fill with negative values for 'num' parameter
$start_key = 0;
-$num = 2;
+$num = -1;
$val = 1;
-$extra_arg = 10;
-var_dump( array_fill($start_key,$num,$val, $extra_arg) );
-// Less than the expected number of arguments
-echo "-- Testing array_fill() function with less than expected no. of arguments --\n";
-$start_key = 0;
-$num = 2;
-var_dump( array_fill($start_key,$num) );
-
-//calling array_fill with negative values for 'num' parameter
-$num = -1;
-var_dump( array_fill($start_key,$num,$val) );
+try {
+ var_dump( array_fill($start_key,$num,$val) );
+} catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+}
-echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing array_fill() : error conditions ***
--- Testing array_fill() function with Zero arguments --
-
-Warning: array_fill() expects exactly 3 parameters, 0 given in %s on line %d
-NULL
--- Testing array_fill() function with more than expected no. of arguments --
-
-Warning: array_fill() expects exactly 3 parameters, 4 given in %s on line %d
-NULL
--- Testing array_fill() function with less than expected no. of arguments --
-
-Warning: array_fill() expects exactly 3 parameters, 2 given in %s on line %d
-NULL
-
-Warning: array_fill(): Number of elements can't be negative in %s on line %d
-bool(false)
-Done
+Number of elements can't be negative
diff --git a/ext/standard/tests/array/array_fill_keys.phpt b/ext/standard/tests/array/array_fill_keys.phpt
index 12adde72e7..eebfd0aafd 100644
--- a/ext/standard/tests/array/array_fill_keys.phpt
+++ b/ext/standard/tests/array/array_fill_keys.phpt
@@ -4,15 +4,12 @@ basic array_fill_keys test
precision=14
--FILE--
<?php
- var_dump(array_fill_keys('test', 1));
- var_dump(array_fill_keys(array(), 1));
- var_dump(array_fill_keys(array('foo', 'bar'), NULL));
- var_dump(array_fill_keys(array('5', 'foo', 10, 1.23), 123));
- var_dump(array_fill_keys(array('test', TRUE, 10, 100), ''));
+ var_dump(array_fill_keys(array(), 1));
+ var_dump(array_fill_keys(array('foo', 'bar'), NULL));
+ var_dump(array_fill_keys(array('5', 'foo', 10, 1.23), 123));
+ var_dump(array_fill_keys(array('test', TRUE, 10, 100), ''));
?>
---EXPECTF--
-Warning: array_fill_keys() expects parameter 1 to be array, string given in %s on line %d
-NULL
+--EXPECT--
array(0) {
}
array(2) {
diff --git a/ext/standard/tests/array/array_fill_keys_variation1.phpt b/ext/standard/tests/array/array_fill_keys_variation1.phpt
index 0af38c7bde..1f394eec86 100644
--- a/ext/standard/tests/array/array_fill_keys_variation1.phpt
+++ b/ext/standard/tests/array/array_fill_keys_variation1.phpt
@@ -59,7 +59,7 @@ array(4) {
-- Testing array_fill_keys() function with mixed array --
-Notice: Array to string conversion in %sarray_fill_keys_variation1.php on line %d
+Warning: Array to string conversion in %s on line %d
array(7) {
["Resource id #%d"]=>
string(6) "simple"
diff --git a/ext/standard/tests/array/array_fill_keys_variation3.phpt b/ext/standard/tests/array/array_fill_keys_variation3.phpt
index 84cc928cbc..b1abbcfe1b 100644
--- a/ext/standard/tests/array/array_fill_keys_variation3.phpt
+++ b/ext/standard/tests/array/array_fill_keys_variation3.phpt
@@ -12,33 +12,18 @@ Test array_fill_keys() function : variation of parameter
echo "*** Testing array_fill_keys() : parameter variations ***\n";
-$simpleStr = "simple";
$fp = fopen(__FILE__, "r");
-$bool = false;
-$float = 2.4;
$array = array("one", "two");
-$nullVal = null;
-
-echo "\n-- Testing array_fill_keys() function with both wrong arguments --\n";
-var_dump( array_fill_keys($bool, $float) );
echo "\n-- Testing array_fill_keys() function with unusual second arguments --\n";
var_dump( array_fill_keys($array, $fp) );
-echo "\n-- Testing array_fill_keys() function with mixed array --\n";
-var_dump( array_fill_keys($nullVal, $simpleStr) );
-
fclose($fp);
echo "Done";
?>
--EXPECTF--
*** Testing array_fill_keys() : parameter variations ***
--- Testing array_fill_keys() function with both wrong arguments --
-
-Warning: array_fill_keys() expects parameter 1 to be array, bool given in %sarray_fill_keys_variation3.php on line %d
-NULL
-
-- Testing array_fill_keys() function with unusual second arguments --
array(2) {
["one"]=>
@@ -46,9 +31,4 @@ array(2) {
["two"]=>
resource(%d) of type (stream)
}
-
--- Testing array_fill_keys() function with mixed array --
-
-Warning: array_fill_keys() expects parameter 1 to be array, null given in %sarray_fill_keys_variation3.php on line %d
-NULL
Done
diff --git a/ext/standard/tests/array/array_fill_keys_variation4.phpt b/ext/standard/tests/array/array_fill_keys_variation4.phpt
index bd89416d9d..9edc4e4a9c 100644
--- a/ext/standard/tests/array/array_fill_keys_variation4.phpt
+++ b/ext/standard/tests/array/array_fill_keys_variation4.phpt
@@ -83,7 +83,7 @@ array(1) {
-- Testing array_fill_keys() function with unset var --
-Notice: Undefined variable: unset_var in %sarray_fill_keys_variation4.php on line %d
+Warning: Undefined variable: unset_var in %s on line %d
array(1) {
["one"]=>
NULL
diff --git a/ext/standard/tests/array/array_filter.phpt b/ext/standard/tests/array/array_filter.phpt
index ba27a59c96..a1b18bd234 100644
--- a/ext/standard/tests/array/array_filter.phpt
+++ b/ext/standard/tests/array/array_filter.phpt
@@ -26,11 +26,7 @@ var_dump(array_filter($array2, "even"));
var_dump(array_filter($array3, "even"));
var_dump(array_filter(array()));
-var_dump(array_filter(array(), array()));
-var_dump(array_filter("", null));
-var_dump(array_filter($array1, 1));
-echo '== DONE ==';
?>
--EXPECTF--
Odd :
@@ -81,13 +77,3 @@ array(2) {
}
array(0) {
}
-
-Warning: array_filter() expects parameter 2 to be a valid callback, array must have exactly two members in %s on line %d
-NULL
-
-Warning: array_filter() expects parameter 1 to be array, string given in %s on line %d
-NULL
-
-Warning: array_filter() expects parameter 2 to be a valid callback, no array or string given in %s on line %d
-NULL
-== DONE ==
diff --git a/ext/standard/tests/array/array_filter_variation10.phpt b/ext/standard/tests/array/array_filter_variation10.phpt
index 4749fe8e45..265daf1fb4 100644
--- a/ext/standard/tests/array/array_filter_variation10.phpt
+++ b/ext/standard/tests/array/array_filter_variation10.phpt
@@ -35,9 +35,9 @@ var_dump( array_filter($input, 'dump2', true) );
echo "*** Testing array_filter() : usage variations - 'callback' expecting second argument ***\n";
try {
- var_dump( array_filter($small, 'dump', false) );
+ var_dump( array_filter($small, 'dump', false) );
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
echo "*** Testing array_filter() with various use types ***\n";
@@ -48,7 +48,11 @@ var_dump(array_filter($mixed, 'is_numeric', ARRAY_FILTER_USE_KEY));
var_dump(array_filter($mixed, 'is_numeric', 0));
-var_dump(array_filter($mixed, 'is_numeric', ARRAY_FILTER_USE_BOTH));
+try {
+ var_dump(array_filter($mixed, 'is_numeric', ARRAY_FILTER_USE_BOTH));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done"
?>
@@ -88,14 +92,5 @@ array(2) {
["b"]=>
int(2)
}
-
-Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line 48
-
-Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line 48
-
-Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line 48
-
-Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line 48
-array(0) {
-}
+is_numeric() expects exactly 1 parameter, 2 given
Done
diff --git a/ext/standard/tests/array/array_filter_variation4.phpt b/ext/standard/tests/array/array_filter_variation4.phpt
index f8b71dc10b..dcf1b905b1 100644
--- a/ext/standard/tests/array/array_filter_variation4.phpt
+++ b/ext/standard/tests/array/array_filter_variation4.phpt
@@ -32,7 +32,7 @@ var_dump( array_filter($input, "callback1") );
function callback2($input)
{
}
-echo "-- Callback funciton with parameter and without return --\n";
+echo "-- Callback function with parameter and without return --\n";
var_dump( array_filter($input, "callback2") );
@@ -79,7 +79,7 @@ array(8) {
["null"]=>
NULL
}
--- Callback funciton with parameter and without return --
+-- Callback function with parameter and without return --
array(0) {
}
-- Callback function without parameter and return --
diff --git a/ext/standard/tests/array/array_filter_variation7.phpt b/ext/standard/tests/array/array_filter_variation7.phpt
index efbe141fe5..2ecda7a5d8 100644
--- a/ext/standard/tests/array/array_filter_variation7.phpt
+++ b/ext/standard/tests/array/array_filter_variation7.phpt
@@ -24,7 +24,7 @@ echo "Anonymous callback function with reference parameter\n";
var_dump( array_filter($input, function(&$input) { return ($input < 1); }) );
// anonymous callback function with null argument
-echo "Anonymous callback funciton with null argument\n";
+echo "Anonymous callback function with null argument\n";
var_dump( array_filter($input, function() { return true; }) );
// anonymous callback function with argument and null statement
@@ -55,7 +55,7 @@ array(4) {
[7]=>
NULL
}
-Anonymous callback funciton with null argument
+Anonymous callback function with null argument
array(8) {
[0]=>
int(0)
diff --git a/ext/standard/tests/array/array_filter_variation9.phpt b/ext/standard/tests/array/array_filter_variation9.phpt
index a6f5789eae..240f5c10fa 100644
--- a/ext/standard/tests/array/array_filter_variation9.phpt
+++ b/ext/standard/tests/array/array_filter_variation9.phpt
@@ -13,7 +13,7 @@ Test array_filter() function : usage variations - built-in functions as 'callbac
echo "*** Testing array_filter() : usage variations - built-in functions as 'callback' argument ***\n";
-$input = array(0, 1, -1, 10, 100, 1000, 'Hello', null);
+$input = array(0, 1, -1, 10, 100, 1000, null);
// using built-in function 'is_int' as 'callback'
var_dump( array_filter($input, 'is_int') );
@@ -22,10 +22,18 @@ var_dump( array_filter($input, 'is_int') );
var_dump( array_filter($input, 'chr') );
// using language construct 'echo' as 'callback'
-var_dump( array_filter($input, 'echo') );
+try {
+ var_dump( array_filter($input, 'echo') );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
// using language construct 'exit' as 'callback'
-var_dump( array_filter($input, 'exit') );
+try {
+ var_dump( array_filter($input, 'exit') );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done"
?>
@@ -45,9 +53,7 @@ array(6) {
[5]=>
int(1000)
}
-
-Warning: chr() expects parameter 1 to be int, string given in %s on line %d
-array(8) {
+array(7) {
[0]=>
int(0)
[1]=>
@@ -61,14 +67,8 @@ array(8) {
[5]=>
int(1000)
[6]=>
- string(5) "Hello"
- [7]=>
NULL
}
-
-Warning: array_filter() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d
-NULL
-
-Warning: array_filter() expects parameter 2 to be a valid callback, function 'exit' not found or invalid function name in %s on line %d
-NULL
+array_filter() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name
+array_filter() expects parameter 2 to be a valid callback, function 'exit' not found or invalid function name
Done
diff --git a/ext/standard/tests/array/array_flip.phpt b/ext/standard/tests/array/array_flip.phpt
index ab8cf271b1..b03c65f034 100644
--- a/ext/standard/tests/array/array_flip.phpt
+++ b/ext/standard/tests/array/array_flip.phpt
@@ -16,11 +16,11 @@ $trans = array_flip($trans);
var_dump($trans);
?>
--EXPECTF--
-Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
+Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d
-Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
+Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d
-Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
+Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d
array(6) {
[1]=>
string(1) "b"
diff --git a/ext/standard/tests/array/array_flip_variation4.phpt b/ext/standard/tests/array/array_flip_variation4.phpt
index b8badb0caa..0ad2367701 100644
--- a/ext/standard/tests/array/array_flip_variation4.phpt
+++ b/ext/standard/tests/array/array_flip_variation4.phpt
@@ -62,29 +62,29 @@ echo "Done"
--EXPECTF--
*** Testing array_flip() : different invalid values in 'input' array argument ***
-Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
+Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d
-Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
+Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d
-Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
+Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d
-Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
+Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d
-Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
+Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d
-Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
+Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d
-Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
+Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d
-Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
+Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d
-Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
+Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d
-Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
+Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d
-Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
+Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d
-Warning: array_flip(): Can only flip STRING and INTEGER values! in %s on line %d
+Warning: array_flip(): Can only flip string and integer values, entry skipped in %s on line %d
array(0) {
}
Done
diff --git a/ext/standard/tests/array/array_intersect_1.phpt b/ext/standard/tests/array/array_intersect_1.phpt
index ce8fdd1cac..518dfd392f 100644
--- a/ext/standard/tests/array/array_intersect_1.phpt
+++ b/ext/standard/tests/array/array_intersect_1.phpt
@@ -4,27 +4,27 @@ Test of the *intersect* bunch of functions (both assoc and non-assoc)
<?php
error_reporting(E_ALL);
class cr {
- private $priv_member;
- public $public_member;
- function __construct($val) {
- $this->priv_member = $val;
- $this->public_member = $val;
- }
- static function comp_func_cr($a, $b) {
- if ($a->priv_member === $b->priv_member) return 0;
- return ($a->priv_member > $b->priv_member)? 1:-1;
- }
+ private $priv_member;
+ public $public_member;
+ function __construct($val) {
+ $this->priv_member = $val;
+ $this->public_member = $val;
+ }
+ static function comp_func_cr($a, $b) {
+ if ($a->priv_member === $b->priv_member) return 0;
+ return ($a->priv_member > $b->priv_member)? 1:-1;
+ }
}
function comp_func($a, $b) {
- if ($a === $b) return 0;
- return ($a > $b)? 1:-1;
+ if ($a === $b) return 0;
+ return ($a > $b)? 1:-1;
}
function comp_func_cr($a, $b) {
- if ($a->public_member === $b->public_member) return 0;
- return ($a->public_member > $b->public_member)? 1:-1;
+ if ($a->public_member === $b->public_member) return 0;
+ return ($a->public_member > $b->public_member)? 1:-1;
}
$a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1=> new cr(4), 2 => new cr(-15),);
diff --git a/ext/standard/tests/array/array_intersect_assoc_error.phpt b/ext/standard/tests/array/array_intersect_assoc_error.phpt
index a06dbddefe..fa815118ce 100644
--- a/ext/standard/tests/array/array_intersect_assoc_error.phpt
+++ b/ext/standard/tests/array/array_intersect_assoc_error.phpt
@@ -12,25 +12,29 @@ echo "*** Testing array_intersect_assoc() : error conditions ***\n";
// Zero arguments
echo "\n-- Testing array_intersect_assoc() function with Zero arguments --\n";
-var_dump( array_intersect_assoc() );
+try {
+ var_dump( array_intersect_assoc() );
+} catch (ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
// Testing array_intersect_assoc with one less than the expected number of arguments
echo "\n-- Testing array_intersect_assoc() function with less than expected no. of arguments --\n";
$arr1 = array(1, 2);
-var_dump( array_intersect_assoc($arr1) );
+try {
+ var_dump( array_intersect_assoc($arr1) );
+} catch (ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing array_intersect_assoc() : error conditions ***
-- Testing array_intersect_assoc() function with Zero arguments --
-
-Warning: array_intersect_assoc(): at least 2 parameters are required, 0 given in %s on line %d
-NULL
+At least 2 parameters are required, 0 given
-- Testing array_intersect_assoc() function with less than expected no. of arguments --
-
-Warning: array_intersect_assoc(): at least 2 parameters are required, 1 given in %s on line %d
-NULL
+At least 2 parameters are required, 1 given
Done
diff --git a/ext/standard/tests/array/array_intersect_assoc_variation1.phpt b/ext/standard/tests/array/array_intersect_assoc_variation1.phpt
index ca11b7cc9b..f4de4c68e7 100644
--- a/ext/standard/tests/array/array_intersect_assoc_variation1.phpt
+++ b/ext/standard/tests/array/array_intersect_assoc_variation1.phpt
@@ -90,17 +90,25 @@ $arrays = array(
/*24*/ $fp
);
-// loop through each sub-array within $arrrays to check the behavior of array_intersect_assoc()
+// loop through each sub-array within $arrays to check the behavior of array_intersect_assoc()
$iterator = 1;
foreach($arrays as $unexpected_value) {
- echo "\n-- Iteration $iterator --";
-
- // Calling array_intersect_assoc() with default arguments
- var_dump( array_intersect_assoc($unexpected_value, $arr2) );
-
- // Calling array_intersect_assoc() with more arguments
- var_dump( array_intersect_assoc($unexpected_value, $arr2, $arr3) );
- $iterator++;
+ echo "\n-- Iteration $iterator --";
+
+ // Calling array_intersect_assoc() with default arguments
+ try {
+ var_dump( array_intersect_assoc($unexpected_value, $arr2) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+
+ // Calling array_intersect_assoc() with more arguments
+ try {
+ var_dump( array_intersect_assoc($unexpected_value, $arr2, $arr3) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ $iterator++;
}
// close the file resource used
@@ -108,174 +116,78 @@ fclose($fp);
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing array_intersect_assoc() : Passing non-array values to $arr1 argument ***
--- Iteration 1 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
--- Iteration 2 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
--- Iteration 3 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
--- Iteration 4 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
--- Iteration 5 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
--- Iteration 6 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
--- Iteration 7 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
--- Iteration 8 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
--- Iteration 9 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
--- Iteration 10 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
--- Iteration 11 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
--- Iteration 12 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
--- Iteration 13 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 1 --Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 2 --Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--- Iteration 14 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 3 --Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 4 --Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--- Iteration 15 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 5 --Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 6 --Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--- Iteration 16 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iteration 7 --Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iteration 8 --Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--- Iteration 17 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iteration 9 --Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iteration 10 --Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--- Iteration 18 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iteration 11 --Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iteration 12 --Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--- Iteration 19 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iteration 13 --Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iteration 14 --Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--- Iteration 20 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iteration 15 --Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iteration 16 --Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--- Iteration 21 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
+-- Iteration 17 --Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
+-- Iteration 18 --Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--- Iteration 22 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+-- Iteration 19 --Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+-- Iteration 20 --Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--- Iteration 23 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+-- Iteration 21 --Expected parameter 1 to be an array, object given
+Expected parameter 1 to be an array, object given
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+-- Iteration 22 --Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--- Iteration 24 --
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, resource given in %s on line %d
-NULL
+-- Iteration 23 --Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
-Warning: array_intersect_assoc(): Expected parameter 1 to be an array, resource given in %s on line %d
-NULL
+-- Iteration 24 --Expected parameter 1 to be an array, resource given
+Expected parameter 1 to be an array, resource given
Done
diff --git a/ext/standard/tests/array/array_intersect_assoc_variation2.phpt b/ext/standard/tests/array/array_intersect_assoc_variation2.phpt
index 274da6f7b2..e3d12cd90d 100644
--- a/ext/standard/tests/array/array_intersect_assoc_variation2.phpt
+++ b/ext/standard/tests/array/array_intersect_assoc_variation2.phpt
@@ -90,18 +90,26 @@ $arrays = array(
/*24*/ $fp
);
-// loop through each sub-array within $arrrays to check the behavior of array_intersect_assoc()
+// loop through each sub-array within $arrays to check the behavior of array_intersect_assoc()
$iterator = 1;
foreach($arrays as $unexpected_value) {
- echo "\n-- Iteration $iterator --";
-
- // Calling array_intersect_assoc() with default arguments
- var_dump( array_intersect_assoc($arr1,$unexpected_value) );
-
- // Calling array_intersect_assoc() with more arguments
- var_dump( array_intersect_assoc($arr1, $unexpected_value, $arr3) );
-
- $iterator++;
+ echo "\n-- Iteration $iterator --";
+
+ // Calling array_intersect_assoc() with default arguments
+ try {
+ var_dump( array_intersect_assoc($arr1,$unexpected_value) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+
+ // Calling array_intersect_assoc() with more arguments
+ try {
+ var_dump( array_intersect_assoc($arr1, $unexpected_value, $arr3) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+
+ $iterator++;
}
// close the file resource used
@@ -109,174 +117,78 @@ fclose($fp);
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing array_intersect_assoc() : Passing non-array values to $arr2 argument ***
--- Iteration 1 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
--- Iteration 2 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
--- Iteration 3 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
--- Iteration 4 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
--- Iteration 5 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
--- Iteration 6 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
--- Iteration 7 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
--- Iteration 8 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
--- Iteration 9 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
--- Iteration 10 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
--- Iteration 11 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
--- Iteration 12 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
--- Iteration 13 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 1 --Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 2 --Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--- Iteration 14 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 3 --Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 4 --Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--- Iteration 15 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 5 --Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 6 --Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--- Iteration 16 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 7 --Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 8 --Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--- Iteration 17 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 9 --Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 10 --Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--- Iteration 18 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 11 --Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 12 --Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--- Iteration 19 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 13 --Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 14 --Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--- Iteration 20 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 15 --Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 16 --Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--- Iteration 21 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
+-- Iteration 17 --Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
+-- Iteration 18 --Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--- Iteration 22 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+-- Iteration 19 --Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+-- Iteration 20 --Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--- Iteration 23 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+-- Iteration 21 --Expected parameter 2 to be an array, object given
+Expected parameter 2 to be an array, object given
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+-- Iteration 22 --Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--- Iteration 24 --
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, resource given in %s on line %d
-NULL
+-- Iteration 23 --Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
-Warning: array_intersect_assoc(): Expected parameter 2 to be an array, resource given in %s on line %d
-NULL
+-- Iteration 24 --Expected parameter 2 to be an array, resource given
+Expected parameter 2 to be an array, resource given
Done
diff --git a/ext/standard/tests/array/array_intersect_assoc_variation3.phpt b/ext/standard/tests/array/array_intersect_assoc_variation3.phpt
index 44eaf4d410..5b3578430d 100644
--- a/ext/standard/tests/array/array_intersect_assoc_variation3.phpt
+++ b/ext/standard/tests/array/array_intersect_assoc_variation3.phpt
@@ -71,7 +71,7 @@ $arrays = array (
array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true),
array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6),
- // array with repetative keys
+ // array with repetitive keys
/*19*/ array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3)
);
@@ -85,7 +85,7 @@ $arr2 = array (
'', null => "null", '' => 'emptys', "emptyd" => "",
);
-// loop through each sub-array within $arrrays to check the behavior of array_intersect_assoc()
+// loop through each sub-array within $arrays to check the behavior of array_intersect_assoc()
$iterator = 1;
foreach($arrays as $arr1) {
echo "-- Iteration $iterator --\n";
diff --git a/ext/standard/tests/array/array_intersect_assoc_variation4.phpt b/ext/standard/tests/array/array_intersect_assoc_variation4.phpt
index df3cbfbcd7..17654feb75 100644
--- a/ext/standard/tests/array/array_intersect_assoc_variation4.phpt
+++ b/ext/standard/tests/array/array_intersect_assoc_variation4.phpt
@@ -80,11 +80,11 @@ $arrays = array (
array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true),
array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6),
- // array with repetative keys
+ // array with repetitive keys
/*19*/ array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3)
);
-// loop through each sub-array within $arrrays to check the behavior of array_intersect_assoc()
+// loop through each sub-array within $arrays to check the behavior of array_intersect_assoc()
$iterator = 1;
foreach($arrays as $arr2) {
echo "-- Iteration $iterator --\n";
diff --git a/ext/standard/tests/array/array_intersect_assoc_variation5.phpt b/ext/standard/tests/array/array_intersect_assoc_variation5.phpt
index 3a86aa9466..104e6e7f26 100644
--- a/ext/standard/tests/array/array_intersect_assoc_variation5.phpt
+++ b/ext/standard/tests/array/array_intersect_assoc_variation5.phpt
@@ -63,7 +63,7 @@ $arr2 = array(0 => 0, 2 => "float", 4 => "f3", 33333333 => "f4",
"\tHello" => 111, 2.2, 'color', "Hello world" => "string",
"pen\n" => 33, 133 => "int");
-// loop through each sub-array within $arrrays to check the behavior of array_intersect_assoc()
+// loop through each sub-array within $arrays to check the behavior of array_intersect_assoc()
$iterator = 1;
foreach($arrays as $arr1) {
echo "-- Iteration $iterator --\n";
diff --git a/ext/standard/tests/array/array_intersect_assoc_variation6.phpt b/ext/standard/tests/array/array_intersect_assoc_variation6.phpt
index e40f56bed0..fcbdd70a3c 100644
--- a/ext/standard/tests/array/array_intersect_assoc_variation6.phpt
+++ b/ext/standard/tests/array/array_intersect_assoc_variation6.phpt
@@ -63,7 +63,7 @@ $arr1 = array(0 => 0, 2 => "float", 4 => "f3", 33333333 => "f4",
"\tHello" => 111, 2.2, 'color', "Hello world" => "string",
"pen\n" => 33, 133 => "int");
-// loop through each sub-array within $arrrays to check the behavior of array_intersect_assoc()
+// loop through each sub-array within $arrays to check the behavior of array_intersect_assoc()
$iterator = 1;
foreach($arrays as $arr2) {
echo "-- Iteration $iterator --\n";
diff --git a/ext/standard/tests/array/array_intersect_assoc_variation7.phpt b/ext/standard/tests/array/array_intersect_assoc_variation7.phpt
index ca803e50a9..a77a59c04b 100644
--- a/ext/standard/tests/array/array_intersect_assoc_variation7.phpt
+++ b/ext/standard/tests/array/array_intersect_assoc_variation7.phpt
@@ -71,7 +71,7 @@ $arr2 = array(0 => "0", 1, "two" => 2, "float" => 2.3333, "f1" => 1.2,
"heredoc" => "Hello world", 11 => new classA(), "resource" => $fp,
"int" => 133, 222 => "fruit");
-// loop through each sub-array within $arrrays to check the behavior of array_intersect_assoc()
+// loop through each sub-array within $arrays to check the behavior of array_intersect_assoc()
$iterator = 1;
foreach($arrays as $arr1) {
echo "-- Iteration $iterator --\n";
diff --git a/ext/standard/tests/array/array_intersect_assoc_variation8.phpt b/ext/standard/tests/array/array_intersect_assoc_variation8.phpt
index a287f4742f..68868c44cf 100644
--- a/ext/standard/tests/array/array_intersect_assoc_variation8.phpt
+++ b/ext/standard/tests/array/array_intersect_assoc_variation8.phpt
@@ -71,7 +71,7 @@ $arr1 = array(0 => "0", 1, "two" => 2, "float" => 2.3333, "f1" => 1.2,
"heredoc" => "Hello world", 11 => new classA(), "resource" => $fp,
"int" => 133, 222 => "fruit");
-// loop through each sub-array within $arrrays to check the behavior of array_intersect_assoc()
+// loop through each sub-array within $arrays to check the behavior of array_intersect_assoc()
$iterator = 1;
foreach($arrays as $arr2) {
echo "-- Iteration $iterator --\n";
diff --git a/ext/standard/tests/array/array_intersect_assoc_variation9.phpt b/ext/standard/tests/array/array_intersect_assoc_variation9.phpt
index 26a491ad64..38b7605924 100644
--- a/ext/standard/tests/array/array_intersect_assoc_variation9.phpt
+++ b/ext/standard/tests/array/array_intersect_assoc_variation9.phpt
@@ -62,13 +62,13 @@ echo "Done";
-- Passing the entire 2-D array to $arr1 and $arr2 --
- With default arguments -
-Notice: Array to string conversion in %sarray_intersect_assoc_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_assoc_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_assoc_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_assoc_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
array(2) {
[0]=>
array(4) {
@@ -95,21 +95,21 @@ array(2) {
}
- With more arguments -
-Notice: Array to string conversion in %sarray_intersect_assoc_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_assoc_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_assoc_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_assoc_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_assoc_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_assoc_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_assoc_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_assoc_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
array(2) {
[0]=>
array(4) {
diff --git a/ext/standard/tests/array/array_intersect_error.phpt b/ext/standard/tests/array/array_intersect_error.phpt
index 373a0ddbe0..81be2634db 100644
--- a/ext/standard/tests/array/array_intersect_error.phpt
+++ b/ext/standard/tests/array/array_intersect_error.phpt
@@ -11,25 +11,29 @@ echo "*** Testing array_intersect() : error conditions ***\n";
// Testing array_intersect() with zero arguments
echo "\n-- Testing array_intersect() function with Zero arguments --\n";
-var_dump( array_intersect() );
+try {
+ var_dump( array_intersect() );
+} catch (ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
// Testing array_intersect() with one less than the expected number of arguments
echo "\n-- Testing array_intersect() function with less than expected no. of arguments --\n";
$arr1 = array(1, 2);
-var_dump( array_intersect($arr1) );
+try {
+ var_dump( array_intersect($arr1) );
+} catch (ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing array_intersect() : error conditions ***
-- Testing array_intersect() function with Zero arguments --
-
-Warning: array_intersect(): at least 2 parameters are required, 0 given in %s on line %d
-NULL
+At least 2 parameters are required, 0 given
-- Testing array_intersect() function with less than expected no. of arguments --
-
-Warning: array_intersect(): at least 2 parameters are required, 1 given in %s on line %d
-NULL
+At least 2 parameters are required, 1 given
Done
diff --git a/ext/standard/tests/array/array_intersect_key_error.phpt b/ext/standard/tests/array/array_intersect_key_error.phpt
index 10ad8ad342..70cb53412d 100644
--- a/ext/standard/tests/array/array_intersect_key_error.phpt
+++ b/ext/standard/tests/array/array_intersect_key_error.phpt
@@ -14,23 +14,25 @@ $array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4);
// Testing array_intersect_key with one less than the expected number of arguments
echo "\n-- Testing array_intersect_key() function with less than expected no. of arguments --\n";
-var_dump( array_intersect_key($array1) );
+try {
+ var_dump( array_intersect_key($array1) );
+} catch (ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
// Testing array_intersect_key with one less than the expected number of arguments
echo "\n-- Testing array_intersect_key() function with no arguments --\n";
-var_dump( array_intersect_key() );
+try {
+ var_dump( array_intersect_key() );
+} catch (ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
-===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_intersect_key() : error conditions ***
-- Testing array_intersect_key() function with less than expected no. of arguments --
-
-Warning: array_intersect_key(): at least 2 parameters are required, 1 given in %s on line %d
-NULL
+At least 2 parameters are required, 1 given
-- Testing array_intersect_key() function with no arguments --
-
-Warning: array_intersect_key(): at least 2 parameters are required, 0 given in %s on line %d
-NULL
-===DONE===
+At least 2 parameters are required, 0 given
diff --git a/ext/standard/tests/array/array_intersect_key_variation1.phpt b/ext/standard/tests/array/array_intersect_key_variation1.phpt
index fb9dd2c7aa..fc1d858516 100644
--- a/ext/standard/tests/array/array_intersect_key_variation1.phpt
+++ b/ext/standard/tests/array/array_intersect_key_variation1.phpt
@@ -23,9 +23,9 @@ $fp = fopen(__FILE__, "r");
// define some classes
class classWithToString
{
- public function __toString() {
- return "Class A object";
- }
+ public function __toString() {
+ return "Class A object";
+ }
}
class classWithoutToString
@@ -93,222 +93,124 @@ $inputs = array(
// loop through each element of the array for arr1
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_intersect_key($value, $array2) );
- var_dump( array_intersect_key($value, $array2, $array3) );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_intersect_key($value, $array2) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ try {
+ var_dump( array_intersect_key($value, $array2, $array3) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
}
fclose($fp);
?>
-===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_intersect_key() : usage variation ***
--int 0--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--int 1--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--int 12345--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--int -12345--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--float 10.5--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--float -10.5--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--float .5--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--uppercase NULL--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--lowercase null--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--lowercase true--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--lowercase false--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--empty string DQ--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--empty string SQ--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--string DQ--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--string SQ--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--mixed case string--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--heredoc--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--instance of classWithToString--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
+Expected parameter 1 to be an array, object given
+Expected parameter 1 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
+Expected parameter 1 to be an array, object given
+Expected parameter 1 to be an array, object given
--undefined var--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--unset var--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--resource var--
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, resource given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 1 to be an array, resource given in %s on line %d
-NULL
-===DONE===
+Expected parameter 1 to be an array, resource given
+Expected parameter 1 to be an array, resource given
diff --git a/ext/standard/tests/array/array_intersect_key_variation2.phpt b/ext/standard/tests/array/array_intersect_key_variation2.phpt
index 5d2147b99f..bae7600b9d 100644
--- a/ext/standard/tests/array/array_intersect_key_variation2.phpt
+++ b/ext/standard/tests/array/array_intersect_key_variation2.phpt
@@ -23,9 +23,9 @@ $fp = fopen(__FILE__, "r");
// define some classes
class classWithToString
{
- public function __toString() {
- return "Class A object";
- }
+ public function __toString() {
+ return "Class A object";
+ }
}
class classWithoutToString
@@ -94,222 +94,124 @@ $inputs = array(
// loop through each element of the array for arr2
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_intersect_key($array1, $value) );
- var_dump( array_intersect_key($array1, $value, $array3) );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_intersect_key($array1, $value) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ try {
+ var_dump( array_intersect_key($array1, $value, $array3) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
}
fclose($fp);
?>
-===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_intersect_key() : usage variation ***
--int 0--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--int 1--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--int 12345--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--int -12345--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--float 10.5--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--float -10.5--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--float .5--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--uppercase NULL--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--lowercase null--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--lowercase true--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--lowercase false--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--empty string DQ--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--empty string SQ--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--string DQ--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--string SQ--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--mixed case string--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--heredoc--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--instance of classWithToString--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
+Expected parameter 2 to be an array, object given
+Expected parameter 2 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
+Expected parameter 2 to be an array, object given
+Expected parameter 2 to be an array, object given
--undefined var--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--unset var--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--resource var--
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, resource given in %s on line %d
-NULL
-
-Warning: array_intersect_key(): Expected parameter 2 to be an array, resource given in %s on line %d
-NULL
-===DONE===
+Expected parameter 2 to be an array, resource given
+Expected parameter 2 to be an array, resource given
diff --git a/ext/standard/tests/array/array_intersect_key_variation3.phpt b/ext/standard/tests/array/array_intersect_key_variation3.phpt
deleted file mode 100644
index dca52bafc2..0000000000
--- a/ext/standard/tests/array/array_intersect_key_variation3.phpt
+++ /dev/null
@@ -1,235 +0,0 @@
---TEST--
-Test array_intersect_key() function : usage variation - Passing unexpected values to optional argument
---FILE--
-<?php
-/* Prototype : array array_intersect_key(array arr1, array arr2 [, array ...])
- * Description: Returns the entries of arr1 that have keys which are present in all the other arguments.
- * Source code: ext/standard/array.c
- */
-
-echo "*** Testing array_intersect_key() : usage variation ***\n";
-
-// Initialise function arguments not being substituted (if any)
-$array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4);
-$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8);
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-//resource variable
-$fp = fopen(__FILE__, "r");
-
-// define some classes
-class classWithToString
-{
- public function __toString() {
- return "Class A object";
- }
-}
-
-class classWithoutToString
-{
-}
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-// add arrays
-$index_array = array (1, 2, 3);
-$assoc_array = array ('one' => 1, 'two' => 2);
-
-//array of values to iterate over
-$inputs = array(
-
- // int data
- 'int 0' => 0,
- 'int 1' => 1,
- 'int 12345' => 12345,
- 'int -12345' => -12345,
-
- // float data
- 'float 10.5' => 10.5,
- 'float -10.5' => -10.5,
- 'float 12.3456789000e10' => 12.3456789000e10,
- 'float -12.3456789000e10' => -12.3456789000e10,
- 'float .5' => .5,
-
- // null data
- 'uppercase NULL' => NULL,
- 'lowercase null' => null,
-
- // boolean data
- 'lowercase true' => true,
- 'lowercase false' =>false,
- 'uppercase TRUE' =>TRUE,
- 'uppercase FALSE' =>FALSE,
-
- // empty data
- 'empty string DQ' => "",
- 'empty string SQ' => '',
-
- // string data
- 'string DQ' => "string",
- 'string SQ' => 'string',
- 'mixed case string' => "sTrInG",
- 'heredoc' => $heredoc,
-
- // object data
- 'instance of classWithToString' => new classWithToString(),
- 'instance of classWithoutToString' => new classWithoutToString(),
-
- // undefined data
- 'undefined var' => @$undefined_var,
-
- // unset data
- 'unset var' => @$unset_var,
-
- // resource data
- 'resource var' => $fp,
-);
-
-// loop through each element of the array for arr2
-foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_intersect_key($array1, $array2, $value) );
-}
-
-fclose($fp);
-?>
-===DONE===
---EXPECTF--
-*** Testing array_intersect_key() : usage variation ***
-
---int 0--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---int 1--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---int 12345--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---int -12345--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---float 10.5--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float -10.5--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float 12.3456789000e10--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float -12.3456789000e10--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float .5--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---uppercase NULL--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---lowercase null--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---lowercase true--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---lowercase false--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---uppercase TRUE--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---uppercase FALSE--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---empty string DQ--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---empty string SQ--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---string DQ--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---string SQ--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---mixed case string--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---heredoc--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---instance of classWithToString--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, object given in %s on line %d
-NULL
-
---instance of classWithoutToString--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, object given in %s on line %d
-NULL
-
---undefined var--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---unset var--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---resource var--
-
-Warning: array_intersect_key(): Expected parameter 3 to be an array, resource given in %s on line %d
-NULL
-===DONE===
diff --git a/ext/standard/tests/array/array_intersect_key_variation4.phpt b/ext/standard/tests/array/array_intersect_key_variation4.phpt
index 8b49ba8db1..bbf992fae0 100644
--- a/ext/standard/tests/array/array_intersect_key_variation4.phpt
+++ b/ext/standard/tests/array/array_intersect_key_variation4.phpt
@@ -24,7 +24,6 @@ foreach($input_arrays as $key =>$value) {
var_dump( array_intersect_key($value,$input_array ) );
}
?>
-===DONE===
--EXPECT--
*** Testing array_intersect_key() : usage variation ***
@@ -57,4 +56,3 @@ array(1) {
[-7]=>
string(4) "-0x7"
}
-===DONE===
diff --git a/ext/standard/tests/array/array_intersect_key_variation5.phpt b/ext/standard/tests/array/array_intersect_key_variation5.phpt
index fb01bb9207..d2b2541fc4 100644
--- a/ext/standard/tests/array/array_intersect_key_variation5.phpt
+++ b/ext/standard/tests/array/array_intersect_key_variation5.phpt
@@ -17,7 +17,6 @@ echo "\n-- Testing array_intersect_key() function with float indexed array --\n"
var_dump( array_intersect_key($input_array, $float_indx_array) );
var_dump( array_intersect_key($float_indx_array,$input_array ) );
?>
-===DONE===
--EXPECT--
*** Testing array_intersect_key() : usage variation ***
@@ -38,4 +37,3 @@ array(3) {
[-10]=>
string(5) "-10.5"
}
-===DONE===
diff --git a/ext/standard/tests/array/array_intersect_key_variation6.phpt b/ext/standard/tests/array/array_intersect_key_variation6.phpt
index da0115e368..6f84bac765 100644
--- a/ext/standard/tests/array/array_intersect_key_variation6.phpt
+++ b/ext/standard/tests/array/array_intersect_key_variation6.phpt
@@ -17,7 +17,6 @@ echo "\n-- Testing array_intersect_key() function with boolean indexed array --\
var_dump( array_intersect_key($input_array, $boolean_indx_array) );
var_dump( array_intersect_key($boolean_indx_array,$input_array ) );
?>
-===DONE===
--EXPECT--
*** Testing array_intersect_key() : usage variation ***
@@ -34,4 +33,3 @@ array(2) {
[0]=>
string(5) "boolF"
}
-===DONE===
diff --git a/ext/standard/tests/array/array_intersect_key_variation7.phpt b/ext/standard/tests/array/array_intersect_key_variation7.phpt
index 589893db5a..6332e8adb2 100644
--- a/ext/standard/tests/array/array_intersect_key_variation7.phpt
+++ b/ext/standard/tests/array/array_intersect_key_variation7.phpt
@@ -27,7 +27,6 @@ foreach($input_arrays as $key =>$value) {
var_dump( array_intersect_key($value,$input_array ) );
}
?>
-===DONE===
--EXPECT--
*** Testing array_intersect_key() : usage variation ***
@@ -60,4 +59,3 @@ array(1) {
[""]=>
string(5) "unset"
}
-===DONE===
diff --git a/ext/standard/tests/array/array_intersect_key_variation8.phpt b/ext/standard/tests/array/array_intersect_key_variation8.phpt
index 9a84b2aead..faa56eeb3d 100644
--- a/ext/standard/tests/array/array_intersect_key_variation8.phpt
+++ b/ext/standard/tests/array/array_intersect_key_variation8.phpt
@@ -12,7 +12,7 @@ echo "*** Testing array_intersect_key() : usage variation ***\n";
/// Initialise function arguments not being substituted (if any)
$array1 = array(
- 'first' => array('blue' => 1, 'red' => 2),
+ 'first' => array('blue' => 1, 'red' => 2),
'second' => array('yellow' => 7),
@@ -21,7 +21,7 @@ $array1 = array(
$array2 = array (
- 'first' => array('blue' => 1, 'red' => 2,),
+ 'first' => array('blue' => 1, 'red' => 2,),
'second' => array('cyan' => 8),
@@ -30,7 +30,6 @@ $array2 = array (
var_dump( array_intersect_key($array1, $array2) );
var_dump( array_intersect_key($array2,$array1 ) );
?>
-===DONE===
--EXPECT--
*** Testing array_intersect_key() : usage variation ***
array(2) {
@@ -61,4 +60,3 @@ array(2) {
int(8)
}
}
-===DONE===
diff --git a/ext/standard/tests/array/array_intersect_uassoc_variation1.phpt b/ext/standard/tests/array/array_intersect_uassoc_variation1.phpt
index 887ad12d9a..c663269b2a 100644
--- a/ext/standard/tests/array/array_intersect_uassoc_variation1.phpt
+++ b/ext/standard/tests/array/array_intersect_uassoc_variation1.phpt
@@ -31,9 +31,9 @@ $fp = fopen(__FILE__, "r");
// define some classes
class classWithToString
{
- public function __toString() {
- return "Class A object";
- }
+ public function __toString() {
+ return "Class A object";
+ }
}
class classWithoutToString
@@ -101,222 +101,124 @@ $inputs = array(
// loop through each element of the array for arr1
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_intersect_uassoc($value, $array2, 'key_compare_func') );
- var_dump( array_intersect_uassoc($value, $array2, $array3, 'key_compare_func') );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_intersect_uassoc($value, $array2, 'key_compare_func') );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ try {
+ var_dump( array_intersect_uassoc($value, $array2, $array3, 'key_compare_func') );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
fclose($fp);
?>
-===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_intersect_uassoc() : usage variation ***
--int 0--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--int 1--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--int 12345--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--int -12345--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--float 10.5--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--float -10.5--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--float .5--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--uppercase NULL--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--lowercase null--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--lowercase true--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--lowercase false--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--empty string DQ--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--empty string SQ--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--string DQ--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--string SQ--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--mixed case string--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--heredoc--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--instance of classWithToString--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
+Expected parameter 1 to be an array, object given
+Expected parameter 1 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
+Expected parameter 1 to be an array, object given
+Expected parameter 1 to be an array, object given
--undefined var--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--unset var--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--resource--
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, resource given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 1 to be an array, resource given in %s on line %d
-NULL
-===DONE===
+Expected parameter 1 to be an array, resource given
+Expected parameter 1 to be an array, resource given
diff --git a/ext/standard/tests/array/array_intersect_uassoc_variation10.phpt b/ext/standard/tests/array/array_intersect_uassoc_variation10.phpt
index 8f0bfd4753..c7ef8174f1 100644
--- a/ext/standard/tests/array/array_intersect_uassoc_variation10.phpt
+++ b/ext/standard/tests/array/array_intersect_uassoc_variation10.phpt
@@ -15,13 +15,13 @@ $array2 = array("a" => "green", "yellow", "red");
// define some class with method
class MyClass
{
- static function static_compare_func($a, $b) {
- return strcasecmp($a, $b);
- }
+ static function static_compare_func($a, $b) {
+ return strcasecmp($a, $b);
+ }
- public function class_compare_func($a, $b) {
- return strcasecmp($a, $b);
- }
+ public function class_compare_func($a, $b) {
+ return strcasecmp($a, $b);
+ }
}
@@ -33,7 +33,6 @@ echo "\n-- Testing array_intersect_uassoc() function using class with regular me
$obj = new MyClass();
var_dump( array_intersect_uassoc($array1, $array2, array($obj,'class_compare_func')) );
?>
-===DONE===
--EXPECT--
*** Testing array_intersect_uassoc() : usage variation ***
@@ -52,4 +51,3 @@ array(1) {
["a"]=>
string(5) "green"
}
-===DONE===
diff --git a/ext/standard/tests/array/array_intersect_uassoc_variation2.phpt b/ext/standard/tests/array/array_intersect_uassoc_variation2.phpt
index d482e9ffcc..20701a5c0b 100644
--- a/ext/standard/tests/array/array_intersect_uassoc_variation2.phpt
+++ b/ext/standard/tests/array/array_intersect_uassoc_variation2.phpt
@@ -31,9 +31,9 @@ $fp = fopen(__FILE__, "r");
// define some classes
class classWithToString
{
- public function __toString() {
- return "Class A object";
- }
+ public function __toString() {
+ return "Class A object";
+ }
}
class classWithoutToString
@@ -101,222 +101,124 @@ $inputs = array(
// loop through each element of the array for arr1
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_intersect_uassoc($array1, $value, 'key_compare_func') );
- var_dump( array_intersect_uassoc($array1, $value, $array3, 'key_compare_func') );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_intersect_uassoc($array1, $value, 'key_compare_func') );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ try {
+ var_dump( array_intersect_uassoc($array1, $value, $array3, 'key_compare_func') );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
fclose($fp);
?>
-===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_intersect_uassoc() : usage variation ***
--int 0--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--int 1--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--int 12345--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--int -12345--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--float 10.5--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--float -10.5--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--float .5--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--uppercase NULL--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--lowercase null--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--lowercase true--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--lowercase false--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--empty string DQ--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--empty string SQ--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--string DQ--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--string SQ--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--mixed case string--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--heredoc--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--instance of classWithToString--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
+Expected parameter 2 to be an array, object given
+Expected parameter 2 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
+Expected parameter 2 to be an array, object given
+Expected parameter 2 to be an array, object given
--undefined var--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--unset var--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--resource--
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, resource given in %s on line %d
-NULL
-
-Warning: array_intersect_uassoc(): Expected parameter 2 to be an array, resource given in %s on line %d
-NULL
-===DONE===
+Expected parameter 2 to be an array, resource given
+Expected parameter 2 to be an array, resource given
diff --git a/ext/standard/tests/array/array_intersect_uassoc_variation3.phpt b/ext/standard/tests/array/array_intersect_uassoc_variation3.phpt
deleted file mode 100644
index 42e53101dc..0000000000
--- a/ext/standard/tests/array/array_intersect_uassoc_variation3.phpt
+++ /dev/null
@@ -1,243 +0,0 @@
---TEST--
-Test array_intersect_uassoc() function : usage variation - Passing unexpected values to optional third argument
---FILE--
-<?php
-/* Prototype : array array_intersect_uassoc(array arr1, array arr2 [, array ...], callback key_compare_func)
- * Description: Computes the intersection of arrays with additional index check, compares indexes by a callback function
- * Source code: ext/standard/array.c
- */
-
-echo "*** Testing array_intersect_uassoc() : usage variation ***\n";
-
-// Initialise function arguments
-$array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red");
-$array2 = array("a" => "green", "yellow", "red");
-
-//Callback function
-function key_compare_func($a, $b) {
- if ($a === $b) {
- return 0;
- }
- return ($a > $b) ? 1 : -1;
-}
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-//resource variable
-$fp = fopen(__FILE__, "r");
-
-// define some classes
-class classWithToString
-{
- public function __toString() {
- return "Class A object";
- }
-}
-
-class classWithoutToString
-{
-}
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-// add arrays
-$index_array = array (1, 2, 3);
-$assoc_array = array ('one' => 1, 'two' => 2);
-
-//array of values to iterate over
-$inputs = array(
-
- // int data
- 'int 0' => 0,
- 'int 1' => 1,
- 'int 12345' => 12345,
- 'int -12345' => -12345,
-
- // float data
- 'float 10.5' => 10.5,
- 'float -10.5' => -10.5,
- 'float 12.3456789000e10' => 12.3456789000e10,
- 'float -12.3456789000e10' => -12.3456789000e10,
- 'float .5' => .5,
-
- // null data
- 'uppercase NULL' => NULL,
- 'lowercase null' => null,
-
- // boolean data
- 'lowercase true' => true,
- 'lowercase false' =>false,
- 'uppercase TRUE' =>TRUE,
- 'uppercase FALSE' =>FALSE,
-
- // empty data
- 'empty string DQ' => "",
- 'empty string SQ' => '',
-
- // string data
- 'string DQ' => "string",
- 'string SQ' => 'string',
- 'mixed case string' => "sTrInG",
- 'heredoc' => $heredoc,
-
- // object data
- 'instance of classWithToString' => new classWithToString(),
- 'instance of classWithoutToString' => new classWithoutToString(),
-
- // undefined data
- 'undefined var' => @$undefined_var,
-
- // unset data
- 'unset var' => @$unset_var,
-
- // resource data
- 'resource' => $fp,
-);
-
-// loop through each element of the array for arr1
-foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_intersect_uassoc($array1, $array2, $value, 'key_compare_func') );
-};
-
-fclose($fp);
-?>
-===DONE===
---EXPECTF--
-*** Testing array_intersect_uassoc() : usage variation ***
-
---int 0--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---int 1--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---int 12345--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---int -12345--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---float 10.5--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float -10.5--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float 12.3456789000e10--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float -12.3456789000e10--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float .5--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---uppercase NULL--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---lowercase null--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---lowercase true--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---lowercase false--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---uppercase TRUE--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---uppercase FALSE--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---empty string DQ--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---empty string SQ--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---string DQ--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---string SQ--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---mixed case string--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---heredoc--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---instance of classWithToString--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, object given in %s on line %d
-NULL
-
---instance of classWithoutToString--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, object given in %s on line %d
-NULL
-
---undefined var--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---unset var--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---resource--
-
-Warning: array_intersect_uassoc(): Expected parameter 3 to be an array, resource given in %s on line %d
-NULL
-===DONE===
diff --git a/ext/standard/tests/array/array_intersect_uassoc_variation5.phpt b/ext/standard/tests/array/array_intersect_uassoc_variation5.phpt
index 10835a1871..67463fb96d 100644
--- a/ext/standard/tests/array/array_intersect_uassoc_variation5.phpt
+++ b/ext/standard/tests/array/array_intersect_uassoc_variation5.phpt
@@ -32,7 +32,6 @@ var_dump( array_intersect_uassoc($arr_default_int, $arr_string, "key_compare_fun
echo "\n-- Result of integers and strings containing floating points intersection --\n";
var_dump( array_intersect_uassoc($arr_default_int, $arr_string_float, "key_compare_func") );
?>
-===DONE===
--EXPECT--
*** Testing array_intersect_uassoc() : usage variation ***
@@ -55,4 +54,3 @@ array(2) {
-- Result of integers and strings containing floating points intersection --
array(0) {
}
-===DONE===
diff --git a/ext/standard/tests/array/array_intersect_uassoc_variation6.phpt b/ext/standard/tests/array/array_intersect_uassoc_variation6.phpt
index b29a9684d5..0605af20f5 100644
--- a/ext/standard/tests/array/array_intersect_uassoc_variation6.phpt
+++ b/ext/standard/tests/array/array_intersect_uassoc_variation6.phpt
@@ -28,7 +28,6 @@ var_dump( array_intersect_uassoc($arr_float, $arr_string, "key_compare_func") );
echo "\n-- Result of floating points and strings containing floating point intersection --\n";
var_dump( array_intersect_uassoc($arr_float, $arr_string_float, "key_compare_func") );
?>
-===DONE===
--EXPECT--
*** Testing array_intersect_uassoc() : usage variation ***
@@ -43,4 +42,3 @@ array(2) {
-- Result of floating points and strings containing floating point intersection --
array(0) {
}
-===DONE===
diff --git a/ext/standard/tests/array/array_intersect_uassoc_variation7.phpt b/ext/standard/tests/array/array_intersect_uassoc_variation7.phpt
index 4be5ebf5d7..eec2dc1f93 100644
--- a/ext/standard/tests/array/array_intersect_uassoc_variation7.phpt
+++ b/ext/standard/tests/array/array_intersect_uassoc_variation7.phpt
@@ -32,7 +32,6 @@ var_dump( array_intersect_uassoc($arr1_string_float, $arr2_string_float, "key_co
echo "\n-- Result of strings containing integers and strings containing floating points intersection --\n";
var_dump( array_intersect_uassoc($arr1_string_int, $arr2_string_float, "key_compare_func") );
?>
-===DONE===
--EXPECT--
*** Testing array_intersect_uassoc() : usage variation ***
@@ -51,4 +50,3 @@ array(1) {
-- Result of strings containing integers and strings containing floating points intersection --
array(0) {
}
-===DONE===
diff --git a/ext/standard/tests/array/array_intersect_uassoc_variation8.phpt b/ext/standard/tests/array/array_intersect_uassoc_variation8.phpt
index 256b883d28..4b6498470a 100644
--- a/ext/standard/tests/array/array_intersect_uassoc_variation8.phpt
+++ b/ext/standard/tests/array/array_intersect_uassoc_variation8.phpt
@@ -27,7 +27,6 @@ $array2 = &$array1;
echo "\n-- Testing array_intersect_uassoc() function when \$array2 is referencd to \$array1 --\n";
var_dump( array_intersect_uassoc($array1, $array2, "strcasecmp") );
?>
-===DONE===
--EXPECT--
*** Testing array_intersect_uassoc() : usage variation ***
@@ -48,4 +47,3 @@ array(2) {
[1]=>
string(1) "a"
}
-===DONE===
diff --git a/ext/standard/tests/array/array_intersect_ukey_variation1.phpt b/ext/standard/tests/array/array_intersect_ukey_variation1.phpt
index 86850094b8..a02d3c03e3 100644
--- a/ext/standard/tests/array/array_intersect_ukey_variation1.phpt
+++ b/ext/standard/tests/array/array_intersect_ukey_variation1.phpt
@@ -32,9 +32,9 @@ $fp = fopen(__FILE__, "r");
// define some classes
class classWithToString
{
- public function __toString() {
- return "Class A object";
- }
+ public function __toString() {
+ return "Class A object";
+ }
}
class classWithoutToString
@@ -99,222 +99,124 @@ $inputs = array(
// loop through each element of the array for arr1
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_intersect_ukey($value, $array2, 'key_compare_func') );
- var_dump( array_intersect_ukey($value, $array2, $array3, 'key_compare_func') );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_intersect_ukey($value, $array2, 'key_compare_func') );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ try {
+ var_dump( array_intersect_ukey($value, $array2, $array3, 'key_compare_func') );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
fclose($fp);
?>
-===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_intersect_ukey() : usage variation ***
--int 0--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--int 1--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--int 12345--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--int -12345--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--float 10.5--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--float -10.5--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--float .5--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--uppercase NULL--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--lowercase null--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--lowercase true--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--lowercase false--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--empty string DQ--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--empty string SQ--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--string DQ--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--string SQ--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--mixed case string--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--heredoc--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--instance of classWithToString--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
+Expected parameter 1 to be an array, object given
+Expected parameter 1 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
+Expected parameter 1 to be an array, object given
+Expected parameter 1 to be an array, object given
--undefined var--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--unset var--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--resource var--
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, resource given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 1 to be an array, resource given in %s on line %d
-NULL
-===DONE===
+Expected parameter 1 to be an array, resource given
+Expected parameter 1 to be an array, resource given
diff --git a/ext/standard/tests/array/array_intersect_ukey_variation2.phpt b/ext/standard/tests/array/array_intersect_ukey_variation2.phpt
index 82b43628e3..a8f01201d5 100644
--- a/ext/standard/tests/array/array_intersect_ukey_variation2.phpt
+++ b/ext/standard/tests/array/array_intersect_ukey_variation2.phpt
@@ -32,9 +32,9 @@ $fp = fopen(__FILE__, "r");
// define some classes
class classWithToString
{
- public function __toString() {
- return "Class A object";
- }
+ public function __toString() {
+ return "Class A object";
+ }
}
class classWithoutToString
@@ -99,222 +99,124 @@ $inputs = array(
// loop through each element of the array for arr2
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_intersect_ukey($array1, $value, 'key_compare_func') );
- var_dump( array_intersect_ukey($array1, $value, $array3, 'key_compare_func') );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_intersect_ukey($array1, $value, 'key_compare_func') );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ try {
+ var_dump( array_intersect_ukey($array1, $value, $array3, 'key_compare_func') );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
fclose($fp);
?>
-===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_intersect_ukey() : usage variation ***
--int 0--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--int 1--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--int 12345--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--int -12345--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--float 10.5--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--float -10.5--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--float .5--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--uppercase NULL--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--lowercase null--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--lowercase true--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--lowercase false--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--empty string DQ--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--empty string SQ--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--string DQ--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--string SQ--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--mixed case string--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--heredoc--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--instance of classWithToString--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
+Expected parameter 2 to be an array, object given
+Expected parameter 2 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
+Expected parameter 2 to be an array, object given
+Expected parameter 2 to be an array, object given
--undefined var--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--unset var--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--resource var--
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, resource given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 2 to be an array, resource given in %s on line %d
-NULL
-===DONE===
+Expected parameter 2 to be an array, resource given
+Expected parameter 2 to be an array, resource given
diff --git a/ext/standard/tests/array/array_intersect_ukey_variation4.phpt b/ext/standard/tests/array/array_intersect_ukey_variation4.phpt
deleted file mode 100644
index 35c0d4a2e6..0000000000
--- a/ext/standard/tests/array/array_intersect_ukey_variation4.phpt
+++ /dev/null
@@ -1,321 +0,0 @@
---TEST--
-Test array_intersect_ukey() function : usage variation - Passing unexpected values to optional third argument
---FILE--
-<?php
-/* Prototype : array array_intersect_ukey(array arr1, array arr2 [, array ...], callback key_compare_func)
- * Description: Computes the intersection of arrays using a callback function on the keys for comparison.
- * Source code: ext/standard/array.c
- */
-
-echo "*** Testing array_intersect_ukey() : usage variation ***\n";
-
-//Initialise arguments
-$array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4);
-$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8);
-$array4 = array('green' => 5, 'cyan' => 8);
-
-//Call back function
-function key_compare_func($key1, $key2)
-{
- if ($key1 == $key2)
- return 0;
- else
- return ($key1 > $key2)? 1:-1;
-}
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-//resource variable
-$fp = fopen(__FILE__, "r");
-
-// define some classes
-class classWithToString
-{
- public function __toString() {
- return "Class A object";
- }
-}
-
-class classWithoutToString
-{
-}
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-//array of values to iterate over
-$inputs = array(
-
- // int data
- 'int 0' => 0,
- 'int 1' => 1,
- 'int 12345' => 12345,
- 'int -12345' => -12345,
-
- // float data
- 'float 10.5' => 10.5,
- 'float -10.5' => -10.5,
- 'float 12.3456789000e10' => 12.3456789000e10,
- 'float -12.3456789000e10' => -12.3456789000e10,
- 'float .5' => .5,
-
- // null data
- 'uppercase NULL' => NULL,
- 'lowercase null' => null,
-
- // boolean data
- 'lowercase true' => true,
- 'lowercase false' =>false,
- 'uppercase TRUE' =>TRUE,
- 'uppercase FALSE' =>FALSE,
-
- // empty data
- 'empty string DQ' => "",
- 'empty string SQ' => '',
-
- // string data
- 'string DQ' => "string",
- 'string SQ' => 'string',
- 'mixed case string' => "sTrInG",
- 'heredoc' => $heredoc,
-
- // object data
- 'instance of classWithToString' => new classWithToString(),
- 'instance of classWithoutToString' => new classWithoutToString(),
-
- // undefined data
- 'undefined var' => @$undefined_var,
-
- // unset data
- 'unset var' => @$unset_var,
-
- // resource data
- 'resource var' => $fp,
-);
-
-// loop through each element of the array for arr2
-
-foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_intersect_ukey($array1, $array2, $value, 'key_compare_func') );
- var_dump( array_intersect_ukey($array1, $array2, $value, $array4, 'key_compare_func') );
-};
-
-fclose($fp);
-?>
-===DONE===
---EXPECTF--
-*** Testing array_intersect_ukey() : usage variation ***
-
---int 0--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---int 1--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---int 12345--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---int -12345--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
---float 10.5--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float -10.5--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float 12.3456789000e10--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float -12.3456789000e10--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---float .5--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, float given in %s on line %d
-NULL
-
---uppercase NULL--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---lowercase null--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---lowercase true--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---lowercase false--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---uppercase TRUE--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---uppercase FALSE--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, bool given in %s on line %d
-NULL
-
---empty string DQ--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---empty string SQ--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---string DQ--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---string SQ--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---mixed case string--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---heredoc--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, string given in %s on line %d
-NULL
-
---instance of classWithToString--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, object given in %s on line %d
-NULL
-
---instance of classWithoutToString--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, object given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, object given in %s on line %d
-NULL
-
---undefined var--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---unset var--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
---resource var--
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, resource given in %s on line %d
-NULL
-
-Warning: array_intersect_ukey(): Expected parameter 3 to be an array, resource given in %s on line %d
-NULL
-===DONE===
diff --git a/ext/standard/tests/array/array_intersect_ukey_variation5.phpt b/ext/standard/tests/array/array_intersect_ukey_variation5.phpt
index e56d6195d0..9f260b70ef 100644
--- a/ext/standard/tests/array/array_intersect_ukey_variation5.phpt
+++ b/ext/standard/tests/array/array_intersect_ukey_variation5.phpt
@@ -33,7 +33,6 @@ var_dump( array_intersect_ukey($arr_default_int, $arr_string, "key_compare_func"
echo "\n-- Result of integers and strings containing floating points intersection --\n";
var_dump( array_intersect_ukey($arr_default_int, $arr_string_float, "key_compare_func") );
?>
-===DONE===
--EXPECT--
*** Testing array_intersect_ukey() : usage variation ***
@@ -60,4 +59,3 @@ array(2) {
[1]=>
int(2)
}
-===DONE===
diff --git a/ext/standard/tests/array/array_intersect_ukey_variation6.phpt b/ext/standard/tests/array/array_intersect_ukey_variation6.phpt
index 9384c48a46..da8246ef8b 100644
--- a/ext/standard/tests/array/array_intersect_ukey_variation6.phpt
+++ b/ext/standard/tests/array/array_intersect_ukey_variation6.phpt
@@ -29,7 +29,6 @@ var_dump( array_intersect_ukey($arr_float, $arr_string, 'key_compare_func') );
echo "\n-- Result of floating points and strings containing floating point intersection --\n";
var_dump( array_intersect_ukey($arr_float, $arr_string_float, 'key_compare_func') );
?>
-===DONE===
--EXPECT--
*** Testing array_intersect_ukey() : usage variation ***
@@ -48,4 +47,3 @@ array(2) {
[1]=>
float(2)
}
-===DONE===
diff --git a/ext/standard/tests/array/array_intersect_ukey_variation7.phpt b/ext/standard/tests/array/array_intersect_ukey_variation7.phpt
index 4f069c0ae8..dade6fd051 100644
--- a/ext/standard/tests/array/array_intersect_ukey_variation7.phpt
+++ b/ext/standard/tests/array/array_intersect_ukey_variation7.phpt
@@ -33,7 +33,6 @@ var_dump( array_intersect_ukey($arr1_string_float, $arr2_string_float, 'key_comp
echo "\n-- Result of strings containing integers and strings containing floating points intersection --\n";
var_dump( array_intersect_ukey($arr1_string_int, $arr2_string_float, 'key_compare_func') );
?>
-===DONE===
--EXPECT--
*** Testing array_intersect_ukey() : usage variation ***
@@ -60,4 +59,3 @@ array(2) {
[1]=>
string(1) "2"
}
-===DONE===
diff --git a/ext/standard/tests/array/array_intersect_ukey_variation8.phpt b/ext/standard/tests/array/array_intersect_ukey_variation8.phpt
index 122d1e4767..b83c3302b2 100644
--- a/ext/standard/tests/array/array_intersect_ukey_variation8.phpt
+++ b/ext/standard/tests/array/array_intersect_ukey_variation8.phpt
@@ -14,26 +14,21 @@ $array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4);
$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8);
//function name within double quotes
-var_dump( array_intersect_ukey($array1, $array2, "unknown_function") );
+try {
+ var_dump( array_intersect_ukey($array1, $array2, "unknown_function") );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
//function name within single quotes
-var_dump( array_intersect_ukey($array1, $array2, 'unknown_function') );
+try {
+ var_dump( array_intersect_ukey($array1, $array2, 'unknown_function') );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
-//function name without quotes
-var_dump( array_intersect_ukey($array1, $array2, unknown_function) );
?>
-===DONE===
--EXPECTF--
*** Testing array_intersect_ukey() : usage variation ***
-
-Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d
-NULL
-
-Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d
-NULL
-
-Warning: Use of undefined constant unknown_function - assumed 'unknown_function' (this will throw an Error in a future version of PHP) in %s on line %d
-
-Warning: array_intersect_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name in %s on line %d
-NULL
-===DONE===
+array_intersect_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name
+array_intersect_ukey() expects parameter 3 to be a valid callback, function 'unknown_function' not found or invalid function name
diff --git a/ext/standard/tests/array/array_intersect_ukey_variation9.phpt b/ext/standard/tests/array/array_intersect_ukey_variation9.phpt
index f6dddb9e83..205991cd41 100644
--- a/ext/standard/tests/array/array_intersect_ukey_variation9.phpt
+++ b/ext/standard/tests/array/array_intersect_ukey_variation9.phpt
@@ -15,13 +15,13 @@ $array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8);
class MyClass
{
- static function static_compare_func($key1, $key2) {
- return strcasecmp($key1, $key2);
- }
+ static function static_compare_func($key1, $key2) {
+ return strcasecmp($key1, $key2);
+ }
- public function class_compare_func($key1, $key2) {
- return strcasecmp($key1, $key2);
- }
+ public function class_compare_func($key1, $key2) {
+ return strcasecmp($key1, $key2);
+ }
}
@@ -33,7 +33,6 @@ echo "\n-- Testing array_intersect_uassoc() function using class with regular me
$obj = new MyClass();
var_dump( array_intersect_ukey($array1, $array2, array($obj,'class_compare_func')) );
?>
-===DONE===
--EXPECT--
*** Testing array_intersect_ukey() : usage variation ***
@@ -58,4 +57,3 @@ array(2) {
["green"]=>
int(3)
}
-===DONE===
diff --git a/ext/standard/tests/array/array_intersect_variation1.phpt b/ext/standard/tests/array/array_intersect_variation1.phpt
index 9536dd8c2a..f0b1144ed3 100644
--- a/ext/standard/tests/array/array_intersect_variation1.phpt
+++ b/ext/standard/tests/array/array_intersect_variation1.phpt
@@ -89,17 +89,25 @@ $arrays = array(
/*24*/ $fp
);
-// loop through each sub-array within $arrrays to check the behavior of array_intersect()
+// loop through each sub-array within $arrays to check the behavior of array_intersect()
$iterator = 1;
foreach($arrays as $unexpected_value) {
- echo "\n-- Iterator $iterator --";
-
- // Calling array_intersect() with default arguments
- var_dump( array_intersect($unexpected_value,$arr2) );
-
- // Calling array_intersect() with more arguments
- var_dump( array_intersect($unexpected_value, $arr2, $arr3) );
- $iterator++;
+ echo "\n-- Iterator $iterator --";
+
+ // Calling array_intersect() with default arguments
+ try {
+ var_dump( array_intersect($unexpected_value,$arr2) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+
+ // Calling array_intersect() with more arguments
+ try {
+ var_dump( array_intersect($unexpected_value, $arr2, $arr3) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ $iterator++;
}
// close the file resource used
@@ -107,174 +115,78 @@ fclose($fp);
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing array_intersect() : Passing non-array values to $arr1 argument ***
--- Iterator 1 --
-Warning: array_intersect(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
--- Iterator 2 --
-Warning: array_intersect(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
--- Iterator 3 --
-Warning: array_intersect(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
--- Iterator 4 --
-Warning: array_intersect(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
--- Iterator 5 --
-Warning: array_intersect(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
--- Iterator 6 --
-Warning: array_intersect(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
--- Iterator 7 --
-Warning: array_intersect(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
--- Iterator 8 --
-Warning: array_intersect(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
--- Iterator 9 --
-Warning: array_intersect(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
--- Iterator 10 --
-Warning: array_intersect(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
--- Iterator 11 --
-Warning: array_intersect(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
--- Iterator 12 --
-Warning: array_intersect(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
--- Iterator 13 --
-Warning: array_intersect(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+-- Iterator 1 --Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
-Warning: array_intersect(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+-- Iterator 2 --Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--- Iterator 14 --
-Warning: array_intersect(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+-- Iterator 3 --Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
-Warning: array_intersect(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+-- Iterator 4 --Expected parameter 1 to be an array, int given
+Expected parameter 1 to be an array, int given
--- Iterator 15 --
-Warning: array_intersect(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+-- Iterator 5 --Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
-Warning: array_intersect(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+-- Iterator 6 --Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--- Iterator 16 --
-Warning: array_intersect(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iterator 7 --Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
-Warning: array_intersect(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iterator 8 --Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
--- Iterator 17 --
-Warning: array_intersect(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iterator 9 --Expected parameter 1 to be an array, float given
+Expected parameter 1 to be an array, float given
-Warning: array_intersect(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iterator 10 --Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--- Iterator 18 --
-Warning: array_intersect(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iterator 11 --Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
-Warning: array_intersect(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iterator 12 --Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--- Iterator 19 --
-Warning: array_intersect(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iterator 13 --Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
-Warning: array_intersect(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iterator 14 --Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
--- Iterator 20 --
-Warning: array_intersect(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iterator 15 --Expected parameter 1 to be an array, bool given
+Expected parameter 1 to be an array, bool given
-Warning: array_intersect(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- Iterator 16 --Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--- Iterator 21 --
-Warning: array_intersect(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
+-- Iterator 17 --Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
-Warning: array_intersect(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
+-- Iterator 18 --Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--- Iterator 22 --
-Warning: array_intersect(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+-- Iterator 19 --Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
-Warning: array_intersect(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+-- Iterator 20 --Expected parameter 1 to be an array, string given
+Expected parameter 1 to be an array, string given
--- Iterator 23 --
-Warning: array_intersect(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+-- Iterator 21 --Expected parameter 1 to be an array, object given
+Expected parameter 1 to be an array, object given
-Warning: array_intersect(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+-- Iterator 22 --Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
--- Iterator 24 --
-Warning: array_intersect(): Expected parameter 1 to be an array, resource given in %s on line %d
-NULL
+-- Iterator 23 --Expected parameter 1 to be an array, null given
+Expected parameter 1 to be an array, null given
-Warning: array_intersect(): Expected parameter 1 to be an array, resource given in %s on line %d
-NULL
+-- Iterator 24 --Expected parameter 1 to be an array, resource given
+Expected parameter 1 to be an array, resource given
Done
diff --git a/ext/standard/tests/array/array_intersect_variation2.phpt b/ext/standard/tests/array/array_intersect_variation2.phpt
index 1db37b8467..dae028898c 100644
--- a/ext/standard/tests/array/array_intersect_variation2.phpt
+++ b/ext/standard/tests/array/array_intersect_variation2.phpt
@@ -89,18 +89,26 @@ $arrays = array(
/*24*/ $fp
);
-// loop through each sub-array within $arrrays to check the behavior of array_intersect()
+// loop through each sub-array within $arrays to check the behavior of array_intersect()
$iterator = 1;
foreach($arrays as $unexpected_value) {
- echo "\n-- Iterator $iterator --";
-
- // Calling array_intersect() with default arguments
- var_dump( array_intersect($arr1,$unexpected_value) );
-
- // Calling array_intersect() with more arguments
- var_dump( array_intersect($arr1, $unexpected_value, $arr3) );
-
- $iterator++;
+ echo "\n-- Iterator $iterator --";
+
+ // Calling array_intersect() with default arguments
+ try {
+ var_dump( array_intersect($arr1,$unexpected_value) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+
+ // Calling array_intersect() with more arguments
+ try {
+ var_dump( array_intersect($arr1, $unexpected_value, $arr3) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+
+ $iterator++;
}
// close the file resource used
@@ -108,174 +116,78 @@ fclose($fp);
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing array_intersect() : Passing non-array values to $arr2 argument ***
--- Iterator 1 --
-Warning: array_intersect(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
--- Iterator 2 --
-Warning: array_intersect(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
--- Iterator 3 --
-Warning: array_intersect(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
--- Iterator 4 --
-Warning: array_intersect(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
-
--- Iterator 5 --
-Warning: array_intersect(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
--- Iterator 6 --
-Warning: array_intersect(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
--- Iterator 7 --
-Warning: array_intersect(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
--- Iterator 8 --
-Warning: array_intersect(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
--- Iterator 9 --
-Warning: array_intersect(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
-
--- Iterator 10 --
-Warning: array_intersect(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
--- Iterator 11 --
-Warning: array_intersect(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
-
--- Iterator 12 --
-Warning: array_intersect(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
-Warning: array_intersect(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
-
--- Iterator 13 --
-Warning: array_intersect(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+-- Iterator 1 --Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
-Warning: array_intersect(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+-- Iterator 2 --Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--- Iterator 14 --
-Warning: array_intersect(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+-- Iterator 3 --Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
-Warning: array_intersect(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+-- Iterator 4 --Expected parameter 2 to be an array, int given
+Expected parameter 2 to be an array, int given
--- Iterator 15 --
-Warning: array_intersect(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+-- Iterator 5 --Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
-Warning: array_intersect(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+-- Iterator 6 --Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--- Iterator 16 --
-Warning: array_intersect(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iterator 7 --Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
-Warning: array_intersect(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iterator 8 --Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
--- Iterator 17 --
-Warning: array_intersect(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iterator 9 --Expected parameter 2 to be an array, float given
+Expected parameter 2 to be an array, float given
-Warning: array_intersect(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iterator 10 --Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--- Iterator 18 --
-Warning: array_intersect(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iterator 11 --Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
-Warning: array_intersect(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iterator 12 --Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--- Iterator 19 --
-Warning: array_intersect(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iterator 13 --Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
-Warning: array_intersect(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iterator 14 --Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
--- Iterator 20 --
-Warning: array_intersect(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iterator 15 --Expected parameter 2 to be an array, bool given
+Expected parameter 2 to be an array, bool given
-Warning: array_intersect(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iterator 16 --Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--- Iterator 21 --
-Warning: array_intersect(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
+-- Iterator 17 --Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
-Warning: array_intersect(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
+-- Iterator 18 --Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--- Iterator 22 --
-Warning: array_intersect(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+-- Iterator 19 --Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
-Warning: array_intersect(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+-- Iterator 20 --Expected parameter 2 to be an array, string given
+Expected parameter 2 to be an array, string given
--- Iterator 23 --
-Warning: array_intersect(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+-- Iterator 21 --Expected parameter 2 to be an array, object given
+Expected parameter 2 to be an array, object given
-Warning: array_intersect(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+-- Iterator 22 --Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
--- Iterator 24 --
-Warning: array_intersect(): Expected parameter 2 to be an array, resource given in %s on line %d
-NULL
+-- Iterator 23 --Expected parameter 2 to be an array, null given
+Expected parameter 2 to be an array, null given
-Warning: array_intersect(): Expected parameter 2 to be an array, resource given in %s on line %d
-NULL
+-- Iterator 24 --Expected parameter 2 to be an array, resource given
+Expected parameter 2 to be an array, resource given
Done
diff --git a/ext/standard/tests/array/array_intersect_variation3.phpt b/ext/standard/tests/array/array_intersect_variation3.phpt
index e6d22405ba..de831a903e 100644
--- a/ext/standard/tests/array/array_intersect_variation3.phpt
+++ b/ext/standard/tests/array/array_intersect_variation3.phpt
@@ -70,7 +70,7 @@ $arrays = array (
array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true),
array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6),
- // array with repetative keys
+ // array with repetitive keys
/*19*/ array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3)
);
@@ -84,7 +84,7 @@ $arr2 = array (
'', null => "null", '' => 'emptys'
);
-// loop through each sub-array within $arrrays to check the behavior of array_intersect()
+// loop through each sub-array within $arrays to check the behavior of array_intersect()
$iterator = 1;
foreach($arrays as $arr1) {
echo "-- Iterator $iterator --\n";
diff --git a/ext/standard/tests/array/array_intersect_variation4.phpt b/ext/standard/tests/array/array_intersect_variation4.phpt
index e019e4ef3e..dfbfdbe2f9 100644
--- a/ext/standard/tests/array/array_intersect_variation4.phpt
+++ b/ext/standard/tests/array/array_intersect_variation4.phpt
@@ -79,11 +79,11 @@ $arrays = array (
array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true),
array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6),
- // array with repetative keys
+ // array with repetitive keys
/*19*/ array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3)
);
-// loop through each sub-array within $arrrays to check the behavior of array_intersect()
+// loop through each sub-array within $arrays to check the behavior of array_intersect()
$iterator = 1;
foreach($arrays as $arr2) {
echo "-- Iteration $iterator --\n";
diff --git a/ext/standard/tests/array/array_intersect_variation5.phpt b/ext/standard/tests/array/array_intersect_variation5.phpt
index 6626c68de2..a500498394 100644
--- a/ext/standard/tests/array/array_intersect_variation5.phpt
+++ b/ext/standard/tests/array/array_intersect_variation5.phpt
@@ -60,7 +60,7 @@ $arrays = array (
// array to be passsed to $arr2 argument
$arr2 = array(1, "float", "f4", "hello", 2.2, 'color', "string", "pen\n", 11);
-// loop through each sub-array within $arrrays to check the behavior of array_intersect()
+// loop through each sub-array within $arrays to check the behavior of array_intersect()
$iterator = 1;
foreach($arrays as $arr1) {
echo "-- Iterator $iterator --\n";
diff --git a/ext/standard/tests/array/array_intersect_variation6.phpt b/ext/standard/tests/array/array_intersect_variation6.phpt
index e605b86bd1..faa66fe1ee 100644
--- a/ext/standard/tests/array/array_intersect_variation6.phpt
+++ b/ext/standard/tests/array/array_intersect_variation6.phpt
@@ -60,7 +60,7 @@ $arrays = array (
// array to be passsed to $arr1 argument
$arr1 = array(1, "float", "f4", "hello", 2.2, 'color', "string", "pen\n", 11);
-// loop through each sub-array within $arrrays to check the behavior of array_intersect()
+// loop through each sub-array within $arrays to check the behavior of array_intersect()
$iterator = 1;
foreach($arrays as $arr2) {
echo "-- Iterator $iterator --\n";
diff --git a/ext/standard/tests/array/array_intersect_variation7.phpt b/ext/standard/tests/array/array_intersect_variation7.phpt
index 4da1b9b7ac..818bc1daf9 100644
--- a/ext/standard/tests/array/array_intersect_variation7.phpt
+++ b/ext/standard/tests/array/array_intersect_variation7.phpt
@@ -68,7 +68,7 @@ $arrays = array (
$arr2 = array(1, 2, 1.2, 2.3333, "col\tor", '\v\fworld', $fp,
"Hello world", $heredoc, new classA(), 444.432, "fruit");
-// loop through each sub-array within $arrrays to check the behavior of array_intersect()
+// loop through each sub-array within $arrays to check the behavior of array_intersect()
$iterator = 1;
foreach($arrays as $arr1) {
echo "-- Iterator $iterator --\n";
diff --git a/ext/standard/tests/array/array_intersect_variation8.phpt b/ext/standard/tests/array/array_intersect_variation8.phpt
index 2934fe09a4..6144cfde29 100644
--- a/ext/standard/tests/array/array_intersect_variation8.phpt
+++ b/ext/standard/tests/array/array_intersect_variation8.phpt
@@ -68,7 +68,7 @@ $arrays = array (
$arr1 = array(1, 2, 1.2, 2.3333, "col\tor", '\v\fworld', $fp,
"Hello world", $heredoc, new classA(), 444.432, "fruit");
-// loop through each sub-array within $arrrays to check the behavior of array_intersect()
+// loop through each sub-array within $arrays to check the behavior of array_intersect()
$iterator = 1;
foreach($arrays as $arr2) {
echo "-- Iterator $iterator --\n";
diff --git a/ext/standard/tests/array/array_intersect_variation9.phpt b/ext/standard/tests/array/array_intersect_variation9.phpt
index 6c7c956ea7..d66d9c682b 100644
--- a/ext/standard/tests/array/array_intersect_variation9.phpt
+++ b/ext/standard/tests/array/array_intersect_variation9.phpt
@@ -61,37 +61,37 @@ echo "Done";
-- Passing the entire 2-D array to $arr1 and $arr2 --
- With default arguments -
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
array(4) {
[0]=>
array(4) {
@@ -136,53 +136,53 @@ array(4) {
}
- With more arguments -
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_intersect_variation9.php on line %d
+Warning: Array to string conversion in %s on line %d
array(4) {
[0]=>
array(4) {
diff --git a/ext/standard/tests/array/array_key_exists.phpt b/ext/standard/tests/array/array_key_exists.phpt
index 78a144f829..a436e7363e 100644
--- a/ext/standard/tests/array/array_key_exists.phpt
+++ b/ext/standard/tests/array/array_key_exists.phpt
@@ -69,53 +69,26 @@ foreach ($search_arrays_v as $search_array) {
}
echo "\n*** Testing error conditions ***\n";
-//Zeor args
-var_dump( array_key_exists() );
// first args as array
-var_dump( array_key_exists(array(), array()) );
-// second args as string
-var_dump( array_key_exists("", "") );
-// second args a integer
-var_dump( array_key_exists(1, 1) );
-// second args as NULL
-var_dump( array_key_exists(1, NULL) );
-// second args as boolean
-var_dump( array_key_exists(1, true) );
-// first args as boolean
-var_dump( array_key_exists(false, true) );
-// second args as float
-var_dump( array_key_exists(false, 17.5) );
-// args more than expected
-var_dump( array_key_exists(1, array(), array()) );
-// first argument as floating point value
-var_dump( array_key_exists(17.5, array(1,23) ) ) ;
+try {
+ array_key_exists(array(), array());
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
echo "\n*** Testing operation on objects ***\n";
class key_check
{
- private $private_var = "Priviate var";
- protected $protected_var = "Protected var";
- public $public_var = "Public var";
- public $arr = array("var" => "value", "1" => "one", ""=>"value");
- public function print_member()
- {
- echo $this->$private_var."\n";
- echo $this->$protected_var."\n";
- echo $this->$public_var."\n";
- }
+ public $public_var = "Public var";
}
$key_check_obj = new key_check; //new object
-/* array_key_exists() on an object, it should work on only public member variables */
-var_dump(array_key_exists("private_var", $key_check_obj)); // not found, private member
-var_dump(array_key_exists("protected_var", $key_check_obj)); // not found, private member
-var_dump(array_key_exists("public_var", $key_check_obj)); // found, public member
-var_dump(array_key_exists("print_member", $key_check_obj)); // not found, its a function
-var_dump(array_key_exists("arr", $key_check_obj)); //found, public member
-var_dump(array_key_exists("var", $key_check_obj->arr)); //found, key is in member array
+try {
+ var_dump(array_key_exists("public_var", $key_check_obj));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
-/* error condition, first argument as object */
-var_dump( array_key_exists($key_check_obj, $key_check_obj) );
echo "Done\n";
?>
--EXPECTF--
@@ -248,57 +221,8 @@ bool(false)
bool(true)
*** Testing error conditions ***
-
-Warning: array_key_exists() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
-bool(false)
-
-Warning: array_key_exists() expects parameter 2 to be array, string given in %s on line %d
-NULL
-
-Warning: array_key_exists() expects parameter 2 to be array, int given in %s on line %d
-NULL
-
-Warning: array_key_exists() expects parameter 2 to be array, null given in %s on line %d
-NULL
-
-Warning: array_key_exists() expects parameter 2 to be array, bool given in %s on line %d
-NULL
-
-Warning: array_key_exists() expects parameter 2 to be array, bool given in %s on line %d
-NULL
-
-Warning: array_key_exists() expects parameter 2 to be array, float given in %s on line %d
-NULL
-
-Warning: array_key_exists() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
-bool(false)
+Illegal offset type
*** Testing operation on objects ***
-
-Deprecated: array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead in %s on line %d
-bool(false)
-
-Deprecated: array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead in %s on line %d
-bool(false)
-
-Deprecated: array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead in %s on line %d
-bool(true)
-
-Deprecated: array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead in %s on line %d
-bool(false)
-
-Deprecated: array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead in %s on line %d
-bool(true)
-bool(true)
-
-Deprecated: array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead in %s on line %d
-
-Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
-bool(false)
+array_key_exists() expects parameter 2 to be array, object given
Done
diff --git a/ext/standard/tests/array/array_key_exists_object1.phpt b/ext/standard/tests/array/array_key_exists_object1.phpt
deleted file mode 100644
index 5386bd624c..0000000000
--- a/ext/standard/tests/array/array_key_exists_object1.phpt
+++ /dev/null
@@ -1,85 +0,0 @@
---TEST--
-Test array_key_exists() function : object functionality
---FILE--
-<?php
-/* Prototype : bool array_key_exists(mixed $key, array $search)
- * Description: Checks if the given key or index exists in the array
- * Source code: ext/standard/array.c
- * Alias to functions: key_exists
- */
-
-/*
- * Test basic functionality of array_key_exists() with objects
- */
-
-echo "*** Testing array_key_exists() : object functionality ***\n";
-
-class myClass {
- var $var1;
- var $var2;
- var $var3;
-
- function __construct($a, $b, $c = null) {
- $this->var1 = $a;
- $this->var2 = $b;
- if (!is_null($c)) {
- $this->var3 = $c;
- }
- }
-}
-
-echo "\n-- Do not assign a value to \$class1->var3 --\n";
-$class1 = new myClass ('a', 'b');
-echo "\$key = var1:\n";
-var_dump(array_key_exists('var1', $class1));
-echo "\$key = var3:\n";
-var_dump(array_key_exists('var3', $class1));
-echo "\$class1:\n";
-var_dump($class1);
-
-echo "\n-- Assign a value to \$class2->var3 --\n";
-$class2 = new myClass('x', 'y', 'z');
-echo "\$key = var3:\n";
-var_dump(array_key_exists('var3', $class2));
-echo "\$class2:\n";
-var_dump($class2);
-
-echo "Done";
-?>
---EXPECTF--
-*** Testing array_key_exists() : object functionality ***
-
--- Do not assign a value to $class1->var3 --
-$key = var1:
-
-Deprecated: array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead in %s on line %d
-bool(true)
-$key = var3:
-
-Deprecated: array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead in %s on line %d
-bool(true)
-$class1:
-object(myClass)#1 (3) {
- ["var1"]=>
- string(1) "a"
- ["var2"]=>
- string(1) "b"
- ["var3"]=>
- NULL
-}
-
--- Assign a value to $class2->var3 --
-$key = var3:
-
-Deprecated: array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead in %s on line %d
-bool(true)
-$class2:
-object(myClass)#2 (3) {
- ["var1"]=>
- string(1) "x"
- ["var2"]=>
- string(1) "y"
- ["var3"]=>
- string(1) "z"
-}
-Done
diff --git a/ext/standard/tests/array/array_key_exists_object2.phpt b/ext/standard/tests/array/array_key_exists_object2.phpt
deleted file mode 100644
index b550f71a79..0000000000
--- a/ext/standard/tests/array/array_key_exists_object2.phpt
+++ /dev/null
@@ -1,91 +0,0 @@
---TEST--
-Test array_key_exists() function : object functionality - different visibilities
---FILE--
-<?php
-/* Prototype : bool array_key_exists(mixed $key, array $search)
- * Description: Checks if the given key or index exists in the array
- * Source code: ext/standard/array.c
- * Alias to functions: key_exists
- */
-
-/*
- * Pass array_key_exists() an object with private and protected properties
- */
-
-echo "*** Testing array_key_exists() : object functionality ***\n";
-
-class myClass {
- public $var1;
- protected $var2;
- private $var3;
-
- function __construct($a, $b, $c = null) {
- $this->var1 = $a;
- $this->var2 = $b;
- if (!is_null($c)) {
- $this->var3 = $c;
- }
- }
-}
-
-echo "\n-- Do not assign a value to \$class1->var3 --\n";
-$class1 = new myClass ('a', 'b');
-echo "\$key = var1:\n";
-var_dump(array_key_exists('var1', $class1));
-echo "\$key = var2:\n";
-var_dump(array_key_exists('var2', $class1));
-echo "\$key = var3:\n";
-var_dump(array_key_exists('var3', $class1));
-echo "\$class1:\n";
-var_dump($class1);
-
-echo "\n-- Assign a value to \$class2->var3 --\n";
-$class2 = new myClass('x', 'y', 'z');
-echo "\$key = var3:\n";
-var_dump(array_key_exists('var3', $class2));
-echo "\$class2:\n";
-var_dump($class2);
-
-echo "Done";
-?>
---EXPECTF--
-*** Testing array_key_exists() : object functionality ***
-
--- Do not assign a value to $class1->var3 --
-$key = var1:
-
-Deprecated: array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead in %s on line %d
-bool(true)
-$key = var2:
-
-Deprecated: array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead in %s on line %d
-bool(false)
-$key = var3:
-
-Deprecated: array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead in %s on line %d
-bool(false)
-$class1:
-object(myClass)#1 (3) {
- ["var1"]=>
- string(1) "a"
- ["var2":protected]=>
- string(1) "b"
- ["var3":"myClass":private]=>
- NULL
-}
-
--- Assign a value to $class2->var3 --
-$key = var3:
-
-Deprecated: array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead in %s on line %d
-bool(false)
-$class2:
-object(myClass)#2 (3) {
- ["var1"]=>
- string(1) "x"
- ["var2":protected]=>
- string(1) "y"
- ["var3":"myClass":private]=>
- string(1) "z"
-}
-Done
diff --git a/ext/standard/tests/array/array_key_exists_variation1.phpt b/ext/standard/tests/array/array_key_exists_variation1.phpt
index c6e8ba7806..2f25dbadee 100644
--- a/ext/standard/tests/array/array_key_exists_variation1.phpt
+++ b/ext/standard/tests/array/array_key_exists_variation1.phpt
@@ -15,7 +15,7 @@ Test array_key_exists() function : usage variations - Pass different data types
echo "*** Testing array_key_exists() : usage variations ***\n";
// Initialise function arguments not being substituted
-$search = array ('zero', 'key' => 'val', 'two');
+$search = array ('zero', 'key' => 'val', 'two', 10 => 'value');
//get an unset variable
$unset_var = 10;
@@ -90,7 +90,11 @@ $inputs = array(
$iterator = 1;
foreach($inputs as $input) {
echo "\n-- Iteration $iterator --\n";
- var_dump( array_key_exists($input, $search) );
+ try {
+ var_dump( array_key_exists($input, $search) );
+ } catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
$iterator++;
};
@@ -114,29 +118,19 @@ bool(false)
bool(false)
-- Iteration 5 --
-
-Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
-bool(false)
+bool(true)
-- Iteration 6 --
-
-Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
bool(false)
-- Iteration 7 --
-
-Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
bool(false)
-- Iteration 8 --
-
-Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
-bool(false)
+bool(true)
-- Iteration 9 --
-
-Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
-bool(false)
+bool(true)
-- Iteration 10 --
bool(false)
@@ -145,24 +139,16 @@ bool(false)
bool(false)
-- Iteration 12 --
-
-Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
-bool(false)
+bool(true)
-- Iteration 13 --
-
-Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
-bool(false)
+bool(true)
-- Iteration 14 --
-
-Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
-bool(false)
+bool(true)
-- Iteration 15 --
-
-Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
-bool(false)
+bool(true)
-- Iteration 16 --
bool(false)
@@ -171,9 +157,7 @@ bool(false)
bool(false)
-- Iteration 18 --
-
-Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
-bool(false)
+Illegal offset type
-- Iteration 19 --
bool(true)
@@ -185,9 +169,7 @@ bool(true)
bool(true)
-- Iteration 22 --
-
-Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
-bool(false)
+Illegal offset type
-- Iteration 23 --
bool(false)
@@ -197,6 +179,6 @@ bool(false)
-- Iteration 25 --
-Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
+Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
bool(false)
Done
diff --git a/ext/standard/tests/array/array_key_exists_variation3.phpt b/ext/standard/tests/array/array_key_exists_variation3.phpt
index 867b4d9848..4a6409bb1f 100644
--- a/ext/standard/tests/array/array_key_exists_variation3.phpt
+++ b/ext/standard/tests/array/array_key_exists_variation3.phpt
@@ -21,11 +21,15 @@ $search = array ('zero', 'one', 'two');
$iterator = 1;
foreach($keys as $key) {
- echo "\n-- Iteration $iterator --\n";
- echo "Pass float as \$key:\n";
- var_dump(array_key_exists($key, $search));
- echo "Cast float to int:\n";
- var_dump(array_key_exists((int)$key, $search));
+ echo "\n-- Iteration $iterator --\n";
+ echo "Pass float as \$key:\n";
+ try {
+ var_dump(array_key_exists($key, $search));
+ } catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+ echo "Cast float to int:\n";
+ var_dump(array_key_exists((int)$key, $search));
}
echo "Done";
@@ -35,25 +39,19 @@ echo "Done";
-- Iteration 1 --
Pass float as $key:
-
-Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
-bool(false)
+bool(true)
Cast float to int:
bool(true)
-- Iteration 1 --
Pass float as $key:
-
-Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
-bool(false)
+bool(true)
Cast float to int:
bool(true)
-- Iteration 1 --
Pass float as $key:
-
-Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
-bool(false)
+bool(true)
Cast float to int:
bool(true)
Done
diff --git a/ext/standard/tests/array/array_key_exists_variation6.phpt b/ext/standard/tests/array/array_key_exists_variation6.phpt
index a801acdd34..fb81d3277a 100644
--- a/ext/standard/tests/array/array_key_exists_variation6.phpt
+++ b/ext/standard/tests/array/array_key_exists_variation6.phpt
@@ -27,17 +27,17 @@ $array = array ('null' => null,
//iterate through original array
foreach($array as $name => $input) {
- $iterator = 1;
- echo "\n-- Key in \$search array is : $name --\n";
- $search[$input] = 'test';
+ $iterator = 1;
+ echo "\n-- Key in \$search array is : $name --\n";
+ $search[$input] = 'test';
- //iterate through array again to see which values are considered equal
- foreach($array as $key) {
- echo "Iteration $iterator: ";
- var_dump(array_key_exists($key, $search));
- $iterator++;
- }
- $search = null;
+ //iterate through array again to see which values are considered equal
+ foreach($array as $key) {
+ echo "Iteration $iterator: ";
+ var_dump(array_key_exists($key, $search));
+ $iterator++;
+ }
+ $search = null;
}
echo "Done";
diff --git a/ext/standard/tests/array/array_key_exists_variation8.phpt b/ext/standard/tests/array/array_key_exists_variation8.phpt
index 1d98b0eefb..a52a9acdaa 100644
--- a/ext/standard/tests/array/array_key_exists_variation8.phpt
+++ b/ext/standard/tests/array/array_key_exists_variation8.phpt
@@ -95,16 +95,16 @@ $inputs = array(
// loop through each element of $inputs to check the behavior of array_key_exists()
$iterator = 1;
foreach($inputs as $type => $input) {
- echo "\n-- Iteration $iterator: $type data --\n";
+ echo "\n-- Iteration $iterator: $type data --\n";
- //iterate over again to get all different key values
- foreach ($inputs as $new_type => $new_input) {
- echo "-- \$key arguments are $new_type data:\n";
- foreach ($new_input as $key => $search) {
- var_dump(array_key_exists($key, $input));
- }
- }
- $iterator++;
+ //iterate over again to get all different key values
+ foreach ($inputs as $new_type => $new_input) {
+ echo "-- \$key arguments are $new_type data:\n";
+ foreach ($new_input as $key => $search) {
+ var_dump(array_key_exists($key, $input));
+ }
+ }
+ $iterator++;
};
echo "Done";
diff --git a/ext/standard/tests/array/array_keys_error.phpt b/ext/standard/tests/array/array_keys_error.phpt
deleted file mode 100644
index 46a989b839..0000000000
--- a/ext/standard/tests/array/array_keys_error.phpt
+++ /dev/null
@@ -1,42 +0,0 @@
---TEST--
-Test array_keys() function (error conditions)
---FILE--
-<?php
-
-echo "\n*** Testing error conditions ***";
-var_dump(array_keys(100));
-var_dump(array_keys("string"));
-var_dump(array_keys(new stdclass)); // object
-var_dump(array_keys()); // Zero arguments
-var_dump(array_keys(array(), "", TRUE, 100)); // args > expected
-var_dump(array_keys(array(1,2,3, new stdClass => array()))); // (W)illegal offset
-
-echo "Done\n";
-?>
---EXPECTF--
-*** Testing error conditions ***
-Warning: array_keys() expects parameter 1 to be array, int given in %s on line %d
-NULL
-
-Warning: array_keys() expects parameter 1 to be array, string given in %s on line %d
-NULL
-
-Warning: array_keys() expects parameter 1 to be array, object given in %s on line %d
-NULL
-
-Warning: array_keys() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: array_keys() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-
-Warning: Illegal offset type in %s on line %d
-array(3) {
- [0]=>
- int(0)
- [1]=>
- int(1)
- [2]=>
- int(2)
-}
-Done
diff --git a/ext/standard/tests/array/array_keys_variation_003.phpt b/ext/standard/tests/array/array_keys_variation_003.phpt
index adb2baea66..3163820de0 100644
--- a/ext/standard/tests/array/array_keys_variation_003.phpt
+++ b/ext/standard/tests/array/array_keys_variation_003.phpt
@@ -20,8 +20,8 @@ $types_arr = array(
);
$values = array(TRUE, FALSE, 1, 0, -1, "1", "0", "-1", NULL, array(), "php", "");
foreach ($values as $value){
- var_dump($value);
- var_dump(array_keys($types_arr, $value));
+ var_dump($value);
+ var_dump(array_keys($types_arr, $value));
}
echo "Done\n";
diff --git a/ext/standard/tests/array/array_map_001.phpt b/ext/standard/tests/array/array_map_001.phpt
index c5d78c257e..ffa56c1309 100644
--- a/ext/standard/tests/array/array_map_001.phpt
+++ b/ext/standard/tests/array/array_map_001.phpt
@@ -6,13 +6,13 @@ array_map() and exceptions in the callback
$a = array(1,2,3);
function foo() {
- throw new exception(1);
+ throw new exception(1);
}
try {
- array_map("foo", $a, array(2,3));
+ array_map("foo", $a, array(2,3));
} catch (Exception $e) {
- var_dump("exception caught!");
+ var_dump("exception caught!");
}
echo "Done\n";
diff --git a/ext/standard/tests/array/array_map_error.phpt b/ext/standard/tests/array/array_map_error.phpt
index 56dd033521..4739bbf663 100644
--- a/ext/standard/tests/array/array_map_error.phpt
+++ b/ext/standard/tests/array/array_map_error.phpt
@@ -9,19 +9,15 @@ Test array_map() function : error conditions
echo "*** Testing array_map() : error conditions ***\n";
-// Zero arguments
-echo "\n-- Testing array_map() function with Zero arguments --\n";
-var_dump( array_map() );
-
// Testing array_map with one less than the expected number of arguments
echo "\n-- Testing array_map() function with one less than expected no. of arguments --\n";
function callback1() {
return 1;
}
try {
- var_dump( array_map('callback1') );
+ var_dump( array_map('callback1') );
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
echo "\n-- Testing array_map() function with less no. of arrays than callback function arguments --\n";
@@ -30,9 +26,9 @@ function callback2($p, $q) {
return $p * $q;
}
try {
- var_dump( array_map('callback2', $arr1) );
+ var_dump( array_map('callback2', $arr1) );
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
echo "\n-- Testing array_map() function with more no. of arrays than callback function arguments --\n";
@@ -45,15 +41,8 @@ echo "Done";
--EXPECTF--
*** Testing array_map() : error conditions ***
--- Testing array_map() function with Zero arguments --
-
-Warning: array_map() expects at least 2 parameters, 0 given in %s on line %d%d
-NULL
-
-- Testing array_map() function with one less than expected no. of arguments --
-
-Warning: array_map() expects at least 2 parameters, 1 given in %s on line %d%d
-NULL
+Exception: array_map() expects at least 2 parameters, 1 given
-- Testing array_map() function with less no. of arrays than callback function arguments --
Exception: Too few arguments to function callback2(), 1 passed and exactly 2 expected
diff --git a/ext/standard/tests/array/array_map_object1.phpt b/ext/standard/tests/array/array_map_object1.phpt
index b808381048..c95395e04d 100644
--- a/ext/standard/tests/array/array_map_object1.phpt
+++ b/ext/standard/tests/array/array_map_object1.phpt
@@ -22,13 +22,17 @@ echo "-- simple class with public variable and method --\n";
class SimpleClass
{
public $var1 = 1;
- public function square($n) {
+ public static function square($n) {
return $n * $n;
}
}
function test($cb, $args) {
echo join('::', $cb) . "\n";
- var_dump(array_map($cb, $args));
+ try {
+ var_dump(array_map($cb, $args));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
}
test(array('SimpleClass', 'square'), array(1, 2));
@@ -36,7 +40,7 @@ echo "\n-- simple class with private variable and method --\n";
class SimpleClassPri
{
private $var1 = 10;
- private function add($n) {
+ private static function add($n) {
return $var + $n;
}
}
@@ -46,7 +50,7 @@ echo "\n-- simple class with protected variable and method --\n";
class SimpleClassPro
{
protected $var1 = 5;
- protected function mul($n) {
+ protected static function mul($n) {
return $var1 * $n;
}
}
@@ -62,14 +66,14 @@ echo "\n-- abstract class --\n";
abstract class AbstractClass
{
protected $var2 = 5;
- abstract function emptyFunction();
+ abstract static function emptyFunction();
}
// class deriving the above abstract class
class ChildClass extends AbstractClass
{
private $var3;
- public function emptyFunction() {
+ public static function emptyFunction() {
echo "defined in child\n";
}
}
@@ -79,7 +83,7 @@ echo "\n-- class with final method --\n";
class FinalClass
{
private $var4;
- final function finalMethod() {
+ final static function finalMethod() {
echo "This function can't be overloaded\n";
}
}
@@ -120,14 +124,10 @@ class InterClass implements myInterface
test(array('InterClass', 'square'), array(1, 2));
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
*** Testing array_map() : object functionality ***
-- simple class with public variable and method --
SimpleClass::square
-
-Deprecated: array_map() expects parameter 1 to be a valid callback, non-static method SimpleClass::square() should not be called statically in %sarray_map_object1.php on line %d
array(2) {
[0]=>
int(1)
@@ -137,26 +137,18 @@ array(2) {
-- simple class with private variable and method --
SimpleClassPri::add
-
-Warning: array_map() expects parameter 1 to be a valid callback, cannot access private method SimpleClassPri::add() in %sarray_map_object1.php on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, cannot access private method SimpleClassPri::add()
-- simple class with protected variable and method --
SimpleClassPro::mul
-
-Warning: array_map() expects parameter 1 to be a valid callback, cannot access protected method SimpleClassPro::mul() in %sarray_map_object1.php on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, cannot access protected method SimpleClassPro::mul()
-- class without members --
EmptyClass
-
-Warning: array_map() expects parameter 1 to be a valid callback, array must have exactly two members in %sarray_map_object1.php on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, array must have exactly two members
-- abstract class --
ChildClass::emptyFunction
-
-Deprecated: array_map() expects parameter 1 to be a valid callback, non-static method ChildClass::emptyFunction() should not be called statically in %sarray_map_object1.php on line %d
defined in child
defined in child
array(2) {
@@ -168,8 +160,6 @@ array(2) {
-- class with final method --
FinalClass::finalMethod
-
-Deprecated: array_map() expects parameter 1 to be a valid callback, non-static method FinalClass::finalMethod() should not be called statically in %sarray_map_object1.php on line %d
This function can't be overloaded
This function can't be overloaded
array(2) {
@@ -188,13 +178,9 @@ array(2) {
int(4)
}
StaticClass::cube
-
-Warning: array_map() expects parameter 1 to be a valid callback, cannot access private method StaticClass::cube() in %sarray_map_object1.php on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, cannot access private method StaticClass::cube()
StaticClass::retVal
-
-Warning: array_map() expects parameter 1 to be a valid callback, cannot access protected method StaticClass::retVal() in %sarray_map_object1.php on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, cannot access protected method StaticClass::retVal()
-- class implementing an interface --
InterClass::square
array(2) {
@@ -203,4 +189,3 @@ array(2) {
[1]=>
int(4)
}
-===DONE===
diff --git a/ext/standard/tests/array/array_map_object2.phpt b/ext/standard/tests/array/array_map_object2.phpt
index 7cfb528bf2..e5218ccbe4 100644
--- a/ext/standard/tests/array/array_map_object2.phpt
+++ b/ext/standard/tests/array/array_map_object2.phpt
@@ -26,21 +26,25 @@ class SimpleClass
}
echo "-- with non-existent class --\n";
-var_dump( array_map(array('non-existent', 'square'), array(1, 2)) );
+try {
+ var_dump( array_map(array('non-existent', 'square'), array(1, 2)) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "-- with existent class and non-existent method --\n";
-var_dump( array_map(array('SimpleClass', 'non-existent'), array(1, 2)) );
+try {
+ var_dump( array_map(array('SimpleClass', 'non-existent'), array(1, 2)) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done";
?>
--EXPECTF--
*** Testing array_map() : with non-existent class and method ***
-- with non-existent class --
-
-Warning: array_map() expects parameter 1 to be a valid callback, class 'non-existent' not found in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, class 'non-existent' not found
-- with existent class and non-existent method --
-
-Warning: array_map() expects parameter 1 to be a valid callback, class 'SimpleClass' does not have a method 'non-existent' in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, class 'SimpleClass' does not have a method 'non-existent'
Done
diff --git a/ext/standard/tests/array/array_map_object3.phpt b/ext/standard/tests/array/array_map_object3.phpt
index 114d1d3134..2f1536df5c 100644
--- a/ext/standard/tests/array/array_map_object3.phpt
+++ b/ext/standard/tests/array/array_map_object3.phpt
@@ -51,13 +51,21 @@ echo "-- accessing parent method from child class --\n";
var_dump( array_map(array('ChildClass', 'staticParent1'), $arr1) );
echo "-- accessing child method from parent class --\n";
-var_dump( array_map(array('ParentClass', 'staticChild'), $arr1) );
+try {
+ var_dump( array_map(array('ParentClass', 'staticChild'), $arr1) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "-- accessing parent method using child class object --\n";
var_dump( array_map(array($childobj, 'staticParent1'), $arr1) );
echo "-- accessing child method using parent class object --\n";
-var_dump( array_map(array($parentobj, 'staticChild'), $arr1) );
+try {
+ var_dump( array_map(array($parentobj, 'staticChild'), $arr1) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done";
?>
@@ -73,9 +81,7 @@ array(3) {
int(7)
}
-- accessing child method from parent class --
-
-Warning: array_map() expects parameter 1 to be a valid callback, class 'ParentClass' does not have a method 'staticChild' in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, class 'ParentClass' does not have a method 'staticChild'
-- accessing parent method using child class object --
array(3) {
[0]=>
@@ -86,7 +92,5 @@ array(3) {
int(7)
}
-- accessing child method using parent class object --
-
-Warning: array_map() expects parameter 1 to be a valid callback, class 'ParentClass' does not have a method 'staticChild' in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, class 'ParentClass' does not have a method 'staticChild'
Done
diff --git a/ext/standard/tests/array/array_map_variation10.phpt b/ext/standard/tests/array/array_map_variation10.phpt
index 5b80126966..d5324f3e28 100644
--- a/ext/standard/tests/array/array_map_variation10.phpt
+++ b/ext/standard/tests/array/array_map_variation10.phpt
@@ -8,7 +8,7 @@ Test array_map() function : usage variations - anonymous callback function
*/
/*
- * Test array_map() by passing anoymous callback function with following variations
+ * Test array_map() by passing anonymous callback function with following variations
*/
echo "*** Testing array_map() : anonymous callback function ***\n";
@@ -21,9 +21,9 @@ var_dump( array_map( function($a, $b) { return array($a, $b); }, $array1, $array
echo "-- anonymous function with two parameters and passing one array --\n";
try {
- var_dump( array_map( function($a, $b) { return array($a, $b); }, $array1));
+ var_dump( array_map( function($a, $b) { return array($a, $b); }, $array1));
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
echo "-- anonymous function with NULL parameter --\n";
@@ -33,11 +33,15 @@ echo "-- anonymous function with NULL body --\n";
var_dump( array_map( function($a) { }, $array1));
echo "-- passing NULL as 'arr1' --\n";
-var_dump( array_map( function($a) { return array($a); }, NULL));
+try {
+ var_dump( array_map( function($a) { return array($a); }, NULL));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing array_map() : anonymous callback function ***
-- anonymous function with all parameters and body --
array(3) {
@@ -84,7 +88,5 @@ array(3) {
NULL
}
-- passing NULL as 'arr1' --
-
-Warning: array_map(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
Done
diff --git a/ext/standard/tests/array/array_map_variation12.phpt b/ext/standard/tests/array/array_map_variation12.phpt
index b258c2d31b..67abde0108 100644
--- a/ext/standard/tests/array/array_map_variation12.phpt
+++ b/ext/standard/tests/array/array_map_variation12.phpt
@@ -20,10 +20,18 @@ echo "-- with built-in function 'pow' and two parameters --\n";
var_dump( array_map('pow', $array1, $array2));
echo "-- with built-in function 'pow' and one parameter --\n";
-var_dump( array_map('pow', $array1));
+try {
+ var_dump( array_map('pow', $array1));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "-- with language construct --\n";
-var_dump( array_map('echo', $array1));
+try {
+ var_dump( array_map('echo', $array1));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done";
?>
@@ -39,22 +47,7 @@ array(3) {
int(243)
}
-- with built-in function 'pow' and one parameter --
-
-Warning: pow() expects exactly 2 parameters, 1 given in %s on line %d
-
-Warning: pow() expects exactly 2 parameters, 1 given in %s on line %d
-
-Warning: pow() expects exactly 2 parameters, 1 given in %s on line %d
-array(3) {
- [0]=>
- NULL
- [1]=>
- NULL
- [2]=>
- NULL
-}
+pow() expects exactly 2 parameters, 1 given
-- with language construct --
-
-Warning: array_map() expects parameter 1 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, function 'echo' not found or invalid function name
Done
diff --git a/ext/standard/tests/array/array_map_variation14.phpt b/ext/standard/tests/array/array_map_variation14.phpt
index 771d3f949e..2764cb7374 100644
--- a/ext/standard/tests/array/array_map_variation14.phpt
+++ b/ext/standard/tests/array/array_map_variation14.phpt
@@ -36,10 +36,18 @@ echo "-- with undefined variable --\n";
var_dump( array_map(@$undefined_var, $arr1) );
echo "-- with empty string --\n";
-var_dump( array_map("", $arr1, $arr2) );
+try {
+ var_dump( array_map("", $arr1, $arr2) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "-- with empty array --\n";
-var_dump( array_map(array(), $arr1, $arr2) );
+try {
+ var_dump( array_map(array(), $arr1, $arr2) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done";
?>
@@ -115,11 +123,7 @@ array(2) {
int(2)
}
-- with empty string --
-
-Warning: array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name
-- with empty array --
-
-Warning: array_map() expects parameter 1 to be a valid callback, array must have exactly two members in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, array must have exactly two members
Done
diff --git a/ext/standard/tests/array/array_map_variation15.phpt b/ext/standard/tests/array/array_map_variation15.phpt
index b29af47713..f36d55bd5f 100644
--- a/ext/standard/tests/array/array_map_variation15.phpt
+++ b/ext/standard/tests/array/array_map_variation15.phpt
@@ -18,13 +18,15 @@ $arr1 = array(1, 2);
$arr2 = array("one", "two");
$arr3 = array(1.1, 2.2);
-var_dump( array_map('non_existent', $arr1, $arr2, $arr3) );
+try {
+ var_dump( array_map('non_existent', $arr1, $arr2, $arr3) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing array_map() : non existent 'callback' function ***
-
-Warning: array_map() expects parameter 1 to be a valid callback, function 'non_existent' not found or invalid function name in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, function 'non_existent' not found or invalid function name
Done
diff --git a/ext/standard/tests/array/array_map_variation16.phpt b/ext/standard/tests/array/array_map_variation16.phpt
index c4987cb385..0c80337c76 100644
--- a/ext/standard/tests/array/array_map_variation16.phpt
+++ b/ext/standard/tests/array/array_map_variation16.phpt
@@ -30,8 +30,12 @@ $callback_names = array(
);
for($count = 0; $count < count($callback_names); $count++)
{
- echo "-- Iteration ".($count + 1)." --\n";
- var_dump( array_map($callback_names[$count], $arr1) );
+ echo "-- Iteration ".($count + 1)." --\n";
+ try {
+ var_dump( array_map($callback_names[$count], $arr1) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
}
echo "Done";
@@ -39,35 +43,19 @@ echo "Done";
--EXPECTF--
*** Testing array_map() : non-permmited built-in functions ***
-- Iteration 1 --
-
-Warning: array_map() expects parameter 1 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, function 'echo' not found or invalid function name
-- Iteration 2 --
-
-Warning: array_map() expects parameter 1 to be a valid callback, function 'array' not found or invalid function name in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, function 'array' not found or invalid function name
-- Iteration 3 --
-
-Warning: array_map() expects parameter 1 to be a valid callback, function 'empty' not found or invalid function name in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, function 'empty' not found or invalid function name
-- Iteration 4 --
-
-Warning: array_map() expects parameter 1 to be a valid callback, function 'eval' not found or invalid function name in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, function 'eval' not found or invalid function name
-- Iteration 5 --
-
-Warning: array_map() expects parameter 1 to be a valid callback, function 'exit' not found or invalid function name in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, function 'exit' not found or invalid function name
-- Iteration 6 --
-
-Warning: array_map() expects parameter 1 to be a valid callback, function 'isset' not found or invalid function name in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, function 'isset' not found or invalid function name
-- Iteration 7 --
-
-Warning: array_map() expects parameter 1 to be a valid callback, function 'list' not found or invalid function name in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, function 'list' not found or invalid function name
-- Iteration 8 --
-
-Warning: array_map() expects parameter 1 to be a valid callback, function 'print' not found or invalid function name in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, function 'print' not found or invalid function name
Done
diff --git a/ext/standard/tests/array/array_map_variation17.phpt b/ext/standard/tests/array/array_map_variation17.phpt
index 1cfbdd7beb..4558dc999f 100644
--- a/ext/standard/tests/array/array_map_variation17.phpt
+++ b/ext/standard/tests/array/array_map_variation17.phpt
@@ -66,93 +66,77 @@ $unexpected_callbacks = array(
// loop through each element of $inputs to check the behavior of array_map
for($count = 0; $count < count($unexpected_callbacks); $count++) {
- echo "\n-- Iteration ".($count + 1)." --";
- var_dump( array_map($unexpected_callbacks[$count], $arr1));
+ echo "\n-- Iteration ".($count + 1)." --\n";
+ try {
+ var_dump( array_map($unexpected_callbacks[$count], $arr1));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
fclose($fp);
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing array_map() : unexpected values for 'callback' argument ***
-- Iteration 1 --
-Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, no array or string given
-- Iteration 2 --
-Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, no array or string given
-- Iteration 3 --
-Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, no array or string given
-- Iteration 4 --
-Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, no array or string given
-- Iteration 5 --
-Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, no array or string given
-- Iteration 6 --
-Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, no array or string given
-- Iteration 7 --
-Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, no array or string given
-- Iteration 8 --
-Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, no array or string given
-- Iteration 9 --
-Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, no array or string given
-- Iteration 10 --
-Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, no array or string given
-- Iteration 11 --
-Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, no array or string given
-- Iteration 12 --
-Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, no array or string given
-- Iteration 13 --
-Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, no array or string given
-- Iteration 14 --
-Warning: array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name
-- Iteration 15 --
-Warning: array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name
-- Iteration 16 --
-Warning: array_map() expects parameter 1 to be a valid callback, array must have exactly two members in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, array must have exactly two members
-- Iteration 17 --
-Warning: array_map() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, first array member is not a valid class name or object
-- Iteration 18 --
-Warning: array_map() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, first array member is not a valid class name or object
-- Iteration 19 --
-Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, no array or string given
-- Iteration 20 --
-Warning: array_map() expects parameter 1 to be a valid callback, no array or string given in %s on line %d
-NULL
+array_map() expects parameter 1 to be a valid callback, no array or string given
Done
diff --git a/ext/standard/tests/array/array_map_variation2.phpt b/ext/standard/tests/array/array_map_variation2.phpt
index b7d22e0825..79eef00fc4 100644
--- a/ext/standard/tests/array/array_map_variation2.phpt
+++ b/ext/standard/tests/array/array_map_variation2.phpt
@@ -38,16 +38,7 @@ array(4) {
[0]=>
&string(2) "v1"
[1]=>
- &array(4) {
- ["k1"]=>
- &string(2) "v1"
- ["k2"]=>
- string(2) "v2"
- [0]=>
- &string(2) "v1"
- [1]=>
- *RECURSION*
- }
+ *RECURSION*
}
array(4) {
["k1"]=>
@@ -91,16 +82,7 @@ array(4) {
[0]=>
&string(2) "v1"
[1]=>
- &array(4) {
- ["k1"]=>
- &string(2) "v1"
- ["k2"]=>
- string(2) "v2"
- [0]=>
- &string(2) "v1"
- [1]=>
- *RECURSION*
- }
+ *RECURSION*
}
array(4) {
[0]=>
@@ -141,16 +123,7 @@ array(4) {
[0]=>
&string(2) "v1"
[1]=>
- &array(4) {
- ["k1"]=>
- &string(2) "v1"
- ["k2"]=>
- string(2) "v2"
- [0]=>
- &string(2) "v1"
- [1]=>
- *RECURSION*
- }
+ *RECURSION*
}
array(4) {
[0]=>
diff --git a/ext/standard/tests/array/array_map_variation3.phpt b/ext/standard/tests/array/array_map_variation3.phpt
index 3e8bfea962..c37925c05e 100644
--- a/ext/standard/tests/array/array_map_variation3.phpt
+++ b/ext/standard/tests/array/array_map_variation3.phpt
@@ -42,7 +42,7 @@ $arrays = array (
array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true),
array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6),
- // array with repetative keys
+ // array with repetitive keys
/*18*/ array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3)
);
diff --git a/ext/standard/tests/array/array_map_variation4.phpt b/ext/standard/tests/array/array_map_variation4.phpt
index e5b4c062c1..8e75b91ff4 100644
--- a/ext/standard/tests/array/array_map_variation4.phpt
+++ b/ext/standard/tests/array/array_map_variation4.phpt
@@ -58,10 +58,10 @@ $arrays = array (
array("hello", $heredoc => "string"), // heredoc
// array with object, unset variable and resource variable
- array(new classA() => 11, @$unset_var => "hello", $fp => 'resource'),
+ array(@$unset_var => "hello", $fp => 'resource'),
// array with mixed values
-/*11*/ array('hello' => 1, new classA() => 2, "fruit" => 2.2,
+/*11*/ array('hello' => 1, "fruit" => 2.2,
$fp => 'resource', 133 => "int", 444.432 => "float",
@$unset_var => "unset", $heredoc => "heredoc")
);
@@ -79,13 +79,9 @@ echo "Done";
--EXPECTF--
*** Testing array_map() : associative array with diff. keys for 'arr1' argument ***
-Warning: Illegal offset type in %s on line %d
+Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
-Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
-
-Warning: Illegal offset type in %s on line %d
-
-Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
+Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
-- Iteration 1 --
array(0) {
}
diff --git a/ext/standard/tests/array/array_map_variation9.phpt b/ext/standard/tests/array/array_map_variation9.phpt
index 9c70340b30..7089f9abc6 100644
--- a/ext/standard/tests/array/array_map_variation9.phpt
+++ b/ext/standard/tests/array/array_map_variation9.phpt
@@ -30,9 +30,9 @@ var_dump( array_map('callback1', $arr1) );
echo "-- checking binary safe array with two parameter callback function --\n";
try {
- var_dump( array_map(b"callback2", $arr1) );
+ var_dump( array_map(b"callback2", $arr1) );
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
echo "Done";
diff --git a/ext/standard/tests/array/array_merge.phpt b/ext/standard/tests/array/array_merge.phpt
index 0afc2084af..08ecbf7147 100644
--- a/ext/standard/tests/array/array_merge.phpt
+++ b/ext/standard/tests/array/array_merge.phpt
@@ -78,12 +78,6 @@ var_dump(array_merge($begin_array[6]));
echo "\n*** Testing array_merge() with typecasting non-array to array ***\n";
var_dump(array_merge($begin_array[4], (array)"type1", (array)10, (array)12.34));
-echo "\n*** Testing error conditions ***";
-/* Invalid arguments */
-var_dump(array_merge(100, 200));
-var_dump(array_merge($begin_array[0], $begin_array[1], 100));
-var_dump(array_merge($begin_array[0], $begin_array[1], $arr4));
-
echo "\n*** Testing array_merge without any arguments ***\n";
var_dump(array_merge());
@@ -747,18 +741,6 @@ array(7) {
float(12.34)
}
-*** Testing error conditions ***
-Warning: array_merge(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
-Warning: array_merge(): Expected parameter 3 to be an array, int given in %s on line %d
-NULL
-
-Notice: Undefined variable: arr4 in %s on line %d
-
-Warning: array_merge(): Expected parameter 3 to be an array, null given in %s on line %d
-NULL
-
*** Testing array_merge without any arguments ***
array(0) {
}
diff --git a/ext/standard/tests/array/array_merge_recursive_variation1.phpt b/ext/standard/tests/array/array_merge_recursive_variation1.phpt
index 071e9eadb5..3d15d56b81 100644
--- a/ext/standard/tests/array/array_merge_recursive_variation1.phpt
+++ b/ext/standard/tests/array/array_merge_recursive_variation1.phpt
@@ -88,17 +88,25 @@ $arr2 = array(1, array("hello", 'world'));
// loop through each element of $arrays and check the behavior of array_merge_recursive()
$iterator = 1;
foreach($arrays as $arr1) {
- echo "\n-- Iteration $iterator --";
-
- // with default argument
- echo "\n-- With default argument --";
- var_dump( array_merge_recursive($arr1) );
-
- // with more arguments
- echo "-- With more arguments --";
- var_dump( array_merge_recursive($arr1, $arr2) );
-
- $iterator++;
+ echo "\n-- Iteration $iterator --";
+
+ // with default argument
+ echo "\n-- With default argument --";
+ try {
+ var_dump( array_merge_recursive($arr1) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+
+ // with more arguments
+ echo "-- With more arguments --";
+ try {
+ var_dump( array_merge_recursive($arr1, $arr2) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+
+ $iterator++;
}
// close the file resource used
@@ -106,198 +114,102 @@ fclose($fp);
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing array_merge_recursive() : Passing non array values to $arr1 argument ***
-- Iteration 1 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, int given
+-- With more arguments --Expected parameter 1 to be an array, int given
-- Iteration 2 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, int given
+-- With more arguments --Expected parameter 1 to be an array, int given
-- Iteration 3 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, int given
+-- With more arguments --Expected parameter 1 to be an array, int given
-- Iteration 4 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, int given
+-- With more arguments --Expected parameter 1 to be an array, int given
-- Iteration 5 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, float given
+-- With more arguments --Expected parameter 1 to be an array, float given
-- Iteration 6 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, float given
+-- With more arguments --Expected parameter 1 to be an array, float given
-- Iteration 7 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, float given
+-- With more arguments --Expected parameter 1 to be an array, float given
-- Iteration 8 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, float given
+-- With more arguments --Expected parameter 1 to be an array, float given
-- Iteration 9 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, float given
+-- With more arguments --Expected parameter 1 to be an array, float given
-- Iteration 10 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, null given
+-- With more arguments --Expected parameter 1 to be an array, null given
-- Iteration 11 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, null given
+-- With more arguments --Expected parameter 1 to be an array, null given
-- Iteration 12 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, bool given
+-- With more arguments --Expected parameter 1 to be an array, bool given
-- Iteration 13 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, bool given
+-- With more arguments --Expected parameter 1 to be an array, bool given
-- Iteration 14 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, bool given
+-- With more arguments --Expected parameter 1 to be an array, bool given
-- Iteration 15 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, bool given
+-- With more arguments --Expected parameter 1 to be an array, bool given
-- Iteration 16 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, string given
+-- With more arguments --Expected parameter 1 to be an array, string given
-- Iteration 17 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, string given
+-- With more arguments --Expected parameter 1 to be an array, string given
-- Iteration 18 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, string given
+-- With more arguments --Expected parameter 1 to be an array, string given
-- Iteration 19 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, string given
+-- With more arguments --Expected parameter 1 to be an array, string given
-- Iteration 20 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, string given
+-- With more arguments --Expected parameter 1 to be an array, string given
-- Iteration 21 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, null given
+-- With more arguments --Expected parameter 1 to be an array, null given
-- Iteration 22 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, null given
+-- With more arguments --Expected parameter 1 to be an array, null given
-- Iteration 23 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, resource given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, resource given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, resource given
+-- With more arguments --Expected parameter 1 to be an array, resource given
-- Iteration 24 --
--- With default argument --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
--- With more arguments --
-Warning: array_merge_recursive(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
+-- With default argument --Expected parameter 1 to be an array, object given
+-- With more arguments --Expected parameter 1 to be an array, object given
Done
diff --git a/ext/standard/tests/array/array_merge_recursive_variation2.phpt b/ext/standard/tests/array/array_merge_recursive_variation2.phpt
index f14d5d9bb3..eec9634630 100644
--- a/ext/standard/tests/array/array_merge_recursive_variation2.phpt
+++ b/ext/standard/tests/array/array_merge_recursive_variation2.phpt
@@ -88,9 +88,13 @@ $arrays = array (
// loop through each element of $arrays and check the behavior of array_merge_recursive()
$iterator = 1;
foreach($arrays as $arr2) {
- echo "\n-- Iteration $iterator --";
- var_dump( array_merge_recursive($arr1, $arr2) );
- $iterator++;
+ echo "\n-- Iteration $iterator --";
+ try {
+ var_dump( array_merge_recursive($arr1, $arr2) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ $iterator++;
}
// close the file resource used
@@ -98,102 +102,54 @@ fclose($fp);
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing array_merge_recursive() : Passing non array values to $arr2 argument ***
--- Iteration 1 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+-- Iteration 1 --Expected parameter 2 to be an array, int given
--- Iteration 2 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+-- Iteration 2 --Expected parameter 2 to be an array, int given
--- Iteration 3 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+-- Iteration 3 --Expected parameter 2 to be an array, int given
--- Iteration 4 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+-- Iteration 4 --Expected parameter 2 to be an array, int given
--- Iteration 5 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+-- Iteration 5 --Expected parameter 2 to be an array, float given
--- Iteration 6 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+-- Iteration 6 --Expected parameter 2 to be an array, float given
--- Iteration 7 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+-- Iteration 7 --Expected parameter 2 to be an array, float given
--- Iteration 8 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+-- Iteration 8 --Expected parameter 2 to be an array, float given
--- Iteration 9 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+-- Iteration 9 --Expected parameter 2 to be an array, float given
--- Iteration 10 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+-- Iteration 10 --Expected parameter 2 to be an array, null given
--- Iteration 11 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+-- Iteration 11 --Expected parameter 2 to be an array, null given
--- Iteration 12 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 12 --Expected parameter 2 to be an array, bool given
--- Iteration 13 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 13 --Expected parameter 2 to be an array, bool given
--- Iteration 14 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 14 --Expected parameter 2 to be an array, bool given
--- Iteration 15 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+-- Iteration 15 --Expected parameter 2 to be an array, bool given
--- Iteration 16 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 16 --Expected parameter 2 to be an array, string given
--- Iteration 17 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 17 --Expected parameter 2 to be an array, string given
--- Iteration 18 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 18 --Expected parameter 2 to be an array, string given
--- Iteration 19 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 19 --Expected parameter 2 to be an array, string given
--- Iteration 20 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+-- Iteration 20 --Expected parameter 2 to be an array, string given
--- Iteration 21 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+-- Iteration 21 --Expected parameter 2 to be an array, null given
--- Iteration 22 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+-- Iteration 22 --Expected parameter 2 to be an array, null given
--- Iteration 23 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, resource given in %s on line %d
-NULL
+-- Iteration 23 --Expected parameter 2 to be an array, resource given
--- Iteration 24 --
-Warning: array_merge_recursive(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
+-- Iteration 24 --Expected parameter 2 to be an array, object given
Done
diff --git a/ext/standard/tests/array/array_merge_recursive_variation4.phpt b/ext/standard/tests/array/array_merge_recursive_variation4.phpt
index f2c1e82a0c..dc5651adfb 100644
--- a/ext/standard/tests/array/array_merge_recursive_variation4.phpt
+++ b/ext/standard/tests/array/array_merge_recursive_variation4.phpt
@@ -50,7 +50,7 @@ $arrays = array (
array("hello", $heredoc => array("heredoc", 'string'), "string"),
// array with object, unset variable and resource variable
-/*8*/ array(new classA() => 11, @$unset_var => array("unset"), $fp => 'resource', 11, "hello")
+/*8*/ array(@$unset_var => array("unset"), $fp => 'resource', 11, "hello")
);
// initialise the second array
@@ -80,9 +80,7 @@ echo "Done";
--EXPECTF--
*** Testing array_merge_recursive() : assoc. array with diff. keys to $arr1 argument ***
-Warning: Illegal offset type in %s on line %d
-
-Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
+Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
-- Iteration 1 --
-- With default argument --
array(2) {
diff --git a/ext/standard/tests/array/array_merge_variation1.phpt b/ext/standard/tests/array/array_merge_variation1.phpt
index 0335fe473b..16e702e8a1 100644
--- a/ext/standard/tests/array/array_merge_variation1.phpt
+++ b/ext/standard/tests/array/array_merge_variation1.phpt
@@ -102,129 +102,8 @@ echo "Done";
-- Iteration 1 --
-Warning: array_merge(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
--- Iteration 2 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
--- Iteration 3 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
--- Iteration 4 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, int given in %s on line %d
-NULL
-
--- Iteration 5 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
--- Iteration 6 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
--- Iteration 7 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
--- Iteration 8 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
--- Iteration 9 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, float given in %s on line %d
-NULL
-
--- Iteration 10 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
--- Iteration 11 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
--- Iteration 12 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
--- Iteration 13 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
--- Iteration 14 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
--- Iteration 15 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, bool given in %s on line %d
-NULL
-
--- Iteration 16 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
--- Iteration 17 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
--- Iteration 18 --
-array(2) {
- [0]=>
- int(1)
- [1]=>
- int(2)
-}
-
--- Iteration 19 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
--- Iteration 20 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
--- Iteration 21 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, string given in %s on line %d
-NULL
-
--- Iteration 22 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, object given in %s on line %d
-NULL
-
--- Iteration 23 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
--- Iteration 24 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, null given in %s on line %d
-NULL
-
--- Iteration 25 --
-
-Warning: array_merge(): Expected parameter 1 to be an array, resource given in %s on line %d
-NULL
-Done
+Fatal error: Uncaught TypeError: Expected parameter 1 to be an array, int given in %s:%d
+Stack trace:
+#0 %s(%d): array_merge(0, Array)
+#1 {main}
+ thrown in %s on line %d
diff --git a/ext/standard/tests/array/array_merge_variation2.phpt b/ext/standard/tests/array/array_merge_variation2.phpt
index fd7e9ccfc8..57715d484b 100644
--- a/ext/standard/tests/array/array_merge_variation2.phpt
+++ b/ext/standard/tests/array/array_merge_variation2.phpt
@@ -88,102 +88,72 @@ $inputs = array(
// loop through each element of $inputs to check the behavior of array_merge()
$iterator = 1;
foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump( array_merge($arr1, $input) );
- $iterator++;
+ echo "\n-- Iteration $iterator --\n";
+ try {
+ var_dump( array_merge($arr1, $input) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ $iterator++;
};
fclose($fp);
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing array_merge() : usage variations ***
-- Iteration 1 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
-- Iteration 2 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
-- Iteration 3 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
-- Iteration 4 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, int given in %s on line %d
-NULL
+Expected parameter 2 to be an array, int given
-- Iteration 5 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
-- Iteration 6 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
-- Iteration 7 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
-- Iteration 8 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
-- Iteration 9 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, float given in %s on line %d
-NULL
+Expected parameter 2 to be an array, float given
-- Iteration 10 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
-- Iteration 11 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
-- Iteration 12 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
-- Iteration 13 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
-- Iteration 14 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
-- Iteration 15 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, bool given in %s on line %d
-NULL
+Expected parameter 2 to be an array, bool given
-- Iteration 16 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
-- Iteration 17 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
-- Iteration 18 --
array(2) {
@@ -194,37 +164,23 @@ array(2) {
}
-- Iteration 19 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
-- Iteration 20 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
-- Iteration 21 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, string given in %s on line %d
-NULL
+Expected parameter 2 to be an array, string given
-- Iteration 22 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, object given in %s on line %d
-NULL
+Expected parameter 2 to be an array, object given
-- Iteration 23 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
-- Iteration 24 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, null given in %s on line %d
-NULL
+Expected parameter 2 to be an array, null given
-- Iteration 25 --
-
-Warning: array_merge(): Expected parameter 2 to be an array, resource given in %s on line %d
-NULL
+Expected parameter 2 to be an array, resource given
Done
diff --git a/ext/standard/tests/array/array_merge_variation3.phpt b/ext/standard/tests/array/array_merge_variation3.phpt
index b8444ffb09..1b15153c7f 100644
--- a/ext/standard/tests/array/array_merge_variation3.phpt
+++ b/ext/standard/tests/array/array_merge_variation3.phpt
@@ -42,7 +42,7 @@ $inputs = array(
// int data
/*1*/ 'int' => array(
- 0,
+ 0,
1,
12345,
-2345,
diff --git a/ext/standard/tests/array/array_multisort_basic1.phpt b/ext/standard/tests/array/array_multisort_basic1.phpt
index 20e90be415..599838a5d5 100644
--- a/ext/standard/tests/array/array_multisort_basic1.phpt
+++ b/ext/standard/tests/array/array_multisort_basic1.phpt
@@ -24,7 +24,6 @@ var_dump($ar2);
?>
-===DONE===
--EXPECT--
*** Testing array_multisort() : basic functionality ***
@@ -57,4 +56,3 @@ array(3) {
["row1"]=>
int(2)
}
-===DONE===
diff --git a/ext/standard/tests/array/array_multisort_basic2.phpt b/ext/standard/tests/array/array_multisort_basic2.phpt
index e7af3b352f..41eb5d8a62 100644
--- a/ext/standard/tests/array/array_multisort_basic2.phpt
+++ b/ext/standard/tests/array/array_multisort_basic2.phpt
@@ -19,7 +19,6 @@ var_dump( array_multisort($ar1, SORT_ASC, SORT_REGULAR, $ar2, SORT_ASC, SORT_NUM
var_dump($ar1, $ar2);
?>
-===DONE===
--EXPECT--
*** Testing array_multisort() : basic functionality - renumbering of numeric keys ***
@@ -41,4 +40,3 @@ array(3) {
[2]=>
int(2)
}
-===DONE===
diff --git a/ext/standard/tests/array/array_multisort_case.phpt b/ext/standard/tests/array/array_multisort_case.phpt
index 390640700c..39d9280c28 100644
--- a/ext/standard/tests/array/array_multisort_case.phpt
+++ b/ext/standard/tests/array/array_multisort_case.phpt
@@ -11,23 +11,23 @@ Test array_multisort() function : case-sensitive
echo "*** Testing array_multisort() : case-sensitive\n";
$a = array(
- 'Second',
- 'First.1',
- 'First.2',
- 'First.3',
- 'Twentieth',
- 'Tenth',
- 'Third',
+ 'Second',
+ 'First.1',
+ 'First.2',
+ 'First.3',
+ 'Twentieth',
+ 'Tenth',
+ 'Third',
);
$b = array(
- '2 a',
- '1 bb 1',
- '1 bB 2',
- '1 BB 3',
- '20 c',
- '10 d',
- '3 e',
+ '2 a',
+ '1 bb 1',
+ '1 bB 2',
+ '1 BB 3',
+ '20 c',
+ '10 d',
+ '3 e',
);
array_multisort($b, SORT_STRING, $a);
@@ -35,7 +35,6 @@ array_multisort($b, SORT_STRING, $a);
var_dump($a, $b);
?>
-===DONE===
--EXPECT--
*** Testing array_multisort() : case-sensitive
array(7) {
@@ -70,4 +69,3 @@ array(7) {
[6]=>
string(3) "3 e"
}
-===DONE===
diff --git a/ext/standard/tests/array/array_multisort_error.phpt b/ext/standard/tests/array/array_multisort_error.phpt
index 3e78b78ac0..63d59e58f0 100644
--- a/ext/standard/tests/array/array_multisort_error.phpt
+++ b/ext/standard/tests/array/array_multisort_error.phpt
@@ -10,35 +10,28 @@ Test array_multisort() function : error conditions
echo "*** Testing array_multisort() : error conditions ***\n";
-// Zero arguments
-echo "\n-- Testing array_multisort() function with Zero arguments --\n";
-var_dump( array_multisort() );
-
echo "\n-- Testing array_multisort() function with repeated flags --\n";
$ar1 = array(1);
-var_dump( array_multisort($ar1, SORT_ASC, SORT_ASC) );
+try {
+ var_dump( array_multisort($ar1, SORT_ASC, SORT_ASC) );
+} catch (\TypeError $e) {
+ echo $e->getMessage() . "\n";
+}
echo "\n-- Testing array_multisort() function with repeated flags --\n";
$ar1 = array(1);
-var_dump( array_multisort($ar1, SORT_STRING, SORT_NUMERIC) );
+try {
+ var_dump( array_multisort($ar1, SORT_STRING, SORT_NUMERIC) );
+} catch (\TypeError $e) {
+ echo $e->getMessage() . "\n";
+}
?>
-===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_multisort() : error conditions ***
--- Testing array_multisort() function with Zero arguments --
-
-Warning: array_multisort() expects at least 1 parameter, 0 given in %sarray_multisort_error.php on line %d
-NULL
-
-- Testing array_multisort() function with repeated flags --
-
-Warning: array_multisort(): Argument #3 is expected to be an array or sorting flag that has not already been specified in %sarray_multisort_error.php on line %d
-bool(false)
+Argument #3 is expected to be an array or sorting flag that has not already been specified
-- Testing array_multisort() function with repeated flags --
-
-Warning: array_multisort(): Argument #3 is expected to be an array or sorting flag that has not already been specified in %sarray_multisort_error.php on line %d
-bool(false)
-===DONE===
+Argument #3 is expected to be an array or sorting flag that has not already been specified
diff --git a/ext/standard/tests/array/array_multisort_incase.phpt b/ext/standard/tests/array/array_multisort_incase.phpt
index a20a0f1151..98be7d06bc 100644
--- a/ext/standard/tests/array/array_multisort_incase.phpt
+++ b/ext/standard/tests/array/array_multisort_incase.phpt
@@ -11,23 +11,23 @@ Test array_multisort() function : case-insensitive
echo "*** Testing array_multisort() : case-insensitive\n";
$a = array(
- 'Second',
- 'First.1',
- 'First.2',
- 'First.3',
- 'Twentieth',
- 'Tenth',
- 'Third',
+ 'Second',
+ 'First.1',
+ 'First.2',
+ 'First.3',
+ 'Twentieth',
+ 'Tenth',
+ 'Third',
);
$b = array(
- '2 a',
- '1 bb 1',
- '1 bB 2',
- '1 BB 3',
- '20 c',
- '10 d',
- '3 e',
+ '2 a',
+ '1 bb 1',
+ '1 bB 2',
+ '1 BB 3',
+ '20 c',
+ '10 d',
+ '3 e',
);
array_multisort($b, SORT_STRING | SORT_FLAG_CASE, $a);
@@ -35,7 +35,6 @@ array_multisort($b, SORT_STRING | SORT_FLAG_CASE, $a);
var_dump($a, $b);
?>
-===DONE===
--EXPECT--
*** Testing array_multisort() : case-insensitive
array(7) {
@@ -70,4 +69,3 @@ array(7) {
[6]=>
string(3) "3 e"
}
-===DONE===
diff --git a/ext/standard/tests/array/array_multisort_natural.phpt b/ext/standard/tests/array/array_multisort_natural.phpt
index 56fb3df582..f56c1b00a2 100644
--- a/ext/standard/tests/array/array_multisort_natural.phpt
+++ b/ext/standard/tests/array/array_multisort_natural.phpt
@@ -11,19 +11,19 @@ Test array_multisort() function : natural sorting
echo "*** Testing array_multisort() : natural sorting\n";
$a = array(
- 'Second',
- 'First',
- 'Twentieth',
- 'Tenth',
- 'Third',
+ 'Second',
+ 'First',
+ 'Twentieth',
+ 'Tenth',
+ 'Third',
);
$b = array(
- '2 a',
- '1 b',
- '20 c',
- '10 d',
- '3 e',
+ '2 a',
+ '1 b',
+ '20 c',
+ '10 d',
+ '3 e',
);
array_multisort($b, SORT_NATURAL, $a);
@@ -31,7 +31,6 @@ array_multisort($b, SORT_NATURAL, $a);
var_dump($a, $b);
?>
-===DONE===
--EXPECT--
*** Testing array_multisort() : natural sorting
array(5) {
@@ -58,4 +57,3 @@ array(5) {
[4]=>
string(4) "20 c"
}
-===DONE===
diff --git a/ext/standard/tests/array/array_multisort_natural_case.phpt b/ext/standard/tests/array/array_multisort_natural_case.phpt
index 79ff8e99c6..fc42219972 100644
--- a/ext/standard/tests/array/array_multisort_natural_case.phpt
+++ b/ext/standard/tests/array/array_multisort_natural_case.phpt
@@ -11,23 +11,23 @@ Test array_multisort() function : natural sorting case-sensitive
echo "*** Testing array_multisort() : natural sorting case-sensitive\n";
$a = array(
- 'Second',
- 'First.1',
- 'First.2',
- 'First.3',
- 'Twentieth',
- 'Tenth',
- 'Third',
+ 'Second',
+ 'First.1',
+ 'First.2',
+ 'First.3',
+ 'Twentieth',
+ 'Tenth',
+ 'Third',
);
$b = array(
- '2 a',
- '1 bb 1',
- '1 bB 2',
- '1 BB 3',
- '20 c',
- '10 d',
- '3 e',
+ '2 a',
+ '1 bb 1',
+ '1 bB 2',
+ '1 BB 3',
+ '20 c',
+ '10 d',
+ '3 e',
);
array_multisort($b, SORT_NATURAL, $a);
@@ -35,7 +35,6 @@ array_multisort($b, SORT_NATURAL, $a);
var_dump($a, $b);
?>
-===DONE===
--EXPECT--
*** Testing array_multisort() : natural sorting case-sensitive
array(7) {
@@ -70,4 +69,3 @@ array(7) {
[6]=>
string(4) "20 c"
}
-===DONE===
diff --git a/ext/standard/tests/array/array_multisort_natural_incase.phpt b/ext/standard/tests/array/array_multisort_natural_incase.phpt
index f34c501eec..0b12bf776d 100644
--- a/ext/standard/tests/array/array_multisort_natural_incase.phpt
+++ b/ext/standard/tests/array/array_multisort_natural_incase.phpt
@@ -11,23 +11,23 @@ Test array_multisort() function : natural sorting case-insensitive
echo "*** Testing array_multisort() : natural sorting case-insensitive\n";
$a = array(
- 'Second',
- 'First.1',
- 'First.2',
- 'First.3',
- 'Twentieth',
- 'Tenth',
- 'Third',
+ 'Second',
+ 'First.1',
+ 'First.2',
+ 'First.3',
+ 'Twentieth',
+ 'Tenth',
+ 'Third',
);
$b = array(
- '2 a',
- '1 bb 1',
- '1 bB 2',
- '1 BB 3',
- '20 c',
- '10 d',
- '3 e',
+ '2 a',
+ '1 bb 1',
+ '1 bB 2',
+ '1 BB 3',
+ '20 c',
+ '10 d',
+ '3 e',
);
array_multisort($b, SORT_NATURAL | SORT_FLAG_CASE, $a);
@@ -35,7 +35,6 @@ array_multisort($b, SORT_NATURAL | SORT_FLAG_CASE, $a);
var_dump($a, $b);
?>
-===DONE===
--EXPECT--
*** Testing array_multisort() : natural sorting case-insensitive
array(7) {
@@ -70,4 +69,3 @@ array(7) {
[6]=>
string(4) "20 c"
}
-===DONE===
diff --git a/ext/standard/tests/array/array_multisort_variation1.phpt b/ext/standard/tests/array/array_multisort_variation1.phpt
index 9a33a270f1..4cedadf071 100644
--- a/ext/standard/tests/array/array_multisort_variation1.phpt
+++ b/ext/standard/tests/array/array_multisort_variation1.phpt
@@ -11,11 +11,11 @@ Test array_multisort() function : usage variation
echo "*** Testing array_multisort() : usage variation ***\n";
// Define error handler
-function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
- if (error_reporting() != 0) {
- // report non-silenced errors
- echo "Error: $err_no - $err_msg, $filename($linenum)\n";
- }
+function test_error_handler($err_no, $err_msg, $filename, $linenum) {
+ if (error_reporting() & $err_no) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ }
}
set_error_handler('test_error_handler');
@@ -28,9 +28,9 @@ unset ($unset_var);
// define some classes
class classWithToString
{
- public function __toString() {
- return "Class A object";
- }
+ public function __toString() {
+ return "Class A object";
+ }
}
class classWithoutToString
@@ -97,111 +97,88 @@ $inputs = array(
foreach($inputs as $key =>$value) {
echo "\n--$key--\n";
- var_dump( array_multisort($value));
+ try {
+ var_dump( array_multisort($value));
+ } catch (\ValueError | \TypeError $e) {
+ echo $e->getMessage() . "\n";
+ }
};
?>
-===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_multisort() : usage variation ***
--int 0--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or sorting flag that has not already been specified, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or sorting flag that has not already been specified
--int 1--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or sorting flag that has not already been specified, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or sorting flag that has not already been specified
--int 12345--
-Error: 2 - array_multisort(): Argument #1 is an unknown sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is an unknown sort flag
--int -12345--
-Error: 2 - array_multisort(): Argument #1 is an unknown sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is an unknown sort flag
--float 10.5--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or a sort flag
--float -10.5--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or a sort flag
--float 12.3456789000e10--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or a sort flag
--float -12.3456789000e10--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or a sort flag
--float .5--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or a sort flag
--uppercase NULL--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or a sort flag
--lowercase null--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or a sort flag
--lowercase true--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or a sort flag
--lowercase false--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or a sort flag
--uppercase TRUE--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or a sort flag
--uppercase FALSE--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or a sort flag
--empty string DQ--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or a sort flag
--empty string SQ--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or a sort flag
--string DQ--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or a sort flag
--string SQ--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or a sort flag
--mixed case string--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or a sort flag
--heredoc--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or a sort flag
--instance of classWithToString--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or a sort flag
--instance of classWithoutToString--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or a sort flag
--undefined var--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
+Argument #1 is expected to be an array or a sort flag
--unset var--
-Error: 2 - array_multisort(): Argument #1 is expected to be an array or a sort flag, %sarray_multisort_variation1.php(%d)
-bool(false)
-===DONE===
+Argument #1 is expected to be an array or a sort flag
diff --git a/ext/standard/tests/array/array_multisort_variation10.phpt b/ext/standard/tests/array/array_multisort_variation10.phpt
index 17bdeae5cd..5452365f37 100644
--- a/ext/standard/tests/array/array_multisort_variation10.phpt
+++ b/ext/standard/tests/array/array_multisort_variation10.phpt
@@ -1,5 +1,5 @@
--TEST--
-Test array_multisort() function : usage variation - testing with anonymous arrary arguments
+Test array_multisort() function : usage variation - testing with anonymous array arguments
--FILE--
<?php
/* Prototype : bool array_multisort(array ar1 [, SORT_ASC|SORT_DESC [, SORT_REGULAR|SORT_NUMERIC|SORT_STRING|SORT_NATURAL|SORT_FLAG_CASE]] [, array ar2 [, SORT_ASC|SORT_DESC [, SORT_REGULAR|SORT_NUMERIC|SORT_STRING|SORT_NATURAL|SORT_FLAG_CASE]], ...])
@@ -13,8 +13,6 @@ echo "*** Testing array_multisort() : Testing with anonymous arguments ***\n";
var_dump(array_multisort(array(1,3,2,4)));
?>
-===DONE===
--EXPECT--
*** Testing array_multisort() : Testing with anonymous arguments ***
bool(true)
-===DONE===
diff --git a/ext/standard/tests/array/array_multisort_variation11.phpt b/ext/standard/tests/array/array_multisort_variation11.phpt
index 49e8d0f30e..2a62b67abc 100644
--- a/ext/standard/tests/array/array_multisort_variation11.phpt
+++ b/ext/standard/tests/array/array_multisort_variation11.phpt
@@ -13,9 +13,6 @@ echo "*** Testing array_multisort() : Testing with empty array ***\n";
var_dump(array_multisort(array()));
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
*** Testing array_multisort() : Testing with empty array ***
bool(true)
-===DONE===
diff --git a/ext/standard/tests/array/array_multisort_variation2.phpt b/ext/standard/tests/array/array_multisort_variation2.phpt
index 8c26a8347b..4900b838ae 100644
--- a/ext/standard/tests/array/array_multisort_variation2.phpt
+++ b/ext/standard/tests/array/array_multisort_variation2.phpt
@@ -11,11 +11,11 @@ Test array_multisort() function : usage variation
echo "*** Testing array_multisort() : usage variation ***\n";
// Define error handler
-function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
- if (error_reporting() != 0) {
- // report non-silenced errors
- echo "Error: $err_no - $err_msg, $filename($linenum)\n";
- }
+function test_error_handler($err_no, $err_msg, $filename, $linenum) {
+ if (error_reporting() & $err_no) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ }
}
set_error_handler('test_error_handler');
@@ -30,9 +30,9 @@ unset ($unset_var);
// define some classes
class classWithToString
{
- public function __toString() {
- return "Class A object";
- }
+ public function __toString() {
+ return "Class A object";
+ }
}
class classWithoutToString
@@ -104,13 +104,16 @@ $inputs = array(
// loop through each element of the array for SORT_REGULAR|SORT_NUMERIC|SORT_STRING|SORT_NATURAL|SORT_FLAG_CASE]]
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_multisort($ar1, $value) );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_multisort($ar1, $value) );
+ } catch (\ValueError | \TypeError $e) {
+ echo $e->getMessage() . "\n";
+ }
};
?>
-===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_multisort() : usage variation ***
--int 0--
@@ -120,109 +123,82 @@ bool(true)
bool(true)
--int 12345--
-Error: 2 - array_multisort(): Argument #2 is an unknown sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is an unknown sort flag
--int -12345--
-Error: 2 - array_multisort(): Argument #2 is an unknown sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is an unknown sort flag
--float 10.5--
-Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is expected to be an array or a sort flag
--float -10.5--
-Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is expected to be an array or a sort flag
--float 12.3456789000e10--
-Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is expected to be an array or a sort flag
--float -12.3456789000e10--
-Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is expected to be an array or a sort flag
--float .5--
-Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is expected to be an array or a sort flag
--empty array--
-Error: 2 - array_multisort(): Array sizes are inconsistent, %sarray_multisort_variation2.php(%d)
-bool(false)
+Array sizes are inconsistent
--int indexed array--
-Error: 2 - array_multisort(): Array sizes are inconsistent, %sarray_multisort_variation2.php(%d)
-bool(false)
+Array sizes are inconsistent
--associative array--
bool(true)
--nested arrays--
-Error: 2 - array_multisort(): Array sizes are inconsistent, %sarray_multisort_variation2.php(%d)
-bool(false)
+Array sizes are inconsistent
--uppercase NULL--
-Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is expected to be an array or a sort flag
--lowercase null--
-Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is expected to be an array or a sort flag
--lowercase true--
-Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is expected to be an array or a sort flag
--lowercase false--
-Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is expected to be an array or a sort flag
--uppercase TRUE--
-Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is expected to be an array or a sort flag
--uppercase FALSE--
-Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is expected to be an array or a sort flag
--empty string DQ--
-Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is expected to be an array or a sort flag
--empty string SQ--
-Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is expected to be an array or a sort flag
--string DQ--
-Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is expected to be an array or a sort flag
--string SQ--
-Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is expected to be an array or a sort flag
--mixed case string--
-Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is expected to be an array or a sort flag
--heredoc--
-Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is expected to be an array or a sort flag
--instance of classWithToString--
-Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is expected to be an array or a sort flag
--instance of classWithoutToString--
-Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is expected to be an array or a sort flag
--undefined var--
-Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
+Argument #2 is expected to be an array or a sort flag
--unset var--
-Error: 2 - array_multisort(): Argument #2 is expected to be an array or a sort flag, %sarray_multisort_variation2.php(%d)
-bool(false)
-===DONE===
+Argument #2 is expected to be an array or a sort flag
diff --git a/ext/standard/tests/array/array_multisort_variation3.phpt b/ext/standard/tests/array/array_multisort_variation3.phpt
index 28130e31fd..02883e87d1 100644
--- a/ext/standard/tests/array/array_multisort_variation3.phpt
+++ b/ext/standard/tests/array/array_multisort_variation3.phpt
@@ -11,11 +11,11 @@ Test array_multisort() function : usage variation
echo "*** Testing array_multisort() : usage variation ***\n";
// Define error handler
-function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
- if (error_reporting() != 0) {
- // report non-silenced errors
- echo "Error: $err_no - $err_msg, $filename($linenum)\n";
- }
+function test_error_handler($err_no, $err_msg, $filename, $linenum) {
+ if (error_reporting() & $err_no) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ }
}
set_error_handler('test_error_handler');
@@ -29,9 +29,9 @@ unset ($unset_var);
// define some classes
class classWithToString
{
- public function __toString() {
- return "Class A object";
- }
+ public function __toString() {
+ return "Class A object";
+ }
}
class classWithoutToString
@@ -95,114 +95,90 @@ $inputs = array(
);
// loop through each element of the array for ar2
-
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_multisort($ar1, SORT_REGULAR, $value) );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_multisort($ar1, SORT_REGULAR, $value) );
+ } catch (\ValueError | \TypeError $e) {
+ echo $e->getMessage() . "\n";
+ }
};
?>
-===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_multisort() : usage variation ***
--int 0--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or sorting flag that has not already been specified, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or sorting flag that has not already been specified
--int 1--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or sorting flag that has not already been specified, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or sorting flag that has not already been specified
--int 12345--
-Error: 2 - array_multisort(): Argument #3 is an unknown sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is an unknown sort flag
--int -12345--
-Error: 2 - array_multisort(): Argument #3 is an unknown sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is an unknown sort flag
--float 10.5--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or a sort flag
--float -10.5--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or a sort flag
--float 12.3456789000e10--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or a sort flag
--float -12.3456789000e10--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or a sort flag
--float .5--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or a sort flag
--uppercase NULL--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or a sort flag
--lowercase null--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or a sort flag
--lowercase true--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or a sort flag
--lowercase false--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or a sort flag
--uppercase TRUE--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or a sort flag
--uppercase FALSE--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or a sort flag
--empty string DQ--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or a sort flag
--empty string SQ--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or a sort flag
--string DQ--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or a sort flag
--string SQ--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or a sort flag
--mixed case string--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or a sort flag
--heredoc--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or a sort flag
--instance of classWithToString--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or a sort flag
--instance of classWithoutToString--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or a sort flag
--undefined var--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
+Argument #3 is expected to be an array or a sort flag
--unset var--
-Error: 2 - array_multisort(): Argument #3 is expected to be an array or a sort flag, %sarray_multisort_variation3.php(%d)
-bool(false)
-===DONE===
+Argument #3 is expected to be an array or a sort flag
diff --git a/ext/standard/tests/array/array_multisort_variation4.phpt b/ext/standard/tests/array/array_multisort_variation4.phpt
index 562be2e70e..9b5f5fe1c7 100644
--- a/ext/standard/tests/array/array_multisort_variation4.phpt
+++ b/ext/standard/tests/array/array_multisort_variation4.phpt
@@ -21,7 +21,6 @@ var_dump($arr2);
var_dump($arr3);
?>
-===DONE===
--EXPECT--
*** Testing array_multisort() : Testing with multiple array arguments ***
bool(true)
@@ -55,4 +54,3 @@ array(4) {
[3]=>
int(9)
}
-===DONE===
diff --git a/ext/standard/tests/array/array_multisort_variation5.phpt b/ext/standard/tests/array/array_multisort_variation5.phpt
index 2953846825..3298bb8099 100644
--- a/ext/standard/tests/array/array_multisort_variation5.phpt
+++ b/ext/standard/tests/array/array_multisort_variation5.phpt
@@ -23,7 +23,6 @@ var_dump($ar);
?>
-===DONE===
--EXPECT--
*** Testing array_multisort() : Testing all array sort specifiers ***
array(3) {
@@ -50,4 +49,3 @@ array(3) {
[2]=>
int(2)
}
-===DONE===
diff --git a/ext/standard/tests/array/array_multisort_variation6.phpt b/ext/standard/tests/array/array_multisort_variation6.phpt
index f5ffb8a7e4..5cf556087c 100644
--- a/ext/standard/tests/array/array_multisort_variation6.phpt
+++ b/ext/standard/tests/array/array_multisort_variation6.phpt
@@ -23,7 +23,6 @@ var_dump($ar);
?>
-===DONE===
--EXPECT--
*** Testing array_multisort() : Testing all array sort specifiers ***
array(3) {
@@ -50,4 +49,3 @@ array(3) {
[2]=>
string(2) "aa"
}
-===DONE===
diff --git a/ext/standard/tests/array/array_multisort_variation7.phpt b/ext/standard/tests/array/array_multisort_variation7.phpt
index 4ad68efe19..7ad9bd72a7 100644
--- a/ext/standard/tests/array/array_multisort_variation7.phpt
+++ b/ext/standard/tests/array/array_multisort_variation7.phpt
@@ -12,9 +12,9 @@ echo "*** Testing array_multisort() : usage variation - test sort order of all
// define some classes
class classWithToString {
- public function __toString() {
- return "Class A object";
- }
+ public function __toString() {
+ return "Class A object";
+ }
}
class classWithoutToString { }
@@ -36,7 +36,6 @@ var_dump(array_multisort($inputs));
var_dump($inputs);
?>
-===DONE===
--EXPECT--
*** Testing array_multisort() : usage variation - test sort order of all types***
bool(true)
@@ -65,4 +64,3 @@ array(10) {
object(classWithoutToString)#2 (0) {
}
}
-===DONE===
diff --git a/ext/standard/tests/array/array_multisort_variation8.phpt b/ext/standard/tests/array/array_multisort_variation8.phpt
index 00b0ccb012..5658e12420 100644
--- a/ext/standard/tests/array/array_multisort_variation8.phpt
+++ b/ext/standard/tests/array/array_multisort_variation8.phpt
@@ -11,16 +11,16 @@ Test array_multisort() function : usage variation - test sort order of all types
echo "*** Testing array_multisort() : usage variation - test sort order of all types***\n";
// Define error handler
-function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
- // We're testing sort order not errors so ignore.
+function test_error_handler($err_no, $err_msg, $filename, $linenum) {
+ // We're testing sort order not errors so ignore.
}
set_error_handler('test_error_handler');
// define some classes
class classWithToString {
- public function __toString() {
- return "Class A object";
- }
+ public function __toString() {
+ return "Class A object";
+ }
}
class classWithoutToString { }
@@ -41,7 +41,6 @@ var_dump(array_multisort($inputs, SORT_STRING));
var_dump($inputs);
?>
-===DONE===
--EXPECT--
*** Testing array_multisort() : usage variation - test sort order of all types***
bool(true)
@@ -67,4 +66,3 @@ array(9) {
["string DQ"]=>
string(6) "string"
}
-===DONE===
diff --git a/ext/standard/tests/array/array_multisort_variation9.phpt b/ext/standard/tests/array/array_multisort_variation9.phpt
index 8d422b78c0..63f42f407d 100644
--- a/ext/standard/tests/array/array_multisort_variation9.phpt
+++ b/ext/standard/tests/array/array_multisort_variation9.phpt
@@ -12,9 +12,9 @@ echo "*** Testing array_multisort() : usage variation - test sort order of all
// define some classes
class classWithToString {
- public function __toString() {
- return "Class A object";
- }
+ public function __toString() {
+ return "Class A object";
+ }
}
class classWithoutToString { }
@@ -36,7 +36,6 @@ var_dump(array_multisort($inputs, SORT_NUMERIC));
var_dump($inputs);
?>
-===DONE===
--EXPECTF--
*** Testing array_multisort() : usage variation - test sort order of all types***
@@ -73,4 +72,3 @@ array(10) {
object(classWithoutToString)#2 (0) {
}
}
-===DONE===
diff --git a/ext/standard/tests/array/array_next_error2.phpt b/ext/standard/tests/array/array_next_error2.phpt
index d4f10e90e5..75aa778859 100644
--- a/ext/standard/tests/array/array_next_error2.phpt
+++ b/ext/standard/tests/array/array_next_error2.phpt
@@ -8,4 +8,7 @@ function f() {
var_dump(next(array(1, 2)));
?>
--EXPECTF--
-Fatal error: Only variables can be passed by reference in %s on line %d
+Fatal error: Uncaught Error: Cannot pass parameter 1 by reference in %s:%d
+Stack trace:
+#0 {main}
+ thrown in %s on line %d
diff --git a/ext/standard/tests/array/array_pad.phpt b/ext/standard/tests/array/array_pad.phpt
index c267516730..e4f8c5ce7f 100644
--- a/ext/standard/tests/array/array_pad.phpt
+++ b/ext/standard/tests/array/array_pad.phpt
@@ -3,9 +3,6 @@ array_pad() tests
--FILE--
<?php
-var_dump(array_pad());
-var_dump(array_pad(array()));
-var_dump(array_pad(array(), 1));
var_dump(array_pad(array(), 1, 0));
var_dump(array_pad(array(), 0, 0));
@@ -15,20 +12,15 @@ var_dump(array_pad(array("", -1, 2.0), 5, array()));
var_dump(array_pad(array("", -1, 2.0), 2, array()));
var_dump(array_pad(array("", -1, 2.0), -3, array()));
var_dump(array_pad(array("", -1, 2.0), -4, array()));
-var_dump(array_pad(array("", -1, 2.0), 2000000, 0));
-var_dump(array_pad("", 2000000, 0));
-echo "Done\n";
-?>
---EXPECTF--
-Warning: array_pad() expects exactly 3 parameters, 0 given in %s on line %d
-NULL
-
-Warning: array_pad() expects exactly 3 parameters, 1 given in %s on line %d
-NULL
+try {
+ var_dump(array_pad(array("", -1, 2.0), 2000000, 0));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+}
-Warning: array_pad() expects exactly 3 parameters, 2 given in %s on line %d
-NULL
+?>
+--EXPECT--
array(1) {
[0]=>
int(0)
@@ -92,10 +84,4 @@ array(4) {
[3]=>
float(2)
}
-
-Warning: array_pad(): You may only pad up to 1048576 elements at a time in %s on line %d
-bool(false)
-
-Warning: array_pad() expects parameter 1 to be array, string given in %s on line %d
-NULL
-Done
+You may only pad up to 1048576 elements at a time
diff --git a/ext/standard/tests/array/array_pad_variation6.phpt b/ext/standard/tests/array/array_pad_variation6.phpt
index 1ef1ef067c..f4d92abcfc 100644
--- a/ext/standard/tests/array/array_pad_variation6.phpt
+++ b/ext/standard/tests/array/array_pad_variation6.phpt
@@ -71,7 +71,7 @@ $inputs = array (
array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true),
array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6),
- // array with repetative keys
+ // array with repetitive keys
/*19*/ array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3)
);
diff --git a/ext/standard/tests/array/array_product_variation1.phpt b/ext/standard/tests/array/array_product_variation1.phpt
index 98c23e4d26..379d59cb21 100644
--- a/ext/standard/tests/array/array_product_variation1.phpt
+++ b/ext/standard/tests/array/array_product_variation1.phpt
@@ -28,7 +28,6 @@ foreach ($types as $desc => $type) {
fclose($fp);
?>
-===DONE===
--EXPECTF--
*** Testing array_product() : variation - using non numeric values ***
boolean (true)
@@ -55,4 +54,3 @@ int(0)
array
int(1)
-===DONE===
diff --git a/ext/standard/tests/array/array_product_variation2.phpt b/ext/standard/tests/array/array_product_variation2.phpt
index 38faf712e1..624fc37e5a 100644
--- a/ext/standard/tests/array/array_product_variation2.phpt
+++ b/ext/standard/tests/array/array_product_variation2.phpt
@@ -13,10 +13,8 @@ echo "*** Testing array_product() : variations ***\n";
echo "\n-- Testing array_product() function with a keyed array array --\n";
var_dump( array_product(array("bob" => 2, "janet" => 5)) );
?>
-===DONE===
--EXPECT--
*** Testing array_product() : variations ***
-- Testing array_product() function with a keyed array array --
int(10)
-===DONE===
diff --git a/ext/standard/tests/array/array_product_variation3.phpt b/ext/standard/tests/array/array_product_variation3.phpt
index a325879e45..588e46249e 100644
--- a/ext/standard/tests/array/array_product_variation3.phpt
+++ b/ext/standard/tests/array/array_product_variation3.phpt
@@ -27,7 +27,6 @@ var_dump( array_product(array(-99999999.9, 99999999.1)));
?>
-===DONE===
--EXPECT--
*** Testing array_product() : variations - negative numbers***
@@ -45,4 +44,3 @@ float(-1.5)
-- Testing array_product() function with negative floats --
float(-9.9999999E+15)
-===DONE===
diff --git a/ext/standard/tests/array/array_product_variation4.phpt b/ext/standard/tests/array/array_product_variation4.phpt
index c79077c78f..70f70516a7 100644
--- a/ext/standard/tests/array/array_product_variation4.phpt
+++ b/ext/standard/tests/array/array_product_variation4.phpt
@@ -20,10 +20,8 @@ for ($i = 0; $i < 999; $i++) {
var_dump( array_product($array) );
?>
-===DONE===
--EXPECT--
*** Testing array_product() : variations ***
-- Testing array_product() function with a very large array --
float(INF)
-===DONE===
diff --git a/ext/standard/tests/array/array_push.phpt b/ext/standard/tests/array/array_push.phpt
index 52e754f94d..227a520ac1 100644
--- a/ext/standard/tests/array/array_push.phpt
+++ b/ext/standard/tests/array/array_push.phpt
@@ -31,16 +31,7 @@ $mixed_array = array(
);
/* Error Conditions */
-echo "\n*** Testing Error Conditions ***\n";
-
-/* Zero argument */
-var_dump( array_push() );
-
-/* Scalar argument */
-var_dump( array_push($number, 22) );
-
-/* String argument */
-var_dump( array_push($str, 22) );
+echo "\n*** Testing Edge Conditions ***\n";
/* Invalid Number of arguments */
var_dump( array_push($mixed_array[1],1,2) );
@@ -70,16 +61,7 @@ var_dump( $mixed_array[2] );
echo"\nDone";
?>
--EXPECTF--
-*** Testing Error Conditions ***
-
-Warning: array_push() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: array_push() expects parameter 1 to be array, int given in %s on line %d
-NULL
-
-Warning: array_push() expects parameter 1 to be array, string given in %s on line %d
-NULL
+*** Testing Edge Conditions ***
int(11)
int(1)
diff --git a/ext/standard/tests/array/array_push_error2.phpt b/ext/standard/tests/array/array_push_error2.phpt
index 3ab60136be..ce267f2cd0 100644
--- a/ext/standard/tests/array/array_push_error2.phpt
+++ b/ext/standard/tests/array/array_push_error2.phpt
@@ -15,19 +15,18 @@ Test array_push() function : error conditions - max int value as key
echo "*** Testing array_push() : error conditions ***\n";
$array = array(PHP_INT_MAX => 'max');
-
-var_dump(array_push($array, 'new'));
+try {
+ var_dump(array_push($array, 'new'));
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
var_dump($array);
-echo "Done";
?>
--EXPECTF--
*** Testing array_push() : error conditions ***
-
-Warning: array_push(): Cannot add element to the array as the next element is already occupied in %s on line %d
-bool(false)
+Cannot add element to the array as the next element is already occupied
array(1) {
[%d]=>
string(3) "max"
}
-Done
diff --git a/ext/standard/tests/array/array_rand.phpt b/ext/standard/tests/array/array_rand.phpt
index db432dc9b4..4aebe8c23d 100644
--- a/ext/standard/tests/array/array_rand.phpt
+++ b/ext/standard/tests/array/array_rand.phpt
@@ -3,39 +3,46 @@ array_rand() tests
--FILE--
<?php
-var_dump(array_rand());
-var_dump(array_rand(array()));
-var_dump(array_rand(array(), 0));
-var_dump(array_rand(0, 0));
-var_dump(array_rand(array(1,2,3), 0));
-var_dump(array_rand(array(1,2,3), -1));
-var_dump(array_rand(array(1,2,3), 10));
-var_dump(array_rand(array(1,2,3), 3));
-var_dump(array_rand(array(1,2,3), 2));
-
-echo "Done\n";
-?>
---EXPECTF--
-Warning: array_rand() expects at least 1 parameter, 0 given in %s on line %d
-NULL
+try {
+ var_dump(array_rand(array()));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+}
-Warning: array_rand(): Array is empty in %s on line %d
-NULL
+try {
+ var_dump(array_rand(array(), 0));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+}
-Warning: array_rand(): Array is empty in %s on line %d
-NULL
+try {
+ var_dump(array_rand(array(1,2,3), 0));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+}
-Warning: array_rand() expects parameter 1 to be array, int given in %s on line %d
-NULL
+try {
+ var_dump(array_rand(array(1,2,3), -1));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+}
-Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d
-NULL
+try {
+ var_dump(array_rand(array(1,2,3), 10));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+}
-Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d
-NULL
+var_dump(array_rand(array(1,2,3), 3));
+var_dump(array_rand(array(1,2,3), 2));
-Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d
-NULL
+?>
+--EXPECTF--
+Array is empty
+Array is empty
+Second argument has to be between 1 and the number of elements in the array
+Second argument has to be between 1 and the number of elements in the array
+Second argument has to be between 1 and the number of elements in the array
array(3) {
[0]=>
int(%d)
@@ -50,4 +57,3 @@ array(2) {
[1]=>
int(%d)
}
-Done
diff --git a/ext/standard/tests/array/array_rand_variation5.phpt b/ext/standard/tests/array/array_rand_variation5.phpt
index 30eb7d7801..04e71bdc49 100644
--- a/ext/standard/tests/array/array_rand_variation5.phpt
+++ b/ext/standard/tests/array/array_rand_variation5.phpt
@@ -32,16 +32,33 @@ var_dump( array_rand($input, 1) ); // with valid $num_req value
// with invalid num_req value
echo"\n-- With num_req = 0 --\n";
-var_dump( array_rand($input, 0) ); // with $num_req=0
+try {
+ var_dump( array_rand($input, 0) ); // with $num_req=0
+} catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+}
+
echo"\n-- With num_req = -1 --\n";
-var_dump( array_rand($input, -1) ); // with $num_req=-1
+try {
+ var_dump( array_rand($input, -1) ); // with $num_req=-1
+} catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+}
+
echo"\n-- With num_req = -2 --\n";
-var_dump( array_rand($input, -2) ); // with $num_req=-2
-echo"\n-- With num_req more than number of members in 'input' array --\n";
-var_dump( array_rand($input, 13) ); // with $num_req=13
+try {
+ var_dump( array_rand($input, -2) ); // with $num_req=-2
+} catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+}
+echo"\n-- With num_req more than number of members in 'input' array --\n";
+try {
+ var_dump( array_rand($input, 13) ); // with $num_req=13
+} catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+}
-echo "Done";
?>
--EXPECTF--
*** Testing array_rand() : with invalid values for 'req_num' ***
@@ -53,22 +70,13 @@ int(%d)
int(%d)
-- With num_req = 0 --
-
-Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d
-NULL
+Second argument has to be between 1 and the number of elements in the array
-- With num_req = -1 --
-
-Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d
-NULL
+Second argument has to be between 1 and the number of elements in the array
-- With num_req = -2 --
-
-Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d
-NULL
+Second argument has to be between 1 and the number of elements in the array
-- With num_req more than number of members in 'input' array --
-
-Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in %s on line %d
-NULL
-Done
+Second argument has to be between 1 and the number of elements in the array
diff --git a/ext/standard/tests/array/array_reduce_variation1.phpt b/ext/standard/tests/array/array_reduce_variation1.phpt
index 618a22282a..6b1d21e046 100644
--- a/ext/standard/tests/array/array_reduce_variation1.phpt
+++ b/ext/standard/tests/array/array_reduce_variation1.phpt
@@ -26,13 +26,12 @@ var_dump(array_reduce($array, "oneArg", 2));
echo "\n--- Testing with a callback with too many parameters ---\n";
try {
- var_dump(array_reduce($array, "threeArgs", 2));
+ var_dump(array_reduce($array, "threeArgs", 2));
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
?>
-===DONE===
--EXPECT--
*** Testing array_reduce() : variation ***
@@ -41,4 +40,3 @@ int(2)
--- Testing with a callback with too many parameters ---
Exception: Too few arguments to function threeArgs(), 2 passed and exactly 3 expected
-===DONE===
diff --git a/ext/standard/tests/array/array_reduce_variation3.phpt b/ext/standard/tests/array/array_reduce_variation3.phpt
index 01bd6d79d6..f43b8eb589 100644
--- a/ext/standard/tests/array/array_reduce_variation3.phpt
+++ b/ext/standard/tests/array/array_reduce_variation3.phpt
@@ -24,7 +24,6 @@ echo "\n--- Instance method callback ---\n";
var_dump(array_reduce($array, array(new A(), "adder2")));
?>
-===DONE===
--EXPECT--
*** Testing array_reduce() : variation - object callbacks ***
@@ -33,4 +32,3 @@ int(1)
--- Instance method callback ---
int(1)
-===DONE===
diff --git a/ext/standard/tests/array/array_replace.phpt b/ext/standard/tests/array/array_replace.phpt
index 6ba9e43fd7..c3edba008c 100644
--- a/ext/standard/tests/array/array_replace.phpt
+++ b/ext/standard/tests/array/array_replace.phpt
@@ -4,26 +4,26 @@ Test array_replace and array_replace_recursive
<?php
$array1 = array(
- 0 => 'dontclobber',
- '1' => 'unclobbered',
- 'test2' => 0.0,
- 'test3' => array(
- 'testarray2' => true,
- 1 => array(
- 'testsubarray1' => 'dontclobber2',
- 'testsubarray2' => 'dontclobber3',
- ),
+ 0 => 'dontclobber',
+ '1' => 'unclobbered',
+ 'test2' => 0.0,
+ 'test3' => array(
+ 'testarray2' => true,
+ 1 => array(
+ 'testsubarray1' => 'dontclobber2',
+ 'testsubarray2' => 'dontclobber3',
+ ),
),
);
$array2 = array(
- 1 => 'clobbered',
- 'test3' => array(
- 'testarray2' => false,
- ),
- 'test4' => array(
- 'clobbered3' => array(0, 1, 2),
- ),
+ 1 => 'clobbered',
+ 'test3' => array(
+ 'testarray2' => false,
+ ),
+ 'test4' => array(
+ 'clobbered3' => array(0, 1, 2),
+ ),
);
$array3 = array(array(array(array())));
@@ -42,11 +42,15 @@ $data = array_replace_recursive($array1, $array2);
var_dump($data);
echo " -- Testing array_replace_recursive() w/ endless recusrsion --\n";
-$data = array_replace_recursive($array3, $array4);
+try {
+ $data = array_replace_recursive($array3, $array4);
+ var_dump($data);
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
-var_dump($data);
?>
---EXPECTF--
+--EXPECT--
-- Testing array_replace() --
array(5) {
[0]=>
@@ -107,16 +111,4 @@ array(5) {
}
}
-- Testing array_replace_recursive() w/ endless recusrsion --
-
-Warning: array_replace_recursive(): recursion detected in %s on line %d
-array(1) {
- [0]=>
- array(1) {
- [0]=>
- array(1) {
- [0]=>
- array(0) {
- }
- }
- }
-}
+Recursion detected
diff --git a/ext/standard/tests/array/array_reverse_variation3.phpt b/ext/standard/tests/array/array_reverse_variation3.phpt
index a5ef1e0d2b..7500719693 100644
--- a/ext/standard/tests/array/array_reverse_variation3.phpt
+++ b/ext/standard/tests/array/array_reverse_variation3.phpt
@@ -57,7 +57,7 @@ $arrays = array (
array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true),
array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6),
- // array with repetative keys
+ // array with repetitive keys
/*18*/ array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3)
);
diff --git a/ext/standard/tests/array/array_reverse_variation4.phpt b/ext/standard/tests/array/array_reverse_variation4.phpt
index 09b2eb4bee..21cced1703 100644
--- a/ext/standard/tests/array/array_reverse_variation4.phpt
+++ b/ext/standard/tests/array/array_reverse_variation4.phpt
@@ -54,10 +54,10 @@ $arrays = array (
array("hello", $heredoc => "string"), // heredoc
// array with object, unset variable and resource variable
- array(new classA() => 11, @$unset_var => "hello", $fp => 'resource'),
+ array(@$unset_var => "hello", $fp => 'resource'),
// array with mixed values
-/*11*/ array('hello' => 1, new classA() => 2, "fruit" => 2.2, $fp => 'resource', 133 => "int", 444.432 => "float", @$unset_var => "unset", $heredoc => "heredoc")
+/*11*/ array('hello' => 1, "fruit" => 2.2, $fp => 'resource', 133 => "int", 444.432 => "float", @$unset_var => "unset", $heredoc => "heredoc")
);
// loop through the various elements of $arrays to test array_reverse()
@@ -83,13 +83,9 @@ echo "Done";
--EXPECTF--
*** Testing array_reverse() : usage variations ***
-Warning: Illegal offset type in %s on line %d
+Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
-Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
-
-Warning: Illegal offset type in %s on line %d
-
-Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
+Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
-- Iteration 1 --
- default argument -
array(0) {
diff --git a/ext/standard/tests/array/array_search1.phpt b/ext/standard/tests/array/array_search1.phpt
index 49563f9712..10c1672e54 100644
--- a/ext/standard/tests/array/array_search1.phpt
+++ b/ext/standard/tests/array/array_search1.phpt
@@ -5,8 +5,6 @@ array_search() tests
$a = array(1=>0, 2=>1, 4=>3, "a"=>"b", "c"=>"d");
-var_dump(array_search(1));
-var_dump(array_search(1,1));
var_dump(array_search("a",$a));
var_dump(array_search("0",$a, true));
var_dump(array_search("0",$a));
@@ -18,12 +16,7 @@ var_dump(array_search(-1,$a, true));
echo "Done\n";
?>
---EXPECTF--
-Warning: array_search() expects at least 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: array_search() expects parameter 2 to be array, int given in %s on line %d
-NULL
+--EXPECT--
int(1)
bool(false)
int(1)
diff --git a/ext/standard/tests/array/array_search_variation3.phpt b/ext/standard/tests/array/array_search_variation3.phpt
index 41b0b5bb20..596c36f805 100644
--- a/ext/standard/tests/array/array_search_variation3.phpt
+++ b/ext/standard/tests/array/array_search_variation3.phpt
@@ -33,9 +33,17 @@ class array_search_check {
$array_search_obj = new array_search_check(); //creating new object
//error: as wrong datatype for second argument
-var_dump( array_search("array_var", $array_search_obj) );
+try {
+ var_dump( array_search("array_var", $array_search_obj) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
//error: as wrong datatype for second argument
-var_dump( array_search("foo", $array_search_obj) );
+try {
+ var_dump( array_search("foo", $array_search_obj) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
//element found as "one" exists in array $array_var
var_dump( array_search("one", $array_search_obj->array_var) );
@@ -48,11 +56,7 @@ string(5) "three"
int(5)
*** Testing objects with array_search() ***
-
-Warning: array_search() expects parameter 2 to be array, object given in %s on line %d
-NULL
-
-Warning: array_search() expects parameter 2 to be array, object given in %s on line %d
-NULL
+array_search() expects parameter 2 to be array, object given
+array_search() expects parameter 2 to be array, object given
int(1)
Done
diff --git a/ext/standard/tests/array/array_search_variation4.phpt b/ext/standard/tests/array/array_search_variation4.phpt
index f9b55dfe4d..0f5e29ecfc 100644
--- a/ext/standard/tests/array/array_search_variation4.phpt
+++ b/ext/standard/tests/array/array_search_variation4.phpt
@@ -19,7 +19,7 @@ $dir_handle = opendir( __DIR__ );
//store resources in array for comparison.
$resources = array($file_handle, $dir_handle);
-// search for resouce type in the resource array
+// search for resource type in the resource array
var_dump( array_search($file_handle, $resources, true) );
//checking for (int) type resource
var_dump( array_search((int)$dir_handle, $resources, true) );
diff --git a/ext/standard/tests/array/array_shift_variation2.phpt b/ext/standard/tests/array/array_shift_variation2.phpt
index 9e37cbb204..fae2e06e0f 100644
--- a/ext/standard/tests/array/array_shift_variation2.phpt
+++ b/ext/standard/tests/array/array_shift_variation2.phpt
@@ -39,7 +39,7 @@ $inputs = array(
// int data
/*1*/ 'int' => array(
- 0,
+ 0,
1,
12345,
-2345,
diff --git a/ext/standard/tests/array/array_slice.phpt b/ext/standard/tests/array/array_slice.phpt
index 59d804350b..d19f5195d6 100644
--- a/ext/standard/tests/array/array_slice.phpt
+++ b/ext/standard/tests/array/array_slice.phpt
@@ -20,26 +20,6 @@ $var_array = array(
$num = 4;
$str = "john";
-/* Zero args */
-echo"\n*** Output for Zero Argument ***\n";
-array_slice();
-
-/* Single args */
-echo"\n*** Output for Single array Argument ***\n";
-array_slice($var_array);
-
-/* More than valid no. of args (ie. >4 ) */
-echo"\n*** Output for invalid number of Arguments ***\n";
-array_slice($var_array, 2, 4, true, 3);
-
-/* Scalar arg */
-echo"\n*** Output for scalar Argument ***\n";
-array_slice($num, 2);
-
-/* String arg */
-echo"\n*** Output for string Argument ***\n";
-array_slice($str, 2);
-
$counter = 1;
foreach ($var_array as $sub_array)
{
@@ -89,26 +69,6 @@ foreach ($var_array as $sub_array)
?>
--EXPECTF--
-*** Output for Zero Argument ***
-
-Warning: array_slice() expects at least 2 parameters, 0 given in %s on line %d
-
-*** Output for Single array Argument ***
-
-Warning: array_slice() expects at least 2 parameters, 1 given in %s on line %d
-
-*** Output for invalid number of Arguments ***
-
-Warning: array_slice() expects at most 4 parameters, 5 given in %s on line %d
-
-*** Output for scalar Argument ***
-
-Warning: array_slice() expects parameter 1 to be array, int given in %s on line %d
-
-*** Output for string Argument ***
-
-Warning: array_slice() expects parameter 1 to be array, string given in %s on line %d
-
*** Iteration 1 ***
*** Variation with first two Arguments ***
diff --git a/ext/standard/tests/array/array_slice_variation1.phpt b/ext/standard/tests/array/array_slice_variation1.phpt
index 7b6d712a1f..46f33b9503 100644
--- a/ext/standard/tests/array/array_slice_variation1.phpt
+++ b/ext/standard/tests/array/array_slice_variation1.phpt
@@ -15,12 +15,20 @@ var_dump(array_slice(range(1, 3), -1, NULL, 1));
$a = 'foo';
-var_dump(array_slice(range(1, 3), 0, $a));
-var_dump(array_slice(range(1, 3), 0, $a));
+try {
+ var_dump(array_slice(range(1, 3), 0, $a));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(array_slice(range(1, 3), 0, $a));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump($a);
?>
---EXPECT--
+--EXPECTF--
array(3) {
[0]=>
int(1)
@@ -53,8 +61,6 @@ array(1) {
[2]=>
int(3)
}
-array(0) {
-}
-array(0) {
-}
+array_slice() expects parameter 3 to be int, string given
+array_slice() expects parameter 3 to be int, string given
string(3) "foo"
diff --git a/ext/standard/tests/array/array_slice_variation11.phpt b/ext/standard/tests/array/array_slice_variation11.phpt
new file mode 100644
index 0000000000..aaffcd4251
--- /dev/null
+++ b/ext/standard/tests/array/array_slice_variation11.phpt
@@ -0,0 +1,105 @@
+--TEST--
+Test array_slice() function : usage variations - array has holes in buckets
+--FILE--
+<?php
+/* Prototype : array array_slice(array $input, int $offset [, int $length [, bool $preserve_keys]])
+ * Description: Returns elements specified by offset and length
+ * Source code: ext/standard/array.c
+ */
+
+/*
+ * Check that results of array_slice are correct when there are holes in buckets caused by unset()
+ */
+
+echo "*** Testing array_slice() : usage variations ***\n";
+
+function dump_slice(array $input, $offsetToUnset, int $offset, int $length) {
+ unset($input[$offsetToUnset]);
+ var_dump(array_slice($input, $offset, $length));
+}
+
+echo "\n-- Call array_slice() on array with string keys--\n";
+$input = ['one' => 'un', 'two' => 'deux', 23 => 'twenty-three', 'zero'];
+dump_slice($input, 'two', 0, 1);
+dump_slice($input, 'two', 0, 2);
+dump_slice($input, 'two', 0, 3);
+dump_slice($input, 23, 1, 2);
+
+echo "\n-- Call array_slice() on array with packed keys--\n";
+$input = [10, 11, 12, 'thirteen'];
+dump_slice($input, 0, 0, 1);
+dump_slice($input, 1, 0, 1);
+dump_slice($input, 1, 0, 3);
+dump_slice($input, 1, -1, 1);
+dump_slice($input, 1, 0, 3);
+dump_slice($input, 1, -3, 3);
+
+echo "Done";
+?>
+--EXPECT--
+*** Testing array_slice() : usage variations ***
+
+-- Call array_slice() on array with string keys--
+array(1) {
+ ["one"]=>
+ string(2) "un"
+}
+array(2) {
+ ["one"]=>
+ string(2) "un"
+ [0]=>
+ string(12) "twenty-three"
+}
+array(3) {
+ ["one"]=>
+ string(2) "un"
+ [0]=>
+ string(12) "twenty-three"
+ [1]=>
+ string(4) "zero"
+}
+array(2) {
+ ["two"]=>
+ string(4) "deux"
+ [0]=>
+ string(4) "zero"
+}
+
+-- Call array_slice() on array with packed keys--
+array(1) {
+ [0]=>
+ int(11)
+}
+array(1) {
+ [0]=>
+ int(10)
+}
+array(3) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(12)
+ [2]=>
+ string(8) "thirteen"
+}
+array(1) {
+ [0]=>
+ string(8) "thirteen"
+}
+array(3) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(12)
+ [2]=>
+ string(8) "thirteen"
+}
+array(3) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(12)
+ [2]=>
+ string(8) "thirteen"
+}
+Done
diff --git a/ext/standard/tests/array/array_slice_variation2.phpt b/ext/standard/tests/array/array_slice_variation2.phpt
deleted file mode 100644
index a76d68e6e0..0000000000
--- a/ext/standard/tests/array/array_slice_variation2.phpt
+++ /dev/null
@@ -1,303 +0,0 @@
---TEST--
-Test array_slice() function : usage variations - Pass different data types as $offset arg
---SKIPIF--
-<?php if (PHP_INT_SIZE > 4) die("skip this test is for 32bit platform only"); ?>
---FILE--
-<?php
-/* Prototype : array array_slice(array $input, int $offset [, int $length [, bool $preserve_keys]])
- * Description: Returns elements specified by offset and length
- * Source code: ext/standard/array.c
- */
-
-/*
- * Pass different data types as $offset argument to array_slice() to test behaviour
- */
-
-echo "*** Testing array_slice() : usage variations ***\n";
-
-// Initialise function arguments not being substituted
-$input_array = array('one' => 1, 2, 'three' => 3, 4);
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-// get a class
-class classA
-{
- public function __toString() {
- return "Class A object";
- }
-}
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-// get a resource variable
-$fp = fopen(__FILE__, "r");
-
-// unexpected values to be passed to $offset argument
-$inputs = array(
-
- // int data
-/*1*/ 0,
- 1,
- 12345,
- -2345,
-
- // float data
-/*5*/ 10.5,
- -10.5,
- 12.3456789000e10,
- 12.3456789000E-10,
- .5,
-
- // null data
-/*10*/ NULL,
- null,
-
- // boolean data
-/*12*/ true,
- false,
- TRUE,
- FALSE,
-
- // empty data
-/*16*/ "",
- '',
- array(),
-
- // string data
-/*19*/ "string",
- 'string',
- $heredoc,
-
- // undefined data
-/*22*/ @$undefined_var,
-
- // unset data
-/*23*/ @$unset_var,
-);
-
-// loop through each element of $inputs to check the behavior of array_slice()
-$iterator = 1;
-foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump( array_slice($input_array, $input) );
- $iterator++;
-};
-
-fclose($fp);
-
-echo "Done";
-?>
---EXPECTF--
-*** Testing array_slice() : usage variations ***
-
--- Iteration 1 --
-array(4) {
- ["one"]=>
- int(1)
- [0]=>
- int(2)
- ["three"]=>
- int(3)
- [1]=>
- int(4)
-}
-
--- Iteration 2 --
-array(3) {
- [0]=>
- int(2)
- ["three"]=>
- int(3)
- [1]=>
- int(4)
-}
-
--- Iteration 3 --
-array(0) {
-}
-
--- Iteration 4 --
-array(4) {
- ["one"]=>
- int(1)
- [0]=>
- int(2)
- ["three"]=>
- int(3)
- [1]=>
- int(4)
-}
-
--- Iteration 5 --
-array(0) {
-}
-
--- Iteration 6 --
-array(4) {
- ["one"]=>
- int(1)
- [0]=>
- int(2)
- ["three"]=>
- int(3)
- [1]=>
- int(4)
-}
-
--- Iteration 7 --
-
-Warning: array_slice() expects parameter 2 to be int, float given in %s on line %d
-NULL
-
--- Iteration 8 --
-array(4) {
- ["one"]=>
- int(1)
- [0]=>
- int(2)
- ["three"]=>
- int(3)
- [1]=>
- int(4)
-}
-
--- Iteration 9 --
-array(4) {
- ["one"]=>
- int(1)
- [0]=>
- int(2)
- ["three"]=>
- int(3)
- [1]=>
- int(4)
-}
-
--- Iteration 10 --
-array(4) {
- ["one"]=>
- int(1)
- [0]=>
- int(2)
- ["three"]=>
- int(3)
- [1]=>
- int(4)
-}
-
--- Iteration 11 --
-array(4) {
- ["one"]=>
- int(1)
- [0]=>
- int(2)
- ["three"]=>
- int(3)
- [1]=>
- int(4)
-}
-
--- Iteration 12 --
-array(3) {
- [0]=>
- int(2)
- ["three"]=>
- int(3)
- [1]=>
- int(4)
-}
-
--- Iteration 13 --
-array(4) {
- ["one"]=>
- int(1)
- [0]=>
- int(2)
- ["three"]=>
- int(3)
- [1]=>
- int(4)
-}
-
--- Iteration 14 --
-array(3) {
- [0]=>
- int(2)
- ["three"]=>
- int(3)
- [1]=>
- int(4)
-}
-
--- Iteration 15 --
-array(4) {
- ["one"]=>
- int(1)
- [0]=>
- int(2)
- ["three"]=>
- int(3)
- [1]=>
- int(4)
-}
-
--- Iteration 16 --
-
-Warning: array_slice() expects parameter 2 to be int, string given in %s on line %d
-NULL
-
--- Iteration 17 --
-
-Warning: array_slice() expects parameter 2 to be int, string given in %s on line %d
-NULL
-
--- Iteration 18 --
-
-Warning: array_slice() expects parameter 2 to be int, array given in %s on line %d
-NULL
-
--- Iteration 19 --
-
-Warning: array_slice() expects parameter 2 to be int, string given in %s on line %d
-NULL
-
--- Iteration 20 --
-
-Warning: array_slice() expects parameter 2 to be int, string given in %s on line %d
-NULL
-
--- Iteration 21 --
-
-Warning: array_slice() expects parameter 2 to be int, string given in %s on line %d
-NULL
-
--- Iteration 22 --
-array(4) {
- ["one"]=>
- int(1)
- [0]=>
- int(2)
- ["three"]=>
- int(3)
- [1]=>
- int(4)
-}
-
--- Iteration 23 --
-array(4) {
- ["one"]=>
- int(1)
- [0]=>
- int(2)
- ["three"]=>
- int(3)
- [1]=>
- int(4)
-}
-Done
diff --git a/ext/standard/tests/array/array_slice_variation5.phpt b/ext/standard/tests/array/array_slice_variation5.phpt
index 5f127fd2eb..06f79c7168 100644
--- a/ext/standard/tests/array/array_slice_variation5.phpt
+++ b/ext/standard/tests/array/array_slice_variation5.phpt
@@ -16,8 +16,8 @@ echo "*** Testing array_slice() : usage variations ***\n";
$input = array ('one' => 1, 2 => 'two', 'three', 9 => 'nine', 'ten' => 10);
for ($i = -7; $i <= 7; $i++) {
- echo "\n-- \$offset is $i --\n";
- var_dump(array_slice($input, $i));
+ echo "\n-- \$offset is $i --\n";
+ var_dump(array_slice($input, $i));
}
echo "\n-- \$offset is maximum integer value --\n";
var_dump(array_slice($input, PHP_INT_MAX));
diff --git a/ext/standard/tests/array/array_slice_variation6.phpt b/ext/standard/tests/array/array_slice_variation6.phpt
index 86bde4ae3c..b54cd1a16b 100644
--- a/ext/standard/tests/array/array_slice_variation6.phpt
+++ b/ext/standard/tests/array/array_slice_variation6.phpt
@@ -17,8 +17,8 @@ $input = array ('one' => 1, 2 => 'two', 'three', 9 => 'nine', 'ten' => 10);
$offset = 1;
for ($i = -6; $i <= 6; $i++) {
- echo "\n-- \$length is $i --\n";
- var_dump(array_slice($input, $offset, $i));
+ echo "\n-- \$length is $i --\n";
+ var_dump(array_slice($input, $offset, $i));
}
echo "\n-- \$length is maximum integer value --\n";
var_dump(array_slice($input, $offset, PHP_INT_MAX));
diff --git a/ext/standard/tests/array/array_splice_basic.phpt b/ext/standard/tests/array/array_splice_basic.phpt
index 9a96ccb362..cf6fcd1db2 100644
--- a/ext/standard/tests/array/array_splice_basic.phpt
+++ b/ext/standard/tests/array/array_splice_basic.phpt
@@ -14,6 +14,12 @@ var_dump (array_splice($input, 2));
var_dump ($input);
// $input is now array("red", "green")
+echo "test truncation with null length \n";
+$input = array("red", "green", "blue", "yellow");
+var_dump (array_splice($input, 2, null));
+var_dump ($input);
+// $input is now array("red", "green")
+
echo "test removing entries from the middle \n";
$input = array("red", "green", "blue", "yellow");
var_dump (array_splice($input, 1, -1));
@@ -56,6 +62,19 @@ array(2) {
[1]=>
string(5) "green"
}
+test truncation with null length
+array(2) {
+ [0]=>
+ string(4) "blue"
+ [1]=>
+ string(6) "yellow"
+}
+array(2) {
+ [0]=>
+ string(3) "red"
+ [1]=>
+ string(5) "green"
+}
test removing entries from the middle
array(2) {
[0]=>
diff --git a/ext/standard/tests/array/array_splice_variation3.phpt b/ext/standard/tests/array/array_splice_variation3.phpt
index b5a55ca144..d5f76ac805 100644
--- a/ext/standard/tests/array/array_splice_variation3.phpt
+++ b/ext/standard/tests/array/array_splice_variation3.phpt
@@ -12,14 +12,14 @@ echo "*** array_splice() function : usage variations - lengths and offsets\n";
function test_splice ($offset, $length)
{
- echo " - No replacement\n";
- $input_array=array(0,1,2,3,4,5);
- var_dump (array_splice ($input_array,$offset,$length));
- var_dump ($input_array);
+ echo " - No replacement\n";
+ $input_array=array(0,1,2,3,4,5);
+ var_dump (array_splice ($input_array,$offset,$length));
+ var_dump ($input_array);
echo " - With replacement\n";
$input_array=array(0,1,2,3,4,5);
var_dump (array_splice ($input_array,$offset,$length,array ("A","B","C")));
- var_dump ($input_array);
+ var_dump ($input_array);
}
echo "absolute offset - absolute length - cut from beginning\n";
diff --git a/ext/standard/tests/array/array_splice_variation4.phpt b/ext/standard/tests/array/array_splice_variation4.phpt
index ddd966780e..06eecdf005 100644
--- a/ext/standard/tests/array/array_splice_variation4.phpt
+++ b/ext/standard/tests/array/array_splice_variation4.phpt
@@ -9,9 +9,9 @@ Test array_splice() function : usage variations - non array replacement values
function test_splice ($replacement)
{
- $input_array=array(0,1);
- var_dump (array_splice ($input_array,2,0,$replacement));
- var_dump ($input_array);
+ $input_array=array(0,1);
+ var_dump (array_splice ($input_array,2,0,$replacement));
+ var_dump ($input_array);
}
test_splice (2);
diff --git a/ext/standard/tests/array/array_sum.phpt b/ext/standard/tests/array/array_sum.phpt
index 08aec2155e..9ba80beba6 100644
--- a/ext/standard/tests/array/array_sum.phpt
+++ b/ext/standard/tests/array/array_sum.phpt
@@ -7,8 +7,8 @@ memory_limit=128M
<?php
$i = 0;
while ($i++ < 1000) {
- $a[] = $i;
- $b[] = (string)$i;
+ $a[] = $i;
+ $b[] = (string)$i;
}
$s1 = array_sum($a);
$s2 = array_sum($b);
@@ -16,8 +16,8 @@ var_dump($s1, $s2);
$j = 0;
while ($j++ < 100000) {
- $c[] = $j;
- $d[] = (string) $j;
+ $c[] = $j;
+ $d[] = (string) $j;
}
$s3 = array_sum($c);
$s4 = array_sum($d);
diff --git a/ext/standard/tests/array/array_udiff_assoc_variation.phpt b/ext/standard/tests/array/array_udiff_assoc_variation.phpt
index eca26a30e6..b71449b259 100644
--- a/ext/standard/tests/array/array_udiff_assoc_variation.phpt
+++ b/ext/standard/tests/array/array_udiff_assoc_variation.phpt
@@ -24,7 +24,6 @@ var_dump( array_udiff_assoc($arr1, $arr2, $arr3, $arr4, $key_compare_function) )
?>
-===DONE===
--EXPECT--
*** Testing array_udiff_assoc() : variation - testing with multiple array arguments ***
array(2) {
@@ -33,4 +32,3 @@ array(2) {
["0.5"]=>
int(5)
}
-===DONE===
diff --git a/ext/standard/tests/array/array_udiff_assoc_variation1.phpt b/ext/standard/tests/array/array_udiff_assoc_variation1.phpt
index 2cbc9572d2..76dd2972c5 100644
--- a/ext/standard/tests/array/array_udiff_assoc_variation1.phpt
+++ b/ext/standard/tests/array/array_udiff_assoc_variation1.phpt
@@ -23,9 +23,9 @@ unset ($unset_var);
// define some classes
class classWithToString
{
- public function __toString() {
- return "Class A object";
- }
+ public function __toString() {
+ return "Class A object";
+ }
}
class classWithoutToString
@@ -91,137 +91,89 @@ $inputs = array(
// loop through each element of the array for arr1
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_udiff_assoc($value, $arr2, $key_comp_func) );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_udiff_assoc($value, $arr2, $key_comp_func) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
?>
-===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_udiff_assoc() : usage variation ***
--int 0--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, int given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--int 1--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, int given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--int 12345--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, int given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--int -12345--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, int given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--float 10.5--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, float given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float -10.5--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, float given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, float given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, float given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float .5--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, float given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--uppercase NULL--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, null given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, null given
--lowercase null--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, null given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, null given
--lowercase true--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, bool given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--lowercase false--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, bool given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, bool given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, bool given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--empty string DQ--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--empty string SQ--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--string DQ--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--string SQ--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--mixed case string--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--heredoc--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--instance of classWithToString--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, object given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, object given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, object given
--undefined var--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, null given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, null given
--unset var--
-
-Warning: array_udiff_assoc(): Expected parameter 1 to be an array, null given in %sarray_udiff_assoc_variation1.php on line %d
-NULL
-===DONE===
+Expected parameter 1 to be an array, null given
diff --git a/ext/standard/tests/array/array_udiff_assoc_variation2.phpt b/ext/standard/tests/array/array_udiff_assoc_variation2.phpt
index 1a2c1ed978..9b84e8d489 100644
--- a/ext/standard/tests/array/array_udiff_assoc_variation2.phpt
+++ b/ext/standard/tests/array/array_udiff_assoc_variation2.phpt
@@ -23,9 +23,9 @@ unset ($unset_var);
// define some classes
class classWithToString
{
- public function __toString() {
- return "Class A object";
- }
+ public function __toString() {
+ return "Class A object";
+ }
}
class classWithoutToString
@@ -91,137 +91,89 @@ $inputs = array(
// loop through each element of the array for arr2
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_udiff_assoc($arr1, $value, $key_comp_func) );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_udiff_assoc($arr1, $value, $key_comp_func) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
?>
-===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_udiff_assoc() : usage variation ***
--int 0--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, int given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--int 1--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, int given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--int 12345--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, int given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--int -12345--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, int given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--float 10.5--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, float given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float -10.5--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, float given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, float given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, float given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float .5--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, float given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--uppercase NULL--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, null given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, null given
--lowercase null--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, null given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, null given
--lowercase true--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, bool given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--lowercase false--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, bool given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, bool given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, bool given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--empty string DQ--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--empty string SQ--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--string DQ--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--string SQ--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--mixed case string--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--heredoc--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--instance of classWithToString--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, object given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, object given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, object given
--undefined var--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, null given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, null given
--unset var--
-
-Warning: array_udiff_assoc(): Expected parameter 2 to be an array, null given in %sarray_udiff_assoc_variation2.php on line %d
-NULL
-===DONE===
+Expected parameter 2 to be an array, null given
diff --git a/ext/standard/tests/array/array_udiff_assoc_variation4.phpt b/ext/standard/tests/array/array_udiff_assoc_variation4.phpt
deleted file mode 100644
index 20a5afa202..0000000000
--- a/ext/standard/tests/array/array_udiff_assoc_variation4.phpt
+++ /dev/null
@@ -1,228 +0,0 @@
---TEST--
-Test array_udiff_assoc() function : usage variation
---FILE--
-<?php
-/* Prototype : array array_udiff_assoc(array arr1, array arr2 [, array ...], callback key_comp_func)
- * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys are compared by user supplied function.
- * Source code: ext/standard/array.c
- * Alias to functions:
- */
-
-echo "*** Testing array_udiff_assoc() : usage variation ***\n";
-
-// Initialise function arguments not being substituted (if any)
-$arr1 = array(1, 2);
-$arr2 = array(1, 2);
-
-include('compare_function.inc');
-$key_comp_func = 'compare_function';
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-// define some classes
-class classWithToString
-{
- public function __toString() {
- return "Class A object";
- }
-}
-
-class classWithoutToString
-{
-}
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-// add arrays
-$index_array = array (1, 2, 3);
-$assoc_array = array ('one' => 1, 'two' => 2);
-
-//array of values to iterate over
-$inputs = array(
-
- // int data
- 'int 0' => 0,
- 'int 1' => 1,
- 'int 12345' => 12345,
- 'int -12345' => -2345,
-
- // float data
- 'float 10.5' => 10.5,
- 'float -10.5' => -10.5,
- 'float 12.3456789000e10' => 12.3456789000e10,
- 'float -12.3456789000e10' => -12.3456789000e10,
- 'float .5' => .5,
-
- // null data
- 'uppercase NULL' => NULL,
- 'lowercase null' => null,
-
- // boolean data
- 'lowercase true' => true,
- 'lowercase false' =>false,
- 'uppercase TRUE' =>TRUE,
- 'uppercase FALSE' =>FALSE,
-
- // empty data
- 'empty string DQ' => "",
- 'empty string SQ' => '',
-
- // string data
- 'string DQ' => "string",
- 'string SQ' => 'string',
- 'mixed case string' => "sTrInG",
- 'heredoc' => $heredoc,
-
- // object data
- 'instance of classWithToString' => new classWithToString(),
- 'instance of classWithoutToString' => new classWithoutToString(),
-
- // undefined data
- 'undefined var' => @$undefined_var,
-
- // unset data
- 'unset var' => @$unset_var,
-);
-
-// loop through each element of the array for ...
-
-foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_udiff_assoc($arr1, $arr2, $value, $key_comp_func) );
-};
-
-?>
-===DONE===
---EXPECTF--
-*** Testing array_udiff_assoc() : usage variation ***
-
---int 0--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, int given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---int 1--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, int given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---int 12345--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, int given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---int -12345--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, int given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---float 10.5--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, float given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---float -10.5--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, float given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---float 12.3456789000e10--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, float given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---float -12.3456789000e10--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, float given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---float .5--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, float given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---uppercase NULL--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, null given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---lowercase null--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, null given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---lowercase true--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, bool given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---lowercase false--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, bool given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---uppercase TRUE--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, bool given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---uppercase FALSE--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, bool given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---empty string DQ--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---empty string SQ--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---string DQ--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---string SQ--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---mixed case string--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---heredoc--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---instance of classWithToString--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, object given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---instance of classWithoutToString--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, object given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---undefined var--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, null given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-
---unset var--
-
-Warning: array_udiff_assoc(): Expected parameter 3 to be an array, null given in %sarray_udiff_assoc_variation4.php on line %d
-NULL
-===DONE===
diff --git a/ext/standard/tests/array/array_udiff_assoc_variation5.phpt b/ext/standard/tests/array/array_udiff_assoc_variation5.phpt
index 10afe341a3..bfed60d30d 100644
--- a/ext/standard/tests/array/array_udiff_assoc_variation5.phpt
+++ b/ext/standard/tests/array/array_udiff_assoc_variation5.phpt
@@ -25,9 +25,9 @@ function too_many_parameters ($val1, $val2, $val3) {
return 1;
}
try {
- var_dump(array_udiff_assoc($arr1, $arr2, 'too_many_parameters'));
+ var_dump(array_udiff_assoc($arr1, $arr2, 'too_many_parameters'));
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
echo "\n-- comparison function taking too few parameters --\n";
@@ -37,7 +37,6 @@ function too_few_parameters ($val1) {
var_dump(array_udiff_assoc($arr1, $arr2, 'too_few_parameters'));
?>
-===DONE===
--EXPECT--
*** Testing array_udiff_assoc() : usage variation - differing comparison functions***
@@ -55,4 +54,3 @@ array(1) {
[0]=>
int(1)
}
-===DONE===
diff --git a/ext/standard/tests/array/array_udiff_uassoc_variation1.phpt b/ext/standard/tests/array/array_udiff_uassoc_variation1.phpt
index 4496194b62..e59012cbb6 100644
--- a/ext/standard/tests/array/array_udiff_uassoc_variation1.phpt
+++ b/ext/standard/tests/array/array_udiff_uassoc_variation1.phpt
@@ -24,9 +24,9 @@ unset ($unset_var);
// define some classes
class classWithToString
{
- public function __toString() {
- return "Class A object";
- }
+ public function __toString() {
+ return "Class A object";
+ }
}
class classWithoutToString
@@ -92,137 +92,89 @@ $inputs = array(
// loop through each element of the array for arr1
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_udiff_uassoc($value, $arr2, $data_comp_func, $key_comp_func) );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_udiff_uassoc($value, $arr2, $data_comp_func, $key_comp_func) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
?>
-===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_udiff_uassoc() : usage variation ***
--int 0--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, int given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--int 1--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, int given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--int 12345--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, int given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--int -12345--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, int given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--float 10.5--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, float given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float -10.5--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, float given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, float given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, float given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float .5--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, float given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--uppercase NULL--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, null given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, null given
--lowercase null--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, null given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, null given
--lowercase true--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, bool given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--lowercase false--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, bool given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, bool given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, bool given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--empty string DQ--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--empty string SQ--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--string DQ--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--string SQ--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--mixed case string--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--heredoc--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, string given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--instance of classWithToString--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, object given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, object given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, object given
--undefined var--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, null given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, null given
--unset var--
-
-Warning: array_udiff_uassoc(): Expected parameter 1 to be an array, null given in %sarray_udiff_uassoc_variation1.php on line %d
-NULL
-===DONE===
+Expected parameter 1 to be an array, null given
diff --git a/ext/standard/tests/array/array_udiff_uassoc_variation2.phpt b/ext/standard/tests/array/array_udiff_uassoc_variation2.phpt
index 2324c5a47b..ee7cf405dc 100644
--- a/ext/standard/tests/array/array_udiff_uassoc_variation2.phpt
+++ b/ext/standard/tests/array/array_udiff_uassoc_variation2.phpt
@@ -24,9 +24,9 @@ unset ($unset_var);
// define some classes
class classWithToString
{
- public function __toString() {
- return "Class A object";
- }
+ public function __toString() {
+ return "Class A object";
+ }
}
class classWithoutToString
@@ -92,137 +92,89 @@ $inputs = array(
// loop through each element of the array for arr2
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_udiff_uassoc($arr1, $value, $data_comp_func, $key_comp_func) );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_udiff_uassoc($arr1, $value, $data_comp_func, $key_comp_func) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
?>
-===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_udiff_uassoc() : usage variation ***
--int 0--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, int given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--int 1--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, int given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--int 12345--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, int given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--int -12345--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, int given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--float 10.5--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, float given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float -10.5--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, float given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, float given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, float given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float .5--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, float given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--uppercase NULL--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, null given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, null given
--lowercase null--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, null given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, null given
--lowercase true--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, bool given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--lowercase false--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, bool given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, bool given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, bool given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--empty string DQ--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--empty string SQ--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--string DQ--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--string SQ--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--mixed case string--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--heredoc--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, string given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--instance of classWithToString--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, object given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, object given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, object given
--undefined var--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, null given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, null given
--unset var--
-
-Warning: array_udiff_uassoc(): Expected parameter 2 to be an array, null given in %sarray_udiff_uassoc_variation2.php on line %d
-NULL
-===DONE===
+Expected parameter 2 to be an array, null given
diff --git a/ext/standard/tests/array/array_udiff_uassoc_variation5.phpt b/ext/standard/tests/array/array_udiff_uassoc_variation5.phpt
deleted file mode 100644
index 820f0466ad..0000000000
--- a/ext/standard/tests/array/array_udiff_uassoc_variation5.phpt
+++ /dev/null
@@ -1,229 +0,0 @@
---TEST--
-Test array_udiff_uassoc() function : usage variation
---FILE--
-<?php
-/* Prototype : array array_udiff_uassoc(array arr1, array arr2 [, array ...], callback data_comp_func, callback key_comp_func)
- * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys and elements are compared by user supplied functions.
- * Source code: ext/standard/array.c
- * Alias to functions:
- */
-
-echo "*** Testing array_udiff_uassoc() : usage variation ***\n";
-
-// Initialise function arguments not being substituted (if any)
-$arr1 = array(1, 2);
-$arr2 = array(1, 2);
-
-include('compare_function.inc');
-$data_comp_func = 'compare_function';
-$key_comp_func = 'compare_function';
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-// define some classes
-class classWithToString
-{
- public function __toString() {
- return "Class A object";
- }
-}
-
-class classWithoutToString
-{
-}
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-// add arrays
-$index_array = array (1, 2, 3);
-$assoc_array = array ('one' => 1, 'two' => 2);
-
-//array of values to iterate over
-$inputs = array(
-
- // int data
- 'int 0' => 0,
- 'int 1' => 1,
- 'int 12345' => 12345,
- 'int -12345' => -2345,
-
- // float data
- 'float 10.5' => 10.5,
- 'float -10.5' => -10.5,
- 'float 12.3456789000e10' => 12.3456789000e10,
- 'float -12.3456789000e10' => -12.3456789000e10,
- 'float .5' => .5,
-
- // null data
- 'uppercase NULL' => NULL,
- 'lowercase null' => null,
-
- // boolean data
- 'lowercase true' => true,
- 'lowercase false' =>false,
- 'uppercase TRUE' =>TRUE,
- 'uppercase FALSE' =>FALSE,
-
- // empty data
- 'empty string DQ' => "",
- 'empty string SQ' => '',
-
- // string data
- 'string DQ' => "string",
- 'string SQ' => 'string',
- 'mixed case string' => "sTrInG",
- 'heredoc' => $heredoc,
-
- // object data
- 'instance of classWithToString' => new classWithToString(),
- 'instance of classWithoutToString' => new classWithoutToString(),
-
- // undefined data
- 'undefined var' => @$undefined_var,
-
- // unset data
- 'unset var' => @$unset_var,
-);
-
-// loop through each element of the array for ...
-
-foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_udiff_uassoc($arr1, $arr2, $value, $data_comp_func, $key_comp_func) );
-};
-
-?>
-===DONE===
---EXPECTF--
-*** Testing array_udiff_uassoc() : usage variation ***
-
---int 0--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, int given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---int 1--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, int given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---int 12345--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, int given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---int -12345--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, int given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---float 10.5--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, float given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---float -10.5--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, float given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---float 12.3456789000e10--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, float given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---float -12.3456789000e10--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, float given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---float .5--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, float given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---uppercase NULL--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, null given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---lowercase null--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, null given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---lowercase true--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, bool given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---lowercase false--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, bool given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---uppercase TRUE--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, bool given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---uppercase FALSE--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, bool given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---empty string DQ--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---empty string SQ--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---string DQ--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---string SQ--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---mixed case string--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---heredoc--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, string given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---instance of classWithToString--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, object given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---instance of classWithoutToString--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, object given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---undefined var--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, null given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-
---unset var--
-
-Warning: array_udiff_uassoc(): Expected parameter 3 to be an array, null given in %sarray_udiff_uassoc_variation5.php on line %d
-NULL
-===DONE===
diff --git a/ext/standard/tests/array/array_udiff_uassoc_variation6.phpt b/ext/standard/tests/array/array_udiff_uassoc_variation6.phpt
index 4939b8eba5..2c917014ca 100644
--- a/ext/standard/tests/array/array_udiff_uassoc_variation6.phpt
+++ b/ext/standard/tests/array/array_udiff_uassoc_variation6.phpt
@@ -24,9 +24,9 @@ function too_many_parameters ($val1, $val2, $val3) {
return 1;
}
try {
- var_dump(array_udiff_uassoc($arr1, $arr2, 'too_many_parameters', 'too_many_parameters'));
+ var_dump(array_udiff_uassoc($arr1, $arr2, 'too_many_parameters', 'too_many_parameters'));
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
echo "\n-- comparison function taking too few parameters --\n";
@@ -36,7 +36,6 @@ function too_few_parameters ($val1) {
var_dump(array_udiff_uassoc($arr1, $arr2, 'too_few_parameters', 'too_few_parameters'));
?>
-===DONE===
--EXPECT--
*** Testing array_udiff_uassoc() : usage variation - differing comparison functions***
@@ -54,4 +53,3 @@ array(1) {
[0]=>
int(1)
}
-===DONE===
diff --git a/ext/standard/tests/array/array_udiff_variation1.phpt b/ext/standard/tests/array/array_udiff_variation1.phpt
index 5eb84146a1..9e98bda727 100644
--- a/ext/standard/tests/array/array_udiff_variation1.phpt
+++ b/ext/standard/tests/array/array_udiff_variation1.phpt
@@ -23,9 +23,9 @@ unset ($unset_var);
// define some classes
class classWithToString
{
- public function __toString() {
- return "Class A object";
- }
+ public function __toString() {
+ return "Class A object";
+ }
}
class classWithoutToString
@@ -91,137 +91,89 @@ $inputs = array(
// loop through each element of the array for arr1
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_udiff($value, $arr2, $data_comp_func) );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_udiff($value, $arr2, $data_comp_func) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
?>
-===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_udiff() : usage variation ***
--int 0--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, int given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--int 1--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, int given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--int 12345--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, int given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--int -12345--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, int given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--float 10.5--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, float given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float -10.5--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, float given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, float given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, float given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float .5--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, float given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--uppercase NULL--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, null given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, null given
--lowercase null--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, null given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, null given
--lowercase true--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, bool given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--lowercase false--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, bool given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, bool given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, bool given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--empty string DQ--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, string given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--empty string SQ--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, string given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--string DQ--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, string given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--string SQ--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, string given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--mixed case string--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, string given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--heredoc--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, string given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--instance of classWithToString--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, object given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, object given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, object given
--undefined var--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, null given in %sarray_udiff_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, null given
--unset var--
-
-Warning: array_udiff(): Expected parameter 1 to be an array, null given in %sarray_udiff_variation1.php on line %d
-NULL
-===DONE===
+Expected parameter 1 to be an array, null given
diff --git a/ext/standard/tests/array/array_udiff_variation2.phpt b/ext/standard/tests/array/array_udiff_variation2.phpt
index 61aa1f0c9a..28f1e8e1b1 100644
--- a/ext/standard/tests/array/array_udiff_variation2.phpt
+++ b/ext/standard/tests/array/array_udiff_variation2.phpt
@@ -23,9 +23,9 @@ unset ($unset_var);
// define some classes
class classWithToString
{
- public function __toString() {
- return "Class A object";
- }
+ public function __toString() {
+ return "Class A object";
+ }
}
class classWithoutToString
@@ -91,137 +91,89 @@ $inputs = array(
// loop through each element of the array for arr2
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_udiff($arr1, $value, $data_comp_func) );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_udiff($arr1, $value, $data_comp_func) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
?>
-===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_udiff() : usage variation ***
--int 0--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, int given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--int 1--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, int given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--int 12345--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, int given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--int -12345--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, int given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--float 10.5--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, float given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float -10.5--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, float given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, float given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, float given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float .5--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, float given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--uppercase NULL--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, null given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, null given
--lowercase null--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, null given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, null given
--lowercase true--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, bool given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--lowercase false--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, bool given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, bool given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, bool given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--empty string DQ--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, string given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--empty string SQ--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, string given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--string DQ--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, string given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--string SQ--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, string given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--mixed case string--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, string given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--heredoc--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, string given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--instance of classWithToString--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, object given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, object given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, object given
--undefined var--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, null given in %sarray_udiff_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, null given
--unset var--
-
-Warning: array_udiff(): Expected parameter 2 to be an array, null given in %sarray_udiff_variation2.php on line %d
-NULL
-===DONE===
+Expected parameter 2 to be an array, null given
diff --git a/ext/standard/tests/array/array_udiff_variation4.phpt b/ext/standard/tests/array/array_udiff_variation4.phpt
deleted file mode 100644
index a92c5ddfdf..0000000000
--- a/ext/standard/tests/array/array_udiff_variation4.phpt
+++ /dev/null
@@ -1,228 +0,0 @@
---TEST--
-Test array_udiff() function : usage variation
---FILE--
-<?php
-/* Prototype : array array_udiff(array arr1, array arr2 [, array ...], callback data_comp_func)
- * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments. Elements are compared by user supplied function.
- * Source code: ext/standard/array.c
- * Alias to functions:
- */
-
-echo "*** Testing array_udiff() : usage variation ***\n";
-
-// Initialise function arguments not being substituted (if any)
-$arr1 = array(1, 2);
-$arr2 = array(1, 2);
-
-include('compare_function.inc');
-$data_comp_func = 'compare_function';
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-// define some classes
-class classWithToString
-{
- public function __toString() {
- return "Class A object";
- }
-}
-
-class classWithoutToString
-{
-}
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-// add arrays
-$index_array = array (1, 2, 3);
-$assoc_array = array ('one' => 1, 'two' => 2);
-
-//array of values to iterate over
-$inputs = array(
-
- // int data
- 'int 0' => 0,
- 'int 1' => 1,
- 'int 12345' => 12345,
- 'int -12345' => -2345,
-
- // float data
- 'float 10.5' => 10.5,
- 'float -10.5' => -10.5,
- 'float 12.3456789000e10' => 12.3456789000e10,
- 'float -12.3456789000e10' => -12.3456789000e10,
- 'float .5' => .5,
-
- // null data
- 'uppercase NULL' => NULL,
- 'lowercase null' => null,
-
- // boolean data
- 'lowercase true' => true,
- 'lowercase false' =>false,
- 'uppercase TRUE' =>TRUE,
- 'uppercase FALSE' =>FALSE,
-
- // empty data
- 'empty string DQ' => "",
- 'empty string SQ' => '',
-
- // string data
- 'string DQ' => "string",
- 'string SQ' => 'string',
- 'mixed case string' => "sTrInG",
- 'heredoc' => $heredoc,
-
- // object data
- 'instance of classWithToString' => new classWithToString(),
- 'instance of classWithoutToString' => new classWithoutToString(),
-
- // undefined data
- 'undefined var' => @$undefined_var,
-
- // unset data
- 'unset var' => @$unset_var,
-);
-
-// loop through each element of the array for ...
-
-foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_udiff($arr1, $arr2, $value, $data_comp_func) );
-};
-
-?>
-===DONE===
---EXPECTF--
-*** Testing array_udiff() : usage variation ***
-
---int 0--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, int given in %sarray_udiff_variation4.php on line %d
-NULL
-
---int 1--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, int given in %sarray_udiff_variation4.php on line %d
-NULL
-
---int 12345--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, int given in %sarray_udiff_variation4.php on line %d
-NULL
-
---int -12345--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, int given in %sarray_udiff_variation4.php on line %d
-NULL
-
---float 10.5--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, float given in %sarray_udiff_variation4.php on line %d
-NULL
-
---float -10.5--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, float given in %sarray_udiff_variation4.php on line %d
-NULL
-
---float 12.3456789000e10--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, float given in %sarray_udiff_variation4.php on line %d
-NULL
-
---float -12.3456789000e10--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, float given in %sarray_udiff_variation4.php on line %d
-NULL
-
---float .5--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, float given in %sarray_udiff_variation4.php on line %d
-NULL
-
---uppercase NULL--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, null given in %sarray_udiff_variation4.php on line %d
-NULL
-
---lowercase null--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, null given in %sarray_udiff_variation4.php on line %d
-NULL
-
---lowercase true--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, bool given in %sarray_udiff_variation4.php on line %d
-NULL
-
---lowercase false--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, bool given in %sarray_udiff_variation4.php on line %d
-NULL
-
---uppercase TRUE--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, bool given in %sarray_udiff_variation4.php on line %d
-NULL
-
---uppercase FALSE--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, bool given in %sarray_udiff_variation4.php on line %d
-NULL
-
---empty string DQ--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, string given in %sarray_udiff_variation4.php on line %d
-NULL
-
---empty string SQ--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, string given in %sarray_udiff_variation4.php on line %d
-NULL
-
---string DQ--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, string given in %sarray_udiff_variation4.php on line %d
-NULL
-
---string SQ--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, string given in %sarray_udiff_variation4.php on line %d
-NULL
-
---mixed case string--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, string given in %sarray_udiff_variation4.php on line %d
-NULL
-
---heredoc--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, string given in %sarray_udiff_variation4.php on line %d
-NULL
-
---instance of classWithToString--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, object given in %sarray_udiff_variation4.php on line %d
-NULL
-
---instance of classWithoutToString--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, object given in %sarray_udiff_variation4.php on line %d
-NULL
-
---undefined var--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, null given in %sarray_udiff_variation4.php on line %d
-NULL
-
---unset var--
-
-Warning: array_udiff(): Expected parameter 3 to be an array, null given in %sarray_udiff_variation4.php on line %d
-NULL
-===DONE===
diff --git a/ext/standard/tests/array/array_udiff_variation5.phpt b/ext/standard/tests/array/array_udiff_variation5.phpt
index 967817bac3..24d1207ed4 100644
--- a/ext/standard/tests/array/array_udiff_variation5.phpt
+++ b/ext/standard/tests/array/array_udiff_variation5.phpt
@@ -25,9 +25,9 @@ function too_many_parameters ($val1, $val2, $val3) {
return 0;
}
try {
- var_dump(array_udiff($arr1, $arr2, 'too_many_parameters'));
+ var_dump(array_udiff($arr1, $arr2, 'too_many_parameters'));
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
echo "\n-- comparison function taking too few parameters --\n";
@@ -37,7 +37,6 @@ function too_few_parameters ($val1) {
var_dump(array_udiff($arr1, $arr2, 'too_few_parameters'));
?>
-===DONE===
--EXPECT--
*** Testing array_udiff() : usage variation ***
@@ -53,4 +52,3 @@ Exception: Too few arguments to function too_many_parameters(), 2 passed and exa
-- comparison function taking too few parameters --
array(0) {
}
-===DONE===
diff --git a/ext/standard/tests/array/array_uintersect_assoc_basic2.phpt b/ext/standard/tests/array/array_uintersect_assoc_basic2.phpt
index b9837e7954..c2655cdb5b 100644
--- a/ext/standard/tests/array/array_uintersect_assoc_basic2.phpt
+++ b/ext/standard/tests/array/array_uintersect_assoc_basic2.phpt
@@ -24,7 +24,6 @@ var_dump( array_uintersect_assoc($arr1, $arr2, $arr3, $arr4, $data_compare_funct
?>
-===DONE===
--EXPECT--
*** Testing array_uintersect_assoc() : basic functionality - testing with multiple array arguments ***
array(2) {
@@ -33,4 +32,3 @@ array(2) {
[3]=>
string(5) "three"
}
-===DONE===
diff --git a/ext/standard/tests/array/array_uintersect_assoc_variation1.phpt b/ext/standard/tests/array/array_uintersect_assoc_variation1.phpt
index a2babcdb02..8111006e3c 100644
--- a/ext/standard/tests/array/array_uintersect_assoc_variation1.phpt
+++ b/ext/standard/tests/array/array_uintersect_assoc_variation1.phpt
@@ -23,9 +23,9 @@ unset ($unset_var);
// define some classes
class classWithToString
{
- public function __toString() {
- return "Class A object";
- }
+ public function __toString() {
+ return "Class A object";
+ }
}
class classWithoutToString
@@ -91,137 +91,89 @@ $inputs = array(
// loop through each element of the array for arr1
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_uintersect_assoc($value, $arr2, $data_compare_function) );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_uintersect_assoc($value, $arr2, $data_compare_function) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
?>
-===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_uintersect_assoc() : usage variation ***
--int 0--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, int given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--int 1--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, int given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--int 12345--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, int given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--int -12345--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, int given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--float 10.5--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, float given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float -10.5--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, float given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, float given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, float given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float .5--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, float given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--uppercase NULL--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, null given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, null given
--lowercase null--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, null given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, null given
--lowercase true--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--lowercase false--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--empty string DQ--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--empty string SQ--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--string DQ--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--string SQ--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--mixed case string--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--heredoc--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--instance of classWithToString--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, object given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, object given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, object given
--undefined var--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, null given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, null given
--unset var--
-
-Warning: array_uintersect_assoc(): Expected parameter 1 to be an array, null given in %sarray_uintersect_assoc_variation1.php on line %d
-NULL
-===DONE===
+Expected parameter 1 to be an array, null given
diff --git a/ext/standard/tests/array/array_uintersect_assoc_variation2.phpt b/ext/standard/tests/array/array_uintersect_assoc_variation2.phpt
index 8723157506..5ce935321f 100644
--- a/ext/standard/tests/array/array_uintersect_assoc_variation2.phpt
+++ b/ext/standard/tests/array/array_uintersect_assoc_variation2.phpt
@@ -23,9 +23,9 @@ unset ($unset_var);
// define some classes
class classWithToString
{
- public function __toString() {
- return "Class A object";
- }
+ public function __toString() {
+ return "Class A object";
+ }
}
class classWithoutToString
@@ -91,137 +91,89 @@ $inputs = array(
// loop through each element of the array for arr2
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_uintersect_assoc($arr1, $value, $data_compare_function) );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_uintersect_assoc($arr1, $value, $data_compare_function) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
?>
-===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_uintersect_assoc() : usage variation ***
--int 0--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, int given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--int 1--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, int given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--int 12345--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, int given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--int -12345--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, int given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--float 10.5--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, float given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float -10.5--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, float given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, float given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, float given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float .5--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, float given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--uppercase NULL--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, null given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, null given
--lowercase null--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, null given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, null given
--lowercase true--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--lowercase false--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--empty string DQ--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--empty string SQ--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--string DQ--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--string SQ--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--mixed case string--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--heredoc--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--instance of classWithToString--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, object given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, object given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, object given
--undefined var--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, null given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, null given
--unset var--
-
-Warning: array_uintersect_assoc(): Expected parameter 2 to be an array, null given in %sarray_uintersect_assoc_variation2.php on line %d
-NULL
-===DONE===
+Expected parameter 2 to be an array, null given
diff --git a/ext/standard/tests/array/array_uintersect_assoc_variation4.phpt b/ext/standard/tests/array/array_uintersect_assoc_variation4.phpt
deleted file mode 100644
index 3024246a3d..0000000000
--- a/ext/standard/tests/array/array_uintersect_assoc_variation4.phpt
+++ /dev/null
@@ -1,228 +0,0 @@
---TEST--
-Test array_uintersect_assoc() function : usage variation
---FILE--
-<?php
-/* Prototype : array array_uintersect_assoc(array arr1, array arr2 [, array ...], callback data_compare_func)
- * Description: U
- * Source code: ext/standard/array.c
- * Alias to functions:
- */
-
-echo "*** Testing array_uintersect_assoc() : usage variation ***\n";
-
-// Initialise function arguments not being substituted (if any)
-$arr1 = array(1, 2);
-$arr2 = array(1, 2);
-
-include('compare_function.inc');
-$data_compare_function = 'compare_function';
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-// define some classes
-class classWithToString
-{
- public function __toString() {
- return "Class A object";
- }
-}
-
-class classWithoutToString
-{
-}
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-// add arrays
-$index_array = array (1, 2, 3);
-$assoc_array = array ('one' => 1, 'two' => 2);
-
-//array of values to iterate over
-$inputs = array(
-
- // int data
- 'int 0' => 0,
- 'int 1' => 1,
- 'int 12345' => 12345,
- 'int -12345' => -2345,
-
- // float data
- 'float 10.5' => 10.5,
- 'float -10.5' => -10.5,
- 'float 12.3456789000e10' => 12.3456789000e10,
- 'float -12.3456789000e10' => -12.3456789000e10,
- 'float .5' => .5,
-
- // null data
- 'uppercase NULL' => NULL,
- 'lowercase null' => null,
-
- // boolean data
- 'lowercase true' => true,
- 'lowercase false' =>false,
- 'uppercase TRUE' =>TRUE,
- 'uppercase FALSE' =>FALSE,
-
- // empty data
- 'empty string DQ' => "",
- 'empty string SQ' => '',
-
- // string data
- 'string DQ' => "string",
- 'string SQ' => 'string',
- 'mixed case string' => "sTrInG",
- 'heredoc' => $heredoc,
-
- // object data
- 'instance of classWithToString' => new classWithToString(),
- 'instance of classWithoutToString' => new classWithoutToString(),
-
- // undefined data
- 'undefined var' => @$undefined_var,
-
- // unset data
- 'unset var' => @$unset_var,
-);
-
-// loop through each element of the array for ...
-
-foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_uintersect_assoc($arr1, $arr2, $value, $data_compare_function ) );
-};
-
-?>
-===DONE===
---EXPECTF--
-*** Testing array_uintersect_assoc() : usage variation ***
-
---int 0--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, int given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---int 1--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, int given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---int 12345--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, int given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---int -12345--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, int given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---float 10.5--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, float given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---float -10.5--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, float given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---float 12.3456789000e10--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, float given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---float -12.3456789000e10--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, float given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---float .5--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, float given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---uppercase NULL--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, null given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---lowercase null--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, null given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---lowercase true--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---lowercase false--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---uppercase TRUE--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---uppercase FALSE--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---empty string DQ--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---empty string SQ--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---string DQ--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---string SQ--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---mixed case string--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---heredoc--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---instance of classWithToString--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, object given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---instance of classWithoutToString--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, object given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---undefined var--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, null given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-
---unset var--
-
-Warning: array_uintersect_assoc(): Expected parameter 3 to be an array, null given in %sarray_uintersect_assoc_variation4.php on line %d
-NULL
-===DONE===
diff --git a/ext/standard/tests/array/array_uintersect_assoc_variation5.phpt b/ext/standard/tests/array/array_uintersect_assoc_variation5.phpt
index 34b10af344..990a711219 100644
--- a/ext/standard/tests/array/array_uintersect_assoc_variation5.phpt
+++ b/ext/standard/tests/array/array_uintersect_assoc_variation5.phpt
@@ -24,9 +24,9 @@ function too_many_parameters ($val1, $val2, $val3) {
return 1;
}
try {
- var_dump(array_uintersect_assoc($arr1, $arr2, 'too_many_parameters'));
+ var_dump(array_uintersect_assoc($arr1, $arr2, 'too_many_parameters'));
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
echo "\n-- comparison function taking too few parameters --\n";
@@ -37,7 +37,6 @@ var_dump(array_uintersect_assoc($arr1, $arr2, 'too_few_parameters'));
?>
-===DONE===
--EXPECT--
*** Testing array_uintersect_assoc() : usage variation - differing comparison functions***
@@ -52,4 +51,3 @@ Exception: Too few arguments to function too_many_parameters(), 2 passed and exa
array(0) {
}
-===DONE===
diff --git a/ext/standard/tests/array/array_uintersect_uassoc_variation1.phpt b/ext/standard/tests/array/array_uintersect_uassoc_variation1.phpt
index 84d4e634cf..908b39c859 100644
--- a/ext/standard/tests/array/array_uintersect_uassoc_variation1.phpt
+++ b/ext/standard/tests/array/array_uintersect_uassoc_variation1.phpt
@@ -24,9 +24,9 @@ unset ($unset_var);
// define some classes
class classWithToString
{
- public function __toString() {
- return "Class A object";
- }
+ public function __toString() {
+ return "Class A object";
+ }
}
class classWithoutToString
@@ -92,137 +92,89 @@ $inputs = array(
// loop through each element of the array for arr1
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_uintersect_uassoc($value, $arr2, $data_compare_func, $key_compare_func) );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_uintersect_uassoc($value, $arr2, $data_compare_func, $key_compare_func) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
?>
-===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_uintersect_uassoc() : usage variation ***
--int 0--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, int given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--int 1--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, int given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--int 12345--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, int given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--int -12345--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, int given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--float 10.5--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, float given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float -10.5--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, float given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, float given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, float given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float .5--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, float given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--uppercase NULL--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, null given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, null given
--lowercase null--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, null given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, null given
--lowercase true--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--lowercase false--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--empty string DQ--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--empty string SQ--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--string DQ--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--string SQ--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--mixed case string--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--heredoc--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, string given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--instance of classWithToString--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, object given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, object given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, object given
--undefined var--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, null given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, null given
--unset var--
-
-Warning: array_uintersect_uassoc(): Expected parameter 1 to be an array, null given in %sarray_uintersect_uassoc_variation1.php on line %d
-NULL
-===DONE===
+Expected parameter 1 to be an array, null given
diff --git a/ext/standard/tests/array/array_uintersect_uassoc_variation2.phpt b/ext/standard/tests/array/array_uintersect_uassoc_variation2.phpt
index 8692026fc4..c9b3e051c3 100644
--- a/ext/standard/tests/array/array_uintersect_uassoc_variation2.phpt
+++ b/ext/standard/tests/array/array_uintersect_uassoc_variation2.phpt
@@ -24,9 +24,9 @@ unset ($unset_var);
// define some classes
class classWithToString
{
- public function __toString() {
- return "Class A object";
- }
+ public function __toString() {
+ return "Class A object";
+ }
}
class classWithoutToString
@@ -92,137 +92,89 @@ $inputs = array(
// loop through each element of the array for arr2
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_uintersect_uassoc($arr1, $value, $data_compare_func, $key_compare_func) );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_uintersect_uassoc($arr1, $value, $data_compare_func, $key_compare_func) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
?>
-===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_uintersect_uassoc() : usage variation ***
--int 0--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, int given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--int 1--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, int given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--int 12345--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, int given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--int -12345--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, int given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--float 10.5--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, float given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float -10.5--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, float given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, float given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, float given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float .5--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, float given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--uppercase NULL--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, null given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, null given
--lowercase null--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, null given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, null given
--lowercase true--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--lowercase false--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--empty string DQ--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--empty string SQ--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--string DQ--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--string SQ--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--mixed case string--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--heredoc--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, string given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--instance of classWithToString--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, object given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, object given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, object given
--undefined var--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, null given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, null given
--unset var--
-
-Warning: array_uintersect_uassoc(): Expected parameter 2 to be an array, null given in %sarray_uintersect_uassoc_variation2.php on line %d
-NULL
-===DONE===
+Expected parameter 2 to be an array, null given
diff --git a/ext/standard/tests/array/array_uintersect_uassoc_variation5.phpt b/ext/standard/tests/array/array_uintersect_uassoc_variation5.phpt
deleted file mode 100644
index d1db008416..0000000000
--- a/ext/standard/tests/array/array_uintersect_uassoc_variation5.phpt
+++ /dev/null
@@ -1,229 +0,0 @@
---TEST--
-Test array_uintersect_uassoc() function : usage variation
---FILE--
-<?php
-/* Prototype : array array_uintersect_uassoc(array arr1, array arr2 [, array ...], callback data_compare_func, callback key_compare_func)
- * Description: Returns the entries of arr1 that have values which are present in all the other arguments. Keys are used to do more restrictive check. Both data and keys are compared by using user-supplied callbacks.
- * Source code: ext/standard/array.c
- * Alias to functions:
- */
-
-echo "*** Testing array_uintersect_uassoc() : usage variation ***\n";
-
-// Initialise function arguments not being substituted (if any)
-$arr1 = array(1, 2);
-$arr2 = array(1, 2);
-
-include('compare_function.inc');
-$data_compare_func = 'compare_function';
-$key_compare_func = 'compare_function';
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-// define some classes
-class classWithToString
-{
- public function __toString() {
- return "Class A object";
- }
-}
-
-class classWithoutToString
-{
-}
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-// add arrays
-$index_array = array (1, 2, 3);
-$assoc_array = array ('one' => 1, 'two' => 2);
-
-//array of values to iterate over
-$inputs = array(
-
- // int data
- 'int 0' => 0,
- 'int 1' => 1,
- 'int 12345' => 12345,
- 'int -12345' => -2345,
-
- // float data
- 'float 10.5' => 10.5,
- 'float -10.5' => -10.5,
- 'float 12.3456789000e10' => 12.3456789000e10,
- 'float -12.3456789000e10' => -12.3456789000e10,
- 'float .5' => .5,
-
- // null data
- 'uppercase NULL' => NULL,
- 'lowercase null' => null,
-
- // boolean data
- 'lowercase true' => true,
- 'lowercase false' =>false,
- 'uppercase TRUE' =>TRUE,
- 'uppercase FALSE' =>FALSE,
-
- // empty data
- 'empty string DQ' => "",
- 'empty string SQ' => '',
-
- // string data
- 'string DQ' => "string",
- 'string SQ' => 'string',
- 'mixed case string' => "sTrInG",
- 'heredoc' => $heredoc,
-
- // object data
- 'instance of classWithToString' => new classWithToString(),
- 'instance of classWithoutToString' => new classWithoutToString(),
-
- // undefined data
- 'undefined var' => @$undefined_var,
-
- // unset data
- 'unset var' => @$unset_var,
-);
-
-// loop through each element of the array for ...
-
-foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_uintersect_uassoc($arr1, $arr2, $value, $data_compare_func, $key_compare_func) );
-};
-
-?>
-===DONE===
---EXPECTF--
-*** Testing array_uintersect_uassoc() : usage variation ***
-
---int 0--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, int given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---int 1--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, int given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---int 12345--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, int given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---int -12345--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, int given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---float 10.5--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, float given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---float -10.5--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, float given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---float 12.3456789000e10--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, float given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---float -12.3456789000e10--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, float given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---float .5--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, float given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---uppercase NULL--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, null given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---lowercase null--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, null given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---lowercase true--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---lowercase false--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---uppercase TRUE--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---uppercase FALSE--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---empty string DQ--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---empty string SQ--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---string DQ--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---string SQ--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---mixed case string--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---heredoc--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, string given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---instance of classWithToString--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, object given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---instance of classWithoutToString--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, object given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---undefined var--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, null given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-
---unset var--
-
-Warning: array_uintersect_uassoc(): Expected parameter 3 to be an array, null given in %sarray_uintersect_uassoc_variation5.php on line %d
-NULL
-===DONE===
diff --git a/ext/standard/tests/array/array_uintersect_uassoc_variation6.phpt b/ext/standard/tests/array/array_uintersect_uassoc_variation6.phpt
index 6abeac09b7..76d387d9c8 100644
--- a/ext/standard/tests/array/array_uintersect_uassoc_variation6.phpt
+++ b/ext/standard/tests/array/array_uintersect_uassoc_variation6.phpt
@@ -24,9 +24,9 @@ function too_many_parameters ($val1, $val2, $val3) {
return 1;
}
try {
- var_dump(array_uintersect_uassoc($arr1, $arr2, 'too_many_parameters', 'too_many_parameters'));
+ var_dump(array_uintersect_uassoc($arr1, $arr2, 'too_many_parameters', 'too_many_parameters'));
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
echo "\n-- comparison function taking too few parameters --\n";
@@ -36,7 +36,6 @@ function too_few_parameters ($val1) {
var_dump(array_uintersect_uassoc($arr1, $arr2, 'too_few_parameters', 'too_few_parameters'));
?>
-===DONE===
--EXPECT--
*** Testing array_uintersect_uassoc() : usage variation - incorrect callbacks ***
@@ -50,4 +49,3 @@ Exception: Too few arguments to function too_many_parameters(), 2 passed and exa
-- comparison function taking too few parameters --
array(0) {
}
-===DONE===
diff --git a/ext/standard/tests/array/array_uintersect_variation1.phpt b/ext/standard/tests/array/array_uintersect_variation1.phpt
index c88177018b..336ce0a169 100644
--- a/ext/standard/tests/array/array_uintersect_variation1.phpt
+++ b/ext/standard/tests/array/array_uintersect_variation1.phpt
@@ -23,9 +23,9 @@ unset ($unset_var);
// define some classes
class classWithToString
{
- public function __toString() {
- return "Class A object";
- }
+ public function __toString() {
+ return "Class A object";
+ }
}
class classWithoutToString
@@ -91,137 +91,89 @@ $inputs = array(
// loop through each element of the array for arr1
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_uintersect($value, $arr2, $data_compare_function) );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_uintersect($value, $arr2, $data_compare_function) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
?>
-===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_uintersect() : usage variation ***
--int 0--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, int given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--int 1--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, int given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--int 12345--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, int given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--int -12345--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, int given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, int given
--float 10.5--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, float given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float -10.5--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, float given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, float given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, float given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--float .5--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, float given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, float given
--uppercase NULL--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, null given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, null given
--lowercase null--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, null given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, null given
--lowercase true--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--lowercase false--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, bool given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, bool given
--empty string DQ--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, string given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--empty string SQ--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, string given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--string DQ--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, string given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--string SQ--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, string given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--mixed case string--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, string given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--heredoc--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, string given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, string given
--instance of classWithToString--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, object given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, object given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, object given
--undefined var--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, null given in %sarray_uintersect_variation1.php on line %d
-NULL
+Expected parameter 1 to be an array, null given
--unset var--
-
-Warning: array_uintersect(): Expected parameter 1 to be an array, null given in %sarray_uintersect_variation1.php on line %d
-NULL
-===DONE===
+Expected parameter 1 to be an array, null given
diff --git a/ext/standard/tests/array/array_uintersect_variation2.phpt b/ext/standard/tests/array/array_uintersect_variation2.phpt
index ee52e21c72..851927e98b 100644
--- a/ext/standard/tests/array/array_uintersect_variation2.phpt
+++ b/ext/standard/tests/array/array_uintersect_variation2.phpt
@@ -23,9 +23,9 @@ unset ($unset_var);
// define some classes
class classWithToString
{
- public function __toString() {
- return "Class A object";
- }
+ public function __toString() {
+ return "Class A object";
+ }
}
class classWithoutToString
@@ -91,137 +91,89 @@ $inputs = array(
// loop through each element of the array for arr2
foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_uintersect($arr1, $value, $data_compare_function) );
+ echo "\n--$key--\n";
+ try {
+ var_dump( array_uintersect($arr1, $value, $data_compare_function) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
?>
-===DONE===
---EXPECTF--
+--EXPECT--
*** Testing array_uintersect() : usage variation ***
--int 0--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, int given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--int 1--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, int given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--int 12345--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, int given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--int -12345--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, int given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, int given
--float 10.5--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, float given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float -10.5--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, float given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float 12.3456789000e10--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, float given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float -12.3456789000e10--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, float given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--float .5--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, float given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, float given
--uppercase NULL--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, null given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, null given
--lowercase null--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, null given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, null given
--lowercase true--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--lowercase false--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--uppercase TRUE--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--uppercase FALSE--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, bool given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, bool given
--empty string DQ--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, string given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--empty string SQ--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, string given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--string DQ--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, string given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--string SQ--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, string given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--mixed case string--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, string given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--heredoc--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, string given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, string given
--instance of classWithToString--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, object given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, object given
--instance of classWithoutToString--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, object given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, object given
--undefined var--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, null given in %sarray_uintersect_variation2.php on line %d
-NULL
+Expected parameter 2 to be an array, null given
--unset var--
-
-Warning: array_uintersect(): Expected parameter 2 to be an array, null given in %sarray_uintersect_variation2.php on line %d
-NULL
-===DONE===
+Expected parameter 2 to be an array, null given
diff --git a/ext/standard/tests/array/array_uintersect_variation4.phpt b/ext/standard/tests/array/array_uintersect_variation4.phpt
deleted file mode 100644
index abc33e591b..0000000000
--- a/ext/standard/tests/array/array_uintersect_variation4.phpt
+++ /dev/null
@@ -1,228 +0,0 @@
---TEST--
-Test array_uintersect() function : usage variation
---FILE--
-<?php
-/* Prototype : array array_uintersect(array arr1, array arr2 [, array ...], callback data_compare_func)
- * Description: Returns the entries of arr1 that have values which are present in all the other arguments. Data is compared by using an user-supplied callback.
- * Source code: ext/standard/array.c
- * Alias to functions:
- */
-
-echo "*** Testing array_uintersect() : usage variation ***\n";
-
-// Initialise function arguments not being substituted (if any)
-$arr1 = array(1, 2);
-$arr2 = array(1, 2);
-
-include('compare_function.inc');
-$data_compare_function = 'compare_function';
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-// define some classes
-class classWithToString
-{
- public function __toString() {
- return "Class A object";
- }
-}
-
-class classWithoutToString
-{
-}
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-// add arrays
-$index_array = array (1, 2, 3);
-$assoc_array = array ('one' => 1, 'two' => 2);
-
-//array of values to iterate over
-$inputs = array(
-
- // int data
- 'int 0' => 0,
- 'int 1' => 1,
- 'int 12345' => 12345,
- 'int -12345' => -2345,
-
- // float data
- 'float 10.5' => 10.5,
- 'float -10.5' => -10.5,
- 'float 12.3456789000e10' => 12.3456789000e10,
- 'float -12.3456789000e10' => -12.3456789000e10,
- 'float .5' => .5,
-
- // null data
- 'uppercase NULL' => NULL,
- 'lowercase null' => null,
-
- // boolean data
- 'lowercase true' => true,
- 'lowercase false' =>false,
- 'uppercase TRUE' =>TRUE,
- 'uppercase FALSE' =>FALSE,
-
- // empty data
- 'empty string DQ' => "",
- 'empty string SQ' => '',
-
- // string data
- 'string DQ' => "string",
- 'string SQ' => 'string',
- 'mixed case string' => "sTrInG",
- 'heredoc' => $heredoc,
-
- // object data
- 'instance of classWithToString' => new classWithToString(),
- 'instance of classWithoutToString' => new classWithoutToString(),
-
- // undefined data
- 'undefined var' => @$undefined_var,
-
- // unset data
- 'unset var' => @$unset_var,
-);
-
-// loop through each element of the array for ...
-
-foreach($inputs as $key =>$value) {
- echo "\n--$key--\n";
- var_dump( array_uintersect($arr1, $arr2, $value, $data_compare_function) );
-};
-
-?>
-===DONE===
---EXPECTF--
-*** Testing array_uintersect() : usage variation ***
-
---int 0--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, int given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---int 1--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, int given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---int 12345--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, int given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---int -12345--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, int given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---float 10.5--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, float given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---float -10.5--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, float given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---float 12.3456789000e10--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, float given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---float -12.3456789000e10--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, float given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---float .5--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, float given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---uppercase NULL--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, null given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---lowercase null--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, null given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---lowercase true--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---lowercase false--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---uppercase TRUE--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---uppercase FALSE--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, bool given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---empty string DQ--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, string given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---empty string SQ--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, string given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---string DQ--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, string given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---string SQ--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, string given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---mixed case string--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, string given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---heredoc--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, string given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---instance of classWithToString--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, object given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---instance of classWithoutToString--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, object given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---undefined var--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, null given in %sarray_uintersect_variation4.php on line %d
-NULL
-
---unset var--
-
-Warning: array_uintersect(): Expected parameter 3 to be an array, null given in %sarray_uintersect_variation4.php on line %d
-NULL
-===DONE===
diff --git a/ext/standard/tests/array/array_uintersect_variation5.phpt b/ext/standard/tests/array/array_uintersect_variation5.phpt
index 699188290b..bcfdac094b 100644
--- a/ext/standard/tests/array/array_uintersect_variation5.phpt
+++ b/ext/standard/tests/array/array_uintersect_variation5.phpt
@@ -24,9 +24,9 @@ function too_many_parameters ($val1, $val2, $val3) {
return 1;
}
try {
- var_dump(array_uintersect($arr1, $arr2, 'too_many_parameters'));
+ var_dump(array_uintersect($arr1, $arr2, 'too_many_parameters'));
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
echo "\n-- comparison function taking too few parameters --\n";
@@ -37,7 +37,6 @@ var_dump(array_uintersect($arr1, $arr2, 'too_few_parameters'));
?>
-===DONE===
--EXPECT--
*** Testing array_uintersect() : usage variation - differing comparison functions***
@@ -52,4 +51,3 @@ Exception: Too few arguments to function too_many_parameters(), 2 passed and exa
array(0) {
}
-===DONE===
diff --git a/ext/standard/tests/array/array_unique_variation3.phpt b/ext/standard/tests/array/array_unique_variation3.phpt
index 205bc3a576..0227449233 100644
--- a/ext/standard/tests/array/array_unique_variation3.phpt
+++ b/ext/standard/tests/array/array_unique_variation3.phpt
@@ -50,7 +50,7 @@ $inputs = array (
array("hello", $heredoc => "string", "string"),
// array with object, unset variable and resource variable
-/*8*/ array(new classA() => 11, @$unset_var => "hello", $fp => 'resource', 11, "hello"),
+/*8*/ array(@$unset_var => "hello", $fp => 'resource', 11, "hello"),
);
// loop through each sub-array of $inputs to check the behavior of array_unique()
@@ -68,9 +68,7 @@ echo "Done";
--EXPECTF--
*** Testing array_unique() : assoc. array with diff. keys passed to $input argument ***
-Warning: Illegal offset type in %s on line %d
-
-Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
+Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
-- Iteration 1 --
array(1) {
[0]=>
diff --git a/ext/standard/tests/array/array_unique_variation8.phpt b/ext/standard/tests/array/array_unique_variation8.phpt
index d8a318dd93..0ac6f91687 100644
--- a/ext/standard/tests/array/array_unique_variation8.phpt
+++ b/ext/standard/tests/array/array_unique_variation8.phpt
@@ -29,13 +29,13 @@ echo "Done";
--EXPECTF--
*** Testing array_unique() : two dimensional array for $input argument ***
-Notice: Array to string conversion in %sarray_unique_variation8.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_unique_variation8.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_unique_variation8.php on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %sarray_unique_variation8.php on line %d
+Warning: Array to string conversion in %s on line %d
array(1) {
[0]=>
array(4) {
diff --git a/ext/standard/tests/array/array_unshift.phpt b/ext/standard/tests/array/array_unshift.phpt
index 9b474277a9..9ebe83391e 100644
--- a/ext/standard/tests/array/array_unshift.phpt
+++ b/ext/standard/tests/array/array_unshift.phpt
@@ -7,8 +7,6 @@ $a = array();
$s = "";
var_dump(array_unshift($a, $s));
var_dump($a);
-var_dump(array_unshift($s, $a));
-var_dump($a);
var_dump(array_unshift($a, $a));
var_dump($a);
@@ -20,13 +18,6 @@ array(1) {
[0]=>
string(0) ""
}
-
-Warning: array_unshift() expects parameter 1 to be array, string given in %s on line %d
-NULL
-array(1) {
- [0]=>
- string(0) ""
-}
int(2)
array(2) {
[0]=>
diff --git a/ext/standard/tests/array/array_unshift_variation3.phpt b/ext/standard/tests/array/array_unshift_variation3.phpt
index 3c0e0a3400..0138e0bf70 100644
--- a/ext/standard/tests/array/array_unshift_variation3.phpt
+++ b/ext/standard/tests/array/array_unshift_variation3.phpt
@@ -41,7 +41,7 @@ $arrays = array (
array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true),
array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6),
- // array with repetative keys
+ // array with repetitive keys
/*18*/ array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3)
);
diff --git a/ext/standard/tests/array/array_unshift_variation4.phpt b/ext/standard/tests/array/array_unshift_variation4.phpt
index 7f507c98d0..e468bfcf46 100644
--- a/ext/standard/tests/array/array_unshift_variation4.phpt
+++ b/ext/standard/tests/array/array_unshift_variation4.phpt
@@ -63,10 +63,10 @@ $arrays = array (
array("hello", $heredoc => "string"), // heredoc
// array with object, unset variable and resource variable
- array(new classA() => 11, @$unset_var => "hello", $fp => 'resource'),
+ array(@$unset_var => "hello", $fp => 'resource'),
// array with mixed keys
-/*11*/ array('hello' => 1, new classA() => 2, "fruit" => 2.2,
+/*11*/ array('hello' => 1, "fruit" => 2.2,
$fp => 'resource', 133 => "int", 444.432 => "float",
@$unset_var => "unset", $heredoc => "heredoc")
);
@@ -101,13 +101,9 @@ echo "Done";
--EXPECTF--
*** Testing array_unshift() : associative array with different keys ***
-Warning: Illegal offset type in %s on line %d
+Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
-Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
-
-Warning: Illegal offset type in %s on line %d
-
-Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
+Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
-- Iteration 1 --
int(1)
array(1) {
diff --git a/ext/standard/tests/array/array_values.phpt b/ext/standard/tests/array/array_values.phpt
index b490684333..afa113e73c 100644
--- a/ext/standard/tests/array/array_values.phpt
+++ b/ext/standard/tests/array/array_values.phpt
Binary files differ
diff --git a/ext/standard/tests/array/array_values_variation2.phpt b/ext/standard/tests/array/array_values_variation2.phpt
index 5105168c1e..a334140001 100644
--- a/ext/standard/tests/array/array_values_variation2.phpt
+++ b/ext/standard/tests/array/array_values_variation2.phpt
@@ -38,7 +38,7 @@ $inputs = array(
// int data
/*1*/ 'int' => array(
- 0,
+ 0,
1,
12345,
-2345,
diff --git a/ext/standard/tests/array/array_walk.phpt b/ext/standard/tests/array/array_walk.phpt
index 7cd8a8cf7a..1f5457c9f7 100644
--- a/ext/standard/tests/array/array_walk.phpt
+++ b/ext/standard/tests/array/array_walk.phpt
@@ -3,42 +3,28 @@ array_walk() tests
--FILE--
<?php
-var_dump(array_walk());
-$var = 1;
-var_dump(array_walk($var,1));
-$var = array();
-var_dump(array_walk($var,""));
-
function foo($v1, $v2, $v3) {
- var_dump($v1);
- var_dump($v2);
- var_dump($v3);
+ var_dump($v1);
+ var_dump($v2);
+ var_dump($v3);
}
$var = array(1,2);
var_dump(array_walk($var, "foo", "data"));
function foo2($v1, $v2, $v3) {
- throw new Exception($v3);
+ throw new Exception($v3);
}
try {
- var_dump(array_walk($var,"foo2", "data"));
+ var_dump(array_walk($var,"foo2", "data"));
} catch (Exception $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
echo "Done\n";
?>
--EXPECTF--
-Warning: array_walk() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: array_walk() expects parameter 1 to be array, int given in %s on line %d
-NULL
-
-Warning: array_walk() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d
-NULL
int(1)
int(0)
string(4) "data"
diff --git a/ext/standard/tests/array/array_walk_closure.phpt b/ext/standard/tests/array/array_walk_closure.phpt
index 0a5d854582..6cc49cf9d3 100644
--- a/ext/standard/tests/array/array_walk_closure.phpt
+++ b/ext/standard/tests/array/array_walk_closure.phpt
@@ -3,14 +3,6 @@ array_walk() closure tests
--FILE--
<?php
-var_dump(array_walk());
-
-$ar = false;
-var_dump(array_walk($ar, $ar));
-
-$ar = NULL;
-var_dump(array_walk($ar, $ar));
-
$ar = ["one" => 1, "two"=>2, "three" => 3];
var_dump(array_walk($ar, function(){ var_dump(func_get_args());}));
@@ -18,8 +10,8 @@ echo "\nclosure with array\n";
$ar = ["one" => 1, "two"=>2, "three" => 3];
$user_data = ["sum" => 42];
$func = function($value, $key, &$udata) {
- var_dump($udata);
- $udata["sum"] += $value;
+ var_dump($udata);
+ $udata["sum"] += $value;
};
var_dump(array_walk($ar, $func, $user_data));
@@ -30,8 +22,8 @@ echo "\nclosure with use\n";
$ar = ["one" => 1, "two"=>2, "three" => 3];
$user_data = ["sum" => 42];
$func = function($value, $key) use (&$user_data) {
- var_dump($user_data);
- $user_data["sum"] += $value;
+ var_dump($user_data);
+ $user_data["sum"] += $value;
};
var_dump(array_walk($ar, $func, $user_data));
@@ -43,8 +35,8 @@ echo "\nclosure with object\n";
$ar = ["one" => 1, "two"=>2, "three" => 3];
$user_data = (object)["sum" => 42];
$func = function($value, $key, &$udata) {
- var_dump($udata);
- $udata->sum += $value;
+ var_dump($udata);
+ $udata->sum += $value;
};
var_dump(array_walk($ar, $func, $user_data));
@@ -56,8 +48,8 @@ var_dump($user_data->sum);
echo "\nfunction with object\n";
function sum_it_up_object($value, $key, $udata)
{
- var_dump($udata);
- $udata->sum += $value;
+ var_dump($udata);
+ $udata->sum += $value;
}
$ar = ["one" => 1, "two"=>2, "three" => 3];
@@ -71,8 +63,8 @@ var_dump($user_data->sum);
echo "\nfunction with array\n";
function sum_it_up_array($value, $key, $udata)
{
- var_dump($udata);
- $udata['sum'] += $value;
+ var_dump($udata);
+ $udata['sum'] += $value;
}
$ar = ["one" => 1, "two"=>2, "three" => 3];
@@ -85,23 +77,15 @@ var_dump($user_data['sum']);
echo "\nclosure and exception\n";
$ar = ["one" => 1, "two"=>2, "three" => 3];
try {
- var_dump(array_walk($ar, function($v, $k) { if ($v == 2) throw new Exception; } ));
+ var_dump(array_walk($ar, function($v, $k) { if ($v == 2) throw new Exception; } ));
} catch (Exception $e) {
- var_dump($e->getTrace());
+ var_dump($e->getTrace());
}
echo "Done\n";
?>
--EXPECTF--
-Warning: array_walk() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: array_walk() expects parameter 1 to be array, bool given in %s on line %d
-NULL
-
-Warning: array_walk() expects parameter 1 to be array, null given in %s on line %d
-NULL
array(2) {
[0]=>
int(1)
diff --git a/ext/standard/tests/array/array_walk_error2.phpt b/ext/standard/tests/array/array_walk_error2.phpt
index a4026180fb..dfc95d3af8 100644
--- a/ext/standard/tests/array/array_walk_error2.phpt
+++ b/ext/standard/tests/array/array_walk_error2.phpt
@@ -23,33 +23,33 @@ echo "*** Testing array_walk() : error conditions - callback parameters ***\n";
// expected: Missing argument Warning
try {
- var_dump( array_walk($input, "callback1") );
+ var_dump( array_walk($input, "callback1") );
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
try {
- var_dump( array_walk($input, "callback2", 4) );
+ var_dump( array_walk($input, "callback2", 4) );
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
// expected: Warning is suppressed
try {
- var_dump( @array_walk($input, "callback1") );
+ var_dump( @array_walk($input, "callback1") );
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
try {
- var_dump( @array_walk($input, "callback2", 4) );
+ var_dump( @array_walk($input, "callback2", 4) );
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
echo "-- Testing array_walk() function with too many callback parameters --\n";
try {
- var_dump( array_walk($input, "callback1", 20, 10) );
+ var_dump( array_walk($input, "callback1", 20, 10) );
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
echo "Done";
@@ -61,7 +61,5 @@ Exception: Too few arguments to function callback2(), 3 passed and exactly 4 exp
Exception: Too few arguments to function callback1(), 2 passed and exactly 3 expected
Exception: Too few arguments to function callback2(), 3 passed and exactly 4 expected
-- Testing array_walk() function with too many callback parameters --
-
-Warning: array_walk() expects at most 3 parameters, 4 given in %s on line %d
-NULL
+Exception: array_walk() expects at most 3 parameters, 4 given
Done
diff --git a/ext/standard/tests/array/array_walk_object1.phpt b/ext/standard/tests/array/array_walk_object1.phpt
index cd06ea3096..b352a07086 100644
--- a/ext/standard/tests/array/array_walk_object1.phpt
+++ b/ext/standard/tests/array/array_walk_object1.phpt
@@ -8,7 +8,7 @@ Test array_walk() function : object functionality
*/
/*
-* Pasing object in place of 'input' argument to test object functionatlity
+* Passing object in place of 'input' argument to test object functionality
*/
echo "*** Testing array_walk() : object functionality ***\n";
diff --git a/ext/standard/tests/array/array_walk_objects.phpt b/ext/standard/tests/array/array_walk_objects.phpt
index fc04304fc5..a4a517746d 100644
--- a/ext/standard/tests/array/array_walk_objects.phpt
+++ b/ext/standard/tests/array/array_walk_objects.phpt
@@ -4,13 +4,13 @@ array_walk() and objects
<?php
function walk($key, $value) {
- var_dump($value, $key);
+ var_dump($value, $key);
}
class test {
- private $var_pri = "test_private";
- protected $var_pro = "test_protected";
- public $var_pub = "test_public";
+ private $var_pri = "test_private";
+ protected $var_pro = "test_protected";
+ public $var_pub = "test_public";
}
$stdclass = new stdclass;
@@ -24,7 +24,11 @@ array_walk($t, "walk");
$var = array();
array_walk($var, "walk");
$var = "";
-array_walk($var, "walk");
+try {
+ array_walk($var, "walk");
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done\n";
?>
@@ -39,6 +43,5 @@ string(10) "%r\0%r*%r\0%rvar_pro"
string(14) "test_protected"
string(7) "var_pub"
string(11) "test_public"
-
-Warning: array_walk() expects parameter 1 to be array, string given in %s on line %d
+array_walk() expects parameter 1 to be array, string given
Done
diff --git a/ext/standard/tests/array/array_walk_rec_objects.phpt b/ext/standard/tests/array/array_walk_rec_objects.phpt
index a83c227a3b..51aeae11c9 100644
--- a/ext/standard/tests/array/array_walk_rec_objects.phpt
+++ b/ext/standard/tests/array/array_walk_rec_objects.phpt
@@ -4,13 +4,13 @@ array_walk_recursive() and objects
<?php
function walk($key, $value) {
- var_dump($value, $key);
+ var_dump($value, $key);
}
class test {
- private $var_pri = "test_private";
- protected $var_pro = "test_protected";
- public $var_pub = "test_public";
+ private $var_pri = "test_private";
+ protected $var_pro = "test_protected";
+ public $var_pub = "test_public";
}
$stdclass = new stdclass;
@@ -24,7 +24,11 @@ array_walk_recursive($t, "walk");
$var = array();
array_walk_recursive($var, "walk");
$var = "";
-array_walk_recursive($var, "walk");
+try {
+ array_walk_recursive($var, "walk");
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done\n";
?>
@@ -39,6 +43,5 @@ string(10) "%r\0%r*%r\0%rvar_pro"
string(14) "test_protected"
string(7) "var_pub"
string(11) "test_public"
-
-Warning: array_walk_recursive() expects parameter 1 to be array, string given in %s on line %d
+array_walk_recursive() expects parameter 1 to be array, string given
Done
diff --git a/ext/standard/tests/array/array_walk_recursive.phpt b/ext/standard/tests/array/array_walk_recursive.phpt
index c8523055e9..0a7fc03a85 100644
--- a/ext/standard/tests/array/array_walk_recursive.phpt
+++ b/ext/standard/tests/array/array_walk_recursive.phpt
@@ -3,11 +3,11 @@ Test array_walk_recursive()
--FILE--
<?php
function foo($value) {
- echo $value . " foo\n";
+ echo $value . " foo\n";
}
function bar($value) {
- echo $value . " bar\n";
+ echo $value . " bar\n";
}
$arr = array (1,2,3);
diff --git a/ext/standard/tests/array/array_walk_recursive1.phpt b/ext/standard/tests/array/array_walk_recursive1.phpt
index 962f133e4c..472cb1032d 100644
--- a/ext/standard/tests/array/array_walk_recursive1.phpt
+++ b/ext/standard/tests/array/array_walk_recursive1.phpt
@@ -3,42 +3,28 @@ array_walk_recursive() tests
--FILE--
<?php
-var_dump(array_walk_recursive());
-$var = 1;
-var_dump(array_walk_recursive($var,1));
-$var = array();
-var_dump(array_walk_recursive($var,""));
-
function foo($v1, $v2, $v3) {
- var_dump($v1);
- var_dump($v2);
- var_dump($v3);
+ var_dump($v1);
+ var_dump($v2);
+ var_dump($v3);
}
$var = array(1,2, array(2,3));
var_dump(array_walk_recursive($var, "foo", "data"));
function foo2($v1, $v2, $v3) {
- throw new Exception($v3);
+ throw new Exception($v3);
}
try {
- var_dump(array_walk_recursive($var,"foo2", "data"));
+ var_dump(array_walk_recursive($var,"foo2", "data"));
} catch (Exception $e) {
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
echo "Done\n";
?>
--EXPECTF--
-Warning: array_walk_recursive() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: array_walk_recursive() expects parameter 1 to be array, int given in %s on line %d
-NULL
-
-Warning: array_walk_recursive() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d
-NULL
int(1)
int(0)
string(4) "data"
diff --git a/ext/standard/tests/array/array_walk_recursive_error2.phpt b/ext/standard/tests/array/array_walk_recursive_error2.phpt
index b162a1c9dc..f1686d7acd 100644
--- a/ext/standard/tests/array/array_walk_recursive_error2.phpt
+++ b/ext/standard/tests/array/array_walk_recursive_error2.phpt
@@ -23,33 +23,33 @@ echo "*** Testing array_walk_recursive() : error conditions - callback parameter
// expected: Missing argument Warning
try {
- var_dump( array_walk_recursive($input, "callback1") );
+ var_dump( array_walk_recursive($input, "callback1") );
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
try {
- var_dump( array_walk_recursive($input, "callback2", 4) );
+ var_dump( array_walk_recursive($input, "callback2", 4) );
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
// expected: Warning is suppressed
try {
- var_dump( @array_walk_recursive($input, "callback1") );
+ var_dump( @array_walk_recursive($input, "callback1") );
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
try {
- var_dump( @array_walk_recursive($input, "callback2", 4) );
+ var_dump( @array_walk_recursive($input, "callback2", 4) );
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
echo "-- Testing array_walk_recursive() function with too many callback parameters --\n";
try {
- var_dump( array_walk_recursive($input, "callback1", 20, 10) );
+ var_dump( array_walk_recursive($input, "callback1", 20, 10) );
} catch (Throwable $e) {
- echo "Exception: " . $e->getMessage() . "\n";
+ echo "Exception: " . $e->getMessage() . "\n";
}
echo "Done";
@@ -61,7 +61,5 @@ Exception: Too few arguments to function callback2(), 3 passed and exactly 4 exp
Exception: Too few arguments to function callback1(), 2 passed and exactly 3 expected
Exception: Too few arguments to function callback2(), 3 passed and exactly 4 expected
-- Testing array_walk_recursive() function with too many callback parameters --
-
-Warning: array_walk_recursive() expects at most 3 parameters, 4 given in %s on line %d
-NULL
+Exception: array_walk_recursive() expects at most 3 parameters, 4 given
Done
diff --git a/ext/standard/tests/array/array_walk_recursive_variation7.phpt b/ext/standard/tests/array/array_walk_recursive_variation7.phpt
index 06dc1aaa09..a0c159d71d 100644
--- a/ext/standard/tests/array/array_walk_recursive_variation7.phpt
+++ b/ext/standard/tests/array/array_walk_recursive_variation7.phpt
@@ -29,9 +29,6 @@ var_dump( array_walk_recursive($input, function($value, $key) { var_dump($key);
echo "-- Anonymous function with three arguments --\n";
var_dump( array_walk_recursive($input, function($value, $key, $user_data) { var_dump($key); var_dump($value); var_dump($user_data); echo "\n"; }, 10));
-echo "-- Anonymous function with one more argument --\n";
-var_dump( array_walk_recursive($input, function($value, $key, $user_data) { var_dump($key); var_dump($value); var_dump($user_data); echo "\n"; }, 20, 30));
-
echo "-- Anonymous function with null argument --\n";
var_dump( array_walk_recursive( $input, function() { echo "1\n"; }));
echo "Done"
@@ -80,10 +77,6 @@ int(0)
int(10)
bool(true)
--- Anonymous function with one more argument --
-
-Warning: array_walk_recursive() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-- Anonymous function with null argument --
1
1
diff --git a/ext/standard/tests/array/array_walk_recursive_variation8.phpt b/ext/standard/tests/array/array_walk_recursive_variation8.phpt
index 2db8067fe0..51eba1e0e0 100644
--- a/ext/standard/tests/array/array_walk_recursive_variation8.phpt
+++ b/ext/standard/tests/array/array_walk_recursive_variation8.phpt
@@ -25,7 +25,11 @@ echo "-- With 'min' built-in function --\n";
var_dump( array_walk_recursive($input, "min"));
echo "-- With 'echo' language construct --\n";
-var_dump( array_walk_recursive($input, "echo"));
+try {
+ var_dump( array_walk_recursive($input, "echo"));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done"
?>
@@ -36,7 +40,5 @@ bool(true)
-- With 'min' built-in function --
bool(true)
-- With 'echo' language construct --
-
-Warning: array_walk_recursive() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d
-NULL
+array_walk_recursive() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name
Done
diff --git a/ext/standard/tests/array/array_walk_variation7.phpt b/ext/standard/tests/array/array_walk_variation7.phpt
index 671ad44309..0354782eda 100644
--- a/ext/standard/tests/array/array_walk_variation7.phpt
+++ b/ext/standard/tests/array/array_walk_variation7.phpt
@@ -29,9 +29,6 @@ var_dump( array_walk($input, function($value, $key) { var_dump($key); var_dump($
echo "-- Anonymous function with three arguments --\n";
var_dump( array_walk($input, function($value, $key, $user_data) { var_dump($key); var_dump($value); var_dump($user_data); echo "\n"; }, 10));
-echo "-- Anonymous function with one more argument --\n";
-var_dump( array_walk($input, function($value, $key, $user_data) { var_dump($key); var_dump($value); var_dump($user_data); echo "\n"; }, 20, 30));
-
echo "-- Anonymous function with null argument --\n";
var_dump( array_walk( $input, function() { echo "1\n"; }));
echo "Done"
@@ -80,10 +77,6 @@ int(0)
int(10)
bool(true)
--- Anonymous function with one more argument --
-
-Warning: array_walk() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-- Anonymous function with null argument --
1
1
diff --git a/ext/standard/tests/array/array_walk_variation8.phpt b/ext/standard/tests/array/array_walk_variation8.phpt
index 829baf1add..baa5f3914b 100644
--- a/ext/standard/tests/array/array_walk_variation8.phpt
+++ b/ext/standard/tests/array/array_walk_variation8.phpt
@@ -25,7 +25,11 @@ echo "-- With 'min' built-in function --\n";
var_dump( array_walk($input, "min"));
echo "-- With 'echo' language construct --\n";
-var_dump( array_walk($input, "echo"));
+try {
+ var_dump( array_walk($input, "echo"));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done"
?>
@@ -36,7 +40,5 @@ bool(true)
-- With 'min' built-in function --
bool(true)
-- With 'echo' language construct --
-
-Warning: array_walk() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d
-NULL
+array_walk() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name
Done
diff --git a/ext/standard/tests/array/arsort_basic.phpt b/ext/standard/tests/array/arsort_basic.phpt
index afd8bb8f49..7ed285aac7 100644
--- a/ext/standard/tests/array/arsort_basic.phpt
+++ b/ext/standard/tests/array/arsort_basic.phpt
@@ -21,9 +21,9 @@ echo "*** Testing arsort() : basic functionality ***\n";
// an array containing unsorted string values with indices
$unsorted_strings = array(
- "l" => "lemon", "o" => "orange",
- "O" => "Orange", "O1" => "Orange1", "o2" => "orange2", "O3" => "Orange3", "o20" => "orange20",
- "b" => "banana",
+ "l" => "lemon", "o" => "orange",
+ "O" => "Orange", "O1" => "Orange1", "o2" => "orange2", "O3" => "Orange3", "o20" => "orange20",
+ "b" => "banana",
);
// an array containing unsorted numeric values with indices
$unsorted_numerics = array( 1 => 100, 2 => 33, 3 => 555, 4 => 22 );
diff --git a/ext/standard/tests/array/arsort_object1.phpt b/ext/standard/tests/array/arsort_object1.phpt
index d8b8991699..7971a1e7e0 100644
--- a/ext/standard/tests/array/arsort_object1.phpt
+++ b/ext/standard/tests/array/arsort_object1.phpt
@@ -10,7 +10,7 @@ Test arsort() function : object functionality - sort objects
/*
* testing arsort() by providing integer/string object arrays with following flag values
- * 1. Defualt flag value
+ * 1. Default flag value
* 2. SORT_REGULAR - compare items normally
*/
@@ -59,14 +59,14 @@ $unsorted_str_obj = array (
);
-echo "\n-- Testing arsort() by supplying various object arrays, 'flag' value is defualt --\n";
+echo "\n-- Testing arsort() by supplying various object arrays, 'flag' value is default --\n";
-// testing arsort() function by supplying integer object array, flag value is defualt
+// testing arsort() function by supplying integer object array, flag value is default
$temp_array = $unsorted_int_obj;
var_dump(arsort($temp_array) );
var_dump($temp_array);
-// testing arsort() function by supplying string object array, flag value is defualt
+// testing arsort() function by supplying string object array, flag value is default
$temp_array = $unsorted_str_obj;
var_dump(arsort($temp_array) );
var_dump($temp_array);
@@ -87,7 +87,7 @@ echo "Done\n";
--EXPECT--
*** Testing arsort() : object functionality ***
--- Testing arsort() by supplying various object arrays, 'flag' value is defualt --
+-- Testing arsort() by supplying various object arrays, 'flag' value is default --
bool(true)
array(6) {
[2]=>
diff --git a/ext/standard/tests/array/arsort_object2.phpt b/ext/standard/tests/array/arsort_object2.phpt
index 79bee33d91..901b599c6a 100644
--- a/ext/standard/tests/array/arsort_object2.phpt
+++ b/ext/standard/tests/array/arsort_object2.phpt
@@ -10,7 +10,7 @@ Test arsort() function : object functionality - sorting objects with diff. acces
/*
* testing arsort() by providing integer/string object arrays with following flag values
- * 1. Defualt flag value
+ * 1. Default flag value
2. SORT_REGULAR - compare items normally
*/
diff --git a/ext/standard/tests/array/arsort_variation10.phpt b/ext/standard/tests/array/arsort_variation10.phpt
index 67a0499aa3..058b331010 100644
--- a/ext/standard/tests/array/arsort_variation10.phpt
+++ b/ext/standard/tests/array/arsort_variation10.phpt
@@ -10,7 +10,7 @@ Test arsort() function : usage variations - sort octal values
/*
* testing arsort() by providing different octal array for $array argument with following flag values
- * 1.flag value as defualt
+ * 1.flag value as default
* 2.SORT_REGULAR - compare items normally
* 3.SORT_NUMERIC - compare items numerically
*/
@@ -23,7 +23,7 @@ $unsorted_oct_array = array (
077 => 077, -066 => -066, -0345 => -0345, 0 => 0
);
-echo "\n-- Testing arsort() by supplying octal value array, 'flag' value is defualt --\n";
+echo "\n-- Testing arsort() by supplying octal value array, 'flag' value is default --\n";
$temp_array = $unsorted_oct_array;
var_dump( arsort($temp_array) ); // expecting : bool(true)
var_dump($temp_array);
@@ -43,7 +43,7 @@ echo "Done\n";
--EXPECT--
*** Testing arsort() : usage variations ***
--- Testing arsort() by supplying octal value array, 'flag' value is defualt --
+-- Testing arsort() by supplying octal value array, 'flag' value is default --
bool(true)
array(9) {
[669]=>
diff --git a/ext/standard/tests/array/arsort_variation3.phpt b/ext/standard/tests/array/arsort_variation3.phpt
index 9f8d47f47c..9981f7a984 100644
--- a/ext/standard/tests/array/arsort_variation3.phpt
+++ b/ext/standard/tests/array/arsort_variation3.phpt
@@ -10,7 +10,7 @@ Test arsort() function : usage variations - sort integer/float values
/*
* Testing arsort() by providing different integer/float value arrays for $array argument with following values
- * 1. flag value as defualt
+ * 1. flag value as default
* 2. SORT_REGULAR - compare items normally
* 3. SORT_NUMERIC - compare items numerically
*/
diff --git a/ext/standard/tests/array/arsort_variation4.phpt b/ext/standard/tests/array/arsort_variation4.phpt
index fa939472b9..3852989bb5 100644
--- a/ext/standard/tests/array/arsort_variation4.phpt
+++ b/ext/standard/tests/array/arsort_variation4.phpt
@@ -10,7 +10,7 @@ Test arsort() function : usage variations - sort reference variables
/*
* Testing arsort() by providing reference variable array with following flag values
- * flag value as defualt
+ * flag value as default
* SORT_REGULAR - compare items normally
* SORT_NUMERIC - compare items numerically
*/
@@ -24,7 +24,7 @@ $value3 = 555;
// an array containing integer references
$unsorted_numerics = array( 1 => &$value1 , 2 => &$value2, 3 => &$value3);
-echo "\n-- Testing arsort() by supplying reference variable array, 'flag' value is defualt --\n";
+echo "\n-- Testing arsort() by supplying reference variable array, 'flag' value is default --\n";
$temp_array = $unsorted_numerics;
var_dump( arsort($temp_array) ); // expecting : bool(true)
var_dump( $temp_array);
@@ -44,7 +44,7 @@ echo "Done\n";
--EXPECT--
*** Testing arsort() :usage variations ***
--- Testing arsort() by supplying reference variable array, 'flag' value is defualt --
+-- Testing arsort() by supplying reference variable array, 'flag' value is default --
bool(true)
array(3) {
[3]=>
diff --git a/ext/standard/tests/array/arsort_variation5.phpt b/ext/standard/tests/array/arsort_variation5.phpt
index 15a8395481..42062e937d 100644
--- a/ext/standard/tests/array/arsort_variation5.phpt
+++ b/ext/standard/tests/array/arsort_variation5.phpt
@@ -10,7 +10,7 @@ Test arsort() function : usage variations - sort strings
/*
* testing arsort() by providing different string arrays for $array argument with following flag values
- * flag value as defualt
+ * flag value as default
* SORT_REGULAR - compare items normally
* SORT_STRING - compare items as strings
*/
diff --git a/ext/standard/tests/array/arsort_variation6.phpt b/ext/standard/tests/array/arsort_variation6.phpt
index 058a5077b1..10825d1f08 100644
--- a/ext/standard/tests/array/arsort_variation6.phpt
+++ b/ext/standard/tests/array/arsort_variation6.phpt
@@ -10,7 +10,7 @@ Test arsort() function : usage variations - sort hexadecimal values
/*
* testing arsort() by providing different hexa-decimal array for $array argument with following flag values
- * flag value as defualt
+ * flag value as default
* SORT_REGULAR - compare items normally
* SORT_NUMERIC - compare items numerically
*/
@@ -23,7 +23,7 @@ $unsorted_hex_array = array ( 0x1AB => 0x1AB, 0xFFF => 0xFFF, 0xF => 0xF, 0xFF =
0x1ab => 0x1ab, 0xff => 0xff, -0xff => -0xFF, 0 => 0, -0x2aa => -0x2aa
);
-echo "\n-- Testing arsort() by supplying hexadecimal value array, 'flag' value is defualt --\n";
+echo "\n-- Testing arsort() by supplying hexadecimal value array, 'flag' value is default --\n";
$temp_array = $unsorted_hex_array;
var_dump(arsort($temp_array) ); // expecting : bool(true)
var_dump($temp_array);
@@ -43,7 +43,7 @@ echo "Done\n";
--EXPECT--
*** Testing arsort() : usage variations ***
--- Testing arsort() by supplying hexadecimal value array, 'flag' value is defualt --
+-- Testing arsort() by supplying hexadecimal value array, 'flag' value is default --
bool(true)
array(9) {
[4095]=>
diff --git a/ext/standard/tests/array/arsort_variation7.phpt b/ext/standard/tests/array/arsort_variation7.phpt
index 3c8b6206c2..929b441d15 100644
--- a/ext/standard/tests/array/arsort_variation7.phpt
+++ b/ext/standard/tests/array/arsort_variation7.phpt
@@ -10,7 +10,7 @@ Test arsort() function : usage variations - sort bool values
/*
* testing arsort() by providing bool value array for $array argument with following flag values.
- * flag value as defualt
+ * flag value as default
* SORT_REGULAR - compare items normally
*/
@@ -19,7 +19,7 @@ echo "*** Testing arsort() : usage variations ***\n";
// bool value array
$bool_values = array (1 => true, 2 => false, 3 => TRUE, 4 => FALSE);
-echo "\n-- Testing arsort() by supplying bool value array, 'flag' value is defualt --\n";
+echo "\n-- Testing arsort() by supplying bool value array, 'flag' value is default --\n";
$temp_array = $bool_values;
var_dump(arsort($temp_array) );
var_dump($temp_array);
@@ -44,7 +44,7 @@ echo "Done\n";
--EXPECT--
*** Testing arsort() : usage variations ***
--- Testing arsort() by supplying bool value array, 'flag' value is defualt --
+-- Testing arsort() by supplying bool value array, 'flag' value is default --
bool(true)
array(4) {
[1]=>
diff --git a/ext/standard/tests/array/asort_basic.phpt b/ext/standard/tests/array/asort_basic.phpt
index c0ae2bc88d..8b4a7c2081 100644
--- a/ext/standard/tests/array/asort_basic.phpt
+++ b/ext/standard/tests/array/asort_basic.phpt
@@ -21,9 +21,9 @@ echo "*** Testing asort() : basic functionality ***\n";
// an array containing unsorted string values with indices
$unsorted_strings = array(
- "l" => "lemon", "o" => "orange",
- "O" => "Orange", "O1" => "Orange1", "o2" => "orange2", "O3" => "Orange3", "o20" => "orange20",
- "b" => "banana",
+ "l" => "lemon", "o" => "orange",
+ "O" => "Orange", "O1" => "Orange1", "o2" => "orange2", "O3" => "Orange3", "o20" => "orange20",
+ "b" => "banana",
);
// an array containing unsorted numeric values with indices
$unsorted_numerics = array( 1 => 100, 2 => 33, 3 => 555, 4 => 22 );
diff --git a/ext/standard/tests/array/asort_object1.phpt b/ext/standard/tests/array/asort_object1.phpt
index 21984de67e..e2fa42993e 100644
--- a/ext/standard/tests/array/asort_object1.phpt
+++ b/ext/standard/tests/array/asort_object1.phpt
@@ -10,7 +10,7 @@ Test asort() function : object functionality - sort objects
/*
* testing asort() by providing integer/string object arrays with following flag values
- * 1. Defualt flag value
+ * 1. Default flag value
* 2. SORT_REGULAR - compare items normally
*/
@@ -59,14 +59,14 @@ $unsorted_str_obj = array (
);
-echo "\n-- Testing asort() by supplying various object arrays, 'flag' value is defualt --\n";
+echo "\n-- Testing asort() by supplying various object arrays, 'flag' value is default --\n";
-// testing asort() function by supplying integer object array, flag value is defualt
+// testing asort() function by supplying integer object array, flag value is default
$temp_array = $unsorted_int_obj;
var_dump(asort($temp_array) );
var_dump($temp_array);
-// testing asort() function by supplying string object array, flag value is defualt
+// testing asort() function by supplying string object array, flag value is default
$temp_array = $unsorted_str_obj;
var_dump(asort($temp_array) );
var_dump($temp_array);
@@ -87,7 +87,7 @@ echo "Done\n";
--EXPECTF--
*** Testing asort() : object functionality ***
--- Testing asort() by supplying various object arrays, 'flag' value is defualt --
+-- Testing asort() by supplying various object arrays, 'flag' value is default --
bool(true)
array(6) {
[4]=>
diff --git a/ext/standard/tests/array/asort_object2.phpt b/ext/standard/tests/array/asort_object2.phpt
index 8f2a666146..1de4f35fae 100644
--- a/ext/standard/tests/array/asort_object2.phpt
+++ b/ext/standard/tests/array/asort_object2.phpt
@@ -10,7 +10,7 @@ Test asort() function : object functionality - sorting objects with diff. access
/*
* testing asort() by providing integer/string object arrays with following flag values
- * 1. Defualt flag value
+ * 1. Default flag value
2. SORT_REGULAR - compare items normally
*/
diff --git a/ext/standard/tests/array/asort_variation10.phpt b/ext/standard/tests/array/asort_variation10.phpt
index 4b9ccd2f51..0ead69d27e 100644
--- a/ext/standard/tests/array/asort_variation10.phpt
+++ b/ext/standard/tests/array/asort_variation10.phpt
@@ -10,7 +10,7 @@ Test asort() function : usage variations - sort octal values
/*
* testing asort() by providing different octal array for $array argument with following flag values
- * 1.flag value as defualt
+ * 1.flag value as default
* 2.SORT_REGULAR - compare items normally
* 3.SORT_NUMERIC - compare items numerically
*/
@@ -23,7 +23,7 @@ $unsorted_oct_array = array (
077 => 077, -066 => -066, -0345 => -0345, 0 => 0
);
-echo "\n-- Testing asort() by supplying octal value array, 'flag' value is defualt --\n";
+echo "\n-- Testing asort() by supplying octal value array, 'flag' value is default --\n";
$temp_array = $unsorted_oct_array;
var_dump( asort($temp_array) ); // expecting : bool(true)
var_dump($temp_array);
@@ -43,7 +43,7 @@ echo "Done\n";
--EXPECT--
*** Testing asort() : usage variations ***
--- Testing asort() by supplying octal value array, 'flag' value is defualt --
+-- Testing asort() by supplying octal value array, 'flag' value is default --
bool(true)
array(9) {
[-229]=>
diff --git a/ext/standard/tests/array/asort_variation3.phpt b/ext/standard/tests/array/asort_variation3.phpt
index 4ad106b658..a1435ecd9c 100644
--- a/ext/standard/tests/array/asort_variation3.phpt
+++ b/ext/standard/tests/array/asort_variation3.phpt
@@ -10,7 +10,7 @@ Test asort() function : usage variations - sort integer/float values
/*
* Testing asort() by providing different integer/float value arrays for $array argument with following values
- * 1. flag value as defualt
+ * 1. flag value as default
* 2. SORT_REGULAR - compare items normally
* 3. SORT_NUMERIC - compare items numerically
*/
diff --git a/ext/standard/tests/array/asort_variation4.phpt b/ext/standard/tests/array/asort_variation4.phpt
index 6dd60e3e7e..09933dba15 100644
--- a/ext/standard/tests/array/asort_variation4.phpt
+++ b/ext/standard/tests/array/asort_variation4.phpt
@@ -10,7 +10,7 @@ Test asort() function : usage variations - sort reference variables
/*
* Testing asort() by providing reference variable array with following flag values
- * flag value as defualt
+ * flag value as default
* SORT_REGULAR - compare items normally
* SORT_NUMERIC - compare items numerically
*/
@@ -24,7 +24,7 @@ $value3 = 555;
// an array containing integer references
$unsorted_numerics = array( 1 => &$value1 , 2 => &$value2, 3 => &$value3);
-echo "\n-- Testing asort() by supplying reference variable array, 'flag' value is defualt --\n";
+echo "\n-- Testing asort() by supplying reference variable array, 'flag' value is default --\n";
$temp_array = $unsorted_numerics;
var_dump( asort($temp_array) ); // expecting : bool(true)
var_dump( $temp_array);
@@ -44,7 +44,7 @@ echo "Done\n";
--EXPECT--
*** Testing asort() :usage variations ***
--- Testing asort() by supplying reference variable array, 'flag' value is defualt --
+-- Testing asort() by supplying reference variable array, 'flag' value is default --
bool(true)
array(3) {
[2]=>
diff --git a/ext/standard/tests/array/asort_variation5.phpt b/ext/standard/tests/array/asort_variation5.phpt
index dfb690ee56..7ae231b361 100644
--- a/ext/standard/tests/array/asort_variation5.phpt
+++ b/ext/standard/tests/array/asort_variation5.phpt
@@ -10,7 +10,7 @@ Test asort() function : usage variations - sort strings
/*
* testing asort() by providing different string arrays for $array argument with following flag values
- * flag value as defualt
+ * flag value as default
* SORT_REGULAR - compare items normally
* SORT_STRING - compare items as strings
*/
diff --git a/ext/standard/tests/array/asort_variation6.phpt b/ext/standard/tests/array/asort_variation6.phpt
index 3d879c1b3b..aa5b4edd3d 100644
--- a/ext/standard/tests/array/asort_variation6.phpt
+++ b/ext/standard/tests/array/asort_variation6.phpt
@@ -10,7 +10,7 @@ Test asort() function : usage variations - sort hexadecimal values
/*
* testing asort() by providing different hexa-decimal array for $array argument with following flag values
- * flag value as defualt
+ * flag value as default
* SORT_REGULAR - compare items normally
* SORT_NUMERIC - compare items numerically
*/
@@ -23,7 +23,7 @@ $unsorted_hex_array = array ( 0x1AB => 0x1AB, 0xFFF => 0xFFF, 0xF => 0xF, 0xFF =
0x1ab => 0x1ab, 0xff => 0xff, -0xff => -0xFF, 0 => 0, -0x2aa => -0x2aa
);
-echo "\n-- Testing asort() by supplying hexadecimal value array, 'flag' value is defualt --\n";
+echo "\n-- Testing asort() by supplying hexadecimal value array, 'flag' value is default --\n";
$temp_array = $unsorted_hex_array;
var_dump(asort($temp_array) ); // expecting : bool(true)
var_dump($temp_array);
@@ -43,7 +43,7 @@ echo "Done\n";
--EXPECT--
*** Testing asort() : usage variations ***
--- Testing asort() by supplying hexadecimal value array, 'flag' value is defualt --
+-- Testing asort() by supplying hexadecimal value array, 'flag' value is default --
bool(true)
array(9) {
[-682]=>
diff --git a/ext/standard/tests/array/asort_variation7.phpt b/ext/standard/tests/array/asort_variation7.phpt
index 892dd82238..97718ed43e 100644
--- a/ext/standard/tests/array/asort_variation7.phpt
+++ b/ext/standard/tests/array/asort_variation7.phpt
@@ -10,7 +10,7 @@ Test asort() function : usage variations - sort bool values
/*
* testing asort() by providing bool value array for $array argument with following flag values.
- * flag value as defualt
+ * flag value as default
* SORT_REGULAR - compare items normally
*/
@@ -19,7 +19,7 @@ echo "*** Testing asort() : usage variations ***\n";
// bool value array
$bool_values = array (1 => true, 2 => false, 3 => TRUE, 4 => FALSE);
-echo "\n-- Testing asort() by supplying bool value array, 'flag' value is defualt --\n";
+echo "\n-- Testing asort() by supplying bool value array, 'flag' value is default --\n";
$temp_array = $bool_values;
var_dump(asort($temp_array) );
var_dump($temp_array);
@@ -44,7 +44,7 @@ echo "Done\n";
--EXPECT--
*** Testing asort() : usage variations ***
--- Testing asort() by supplying bool value array, 'flag' value is defualt --
+-- Testing asort() by supplying bool value array, 'flag' value is default --
bool(true)
array(4) {
[2]=>
diff --git a/ext/standard/tests/array/bug12776.phpt b/ext/standard/tests/array/bug12776.phpt
index 54c6f6fceb..957832b97e 100644
--- a/ext/standard/tests/array/bug12776.phpt
+++ b/ext/standard/tests/array/bug12776.phpt
@@ -5,10 +5,10 @@ Bug #12776 (array_walk crash)
function test($val,$key)
{
- global $globalArray;
- $globalArray[]=$key; // this will end up crashing
- $globalArray[]=(string)$key; // this will end up OK
- print "val: $val; key: $key\n"; flush();
+ global $globalArray;
+ $globalArray[]=$key; // this will end up crashing
+ $globalArray[]=(string)$key; // this will end up OK
+ print "val: $val; key: $key\n"; flush();
}
$arr=array('k'=>'v');
diff --git a/ext/standard/tests/array/bug14580.phpt b/ext/standard/tests/array/bug14580.phpt
index 1cf27f22d6..8f4c7d5bd3 100644
--- a/ext/standard/tests/array/bug14580.phpt
+++ b/ext/standard/tests/array/bug14580.phpt
@@ -2,10 +2,10 @@
Bug #14580 (key() not binary safe)
--FILE--
<?php
- $arr = array ("foo\0bar" => "foo\0bar");
- $key = key($arr);
- echo strlen($key), ': ';
- echo urlencode($key), "\n";
+ $arr = array ("foo\0bar" => "foo\0bar");
+ $key = key($arr);
+ echo strlen($key), ': ';
+ echo urlencode($key), "\n";
?>
--EXPECT--
7: foo%00bar
diff --git a/ext/standard/tests/array/bug20381.phpt b/ext/standard/tests/array/bug20381.phpt
index 1adaa863b7..0da52d9fd9 100644
--- a/ext/standard/tests/array/bug20381.phpt
+++ b/ext/standard/tests/array/bug20381.phpt
@@ -3,20 +3,20 @@ Bug #20381 (array_merge_recursive mangles input arrays)
--FILE--
<?php
$a = array(
- 'a1' => 1,
- 'a2' => array( 1, 2, 3 ),
- 'a3' => array(
- 'a' => array( 10, 20, 30 ),
- 'b' => 'b'
- )
- );
+ 'a1' => 1,
+ 'a2' => array( 1, 2, 3 ),
+ 'a3' => array(
+ 'a' => array( 10, 20, 30 ),
+ 'b' => 'b'
+ )
+ );
$b = array( 'a1' => 2,
- 'a2' => array( 3, 4, 5 ),
- 'a3' => array(
- 'c' => 'cc',
- 'a' => array( 10, 40 )
- )
- );
+ 'a2' => array( 3, 4, 5 ),
+ 'a3' => array(
+ 'c' => 'cc',
+ 'a' => array( 10, 40 )
+ )
+ );
var_dump($a);
array_merge_recursive( $a, $b );
diff --git a/ext/standard/tests/array/bug20865.phpt b/ext/standard/tests/array/bug20865.phpt
index f1edbabab5..6dfad2bcec 100644
--- a/ext/standard/tests/array/bug20865.phpt
+++ b/ext/standard/tests/array/bug20865.phpt
@@ -2,10 +2,10 @@
Bug #20865 (array_key_exists and NULL key)
--FILE--
<?php
- $ta = array(1, 2, 3);
- $ta[NULL] = "Null Value";
+ $ta = array(1, 2, 3);
+ $ta[NULL] = "Null Value";
- var_dump(array_key_exists(NULL, $ta));
+ var_dump(array_key_exists(NULL, $ta));
?>
--EXPECT--
bool(true)
diff --git a/ext/standard/tests/array/bug21918.phpt b/ext/standard/tests/array/bug21918.phpt
index 1c9d746fdf..e855aacd7e 100644
--- a/ext/standard/tests/array/bug21918.phpt
+++ b/ext/standard/tests/array/bug21918.phpt
@@ -7,8 +7,8 @@ echo "==Mixed==\n";
$a = array(-1=>'a', '-2'=>'b', 3=>'c', '4'=>'d', 5=>'e', '6001'=>'f', '07'=>'g');
foreach($a as $k => $v) {
- var_dump($k);
- var_dump($v);
+ var_dump($k);
+ var_dump($v);
}
echo "==Normal==\n";
@@ -16,19 +16,18 @@ $b = array();
$b[] = 'a';
foreach($b as $k => $v) {
- var_dump($k);
- var_dump($v);
+ var_dump($k);
+ var_dump($v);
}
echo "==Negative==\n";
$c = array('-2' => 'a');
foreach($c as $k => $v) {
- var_dump($k);
- var_dump($v);
+ var_dump($k);
+ var_dump($v);
}
-echo "==Done==\n";
?>
--EXPECT--
==Mixed==
@@ -52,4 +51,3 @@ string(1) "a"
==Negative==
int(-2)
string(1) "a"
-==Done==
diff --git a/ext/standard/tests/array/bug22463.phpt b/ext/standard/tests/array/bug22463.phpt
index 7993ac2576..434c2b6e23 100644
--- a/ext/standard/tests/array/bug22463.phpt
+++ b/ext/standard/tests/array/bug22463.phpt
@@ -4,23 +4,23 @@ Bug #22463 (array_reduce() segfaults)
<?php
function a($ary) {
- return (is_array($ary) ? array_reduce($ary, 'cb', 0) : 1);
+ return (is_array($ary) ? array_reduce($ary, 'cb', 0) : 1);
}
function cb($v, $elem) {
- return $v + a($elem);
+ return $v + a($elem);
}
$ary = array(
- array(
- array(
- array(
- array(
- array(0, 1, 2, 3, 4)
- )
- )
- )
- )
+ array(
+ array(
+ array(
+ array(
+ array(0, 1, 2, 3, 4)
+ )
+ )
+ )
+ )
);
var_dump(a($ary));
diff --git a/ext/standard/tests/array/bug24220.phpt b/ext/standard/tests/array/bug24220.phpt
index c8e25709e9..d0242e6bf9 100644
--- a/ext/standard/tests/array/bug24220.phpt
+++ b/ext/standard/tests/array/bug24220.phpt
@@ -2,9 +2,9 @@
Bug #24220 (range() numeric string handling)
--FILE--
<?php
- var_dump(range("2003", "2004"));
- var_dump(range("a", "z"));
- var_dump(range("1", "10"));
+ var_dump(range("2003", "2004"));
+ var_dump(range("a", "z"));
+ var_dump(range("1", "10"));
?>
--EXPECT--
array(2) {
diff --git a/ext/standard/tests/array/bug24980.phpt b/ext/standard/tests/array/bug24980.phpt
index 6c97562f6c..829e156afd 100644
--- a/ext/standard/tests/array/bug24980.phpt
+++ b/ext/standard/tests/array/bug24980.phpt
@@ -5,9 +5,9 @@ Bug #24980 (array_reduce() uses first element as default running total)
/* test #1: numeric data */
function add_up($running_total, $current_value)
{
- echo "running_total is ".(int)$running_total.", current_value is {$current_value}\n";
- $running_total += $current_value * $current_value;
- return $running_total;
+ echo "running_total is ".(int)$running_total.", current_value is {$current_value}\n";
+ $running_total += $current_value * $current_value;
+ return $running_total;
}
$numbers = array (2,3,5,7);
@@ -18,20 +18,20 @@ print "Total is $total\n";
$a = array("a", "b", "c");
function foo ($a, $b)
{
- return $a . $b;
+ return $a . $b;
}
var_dump(array_reduce($a, "foo"));
/* test #3: basic test (used to leak memory) */
function rsum($v, $w)
{
- $v += $w;
- return $v;
+ $v += $w;
+ return $v;
}
function rmul($v, $w)
{
- $v *= $w;
- return $v;
+ $v *= $w;
+ return $v;
}
$a = array(1, 2, 3, 4, 5);
$x = array();
diff --git a/ext/standard/tests/array/bug25708.phpt b/ext/standard/tests/array/bug25708.phpt
index ff8b9f4304..0e695b69c9 100644
--- a/ext/standard/tests/array/bug25708.phpt
+++ b/ext/standard/tests/array/bug25708.phpt
@@ -3,55 +3,55 @@ Bug #25708 (extract($GLOBALS, EXTR_REFS) mangles $GLOBALS)
--FILE--
<?php
function foo($ref, $alt) {
- unset($GLOBALS['a']);
- unset($GLOBALS['b']);
- $GLOBALS['a'] = 1;
- $GLOBALS['b'] = 2;
+ unset($GLOBALS['a']);
+ unset($GLOBALS['b']);
+ $GLOBALS['a'] = 1;
+ $GLOBALS['b'] = 2;
- $org_a = $GLOBALS['a'];
- $org_b = $GLOBALS['b'];
+ $org_a = $GLOBALS['a'];
+ $org_b = $GLOBALS['b'];
- if ($ref) {
- global $a, $b;
- } else {
- /* zval temp_var(NULL); // refcount = 1
- * a = temp_var[x] // refcount = 2
- */
- $a = NULL;
- $b = NULL;
- }
+ if ($ref) {
+ global $a, $b;
+ } else {
+ /* zval temp_var(NULL); // refcount = 1
+ * a = temp_var[x] // refcount = 2
+ */
+ $a = NULL;
+ $b = NULL;
+ }
- debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']);
- echo "--\n";
- if ($alt) {
- $a = &$GLOBALS['a'];
- $b = &$GLOBALS['b'];
- } else {
- extract($GLOBALS, EXTR_REFS);
- }
- debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']);
- echo "--\n";
- $a = &$GLOBALS['a'];
- $b = &$GLOBALS['b'];
- debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']);
- echo "--\n";
- $GLOBALS['b'] = 3;
- debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']);
- echo "--\n";
- $a = 4;
- debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']);
- echo "--\n";
- $c = $b;
- debug_zval_dump($b, $GLOBALS['b'], $c);
- echo "--\n";
- $b = 'x';
- debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b'], $c);
- echo "--\n";
- debug_zval_dump($org_a, $org_b);
- echo "----";
- if ($ref) echo 'r';
- if ($alt) echo 'a';
- echo "\n";
+ debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']);
+ echo "--\n";
+ if ($alt) {
+ $a = &$GLOBALS['a'];
+ $b = &$GLOBALS['b'];
+ } else {
+ extract($GLOBALS, EXTR_REFS);
+ }
+ debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']);
+ echo "--\n";
+ $a = &$GLOBALS['a'];
+ $b = &$GLOBALS['b'];
+ debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']);
+ echo "--\n";
+ $GLOBALS['b'] = 3;
+ debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']);
+ echo "--\n";
+ $a = 4;
+ debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b']);
+ echo "--\n";
+ $c = $b;
+ debug_zval_dump($b, $GLOBALS['b'], $c);
+ echo "--\n";
+ $b = 'x';
+ debug_zval_dump($a, $b, $GLOBALS['a'], $GLOBALS['b'], $c);
+ echo "--\n";
+ debug_zval_dump($org_a, $org_b);
+ echo "----";
+ if ($ref) echo 'r';
+ if ($alt) echo 'a';
+ echo "\n";
}
$a = 'ok';
diff --git a/ext/standard/tests/array/bug25758.phpt b/ext/standard/tests/array/bug25758.phpt
index ff97d2e3fb..a2d2952d85 100644
--- a/ext/standard/tests/array/bug25758.phpt
+++ b/ext/standard/tests/array/bug25758.phpt
@@ -2,8 +2,8 @@
Bug #25758 (var_export does not escape ' & \ inside array keys)
--FILE--
<?php
- $a = array ("quote'" => array("quote'"));
- echo var_export($a, true);
+ $a = array ("quote'" => array("quote'"));
+ echo var_export($a, true);
?>
--EXPECT--
array (
diff --git a/ext/standard/tests/array/bug29493.phpt b/ext/standard/tests/array/bug29493.phpt
index 0cfe45910b..30a7c058c2 100644
--- a/ext/standard/tests/array/bug29493.phpt
+++ b/ext/standard/tests/array/bug29493.phpt
@@ -4,68 +4,68 @@ Bug #29493 (extract(EXTR_REFS) fails if array has multiple referrals)
<?php
function t1()
{
- $a = array('foo' => 'aaa');
- // refcount($a) = 1
- // refcount($a['foo']) = 1
- $b = $a;
- // refcount($a) = 2
- // refcount($a['foo']) = 1
- $b['foo'] = 'bbb';
- // refcount($a) = 1
- // refcount($a['foo']) = 1
+ $a = array('foo' => 'aaa');
+ // refcount($a) = 1
+ // refcount($a['foo']) = 1
+ $b = $a;
+ // refcount($a) = 2
+ // refcount($a['foo']) = 1
+ $b['foo'] = 'bbb';
+ // refcount($a) = 1
+ // refcount($a['foo']) = 1
- var_dump($a, $b);
+ var_dump($a, $b);
- extract($a, EXTR_REFS);
+ extract($a, EXTR_REFS);
- $foo = 'noo';
+ $foo = 'noo';
- var_dump($a, $b);
+ var_dump($a, $b);
}
function t2()
{
- $a = array('foo' => 'aaa');
- // refcount($a) = 1
- // refcount($a['foo']) = 1
- $b = &$a;
- // refcount($a) = 2
- // is_ref($a) = true
- // refcount($a['foo']) = 1
- $b['foo'] = 'bbb';
- // refcount($a) = 2
- // refcount($a['foo']) = 1
+ $a = array('foo' => 'aaa');
+ // refcount($a) = 1
+ // refcount($a['foo']) = 1
+ $b = &$a;
+ // refcount($a) = 2
+ // is_ref($a) = true
+ // refcount($a['foo']) = 1
+ $b['foo'] = 'bbb';
+ // refcount($a) = 2
+ // refcount($a['foo']) = 1
- var_dump($a, $b);
+ var_dump($a, $b);
- extract($a, EXTR_REFS);
+ extract($a, EXTR_REFS);
- $foo = 'noo';
+ $foo = 'noo';
- var_dump($a, $b);
+ var_dump($a, $b);
}
function t3()
{
- $a = array('foo' => 'aaa');
- // refcount($a) = 1
- // refcount($a['foo']) = 1
- $b = &$a;
- // refcount($a) = 2
- // is_ref($a) = true
- // refcount($a['foo']) = 1
- unset($b);
- // refcount($a) = 1
- // is_ref($a) = true
- // refcount($a['foo']) = 1
+ $a = array('foo' => 'aaa');
+ // refcount($a) = 1
+ // refcount($a['foo']) = 1
+ $b = &$a;
+ // refcount($a) = 2
+ // is_ref($a) = true
+ // refcount($a['foo']) = 1
+ unset($b);
+ // refcount($a) = 1
+ // is_ref($a) = true
+ // refcount($a['foo']) = 1
- var_dump($a);
+ var_dump($a);
- extract($a, EXTR_REFS);
+ extract($a, EXTR_REFS);
- $foo = 'noo';
+ $foo = 'noo';
- var_dump($a);
+ var_dump($a);
}
t1();
diff --git a/ext/standard/tests/array/bug30074.phpt b/ext/standard/tests/array/bug30074.phpt
index 289e802c00..e0309bac1f 100644
--- a/ext/standard/tests/array/bug30074.phpt
+++ b/ext/standard/tests/array/bug30074.phpt
@@ -2,12 +2,12 @@
Bug #30074 (EG(uninitialized_zval_ptr) gets set to reference using EXTR_REFS, affecting later values)
--FILE--
<?php
-error_reporting(E_ALL & ~E_NOTICE); // We don't want the notice for $undefined
$result = extract(array('a'=>$undefined), EXTR_REFS);
var_dump(array($a));
echo "Done\n";
?>
---EXPECT--
+--EXPECTF--
+Warning: Undefined variable: undefined in %s on line %d
array(1) {
[0]=>
NULL
diff --git a/ext/standard/tests/array/bug30266.phpt b/ext/standard/tests/array/bug30266.phpt
index 8f7c3d2135..2579714ae7 100644
--- a/ext/standard/tests/array/bug30266.phpt
+++ b/ext/standard/tests/array/bug30266.phpt
@@ -4,13 +4,13 @@ Bug #30266 (Invalid opcode 137/1/8) and array_walk
<?php
class testc
{
- public $b = "c";
+ public $b = "c";
- function crash($val)
- {
- $this->b = $val;
- throw new Exception("Error");
- }
+ function crash($val)
+ {
+ $this->b = $val;
+ throw new Exception("Error");
+ }
}
$fruits = array ("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple");
@@ -19,19 +19,17 @@ $myobj = new testc();
function test($item2, $key, $userd)
{
- $userd->crash($item2);
+ $userd->crash($item2);
}
try
{
- array_walk($fruits, 'test', $myobj);
+ array_walk($fruits, 'test', $myobj);
}
catch(Exception $e)
{
- echo "Caught: " . $e->getMessage() . "\n";
+ echo "Caught: " . $e->getMessage() . "\n";
}
?>
-===DONE===
--EXPECT--
Caught: Error
-===DONE===
diff --git a/ext/standard/tests/array/bug31158.phpt b/ext/standard/tests/array/bug31158.phpt
index 62ba1cfaa3..d4f5210760 100644
--- a/ext/standard/tests/array/bug31158.phpt
+++ b/ext/standard/tests/array/bug31158.phpt
@@ -14,7 +14,7 @@ __();
echo "ok\n";
?>
--EXPECTF--
-Notice: Undefined variable: GLOBALS in %sbug31158.php on line 6
+Warning: Undefined variable: GLOBALS in %s on line %d
-Notice: Trying to access array offset on value of type null in %sbug31158.php on line 6
+Warning: Trying to access array offset on value of type null in %s on line %d
ok
diff --git a/ext/standard/tests/array/bug31213.phpt b/ext/standard/tests/array/bug31213.phpt
index 6aa31d5e0e..829c657d1e 100644
--- a/ext/standard/tests/array/bug31213.phpt
+++ b/ext/standard/tests/array/bug31213.phpt
@@ -3,27 +3,27 @@ Bug #31213 (Sideeffects caused by bug #29493)
--FILE--
<?php
function test($use_extract) {
- $a = 1;
- $b = 1;
+ $a = 1;
+ $b = 1;
- $arr = array(
- '_a' => $a,
- '_b' => &$b
- );
+ $arr = array(
+ '_a' => $a,
+ '_b' => &$b
+ );
- var_dump($a, $b);
+ var_dump($a, $b);
- if ($use_extract) {
- extract($arr, EXTR_REFS);
- } else {
- $_a = &$arr['_a'];
- $_b = &$arr['_b'];
- }
+ if ($use_extract) {
+ extract($arr, EXTR_REFS);
+ } else {
+ $_a = &$arr['_a'];
+ $_b = &$arr['_b'];
+ }
- $_a++;
- $_b++;
+ $_a++;
+ $_b++;
- var_dump($a, $b, $_a, $_b, $arr);
+ var_dump($a, $b, $_a, $_b, $arr);
}
test(false);
diff --git a/ext/standard/tests/array/bug34066.phpt b/ext/standard/tests/array/bug34066.phpt
index 44710b0426..df524feb9c 100644
--- a/ext/standard/tests/array/bug34066.phpt
+++ b/ext/standard/tests/array/bug34066.phpt
@@ -245,21 +245,21 @@ function gen_xml($val, $key, $prefix)
global $xml_fd;
print "gen_xml(prefix=$prefix)\n";
if (is_array($val)) {
- if (preg_match('/^\d+$/', $key)) {
- if ($key == 1) {
- print substr($prefix, 0, -1) . "\n";
- }
- array_walk($val, "gen_xml", "$prefix@");
- }
- else {
- array_walk($val, "gen_xml", "$prefix$key/");
- }
+ if (preg_match('/^\d+$/', $key)) {
+ if ($key == 1) {
+ print substr($prefix, 0, -1) . "\n";
+ }
+ array_walk($val, "gen_xml", "$prefix@");
}
else {
- if (strlen($val) > 0)
- print "$prefix$key=$val\n";
- else
- print "$prefix$key\n";
+ array_walk($val, "gen_xml", "$prefix$key/");
+ }
+ }
+ else {
+ if (strlen($val) > 0)
+ print "$prefix$key=$val\n";
+ else
+ print "$prefix$key\n";
}
print "gen_xml(prefix=$prefix) end\n";
}
diff --git a/ext/standard/tests/array/bug34066_1.phpt b/ext/standard/tests/array/bug34066_1.phpt
index 5200fa86a6..5ded4ea816 100644
--- a/ext/standard/tests/array/bug34066_1.phpt
+++ b/ext/standard/tests/array/bug34066_1.phpt
@@ -245,21 +245,21 @@ function gen_xml($val, $key, $prefix)
global $xml_fd;
print "gen_xml(prefix=$prefix)\n";
if (is_array($val)) {
- if (preg_match('/^\d+$/', $key)) {
- if ($key == 1) {
- print substr($prefix, 0, -1) . "\n";
- }
- array_walk_recursive($val, "gen_xml", "$prefix@");
- }
- else {
- array_walk_recursive($val, "gen_xml", "$prefix$key/");
- }
+ if (preg_match('/^\d+$/', $key)) {
+ if ($key == 1) {
+ print substr($prefix, 0, -1) . "\n";
+ }
+ array_walk_recursive($val, "gen_xml", "$prefix@");
}
else {
- if (strlen($val) > 0)
- print "$prefix$key=$val\n";
- else
- print "$prefix$key\n";
+ array_walk_recursive($val, "gen_xml", "$prefix$key/");
+ }
+ }
+ else {
+ if (strlen($val) > 0)
+ print "$prefix$key=$val\n";
+ else
+ print "$prefix$key\n";
}
print "gen_xml(prefix=$prefix) end\n";
}
diff --git a/ext/standard/tests/array/bug35014.phpt b/ext/standard/tests/array/bug35014.phpt
index f858bf107b..8980f00d80 100644
--- a/ext/standard/tests/array/bug35014.phpt
+++ b/ext/standard/tests/array/bug35014.phpt
@@ -7,24 +7,21 @@ precision=14
--FILE--
<?php
$tests = array(
- 'foo',
- array(),
- array(0),
- array(3),
- array(3, 3),
- array(0.5, 2),
- array(99999999, 99999999),
- array(8.993, 7443241,988, sprintf("%u", -1)+0.44),
- array(2,sprintf("%u", -1)),
+ array(),
+ array(0),
+ array(3),
+ array(3, 3),
+ array(0.5, 2),
+ array(99999999, 99999999),
+ array(8.993, 7443241,988, sprintf("%u", -1)+0.44),
+ array(2,sprintf("%u", -1)),
);
foreach ($tests as $v) {
- var_dump(array_product($v));
+ var_dump(array_product($v));
}
?>
---EXPECTF--
-Warning: array_product() expects parameter 1 to be array, string given in %s on line %d
-NULL
+--EXPECT--
int(1)
int(0)
int(3)
diff --git a/ext/standard/tests/array/bug35014_64bit.phpt b/ext/standard/tests/array/bug35014_64bit.phpt
index 5caf48c6ee..91face05af 100644
--- a/ext/standard/tests/array/bug35014_64bit.phpt
+++ b/ext/standard/tests/array/bug35014_64bit.phpt
@@ -7,24 +7,21 @@ precision=14
--FILE--
<?php
$tests = array(
- 'foo',
- array(),
- array(0),
- array(3),
- array(3, 3),
- array(0.5, 2),
- array(99999999, 99999999),
- array(8.993, 7443241,988, sprintf("%u", -1)+0.44),
- array(2,sprintf("%u", -1)),
+ array(),
+ array(0),
+ array(3),
+ array(3, 3),
+ array(0.5, 2),
+ array(99999999, 99999999),
+ array(8.993, 7443241,988, sprintf("%u", -1)+0.44),
+ array(2,sprintf("%u", -1)),
);
foreach ($tests as $v) {
- var_dump(array_product($v));
+ var_dump(array_product($v));
}
?>
---EXPECTF--
-Warning: array_product() expects parameter 1 to be array, string given in %s on line %d
-NULL
+--EXPECT--
int(1)
int(0)
int(3)
diff --git a/ext/standard/tests/array/bug35022.phpt b/ext/standard/tests/array/bug35022.phpt
index 07138f138d..8c67c5201a 100644
--- a/ext/standard/tests/array/bug35022.phpt
+++ b/ext/standard/tests/array/bug35022.phpt
@@ -6,7 +6,7 @@ $state = array("one" => 1, "two" => 2, "three" => 3);
function foo( &$state ) {
$contentDict = end( $state );
for ( $contentDict = end( $state ); $contentDict !== false; $contentDict = prev( $state ) ) {
- echo key($state) . " => " . current($state) . "\n";
+ echo key($state) . " => " . current($state) . "\n";
}
}
foo($state);
diff --git a/ext/standard/tests/array/bug35821.phpt b/ext/standard/tests/array/bug35821.phpt
index 3b1ecb6278..e01ec6e392 100644
--- a/ext/standard/tests/array/bug35821.phpt
+++ b/ext/standard/tests/array/bug35821.phpt
@@ -5,15 +5,15 @@ Bug #35821 (array_map() segfaults when exception is throwed from the callback)
class Element
{
- public function ThrowException ()
- {
- throw new Exception();
- }
+ public function ThrowException ()
+ {
+ throw new Exception();
+ }
- public static function CallBack(Element $elem)
- {
- $elem->ThrowException();
- }
+ public static function CallBack(Element $elem)
+ {
+ $elem->ThrowException();
+ }
}
$arr = array(new Element(), new Element(), new Element());
diff --git a/ext/standard/tests/array/bug39576.phpt b/ext/standard/tests/array/bug39576.phpt
index bb58e79183..3ac9756941 100644
--- a/ext/standard/tests/array/bug39576.phpt
+++ b/ext/standard/tests/array/bug39576.phpt
@@ -5,9 +5,9 @@ Bug #39576 (array_walk() doesn't separate userdata zval)
class Test {
- public $_table = '';
- public $_columns = array ();
- public $_primary = array ();
+ public $_table = '';
+ public $_columns = array ();
+ public $_primary = array ();
}
@@ -18,16 +18,16 @@ $test->_columns['name'] = new stdClass;
function test ($value, $column, &$columns) {}
array_walk (
- get_object_vars ($test),
- 'test',
- $test->_columns
+ get_object_vars ($test),
+ 'test',
+ $test->_columns
);
var_dump($test);
array_intersect_key (
- get_object_vars ($test),
- $test->_primary
+ get_object_vars ($test),
+ $test->_primary
);
echo "Done\n";
diff --git a/ext/standard/tests/array/bug40191.phpt b/ext/standard/tests/array/bug40191.phpt
index f5e439821d..b94e709364 100644
--- a/ext/standard/tests/array/bug40191.phpt
+++ b/ext/standard/tests/array/bug40191.phpt
@@ -8,12 +8,14 @@ $arrObj->append('foo');
$arrObj->append('bar');
$arrObj->append('foo');
-$arr = array_unique($arrObj);
-var_dump($arr);
+try {
+ $arr = array_unique($arrObj);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done\n";
?>
---EXPECTF--
-Warning: array_unique() expects parameter 1 to be array, object given in %s on line %d
-NULL
+--EXPECT--
+array_unique() expects parameter 1 to be array, object given
Done
diff --git a/ext/standard/tests/array/bug41686.phpt b/ext/standard/tests/array/bug41686.phpt
index d293fdf175..b94acb608d 100644
--- a/ext/standard/tests/array/bug41686.phpt
+++ b/ext/standard/tests/array/bug41686.phpt
@@ -6,12 +6,12 @@ $a = array(1,2,3);
$b = array('a'=>1,'b'=>1,'c'=>2);
var_dump(
- array_slice($a, 1),
- array_slice($a, 1, 2, TRUE),
- array_slice($a, 1, NULL, TRUE),
- array_slice($b, 1),
- array_slice($b, 1, 2, TRUE),
- array_slice($b, 1, NULL, TRUE)
+ array_slice($a, 1),
+ array_slice($a, 1, 2, TRUE),
+ array_slice($a, 1, NULL, TRUE),
+ array_slice($b, 1),
+ array_slice($b, 1, 2, TRUE),
+ array_slice($b, 1, NULL, TRUE)
);
echo "Done\n";
diff --git a/ext/standard/tests/array/bug42177.phpt b/ext/standard/tests/array/bug42177.phpt
index 5678ca3cac..dc5297b302 100644
--- a/ext/standard/tests/array/bug42177.phpt
+++ b/ext/standard/tests/array/bug42177.phpt
@@ -18,7 +18,11 @@ unset( $a1, $a2 );
$a1 = array();
$a2 = array( 'key1' => &$a1 );
$a1 = array_merge_recursive( $a1, $a2 );
-$a1 = array_merge_recursive( $a1, $a2 );
+try {
+ $a1 = array_merge_recursive( $a1, $a2 );
+} catch (\Error $e) {
+ echo $e->getMessage() . " on line " . $e->getLine() . "\n";
+}
unset( $a1, $a2 );
$x = 'foo';
@@ -30,5 +34,5 @@ $a1 = array_merge_recursive( $a1, $a2 );
unset( $a1, $a2 );
?>
---EXPECTF--
-Warning: array_merge_recursive(): recursion detected in %s on line 18
+--EXPECT--
+Recursion detected on line 19
diff --git a/ext/standard/tests/array/bug42233.phpt b/ext/standard/tests/array/bug42233.phpt
index 0cebc428f7..c02a620ae6 100644
--- a/ext/standard/tests/array/bug42233.phpt
+++ b/ext/standard/tests/array/bug42233.phpt
@@ -4,9 +4,9 @@ Bug #42233 (extract(): scandic characters not allowed as variable name)
<?php
$test = array(
- 'a' => '1',
- 'æ' => '2',
- 'æøåäö' => '3',
+ 'a' => '1',
+ 'æ' => '2',
+ 'æøåäö' => '3',
);
var_dump($test);
diff --git a/ext/standard/tests/array/bug42838.phpt b/ext/standard/tests/array/bug42838.phpt
index 5a09ae9c8e..fbd8234987 100644
--- a/ext/standard/tests/array/bug42838.phpt
+++ b/ext/standard/tests/array/bug42838.phpt
@@ -5,10 +5,10 @@ Bug #42838 (Wrong results in array_diff_uassoc())
function key_compare_func($a, $b)
{
- if ($a === $b) {
- return 0;
- }
- return ($a > $b)? 1:-1;
+ if ($a === $b) {
+ return 0;
+ }
+ return ($a > $b)? 1:-1;
}
$array1 = array("a" => "green", "b" => "Brown", 'c' => 'blue', 0 => 'red');
diff --git a/ext/standard/tests/array/bug43495.phpt b/ext/standard/tests/array/bug43495.phpt
index 522ff1903b..37c4f6b604 100644
--- a/ext/standard/tests/array/bug43495.phpt
+++ b/ext/standard/tests/array/bug43495.phpt
@@ -8,14 +8,17 @@ $a["key1"]["key2"]["key3"]=&$a;
$b=array("key1"=>array("key2"=>array()));
$b["key1"]["key2"]["key3"]=&$b;
-array_merge_recursive($a,$b);
+
+try {
+ array_merge_recursive($a,$b);
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
/* Break recursion */
$a["key1"]["key2"]["key3"] = null;
$b["key1"]["key2"]["key3"] = null;
-echo "Done.\n";
?>
---EXPECTF--
-Warning: array_merge_recursive(): recursion detected in %sbug43495.php on line %d
-Done.
+--EXPECT--
+Recursion detected
diff --git a/ext/standard/tests/array/bug45312.phpt b/ext/standard/tests/array/bug45312.phpt
index 858bdfa4bf..a315814108 100644
--- a/ext/standard/tests/array/bug45312.phpt
+++ b/ext/standard/tests/array/bug45312.phpt
@@ -12,7 +12,7 @@ class cr {
return ($a->priv_member > $b->priv_member) ? 1 : -1;
}
static function comp_func_cr2($a, $b) {
- echo ".";
+ echo ".";
if ($a->priv_member === $b->priv_member) return 0;
return ($a->priv_member < $b->priv_member) ? 1 : -1;
}
@@ -24,11 +24,11 @@ $a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1 => new cr
$b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr(3), 1 => new cr(4), 2 => new cr(-15),);
$result = array_udiff_assoc($a, $b, array("cr", "comp_func_cr"));
foreach($result as $val) {
- $val->dump();
+ $val->dump();
}
$result = array_udiff_assoc($a, $b, array("cr", "comp_func_cr2"));
foreach($result as $val) {
- $val->dump();
+ $val->dump();
}
?>
--EXPECT--
diff --git a/ext/standard/tests/array/bug61058.phpt b/ext/standard/tests/array/bug61058.phpt
index f5e06a4a02..6e78b35711 100644
--- a/ext/standard/tests/array/bug61058.phpt
+++ b/ext/standard/tests/array/bug61058.phpt
@@ -2,7 +2,12 @@
Bug #61058 (array_fill leaks if start index is PHP_INT_MAX)
--FILE--
<?php
-array_fill(PHP_INT_MAX, 2, '*');
+
+try {
+ array_fill(PHP_INT_MAX, 2, '*');
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
?>
---EXPECTF--
-Warning: array_fill(): Cannot add element to the array as the next element is already occupied in %sbug61058.php on line %d
+--EXPECT--
+Cannot add element to the array as the next element is already occupied
diff --git a/ext/standard/tests/array/bug65251.phpt b/ext/standard/tests/array/bug65251.phpt
index 014517794c..3e0f3a1e27 100644
--- a/ext/standard/tests/array/bug65251.phpt
+++ b/ext/standard/tests/array/bug65251.phpt
@@ -3,8 +3,12 @@ Bug #65251: array_merge_recursive() recursion detection broken
--FILE--
<?php
-array_merge_recursive($GLOBALS, $GLOBALS)
+try {
+ array_merge_recursive($GLOBALS, $GLOBALS);
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
?>
---EXPECTF--
-Warning: array_merge_recursive(): recursion detected in %s on line %d
+--EXPECT--
+Recursion detected
diff --git a/ext/standard/tests/array/bug67693.phpt b/ext/standard/tests/array/bug67693.phpt
index 516436c511..c9aa2d86fa 100644
--- a/ext/standard/tests/array/bug67693.phpt
+++ b/ext/standard/tests/array/bug67693.phpt
@@ -16,9 +16,9 @@ echo"\nDone";
?>
--EXPECT--
array(2) {
- [0]=>
+ [-1]=>
int(0)
- [1]=>
+ [0]=>
int(0)
}
diff --git a/ext/standard/tests/array/bug68553.phpt b/ext/standard/tests/array/bug68553.phpt
index fbee975d17..966c98b544 100644
--- a/ext/standard/tests/array/bug68553.phpt
+++ b/ext/standard/tests/array/bug68553.phpt
@@ -5,19 +5,19 @@ Bug #68553 (array_column: null values in $index_key become incrementing keys in
$i = 100;
/* increase the resource id to make test stable */
while ($i--) {
- $fd = fopen(__FILE__, "r");
- fclose($fd);
+ $fd = fopen(__FILE__, "r");
+ fclose($fd);
}
$a = [
- ['a' => 10],
- ['a' => 20],
- ['a' => true],
- ['a' => false],
- ['a' => fopen(__FILE__, "r")],
- ['a' => -5],
- ['a' => 7.38],
- ['a' => null, "test"],
- ['a' => null],
+ ['a' => 10],
+ ['a' => 20],
+ ['a' => true],
+ ['a' => false],
+ ['a' => fopen(__FILE__, "r")],
+ ['a' => -5],
+ ['a' => 7.38],
+ ['a' => null, "test"],
+ ['a' => null],
];
var_dump(array_column($a, null, 'a'));
diff --git a/ext/standard/tests/array/bug69198.phpt b/ext/standard/tests/array/bug69198.phpt
index 96a0f9a963..3441bee5d7 100644
--- a/ext/standard/tests/array/bug69198.phpt
+++ b/ext/standard/tests/array/bug69198.phpt
@@ -3,7 +3,7 @@ Bug #69198 (Compact function generate array with length but no content)
--FILE--
<?php
if (false) {
- $willNeverBeDefined = true;
+ $willNeverBeDefined = true;
}
$result = compact('willNeverBeDefined');
var_dump($result, empty($result), $result === array(), empty($willNeverBeDefined));
diff --git a/ext/standard/tests/array/bug69299.phpt b/ext/standard/tests/array/bug69299.phpt
index 088b10fd13..77c76166af 100644
--- a/ext/standard/tests/array/bug69299.phpt
+++ b/ext/standard/tests/array/bug69299.phpt
@@ -4,12 +4,12 @@ Bug #69299 (Regression in array_filter's $flag argument in PHP 7)
<?php
$toFilter = array('foo' => 'bar', 'fiz' => 'buz');
$filtered = array_filter($toFilter, function ($value, $key) {
- if ($value === 'buz'
- || $key === 'foo'
- ) {
- return false;
- }
- return true;
+ if ($value === 'buz'
+ || $key === 'foo'
+ ) {
+ return false;
+ }
+ return true;
}, ARRAY_FILTER_USE_BOTH);
var_dump($filtered);
?>
diff --git a/ext/standard/tests/array/bug69723.phpt b/ext/standard/tests/array/bug69723.phpt
index 23b3576a51..88183c5aae 100644
--- a/ext/standard/tests/array/bug69723.phpt
+++ b/ext/standard/tests/array/bug69723.phpt
@@ -3,23 +3,23 @@ Bug #69723 (Passing parameters by reference and array_column)
--FILE--
<?php
function byReference( & $array){
- foreach($array as &$item){
- $item['nanana'] = 'batman';
- $item['superhero'] = 'robin';
- }
+ foreach($array as &$item){
+ $item['nanana'] = 'batman';
+ $item['superhero'] = 'robin';
+ }
}
$array = [
- [
- 'superhero'=> 'superman',
- 'nanana' => 'no nana'
- ],
- [
- 'superhero'=> 'acuaman',
- 'nanana' => 'no nana'
- ],
+ [
+ 'superhero'=> 'superman',
+ 'nanana' => 'no nana'
+ ],
+ [
+ 'superhero'=> 'acuaman',
+ 'nanana' => 'no nana'
+ ],
- ];
+ ];
var_dump(array_column($array, 'superhero'));
byReference($array);
diff --git a/ext/standard/tests/array/bug70713.phpt b/ext/standard/tests/array/bug70713.phpt
index 7cd0a0f113..fab1661e84 100644
--- a/ext/standard/tests/array/bug70713.phpt
+++ b/ext/standard/tests/array/bug70713.phpt
@@ -5,22 +5,27 @@ Bug #70713: Use After Free Vulnerability in array_walk()/array_walk_recursive()
class obj
{
- function __tostring()
- {
- global $arr;
+ function __tostring()
+ {
+ global $arr;
- $arr = 1;
- for ($i = 0; $i < 5; $i++) {
- $v[$i] = 'hi'.$i;
- }
+ $arr = 1;
+ for ($i = 0; $i < 5; $i++) {
+ $v[$i] = 'hi'.$i;
+ }
- return 'hi';
- }
+ return 'hi';
+ }
}
$arr = array('string' => new obj);
-array_walk_recursive($arr, 'settype');
+
+try {
+ array_walk_recursive($arr, 'settype');
+} catch (\TypeError $e) {
+ echo $e->getMessage() . "\n";
+}
?>
---EXPECTF--
-Warning: array_walk_recursive(): Iterated value is no longer an array or object in %s on line %d
+--EXPECT--
+Iterated value is no longer an array or object
diff --git a/ext/standard/tests/array/bug71220.phpt b/ext/standard/tests/array/bug71220.phpt
index 49e5bb7719..6a933f5f52 100644
--- a/ext/standard/tests/array/bug71220.phpt
+++ b/ext/standard/tests/array/bug71220.phpt
@@ -3,8 +3,12 @@ Bug #71220 (Null pointer deref (segfault) in compact via ob_start)
--FILE--
<?php
ob_start("compact");
-ob_end_clean();
+try {
+ ob_end_clean();
+} catch (\Error $e) {
+ echo $e->getMessage();
+}
?>
-okey
+
--EXPECT--
-okey
+Cannot call compact() dynamically
diff --git a/ext/standard/tests/array/bug71334.phpt b/ext/standard/tests/array/bug71334.phpt
index 7a37d0953a..ba14f08c18 100644
--- a/ext/standard/tests/array/bug71334.phpt
+++ b/ext/standard/tests/array/bug71334.phpt
@@ -5,29 +5,29 @@ Bug #71334: Cannot access array keys while uksort()
class myClass
{
- private $a = [
- 'foo-test' => [1],
- '-' => [2],
- 'bar-test' => [3]
- ];
+ private $a = [
+ 'foo-test' => [1],
+ '-' => [2],
+ 'bar-test' => [3]
+ ];
- private function _mySort($x, $y)
- {
- if (!isset($this->a[$x])) {
- throw new Exception('Missing X: "' . $x . '"');
- }
+ private function _mySort($x, $y)
+ {
+ if (!isset($this->a[$x])) {
+ throw new Exception('Missing X: "' . $x . '"');
+ }
- if (!isset($this->a[$y])) {
- throw new Exception('Missing Y: "' . $y . '"');
- }
+ if (!isset($this->a[$y])) {
+ throw new Exception('Missing Y: "' . $y . '"');
+ }
- return $x < $y;
- }
+ return $x < $y;
+ }
- public function __construct()
- {
- uksort($this->a, [$this, '_mySort']);
- }
+ public function __construct()
+ {
+ uksort($this->a, [$this, '_mySort']);
+ }
}
new myClass();
diff --git a/ext/standard/tests/array/bug71660.phpt b/ext/standard/tests/array/bug71660.phpt
index c2d7192378..067f533381 100644
--- a/ext/standard/tests/array/bug71660.phpt
+++ b/ext/standard/tests/array/bug71660.phpt
@@ -4,7 +4,7 @@ Bug #71660 (array_column behaves incorrectly after foreach by reference)
<?php
$arr = array('id' => 12345, 'name' => 'sam');
foreach ($arr as &$v) {
- $v = $v;
+ $v = $v;
}
$arr = [$arr];
diff --git a/ext/standard/tests/array/bug72622.phpt b/ext/standard/tests/array/bug72622.phpt
index 66e22f3bf9..cf1a3ece8a 100644
--- a/ext/standard/tests/array/bug72622.phpt
+++ b/ext/standard/tests/array/bug72622.phpt
@@ -4,11 +4,11 @@ Bug #72622 (array_walk + array_replace_recursive create references from nothing)
<?php
function walk (array $arr) {
- array_walk($arr, function (&$val, $name) {
+ array_walk($arr, function (&$val, $name) {
- });
+ });
- return $arr;
+ return $arr;
}
$arr3 = ['foo' => 'foo'];
diff --git a/ext/standard/tests/array/bug76713.phpt b/ext/standard/tests/array/bug76713.phpt
index 0c993f5721..8bb8bf221f 100644
--- a/ext/standard/tests/array/bug76713.phpt
+++ b/ext/standard/tests/array/bug76713.phpt
@@ -4,7 +4,7 @@ Bug #76713 (Segmentation fault caused by property corruption)
<?php
function test($obj) {
- return array_column(array($obj), "prop");
+ return array_column(array($obj), "prop");
}
$obj = new Stdclass();
@@ -18,10 +18,10 @@ test($obj);
var_dump($obj->prop);
class C {
- public $name;
- public function __get($name) {
- return $this->name;
- }
+ public $name;
+ public function __get($name) {
+ return $this->name;
+ }
}
$obj = new C;
diff --git a/ext/standard/tests/array/bug77395.phpt b/ext/standard/tests/array/bug77395.phpt
index 7910e36982..a4a79f5e2f 100644
--- a/ext/standard/tests/array/bug77395.phpt
+++ b/ext/standard/tests/array/bug77395.phpt
@@ -3,14 +3,19 @@ Bug #77395 (segfault about array_multisort)
--FILE--
<?php
function error_handle($level, $message, $file = '', $line = 0){
- $a = [1,2,3];
- $b = [3,2,1];
- echo $message;
- array_multisort($a, SORT_ASC, $b); // if comment this line, no segfault happen
+ $a = [1,2,3];
+ $b = [3,2,1];
+ echo $message;
+ array_multisort($a, SORT_ASC, $b); // if comment this line, no segfault happen
}
set_error_handler('error_handle');
$data = [['aa'=> 'bb',], ['aa'=> 'bb',],];
-array_multisort(array_column($data, 'bb'),SORT_DESC, $data); // PHP Warning error
+
+try {
+ array_multisort(array_column($data, 'bb'),SORT_DESC, $data); // PHP Warning error
+} catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+}
?>
--EXPECT--
-array_multisort(): Array sizes are inconsistent
+Array sizes are inconsistent
diff --git a/ext/standard/tests/array/bug77931.phpt b/ext/standard/tests/array/bug77931.phpt
index 98a2eb91cf..45a241f27f 100644
--- a/ext/standard/tests/array/bug77931.phpt
+++ b/ext/standard/tests/array/bug77931.phpt
@@ -3,14 +3,24 @@ Bug #77931: Warning for array_map mentions wrong type
--FILE--
<?php
-array_map('trim', array(), 1);
-array_map('trim', array(), array(), true);
-array_map('trim', array(), array(), array(), null);
+try {
+ array_map('trim', array(), 1);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ array_map('trim', array(), array(), true);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ array_map('trim', array(), array(), array(), null);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Warning: array_map(): Expected parameter 3 to be an array, int given in %s on line %d
-
-Warning: array_map(): Expected parameter 4 to be an array, bool given in %s on line %d
-
-Warning: array_map(): Expected parameter 5 to be an array, null given in %s on line %d
+--EXPECT--
+Expected parameter 3 to be an array, int given
+Expected parameter 4 to be an array, bool given
+Expected parameter 5 to be an array, null given
diff --git a/ext/standard/tests/array/compact_variation1.phpt b/ext/standard/tests/array/compact_variation1.phpt
index d2b9fc45df..ede36efd7e 100644
--- a/ext/standard/tests/array/compact_variation1.phpt
+++ b/ext/standard/tests/array/compact_variation1.phpt
@@ -10,7 +10,7 @@ Test compact() function : usage variations - arrays containing references.
/*
* compact variations - arrays with references
*/
-echo "*** Testing compact() : usage variations - arrays containg references ***\n";
+echo "*** Testing compact() : usage variations - arrays containing references ***\n";
$a = 1;
$b = 2;
$c = 3;
@@ -20,31 +20,27 @@ $arr2 = array("a", array(array(array("b"))));
$arr2[1][0][0][] = &$arr2;
$arr2[1][0][0][] = &$arr2[1];
$arr3 = array(&$string);
-var_dump(compact($arr1));
-var_dump(compact($arr2));
-var_dump(compact($arr3));
-echo "Done";
-?>
---EXPECTF--
-*** Testing compact() : usage variations - arrays containg references ***
-Warning: compact(): recursion detected in %s on line %d
-array(1) {
- ["a"]=>
- int(1)
+try {
+ var_dump(compact($arr1));
+} catch (Error $e) {
+ echo $e->getMessage() . "\n";
}
-Warning: compact(): recursion detected in %s on line %d
-
-Warning: compact(): recursion detected in %s on line %d
-array(2) {
- ["a"]=>
- int(1)
- ["b"]=>
- int(2)
+try {
+ var_dump(compact($arr2));
+} catch (Error $e) {
+ echo $e->getMessage() . "\n";
}
+
+var_dump(compact($arr3));
+
+?>
+--EXPECT--
+*** Testing compact() : usage variations - arrays containing references ***
+Recursion detected
+Recursion detected
array(1) {
["c"]=>
int(3)
}
-Done
diff --git a/ext/standard/tests/array/compact_variation2.phpt b/ext/standard/tests/array/compact_variation2.phpt
index 8ca5020d6d..fb186ae002 100644
--- a/ext/standard/tests/array/compact_variation2.phpt
+++ b/ext/standard/tests/array/compact_variation2.phpt
@@ -13,16 +13,15 @@ $a = 'main.a';
$b = 'main.b';
function f() {
- $b = 'f.b';
- $c = 'f.c';
- var_dump(compact('a','b','c'));
- var_dump(compact(array('a','b','c')));
+ $b = 'f.b';
+ $c = 'f.c';
+ var_dump(compact('a','b','c'));
+ var_dump(compact(array('a','b','c')));
}
f();
?>
-==Done==
--EXPECTF--
*** Testing compact() : usage variations - variables outside of current scope ***
@@ -41,4 +40,3 @@ array(2) {
["c"]=>
string(3) "f.c"
}
-==Done==
diff --git a/ext/standard/tests/array/count_invalid_mode.phpt b/ext/standard/tests/array/count_invalid_mode.phpt
new file mode 100644
index 0000000000..6e302fd0ce
--- /dev/null
+++ b/ext/standard/tests/array/count_invalid_mode.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test count() function : invalid modes in weak type mode
+--FILE--
+<?php
+
+$modes = [
+ COUNT_NORMAL,
+ COUNT_RECURSIVE,
+ 0,
+ 1,
+ -1,
+ -1.45,
+ 2,
+ TRUE,
+ FALSE,
+ NULL,
+];
+
+foreach ($modes as $mode) {
+ try {
+ var_dump(count([], $mode));
+ } catch (\ValueError $error) {
+ echo $error->getMessage() . \PHP_EOL;
+ }
+}
+?>
+--EXPECT--
+int(0)
+int(0)
+int(0)
+int(0)
+Mode value is invalid
+Mode value is invalid
+Mode value is invalid
+int(0)
+int(0)
+int(0)
diff --git a/ext/standard/tests/array/count_recursive.phpt b/ext/standard/tests/array/count_recursive.phpt
index 175cfe7118..a7d4afb53b 100644
--- a/ext/standard/tests/array/count_recursive.phpt
+++ b/ext/standard/tests/array/count_recursive.phpt
@@ -3,7 +3,7 @@ Test count() function
--FILE--
<?php
/* Prototype: int count ( mixed $var [, int $mode] );
- Discription: Count elements in an array, or properties in an object
+ Description: Count elements in an array, or properties in an object
*/
echo "*** Testing basic functionality of count() function ***\n";
@@ -31,7 +31,7 @@ print "COUNT_NORMAL: should be 1, is ".count("string")."\n";
print "COUNT_NORMAL: should be 2, is ".count(array("a", array("b")))."\n";
$arr = array('a'=>array(NULL, NULL, NULL), 1=>array(NULL=>1, 1=>NULL),
- array(array(array(array(array(NULL))))));
+ array(array(array(array(array(NULL))))));
print "-- Testing really cool arrays --\n";
print "COUNT_NORMAL: should be 3, is ".count($arr, COUNT_NORMAL)."\n";
print "COUNT_RECURSIVE: should be 13, is ".count($arr, COUNT_RECURSIVE)."\n";
@@ -47,7 +47,7 @@ $count_array = array(
array( 4 => 1, 3 => -2.344, "3" => "string", "2" => NULL,
1 => -2.344, array()),
array( TRUE => TRUE, FALSE => FALSE, "" => "", " " => " ",
- NULL => NULL, "\x000" => "\x000", "\000" => "\000"),
+ NULL => NULL, "\x000" => "\x000", "\000" => "\000"),
array( NULL, 1.23 => "Hi", "string" => "hello",
array("" => "World", "-2.34" => "a", "0" => "b"))
);
@@ -104,24 +104,10 @@ echo "\n-- Testing count() on arrays containing references --\n";
$arr = array(1, array("a", "b", "c"));
$arr[2] = &$arr[1];
-$mode_arr = array( COUNT_NORMAL, COUNT_RECURSIVE, 0, 1, -1, -1.45, 2, TRUE,
- FALSE, NULL);
-for( $i =0; $i < count( $mode_arr ); $i++) {
- echo "For mode '$mode_arr[$i]' count is => ";
- var_dump(count($arr, $mode_arr[$i]));
-}
-
-
-echo "\n-- Testing error conditions --";
-var_dump( count() ); // No. of args = 0
-var_dump( count(array(), COUNT_NORMAL, 100) ); // No. of args > expected
-
-/* Testing Invalid type arguments */
-var_dump( count("string", ABCD) );
-var_dump( count(100, "string") );
-var_dump( count(array(), "") );
-
-echo "\nDone";
+echo "Count normal" . \PHP_EOL;
+var_dump(count($arr, COUNT_NORMAL));
+echo "Count recursive" . \PHP_EOL;
+var_dump(count($arr, COUNT_RECURSIVE));
/* closing the resource handles */
fclose( $resource1 );
@@ -219,33 +205,7 @@ COUNT_NORMAL: should be 3, is 3
int(2)
-- Testing count() on arrays containing references --
-For mode '0' count is => int(3)
-For mode '1' count is => int(9)
-For mode '0' count is => int(3)
-For mode '1' count is => int(9)
-For mode '-1' count is => int(3)
-For mode '-1.45' count is => int(3)
-For mode '2' count is => int(3)
-For mode '1' count is => int(9)
-For mode '' count is => int(3)
-For mode '' count is => int(3)
-
--- Testing error conditions --
-Warning: count() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: count() expects at most 2 parameters, 3 given in %s on line %d
-NULL
-
-Warning: Use of undefined constant ABCD - assumed 'ABCD' (this will throw an Error in a future version of PHP) in %s on line %d
-
-Warning: count() expects parameter 2 to be int, %s given in %s on line %d
-NULL
-
-Warning: count() expects parameter 2 to be int, %s given in %s on line %d
-NULL
-
-Warning: count() expects parameter 2 to be int, %s given in %s on line %d
-NULL
-
-Done
+Count normal
+int(3)
+Count recursive
+int(9)
diff --git a/ext/standard/tests/array/count_variation3.phpt b/ext/standard/tests/array/count_variation3.phpt
index 30cae18964..3455585eab 100644
--- a/ext/standard/tests/array/count_variation3.phpt
+++ b/ext/standard/tests/array/count_variation3.phpt
@@ -34,6 +34,6 @@ int(4)
-- $mode = 1: --
-Warning: count(): recursion detected in %s on line %d
+Warning: count(): Recursion detected in %s on line %d
int(4)
Done
diff --git a/ext/standard/tests/array/current_basic.phpt b/ext/standard/tests/array/current_basic.phpt
index 287a479067..fc28b7c342 100644
--- a/ext/standard/tests/array/current_basic.phpt
+++ b/ext/standard/tests/array/current_basic.phpt
@@ -22,11 +22,9 @@ var_dump(current($array));
next($array);
var_dump(current($array));
?>
-===DONE===
--EXPECT--
*** Testing current() : basic functionality ***
string(4) "zero"
string(3) "one"
int(3)
bool(false)
-===DONE===
diff --git a/ext/standard/tests/array/current_variation2.phpt b/ext/standard/tests/array/current_variation2.phpt
index d839370962..8a6b56d99a 100644
--- a/ext/standard/tests/array/current_variation2.phpt
+++ b/ext/standard/tests/array/current_variation2.phpt
@@ -39,7 +39,7 @@ $inputs = array(
// int data
/*1*/ 'int' => array(
- 0,
+ 0,
1,
12345,
-2345,
@@ -115,7 +115,6 @@ foreach($inputs as $key => $input) {
fclose($fp);
?>
-===DONE===
--EXPECTF--
*** Testing current() : usage variations ***
@@ -152,4 +151,3 @@ NULL
-- Iteration 11 : resource data --
resource(%d) of type (stream)
-===DONE===
diff --git a/ext/standard/tests/array/current_variation3.phpt b/ext/standard/tests/array/current_variation3.phpt
index decb043116..b0684cd7b7 100644
--- a/ext/standard/tests/array/current_variation3.phpt
+++ b/ext/standard/tests/array/current_variation3.phpt
@@ -29,7 +29,6 @@ var_dump(current($array1));
echo "\$array2: ";
var_dump(current($array2));
?>
-===DONE===
--EXPECT--
*** Testing current() : usage variations ***
@@ -39,4 +38,3 @@ string(4) "zero"
-- Position after calling next() --
$array1: string(3) "one"
$array2: string(3) "one"
-===DONE===
diff --git a/ext/standard/tests/array/current_variation4.phpt b/ext/standard/tests/array/current_variation4.phpt
index 5862a86129..a8471e9d7f 100644
--- a/ext/standard/tests/array/current_variation4.phpt
+++ b/ext/standard/tests/array/current_variation4.phpt
@@ -45,7 +45,6 @@ var_dump(current($multi_array[3][3][3]));
// see if internal pointer is in the same position from when accessing this inner array
var_dump(current($multi_array[3][3][3][1]));
?>
-===DONE===
--EXPECT--
*** Testing current() : usage variations ***
@@ -68,4 +67,3 @@ Initial Position: int(1)
Current Position: string(3) "two"
string(3) "two"
int(1)
-===DONE===
diff --git a/ext/standard/tests/array/current_variation5.phpt b/ext/standard/tests/array/current_variation5.phpt
index d49353c24f..7458de07f7 100644
--- a/ext/standard/tests/array/current_variation5.phpt
+++ b/ext/standard/tests/array/current_variation5.phpt
@@ -39,8 +39,6 @@ var_dump(next($a));
current_variation5($a);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
*** Testing current() : usage variations ***
@@ -55,4 +53,3 @@ string(3) "yes"
string(5) "maybe"
string(5) "maybe"
string(2) "no"
-===DONE===
diff --git a/ext/standard/tests/array/data.inc b/ext/standard/tests/array/data.inc
index bbc8d43c23..c8ad4fe295 100644
--- a/ext/standard/tests/array/data.inc
+++ b/ext/standard/tests/array/data.inc
@@ -1,13 +1,13 @@
<?php
$tmp = pow(2,24);
$data = array(
- 'PHP',
- 17=>'PHP: Hypertext Preprocessor',
- 5=>'Test',
- 'test'=>27,
- 1000=>'test',
- "-1000"=>array('banana', 'orange'),
- 'monkey',
- $tmp=>-1/3
+ 'PHP',
+ 17=>'PHP: Hypertext Preprocessor',
+ 5=>'Test',
+ 'test'=>27,
+ 1000=>'test',
+ "-1000"=>array('banana', 'orange'),
+ 'monkey',
+ $tmp=>-1/3
);
?>
diff --git a/ext/standard/tests/array/each.phpt b/ext/standard/tests/array/each.phpt
deleted file mode 100644
index 4af2097a7d..0000000000
--- a/ext/standard/tests/array/each.phpt
+++ /dev/null
Binary files differ
diff --git a/ext/standard/tests/array/each_basic.phpt b/ext/standard/tests/array/each_basic.phpt
deleted file mode 100644
index cd38682dc7..0000000000
--- a/ext/standard/tests/array/each_basic.phpt
+++ /dev/null
@@ -1,76 +0,0 @@
---TEST--
-Test each() function : basic functionality
---FILE--
-<?php
-/* Prototype : array each(array $arr)
- * Description: Return the currently pointed key..value pair in the passed array,
- * and advance the pointer to the next element
- * Source code: Zend/zend_builtin_functions.c
- */
-
-/*
- * Test basic functionality of each()
- */
-
-echo "*** Testing each() : basic functionality ***\n";
-
-$arr = array ('one' => 1, 'zero', 'two' => 'deux', 20 => 'twenty');
-echo "\n-- Passed array: --\n";
-var_dump($arr);
-
-echo "\n-- Initial position: --\n";
-var_dump(each($arr));
-
-echo "\n-- End position: --\n";
-end($arr);
-var_dump(each($arr));
-
-echo "\n-- Passed the end of array: --\n";
-var_dump(each($arr));
-
-echo "Done";
-?>
---EXPECTF--
-*** Testing each() : basic functionality ***
-
--- Passed array: --
-array(4) {
- ["one"]=>
- int(1)
- [0]=>
- string(4) "zero"
- ["two"]=>
- string(4) "deux"
- [20]=>
- string(6) "twenty"
-}
-
--- Initial position: --
-
-Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d
-array(4) {
- [1]=>
- int(1)
- ["value"]=>
- int(1)
- [0]=>
- string(3) "one"
- ["key"]=>
- string(3) "one"
-}
-
--- End position: --
-array(4) {
- [1]=>
- string(6) "twenty"
- ["value"]=>
- string(6) "twenty"
- [0]=>
- int(20)
- ["key"]=>
- int(20)
-}
-
--- Passed the end of array: --
-bool(false)
-Done
diff --git a/ext/standard/tests/array/each_error.phpt b/ext/standard/tests/array/each_error.phpt
deleted file mode 100644
index e7ee4976ed..0000000000
--- a/ext/standard/tests/array/each_error.phpt
+++ /dev/null
@@ -1,41 +0,0 @@
---TEST--
-Test each() function : error conditions - pass incorrect number of args
---FILE--
-<?php
-/* Prototype : array each(array $arr)
- * Description: Return the currently pointed key..value pair in the passed array,
- * and advance the pointer to the next element
- * Source code: Zend/zend_builtin_functions.c
- */
-
-/*
- * Pass an incorrect number of arguments to each() to test behaviour
- */
-
-echo "*** Testing each() : error conditions ***\n";
-
-// Zero arguments
-echo "\n-- Testing each() function with Zero arguments --\n";
-var_dump( each() );
-
-//Test each with one more than the expected number of arguments
-echo "\n-- Testing each() function with more than expected no. of arguments --\n";
-$arr = array(1, 2);
-$extra_arg = 10;
-var_dump( each($arr, $extra_arg) );
-
-echo "Done";
-?>
---EXPECTF--
-*** Testing each() : error conditions ***
-
--- Testing each() function with Zero arguments --
-
-Warning: each() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
--- Testing each() function with more than expected no. of arguments --
-
-Warning: each() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-Done
diff --git a/ext/standard/tests/array/each_variation1.phpt b/ext/standard/tests/array/each_variation1.phpt
deleted file mode 100644
index 6b75d5e15c..0000000000
--- a/ext/standard/tests/array/each_variation1.phpt
+++ /dev/null
@@ -1,223 +0,0 @@
---TEST--
-Test each() function : usage variations - Pass different data types as $arr arg
---FILE--
-<?php
-/* Prototype : array each(array $arr)
- * Description: Return the currently pointed key..value pair in the passed array,
- * and advance the pointer to the next element
- * Source code: Zend/zend_builtin_functions.c
- */
-
-/*
- * Pass different data types as $arr arg to each() to test behaviour
- */
-
-echo "*** Testing each() : usage variations ***\n";
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-// get a class
-class classA
-{
- public function __toString() {
- return "Class A object";
- }
-}
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-// get a resource variable
-$fp = fopen(__FILE__, "r");
-
-// unexpected values to be passed to $arr argument
-$inputs = array(
-
- // int data
-/*1*/ 0,
- 1,
- 12345,
- -2345,
-
- // float data
-/*5*/ 10.5,
- -10.5,
- 12.3456789000e10,
- 12.3456789000E-10,
- .5,
-
- // null data
-/*10*/ NULL,
- null,
-
- // boolean data
-/*12*/ true,
- false,
- TRUE,
- FALSE,
-
- // empty data
-/*16*/ "",
- '',
- array(),
-
- // string data
-/*19*/ "string",
- 'string',
- $heredoc,
-
- // object data
-/*22*/ new classA(),
-
- // undefined data
-/*23*/ @$undefined_var,
-
- // unset data
-/*24*/ @$unset_var,
-
- // resource variable
-/*25*/ $fp
-);
-
-// loop through each element of $inputs to check the behavior of each()
-$iterator = 1;
-foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump( each($input) );
- $iterator++;
-};
-
-fclose($fp);
-
-echo "Done";
-?>
---EXPECTF--
-*** Testing each() : usage variations ***
-
--- Iteration 1 --
-
-Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 2 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 3 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 4 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 5 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 6 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 7 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 8 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 9 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 10 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 11 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 12 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 13 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 14 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 15 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 16 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 17 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 18 --
-bool(false)
-
--- Iteration 19 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 20 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 21 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 22 --
-bool(false)
-
--- Iteration 23 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 24 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-
--- Iteration 25 --
-
-Warning: Variable passed to each() is not an array or object in %s on line %d
-NULL
-Done
diff --git a/ext/standard/tests/array/each_variation2.phpt b/ext/standard/tests/array/each_variation2.phpt
deleted file mode 100644
index 34eeedc9a8..0000000000
--- a/ext/standard/tests/array/each_variation2.phpt
+++ /dev/null
@@ -1,249 +0,0 @@
---TEST--
-Test each() function : usage variations - arrays of different data types
---FILE--
-<?php
-/* Prototype : array each(array $arr)
- * Description: Return the currently pointed key..value pair in the passed array,
- * and advance the pointer to the next element
- * Source code: Zend/zend_builtin_functions.c
- */
-
-/*
- * Pass arrays of different data types as $arr argument to each() to test behaviour
- */
-
-echo "*** Testing each() : usage variations ***\n";
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-// get a class
-class classA
-{
- public function __toString() {
- return "Class A object";
- }
-}
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-// get a resource variable
-$fp = fopen(__FILE__, "r");
-
-// arrays of different data types to be passed as $arr
-$inputs = array(
-
- // int data
-/*1*/ 'int' => array(
- 0,
- 1,
- 12345,
- -2345,
- ),
-
- // float data
-/*2*/ 'float' => array(
- 10.5,
- -10.5,
- 12.3456789000e10,
- 12.3456789000E-10,
- .5,
- ),
-
- // null data
-/*3*/ 'null' => array(
- NULL,
- null,
- ),
-
- // boolean data
-/*4*/ 'bool' => array(
- true,
- false,
- TRUE,
- FALSE,
- ),
-
- // empty data
-/*5*/ 'empty string' => array(
- "",
- '',
- ),
-
-/*6*/ 'empty array' => array(
- ),
-
- // string data
-/*7*/ 'string' => array(
- "string",
- 'string',
- $heredoc,
- ),
-
- // object data
-/*8*/ 'object' => array(
- new classA(),
- ),
-
- // undefined data
-/*9*/ 'undefined' => array(
- @$undefined_var,
- ),
-
- // unset data
-/*10*/ 'unset' => array(
- @$unset_var,
- ),
-
- // resource variable
-/*11*/ 'resource' => array(
- $fp
- ),
-);
-
-// loop through each element of $inputs to check the behavior of each()
-$iterator = 1;
-foreach($inputs as $key => $input) {
- echo "\n-- Iteration $iterator: $key data --\n";
- var_dump( each($input) );
- $iterator++;
-};
-
-fclose($fp);
-
-echo "Done";
-?>
---EXPECTF--
-*** Testing each() : usage variations ***
-
--- Iteration 1: int data --
-
-Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d
-array(4) {
- [1]=>
- int(0)
- ["value"]=>
- int(0)
- [0]=>
- int(0)
- ["key"]=>
- int(0)
-}
-
--- Iteration 2: float data --
-array(4) {
- [1]=>
- float(10.5)
- ["value"]=>
- float(10.5)
- [0]=>
- int(0)
- ["key"]=>
- int(0)
-}
-
--- Iteration 3: null data --
-array(4) {
- [1]=>
- NULL
- ["value"]=>
- NULL
- [0]=>
- int(0)
- ["key"]=>
- int(0)
-}
-
--- Iteration 4: bool data --
-array(4) {
- [1]=>
- bool(true)
- ["value"]=>
- bool(true)
- [0]=>
- int(0)
- ["key"]=>
- int(0)
-}
-
--- Iteration 5: empty string data --
-array(4) {
- [1]=>
- string(0) ""
- ["value"]=>
- string(0) ""
- [0]=>
- int(0)
- ["key"]=>
- int(0)
-}
-
--- Iteration 6: empty array data --
-bool(false)
-
--- Iteration 7: string data --
-array(4) {
- [1]=>
- string(6) "string"
- ["value"]=>
- string(6) "string"
- [0]=>
- int(0)
- ["key"]=>
- int(0)
-}
-
--- Iteration 8: object data --
-array(4) {
- [1]=>
- object(classA)#%d (0) {
- }
- ["value"]=>
- object(classA)#%d (0) {
- }
- [0]=>
- int(0)
- ["key"]=>
- int(0)
-}
-
--- Iteration 9: undefined data --
-array(4) {
- [1]=>
- NULL
- ["value"]=>
- NULL
- [0]=>
- int(0)
- ["key"]=>
- int(0)
-}
-
--- Iteration 10: unset data --
-array(4) {
- [1]=>
- NULL
- ["value"]=>
- NULL
- [0]=>
- int(0)
- ["key"]=>
- int(0)
-}
-
--- Iteration 11: resource data --
-array(4) {
- [1]=>
- resource(%d) of type (stream)
- ["value"]=>
- resource(%d) of type (stream)
- [0]=>
- int(0)
- ["key"]=>
- int(0)
-}
-Done
diff --git a/ext/standard/tests/array/each_variation3.phpt b/ext/standard/tests/array/each_variation3.phpt
deleted file mode 100644
index 32342d6d78..0000000000
--- a/ext/standard/tests/array/each_variation3.phpt
+++ /dev/null
@@ -1,254 +0,0 @@
---TEST--
-Test each() function : usage variations - keys of different data types
---FILE--
-<?php
-/* Prototype : array each(array $arr)
- * Description: Return the currently pointed key..value pair in the passed array,
- * and advance the pointer to the next element
- * Source code: Zend/zend_builtin_functions.c
- */
-
-/*
- * Pass each() arrays where the keys are different data types to test behaviour
- */
-
-echo "*** Testing each() : usage variations ***\n";
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-// unexpected values to be passed as $arr
-$inputs = array(
-
- // int data
-/*1*/ 'int' => array(
- 0 => 'zero',
- 1 => 'one',
- 12345 => 'positive',
- -2345 => 'negative',
- ),
-
- // float data
-/*2*/ 'float' => array(
- 10.5 => 'positive',
- -10.5 => 'negative',
- .5 => 'half',
- ),
-
-/*3*/ 'extreme floats' => array(
- 12.3456789000e6 => 'large',
- 12.3456789000E-10 => 'small',
- ),
-
- // null data
-/*4*/ 'null uppercase' => array(
- NULL => 'null 1',
- ),
-
-/*5*/ 'null lowercase' => array(
- null => 'null 2',
- ),
-
- // boolean data
-/*6*/ 'bool lowercase' => array(
- true => 'lowert',
- false => 'lowerf',
- ),
-
-/*7*/ 'bool uppercase' => array(
- TRUE => 'uppert',
- FALSE => 'upperf',
- ),
-
- // empty data
-/*8*/ 'empty double quotes' => array(
- "" => 'emptyd',
- ),
-
-/*9*/ 'empty single quotes' => array(
- '' => 'emptys',
- ),
-
- // string data
-/*10*/ 'string' => array(
- "stringd" => 'stringd',
- 'strings' => 'strings',
- $heredoc => 'stringh',
- ),
-
- // undefined data
-/*11*/ 'undefined' => array(
- @$undefined_var => 'undefined',
- ),
-
- // unset data
-/*12*/ 'unset' => array(
- @$unset_var => 'unset',
- ),
-);
-
-// loop through each element of $inputs to check the behavior of each()
-$iterator = 1;
-foreach($inputs as $key => $input) {
- echo "\n-- Iteration $iterator: $key data --\n";
- var_dump( each($input) );
- $iterator++;
-};
-
-echo "Done";
-?>
---EXPECTF--
-*** Testing each() : usage variations ***
-
--- Iteration 1: int data --
-
-Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d
-array(4) {
- [1]=>
- string(4) "zero"
- ["value"]=>
- string(4) "zero"
- [0]=>
- int(0)
- ["key"]=>
- int(0)
-}
-
--- Iteration 2: float data --
-array(4) {
- [1]=>
- string(8) "positive"
- ["value"]=>
- string(8) "positive"
- [0]=>
- int(10)
- ["key"]=>
- int(10)
-}
-
--- Iteration 3: extreme floats data --
-array(4) {
- [1]=>
- string(5) "large"
- ["value"]=>
- string(5) "large"
- [0]=>
- int(12345678)
- ["key"]=>
- int(12345678)
-}
-
--- Iteration 4: null uppercase data --
-array(4) {
- [1]=>
- string(6) "null 1"
- ["value"]=>
- string(6) "null 1"
- [0]=>
- string(0) ""
- ["key"]=>
- string(0) ""
-}
-
--- Iteration 5: null lowercase data --
-array(4) {
- [1]=>
- string(6) "null 2"
- ["value"]=>
- string(6) "null 2"
- [0]=>
- string(0) ""
- ["key"]=>
- string(0) ""
-}
-
--- Iteration 6: bool lowercase data --
-array(4) {
- [1]=>
- string(6) "lowert"
- ["value"]=>
- string(6) "lowert"
- [0]=>
- int(1)
- ["key"]=>
- int(1)
-}
-
--- Iteration 7: bool uppercase data --
-array(4) {
- [1]=>
- string(6) "uppert"
- ["value"]=>
- string(6) "uppert"
- [0]=>
- int(1)
- ["key"]=>
- int(1)
-}
-
--- Iteration 8: empty double quotes data --
-array(4) {
- [1]=>
- string(6) "emptyd"
- ["value"]=>
- string(6) "emptyd"
- [0]=>
- string(0) ""
- ["key"]=>
- string(0) ""
-}
-
--- Iteration 9: empty single quotes data --
-array(4) {
- [1]=>
- string(6) "emptys"
- ["value"]=>
- string(6) "emptys"
- [0]=>
- string(0) ""
- ["key"]=>
- string(0) ""
-}
-
--- Iteration 10: string data --
-array(4) {
- [1]=>
- string(7) "stringd"
- ["value"]=>
- string(7) "stringd"
- [0]=>
- string(7) "stringd"
- ["key"]=>
- string(7) "stringd"
-}
-
--- Iteration 11: undefined data --
-array(4) {
- [1]=>
- string(9) "undefined"
- ["value"]=>
- string(9) "undefined"
- [0]=>
- string(0) ""
- ["key"]=>
- string(0) ""
-}
-
--- Iteration 12: unset data --
-array(4) {
- [1]=>
- string(5) "unset"
- ["value"]=>
- string(5) "unset"
- [0]=>
- string(0) ""
- ["key"]=>
- string(0) ""
-}
-Done
diff --git a/ext/standard/tests/array/each_variation4.phpt b/ext/standard/tests/array/each_variation4.phpt
deleted file mode 100644
index 64fbb4a8d0..0000000000
--- a/ext/standard/tests/array/each_variation4.phpt
+++ /dev/null
@@ -1,60 +0,0 @@
---TEST--
-Test each() function : usage variations - Referenced variables
---FILE--
-<?php
-/* Prototype : array each(array $arr)
- * Description: Return the currently pointed key..value pair in the passed array,
- * and advance the pointer to the next element
- * Source code: Zend/zend_builtin_functions.c
- */
-
-/*
- * Test behaviour of each() when:
- * 1. Passed an array made up of referenced variables
- * 2. Passed an array as $arr argument by reference
- */
-
-echo "*** Testing each() : usage variations ***\n";
-
-echo "\n-- Array made up of referenced variables: --\n";
-$val1 = 'foo';
-$val2 = 'bar';
-
-$arr1 = array('one' => &$val1, &$val2);
-
-echo "-- Call each until at the end of the array: --\n";
-var_dump( each($arr1) );
-var_dump( each($arr1) );
-var_dump( each($arr1) );
-
-echo "Done";
-?>
---EXPECTF--
-*** Testing each() : usage variations ***
-
--- Array made up of referenced variables: --
--- Call each until at the end of the array: --
-
-Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d
-array(4) {
- [1]=>
- string(3) "foo"
- ["value"]=>
- string(3) "foo"
- [0]=>
- string(3) "one"
- ["key"]=>
- string(3) "one"
-}
-array(4) {
- [1]=>
- string(3) "bar"
- ["value"]=>
- string(3) "bar"
- [0]=>
- int(0)
- ["key"]=>
- int(0)
-}
-bool(false)
-Done
diff --git a/ext/standard/tests/array/each_variation5.phpt b/ext/standard/tests/array/each_variation5.phpt
deleted file mode 100644
index 441882f962..0000000000
--- a/ext/standard/tests/array/each_variation5.phpt
+++ /dev/null
@@ -1,97 +0,0 @@
---TEST--
-Test each() function : usage variations - Multi-dimensional arrays
---FILE--
-<?php
-/* Prototype : array each(array $arr)
- * Description: Return the currently pointed key..value pair in the passed array,
- * and advance the pointer to the next element
- * Source code: Zend/zend_builtin_functions.c
- */
-
-/*
- * Test behaviour of each() when passed:
- * 1. a two-dimensional array
- * 2. a sub-array
- */
-
-echo "*** Testing each() : usage variations ***\n";
-
-$arr = array ('zero',
- array(1, 2, 3),
- 'one' => 'un',
- array('a', 'b', 'c')
- );
-
-echo "\n-- Pass each() a two-dimensional array --\n";
-for ($i = 1; $i < count($arr); $i++) {
- var_dump( each($arr) );
-}
-
-echo "\n-- Pass each() a sub-array --\n";
-var_dump( each($arr[2]));
-
-echo "Done";
-?>
---EXPECTF--
-*** Testing each() : usage variations ***
-
--- Pass each() a two-dimensional array --
-
-Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d
-array(4) {
- [1]=>
- string(4) "zero"
- ["value"]=>
- string(4) "zero"
- [0]=>
- int(0)
- ["key"]=>
- int(0)
-}
-array(4) {
- [1]=>
- array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- }
- ["value"]=>
- array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- }
- [0]=>
- int(1)
- ["key"]=>
- int(1)
-}
-array(4) {
- [1]=>
- string(2) "un"
- ["value"]=>
- string(2) "un"
- [0]=>
- string(3) "one"
- ["key"]=>
- string(3) "one"
-}
-
--- Pass each() a sub-array --
-array(4) {
- [1]=>
- string(1) "a"
- ["value"]=>
- string(1) "a"
- [0]=>
- int(0)
- ["key"]=>
- int(0)
-}
-Done
diff --git a/ext/standard/tests/array/each_variation6.phpt b/ext/standard/tests/array/each_variation6.phpt
deleted file mode 100644
index de52ba5965..0000000000
--- a/ext/standard/tests/array/each_variation6.phpt
+++ /dev/null
@@ -1,52 +0,0 @@
---TEST--
-Test each() function : usage variations - Internal array pointer
---FILE--
-<?php
-/* Prototype : array each(array $arr)
- * Description: Return the currently pointed key..value pair in the passed array,
- * and advance the pointer to the next element
- * Source code: Zend/zend_builtin_functions.c
- */
-
-/*
- * Test the position of the internal array pointer after a call to each()
- */
-
-echo "*** Testing each() : usage variations ***\n";
-
-$arr = array('zero', 'one', 'two', 'abc', 'xyz');
-
-echo "\n-- Current position: --\n";
-echo key($arr) . " => " . current($arr) . "\n";
-
-echo "\n-- Call to each(): --\n";
-var_dump( each($arr) );
-
-echo "\n-- New position: --\n";
-echo key($arr) . " => " . current($arr) . "\n";
-
-echo "Done";
-?>
---EXPECTF--
-*** Testing each() : usage variations ***
-
--- Current position: --
-0 => zero
-
--- Call to each(): --
-
-Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d
-array(4) {
- [1]=>
- string(4) "zero"
- ["value"]=>
- string(4) "zero"
- [0]=>
- int(0)
- ["key"]=>
- int(0)
-}
-
--- New position: --
-1 => one
-Done
diff --git a/ext/standard/tests/array/end.phpt b/ext/standard/tests/array/end.phpt
index 724f2e612f..a7474a7e73 100644
--- a/ext/standard/tests/array/end.phpt
+++ b/ext/standard/tests/array/end.phpt
@@ -106,21 +106,6 @@ $resources = array($file_handle, $dir_handle);
var_dump( end($resources) );
var_dump( current($resources) );
-echo "\n*** Testing error conditions ***\n";
-/* checking for unexpected number of arguments */
-var_dump( end() );
-var_dump( end($array[0], $array[0]) );
-
-/* checking for unexpected type of arguments */
-$var=1;
-$var1="string";
-var_dump( end($var) );
-var_dump( end($var1) );
-
-/* checking null array */
-$null_array = array();
-var_dump( end($null_array) );
-
echo "Done\n";
@@ -219,19 +204,4 @@ array(2) {
*** Testing end() on resource type ***
resource(%d) of type (stream)
resource(%d) of type (stream)
-
-*** Testing error conditions ***
-
-Warning: end() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: end() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: end() expects parameter 1 to be array, int given in %s on line %d
-NULL
-
-Warning: end() expects parameter 1 to be array, string given in %s on line %d
-NULL
-bool(false)
Done
diff --git a/ext/standard/tests/array/end_64bit.phpt b/ext/standard/tests/array/end_64bit.phpt
index 0049041848..ba20693d0f 100644
--- a/ext/standard/tests/array/end_64bit.phpt
+++ b/ext/standard/tests/array/end_64bit.phpt
@@ -106,21 +106,6 @@ $resources = array($file_handle, $dir_handle);
var_dump( end($resources) );
var_dump( current($resources) );
-echo "\n*** Testing error conditions ***\n";
-/* checking for unexpected number of arguments */
-var_dump( end() );
-var_dump( end($array[0], $array[0]) );
-
-/* checking for unexpected type of arguments */
-$var=1;
-$var1="string";
-var_dump( end($var) );
-var_dump( end($var1) );
-
-/* checking null array */
-$null_array = array();
-var_dump( end($null_array) );
-
echo "Done\n";
?>
@@ -218,19 +203,4 @@ array(2) {
*** Testing end() on resource type ***
resource(%d) of type (stream)
resource(%d) of type (stream)
-
-*** Testing error conditions ***
-
-Warning: end() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: end() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: end() expects parameter 1 to be array, int given in %s on line %d
-NULL
-
-Warning: end() expects parameter 1 to be array, string given in %s on line %d
-NULL
-bool(false)
Done
diff --git a/ext/standard/tests/array/end_basic.phpt b/ext/standard/tests/array/end_basic.phpt
index b14cc2f836..b337ece75c 100644
--- a/ext/standard/tests/array/end_basic.phpt
+++ b/ext/standard/tests/array/end_basic.phpt
@@ -28,7 +28,6 @@ echo "\n-- Add a new element to array --\n";
$array[2] = 'foo';
var_dump(end($array));
?>
-===DONE===
--EXPECT--
*** Testing end() : basic functionality ***
@@ -43,4 +42,3 @@ string(3) "two"
-- Add a new element to array --
string(3) "foo"
-===DONE===
diff --git a/ext/standard/tests/array/end_variation2.phpt b/ext/standard/tests/array/end_variation2.phpt
index 43972b751e..354e3d5369 100644
--- a/ext/standard/tests/array/end_variation2.phpt
+++ b/ext/standard/tests/array/end_variation2.phpt
@@ -24,7 +24,6 @@ var_dump(end($array_arg));
echo "\n-- Pass a sub-array as \$array_arg --\n";
var_dump(end($array_arg[0]));
?>
-===DONE===
--EXPECT--
*** Testing end() : usage variations ***
@@ -40,4 +39,3 @@ array(3) {
-- Pass a sub-array as $array_arg --
int(7)
-===DONE===
diff --git a/ext/standard/tests/array/end_variation3.phpt b/ext/standard/tests/array/end_variation3.phpt
index fbeea68a12..8e9284b816 100644
--- a/ext/standard/tests/array/end_variation3.phpt
+++ b/ext/standard/tests/array/end_variation3.phpt
@@ -28,7 +28,6 @@ var_dump(current($array1));
echo "\$array2: ";
var_dump(current($array2));
?>
-===DONE===
--EXPECT--
*** Testing end() : usage variations ***
@@ -38,4 +37,3 @@ string(4) "zero"
-- Position after calling end() --
$array1: string(3) "two"
$array2: string(3) "two"
-===DONE===
diff --git a/ext/standard/tests/array/extract_error.phpt b/ext/standard/tests/array/extract_error.phpt
index e8bcf8f5d8..db6569e94c 100644
--- a/ext/standard/tests/array/extract_error.phpt
+++ b/ext/standard/tests/array/extract_error.phpt
@@ -6,53 +6,33 @@ Test extract() function (error conditions)
/* Testing Error Conditions */
echo "*** Testing Error Conditions ***\n";
-/* Zero Arguments */
-var_dump( extract() );
-
/* Invalid second argument ( only 0-6 is valid) */
$arr = array(1);
-var_dump( extract($arr, -1 . "wddr") );
-var_dump( extract($arr, 7 , "wddr") );
-
-/* scalar argument */
-$val = 1;
-var_dump( extract($val) );
-/* string argument */
-$str = "test";
-var_dump( extract($str) );
+try {
+ var_dump( extract($arr, -1 . "wddr") );
+} catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+}
-/* More than valid number of arguments i.e. 3 args */
-var_dump( extract($arr, EXTR_SKIP, "aa", "ee") );
+try {
+ var_dump( extract($arr, 7 , "wddr") );
+} catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+}
/* Two Arguments, second as prefix but without prefix string as third argument */
-var_dump( extract($arr,EXTR_PREFIX_IF_EXISTS) );
+try {
+ var_dump( extract($arr,EXTR_PREFIX_IF_EXISTS) );
+} catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+}
-echo "Done\n";
?>
--EXPECTF--
*** Testing Error Conditions ***
-Warning: extract() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
Notice: A non well formed numeric value encountered in %s on line %d
-
-Warning: extract(): Invalid extract type in %s on line %d
-NULL
-
-Warning: extract(): Invalid extract type in %s on line %d
-NULL
-
-Warning: extract() expects parameter 1 to be array, int given in %s on line %d
-NULL
-
-Warning: extract() expects parameter 1 to be array, string given in %s on line %d
-NULL
-
-Warning: extract() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-
-Warning: extract(): specified extract type requires the prefix parameter in %s on line %d
-NULL
-Done
+Invalid extract type
+Invalid extract type
+Specified extract type requires the prefix parameter
diff --git a/ext/standard/tests/array/extract_error_variation1.phpt b/ext/standard/tests/array/extract_error_variation1.phpt
new file mode 100644
index 0000000000..a0caafb213
--- /dev/null
+++ b/ext/standard/tests/array/extract_error_variation1.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Test extract() function - error condition - Invalid prefix.
+--FILE--
+<?php
+$a = ["1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five"];
+
+try {
+ extract($a, EXTR_PREFIX_ALL, '85bogus');
+} catch (\ValueError $e) {
+ echo $e->getMessage();
+}
+?>
+--EXPECT--
+Prefix is not a valid identifier
diff --git a/ext/standard/tests/array/extract_typed_ref.phpt b/ext/standard/tests/array/extract_typed_ref.phpt
index 8b697d5ccb..6d2a5a9272 100644
--- a/ext/standard/tests/array/extract_typed_ref.phpt
+++ b/ext/standard/tests/array/extract_typed_ref.phpt
@@ -2,17 +2,17 @@
extract() into typed references must respect their type
--FILE--
<?php
-
+
class Test {
- public int $i = 0;
- public string $s = "";
+ public int $i = 0;
+ public string $s = "";
}
$test = new Test;
$i =& $test->i;
$s =& $test->s;
try {
- extract(['i' => 'foo', 's' => 42]);
+ extract(['i' => 'foo', 's' => 42]);
} catch (TypeError $e) { echo $e->getMessage(), "\n"; }
var_dump($test->i, $test->s);
diff --git a/ext/standard/tests/array/extract_variation7.phpt b/ext/standard/tests/array/extract_variation7.phpt
index 1502a52380..eb5171bfc7 100644
--- a/ext/standard/tests/array/extract_variation7.phpt
+++ b/ext/standard/tests/array/extract_variation7.phpt
@@ -9,7 +9,7 @@ $a = array( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "f
var_dump ( extract($a, EXTR_PREFIX_ALL, "same"));
$b = array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2.4 => "float", "F" => "FFF",
- "blank" => "", 3.7 => 3.7, 5.4 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 );
+ "blank" => "", 3.7 => 3.7, 5.4 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 );
var_dump ( extract($b, EXTR_PREFIX_ALL, "same"));
var_dump ( extract($b, EXTR_PREFIX_ALL, "diff"));
diff --git a/ext/standard/tests/array/in_array_variation3.phpt b/ext/standard/tests/array/in_array_variation3.phpt
index f07d1dea89..0b58990041 100644
--- a/ext/standard/tests/array/in_array_variation3.phpt
+++ b/ext/standard/tests/array/in_array_variation3.phpt
@@ -36,9 +36,17 @@ class in_array_check {
$in_array_obj = new in_array_check(); //creating new object
//error: as wrong datatype for second argument
-var_dump( in_array("array_var", $in_array_obj) );
+try {
+ var_dump( in_array("array_var", $in_array_obj) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
//error: as wrong datatype for second argument
-var_dump( in_array("foo", $in_array_obj) );
+try {
+ var_dump( in_array("foo", $in_array_obj) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
//element found as "one" exists in array $array_var
var_dump( in_array("one", $in_array_obj->array_var) );
@@ -51,11 +59,7 @@ bool(true)
bool(true)
*** Testing objects with in_array() ***
-
-Warning: in_array() expects parameter 2 to be array, object given in %s on line %d
-NULL
-
-Warning: in_array() expects parameter 2 to be array, object given in %s on line %d
-NULL
+in_array() expects parameter 2 to be array, object given
+in_array() expects parameter 2 to be array, object given
bool(true)
Done
diff --git a/ext/standard/tests/array/in_array_variation4.phpt b/ext/standard/tests/array/in_array_variation4.phpt
index d481010211..4cfc405922 100644
--- a/ext/standard/tests/array/in_array_variation4.phpt
+++ b/ext/standard/tests/array/in_array_variation4.phpt
@@ -9,7 +9,7 @@ Test in_array() function : usage variations - haystack as resource/multi dimensi
* Source Code: ext/standard/array.c
*/
-/* Test in_array() with haystack as resouce and multidimensional arrays */
+/* Test in_array() with haystack as resource and multidimensional arrays */
/* checking for Resources */
echo "*** Testing resource type with in_array() ***\n";
@@ -22,7 +22,7 @@ $dir_handle = opendir( __DIR__ );
//store resources in array for comparison.
$resources = array($file_handle, $dir_handle);
-// search for resouce type in the resource array
+// search for resource type in the resource array
var_dump( in_array($file_handle, $resources, true) );
//checking for (int) type resource
var_dump( in_array((int)$dir_handle, $resources, true) );
diff --git a/ext/standard/tests/array/key_basic.phpt b/ext/standard/tests/array/key_basic.phpt
index 2b45124921..6e0d2f9d50 100644
--- a/ext/standard/tests/array/key_basic.phpt
+++ b/ext/standard/tests/array/key_basic.phpt
@@ -29,7 +29,6 @@ echo "\n-- Past end of the array --\n";
next($array);
var_dump(key($array));
?>
-===DONE===
--EXPECT--
*** Testing key() : basic functionality ***
@@ -44,4 +43,3 @@ string(5) "three"
-- Past end of the array --
NULL
-===DONE===
diff --git a/ext/standard/tests/array/key_variation2.phpt b/ext/standard/tests/array/key_variation2.phpt
index cf7ca37531..3a6022e08a 100644
--- a/ext/standard/tests/array/key_variation2.phpt
+++ b/ext/standard/tests/array/key_variation2.phpt
@@ -97,13 +97,12 @@ $iterator = 1;
foreach($inputs as $key => $input) {
echo "\n-- Iteration $iterator : $key data --\n";
while (key($input) !== NULL) {
- var_dump(key($input));
- next($input);
+ var_dump(key($input));
+ next($input);
}
$iterator++;
};
?>
-===DONE===
--EXPECT--
*** Testing key() : usage variations ***
@@ -152,4 +151,3 @@ string(0) ""
-- Iteration 12 : unset data --
string(0) ""
-===DONE===
diff --git a/ext/standard/tests/array/key_variation3.phpt b/ext/standard/tests/array/key_variation3.phpt
index 2d5387e56e..9ad9ff8a7d 100644
--- a/ext/standard/tests/array/key_variation3.phpt
+++ b/ext/standard/tests/array/key_variation3.phpt
@@ -30,7 +30,6 @@ var_dump(key($array1));
echo "\$array2: ";
var_dump(key($array2));
?>
-===DONE===
--EXPECT--
*** Testing key() : usage variations ***
@@ -40,4 +39,3 @@ int(0)
-- Position after calling next() --
$array1: int(1)
$array2: int(1)
-===DONE===
diff --git a/ext/standard/tests/array/key_variation4.phpt b/ext/standard/tests/array/key_variation4.phpt
index a7fa8d7bf9..b89ca829b4 100644
--- a/ext/standard/tests/array/key_variation4.phpt
+++ b/ext/standard/tests/array/key_variation4.phpt
@@ -44,7 +44,6 @@ var_dump(key($multi_array[3][3][3]));
// see if internal pointer is in the same position from when accessing this inner array
var_dump(key($multi_array[3][3][3][1]));
?>
-===DONE===
--EXPECT--
*** Testing key() : usage variations ***
@@ -60,4 +59,3 @@ Initial Position: int(0)
Current Position: int(2)
int(2)
int(0)
-===DONE===
diff --git a/ext/standard/tests/array/krsort_basic.phpt b/ext/standard/tests/array/krsort_basic.phpt
index f65fa0a553..393b7f06e4 100644
--- a/ext/standard/tests/array/krsort_basic.phpt
+++ b/ext/standard/tests/array/krsort_basic.phpt
@@ -10,7 +10,7 @@ Test krsort() function : basic functionality
/*
* Testing krsort() by providing array of integer/string values to check the basic functionality
* with following flag values :
- * 1.flag value as defualt
+ * 1.flag value as default
* 2.SORT_REGULAR - compare items normally
* 3.SORT_NUMERIC - compare items numerically
* 4.SORT_STRING - compare items as strings
@@ -21,19 +21,19 @@ echo "*** Testing krsort() : basic functionality ***\n";
// an array containing unsorted string values with indices
$unsorted_strings = array( "lemon" => "l", "orange" => "o", "banana" => "b" );
$unsorted_strings = array(
- "l" => "lemon", "o" => "orange",
- "O" => "Orange", "O1" => "Orange1", "o2" => "orange2", "O3" => "Orange3", "o20" => "orange20",
- "b" => "banana",
+ "l" => "lemon", "o" => "orange",
+ "O" => "Orange", "O1" => "Orange1", "o2" => "orange2", "O3" => "Orange3", "o20" => "orange20",
+ "b" => "banana",
);
// an array containing unsorted numeric values with indices
$unsorted_numerics = array( 100 => 4, 33 => 3, 555 => 2, 22 => 1 );
-echo "\n-- Testing krsort() by supplying string array, 'flag' value is defualt --\n";
+echo "\n-- Testing krsort() by supplying string array, 'flag' value is default --\n";
$temp_array = $unsorted_strings;
var_dump( krsort($temp_array) ); // expecting : bool(true)
var_dump( $temp_array);
-echo "\n-- Testing krsort() by supplying numeric array, 'flag' value is defualt --\n";
+echo "\n-- Testing krsort() by supplying numeric array, 'flag' value is default --\n";
$temp_array = $unsorted_numerics;
var_dump( krsort($temp_array) ); // expecting : bool(true)
var_dump( $temp_array);
@@ -78,7 +78,7 @@ echo "Done\n";
--EXPECT--
*** Testing krsort() : basic functionality ***
--- Testing krsort() by supplying string array, 'flag' value is defualt --
+-- Testing krsort() by supplying string array, 'flag' value is default --
bool(true)
array(8) {
["o20"]=>
@@ -99,7 +99,7 @@ array(8) {
string(6) "Orange"
}
--- Testing krsort() by supplying numeric array, 'flag' value is defualt --
+-- Testing krsort() by supplying numeric array, 'flag' value is default --
bool(true)
array(4) {
[555]=>
diff --git a/ext/standard/tests/array/krsort_object.phpt b/ext/standard/tests/array/krsort_object.phpt
index 308be2cc26..482dacc50a 100644
--- a/ext/standard/tests/array/krsort_object.phpt
+++ b/ext/standard/tests/array/krsort_object.phpt
@@ -8,7 +8,7 @@ Test krsort() function : object functionality - sort objects
*/
/*
* testing krsort() by providing array of integer/string objects with following flag values:
- * 1.Defualt flag value
+ * 1.Default flag value
* 2.SORT_REGULAR - compare items normally
*/
@@ -56,14 +56,14 @@ $unsorted_str_obj = array (
);
-echo "\n-- Testing krsort() by supplying various object arrays, 'flag' value is defualt --\n";
+echo "\n-- Testing krsort() by supplying various object arrays, 'flag' value is default --\n";
-// testing krsort() function by supplying integer object array, flag value is defualt
+// testing krsort() function by supplying integer object array, flag value is default
$temp_array = $unsorted_int_obj;
var_dump(krsort($temp_array) );
var_dump($temp_array);
-// testing krsort() function by supplying string object array, flag value is defualt
+// testing krsort() function by supplying string object array, flag value is default
$temp_array = $unsorted_str_obj;
var_dump(krsort($temp_array) );
var_dump($temp_array);
@@ -84,7 +84,7 @@ echo "Done\n";
--EXPECTF--
*** Testing krsort() : object functionality ***
--- Testing krsort() by supplying various object arrays, 'flag' value is defualt --
+-- Testing krsort() by supplying various object arrays, 'flag' value is default --
bool(true)
array(6) {
[50]=>
diff --git a/ext/standard/tests/array/krsort_variation10.phpt b/ext/standard/tests/array/krsort_variation10.phpt
index c22656d173..aa614a5b50 100644
--- a/ext/standard/tests/array/krsort_variation10.phpt
+++ b/ext/standard/tests/array/krsort_variation10.phpt
@@ -10,7 +10,7 @@ Test krsort() function : usage variations - sort heredoc strings
/*
* testing krsort() by providing array of heredoc strings for $array argument with
* following flag values:
- * 1.flag value as defualt
+ * 1.flag value as default
* 2.SORT_REGULAR - compare items normally
* 3.SORT_STRING - compare items as strings
*/
@@ -37,7 +37,7 @@ $array = array (
$multiline_heredoc => "heredoc string\twith!@# and 123\nTest this!!!"
);
-echo "\n-- Testing krsort() by supplying heredoc string array, 'flag' value is defualt --\n";
+echo "\n-- Testing krsort() by supplying heredoc string array, 'flag' value is default --\n";
$temp_array = $array;
var_dump(krsort($temp_array) ); // expecting : bool(true)
var_dump($temp_array);
@@ -57,7 +57,7 @@ echo "Done\n";
--EXPECT--
*** Testing krsort() : usage variations ***
--- Testing krsort() by supplying heredoc string array, 'flag' value is defualt --
+-- Testing krsort() by supplying heredoc string array, 'flag' value is default --
bool(true)
array(3) {
["heredoc string with!@# and 123
diff --git a/ext/standard/tests/array/krsort_variation11.phpt b/ext/standard/tests/array/krsort_variation11.phpt
index 32ca85c6ec..271559c3e5 100644
--- a/ext/standard/tests/array/krsort_variation11.phpt
+++ b/ext/standard/tests/array/krsort_variation11.phpt
@@ -9,7 +9,7 @@ Test krsort() function : usage variations - sort bool values
/*
* testing krsort() by providing array of boolean values for $array argument with following flag values:
- * 1.flag value as defualt
+ * 1.flag value as default
* 2.SORT_REGULAR - compare items normally
*/
@@ -18,7 +18,7 @@ echo "*** Testing krsort() : usage variations ***\n";
// bool value array
$bool_values = array (true => true, false => false, TRUE => TRUE, FALSE => FALSE);
-echo "\n-- Testing krsort() by supplying boolean value array, 'flag' value is defualt --\n";
+echo "\n-- Testing krsort() by supplying boolean value array, 'flag' value is default --\n";
$temp_array = $bool_values;
var_dump(krsort($temp_array) );
var_dump($temp_array);
@@ -43,7 +43,7 @@ echo "Done\n";
--EXPECT--
*** Testing krsort() : usage variations ***
--- Testing krsort() by supplying boolean value array, 'flag' value is defualt --
+-- Testing krsort() by supplying boolean value array, 'flag' value is default --
bool(true)
array(2) {
[1]=>
diff --git a/ext/standard/tests/array/krsort_variation3.phpt b/ext/standard/tests/array/krsort_variation3.phpt
index 506b0cfa57..c94dc4981e 100644
--- a/ext/standard/tests/array/krsort_variation3.phpt
+++ b/ext/standard/tests/array/krsort_variation3.phpt
@@ -10,7 +10,7 @@ Test krsort() function : usage variations - sort integer/float values
/*
* Testing krsort() by providing array of integer/float/mixed values for $array argument
* with following flag values:
- * 1.flag value as defualt
+ * 1.flag value as default
* 2.SORT_REGULAR - compare items normally
* 3.SORT_NUMERIC - compare items numerically
*/
@@ -40,7 +40,7 @@ echo "\n-- Testing krsort() by supplying various integer/float arrays --\n";
foreach ($various_arrays as $array) {
echo "\n-- Iteration $count --\n";
- echo "- With defualt sort flag -\n";
+ echo "- With default sort flag -\n";
$temp_array = $array;
var_dump(krsort($temp_array) );
var_dump($temp_array);
@@ -63,7 +63,7 @@ echo "Done\n";
-- Testing krsort() by supplying various integer/float arrays --
-- Iteration 1 --
-- With defualt sort flag -
+- With default sort flag -
bool(true)
array(9) {
[8]=>
@@ -131,7 +131,7 @@ array(9) {
}
-- Iteration 2 --
-- With defualt sort flag -
+- With default sort flag -
bool(true)
array(6) {
[6]=>
@@ -181,7 +181,7 @@ array(6) {
}
-- Iteration 3 --
-- With defualt sort flag -
+- With default sort flag -
bool(true)
array(11) {
[11]=>
diff --git a/ext/standard/tests/array/krsort_variation4.phpt b/ext/standard/tests/array/krsort_variation4.phpt
index dbbac1e85a..f17be973e4 100644
--- a/ext/standard/tests/array/krsort_variation4.phpt
+++ b/ext/standard/tests/array/krsort_variation4.phpt
@@ -10,7 +10,7 @@ Test krsort() function : usage variations - sort octal values
/*
* testing krsort() by providing array of octal values for $array argument
* with following flag values:
- * 1.flag value as defualt
+ * 1.flag value as default
* 2.SORT_REGULAR - compare items normally
* 3.SORT_NUMERIC - compare items numerically
*/
@@ -23,7 +23,7 @@ $unsorted_oct_array = array (
077 => 06, -066 => -01, -0345 => -02, 0 => 0
);
-echo "\n-- Testing krsort() by supplying octal value array, 'flag' value is defualt --\n";
+echo "\n-- Testing krsort() by supplying octal value array, 'flag' value is default --\n";
$temp_array = $unsorted_oct_array;
var_dump( krsort($temp_array) ); // expecting : bool(true)
var_dump($temp_array);
@@ -43,7 +43,7 @@ echo "Done\n";
--EXPECT--
*** Testing krsort() : usage variations ***
--- Testing krsort() by supplying octal value array, 'flag' value is defualt --
+-- Testing krsort() by supplying octal value array, 'flag' value is default --
bool(true)
array(9) {
[669]=>
diff --git a/ext/standard/tests/array/krsort_variation5.phpt b/ext/standard/tests/array/krsort_variation5.phpt
index 75986690e5..e8f5404f9f 100644
--- a/ext/standard/tests/array/krsort_variation5.phpt
+++ b/ext/standard/tests/array/krsort_variation5.phpt
@@ -10,7 +10,7 @@ Test krsort() function : usage variations - sort strings
/*
* testing krsort() by providing array of string values for $array argument with
* following flag values:
- * 1.flag value as defualt
+ * 1.flag value as default
* 2.SORT_REGULAR - compare items normally
* 3.SORT_STRING - compare items as strings
*/
@@ -40,7 +40,7 @@ echo "\n-- Testing krsort() by supplying various string arrays --\n";
foreach ($various_arrays as $array) {
echo "\n-- Iteration $count --\n";
- echo "- With defualt sort flag -\n";
+ echo "- With default sort flag -\n";
$temp_array = $array;
var_dump(krsort($temp_array) ); // expecting : bool(true)
var_dump($temp_array);
@@ -63,7 +63,7 @@ echo "Done\n";
-- Testing krsort() by supplying various string arrays --
-- Iteration 1 --
-- With defualt sort flag -
+- With default sort flag -
bool(true)
array(11) {
["\xhh"]=>
@@ -149,7 +149,7 @@ array(11) {
}
-- Iteration 2 --
-- With defualt sort flag -
+- With default sort flag -
bool(true)
array(11) {
["x"]=>
diff --git a/ext/standard/tests/array/krsort_variation6.phpt b/ext/standard/tests/array/krsort_variation6.phpt
index 357fb5c1a0..8807653cef 100644
--- a/ext/standard/tests/array/krsort_variation6.phpt
+++ b/ext/standard/tests/array/krsort_variation6.phpt
@@ -10,7 +10,7 @@ Test krsort() function : usage variations - sort hexadecimal values
/*
* testing krsort() by providing array of hexa-decimal values for $array argument
* with following flag values:
- * 1.flag value as defualt
+ * 1.flag value as default
* 2.SORT_REGULAR - compare items normally
* 3.SORT_NUMERIC - compare items numerically
*/
@@ -23,7 +23,7 @@ $unsorted_hex_array = array (
0x1ab => 0x1ab, 0xff => 0xff, -0xff => -0xFF, 0 => 0, -0x2aa => -0x2aa
);
-echo "\n-- Testing krsort() by supplying hexadecimal value array, 'flag' value is defualt --\n";
+echo "\n-- Testing krsort() by supplying hexadecimal value array, 'flag' value is default --\n";
$temp_array = $unsorted_hex_array;
var_dump(krsort( $temp_array) ); // expecting : bool(true)
var_dump($temp_array);
@@ -43,7 +43,7 @@ echo "Done\n";
--EXPECT--
*** Testing krsort() : usage variations ***
--- Testing krsort() by supplying hexadecimal value array, 'flag' value is defualt --
+-- Testing krsort() by supplying hexadecimal value array, 'flag' value is default --
bool(true)
array(9) {
[4095]=>
diff --git a/ext/standard/tests/array/krsort_variation7.phpt b/ext/standard/tests/array/krsort_variation7.phpt
index 14a3310a65..0315e9d10f 100644
--- a/ext/standard/tests/array/krsort_variation7.phpt
+++ b/ext/standard/tests/array/krsort_variation7.phpt
@@ -10,7 +10,7 @@ Test krsort() function : usage variations - sort array with diff. sub arrays
/*
* testing krsort() by providing arrays contains sub arrays for $array argument
* with flowing flag values
- * 1.flag value as defualt
+ * 1.flag value as default
* 2.SORT_REGULAR - compare items normally
*/
@@ -40,7 +40,7 @@ echo "\n-- Testing krsort() by supplying various arrays containing sub arrays --
foreach ($various_arrays as $array) {
echo "\n-- Iteration $count --\n";
- echo "- With defualt sort flag -\n";
+ echo "- With default sort flag -\n";
$temp_array = $array;
var_dump( krsort($temp_array) );
var_dump($temp_array);
@@ -60,7 +60,7 @@ echo "Done\n";
-- Testing krsort() by supplying various arrays containing sub arrays --
-- Iteration 1 --
-- With defualt sort flag -
+- With default sort flag -
bool(true)
array(0) {
}
@@ -70,7 +70,7 @@ array(0) {
}
-- Iteration 2 --
-- With defualt sort flag -
+- With default sort flag -
bool(true)
array(1) {
[1]=>
@@ -86,7 +86,7 @@ array(1) {
}
-- Iteration 3 --
-- With defualt sort flag -
+- With default sort flag -
bool(true)
array(3) {
[4]=>
@@ -118,7 +118,7 @@ array(3) {
}
-- Iteration 4 --
-- With defualt sort flag -
+- With default sort flag -
bool(true)
array(4) {
[3]=>
diff --git a/ext/standard/tests/array/krsort_variation8.phpt b/ext/standard/tests/array/krsort_variation8.phpt
index 67a402a8df..7f9aa17bf3 100644
--- a/ext/standard/tests/array/krsort_variation8.phpt
+++ b/ext/standard/tests/array/krsort_variation8.phpt
Binary files differ
diff --git a/ext/standard/tests/array/krsort_variation9.phpt b/ext/standard/tests/array/krsort_variation9.phpt
index 5317228931..d961ff1837 100644
--- a/ext/standard/tests/array/krsort_variation9.phpt
+++ b/ext/standard/tests/array/krsort_variation9.phpt
@@ -10,7 +10,7 @@ Test krsort() function : usage variations - sort array with/without key values
/*
* Testing krsort() by providing arrays with/without key values for $array argument
* with following flag values:
- * 1.flag value as defualt
+ * 1.flag value as default
* 2.SORT_REGULAR - compare items normally
*/
@@ -34,7 +34,7 @@ echo "\n-- Testing krsort() by supplying various arrays with/without key values
foreach ($various_arrays as $array) {
echo "\n-- Iteration $count --\n";
- echo "- With defualt sort flag -\n";
+ echo "- With default sort flag -\n";
$temp_array = $array;
var_dump( krsort($temp_array) );
var_dump($temp_array);
@@ -54,7 +54,7 @@ echo "Done\n";
-- Testing krsort() by supplying various arrays with/without key values --
-- Iteration 1 --
-- With defualt sort flag -
+- With default sort flag -
bool(true)
array(5) {
[9]=>
@@ -84,7 +84,7 @@ array(5) {
}
-- Iteration 2 --
-- With defualt sort flag -
+- With default sort flag -
bool(true)
array(3) {
["a"]=>
@@ -106,7 +106,7 @@ array(3) {
}
-- Iteration 3 --
-- With defualt sort flag -
+- With default sort flag -
bool(true)
array(6) {
[5]=>
@@ -140,7 +140,7 @@ array(6) {
}
-- Iteration 4 --
-- With defualt sort flag -
+- With default sort flag -
bool(true)
array(3) {
[5]=>
@@ -162,7 +162,7 @@ array(3) {
}
-- Iteration 5 --
-- With defualt sort flag -
+- With default sort flag -
bool(true)
array(6) {
[9]=>
@@ -196,7 +196,7 @@ array(6) {
}
-- Iteration 6 --
-- With defualt sort flag -
+- With default sort flag -
bool(true)
array(2) {
["foo"]=>
@@ -214,7 +214,7 @@ array(2) {
}
-- Iteration 7 --
-- With defualt sort flag -
+- With default sort flag -
bool(true)
array(4) {
["d"]=>
diff --git a/ext/standard/tests/array/ksort_basic.phpt b/ext/standard/tests/array/ksort_basic.phpt
index ff0469e7a3..1a62f3ac2c 100644
--- a/ext/standard/tests/array/ksort_basic.phpt
+++ b/ext/standard/tests/array/ksort_basic.phpt
@@ -9,7 +9,7 @@ Test ksort() function : basic functionality
/*
* Testing ksort() by providing array of integer/string values to check the basic functionality with following flag values :
- * 1.flag value as defualt
+ * 1.flag value as default
* 2.SORT_REGULAR - compare items normally
* 3.SORT_NUMERIC - compare items numerically
* 4.SORT_STRING - compare items as strings
@@ -19,19 +19,19 @@ echo "*** Testing ksort() : basic functionality ***\n";
// an array containing unsorted string values with indices
$unsorted_strings = array(
- "l" => "lemon", "o" => "orange",
- "O" => "Orange", "O1" => "Orange1", "o2" => "orange2", "O3" => "Orange3", "o20" => "orange20",
- "b" => "banana",
+ "l" => "lemon", "o" => "orange",
+ "O" => "Orange", "O1" => "Orange1", "o2" => "orange2", "O3" => "Orange3", "o20" => "orange20",
+ "b" => "banana",
);
// an array containing unsorted numeric values with indices
$unsorted_numerics = array( 100 => 4, 33 => 3, 555 => 2, 22 => 1 );
-echo "\n-- Testing ksort() by supplying string array, 'flag' value is defualt --\n";
+echo "\n-- Testing ksort() by supplying string array, 'flag' value is default --\n";
$temp_array = $unsorted_strings;
var_dump( ksort($temp_array) ); // expecting : bool(true)
var_dump( $temp_array);
-echo "\n-- Testing ksort() by supplying numeric array, 'flag' value is defualt --\n";
+echo "\n-- Testing ksort() by supplying numeric array, 'flag' value is default --\n";
$temp_array = $unsorted_numerics;
var_dump( ksort($temp_array) ); // expecting : bool(true)
var_dump( $temp_array);
@@ -76,7 +76,7 @@ echo "Done\n";
--EXPECT--
*** Testing ksort() : basic functionality ***
--- Testing ksort() by supplying string array, 'flag' value is defualt --
+-- Testing ksort() by supplying string array, 'flag' value is default --
bool(true)
array(8) {
["O"]=>
@@ -97,7 +97,7 @@ array(8) {
string(8) "orange20"
}
--- Testing ksort() by supplying numeric array, 'flag' value is defualt --
+-- Testing ksort() by supplying numeric array, 'flag' value is default --
bool(true)
array(4) {
[22]=>
diff --git a/ext/standard/tests/array/ksort_object.phpt b/ext/standard/tests/array/ksort_object.phpt
index e193032788..03c97e253b 100644
--- a/ext/standard/tests/array/ksort_object.phpt
+++ b/ext/standard/tests/array/ksort_object.phpt
@@ -55,14 +55,14 @@ $unsorted_str_obj = array (
"apple" => new StringObject("apple"), "Orange" => new StringObject("Orange"),
"Lemon" => new StringObject("Lemon"), "aPPle" => new StringObject("aPPle")
);
-echo "\n-- Testing ksort() by supplying various object arrays, 'flag' value is defualt --\n";
+echo "\n-- Testing ksort() by supplying various object arrays, 'flag' value is default --\n";
-// testing ksort() function by supplying integer object array, flag value is defualt
+// testing ksort() function by supplying integer object array, flag value is default
$temp_array = $unsorted_int_obj;
var_dump(ksort($temp_array) );
var_dump($temp_array);
-// testing ksort() function by supplying string object array, flag value is defualt
+// testing ksort() function by supplying string object array, flag value is default
$temp_array = $unsorted_str_obj;
var_dump(ksort($temp_array) );
var_dump($temp_array);
@@ -83,7 +83,7 @@ echo "Done\n";
--EXPECTF--
*** Testing ksort() : object functionality ***
--- Testing ksort() by supplying various object arrays, 'flag' value is defualt --
+-- Testing ksort() by supplying various object arrays, 'flag' value is default --
bool(true)
array(6) {
[-5]=>
diff --git a/ext/standard/tests/array/ksort_variation10.phpt b/ext/standard/tests/array/ksort_variation10.phpt
index 1a1a719b53..8a3e522c8a 100644
--- a/ext/standard/tests/array/ksort_variation10.phpt
+++ b/ext/standard/tests/array/ksort_variation10.phpt
@@ -9,7 +9,7 @@ Test ksort() function : usage variations - sort octal values
/*
* testing ksort() by providing array of octal values for $array argument with following flag values:
- * 1.flag value as defualt
+ * 1.flag value as default
* 2.SORT_REGULAR - compare items normally
* 3.SORT_NUMERIC - compare items numerically
*/
@@ -22,7 +22,7 @@ $unsorted_oct_array = array (
077 => 06, -066 => -01, -0345 => -02, 0 => 0
);
-echo "\n-- Testing ksort() by supplying octal value array, 'flag' value is defualt --\n";
+echo "\n-- Testing ksort() by supplying octal value array, 'flag' value is default --\n";
$temp_array = $unsorted_oct_array;
var_dump( ksort($temp_array) ); // expecting : bool(true)
var_dump($temp_array);
@@ -42,7 +42,7 @@ echo "Done\n";
--EXPECT--
*** Testing ksort() : usage variations ***
--- Testing ksort() by supplying octal value array, 'flag' value is defualt --
+-- Testing ksort() by supplying octal value array, 'flag' value is default --
bool(true)
array(9) {
[-229]=>
diff --git a/ext/standard/tests/array/ksort_variation11.phpt b/ext/standard/tests/array/ksort_variation11.phpt
index 2c93512fea..1fabd01e5c 100644
--- a/ext/standard/tests/array/ksort_variation11.phpt
+++ b/ext/standard/tests/array/ksort_variation11.phpt
@@ -10,7 +10,7 @@ Test ksort() function : usage variations - sort heredoc strings
/*
* testing ksort() by providing array of heredoc strings for $array argument with
* following flag values:
- * 1.flag value as defualt
+ * 1.flag value as default
* 2.SORT_REGULAR - compare items normally
* 3.SORT_STRING - compare items as strings
*/
@@ -37,7 +37,7 @@ $array = array (
$multiline_heredoc => "heredoc string\twith!@# and 123\nTest this!!!"
);
-echo "\n-- Testing ksort() by supplying heredoc string array, 'flag' value is defualt --\n";
+echo "\n-- Testing ksort() by supplying heredoc string array, 'flag' value is default --\n";
$temp_array = $array;
var_dump(ksort($temp_array) ); // expecting : bool(true)
var_dump($temp_array);
@@ -57,7 +57,7 @@ echo "Done\n";
--EXPECT--
*** Testing ksort() : usage variations ***
--- Testing ksort() by supplying heredoc string array, 'flag' value is defualt --
+-- Testing ksort() by supplying heredoc string array, 'flag' value is default --
bool(true)
array(3) {
["HEREDOC"]=>
diff --git a/ext/standard/tests/array/ksort_variation3.phpt b/ext/standard/tests/array/ksort_variation3.phpt
index 3159a36be5..5d2d14ff58 100644
--- a/ext/standard/tests/array/ksort_variation3.phpt
+++ b/ext/standard/tests/array/ksort_variation3.phpt
@@ -10,7 +10,7 @@ Test ksort() function : usage variations - sort integer/float values
/*
* Testing ksort() by providing array of integer/float/mixed values for $array argument
* with following flag values:
- * 1. flag value as defualt
+ * 1. flag value as default
* 2. SORT_REGULAR - compare items normally
* 3. SORT_NUMERIC - compare items numerically
*/
@@ -40,7 +40,7 @@ echo "\n-- Testing ksort() by supplying various integer/float arrays --\n";
foreach ($various_arrays as $array) {
echo "\n-- Iteration $count --\n";
- echo "- With defualt sort flag -\n";
+ echo "- With default sort flag -\n";
$temp_array = $array;
var_dump(ksort($temp_array) );
var_dump($temp_array);
@@ -63,7 +63,7 @@ echo "Done\n";
-- Testing ksort() by supplying various integer/float arrays --
-- Iteration 1 --
-- With defualt sort flag -
+- With default sort flag -
bool(true)
array(9) {
[-10]=>
@@ -131,7 +131,7 @@ array(9) {
}
-- Iteration 2 --
-- With defualt sort flag -
+- With default sort flag -
bool(true)
array(6) {
[-7]=>
@@ -181,7 +181,7 @@ array(6) {
}
-- Iteration 3 --
-- With defualt sort flag -
+- With default sort flag -
bool(true)
array(11) {
[-10]=>
diff --git a/ext/standard/tests/array/ksort_variation4.phpt b/ext/standard/tests/array/ksort_variation4.phpt
index 46e330229e..8404f030e9 100644
--- a/ext/standard/tests/array/ksort_variation4.phpt
+++ b/ext/standard/tests/array/ksort_variation4.phpt
@@ -9,7 +9,7 @@ Test ksort() function : usage variations - sort bool values
/*
* testing ksort() by providing array of boolean values for $array argument with following flag values:
- * 1.flag value as defualt
+ * 1.flag value as default
* 2.SORT_REGULAR - compare items normally
*/
@@ -18,7 +18,7 @@ echo "*** Testing ksort() : usage variations ***\n";
// bool value array
$bool_values = array (true => true, false => false, TRUE => TRUE, FALSE => FALSE);
-echo "\n-- Testing ksort() by supplying boolean value array, 'flag' value is defualt --\n";
+echo "\n-- Testing ksort() by supplying boolean value array, 'flag' value is default --\n";
$temp_array = $bool_values;
var_dump(ksort($temp_array) );
var_dump($temp_array);
@@ -43,7 +43,7 @@ echo "Done\n";
--EXPECT--
*** Testing ksort() : usage variations ***
--- Testing ksort() by supplying boolean value array, 'flag' value is defualt --
+-- Testing ksort() by supplying boolean value array, 'flag' value is default --
bool(true)
array(2) {
[0]=>
diff --git a/ext/standard/tests/array/ksort_variation5.phpt b/ext/standard/tests/array/ksort_variation5.phpt
index c19cb3cf8a..c5f950edd4 100644
--- a/ext/standard/tests/array/ksort_variation5.phpt
+++ b/ext/standard/tests/array/ksort_variation5.phpt
@@ -10,7 +10,7 @@ Test ksort() function : usage variations - sort strings
/*
* testing ksort() by providing array of string values for $array argument with
* following flag values:
- * 1.flag value as defualt
+ * 1.flag value as default
* 2.SORT_REGULAR - compare items normally
* 3.SORT_STRING - compare items as strings
*/
@@ -40,7 +40,7 @@ echo "\n-- Testing ksort() by supplying various string arrays --\n";
foreach ($various_arrays as $array) {
echo "\n-- Iteration $count --\n";
- echo "- With defualt sort flag -\n";
+ echo "- With default sort flag -\n";
$temp_array = $array;
var_dump(ksort($temp_array) ); // expecting : bool(true)
var_dump($temp_array);
@@ -63,7 +63,7 @@ echo "Done\n";
-- Testing ksort() by supplying various string arrays --
-- Iteration 1 --
-- With defualt sort flag -
+- With default sort flag -
bool(true)
array(11) {
[""]=>
@@ -149,7 +149,7 @@ array(11) {
}
-- Iteration 2 --
-- With defualt sort flag -
+- With default sort flag -
bool(true)
array(11) {
["Apple"]=>
diff --git a/ext/standard/tests/array/ksort_variation6.phpt b/ext/standard/tests/array/ksort_variation6.phpt
index 0e6d8fe372..40cd27d7b8 100644
--- a/ext/standard/tests/array/ksort_variation6.phpt
+++ b/ext/standard/tests/array/ksort_variation6.phpt
@@ -9,7 +9,7 @@ Test ksort() function : usage variations - sort hexadecimal values
/*
* testing ksort() by providing array of hexa-decimal values for $array argument with following flag values:
- * 1.flag value as defualt
+ * 1.flag value as default
* 2.SORT_REGULAR - compare items normally
* 3.SORT_NUMERIC - compare items numerically
*/
@@ -23,7 +23,7 @@ $unsorted_hex_array = array (
0x1ab => 0x1ab, 0xff => 0xff, -0xff => -0xFF, 0 => 0, -0x2aa => -0x2aa
);
-echo "\n-- Testing ksort() by supplying hexadecimal value array, 'flag' value is defualt --\n";
+echo "\n-- Testing ksort() by supplying hexadecimal value array, 'flag' value is default --\n";
$temp_array = $unsorted_hex_array;
var_dump(ksort( $temp_array) ); // expecting : bool(true)
var_dump($temp_array);
@@ -43,7 +43,7 @@ echo "Done\n";
--EXPECT--
*** Testing ksort() : usage variations ***
--- Testing ksort() by supplying hexadecimal value array, 'flag' value is defualt --
+-- Testing ksort() by supplying hexadecimal value array, 'flag' value is default --
bool(true)
array(9) {
[-682]=>
diff --git a/ext/standard/tests/array/ksort_variation7.phpt b/ext/standard/tests/array/ksort_variation7.phpt
index 4b1f509c3c..0e92ed40ef 100644
--- a/ext/standard/tests/array/ksort_variation7.phpt
+++ b/ext/standard/tests/array/ksort_variation7.phpt
@@ -10,7 +10,7 @@ Test ksort() function : usage variations - sort array with diff. sub arrays
/*
* testing ksort() by providing arrays containing sub arrays for $array argument
* with flowing flag values:
- * 1. flag value as defualt
+ * 1. flag value as default
* 2. SORT_REGULAR - compare items normally
*/
@@ -40,7 +40,7 @@ echo "\n-- Testing ksort() by supplying various arrays containing sub arrays --\
foreach ($various_arrays as $array) {
echo "\n-- Iteration $count --\n";
- echo "- With defualt sort flag -\n";
+ echo "- With default sort flag -\n";
$temp_array = $array;
var_dump( ksort($temp_array) );
var_dump($temp_array);
@@ -60,7 +60,7 @@ echo "Done\n";
-- Testing ksort() by supplying various arrays containing sub arrays --
-- Iteration 1 --
-- With defualt sort flag -
+- With default sort flag -
bool(true)
array(0) {
}
@@ -70,7 +70,7 @@ array(0) {
}
-- Iteration 2 --
-- With defualt sort flag -
+- With default sort flag -
bool(true)
array(1) {
[1]=>
@@ -86,7 +86,7 @@ array(1) {
}
-- Iteration 3 --
-- With defualt sort flag -
+- With default sort flag -
bool(true)
array(3) {
[1]=>
@@ -118,7 +118,7 @@ array(3) {
}
-- Iteration 4 --
-- With defualt sort flag -
+- With default sort flag -
bool(true)
array(4) {
[0]=>
diff --git a/ext/standard/tests/array/ksort_variation8.phpt b/ext/standard/tests/array/ksort_variation8.phpt
index bedbeeed7c..9222e64e19 100644
--- a/ext/standard/tests/array/ksort_variation8.phpt
+++ b/ext/standard/tests/array/ksort_variation8.phpt
Binary files differ
diff --git a/ext/standard/tests/array/ksort_variation9.phpt b/ext/standard/tests/array/ksort_variation9.phpt
index be58e6d589..20a85f2f77 100644
--- a/ext/standard/tests/array/ksort_variation9.phpt
+++ b/ext/standard/tests/array/ksort_variation9.phpt
@@ -9,7 +9,7 @@ Test ksort() function : usage variations - sorting arrays with/without keys
/*
* Testing ksort() by providing arrays with/without key values for $array argument with following flag values:
- * 1.flag value as defualt
+ * 1.flag value as default
* 2.SORT_REGULAR - compare items normally
*/
@@ -33,7 +33,7 @@ echo "\n-- Testing ksort() by supplying various arrays with/without key values -
foreach ($various_arrays as $array) {
echo "\n-- Iteration $count --\n";
- echo "- With defualt sort flag -\n";
+ echo "- With default sort flag -\n";
$temp_array = $array;
var_dump( ksort($temp_array) );
var_dump($temp_array);
@@ -53,7 +53,7 @@ echo "Done\n";
-- Testing ksort() by supplying various arrays with/without key values --
-- Iteration 1 --
-- With defualt sort flag -
+- With default sort flag -
bool(true)
array(5) {
[5]=>
@@ -83,7 +83,7 @@ array(5) {
}
-- Iteration 2 --
-- With defualt sort flag -
+- With default sort flag -
bool(true)
array(3) {
["a"]=>
@@ -105,7 +105,7 @@ array(3) {
}
-- Iteration 3 --
-- With defualt sort flag -
+- With default sort flag -
bool(true)
array(6) {
[0]=>
@@ -139,7 +139,7 @@ array(6) {
}
-- Iteration 4 --
-- With defualt sort flag -
+- With default sort flag -
bool(true)
array(3) {
[0]=>
@@ -161,7 +161,7 @@ array(3) {
}
-- Iteration 5 --
-- With defualt sort flag -
+- With default sort flag -
bool(true)
array(6) {
[0]=>
@@ -195,7 +195,7 @@ array(6) {
}
-- Iteration 6 --
-- With defualt sort flag -
+- With default sort flag -
bool(true)
array(2) {
["bar"]=>
@@ -213,7 +213,7 @@ array(2) {
}
-- Iteration 7 --
-- With defualt sort flag -
+- With default sort flag -
bool(true)
array(4) {
["a"]=>
diff --git a/ext/standard/tests/array/max.phpt b/ext/standard/tests/array/max.phpt
index ae4f304eae..dacd470ada 100644
--- a/ext/standard/tests/array/max.phpt
+++ b/ext/standard/tests/array/max.phpt
@@ -5,10 +5,24 @@ precision=14
--FILE--
<?php
-var_dump(max());
-var_dump(max(1));
-var_dump(max(array()));
-var_dump(max(new stdclass));
+try {
+ var_dump(max(1));
+} catch (\TypeError $e) {
+ echo $e->getMessage() . "\n";
+}
+
+try {
+ var_dump(max(array()));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+}
+
+try {
+ var_dump(max(new stdclass));
+} catch (\TypeError $e) {
+ echo $e->getMessage() . "\n";
+}
+
var_dump(max(2,1,2));
var_dump(max(2.1,2.11,2.09));
var_dump(max("", "t", "b"));
@@ -17,20 +31,11 @@ var_dump(max(true, false, true));
var_dump(max(1, true, false, true));
var_dump(max(0, true, false, true));
-echo "Done\n";
?>
---EXPECTF--
-Warning: max() expects at least 1 parameter, 0 given in %s on line 3
-NULL
-
-Warning: max(): When only one parameter is given, it must be an array in %s on line 4
-NULL
-
-Warning: max(): Array must contain at least one element in %s on line 5
-bool(false)
-
-Warning: max(): When only one parameter is given, it must be an array in %s on line 6
-NULL
+--EXPECT--
+When only one parameter is given, it must be an array
+Array must contain at least one element
+When only one parameter is given, it must be an array
int(2)
float(2.11)
string(1) "t"
@@ -38,4 +43,3 @@ bool(true)
bool(true)
int(1)
bool(true)
-Done
diff --git a/ext/standard/tests/array/max_basiclong_64bit.phpt b/ext/standard/tests/array/max_basiclong_64bit.phpt
index 95116b16c2..6d40be0388 100644
--- a/ext/standard/tests/array/max_basiclong_64bit.phpt
+++ b/ext/standard/tests/array/max_basiclong_64bit.phpt
@@ -28,8 +28,6 @@ $longVals = array(
var_dump(max($longVals));
?>
-===DONE===
--EXPECT--
int(9223372036854775807)
int(9223372036854775807)
-===DONE===
diff --git a/ext/standard/tests/array/min.phpt b/ext/standard/tests/array/min.phpt
index cb8c7cfdca..144cd815a8 100644
--- a/ext/standard/tests/array/min.phpt
+++ b/ext/standard/tests/array/min.phpt
@@ -5,10 +5,24 @@ precision=14
--FILE--
<?php
-var_dump(min());
-var_dump(min(1));
-var_dump(min(array()));
-var_dump(min(new stdclass));
+try {
+ var_dump(min(1));
+} catch (\TypeError $e) {
+ echo $e->getMessage() . "\n";
+}
+
+try {
+ var_dump(min(array()));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+}
+
+try {
+ var_dump(min(new stdclass));
+} catch (\TypeError $e) {
+ echo $e->getMessage() . "\n";
+}
+
var_dump(min(2,1,2));
var_dump(min(2.1,2.11,2.09));
var_dump(min("", "t", "b"));
@@ -17,20 +31,11 @@ var_dump(min(true, false, true));
var_dump(min(1, true, false, true));
var_dump(min(0, true, false, true));
-echo "Done\n";
?>
---EXPECTF--
-Warning: min() expects at least 1 parameter, 0 given in %s on line 3
-NULL
-
-Warning: min(): When only one parameter is given, it must be an array in %s on line 4
-NULL
-
-Warning: min(): Array must contain at least one element in %s on line 5
-bool(false)
-
-Warning: min(): When only one parameter is given, it must be an array in %s on line 6
-NULL
+--EXPECT--
+When only one parameter is given, it must be an array
+Array must contain at least one element
+When only one parameter is given, it must be an array
int(1)
float(2.09)
string(0) ""
@@ -38,4 +43,3 @@ bool(false)
bool(false)
bool(false)
int(0)
-Done
diff --git a/ext/standard/tests/array/min_basiclong_64bit.phpt b/ext/standard/tests/array/min_basiclong_64bit.phpt
index 526d77a27a..50e5dda125 100644
--- a/ext/standard/tests/array/min_basiclong_64bit.phpt
+++ b/ext/standard/tests/array/min_basiclong_64bit.phpt
@@ -28,8 +28,6 @@ $longVals = array(
var_dump(min($longVals));
?>
-===DONE===
--EXPECT--
int(-9223372036854775808)
int(-9223372036854775808)
-===DONE===
diff --git a/ext/standard/tests/array/natcasesort_object2.phpt b/ext/standard/tests/array/natcasesort_object2.phpt
index 3eef437588..b82d0a0b7a 100644
--- a/ext/standard/tests/array/natcasesort_object2.phpt
+++ b/ext/standard/tests/array/natcasesort_object2.phpt
@@ -17,20 +17,20 @@ echo "*** Testing natcasesort() : object functionality ***\n";
// class declaration for string objects
class for_string_natcasesort
{
- public $public_class_value;
- private $private_class_value;
- protected $protected_class_value;
- // initializing object member value
- function __construct($value1, $value2,$value3){
- $this->public_class_value = $value1;
- $this->private_class_value = $value2;
- $this->protected_class_value = $value3;
- }
+ public $public_class_value;
+ private $private_class_value;
+ protected $protected_class_value;
+ // initializing object member value
+ function __construct($value1, $value2,$value3){
+ $this->public_class_value = $value1;
+ $this->private_class_value = $value2;
+ $this->protected_class_value = $value3;
+ }
- // return string value
- function __tostring() {
- return (string)$this->public_class_value;
- }
+ // return string value
+ function __tostring() {
+ return (string)$this->public_class_value;
+ }
}
diff --git a/ext/standard/tests/array/natcasesort_variation11.phpt b/ext/standard/tests/array/natcasesort_variation11.phpt
index 365600edd7..27e41865f1 100644
--- a/ext/standard/tests/array/natcasesort_variation11.phpt
+++ b/ext/standard/tests/array/natcasesort_variation11.phpt
@@ -103,10 +103,10 @@ $inputs = array(
// loop through each element of $inputs to check the behavior of natcasesort()
$iterator = 1;
foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump( natcasesort($input) );
- var_dump($input);
- $iterator++;
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( natcasesort($input) );
+ var_dump($input);
+ $iterator++;
};
echo "Done";
diff --git a/ext/standard/tests/array/natcasesort_variation2.phpt b/ext/standard/tests/array/natcasesort_variation2.phpt
index ce34db1246..c9dbec1e1f 100644
--- a/ext/standard/tests/array/natcasesort_variation2.phpt
+++ b/ext/standard/tests/array/natcasesort_variation2.phpt
@@ -39,7 +39,7 @@ $inputs = array(
// int data
/*1*/ 'int' => array(
- 0,
+ 0,
1,
12345,
-2345,
@@ -107,10 +107,10 @@ $inputs = array(
// loop through each element of $inputs to check the behavior of natcasesort()
$iterator = 1;
foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump( natcasesort($input) );
- var_dump($input);
- $iterator++;
+ echo "\n-- Iteration $iterator --\n";
+ var_dump( natcasesort($input) );
+ var_dump($input);
+ $iterator++;
};
fclose($fp);
diff --git a/ext/standard/tests/array/natcasesort_variation3.phpt b/ext/standard/tests/array/natcasesort_variation3.phpt
index c3400f4d65..b2523dc426 100644
--- a/ext/standard/tests/array/natcasesort_variation3.phpt
+++ b/ext/standard/tests/array/natcasesort_variation3.phpt
@@ -34,9 +34,9 @@ $inputs = array (
$iterator = 1;
foreach ($inputs as $array_arg) {
- echo "\n-- Iteration $iterator --\n";
- var_dump(natcasesort($array_arg));
- var_dump($array_arg);
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(natcasesort($array_arg));
+ var_dump($array_arg);
}
echo "Done";
diff --git a/ext/standard/tests/array/natcasesort_variation4.phpt b/ext/standard/tests/array/natcasesort_variation4.phpt
index b8d4d2c220..452e2e48b2 100644
--- a/ext/standard/tests/array/natcasesort_variation4.phpt
+++ b/ext/standard/tests/array/natcasesort_variation4.phpt
@@ -14,16 +14,16 @@ Test natcasesort() function : usage variations - different string types
echo "*** Testing natcasesort() : usage variation ***\n";
$inputs = array (
- // group of escape sequences
- array(null, NULL, "\a", "\cx", "\e", "\f", "\n", "\t", "\xhh", "\ddd", "\v"),
+ // group of escape sequences
+ array(null, NULL, "\a", "\cx", "\e", "\f", "\n", "\t", "\xhh", "\ddd", "\v"),
- // array contains combination of capital/small letters
- array("lemoN", "Orange", "banana", "apple", "Test", "TTTT", "ttt", "ww", "x", "X", "oraNGe", "BANANA")
+ // array contains combination of capital/small letters
+ array("lemoN", "Orange", "banana", "apple", "Test", "TTTT", "ttt", "ww", "x", "X", "oraNGe", "BANANA")
);
foreach ($inputs as $array_arg) {
- var_dump( natcasesort($array_arg) );
- var_dump($array_arg);
+ var_dump( natcasesort($array_arg) );
+ var_dump($array_arg);
}
echo "Done";
diff --git a/ext/standard/tests/array/natcasesort_variation6.phpt b/ext/standard/tests/array/natcasesort_variation6.phpt
index bbbefa799e..85d4cd64e5 100644
--- a/ext/standard/tests/array/natcasesort_variation6.phpt
+++ b/ext/standard/tests/array/natcasesort_variation6.phpt
@@ -8,7 +8,7 @@ Test natcasesort() function : usage variations - referenced variables
*/
/*
- * Pass an array of referenced varaibles to test how natcasesort() re-orders it
+ * Pass an array of referenced variables to test how natcasesort() re-orders it
*/
echo "*** Testing natcasesort() : usage variation ***\n";
diff --git a/ext/standard/tests/array/natcasesort_variation7.phpt b/ext/standard/tests/array/natcasesort_variation7.phpt
index 713f7c959c..fb731b101c 100644
--- a/ext/standard/tests/array/natcasesort_variation7.phpt
+++ b/ext/standard/tests/array/natcasesort_variation7.phpt
@@ -34,18 +34,7 @@ array(5) {
[3]=>
string(1) "2"
[4]=>
- &array(5) {
- [0]=>
- int(1)
- [1]=>
- float(3)
- [2]=>
- string(4) "zero"
- [3]=>
- string(1) "2"
- [4]=>
- *RECURSION*
- }
+ *RECURSION*
}
bool(true)
array(5) {
@@ -56,18 +45,7 @@ array(5) {
[1]=>
float(3)
[4]=>
- &array(5) {
- [0]=>
- int(1)
- [3]=>
- string(1) "2"
- [1]=>
- float(3)
- [4]=>
- *RECURSION*
- [2]=>
- string(4) "zero"
- }
+ *RECURSION*
[2]=>
string(4) "zero"
}
diff --git a/ext/standard/tests/array/negative_index.phpt b/ext/standard/tests/array/negative_index.phpt
new file mode 100644
index 0000000000..a9f442acbd
--- /dev/null
+++ b/ext/standard/tests/array/negative_index.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test arrays starting with negative indices
+--FILE--
+<?php
+
+$a = array_fill(-2, 3, true);
+$b = [-2 => true, true, true];
+$c = ["string" => true, -2 => true, true, true];
+unset($c["string"]);
+$d[-2] = true;
+$d[] = true;
+$d[] = true;
+$e = [-2 => false];
+array_pop($e);
+$e[] = true;
+$e[] = true;
+$e[] = true;
+
+var_dump($a === $b && $b === $c && $c === $d && $d == $e);
+var_dump($a);
+?>
+--EXPECT--
+bool(true)
+array(3) {
+ [-2]=>
+ bool(true)
+ [-1]=>
+ bool(true)
+ [0]=>
+ bool(true)
+}
diff --git a/ext/standard/tests/array/next_basic.phpt b/ext/standard/tests/array/next_basic.phpt
index 2813f7c514..092eec555a 100644
--- a/ext/standard/tests/array/next_basic.phpt
+++ b/ext/standard/tests/array/next_basic.phpt
@@ -23,7 +23,6 @@ var_dump(next($array));
echo key($array) . " => " . current($array) . "\n";
var_dump(next($array));
?>
-===DONE===
--EXPECT--
*** Testing next() : basic functionality ***
0 => zero
@@ -32,4 +31,3 @@ string(3) "one"
string(3) "two"
2 => two
bool(false)
-===DONE===
diff --git a/ext/standard/tests/array/next_variation2.phpt b/ext/standard/tests/array/next_variation2.phpt
index aff03a619a..892e120b5e 100644
--- a/ext/standard/tests/array/next_variation2.phpt
+++ b/ext/standard/tests/array/next_variation2.phpt
@@ -25,7 +25,6 @@ var_dump(next($array_arg));
echo "\n-- Pass a sub-array as \$array_arg --\n";
var_dump(next($array_arg[0]));
?>
-===DONE===
--EXPECT--
*** Testing next() : usage variations ***
@@ -42,4 +41,3 @@ bool(false)
-- Pass a sub-array as $array_arg --
int(8)
-===DONE===
diff --git a/ext/standard/tests/array/prev_basic.phpt b/ext/standard/tests/array/prev_basic.phpt
index 8e1703259e..92d1536c87 100644
--- a/ext/standard/tests/array/prev_basic.phpt
+++ b/ext/standard/tests/array/prev_basic.phpt
@@ -33,7 +33,6 @@ for ($i = $length; $i > 0; $i--) {
}
?>
-===DONE===
--EXPECT--
*** Testing prev() : basic functionality ***
2 => two
@@ -50,4 +49,3 @@ int(3)
string(4) "help"
string(3) "one"
bool(false)
-===DONE===
diff --git a/ext/standard/tests/array/prev_error2.phpt b/ext/standard/tests/array/prev_error2.phpt
index 37049cf854..45d2930ad7 100644
--- a/ext/standard/tests/array/prev_error2.phpt
+++ b/ext/standard/tests/array/prev_error2.phpt
@@ -12,8 +12,8 @@ prev - ensure warning is received when passing an indirect temporary.
*/
function f() {
- $array = array(1,2);
- end($array);
+ $array = array(1,2);
+ end($array);
return $array;
}
diff --git a/ext/standard/tests/array/prev_error3.phpt b/ext/standard/tests/array/prev_error3.phpt
index 6f0beaf115..44c7b1e8ad 100644
--- a/ext/standard/tests/array/prev_error3.phpt
+++ b/ext/standard/tests/array/prev_error3.phpt
@@ -15,4 +15,7 @@ prev - ensure we cannot pass a temporary
var_dump(prev(array(1, 2)));
?>
--EXPECTF--
-Fatal error: Only variables can be passed by reference in %s on line %d
+Fatal error: Uncaught Error: Cannot pass parameter 1 by reference in %s:%d
+Stack trace:
+#0 {main}
+ thrown in %s on line %d
diff --git a/ext/standard/tests/array/prev_variation2.phpt b/ext/standard/tests/array/prev_variation2.phpt
index e4c707124c..9c38e6ef37 100644
--- a/ext/standard/tests/array/prev_variation2.phpt
+++ b/ext/standard/tests/array/prev_variation2.phpt
@@ -29,7 +29,6 @@ var_dump(prev($array_arg));
echo "\n-- Pass a sub-array as \$array_arg --\n";
var_dump(prev($array_arg[0]));
?>
-===DONE===
--EXPECT--
*** Testing prev() : usage variations ***
@@ -46,4 +45,3 @@ bool(false)
-- Pass a sub-array as $array_arg --
int(8)
-===DONE===
diff --git a/ext/standard/tests/array/range_bug70239_0.phpt b/ext/standard/tests/array/range_bug70239_0.phpt
index edfdd05fbc..c5e56462c5 100644
--- a/ext/standard/tests/array/range_bug70239_0.phpt
+++ b/ext/standard/tests/array/range_bug70239_0.phpt
@@ -2,9 +2,11 @@
Bug #70239 Creating a huge array doesn't result in exhausted, but segfault, var 1
--FILE--
<?php
-range(0, pow(2.0, 100000000));
+try {
+ range(0, pow(2.0, 100000000));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+}
?>
-===DONE===
---EXPECTF--
-Warning: range(): Invalid range supplied: start=0 end=inf in %srange_bug70239_0.php on line %d
-===DONE===
+--EXPECT--
+Invalid range supplied: start=0 end=inf
diff --git a/ext/standard/tests/array/range_bug70239_1.phpt b/ext/standard/tests/array/range_bug70239_1.phpt
index 75419cf829..cfaa1a51fc 100644
--- a/ext/standard/tests/array/range_bug70239_1.phpt
+++ b/ext/standard/tests/array/range_bug70239_1.phpt
@@ -2,9 +2,11 @@
Bug #70239 Creating a huge array doesn't result in exhausted, but segfault, var 2
--FILE--
<?php
-range(pow(2.0, 100000000), pow(2.0, 100000000) + 1);
+try {
+ range(pow(2.0, 100000000), pow(2.0, 100000000) + 1);
+} catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+}
?>
-===DONE===
---EXPECTF--
-Warning: range(): Invalid range supplied: start=inf end=inf in %srange_bug70239_1.php on line %d
-===DONE===
+--EXPECT--
+Invalid range supplied: start=inf end=inf
diff --git a/ext/standard/tests/array/range_bug70239_2.phpt b/ext/standard/tests/array/range_bug70239_2.phpt
index 76ed638669..1ccf8d0373 100644
--- a/ext/standard/tests/array/range_bug70239_2.phpt
+++ b/ext/standard/tests/array/range_bug70239_2.phpt
@@ -2,10 +2,11 @@
Bug #70239 Creating a huge array doesn't result in exhausted, but segfault, var 3
--FILE--
<?php
-var_dump(range(0, PHP_INT_MAX));
+try {
+ var_dump(range(0, PHP_INT_MAX));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+}
?>
-===DONE===
--EXPECTF--
-Warning: range(): The supplied range exceeds the maximum array size: start=0 end=%d in %srange_bug70239_2.php on line %d
-bool(false)
-===DONE===
+The supplied range exceeds the maximum array size: start=0 end=%d
diff --git a/ext/standard/tests/array/range_bug70239_3.phpt b/ext/standard/tests/array/range_bug70239_3.phpt
index 8402870c82..5d50db4f4a 100644
--- a/ext/standard/tests/array/range_bug70239_3.phpt
+++ b/ext/standard/tests/array/range_bug70239_3.phpt
@@ -2,10 +2,11 @@
Bug #70239 Creating a huge array doesn't result in exhausted, but segfault, var 4
--FILE--
<?php
-var_dump(range(PHP_INT_MIN, 0));
+try {
+ var_dump(range(PHP_INT_MIN, 0));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+}
?>
-===DONE===
--EXPECTF--
-Warning: range(): The supplied range exceeds the maximum array size: start=-%d end=0 in %srange_bug70239_3.php on line %d
-bool(false)
-===DONE===
+The supplied range exceeds the maximum array size: start=-%d end=0
diff --git a/ext/standard/tests/array/range_errors.phpt b/ext/standard/tests/array/range_errors.phpt
index b63e9874bf..51e9e50a55 100644
--- a/ext/standard/tests/array/range_errors.phpt
+++ b/ext/standard/tests/array/range_errors.phpt
@@ -7,101 +7,113 @@ precision=14
echo "\n*** Testing error conditions ***\n";
-echo "\n-- Testing ( (low < high) && (step = 0) ) --";
-var_dump( range(1, 2, 0) );
-var_dump( range("a", "b", 0) );
-
-echo "\n\n-- Testing ( (low > high) && (step = 0) ) --";
-var_dump( range(2, 1, 0) );
-var_dump( range("b", "a", 0) );
-
-echo "\n\n-- Testing ( (low < high) && (high-low < step) ) --";
-var_dump( range(1.0, 7.0, 6.5) );
-
-echo "\n\n-- Testing ( (low > high) && (low-high < step) ) --";
-var_dump( range(7.0, 1.0, 6.5) );
-
-echo "\n-- Testing Invalid number of arguments --";
-var_dump( range() ); // No.of args = 0
-var_dump( range(1) ); // No.of args < expected
-var_dump( range(1,2,3,4) ); // No.of args > expected
-var_dump( range(-1, -2, 2) );
-var_dump( range("a", "j", "z") );
-var_dump( range(0, 1, "140962482048819216326.24") );
-var_dump( range(0, 1, "140962482048819216326.24.") );
-
-echo "\n-- Testing Invalid steps --";
-$step_arr = array( "string", NULL, FALSE, "", "\0" );
-
-foreach( $step_arr as $step ) {
- var_dump( range( 1, 5, $step ) );
+echo "\n-- Testing ( (low < high) && (step = 0) ) --\n";
+try {
+ var_dump( range(1, 2, 0) );
+} catch (\ValueError $e) {
+ echo $e->getMessage(), "\n";
}
-echo "Done\n";
-?>
---EXPECTF--
-*** Testing error conditions ***
-
--- Testing ( (low < high) && (step = 0) ) --
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
+try {
+ var_dump( range("a", "b", 0) );
+} catch (\ValueError $e) {
+ echo $e->getMessage(), "\n";
+}
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
+echo "\n\n-- Testing ( (low > high) && (step = 0) ) --\n";
+try {
+ var_dump( range(2, 1, 0) );
+} catch (\ValueError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump( range("b", "a", 0) );
+} catch (\ValueError $e) {
+ echo $e->getMessage(), "\n";
+}
--- Testing ( (low > high) && (step = 0) ) --
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
+echo "\n\n-- Testing ( (low < high) && (high-low < step) ) --\n";
+try {
+ var_dump( range(1.0, 7.0, 6.5) );
+} catch (\ValueError $e) {
+ echo $e->getMessage(), "\n";
+}
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
+echo "\n\n-- Testing ( (low > high) && (low-high < step) ) --\n";
+try {
+ var_dump( range(7.0, 1.0, 6.5) );
+} catch (\ValueError $e) {
+ echo $e->getMessage(), "\n";
+}
+echo "\n-- Testing other conditions --\n";
+try {
+ var_dump( range(-1, -2, 2) );
+} catch (\ValueError $e) {
+ echo $e->getMessage(), "\n";
+}
--- Testing ( (low < high) && (high-low < step) ) --
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
+try {
+ var_dump( range("a", "j", "z") );
+} catch (\TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump( range(0, 1, "140962482048819216326.24") );
+} catch (\ValueError $e) {
+ echo $e->getMessage(), "\n";
+}
--- Testing ( (low > high) && (low-high < step) ) --
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
+try {
+ var_dump( range(0, 1, "140962482048819216326.24.") );
+} catch (\ValueError $e) {
+ echo $e->getMessage(), "\n";
+}
--- Testing Invalid number of arguments --
-Warning: range() expects at least 2 parameters, 0 given in %s on line %d
-bool(false)
+echo "\n-- Testing Invalid steps --\n";
+$step_arr = array( "string", NULL, FALSE, "", "\0" );
-Warning: range() expects at least 2 parameters, 1 given in %s on line %d
-bool(false)
+foreach( $step_arr as $step ) {
+ try {
+ var_dump( range( 1, 5, $step ) );
+ } catch (\TypeError | \ValueError $e) {
+ echo $e->getMessage(), "\n";
+ }
+}
+?>
+--EXPECTF--
+*** Testing error conditions ***
-Warning: range() expects at most 3 parameters, 4 given in %s on line %d
-bool(false)
+-- Testing ( (low < high) && (step = 0) ) --
+Step exceeds the specified range
+Step exceeds the specified range
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
-Warning: range(): Invalid range string - must be numeric in %s on line %d
-bool(false)
+-- Testing ( (low > high) && (step = 0) ) --
+Step exceeds the specified range
+Step exceeds the specified range
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
-Warning: range(): Invalid range string - must be numeric in %s on line %d
-bool(false)
+-- Testing ( (low < high) && (high-low < step) ) --
+Step exceeds the specified range
--- Testing Invalid steps --
-Warning: range(): Invalid range string - must be numeric in %s on line %d
-bool(false)
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
+-- Testing ( (low > high) && (low-high < step) ) --
+Step exceeds the specified range
-Warning: range(): step exceeds the specified range in %s on line %d
-bool(false)
+-- Testing other conditions --
+Step exceeds the specified range
+range() expects parameter 3 to be int or float, string given
+Step exceeds the specified range
-Warning: range(): Invalid range string - must be numeric in %s on line %d
-bool(false)
+Notice: A non well formed numeric value encountered in %s on line %d
+Step exceeds the specified range
-Warning: range(): Invalid range string - must be numeric in %s on line %d
-bool(false)
-Done
+-- Testing Invalid steps --
+range() expects parameter 3 to be int or float, string given
+Step exceeds the specified range
+Step exceeds the specified range
+range() expects parameter 3 to be int or float, string given
+range() expects parameter 3 to be int or float, string given
diff --git a/ext/standard/tests/array/range_variation.phpt b/ext/standard/tests/array/range_variation.phpt
index f7fc9e0815..3de5f6188f 100644
--- a/ext/standard/tests/array/range_variation.phpt
+++ b/ext/standard/tests/array/range_variation.phpt
@@ -18,7 +18,11 @@ for( $i = 0; $i < count($low_arr); $i++) {
echo "\n*** Possible variatins with steps ***\n";
var_dump( range( 1, 5, TRUE ) );
-var_dump( range( 1, 5, array(1, 2) ) );
+try {
+ var_dump( range( 1, 5, array(1, 2) ) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done\n";
?>
@@ -611,16 +615,5 @@ array(5) {
[4]=>
int(5)
}
-array(5) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
- [3]=>
- int(4)
- [4]=>
- int(5)
-}
+range() expects parameter 3 to be int or float, array given
Done
diff --git a/ext/standard/tests/array/reset_basic.phpt b/ext/standard/tests/array/reset_basic.phpt
index 04c676a4cf..195c431fd9 100644
--- a/ext/standard/tests/array/reset_basic.phpt
+++ b/ext/standard/tests/array/reset_basic.phpt
@@ -27,7 +27,6 @@ echo key($array) . " => " . current($array) . "\n";
echo "\n-- Call to reset() --\n";
var_dump(reset($array));
?>
-===DONE===
--EXPECT--
*** Testing reset() : basic functionality ***
@@ -42,4 +41,3 @@ string(3) "one"
-- Call to reset() --
string(4) "zero"
-===DONE===
diff --git a/ext/standard/tests/array/reset_variation2.phpt b/ext/standard/tests/array/reset_variation2.phpt
index e155cad592..2dbf152ce6 100644
--- a/ext/standard/tests/array/reset_variation2.phpt
+++ b/ext/standard/tests/array/reset_variation2.phpt
@@ -22,7 +22,6 @@ echo "\n-- Unset First element in array and check reset() --\n";
unset($array[0]);
var_dump(reset($array));
?>
-===DONE===
--EXPECT--
*** Testing reset() : usage variations ***
@@ -31,4 +30,3 @@ a => 0
-- Unset First element in array and check reset() --
string(1) "b"
-===DONE===
diff --git a/ext/standard/tests/array/reset_variation3.phpt b/ext/standard/tests/array/reset_variation3.phpt
index ff17a0cc9e..fd0d86eda8 100644
--- a/ext/standard/tests/array/reset_variation3.phpt
+++ b/ext/standard/tests/array/reset_variation3.phpt
@@ -38,7 +38,6 @@ var_dump(current($array1));
echo "\$array2: ";
var_dump(current($array2));
?>
-===DONE===
--EXPECT--
*** Testing reset() : usage variations ***
@@ -53,4 +52,3 @@ $array2: string(3) "one"
string(4) "zero"
$array1: string(4) "zero"
$array2: string(4) "zero"
-===DONE===
diff --git a/ext/standard/tests/array/rsort_basic.phpt b/ext/standard/tests/array/rsort_basic.phpt
index 2d75287841..76123b7c02 100644
--- a/ext/standard/tests/array/rsort_basic.phpt
+++ b/ext/standard/tests/array/rsort_basic.phpt
@@ -15,20 +15,20 @@ echo "*** Testing rsort() : basic functionality ***\n";
// associative array containing unsorted string values
$unsorted_strings = array(
- "l" => "lemon", "o" => "orange",
- "O" => "Orange", "O1" => "Orange1", "o2" => "orange2", "O3" => "Orange3", "o20" => "orange20",
- "b" => "banana",
+ "l" => "lemon", "o" => "orange",
+ "O" => "Orange", "O1" => "Orange1", "o2" => "orange2", "O3" => "Orange3", "o20" => "orange20",
+ "b" => "banana",
);
// array with default keys containing unsorted numeric values
$unsorted_numerics = array( 100, 33, 555, 22 );
-echo "\n-- Testing rsort() by supplying string array, 'flag' value is defualt --\n";
+echo "\n-- Testing rsort() by supplying string array, 'flag' value is default --\n";
$temp_array = $unsorted_strings;
var_dump( rsort($temp_array) );
var_dump( $temp_array);
-echo "\n-- Testing rsort() by supplying numeric array, 'flag' value is defualt --\n";
+echo "\n-- Testing rsort() by supplying numeric array, 'flag' value is default --\n";
$temp_array = $unsorted_numerics;
var_dump( rsort($temp_array) );
var_dump( $temp_array);
@@ -73,7 +73,7 @@ echo "Done";
--EXPECT--
*** Testing rsort() : basic functionality ***
--- Testing rsort() by supplying string array, 'flag' value is defualt --
+-- Testing rsort() by supplying string array, 'flag' value is default --
bool(true)
array(8) {
[0]=>
@@ -94,7 +94,7 @@ array(8) {
string(6) "Orange"
}
--- Testing rsort() by supplying numeric array, 'flag' value is defualt --
+-- Testing rsort() by supplying numeric array, 'flag' value is default --
bool(true)
array(4) {
[0]=>
diff --git a/ext/standard/tests/array/rsort_object1.phpt b/ext/standard/tests/array/rsort_object1.phpt
index 7477276cd3..df7ca491ff 100644
--- a/ext/standard/tests/array/rsort_object1.phpt
+++ b/ext/standard/tests/array/rsort_object1.phpt
@@ -16,27 +16,27 @@ echo "*** Testing rsort() : object functionality ***\n";
// class declaration for integer objects
class for_integer_rsort
{
- public $class_value;
- // initializing object member value
- function __construct($value){
- $this->class_value = $value;
- }
+ public $class_value;
+ // initializing object member value
+ function __construct($value){
+ $this->class_value = $value;
+ }
}
// class declaration for string objects
class for_string_rsort
{
- public $class_value;
- // initializing object member value
- function __construct($value){
- $this->class_value = $value;
- }
+ public $class_value;
+ // initializing object member value
+ function __construct($value){
+ $this->class_value = $value;
+ }
- // return string value
- function __tostring() {
- return (string)$this->value;
- }
+ // return string value
+ function __tostring() {
+ return (string)$this->value;
+ }
}
@@ -58,12 +58,12 @@ $unsorted_str_obj = array (
echo "\n-- Sort flag = default --\n";
-// testing rsort() function by supplying integer object array, flag value is defualt
+// testing rsort() function by supplying integer object array, flag value is default
$temp_array = $unsorted_int_obj;
var_dump(rsort($temp_array) );
var_dump($temp_array);
-// testing rsort() function by supplying string object array, flag value is defualt
+// testing rsort() function by supplying string object array, flag value is default
$temp_array = $unsorted_str_obj;
var_dump(rsort($temp_array) );
var_dump($temp_array);
diff --git a/ext/standard/tests/array/rsort_object2.phpt b/ext/standard/tests/array/rsort_object2.phpt
index b47903b698..21789ba026 100644
--- a/ext/standard/tests/array/rsort_object2.phpt
+++ b/ext/standard/tests/array/rsort_object2.phpt
@@ -16,36 +16,36 @@ echo "*** Testing rsort() : object functionality ***\n";
// class declaration for integer objects
class for_integer_rsort
{
- public $public_class_value;
- private $private_class_value;
- protected $protected_class_value;
+ public $public_class_value;
+ private $private_class_value;
+ protected $protected_class_value;
- // initializing object member value
- function __construct($value1, $value2,$value3){
- $this->public_class_value = $value1;
- $this->private_class_value = $value2;
- $this->protected_class_value = $value3;
- }
+ // initializing object member value
+ function __construct($value1, $value2,$value3){
+ $this->public_class_value = $value1;
+ $this->private_class_value = $value2;
+ $this->protected_class_value = $value3;
+ }
}
// class declaration for string objects
class for_string_rsort
{
- public $public_class_value;
- private $private_class_value;
- protected $protected_class_value;
- // initializing object member value
- function __construct($value1, $value2,$value3){
- $this->public_class_value = $value1;
- $this->private_class_value = $value2;
- $this->protected_class_value = $value3;
- }
+ public $public_class_value;
+ private $private_class_value;
+ protected $protected_class_value;
+ // initializing object member value
+ function __construct($value1, $value2,$value3){
+ $this->public_class_value = $value1;
+ $this->private_class_value = $value2;
+ $this->protected_class_value = $value3;
+ }
- // return string value
- function __tostring() {
- return (string)$this->value;
- }
+ // return string value
+ function __tostring() {
+ return (string)$this->value;
+ }
}
@@ -69,12 +69,12 @@ $unsorted_str_obj = array (
echo "\n-- Sort flag = default --\n";
-// testing rsort() function by supplying integer object array, flag value is defualt
+// testing rsort() function by supplying integer object array, flag value is default
$temp_array = $unsorted_int_obj;
var_dump(rsort($temp_array) );
var_dump($temp_array);
-// testing rsort() function by supplying string object array, flag value is defualt
+// testing rsort() function by supplying string object array, flag value is default
$temp_array = $unsorted_str_obj;
var_dump(rsort($temp_array) );
var_dump($temp_array);
diff --git a/ext/standard/tests/array/rsort_variation3.phpt b/ext/standard/tests/array/rsort_variation3.phpt
index 724764f48b..545eacedc3 100644
--- a/ext/standard/tests/array/rsort_variation3.phpt
+++ b/ext/standard/tests/array/rsort_variation3.phpt
@@ -42,7 +42,7 @@ $count = 1;
foreach ($various_arrays as $array) {
echo "\n-- Iteration $count --\n";
- echo "- With Defualt sort flag -\n";
+ echo "- With Default sort flag -\n";
$temp_array = $array;
var_dump(rsort($temp_array) );
var_dump($temp_array);
@@ -63,7 +63,7 @@ echo "Done";
*** Testing rsort() : variation ***
-- Iteration 1 --
-- With Defualt sort flag -
+- With Default sort flag -
bool(true)
array(9) {
[0]=>
@@ -131,7 +131,7 @@ array(9) {
}
-- Iteration 2 --
-- With Defualt sort flag -
+- With Default sort flag -
bool(true)
array(7) {
[0]=>
@@ -187,7 +187,7 @@ array(7) {
}
-- Iteration 3 --
-- With Defualt sort flag -
+- With Default sort flag -
bool(true)
array(11) {
[0]=>
@@ -267,7 +267,7 @@ array(11) {
}
-- Iteration 4 --
-- With Defualt sort flag -
+- With Default sort flag -
bool(true)
array(7) {
[0]=>
diff --git a/ext/standard/tests/array/rsort_variation4.phpt b/ext/standard/tests/array/rsort_variation4.phpt
index 75d8c8bb56..3687c05c7f 100644
--- a/ext/standard/tests/array/rsort_variation4.phpt
+++ b/ext/standard/tests/array/rsort_variation4.phpt
@@ -23,7 +23,7 @@ $value3 = 555;
// an array containing integer references
$unsorted_numerics = array( &$value1 , &$value2, &$value3);
-echo "\n-- 'flag' value is defualt --\n";
+echo "\n-- 'flag' value is default --\n";
$temp_array = $unsorted_numerics;
var_dump( rsort($temp_array) );
var_dump( $temp_array);
@@ -38,7 +38,7 @@ echo "Done";
--EXPECT--
*** Testing rsort() : variation ***
--- 'flag' value is defualt --
+-- 'flag' value is default --
bool(true)
array(3) {
[0]=>
diff --git a/ext/standard/tests/array/rsort_variation5.phpt b/ext/standard/tests/array/rsort_variation5.phpt
index 44a8b2b473..20d061f4c4 100644
--- a/ext/standard/tests/array/rsort_variation5.phpt
+++ b/ext/standard/tests/array/rsort_variation5.phpt
@@ -26,22 +26,22 @@ $flags = array("SORT_REGULAR" => SORT_REGULAR, "SORT_STRING" => SORT_STRING);
$count = 1;
// loop through to test rsort() with different arrays
foreach ($various_arrays as $array) {
- echo "\n-- Iteration $count --\n";
+ echo "\n-- Iteration $count --\n";
- echo "- With Default sort flag -\n";
- $temp_array = $array;
- var_dump(rsort($temp_array) );
- var_dump($temp_array);
+ echo "- With Default sort flag -\n";
+ $temp_array = $array;
+ var_dump(rsort($temp_array) );
+ var_dump($temp_array);
- // loop through $flags array and setting all possible flag values
- foreach($flags as $key => $flag){
- echo "- Sort flag = $key -\n";
+ // loop through $flags array and setting all possible flag values
+ foreach($flags as $key => $flag){
+ echo "- Sort flag = $key -\n";
- $temp_array = $array;
- var_dump(rsort($temp_array, $flag) );
- var_dump($temp_array);
- }
- $count++;
+ $temp_array = $array;
+ var_dump(rsort($temp_array, $flag) );
+ var_dump($temp_array);
+ }
+ $count++;
}
echo "Done";
diff --git a/ext/standard/tests/array/rsort_variation6.phpt b/ext/standard/tests/array/rsort_variation6.phpt
index 29c5d3c09d..3789776c37 100644
--- a/ext/standard/tests/array/rsort_variation6.phpt
+++ b/ext/standard/tests/array/rsort_variation6.phpt
@@ -16,7 +16,7 @@ echo "*** Testing rsort() : variation ***\n";
// an array contains unsorted hexadecimal values
$unsorted_hex_array = array(0x1AB, 0xFFF, 0xF, 0xFF, 0x2AA, 0xBB, 0x1ab, 0xff, -0xFF, 0, -0x2aa);
-echo "\n-- 'flag' value is defualt --\n";
+echo "\n-- 'flag' value is default --\n";
$temp_array = $unsorted_hex_array;
var_dump(rsort($temp_array) );
var_dump($temp_array);
@@ -36,7 +36,7 @@ echo "Done";
--EXPECT--
*** Testing rsort() : variation ***
--- 'flag' value is defualt --
+-- 'flag' value is default --
bool(true)
array(11) {
[0]=>
diff --git a/ext/standard/tests/array/rsort_variation7.phpt b/ext/standard/tests/array/rsort_variation7.phpt
index 51a0565cdb..b54108d031 100644
--- a/ext/standard/tests/array/rsort_variation7.phpt
+++ b/ext/standard/tests/array/rsort_variation7.phpt
@@ -16,7 +16,7 @@ echo "*** Testing rsort() : variation ***\n";
// bool value array
$bool_values = array (true, false, TRUE, FALSE);
-echo "\n-- 'flag' value is defualt --\n";
+echo "\n-- 'flag' value is default --\n";
$temp_array = $bool_values;
var_dump(rsort($temp_array) );
var_dump($temp_array);
@@ -41,7 +41,7 @@ echo "Done";
--EXPECT--
*** Testing rsort() : variation ***
--- 'flag' value is defualt --
+-- 'flag' value is default --
bool(true)
array(4) {
[0]=>
diff --git a/ext/standard/tests/array/rsort_variation9.phpt b/ext/standard/tests/array/rsort_variation9.phpt
index d3b44ec0bb..93cdff2228 100644
--- a/ext/standard/tests/array/rsort_variation9.phpt
+++ b/ext/standard/tests/array/rsort_variation9.phpt
@@ -15,22 +15,22 @@ echo "*** Testing rsort() : variation ***\n";
// Associative arrays
$various_arrays = array(
- // numeric assoc. only array
- array(5 => 55, 6 => 66, 2 => 22, 3 => 33, 1 => 11),
+ // numeric assoc. only array
+ array(5 => 55, 6 => 66, 2 => 22, 3 => 33, 1 => 11),
- // two-dimensional assoc. and default key array
- array("fruits" => array("a" => "orange", "b" => "banana", "c" => "apple"),
- "numbers" => array(1, 2, 3, 4, 5, 6),
- "holes" => array("first", 5 => "second", "third")),
+ // two-dimensional assoc. and default key array
+ array("fruits" => array("a" => "orange", "b" => "banana", "c" => "apple"),
+ "numbers" => array(1, 2, 3, 4, 5, 6),
+ "holes" => array("first", 5 => "second", "third")),
- // numeric assoc. and default key array
- array(1, 1, 8 => 1, 4 => 1, 19, 3 => 13),
+ // numeric assoc. and default key array
+ array(1, 1, 8 => 1, 4 => 1, 19, 3 => 13),
- // mixed assoc. array
- array('bar' => 'baz', "foo" => 1),
+ // mixed assoc. array
+ array('bar' => 'baz', "foo" => 1),
- // assoc. only multi-dimensional array
- array('a' => 1,'b' => array('e' => 2,'f' => 3),'c' => array('g' => 4),'d' => 5),
+ // assoc. only multi-dimensional array
+ array('a' => 1,'b' => array('e' => 2,'f' => 3),'c' => array('g' => 4),'d' => 5),
);
$count = 1;
diff --git a/ext/standard/tests/array/sizeof_variation4.phpt b/ext/standard/tests/array/sizeof_variation4.phpt
index 465b818174..2fc98396b1 100644
--- a/ext/standard/tests/array/sizeof_variation4.phpt
+++ b/ext/standard/tests/array/sizeof_variation4.phpt
@@ -89,380 +89,380 @@ echo "Done";
--- Testing sizeof() for all kinds of unset variables in default, Normal and Recursive Modes ---
-- Iteration 1 --
Default Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 2 --
Default Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 3 --
Default Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 4 --
Default Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 5 --
Default Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 6 --
Default Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 7 --
Default Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 8 --
Default Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 9 --
Default Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 10 --
Default Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 11 --
Default Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 12 --
Default Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 13 --
Default Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 14 --
Default Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 15 --
Default Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 16 --
Default Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 17 --
Default Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 18 --
Default Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 19 --
Default Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
-- Iteration 20 --
Default Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_NORMAL Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
COUNT_RECURSIVE Mode:
-Notice: Undefined variable: value in %s on line %d
+Warning: Undefined variable: value in %s on line %d
Warning: sizeof(): Parameter must be an array or an object that implements Countable in %s on line %d
int(0)
diff --git a/ext/standard/tests/array/sort_basic.phpt b/ext/standard/tests/array/sort_basic.phpt
index 065889de11..451fd5788f 100644
--- a/ext/standard/tests/array/sort_basic.phpt
+++ b/ext/standard/tests/array/sort_basic.phpt
@@ -11,7 +11,7 @@ Test sort() function : basic functionality
/*
* Testing sort() by providing arrays with default keys and assoc arrays
* to check the basic functionality with following flag values.
- * flag value as defualt
+ * flag value as default
* SORT_REGULAR - compare items normally
* SORT_NUMERIC - compare items numerically
* SORT_STRING - compare items as strings
@@ -21,20 +21,20 @@ echo "*** Testing sort() : basic functionality ***\n";
// associative array containing unsorted string values
$unsorted_strings = array(
- "l" => "lemon", "o" => "orange",
- "O" => "Orange", "O1" => "Orange1", "o2" => "orange2", "O3" => "Orange3", "o20" => "orange20",
- "b" => "banana",
+ "l" => "lemon", "o" => "orange",
+ "O" => "Orange", "O1" => "Orange1", "o2" => "orange2", "O3" => "Orange3", "o20" => "orange20",
+ "b" => "banana",
);
// array with default keys containing unsorted numeric values
$unsorted_numerics = array( 100, 33, 555, 22 );
-echo "\n-- Testing sort() by supplying string array, 'flag' value is defualt --\n";
+echo "\n-- Testing sort() by supplying string array, 'flag' value is default --\n";
$temp_array = $unsorted_strings;
var_dump( sort($temp_array) ); // expecting : bool(true)
var_dump( $temp_array);
-echo "\n-- Testing sort() by supplying numeric array, 'flag' value is defualt --\n";
+echo "\n-- Testing sort() by supplying numeric array, 'flag' value is default --\n";
$temp_array = $unsorted_numerics;
var_dump( sort($temp_array) ); // expecting : bool(true)
var_dump( $temp_array);
@@ -79,7 +79,7 @@ echo "Done\n";
--EXPECT--
*** Testing sort() : basic functionality ***
--- Testing sort() by supplying string array, 'flag' value is defualt --
+-- Testing sort() by supplying string array, 'flag' value is default --
bool(true)
array(8) {
[0]=>
@@ -100,7 +100,7 @@ array(8) {
string(8) "orange20"
}
--- Testing sort() by supplying numeric array, 'flag' value is defualt --
+-- Testing sort() by supplying numeric array, 'flag' value is default --
bool(true)
array(4) {
[0]=>
diff --git a/ext/standard/tests/array/sort_object1.phpt b/ext/standard/tests/array/sort_object1.phpt
index a55a0962a8..79458e0b1c 100644
--- a/ext/standard/tests/array/sort_object1.phpt
+++ b/ext/standard/tests/array/sort_object1.phpt
@@ -8,7 +8,7 @@ Test sort() function : object functionality - sorting objects, 'sort_flags' as d
* Source code: ext/standard/array.c
*/
/*
- * testing sort() by providing integer/string object arrays with flag values are defualt, SORT_REGULAR
+ * testing sort() by providing integer/string object arrays with flag values are default, SORT_REGULAR
*/
echo "*** Testing sort() : object functionality ***\n";
@@ -56,14 +56,14 @@ $unsorted_str_obj = array (
);
-echo "\n-- Testing sort() by supplying various object arrays, 'flag' value is defualt --\n";
+echo "\n-- Testing sort() by supplying various object arrays, 'flag' value is default --\n";
-// testing sort() function by supplying integer object array, flag value is defualt
+// testing sort() function by supplying integer object array, flag value is default
$temp_array = $unsorted_int_obj;
var_dump(sort($temp_array) );
var_dump($temp_array);
-// testing sort() function by supplying string object array, flag value is defualt
+// testing sort() function by supplying string object array, flag value is default
$temp_array = $unsorted_str_obj;
var_dump(sort($temp_array) );
var_dump($temp_array);
@@ -84,7 +84,7 @@ echo "Done\n";
--EXPECTF--
*** Testing sort() : object functionality ***
--- Testing sort() by supplying various object arrays, 'flag' value is defualt --
+-- Testing sort() by supplying various object arrays, 'flag' value is default --
bool(true)
array(6) {
[0]=>
diff --git a/ext/standard/tests/array/sort_object2.phpt b/ext/standard/tests/array/sort_object2.phpt
index 7e13cf8abf..9816ae3012 100644
--- a/ext/standard/tests/array/sort_object2.phpt
+++ b/ext/standard/tests/array/sort_object2.phpt
@@ -9,7 +9,7 @@ Test sort() function : object functionality - sorting objects with diff. accessi
*/
/*
- * testing sort() by providing integer/string object arrays with flag values are defualt, SORT_REGULAR
+ * testing sort() by providing integer/string object arrays with flag values are default, SORT_REGULAR
*/
echo "*** Testing sort() : object functionality ***\n";
@@ -66,14 +66,14 @@ $unsorted_str_obj = array (
);
-echo "\n-- Testing sort() by supplying various object arrays, 'flag' value is defualt --\n";
+echo "\n-- Testing sort() by supplying various object arrays, 'flag' value is default --\n";
-// testing sort() function by supplying integer object array, flag value is defualt
+// testing sort() function by supplying integer object array, flag value is default
$temp_array = $unsorted_int_obj;
var_dump(sort($temp_array) );
var_dump($temp_array);
-// testing sort() function by supplying string object array, flag value is defualt
+// testing sort() function by supplying string object array, flag value is default
$temp_array = $unsorted_str_obj;
var_dump(sort($temp_array) );
var_dump($temp_array);
@@ -94,7 +94,7 @@ echo "Done\n";
--EXPECTF--
*** Testing sort() : object functionality ***
--- Testing sort() by supplying various object arrays, 'flag' value is defualt --
+-- Testing sort() by supplying various object arrays, 'flag' value is default --
bool(true)
array(4) {
[0]=>
diff --git a/ext/standard/tests/array/sort_variation10.phpt b/ext/standard/tests/array/sort_variation10.phpt
index 1ff71a3dc5..4dc510064e 100644
--- a/ext/standard/tests/array/sort_variation10.phpt
+++ b/ext/standard/tests/array/sort_variation10.phpt
@@ -11,7 +11,7 @@ Test sort() function : usage variations - sort octal values
/*
* testing sort() by providing different octal array for $array argument
* with following flag values
- * 1.flag value as defualt
+ * 1.flag value as default
* 2.SORT_REGULAR - compare items normally
* 3.SORT_NUMERIC - compare items numerically
*/
@@ -21,7 +21,7 @@ echo "*** Testing sort() : usage variations ***\n";
// an array containing unsorted octal values
$unsorted_oct_array = array(01235, 0321, 0345, 066, 0772, 077, -066, -0345, 0);
-echo "\n-- Testing sort() by supplying octal value array, 'flag' value is defualt --\n";
+echo "\n-- Testing sort() by supplying octal value array, 'flag' value is default --\n";
$temp_array = $unsorted_oct_array;
var_dump(sort($temp_array) ); // expecting : bool(true)
var_dump($temp_array);
@@ -41,7 +41,7 @@ echo "Done\n";
--EXPECT--
*** Testing sort() : usage variations ***
--- Testing sort() by supplying octal value array, 'flag' value is defualt --
+-- Testing sort() by supplying octal value array, 'flag' value is default --
bool(true)
array(9) {
[0]=>
diff --git a/ext/standard/tests/array/sort_variation11.phpt b/ext/standard/tests/array/sort_variation11.phpt
index 0806ab6816..50d40fca63 100644
--- a/ext/standard/tests/array/sort_variation11.phpt
+++ b/ext/standard/tests/array/sort_variation11.phpt
Binary files differ
diff --git a/ext/standard/tests/array/sort_variation3.phpt b/ext/standard/tests/array/sort_variation3.phpt
index 3aec6dcdb1..7ee0d8ea84 100644
--- a/ext/standard/tests/array/sort_variation3.phpt
+++ b/ext/standard/tests/array/sort_variation3.phpt
@@ -11,7 +11,7 @@ Test sort() function : usage variations - sort integer/float values
/*
* Testing sort() by providing different integer/float value arrays for $array argument
* with following flag values
- * 1. flag value as defualt
+ * 1. flag value as default
* 2. SORT_REGULAR - compare items normally
* 3. SORT_NUMERIC - compare items numerically
* 4. SORT_STRING - compare items as strings
@@ -44,7 +44,7 @@ echo "\n-- Testing sort() by supplying various integer/float arrays --\n";
foreach ($various_arrays as $array) {
echo "\n-- Iteration $count --\n";
- echo "- With Defualt sort flag -\n";
+ echo "- With Default sort flag -\n";
$temp_array = $array;
var_dump(sort($temp_array) );
var_dump($temp_array);
@@ -67,7 +67,7 @@ echo "Done\n";
-- Testing sort() by supplying various integer/float arrays --
-- Iteration 1 --
-- With Defualt sort flag -
+- With Default sort flag -
bool(true)
array(9) {
[0]=>
@@ -135,7 +135,7 @@ array(9) {
}
-- Iteration 2 --
-- With Defualt sort flag -
+- With Default sort flag -
bool(true)
array(7) {
[0]=>
@@ -191,7 +191,7 @@ array(7) {
}
-- Iteration 3 --
-- With Defualt sort flag -
+- With Default sort flag -
bool(true)
array(11) {
[0]=>
@@ -271,7 +271,7 @@ array(11) {
}
-- Iteration 4 --
-- With Defualt sort flag -
+- With Default sort flag -
bool(true)
array(7) {
[0]=>
diff --git a/ext/standard/tests/array/sort_variation4.phpt b/ext/standard/tests/array/sort_variation4.phpt
index 56b25223bf..4a5d42ed9d 100644
--- a/ext/standard/tests/array/sort_variation4.phpt
+++ b/ext/standard/tests/array/sort_variation4.phpt
@@ -10,7 +10,7 @@ Test sort() function : usage variations - sort reference values
/*
* Testing sort() by providing reference variable array with following flag values
- * flag value as defualt
+ * flag value as default
* SORT_REGULAR - compare items normally
* SORT_NUMERIC - compare items numerically
*/
@@ -24,7 +24,7 @@ $value3 = 555;
// an array containing integer references
$unsorted_numerics = array( &$value1 , &$value2, &$value3);
-echo "\n-- Testing sort() by supplying reference variable array, 'flag' value is defualt --\n";
+echo "\n-- Testing sort() by supplying reference variable array, 'flag' value is default --\n";
$temp_array = $unsorted_numerics;
var_dump( sort($temp_array) ); // expecting : bool(true)
var_dump( $temp_array);
@@ -44,7 +44,7 @@ echo "Done\n";
--EXPECT--
*** Testing sort() :usage variations ***
--- Testing sort() by supplying reference variable array, 'flag' value is defualt --
+-- Testing sort() by supplying reference variable array, 'flag' value is default --
bool(true)
array(3) {
[0]=>
diff --git a/ext/standard/tests/array/sort_variation5.phpt b/ext/standard/tests/array/sort_variation5.phpt
index 613fb1d3b5..e5fc94c387 100644
--- a/ext/standard/tests/array/sort_variation5.phpt
+++ b/ext/standard/tests/array/sort_variation5.phpt
@@ -10,7 +10,7 @@ Test sort() function : usage variations - sort strings
/*
* testing sort() by providing different string arrays for $array argument with following flag values
- * flag value as defualt
+ * flag value as default
* SORT_REGULAR - compare items normally
* SORT_STRING - compare items as strings
*/
diff --git a/ext/standard/tests/array/sort_variation6.phpt b/ext/standard/tests/array/sort_variation6.phpt
index 7d7fdeb410..5fa933eb21 100644
--- a/ext/standard/tests/array/sort_variation6.phpt
+++ b/ext/standard/tests/array/sort_variation6.phpt
@@ -10,7 +10,7 @@ Test sort() function : usage variations - sort hexadecimal values
/*
* testing sort() by providing different hexa-decimal array for $array argument with following flag values
- * flag value as defualt
+ * flag value as default
* SORT_REGULAR - compare items normally
* SORT_NUMERIC - compare items numerically
*/
@@ -20,7 +20,7 @@ echo "*** Testing sort() : usage variations ***\n";
// an array contains unsorted hexadecimal values
$unsorted_hex_array = array(0x1AB, 0xFFF, 0xF, 0xFF, 0x2AA, 0xBB, 0x1ab, 0xff, -0xFF, 0, -0x2aa);
-echo "\n-- Testing sort() by supplying hexadecimal value array, 'flag' value is defualt --\n";
+echo "\n-- Testing sort() by supplying hexadecimal value array, 'flag' value is default --\n";
$temp_array = $unsorted_hex_array;
var_dump(sort($temp_array) ); // expecting : bool(true)
var_dump($temp_array);
@@ -40,7 +40,7 @@ echo "Done\n";
--EXPECT--
*** Testing sort() : usage variations ***
--- Testing sort() by supplying hexadecimal value array, 'flag' value is defualt --
+-- Testing sort() by supplying hexadecimal value array, 'flag' value is default --
bool(true)
array(11) {
[0]=>
diff --git a/ext/standard/tests/array/sort_variation7.phpt b/ext/standard/tests/array/sort_variation7.phpt
index 48d4a48758..7c2a4afe3e 100644
--- a/ext/standard/tests/array/sort_variation7.phpt
+++ b/ext/standard/tests/array/sort_variation7.phpt
@@ -10,7 +10,7 @@ Test sort() function : usage variations - sort boolean values
/*
* testing sort() by providing bool value array for $array argument with following flag values.
- * flag value as defualt
+ * flag value as default
* SORT_REGULAR - compare items normally
*/
@@ -19,7 +19,7 @@ echo "*** Testing sort() : usage variations ***\n";
// bool value array
$bool_values = array (true, false, TRUE, FALSE);
-echo "\n-- Testing sort() by supplying bool value array, 'flag' value is defualt --\n";
+echo "\n-- Testing sort() by supplying bool value array, 'flag' value is default --\n";
$temp_array = $bool_values;
var_dump(sort($temp_array) );
var_dump($temp_array);
@@ -44,7 +44,7 @@ echo "Done\n";
--EXPECT--
*** Testing sort() : usage variations ***
--- Testing sort() by supplying bool value array, 'flag' value is defualt --
+-- Testing sort() by supplying bool value array, 'flag' value is default --
bool(true)
array(4) {
[0]=>
diff --git a/ext/standard/tests/array/sort_variation8.phpt b/ext/standard/tests/array/sort_variation8.phpt
index 87134716ca..e4682e1702 100644
--- a/ext/standard/tests/array/sort_variation8.phpt
+++ b/ext/standard/tests/array/sort_variation8.phpt
@@ -1,5 +1,5 @@
--TEST--
-Test sort() function : usage variations - sort array with diff. sub arrays, 'sort_flags' as defualt/SORT_REGULAR
+Test sort() function : usage variations - sort array with diff. sub arrays, 'sort_flags' as default/SORT_REGULAR
--FILE--
<?php
/* Prototype : bool sort ( array &$array [, int $sort_flags] )
@@ -10,7 +10,7 @@ Test sort() function : usage variations - sort array with diff. sub arrays, 'sor
/*
* testing sort() by providing arrays contains sub arrays for $array argument with flowing flag values
- * flag value as defualt
+ * flag value as default
* SORT_REGULAR - compare items normally
*/
@@ -39,8 +39,8 @@ echo "\n-- Testing sort() by supplying various arrays containing sub arrays --\n
foreach ($various_arrays as $array) {
echo "\n-- Iteration $count --\n";
- // testing sort() function by supplying different arrays, flag value is defualt
- echo "- With Defualt sort flag -\n";
+ // testing sort() function by supplying different arrays, flag value is default
+ echo "- With Default sort flag -\n";
$temp_array = $array;
var_dump(sort($temp_array) );
var_dump($temp_array);
@@ -61,7 +61,7 @@ echo "Done\n";
-- Testing sort() by supplying various arrays containing sub arrays --
-- Iteration 1 --
-- With Defualt sort flag -
+- With Default sort flag -
bool(true)
array(0) {
}
@@ -71,7 +71,7 @@ array(0) {
}
-- Iteration 2 --
-- With Defualt sort flag -
+- With Default sort flag -
bool(true)
array(1) {
[0]=>
@@ -87,7 +87,7 @@ array(1) {
}
-- Iteration 3 --
-- With Defualt sort flag -
+- With Default sort flag -
bool(true)
array(3) {
[0]=>
@@ -119,7 +119,7 @@ array(3) {
}
-- Iteration 4 --
-- With Defualt sort flag -
+- With Default sort flag -
bool(true)
array(4) {
[0]=>
diff --git a/ext/standard/tests/array/sort_variation9.phpt b/ext/standard/tests/array/sort_variation9.phpt
index bf7d03191d..c5488be175 100644
--- a/ext/standard/tests/array/sort_variation9.phpt
+++ b/ext/standard/tests/array/sort_variation9.phpt
@@ -1,5 +1,5 @@
--TEST--
-Test sort() function : usage variations - sort diff. associative arrays, 'sort_flags' as defualt/SORT_REGULAR
+Test sort() function : usage variations - sort diff. associative arrays, 'sort_flags' as default/SORT_REGULAR
--FILE--
<?php
/* Prototype : bool sort ( array &$array [, int $sort_flags] )
@@ -11,7 +11,7 @@ Test sort() function : usage variations - sort diff. associative arrays, 'sort_f
/*
* Testing sort() by providing arrays with key values for $array argument
* with following flag values.
- * 1.flag value as defualt
+ * 1.flag value as default
* 2.SORT_REGULAR - compare items normally
* To test the new keys for the elements in the sorted array.
*/
@@ -38,7 +38,7 @@ echo "\n-- Testing sort() by supplying various arrays with key values --\n";
foreach ($various_arrays as $array) {
echo "\n-- Iteration $count --\n";
- echo "- With Defualt sort flag -\n";
+ echo "- With Default sort flag -\n";
$temp_array = $array;
var_dump(sort($temp_array) );
var_dump($temp_array);
@@ -58,7 +58,7 @@ echo "Done\n";
-- Testing sort() by supplying various arrays with key values --
-- Iteration 1 --
-- With Defualt sort flag -
+- With Default sort flag -
bool(true)
array(5) {
[0]=>
@@ -88,7 +88,7 @@ array(5) {
}
-- Iteration 2 --
-- With Defualt sort flag -
+- With Default sort flag -
bool(true)
array(3) {
[0]=>
@@ -164,7 +164,7 @@ array(3) {
}
-- Iteration 3 --
-- With Defualt sort flag -
+- With Default sort flag -
bool(true)
array(6) {
[0]=>
@@ -198,7 +198,7 @@ array(6) {
}
-- Iteration 4 --
-- With Defualt sort flag -
+- With Default sort flag -
bool(true)
array(2) {
[0]=>
@@ -216,7 +216,7 @@ array(2) {
}
-- Iteration 5 --
-- With Defualt sort flag -
+- With Default sort flag -
bool(true)
array(4) {
[0]=>
diff --git a/ext/standard/tests/array/uasort_variation3.phpt b/ext/standard/tests/array/uasort_variation3.phpt
index bcb5d41fab..5db2163e24 100644
--- a/ext/standard/tests/array/uasort_variation3.phpt
+++ b/ext/standard/tests/array/uasort_variation3.phpt
Binary files differ
diff --git a/ext/standard/tests/array/uasort_variation8.phpt b/ext/standard/tests/array/uasort_variation8.phpt
index 2bb2b46512..d27cd569c0 100644
--- a/ext/standard/tests/array/uasort_variation8.phpt
+++ b/ext/standard/tests/array/uasort_variation8.phpt
@@ -10,7 +10,6 @@ Test uasort() function : usage variations - built-in function as 'cmp_function'
/*
* Passing different built-in library functions in place of 'cmp_function'
* valid comparison functions: strcmp() & strcasecmp()
-* language constructs: echo & exit
*/
echo "*** Testing uasort() : built in function as 'cmp_function' ***\n";
@@ -28,13 +27,6 @@ echo "-- Testing uasort() with built-in 'cmp_function': strcmp() --\n";
var_dump( uasort($array_arg, 'strcmp') ); // expecting: bool(true)
var_dump($array_arg);
-// Testing with language construct as comparison function
-echo "-- Testing uasort() with language construct as 'cmp_function' --\n";
-var_dump( uasort($languageConstruct_fun_arg, 'echo') ); // expecting: bool(false)
-
-echo "-- Testing uasort() with language construct as 'cmp_function' --\n";
-var_dump( uasort($languageConstruct_fun_arg, 'exit') ); // expecting: bool(false)
-
echo "Done"
?>
--EXPECTF--
@@ -67,12 +59,4 @@ array(5) {
["o"]=>
string(6) "orange"
}
--- Testing uasort() with language construct as 'cmp_function' --
-
-Warning: uasort() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d
-NULL
--- Testing uasort() with language construct as 'cmp_function' --
-
-Warning: uasort() expects parameter 2 to be a valid callback, function 'exit' not found or invalid function name in %s on line %d
-NULL
Done
diff --git a/ext/standard/tests/array/usort_basic.phpt b/ext/standard/tests/array/usort_basic.phpt
index f5a8e7579d..36add207cf 100644
--- a/ext/standard/tests/array/usort_basic.phpt
+++ b/ext/standard/tests/array/usort_basic.phpt
@@ -53,7 +53,6 @@ echo "\n-- Associative array with string keys --\n";
var_dump( usort($string_key_arg, 'cmp') );
var_dump($string_key_arg);
?>
-===DONE===
--EXPECT--
*** Testing usort() : basic functionality ***
@@ -116,4 +115,3 @@ array(4) {
[3]=>
int(10)
}
-===DONE===
diff --git a/ext/standard/tests/array/usort_object1.phpt b/ext/standard/tests/array/usort_object1.phpt
index 18ca31890e..b1002a53e4 100644
--- a/ext/standard/tests/array/usort_object1.phpt
+++ b/ext/standard/tests/array/usort_object1.phpt
@@ -16,51 +16,51 @@ echo "*** Testing usort() : object functionality ***\n";
function simple_cmp($value1, $value2)
{
- if($value1 == $value2) {
- return 0;
- }
- else if($value1 > $value2) {
- return 1;
- }
- else
- return -1;
+ if($value1 == $value2) {
+ return 0;
+ }
+ else if($value1 > $value2) {
+ return 1;
+ }
+ else
+ return -1;
}
// comparison function for SimpleClass2 objects which has more than one member
function multiple_cmp($value1, $value2)
{
- if($value1->getValue() == $value2->getValue())
- return 0;
- else if($value1->getValue() > $value2->getValue())
- return 1;
- else
- return -1;
+ if($value1->getValue() == $value2->getValue())
+ return 0;
+ else if($value1->getValue() > $value2->getValue())
+ return 1;
+ else
+ return -1;
}
// Simple class with single property
class SimpleClass1
{
- private $int_value;
+ private $int_value;
- public function __construct($value) {
- $this->int_value = $value;
- }
+ public function __construct($value) {
+ $this->int_value = $value;
+ }
}
// Simple class with more than one property
class SimpleClass2
{
- private $int_value;
- protected $float_value;
- public $string_value;
- public function __construct($int, $float, $str) {
- $this->int_value = $int;
- $this->float_value = $float;
- $this->string_value = $str;
- }
- public function getValue() {
- return $this->int_value;
- }
+ private $int_value;
+ protected $float_value;
+ public $string_value;
+ public function __construct($int, $float, $str) {
+ $this->int_value = $int;
+ $this->float_value = $float;
+ $this->string_value = $str;
+ }
+ public function getValue() {
+ return $this->int_value;
+ }
}
// array of SimpleClass objects with only one property
@@ -82,7 +82,6 @@ $array_arg = array(
var_dump( usort($array_arg, 'multiple_cmp') );
var_dump($array_arg);
?>
-===DONE===
--EXPECTF--
*** Testing usort() : object functionality ***
bool(true)
@@ -138,4 +137,3 @@ array(3) {
string(5) "apple"
}
}
-===DONE===
diff --git a/ext/standard/tests/array/usort_object2.phpt b/ext/standard/tests/array/usort_object2.phpt
index e0c41936d5..915c3755bc 100644
--- a/ext/standard/tests/array/usort_object2.phpt
+++ b/ext/standard/tests/array/usort_object2.phpt
@@ -95,7 +95,6 @@ $array_arg = array(
var_dump( usort($array_arg, 'cmp_function') );
var_dump($array_arg);
?>
-===DONE===
--EXPECTF--
*** Testing usort() : object functionality ***
-- Testing usort() with StaticClass objects --
@@ -162,4 +161,3 @@ array(4) {
NULL
}
}
-===DONE===
diff --git a/ext/standard/tests/array/usort_variation10.phpt b/ext/standard/tests/array/usort_variation10.phpt
index be5a1b0969..6985c0ac55 100644
--- a/ext/standard/tests/array/usort_variation10.phpt
+++ b/ext/standard/tests/array/usort_variation10.phpt
@@ -41,7 +41,6 @@ echo "\n-- Array with default/assigned keys --\n";
var_dump( usort($array_arg, 'cmp') );
var_dump($array_arg);
?>
-===DONE===
--EXPECT--
*** Testing usort() : usage variation ***
@@ -76,4 +75,3 @@ array(4) {
[3]=>
string(9) "Pineapple"
}
-===DONE===
diff --git a/ext/standard/tests/array/usort_variation11.phpt b/ext/standard/tests/array/usort_variation11.phpt
index b6cdeef766..d07dfb48e0 100644
--- a/ext/standard/tests/array/usort_variation11.phpt
+++ b/ext/standard/tests/array/usort_variation11.phpt
@@ -4,20 +4,20 @@ Test usort() function : usage variations - binary return cmp
<?php
function ucmp($a, $b) {
- return $a > $b;
+ return $a > $b;
}
$range = array(2, 4, 8, 16, 32, 64, 128);
foreach ($range as $r) {
- $backup = $array = range(0, $r);
- shuffle($array);
- usort($array, "ucmp");
- if ($array != $backup) {
- var_dump($array);
- var_dump($backup);
- die("Whatever sorting algo you used, this test should never be broken");
- }
+ $backup = $array = range(0, $r);
+ shuffle($array);
+ usort($array, "ucmp");
+ if ($array != $backup) {
+ var_dump($array);
+ var_dump($backup);
+ die("Whatever sorting algo you used, this test should never be broken");
+ }
}
echo "okey";
?>
diff --git a/ext/standard/tests/array/usort_variation3.phpt b/ext/standard/tests/array/usort_variation3.phpt
index 88ae8afe4b..0d83d5e2d6 100644
--- a/ext/standard/tests/array/usort_variation3.phpt
+++ b/ext/standard/tests/array/usort_variation3.phpt
@@ -74,7 +74,6 @@ var_dump( usort($array_arg, 'cmp_function') );
echo "\n-- Sorted array after usort() function call --\n";
var_dump($array_arg);
?>
-===DONE===
--EXPECT--
*** Testing usort() : usage variation ***
bool(true)
@@ -112,4 +111,3 @@ array(15) {
[14]=>
int(0)
}
-===DONE===
diff --git a/ext/standard/tests/array/usort_variation4.phpt b/ext/standard/tests/array/usort_variation4.phpt
index 1335279708..e4365207a3 100644
--- a/ext/standard/tests/array/usort_variation4.phpt
+++ b/ext/standard/tests/array/usort_variation4.phpt
@@ -66,7 +66,6 @@ echo "\n-- Sorting empty array --\n";
var_dump( usort($empty_array, 'cmp_function') );
var_dump($empty_array);
?>
-===DONE===
--EXPECT--
*** Testing usort() : usage variation ***
@@ -152,4 +151,3 @@ array(7) {
bool(true)
array(0) {
}
-===DONE===
diff --git a/ext/standard/tests/array/usort_variation5.phpt b/ext/standard/tests/array/usort_variation5.phpt
index 2fd3f24ae1..2757054ead 100644
--- a/ext/standard/tests/array/usort_variation5.phpt
+++ b/ext/standard/tests/array/usort_variation5.phpt
@@ -73,7 +73,6 @@ echo "\n-- Sorting Heredoc String values --\n";
var_dump( usort($heredoc_values, 'cmp_function') );
var_dump($heredoc_values);
?>
-===DONE===
--EXPECTF--
*** Testing usort() : usage variation ***
@@ -140,4 +139,3 @@ array(4) {
string(%d) "heredoc string with!@# and 123
Test this!!!"
}
-===DONE===
diff --git a/ext/standard/tests/array/usort_variation6.phpt b/ext/standard/tests/array/usort_variation6.phpt
index 473f61a0dd..1916ded151 100644
--- a/ext/standard/tests/array/usort_variation6.phpt
+++ b/ext/standard/tests/array/usort_variation6.phpt
@@ -53,7 +53,6 @@ var_dump( usort($array_args[5], 'cmp_function') );
echo "-- Array after call to usort() --\n";
var_dump($array_args[5]);
?>
-===DONE===
--EXPECT--
*** Testing usort() : usage variation ***
@@ -136,4 +135,3 @@ array(5) {
[4]=>
int(54)
}
-===DONE===
diff --git a/ext/standard/tests/array/usort_variation7.phpt b/ext/standard/tests/array/usort_variation7.phpt
index a493ac752c..bf554bce1d 100644
--- a/ext/standard/tests/array/usort_variation7.phpt
+++ b/ext/standard/tests/array/usort_variation7.phpt
@@ -37,7 +37,6 @@ echo "\n-- Anonymous 'cmp_function' with parameters passed by reference --\n";
var_dump( usort($array_arg, $cmp_function) );
var_dump($array_arg);
?>
-===DONE===
--EXPECT--
*** Testing usort() : usage variation ***
@@ -68,4 +67,3 @@ array(4) {
[3]=>
string(9) "Pineapple"
}
-===DONE===
diff --git a/ext/standard/tests/array/usort_variation8.phpt b/ext/standard/tests/array/usort_variation8.phpt
index 3296c4a36a..55ff362d41 100644
--- a/ext/standard/tests/array/usort_variation8.phpt
+++ b/ext/standard/tests/array/usort_variation8.phpt
@@ -30,16 +30,7 @@ $temp_array2 = $array_arg;
var_dump( usort($temp_array2, 'strcmp') );
var_dump($temp_array2);
-// Testing with language construct as comparison function
-echo "\n-- Testing usort() with language construct as 'cmp_function' --\n";
-$temp_array3 = $array_arg;
-var_dump( usort($temp_array3, 'echo') );
-
-echo "\n-- Testing usort() with language construct as 'cmp_function' --\n";
-$temp_array4 = $array_arg;
-var_dump( usort($temp_array4, 'exit') );
?>
-===DONE===
--EXPECTF--
*** Testing usort() : usage variation ***
@@ -72,14 +63,3 @@ array(5) {
[4]=>
string(6) "orange"
}
-
--- Testing usort() with language construct as 'cmp_function' --
-
-Warning: usort() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d
-NULL
-
--- Testing usort() with language construct as 'cmp_function' --
-
-Warning: usort() expects parameter 2 to be a valid callback, function 'exit' not found or invalid function name in %s on line %d
-NULL
-===DONE===
diff --git a/ext/standard/tests/array/usort_variation9.phpt b/ext/standard/tests/array/usort_variation9.phpt
index 8035c57b13..6c7f511b1f 100644
--- a/ext/standard/tests/array/usort_variation9.phpt
+++ b/ext/standard/tests/array/usort_variation9.phpt
@@ -45,7 +45,6 @@ echo "\n-- Sorting \$array_arg containing different references --\n";
var_dump( usort($array_arg, 'cmp_function') );
var_dump($array_arg);
?>
-===DONE===
--EXPECT--
*** Testing usort() : usage variation ***
@@ -63,4 +62,3 @@ array(5) {
[4]=>
int(200)
}
-===DONE===
diff --git a/ext/standard/tests/array/var_export3.phpt b/ext/standard/tests/array/var_export3.phpt
index 6d39946916..e7d3c851f2 100644
--- a/ext/standard/tests/array/var_export3.phpt
+++ b/ext/standard/tests/array/var_export3.phpt
@@ -3,14 +3,14 @@ var_export() and classes
--FILE--
<?php
class kake {
- public $mann;
- protected $kvinne;
+ public $mann;
+ protected $kvinne;
- function __construct()
- {
- $this->mann = 42;
- $this->kvinne = 43;
- }
+ function __construct()
+ {
+ $this->mann = 42;
+ $this->kvinne = 43;
+ }
}
$kake = new kake;
diff --git a/ext/standard/tests/assert/assert.phpt b/ext/standard/tests/assert/assert.phpt
index 08e1188d60..7935b7c8fd 100644
--- a/ext/standard/tests/assert/assert.phpt
+++ b/ext/standard/tests/assert/assert.phpt
@@ -1,44 +1,41 @@
--TEST--
assert()
--INI--
-error_reporting = 2039
assert.active = 0
assert.warning = 1
assert.callback =
assert.bail = 0
-assert.quiet_eval = 0
--FILE--
<?php
-function a($file,$line,$myev)
+function a($file, $line, $unused, $desc)
{
- echo "assertion failed $line,\"$myev\"\n";
+ echo "assertion failed $line,\"$desc\"\n";
}
class a
{
- function assert($file,$line,$myev)
- {
- echo "class assertion failed $line,\"$myev\"\n";
- }
+ static function assert($file, $line, $unused, $desc)
+ {
+ echo "class assertion failed $line,\"$desc\"\n";
+ }
}
assert_options(ASSERT_ACTIVE,1);
-assert_options(ASSERT_QUIET_EVAL,1);
assert_options(ASSERT_WARNING,0);
$a = 0;
assert_options(ASSERT_CALLBACK,"a");
-assert('$a != 0');
+assert($a != 0);
assert_options(ASSERT_CALLBACK,array("a","assert"));
-assert('$a != 0');
+assert($a != 0);
$obj = new a();
assert_options(ASSERT_CALLBACK,array(&$obj,"assert"));
-assert('$a != 0');
+assert($a != 0);
?>
--EXPECT--
-assertion failed 22,"$a != 0"
-class assertion failed 25,"$a != 0"
-class assertion failed 29,"$a != 0"
+assertion failed 21,"assert($a != 0)"
+class assertion failed 24,"assert($a != 0)"
+class assertion failed 28,"assert($a != 0)"
diff --git a/ext/standard/tests/assert/assert02.phpt b/ext/standard/tests/assert/assert02.phpt
deleted file mode 100644
index 85b72369cb..0000000000
--- a/ext/standard/tests/assert/assert02.phpt
+++ /dev/null
@@ -1,64 +0,0 @@
---TEST--
-catch assert() errors
---INI--
-assert.active=1
-assert.warning=1
-assert.callback=
-assert.bail=0
-assert.quiet_eval=0
---FILE--
-<?php
-
-assert(1);
-assert('1');
-assert('$a');
-
-try {
- assert('aa=sd+as+safsafasfasafsaf');
-} catch (Throwable $e) {
- echo $e->getMessage(), "\n";
-}
-
-assert('0');
-
-assert_options(ASSERT_BAIL, 1);
-
-try {
- assert('aa=sd+as+safsafasfasafsaf');
-} catch (Throwable $e) {
- echo $e->getMessage(), "\n";
-}
-
-echo "done\n";
-
-?>
---EXPECTF--
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
-
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
-
-Notice: Undefined variable: a in %sassert02.php(%d) : assert code on line 1
-
-Warning: assert(): Assertion "$a" failed in %sassert02.php on line %d
-
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
-Failure evaluating code:
-aa=sd+as+safsafasfasafsaf
-
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
-
-Warning: assert(): Assertion "0" failed in %sassert02.php on line %d
-
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
-
-Fatal error: Uncaught ParseError: syntax error, unexpected '=', expecting ';' in %s(%d) : assert code:1
-Stack trace:
-#0 %s(%d): assert('aa=sd+as+safsaf...')
-#1 {main}
-
-Next Error: Failure evaluating code:
-aa=sd+as+safsafasfasafsaf in %s:%d
-Stack trace:
-#0 %s(%d): assert('aa=sd+as+safsaf...')
-#1 {main}
- thrown in %s on line %d
diff --git a/ext/standard/tests/assert/assert03.phpt b/ext/standard/tests/assert/assert03.phpt
index 80c42df473..4428790fa2 100644
--- a/ext/standard/tests/assert/assert03.phpt
+++ b/ext/standard/tests/assert/assert03.phpt
@@ -5,38 +5,31 @@ assert.active = 1
assert.warning = 0
assert.callback =
assert.bail = 0
-assert.quiet_eval = 1
--FILE--
<?php
-function a($file,$line,$myev)
+function a($file, $line, $unused, $desc)
{
- echo "assertion failed - a - $line,\"$myev\"\n";
+ echo "assertion failed - a - $line,\"$desc\"\n";
}
-function b($file,$line,$myev)
+function b($file, $line, $unused, $desc)
{
- echo "assertion failed - b - $line,\"$myev\"\n";
+ echo "assertion failed - b - $line,\"$desc\"\n";
}
assert_options(ASSERT_ACTIVE,1);
-assert_options(ASSERT_QUIET_EVAL,1);
assert_options(ASSERT_WARNING,0);
$a = 0;
-assert_options(ASSERT_CALLBACK,"a");
-assert('$a != 0');
+assert_options(ASSERT_CALLBACK, "a");
+assert($a != 0);
/* Modify call back using ini_set() */
ini_set("assert.callback", "b");
-assert('$a != 0');
+assert($a != 0);
?>
-==DONE==
---EXPECTF--
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
-assertion failed - a - %d,"$a != 0"
-
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
-assertion failed - b - %d,"$a != 0"
-==DONE==
+--EXPECT--
+assertion failed - a - 18,"assert($a != 0)"
+assertion failed - b - 22,"assert($a != 0)"
diff --git a/ext/standard/tests/assert/assert04.phpt b/ext/standard/tests/assert/assert04.phpt
index 0100229958..35f7668ce1 100644
--- a/ext/standard/tests/assert/assert04.phpt
+++ b/ext/standard/tests/assert/assert04.phpt
@@ -5,24 +5,14 @@ assert.active = 1
assert.warning = 1
assert.callback =
assert.bail = 0
-assert.quiet_eval = 0
--FILE--
<?php
/* Assert not active */
assert_options(ASSERT_ACTIVE, 0);
assert(1);
-
/* Wrong parameter count in assert */
assert_options(ASSERT_ACTIVE, 1);
-assert(2, "failure", 3);
-
-/* Wrong parameter count in assert_options */
-assert_options(ASSERT_ACTIVE, 0, 2);
-
-/* Wrong parameter name in assert_options */
-$test="ASSERT_FRED";
-assert_options($test, 1);
/* Assert false */
assert(0);
@@ -36,12 +26,6 @@ echo "not reached\n";
?>
--EXPECTF--
-Warning: assert() expects at most 2 parameters, 3 given in %s on line %d
-
-Warning: assert_options() expects at most 2 parameters, 3 given in %s on line %d
-
-Warning: assert_options() expects parameter 1 to be int, string given in %s on line %d
-
Warning: assert(): assert(0) failed in %s on line %d
Warning: assert(): assert(0) failed in %s on line %d
diff --git a/ext/standard/tests/assert/assert_basic.phpt b/ext/standard/tests/assert/assert_basic.phpt
index 73b3e73206..dbf15c1998 100644
--- a/ext/standard/tests/assert/assert_basic.phpt
+++ b/ext/standard/tests/assert/assert_basic.phpt
@@ -5,29 +5,16 @@ assert.active = 1
assert.warning = 0
assert.callback = f1
assert.bail = 0
-assert.quiet_eval = 0
--FILE--
<?php
function f1()
{
- echo "f1 called\n";
+ echo "f1 called\n";
}
-//String assert
-$sa = "0 != 0";
-var_dump($r2=assert($sa));
-$sa = "0 == 0";
-var_dump($r2=assert($sa));
-//Non string assert
-var_dump($r2=assert(0));
-var_dump($r2=assert(1));
---EXPECTF--
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
-f1 called
-bool(false)
-
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
-bool(true)
+var_dump($r2 = assert(0));
+var_dump($r2 = assert(1));
+--EXPECT--
f1 called
bool(false)
bool(true)
diff --git a/ext/standard/tests/assert/assert_basic1.phpt b/ext/standard/tests/assert/assert_basic1.phpt
index a5bcda3316..5961811468 100644
--- a/ext/standard/tests/assert/assert_basic1.phpt
+++ b/ext/standard/tests/assert/assert_basic1.phpt
@@ -5,25 +5,16 @@ assert.active = 0
assert.warning = 0
assert.callback = f1
assert.bail = 0
-assert.quiet_eval = 0
--FILE--
<?php
function f1()
{
- echo "f1 called\n";
+ echo "f1 called\n";
}
-//String assert
-$sa = "0 != 0";
-var_dump($r2=assert($sa));
-$sa = "0 == 0";
-var_dump($r2=assert($sa));
-
-//Non string assert
var_dump($r2=assert(0));
var_dump($r2=assert(1));
+?>
--EXPECT--
bool(true)
bool(true)
-bool(true)
-bool(true)
diff --git a/ext/standard/tests/assert/assert_basic2.phpt b/ext/standard/tests/assert/assert_basic2.phpt
index d6c150d0d0..9d768e0d36 100644
--- a/ext/standard/tests/assert/assert_basic2.phpt
+++ b/ext/standard/tests/assert/assert_basic2.phpt
@@ -5,17 +5,16 @@ assert.active = 1
assert.warning = 1
assert.callback=f1
assert.bail = 0
-assert.quiet_eval = 0
--FILE--
<?php
function f2()
{
- echo "f2 called\n";
+ echo "f2 called\n";
}
function f1()
{
- echo "f1 called\n";
+ echo "f1 called\n";
}
var_dump($o = assert_options(ASSERT_CALLBACK));
diff --git a/ext/standard/tests/assert/assert_basic3.phpt b/ext/standard/tests/assert/assert_basic3.phpt
index a7fd990cbe..8374eff951 100644
--- a/ext/standard/tests/assert/assert_basic3.phpt
+++ b/ext/standard/tests/assert/assert_basic3.phpt
@@ -4,24 +4,20 @@ assert() - basic - Test that bailout works
assert.active = 1
assert.warning = 1
assert.callback = f1
-assert.quiet_eval = 1
assert.bail = 0
--FILE--
<?php
function f1()
{
- echo "f1 called\n";
+ echo "f1 called\n";
}
//bail out on error
var_dump($rao=assert_options(ASSERT_BAIL, 1));
-$sa = "0 != 0";
-var_dump($r2=assert($sa));
+var_dump($r2=assert(0 != 0));
echo "If this is printed BAIL hasn't worked";
--EXPECTF--
int(0)
-
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
f1 called
-Warning: assert(): assert($sa): "0 != 0" failed in %s on line 10
+Warning: assert(): assert(0 != 0) failed in %s on line %d
diff --git a/ext/standard/tests/assert/assert_basic4.phpt b/ext/standard/tests/assert/assert_basic4.phpt
index 4e78cf9ec1..289c51860e 100644
--- a/ext/standard/tests/assert/assert_basic4.phpt
+++ b/ext/standard/tests/assert/assert_basic4.phpt
@@ -4,7 +4,6 @@ assert() - basic - test initial values using ini.get and assert_options
assert.active = 0
assert.warning = 0
assert.bail = 0
-assert.quiet_eval = 0
assert.callback = f1
--FILE--
<?php
@@ -14,23 +13,19 @@ assert.callback = f1
echo "Initial values: assert_options(ASSERT_ACTIVE) => [".assert_options(ASSERT_ACTIVE)."]\n";
echo "Initial values: assert_options(ASSERT_WARNING) => [".assert_options(ASSERT_WARNING)."]\n";
echo "Initial values: assert_options(ASSERT_BAIL) => [".assert_options(ASSERT_BAIL)."]\n";
-echo "Initial values: assert_options(ASSERT_QUIET_EVAL) => [".assert_options(ASSERT_QUIET_EVAL)."]\n";
echo "Initial values: assert_options(ASSERT_CALLBACK) => [".assert_options(ASSERT_CALLBACK)."]\n";
//Using ini.get;
echo "Initial values: ini.get(\"assert.active\") => [".ini_get("assert.active")."]\n";
echo "Initial values: ini.get(\"assert.warning\") => [".ini_get("assert.warning")."]\n";
echo "Initial values: ini.get(\"assert.bail\") => [".ini_get("assert.bail")."]\n";
-echo "Initial values: ini.get(\"assert.quiet_eval\") => [".ini_get("assert.quiet_eval")."]\n";
echo "Initial values: ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n\n";
--EXPECT--
Initial values: assert_options(ASSERT_ACTIVE) => [0]
Initial values: assert_options(ASSERT_WARNING) => [0]
Initial values: assert_options(ASSERT_BAIL) => [0]
-Initial values: assert_options(ASSERT_QUIET_EVAL) => [0]
Initial values: assert_options(ASSERT_CALLBACK) => [f1]
Initial values: ini.get("assert.active") => [0]
Initial values: ini.get("assert.warning") => [0]
Initial values: ini.get("assert.bail") => [0]
-Initial values: ini.get("assert.quiet_eval") => [0]
Initial values: ini.get("assert.callback") => [f1]
diff --git a/ext/standard/tests/assert/assert_basic5.phpt b/ext/standard/tests/assert/assert_basic5.phpt
index f4943cdf16..98053c7313 100644
--- a/ext/standard/tests/assert/assert_basic5.phpt
+++ b/ext/standard/tests/assert/assert_basic5.phpt
@@ -5,32 +5,25 @@ assert.active = 1
assert.warning = 0
assert.callback = f1
assert.bail = 0
-assert.quiet_eval = 0
--FILE--
<?php
function f1()
{
- echo "f1 called\n";
+ echo "f1 called\n";
}
//switch warning on and test return value
var_dump($rao=assert_options(ASSERT_WARNING, 1));
-$sa = "0 != 0";
-var_dump($r2=assert($sa));
-$sa = "0 == 0";
-var_dump($r2=assert($sa));
+var_dump($r2=assert(0 != 0));
+var_dump($r2=assert(0 == 0));
//switch warning on and test return value
var_dump($rao=assert_options(ASSERT_WARNING, 0));
--EXPECTF--
int(0)
-
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
f1 called
-Warning: assert(): assert($sa): "0 != 0" failed in %s on line 10
+Warning: assert(): assert(0 != 0) failed in %s on line %d
bool(false)
-
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
bool(true)
int(1)
diff --git a/ext/standard/tests/assert/assert_basic6.phpt b/ext/standard/tests/assert/assert_basic6.phpt
deleted file mode 100644
index 216c85c94b..0000000000
--- a/ext/standard/tests/assert/assert_basic6.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-assert() - basic - Test that bailout works
---INI--
-assert.active = 1
-assert.warning = 1
-assert.callback = f1
-assert.quiet_eval = 1
-assert.bail = 0
---FILE--
-<?php
-function f1($message)
-{
- echo "f1 called\n";
-}
-
-//bail out on error
-var_dump($rao = assert_options(ASSERT_BAIL, 1));
-$sa = "0 != 0";
-var_dump($r2 = assert($sa, "0 is 0"));
-echo "If this is printed BAIL hasn't worked";
---EXPECTF--
-int(0)
-
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
-f1 called
-
-Warning: assert(): 0 is 0: "0 != 0" failed in %s on line 10
diff --git a/ext/standard/tests/assert/assert_closures.phpt b/ext/standard/tests/assert/assert_closures.phpt
index 4a013283a8..13a7e5415e 100644
--- a/ext/standard/tests/assert/assert_closures.phpt
+++ b/ext/standard/tests/assert/assert_closures.phpt
@@ -4,7 +4,6 @@ assert() - basic - accept closures as callback.
assert.active = 1
assert.warning = 1
assert.bail = 0
-assert.quiet_eval = 0
--FILE--
<?php
assert_options(ASSERT_CALLBACK, function () { echo "Hello World!\n"; });
diff --git a/ext/standard/tests/assert/assert_error.phpt b/ext/standard/tests/assert/assert_error.phpt
deleted file mode 100644
index 6e04060765..0000000000
--- a/ext/standard/tests/assert/assert_error.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-assert() - error - give assert nonsense string with quiet_eval on then off
---INI--
-assert.active = 1
-assert.warning = 1
-assert.callback = f1
-assert.bail = 0
-assert.quiet_eval = 0
---FILE--
-<?php
-function f1()
-{
- echo "f1 called\n";
-}
-
-$sa = "threemeninaboat";
-
-var_dump($r2=assert($sa));
-
-var_dump($ra0 = assert_options(ASSERT_QUIET_EVAL, 1));
-
-var_dump($r2=assert($sa));
---EXPECTF--
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
-
-Warning: Use of undefined constant threemeninaboat - assumed 'threemeninaboat' (this will throw an Error in a future version of PHP) in %s(9) : assert code on line 1
-bool(true)
-int(0)
-
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
-bool(true)
diff --git a/ext/standard/tests/assert/assert_error2.phpt b/ext/standard/tests/assert/assert_error2.phpt
index d1b6f1745f..027bd03067 100644
--- a/ext/standard/tests/assert/assert_error2.phpt
+++ b/ext/standard/tests/assert/assert_error2.phpt
@@ -4,7 +4,6 @@ assert() - basic - Test that bailout works
assert.active = 1
assert.warning = 1
assert.callback = f1
-assert.quiet_eval = 1
assert.bail = 0
error_reporting = -1
display_errors = 1
@@ -12,23 +11,15 @@ display_errors = 1
<?php
function f1($script, $line, $message, $user_message)
{
- echo "f1 called\n";
+ echo "f1 called\n";
}
//bail out on error
var_dump($rao = assert_options(ASSERT_BAIL, 1));
-var_dump($r2 = assert("0 != 0"));
+var_dump($r2 = assert(0 != 0));
echo "If this is printed BAIL hasn't worked";
--EXPECTF--
int(0)
+f1 called
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
-
-Warning: assert(): Assertion "0 != 0" failed in %s on line 9
-
-Fatal error: Uncaught ArgumentCountError: Too few arguments to function f1(), 3 passed and exactly 4 expected in %sassert_error2.php:2
-Stack trace:
-#0 [internal function]: f1('%s', 9, '0 != 0')
-#1 %sassert_error2.php(9): assert('0 != 0')
-#2 {main}
- thrown in %sassert_error2.php on line 2
+Warning: assert(): assert(0 != 0) failed in %s on line %d
diff --git a/ext/standard/tests/assert/assert_error3.phpt b/ext/standard/tests/assert/assert_error3.phpt
deleted file mode 100644
index 24538f4b04..0000000000
--- a/ext/standard/tests/assert/assert_error3.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-assert() - basic - Test recoverable error
---INI--
-assert.active = 1
-assert.warning = 1
-assert.callback = f1
-assert.quiet_eval = 0
-assert.bail = 0
-error_reporting = -1
-display_errors = 1
---FILE--
-<?php
-var_dump($r2 = assert("0 $ 0"));
---EXPECTF--
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
-
-Fatal error: Uncaught ParseError: syntax error, unexpected '$', expecting ';' in %s(%d) : assert code:1
-Stack trace:
-#0 %s(%d): assert('0 $ 0')
-#1 {main}
-
-Next Error: Failure evaluating code:
-0 $ 0 in %s:%d
-Stack trace:
-#0 %s(%d): assert('0 $ 0')
-#1 {main}
- thrown in %s on line %d
diff --git a/ext/standard/tests/assert/assert_error4.phpt b/ext/standard/tests/assert/assert_error4.phpt
deleted file mode 100644
index 59b4df6935..0000000000
--- a/ext/standard/tests/assert/assert_error4.phpt
+++ /dev/null
@@ -1,28 +0,0 @@
---TEST--
-assert() - basic - Test recoverable error
---INI--
-assert.active = 1
-assert.warning = 1
-assert.callback = f1
-assert.quiet_eval = 0
-assert.bail = 0
-error_reporting = -1
-display_errors = 1
---FILE--
-<?php
-$sa = "0 $ 0";
-var_dump($r2 = assert($sa, "Describing what was asserted"));
---EXPECTF--
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
-
-Fatal error: Uncaught ParseError: syntax error, unexpected '$', expecting ';' in %s(%d) : assert code:1
-Stack trace:
-#0 %s(%d): assert('0 $ 0', 'Describing what...')
-#1 {main}
-
-Next Error: Failure evaluating code:
-Describing what was asserted:"0 $ 0" in %s:%d
-Stack trace:
-#0 %s(%d): assert('0 $ 0', 'Describing what...')
-#1 {main}
- thrown in %s on line %d
diff --git a/ext/standard/tests/assert/assert_options_error.phpt b/ext/standard/tests/assert/assert_options_error.phpt
new file mode 100644
index 0000000000..ed94260ef8
--- /dev/null
+++ b/ext/standard/tests/assert/assert_options_error.phpt
@@ -0,0 +1,13 @@
+--TEST--
+assert_options() - unknown assert option.
+
+--FILE--
+<?php
+try {
+ assert_options(1000);
+} catch (\ValueError $e) {
+ echo $e->getMessage();
+}
+?>
+--EXPECT--
+Unknown value 1000
diff --git a/ext/standard/tests/assert/assert_variation.phpt b/ext/standard/tests/assert/assert_variation.phpt
index 023f6690c5..a28ea58d5a 100644
--- a/ext/standard/tests/assert/assert_variation.phpt
+++ b/ext/standard/tests/assert/assert_variation.phpt
@@ -5,46 +5,44 @@ assert.active = 1
assert.warning = 0
assert.callback = f1
assert.bail = 0
-assert.quiet_eval = 0
--FILE--
<?php
function f1()
{
- echo "f1 called\n";
+ echo "f1 called\n";
}
function f2()
{
- echo "f2 called\n";
+ echo "f2 called\n";
}
function f3()
{
- echo "f3 called\n";
+ echo "f3 called\n";
}
class c1
{
- function assert($file, $line, $myev)
- {
- echo "Class assertion failed $line, \"$myev\"\n";
- }
+ static function assert($file, $line, $unused, $desc)
+ {
+ echo "Class assertion failed $line, \"$desc\"\n";
+ }
}
echo "Initial values: assert_options(ASSERT_CALLBACK) => [".assert_options(ASSERT_CALLBACK)."]\n";
echo "Initial values: ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n";
-$sa = "0 != 0";
-var_dump($r2=assert($sa));
+var_dump($r2=assert(0 != 0));
echo"\n";
echo "Change callback function using ini.set and test return value \n";
var_dump($rv = ini_set("assert.callback","f2"));
echo "assert_options(ASSERT_CALLBACK) => [".assert_options(ASSERT_CALLBACK)."]\n";
echo "ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n";
-var_dump($r2=assert($sa));
+var_dump($r2=assert(0 != 0));
echo"\n";
echo "Change callback function using assert_options and test return value \n";
var_dump($rv=assert_options(ASSERT_CALLBACK, "f3"));
echo "assert_options(ASSERT_CALLBACK) => [".assert_options(ASSERT_CALLBACK)."]\n";
echo "ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n";
-var_dump($r2=assert($sa));
+var_dump($r2=assert(0 != 0));
echo"\n";
@@ -52,14 +50,14 @@ echo "Reset the name of the callback routine to a class method and check that it
var_dump($rc=assert_options(ASSERT_CALLBACK, "c1"));
echo "assert_options(ASSERT_CALLBACK) => [".assert_options(ASSERT_CALLBACK)."]\n";
echo "ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n";
-var_dump($r2=assert($sa));
+var_dump($r2=assert(0 != 0));
echo"\n";
echo "Reset callback options to use a class method \n";
var_dump($rc = assert_options(ASSERT_CALLBACK,array("c1","assert")));
var_dump($rao=assert_options(ASSERT_CALLBACK));
echo "ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n\n";
-var_dump($r2=assert($sa));
+var_dump($r2=assert(0 != 0));
echo"\n";
echo "Reset callback options to use an object method \n";
@@ -67,13 +65,11 @@ $o = new c1();
var_dump($rc=assert_options(ASSERT_CALLBACK,array(&$o,"assert")));
var_dump($rao=assert_options(ASSERT_CALLBACK));
echo "ini.get(\"assert.callback\") => [".ini_get("assert.callback")."]\n\n";
-var_dump($r2=assert($sa));
+var_dump($r2=assert(0 != 0));
echo"\n";
--EXPECTF--
Initial values: assert_options(ASSERT_CALLBACK) => [f1]
Initial values: ini.get("assert.callback") => [f1]
-
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
f1 called
bool(false)
@@ -81,8 +77,6 @@ Change callback function using ini.set and test return value
string(2) "f1"
assert_options(ASSERT_CALLBACK) => [f2]
ini.get("assert.callback") => [f2]
-
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
f2 called
bool(false)
@@ -90,8 +84,6 @@ Change callback function using assert_options and test return value
string(2) "f2"
assert_options(ASSERT_CALLBACK) => [f3]
ini.get("assert.callback") => [f2]
-
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
f3 called
bool(false)
@@ -99,8 +91,6 @@ Reset the name of the callback routine to a class method and check that it works
string(2) "f3"
assert_options(ASSERT_CALLBACK) => [c1]
ini.get("assert.callback") => [f2]
-
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
bool(false)
Reset callback options to use a class method
@@ -113,11 +103,7 @@ array(2) {
}
ini.get("assert.callback") => [f2]
-
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
-
-Deprecated: Non-static method c1::assert() should not be called statically in %s on line 53
-Class assertion failed 53, "0 != 0"
+Class assertion failed 52, "assert(0 != 0)"
bool(false)
Reset callback options to use an object method
@@ -136,7 +122,5 @@ array(2) {
}
ini.get("assert.callback") => [f2]
-
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
-Class assertion failed 61, "0 != 0"
+Class assertion failed 60, "assert(0 != 0)"
bool(false)
diff --git a/ext/standard/tests/assert/bug73303.phpt b/ext/standard/tests/assert/bug73303.phpt
deleted file mode 100644
index 7264f5a322..0000000000
--- a/ext/standard/tests/assert/bug73303.phpt
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-Bug #73303: Scope not inherited by eval in assert()
---FILE--
-<?php
-
-class Test {
- public $prop;
-
- public function main(){
- assert('self::checkCacheKey(get_object_vars($this))');
- echo 'Success';
- }
- private static function checkCacheKey($obj_properties){
- return count($obj_properties) == 1;
- }
-}
-
-$obj = new Test();
-$obj->main();
-
-?>
---EXPECTF--
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
-Success
diff --git a/ext/standard/tests/bug49244.phpt b/ext/standard/tests/bug49244.phpt
index 60942966a7..a50aacee8d 100644
--- a/ext/standard/tests/bug49244.phpt
+++ b/ext/standard/tests/bug49244.phpt
@@ -4,8 +4,8 @@ Bug #49244 (Floating point NaN cause garbage characters)
<?php
for ($i = 0; $i < 10; $i++) {
- printf("{%f} %1\$f\n", pow(-1.0, 0.3));
- printf("{%f} %1\$f\n", pow(-1.0, 0.3));
+ printf("{%f} %1\$f\n", pow(-1.0, 0.3));
+ printf("{%f} %1\$f\n", pow(-1.0, 0.3));
}
?>
diff --git a/ext/standard/tests/bug64370_var1.phpt b/ext/standard/tests/bug64370_var1.phpt
index 87172c9b60..16d1ce3365 100644
--- a/ext/standard/tests/bug64370_var1.phpt
+++ b/ext/standard/tests/bug64370_var1.phpt
@@ -10,7 +10,6 @@ $d = (microtime(true)-$_SERVER['REQUEST_TIME_FLOAT'])*1000;
echo "created in $d ms\n";
echo ((bool)($d >= 0)) . "\n";
?>
-===DONE===
--EXPECTF--
$_SERVER['REQUEST_TIME']: %d
$_SERVER['REQUEST_TIME_FLOAT']: %f
@@ -18,4 +17,3 @@ time(): %d
microtime(true): %f
created in %f ms
1
-===DONE===
diff --git a/ext/standard/tests/bug64370_var2.phpt b/ext/standard/tests/bug64370_var2.phpt
index d0d3590ea7..601f8b93e0 100644
--- a/ext/standard/tests/bug64370_var2.phpt
+++ b/ext/standard/tests/bug64370_var2.phpt
@@ -5,19 +5,17 @@ Test bug #64370 sequential microtime(true) calls
$i = 0;
while(100000 > $i++) {
- $m0 = microtime(true);
- $m1 = microtime(true);
- $d = $m1 - $m0;
+ $m0 = microtime(true);
+ $m1 = microtime(true);
+ $d = $m1 - $m0;
- /*echo "$d\n";*/
+ /*echo "$d\n";*/
- if ($d < 0) {
- die("failed in {$i}th iteration");
- }
+ if ($d < 0) {
+ die("failed in {$i}th iteration");
+ }
}
echo "ok\n";
?>
-===DONE===
--EXPECT--
ok
-===DONE===
diff --git a/ext/standard/tests/bug75220.phpt b/ext/standard/tests/bug75220.phpt
index ca6c3ef4ea..f0ba55a702 100644
--- a/ext/standard/tests/bug75220.phpt
+++ b/ext/standard/tests/bug75220.phpt
@@ -9,16 +9,16 @@ $a->bar('foo');
class B {};
class A extends B
{
- function bar($func)
- {
- var_dump('foo');
- var_dump(is_callable('parent::foo'));
- var_dump(is_callable(array('parent', 'foo')));
- }
+ function bar($func)
+ {
+ var_dump('foo');
+ var_dump(is_callable('parent::foo'));
+ var_dump(is_callable(array('parent', 'foo')));
+ }
- function __call($func, $args)
- {
- }
+ function __call($func, $args)
+ {
+ }
};
?>
diff --git a/ext/standard/tests/class_object/bug71442.phpt b/ext/standard/tests/class_object/bug71442.phpt
index d6b3d6699b..27a025c4e4 100644
--- a/ext/standard/tests/class_object/bug71442.phpt
+++ b/ext/standard/tests/class_object/bug71442.phpt
@@ -5,29 +5,29 @@ Bug #71442 (forward_static_call crash)
class A
{
- const NAME = 'A';
- public static function test() {
- $args = func_get_args();
- echo static::NAME, " ".join(',', $args)." \n";
- }
+ const NAME = 'A';
+ public static function test() {
+ $args = func_get_args();
+ echo static::NAME, " ".join(',', $args)." \n";
+ }
}
class B extends A
{
- const NAME = 'B';
+ const NAME = 'B';
- public static function test() {
- echo self::NAME, "\n";
- forward_static_call(array('A', 'test'), 'more', 'args');
- forward_static_call( 'test', 'other', 'args');
- }
+ public static function test() {
+ echo self::NAME, "\n";
+ forward_static_call(array('A', 'test'), 'more', 'args');
+ forward_static_call( 'test', 'other', 'args');
+ }
}
B::test('foo');
function test() {
- $args = func_get_args();
- echo "C ".join(',', $args)." \n";
+ $args = func_get_args();
+ echo "C ".join(',', $args)." \n";
}
?>
diff --git a/ext/standard/tests/class_object/bug78638.phpt b/ext/standard/tests/class_object/bug78638.phpt
new file mode 100644
index 0000000000..088e7c4c1f
--- /dev/null
+++ b/ext/standard/tests/class_object/bug78638.phpt
@@ -0,0 +1,9 @@
+--TEST--
+FR: #78638 (__PHP_Incomplete_Class should be final)
+--FILE--
+<?php
+$c = new class('bar') extends __PHP_Incomplete_Class {
+};
+?>
+--EXPECTF--
+Fatal error: Class class@anonymous may not inherit from final class (__PHP_Incomplete_Class) in %sbug78638.php on line %d
diff --git a/ext/standard/tests/class_object/class_exists_basic_001.phpt b/ext/standard/tests/class_object/class_exists_basic_001.phpt
index b95efecd65..9192ea80b7 100644
--- a/ext/standard/tests/class_object/class_exists_basic_001.phpt
+++ b/ext/standard/tests/class_object/class_exists_basic_001.phpt
@@ -11,7 +11,7 @@ Test class_exists() function : basic functionality
echo "*** Testing class_exists() : basic functionality ***\n";
spl_autoload_register(function ($className) {
- echo "In autoload($className)\n";
+ echo "In autoload($className)\n";
});
echo "Calling class_exists() on non-existent class with autoload explicitly enabled:\n";
diff --git a/ext/standard/tests/class_object/forward_static_call_001.phpt b/ext/standard/tests/class_object/forward_static_call_001.phpt
index 0fac78f4ea..30459f0c43 100644
--- a/ext/standard/tests/class_object/forward_static_call_001.phpt
+++ b/ext/standard/tests/class_object/forward_static_call_001.phpt
@@ -5,41 +5,41 @@ forward_static_call() called from outside of a method.
class A
{
- const NAME = 'A';
- public static function test() {
- echo static::NAME, "\n";
- }
+ const NAME = 'A';
+ public static function test() {
+ echo static::NAME, "\n";
+ }
}
class B extends A
{
- const NAME = 'B';
+ const NAME = 'B';
- public static function test() {
- echo self::NAME, "\n";
- forward_static_call(array('parent', 'test'));
- }
+ public static function test() {
+ echo self::NAME, "\n";
+ forward_static_call(array('parent', 'test'));
+ }
- public static function test2() {
- echo self::NAME, "\n";
- forward_static_call(array('self', 'test'));
- }
+ public static function test2() {
+ echo self::NAME, "\n";
+ forward_static_call(array('self', 'test'));
+ }
- public static function test3() {
- echo self::NAME, "\n";
- forward_static_call(array('A', 'test'));
- }
+ public static function test3() {
+ echo self::NAME, "\n";
+ forward_static_call(array('A', 'test'));
+ }
}
class C extends B
{
- const NAME = 'C';
+ const NAME = 'C';
- public static function test()
- {
- echo self::NAME, "\n";
- forward_static_call(array('A', 'test'));
- }
+ public static function test()
+ {
+ echo self::NAME, "\n";
+ forward_static_call(array('A', 'test'));
+ }
}
A::test();
@@ -57,7 +57,6 @@ echo "-\n";
C::test3();
?>
-===DONE===
--EXPECT--
A
-
@@ -80,4 +79,3 @@ C
-
B
C
-===DONE===
diff --git a/ext/standard/tests/class_object/forward_static_call_002.phpt b/ext/standard/tests/class_object/forward_static_call_002.phpt
index 64406feb3e..7bc0092321 100644
--- a/ext/standard/tests/class_object/forward_static_call_002.phpt
+++ b/ext/standard/tests/class_object/forward_static_call_002.phpt
@@ -5,13 +5,13 @@ forward_static_call() from outside of a class method.
class A
{
- public static function test() {
- echo "A\n";
- }
+ public static function test() {
+ echo "A\n";
+ }
}
function test() {
- forward_static_call(array('A', 'test'));
+ forward_static_call(array('A', 'test'));
}
test();
diff --git a/ext/standard/tests/class_object/forward_static_call_003.phpt b/ext/standard/tests/class_object/forward_static_call_003.phpt
index ea56f8d2e7..c2c0035f6b 100644
--- a/ext/standard/tests/class_object/forward_static_call_003.phpt
+++ b/ext/standard/tests/class_object/forward_static_call_003.phpt
@@ -5,30 +5,30 @@ forward_static_call() calling outside of the inheritance chain.
class A
{
- const NAME = 'A';
- public static function test() {
- echo static::NAME, "\n";
- }
+ const NAME = 'A';
+ public static function test() {
+ echo static::NAME, "\n";
+ }
}
class B extends A
{
- const NAME = 'B';
+ const NAME = 'B';
- public static function test() {
- echo self::NAME, "\n";
- forward_static_call(array('parent', 'test'));
- }
+ public static function test() {
+ echo self::NAME, "\n";
+ forward_static_call(array('parent', 'test'));
+ }
}
class C
{
- const NAME = 'C';
+ const NAME = 'C';
- public static function test() {
- echo self::NAME, "\n";
- forward_static_call(array('B', 'test'));
- }
+ public static function test() {
+ echo self::NAME, "\n";
+ forward_static_call(array('B', 'test'));
+ }
}
A::test();
@@ -38,7 +38,6 @@ echo "-\n";
C::test();
?>
-===DONE===
--EXPECT--
A
-
@@ -48,4 +47,3 @@ B
C
B
B
-===DONE===
diff --git a/ext/standard/tests/class_object/get_class_methods_basic_001.phpt b/ext/standard/tests/class_object/get_class_methods_basic_001.phpt
index 843e9f1a53..4c091da565 100644
--- a/ext/standard/tests/class_object/get_class_methods_basic_001.phpt
+++ b/ext/standard/tests/class_object/get_class_methods_basic_001.phpt
@@ -15,9 +15,9 @@ Test get_class_methods() function : basic functionality
echo "*** Testing get_class_methods() : basic functionality ***\n";
class C {
- function f() {}
- function g() {}
- function h() {}
+ function f() {}
+ function g() {}
+ function h() {}
}
echo "Argument is class name:\n";
diff --git a/ext/standard/tests/class_object/get_class_methods_basic_002.phpt b/ext/standard/tests/class_object/get_class_methods_basic_002.phpt
index 8a11eba589..59d8606d8d 100644
--- a/ext/standard/tests/class_object/get_class_methods_basic_002.phpt
+++ b/ext/standard/tests/class_object/get_class_methods_basic_002.phpt
@@ -13,48 +13,48 @@ Test get_class_methods() function : basic functionality
*/
class C {
- private function privC() {}
- protected function protC() {}
- public function pubC() {}
+ private function privC() {}
+ protected function protC() {}
+ public function pubC() {}
- public static function testFromC() {
- echo "Accessing C from C:\n";
- var_dump(get_class_methods("C"));
- echo "Accessing D from C:\n";
- var_dump(get_class_methods("D"));
- echo "Accessing X from C:\n";
- var_dump(get_class_methods("X"));
- }
+ public static function testFromC() {
+ echo "Accessing C from C:\n";
+ var_dump(get_class_methods("C"));
+ echo "Accessing D from C:\n";
+ var_dump(get_class_methods("D"));
+ echo "Accessing X from C:\n";
+ var_dump(get_class_methods("X"));
+ }
}
class D extends C {
- private function privD() {}
- protected function protD() {}
- public function pubD() {}
+ private function privD() {}
+ protected function protD() {}
+ public function pubD() {}
- public static function testFromD() {
- echo "Accessing C from D:\n";
- var_dump(get_class_methods("C"));
- echo "Accessing D from D:\n";
- var_dump(get_class_methods("D"));
- echo "Accessing X from D:\n";
- var_dump(get_class_methods("X"));
- }
+ public static function testFromD() {
+ echo "Accessing C from D:\n";
+ var_dump(get_class_methods("C"));
+ echo "Accessing D from D:\n";
+ var_dump(get_class_methods("D"));
+ echo "Accessing X from D:\n";
+ var_dump(get_class_methods("X"));
+ }
}
class X {
- private function privX() {}
- protected function protX() {}
- public function pubX() {}
+ private function privX() {}
+ protected function protX() {}
+ public function pubX() {}
- public static function testFromX() {
- echo "Accessing C from X:\n";
- var_dump(get_class_methods("C"));
- echo "Accessing D from X:\n";
- var_dump(get_class_methods("D"));
- echo "Accessing X from X:\n";
- var_dump(get_class_methods("X"));
- }
+ public static function testFromX() {
+ echo "Accessing C from X:\n";
+ var_dump(get_class_methods("C"));
+ echo "Accessing D from X:\n";
+ var_dump(get_class_methods("D"));
+ echo "Accessing X from X:\n";
+ var_dump(get_class_methods("X"));
+ }
}
echo "Accessing D from global scope:\n";
diff --git a/ext/standard/tests/class_object/get_class_methods_basic_003.phpt b/ext/standard/tests/class_object/get_class_methods_basic_003.phpt
index c7662f8605..e15d962b16 100644
--- a/ext/standard/tests/class_object/get_class_methods_basic_003.phpt
+++ b/ext/standard/tests/class_object/get_class_methods_basic_003.phpt
@@ -13,23 +13,23 @@ Test get_class_methods() function : basic functionality
*/
interface I {
- public function pubI();
+ public function pubI();
}
class C implements I {
- public function pubI() {}
+ public function pubI() {}
- private function privC() {}
- protected function protC() {}
- public function pubC() {}
+ private function privC() {}
+ protected function protC() {}
+ public function pubC() {}
- public static function testFromC() {
- echo "Accessing I from C:\n";
- var_dump(get_class_methods("I"));
- echo "Accessing C from C:\n";
- var_dump(get_class_methods("C"));
- }
+ public static function testFromC() {
+ echo "Accessing I from C:\n";
+ var_dump(get_class_methods("I"));
+ echo "Accessing C from C:\n";
+ var_dump(get_class_methods("C"));
+ }
}
diff --git a/ext/standard/tests/class_object/get_class_methods_variation_001.phpt b/ext/standard/tests/class_object/get_class_methods_variation_001.phpt
index dd852ef61f..e44a3d1fd9 100644
--- a/ext/standard/tests/class_object/get_class_methods_variation_001.phpt
+++ b/ext/standard/tests/class_object/get_class_methods_variation_001.phpt
@@ -9,8 +9,8 @@ Test get_class_methods() function : usage variations - unexpected types
*/
-function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
- echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+function test_error_handler($err_no, $err_msg, $filename, $linenum) {
+ echo "Error: $err_no - $err_msg\n";
}
set_error_handler('test_error_handler');
@@ -81,10 +81,10 @@ foreach($values as $value) {
};
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing get_class_methods() : usage variations ***
-Error: 8 - Undefined variable: undefined_var, %s(67)
-Error: 8 - Undefined variable: unset_var, %s(70)
+Error: 2 - Undefined variable: undefined_var
+Error: 2 - Undefined variable: unset_var
Arg value 0
NULL
@@ -112,23 +112,23 @@ NULL
Arg value 0.5
NULL
-Error: 8 - Array to string conversion, %sget_class_methods_variation_001.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
NULL
-Error: 8 - Array to string conversion, %sget_class_methods_variation_001.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
NULL
-Error: 8 - Array to string conversion, %sget_class_methods_variation_001.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
NULL
-Error: 8 - Array to string conversion, %sget_class_methods_variation_001.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
NULL
-Error: 8 - Array to string conversion, %sget_class_methods_variation_001.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
NULL
diff --git a/ext/standard/tests/class_object/get_class_methods_variation_002.phpt b/ext/standard/tests/class_object/get_class_methods_variation_002.phpt
index 23416234f9..449df8845c 100644
--- a/ext/standard/tests/class_object/get_class_methods_variation_002.phpt
+++ b/ext/standard/tests/class_object/get_class_methods_variation_002.phpt
@@ -11,7 +11,7 @@ Test get_class_methods() function : usage variations - case sensitivity
echo "*** Testing get_class_methods() : usage variations ***\n";
class caseSensitivityTest {
- function MyMeThOd() {}
+ function MyMeThOd() {}
}
var_dump( get_class_methods('CasesensitivitytesT') );
diff --git a/ext/standard/tests/class_object/get_class_variation_001.phpt b/ext/standard/tests/class_object/get_class_variation_001.phpt
index b142f8ace9..87a9eac6c3 100644
--- a/ext/standard/tests/class_object/get_class_variation_001.phpt
+++ b/ext/standard/tests/class_object/get_class_variation_001.phpt
@@ -67,8 +67,12 @@ $values = array(
// loop through each element of the array for object
foreach($values as $value) {
- echo @"\nArg value: $value (type: " . gettype($value) . ")\n";
- var_dump( get_class($value) );
+ echo @"\nArg value: $value (type: " . gettype($value) . ")\n";
+ try {
+ var_dump( get_class($value) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
echo "Done";
@@ -76,137 +80,85 @@ echo "Done";
--EXPECTF--
*** Testing get_class() : usage variations ***
-Notice: Undefined variable: undefined_var in %sget_class_variation_001.php on line 58
+Warning: Undefined variable: undefined_var in %s on line %d
-Notice: Undefined variable: unset_var in %sget_class_variation_001.php on line 61
+Warning: Undefined variable: unset_var in %s on line %d
Arg value: 0 (type: integer)
-
-Warning: get_class() expects parameter 1 to be object, int given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, int given
Arg value: 1 (type: integer)
-
-Warning: get_class() expects parameter 1 to be object, int given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, int given
Arg value: 12345 (type: integer)
-
-Warning: get_class() expects parameter 1 to be object, int given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, int given
Arg value: -2345 (type: integer)
-
-Warning: get_class() expects parameter 1 to be object, int given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, int given
Arg value: 10.5 (type: double)
-
-Warning: get_class() expects parameter 1 to be object, float given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, float given
Arg value: -10.5 (type: double)
-
-Warning: get_class() expects parameter 1 to be object, float given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, float given
Arg value: 101234567000 (type: double)
-
-Warning: get_class() expects parameter 1 to be object, float given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, float given
Arg value: 1.07654321E-9 (type: double)
-
-Warning: get_class() expects parameter 1 to be object, float given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, float given
Arg value: 0.5 (type: double)
-
-Warning: get_class() expects parameter 1 to be object, float given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, float given
Arg value: Array (type: array)
-
-Warning: get_class() expects parameter 1 to be object, array given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, array given
Arg value: Array (type: array)
-
-Warning: get_class() expects parameter 1 to be object, array given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, array given
Arg value: Array (type: array)
-
-Warning: get_class() expects parameter 1 to be object, array given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, array given
Arg value: Array (type: array)
-
-Warning: get_class() expects parameter 1 to be object, array given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, array given
Arg value: Array (type: array)
-
-Warning: get_class() expects parameter 1 to be object, array given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, array given
Arg value: (type: NULL)
-
-Warning: get_class() expects parameter 1 to be object, null given in %s on line %d
-bool(false)
+get_class() expects parameter 1 to be object, null given
Arg value: (type: NULL)
-
-Warning: get_class() expects parameter 1 to be object, null given in %s on line %d
-bool(false)
+get_class() expects parameter 1 to be object, null given
Arg value: 1 (type: boolean)
-
-Warning: get_class() expects parameter 1 to be object, bool given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, bool given
Arg value: (type: boolean)
-
-Warning: get_class() expects parameter 1 to be object, bool given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, bool given
Arg value: 1 (type: boolean)
-
-Warning: get_class() expects parameter 1 to be object, bool given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, bool given
Arg value: (type: boolean)
-
-Warning: get_class() expects parameter 1 to be object, bool given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, bool given
Arg value: (type: string)
-
-Warning: get_class() expects parameter 1 to be object, string given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, string given
Arg value: (type: string)
-
-Warning: get_class() expects parameter 1 to be object, string given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, string given
Arg value: string (type: string)
-
-Warning: get_class() expects parameter 1 to be object, string given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, string given
Arg value: string (type: string)
-
-Warning: get_class() expects parameter 1 to be object, string given in %sget_class_variation_001.php on line %d
-bool(false)
+get_class() expects parameter 1 to be object, string given
Arg value: (type: NULL)
-
-Warning: get_class() expects parameter 1 to be object, null given in %s on line %d
-bool(false)
+get_class() expects parameter 1 to be object, null given
Arg value: (type: NULL)
-
-Warning: get_class() expects parameter 1 to be object, null given in %s on line %d
-bool(false)
+get_class() expects parameter 1 to be object, null given
Done
diff --git a/ext/standard/tests/class_object/get_class_vars_variation2.phpt b/ext/standard/tests/class_object/get_class_vars_variation2.phpt
index 0e54864b09..9745c33b0e 100644
--- a/ext/standard/tests/class_object/get_class_vars_variation2.phpt
+++ b/ext/standard/tests/class_object/get_class_vars_variation2.phpt
@@ -74,7 +74,6 @@ $child->test();
echo "\n-- From a child's static context --\n";
Child::testStatic();
?>
-===DONE===
--EXPECT--
*** Testing get_class_vars() : testing visibility
@@ -165,4 +164,3 @@ array(4) {
["prots"]=>
string(20) "protected static var"
}
-===DONE===
diff --git a/ext/standard/tests/class_object/get_declared_classes_basic_001.phpt b/ext/standard/tests/class_object/get_declared_classes_basic_001.phpt
index 78d27fa3a5..519f8beae0 100644
--- a/ext/standard/tests/class_object/get_declared_classes_basic_001.phpt
+++ b/ext/standard/tests/class_object/get_declared_classes_basic_001.phpt
@@ -16,9 +16,9 @@ echo "\n-- Testing get_declared_classes() function with Zero arguments --\n";
var_dump(get_declared_classes());
foreach (get_declared_classes() as $class) {
- if (!class_exists($class)) {
- echo "Error: $class is not a valid class.\n";
- }
+ if (!class_exists($class)) {
+ echo "Error: $class is not a valid class.\n";
+ }
}
echo "\n-- Ensure userspace classes are listed --\n";
diff --git a/ext/standard/tests/class_object/get_declared_interfaces_basic_001.phpt b/ext/standard/tests/class_object/get_declared_interfaces_basic_001.phpt
index 749ee69ab7..d328a02a03 100644
--- a/ext/standard/tests/class_object/get_declared_interfaces_basic_001.phpt
+++ b/ext/standard/tests/class_object/get_declared_interfaces_basic_001.phpt
@@ -16,9 +16,9 @@ echo "\n-- Testing get_declared_interfaces() function with Zero arguments --\n";
var_dump(get_declared_interfaces());
foreach (get_declared_interfaces() as $interface) {
- if (!interface_exists($interface)) {
- echo "Error: $interface is not a valid interface.\n";
- }
+ if (!interface_exists($interface)) {
+ echo "Error: $interface is not a valid interface.\n";
+ }
}
echo "\n-- Ensure userspace classes are not listed --\n";
diff --git a/ext/standard/tests/class_object/get_declared_traits_basic_001.phpt b/ext/standard/tests/class_object/get_declared_traits_basic_001.phpt
index 8ce2d2df56..2ca0ce00ca 100644
--- a/ext/standard/tests/class_object/get_declared_traits_basic_001.phpt
+++ b/ext/standard/tests/class_object/get_declared_traits_basic_001.phpt
@@ -18,9 +18,9 @@ echo "\n-- Testing get_declared_traits() function with Zero arguments --\n";
var_dump(get_declared_traits());
foreach (get_declared_traits() as $trait) {
- if (!trait_exists($trait)) {
- echo "Error: $trait is not a valid trait.\n";
- }
+ if (!trait_exists($trait)) {
+ echo "Error: $trait is not a valid trait.\n";
+ }
}
echo "\n-- Ensure trait is listed --\n";
diff --git a/ext/standard/tests/class_object/get_object_vars_basic_001.phpt b/ext/standard/tests/class_object/get_object_vars_basic_001.phpt
index 253ebd2be4..1133202cbf 100644
--- a/ext/standard/tests/class_object/get_object_vars_basic_001.phpt
+++ b/ext/standard/tests/class_object/get_object_vars_basic_001.phpt
@@ -9,40 +9,40 @@ get_object_vars(): visibility from static methods (target object passed as arg)
*/
Class A {
- private $hiddenPriv = 'A::hiddenPriv';
+ private $hiddenPriv = 'A::hiddenPriv';
- public static function test($b) {
- echo __METHOD__ . "\n";
- var_dump(get_object_vars($b));
- }
+ public static function test($b) {
+ echo __METHOD__ . "\n";
+ var_dump(get_object_vars($b));
+ }
}
Class B extends A {
- private $hiddenPriv = 'B::hiddenPriv';
- private $priv = 'B::priv';
- protected $prot = 'B::prot';
- public $pub = 'B::pub';
+ private $hiddenPriv = 'B::hiddenPriv';
+ private $priv = 'B::priv';
+ protected $prot = 'B::prot';
+ public $pub = 'B::pub';
- public static function test($b) {
- echo __METHOD__ . "\n";
- var_dump(get_object_vars($b));
- }
+ public static function test($b) {
+ echo __METHOD__ . "\n";
+ var_dump(get_object_vars($b));
+ }
}
Class C extends B {
- private $hiddenPriv = 'C::hiddenPriv';
+ private $hiddenPriv = 'C::hiddenPriv';
- public static function test($b) {
- echo __METHOD__ . "\n";
- var_dump(get_object_vars($b));
- }
+ public static function test($b) {
+ echo __METHOD__ . "\n";
+ var_dump(get_object_vars($b));
+ }
}
Class X {
- public static function test($b) {
- echo __METHOD__ . "\n";
- var_dump(get_object_vars($b));
- }
+ public static function test($b) {
+ echo __METHOD__ . "\n";
+ var_dump(get_object_vars($b));
+ }
}
diff --git a/ext/standard/tests/class_object/get_object_vars_basic_002.phpt b/ext/standard/tests/class_object/get_object_vars_basic_002.phpt
index 41a1758baa..ff0664ea46 100644
--- a/ext/standard/tests/class_object/get_object_vars_basic_002.phpt
+++ b/ext/standard/tests/class_object/get_object_vars_basic_002.phpt
@@ -9,24 +9,24 @@ get_object_vars(): visibility from non static methods (target object passed as a
*/
Class A {
- private $hiddenPriv = 'A::hiddenPriv';
+ private $hiddenPriv = 'A::hiddenPriv';
- public function testA($b) {
- echo __METHOD__ . "\n";
- var_dump(get_object_vars($b));
- }
+ public function testA($b) {
+ echo __METHOD__ . "\n";
+ var_dump(get_object_vars($b));
+ }
}
Class B extends A {
- private $hiddenPriv = 'B::hiddenPriv';
- private $priv = 'B::priv';
- protected $prot = 'B::prot';
- public $pub = 'B::pub';
-
- public function testB($b) {
- echo __METHOD__ . "\n";
- var_dump(get_object_vars($b));
- }
+ private $hiddenPriv = 'B::hiddenPriv';
+ private $priv = 'B::priv';
+ protected $prot = 'B::prot';
+ public $pub = 'B::pub';
+
+ public function testB($b) {
+ echo __METHOD__ . "\n";
+ var_dump(get_object_vars($b));
+ }
}
diff --git a/ext/standard/tests/class_object/get_object_vars_variation_001.phpt b/ext/standard/tests/class_object/get_object_vars_variation_001.phpt
index 2a310227a5..0cc7d492c8 100644
--- a/ext/standard/tests/class_object/get_object_vars_variation_001.phpt
+++ b/ext/standard/tests/class_object/get_object_vars_variation_001.phpt
@@ -9,7 +9,7 @@ get_object_vars() - ensure statics are not shown
*/
Class A {
- public static $var = 'hello';
+ public static $var = 'hello';
}
$a = new A;
diff --git a/ext/standard/tests/class_object/get_parent_class_variation_002.phpt b/ext/standard/tests/class_object/get_parent_class_variation_002.phpt
index 0ad5756837..d564ad3cd0 100644
--- a/ext/standard/tests/class_object/get_parent_class_variation_002.phpt
+++ b/ext/standard/tests/class_object/get_parent_class_variation_002.phpt
@@ -9,11 +9,11 @@ Test get_parent_class() function : usage variations - unexpected argument type.
*/
spl_autoload_register(function ($className) {
- echo "In autoload($className)\n";
+ echo "In autoload($className)\n";
});
-function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
- echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+function test_error_handler($err_no, $err_msg, $filename, $linenum) {
+ echo "Error: $err_no - $err_msg\n";
}
set_error_handler('test_error_handler');
@@ -83,10 +83,10 @@ foreach($values as $value) {
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing get_parent_class() : usage variations ***
-Error: 8 - Undefined variable: undefined_var, %s(68)
-Error: 8 - Undefined variable: unset_var, %s(71)
+Error: 2 - Undefined variable: undefined_var
+Error: 2 - Undefined variable: unset_var
Arg value 0
bool(false)
@@ -114,23 +114,23 @@ bool(false)
Arg value 0.5
bool(false)
-Error: 8 - Array to string conversion, %sget_parent_class_variation_002.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
bool(false)
-Error: 8 - Array to string conversion, %sget_parent_class_variation_002.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
bool(false)
-Error: 8 - Array to string conversion, %sget_parent_class_variation_002.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
bool(false)
-Error: 8 - Array to string conversion, %sget_parent_class_variation_002.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
bool(false)
-Error: 8 - Array to string conversion, %sget_parent_class_variation_002.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
bool(false)
diff --git a/ext/standard/tests/class_object/is_a.phpt b/ext/standard/tests/class_object/is_a.phpt
index 92d289ba18..efb03b3434 100644
--- a/ext/standard/tests/class_object/is_a.phpt
+++ b/ext/standard/tests/class_object/is_a.phpt
@@ -4,51 +4,51 @@ is_a and is_subclass_of behaviour (with and without autoload)
<?php
interface if_a {
- function f_a();
+ function f_a();
}
interface if_b extends if_a {
- function f_b();
+ function f_b();
}
class base {
- function _is_a($sub) {
-
- echo "\n>>> With Defined class\n";
- echo str_pad('is_a( OBJECT:'.get_class($this).', '.$sub.') = ', 60) . (is_a($this, $sub) ? 'yes' : 'no')."\n";
- echo str_pad('is_a( STRING:'.get_class($this).', '.$sub.') = ', 60). (is_a(get_class($this), $sub) ? 'yes' : 'no')."\n";
- echo str_pad('is_a( STRING:'.get_class($this).', '.$sub.', true) = ', 60). (is_a(get_class($this), $sub, true) ? 'yes' : 'no')."\n";
- echo str_pad('is_subclass_of( OBJECT:'.get_class($this).', '.$sub.') = ', 60). (is_subclass_of($this, $sub) ? 'yes' : 'no')."\n";
- echo str_pad('is_subclass_of( STRING:'.get_class($this).', '.$sub.') = ', 60). (is_subclass_of(get_class($this), $sub) ? 'yes' : 'no')."\n";
- echo str_pad('is_subclass_of( STRING:'.get_class($this).', '.$sub.',false) = ', 60). (is_subclass_of(get_class($this), $sub , false) ? 'yes' : 'no')."\n";
-
- // with autoload options..
- echo ">>> With Undefined\n";
- echo str_pad('is_a( STRING:undefB, '.$sub.',true) = ', 60). (is_a('undefB', $sub, true) ? 'yes' : 'no')."\n";
- echo str_pad('is_a( STRING:undefB, '.$sub.') = ', 60). (is_a('undefB', $sub) ? 'yes' : 'no')."\n";
- echo str_pad('is_subclass_of( STRING:undefB, '.$sub.',false) = ', 60). (is_subclass_of('undefB', $sub, false) ? 'yes' : 'no')."\n";
- echo str_pad('is_subclass_of( STRING:undefB, '.$sub.') = ', 60). (is_subclass_of('undefB', $sub) ? 'yes' : 'no')."\n";
- }
- function test() {
- echo $this->_is_a('base');
- echo $this->_is_a('derived_a');
- echo $this->_is_a('if_a');
- echo $this->_is_a('undefA');
- echo "\n";
- }
+ function _is_a($sub) {
+
+ echo "\n>>> With Defined class\n";
+ echo str_pad('is_a( OBJECT:'.get_class($this).', '.$sub.') = ', 60) . (is_a($this, $sub) ? 'yes' : 'no')."\n";
+ echo str_pad('is_a( STRING:'.get_class($this).', '.$sub.') = ', 60). (is_a(get_class($this), $sub) ? 'yes' : 'no')."\n";
+ echo str_pad('is_a( STRING:'.get_class($this).', '.$sub.', true) = ', 60). (is_a(get_class($this), $sub, true) ? 'yes' : 'no')."\n";
+ echo str_pad('is_subclass_of( OBJECT:'.get_class($this).', '.$sub.') = ', 60). (is_subclass_of($this, $sub) ? 'yes' : 'no')."\n";
+ echo str_pad('is_subclass_of( STRING:'.get_class($this).', '.$sub.') = ', 60). (is_subclass_of(get_class($this), $sub) ? 'yes' : 'no')."\n";
+ echo str_pad('is_subclass_of( STRING:'.get_class($this).', '.$sub.',false) = ', 60). (is_subclass_of(get_class($this), $sub , false) ? 'yes' : 'no')."\n";
+
+ // with autoload options..
+ echo ">>> With Undefined\n";
+ echo str_pad('is_a( STRING:undefB, '.$sub.',true) = ', 60). (is_a('undefB', $sub, true) ? 'yes' : 'no')."\n";
+ echo str_pad('is_a( STRING:undefB, '.$sub.') = ', 60). (is_a('undefB', $sub) ? 'yes' : 'no')."\n";
+ echo str_pad('is_subclass_of( STRING:undefB, '.$sub.',false) = ', 60). (is_subclass_of('undefB', $sub, false) ? 'yes' : 'no')."\n";
+ echo str_pad('is_subclass_of( STRING:undefB, '.$sub.') = ', 60). (is_subclass_of('undefB', $sub) ? 'yes' : 'no')."\n";
+ }
+ function test() {
+ echo $this->_is_a('base');
+ echo $this->_is_a('derived_a');
+ echo $this->_is_a('if_a');
+ echo $this->_is_a('undefA');
+ echo "\n";
+ }
}
class derived_a extends base implements if_a {
- function f_a() {}
+ function f_a() {}
}
class derived_b extends base implements if_a, if_b {
- function f_a() {}
- function f_b() {}
+ function f_a() {}
+ function f_b() {}
}
class derived_c extends derived_a implements if_b {
- function f_b() {}
+ function f_b() {}
}
class derived_d extends derived_c {
diff --git a/ext/standard/tests/class_object/is_a_variation_001.phpt b/ext/standard/tests/class_object/is_a_variation_001.phpt
index 563195cd0c..e9dfe0db6d 100644
--- a/ext/standard/tests/class_object/is_a_variation_001.phpt
+++ b/ext/standard/tests/class_object/is_a_variation_001.phpt
@@ -77,9 +77,9 @@ echo "Done";
--EXPECTF--
*** Testing is_a() : usage variations ***
-Notice: Undefined variable: undefined_var in %s on line 59
+Warning: Undefined variable: undefined_var in %s on line %d
-Notice: Undefined variable: unset_var in %s on line 62
+Warning: Undefined variable: unset_var in %s on line %d
Arg value 0
bool(false)
diff --git a/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt b/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt
index d65bfcbc26..37743f393e 100644
--- a/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt
+++ b/ext/standard/tests/class_object/is_subclass_of_variation_001.phpt
@@ -9,11 +9,11 @@ Test is_subclass_of() function : usage variations - unexpected type for arg 1
*/
// Note: basic use cases in Zend/tests/is_a.phpt
spl_autoload_register(function ($className) {
- echo "In autoload($className)\n";
+ echo "In autoload($className)\n";
});
-function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
- echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+function test_error_handler($err_no, $err_msg, $filename, $linenum) {
+ echo "Error: $err_no - $err_msg\n";
}
set_error_handler('test_error_handler');
@@ -84,10 +84,10 @@ foreach($values as $value) {
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing is_subclass_of() : usage variations ***
-Error: 8 - Undefined variable: undefined_var, %s(69)
-Error: 8 - Undefined variable: unset_var, %s(72)
+Error: 2 - Undefined variable: undefined_var
+Error: 2 - Undefined variable: unset_var
Arg value 0
bool(false)
@@ -115,23 +115,23 @@ bool(false)
Arg value 0.5
bool(false)
-Error: 8 - Array to string conversion, %sis_subclass_of_variation_001.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
bool(false)
-Error: 8 - Array to string conversion, %sis_subclass_of_variation_001.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
bool(false)
-Error: 8 - Array to string conversion, %sis_subclass_of_variation_001.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
bool(false)
-Error: 8 - Array to string conversion, %sis_subclass_of_variation_001.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
bool(false)
-Error: 8 - Array to string conversion, %sis_subclass_of_variation_001.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
bool(false)
diff --git a/ext/standard/tests/class_object/is_subclass_of_variation_004.phpt b/ext/standard/tests/class_object/is_subclass_of_variation_004.phpt
index 0a4c575258..c9409dcac8 100644
--- a/ext/standard/tests/class_object/is_subclass_of_variation_004.phpt
+++ b/ext/standard/tests/class_object/is_subclass_of_variation_004.phpt
@@ -9,11 +9,11 @@ Test is_subclass_of() function : usage variations - unexpected type for arg 1 w
*/
// Note: basic use cases in Zend/tests/is_a.phpt
spl_autoload_register(function ($className) {
- echo "In autoload($className)\n";
+ echo "In autoload($className)\n";
});
-function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
- echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+function test_error_handler($err_no, $err_msg, $filename, $linenum) {
+ echo "Error: $err_no - $err_msg\n";
}
set_error_handler('test_error_handler');
@@ -84,10 +84,10 @@ foreach($values as $value) {
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing is_subclass_of() : usage variations ***
-Error: 8 - Undefined variable: undefined_var, %s(69)
-Error: 8 - Undefined variable: unset_var, %s(72)
+Error: 2 - Undefined variable: undefined_var
+Error: 2 - Undefined variable: unset_var
Arg value 0
bool(false)
@@ -115,23 +115,23 @@ bool(false)
Arg value 0.5
bool(false)
-Error: 8 - Array to string conversion, %sis_subclass_of_variation_004.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
bool(false)
-Error: 8 - Array to string conversion, %sis_subclass_of_variation_004.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
bool(false)
-Error: 8 - Array to string conversion, %sis_subclass_of_variation_004.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
bool(false)
-Error: 8 - Array to string conversion, %sis_subclass_of_variation_004.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
bool(false)
-Error: 8 - Array to string conversion, %sis_subclass_of_variation_004.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
bool(false)
diff --git a/ext/standard/tests/class_object/method_exists_basic_001.phpt b/ext/standard/tests/class_object/method_exists_basic_001.phpt
index c0b656b3f9..5d1e2c89df 100644
--- a/ext/standard/tests/class_object/method_exists_basic_001.phpt
+++ b/ext/standard/tests/class_object/method_exists_basic_001.phpt
@@ -9,30 +9,30 @@ method_exists() on userspace classes; static & non-static methods with various v
*/
Class B {
- public function inherit_pub() {}
- protected function inherit_prot() {}
- private function inherit_priv() {}
- static public function inherit_static_pub() {}
- static protected function inherit_static_prot() {}
- static private function inherit_static_priv() {}
+ public function inherit_pub() {}
+ protected function inherit_prot() {}
+ private function inherit_priv() {}
+ static public function inherit_static_pub() {}
+ static protected function inherit_static_prot() {}
+ static private function inherit_static_priv() {}
}
Class C extends B {
- public function pub() {}
- protected function prot() {}
- private function priv() {}
- static public function static_pub() {}
- static protected function static_prot() {}
- static private function static_priv() {}
+ public function pub() {}
+ protected function prot() {}
+ private function priv() {}
+ static public function static_pub() {}
+ static protected function static_prot() {}
+ static private function static_priv() {}
}
$methods = array(
- 'inherit_pub', 'inherit_prot', 'inherit_priv',
- 'inherit_static_pub', 'inherit_static_prot', 'inherit_static_priv',
- 'pub', 'prot', 'priv',
- 'static_pub', 'static_prot', 'static_priv',
- 'non_existent');
+ 'inherit_pub', 'inherit_prot', 'inherit_priv',
+ 'inherit_static_pub', 'inherit_static_prot', 'inherit_static_priv',
+ 'pub', 'prot', 'priv',
+ 'static_pub', 'static_prot', 'static_priv',
+ 'non_existent');
echo "\n ---(Using string class name)---\n";
foreach ($methods as $method) {
diff --git a/ext/standard/tests/class_object/method_exists_basic_003.phpt b/ext/standard/tests/class_object/method_exists_basic_003.phpt
index e92b7a9135..42225a8ebd 100644
--- a/ext/standard/tests/class_object/method_exists_basic_003.phpt
+++ b/ext/standard/tests/class_object/method_exists_basic_003.phpt
@@ -9,7 +9,7 @@ method_exists() on non-existent class, with __autoload().
*/
spl_autoload_register(function ($name) {
- echo "In autoload($name)\n";
+ echo "In autoload($name)\n";
});
var_dump(method_exists('UndefC', 'func'));
diff --git a/ext/standard/tests/class_object/method_exists_variation_001.phpt b/ext/standard/tests/class_object/method_exists_variation_001.phpt
index 4accebe20a..0f2293cf7b 100644
--- a/ext/standard/tests/class_object/method_exists_variation_001.phpt
+++ b/ext/standard/tests/class_object/method_exists_variation_001.phpt
@@ -9,11 +9,11 @@ Test method_exists() function : usage variations - unexpected type for arg 1
*/
spl_autoload_register(function ($className) {
- echo "In autoload($className)\n";
+ echo "In autoload($className)\n";
});
-function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
- echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+function test_error_handler($err_no, $err_msg, $filename, $linenum) {
+ echo "Error: $err_no - $err_msg\n";
}
set_error_handler('test_error_handler');
@@ -83,10 +83,10 @@ foreach($values as $value) {
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing method_exists() : usage variations ***
-Error: 8 - Undefined variable: undefined_var, %s(68)
-Error: 8 - Undefined variable: unset_var, %s(71)
+Error: 2 - Undefined variable: undefined_var
+Error: 2 - Undefined variable: unset_var
Arg value 0
bool(false)
@@ -114,23 +114,23 @@ bool(false)
Arg value 0.5
bool(false)
-Error: 8 - Array to string conversion, %smethod_exists_variation_001.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
bool(false)
-Error: 8 - Array to string conversion, %smethod_exists_variation_001.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
bool(false)
-Error: 8 - Array to string conversion, %smethod_exists_variation_001.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
bool(false)
-Error: 8 - Array to string conversion, %smethod_exists_variation_001.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
bool(false)
-Error: 8 - Array to string conversion, %smethod_exists_variation_001.php(%d)
+Error: 2 - Array to string conversion
Arg value Array
bool(false)
diff --git a/ext/standard/tests/class_object/method_exists_variation_003.phpt b/ext/standard/tests/class_object/method_exists_variation_003.phpt
index d5835b0b87..72b63f1e33 100644
--- a/ext/standard/tests/class_object/method_exists_variation_003.phpt
+++ b/ext/standard/tests/class_object/method_exists_variation_003.phpt
@@ -11,7 +11,7 @@ Test method_exists() function : variation - Case sensitivity
echo "*** Testing method_exists() : variation ***\n";
Class caseSensitivityTest {
- public function myMethod() {}
+ public function myMethod() {}
}
var_dump(method_exists(new casesensitivitytest, 'myMetHOD'));
diff --git a/ext/standard/tests/class_object/property_exists_error.phpt b/ext/standard/tests/class_object/property_exists_error.phpt
index 217a5c61f9..43f68badd1 100644
--- a/ext/standard/tests/class_object/property_exists_error.phpt
+++ b/ext/standard/tests/class_object/property_exists_error.phpt
@@ -10,38 +10,15 @@ Test property_exists() function : error conditions
echo "*** Testing property_exists() : error conditions ***\n";
-$object_or_class = "obj";
-$property_name = 'string_val';
-$extra_arg = 10;
-
-
-echo "\n-- Testing property_exists() function with more than expected no. of arguments --\n";
-var_dump( property_exists($object_or_class, $property_name, $extra_arg) );
-
-
-echo "\n-- Testing property_exists() function with less than expected no. of arguments --\n";
-var_dump( property_exists($object_or_class) );
-
echo "\n-- Testing property_exists() function with incorrect arguments --\n";
+$property_name = 'string_val';
var_dump( property_exists(10, $property_name) );
?>
-===DONE===
--EXPECTF--
*** Testing property_exists() : error conditions ***
--- Testing property_exists() function with more than expected no. of arguments --
-
-Warning: property_exists() expects exactly 2 parameters, 3 given in %sproperty_exists_error.php on line %d
-NULL
-
--- Testing property_exists() function with less than expected no. of arguments --
-
-Warning: property_exists() expects exactly 2 parameters, 1 given in %sproperty_exists_error.php on line %d
-NULL
-
-- Testing property_exists() function with incorrect arguments --
Warning: First parameter must either be an object or the name of an existing class in %sproperty_exists_error.php on line %d
NULL
-===DONE===
diff --git a/ext/standard/tests/class_object/property_exists_variation1.phpt b/ext/standard/tests/class_object/property_exists_variation1.phpt
index 4b0ce2baff..f32790a029 100644
--- a/ext/standard/tests/class_object/property_exists_variation1.phpt
+++ b/ext/standard/tests/class_object/property_exists_variation1.phpt
@@ -21,7 +21,6 @@ echo "\ntesting __get magic method\n";
var_dump(property_exists("AutoTest", "foo"));
?>
-===DONE===
--EXPECT--
*** Testing property_exists() : class auto loading ***
@@ -30,4 +29,3 @@ bool(true)
testing __get magic method
bool(false)
-===DONE===
diff --git a/ext/standard/tests/class_object/trait_exists_basic_001.phpt b/ext/standard/tests/class_object/trait_exists_basic_001.phpt
index 708c6c91e4..55b92da0d2 100644
--- a/ext/standard/tests/class_object/trait_exists_basic_001.phpt
+++ b/ext/standard/tests/class_object/trait_exists_basic_001.phpt
@@ -11,7 +11,7 @@ Test trait_exists() function : basic functionality
echo "*** Testing trait_exists() : basic functionality ***\n";
spl_autoload_register(function ($traitName) {
- echo "In autoload($traitName)\n";
+ echo "In autoload($traitName)\n";
});
trait MyTrait {}
diff --git a/ext/standard/tests/dir/bug41693.phpt b/ext/standard/tests/dir/bug41693.phpt
new file mode 100644
index 0000000000..2f9fcabb9a
--- /dev/null
+++ b/ext/standard/tests/dir/bug41693.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Bug #41693 (scandir() allows empty directory names)
+--FILE--
+<?php
+
+try {
+ var_dump(scandir(''));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+}
+
+?>
+--EXPECT--
+Directory name cannot be empty
diff --git a/ext/standard/tests/dir/bug72625.phpt b/ext/standard/tests/dir/bug72625.phpt
index b64010fcd4..2ea6da9699 100644
--- a/ext/standard/tests/dir/bug72625.phpt
+++ b/ext/standard/tests/dir/bug72625.phpt
@@ -11,7 +11,7 @@ if (substr(PHP_OS, 0, 3) != 'WIN') {
$base = sys_get_temp_dir() . "/" . md5(uniqid());
while (strlen($base) < 260) {
- $base = "$base/" . md5(uniqid());
+ $base = "$base/" . md5(uniqid());
}
$f0 = "$base/_test/documents/projects/myproject/vendor/name/library/classpath";
@@ -22,25 +22,24 @@ mkdir($f0, 0777, true);
var_dump(
- $f0,
- file_exists($f0),
- realpath($f0),
- dirname($f0),
-
- $f1,
- file_exists($f1),
- realpath($f1),
- dirname($f1)
+ $f0,
+ file_exists($f0),
+ realpath($f0),
+ dirname($f0),
+
+ $f1,
+ file_exists($f1),
+ realpath($f1),
+ dirname($f1)
);
$tmp = $f0;
while ($tmp > $base) {
- rmdir($tmp);
- $tmp = dirname($tmp);
+ rmdir($tmp);
+ $tmp = dirname($tmp);
}
?>
-===DONE===
--EXPECTF--
string(%d) "%s/_test/documents/projects/myproject/vendor/name/library/classpath"
bool(true)
@@ -50,4 +49,3 @@ string(%d) "%s/_test/documents/projects/myproject/vendor/name/library/classpath/
bool(true)
string(%d) "%s\_test\documents\projects\myproject\vendor\name\library\classpath"
string(%d) "%s/_test/documents/projects/myproject/vendor/name/library"
-===DONE===
diff --git a/ext/standard/tests/dir/bug73877.phpt b/ext/standard/tests/dir/bug73877.phpt
index 633a4eef81..ceb272ea65 100644
--- a/ext/standard/tests/dir/bug73877.phpt
+++ b/ext/standard/tests/dir/bug73877.phpt
@@ -21,10 +21,10 @@ mkdir($dir1);
`mklink /J $junk0 $dir0`;
var_dump(
- readlink($dir0),
- readlink($dir1),
- readlink($junk0),
- strlen(readlink($dir0)) === strlen(readlink($junk0))
+ readlink($dir0),
+ readlink($dir1),
+ readlink($junk0),
+ strlen(readlink($dir0)) === strlen(readlink($junk0))
);
?>
diff --git a/ext/standard/tests/dir/chdir_basic-win32-mb.phpt b/ext/standard/tests/dir/chdir_basic-win32-mb.phpt
index d2d590ff3c..680ff8bd3d 100644
--- a/ext/standard/tests/dir/chdir_basic-win32-mb.phpt
+++ b/ext/standard/tests/dir/chdir_basic-win32-mb.phpt
@@ -40,7 +40,6 @@ echo "\n-- Testing chdir() with relative paths: --\n";
var_dump(chdir($level_two_dir_name));
var_dump(getcwd());
?>
-===DONE===
--CLEAN--
<?php
$base_dir_path = __DIR__ . '/chdir_basic-win32-mb';
@@ -59,4 +58,3 @@ string(%d) "%sç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™level_one"
-- Testing chdir() with relative paths: --
bool(true)
string(%d) "%sç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™level_one%eç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™level_two"
-===DONE===
diff --git a/ext/standard/tests/dir/chdir_basic.phpt b/ext/standard/tests/dir/chdir_basic.phpt
index 6c96898dd8..6a216f0362 100644
--- a/ext/standard/tests/dir/chdir_basic.phpt
+++ b/ext/standard/tests/dir/chdir_basic.phpt
@@ -33,7 +33,6 @@ echo "\n-- Testing chdir() with relative paths: --\n";
var_dump(chdir($level1_two_dir_name));
var_dump(getcwd());
?>
-===DONE===
--CLEAN--
<?php
$file_path = __DIR__;
@@ -50,4 +49,3 @@ string(%d) "%slevel1_one"
-- Testing chdir() with relative paths: --
bool(true)
string(%d) "%slevel1_one%elevel1_two"
-===DONE===
diff --git a/ext/standard/tests/dir/chdir_error2-win32-mb.phpt b/ext/standard/tests/dir/chdir_error2-win32-mb.phpt
index 4f6272ce4f..403dcef574 100644
--- a/ext/standard/tests/dir/chdir_error2-win32-mb.phpt
+++ b/ext/standard/tests/dir/chdir_error2-win32-mb.phpt
@@ -23,10 +23,8 @@ $directory = __FILE__ . '/ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™idonotexist';
var_dump(chdir($directory));
?>
-===DONE===
--EXPECTF--
*** Testing chdir() : error conditions ***
Warning: chdir(): %s (errno %d) in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/standard/tests/dir/chdir_error2.phpt b/ext/standard/tests/dir/chdir_error2.phpt
index 6c322a2e3a..414ae1427c 100644
--- a/ext/standard/tests/dir/chdir_error2.phpt
+++ b/ext/standard/tests/dir/chdir_error2.phpt
@@ -17,10 +17,8 @@ $directory = __FILE__ . '/idonotexist';
var_dump(chdir($directory));
?>
-===DONE===
--EXPECTF--
*** Testing chdir() : error conditions ***
Warning: chdir(): %s (errno %d) in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/standard/tests/dir/chdir_variation2-win32-mb.phpt b/ext/standard/tests/dir/chdir_variation2-win32-mb.phpt
index 9b1d8f1e9c..9e1b2e9aa0 100644
--- a/ext/standard/tests/dir/chdir_variation2-win32-mb.phpt
+++ b/ext/standard/tests/dir/chdir_variation2-win32-mb.phpt
@@ -65,7 +65,6 @@ var_dump(chdir($level_two_dir_path));
var_dump(chdir("../../$level_one_dir_name"));
var_dump(getcwd());
?>
-===DONE===
--CLEAN--
<?php
$base_dir_path = __DIR__ . '/chdir_variation2-win32-mb';
@@ -109,4 +108,3 @@ string(%d) "%sç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™level_one%eç§ã¯ã‚¬ãƒ©ã‚¹ã‚’é
bool(true)
bool(true)
string(%d) "%sç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™level_one"
-===DONE===
diff --git a/ext/standard/tests/dir/chdir_variation2.phpt b/ext/standard/tests/dir/chdir_variation2.phpt
index 7f9c3845ee..acab454ef6 100644
--- a/ext/standard/tests/dir/chdir_variation2.phpt
+++ b/ext/standard/tests/dir/chdir_variation2.phpt
@@ -59,7 +59,6 @@ var_dump(chdir("../../$level2_one_dir_name"));
var_dump(getcwd());
?>
-===DONE===
--CLEAN--
<?php
$file_path = __DIR__;
@@ -101,4 +100,3 @@ string(%d) "%slevel2_one%elevel2_two"
bool(true)
bool(true)
string(%d) "%slevel2_one"
-===DONE===
diff --git a/ext/standard/tests/dir/closedir_basic-win32-mb.phpt b/ext/standard/tests/dir/closedir_basic-win32-mb.phpt
index f74ac29952..7db6b7740a 100644
--- a/ext/standard/tests/dir/closedir_basic-win32-mb.phpt
+++ b/ext/standard/tests/dir/closedir_basic-win32-mb.phpt
@@ -34,13 +34,12 @@ echo "\n-- Call closedir() with \$dir_handle argument supplied: --\n";
$dh2 = opendir($dir_path);
if ((int)$dh1 === (int)$dh2) {
- echo "\nNo new resource created\n";
+ echo "\nNo new resource created\n";
}
var_dump(closedir($dh2));
echo "-- Check Directory Handle: --\n";
var_dump($dh2);
?>
-===DONE===
--CLEAN--
<?php
$base_dir = __DIR__;
@@ -59,4 +58,3 @@ resource(%d) of type (Unknown)
NULL
-- Check Directory Handle: --
resource(%d) of type (Unknown)
-===DONE===
diff --git a/ext/standard/tests/dir/closedir_basic.phpt b/ext/standard/tests/dir/closedir_basic.phpt
index 94aaebf9f9..5ec72cd8a5 100644
--- a/ext/standard/tests/dir/closedir_basic.phpt
+++ b/ext/standard/tests/dir/closedir_basic.phpt
@@ -28,13 +28,12 @@ echo "\n-- Call closedir() with \$dir_handle argument supplied: --\n";
$dh2 = opendir($dir_path);
if ((int)$dh1 === (int)$dh2) {
- echo "\nNo new resource created\n";
+ echo "\nNo new resource created\n";
}
var_dump(closedir($dh2));
echo "-- Check Directory Handle: --\n";
var_dump($dh2);
?>
-===DONE===
--CLEAN--
<?php
$base_dir = __DIR__;
@@ -53,4 +52,3 @@ resource(%d) of type (Unknown)
NULL
-- Check Directory Handle: --
resource(%d) of type (Unknown)
-===DONE===
diff --git a/ext/standard/tests/dir/closedir_error-win32-mb.phpt b/ext/standard/tests/dir/closedir_error-win32-mb.phpt
deleted file mode 100644
index e0a399c688..0000000000
--- a/ext/standard/tests/dir/closedir_error-win32-mb.phpt
+++ /dev/null
@@ -1,51 +0,0 @@
---TEST--
-Test closedir() function : error conditions - Pass incorrect number of arguments
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) != 'WIN') {
- die("skip Valid only on Windows");
-}
-?>
---FILE--
-<?php
-/* Prototype : void closedir([resource $dir_handle])
- * Description: Close directory connection identified by the dir_handle
- * Source code: ext/standard/dir.c
- * Alias to functions: close
- */
-
-/*
- * Pass incorrect number of arguments to closedir() to test behaviour
- */
-
-echo "*** Testing closedir() : error conditions ***\n";
-
-
-//Test closedir with one more than the expected number of arguments
-echo "\n-- Testing closedir() function with more than expected no. of arguments --\n";
-
-$dir_path = __DIR__ . '\ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™closedir_error';
-mkdir($dir_path);
-$dir_handle = opendir($dir_path);
-
-$extra_arg = 10;
-var_dump( closedir($dir_handle, $extra_arg) );
-
-//successfully close the directory handle so can delete in CLEAN section
-closedir($dir_handle);
-?>
-===DONE===
---CLEAN--
-<?php
-$base_dir = __DIR__;
-$dir_path = $base_dir . '\ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™closedir_error';
-rmdir($dir_path);
-?>
---EXPECTF--
-*** Testing closedir() : error conditions ***
-
--- Testing closedir() function with more than expected no. of arguments --
-
-Warning: closedir() expects at most 1 parameter, 2 given in %s on line %d
-NULL
-===DONE===
diff --git a/ext/standard/tests/dir/closedir_variation2-win32-mb.phpt b/ext/standard/tests/dir/closedir_variation2-win32-mb.phpt
index 07b9ab869a..a4013676ff 100644
--- a/ext/standard/tests/dir/closedir_variation2-win32-mb.phpt
+++ b/ext/standard/tests/dir/closedir_variation2-win32-mb.phpt
@@ -32,11 +32,14 @@ echo "Directory Handle: ";
var_dump($dh);
echo "\n-- Close directory handle second time: --\n";
-var_dump(closedir($dh));
+try {
+ var_dump(closedir($dh));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Directory Handle: ";
var_dump($dh);
?>
-===DONE===
--CLEAN--
<?php
$directory = __DIR__ . "/ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™closedir_variation2";
@@ -50,8 +53,5 @@ NULL
Directory Handle: resource(%d) of type (Unknown)
-- Close directory handle second time: --
-
-Warning: closedir(): %s is not a valid Directory resource in %s on line %d
-bool(false)
+closedir(): %s is not a valid Directory resource
Directory Handle: resource(%d) of type (Unknown)
-===DONE===
diff --git a/ext/standard/tests/dir/closedir_variation2.phpt b/ext/standard/tests/dir/closedir_variation2.phpt
index cb85750e71..ee6e876ae8 100644
--- a/ext/standard/tests/dir/closedir_variation2.phpt
+++ b/ext/standard/tests/dir/closedir_variation2.phpt
@@ -26,11 +26,14 @@ echo "Directory Handle: ";
var_dump($dh);
echo "\n-- Close directory handle second time: --\n";
-var_dump(closedir($dh));
+try {
+ var_dump(closedir($dh));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Directory Handle: ";
var_dump($dh);
?>
-===DONE===
--CLEAN--
<?php
$directory = __DIR__ . "/closedir_variation2";
@@ -44,8 +47,5 @@ NULL
Directory Handle: resource(%d) of type (Unknown)
-- Close directory handle second time: --
-
-Warning: closedir(): supplied resource is not a valid Directory resource in %s on line %d
-bool(false)
+closedir(): supplied resource is not a valid Directory resource
Directory Handle: resource(%d) of type (Unknown)
-===DONE===
diff --git a/ext/standard/tests/dir/closedir_variation3.phpt b/ext/standard/tests/dir/closedir_variation3.phpt
index 7d7fdcbf0e..1d9c644a3e 100644
--- a/ext/standard/tests/dir/closedir_variation3.phpt
+++ b/ext/standard/tests/dir/closedir_variation3.phpt
@@ -18,16 +18,18 @@ echo "\n-- Open a file using fopen() --\n";
var_dump($fp = fopen(__FILE__, 'r'));
echo "\n-- Try to close the file pointer using closedir() --\n";
-var_dump(closedir($fp));
-
+try {
+ var_dump(closedir($fp));
+} catch (\TypeError $e) {
+ echo $e->getMessage() . "\n";
+}
echo "\n-- Check file pointer: --\n";
var_dump($fp);
if(is_resource($fp)) {
- fclose($fp);
+ fclose($fp);
}
?>
-===DONE===
--EXPECTF--
*** Testing closedir() : usage variations ***
@@ -35,10 +37,7 @@ if(is_resource($fp)) {
resource(%d) of type (stream)
-- Try to close the file pointer using closedir() --
-
-Warning: closedir(): %d is not a valid Directory resource in %s on line %d
-bool(false)
+%d is not a valid Directory resource
-- Check file pointer: --
resource(%d) of type (stream)
-===DONE===
diff --git a/ext/standard/tests/dir/closedir_without_arg.phpt b/ext/standard/tests/dir/closedir_without_arg.phpt
new file mode 100644
index 0000000000..27884c1a2b
--- /dev/null
+++ b/ext/standard/tests/dir/closedir_without_arg.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Calling closedir() without argument and without opening a directory beforehand
+--FILE--
+<?php
+try {
+ closedir();
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+?>
+--EXPECT--
+No resource supplied
diff --git a/ext/standard/tests/dir/dir_basic-win32-mb.phpt b/ext/standard/tests/dir/dir_basic-win32-mb.phpt
index d643846852..2106bc37d6 100644
--- a/ext/standard/tests/dir/dir_basic-win32-mb.phpt
+++ b/ext/standard/tests/dir/dir_basic-win32-mb.phpt
@@ -44,8 +44,12 @@ echo "\nClose directory:\n";
var_dump( $d->close() );
var_dump( $d );
-echo "\nTest read after closing the dir:";
-var_dump( $d->read() );
+echo "\nTest read after closing the dir:\n";
+try {
+ var_dump( $d->read() );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
// delete temp files
delete_files($dir_path, 3, "ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™dir_basic", 1, ".tmp");
@@ -87,6 +91,5 @@ object(Directory)#%d (2) {
}
Test read after closing the dir:
-Warning: Directory::read(): %s is not a valid Directory resource in %s on line %d
-bool(false)
+Directory::read(): %s is not a valid Directory resource
Done
diff --git a/ext/standard/tests/dir/dir_basic.phpt b/ext/standard/tests/dir/dir_basic.phpt
index 4360a749c7..15f8061b7b 100644
--- a/ext/standard/tests/dir/dir_basic.phpt
+++ b/ext/standard/tests/dir/dir_basic.phpt
@@ -38,8 +38,12 @@ echo "\nClose directory:\n";
var_dump( $d->close() );
var_dump( $d );
-echo "\nTest read after closing the dir:";
-var_dump( $d->read() );
+echo "\nTest read after closing the dir:\n";
+try {
+ var_dump( $d->read() );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
// delete temp files
delete_files($dir_path, 3, "dir_basic", 1, ".tmp");
@@ -81,6 +85,5 @@ object(Directory)#%d (2) {
}
Test read after closing the dir:
-Warning: Directory::read(): supplied resource is not a valid Directory resource in %s on line %d
-bool(false)
+Directory::read(): supplied resource is not a valid Directory resource
Done
diff --git a/ext/standard/tests/dir/dir_bug73971.phpt b/ext/standard/tests/dir/dir_bug73971.phpt
index 3649b74329..1fd3eb6691 100644
--- a/ext/standard/tests/dir/dir_bug73971.phpt
+++ b/ext/standard/tests/dir/dir_bug73971.phpt
@@ -26,11 +26,10 @@ $d->close();
echo "\ntest DirectoryIterator\n";
$dir = new DirectoryIterator($base);
foreach ($dir as $finfo) {
- var_dump($finfo->getFilename());
+ var_dump($finfo->getFilename());
}
?>
-==DONE==
--CLEAN--
<?php
$base = __DIR__ . DIRECTORY_SEPARATOR . "bug73971";
@@ -51,4 +50,3 @@ test DirectoryIterator
string(1) "."
string(2) ".."
string(432) "テストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテストテスト"
-==DONE==
diff --git a/ext/standard/tests/dir/dir_variation3.phpt b/ext/standard/tests/dir/dir_variation3.phpt
index b79b2befe4..8873c715cb 100644
--- a/ext/standard/tests/dir/dir_variation3.phpt
+++ b/ext/standard/tests/dir/dir_variation3.phpt
@@ -58,7 +58,7 @@ for($count = 0; $count < count($permission_values); $count++) {
// create the dir now
@mkdir($dir_path);
- // change the dir permisson to test dir on it
+ // change the dir permission to test dir on it
var_dump( chmod($dir_path, $permission_values[$count]) );
// try to get dir handle
diff --git a/ext/standard/tests/dir/dir_variation5.phpt b/ext/standard/tests/dir/dir_variation5.phpt
index ea040bed8a..7492ee55fe 100644
--- a/ext/standard/tests/dir/dir_variation5.phpt
+++ b/ext/standard/tests/dir/dir_variation5.phpt
@@ -30,6 +30,6 @@ echo "Done";
--EXPECTF--
*** Testing dir() : open a file instead of a directory ***
-Warning: dir(%s): failed to open dir: %s in %s on line %d
+Warning: dir(%s): Failed to open directory: %s in %s on line %d
bool(false)
Done
diff --git a/ext/standard/tests/dir/dir_variation6.phpt b/ext/standard/tests/dir/dir_variation6.phpt
index c7ce2bc080..ca0a47e818 100644
--- a/ext/standard/tests/dir/dir_variation6.phpt
+++ b/ext/standard/tests/dir/dir_variation6.phpt
@@ -48,10 +48,10 @@ echo "Done";
*** Testing dir() : open a non-existent directory ***
-- opening previously removed directory --
-Warning: dir(%s): failed to open dir: %s in %s on line %d
+Warning: dir(%s): Failed to open directory: %s in %s on line %d
bool(false)
-- opening non-existent directory --
-Warning: dir(%s): failed to open dir: %s in %s on line %d
+Warning: dir(%s): Failed to open directory: %s in %s on line %d
bool(false)
Done
diff --git a/ext/standard/tests/dir/dir_variation7.phpt b/ext/standard/tests/dir/dir_variation7.phpt
index c2e6519dfe..5083c66d7a 100644
--- a/ext/standard/tests/dir/dir_variation7.phpt
+++ b/ext/standard/tests/dir/dir_variation7.phpt
@@ -42,14 +42,14 @@ chmod($sub_dir_path, 0777);
$child_dir_path = $sub_dir_path."/child_dir";
@mkdir($child_dir_path);
-// remove the write and execute permisson from sub parent
+// remove the write and execute permission from sub parent
chmod($sub_dir_path, 0444);
echo "-- After restricting 1st level parent directory --\n";
$d = dir($child_dir_path); // try to open, expected failure
var_dump( $d ); // dump it
-// remove the execute permisson from parent dir, allowing all permission for sub dir
-chmod($sub_dir_path, 0777); // all permisson to sub dir
+// remove the execute permission from parent dir, allowing all permission for sub dir
+chmod($sub_dir_path, 0777); // all permission to sub dir
chmod($parent_dir_path, 0666); // restricting parent directory
echo "-- After restricting parent directory --\n";
$d = dir($child_dir_path); // try to open, expected failure
@@ -77,10 +77,10 @@ rmdir($parent_dir_path);
*** Testing dir() : remove execute permission from the parent dir ***
-- After restricting 1st level parent directory --
-Warning: dir(%s/dir_variation7/sub_dir/child_dir): failed to open dir: %s in %s on line %d
+Warning: dir(%s/dir_variation7/sub_dir/child_dir): Failed to open directory: %s in %s on line %d
bool(false)
-- After restricting parent directory --
-Warning: dir(%s/dir_variation7/sub_dir/child_dir): failed to open dir: %s in %s on line %d
+Warning: dir(%s/dir_variation7/sub_dir/child_dir): Failed to open directory: %s in %s on line %d
bool(false)
Done
diff --git a/ext/standard/tests/dir/dir_variation8.phpt b/ext/standard/tests/dir/dir_variation8.phpt
index 8664a33e34..3b5aecb8a3 100644
--- a/ext/standard/tests/dir/dir_variation8.phpt
+++ b/ext/standard/tests/dir/dir_variation8.phpt
@@ -45,16 +45,16 @@ echo "Done";
*** Testing dir() : checking with wildcard characters ***
-- wildcard = '*' --
-Warning: dir(%s/dir_var*): failed to open dir: %s in %s on line %d
+Warning: dir(%s/dir_var*): Failed to open directory: %s in %s on line %d
bool(false)
-Warning: dir(%s/*): failed to open dir: %s in %s on line %d
+Warning: dir(%s/*): Failed to open directory: %s in %s on line %d
bool(false)
-- wildcard = '?' --
-Warning: dir(%s/dir_variation81/sub_dir?): failed to open dir: %s in %s on line %d
+Warning: dir(%s/dir_variation81/sub_dir?): Failed to open directory: %s in %s on line %d
bool(false)
-Warning: dir(%s/dir_variation81/sub?dir1): failed to open dir: %s in %s on line %d
+Warning: dir(%s/dir_variation81/sub?dir1): Failed to open directory: %s in %s on line %d
bool(false)
Done
diff --git a/ext/standard/tests/dir/dir_variation9.phpt b/ext/standard/tests/dir/dir_variation9.phpt
index 50f6d6c3ce..5b398c383c 100644
--- a/ext/standard/tests/dir/dir_variation9.phpt
+++ b/ext/standard/tests/dir/dir_variation9.phpt
@@ -103,15 +103,15 @@ object(Directory)#%d (2) {
-- With invalid paths --
-Warning: dir(%s/dir_variation91/sub_dir12/sub_dir111/..): failed to open dir: %s in %s on line %d
+Warning: dir(%s/dir_variation91/sub_dir12/sub_dir111/..): Failed to open directory: %s in %s on line %d
bool(false)
-Warning: dir(%s/dir_variation92/sub_dir21/../dir_variation91): failed to open dir: %s in %s on line %d
+Warning: dir(%s/dir_variation92/sub_dir21/../dir_variation91): Failed to open directory: %s in %s on line %d
bool(false)
-Warning: dir(%s/dir_variation92/sub_dir21/../../dir_variation91/sub_dir12/..): failed to open dir: %s in %s on line %d
+Warning: dir(%s/dir_variation92/sub_dir21/../../dir_variation91/sub_dir12/..): Failed to open directory: %s in %s on line %d
bool(false)
-Warning: dir(%s/dir_variation91/sub_dir11/sub_dir111/../../dir_variation92/sub_dir21/..): failed to open dir: %s in %s on line %d
+Warning: dir(%s/dir_variation91/sub_dir11/sub_dir111/../../dir_variation92/sub_dir21/..): Failed to open directory: %s in %s on line %d
bool(false)
Done
diff --git a/ext/standard/tests/dir/getcwd_basic-win32-mb.phpt b/ext/standard/tests/dir/getcwd_basic-win32-mb.phpt
index 41d90864ef..accb70243d 100644
--- a/ext/standard/tests/dir/getcwd_basic-win32-mb.phpt
+++ b/ext/standard/tests/dir/getcwd_basic-win32-mb.phpt
@@ -27,7 +27,6 @@ var_dump(getcwd());
chdir($directory);
var_dump(getcwd());
?>
-===DONE===
--CLEAN--
<?php
$directory = __DIR__ . "/ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™getcwd_basic";
@@ -37,4 +36,3 @@ rmdir($directory);
*** Testing getcwd() : basic functionality ***
string(%d) "%s"
string(%d) "%s%eç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™getcwd_basic"
-===DONE===
diff --git a/ext/standard/tests/dir/getcwd_basic.phpt b/ext/standard/tests/dir/getcwd_basic.phpt
index 577521a347..0067312041 100644
--- a/ext/standard/tests/dir/getcwd_basic.phpt
+++ b/ext/standard/tests/dir/getcwd_basic.phpt
@@ -21,7 +21,6 @@ var_dump(getcwd());
chdir($directory);
var_dump(getcwd());
?>
-===DONE===
--CLEAN--
<?php
$directory = __DIR__ . "/getcwd_basic";
@@ -31,4 +30,3 @@ rmdir($directory);
*** Testing getcwd() : basic functionality ***
string(%d) "%s"
string(%d) "%s%egetcwd_basic"
-===DONE===
diff --git a/ext/standard/tests/dir/opendir_basic-win32-mb.phpt b/ext/standard/tests/dir/opendir_basic-win32-mb.phpt
index 8bdba8a5ce..340561b218 100644
--- a/ext/standard/tests/dir/opendir_basic-win32-mb.phpt
+++ b/ext/standard/tests/dir/opendir_basic-win32-mb.phpt
@@ -46,7 +46,6 @@ var_dump($dh1);
closedir($dh2);
var_dump($dh2);
?>
-===DONE===
--CLEAN--
<?php
$base_dir_path = __DIR__ . '/opendir_basic-win32-mb';
@@ -67,4 +66,3 @@ resource(%d) of type (stream)
-- Close directory handles: --
resource(%d) of type (Unknown)
resource(%d) of type (Unknown)
-===DONE===
diff --git a/ext/standard/tests/dir/opendir_basic.phpt b/ext/standard/tests/dir/opendir_basic.phpt
index fc5af44e66..6947e77952 100644
--- a/ext/standard/tests/dir/opendir_basic.phpt
+++ b/ext/standard/tests/dir/opendir_basic.phpt
@@ -40,7 +40,6 @@ var_dump($dh1);
closedir($dh2);
var_dump($dh2);
?>
-===DONE===
--CLEAN--
<?php
$base_dir_path = __DIR__ . '/opendir_basic';
@@ -61,4 +60,3 @@ resource(%d) of type (stream)
-- Close directory handles: --
resource(%d) of type (Unknown)
resource(%d) of type (Unknown)
-===DONE===
diff --git a/ext/standard/tests/dir/opendir_error2.phpt b/ext/standard/tests/dir/opendir_error2.phpt
index 47b7709cec..5d7128921b 100644
--- a/ext/standard/tests/dir/opendir_error2.phpt
+++ b/ext/standard/tests/dir/opendir_error2.phpt
@@ -27,17 +27,15 @@ echo "\n-- Pass a non-existent relative path: --\n";
chdir(__DIR__);
var_dump(opendir('idonotexist'));
?>
-===DONE===
--EXPECTF--
*** Testing opendir() : error conditions ***
-- Pass a non-existent absolute path: --
-Warning: opendir(%s/idonotexist): failed to open dir: %s in %s on line %d
+Warning: opendir(%s/idonotexist): Failed to open directory: %s in %s on line %d
bool(false)
-- Pass a non-existent relative path: --
-Warning: opendir(idonotexist): failed to open dir: %s in %s on line %d
+Warning: opendir(idonotexist): Failed to open directory: %s in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/standard/tests/dir/opendir_variation3-win32-mb.phpt b/ext/standard/tests/dir/opendir_variation3-win32-mb.phpt
index 8bf2d3c26a..82f2a330d0 100644
--- a/ext/standard/tests/dir/opendir_variation3-win32-mb.phpt
+++ b/ext/standard/tests/dir/opendir_variation3-win32-mb.phpt
@@ -29,15 +29,14 @@ echo "\n-- Open directory second time: --\n";
var_dump($dh2 = opendir($path));
if ($dh1 !== $dh2) {
- echo "\nNew resource created\n";
+ echo "\nNew resource created\n";
} else {
- echo "\nNo new resource created\n";
+ echo "\nNo new resource created\n";
}
closedir($dh1);
closedir($dh2);
?>
-===DONE===
--CLEAN--
<?php
$path = __DIR__ . "/ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™opendir_variation3";
@@ -53,4 +52,3 @@ resource(%d) of type (stream)
resource(%d) of type (stream)
New resource created
-===DONE===
diff --git a/ext/standard/tests/dir/opendir_variation3.phpt b/ext/standard/tests/dir/opendir_variation3.phpt
index 65ec8df82f..2169684fba 100644
--- a/ext/standard/tests/dir/opendir_variation3.phpt
+++ b/ext/standard/tests/dir/opendir_variation3.phpt
@@ -23,15 +23,14 @@ echo "\n-- Open directory second time: --\n";
var_dump($dh2 = opendir($path));
if ($dh1 !== $dh2) {
- echo "\nNew resource created\n";
+ echo "\nNew resource created\n";
} else {
- echo "\nNo new resource created\n";
+ echo "\nNo new resource created\n";
}
closedir($dh1);
closedir($dh2);
?>
-===DONE===
--CLEAN--
<?php
$path = __DIR__ . "/opendir_variation3";
@@ -47,4 +46,3 @@ resource(%d) of type (stream)
resource(%d) of type (stream)
New resource created
-===DONE===
diff --git a/ext/standard/tests/dir/opendir_variation4-win32-mb.phpt b/ext/standard/tests/dir/opendir_variation4-win32-mb.phpt
index ec9f2b3886..00d09985de 100644
--- a/ext/standard/tests/dir/opendir_variation4-win32-mb.phpt
+++ b/ext/standard/tests/dir/opendir_variation4-win32-mb.phpt
@@ -70,13 +70,12 @@ clean_dh($dh);
* and to ensure directory is not in use at CLEAN section so can me removed
*/
function clean_dh($dh){
- if (is_resource($dh)) {
- closedir($dh);
- }
- unset($dh);
+ if (is_resource($dh)) {
+ closedir($dh);
+ }
+ unset($dh);
}
?>
-===DONE===
--CLEAN--
<?php
$base_dir_path = __DIR__ . '/opendir_variation4-win32-mb';
@@ -112,4 +111,3 @@ resource(%d) of type (stream)
-- $path = '../../'ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™level_one': --
bool(true)
resource(%d) of type (stream)
-===DONE===
diff --git a/ext/standard/tests/dir/opendir_variation4.phpt b/ext/standard/tests/dir/opendir_variation4.phpt
index ea72c8b627..c206ac4d1e 100644
--- a/ext/standard/tests/dir/opendir_variation4.phpt
+++ b/ext/standard/tests/dir/opendir_variation4.phpt
@@ -64,13 +64,12 @@ clean_dh($dh);
* and to ensure directory is not in use at CLEAN section so can me removed
*/
function clean_dh($dh){
- if (is_resource($dh)) {
- closedir($dh);
- }
- unset($dh);
+ if (is_resource($dh)) {
+ closedir($dh);
+ }
+ unset($dh);
}
?>
-===DONE===
--CLEAN--
<?php
$base_dir_path = __DIR__ . '/opendir_variation4';
@@ -106,4 +105,3 @@ resource(%d) of type (stream)
-- $path = '../../'level_one': --
bool(true)
resource(%d) of type (stream)
-===DONE===
diff --git a/ext/standard/tests/dir/opendir_variation5.phpt b/ext/standard/tests/dir/opendir_variation5.phpt
index 937911227c..15e6e16c8f 100644
--- a/ext/standard/tests/dir/opendir_variation5.phpt
+++ b/ext/standard/tests/dir/opendir_variation5.phpt
@@ -41,15 +41,15 @@ chmod($sub_dir_path, 0777);
$child_dir_path = $sub_dir_path."/child_dir";
mkdir($child_dir_path);
-// remove the write and execute permisson from sub parent
+// remove the write and execute permission from sub parent
chmod($sub_dir_path, 0444);
echo "\n-- After restricting 1st level parent directory --\n";
$dir_handle1 = opendir($child_dir_path);
var_dump( $dir_handle1 );
-// remove the execute permisson from parent dir, allowing all permission for sub dir
-chmod($sub_dir_path, 0777); // all permisson to sub dir
+// remove the execute permission from parent dir, allowing all permission for sub dir
+chmod($sub_dir_path, 0777); // all permission to sub dir
chmod($parent_dir_path, 0666); // restricting parent directory
echo "\n-- After restricting parent directory --\n";
@@ -57,13 +57,12 @@ $dir_handle2 = opendir($child_dir_path); // try to open, expected failure
var_dump( $dir_handle2 ); // dump it
if (is_resource($dir_handle1)) {
- closedir($dir_handle1);
+ closedir($dir_handle1);
}
if (is_resource($dir_handle2)) {
- closedir($dir_handle2);
+ closedir($dir_handle2);
}
?>
-===DONE===
--CLEAN--
<?php
$parent_dir_path = __DIR__ . "/opendir_variation5";
@@ -84,11 +83,10 @@ rmdir($parent_dir_path);
-- After restricting 1st level parent directory --
-Warning: opendir(%s/opendir_variation5/sub_dir/child_dir): failed to open dir: %s in %s on line %d
+Warning: opendir(%s/opendir_variation5/sub_dir/child_dir): Failed to open directory: %s in %s on line %d
bool(false)
-- After restricting parent directory --
-Warning: opendir(%s/opendir_variation5/sub_dir/child_dir): failed to open dir: %s in %s on line %d
+Warning: opendir(%s/opendir_variation5/sub_dir/child_dir): Failed to open directory: %s in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/standard/tests/dir/opendir_variation6-win32.phpt b/ext/standard/tests/dir/opendir_variation6-win32.phpt
index 3e3c26e679..60957b5f9c 100644
--- a/ext/standard/tests/dir/opendir_variation6-win32.phpt
+++ b/ext/standard/tests/dir/opendir_variation6-win32.phpt
@@ -37,7 +37,6 @@ var_dump( opendir($dir_path . "/sub_dir?") );
var_dump( opendir($dir_path . "/sub?dir1") );
?>
-===DONE===
--CLEAN--
<?php
$dir_path = __DIR__ . "/opendir_variation6";
@@ -53,23 +52,22 @@ rmdir($dir_path);
Warning: opendir(%s/opendir_var*,%s/opendir_var*): %s in %s on line %d
-Warning: opendir(%s/opendir_var*): failed to open dir: %s in %s on line %d
+Warning: opendir(%s/opendir_var*): Failed to open directory: %s in %s on line %d
bool(false)
Warning: opendir(%s/*,%s/*): %s in %s on line %d
-Warning: opendir(%s/*): failed to open dir: %s in %s on line %d
+Warning: opendir(%s/*): Failed to open directory: %s in %s on line %d
bool(false)
-- Wildcard = '?' --
Warning: opendir(%s/opendir_variation6/sub_dir?,%s/opendir_variation6/sub_dir?): %s in %s on line %d
-Warning: opendir(%s/opendir_variation6/sub_dir?): failed to open dir: %s in %s on line %d
+Warning: opendir(%s/opendir_variation6/sub_dir?): Failed to open directory: %s in %s on line %d
bool(false)
Warning: opendir(%s/opendir_variation6/sub?dir1,%s/opendir_variation6/sub?dir1): %s in %s on line %d
-Warning: opendir(%s/opendir_variation6/sub?dir1): failed to open dir: %s in %s on line %d
+Warning: opendir(%s/opendir_variation6/sub?dir1): Failed to open directory: %s in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/standard/tests/dir/opendir_variation6.phpt b/ext/standard/tests/dir/opendir_variation6.phpt
index c51cd4ca26..da91798dd3 100644
--- a/ext/standard/tests/dir/opendir_variation6.phpt
+++ b/ext/standard/tests/dir/opendir_variation6.phpt
@@ -37,7 +37,6 @@ var_dump( opendir($dir_path . "/sub_dir?") );
var_dump( opendir($dir_path . "/sub?dir1") );
?>
-===DONE===
--CLEAN--
<?php
$dir_path = __DIR__ . "/opendir_variation6";
@@ -51,17 +50,16 @@ rmdir($dir_path);
-- Wildcard = '*' --
-Warning: opendir(%s/opendir_var*): failed to open dir: %s in %s on line %d
+Warning: opendir(%s/opendir_var*): Failed to open directory: %s in %s on line %d
bool(false)
-Warning: opendir(%s/*): failed to open dir: %s in %s on line %d
+Warning: opendir(%s/*): Failed to open directory: %s in %s on line %d
bool(false)
-- Wildcard = '?' --
-Warning: opendir(%s/opendir_variation6/sub_dir?): failed to open dir: %s in %s on line %d
+Warning: opendir(%s/opendir_variation6/sub_dir?): Failed to open directory: %s in %s on line %d
bool(false)
-Warning: opendir(%s/opendir_variation6/sub?dir1): failed to open dir: %s in %s on line %d
+Warning: opendir(%s/opendir_variation6/sub?dir1): Failed to open directory: %s in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/standard/tests/dir/opendir_variation7.phpt b/ext/standard/tests/dir/opendir_variation7.phpt
index d781c4f538..aa45f443f0 100644
--- a/ext/standard/tests/dir/opendir_variation7.phpt
+++ b/ext/standard/tests/dir/opendir_variation7.phpt
@@ -48,26 +48,25 @@ $permission_values = array(
$iterator = 1;
foreach ($permission_values as $perm) {
- echo "\n-- Iteration $iterator --\n";
- // try to remove the dir if exists & create
- if (is_dir($dir_path)){
- chmod ($dir_path, 0777); // change dir permission to allow all operation
- rmdir ($dir_path);
- }
- mkdir($dir_path);
-
- // change the dir permisson to test dir on it
- var_dump( chmod($dir_path, $perm) );
-
- var_dump($dh = opendir($dir_path));
-
- if (is_resource($dh)) {
- closedir($dh);
- }
- $iterator++;
+ echo "\n-- Iteration $iterator --\n";
+ // try to remove the dir if exists & create
+ if (is_dir($dir_path)){
+ chmod ($dir_path, 0777); // change dir permission to allow all operation
+ rmdir ($dir_path);
+ }
+ mkdir($dir_path);
+
+ // change the dir permission to test dir on it
+ var_dump( chmod($dir_path, $perm) );
+
+ var_dump($dh = opendir($dir_path));
+
+ if (is_resource($dh)) {
+ closedir($dh);
+ }
+ $iterator++;
}
?>
-===DONE===
--CLEAN--
<?php
// deleting temporary directory
@@ -116,4 +115,3 @@ resource(%d) of type (stream)
-- Iteration 10 --
bool(true)
resource(%d) of type (stream)
-===DONE===
diff --git a/ext/standard/tests/dir/readdir_basic-win32-mb.phpt b/ext/standard/tests/dir/readdir_basic-win32-mb.phpt
index 697d8774f9..7b371ec3ac 100644
--- a/ext/standard/tests/dir/readdir_basic-win32-mb.phpt
+++ b/ext/standard/tests/dir/readdir_basic-win32-mb.phpt
@@ -31,28 +31,27 @@ echo "\n-- Call readdir() with \$path argument --\n";
var_dump($dh = opendir($path));
$a = array();
while( FALSE !== ($file = readdir($dh)) ) {
- $a[] = $file;
+ $a[] = $file;
}
sort($a);
foreach($a as $file) {
- var_dump($file);
+ var_dump($file);
}
echo "\n-- Call readdir() without \$path argument --\n";
var_dump($dh = opendir($path));
$a = array();
while( FALSE !== ( $file = readdir() ) ) {
- $a[] = $file;
+ $a[] = $file;
}
sort($a);
foreach($a as $file) {
- var_dump($file);
+ var_dump($file);
}
delete_files($path, 3);
closedir($dh);
?>
-===DONE===
--CLEAN--
<?php
$path = __DIR__ . '/ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™readdir_basic';
@@ -76,4 +75,3 @@ string(2) ".."
string(9) "file1.tmp"
string(9) "file2.tmp"
string(9) "file3.tmp"
-===DONE===
diff --git a/ext/standard/tests/dir/readdir_basic.phpt b/ext/standard/tests/dir/readdir_basic.phpt
index 8c615afc5e..16437eb5a6 100644
--- a/ext/standard/tests/dir/readdir_basic.phpt
+++ b/ext/standard/tests/dir/readdir_basic.phpt
@@ -25,28 +25,27 @@ echo "\n-- Call readdir() with \$path argument --\n";
var_dump($dh = opendir($path));
$a = array();
while( FALSE !== ($file = readdir($dh)) ) {
- $a[] = $file;
+ $a[] = $file;
}
sort($a);
foreach($a as $file) {
- var_dump($file);
+ var_dump($file);
}
echo "\n-- Call readdir() without \$path argument --\n";
var_dump($dh = opendir($path));
$a = array();
while( FALSE !== ( $file = readdir() ) ) {
- $a[] = $file;
+ $a[] = $file;
}
sort($a);
foreach($a as $file) {
- var_dump($file);
+ var_dump($file);
}
delete_files($path, 3);
closedir($dh);
?>
-===DONE===
--CLEAN--
<?php
$path = __DIR__ . '/readdir_basic';
@@ -70,4 +69,3 @@ string(2) ".."
string(9) "file1.tmp"
string(9) "file2.tmp"
string(9) "file3.tmp"
-===DONE===
diff --git a/ext/standard/tests/dir/readdir_variation2-win32-mb.phpt b/ext/standard/tests/dir/readdir_variation2-win32-mb.phpt
index ede4199ac6..4e0a8d7158 100644
--- a/ext/standard/tests/dir/readdir_variation2-win32-mb.phpt
+++ b/ext/standard/tests/dir/readdir_variation2-win32-mb.phpt
@@ -25,21 +25,20 @@ $dir_handle = opendir($path);
echo "\n-- Pass an empty directory to readdir() --\n";
function mysort($a,$b) {
- return strlen($a) > strlen($b) ? 1 : -1;
+ return strlen($a) > strlen($b) ? 1 : -1;
}
$entries = array();
while(FALSE !== ($file = readdir($dir_handle))){
- $entries[] = $file;
+ $entries[] = $file;
}
closedir($dir_handle);
usort($entries, "mysort");
foreach($entries as $entry) {
- var_dump($entry);
+ var_dump($entry);
}
?>
-===DONE===
--CLEAN--
<?php
$path = __DIR__ . '/ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™readdir_variation2';
@@ -51,4 +50,3 @@ rmdir($path);
-- Pass an empty directory to readdir() --
string(1) "."
string(2) ".."
-===DONE===
diff --git a/ext/standard/tests/dir/readdir_variation2.phpt b/ext/standard/tests/dir/readdir_variation2.phpt
index fbe383e768..979c4f4057 100644
--- a/ext/standard/tests/dir/readdir_variation2.phpt
+++ b/ext/standard/tests/dir/readdir_variation2.phpt
@@ -19,21 +19,20 @@ $dir_handle = opendir($path);
echo "\n-- Pass an empty directory to readdir() --\n";
function mysort($a,$b) {
- return strlen($a) > strlen($b) ? 1 : -1;
+ return strlen($a) > strlen($b) ? 1 : -1;
}
$entries = array();
while(FALSE !== ($file = readdir($dir_handle))){
- $entries[] = $file;
+ $entries[] = $file;
}
closedir($dir_handle);
usort($entries, "mysort");
foreach($entries as $entry) {
- var_dump($entry);
+ var_dump($entry);
}
?>
-===DONE===
--CLEAN--
<?php
$path = __DIR__ . '/readdir_variation2';
@@ -45,4 +44,3 @@ rmdir($path);
-- Pass an empty directory to readdir() --
string(1) "."
string(2) ".."
-===DONE===
diff --git a/ext/standard/tests/dir/readdir_variation3-win32-mb.phpt b/ext/standard/tests/dir/readdir_variation3-win32-mb.phpt
index 5c2b0c8385..594838fe11 100644
--- a/ext/standard/tests/dir/readdir_variation3-win32-mb.phpt
+++ b/ext/standard/tests/dir/readdir_variation3-win32-mb.phpt
@@ -35,9 +35,9 @@ create_files($path_sub, 2);
$dir_handle = opendir($path_top);
while(FALSE !== ($file = readdir($dir_handle))) {
- // different OS order files differently so will
- // store file names into an array so can use sorted in expected output
- $contents[] = $file;
+ // different OS order files differently so will
+ // store file names into an array so can use sorted in expected output
+ $contents[] = $file;
}
// more important to check that all contents are present than order they are returned in
@@ -49,7 +49,6 @@ delete_files($path_sub, 2);
closedir($dir_handle);
?>
-===DONE===
--CLEAN--
<?php
$path_top = __DIR__ . '/readdir_variation3-win32-mb';
@@ -71,4 +70,3 @@ array(5) {
[4]=>
string(46) "ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™sub_folder"
}
-===DONE===
diff --git a/ext/standard/tests/dir/readdir_variation3.phpt b/ext/standard/tests/dir/readdir_variation3.phpt
index 849068e97a..6cc6f9e0a4 100644
--- a/ext/standard/tests/dir/readdir_variation3.phpt
+++ b/ext/standard/tests/dir/readdir_variation3.phpt
@@ -29,9 +29,9 @@ create_files($path_sub, 2);
$dir_handle = opendir($path_top);
while(FALSE !== ($file = readdir($dir_handle))) {
- // different OS order files differently so will
- // store file names into an array so can use sorted in expected output
- $contents[] = $file;
+ // different OS order files differently so will
+ // store file names into an array so can use sorted in expected output
+ $contents[] = $file;
}
// more important to check that all contents are present than order they are returned in
@@ -43,7 +43,6 @@ delete_files($path_sub, 2);
closedir($dir_handle);
?>
-===DONE===
--CLEAN--
<?php
$path_top = __DIR__ . '/readdir_variation3';
@@ -65,4 +64,3 @@ array(5) {
[4]=>
string(10) "sub_folder"
}
-===DONE===
diff --git a/ext/standard/tests/dir/readdir_variation4-win32-mb.phpt b/ext/standard/tests/dir/readdir_variation4-win32-mb.phpt
index a77fcd8ca4..c2bf8b1616 100644
--- a/ext/standard/tests/dir/readdir_variation4-win32-mb.phpt
+++ b/ext/standard/tests/dir/readdir_variation4-win32-mb.phpt
@@ -55,24 +55,24 @@ $inputs = array(
$iterator = 1;
foreach($inputs as $key => $input) {
- echo "\n-- Iteration $iterator --\n";
- $handle = "fp{$iterator}";
- var_dump( $$handle = @fopen($dir_path . "ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™$input.tmp", 'w') );
- var_dump( fwrite($$handle, $key));
- fclose($$handle);
- $iterator++;
+ echo "\n-- Iteration $iterator --\n";
+ $handle = "fp{$iterator}";
+ var_dump( $$handle = @fopen($dir_path . "ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™$input.tmp", 'w') );
+ var_dump( fwrite($$handle, $key));
+ fclose($$handle);
+ $iterator++;
};
echo "\n-- Call to readdir() --\n";
$dir_handle = opendir($dir_path);
while(FALSE !== ($file = readdir($dir_handle))){
- // different OS order files differently so will
- // store file names into an array so can use sorted in expected output
- $contents[] = $file;
+ // different OS order files differently so will
+ // store file names into an array so can use sorted in expected output
+ $contents[] = $file;
- // remove files while going through directory
- @unlink($dir_path . $file);
+ // remove files while going through directory
+ @unlink($dir_path . $file);
}
// more important to check that all contents are present than order they are returned in
@@ -81,7 +81,6 @@ var_dump($contents);
closedir($dir_handle);
?>
-===DONE===
--CLEAN--
<?php
$dir_path = __DIR__ . "/ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™readdir_variation4/";
@@ -181,4 +180,3 @@ array(16) {
[15]=>
string(51) "ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™single_file.tmp"
}
-===DONE===
diff --git a/ext/standard/tests/dir/readdir_variation4.phpt b/ext/standard/tests/dir/readdir_variation4.phpt
index 22eb62381a..37e5b80ecb 100644
--- a/ext/standard/tests/dir/readdir_variation4.phpt
+++ b/ext/standard/tests/dir/readdir_variation4.phpt
@@ -49,24 +49,24 @@ $inputs = array(
$iterator = 1;
foreach($inputs as $key => $input) {
- echo "\n-- Iteration $iterator --\n";
- $handle = "fp{$iterator}";
- var_dump( $$handle = fopen(@"$dir_path$input.tmp", 'w') );
- var_dump( fwrite($$handle, $key));
- fclose($$handle);
- $iterator++;
+ echo "\n-- Iteration $iterator --\n";
+ $handle = "fp{$iterator}";
+ var_dump( $$handle = fopen(@"$dir_path$input.tmp", 'w') );
+ var_dump( fwrite($$handle, $key));
+ fclose($$handle);
+ $iterator++;
};
echo "\n-- Call to readdir() --\n";
$dir_handle = opendir($dir_path);
while(FALSE !== ($file = readdir($dir_handle))){
- // different OS order files differently so will
- // store file names into an array so can use sorted in expected output
- $contents[] = $file;
+ // different OS order files differently so will
+ // store file names into an array so can use sorted in expected output
+ $contents[] = $file;
- // remove files while going through directory
- @unlink($dir_path . $file);
+ // remove files while going through directory
+ @unlink($dir_path . $file);
}
// more important to check that all contents are present than order they are returned in
@@ -75,7 +75,6 @@ var_dump($contents);
closedir($dir_handle);
?>
-===DONE===
--CLEAN--
<?php
$dir_path = __DIR__ . "/readdir_variation4/";
@@ -175,4 +174,3 @@ array(16) {
[15]=>
string(15) "single_file.tmp"
}
-===DONE===
diff --git a/ext/standard/tests/dir/readdir_variation5.phpt b/ext/standard/tests/dir/readdir_variation5.phpt
index 72ec24a9d8..d1cdc1bd58 100644
--- a/ext/standard/tests/dir/readdir_variation5.phpt
+++ b/ext/standard/tests/dir/readdir_variation5.phpt
@@ -46,26 +46,25 @@ $permission_values = array(
// Open directory with different permission values, read and close, expected: none of them to succeed.
$iterator = 1;
foreach($permission_values as $perm) {
- echo "\n-- Iteration $iterator --\n";
+ echo "\n-- Iteration $iterator --\n";
- if (is_dir($dir_path)) {
- chmod ($dir_path, 0777); // change dir permission to allow all operation
- rmdir ($dir_path);
- }
- mkdir($dir_path);
+ if (is_dir($dir_path)) {
+ chmod ($dir_path, 0777); // change dir permission to allow all operation
+ rmdir ($dir_path);
+ }
+ mkdir($dir_path);
- // change the dir permisson to test dir on it
- var_dump( chmod($dir_path, $perm) );
- var_dump($dh = opendir($dir_path));
+ // change the dir permission to test dir on it
+ var_dump( chmod($dir_path, $perm) );
+ var_dump($dh = opendir($dir_path));
- echo "-- Calling readdir() --\n";
- var_dump(readdir($dh));
+ echo "-- Calling readdir() --\n";
+ var_dump(readdir($dh));
- closedir($dh);
- $iterator++;
+ closedir($dh);
+ $iterator++;
}
?>
-===DONE===
--CLEAN--
<?php
$dir_path = __DIR__ . "/readdir_variation5";
@@ -133,4 +132,3 @@ bool(true)
resource(%d) of type (stream)
-- Calling readdir() --
string(%d) "%s"
-===DONE===
diff --git a/ext/standard/tests/dir/readdir_variation6-win32-mb.phpt b/ext/standard/tests/dir/readdir_variation6-win32-mb.phpt
index 57a8147a46..806fdec87e 100644
--- a/ext/standard/tests/dir/readdir_variation6-win32-mb.phpt
+++ b/ext/standard/tests/dir/readdir_variation6-win32-mb.phpt
@@ -39,21 +39,21 @@ opendir($dir_path);
echo "\n-- Reading Directory Contents with Previous Handle --\n";
$a = array();
while (FALSE !== ($file = readdir($dir_handle1))) {
- $a[] = $file;
+ $a[] = $file;
}
sort($a);
foreach ($a as $file) {
- var_dump($file);
+ var_dump($file);
}
echo "\n-- Reading Directory Contents with Current Handle (no arguments supplied) --\n";
$a = array();
while (FALSE !== ($file = readdir())) {
- $a[] = $file;
+ $a[] = $file;
}
sort($a);
foreach ($a as $file) {
- var_dump($file);
+ var_dump($file);
}
// delete temporary files
@@ -61,7 +61,6 @@ delete_files($dir_path, 3, "ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™readdir_variatio
closedir($dir_handle1);
closedir();
?>
-===DONE===
--CLEAN--
<?php
$dir_path = __DIR__ . "/ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™readdir_variation6";
@@ -83,4 +82,3 @@ string(2) ".."
string(59) "ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™readdir_variation61.tmp"
string(59) "ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™readdir_variation62.tmp"
string(59) "ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™readdir_variation63.tmp"
-===DONE===
diff --git a/ext/standard/tests/dir/readdir_variation6.phpt b/ext/standard/tests/dir/readdir_variation6.phpt
index 379d5cc80c..532a20fd21 100644
--- a/ext/standard/tests/dir/readdir_variation6.phpt
+++ b/ext/standard/tests/dir/readdir_variation6.phpt
@@ -33,21 +33,21 @@ opendir($dir_path);
echo "\n-- Reading Directory Contents with Previous Handle --\n";
$a = array();
while (FALSE !== ($file = readdir($dir_handle1))) {
- $a[] = $file;
+ $a[] = $file;
}
sort($a);
foreach ($a as $file) {
- var_dump($file);
+ var_dump($file);
}
echo "\n-- Reading Directory Contents with Current Handle (no arguments supplied) --\n";
$a = array();
while (FALSE !== ($file = readdir())) {
- $a[] = $file;
+ $a[] = $file;
}
sort($a);
foreach ($a as $file) {
- var_dump($file);
+ var_dump($file);
}
// delete temporary files
@@ -55,7 +55,6 @@ delete_files($dir_path, 3, "readdir_variation6");
closedir($dir_handle1);
closedir();
?>
-===DONE===
--CLEAN--
<?php
$dir_path = __DIR__ . "/readdir_variation6";
@@ -77,4 +76,3 @@ string(2) ".."
string(23) "readdir_variation61.tmp"
string(23) "readdir_variation62.tmp"
string(23) "readdir_variation63.tmp"
-===DONE===
diff --git a/ext/standard/tests/dir/readdir_variation7.phpt b/ext/standard/tests/dir/readdir_variation7.phpt
index 2cd23b8bfc..a2c0ef059f 100644
--- a/ext/standard/tests/dir/readdir_variation7.phpt
+++ b/ext/standard/tests/dir/readdir_variation7.phpt
@@ -15,14 +15,14 @@ echo "*** Testing readdir() : usage variations ***\n";
// get a resource variable
var_dump($fp = fopen(__FILE__, "r"));
-var_dump( readdir($fp) );
+try {
+ var_dump( readdir($fp) );
+} catch (\TypeError $e) {
+ echo $e->getMessage() . "\n";
+}
?>
-===DONE===
--EXPECTF--
*** Testing readdir() : usage variations ***
resource(%d) of type (stream)
-
-Warning: readdir(): %d is not a valid Directory resource in %s on line %d
-bool(false)
-===DONE===
+%d is not a valid Directory resource
diff --git a/ext/standard/tests/dir/rewinddir_basic-win32-mb.phpt b/ext/standard/tests/dir/rewinddir_basic-win32-mb.phpt
index 5e704870ee..fc5539666d 100644
--- a/ext/standard/tests/dir/rewinddir_basic-win32-mb.phpt
+++ b/ext/standard/tests/dir/rewinddir_basic-win32-mb.phpt
@@ -36,7 +36,7 @@ var_dump($dh2 = opendir($dir_path2));
$data = array();
echo "\n-- Read and rewind first directory (argument supplied) --\n";
while(FALSE !== $file1 = readdir($dh1)) {
- $data[] = $file1;
+ $data[] = $file1;
}
$first = $data[0];
sort($data);
@@ -48,7 +48,7 @@ var_dump(readdir($dh1) == $first);
$data = array();
echo "\n-- Read and rewind second directory (no argument supplied) --\n";
while(FALSE !== $file2 = readdir()) {
- $data[] = $file2;
+ $data[] = $file2;
}
$first = $data[0];
sort($data);
@@ -63,7 +63,6 @@ closedir($dh2);
delete_files($dir_path1, 1, "ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™file");
delete_files($dir_path2, 1, "ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™file", 2);
?>
-===DONE===
--CLEAN--
<?php
$dir_path1 = __DIR__ . "/ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™rewinddir_basic_dir1";
@@ -99,4 +98,3 @@ array(3) {
}
NULL
bool(true)
-===DONE===
diff --git a/ext/standard/tests/dir/rewinddir_basic.phpt b/ext/standard/tests/dir/rewinddir_basic.phpt
index b0abc0a379..714d75266c 100644
--- a/ext/standard/tests/dir/rewinddir_basic.phpt
+++ b/ext/standard/tests/dir/rewinddir_basic.phpt
@@ -30,7 +30,7 @@ var_dump($dh2 = opendir($dir_path2));
$data = array();
echo "\n-- Read and rewind first directory (argument supplied) --\n";
while(FALSE !== $file1 = readdir($dh1)) {
- $data[] = $file1;
+ $data[] = $file1;
}
$first = $data[0];
sort($data);
@@ -42,7 +42,7 @@ var_dump(readdir($dh1) == $first);
$data = array();
echo "\n-- Read and rewind second directory (no argument supplied) --\n";
while(FALSE !== $file2 = readdir()) {
- $data[] = $file2;
+ $data[] = $file2;
}
$first = $data[0];
sort($data);
@@ -57,7 +57,6 @@ closedir($dh2);
delete_files($dir_path1, 1);
delete_files($dir_path2, 1, 'file', 2);
?>
-===DONE===
--CLEAN--
<?php
$dir_path1 = __DIR__ . "/rewinddir_basic_dir1";
@@ -93,4 +92,3 @@ array(3) {
}
NULL
bool(true)
-===DONE===
diff --git a/ext/standard/tests/dir/rewinddir_variation2-win32-mb.phpt b/ext/standard/tests/dir/rewinddir_variation2-win32-mb.phpt
index e46640c41e..7d86575b6d 100644
--- a/ext/standard/tests/dir/rewinddir_variation2-win32-mb.phpt
+++ b/ext/standard/tests/dir/rewinddir_variation2-win32-mb.phpt
@@ -29,9 +29,12 @@ var_dump(readdir($dir_handle));
closedir($dir_handle);
echo "\n-- Call to rewinddir() --\n";
-var_dump(rewinddir($dir_handle));
+try {
+ var_dump(rewinddir($dir_handle));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
-===DONE===
--CLEAN--
<?php
$dir_path = __DIR__ . '/ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™rewinddir_variation2';
@@ -45,7 +48,4 @@ resource(%d) of type (stream)
string(%d) "%s"
-- Call to rewinddir() --
-
-Warning: rewinddir(): %s is not a valid Directory resource in %s on line %d
-bool(false)
-===DONE===
+rewinddir(): %s is not a valid Directory resource
diff --git a/ext/standard/tests/dir/rewinddir_variation2.phpt b/ext/standard/tests/dir/rewinddir_variation2.phpt
index 02654aa80c..9294d68b46 100644
--- a/ext/standard/tests/dir/rewinddir_variation2.phpt
+++ b/ext/standard/tests/dir/rewinddir_variation2.phpt
@@ -23,9 +23,12 @@ var_dump(readdir($dir_handle));
closedir($dir_handle);
echo "\n-- Call to rewinddir() --\n";
-var_dump(rewinddir($dir_handle));
+try {
+ var_dump(rewinddir($dir_handle));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
-===DONE===
--CLEAN--
<?php
$dir_path = __DIR__ . '/rewinddir_variation2';
@@ -39,7 +42,4 @@ resource(%d) of type (stream)
string(%d) "%s"
-- Call to rewinddir() --
-
-Warning: rewinddir(): supplied resource is not a valid Directory resource in %s on line %d
-bool(false)
-===DONE===
+rewinddir(): supplied resource is not a valid Directory resource
diff --git a/ext/standard/tests/dir/rewinddir_variation3.phpt b/ext/standard/tests/dir/rewinddir_variation3.phpt
index a1ec7f80d4..07508eac3f 100644
--- a/ext/standard/tests/dir/rewinddir_variation3.phpt
+++ b/ext/standard/tests/dir/rewinddir_variation3.phpt
@@ -18,26 +18,27 @@ echo "\n-- Open a file using fopen --\n";
var_dump($fp = fopen(__FILE__, 'r'));
$result1 = fread($fp, 5);
-var_dump(rewinddir($fp));
+
+try {
+ var_dump(rewinddir($fp));
+} catch (\TypeError $e) {
+ echo $e->getMessage() . "\n";
+}
$result2 = fread($fp, 5);
echo "\n-- Check if rewinddir() has repositioned the file pointer --\n";
if ($result1 === $result2) {
- echo "rewinddir() works on file pointers\n";
+ echo "rewinddir() works on file pointers\n";
} else {
- echo "rewinddir() does not work on file pointers\n";
+ echo "rewinddir() does not work on file pointers\n";
}
?>
-===DONE===
--EXPECTF--
*** Testing rewinddir() : usage variations ***
-- Open a file using fopen --
resource(%d) of type (stream)
-
-Warning: rewinddir(): %d is not a valid Directory resource in %s on line %d
-bool(false)
+%d is not a valid Directory resource
-- Check if rewinddir() has repositioned the file pointer --
rewinddir() does not work on file pointers
-===DONE===
diff --git a/ext/standard/tests/dir/scandir_basic-win32-mb.phpt b/ext/standard/tests/dir/scandir_basic-win32-mb.phpt
index 39c375461e..501a3c54c5 100644
--- a/ext/standard/tests/dir/scandir_basic-win32-mb.phpt
+++ b/ext/standard/tests/dir/scandir_basic-win32-mb.phpt
@@ -37,7 +37,6 @@ var_dump(scandir($directory, $sorting_order, $context));
delete_files($directory, 3, "ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™file");
?>
-===DONE===
--CLEAN--
<?php
$directory = __DIR__ . '/ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™scandir_basic';
@@ -73,4 +72,3 @@ array(5) {
[4]=>
string(1) "."
}
-===DONE===
diff --git a/ext/standard/tests/dir/scandir_basic.phpt b/ext/standard/tests/dir/scandir_basic.phpt
index e0e40f5620..e31ef6ea41 100644
--- a/ext/standard/tests/dir/scandir_basic.phpt
+++ b/ext/standard/tests/dir/scandir_basic.phpt
@@ -31,7 +31,6 @@ var_dump(scandir($directory, $sorting_order, $context));
delete_files($directory, 3);
?>
-===DONE===
--CLEAN--
<?php
$directory = __DIR__ . '/scandir_basic';
@@ -67,4 +66,3 @@ array(5) {
[4]=>
string(1) "."
}
-===DONE===
diff --git a/ext/standard/tests/dir/scandir_error2.phpt b/ext/standard/tests/dir/scandir_error2.phpt
index 121d68bab8..d8eefc3992 100644
--- a/ext/standard/tests/dir/scandir_error2.phpt
+++ b/ext/standard/tests/dir/scandir_error2.phpt
@@ -27,21 +27,19 @@ var_dump(scandir($directory));
echo "\n-- Pass scandir() a relative path that does not exist --\n";
var_dump(scandir('/idonotexist'));
?>
-===DONE===
--EXPECTF--
*** Testing scandir() : error conditions ***
-- Pass scandir() an absolute path that does not exist --
-Warning: scandir(%s/idonotexist): failed to open dir: %s in %s on line %d
+Warning: scandir(%s/idonotexist): Failed to open directory: %s in %s on line %d
Warning: scandir(): (errno %d): %s in %s on line %d
bool(false)
-- Pass scandir() a relative path that does not exist --
-Warning: scandir(/idonotexist): failed to open dir: %s in %s on line %d
+Warning: scandir(/idonotexist): Failed to open directory: %s in %s on line %d
Warning: scandir(): (errno %d): %s in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/standard/tests/dir/scandir_variation10-win32-mb.phpt b/ext/standard/tests/dir/scandir_variation10-win32-mb.phpt
index b596eb0e17..120e12e6e7 100644
--- a/ext/standard/tests/dir/scandir_variation10-win32-mb.phpt
+++ b/ext/standard/tests/dir/scandir_variation10-win32-mb.phpt
@@ -46,7 +46,6 @@ var_dump(in_array('ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™file2.tmp', $files));
delete_files($dir, 2, "ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™file");
?>
-===DONE===
--CLEAN--
<?php
$dir = __DIR__ . '/ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™scandir_variation10';
@@ -82,4 +81,3 @@ bool(true)
bool(true)
bool(true)
bool(true)
-===DONE===
diff --git a/ext/standard/tests/dir/scandir_variation10.phpt b/ext/standard/tests/dir/scandir_variation10.phpt
index 28220c66ba..1de1e9752c 100644
--- a/ext/standard/tests/dir/scandir_variation10.phpt
+++ b/ext/standard/tests/dir/scandir_variation10.phpt
@@ -40,7 +40,6 @@ var_dump(in_array('file2.tmp', $files));
delete_files($dir, 2);
?>
-===DONE===
--CLEAN--
<?php
$dir = __DIR__ . '/scandir_variation10';
@@ -76,4 +75,3 @@ bool(true)
bool(true)
bool(true)
bool(true)
-===DONE===
diff --git a/ext/standard/tests/dir/scandir_variation3-win32-mb.phpt b/ext/standard/tests/dir/scandir_variation3-win32-mb.phpt
deleted file mode 100644
index 5505b3db6d..0000000000
--- a/ext/standard/tests/dir/scandir_variation3-win32-mb.phpt
+++ /dev/null
@@ -1,244 +0,0 @@
---TEST--
-Test scandir() function : usage variations - diff data types as $context arg
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) != 'WIN') {
- die("skip Valid only on Windows");
-}
-?>
---FILE--
-<?php
-/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]])
- * Description: List files & directories inside the specified path
- * Source code: ext/standard/dir.c
- */
-
-/*
- * Pass different data types as $context argument to test how scandir() behaves
- */
-
-echo "*** Testing scandir() : usage variations ***\n";
-
-// Initialise function arguments not being substituted
-$dir = __DIR__ . '/ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™scandir_variation3';
-mkdir($dir);
-$sorting_order = SCANDIR_SORT_ASCENDING;
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-// get a class
-class classA
-{
- public function __toString() {
- return "Class A object";
- }
-}
-
-// heredoc string
-$heredoc = <<<EOT
-hello world
-EOT;
-
-// get a resource variable
-$fp = fopen(__FILE__, "r");
-
-// unexpected values to be passed to $context argument
-$inputs = array(
-
- // int data
-/*1*/ 0,
- 1,
- 12345,
- -2345,
-
- // float data
-/*5*/ 10.5,
- -10.5,
- 12.3456789000e10,
- 12.3456789000E-10,
- .5,
-
- // null data
-/*10*/ NULL,
- null,
-
- // boolean data
-/*12*/ true,
- false,
- TRUE,
- FALSE,
-
- // empty data
-/*16*/ "",
- '',
- array(),
-
- // string data
-/*19*/ "string",
- 'string',
- $heredoc,
-
- // object data
-/*22*/ new classA(),
-
- // undefined data
-/*23*/ @$undefined_var,
-
- // unset data
-/*24*/ @$unset_var,
-
- // resource variable
-/*25*/ $fp
-);
-
-// loop through each element of $inputs to check the behavior of scandir()
-$iterator = 1;
-foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump( scandir($dir, $sorting_order, $input) );
- $iterator++;
-};
-
-fclose($fp);
-?>
-===DONE===
---CLEAN--
-<?php
-$dir = __DIR__ . '/ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™scandir_variation3';
-rmdir($dir);
-?>
---EXPECTF--
-*** Testing scandir() : usage variations ***
-
--- Iteration 1 --
-
-Warning: scandir() expects parameter 3 to be resource, int given in %s on line %d
-NULL
-
--- Iteration 2 --
-
-Warning: scandir() expects parameter 3 to be resource, int given in %s on line %d
-NULL
-
--- Iteration 3 --
-
-Warning: scandir() expects parameter 3 to be resource, int given in %s on line %d
-NULL
-
--- Iteration 4 --
-
-Warning: scandir() expects parameter 3 to be resource, int given in %s on line %d
-NULL
-
--- Iteration 5 --
-
-Warning: scandir() expects parameter 3 to be resource, float given in %s on line %d
-NULL
-
--- Iteration 6 --
-
-Warning: scandir() expects parameter 3 to be resource, float given in %s on line %d
-NULL
-
--- Iteration 7 --
-
-Warning: scandir() expects parameter 3 to be resource, float given in %s on line %d
-NULL
-
--- Iteration 8 --
-
-Warning: scandir() expects parameter 3 to be resource, float given in %s on line %d
-NULL
-
--- Iteration 9 --
-
-Warning: scandir() expects parameter 3 to be resource, float given in %s on line %d
-NULL
-
--- Iteration 10 --
-
-Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d
-NULL
-
--- Iteration 11 --
-
-Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d
-NULL
-
--- Iteration 12 --
-
-Warning: scandir() expects parameter 3 to be resource, bool given in %s on line %d
-NULL
-
--- Iteration 13 --
-
-Warning: scandir() expects parameter 3 to be resource, bool given in %s on line %d
-NULL
-
--- Iteration 14 --
-
-Warning: scandir() expects parameter 3 to be resource, bool given in %s on line %d
-NULL
-
--- Iteration 15 --
-
-Warning: scandir() expects parameter 3 to be resource, bool given in %s on line %d
-NULL
-
--- Iteration 16 --
-
-Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d
-NULL
-
--- Iteration 17 --
-
-Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d
-NULL
-
--- Iteration 18 --
-
-Warning: scandir() expects parameter 3 to be resource, array given in %s on line %d
-NULL
-
--- Iteration 19 --
-
-Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d
-NULL
-
--- Iteration 20 --
-
-Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d
-NULL
-
--- Iteration 21 --
-
-Warning: scandir() expects parameter 3 to be resource, string given in %s on line %d
-NULL
-
--- Iteration 22 --
-
-Warning: scandir() expects parameter 3 to be resource, object given in %s on line %d
-NULL
-
--- Iteration 23 --
-
-Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d
-NULL
-
--- Iteration 24 --
-
-Warning: scandir() expects parameter 3 to be resource, null given in %s on line %d
-NULL
-
--- Iteration 25 --
-
-Warning: scandir(): supplied resource is not a valid Stream-Context resource in %s on line %d
-array(2) {
- [0]=>
- string(1) "."
- [1]=>
- string(2) ".."
-}
-===DONE===
diff --git a/ext/standard/tests/dir/scandir_variation4-win32-mb.phpt b/ext/standard/tests/dir/scandir_variation4-win32-mb.phpt
index 9bfeddf556..88389c6f92 100644
--- a/ext/standard/tests/dir/scandir_variation4-win32-mb.phpt
+++ b/ext/standard/tests/dir/scandir_variation4-win32-mb.phpt
@@ -65,7 +65,6 @@ var_dump(scandir('../../ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™level_one'));
@delete_files($level_one_dir_path, 2, 'ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™level_one');
@delete_files($level_two_dir_path, 2, 'ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™level_two');
?>
-===DONE===
--CLEAN--
<?php
$base_dir_path = __DIR__ . '/scandir_variation4-win32-mb';
@@ -174,4 +173,3 @@ array(5) {
[4]=>
string(45) "ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™level_two"
}
-===DONE===
diff --git a/ext/standard/tests/dir/scandir_variation4.phpt b/ext/standard/tests/dir/scandir_variation4.phpt
index 6030ace2ac..afaa17dee7 100644
--- a/ext/standard/tests/dir/scandir_variation4.phpt
+++ b/ext/standard/tests/dir/scandir_variation4.phpt
@@ -59,7 +59,6 @@ var_dump(scandir('../../level_one'));
@delete_files($level_one_dir_path, 2, 'level_one');
@delete_files($level_two_dir_path, 2, 'level_two');
?>
-===DONE===
--CLEAN--
<?php
$base_dir_path = __DIR__ . '/scandir_variation4';
@@ -168,4 +167,3 @@ array(5) {
[4]=>
string(9) "level_two"
}
-===DONE===
diff --git a/ext/standard/tests/dir/scandir_variation5.phpt b/ext/standard/tests/dir/scandir_variation5.phpt
index 189687f1d0..459ce146ee 100644
--- a/ext/standard/tests/dir/scandir_variation5.phpt
+++ b/ext/standard/tests/dir/scandir_variation5.phpt
@@ -42,20 +42,19 @@ chmod($sub_dir_path, 0777);
$child_dir_path = $sub_dir_path."/child_dir";
mkdir($child_dir_path);
-// remove the write and execute permisson from sub parent
+// remove the write and execute permission from sub parent
chmod($sub_dir_path, 0444);
echo "\n-- After restricting 1st level parent directory --\n";
var_dump(scandir($child_dir_path));
-// remove the execute permisson from parent dir, allowing all permission for sub dir
-chmod($sub_dir_path, 0777); // all permisson to sub dir
+// remove the execute permission from parent dir, allowing all permission for sub dir
+chmod($sub_dir_path, 0777); // all permission to sub dir
chmod($parent_dir_path, 0666); // restricting parent directory
echo "\n-- After restricting parent directory --\n";
var_dump(scandir($child_dir_path));
?>
-===DONE===
--CLEAN--
<?php
$parent_dir_path = __DIR__ . "/scandir_variation5";
@@ -76,15 +75,14 @@ rmdir($parent_dir_path);
-- After restricting 1st level parent directory --
-Warning: scandir(%s/scandir_variation5/sub_dir/child_dir): failed to open dir: %s in %s on line %d
+Warning: scandir(%s/scandir_variation5/sub_dir/child_dir): Failed to open directory: %s in %s on line %d
Warning: scandir(): (errno %d): %s in %s on line %d
bool(false)
-- After restricting parent directory --
-Warning: scandir(%s/scandir_variation5/sub_dir/child_dir): failed to open dir: %s in %s on line %d
+Warning: scandir(%s/scandir_variation5/sub_dir/child_dir): Failed to open directory: %s in %s on line %d
Warning: scandir(): (errno %d): %s in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/standard/tests/dir/scandir_variation6.phpt b/ext/standard/tests/dir/scandir_variation6.phpt
index d516411886..8947293818 100644
--- a/ext/standard/tests/dir/scandir_variation6.phpt
+++ b/ext/standard/tests/dir/scandir_variation6.phpt
@@ -38,7 +38,6 @@ var_dump( scandir($dir_path . "/sub_dir?") );
var_dump( scandir($dir_path . "/sub?dir1") );
?>
-===DONE===
--CLEAN--
<?php
$dir_path = __DIR__ . "/scandir_variation6";
@@ -52,25 +51,24 @@ rmdir($dir_path);
-- Wildcard = '*' --
-Warning: scandir(%s/scandir_var*): failed to open dir: %s in %s on line %d
+Warning: scandir(%s/scandir_var*): Failed to open directory: %s in %s on line %d
Warning: scandir(): (errno %d): %s in %s on line %d
bool(false)
-Warning: scandir(%s/*): failed to open dir: %s in %s on line %d
+Warning: scandir(%s/*): Failed to open directory: %s in %s on line %d
Warning: scandir(): (errno %d): %s in %s on line %d
bool(false)
-- Wildcard = '?' --
-Warning: scandir(%s/scandir_variation6/sub_dir?): failed to open dir: %s in %s on line %d
+Warning: scandir(%s/scandir_variation6/sub_dir?): Failed to open directory: %s in %s on line %d
Warning: scandir(): (errno %d): %s in %s on line %d
bool(false)
-Warning: scandir(%s/scandir_variation6/sub?dir1): failed to open dir: %s in %s on line %d
+Warning: scandir(%s/scandir_variation6/sub?dir1): Failed to open directory: %s in %s on line %d
Warning: scandir(): (errno %d): %s in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/standard/tests/dir/scandir_variation7.phpt b/ext/standard/tests/dir/scandir_variation7.phpt
index bd0cb74a15..eb4c7e9d21 100644
--- a/ext/standard/tests/dir/scandir_variation7.phpt
+++ b/ext/standard/tests/dir/scandir_variation7.phpt
@@ -44,23 +44,22 @@ $permission_values = array(
$iterator = 1;
foreach ($permission_values as $perm) {
- echo "\n-- Iteration $iterator --\n";
+ echo "\n-- Iteration $iterator --\n";
- // Remove the directory if already exists
- if (is_dir($dir_path)){
- chmod ($dir_path, 0777); // change dir permission to allow all operation
- rmdir ($dir_path);
- }
- mkdir($dir_path);
+ // Remove the directory if already exists
+ if (is_dir($dir_path)){
+ chmod ($dir_path, 0777); // change dir permission to allow all operation
+ rmdir ($dir_path);
+ }
+ mkdir($dir_path);
- // change the dir permisson to test dir on it
- var_dump( chmod($dir_path, $perm) );
+ // change the dir permission to test dir on it
+ var_dump( chmod($dir_path, $perm) );
- var_dump(scandir($dir_path));
- $iterator++;
+ var_dump(scandir($dir_path));
+ $iterator++;
}
?>
-===DONE===
--CLEAN--
<?php
$dir_path = __DIR__ . "/scandir_variation7";
@@ -158,4 +157,3 @@ array(2) {
[1]=>
string(2) ".."
}
-===DONE===
diff --git a/ext/standard/tests/dir/scandir_variation8-win32-mb.phpt b/ext/standard/tests/dir/scandir_variation8-win32-mb.phpt
index acc289e590..e353dc3725 100644
--- a/ext/standard/tests/dir/scandir_variation8-win32-mb.phpt
+++ b/ext/standard/tests/dir/scandir_variation8-win32-mb.phpt
@@ -55,11 +55,11 @@ $inputs = array(
$iterator = 1;
foreach($inputs as $key => $input) {
- echo "\n-- Iteration $iterator --\n";
- $handle = "fp{$iterator}";
- var_dump( $$handle = @fopen($dir_path . "/ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™$input.tmp", 'w') );
- fclose($$handle);
- $iterator++;
+ echo "\n-- Iteration $iterator --\n";
+ $handle = "fp{$iterator}";
+ var_dump( $$handle = @fopen($dir_path . "/ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™$input.tmp", 'w') );
+ fclose($$handle);
+ $iterator++;
};
echo "\n-- Call to scandir() --\n";
@@ -67,11 +67,10 @@ var_dump($content = scandir($dir_path));
// remove all files in directory so can remove directory in CLEAN section
foreach ($content as $file_name) {
- // suppress errors as won't be able to remove "." and ".." entries
- @unlink($dir_path . $file_name);
+ // suppress errors as won't be able to remove "." and ".." entries
+ @unlink($dir_path . $file_name);
}
?>
-===DONE===
--CLEAN--
<?php
$dir_path = __DIR__ . "/ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™scandir_variation8";
@@ -157,4 +156,3 @@ array(16) {
[15]=>
string(51) "ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™single_file.tmp"
}
-===DONE===
diff --git a/ext/standard/tests/dir/scandir_variation8.phpt b/ext/standard/tests/dir/scandir_variation8.phpt
index 5ba7a6391b..1eec187f70 100644
--- a/ext/standard/tests/dir/scandir_variation8.phpt
+++ b/ext/standard/tests/dir/scandir_variation8.phpt
@@ -49,11 +49,11 @@ $inputs = array(
$iterator = 1;
foreach($inputs as $key => $input) {
- echo "\n-- Iteration $iterator --\n";
- $handle = "fp{$iterator}";
- var_dump( $$handle = fopen(@"$dir_path$input.tmp", 'w') );
- fclose($$handle);
- $iterator++;
+ echo "\n-- Iteration $iterator --\n";
+ $handle = "fp{$iterator}";
+ var_dump( $$handle = fopen(@"$dir_path$input.tmp", 'w') );
+ fclose($$handle);
+ $iterator++;
};
echo "\n-- Call to scandir() --\n";
@@ -61,11 +61,10 @@ var_dump($content = scandir($dir_path));
// remove all files in directory so can remove directory in CLEAN section
foreach ($content as $file_name) {
- // suppress errors as won't be able to remove "." and ".." entries
- @unlink($dir_path . $file_name);
+ // suppress errors as won't be able to remove "." and ".." entries
+ @unlink($dir_path . $file_name);
}
?>
-===DONE===
--CLEAN--
<?php
$dir_path = __DIR__ . "/scandir_variation8";
@@ -151,4 +150,3 @@ array(16) {
[15]=>
string(15) "single_file.tmp"
}
-===DONE===
diff --git a/ext/standard/tests/dir/scandir_variation9-win32-mb.phpt b/ext/standard/tests/dir/scandir_variation9-win32-mb.phpt
index c634f2d3b3..c609975dda 100644
--- a/ext/standard/tests/dir/scandir_variation9-win32-mb.phpt
+++ b/ext/standard/tests/dir/scandir_variation9-win32-mb.phpt
@@ -32,12 +32,11 @@ mkdir($dir);
$ints = array (PHP_INT_MAX, -PHP_INT_MAX, 0);
foreach($ints as $sorting_order) {
- var_dump( scandir($dir, $sorting_order) );
+ var_dump( scandir($dir, $sorting_order) );
}
delete_files($dir, 2, "ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™file");
?>
-===DONE===
--CLEAN--
<?php
$dir = __DIR__ . '/ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™scandir_variation9';
@@ -75,4 +74,3 @@ array(4) {
[3]=>
string(45) "ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™file2.tmp"
}
-===DONE===
diff --git a/ext/standard/tests/dir/scandir_variation9.phpt b/ext/standard/tests/dir/scandir_variation9.phpt
index 42e42bb6cb..7e623c0e6f 100644
--- a/ext/standard/tests/dir/scandir_variation9.phpt
+++ b/ext/standard/tests/dir/scandir_variation9.phpt
@@ -26,12 +26,11 @@ mkdir($dir);
$ints = array (PHP_INT_MAX, -PHP_INT_MAX, 0);
foreach($ints as $sorting_order) {
- var_dump( scandir($dir, $sorting_order) );
+ var_dump( scandir($dir, $sorting_order) );
}
delete_files($dir, 2);
?>
-===DONE===
--CLEAN--
<?php
$dir = __DIR__ . '/scandir_variation9';
@@ -69,4 +68,3 @@ array(4) {
[3]=>
string(9) "file2.tmp"
}
-===DONE===
diff --git a/ext/standard/tests/directory/DirectoryClass_basic_001.phpt b/ext/standard/tests/directory/DirectoryClass_basic_001.phpt
index 73aac5b43c..5594207812 100644
--- a/ext/standard/tests/directory/DirectoryClass_basic_001.phpt
+++ b/ext/standard/tests/directory/DirectoryClass_basic_001.phpt
@@ -15,7 +15,12 @@ echo $rc;
echo "Cannot instantiate a valid Directory directly:\n";
$d = new Directory(getcwd());
var_dump($d);
-var_dump($d->read());
+
+try {
+ var_dump($d->read());
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
?>
--EXPECTF--
@@ -60,6 +65,4 @@ Class [ <internal%s> class Directory ] {
Cannot instantiate a valid Directory directly:
object(Directory)#%d (0) {
}
-
-Warning: Directory::read(): Unable to find my handle property in %s on line 15
-bool(false)
+Unable to find my handle property
diff --git a/ext/standard/tests/directory/DirectoryClass_error_001-mb.phpt b/ext/standard/tests/directory/DirectoryClass_error_001-mb.phpt
index cba61d3fbf..8a43fec34b 100644
--- a/ext/standard/tests/directory/DirectoryClass_error_001-mb.phpt
+++ b/ext/standard/tests/directory/DirectoryClass_error_001-mb.phpt
@@ -10,22 +10,41 @@ mkdir($d);
echo "\n--> Try all methods with bad handle:\n";
$d = new Directory($d);
$d->handle = "Havoc!";
-var_dump($d->read());
-var_dump($d->rewind());
-var_dump($d->close());
+try {
+ var_dump($d->read());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump($d->rewind());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump($d->close());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "\n--> Try all methods with no handle:\n";
$d = new Directory($d);
unset($d->handle);
-var_dump($d->read());
-var_dump($d->rewind());
-var_dump($d->close());
-echo "\n--> Try all methods with wrong number of args:\n";
-$d = new Directory($d);
-var_dump($d->read(1,2));
-var_dump($d->rewind(1,2));
-var_dump($d->close(1,2));
+try {
+ var_dump($d->read());
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+try {
+ var_dump($d->rewind());
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+try {
+ var_dump($d->close());
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
?>
--CLEAN--
@@ -34,36 +53,13 @@ $d = getcwd().PATH_SEPARATOR."ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™";
rmdir($d);
?>
---EXPECTF--
+--EXPECT--
--> Try all methods with bad handle:
-
-Warning: Directory::read(): supplied argument is not a valid Directory resource in %s on line %d
-bool(false)
-
-Warning: Directory::rewind(): supplied argument is not a valid Directory resource in %s on line %d
-bool(false)
-
-Warning: Directory::close(): supplied argument is not a valid Directory resource in %s on line %d
-bool(false)
+Directory::read(): supplied argument is not a valid Directory resource
+Directory::rewind(): supplied argument is not a valid Directory resource
+Directory::close(): supplied argument is not a valid Directory resource
--> Try all methods with no handle:
-
-Warning: Directory::read(): Unable to find my handle property in %s on line %d
-bool(false)
-
-Warning: Directory::rewind(): Unable to find my handle property in %s on line %d
-bool(false)
-
-Warning: Directory::close(): Unable to find my handle property in %s on line %d
-bool(false)
-
---> Try all methods with wrong number of args:
-
-Warning: Directory::read() expects at most 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: Directory::rewind() expects at most 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: Directory::close() expects at most 1 parameter, 2 given in %s on line %d
-NULL
+Unable to find my handle property
+Unable to find my handle property
+Unable to find my handle property
diff --git a/ext/standard/tests/directory/DirectoryClass_error_001.phpt b/ext/standard/tests/directory/DirectoryClass_error_001.phpt
index 5b2771eef6..1a8bbf3c1d 100644
--- a/ext/standard/tests/directory/DirectoryClass_error_001.phpt
+++ b/ext/standard/tests/directory/DirectoryClass_error_001.phpt
@@ -6,54 +6,50 @@ Directory class behaviour.
echo "\n--> Try all methods with bad handle:\n";
$d = new Directory(getcwd());
$d->handle = "Havoc!";
-var_dump($d->read());
-var_dump($d->rewind());
-var_dump($d->close());
+try {
+ var_dump($d->read());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump($d->rewind());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump($d->close());
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "\n--> Try all methods with no handle:\n";
$d = new Directory(getcwd());
unset($d->handle);
-var_dump($d->read());
-var_dump($d->rewind());
-var_dump($d->close());
-echo "\n--> Try all methods with wrong number of args:\n";
-$d = new Directory(getcwd());
-var_dump($d->read(1,2));
-var_dump($d->rewind(1,2));
-var_dump($d->close(1,2));
+try {
+ var_dump($d->read());
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+try {
+ var_dump($d->rewind());
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+try {
+ var_dump($d->close());
+} catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
?>
---EXPECTF--
+--EXPECT--
--> Try all methods with bad handle:
-
-Warning: Directory::read(): supplied argument is not a valid Directory resource in %s on line %d
-bool(false)
-
-Warning: Directory::rewind(): supplied argument is not a valid Directory resource in %s on line %d
-bool(false)
-
-Warning: Directory::close(): supplied argument is not a valid Directory resource in %s on line %d
-bool(false)
+Directory::read(): supplied argument is not a valid Directory resource
+Directory::rewind(): supplied argument is not a valid Directory resource
+Directory::close(): supplied argument is not a valid Directory resource
--> Try all methods with no handle:
-
-Warning: Directory::read(): Unable to find my handle property in %s on line %d
-bool(false)
-
-Warning: Directory::rewind(): Unable to find my handle property in %s on line %d
-bool(false)
-
-Warning: Directory::close(): Unable to find my handle property in %s on line %d
-bool(false)
-
---> Try all methods with wrong number of args:
-
-Warning: Directory::read() expects at most 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: Directory::rewind() expects at most 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: Directory::close() expects at most 1 parameter, 2 given in %s on line %d
-NULL
+Unable to find my handle property
+Unable to find my handle property
+Unable to find my handle property
diff --git a/ext/standard/tests/directory/bug74589_utf8.phpt b/ext/standard/tests/directory/bug74589_utf8.phpt
index 1bec90fe16..7a13b57f04 100644
--- a/ext/standard/tests/directory/bug74589_utf8.phpt
+++ b/ext/standard/tests/directory/bug74589_utf8.phpt
@@ -23,21 +23,19 @@ mkdir($dir);
file_put_contents($test_file,
"<?php
- var_dump(__DIR__);
- var_dump(__FILE__);
- var_dump(__DIR__ === __DIR__);");
+ var_dump(__DIR__);
+ var_dump(__FILE__);
+ var_dump(__DIR__ === __DIR__);");
$php = getenv('TEST_PHP_EXECUTABLE');
echo shell_exec("$php -n $test_file");
?>
-===DONE===
--EXPECTF--
string(%d) "%sbug74589_新建文件夹"
string(%d) "%sbug74589_新建文件夹%etest.php"
bool(true)
-===DONE===
--CLEAN--
<?php
$item = "bug74589_新建文件夹"; // utf-8 string
diff --git a/ext/standard/tests/file/001.phpt b/ext/standard/tests/file/001.phpt
index d5ab2e5a0b..e2fa6cce59 100644
--- a/ext/standard/tests/file/001.phpt
+++ b/ext/standard/tests/file/001.phpt
@@ -50,14 +50,14 @@ $s = stat ('test.file');
$ls = lstat ('test.file');
for ($i = 0; $i <= 12; $i++) {
if ($ls[$i] != $s[$i]) {
- echo "test.file lstat and stat differ at element $i\n";
+ echo "test.file lstat and stat differ at element $i\n";
}
}
$s = stat ('test.link');
$ls = lstat ('test.link');
for ($i = 0; $i <= 11; $i++) {
if ($ls[$i] != $s[$i]) {
- if ($i != 6 && $i != 10 && $i != 11) echo "test.link lstat and stat differ at element $i\n";
+ if ($i != 6 && $i != 10 && $i != 11) echo "test.link lstat and stat differ at element $i\n";
}
}
echo "test.file is " . filetype('test.file') . "\n";
diff --git a/ext/standard/tests/file/003.phpt b/ext/standard/tests/file/003.phpt
index 8eeaa939eb..59e03f0cef 100644
--- a/ext/standard/tests/file/003.phpt
+++ b/ext/standard/tests/file/003.phpt
@@ -4,27 +4,27 @@ is_*() and file_exists() return values are boolean.
<?php
$funcs = array(
- 'is_writable',
- 'is_readable',
- 'is_executable',
- 'is_file',
- 'file_exists',
+ 'is_writable',
+ 'is_readable',
+ 'is_executable',
+ 'is_file',
+ 'file_exists',
);
$filename="";
foreach ($funcs as $test) {
- $bb = $test($filename);
- echo gettype($bb)."\n";
- clearstatcache();
+ $bb = $test($filename);
+ echo gettype($bb)."\n";
+ clearstatcache();
}
$filename="run-tests.php";
foreach ($funcs as $test) {
- $bb = $test($filename);
- echo gettype($bb)."\n";
- clearstatcache();
+ $bb = $test($filename);
+ echo gettype($bb)."\n";
+ clearstatcache();
}
?>
diff --git a/ext/standard/tests/file/004.phpt b/ext/standard/tests/file/004.phpt
index 522b8320e4..742457c7aa 100644
--- a/ext/standard/tests/file/004.phpt
+++ b/ext/standard/tests/file/004.phpt
@@ -2,56 +2,56 @@
file_put_contents() test
--FILE--
<?php
- chdir(__DIR__);
- for ($i = 1; $i < 6; $i++) {
- @unlink("./TEST{$i}");
- }
+ chdir(__DIR__);
+ for ($i = 1; $i < 6; $i++) {
+ @unlink("./TEST{$i}");
+ }
- echo "String Test: ";
- echo file_put_contents("TEST1", file_get_contents(__FILE__)) !== FALSE ? 'OK' : 'FAIL';
- echo "\n";
+ echo "String Test: ";
+ echo file_put_contents("TEST1", file_get_contents(__FILE__)) !== FALSE ? 'OK' : 'FAIL';
+ echo "\n";
- $old_int = $int = rand();
- $ret = file_put_contents("TEST2", $int);
- echo "Integer Test: ";
- if ($int === $old_int && $ret !== FALSE && md5($int) == md5_file("TEST2")) {
- echo 'OK';
- } else {
- echo 'FAIL';
- }
- echo "\n";
+ $old_int = $int = rand();
+ $ret = file_put_contents("TEST2", $int);
+ echo "Integer Test: ";
+ if ($int === $old_int && $ret !== FALSE && md5($int) == md5_file("TEST2")) {
+ echo 'OK';
+ } else {
+ echo 'FAIL';
+ }
+ echo "\n";
- $old_int = $int = time() / 1000;
- $ret = file_put_contents("TEST3", $int);
- echo "Float Test: ";
- if ($int === $old_int && $ret !== FALSE && md5($int) == md5_file("TEST3")) {
- echo 'OK';
- } else {
- echo 'FAIL';
- }
- echo "\n";
+ $old_int = $int = time() / 1000;
+ $ret = file_put_contents("TEST3", $int);
+ echo "Float Test: ";
+ if ($int === $old_int && $ret !== FALSE && md5($int) == md5_file("TEST3")) {
+ echo 'OK';
+ } else {
+ echo 'FAIL';
+ }
+ echo "\n";
- $ret = file_put_contents("TEST4", __FILE__);
- echo "Bool Test: ";
- if ($ret !== FALSE && md5(__FILE__) == md5_file("TEST4")) {
- echo 'OK';
- } else {
- echo 'FAIL';
- }
- echo "\n";
+ $ret = file_put_contents("TEST4", __FILE__);
+ echo "Bool Test: ";
+ if ($ret !== FALSE && md5(__FILE__) == md5_file("TEST4")) {
+ echo 'OK';
+ } else {
+ echo 'FAIL';
+ }
+ echo "\n";
- $ret = @file_put_contents("TEST5", $_SERVER);
- echo "Array Test: ";
- if ($ret !== FALSE && @md5(implode('', $_SERVER)) == md5_file("TEST5")) {
- echo 'OK';
- } else {
- echo 'FAIL';
- }
- echo "\n";
+ $ret = @file_put_contents("TEST5", $_SERVER);
+ echo "Array Test: ";
+ if ($ret !== FALSE && @md5(implode('', $_SERVER)) == md5_file("TEST5")) {
+ echo 'OK';
+ } else {
+ echo 'FAIL';
+ }
+ echo "\n";
- for ($i = 1; $i < 6; $i++) {
- @unlink("./TEST{$i}");
- }
+ for ($i = 1; $i < 6; $i++) {
+ @unlink("./TEST{$i}");
+ }
?>
--EXPECT--
String Test: OK
diff --git a/ext/standard/tests/file/005_error.phpt b/ext/standard/tests/file/005_error.phpt
index e3ce551b3d..bc2bf3f978 100644
--- a/ext/standard/tests/file/005_error.phpt
+++ b/ext/standard/tests/file/005_error.phpt
@@ -29,31 +29,6 @@ var_dump( filemtime("/no/such/file/or/dir") );
var_dump( filectime("/no/such/file/or/dir") );
var_dump( touch("/no/such/file/or/dir", 10) );
-/* Only one invalid argument */
-var_dump( fileatime(__FILE__, "string") );
-var_dump( filemtime(__FILE__, 100) );
-var_dump( filectime(__FILE__, TRUE) );
-var_dump( touch(__FILE__, 10, 100, 123) );
-
-echo "\n-- Testing No.of arguments less than expected --";
-var_dump( fileatime() );
-var_dump( filemtime() );
-var_dump( filectime() );
-var_dump( touch() );
-
-echo "\n-- Testing No.of arguments greater than expected --";
-/* Both invalid arguments */
-var_dump( fileatime("/no/such/file/or/dir", "string") );
-var_dump( filemtime("/no/such/file/or/dir", 100) );
-var_dump( filectime("/no/such/file/or/dir", TRUE) );
-var_dump( touch("/no/such/file/or/dir", 10, 100, 123) );
-
-/* Only one invalid argument */
-var_dump( fileatime(__FILE__, "string") );
-var_dump( filemtime(__FILE__, 100) );
-var_dump( filectime(__FILE__, TRUE) );
-var_dump( touch(__FILE__, 10, 100, 123) );
-
echo "\nDone";
?>
--EXPECTF--
@@ -72,54 +47,4 @@ bool(false)
Warning: touch(): Unable to create file /no/such/file/or/dir because No such file or directory in %s on line %d
bool(false)
-Warning: fileatime() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: filemtime() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: filectime() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: touch() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-
--- Testing No.of arguments less than expected --
-Warning: fileatime() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: filemtime() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: filectime() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: touch() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
--- Testing No.of arguments greater than expected --
-Warning: fileatime() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: filemtime() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: filectime() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: touch() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-
-Warning: fileatime() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: filemtime() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: filectime() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: touch() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-
Done
diff --git a/ext/standard/tests/file/005_variation-win32.phpt b/ext/standard/tests/file/005_variation-win32.phpt
index 1e712b7828..42502b6509 100644
--- a/ext/standard/tests/file/005_variation-win32.phpt
+++ b/ext/standard/tests/file/005_variation-win32.phpt
@@ -40,7 +40,6 @@ function stat_fn( $filename ) {
echo "-- inode change time is => ";
print( @date( 'Y:M:D:H:i:s', filectime($filename) ) )."\n";
clearstatcache();
-
}
echo "*** Testing fileattime(), filemtime(), filectime() & touch() : usage variations ***\n";
@@ -49,12 +48,12 @@ $file_path = __DIR__;
$file_handle = fopen("$file_path/005_variation1.tmp", "w");
fclose($file_handle);
stat_fn("$file_path/005_variation1.tmp");
-sleep(2);
+sleep(1);
$file_handle = fopen("$file_path/005_variation2.tmp", "w");
fclose($file_handle);
stat_fn("$file_path/005_variation2.tmp");
-sleep(2);
+sleep(1);
$file_handle = fopen("$file_path/005_variation3.tmp", "w");
fclose($file_handle);
@@ -70,13 +69,13 @@ $file_name = "$file_path/005_variation1.tmp";
$file_write_handle = fopen($file_name, "w");
fclose($file_write_handle);
stat_fn($file_name);
-sleep(2);
+sleep(1);
/* filectime + 2 */
echo "\n-- Checking different times, after changing the file permission --\n";
chmod($file_name, 0777);
stat_fn($file_name);
-sleep(2);
+sleep(1);
/* filemtime + 2 & filectime + 2 */
echo "\n-- Checking different times, after writing into the file --\n";
@@ -84,7 +83,7 @@ $file_write_handle = fopen($file_name, "w");
fwrite($file_write_handle, "Hello, world");
fclose($file_write_handle);
stat_fn($file_name);
-sleep(2);
+sleep(1);
/* fileatime + 2 */
echo "\n-- Checking different times, after reading from the file --\n";
@@ -92,42 +91,54 @@ $file_read_handle = fopen($file_name ,"r");
fread($file_read_handle, 10);
fclose( $file_read_handle);
stat_fn($file_name);
-sleep(2);
+sleep(1);
+
+/* No change */
+echo "\n-- Checking same times, after creating a softlink to the file --\n";
+symlink($file_name, "$file_path/005_variation_softlink.tmp");
+stat_fn($file_name);
+sleep(1);
+
+/* filectime + 2 */
+echo "\n-- Checking different times, after creating a hardlink to the file --\n";
+link($file_name, "$file_path/005_variation_hardlink.tmp");
+stat_fn($file_name);
+sleep(1);
/* No change */
-echo "\n-- Checking different times, after making a copy of the file --\n";
+echo "\n-- Checking same times, after making a copy of the file --\n";
$file_copy = "$file_path/005_variation_copy.tmp";
copy($file_name, $file_copy);
stat_fn($file_name);
-sleep(2);
+sleep(1);
/* fileatime + 2 */
echo "\n-- Checking different times, after performing is_file() operation on the file --\n";
is_file($file_name);
stat_fn($file_name);
-sleep(2);
+sleep(1);
echo "\n*** Testing touch() function with different time values ***\n";
$file_name2 = $file_path."/005_variation_touch.tmp";
$file_handle = fopen($file_name2, "w");
fclose($file_handle);
-sleep(2);
+sleep(1);
/* Time is not mentioned */
var_dump( touch($file_name2) ); //set to current system time
stat_fn($file_name2);
-sleep(2);
+sleep(1);
/* set to access(creation time of the file) time */
var_dump( touch($file_name2, @date(fileatime($file_name2))) );
stat_fn($file_name2);
-sleep(2);
+sleep(1);
/* set to access time of $file_name2 */
var_dump( touch($file_path."/005_variation_touch_fly.tmp", @date(fileatime($file_name2)), time()) );
stat_fn($file_name2);
-sleep(2);
+sleep(1);
/* set to default value, with Invalid timestamps */
var_dump( touch($file_name2, 10) );
@@ -184,7 +195,17 @@ unlink($file_path."/005_variation_touch_new.tmp");
-- File modification time is => %d:%s:%s:%d:%d:%d
-- inode change time is => %d:%s:%s:%d:%d:%d
--- Checking different times, after making a copy of the file --
+-- Checking same times, after creating a softlink to the file --
+-- File access time is => %d:%s:%s:%d:%d:%d
+-- File modification time is => %d:%s:%s:%d:%d:%d
+-- inode change time is => %d:%s:%s:%d:%d:%d
+
+-- Checking different times, after creating a hardlink to the file --
+-- File access time is => %d:%s:%s:%d:%d:%d
+-- File modification time is => %d:%s:%s:%d:%d:%d
+-- inode change time is => %d:%s:%s:%d:%d:%d
+
+-- Checking same times, after making a copy of the file --
-- File access time is => %d:%s:%s:%d:%d:%d
-- File modification time is => %d:%s:%s:%d:%d:%d
-- inode change time is => %d:%s:%s:%d:%d:%d
diff --git a/ext/standard/tests/file/006_error.phpt b/ext/standard/tests/file/006_error.phpt
index 9451a3e18b..9234922790 100644
--- a/ext/standard/tests/file/006_error.phpt
+++ b/ext/standard/tests/file/006_error.phpt
@@ -36,19 +36,6 @@ var_dump( chmod("/no/such/file/dir", 0777) );
var_dump( fileperms("/no/such/file/dir") );
echo "\n";
-/* With args less than expected */
-$fp = fopen(__DIR__."/006_error.tmp", "w");
-fclose($fp);
-var_dump( chmod(__DIR__."/006_error.tmp") );
-var_dump( chmod("nofile") );
-var_dump( chmod() );
-var_dump( fileperms() );
-
-/* With args greater than expected */
-var_dump( chmod(__DIR__."/006_error.tmp", 0755, TRUE) );
-var_dump( fileperms(__DIR__."/006_error.tmp", 0777) );
-var_dump( fileperms("nofile", 0777) );
-
echo "\n*** Done ***\n";
?>
--CLEAN--
@@ -73,25 +60,4 @@ Warning: fileperms(): stat failed for /no/such/file/dir in %s on line %d
bool(false)
-Warning: chmod() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: chmod() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: chmod() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: fileperms() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: chmod() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-Warning: fileperms() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: fileperms() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
*** Done ***
diff --git a/ext/standard/tests/file/006_variation2.phpt b/ext/standard/tests/file/006_variation2.phpt
index 6e87d24675..a5c95ab1da 100644
--- a/ext/standard/tests/file/006_variation2.phpt
+++ b/ext/standard/tests/file/006_variation2.phpt
@@ -58,15 +58,23 @@ $perms_array = array(
$count = 1;
foreach($perms_array as $permission) {
echo "-- Iteration $count --\n";
- var_dump( chmod($file_name, $permission) );
- printf("%o", fileperms($file_name) );
- echo "\n";
- clearstatcache();
-
- var_dump( chmod($dir_name, $permission) );
- printf("%o", fileperms($dir_name) );
- echo "\n";
- clearstatcache();
+ try {
+ var_dump( chmod($file_name, $permission) );
+ printf("%o", fileperms($file_name) );
+ echo "\n";
+ clearstatcache();
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+
+ try {
+ var_dump( chmod($dir_name, $permission) );
+ printf("%o", fileperms($dir_name) );
+ echo "\n";
+ clearstatcache();
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$count++;
}
echo "*** Done ***\n";
@@ -138,39 +146,15 @@ bool(true)
bool(true)
43567
-- Iteration 12 --
-
-Warning: chmod() expects parameter 2 to be int, string given in %s on line %d
-NULL
-103567
-
-Warning: chmod() expects parameter 2 to be int, string given in %s on line %d
-NULL
-43567
+chmod() expects parameter 2 to be int, string given
+chmod() expects parameter 2 to be int, string given
-- Iteration 13 --
-
-Warning: chmod() expects parameter 2 to be int, string given in %s on line %d
-NULL
-103567
-
-Warning: chmod() expects parameter 2 to be int, string given in %s on line %d
-NULL
-43567
+chmod() expects parameter 2 to be int, string given
+chmod() expects parameter 2 to be int, string given
-- Iteration 14 --
-
-Warning: chmod() expects parameter 2 to be int, string given in %s on line %d
-NULL
-103567
-
-Warning: chmod() expects parameter 2 to be int, string given in %s on line %d
-NULL
-43567
+chmod() expects parameter 2 to be int, string given
+chmod() expects parameter 2 to be int, string given
-- Iteration 15 --
-
-Warning: chmod() expects parameter 2 to be int, string given in %s on line %d
-NULL
-103567
-
-Warning: chmod() expects parameter 2 to be int, string given in %s on line %d
-NULL
-43567
+chmod() expects parameter 2 to be int, string given
+chmod() expects parameter 2 to be int, string given
*** Done ***
diff --git a/ext/standard/tests/file/007_basic.phpt b/ext/standard/tests/file/007_basic.phpt
index fd2e5575a9..fa25431580 100644
--- a/ext/standard/tests/file/007_basic.phpt
+++ b/ext/standard/tests/file/007_basic.phpt
@@ -51,9 +51,17 @@ for( $i=0; $i<count($modes); $i++ ) {
// check fclose()
var_dump( fclose($handle) );
var_dump( $handle );
- // confirm the closure, using ftell() and feof(), expect, false
- var_dump( ftell($handle) );
- var_dump( feof($handle) );
+ // confirm the closure, using ftell() and feof()
+ try {
+ var_dump( ftell($handle) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ try {
+ var_dump( feof($handle) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
}
// remove the temp file
@@ -78,9 +86,17 @@ for( $i=0; $i<count($x_modes); $i++ ) {
// check fclose()
var_dump( fclose($handle) );
var_dump( $handle );
- // confirm the closure, using ftell() and feof(), expect, false
- var_dump( ftell($handle) );
- var_dump( feof($handle) );
+ // confirm the closure, using ftell() and feof()
+ try {
+ var_dump( ftell($handle) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ try {
+ var_dump( feof($handle) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
var_dump( $handle );
// remove the file
@@ -97,12 +113,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
-- Iteration with mode 'wb' --
resource(%d) of type (stream)
@@ -110,12 +122,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
-- Iteration with mode 'wt' --
resource(%d) of type (stream)
@@ -123,12 +131,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
-- Iteration with mode 'w+' --
resource(%d) of type (stream)
@@ -136,12 +140,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
-- Iteration with mode 'w+b' --
resource(%d) of type (stream)
@@ -149,12 +149,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
-- Iteration with mode 'w+t' --
resource(%d) of type (stream)
@@ -162,12 +158,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
-- Iteration with mode 'r' --
resource(%d) of type (stream)
@@ -175,12 +167,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
-- Iteration with mode 'rb' --
resource(%d) of type (stream)
@@ -188,12 +176,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
-- Iteration with mode 'rt' --
resource(%d) of type (stream)
@@ -201,12 +185,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
-- Iteration with mode 'r+' --
resource(%d) of type (stream)
@@ -214,12 +194,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
-- Iteration with mode 'r+b' --
resource(%d) of type (stream)
@@ -227,12 +203,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
-- Iteration with mode 'r+t' --
resource(%d) of type (stream)
@@ -240,12 +212,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
-- Iteration with mode 'a' --
resource(%d) of type (stream)
@@ -253,12 +221,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
-- Iteration with mode 'ab' --
resource(%d) of type (stream)
@@ -266,12 +230,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
-- Iteration with mode 'at' --
resource(%d) of type (stream)
@@ -279,12 +239,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
-- Iteration with mode 'a+' --
resource(%d) of type (stream)
@@ -292,12 +248,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
-- Iteration with mode 'a+t' --
resource(%d) of type (stream)
@@ -305,12 +257,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
-- Iteration with mode 'a+b' --
resource(%d) of type (stream)
@@ -318,12 +266,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
-- Iteration with mode 'x' --
resource(%d) of type (stream)
@@ -331,12 +275,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
resource(%d) of type (Unknown)
-- Iteration with mode 'xb' --
@@ -345,12 +285,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
resource(%d) of type (Unknown)
-- Iteration with mode 'xt' --
@@ -359,12 +295,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
resource(%d) of type (Unknown)
-- Iteration with mode 'x+' --
@@ -373,12 +305,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
resource(%d) of type (Unknown)
-- Iteration with mode 'x+b' --
@@ -387,12 +315,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
resource(%d) of type (Unknown)
-- Iteration with mode 'x+t' --
@@ -401,12 +325,8 @@ int(0)
bool(false)
bool(true)
resource(%d) of type (Unknown)
-
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
+feof(): supplied resource is not a valid stream resource
resource(%d) of type (Unknown)
*** Done ***
diff --git a/ext/standard/tests/file/007_error.phpt b/ext/standard/tests/file/007_error.phpt
deleted file mode 100644
index 93a6a23e5f..0000000000
--- a/ext/standard/tests/file/007_error.phpt
+++ /dev/null
@@ -1,185 +0,0 @@
---TEST--
-Test fopen, fclose() & feof() functions: error conditions
---CREDITS--
-Dave Kelsey <d_kelsey@uk.ibm.com>
---FILE--
-<?php
-/*
- Prototype: resource fopen(string $filename, string $mode
- [, bool $use_include_path [, resource $context]] );
- Description: Opens file or URL.
-
- Prototype: bool fclose ( resource $handle );
- Description: Closes an open file pointer
-
- Prototype: bool feof ( resource $handle )
- Description: Returns TRUE if the file pointer is at EOF or an error occurs
- (including socket timeout); otherwise returns FALSE.
-*/
-
-echo "*** Testing error conditions for fopen(), fclsoe() & feof() ***\n";
-/* Arguments less than minimum no.of args */
-
-// fopen ()
-var_dump(fopen(__FILE__)); // one valid argument
-var_dump(fopen()); // zero argument
-
-// fclose()
-$fp = fopen(__FILE__, "r");
-fclose($fp);
-var_dump( fclose($fp) ); // closed handle
-var_dump( fclose(__FILE__) ); // invalid handle
-var_dump( fclose() ); // zero argument
-
-//feof()
-var_dump( feof($fp) ); // closed handle
-var_dump( feof(__FILE__) ); // invalid handle
-var_dump( feof() ); //zero argument
-
-/* Arguments greater than maximum no.of ags */
-var_dump(fopen(__FILE__, "r", TRUE, "www.example.com", 100));
-
-$fp = fopen(__FILE__, "r");
-var_dump( fclose($fp, "handle") );
-
-var_dump( feof($fp, "handle"));
-fclose($fp);
-
-/* test invalid arguments : non-resources */
-echo "-- Testing fopen(), fclose() & feof() with invalid arguments --\n";
-$invalid_args = array (
- "string",
- 10,
- 10.5,
- true,
- array(1,2,3),
- new stdclass,
- NULL,
- ""
-);
-
-/* loop to test fclose with different invalid type of args */
-for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) {
- echo "-- Iteration $loop_counter --\n";
- var_dump( fopen($invalid_args[$loop_counter - 1], "r") );
- var_dump( fclose($invalid_args[$loop_counter - 1]) );
- var_dump( feof($invalid_args[$loop_counter - 1]) );
-}
-
-?>
---EXPECTF--
-*** Testing error conditions for fopen(), fclsoe() & feof() ***
-
-Warning: fopen() expects at least 2 parameters, 1 given in %s on line %d
-bool(false)
-
-Warning: fopen() expects at least 2 parameters, 0 given in %s on line %d
-bool(false)
-
-Warning: fclose(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: fclose() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
-
-Warning: fclose() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: feof() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
-
-Warning: feof() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: fopen() expects at most 4 parameters, 5 given in %s on line %d
-bool(false)
-
-Warning: fclose() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
-
-Warning: feof() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
--- Testing fopen(), fclose() & feof() with invalid arguments --
--- Iteration 1 --
-
-Warning: fopen(string): failed to open stream: No such file or directory in %s on line %d
-bool(false)
-
-Warning: fclose() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
-
-Warning: feof() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
--- Iteration 2 --
-
-Warning: fopen(10): failed to open stream: No such file or directory in %s on line %d
-bool(false)
-
-Warning: fclose() expects parameter 1 to be resource, int given in %s on line %d
-bool(false)
-
-Warning: feof() expects parameter 1 to be resource, int given in %s on line %d
-bool(false)
--- Iteration 3 --
-
-Warning: fopen(10.5): failed to open stream: No such file or directory in %s on line %d
-bool(false)
-
-Warning: fclose() expects parameter 1 to be resource, float given in %s on line %d
-bool(false)
-
-Warning: feof() expects parameter 1 to be resource, float given in %s on line %d
-bool(false)
--- Iteration 4 --
-
-Warning: fopen(1): failed to open stream: No such file or directory in %s on line %d
-bool(false)
-
-Warning: fclose() expects parameter 1 to be resource, bool given in %s on line %d
-bool(false)
-
-Warning: feof() expects parameter 1 to be resource, bool given in %s on line %d
-bool(false)
--- Iteration 5 --
-
-Warning: fopen() expects parameter 1 to be a valid path, array given in %s on line %d
-bool(false)
-
-Warning: fclose() expects parameter 1 to be resource, array given in %s on line %d
-bool(false)
-
-Warning: feof() expects parameter 1 to be resource, array given in %s on line %d
-bool(false)
--- Iteration 6 --
-
-Warning: fopen() expects parameter 1 to be a valid path, object given in %s on line %d
-bool(false)
-
-Warning: fclose() expects parameter 1 to be resource, object given in %s on line %d
-bool(false)
-
-Warning: feof() expects parameter 1 to be resource, object given in %s on line %d
-bool(false)
--- Iteration 7 --
-
-Warning: fopen(): Filename cannot be empty in %s on line %d
-bool(false)
-
-Warning: fclose() expects parameter 1 to be resource, null given in %s on line %d
-bool(false)
-
-Warning: feof() expects parameter 1 to be resource, null given in %s on line %d
-bool(false)
--- Iteration 8 --
-
-Warning: fopen(): Filename cannot be empty in %s on line %d
-bool(false)
-
-Warning: fclose() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
-
-Warning: feof() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
diff --git a/ext/standard/tests/file/007_variation1.phpt b/ext/standard/tests/file/007_variation1.phpt
index f22fdc0dc9..5de97e32cc 100644
--- a/ext/standard/tests/file/007_variation1.phpt
+++ b/ext/standard/tests/file/007_variation1.phpt
@@ -49,7 +49,7 @@ string(20) "line
line of text
li"
-Notice: fwrite(): write of 37 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 37 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
bool(true)
string(7) "Unknown"
diff --git a/ext/standard/tests/file/007_variation11-win32-mb.phpt b/ext/standard/tests/file/007_variation11-win32-mb.phpt
index fc24ba3853..785305c927 100644
--- a/ext/standard/tests/file/007_variation11-win32-mb.phpt
+++ b/ext/standard/tests/file/007_variation11-win32-mb.phpt
@@ -69,7 +69,7 @@ int(0)
int(37)
int(37)
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(true)
diff --git a/ext/standard/tests/file/007_variation11-win32.phpt b/ext/standard/tests/file/007_variation11-win32.phpt
index f52e211ea5..619f51a208 100644
--- a/ext/standard/tests/file/007_variation11-win32.phpt
+++ b/ext/standard/tests/file/007_variation11-win32.phpt
@@ -67,7 +67,7 @@ int(0)
int(37)
int(37)
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(true)
diff --git a/ext/standard/tests/file/007_variation11.phpt b/ext/standard/tests/file/007_variation11.phpt
index 6bc9975104..817e92bdea 100644
--- a/ext/standard/tests/file/007_variation11.phpt
+++ b/ext/standard/tests/file/007_variation11.phpt
@@ -67,7 +67,7 @@ int(0)
int(37)
int(37)
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(true)
diff --git a/ext/standard/tests/file/007_variation13-win32.phpt b/ext/standard/tests/file/007_variation13-win32.phpt
index d588cc4235..dcb3c83670 100644
--- a/ext/standard/tests/file/007_variation13-win32.phpt
+++ b/ext/standard/tests/file/007_variation13-win32.phpt
@@ -57,7 +57,7 @@ resource(%d) of type (stream)
string(6) "stream"
int(37)
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(true)
diff --git a/ext/standard/tests/file/007_variation13.phpt b/ext/standard/tests/file/007_variation13.phpt
index 742d06a487..09fbb237a3 100644
--- a/ext/standard/tests/file/007_variation13.phpt
+++ b/ext/standard/tests/file/007_variation13.phpt
@@ -57,7 +57,7 @@ resource(%d) of type (stream)
string(6) "stream"
int(37)
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(true)
diff --git a/ext/standard/tests/file/007_variation15.phpt b/ext/standard/tests/file/007_variation15.phpt
index 128ed2fc46..fa6c1f9951 100644
--- a/ext/standard/tests/file/007_variation15.phpt
+++ b/ext/standard/tests/file/007_variation15.phpt
@@ -50,11 +50,11 @@ int(0)
int(37)
int(37)
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(true)
string(7) "Unknown"
-Warning: fopen(%s): failed to open stream: File exists in %s on line %d
+Warning: fopen(%s): Failed to open stream: File exists in %s on line %d
*** Done ***
diff --git a/ext/standard/tests/file/007_variation16.phpt b/ext/standard/tests/file/007_variation16.phpt
index 9173138db4..150067b391 100644
--- a/ext/standard/tests/file/007_variation16.phpt
+++ b/ext/standard/tests/file/007_variation16.phpt
@@ -56,5 +56,5 @@ int(37)
bool(true)
string(7) "Unknown"
-Warning: fopen(%s): failed to open stream: File exists in %s on line %d
+Warning: fopen(%s): Failed to open stream: File exists in %s on line %d
*** Done ***
diff --git a/ext/standard/tests/file/007_variation17.phpt b/ext/standard/tests/file/007_variation17.phpt
index b817526365..d37d983b70 100644
--- a/ext/standard/tests/file/007_variation17.phpt
+++ b/ext/standard/tests/file/007_variation17.phpt
@@ -49,7 +49,7 @@ string(20) "line
line of text
li"
-Notice: fwrite(): write of 37 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 37 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
bool(true)
string(7) "Unknown"
diff --git a/ext/standard/tests/file/007_variation19.phpt b/ext/standard/tests/file/007_variation19.phpt
index 316616fa14..09e171bad1 100644
--- a/ext/standard/tests/file/007_variation19.phpt
+++ b/ext/standard/tests/file/007_variation19.phpt
@@ -62,7 +62,7 @@ int(0)
int(37)
int(37)
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(true)
diff --git a/ext/standard/tests/file/007_variation21.phpt b/ext/standard/tests/file/007_variation21.phpt
index 37b1797491..3d0eaa5863 100644
--- a/ext/standard/tests/file/007_variation21.phpt
+++ b/ext/standard/tests/file/007_variation21.phpt
@@ -52,7 +52,7 @@ resource(%d) of type (stream)
string(6) "stream"
int(37)
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(true)
diff --git a/ext/standard/tests/file/007_variation23.phpt b/ext/standard/tests/file/007_variation23.phpt
index eafa408eac..ef9d532585 100644
--- a/ext/standard/tests/file/007_variation23.phpt
+++ b/ext/standard/tests/file/007_variation23.phpt
@@ -50,11 +50,11 @@ int(0)
int(37)
int(37)
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(true)
string(7) "Unknown"
-Warning: fopen(%s): failed to open stream: File exists in %s on line %d
+Warning: fopen(%s): Failed to open stream: File exists in %s on line %d
*** Done ***
diff --git a/ext/standard/tests/file/007_variation24.phpt b/ext/standard/tests/file/007_variation24.phpt
index 86b7347a1c..61d83712cd 100644
--- a/ext/standard/tests/file/007_variation24.phpt
+++ b/ext/standard/tests/file/007_variation24.phpt
@@ -56,5 +56,5 @@ int(37)
bool(true)
string(7) "Unknown"
-Warning: fopen(%s): failed to open stream: File exists in %s on line %d
+Warning: fopen(%s): Failed to open stream: File exists in %s on line %d
*** Done ***
diff --git a/ext/standard/tests/file/007_variation3.phpt b/ext/standard/tests/file/007_variation3.phpt
index 59fb4587f9..8838a4d783 100644
--- a/ext/standard/tests/file/007_variation3.phpt
+++ b/ext/standard/tests/file/007_variation3.phpt
@@ -62,7 +62,7 @@ int(0)
int(37)
int(37)
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(true)
diff --git a/ext/standard/tests/file/007_variation5.phpt b/ext/standard/tests/file/007_variation5.phpt
index 5e4fc5c9db..69b0ae6332 100644
--- a/ext/standard/tests/file/007_variation5.phpt
+++ b/ext/standard/tests/file/007_variation5.phpt
@@ -52,7 +52,7 @@ resource(%d) of type (stream)
string(6) "stream"
int(37)
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(true)
diff --git a/ext/standard/tests/file/007_variation7.phpt b/ext/standard/tests/file/007_variation7.phpt
index 40e22c4655..6c8613c57d 100644
--- a/ext/standard/tests/file/007_variation7.phpt
+++ b/ext/standard/tests/file/007_variation7.phpt
@@ -50,11 +50,11 @@ int(0)
int(37)
int(37)
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(true)
string(7) "Unknown"
-Warning: fopen(%s): failed to open stream: File exists in %s on line %d
+Warning: fopen(%s): Failed to open stream: File exists in %s on line %d
*** Done ***
diff --git a/ext/standard/tests/file/007_variation8.phpt b/ext/standard/tests/file/007_variation8.phpt
index b19fbaf9ec..bc26245b87 100644
--- a/ext/standard/tests/file/007_variation8.phpt
+++ b/ext/standard/tests/file/007_variation8.phpt
@@ -56,5 +56,5 @@ int(37)
bool(true)
string(7) "Unknown"
-Warning: fopen(%s): failed to open stream: File exists in %s on line %d
+Warning: fopen(%s): Failed to open stream: File exists in %s on line %d
*** Done ***
diff --git a/ext/standard/tests/file/007_variation9.phpt b/ext/standard/tests/file/007_variation9.phpt
index c20d3b4cf1..a21a807d20 100644
--- a/ext/standard/tests/file/007_variation9.phpt
+++ b/ext/standard/tests/file/007_variation9.phpt
@@ -49,7 +49,7 @@ string(20) "line
line of text
li"
-Notice: fwrite(): write of 37 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 37 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
bool(true)
string(7) "Unknown"
diff --git a/ext/standard/tests/file/basename-win32.phpt b/ext/standard/tests/file/basename-win32.phpt
index 996b060cea..703861dec7 100644
--- a/ext/standard/tests/file/basename-win32.phpt
+++ b/ext/standard/tests/file/basename-win32.phpt
@@ -115,23 +115,6 @@ check_basename( $file_paths );
echo "\n*** Testing possible variations in path and suffix ***\n";
check_basename( $file_path_variations );
-echo "\n*** Testing error conditions ***\n";
-// zero arguments
-var_dump( basename() );
-
-// more than expected no. of arguments
-var_dump( basename("\\blah\\tmp\\bar.zip", ".zip", ".zip") );
-
-// passing invalid type arguments
-$object = new stdclass;
-var_dump( basename( array("string\\bar") ) );
-var_dump( basename( array("string\\bar"), "bar" ) );
-var_dump( basename( "bar", array("string\\bar") ) );
-var_dump( basename( $object, "bar" ) );
-var_dump( basename( $object ) );
-var_dump( basename( $object, $object ) );
-var_dump( basename( "bar", $object ) );
-
echo "Done\n";
?>
--EXPECTF--
@@ -309,33 +292,4 @@ string(0) ""
--Iteration 32--
string(0) ""
-
-*** Testing error conditions ***
-
-Warning: basename() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: basename() expects at most 2 parameters, 3 given in %s on line %d
-NULL
-
-Warning: basename() expects parameter 1 to be string, array given in %s on line %d
-NULL
-
-Warning: basename() expects parameter 1 to be string, array given in %s on line %d
-NULL
-
-Warning: basename() expects parameter 2 to be string, array given in %s on line %d
-NULL
-
-Warning: basename() expects parameter 1 to be string, object given in %s on line %d
-NULL
-
-Warning: basename() expects parameter 1 to be string, object given in %s on line %d
-NULL
-
-Warning: basename() expects parameter 1 to be string, object given in %s on line %d
-NULL
-
-Warning: basename() expects parameter 2 to be string, object given in %s on line %d
-NULL
Done
diff --git a/ext/standard/tests/file/basename.phpt b/ext/standard/tests/file/basename.phpt
index a9b4389b5a..8352f4da4b 100644
--- a/ext/standard/tests/file/basename.phpt
+++ b/ext/standard/tests/file/basename.phpt
Binary files differ
diff --git a/ext/standard/tests/file/basename_basic-win32.phpt b/ext/standard/tests/file/basename_basic-win32.phpt
index ceccf9eef7..79de350eae 100644
--- a/ext/standard/tests/file/basename_basic-win32.phpt
+++ b/ext/standard/tests/file/basename_basic-win32.phpt
@@ -60,7 +60,7 @@ $file_paths = array (
);
foreach ($file_paths as $file_path) {
- var_dump(basename($file_path));
+ var_dump(basename($file_path));
}
?>
diff --git a/ext/standard/tests/file/basename_basic.phpt b/ext/standard/tests/file/basename_basic.phpt
index 6354b2acd7..55bd868c55 100644
--- a/ext/standard/tests/file/basename_basic.phpt
+++ b/ext/standard/tests/file/basename_basic.phpt
@@ -60,7 +60,7 @@ $file_paths = array (
);
foreach ($file_paths as $file_path) {
- var_dump(basename($file_path));
+ var_dump(basename($file_path));
}
?>
diff --git a/ext/standard/tests/file/basename_bug66395-win32.phpt b/ext/standard/tests/file/basename_bug66395-win32.phpt
index b4ad18dd28..c276107881 100644
--- a/ext/standard/tests/file/basename_bug66395-win32.phpt
+++ b/ext/standard/tests/file/basename_bug66395-win32.phpt
@@ -9,10 +9,8 @@ echo basename("d:subdir\\file.txt") . "\n";
echo basename("y:file.txt", ".txt") . "\n";
echo basename("notdriveletter:file.txt") . "\n";
?>
-==DONE==
--EXPECT--
file.txt
file.txt
file
notdriveletter:file.txt
-==DONE==
diff --git a/ext/standard/tests/file/basename_bug66395_variation2-win32.phpt b/ext/standard/tests/file/basename_bug66395_variation2-win32.phpt
index 4dc05dbeb1..7311b7797c 100644
--- a/ext/standard/tests/file/basename_bug66395_variation2-win32.phpt
+++ b/ext/standard/tests/file/basename_bug66395_variation2-win32.phpt
@@ -19,7 +19,6 @@ echo basename("x:y:z:hello\world:my.stream:\$DATA") . "\n";
echo basename("a:\\b:\\c:d:hello\\world:c:\$DATA") . "\n";
echo basename("a:\\b:\\c:d:hello\\d:world:c:\$DATA") . "\n";
?>
-==DONE==
--EXPECT--
y
y
@@ -35,4 +34,3 @@ world:some.stream:$DATA
world:my.stream:$DATA
world:c:$DATA
world:c:$DATA
-==DONE==
diff --git a/ext/standard/tests/file/basename_variation1-win32.phpt b/ext/standard/tests/file/basename_variation1-win32.phpt
index eb2a4ff497..b68765ca68 100644
--- a/ext/standard/tests/file/basename_variation1-win32.phpt
+++ b/ext/standard/tests/file/basename_variation1-win32.phpt
@@ -12,25 +12,25 @@ if (substr(PHP_OS, 0, 3) != 'WIN') {
$prefixes = array (
// drive letters
- "A:/",
+ "A:/",
"Z:/",
"A:\\",
// other prefixes
"http://",
"blah://",
- "blah:\\",
+ "blah:\\",
"hostname:",
- // home directory ~
- "~/",
- "~\\",
+ // home directory ~
+ "~/",
+ "~\\",
);
$paths = array (
- "foo",
- "foo/",
+ "foo",
+ "foo/",
"foo\\",
"foo.bar",
"foo.bar/",
@@ -43,11 +43,11 @@ $paths = array (
);
foreach ($prefixes as $prefix) {
- foreach ($paths as $path) {
- $input = $prefix . $path;
- echo "basename for path $input is:\n";
- var_dump(basename($input));
- }
+ foreach ($paths as $path) {
+ $input = $prefix . $path;
+ echo "basename for path $input is:\n";
+ var_dump(basename($input));
+ }
}
echo "\ndone\n";
diff --git a/ext/standard/tests/file/basename_variation1.phpt b/ext/standard/tests/file/basename_variation1.phpt
index ea7cdfe8b7..2b2ac3110e 100644
--- a/ext/standard/tests/file/basename_variation1.phpt
+++ b/ext/standard/tests/file/basename_variation1.phpt
@@ -12,25 +12,25 @@ if (substr(PHP_OS, 0, 3) == 'WIN') {
$prefixes = array (
// drive letters
- "A:/",
+ "A:/",
"Z:/",
"A:\\",
// other prefixes
"http://",
"blah://",
- "blah:\\",
+ "blah:\\",
"hostname:",
- // home directory ~
- "~/",
- "~\\",
+ // home directory ~
+ "~/",
+ "~\\",
);
$paths = array (
- "foo",
- "foo/",
+ "foo",
+ "foo/",
"foo\\",
"foo.bar",
"foo.bar/",
@@ -43,11 +43,11 @@ $paths = array (
);
foreach ($prefixes as $prefix) {
- foreach ($paths as $path) {
- $input = $prefix . $path;
- echo "basename for path $input is:\n";
- var_dump(basename($input));
- }
+ foreach ($paths as $path) {
+ $input = $prefix . $path;
+ echo "basename for path $input is:\n";
+ var_dump(basename($input));
+ }
}
echo "\ndone\n";
diff --git a/ext/standard/tests/file/basename_variation2-win32.phpt b/ext/standard/tests/file/basename_variation2-win32.phpt
index 43d6de5060..870fc617dd 100644
--- a/ext/standard/tests/file/basename_variation2-win32.phpt
+++ b/ext/standard/tests/file/basename_variation2-win32.phpt
@@ -11,8 +11,8 @@ if (substr(PHP_OS, 0, 3) != 'WIN') {
$paths = array (
- "foo",
- "foo/",
+ "foo",
+ "foo/",
"foo\\",
"foo.bar",
"foo.bar/",
@@ -26,8 +26,8 @@ $paths = array (
$suffixes = array (
- ".bar",
- ".b",
+ ".bar",
+ ".b",
".",
" ",
"foo",
@@ -39,10 +39,10 @@ $suffixes = array (
);
foreach ($paths as $path) {
- foreach ($suffixes as $suffix) {
- echo "basename for path $path, supplying suffix $suffix is:\n";
- var_dump(basename($path, $suffix));
- }
+ foreach ($suffixes as $suffix) {
+ echo "basename for path $path, supplying suffix $suffix is:\n";
+ var_dump(basename($path, $suffix));
+ }
}
echo "\ndone\n";
diff --git a/ext/standard/tests/file/basename_variation2.phpt b/ext/standard/tests/file/basename_variation2.phpt
index 195b98a6d3..a428d84e06 100644
--- a/ext/standard/tests/file/basename_variation2.phpt
+++ b/ext/standard/tests/file/basename_variation2.phpt
@@ -11,8 +11,8 @@ if (substr(PHP_OS, 0, 3) == 'WIN') {
$paths = array (
- "foo",
- "foo/",
+ "foo",
+ "foo/",
"foo\\",
"foo.bar",
"foo.bar/",
@@ -26,8 +26,8 @@ $paths = array (
$suffixes = array (
- ".bar",
- ".b",
+ ".bar",
+ ".b",
".",
" ",
"foo",
@@ -39,10 +39,10 @@ $suffixes = array (
);
foreach ($paths as $path) {
- foreach ($suffixes as $suffix) {
- echo "basename for path $path, supplying suffix $suffix is:\n";
- var_dump(basename($path, $suffix));
- }
+ foreach ($suffixes as $suffix) {
+ echo "basename for path $path, supplying suffix $suffix is:\n";
+ var_dump(basename($path, $suffix));
+ }
}
echo "\ndone\n";
diff --git a/ext/standard/tests/file/bug12556.phpt b/ext/standard/tests/file/bug12556.phpt
index 30299899a1..83b39ad782 100644
--- a/ext/standard/tests/file/bug12556.phpt
+++ b/ext/standard/tests/file/bug12556.phpt
@@ -4,8 +4,8 @@ Bug #12556 (fgetcsv() ignores lengths when quotes not closed)
<?php
$fp = fopen(__DIR__."/test.csv", "r");
while($line = fgetcsv($fp, 24)) {
- $line = str_replace("\x0d\x0a", "\x0a", $line);
- var_dump($line);
+ $line = str_replace("\x0d\x0a", "\x0a", $line);
+ var_dump($line);
}
fclose($fp);
?>
diff --git a/ext/standard/tests/file/bug22382.phpt b/ext/standard/tests/file/bug22382.phpt
index 7768a13b3e..c8dd01efd0 100644
--- a/ext/standard/tests/file/bug22382.phpt
+++ b/ext/standard/tests/file/bug22382.phpt
@@ -4,7 +4,7 @@ Bug #22382 (fgetcsv() does not handle escaped quotes correctly)
<?php
$fp = fopen(__DIR__."/test2.csv", "r");
while(($line = fgetcsv($fp, 1024))) {
- var_dump($line);
+ var_dump($line);
}
fclose($fp);
?>
diff --git a/ext/standard/tests/file/bug22414.phpt b/ext/standard/tests/file/bug22414.phpt
index c6e993ac9f..5507856815 100644
--- a/ext/standard/tests/file/bug22414.phpt
+++ b/ext/standard/tests/file/bug22414.phpt
@@ -5,33 +5,33 @@ output_handler=
--FILE--
<?php
- $php = getenv('TEST_PHP_EXECUTABLE');
- $tmpfile = tempnam(__DIR__, 'phpt');
- $args = ' -n ';
+ $php = getenv('TEST_PHP_EXECUTABLE');
+ $tmpfile = tempnam(__DIR__, 'phpt');
+ $args = ' -n ';
- /* Regular Data Test */
- passthru($php . $args . ' -r " echo \"HELLO\"; "');
+ /* Regular Data Test */
+ passthru($php . $args . ' -r " echo \"HELLO\"; "');
- echo "\n";
+ echo "\n";
- /* Binary Data Test */
+ /* Binary Data Test */
- if (substr(PHP_OS, 0, 3) != 'WIN') {
- $cmd = $php . $args . ' -r \"readfile(@getenv(\'\\\'\'TEST_PHP_EXECUTABLE\'\\\'\')); \"';
- $cmd = $php . $args . ' -r \' passthru("'.$cmd.'"); \' > '.$tmpfile ;
- } else {
- $cmd = $php . $args . ' -r \"readfile(@getenv(\\\\\\"TEST_PHP_EXECUTABLE\\\\\\")); \"';
- $cmd = $php . $args . ' -r " passthru(\''.$cmd.'\');" > '.$tmpfile ;
- }
- exec($cmd);
+ if (substr(PHP_OS, 0, 3) != 'WIN') {
+ $cmd = $php . $args . ' -r \"readfile(@getenv(\'\\\'\'TEST_PHP_EXECUTABLE\'\\\'\')); \"';
+ $cmd = $php . $args . ' -r \' passthru("'.$cmd.'"); \' > '.$tmpfile ;
+ } else {
+ $cmd = $php . $args . ' -r \"readfile(@getenv(\\\\\\"TEST_PHP_EXECUTABLE\\\\\\")); \"';
+ $cmd = $php . $args . ' -r " passthru(\''.$cmd.'\');" > '.$tmpfile ;
+ }
+ exec($cmd);
- if (md5_file($php) == md5_file($tmpfile)) {
- echo "Works\n";
- } else {
- echo "Does not work\n";
- }
+ if (md5_file($php) == md5_file($tmpfile)) {
+ echo "Works\n";
+ } else {
+ echo "Does not work\n";
+ }
- @unlink($tmpfile);
+ @unlink($tmpfile);
?>
--EXPECT--
HELLO
diff --git a/ext/standard/tests/file/bug24313.phpt b/ext/standard/tests/file/bug24313.phpt
index e5bceee856..0893889a02 100644
--- a/ext/standard/tests/file/bug24313.phpt
+++ b/ext/standard/tests/file/bug24313.phpt
@@ -10,7 +10,7 @@ if (substr(PHP_OS, 0, 3) == 'WIN') {
open_basedir=/dev
--FILE--
<?php
- var_dump(file_exists("/dev/bogus_file_no_such_thing"));
+ var_dump(file_exists("/dev/bogus_file_no_such_thing"));
?>
--EXPECT--
bool(false)
diff --git a/ext/standard/tests/file/bug24482.phpt b/ext/standard/tests/file/bug24482.phpt
index 9fe4d2d9ee..ba3dd73318 100644
--- a/ext/standard/tests/file/bug24482.phpt
+++ b/ext/standard/tests/file/bug24482.phpt
@@ -18,24 +18,24 @@ $globdirs = glob("*", GLOB_ONLYDIR);
$dirs = array();
$dh = opendir(".");
while (is_string($file = readdir($dh))) {
- if ($file[0] === ".") continue;
- if (!is_dir($file)) continue;
- $dirs[] = $file;
+ if ($file[0] === ".") continue;
+ if (!is_dir($file)) continue;
+ $dirs[] = $file;
}
closedir($dh);
if (count($dirs) != count($globdirs)) {
- echo "Directory count mismatch\n";
+ echo "Directory count mismatch\n";
- echo "glob found:\n";
- sort($globdirs);
- var_dump($globdirs);
+ echo "glob found:\n";
+ sort($globdirs);
+ var_dump($globdirs);
- echo "opendir/readdir/isdir found:\n";
- sort($dirs);
- var_dump($dirs);
+ echo "opendir/readdir/isdir found:\n";
+ sort($dirs);
+ var_dump($dirs);
} else {
- echo "OK\n";
+ echo "OK\n";
}
?>
--EXPECT--
diff --git a/ext/standard/tests/file/bug26615.phpt b/ext/standard/tests/file/bug26615.phpt
index 3689fdfe16..8a5df91ec1 100644
--- a/ext/standard/tests/file/bug26615.phpt
+++ b/ext/standard/tests/file/bug26615.phpt
@@ -7,9 +7,9 @@ variables_order=E
$out = array();
$status = -1;
if (substr(PHP_OS, 0, 3) != 'WIN') {
- exec($_ENV['TEST_PHP_EXECUTABLE'].' -n -r \'for($i=1;$i<=5000;$i++) print "$i\n";\' | tr \'\n\' \' \'', $out, $status);
+ exec($_ENV['TEST_PHP_EXECUTABLE'].' -n -r \'for($i=1;$i<=5000;$i++) print "$i\n";\' | tr \'\n\' \' \'', $out, $status);
} else {
- exec($_ENV['TEST_PHP_EXECUTABLE'].' -n -r "for($i=1;$i<=5000;$i++) echo $i,\' \';"', $out, $status);
+ exec($_ENV['TEST_PHP_EXECUTABLE'].' -n -r "for($i=1;$i<=5000;$i++) echo $i,\' \';"', $out, $status);
}
print_r($out);
?>
diff --git a/ext/standard/tests/file/bug26938.phpt b/ext/standard/tests/file/bug26938.phpt
index d1ad6b6526..13732c03f6 100644
--- a/ext/standard/tests/file/bug26938.phpt
+++ b/ext/standard/tests/file/bug26938.phpt
@@ -6,19 +6,19 @@ $out = array();
$status = -1;
$php = getenv('TEST_PHP_EXECUTABLE');
if (substr(PHP_OS, 0, 3) != 'WIN') {
- exec($php . ' -n -r \''
- . '$lengths = array(10,20000,10000,5,10000,3);'
- . 'foreach($lengths as $length) {'
- . ' for($i=0;$i<$length;$i++) print chr(65+$i % 27);'
- . ' print "\n";'
- . '}\'', $out, $status);
+ exec($php . ' -n -r \''
+ . '$lengths = array(10,20000,10000,5,10000,3);'
+ . 'foreach($lengths as $length) {'
+ . ' for($i=0;$i<$length;$i++) print chr(65+$i % 27);'
+ . ' print "\n";'
+ . '}\'', $out, $status);
} else {
- exec($php . ' -n -r "'
- . '$lengths = array(10,20000,10000,5,10000,3);'
- . 'foreach($lengths as $length) {'
- . ' for($i=0;$i<$length;$i++) print chr(65+$i % 27);'
- . ' print \\"\\n\\";'
- . '}"', $out, $status);
+ exec($php . ' -n -r "'
+ . '$lengths = array(10,20000,10000,5,10000,3);'
+ . 'foreach($lengths as $length) {'
+ . ' for($i=0;$i<$length;$i++) print chr(65+$i % 27);'
+ . ' print \\"\\n\\";'
+ . '}"', $out, $status);
}
for ($i=0;$i<6;$i++)
print "md5(line $i)= " . md5($out[$i]) . " (length " .
diff --git a/ext/standard/tests/file/bug27619.phpt b/ext/standard/tests/file/bug27619.phpt
index 095a18c199..6f377b52a9 100644
--- a/ext/standard/tests/file/bug27619.phpt
+++ b/ext/standard/tests/file/bug27619.phpt
@@ -2,17 +2,17 @@
Bug #27619 (filters not applied to pre-buffered data)
--FILE--
<?php
- $fp = tmpfile();
- fwrite($fp, "this is a lowercase string.\n");
- rewind($fp);
+ $fp = tmpfile();
+ fwrite($fp, "this is a lowercase string.\n");
+ rewind($fp);
- /* Echo out the first four bytes 'this' without applying filter
- Remainder will get sucked into the read buffer though. */
- echo fread($fp, 4);
+ /* Echo out the first four bytes 'this' without applying filter
+ Remainder will get sucked into the read buffer though. */
+ echo fread($fp, 4);
- stream_filter_append($fp, "string.toupper");
+ stream_filter_append($fp, "string.toupper");
- fpassthru($fp);
+ fpassthru($fp);
?>
--EXPECT--
this IS A LOWERCASE STRING.
diff --git a/ext/standard/tests/file/bug35740.phpt b/ext/standard/tests/file/bug35740.phpt
index 29e8d8ebf8..29ab0248d8 100644
--- a/ext/standard/tests/file/bug35740.phpt
+++ b/ext/standard/tests/file/bug35740.phpt
@@ -8,7 +8,7 @@ include (__DIR__);
echo "Done\n";
?>
--EXPECTF--
-Warning: include(%s): failed to open stream: %s in %s on line %d
+Warning: include(%s): Failed to open stream: %s in %s on line %d
Warning: include(): Failed opening '%s' for inclusion (include_path='%s') in %s on line %d
Done
diff --git a/ext/standard/tests/file/bug35781.phpt b/ext/standard/tests/file/bug35781.phpt
index 30b49beb78..c07900e9d7 100644
--- a/ext/standard/tests/file/bug35781.phpt
+++ b/ext/standard/tests/file/bug35781.phpt
@@ -19,7 +19,7 @@ var_dump(file_get_contents($filename));
echo "Done\n";
?>
--EXPECTF--
-Notice: fpassthru(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fpassthru(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
string(15) "Guvf vf n grfg
"
Done
diff --git a/ext/standard/tests/file/bug37158.phpt b/ext/standard/tests/file/bug37158.phpt
index 3200a62cf9..9afeaeeb8c 100644
--- a/ext/standard/tests/file/bug37158.phpt
+++ b/ext/standard/tests/file/bug37158.phpt
@@ -17,7 +17,7 @@ $file = __DIR__ . '/footest.txt';
$x = str_repeat(1, 8192);
$fp = fopen($file, 'w');
for ($i = 0; $i < 5; $i++) {
- fwrite($fp, $x);
+ fwrite($fp, $x);
}
fclose($fp);
diff --git a/ext/standard/tests/file/bug37864.phpt b/ext/standard/tests/file/bug37864.phpt
index f8743bd5ec..1da8f16183 100644
--- a/ext/standard/tests/file/bug37864.phpt
+++ b/ext/standard/tests/file/bug37864.phpt
@@ -2,10 +2,10 @@
Bug #37864 (file_get_contents() leaks on empty file)
--FILE--
<?php
- $tmpfname = tempnam(sys_get_temp_dir(), "emptyfile");
- var_dump(file_get_contents($tmpfname));
- echo "done.\n";
- unlink($tmpfname);
+ $tmpfname = tempnam(sys_get_temp_dir(), "emptyfile");
+ var_dump(file_get_contents($tmpfname));
+ echo "done.\n";
+ unlink($tmpfname);
?>
--EXPECT--
string(0) ""
diff --git a/ext/standard/tests/file/bug38450.phpt b/ext/standard/tests/file/bug38450.phpt
index eae86cf9a0..a82be7848a 100644
--- a/ext/standard/tests/file/bug38450.phpt
+++ b/ext/standard/tests/file/bug38450.phpt
@@ -4,85 +4,85 @@ Bug #38450 (constructor is not called for classes used in userspace stream wrapp
<?php
class VariableStream {
- var $position;
- var $varname;
-
- function __construct($var=null) {
- var_dump("constructor!");
- }
-
- function stream_open($path, $mode, $options, &$opened_path)
- {
- $url = parse_url($path);
- $this->varname = $url["host"];
- $this->position = 0;
-
- return true;
- }
-
- function stream_read($count)
- {
- $ret = substr($GLOBALS[$this->varname], $this->position, $count);
- $this->position += strlen($ret);
- return $ret;
- }
-
- function stream_write($data)
- {
- $left = substr($GLOBALS[$this->varname], 0, $this->position);
- $right = substr($GLOBALS[$this->varname], $this->position + strlen($data));
- $GLOBALS[$this->varname] = $left . $data . $right;
- $this->position += strlen($data);
- return strlen($data);
- }
-
- function stream_tell()
- {
- return $this->position;
- }
-
- function stream_eof()
- {
- return $this->position >= strlen($GLOBALS[$this->varname]);
- }
- function stream_seek($offset, $whence)
- {
- switch ($whence) {
- case SEEK_SET:
- if ($offset < strlen($GLOBALS[$this->varname]) && $offset >= 0) {
- $this->position = $offset;
- return true;
- } else {
- return false;
- }
- break;
-
- case SEEK_CUR:
- if ($offset >= 0) {
- $this->position += $offset;
- return true;
- } else {
- return false;
- }
- break;
-
- case SEEK_END:
- if (strlen($GLOBALS[$this->varname]) + $offset >= 0) {
- $this->position = strlen($GLOBALS[$this->varname]) + $offset;
- return true;
- } else {
- return false;
- }
- break;
-
- default:
- return false;
- }
- }
+ var $position;
+ var $varname;
+
+ function __construct($var=null) {
+ var_dump("constructor!");
+ }
+
+ function stream_open($path, $mode, $options, &$opened_path)
+ {
+ $url = parse_url($path);
+ $this->varname = $url["host"];
+ $this->position = 0;
+
+ return true;
+ }
+
+ function stream_read($count)
+ {
+ $ret = substr($GLOBALS[$this->varname], $this->position, $count);
+ $this->position += strlen($ret);
+ return $ret;
+ }
+
+ function stream_write($data)
+ {
+ $left = substr($GLOBALS[$this->varname], 0, $this->position);
+ $right = substr($GLOBALS[$this->varname], $this->position + strlen($data));
+ $GLOBALS[$this->varname] = $left . $data . $right;
+ $this->position += strlen($data);
+ return strlen($data);
+ }
+
+ function stream_tell()
+ {
+ return $this->position;
+ }
+
+ function stream_eof()
+ {
+ return $this->position >= strlen($GLOBALS[$this->varname]);
+ }
+ function stream_seek($offset, $whence)
+ {
+ switch ($whence) {
+ case SEEK_SET:
+ if ($offset < strlen($GLOBALS[$this->varname]) && $offset >= 0) {
+ $this->position = $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+
+ case SEEK_CUR:
+ if ($offset >= 0) {
+ $this->position += $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+
+ case SEEK_END:
+ if (strlen($GLOBALS[$this->varname]) + $offset >= 0) {
+ $this->position = strlen($GLOBALS[$this->varname]) + $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+
+ default:
+ return false;
+ }
+ }
}
stream_wrapper_register("var", "VariableStream")
- or die("Failed to register protocol");
+ or die("Failed to register protocol");
$myvar = "";
@@ -94,7 +94,7 @@ fwrite($fp, "line3\n");
rewind($fp);
while (!feof($fp)) {
- echo fgets($fp);
+ echo fgets($fp);
}
fclose($fp);
var_dump($myvar);
diff --git a/ext/standard/tests/file/bug38450_1.phpt b/ext/standard/tests/file/bug38450_1.phpt
index 9cc383171b..6eea9e2000 100644
--- a/ext/standard/tests/file/bug38450_1.phpt
+++ b/ext/standard/tests/file/bug38450_1.phpt
@@ -4,85 +4,85 @@ Bug #38450 (constructor is not called for classes used in userspace stream wrapp
<?php
class VariableStream {
- var $position;
- var $varname;
-
- function __construct($var = null) {
- var_dump("constructor!");
- }
-
- function stream_open($path, $mode, $options, &$opened_path)
- {
- $url = parse_url($path);
- $this->varname = $url["host"];
- $this->position = 0;
-
- return true;
- }
-
- function stream_read($count)
- {
- $ret = substr($GLOBALS[$this->varname], $this->position, $count);
- $this->position += strlen($ret);
- return $ret;
- }
-
- function stream_write($data)
- {
- $left = substr($GLOBALS[$this->varname], 0, $this->position);
- $right = substr($GLOBALS[$this->varname], $this->position + strlen($data));
- $GLOBALS[$this->varname] = $left . $data . $right;
- $this->position += strlen($data);
- return strlen($data);
- }
-
- function stream_tell()
- {
- return $this->position;
- }
-
- function stream_eof()
- {
- return $this->position >= strlen($GLOBALS[$this->varname]);
- }
- function stream_seek($offset, $whence)
- {
- switch ($whence) {
- case SEEK_SET:
- if ($offset < strlen($GLOBALS[$this->varname]) && $offset >= 0) {
- $this->position = $offset;
- return true;
- } else {
- return false;
- }
- break;
-
- case SEEK_CUR:
- if ($offset >= 0) {
- $this->position += $offset;
- return true;
- } else {
- return false;
- }
- break;
-
- case SEEK_END:
- if (strlen($GLOBALS[$this->varname]) + $offset >= 0) {
- $this->position = strlen($GLOBALS[$this->varname]) + $offset;
- return true;
- } else {
- return false;
- }
- break;
-
- default:
- return false;
- }
- }
+ var $position;
+ var $varname;
+
+ function __construct($var = null) {
+ var_dump("constructor!");
+ }
+
+ function stream_open($path, $mode, $options, &$opened_path)
+ {
+ $url = parse_url($path);
+ $this->varname = $url["host"];
+ $this->position = 0;
+
+ return true;
+ }
+
+ function stream_read($count)
+ {
+ $ret = substr($GLOBALS[$this->varname], $this->position, $count);
+ $this->position += strlen($ret);
+ return $ret;
+ }
+
+ function stream_write($data)
+ {
+ $left = substr($GLOBALS[$this->varname], 0, $this->position);
+ $right = substr($GLOBALS[$this->varname], $this->position + strlen($data));
+ $GLOBALS[$this->varname] = $left . $data . $right;
+ $this->position += strlen($data);
+ return strlen($data);
+ }
+
+ function stream_tell()
+ {
+ return $this->position;
+ }
+
+ function stream_eof()
+ {
+ return $this->position >= strlen($GLOBALS[$this->varname]);
+ }
+ function stream_seek($offset, $whence)
+ {
+ switch ($whence) {
+ case SEEK_SET:
+ if ($offset < strlen($GLOBALS[$this->varname]) && $offset >= 0) {
+ $this->position = $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+
+ case SEEK_CUR:
+ if ($offset >= 0) {
+ $this->position += $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+
+ case SEEK_END:
+ if (strlen($GLOBALS[$this->varname]) + $offset >= 0) {
+ $this->position = strlen($GLOBALS[$this->varname]) + $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+
+ default:
+ return false;
+ }
+ }
}
stream_wrapper_register("var", "VariableStream")
- or die("Failed to register protocol");
+ or die("Failed to register protocol");
$myvar = "";
@@ -94,7 +94,7 @@ fwrite($fp, "line3\n");
rewind($fp);
while (!feof($fp)) {
- echo fgets($fp);
+ echo fgets($fp);
}
fclose($fp);
var_dump($myvar);
diff --git a/ext/standard/tests/file/bug38450_2.phpt b/ext/standard/tests/file/bug38450_2.phpt
index 33a13da0db..cf4cb91928 100644
--- a/ext/standard/tests/file/bug38450_2.phpt
+++ b/ext/standard/tests/file/bug38450_2.phpt
@@ -4,85 +4,85 @@ Bug #38450 (constructor is not called for classes used in userspace stream wrapp
<?php
class VariableStream {
- var $position;
- var $varname;
-
- function __construct($var = null) {
- throw new Exception("constructor");
- }
-
- function stream_open($path, $mode, $options, &$opened_path)
- {
- $url = parse_url($path);
- $this->varname = $url["host"];
- $this->position = 0;
-
- return true;
- }
-
- function stream_read($count)
- {
- $ret = substr($GLOBALS[$this->varname], $this->position, $count);
- $this->position += strlen($ret);
- return $ret;
- }
-
- function stream_write($data)
- {
- $left = substr($GLOBALS[$this->varname], 0, $this->position);
- $right = substr($GLOBALS[$this->varname], $this->position + strlen($data));
- $GLOBALS[$this->varname] = $left . $data . $right;
- $this->position += strlen($data);
- return strlen($data);
- }
-
- function stream_tell()
- {
- return $this->position;
- }
-
- function stream_eof()
- {
- return $this->position >= strlen($GLOBALS[$this->varname]);
- }
- function stream_seek($offset, $whence)
- {
- switch ($whence) {
- case SEEK_SET:
- if ($offset < strlen($GLOBALS[$this->varname]) && $offset >= 0) {
- $this->position = $offset;
- return true;
- } else {
- return false;
- }
- break;
-
- case SEEK_CUR:
- if ($offset >= 0) {
- $this->position += $offset;
- return true;
- } else {
- return false;
- }
- break;
-
- case SEEK_END:
- if (strlen($GLOBALS[$this->varname]) + $offset >= 0) {
- $this->position = strlen($GLOBALS[$this->varname]) + $offset;
- return true;
- } else {
- return false;
- }
- break;
-
- default:
- return false;
- }
- }
+ var $position;
+ var $varname;
+
+ function __construct($var = null) {
+ throw new Exception("constructor");
+ }
+
+ function stream_open($path, $mode, $options, &$opened_path)
+ {
+ $url = parse_url($path);
+ $this->varname = $url["host"];
+ $this->position = 0;
+
+ return true;
+ }
+
+ function stream_read($count)
+ {
+ $ret = substr($GLOBALS[$this->varname], $this->position, $count);
+ $this->position += strlen($ret);
+ return $ret;
+ }
+
+ function stream_write($data)
+ {
+ $left = substr($GLOBALS[$this->varname], 0, $this->position);
+ $right = substr($GLOBALS[$this->varname], $this->position + strlen($data));
+ $GLOBALS[$this->varname] = $left . $data . $right;
+ $this->position += strlen($data);
+ return strlen($data);
+ }
+
+ function stream_tell()
+ {
+ return $this->position;
+ }
+
+ function stream_eof()
+ {
+ return $this->position >= strlen($GLOBALS[$this->varname]);
+ }
+ function stream_seek($offset, $whence)
+ {
+ switch ($whence) {
+ case SEEK_SET:
+ if ($offset < strlen($GLOBALS[$this->varname]) && $offset >= 0) {
+ $this->position = $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+
+ case SEEK_CUR:
+ if ($offset >= 0) {
+ $this->position += $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+
+ case SEEK_END:
+ if (strlen($GLOBALS[$this->varname]) + $offset >= 0) {
+ $this->position = strlen($GLOBALS[$this->varname]) + $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+
+ default:
+ return false;
+ }
+ }
}
stream_wrapper_register("var", "VariableStream")
- or die("Failed to register protocol");
+ or die("Failed to register protocol");
$myvar = "";
@@ -94,7 +94,7 @@ fwrite($fp, "line3\n");
rewind($fp);
while (!feof($fp)) {
- echo fgets($fp);
+ echo fgets($fp);
}
fclose($fp);
var_dump($myvar);
diff --git a/ext/standard/tests/file/bug38450_3.phpt b/ext/standard/tests/file/bug38450_3.phpt
index 8a5c696587..cbd03e908e 100644
--- a/ext/standard/tests/file/bug38450_3.phpt
+++ b/ext/standard/tests/file/bug38450_3.phpt
@@ -4,85 +4,85 @@ Bug #38450 (constructor is not called for classes used in userspace stream wrapp
<?php
class VariableStream {
- var $position;
- var $varname;
-
- function __construct(array $var) {
- var_dump("constructor!");
- }
-
- function stream_open($path, $mode, $options, &$opened_path)
- {
- $url = parse_url($path);
- $this->varname = $url["host"];
- $this->position = 0;
-
- return true;
- }
-
- function stream_read($count)
- {
- $ret = substr($GLOBALS[$this->varname], $this->position, $count);
- $this->position += strlen($ret);
- return $ret;
- }
-
- function stream_write($data)
- {
- $left = substr($GLOBALS[$this->varname], 0, $this->position);
- $right = substr($GLOBALS[$this->varname], $this->position + strlen($data));
- $GLOBALS[$this->varname] = $left . $data . $right;
- $this->position += strlen($data);
- return strlen($data);
- }
-
- function stream_tell()
- {
- return $this->position;
- }
-
- function stream_eof()
- {
- return $this->position >= strlen($GLOBALS[$this->varname]);
- }
- function stream_seek($offset, $whence)
- {
- switch ($whence) {
- case SEEK_SET:
- if ($offset < strlen($GLOBALS[$this->varname]) && $offset >= 0) {
- $this->position = $offset;
- return true;
- } else {
- return false;
- }
- break;
-
- case SEEK_CUR:
- if ($offset >= 0) {
- $this->position += $offset;
- return true;
- } else {
- return false;
- }
- break;
-
- case SEEK_END:
- if (strlen($GLOBALS[$this->varname]) + $offset >= 0) {
- $this->position = strlen($GLOBALS[$this->varname]) + $offset;
- return true;
- } else {
- return false;
- }
- break;
-
- default:
- return false;
- }
- }
+ var $position;
+ var $varname;
+
+ function __construct(array $var) {
+ var_dump("constructor!");
+ }
+
+ function stream_open($path, $mode, $options, &$opened_path)
+ {
+ $url = parse_url($path);
+ $this->varname = $url["host"];
+ $this->position = 0;
+
+ return true;
+ }
+
+ function stream_read($count)
+ {
+ $ret = substr($GLOBALS[$this->varname], $this->position, $count);
+ $this->position += strlen($ret);
+ return $ret;
+ }
+
+ function stream_write($data)
+ {
+ $left = substr($GLOBALS[$this->varname], 0, $this->position);
+ $right = substr($GLOBALS[$this->varname], $this->position + strlen($data));
+ $GLOBALS[$this->varname] = $left . $data . $right;
+ $this->position += strlen($data);
+ return strlen($data);
+ }
+
+ function stream_tell()
+ {
+ return $this->position;
+ }
+
+ function stream_eof()
+ {
+ return $this->position >= strlen($GLOBALS[$this->varname]);
+ }
+ function stream_seek($offset, $whence)
+ {
+ switch ($whence) {
+ case SEEK_SET:
+ if ($offset < strlen($GLOBALS[$this->varname]) && $offset >= 0) {
+ $this->position = $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+
+ case SEEK_CUR:
+ if ($offset >= 0) {
+ $this->position += $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+
+ case SEEK_END:
+ if (strlen($GLOBALS[$this->varname]) + $offset >= 0) {
+ $this->position = strlen($GLOBALS[$this->varname]) + $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+
+ default:
+ return false;
+ }
+ }
}
stream_wrapper_register("var", "VariableStream")
- or die("Failed to register protocol");
+ or die("Failed to register protocol");
$myvar = "";
@@ -94,7 +94,7 @@ fwrite($fp, "line3\n");
rewind($fp);
while (!feof($fp)) {
- echo fgets($fp);
+ echo fgets($fp);
}
fclose($fp);
var_dump($myvar);
diff --git a/ext/standard/tests/file/bug39538.phpt b/ext/standard/tests/file/bug39538.phpt
index cdff507b48..5f40192ec9 100644
--- a/ext/standard/tests/file/bug39538.phpt
+++ b/ext/standard/tests/file/bug39538.phpt
@@ -7,8 +7,8 @@ $content = array("\"\nthis is an test\", \"next data\", \"p\narsed\"","\"\r\nthi
$file = __DIR__ . "/bug39538.csv";
@unlink($file);
foreach ($content as $v) {
- file_put_contents($file, $v);
- print_r (fgetcsv(fopen($file, "r"), filesize($file)));
+ file_put_contents($file, $v);
+ print_r (fgetcsv(fopen($file, "r"), filesize($file)));
}
@unlink($file);
?>
diff --git a/ext/standard/tests/file/bug39551.phpt b/ext/standard/tests/file/bug39551.phpt
index 2877c4951f..c3d011351e 100644
--- a/ext/standard/tests/file/bug39551.phpt
+++ b/ext/standard/tests/file/bug39551.phpt
@@ -6,12 +6,12 @@ Bug #39551 (Segfault with stream_bucket_new in user filter)
$bucket = stream_bucket_new(fopen('php://temp', 'w+'), '');
class bucketFilter {
- public function filter($in, $out, &$consumed, $closing ){
+ public function filter($in, $out, &$consumed, $closing ){
- $bucket = stream_bucket_new(fopen('php://temp', 'w+'), '');
- stream_bucket_append($out, $bucket);
- return PSFS_PASS_ON;
- }
+ $bucket = stream_bucket_new(fopen('php://temp', 'w+'), '');
+ stream_bucket_append($out, $bucket);
+ return PSFS_PASS_ON;
+ }
}
stream_filter_register('bucketfault', 'bucketFilter');
diff --git a/ext/standard/tests/file/bug39673.phpt b/ext/standard/tests/file/bug39673.phpt
index 70a47e3fc1..64c66cc141 100644
--- a/ext/standard/tests/file/bug39673.phpt
+++ b/ext/standard/tests/file/bug39673.phpt
@@ -9,20 +9,20 @@ $filename = __DIR__.'/bug39673.txt';
file_put_contents($filename, $str);
$offsets = array(
- -1,
- 0,
- 3456*4,
- 3456*4 - 1,
- 3456*4 + 1,
- 2000,
- 5000,
- 100000,
+ -1,
+ 0,
+ 3456*4,
+ 3456*4 - 1,
+ 3456*4 + 1,
+ 2000,
+ 5000,
+ 100000,
);
foreach ($offsets as $offset) {
- $r = file_get_contents($filename, false, null, $offset);
- if ($r !== false) var_dump(strlen($r));
+ $r = file_get_contents($filename, false, null, $offset);
+ if ($r !== false) var_dump(strlen($r));
}
@unlink($filename);
diff --git a/ext/standard/tests/file/bug39863.phpt b/ext/standard/tests/file/bug39863.phpt
index 5460203e05..174e349b15 100644
--- a/ext/standard/tests/file/bug39863.phpt
+++ b/ext/standard/tests/file/bug39863.phpt
@@ -7,16 +7,11 @@ Andrew van der Stock, vanderaj @ owasp.org
$filename = __FILE__ . chr(0). ".ridiculous";
-if (file_exists($filename)) {
- echo "FAIL\n";
-}
-else {
- echo "PASS\n";
+try {
+ var_dump(file_exists($filename));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
}
?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-Warning: file_exists() expects parameter 1 to be a valid path, string given in %s on line %d
-PASS
-===DONE===
+--EXPECT--
+file_exists() expects parameter 1 to be a valid path, string given
diff --git a/ext/standard/tests/file/bug41655_2.phpt b/ext/standard/tests/file/bug41655_2.phpt
index 20c29844c1..61fdec1054 100644
--- a/ext/standard/tests/file/bug41655_2.phpt
+++ b/ext/standard/tests/file/bug41655_2.phpt
@@ -4,9 +4,9 @@ Bug #41655 (open_basedir bypass via glob()) 2/2
open_basedir=/
--FILE--
<?php
- $dir = __DIR__;
- $a=glob($dir . "/test*csv");
- print_r($a);
+ $dir = __DIR__;
+ $a=glob($dir . "/test*csv");
+ print_r($a);
?>
--EXPECTF--
Array
diff --git a/ext/standard/tests/file/bug41693.phpt b/ext/standard/tests/file/bug41693.phpt
deleted file mode 100644
index ea074fa4fd..0000000000
--- a/ext/standard/tests/file/bug41693.phpt
+++ /dev/null
@@ -1,13 +0,0 @@
---TEST--
-Bug #41693 (scandir() allows empty directory names)
---FILE--
-<?php
-
-var_dump(scandir(''));
-
-echo "Done\n";
-?>
---EXPECTF--
-Warning: scandir(): Directory name cannot be empty in %s on line %d
-bool(false)
-Done
diff --git a/ext/standard/tests/file/bug41815.phpt b/ext/standard/tests/file/bug41815.phpt
index 58f287cedf..d77d73055b 100644
--- a/ext/standard/tests/file/bug41815.phpt
+++ b/ext/standard/tests/file/bug41815.phpt
@@ -12,7 +12,7 @@ fread($reader, 1);
fwrite($writer, "foo");
if (strlen(fread($reader, 10)) > 0) {
- echo "OK\n";
+ echo "OK\n";
}
fclose($writer);
diff --git a/ext/standard/tests/file/bug43008.phpt b/ext/standard/tests/file/bug43008.phpt
index 0d9d6ed986..60bea35429 100644
--- a/ext/standard/tests/file/bug43008.phpt
+++ b/ext/standard/tests/file/bug43008.phpt
@@ -9,12 +9,12 @@ allow_url_fopen=1
--FILE--
<?php
$url = ""
- . "php://filter/read="
- . urlencode("convert.iconv.ISO-8859-15/UTF-8")
- . '|' . urlencode("string.rot13")
- . '|' . urlencode("string.rot13")
- . '|' . urlencode("convert.iconv.UTF-8/ISO-8859-15")
- . "/resource=data://text/plain,foob%E2r";
+ . "php://filter/read="
+ . urlencode("convert.iconv.ISO-8859-15/UTF-8")
+ . '|' . urlencode("string.rot13")
+ . '|' . urlencode("string.rot13")
+ . '|' . urlencode("convert.iconv.UTF-8/ISO-8859-15")
+ . "/resource=data://text/plain,foob%E2r";
var_dump(urlencode(file_get_contents($url)));
?>
--EXPECTF--
diff --git a/ext/standard/tests/file/bug43137.phpt b/ext/standard/tests/file/bug43137.phpt
index 8125445bb0..f0f17895b7 100644
--- a/ext/standard/tests/file/bug43137.phpt
+++ b/ext/standard/tests/file/bug43137.phpt
@@ -2,16 +2,16 @@
Bug #43137 (rmdir() and rename() do not clear statcache)
--FILE--
<?php
- $toname = "TO_" . md5(microtime());
- $dirname = "FROM_" . md5(microtime());
+ $toname = "TO_" . md5(microtime());
+ $dirname = "FROM_" . md5(microtime());
- mkdir($dirname);
- var_dump(is_dir($dirname)); // Expected: true
- rename($dirname, $toname);
- var_dump(is_dir($dirname)); // Expected: false
- var_dump(is_dir($toname)); // Expected: true
- rmdir($toname);
- var_dump(is_dir($toname)); // Expected: false
+ mkdir($dirname);
+ var_dump(is_dir($dirname)); // Expected: true
+ rename($dirname, $toname);
+ var_dump(is_dir($dirname)); // Expected: false
+ var_dump(is_dir($toname)); // Expected: true
+ rmdir($toname);
+ var_dump(is_dir($toname)); // Expected: false
?>
--EXPECT--
bool(true)
diff --git a/ext/standard/tests/file/bug43353.phpt b/ext/standard/tests/file/bug43353.phpt
index d9576f24e2..6089fabadd 100644
--- a/ext/standard/tests/file/bug43353.phpt
+++ b/ext/standard/tests/file/bug43353.phpt
@@ -16,5 +16,5 @@ bool(false)
bool(false)
string(3) "foo"
-Warning: file_get_contents(datafoo:text/plain,foo): failed to open stream: No such file or directory in %s
+Warning: file_get_contents(datafoo:text/plain,foo): Failed to open stream: No such file or directory in %s
bool(false)
diff --git a/ext/standard/tests/file/bug43522.phpt b/ext/standard/tests/file/bug43522.phpt
index 10e44fc352..185f2c3697 100644
--- a/ext/standard/tests/file/bug43522.phpt
+++ b/ext/standard/tests/file/bug43522.phpt
@@ -9,10 +9,10 @@ DoTest($fp, 'ZZZ'); // test multi-char delimiter
DoTest($fp, "Z"); // test single-char delimiter
function DoTest($fp, $delim) {
- echo "Delimiter: " . $delim . "\n";
- rewind($fp);
- echo "\t" . stream_get_line($fp, 10, $delim) . "\n";
- echo "\t" . stream_get_line($fp, 10, $delim) . "\n";
+ echo "Delimiter: " . $delim . "\n";
+ rewind($fp);
+ echo "\t" . stream_get_line($fp, 10, $delim) . "\n";
+ echo "\t" . stream_get_line($fp, 10, $delim) . "\n";
}
?>
diff --git a/ext/standard/tests/file/bug44034.phpt b/ext/standard/tests/file/bug44034.phpt
index 887b9eb08e..2b7e1168c8 100644
--- a/ext/standard/tests/file/bug44034.phpt
+++ b/ext/standard/tests/file/bug44034.phpt
@@ -11,8 +11,8 @@ $urls[] = "data://text/plain,\r\nfoo\r\nbar\r\n";
$urls[] = "data://text/plain,foo\r\nbar";
foreach($urls as $url) {
- echo strtr($url, array("\r" => "\\r", "\n" => "\\n")) . "\n";
- var_dump(file($url, FILE_IGNORE_NEW_LINES));
+ echo strtr($url, array("\r" => "\\r", "\n" => "\\n")) . "\n";
+ var_dump(file($url, FILE_IGNORE_NEW_LINES));
}
?>
--EXPECT--
diff --git a/ext/standard/tests/file/bug44805.phpt b/ext/standard/tests/file/bug44805.phpt
index ac4e334f53..0b81be6a06 100644
--- a/ext/standard/tests/file/bug44805.phpt
+++ b/ext/standard/tests/file/bug44805.phpt
@@ -14,10 +14,10 @@ rename($file1, $file2);
echo "reading file 2: ";
readfile($file2);
if (file_exists($file1)) {
- unlink($file1);
+ unlink($file1);
}
if (file_exists($file2)) {
- unlink($file2);
+ unlink($file2);
}
?>
--EXPECT--
diff --git a/ext/standard/tests/file/bug45303.phpt b/ext/standard/tests/file/bug45303.phpt
index 0a4b33bcff..927c459fb5 100644
--- a/ext/standard/tests/file/bug45303.phpt
+++ b/ext/standard/tests/file/bug45303.phpt
@@ -9,5 +9,5 @@ var_dump(fseek($fd, 1024*1024, SEEK_SET));
--EXPECTF--
resource(%d) of type (stream)
-Warning: fseek(): stream does not support seeking in %s
+Warning: fseek(): Stream does not support seeking in %s
int(-1)
diff --git a/ext/standard/tests/file/bug47517.phpt b/ext/standard/tests/file/bug47517.phpt
index f8c9e41446..4eaf9a132c 100644
--- a/ext/standard/tests/file/bug47517.phpt
+++ b/ext/standard/tests/file/bug47517.phpt
@@ -15,7 +15,5 @@ if (!$status) {
/* This has to behave same way on both 64- and 32-bits. */
file_put_contents('C:\Program Files\myfile.txt', 'hello');
?>
-==DONE==
--EXPECTF--
-Warning: file_put_contents(C:\Program Files\myfile.txt): failed to open stream: Permission denied in %sbug47517.php on line %d
-==DONE==
+Warning: file_put_contents(C:\Program Files\myfile.txt): Failed to open stream: Permission denied in %sbug47517.php on line %d
diff --git a/ext/standard/tests/file/bug52820.phpt b/ext/standard/tests/file/bug52820.phpt
index e51c27e457..b5690484a2 100644
--- a/ext/standard/tests/file/bug52820.phpt
+++ b/ext/standard/tests/file/bug52820.phpt
@@ -10,7 +10,7 @@ if (!extension_loaded("curl")) exit("skip curl extension not loaded");
$handle=curl_init('http://127.0.0.1:37349/');
curl_setopt($handle, CURLOPT_VERBOSE, true);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
-if (!curl_setopt($handle, CURLOPT_STDERR, fopen("php://memory", "w+")))
+if (!@curl_setopt($handle, CURLOPT_STDERR, fopen("php://memory", "w+")))
die("skip fopencookie not supported on this platform");
--FILE--
<?php
diff --git a/ext/standard/tests/file/bug55124.phpt b/ext/standard/tests/file/bug55124.phpt
index 7938196dbc..a894ff32e0 100644
--- a/ext/standard/tests/file/bug55124.phpt
+++ b/ext/standard/tests/file/bug55124.phpt
@@ -6,10 +6,10 @@ $old_dir_path = getcwd();
chdir(__DIR__);
mkdir('a/./b', 0755, true);
if (is_dir('a/b')) {
- rmdir('a/b');
+ rmdir('a/b');
}
if (is_dir('./a')) {
- rmdir('a');
+ rmdir('a');
}
chdir($old_dir_path);
echo "OK";
diff --git a/ext/standard/tests/file/bug60120.phpt b/ext/standard/tests/file/bug60120.phpt
index 77ebf086bd..9d964e34cb 100644
--- a/ext/standard/tests/file/bug60120.phpt
+++ b/ext/standard/tests/file/bug60120.phpt
@@ -14,7 +14,7 @@ error_reporting(E_ALL);
$php = getenv('TEST_PHP_EXECUTABLE');
if (!$php) {
- die("No php executable defined\n");
+ die("No php executable defined\n");
}
$cmd = 'php -r "fwrite(STDOUT, $in = file_get_contents(\'php://stdin\')); fwrite(STDERR, $in);"';
$descriptors = array(array('pipe', 'r'), array('pipe', 'w'), array('pipe', 'w'));
diff --git a/ext/standard/tests/file/bug61961.phpt b/ext/standard/tests/file/bug61961.phpt
index a2d83fe77e..c9ae4c8880 100644
--- a/ext/standard/tests/file/bug61961.phpt
+++ b/ext/standard/tests/file/bug61961.phpt
@@ -8,7 +8,5 @@ file_put_contents($tmp_empty_file, "");
var_dump(file_get_contents($tmp_empty_file, NULL, NULL, NULL, 10));
unlink($tmp_empty_file);
?>
-==DONE==
--EXPECT--
string(0) ""
-==DONE==
diff --git a/ext/standard/tests/file/bug63512.phpt b/ext/standard/tests/file/bug63512.phpt
index 9277359256..a22ba9f0cf 100644
--- a/ext/standard/tests/file/bug63512.phpt
+++ b/ext/standard/tests/file/bug63512.phpt
@@ -4,13 +4,13 @@ Fixed bug #63512 (parse_ini_file() with INI_SCANNER_RAW removes quotes from valu
<?php
$array = parse_ini_string('
- int = 123
- constant = INSTALL_ROOT
- quotedString = "string"
- a = INSTALL_ROOT "waa"
- b = "INSTALL_ROOT"
- c = "waa" INSTALL_ROOT
- d = INSTALL_ROOT "INSTALL_ROOT"', false, INI_SCANNER_RAW);
+ int = 123
+ constant = INSTALL_ROOT
+ quotedString = "string"
+ a = INSTALL_ROOT "waa"
+ b = "INSTALL_ROOT"
+ c = "waa" INSTALL_ROOT
+ d = INSTALL_ROOT "INSTALL_ROOT"', false, INI_SCANNER_RAW);
var_dump($array);
--EXPECT--
diff --git a/ext/standard/tests/file/bug65701.phpt b/ext/standard/tests/file/bug65701.phpt
index c4a356b41b..f70446a17e 100644
--- a/ext/standard/tests/file/bug65701.phpt
+++ b/ext/standard/tests/file/bug65701.phpt
@@ -7,7 +7,7 @@ Boro Sitnikovski <buritomath@yahoo.com>
$file_path = __DIR__ . "/bug65701/";
if (!is_dir($file_path)) {
- mkdir($file_path);
+ mkdir($file_path);
}
$src = $file_path . '/srcbug65701_file.txt';
diff --git a/ext/standard/tests/file/bug68335.phpt b/ext/standard/tests/file/bug68335.phpt
index b3a8165e5b..bb5f597fca 100644
--- a/ext/standard/tests/file/bug68335.phpt
+++ b/ext/standard/tests/file/bug68335.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #68335: rmdir doesnt work with file:// stream wrapper
+Bug #68335: rmdir doesn't work with file:// stream wrapper
--FILE--
<?php
$dir = 'file://' . __DIR__ . '/testDir';
diff --git a/ext/standard/tests/file/bug69442.phpt b/ext/standard/tests/file/bug69442.phpt
index d7063f429d..60192d3c9b 100644
--- a/ext/standard/tests/file/bug69442.phpt
+++ b/ext/standard/tests/file/bug69442.phpt
@@ -17,7 +17,7 @@ EOC;
$output = join("\n", $output);
unlink($tmpFile);
- if (strstr($output, "pty pseudo terminal not supported on this system") !== false) {
+ if (strstr($output, "PTY pseudo terminal not supported on this system") !== false) {
die("skip PTY pseudo terminals are not supported");
}
--FILE--
diff --git a/ext/standard/tests/file/bug71287.phpt b/ext/standard/tests/file/bug71287.phpt
index b7987829b0..f88414f2c2 100644
--- a/ext/standard/tests/file/bug71287.phpt
+++ b/ext/standard/tests/file/bug71287.phpt
@@ -3,13 +3,13 @@ Bug #71287 (Error message contains hexadecimal instead of decimal number)
--FILE--
<?php
class Stream {
- public function stream_open($path, $mode, $options, $opened_path) {
- return true;
- }
+ public function stream_open($path, $mode, $options, $opened_path) {
+ return true;
+ }
- public function stream_write($data) {
- return strlen($data) - 2;
- }
+ public function stream_write($data) {
+ return strlen($data) - 2;
+ }
}
stream_wrapper_register('test', Stream::class);
diff --git a/ext/standard/tests/file/bug71882.phpt b/ext/standard/tests/file/bug71882.phpt
index c132aa95c7..7d3b911109 100644
--- a/ext/standard/tests/file/bug71882.phpt
+++ b/ext/standard/tests/file/bug71882.phpt
@@ -3,10 +3,11 @@ Bug #71882 (Negative ftruncate() on php://memory exhausts memory)
--FILE--
<?php
$fd = fopen("php://memory", "w+");
-var_dump(ftruncate($fd, -1));
+try {
+ var_dump(ftruncate($fd, -1));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
?>
-==DONE==
---EXPECTF--
-Warning: ftruncate(): Negative size is not supported in %s%ebug71882.php on line %d
-bool(false)
-==DONE==
+--EXPECT--
+Negative size is not supported
diff --git a/ext/standard/tests/file/bug72035.phpt b/ext/standard/tests/file/bug72035.phpt
index 704d746efc..6ed7fe470f 100644
--- a/ext/standard/tests/file/bug72035.phpt
+++ b/ext/standard/tests/file/bug72035.phpt
@@ -3,7 +3,6 @@ Bug #72035 php-cgi.exe fails to run scripts relative to drive root
--SKIPIF--
<?php
if(substr(PHP_OS, 0, 3) != 'WIN' ) die('skip windows only test');
-if(php_sapi_name() != "cli") die('skip CLI only test');
$cgi = realpath(dirname(PHP_BINARY)) . DIRECTORY_SEPARATOR . "php-cgi.exe";
if (!file_exists($cgi)) die('skip CGI binary not found');
@@ -24,17 +23,15 @@ $cmd = "$cgi -n -C $fl";
$desc = array(0 => array("pipe", "r"));
$proc = proc_open($cmd, $desc, $pipes, getcwd(), array());
if (is_resource($proc)) {
- echo stream_get_contents($pipes[0]);
+ echo stream_get_contents($pipes[0]);
- proc_close($proc);
+ proc_close($proc);
}
unlink($fl);
?>
-==DONE==
--EXPECTF--
X-Powered-By: PHP/%s
Content-type: text/html; charset=UTF-8
hello
-==DONE==
diff --git a/ext/standard/tests/file/bug74719.phpt b/ext/standard/tests/file/bug74719.phpt
index 57309bcf06..ab888d682f 100644
--- a/ext/standard/tests/file/bug74719.phpt
+++ b/ext/standard/tests/file/bug74719.phpt
@@ -33,11 +33,9 @@ if (rmdir($tmpDir, NULL)) {
}
?>
-===DONE===
--EXPECT--
ok
ok
ok
ok
ok
-===DONE===
diff --git a/ext/standard/tests/file/bug75679.phpt b/ext/standard/tests/file/bug75679.phpt
index 1441447853..df8b994781 100644
--- a/ext/standard/tests/file/bug75679.phpt
+++ b/ext/standard/tests/file/bug75679.phpt
@@ -24,7 +24,6 @@ foreach ($Files2Report as $file => &$Report)
?>
-==DONE==
--CLEAN--
<?php
$d = __DIR__;
@@ -63,4 +62,3 @@ Array
[strlen] => 261
[result] => ok
)
-==DONE==
diff --git a/ext/standard/tests/file/bug77552.phpt b/ext/standard/tests/file/bug77552.phpt
index 9404b8e09f..8e3a835537 100644
--- a/ext/standard/tests/file/bug77552.phpt
+++ b/ext/standard/tests/file/bug77552.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #77552 Unintialized php_stream_statbuf in stat functions
+Bug #77552 Uninitialized php_stream_statbuf in stat functions
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) != 'WIN') {
@@ -15,7 +15,7 @@ $target = $tmpDir.'/folder/target';
mkdir($target, 0777, true);
$junction = $tmpDir.'/junction';
-$cmd = sprintf('mklink /J "%s" "%s"', $junction, $target);
+$cmd = sprintf('mklink /J "%s" "%s"', $junction, $target);
exec($cmd);
$stat = lstat($junction);
diff --git a/ext/standard/tests/file/bug79099.phpt b/ext/standard/tests/file/bug79099.phpt
index a1f2a3355f..1896d7d02c 100644
--- a/ext/standard/tests/file/bug79099.phpt
+++ b/ext/standard/tests/file/bug79099.phpt
@@ -2,31 +2,11 @@
Bug #79099 (OOB read in php_strip_tags_ex)
--FILE--
<?php
-$stream = fopen('php://memory', 'w+');
-fputs($stream, "<?\n\"\n");
-rewind($stream);
-var_dump(@fgetss($stream));
-var_dump(@fgetss($stream));
-fclose($stream);
-
-$stream = fopen('php://memory', 'w+');
-fputs($stream, "<\0\n!\n");
-rewind($stream);
-var_dump(@fgetss($stream));
-var_dump(@fgetss($stream));
-fclose($stream);
-
-$stream = fopen('php://memory', 'w+');
-fputs($stream, "<\0\n?\n");
-rewind($stream);
-var_dump(@fgetss($stream));
-var_dump(@fgetss($stream));
-fclose($stream);
+var_dump(strip_tags("<?\n\"\n"));
+var_dump(strip_tags("<\0\n!\n"));
+var_dump(strip_tags("<\0\n?\n"));
?>
--EXPECT--
string(0) ""
string(0) ""
string(0) ""
-string(0) ""
-string(0) ""
-string(0) ""
diff --git a/ext/standard/tests/file/chgrp.phpt b/ext/standard/tests/file/chgrp.phpt
index 03ea24141b..9003979a75 100644
--- a/ext/standard/tests/file/chgrp.phpt
+++ b/ext/standard/tests/file/chgrp.phpt
@@ -7,9 +7,11 @@ if(substr(PHP_OS, 0, 3) == "WIN")
?>
--FILE--
<?php
-chgrp("sjhgfskhagkfdgskjfhgskfsdgfkdsajf", NULL);
-echo "ALIVE\n";
+try {
+ chgrp("sjhgfskhagkfdgskjfhgskfsdgfkdsajf", null);
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
?>
--EXPECTF--
-Warning: chgrp(): parameter 2 should be string or int, null given in %schgrp.php on line 2
-ALIVE
+Parameter 2 should be string or int, null given
diff --git a/ext/standard/tests/file/chmod_basic-win32-mb.phpt b/ext/standard/tests/file/chmod_basic-win32-mb.phpt
index 3970504ddb..a3c0b62410 100644
--- a/ext/standard/tests/file/chmod_basic-win32-mb.phpt
+++ b/ext/standard/tests/file/chmod_basic-win32-mb.phpt
@@ -17,10 +17,10 @@ $fd = fopen($filename, "w+");
fclose($fd);
for ($perms_to_set = 0777; $perms_to_set >= 0; $perms_to_set--) {
- chmod($filename, $perms_to_set);
- $set_perms = (fileperms($filename) & PERMISSIONS_MASK);
- clearstatcache();
- printf("Setting mode %o gives mode %o\n", $perms_to_set, $set_perms);
+ chmod($filename, $perms_to_set);
+ $set_perms = (fileperms($filename) & PERMISSIONS_MASK);
+ clearstatcache();
+ printf("Setting mode %o gives mode %o\n", $perms_to_set, $set_perms);
}
var_dump(chmod($filename, 0777));
diff --git a/ext/standard/tests/file/chmod_basic-win32.phpt b/ext/standard/tests/file/chmod_basic-win32.phpt
index 31d44c80aa..072f98d644 100644
--- a/ext/standard/tests/file/chmod_basic-win32.phpt
+++ b/ext/standard/tests/file/chmod_basic-win32.phpt
@@ -17,10 +17,10 @@ $fd = fopen($filename, "w+");
fclose($fd);
for ($perms_to_set = 0777; $perms_to_set >= 0; $perms_to_set--) {
- chmod($filename, $perms_to_set);
- $set_perms = (fileperms($filename) & PERMISSIONS_MASK);
- clearstatcache();
- printf("Setting mode %o gives mode %o\n", $perms_to_set, $set_perms);
+ chmod($filename, $perms_to_set);
+ $set_perms = (fileperms($filename) & PERMISSIONS_MASK);
+ clearstatcache();
+ printf("Setting mode %o gives mode %o\n", $perms_to_set, $set_perms);
}
var_dump(chmod($filename, 0777));
diff --git a/ext/standard/tests/file/chmod_basic.phpt b/ext/standard/tests/file/chmod_basic.phpt
index fc983074fd..635ea8de79 100644
--- a/ext/standard/tests/file/chmod_basic.phpt
+++ b/ext/standard/tests/file/chmod_basic.phpt
@@ -17,12 +17,12 @@ $fd = fopen($filename, "w+");
fclose($fd);
for ($perms_to_set = 07777; $perms_to_set >= 0; $perms_to_set--) {
- chmod($filename, $perms_to_set);
- $set_perms = (fileperms($filename) & MODE_MASK);
- clearstatcache();
- if ($set_perms != $perms_to_set) {
- printf("Error: %o does not match %o\n", $set_perms, $perms_to_set);
- }
+ chmod($filename, $perms_to_set);
+ $set_perms = (fileperms($filename) & MODE_MASK);
+ clearstatcache();
+ if ($set_perms != $perms_to_set) {
+ printf("Error: %o does not match %o\n", $set_perms, $perms_to_set);
+ }
}
var_dump(chmod($filename, 0777));
diff --git a/ext/standard/tests/file/chmod_error.phpt b/ext/standard/tests/file/chmod_error.phpt
index 3b234c741f..e45ee4ecba 100644
--- a/ext/standard/tests/file/chmod_error.phpt
+++ b/ext/standard/tests/file/chmod_error.phpt
@@ -10,38 +10,13 @@ Test chmod() function : error conditions
echo "*** Testing chmod() : error conditions ***\n";
-
-//Test chmod with one more than the expected number of arguments
-echo "\n-- Testing chmod() function with more than expected no. of arguments --\n";
-$filename = 'string_val';
-$mode = 10;
-$extra_arg = 10;
-var_dump( chmod($filename, $mode, $extra_arg) );
-
-// Testing chmod with one less than the expected number of arguments
-echo "\n-- Testing chmod() function with less than expected no. of arguments --\n";
-$filename = 'string_val';
-var_dump( chmod($filename) );
-
// testing chmod with a non-existing file
$filename = "___nonExisitingFile___";
var_dump(chmod($filename, 0777));
?>
-===DONE===
--EXPECTF--
*** Testing chmod() : error conditions ***
--- Testing chmod() function with more than expected no. of arguments --
-
-Warning: chmod() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
--- Testing chmod() function with less than expected no. of arguments --
-
-Warning: chmod() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
Warning: chmod(): No such file or directory in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/standard/tests/file/chmod_variation1.phpt b/ext/standard/tests/file/chmod_variation1.phpt
index 935d30ce55..f89c70fa5d 100644
--- a/ext/standard/tests/file/chmod_variation1.phpt
+++ b/ext/standard/tests/file/chmod_variation1.phpt
@@ -15,12 +15,12 @@ $dirname = __DIR__ . "/" . basename(__FILE__, ".php") . "testdir";
mkdir($dirname);
for ($perms_to_set = 0777; $perms_to_set >= 0; $perms_to_set--) {
- chmod($dirname, $perms_to_set);
- $set_perms = (fileperms($dirname) & PERMISSIONS_MASK);
- clearstatcache();
- if ($set_perms != $perms_to_set) {
- printf("Error: %o does not match %o\n", $set_perms, $perms_to_set);
- }
+ chmod($dirname, $perms_to_set);
+ $set_perms = (fileperms($dirname) & PERMISSIONS_MASK);
+ clearstatcache();
+ if ($set_perms != $perms_to_set) {
+ printf("Error: %o does not match %o\n", $set_perms, $perms_to_set);
+ }
}
var_dump(chmod($dirname, 0777));
diff --git a/ext/standard/tests/file/chown.phpt b/ext/standard/tests/file/chown.phpt
index 049073e7a0..1654e550b6 100644
--- a/ext/standard/tests/file/chown.phpt
+++ b/ext/standard/tests/file/chown.phpt
@@ -11,5 +11,5 @@ chown("sjhgfskhagkfdgskjfhgskfsdgfkdsajf", NULL);
echo "ALIVE\n";
?>
--EXPECTF--
-Warning: chown(): parameter 2 should be string or int, null given in %schown.php on line %d
+Warning: chown(): Parameter 2 should be string or int, null given in %schown.php on line %d
ALIVE
diff --git a/ext/standard/tests/file/copy_error.phpt b/ext/standard/tests/file/copy_error.phpt
index 2d6395167b..761c4403f7 100644
--- a/ext/standard/tests/file/copy_error.phpt
+++ b/ext/standard/tests/file/copy_error.phpt
@@ -11,27 +11,11 @@ echo "*** Testing copy() function: error conditions --\n";
/* Invalid args */
var_dump( copy("/no/file", "file") );
-/* No.of args less than expected */
-var_dump( copy() );
-var_dump( copy(__FILE__) );
-
-/* No.of args less than expected */
-var_dump( copy(__FILE__, "file1", "file1") );
-
echo "*** Done ***\n";
?>
--EXPECTF--
*** Testing copy() function: error conditions --
-Warning: copy(/no/file): failed to open stream: No such file or directory in %s on line %d
+Warning: copy(/no/file): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-
-Warning: copy() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: copy() expects at least 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: copy() expects parameter 3 to be resource, string given in %s on line %d
-NULL
*** Done ***
diff --git a/ext/standard/tests/file/copy_variation14.phpt b/ext/standard/tests/file/copy_variation14.phpt
index 45289af90a..bee8c94b47 100644
--- a/ext/standard/tests/file/copy_variation14.phpt
+++ b/ext/standard/tests/file/copy_variation14.phpt
@@ -8,7 +8,7 @@ Test copy() function: usage variations - non existing src/dest
*/
/* Test copy(): Trying to create a copy of non-existing source in an existing destination
- and an existing source in non-existing destiantion */
+ and an existing source in non-existing destination */
$file_path = __DIR__;
diff --git a/ext/standard/tests/file/copy_variation16-win32.phpt b/ext/standard/tests/file/copy_variation16-win32.phpt
index b6e8a26684..ae79b79984 100644
--- a/ext/standard/tests/file/copy_variation16-win32.phpt
+++ b/ext/standard/tests/file/copy_variation16-win32.phpt
@@ -130,7 +130,7 @@ Size of destination file => int(3500)
-- Iteration 7 --
Size of source file => int(3500)
Copy operation =>
-Warning: copy(%s): failed to open stream: No such file or directory in %s on line %d
+Warning: copy(%s): Failed to open stream: No such file or directory in %s on line %d
bool(false)
Existence of destination file => bool(false)
diff --git a/ext/standard/tests/file/copy_variation4.phpt b/ext/standard/tests/file/copy_variation4.phpt
index b082c082b5..01385cb893 100644
--- a/ext/standard/tests/file/copy_variation4.phpt
+++ b/ext/standard/tests/file/copy_variation4.phpt
Binary files differ
diff --git a/ext/standard/tests/file/copy_variation6-win32.phpt b/ext/standard/tests/file/copy_variation6-win32.phpt
index 59a82236d2..4e94c148c5 100644
--- a/ext/standard/tests/file/copy_variation6-win32.phpt
+++ b/ext/standard/tests/file/copy_variation6-win32.phpt
@@ -129,7 +129,7 @@ Size of destination file => int(0)
-- Iteration 7 --
Copy operation =>
-Warning: copy(%s/copy_variation6/copy_variation6_sub///../*): failed to open stream: No such file or directory in %s on line %d
+Warning: copy(%s/copy_variation6/copy_variation6_sub///../*): Failed to open stream: No such file or directory in %s on line %d
bool(false)
Existence of destination file => bool(false)
diff --git a/ext/standard/tests/file/directory_wrapper_fstat_basic.phpt b/ext/standard/tests/file/directory_wrapper_fstat_basic.phpt
index 9131a4cfcd..14f7bac438 100644
--- a/ext/standard/tests/file/directory_wrapper_fstat_basic.phpt
+++ b/ext/standard/tests/file/directory_wrapper_fstat_basic.phpt
@@ -7,7 +7,5 @@ $h = opendir($d);
var_dump(fstat($h));
closedir($h);
?>
-===DONE===
--EXPECT--
bool(false)
-===DONE===
diff --git a/ext/standard/tests/file/dirname_basic-win32.phpt b/ext/standard/tests/file/dirname_basic-win32.phpt
index bb53255fc8..1ae436d1e1 100644
--- a/ext/standard/tests/file/dirname_basic-win32.phpt
+++ b/ext/standard/tests/file/dirname_basic-win32.phpt
@@ -20,44 +20,43 @@ echo "*** Testing dirname() : basic functionality ***\n";
// Initialise all required variables
$paths = array(
- '',
- ' ',
- 'c:',
- 'c:\\',
- 'c:/',
- 'afile',
- 'c:\test\afile',
- 'c:\\test\\afile',
- 'c://test//afile',
- 'c:\test\afile\\',
- '/usr/lib/locale/en_US',
- '//usr/lib//locale/en_US',
- '\\',
- '\\\\',
- '/',
- '//',
- '///',
- '/usr/lib/locale/en_US/',
- 'c:\windows/system32\drivers/etc\hosts',
- '/usr\lib/locale\en_US',
- ' c:\test\adir\afile.txt',
- 'c:\test\adir\afile.txt ',
- ' c:\test\adir\afile.txt ',
- ' /usr/lib/locale/en_US',
- '/usr/lib/locale/en_US ',
- ' /usr/lib/locale/en_US ',
- ' c:',
- ' c:\test\adir\afile.txt',
- '/usr',
- '/usr/',
- );
+ '',
+ ' ',
+ 'c:',
+ 'c:\\',
+ 'c:/',
+ 'afile',
+ 'c:\test\afile',
+ 'c:\\test\\afile',
+ 'c://test//afile',
+ 'c:\test\afile\\',
+ '/usr/lib/locale/en_US',
+ '//usr/lib//locale/en_US',
+ '\\',
+ '\\\\',
+ '/',
+ '//',
+ '///',
+ '/usr/lib/locale/en_US/',
+ 'c:\windows/system32\drivers/etc\hosts',
+ '/usr\lib/locale\en_US',
+ ' c:\test\adir\afile.txt',
+ 'c:\test\adir\afile.txt ',
+ ' c:\test\adir\afile.txt ',
+ ' /usr/lib/locale/en_US',
+ '/usr/lib/locale/en_US ',
+ ' /usr/lib/locale/en_US ',
+ ' c:',
+ ' c:\test\adir\afile.txt',
+ '/usr',
+ '/usr/',
+ );
foreach ($paths as $path) {
- var_dump( dirname($path) );
+ var_dump( dirname($path) );
}
?>
-===DONE===
--EXPECT--
*** Testing dirname() : basic functionality ***
string(0) ""
@@ -90,4 +89,3 @@ string(1) "."
string(14) " c:\test\adir"
string(1) "\"
string(1) "\"
-===DONE===
diff --git a/ext/standard/tests/file/dirname_basic.phpt b/ext/standard/tests/file/dirname_basic.phpt
index 74d0a14e9e..75355a7135 100644
--- a/ext/standard/tests/file/dirname_basic.phpt
+++ b/ext/standard/tests/file/dirname_basic.phpt
@@ -20,44 +20,43 @@ echo "*** Testing dirname() : basic functionality ***\n";
// Initialise all required variables
$paths = array(
- '',
- ' ',
- 'c:',
- 'c:\\',
- 'c:/',
- 'afile',
- 'c:\test\afile',
- 'c:\\test\\afile',
- 'c://test//afile',
- 'c:\test\afile\\',
- '/usr/lib/locale/en_US',
- '//usr/lib//locale/en_US',
- '\\',
- '\\\\',
- '/',
- '//',
- '///',
- '/usr/lib/locale/en_US/',
- 'c:\windows/system32\drivers/etc\hosts',
- '/usr\lib/locale\en_US',
- ' c:\test\adir\afile.txt',
- 'c:\test\adir\afile.txt ',
- ' c:\test\adir\afile.txt ',
- ' /usr/lib/locale/en_US',
- '/usr/lib/locale/en_US ',
- ' /usr/lib/locale/en_US ',
- ' c:',
- ' c:\test\adir\afile.txt',
- '/usr',
- '/usr/'
- );
+ '',
+ ' ',
+ 'c:',
+ 'c:\\',
+ 'c:/',
+ 'afile',
+ 'c:\test\afile',
+ 'c:\\test\\afile',
+ 'c://test//afile',
+ 'c:\test\afile\\',
+ '/usr/lib/locale/en_US',
+ '//usr/lib//locale/en_US',
+ '\\',
+ '\\\\',
+ '/',
+ '//',
+ '///',
+ '/usr/lib/locale/en_US/',
+ 'c:\windows/system32\drivers/etc\hosts',
+ '/usr\lib/locale\en_US',
+ ' c:\test\adir\afile.txt',
+ 'c:\test\adir\afile.txt ',
+ ' c:\test\adir\afile.txt ',
+ ' /usr/lib/locale/en_US',
+ '/usr/lib/locale/en_US ',
+ ' /usr/lib/locale/en_US ',
+ ' c:',
+ ' c:\test\adir\afile.txt',
+ '/usr',
+ '/usr/'
+ );
foreach ($paths as $path) {
- var_dump( dirname($path) );
+ var_dump( dirname($path) );
}
?>
-===DONE===
--EXPECT--
*** Testing dirname() : basic functionality ***
string(0) ""
@@ -90,4 +89,3 @@ string(1) "."
string(1) "."
string(1) "/"
string(1) "/"
-===DONE===
diff --git a/ext/standard/tests/file/dirname_no_path_normalization-win32.phpt b/ext/standard/tests/file/dirname_no_path_normalization-win32.phpt
index 2bb227b5c2..cde1e92e24 100644
--- a/ext/standard/tests/file/dirname_no_path_normalization-win32.phpt
+++ b/ext/standard/tests/file/dirname_no_path_normalization-win32.phpt
@@ -10,18 +10,16 @@ if(substr(PHP_OS, 0, 3) != "WIN")
$s = '/php_sanity/sanity.php?';
while (dirname($s) == "/php_sanity" && strlen($s) < 10000) {
- $s .= str_repeat('X', 250);
+ $s .= str_repeat('X', 250);
}
if (strlen($s) >= 10000) {
- echo "OK\n";
+ echo "OK\n";
} else {
- print "ERROR: " . PHP_EOL;
- var_dump(dirname($s));
- var_dump(strlen($s));
+ print "ERROR: " . PHP_EOL;
+ var_dump(dirname($s));
+ var_dump(strlen($s));
}
?>
-===DONE===
--EXPECT--
OK
-===DONE===
diff --git a/ext/standard/tests/file/disk.phpt b/ext/standard/tests/file/disk.phpt
index 0ed1dcea95..424de1f6ba 100644
--- a/ext/standard/tests/file/disk.phpt
+++ b/ext/standard/tests/file/disk.phpt
@@ -13,9 +13,6 @@ disk_total_space
--FILE--
<?php
-var_dump(disk_free_space());
-var_dump(disk_total_space());
-
var_dump(disk_free_space(-1));
var_dump(disk_total_space(-1));
@@ -28,12 +25,6 @@ var_dump(disk_total_space("/some/path/here"));
echo "Done\n";
?>
--EXPECTF--
-Warning: disk_free_space() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: disk_total_space() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
Warning: disk_free_space(): No such file or directory in %s on line %d
bool(false)
diff --git a/ext/standard/tests/file/disk_free_space_error-win32.phpt b/ext/standard/tests/file/disk_free_space_error-win32.phpt
index 43e71719c0..e7439d3f34 100644
--- a/ext/standard/tests/file/disk_free_space_error-win32.phpt
+++ b/ext/standard/tests/file/disk_free_space_error-win32.phpt
@@ -16,12 +16,6 @@ if(substr(PHP_OS, 0, 3) != 'WIN' )
echo "*** Testing error conditions ***\n";
$file_path = __DIR__;
-var_dump( disk_free_space() ); // Zero Arguments
-var_dump( diskfreespace() );
-
-var_dump( disk_free_space( $file_path, "extra argument") ); // More than valid number of arguments
-var_dump( diskfreespace( $file_path, "extra argument") );
-
var_dump( disk_free_space( $file_path."/dir1" )); // Invalid directory
var_dump( diskfreespace( $file_path."/dir1" ));
@@ -43,18 +37,6 @@ unlink($file_path."/disk_free_space.tmp");
--EXPECTF--
*** Testing error conditions ***
-Warning: disk_free_space() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: diskfreespace() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: disk_free_space() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: diskfreespace() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
Warning: disk_free_space(): The system cannot find the path specified.
in %s on line %d
bool(false)
diff --git a/ext/standard/tests/file/disk_free_space_error.phpt b/ext/standard/tests/file/disk_free_space_error.phpt
index aca17b2331..ea8d84aa36 100644
--- a/ext/standard/tests/file/disk_free_space_error.phpt
+++ b/ext/standard/tests/file/disk_free_space_error.phpt
@@ -16,12 +16,6 @@ if(substr(PHP_OS, 0, 3) == 'WIN')
echo "*** Testing error conditions ***\n";
$file_path = __DIR__;
-var_dump( disk_free_space() ); // Zero Arguments
-var_dump( diskfreespace() );
-
-var_dump( disk_free_space( $file_path, "extra argument") ); // More than valid number of arguments
-var_dump( diskfreespace( $file_path, "extra argument") );
-
var_dump( disk_free_space( $file_path."/dir1" )); // Invalid directory
var_dump( diskfreespace( $file_path."/dir1" ));
@@ -43,18 +37,6 @@ unlink($file_path."/disk_free_space.tmp");
--EXPECTF--
*** Testing error conditions ***
-Warning: disk_free_space() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: diskfreespace() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: disk_free_space() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: diskfreespace() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
Warning: disk_free_space(): No such file or directory in %s on line %d
bool(false)
diff --git a/ext/standard/tests/file/disk_free_space_variation.phpt b/ext/standard/tests/file/disk_free_space_variation.phpt
index 25eeadf800..d47850d898 100644
--- a/ext/standard/tests/file/disk_free_space_variation.phpt
+++ b/ext/standard/tests/file/disk_free_space_variation.phpt
@@ -48,8 +48,16 @@ $count = 1;
/* loop through to test each element the above array */
foreach($dirs_arr as $dir1) {
echo "\n-- Iteration $count --\n";
- var_dump( disk_free_space( $dir1 ) );
- var_dump( diskfreespace( $dir1 ) );
+ try {
+ var_dump( disk_free_space( $dir1 ) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ try {
+ var_dump( diskfreespace( $dir1 ) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$count++;
}
@@ -102,35 +110,19 @@ float(%d)
float(%d)
-- Iteration 9 --
-
-Warning: disk_free_space() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: diskfreespace() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+disk_free_space() expects parameter 1 to be a valid path, string given
+diskfreespace() expects parameter 1 to be a valid path, string given
-- Iteration 10 --
-
-Warning: disk_free_space() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: diskfreespace() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+disk_free_space() expects parameter 1 to be a valid path, string given
+diskfreespace() expects parameter 1 to be a valid path, string given
-- Iteration 11 --
-
-Warning: disk_free_space() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: diskfreespace() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+disk_free_space() expects parameter 1 to be a valid path, string given
+diskfreespace() expects parameter 1 to be a valid path, string given
-- Iteration 12 --
-
-Warning: disk_free_space() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: diskfreespace() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+disk_free_space() expects parameter 1 to be a valid path, string given
+diskfreespace() expects parameter 1 to be a valid path, string given
--- Done ---
diff --git a/ext/standard/tests/file/disk_total_space_error-win32.phpt b/ext/standard/tests/file/disk_total_space_error-win32.phpt
index c280f5e064..2e6192cf82 100644
--- a/ext/standard/tests/file/disk_total_space_error-win32.phpt
+++ b/ext/standard/tests/file/disk_total_space_error-win32.phpt
@@ -18,10 +18,6 @@ disk_total_space
echo "*** Testing error conditions ***\n";
$file_path = __DIR__;
-var_dump( disk_total_space() ); // Zero Arguments
-
-var_dump( disk_total_space( $file_path, "extra argument") ); // More than valid number of arguments
-
var_dump( disk_total_space( $file_path."/dir1" )); // Invalid directory
@@ -40,12 +36,6 @@ unlink($file_path."/disk_total_space.tmp");
--EXPECTF--
*** Testing error conditions ***
-Warning: disk_total_space() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: disk_total_space() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
Warning: disk_total_space(): The system cannot find the path specified.
in %s on line %d
bool(false)
diff --git a/ext/standard/tests/file/disk_total_space_error.phpt b/ext/standard/tests/file/disk_total_space_error.phpt
index 8fd5cc3c53..0fba673f28 100644
--- a/ext/standard/tests/file/disk_total_space_error.phpt
+++ b/ext/standard/tests/file/disk_total_space_error.phpt
@@ -18,10 +18,6 @@ disk_total_space
echo "*** Testing error conditions ***\n";
$file_path = __DIR__;
-var_dump( disk_total_space() ); // Zero Arguments
-
-var_dump( disk_total_space( $file_path, "extra argument") ); // More than valid number of arguments
-
var_dump( disk_total_space( $file_path."/dir1" )); // Invalid directory
@@ -40,12 +36,6 @@ unlink($file_path."/disk_total_space.tmp");
--EXPECTF--
*** Testing error conditions ***
-Warning: disk_total_space() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: disk_total_space() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
Warning: disk_total_space(): No such file or directory in %s on line %d
bool(false)
float(%d)
diff --git a/ext/standard/tests/file/disk_total_space_variation.phpt b/ext/standard/tests/file/disk_total_space_variation.phpt
index 05d1f074d3..e35981f278 100644
--- a/ext/standard/tests/file/disk_total_space_variation.phpt
+++ b/ext/standard/tests/file/disk_total_space_variation.phpt
@@ -51,7 +51,11 @@ $count = 1;
/* loop through to test each element the above array */
foreach($dirs_arr as $dir1) {
echo "\n-- Iteration $count --\n";
- var_dump( disk_total_space( $dir1 ) );
+ try {
+ var_dump( disk_total_space( $dir1 ) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$count++;
}
@@ -98,25 +102,17 @@ float(%d)
float(%d)
-- Iteration 9 --
-
-Warning: disk_total_space() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+disk_total_space() expects parameter 1 to be a valid path, string given
-- Iteration 10 --
-
-Warning: disk_total_space() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+disk_total_space() expects parameter 1 to be a valid path, string given
-- Iteration 11 --
-
-Warning: disk_total_space() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+disk_total_space() expects parameter 1 to be a valid path, string given
-- Iteration 12 --
-
-Warning: disk_total_space() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+disk_total_space() expects parameter 1 to be a valid path, string given
*** Testing with Binary Input ***
-float(%d)
+float(%s)
--- Done ---
diff --git a/ext/standard/tests/file/fclose_variation1.phpt b/ext/standard/tests/file/fclose_variation1.phpt
index ba3631e50d..8d3e1a1805 100644
--- a/ext/standard/tests/file/fclose_variation1.phpt
+++ b/ext/standard/tests/file/fclose_variation1.phpt
@@ -7,9 +7,13 @@ function separate_zval(&$var) { }
$s2 = $s;
separate_zval($s2);
fclose($s);
-echo fread($s2, strlen("<?php"));
+try {
+ echo fread($s2, strlen("<?php"));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "\nDone.\n";
---EXPECTF--
-Warning: fread(): supplied resource is not a valid stream resource in %s on line %d
+--EXPECT--
+fread(): supplied resource is not a valid stream resource
Done.
diff --git a/ext/standard/tests/file/feof_basic.phpt b/ext/standard/tests/file/feof_basic.phpt
index 2fc2e4b855..0711a3468d 100644
--- a/ext/standard/tests/file/feof_basic.phpt
+++ b/ext/standard/tests/file/feof_basic.phpt
@@ -64,13 +64,17 @@ var_dump(feof($h));
echo "*** closing file, testing eof ***\n";
fclose($h);
-feof($h);
+try {
+ feof($h);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
unlink($tmpFile1);
unlink($tmpFile2);
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing feof() : basic functionality ***
*** testing reading complete file using feof to stop ***
@@ -96,6 +100,5 @@ bool(false)
*** testing feof after a seek passed the end ***
bool(false)
*** closing file, testing eof ***
-
-Warning: feof(): supplied resource is not a valid stream resource in %s on line %d
+feof(): supplied resource is not a valid stream resource
Done
diff --git a/ext/standard/tests/file/fflush_basic.phpt b/ext/standard/tests/file/fflush_basic.phpt
index 2c9314394b..854a23db45 100644
--- a/ext/standard/tests/file/fflush_basic.phpt
+++ b/ext/standard/tests/file/fflush_basic.phpt
@@ -22,7 +22,7 @@ if($file_handle == false)
exit("Error:failed to open file $filename");
if(substr(PHP_OS, 0, 3) == "WIN") {
- $data = str_replace("\r",'', $data);
+ $data = str_replace("\r",'', $data);
}
// writing data to the file
diff --git a/ext/standard/tests/file/fgetc_basic.phpt b/ext/standard/tests/file/fgetc_basic.phpt
index f5b8ef9055..a69470b3d6 100644
--- a/ext/standard/tests/file/fgetc_basic.phpt
+++ b/ext/standard/tests/file/fgetc_basic.phpt
@@ -10,7 +10,7 @@ Test fgetc() function : basic functionality
include ("file.inc");
echo "*** Testing fgetc() : basic operations ***\n";
-/* read charecter from different files which are opened in different modes */
+/* read character from different files which are opened in different modes */
$file_modes = array( "r", "rb", "rt", "r+", "r+b", "r+t");
/* create file with following type of contents */
@@ -46,7 +46,7 @@ for($outerloop_counter = 0; $outerloop_counter < count($file_content_types); $ou
var_dump( fgetc($file_handle) ); // read a char
var_dump( ftell($file_handle) ); // file pointer position
var_dump( feof($file_handle) ); // is it eof()
- var_dump($file_handle); // dump the $file_handle to see if any thing got modifed
+ var_dump($file_handle); // dump the $file_handle to see if any thing got modified
} // end of for
// close the file
diff --git a/ext/standard/tests/file/fgetc_variation2.phpt b/ext/standard/tests/file/fgetc_variation2.phpt
index d444209af4..d67e56e56a 100644
--- a/ext/standard/tests/file/fgetc_variation2.phpt
+++ b/ext/standard/tests/file/fgetc_variation2.phpt
@@ -24,29 +24,16 @@ $file_handle = fopen(__FILE__, "r");
fclose($file_handle);
// read from closed file
-var_dump( fgetc($file_handle) );
-
-echo "-- Testing fgetc() with unset handle --\n";
-// open the file for reading
-$file_handle = fopen(__FILE__, "r");
-// unset the file handle
-unset($file_handle);
-
-//fgetc using unset handle
-var_dump( fgetc($file_handle) );
+try {
+ var_dump( fgetc($file_handle) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing fgetc() : usage variations ***
-- Testing fgetc() with closed handle --
-
-Warning: fgetc(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
--- Testing fgetc() with unset handle --
-
-Notice: Undefined variable: file_handle in %s on line %d
-
-Warning: fgetc() expects parameter 1 to be resource, null given in %s on line %d
-bool(false)
+fgetc(): supplied resource is not a valid stream resource
Done
diff --git a/ext/standard/tests/file/fgetc_variation3.phpt b/ext/standard/tests/file/fgetc_variation3.phpt
index 67f5c76ff4..e8cd705abd 100644
--- a/ext/standard/tests/file/fgetc_variation3.phpt
+++ b/ext/standard/tests/file/fgetc_variation3.phpt
@@ -56,7 +56,7 @@ bool(true)
int(0)
bool(false)
-Notice: fgetc(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fgetc(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
@@ -65,7 +65,7 @@ bool(true)
int(0)
bool(false)
-Notice: fgetc(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fgetc(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
@@ -74,7 +74,7 @@ bool(true)
int(0)
bool(false)
-Notice: fgetc(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fgetc(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
@@ -83,7 +83,7 @@ bool(true)
int(0)
bool(false)
-Notice: fgetc(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fgetc(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
@@ -92,7 +92,7 @@ bool(true)
int(0)
bool(false)
-Notice: fgetc(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fgetc(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
@@ -101,7 +101,7 @@ bool(true)
int(0)
bool(false)
-Notice: fgetc(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fgetc(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
@@ -110,7 +110,7 @@ bool(true)
int(0)
bool(false)
-Notice: fgetc(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fgetc(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
@@ -119,7 +119,7 @@ bool(true)
int(0)
bool(false)
-Notice: fgetc(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fgetc(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
@@ -128,7 +128,7 @@ bool(true)
int(0)
bool(false)
-Notice: fgetc(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fgetc(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
diff --git a/ext/standard/tests/file/fgetcsv.phpt b/ext/standard/tests/file/fgetcsv.phpt
index 7a6d7d59db..17ac19ca60 100644
--- a/ext/standard/tests/file/fgetcsv.phpt
+++ b/ext/standard/tests/file/fgetcsv.phpt
@@ -2,39 +2,39 @@
various fgetcsv() functionality tests
--FILE--
<?php
- $list = array(
- 'aaa,bbb',
- 'aaa,"bbb"',
- '"aaa","bbb"',
- 'aaa,bbb',
- '"aaa",bbb',
- '"aaa", "bbb"',
- ',',
- 'aaa,',
- ',"aaa"',
- '"",""',
- '"\\"","aaa"',
- '"""""",',
- '""""",aaa',
- '"\\""",aaa',
- 'aaa,"\\"bbb,ccc',
- 'aaa,bbb ',
- 'aaa,"bbb "',
- 'aaa"aaa","bbb"bbb',
- 'aaa"aaa""",bbb',
- 'aaa"\\"a","bbb"'
- );
+ $list = array(
+ 'aaa,bbb',
+ 'aaa,"bbb"',
+ '"aaa","bbb"',
+ 'aaa,bbb',
+ '"aaa",bbb',
+ '"aaa", "bbb"',
+ ',',
+ 'aaa,',
+ ',"aaa"',
+ '"",""',
+ '"\\"","aaa"',
+ '"""""",',
+ '""""",aaa',
+ '"\\""",aaa',
+ 'aaa,"\\"bbb,ccc',
+ 'aaa,bbb ',
+ 'aaa,"bbb "',
+ 'aaa"aaa","bbb"bbb',
+ 'aaa"aaa""",bbb',
+ 'aaa"\\"a","bbb"'
+ );
- $file = __DIR__ . '/fgetcsv.csv';
- @unlink($file);
- foreach ($list as $v) {
- $fp = fopen($file, "w");
- fwrite($fp, $v . "\n");
- fclose($fp);
+ $file = __DIR__ . '/fgetcsv.csv';
+ @unlink($file);
+ foreach ($list as $v) {
+ $fp = fopen($file, "w");
+ fwrite($fp, $v . "\n");
+ fclose($fp);
- var_dump(fgetcsv(fopen($file, "r"), 1024));
- }
- @unlink($file);
+ var_dump(fgetcsv(fopen($file, "r"), 1024));
+ }
+ @unlink($file);
?>
--EXPECT--
array(2) {
diff --git a/ext/standard/tests/file/fgetcsv_error_conditions.csv b/ext/standard/tests/file/fgetcsv_error_conditions.csv
new file mode 100644
index 0000000000..7bcd2a6a9c
--- /dev/null
+++ b/ext/standard/tests/file/fgetcsv_error_conditions.csv
@@ -0,0 +1,2 @@
+"water",fruit
+This is line of text without csv fields \ No newline at end of file
diff --git a/ext/standard/tests/file/fgetcsv_error_conditions.phpt b/ext/standard/tests/file/fgetcsv_error_conditions.phpt
new file mode 100644
index 0000000000..2dcd505a7b
--- /dev/null
+++ b/ext/standard/tests/file/fgetcsv_error_conditions.phpt
@@ -0,0 +1,61 @@
+--TEST--
+Various fgetcsv() error conditions
+--FILE--
+<?php
+
+$file_name = __DIR__ . '/fgetcsv_error_conditions.csv';
+$file_handle = fopen($file_name, 'r');
+
+$length = 1024;
+$delimiter = ',';
+$enclosure = '"';
+
+echo 'fgetcsv() with negative length' . \PHP_EOL;
+try {
+ var_dump( fgetcsv($file_handle, -10) );
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ var_dump( fgetcsv($file_handle, -10, $delimiter) );
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ var_dump( fgetcsv($file_handle, -10, $delimiter, $enclosure) );
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+echo 'fgetcsv() with delimiter as NULL' . \PHP_EOL;
+try {
+ var_dump( fgetcsv($file_handle, $length, NULL, $enclosure) );
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+echo 'fgetcsv() with enclosure as NULL' . \PHP_EOL;
+try {
+ var_dump( fgetcsv($file_handle, $length, $delimiter, NULL) );
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+echo 'fgetcsv() with delimiter & enclosure as NULL' . \PHP_EOL;
+try {
+ var_dump( fgetcsv($file_handle, $length, NULL, NULL) );
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+?>
+--EXPECT--
+fgetcsv() with negative length
+Length parameter may not be negative
+Length parameter may not be negative
+Length parameter may not be negative
+fgetcsv() with delimiter as NULL
+delimiter must be a character
+fgetcsv() with enclosure as NULL
+enclosure must be a character
+fgetcsv() with delimiter & enclosure as NULL
+delimiter must be a character
diff --git a/ext/standard/tests/file/fgetcsv_variation25.phpt b/ext/standard/tests/file/fgetcsv_variation25.phpt
deleted file mode 100644
index 073248c101..0000000000
--- a/ext/standard/tests/file/fgetcsv_variation25.phpt
+++ /dev/null
@@ -1,935 +0,0 @@
---TEST--
-Test fgetcsv() : usage variations - with negative length value along with enclosure and delimiter
---FILE--
-<?php
-/*
- Prototype: array fgetcsv ( resource $handle [, int $length [, string $delimiter [, string $enclosure]]] );
- Description: Gets line from file pointer and parse for CSV fields
-*/
-
-/*
- Testing fgetcsv() to read from a file when provided with negative length argument
- along with delimiter and enclosure arguments
-*/
-
-echo "*** Testing fgetcsv() : with negative length value ***\n";
-
-/* the array is with three elements in it. Each element should be read as
- 1st element is delimiter, 2nd element is enclosure
- and 3rd element is csv fields
-*/
-$csv_lists = array (
- array(',', '"', '"water",fruit'),
- array(',', '"', '"water","fruit"'),
- array(' ', '^', '^water^ ^fruit^'),
- array(':', '&', '&water&:&fruit&'),
- array('=', '=', '=water===fruit='),
- array('-', '-', '-water--fruit-air'),
- array('-', '-', '-water---fruit---air-'),
- array(':', '&', '&""""&:&"&:,:":&,&:,,,,')
-);
-
-$filename = __DIR__ . '/fgetcsv_variation25.tmp';
-@unlink($filename);
-
-$file_modes = array ("r","rb", "rt", "r+", "r+b", "r+t",
- "a+", "a+b", "a+t",
- "w+", "w+b", "w+t",
- "x+", "x+b", "x+t");
-
-$loop_counter = 1;
-foreach ($csv_lists as $csv_list) {
- for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
- // create the file and add the content with has csv fields
- if ( strstr($file_modes[$mode_counter], "r") ) {
- $file_handle = fopen($filename, "w");
- } else {
- $file_handle = fopen($filename, $file_modes[$mode_counter] );
- }
- if ( !$file_handle ) {
- echo "Error: failed to create file $filename!\n";
- exit();
- }
- $delimiter = $csv_list[0];
- $enclosure = $csv_list[1];
- $csv_field = $csv_list[2];
-
- fwrite($file_handle, $csv_field . "\n");
- // write another line of text and a blank line
- // this will be used to test, if the fgetcsv() read more than a line and its
- // working when only a blank line is read
- fwrite($file_handle, "This is line of text without csv fields\n");
- fwrite($file_handle, "\n"); // blank line
-
- // close the file if the mode to be used is read mode and re-open using read mode
- // else rewind the file pointer to beginning of the file
- if ( strstr($file_modes[$mode_counter], "r" ) ) {
- fclose($file_handle);
- $file_handle = fopen($filename, $file_modes[$mode_counter]);
- } else {
- // rewind the file pointer to bof
- rewind($file_handle);
- }
-
- echo "\n-- Testing fgetcsv() with file opened using $file_modes[$mode_counter] mode --\n";
-
- // call fgetcsv() to parse csv fields
-
- // use the right delimiter and enclosure with negative length
- var_dump( fgetcsv($file_handle, -10, $delimiter, $enclosure) );
- // check the file pointer position and if eof
- var_dump( ftell($file_handle) );
- var_dump( feof($file_handle) );
-
- // close the file
- fclose($file_handle);
- //delete file
- unlink($filename);
- } //end of mode loop
-} // end of foreach
-
-echo "Done\n";
-?>
---EXPECTF--
-*** Testing fgetcsv() : with negative length value ***
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-Done
diff --git a/ext/standard/tests/file/fgetcsv_variation26.phpt b/ext/standard/tests/file/fgetcsv_variation26.phpt
deleted file mode 100644
index 289972acb3..0000000000
--- a/ext/standard/tests/file/fgetcsv_variation26.phpt
+++ /dev/null
@@ -1,585 +0,0 @@
---TEST--
-Test fgetcsv() : usage variations - reading files opened in write only mode (Bug #42036)
---FILE--
-<?php
-/*
- Prototype: array fgetcsv ( resource $handle [, int $length [, string $delimiter [, string $enclosure]]] );
- Description: Gets line from file pointer and parse for CSV fields
-*/
-
-/* Testing fgetcsv() to read from files opened in write only mode */
-
-echo "*** Testing fgetcsv() : reading the files opened in write only mode ***\n";
-
-/* the array is with three elements in it. Each element should be read as
- 1st element is delimiter, 2nd element is enclosure
- and 3rd element is csv fields
-*/
-$csv_lists = array (
- array(',', '"', '"water",fruit'),
- array(',', '"', '"water","fruit"'),
- array(' ', '^', '^water^ ^fruit^'),
- array(':', '&', '&water&:&fruit&'),
- array('=', '=', '=water===fruit='),
- array('-', '-', '-water--fruit-air'),
- array('-', '-', '-water---fruit---air-'),
- array(':', '&', '&""""&:&"&:,:":&,&:,,,,')
-);
-
-$filename = __DIR__ . '/fgetcsv_variation26.tmp';
-@unlink($filename);
-
-$file_modes = array ("w", "wb", "wt",
- "a", "ab", "at",
- "x", "xb", "xt");
-
-$loop_counter = 1;
-foreach ($csv_lists as $csv_list) {
- for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
- // create the file and add the content with has csv fields
- $file_handle = fopen($filename, $file_modes[$mode_counter] );
-
- if ( !$file_handle ) {
- echo "Error: failed to create file $filename!\n";
- exit();
- }
- $delimiter = $csv_list[0];
- $enclosure = $csv_list[1];
- $csv_field = $csv_list[2];
-
- fwrite($file_handle, $csv_field . "\n");
- // write another line of text and a blank line
- // this will be used to test, if the fgetcsv() read more than a line and its
- // working when only a blank line is read
- fwrite($file_handle, "This is line of text without csv fields\n");
- fwrite($file_handle, "\n"); // blank line
-
- // rewind the file pointer to bof
- rewind($file_handle);
-
- echo "\n-- Testing fgetcsv() with file opened using $file_modes[$mode_counter] mode --\n";
-
- // call fgetcsv() to parse csv fields
-
- // use the right delimiter and enclosure with max length
- var_dump( fgetcsv($file_handle, 1024, $delimiter, $enclosure) );
- // check the file pointer position and if eof
- var_dump( ftell($file_handle) );
- var_dump( feof($file_handle) );
-
- // close the file
- fclose($file_handle);
- //delete file
- unlink($filename);
- } //end of mode loop
-} // end of foreach
-
-echo "Done\n";
-?>
---EXPECTF--
-*** Testing fgetcsv() : reading the files opened in write only mode ***
-
--- Testing fgetcsv() with file opened using w mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using wb mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using wt mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using ab mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using at mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using xb mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using xt mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using wb mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using wt mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using ab mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using at mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using xb mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using xt mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using wb mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using wt mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using ab mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using at mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using xb mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using xt mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using wb mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using wt mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using ab mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using at mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using xb mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using xt mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using wb mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using wt mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using ab mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using at mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using xb mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using xt mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using wb mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using wt mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using ab mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using at mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using xb mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using xt mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using wb mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using wt mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using ab mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using at mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using xb mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using xt mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using wb mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using wt mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using ab mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using at mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using xb mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using xt mode --
-
-Notice: fgetcsv(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-Done
diff --git a/ext/standard/tests/file/fgetcsv_variation27.phpt b/ext/standard/tests/file/fgetcsv_variation27.phpt
deleted file mode 100644
index 484ac89472..0000000000
--- a/ext/standard/tests/file/fgetcsv_variation27.phpt
+++ /dev/null
@@ -1,935 +0,0 @@
---TEST--
-Test fgetcsv() : usage variations - with negative length value along with delimiter and no enclosure
---FILE--
-<?php
-/*
- Prototype: array fgetcsv ( resource $handle [, int $length [, string $delimiter [, string $enclosure]]] );
- Description: Gets line from file pointer and parse for CSV fields
-*/
-
-/*
- Testing fgetcsv() to read from a file when provided with negative length argument
- along with delimiter and no enclosure arguments
-*/
-
-echo "*** Testing fgetcsv() : with negative length value ***\n";
-
-/* the array is with three elements in it. Each element should be read as
- 1st element is delimiter, 2nd element is enclosure
- and 3rd element is csv fields
-*/
-$csv_lists = array (
- array(',', '"', '"water",fruit'),
- array(',', '"', '"water","fruit"'),
- array(' ', '^', '^water^ ^fruit^'),
- array(':', '&', '&water&:&fruit&'),
- array('=', '=', '=water===fruit='),
- array('-', '-', '-water--fruit-air'),
- array('-', '-', '-water---fruit---air-'),
- array(':', '&', '&""""&:&"&:,:":&,&:,,,,')
-);
-
-$filename = __DIR__ . '/fgetcsv_variation27.tmp';
-@unlink($filename);
-
-$file_modes = array ("r","rb", "rt", "r+", "r+b", "r+t",
- "a+", "a+b", "a+t",
- "w+", "w+b", "w+t",
- "x+", "x+b", "x+t");
-
-$loop_counter = 1;
-foreach ($csv_lists as $csv_list) {
- for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
- // create the file and add the content with has csv fields
- if ( strstr($file_modes[$mode_counter], "r") ) {
- $file_handle = fopen($filename, "w");
- } else {
- $file_handle = fopen($filename, $file_modes[$mode_counter] );
- }
- if ( !$file_handle ) {
- echo "Error: failed to create file $filename!\n";
- exit();
- }
- $delimiter = $csv_list[0];
- $enclosure = $csv_list[1];
- $csv_field = $csv_list[2];
-
- fwrite($file_handle, $csv_field . "\n");
- // write another line of text and a blank line
- // this will be used to test, if the fgetcsv() read more than a line and its
- // working when only a blank line is read
- fwrite($file_handle, "This is line of text without csv fields\n");
- fwrite($file_handle, "\n"); // blank line
-
- // close the file if the mode to be used is read mode and re-open using read mode
- // else rewind the file pointer to beginning of the file
- if ( strstr($file_modes[$mode_counter], "r" ) ) {
- fclose($file_handle);
- $file_handle = fopen($filename, $file_modes[$mode_counter]);
- } else {
- // rewind the file pointer to bof
- rewind($file_handle);
- }
-
- echo "\n-- Testing fgetcsv() with file opened using $file_modes[$mode_counter] mode --\n";
-
- // call fgetcsv() to parse csv fields
-
- // use the right delimiter and enclosure with negative length
- var_dump( fgetcsv($file_handle, -10, $delimiter) );
- // check the file pointer position and if eof
- var_dump( ftell($file_handle) );
- var_dump( feof($file_handle) );
-
- // close the file
- fclose($file_handle);
- //delete file
- unlink($filename);
- } //end of mode loop
-} // end of foreach
-
-echo "Done\n";
-?>
---EXPECTF--
-*** Testing fgetcsv() : with negative length value ***
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-Done
diff --git a/ext/standard/tests/file/fgetcsv_variation28.phpt b/ext/standard/tests/file/fgetcsv_variation28.phpt
deleted file mode 100644
index 95d59dcec4..0000000000
--- a/ext/standard/tests/file/fgetcsv_variation28.phpt
+++ /dev/null
@@ -1,935 +0,0 @@
---TEST--
-Test fgetcsv() : usage variations - with negative length value along with neither enclosure and nor delimiter
---FILE--
-<?php
-/*
- Prototype: array fgetcsv ( resource $handle [, int $length [, string $delimiter [, string $enclosure]]] );
- Description: Gets line from file pointer and parse for CSV fields
-*/
-
-/*
- Testing fgetcsv() to read from a file when provided with negative length argument
- along with neither delimiter nor enclosure argument
-*/
-
-echo "*** Testing fgetcsv() : with negative length value ***\n";
-
-/* the array is with three elements in it. Each element should be read as
- 1st element is delimiter, 2nd element is enclosure
- and 3rd element is csv fields
-*/
-$csv_lists = array (
- array(',', '"', '"water",fruit'),
- array(',', '"', '"water","fruit"'),
- array(' ', '^', '^water^ ^fruit^'),
- array(':', '&', '&water&:&fruit&'),
- array('=', '=', '=water===fruit='),
- array('-', '-', '-water--fruit-air'),
- array('-', '-', '-water---fruit---air-'),
- array(':', '&', '&""""&:&"&:,:":&,&:,,,,')
-);
-
-$filename = __DIR__ . '/fgetcsv_variation28.tmp';
-@unlink($filename);
-
-$file_modes = array ("r","rb", "rt", "r+", "r+b", "r+t",
- "a+", "a+b", "a+t",
- "w+", "w+b", "w+t",
- "x+", "x+b", "x+t");
-
-$loop_counter = 1;
-foreach ($csv_lists as $csv_list) {
- for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
- // create the file and add the content with has csv fields
- if ( strstr($file_modes[$mode_counter], "r") ) {
- $file_handle = fopen($filename, "w");
- } else {
- $file_handle = fopen($filename, $file_modes[$mode_counter] );
- }
- if ( !$file_handle ) {
- echo "Error: failed to create file $filename!\n";
- exit();
- }
- $delimiter = $csv_list[0];
- $enclosure = $csv_list[1];
- $csv_field = $csv_list[2];
-
- fwrite($file_handle, $csv_field . "\n");
- // write another line of text and a blank line
- // this will be used to test, if the fgetcsv() read more than a line and its
- // working when only a blank line is read
- fwrite($file_handle, "This is line of text without csv fields\n");
- fwrite($file_handle, "\n"); // blank line
-
- // close the file if the mode to be used is read mode and re-open using read mode
- // else rewind the file pointer to beginning of the file
- if ( strstr($file_modes[$mode_counter], "r" ) ) {
- fclose($file_handle);
- $file_handle = fopen($filename, $file_modes[$mode_counter]);
- } else {
- // rewind the file pointer to bof
- rewind($file_handle);
- }
-
- echo "\n-- Testing fgetcsv() with file opened using $file_modes[$mode_counter] mode --\n";
-
- // call fgetcsv() to parse csv fields
-
- // use the right delimiter and enclosure with negative length
- var_dump( fgetcsv($file_handle, -10) );
- // check the file pointer position and if eof
- var_dump( ftell($file_handle) );
- var_dump( feof($file_handle) );
-
- // close the file
- fclose($file_handle);
- //delete file
- unlink($filename);
- } //end of mode loop
-} // end of foreach
-
-echo "Done\n";
-?>
---EXPECTF--
-*** Testing fgetcsv() : with negative length value ***
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): Length parameter may not be negative in %s on line %d
-bool(false)
-int(0)
-bool(false)
-Done
diff --git a/ext/standard/tests/file/fgetcsv_variation3.phpt b/ext/standard/tests/file/fgetcsv_variation3.phpt
deleted file mode 100644
index e94f81d56d..0000000000
--- a/ext/standard/tests/file/fgetcsv_variation3.phpt
+++ /dev/null
@@ -1,933 +0,0 @@
---TEST--
-Test fgetcsv() : usage variations - with delimiter as NULL
---FILE--
-<?php
-/*
- Prototype: array fgetcsv ( resource $handle [, int $length [, string $delimiter [, string $enclosure]]] );
- Description: Gets line from file pointer and parse for CSV fields
-*/
-
-/* Testing fgetcsv() to read from a file when provided with delimiter value as NULL */
-
-echo "*** Testing fgetcsv() : with delimiter as NULL ***\n";
-
-/* the array is with three elements in it. Each element should be read as
- 1st element is delimiter, 2nd element is enclosure
- and 3rd element is csv fields
-*/
-$csv_lists = array (
- array(',', '"', '"water",fruit'),
- array(',', '"', '"water","fruit"'),
- array(' ', '^', '^water^ ^fruit^'),
- array(':', '&', '&water&:&fruit&'),
- array('=', '=', '=water===fruit='),
- array('-', '-', '-water--fruit-air'),
- array('-', '-', '-water---fruit---air-'),
- array(':', '&', '&""""&:&"&:,:":&,&:,,,,')
-);
-
-$filename = __DIR__ . '/fgetcsv_variation3.tmp';
-@unlink($filename);
-
-$file_modes = array ("r","rb", "rt", "r+", "r+b", "r+t",
- "a+", "a+b", "a+t",
- "w+", "w+b", "w+t",
- "x+", "x+b", "x+t");
-
-$loop_counter = 1;
-foreach ($csv_lists as $csv_list) {
- for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
- // create the file and add the content with has csv fields
- if ( strstr($file_modes[$mode_counter], "r") ) {
- $file_handle = fopen($filename, "w");
- } else {
- $file_handle = fopen($filename, $file_modes[$mode_counter] );
- }
- if ( !$file_handle ) {
- echo "Error: failed to create file $filename!\n";
- exit();
- }
- $delimiter = $csv_list[0];
- $enclosure = $csv_list[1];
- $csv_field = $csv_list[2];
-
- fwrite($file_handle, $csv_field . "\n");
- // write another line of text and a blank line
- // this will be used to test, if the fgetcsv() read more than a line and its
- // working when only a blank line is read
- fwrite($file_handle, "This is line of text without csv fields\n");
- fwrite($file_handle, "\n"); // blank line
-
- // close the file if the mode to be used is read mode and re-open using read mode
- // else rewind the file pointer to beginning of the file
- if ( strstr($file_modes[$mode_counter], "r" ) ) {
- fclose($file_handle);
- $file_handle = fopen($filename, $file_modes[$mode_counter]);
- } else {
- // rewind the file pointer to bof
- rewind($file_handle);
- }
-
- echo "\n-- Testing fgetcsv() with file opened using $file_modes[$mode_counter] mode --\n";
-
- // call fgetcsv() to parse csv fields
-
- // use length as 0
- fseek($file_handle, 0, SEEK_SET);
- var_dump( fgetcsv($file_handle, 1024, NULL, $enclosure) );
- // check the file pointer position and if eof
- var_dump( ftell($file_handle) );
- var_dump( feof($file_handle) );
-
- // close the file
- fclose($file_handle);
- //delete file
- unlink($filename);
- } //end of mode loop
-} // end of foreach
-
-echo "Done\n";
-?>
---EXPECTF--
-*** Testing fgetcsv() : with delimiter as NULL ***
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-Done
diff --git a/ext/standard/tests/file/fgetcsv_variation32.phpt b/ext/standard/tests/file/fgetcsv_variation32.phpt
index eac1046c44..839e51734b 100644
--- a/ext/standard/tests/file/fgetcsv_variation32.phpt
+++ b/ext/standard/tests/file/fgetcsv_variation32.phpt
@@ -15,7 +15,6 @@ while (($data = fgetcsv($stream, 0, ',', '"', '')) !== false) {
}
fclose($stream);
?>
-===DONE===
--EXPECT--
Array
(
@@ -29,4 +28,3 @@ Array
[0] => \\\line1
line2\\\
)
-===DONE===
diff --git a/ext/standard/tests/file/fgetcsv_variation4.phpt b/ext/standard/tests/file/fgetcsv_variation4.phpt
deleted file mode 100644
index 1f32907b53..0000000000
--- a/ext/standard/tests/file/fgetcsv_variation4.phpt
+++ /dev/null
@@ -1,932 +0,0 @@
---TEST--
-Test fgetcsv() : usage variations - with enclosure as NULL
---FILE--
-<?php
-/*
- Prototype: array fgetcsv ( resource $handle [, int $length [, string $delimiter [, string $enclosure]]] );
- Description: Gets line from file pointer and parse for CSV fields
-*/
-
-/* Testing fgetcsv() to read from a file when provided with enclosure value as NULL */
-
-echo "*** Testing fgetcsv() : with enclosure as NULL ***\n";
-
-/* the array is with three elements in it. Each element should be read as
- 1st element is delimiter, 2nd element is enclosure
- and 3rd element is csv fields
-*/
-$csv_lists = array (
- array(',', '"', '"water",fruit'),
- array(',', '"', '"water","fruit"'),
- array(' ', '^', '^water^ ^fruit^'),
- array(':', '&', '&water&:&fruit&'),
- array('=', '=', '=water===fruit='),
- array('-', '-', '-water--fruit-air'),
- array('-', '-', '-water---fruit---air-'),
- array(':', '&', '&""""&:&"&:,:":&,&:,,,,')
-);
-
-$filename = __DIR__ . '/fgetcsv_variation4.tmp';
-@unlink($filename);
-
-$file_modes = array ("r","rb", "rt", "r+", "r+b", "r+t",
- "a+", "a+b", "a+t",
- "w+", "w+b", "w+t",
- "x+", "x+b", "x+t");
-
-$loop_counter = 1;
-foreach ($csv_lists as $csv_list) {
- for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
- // create the file and add the content with has csv fields
- if ( strstr($file_modes[$mode_counter], "r") ) {
- $file_handle = fopen($filename, "w");
- } else {
- $file_handle = fopen($filename, $file_modes[$mode_counter] );
- }
- if ( !$file_handle ) {
- echo "Error: failed to create file $filename!\n";
- exit();
- }
- $delimiter = $csv_list[0];
- $enclosure = $csv_list[1];
- $csv_field = $csv_list[2];
- fwrite($file_handle, $csv_field . "\n");
- // write another line of text and a blank line
- // this will be used to test, if the fgetcsv() read more than a line and its
- // working when only a blan line is read
- fwrite($file_handle, "This is line of text without csv fields\n");
- fwrite($file_handle, "\n"); // blank line
-
- // close the file if the mode to be used is read mode and re-open using read mode
- // else rewind the file pointer to beginning of the file
- if ( strstr($file_modes[$mode_counter], "r" ) ) {
- fclose($file_handle);
- $file_handle = fopen($filename, $file_modes[$mode_counter]);
- } else {
- // rewind the file pointer to bof
- rewind($file_handle);
- }
-
- echo "\n-- Testing fgetcsv() with file opened using $file_modes[$mode_counter] mode --\n";
-
- // call fgetcsv() to parse csv fields
-
- // use length as 0
- fseek($file_handle, 0, SEEK_SET);
- var_dump( fgetcsv($file_handle, 0, $delimiter, NULL) );
- // check the file pointer position and if eof
- var_dump( ftell($file_handle) );
- var_dump( feof($file_handle) );
-
- // close the file
- fclose($file_handle);
- //delete file
- unlink($filename);
- } //end of mode loop
-} // end of foreach
-
-echo "Done\n";
-?>
---EXPECTF--
-*** Testing fgetcsv() : with enclosure as NULL ***
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): enclosure must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-Done
diff --git a/ext/standard/tests/file/fgetcsv_variation5.phpt b/ext/standard/tests/file/fgetcsv_variation5.phpt
deleted file mode 100644
index 4c883abf69..0000000000
--- a/ext/standard/tests/file/fgetcsv_variation5.phpt
+++ /dev/null
@@ -1,934 +0,0 @@
---TEST--
-Test fgetcsv() : usage variations - with delimiter & enclosure as NULL
---FILE--
-<?php
-/*
- Prototype: array fgetcsv ( resource $handle [, int $length [, string $delimiter [, string $enclosure]]] );
- Description: Gets line from file pointer and parse for CSV fields
-*/
-
-/*
- Testing fgetcsv() to read from a file when provided with delimiter and
- enclosure values both as NULL
- */
-
-echo "*** Testing fgetcsv() : with delimiter & enclosure as NULL ***\n";
-
-/* the array is with three elements in it. Each element should be read as
- 1st element is delimiter, 2nd element is enclosure
- and 3rd element is csv fields
-*/
-$csv_lists = array (
- array(',', '"', '"water",fruit'),
- array(',', '"', '"water","fruit"'),
- array(' ', '^', '^water^ ^fruit^'),
- array(':', '&', '&water&:&fruit&'),
- array('=', '=', '=water===fruit='),
- array('-', '-', '-water--fruit-air'),
- array('-', '-', '-water---fruit---air-'),
- array(':', '&', '&""""&:&"&:,:":&,&:,,,,')
-);
-
-$filename = __DIR__ . '/fgetcsv_variation5.tmp';
-@unlink($filename);
-
-$file_modes = array ("r","rb", "rt", "r+", "r+b", "r+t",
- "a+", "a+b", "a+t",
- "w+", "w+b", "w+t",
- "x+", "x+b", "x+t");
-
-$loop_counter = 1;
-foreach ($csv_lists as $csv_list) {
- for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
- // create the file and add the content with has csv fields
- if ( strstr($file_modes[$mode_counter], "r") ) {
- $file_handle = fopen($filename, "w");
- } else {
- $file_handle = fopen($filename, $file_modes[$mode_counter] );
- }
- if ( !$file_handle ) {
- echo "Error: failed to create file $filename!\n";
- exit();
- }
- $delimiter = $csv_list[0];
- $enclosure = $csv_list[1];
- $csv_field = $csv_list[2];
- fwrite($file_handle, $csv_field . "\n");
- // write another line of text and a blank line
- // this will be used to test, if the fgetcsv() read more than a line and its
- // working when only a blank line is read
- fwrite($file_handle, "This is line of text without csv fields\n");
- fwrite($file_handle, "\n"); // blank line
-
- // close the file if the mode to be used is read mode and re-open using read mode
- // else rewind the file pointer to beginning of the file
- if ( strstr($file_modes[$mode_counter], "r" ) ) {
- fclose($file_handle);
- $file_handle = fopen($filename, $file_modes[$mode_counter]);
- } else {
- // rewind the file pointer to bof
- rewind($file_handle);
- }
-
- echo "\n-- Testing fgetcsv() with file opened using $file_modes[$mode_counter] mode --\n";
-
- // call fgetcsv() to parse csv fields
-
- fseek($file_handle, 0, SEEK_SET);
- var_dump( fgetcsv($file_handle, 1024, NULL, NULL) );
- // check the file pointer position and if eof
- var_dump( ftell($file_handle) );
- var_dump( feof($file_handle) );
-
- // close the file
- fclose($file_handle);
- //delete file
- unlink($filename);
- } //end of mode loop
-} // end of foreach
-
-echo "Done\n";
-?>
---EXPECTF--
-*** Testing fgetcsv() : with delimiter & enclosure as NULL ***
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rb mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using rt mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using r+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using a+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using w+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+ mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+b mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetcsv() with file opened using x+t mode --
-
-Warning: fgetcsv(): delimiter must be a character in %s on line %d
-bool(false)
-int(0)
-bool(false)
-Done
diff --git a/ext/standard/tests/file/fgets_basic.phpt b/ext/standard/tests/file/fgets_basic.phpt
index 9b2cd715cc..853be0a8de 100644
--- a/ext/standard/tests/file/fgets_basic.phpt
+++ b/ext/standard/tests/file/fgets_basic.phpt
@@ -7,7 +7,7 @@ Test fgets() function : basic functionality
Description: Gets a line from file pointer
*/
-// include the file.inc for common test funcitons
+// include the file.inc for common test functions
include ("file.inc");
$file_modes = array("r", "rb", "rt", "r+", "r+b", "r+t");
@@ -31,13 +31,13 @@ foreach($file_modes as $file_mode) {
echo "-- fgets() with default length, file pointer at 0 --\n";
var_dump( fgets($file_handle) ); // with default length
var_dump( ftell($file_handle) ); // ensure the file pointer position
- var_dump( feof($file_handle) ); // enusre if eof set
+ var_dump( feof($file_handle) ); // ensure if eof set
echo "-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 --\n";
var_dump( rewind($file_handle) );
var_dump( fgets($file_handle, 23) ); // expected: 22 chars
var_dump( ftell($file_handle) ); // ensure the file pointer position
- var_dump( feof($file_handle) ); // enusre if eof set
+ var_dump( feof($file_handle) ); // ensure if eof set
//close file
fclose($file_handle);
diff --git a/ext/standard/tests/file/fgets_error.phpt b/ext/standard/tests/file/fgets_error.phpt
index 919343aa87..ffc21ee588 100644
--- a/ext/standard/tests/file/fgets_error.phpt
+++ b/ext/standard/tests/file/fgets_error.phpt
@@ -8,100 +8,31 @@ Test fgets() function : error conditions
*/
echo "*** Testing error conditions ***\n";
-// zero argument
-echo "-- Testing fgets() with zero argument --\n";
-var_dump( fgets() );
-// more than expected no. of args
-echo "-- Testing fgets() with more than expected number of arguments --\n";
$fp = fopen(__FILE__, "r");
-var_dump( fgets($fp, 10, $fp) );
// invalid length argument
echo "-- Testing fgets() with invalid length arguments --\n";
$len = 0;
-var_dump( fgets($fp, $len) );
+try {
+ var_dump( fgets($fp, $len) );
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
$len = -10;
-var_dump( fgets($fp, $len) );
+try {
+ var_dump( fgets($fp, $len) );
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
$len = 1;
var_dump( fgets($fp, $len) ); // return length - 1 always, expect false
-
-// test invalid arguments : non-resources
-echo "-- Testing fgets() with invalid arguments --\n";
-$invalid_args = array (
- "string",
- 10,
- 10.5,
- true,
- array(1,2,3),
- new stdclass,
-);
-/* loop to test fgets() with different invalid type of args */
-for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) {
- echo "-- Iteration $loop_counter --\n";
- var_dump( fgets($invalid_args[$loop_counter - 1], 10) );
-}
-
-// fgets() on a file handle which is already closed
-echo "-- Testing fgets() with closed/unset file handle --";
-fclose($fp);
-var_dump(fgets($fp,10));
-
-// fgets() on a file handle which is unset
-$file_handle = fopen(__FILE__, "r");
-unset($file_handle); //unset file handle
-var_dump( fgets(@$file_handle,10));
-
-echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
*** Testing error conditions ***
--- Testing fgets() with zero argument --
-
-Warning: fgets() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
--- Testing fgets() with more than expected number of arguments --
-
-Warning: fgets() expects at most 2 parameters, 3 given in %s on line %d
-bool(false)
-- Testing fgets() with invalid length arguments --
-
-Warning: fgets(): Length parameter must be greater than 0 in %s on line %d
-bool(false)
-
-Warning: fgets(): Length parameter must be greater than 0 in %s on line %d
-bool(false)
-bool(false)
--- Testing fgets() with invalid arguments --
--- Iteration 1 --
-
-Warning: fgets() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
--- Iteration 2 --
-
-Warning: fgets() expects parameter 1 to be resource, int given in %s on line %d
-bool(false)
--- Iteration 3 --
-
-Warning: fgets() expects parameter 1 to be resource, float given in %s on line %d
-bool(false)
--- Iteration 4 --
-
-Warning: fgets() expects parameter 1 to be resource, bool given in %s on line %d
-bool(false)
--- Iteration 5 --
-
-Warning: fgets() expects parameter 1 to be resource, array given in %s on line %d
-bool(false)
--- Iteration 6 --
-
-Warning: fgets() expects parameter 1 to be resource, object given in %s on line %d
-bool(false)
--- Testing fgets() with closed/unset file handle --
-Warning: fgets(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: fgets() expects parameter 1 to be resource, null given in %s on line %d
+Length parameter must be greater than 0
+Length parameter must be greater than 0
bool(false)
-Done
diff --git a/ext/standard/tests/file/fgets_socket_variation1.phpt b/ext/standard/tests/file/fgets_socket_variation1.phpt
index 429ad67d69..ac1086ef56 100644
--- a/ext/standard/tests/file/fgets_socket_variation1.phpt
+++ b/ext/standard/tests/file/fgets_socket_variation1.phpt
@@ -18,7 +18,7 @@ for ($i=0; $i<100; $i++) {
$client = fsockopen("tcp://127.0.0.1:$port");
if (!$client) {
- die("Unable to create socket");
+ die("Unable to create socket");
}
/* Accept that connection */
@@ -38,7 +38,7 @@ echo "\n\nClose the server side socket and read the remaining data from the clie
fclose($socket);
fclose($server);
while(!feof($client)) {
- fread($client, 1);
+ fread($client, 1);
}
echo "done\n";
diff --git a/ext/standard/tests/file/fgets_socket_variation2.phpt b/ext/standard/tests/file/fgets_socket_variation2.phpt
index da1f0b47ad..88fbbd45b9 100644
--- a/ext/standard/tests/file/fgets_socket_variation2.phpt
+++ b/ext/standard/tests/file/fgets_socket_variation2.phpt
@@ -12,7 +12,7 @@ $fd = fopen($filename, "w+");
// populate the file with lines of data
define("LINE_OF_DATA", "12345678\n");
for ($i = 0; $i < 1000; $i++) {
- fwrite($fd, LINE_OF_DATA);
+ fwrite($fd, LINE_OF_DATA);
}
fclose($fd);
@@ -29,7 +29,7 @@ for ($i=0; $i<100; $i++) {
$client = fsockopen("tcp://127.0.0.1:$port");
if (!$client) {
- die("Unable to create socket");
+ die("Unable to create socket");
}
/* Accept that connection */
@@ -44,16 +44,16 @@ fclose($socket);
echo "\nRead lines from the client\n";
while ($line = fgets($client,256)) {
- if (strcmp($line, LINE_OF_DATA) != 0) {
- echo "Error - $line does not match " . LINE_OF_DATA;
- break;
- }
+ if (strcmp($line, LINE_OF_DATA) != 0) {
+ echo "Error - $line does not match " . LINE_OF_DATA;
+ break;
+ }
}
echo "\nClose the server side socket and read the remaining data from the client\n";
fclose($server);
while(!feof($client)) {
- fread($client, 1);
+ fread($client, 1);
}
echo "done\n";
diff --git a/ext/standard/tests/file/fgets_variation1.phpt b/ext/standard/tests/file/fgets_variation1.phpt
index 50856df2e0..1556540a2e 100644
--- a/ext/standard/tests/file/fgets_variation1.phpt
+++ b/ext/standard/tests/file/fgets_variation1.phpt
@@ -55,7 +55,7 @@ bool(true)
int(0)
bool(false)
-Notice: fgets(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fgets(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
@@ -64,7 +64,7 @@ bool(true)
int(0)
bool(false)
-Notice: fgets(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fgets(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
@@ -73,7 +73,7 @@ bool(true)
int(0)
bool(false)
-Notice: fgets(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fgets(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
@@ -82,7 +82,7 @@ bool(true)
int(0)
bool(false)
-Notice: fgets(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fgets(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
@@ -91,7 +91,7 @@ bool(true)
int(0)
bool(false)
-Notice: fgets(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fgets(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
@@ -100,7 +100,7 @@ bool(true)
int(0)
bool(false)
-Notice: fgets(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fgets(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
@@ -109,7 +109,7 @@ bool(true)
int(0)
bool(false)
-Notice: fgets(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fgets(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
@@ -118,7 +118,7 @@ bool(true)
int(0)
bool(false)
-Notice: fgets(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fgets(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
@@ -127,7 +127,7 @@ bool(true)
int(0)
bool(false)
-Notice: fgets(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fgets(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
diff --git a/ext/standard/tests/file/fgets_variation2.phpt b/ext/standard/tests/file/fgets_variation2.phpt
index 0bbcf22039..2626139dcb 100644
--- a/ext/standard/tests/file/fgets_variation2.phpt
+++ b/ext/standard/tests/file/fgets_variation2.phpt
@@ -24,39 +24,22 @@ $file_handle = fopen(__FILE__, "r");
fclose($file_handle);
// read from closed file
-var_dump( fgets($file_handle) ); // default length
-var_dump( fgets($file_handle, 10) ); // with specific length
-
-echo "-- Testing fgets() with unset handle --\n";
-// open the file for reading
-$file_handle = fopen(__FILE__, "r");
-// unset the file handle
-unset($file_handle);
-
-//fgets using unset handle
-var_dump( fgets($file_handle) ); // default length
-var_dump( fgets($file_handle, 10) ); // with specific length
+try {
+ var_dump( fgets($file_handle) ); // default length
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump( fgets($file_handle, 10) ); // with specific length
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing fgets() : usage variations ***
-- Testing fgets() with closed handle --
-
-Warning: fgets(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: fgets(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
--- Testing fgets() with unset handle --
-
-Notice: Undefined variable: file_handle in %s on line %d
-
-Warning: fgets() expects parameter 1 to be resource, null given in %s on line %d
-bool(false)
-
-Notice: Undefined variable: file_handle in %s on line %d
-
-Warning: fgets() expects parameter 1 to be resource, null given in %s on line %d
-bool(false)
+fgets(): supplied resource is not a valid stream resource
+fgets(): supplied resource is not a valid stream resource
Done
diff --git a/ext/standard/tests/file/fgets_variation3.phpt b/ext/standard/tests/file/fgets_variation3.phpt
index ee3f8996ab..cb10dfbc4d 100644
--- a/ext/standard/tests/file/fgets_variation3.phpt
+++ b/ext/standard/tests/file/fgets_variation3.phpt
@@ -7,7 +7,7 @@ Test fgets() function : usage variations - read with/without length
Description: Gets a line from file pointer
*/
-// include the file.inc for common test funcitons
+// include the file.inc for common test functions
include ("file.inc");
$file_modes = array("w+", "w+b", "w+t",
@@ -42,7 +42,7 @@ foreach($file_modes as $file_mode) {
var_dump( ftell($file_handle) );
var_dump( fgets($file_handle) ); // with default length
var_dump( ftell($file_handle) ); // ensure the file pointer position
- var_dump( feof($file_handle) ); // enusre if eof set
+ var_dump( feof($file_handle) ); // ensure if eof set
echo "-- fgets() with length = 23, Expected: 22 chars, file pointer at 0 --\n";
// get the file pointer to beginning of the file
@@ -51,7 +51,7 @@ foreach($file_modes as $file_mode) {
var_dump( ftell($file_handle) );
var_dump( fgets($file_handle, 23) ); // expected: 22 chars
var_dump( ftell($file_handle) ); // ensure the file pointer position
- var_dump( feof($file_handle) ); // enusre if eof set
+ var_dump( feof($file_handle) ); // ensure if eof set
//close file
fclose($file_handle);
diff --git a/ext/standard/tests/file/fgets_variation4-win32-mb.phpt b/ext/standard/tests/file/fgets_variation4-win32-mb.phpt
index 629af64ad1..df3bfa2087 100644
--- a/ext/standard/tests/file/fgets_variation4-win32-mb.phpt
+++ b/ext/standard/tests/file/fgets_variation4-win32-mb.phpt
@@ -13,7 +13,7 @@ if (substr(PHP_OS, 0, 3) != 'WIN') {
Description: Gets a line from file pointer
*/
-// include the file.inc for common test funcitons
+// include the file.inc for common test functions
include ("file.inc");
$file_modes = array("w+", "w+b", "w+t",
@@ -46,14 +46,14 @@ foreach($file_modes as $file_mode) {
var_dump( ftell($file_handle) );
var_dump( fgets($file_handle ) );
var_dump( ftell($file_handle) ); // ensure the file pointer position
- var_dump( feof($file_handle) ); // enusre if eof set
+ var_dump( feof($file_handle) ); // ensure if eof set
echo "-- fgets() with location set by fseek() with length = 20 --\n";
var_dump( fseek($file_handle, 25, SEEK_SET) );
var_dump( ftell($file_handle) );
var_dump( fgets($file_handle, 20 ) ); // expected 19 chars
var_dump( ftell($file_handle) ); // ensure the file pointer position
- var_dump( feof($file_handle) ); // enusre if eof set
+ var_dump( feof($file_handle) ); // ensure if eof set
//close file
fclose($file_handle);
diff --git a/ext/standard/tests/file/fgets_variation4-win32.phpt b/ext/standard/tests/file/fgets_variation4-win32.phpt
index ed8378d357..a7a43fdbb4 100644
--- a/ext/standard/tests/file/fgets_variation4-win32.phpt
+++ b/ext/standard/tests/file/fgets_variation4-win32.phpt
@@ -13,7 +13,7 @@ if (substr(PHP_OS, 0, 3) != 'WIN') {
Description: Gets a line from file pointer
*/
-// include the file.inc for common test funcitons
+// include the file.inc for common test functions
include ("file.inc");
$file_modes = array("w+", "w+b", "w+t",
@@ -46,14 +46,14 @@ foreach($file_modes as $file_mode) {
var_dump( ftell($file_handle) );
var_dump( fgets($file_handle ) );
var_dump( ftell($file_handle) ); // ensure the file pointer position
- var_dump( feof($file_handle) ); // enusre if eof set
+ var_dump( feof($file_handle) ); // ensure if eof set
echo "-- fgets() with location set by fseek() with length = 20 --\n";
var_dump( fseek($file_handle, 25, SEEK_SET) );
var_dump( ftell($file_handle) );
var_dump( fgets($file_handle, 20 ) ); // expected 19 chars
var_dump( ftell($file_handle) ); // ensure the file pointer position
- var_dump( feof($file_handle) ); // enusre if eof set
+ var_dump( feof($file_handle) ); // ensure if eof set
//close file
fclose($file_handle);
diff --git a/ext/standard/tests/file/fgets_variation4.phpt b/ext/standard/tests/file/fgets_variation4.phpt
index cc29e2a620..3dfc4ba801 100644
--- a/ext/standard/tests/file/fgets_variation4.phpt
+++ b/ext/standard/tests/file/fgets_variation4.phpt
@@ -13,7 +13,7 @@ if (substr(PHP_OS, 0, 3) == 'WIN') {
Description: Gets a line from file pointer
*/
-// include the file.inc for common test funcitons
+// include the file.inc for common test functions
include ("file.inc");
$file_modes = array("w+", "w+b", "w+t",
@@ -46,14 +46,14 @@ foreach($file_modes as $file_mode) {
var_dump( ftell($file_handle) );
var_dump( fgets($file_handle ) );
var_dump( ftell($file_handle) ); // ensure the file pointer position
- var_dump( feof($file_handle) ); // enusre if eof set
+ var_dump( feof($file_handle) ); // ensure if eof set
echo "-- fgets() with location set by fseek() with length = 20 --\n";
var_dump( fseek($file_handle, 25, SEEK_SET) );
var_dump( ftell($file_handle) );
var_dump( fgets($file_handle, 20 ) ); // expected 19 chars
var_dump( ftell($file_handle) ); // ensure the file pointer position
- var_dump( feof($file_handle) ); // enusre if eof set
+ var_dump( feof($file_handle) ); // ensure if eof set
//close file
fclose($file_handle);
diff --git a/ext/standard/tests/file/fgets_variation5.phpt b/ext/standard/tests/file/fgets_variation5.phpt
index e0eaa9fe5d..ae1e781097 100644
--- a/ext/standard/tests/file/fgets_variation5.phpt
+++ b/ext/standard/tests/file/fgets_variation5.phpt
@@ -7,7 +7,7 @@ Test fgets() function : usage variations - read beyond filesize
Description: Gets a line from file pointer
*/
-// include the file.inc for common test funcitons
+// include the file.inc for common test functions
include ("file.inc");
$file_modes = array("w+", "w+b", "w+t",
@@ -35,14 +35,14 @@ foreach($file_modes as $file_mode) {
exit();
}
- /* read with length beyong file size */
+ /* read with length beyond file size */
echo "-- fgets() with length > filesize --\n";
rewind($file_handle);
var_dump( ftell($file_handle) );
var_dump( fgets($file_handle, 50 + 23) ); // expected: 50
var_dump( ftell($file_handle) ); // ensure the file pointer position
- var_dump( feof($file_handle) ); // enusre if eof set
+ var_dump( feof($file_handle) ); // ensure if eof set
//close file
fclose($file_handle);
diff --git a/ext/standard/tests/file/fgets_variation6-win32.phpt b/ext/standard/tests/file/fgets_variation6-win32.phpt
index f736d1ce74..11899df1f7 100644
--- a/ext/standard/tests/file/fgets_variation6-win32.phpt
+++ b/ext/standard/tests/file/fgets_variation6-win32.phpt
@@ -13,7 +13,7 @@ if (substr(PHP_OS, 0, 3) != 'WIN') {
Description: Gets a line from file pointer
*/
-// include the file.inc for common test funcitons
+// include the file.inc for common test functions
include ("file.inc");
$file_modes = array("w+", "w+b", "w+t",
diff --git a/ext/standard/tests/file/fgets_variation6.phpt b/ext/standard/tests/file/fgets_variation6.phpt
index 78af58c82d..95a2a73adf 100644
--- a/ext/standard/tests/file/fgets_variation6.phpt
+++ b/ext/standard/tests/file/fgets_variation6.phpt
@@ -13,7 +13,7 @@ if (substr(PHP_OS, 0, 3) == 'WIN') {
Description: Gets a line from file pointer
*/
-// include the file.inc for common test funcitons
+// include the file.inc for common test functions
include ("file.inc");
$file_modes = array("w+", "w+b", "w+t",
diff --git a/ext/standard/tests/file/fgetss.phpt b/ext/standard/tests/file/fgetss.phpt
deleted file mode 100644
index 7ca6169762..0000000000
--- a/ext/standard/tests/file/fgetss.phpt
+++ /dev/null
@@ -1,144 +0,0 @@
---TEST--
-fgetss() tests
---FILE--
-<?php
-
-$filename = __DIR__."/fgetss.html";
-
-$array = array(
- "askasdfasdf<b>aaaaaa\n</b>dddddd",
- "asdqw<i onClick=\"hello();\">\naaaa<>qqqq",
- "aaa<script>function foo() {}</script>qqq",
- "asdasd<a\n asdjeje",
- "",
- "some text \n<b>blah</i>",
- "some another text <> hoho </>"
- );
-
-foreach ($array as $str) {
- file_put_contents($filename, $str);
- $fp = fopen($filename, "r");
- var_dump(fgetss($fp));
- var_dump(fgetss($fp));
-}
-
-foreach ($array as $str) {
- file_put_contents($filename, $str);
- $fp = fopen($filename, "r");
- var_dump(fgetss($fp, 10));
- var_dump(fgetss($fp, 10));
-}
-
-var_dump(fgetss($fp, -10));
-var_dump(fgetss($fp, 0));
-fclose($fp);
-var_dump(fgetss($fp, 0));
-
-@unlink($filename);
-
-echo "Done\n";
-?>
---EXPECTF--
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(18) "askasdfasdfaaaaaa
-"
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(6) "dddddd"
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(6) "asdqw
-"
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(8) "aaaaqqqq"
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(23) "aaafunction foo() {}qqq"
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-bool(false)
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(6) "asdasd"
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(0) ""
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-bool(false)
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-bool(false)
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(11) "some text
-"
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(4) "blah"
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(24) "some another text hoho "
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-bool(false)
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(9) "askasdfas"
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(6) "dfaaaa"
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(5) "asdqw"
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(0) ""
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(3) "aaa"
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(7) "functio"
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(6) "asdasd"
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(0) ""
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-bool(false)
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-bool(false)
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(9) "some text"
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(2) "
-"
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(9) "some anot"
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-string(9) "her text "
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-
-Warning: fgetss(): Length parameter must be greater than 0 in %s on line %d
-bool(false)
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-
-Warning: fgetss(): Length parameter must be greater than 0 in %s on line %d
-bool(false)
-
-Deprecated: Function fgetss() is deprecated in %s on line %d
-
-Warning: fgetss(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-Done
diff --git a/ext/standard/tests/file/fgetss1.phpt b/ext/standard/tests/file/fgetss1.phpt
deleted file mode 100644
index 55b6adbe6b..0000000000
--- a/ext/standard/tests/file/fgetss1.phpt
+++ /dev/null
@@ -1,73 +0,0 @@
---TEST--
-more fgetss() tests
---FILE--
-<?php
-error_reporting(E_ALL & ~E_DEPRECATED);
-
-$filename = __DIR__."/fgetss1.html";
-
-$array = array(
- "askasdfasdf<b>aaaaaa\n</b>dddddd",
- "asdqw<i onClick=\"hello();\">\naaaa<>qqqq",
- "aaa<script>function foo() {}</script>qqq",
- "asdasd<a\n asdjeje",
- "",
- "some text \n<b>blah</i>",
- "some another text <> hoho </>"
- );
-
-foreach ($array as $str) {
- file_put_contents($filename, $str);
- $fp = fopen($filename, "r");
- var_dump(fgetss($fp, 1000, "<i>,<b>,<a>"));
- var_dump(fgetss($fp));
-}
-
-foreach ($array as $str) {
- file_put_contents($filename, $str);
- $fp = fopen($filename, "r");
- var_dump(fgetss($fp, 10));
- var_dump(fgetss($fp, 10, "<script>,<a>"));
-}
-
-echo "Done\n";
-?>
---CLEAN--
-<?php
-$filename = __DIR__."/fgetss1.html";
-unlink($filename);
-?>
---EXPECT--
-string(21) "askasdfasdf<b>aaaaaa
-"
-string(6) "dddddd"
-string(28) "asdqw<i onClick="hello();">
-"
-string(8) "aaaaqqqq"
-string(23) "aaafunction foo() {}qqq"
-bool(false)
-string(6) "asdasd"
-string(0) ""
-bool(false)
-bool(false)
-string(11) "some text
-"
-string(4) "blah"
-string(24) "some another text hoho "
-bool(false)
-string(9) "askasdfas"
-string(6) "dfaaaa"
-string(5) "asdqw"
-string(0) ""
-string(3) "aaa"
-string(9) "t>functio"
-string(6) "asdasd"
-string(0) ""
-bool(false)
-bool(false)
-string(9) "some text"
-string(2) "
-"
-string(9) "some anot"
-string(9) "her text "
-Done
diff --git a/ext/standard/tests/file/fgetss_basic1.phpt b/ext/standard/tests/file/fgetss_basic1.phpt
deleted file mode 100644
index 80d1b74f3c..0000000000
--- a/ext/standard/tests/file/fgetss_basic1.phpt
+++ /dev/null
@@ -1,137 +0,0 @@
---TEST--
-Test fgetss() function : Basic functionality - read modes only
---FILE--
-<?php
-error_reporting(E_ALL & ~E_DEPRECATED);
-
-/*
- Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] );
- Description: Gets line from file pointer and strip HTML tags
-*/
-
-/* test fgetss with all read modes */
-
-// include the common file related test functions
-include ("file.inc");
-
-echo "*** Testing fgetss() : Basic operations ***\n";
-
-/* string with html and php tags */
-$string_with_tags = <<<EOT
-<test>Testing fgetss() functions</test>
-<?php echo "this string is within php tag"; ?> {;}<{> this
-is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg>
-<html> html </html> <?php echo "php"; ?>
-EOT;
-
-if(substr(PHP_OS, 0, 3) == "WIN") {
- $string_with_tags = str_replace("\r",'', $string_with_tags);
-}
-/* try reading the file opened in different modes of reading */
-$file_modes = array("r","rb", "rt","r+", "r+b", "r+t");
-
-for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
- echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n";
-
- /* create an empty file and write the strings with tags */
- $filename = __DIR__."/fgetss_basic1.tmp";
- create_file ($filename); //create an empty file
- file_put_contents($filename, $string_with_tags);
- $file_handle = fopen($filename, $file_modes[$mode_counter]);
- if(!$file_handle) {
- echo "Error: failed to open file $filename!\n";
- exit();
- }
-
- rewind($file_handle);
- /* read entire file and strip tags */
- echo "-- fgetss() with default length, file pointer at 0 --\n";
- var_dump( fgetss($file_handle) ); // no length and allowable tags provided, reads entire file
- var_dump( ftell($file_handle) );
- var_dump( feof($file_handle) );
-
- rewind($file_handle);
- /* read entire file and strip tags tags */
- echo "-- fgets() with length = 30, file pointer at 0 --\n";
- var_dump( fgetss($file_handle ,30) ); // length parameter given,not reading entire file
- var_dump( ftell($file_handle) ); // checking file pointer position initially
- var_dump( feof($file_handle) ); // confirm file pointer is not at eof
-
- // close the file
- fclose($file_handle);
-
- // delete the file
- delete_file($filename);
-} // end of for - mode_counter
-
-echo "Done\n";
-?>
---EXPECT--
-*** Testing fgetss() : Basic operations ***
-
--- Testing fgetss() with file opened using r mode --
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using rb mode --
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using rt mode --
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using r+ mode --
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using r+b mode --
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using r+t mode --
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-Done
diff --git a/ext/standard/tests/file/fgetss_basic2-win32-mb.phpt b/ext/standard/tests/file/fgetss_basic2-win32-mb.phpt
deleted file mode 100644
index 68fd7059d0..0000000000
--- a/ext/standard/tests/file/fgetss_basic2-win32-mb.phpt
+++ /dev/null
@@ -1,218 +0,0 @@
---TEST--
-Test fgetss() function : Basic functionality - read/write modes
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) != 'WIN') {
- die('skip.. only on Windows');
-}
-?>
---FILE--
-<?php
-error_reporting(E_ALL & ~E_DEPRECATED);
-
-/*
- Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] );
- Description: Gets line from file pointer and strip HTML tags
-*/
-
-/* try fgetss on files which are opened in read/write modes
- w+, w+b, w+t,
- a+, a+b, a+t,
- x+, x+b, x+t
-*/
-
-
-echo "*** Testing fgetss() : basic operations ***\n";
-
-/* string with html and php tags */
-$string_with_tags = <<<EOT
-<test>Testing fgetss() functions</test>
-<?php echo "this string is within php tag"; ?> {;}<{> this
-is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg>
-<html> html </html> <?php echo "php"; ?>
-EOT;
-if(substr(PHP_OS, 0, 3) == "WIN") {
- $string_with_tags = str_replace("\r",'', $string_with_tags);
-}
-$filename = __DIR__."/fgetss_basic2ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.tmp";
-
-/* try reading the file opened in different modes of reading */
-$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t");
-
-for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
- echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n";
-
- /* create an empty file and write the strings with tags */
- $file_handle = fopen($filename, $file_modes[$mode_counter]);
- fwrite($file_handle,$string_with_tags); //writing data to the file
- if(!$file_handle) {
- echo "Error: failed to open file $filename!\n";
- exit();
- }
-
- // rewind the file pointer to beginning of the file
- var_dump( filesize($filename) );
- var_dump( rewind($file_handle) );
- var_dump( ftell($file_handle) );
- var_dump( feof($file_handle) );
-
- /* read entire file and strip tags */
- echo "-- fgetss() with default length, file pointer at 0 --\n";
- var_dump( fgetss($file_handle) ); // no length and allowable tags provided, reads entire file
- var_dump( ftell($file_handle) );
- var_dump( feof($file_handle) );
-
- rewind($file_handle);
- /* read entire file and strip tags tags */
- echo "-- fgets() with length = 30, file pointer at 0 --\n";
- var_dump( fgetss($file_handle ,30) ); // length parameter given,not reading entire file
- var_dump( ftell($file_handle) ); // checking file pointer position initially
- var_dump( feof($file_handle) ); // confirm file pointer is not at eof
-
- // close the file
- fclose($file_handle);
-
- // delete the file
- unlink($filename);
-} // end of for - mode_counter
-
-echo "Done\n";
-?>
---EXPECT--
-*** Testing fgetss() : basic operations ***
-
--- Testing fgetss() with file opened using w+ mode --
-int(192)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using w+b mode --
-int(192)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using w+t mode --
-int(195)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using a+ mode --
-int(192)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using a+b mode --
-int(192)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using a+t mode --
-int(195)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using x+ mode --
-int(192)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using x+b mode --
-int(192)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using x+t mode --
-int(195)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-Done
diff --git a/ext/standard/tests/file/fgetss_basic2-win32.phpt b/ext/standard/tests/file/fgetss_basic2-win32.phpt
deleted file mode 100644
index 9e9ab50788..0000000000
--- a/ext/standard/tests/file/fgetss_basic2-win32.phpt
+++ /dev/null
@@ -1,218 +0,0 @@
---TEST--
-Test fgetss() function : Basic functionality - read/write modes
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) != 'WIN') {
- die('skip.. only on Windows');
-}
-?>
---FILE--
-<?php
-error_reporting(E_ALL & ~E_DEPRECATED);
-
-/*
- Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] );
- Description: Gets line from file pointer and strip HTML tags
-*/
-
-/* try fgetss on files which are opened in read/write modes
- w+, w+b, w+t,
- a+, a+b, a+t,
- x+, x+b, x+t
-*/
-
-
-echo "*** Testing fgetss() : basic operations ***\n";
-
-/* string with html and php tags */
-$string_with_tags = <<<EOT
-<test>Testing fgetss() functions</test>
-<?php echo "this string is within php tag"; ?> {;}<{> this
-is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg>
-<html> html </html> <?php echo "php"; ?>
-EOT;
-if(substr(PHP_OS, 0, 3) == "WIN") {
- $string_with_tags = str_replace("\r",'', $string_with_tags);
-}
-$filename = __DIR__."/fgetss_basic2.tmp";
-
-/* try reading the file opened in different modes of reading */
-$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t");
-
-for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
- echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n";
-
- /* create an empty file and write the strings with tags */
- $file_handle = fopen($filename, $file_modes[$mode_counter]);
- fwrite($file_handle,$string_with_tags); //writing data to the file
- if(!$file_handle) {
- echo "Error: failed to open file $filename!\n";
- exit();
- }
-
- // rewind the file pointer to beginning of the file
- var_dump( filesize($filename) );
- var_dump( rewind($file_handle) );
- var_dump( ftell($file_handle) );
- var_dump( feof($file_handle) );
-
- /* read entire file and strip tags */
- echo "-- fgetss() with default length, file pointer at 0 --\n";
- var_dump( fgetss($file_handle) ); // no length and allowable tags provided, reads entire file
- var_dump( ftell($file_handle) );
- var_dump( feof($file_handle) );
-
- rewind($file_handle);
- /* read entire file and strip tags tags */
- echo "-- fgets() with length = 30, file pointer at 0 --\n";
- var_dump( fgetss($file_handle ,30) ); // length parameter given,not reading entire file
- var_dump( ftell($file_handle) ); // checking file pointer position initially
- var_dump( feof($file_handle) ); // confirm file pointer is not at eof
-
- // close the file
- fclose($file_handle);
-
- // delete the file
- unlink($filename);
-} // end of for - mode_counter
-
-echo "Done\n";
-?>
---EXPECT--
-*** Testing fgetss() : basic operations ***
-
--- Testing fgetss() with file opened using w+ mode --
-int(192)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using w+b mode --
-int(192)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using w+t mode --
-int(195)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using a+ mode --
-int(192)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using a+b mode --
-int(192)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using a+t mode --
-int(195)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using x+ mode --
-int(192)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using x+b mode --
-int(192)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using x+t mode --
-int(195)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-Done
diff --git a/ext/standard/tests/file/fgetss_basic2.phpt b/ext/standard/tests/file/fgetss_basic2.phpt
deleted file mode 100644
index 887a752435..0000000000
--- a/ext/standard/tests/file/fgetss_basic2.phpt
+++ /dev/null
@@ -1,216 +0,0 @@
---TEST--
-Test fgetss() function : Basic functionality - read/write modes
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die('skip.. Not valid for Windows');
-}
-?>
---FILE--
-<?php
-error_reporting(E_ALL & ~E_DEPRECATED);
-
-/*
- Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] );
- Description: Gets line from file pointer and strip HTML tags
-*/
-
-/* try fgetss on files which are opened in read/write modes
- w+, w+b, w+t,
- a+, a+b, a+t,
- x+, x+b, x+t
-*/
-
-
-echo "*** Testing fgetss() : basic operations ***\n";
-
-/* string with html and php tags */
-$string_with_tags = <<<EOT
-<test>Testing fgetss() functions</test>
-<?php echo "this string is within php tag"; ?> {;}<{> this
-is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg>
-<html> html </html> <?php echo "php"; ?>
-EOT;
-
-$filename = __DIR__."/fgetss_basic2.tmp";
-
-/* try reading the file opened in different modes of reading */
-$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t");
-
-for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
- echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n";
-
- /* create an empty file and write the strings with tags */
- $file_handle = fopen($filename, $file_modes[$mode_counter]);
- fwrite($file_handle,$string_with_tags); //writing data to the file
- if(!$file_handle) {
- echo "Error: failed to open file $filename!\n";
- exit();
- }
-
- // rewind the file pointer to beginning of the file
- var_dump( filesize($filename) );
- var_dump( rewind($file_handle) );
- var_dump( ftell($file_handle) );
- var_dump( feof($file_handle) );
-
- /* read entire file and strip tags */
- echo "-- fgetss() with default length, file pointer at 0 --\n";
- var_dump( fgetss($file_handle) ); // no length and allowable tags provided, reads entire file
- var_dump( ftell($file_handle) );
- var_dump( feof($file_handle) );
-
- rewind($file_handle);
- /* read entire file and strip tags tags */
- echo "-- fgets() with length = 30, file pointer at 0 --\n";
- var_dump( fgetss($file_handle ,30) ); // length parameter given,not reading entire file
- var_dump( ftell($file_handle) ); // checking file pointer position initially
- var_dump( feof($file_handle) ); // confirm file pointer is not at eof
-
- // close the file
- fclose($file_handle);
-
- // delete the file
- unlink($filename);
-} // end of for - mode_counter
-
-echo "Done\n";
-?>
---EXPECT--
-*** Testing fgetss() : basic operations ***
-
--- Testing fgetss() with file opened using w+ mode --
-int(192)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using w+b mode --
-int(192)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using w+t mode --
-int(192)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using a+ mode --
-int(192)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using a+b mode --
-int(192)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using a+t mode --
-int(192)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using x+ mode --
-int(192)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using x+b mode --
-int(192)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-
--- Testing fgetss() with file opened using x+t mode --
-int(192)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 --
-string(27) "Testing fgetss() functions
-"
-int(40)
-bool(false)
--- fgets() with length = 30, file pointer at 0 --
-string(23) "Testing fgetss() functi"
-int(29)
-bool(false)
-Done
diff --git a/ext/standard/tests/file/fgetss_error.phpt b/ext/standard/tests/file/fgetss_error.phpt
deleted file mode 100644
index 13a5399406..0000000000
--- a/ext/standard/tests/file/fgetss_error.phpt
+++ /dev/null
@@ -1,108 +0,0 @@
---TEST--
-Test fgetss() function : error conditions
---FILE--
-<?php
-error_reporting(E_ALL & ~E_DEPRECATED);
-
-/*
- Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] );
- Description: Gets line from file pointer and strip HTML tags
-*/
-
-echo "*** Testing error conditions ***\n";
-// zero argument
-echo "-- Testing fgetss() with zero argument --\n";
-var_dump( fgetss() );
-
-// more than expected no. of args
-echo "-- Testing fgetss() with more than expected number of arguments --\n";
-$fp = fopen(__FILE__, "r");
-var_dump( fgetss($fp, 100, '<p><a>', $fp) );
-
-// invalid length argument
-echo "-- Testing fgetss() with invalid length arguments --\n";
-$len = 0;
-$allowable_tags = '<p><a>';
-var_dump( fgetss($fp, $len, $allowable_tags) );
-$len = -10;
-var_dump( fgetss($fp, $len, $allowable_tags) );
-$len = 1;
-var_dump( fgetss($fp, $len, $allowable_tags) ); // return length - 1 always, expect false
-
-// test invalid arguments : non-resources
-echo "-- Testing fgetss() with invalid arguments --\n";
-$invalid_args = array (
- "string",
- 10,
- 10.5,
- true,
- array(1,2,3),
- new stdclass,
-);
-/* loop to test fgetss() with different invalid type of args */
-for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) {
- echo "-- Iteration $loop_counter --\n";
- var_dump( fgetss($invalid_args[$loop_counter - 1], 10, $allowable_tags) );
-}
-// fgetss() on a file handle which is already closed
-echo "-- Testing fgetss() with closed/unset file handle --";
-fclose($fp);
-var_dump(fgetss($fp,10,$allowable_tags));
-
-// fgetss() on a file handle which is unset
-$file_handle = fopen(__FILE__, "r");
-unset($file_handle); //unset file handle
-var_dump( fgetss(@$file_handle,10));
-
-echo "Done\n";
-?>
---EXPECTF--
-*** Testing error conditions ***
--- Testing fgetss() with zero argument --
-
-Warning: fgetss() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
--- Testing fgetss() with more than expected number of arguments --
-
-Warning: fgetss() expects at most 3 parameters, 4 given in %s on line %d
-bool(false)
--- Testing fgetss() with invalid length arguments --
-
-Warning: fgetss(): Length parameter must be greater than 0 in %s on line %d
-bool(false)
-
-Warning: fgetss(): Length parameter must be greater than 0 in %s on line %d
-bool(false)
-bool(false)
--- Testing fgetss() with invalid arguments --
--- Iteration 1 --
-
-Warning: fgetss() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
--- Iteration 2 --
-
-Warning: fgetss() expects parameter 1 to be resource, int given in %s on line %d
-bool(false)
--- Iteration 3 --
-
-Warning: fgetss() expects parameter 1 to be resource, float given in %s on line %d
-bool(false)
--- Iteration 4 --
-
-Warning: fgetss() expects parameter 1 to be resource, bool given in %s on line %d
-bool(false)
--- Iteration 5 --
-
-Warning: fgetss() expects parameter 1 to be resource, array given in %s on line %d
-bool(false)
--- Iteration 6 --
-
-Warning: fgetss() expects parameter 1 to be resource, object given in %s on line %d
-bool(false)
--- Testing fgetss() with closed/unset file handle --
-Warning: fgetss(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: fgetss() expects parameter 1 to be resource, null given in %s on line %d
-bool(false)
-Done
diff --git a/ext/standard/tests/file/fgetss_variation1-win32.phpt b/ext/standard/tests/file/fgetss_variation1-win32.phpt
deleted file mode 100644
index 72e19c293f..0000000000
--- a/ext/standard/tests/file/fgetss_variation1-win32.phpt
+++ /dev/null
@@ -1,192 +0,0 @@
---TEST--
-Test fgetss() function : usage variations - write only modes
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) != 'WIN') {
- die('skip.. only on Windows');
-}
-?>
---FILE--
-<?php
-error_reporting(E_ALL & ~E_DEPRECATED);
-
-/*
- Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] );
- Description: Gets line from file pointer and strip HTML tags
-*/
-
-/* try fgets on files which are opened in non readable modes
- w, wb, wt,
- a, ab, at,
- x, xb, xt
-*/
-
-// include the common file related test functions
-include ("file.inc");
-
-echo "*** Testing fgetss() : usage variations ***\n";
-
-/* string with html and php tags */
-$string_with_tags = <<<EOT
-<test>Testing fgetss() functions</test>
-<?php echo "this string is within php tag"; ?> {;}<{> this
-is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg>
-<html> html </html> <?php echo "php"; ?>
-this line is without any html and php tags
-this is a line with more than eighty character,want to check line splitting correctly after 80 characters
-this text contains some html tags <body> body </body> <br> br </br>
-this is the line with \n character.
-EOT;
-
-if(substr(PHP_OS, 0, 3) == "WIN") {
- $string_with_tags = str_replace("\r",'', $string_with_tags);
-}
-
-$filename = __DIR__."/fgetss_variation1.tmp";
-
-/* try reading the file opened in different modes of reading */
-$file_modes = array("w","wb", "wt","a", "ab", "at","x","xb","xt");
-
-for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
- echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n";
-
- /* create an empty file and write the strings with tags */
- $file_handle = fopen($filename, $file_modes[$mode_counter]);
- fwrite($file_handle,$string_with_tags);
- if(!$file_handle) {
- echo "Error: failed to open file $filename!\n";
- exit();
- }
-
- // rewind the file pointer to beginning of the file
- var_dump( filesize($filename) );
- var_dump( rewind($file_handle) );
- var_dump( ftell($file_handle) );
- var_dump( feof($file_handle) );
-
- /* read entire file and strip tags */
- echo "-- fgetss() with default length, file pointer at 0 , expected : no character should be read --\n";
- var_dump( fgetss($file_handle) ); // expected : no character should be read
- var_dump( ftell($file_handle) ); //ensure that file pointer position is not changed
- var_dump( feof($file_handle) ); // check if end of file pointer is set
-
- // close the file
- fclose($file_handle);
-
- // delete the file
- delete_file($filename);
-} // end of for - mode_counter
-
-echo "Done\n";
-?>
---EXPECTF--
-*** Testing fgetss() : usage variations ***
-
--- Testing fgetss() with file opened using w mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 , expected : no character should be read --
-
-Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetss() with file opened using wb mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 , expected : no character should be read --
-
-Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetss() with file opened using wt mode --
-int(453)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 , expected : no character should be read --
-
-Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetss() with file opened using a mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 , expected : no character should be read --
-
-Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetss() with file opened using ab mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 , expected : no character should be read --
-
-Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetss() with file opened using at mode --
-int(453)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 , expected : no character should be read --
-
-Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetss() with file opened using x mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 , expected : no character should be read --
-
-Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetss() with file opened using xb mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 , expected : no character should be read --
-
-Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetss() with file opened using xt mode --
-int(453)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 , expected : no character should be read --
-
-Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-Done
diff --git a/ext/standard/tests/file/fgetss_variation1.phpt b/ext/standard/tests/file/fgetss_variation1.phpt
deleted file mode 100644
index e1a202388c..0000000000
--- a/ext/standard/tests/file/fgetss_variation1.phpt
+++ /dev/null
@@ -1,188 +0,0 @@
---TEST--
-Test fgetss() function : usage variations - write only modes
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die('skip.. Not valid for Windows');
-}
-?>
---FILE--
-<?php
-error_reporting(E_ALL & ~E_DEPRECATED);
-
-/*
- Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] );
- Description: Gets line from file pointer and strip HTML tags
-*/
-
-/* try fgets on files which are opened in non readable modes
- w, wb, wt,
- a, ab, at,
- x, xb, xt
-*/
-
-// include the common file related test functions
-include ("file.inc");
-
-echo "*** Testing fgetss() : usage variations ***\n";
-
-/* string with html and php tags */
-$string_with_tags = <<<EOT
-<test>Testing fgetss() functions</test>
-<?php echo "this string is within php tag"; ?> {;}<{> this
-is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg>
-<html> html </html> <?php echo "php"; ?>
-this line is without any html and php tags
-this is a line with more than eighty character,want to check line splitting correctly after 80 characters
-this text contains some html tags <body> body </body> <br> br </br>
-this is the line with \n character.
-EOT;
-
-$filename = __DIR__."/fgetss_variation1.tmp";
-
-/* try reading the file opened in different modes of reading */
-$file_modes = array("w","wb", "wt","a", "ab", "at","x","xb","xt");
-
-for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
- echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n";
-
- /* create an empty file and write the strings with tags */
- $file_handle = fopen($filename, $file_modes[$mode_counter]);
- fwrite($file_handle,$string_with_tags);
- if(!$file_handle) {
- echo "Error: failed to open file $filename!\n";
- exit();
- }
-
- // rewind the file pointer to beginning of the file
- var_dump( filesize($filename) );
- var_dump( rewind($file_handle) );
- var_dump( ftell($file_handle) );
- var_dump( feof($file_handle) );
-
- /* read entire file and strip tags */
- echo "-- fgetss() with default length, file pointer at 0 , expected : no character should be read --\n";
- var_dump( fgetss($file_handle) ); // expected : no character should be read
- var_dump( ftell($file_handle) ); //ensure that file pointer position is not changed
- var_dump( feof($file_handle) ); // check if end of file pointer is set
-
- // close the file
- fclose($file_handle);
-
- // delete the file
- delete_file($filename);
-} // end of for - mode_counter
-
-echo "Done\n";
-?>
---EXPECTF--
-*** Testing fgetss() : usage variations ***
-
--- Testing fgetss() with file opened using w mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 , expected : no character should be read --
-
-Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetss() with file opened using wb mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 , expected : no character should be read --
-
-Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetss() with file opened using wt mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 , expected : no character should be read --
-
-Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetss() with file opened using a mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 , expected : no character should be read --
-
-Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetss() with file opened using ab mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 , expected : no character should be read --
-
-Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetss() with file opened using at mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 , expected : no character should be read --
-
-Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetss() with file opened using x mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 , expected : no character should be read --
-
-Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetss() with file opened using xb mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 , expected : no character should be read --
-
-Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-
--- Testing fgetss() with file opened using xt mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- fgetss() with default length, file pointer at 0 , expected : no character should be read --
-
-Notice: fgetss(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
-bool(false)
-int(0)
-bool(false)
-Done
diff --git a/ext/standard/tests/file/fgetss_variation2.phpt b/ext/standard/tests/file/fgetss_variation2.phpt
deleted file mode 100644
index 7c581793c2..0000000000
--- a/ext/standard/tests/file/fgetss_variation2.phpt
+++ /dev/null
@@ -1,436 +0,0 @@
---TEST--
-Test fgetss() function : usage variations - read modes
---FILE--
-<?php
-error_reporting(E_ALL & ~E_DEPRECATED);
-
-/*
- Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] );
- Description: Gets line from file pointer and strip HTML tags
-*/
-
-// include the common file related test functions
-include ("file.inc");
-
-/*Test fgetss() with all read modes , reading line by line with allowable tags: <test>, <html>, <?> */
-
-echo "*** Testing fgetss() : usage variations ***\n";
-
-/* string with html and php tags */
-$string_with_tags = <<<EOT
-<test>Testing fgetss() functions</test>
-<?php echo "this string is within php tag"; ?> {;}<{> this
-is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg>
-<html> html </html> <?php echo "php"; ?>
-this line is without any html and php tags
-this is a line with more than eighty character,want to check line splitting correctly after 80 characters
-this is the text containing \r character
-this text contains some html tags <body> body </body> <br> br </br>
-this is the line with \n character.
-EOT;
-
-$filename = __DIR__."/fgetss_variation2.tmp";
-
-/* try reading the file opened in different modes of reading */
-$file_modes = array("r","rb", "rt","r+", "r+b", "r+t");
-
-for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
- echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n";
-
- /* create an empty file and write the strings with tags */
- create_file ($filename); //create an empty file
- file_put_contents($filename, $string_with_tags);
- $file_handle = fopen($filename, $file_modes[$mode_counter]);
- if(!$file_handle) {
- echo "Error: failed to open file $filename!\n";
- exit();
- }
-
- // rewind the file pointer to beginning of the file
- var_dump( filesize($filename) );
- var_dump( rewind($file_handle) );
- var_dump( ftell($file_handle) );
- var_dump( feof($file_handle) );
-
- /* rewind the file and read the file line by line with allowable tags */
- echo "-- Reading line by line with allowable tags: <test>, <html>, <?> --\n";
- rewind($file_handle);
- $line = 1;
- while( !feof($file_handle) ) {
- echo "-- Line $line --\n"; $line++;
- var_dump( fgetss($file_handle, 80, "<test>, <html>, <?>") );
- var_dump( ftell($file_handle) ); // check the file pointer position
- var_dump( feof($file_handle) ); // check if eof reached
- }
-
- // close the file
- fclose($file_handle);
- // delete the file
- delete_file($filename);
-} // end of for - mode_counter
-
-echo "Done\n";
-?>
---EXPECT--
-*** Testing fgetss() : usage variations ***
-
--- Testing fgetss() with file opened using r mode --
-int(486)
-bool(true)
-int(0)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(41) "this is the text containing character
-"
-int(383)
-bool(false)
--- Line 9 --
-string(46) "this text contains some html tags body br
-"
-int(451)
-bool(false)
--- Line 10 --
-string(23) "this is the line with
-"
-int(474)
-bool(false)
--- Line 11 --
-string(12) " character. "
-int(486)
-bool(true)
-
--- Testing fgetss() with file opened using rb mode --
-int(486)
-bool(true)
-int(0)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(41) "this is the text containing character
-"
-int(383)
-bool(false)
--- Line 9 --
-string(46) "this text contains some html tags body br
-"
-int(451)
-bool(false)
--- Line 10 --
-string(23) "this is the line with
-"
-int(474)
-bool(false)
--- Line 11 --
-string(12) " character. "
-int(486)
-bool(true)
-
--- Testing fgetss() with file opened using rt mode --
-int(486)
-bool(true)
-int(0)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(41) "this is the text containing character
-"
-int(383)
-bool(false)
--- Line 9 --
-string(46) "this text contains some html tags body br
-"
-int(451)
-bool(false)
--- Line 10 --
-string(23) "this is the line with
-"
-int(474)
-bool(false)
--- Line 11 --
-string(12) " character. "
-int(486)
-bool(true)
-
--- Testing fgetss() with file opened using r+ mode --
-int(486)
-bool(true)
-int(0)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(41) "this is the text containing character
-"
-int(383)
-bool(false)
--- Line 9 --
-string(46) "this text contains some html tags body br
-"
-int(451)
-bool(false)
--- Line 10 --
-string(23) "this is the line with
-"
-int(474)
-bool(false)
--- Line 11 --
-string(12) " character. "
-int(486)
-bool(true)
-
--- Testing fgetss() with file opened using r+b mode --
-int(486)
-bool(true)
-int(0)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(41) "this is the text containing character
-"
-int(383)
-bool(false)
--- Line 9 --
-string(46) "this text contains some html tags body br
-"
-int(451)
-bool(false)
--- Line 10 --
-string(23) "this is the line with
-"
-int(474)
-bool(false)
--- Line 11 --
-string(12) " character. "
-int(486)
-bool(true)
-
--- Testing fgetss() with file opened using r+t mode --
-int(486)
-bool(true)
-int(0)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(41) "this is the text containing character
-"
-int(383)
-bool(false)
--- Line 9 --
-string(46) "this text contains some html tags body br
-"
-int(451)
-bool(false)
--- Line 10 --
-string(23) "this is the line with
-"
-int(474)
-bool(false)
--- Line 11 --
-string(12) " character. "
-int(486)
-bool(true)
-Done
diff --git a/ext/standard/tests/file/fgetss_variation3-win32.phpt b/ext/standard/tests/file/fgetss_variation3-win32.phpt
deleted file mode 100644
index f53d76ce27..0000000000
--- a/ext/standard/tests/file/fgetss_variation3-win32.phpt
+++ /dev/null
@@ -1,573 +0,0 @@
---TEST--
-Test fgetss() function : usage variations - read/write modes
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) != 'WIN') {
- die('skip.. only valid for Windows');
-}
-?>
---FILE--
-<?php
-error_reporting(E_ALL & ~E_DEPRECATED);
-
-/*
- Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] );
- Description: Gets line from file pointer and strip HTML tags
-*/
-
-/* try fgetss on files which are opened in read/write modes
- w+, w+b, w+t,
- a+, a+b, a+t,
- x+, x+b, x+t
- reading line by line with allowable tags: <test>, <html>, <?>
-*/
-
-
-echo "*** Testing fgetss() : usage variations ***\n";
-
-/* string with html and php tags */
-$string_with_tags = <<<EOT
-<test>Testing fgetss() functions</test>
-<?php echo "this string is within php tag"; ?> {;}<{> this
-is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg>
-<html> html </html> <?php echo "php"; ?>
-this line is without any html and php tags
-this is a line with more than eighty character,want to check line splitting correctly after 80 characters
-this text contains some html tags <body> body </body> <br> br </br>
-this is the line with \n character.
-EOT;
-
-if(substr(PHP_OS, 0, 3) == "WIN") {
- $string_with_tags = str_replace("\r",'', $string_with_tags);
-}
-
-$filename = __DIR__."/fgetss_variation3.tmp";
-
-/* try reading the file opened in different modes of reading */
-$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t");
-
-for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
- echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n";
-
- /* create an empty file and write the strings with tags */
- $file_handle = fopen($filename, $file_modes[$mode_counter]);
- fwrite($file_handle,$string_with_tags); //writing data to the file
- if(!$file_handle) {
- echo "Error: failed to open file $filename!\n";
- exit();
- }
-
- // rewind the file pointer to beginning of the file
- rewind($file_handle);
- var_dump( ftell($file_handle) );
- var_dump( filesize($filename) );
- var_dump( feof($file_handle) );
-
- /* rewind the file and read the file line by line with allowable tags */
- echo "-- Reading line by line with allowable tags: <test>, <html>, <?> --\n";
- $line = 1;
- while( !feof($file_handle) ) {
- echo "-- Line $line --\n"; $line++;
- var_dump( fgetss($file_handle, 80, "<test>, <html>, <?>") );
- var_dump( ftell($file_handle) ); // check the file pointer position
- var_dump( feof($file_handle) ); // check if eof reached
- }
-
- // close the file
- fclose($file_handle);
-
- // delete the file
- unlink($filename);
-} // end of for - mode_counter
-
-echo "Done\n";
-?>
---EXPECT--
-*** Testing fgetss() : usage variations ***
-
--- Testing fgetss() with file opened using w+ mode --
-int(0)
-int(445)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(46) "this text contains some html tags body br
-"
-int(410)
-bool(false)
--- Line 9 --
-string(23) "this is the line with
-"
-int(433)
-bool(false)
--- Line 10 --
-string(12) " character. "
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using w+b mode --
-int(0)
-int(445)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(46) "this text contains some html tags body br
-"
-int(410)
-bool(false)
--- Line 9 --
-string(23) "this is the line with
-"
-int(433)
-bool(false)
--- Line 10 --
-string(12) " character. "
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using w+t mode --
-int(0)
-int(453)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(46) "this text contains some html tags body br
-"
-int(410)
-bool(false)
--- Line 9 --
-string(23) "this is the line with
-"
-int(433)
-bool(false)
--- Line 10 --
-string(12) " character. "
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using a+ mode --
-int(0)
-int(445)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(46) "this text contains some html tags body br
-"
-int(410)
-bool(false)
--- Line 9 --
-string(23) "this is the line with
-"
-int(433)
-bool(false)
--- Line 10 --
-string(12) " character. "
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using a+b mode --
-int(0)
-int(445)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(46) "this text contains some html tags body br
-"
-int(410)
-bool(false)
--- Line 9 --
-string(23) "this is the line with
-"
-int(433)
-bool(false)
--- Line 10 --
-string(12) " character. "
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using a+t mode --
-int(0)
-int(453)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(46) "this text contains some html tags body br
-"
-int(410)
-bool(false)
--- Line 9 --
-string(23) "this is the line with
-"
-int(433)
-bool(false)
--- Line 10 --
-string(12) " character. "
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using x+ mode --
-int(0)
-int(445)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(46) "this text contains some html tags body br
-"
-int(410)
-bool(false)
--- Line 9 --
-string(23) "this is the line with
-"
-int(433)
-bool(false)
--- Line 10 --
-string(12) " character. "
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using x+b mode --
-int(0)
-int(445)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(46) "this text contains some html tags body br
-"
-int(410)
-bool(false)
--- Line 9 --
-string(23) "this is the line with
-"
-int(433)
-bool(false)
--- Line 10 --
-string(12) " character. "
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using x+t mode --
-int(0)
-int(453)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(46) "this text contains some html tags body br
-"
-int(410)
-bool(false)
--- Line 9 --
-string(23) "this is the line with
-"
-int(433)
-bool(false)
--- Line 10 --
-string(12) " character. "
-int(445)
-bool(true)
-Done
diff --git a/ext/standard/tests/file/fgetss_variation3.phpt b/ext/standard/tests/file/fgetss_variation3.phpt
deleted file mode 100644
index d4120f7fc9..0000000000
--- a/ext/standard/tests/file/fgetss_variation3.phpt
+++ /dev/null
@@ -1,569 +0,0 @@
---TEST--
-Test fgetss() function : usage variations - read/write modes
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die('skip.. Not valid for Windows');
-}
-?>
---FILE--
-<?php
-error_reporting(E_ALL & ~E_DEPRECATED);
-
-/*
- Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] );
- Description: Gets line from file pointer and strip HTML tags
-*/
-
-/* try fgetss on files which are opened in read/write modes
- w+, w+b, w+t,
- a+, a+b, a+t,
- x+, x+b, x+t
- reading line by line with allowable tags: <test>, <html>, <?>
-*/
-
-
-echo "*** Testing fgetss() : usage variations ***\n";
-
-/* string with html and php tags */
-$string_with_tags = <<<EOT
-<test>Testing fgetss() functions</test>
-<?php echo "this string is within php tag"; ?> {;}<{> this
-is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg>
-<html> html </html> <?php echo "php"; ?>
-this line is without any html and php tags
-this is a line with more than eighty character,want to check line splitting correctly after 80 characters
-this text contains some html tags <body> body </body> <br> br </br>
-this is the line with \n character.
-EOT;
-
-$filename = __DIR__."/fgetss_variation3.tmp";
-
-/* try reading the file opened in different modes of reading */
-$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t");
-
-for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
- echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n";
-
- /* create an empty file and write the strings with tags */
- $file_handle = fopen($filename, $file_modes[$mode_counter]);
- fwrite($file_handle,$string_with_tags); //writing data to the file
- if(!$file_handle) {
- echo "Error: failed to open file $filename!\n";
- exit();
- }
-
- // rewind the file pointer to beginning of the file
- rewind($file_handle);
- var_dump( ftell($file_handle) );
- var_dump( filesize($filename) );
- var_dump( feof($file_handle) );
-
- /* rewind the file and read the file line by line with allowable tags */
- echo "-- Reading line by line with allowable tags: <test>, <html>, <?> --\n";
- $line = 1;
- while( !feof($file_handle) ) {
- echo "-- Line $line --\n"; $line++;
- var_dump( fgetss($file_handle, 80, "<test>, <html>, <?>") );
- var_dump( ftell($file_handle) ); // check the file pointer position
- var_dump( feof($file_handle) ); // check if eof reached
- }
-
- // close the file
- fclose($file_handle);
-
- // delete the file
- unlink($filename);
-} // end of for - mode_counter
-
-echo "Done\n";
-?>
---EXPECT--
-*** Testing fgetss() : usage variations ***
-
--- Testing fgetss() with file opened using w+ mode --
-int(0)
-int(445)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(46) "this text contains some html tags body br
-"
-int(410)
-bool(false)
--- Line 9 --
-string(23) "this is the line with
-"
-int(433)
-bool(false)
--- Line 10 --
-string(12) " character. "
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using w+b mode --
-int(0)
-int(445)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(46) "this text contains some html tags body br
-"
-int(410)
-bool(false)
--- Line 9 --
-string(23) "this is the line with
-"
-int(433)
-bool(false)
--- Line 10 --
-string(12) " character. "
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using w+t mode --
-int(0)
-int(445)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(46) "this text contains some html tags body br
-"
-int(410)
-bool(false)
--- Line 9 --
-string(23) "this is the line with
-"
-int(433)
-bool(false)
--- Line 10 --
-string(12) " character. "
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using a+ mode --
-int(0)
-int(445)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(46) "this text contains some html tags body br
-"
-int(410)
-bool(false)
--- Line 9 --
-string(23) "this is the line with
-"
-int(433)
-bool(false)
--- Line 10 --
-string(12) " character. "
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using a+b mode --
-int(0)
-int(445)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(46) "this text contains some html tags body br
-"
-int(410)
-bool(false)
--- Line 9 --
-string(23) "this is the line with
-"
-int(433)
-bool(false)
--- Line 10 --
-string(12) " character. "
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using a+t mode --
-int(0)
-int(445)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(46) "this text contains some html tags body br
-"
-int(410)
-bool(false)
--- Line 9 --
-string(23) "this is the line with
-"
-int(433)
-bool(false)
--- Line 10 --
-string(12) " character. "
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using x+ mode --
-int(0)
-int(445)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(46) "this text contains some html tags body br
-"
-int(410)
-bool(false)
--- Line 9 --
-string(23) "this is the line with
-"
-int(433)
-bool(false)
--- Line 10 --
-string(12) " character. "
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using x+b mode --
-int(0)
-int(445)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(46) "this text contains some html tags body br
-"
-int(410)
-bool(false)
--- Line 9 --
-string(23) "this is the line with
-"
-int(433)
-bool(false)
--- Line 10 --
-string(12) " character. "
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using x+t mode --
-int(0)
-int(445)
-bool(false)
--- Reading line by line with allowable tags: <test>, <html>, <?> --
--- Line 1 --
-string(40) "<test>Testing fgetss() functions</test>
-"
-int(40)
-bool(false)
--- Line 2 --
-string(10) " {;} this
-"
-int(99)
-bool(false)
--- Line 3 --
-string(44) "is a heredoc string. ksklnm@@$$&$&^%&^%&^%&
-"
-int(152)
-bool(false)
--- Line 4 --
-string(21) "<html> html </html>
-"
-int(193)
-bool(false)
--- Line 5 --
-string(43) "this line is without any html and php tags
-"
-int(236)
-bool(false)
--- Line 6 --
-string(79) "this is a line with more than eighty character,want to check line splitting cor"
-int(315)
-bool(false)
--- Line 7 --
-string(27) "rectly after 80 characters
-"
-int(342)
-bool(false)
--- Line 8 --
-string(46) "this text contains some html tags body br
-"
-int(410)
-bool(false)
--- Line 9 --
-string(23) "this is the line with
-"
-int(433)
-bool(false)
--- Line 10 --
-string(12) " character. "
-int(445)
-bool(true)
-Done
diff --git a/ext/standard/tests/file/fgetss_variation4.phpt b/ext/standard/tests/file/fgetss_variation4.phpt
deleted file mode 100644
index 585f277e72..0000000000
--- a/ext/standard/tests/file/fgetss_variation4.phpt
+++ /dev/null
@@ -1,170 +0,0 @@
---TEST--
-Test fgetss() function : usage variations - read modes, file pointer at EOF
---SKIPIF--
-<?php
-if(substr(PHP_OS, 0, 3) == "WIN")
- die("skip not for Windows");
-?>
---FILE--
-<?php
-error_reporting(E_ALL & ~E_DEPRECATED);
-
-/*
- Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] );
- Description: Gets line from file pointer and strip HTML tags
-*/
-
-// include the common file related test functions
-include ("file.inc");
-
-echo "*** Testing fgetss() : usage variations ***\n";
-
-/* string with html and php tags */
-$string_with_tags = <<<EOT
-<test>Testing fgetss() functions</test>
-<?php echo "this string is within php tag"; ?> {;}<{> this
-is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg>
-<html> html </html> <?php echo "php"; ?>
-this line is without any html and php tags
-this is a line with more than eighty character,want to check line splitting correctly after 80 characters
-this is the text containing \r character
-this text contains some html tags <body> body </body> <br> br </br>
-this is the line with \n character.
-EOT;
-
-$filename = __DIR__."/fgetss_variation4.tmp";
-
-/* try reading the file opened in different modes of reading */
-$file_modes = array("r","rb", "rt","r+", "r+b", "r+t");
-
-for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
- echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n";
-
- /* create an empty file and write the strings with tags */
- create_file ($filename); //create an empty file
- file_put_contents($filename, $string_with_tags);
- $file_handle = fopen($filename, $file_modes[$mode_counter]);
- if(!$file_handle) {
- echo "Error: failed to open file $filename!\n";
- exit();
- }
-
- // rewind the file pointer to beginning of the file
- var_dump( filesize($filename) );
- var_dump( rewind($file_handle) );
- var_dump( ftell($file_handle) );
- var_dump( feof($file_handle) );
-
- echo "-- Reading when file pointer points to EOF --\n";
- var_dump( fseek($file_handle,0,SEEK_END) ); // now file pointer at end
- var_dump( ftell($file_handle) ); //ensure file pointer at end
- var_dump( fgetss($file_handle) ); // try to read
- var_dump( ftell($file_handle) ); // find out file position
- var_dump( feof($file_handle) ); // ensure that file pointer is at eof
-
- // now file is at the end try reading with length and allowable tags,expecting false
- var_dump( fgetss($file_handle, 80, "<test>, <html>, <?>") );
- var_dump( ftell($file_handle) ); // find out file position
- var_dump( feof($file_handle) ); // ensure that file pointer is at eof
-
- // close the file
- fclose($file_handle);
- // delete the file
- delete_file($filename);
-} // end of for - mode_counter
-
-echo "Done\n";
-?>
---EXPECT--
-*** Testing fgetss() : usage variations ***
-
--- Testing fgetss() with file opened using r mode --
-int(486)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(486)
-bool(false)
-int(486)
-bool(true)
-bool(false)
-int(486)
-bool(true)
-
--- Testing fgetss() with file opened using rb mode --
-int(486)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(486)
-bool(false)
-int(486)
-bool(true)
-bool(false)
-int(486)
-bool(true)
-
--- Testing fgetss() with file opened using rt mode --
-int(486)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(486)
-bool(false)
-int(486)
-bool(true)
-bool(false)
-int(486)
-bool(true)
-
--- Testing fgetss() with file opened using r+ mode --
-int(486)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(486)
-bool(false)
-int(486)
-bool(true)
-bool(false)
-int(486)
-bool(true)
-
--- Testing fgetss() with file opened using r+b mode --
-int(486)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(486)
-bool(false)
-int(486)
-bool(true)
-bool(false)
-int(486)
-bool(true)
-
--- Testing fgetss() with file opened using r+t mode --
-int(486)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(486)
-bool(false)
-int(486)
-bool(true)
-bool(false)
-int(486)
-bool(true)
-Done
diff --git a/ext/standard/tests/file/fgetss_variation5-win32.phpt b/ext/standard/tests/file/fgetss_variation5-win32.phpt
deleted file mode 100644
index 035186fd09..0000000000
--- a/ext/standard/tests/file/fgetss_variation5-win32.phpt
+++ /dev/null
@@ -1,222 +0,0 @@
---TEST--
-Test fgetss() function : usage variations - read/write modes, file pointer at EOF
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) != 'WIN') {
- die('skip.. only valid for Windows');
-}
-?>
---FILE--
-<?php
-error_reporting(E_ALL & ~E_DEPRECATED);
-
-/*
- Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] );
- Description: Gets line from file pointer and strip HTML tags
-*/
-
-/* try fgetss on files which are opened in read/write modes
- w+, w+b, w+t,
- a+, a+b, a+t,
- x+, x+b, x+t
-*/
-
-
-echo "*** Testing fgetss() : usage variations ***\n";
-
-/* string with html and php tags */
-$string_with_tags = <<<EOT
-<test>Testing fgetss() functions</test>
-<?php echo "this string is within php tag"; ?> {;}<{> this
-is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg>
-<html> html </html> <?php echo "php"; ?>
-this line is without any html and php tags
-this is a line with more than eighty character,want to check line splitting correctly after 80 characters
-this text contains some html tags <body> body </body> <br> br </br>
-this is the line with \n character.
-EOT;
-if(substr(PHP_OS, 0, 3) == "WIN") {
- $string_with_tags = str_replace("\r",'', $string_with_tags);
-}
-
-$filename = __DIR__."/fgetss_variation5.tmp";
-
-/* try reading the file opened in different modes of reading */
-$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t");
-
-for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
- echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n";
-
- /* create an empty file and write the strings with tags */
- $file_handle = fopen($filename, $file_modes[$mode_counter]);
- fwrite($file_handle,$string_with_tags); //writing data to the file
- if(!$file_handle) {
- echo "Error: failed to open file $filename!\n";
- exit();
- }
- // rewind the file pointer to beginning of the file
- var_dump( filesize($filename) );
- var_dump( rewind($file_handle) );
- var_dump( ftell($file_handle) );
- var_dump( feof($file_handle) );
-
- echo "-- Reading when file pointer points to EOF --\n";
- var_dump( fseek($file_handle,0,SEEK_END) ); // now file pointer at end
- var_dump( ftell($file_handle) ); //ensure file pointer at end
- var_dump( fgetss($file_handle) ); // try to read
- var_dump( ftell($file_handle) ); // find out file position
- var_dump( feof($file_handle) ); // ensure that file pointer is at eof
-
- // now file is at the end try reading with length and allowable tags,expecting false
- var_dump( fgetss($file_handle, 80, "<test>, <html>, <?>") );
- var_dump( ftell($file_handle) ); // find out file position
- var_dump( feof($file_handle) ); // ensure that file pointer is at eof
-
-
- // close the file
- fclose($file_handle);
-
- // delete the file
- unlink($filename);
-} // end of for - mode_counter
-
-echo "Done\n";
-?>
---EXPECT--
-*** Testing fgetss() : usage variations ***
-
--- Testing fgetss() with file opened using w+ mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(445)
-bool(false)
-int(445)
-bool(true)
-bool(false)
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using w+b mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(445)
-bool(false)
-int(445)
-bool(true)
-bool(false)
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using w+t mode --
-int(453)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(453)
-bool(false)
-int(453)
-bool(true)
-bool(false)
-int(453)
-bool(true)
-
--- Testing fgetss() with file opened using a+ mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(445)
-bool(false)
-int(445)
-bool(true)
-bool(false)
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using a+b mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(445)
-bool(false)
-int(445)
-bool(true)
-bool(false)
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using a+t mode --
-int(453)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(453)
-bool(false)
-int(453)
-bool(true)
-bool(false)
-int(453)
-bool(true)
-
--- Testing fgetss() with file opened using x+ mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(445)
-bool(false)
-int(445)
-bool(true)
-bool(false)
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using x+b mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(445)
-bool(false)
-int(445)
-bool(true)
-bool(false)
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using x+t mode --
-int(453)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(453)
-bool(false)
-int(453)
-bool(true)
-bool(false)
-int(453)
-bool(true)
-Done
diff --git a/ext/standard/tests/file/fgetss_variation5.phpt b/ext/standard/tests/file/fgetss_variation5.phpt
deleted file mode 100644
index 928fdeadf5..0000000000
--- a/ext/standard/tests/file/fgetss_variation5.phpt
+++ /dev/null
@@ -1,219 +0,0 @@
---TEST--
-Test fgetss() function : usage variations - read/write modes, file pointer at EOF
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die('skip.. Not valid for Windows');
-}
-?>
---FILE--
-<?php
-error_reporting(E_ALL & ~E_DEPRECATED);
-
-/*
- Prototype: string fgetss ( resource $handle [, int $length [, string $allowable_tags]] );
- Description: Gets line from file pointer and strip HTML tags
-*/
-
-/* try fgetss on files which are opened in read/write modes
- w+, w+b, w+t,
- a+, a+b, a+t,
- x+, x+b, x+t
-*/
-
-
-echo "*** Testing fgetss() : usage variations ***\n";
-
-/* string with html and php tags */
-$string_with_tags = <<<EOT
-<test>Testing fgetss() functions</test>
-<?php echo "this string is within php tag"; ?> {;}<{> this
-is a heredoc string. <pg>ksklnm@@$$&$&^%&^%&^%&</pg>
-<html> html </html> <?php echo "php"; ?>
-this line is without any html and php tags
-this is a line with more than eighty character,want to check line splitting correctly after 80 characters
-this text contains some html tags <body> body </body> <br> br </br>
-this is the line with \n character.
-EOT;
-
-$filename = __DIR__."/fgetss_variation5.tmp";
-
-/* try reading the file opened in different modes of reading */
-$file_modes = array("w+","w+b", "w+t","a+", "a+b", "a+t","x+","x+b","x+t");
-
-for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
- echo "\n-- Testing fgetss() with file opened using $file_modes[$mode_counter] mode --\n";
-
- /* create an empty file and write the strings with tags */
- $file_handle = fopen($filename, $file_modes[$mode_counter]);
- fwrite($file_handle,$string_with_tags); //writing data to the file
- if(!$file_handle) {
- echo "Error: failed to open file $filename!\n";
- exit();
- }
- // rewind the file pointer to beginning of the file
- var_dump( filesize($filename) );
- var_dump( rewind($file_handle) );
- var_dump( ftell($file_handle) );
- var_dump( feof($file_handle) );
-
- echo "-- Reading when file pointer points to EOF --\n";
- var_dump( fseek($file_handle,0,SEEK_END) ); // now file pointer at end
- var_dump( ftell($file_handle) ); //ensure file pointer at end
- var_dump( fgetss($file_handle) ); // try to read
- var_dump( ftell($file_handle) ); // find out file position
- var_dump( feof($file_handle) ); // ensure that file pointer is at eof
-
- // now file is at the end try reading with length and allowable tags,expecting false
- var_dump( fgetss($file_handle, 80, "<test>, <html>, <?>") );
- var_dump( ftell($file_handle) ); // find out file position
- var_dump( feof($file_handle) ); // ensure that file pointer is at eof
-
-
- // close the file
- fclose($file_handle);
-
- // delete the file
- unlink($filename);
-} // end of for - mode_counter
-
-echo "Done\n";
-?>
---EXPECT--
-*** Testing fgetss() : usage variations ***
-
--- Testing fgetss() with file opened using w+ mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(445)
-bool(false)
-int(445)
-bool(true)
-bool(false)
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using w+b mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(445)
-bool(false)
-int(445)
-bool(true)
-bool(false)
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using w+t mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(445)
-bool(false)
-int(445)
-bool(true)
-bool(false)
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using a+ mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(445)
-bool(false)
-int(445)
-bool(true)
-bool(false)
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using a+b mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(445)
-bool(false)
-int(445)
-bool(true)
-bool(false)
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using a+t mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(445)
-bool(false)
-int(445)
-bool(true)
-bool(false)
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using x+ mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(445)
-bool(false)
-int(445)
-bool(true)
-bool(false)
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using x+b mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(445)
-bool(false)
-int(445)
-bool(true)
-bool(false)
-int(445)
-bool(true)
-
--- Testing fgetss() with file opened using x+t mode --
-int(445)
-bool(true)
-int(0)
-bool(false)
--- Reading when file pointer points to EOF --
-int(0)
-int(445)
-bool(false)
-int(445)
-bool(true)
-bool(false)
-int(445)
-bool(true)
-Done
diff --git a/ext/standard/tests/file/file.inc b/ext/standard/tests/file/file.inc
index eda2b32c78..08825f4502 100644
--- a/ext/standard/tests/file/file.inc
+++ b/ext/standard/tests/file/file.inc
@@ -202,7 +202,7 @@ function change_file_perms($file_path,
permissions. File is filled with content of size specified.
$file_path = dir where files will be created
$name_prefix = prefix to be used for names, name is suffix with a
- unqiue numeric value to make the file name unique, default = file
+ unique numeric value to make the file name unique, default = file
$name_suffix = suffix to be used for the name, default = 1
$count = total no. of files to be created, default = 1
$mode = file open mode as specified in fopen() call. Do not use
@@ -215,7 +215,7 @@ function change_file_perms($file_path,
"empty" = empty file
"text_with_new_line" = similar to text fill type, but writes with new line char
"alphanumeric" = fill file with alpha numeric text
- If imporper $content type is specified, file is created as empty
+ If improper $content type is specified, file is created as empty
$size = size of the fill in terms of kilobyte, i.e size of the file.
if $flag is specified as "byte", then then given size is taken in bytes
$flag = specify if size has to be treated as no of total bytes or
@@ -309,7 +309,7 @@ function create_files( $file_path,
/*
Function: function create_links( $file_path,
- $filename,
+ $filename,
$link_count = 1,
$link_type = "soft",
$link_size = 1024,
diff --git a/ext/standard/tests/file/file_error.phpt b/ext/standard/tests/file/file_error.phpt
index d932966ee5..f0e0c32ada 100644
--- a/ext/standard/tests/file/file_error.phpt
+++ b/ext/standard/tests/file/file_error.phpt
@@ -8,14 +8,10 @@ Test file() function : error conditions
Returns the file in an array
*/
$file_path = __DIR__;
-echo "\n*** Testing error conditions ***";
+echo "\n*** Testing error conditions ***\n";
$file_handle = fopen($file_path."/file.tmp", "w");
-var_dump( file() ); // Zero No. of args
$filename = $file_path."/file.tmp";
-var_dump( file($filename, $filename, $filename, $filename) ); // more than expected number of arguments
-
-var_dump( file($filename, "INCORRECT_FLAG", NULL) ); // Incorrect flag
var_dump( file($filename, 10, NULL) ); // Incorrect flag
var_dump( file("temp.tmp") ); // non existing filename
@@ -30,18 +26,10 @@ unlink($file_path."/file.tmp");
?>
--EXPECTF--
*** Testing error conditions ***
-Warning: file() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: file() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-
-Warning: file() expects parameter 2 to be int, string given in %s on line %d
-NULL
array(0) {
}
-Warning: file(temp.tmp): failed to open stream: No such file or directory in %s on line %d
+Warning: file(temp.tmp): Failed to open stream: No such file or directory in %s on line %d
bool(false)
--- Done ---
diff --git a/ext/standard/tests/file/file_get_contents_basic001.phpt b/ext/standard/tests/file/file_get_contents_basic001.phpt
index 86569d7917..d54bf2bcb4 100644
--- a/ext/standard/tests/file/file_get_contents_basic001.phpt
+++ b/ext/standard/tests/file/file_get_contents_basic001.phpt
@@ -4,13 +4,13 @@ file_get_contents() test using basic syntax
"Blanche V.N." <valerie_nare@yahoo.fr>
--FILE--
<?php
- $file_content = "Bienvenue au CodeFest a Montreal";
- $temp_filename = __DIR__."/fichier_a_lire.txt";
- $handle = fopen($temp_filename,"w");
- fwrite($handle,$file_content);
- fclose($handle);
- $var = file_get_contents($temp_filename);
- echo $var;
+ $file_content = "Bienvenue au CodeFest a Montreal";
+ $temp_filename = __DIR__."/fichier_a_lire.txt";
+ $handle = fopen($temp_filename,"w");
+ fwrite($handle,$file_content);
+ fclose($handle);
+ $var = file_get_contents($temp_filename);
+ echo $var;
?>
--CLEAN--
<?php
diff --git a/ext/standard/tests/file/file_get_contents_error.phpt b/ext/standard/tests/file/file_get_contents_error.phpt
index d4c6f16529..47c528ddb5 100644
--- a/ext/standard/tests/file/file_get_contents_error.phpt
+++ b/ext/standard/tests/file/file_get_contents_error.phpt
@@ -17,17 +17,15 @@ include($file_path."/file.inc");
echo "\n-- Testing with Non-existing file --\n";
print( file_get_contents("/no/such/file/or/dir") );
-echo "\n-- Testing No.of arguments less than expected --\n";
-print( file_get_contents() );
-
-echo "\n-- Testing No.of arguments greater than expected --\n";
-
create_files($file_path, 1, "text", 0755, 100, "w", "file", 1, "byte");
$file_handle = fopen($file_path."/file_put_contents_error.tmp", "w");
-print( file_get_contents($file_path."/file1.tmp", false, $file_handle, 1, 2, "extra_argument") );
-echo "\n-- Testing for invalid negative maxlen values --";
-var_dump( file_get_contents($file_path."/file1.tmp", FALSE, $file_handle, 0, -5) );
+echo "\n-- Testing for invalid negative maxlen values --\n";
+try {
+ file_get_contents($file_path."/file1.tmp", FALSE, $file_handle, 0, -5);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
delete_files($file_path, 1);
fclose($file_handle);
@@ -50,18 +48,9 @@ if(file_exists($file_path."/file_put_contents1.tmp")) {
-- Testing with Non-existing file --
-Warning: file_get_contents(/no/such/file/or/dir): failed to open stream: No such file or directory in %s on line %d
-
--- Testing No.of arguments less than expected --
-
-Warning: file_get_contents() expects at least 1 parameter, 0 given in %s on line %d
-
--- Testing No.of arguments greater than expected --
-
-Warning: file_get_contents() expects at most 5 parameters, 6 given in %s on line %d
+Warning: file_get_contents(/no/such/file/or/dir): Failed to open stream: No such file or directory in %s on line %d
-- Testing for invalid negative maxlen values --
-Warning: file_get_contents(): length must be greater than or equal to zero in %s on line %d
-bool(false)
+Length must be greater than or equal to zero
*** Done ***
diff --git a/ext/standard/tests/file/file_get_contents_error001.phpt b/ext/standard/tests/file/file_get_contents_error001.phpt
index 45c376b913..0bbce038e6 100644
--- a/ext/standard/tests/file/file_get_contents_error001.phpt
+++ b/ext/standard/tests/file/file_get_contents_error001.phpt
@@ -11,7 +11,7 @@ display_errors=false
?>
--FILE--
<?php
- var_dump(file_get_contents("php://stdin",null,null,8000,1));
+ var_dump(file_get_contents("php://stdin",null,null,8000,1));
?>
--EXPECT--
bool(false)
diff --git a/ext/standard/tests/file/file_get_contents_error002.phpt b/ext/standard/tests/file/file_get_contents_error002.phpt
index 8ca1162672..4c9faf91ea 100644
--- a/ext/standard/tests/file/file_get_contents_error002.phpt
+++ b/ext/standard/tests/file/file_get_contents_error002.phpt
@@ -7,7 +7,11 @@ file_get_contents() test using negative parameter for length (last parameter)
display_errors=false
--FILE--
<?php
- var_dump(file_get_contents("http://checkip.dyndns.com",null,null,0,-1));
+try {
+ file_get_contents("http://checkip.dyndns.com",null,null,0,-1);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
?>
--EXPECT--
-bool(false)
+Length must be greater than or equal to zero
diff --git a/ext/standard/tests/file/file_get_contents_file_put_contents_error.phpt b/ext/standard/tests/file/file_get_contents_file_put_contents_error.phpt
index f34e6ef418..12c0ee6753 100644
--- a/ext/standard/tests/file/file_get_contents_file_put_contents_error.phpt
+++ b/ext/standard/tests/file/file_get_contents_file_put_contents_error.phpt
@@ -18,19 +18,15 @@ $file_path = __DIR__;
echo "\n-- Testing with Non-existing file --\n";
print( file_get_contents("/no/such/file/or/dir") );
-echo "\n-- Testing No.of arguments less than expected --\n";
-print( file_get_contents() );
-print( file_put_contents() );
-print( file_put_contents($file_path."/".__FILE__) );
-
$file_handle = fopen($file_path."/file_put_contents.tmp", "w");
-echo "\n-- Testing No.of arguments greater than expected --\n";
-print( file_put_contents("abc.tmp", 12345, 1, $file_handle, "extra_argument") );
-print( file_get_contents("abc.tmp", false, $file_handle, 1, 2, "extra_argument") );
-echo "\n-- Testing for invalid negative maxlen values --";
+echo "\n-- Testing for invalid negative maxlen values --\n";
file_put_contents($file_path."/file_put_contents1.tmp", "Garbage data in the file");
-var_dump( file_get_contents($file_path."/file_put_contents1.tmp", FALSE, NULL, 0, -5) );
+try {
+ file_get_contents($file_path."/file_put_contents1.tmp", FALSE, NULL, 0, -5);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
fclose($file_handle);
@@ -48,24 +44,9 @@ unlink($file_path."/file_put_contents1.tmp");
-- Testing with Non-existing file --
-Warning: file_get_contents(/no/such/file/or/dir): failed to open stream: No such file or directory in %s on line %d
-
--- Testing No.of arguments less than expected --
-
-Warning: file_get_contents() expects at least 1 parameter, 0 given in %s on line %d
-
-Warning: file_put_contents() expects at least 2 parameters, 0 given in %s on line %d
-
-Warning: file_put_contents() expects at least 2 parameters, 1 given in %s on line %d
-
--- Testing No.of arguments greater than expected --
-
-Warning: file_put_contents() expects at most 4 parameters, 5 given in %s on line %d
-
-Warning: file_get_contents() expects at most 5 parameters, 6 given in %s on line %d
+Warning: file_get_contents(/no/such/file/or/dir): Failed to open stream: No such file or directory in %s on line %d
-- Testing for invalid negative maxlen values --
-Warning: file_get_contents(): length must be greater than or equal to zero in %s on line %d
-bool(false)
+Length must be greater than or equal to zero
*** Done ***
diff --git a/ext/standard/tests/file/file_get_contents_variation1.phpt b/ext/standard/tests/file/file_get_contents_variation1.phpt
index eb502e0527..36bed7cb10 100644
--- a/ext/standard/tests/file/file_get_contents_variation1.phpt
+++ b/ext/standard/tests/file/file_get_contents_variation1.phpt
@@ -43,8 +43,6 @@ function runtest() {
}
?>
-===DONE===
--EXPECT--
*** Testing file_get_contents() : variation ***
File in include path
-===DONE===
diff --git a/ext/standard/tests/file/file_get_contents_variation2.phpt b/ext/standard/tests/file/file_get_contents_variation2.phpt
index 8c24246aaa..b39c148b89 100644
--- a/ext/standard/tests/file/file_get_contents_variation2.phpt
+++ b/ext/standard/tests/file/file_get_contents_variation2.phpt
@@ -44,8 +44,6 @@ function runtest() {
}
?>
-===DONE===
--EXPECT--
*** Testing file_get_contents() : variation ***
File in script location
-===DONE===
diff --git a/ext/standard/tests/file/file_get_contents_variation7-win32-mb.phpt b/ext/standard/tests/file/file_get_contents_variation7-win32-mb.phpt
index 0f2c58a86d..48711ddf43 100644
--- a/ext/standard/tests/file/file_get_contents_variation7-win32-mb.phpt
+++ b/ext/standard/tests/file/file_get_contents_variation7-win32-mb.phpt
@@ -84,12 +84,12 @@ string(%d) "contents read"
-- Iteration 5 --
-Warning: file_get_contents(%sfileGetContentsVar7ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.dir\fileGetContentsVar7Subç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™\..\\\fileGetContentsVar7Subç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™\\..\\..\fileGetContentsVar7Subç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™\FileGetContentsVar7.tmp): failed to open stream: No such file or directory in %s on line %d
+Warning: file_get_contents(%sfileGetContentsVar7ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.dir\fileGetContentsVar7Subç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™\..\\\fileGetContentsVar7Subç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™\\..\\..\fileGetContentsVar7Subç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™\FileGetContentsVar7.tmp): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-- Iteration 6 --
-Warning: file_get_contents(%sfileGetContentsVar7ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.dir\fileGetContentsVar7Subç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™\BADDIR\FileGetContentsVar7.tmp): failed to open stream: No such file or directory in %s on line %d
+Warning: file_get_contents(%sfileGetContentsVar7ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.dir\fileGetContentsVar7Subç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™\BADDIR\FileGetContentsVar7.tmp): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-- Iteration 7 --
@@ -106,7 +106,7 @@ string(%d) "contents read"
-- Iteration 11 --
-Warning: file_get_contents(BADDIR\FileGetContentsVar7.tmp): failed to open stream: No such file or directory in %s on line %d
+Warning: file_get_contents(BADDIR\FileGetContentsVar7.tmp): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-- Iteration 12 --
diff --git a/ext/standard/tests/file/file_get_contents_variation7-win32.phpt b/ext/standard/tests/file/file_get_contents_variation7-win32.phpt
index 8e9f34520a..d4e877d9ab 100644
--- a/ext/standard/tests/file/file_get_contents_variation7-win32.phpt
+++ b/ext/standard/tests/file/file_get_contents_variation7-win32.phpt
@@ -84,12 +84,12 @@ string(%d) "contents read"
-- Iteration 5 --
-Warning: file_get_contents(%sfileGetContentsVar7.dir\fileGetContentsVar7Sub\..\\\fileGetContentsVar7Sub\\..\\..\fileGetContentsVar7Sub\FileGetContentsVar7.tmp): failed to open stream: No such file or directory in %s on line %d
+Warning: file_get_contents(%sfileGetContentsVar7.dir\fileGetContentsVar7Sub\..\\\fileGetContentsVar7Sub\\..\\..\fileGetContentsVar7Sub\FileGetContentsVar7.tmp): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-- Iteration 6 --
-Warning: file_get_contents(%sfileGetContentsVar7.dir\fileGetContentsVar7Sub\BADDIR\FileGetContentsVar7.tmp): failed to open stream: No such file or directory in %s on line %d
+Warning: file_get_contents(%sfileGetContentsVar7.dir\fileGetContentsVar7Sub\BADDIR\FileGetContentsVar7.tmp): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-- Iteration 7 --
@@ -106,7 +106,7 @@ string(%d) "contents read"
-- Iteration 11 --
-Warning: file_get_contents(BADDIR\FileGetContentsVar7.tmp): failed to open stream: No such file or directory in %s on line %d
+Warning: file_get_contents(BADDIR\FileGetContentsVar7.tmp): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-- Iteration 12 --
diff --git a/ext/standard/tests/file/file_get_contents_variation7.phpt b/ext/standard/tests/file/file_get_contents_variation7.phpt
index e2d317a4a0..627ef8f849 100644
--- a/ext/standard/tests/file/file_get_contents_variation7.phpt
+++ b/ext/standard/tests/file/file_get_contents_variation7.phpt
@@ -76,12 +76,12 @@ string(%d) "contents read"
-- Iteration 5 --
-Warning: file_get_contents(%sfileGetContentsVar7.dir/fileGetContentsVar7Sub/..///fileGetContentsVar7Sub//..//../fileGetContentsVar7Sub/FileGetContentsVar7.tmp): failed to open stream: No such file or directory in %s on line %d
+Warning: file_get_contents(%sfileGetContentsVar7.dir/fileGetContentsVar7Sub/..///fileGetContentsVar7Sub//..//../fileGetContentsVar7Sub/FileGetContentsVar7.tmp): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-- Iteration 6 --
-Warning: file_get_contents(%sfileGetContentsVar7.dir/fileGetContentsVar7Sub/BADDIR/FileGetContentsVar7.tmp): failed to open stream: No such file or directory in %s on line %d
+Warning: file_get_contents(%sfileGetContentsVar7.dir/fileGetContentsVar7Sub/BADDIR/FileGetContentsVar7.tmp): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-- Iteration 7 --
@@ -98,7 +98,7 @@ string(%d) "contents read"
-- Iteration 11 --
-Warning: file_get_contents(BADDIR/FileGetContentsVar7.tmp): failed to open stream: No such file or directory in %s on line %d
+Warning: file_get_contents(BADDIR/FileGetContentsVar7.tmp): Failed to open stream: No such file or directory in %s on line %d
bool(false)
*** Done ***
diff --git a/ext/standard/tests/file/file_get_contents_variation8-win32.phpt b/ext/standard/tests/file/file_get_contents_variation8-win32.phpt
index e8d6238715..1edd46a9cb 100644
--- a/ext/standard/tests/file/file_get_contents_variation8-win32.phpt
+++ b/ext/standard/tests/file/file_get_contents_variation8-win32.phpt
@@ -40,22 +40,25 @@ $names_arr = array(
foreach($names_arr as $key =>$value) {
echo "\n-- Filename: $key --\n";
- var_dump(file_get_contents($value));
+ try {
+ var_dump(file_get_contents($value));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
}
?>
-===Done===
--EXPECTF--
*** Testing file_get_contents() : variation ***
-- Filename: -1 --
-Warning: file_get_contents(-1): failed to open stream: No such file or directory in %s on line %d
+Warning: file_get_contents(-1): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-- Filename: TRUE --
-Warning: file_get_contents(1): failed to open stream: No such file or directory in %s on line %d
+Warning: file_get_contents(1): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-- Filename: FALSE --
@@ -75,26 +78,21 @@ bool(false)
-- Filename: " " --
-Warning: file_get_contents( ): failed to open stream: Permission denied in %s on line %d
+Warning: file_get_contents( ): Failed to open stream: Permission denied in %s on line %d
bool(false)
-- Filename: \0 --
-
-Warning: file_get_contents() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+file_get_contents() expects parameter 1 to be a valid path, string given
-- Filename: array() --
-
-Warning: file_get_contents() expects parameter 1 to be a valid path, array given in %s on line %d
-NULL
+file_get_contents() expects parameter 1 to be a valid path, array given
-- Filename: /no/such/file/dir --
-Warning: file_get_contents(/no/such/file/dir): failed to open stream: No such file or directory in %s on line %d
+Warning: file_get_contents(/no/such/file/dir): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-- Filename: php/php --
-Warning: file_get_contents(php/php): failed to open stream: No such file or directory in %s on line %d
+Warning: file_get_contents(php/php): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-===Done===
diff --git a/ext/standard/tests/file/file_get_contents_variation8.phpt b/ext/standard/tests/file/file_get_contents_variation8.phpt
index 06fd1b3a5f..9277106992 100644
--- a/ext/standard/tests/file/file_get_contents_variation8.phpt
+++ b/ext/standard/tests/file/file_get_contents_variation8.phpt
@@ -39,7 +39,11 @@ $names_arr = array(
for( $i=0; $i<count($names_arr); $i++ ) {
echo "-- Iteration $i --\n";
- var_dump(file_get_contents($names_arr[$i]));
+ try {
+ var_dump(file_get_contents($names_arr[$i]));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
}
echo "\n*** Done ***\n";
@@ -48,11 +52,11 @@ echo "\n*** Done ***\n";
*** Testing file_get_contents() : variation ***
-- Iteration 0 --
-Warning: file_get_contents(-1): failed to open stream: No such file or directory in %s on line %d
+Warning: file_get_contents(-1): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-- Iteration 1 --
-Warning: file_get_contents(1): failed to open stream: No such file or directory in %s on line %d
+Warning: file_get_contents(1): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-- Iteration 2 --
@@ -68,23 +72,19 @@ Warning: file_get_contents(): Filename cannot be empty in %s on line %d
bool(false)
-- Iteration 5 --
-Warning: file_get_contents( ): failed to open stream: No such file or directory in %s on line %d
+Warning: file_get_contents( ): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-- Iteration 6 --
-
-Warning: file_get_contents() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+file_get_contents() expects parameter 1 to be a valid path, string given
-- Iteration 7 --
-
-Warning: file_get_contents() expects parameter 1 to be a valid path, array given in %s on line %d
-NULL
+file_get_contents() expects parameter 1 to be a valid path, array given
-- Iteration 8 --
-Warning: file_get_contents(/no/such/file/dir): failed to open stream: No such file or directory in %s on line %d
+Warning: file_get_contents(/no/such/file/dir): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-- Iteration 9 --
-Warning: file_get_contents(php/php): failed to open stream: No such file or directory in %s on line %d
+Warning: file_get_contents(php/php): Failed to open stream: No such file or directory in %s on line %d
bool(false)
*** Done ***
diff --git a/ext/standard/tests/file/file_put_contents.phpt b/ext/standard/tests/file/file_put_contents.phpt
index be2a6ca0ac..f9dc6d1b8e 100644
--- a/ext/standard/tests/file/file_put_contents.phpt
+++ b/ext/standard/tests/file/file_put_contents.phpt
@@ -11,22 +11,27 @@ $file = __DIR__."/file_put_contents.txt";
$context = stream_context_create();
-var_dump(file_put_contents($file, $context));
+try {
+ var_dump(file_put_contents($file, $context));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump(file_put_contents($file, new stdClass));
var_dump(file_put_contents($file, new foo));
$fp = fopen($file, "r");
-var_dump(file_put_contents($file, "string", 0, $fp));
+try {
+ var_dump(file_put_contents($file, "string", 0, $fp));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
@unlink($file);
echo "Done\n";
?>
---EXPECTF--
-Warning: file_put_contents(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+--EXPECT--
+file_put_contents(): supplied resource is not a valid stream resource
bool(false)
int(15)
-
-Warning: file_put_contents(): supplied resource is not a valid Stream-Context resource in %s on line %d
-int(6)
+file_put_contents(): supplied resource is not a valid Stream-Context resource
Done
diff --git a/ext/standard/tests/file/file_put_contents_variation1.phpt b/ext/standard/tests/file/file_put_contents_variation1.phpt
index b6f8815cd0..8302454d72 100644
--- a/ext/standard/tests/file/file_put_contents_variation1.phpt
+++ b/ext/standard/tests/file/file_put_contents_variation1.phpt
@@ -31,7 +31,6 @@ unlink($filename);
?>
-===DONE===
--EXPECT--
*** Testing file_put_contents() : variation ***
int(25)
@@ -40,4 +39,3 @@ int(18)
The first string to write, followed by this
25
The first string to write
-===DONE===
diff --git a/ext/standard/tests/file/file_put_contents_variation2.phpt b/ext/standard/tests/file/file_put_contents_variation2.phpt
index ae56486d5f..098ed37589 100644
--- a/ext/standard/tests/file/file_put_contents_variation2.phpt
+++ b/ext/standard/tests/file/file_put_contents_variation2.phpt
@@ -13,11 +13,11 @@ Dave Kelsey <d_kelsey@uk.ibm.com>
echo "*** Testing file_put_contents() : usage variation ***\n";
// Define error handler
-function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
- if (error_reporting() != 0) {
- // report non-silenced errors
- echo "Error: $err_no - $err_msg, $filename($linenum)\n";
- }
+function test_error_handler($err_no, $err_msg, $filename, $linenum) {
+ if (error_reporting() & $err_no) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg\n";
+ }
}
set_error_handler('test_error_handler');
@@ -34,9 +34,9 @@ unset ($unset_var);
// define some classes
class classWithToString
{
- public function __toString() {
- return "Class A object";
- }
+ public function __toString() {
+ return "Class A object";
+ }
}
class classWithoutToString
@@ -109,8 +109,7 @@ foreach($inputs as $key =>$value) {
unlink($filename);
?>
-===DONE===
---EXPECTF--
+--EXPECT--
*** Testing file_put_contents() : usage variation ***
--int 0--
@@ -138,8 +137,8 @@ unlink($filename);
--associative array--
12
--nested arrays--
-Error: 8 - Array to string conversion, %s(%d)
-Error: 8 - Array to string conversion, %s(%d)
+Error: 2 - Array to string conversion
+Error: 2 - Array to string conversion
fooArrayArray
--uppercase NULL--
@@ -164,4 +163,3 @@ Class A object
--undefined var--
--unset var--
-===DONE===
diff --git a/ext/standard/tests/file/file_put_contents_variation4.phpt b/ext/standard/tests/file/file_put_contents_variation4.phpt
index c7df0194ff..722ecd4dd1 100644
--- a/ext/standard/tests/file/file_put_contents_variation4.phpt
+++ b/ext/standard/tests/file/file_put_contents_variation4.phpt
@@ -34,7 +34,7 @@ rmdir($thisTestDir);
function runtest() {
global $filename;
- //correct php53 behaviour is to ingnore the FILE_USE_INCLUDE_PATH unless the file alread exists
+ //correct php53 behaviour is to ignore the FILE_USE_INCLUDE_PATH unless the file already exists
// in the include path. In this case it doesn't so the file should be written in the current dir.
file_put_contents($filename, "File in include path", FILE_USE_INCLUDE_PATH);
$line = file_get_contents($filename);
@@ -43,8 +43,6 @@ function runtest() {
}
?>
-===DONE===
--EXPECT--
File in include path
File in include path
-===DONE===
diff --git a/ext/standard/tests/file/file_put_contents_variation5.phpt b/ext/standard/tests/file/file_put_contents_variation5.phpt
index c069c35a7e..d16db38b14 100644
--- a/ext/standard/tests/file/file_put_contents_variation5.phpt
+++ b/ext/standard/tests/file/file_put_contents_variation5.phpt
@@ -41,10 +41,8 @@ function runtest() {
}
}
?>
-===DONE===
--EXPECT--
File written in working directory
File written in working directory
File written in working directory
File written in working directory
-===DONE===
diff --git a/ext/standard/tests/file/file_put_contents_variation6.phpt b/ext/standard/tests/file/file_put_contents_variation6.phpt
index 85f2aad363..389df4db27 100644
--- a/ext/standard/tests/file/file_put_contents_variation6.phpt
+++ b/ext/standard/tests/file/file_put_contents_variation6.phpt
@@ -47,9 +47,7 @@ function runtest() {
}
?>
-===DONE===
--EXPECT--
*** Testing file_put_contents() : variation ***
File in include path. This was appended
File in include path. This was appended
-===DONE===
diff --git a/ext/standard/tests/file/file_put_contents_variation7-win32.phpt b/ext/standard/tests/file/file_put_contents_variation7-win32.phpt
index 138b4ede84..6a3d41797a 100644
--- a/ext/standard/tests/file/file_put_contents_variation7-win32.phpt
+++ b/ext/standard/tests/file/file_put_contents_variation7-win32.phpt
@@ -99,12 +99,12 @@ Data written correctly
-- Iteration 5 --
-Warning: file_put_contents(%sfilePutContentsVar7.dir\filePutContentsVar7Sub\..\\\filePutContentsVar7Sub\\..\\..\filePutContentsVar7Sub\FileGetContentsVar7.tmp): failed to open stream: %s in %s on line %d
+Warning: file_put_contents(%sfilePutContentsVar7.dir\filePutContentsVar7Sub\..\\\filePutContentsVar7Sub\\..\\..\filePutContentsVar7Sub\FileGetContentsVar7.tmp): Failed to open stream: %s in %s on line %d
No data written
-- Iteration 6 --
-Warning: file_put_contents(%sfilePutContentsVar7.dir\filePutContentsVar7Sub\BADDIR\FileGetContentsVar7.tmp): failed to open stream: %s in %s on line %d
+Warning: file_put_contents(%sfilePutContentsVar7.dir\filePutContentsVar7Sub\BADDIR\FileGetContentsVar7.tmp): Failed to open stream: %s in %s on line %d
No data written
-- Iteration 7 --
@@ -121,7 +121,7 @@ Data written correctly
-- Iteration 11 --
-Warning: file_put_contents(BADDIR\FileGetContentsVar7.tmp): failed to open stream: %s in %s on line %d
+Warning: file_put_contents(BADDIR\FileGetContentsVar7.tmp): Failed to open stream: %s in %s on line %d
No data written
-- Iteration 12 --
diff --git a/ext/standard/tests/file/file_put_contents_variation7.phpt b/ext/standard/tests/file/file_put_contents_variation7.phpt
index 561c78b374..1c55b1bb58 100644
--- a/ext/standard/tests/file/file_put_contents_variation7.phpt
+++ b/ext/standard/tests/file/file_put_contents_variation7.phpt
@@ -91,12 +91,12 @@ Data written correctly
-- Iteration 5 --
-Warning: file_put_contents(%sfilePutContentsVar7.dir/filePutContentsVar7Sub/..///filePutContentsVar7Sub//..//../filePutContentsVar7Sub/FileGetContentsVar7.tmp): failed to open stream: %s in %s on line %d
+Warning: file_put_contents(%sfilePutContentsVar7.dir/filePutContentsVar7Sub/..///filePutContentsVar7Sub//..//../filePutContentsVar7Sub/FileGetContentsVar7.tmp): Failed to open stream: %s in %s on line %d
No data written
-- Iteration 6 --
-Warning: file_put_contents(%sfilePutContentsVar7.dir/filePutContentsVar7Sub/BADDIR/FileGetContentsVar7.tmp): failed to open stream: %s in %s on line %d
+Warning: file_put_contents(%sfilePutContentsVar7.dir/filePutContentsVar7Sub/BADDIR/FileGetContentsVar7.tmp): Failed to open stream: %s in %s on line %d
No data written
-- Iteration 7 --
@@ -113,7 +113,7 @@ Data written correctly
-- Iteration 11 --
-Warning: file_put_contents(BADDIR/FileGetContentsVar7.tmp): failed to open stream: %s in %s on line %d
+Warning: file_put_contents(BADDIR/FileGetContentsVar7.tmp): Failed to open stream: %s in %s on line %d
No data written
*** Done ***
diff --git a/ext/standard/tests/file/file_put_contents_variation8-win32.phpt b/ext/standard/tests/file/file_put_contents_variation8-win32.phpt
index c21c2da986..71e672e8e9 100644
--- a/ext/standard/tests/file/file_put_contents_variation8-win32.phpt
+++ b/ext/standard/tests/file/file_put_contents_variation8-win32.phpt
@@ -37,18 +37,21 @@ $names_arr = array(
);
foreach($names_arr as $key =>$value) {
- echo "\n-- Filename: $key --\n";
- $res = file_put_contents($value, "Some data");
- if ($res !== false && $res != null) {
- echo "$res bytes written to: $value\n";
- unlink($value);
- } else {
- echo "Failed to write data to: $key\n";
- }
+ echo "\n-- Filename: $key --\n";
+ try {
+ $res = file_put_contents($value, "Some data");
+ if ($res !== false && $res != null) {
+ echo "$res bytes written to: $value\n";
+ unlink($value);
+ } else {
+ echo "Failed to write data to: $key\n";
+ }
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
?>
-===Done===
--EXPECTF--
*** Testing file_put_contents() : usage variation ***
@@ -75,26 +78,21 @@ Failed to write data to: ""
-- Filename: " " --
-Warning: file_put_contents( ): failed to open stream: Permission denied in %s on line %d
+Warning: file_put_contents( ): Failed to open stream: Permission denied in %s on line %d
Failed to write data to: " "
-- Filename: \0 --
-
-Warning: file_put_contents() expects parameter 1 to be a valid path, string given in %s on line %d
-Failed to write data to: \0
+file_put_contents() expects parameter 1 to be a valid path, string given
-- Filename: array() --
-
-Warning: file_put_contents() expects parameter 1 to be a valid path, array given in %s on line %d
-Failed to write data to: array()
+file_put_contents() expects parameter 1 to be a valid path, array given
-- Filename: /no/such/file/dir --
-Warning: file_put_contents(/no/such/file/dir): failed to open stream: %s in %s on line %d
+Warning: file_put_contents(/no/such/file/dir): Failed to open stream: %s in %s on line %d
Failed to write data to: /no/such/file/dir
-- Filename: php/php --
-Warning: file_put_contents(php/php): failed to open stream: %s in %s on line %d
+Warning: file_put_contents(php/php): Failed to open stream: %s in %s on line %d
Failed to write data to: php/php
-===Done===
diff --git a/ext/standard/tests/file/file_put_contents_variation8.phpt b/ext/standard/tests/file/file_put_contents_variation8.phpt
index 497c68b2bb..7c72ca8516 100644
--- a/ext/standard/tests/file/file_put_contents_variation8.phpt
+++ b/ext/standard/tests/file/file_put_contents_variation8.phpt
Binary files differ
diff --git a/ext/standard/tests/file/file_variation6.phpt b/ext/standard/tests/file/file_variation6.phpt
index 7e34f285d3..e5d8b6d51a 100644
--- a/ext/standard/tests/file/file_variation6.phpt
+++ b/ext/standard/tests/file/file_variation6.phpt
@@ -9,13 +9,17 @@ fwrite($fd, "Line 1\nLine 2\nLine 3");
fclose($fd);
for ($flags = 0; $flags <= 32; $flags++) {
- var_dump(file($filepath, $flags));
+ try {
+ var_dump(file($filepath, $flags));
+ } catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
}
unlink($filepath);
?>
---EXPECTF--
+--EXPECT--
array(3) {
[0]=>
string(7) "Line 1
@@ -232,30 +236,12 @@ array(3) {
[2]=>
string(6) "Line 3"
}
-
-Warning: file(): '24' flag is not supported in %s on line %d
-bool(false)
-
-Warning: file(): '25' flag is not supported in %s on line %d
-bool(false)
-
-Warning: file(): '26' flag is not supported in %s on line %d
-bool(false)
-
-Warning: file(): '27' flag is not supported in %s on line %d
-bool(false)
-
-Warning: file(): '28' flag is not supported in %s on line %d
-bool(false)
-
-Warning: file(): '29' flag is not supported in %s on line %d
-bool(false)
-
-Warning: file(): '30' flag is not supported in %s on line %d
-bool(false)
-
-Warning: file(): '31' flag is not supported in %s on line %d
-bool(false)
-
-Warning: file(): '32' flag is not supported in %s on line %d
-bool(false)
+'24' flag is not supported
+'25' flag is not supported
+'26' flag is not supported
+'27' flag is not supported
+'28' flag is not supported
+'29' flag is not supported
+'30' flag is not supported
+'31' flag is not supported
+'32' flag is not supported \ No newline at end of file
diff --git a/ext/standard/tests/file/file_variation8-win32.phpt b/ext/standard/tests/file/file_variation8-win32.phpt
index b5a2004473..1bd68f5ed5 100644
--- a/ext/standard/tests/file/file_variation8-win32.phpt
+++ b/ext/standard/tests/file/file_variation8-win32.phpt
@@ -96,12 +96,12 @@ array(1) {
-- Iteration 5 --
-Warning: file(%sfileVar8.dir\fileVar8Sub\..\\\fileVar8Sub\\..\\..\fileVar8Sub\FileGetContentsVar7.tmp): failed to open stream: No such file or directory in %s on line %d
+Warning: file(%sfileVar8.dir\fileVar8Sub\..\\\fileVar8Sub\\..\\..\fileVar8Sub\FileGetContentsVar7.tmp): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-- Iteration 6 --
-Warning: file(%sfileVar8.dir\fileVar8Sub\BADDIR\FileGetContentsVar7.tmp): failed to open stream: No such file or directory in %s on line %d
+Warning: file(%sfileVar8.dir\fileVar8Sub\BADDIR\FileGetContentsVar7.tmp): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-- Iteration 7 --
@@ -130,7 +130,7 @@ array(1) {
-- Iteration 11 --
-Warning: file(BADDIR\FileGetContentsVar7.tmp): failed to open stream: No such file or directory in %s on line %d
+Warning: file(BADDIR\FileGetContentsVar7.tmp): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-- Iteration 12 --
diff --git a/ext/standard/tests/file/file_variation8.phpt b/ext/standard/tests/file/file_variation8.phpt
index f56ca9af7d..18908df15d 100644
--- a/ext/standard/tests/file/file_variation8.phpt
+++ b/ext/standard/tests/file/file_variation8.phpt
@@ -88,12 +88,12 @@ array(1) {
-- Iteration 5 --
-Warning: file(%sfileVar8.dir/fileVar8Sub/..///fileVar8Sub//..//../fileVar8Sub/FileGetContentsVar7.tmp): failed to open stream: No such file or directory in %s on line %d
+Warning: file(%sfileVar8.dir/fileVar8Sub/..///fileVar8Sub//..//../fileVar8Sub/FileGetContentsVar7.tmp): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-- Iteration 6 --
-Warning: file(%sfileVar8.dir/fileVar8Sub/BADDIR/FileGetContentsVar7.tmp): failed to open stream: No such file or directory in %s on line %d
+Warning: file(%sfileVar8.dir/fileVar8Sub/BADDIR/FileGetContentsVar7.tmp): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-- Iteration 7 --
@@ -122,7 +122,7 @@ array(1) {
-- Iteration 11 --
-Warning: file(BADDIR/FileGetContentsVar7.tmp): failed to open stream: No such file or directory in %s on line %d
+Warning: file(BADDIR/FileGetContentsVar7.tmp): Failed to open stream: No such file or directory in %s on line %d
bool(false)
*** Done ***
diff --git a/ext/standard/tests/file/file_variation9.phpt b/ext/standard/tests/file/file_variation9.phpt
index 13860878d9..39f58aa788 100644
--- a/ext/standard/tests/file/file_variation9.phpt
+++ b/ext/standard/tests/file/file_variation9.phpt
@@ -27,7 +27,7 @@ foreach ($contents as $content) {
fwrite($h, $content);
fclose($h);
var_dump(file($testfile));
- unlink($testfile);
+ unlink($testfile);
}
echo "\n*** Done ***\n";
diff --git a/ext/standard/tests/file/filegroup_error.phpt b/ext/standard/tests/file/filegroup_error.phpt
index e32711cd5b..e602f3441f 100644
--- a/ext/standard/tests/file/filegroup_error.phpt
+++ b/ext/standard/tests/file/filegroup_error.phpt
@@ -15,10 +15,6 @@ var_dump( filegroup("/no/such/file/dir") );
var_dump( filegroup("string") );
var_dump( filegroup(100) );
-/* Invalid no.of arguments */
-var_dump( filegroup() ); // args < expected
-var_dump( filegroup("/no/such/file", "root") ); // args > expected
-
echo "\n*** Done ***\n";
?>
--EXPECTF--
@@ -33,10 +29,4 @@ bool(false)
Warning: filegroup(): stat failed for 100 in %s on line %d
bool(false)
-Warning: filegroup() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: filegroup() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
*** Done ***
diff --git a/ext/standard/tests/file/filegroup_variation2.phpt b/ext/standard/tests/file/filegroup_variation2.phpt
index 030f97a0f8..6c8b1826c3 100644
--- a/ext/standard/tests/file/filegroup_variation2.phpt
+++ b/ext/standard/tests/file/filegroup_variation2.phpt
@@ -13,7 +13,6 @@ obscure_filename
/* Testing filegroup() with invalid arguments -int, float, bool, NULL, resource */
$file_path = __DIR__;
-$file_handle = fopen($file_path."/filegroup_variation2.tmp", "w");
echo "*** Testing Invalid file types ***\n";
$filenames = array(
@@ -24,7 +23,6 @@ $filenames = array(
TRUE,
FALSE,
NULL,
- $file_handle,
/* scalars */
1234,
@@ -36,7 +34,6 @@ foreach( $filenames as $filename ) {
var_dump( filegroup($filename) );
clearstatcache();
}
-fclose($file_handle);
?>
--CLEAN--
<?php
@@ -58,9 +55,6 @@ bool(false)
bool(false)
bool(false)
-Warning: filegroup() expects parameter 1 to be a valid path, resource given in %s on line %d
-NULL
-
Warning: filegroup(): stat failed for 1234 in %s on line %d
bool(false)
diff --git a/ext/standard/tests/file/filegroup_variation3.phpt b/ext/standard/tests/file/filegroup_variation3.phpt
index a43a54da0d..274f12bb70 100644
--- a/ext/standard/tests/file/filegroup_variation3.phpt
+++ b/ext/standard/tests/file/filegroup_variation3.phpt
@@ -39,7 +39,11 @@ $count = 1;
/* loop through to test each element in the above array */
foreach($files_arr as $file) {
echo "- Iteration $count -\n";
- var_dump( filegroup( $file_path."/".$file ) );
+ try {
+ var_dump( filegroup( $file_path."/".$file ) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
clearstatcache();
$count++;
}
@@ -74,12 +78,8 @@ bool(false)
Warning: filegroup(): stat failed for %s/filegroup_variation3/filegroup*.tmp in %s on line %d
bool(false)
- Iteration 7 -
-
-Warning: filegroup() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+filegroup() expects parameter 1 to be a valid path, string given
- Iteration 8 -
-
-Warning: filegroup() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+filegroup() expects parameter 1 to be a valid path, string given
*** Done ***
diff --git a/ext/standard/tests/file/fileinode_error.phpt b/ext/standard/tests/file/fileinode_error.phpt
index 462ab62367..d080467f04 100644
--- a/ext/standard/tests/file/fileinode_error.phpt
+++ b/ext/standard/tests/file/fileinode_error.phpt
@@ -16,12 +16,6 @@ var_dump( fileinode("/no/such/file/dir") );
var_dump( fileinode("string") );
var_dump( fileinode(100) );
-/* No.of arguments less than expected */
-var_dump( fileinode() );
-
-/* No.of arguments greater than expected */
-var_dump( fileinode(__FILE__, "string") );
-
echo "\n*** Done ***";
--EXPECTF--
*** Testing error conditions of fileinode() ***
@@ -34,10 +28,4 @@ bool(false)
Warning: fileinode(): stat failed for 100 in %s on line 14
bool(false)
-Warning: fileinode() expects exactly 1 parameter, 0 given in %s on line 17
-NULL
-
-Warning: fileinode() expects exactly 1 parameter, 2 given in %s on line 20
-NULL
-
*** Done ***
diff --git a/ext/standard/tests/file/fileinode_variation2.phpt b/ext/standard/tests/file/fileinode_variation2.phpt
index 71cdc395a6..07b76bb62c 100644
--- a/ext/standard/tests/file/fileinode_variation2.phpt
+++ b/ext/standard/tests/file/fileinode_variation2.phpt
@@ -14,7 +14,6 @@ Description: Returns the inode number of the file, or FALSE in case of an error.
/* Testing fileinode() with invalid arguments -int, float, bool, NULL, resource */
$file_path = __DIR__;
-$file_handle = fopen($file_path."/fileinode_variation2.tmp", "w");
echo "*** Testing Invalid file types ***\n";
$filenames = array(
@@ -25,7 +24,6 @@ $filenames = array(
TRUE,
FALSE,
NULL,
- $file_handle,
/* scalars */
1234,
@@ -37,7 +35,6 @@ foreach( $filenames as $filename ) {
var_dump( fileinode($filename) );
clearstatcache();
}
-fclose($file_handle);
?>
--CLEAN--
<?php
@@ -59,9 +56,6 @@ bool(false)
bool(false)
bool(false)
-Warning: fileinode() expects parameter 1 to be a valid path, resource given in %s on line %d
-NULL
-
Warning: fileinode(): stat failed for 1234 in %s on line %d
bool(false)
diff --git a/ext/standard/tests/file/fileinode_variation3.phpt b/ext/standard/tests/file/fileinode_variation3.phpt
index 72dfcbdc55..16f67b0676 100644
--- a/ext/standard/tests/file/fileinode_variation3.phpt
+++ b/ext/standard/tests/file/fileinode_variation3.phpt
@@ -40,7 +40,11 @@ $count = 1;
/* loop through to test each element in the above array */
foreach($files_arr as $file) {
echo "- Iteration $count -\n";
- var_dump( fileinode( $file_path."/".$file ) );
+ try {
+ var_dump( fileinode( $file_path."/".$file ) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
clearstatcache();
$count++;
}
@@ -75,12 +79,8 @@ bool(false)
Warning: fileinode(): stat failed for %s/fileinode_variation3/fileinode*.tmp in %s on line %d
bool(false)
- Iteration 7 -
-
-Warning: fileinode() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+fileinode() expects parameter 1 to be a valid path, string given
- Iteration 8 -
-
-Warning: fileinode() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+fileinode() expects parameter 1 to be a valid path, string given
*** Done ***
diff --git a/ext/standard/tests/file/fileowner_error.phpt b/ext/standard/tests/file/fileowner_error.phpt
index 967a541cc0..807c09f0f0 100644
--- a/ext/standard/tests/file/fileowner_error.phpt
+++ b/ext/standard/tests/file/fileowner_error.phpt
@@ -15,10 +15,6 @@ var_dump( fileowner("/no/such/file/dir") );
var_dump( fileowner("string") );
var_dump( fileowner(100) );
-/* Invalid no.of arguments */
-var_dump( fileowner() ); // args < expected
-var_dump( fileowner("/no/such/file", "root") ); // args > expected
-
echo "\n*** Done ***\n";
?>
--EXPECTF--
@@ -33,10 +29,4 @@ bool(false)
Warning: fileowner(): stat failed for 100 in %s on line %d
bool(false)
-Warning: fileowner() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: fileowner() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
*** Done ***
diff --git a/ext/standard/tests/file/fileowner_variation2.phpt b/ext/standard/tests/file/fileowner_variation2.phpt
index 4be8f58682..8de42cb494 100644
--- a/ext/standard/tests/file/fileowner_variation2.phpt
+++ b/ext/standard/tests/file/fileowner_variation2.phpt
@@ -14,7 +14,6 @@ obscure_filename
/* Testing fileowner() with invalid arguments -int, float, bool, NULL, resource */
$file_path = __DIR__;
-$file_handle = fopen($file_path."/fileowner_variation2.tmp", "w");
echo "*** Testing Invalid file types ***\n";
$filenames = array(
@@ -25,7 +24,6 @@ $filenames = array(
TRUE,
FALSE,
NULL,
- $file_handle,
/* scalars */
1234,
@@ -37,7 +35,6 @@ foreach( $filenames as $filename ) {
var_dump( fileowner($filename) );
clearstatcache();
}
-fclose($file_handle);
?>
--CLEAN--
<?php
@@ -59,9 +56,6 @@ bool(false)
bool(false)
bool(false)
-Warning: fileowner() expects parameter 1 to be a valid path, resource given in %s on line %d
-NULL
-
Warning: fileowner(): stat failed for 1234 in %s on line %d
bool(false)
diff --git a/ext/standard/tests/file/fileowner_variation3.phpt b/ext/standard/tests/file/fileowner_variation3.phpt
index e5d8852776..01d2da2445 100644
--- a/ext/standard/tests/file/fileowner_variation3.phpt
+++ b/ext/standard/tests/file/fileowner_variation3.phpt
@@ -40,7 +40,11 @@ $count = 1;
/* loop through to test each element in the above array */
foreach($files_arr as $file) {
echo "- Iteration $count -\n";
- var_dump( fileowner( $file_path."/".$file ) );
+ try {
+ var_dump( fileowner( $file_path."/".$file ) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
clearstatcache();
$count++;
}
@@ -75,12 +79,8 @@ bool(false)
Warning: fileowner(): stat failed for %s/fileowner_variation3/fileowner*.tmp in %s on line %d
bool(false)
- Iteration 7 -
-
-Warning: fileowner() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+fileowner() expects parameter 1 to be a valid path, string given
- Iteration 8 -
-
-Warning: fileowner() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+fileowner() expects parameter 1 to be a valid path, string given
*** Done ***
diff --git a/ext/standard/tests/file/fileperms_variation2.phpt b/ext/standard/tests/file/fileperms_variation2.phpt
index d45da017cc..4eee45d869 100644
--- a/ext/standard/tests/file/fileperms_variation2.phpt
+++ b/ext/standard/tests/file/fileperms_variation2.phpt
@@ -13,7 +13,6 @@ obscure_filename
/* Testing fileperms() with invalid arguments -int, float, bool, NULL, resource */
$file_path = __DIR__;
-$file_handle = fopen($file_path."/fileperms_variation2.tmp", "w");
echo "*** Testing Invalid file types ***\n";
$filenames = array(
@@ -24,7 +23,6 @@ $filenames = array(
TRUE,
FALSE,
NULL,
- $file_handle,
/* scalars */
1234,
@@ -36,7 +34,6 @@ foreach( $filenames as $filename ) {
var_dump( fileperms($filename) );
clearstatcache();
}
-fclose($file_handle);
?>
--CLEAN--
<?php
@@ -58,9 +55,6 @@ bool(false)
bool(false)
bool(false)
-Warning: fileperms() expects parameter 1 to be a valid path, resource given in %s on line %d
-NULL
-
Warning: fileperms(): stat failed for 1234 in %s on line %d
bool(false)
diff --git a/ext/standard/tests/file/fileperms_variation3.phpt b/ext/standard/tests/file/fileperms_variation3.phpt
index 6a4aacdc6d..1588ee67fe 100644
--- a/ext/standard/tests/file/fileperms_variation3.phpt
+++ b/ext/standard/tests/file/fileperms_variation3.phpt
@@ -39,7 +39,11 @@ $count = 1;
/* loop through to test each element in the above array */
foreach($files_arr as $file) {
echo "- Iteration $count -\n";
- var_dump( fileperms( $file_path."/".$file ) );
+ try {
+ var_dump( fileperms( $file_path."/".$file ) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
clearstatcache();
$count++;
}
@@ -74,12 +78,8 @@ bool(false)
Warning: fileperms(): stat failed for %s/fileperms_variation3/fileperms*.tmp in %s on line %d
bool(false)
- Iteration 7 -
-
-Warning: fileperms() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+fileperms() expects parameter 1 to be a valid path, string given
- Iteration 8 -
-
-Warning: fileperms() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+fileperms() expects parameter 1 to be a valid path, string given
*** Done ***
diff --git a/ext/standard/tests/file/filesize_error.phpt b/ext/standard/tests/file/filesize_error.phpt
index 9f721ff921..5ad8ee99ca 100644
--- a/ext/standard/tests/file/filesize_error.phpt
+++ b/ext/standard/tests/file/filesize_error.phpt
@@ -14,13 +14,6 @@ echo "*** Testing filesize(): error conditions ***";
var_dump( filesize("/no/such/file") );
var_dump( filesize("/no/such/dir") );
-/* No.of arguments less than expected */
-var_dump( filesize() );
-
-/* No.of arguments greater than expected */
-var_dump( filesize(__FILE__, 2000) );
-echo "\n";
-
echo "*** Done ***\n";
?>
--EXPECTF--
@@ -30,11 +23,4 @@ bool(false)
Warning: filesize(): stat failed for /no/such/dir in %s on line %d
bool(false)
-
-Warning: filesize() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: filesize() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
*** Done ***
diff --git a/ext/standard/tests/file/filesize_variation3-win32.phpt b/ext/standard/tests/file/filesize_variation3-win32.phpt
deleted file mode 100644
index 67b97a8009..0000000000
--- a/ext/standard/tests/file/filesize_variation3-win32.phpt
+++ /dev/null
@@ -1,72 +0,0 @@
---TEST--
-Test filesize() function: usage variations - file size after truncate
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) != 'WIN') {
- die('skip only valid for Windows');
-}
---FILE--
-<?php
-/*
- Prototype : int filesize ( string $filename );
- Description : Returns the size of the file in bytes, or FALSE
- (and generates an error of level E_WARNING) in case of an error.
-*/
-
-$file_path = __DIR__;
-
-echo "*** Testing filesize(): usage variations ***\n";
-$filename = $file_path."/filesize_variation3.tmp";
-$file_handle = fopen($filename, "w");
-fwrite($file_handle, str_repeat("Hello,World ", 1000) ); // create file of size 12000 bytes
-fclose($file_handle);
-
-echo "-- Testing filesize() after truncating the file to a new length --\n";
-// truncate the file created earlier in subdir, the size of the file is 12000bytes
-// truncate the same file, in the loop , each time with the decrement in size by 1200 bytes,
-// until -1200bytes size
-for($size = filesize($filename); $size>=-1200; $size-=1200) {
- $file_handle = fopen($filename, "r+");
- var_dump( ftruncate($file_handle, $size) );
- fclose($file_handle);
- var_dump( filesize($filename) );
- clearstatcache();
-}
-
-echo "*** Done ***\n";
-?>
---CLEAN--
-<?php
-$file_path = __DIR__;
-unlink($file_path."/filesize_variation3.tmp");
-?>
---EXPECTF--
-*** Testing filesize(): usage variations ***
--- Testing filesize() after truncating the file to a new length --
-bool(true)
-int(12000)
-bool(true)
-int(10800)
-bool(true)
-int(9600)
-bool(true)
-int(8400)
-bool(true)
-int(7200)
-bool(true)
-int(6000)
-bool(true)
-int(4800)
-bool(true)
-int(3600)
-bool(true)
-int(2400)
-bool(true)
-int(1200)
-bool(true)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-*** Done ***
diff --git a/ext/standard/tests/file/filesize_variation3.phpt b/ext/standard/tests/file/filesize_variation3.phpt
index 09b9c341ca..74790e687c 100644
--- a/ext/standard/tests/file/filesize_variation3.phpt
+++ b/ext/standard/tests/file/filesize_variation3.phpt
@@ -1,10 +1,5 @@
--TEST--
Test filesize() function: usage variations - file size after truncate
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die('skip only valid for Linux');
-}
--FILE--
<?php
/*
@@ -26,21 +21,24 @@ echo "-- Testing filesize() after truncating the file to a new length --\n";
// truncate the same file, in the loop , each time with the decrement in size by 1200 bytes,
// until -1200bytes size
for($size = filesize($filename); $size>=-1200; $size-=1200) {
- $file_handle = fopen($filename, "r+");
- var_dump( ftruncate($file_handle, $size) );
- fclose($file_handle);
- var_dump( filesize($filename) );
- clearstatcache();
+ $file_handle = fopen($filename, "r+");
+ try {
+ var_dump( ftruncate($file_handle, $size) );
+ } catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
+ fclose($file_handle);
+ var_dump( filesize($filename) );
+ clearstatcache();
}
-echo "*** Done ***\n";
?>
--CLEAN--
<?php
$file_path = __DIR__;
unlink($file_path."/filesize_variation3.tmp");
?>
---EXPECTF--
+--EXPECT--
*** Testing filesize(): usage variations ***
-- Testing filesize() after truncating the file to a new length --
bool(true)
@@ -65,8 +63,5 @@ bool(true)
int(1200)
bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
-*** Done ***
diff --git a/ext/standard/tests/file/filesize_variation4-win32.phpt b/ext/standard/tests/file/filesize_variation4-win32.phpt
index 89bb869e31..950f8be1cb 100644
--- a/ext/standard/tests/file/filesize_variation4-win32.phpt
+++ b/ext/standard/tests/file/filesize_variation4-win32.phpt
@@ -60,7 +60,7 @@ clearstatcache();
echo "-- writing data after hole and checking the size --\n";
$file_handle = fopen($filename, "a");
-fwrite($file_handle, "Hello\0"); //wrting 6 bytes of data
+fwrite($file_handle, "Hello\0"); //writing 6 bytes of data
fclose($file_handle);
var_dump( filesize($filename) ); //226 bytes
clearstatcache();
diff --git a/ext/standard/tests/file/filesize_variation4.phpt b/ext/standard/tests/file/filesize_variation4.phpt
index 4abb64dca6..6a76313af3 100644
--- a/ext/standard/tests/file/filesize_variation4.phpt
+++ b/ext/standard/tests/file/filesize_variation4.phpt
@@ -62,7 +62,7 @@ clearstatcache();
echo "-- writing data after hole and checking the size --\n";
$file_handle = fopen($filename, "a");
-fwrite($file_handle, "Hello\0"); //wrting 6 bytes of data
+fwrite($file_handle, "Hello\0"); //writing 6 bytes of data
fclose($file_handle);
var_dump( filesize($filename) ); //226 bytes
clearstatcache();
diff --git a/ext/standard/tests/file/filetype_error.phpt b/ext/standard/tests/file/filetype_error.phpt
index b49a5286c6..a34671d9b0 100644
--- a/ext/standard/tests/file/filetype_error.phpt
+++ b/ext/standard/tests/file/filetype_error.phpt
@@ -16,12 +16,6 @@ print( filetype("/no/such/file/dir") );
print( filetype("string") );
print( filetype(100) );
-/* No.of args less than expected */
-print( filetype() );
-
-/* No.of args greater than expected */
-print( filetype("file", "file") );
-
echo "\n*** Done ***\n";
?>
--EXPECTF--
@@ -32,8 +26,4 @@ Warning: filetype(): Lstat failed for string in %s on line %d
Warning: filetype(): Lstat failed for 100 in %s on line %d
-Warning: filetype() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: filetype() expects exactly 1 parameter, 2 given in %s on line %d
-
*** Done ***
diff --git a/ext/standard/tests/file/filetype_variation2.phpt b/ext/standard/tests/file/filetype_variation2.phpt
index 1c276a2957..1e006441c5 100644
--- a/ext/standard/tests/file/filetype_variation2.phpt
+++ b/ext/standard/tests/file/filetype_variation2.phpt
@@ -22,8 +22,6 @@ Description: Returns the type of the file. Possible values are fifo, char,
echo "-- Checking for char --\n";
print( filetype("/dev/null") )."\n";
?>
-===DONE===
--EXPECT--
-- Checking for char --
char
-===DONE===
diff --git a/ext/standard/tests/file/filetype_variation3.phpt b/ext/standard/tests/file/filetype_variation3.phpt
index eb82a4d149..0abd264621 100644
--- a/ext/standard/tests/file/filetype_variation3.phpt
+++ b/ext/standard/tests/file/filetype_variation3.phpt
@@ -22,8 +22,6 @@ Description: Returns the type of the file. Possible values are fifo, char,
echo "-- Checking for block --\n";
print( filetype("/dev/ram0") )."\n";
?>
-===DONE===
--EXPECT--
-- Checking for block --
block
-===DONE===
diff --git a/ext/standard/tests/file/flock.phpt b/ext/standard/tests/file/flock.phpt
index 43f9112887..ab0cfc6f4e 100644
--- a/ext/standard/tests/file/flock.phpt
+++ b/ext/standard/tests/file/flock.phpt
@@ -5,13 +5,14 @@ flock() tests
$file = __DIR__."/flock.dat";
-var_dump(flock());
-var_dump(flock("", "", $var));
-
$fp = fopen($file, "w");
fclose($fp);
-var_dump(flock($fp, LOCK_SH|LOCK_NB));
+try {
+ var_dump(flock($fp, LOCK_SH|LOCK_NB));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
$fp = fopen($file, "w");
@@ -31,24 +32,21 @@ var_dump(flock($fp, LOCK_UN, $would));
var_dump($would);
var_dump(flock($fp, -1));
-var_dump(flock($fp, 0));
-echo "Done\n";
+try {
+ var_dump(flock($fp, 0));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
?>
--CLEAN--
<?php
$file = __DIR__."/flock.dat";
unlink($file);
?>
---EXPECTF--
-Warning: flock() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: flock() expects parameter 1 to be resource, string given in %s on line %d
-NULL
-
-Warning: flock(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+--EXPECT--
+flock(): supplied resource is not a valid stream resource
bool(true)
bool(true)
bool(true)
@@ -62,7 +60,4 @@ int(0)
bool(true)
int(0)
bool(true)
-
-Warning: flock(): Illegal operation argument in %s on line %d
-bool(false)
-Done
+Illegal operation argument
diff --git a/ext/standard/tests/file/flock_error.phpt b/ext/standard/tests/file/flock_error.phpt
index d6f1b3f59b..ced25b2e71 100644
--- a/ext/standard/tests/file/flock_error.phpt
+++ b/ext/standard/tests/file/flock_error.phpt
@@ -15,7 +15,7 @@ echo "*** Testing error conditions ***\n";
$file = preg_replace("~\.phpt?$~", '.tmp', __FILE__);
$fp = fopen($file, "w");
-/* array of operatons */
+/* array of operations */
$operations = array(
0,
LOCK_NB,
@@ -30,81 +30,48 @@ $operations = array(
$i = 0;
foreach($operations as $operation) {
- echo "\n--- Iteration $i ---";
- var_dump(flock($fp, $operation));
- $i++;
+ echo "--- Iteration $i ---" . \PHP_EOL;
+ try {
+ var_dump(flock($fp, $operation));
+ } catch (\TypeError|\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
+ $i++;
}
/* Invalid arguments */
$fp = fopen($file, "w");
fclose($fp);
-var_dump(flock($fp, LOCK_SH|LOCK_NB));
-
-var_dump(flock("", "", $var));
-
-/* No.of args leass than expected */
-var_dump(flock());
-var_dump(flock($fp));
-
-/* No.of args greater than expected */
-var_dump(flock($fp, "", $var, ""));
+try {
+ var_dump(flock($fp, LOCK_SH|LOCK_NB));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
--CLEAN--
<?php
$file = __DIR__."/flock_error.tmp";
unlink($file);
?>
---EXPECTF--
+--EXPECT--
*** Testing error conditions ***
-
--- Iteration 0 ---
-Warning: flock(): Illegal operation argument in %s on line %d
-bool(false)
-
+Illegal operation argument
--- Iteration 1 ---
-Warning: flock(): Illegal operation argument in %s on line %d
-bool(false)
-
+Illegal operation argument
--- Iteration 2 ---
-Warning: flock(): Illegal operation argument in %s on line %d
-bool(false)
-
+Illegal operation argument
--- Iteration 3 ---
-Warning: flock(): Illegal operation argument in %s on line %d
-bool(false)
-
+Illegal operation argument
--- Iteration 4 ---
-Warning: flock() expects parameter 2 to be int, array given in %s on line %d
-NULL
-
+flock() expects parameter 2 to be int, array given
--- Iteration 5 ---
-Warning: flock() expects parameter 2 to be int, array given in %s on line %d
-NULL
-
+flock() expects parameter 2 to be int, array given
--- Iteration 6 ---
-Warning: flock() expects parameter 2 to be int, string given in %s on line %d
-NULL
-
+flock() expects parameter 2 to be int, string given
--- Iteration 7 ---
-Warning: flock() expects parameter 2 to be int, string given in %s on line %d
-NULL
-
+flock() expects parameter 2 to be int, string given
--- Iteration 8 ---
-Warning: flock() expects parameter 2 to be int, string given in %s on line %d
-NULL
-
-Warning: flock(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: flock() expects parameter 1 to be resource, string given in %s on line %d
-NULL
-
-Warning: flock() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: flock() expects at least 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: flock() expects at most 3 parameters, 4 given in %s on line %d
-NULL
+flock() expects parameter 2 to be int, string given
+flock(): supplied resource is not a valid stream resource
diff --git a/ext/standard/tests/file/flock_variation.phpt b/ext/standard/tests/file/flock_variation.phpt
index 0c66fca7fb..a912fce3c9 100644
--- a/ext/standard/tests/file/flock_variation.phpt
+++ b/ext/standard/tests/file/flock_variation.phpt
@@ -8,13 +8,13 @@ Description: PHP supports a portable way of locking complete files
in an advisory way
*/
-echo "*** Testing flock() fun with the various operation and
- wouldblock values ***\n";
+echo "*** Testing flock() fun with the various operation and
+ wouldblock values ***\n";
$file = preg_replace("~\.phpt?$~", null, __FILE__);
$fp = fopen($file, "w");
-/* array of operatons */
+/* array of operations */
$operations = array(
LOCK_SH,
LOCK_EX,
@@ -66,8 +66,8 @@ fclose($fp);
echo "\n*** Done ***\n";
?>
--EXPECT--
-*** Testing flock() fun with the various operation and
- wouldblock values ***
+*** Testing flock() fun with the various operation and
+ wouldblock values ***
--- Outer iteration 0 ---
bool(true)
-- Inner iteration 0 in 0 --
diff --git a/ext/standard/tests/file/fnmatch_variation.phpt b/ext/standard/tests/file/fnmatch_variation.phpt
index 919e80eec0..4318a844e8 100644
--- a/ext/standard/tests/file/fnmatch_variation.phpt
+++ b/ext/standard/tests/file/fnmatch_variation.phpt
@@ -66,7 +66,11 @@ $pattern_arr = array(
for( $i = 0; $i<count($pattern_arr); $i++ ) {
echo "-- Iteration $i --\n";
- var_dump( fnmatch($pattern_arr[$i], $file_name) );
+ try {
+ var_dump( fnmatch($pattern_arr[$i], $file_name) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
}
unlink($file_name);
@@ -78,7 +82,11 @@ function match( $pattern, $string ) {
for( $i = 0; $i<count($pattern); $i++ ) {
echo "-- Iteration $i --\n";
for( $j = 0; $j<count($string); $j++ ) {
- var_dump( fnmatch($pattern[$i], $string[$j]) );
+ try {
+ var_dump( fnmatch($pattern[$i], $string[$j]) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
}
}
}
@@ -134,7 +142,7 @@ match($null_arr, $null_arr);
echo "\n*** Done ***\n";
?>
---EXPECTF--
+--EXPECT--
*** Testing fnmatch() with file and various patterns ***
-- Iteration 0 --
bool(true)
@@ -183,13 +191,9 @@ bool(false)
-- Iteration 22 --
bool(false)
-- Iteration 23 --
-
-Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+fnmatch() expects parameter 1 to be a valid path, string given
-- Iteration 24 --
-
-Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+fnmatch() expects parameter 1 to be a valid path, string given
-- Iteration 25 --
bool(false)
-- Iteration 26 --
@@ -263,84 +267,44 @@ bool(true)
--- With Strings ---
-- Iteration 0 --
bool(true)
-
-Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d
-NULL
+fnmatch() expects parameter 2 to be a valid path, string given
bool(true)
-
-Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d
-NULL
+fnmatch() expects parameter 2 to be a valid path, string given
bool(false)
bool(true)
-- Iteration 1 --
-
-Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+fnmatch() expects parameter 1 to be a valid path, string given
+fnmatch() expects parameter 1 to be a valid path, string given
+fnmatch() expects parameter 1 to be a valid path, string given
+fnmatch() expects parameter 1 to be a valid path, string given
+fnmatch() expects parameter 1 to be a valid path, string given
+fnmatch() expects parameter 1 to be a valid path, string given
-- Iteration 2 --
bool(true)
-
-Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d
-NULL
+fnmatch() expects parameter 2 to be a valid path, string given
bool(true)
-
-Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d
-NULL
+fnmatch() expects parameter 2 to be a valid path, string given
bool(false)
bool(true)
-- Iteration 3 --
-
-Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+fnmatch() expects parameter 1 to be a valid path, string given
+fnmatch() expects parameter 1 to be a valid path, string given
+fnmatch() expects parameter 1 to be a valid path, string given
+fnmatch() expects parameter 1 to be a valid path, string given
+fnmatch() expects parameter 1 to be a valid path, string given
+fnmatch() expects parameter 1 to be a valid path, string given
-- Iteration 4 --
bool(false)
-
-Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d
-NULL
+fnmatch() expects parameter 2 to be a valid path, string given
bool(false)
-
-Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d
-NULL
+fnmatch() expects parameter 2 to be a valid path, string given
bool(true)
bool(false)
-- Iteration 5 --
bool(true)
-
-Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d
-NULL
+fnmatch() expects parameter 2 to be a valid path, string given
bool(true)
-
-Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d
-NULL
+fnmatch() expects parameter 2 to be a valid path, string given
bool(false)
bool(true)
@@ -441,64 +405,42 @@ bool(true)
bool(true)
bool(true)
bool(true)
-
-Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d
-NULL
+fnmatch() expects parameter 2 to be a valid path, string given
bool(false)
bool(false)
-- Iteration 1 --
bool(true)
bool(true)
bool(true)
-
-Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d
-NULL
+fnmatch() expects parameter 2 to be a valid path, string given
bool(false)
bool(false)
-- Iteration 2 --
bool(true)
bool(true)
bool(true)
-
-Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d
-NULL
+fnmatch() expects parameter 2 to be a valid path, string given
bool(false)
bool(false)
-- Iteration 3 --
-
-Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: fnmatch() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+fnmatch() expects parameter 1 to be a valid path, string given
+fnmatch() expects parameter 1 to be a valid path, string given
+fnmatch() expects parameter 1 to be a valid path, string given
+fnmatch() expects parameter 1 to be a valid path, string given
+fnmatch() expects parameter 1 to be a valid path, string given
+fnmatch() expects parameter 1 to be a valid path, string given
-- Iteration 4 --
bool(false)
bool(false)
bool(false)
-
-Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d
-NULL
+fnmatch() expects parameter 2 to be a valid path, string given
bool(true)
bool(false)
-- Iteration 5 --
bool(false)
bool(false)
bool(false)
-
-Warning: fnmatch() expects parameter 2 to be a valid path, string given in %s on line %d
-NULL
+fnmatch() expects parameter 2 to be a valid path, string given
bool(false)
bool(true)
diff --git a/ext/standard/tests/file/fopen_include_path.inc b/ext/standard/tests/file/fopen_include_path.inc
index e33dae4915..160f9aee5f 100644
--- a/ext/standard/tests/file/fopen_include_path.inc
+++ b/ext/standard/tests/file/fopen_include_path.inc
@@ -11,82 +11,82 @@ $newdirs = array($dir1, $dir2, $dir3);
$reldirs = array("dir1", "dir2", "dir3");
function generate_next_rel_path() {
- global $reldirs;
- //create the include directory structure
- $pathSep = ":";
- $newIncludePath = "";
- if(substr(PHP_OS, 0, 3) == 'WIN' ) {
- $pathSep = ";";
- }
- foreach($reldirs as $newdir) {
- $newIncludePath .= $newdir.$pathSep;
- }
- return "dir4".$pathSep . $newIncludePath;
+ global $reldirs;
+ //create the include directory structure
+ $pathSep = ":";
+ $newIncludePath = "";
+ if(substr(PHP_OS, 0, 3) == 'WIN' ) {
+ $pathSep = ";";
+ }
+ foreach($reldirs as $newdir) {
+ $newIncludePath .= $newdir.$pathSep;
+ }
+ return "dir4".$pathSep . $newIncludePath;
}
function generate_next_path() {
- global $newdirs, $dir4;
- //create the include directory structure
- $pathSep = ":";
- $newIncludePath = "";
- if(substr(PHP_OS, 0, 3) == 'WIN' ) {
- $pathSep = ";";
- }
- foreach($newdirs as $newdir) {
- $newIncludePath .= $newdir.$pathSep;
- }
- return $dir4.$pathSep . $newIncludePath;
+ global $newdirs, $dir4;
+ //create the include directory structure
+ $pathSep = ":";
+ $newIncludePath = "";
+ if(substr(PHP_OS, 0, 3) == 'WIN' ) {
+ $pathSep = ";";
+ }
+ foreach($newdirs as $newdir) {
+ $newIncludePath .= $newdir.$pathSep;
+ }
+ return $dir4.$pathSep . $newIncludePath;
}
function create_include_path() {
- global $newdirs;
- //create the include directory structure
- $pathSep = ":";
- $newIncludePath = "";
- if(substr(PHP_OS, 0, 3) == 'WIN' ) {
- $pathSep = ";";
- }
- foreach($newdirs as $newdir) {
- mkdir($newdir);
- $newIncludePath .= $newdir.$pathSep;
- }
- return $newIncludePath;
+ global $newdirs;
+ //create the include directory structure
+ $pathSep = ":";
+ $newIncludePath = "";
+ if(substr(PHP_OS, 0, 3) == 'WIN' ) {
+ $pathSep = ";";
+ }
+ foreach($newdirs as $newdir) {
+ mkdir($newdir);
+ $newIncludePath .= $newdir.$pathSep;
+ }
+ return $newIncludePath;
}
function relative_include_path() {
- global $reldirs;
- //create the include directory structure
- $pathSep = ":";
- $newIncludePath = "";
- if(substr(PHP_OS, 0, 3) == 'WIN' ) {
- $pathSep = ";";
- }
- foreach($reldirs as $newdir) {
- mkdir($newdir);
- $newIncludePath .= $newdir.$pathSep;
- }
- return $newIncludePath;
+ global $reldirs;
+ //create the include directory structure
+ $pathSep = ":";
+ $newIncludePath = "";
+ if(substr(PHP_OS, 0, 3) == 'WIN' ) {
+ $pathSep = ";";
+ }
+ foreach($reldirs as $newdir) {
+ mkdir($newdir);
+ $newIncludePath .= $newdir.$pathSep;
+ }
+ return $newIncludePath;
}
function teardown_include_path() {
- global $newdirs;
- // remove the directory structure
- foreach($newdirs as $newdir) {
- rmdir($newdir);
- }
+ global $newdirs;
+ // remove the directory structure
+ foreach($newdirs as $newdir) {
+ rmdir($newdir);
+ }
}
function teardown_relative_path() {
- global $reldirs;
- // remove the directory structure
- foreach($reldirs as $newdir) {
- rmdir($newdir);
- }
+ global $reldirs;
+ // remove the directory structure
+ foreach($reldirs as $newdir) {
+ rmdir($newdir);
+ }
}
?>
diff --git a/ext/standard/tests/file/fopen_unlink.phpt b/ext/standard/tests/file/fopen_unlink.phpt
index 117863b63d..8e66ae0608 100644
--- a/ext/standard/tests/file/fopen_unlink.phpt
+++ b/ext/standard/tests/file/fopen_unlink.phpt
@@ -4,21 +4,20 @@ Test fopen() function : check fopen()ed descriptor is usable after the fs object
<?php
var_dump(
- $p = __DIR__ . DIRECTORY_SEPARATOR . 'tututu',
- $f = fopen($p, 'w+'),
- unlink($p),
- file_exists($p),
- fwrite($f, 'hello'),
- fseek($f, 0),
- fread($f, 16),
- fwrite($f, 'world'),
- fseek($f, 0),
- fread($f, 16),
- fclose($f)
+ $p = __DIR__ . DIRECTORY_SEPARATOR . 'tututu',
+ $f = fopen($p, 'w+'),
+ unlink($p),
+ file_exists($p),
+ fwrite($f, 'hello'),
+ fseek($f, 0),
+ fread($f, 16),
+ fwrite($f, 'world'),
+ fseek($f, 0),
+ fread($f, 16),
+ fclose($f)
);
?>
-===DONE===
--EXPECTF--
string(%d) "%stututu"
resource(%s) of type (Unknown)
@@ -31,4 +30,3 @@ int(5)
int(0)
string(10) "helloworld"
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/fopen_variation10-win32.phpt b/ext/standard/tests/file/fopen_variation10-win32.phpt
index 300cf52864..97e2d8a6fb 100644
--- a/ext/standard/tests/file/fopen_variation10-win32.phpt
+++ b/ext/standard/tests/file/fopen_variation10-win32.phpt
@@ -83,7 +83,6 @@ rmdir('c:\\'.$rootdir);
?>
-===DONE===
--EXPECTF--
*** Testing fopen() : variation ***
@@ -95,21 +94,21 @@ file in root
--c--
-Warning: fopen(c\fopen_variation10.tmp): failed to open stream: No such file or directory in %s on line %d
+Warning: fopen(c\fopen_variation10.tmp): Failed to open stream: No such file or directory in %s on line %d
file not opened for read
Warning: fclose() expects parameter 1 to be resource, bool given in %s on line %d
--\--
-Warning: fopen(\\fopen_variation10.tmp): failed to open stream: Invalid argument in %s on line %d
+Warning: fopen(\\fopen_variation10.tmp): Failed to open stream: Invalid argument in %s on line %d
file not opened for read
Warning: fclose() expects parameter 1 to be resource, bool given in %s on line %d
--/--
-Warning: fopen(/\fopen_variation10.tmp): failed to open stream: Invalid argument in %s on line %d
+Warning: fopen(/\fopen_variation10.tmp): Failed to open stream: Invalid argument in %s on line %d
file not opened for read
Warning: fclose() expects parameter 1 to be resource, bool given in %s on line %d
@@ -119,7 +118,7 @@ file in fopen10.tmpdirTwo
--c:adir--
-Warning: fopen(c:adir\fopen_variation10.tmp): failed to open stream: No such file or directory in %s on line %d
+Warning: fopen(c:adir\fopen_variation10.tmp): Failed to open stream: No such file or directory in %s on line %d
file not opened for read
Warning: fclose() expects parameter 1 to be resource, bool given in %s on line %d
@@ -141,8 +140,7 @@ file in fopen10.tmpDir
--/sortout--
-Warning: fopen(/sortout\fopen_variation10.tmp): failed to open stream: No such file or directory in %s on line %d
+Warning: fopen(/sortout\fopen_variation10.tmp): Failed to open stream: No such file or directory in %s on line %d
file not opened for read
Warning: fclose() expects parameter 1 to be resource, bool given in %s on line %d
-===DONE===
diff --git a/ext/standard/tests/file/fopen_variation11-win32.phpt b/ext/standard/tests/file/fopen_variation11-win32.phpt
index ed6508b69a..a1d4c4c4e7 100644
--- a/ext/standard/tests/file/fopen_variation11-win32.phpt
+++ b/ext/standard/tests/file/fopen_variation11-win32.phpt
@@ -81,7 +81,6 @@ rmdir($testdir);
rmdir('c:\\'.$rootdir);
?>
-===DONE===
--EXPECTF--
*** Testing fopen() : variation ***
@@ -93,21 +92,21 @@ file in root
--c--
-Warning: fopen(c\fopen_variation11.tmp): failed to open stream: No such file or directory in %s on line %d
+Warning: fopen(c\fopen_variation11.tmp): Failed to open stream: No such file or directory in %s on line %d
file not opened for read
Warning: fclose() expects parameter 1 to be resource, bool given in %s on line %d
--\--
-Warning: fopen(\\FOPEN_VARIATION11.TMP): failed to open stream: Invalid argument in %s on line %d
+Warning: fopen(\\FOPEN_VARIATION11.TMP): Failed to open stream: Invalid argument in %s on line %d
file not opened for read
Warning: fclose() expects parameter 1 to be resource, bool given in %s on line %d
--/--
-Warning: fopen(\\FOPEN_VARIATION11.TMP): failed to open stream: Invalid argument in %s on line %d
+Warning: fopen(\\FOPEN_VARIATION11.TMP): Failed to open stream: Invalid argument in %s on line %d
file not opened for read
Warning: fclose() expects parameter 1 to be resource, bool given in %s on line %d
@@ -117,7 +116,7 @@ file in fopen11.tmpdirTwo
--c:adir--
-Warning: fopen(c:adir\fopen_variation11.tmp): failed to open stream: No such file or directory in %s on line %d
+Warning: fopen(c:adir\fopen_variation11.tmp): Failed to open stream: No such file or directory in %s on line %d
file not opened for read
Warning: fclose() expects parameter 1 to be resource, bool given in %s on line %d
@@ -139,8 +138,7 @@ file in fopen11.tmpDir
--/sortout--
-Warning: fopen(/sortout\fopen_variation11.tmp): failed to open stream: No such file or directory in %s on line %d
+Warning: fopen(/sortout\fopen_variation11.tmp): Failed to open stream: No such file or directory in %s on line %d
file not opened for read
Warning: fclose() expects parameter 1 to be resource, bool given in %s on line %d
-===DONE===
diff --git a/ext/standard/tests/file/fopen_variation12.phpt b/ext/standard/tests/file/fopen_variation12.phpt
index 2f79be1b63..1ac67df048 100644
--- a/ext/standard/tests/file/fopen_variation12.phpt
+++ b/ext/standard/tests/file/fopen_variation12.phpt
@@ -15,37 +15,35 @@ testme();
function testme() {
- $tmpfile = basename(__FILE__, ".php") . ".tmp";
- $h = fopen($tmpfile, "w", true);
- fwrite($h, "This is the test file");
- fclose($h);
+ $tmpfile = basename(__FILE__, ".php") . ".tmp";
+ $h = fopen($tmpfile, "w", true);
+ fwrite($h, "This is the test file");
+ fclose($h);
- $h = @fopen($tmpfile, "r");
- if ($h === false) {
- echo "Not created in working dir\n";
- }
- else {
- echo "created in working dir\n";
- fclose($h);
- unlink($tmpfile);
- }
+ $h = @fopen($tmpfile, "r");
+ if ($h === false) {
+ echo "Not created in working dir\n";
+ }
+ else {
+ echo "created in working dir\n";
+ fclose($h);
+ unlink($tmpfile);
+ }
- $scriptDirFile = __DIR__.'/'.$tmpfile;
- $h = @fopen($scriptDirFile, "r");
- if ($h === false) {
- echo "Not created in script dir\n";
- }
- else {
- echo "created in script dir\n";
- fclose($h);
- unlink($scriptDirFile);
- }
+ $scriptDirFile = __DIR__.'/'.$tmpfile;
+ $h = @fopen($scriptDirFile, "r");
+ if ($h === false) {
+ echo "Not created in script dir\n";
+ }
+ else {
+ echo "created in script dir\n";
+ fclose($h);
+ unlink($scriptDirFile);
+ }
}
?>
-===DONE===
--EXPECT--
created in working dir
Not created in script dir
-===DONE===
diff --git a/ext/standard/tests/file/fopen_variation13.phpt b/ext/standard/tests/file/fopen_variation13.phpt
index 4d613a9145..0c446485a3 100644
--- a/ext/standard/tests/file/fopen_variation13.phpt
+++ b/ext/standard/tests/file/fopen_variation13.phpt
@@ -25,31 +25,29 @@ teardown_include_path();
function runtest() {
$tempDir = 'fopen_variation13.dir.tmp';
- $tmpfile = 'fopen_variation13.tmp';
- $absFile = getcwd().'/'.$tempDir.'/'.$tmpfile;
-
- mkdir($tempDir);
- $h = fopen($absFile, "w", true);
- fwrite($h, "This is the test file");
- fclose($h);
-
-
- $h = fopen($absFile, "r");
- if ($h === false) {
- echo "Not created absolute location\n";
- }
- else {
- echo "Created in correct location\n";
- fclose($h);
- }
+ $tmpfile = 'fopen_variation13.tmp';
+ $absFile = getcwd().'/'.$tempDir.'/'.$tmpfile;
+
+ mkdir($tempDir);
+ $h = fopen($absFile, "w", true);
+ fwrite($h, "This is the test file");
+ fclose($h);
+
+
+ $h = fopen($absFile, "r");
+ if ($h === false) {
+ echo "Not created absolute location\n";
+ }
+ else {
+ echo "Created in correct location\n";
+ fclose($h);
+ }
unlink($absFile);
rmdir($tempDir);
}
?>
-===DONE===
--EXPECT--
*** Testing fopen() : variation ***
Created in correct location
Created in correct location
-===DONE===
diff --git a/ext/standard/tests/file/fopen_variation14-win32.phpt b/ext/standard/tests/file/fopen_variation14-win32.phpt
index 73c5d68e76..f989e8c420 100644
--- a/ext/standard/tests/file/fopen_variation14-win32.phpt
+++ b/ext/standard/tests/file/fopen_variation14-win32.phpt
@@ -78,69 +78,68 @@ function runtest($fileURIs) {
// create the file to test write
$h = fopen($fileURI, 'w');
if ($h !== false) {
- fwrite($h, $writeData);
- fclose($h);
-
- $h = fopen($absFile, 'r');
- if ($h !== false) {
- if (fread($h, 4096) != $writeData) {
- echo "contents not correct\n";
- }
- else {
- echo "test passed\n";
- }
- fclose($h);
- }
- unlink($absFile);
- }
+ fwrite($h, $writeData);
+ fclose($h);
+
+ $h = fopen($absFile, 'r');
+ if ($h !== false) {
+ if (fread($h, 4096) != $writeData) {
+ echo "contents not correct\n";
+ }
+ else {
+ echo "test passed\n";
+ }
+ fclose($h);
+ }
+ unlink($absFile);
+ }
}
}
?>
-===DONE===
--EXPECTF--
*** Testing fopen() : variation ***
--- READ: file://fopen14.tmpDir\fopen_variation14.tmp ---
-Warning: fopen(): remote host file access not supported, file://fopen14.tmpDir\fopen_variation14.tmp in %s on line %d
+Warning: fopen(): Remote host file access not supported, file://fopen14.tmpDir\fopen_variation14.tmp in %s on line %d
-Warning: fopen(file://fopen14.tmpDir\fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+Warning: fopen(file://fopen14.tmpDir\fopen_variation14.tmp): Failed to open stream: no suitable wrapper could be found in %s on line %d
--- WRITE: file://fopen14.tmpDir\fopen_variation14.tmp ---
-Warning: fopen(): remote host file access not supported, file://fopen14.tmpDir\fopen_variation14.tmp in %s on line %d
+Warning: fopen(): Remote host file access not supported, file://fopen14.tmpDir\fopen_variation14.tmp in %s on line %d
-Warning: fopen(file://fopen14.tmpDir\fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+Warning: fopen(file://fopen14.tmpDir\fopen_variation14.tmp): Failed to open stream: no suitable wrapper could be found in %s on line %d
--- READ: file://fopen14.tmpDir/fopen_variation14.tmp ---
-Warning: fopen(): remote host file access not supported, file://fopen14.tmpDir/fopen_variation14.tmp in %s on line %d
+Warning: fopen(): Remote host file access not supported, file://fopen14.tmpDir/fopen_variation14.tmp in %s on line %d
-Warning: fopen(file://fopen14.tmpDir/fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+Warning: fopen(file://fopen14.tmpDir/fopen_variation14.tmp): Failed to open stream: no suitable wrapper could be found in %s on line %d
--- WRITE: file://fopen14.tmpDir/fopen_variation14.tmp ---
-Warning: fopen(): remote host file access not supported, file://fopen14.tmpDir/fopen_variation14.tmp in %s on line %d
+Warning: fopen(): Remote host file access not supported, file://fopen14.tmpDir/fopen_variation14.tmp in %s on line %d
-Warning: fopen(file://fopen14.tmpDir/fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+Warning: fopen(file://fopen14.tmpDir/fopen_variation14.tmp): Failed to open stream: no suitable wrapper could be found in %s on line %d
--- READ: file://./fopen14.tmpDir/fopen_variation14.tmp ---
-Warning: fopen(): remote host file access not supported, file://./fopen14.tmpDir/fopen_variation14.tmp in %s on line %d
+Warning: fopen(): Remote host file access not supported, file://./fopen14.tmpDir/fopen_variation14.tmp in %s on line %d
-Warning: fopen(file://./fopen14.tmpDir/fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+Warning: fopen(file://./fopen14.tmpDir/fopen_variation14.tmp): Failed to open stream: no suitable wrapper could be found in %s on line %d
--- WRITE: file://./fopen14.tmpDir/fopen_variation14.tmp ---
-Warning: fopen(): remote host file access not supported, file://./fopen14.tmpDir/fopen_variation14.tmp in %s on line %d
+Warning: fopen(): Remote host file access not supported, file://./fopen14.tmpDir/fopen_variation14.tmp in %s on line %d
-Warning: fopen(file://./fopen14.tmpDir/fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+Warning: fopen(file://./fopen14.tmpDir/fopen_variation14.tmp): Failed to open stream: no suitable wrapper could be found in %s on line %d
--- READ: file://.\fopen14.tmpDir\fopen_variation14.tmp ---
-Warning: fopen(): remote host file access not supported, file://.\fopen14.tmpDir\fopen_variation14.tmp in %s on line %d
+Warning: fopen(): Remote host file access not supported, file://.\fopen14.tmpDir\fopen_variation14.tmp in %s on line %d
-Warning: fopen(file://.\fopen14.tmpDir\fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+Warning: fopen(file://.\fopen14.tmpDir\fopen_variation14.tmp): Failed to open stream: no suitable wrapper could be found in %s on line %d
--- WRITE: file://.\fopen14.tmpDir\fopen_variation14.tmp ---
-Warning: fopen(): remote host file access not supported, file://.\fopen14.tmpDir\fopen_variation14.tmp in %s on line %d
+Warning: fopen(): Remote host file access not supported, file://.\fopen14.tmpDir\fopen_variation14.tmp in %s on line %d
-Warning: fopen(file://.\fopen14.tmpDir\fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+Warning: fopen(file://.\fopen14.tmpDir\fopen_variation14.tmp): Failed to open stream: no suitable wrapper could be found in %s on line %d
--- READ: file://%s/fopen14.tmpDir/fopen_variation14.tmp ---
test passed
--- WRITE: file://%s/fopen14.tmpDir/fopen_variation14.tmp ---
@@ -155,24 +154,24 @@ test passed
test passed
--- READ: file://../fopen14.tmpDir/fopen_variation14.tmp ---
-Warning: fopen(): remote host file access not supported, file://../fopen14.tmpDir/fopen_variation14.tmp in %s on line %d
+Warning: fopen(): Remote host file access not supported, file://../fopen14.tmpDir/fopen_variation14.tmp in %s on line %d
-Warning: fopen(file://../fopen14.tmpDir/fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+Warning: fopen(file://../fopen14.tmpDir/fopen_variation14.tmp): Failed to open stream: no suitable wrapper could be found in %s on line %d
--- WRITE: file://../fopen14.tmpDir/fopen_variation14.tmp ---
-Warning: fopen(): remote host file access not supported, file://../fopen14.tmpDir/fopen_variation14.tmp in %s on line %d
+Warning: fopen(): Remote host file access not supported, file://../fopen14.tmpDir/fopen_variation14.tmp in %s on line %d
-Warning: fopen(file://../fopen14.tmpDir/fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+Warning: fopen(file://../fopen14.tmpDir/fopen_variation14.tmp): Failed to open stream: no suitable wrapper could be found in %s on line %d
--- READ: file://..\fopen14.tmpDir\fopen_variation14.tmp ---
-Warning: fopen(): remote host file access not supported, file://..\fopen14.tmpDir\fopen_variation14.tmp in %s on line %d
+Warning: fopen(): Remote host file access not supported, file://..\fopen14.tmpDir\fopen_variation14.tmp in %s on line %d
-Warning: fopen(file://..\fopen14.tmpDir\fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+Warning: fopen(file://..\fopen14.tmpDir\fopen_variation14.tmp): Failed to open stream: no suitable wrapper could be found in %s on line %d
--- WRITE: file://..\fopen14.tmpDir\fopen_variation14.tmp ---
-Warning: fopen(): remote host file access not supported, file://..\fopen14.tmpDir\fopen_variation14.tmp in %s on line %d
+Warning: fopen(): Remote host file access not supported, file://..\fopen14.tmpDir\fopen_variation14.tmp in %s on line %d
-Warning: fopen(file://..\fopen14.tmpDir\fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+Warning: fopen(file://..\fopen14.tmpDir\fopen_variation14.tmp): Failed to open stream: no suitable wrapper could be found in %s on line %d
--- READ: file://%s/fopen14.tmpDir/fopen_variation14.tmp ---
test passed
--- WRITE: file://%s/fopen14.tmpDir/fopen_variation14.tmp ---
@@ -185,4 +184,3 @@ test passed
test passed
--- WRITE: file:///%s/fopen14.tmpDir/fopen_variation14.tmp ---
test passed
-===DONE===
diff --git a/ext/standard/tests/file/fopen_variation14.phpt b/ext/standard/tests/file/fopen_variation14.phpt
index f1e37fdda0..fc98194d34 100644
--- a/ext/standard/tests/file/fopen_variation14.phpt
+++ b/ext/standard/tests/file/fopen_variation14.phpt
@@ -70,65 +70,63 @@ function runtest($fileURIs) {
// create the file to test write
$h = fopen($fileURI, 'w');
if ($h !== false) {
- fwrite($h, $writeData);
- fclose($h);
-
- $h = fopen($absFile, 'r');
- if ($h !== false) {
- if (fread($h, 4096) != $writeData) {
- echo "contents not correct\n";
- }
- else {
- echo "test passed\n";
- }
- fclose($h);
- }
- unlink($absFile);
- }
+ fwrite($h, $writeData);
+ fclose($h);
+
+ $h = fopen($absFile, 'r');
+ if ($h !== false) {
+ if (fread($h, 4096) != $writeData) {
+ echo "contents not correct\n";
+ }
+ else {
+ echo "test passed\n";
+ }
+ fclose($h);
+ }
+ unlink($absFile);
+ }
}
}
?>
-===DONE===
--EXPECTF--
*** Testing fopen() : variation ***
--- READ: file://fopen14.tmpDir/fopen_variation14.tmp ---
-Warning: fopen(): remote host file access not supported, file://fopen14.tmpDir/fopen_variation14.tmp in %s on line %d
+Warning: fopen(): Remote host file access not supported, file://fopen14.tmpDir/fopen_variation14.tmp in %s on line %d
-Warning: fopen(file://fopen14.tmpDir/fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+Warning: fopen(file://fopen14.tmpDir/fopen_variation14.tmp): Failed to open stream: no suitable wrapper could be found in %s on line %d
--- WRITE: file://fopen14.tmpDir/fopen_variation14.tmp ---
-Warning: fopen(): remote host file access not supported, file://fopen14.tmpDir/fopen_variation14.tmp in %s on line %d
+Warning: fopen(): Remote host file access not supported, file://fopen14.tmpDir/fopen_variation14.tmp in %s on line %d
-Warning: fopen(file://fopen14.tmpDir/fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+Warning: fopen(file://fopen14.tmpDir/fopen_variation14.tmp): Failed to open stream: no suitable wrapper could be found in %s on line %d
--- READ: file://./fopen14.tmpDir/fopen_variation14.tmp ---
-Warning: fopen(): remote host file access not supported, file://./fopen14.tmpDir/fopen_variation14.tmp in %s on line %d
+Warning: fopen(): Remote host file access not supported, file://./fopen14.tmpDir/fopen_variation14.tmp in %s on line %d
-Warning: fopen(file://./fopen14.tmpDir/fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+Warning: fopen(file://./fopen14.tmpDir/fopen_variation14.tmp): Failed to open stream: no suitable wrapper could be found in %s on line %d
--- WRITE: file://./fopen14.tmpDir/fopen_variation14.tmp ---
-Warning: fopen(): remote host file access not supported, file://./fopen14.tmpDir/fopen_variation14.tmp in %s on line %d
+Warning: fopen(): Remote host file access not supported, file://./fopen14.tmpDir/fopen_variation14.tmp in %s on line %d
-Warning: fopen(file://./fopen14.tmpDir/fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+Warning: fopen(file://./fopen14.tmpDir/fopen_variation14.tmp): Failed to open stream: no suitable wrapper could be found in %s on line %d
--- READ: file:///%s/fopen14.tmpDir/fopen_variation14.tmp ---
test passed
--- WRITE: file:///%s/fopen14.tmpDir/fopen_variation14.tmp ---
test passed
--- READ: file://../fopen14.tmpDir/fopen_variation14.tmp ---
-Warning: fopen(): remote host file access not supported, file://../fopen14.tmpDir/fopen_variation14.tmp in %s on line %d
+Warning: fopen(): Remote host file access not supported, file://../fopen14.tmpDir/fopen_variation14.tmp in %s on line %d
-Warning: fopen(file://../fopen14.tmpDir/fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+Warning: fopen(file://../fopen14.tmpDir/fopen_variation14.tmp): Failed to open stream: no suitable wrapper could be found in %s on line %d
--- WRITE: file://../fopen14.tmpDir/fopen_variation14.tmp ---
-Warning: fopen(): remote host file access not supported, file://../fopen14.tmpDir/fopen_variation14.tmp in %s on line %d
+Warning: fopen(): Remote host file access not supported, file://../fopen14.tmpDir/fopen_variation14.tmp in %s on line %d
-Warning: fopen(file://../fopen14.tmpDir/fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+Warning: fopen(file://../fopen14.tmpDir/fopen_variation14.tmp): Failed to open stream: no suitable wrapper could be found in %s on line %d
--- READ: file:///%s/fopen14.tmpDir/fopen_variation14.tmp ---
test passed
--- WRITE: file:///%s/fopen14.tmpDir/fopen_variation14.tmp ---
test passed
-===DONE===
diff --git a/ext/standard/tests/file/fopen_variation15-win32.phpt b/ext/standard/tests/file/fopen_variation15-win32.phpt
index 52f69db746..f263b1b393 100644
--- a/ext/standard/tests/file/fopen_variation15-win32.phpt
+++ b/ext/standard/tests/file/fopen_variation15-win32.phpt
@@ -82,69 +82,68 @@ function runtest($fileURIs) {
// create the file to test write
$h = fopen($fileURI, 'w', true);
if ($h !== false) {
- fwrite($h, $writeData);
- fclose($h);
-
- $h = fopen($absFile, 'r');
- if ($h !== false) {
- if (fread($h, 4096) != $writeData) {
- echo "contents not correct\n";
- }
- else {
- echo "test passed\n";
- }
- fclose($h);
- }
- unlink($absFile);
- }
+ fwrite($h, $writeData);
+ fclose($h);
+
+ $h = fopen($absFile, 'r');
+ if ($h !== false) {
+ if (fread($h, 4096) != $writeData) {
+ echo "contents not correct\n";
+ }
+ else {
+ echo "test passed\n";
+ }
+ fclose($h);
+ }
+ unlink($absFile);
+ }
}
}
?>
-===DONE===
--EXPECTF--
*** Testing fopen() : variation ***
--- READ: file://fopen15.tmpDir\fopen_variation15.tmp ---
-Warning: fopen(): remote host file access not supported, file://fopen15.tmpDir\fopen_variation15.tmp in %s on line %d
+Warning: fopen(): Remote host file access not supported, file://fopen15.tmpDir\fopen_variation15.tmp in %s on line %d
-Warning: fopen(file://fopen15.tmpDir\fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+Warning: fopen(file://fopen15.tmpDir\fopen_variation15.tmp): Failed to open stream: no suitable wrapper could be found in %s on line %d
--- WRITE: file://fopen15.tmpDir\fopen_variation15.tmp ---
-Warning: fopen(): remote host file access not supported, file://fopen15.tmpDir\fopen_variation15.tmp in %s on line %d
+Warning: fopen(): Remote host file access not supported, file://fopen15.tmpDir\fopen_variation15.tmp in %s on line %d
-Warning: fopen(file://fopen15.tmpDir\fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+Warning: fopen(file://fopen15.tmpDir\fopen_variation15.tmp): Failed to open stream: no suitable wrapper could be found in %s on line %d
--- READ: file://fopen15.tmpDir/fopen_variation15.tmp ---
-Warning: fopen(): remote host file access not supported, file://fopen15.tmpDir/fopen_variation15.tmp in %s on line %d
+Warning: fopen(): Remote host file access not supported, file://fopen15.tmpDir/fopen_variation15.tmp in %s on line %d
-Warning: fopen(file://fopen15.tmpDir/fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+Warning: fopen(file://fopen15.tmpDir/fopen_variation15.tmp): Failed to open stream: no suitable wrapper could be found in %s on line %d
--- WRITE: file://fopen15.tmpDir/fopen_variation15.tmp ---
-Warning: fopen(): remote host file access not supported, file://fopen15.tmpDir/fopen_variation15.tmp in %s on line %d
+Warning: fopen(): Remote host file access not supported, file://fopen15.tmpDir/fopen_variation15.tmp in %s on line %d
-Warning: fopen(file://fopen15.tmpDir/fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+Warning: fopen(file://fopen15.tmpDir/fopen_variation15.tmp): Failed to open stream: no suitable wrapper could be found in %s on line %d
--- READ: file://./fopen15.tmpDir/fopen_variation15.tmp ---
-Warning: fopen(): remote host file access not supported, file://./fopen15.tmpDir/fopen_variation15.tmp in %s on line %d
+Warning: fopen(): Remote host file access not supported, file://./fopen15.tmpDir/fopen_variation15.tmp in %s on line %d
-Warning: fopen(file://./fopen15.tmpDir/fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+Warning: fopen(file://./fopen15.tmpDir/fopen_variation15.tmp): Failed to open stream: no suitable wrapper could be found in %s on line %d
--- WRITE: file://./fopen15.tmpDir/fopen_variation15.tmp ---
-Warning: fopen(): remote host file access not supported, file://./fopen15.tmpDir/fopen_variation15.tmp in %s on line %d
+Warning: fopen(): Remote host file access not supported, file://./fopen15.tmpDir/fopen_variation15.tmp in %s on line %d
-Warning: fopen(file://./fopen15.tmpDir/fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+Warning: fopen(file://./fopen15.tmpDir/fopen_variation15.tmp): Failed to open stream: no suitable wrapper could be found in %s on line %d
--- READ: file://.\fopen15.tmpDir\fopen_variation15.tmp ---
-Warning: fopen(): remote host file access not supported, file://.\fopen15.tmpDir\fopen_variation15.tmp in %s on line %d
+Warning: fopen(): Remote host file access not supported, file://.\fopen15.tmpDir\fopen_variation15.tmp in %s on line %d
-Warning: fopen(file://.\fopen15.tmpDir\fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+Warning: fopen(file://.\fopen15.tmpDir\fopen_variation15.tmp): Failed to open stream: no suitable wrapper could be found in %s on line %d
--- WRITE: file://.\fopen15.tmpDir\fopen_variation15.tmp ---
-Warning: fopen(): remote host file access not supported, file://.\fopen15.tmpDir\fopen_variation15.tmp in %s on line %d
+Warning: fopen(): Remote host file access not supported, file://.\fopen15.tmpDir\fopen_variation15.tmp in %s on line %d
-Warning: fopen(file://.\fopen15.tmpDir\fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+Warning: fopen(file://.\fopen15.tmpDir\fopen_variation15.tmp): Failed to open stream: no suitable wrapper could be found in %s on line %d
--- READ: file://%s/fopen15.tmpDir/fopen_variation15.tmp ---
test passed
--- WRITE: file://%s/fopen15.tmpDir/fopen_variation15.tmp ---
@@ -159,24 +158,24 @@ test passed
test passed
--- READ: file://../fopen15.tmpDir/fopen_variation15.tmp ---
-Warning: fopen(): remote host file access not supported, file://../fopen15.tmpDir/fopen_variation15.tmp in %s on line %d
+Warning: fopen(): Remote host file access not supported, file://../fopen15.tmpDir/fopen_variation15.tmp in %s on line %d
-Warning: fopen(file://../fopen15.tmpDir/fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+Warning: fopen(file://../fopen15.tmpDir/fopen_variation15.tmp): Failed to open stream: no suitable wrapper could be found in %s on line %d
--- WRITE: file://../fopen15.tmpDir/fopen_variation15.tmp ---
-Warning: fopen(): remote host file access not supported, file://../fopen15.tmpDir/fopen_variation15.tmp in %s on line %d
+Warning: fopen(): Remote host file access not supported, file://../fopen15.tmpDir/fopen_variation15.tmp in %s on line %d
-Warning: fopen(file://../fopen15.tmpDir/fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+Warning: fopen(file://../fopen15.tmpDir/fopen_variation15.tmp): Failed to open stream: no suitable wrapper could be found in %s on line %d
--- READ: file://..\fopen15.tmpDir\fopen_variation15.tmp ---
-Warning: fopen(): remote host file access not supported, file://..\fopen15.tmpDir\fopen_variation15.tmp in %s on line %d
+Warning: fopen(): Remote host file access not supported, file://..\fopen15.tmpDir\fopen_variation15.tmp in %s on line %d
-Warning: fopen(file://..\fopen15.tmpDir\fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+Warning: fopen(file://..\fopen15.tmpDir\fopen_variation15.tmp): Failed to open stream: no suitable wrapper could be found in %s on line %d
--- WRITE: file://..\fopen15.tmpDir\fopen_variation15.tmp ---
-Warning: fopen(): remote host file access not supported, file://..\fopen15.tmpDir\fopen_variation15.tmp in %s on line %d
+Warning: fopen(): Remote host file access not supported, file://..\fopen15.tmpDir\fopen_variation15.tmp in %s on line %d
-Warning: fopen(file://..\fopen15.tmpDir\fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+Warning: fopen(file://..\fopen15.tmpDir\fopen_variation15.tmp): Failed to open stream: no suitable wrapper could be found in %s on line %d
--- READ: file://%s/fopen15.tmpDir/fopen_variation15.tmp ---
test passed
--- WRITE: file://%s/fopen15.tmpDir/fopen_variation15.tmp ---
@@ -189,4 +188,3 @@ test passed
test passed
--- WRITE: file:///%s/fopen15.tmpDir/fopen_variation15.tmp ---
test passed
-===DONE===
diff --git a/ext/standard/tests/file/fopen_variation15.phpt b/ext/standard/tests/file/fopen_variation15.phpt
index bad0a0b63c..a86b7d9642 100644
--- a/ext/standard/tests/file/fopen_variation15.phpt
+++ b/ext/standard/tests/file/fopen_variation15.phpt
@@ -74,65 +74,63 @@ function runtest($fileURIs) {
// create the file to test write
$h = fopen($fileURI, 'w', true);
if ($h !== false) {
- fwrite($h, $writeData);
- fclose($h);
-
- $h = fopen($absFile, 'r');
- if ($h !== false) {
- if (fread($h, 4096) != $writeData) {
- echo "contents not correct\n";
- }
- else {
- echo "test passed\n";
- }
- fclose($h);
- }
- unlink($absFile);
- }
+ fwrite($h, $writeData);
+ fclose($h);
+
+ $h = fopen($absFile, 'r');
+ if ($h !== false) {
+ if (fread($h, 4096) != $writeData) {
+ echo "contents not correct\n";
+ }
+ else {
+ echo "test passed\n";
+ }
+ fclose($h);
+ }
+ unlink($absFile);
+ }
}
}
?>
-===DONE===
--EXPECTF--
*** Testing fopen() : variation ***
--- READ: file://fopen15.tmpDir/fopen_variation15.tmp ---
-Warning: fopen(): remote host file access not supported, file://fopen15.tmpDir/fopen_variation15.tmp in %s on line %d
+Warning: fopen(): Remote host file access not supported, file://fopen15.tmpDir/fopen_variation15.tmp in %s on line %d
-Warning: fopen(file://fopen15.tmpDir/fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+Warning: fopen(file://fopen15.tmpDir/fopen_variation15.tmp): Failed to open stream: no suitable wrapper could be found in %s on line %d
--- WRITE: file://fopen15.tmpDir/fopen_variation15.tmp ---
-Warning: fopen(): remote host file access not supported, file://fopen15.tmpDir/fopen_variation15.tmp in %s on line %d
+Warning: fopen(): Remote host file access not supported, file://fopen15.tmpDir/fopen_variation15.tmp in %s on line %d
-Warning: fopen(file://fopen15.tmpDir/fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+Warning: fopen(file://fopen15.tmpDir/fopen_variation15.tmp): Failed to open stream: no suitable wrapper could be found in %s on line %d
--- READ: file://./fopen15.tmpDir/fopen_variation15.tmp ---
-Warning: fopen(): remote host file access not supported, file://./fopen15.tmpDir/fopen_variation15.tmp in %s on line %d
+Warning: fopen(): Remote host file access not supported, file://./fopen15.tmpDir/fopen_variation15.tmp in %s on line %d
-Warning: fopen(file://./fopen15.tmpDir/fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+Warning: fopen(file://./fopen15.tmpDir/fopen_variation15.tmp): Failed to open stream: no suitable wrapper could be found in %s on line %d
--- WRITE: file://./fopen15.tmpDir/fopen_variation15.tmp ---
-Warning: fopen(): remote host file access not supported, file://./fopen15.tmpDir/fopen_variation15.tmp in %s on line %d
+Warning: fopen(): Remote host file access not supported, file://./fopen15.tmpDir/fopen_variation15.tmp in %s on line %d
-Warning: fopen(file://./fopen15.tmpDir/fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+Warning: fopen(file://./fopen15.tmpDir/fopen_variation15.tmp): Failed to open stream: no suitable wrapper could be found in %s on line %d
--- READ: file:///%s/fopen15.tmpDir/fopen_variation15.tmp ---
test passed
--- WRITE: file:///%s/fopen15.tmpDir/fopen_variation15.tmp ---
test passed
--- READ: file://../fopen15.tmpDir/fopen_variation15.tmp ---
-Warning: fopen(): remote host file access not supported, file://../fopen15.tmpDir/fopen_variation15.tmp in %s on line %d
+Warning: fopen(): Remote host file access not supported, file://../fopen15.tmpDir/fopen_variation15.tmp in %s on line %d
-Warning: fopen(file://../fopen15.tmpDir/fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+Warning: fopen(file://../fopen15.tmpDir/fopen_variation15.tmp): Failed to open stream: no suitable wrapper could be found in %s on line %d
--- WRITE: file://../fopen15.tmpDir/fopen_variation15.tmp ---
-Warning: fopen(): remote host file access not supported, file://../fopen15.tmpDir/fopen_variation15.tmp in %s on line %d
+Warning: fopen(): Remote host file access not supported, file://../fopen15.tmpDir/fopen_variation15.tmp in %s on line %d
-Warning: fopen(file://../fopen15.tmpDir/fopen_variation15.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
+Warning: fopen(file://../fopen15.tmpDir/fopen_variation15.tmp): Failed to open stream: no suitable wrapper could be found in %s on line %d
--- READ: file:///%s/fopen15.tmpDir/fopen_variation15.tmp ---
test passed
--- WRITE: file:///%s/fopen15.tmpDir/fopen_variation15.tmp ---
test passed
-===DONE===
diff --git a/ext/standard/tests/file/fopen_variation16.phpt b/ext/standard/tests/file/fopen_variation16.phpt
index 5888688fa8..fa2fc02682 100644
--- a/ext/standard/tests/file/fopen_variation16.phpt
+++ b/ext/standard/tests/file/fopen_variation16.phpt
@@ -36,39 +36,37 @@ function runtest() {
mkdir($dir1.'/'.$extraDir);
mkdir($extraDir);
- $tmpfile = $extraDir.'/fopen_variation16.tmp';
+ $tmpfile = $extraDir.'/fopen_variation16.tmp';
- $h = fopen($tmpfile, "w+", true);
- fwrite($h, "This is the test file");
- fclose($h);
+ $h = fopen($tmpfile, "w+", true);
+ fwrite($h, "This is the test file");
+ fclose($h);
- $h = @fopen($dir1.'/'.$tmpfile, "r");
- if ($h === false) {
- echo "Not created in dir1\n";
- }
- else {
- echo "created in dir1\n";
- fclose($h);
- }
+ $h = @fopen($dir1.'/'.$tmpfile, "r");
+ if ($h === false) {
+ echo "Not created in dir1\n";
+ }
+ else {
+ echo "created in dir1\n";
+ fclose($h);
+ }
- $h = fopen($tmpfile, "r", true);
- if ($h === false) {
- echo "could not find file for reading\n";
- }
- else {
- echo "found file - not in dir1\n";
- fclose($h);
- }
+ $h = fopen($tmpfile, "r", true);
+ if ($h === false) {
+ echo "could not find file for reading\n";
+ }
+ else {
+ echo "found file - not in dir1\n";
+ fclose($h);
+ }
- unlink($tmpfile);
+ unlink($tmpfile);
rmdir($dir1.'/'.$extraDir);
rmdir($extraDir);
}
?>
-===DONE===
--EXPECT--
Not created in dir1
found file - not in dir1
Not created in dir1
found file - not in dir1
-===DONE===
diff --git a/ext/standard/tests/file/fopen_variation17.phpt b/ext/standard/tests/file/fopen_variation17.phpt
index 5d639e8236..9565cf614c 100644
--- a/ext/standard/tests/file/fopen_variation17.phpt
+++ b/ext/standard/tests/file/fopen_variation17.phpt
@@ -36,38 +36,36 @@ function runtest() {
mkdir($dir1.'/'.$extraDir);
mkdir($extraDir);
- $tmpfile = $extraDir . '/' . basename(__FILE__, ".php") . ".tmp";
- $h = fopen($tmpfile, "w+", true);
- fwrite($h, "This is the test file");
- fclose($h);
+ $tmpfile = $extraDir . '/' . basename(__FILE__, ".php") . ".tmp";
+ $h = fopen($tmpfile, "w+", true);
+ fwrite($h, "This is the test file");
+ fclose($h);
- $h = @fopen($dir1.'/'.$tmpfile, "r");
- if ($h === false) {
- echo "Not created in dir1\n";
- }
- else {
- echo "created in dir1\n";
- fclose($h);
- }
+ $h = @fopen($dir1.'/'.$tmpfile, "r");
+ if ($h === false) {
+ echo "Not created in dir1\n";
+ }
+ else {
+ echo "created in dir1\n";
+ fclose($h);
+ }
- $h = fopen($tmpfile, "r", true);
- if ($h === false) {
- echo "could not find file for reading\n";
- }
- else {
- echo "found file for reading\n";
- fclose($h);
- }
+ $h = fopen($tmpfile, "r", true);
+ if ($h === false) {
+ echo "could not find file for reading\n";
+ }
+ else {
+ echo "found file for reading\n";
+ fclose($h);
+ }
- unlink($tmpfile);
+ unlink($tmpfile);
rmdir($dir1.'/'.$extraDir);
rmdir($extraDir);
}
?>
-===DONE===
--EXPECT--
Not created in dir1
found file for reading
Not created in dir1
found file for reading
-===DONE===
diff --git a/ext/standard/tests/file/fopen_variation19.phpt b/ext/standard/tests/file/fopen_variation19.phpt
index 069ce11170..58d69cc2cb 100644
--- a/ext/standard/tests/file/fopen_variation19.phpt
+++ b/ext/standard/tests/file/fopen_variation19.phpt
@@ -92,7 +92,6 @@ function writeFile($file) {
?>
-===DONE===
--EXPECT--
*** Testing fopen() : variation ***
*** testing reading of links ***
@@ -107,4 +106,3 @@ link of link:Hello World again! again! again!
soft link:Goodbye World
hard link:Goodbye World
link of link:Goodbye World
-===DONE===
diff --git a/ext/standard/tests/file/fopen_variation5.phpt b/ext/standard/tests/file/fopen_variation5.phpt
index a3f5c1d3be..8d7e3b0384 100644
--- a/ext/standard/tests/file/fopen_variation5.phpt
+++ b/ext/standard/tests/file/fopen_variation5.phpt
@@ -121,7 +121,6 @@ function test_fopen($mode) {
}
?>
-===DONE===
--EXPECT--
--- testing include path ---
@@ -145,4 +144,3 @@ in dir1
in dir1
in working dir
in script dir
-===DONE===
diff --git a/ext/standard/tests/file/fopen_variation6.phpt b/ext/standard/tests/file/fopen_variation6.phpt
index a3ce051deb..7a73aa8364 100644
--- a/ext/standard/tests/file/fopen_variation6.phpt
+++ b/ext/standard/tests/file/fopen_variation6.phpt
@@ -36,9 +36,7 @@ echo "\n";
unlink($absfile);
unlink($relfile);
?>
-===DONE===
--EXPECT--
*** Testing fopen() : variation ***
This is an absolute file
This is a relative file
-===DONE===
diff --git a/ext/standard/tests/file/fopen_variation7.phpt b/ext/standard/tests/file/fopen_variation7.phpt
index 531b27e0bc..2a1e0268bc 100644
--- a/ext/standard/tests/file/fopen_variation7.phpt
+++ b/ext/standard/tests/file/fopen_variation7.phpt
@@ -29,37 +29,35 @@ rmdir($thisTestDir);
function runtest() {
global $dir1;
- $tmpfile = basename(__FILE__, ".php") . ".tmp";
- $h = fopen($tmpfile, "w", true);
- fwrite($h, "This is the test file");
- fclose($h);
-
-
- $h = @fopen($tmpfile, "r");
- if ($h === false) {
- echo "Not created in working dir\n";
- }
- else {
- echo "created in working dir\n";
- fclose($h);
- unlink($tmpfile);
- }
-
- $h = @fopen($dir1.'/'.$tmpfile, "r");
- if ($h === false) {
- echo "Not created in dir1\n";
- }
- else {
- echo "created in dir1\n";
- fclose($h);
- unlink($dir1.'/'.$tmpfile);
- }
+ $tmpfile = basename(__FILE__, ".php") . ".tmp";
+ $h = fopen($tmpfile, "w", true);
+ fwrite($h, "This is the test file");
+ fclose($h);
+
+
+ $h = @fopen($tmpfile, "r");
+ if ($h === false) {
+ echo "Not created in working dir\n";
+ }
+ else {
+ echo "created in working dir\n";
+ fclose($h);
+ unlink($tmpfile);
+ }
+
+ $h = @fopen($dir1.'/'.$tmpfile, "r");
+ if ($h === false) {
+ echo "Not created in dir1\n";
+ }
+ else {
+ echo "created in dir1\n";
+ fclose($h);
+ unlink($dir1.'/'.$tmpfile);
+ }
}
?>
-===DONE===
--EXPECT--
created in working dir
Not created in dir1
created in working dir
Not created in dir1
-===DONE===
diff --git a/ext/standard/tests/file/fopen_variation8.phpt b/ext/standard/tests/file/fopen_variation8.phpt
index 3647191128..229edd5672 100644
--- a/ext/standard/tests/file/fopen_variation8.phpt
+++ b/ext/standard/tests/file/fopen_variation8.phpt
@@ -120,7 +120,6 @@ function test_fopen($mode) {
}
?>
-===DONE===
--EXPECT--
--- testing include path ---
@@ -144,4 +143,3 @@ in dir1
in dir1
in working dir
in script dir
-===DONE===
diff --git a/ext/standard/tests/file/fopen_variation9.phpt b/ext/standard/tests/file/fopen_variation9.phpt
index 5479ddcf2d..850bf138d6 100644
--- a/ext/standard/tests/file/fopen_variation9.phpt
+++ b/ext/standard/tests/file/fopen_variation9.phpt
@@ -29,37 +29,35 @@ chdir("..");
rmdir($thisTestDir);
function runtest() {
- $tmpfile = basename(__FILE__, ".php") . ".tmp";
- $h = fopen($tmpfile, "w", true);
- fwrite($h, "This is the test file");
- fclose($h);
-
-
- $h = @fopen($tmpfile, "r");
- if ($h === false) {
- echo "Not created in working dir\n";
- }
- else {
- echo "created in working dir\n";
- fclose($h);
- unlink($tmpfile);
- }
-
- $h = @fopen('dir1/'.$tmpfile, "r");
- if ($h === false) {
- echo "Not created in dir1\n";
- }
- else {
- echo "created in dir1\n";
- fclose($h);
- unlink('dir1/'.$tmpfile);
- }
+ $tmpfile = basename(__FILE__, ".php") . ".tmp";
+ $h = fopen($tmpfile, "w", true);
+ fwrite($h, "This is the test file");
+ fclose($h);
+
+
+ $h = @fopen($tmpfile, "r");
+ if ($h === false) {
+ echo "Not created in working dir\n";
+ }
+ else {
+ echo "created in working dir\n";
+ fclose($h);
+ unlink($tmpfile);
+ }
+
+ $h = @fopen('dir1/'.$tmpfile, "r");
+ if ($h === false) {
+ echo "Not created in dir1\n";
+ }
+ else {
+ echo "created in dir1\n";
+ fclose($h);
+ unlink('dir1/'.$tmpfile);
+ }
}
?>
-===DONE===
--EXPECT--
created in working dir
Not created in dir1
created in working dir
Not created in dir1
-===DONE===
diff --git a/ext/standard/tests/file/fopencookie.phpt b/ext/standard/tests/file/fopencookie.phpt
index 20fd181cbd..03c9a84cd4 100644
--- a/ext/standard/tests/file/fopencookie.phpt
+++ b/ext/standard/tests/file/fopencookie.phpt
@@ -17,68 +17,68 @@ fopencookie detected and working (or cast mechanism works)
*/
class userstream {
- public $position = 0;
- public $data = "If you can read this, it worked";
+ public $position = 0;
+ public $data = "If you can read this, it worked";
- function stream_open($path, $mode, $options, &$opened_path)
- {
- return true;
- }
+ function stream_open($path, $mode, $options, &$opened_path)
+ {
+ return true;
+ }
- function stream_read($count)
- {
- $ret = substr($this->data, $this->position, $count);
- $this->position += strlen($ret);
- return $ret;
- }
+ function stream_read($count)
+ {
+ $ret = substr($this->data, $this->position, $count);
+ $this->position += strlen($ret);
+ return $ret;
+ }
- function stream_tell()
- {
- return $this->position;
- }
+ function stream_tell()
+ {
+ return $this->position;
+ }
- function stream_eof()
- {
- return $this->position >= strlen($this->data);
- }
+ function stream_eof()
+ {
+ return $this->position >= strlen($this->data);
+ }
- function stream_seek($offset, $whence)
- {
- switch($whence) {
- case SEEK_SET:
- if ($offset < strlen($this->data) && $offset >= 0) {
- $this->position = $offset;
- return true;
- } else {
- return false;
- }
- break;
- case SEEK_CUR:
- if ($offset >= 0) {
- $this->position += $offset;
- return true;
- } else {
- return false;
- }
- break;
- case SEEK_END:
- if (strlen($this->data) + $offset >= 0) {
- $this->position = strlen($this->data) + $offset;
- return true;
- } else {
- return false;
- }
- break;
- default:
- return false;
- }
- }
- function stream_stat() {
- return array('size' => strlen($this->data));
- }
- function stream_set_option($option, $arg1, $arg2) {
- return false;
- }
+ function stream_seek($offset, $whence)
+ {
+ switch($whence) {
+ case SEEK_SET:
+ if ($offset < strlen($this->data) && $offset >= 0) {
+ $this->position = $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+ case SEEK_CUR:
+ if ($offset >= 0) {
+ $this->position += $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+ case SEEK_END:
+ if (strlen($this->data) + $offset >= 0) {
+ $this->position = strlen($this->data) + $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+ default:
+ return false;
+ }
+ }
+ function stream_stat() {
+ return array('size' => strlen($this->data));
+ }
+ function stream_set_option($option, $arg1, $arg2) {
+ return false;
+ }
}
stream_wrapper_register("cookietest", "userstream");
diff --git a/ext/standard/tests/file/fpassthru_basic.phpt b/ext/standard/tests/file/fpassthru_basic.phpt
index 9376714368..3304de406d 100644
--- a/ext/standard/tests/file/fpassthru_basic.phpt
+++ b/ext/standard/tests/file/fpassthru_basic.phpt
@@ -11,10 +11,10 @@ Description: Reads to EOF on the given file pointer from the current position
$file_name = __DIR__."/passthru.tmp";
$write_handle = fopen($file_name, "w");
-$string = "Hello, world\n, abcdefg\tadsdsfdf\n8u2394723947\t$%$%#$%#$%#^#%^
+$string = "Hello, world\n, abcdefg\tadsdsfdf\n8u2394723947\t$%$%#$%#$%#^#%^
Hello, world\n, abcdefg\tadsdsfdf\n8u2394723947\t$%$%#$%#$%#^#%^\n";
if(substr(PHP_OS, 0, 3) == "WIN") {
- $string = str_replace("\r",'', $string);
+ $string = str_replace("\r",'', $string);
}
fwrite($write_handle, $string);
fclose($write_handle);
@@ -68,60 +68,60 @@ unlink(__DIR__."/passthru.tmp");
-- Before seek operation --
Hello, world
, abcdefg adsdsfdf
-8u2394723947 $%$%#$%#$%#^#%^
+8u2394723947 $%$%#$%#$%#^#%^
Hello, world
, abcdefg adsdsfdf
8u2394723947 $%$%#$%#$%#^#%^
-int(133)
+int(132)
-- After seeking position to 0 --
Hello, world
, abcdefg adsdsfdf
-8u2394723947 $%$%#$%#$%#^#%^
+8u2394723947 $%$%#$%#$%#^#%^
Hello, world
, abcdefg adsdsfdf
8u2394723947 $%$%#$%#$%#^#%^
-int(133)
+int(132)
-- After seeking position to 3 --
lo, world
, abcdefg adsdsfdf
-8u2394723947 $%$%#$%#$%#^#%^
+8u2394723947 $%$%#$%#$%#^#%^
Hello, world
, abcdefg adsdsfdf
8u2394723947 $%$%#$%#$%#^#%^
-int(130)
+int(129)
-- After seeking position to 13 --
, abcdefg adsdsfdf
-8u2394723947 $%$%#$%#$%#^#%^
+8u2394723947 $%$%#$%#$%#^#%^
Hello, world
, abcdefg adsdsfdf
8u2394723947 $%$%#$%#$%#^#%^
-int(120)
+int(119)
-- After seeking position to 14 --
abcdefg adsdsfdf
-8u2394723947 $%$%#$%#$%#^#%^
+8u2394723947 $%$%#$%#$%#^#%^
Hello, world
, abcdefg adsdsfdf
8u2394723947 $%$%#$%#$%#^#%^
-int(119)
+int(118)
-- After seeking position to 23 --
adsdsfdf
-8u2394723947 $%$%#$%#$%#^#%^
+8u2394723947 $%$%#$%#$%#^#%^
Hello, world
, abcdefg adsdsfdf
8u2394723947 $%$%#$%#$%#^#%^
-int(110)
+int(109)
-- After seeking position to 34 --
-2394723947 $%$%#$%#$%#^#%^
+2394723947 $%$%#$%#$%#^#%^
Hello, world
, abcdefg adsdsfdf
8u2394723947 $%$%#$%#$%#^#%^
-int(99)
+int(98)
-- After seeking position to 1000 --
int(0)
diff --git a/ext/standard/tests/file/fputcsv.phpt b/ext/standard/tests/file/fputcsv.phpt
index 5760882032..b303554e9c 100644
--- a/ext/standard/tests/file/fputcsv.phpt
+++ b/ext/standard/tests/file/fputcsv.phpt
@@ -31,14 +31,14 @@ $file = __DIR__ . '/fputcsv.csv';
$fp = fopen($file, "w");
foreach ($list as $v) {
- fputcsv($fp, explode(',', $v));
+ fputcsv($fp, explode(',', $v));
}
fclose($fp);
$res = file($file);
foreach($res as &$val)
{
- $val = substr($val, 0, -1);
+ $val = substr($val, 0, -1);
}
echo '$list = ';var_export($res);echo ";\n";
@@ -46,7 +46,7 @@ $fp = fopen($file, "r");
$res = array();
while($l=fgetcsv($fp))
{
- $res[] = join(',',$l);
+ $res[] = join(',',$l);
}
fclose($fp);
@@ -55,8 +55,6 @@ echo '$list = ';var_export($res);echo ";\n";
@unlink($file);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
$list = array (
0 => 'aaa,bbb',
@@ -102,4 +100,3 @@ $list = array (
18 => '"\\"","aaa"',
19 => '"\\""",aaa',
);
-===DONE===
diff --git a/ext/standard/tests/file/fputcsv_002.phpt b/ext/standard/tests/file/fputcsv_002.phpt
index db565d5223..90999a9e70 100644
--- a/ext/standard/tests/file/fputcsv_002.phpt
+++ b/ext/standard/tests/file/fputcsv_002.phpt
@@ -20,7 +20,7 @@ $file = __DIR__ .'/fgetcsv-test.csv';
unlink($file);
?>
--EXPECTF--
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
array(7) {
[0]=>
int(1)
diff --git a/ext/standard/tests/file/fputcsv_variation14.phpt b/ext/standard/tests/file/fputcsv_variation14.phpt
index 79576e4656..64c2f290ff 100644
--- a/ext/standard/tests/file/fputcsv_variation14.phpt
+++ b/ext/standard/tests/file/fputcsv_variation14.phpt
@@ -90,7 +90,7 @@ Notice: fputcsv(): delimiter must be a single character in %s on line %d
Notice: fputcsv(): enclosure must be a single character in %s on line %d
-Notice: fputcsv(): write of 12 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fputcsv(): Write of 12 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
@@ -102,7 +102,7 @@ Notice: fputcsv(): delimiter must be a single character in %s on line %d
Notice: fputcsv(): enclosure must be a single character in %s on line %d
-Notice: fputcsv(): write of 12 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fputcsv(): Write of 12 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
@@ -114,7 +114,7 @@ Notice: fputcsv(): delimiter must be a single character in %s on line %d
Notice: fputcsv(): enclosure must be a single character in %s on line %d
-Notice: fputcsv(): write of 12 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fputcsv(): Write of 12 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
@@ -126,7 +126,7 @@ Notice: fputcsv(): delimiter must be a single character in %s on line %d
Notice: fputcsv(): enclosure must be a single character in %s on line %d
-Notice: fputcsv(): write of 15 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fputcsv(): Write of 15 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
@@ -138,7 +138,7 @@ Notice: fputcsv(): delimiter must be a single character in %s on line %d
Notice: fputcsv(): enclosure must be a single character in %s on line %d
-Notice: fputcsv(): write of 15 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fputcsv(): Write of 15 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
@@ -150,7 +150,7 @@ Notice: fputcsv(): delimiter must be a single character in %s on line %d
Notice: fputcsv(): enclosure must be a single character in %s on line %d
-Notice: fputcsv(): write of 15 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fputcsv(): Write of 15 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
@@ -162,7 +162,7 @@ Notice: fputcsv(): delimiter must be a single character in %s on line %d
Notice: fputcsv(): enclosure must be a single character in %s on line %d
-Notice: fputcsv(): write of 16 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fputcsv(): Write of 16 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
@@ -174,7 +174,7 @@ Notice: fputcsv(): delimiter must be a single character in %s on line %d
Notice: fputcsv(): enclosure must be a single character in %s on line %d
-Notice: fputcsv(): write of 16 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fputcsv(): Write of 16 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
@@ -186,7 +186,7 @@ Notice: fputcsv(): delimiter must be a single character in %s on line %d
Notice: fputcsv(): enclosure must be a single character in %s on line %d
-Notice: fputcsv(): write of 16 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fputcsv(): Write of 16 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
@@ -198,7 +198,7 @@ Notice: fputcsv(): delimiter must be a single character in %s on line %d
Notice: fputcsv(): enclosure must be a single character in %s on line %d
-Notice: fputcsv(): write of 18 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fputcsv(): Write of 18 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
@@ -210,7 +210,7 @@ Notice: fputcsv(): delimiter must be a single character in %s on line %d
Notice: fputcsv(): enclosure must be a single character in %s on line %d
-Notice: fputcsv(): write of 18 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fputcsv(): Write of 18 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
@@ -222,7 +222,7 @@ Notice: fputcsv(): delimiter must be a single character in %s on line %d
Notice: fputcsv(): enclosure must be a single character in %s on line %d
-Notice: fputcsv(): write of 18 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fputcsv(): Write of 18 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
@@ -234,7 +234,7 @@ Notice: fputcsv(): delimiter must be a single character in %s on line %d
Notice: fputcsv(): enclosure must be a single character in %s on line %d
-Notice: fputcsv(): write of 16 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fputcsv(): Write of 16 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
@@ -246,7 +246,7 @@ Notice: fputcsv(): delimiter must be a single character in %s on line %d
Notice: fputcsv(): enclosure must be a single character in %s on line %d
-Notice: fputcsv(): write of 16 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fputcsv(): Write of 16 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
@@ -258,7 +258,7 @@ Notice: fputcsv(): delimiter must be a single character in %s on line %d
Notice: fputcsv(): enclosure must be a single character in %s on line %d
-Notice: fputcsv(): write of 16 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fputcsv(): Write of 16 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
@@ -270,7 +270,7 @@ Notice: fputcsv(): delimiter must be a single character in %s on line %d
Notice: fputcsv(): enclosure must be a single character in %s on line %d
-Notice: fputcsv(): write of 16 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fputcsv(): Write of 16 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
@@ -282,7 +282,7 @@ Notice: fputcsv(): delimiter must be a single character in %s on line %d
Notice: fputcsv(): enclosure must be a single character in %s on line %d
-Notice: fputcsv(): write of 16 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fputcsv(): Write of 16 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
@@ -294,7 +294,7 @@ Notice: fputcsv(): delimiter must be a single character in %s on line %d
Notice: fputcsv(): enclosure must be a single character in %s on line %d
-Notice: fputcsv(): write of 16 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fputcsv(): Write of 16 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
@@ -306,7 +306,7 @@ Notice: fputcsv(): delimiter must be a single character in %s on line %d
Notice: fputcsv(): enclosure must be a single character in %s on line %d
-Notice: fputcsv(): write of 18 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fputcsv(): Write of 18 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
@@ -318,7 +318,7 @@ Notice: fputcsv(): delimiter must be a single character in %s on line %d
Notice: fputcsv(): enclosure must be a single character in %s on line %d
-Notice: fputcsv(): write of 18 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fputcsv(): Write of 18 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
@@ -330,7 +330,7 @@ Notice: fputcsv(): delimiter must be a single character in %s on line %d
Notice: fputcsv(): enclosure must be a single character in %s on line %d
-Notice: fputcsv(): write of 18 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fputcsv(): Write of 18 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
@@ -342,7 +342,7 @@ Notice: fputcsv(): delimiter must be a single character in %s on line %d
Notice: fputcsv(): enclosure must be a single character in %s on line %d
-Notice: fputcsv(): write of 22 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fputcsv(): Write of 22 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
@@ -354,7 +354,7 @@ Notice: fputcsv(): delimiter must be a single character in %s on line %d
Notice: fputcsv(): enclosure must be a single character in %s on line %d
-Notice: fputcsv(): write of 22 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fputcsv(): Write of 22 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
@@ -366,7 +366,7 @@ Notice: fputcsv(): delimiter must be a single character in %s on line %d
Notice: fputcsv(): enclosure must be a single character in %s on line %d
-Notice: fputcsv(): write of 22 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fputcsv(): Write of 22 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
@@ -378,7 +378,7 @@ Notice: fputcsv(): delimiter must be a single character in %s on line %d
Notice: fputcsv(): enclosure must be a single character in %s on line %d
-Notice: fputcsv(): write of 24 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fputcsv(): Write of 24 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
@@ -390,7 +390,7 @@ Notice: fputcsv(): delimiter must be a single character in %s on line %d
Notice: fputcsv(): enclosure must be a single character in %s on line %d
-Notice: fputcsv(): write of 24 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fputcsv(): Write of 24 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
@@ -402,7 +402,7 @@ Notice: fputcsv(): delimiter must be a single character in %s on line %d
Notice: fputcsv(): enclosure must be a single character in %s on line %d
-Notice: fputcsv(): write of 24 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fputcsv(): Write of 24 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
diff --git a/ext/standard/tests/file/fputcsv_variation15.phpt b/ext/standard/tests/file/fputcsv_variation15.phpt
index 0e9d306ffa..150fdd69d5 100644
--- a/ext/standard/tests/file/fputcsv_variation15.phpt
+++ b/ext/standard/tests/file/fputcsv_variation15.phpt
@@ -33,14 +33,14 @@ $file = __DIR__ . '/fputcsv_variation15.csv';
$fp = fopen($file, "w");
foreach ($list as $v) {
- fputcsv($fp, explode(',', $v), ',', '"', '/');
+ fputcsv($fp, explode(',', $v), ',', '"', '/');
}
fclose($fp);
$res = file($file);
foreach($res as &$val)
{
- $val = substr($val, 0, -1);
+ $val = substr($val, 0, -1);
}
echo '$list = ';var_export($res);echo ";\n";
@@ -48,7 +48,7 @@ $fp = fopen($file, "r");
$res = array();
while($l=fgetcsv($fp, 0, ',', '"', '/'))
{
- $res[] = join(',',$l);
+ $res[] = join(',',$l);
}
fclose($fp);
@@ -57,8 +57,6 @@ echo '$list = ';var_export($res);echo ";\n";
@unlink($file);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
$list = array (
0 => 'aaa,bbb',
@@ -104,4 +102,3 @@ $list = array (
18 => '"/"","aaa"',
19 => '"/""",aaa',
);
-===DONE===
diff --git a/ext/standard/tests/file/fputcsv_variation16.phpt b/ext/standard/tests/file/fputcsv_variation16.phpt
index 1bae60da20..b5434312c6 100644
--- a/ext/standard/tests/file/fputcsv_variation16.phpt
+++ b/ext/standard/tests/file/fputcsv_variation16.phpt
@@ -14,8 +14,6 @@ rewind($stream);
echo stream_get_contents($stream);
fclose($stream);
?>
-===DONE===
--EXPECT--
\
"\"""
-===DONE===
diff --git a/ext/standard/tests/file/fputcsv_variation2.phpt b/ext/standard/tests/file/fputcsv_variation2.phpt
index deb2e82565..6625ef6ffe 100644
--- a/ext/standard/tests/file/fputcsv_variation2.phpt
+++ b/ext/standard/tests/file/fputcsv_variation2.phpt
@@ -55,7 +55,11 @@ foreach ($csv_lists as $csv_list) {
$csv_field = $csv_list[2];
// write to a file in csv format
- var_dump( fputcsv($file_handle, $csv_field, NULL, $enclosure) );
+ try {
+ var_dump( fputcsv($file_handle, $csv_field, NULL, $enclosure) );
+ } catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
// check the file pointer position and eof
var_dump( ftell($file_handle) );
var_dump( feof($file_handle) );
@@ -72,869 +76,653 @@ foreach ($csv_lists as $csv_list) {
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
*** Testing fputcsv() : with delimiter as NULL ***
-- file opened in r+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
diff --git a/ext/standard/tests/file/fputcsv_variation3.phpt b/ext/standard/tests/file/fputcsv_variation3.phpt
index 05f29bfc4c..326e92939c 100644
--- a/ext/standard/tests/file/fputcsv_variation3.phpt
+++ b/ext/standard/tests/file/fputcsv_variation3.phpt
@@ -55,7 +55,11 @@ foreach ($csv_lists as $csv_list) {
$csv_field = $csv_list[2];
// write to a file in csv format
- var_dump( fputcsv($file_handle, $csv_field, $delimiter, NULL) );
+ try {
+ var_dump( fputcsv($file_handle, $csv_field, $delimiter, NULL) );
+ } catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
// check the file pointer position and eof
var_dump( ftell($file_handle) );
var_dump( feof($file_handle) );
@@ -72,869 +76,653 @@ foreach ($csv_lists as $csv_list) {
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
*** Testing fputcsv() : with enclosure as NULL ***
-- file opened in r+ --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+b --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+t --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+ --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+b --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+t --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+ --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+b --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+t --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+ --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+b --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+t --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+ --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+b --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+t --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+ --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+b --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+t --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+ --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+b --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+t --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+ --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+b --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+t --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+ --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+b --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+t --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+ --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+b --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+t --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+ --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+b --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+t --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+ --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+b --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+t --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+ --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+b --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+t --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+ --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+b --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+t --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+ --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+b --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+t --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+ --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+b --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+t --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+ --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+b --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+t --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+ --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+b --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+t --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+ --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+b --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+t --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+ --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+b --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+t --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+ --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+b --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+t --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+ --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+b --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+t --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+ --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+b --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+t --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+ --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+b --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+t --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+ --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+b --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+t --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+ --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+b --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+t --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+ --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+b --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+t --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+ --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+b --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+t --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+ --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+b --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+t --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+ --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+b --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+t --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+ --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+b --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+t --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+ --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+b --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+t --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+ --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+b --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+t --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+ --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+b --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+t --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+ --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+b --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+t --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+ --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+b --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+t --
-
-Warning: fputcsv(): enclosure must be a character in %s on line %d
-bool(false)
+enclosure must be a character
int(0)
bool(false)
string(0) ""
diff --git a/ext/standard/tests/file/fputcsv_variation4.phpt b/ext/standard/tests/file/fputcsv_variation4.phpt
index 0a1a1cb5d7..90cdfd724a 100644
--- a/ext/standard/tests/file/fputcsv_variation4.phpt
+++ b/ext/standard/tests/file/fputcsv_variation4.phpt
@@ -55,7 +55,11 @@ foreach ($csv_lists as $csv_list) {
$csv_field = $csv_list[2];
// write to a file in csv format
- var_dump( fputcsv($file_handle, $csv_field, NULL, NULL) );
+ try {
+ var_dump( fputcsv($file_handle, $csv_field, NULL, NULL) );
+ } catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
// check the file pointer position and eof
var_dump( ftell($file_handle) );
var_dump( feof($file_handle) );
@@ -72,869 +76,653 @@ foreach ($csv_lists as $csv_list) {
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
*** Testing fputcsv() : with delimiter and enclosure as NULL ***
-- file opened in r+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in r+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in a+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in w+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+ --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+b --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
-- file opened in x+t --
-
-Warning: fputcsv(): delimiter must be a character in %s on line %d
-bool(false)
+delimiter must be a character
int(0)
bool(false)
string(0) ""
diff --git a/ext/standard/tests/file/fread_basic.phpt b/ext/standard/tests/file/fread_basic.phpt
index 80175ef37f..c97bc05d35 100644
--- a/ext/standard/tests/file/fread_basic.phpt
+++ b/ext/standard/tests/file/fread_basic.phpt
@@ -54,7 +54,7 @@ $file_content_types = array("numeric","text","text_with_new_line","alphanumeric"
exit();
}
- /* read file by giving the acutal length, check the length and content by calculating the
+ /* read file by giving the actual length, check the length and content by calculating the
hash using md5() function
*/
/* Reading 1024 bytes from file, expecting 1024 bytes */ ;
diff --git a/ext/standard/tests/file/fread_error.phpt b/ext/standard/tests/file/fread_error.phpt
index 1c4068cd97..953df79556 100644
--- a/ext/standard/tests/file/fread_error.phpt
+++ b/ext/standard/tests/file/fread_error.phpt
@@ -14,101 +14,24 @@ echo "*** Testing error conditions ***\n";
$filename = __FILE__;
$file_handle = fopen($filename, "r");
-// zero argument
-echo "-- Testing fread() with zero argument --\n";
-var_dump( fread() );
-
-// more than expected no. of args
-echo "-- Testing fread() with more than expected number of arguments --\n";
-var_dump( fread($file_handle, 10, $file_handle) );
-
// invalid length argument
echo "-- Testing fread() with invalid length arguments --\n";
$len = 0;
-var_dump( fread($file_handle, $len) );
-$len = -10;
-var_dump( fread($file_handle, $len) );
-
-// test invalid arguments : non-resources
-echo "-- Testing fread() with invalid arguments --\n";
-$invalid_args = array (
- "string",
- 10,
- 10.5,
- true,
- array(1,2,3),
- new stdclass,
-);
-/* loop to test fread() with different invalid type of args */
-for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) {
- echo "-- Iteration $loop_counter --\n";
- var_dump( fread($invalid_args[$loop_counter - 1], 10) );
+try {
+ var_dump( fread($file_handle, $len) );
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
}
-// fwrite() on a file handle which is already closed
-echo "-- Testing fwrite() with closed/unset file handle --\n";
-fclose($file_handle);
-var_dump( fread($file_handle,$file_content_type) );
-
-// fwrite on a file handle which is unset
-$fp = fopen($filename, "r");
-unset($fp); //unset file handle
-var_dump( fread(@$fp,10) );
-var_dump( fclose(@$fp) );
+$len = -10;
+try {
+ var_dump( fread($file_handle, $len) );
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
-echo "Done\n";
---EXPECTF--
+--EXPECT--
*** Testing error conditions ***
--- Testing fread() with zero argument --
-
-Warning: fread() expects exactly 2 parameters, 0 given in %s on line %d
-bool(false)
--- Testing fread() with more than expected number of arguments --
-
-Warning: fread() expects exactly 2 parameters, 3 given in %s on line %d
-bool(false)
-- Testing fread() with invalid length arguments --
-
-Warning: fread(): Length parameter must be greater than 0 in %s on line %d
-bool(false)
-
-Warning: fread(): Length parameter must be greater than 0 in %s on line %d
-bool(false)
--- Testing fread() with invalid arguments --
--- Iteration 1 --
-
-Warning: fread() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
--- Iteration 2 --
-
-Warning: fread() expects parameter 1 to be resource, int given in %s on line %d
-bool(false)
--- Iteration 3 --
-
-Warning: fread() expects parameter 1 to be resource, float given in %s on line %d
-bool(false)
--- Iteration 4 --
-
-Warning: fread() expects parameter 1 to be resource, bool given in %s on line %d
-bool(false)
--- Iteration 5 --
-
-Warning: fread() expects parameter 1 to be resource, array given in %s on line %d
-bool(false)
--- Iteration 6 --
-
-Warning: fread() expects parameter 1 to be resource, object given in %s on line %d
-bool(false)
--- Testing fwrite() with closed/unset file handle --
-
-Notice: Undefined variable: file_content_type in %s on line %d
-
-Warning: fread(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: fread() expects parameter 1 to be resource, null given in %s on line %d
-bool(false)
-
-Warning: fclose() expects parameter 1 to be resource, null given in %s on line %d
-bool(false)
-Done
+Length parameter must be greater than 0
+Length parameter must be greater than 0
diff --git a/ext/standard/tests/file/fread_variation1.phpt b/ext/standard/tests/file/fread_variation1.phpt
index df9c6da8f5..4434887c15 100644
--- a/ext/standard/tests/file/fread_variation1.phpt
+++ b/ext/standard/tests/file/fread_variation1.phpt
@@ -79,7 +79,7 @@ foreach($file_content_types as $file_content_type) {
}
rewind($file_handle);
- echo "-- Reading entire file content, expeceted : 1024 bytes --\n";
+ echo "-- Reading entire file content, expected : 1024 bytes --\n";
// read from file, by giving the file actual size,
$data_from_file = check_read($file_handle, 1024, (strstr($file_mode, "+") ? 1024 : 1024 ) );
// calculate the hash and dump it, if data read, expecting here no data was read
@@ -87,7 +87,7 @@ foreach($file_content_types as $file_content_type) {
var_dump( md5($data_from_file) );
// reading file by giving less than its size
- echo "-- Reading file content less than max. file size, expeceted : 1000 bytes --\n";
+ echo "-- Reading file content less than max. file size, expected : 1000 bytes --\n";
rewind($file_handle);
$data_from_file = check_read($file_handle, 1000, (strstr($file_mode, "+") ? 1000 : 1000 ) );
// calculate the hash and dump it, if data read, expecting here no data was read
@@ -109,14 +109,14 @@ echo"Done\n";
-- Testing fread() with file having content of type numeric --
-- File opened in mode a+ --
--- Reading entire file content, expeceted : 1024 bytes --
+-- Reading entire file content, expected : 1024 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(false)
string(32) "950b7457d1deb6332f2fc5d42f3129d6"
--- Reading file content less than max. file size, expeceted : 1000 bytes --
+-- Reading file content less than max. file size, expected : 1000 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 1000 bytes ... OK
@@ -124,14 +124,14 @@ int(1000)
bool(false)
string(32) "4501f99f2b79d0345f26f1394aca58a3"
-- File opened in mode a+b --
--- Reading entire file content, expeceted : 1024 bytes --
+-- Reading entire file content, expected : 1024 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(false)
string(32) "950b7457d1deb6332f2fc5d42f3129d6"
--- Reading file content less than max. file size, expeceted : 1000 bytes --
+-- Reading file content less than max. file size, expected : 1000 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 1000 bytes ... OK
@@ -139,14 +139,14 @@ int(1000)
bool(false)
string(32) "4501f99f2b79d0345f26f1394aca58a3"
-- File opened in mode a+t --
--- Reading entire file content, expeceted : 1024 bytes --
+-- Reading entire file content, expected : 1024 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(false)
string(32) "950b7457d1deb6332f2fc5d42f3129d6"
--- Reading file content less than max. file size, expeceted : 1000 bytes --
+-- Reading file content less than max. file size, expected : 1000 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 1000 bytes ... OK
@@ -154,14 +154,14 @@ int(1000)
bool(false)
string(32) "4501f99f2b79d0345f26f1394aca58a3"
-- File opened in mode w+ --
--- Reading entire file content, expeceted : 1024 bytes --
+-- Reading entire file content, expected : 1024 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(false)
string(32) "950b7457d1deb6332f2fc5d42f3129d6"
--- Reading file content less than max. file size, expeceted : 1000 bytes --
+-- Reading file content less than max. file size, expected : 1000 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 1000 bytes ... OK
@@ -169,14 +169,14 @@ int(1000)
bool(false)
string(32) "4501f99f2b79d0345f26f1394aca58a3"
-- File opened in mode w+b --
--- Reading entire file content, expeceted : 1024 bytes --
+-- Reading entire file content, expected : 1024 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(false)
string(32) "950b7457d1deb6332f2fc5d42f3129d6"
--- Reading file content less than max. file size, expeceted : 1000 bytes --
+-- Reading file content less than max. file size, expected : 1000 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 1000 bytes ... OK
@@ -184,14 +184,14 @@ int(1000)
bool(false)
string(32) "4501f99f2b79d0345f26f1394aca58a3"
-- File opened in mode w+t --
--- Reading entire file content, expeceted : 1024 bytes --
+-- Reading entire file content, expected : 1024 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(false)
string(32) "950b7457d1deb6332f2fc5d42f3129d6"
--- Reading file content less than max. file size, expeceted : 1000 bytes --
+-- Reading file content less than max. file size, expected : 1000 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 1000 bytes ... OK
@@ -199,14 +199,14 @@ int(1000)
bool(false)
string(32) "4501f99f2b79d0345f26f1394aca58a3"
-- File opened in mode x+ --
--- Reading entire file content, expeceted : 1024 bytes --
+-- Reading entire file content, expected : 1024 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(false)
string(32) "950b7457d1deb6332f2fc5d42f3129d6"
--- Reading file content less than max. file size, expeceted : 1000 bytes --
+-- Reading file content less than max. file size, expected : 1000 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 1000 bytes ... OK
@@ -214,14 +214,14 @@ int(1000)
bool(false)
string(32) "4501f99f2b79d0345f26f1394aca58a3"
-- File opened in mode x+b --
--- Reading entire file content, expeceted : 1024 bytes --
+-- Reading entire file content, expected : 1024 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(false)
string(32) "950b7457d1deb6332f2fc5d42f3129d6"
--- Reading file content less than max. file size, expeceted : 1000 bytes --
+-- Reading file content less than max. file size, expected : 1000 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 1000 bytes ... OK
@@ -229,14 +229,14 @@ int(1000)
bool(false)
string(32) "4501f99f2b79d0345f26f1394aca58a3"
-- File opened in mode x+t --
--- Reading entire file content, expeceted : 1024 bytes --
+-- Reading entire file content, expected : 1024 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(false)
string(32) "950b7457d1deb6332f2fc5d42f3129d6"
--- Reading file content less than max. file size, expeceted : 1000 bytes --
+-- Reading file content less than max. file size, expected : 1000 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 1000 bytes ... OK
@@ -246,14 +246,14 @@ string(32) "4501f99f2b79d0345f26f1394aca58a3"
-- Testing fread() with file having content of type text --
-- File opened in mode a+ --
--- Reading entire file content, expeceted : 1024 bytes --
+-- Reading entire file content, expected : 1024 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(false)
string(32) "e486000c4c8452774f746a27658d87fa"
--- Reading file content less than max. file size, expeceted : 1000 bytes --
+-- Reading file content less than max. file size, expected : 1000 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 1000 bytes ... OK
@@ -261,14 +261,14 @@ int(1000)
bool(false)
string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd"
-- File opened in mode a+b --
--- Reading entire file content, expeceted : 1024 bytes --
+-- Reading entire file content, expected : 1024 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(false)
string(32) "e486000c4c8452774f746a27658d87fa"
--- Reading file content less than max. file size, expeceted : 1000 bytes --
+-- Reading file content less than max. file size, expected : 1000 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 1000 bytes ... OK
@@ -276,14 +276,14 @@ int(1000)
bool(false)
string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd"
-- File opened in mode a+t --
--- Reading entire file content, expeceted : 1024 bytes --
+-- Reading entire file content, expected : 1024 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(false)
string(32) "e486000c4c8452774f746a27658d87fa"
--- Reading file content less than max. file size, expeceted : 1000 bytes --
+-- Reading file content less than max. file size, expected : 1000 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 1000 bytes ... OK
@@ -291,14 +291,14 @@ int(1000)
bool(false)
string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd"
-- File opened in mode w+ --
--- Reading entire file content, expeceted : 1024 bytes --
+-- Reading entire file content, expected : 1024 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(false)
string(32) "e486000c4c8452774f746a27658d87fa"
--- Reading file content less than max. file size, expeceted : 1000 bytes --
+-- Reading file content less than max. file size, expected : 1000 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 1000 bytes ... OK
@@ -306,14 +306,14 @@ int(1000)
bool(false)
string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd"
-- File opened in mode w+b --
--- Reading entire file content, expeceted : 1024 bytes --
+-- Reading entire file content, expected : 1024 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(false)
string(32) "e486000c4c8452774f746a27658d87fa"
--- Reading file content less than max. file size, expeceted : 1000 bytes --
+-- Reading file content less than max. file size, expected : 1000 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 1000 bytes ... OK
@@ -321,14 +321,14 @@ int(1000)
bool(false)
string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd"
-- File opened in mode w+t --
--- Reading entire file content, expeceted : 1024 bytes --
+-- Reading entire file content, expected : 1024 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(false)
string(32) "e486000c4c8452774f746a27658d87fa"
--- Reading file content less than max. file size, expeceted : 1000 bytes --
+-- Reading file content less than max. file size, expected : 1000 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 1000 bytes ... OK
@@ -336,14 +336,14 @@ int(1000)
bool(false)
string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd"
-- File opened in mode x+ --
--- Reading entire file content, expeceted : 1024 bytes --
+-- Reading entire file content, expected : 1024 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(false)
string(32) "e486000c4c8452774f746a27658d87fa"
--- Reading file content less than max. file size, expeceted : 1000 bytes --
+-- Reading file content less than max. file size, expected : 1000 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 1000 bytes ... OK
@@ -351,14 +351,14 @@ int(1000)
bool(false)
string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd"
-- File opened in mode x+b --
--- Reading entire file content, expeceted : 1024 bytes --
+-- Reading entire file content, expected : 1024 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(false)
string(32) "e486000c4c8452774f746a27658d87fa"
--- Reading file content less than max. file size, expeceted : 1000 bytes --
+-- Reading file content less than max. file size, expected : 1000 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 1000 bytes ... OK
@@ -366,14 +366,14 @@ int(1000)
bool(false)
string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd"
-- File opened in mode x+t --
--- Reading entire file content, expeceted : 1024 bytes --
+-- Reading entire file content, expected : 1024 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(false)
string(32) "e486000c4c8452774f746a27658d87fa"
--- Reading file content less than max. file size, expeceted : 1000 bytes --
+-- Reading file content less than max. file size, expected : 1000 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 1000 bytes ... OK
@@ -383,14 +383,14 @@ string(32) "2ec76a59f8c44b8f8a0f5139f61bb1bd"
-- Testing fread() with file having content of type text_with_new_line --
-- File opened in mode a+ --
--- Reading entire file content, expeceted : 1024 bytes --
+-- Reading entire file content, expected : 1024 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(false)
string(32) "b09c8026a64a88d36d4c2f17983964bb"
--- Reading file content less than max. file size, expeceted : 1000 bytes --
+-- Reading file content less than max. file size, expected : 1000 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 1000 bytes ... OK
@@ -398,14 +398,14 @@ int(1000)
bool(false)
string(32) "a148fa8110bbac875d84fc9d7056c0a1"
-- File opened in mode a+b --
--- Reading entire file content, expeceted : 1024 bytes --
+-- Reading entire file content, expected : 1024 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(false)
string(32) "b09c8026a64a88d36d4c2f17983964bb"
--- Reading file content less than max. file size, expeceted : 1000 bytes --
+-- Reading file content less than max. file size, expected : 1000 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 1000 bytes ... OK
@@ -413,14 +413,14 @@ int(1000)
bool(false)
string(32) "a148fa8110bbac875d84fc9d7056c0a1"
-- File opened in mode a+t --
--- Reading entire file content, expeceted : 1024 bytes --
+-- Reading entire file content, expected : 1024 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(false)
string(32) "b09c8026a64a88d36d4c2f17983964bb"
--- Reading file content less than max. file size, expeceted : 1000 bytes --
+-- Reading file content less than max. file size, expected : 1000 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 1000 bytes ... OK
@@ -428,14 +428,14 @@ int(1000)
bool(false)
string(32) "a148fa8110bbac875d84fc9d7056c0a1"
-- File opened in mode w+ --
--- Reading entire file content, expeceted : 1024 bytes --
+-- Reading entire file content, expected : 1024 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(false)
string(32) "b09c8026a64a88d36d4c2f17983964bb"
--- Reading file content less than max. file size, expeceted : 1000 bytes --
+-- Reading file content less than max. file size, expected : 1000 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 1000 bytes ... OK
@@ -443,14 +443,14 @@ int(1000)
bool(false)
string(32) "a148fa8110bbac875d84fc9d7056c0a1"
-- File opened in mode w+b --
--- Reading entire file content, expeceted : 1024 bytes --
+-- Reading entire file content, expected : 1024 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(false)
string(32) "b09c8026a64a88d36d4c2f17983964bb"
--- Reading file content less than max. file size, expeceted : 1000 bytes --
+-- Reading file content less than max. file size, expected : 1000 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 1000 bytes ... OK
@@ -458,14 +458,14 @@ int(1000)
bool(false)
string(32) "a148fa8110bbac875d84fc9d7056c0a1"
-- File opened in mode w+t --
--- Reading entire file content, expeceted : 1024 bytes --
+-- Reading entire file content, expected : 1024 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(false)
string(32) "b09c8026a64a88d36d4c2f17983964bb"
--- Reading file content less than max. file size, expeceted : 1000 bytes --
+-- Reading file content less than max. file size, expected : 1000 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 1000 bytes ... OK
@@ -473,14 +473,14 @@ int(1000)
bool(false)
string(32) "a148fa8110bbac875d84fc9d7056c0a1"
-- File opened in mode x+ --
--- Reading entire file content, expeceted : 1024 bytes --
+-- Reading entire file content, expected : 1024 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(false)
string(32) "b09c8026a64a88d36d4c2f17983964bb"
--- Reading file content less than max. file size, expeceted : 1000 bytes --
+-- Reading file content less than max. file size, expected : 1000 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 1000 bytes ... OK
@@ -488,14 +488,14 @@ int(1000)
bool(false)
string(32) "a148fa8110bbac875d84fc9d7056c0a1"
-- File opened in mode x+b --
--- Reading entire file content, expeceted : 1024 bytes --
+-- Reading entire file content, expected : 1024 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(false)
string(32) "b09c8026a64a88d36d4c2f17983964bb"
--- Reading file content less than max. file size, expeceted : 1000 bytes --
+-- Reading file content less than max. file size, expected : 1000 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 1000 bytes ... OK
@@ -503,14 +503,14 @@ int(1000)
bool(false)
string(32) "a148fa8110bbac875d84fc9d7056c0a1"
-- File opened in mode x+t --
--- Reading entire file content, expeceted : 1024 bytes --
+-- Reading entire file content, expected : 1024 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(false)
string(32) "b09c8026a64a88d36d4c2f17983964bb"
--- Reading file content less than max. file size, expeceted : 1000 bytes --
+-- Reading file content less than max. file size, expected : 1000 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 1000 bytes ... OK
@@ -520,14 +520,14 @@ string(32) "a148fa8110bbac875d84fc9d7056c0a1"
-- Testing fread() with file having content of type alphanumeric --
-- File opened in mode a+ --
--- Reading entire file content, expeceted : 1024 bytes --
+-- Reading entire file content, expected : 1024 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(false)
string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
--- Reading file content less than max. file size, expeceted : 1000 bytes --
+-- Reading file content less than max. file size, expected : 1000 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 1000 bytes ... OK
@@ -535,14 +535,14 @@ int(1000)
bool(false)
string(32) "a49d752f980184c7f44568e930f89c72"
-- File opened in mode a+b --
--- Reading entire file content, expeceted : 1024 bytes --
+-- Reading entire file content, expected : 1024 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(false)
string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
--- Reading file content less than max. file size, expeceted : 1000 bytes --
+-- Reading file content less than max. file size, expected : 1000 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 1000 bytes ... OK
@@ -550,14 +550,14 @@ int(1000)
bool(false)
string(32) "a49d752f980184c7f44568e930f89c72"
-- File opened in mode a+t --
--- Reading entire file content, expeceted : 1024 bytes --
+-- Reading entire file content, expected : 1024 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(false)
string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
--- Reading file content less than max. file size, expeceted : 1000 bytes --
+-- Reading file content less than max. file size, expected : 1000 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 1000 bytes ... OK
@@ -565,14 +565,14 @@ int(1000)
bool(false)
string(32) "a49d752f980184c7f44568e930f89c72"
-- File opened in mode w+ --
--- Reading entire file content, expeceted : 1024 bytes --
+-- Reading entire file content, expected : 1024 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(false)
string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
--- Reading file content less than max. file size, expeceted : 1000 bytes --
+-- Reading file content less than max. file size, expected : 1000 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 1000 bytes ... OK
@@ -580,14 +580,14 @@ int(1000)
bool(false)
string(32) "a49d752f980184c7f44568e930f89c72"
-- File opened in mode w+b --
--- Reading entire file content, expeceted : 1024 bytes --
+-- Reading entire file content, expected : 1024 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(false)
string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
--- Reading file content less than max. file size, expeceted : 1000 bytes --
+-- Reading file content less than max. file size, expected : 1000 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 1000 bytes ... OK
@@ -595,14 +595,14 @@ int(1000)
bool(false)
string(32) "a49d752f980184c7f44568e930f89c72"
-- File opened in mode w+t --
--- Reading entire file content, expeceted : 1024 bytes --
+-- Reading entire file content, expected : 1024 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(false)
string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
--- Reading file content less than max. file size, expeceted : 1000 bytes --
+-- Reading file content less than max. file size, expected : 1000 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 1000 bytes ... OK
@@ -610,14 +610,14 @@ int(1000)
bool(false)
string(32) "a49d752f980184c7f44568e930f89c72"
-- File opened in mode x+ --
--- Reading entire file content, expeceted : 1024 bytes --
+-- Reading entire file content, expected : 1024 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(false)
string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
--- Reading file content less than max. file size, expeceted : 1000 bytes --
+-- Reading file content less than max. file size, expected : 1000 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 1000 bytes ... OK
@@ -625,14 +625,14 @@ int(1000)
bool(false)
string(32) "a49d752f980184c7f44568e930f89c72"
-- File opened in mode x+b --
--- Reading entire file content, expeceted : 1024 bytes --
+-- Reading entire file content, expected : 1024 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(false)
string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
--- Reading file content less than max. file size, expeceted : 1000 bytes --
+-- Reading file content less than max. file size, expected : 1000 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 1000 bytes ... OK
@@ -640,14 +640,14 @@ int(1000)
bool(false)
string(32) "a49d752f980184c7f44568e930f89c72"
-- File opened in mode x+t --
--- Reading entire file content, expeceted : 1024 bytes --
+-- Reading entire file content, expected : 1024 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(false)
string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
--- Reading file content less than max. file size, expeceted : 1000 bytes --
+-- Reading file content less than max. file size, expected : 1000 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 1000 bytes ... OK
diff --git a/ext/standard/tests/file/fread_variation2.phpt b/ext/standard/tests/file/fread_variation2.phpt
index 908ce90f2e..07ed6c3e6f 100644
--- a/ext/standard/tests/file/fread_variation2.phpt
+++ b/ext/standard/tests/file/fread_variation2.phpt
@@ -78,7 +78,7 @@ foreach($file_content_types as $file_content_type) {
}
rewind($file_handle);
- echo "-- Reading entire file content, expeceted : 0 bytes --\n";
+ echo "-- Reading entire file content, expected : 0 bytes --\n";
// read from file, by giving the file actual size,
$data_from_file = check_read($file_handle, 1024, (strstr($file_mode, "+") ? 1024 : 0 ) );
// calculate the hash and dump it, if data read, expecting here no data was read
@@ -86,7 +86,7 @@ foreach($file_content_types as $file_content_type) {
var_dump( md5($data_from_file) );
// reading file by giving less than its size
- echo "-- Reading file content less than max. file size, expeceted : 0 bytes --\n";
+ echo "-- Reading file content less than max. file size, expected : 0 bytes --\n";
rewind($file_handle);
$data_from_file = check_read($file_handle, 1000, (strstr($file_mode, "+") ? 1000 : 0 ) );
// calculate the hash and dump it, if data read, expecting here no data was read
@@ -108,172 +108,172 @@ echo "Done\n";
-- Testing fread() with file having content of type numeric --
-- File opened in mode a --
--- Reading entire file content, expeceted : 0 bytes --
+-- Reading entire file content, expected : 0 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading file content less than max. file size, expeceted : 0 bytes --
+-- Reading file content less than max. file size, expected : 0 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
-- File opened in mode ab --
--- Reading entire file content, expeceted : 0 bytes --
+-- Reading entire file content, expected : 0 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading file content less than max. file size, expeceted : 0 bytes --
+-- Reading file content less than max. file size, expected : 0 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
-- File opened in mode at --
--- Reading entire file content, expeceted : 0 bytes --
+-- Reading entire file content, expected : 0 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading file content less than max. file size, expeceted : 0 bytes --
+-- Reading file content less than max. file size, expected : 0 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
-- File opened in mode w --
--- Reading entire file content, expeceted : 0 bytes --
+-- Reading entire file content, expected : 0 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading file content less than max. file size, expeceted : 0 bytes --
+-- Reading file content less than max. file size, expected : 0 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
-- File opened in mode wb --
--- Reading entire file content, expeceted : 0 bytes --
+-- Reading entire file content, expected : 0 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading file content less than max. file size, expeceted : 0 bytes --
+-- Reading file content less than max. file size, expected : 0 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
-- File opened in mode wt --
--- Reading entire file content, expeceted : 0 bytes --
+-- Reading entire file content, expected : 0 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading file content less than max. file size, expeceted : 0 bytes --
+-- Reading file content less than max. file size, expected : 0 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
-- File opened in mode x --
--- Reading entire file content, expeceted : 0 bytes --
+-- Reading entire file content, expected : 0 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading file content less than max. file size, expeceted : 0 bytes --
+-- Reading file content less than max. file size, expected : 0 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
-- File opened in mode xb --
--- Reading entire file content, expeceted : 0 bytes --
+-- Reading entire file content, expected : 0 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading file content less than max. file size, expeceted : 0 bytes --
+-- Reading file content less than max. file size, expected : 0 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
-- File opened in mode xt --
--- Reading entire file content, expeceted : 0 bytes --
+-- Reading entire file content, expected : 0 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading file content less than max. file size, expeceted : 0 bytes --
+-- Reading file content less than max. file size, expected : 0 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
@@ -281,172 +281,172 @@ bool(false)
-- Testing fread() with file having content of type text --
-- File opened in mode a --
--- Reading entire file content, expeceted : 0 bytes --
+-- Reading entire file content, expected : 0 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading file content less than max. file size, expeceted : 0 bytes --
+-- Reading file content less than max. file size, expected : 0 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
-- File opened in mode ab --
--- Reading entire file content, expeceted : 0 bytes --
+-- Reading entire file content, expected : 0 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading file content less than max. file size, expeceted : 0 bytes --
+-- Reading file content less than max. file size, expected : 0 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
-- File opened in mode at --
--- Reading entire file content, expeceted : 0 bytes --
+-- Reading entire file content, expected : 0 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading file content less than max. file size, expeceted : 0 bytes --
+-- Reading file content less than max. file size, expected : 0 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
-- File opened in mode w --
--- Reading entire file content, expeceted : 0 bytes --
+-- Reading entire file content, expected : 0 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading file content less than max. file size, expeceted : 0 bytes --
+-- Reading file content less than max. file size, expected : 0 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
-- File opened in mode wb --
--- Reading entire file content, expeceted : 0 bytes --
+-- Reading entire file content, expected : 0 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading file content less than max. file size, expeceted : 0 bytes --
+-- Reading file content less than max. file size, expected : 0 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
-- File opened in mode wt --
--- Reading entire file content, expeceted : 0 bytes --
+-- Reading entire file content, expected : 0 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading file content less than max. file size, expeceted : 0 bytes --
+-- Reading file content less than max. file size, expected : 0 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
-- File opened in mode x --
--- Reading entire file content, expeceted : 0 bytes --
+-- Reading entire file content, expected : 0 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading file content less than max. file size, expeceted : 0 bytes --
+-- Reading file content less than max. file size, expected : 0 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
-- File opened in mode xb --
--- Reading entire file content, expeceted : 0 bytes --
+-- Reading entire file content, expected : 0 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading file content less than max. file size, expeceted : 0 bytes --
+-- Reading file content less than max. file size, expected : 0 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
-- File opened in mode xt --
--- Reading entire file content, expeceted : 0 bytes --
+-- Reading entire file content, expected : 0 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading file content less than max. file size, expeceted : 0 bytes --
+-- Reading file content less than max. file size, expected : 0 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
@@ -454,172 +454,172 @@ bool(false)
-- Testing fread() with file having content of type text_with_new_line --
-- File opened in mode a --
--- Reading entire file content, expeceted : 0 bytes --
+-- Reading entire file content, expected : 0 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading file content less than max. file size, expeceted : 0 bytes --
+-- Reading file content less than max. file size, expected : 0 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
-- File opened in mode ab --
--- Reading entire file content, expeceted : 0 bytes --
+-- Reading entire file content, expected : 0 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading file content less than max. file size, expeceted : 0 bytes --
+-- Reading file content less than max. file size, expected : 0 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
-- File opened in mode at --
--- Reading entire file content, expeceted : 0 bytes --
+-- Reading entire file content, expected : 0 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading file content less than max. file size, expeceted : 0 bytes --
+-- Reading file content less than max. file size, expected : 0 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
-- File opened in mode w --
--- Reading entire file content, expeceted : 0 bytes --
+-- Reading entire file content, expected : 0 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading file content less than max. file size, expeceted : 0 bytes --
+-- Reading file content less than max. file size, expected : 0 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
-- File opened in mode wb --
--- Reading entire file content, expeceted : 0 bytes --
+-- Reading entire file content, expected : 0 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading file content less than max. file size, expeceted : 0 bytes --
+-- Reading file content less than max. file size, expected : 0 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
-- File opened in mode wt --
--- Reading entire file content, expeceted : 0 bytes --
+-- Reading entire file content, expected : 0 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading file content less than max. file size, expeceted : 0 bytes --
+-- Reading file content less than max. file size, expected : 0 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
-- File opened in mode x --
--- Reading entire file content, expeceted : 0 bytes --
+-- Reading entire file content, expected : 0 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading file content less than max. file size, expeceted : 0 bytes --
+-- Reading file content less than max. file size, expected : 0 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
-- File opened in mode xb --
--- Reading entire file content, expeceted : 0 bytes --
+-- Reading entire file content, expected : 0 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading file content less than max. file size, expeceted : 0 bytes --
+-- Reading file content less than max. file size, expected : 0 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
-- File opened in mode xt --
--- Reading entire file content, expeceted : 0 bytes --
+-- Reading entire file content, expected : 0 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading file content less than max. file size, expeceted : 0 bytes --
+-- Reading file content less than max. file size, expected : 0 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
@@ -627,172 +627,172 @@ bool(false)
-- Testing fread() with file having content of type alphanumeric --
-- File opened in mode a --
--- Reading entire file content, expeceted : 0 bytes --
+-- Reading entire file content, expected : 0 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading file content less than max. file size, expeceted : 0 bytes --
+-- Reading file content less than max. file size, expected : 0 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
-- File opened in mode ab --
--- Reading entire file content, expeceted : 0 bytes --
+-- Reading entire file content, expected : 0 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading file content less than max. file size, expeceted : 0 bytes --
+-- Reading file content less than max. file size, expected : 0 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
-- File opened in mode at --
--- Reading entire file content, expeceted : 0 bytes --
+-- Reading entire file content, expected : 0 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading file content less than max. file size, expeceted : 0 bytes --
+-- Reading file content less than max. file size, expected : 0 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
-- File opened in mode w --
--- Reading entire file content, expeceted : 0 bytes --
+-- Reading entire file content, expected : 0 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading file content less than max. file size, expeceted : 0 bytes --
+-- Reading file content less than max. file size, expected : 0 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
-- File opened in mode wb --
--- Reading entire file content, expeceted : 0 bytes --
+-- Reading entire file content, expected : 0 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading file content less than max. file size, expeceted : 0 bytes --
+-- Reading file content less than max. file size, expected : 0 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
-- File opened in mode wt --
--- Reading entire file content, expeceted : 0 bytes --
+-- Reading entire file content, expected : 0 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading file content less than max. file size, expeceted : 0 bytes --
+-- Reading file content less than max. file size, expected : 0 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
-- File opened in mode x --
--- Reading entire file content, expeceted : 0 bytes --
+-- Reading entire file content, expected : 0 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading file content less than max. file size, expeceted : 0 bytes --
+-- Reading file content less than max. file size, expected : 0 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
-- File opened in mode xb --
--- Reading entire file content, expeceted : 0 bytes --
+-- Reading entire file content, expected : 0 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading file content less than max. file size, expeceted : 0 bytes --
+-- Reading file content less than max. file size, expected : 0 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
-- File opened in mode xt --
--- Reading entire file content, expeceted : 0 bytes --
+-- Reading entire file content, expected : 0 bytes --
int(0)
bool(false)
Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading file content less than max. file size, expeceted : 0 bytes --
+-- Reading file content less than max. file size, expected : 0 bytes --
int(0)
bool(false)
Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
diff --git a/ext/standard/tests/file/fread_variation3-win32-mb.phpt b/ext/standard/tests/file/fread_variation3-win32-mb.phpt
index cbc1b6d60b..43ccbe87ea 100644
--- a/ext/standard/tests/file/fread_variation3-win32-mb.phpt
+++ b/ext/standard/tests/file/fread_variation3-win32-mb.phpt
@@ -84,14 +84,14 @@ foreach($file_content_types as $file_content_type) {
rewind($file_handle);
// read file by giving size more than its size
- echo "-- Reading beyond filesize, expeceted : 1024 bytes --\n";
+ echo "-- Reading beyond filesize, expected : 1024 bytes --\n";
rewind($file_handle);
$data_from_file = check_read($file_handle, 1030, ( strstr($file_mode, "+") ? 1024 : 1024) );
if ( $data_from_file != false)
var_dump( md5($data_from_file) );
rewind($file_handle);
- echo "-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --\n";
+ echo "-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --\n";
// try fread when file pointer at end
fseek($file_handle, 0, SEEK_END);
//reading file when file pointer at end
@@ -114,126 +114,126 @@ echo"Done\n";
-- Testing fread() with file having content of type numeric --
-- File opened in mode a+ --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "950b7457d1deb6332f2fc5d42f3129d6"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode a+b --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "950b7457d1deb6332f2fc5d42f3129d6"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode a+t --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "950b7457d1deb6332f2fc5d42f3129d6"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode w+ --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "950b7457d1deb6332f2fc5d42f3129d6"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode w+b --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "950b7457d1deb6332f2fc5d42f3129d6"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode w+t --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "950b7457d1deb6332f2fc5d42f3129d6"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode x+ --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "950b7457d1deb6332f2fc5d42f3129d6"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode x+b --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "950b7457d1deb6332f2fc5d42f3129d6"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode x+t --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "950b7457d1deb6332f2fc5d42f3129d6"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
@@ -242,126 +242,126 @@ bool(true)
-- Testing fread() with file having content of type text --
-- File opened in mode a+ --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "e486000c4c8452774f746a27658d87fa"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode a+b --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "e486000c4c8452774f746a27658d87fa"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode a+t --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "e486000c4c8452774f746a27658d87fa"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode w+ --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "e486000c4c8452774f746a27658d87fa"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode w+b --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "e486000c4c8452774f746a27658d87fa"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode w+t --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "e486000c4c8452774f746a27658d87fa"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode x+ --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "e486000c4c8452774f746a27658d87fa"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode x+b --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "e486000c4c8452774f746a27658d87fa"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode x+t --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "e486000c4c8452774f746a27658d87fa"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
@@ -370,126 +370,126 @@ bool(true)
-- Testing fread() with file having content of type text_with_new_line --
-- File opened in mode a+ --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "b09c8026a64a88d36d4c2f17983964bb"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode a+b --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "b09c8026a64a88d36d4c2f17983964bb"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode a+t --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "b09c8026a64a88d36d4c2f17983964bb"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode w+ --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "b09c8026a64a88d36d4c2f17983964bb"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode w+b --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "b09c8026a64a88d36d4c2f17983964bb"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode w+t --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "b09c8026a64a88d36d4c2f17983964bb"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1137)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1137)
bool(true)
-- File opened in mode x+ --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "b09c8026a64a88d36d4c2f17983964bb"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode x+b --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "b09c8026a64a88d36d4c2f17983964bb"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode x+t --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "b09c8026a64a88d36d4c2f17983964bb"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1137)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
diff --git a/ext/standard/tests/file/fread_variation3-win32.phpt b/ext/standard/tests/file/fread_variation3-win32.phpt
index d09917207e..c5a1eef26d 100644
--- a/ext/standard/tests/file/fread_variation3-win32.phpt
+++ b/ext/standard/tests/file/fread_variation3-win32.phpt
@@ -84,14 +84,14 @@ foreach($file_content_types as $file_content_type) {
rewind($file_handle);
// read file by giving size more than its size
- echo "-- Reading beyond filesize, expeceted : 1024 bytes --\n";
+ echo "-- Reading beyond filesize, expected : 1024 bytes --\n";
rewind($file_handle);
$data_from_file = check_read($file_handle, 1030, ( strstr($file_mode, "+") ? 1024 : 1024) );
if ( $data_from_file != false)
var_dump( md5($data_from_file) );
rewind($file_handle);
- echo "-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --\n";
+ echo "-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --\n";
// try fread when file pointer at end
fseek($file_handle, 0, SEEK_END);
//reading file when file pointer at end
@@ -114,126 +114,126 @@ echo"Done\n";
-- Testing fread() with file having content of type numeric --
-- File opened in mode a+ --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "950b7457d1deb6332f2fc5d42f3129d6"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode a+b --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "950b7457d1deb6332f2fc5d42f3129d6"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode a+t --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "950b7457d1deb6332f2fc5d42f3129d6"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode w+ --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "950b7457d1deb6332f2fc5d42f3129d6"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode w+b --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "950b7457d1deb6332f2fc5d42f3129d6"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode w+t --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "950b7457d1deb6332f2fc5d42f3129d6"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode x+ --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "950b7457d1deb6332f2fc5d42f3129d6"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode x+b --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "950b7457d1deb6332f2fc5d42f3129d6"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode x+t --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "950b7457d1deb6332f2fc5d42f3129d6"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
@@ -242,126 +242,126 @@ bool(true)
-- Testing fread() with file having content of type text --
-- File opened in mode a+ --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "e486000c4c8452774f746a27658d87fa"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode a+b --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "e486000c4c8452774f746a27658d87fa"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode a+t --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "e486000c4c8452774f746a27658d87fa"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode w+ --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "e486000c4c8452774f746a27658d87fa"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode w+b --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "e486000c4c8452774f746a27658d87fa"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode w+t --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "e486000c4c8452774f746a27658d87fa"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode x+ --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "e486000c4c8452774f746a27658d87fa"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode x+b --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "e486000c4c8452774f746a27658d87fa"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode x+t --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "e486000c4c8452774f746a27658d87fa"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
@@ -370,126 +370,126 @@ bool(true)
-- Testing fread() with file having content of type text_with_new_line --
-- File opened in mode a+ --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "b09c8026a64a88d36d4c2f17983964bb"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode a+b --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "b09c8026a64a88d36d4c2f17983964bb"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode a+t --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "b09c8026a64a88d36d4c2f17983964bb"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode w+ --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "b09c8026a64a88d36d4c2f17983964bb"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode w+b --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "b09c8026a64a88d36d4c2f17983964bb"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode w+t --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "b09c8026a64a88d36d4c2f17983964bb"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1137)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1137)
bool(true)
-- File opened in mode x+ --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "b09c8026a64a88d36d4c2f17983964bb"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode x+b --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "b09c8026a64a88d36d4c2f17983964bb"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode x+t --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "b09c8026a64a88d36d4c2f17983964bb"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1137)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
diff --git a/ext/standard/tests/file/fread_variation3.phpt b/ext/standard/tests/file/fread_variation3.phpt
index b0b374a4c6..9bb735a76c 100644
--- a/ext/standard/tests/file/fread_variation3.phpt
+++ b/ext/standard/tests/file/fread_variation3.phpt
@@ -84,14 +84,14 @@ foreach($file_content_types as $file_content_type) {
rewind($file_handle);
// read file by giving size more than its size
- echo "-- Reading beyond filesize, expeceted : 1024 bytes --\n";
+ echo "-- Reading beyond filesize, expected : 1024 bytes --\n";
rewind($file_handle);
$data_from_file = check_read($file_handle, 1030, ( strstr($file_mode, "+") ? 1024 : 1024) );
if ( $data_from_file != false)
var_dump( md5($data_from_file) );
rewind($file_handle);
- echo "-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --\n";
+ echo "-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --\n";
// try fread when file pointer at end
fseek($file_handle, 0, SEEK_END);
//reading file when file pointer at end
@@ -114,126 +114,126 @@ echo"Done\n";
-- Testing fread() with file having content of type numeric --
-- File opened in mode a+ --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "950b7457d1deb6332f2fc5d42f3129d6"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode a+b --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "950b7457d1deb6332f2fc5d42f3129d6"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode a+t --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "950b7457d1deb6332f2fc5d42f3129d6"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode w+ --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "950b7457d1deb6332f2fc5d42f3129d6"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode w+b --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "950b7457d1deb6332f2fc5d42f3129d6"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode w+t --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "950b7457d1deb6332f2fc5d42f3129d6"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode x+ --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "950b7457d1deb6332f2fc5d42f3129d6"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode x+b --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "950b7457d1deb6332f2fc5d42f3129d6"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode x+t --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "950b7457d1deb6332f2fc5d42f3129d6"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
@@ -242,126 +242,126 @@ bool(true)
-- Testing fread() with file having content of type text --
-- File opened in mode a+ --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "e486000c4c8452774f746a27658d87fa"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode a+b --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "e486000c4c8452774f746a27658d87fa"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode a+t --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "e486000c4c8452774f746a27658d87fa"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode w+ --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "e486000c4c8452774f746a27658d87fa"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode w+b --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "e486000c4c8452774f746a27658d87fa"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode w+t --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "e486000c4c8452774f746a27658d87fa"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode x+ --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "e486000c4c8452774f746a27658d87fa"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode x+b --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "e486000c4c8452774f746a27658d87fa"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode x+t --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "e486000c4c8452774f746a27658d87fa"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
@@ -370,126 +370,126 @@ bool(true)
-- Testing fread() with file having content of type text_with_new_line --
-- File opened in mode a+ --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "b09c8026a64a88d36d4c2f17983964bb"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode a+b --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "b09c8026a64a88d36d4c2f17983964bb"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode a+t --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "b09c8026a64a88d36d4c2f17983964bb"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode w+ --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "b09c8026a64a88d36d4c2f17983964bb"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode w+b --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "b09c8026a64a88d36d4c2f17983964bb"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode w+t --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "b09c8026a64a88d36d4c2f17983964bb"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode x+ --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "b09c8026a64a88d36d4c2f17983964bb"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode x+b --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "b09c8026a64a88d36d4c2f17983964bb"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
int(1024)
bool(true)
-- File opened in mode x+t --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 1024 bytes ... OK
int(1024)
bool(true)
string(32) "b09c8026a64a88d36d4c2f17983964bb"
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ... OK
diff --git a/ext/standard/tests/file/fread_variation4.phpt b/ext/standard/tests/file/fread_variation4.phpt
index de2fceb034..953158e594 100644
--- a/ext/standard/tests/file/fread_variation4.phpt
+++ b/ext/standard/tests/file/fread_variation4.phpt
@@ -75,14 +75,14 @@ foreach($file_content_types as $file_content_type) {
}
rewind($file_handle);
- echo "-- Reading beyond filesize, expeceted : 1024 bytes --\n";
+ echo "-- Reading beyond filesize, expected : 1024 bytes --\n";
// read file by giving size more than its size
rewind($file_handle);
$data_from_file = check_read($file_handle, 1030, ( strstr($file_mode, "+") ? 1024 : 0) );
if ( $data_from_file != false)
var_dump( md5($data_from_file) );
- echo "-- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --\n";
+ echo "-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --\n";
rewind($file_handle);
// try fread when file pointer at end
fseek($file_handle, 0, SEEK_END);
@@ -106,465 +106,465 @@ echo"Done\n";
-- Testing fread() with file having content of type numeric --
-- File opened in mode a --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(1024)
bool(false)
-- File opened in mode ab --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(1024)
bool(false)
-- File opened in mode at --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(1024)
bool(false)
-- File opened in mode w --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(1024)
bool(false)
-- File opened in mode wb --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(1024)
bool(false)
-- File opened in mode wt --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(1024)
bool(false)
-- File opened in mode x --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(1024)
bool(false)
-- File opened in mode xb --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(1024)
bool(false)
-- File opened in mode xt --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(1024)
bool(false)
-- Testing fread() with file having content of type text --
-- File opened in mode a --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(1024)
bool(false)
-- File opened in mode ab --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(1024)
bool(false)
-- File opened in mode at --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(1024)
bool(false)
-- File opened in mode w --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(1024)
bool(false)
-- File opened in mode wb --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(1024)
bool(false)
-- File opened in mode wt --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(1024)
bool(false)
-- File opened in mode x --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(1024)
bool(false)
-- File opened in mode xb --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(1024)
bool(false)
-- File opened in mode xt --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(1024)
bool(false)
-- Testing fread() with file having content of type text_with_new_line --
-- File opened in mode a --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(1024)
bool(false)
-- File opened in mode ab --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(1024)
bool(false)
-- File opened in mode at --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(1024)
bool(false)
-- File opened in mode w --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(1024)
bool(false)
-- File opened in mode wb --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(1024)
bool(false)
-- File opened in mode wt --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(%r1024|1137%r)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(%r1024|1137%r)
bool(false)
-- File opened in mode x --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(1024)
bool(false)
-- File opened in mode xb --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(1024)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(1024)
bool(false)
-- File opened in mode xt --
--- Reading beyond filesize, expeceted : 1024 bytes --
+-- Reading beyond filesize, expected : 1024 bytes --
int(0)
bool(false)
Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(0)
bool(false)
--- Reading beyond filesize when file pointer pointing to EOF, expeceted : 0 bytes --
+-- Reading beyond filesize when file pointer pointing to EOF, expected : 0 bytes --
int(%r1024|1137%r)
bool(false)
Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
OK
int(%r1024|1137%r)
bool(false)
diff --git a/ext/standard/tests/file/fscanf.phpt b/ext/standard/tests/file/fscanf.phpt
index 7a5a70070e..6605b795ff 100644
--- a/ext/standard/tests/file/fscanf.phpt
+++ b/ext/standard/tests/file/fscanf.phpt
@@ -5,10 +5,6 @@ fscanf() tests
$filename = __DIR__."/fscanf.dat";
-var_dump(fscanf());
-var_dump(fscanf(array()));
-var_dump(fscanf(array(), array()));
-
file_put_contents($filename, "data");
$fp = fopen($filename, "rt");
@@ -22,7 +18,11 @@ var_dump($v);
fclose($fp);
$fp = fopen($filename, "rt");
-var_dump(fscanf($fp, "%s", $v, $v1));
+try {
+ fscanf($fp, "%s", $v, $v1);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
var_dump($v);
var_dump($v1);
fclose($fp);
@@ -30,7 +30,11 @@ fclose($fp);
$v = array();
$v1 = array();
$fp = fopen($filename, "rt");
-var_dump(fscanf($fp, "", $v, $v1));
+try {
+ fscanf($fp, "", $v, $v1);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
var_dump($v);
var_dump($v1);
fclose($fp);
@@ -38,7 +42,11 @@ fclose($fp);
$v = array();
$v1 = array();
$fp = fopen($filename, "rt");
-var_dump(fscanf($fp, "%.a", $v, $v1));
+try {
+ fscanf($fp, "%.a", $v, $v1);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
var_dump($v);
var_dump($v1);
fclose($fp);
@@ -54,7 +62,11 @@ fclose($fp);
file_put_contents($filename, "data");
$fp = fopen($filename, "rt");
-var_dump(fscanf($fp, "%s%d", $v));
+try {
+ var_dump(fscanf($fp, "%s%d", $v));
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
echo "Done\n";
?>
@@ -64,33 +76,19 @@ $filename = __DIR__."/fscanf.dat";
unlink($filename);
?>
--EXPECTF--
-Warning: fscanf() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: fscanf() expects at least 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: fscanf() expects parameter 1 to be resource, array given in %s on line %d
-NULL
int(0)
NULL
int(1)
string(4) "data"
-
-Warning: fscanf(): Variable is not assigned by any conversion specifiers in %s on line %d
-int(-1)
+Variable is not assigned by any conversion specifiers
string(4) "data"
NULL
-
-Warning: fscanf(): Variable is not assigned by any conversion specifiers in %s on line %d
-int(-1)
+Variable is not assigned by any conversion specifiers
array(0) {
}
array(0) {
}
-
-Warning: fscanf(): Bad scan conversion character "." in %s on line %d
-int(-1)
+Bad scan conversion character "."
array(0) {
}
array(0) {
@@ -98,7 +96,5 @@ array(0) {
bool(false)
array(0) {
}
-
-Warning: fscanf(): Different numbers of variable names and field specifiers in %s on line %d
-int(-1)
+Different numbers of variable names and field specifiers
Done
diff --git a/ext/standard/tests/file/fscanf_error.phpt b/ext/standard/tests/file/fscanf_error.phpt
index ea6a91e33d..9e4f07f0b5 100644
--- a/ext/standard/tests/file/fscanf_error.phpt
+++ b/ext/standard/tests/file/fscanf_error.phpt
@@ -17,28 +17,26 @@ if ($file_handle == false)
fwrite($file_handle, "hello world");
fclose($file_handle);
-// zero argument
-var_dump( fscanf() );
-
-// single argument
-$file_handle = fopen($filename, 'r');
-if ($file_handle == false)
- exit("Error:failed to open file $filename");
-var_dump( fscanf($file_handle) );
-fclose($file_handle);
-
// invalid file handle
-var_dump( fscanf($file_handle, "%s") );
+try {
+ fscanf($file_handle, "%s");
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
// number of formats in format strings not matching the no of variables
$file_handle = fopen($filename, 'r');
if ($file_handle == false)
exit("Error:failed to open file $filename");
-var_dump( fscanf($file_handle, "%d%s%f", $int_var, $string_var) );
+try {
+ fscanf($file_handle, "%d%s%f", $int_var, $string_var);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
fclose($file_handle);
// different invalid format strings
-$invalid_formats = array( $undefined_var, undefined_constant,
+$invalid_formats = array( $undefined_var,
"%", "%h", "%.", "%d%m"
);
@@ -48,7 +46,11 @@ foreach($invalid_formats as $format) {
$file_handle = fopen($filename, 'r');
if ($file_handle == false)
exit("Error:failed to open file $filename");
- var_dump( fscanf($file_handle, $format) );
+ try {
+ var_dump(fscanf($file_handle, $format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
fclose($file_handle);
}
@@ -62,37 +64,15 @@ unlink($filename);
?>
--EXPECTF--
*** Testing fscanf() for error conditions ***
+fscanf(): supplied resource is not a valid File-Handle resource
+Different numbers of variable names and field specifiers
-Warning: fscanf() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: fscanf() expects at least 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: fscanf(): supplied resource is not a valid File-Handle resource in %s on line %d
-bool(false)
-
-Warning: fscanf(): Different numbers of variable names and field specifiers in %s on line %d
-int(-1)
-
-Notice: Undefined variable: undefined_var in %s on line %d
-
-Warning: Use of undefined constant undefined_constant - assumed 'undefined_constant' (this will throw an Error in a future version of PHP) in %s on line %d
-array(0) {
-}
+Warning: Undefined variable: undefined_var in %s on line %d
array(0) {
}
-
-Warning: fscanf(): Bad scan conversion character " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character "." in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character "m" in %s on line %d
-NULL
+Bad scan conversion character "
+Bad scan conversion character "
+Bad scan conversion character "."
+Bad scan conversion character "m"
*** Done ***
diff --git a/ext/standard/tests/file/fscanf_variation10.phpt b/ext/standard/tests/file/fscanf_variation10.phpt
index 158c6579d9..f657c07005 100644
--- a/ext/standard/tests/file/fscanf_variation10.phpt
+++ b/ext/standard/tests/file/fscanf_variation10.phpt
@@ -42,7 +42,7 @@ $counter = 1;
// writing to the file
foreach($resource_types as $value) {
- @fprintf($file_handle, $value);
+ @fprintf($file_handle, "%s", $value);
@fprintf($file_handle, "\n");
}
// closing the file
@@ -61,7 +61,11 @@ foreach($float_formats as $float_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$float_format) );
+ try {
+ var_dump( fscanf($file_handle,$float_format) );
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -148,12 +152,8 @@ array(1) {
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation11.phpt b/ext/standard/tests/file/fscanf_variation11.phpt
index 97dfa810a2..3d065060dc 100644
--- a/ext/standard/tests/file/fscanf_variation11.phpt
+++ b/ext/standard/tests/file/fscanf_variation11.phpt
@@ -47,7 +47,7 @@ $counter = 1;
// writing to the file
foreach($array_types as $value) {
- @fprintf($file_handle, $value);
+ @fprintf($file_handle, "%s", $value);
@fprintf($file_handle, "\n");
}
// closing the file
@@ -66,7 +66,11 @@ foreach($float_formats as $float_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$float_format) );
+ try {
+ var_dump(fscanf($file_handle,$float_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -79,7 +83,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation11.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different float format types with arrays ***
-- iteration 1 --
@@ -389,42 +393,18 @@ array(1) {
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation12.phpt b/ext/standard/tests/file/fscanf_variation12.phpt
index a76e5b92a4..3cfd942662 100644
--- a/ext/standard/tests/file/fscanf_variation12.phpt
+++ b/ext/standard/tests/file/fscanf_variation12.phpt
@@ -67,7 +67,11 @@ foreach($float_formats as $float_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$float_format) );
+ try {
+ var_dump(fscanf($file_handle,$float_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -80,7 +84,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation12.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different float format types with strings ***
-- iteration 1 --
@@ -498,60 +502,24 @@ array(1) {
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation13.phpt b/ext/standard/tests/file/fscanf_variation13.phpt
index 8f14e97e32..796831f32a 100644
--- a/ext/standard/tests/file/fscanf_variation13.phpt
+++ b/ext/standard/tests/file/fscanf_variation13.phpt
@@ -53,7 +53,11 @@ foreach($float_formats as $float_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$float_format) );
+ try {
+ var_dump(fscanf($file_handle,$float_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -66,7 +70,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation13.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different float format types with boolean data ***
-- iteration 1 --
@@ -148,18 +152,10 @@ NULL
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation14.phpt b/ext/standard/tests/file/fscanf_variation14.phpt
index 47caaa3568..557767978a 100644
--- a/ext/standard/tests/file/fscanf_variation14.phpt
+++ b/ext/standard/tests/file/fscanf_variation14.phpt
@@ -76,8 +76,12 @@ $counter = 1;
// writing to the file
foreach($valid_strings as $string) {
- @fprintf($file_handle, $string);
- @fprintf($file_handle, "\n");
+ try {
+ fprintf($file_handle, $string);
+ } catch (\ValueError $e) {
+ } catch (\ArgumentCountError $e) {
+ }
+ fprintf($file_handle, "\n");
}
// closing the file
fclose($file_handle);
@@ -95,7 +99,11 @@ foreach($string_formats as $string_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$string_format) );
+ try {
+ var_dump(fscanf($file_handle,$string_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -108,7 +116,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation14.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different string format types with different string ***
-- iteration 1 --
@@ -562,78 +570,30 @@ array(1) {
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation15.phpt b/ext/standard/tests/file/fscanf_variation15.phpt
index f16b697896..d177763557 100644
--- a/ext/standard/tests/file/fscanf_variation15.phpt
+++ b/ext/standard/tests/file/fscanf_variation15.phpt
@@ -69,7 +69,11 @@ foreach($string_formats as $string_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$string_format) );
+ try {
+ var_dump(fscanf($file_handle,$string_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -82,7 +86,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation15.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different string format types with float values ***
-- iteration 1 --
@@ -464,51 +468,21 @@ array(1) {
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation16.phpt b/ext/standard/tests/file/fscanf_variation16.phpt
index a9fd0cf84d..00fed59cba 100644
--- a/ext/standard/tests/file/fscanf_variation16.phpt
+++ b/ext/standard/tests/file/fscanf_variation16.phpt
@@ -41,7 +41,7 @@ $counter = 1;
// writing to the file
foreach($resource_types as $value) {
- @fprintf($file_handle, $value);
+ @fprintf($file_handle, "%s", $value);
@fprintf($file_handle, "\n");
}
// closing the file
@@ -60,7 +60,11 @@ foreach($string_formats as $string_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$string_format) );
+ try {
+ var_dump(fscanf($file_handle,$string_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -77,7 +81,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation16.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different string format types with resource ***
-- iteration 1 --
@@ -147,12 +151,8 @@ array(1) {
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation17.phpt b/ext/standard/tests/file/fscanf_variation17.phpt
index 4e976c7cb4..aee9a0c3f9 100644
--- a/ext/standard/tests/file/fscanf_variation17.phpt
+++ b/ext/standard/tests/file/fscanf_variation17.phpt
@@ -46,7 +46,7 @@ $counter = 1;
// writing to the file
foreach($array_types as $value) {
- @fprintf($file_handle, $value);
+ @fprintf($file_handle, "%s", $value);
@fprintf($file_handle, "\n");
}
// closing the file
@@ -65,7 +65,11 @@ foreach($string_formats as $string_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$string_format) );
+ try {
+ var_dump(fscanf($file_handle,$string_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -78,7 +82,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation17.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different string format types with arrays ***
-- iteration 1 --
@@ -388,42 +392,18 @@ array(1) {
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation18.phpt b/ext/standard/tests/file/fscanf_variation18.phpt
index 3887170b96..af90fffadf 100644
--- a/ext/standard/tests/file/fscanf_variation18.phpt
+++ b/ext/standard/tests/file/fscanf_variation18.phpt
@@ -73,7 +73,11 @@ foreach($string_formats as $string_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$string_format) );
+ try {
+ var_dump(fscanf($file_handle,$string_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -86,7 +90,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation18.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different string format types with integer values ***
-- iteration 1 --
@@ -540,60 +544,24 @@ array(1) {
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation19.phpt b/ext/standard/tests/file/fscanf_variation19.phpt
index 5558c7786a..31cc83297b 100644
--- a/ext/standard/tests/file/fscanf_variation19.phpt
+++ b/ext/standard/tests/file/fscanf_variation19.phpt
@@ -31,8 +31,8 @@ $bool_types = array (
$string_formats = array( "%s",
"%hs", "%ls", "%Ls",
" %s", "%s ", "% s",
- "\t%s", "\n%s", "%4s",
- "%30s", "%[a-zA-Z0-9]", "%*s");
+ "\t%s", "\n%s", "%4s",
+ "%30s", "%[a-zA-Z0-9]", "%*s");
$counter = 1;
@@ -57,7 +57,11 @@ foreach($string_formats as $string_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$string_format) );
+ try {
+ var_dump(fscanf($file_handle,$string_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -70,7 +74,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation19.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different string format types with boolean data ***
-- iteration 1 --
@@ -152,18 +156,10 @@ NULL
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation2.phpt b/ext/standard/tests/file/fscanf_variation2.phpt
index 7ef77a6754..683ac4faae 100644
--- a/ext/standard/tests/file/fscanf_variation2.phpt
+++ b/ext/standard/tests/file/fscanf_variation2.phpt
@@ -8,7 +8,7 @@ Test fscanf() function: usage variations - integer formats with integer values
Description: Parses input from a file according to a format
*/
-/* Test fscanf() to scan different integer values using different interger format types */
+/* Test fscanf() to scan different integer values using different integer format types */
$file_path = __DIR__;
@@ -67,7 +67,11 @@ foreach($int_formats as $int_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$int_format) );
+ try {
+ var_dump(fscanf($file_handle,$int_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -80,7 +84,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation2.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different integer format types with different integer values ***
-- iteration 1 --
@@ -534,60 +538,24 @@ array(1) {
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation20.phpt b/ext/standard/tests/file/fscanf_variation20.phpt
index 2db263b79f..34dac83bf1 100644
--- a/ext/standard/tests/file/fscanf_variation20.phpt
+++ b/ext/standard/tests/file/fscanf_variation20.phpt
@@ -43,10 +43,10 @@ $valid_ints = array(
);
// various char formats
$char_formats = array( "%c",
- "%hc", "%lc", "%Lc",
- " %c", "%c ", "% c",
- "\t%c", "\n%c", "%4c",
- "%30c", "%[a-bA-B@#$&]", "%*c");
+ "%hc", "%lc", "%Lc",
+ " %c", "%c ", "% c",
+ "\t%c", "\n%c", "%4c",
+ "%30c", "%[a-bA-B@#$&]", "%*c");
$counter = 1;
@@ -71,7 +71,11 @@ foreach($char_formats as $char_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$char_format) );
+ try {
+ var_dump(fscanf($file_handle,$char_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -84,7 +88,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation20.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different char format types with different integer values ***
-- iteration 1 --
@@ -538,60 +542,24 @@ array(1) {
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation21.phpt b/ext/standard/tests/file/fscanf_variation21.phpt
index 1275064d6a..e0c8074ead 100644
--- a/ext/standard/tests/file/fscanf_variation21.phpt
+++ b/ext/standard/tests/file/fscanf_variation21.phpt
@@ -42,9 +42,9 @@ $float_values = array (
$char_formats = array( "%c",
"%hc", "%lc", "%Lc",
- " %c", "%c ", "% c",
- "\t%c", "\n%c", "%4c",
- "%30c", "%[a-zA-Z@#$&0-9]", "%*c");
+ " %c", "%c ", "% c",
+ "\t%c", "\n%c", "%4c",
+ "%30c", "%[a-zA-Z@#$&0-9]", "%*c");
$counter = 1;
@@ -69,7 +69,11 @@ foreach($char_formats as $char_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$char_format) );
+ try {
+ var_dump(fscanf($file_handle,$char_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -82,7 +86,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation21.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different char format types with float values ***
-- iteration 1 --
@@ -464,51 +468,21 @@ array(1) {
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation22.phpt b/ext/standard/tests/file/fscanf_variation22.phpt
index adb848a908..2fb450750d 100644
--- a/ext/standard/tests/file/fscanf_variation22.phpt
+++ b/ext/standard/tests/file/fscanf_variation22.phpt
@@ -32,16 +32,16 @@ $resource_types = array (
);
$char_formats = array( "%c",
- "%hc", "%lc", "%Lc",
- " %c", "%c ", "% c",
- "\t%c", "\n%c", "%4c",
- "%30c", "%[a-zA-Z@#$&0-9]", "%*c");
+ "%hc", "%lc", "%Lc",
+ " %c", "%c ", "% c",
+ "\t%c", "\n%c", "%4c",
+ "%30c", "%[a-zA-Z@#$&0-9]", "%*c");
$counter = 1;
// writing to the file
foreach($resource_types as $value) {
- @fprintf($file_handle, $value);
+ @fprintf($file_handle, "%s", $value);
@fprintf($file_handle, "\n");
}
// closing the file
@@ -60,7 +60,11 @@ foreach($char_formats as $char_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$char_format) );
+ try {
+ var_dump(fscanf($file_handle,$char_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -77,7 +81,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation22.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different char format types with resource ***
-- iteration 1 --
@@ -147,12 +151,8 @@ array(1) {
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation23.phpt b/ext/standard/tests/file/fscanf_variation23.phpt
index c1b9ca6580..e8b9c0dae2 100644
--- a/ext/standard/tests/file/fscanf_variation23.phpt
+++ b/ext/standard/tests/file/fscanf_variation23.phpt
@@ -37,16 +37,16 @@ $array_types = array (
);
$char_formats = array( "%c",
- "%hc", "%lc", "%Lc",
- " %c", "%c ", "% c",
- "\t%c", "\n%c", "%4c",
- "%30c", "%[a-zA-Z@#$&0-9]", "%*c");
+ "%hc", "%lc", "%Lc",
+ " %c", "%c ", "% c",
+ "\t%c", "\n%c", "%4c",
+ "%30c", "%[a-zA-Z@#$&0-9]", "%*c");
$counter = 1;
// writing to the file
foreach($array_types as $value) {
- @fprintf($file_handle, $value);
+ @fprintf($file_handle, "%s", $value);
@fprintf($file_handle, "\n");
}
// closing the file
@@ -65,7 +65,11 @@ foreach($char_formats as $char_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$char_format) );
+ try {
+ var_dump(fscanf($file_handle,$char_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -78,7 +82,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation23.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different char format types with arrays ***
-- iteration 1 --
@@ -388,42 +392,18 @@ array(1) {
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation24.phpt b/ext/standard/tests/file/fscanf_variation24.phpt
index eb7053587c..576919c886 100644
--- a/ext/standard/tests/file/fscanf_variation24.phpt
+++ b/ext/standard/tests/file/fscanf_variation24.phpt
@@ -43,10 +43,10 @@ $strings = array (
);
$char_formats = array( "%c",
- "%hc", "%lc", "%Lc",
- " %c", "%c ", "% c",
- "\t%c", "\n%c", "%4c",
- "%30c", "%[a-zA-Z@#$&0-9]", "%*c");
+ "%hc", "%lc", "%Lc",
+ " %c", "%c ", "% c",
+ "\t%c", "\n%c", "%4c",
+ "%30c", "%[a-zA-Z@#$&0-9]", "%*c");
$counter = 1;
@@ -71,7 +71,11 @@ foreach($char_formats as $char_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$char_format) );
+ try {
+ var_dump(fscanf($file_handle,$char_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -84,7 +88,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation24.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different char format types with strings ***
-- iteration 1 --
@@ -532,60 +536,24 @@ array(1) {
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation25.phpt b/ext/standard/tests/file/fscanf_variation25.phpt
index 41d9bdc009..0fea04e438 100644
--- a/ext/standard/tests/file/fscanf_variation25.phpt
+++ b/ext/standard/tests/file/fscanf_variation25.phpt
@@ -29,10 +29,10 @@ $bool_types = array (
);
$char_formats = array( "%c",
- "%hc", "%lc", "%Lc",
- " %c", "%c ", "% c",
- "\t%c", "\n%c", "%4c",
- "%30c", "%[a-zA-Z@#$&0-9]", "%*c");
+ "%hc", "%lc", "%Lc",
+ " %c", "%c ", "% c",
+ "\t%c", "\n%c", "%4c",
+ "%30c", "%[a-zA-Z@#$&0-9]", "%*c");
$counter = 1;
@@ -57,7 +57,11 @@ foreach($char_formats as $char_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$char_format) );
+ try {
+ var_dump(fscanf($file_handle,$char_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -70,7 +74,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation25.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different char format types with boolean data ***
-- iteration 1 --
@@ -182,18 +186,10 @@ array(1) {
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation26.phpt b/ext/standard/tests/file/fscanf_variation26.phpt
index d777e2ce8d..5b1c5b0428 100644
--- a/ext/standard/tests/file/fscanf_variation26.phpt
+++ b/ext/standard/tests/file/fscanf_variation26.phpt
@@ -24,10 +24,10 @@ if($file_handle == false)
$char_types = array( 'a', "a", 67, -67, 99 );
$char_formats = array( "%c",
- "%hc", "%lc", "%Lc",
- " %c", "%c ", "% c",
- "\t%c", "\n%c", "%4c",
- "%30c", "%[a-zA-Z@#$&0-9]", "%*c");
+ "%hc", "%lc", "%Lc",
+ " %c", "%c ", "% c",
+ "\t%c", "\n%c", "%4c",
+ "%30c", "%[a-zA-Z@#$&0-9]", "%*c");
$counter = 1;
@@ -52,7 +52,11 @@ foreach($char_formats as $char_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$char_format) );
+ try {
+ var_dump(fscanf($file_handle,$char_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -65,7 +69,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation26.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different char format types with chars ***
-- iteration 1 --
@@ -207,21 +211,11 @@ array(1) {
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation27.phpt b/ext/standard/tests/file/fscanf_variation27.phpt
index 1d81190e9b..ca27895eac 100644
--- a/ext/standard/tests/file/fscanf_variation27.phpt
+++ b/ext/standard/tests/file/fscanf_variation27.phpt
@@ -72,7 +72,11 @@ foreach($octal_formats as $octal_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$octal_format) );
+ try {
+ var_dump(fscanf($file_handle,$octal_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -85,7 +89,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation27.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different octal format types with different integer values ***
-- iteration 1 --
@@ -539,60 +543,24 @@ array(1) {
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation28.phpt b/ext/standard/tests/file/fscanf_variation28.phpt
index 4a791259bc..93b476dd44 100644
--- a/ext/standard/tests/file/fscanf_variation28.phpt
+++ b/ext/standard/tests/file/fscanf_variation28.phpt
@@ -70,7 +70,11 @@ foreach($octal_formats as $octal_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$octal_format) );
+ try {
+ var_dump(fscanf($file_handle,$octal_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -83,7 +87,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation28.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different octal format types with float values ***
-- iteration 1 --
@@ -465,51 +469,21 @@ array(1) {
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation29.phpt b/ext/standard/tests/file/fscanf_variation29.phpt
index 1db4973290..1621958fa4 100644
--- a/ext/standard/tests/file/fscanf_variation29.phpt
+++ b/ext/standard/tests/file/fscanf_variation29.phpt
@@ -32,17 +32,17 @@ $resource_types = array (
);
$octal_formats = array( "%o",
- "%ho", "%lo", "%Lo",
- " %o", "%o ", "% o",
- "\t%o", "\n%o", "%4o",
- "%30o", "%[0-7]", "%*o"
- );
+ "%ho", "%lo", "%Lo",
+ " %o", "%o ", "% o",
+ "\t%o", "\n%o", "%4o",
+ "%30o", "%[0-7]", "%*o"
+ );
$counter = 1;
// writing to the file
foreach($resource_types as $value) {
- @fprintf($file_handle, $value);
+ @fprintf($file_handle, "%s", $value);
@fprintf($file_handle, "\n");
}
// closing the file
@@ -61,7 +61,11 @@ foreach($octal_formats as $octal_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$octal_format) );
+ try {
+ var_dump(fscanf($file_handle,$octal_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -78,7 +82,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation29.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different octal format types with resource ***
-- iteration 1 --
@@ -148,12 +152,8 @@ array(1) {
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation3.phpt b/ext/standard/tests/file/fscanf_variation3.phpt
index 225fb6a0de..f52cca4181 100644
--- a/ext/standard/tests/file/fscanf_variation3.phpt
+++ b/ext/standard/tests/file/fscanf_variation3.phpt
@@ -71,7 +71,11 @@ foreach($int_formats as $int_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$int_format) );
+ try {
+ var_dump( fscanf($file_handle,$int_format) );
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -84,7 +88,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation3.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different integer format types with float values ***
-- iteration 1 --
@@ -466,51 +470,21 @@ array(1) {
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation30.phpt b/ext/standard/tests/file/fscanf_variation30.phpt
index c01f5aa2e6..3af42e34bc 100644
--- a/ext/standard/tests/file/fscanf_variation30.phpt
+++ b/ext/standard/tests/file/fscanf_variation30.phpt
@@ -37,17 +37,17 @@ $array_types = array (
);
$octal_formats = array ( "%o",
- "%ho", "%lo", "%Lo",
- " %o", "%o ", "% o",
- "\t%o", "\n%o", "%4o",
- "%30o", "%[0-7]", "%*o"
- );
+ "%ho", "%lo", "%Lo",
+ " %o", "%o ", "% o",
+ "\t%o", "\n%o", "%4o",
+ "%30o", "%[0-7]", "%*o"
+ );
$counter = 1;
// writing to the file
foreach($array_types as $value) {
- @fprintf($file_handle, $value);
+ @fprintf($file_handle, "%s", $value);
@fprintf($file_handle, "\n");
}
// closing the file
@@ -66,7 +66,11 @@ foreach($octal_formats as $octal_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$octal_format) );
+ try {
+ var_dump(fscanf($file_handle,$octal_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -79,7 +83,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation30.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different octal format types with arrays ***
-- iteration 1 --
@@ -389,42 +393,18 @@ array(1) {
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation31.phpt b/ext/standard/tests/file/fscanf_variation31.phpt
index 2702fbc535..cf1120644a 100644
--- a/ext/standard/tests/file/fscanf_variation31.phpt
+++ b/ext/standard/tests/file/fscanf_variation31.phpt
@@ -67,7 +67,11 @@ foreach($octal_formats as $octal_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$octal_format) );
+ try {
+ var_dump(fscanf($file_handle,$octal_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -80,7 +84,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation31.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different octal format types with strings ***
-- iteration 1 --
@@ -498,60 +502,24 @@ array(1) {
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation32.phpt b/ext/standard/tests/file/fscanf_variation32.phpt
index 36f3f56881..556f60363e 100644
--- a/ext/standard/tests/file/fscanf_variation32.phpt
+++ b/ext/standard/tests/file/fscanf_variation32.phpt
@@ -29,11 +29,11 @@ $bool_types = array (
);
$octal_formats = array( "%o",
- "%ho", "%lo", "%Lo",
- " %o", "%o ", "% o",
- "\t%o", "\n%o", "%4o",
- "%30o", "%[0-7]", "%*o"
- );
+ "%ho", "%lo", "%Lo",
+ " %o", "%o ", "% o",
+ "\t%o", "\n%o", "%4o",
+ "%30o", "%[0-7]", "%*o"
+ );
$counter = 1;
@@ -58,7 +58,11 @@ foreach($octal_formats as $octal_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$octal_format) );
+ try {
+ var_dump(fscanf($file_handle,$octal_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -71,7 +75,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation32.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different octal format types with boolean data ***
-- iteration 1 --
@@ -153,18 +157,10 @@ NULL
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation33.phpt b/ext/standard/tests/file/fscanf_variation33.phpt
index a444462a09..2753a890b5 100644
--- a/ext/standard/tests/file/fscanf_variation33.phpt
+++ b/ext/standard/tests/file/fscanf_variation33.phpt
@@ -49,11 +49,11 @@ $valid_ints = array(
);
// various hexa formats
$hexa_formats = array( "%x",
- "%xx", "%lx", "%Lx",
- " %x", "%x ", "% x",
- "\t%x", "\n%x", "%4x",
- "%30x", "%[0-9A-Fa-f]", "%*x"
- );
+ "%xx", "%lx", "%Lx",
+ " %x", "%x ", "% x",
+ "\t%x", "\n%x", "%4x",
+ "%30x", "%[0-9A-Fa-f]", "%*x"
+ );
$counter = 1;
@@ -78,7 +78,11 @@ foreach($hexa_formats as $hexa_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$hexa_format) );
+ try {
+ var_dump(fscanf($file_handle,$hexa_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -91,7 +95,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation33.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different hexa format types with different integer values ***
-- iteration 1 --
@@ -545,60 +549,24 @@ array(1) {
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation34.phpt b/ext/standard/tests/file/fscanf_variation34.phpt
index a2d1ffdf01..ca0ca65e95 100644
--- a/ext/standard/tests/file/fscanf_variation34.phpt
+++ b/ext/standard/tests/file/fscanf_variation34.phpt
@@ -47,10 +47,10 @@ $float_values = array (
);
$hexa_formats = array( "%x",
- "%hx", "%lx", "%Lx",
- " %x", "%x ", "% x",
- "\t%x", "\n%x", "%4x",
- "%30x", "%[0-9A-Za-z]", "%*x");
+ "%hx", "%lx", "%Lx",
+ " %x", "%x ", "% x",
+ "\t%x", "\n%x", "%4x",
+ "%30x", "%[0-9A-Za-z]", "%*x");
$counter = 1;
@@ -75,7 +75,11 @@ foreach($hexa_formats as $hexa_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$hexa_format) );
+ try {
+ var_dump(fscanf($file_handle,$hexa_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -88,7 +92,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation34.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different hexa format types with float values ***
-- iteration 1 --
@@ -470,51 +474,21 @@ array(1) {
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation35.phpt b/ext/standard/tests/file/fscanf_variation35.phpt
index 445280c2fd..a992e80600 100644
--- a/ext/standard/tests/file/fscanf_variation35.phpt
+++ b/ext/standard/tests/file/fscanf_variation35.phpt
@@ -37,7 +37,7 @@ $counter = 1;
// writing to the file
foreach($resource_types as $value) {
- @fprintf($file_handle, $value);
+ @fprintf($file_handle, "%s", $value);
@fprintf($file_handle, "\n");
}
// closing the file
@@ -56,7 +56,11 @@ foreach($hexa_formats as $hexa_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$hexa_format) );
+ try {
+ var_dump(fscanf($file_handle,$hexa_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -73,7 +77,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation35.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different hexa format types with resource ***
-- iteration 1 --
@@ -143,12 +147,8 @@ array(1) {
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation36.phpt b/ext/standard/tests/file/fscanf_variation36.phpt
index 9eb617077d..12385ce0e7 100644
--- a/ext/standard/tests/file/fscanf_variation36.phpt
+++ b/ext/standard/tests/file/fscanf_variation36.phpt
@@ -42,7 +42,7 @@ $counter = 1;
// writing to the file
foreach($array_types as $value) {
- @fprintf($file_handle, $value);
+ @fprintf($file_handle, "%s", $value);
@fprintf($file_handle, "\n");
}
// closing the file
@@ -61,7 +61,11 @@ foreach($hexa_formats as $hexa_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$hexa_format) );
+ try {
+ var_dump(fscanf($file_handle,$hexa_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -74,7 +78,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation36.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different hexa format types with arrays ***
-- iteration 1 --
@@ -384,42 +388,18 @@ array(1) {
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation37.phpt b/ext/standard/tests/file/fscanf_variation37.phpt
index 9acdfa489c..c31768d8fe 100644
--- a/ext/standard/tests/file/fscanf_variation37.phpt
+++ b/ext/standard/tests/file/fscanf_variation37.phpt
@@ -67,7 +67,11 @@ foreach($hexa_formats as $hexa_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$hexa_format) );
+ try {
+ var_dump(fscanf($file_handle,$hexa_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -80,7 +84,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation37.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different hexa format types with strings ***
-- iteration 1 --
@@ -498,60 +502,24 @@ array(1) {
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation38.phpt b/ext/standard/tests/file/fscanf_variation38.phpt
index eabe5a05b4..d42a9a8f78 100644
--- a/ext/standard/tests/file/fscanf_variation38.phpt
+++ b/ext/standard/tests/file/fscanf_variation38.phpt
@@ -53,7 +53,11 @@ foreach($hexa_formats as $hexa_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$hexa_format) );
+ try {
+ var_dump(fscanf($file_handle,$hexa_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -66,7 +70,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation38.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different hexa format types with boolean data ***
-- iteration 1 --
@@ -148,18 +152,10 @@ NULL
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation39.phpt b/ext/standard/tests/file/fscanf_variation39.phpt
index 011a714e1c..f92fccf3d1 100644
--- a/ext/standard/tests/file/fscanf_variation39.phpt
+++ b/ext/standard/tests/file/fscanf_variation39.phpt
@@ -73,7 +73,11 @@ foreach($unsigned_formats as $unsigned_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$unsigned_format) );
+ try {
+ var_dump(fscanf($file_handle,$unsigned_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -86,7 +90,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation39.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different unsigned int format types with different integer values ***
-- iteration 1 --
@@ -540,60 +544,24 @@ array(1) {
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation4.phpt b/ext/standard/tests/file/fscanf_variation4.phpt
index b802a90da3..3f8982de12 100644
--- a/ext/standard/tests/file/fscanf_variation4.phpt
+++ b/ext/standard/tests/file/fscanf_variation4.phpt
@@ -38,7 +38,7 @@ $counter = 1;
// writing to the file
foreach($resource_types as $value) {
- @fprintf($file_handle, $value);
+ @fprintf($file_handle, "%s", $value);
@fprintf($file_handle, "\n");
}
// closing the file
@@ -57,7 +57,11 @@ foreach($int_formats as $int_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$int_format) );
+ try {
+ var_dump(fscanf($file_handle,$int_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -74,7 +78,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation4.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different integer format types with resource ***
-- iteration 1 --
@@ -144,12 +148,8 @@ array(1) {
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation40.phpt b/ext/standard/tests/file/fscanf_variation40.phpt
index c65aaac9c7..986d1face4 100644
--- a/ext/standard/tests/file/fscanf_variation40.phpt
+++ b/ext/standard/tests/file/fscanf_variation40.phpt
@@ -71,7 +71,11 @@ foreach($unsigned_formats as $unsigned_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$unsigned_format) );
+ try {
+ var_dump(fscanf($file_handle,$unsigned_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -84,7 +88,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation40.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different unsigned format types with float values ***
-- iteration 1 --
@@ -466,51 +470,21 @@ array(1) {
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation41.phpt b/ext/standard/tests/file/fscanf_variation41.phpt
index 487954097f..4a752b3830 100644
--- a/ext/standard/tests/file/fscanf_variation41.phpt
+++ b/ext/standard/tests/file/fscanf_variation41.phpt
@@ -37,7 +37,7 @@ $counter = 1;
// writing to the file
foreach($resource_types as $value) {
- @fprintf($file_handle, $value);
+ @fprintf($file_handle, "%s", $value);
@fprintf($file_handle, "\n");
}
// closing the file
@@ -56,7 +56,11 @@ foreach($unsigned_formats as $unsigned_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$unsigned_format) );
+ try {
+ var_dump(fscanf($file_handle,$unsigned_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -73,7 +77,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation41.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different unsigned format types with resource ***
-- iteration 1 --
@@ -143,12 +147,8 @@ array(1) {
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation42.phpt b/ext/standard/tests/file/fscanf_variation42.phpt
index 45cf3696b5..09f0d0817f 100644
--- a/ext/standard/tests/file/fscanf_variation42.phpt
+++ b/ext/standard/tests/file/fscanf_variation42.phpt
@@ -42,7 +42,7 @@ $counter = 1;
// writing to the file
foreach($array_types as $value) {
- @fprintf($file_handle, $value);
+ @fprintf($file_handle, "%s", $value);
@fprintf($file_handle, "\n");
}
// closing the file
@@ -61,7 +61,11 @@ foreach($unsigned_formats as $unsigned_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$unsigned_format) );
+ try {
+ var_dump(fscanf($file_handle,$unsigned_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -74,7 +78,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation42.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different unsigned format types with arrays ***
-- iteration 1 --
@@ -384,42 +388,18 @@ array(1) {
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation43.phpt b/ext/standard/tests/file/fscanf_variation43.phpt
index bc19326e62..399e9c72b7 100644
--- a/ext/standard/tests/file/fscanf_variation43.phpt
+++ b/ext/standard/tests/file/fscanf_variation43.phpt
@@ -67,7 +67,11 @@ foreach($unsigned_formats as $unsigned_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$unsigned_format) );
+ try {
+ var_dump(fscanf($file_handle,$unsigned_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -80,7 +84,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation43.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different unsigned format types with strings ***
-- iteration 1 --
@@ -498,60 +502,24 @@ array(1) {
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation44.phpt b/ext/standard/tests/file/fscanf_variation44.phpt
index 6c61ba9507..cdc9befcf2 100644
--- a/ext/standard/tests/file/fscanf_variation44.phpt
+++ b/ext/standard/tests/file/fscanf_variation44.phpt
@@ -53,7 +53,11 @@ foreach($unsigned_formats as $unsigned_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$unsigned_format) );
+ try {
+ var_dump(fscanf($file_handle,$unsigned_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -66,7 +70,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation44.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different unsigned format types with boolean data ***
-- iteration 1 --
@@ -148,18 +152,10 @@ NULL
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation45.phpt b/ext/standard/tests/file/fscanf_variation45.phpt
index 87192cbb7c..31a05d26fa 100644
--- a/ext/standard/tests/file/fscanf_variation45.phpt
+++ b/ext/standard/tests/file/fscanf_variation45.phpt
@@ -67,7 +67,11 @@ foreach($scientific_formats as $scientific_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$scientific_format) );
+ try {
+ var_dump(fscanf($file_handle,$scientific_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -80,7 +84,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation45.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different scientific format types with different integer values ***
-- iteration 1 --
@@ -534,60 +538,24 @@ array(1) {
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation46.phpt b/ext/standard/tests/file/fscanf_variation46.phpt
index 690918bdf1..5c2527f33b 100644
--- a/ext/standard/tests/file/fscanf_variation46.phpt
+++ b/ext/standard/tests/file/fscanf_variation46.phpt
@@ -65,7 +65,11 @@ foreach($scientific_formats as $scientific_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$scientific_format) );
+ try {
+ var_dump(fscanf($file_handle,$scientific_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -78,7 +82,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation46.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different scientific format types with float values ***
-- iteration 1 --
@@ -460,51 +464,21 @@ array(1) {
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation47.phpt b/ext/standard/tests/file/fscanf_variation47.phpt
index 6217b32b61..8457c48d50 100644
--- a/ext/standard/tests/file/fscanf_variation47.phpt
+++ b/ext/standard/tests/file/fscanf_variation47.phpt
@@ -37,7 +37,7 @@ $counter = 1;
// writing to the file
foreach($resource_types as $value) {
- @fprintf($file_handle, $value);
+ @fprintf($file_handle, "%s", $value);
@fprintf($file_handle, "\n");
}
// closing the file
@@ -56,7 +56,11 @@ foreach($scientific_formats as $scientific_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$scientific_format) );
+ try {
+ var_dump(fscanf($file_handle,$scientific_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -73,7 +77,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation47.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different scientific format types with resource ***
-- iteration 1 --
@@ -143,12 +147,8 @@ array(1) {
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation48.phpt b/ext/standard/tests/file/fscanf_variation48.phpt
index 355d5cf187..fef3e33e6b 100644
--- a/ext/standard/tests/file/fscanf_variation48.phpt
+++ b/ext/standard/tests/file/fscanf_variation48.phpt
@@ -42,7 +42,7 @@ $counter = 1;
// writing to the file
foreach($array_types as $value) {
- @fprintf($file_handle, $value);
+ @fprintf($file_handle, "%s", $value);
@fprintf($file_handle, "\n");
}
// closing the file
@@ -61,7 +61,11 @@ foreach($scientific_formats as $scientific_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$scientific_format) );
+ try {
+ var_dump(fscanf($file_handle,$scientific_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -74,7 +78,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation48.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different scientific format types with arrays ***
-- iteration 1 --
@@ -384,42 +388,18 @@ array(1) {
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation49.phpt b/ext/standard/tests/file/fscanf_variation49.phpt
index 5355db9a5a..5ec5ab199d 100644
--- a/ext/standard/tests/file/fscanf_variation49.phpt
+++ b/ext/standard/tests/file/fscanf_variation49.phpt
@@ -67,7 +67,11 @@ foreach($scientific_formats as $scientific_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$scientific_format) );
+ try {
+ var_dump(fscanf($file_handle,$scientific_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -80,7 +84,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation49.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different scientific format types with strings ***
-- iteration 1 --
@@ -498,60 +502,24 @@ array(1) {
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation5.phpt b/ext/standard/tests/file/fscanf_variation5.phpt
index 714a54b912..a88ce61bf1 100644
--- a/ext/standard/tests/file/fscanf_variation5.phpt
+++ b/ext/standard/tests/file/fscanf_variation5.phpt
@@ -42,7 +42,7 @@ $counter = 1;
// writing to the file
foreach($array_types as $value) {
- @fprintf($file_handle, $value);
+ @fprintf($file_handle, "%s", $value);
@fprintf($file_handle, "\n");
}
// closing the file
@@ -61,7 +61,11 @@ foreach($int_formats as $int_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$int_format) );
+ try {
+ var_dump(fscanf($file_handle,$int_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -74,7 +78,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation5.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different integer format types with arrays ***
-- iteration 1 --
@@ -384,42 +388,18 @@ array(1) {
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation50.phpt b/ext/standard/tests/file/fscanf_variation50.phpt
index 4853ba10ca..6cb8e9fee6 100644
--- a/ext/standard/tests/file/fscanf_variation50.phpt
+++ b/ext/standard/tests/file/fscanf_variation50.phpt
@@ -53,7 +53,11 @@ foreach($scientific_formats as $scientific_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$scientific_format) );
+ try {
+ var_dump(fscanf($file_handle,$scientific_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -66,7 +70,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation50.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different scientific format types with boolean data ***
-- iteration 1 --
@@ -148,18 +152,10 @@ NULL
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation51.phpt b/ext/standard/tests/file/fscanf_variation51.phpt
index 712e1e18c7..61530e74b8 100644
--- a/ext/standard/tests/file/fscanf_variation51.phpt
+++ b/ext/standard/tests/file/fscanf_variation51.phpt
@@ -70,209 +70,209 @@ if(file_exists($filename)) {
-- iteration 1 --
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-- iteration 2 --
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-- iteration 3 --
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-- iteration 4 --
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-- iteration 5 --
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-- iteration 6 --
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-- iteration 7 --
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-- iteration 8 --
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-- iteration 9 --
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
-Notice: fscanf(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
*** Done ***
diff --git a/ext/standard/tests/file/fscanf_variation6.phpt b/ext/standard/tests/file/fscanf_variation6.phpt
index f2038cd1c8..e4df9faafa 100644
--- a/ext/standard/tests/file/fscanf_variation6.phpt
+++ b/ext/standard/tests/file/fscanf_variation6.phpt
@@ -67,7 +67,11 @@ foreach($int_formats as $int_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$int_format) );
+ try {
+ var_dump(fscanf($file_handle,$int_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -80,7 +84,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation6.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different integer format types with strings ***
-- iteration 1 --
@@ -498,60 +502,24 @@ array(1) {
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation7.phpt b/ext/standard/tests/file/fscanf_variation7.phpt
index 5be2436607..5978a15087 100644
--- a/ext/standard/tests/file/fscanf_variation7.phpt
+++ b/ext/standard/tests/file/fscanf_variation7.phpt
@@ -53,7 +53,11 @@ foreach($int_formats as $int_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$int_format) );
+ try {
+ var_dump(fscanf($file_handle,$int_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -66,7 +70,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation7.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different integer format types with boolean data ***
-- iteration 1 --
@@ -148,18 +152,10 @@ NULL
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation8.phpt b/ext/standard/tests/file/fscanf_variation8.phpt
index cd7dd35fd9..0f851ad21a 100644
--- a/ext/standard/tests/file/fscanf_variation8.phpt
+++ b/ext/standard/tests/file/fscanf_variation8.phpt
@@ -85,7 +85,11 @@ foreach($float_formats as $float_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$float_format) );
+ try {
+ var_dump(fscanf($file_handle,$float_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -98,7 +102,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation8.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different float format types with different float values ***
-- iteration 1 --
@@ -840,96 +844,36 @@ array(1) {
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fscanf_variation9.phpt b/ext/standard/tests/file/fscanf_variation9.phpt
index 40470db064..7abcb6fc64 100644
--- a/ext/standard/tests/file/fscanf_variation9.phpt
+++ b/ext/standard/tests/file/fscanf_variation9.phpt
@@ -74,7 +74,11 @@ foreach($float_formats as $float_format) {
rewind($file_handle);
echo "\n-- iteration $counter --\n";
while( !feof($file_handle) ) {
- var_dump( fscanf($file_handle,$float_format) );
+ try {
+ var_dump(fscanf($file_handle,$float_format));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
$counter++;
}
@@ -87,7 +91,7 @@ $file_path = __DIR__;
$filename = "$file_path/fscanf_variation9.tmp";
unlink($filename);
?>
---EXPECTF--
+--EXPECT--
*** Test fscanf(): different float format types with integer values ***
-- iteration 1 --
@@ -541,60 +545,24 @@ array(1) {
bool(false)
-- iteration 7 --
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
-
-Warning: fscanf(): Bad scan conversion character " " in %s on line %d
-NULL
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
+Bad scan conversion character " "
bool(false)
-- iteration 8 --
diff --git a/ext/standard/tests/file/fseek_ftell_rewind_error1.phpt b/ext/standard/tests/file/fseek_ftell_rewind_error1.phpt
index 9c1b3a822d..cd58c30f20 100644
--- a/ext/standard/tests/file/fseek_ftell_rewind_error1.phpt
+++ b/ext/standard/tests/file/fseek_ftell_rewind_error1.phpt
@@ -14,86 +14,21 @@ Test fseek(), ftell() & rewind() functions : error conditions - fseek()
*/
echo "*** Testing fseek() : error conditions ***\n";
-// zero argument
-echo "-- Testing fseek() with zero argument --\n";
-var_dump( fseek() );
-
-// unexpected no. of args
-echo "-- Testing fseek() with unexpected number of arguments --\n";
-$fp = fopen(__FILE__, "r");
-var_dump( fseek($fp) );
-var_dump( fseek($fp, 10, $fp,10) );
-
-// test invalid arguments : non-resources
-echo "-- Testing fseek() with invalid arguments --\n";
-$invalid_args = array (
- "string",
- 10,
- 10.5,
- true,
- array(1,2,3),
- new stdclass
-);
-/* loop to test fseek() with different invalid type of args */
-for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) {
- echo "-- Iteration $loop_counter --\n";
- var_dump( fseek($invalid_args[$loop_counter - 1], 10) );
-}
// fseek() on a file handle which is already closed
-echo "-- Testing fseek() with closed/unset file handle --";
+echo "-- Testing fseek() with closed/unset file handle --\n";
+$fp = fopen(__FILE__, "r");
fclose($fp);
-var_dump(fseek($fp,10));
-
-// fseek() on a file handle which is unset
-$file_handle = fopen(__FILE__, "r");
-unset($file_handle); //unset file handle
-var_dump( fseek(@$file_handle,10));
+try {
+ var_dump(fseek($fp,10));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
*** Testing fseek() : error conditions ***
--- Testing fseek() with zero argument --
-
-Warning: fseek() expects at least 2 parameters, 0 given in %s on line %d
-bool(false)
--- Testing fseek() with unexpected number of arguments --
-
-Warning: fseek() expects at least 2 parameters, 1 given in %s on line %d
-bool(false)
-
-Warning: fseek() expects at most 3 parameters, 4 given in %s on line %d
-bool(false)
--- Testing fseek() with invalid arguments --
--- Iteration 1 --
-
-Warning: fseek() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
--- Iteration 2 --
-
-Warning: fseek() expects parameter 1 to be resource, int given in %s on line %d
-bool(false)
--- Iteration 3 --
-
-Warning: fseek() expects parameter 1 to be resource, float given in %s on line %d
-bool(false)
--- Iteration 4 --
-
-Warning: fseek() expects parameter 1 to be resource, bool given in %s on line %d
-bool(false)
--- Iteration 5 --
-
-Warning: fseek() expects parameter 1 to be resource, array given in %s on line %d
-bool(false)
--- Iteration 6 --
-
-Warning: fseek() expects parameter 1 to be resource, object given in %s on line %d
-bool(false)
-- Testing fseek() with closed/unset file handle --
-Warning: fseek(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: fseek() expects parameter 1 to be resource, null given in %s on line %d
-bool(false)
+fseek(): supplied resource is not a valid stream resource
Done
diff --git a/ext/standard/tests/file/fseek_ftell_rewind_error2.phpt b/ext/standard/tests/file/fseek_ftell_rewind_error2.phpt
index 8835046f6c..45f1298951 100644
--- a/ext/standard/tests/file/fseek_ftell_rewind_error2.phpt
+++ b/ext/standard/tests/file/fseek_ftell_rewind_error2.phpt
@@ -14,82 +14,21 @@ Test fseek(), ftell() & rewind() functions : error conditions - ftell()
*/
echo "*** Testing ftell() : error conditions ***\n";
-// zero argument
-echo "-- Testing ftell() with zero argument --\n";
-var_dump( ftell() );
-
-// more than expected no. of args
-echo "-- Testing ftell() with more than expected number of arguments --\n";
-$fp = fopen(__FILE__, "r");
-var_dump( ftell($fp, 10) );
-
-// test invalid arguments : non-resources
-echo "-- Testing ftell() with invalid arguments --\n";
-$invalid_args = array (
- "string",
- 10,
- 10.5,
- true,
- array(1,2,3),
- new stdclass,
-);
-/* loop to test ftell with different invalid type of args */
-for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) {
- echo "-- Iteration $loop_counter --\n";
- var_dump( ftell($invalid_args[$loop_counter - 1]) );
-}
// ftell on a file handle which is already closed
-echo "-- Testing ftell with closed/unset file handle --";
+echo "-- Testing ftell with closed/unset file handle --\n";
+$fp = fopen(__FILE__, "r");
fclose($fp);
-var_dump(ftell($fp));
-
-// ftell on a file handle which is unset
-$file_handle = fopen(__FILE__, "r");
-unset($file_handle); //unset file handle
-var_dump( ftell(@$file_handle) );
+try {
+ var_dump(ftell($fp));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
*** Testing ftell() : error conditions ***
--- Testing ftell() with zero argument --
-
-Warning: ftell() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
--- Testing ftell() with more than expected number of arguments --
-
-Warning: ftell() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
--- Testing ftell() with invalid arguments --
--- Iteration 1 --
-
-Warning: ftell() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
--- Iteration 2 --
-
-Warning: ftell() expects parameter 1 to be resource, int given in %s on line %d
-bool(false)
--- Iteration 3 --
-
-Warning: ftell() expects parameter 1 to be resource, float given in %s on line %d
-bool(false)
--- Iteration 4 --
-
-Warning: ftell() expects parameter 1 to be resource, bool given in %s on line %d
-bool(false)
--- Iteration 5 --
-
-Warning: ftell() expects parameter 1 to be resource, array given in %s on line %d
-bool(false)
--- Iteration 6 --
-
-Warning: ftell() expects parameter 1 to be resource, object given in %s on line %d
-bool(false)
-- Testing ftell with closed/unset file handle --
-Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: ftell() expects parameter 1 to be resource, null given in %s on line %d
-bool(false)
+ftell(): supplied resource is not a valid stream resource
Done
diff --git a/ext/standard/tests/file/fseek_ftell_rewind_error3.phpt b/ext/standard/tests/file/fseek_ftell_rewind_error3.phpt
index 0b94bcffc7..e698bca463 100644
--- a/ext/standard/tests/file/fseek_ftell_rewind_error3.phpt
+++ b/ext/standard/tests/file/fseek_ftell_rewind_error3.phpt
@@ -14,82 +14,21 @@ Test fseek(), ftell() & rewind() functions : error conditions - rewind()
*/
echo "*** Testing rewind() : error conditions ***\n";
-// zero argument
-echo "-- Testing rewind() with zero argument --\n";
-var_dump( rewind() );
-
-// more than expected no. of args
-echo "-- Testing rewind() with more than expected number of arguments --\n";
-$fp = fopen(__FILE__, "r");
-var_dump( rewind($fp, 10) );
-
-// test invalid arguments : non-resources
-echo "-- Testing rewind() with invalid arguments --\n";
-$invalid_args = array (
- "string",
- 10,
- 10.5,
- true,
- array(1,2,3),
- new stdclass,
-);
-/* loop to test rewind with different invalid type of args */
-for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) {
- echo "-- Iteration $loop_counter --\n";
- var_dump( rewind($invalid_args[$loop_counter - 1]) );
-}
// rewind on a file handle which is already closed
-echo "-- Testing rewind() with closed/unset file handle --";
+echo "-- Testing rewind() with closed/unset file handle --\n";
+$fp = fopen(__FILE__, "r");
fclose($fp);
-var_dump(rewind($fp));
-
-// rewind on a file handle which is unset
-$file_handle = fopen(__FILE__, "r");
-unset($file_handle); //unset file handle
-var_dump( rewind(@$file_handle) );
+try {
+ var_dump(rewind($fp));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
*** Testing rewind() : error conditions ***
--- Testing rewind() with zero argument --
-
-Warning: rewind() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
--- Testing rewind() with more than expected number of arguments --
-
-Warning: rewind() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
--- Testing rewind() with invalid arguments --
--- Iteration 1 --
-
-Warning: rewind() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
--- Iteration 2 --
-
-Warning: rewind() expects parameter 1 to be resource, int given in %s on line %d
-bool(false)
--- Iteration 3 --
-
-Warning: rewind() expects parameter 1 to be resource, float given in %s on line %d
-bool(false)
--- Iteration 4 --
-
-Warning: rewind() expects parameter 1 to be resource, bool given in %s on line %d
-bool(false)
--- Iteration 5 --
-
-Warning: rewind() expects parameter 1 to be resource, array given in %s on line %d
-bool(false)
--- Iteration 6 --
-
-Warning: rewind() expects parameter 1 to be resource, object given in %s on line %d
-bool(false)
-- Testing rewind() with closed/unset file handle --
-Warning: rewind(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: rewind() expects parameter 1 to be resource, null given in %s on line %d
-bool(false)
+rewind(): supplied resource is not a valid stream resource
Done
diff --git a/ext/standard/tests/file/fstat.phpt b/ext/standard/tests/file/fstat.phpt
index 415124046e..b48b06cfe5 100644
--- a/ext/standard/tests/file/fstat.phpt
+++ b/ext/standard/tests/file/fstat.phpt
@@ -8,7 +8,11 @@ $filename = __DIR__."/fstat.dat";
$fp = fopen($filename, "w");
var_dump(fstat($fp));
fclose($fp);
-var_dump(fstat($fp));
+try {
+ var_dump(fstat($fp));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
@unlink($filename);
echo "Done\n";
@@ -68,7 +72,5 @@ array(26) {
["blocks"]=>
int(%i)
}
-
-Warning: fstat(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+fstat(): supplied resource is not a valid stream resource
Done
diff --git a/ext/standard/tests/file/fstat_basic.phpt b/ext/standard/tests/file/fstat_basic.phpt
index e1f92a7926..d5fdd44e34 100644
--- a/ext/standard/tests/file/fstat_basic.phpt
+++ b/ext/standard/tests/file/fstat_basic.phpt
@@ -6,7 +6,6 @@ $fp = fopen (__FILE__, 'r');
var_dump(fstat( $fp ) );
fclose($fp);
?>
-===DONE===
--EXPECTF--
array(26) {
[0]=>
@@ -62,4 +61,3 @@ array(26) {
["blocks"]=>
int(%i)
}
-===DONE===
diff --git a/ext/standard/tests/file/fstat_variation8.phpt b/ext/standard/tests/file/fstat_variation8.phpt
index c738b1bcaa..95036f5013 100644
--- a/ext/standard/tests/file/fstat_variation8.phpt
+++ b/ext/standard/tests/file/fstat_variation8.phpt
@@ -15,10 +15,10 @@ foreach($stat_result as $key =>$value) {
// windows, dev and rdev will not match this is expected
}
else {
- if ($fstat_result[$key] != $value) {
- echo "FAIL: stat differs at '$key'. $fstat_result[$key] -- $value\n";
- $failed = true;
- }
+ if ($fstat_result[$key] != $value) {
+ echo "FAIL: stat differs at '$key'. $fstat_result[$key] -- $value\n";
+ $failed = true;
+ }
}
}
if ($failed !== true) {
@@ -27,7 +27,5 @@ if ($failed !== true) {
?>
-===DONE===
--EXPECT--
PASSED: all elements are the same
-===DONE===
diff --git a/ext/standard/tests/file/ftruncate.phpt b/ext/standard/tests/file/ftruncate.phpt
index 3779cf3378..d5d883b1a1 100644
--- a/ext/standard/tests/file/ftruncate.phpt
+++ b/ext/standard/tests/file/ftruncate.phpt
Binary files differ
diff --git a/ext/standard/tests/file/ftruncate_bug76422.phpt b/ext/standard/tests/file/ftruncate_bug76422.phpt
index 77334545a9..84134acfd0 100644
--- a/ext/standard/tests/file/ftruncate_bug76422.phpt
+++ b/ext/standard/tests/file/ftruncate_bug76422.phpt
@@ -23,6 +23,8 @@ $truncate_offset = 2 * 1024 * 1024 * 1024;
$ftruncate_result = ftruncate($file_handle, $truncate_offset);
if (false === $ftruncate_result) {
var_dump(true);
+ fclose($file_handle);
+ unlink($fn);
return;
}
@@ -30,11 +32,17 @@ $truncate_offset = 4 * 1024 * 1024 * 1024 + 1;
$ftruncate_result = ftruncate($file_handle, $truncate_offset);
if (false === $ftruncate_result) {
+ // NOTE: unlink() is deliberately repeated - If this test runs out of disk space attempting to reserve space for this temporary file,
+ // then the--CLEAN-- script can't be run (if we don't delete the file),
+ // because there wouldn't be any free disk space to save a new php file.
+ fclose($file_handle);
+ unlink($fn);
die('Truncate has failed :/');
}
fclose($file_handle);
var_dump(filesize($fn) >= $truncate_offset);
+unlink($fn);
?>
--CLEAN--
<?php
diff --git a/ext/standard/tests/file/ftruncate_error.phpt b/ext/standard/tests/file/ftruncate_error.phpt
index 61ba1fc509..83569c47d8 100644
--- a/ext/standard/tests/file/ftruncate_error.phpt
+++ b/ext/standard/tests/file/ftruncate_error.phpt
@@ -15,51 +15,16 @@ fwrite($file_handle, "Testing ftruncate error conditions \n");
fflush($file_handle);
echo "\n Initial file size = ".filesize($filename)."\n";
-echo "-- Testing ftruncate() with less than expected number of arguments --\n";
-
-// zero arguments
-var_dump( ftruncate() );
-
-// arguments less than expected numbers
-var_dump( ftruncate( $file_handle ) );
-// check the first size
-var_dump( filesize($filename) );
-
-echo "-- Testing ftruncate() with more than expected number of arguments --\n";
-// more than expected number of arguments
-var_dump( ftruncate($file_handle, 10, 20) );
-// check the first size
-var_dump( filesize($filename) );
-
-// test invalid arguments : non-resources
-echo "-- Testing ftruncate() with invalid file pointer --\n";
-$invalid_args = array (
- "string",
- 10,
- 10.5,
- true,
- array(1,2,3),
- new stdclass,
-);
-/* loop to test ftruncate() with different invalid type of args */
-for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) {
- echo "-- Iteration $loop_counter --\n";
- var_dump( ftruncate($invalid_args[$loop_counter - 1], 10) );
-}
-
// ftruncate() on a file handle which is already closed/unset
echo "-- Testing ftruncate() with closed/unset file handle --\n";
// ftruncate on close file handle
fclose($file_handle);
-var_dump( ftruncate($file_handle,10) );
-// check the first size
-var_dump( filesize($filename) );
-
-// ftruncate on a file handle which is unset
-$fp = fopen($filename, "w");
-unset($fp); //unset file handle
-var_dump( ftruncate(@$fp,10));
+try {
+ var_dump( ftruncate($file_handle,10) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
// check the first size
var_dump( filesize($filename) );
@@ -70,55 +35,11 @@ echo "Done\n";
$filename = __DIR__."/ftruncate_error.tmp";
unlink( $filename );
?>
---EXPECTF--
+--EXPECT--
*** Testing ftruncate() : error conditions ***
Initial file size = 36
--- Testing ftruncate() with less than expected number of arguments --
-
-Warning: ftruncate() expects exactly 2 parameters, 0 given in %s on line %d
-bool(false)
-
-Warning: ftruncate() expects exactly 2 parameters, 1 given in %s on line %d
-bool(false)
-int(36)
--- Testing ftruncate() with more than expected number of arguments --
-
-Warning: ftruncate() expects exactly 2 parameters, 3 given in %s on line %d
-bool(false)
-int(36)
--- Testing ftruncate() with invalid file pointer --
--- Iteration 1 --
-
-Warning: ftruncate() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
--- Iteration 2 --
-
-Warning: ftruncate() expects parameter 1 to be resource, int given in %s on line %d
-bool(false)
--- Iteration 3 --
-
-Warning: ftruncate() expects parameter 1 to be resource, float given in %s on line %d
-bool(false)
--- Iteration 4 --
-
-Warning: ftruncate() expects parameter 1 to be resource, bool given in %s on line %d
-bool(false)
--- Iteration 5 --
-
-Warning: ftruncate() expects parameter 1 to be resource, array given in %s on line %d
-bool(false)
--- Iteration 6 --
-
-Warning: ftruncate() expects parameter 1 to be resource, object given in %s on line %d
-bool(false)
-- Testing ftruncate() with closed/unset file handle --
-
-Warning: ftruncate(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-int(36)
-
-Warning: ftruncate() expects parameter 1 to be resource, null given in %s on line %d
-bool(false)
+ftruncate(): supplied resource is not a valid stream resource
int(36)
Done
diff --git a/ext/standard/tests/file/ftruncate_variation4-win32.phpt b/ext/standard/tests/file/ftruncate_variation4-win32.phpt
deleted file mode 100644
index e2e92269e7..0000000000
--- a/ext/standard/tests/file/ftruncate_variation4-win32.phpt
+++ /dev/null
@@ -1,558 +0,0 @@
---TEST--
-Test ftruncate() function : usage variations - truncate file to negative size
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) != 'WIN') {
- die('skip.. only valid for Windows');
-}
-?>
---FILE--
-<?php
-/*
- Prototype: bool ftruncate ( resource $handle, int $size );
- Description: Truncates a file to a given length
-*/
-
-// include common file related test functions
-include ("file.inc");
-
-echo "*** Testing ftruncate() : usage variations ***\n";
-
-/* test ftruncate with file opened in different modes */
-$file_modes = array("r", "rb", "rt", "r+", "r+b", "r+t",
- "w", "wb", "wt", "w+", "w+b", "w+t",
- "x", "xb", "xt", "x+", "x+b", "x+t",
- "a", "ab", "at", "a+", "a+b", "a+t");
-
-$file_content_types = array("numeric","text_with_new_line");
-
-foreach($file_content_types as $file_content_type) {
- echo "\n-- Testing ftruncate() with file having data of type ". $file_content_type ." --\n";
-
- for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
- echo "-- Testing ftruncate() with file opening using $file_modes[$mode_counter] mode --\n";
-
- // create 1 file with some contents
- $filename = __DIR__."/ftruncate_variation4.tmp";
- if( strstr($file_modes[$mode_counter], "x") || strstr($file_modes[$mode_counter], "w") ) {
- // fopen the file using the $file_modes
- $file_handle = fopen($filename, $file_modes[$mode_counter]);
- fill_file($file_handle, $file_content_type, 1024);
- } else {
- create_files ( __DIR__, 1, $file_content_type, 0755, 1, "w", "ftruncate_variation", 4);
- // fopen the file using the $file_modes
- $file_handle = fopen($filename, $file_modes[$mode_counter]);
- }
- if (!$file_handle) {
- echo "Error: failed to open file $filename!\n";
- exit();
- }
-
- rewind($file_handle); // file pointer to 0
-
- echo "-- Testing ftruncate(): try truncating file to a negative size --\n";
- /* try to truncate it to a negative size, size should not change*/
-
- $new_size = -1000;
- var_dump( filesize($filename) ); // current filesize
- var_dump( ftell($file_handle) );
- var_dump( ftruncate($file_handle, $new_size) ); // truncate it
- var_dump( ftell($file_handle) );
- var_dump( feof($file_handle) );
- fclose($file_handle);
- clearstatcache(); // clear previous size value in cache
- var_dump( filesize($filename) ); // new file size = actual size, no change
-
- //delete all files created
- delete_file( $filename );
- }//end of inner for loop
-}//end of outer foreach loop
-echo "Done\n";
-?>
---EXPECTF--
-*** Testing ftruncate() : usage variations ***
-
--- Testing ftruncate() with file having data of type numeric --
--- Testing ftruncate() with file opening using r mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
--- Testing ftruncate() with file opening using rb mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
--- Testing ftruncate() with file opening using rt mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
--- Testing ftruncate() with file opening using r+ mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
--- Testing ftruncate() with file opening using r+b mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
--- Testing ftruncate() with file opening using r+t mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
--- Testing ftruncate() with file opening using w mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
--- Testing ftruncate() with file opening using wb mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
--- Testing ftruncate() with file opening using wt mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
--- Testing ftruncate() with file opening using w+ mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
--- Testing ftruncate() with file opening using w+b mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
--- Testing ftruncate() with file opening using w+t mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
--- Testing ftruncate() with file opening using x mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
--- Testing ftruncate() with file opening using xb mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
--- Testing ftruncate() with file opening using xt mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
--- Testing ftruncate() with file opening using x+ mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
--- Testing ftruncate() with file opening using x+b mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
--- Testing ftruncate() with file opening using x+t mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
--- Testing ftruncate() with file opening using a mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
--- Testing ftruncate() with file opening using ab mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
--- Testing ftruncate() with file opening using at mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
--- Testing ftruncate() with file opening using a+ mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
--- Testing ftruncate() with file opening using a+b mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
--- Testing ftruncate() with file opening using a+t mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
-
--- Testing ftruncate() with file having data of type text_with_new_line --
--- Testing ftruncate() with file opening using r mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
--- Testing ftruncate() with file opening using rb mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
--- Testing ftruncate() with file opening using rt mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
--- Testing ftruncate() with file opening using r+ mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
--- Testing ftruncate() with file opening using r+b mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
--- Testing ftruncate() with file opening using r+t mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
--- Testing ftruncate() with file opening using w mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
--- Testing ftruncate() with file opening using wb mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
--- Testing ftruncate() with file opening using wt mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1137)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1137)
--- Testing ftruncate() with file opening using w+ mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
--- Testing ftruncate() with file opening using w+b mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
--- Testing ftruncate() with file opening using w+t mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1137)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1137)
--- Testing ftruncate() with file opening using x mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
--- Testing ftruncate() with file opening using xb mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
--- Testing ftruncate() with file opening using xt mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1137)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1137)
--- Testing ftruncate() with file opening using x+ mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
--- Testing ftruncate() with file opening using x+b mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
--- Testing ftruncate() with file opening using x+t mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1137)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1137)
--- Testing ftruncate() with file opening using a mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
--- Testing ftruncate() with file opening using ab mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
--- Testing ftruncate() with file opening using at mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
--- Testing ftruncate() with file opening using a+ mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
--- Testing ftruncate() with file opening using a+b mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
--- Testing ftruncate() with file opening using a+t mode --
--- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
-int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
-int(0)
-bool(false)
-int(1024)
-Done
diff --git a/ext/standard/tests/file/ftruncate_variation4.phpt b/ext/standard/tests/file/ftruncate_variation4.phpt
index 3d06d1eb8e..95ae439b4d 100644
--- a/ext/standard/tests/file/ftruncate_variation4.phpt
+++ b/ext/standard/tests/file/ftruncate_variation4.phpt
@@ -1,11 +1,5 @@
--TEST--
Test ftruncate() function : usage variations - truncate file to negative size
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) == 'WIN') {
- die('skip.. Not valid for Windows');
-}
-?>
--FILE--
<?php
/*
@@ -27,532 +21,442 @@ $file_modes = array("r", "rb", "rt", "r+", "r+b", "r+t",
$file_content_types = array("numeric","text_with_new_line");
foreach($file_content_types as $file_content_type) {
- echo "\n-- Testing ftruncate() with file having data of type ". $file_content_type ." --\n";
-
- for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
- echo "-- Testing ftruncate() with file opening using $file_modes[$mode_counter] mode --\n";
-
- // create 1 file with some contents
- $filename = __DIR__."/ftruncate_variation4.tmp";
- if( strstr($file_modes[$mode_counter], "x") || strstr($file_modes[$mode_counter], "w") ) {
- // fopen the file using the $file_modes
- $file_handle = fopen($filename, $file_modes[$mode_counter]);
- fill_file($file_handle, $file_content_type, 1024);
- } else {
- create_files ( __DIR__, 1, $file_content_type, 0755, 1, "w", "ftruncate_variation", 4);
- // fopen the file using the $file_modes
- $file_handle = fopen($filename, $file_modes[$mode_counter]);
- }
- if (!$file_handle) {
- echo "Error: failed to open file $filename!\n";
- exit();
- }
-
- rewind($file_handle); // file pointer to 0
-
- echo "-- Testing ftruncate(): try truncating file to a negative size --\n";
- /* try to truncate it to a negative size, size should not change*/
-
- $new_size = -1000;
- var_dump( filesize($filename) ); // current filesize
- var_dump( ftell($file_handle) );
- var_dump( ftruncate($file_handle, $new_size) ); // truncate it
- var_dump( ftell($file_handle) );
- var_dump( feof($file_handle) );
- fclose($file_handle);
- clearstatcache(); // clear previous size value in cache
- var_dump( filesize($filename) ); // new file size = actual size, no change
-
- //delete all files created
- delete_file( $filename );
- }//end of inner for loop
+ echo "\n-- Testing ftruncate() with file having data of type ". $file_content_type ." --\n";
+
+ for($mode_counter = 0; $mode_counter < count($file_modes); $mode_counter++) {
+ echo "-- Testing ftruncate() with file opening using $file_modes[$mode_counter] mode --\n";
+
+ // create 1 file with some contents
+ $filename = __DIR__."/ftruncate_variation4.tmp";
+ if( strstr($file_modes[$mode_counter], "x") || strstr($file_modes[$mode_counter], "w") ) {
+ // fopen the file using the $file_modes
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ fill_file($file_handle, $file_content_type, 1024);
+ } else {
+ create_files ( __DIR__, 1, $file_content_type, 0755, 1, "w", "ftruncate_variation", 4);
+ // fopen the file using the $file_modes
+ $file_handle = fopen($filename, $file_modes[$mode_counter]);
+ }
+ if (!$file_handle) {
+ echo "Error: failed to open file $filename!\n";
+ exit();
+ }
+
+ rewind($file_handle); // file pointer to 0
+
+ echo "-- Testing ftruncate(): try truncating file to a negative size --\n";
+ /* try to truncate it to a negative size, size should not change*/
+
+ $new_size = -1000;
+ $file_size = filesize($filename); // current filesize
+ var_dump($file_size === 1024 || $file_size === 1137); // 1137 is for Windows with 't' mode
+ var_dump( ftell($file_handle) );
+ try {
+ var_dump( ftruncate($file_handle, $new_size) ); // truncate it
+ } catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+ }
+ var_dump( ftell($file_handle) );
+ var_dump( feof($file_handle) );
+ fclose($file_handle);
+ clearstatcache(); // clear previous size value in cache
+ $file_size = filesize($filename); // new file size = actual size, no change
+ var_dump($file_size === 1024 || $file_size === 1137); // 1137 is for Windows with 't' mode
+
+ //delete all files created
+ delete_file( $filename );
+ }//end of inner for loop
}//end of outer foreach loop
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
*** Testing ftruncate() : usage variations ***
-- Testing ftruncate() with file having data of type numeric --
-- Testing ftruncate() with file opening using r mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using rb mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using rt mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using r+ mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using r+b mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using r+t mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using w mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using wb mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using wt mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using w+ mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using w+b mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using w+t mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using x mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using xb mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using xt mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using x+ mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using x+b mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using x+t mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using a mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using ab mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using at mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using a+ mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using a+b mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using a+t mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file having data of type text_with_new_line --
-- Testing ftruncate() with file opening using r mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using rb mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using rt mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using r+ mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using r+b mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using r+t mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using w mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using wb mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using wt mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using w+ mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using w+b mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using w+t mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using x mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using xb mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using xt mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using x+ mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using x+b mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using x+t mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using a mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using ab mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using at mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using a+ mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using a+b mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
-- Testing ftruncate() with file opening using a+t mode --
-- Testing ftruncate(): try truncating file to a negative size --
-int(1024)
+bool(true)
int(0)
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
int(0)
bool(false)
-int(1024)
+bool(true)
Done
diff --git a/ext/standard/tests/file/fwrite.phpt b/ext/standard/tests/file/fwrite.phpt
index 7cdb270ae3..90e158d048 100644
--- a/ext/standard/tests/file/fwrite.phpt
+++ b/ext/standard/tests/file/fwrite.phpt
@@ -6,8 +6,7 @@ fwrite() tests
$filename = __DIR__."/fwrite.dat";
$fp = fopen($filename, "w");
-var_dump(fwrite($fp));
-var_dump(fwrite($fp, array()));
+var_dump(fwrite($fp, ""));
fclose($fp);
$fp = fopen($filename, "r");
@@ -20,35 +19,18 @@ fclose($fp);
var_dump(fwrite($fp, "data", -1));
-var_dump(fwrite(array(), "data", -1));
-var_dump(fwrite(array(), "data"));
-var_dump(fwrite(array()));
-
var_dump(file_get_contents($filename));
@unlink($filename);
echo "Done\n";
?>
--EXPECTF--
-Warning: fwrite() expects at least 2 parameters, 1 given in %s on line %d
-bool(false)
-
-Warning: fwrite() expects parameter 2 to be string, array given in %s on line %d
-bool(false)
+int(0)
-Notice: fwrite(): write of 4 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 4 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
int(4)
int(0)
-
-Warning: fwrite() expects parameter 1 to be resource, array given in %s on line %d
-bool(false)
-
-Warning: fwrite() expects parameter 1 to be resource, array given in %s on line %d
-bool(false)
-
-Warning: fwrite() expects at least 2 parameters, 1 given in %s on line %d
-bool(false)
string(4) "data"
Done
diff --git a/ext/standard/tests/file/fwrite_error.phpt b/ext/standard/tests/file/fwrite_error.phpt
index a54550a6c8..236c4601b0 100644
--- a/ext/standard/tests/file/fwrite_error.phpt
+++ b/ext/standard/tests/file/fwrite_error.phpt
@@ -16,18 +16,8 @@ include ("file.inc");
echo "*** Testing fwrite() : error conditions ***\n";
$filename = __DIR__."/fwrite_error.tmp";
-
-echo "-- Testing fwrite() with less than expected number of arguments --\n";
-// zero argument
-var_dump( fwrite() );
-// less than expected, 1 arg
$file_handle = fopen ( $filename, "w");
-var_dump( fwrite($file_handle) );
-
-// more than expected no. of args
-echo "-- Testing fwrite() with more than expected number of arguments --\n";
$data = "data";
-var_dump( fwrite($file_handle, $data, strlen($data), 10) );
// invalid length argument
echo "-- Testing fwrite() with invalid length arguments --\n";
@@ -36,31 +26,14 @@ var_dump( fwrite($file_handle, $data, $len) );
$len = -10;
var_dump( fwrite($file_handle, $data, $len) );
-// test invalid arguments : non-resources
-echo "-- Testing fwrite() with invalid arguments --\n";
-$invalid_args = array (
- "string",
- 10,
- 10.5,
- true,
- array(1,2,3),
- new stdclass,
-);
-/* loop to test fwrite() with different invalid type of args */
-for($loop_counter = 1; $loop_counter <= count($invalid_args); $loop_counter++) {
- echo "-- Iteration $loop_counter --\n";
- var_dump( fwrite($invalid_args[$loop_counter - 1], 10) );
-}
-
// fwrite() on a file handle which is already closed
echo "-- Testing fwrite() with closed/unset file handle --\n";
fclose($file_handle);
-var_dump(fwrite($file_handle,"data"));
-
-// fwrite on a file handle which is unset
-$fp = fopen($filename, "w");
-unset($fp); //unset file handle
-var_dump( fwrite(@$fp,"data"));
+try {
+ var_dump(fwrite($file_handle,"data"));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done\n";
?>
@@ -69,52 +42,11 @@ echo "Done\n";
$filename = __DIR__."/fwrite_error.tmp";
unlink( $filename );
?>
---EXPECTF--
+--EXPECT--
*** Testing fwrite() : error conditions ***
--- Testing fwrite() with less than expected number of arguments --
-
-Warning: fwrite() expects at least 2 parameters, 0 given in %s on line %d
-bool(false)
-
-Warning: fwrite() expects at least 2 parameters, 1 given in %s on line %d
-bool(false)
--- Testing fwrite() with more than expected number of arguments --
-
-Warning: fwrite() expects at most 3 parameters, 4 given in %s on line %d
-bool(false)
-- Testing fwrite() with invalid length arguments --
int(0)
int(0)
--- Testing fwrite() with invalid arguments --
--- Iteration 1 --
-
-Warning: fwrite() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
--- Iteration 2 --
-
-Warning: fwrite() expects parameter 1 to be resource, int given in %s on line %d
-bool(false)
--- Iteration 3 --
-
-Warning: fwrite() expects parameter 1 to be resource, float given in %s on line %d
-bool(false)
--- Iteration 4 --
-
-Warning: fwrite() expects parameter 1 to be resource, bool given in %s on line %d
-bool(false)
--- Iteration 5 --
-
-Warning: fwrite() expects parameter 1 to be resource, array given in %s on line %d
-bool(false)
--- Iteration 6 --
-
-Warning: fwrite() expects parameter 1 to be resource, object given in %s on line %d
-bool(false)
-- Testing fwrite() with closed/unset file handle --
-
-Warning: fwrite(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
-Warning: fwrite() expects parameter 1 to be resource, null given in %s on line %d
-bool(false)
+fwrite(): supplied resource is not a valid stream resource
Done
diff --git a/ext/standard/tests/file/fwrite_variation1-win32-mb.phpt b/ext/standard/tests/file/fwrite_variation1-win32-mb.phpt
index 706c765f8c..92d4a38b05 100644
--- a/ext/standard/tests/file/fwrite_variation1-win32-mb.phpt
+++ b/ext/standard/tests/file/fwrite_variation1-win32-mb.phpt
@@ -85,13 +85,13 @@ echo "Done\n";
-- Opening file in r --
int(0)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
int(2)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(2)
bool(false)
@@ -101,13 +101,13 @@ string(32) "950b7457d1deb6332f2fc5d42f3129d6"
-- Opening file in rb --
int(0)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
int(2)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(2)
bool(false)
@@ -117,13 +117,13 @@ string(32) "950b7457d1deb6332f2fc5d42f3129d6"
-- Opening file in rt --
int(0)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
int(2)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(2)
bool(false)
@@ -135,13 +135,13 @@ string(32) "950b7457d1deb6332f2fc5d42f3129d6"
-- Opening file in r --
int(0)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
int(2)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(2)
bool(false)
@@ -151,13 +151,13 @@ string(32) "e486000c4c8452774f746a27658d87fa"
-- Opening file in rb --
int(0)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
int(2)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(2)
bool(false)
@@ -167,13 +167,13 @@ string(32) "e486000c4c8452774f746a27658d87fa"
-- Opening file in rt --
int(0)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
int(2)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(2)
bool(false)
@@ -185,13 +185,13 @@ string(32) "e486000c4c8452774f746a27658d87fa"
-- Opening file in r --
int(0)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
int(2)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(2)
bool(false)
@@ -201,13 +201,13 @@ string(32) "b09c8026a64a88d36d4c2f17983964bb"
-- Opening file in rb --
int(0)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
int(2)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(2)
bool(false)
@@ -217,13 +217,13 @@ string(32) "b09c8026a64a88d36d4c2f17983964bb"
-- Opening file in rt --
int(0)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
int(2)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(2)
bool(false)
@@ -235,13 +235,13 @@ string(32) "b09c8026a64a88d36d4c2f17983964bb"
-- Opening file in r --
int(0)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
int(2)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(2)
bool(false)
@@ -251,13 +251,13 @@ string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
-- Opening file in rb --
int(0)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
int(2)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(2)
bool(false)
@@ -267,13 +267,13 @@ string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
-- Opening file in rt --
int(0)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
int(2)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(2)
bool(false)
diff --git a/ext/standard/tests/file/fwrite_variation1.phpt b/ext/standard/tests/file/fwrite_variation1.phpt
index 20bde9b71a..5ce8c4f2fa 100644
--- a/ext/standard/tests/file/fwrite_variation1.phpt
+++ b/ext/standard/tests/file/fwrite_variation1.phpt
@@ -77,13 +77,13 @@ echo "Done\n";
-- Opening file in r --
int(0)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
int(2)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(2)
bool(false)
@@ -93,13 +93,13 @@ string(32) "950b7457d1deb6332f2fc5d42f3129d6"
-- Opening file in rb --
int(0)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
int(2)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(2)
bool(false)
@@ -109,13 +109,13 @@ string(32) "950b7457d1deb6332f2fc5d42f3129d6"
-- Opening file in rt --
int(0)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
int(2)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(2)
bool(false)
@@ -127,13 +127,13 @@ string(32) "950b7457d1deb6332f2fc5d42f3129d6"
-- Opening file in r --
int(0)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
int(2)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(2)
bool(false)
@@ -143,13 +143,13 @@ string(32) "e486000c4c8452774f746a27658d87fa"
-- Opening file in rb --
int(0)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
int(2)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(2)
bool(false)
@@ -159,13 +159,13 @@ string(32) "e486000c4c8452774f746a27658d87fa"
-- Opening file in rt --
int(0)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
int(2)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(2)
bool(false)
@@ -177,13 +177,13 @@ string(32) "e486000c4c8452774f746a27658d87fa"
-- Opening file in r --
int(0)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
int(2)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(2)
bool(false)
@@ -193,13 +193,13 @@ string(32) "b09c8026a64a88d36d4c2f17983964bb"
-- Opening file in rb --
int(0)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
int(2)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(2)
bool(false)
@@ -209,13 +209,13 @@ string(32) "b09c8026a64a88d36d4c2f17983964bb"
-- Opening file in rt --
int(0)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
int(2)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(2)
bool(false)
@@ -227,13 +227,13 @@ string(32) "b09c8026a64a88d36d4c2f17983964bb"
-- Opening file in r --
int(0)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
int(2)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(2)
bool(false)
@@ -243,13 +243,13 @@ string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
-- Opening file in rb --
int(0)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
int(2)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(2)
bool(false)
@@ -259,13 +259,13 @@ string(32) "3fabd48d8eaa65c14e0d93d6880c560c"
-- Opening file in rt --
int(0)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(0)
bool(false)
int(2)
-Notice: fwrite(): write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
bool(false)
int(2)
bool(false)
diff --git a/ext/standard/tests/file/get_current_user.phpt b/ext/standard/tests/file/get_current_user.phpt
index f23d2fabef..04938e3d6b 100644
--- a/ext/standard/tests/file/get_current_user.phpt
+++ b/ext/standard/tests/file/get_current_user.phpt
@@ -3,13 +3,10 @@ get_current_user() tests
--FILE--
<?php
-var_dump(get_current_user("blah"));
var_dump(get_current_user());
echo "Done\n";
?>
--EXPECTF--
-Warning: get_current_user() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
string(%d) %s
Done
diff --git a/ext/standard/tests/file/glob_variation-win32-mb.phpt b/ext/standard/tests/file/glob_variation-win32-mb.phpt
index fd068b01ad..2ced6fd355 100644
--- a/ext/standard/tests/file/glob_variation-win32-mb.phpt
+++ b/ext/standard/tests/file/glob_variation-win32-mb.phpt
@@ -46,12 +46,16 @@ $counter = 1;
using glob() */
foreach($patterns as $pattern) {
echo "\n-- Iteration $counter --\n";
- var_dump( glob($pattern) ); // default arguments
- var_dump( glob($pattern, GLOB_MARK) );
- var_dump( glob($pattern, GLOB_NOSORT) );
- var_dump( glob($pattern, GLOB_NOCHECK) );
- var_dump( glob($pattern, GLOB_NOESCAPE) );
- var_dump( glob($pattern, GLOB_ERR) );
+ try {
+ var_dump( glob($pattern) ); // default arguments
+ var_dump( glob($pattern, GLOB_MARK) );
+ var_dump( glob($pattern, GLOB_NOSORT) );
+ var_dump( glob($pattern, GLOB_NOCHECK) );
+ var_dump( glob($pattern, GLOB_NOESCAPE) );
+ var_dump( glob($pattern, GLOB_ERR) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$counter++;
}
@@ -73,7 +77,11 @@ $counter = 1;
using glob() */
foreach($patterns as $pattern) {
echo "-- Iteration $counter --\n";
- var_dump( glob($pattern, GLOB_ONLYDIR) );
+ try {
+ var_dump( glob($pattern, GLOB_ONLYDIR) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$counter++;
}
@@ -326,24 +334,7 @@ array(0) {
}
-- Iteration 8 --
-
-Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32-mb.php on line %d
-NULL
-
-Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32-mb.php on line %d
-NULL
-
-Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32-mb.php on line %d
-NULL
-
-Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32-mb.php on line %d
-NULL
-
-Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32-mb.php on line %d
-NULL
-
-Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32-mb.php on line %d
-NULL
+glob() expects parameter 1 to be a valid path, string given
-- Iteration 9 --
array(0) {
@@ -446,9 +437,7 @@ array(1) {
array(0) {
}
-- Iteration 8 --
-
-Warning: glob() expects parameter 1 to be a valid path, string given in %sglob_variation-win32-mb.php on line %d
-NULL
+glob() expects parameter 1 to be a valid path, string given
-- Iteration 9 --
array(0) {
}
diff --git a/ext/standard/tests/file/glob_variation-win32.phpt b/ext/standard/tests/file/glob_variation-win32.phpt
index 9a1528bb1f..32d56e8762 100644
--- a/ext/standard/tests/file/glob_variation-win32.phpt
+++ b/ext/standard/tests/file/glob_variation-win32.phpt
@@ -45,12 +45,16 @@ $counter = 1;
using glob() */
foreach($patterns as $pattern) {
echo "\n-- Iteration $counter --\n";
- var_dump( glob($pattern) ); // default arguments
- var_dump( glob($pattern, GLOB_MARK) );
- var_dump( glob($pattern, GLOB_NOSORT) );
- var_dump( glob($pattern, GLOB_NOCHECK) );
- var_dump( glob($pattern, GLOB_NOESCAPE) );
- var_dump( glob($pattern, GLOB_ERR) );
+ try {
+ var_dump( glob($pattern) ); // default arguments
+ var_dump( glob($pattern, GLOB_MARK) );
+ var_dump( glob($pattern, GLOB_NOSORT) );
+ var_dump( glob($pattern, GLOB_NOCHECK) );
+ var_dump( glob($pattern, GLOB_NOESCAPE) );
+ var_dump( glob($pattern, GLOB_ERR) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$counter++;
}
@@ -72,7 +76,11 @@ $counter = 1;
using glob() */
foreach($patterns as $pattern) {
echo "-- Iteration $counter --\n";
- var_dump( glob($pattern, GLOB_ONLYDIR) );
+ try {
+ var_dump( glob($pattern, GLOB_ONLYDIR) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$counter++;
}
@@ -325,24 +333,7 @@ array(0) {
}
-- Iteration 8 --
-
-Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32.php on line %d
-NULL
-
-Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32.php on line %d
-NULL
-
-Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32.php on line %d
-NULL
-
-Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32.php on line %d
-NULL
-
-Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32.php on line %d
-NULL
-
-Warning: glob() expects parameter 1 to be a valid path, string given %sglob_variation-win32.php on line %d
-NULL
+glob() expects parameter 1 to be a valid path, string given
-- Iteration 9 --
array(0) {
@@ -445,9 +436,7 @@ array(1) {
array(0) {
}
-- Iteration 8 --
-
-Warning: glob() expects parameter 1 to be a valid path, string given in %sglob_variation-win32.php on line %d
-NULL
+glob() expects parameter 1 to be a valid path, string given
-- Iteration 9 --
array(0) {
}
diff --git a/ext/standard/tests/file/glob_variation.phpt b/ext/standard/tests/file/glob_variation.phpt
index 056cf62bec..eb5aff0cf4 100644
--- a/ext/standard/tests/file/glob_variation.phpt
+++ b/ext/standard/tests/file/glob_variation.phpt
@@ -48,12 +48,16 @@ $counter = 1;
using glob() */
foreach($patterns as $pattern) {
echo "\n-- Iteration $counter --\n";
- var_dump( glob($pattern) ); // default arguments
- var_dump( glob($pattern, GLOB_MARK) );
- var_dump( glob($pattern, GLOB_NOSORT) );
- var_dump( glob($pattern, GLOB_NOCHECK) );
- var_dump( glob($pattern, GLOB_NOESCAPE) );
- var_dump( glob($pattern, GLOB_ERR) );
+ try {
+ var_dump( glob($pattern) ); // default arguments
+ var_dump( glob($pattern, GLOB_MARK) );
+ var_dump( glob($pattern, GLOB_NOSORT) );
+ var_dump( glob($pattern, GLOB_NOCHECK) );
+ var_dump( glob($pattern, GLOB_NOESCAPE) );
+ var_dump( glob($pattern, GLOB_ERR) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$counter++;
}
@@ -75,7 +79,11 @@ $counter = 1;
using glob() */
foreach($patterns as $pattern) {
echo "-- Iteration $counter --\n";
- var_dump( glob($pattern, GLOB_ONLYDIR) );
+ try {
+ var_dump( glob($pattern, GLOB_ONLYDIR) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$counter++;
}
@@ -328,24 +336,7 @@ array(0) {
}
-- Iteration 8 --
-
-Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+glob() expects parameter 1 to be a valid path, string given
-- Iteration 9 --
array(0) {
@@ -448,9 +439,7 @@ array(1) {
array(0) {
}
-- Iteration 8 --
-
-Warning: glob() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+glob() expects parameter 1 to be a valid path, string given
-- Iteration 9 --
array(0) {
}
diff --git a/ext/standard/tests/file/glob_variation3.phpt b/ext/standard/tests/file/glob_variation3.phpt
index 5db242825e..4bf008a9a7 100644
--- a/ext/standard/tests/file/glob_variation3.phpt
+++ b/ext/standard/tests/file/glob_variation3.phpt
@@ -15,7 +15,6 @@ var_dump(glob("$path/directly_not_exists"));
var_dump(empty(ini_get('open_basedir')));
?>
-==DONE==
--EXPECT--
array(0) {
}
@@ -30,4 +29,3 @@ array(0) {
array(0) {
}
bool(true)
-==DONE==
diff --git a/ext/standard/tests/file/glob_variation4.phpt b/ext/standard/tests/file/glob_variation4.phpt
index 6544c96944..b96f14fb38 100644
--- a/ext/standard/tests/file/glob_variation4.phpt
+++ b/ext/standard/tests/file/glob_variation4.phpt
@@ -15,7 +15,6 @@ var_dump(glob("$path/directly_not_exists"));
var_dump($path == ini_get('open_basedir'));
?>
-==DONE==
--EXPECT--
array(0) {
}
@@ -30,4 +29,3 @@ array(0) {
array(0) {
}
bool(true)
-==DONE==
diff --git a/ext/standard/tests/file/glob_variation5.phpt b/ext/standard/tests/file/glob_variation5.phpt
index 800305aabd..e03bc08d56 100644
--- a/ext/standard/tests/file/glob_variation5.phpt
+++ b/ext/standard/tests/file/glob_variation5.phpt
@@ -17,7 +17,6 @@ var_dump(glob("$path/directly_not_exists"));
var_dump('/tmp' == ini_get('open_basedir'));
?>
-==DONE==
--EXPECT--
bool(false)
bool(false)
@@ -26,4 +25,3 @@ bool(false)
bool(false)
bool(false)
bool(true)
-==DONE==
diff --git a/ext/standard/tests/file/glob_variation6.phpt b/ext/standard/tests/file/glob_variation6.phpt
index e0eaeb8c6e..553819326f 100644
--- a/ext/standard/tests/file/glob_variation6.phpt
+++ b/ext/standard/tests/file/glob_variation6.phpt
@@ -17,7 +17,6 @@ var_dump(glob("$path/directly_not_exists"));
var_dump('c:\\windows' == ini_get('open_basedir'));
?>
-==DONE==
--EXPECT--
array(0) {
}
@@ -32,4 +31,3 @@ array(0) {
array(0) {
}
bool(true)
-==DONE==
diff --git a/ext/standard/tests/file/include_streams.phpt b/ext/standard/tests/file/include_streams.phpt
index 0b9446ff9e..90629d3ffc 100644
--- a/ext/standard/tests/file/include_streams.phpt
+++ b/ext/standard/tests/file/include_streams.phpt
@@ -10,99 +10,99 @@ EOD;
class mystream
{
- public $path;
- public $mode;
- public $options;
-
- public $position;
- public $varname;
-
- function url_stat($path, $flags) {
- return array();
- }
-
- function stream_stat() {
- return array();
- }
-
- function stream_open($path, $mode, $options, &$opened_path)
- {
- $this->path = $path;
- $this->mode = $mode;
- $this->options = $options;
-
- $split = parse_url($path);
- if ($split["host"] !== "GLOBALS" ||
- empty($split["path"]) ||
- empty($GLOBALS[substr($split["path"],1)])) {
- return false;
- }
- $this->varname = substr($split["path"],1);
-
- if (strchr($mode, 'a'))
- $this->position = strlen($GLOBALS[$this->varname]);
- else
- $this->position = 0;
-
- return true;
- }
-
- function stream_read($count)
- {
- $ret = substr($GLOBALS[$this->varname], $this->position, $count);
- $this->position += strlen($ret);
- return $ret;
- }
-
- function stream_tell()
- {
- return $this->position;
- }
-
- function stream_eof()
- {
- return $this->position >= strlen($GLOBALS[$this->varname]);
- }
-
- function stream_seek($offset, $whence)
- {
- switch($whence) {
- case SEEK_SET:
- if ($offset < strlen($GLOBALS[$this->varname]) && $offset >= 0) {
- $this->position = $offset;
- return true;
- } else {
- return false;
- }
- break;
- case SEEK_CUR:
- if ($offset >= 0) {
- $this->position += $offset;
- return true;
- } else {
- return false;
- }
- break;
- case SEEK_END:
- if (strlen($GLOBALS[$this->varname]) + $offset >= 0) {
- $this->position = strlen($GLOBALS[$this->varname]) + $offset;
- return true;
- } else {
- return false;
- }
- break;
- default:
- return false;
- }
- }
-
- function stream_set_option($option, $arg1, $arg2) {
- return false;
- }
+ public $path;
+ public $mode;
+ public $options;
+
+ public $position;
+ public $varname;
+
+ function url_stat($path, $flags) {
+ return array();
+ }
+
+ function stream_stat() {
+ return array();
+ }
+
+ function stream_open($path, $mode, $options, &$opened_path)
+ {
+ $this->path = $path;
+ $this->mode = $mode;
+ $this->options = $options;
+
+ $split = parse_url($path);
+ if ($split["host"] !== "GLOBALS" ||
+ empty($split["path"]) ||
+ empty($GLOBALS[substr($split["path"],1)])) {
+ return false;
+ }
+ $this->varname = substr($split["path"],1);
+
+ if (strchr($mode, 'a'))
+ $this->position = strlen($GLOBALS[$this->varname]);
+ else
+ $this->position = 0;
+
+ return true;
+ }
+
+ function stream_read($count)
+ {
+ $ret = substr($GLOBALS[$this->varname], $this->position, $count);
+ $this->position += strlen($ret);
+ return $ret;
+ }
+
+ function stream_tell()
+ {
+ return $this->position;
+ }
+
+ function stream_eof()
+ {
+ return $this->position >= strlen($GLOBALS[$this->varname]);
+ }
+
+ function stream_seek($offset, $whence)
+ {
+ switch($whence) {
+ case SEEK_SET:
+ if ($offset < strlen($GLOBALS[$this->varname]) && $offset >= 0) {
+ $this->position = $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+ case SEEK_CUR:
+ if ($offset >= 0) {
+ $this->position += $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+ case SEEK_END:
+ if (strlen($GLOBALS[$this->varname]) + $offset >= 0) {
+ $this->position = strlen($GLOBALS[$this->varname]) + $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+ default:
+ return false;
+ }
+ }
+
+ function stream_set_option($option, $arg1, $arg2) {
+ return false;
+ }
}
if (!stream_wrapper_register("test", "mystream")) {
- die("test wrapper registration failed");
+ die("test wrapper registration failed");
}
echo file_get_contents("test://GLOBALS/data1");
diff --git a/ext/standard/tests/file/include_userstream_001.phpt b/ext/standard/tests/file/include_userstream_001.phpt
index d769a4f3b2..988a8bf085 100644
--- a/ext/standard/tests/file/include_userstream_001.phpt
+++ b/ext/standard/tests/file/include_userstream_001.phpt
@@ -7,66 +7,66 @@ allow_url_include=0
<?php
class test {
private $data = '<?php echo "Hello World\n";?>';
- private $pos;
+ private $pos;
- function stream_open($path, $mode, $options, &$opened_path)
- {
- if (strchr($mode, 'a'))
- $this->pos = strlen($this->data);
- else
- $this->po = 0;
+ function stream_open($path, $mode, $options, &$opened_path)
+ {
+ if (strchr($mode, 'a'))
+ $this->pos = strlen($this->data);
+ else
+ $this->po = 0;
- return true;
- }
+ return true;
+ }
- function stream_read($count)
- {
- $ret = substr($this->data, $this->pos, $count);
- $this->pos += strlen($ret);
- return $ret;
- }
+ function stream_read($count)
+ {
+ $ret = substr($this->data, $this->pos, $count);
+ $this->pos += strlen($ret);
+ return $ret;
+ }
- function stream_tell()
- {
- return $this->pos;
- }
+ function stream_tell()
+ {
+ return $this->pos;
+ }
- function stream_eof()
- {
- return $this->pos >= strlen($this->data);
- }
+ function stream_eof()
+ {
+ return $this->pos >= strlen($this->data);
+ }
- function stream_seek($offset, $whence)
- {
- switch($whence) {
- case SEEK_SET:
- if ($offset < $this->data && $offset >= 0) {
- $this->pos = $offset;
- return true;
- } else {
- return false;
- }
- break;
- case SEEK_CUR:
- if ($offset >= 0) {
- $this->pos += $offset;
- return true;
- } else {
- return false;
- }
- break;
- case SEEK_END:
- if (strlen($this->data) + $offset >= 0) {
- $this->pos = strlen($this->data) + $offset;
- return true;
- } else {
- return false;
- }
- break;
- default:
- return false;
- }
- }
+ function stream_seek($offset, $whence)
+ {
+ switch($whence) {
+ case SEEK_SET:
+ if ($offset < $this->data && $offset >= 0) {
+ $this->pos = $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+ case SEEK_CUR:
+ if ($offset >= 0) {
+ $this->pos += $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+ case SEEK_END:
+ if (strlen($this->data) + $offset >= 0) {
+ $this->pos = strlen($this->data) + $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+ default:
+ return false;
+ }
+ }
}
diff --git a/ext/standard/tests/file/include_userstream_002.phpt b/ext/standard/tests/file/include_userstream_002.phpt
index cc1887c446..15c05314a5 100644
--- a/ext/standard/tests/file/include_userstream_002.phpt
+++ b/ext/standard/tests/file/include_userstream_002.phpt
@@ -7,83 +7,83 @@ allow_url_include=0
<?php
class test {
private $data = '<?php echo "Hello World\n";?>';
- private $pos;
- private $stream = null;
+ private $pos;
+ private $stream = null;
- function stream_open($path, $mode, $options, &$opened_path)
- {
- if (strpos($path, "test2://") === 0) {
- $this->stream = fopen("test1://".substr($path, 8), $mode);
- return !empty($this->stream);
- }
- if (strchr($mode, 'a'))
- $this->pos = strlen($this->data);
- else
- $this->po = 0;
+ function stream_open($path, $mode, $options, &$opened_path)
+ {
+ if (strpos($path, "test2://") === 0) {
+ $this->stream = fopen("test1://".substr($path, 8), $mode);
+ return !empty($this->stream);
+ }
+ if (strchr($mode, 'a'))
+ $this->pos = strlen($this->data);
+ else
+ $this->po = 0;
- return true;
- }
+ return true;
+ }
- function stream_read($count)
- {
- if (!empty($this->stream)) {
- return fread($this->stream, $count);
- }
- $ret = substr($this->data, $this->pos, $count);
- $this->pos += strlen($ret);
- return $ret;
- }
+ function stream_read($count)
+ {
+ if (!empty($this->stream)) {
+ return fread($this->stream, $count);
+ }
+ $ret = substr($this->data, $this->pos, $count);
+ $this->pos += strlen($ret);
+ return $ret;
+ }
- function stream_tell()
- {
- if (!empty($this->stream)) {
- return ftell($this->stream);
- }
- return $this->pos;
- }
+ function stream_tell()
+ {
+ if (!empty($this->stream)) {
+ return ftell($this->stream);
+ }
+ return $this->pos;
+ }
- function stream_eof()
- {
- if (!empty($this->stream)) {
- return feof($this->stream);
- }
- return $this->pos >= strlen($this->data);
- }
+ function stream_eof()
+ {
+ if (!empty($this->stream)) {
+ return feof($this->stream);
+ }
+ return $this->pos >= strlen($this->data);
+ }
- function stream_seek($offset, $whence)
- {
- if (!empty($this->stream)) {
- return fseek($this->stream, $offset, $whence);
- }
- switch($whence) {
- case SEEK_SET:
- if ($offset < $this->data && $offset >= 0) {
- $this->pos = $offset;
- return true;
- } else {
- return false;
- }
- break;
- case SEEK_CUR:
- if ($offset >= 0) {
- $this->pos += $offset;
- return true;
- } else {
- return false;
- }
- break;
- case SEEK_END:
- if (strlen($this->data) + $offset >= 0) {
- $this->pos = strlen($this->data) + $offset;
- return true;
- } else {
- return false;
- }
- break;
- default:
- return false;
- }
- }
+ function stream_seek($offset, $whence)
+ {
+ if (!empty($this->stream)) {
+ return fseek($this->stream, $offset, $whence);
+ }
+ switch($whence) {
+ case SEEK_SET:
+ if ($offset < $this->data && $offset >= 0) {
+ $this->pos = $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+ case SEEK_CUR:
+ if ($offset >= 0) {
+ $this->pos += $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+ case SEEK_END:
+ if (strlen($this->data) + $offset >= 0) {
+ $this->pos = strlen($this->data) + $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+ default:
+ return false;
+ }
+ }
}
@@ -99,8 +99,8 @@ include "test2://hello";
Warning: fopen(): test1:// wrapper is disabled in the server configuration by allow_url_include=0 in %sinclude_userstream_002.php on line 10
-Warning: fopen(test1://hello): failed to open stream: no suitable wrapper could be found in %sinclude_userstream_002.php on line 10
+Warning: fopen(test1://hello): Failed to open stream: no suitable wrapper could be found in %sinclude_userstream_002.php on line 10
-Warning: include(test2://hello): failed to open stream: "test::stream_open" call failed in %sinclude_userstream_002.php on line 89
+Warning: include(test2://hello): Failed to open stream: "test::stream_open" call failed in %sinclude_userstream_002.php on line 89
Warning: include(): Failed opening 'test2://hello' for inclusion (include_path='%s') in %sinclude_userstream_002.php on line 89
diff --git a/ext/standard/tests/file/include_userstream_003.phpt b/ext/standard/tests/file/include_userstream_003.phpt
index 71f8920d53..ae6ec62649 100644
--- a/ext/standard/tests/file/include_userstream_003.phpt
+++ b/ext/standard/tests/file/include_userstream_003.phpt
@@ -7,83 +7,83 @@ allow_url_include=1
<?php
class test {
private $data = '<?php echo "Hello World\n";?>';
- private $pos;
- private $stream = null;
-
- function stream_open($path, $mode, $options, &$opened_path)
- {
- if (strpos($path, "test2://") === 0) {
- $this->stream = fopen("test1://".substr($path, 8), $mode);
- return !empty($this->stream);
- }
- if (strchr($mode, 'a'))
- $this->pos = strlen($this->data);
- else
- $this->po = 0;
-
- return true;
- }
-
- function stream_read($count)
- {
- if (!empty($this->stream)) {
- return fread($this->stream, $count);
- }
- $ret = substr($this->data, $this->pos, $count);
- $this->pos += strlen($ret);
- return $ret;
- }
-
- function stream_tell()
- {
- if (!empty($this->stream)) {
- return ftell($this->stream);
- }
- return $this->pos;
- }
-
- function stream_eof()
- {
- if (!empty($this->stream)) {
- return feof($this->stream);
- }
- return $this->pos >= strlen($this->data);
- }
-
- function stream_seek($offset, $whence)
- {
- if (!empty($this->stream)) {
- return fseek($this->stream, $offset, $whence);
- }
- switch($whence) {
- case SEEK_SET:
- if ($offset < $this->data && $offset >= 0) {
- $this->pos = $offset;
- return true;
- } else {
- return false;
- }
- break;
- case SEEK_CUR:
- if ($offset >= 0) {
- $this->pos += $offset;
- return true;
- } else {
- return false;
- }
- break;
- case SEEK_END:
- if (strlen($this->data) + $offset >= 0) {
- $this->pos = strlen($this->data) + $offset;
- return true;
- } else {
- return false;
- }
- break;
- default:
- return false;
- }
- }
+ private $pos;
+ private $stream = null;
+
+ function stream_open($path, $mode, $options, &$opened_path)
+ {
+ if (strpos($path, "test2://") === 0) {
+ $this->stream = fopen("test1://".substr($path, 8), $mode);
+ return !empty($this->stream);
+ }
+ if (strchr($mode, 'a'))
+ $this->pos = strlen($this->data);
+ else
+ $this->po = 0;
+
+ return true;
+ }
+
+ function stream_read($count)
+ {
+ if (!empty($this->stream)) {
+ return fread($this->stream, $count);
+ }
+ $ret = substr($this->data, $this->pos, $count);
+ $this->pos += strlen($ret);
+ return $ret;
+ }
+
+ function stream_tell()
+ {
+ if (!empty($this->stream)) {
+ return ftell($this->stream);
+ }
+ return $this->pos;
+ }
+
+ function stream_eof()
+ {
+ if (!empty($this->stream)) {
+ return feof($this->stream);
+ }
+ return $this->pos >= strlen($this->data);
+ }
+
+ function stream_seek($offset, $whence)
+ {
+ if (!empty($this->stream)) {
+ return fseek($this->stream, $offset, $whence);
+ }
+ switch($whence) {
+ case SEEK_SET:
+ if ($offset < $this->data && $offset >= 0) {
+ $this->pos = $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+ case SEEK_CUR:
+ if ($offset >= 0) {
+ $this->pos += $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+ case SEEK_END:
+ if (strlen($this->data) + $offset >= 0) {
+ $this->pos = strlen($this->data) + $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+ default:
+ return false;
+ }
+ }
}
@@ -98,26 +98,26 @@ Deprecated: Directive 'allow_url_include' is deprecated in Unknown on line 0
Warning: file_get_contents(): test1:// wrapper is disabled in the server configuration by allow_url_fopen=0 in %sinclude_userstream_003.php on line 86
-Warning: file_get_contents(test1://hello): failed to open stream: no suitable wrapper could be found in %sinclude_userstream_003.php on line 86
+Warning: file_get_contents(test1://hello): Failed to open stream: no suitable wrapper could be found in %sinclude_userstream_003.php on line 86
Warning: include(): test1:// wrapper is disabled in the server configuration by allow_url_fopen=0 in %sinclude_userstream_003.php on line 87
-Warning: include(test1://hello): failed to open stream: no suitable wrapper could be found in %sinclude_userstream_003.php on line 87
+Warning: include(test1://hello): Failed to open stream: no suitable wrapper could be found in %sinclude_userstream_003.php on line 87
Warning: include(): Failed opening 'test1://hello' for inclusion (include_path='%s') in %sinclude_userstream_003.php on line 87
Warning: fopen(): test1:// wrapper is disabled in the server configuration by allow_url_fopen=0 in %sinclude_userstream_003.php on line 10
-Warning: fopen(test1://hello): failed to open stream: no suitable wrapper could be found in %sinclude_userstream_003.php on line 10
+Warning: fopen(test1://hello): Failed to open stream: no suitable wrapper could be found in %sinclude_userstream_003.php on line 10
-Warning: file_get_contents(test2://hello): failed to open stream: "test::stream_open" call failed in %sinclude_userstream_003.php on line 88
+Warning: file_get_contents(test2://hello): Failed to open stream: "test::stream_open" call failed in %sinclude_userstream_003.php on line 88
Warning: fopen(): test1:// wrapper is disabled in the server configuration by allow_url_fopen=0 in %sinclude_userstream_003.php on line 10
-Warning: fopen(test1://hello): failed to open stream: no suitable wrapper could be found in %sinclude_userstream_003.php on line 10
+Warning: fopen(test1://hello): Failed to open stream: no suitable wrapper could be found in %sinclude_userstream_003.php on line 10
-Warning: include(test2://hello): failed to open stream: "test::stream_open" call failed in %sinclude_userstream_003.php on line 89
+Warning: include(test2://hello): Failed to open stream: "test::stream_open" call failed in %sinclude_userstream_003.php on line 89
Warning: include(): Failed opening 'test2://hello' for inclusion (include_path='%s') in %sinclude_userstream_003.php on line 89
diff --git a/ext/standard/tests/file/is_dir_variation3.phpt b/ext/standard/tests/file/is_dir_variation3.phpt
index 3f9d196e64..e82d9ae034 100644
--- a/ext/standard/tests/file/is_dir_variation3.phpt
+++ b/ext/standard/tests/file/is_dir_variation3.phpt
@@ -11,8 +11,6 @@ obscure_filename
/* Passing invalid arguments to is_dir() */
-$dir_handle = opendir( __DIR__ );
-
echo "*** Testing is_dir() with Invalid arguments: expected bool(false) ***\n";
$dirnames = array(
/* Invalid dirnames */
@@ -21,7 +19,6 @@ $dirnames = array(
FALSE,
NULL,
" ",
- $dir_handle,
/* scalars */
0,
@@ -32,7 +29,6 @@ $dirnames = array(
foreach($dirnames as $dirname) {
var_dump( is_dir($dirname) );
}
-closedir($dir_handle);
?>
--EXPECTF--
*** Testing is_dir() with Invalid arguments: expected bool(false) ***
@@ -41,8 +37,5 @@ bool(false)
bool(false)
bool(false)
bool(false)
-
-Warning: is_dir() expects parameter 1 to be a valid path, resource given in %s on line %d
-NULL
bool(false)
bool(false)
diff --git a/ext/standard/tests/file/is_dir_variation4.phpt b/ext/standard/tests/file/is_dir_variation4.phpt
index 543533f8ed..8d4838524e 100644
--- a/ext/standard/tests/file/is_dir_variation4.phpt
+++ b/ext/standard/tests/file/is_dir_variation4.phpt
@@ -38,7 +38,11 @@ $count = 1;
/* loop through to test each element the above array */
foreach($dirs_arr as $dir) {
echo "\n-- Iteration $count --\n";
- var_dump( is_dir($file_path."/".$dir ) );
+ try {
+ var_dump( is_dir($file_path."/".$dir ) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$count++;
}
@@ -77,13 +81,9 @@ bool(true)
bool(false)
-- Iteration 9 --
-
-Warning: is_dir() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+is_dir() expects parameter 1 to be a valid path, string given
-- Iteration 10 --
-
-Warning: is_dir() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+is_dir() expects parameter 1 to be a valid path, string given
*** Done ***
diff --git a/ext/standard/tests/file/is_executable_error.phpt b/ext/standard/tests/file/is_executable_error.phpt
index 99c218b514..ad90d64435 100644
--- a/ext/standard/tests/file/is_executable_error.phpt
+++ b/ext/standard/tests/file/is_executable_error.phpt
@@ -6,24 +6,11 @@ Test is_executable() function: error conditions
Description: Tells whether the filename is executable
*/
-echo "*** Testing is_executable(): error conditions ***\n";
-var_dump( is_executable() ); // args < expected no of arguments
-
-var_dump( is_executable(1, 2) ); // args > expected no. of arguments
-
echo "\n*** Testing is_exceutable() on non-existent directory ***\n";
var_dump( is_executable(__DIR__."/is_executable") );
echo "Done\n";
--EXPECTF--
-*** Testing is_executable(): error conditions ***
-
-Warning: is_executable() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: is_executable() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
*** Testing is_exceutable() on non-existent directory ***
bool(false)
Done
diff --git a/ext/standard/tests/file/is_executable_variation1.phpt b/ext/standard/tests/file/is_executable_variation1.phpt
index 1e8d8f5faf..5c8193b44d 100644
--- a/ext/standard/tests/file/is_executable_variation1.phpt
+++ b/ext/standard/tests/file/is_executable_variation1.phpt
@@ -51,7 +51,11 @@ $counter = 1;
is an executable file */
foreach($files_arr as $file) {
echo "-- Iteration $counter --\n";
- var_dump( is_executable($file) );
+ try {
+ var_dump( is_executable($file) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$counter++;
clearstatcache();
}
@@ -76,13 +80,9 @@ bool(false)
-- Iteration 5 --
bool(false)
-- Iteration 6 --
-
-Warning: is_executable() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+is_executable() expects parameter 1 to be a valid path, string given
-- Iteration 7 --
-
-Warning: is_executable() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+is_executable() expects parameter 1 to be a valid path, string given
-- Iteration 8 --
bool(false)
-- Iteration 9 --
diff --git a/ext/standard/tests/file/is_executable_variation2.phpt b/ext/standard/tests/file/is_executable_variation2.phpt
index 5b07f683d3..e333b270bc 100644
--- a/ext/standard/tests/file/is_executable_variation2.phpt
+++ b/ext/standard/tests/file/is_executable_variation2.phpt
@@ -26,7 +26,7 @@ chmod("$file_path/is_executable_variation2", 0444);
var_dump( is_executable("$file_path/is_executable_variation2") ); // exp: bool(false)
chmod("$file_path/is_executable_variation2", 0777); // chmod to enable deletion of directory
-echo "\n*** Testing miscelleneous input for is_executable() function ***\n";
+echo "\n*** Testing miscellaneous input for is_executable() function ***\n";
$name_prefix = "is_executable_variation2";
create_files(__DIR__, 1, "numeric", 0755, 1, "w", $name_prefix, 1);
create_files(__DIR__, 1, "text", 0755, 1, "w", $name_prefix, 2);
@@ -77,7 +77,7 @@ rmdir(__DIR__."/is_executable_variation2/");
*** Testing is_executable() on directory without execute permission ***
bool(false)
-*** Testing miscelleneous input for is_executable() function ***
+*** Testing miscellaneous input for is_executable() function ***
-- Iteration 1 --
bool(true)
-- Iteration 2 --
diff --git a/ext/standard/tests/file/is_executable_variation3.phpt b/ext/standard/tests/file/is_executable_variation3.phpt
index 1a71a5a005..92ad3320d3 100644
--- a/ext/standard/tests/file/is_executable_variation3.phpt
+++ b/ext/standard/tests/file/is_executable_variation3.phpt
@@ -29,7 +29,6 @@ $invalid_files = array(
FALSE,
NULL,
" ",
- @array(),
@$file_handle
);
/* loop through to test each element in the above array
@@ -52,8 +51,5 @@ bool(false)
bool(false)
bool(false)
bool(false)
-
-Warning: is_executable() expects parameter 1 to be a valid path, array given in %s on line %d
-NULL
bool(false)
Done
diff --git a/ext/standard/tests/file/is_file_variation1.phpt b/ext/standard/tests/file/is_file_variation1.phpt
index c8a26ea7c7..9593b9c495 100644
--- a/ext/standard/tests/file/is_file_variation1.phpt
+++ b/ext/standard/tests/file/is_file_variation1.phpt
@@ -15,7 +15,7 @@ $file_path = __DIR__;
echo "-- Testing is_file() with file containing data --\n";
$filename = $file_path."/is_file_variation1.tmp";
$file_handle = fopen($filename, "w" );
-fwrite( $file_handle, "Hello, world....." ); // exptected true
+fwrite( $file_handle, "Hello, world....." ); // expected true
fclose($file_handle);
var_dump( is_file($filename) );
clearstatcache();
diff --git a/ext/standard/tests/file/is_file_variation3.phpt b/ext/standard/tests/file/is_file_variation3.phpt
index d18bef52f1..d33b01dfb3 100644
--- a/ext/standard/tests/file/is_file_variation3.phpt
+++ b/ext/standard/tests/file/is_file_variation3.phpt
@@ -9,7 +9,7 @@ obscure_filename
Returns TRUE if the filename exists and is a regular file
*/
-/* Testing is_file() with invalid arguments -int, float, bool, NULL, resource */
+/* Testing is_file() with invalid arguments -int, float, bool, NULL */
function flatten($variable) {
\ob_start();
@@ -31,10 +31,7 @@ foreach([
/* scalars */
1234,
- 0,
-
- /* resource */
- fopen(__FILE__, "r")
+ 0
] as $filename ) {
printf(
"%s: %d\n",
@@ -51,4 +48,3 @@ bool(false): 0
NULL: 0
int(1234): 0
int(0): 0
-resource(%d) of type (stream): 0
diff --git a/ext/standard/tests/file/is_file_variation4.phpt b/ext/standard/tests/file/is_file_variation4.phpt
index 39a640e7eb..e67180c086 100644
--- a/ext/standard/tests/file/is_file_variation4.phpt
+++ b/ext/standard/tests/file/is_file_variation4.phpt
@@ -38,7 +38,11 @@ $count = 1;
/* loop through to test each element in the above array */
foreach($files_arr as $file) {
echo "- Iteration $count -\n";
- var_dump( is_file( $file_path."/".$file ) );
+ try {
+ var_dump( is_file( $file_path."/".$file ) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
clearstatcache();
$count++;
}
@@ -67,12 +71,8 @@ bool(false)
- Iteration 6 -
bool(false)
- Iteration 7 -
-
-Warning: is_file() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+is_file() expects parameter 1 to be a valid path, string given
- Iteration 8 -
-
-Warning: is_file() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+is_file() expects parameter 1 to be a valid path, string given
*** Done ***
diff --git a/ext/standard/tests/file/is_readable_error.phpt b/ext/standard/tests/file/is_readable_error.phpt
index ad6c2b8c62..1520eb4d20 100644
--- a/ext/standard/tests/file/is_readable_error.phpt
+++ b/ext/standard/tests/file/is_readable_error.phpt
@@ -6,24 +6,12 @@ Test is_readable() function: error conditions
Description: Tells whether the filename is readable
*/
-echo "*** Testing is_readable(): error conditions ***\n";
-var_dump( is_readable() ); // args < expected
-var_dump( is_readable(1, 2) ); // args > expected
-
echo "\n*** Testing is_readable() on non-existent file ***\n";
var_dump( is_readable(__DIR__."/is_readable.tmp") );
echo "Done\n";
?>
--EXPECTF--
-*** Testing is_readable(): error conditions ***
-
-Warning: is_readable() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: is_readable() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
*** Testing is_readable() on non-existent file ***
bool(false)
Done
diff --git a/ext/standard/tests/file/is_readable_variation1.phpt b/ext/standard/tests/file/is_readable_variation1.phpt
index 60729b5ac2..ab2e591ad5 100644
--- a/ext/standard/tests/file/is_readable_variation1.phpt
+++ b/ext/standard/tests/file/is_readable_variation1.phpt
@@ -50,7 +50,11 @@ $counter = 1;
is a writable file */
foreach($files_arr as $file) {
echo "-- Iteration $counter --\n";
- var_dump( is_readable($file) );
+ try {
+ var_dump( is_readable($file) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$counter++;
clearstatcache();
}
@@ -77,17 +81,11 @@ bool(false)
-- Iteration 6 --
bool(false)
-- Iteration 7 --
-
-Warning: is_readable() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+is_readable() expects parameter 1 to be a valid path, string given
-- Iteration 8 --
-
-Warning: is_readable() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+is_readable() expects parameter 1 to be a valid path, string given
-- Iteration 9 --
-
-Warning: is_readable() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+is_readable() expects parameter 1 to be a valid path, string given
-- Iteration 10 --
bool(true)
-- Iteration 11 --
diff --git a/ext/standard/tests/file/is_readable_variation2.phpt b/ext/standard/tests/file/is_readable_variation2.phpt
index 1dd4ffd06a..28c63a775d 100644
--- a/ext/standard/tests/file/is_readable_variation2.phpt
+++ b/ext/standard/tests/file/is_readable_variation2.phpt
@@ -26,7 +26,7 @@ chmod("$file_path/is_readable_variation2", 0001);
var_dump( is_readable("$file_path/is_readable_variation2") ); // exp: bool(false)
chmod("$file_path/is_readable_variation2", 0777); // chmod to enable deletion of directory
-echo "\n*** Testing miscelleneous input for is_readable() function ***\n";
+echo "\n*** Testing miscellaneous input for is_readable() function ***\n";
$name_prefix = "is_readable_variation2";
create_files(__DIR__, 1, "numeric", 0755, 1, "w", $name_prefix, 1);
create_files(__DIR__, 1, "text", 0755, 1, "w", $name_prefix, 2);
@@ -77,7 +77,7 @@ rmdir(__DIR__."/is_readable_variation2/");
*** Testing is_readable() on directory without read permission ***
bool(false)
-*** Testing miscelleneous input for is_readable() function ***
+*** Testing miscellaneous input for is_readable() function ***
-- Iteration 1 --
bool(true)
-- Iteration 2 --
diff --git a/ext/standard/tests/file/is_readable_variation3.phpt b/ext/standard/tests/file/is_readable_variation3.phpt
index c73a28520f..97c794d1b7 100644
--- a/ext/standard/tests/file/is_readable_variation3.phpt
+++ b/ext/standard/tests/file/is_readable_variation3.phpt
@@ -17,7 +17,7 @@ echo "*** Testing is_readable(): usage variations ***\n";
$file_handle = fopen(__FILE__, "r");
unset($file_handle);
-echo "\n*** Testing is_readable() on miscelleneous filenames ***\n";
+echo "\n*** Testing is_readable() on miscellaneous filenames ***\n";
$misc_files = array(
0,
1234,
@@ -26,7 +26,6 @@ $misc_files = array(
FALSE,
NULL,
" ",
- @array(),
@$file_handle
);
/* loop through to test each element in the above array
@@ -41,7 +40,7 @@ echo "Done\n";
--EXPECTF--
*** Testing is_readable(): usage variations ***
-*** Testing is_readable() on miscelleneous filenames ***
+*** Testing is_readable() on miscellaneous filenames ***
bool(false)
bool(false)
bool(false)
@@ -49,8 +48,5 @@ bool(false)
bool(false)
bool(false)
bool(false)
-
-Warning: is_readable() expects parameter 1 to be a valid path, array given in %s on line %d
-NULL
bool(false)
Done
diff --git a/ext/standard/tests/file/is_uploaded_file_basic.phpt b/ext/standard/tests/file/is_uploaded_file_basic.phpt
index 1721935549..d053244a79 100644
--- a/ext/standard/tests/file/is_uploaded_file_basic.phpt
+++ b/ext/standard/tests/file/is_uploaded_file_basic.phpt
@@ -29,19 +29,9 @@ var_dump(is_uploaded_file('random_filename.txt'));
// not an uploaded file
var_dump(is_uploaded_file('__FILE__'));
-// Error cases
-var_dump(is_uploaded_file());
-var_dump(is_uploaded_file('a', 'b'));
-
?>
--EXPECTF--
bool(true)
bool(false)
bool(false)
bool(false)
-
-Warning: is_uploaded_file() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: is_uploaded_file() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
diff --git a/ext/standard/tests/file/is_writable_error.phpt b/ext/standard/tests/file/is_writable_error.phpt
index a9633f2284..e2a38412cd 100644
--- a/ext/standard/tests/file/is_writable_error.phpt
+++ b/ext/standard/tests/file/is_writable_error.phpt
@@ -8,14 +8,6 @@ Test is_writable() and its alias is_writeable() function: error conditions
is_writeable() is an alias of is_writable()
*/
-echo "*** Testing is_writable(): error conditions ***\n";
-var_dump( is_writable() ); // args < expected
-var_dump( is_writeable() );
-
-echo "\n*** Testing is_writeable(): error conditions ***\n";
-var_dump( is_writable(1, 2) ); // args > expected
-var_dump( is_writeable(1, 2) );
-
echo "\n*** Testing is_writable() on non-existent file ***\n";
var_dump( is_writable(__DIR__."/is_writable") );
var_dump( is_writeable(__DIR__."/is_writable") );
@@ -23,22 +15,6 @@ var_dump( is_writeable(__DIR__."/is_writable") );
echo "Done\n";
?>
--EXPECTF--
-*** Testing is_writable(): error conditions ***
-
-Warning: is_writable() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: is_writeable() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-*** Testing is_writeable(): error conditions ***
-
-Warning: is_writable() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: is_writeable() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
*** Testing is_writable() on non-existent file ***
bool(false)
bool(false)
diff --git a/ext/standard/tests/file/is_writable_variation1.phpt b/ext/standard/tests/file/is_writable_variation1.phpt
index 6ce05f172e..45ef1524b6 100644
--- a/ext/standard/tests/file/is_writable_variation1.phpt
+++ b/ext/standard/tests/file/is_writable_variation1.phpt
@@ -50,8 +50,16 @@ $counter = 1;
is a writable file */
foreach($files_arr as $file) {
echo "-- Iteration $counter --\n";
- var_dump( is_writable($file) );
- var_dump( is_writeable($file) );
+ try {
+ var_dump( is_writable($file) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ try {
+ var_dump( is_writeable($file) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$counter++;
clearstatcache();
}
@@ -84,26 +92,14 @@ bool(false)
bool(false)
bool(false)
-- Iteration 7 --
-
-Warning: is_writable() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: is_writeable() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+is_writable() expects parameter 1 to be a valid path, string given
+is_writeable() expects parameter 1 to be a valid path, string given
-- Iteration 8 --
-
-Warning: is_writable() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: is_writeable() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+is_writable() expects parameter 1 to be a valid path, string given
+is_writeable() expects parameter 1 to be a valid path, string given
-- Iteration 9 --
-
-Warning: is_writable() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-
-Warning: is_writeable() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
+is_writable() expects parameter 1 to be a valid path, string given
+is_writeable() expects parameter 1 to be a valid path, string given
-- Iteration 10 --
bool(true)
bool(true)
diff --git a/ext/standard/tests/file/is_writable_variation2.phpt b/ext/standard/tests/file/is_writable_variation2.phpt
index def45bd2a0..0dcce8c6d4 100644
--- a/ext/standard/tests/file/is_writable_variation2.phpt
+++ b/ext/standard/tests/file/is_writable_variation2.phpt
@@ -29,7 +29,7 @@ var_dump( is_writable("$file_path/is_writable_variation2") ); // exp: bool(fals
var_dump( is_writeable("$file_path/is_writable_variation2") ); // exp: bool(false)
chmod("$file_path/is_writable_variation2", 0777); // chmod to enable deletion of directory
-echo "\n*** Testing miscelleneous input for is_writable() function ***\n";
+echo "\n*** Testing miscellaneous input for is_writable() function ***\n";
$name_prefix = "is_writable_variation2";
create_files(__DIR__, 1, "numeric", 0755, 1, "w", $name_prefix, 1);
create_files(__DIR__, 1, "text", 0755, 1, "w", $name_prefix, 2);
@@ -83,7 +83,7 @@ rmdir(__DIR__."/is_writable_variation2/");
bool(false)
bool(false)
-*** Testing miscelleneous input for is_writable() function ***
+*** Testing miscellaneous input for is_writable() function ***
-- Iteration 1 --
bool(true)
bool(true)
diff --git a/ext/standard/tests/file/is_writable_variation3.phpt b/ext/standard/tests/file/is_writable_variation3.phpt
index e49270bcf4..c5843a5abf 100644
--- a/ext/standard/tests/file/is_writable_variation3.phpt
+++ b/ext/standard/tests/file/is_writable_variation3.phpt
@@ -27,7 +27,6 @@ $misc_files = array(
FALSE,
NULL,
" ",
- @array(),
@$file_handle
);
/* loop through to test each element in the above array
@@ -56,11 +55,5 @@ bool(false)
bool(false)
bool(false)
bool(false)
-
-Warning: is_writable() expects parameter 1 to be a valid path, array given in %s on line %d
-NULL
-
-Warning: is_writeable() expects parameter 1 to be a valid path, array given in %s on line %d
-NULL
bool(false)
bool(false)
diff --git a/ext/standard/tests/file/lchgrp_basic.phpt b/ext/standard/tests/file/lchgrp_basic.phpt
index fa97ce86ef..283d805a94 100644
--- a/ext/standard/tests/file/lchgrp_basic.phpt
+++ b/ext/standard/tests/file/lchgrp_basic.phpt
@@ -18,7 +18,6 @@ var_dump( lchgrp( $filename, $gid ) );
var_dump( filegroup( $symlink ) === $gid );
?>
-===DONE===
--CLEAN--
<?php
@@ -33,4 +32,3 @@ bool(true)
bool(true)
bool(true)
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/lchown_basic.phpt b/ext/standard/tests/file/lchown_basic.phpt
index e38bbda1be..d6a6072792 100644
--- a/ext/standard/tests/file/lchown_basic.phpt
+++ b/ext/standard/tests/file/lchown_basic.phpt
@@ -25,7 +25,6 @@ var_dump( lchown( $filename, $uid ) );
var_dump( fileowner( $symlink ) === $uid );
?>
-===DONE===
--CLEAN--
<?php
@@ -41,4 +40,3 @@ bool(true)
bool(true)
bool(true)
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/lchown_error.phpt b/ext/standard/tests/file/lchown_error.phpt
index dbd9a7bbe8..093c0c5b31 100644
--- a/ext/standard/tests/file/lchown_error.phpt
+++ b/ext/standard/tests/file/lchown_error.phpt
@@ -21,25 +21,13 @@ $filename = __DIR__ . DIRECTORY_SEPARATOR . 'lchown.txt';
touch( $filename );
$uid = posix_getuid();
-
-// Less than expected arguments
-var_dump( lchown( $filename ) );
-
-// More than expected arguments
-var_dump( lchown( $filename, $uid, 'foobar' ) );
-
// Non-existent filename
var_dump( lchown( 'foobar_lchown.txt', $uid ) );
-// Wrong argument types
-var_dump( lchown( new StdClass(), $uid ) );
-var_dump( lchown( array(), $uid ) );
-
// Bad user
var_dump( lchown( $filename, -5 ) );
?>
-===DONE===
--CLEAN--
<?php
@@ -50,21 +38,8 @@ unlink($filename);
--EXPECTF--
*** Testing lchown() : error functionality ***
-Warning: lchown() expects exactly 2 parameters, 1 given in %s on line %d
-bool(true)
-
-Warning: lchown() expects exactly 2 parameters, 3 given in %s on line %d
-bool(true)
-
Warning: lchown(): No such file or directory in %s on line %d
bool(false)
-Warning: lchown() expects parameter 1 to be a valid path, object given in %s on line %d
-bool(true)
-
-Warning: lchown() expects parameter 1 to be a valid path, array given in %s on line %d
-bool(true)
-
Warning: lchown(): %r(Operation not permitted|Invalid argument)%r in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/standard/tests/file/lstat_stat_error.phpt b/ext/standard/tests/file/lstat_stat_error.phpt
index 543e296ec2..06926df2a2 100644
--- a/ext/standard/tests/file/lstat_stat_error.phpt
+++ b/ext/standard/tests/file/lstat_stat_error.phpt
@@ -17,54 +17,28 @@ if (substr(PHP_OS, 0, 3) == 'WIN') {
echo "*** Testing lstat() for error conditions ***\n";
$file_path = __DIR__;
-var_dump( lstat() ); // args < expected
-var_dump( lstat(__FILE__, 2) ); // args > expected
var_dump( lstat("$file_path/temp.tmp") ); // non existing file
var_dump( lstat(22) ); // scalar argument
-$arr = array(__FILE__);
-var_dump( lstat($arr) ); // array argument
echo "\n*** Testing stat() for error conditions ***\n";
-var_dump( stat() ); // args < expected
-var_dump( stat(__FILE__, 2) ); // file, args > expected
-var_dump( stat(__DIR__, 2) ); //dir, args > expected
var_dump( stat("$file_path/temp.tmp") ); // non existing file
var_dump( stat("$file_path/temp/") ); // non existing dir
var_dump( stat(22) ); // scalar argument
-var_dump( stat($arr) ); // array argument
echo "Done\n";
?>
--EXPECTF--
*** Testing lstat() for error conditions ***
-Warning: lstat() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: lstat() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
Warning: lstat(): Lstat failed for %s in %s on line %d
bool(false)
Warning: lstat(): Lstat failed for 22 in %s on line %d
bool(false)
-Warning: lstat() expects parameter 1 to be a valid path, array given in %s on line %d
-NULL
-
*** Testing stat() for error conditions ***
-Warning: stat() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: stat() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: stat() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
Warning: stat(): stat failed for %s in %s on line %d
bool(false)
@@ -73,7 +47,4 @@ bool(false)
Warning: stat(): stat failed for 22 in %s on line %d
bool(false)
-
-Warning: stat() expects parameter 1 to be a valid path, array given in %s on line %d
-NULL
Done
diff --git a/ext/standard/tests/file/lstat_stat_variation10.phpt b/ext/standard/tests/file/lstat_stat_variation10.phpt
index 16ff75c26d..30578f5d18 100644
--- a/ext/standard/tests/file/lstat_stat_variation10.phpt
+++ b/ext/standard/tests/file/lstat_stat_variation10.phpt
@@ -31,7 +31,7 @@ echo "*** Testing stat() on directory after using is_dir() on it ***\n";
$old_stat = stat($dirname);
// clear the cache
clearstatcache();
-sleep(2);
+sleep(1);
var_dump( is_dir($dirname) );
$new_stat = stat($dirname);
diff --git a/ext/standard/tests/file/lstat_stat_variation11.phpt b/ext/standard/tests/file/lstat_stat_variation11.phpt
index 9a394ae7e9..523bfacf5c 100644
--- a/ext/standard/tests/file/lstat_stat_variation11.phpt
+++ b/ext/standard/tests/file/lstat_stat_variation11.phpt
@@ -31,7 +31,7 @@ echo "*** Testing stat() on a file after using is_file() on it ***\n";
$old_stat = stat($filename);
// clear the stat
clearstatcache();
-sleep(2);
+sleep(1);
var_dump( is_file($filename) );
$new_stat = stat($filename);
// compare self stats
diff --git a/ext/standard/tests/file/lstat_stat_variation12.phpt b/ext/standard/tests/file/lstat_stat_variation12.phpt
index eada799cdf..15f081f21f 100644
--- a/ext/standard/tests/file/lstat_stat_variation12.phpt
+++ b/ext/standard/tests/file/lstat_stat_variation12.phpt
@@ -36,7 +36,7 @@ $linkname = "$file_path/lstat_stat_variation12_link.tmp";
$old_stat = lstat($linkname);
// clear the stat
clearstatcache();
-sleep(2);
+sleep(1);
var_dump( is_link($linkname) );
$new_stat = lstat($linkname);
// compare self stats
diff --git a/ext/standard/tests/file/lstat_stat_variation13.phpt b/ext/standard/tests/file/lstat_stat_variation13.phpt
index 22694240f5..e94a5085ec 100644
--- a/ext/standard/tests/file/lstat_stat_variation13.phpt
+++ b/ext/standard/tests/file/lstat_stat_variation13.phpt
@@ -30,7 +30,7 @@ fclose($file_handle);
$old_stat = stat($filename);
// clear the stat
clearstatcache();
-sleep(2);
+sleep(1);
// opening file again in read mode
$file_handle = fopen($filename, "r"); // read file
fclose($file_handle);
diff --git a/ext/standard/tests/file/lstat_stat_variation16.phpt b/ext/standard/tests/file/lstat_stat_variation16.phpt
index 652f5c29c7..93791355ba 100644
--- a/ext/standard/tests/file/lstat_stat_variation16.phpt
+++ b/ext/standard/tests/file/lstat_stat_variation16.phpt
@@ -28,7 +28,7 @@ fclose($fp);
// checking stat() on file after changing its permission
echo "*** Testing lstat() on a file after changing its access permission ***\n";
$old_stat = stat($filename);
-sleep(2);
+sleep(1);
var_dump( chmod($filename, 0777) );
// clear the stat
clearstatcache();
diff --git a/ext/standard/tests/file/lstat_stat_variation17.phpt b/ext/standard/tests/file/lstat_stat_variation17.phpt
index 208cc0b388..64039566f0 100644
--- a/ext/standard/tests/file/lstat_stat_variation17.phpt
+++ b/ext/standard/tests/file/lstat_stat_variation17.phpt
@@ -27,7 +27,7 @@ $dirname = "$file_path/lstat_stat_variation17";
mkdir($dirname);
$old_stat = stat($dirname);
-sleep(2);
+sleep(1);
var_dump( chmod($dirname, 0777) );
// clear the stat
clearstatcache();
diff --git a/ext/standard/tests/file/lstat_stat_variation21.phpt b/ext/standard/tests/file/lstat_stat_variation21.phpt
index 23ed53e566..df09bc7f98 100644
--- a/ext/standard/tests/file/lstat_stat_variation21.phpt
+++ b/ext/standard/tests/file/lstat_stat_variation21.phpt
@@ -33,7 +33,7 @@ echo "*** Testing stat() on file by truncating it to given size ***\n";
$old_stat = stat($filename);
// clear the cache
clearstatcache();
-sleep(2);
+sleep(1);
// opening file in r/w mode
$file_handle = fopen($filename, "r+");
var_dump( ftruncate($file_handle, 512) ); // truncate it
diff --git a/ext/standard/tests/file/lstat_stat_variation3.phpt b/ext/standard/tests/file/lstat_stat_variation3.phpt
index 962f1df5b2..15fc5f0b53 100644
--- a/ext/standard/tests/file/lstat_stat_variation3.phpt
+++ b/ext/standard/tests/file/lstat_stat_variation3.phpt
@@ -46,7 +46,6 @@ $keys_to_compare = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12,
"rdev", "size", "atime", "mtime", "blksize", "blocks");
var_dump( compare_stats($old_stat, $new_stat, $keys_to_compare) );
?>
-===Done===
--CLEAN--
<?php
$file_path = __DIR__;
@@ -59,4 +58,3 @@ bool(true)
bool(true)
bool(true)
bool(true)
-===Done===
diff --git a/ext/standard/tests/file/lstat_stat_variation4.phpt b/ext/standard/tests/file/lstat_stat_variation4.phpt
index fe8b61e5ca..c72d7ffe4b 100644
--- a/ext/standard/tests/file/lstat_stat_variation4.phpt
+++ b/ext/standard/tests/file/lstat_stat_variation4.phpt
@@ -33,7 +33,7 @@ echo "*** Testing stat() for file after using touch() on the file ***\n";
$old_stat = stat($file_name);
// clear the cache
clearstatcache();
-sleep(2);
+sleep(1);
var_dump( touch($file_name) );
$new_stat = stat($file_name);
diff --git a/ext/standard/tests/file/lstat_stat_variation5.phpt b/ext/standard/tests/file/lstat_stat_variation5.phpt
index b5c03c3f08..668e79238d 100644
--- a/ext/standard/tests/file/lstat_stat_variation5.phpt
+++ b/ext/standard/tests/file/lstat_stat_variation5.phpt
@@ -33,7 +33,7 @@ echo "*** Testing stat() for directory after using touch() on the directory ***\
$old_stat = stat($dir_name);
// clear the cache
clearstatcache();
-sleep(2);
+sleep(1);
var_dump( touch($dir_name) );
$new_stat = stat($dir_name);
diff --git a/ext/standard/tests/file/lstat_stat_variation8.phpt b/ext/standard/tests/file/lstat_stat_variation8.phpt
index db7f87f7f7..9870a56c10 100644
--- a/ext/standard/tests/file/lstat_stat_variation8.phpt
+++ b/ext/standard/tests/file/lstat_stat_variation8.phpt
@@ -30,7 +30,7 @@ echo "*** Testing stat() on dir after subdir and file is created in it ***\n";
$dirname = "$file_path/lstat_stat_variation8";
$old_stat = stat($dirname);
clearstatcache();
-sleep(2);
+sleep(1);
mkdir("$dirname/lstat_stat_variation8_subdir");
$file_handle = fopen("$dirname/lstat_stat_variation8a.tmp", "w");
fclose($file_handle);
diff --git a/ext/standard/tests/file/mkdir_rmdir_error.phpt b/ext/standard/tests/file/mkdir_rmdir_error.phpt
index 17f908c3f6..be0b434c2c 100644
--- a/ext/standard/tests/file/mkdir_rmdir_error.phpt
+++ b/ext/standard/tests/file/mkdir_rmdir_error.phpt
@@ -9,48 +9,12 @@ Test mkdir() and rmdir() functions : error conditions
Description: Removes directory
*/
-echo "*** Testing mkdir(): error conditions ***\n";
-var_dump( mkdir() ); // args < expected
-var_dump( mkdir(1, 2, 3, 4, 5) ); // args > expected
-var_dump( mkdir("testdir", 0777, false, $context, "test") ); // args > expected
-
-echo "\n*** Testing rmdir(): error conditions ***\n";
-var_dump( rmdir() ); // args < expected
-var_dump( rmdir(1, 2, 3) ); // args > expected
-var_dump( rmdir("testdir", $context, "test") ); // args > expected
-
echo "\n*** Testing rmdir() on non-existent directory ***\n";
var_dump( rmdir("temp") );
echo "Done\n";
?>
--EXPECTF--
-*** Testing mkdir(): error conditions ***
-
-Warning: mkdir() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: mkdir() expects at most 4 parameters, 5 given in %s on line %d
-bool(false)
-
-Notice: Undefined variable: context in %s on line %d
-
-Warning: mkdir() expects at most 4 parameters, 5 given in %s on line %d
-bool(false)
-
-*** Testing rmdir(): error conditions ***
-
-Warning: rmdir() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: rmdir() expects at most 2 parameters, 3 given in %s on line %d
-bool(false)
-
-Notice: Undefined variable: context in %s on line %d
-
-Warning: rmdir() expects at most 2 parameters, 3 given in %s on line %d
-bool(false)
-
*** Testing rmdir() on non-existent directory ***
Warning: rmdir(temp): No such file or directory in %s on line %d
diff --git a/ext/standard/tests/file/mkdir_rmdir_variation-win32-mb.phpt b/ext/standard/tests/file/mkdir_rmdir_variation-win32-mb.phpt
index 20535a0536..37fe05560e 100644
--- a/ext/standard/tests/file/mkdir_rmdir_variation-win32-mb.phpt
+++ b/ext/standard/tests/file/mkdir_rmdir_variation-win32-mb.phpt
@@ -38,7 +38,7 @@ echo "\n*** Testing mkdir() and rmdir() for binary safe functionality ***\n";
var_dump( mkdir("$file_path/tempx000/") );
var_dump( rmdir("$file_path/tempx000/") );
-echo "\n*** Testing mkdir() with miscelleneous input ***\n";
+echo "\n*** Testing mkdir() with miscellaneous input ***\n";
/* changing mode of mkdir to prevent creating sub-directory under it */
var_dump( chmod("$file_path/mkdirç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™/", 0000) );
/* creating sub-directory test1 under mkdir, expected: false */
@@ -1606,7 +1606,7 @@ bool(false)
bool(true)
bool(true)
-*** Testing mkdir() with miscelleneous input ***
+*** Testing mkdir() with miscellaneous input ***
bool(true)
bool(true)
bool(true)
diff --git a/ext/standard/tests/file/mkdir_rmdir_variation-win32.phpt b/ext/standard/tests/file/mkdir_rmdir_variation-win32.phpt
index 3391472f99..eea1065917 100644
--- a/ext/standard/tests/file/mkdir_rmdir_variation-win32.phpt
+++ b/ext/standard/tests/file/mkdir_rmdir_variation-win32.phpt
@@ -38,7 +38,7 @@ echo "\n*** Testing mkdir() and rmdir() for binary safe functionality ***\n";
var_dump( mkdir("$file_path/tempx000/") );
var_dump( rmdir("$file_path/tempx000/") );
-echo "\n*** Testing mkdir() with miscelleneous input ***\n";
+echo "\n*** Testing mkdir() with miscellaneous input ***\n";
/* changing mode of mkdir to prevent creating sub-directory under it */
var_dump( chmod("$file_path/mkdir/", 0000) );
/* creating sub-directory test1 under mkdir, expected: false */
@@ -1606,7 +1606,7 @@ bool(false)
bool(true)
bool(true)
-*** Testing mkdir() with miscelleneous input ***
+*** Testing mkdir() with miscellaneous input ***
bool(true)
bool(true)
bool(true)
diff --git a/ext/standard/tests/file/mkdir_rmdir_variation2.phpt b/ext/standard/tests/file/mkdir_rmdir_variation2.phpt
index 22c055ddb5..bd6a7c56a9 100644
--- a/ext/standard/tests/file/mkdir_rmdir_variation2.phpt
+++ b/ext/standard/tests/file/mkdir_rmdir_variation2.phpt
@@ -26,10 +26,18 @@ var_dump( mkdir("$file_path/mkdir_variation2/test/", 0777, true) );
var_dump( rmdir("$file_path/mkdir_variation2/") );
echo "\n*** Testing mkdir() and rmdir() for binary safe functionality ***\n";
-var_dump( mkdir("$file_path/temp".chr(0)."/") );
-var_dump( rmdir("$file_path/temp".chr(0)."/") );
+try {
+ var_dump( mkdir("$file_path/temp".chr(0)."/") );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump( rmdir("$file_path/temp".chr(0)."/") );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
-echo "\n*** Testing mkdir() with miscelleneous input ***\n";
+echo "\n*** Testing mkdir() with miscellaneous input ***\n";
/* changing mode of mkdir to prevent creating sub-directory under it */
var_dump( chmod("$file_path/mkdir_variation2/", 0000) );
/* creating sub-directory test1 under mkdir, expected: false */
@@ -55,14 +63,10 @@ Warning: rmdir(%s/mkdir_variation2/): %s on line %d
bool(false)
*** Testing mkdir() and rmdir() for binary safe functionality ***
+mkdir() expects parameter 1 to be a valid path, string given
+rmdir() expects parameter 1 to be a valid path, string given
-Warning: mkdir() expects parameter 1 to be a valid path, string given in %s on line %d
-bool(false)
-
-Warning: rmdir() expects parameter 1 to be a valid path, string given in %s on line %d
-bool(false)
-
-*** Testing mkdir() with miscelleneous input ***
+*** Testing mkdir() with miscellaneous input ***
bool(true)
Warning: mkdir(): Permission denied in %s on line %d
diff --git a/ext/standard/tests/file/mkdir_variation5-win32.phpt b/ext/standard/tests/file/mkdir_variation5-win32.phpt
index b805dee3be..e2eea07f52 100644
--- a/ext/standard/tests/file/mkdir_variation5-win32.phpt
+++ b/ext/standard/tests/file/mkdir_variation5-win32.phpt
@@ -68,7 +68,6 @@ foreach($dirs as $dir) {
rmdir($workDir);
?>
-===DONE===
--EXPECTF--
*** Testing mkdir() : variation ***
-- creating mkdirVar5.tmp\aSubDir --
@@ -102,4 +101,3 @@ Directory created
Directory created
-- creating /%s/mkdirVar5.tmp/aSubDir --
Directory created
-===DONE===
diff --git a/ext/standard/tests/file/mkdir_variation5.phpt b/ext/standard/tests/file/mkdir_variation5.phpt
index ea60edf42f..c8e8b8d3ea 100644
--- a/ext/standard/tests/file/mkdir_variation5.phpt
+++ b/ext/standard/tests/file/mkdir_variation5.phpt
@@ -63,7 +63,6 @@ foreach($dirs as $dir) {
rmdir($workDir);
?>
-===DONE===
--EXPECTF--
*** Testing mkdir() : variation ***
-- creating mkdirVar5.tmp/aSubDir --
@@ -95,4 +94,3 @@ Directory created
Directory created
-- creating %s//mkdirVar5.tmp//aSubDir --
Directory created
-===DONE===
diff --git a/ext/standard/tests/file/move_uploaded_file_basic.phpt b/ext/standard/tests/file/move_uploaded_file_basic.phpt
index c6cfdd3203..7af8748fe2 100644
--- a/ext/standard/tests/file/move_uploaded_file_basic.phpt
+++ b/ext/standard/tests/file/move_uploaded_file_basic.phpt
@@ -49,11 +49,6 @@ fclose($fd);
var_dump(move_uploaded_file($_FILES['file2']['tmp_name'], $destination4));
unlink($destination4);
-echo "Wrong parameters\n";
-var_dump(move_uploaded_file());
-var_dump(move_uploaded_file(1, 2, 3));
-
-
?>
--EXPECTF--
Valid move
@@ -66,10 +61,3 @@ Non-uploaded source file
bool(false)
Valid move to existing file
bool(true)
-Wrong parameters
-
-Warning: move_uploaded_file() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: move_uploaded_file() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
diff --git a/ext/standard/tests/file/parse_ini_file.phpt b/ext/standard/tests/file/parse_ini_file.phpt
index eed17c0093..817b92aa7f 100644
--- a/ext/standard/tests/file/parse_ini_file.phpt
+++ b/ext/standard/tests/file/parse_ini_file.phpt
@@ -25,7 +25,7 @@ PHP_CONSTANT = 1.2345678
HELLO = HELLO
[date]
-date =
+date =
time =
[paths]
@@ -64,7 +64,7 @@ Non_alpha11 = /
Non_alpha12 = \
;These chars have a special meaning when used in the value,
; hence parser throws an error
-;Non_alpha13 = &
+;Non_alpha13 = &
;Non_alpha14 = ^
;Non_alpha15 = {}
;Non_alpha16 = |
@@ -172,7 +172,7 @@ Key16 = Null
Key17 = nuLL
Key18 = null
-[ReservedKeys_as_Keys]
+[ReservedKeys_as_Keys]
; Expected:error, reserved key words must not be used as keys for ini file
;YES = 1
;Yes = 2
diff --git a/ext/standard/tests/file/parse_ini_file_error.phpt b/ext/standard/tests/file/parse_ini_file_error.phpt
index 29e022fb13..41a8f13786 100644
--- a/ext/standard/tests/file/parse_ini_file_error.phpt
+++ b/ext/standard/tests/file/parse_ini_file_error.phpt
@@ -10,10 +10,6 @@ Test parse_ini_file() function : error conditions
echo "*** Testing parse_ini_file() : error conditions ***\n";
-// Zero arguments
-echo "\n-- Testing parse_ini_file() function with Zero arguments --\n";
-var_dump( parse_ini_file() );
-
//Test parse_ini_file with one more than the expected number of arguments
echo "\n-- Testing parse_ini_file() function with more than expected no. of arguments --\n";
$filename = 'string_val';
@@ -30,18 +26,13 @@ echo "Done";
--EXPECTF--
*** Testing parse_ini_file() : error conditions ***
--- Testing parse_ini_file() function with Zero arguments --
-
-Warning: parse_ini_file() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
-
-- Testing parse_ini_file() function with more than expected no. of arguments --
-Warning: parse_ini_file(%s): failed to open stream: No such file or directory in %s on line %d
+Warning: parse_ini_file(%s): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-- Testing parse_ini_file() function with a non-existent file --
-Warning: parse_ini_file(%s): failed to open stream: No such file or directory in %s on line %d
+Warning: parse_ini_file(%s): Failed to open stream: No such file or directory in %s on line %d
bool(false)
Done
diff --git a/ext/standard/tests/file/parse_ini_file_variation1.phpt b/ext/standard/tests/file/parse_ini_file_variation1.phpt
index 666ea433b1..82465d9b17 100644
--- a/ext/standard/tests/file/parse_ini_file_variation1.phpt
+++ b/ext/standard/tests/file/parse_ini_file_variation1.phpt
@@ -30,7 +30,6 @@ var_dump($a);
unlink($output_file);
?>
-===DONE===
--EXPECT--
*** Testing parse_ini_file() : variation ***
array(2) {
@@ -65,4 +64,3 @@ array(2) {
string(9) "different"
}
}
-===DONE===
diff --git a/ext/standard/tests/file/parse_ini_file_variation2.phpt b/ext/standard/tests/file/parse_ini_file_variation2.phpt
index e7b9091737..2ba810ae2e 100644
--- a/ext/standard/tests/file/parse_ini_file_variation2.phpt
+++ b/ext/standard/tests/file/parse_ini_file_variation2.phpt
@@ -47,7 +47,6 @@ $a = parse_ini_file($output_file, true);
var_dump($a);
unlink($output_file);
?>
-===DONE===
--EXPECT--
*** Testing parse_ini_file() : variation ***
array(8) {
@@ -108,4 +107,3 @@ array(8) {
string(0) ""
}
}
-===DONE===
diff --git a/ext/standard/tests/file/parse_ini_file_variation3.phpt b/ext/standard/tests/file/parse_ini_file_variation3.phpt
index 96d44433f7..23b0ec4a8a 100644
--- a/ext/standard/tests/file/parse_ini_file_variation3.phpt
+++ b/ext/standard/tests/file/parse_ini_file_variation3.phpt
@@ -43,7 +43,6 @@ log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
-track_errors = Off
docref_root = "/phpmanual/"
docref_ext = .html
@@ -53,7 +52,6 @@ file_put_contents($output_file, $iniContent);
var_dump(parse_ini_file($iniFile));
?>
-===Done===
--CLEAN--
<?php
@@ -77,7 +75,7 @@ foreach($newdirs as $newdir) {
--EXPECTF--
*** Testing parse_ini_file() : variation ***
New include path is : %sparse_ini_file_variation3.dir1%sparse_ini_file_variation3.dir2%sparse_ini_file_variation3.dir3%S
-array(11) {
+array(10) {
["error_reporting"]=>
string(5) "32767"
["display_errors"]=>
@@ -94,11 +92,8 @@ array(11) {
string(0) ""
["report_memleaks"]=>
string(1) "1"
- ["track_errors"]=>
- string(0) ""
["docref_root"]=>
string(11) "/phpmanual/"
["docref_ext"]=>
string(5) ".html"
}
-===Done===
diff --git a/ext/standard/tests/file/parse_ini_file_variation6-win32-mb.phpt b/ext/standard/tests/file/parse_ini_file_variation6-win32-mb.phpt
index df98a632b4..aac0426e96 100644
--- a/ext/standard/tests/file/parse_ini_file_variation6-win32-mb.phpt
+++ b/ext/standard/tests/file/parse_ini_file_variation6-win32-mb.phpt
@@ -97,12 +97,12 @@ array(1) {
-- Iteration 5 --
-Warning: parse_ini_file(%sparseIniFileVarç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.dir\parseIniFileVarç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™Sub\..\\\parseIniFileVarç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™Sub\\..\\..\parseIniFileVarç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™Sub\parseIniFileVarç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.ini): failed to open stream: No such file or directory in %s on line %d
+Warning: parse_ini_file(%sparseIniFileVarç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.dir\parseIniFileVarç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™Sub\..\\\parseIniFileVarç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™Sub\\..\\..\parseIniFileVarç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™Sub\parseIniFileVarç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.ini): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-- Iteration 6 --
-Warning: parse_ini_file(%sparseIniFileVarç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.dir\parseIniFileVarç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™Sub\BADDIR\parseIniFileVarç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.ini): failed to open stream: No such file or directory in %s on line %d
+Warning: parse_ini_file(%sparseIniFileVarç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.dir\parseIniFileVarç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™Sub\BADDIR\parseIniFileVarç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.ini): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-- Iteration 7 --
@@ -131,7 +131,7 @@ array(1) {
-- Iteration 11 --
-Warning: parse_ini_file(BADDIR\parseIniFileVarç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.ini): failed to open stream: No such file or directory in %s on line %d
+Warning: parse_ini_file(BADDIR\parseIniFileVarç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.ini): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-- Iteration 12 --
diff --git a/ext/standard/tests/file/parse_ini_file_variation6-win32.phpt b/ext/standard/tests/file/parse_ini_file_variation6-win32.phpt
index 2ef1d88fcc..a0fb9878b3 100644
--- a/ext/standard/tests/file/parse_ini_file_variation6-win32.phpt
+++ b/ext/standard/tests/file/parse_ini_file_variation6-win32.phpt
@@ -97,12 +97,12 @@ array(1) {
-- Iteration 5 --
-Warning: parse_ini_file(%sparseIniFileVar6.dir\parseIniFileVar6Sub\..\\\parseIniFileVar6Sub\\..\\..\parseIniFileVar6Sub\ParseIniFileVar6.ini): failed to open stream: No such file or directory in %s on line %d
+Warning: parse_ini_file(%sparseIniFileVar6.dir\parseIniFileVar6Sub\..\\\parseIniFileVar6Sub\\..\\..\parseIniFileVar6Sub\ParseIniFileVar6.ini): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-- Iteration 6 --
-Warning: parse_ini_file(%sparseIniFileVar6.dir\parseIniFileVar6Sub\BADDIR\ParseIniFileVar6.ini): failed to open stream: No such file or directory in %s on line %d
+Warning: parse_ini_file(%sparseIniFileVar6.dir\parseIniFileVar6Sub\BADDIR\ParseIniFileVar6.ini): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-- Iteration 7 --
@@ -131,7 +131,7 @@ array(1) {
-- Iteration 11 --
-Warning: parse_ini_file(BADDIR\ParseIniFileVar6.ini): failed to open stream: No such file or directory in %s on line %d
+Warning: parse_ini_file(BADDIR\ParseIniFileVar6.ini): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-- Iteration 12 --
diff --git a/ext/standard/tests/file/parse_ini_file_variation6.phpt b/ext/standard/tests/file/parse_ini_file_variation6.phpt
index 7c6d8ab4cb..e0af048e8b 100644
--- a/ext/standard/tests/file/parse_ini_file_variation6.phpt
+++ b/ext/standard/tests/file/parse_ini_file_variation6.phpt
@@ -89,12 +89,12 @@ array(1) {
-- Iteration 5 --
-Warning: parse_ini_file(%sparseIniFileVar6.dir/parseIniFileVar6Sub/..///parseIniFileVar6Sub//..//../parseIniFileVar6Sub/ParseIniFileVar6.ini): failed to open stream: No such file or directory in %s on line %d
+Warning: parse_ini_file(%sparseIniFileVar6.dir/parseIniFileVar6Sub/..///parseIniFileVar6Sub//..//../parseIniFileVar6Sub/ParseIniFileVar6.ini): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-- Iteration 6 --
-Warning: parse_ini_file(%sparseIniFileVar6.dir/parseIniFileVar6Sub/BADDIR/ParseIniFileVar6.ini): failed to open stream: No such file or directory in %s on line %d
+Warning: parse_ini_file(%sparseIniFileVar6.dir/parseIniFileVar6Sub/BADDIR/ParseIniFileVar6.ini): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-- Iteration 7 --
@@ -123,7 +123,7 @@ array(1) {
-- Iteration 11 --
-Warning: parse_ini_file(BADDIR/ParseIniFileVar6.ini): failed to open stream: No such file or directory in %s on line %d
+Warning: parse_ini_file(BADDIR/ParseIniFileVar6.ini): Failed to open stream: No such file or directory in %s on line %d
bool(false)
*** Done ***
diff --git a/ext/standard/tests/file/pathinfo_basic1-win32.phpt b/ext/standard/tests/file/pathinfo_basic1-win32.phpt
index acca647a97..060c7e3423 100644
--- a/ext/standard/tests/file/pathinfo_basic1-win32.phpt
+++ b/ext/standard/tests/file/pathinfo_basic1-win32.phpt
@@ -16,45 +16,45 @@ if(substr(PHP_OS, 0, 3) != "WIN")
echo "*** Testing basic functions of pathinfo() ***\n";
$paths = array (
- '',
- ' ',
- 'c:',
- 'c:\\',
- 'c:/',
- 'afile',
- 'c:\test\adir',
- 'c:\test\adir\\',
- '/usr/include/arpa',
- '/usr/include/arpa/',
- 'usr/include/arpa',
- 'usr/include/arpa/',
- 'c:\test\afile',
- 'c:\\test\\afile',
- 'c://test//afile',
- 'c:\test\afile\\',
- 'c:\test\prog.exe',
- 'c:\\test\\prog.exe',
- 'c:/test/prog.exe',
- '/usr/include/arpa/inet.h',
- '//usr/include//arpa/inet.h',
- '\\',
- '\\\\',
- '/',
- '//',
- '///',
- '/usr/include/arpa/inet.h',
- 'c:\windows/system32\drivers/etc\hosts',
- '/usr\include/arpa\inet.h',
- ' c:\test\adir\afile.txt',
- 'c:\test\adir\afile.txt ',
- ' c:\test\adir\afile.txt ',
- ' /usr/include/arpa/inet.h',
- '/usr/include/arpa/inet.h ',
- ' /usr/include/arpa/inet.h ',
- ' c:',
- ' c:\test\adir\afile.txt',
- '/usr',
- '/usr/'
+ '',
+ ' ',
+ 'c:',
+ 'c:\\',
+ 'c:/',
+ 'afile',
+ 'c:\test\adir',
+ 'c:\test\adir\\',
+ '/usr/include/arpa',
+ '/usr/include/arpa/',
+ 'usr/include/arpa',
+ 'usr/include/arpa/',
+ 'c:\test\afile',
+ 'c:\\test\\afile',
+ 'c://test//afile',
+ 'c:\test\afile\\',
+ 'c:\test\prog.exe',
+ 'c:\\test\\prog.exe',
+ 'c:/test/prog.exe',
+ '/usr/include/arpa/inet.h',
+ '//usr/include//arpa/inet.h',
+ '\\',
+ '\\\\',
+ '/',
+ '//',
+ '///',
+ '/usr/include/arpa/inet.h',
+ 'c:\windows/system32\drivers/etc\hosts',
+ '/usr\include/arpa\inet.h',
+ ' c:\test\adir\afile.txt',
+ 'c:\test\adir\afile.txt ',
+ ' c:\test\adir\afile.txt ',
+ ' /usr/include/arpa/inet.h',
+ '/usr/include/arpa/inet.h ',
+ ' /usr/include/arpa/inet.h ',
+ ' c:',
+ ' c:\test\adir\afile.txt',
+ '/usr',
+ '/usr/'
);
$counter = 1;
diff --git a/ext/standard/tests/file/pathinfo_basic1.phpt b/ext/standard/tests/file/pathinfo_basic1.phpt
index c9e84522a8..d195a76fb3 100644
--- a/ext/standard/tests/file/pathinfo_basic1.phpt
+++ b/ext/standard/tests/file/pathinfo_basic1.phpt
@@ -16,45 +16,45 @@ if(substr(PHP_OS, 0, 3) == "WIN")
echo "*** Testing basic functions of pathinfo() ***\n";
$paths = array (
- '',
- ' ',
- 'c:',
- 'c:\\',
- 'c:/',
- 'afile',
- 'c:\test\adir',
- 'c:\test\adir\\',
- '/usr/include/arpa',
- '/usr/include/arpa/',
- 'usr/include/arpa',
- 'usr/include/arpa/',
- 'c:\test\afile',
- 'c:\\test\\afile',
- 'c://test//afile',
- 'c:\test\afile\\',
- 'c:\test\prog.exe',
- 'c:\\test\\prog.exe',
- 'c:/test/prog.exe',
- '/usr/include/arpa/inet.h',
- '//usr/include//arpa/inet.h',
- '\\',
- '\\\\',
- '/',
- '//',
- '///',
- '/usr/include/arpa/inet.h',
- 'c:\windows/system32\drivers/etc\hosts',
- '/usr\include/arpa\inet.h',
- ' c:\test\adir\afile.txt',
- 'c:\test\adir\afile.txt ',
- ' c:\test\adir\afile.txt ',
- ' /usr/include/arpa/inet.h',
- '/usr/include/arpa/inet.h ',
- ' /usr/include/arpa/inet.h ',
- ' c:',
- ' c:\test\adir\afile.txt',
- '/usr',
- '/usr/'
+ '',
+ ' ',
+ 'c:',
+ 'c:\\',
+ 'c:/',
+ 'afile',
+ 'c:\test\adir',
+ 'c:\test\adir\\',
+ '/usr/include/arpa',
+ '/usr/include/arpa/',
+ 'usr/include/arpa',
+ 'usr/include/arpa/',
+ 'c:\test\afile',
+ 'c:\\test\\afile',
+ 'c://test//afile',
+ 'c:\test\afile\\',
+ 'c:\test\prog.exe',
+ 'c:\\test\\prog.exe',
+ 'c:/test/prog.exe',
+ '/usr/include/arpa/inet.h',
+ '//usr/include//arpa/inet.h',
+ '\\',
+ '\\\\',
+ '/',
+ '//',
+ '///',
+ '/usr/include/arpa/inet.h',
+ 'c:\windows/system32\drivers/etc\hosts',
+ '/usr\include/arpa\inet.h',
+ ' c:\test\adir\afile.txt',
+ 'c:\test\adir\afile.txt ',
+ ' c:\test\adir\afile.txt ',
+ ' /usr/include/arpa/inet.h',
+ '/usr/include/arpa/inet.h ',
+ ' /usr/include/arpa/inet.h ',
+ ' c:',
+ ' c:\test\adir\afile.txt',
+ '/usr',
+ '/usr/'
);
$counter = 1;
diff --git a/ext/standard/tests/file/pathinfo_basic2-win32.phpt b/ext/standard/tests/file/pathinfo_basic2-win32.phpt
index 5a88b648d3..97f3899426 100644
--- a/ext/standard/tests/file/pathinfo_basic2-win32.phpt
+++ b/ext/standard/tests/file/pathinfo_basic2-win32.phpt
@@ -16,21 +16,21 @@ if(substr(PHP_OS, 0, 3) != "WIN")
echo "*** Testing basic functions of pathinfo() ***\n";
$paths = array (
- 'c:\..\dir1',
- 'c:\test\..\test2\.\adir\afile.txt',
- '/usr/include/../arpa/./inet.h',
- 'c:\test\adir\afile..txt',
- '/usr/include/arpa/inet..h',
- 'c:\test\adir\afile.',
- '/usr/include/arpa/inet.',
- '/usr/include/arpa/inet,h',
- 'c:afile.txt',
- '..\.\..\test\afile.txt',
- '.././../test/afile',
- '.',
- '..',
- '...',
- '/usr/lib/.../afile'
+ 'c:\..\dir1',
+ 'c:\test\..\test2\.\adir\afile.txt',
+ '/usr/include/../arpa/./inet.h',
+ 'c:\test\adir\afile..txt',
+ '/usr/include/arpa/inet..h',
+ 'c:\test\adir\afile.',
+ '/usr/include/arpa/inet.',
+ '/usr/include/arpa/inet,h',
+ 'c:afile.txt',
+ '..\.\..\test\afile.txt',
+ '.././../test/afile',
+ '.',
+ '..',
+ '...',
+ '/usr/lib/.../afile'
);
diff --git a/ext/standard/tests/file/pathinfo_basic2.phpt b/ext/standard/tests/file/pathinfo_basic2.phpt
index 51de45d33d..3ae6e1338c 100644
--- a/ext/standard/tests/file/pathinfo_basic2.phpt
+++ b/ext/standard/tests/file/pathinfo_basic2.phpt
@@ -16,21 +16,21 @@ if(substr(PHP_OS, 0, 3) == "WIN")
echo "*** Testing basic functions of pathinfo() ***\n";
$paths = array (
- 'c:\..\dir1',
- 'c:\test\..\test2\.\adir\afile.txt',
- '/usr/include/../arpa/./inet.h',
- 'c:\test\adir\afile..txt',
- '/usr/include/arpa/inet..h',
- 'c:\test\adir\afile.',
- '/usr/include/arpa/inet.',
- '/usr/include/arpa/inet,h',
- 'c:afile.txt',
- '..\.\..\test\afile.txt',
- '.././../test/afile',
- '.',
- '..',
- '...',
- '/usr/lib/.../afile'
+ 'c:\..\dir1',
+ 'c:\test\..\test2\.\adir\afile.txt',
+ '/usr/include/../arpa/./inet.h',
+ 'c:\test\adir\afile..txt',
+ '/usr/include/arpa/inet..h',
+ 'c:\test\adir\afile.',
+ '/usr/include/arpa/inet.',
+ '/usr/include/arpa/inet,h',
+ 'c:afile.txt',
+ '..\.\..\test\afile.txt',
+ '.././../test/afile',
+ '.',
+ '..',
+ '...',
+ '/usr/lib/.../afile'
);
diff --git a/ext/standard/tests/file/pathinfo_variation3.phpt b/ext/standard/tests/file/pathinfo_variation3.phpt
index 014cc90e9a..251a20496f 100644
--- a/ext/standard/tests/file/pathinfo_variation3.phpt
+++ b/ext/standard/tests/file/pathinfo_variation3.phpt
@@ -32,7 +32,6 @@ var_dump(pathinfo($testfile, PATHINFO_DIRNAME|PATHINFO_BASENAME));
?>
-===DONE===
--EXPECTF--
*** Testing pathinfo() : usage variation ***
array(4) {
@@ -77,4 +76,3 @@ string(17) "/usr/include/arpa"
string(6) "inet.h"
string(17) "/usr/include/arpa"
string(17) "/usr/include/arpa"
-===DONE===
diff --git a/ext/standard/tests/file/pathinfo_variaton.phpt b/ext/standard/tests/file/pathinfo_variaton.phpt
index 421f378e01..799a264e34 100644
--- a/ext/standard/tests/file/pathinfo_variaton.phpt
+++ b/ext/standard/tests/file/pathinfo_variaton.phpt
@@ -6,7 +6,7 @@ Test pathinfo() function: usage variations
Description: Returns information about a file path
*/
-echo "*** Testing pathinfo() with miscelleneous input arguments ***\n";
+echo "*** Testing pathinfo() with miscellaneous input arguments ***\n";
$fp = fopen(__FILE__, "r");
unset($fp);
@@ -43,9 +43,6 @@ $paths = array (
"./array(1, 2)",
"array( array(), null)",
- /* pathname as object */
- $obj,
-
/* pathname as spaces */
" ",
' ',
@@ -91,9 +88,9 @@ foreach($paths as $path) {
echo "Done\n";
?>
--EXPECTF--
-*** Testing pathinfo() with miscelleneous input arguments ***
+*** Testing pathinfo() with miscellaneous input arguments ***
-Notice: Undefined variable: fp in %s on line %d
+Warning: Undefined variable: fp in %s on line %d
-- Iteration 1 --
array(3) {
["dirname"]=>
@@ -199,22 +196,6 @@ string(21) "array( array(), null)"
string(0) ""
string(21) "array( array(), null)"
-- Iteration 9 --
-
-Warning: pathinfo() expects parameter 1 to be string, object given in %s on line %d
-NULL
-
-Warning: pathinfo() expects parameter 1 to be string, object given in %s on line %d
-NULL
-
-Warning: pathinfo() expects parameter 1 to be string, object given in %s on line %d
-NULL
-
-Warning: pathinfo() expects parameter 1 to be string, object given in %s on line %d
-NULL
-
-Warning: pathinfo() expects parameter 1 to be string, object given in %s on line %d
-NULL
--- Iteration 10 --
array(3) {
["dirname"]=>
string(1) "."
@@ -227,7 +208,7 @@ string(1) "."
string(1) " "
string(0) ""
string(1) " "
--- Iteration 11 --
+-- Iteration 10 --
array(3) {
["dirname"]=>
string(1) "."
@@ -240,7 +221,7 @@ string(1) "."
string(1) " "
string(0) ""
string(1) " "
--- Iteration 12 --
+-- Iteration 11 --
array(2) {
["basename"]=>
string(0) ""
@@ -251,7 +232,7 @@ string(0) ""
string(0) ""
string(0) ""
string(0) ""
--- Iteration 13 --
+-- Iteration 12 --
array(2) {
["basename"]=>
string(0) ""
@@ -262,7 +243,7 @@ string(0) ""
string(0) ""
string(0) ""
string(0) ""
--- Iteration 14 --
+-- Iteration 13 --
array(2) {
["basename"]=>
string(0) ""
@@ -273,7 +254,7 @@ string(0) ""
string(0) ""
string(0) ""
string(0) ""
--- Iteration 15 --
+-- Iteration 14 --
array(2) {
["basename"]=>
string(0) ""
@@ -284,7 +265,7 @@ string(0) ""
string(0) ""
string(0) ""
string(0) ""
--- Iteration 16 --
+-- Iteration 15 --
array(2) {
["basename"]=>
string(0) ""
@@ -295,7 +276,7 @@ string(0) ""
string(0) ""
string(0) ""
string(0) ""
--- Iteration 17 --
+-- Iteration 16 --
array(4) {
["dirname"]=>
string(1) "."
@@ -310,7 +291,7 @@ string(1) "."
string(11) "www.foo.com"
string(3) "com"
string(7) "www.foo"
--- Iteration 18 --
+-- Iteration 17 --
array(4) {
["dirname"]=>
string(17) "/var/html/testdir"
@@ -325,7 +306,7 @@ string(17) "/var/html/testdir"
string(12) "example.html"
string(4) "html"
string(7) "example"
--- Iteration 19 --
+-- Iteration 18 --
array(3) {
["dirname"]=>
string(12) "/testdir/foo"
@@ -338,7 +319,7 @@ string(12) "/testdir/foo"
string(4) "test"
string(0) ""
string(4) "test"
--- Iteration 20 --
+-- Iteration 19 --
array(4) {
["dirname"]=>
string(4) "/foo"
@@ -353,7 +334,7 @@ string(4) "/foo"
string(12) "symlink.link"
string(4) "link"
string(7) "symlink"
--- Iteration 21 --
+-- Iteration 20 --
array(3) {
["dirname"]=>
string(1) "."
@@ -366,7 +347,7 @@ string(1) "."
string(5) "12345"
string(0) ""
string(5) "12345"
--- Iteration 22 --
+-- Iteration 21 --
array(4) {
["dirname"]=>
string(1) "."
@@ -381,7 +362,7 @@ string(1) "."
string(15) "www.example.com"
string(3) "com"
string(11) "www.example"
--- Iteration 23 --
+-- Iteration 22 --
array(3) {
["dirname"]=>
string(12) "/testdir/foo"
@@ -394,7 +375,7 @@ string(12) "/testdir/foo"
string(4) "test"
string(0) ""
string(4) "test"
--- Iteration 24 --
+-- Iteration 23 --
array(4) {
["dirname"]=>
string(6) "../foo"
@@ -409,7 +390,7 @@ string(6) "../foo"
string(9) "test.link"
string(4) "link"
string(4) "test"
--- Iteration 25 --
+-- Iteration 24 --
array(4) {
["dirname"]=>
string(76) "./test/work/scratch/mydir/yourdir/ourdir/test1/test2/test3/test4/test5/test6"
@@ -424,7 +405,7 @@ string(76) "./test/work/scratch/mydir/yourdir/ourdir/test1/test2/test3/test4/tes
string(8) "test.tmp"
string(3) "tmp"
string(4) "test"
--- Iteration 26 --
+-- Iteration 25 --
array(4) {
["dirname"]=>
string(1) "."
diff --git a/ext/standard/tests/file/php_fd_wrapper_03.phpt b/ext/standard/tests/file/php_fd_wrapper_03.phpt
index c004a4319f..75e05620aa 100644
--- a/ext/standard/tests/file/php_fd_wrapper_03.phpt
+++ b/ext/standard/tests/file/php_fd_wrapper_03.phpt
@@ -11,12 +11,12 @@ echo "\nDone.\n";
--EXPECTF--
Warning: fopen(): Invalid php:// URL specified in %s on line %d
-Warning: fopen(php://fd): failed to open stream: operation failed in %s on line 2
+Warning: fopen(php://fd): Failed to open stream: operation failed in %s on line 2
-Warning: fopen(php://fd/): failed to open stream: php://fd/ stream must be specified in the form php://fd/<orig fd> in %s on line %d
+Warning: fopen(php://fd/): Failed to open stream: php://fd/ stream must be specified in the form php://fd/<orig fd> in %s on line %d
-Warning: fopen(php://fd/-2): failed to open stream: The file descriptors must be non-negative numbers smaller than %d in %s on line %d
+Warning: fopen(php://fd/-2): Failed to open stream: The file descriptors must be non-negative numbers smaller than %d in %s on line %d
-Warning: fopen(php://fd/1/): failed to open stream: php://fd/ stream must be specified in the form php://fd/<orig fd> in %s on line %d
+Warning: fopen(php://fd/1/): Failed to open stream: php://fd/ stream must be specified in the form php://fd/<orig fd> in %s on line %d
Done.
diff --git a/ext/standard/tests/file/php_fd_wrapper_04.phpt b/ext/standard/tests/file/php_fd_wrapper_04.phpt
index ea3a1aff6e..142f70abb4 100644
--- a/ext/standard/tests/file/php_fd_wrapper_04.phpt
+++ b/ext/standard/tests/file/php_fd_wrapper_04.phpt
@@ -6,6 +6,6 @@ fopen("php://fd/1023", "w");
echo "\nDone.\n";
--EXPECTF--
-Warning: fopen(php://fd/1023): failed to open stream: Error duping file descriptor 1023; possibly it doesn't exist: [9]: %s in %s on line %d
+Warning: fopen(php://fd/1023): Failed to open stream: Error duping file descriptor 1023; possibly it doesn't exist: [9]: %s in %s on line %d
Done.
diff --git a/ext/standard/tests/file/popen_pclose_basic-win32-mb.phpt b/ext/standard/tests/file/popen_pclose_basic-win32-mb.phpt
index 2d9b2b92dc..008cef3643 100644
--- a/ext/standard/tests/file/popen_pclose_basic-win32-mb.phpt
+++ b/ext/standard/tests/file/popen_pclose_basic-win32-mb.phpt
@@ -28,7 +28,7 @@ echo "*** Testing popen(): writing to the pipe ***\n";
$arr = array("ggg", "ddd", "aaa", "sss");
// popen("sort", "w") fails if variables_order="GPCS"
// this is set in the default INI file
-// it doesn't seem to be changeable in the --INI-- section
+// it doesn't seem to be changeable in the--INI-- section
// also, doing: ini_set('variables_order', ''); doesn't work!
//
// the only solution is to either put the absolute path here, or
diff --git a/ext/standard/tests/file/popen_pclose_basic-win32.phpt b/ext/standard/tests/file/popen_pclose_basic-win32.phpt
index dfb00fbeb2..5be3ee4ca8 100644
--- a/ext/standard/tests/file/popen_pclose_basic-win32.phpt
+++ b/ext/standard/tests/file/popen_pclose_basic-win32.phpt
@@ -28,7 +28,7 @@ echo "*** Testing popen(): writing to the pipe ***\n";
$arr = array("ggg", "ddd", "aaa", "sss");
// popen("sort", "w") fails if variables_order="GPCS"
// this is set in the default INI file
-// it doesn't seem to be changeable in the --INI-- section
+// it doesn't seem to be changeable in the--INI-- section
// also, doing: ini_set('variables_order', ''); doesn't work!
//
// the only solution is to either put the absolute path here, or
diff --git a/ext/standard/tests/file/popen_pclose_error.phpt b/ext/standard/tests/file/popen_pclose_error.phpt
index b0e86be65c..eebe6a7a00 100644
--- a/ext/standard/tests/file/popen_pclose_error.phpt
+++ b/ext/standard/tests/file/popen_pclose_error.phpt
@@ -16,14 +16,9 @@ if (strtoupper( substr(PHP_OS, 0, 3) ) == 'SUN')
*/
$file_path = __DIR__;
echo "*** Testing for error conditions ***\n";
-var_dump( popen() ); // Zero Arguments
-var_dump( popen("abc.txt") ); // Single Argument
var_dump( popen("abc.txt", "rw") ); // Invalid mode Argument
-var_dump( pclose() );
$file_handle = fopen($file_path."/popen.tmp", "w");
-var_dump( pclose($file_handle, $file_handle) );
fclose($file_handle);
-var_dump( pclose(1) );
echo "\n--- Done ---";
?>
--CLEAN--
@@ -34,22 +29,7 @@ unlink($file_path."/popen.tmp");
--EXPECTF--
*** Testing for error conditions ***
-Warning: popen() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: popen() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
Warning: popen(abc.txt,rw): %s on line %d
bool(false)
-Warning: pclose() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: pclose() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
-
-Warning: pclose() expects parameter 1 to be resource, int given in %s on line %d
-bool(false)
-
--- Done ---
diff --git a/ext/standard/tests/file/proc_open01.phpt b/ext/standard/tests/file/proc_open01.phpt
index 66c601fb91..2f74a17464 100644
--- a/ext/standard/tests/file/proc_open01.phpt
+++ b/ext/standard/tests/file/proc_open01.phpt
@@ -6,15 +6,15 @@ $pipes = array(1, 2, 3);
$orig_pipes = $pipes;
$php = getenv('TEST_PHP_EXECUTABLE');
if ($php === false) {
- die("no php executable defined");
+ die("no php executable defined");
}
$proc = proc_open(
- "$php -n",
- array(0 => array('pipe', 'r'), 1 => array('pipe', 'w')),
- $pipes, getcwd(), array(), array()
+ "$php -n",
+ array(0 => array('pipe', 'r'), 1 => array('pipe', 'w')),
+ $pipes, getcwd(), array(), array()
);
if ($proc === false) {
- print "something went wrong.\n";
+ print "something went wrong.\n";
}
var_dump($pipes);
stream_set_blocking($pipes[1], FALSE);
@@ -25,25 +25,25 @@ fclose($pipes[0]);
$cnt = '';
$n=0;
for ($left = strlen($test_string); $left > 0;) {
- if (++$n >1000) {
- print "terminated after 1000 iterations\n";
- break;
- }
- $read_fds = array($pipes[1]);
- $write_fds = NULL;
- $exp_fds = NULL;
- $retval = stream_select($read_fds, $write_fds, $exp_fds, 5);
- if ($retval === false) {
- print "select() failed\n";
- break;
- }
- if ($retval === 0) {
- print "timed out\n";
- break;
- }
- $buf = fread($pipes[1], 1024);
- $cnt .= $buf;
- $left -= strlen($buf);
+ if (++$n >1000) {
+ print "terminated after 1000 iterations\n";
+ break;
+ }
+ $read_fds = array($pipes[1]);
+ $write_fds = NULL;
+ $exp_fds = NULL;
+ $retval = stream_select($read_fds, $write_fds, $exp_fds, 5);
+ if ($retval === false) {
+ print "select() failed\n";
+ break;
+ }
+ if ($retval === 0) {
+ print "timed out\n";
+ break;
+ }
+ $buf = fread($pipes[1], 1024);
+ $cnt .= $buf;
+ $left -= strlen($buf);
}
var_dump($cnt);
fclose($pipes[1]);
diff --git a/ext/standard/tests/file/readfile_error.phpt b/ext/standard/tests/file/readfile_error.phpt
index 0dc1f7b82f..b0ada5ea21 100644
--- a/ext/standard/tests/file/readfile_error.phpt
+++ b/ext/standard/tests/file/readfile_error.phpt
@@ -9,17 +9,12 @@ Test readfile() function: error conditions
$context = stream_context_create();
echo "*** Test readfile(): error conditions ***\n";
-echo "-- Testing readfile() with unexpected no. of arguments --\n";
-var_dump( readfile() ); // args < expected
-var_dump( readfile(__FILE__, true, $context, 4) ); // args > expected
echo "\n-- Testing readfile() with invalid arguments --\n";
// invalid arguments
var_dump( readfile(NULL) ); // NULL as $filename
var_dump( readfile('') ); // empty string as $filename
var_dump( readfile(false) ); // boolean false as $filename
-var_dump( readfile(__FILE__, false, '') ); // empty string as $context
-var_dump( readfile(__FILE__, true, false) ); // boolean false as $context
echo "\n-- Testing readfile() with non-existent file --\n";
$non_existent_file = __DIR__."/non_existent_file.tmp";
@@ -29,13 +24,6 @@ echo "Done\n";
?>
--EXPECTF--
*** Test readfile(): error conditions ***
--- Testing readfile() with unexpected no. of arguments --
-
-Warning: readfile() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: readfile() expects at most 3 parameters, 4 given in %s on line %d
-bool(false)
-- Testing readfile() with invalid arguments --
@@ -48,14 +36,8 @@ bool(false)
Warning: readfile(): Filename cannot be empty in %s on line %d
bool(false)
-Warning: readfile() expects parameter 3 to be resource, string given in %s on line %d
-bool(false)
-
-Warning: readfile() expects parameter 3 to be resource, bool given in %s on line %d
-bool(false)
-
-- Testing readfile() with non-existent file --
-Warning: readfile(%s/non_existent_file.tmp): failed to open stream: %s in %s on line %d
+Warning: readfile(%s/non_existent_file.tmp): Failed to open stream: %s in %s on line %d
bool(false)
Done
diff --git a/ext/standard/tests/file/readfile_variation10-win32.phpt b/ext/standard/tests/file/readfile_variation10-win32.phpt
index 5824a8fe15..c6c3f87a36 100644
--- a/ext/standard/tests/file/readfile_variation10-win32.phpt
+++ b/ext/standard/tests/file/readfile_variation10-win32.phpt
@@ -38,8 +38,12 @@ $names_arr = array(
);
foreach($names_arr as $key => $value) {
- echo "\n-- Filename: $key --\n";
- readfile($value);
+ echo "\n-- Filename: $key --\n";
+ try {
+ readfile($value);
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
};
?>
@@ -48,11 +52,11 @@ foreach($names_arr as $key => $value) {
-- Filename: -1 --
-Warning: readfile(-1): failed to open stream: No such file or directory in %s on line %d
+Warning: readfile(-1): Failed to open stream: No such file or directory in %s on line %d
-- Filename: TRUE --
-Warning: readfile(1): failed to open stream: No such file or directory in %s on line %d
+Warning: readfile(1): Failed to open stream: No such file or directory in %s on line %d
-- Filename: FALSE --
@@ -68,20 +72,18 @@ Warning: readfile(): Filename cannot be empty in %s on line %d
-- Filename: " " --
-Warning: readfile( ): failed to open stream: Permission denied in %s on line %d
+Warning: readfile( ): Failed to open stream: Permission denied in %s on line %d
-- Filename: \0 --
-
-Warning: readfile() expects parameter 1 to be a valid path, string given in %s on line %d
+readfile() expects parameter 1 to be a valid path, string given
-- Filename: array() --
-
-Warning: readfile() expects parameter 1 to be a valid path, array given in %s on line %d
+readfile() expects parameter 1 to be a valid path, array given
-- Filename: /no/such/file/dir --
-Warning: readfile(/no/such/file/dir): failed to open stream: No such file or directory in %s on line %d
+Warning: readfile(/no/such/file/dir): Failed to open stream: No such file or directory in %s on line %d
-- Filename: php/php --
-Warning: readfile(php/php): failed to open stream: No such file or directory in %s on line %d
+Warning: readfile(php/php): Failed to open stream: No such file or directory in %s on line %d
diff --git a/ext/standard/tests/file/readfile_variation10.phpt b/ext/standard/tests/file/readfile_variation10.phpt
index e9655377a3..fd501eaef5 100644
--- a/ext/standard/tests/file/readfile_variation10.phpt
+++ b/ext/standard/tests/file/readfile_variation10.phpt
Binary files differ
diff --git a/ext/standard/tests/file/readfile_variation6.phpt b/ext/standard/tests/file/readfile_variation6.phpt
index 38e0f23958..7e751753ff 100644
--- a/ext/standard/tests/file/readfile_variation6.phpt
+++ b/ext/standard/tests/file/readfile_variation6.phpt
@@ -42,8 +42,6 @@ function runtest() {
}
?>
-===DONE===
--EXPECT--
*** Testing readfile() : variation ***
File in include path
-===DONE===
diff --git a/ext/standard/tests/file/readfile_variation7.phpt b/ext/standard/tests/file/readfile_variation7.phpt
index 955d77bd27..71f2d0beb5 100644
--- a/ext/standard/tests/file/readfile_variation7.phpt
+++ b/ext/standard/tests/file/readfile_variation7.phpt
@@ -42,8 +42,6 @@ function runtest() {
}
?>
-===DONE===
--EXPECT--
*** Testing readfile() : variation ***
File in script location
-===DONE===
diff --git a/ext/standard/tests/file/readfile_variation8-win32-mb.phpt b/ext/standard/tests/file/readfile_variation8-win32-mb.phpt
index 4ca719266f..acf968d6fd 100644
--- a/ext/standard/tests/file/readfile_variation8-win32-mb.phpt
+++ b/ext/standard/tests/file/readfile_variation8-win32-mb.phpt
@@ -86,11 +86,11 @@ The File Contents
The File Contents
-- %s\readfileVarç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™8\readfileVarç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™8Sub\..\\\readfileVarç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™8Sub\\..\\..\readfileVarç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™8Sub --
-Warning: readfile(%s\readfileVarç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™8\readfileVarç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™8Sub\..\\\readfileVarç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™8Sub\\..\\..\readfileVarç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™8Sub\fileToRead.tmp): failed to open stream: No such file or directory in %s on line %d
+Warning: readfile(%s\readfileVarç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™8\readfileVarç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™8Sub\..\\\readfileVarç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™8Sub\\..\\..\readfileVarç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™8Sub\fileToRead.tmp): Failed to open stream: No such file or directory in %s on line %d
-- %s\readfileVarç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™8\readfileVarç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™8Sub\BADDIR --
-Warning: readfile(%s\readfileVarç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™8\readfileVarç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™8Sub\BADDIR\fileToRead.tmp): failed to open stream: No such file or directory in %s on line %d
+Warning: readfile(%s\readfileVarç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™8\readfileVarç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™8Sub\BADDIR\fileToRead.tmp): Failed to open stream: No such file or directory in %s on line %d
-- readfileVarç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™8\readfileVarç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™8Sub --
The File Contents
@@ -102,7 +102,7 @@ The File Contents
The File Contents
-- BADDIR --
-Warning: readfile(BADDIR\fileToRead.tmp): failed to open stream: No such file or directory in %s on line %d
+Warning: readfile(BADDIR\fileToRead.tmp): Failed to open stream: No such file or directory in %s on line %d
-- /%s/readfileVarç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™8/readfileVarç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™8Sub --
The File Contents
diff --git a/ext/standard/tests/file/readfile_variation8-win32.phpt b/ext/standard/tests/file/readfile_variation8-win32.phpt
index c914786407..ebd15ae618 100644
--- a/ext/standard/tests/file/readfile_variation8-win32.phpt
+++ b/ext/standard/tests/file/readfile_variation8-win32.phpt
@@ -86,11 +86,11 @@ The File Contents
The File Contents
-- %s\readfileVar8\readfileVar8Sub\..\\\readfileVar8Sub\\..\\..\readfileVar8Sub --
-Warning: readfile(%s\readfileVar8\readfileVar8Sub\..\\\readfileVar8Sub\\..\\..\readfileVar8Sub\fileToRead.tmp): failed to open stream: No such file or directory in %s on line %d
+Warning: readfile(%s\readfileVar8\readfileVar8Sub\..\\\readfileVar8Sub\\..\\..\readfileVar8Sub\fileToRead.tmp): Failed to open stream: No such file or directory in %s on line %d
-- %s\readfileVar8\readfileVar8Sub\BADDIR --
-Warning: readfile(%s\readfileVar8\readfileVar8Sub\BADDIR\fileToRead.tmp): failed to open stream: No such file or directory in %s on line %d
+Warning: readfile(%s\readfileVar8\readfileVar8Sub\BADDIR\fileToRead.tmp): Failed to open stream: No such file or directory in %s on line %d
-- readfileVar8\readfileVar8Sub --
The File Contents
@@ -102,7 +102,7 @@ The File Contents
The File Contents
-- BADDIR --
-Warning: readfile(BADDIR\fileToRead.tmp): failed to open stream: No such file or directory in %s on line %d
+Warning: readfile(BADDIR\fileToRead.tmp): Failed to open stream: No such file or directory in %s on line %d
-- /%s/readfileVar8/readfileVar8Sub --
The File Contents
diff --git a/ext/standard/tests/file/readfile_variation9.phpt b/ext/standard/tests/file/readfile_variation9.phpt
index 1d536e61f1..a6ca560d6d 100644
--- a/ext/standard/tests/file/readfile_variation9.phpt
+++ b/ext/standard/tests/file/readfile_variation9.phpt
@@ -78,11 +78,11 @@ The File Contents
The File Contents
-- Iteration 5 --
-Warning: readfile(%sreadfileVar8Sub/..///readfileVar8Sub//..//../readfileVar8Sub/fileToRead.tmp): failed to open stream: No such file or directory in %s on line %d
+Warning: readfile(%sreadfileVar8Sub/..///readfileVar8Sub//..//../readfileVar8Sub/fileToRead.tmp): Failed to open stream: No such file or directory in %s on line %d
-- Iteration 6 --
-Warning: readfile(%sreadfileVar8Sub/BADDIR/fileToRead.tmp): failed to open stream: No such file or directory in %s on line %d
+Warning: readfile(%sreadfileVar8Sub/BADDIR/fileToRead.tmp): Failed to open stream: No such file or directory in %s on line %d
-- Iteration 7 --
The File Contents
@@ -94,6 +94,6 @@ The File Contents
The File Contents
-- Iteration 11 --
-Warning: readfile(BADDIR/fileToRead.tmp): failed to open stream: No such file or directory in %s on line %d
+Warning: readfile(BADDIR/fileToRead.tmp): Failed to open stream: No such file or directory in %s on line %d
*** Done ***
diff --git a/ext/standard/tests/file/readlink_realpath_error.phpt b/ext/standard/tests/file/readlink_realpath_error.phpt
index e2afb8bb36..07880d1007 100644
--- a/ext/standard/tests/file/readlink_realpath_error.phpt
+++ b/ext/standard/tests/file/readlink_realpath_error.phpt
@@ -15,10 +15,6 @@ if (substr(PHP_OS, 0, 3) == 'WIN') {
Description: Returns canonicalized absolute pathname
*/
-echo "*** Testing readlink(): error conditions ***\n";
-var_dump( readlink() ); // args < expected
-var_dump( readlink(__FILE__, 2) ); // args > expected
-
echo "\n*** Testing readlink() on a non-existent link ***\n";
var_dump( readlink(__DIR__."/readlink_error.tmp") );
@@ -28,24 +24,12 @@ var_dump( readlink(__FILE__) );
echo "\n*** Testing readlink() on existing directory ***\n";
var_dump( readlink(__DIR__) );
-echo "*** Testing realpath(): error conditions ***\n";
-var_dump( realpath() ); // args < expected
-var_dump( realpath(1, 2) ); // args > expected
-
echo "\n*** Testing realpath() on a non-existent file ***\n";
var_dump( realpath(__DIR__."/realpath_error.tmp") );
echo "Done\n";
?>
--EXPECTF--
-*** Testing readlink(): error conditions ***
-
-Warning: readlink() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: readlink() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
*** Testing readlink() on a non-existent link ***
Warning: readlink(): No such file or directory in %s on line %d
@@ -60,13 +44,6 @@ bool(false)
Warning: readlink(): Invalid argument in %s on line %d
bool(false)
-*** Testing realpath(): error conditions ***
-
-Warning: realpath() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: realpath() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
*** Testing realpath() on a non-existent file ***
%s
diff --git a/ext/standard/tests/file/readlink_variation1.phpt b/ext/standard/tests/file/readlink_variation1.phpt
index d641f20f26..276f894432 100644
--- a/ext/standard/tests/file/readlink_variation1.phpt
+++ b/ext/standard/tests/file/readlink_variation1.phpt
@@ -12,7 +12,6 @@ obscure_filename
/* Testing readlink() with invalid arguments -int, float, bool, NULL, resource */
$file_path = __DIR__;
-$file_handle = fopen($file_path."/readlink_variation2.tmp", "w");
echo "*** Testing Invalid file types ***\n";
$filenames = array(
@@ -22,7 +21,6 @@ $filenames = array(
TRUE,
FALSE,
NULL,
- $file_handle,
/* scalars */
1234,
@@ -34,7 +32,6 @@ foreach( $filenames as $filename ) {
var_dump( readlink($filename) );
clearstatcache();
}
-fclose($file_handle);
?>
--CLEAN--
<?php
@@ -59,9 +56,6 @@ bool(false)
Warning: readlink(): %s in %s on line %d
bool(false)
-Warning: readlink() expects parameter 1 to be a valid path, resource given in %s on line %d
-NULL
-
Warning: readlink(): %s in %s on line %d
bool(false)
diff --git a/ext/standard/tests/file/realpath_error-win32.phpt b/ext/standard/tests/file/realpath_error-win32.phpt
deleted file mode 100644
index 2fd221e45a..0000000000
--- a/ext/standard/tests/file/realpath_error-win32.phpt
+++ /dev/null
@@ -1,29 +0,0 @@
---TEST--
-Test realpath() function: error conditions
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) != 'WIN') {
- die('skip only on Windows');
-}
-?>
---FILE--
-<?php
-/* Prototype: string realpath ( string $path );
- Description: Returns canonicalized absolute pathname
-*/
-
-echo "*** Testing realpath() for error conditions ***\n";
-var_dump( realpath() ); // args < expected
-var_dump( realpath(1, 2) ); // args > expected
-
-echo "Done\n";
-?>
---EXPECTF--
-*** Testing realpath() for error conditions ***
-
-Warning: realpath() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: realpath() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-Done
diff --git a/ext/standard/tests/file/realpath_variation2.phpt b/ext/standard/tests/file/realpath_variation2.phpt
index 9b0393a5f8..142e8846da 100644
--- a/ext/standard/tests/file/realpath_variation2.phpt
+++ b/ext/standard/tests/file/realpath_variation2.phpt
@@ -35,7 +35,6 @@ foreach($paths as $path) {
};
?>
-===DONE===
--EXPECTF--
*** Testing realpath() : variation ***
@@ -71,4 +70,3 @@ bool(false)
--\tmp\--
bool(false)
-===DONE===
diff --git a/ext/standard/tests/file/rename_basic.phpt b/ext/standard/tests/file/rename_basic.phpt
index 49de9ac042..4313f061d6 100644
--- a/ext/standard/tests/file/rename_basic.phpt
+++ b/ext/standard/tests/file/rename_basic.phpt
@@ -31,7 +31,6 @@ $keys_to_compare = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12,
var_dump( compare_stats($old_stat, $new_stat, $keys_to_compare) );
?>
-===Done===
--CLEAN--
<?php
unlink(__DIR__."/rename_basic_new.tmp");
@@ -42,4 +41,3 @@ bool(true)
bool(false)
bool(true)
bool(true)
-===Done===
diff --git a/ext/standard/tests/file/rename_variation13-win32.phpt b/ext/standard/tests/file/rename_variation13-win32.phpt
index 965a0dac25..e80acae01b 100644
--- a/ext/standard/tests/file/rename_variation13-win32.phpt
+++ b/ext/standard/tests/file/rename_variation13-win32.phpt
Binary files differ
diff --git a/ext/standard/tests/file/rename_variation13.phpt b/ext/standard/tests/file/rename_variation13.phpt
index 70ec37c7a6..3e35f179a8 100644
--- a/ext/standard/tests/file/rename_variation13.phpt
+++ b/ext/standard/tests/file/rename_variation13.phpt
@@ -32,8 +32,6 @@ $names_arr = array(
NULL,
"",
" ",
- "\0",
- array(),
/* prefix with path separator of a non existing directory*/
"/no/such/file/dir",
@@ -98,24 +96,6 @@ bool(true)
Warning: rename( ,%s/renameVar13/afile.tmp): No such file or directory in %s on line %d
bool(false)
--- testing '%s' --
-
-Warning: rename() %s in %s on line %d
-bool(false)
-
-Warning: file_exists() expects parameter 1 to be a valid path, string given in %s on line %d
-
-Warning: rename() expects parameter 1 to be a valid path, string given in %s on line %d
-bool(false)
--- testing 'Array' --
-
-Warning: rename() expects parameter 2 to be a valid path, array given in %s on line %d
-bool(false)
-
-Warning: file_exists() expects parameter 1 to be a valid path, array given in %s on line %d
-
-Warning: rename() expects parameter 1 to be a valid path, array given in %s on line %d
-bool(false)
-- testing '/no/such/file/dir' --
Warning: rename(%s/renameVar13/afile.tmp,/no/such/file/dir): No such file or directory in %s on line %d
diff --git a/ext/standard/tests/file/rename_variation3-win32.phpt b/ext/standard/tests/file/rename_variation3-win32.phpt
index b14b814295..a9e3057340 100644
--- a/ext/standard/tests/file/rename_variation3-win32.phpt
+++ b/ext/standard/tests/file/rename_variation3-win32.phpt
@@ -25,7 +25,7 @@ mkdir($dirname);
$filename = "$file_path/rename_variation3.tmp";
$fp = fopen($filename, "w");
if (!$fp) {
- die("Cannot create $filename\n");
+ die("Cannot create $filename\n");
}
fclose($fp);
diff --git a/ext/standard/tests/file/rename_variation7-win32.phpt b/ext/standard/tests/file/rename_variation7-win32.phpt
index fb7c805cbf..bf879ce7d9 100644
--- a/ext/standard/tests/file/rename_variation7-win32.phpt
+++ b/ext/standard/tests/file/rename_variation7-win32.phpt
@@ -12,7 +12,7 @@ $tmp_link = __FILE__.".tmp.link";
$tmp_link2 = __FILE__.".tmp.link2";
if (symlink(__DIR__."/there_is_no_such_file", $tmp_link)) {
- rename($tmp_link, $tmp_link2);
+ rename($tmp_link, $tmp_link2);
}
clearstatcache();
diff --git a/ext/standard/tests/file/rmdir_variation3-win32.phpt b/ext/standard/tests/file/rmdir_variation3-win32.phpt
index ac8c9dd368..ca7e88f589 100644
--- a/ext/standard/tests/file/rmdir_variation3-win32.phpt
+++ b/ext/standard/tests/file/rmdir_variation3-win32.phpt
@@ -71,7 +71,6 @@ foreach($dirs as $dir) {
rmdir($workDir);
?>
-===DONE===
--EXPECTF--
*** Testing rmdir() : variation ***
-- removing rmdirVar3.tmp\aSubDir --
@@ -105,4 +104,3 @@ Directory removed
Directory removed
-- removing /%s/rmdirVar3.tmp/aSubDir --
Directory removed
-===DONE===
diff --git a/ext/standard/tests/file/rmdir_variation3.phpt b/ext/standard/tests/file/rmdir_variation3.phpt
index 095cde0880..c0714144e5 100644
--- a/ext/standard/tests/file/rmdir_variation3.phpt
+++ b/ext/standard/tests/file/rmdir_variation3.phpt
@@ -61,7 +61,6 @@ foreach($dirs as $dir) {
rmdir($workDir);
?>
-===DONE===
--EXPECTF--
*** Testing rmdir() : variation ***
-- removing rmdirVar3.tmp/aSubDir --
@@ -93,4 +92,3 @@ Directory removed
Directory removed
-- removing %s//rmdirVar3.tmp//aSubDir --
Directory removed
-===DONE===
diff --git a/ext/standard/tests/file/stat_basic-win32-mb.phpt b/ext/standard/tests/file/stat_basic-win32-mb.phpt
index 504e0f45ea..29f1514d76 100644
--- a/ext/standard/tests/file/stat_basic-win32-mb.phpt
+++ b/ext/standard/tests/file/stat_basic-win32-mb.phpt
@@ -26,7 +26,7 @@ mkdir($dirname);
// stat of the dir created
$dir_stat = stat($dirname);
clearstatcache();
-sleep(2);
+sleep(1);
// creating file
$filename = "$dirname/stat_basic_ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.tmp";
@@ -34,7 +34,7 @@ $file_handle = fopen($filename, "w");
fclose($file_handle);
// stat of the file created
$file_stat = stat($filename);
-sleep(2);
+sleep(1);
// now new stat of the dir after file is created
$new_dir_stat = stat($dirname);
diff --git a/ext/standard/tests/file/stat_basic-win32.phpt b/ext/standard/tests/file/stat_basic-win32.phpt
index 348ac2d380..4df0064688 100644
--- a/ext/standard/tests/file/stat_basic-win32.phpt
+++ b/ext/standard/tests/file/stat_basic-win32.phpt
@@ -34,7 +34,7 @@ $file_handle = fopen($filename, "w");
fclose($file_handle);
// stat of the file created
$file_stat = stat($filename);
-sleep(2);
+sleep(1);
// now new stat of the dir after file is created
$new_dir_stat = stat($dirname);
diff --git a/ext/standard/tests/file/stat_error-win32.phpt b/ext/standard/tests/file/stat_error-win32.phpt
index 735a17cb26..3d4e367739 100644
--- a/ext/standard/tests/file/stat_error-win32.phpt
+++ b/ext/standard/tests/file/stat_error-win32.phpt
@@ -17,29 +17,16 @@ $file_path = __DIR__;
$arr = array(__FILE__);
echo "\n*** Testing stat() for error conditions ***\n";
-var_dump( stat() ); // args < expected
-var_dump( stat(__FILE__, 2) ); // file, args > expected
-var_dump( stat(__DIR__, 2) ); //dir, args > expected
var_dump( stat("$file_path/temp.tmp") ); // non existing file
var_dump( stat("$file_path/temp/") ); // non existing dir
var_dump( stat(22) ); // scalar argument
-var_dump( stat($arr) ); // array argument
echo "Done\n";
?>
--EXPECTF--
*** Testing stat() for error conditions ***
-Warning: stat() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: stat() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: stat() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
Warning: stat(): stat failed for %s in %s on line %d
bool(false)
@@ -48,7 +35,4 @@ bool(false)
Warning: stat(): stat failed for 22 in %s on line %d
bool(false)
-
-Warning: stat() expects parameter 1 to be a valid path, array given in %s on line %d
-NULL
Done
diff --git a/ext/standard/tests/file/stat_variation1-win32-mb.phpt b/ext/standard/tests/file/stat_variation1-win32-mb.phpt
index 1db467632b..002d5ac650 100644
--- a/ext/standard/tests/file/stat_variation1-win32-mb.phpt
+++ b/ext/standard/tests/file/stat_variation1-win32-mb.phpt
@@ -35,7 +35,7 @@ $old_filename = "$file_path/stat_variation1_ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™
$new_filename = "$file_path/stat_variation1a_ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.tmp";
$old_stat = stat($old_filename);
clearstatcache();
-sleep(2);
+sleep(1);
var_dump( rename($old_filename, $new_filename) );
$new_stat = stat($new_filename);
diff --git a/ext/standard/tests/file/stat_variation1-win32.phpt b/ext/standard/tests/file/stat_variation1-win32.phpt
index 26b1549e02..03d94b8898 100644
--- a/ext/standard/tests/file/stat_variation1-win32.phpt
+++ b/ext/standard/tests/file/stat_variation1-win32.phpt
@@ -35,7 +35,7 @@ $old_filename = "$file_path/stat_variation1.tmp";
$new_filename = "$file_path/stat_variation1a.tmp";
$old_stat = stat($old_filename);
clearstatcache();
-sleep(2);
+sleep(1);
var_dump( rename($old_filename, $new_filename) );
$new_stat = stat($new_filename);
diff --git a/ext/standard/tests/file/stat_variation2-win32.phpt b/ext/standard/tests/file/stat_variation2-win32.phpt
index 2d4f44bf02..66347ce2b5 100644
--- a/ext/standard/tests/file/stat_variation2-win32.phpt
+++ b/ext/standard/tests/file/stat_variation2-win32.phpt
@@ -32,7 +32,7 @@ echo "*** Testing stat(): writing to a file ***\n";
echo "-- Testing stat() on file after data is written in it --\n";
$old_stat = stat($filename);
clearstatcache();
-sleep(2);
+sleep(1);
$file_handle = fopen($filename, "w"); // temp file
fwrite($file_handle, "Hello World");
fclose($file_handle);
diff --git a/ext/standard/tests/file/stat_variation3-win32.phpt b/ext/standard/tests/file/stat_variation3-win32.phpt
index d08612fc7f..980fc56836 100644
--- a/ext/standard/tests/file/stat_variation3-win32.phpt
+++ b/ext/standard/tests/file/stat_variation3-win32.phpt
@@ -30,7 +30,7 @@ echo "-- Testing stat() on dir after subdir and file is created in it --\n";
$dirname = "$file_path/stat_variation3";
$old_stat = stat($dirname);
clearstatcache();
-sleep(2);
+sleep(1);
mkdir("$dirname/stat_variation3_subdir");
$file_handle = fopen("$dirname/stat_variation3a.tmp", "w");
fclose($file_handle);
diff --git a/ext/standard/tests/file/stat_variation4-win32.phpt b/ext/standard/tests/file/stat_variation4-win32.phpt
index a5e25f99d0..9cae39a498 100644
--- a/ext/standard/tests/file/stat_variation4-win32.phpt
+++ b/ext/standard/tests/file/stat_variation4-win32.phpt
@@ -36,7 +36,7 @@ $old_dirname = "$file_path/stat_variation4";
$old_stat = stat($old_dirname);
// clear the cache
clearstatcache();
-sleep(2);
+sleep(1);
var_dump( is_dir($old_dirname) );
$new_stat = stat($old_dirname);
diff --git a/ext/standard/tests/file/stat_variation5-win32.phpt b/ext/standard/tests/file/stat_variation5-win32.phpt
index d2c9fd4c84..47627671db 100644
--- a/ext/standard/tests/file/stat_variation5-win32.phpt
+++ b/ext/standard/tests/file/stat_variation5-win32.phpt
@@ -32,7 +32,7 @@ fclose($file_handle);
$old_stat = stat($filename);
// clear the stat
clearstatcache();
-sleep(2);
+sleep(1);
// opening file again in read mode
$file_handle = fopen($filename, "r"); // read file
fclose($file_handle);
diff --git a/ext/standard/tests/file/stat_variation6-win32.phpt b/ext/standard/tests/file/stat_variation6-win32.phpt
index 38c69f97f2..3dc7a4bac1 100644
--- a/ext/standard/tests/file/stat_variation6-win32.phpt
+++ b/ext/standard/tests/file/stat_variation6-win32.phpt
@@ -31,12 +31,13 @@ fclose($file_handle);
// checking stat() on file
-echo "\n*** Testing stat() on file with miscelleneous file permission and content ***\n";
+echo "\n*** Testing stat() on file with miscellaneous file permission and content ***\n";
+clearstatcache();
$old_stat = stat($filename);
+sleep(1);
var_dump( chmod($filename, 0777) );
// clear the stat
clearstatcache();
-sleep(2);
$new_stat = stat($filename);
// compare self stats
var_dump( compare_self_stat($old_stat) );
@@ -48,12 +49,12 @@ var_dump( compare_stats($old_stat, $new_stat, $affected_members, "==") );
clearstatcache(); // clear statement cache
// checking stat() on directory
-echo "\n*** Testing stat() on directory with miscelleneous file permission ***\n";
+echo "\n*** Testing stat() on directory with miscellaneous file permission ***\n";
$old_stat = stat($dirname);
+sleep(1);
var_dump( chmod($dirname, 0777) );
// clear the stat
clearstatcache();
-sleep(2);
$new_stat = stat($dirname);
// compare self stats
var_dump( compare_self_stat($old_stat) );
@@ -74,13 +75,13 @@ unlink("$file_path/stat_variation6.tmp");
rmdir("$file_path/stat_variation6");
?>
--EXPECT--
-*** Testing stat() on file with miscelleneous file permission and content ***
+*** Testing stat() on file with miscellaneous file permission and content ***
bool(true)
bool(true)
bool(true)
bool(true)
-*** Testing stat() on directory with miscelleneous file permission ***
+*** Testing stat() on directory with miscellaneous file permission ***
bool(true)
bool(true)
bool(true)
diff --git a/ext/standard/tests/file/stat_variation8-win32.phpt b/ext/standard/tests/file/stat_variation8-win32.phpt
index 7a0cf65d41..c86ba3206e 100644
--- a/ext/standard/tests/file/stat_variation8-win32.phpt
+++ b/ext/standard/tests/file/stat_variation8-win32.phpt
@@ -37,7 +37,7 @@ fclose($file_handle);
clearstatcache(true, $filename);
$old_stat = stat($filename);
// clear the cache
-sleep(2);
+sleep(1);
// opening file in r/w mode
$file_handle = fopen($filename, "r+");
diff --git a/ext/standard/tests/file/stream_001.phpt b/ext/standard/tests/file/stream_001.phpt
index 6e692c554a..6a203c6772 100644
--- a/ext/standard/tests/file/stream_001.phpt
+++ b/ext/standard/tests/file/stream_001.phpt
@@ -17,7 +17,7 @@ Warning: fopen(): Unable to find the wrapper "file" - did you forget to enable i
Warning: fopen(): file:// wrapper is disabled in the server configuration in %s on line %d
-Warning: fopen(file://%s): failed to open stream: no suitable wrapper could be found in %s on line %d
+Warning: fopen(file://%s): Failed to open stream: no suitable wrapper could be found in %s on line %d
bool(false)
bool(true)
resource(%d) of type (stream)
diff --git a/ext/standard/tests/file/stream_002.phpt b/ext/standard/tests/file/stream_002.phpt
index b18dd85b31..4aab2240ee 100644
--- a/ext/standard/tests/file/stream_002.phpt
+++ b/ext/standard/tests/file/stream_002.phpt
@@ -15,38 +15,31 @@ var_dump(stream_socket_client(".", $a, $b));
var_dump($a, $b);
var_dump(stream_socket_client(1, $a, $b));
var_dump($a, $b);
-var_dump(stream_socket_client(array(), $a, $b));
-var_dump($a, $b);
echo "Done\n";
?>
--EXPECTF--
-Warning: stream_socket_client(): unable to connect to (Failed to parse address "") in %s on line %d
+Warning: stream_socket_client(): Unable to connect to (Failed to parse address "") in %s on line %d
bool(false)
int(0)
string(26) "Failed to parse address """
-Warning: stream_socket_client(): unable to connect to [ (Failed to parse address "[") in %s on line %d
+Warning: stream_socket_client(): Unable to connect to [ (Failed to parse address "[") in %s on line %d
bool(false)
int(0)
string(27) "Failed to parse address "[""
-Warning: stream_socket_client(): unable to connect to [ (Failed to parse%saddress "[ ") in %s on line %d
+Warning: stream_socket_client(): Unable to connect to [ (Failed to parse%saddress "[ ") in %s on line %d
bool(false)
int(0)
string(%d) "Failed to parse%saddress "[ ""
-Warning: stream_socket_client(): unable to connect to . (Failed to parse address ".") in %s on line %d
+Warning: stream_socket_client(): Unable to connect to . (Failed to parse address ".") in %s on line %d
bool(false)
int(0)
string(27) "Failed to parse address ".""
-Warning: stream_socket_client(): unable to connect to 1 (Failed to parse address "1") in %s on line %d
-bool(false)
-int(0)
-string(27) "Failed to parse address "1""
-
-Warning: stream_socket_client() expects parameter 1 to be string, array given in %s on line %d
+Warning: stream_socket_client(): Unable to connect to 1 (Failed to parse address "1") in %s on line %d
bool(false)
int(0)
string(27) "Failed to parse address "1""
diff --git a/ext/standard/tests/file/stream_get_line.phpt b/ext/standard/tests/file/stream_get_line.phpt
index 9421bd44c1..773efd2c88 100644
--- a/ext/standard/tests/file/stream_get_line.phpt
+++ b/ext/standard/tests/file/stream_get_line.phpt
@@ -7,7 +7,7 @@ $path = __DIR__ . '/test.html';
file_put_contents($path, "foo<br>bar<br>foo");
$fp = fopen($path, "r");
while ($fp && !feof($fp)) {
- echo stream_get_line($fp, 0, "<br>")."\n";
+ echo stream_get_line($fp, 0, "<br>")."\n";
}
fclose($fp);
@unlink($path);
diff --git a/ext/standard/tests/file/stream_rfc2397_001.phpt b/ext/standard/tests/file/stream_rfc2397_001.phpt
index d88e778623..3036620eb5 100644
--- a/ext/standard/tests/file/stream_rfc2397_001.phpt
+++ b/ext/standard/tests/file/stream_rfc2397_001.phpt
@@ -15,8 +15,6 @@ unset($data);
var_dump(stream_get_contents($file));
?>
-===DONE===
--EXPECT--
string(11) "hello world"
string(11) "hello world"
-===DONE===
diff --git a/ext/standard/tests/file/stream_rfc2397_002.phpt b/ext/standard/tests/file/stream_rfc2397_002.phpt
index 1dce5adf6c..d145456fdb 100644
--- a/ext/standard/tests/file/stream_rfc2397_002.phpt
+++ b/ext/standard/tests/file/stream_rfc2397_002.phpt
@@ -6,32 +6,32 @@ allow_url_fopen=1
<?php
$streams = array(
- 'data://,',
- 'data://',
- 'data://;base64,',
- 'data://;base64',
- 'data://foo,',
- 'data://foo=bar,',
- 'data://text/plain,',
- 'data://text/plain;foo,',
- 'data://text/plain;foo=bar,',
- 'data://text/plain;foo=bar;bla,',
- 'data://text/plain;foo=bar;base64,',
- 'data://text/plain;foo=bar;bar=baz',
- 'data://text/plain;foo=bar;bar=baz,',
- );
+ 'data://,',
+ 'data://',
+ 'data://;base64,',
+ 'data://;base64',
+ 'data://foo,',
+ 'data://foo=bar,',
+ 'data://text/plain,',
+ 'data://text/plain;foo,',
+ 'data://text/plain;foo=bar,',
+ 'data://text/plain;foo=bar;bla,',
+ 'data://text/plain;foo=bar;base64,',
+ 'data://text/plain;foo=bar;bar=baz',
+ 'data://text/plain;foo=bar;bar=baz,',
+ );
foreach($streams as $stream)
{
- $stream = fopen($stream, 'r');
- $meta = @stream_get_meta_data($stream);
- var_dump($meta);
- var_dump(isset($meta['foo']) ? $meta['foo'] : null);
+ $stream = fopen($stream, 'r');
+ if ($stream) {
+ $meta = stream_get_meta_data($stream);
+ var_dump($meta);
+ var_dump(isset($meta['foo']) ? $meta['foo'] : null);
+ }
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
array(7) {
["base64"]=>
@@ -51,9 +51,7 @@ array(7) {
}
NULL
-Warning: fopen(data://): failed to open stream: rfc2397: no comma in URL in %sstream_rfc2397_002.php on line %d
-NULL
-NULL
+Warning: fopen(data://): Failed to open stream: rfc2397: no comma in URL in %sstream_rfc2397_002.php on line %d
array(7) {
["base64"]=>
bool(true)
@@ -72,17 +70,11 @@ array(7) {
}
NULL
-Warning: fopen(data://;base64): failed to open stream: rfc2397: no comma in URL in %sstream_rfc2397_002.php on line %d
-NULL
-NULL
+Warning: fopen(data://;base64): Failed to open stream: rfc2397: no comma in URL in %sstream_rfc2397_002.php on line %d
-Warning: fopen(data://foo,): failed to open stream: rfc2397: illegal media type in %sstream_rfc2397_002.php on line %d
-NULL
-NULL
+Warning: fopen(data://foo,): Failed to open stream: rfc2397: illegal media type in %sstream_rfc2397_002.php on line %d
-Warning: fopen(data://foo=bar,): failed to open stream: rfc2397: illegal media type in %sstream_rfc2397_002.php on line %d
-NULL
-NULL
+Warning: fopen(data://foo=bar,): Failed to open stream: rfc2397: illegal media type in %sstream_rfc2397_002.php on line %d
array(8) {
["mediatype"]=>
string(10) "text/plain"
@@ -103,9 +95,7 @@ array(8) {
}
NULL
-Warning: fopen(data://text/plain;foo,): failed to open stream: rfc2397: illegal parameter in %sstream_rfc2397_002.php on line %d
-NULL
-NULL
+Warning: fopen(data://text/plain;foo,): Failed to open stream: rfc2397: illegal parameter in %sstream_rfc2397_002.php on line %d
array(9) {
["mediatype"]=>
string(10) "text/plain"
@@ -128,9 +118,7 @@ array(9) {
}
string(3) "bar"
-Warning: fopen(data://text/plain;foo=bar;bla,): failed to open stream: rfc2397: illegal parameter in %sstream_rfc2397_002.php on line %d
-NULL
-NULL
+Warning: fopen(data://text/plain;foo=bar;bla,): Failed to open stream: rfc2397: illegal parameter in %sstream_rfc2397_002.php on line %d
array(9) {
["mediatype"]=>
string(10) "text/plain"
@@ -153,9 +141,7 @@ array(9) {
}
string(3) "bar"
-Warning: fopen(data://text/plain;foo=bar;bar=baz): failed to open stream: rfc2397: no comma in URL in %sstream_rfc2397_002.php on line %d
-NULL
-NULL
+Warning: fopen(data://text/plain;foo=bar;bar=baz): Failed to open stream: rfc2397: no comma in URL in %sstream_rfc2397_002.php on line %d
array(10) {
["mediatype"]=>
string(10) "text/plain"
@@ -179,4 +165,3 @@ array(10) {
string(34) "data://text/plain;foo=bar;bar=baz,"
}
string(3) "bar"
-===DONE===
diff --git a/ext/standard/tests/file/stream_rfc2397_003.phpt b/ext/standard/tests/file/stream_rfc2397_003.phpt
index 291b1301c5..a1437a04bb 100644
--- a/ext/standard/tests/file/stream_rfc2397_003.phpt
+++ b/ext/standard/tests/file/stream_rfc2397_003.phpt
@@ -6,33 +6,30 @@ allow_url_fopen=1
<?php
$streams = array(
- 'data://,A%20brief%20note',
- 'data://application/vnd-xxx-query,select_vcount,fcol_from_fieldtable/local',
- 'data://;base64,Zm9vYmFyIGZvb2Jhcg==',
- 'stream_rfc2397_003.gif' => 'data://image/gif;base64,R0lGODdhMAAwAPAAAAAAAP///ywAAAAAMAAw
+ 'data://,A%20brief%20note',
+ 'data://application/vnd-xxx-query,select_vcount,fcol_from_fieldtable/local',
+ 'data://;base64,Zm9vYmFyIGZvb2Jhcg==',
+ 'stream_rfc2397_003.gif' => 'data://image/gif;base64,R0lGODdhMAAwAPAAAAAAAP///ywAAAAAMAAw
AAAC8IyPqcvt3wCcDkiLc7C0qwyGHhSWpjQu5yqmCYsapyuvUUlvONmOZtfzgFz
ByTB10QgxOR0TqBQejhRNzOfkVJ+5YiUqrXF5Y5lKh/DeuNcP5yLWGsEbtLiOSp
a/TPg7JpJHxyendzWTBfX0cxOnKPjgBzi4diinWGdkF8kjdfnycQZXZeYGejmJl
ZeGl9i2icVqaNVailT6F5iJ90m6mvuTS4OK05M0vDk0Q4XUtwvKOzrcd3iq9uis
F81M1OIcR7lEewwcLp7tuNNkM3uNna3F2JQFo97Vriy/Xl4/f1cf5VWzXyym7PH
hhx4dbgYKAAA7',
- );
+ );
foreach($streams as $original => $stream)
{
- if (is_string($original)) {
- var_dump(file_get_contents(__DIR__ . '/' . $original) == file_get_contents($stream));
- } else {
- var_dump(file_get_contents($stream));
- }
+ if (is_string($original)) {
+ var_dump(file_get_contents(__DIR__ . '/' . $original) == file_get_contents($stream));
+ } else {
+ var_dump(file_get_contents($stream));
+ }
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
string(12) "A brief note"
string(40) "select_vcount,fcol_from_fieldtable/local"
string(13) "foobar foobar"
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/stream_rfc2397_004.phpt b/ext/standard/tests/file/stream_rfc2397_004.phpt
index 4c13a5f9cd..cb7012f650 100644
--- a/ext/standard/tests/file/stream_rfc2397_004.phpt
+++ b/ext/standard/tests/file/stream_rfc2397_004.phpt
@@ -6,22 +6,20 @@ allow_url_fopen=1
<?php
$streams = array(
- 'data://,;test',
- 'data://text/plain,test',
- 'data://text/plain;charset=US-ASCII,test',
- 'data://;charset=UTF-8,Hello',
- 'data://text/plain;charset=UTF-8,Hello',
- 'data://,a,b',
- );
+ 'data://,;test',
+ 'data://text/plain,test',
+ 'data://text/plain;charset=US-ASCII,test',
+ 'data://;charset=UTF-8,Hello',
+ 'data://text/plain;charset=UTF-8,Hello',
+ 'data://,a,b',
+ );
foreach($streams as $stream)
{
- var_dump(@file_get_contents($stream));
+ var_dump(@file_get_contents($stream));
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
string(5) ";test"
string(4) "test"
@@ -29,4 +27,3 @@ string(4) "test"
bool(false)
string(5) "Hello"
string(3) "a,b"
-===DONE===
diff --git a/ext/standard/tests/file/stream_rfc2397_005.phpt b/ext/standard/tests/file/stream_rfc2397_005.phpt
index ab03f399f3..38c0f4b77e 100644
--- a/ext/standard/tests/file/stream_rfc2397_005.phpt
+++ b/ext/standard/tests/file/stream_rfc2397_005.phpt
@@ -6,25 +6,23 @@ allow_url_fopen=1
<?php
$streams = array(
- 'data:,A%20brief%20note',
- 'data:application/vnd-xxx-query,select_vcount,fcol_from_fieldtable/local',
- 'data:;base64,Zm9vYmFyIGZvb2Jhcg==',
- 'data:,;test',
- 'data:text/plain,test',
- 'data:text/plain;charset=US-ASCII,test',
- 'data:;charset=UTF-8,Hello',
- 'data:text/plain;charset=UTF-8,Hello',
- 'data:,a,b',
- );
+ 'data:,A%20brief%20note',
+ 'data:application/vnd-xxx-query,select_vcount,fcol_from_fieldtable/local',
+ 'data:;base64,Zm9vYmFyIGZvb2Jhcg==',
+ 'data:,;test',
+ 'data:text/plain,test',
+ 'data:text/plain;charset=US-ASCII,test',
+ 'data:;charset=UTF-8,Hello',
+ 'data:text/plain;charset=UTF-8,Hello',
+ 'data:,a,b',
+ );
foreach($streams as $stream)
{
- var_dump(@file_get_contents($stream));
+ var_dump(@file_get_contents($stream));
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
string(12) "A brief note"
string(40) "select_vcount,fcol_from_fieldtable/local"
@@ -35,4 +33,3 @@ string(4) "test"
bool(false)
string(5) "Hello"
string(3) "a,b"
-===DONE===
diff --git a/ext/standard/tests/file/stream_rfc2397_006.phpt b/ext/standard/tests/file/stream_rfc2397_006.phpt
index f6616a0c88..2c8b8fd720 100644
--- a/ext/standard/tests/file/stream_rfc2397_006.phpt
+++ b/ext/standard/tests/file/stream_rfc2397_006.phpt
@@ -6,30 +6,28 @@ allow_url_fopen=1
<?php
$streams = array(
- "data:;base64,\0Zm9vYmFyIGZvb2Jhcg==",
- "data:;base64,Zm9vYmFy\0IGZvb2Jhcg==",
- 'data:;base64,#Zm9vYmFyIGZvb2Jhcg==',
- 'data:;base64,#Zm9vYmFyIGZvb2Jhc=',
- );
+ "data:;base64,\0Zm9vYmFyIGZvb2Jhcg==",
+ "data:;base64,Zm9vYmFy\0IGZvb2Jhcg==",
+ 'data:;base64,#Zm9vYmFyIGZvb2Jhcg==',
+ 'data:;base64,#Zm9vYmFyIGZvb2Jhc=',
+ );
foreach($streams as $stream)
{
- var_dump(file_get_contents($stream));
+ try {
+ var_dump(file_get_contents($stream));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
-Warning: file_get_contents() expects parameter 1 to be a valid path, string given in %s line %d
-NULL
+file_get_contents() expects parameter 1 to be a valid path, string given
+file_get_contents() expects parameter 1 to be a valid path, string given
-Warning: file_get_contents() expects parameter 1 to be a valid path, string given in %s line %d
-NULL
-
-Warning: file_get_contents(data:;base64,#Zm9vYmFyIGZvb2Jhcg==): failed to open stream: rfc2397: unable to decode in %sstream_rfc2397_006.php on line %d
+Warning: file_get_contents(data:;base64,#Zm9vYmFyIGZvb2Jhcg==): Failed to open stream: rfc2397: unable to decode in %sstream_rfc2397_006.php on line %d
bool(false)
-Warning: file_get_contents(data:;base64,#Zm9vYmFyIGZvb2Jhc=): failed to open stream: rfc2397: unable to decode in %sstream_rfc2397_006.php on line %d
+Warning: file_get_contents(data:;base64,#Zm9vYmFyIGZvb2Jhc=): Failed to open stream: rfc2397: unable to decode in %sstream_rfc2397_006.php on line %d
bool(false)
-===DONE===
diff --git a/ext/standard/tests/file/stream_rfc2397_007.phpt b/ext/standard/tests/file/stream_rfc2397_007.phpt
index 447b0246ae..56d9162157 100644
--- a/ext/standard/tests/file/stream_rfc2397_007.phpt
+++ b/ext/standard/tests/file/stream_rfc2397_007.phpt
@@ -6,81 +6,79 @@ allow_url_fopen=1
<?php
$streams = array(
- "data:,012345",
- );
+ "data:,012345",
+ );
foreach($streams as $stream)
{
- echo "===$stream===\n";
+ echo "===$stream===\n";
- $fp = fopen($stream, 'rb');
+ $fp = fopen($stream, 'rb');
- var_dump(ftell($fp));
- var_dump(feof($fp));
- echo "===S:4,S===\n";
- var_dump(fseek($fp, 4));
- var_dump(ftell($fp));
- var_dump(feof($fp));
- echo "===GETC===\n";
- var_dump(fgetc($fp));
- var_dump(ftell($fp));
- var_dump(feof($fp));
- echo "===GETC===\n";
- var_dump(fgetc($fp));
- var_dump(fgetc($fp));
- var_dump(ftell($fp));
- var_dump(feof($fp));
- echo "===REWIND===\n";
- var_dump(rewind($fp));
- var_dump(ftell($fp));
- var_dump(feof($fp));
- echo "===GETC===\n";
- var_dump(fgetc($fp));
- var_dump(ftell($fp));
- var_dump(feof($fp));
- echo "===S:3,S===\n";
- var_dump(fseek($fp, 3, SEEK_SET));
- var_dump(ftell($fp));
- var_dump(feof($fp));
- echo "===S:1,C===\n";
- var_dump(fseek($fp, 1, SEEK_CUR));
- var_dump(ftell($fp));
- var_dump(feof($fp));
- echo "===S:-2,C===\n";
- var_dump(fseek($fp, -2, SEEK_CUR));
- var_dump(ftell($fp));
- var_dump(feof($fp));
- echo "===S:-10,C===\n";
- var_dump(fseek($fp, -10, SEEK_CUR));
- var_dump(ftell($fp));
- var_dump(feof($fp));
- echo "===S:3,S===\n";
- var_dump(fseek($fp, 3, SEEK_SET));
- var_dump(ftell($fp));
- var_dump(feof($fp));
- echo "===S:10,C===\n";
- var_dump(fseek($fp, 10, SEEK_CUR));
- var_dump(ftell($fp));
- var_dump(feof($fp));
- echo "===S:-1,E===\n";
- var_dump(fseek($fp, -1, SEEK_END));
- var_dump(ftell($fp));
- var_dump(feof($fp));
- echo "===S:0,E===\n";
- var_dump(fseek($fp, 0, SEEK_END));
- var_dump(ftell($fp));
- var_dump(feof($fp));
- echo "===S:1,E===\n";
- var_dump(fseek($fp, 1, SEEK_END));
- var_dump(ftell($fp));
- var_dump(feof($fp));
+ var_dump(ftell($fp));
+ var_dump(feof($fp));
+ echo "===S:4,S===\n";
+ var_dump(fseek($fp, 4));
+ var_dump(ftell($fp));
+ var_dump(feof($fp));
+ echo "===GETC===\n";
+ var_dump(fgetc($fp));
+ var_dump(ftell($fp));
+ var_dump(feof($fp));
+ echo "===GETC===\n";
+ var_dump(fgetc($fp));
+ var_dump(fgetc($fp));
+ var_dump(ftell($fp));
+ var_dump(feof($fp));
+ echo "===REWIND===\n";
+ var_dump(rewind($fp));
+ var_dump(ftell($fp));
+ var_dump(feof($fp));
+ echo "===GETC===\n";
+ var_dump(fgetc($fp));
+ var_dump(ftell($fp));
+ var_dump(feof($fp));
+ echo "===S:3,S===\n";
+ var_dump(fseek($fp, 3, SEEK_SET));
+ var_dump(ftell($fp));
+ var_dump(feof($fp));
+ echo "===S:1,C===\n";
+ var_dump(fseek($fp, 1, SEEK_CUR));
+ var_dump(ftell($fp));
+ var_dump(feof($fp));
+ echo "===S:-2,C===\n";
+ var_dump(fseek($fp, -2, SEEK_CUR));
+ var_dump(ftell($fp));
+ var_dump(feof($fp));
+ echo "===S:-10,C===\n";
+ var_dump(fseek($fp, -10, SEEK_CUR));
+ var_dump(ftell($fp));
+ var_dump(feof($fp));
+ echo "===S:3,S===\n";
+ var_dump(fseek($fp, 3, SEEK_SET));
+ var_dump(ftell($fp));
+ var_dump(feof($fp));
+ echo "===S:10,C===\n";
+ var_dump(fseek($fp, 10, SEEK_CUR));
+ var_dump(ftell($fp));
+ var_dump(feof($fp));
+ echo "===S:-1,E===\n";
+ var_dump(fseek($fp, -1, SEEK_END));
+ var_dump(ftell($fp));
+ var_dump(feof($fp));
+ echo "===S:0,E===\n";
+ var_dump(fseek($fp, 0, SEEK_END));
+ var_dump(ftell($fp));
+ var_dump(feof($fp));
+ echo "===S:1,E===\n";
+ var_dump(fseek($fp, 1, SEEK_END));
+ var_dump(ftell($fp));
+ var_dump(feof($fp));
- fclose($fp);
+ fclose($fp);
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
===data:,012345===
int(0)
@@ -142,4 +140,3 @@ bool(false)
int(-1)
bool(false)
bool(false)
-===DONE===
diff --git a/ext/standard/tests/file/stream_supports_lock.phpt b/ext/standard/tests/file/stream_supports_lock.phpt
index 38a84dd7c2..0d2f04b72d 100644
--- a/ext/standard/tests/file/stream_supports_lock.phpt
+++ b/ext/standard/tests/file/stream_supports_lock.phpt
@@ -26,7 +26,11 @@ fclose($fp);
$sock = stream_context_create();
var_dump($sock);
-var_dump(stream_supports_lock($sock));
+try {
+ var_dump(stream_supports_lock($sock));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done\n";
?>
@@ -40,7 +44,5 @@ bool(false)
resource(%d) of type (stream)
bool(false)
resource(%d) of type (stream-context)
-
-Warning: stream_supports_lock(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+stream_supports_lock(): supplied resource is not a valid stream resource
Done
diff --git a/ext/standard/tests/file/symlink_link_linkinfo_is_link_error1.phpt b/ext/standard/tests/file/symlink_link_linkinfo_is_link_error1.phpt
index ddee40ecdd..6ee0f8aca7 100644
--- a/ext/standard/tests/file/symlink_link_linkinfo_is_link_error1.phpt
+++ b/ext/standard/tests/file/symlink_link_linkinfo_is_link_error1.phpt
@@ -33,11 +33,6 @@ fclose($fp);
$linkname = __DIR__."/symlink_link_linkinfo_is_link_link_error1.tmp";
echo "*** Testing symlink() for error conditions ***\n";
-//zero arguments
-var_dump( symlink() );
-
-//more than expected
-var_dump( symlink($filename, $linkname, true) );
//invalid arguments
var_dump( symlink(NULL, $linkname) ); // NULL as filename
@@ -48,11 +43,6 @@ var_dump( symlink($filename, '') ); // '' as linkname
var_dump( symlink($filename, false) ); // false as linkname
echo "\n*** Testing linkinfo() for error conditions ***\n";
-//zero arguments
-var_dump( linkinfo() );
-
-//more than expected
-var_dump( linkinfo($linkname, true) );
//invalid arguments
var_dump( linkinfo(NULL) ); // NULL as linkname
@@ -69,12 +59,6 @@ unlink(__DIR__."/symlink_link_linkinfo_is_link_error1.tmp");
--EXPECTF--
*** Testing symlink() for error conditions ***
-Warning: symlink() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: symlink() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
Warning: symlink(): %s in %s on line %d
bool(false)
@@ -95,12 +79,6 @@ bool(false)
*** Testing linkinfo() for error conditions ***
-Warning: linkinfo() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: linkinfo() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
Warning: linkinfo(): %s in %s on line %d
int(-1)
diff --git a/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt b/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt
index 7e22741aa8..287ac4eb5f 100644
--- a/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt
+++ b/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt
@@ -30,11 +30,6 @@ fclose($fp);
$linkname = __DIR__."/symlink_link_linkinfo_is_link_link_error2.tmp";
echo "*** Testing link() for error conditions ***\n";
-//zero arguments
-var_dump( link() );
-
-//more than expected
-var_dump( link($filename, $linkname, false) );
//invalid arguments
var_dump( link(NULL, $linkname) ); // NULL as filename
@@ -46,11 +41,6 @@ var_dump( link($filename, '') ); // '' as linkname
var_dump( link($filename, false) ); // false as linkname
echo "\n*** Testing is_link() for error conditions ***\n";
-//zero arguments
-var_dump( is_link() );
-
-//more than expected
-var_dump( is_link($linkname, "/") );
//invalid arguments
var_dump( is_link(NULL) ); // NULL as linkname
@@ -68,12 +58,6 @@ unlink(__DIR__."/symlink_link_linkinfo_is_link_error2.tmp");
--EXPECTF--
*** Testing link() for error conditions ***
-Warning: link() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: link() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
Warning: link(): No such file or directory in %s on line %d
bool(false)
@@ -96,12 +80,6 @@ Warning: link(): No such file or directory in %s on line %d
bool(false)
*** Testing is_link() for error conditions ***
-
-Warning: is_link() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: is_link() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
bool(false)
bool(false)
bool(false)
diff --git a/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation9.phpt b/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation9.phpt
index 04daa591b0..a2a42a3d90 100644
--- a/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation9.phpt
+++ b/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation9.phpt
@@ -50,7 +50,7 @@ echo "lstat() returns lstat['dev'] as $s1[0]\n";
if( $s1[0] == $linkinfo )
echo "\nlinkinfo() value matches lstat['dev']\n";
else
- echo "\nWarning: linkinfo() value doesnt match lstat['dev']\n";
+ echo "\nWarning: linkinfo() value doesn't match lstat['dev']\n";
// delete link
unlink($soft_link);
@@ -65,7 +65,7 @@ echo "lstat() returns lstat['dev'] as $s1[0]\n";
if( $s1[0] == $linkinfo )
echo "\nlinkinfo() value matches lstat['dev']\n";
else
- echo "\nWarning: linkinfo() value doesnt match lstat['dev']\n";
+ echo "\nWarning: linkinfo() value doesn't match lstat['dev']\n";
// delete link
unlink($hard_link);
@@ -82,7 +82,7 @@ echo "lstat() returns lstat['dev'] as $s1[0]\n";
if( $s1[0] == $linkinfo )
echo "\nlinkinfo() value matches lstat['dev']\n";
else
- echo "\nWarning: linkinfo() value doesnt match lstat['dev']\n";
+ echo "\nWarning: linkinfo() value doesn't match lstat['dev']\n";
// delete link
unlink($soft_link);
diff --git a/ext/standard/tests/file/tempnam_variation3-win32.phpt b/ext/standard/tests/file/tempnam_variation3-win32.phpt
index bade05ac87..3311b0bc7c 100644
--- a/ext/standard/tests/file/tempnam_variation3-win32.phpt
+++ b/ext/standard/tests/file/tempnam_variation3-win32.phpt
@@ -18,71 +18,76 @@ obscure_filename
echo "*** Testing tempnam() with obscure prefixes ***\n";
$file_path = __DIR__."/tempnamVar3";
if (!mkdir($file_path)) {
- echo "Failed, cannot create temp dir $filepath\n";
- exit(1);
+ echo "Failed, cannot create temp dir $filepath\n";
+ exit(1);
}
$file_path = realpath($file_path);
/* An array of prefixes */
$names_arr = array(
- /* Valid args (casting)*/
- -1,
- TRUE,
- FALSE,
- NULL,
- "",
- " ",
- "\0",
- /* Invalid args */
- array(),
+ /* Valid args (casting)*/
+ -1,
+ TRUE,
+ FALSE,
+ NULL,
+ "",
+ " ",
+ "\0",
+ /* Invalid args */
+ array(),
- /* Valid args*/
- /* prefix with path separator of a non existing directory*/
- "/no/such/file/dir",
- "php/php"
+ /* Valid args*/
+ /* prefix with path separator of a non existing directory*/
+ "/no/such/file/dir",
+ "php/php"
);
$res_arr = array(
- /* Invalid args */
- true,
- true,
- true,
- true,
- true,
- true,
- true,
- false,
+ /* Invalid args */
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
+ false,
- /* prefix with path separator of a non existing directory*/
- true,
- true
+ /* prefix with path separator of a non existing directory*/
+ true,
+ true
);
for( $i=0; $i<count($names_arr); $i++ ) {
- echo "-- Iteration $i --\n";
- $file_name = tempnam($file_path, $names_arr[$i]);
+ echo "-- Iteration $i --\n";
+ try {
+ $file_name = tempnam($file_path, $names_arr[$i]);
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ continue;
+ }
- /* creating the files in existing dir */
- if (file_exists($file_name) && !$res_arr[$i]) {
- echo "Failed\n";
- }
- if ($res_arr[$i]) {
- $file_dir = dirname($file_name);
- if (realpath($file_dir) == $file_path || realpath($file_dir . "\\") == $file_path) {
- echo "OK\n";
- } else {
- echo "Failed, not created in the correct directory " . realpath($file_dir) . ' vs ' . $file_path ."\n";
- }
+ /* creating the files in existing dir */
+ if (file_exists($file_name) && !$res_arr[$i]) {
+ echo "Failed\n";
+ }
+ if ($res_arr[$i]) {
+ $file_dir = dirname($file_name);
+ if (realpath($file_dir) == $file_path || realpath($file_dir . "\\") == $file_path) {
+ echo "OK\n";
+ } else {
+ echo "Failed, not created in the correct directory " . realpath($file_dir) . ' vs ' . $file_path ."\n";
+ }
- if (!is_writable($file_name)) {
- printf("%o\n", fileperms($file_name) );
+ if (!is_writable($file_name)) {
+ printf("%o\n", fileperms($file_name) );
- }
- } else {
- echo "OK\n";
- }
- @unlink($file_name);
+ }
+ } else {
+ echo "OK\n";
+ }
+ @unlink($file_name);
}
rmdir($file_path);
@@ -105,14 +110,9 @@ Notice: tempnam(): file created in the system's temporary directory in %stempnam
Failed, not created in the correct directory %s vs %s
0
-- Iteration 6 --
-
-Warning: tempnam() expects parameter 2 to be a valid path, string given in %stempnam_variation3-win32.php on line 54
-Failed, not created in the correct directory %s vs %sext\standard\tests\file\tempnamVar3
-0
+tempnam() expects parameter 2 to be a valid path, string given
-- Iteration 7 --
-
-Warning: tempnam() expects parameter 2 to be a valid path, array given in %s\ext\standard\tests\file\tempnam_variation3-win32.php on line %d
-OK
+tempnam() expects parameter 2 to be a valid path, array given
-- Iteration 8 --
OK
-- Iteration 9 --
diff --git a/ext/standard/tests/file/tempnam_variation3.phpt b/ext/standard/tests/file/tempnam_variation3.phpt
index 55db89cc72..78ef3bbaca 100644
--- a/ext/standard/tests/file/tempnam_variation3.phpt
+++ b/ext/standard/tests/file/tempnam_variation3.phpt
@@ -39,7 +39,12 @@ $names_arr = array(
for( $i=0; $i<count($names_arr); $i++ ) {
echo "-- Iteration $i --\n";
- $file_name = tempnam("$file_path", $names_arr[$i]);
+ try {
+ $file_name = tempnam("$file_path", $names_arr[$i]);
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ continue;
+ }
/* creating the files in existing dir */
if( file_exists($file_name) ) {
@@ -101,17 +106,9 @@ File name is => %s/%s
File permissions are => 100600
File created in => directory specified
-- Iteration 6 --
-
-Warning: tempnam() expects parameter 2 to be a valid path, string given in %s on line %d
--- File is not created --
-
-Warning: unlink(): %s in %s on line %d
+tempnam() expects parameter 2 to be a valid path, string given
-- Iteration 7 --
-
-Warning: tempnam() expects parameter 2 to be a valid path, array given in %s on line %d
--- File is not created --
-
-Warning: unlink(): %s in %s on line %d
+tempnam() expects parameter 2 to be a valid path, array given
-- Iteration 8 --
File name is => %s/dir%s
File permissions are => 100600
diff --git a/ext/standard/tests/file/tempnam_variation7-win32.phpt b/ext/standard/tests/file/tempnam_variation7-win32.phpt
index 9ad75f8ed5..26ccaef84d 100644
--- a/ext/standard/tests/file/tempnam_variation7-win32.phpt
+++ b/ext/standard/tests/file/tempnam_variation7-win32.phpt
@@ -19,47 +19,52 @@ obscure_filename
echo "*** Testing tempnam() with invalid/non-existing directory names ***\n";
/* An array of names, which will be passed as a dir name */
$names_arr = array(
- /* Invalid args */
- -1,
- TRUE,
- FALSE,
- NULL,
- "",
- " ",
- "\0",
- array(),
-
- /* Non-existing dirs */
- "/no/such/file/dir",
- "php"
+ /* Invalid args */
+ -1,
+ TRUE,
+ FALSE,
+ NULL,
+ "",
+ " ",
+ "\0",
+ array(),
+
+ /* Non-existing dirs */
+ "/no/such/file/dir",
+ "php"
);
for( $i=0; $i<count($names_arr); $i++ ) {
- echo "-- Iteration $i --\n";
- $file_name = tempnam($names_arr[$i], "tempnam_variation3.tmp");
-
- if( file_exists($file_name) ){
-
- echo "File name is => ";
- print($file_name);
- echo "\n";
-
- echo "File permissions are => ";
- printf("%o", fileperms($file_name) );
- echo "\n";
-
- echo "File created in => ";
- $file_dir = dirname($file_name);
- if (realpath($file_dir) == realpath(sys_get_temp_dir()) || realpath($file_dir."\\") == realpath(sys_get_temp_dir())) {
- echo "temp dir\n";
- } else {
- echo "unknown location\n";
- }
- } else {
- echo "-- File is not created --\n";
- }
-
- unlink($file_name);
+ echo "-- Iteration $i --\n";
+ try {
+ $file_name = tempnam($names_arr[$i], "tempnam_variation3.tmp");
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ continue;
+ }
+
+ if( file_exists($file_name) ){
+
+ echo "File name is => ";
+ print($file_name);
+ echo "\n";
+
+ echo "File permissions are => ";
+ printf("%o", fileperms($file_name) );
+ echo "\n";
+
+ echo "File created in => ";
+ $file_dir = dirname($file_name);
+ if (realpath($file_dir) == realpath(sys_get_temp_dir()) || realpath($file_dir."\\") == realpath(sys_get_temp_dir())) {
+ echo "temp dir\n";
+ } else {
+ echo "unknown location\n";
+ }
+ } else {
+ echo "-- File is not created --\n";
+ }
+
+ unlink($file_name);
}
?>
--EXPECTF--
@@ -95,17 +100,9 @@ File name is => %s%et%s
File permissions are => 100666
File created in => temp dir
-- Iteration 6 --
-
-Warning: tempnam() expects parameter 1 to be a valid path, string given in %stempnam_variation7-win32.php on line %d
--- File is not created --
-
-Warning: unlink(): %r(Invalid argument|No such file or directory)%r in %s on line %d
+tempnam() expects parameter 1 to be a valid path, string given
-- Iteration 7 --
-
-Warning: tempnam() expects parameter 1 to be a valid path, array given in %s on line %d
--- File is not created --
-
-Warning: unlink(): %r(Invalid argument|No such file or directory)%r in %s on line %d
+tempnam() expects parameter 1 to be a valid path, array given
-- Iteration 8 --
Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7-win32.php on line %d
diff --git a/ext/standard/tests/file/tempnam_variation7.phpt b/ext/standard/tests/file/tempnam_variation7.phpt
index 289fe82375..a385fe43b6 100644
--- a/ext/standard/tests/file/tempnam_variation7.phpt
+++ b/ext/standard/tests/file/tempnam_variation7.phpt
@@ -37,7 +37,12 @@ $names_arr = array(
for( $i=0; $i<count($names_arr); $i++ ) {
echo "-- Iteration $i --\n";
- $file_name = tempnam($names_arr[$i], "tempnam_variation3.tmp");
+ try {
+ $file_name = tempnam($names_arr[$i], "tempnam_variation3.tmp");
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ continue;
+ }
if( file_exists($file_name) ){
@@ -100,17 +105,9 @@ File name is => %s%etempnam_variation3.tmp%s
File permissions are => 100600
File created in => temp dir
-- Iteration 6 --
-
-Warning: tempnam() expects parameter 1 to be a valid path, string given in %s on line %d
--- File is not created --
-
-Warning: unlink(): %s in %s on line %d
+tempnam() expects parameter 1 to be a valid path, string given
-- Iteration 7 --
-
-Warning: tempnam() expects parameter 1 to be a valid path, array given in %s on line %d
--- File is not created --
-
-Warning: unlink(): %s in %s on line %d
+tempnam() expects parameter 1 to be a valid path, array given
-- Iteration 8 --
Notice: tempnam(): file created in the system's temporary directory in %stempnam_variation7.php on line %d
diff --git a/ext/standard/tests/file/touch.phpt b/ext/standard/tests/file/touch.phpt
index e0b06d3960..0474b34af2 100644
--- a/ext/standard/tests/file/touch.phpt
+++ b/ext/standard/tests/file/touch.phpt
@@ -13,7 +13,6 @@ if (substr(PHP_OS, 0, 3) == 'WIN') {
// output to linux. This could be a php.net bug on windows or a windows querk.
$filename = __DIR__."/touch.dat";
-var_dump(touch());
var_dump(touch($filename));
var_dump(filemtime($filename));
@unlink($filename);
@@ -39,8 +38,6 @@ var_dump(touch("/no/such/file/or/directory"));
echo "Done\n";
?>
--EXPECTF--
-Warning: touch() expects at least 1 parameter, 0 given in %s on line %d
-NULL
bool(true)
int(%d)
bool(true)
diff --git a/ext/standard/tests/file/touch_error.phpt b/ext/standard/tests/file/touch_error.phpt
index 0520055a90..9a4bd01e13 100644
--- a/ext/standard/tests/file/touch_error.phpt
+++ b/ext/standard/tests/file/touch_error.phpt
@@ -5,17 +5,9 @@ Dave Kelsey <d_kelsey@uk.ibm.com>
--FILE--
<?php
-var_dump(touch());
-var_dump(touch(1, 2, 3, 4));
var_dump(touch("/no/such/file/or/directory"));
?>
--EXPECTF--
-Warning: touch() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: touch() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-
Warning: touch(): Unable to create file /no/such/file/or/directory because No such file or directory in %s on line %d
bool(false)
diff --git a/ext/standard/tests/file/touch_variation5-win32.phpt b/ext/standard/tests/file/touch_variation5-win32.phpt
index 5761824ef3..83d1879634 100644
--- a/ext/standard/tests/file/touch_variation5-win32.phpt
+++ b/ext/standard/tests/file/touch_variation5-win32.phpt
@@ -22,7 +22,7 @@ chdir($cwd);
if (!mkdir($cwd . '/' . $workDir)) die("cannot create directory $workDir");
$paths = array(
- // relative
+ // relative
$workDir.'/'.$subDirOrFile,
'./'.$workDir.'/'.$subDirOrFile,
$workDir.'/../'.$workDir.'/'.$subDirOrFile,
@@ -66,66 +66,66 @@ rmdir($workDir);
function test_nonexisting($paths) {
- foreach($paths as $path) {
- echo "--- testing $path ---\n";
-
- if (is_dir($path) || is_file($path)) {
- echo "FAILED: $path - exists\n";
- }
- else {
- $res = touch($path);
- if ($res === true) {
- // something was created
- if (file_exists($path)) {
- // something found
- if (is_dir($path)) {
- echo "FAILED: $path - unexpected directory\n";
- }
- else {
- echo "PASSED: $path - created\n";
- unlink($path);
- }
- }
- else {
- // nothing found
- echo "FAILED: $path - touch returned true, nothing there\n";
- }
- }
- else {
- // nothing created
- if (file_exists($path)) {
- //something found
- echo "FAILED: $path - touch returned false, something there\n";
- if (is_dir($path)) {
- rmdir($path);
- }
- else {
- unlink($path);
- }
- }
- }
- }
- }
+ foreach($paths as $path) {
+ echo "--- testing $path ---\n";
+
+ if (is_dir($path) || is_file($path)) {
+ echo "FAILED: $path - exists\n";
+ }
+ else {
+ $res = touch($path);
+ if ($res === true) {
+ // something was created
+ if (file_exists($path)) {
+ // something found
+ if (is_dir($path)) {
+ echo "FAILED: $path - unexpected directory\n";
+ }
+ else {
+ echo "PASSED: $path - created\n";
+ unlink($path);
+ }
+ }
+ else {
+ // nothing found
+ echo "FAILED: $path - touch returned true, nothing there\n";
+ }
+ }
+ else {
+ // nothing created
+ if (file_exists($path)) {
+ //something found
+ echo "FAILED: $path - touch returned false, something there\n";
+ if (is_dir($path)) {
+ rmdir($path);
+ }
+ else {
+ unlink($path);
+ }
+ }
+ }
+ }
+ }
}
function test_existing($paths, $are_dirs) {
- foreach($paths as $path) {
- if ($are_dirs) {
- $res = @mkdir($path);
- if ($res == true) {
+ foreach($paths as $path) {
+ if ($are_dirs) {
+ $res = @mkdir($path);
+ if ($res == true) {
test_path($path);
rmdir($path);
}
- }
- else {
- $h = @fopen($path,"w");
- if ($h !== false) {
- fclose($h);
+ }
+ else {
+ $h = @fopen($path,"w");
+ if ($h !== false) {
+ fclose($h);
test_path($path);
unlink($path);
}
- }
- }
+ }
+ }
}
@@ -150,7 +150,6 @@ function get_atime($path) {
?>
-===DONE===
--EXPECTF--
*** Testing touch() : variation ***
@@ -226,4 +225,3 @@ PASSED: %s/touchVar5.tmp/aSubDirOrFile/ - touched
PASSED: touchVar5.tmp//aSubDirOrFile - touched
--- testing %s//touchVar5.tmp//aSubDirOrFile ---
PASSED: %s//touchVar5.tmp//aSubDirOrFile - touched
-===DONE===
diff --git a/ext/standard/tests/file/touch_variation5.phpt b/ext/standard/tests/file/touch_variation5.phpt
index 7eb4aaa7e0..67382f3b99 100644
--- a/ext/standard/tests/file/touch_variation5.phpt
+++ b/ext/standard/tests/file/touch_variation5.phpt
@@ -22,7 +22,7 @@ mkdir($workDir);
$cwd = getcwd();
$paths = array(
- // relative
+ // relative
$workDir.'/'.$subDirOrFile,
'./'.$workDir.'/'.$subDirOrFile,
$workDir.'/../'.$workDir.'/'.$subDirOrFile,
@@ -66,66 +66,66 @@ rmdir($workDir);
function test_nonexisting($paths) {
- foreach($paths as $path) {
- echo "--- testing $path ---\n";
-
- if (is_dir($path) || is_file($path)) {
- echo "FAILED: $path - exists\n";
- }
- else {
- $res = touch($path);
- if ($res === true) {
- // something was created
- if (file_exists($path)) {
- // something found
- if (is_dir($path)) {
- echo "FAILED: $path - unexpected directory\n";
- }
- else {
- echo "PASSED: $path - created\n";
- unlink($path);
- }
- }
- else {
- // nothing found
- echo "FAILED: $path - touch returned true, nothing there\n";
- }
- }
- else {
- // nothing created
- if (file_exists($path)) {
- //something found
- echo "FAILED: $path - touch returned false, something there\n";
- if (is_dir($path)) {
- rmdir($path);
- }
- else {
- unlink($path);
- }
- }
- }
- }
- }
+ foreach($paths as $path) {
+ echo "--- testing $path ---\n";
+
+ if (is_dir($path) || is_file($path)) {
+ echo "FAILED: $path - exists\n";
+ }
+ else {
+ $res = touch($path);
+ if ($res === true) {
+ // something was created
+ if (file_exists($path)) {
+ // something found
+ if (is_dir($path)) {
+ echo "FAILED: $path - unexpected directory\n";
+ }
+ else {
+ echo "PASSED: $path - created\n";
+ unlink($path);
+ }
+ }
+ else {
+ // nothing found
+ echo "FAILED: $path - touch returned true, nothing there\n";
+ }
+ }
+ else {
+ // nothing created
+ if (file_exists($path)) {
+ //something found
+ echo "FAILED: $path - touch returned false, something there\n";
+ if (is_dir($path)) {
+ rmdir($path);
+ }
+ else {
+ unlink($path);
+ }
+ }
+ }
+ }
+ }
}
function test_existing($paths, $are_dirs) {
- foreach($paths as $path) {
- if ($are_dirs) {
- $res = @mkdir($path);
- if ($res == true) {
+ foreach($paths as $path) {
+ if ($are_dirs) {
+ $res = @mkdir($path);
+ if ($res == true) {
test_path($path);
rmdir($path);
}
- }
- else {
- $h = @fopen($path,"w");
- if ($h !== false) {
- fclose($h);
+ }
+ else {
+ $h = @fopen($path,"w");
+ if ($h !== false) {
+ fclose($h);
test_path($path);
unlink($path);
}
- }
- }
+ }
+ }
}
@@ -150,7 +150,6 @@ function get_atime($path) {
?>
-===DONE===
--EXPECTF--
*** Testing touch() : variation ***
@@ -226,4 +225,3 @@ PASSED: /%s/touchVar5.tmp/aSubDirOrFile/ - touched
PASSED: touchVar5.tmp//aSubDirOrFile - touched
--- testing /%s//touchVar5.tmp//aSubDirOrFile ---
PASSED: /%s//touchVar5.tmp//aSubDirOrFile - touched
-===DONE===
diff --git a/ext/standard/tests/file/touch_variation6-win32.phpt b/ext/standard/tests/file/touch_variation6-win32.phpt
index 197078db3b..b9e9ce7a6c 100644
--- a/ext/standard/tests/file/touch_variation6-win32.phpt
+++ b/ext/standard/tests/file/touch_variation6-win32.phpt
@@ -25,7 +25,7 @@ $cwd = getcwd();
$unixifiedDirOrFile = '/'.substr(str_replace('\\','/',$cwd).'/'.$workDir.'/'.$subDirOrFile, 3);
$paths = array(
- // relative
+ // relative
$workDir.'\\'.$subDirOrFile,
'.\\'.$workDir.'\\'.$subDirOrFile,
$workDir.'\\..\\'.$workDir.'\\'.$subDirOrFile,
@@ -72,66 +72,66 @@ rmdir($workDir);
function test_nonexisting($paths) {
- foreach($paths as $path) {
- echo "--- testing $path ---\n";
-
- if (is_dir($path) || is_file($path)) {
- echo "FAILED: $path - exists\n";
- }
- else {
- $res = touch($path);
- if ($res === true) {
- // something was created
- if (file_exists($path)) {
- // something found
- if (is_dir($path)) {
- echo "FAILED: $path - unexpected directory\n";
- }
- else {
- echo "PASSED: $path - created\n";
- unlink($path);
- }
- }
- else {
- // nothing found
- echo "FAILED: $path - touch returned true, nothing there\n";
- }
- }
- else {
- // nothing created
- if (file_exists($path)) {
- //something found
- echo "FAILED: $path - touch returned false, something there\n";
- if (is_dir($path)) {
- rmdir($path);
- }
- else {
- unlink($path);
- }
- }
- }
- }
- }
+ foreach($paths as $path) {
+ echo "--- testing $path ---\n";
+
+ if (is_dir($path) || is_file($path)) {
+ echo "FAILED: $path - exists\n";
+ }
+ else {
+ $res = touch($path);
+ if ($res === true) {
+ // something was created
+ if (file_exists($path)) {
+ // something found
+ if (is_dir($path)) {
+ echo "FAILED: $path - unexpected directory\n";
+ }
+ else {
+ echo "PASSED: $path - created\n";
+ unlink($path);
+ }
+ }
+ else {
+ // nothing found
+ echo "FAILED: $path - touch returned true, nothing there\n";
+ }
+ }
+ else {
+ // nothing created
+ if (file_exists($path)) {
+ //something found
+ echo "FAILED: $path - touch returned false, something there\n";
+ if (is_dir($path)) {
+ rmdir($path);
+ }
+ else {
+ unlink($path);
+ }
+ }
+ }
+ }
+ }
}
function test_existing($paths, $are_dirs) {
- foreach($paths as $path) {
- if ($are_dirs) {
- $res = @mkdir($path);
- if ($res == true) {
+ foreach($paths as $path) {
+ if ($are_dirs) {
+ $res = @mkdir($path);
+ if ($res == true) {
test_path($path);
rmdir($path);
}
- }
- else {
- $h = @fopen($path,"w");
- if ($h !== false) {
- fclose($h);
+ }
+ else {
+ $h = @fopen($path,"w");
+ if ($h !== false) {
+ fclose($h);
test_path($path);
unlink($path);
}
- }
- }
+ }
+ }
}
@@ -156,7 +156,6 @@ function get_atime($path) {
?>
-===DONE===
--EXPECTF--
*** Testing touch() : variation ***
@@ -238,4 +237,3 @@ PASSED: touchVar5.tmp\\aSubDirOrFile - touched
PASSED: %s\\touchVar5.tmp\\aSubDirOrFile - touched
--- testing /%s/touchVar5.tmp/aSubDirOrFile ---
PASSED: /%s/touchVar5.tmp/aSubDirOrFile - touched
-===DONE===
diff --git a/ext/standard/tests/file/unlink_basic.phpt b/ext/standard/tests/file/unlink_basic.phpt
index 872326bad8..ff9010183b 100644
--- a/ext/standard/tests/file/unlink_basic.phpt
+++ b/ext/standard/tests/file/unlink_basic.phpt
@@ -16,7 +16,7 @@ fclose($fp);
// delete file
var_dump( unlink($filename) );
-var_dump( file_exists($filename) ); // confirm file doesnt exist
+var_dump( file_exists($filename) ); // confirm file doesn't exist
echo "\n*** Testing unlink() : checking second argument ***\n";
// creating a context
@@ -28,7 +28,7 @@ fclose($fp);
// delete file
var_dump( unlink($filename, $context) ); // using $context in second argument
-var_dump( file_exists($filename) ); // confirm file doesnt exist
+var_dump( file_exists($filename) ); // confirm file doesn't exist
echo "Done\n";
?>
diff --git a/ext/standard/tests/file/unlink_error-win32-mb.phpt b/ext/standard/tests/file/unlink_error-win32-mb.phpt
index a208e5675b..400e52e556 100644
--- a/ext/standard/tests/file/unlink_error-win32-mb.phpt
+++ b/ext/standard/tests/file/unlink_error-win32-mb.phpt
@@ -25,26 +25,16 @@ $context = stream_context_create();
echo "*** Testing unlink() : error conditions ***\n";
-echo "-- Testing unlink() on unexpected no. of arguments --\n";
-// arg < expected
-var_dump( unlink() );
-// args > expected
-var_dump( unlink($filename, $context, true) );
-var_dump( file_exists($filename) ); // expected: true
-
echo "\n-- Testing unlink() on invalid arguments --\n";
// invalid arguments
var_dump( unlink('') ); // $filename as empty string
-var_dump( file_exists('') ); // confirm file doesnt exist
+var_dump( file_exists('') ); // confirm file doesn't exist
var_dump( unlink(NULL) ); // $filename as NULL
-var_dump( file_exists(NULL) ); // confirm file doesnt exist
+var_dump( file_exists(NULL) ); // confirm file doesn't exist
var_dump( unlink(false) ); // $filename as boolean false
-var_dump( file_exists(false) ); // confirm file doesnt exist
-
-var_dump( unlink($filename, '') ); // $context as empty string
-var_dump( unlink($filename, false) ); // $context as boolean false
+var_dump( file_exists(false) ); // confirm file doesn't exist
echo "\n-- Testing unlink() on non-existent file --\n";
@@ -68,14 +58,6 @@ rmdir(__DIR__."/ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™");
?>
--EXPECTF--
*** Testing unlink() : error conditions ***
--- Testing unlink() on unexpected no. of arguments --
-
-Warning: unlink() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: unlink() expects at most 2 parameters, 3 given in %s on line %d
-bool(false)
-bool(true)
-- Testing unlink() on invalid arguments --
@@ -91,12 +73,6 @@ Warning: unlink(): %s in %s on line %d
bool(false)
bool(false)
-Warning: unlink() expects parameter 2 to be resource, string given in %s on line %d
-bool(false)
-
-Warning: unlink() expects parameter 2 to be resource, bool given in %s on line %d
-bool(false)
-
-- Testing unlink() on non-existent file --
Warning: unlink(%s/non_existent_file.tmp): No such file or directory in %s on line %d
diff --git a/ext/standard/tests/file/unlink_error-win32.phpt b/ext/standard/tests/file/unlink_error-win32.phpt
index d62c715a94..2b1df9652f 100644
--- a/ext/standard/tests/file/unlink_error-win32.phpt
+++ b/ext/standard/tests/file/unlink_error-win32.phpt
@@ -23,26 +23,16 @@ $context = stream_context_create();
echo "*** Testing unlink() : error conditions ***\n";
-echo "-- Testing unlink() on unexpected no. of arguments --\n";
-// arg < expected
-var_dump( unlink() );
-// args > expected
-var_dump( unlink($filename, $context, true) );
-var_dump( file_exists($filename) ); // expected: true
-
echo "\n-- Testing unlink() on invalid arguments --\n";
// invalid arguments
var_dump( unlink('') ); // $filename as empty string
-var_dump( file_exists('') ); // confirm file doesnt exist
+var_dump( file_exists('') ); // confirm file doesn't exist
var_dump( unlink(NULL) ); // $filename as NULL
-var_dump( file_exists(NULL) ); // confirm file doesnt exist
+var_dump( file_exists(NULL) ); // confirm file doesn't exist
var_dump( unlink(false) ); // $filename as boolean false
-var_dump( file_exists(false) ); // confirm file doesnt exist
-
-var_dump( unlink($filename, '') ); // $context as empty string
-var_dump( unlink($filename, false) ); // $context as boolean false
+var_dump( file_exists(false) ); // confirm file doesn't exist
echo "\n-- Testing unlink() on non-existent file --\n";
@@ -65,14 +55,6 @@ rmdir(__DIR__."/unlink_error");
?>
--EXPECTF--
*** Testing unlink() : error conditions ***
--- Testing unlink() on unexpected no. of arguments --
-
-Warning: unlink() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: unlink() expects at most 2 parameters, 3 given in %s on line %d
-bool(false)
-bool(true)
-- Testing unlink() on invalid arguments --
@@ -88,12 +70,6 @@ Warning: unlink(): %s in %s on line %d
bool(false)
bool(false)
-Warning: unlink() expects parameter 2 to be resource, string given in %s on line %d
-bool(false)
-
-Warning: unlink() expects parameter 2 to be resource, bool given in %s on line %d
-bool(false)
-
-- Testing unlink() on non-existent file --
Warning: unlink(%s/non_existent_file.tmp): No such file or directory in %s on line %d
diff --git a/ext/standard/tests/file/unlink_error.phpt b/ext/standard/tests/file/unlink_error.phpt
index 61aac03dd3..5bf2227ca5 100644
--- a/ext/standard/tests/file/unlink_error.phpt
+++ b/ext/standard/tests/file/unlink_error.phpt
@@ -23,27 +23,16 @@ $context = stream_context_create();
echo "*** Testing unlink() : error conditions ***\n";
-echo "-- Testing unlink() on unexpected no. of arguments --\n";
-// arg < expected
-var_dump( unlink() );
-// args > expected
-var_dump( unlink($filename, $context, true) );
-var_dump( file_exists($filename) ); // expected true
-
echo "\n-- Testing unlink() on invalid arguments --\n";
// invalid arguments
var_dump( unlink('') ); // $filename as empty string
-var_dump( file_exists('') ); // confirm file doesnt exist
+var_dump( file_exists('') ); // confirm file doesn't exist
var_dump( unlink(NULL) ); // $filename as NULL
-var_dump( file_exists(NULL) ); // confirm file doesnt exist
+var_dump( file_exists(NULL) ); // confirm file doesn't exist
var_dump( unlink(false) ); // $filename as boolean false
-var_dump( file_exists(false) ); // confirm file doesnt exist
-
-var_dump( unlink($filename, '') ); // $context as empty string
-var_dump( unlink($filename, false) ); // $context as boolean false
-
+var_dump( file_exists(false) ); // confirm file doesn't exist
echo "\n-- Testing unlink() on non-existent file --\n";
var_dump( unlink(__DIR__."/non_existent_file.tmp") );
@@ -65,14 +54,6 @@ rmdir(__DIR__."/unlink_error");
?>
--EXPECTF--
*** Testing unlink() : error conditions ***
--- Testing unlink() on unexpected no. of arguments --
-
-Warning: unlink() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: unlink() expects at most 2 parameters, 3 given in %s on line %d
-bool(false)
-bool(true)
-- Testing unlink() on invalid arguments --
@@ -88,12 +69,6 @@ Warning: unlink(): %s in %s on line %d
bool(false)
bool(false)
-Warning: unlink() expects parameter 2 to be resource, string given in %s on line %d
-bool(false)
-
-Warning: unlink() expects parameter 2 to be resource, bool given in %s on line %d
-bool(false)
-
-- Testing unlink() on non-existent file --
Warning: unlink(%s/non_existent_file.tmp): No such file or directory in %s on line %d
diff --git a/ext/standard/tests/file/unlink_variation10.phpt b/ext/standard/tests/file/unlink_variation10.phpt
index 585b8f87fb..ae48764d9b 100644
--- a/ext/standard/tests/file/unlink_variation10.phpt
+++ b/ext/standard/tests/file/unlink_variation10.phpt
@@ -56,18 +56,18 @@ rmdir($workDir);
function test_link($linkedDir, $toLinkTo, $tounlink, $softlink) {
if ($softlink == true) {
- symlink($toLinkTo, $linkedDir);
- $msg = "soft link";
+ symlink($toLinkTo, $linkedDir);
+ $msg = "soft link";
}
else {
- link($toLinkTo, $linkedDir);
- $msg = "hard link";
+ link($toLinkTo, $linkedDir);
+ $msg = "hard link";
}
echo "-- unlinking $msg $tounlink --\n";
$res = unlink($tounlink);
if ($res === true) {
if (is_link($tounlink) === false) {
- echo "directory unlinked\n";
+ echo "directory unlinked\n";
}
else {
echo "FAILED: directory not unlinked\n";
@@ -80,7 +80,6 @@ function test_link($linkedDir, $toLinkTo, $tounlink, $softlink) {
?>
-===DONE===
--EXPECTF--
*** Testing unlink() : variation ***
-- unlinking soft link unlinkVar10.tmp/subDir.tmp --
@@ -103,4 +102,3 @@ directory unlinked
--- try to unlink a directory ---
Warning: unlink(unlinkVar10.tmp/linkme.tmp): %s in %s on line %d
-===DONE===
diff --git a/ext/standard/tests/file/unlink_variation6.phpt b/ext/standard/tests/file/unlink_variation6.phpt
index 64c009bf91..ff66cd2195 100644
--- a/ext/standard/tests/file/unlink_variation6.phpt
+++ b/ext/standard/tests/file/unlink_variation6.phpt
@@ -32,10 +32,8 @@ function f_exists($file) {
}
}
?>
-===DONE===
--EXPECT--
*** Testing unlink() : variation: contexts and relative files ***
subdir/testfile.txt exists
bool(true)
subdir/testfile.txt doesn't exist
-===DONE===
diff --git a/ext/standard/tests/file/unlink_variation8-win32.phpt b/ext/standard/tests/file/unlink_variation8-win32.phpt
index 9ee6b49d2a..12b43a340f 100644
--- a/ext/standard/tests/file/unlink_variation8-win32.phpt
+++ b/ext/standard/tests/file/unlink_variation8-win32.phpt
@@ -65,7 +65,7 @@ function test_realfile($file, $tounlink) {
$res = unlink($tounlink);
if ($res === true) {
if (file_exists($tounlink) === false) {
- echo "file removed\n";
+ echo "file removed\n";
}
else {
echo "FAILED: file not removed\n";
@@ -76,7 +76,6 @@ function test_realfile($file, $tounlink) {
}
}
?>
-===DONE===
--EXPECTF--
*** Testing unlink() : variation ***
-- removing unlinkVar8.tmp/file.tmp --
@@ -110,4 +109,3 @@ Warning: unlink(%s/unlinkVar8.tmp/file.tmp/): No such file or directory in %s on
file removed
-- removing %s//unlinkVar8.tmp//file.tmp --
file removed
-===DONE===
diff --git a/ext/standard/tests/file/unlink_variation8.phpt b/ext/standard/tests/file/unlink_variation8.phpt
index ab074c7849..41c18f710b 100644
--- a/ext/standard/tests/file/unlink_variation8.phpt
+++ b/ext/standard/tests/file/unlink_variation8.phpt
@@ -70,7 +70,7 @@ function test_realfile($file, $tounlink) {
$res = unlink($tounlink);
if ($res === true) {
if (file_exists($tounlink) === false) {
- echo "file removed\n";
+ echo "file removed\n";
}
else {
echo "FAILED: file not removed\n";
@@ -83,18 +83,18 @@ function test_realfile($file, $tounlink) {
function test_link($linkedfile, $toLinkTo, $tounlink, $softlink) {
if ($softlink == true) {
- symlink($toLinkTo, $linkedfile);
- $msg = "soft link";
+ symlink($toLinkTo, $linkedfile);
+ $msg = "soft link";
}
else {
- link($toLinkTo, $linkedfile);
- $msg = "hard link";
+ link($toLinkTo, $linkedfile);
+ $msg = "hard link";
}
echo "-- unlinking $msg $tounlink --\n";
$res = unlink($tounlink);
if ($res === true) {
if (file_exists($tounlink) === false) {
- echo "file unlinked\n";
+ echo "file unlinked\n";
}
else {
echo "FAILED: file not unlinked\n";
@@ -107,7 +107,6 @@ function test_link($linkedfile, $toLinkTo, $tounlink, $softlink) {
?>
-===DONE===
--EXPECTF--
*** Testing unlink() : variation ***
-- removing unlinkVar8.tmp/file.tmp --
@@ -203,4 +202,3 @@ file removed
file unlinked
-- unlinking hard link /%s//unlinkVar8.tmp//file.tmp --
file unlinked
-===DONE===
diff --git a/ext/standard/tests/file/unlink_variation9-win32.phpt b/ext/standard/tests/file/unlink_variation9-win32.phpt
index 2331c9edc8..83a3f5617d 100644
--- a/ext/standard/tests/file/unlink_variation9-win32.phpt
+++ b/ext/standard/tests/file/unlink_variation9-win32.phpt
@@ -58,14 +58,14 @@ $files = array(
foreach($files as $fileToUnlink) {
- $file = $workDir.'/'.$tmpFile;
- $tounlink = $fileToUnlink;
+ $file = $workDir.'/'.$tmpFile;
+ $tounlink = $fileToUnlink;
touch($file);
echo "-- removing $tounlink --\n";
$res = unlink($tounlink);
if ($res === true) {
if (file_exists($tounlink) === false) {
- echo "file removed\n";
+ echo "file removed\n";
}
else {
echo "FAILED: file not removed\n";
@@ -78,7 +78,6 @@ foreach($files as $fileToUnlink) {
rmdir($workDir);
?>
-===DONE===
--EXPECTF--
*** Testing unlink() : variation ***
-- removing unlinkVar9.tmp\file.tmp --
@@ -114,4 +113,3 @@ file removed
file removed
-- removing /%s/unlinkVar9.tmp/file.tmp --
file removed
-===DONE===
diff --git a/ext/standard/tests/file/userdirstream.phpt b/ext/standard/tests/file/userdirstream.phpt
index a83e899b83..e2f03dabb7 100644
--- a/ext/standard/tests/file/userdirstream.phpt
+++ b/ext/standard/tests/file/userdirstream.phpt
@@ -3,33 +3,33 @@ Directory Streams
--FILE--
<?php
class test {
- public $idx = 0;
+ public $idx = 0;
- function dir_opendir($path, $options) {
- print "Opening\n";
- $this->idx = 0;
+ function dir_opendir($path, $options) {
+ print "Opening\n";
+ $this->idx = 0;
- return true;
- }
+ return true;
+ }
- function dir_readdir() {
- $sample = array('first','second','third','fourth');
+ function dir_readdir() {
+ $sample = array('first','second','third','fourth');
- if ($this->idx >= count($sample)) return false;
- else return $sample[$this->idx++];
- }
+ if ($this->idx >= count($sample)) return false;
+ else return $sample[$this->idx++];
+ }
- function dir_rewinddir() {
- $this->idx = 0;
+ function dir_rewinddir() {
+ $this->idx = 0;
- return true;
- }
+ return true;
+ }
- function dir_closedir() {
- print "Closing up!\n";
+ function dir_closedir() {
+ print "Closing up!\n";
- return true;
- }
+ return true;
+ }
}
stream_wrapper_register('test', 'test');
diff --git a/ext/standard/tests/file/userstreams.phpt b/ext/standard/tests/file/userstreams.phpt
index 790b74a0c3..5b753e02e4 100644
--- a/ext/standard/tests/file/userstreams.phpt
+++ b/ext/standard/tests/file/userstreams.phpt
@@ -22,7 +22,7 @@ call me what you will
Free to speak my mind anywhere
and Ill redefine anywhere
Anywhere I roam
- Where I lay my head is home
+ Where I lay my head is home
...and the earth becomes my throne
I adapt to the unknown
under wandering stars Ive grown
@@ -38,12 +38,12 @@ call me what you will
Free to speak my mind anywhere
and Ill never mind anywhere
Anywhere I roam
- Where I lay my head is home
+ Where I lay my head is home
But Ill take my time anywhere
Free to speak my mind anywhere
and Ill take my find anywhere
Anywhere I roam
- Where I lay my head is home
+ Where I lay my head is home
carved upon my stone
my body lie but still I roam
Wherever I may roam.
@@ -57,10 +57,10 @@ EOD;
* to seek around... */
$DATA = "";
for ($i = 0; $i < 30; $i++) {
- if ($i % 2 == 0)
- $DATA .= str_rot13($lyrics);
- else
- $DATA .= $lyrics;
+ if ($i % 2 == 0)
+ $DATA .= str_rot13($lyrics);
+ else
+ $DATA .= $lyrics;
}
/* store the data in a regular file so that we can compare
@@ -70,10 +70,10 @@ fwrite($tf, $DATA);
$n = ftell($tf);
rewind($tf) or die("failed to rewind tmp file!");
if (ftell($tf) != 0)
- die("tmpfile is not at start!");
+ die("tmpfile is not at start!");
$DATALEN = strlen($DATA);
if ($n != $DATALEN)
- die("tmpfile stored $n bytes; should be $DATALEN!");
+ die("tmpfile stored $n bytes; should be $DATALEN!");
class uselessstream
{
@@ -81,150 +81,150 @@ class uselessstream
class mystream
{
- public $path;
- public $mode;
- public $options;
-
- public $position;
- public $varname;
-
- function stream_open($path, $mode, $options, &$opened_path)
- {
- $this->path = $path;
- $this->mode = $mode;
- $this->options = $options;
-
- $split = parse_url($path);
- $this->varname = $split["host"];
-
- if (strchr($mode, 'a'))
- $this->position = strlen($GLOBALS[$this->varname]);
- else
- $this->position = 0;
-
- return true;
- }
-
- function stream_read($count)
- {
- $ret = substr($GLOBALS[$this->varname], $this->position, $count);
- $this->position += strlen($ret);
- return $ret;
- }
-
- function stream_tell()
- {
- return $this->position;
- }
-
- function stream_eof()
- {
- return $this->position >= strlen($GLOBALS[$this->varname]);
- }
-
- function stream_seek($offset, $whence)
- {
- switch($whence) {
- case SEEK_SET:
- if ($offset < strlen($GLOBALS[$this->varname]) && $offset >= 0) {
- $this->position = $offset;
- return true;
- } else {
- return false;
- }
- break;
- case SEEK_CUR:
- if ($offset >= 0) {
- $this->position += $offset;
- return true;
- } else {
- return false;
- }
- break;
- case SEEK_END:
- if (strlen($GLOBALS[$this->varname]) + $offset >= 0) {
- $this->position = strlen($GLOBALS[$this->varname]) + $offset;
- return true;
- } else {
- return false;
- }
- break;
- default:
- return false;
- }
- }
+ public $path;
+ public $mode;
+ public $options;
+
+ public $position;
+ public $varname;
+
+ function stream_open($path, $mode, $options, &$opened_path)
+ {
+ $this->path = $path;
+ $this->mode = $mode;
+ $this->options = $options;
+
+ $split = parse_url($path);
+ $this->varname = $split["host"];
+
+ if (strchr($mode, 'a'))
+ $this->position = strlen($GLOBALS[$this->varname]);
+ else
+ $this->position = 0;
+
+ return true;
+ }
+
+ function stream_read($count)
+ {
+ $ret = substr($GLOBALS[$this->varname], $this->position, $count);
+ $this->position += strlen($ret);
+ return $ret;
+ }
+
+ function stream_tell()
+ {
+ return $this->position;
+ }
+
+ function stream_eof()
+ {
+ return $this->position >= strlen($GLOBALS[$this->varname]);
+ }
+
+ function stream_seek($offset, $whence)
+ {
+ switch($whence) {
+ case SEEK_SET:
+ if ($offset < strlen($GLOBALS[$this->varname]) && $offset >= 0) {
+ $this->position = $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+ case SEEK_CUR:
+ if ($offset >= 0) {
+ $this->position += $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+ case SEEK_END:
+ if (strlen($GLOBALS[$this->varname]) + $offset >= 0) {
+ $this->position = strlen($GLOBALS[$this->varname]) + $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+ default:
+ return false;
+ }
+ }
}
if (@stream_wrapper_register("bogus", "class_not_exist")) {
- die("Registered a non-existent class!!!???");
+ die("Registered a non-existent class!!!???");
}
echo "Not Registered\n";
if (!stream_wrapper_register("test", "mystream")) {
- die("test wrapper registration failed");
+ die("test wrapper registration failed");
}
echo "Registered\n";
if (!stream_wrapper_register("bogon", "uselessstream")) {
- die("bogon wrapper registration failed");
+ die("bogon wrapper registration failed");
}
echo "Registered\n";
$b = @fopen("bogon://url", "rb");
if (is_resource($b)) {
- die("Opened a bogon??");
+ die("Opened a bogon??");
}
$fp = fopen("test://DATA", "rb");
if (!$fp || !is_resource($fp)) {
- die("Failed to open resource");
+ die("Failed to open resource");
}
/* some default seeks that will cause buffer/cache misses */
$seeks = array(
- array(SEEK_SET, 0, 0),
- array(SEEK_CUR, 8450, 8450),
- array(SEEK_CUR, -7904, 546),
- array(SEEK_CUR, 12456, 13002),
-
- /* end up at BOF so that randomly generated seek offsets
- * below will know where they are supposed to be */
- array(SEEK_SET, 0, 0)
+ array(SEEK_SET, 0, 0),
+ array(SEEK_CUR, 8450, 8450),
+ array(SEEK_CUR, -7904, 546),
+ array(SEEK_CUR, 12456, 13002),
+
+ /* end up at BOF so that randomly generated seek offsets
+ * below will know where they are supposed to be */
+ array(SEEK_SET, 0, 0)
);
$whence_map = array(
- SEEK_CUR,
- SEEK_SET,
- SEEK_END
+ SEEK_CUR,
+ SEEK_SET,
+ SEEK_END
);
$whence_names = array(
- SEEK_CUR => "SEEK_CUR",
- SEEK_SET => "SEEK_SET",
- SEEK_END => "SEEK_END"
- );
+ SEEK_CUR => "SEEK_CUR",
+ SEEK_SET => "SEEK_SET",
+ SEEK_END => "SEEK_END"
+ );
/* generate some random seek offsets */
$position = 0;
for ($i = 0; $i < 256; $i++) {
- $whence = $whence_map[array_rand($whence_map, 1)];
- switch($whence) {
- case SEEK_SET:
- $offset = rand(0, $DATALEN - 1);
- $position = $offset;
- break;
- case SEEK_END:
- $offset = -rand(0, $DATALEN - 1);
- $position = $DATALEN + $offset;
- break;
- case SEEK_CUR:
- $offset = rand(0, $DATALEN - 1);
- $offset -= $position;
- $position += $offset;
- break;
- }
-
- $seeks[] = array($whence, $offset, $position);
+ $whence = $whence_map[array_rand($whence_map, 1)];
+ switch($whence) {
+ case SEEK_SET:
+ $offset = rand(0, $DATALEN - 1);
+ $position = $offset;
+ break;
+ case SEEK_END:
+ $offset = -rand(0, $DATALEN - 1);
+ $position = $DATALEN + $offset;
+ break;
+ case SEEK_CUR:
+ $offset = rand(0, $DATALEN - 1);
+ $offset -= $position;
+ $position += $offset;
+ break;
+ }
+
+ $seeks[] = array($whence, $offset, $position);
}
/* we compare the results of fgets using differing line lengths to
@@ -234,50 +234,50 @@ $fail_count = 0;
ob_start();
foreach($line_lengths as $line_length) {
- /* now compare the real stream with the user stream */
- $j = 0;
- rewind($tf);
- rewind($fp);
- foreach($seeks as $seekdata) {
- list($whence, $offset, $position) = $seekdata;
-
- $rpb = ftell($tf);
- $rr = (int)fseek($tf, $offset, $whence);
- $rpa = ftell($tf);
- $rline = fgets($tf, $line_length);
- (int)fseek($tf, - strlen($rline), SEEK_CUR);
-
- $upb = ftell($fp);
- $ur = (int)fseek($fp, $offset, $whence);
- $upa = ftell($fp);
- $uline = fgets($fp, $line_length);
- (int)fseek($fp, - strlen($uline), SEEK_CUR);
-
- printf("\n--[%d] whence=%s offset=%d line_length=%d position_should_be=%d --\n",
- $j, $whence_names[$whence], $offset, $line_length, $position);
- printf("REAL: pos=(%d,%d,%d) ret=%d line[%d]=`%s'\n", $rpb, $rpa, ftell($tf), $rr, strlen($rline), $rline);
- printf("USER: pos=(%d,%d,%d) ret=%d line[%d]=`%s'\n", $upb, $upa, ftell($fp), $ur, strlen($uline), $uline);
-
- if ($rr != $ur || $rline != $uline || $rpa != $position || $upa != $position) {
- $fail_count++;
- echo "###################################### FAIL!\n";
- $dat = stream_get_meta_data($fp);
- var_dump($dat);
- break;
- }
-
- $j++;
- }
- if ($fail_count)
- break;
+ /* now compare the real stream with the user stream */
+ $j = 0;
+ rewind($tf);
+ rewind($fp);
+ foreach($seeks as $seekdata) {
+ list($whence, $offset, $position) = $seekdata;
+
+ $rpb = ftell($tf);
+ $rr = (int)fseek($tf, $offset, $whence);
+ $rpa = ftell($tf);
+ $rline = fgets($tf, $line_length);
+ (int)fseek($tf, - strlen($rline), SEEK_CUR);
+
+ $upb = ftell($fp);
+ $ur = (int)fseek($fp, $offset, $whence);
+ $upa = ftell($fp);
+ $uline = fgets($fp, $line_length);
+ (int)fseek($fp, - strlen($uline), SEEK_CUR);
+
+ printf("\n--[%d] whence=%s offset=%d line_length=%d position_should_be=%d --\n",
+ $j, $whence_names[$whence], $offset, $line_length, $position);
+ printf("REAL: pos=(%d,%d,%d) ret=%d line[%d]=`%s'\n", $rpb, $rpa, ftell($tf), $rr, strlen($rline), $rline);
+ printf("USER: pos=(%d,%d,%d) ret=%d line[%d]=`%s'\n", $upb, $upa, ftell($fp), $ur, strlen($uline), $uline);
+
+ if ($rr != $ur || $rline != $uline || $rpa != $position || $upa != $position) {
+ $fail_count++;
+ echo "###################################### FAIL!\n";
+ $dat = stream_get_meta_data($fp);
+ var_dump($dat);
+ break;
+ }
+
+ $j++;
+ }
+ if ($fail_count)
+ break;
}
if ($fail_count == 0) {
- ob_end_clean();
- echo "SEEK: OK\n";
+ ob_end_clean();
+ echo "SEEK: OK\n";
} else {
- echo "SEEK: FAIL\n";
- ob_end_flush();
+ echo "SEEK: FAIL\n";
+ ob_end_flush();
}
$fail_count = 0;
@@ -286,23 +286,23 @@ fseek($fp, $DATALEN / 2, SEEK_SET);
fseek($tf, $DATALEN / 2, SEEK_SET);
if (ftell($fp) != ftell($tf)) {
- echo "SEEK: positions do not match!\n";
+ echo "SEEK: positions do not match!\n";
}
$n = 0;
while(!feof($fp)) {
- $uline = fgets($fp, 1024);
- $rline = fgets($tf, 1024);
-
- if ($uline != $rline) {
- echo "FGETS: FAIL\niter=$n user=$uline [pos=" . ftell($fp) . "]\nreal=$rline [pos=" . ftell($tf) . "]\n";
- $fail_count++;
- break;
- }
+ $uline = fgets($fp, 1024);
+ $rline = fgets($tf, 1024);
+
+ if ($uline != $rline) {
+ echo "FGETS: FAIL\niter=$n user=$uline [pos=" . ftell($fp) . "]\nreal=$rline [pos=" . ftell($tf) . "]\n";
+ $fail_count++;
+ break;
+ }
}
if ($fail_count == 0) {
- echo "FGETS: OK\n";
+ echo "FGETS: OK\n";
}
/* One final test to see if the position is respected when opened for append */
diff --git a/ext/standard/tests/file/userstreams_002.phpt b/ext/standard/tests/file/userstreams_002.phpt
index 81f463ddd2..95e085947f 100644
--- a/ext/standard/tests/file/userstreams_002.phpt
+++ b/ext/standard/tests/file/userstreams_002.phpt
@@ -3,26 +3,30 @@ User-space streams: stream_cast()
--FILE--
<?php
class test_wrapper_base {
- public $return_value;
- function stream_open($path, $mode, $openedpath) {
- return true;
- }
- function stream_eof() {
- return false;
- }
+ public $return_value;
+ function stream_open($path, $mode, $openedpath) {
+ return true;
+ }
+ function stream_eof() {
+ return false;
+ }
}
class test_wrapper extends test_wrapper_base {
- function stream_cast($castas) {
- return $this->return_value;
- }
+ function stream_cast($castas) {
+ return $this->return_value;
+ }
}
function test($name, $fd, $return_value) {
- echo "\n------ $name: -------\n";
- $data = stream_get_meta_data($fd);
- $data['wrapper_data']->return_value = $return_value;
- $r = array($fd);
- $w = $e = null;
- var_dump(stream_select($r, $w, $e, 0) !== false);
+ echo "\n------ $name: -------\n";
+ $data = stream_get_meta_data($fd);
+ $data['wrapper_data']->return_value = $return_value;
+ $r = array($fd);
+ $w = $e = null;
+ try {
+ var_dump(stream_select($r, $w, $e, 0) !== false);
+ } catch (TypeError|ValueError $e) {
+ echo $e->getMessage(), "\n";
+ }
}
var_dump(stream_wrapper_register('test', 'test_wrapper'));
@@ -50,45 +54,33 @@ bool(true)
Warning: stream_select(): test_wrapper_base::stream_cast is not implemented! in %s
-Warning: stream_select(): cannot represent a stream of type user-space as a select()able descriptor in %s
-
-Warning: stream_select(): No stream arrays were passed in %s
-bool(false)
+Warning: stream_select(): Cannot represent a stream of type user-space as a select()able descriptor in %s
+No stream arrays were passed
------ return value is false: -------
-Warning: stream_select(): cannot represent a stream of type user-space as a select()able descriptor in %s
-
-Warning: stream_select(): No stream arrays were passed in %s
-bool(false)
+Warning: stream_select(): Cannot represent a stream of type user-space as a select()able descriptor in %s
+No stream arrays were passed
------ return value not a stream resource: -------
-Warning: stream_select(): supplied argument is not a valid stream resource in %s
-
Warning: stream_select(): test_wrapper::stream_cast must return a stream resource in %s
-Warning: stream_select(): cannot represent a stream of type user-space as a select()able descriptor in %s
-
-Warning: stream_select(): No stream arrays were passed in %s
-bool(false)
+Warning: stream_select(): Cannot represent a stream of type user-space as a select()able descriptor in %s
+No stream arrays were passed
------ return value is stream itself: -------
Warning: stream_select(): test_wrapper::stream_cast must not return itself in %s
-Warning: stream_select(): cannot represent a stream of type user-space as a select()able descriptor in %s
-
-Warning: stream_select(): No stream arrays were passed in %s
-bool(false)
+Warning: stream_select(): Cannot represent a stream of type user-space as a select()able descriptor in %s
+No stream arrays were passed
------ return value cannot be casted: -------
Warning: stream_select(): test_wrapper_base::stream_cast is not implemented! in %s
-Warning: stream_select(): cannot represent a stream of type user-space as a select()able descriptor in %s
-
-Warning: stream_select(): cannot represent a stream of type user-space as a select()able descriptor in %s
+Warning: stream_select(): Cannot represent a stream of type user-space as a select()able descriptor in %s
-Warning: stream_select(): No stream arrays were passed in %s
-bool(false)
+Warning: stream_select(): Cannot represent a stream of type user-space as a select()able descriptor in %s
+No stream arrays were passed
diff --git a/ext/standard/tests/file/userstreams_003.phpt b/ext/standard/tests/file/userstreams_003.phpt
index 9ee71f2666..686963adf7 100644
--- a/ext/standard/tests/file/userstreams_003.phpt
+++ b/ext/standard/tests/file/userstreams_003.phpt
@@ -3,37 +3,37 @@ User-space streams: stream_set_option()
--FILE--
<?php
class test_wrapper_base {
- public $return_value;
- public $expected_option;
- public $expected_value;
- function stream_open($path, $mode, $openedpath) {
- return true;
- }
- function stream_eof() {
- return false;
- }
+ public $return_value;
+ public $expected_option;
+ public $expected_value;
+ function stream_open($path, $mode, $openedpath) {
+ return true;
+ }
+ function stream_eof() {
+ return false;
+ }
}
class test_wrapper extends test_wrapper_base {
- function stream_set_option($option, $value, $ptrparam) {
- echo "value:\n";
- var_dump($value);
- echo "ptrparam:\n";
- var_dump($ptrparam);
- echo "\$option === $option === " . $this->expected_option . ":\n";
- var_dump($option === $this->expected_option);
- echo "\$value === $value === " . $this->expected_value. ":\n";
- var_dump($value === $this->expected_value);
- return $this->return_value;
- }
+ function stream_set_option($option, $value, $ptrparam) {
+ echo "value:\n";
+ var_dump($value);
+ echo "ptrparam:\n";
+ var_dump($ptrparam);
+ echo "\$option === $option === " . $this->expected_option . ":\n";
+ var_dump($option === $this->expected_option);
+ echo "\$value === $value === " . $this->expected_value. ":\n";
+ var_dump($value === $this->expected_value);
+ return $this->return_value;
+ }
}
function test($name, $fd, $return_value, $func, $args, $expected_option, $expected_value) {
- echo "\n------ $name: -------\n";
- $data = stream_get_meta_data($fd);
- $data['wrapper_data']->return_value = $return_value;
- $data['wrapper_data']->expected_option = $expected_option;
- $data['wrapper_data']->expected_value = $expected_value;
- var_dump(call_user_func_array($func, $args));
+ echo "\n------ $name: -------\n";
+ $data = stream_get_meta_data($fd);
+ $data['wrapper_data']->return_value = $return_value;
+ $data['wrapper_data']->expected_option = $expected_option;
+ $data['wrapper_data']->expected_value = $expected_value;
+ var_dump(call_user_func_array($func, $args));
}
var_dump(stream_wrapper_register('test', 'test_wrapper'));
diff --git a/ext/standard/tests/file/userstreams_004.phpt b/ext/standard/tests/file/userstreams_004.phpt
index da9f148b5d..df1a9f3604 100644
--- a/ext/standard/tests/file/userstreams_004.phpt
+++ b/ext/standard/tests/file/userstreams_004.phpt
@@ -3,24 +3,24 @@ User-space streams: stream_lock()
--FILE--
<?php
class test_wrapper_base {
- public $mode;
- function stream_open($path, $mode, $openedpath) {
- return true;
- }
- function stream_eof() {
- return false;
- }
+ public $mode;
+ function stream_open($path, $mode, $openedpath) {
+ return true;
+ }
+ function stream_eof() {
+ return false;
+ }
}
class test_wrapper extends test_wrapper_base {
- function stream_lock($mode) {
- $this->mode = $mode;
- }
+ function stream_lock($mode) {
+ $this->mode = $mode;
+ }
}
function test($name, $fd, $mode) {
- echo "------ $name: -------\n";
- flock($fd, $mode);
- $data = stream_get_meta_data($fd);
- var_dump($data['wrapper_data']->mode === $mode);
+ echo "------ $name: -------\n";
+ flock($fd, $mode);
+ $data = stream_get_meta_data($fd);
+ var_dump($data['wrapper_data']->mode === $mode);
}
var_dump(stream_wrapper_register('test', 'test_wrapper'));
@@ -32,8 +32,8 @@ $fd2 = fopen("test2://foo","r");
test("stream_lock not implemented", $fd2, LOCK_EX);
foreach(array("LOCK_SH","LOCK_EX","LOCK_UN") as $mode) {
- test("fclock($mode)", $fd, constant($mode));
- test("fclock($mode|LOCK_NB)", $fd, constant($mode)|LOCK_NB);
+ test("fclock($mode)", $fd, constant($mode));
+ test("fclock($mode|LOCK_NB)", $fd, constant($mode)|LOCK_NB);
}
?>
diff --git a/ext/standard/tests/file/userstreams_005.phpt b/ext/standard/tests/file/userstreams_005.phpt
index a2af1b4086..5650df2aa0 100644
--- a/ext/standard/tests/file/userstreams_005.phpt
+++ b/ext/standard/tests/file/userstreams_005.phpt
@@ -3,29 +3,29 @@ User-space streams: stream_truncate()
--FILE--
<?php
class test_wrapper_base {
- public $mode;
- function stream_open($path, $mode, $openedpath) {
- return true;
- }
- function stream_eof() {
- return false;
- }
+ public $mode;
+ function stream_open($path, $mode, $openedpath) {
+ return true;
+ }
+ function stream_eof() {
+ return false;
+ }
}
class test_wrapper extends test_wrapper_base {
- function stream_truncate($new_size) {
- echo "truncation with new_size=$new_size\n";
- return true;
- }
+ function stream_truncate($new_size) {
+ echo "truncation with new_size=$new_size\n";
+ return true;
+ }
}
class test_wrapper_bad extends test_wrapper_base {
- function stream_truncate($new_size) {
- echo "truncation with new_size=$new_size\n";
- return "kkk";
- }
+ function stream_truncate($new_size) {
+ echo "truncation with new_size=$new_size\n";
+ return "kkk";
+ }
}
function test($name, $fd, $dest_size) {
- echo "------ $name: -------\n";
- var_dump(ftruncate($fd, $dest_size));
+ echo "------ $name: -------\n";
+ var_dump(ftruncate($fd, $dest_size));
}
var_dump(stream_wrapper_register('test', 'test_wrapper'));
var_dump(stream_wrapper_register('test2', 'test_wrapper_base'));
@@ -38,7 +38,11 @@ $fd3 = fopen("test3://foo","r");
test("stream_truncate not implemented", $fd2, 0);
test("stream_truncate size 0", $fd, 0);
test("stream_truncate size 10", $fd, 10);
-test("stream_truncate negative size", $fd, -1);
+try {
+ test("stream_truncate negative size", $fd, -1);
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
test("stream_truncate bad return", $fd3, 0);
--EXPECTF--
bool(true)
@@ -55,9 +59,7 @@ bool(true)
truncation with new_size=10
bool(true)
------ stream_truncate negative size: -------
-
-Warning: ftruncate(): Negative size is not supported in %s on line %d
-bool(false)
+Negative size is not supported
------ stream_truncate bad return: -------
truncation with new_size=0
diff --git a/ext/standard/tests/file/userstreams_006.phpt b/ext/standard/tests/file/userstreams_006.phpt
index c434f4cc62..561bea4fb5 100644
--- a/ext/standard/tests/file/userstreams_006.phpt
+++ b/ext/standard/tests/file/userstreams_006.phpt
@@ -3,20 +3,20 @@ User-space streams: set_options returns "not implemented" for unhandled option t
--FILE--
<?php
class test_wrapper {
- function stream_open($path, $mode, $openedpath) {
- return true;
- }
- function stream_eof() {
- return false;
- }
- function stream_write($data) {
- echo "size: ", strlen($data), "\n";
- return strlen($data);
- }
- function stream_set_option($option, $arg1, $arg2) {
- echo "option: ", $option, ", ", $arg1, ", ", $arg2, "\n";
- return false;
- }
+ function stream_open($path, $mode, $openedpath) {
+ return true;
+ }
+ function stream_eof() {
+ return false;
+ }
+ function stream_write($data) {
+ echo "size: ", strlen($data), "\n";
+ return strlen($data);
+ }
+ function stream_set_option($option, $arg1, $arg2) {
+ echo "option: ", $option, ", ", $arg1, ", ", $arg2, "\n";
+ return false;
+ }
}
var_dump(stream_wrapper_register('test', 'test_wrapper'));
@@ -32,6 +32,5 @@ bool(true)
option: 3, 2, 50
int(-1)
int(8192)
-size: 42
-size: 28
+size: 70
int(70)
diff --git a/ext/standard/tests/file/userstreams_007.phpt b/ext/standard/tests/file/userstreams_007.phpt
index b3e52bb098..31a7e4f872 100644
--- a/ext/standard/tests/file/userstreams_007.phpt
+++ b/ext/standard/tests/file/userstreams_007.phpt
@@ -3,19 +3,19 @@ User-space streams: test metadata option
--FILE--
<?php
class test_wrapper {
- function stream_open($path, $mode, $openedpath) {
- return true;
- }
+ function stream_open($path, $mode, $openedpath) {
+ return true;
+ }
public function stream_metadata($path, $option, $var) {
- echo "metadata: $path, $option\n";
- if(is_array($var)) {
- echo join(",", $var);
- } else {
- echo $var;
- }
- echo "\n";
- return false;
- }
+ echo "metadata: $path, $option\n";
+ if(is_array($var)) {
+ echo join(",", $var);
+ } else {
+ echo $var;
+ }
+ echo "\n";
+ return false;
+ }
}
var_dump(stream_wrapper_register('test', 'test_wrapper'));
diff --git a/ext/standard/tests/file/userwrapper.phpt b/ext/standard/tests/file/userwrapper.phpt
index dd4f0d3dd1..6e516d68db 100644
--- a/ext/standard/tests/file/userwrapper.phpt
+++ b/ext/standard/tests/file/userwrapper.phpt
@@ -20,9 +20,9 @@ class test {
}
function url_stat($path, $options) {
- /* By printing out a notice that we are actively stating the file
- then subsequently performing multiple stat operations on it
- we effectively test the stat cache mechanism */
+ /* By printing out a notice that we are actively stating the file
+ then subsequently performing multiple stat operations on it
+ we effectively test the stat cache mechanism */
print "Stating file: $path\n";
return array('dev'=>1, 'ino'=>2, 'mode'=>0644, 'nlink'=>3,
'uid'=>100, 'gid'=>1000, 'rdev'=>-1, 'size'=>31337,
diff --git a/ext/standard/tests/file/windows_acls/bug44859.phpt b/ext/standard/tests/file/windows_acls/bug44859.phpt
index 679734b379..513c3a6af8 100644
--- a/ext/standard/tests/file/windows_acls/bug44859.phpt
+++ b/ext/standard/tests/file/windows_acls/bug44859.phpt
@@ -12,42 +12,42 @@ include_once __DIR__ . '/common.inc';
fix_acls();
$iteration = array(
- PHPT_ACL_READ => false,
- PHPT_ACL_NONE => false,
- PHPT_ACL_WRITE => true,
- PHPT_ACL_WRITE|PHPT_ACL_READ => true,
+ PHPT_ACL_READ => false,
+ PHPT_ACL_NONE => false,
+ PHPT_ACL_WRITE => true,
+ PHPT_ACL_WRITE|PHPT_ACL_READ => true,
);
echo "Testing file:\n";
$i = 1;
$path = $uniqueBasePath . '_file.txt';
foreach ($iteration as $perms => $exp) {
- create_file($path, $perms);
- clearstatcache(true, $path);
- echo 'Iteration #' . $i++ . ': ';
- if (is_writable($path) == $exp) {
- echo "passed.\n";
- } else {
- var_dump(is_writable($path), $exp);
- echo "failed.\n";
- }
- delete_file($path);
+ create_file($path, $perms);
+ clearstatcache(true, $path);
+ echo 'Iteration #' . $i++ . ': ';
+ if (is_writable($path) == $exp) {
+ echo "passed.\n";
+ } else {
+ var_dump(is_writable($path), $exp);
+ echo "failed.\n";
+ }
+ delete_file($path);
}
echo "Testing directory:\n";
$path = $uniqueBasePath . '_dir';
$i = 1;
foreach ($iteration as $perms => $exp) {
- create_dir($path, $perms);
- clearstatcache(true, $path);
- echo 'Iteration #' . $i++ . ': ';
- if (is_writable($path) == $exp) {
- echo "passed.\n";
- } else {
- var_dump(is_writable($path), $exp);
- echo "failed.\n";
- }
- delete_dir($path);
+ create_dir($path, $perms);
+ clearstatcache(true, $path);
+ echo 'Iteration #' . $i++ . ': ';
+ if (is_writable($path) == $exp) {
+ echo "passed.\n";
+ } else {
+ var_dump(is_writable($path), $exp);
+ echo "failed.\n";
+ }
+ delete_dir($path);
}
?>
diff --git a/ext/standard/tests/file/windows_acls/bug44859_2.phpt b/ext/standard/tests/file/windows_acls/bug44859_2.phpt
index b88d07f820..4b5fd9e139 100644
--- a/ext/standard/tests/file/windows_acls/bug44859_2.phpt
+++ b/ext/standard/tests/file/windows_acls/bug44859_2.phpt
@@ -12,42 +12,42 @@ include_once __DIR__ . '/common.inc';
fix_acls();
$iteration = array(
- PHPT_ACL_READ => true,
- PHPT_ACL_NONE => false,
- PHPT_ACL_WRITE => false,
- PHPT_ACL_WRITE|PHPT_ACL_READ => true,
+ PHPT_ACL_READ => true,
+ PHPT_ACL_NONE => false,
+ PHPT_ACL_WRITE => false,
+ PHPT_ACL_WRITE|PHPT_ACL_READ => true,
);
echo "Testing file:\n";
$i = 1;
$path = $uniqueBasePath . '_file.txt';
foreach ($iteration as $perms => $exp) {
- create_file($path, $perms);
- clearstatcache(true, $path);
- echo 'Iteration #' . $i++ . ': ';
- if (is_readable($path) == $exp) {
- echo "passed.\n";
- } else {
- var_dump(is_readable($path), $exp);
- echo "failed.\n";
- }
- delete_file($path);
+ create_file($path, $perms);
+ clearstatcache(true, $path);
+ echo 'Iteration #' . $i++ . ': ';
+ if (is_readable($path) == $exp) {
+ echo "passed.\n";
+ } else {
+ var_dump(is_readable($path), $exp);
+ echo "failed.\n";
+ }
+ delete_file($path);
}
echo "Testing directory:\n";
$path = $uniqueBasePath . '_dir';
$i = 1;
foreach ($iteration as $perms => $exp) {
- create_dir($path, $perms);
- clearstatcache(true, $path);
- echo 'Iteration #' . $i++ . ': ';
- if (is_readable($path) == $exp) {
- echo "passed.\n";
- } else {
- var_dump(is_readable($path), $exp);
- echo "failed.\n";
- }
- delete_dir($path);
+ create_dir($path, $perms);
+ clearstatcache(true, $path);
+ echo 'Iteration #' . $i++ . ': ';
+ if (is_readable($path) == $exp) {
+ echo "passed.\n";
+ } else {
+ var_dump(is_readable($path), $exp);
+ echo "failed.\n";
+ }
+ delete_dir($path);
}
?>
diff --git a/ext/standard/tests/file/windows_acls/bug44859_3.phpt b/ext/standard/tests/file/windows_acls/bug44859_3.phpt
index 35db1f29be..465c7557ac 100644
--- a/ext/standard/tests/file/windows_acls/bug44859_3.phpt
+++ b/ext/standard/tests/file/windows_acls/bug44859_3.phpt
@@ -11,23 +11,23 @@ include_once __DIR__ . '/common.inc';
fix_acls();
$iteration = array(
- 'tiny.exe' => true,
- //'tiny.bat' => true, To be fixed in _access
- __FILE__ => false
+ 'tiny.exe' => true,
+ //'tiny.bat' => true, To be fixed in _access
+ __FILE__ => false
);
$i = 1;
$path = __DIR__;
foreach ($iteration as $file => $exp) {
- $path = __DIR__ . '/' . $file;
- echo 'Iteration #' . $i++ . ': ';
- if (is_executable($path) == $exp) {
- echo "passed.\n";
- } else {
- var_dump(is_executable($path), $exp);
- echo "failed.\n";
- }
+ $path = __DIR__ . '/' . $file;
+ echo 'Iteration #' . $i++ . ': ';
+ if (is_executable($path) == $exp) {
+ echo "passed.\n";
+ } else {
+ var_dump(is_executable($path), $exp);
+ echo "failed.\n";
+ }
}
diff --git a/ext/standard/tests/file/windows_acls/bug44859_4.phpt b/ext/standard/tests/file/windows_acls/bug44859_4.phpt
index e0fbe11f4b..483438bcf6 100644
--- a/ext/standard/tests/file/windows_acls/bug44859_4.phpt
+++ b/ext/standard/tests/file/windows_acls/bug44859_4.phpt
@@ -14,42 +14,42 @@ include_once __DIR__ . '/common.inc';
fix_acls();
$iteration = array(
- PHPT_ACL_READ => true,
- PHPT_ACL_NONE => false,
- PHPT_ACL_WRITE => false,
- PHPT_ACL_WRITE|PHPT_ACL_READ => true,
+ PHPT_ACL_READ => true,
+ PHPT_ACL_NONE => false,
+ PHPT_ACL_WRITE => false,
+ PHPT_ACL_WRITE|PHPT_ACL_READ => true,
);
echo "Testing file with relative path:\n";
$i = 1;
$path = './' . $uniqueBaseName . '_file.txt';
foreach ($iteration as $perms => $exp) {
- create_file($path, $perms);
- clearstatcache(true, $path);
- echo 'Iteration #' . $i++ . ': ';
- if (is_readable($path) == $exp) {
- echo "passed.\n";
- } else {
- var_dump(is_readable($path), $exp);
- echo "failed.\n";
- }
- delete_file($path);
+ create_file($path, $perms);
+ clearstatcache(true, $path);
+ echo 'Iteration #' . $i++ . ': ';
+ if (is_readable($path) == $exp) {
+ echo "passed.\n";
+ } else {
+ var_dump(is_readable($path), $exp);
+ echo "failed.\n";
+ }
+ delete_file($path);
}
echo "Testing directory with relative path:\n";
$path = $uniqueBaseName . '_dir';
$i = 1;
foreach ($iteration as $perms => $exp) {
- create_dir($path, $perms);
- clearstatcache(true, $path);
- echo 'Iteration #' . $i++ . ': ';
- if (is_readable($path) == $exp) {
- echo "passed.\n";
- } else {
- var_dump(is_readable($path), $exp);
- echo "failed.\n";
- }
- delete_dir($path);
+ create_dir($path, $perms);
+ clearstatcache(true, $path);
+ echo 'Iteration #' . $i++ . ': ';
+ if (is_readable($path) == $exp) {
+ echo "passed.\n";
+ } else {
+ var_dump(is_readable($path), $exp);
+ echo "failed.\n";
+ }
+ delete_dir($path);
}
?>
diff --git a/ext/standard/tests/file/windows_acls/common.inc b/ext/standard/tests/file/windows_acls/common.inc
index 5d4b402840..b3490ebb43 100644
--- a/ext/standard/tests/file/windows_acls/common.inc
+++ b/ext/standard/tests/file/windows_acls/common.inc
@@ -10,161 +10,161 @@ define('PHPT_ACL_GRANT', 1);
define('PHPT_ACL_DENY', 2);
function skipif() {
- if(substr(PHP_OS, 0, 3) != 'WIN' ) {
- die('skip windows only test');
- }
- if(stripos(php_uname(), 'XP') !== FALSE) {
- die('skip windows 2003 or newer only test');
- }
+ if(substr(PHP_OS, 0, 3) != 'WIN' ) {
+ die('skip windows only test');
+ }
+ if(stripos(php_uname(), 'XP') !== FALSE) {
+ die('skip windows 2003 or newer only test');
+ }
}
function get_username(){
- $user = getenv('USERNAME');
+ $user = getenv('USERNAME');
- if (!$user) {
- $user = get_current_user();
- }
+ if (!$user) {
+ $user = get_current_user();
+ }
- if (!$user) {
- $user = exec('echo %USERNAME%');
- }
+ if (!$user) {
+ $user = exec('echo %USERNAME%');
+ }
- return $user;
+ return $user;
}
function get_domainname()
{
- $domain = getenv('USERDOMAIN');
+ $domain = getenv('USERDOMAIN');
- return $domain;
+ return $domain;
}
function get_icacls()
{
- $sysroot = exec('echo %SYSTEMROOT%');
+ $sysroot = exec('echo %SYSTEMROOT%');
- return "$sysroot\\System32\\icacls.exe";
+ return "$sysroot\\System32\\icacls.exe";
}
function fix_acls() {
- $user = get_username();
- /* Current user needs to be owner of the test files. As well
- all the other users having acls on the files must loose them.
- The following fixes this just partially, as dynamically reading
- all the users having acls on a file could be sophisticated. */
- exec(get_icacls() . ' ' . __DIR__ . ' /setowner ' . escapeshellarg($user) . ' /T /L /Q /C > nul 2>&1');
- exec(get_icacls() . ' ' . __DIR__ . ' /remove:g Administrators /T /L /Q /C > nul 2>&1');
+ $user = get_username();
+ /* Current user needs to be owner of the test files. As well
+ all the other users having acls on the files must loose them.
+ The following fixes this just partially, as dynamically reading
+ all the users having acls on a file could be sophisticated. */
+ exec(get_icacls() . ' ' . __DIR__ . ' /setowner ' . escapeshellarg($user) . ' /T /L /Q /C > nul 2>&1');
+ exec(get_icacls() . ' ' . __DIR__ . ' /remove:g Administrators /T /L /Q /C > nul 2>&1');
}
function icacls_set($path, $mode, $perm) {
- $icacls = get_icacls();
- $user = get_username();
- $path_escaped = '"' . $path . '"';
- $perm_entry = array();
-
- if ($perm & PHPT_ACL_READ) $perm_entry[] = 'R';
- if ($perm & PHPT_ACL_WRITE) $perm_entry[] = 'W';
- if ($perm & PHPT_ACL_EXEC) $perm_entry[] = 'RX';
- if ($perm & PHPT_ACL_FULL) $perm_entry[] = 'F';
-
- // Deny all
- $cmd = $icacls . ' ' . $path_escaped . ' /inheritance:r /deny ' . $user . ':(F,M,R,RX,W)';
- exec($cmd);
-
- if ($perm & PHPT_ACL_NONE) {
- /*
- This is required to remove all the previously denied
- permission for the USER. Just granting permission doesn't
- remove the previously denied permission.
- */
- $cmd = $icacls . ' ' . $path_escaped . ' /remove:d ' . $user;
- exec($cmd);
- $cmd = $icacls . ' ' . $path_escaped . ' /remove:g ' . $user;
- exec($cmd);
- return;
- }
-
- if ($mode == PHPT_ACL_GRANT) {
- $mode = 'grant';
- } else {
- $mode = 'deny';
- }
-
-
- // Deny all
- $cmd = $icacls . ' ' . $path_escaped . ' /deny ' . $user . ':(F,M,R,RX,W)';
- exec($cmd);
-
- /*
- This is required to remove all the previously denied
- permission for the USER. Just granting permission doesn't
- remove the previously denied permission.
- */
- $cmd = $icacls . ' ' . $path_escaped . ' /remove:d ' . $user;
- exec($cmd);
- $cmd = $icacls . ' ' . $path_escaped . ' /remove:g ' . $user;
- exec($cmd);
-
-
- /*
- Required to set no permission and check that is_readable()
- returns false. If the $perm_entry contains 'N' skip this step.
- This will make the file/dir with NO aceess.
- */
- if (!in_array('N', $perm_entry)) {
- /*
- This is required to remove all the previously denied
- permission for the USER. Just granting permission doesn't
- remove the previously denied permission.
- */
- $cmd = $icacls . ' ' . $path_escaped . ' /remove:d ' . $user;
- exec($cmd);
- $cmd = $icacls . ' ' . $path_escaped . ' /remove:g ' . $user;
- exec($cmd);
-
- $cmd = $icacls . ' ' . $path_escaped . ' /' . $mode . ' ' . $user;
- $cmd .= ':' . '(' . implode(',', $perm_entry) . ')';
- exec($cmd);
- }
+ $icacls = get_icacls();
+ $user = get_username();
+ $path_escaped = '"' . $path . '"';
+ $perm_entry = array();
+
+ if ($perm & PHPT_ACL_READ) $perm_entry[] = 'R';
+ if ($perm & PHPT_ACL_WRITE) $perm_entry[] = 'W';
+ if ($perm & PHPT_ACL_EXEC) $perm_entry[] = 'RX';
+ if ($perm & PHPT_ACL_FULL) $perm_entry[] = 'F';
+
+ // Deny all
+ $cmd = $icacls . ' ' . $path_escaped . ' /inheritance:r /deny ' . $user . ':(F,M,R,RX,W)';
+ exec($cmd);
+
+ if ($perm & PHPT_ACL_NONE) {
+ /*
+ This is required to remove all the previously denied
+ permission for the USER. Just granting permission doesn't
+ remove the previously denied permission.
+ */
+ $cmd = $icacls . ' ' . $path_escaped . ' /remove:d ' . $user;
+ exec($cmd);
+ $cmd = $icacls . ' ' . $path_escaped . ' /remove:g ' . $user;
+ exec($cmd);
+ return;
+ }
+
+ if ($mode == PHPT_ACL_GRANT) {
+ $mode = 'grant';
+ } else {
+ $mode = 'deny';
+ }
+
+
+ // Deny all
+ $cmd = $icacls . ' ' . $path_escaped . ' /deny ' . $user . ':(F,M,R,RX,W)';
+ exec($cmd);
+
+ /*
+ This is required to remove all the previously denied
+ permission for the USER. Just granting permission doesn't
+ remove the previously denied permission.
+ */
+ $cmd = $icacls . ' ' . $path_escaped . ' /remove:d ' . $user;
+ exec($cmd);
+ $cmd = $icacls . ' ' . $path_escaped . ' /remove:g ' . $user;
+ exec($cmd);
+
+
+ /*
+ Required to set no permission and check that is_readable()
+ returns false. If the $perm_entry contains 'N' skip this step.
+ This will make the file/dir with NO aceess.
+ */
+ if (!in_array('N', $perm_entry)) {
+ /*
+ This is required to remove all the previously denied
+ permission for the USER. Just granting permission doesn't
+ remove the previously denied permission.
+ */
+ $cmd = $icacls . ' ' . $path_escaped . ' /remove:d ' . $user;
+ exec($cmd);
+ $cmd = $icacls . ' ' . $path_escaped . ' /remove:g ' . $user;
+ exec($cmd);
+
+ $cmd = $icacls . ' ' . $path_escaped . ' /' . $mode . ' ' . $user;
+ $cmd .= ':' . '(' . implode(',', $perm_entry) . ')';
+ exec($cmd);
+ }
}
function create_dir($name, $perms) {
- if (empty($name)) {
- echo "create_dir: Empty name is not allowed\n";
- return;
- }
-
- mkdir($name);
- $dst = realpath($name);
- icacls_set($name, PHPT_ACL_GRANT, $perms);
+ if (empty($name)) {
+ echo "create_dir: Empty name is not allowed\n";
+ return;
+ }
+
+ mkdir($name);
+ $dst = realpath($name);
+ icacls_set($name, PHPT_ACL_GRANT, $perms);
}
function create_file($name, $perms) {
- if (empty($name)) {
- echo "create_file: Empty name is not allowed\n";
- return;
- }
+ if (empty($name)) {
+ echo "create_file: Empty name is not allowed\n";
+ return;
+ }
- touch($name);
- icacls_set($name, PHPT_ACL_GRANT, $perms);
+ touch($name);
+ icacls_set($name, PHPT_ACL_GRANT, $perms);
}
function delete_file($path) {
- icacls_set($path, PHPT_ACL_GRANT, PHPT_ACL_FULL);
- if (is_file($path)) {
- unlink($path);
- } else {
- echo "delete_file: '$path' is not a file\n";
- return;
- }
+ icacls_set($path, PHPT_ACL_GRANT, PHPT_ACL_FULL);
+ if (is_file($path)) {
+ unlink($path);
+ } else {
+ echo "delete_file: '$path' is not a file\n";
+ return;
+ }
}
function delete_dir($path) {
- if (is_dir($path)) {
- icacls_set($path, PHPT_ACL_GRANT, PHPT_ACL_FULL);
- rmdir($path);
- } else {
- echo "delete_dir: '$path' is not a directory\n";
- return;
- }
+ if (is_dir($path)) {
+ icacls_set($path, PHPT_ACL_GRANT, PHPT_ACL_FULL);
+ rmdir($path);
+ } else {
+ echo "delete_dir: '$path' is not a directory\n";
+ return;
+ }
}
diff --git a/ext/standard/tests/file/windows_links/bug78862.phpt b/ext/standard/tests/file/windows_links/bug78862.phpt
index 33b4b49293..3bd787e705 100644
--- a/ext/standard/tests/file/windows_links/bug78862.phpt
+++ b/ext/standard/tests/file/windows_links/bug78862.phpt
@@ -7,9 +7,11 @@ var_dump(link(__DIR__ . "/bug78862.target\0more", __DIR__ . "/bug78862.link\0mor
var_dump(file_exists(__DIR__ . '/bug78862.link'));
?>
--EXPECTF--
-Warning: link() expects parameter 1 to be a valid path, string given in %s on line %d
-NULL
-bool(false)
+Fatal error: Uncaught TypeError: link() expects parameter 1 to be a valid path, string given in %s:%d
+Stack trace:
+#0 %s(%d): link('%s', '%s')
+#1 {main}
+ thrown in %s on line %d
--CLEAN--
<?php
unlink(__DIR__ . '/bug78862.target');
diff --git a/ext/standard/tests/file/windows_links/common.inc b/ext/standard/tests/file/windows_links/common.inc
index 505368b8b0..4d4409e9d8 100644
--- a/ext/standard/tests/file/windows_links/common.inc
+++ b/ext/standard/tests/file/windows_links/common.inc
@@ -1,23 +1,23 @@
<?php
function get_sysroot() {
- // usually c:\\windows, but not always
- return exec('echo %SYSTEMROOT%');
+ // usually c:\\windows, but not always
+ return exec('echo %SYSTEMROOT%');
}
function get_junction(){
- // junction.exe isn't included with Windows
- // its a sysinternals tool for working with filesystem links
- // see: http://technet.microsoft.com/en-us/sysinternals/bb896768
+ // junction.exe isn't included with Windows
+ // its a sysinternals tool for working with filesystem links
+ // see: http://technet.microsoft.com/en-us/sysinternals/bb896768
- // install somewhere that is on %path% or added to %path%
- return "junction.exe";
+ // install somewhere that is on %path% or added to %path%
+ return "junction.exe";
}
function get_mountvol() {
- $sysroot = get_sysroot();
+ $sysroot = get_sysroot();
- return "$sysroot\\System32\\mountvol.exe";
+ return "$sysroot\\System32\\mountvol.exe";
}
?>
diff --git a/ext/standard/tests/file/windows_links/readlink_compat.phpt b/ext/standard/tests/file/windows_links/readlink_compat.phpt
index e119473895..b4ac07682e 100644
--- a/ext/standard/tests/file/windows_links/readlink_compat.phpt
+++ b/ext/standard/tests/file/windows_links/readlink_compat.phpt
@@ -20,7 +20,7 @@ mkdir($tmpDir);
// mounted volume
$volume = trim(exec('mountvol C: /L'));
exec(sprintf('mountvol "%s" %s', $tmpDir, $volume));
-var_dump(readlink($tmpDir));
+var_dump(readlink($tmpDir));
exec(sprintf('mountvol "%s" /D', $tmpDir));
mkdir($tmpDir . '\\test\\directory', 0777, true);
@@ -35,7 +35,7 @@ rmdir($link);
// junction to a directory
$link = $tmpDir . '\\test\\directory_junction';
$target = $tmpDir . '\\test\\directory';
-exec(sprintf('mklink /J "%s" "%s"', $link, $target));
+exec(sprintf('mklink /J "%s" "%s"', $link, $target));
var_dump(readlink($link));
rmdir($link);
@@ -56,7 +56,7 @@ fclose($fh);
// symlink to a file (absolute and relative)
$link = $tmpDir . '\\test\\file_symlink';
-exec(sprintf('mklink "%s" "%s"', $link, $filename));
+exec(sprintf('mklink "%s" "%s"', $link, $filename));
var_dump(readlink($link));
unlink($link);
exec(sprintf('mklink "%s" directory\\a.php', $link));
@@ -64,7 +64,7 @@ var_dump(readlink($link));
unlink($link);
// unexpected behaviour
-echo "\n*** Unexpected behaviour when not a reparse point\n";
+echo "\n*** Unexpected behaviour when not a reparse point\n";
var_dump(readlink($tmpDir . '\\test\\directory'));
var_dump(readlink($filename));
diff --git a/ext/standard/tests/file/windows_mb_path/bug54028.phpt b/ext/standard/tests/file/windows_mb_path/bug54028.phpt
index 7b304c70f4..6f3e6dab51 100644
--- a/ext/standard/tests/file/windows_mb_path/bug54028.phpt
+++ b/ext/standard/tests/file/windows_mb_path/bug54028.phpt
@@ -22,28 +22,27 @@ $dirs = array("a", "ソ", "ゾ", "şŞıİğĞ", "多国語", "王", "汚れã¦æ
mkdir($prefix);
foreach ($dirs as $d) {
- mkdir($prefix . $d);
+ mkdir($prefix . $d);
}
$directory = dir($prefix);
while (false !== ($content = $directory->read())) {
- if ("." == $content || ".." == $content) continue;
+ if ("." == $content || ".." == $content) continue;
printf("Returned (%s)\n", $content);
printf("Encoding: %s\n", mb_detect_encoding($content));
if ($content != get_basename_with_cp($prefix . $content, 65001, false)) {
- echo "Verification failed!\n";
- }
- echo "\n";
+ echo "Verification failed!\n";
+ }
+ echo "\n";
}
foreach ($dirs as $d) {
- rmdir($prefix . $d);
+ rmdir($prefix . $d);
}
rmdir($prefix);
?>
-===DONE===
--EXPECT--
Returned (a)
Encoding: ASCII
@@ -66,4 +65,3 @@ Encoding: UTF-8
Returned (王)
Encoding: UTF-8
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/bug54028_2.phpt b/ext/standard/tests/file/windows_mb_path/bug54028_2.phpt
index 81be60e640..d6ef5925a8 100644
--- a/ext/standard/tests/file/windows_mb_path/bug54028_2.phpt
+++ b/ext/standard/tests/file/windows_mb_path/bug54028_2.phpt
@@ -22,25 +22,24 @@ $dirs = array("a", "ソ", "ゾ", "şŞıİğĞ", "多国語", "王", "汚れã¦æ
mkdir($prefix);
foreach ($dirs as $d) {
- mkdir($prefix . $d);
+ mkdir($prefix . $d);
}
$old_cwd = getcwd();
foreach ($dirs as $d) {
- $now = $prefix . $d;
- var_dump(chdir($now));
- var_dump($dn = realpath("."));
- var_dump($d == get_basename_with_cp($dn, 65001, false));
+ $now = $prefix . $d;
+ var_dump(chdir($now));
+ var_dump($dn = realpath("."));
+ var_dump($d == get_basename_with_cp($dn, 65001, false));
}
chdir($old_cwd);
foreach ($dirs as $d) {
- rmdir($prefix . $d);
+ rmdir($prefix . $d);
}
rmdir($prefix);
?>
-===DONE===
--EXPECTF--
bool(true)
string(%d) "%sa"
@@ -63,4 +62,3 @@ bool(true)
bool(true)
string(%d) "%s汚れã¦æŽ˜ã‚‹"
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/bug54977.phpt b/ext/standard/tests/file/windows_mb_path/bug54977.phpt
index 173aed480f..5edead63ed 100644
--- a/ext/standard/tests/file/windows_mb_path/bug54977.phpt
+++ b/ext/standard/tests/file/windows_mb_path/bug54977.phpt
@@ -22,24 +22,23 @@ $paths = array("多国語", "王", "汚れã¦æŽ˜ã‚‹");
mkdir($prefix);
foreach ($paths as $d) {
- mkdir($prefix . $d);
- file_put_contents($prefix . $d . ".test", $d);
+ mkdir($prefix . $d);
+ file_put_contents($prefix . $d . ".test", $d);
}
$myDirectory = opendir($prefix);
while($entryName = readdir($myDirectory)) {
- echo get_basename_with_cp($prefix . $entryName, 65001, false) . "\n";
+ echo get_basename_with_cp($prefix . $entryName, 65001, false) . "\n";
}
closedir($myDirectory);
foreach ($paths as $d) {
- rmdir($prefix . $d);
- unlink($prefix . $d . ".test");
+ rmdir($prefix . $d);
+ unlink($prefix . $d . ".test");
}
rmdir($prefix);
?>
-===DONE===
--EXPECT--
testBug54977
windows_mb_path
@@ -49,4 +48,3 @@ windows_mb_path
汚れã¦æŽ˜ã‚‹.test
王
王.test
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/bug61315.phpt b/ext/standard/tests/file/windows_mb_path/bug61315.phpt
index 1e97636175..8729aafe09 100644
--- a/ext/standard/tests/file/windows_mb_path/bug61315.phpt
+++ b/ext/standard/tests/file/windows_mb_path/bug61315.phpt
@@ -44,7 +44,6 @@ rmdir($d1);
rmdir($prefix);
?>
-===DONE===
--EXPECTF--
Active code page: 65001
getting basename of %s\ソフト
@@ -60,4 +59,3 @@ string(%d) "%s\フォルダ"
Active code page: %d
bool(true)
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/bug64506.phpt b/ext/standard/tests/file/windows_mb_path/bug64506.phpt
index 44d5c6f5f7..0bcf0d778c 100644
--- a/ext/standard/tests/file/windows_mb_path/bug64506.phpt
+++ b/ext/standard/tests/file/windows_mb_path/bug64506.phpt
@@ -22,9 +22,9 @@ $fnw = __DIR__ . DIRECTORY_SEPARATOR . "Å¡.txt"; // UTF-8
$f = fopen($fnw, 'w');
if ($f) {
- var_dump($f, fwrite($f, "writing to an mb filename"));
+ var_dump($f, fwrite($f, "writing to an mb filename"));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
var_dump(fclose($f));
@@ -35,7 +35,6 @@ get_basename_with_cp($fnw, 65001);
var_dump(unlink($fnw));
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
int(25)
@@ -48,4 +47,3 @@ bool(true)
string(%d) "%s\Å¡.txt"
Active code page: %d
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/bug64699.phpt b/ext/standard/tests/file/windows_mb_path/bug64699.phpt
index db488c15ed..20d4182b71 100644
--- a/ext/standard/tests/file/windows_mb_path/bug64699.phpt
+++ b/ext/standard/tests/file/windows_mb_path/bug64699.phpt
@@ -25,7 +25,7 @@ $dirs = array("a", "ソ", "ゾ", "şŞıİğĞ", "多国語", "表");
mkdir($prefix);
foreach ($dirs as $d) {
- mkdir($prefix . $d);
+ mkdir($prefix . $d);
}
$dir = $prefix;
@@ -41,14 +41,13 @@ if ($dh = opendir($dir)) {
}
foreach ($dirs as $d) {
- rmdir($prefix . $d);
+ rmdir($prefix . $d);
}
rmdir($prefix);
set_active_cp($old_cp);
?>
-===DONE===
--EXPECTF--
Active code page: 65001
filetype()[dir ] == is_dir()[dir ] -> OK: .
@@ -60,4 +59,3 @@ filetype()[dir ] == is_dir()[dir ] -> OK: ゾ
filetype()[dir ] == is_dir()[dir ] -> OK: 多国語
filetype()[dir ] == is_dir()[dir ] -> OK: 表
Active code page: %d
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/bug70903.phpt b/ext/standard/tests/file/windows_mb_path/bug70903.phpt
index 8d529484be..48cbf524c9 100644
--- a/ext/standard/tests/file/windows_mb_path/bug70903.phpt
+++ b/ext/standard/tests/file/windows_mb_path/bug70903.phpt
@@ -37,7 +37,6 @@ rmdir($d0);
rmdir($prefix);
?>
-===DONE===
--EXPECTF--
Active code page: 65001
getting basename of %s\ı
@@ -46,4 +45,3 @@ bool(true)
string(%d) "%s\ı"
Active code page: %d
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/bug71509.phpt b/ext/standard/tests/file/windows_mb_path/bug71509.phpt
index ed094c6b7a..377b5d7e2a 100644
--- a/ext/standard/tests/file/windows_mb_path/bug71509.phpt
+++ b/ext/standard/tests/file/windows_mb_path/bug71509.phpt
@@ -37,8 +37,6 @@ var_dump(file_exists($outputfile_zip));
remove_data("bug71509");
?>
-===DONE===
--EXPECT--
bool(true)
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/bug74923.phpt b/ext/standard/tests/file/windows_mb_path/bug74923.phpt
index 210a49732f..9cffd5860f 100644
--- a/ext/standard/tests/file/windows_mb_path/bug74923.phpt
+++ b/ext/standard/tests/file/windows_mb_path/bug74923.phpt
@@ -12,15 +12,13 @@ if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
<?php
/* No way to affect timeout here. On different systems this might take some
- dozens of seconds to complete. */
+ dozens of seconds to complete. */
$s = '\\\\hello.com' . str_repeat('\\', 260);
var_dump($s, @stat($s));
?>
-===DONE===
--EXPECTF--
string(271) "%s"
bool(false)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/bug75063_cp1251.phpt b/ext/standard/tests/file/windows_mb_path/bug75063_cp1251.phpt
index a56fecbbe3..32cb2adead 100644
--- a/ext/standard/tests/file/windows_mb_path/bug75063_cp1251.phpt
+++ b/ext/standard/tests/file/windows_mb_path/bug75063_cp1251.phpt
@@ -34,16 +34,16 @@ $code = <<<CODE
<?php
foreach(["test", "òàñò"] as \$fn) {
- file_put_contents("\$fn.txt", "");
+ file_put_contents("\$fn.txt", "");
}
var_dump(getcwd());
if (\$dh = opendir(getcwd())) {
- while ((\$file = readdir(\$dh)) !== false) {
- if ("." == \$file || ".." == \$file) continue;
- var_dump(\$file);
- }
- closedir(\$dh);
+ while ((\$file = readdir(\$dh)) !== false) {
+ if ("." == \$file || ".." == \$file) continue;
+ var_dump(\$file);
+ }
+ closedir(\$dh);
}
CODE;
$code_fn = "code.php";
@@ -53,7 +53,7 @@ print(shell_exec(getenv('TEST_PHP_EXECUTABLE') . " -n -d default_charset=cp1251
chdir($old_cwd);
-/* --CLEAN-- section were the right place, but it won't accept default_charset ATM, it seems. */
+/*--CLEAN-- section were the right place, but it won't accept default_charset ATM, it seems. */
$dir_basename = "òåñò";
$prefix = __DIR__ . DIRECTORY_SEPARATOR . "bug75063-cp1251";
$d0 = $prefix . DIRECTORY_SEPARATOR . $dir_basename;
@@ -67,7 +67,6 @@ foreach ($obj as $file) {
rmdir($d0);
rmdir($prefix);
?>
-===DONE===
--EXPECTF--
string(4) "òåñò"
bool(true)
@@ -75,4 +74,3 @@ string(%d) "%sbug75063-cp1251%eòåñò"
string(8) "code.php"
string(8) "test.txt"
string(8) "òàñò.txt"
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/bug75063_utf8.phpt b/ext/standard/tests/file/windows_mb_path/bug75063_utf8.phpt
index beaf690dea..b8235c8842 100644
--- a/ext/standard/tests/file/windows_mb_path/bug75063_utf8.phpt
+++ b/ext/standard/tests/file/windows_mb_path/bug75063_utf8.phpt
@@ -32,16 +32,16 @@ $code = <<<CODE
<?php
foreach(["test", "таÑÑ‚"] as \$fn) {
- file_put_contents("\$fn.txt", "");
+ file_put_contents("\$fn.txt", "");
}
var_dump(getcwd());
if (\$dh = opendir(getcwd())) {
- while ((\$file = readdir(\$dh)) !== false) {
- if ("." == \$file || ".." == \$file) continue;
- var_dump(\$file);
- }
- closedir(\$dh);
+ while ((\$file = readdir(\$dh)) !== false) {
+ if ("." == \$file || ".." == \$file) continue;
+ var_dump(\$file);
+ }
+ closedir(\$dh);
}
CODE;
$code_fn = "code.php";
@@ -52,7 +52,6 @@ print(shell_exec(getenv('TEST_PHP_EXECUTABLE') . " -nf code.php"));
chdir($old_cwd);
?>
-===DONE===
--CLEAN--
<?php
$dir_basename = "теÑÑ‚";
@@ -76,4 +75,3 @@ string(%d) "%sbug75063-utf8%eтеÑÑ‚"
string(8) "code.php"
string(8) "test.txt"
string(12) "таÑÑ‚.txt"
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/recursive_it.phpt b/ext/standard/tests/file/windows_mb_path/recursive_it.phpt
index b42f796ee3..fb97086b2b 100644
--- a/ext/standard/tests/file/windows_mb_path/recursive_it.phpt
+++ b/ext/standard/tests/file/windows_mb_path/recursive_it.phpt
@@ -15,7 +15,7 @@ $need_len = 1024;
//$need_len = 259;
$dir = __DIR__;
while ($need_len - strlen($dir) > 32) {
- $dir .= DIRECTORY_SEPARATOR . str_repeat("a", 32);
+ $dir .= DIRECTORY_SEPARATOR . str_repeat("a", 32);
}
$dir .= DIRECTORY_SEPARATOR . str_repeat("a", $need_len - strlen($dir));
mkdir($dir, 0700, true);
@@ -26,39 +26,37 @@ file_put_contents($fl, "");
$start = substr($dir, 0, strpos($dir, DIRECTORY_SEPARATOR, strlen(__DIR__)+1));
$iter = new RecursiveIteratorIterator(
- new RecursiveDirectoryIterator(
- $start,
- FilesystemIterator::SKIP_DOTS
- ),
- RecursiveIteratorIterator::CHILD_FIRST
+ new RecursiveDirectoryIterator(
+ $start,
+ FilesystemIterator::SKIP_DOTS
+ ),
+ RecursiveIteratorIterator::CHILD_FIRST
);
foreach ($iter as $item) {
- if (!$item->isDir()) {
- var_dump($item->getPathname());
- }
+ if (!$item->isDir()) {
+ var_dump($item->getPathname());
+ }
}
$iter->rewind();
foreach ($iter as $item) {
- if ($item->isDir()) {
- rmdir($item->getPathname());
- } else {
- unlink($item->getPathname());
- }
+ if ($item->isDir()) {
+ rmdir($item->getPathname());
+ } else {
+ unlink($item->getPathname());
+ }
}
rmdir($start);
var_dump(file_exists($start));
/*unlink($fl);
do {
- rmdir($dir);
- $dir = dirname($dir);
+ rmdir($dir);
+ $dir = dirname($dir);
} while (__DIR__ != $dir);*/
?>
-==DONE==
--EXPECTF--
string(%d) "%shello.txt"
bool(false)
-==DONE==
diff --git a/ext/standard/tests/file/windows_mb_path/test_big5_0.phpt b/ext/standard/tests/file/windows_mb_path/test_big5_0.phpt
index 9390b3755f..41fd2e7552 100644
--- a/ext/standard/tests/file/windows_mb_path/test_big5_0.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_big5_0.phpt
@@ -27,19 +27,17 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "$item";
$f = fopen($fn, 'r');
if ($f) {
- var_dump($f, fread($f, 42));
- var_dump(fclose($f));
+ var_dump($f, fread($f, 42));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
remove_data("file_big5");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
string(%d) "reading file wihh multibyte filename
"
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_big5_1.phpt b/ext/standard/tests/file/windows_mb_path/test_big5_1.phpt
index ad16770381..b0caf3b73f 100644
--- a/ext/standard/tests/file/windows_mb_path/test_big5_1.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_big5_1.phpt
@@ -39,7 +39,6 @@ var_dump(rmdir($subpath));
remove_data("dir_big5");
?>
-===DONE===
--EXPECTF--
bool(true)
bool(true)
@@ -51,4 +50,3 @@ bool(true)
string(%d) "%s´ú¸Õ¦h¦r¸`¸ô®|5\´ú¸Õ¦h¦r¸`¸ô®|4"
Active code page: %d
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_big5_2.phpt b/ext/standard/tests/file/windows_mb_path/test_big5_2.phpt
index 088c46d7b6..5460ae9dfa 100644
--- a/ext/standard/tests/file/windows_mb_path/test_big5_2.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_big5_2.phpt
@@ -27,10 +27,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "{$item}25";
$f = fopen($fn, 'w');
if ($f) {
- var_dump($f, fwrite($f, "writing to an mb filename"));
- var_dump(fclose($f));
+ var_dump($f, fwrite($f, "writing to an mb filename"));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
var_dump(file_get_contents($fn));
@@ -42,7 +42,6 @@ var_dump(unlink($fn));
remove_data("file_big5");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
int(25)
@@ -55,4 +54,3 @@ bool(true)
string(%d) "%s測試多字節路徑25"
Active code page: %d
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_big5_to_utf8_0.phpt b/ext/standard/tests/file/windows_mb_path/test_big5_to_utf8_0.phpt
index f738b9f5be..0dcc09dae9 100644
--- a/ext/standard/tests/file/windows_mb_path/test_big5_to_utf8_0.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_big5_to_utf8_0.phpt
@@ -24,19 +24,17 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "$item";
$f = fopen($fn, 'r');
if ($f) {
- var_dump($f, fread($f, 42));
- var_dump(fclose($f));
+ var_dump($f, fread($f, 42));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
remove_data("file_big5");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
string(%d) "reading file wihh multibyte filename
"
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_big5_to_utf8_1.phpt b/ext/standard/tests/file/windows_mb_path/test_big5_to_utf8_1.phpt
index 45d87d1cbe..418e33f927 100644
--- a/ext/standard/tests/file/windows_mb_path/test_big5_to_utf8_1.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_big5_to_utf8_1.phpt
@@ -36,7 +36,6 @@ var_dump(rmdir($subpath));
remove_data("dir_big5");
?>
-===DONE===
--EXPECTF--
bool(true)
bool(true)
@@ -48,4 +47,3 @@ bool(true)
string(%d) "%s\測試多字節路徑5\測試多字節路徑4"
Active code page: %d
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_big5_to_utf8_2.phpt b/ext/standard/tests/file/windows_mb_path/test_big5_to_utf8_2.phpt
index 07f48eb218..6269aaf050 100644
--- a/ext/standard/tests/file/windows_mb_path/test_big5_to_utf8_2.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_big5_to_utf8_2.phpt
@@ -24,10 +24,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "{$item}25";
$f = fopen($fn, 'w');
if ($f) {
- var_dump($f, fwrite($f, "writing to an mb filename"));
- var_dump(fclose($f));
+ var_dump($f, fwrite($f, "writing to an mb filename"));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
var_dump(file_get_contents($fn));
@@ -39,7 +39,6 @@ var_dump(unlink($fn));
remove_data("file_big5");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
int(25)
@@ -52,4 +51,3 @@ bool(true)
string(%d) "%s\測試多字節路徑25"
Active code page: %d
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_0.phpt
index d7b093281e..10db18c19b 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_0.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_0.phpt
@@ -24,19 +24,17 @@ $fn = $prefix . DIRECTORY_SEPARATOR . $item;
$f = fopen($fn, 'r');
if ($f) {
- var_dump($f, fread($f, 42));
- var_dump(fclose($f));
+ var_dump($f, fread($f, 42));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
remove_data("file_cp1250");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
string(37) "reading file wihh multibyte filename
"
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_1.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_1.phpt
index 2c629e18ac..9276dcfc2d 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_1.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_1.phpt
@@ -36,7 +36,6 @@ var_dump(rmdir($subpath));
remove_data("dir_cp1250");
?>
-===DONE===
--EXPECTF--
bool(true)
bool(true)
@@ -48,4 +47,3 @@ bool(true)
string(%d) "%s\Å¡Ä‘Äćž_Å ÄČĆŽ42\Å¡Ä‘Äćž_Å ÄČĆŽ4"
Active code page: %d
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_2.phpt
index 77a5bf6a08..571daff094 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_2.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_2.phpt
@@ -24,10 +24,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "${item}33";
$f = fopen($fn, 'w');
if ($f) {
- var_dump($f, fwrite($f, "writing to an mb filename"));
- var_dump(fclose($f));
+ var_dump($f, fwrite($f, "writing to an mb filename"));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
var_dump(file_get_contents($fn));
@@ -37,7 +37,6 @@ get_basename_with_cp($fn, 65001);
remove_data("dir_cp1250");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
int(25)
@@ -49,4 +48,3 @@ string(23) "Å¡Ä‘Äćž_Å ÄČĆŽ33"
bool(true)
string(%d) "%s\Å¡Ä‘Äćž_Å ÄČĆŽ33"
Active code page: %d
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_3.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_3.phpt
index f88cb70ac6..568f56361b 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_3.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_3.phpt
@@ -24,19 +24,17 @@ $fn = $prefix . DIRECTORY_SEPARATOR . $item;
$f = fopen($fn, 'r');
if ($f) {
- var_dump($f, fread($f, 42));
- var_dump(fclose($f));
+ var_dump($f, fread($f, 42));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
remove_data("file_cp1250");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
string(37) "reading file wihh multibyte filename
"
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_4.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_4.phpt
index eca9479978..1d29fe7f98 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_4.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_4.phpt
@@ -36,7 +36,6 @@ var_dump(rmdir($subpath));
remove_data("dir_cp1250");
?>
-===DONE===
--EXPECTF--
bool(true)
bool(true)
@@ -48,4 +47,3 @@ bool(true)
string(%d) "%s\ÃrvíztűrÅ‘ tükörfúrógép42\ÃrvíztűrÅ‘ tükörfúrógép4"
Active code page: %d
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_5.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_5.phpt
index 910db7b04c..ef9e17b7f2 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_5.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1250_to_utf8_5.phpt
@@ -24,10 +24,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "${item}33";
$f = fopen($fn, 'w');
if ($f) {
- var_dump($f, fwrite($f, "writing to an mb filename"));
- var_dump(fclose($f));
+ var_dump($f, fwrite($f, "writing to an mb filename"));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
var_dump(file_get_contents($fn));
@@ -37,7 +37,6 @@ get_basename_with_cp($fn, 65001);
remove_data("dir_cp1250");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
int(25)
@@ -49,4 +48,3 @@ string(33) "ÃrvíztűrÅ‘ tükörfúrógép33"
bool(true)
string(%d) "%s\ÃrvíztűrÅ‘ tükörfúrógép33"
Active code page: %d
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1251_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1251_0.phpt
index 1688d75a02..d1c4f0f4fc 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1251_0.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1251_0.phpt
@@ -27,18 +27,16 @@ $fn = $prefix . DIRECTORY_SEPARATOR . $item;
$f = fopen($fn, 'r');
if ($f) {
- var_dump($f, fread($f, 42));
- var_dump(fclose($f));
+ var_dump($f, fread($f, 42));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
remove_data("file_cp1251");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
string(35) "opened an utf8 filename for reading"
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1251_1.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1251_1.phpt
index 049800a0aa..05eb269daa 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1251_1.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1251_1.phpt
@@ -39,7 +39,6 @@ var_dump(rmdir($subpath));
remove_data("dir_cp1251");
?>
-===DONE===
--EXPECTF--
bool(true)
bool(true)
@@ -51,4 +50,3 @@ bool(true)
string(%d) "%s\ïðèâåò3\ïðèâåò4"
Active code page: %d
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1251_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1251_2.phpt
index 7d3290d99e..1161747564 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1251_2.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1251_2.phpt
@@ -27,10 +27,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "${item}7";
$f = fopen($fn, 'w');
if ($f) {
- var_dump($f, fwrite($f, "writing to an mb filename"));
- var_dump(fclose($f));
+ var_dump($f, fwrite($f, "writing to an mb filename"));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
var_dump(file_get_contents($fn));
@@ -41,7 +41,6 @@ var_dump(unlink($fn));
remove_data("file_cp1251");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
int(25)
@@ -54,4 +53,3 @@ bool(true)
string(%d) "%s\ïðèâåò7"
Active code page: %d
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1251_to_utf8_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1251_to_utf8_0.phpt
index 27ba191d0d..b780065d90 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1251_to_utf8_0.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1251_to_utf8_0.phpt
@@ -24,18 +24,16 @@ $fn = $prefix . DIRECTORY_SEPARATOR . $item;
$f = fopen($fn, 'r');
if ($f) {
- var_dump($f, fread($f, 42));
- var_dump(fclose($f));
+ var_dump($f, fread($f, 42));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
remove_data("file_cp1251");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
string(35) "opened an utf8 filename for reading"
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1251_to_utf8_1.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1251_to_utf8_1.phpt
index a6baa4b9c1..5cabf45641 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1251_to_utf8_1.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1251_to_utf8_1.phpt
@@ -36,7 +36,6 @@ var_dump(rmdir($subpath));
remove_data("dir_cp1251");
?>
-===DONE===
--EXPECTF--
bool(true)
bool(true)
@@ -48,4 +47,3 @@ bool(true)
string(%d) "%s\привет3\привет4"
Active code page: %d
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1251_to_utf8_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1251_to_utf8_2.phpt
index c46bc48645..251fa2c000 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1251_to_utf8_2.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1251_to_utf8_2.phpt
@@ -24,10 +24,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "${item}7";
$f = fopen($fn, 'w');
if ($f) {
- var_dump($f, fwrite($f, "writing to an mb filename"));
- var_dump(fclose($f));
+ var_dump($f, fwrite($f, "writing to an mb filename"));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
var_dump(file_get_contents($fn));
@@ -38,7 +38,6 @@ var_dump(unlink($fn));
remove_data("file_cp1251");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
int(25)
@@ -51,4 +50,3 @@ bool(true)
string(%d) "%s\привет7"
Active code page: %d
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1251_zend_multibyte_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1251_zend_multibyte_0.phpt
index c4aa6f831c..2f28a922e3 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1251_zend_multibyte_0.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1251_zend_multibyte_0.phpt
@@ -27,18 +27,16 @@ $fn = $prefix . DIRECTORY_SEPARATOR . $item;
$f = fopen($fn, 'r');
if ($f) {
- var_dump($f, fread($f, 42));
- var_dump(fclose($f));
+ var_dump($f, fread($f, 42));
+ var_dump(fclose($f));
} else {
- echo "open failed\n";
+ echo "open failed\n";
}
remove_data("file_cp1251");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
string(35) "opened an utf8 filename for reading"
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1251_zend_multibyte_1.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1251_zend_multibyte_1.phpt
index 9265f8ec0b..7416b0752d 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1251_zend_multibyte_1.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1251_zend_multibyte_1.phpt
@@ -39,7 +39,6 @@ var_dump(rmdir($subpath));
remove_data("dir_cp1251");
?>
-===DONE===
--EXPECTF--
bool(true)
bool(true)
@@ -51,4 +50,3 @@ bool(true)
string(%d) "%s\привет3\привет4"
Active code page: %d
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1251_zend_multibyte_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1251_zend_multibyte_2.phpt
index 71ecc73bc9..d6ff64e4e5 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1251_zend_multibyte_2.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1251_zend_multibyte_2.phpt
@@ -27,10 +27,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . $item;
$f = fopen($fn, 'w');
if ($f) {
- var_dump($f, fwrite($f, "writing to an mb filename"));
- var_dump(fclose($f));
+ var_dump($f, fwrite($f, "writing to an mb filename"));
+ var_dump(fclose($f));
} else {
- echo "open failed\n";
+ echo "open failed\n";
}
var_dump(file_get_contents($fn));
@@ -41,7 +41,6 @@ var_dump(unlink($fn));
remove_data("file_cp1251");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
int(25)
@@ -54,4 +53,3 @@ bool(true)
string(%d) "%s\привет7"
Active code page: %d
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1252_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1252_0.phpt
index 2ebb63a688..402102e7ee 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1252_0.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1252_0.phpt
@@ -33,10 +33,8 @@ system("dir /b " . $fn);
remove_data("file");
?>
-===DONE===
--EXPECTF--
string(%d) "%s\gefäß"
bool(true)
bool(true)
gefäß
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_0.phpt
index dc673c260b..e85636d989 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_0.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_0.phpt
@@ -24,19 +24,17 @@ $fn = $prefix . DIRECTORY_SEPARATOR . $item;
$f = fopen($fn, 'r');
if ($f) {
- var_dump($f, fread($f, 42));
- var_dump(fclose($f));
+ var_dump($f, fread($f, 42));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
remove_data("file_cp1252");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
string(%d) "hallo
"
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_1.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_1.phpt
index eff0c923e8..e328576394 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_1.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_1.phpt
@@ -36,7 +36,6 @@ var_dump(rmdir($subpath));
remove_data("dir_cp1252");
?>
-===DONE===
--EXPECTF--
bool(true)
bool(true)
@@ -48,4 +47,3 @@ bool(true)
string(%d) "%s\tschüß3\tschüß4"
Active code page: %d
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_2.phpt
index d0e39c0513..0709d1270c 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_2.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_2.phpt
@@ -24,10 +24,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "${item}7";
$f = fopen($fn, 'w');
if ($f) {
- var_dump($f, fwrite($f, "writing to an mb filename"));
- var_dump(fclose($f));
+ var_dump($f, fwrite($f, "writing to an mb filename"));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
var_dump(file_get_contents($fn));
@@ -38,7 +38,6 @@ var_dump(unlink($fn));
remove_data("dir_cp1252");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
int(25)
@@ -51,4 +50,3 @@ bool(true)
string(%d) "%s\tschüß7"
Active code page: %d
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_3.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_3.phpt
index c3b3edb7ee..3abbc58205 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_3.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_3.phpt
@@ -24,18 +24,16 @@ $fn = $prefix . DIRECTORY_SEPARATOR . $item;
$f = fopen($fn, 'r');
if ($f) {
- var_dump($f, fread($f, 42));
- var_dump(fclose($f));
+ var_dump($f, fread($f, 42));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
remove_data("file2_cp1252");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
string(4) "hola"
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_4.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_4.phpt
index 2e97e78460..e35b2c5508 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_4.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_4.phpt
@@ -36,7 +36,6 @@ var_dump(rmdir($subpath));
remove_data("dir2_cp1252");
?>
-===DONE===
--EXPECTF--
bool(true)
bool(true)
@@ -48,4 +47,3 @@ bool(true)
string(%d) "%s\Voláçao3\Voláçao4"
Active code page: %d
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_5.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_5.phpt
index c6a135f567..8f45ed24e4 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_5.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1252_to_utf8_5.phpt
@@ -24,10 +24,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "${item}7";
$f = fopen($fn, 'w');
if ($f) {
- var_dump($f, fwrite($f, "writing to an mb filename"));
- var_dump(fclose($f));
+ var_dump($f, fwrite($f, "writing to an mb filename"));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
var_dump(file_get_contents($fn));
@@ -38,7 +38,6 @@ var_dump(unlink($fn));
remove_data("dir2_cp1252");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
int(25)
@@ -51,4 +50,3 @@ bool(true)
string(%d) "%s\Voláçao7"
Active code page: %d
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1253_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1253_0.phpt
index 07cf3c8e6c..8ed2b2d97b 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1253_0.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1253_0.phpt
@@ -27,19 +27,17 @@ $fn = $prefix . DIRECTORY_SEPARATOR . $item;
$f = fopen($fn, 'r');
if ($f) {
- var_dump($f, fread($f, 42));
- var_dump(fclose($f));
+ var_dump($f, fread($f, 42));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
remove_data("file_cp1253");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
string(37) "reading file wihh multibyte filename
"
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1253_1.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1253_1.phpt
index 9f03a9115c..b799fec4db 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1253_1.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1253_1.phpt
@@ -39,7 +39,6 @@ var_dump(rmdir($subpath));
remove_data("dir_cp1253");
?>
-===DONE===
--EXPECTF--
bool(true)
bool(true)
@@ -51,4 +50,3 @@ bool(true)
string(%d) "%s\äéáäñïìÞ äïêéìÞò42\äéáäñïìÞ äïêéìÞò4"
Active code page: %d
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1253_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1253_2.phpt
index 1ab6f658c0..88f28fa281 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1253_2.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1253_2.phpt
@@ -27,10 +27,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "${item}33";
$f = fopen($fn, 'w');
if ($f) {
- var_dump($f, fwrite($f, "writing to an mb filename"));
- var_dump(fclose($f));
+ var_dump($f, fwrite($f, "writing to an mb filename"));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
var_dump(file_get_contents($fn));
@@ -40,7 +40,6 @@ get_basename_with_cp($fn, 1253);
remove_data("dir_cp1253");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
int(25)
@@ -52,4 +51,3 @@ string(%d) "äéáäñïìÞ äïêéìÞò33"
bool(true)
string(%d) "%s\äéáäñïìÞ äïêéìÞò33"
Active code page: %d
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1253_to_utf8_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1253_to_utf8_0.phpt
index 64ad358b5c..4f0d601d4a 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1253_to_utf8_0.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1253_to_utf8_0.phpt
@@ -24,19 +24,17 @@ $fn = $prefix . DIRECTORY_SEPARATOR . $item;
$f = fopen($fn, 'r');
if ($f) {
- var_dump($f, fread($f, 42));
- var_dump(fclose($f));
+ var_dump($f, fread($f, 42));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
remove_data("file_cp1253");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
string(37) "reading file wihh multibyte filename
"
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1253_to_utf8_1.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1253_to_utf8_1.phpt
index a178ea574a..01b489af9c 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1253_to_utf8_1.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1253_to_utf8_1.phpt
@@ -36,7 +36,6 @@ var_dump(rmdir($subpath));
remove_data("dir_cp1253");
?>
-===DONE===
--EXPECTF--
bool(true)
bool(true)
@@ -48,4 +47,3 @@ bool(true)
string(%d) "%s\διαδÏομή δοκιμής42\διαδÏομή δοκιμής4"
Active code page: %d
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1253_to_utf8_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1253_to_utf8_2.phpt
index a46a8854ce..af329eadcf 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1253_to_utf8_2.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1253_to_utf8_2.phpt
@@ -24,10 +24,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "${item}33";
$f = fopen($fn, 'w');
if ($f) {
- var_dump($f, fwrite($f, "writing to an mb filename"));
- var_dump(fclose($f));
+ var_dump($f, fwrite($f, "writing to an mb filename"));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
var_dump(file_get_contents($fn));
@@ -37,7 +37,6 @@ get_basename_with_cp($fn, 65001);
remove_data("dir_cp1253");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
int(25)
@@ -49,4 +48,3 @@ string(33) "διαδÏομή δοκιμής33"
bool(true)
string(%d) "%s\διαδÏομή δοκιμής33"
Active code page: %d
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1254_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1254_0.phpt
index 9d92267b01..d619576ad5 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1254_0.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1254_0.phpt
@@ -27,19 +27,17 @@ $fn = $prefix . DIRECTORY_SEPARATOR . $item;
$f = fopen($fn, 'r');
if ($f) {
- var_dump($f, fread($f, 42));
- var_dump(fclose($f));
+ var_dump($f, fread($f, 42));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
remove_data("file_cp1254");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
string(37) "reading file wihh multibyte filename
"
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1254_1.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1254_1.phpt
index 8f79a2982b..9bb34e5316 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1254_1.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1254_1.phpt
@@ -39,7 +39,6 @@ var_dump(rmdir($subpath));
remove_data("dir_cp1254");
?>
-===DONE===
--EXPECTF--
bool(true)
bool(true)
@@ -51,4 +50,3 @@ bool(true)
string(%d) "%s\çokbaytlý iþleri42\çokbaytlý iþleri4"
Active code page: %d
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1254_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1254_2.phpt
index d924f87edd..f6357366e7 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1254_2.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1254_2.phpt
@@ -27,10 +27,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "${item}33";
$f = fopen($fn, 'w');
if ($f) {
- var_dump($f, fwrite($f, "writing to an mb filename"));
- var_dump(fclose($f));
+ var_dump($f, fwrite($f, "writing to an mb filename"));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
var_dump(file_get_contents($fn));
@@ -40,7 +40,6 @@ get_basename_with_cp($fn, 1254);
remove_data("dir_cp1254");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
int(25)
@@ -52,4 +51,3 @@ string(%d) "çokbaytlý iþleri33"
bool(true)
string(%d) "%s\çokbaytlý iþleri33"
Active code page: %d
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1254_3.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1254_3.phpt
index da264f9e3e..531aab848a 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1254_3.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1254_3.phpt
@@ -34,10 +34,8 @@ system("dir /b \"" . $fn . "\"");
remove_data("file_cp1254");
?>
-===DONE===
--EXPECTF--
string(%d) "%s\çokbaytlý iþleri"
bool(true)
bool(true)
çokbaytlý iþleri
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1254_to_utf8_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1254_to_utf8_0.phpt
index b79e0f466f..eac345d8be 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1254_to_utf8_0.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1254_to_utf8_0.phpt
@@ -24,19 +24,17 @@ $fn = $prefix . DIRECTORY_SEPARATOR . $item;
$f = fopen($fn, 'r');
if ($f) {
- var_dump($f, fread($f, 42));
- var_dump(fclose($f));
+ var_dump($f, fread($f, 42));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
remove_data("file_cp1254");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
string(37) "reading file wihh multibyte filename
"
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1254_to_utf8_1.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1254_to_utf8_1.phpt
index 2966eebab4..c905c99b35 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1254_to_utf8_1.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1254_to_utf8_1.phpt
@@ -36,7 +36,6 @@ var_dump(rmdir($subpath));
remove_data("dir_cp1254");
?>
-===DONE===
--EXPECTF--
bool(true)
bool(true)
@@ -48,4 +47,3 @@ bool(true)
string(%d) "%s\çokbaytlı işleri42\çokbaytlı işleri4"
Active code page: %d
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1254_to_utf8_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1254_to_utf8_2.phpt
index a8b1a9a67f..09caa2c386 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1254_to_utf8_2.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1254_to_utf8_2.phpt
@@ -24,10 +24,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "${item}33";
$f = fopen($fn, 'w');
if ($f) {
- var_dump($f, fwrite($f, "writing to an mb filename"));
- var_dump(fclose($f));
+ var_dump($f, fwrite($f, "writing to an mb filename"));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
var_dump(file_get_contents($fn));
@@ -37,7 +37,6 @@ get_basename_with_cp($fn, 65001);
remove_data("dir_cp1254");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
int(25)
@@ -49,4 +48,3 @@ string(%d) "çokbaytlı işleri33"
bool(true)
string(%d) "%s\çokbaytlı işleri33"
Active code page: %d
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1254_to_utf8_3.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1254_to_utf8_3.phpt
index a08dfc3e30..a1dcf7c90c 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1254_to_utf8_3.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1254_to_utf8_3.phpt
@@ -31,10 +31,8 @@ system("dir /b \"" . $fn . "\"");
remove_data("file_cp1254");
?>
-===DONE===
--EXPECTF--
string(%d) "%s\çokbaytlı işleri"
bool(true)
bool(true)
çokbaytlı işleri
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1255_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1255_0.phpt
index db96aa08d6..c360e82119 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1255_0.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1255_0.phpt
@@ -27,19 +27,17 @@ $fn = $prefix . DIRECTORY_SEPARATOR . $item;
$f = fopen($fn, 'r');
if ($f) {
- var_dump($f, fread($f, 42));
- var_dump(fclose($f));
+ var_dump($f, fread($f, 42));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
remove_data("file_cp1255");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
string(37) "reading file wihh multibyte filename
"
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1255_1.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1255_1.phpt
index 4da386eaa4..f80047f07f 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1255_1.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1255_1.phpt
@@ -39,7 +39,6 @@ var_dump(rmdir($subpath));
remove_data("dir_cp1255");
?>
-===DONE===
--EXPECTF--
bool(true)
bool(true)
@@ -51,4 +50,3 @@ bool(true)
string(%d) "%s\ëììéí îøåáéí42\ëììéí îøåáéí4"
Active code page: %d
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1255_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1255_2.phpt
index e5b6f4cf77..346620c6c5 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1255_2.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1255_2.phpt
@@ -27,10 +27,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "${item}33";
$f = fopen($fn, 'w');
if ($f) {
- var_dump($f, fwrite($f, "writing to an mb filename"));
- var_dump(fclose($f));
+ var_dump($f, fwrite($f, "writing to an mb filename"));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
var_dump(file_get_contents($fn));
@@ -40,7 +40,6 @@ get_basename_with_cp($fn, 1255);
remove_data("dir_cp1255");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
int(25)
@@ -52,4 +51,3 @@ string(%d) "ëììéí îøåáéí33"
bool(true)
string(%d) "%s\ëììéí îøåáéí33"
Active code page: %d
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1255_to_utf8_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1255_to_utf8_0.phpt
index b8937a2f9e..c930515c57 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1255_to_utf8_0.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1255_to_utf8_0.phpt
@@ -24,19 +24,17 @@ $fn = $prefix . DIRECTORY_SEPARATOR . $item;
$f = fopen($fn, 'r');
if ($f) {
- var_dump($f, fread($f, 42));
- var_dump(fclose($f));
+ var_dump($f, fread($f, 42));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
remove_data("file_cp1255");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
string(37) "reading file wihh multibyte filename
"
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1255_to_utf8_1.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1255_to_utf8_1.phpt
index dc47630450..cf5be0bc21 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1255_to_utf8_1.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1255_to_utf8_1.phpt
@@ -36,7 +36,6 @@ var_dump(rmdir($subpath));
remove_data("dir_cp1255");
?>
-===DONE===
--EXPECTF--
bool(true)
bool(true)
@@ -48,4 +47,3 @@ bool(true)
string(%s) "%s\×›×œ×œ×™× ×ž×¨×•×‘×™×42\×›×œ×œ×™× ×ž×¨×•×‘×™×4"
Active code page: %d
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1255_to_utf8_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1255_to_utf8_2.phpt
index 109d2dbd64..8e18ca690f 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1255_to_utf8_2.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1255_to_utf8_2.phpt
@@ -24,10 +24,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "${item}33";
$f = fopen($fn, 'w');
if ($f) {
- var_dump($f, fwrite($f, "writing to an mb filename"));
- var_dump(fclose($f));
+ var_dump($f, fwrite($f, "writing to an mb filename"));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
var_dump(file_get_contents($fn));
@@ -37,7 +37,6 @@ get_basename_with_cp($fn, 65001);
remove_data("dir_cp1255");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
int(25)
@@ -49,4 +48,3 @@ string(%s) "×›×œ×œ×™× ×ž×¨×•×‘×™×33"
bool(true)
string(%d) "%s\×›×œ×œ×™× ×ž×¨×•×‘×™×33"
Active code page: %d
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1256_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1256_0.phpt
index 5ac99b2fd3..5619b33f06 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1256_0.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1256_0.phpt
@@ -27,19 +27,17 @@ $fn = $prefix . DIRECTORY_SEPARATOR . $item;
$f = fopen($fn, 'r');
if ($f) {
- var_dump($f, fread($f, 42));
- var_dump(fclose($f));
+ var_dump($f, fread($f, 42));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
remove_data("file_cp1256");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
string(37) "reading file wihh multibyte filename
"
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1256_1.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1256_1.phpt
index ec95e582d9..ec27dbdaaa 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1256_1.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1256_1.phpt
@@ -39,7 +39,6 @@ var_dump(rmdir($subpath));
remove_data("dir_cp1256");
?>
-===DONE===
--EXPECTF--
bool(true)
bool(true)
@@ -51,4 +50,3 @@ bool(true)
string(%d) "%s\ãÓÇÑ ãÊÚÏÏ ÇáÈÇíÊ ÇÎÊÈÇÑ42\ãÓÇÑ ãÊÚÏÏ ÇáÈÇíÊ ÇÎÊÈÇÑ4"
Active code page: %d
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1256_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1256_2.phpt
index fd7303f1e7..e756a3e093 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1256_2.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1256_2.phpt
@@ -27,10 +27,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "${item}33";
$f = fopen($fn, 'w');
if ($f) {
- var_dump($f, fwrite($f, "writing to an mb filename"));
- var_dump(fclose($f));
+ var_dump($f, fwrite($f, "writing to an mb filename"));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
var_dump(file_get_contents($fn));
@@ -40,7 +40,6 @@ get_basename_with_cp($fn, 1256);
remove_data("dir_cp1256");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
int(25)
@@ -52,4 +51,3 @@ string(%d) "ãÓÇÑ ãÊÚÏÏ ÇáÈÇíÊ ÇÎÊÈÇÑ33"
bool(true)
string(%d) "%s\ãÓÇÑ ãÊÚÏÏ ÇáÈÇíÊ ÇÎÊÈÇÑ33"
Active code page: %s
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1256_to_utf8_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1256_to_utf8_0.phpt
index 25e1118fcb..d7e0ed5afc 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1256_to_utf8_0.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1256_to_utf8_0.phpt
@@ -24,19 +24,17 @@ $fn = $prefix . DIRECTORY_SEPARATOR . $item;
$f = fopen($fn, 'r');
if ($f) {
- var_dump($f, fread($f, 42));
- var_dump(fclose($f));
+ var_dump($f, fread($f, 42));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
remove_data("file_cp1256");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
string(37) "reading file wihh multibyte filename
"
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1256_to_utf8_1.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1256_to_utf8_1.phpt
index f660c5e906..5d544a52d0 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1256_to_utf8_1.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1256_to_utf8_1.phpt
@@ -36,7 +36,6 @@ var_dump(rmdir($subpath));
remove_data("dir_cp1256");
?>
-===DONE===
--EXPECTF--
bool(true)
bool(true)
@@ -48,4 +47,3 @@ bool(true)
string(%d) "%s\مسار متعدد البايت اختبار42\مسار متعدد البايت اختبار4"
Active code page: %d
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp1256_to_utf8_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp1256_to_utf8_2.phpt
index e8a14ca9a4..b05c4301e5 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp1256_to_utf8_2.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp1256_to_utf8_2.phpt
@@ -24,10 +24,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "${item}33";
$f = fopen($fn, 'w');
if ($f) {
- var_dump($f, fwrite($f, "writing to an mb filename"));
- var_dump(fclose($f));
+ var_dump($f, fwrite($f, "writing to an mb filename"));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
var_dump(file_get_contents($fn));
@@ -37,7 +37,6 @@ get_basename_with_cp($fn, 65001);
remove_data("dir_cp1256");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
int(25)
@@ -49,4 +48,3 @@ string(47) "مسار متعدد البايت اختبار33"
bool(true)
string(%d) "%s\مسار متعدد البايت اختبار33"
Active code page: %s
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp874_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp874_0.phpt
index 8a52ab0a1f..e8bc394a5d 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp874_0.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp874_0.phpt
@@ -22,31 +22,30 @@ default_charset=cp874
include __DIR__ . DIRECTORY_SEPARATOR . "util.inc";
$names = array( /* cp874 */
- "à»ç¹á¿éÁ·Õè·´Êͺ1",
- "à»ç¹á¿éÁ·Õè·´Êͺ2",
- "à»ç¹á¿éÁ·Õè·´Êͺ3",
- "à»ç¹á¿éÁ·Õè·´Êͺ4",
- "à»ç¹á¿éÁ·Õè·´Êͺ5",
- "à»ç¹á¿éÁ·Õè·´Êͺ6",
- "à»ç¹á¿éÁ·Õè·´Êͺ7",
- "à»ç¹á¿éÁ·Õè·´Êͺ8",
- "à»ç¹á¿éÁ·Õè·´Êͺ8 10",
+ "à»ç¹á¿éÁ·Õè·´Êͺ1",
+ "à»ç¹á¿éÁ·Õè·´Êͺ2",
+ "à»ç¹á¿éÁ·Õè·´Êͺ3",
+ "à»ç¹á¿éÁ·Õè·´Êͺ4",
+ "à»ç¹á¿éÁ·Õè·´Êͺ5",
+ "à»ç¹á¿éÁ·Õè·´Êͺ6",
+ "à»ç¹á¿éÁ·Õè·´Êͺ7",
+ "à»ç¹á¿éÁ·Õè·´Êͺ8",
+ "à»ç¹á¿éÁ·Õè·´Êͺ8 10",
);
$i = 0;
foreach ($names as $name) {
- $path = __DIR__ . DIRECTORY_SEPARATOR . $name . ".txt";
+ $path = __DIR__ . DIRECTORY_SEPARATOR . $name . ".txt";
- file_put_contents($path, "hello" . $i++);
+ file_put_contents($path, "hello" . $i++);
- get_basename_with_cp($path, 874);
- var_dump(file_get_contents($path));
+ get_basename_with_cp($path, 874);
+ var_dump(file_get_contents($path));
- unlink($path);
+ unlink($path);
}
?>
-===DONE===
--EXPECTF--
Active code page: %d
getting basename of %sà»ç¹á¿éÁ·Õè·´Êͺ1.txt
@@ -111,4 +110,3 @@ bool(true)
string(%d) "%sà»ç¹á¿éÁ·Õè·´Êͺ8 10.txt"
Active code page: %d
string(6) "hello8"
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp874_1.phpt b/ext/standard/tests/file/windows_mb_path/test_cp874_1.phpt
index 2e6df976a4..84c8c55983 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp874_1.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp874_1.phpt
@@ -34,10 +34,8 @@ system("dir /b " . $fn);
remove_data("file_cp874");
?>
-===DONE===
--EXPECTF--
string(%d) "%s\à»ç¹á¿éÁ·Õè·´Êͺ11"
bool(true)
bool(true)
à»ç¹á¿éÁ·Õè·´Êͺ11
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp874_to_utf8_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp874_to_utf8_0.phpt
index 3ac3035b4c..c21f124b6e 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp874_to_utf8_0.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp874_to_utf8_0.phpt
@@ -19,31 +19,30 @@ skip_if_no_required_exts();
include __DIR__ . DIRECTORY_SEPARATOR . "util.inc";
$names = array( /* cp874 */
- "à»ç¹á¿éÁ·Õè·´Êͺ1",
- "à»ç¹á¿éÁ·Õè·´Êͺ2",
- "à»ç¹á¿éÁ·Õè·´Êͺ3",
- "à»ç¹á¿éÁ·Õè·´Êͺ4",
- "à»ç¹á¿éÁ·Õè·´Êͺ5",
- "à»ç¹á¿éÁ·Õè·´Êͺ6",
- "à»ç¹á¿éÁ·Õè·´Êͺ7",
- "à»ç¹á¿éÁ·Õè·´Êͺ8",
- "à»ç¹á¿éÁ·Õè·´Êͺ8 10",
+ "à»ç¹á¿éÁ·Õè·´Êͺ1",
+ "à»ç¹á¿éÁ·Õè·´Êͺ2",
+ "à»ç¹á¿éÁ·Õè·´Êͺ3",
+ "à»ç¹á¿éÁ·Õè·´Êͺ4",
+ "à»ç¹á¿éÁ·Õè·´Êͺ5",
+ "à»ç¹á¿éÁ·Õè·´Êͺ6",
+ "à»ç¹á¿éÁ·Õè·´Êͺ7",
+ "à»ç¹á¿éÁ·Õè·´Êͺ8",
+ "à»ç¹á¿éÁ·Õè·´Êͺ8 10",
);
$i = 0;
foreach ($names as $name) {
- $pathw = __DIR__ . DIRECTORY_SEPARATOR . iconv('cp874', 'utf-8', $name) . ".txt";
+ $pathw = __DIR__ . DIRECTORY_SEPARATOR . iconv('cp874', 'utf-8', $name) . ".txt";
- file_put_contents($pathw, "hello" . $i++);
+ file_put_contents($pathw, "hello" . $i++);
- get_basename_with_cp($pathw, 65001);
- var_dump(file_get_contents($pathw));
+ get_basename_with_cp($pathw, 65001);
+ var_dump(file_get_contents($pathw));
- unlink($pathw);
+ unlink($pathw);
}
?>
-===DONE===
--EXPECTF--
Active code page: %d
getting basename of %sเป็นà¹à¸Ÿà¹‰à¸¡à¸—ี่ทดสอบ1.txt
@@ -108,4 +107,3 @@ bool(true)
string(%d) "%sเป็นà¹à¸Ÿà¹‰à¸¡à¸—ี่ทดสอบ8 10.txt"
Active code page: %d
string(6) "hello8"
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp874_to_utf8_1.phpt b/ext/standard/tests/file/windows_mb_path/test_cp874_to_utf8_1.phpt
index 1bc8fca100..97d0b24192 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp874_to_utf8_1.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp874_to_utf8_1.phpt
@@ -31,10 +31,8 @@ system("dir /b " . $fn);
remove_data("file_cp874");
?>
-===DONE===
--EXPECTF--
string(%d) "%s\เป็นà¹à¸Ÿà¹‰à¸¡à¸—ี่ทดสอบ11"
bool(true)
bool(true)
เป็นà¹à¸Ÿà¹‰à¸¡à¸—ี่ทดสอบ11
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp932_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp932_0.phpt
index 12c38eae69..afd1ef3e7a 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp932_0.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp932_0.phpt
@@ -27,19 +27,17 @@ $fn = $prefix . DIRECTORY_SEPARATOR . $item;
$f = fopen($fn, 'r');
if ($f) {
- var_dump($f, fread($f, 42));
- var_dump(fclose($f));
+ var_dump($f, fread($f, 42));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
remove_data("file_cp932");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
string(37) "reading file wihh multibyte filename
"
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp932_1.phpt b/ext/standard/tests/file/windows_mb_path/test_cp932_1.phpt
index 9163f87b33..086e24483d 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp932_1.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp932_1.phpt
@@ -39,7 +39,6 @@ var_dump(rmdir($subpath));
remove_data("dir_cp932");
?>
-===DONE===
--EXPECTF--
bool(true)
bool(true)
@@ -51,4 +50,3 @@ bool(true)
string(%d) "%s\ƒeƒXƒgƒ}ƒ‹ƒ`ƒoƒCƒgEƒpƒX42\ƒeƒXƒgƒ}ƒ‹ƒ`ƒoƒCƒgEƒpƒX4"
Active code page: %d
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp932_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp932_2.phpt
index 149c0fe595..97bad6412e 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp932_2.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp932_2.phpt
@@ -27,10 +27,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "${item}33";
$f = fopen($fn, 'w');
if ($f) {
- var_dump($f, fwrite($f, "writing to an mb filename"));
- var_dump(fclose($f));
+ var_dump($f, fwrite($f, "writing to an mb filename"));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
var_dump(file_get_contents($fn));
@@ -40,7 +40,6 @@ get_basename_with_cp($fn, 932);
remove_data("dir_cp932");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
int(25)
@@ -52,4 +51,3 @@ string(%d) "ƒeƒXƒgƒ}ƒ‹ƒ`ƒoƒCƒgEƒpƒX33"
bool(true)
string(%d) "%s\ƒeƒXƒgƒ}ƒ‹ƒ`ƒoƒCƒgEƒpƒX33"
Active code page: %d
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp932_3.phpt b/ext/standard/tests/file/windows_mb_path/test_cp932_3.phpt
index a6fd814203..b2c1f6d408 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp932_3.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp932_3.phpt
@@ -34,10 +34,8 @@ system("dir /b " . $fn);
remove_data("file_cp932");
?>
-===DONE===
--EXPECTF--
string(%d) "%s\ƒeƒXƒgƒ}ƒ‹ƒ`ƒoƒCƒgEƒpƒX77"
bool(true)
bool(true)
ƒeƒXƒgƒ}ƒ‹ƒ`ƒoƒCƒgEƒpƒX77
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp932_to_utf8_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp932_to_utf8_0.phpt
index b845e313b3..7da7aff1fc 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp932_to_utf8_0.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp932_to_utf8_0.phpt
@@ -24,19 +24,17 @@ $fn = $prefix . DIRECTORY_SEPARATOR . $item;
$f = fopen($fn, 'r');
if ($f) {
- var_dump($f, fread($f, 42));
- var_dump(fclose($f));
+ var_dump($f, fread($f, 42));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
remove_data("file_cp932");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
string(37) "reading file wihh multibyte filename
"
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp932_to_utf8_1.phpt b/ext/standard/tests/file/windows_mb_path/test_cp932_to_utf8_1.phpt
index 80a49dd28b..5c150a3318 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp932_to_utf8_1.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp932_to_utf8_1.phpt
@@ -36,7 +36,6 @@ var_dump(rmdir($subpath));
remove_data("dir_cp932");
?>
-===DONE===
--EXPECTF--
bool(true)
bool(true)
@@ -48,4 +47,3 @@ bool(true)
string(%d) "%s\テストマルãƒãƒã‚¤ãƒˆãƒ»ãƒ‘ス42\テストマルãƒãƒã‚¤ãƒˆãƒ»ãƒ‘ス4"
Active code page: %d
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp932_to_utf8_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp932_to_utf8_2.phpt
index 1d7764236a..c8aaa0b56b 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp932_to_utf8_2.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp932_to_utf8_2.phpt
@@ -24,10 +24,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "${item}33";
$f = fopen($fn, 'w');
if ($f) {
- var_dump($f, fwrite($f, "writing to an mb filename"));
- var_dump(fclose($f));
+ var_dump($f, fwrite($f, "writing to an mb filename"));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
var_dump(file_get_contents($fn));
@@ -37,7 +37,6 @@ get_basename_with_cp($fn, 65001);
remove_data("dir_cp932");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
int(25)
@@ -49,4 +48,3 @@ string(38) "テストマルãƒãƒã‚¤ãƒˆãƒ»ãƒ‘ス33"
bool(true)
string(%d) "%s\テストマルãƒãƒã‚¤ãƒˆãƒ»ãƒ‘ス33"
Active code page: %d
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp936_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp936_0.phpt
index b29631ad5c..a67cc6683c 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp936_0.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp936_0.phpt
@@ -27,19 +27,17 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "$item";
$f = fopen($fn, 'r');
if ($f) {
- var_dump($f, fread($f, 42));
- var_dump(fclose($f));
+ var_dump($f, fread($f, 42));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
remove_data("file_cp936");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
string(%d) "reading file wihh multibyte filename
"
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp936_1.phpt b/ext/standard/tests/file/windows_mb_path/test_cp936_1.phpt
index d7ee04bf9e..74c9da9398 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp936_1.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp936_1.phpt
@@ -39,7 +39,6 @@ var_dump(rmdir($subpath));
remove_data("dir_cp936");
?>
-===DONE===
--EXPECTF--
bool(true)
bool(true)
@@ -51,4 +50,3 @@ bool(true)
string(%d) "%s\œyÔ‡¶à×ֹ·½5\œyÔ‡¶à×ֹ·½4"
Active code page: %d
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp936_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp936_2.phpt
index eef4e4915e..c913f4e352 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp936_2.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp936_2.phpt
@@ -27,10 +27,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "{$item}25";
$f = fopen($fn, 'w');
if ($f) {
- var_dump($f, fwrite($f, "writing to an mb filename"));
- var_dump(fclose($f));
+ var_dump($f, fwrite($f, "writing to an mb filename"));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
var_dump(file_get_contents($fn));
@@ -42,7 +42,6 @@ var_dump(unlink($fn));
remove_data("file_cp936");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
int(25)
@@ -55,4 +54,3 @@ bool(true)
string(%d) "%s\œyÔ‡¶à×ֹ·½25"
Active code page: %d
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp936_to_utf8_0.phpt b/ext/standard/tests/file/windows_mb_path/test_cp936_to_utf8_0.phpt
index 52b164fdb2..9653f2ec1f 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp936_to_utf8_0.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp936_to_utf8_0.phpt
@@ -24,19 +24,17 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "$item";
$f = fopen($fn, 'r');
if ($f) {
- var_dump($f, fread($f, 42));
- var_dump(fclose($f));
+ var_dump($f, fread($f, 42));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
remove_data("file_cp936");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
string(%d) "reading file wihh multibyte filename
"
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp936_to_utf8_1.phpt b/ext/standard/tests/file/windows_mb_path/test_cp936_to_utf8_1.phpt
index 1a22b13ea6..a4c3588cc6 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp936_to_utf8_1.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp936_to_utf8_1.phpt
@@ -36,7 +36,6 @@ var_dump(rmdir($subpath));
remove_data("dir_cp936");
?>
-===DONE===
--EXPECTF--
bool(true)
bool(true)
@@ -48,4 +47,3 @@ bool(true)
string(%d) "%s\測試多字節路徑5\測試多字節路徑4"
Active code page: %d
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cp936_to_utf8_2.phpt b/ext/standard/tests/file/windows_mb_path/test_cp936_to_utf8_2.phpt
index b4fe8415c2..ab0b836da7 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cp936_to_utf8_2.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cp936_to_utf8_2.phpt
@@ -24,10 +24,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "{$item}25";
$f = fopen($fn, 'w');
if ($f) {
- var_dump($f, fwrite($f, "writing to an mb filename"));
- var_dump(fclose($f));
+ var_dump($f, fwrite($f, "writing to an mb filename"));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
var_dump(file_get_contents($fn));
@@ -39,7 +39,6 @@ var_dump(unlink($fn));
remove_data("file_cp936");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
int(25)
@@ -52,4 +51,3 @@ bool(true)
string(%d) "%s\測試多字節路徑25"
Active code page: %d
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_cwd_mb_names.phpt b/ext/standard/tests/file/windows_mb_path/test_cwd_mb_names.phpt
index 394ab17011..ced4230178 100644
--- a/ext/standard/tests/file/windows_mb_path/test_cwd_mb_names.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_cwd_mb_names.phpt
@@ -37,11 +37,9 @@ chdir($oldcwd);
remove_data("dir_mb");
?>
-===DONE===
--EXPECTF--
Active code page: 65001
bool(true)
string(%d) "%s\テストマルãƒãƒã‚¤ãƒˆãƒ»ãƒ‘ス42"
bool(true)
Active code page: %d
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_eucjp_to_utf8_0.phpt b/ext/standard/tests/file/windows_mb_path/test_eucjp_to_utf8_0.phpt
index 0c8f70919f..a72a80ac8b 100644
--- a/ext/standard/tests/file/windows_mb_path/test_eucjp_to_utf8_0.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_eucjp_to_utf8_0.phpt
@@ -24,19 +24,17 @@ $fn = $prefix . DIRECTORY_SEPARATOR . $item;
$f = fopen($fn, 'r');
if ($f) {
- var_dump($f, fread($f, 42));
- var_dump(fclose($f));
+ var_dump($f, fread($f, 42));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
remove_data("file_eucjp");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
string(37) "reading file wihh multibyte filename
"
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_eucjp_to_utf8_1.phpt b/ext/standard/tests/file/windows_mb_path/test_eucjp_to_utf8_1.phpt
index 634c676385..1e53da44fb 100644
--- a/ext/standard/tests/file/windows_mb_path/test_eucjp_to_utf8_1.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_eucjp_to_utf8_1.phpt
@@ -36,7 +36,6 @@ var_dump(rmdir($subpath));
remove_data("dir_eucjp");
?>
-===DONE===
--EXPECTF--
bool(true)
bool(true)
@@ -48,4 +47,3 @@ bool(true)
string(%d) "%s\テストマルãƒãƒã‚¤ãƒˆãƒ»ãƒ‘ス42\テストマルãƒãƒã‚¤ãƒˆãƒ»ãƒ‘ス4"
Active code page: %d
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_eucjp_to_utf8_2.phpt b/ext/standard/tests/file/windows_mb_path/test_eucjp_to_utf8_2.phpt
index 4b3c631837..f43e27bd29 100644
--- a/ext/standard/tests/file/windows_mb_path/test_eucjp_to_utf8_2.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_eucjp_to_utf8_2.phpt
@@ -24,10 +24,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "${item}33";
$f = fopen($fn, 'w');
if ($f) {
- var_dump($f, fwrite($f, "writing to an mb filename"));
- var_dump(fclose($f));
+ var_dump($f, fwrite($f, "writing to an mb filename"));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
var_dump(file_get_contents($fn));
@@ -37,7 +37,6 @@ get_basename_with_cp($fn, 65001);
remove_data("dir_eucjp");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
int(25)
@@ -49,4 +48,3 @@ string(38) "テストマルãƒãƒã‚¤ãƒˆãƒ»ãƒ‘ス33"
bool(true)
string(%d) "%s\テストマルãƒãƒã‚¤ãƒˆãƒ»ãƒ‘ス33"
Active code page: %d
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_kartuli_utf8_0.phpt b/ext/standard/tests/file/windows_mb_path/test_kartuli_utf8_0.phpt
index b1576e827a..b9a8552313 100644
--- a/ext/standard/tests/file/windows_mb_path/test_kartuli_utf8_0.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_kartuli_utf8_0.phpt
@@ -24,19 +24,17 @@ $fn = $prefix . DIRECTORY_SEPARATOR . $item;
$f = fopen($fn, 'r');
if ($f) {
- var_dump($f, fread($f, 42));
- var_dump(fclose($f));
+ var_dump($f, fread($f, 42));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
remove_data("file_kartuli");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
string(37) "reading file wihh multibyte filename
"
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_kartuli_utf8_1.phpt b/ext/standard/tests/file/windows_mb_path/test_kartuli_utf8_1.phpt
index 73ae71a6ba..ae3fbbf8a3 100644
--- a/ext/standard/tests/file/windows_mb_path/test_kartuli_utf8_1.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_kartuli_utf8_1.phpt
@@ -36,7 +36,6 @@ var_dump(rmdir($subpath));
remove_data("dir_kartuli");
?>
-===DONE===
--EXPECTF--
bool(true)
bool(true)
@@ -48,4 +47,3 @@ bool(true)
string(%d) "%s\ქáƒáƒ áƒ—ველები42\ქáƒáƒ áƒ—ველები4"
Active code page: %d
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_kartuli_utf8_2.phpt b/ext/standard/tests/file/windows_mb_path/test_kartuli_utf8_2.phpt
index 8aa7b2378c..c0c881f0f3 100644
--- a/ext/standard/tests/file/windows_mb_path/test_kartuli_utf8_2.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_kartuli_utf8_2.phpt
@@ -24,10 +24,10 @@ $fn = $prefix . DIRECTORY_SEPARATOR . "${item}33";
$f = fopen($fn, 'w');
if ($f) {
- var_dump($f, fwrite($f, "writing to an mb filename"));
- var_dump(fclose($f));
+ var_dump($f, fwrite($f, "writing to an mb filename"));
+ var_dump(fclose($f));
} else {
- echo "open utf8 failed\n";
+ echo "open utf8 failed\n";
}
var_dump(file_get_contents($fn));
@@ -37,7 +37,6 @@ get_basename_with_cp($fn, 65001);
remove_data("dir_kartuli");
?>
-===DONE===
--EXPECTF--
resource(%d) of type (stream)
int(25)
@@ -49,4 +48,3 @@ string(32) "ქáƒáƒ áƒ—ველები33"
bool(true)
string(%d) "%s\ქáƒáƒ áƒ—ველები33"
Active code page: %d
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_kartuli_utf8_3.phpt b/ext/standard/tests/file/windows_mb_path/test_kartuli_utf8_3.phpt
index 211124ad21..44614a5f26 100644
--- a/ext/standard/tests/file/windows_mb_path/test_kartuli_utf8_3.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_kartuli_utf8_3.phpt
@@ -31,10 +31,8 @@ system("dir /b " . $fn);
remove_data("file_kartuli");
?>
-===DONE===
--EXPECTF--
string(%d) "%s\ქáƒáƒ áƒ—ველები55"
bool(true)
bool(true)
ქáƒáƒ áƒ—ველები55
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_long_path_0.phpt b/ext/standard/tests/file/windows_mb_path/test_long_path_0.phpt
index 181ba33ca1..3705582484 100644
--- a/ext/standard/tests/file/windows_mb_path/test_long_path_0.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_long_path_0.phpt
@@ -17,8 +17,8 @@ $s = str_repeat('a', 50);
$how_many = 32;
for ($i = 0; $i < $how_many; $i++) {
- $p .= "$s";
- $p .= DIRECTORY_SEPARATOR;
+ $p .= "$s";
+ $p .= DIRECTORY_SEPARATOR;
}
$p = realpath(__DIR__) . DIRECTORY_SEPARATOR . $p;
@@ -30,18 +30,16 @@ var_dump(mkdir($p, 0777, true));
var_dump(file_exists($p));
for ($i = 0; $i < $how_many; $i++) {
- $p0 = substr($p, 0, strlen($p) - $i*51);
- rmdir($p0);
+ $p0 = substr($p, 0, strlen($p) - $i*51);
+ rmdir($p0);
}
var_dump(file_exists(realpath(__DIR__) . DIRECTORY_SEPARATOR . $s));
?>
-===DONE===
--EXPECTF--
%d%d%d%d
%s\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\
bool(true)
bool(true)
bool(false)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_long_path_1.phpt b/ext/standard/tests/file/windows_mb_path/test_long_path_1.phpt
index 48f30dbccd..427f0e9cf5 100644
--- a/ext/standard/tests/file/windows_mb_path/test_long_path_1.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_long_path_1.phpt
@@ -17,8 +17,8 @@ $how_many = 32;
for ($i = 0; $i < $how_many; $i++) {
- $p .= "$s";
- $p .= DIRECTORY_SEPARATOR;
+ $p .= "$s";
+ $p .= DIRECTORY_SEPARATOR;
}
$p = realpath(__DIR__) . DIRECTORY_SEPARATOR . $p;
@@ -37,14 +37,13 @@ var_dump(file_get_contents($p7));
unlink($p7);
for ($i = 0; $i < $how_many; $i++) {
- $p0 = substr($p, 0, strlen($p) - $i*51);
- rmdir($p0);
+ $p0 = substr($p, 0, strlen($p) - $i*51);
+ rmdir($p0);
}
var_dump(file_exists(realpath(__DIR__) . DIRECTORY_SEPARATOR . $s));
?>
-===DONE===
--EXPECTF--
%d%d%d%d
%s\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\
@@ -52,4 +51,3 @@ bool(true)
bool(true)
string(5) "hello"
bool(false)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_long_path_2.phpt b/ext/standard/tests/file/windows_mb_path/test_long_path_2.phpt
index 3437656eec..05982133c1 100644
--- a/ext/standard/tests/file/windows_mb_path/test_long_path_2.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_long_path_2.phpt
@@ -17,8 +17,8 @@ $how_many = 32;
for ($i = 0; $i < $how_many; $i++) {
- $p .= "$s";
- $p .= DIRECTORY_SEPARATOR;
+ $p .= "$s";
+ $p .= DIRECTORY_SEPARATOR;
}
/* path doesn't exist at this point! */
@@ -43,14 +43,13 @@ var_dump(file_get_contents($p7));
unlink($p7);
for ($i = 0; $i < $how_many; $i++) {
- $p0 = substr($p, 0, strlen($p) - $i*(strlen($s) + 1));
- rmdir($p0);
+ $p0 = substr($p, 0, strlen($p) - $i*(strlen($s) + 1));
+ rmdir($p0);
}
var_dump(file_exists(realpath(__DIR__) . DIRECTORY_SEPARATOR . $s));
?>
-===DONE===
--EXPECTF--
%d%d%d%d
%s\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxü\
@@ -61,4 +60,3 @@ bool(true)
int(5)
string(5) "hello"
bool(false)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_long_path_bug30730.phpt b/ext/standard/tests/file/windows_mb_path/test_long_path_bug30730.phpt
index d572206c5d..6acdddd4c2 100644
--- a/ext/standard/tests/file/windows_mb_path/test_long_path_bug30730.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_long_path_bug30730.phpt
@@ -34,11 +34,9 @@ var_dump(unlink($dest_file));
var_dump(rmdir($dest_dir));
?>
-===DONE===
--EXPECT--
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_long_path_bug70943.phpt b/ext/standard/tests/file/windows_mb_path/test_long_path_bug70943.phpt
index 6dd1e21afb..5b797d293b 100644
--- a/ext/standard/tests/file/windows_mb_path/test_long_path_bug70943.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_long_path_bug70943.phpt
@@ -17,15 +17,13 @@ touch($testFile);
echo "Opening file... ";
if ($fp = fopen($testFile, "r")) {
- fclose($fp);
- echo "OK", "\n";
+ fclose($fp);
+ echo "OK", "\n";
}
unlink($testFile);
?>
-===DONE===
--EXPECT--
Generating a file with a path length of 259 characters...
Opening file... OK
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_long_path_bug71103.phpt b/ext/standard/tests/file/windows_mb_path/test_long_path_bug71103.phpt
index 7a83c1e4f9..a81ff66dfb 100644
--- a/ext/standard/tests/file/windows_mb_path/test_long_path_bug71103.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_long_path_bug71103.phpt
@@ -20,31 +20,30 @@ $bar = $d . '\\5b53796d666f6e795c42756e646c655c5477696742756e646c655c436f6e74726
mkdir($d, NULL, true);
foreach (array($foo, $bar) as $f) {
- touch($f);
-
- $foo_obj = new \SplFileInfo($f);
- var_dump(
- $f,
- strlen($f) > 260, /* exceeds _MAX_PATH */
- file_exists($f),
- file_exists($foo_obj),
- is_readable($f),
- is_readable($foo_obj),
- is_writable($f),
- is_writable($foo_obj)
- );
-
- unlink($f);
+ touch($f);
+
+ $foo_obj = new \SplFileInfo($f);
+ var_dump(
+ $f,
+ strlen($f) > 260, /* exceeds _MAX_PATH */
+ file_exists($f),
+ file_exists($foo_obj),
+ is_readable($f),
+ is_readable($foo_obj),
+ is_writable($f),
+ is_writable($foo_obj)
+ );
+
+ unlink($f);
}
$p = $d;
do {
- rmdir($p);
- $p = dirname($p);
+ rmdir($p);
+ $p = dirname($p);
} while ($p != $base);
?>
-===DONE===
--EXPECTF--
string(%d) "%s\dev\http\tproj\app\cache\dev_old\annotations\72\5b53796d666f6e795c42756e646c655c5477696742756e646c655c436f6e74726f6c6c65725c457863657074696f6e436f6e74726f6c6c657223676574416e64436c65616e4f7574707574427566666572696e67405b416e6e6f745d5d5b.doctrinecache.data"
bool(true)
@@ -62,4 +61,3 @@ bool(true)
bool(true)
bool(true)
bool(true)
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_long_path_mkdir.phpt b/ext/standard/tests/file/windows_mb_path/test_long_path_mkdir.phpt
index 287dbf192e..1e3d7cd19c 100644
--- a/ext/standard/tests/file/windows_mb_path/test_long_path_mkdir.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_long_path_mkdir.phpt
@@ -20,15 +20,15 @@ $s = str_repeat('a', 50);
$how_many = 32;
for ($i = 0; $i < $how_many; $i++) {
- $p .= "$s\\";
+ $p .= "$s\\";
}
$start = realpath(__DIR__);
$newstart = false;
if (strlen($start) <= 248) {
- // create the exact length
- $start = $start . "\\" . str_repeat('a', 251 - strlen($start) - 1);
- $newstart = true;
+ // create the exact length
+ $start = $start . "\\" . str_repeat('a', 251 - strlen($start) - 1);
+ $newstart = true;
}
var_dump($start);
@@ -46,15 +46,14 @@ var_dump(file_get_contents($p7));
// cleanup
unlink($p7);
for ($i = 0; $i < $how_many; $i++) {
- $p0 = substr($p, 0, strlen($p) - $i*51);
- rmdir($p0);
+ $p0 = substr($p, 0, strlen($p) - $i*51);
+ rmdir($p0);
}
if ($newstart) {
- rmdir($start);
+ rmdir($start);
}
?>
-===DONE===
--EXPECTF--
string(251) "%s"
string(1884) "%s"
@@ -62,4 +61,3 @@ bool(true)
bool(true)
int(5)
string(5) "hello"
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_readdir_mb_names.phpt b/ext/standard/tests/file/windows_mb_path/test_readdir_mb_names.phpt
index d64316b3af..e671ef8f1d 100644
--- a/ext/standard/tests/file/windows_mb_path/test_readdir_mb_names.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_readdir_mb_names.phpt
@@ -47,14 +47,13 @@ if (is_dir($dirw)) {
closedir($dh);
}
} else {
- echo "is_dir failed\n";
+ echo "is_dir failed\n";
}
set_active_cp($old_cp);
remove_data("mb_names");
?>
-===DONE===
--EXPECTF--
Active code page: 65001
filename: . : filetype: dir
@@ -76,4 +75,3 @@ filename: テストマルãƒãƒã‚¤ãƒˆãƒ»ãƒ‘ス42 : filetype: dir
filename: 測試多字節路徑 : filetype: file
filename: 測試多字節路徑5 : filetype: dir
Active code page: %d
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/test_rename_mb_names.phpt b/ext/standard/tests/file/windows_mb_path/test_rename_mb_names.phpt
index acd9323c5c..771d82b1bb 100644
--- a/ext/standard/tests/file/windows_mb_path/test_rename_mb_names.phpt
+++ b/ext/standard/tests/file/windows_mb_path/test_rename_mb_names.phpt
@@ -55,7 +55,6 @@ set_active_cp($old_cp);
remove_data("file2_mb");
?>
-===DONE===
--EXPECTF--
Active code page: 65001
bool(true)
@@ -66,4 +65,3 @@ string(27) "測試多字節路徑17.txt"
bool(true)
bool(true)
Active code page: %d
-===DONE===
diff --git a/ext/standard/tests/file/windows_mb_path/util.inc b/ext/standard/tests/file/windows_mb_path/util.inc
index fc80a7613f..a26a66c017 100644
--- a/ext/standard/tests/file/windows_mb_path/util.inc
+++ b/ext/standard/tests/file/windows_mb_path/util.inc
@@ -2,153 +2,153 @@
function get_active_cp($kind = "")
{
- if (version_compare(PHP_VERSION, '7.1', '<')) {
- $s = exec("chcp");
- preg_match(",.*: (\d+),", $s, $m);
-
- return $m[1];
- } else {
- return sapi_windows_cp_get($kind);
- }
+ if (version_compare(PHP_VERSION, '7.1', '<')) {
+ $s = exec("chcp");
+ preg_match(",.*: (\d+),", $s, $m);
+
+ return $m[1];
+ } else {
+ return sapi_windows_cp_get($kind);
+ }
}
function set_active_cp($cp, $echo = true)
{
- if (version_compare(PHP_VERSION, '7.1', '<')) {
- $ret = exec("chcp $cp");
- } else {
- if (!sapi_windows_cp_set($cp)) {
- echo "Failed to set cp $cp\n";
- return;
- }
-
- if ($echo) echo "Active code page: ", get_active_cp(), "\n";
- }
+ if (version_compare(PHP_VERSION, '7.1', '<')) {
+ $ret = exec("chcp $cp");
+ } else {
+ if (!sapi_windows_cp_set($cp)) {
+ echo "Failed to set cp $cp\n";
+ return;
+ }
+
+ if ($echo) echo "Active code page: ", get_active_cp(), "\n";
+ }
}
function get_basename_with_cp($path, $cp, $echo = true)
{
- $old_cp = get_active_cp();
- set_active_cp($cp, $echo);
+ $old_cp = get_active_cp();
+ set_active_cp($cp, $echo);
- if ($echo) echo "getting basename of $path\n";
+ if ($echo) echo "getting basename of $path\n";
- $cmd = "powershell -command \"Get-Item -Path '$path' | Format-Table -HideTableHeaders Name\"";
- $out = trim(shell_exec($cmd));
+ $cmd = "powershell -command \"Get-Item -Path '$path' | Format-Table -HideTableHeaders Name\"";
+ $out = trim(shell_exec($cmd));
- if ($echo) var_dump($out, $out == basename($path));
- if ($echo) var_dump(realpath($path));
+ if ($echo) var_dump($out, $out == basename($path));
+ if ($echo) var_dump(realpath($path));
- set_active_cp($old_cp, $echo);
+ set_active_cp($old_cp, $echo);
- return $out;
+ return $out;
}
function skip_if_wrong_cp($cp, $kind = "")
{
- if (get_active_cp($kind) != $cp) {
- die("skip this test expect codepage $cp");
- }
+ if (get_active_cp($kind) != $cp) {
+ die("skip this test expect codepage $cp");
+ }
}
function skip_if_no_required_exts()
{
- $exts = func_get_args();
- $exts[] = "iconv";
-
- foreach ($exts as $ext) {
- if (!extension_loaded($ext)) {
- die("skip $ext is not loaded");
- }
- }
+ $exts = func_get_args();
+ $exts[] = "iconv";
+
+ foreach ($exts as $ext) {
+ if (!extension_loaded($ext)) {
+ die("skip $ext is not loaded");
+ }
+ }
}
function skip_if_not_win()
{
- if(substr(PHP_OS, 0, 3) != 'WIN' ) {
- die('skip windows only test');
- }
+ if(substr(PHP_OS, 0, 3) != 'WIN' ) {
+ die('skip windows only test');
+ }
}
function create_verify_file($prefix, $basename, $content = "", $cp = 65001)
{
- $full = $prefix . DIRECTORY_SEPARATOR . $basename;
-
- if (!touch($full)) {
- echo "failed to touch create $full\n";
- return;
- }
-
- $now = get_basename_with_cp($full, $cp, false);
- if ($now !== $basename) {
- echo "expected '$basename', got '$now'\n";
- return;
- }
-
- if ($content) {
- file_put_contents($full, $content);
- }
+ $full = $prefix . DIRECTORY_SEPARATOR . $basename;
+
+ if (!touch($full)) {
+ echo "failed to touch create $full\n";
+ return;
+ }
+
+ $now = get_basename_with_cp($full, $cp, false);
+ if ($now !== $basename) {
+ echo "expected '$basename', got '$now'\n";
+ return;
+ }
+
+ if ($content) {
+ file_put_contents($full, $content);
+ }
}
function create_verify_dir($prefix, $basename, $cp = 65001)
{
- $full = $prefix . DIRECTORY_SEPARATOR . $basename;
+ $full = $prefix . DIRECTORY_SEPARATOR . $basename;
- if (!mkdir($full)) {
- echo "failed to create dir '$full'\n";
- return;
- }
+ if (!mkdir($full)) {
+ echo "failed to create dir '$full'\n";
+ return;
+ }
- $now = get_basename_with_cp($full, $cp, false);
- if ($now !== $basename) {
- echo "expected '$basename', got '$now'\n";
- }
+ $now = get_basename_with_cp($full, $cp, false);
+ if ($now !== $basename) {
+ echo "expected '$basename', got '$now'\n";
+ }
}
function remove_data($id, $dir = NULL)
{
- if (!$dir) {
- $dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . $id;
- }
-
- if (is_dir($dir)) {
- $objects = scandir($dir);
- foreach ($objects as $object) {
- if ($object != "." && $object != "..") {
- if (filetype($dir . DIRECTORY_SEPARATOR . $object) == "dir")
- remove_data($id, $dir . DIRECTORY_SEPARATOR . $object);
- else
- unlink($dir . DIRECTORY_SEPARATOR . $object);
- }
- }
- reset($objects);
- rmdir($dir);
- }
+ if (!$dir) {
+ $dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . $id;
+ }
+
+ if (is_dir($dir)) {
+ $objects = scandir($dir);
+ foreach ($objects as $object) {
+ if ($object != "." && $object != "..") {
+ if (filetype($dir . DIRECTORY_SEPARATOR . $object) == "dir")
+ remove_data($id, $dir . DIRECTORY_SEPARATOR . $object);
+ else
+ unlink($dir . DIRECTORY_SEPARATOR . $object);
+ }
+ }
+ reset($objects);
+ rmdir($dir);
+ }
}
function create_data($id, $item = "", $cp = 65001, $utf8 = true)
{
- if ($utf8) {
- /* Keep this file ASCII, so zend.multibyte related stuff can be tasted as well. */
- include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util_utf8.inc";
- return create_data_from_utf8($id, $item, $cp);
- } else {
-
- $prefix = dirname(__FILE__) . DIRECTORY_SEPARATOR . $id;
-
- if (!is_dir($prefix)) {
- mkdir($prefix);
- }
-
- if (0 === strpos($id, "dir")) {
- create_verify_dir($prefix, $item, $cp);
- } else if (0 === strpos($id, "file")) {
- /* a bit unhandy, but content can be put from outside, if needed */
- create_verify_file($prefix, $item, "dummy content", $cp);
- } else {
- echo "Item has either to start with \"dir\" or \"file\"";
- }
- }
-
- return $prefix;
+ if ($utf8) {
+ /* Keep this file ASCII, so zend.multibyte related stuff can be tasted as well. */
+ include dirname(__FILE__) . DIRECTORY_SEPARATOR . "util_utf8.inc";
+ return create_data_from_utf8($id, $item, $cp);
+ } else {
+
+ $prefix = dirname(__FILE__) . DIRECTORY_SEPARATOR . $id;
+
+ if (!is_dir($prefix)) {
+ mkdir($prefix);
+ }
+
+ if (0 === strpos($id, "dir")) {
+ create_verify_dir($prefix, $item, $cp);
+ } else if (0 === strpos($id, "file")) {
+ /* a bit unhandy, but content can be put from outside, if needed */
+ create_verify_file($prefix, $item, "dummy content", $cp);
+ } else {
+ echo "Item has either to start with \"dir\" or \"file\"";
+ }
+ }
+
+ return $prefix;
}
diff --git a/ext/standard/tests/file/windows_mb_path/util_utf8.inc b/ext/standard/tests/file/windows_mb_path/util_utf8.inc
index e091564998..e51fad13b6 100644
--- a/ext/standard/tests/file/windows_mb_path/util_utf8.inc
+++ b/ext/standard/tests/file/windows_mb_path/util_utf8.inc
@@ -2,93 +2,93 @@
function create_data_from_utf8($id, $item = "", $cp = 65001)
{
- $prefix = dirname(__FILE__) . DIRECTORY_SEPARATOR . $id;
+ $prefix = dirname(__FILE__) . DIRECTORY_SEPARATOR . $id;
- if (!is_dir($prefix)) {
- mkdir($prefix);
- }
+ if (!is_dir($prefix)) {
+ mkdir($prefix);
+ }
- /* Using a UTF-8 encoded filenames if !zend.multibyte, otherwise files in retrospective charset. */
- switch ($id) {
+ /* Using a UTF-8 encoded filenames if !zend.multibyte, otherwise files in retrospective charset. */
+ switch ($id) {
- case "file_mb3":
- $content = "<?php
+ case "file_mb3":
+ $content = "<?php
echo \"hello there from the include\n\";";
- create_verify_file($prefix, "Äeskýtestování.inc", $content);
- break;
+ create_verify_file($prefix, "Äeskýtestování.inc", $content);
+ break;
- case "bug71509":
- $content = "that's my file with swedish filename
+ case "bug71509":
+ $content = "that's my file with swedish filename
";
- create_verify_file($prefix, $item, $content);
- break;
+ create_verify_file($prefix, $item, $content);
+ break;
- case "file_mb4":
- create_verify_file($prefix, "Å¡.txt", "");
- break;
+ case "file_mb4":
+ create_verify_file($prefix, "Å¡.txt", "");
+ break;
- case "file_cp1252":
- $content = "hallo
+ case "file_cp1252":
+ $content = "hallo
";
- create_verify_file($prefix, "tschüß", $content);
- break;
-
- case "file2_cp1252":
- create_verify_file($prefix, $item, "hola");
- break;
-
- case "file2_mb":
- create_verify_file($prefix, "Ελλάδα.txt", "");
- break;
-
- case "file_cp1251":
- create_verify_file($prefix, $item, "opened an utf8 filename for reading", $cp);
- break;
-
- case "file_cp1255":
- case "file_cp1254":
- case "file_cp1253":
- case "file_kartuli":
- case "file_cp1250":
- case "file_cp1256":
- case "file_cp874":
- case "file_big5":
- case "file_cp936":
- case "file_cp932":
- case "file_eucjp":
- case "file_mb":
- $content = "reading file wihh multibyte filename
+ create_verify_file($prefix, "tschüß", $content);
+ break;
+
+ case "file2_cp1252":
+ create_verify_file($prefix, $item, "hola");
+ break;
+
+ case "file2_mb":
+ create_verify_file($prefix, "Ελλάδα.txt", "");
+ break;
+
+ case "file_cp1251":
+ create_verify_file($prefix, $item, "opened an utf8 filename for reading", $cp);
+ break;
+
+ case "file_cp1255":
+ case "file_cp1254":
+ case "file_cp1253":
+ case "file_kartuli":
+ case "file_cp1250":
+ case "file_cp1256":
+ case "file_cp874":
+ case "file_big5":
+ case "file_cp936":
+ case "file_cp932":
+ case "file_eucjp":
+ case "file_mb":
+ $content = "reading file wihh multibyte filename
";
- create_verify_file($prefix, $item, $content, $cp);
- break;
-
- case "dir_mb":
- create_verify_dir($prefix, "テストマルãƒãƒã‚¤ãƒˆãƒ»ãƒ‘ス42");
- break;
-
- case "dir_cp1255":
- case "dir_cp1254":
- case "dir_cp1253":
- case "dir_kartuli":
- case "dir_cp1250":
- case "dir_cp1256":
- case "dir_cp874":
- case "dir_cp932":
- case "dir_cp936":
- case "dir_eucjp":
- case "dir2_cp1252":
- case "dir_cp1252":
- case "dir_cp1251":
- case "dir_big5":
- case "dir":
- create_verify_dir($prefix, $item, $cp);
- break;
-
- case "file":
- create_verify_file($prefix, $item, "", $cp);
- break;
- }
-
- return $prefix;
+ create_verify_file($prefix, $item, $content, $cp);
+ break;
+
+ case "dir_mb":
+ create_verify_dir($prefix, "テストマルãƒãƒã‚¤ãƒˆãƒ»ãƒ‘ス42");
+ break;
+
+ case "dir_cp1255":
+ case "dir_cp1254":
+ case "dir_cp1253":
+ case "dir_kartuli":
+ case "dir_cp1250":
+ case "dir_cp1256":
+ case "dir_cp874":
+ case "dir_cp932":
+ case "dir_cp936":
+ case "dir_eucjp":
+ case "dir2_cp1252":
+ case "dir_cp1252":
+ case "dir_cp1251":
+ case "dir_big5":
+ case "dir":
+ create_verify_dir($prefix, $item, $cp);
+ break;
+
+ case "file":
+ create_verify_file($prefix, $item, "", $cp);
+ break;
+ }
+
+ return $prefix;
}
diff --git a/ext/standard/tests/filters/001.phpt b/ext/standard/tests/filters/001.phpt
index fbfdda2385..0c502d4611 100644
--- a/ext/standard/tests/filters/001.phpt
+++ b/ext/standard/tests/filters/001.phpt
@@ -2,30 +2,31 @@
stream_filter_register() and invalid arguments
--FILE--
<?php
+try {
+ stream_filter_register("", "");
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+try {
+ stream_filter_register("test", "");
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+try {
+ stream_filter_register("", "test");
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
-var_dump(stream_filter_register("", ""));
-var_dump(stream_filter_register("test", ""));
-var_dump(stream_filter_register("", "test"));
var_dump(stream_filter_register("------", "nonexistentclass"));
-var_dump(stream_filter_register(array(), "aa"));
-var_dump(stream_filter_register("", array()));
echo "Done\n";
?>
--EXPECTF--
-Warning: stream_filter_register(): Filter name cannot be empty in %s on line %d
-bool(false)
-
-Warning: stream_filter_register(): Class name cannot be empty in %s on line %d
-bool(false)
-
-Warning: stream_filter_register(): Filter name cannot be empty in %s on line %d
-bool(false)
+Filter name cannot be empty
+Class name cannot be empty
+Filter name cannot be empty
bool(true)
-
-Warning: stream_filter_register() expects parameter 1 to be string, array given in %s on line %d
-bool(false)
-
-Warning: stream_filter_register() expects parameter 2 to be string, array given in %s on line %d
-bool(false)
Done
diff --git a/ext/standard/tests/filters/basic.phpt b/ext/standard/tests/filters/basic.phpt
index c9162e5bef..c0d4e5d85b 100644
--- a/ext/standard/tests/filters/basic.phpt
+++ b/ext/standard/tests/filters/basic.phpt
@@ -8,19 +8,19 @@ $filters = array("string.rot13", "string.toupper", "string.tolower");
function filter_test($names)
{
- $fp = tmpfile();
- fwrite($fp, $GLOBALS["text"]);
- rewind($fp);
- foreach ($names as $name) {
- echo "filter: $name\n";
- var_dump(stream_filter_prepend($fp, $name));
- }
- var_dump(fgets($fp));
- fclose($fp);
+ $fp = tmpfile();
+ fwrite($fp, $GLOBALS["text"]);
+ rewind($fp);
+ foreach ($names as $name) {
+ echo "filter: $name\n";
+ var_dump(stream_filter_prepend($fp, $name));
+ }
+ var_dump(fgets($fp));
+ fclose($fp);
}
foreach ($filters as $filter) {
- filter_test(array($filter));
+ filter_test(array($filter));
}
filter_test(array($filters[0], $filters[1]));
diff --git a/ext/standard/tests/filters/bug22538.phpt b/ext/standard/tests/filters/bug22538.phpt
index 0ef37a7bc1..920dd55c79 100644
--- a/ext/standard/tests/filters/bug22538.phpt
+++ b/ext/standard/tests/filters/bug22538.phpt
@@ -3,16 +3,16 @@ Bug #22538 (filtered stream doesn't update file pointer)
--FILE--
<?php
function my_stream_copy_to_stream($fin, $fout) {
- while (!feof($fin)) {
- fwrite($fout, fread($fin, 4096));
- }
+ while (!feof($fin)) {
+ fwrite($fout, fread($fin, 4096));
+ }
}
$size = 65536;
do {
- $path1 = sprintf("%s/%s%da", __DIR__, uniqid(), time());
- $path2 = sprintf("%s/%s%db", __DIR__, uniqid(), time());
+ $path1 = sprintf("%s/%s%da", __DIR__, uniqid(), time());
+ $path2 = sprintf("%s/%s%db", __DIR__, uniqid(), time());
} while ($path1 == $path2);
$fp = fopen($path1, "w") or die("Can not open $path1\n");
@@ -20,7 +20,7 @@ $str = "abcdefghijklmnopqrstuvwxyz\n";
$str_len = strlen($str);
$cnt = $size;
while (($cnt -= $str_len) > 0) {
- fwrite($fp, $str);
+ fwrite($fp, $str);
}
$cnt = $size - ($str_len + $cnt);
fclose($fp);
diff --git a/ext/standard/tests/filters/bug35916.phpt b/ext/standard/tests/filters/bug35916.phpt
index 578e462bd9..e234949303 100644
--- a/ext/standard/tests/filters/bug35916.phpt
+++ b/ext/standard/tests/filters/bug35916.phpt
@@ -9,22 +9,22 @@ class strtoupper_filter extends php_user_filter
{
function filter($in, $out, &$consumed, $closing)
{
- while($bucket=stream_bucket_make_writeable($in)) {
- $bucket->data = strtoupper($bucket->data);
- $consumed += $bucket->datalen;
- stream_bucket_append($out, $bucket);
- stream_bucket_append($out, $bucket);
+ while($bucket=stream_bucket_make_writeable($in)) {
+ $bucket->data = strtoupper($bucket->data);
+ $consumed += $bucket->datalen;
+ stream_bucket_append($out, $bucket);
+ stream_bucket_append($out, $bucket);
}
- return PSFS_PASS_ON;
+ return PSFS_PASS_ON;
}
- function onCreate()
- {
- echo "fffffffffff\n";
- }
- function onClose()
- {
- echo "hello\n";
- }
+ function onCreate()
+ {
+ echo "fffffffffff\n";
+ }
+ function onClose()
+ {
+ echo "hello\n";
+ }
}
stream_filter_register("strtoupper", "strtoupper_filter");
@@ -39,6 +39,6 @@ unlink($file);
--EXPECTF--
fffffffffff
-Notice: fread(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
hello
THANK YOU
diff --git a/ext/standard/tests/filters/bug46164-1.phpt b/ext/standard/tests/filters/bug46164-1.phpt
index b2d2d4e85d..ecdd86bbe2 100644
--- a/ext/standard/tests/filters/bug46164-1.phpt
+++ b/ext/standard/tests/filters/bug46164-1.phpt
@@ -3,13 +3,13 @@ Bug #46164 - 1 (stream_filter_remove() closes the stream)
--FILE--
<?php
class user_filter extends php_user_filter {
- function filter($in, $out, &$consumed, $closing) {
- while($bucket = stream_bucket_make_writeable($in)) {
- $consumed += $bucket->datalen;
- stream_bucket_append($out, $bucket);
- }
- return PSFS_PASS_ON;
- }
+ function filter($in, $out, &$consumed, $closing) {
+ while($bucket = stream_bucket_make_writeable($in)) {
+ $consumed += $bucket->datalen;
+ stream_bucket_append($out, $bucket);
+ }
+ return PSFS_PASS_ON;
+ }
}
stream_filter_register('user_filter','user_filter');
diff --git a/ext/standard/tests/filters/bug46164-2.phpt b/ext/standard/tests/filters/bug46164-2.phpt
index 6a1bde5962..c58295076f 100644
--- a/ext/standard/tests/filters/bug46164-2.phpt
+++ b/ext/standard/tests/filters/bug46164-2.phpt
@@ -3,14 +3,14 @@ Bug #46164 - 2 (stream_filter_remove() closes the stream)
--FILE--
<?php
class user_filter extends php_user_filter {
- function filter($in, $out, &$consumed, $closing) {
- while($bucket = stream_bucket_make_writeable($in)) {
- $consumed += $bucket->datalen;
- stream_bucket_append($out, $bucket);
- }
- unset($this->stream);
- return PSFS_PASS_ON;
- }
+ function filter($in, $out, &$consumed, $closing) {
+ while($bucket = stream_bucket_make_writeable($in)) {
+ $consumed += $bucket->datalen;
+ stream_bucket_append($out, $bucket);
+ }
+ unset($this->stream);
+ return PSFS_PASS_ON;
+ }
}
stream_filter_register('user_filter','user_filter');
diff --git a/ext/standard/tests/filters/chunked_001.phpt b/ext/standard/tests/filters/chunked_001.phpt
index c90dd403ec..094b49d7b9 100644
--- a/ext/standard/tests/filters/chunked_001.phpt
+++ b/ext/standard/tests/filters/chunked_001.phpt
@@ -10,19 +10,19 @@ allow_url_fopen=1
--FILE--
<?php
$streams = array(
- "data://text/plain,0\r\n",
- "data://text/plain,2\r\nte\r\n2\r\nst\r\n0\r\n",
- "data://text/plain,2\nte\n2\nst\n0\n",
- "data://text/plain,2;a=1\nte\n2;a=2;b=3\r\nst\n0\n",
- "data://text/plain,2\nte\n2\nst\n0\na=b\r\nc=d\n\r\n",
- "data://text/plain,1f\n0123456789abcdef0123456789abcde\n1\nf\n0\n",
- "data://text/plain,1E\n0123456789abcdef0123456789abcd\n2\nef\n0\n",
+ "data://text/plain,0\r\n",
+ "data://text/plain,2\r\nte\r\n2\r\nst\r\n0\r\n",
+ "data://text/plain,2\nte\n2\nst\n0\n",
+ "data://text/plain,2;a=1\nte\n2;a=2;b=3\r\nst\n0\n",
+ "data://text/plain,2\nte\n2\nst\n0\na=b\r\nc=d\n\r\n",
+ "data://text/plain,1f\n0123456789abcdef0123456789abcde\n1\nf\n0\n",
+ "data://text/plain,1E\n0123456789abcdef0123456789abcd\n2\nef\n0\n",
);
foreach ($streams as $name) {
- $fp = fopen($name, "r");
- stream_filter_append($fp, "dechunk", STREAM_FILTER_READ);
- var_dump(stream_get_contents($fp));
- fclose($fp);
+ $fp = fopen($name, "r");
+ stream_filter_append($fp, "dechunk", STREAM_FILTER_READ);
+ var_dump(stream_get_contents($fp));
+ fclose($fp);
}
?>
--EXPECT--
diff --git a/ext/standard/tests/filters/filter_errors.inc b/ext/standard/tests/filters/filter_errors.inc
index 8636fbe17f..18711844f8 100644
--- a/ext/standard/tests/filters/filter_errors.inc
+++ b/ext/standard/tests/filters/filter_errors.inc
@@ -1,36 +1,36 @@
<?php
function filter_errors_skipif($needle) {
- if (!function_exists('fnmatch')) {
- die('skip fnmatch() not available');
- }
- $filters = stream_get_filters();
- foreach($filters as $filter) {
- if (fnmatch($filter, $needle)) return;
- }
- die("skip $needle not available");
+ if (!function_exists('fnmatch')) {
+ die('skip fnmatch() not available');
+ }
+ $filters = stream_get_filters();
+ foreach($filters as $filter) {
+ if (fnmatch($filter, $needle)) return;
+ }
+ die("skip $needle not available");
}
function filter_errors_test($filter, $data) {
- echo "test filtering of buffered data\n";
+ echo "test filtering of buffered data\n";
- $stream = fopen('php://memory', 'wb+');
+ $stream = fopen('php://memory', 'wb+');
- fwrite($stream, ".\r\n$data");
- fseek($stream, 0, SEEK_SET);
- stream_get_line($stream, 8192, "\r\n");
+ fwrite($stream, ".\r\n$data");
+ fseek($stream, 0, SEEK_SET);
+ stream_get_line($stream, 8192, "\r\n");
- $f = stream_filter_append($stream, $filter);
+ $f = stream_filter_append($stream, $filter);
- echo "test filtering of non buffered data\n";
+ echo "test filtering of non buffered data\n";
- $stream = fopen('php://memory', 'wb+');
+ $stream = fopen('php://memory', 'wb+');
- fwrite($stream, "$data");
- fseek($stream, 0, SEEK_SET);
+ fwrite($stream, "$data");
+ fseek($stream, 0, SEEK_SET);
- stream_filter_append($stream, $filter);
- stream_get_contents($stream);
+ stream_filter_append($stream, $filter);
+ stream_get_contents($stream);
}
diff --git a/ext/standard/tests/filters/filter_errors_convert_base64_decode.phpt b/ext/standard/tests/filters/filter_errors_convert_base64_decode.phpt
index 4c043be3b6..1264cada03 100644
--- a/ext/standard/tests/filters/filter_errors_convert_base64_decode.phpt
+++ b/ext/standard/tests/filters/filter_errors_convert_base64_decode.phpt
@@ -10,9 +10,9 @@ filter_errors_test('convert.base64-decode', '===');
--EXPECTF--
test filtering of buffered data
-Warning: stream_filter_append(): stream filter (convert.base64-decode): invalid byte sequence in %s
+Warning: stream_filter_append(): Stream filter (convert.base64-decode): invalid byte sequence in %s
Warning: stream_filter_append(): Filter failed to process pre-buffered data in %s
test filtering of non buffered data
-Warning: stream_get_contents(): stream filter (convert.base64-decode): invalid byte sequence in %s
+Warning: stream_get_contents(): Stream filter (convert.base64-decode): invalid byte sequence in %s
diff --git a/ext/standard/tests/filters/filter_errors_user.phpt b/ext/standard/tests/filters/filter_errors_user.phpt
index 9b911cf81f..a8547fe9ed 100644
--- a/ext/standard/tests/filters/filter_errors_user.phpt
+++ b/ext/standard/tests/filters/filter_errors_user.phpt
@@ -5,58 +5,58 @@ Filter errors: user filter
require 'filter_errors.inc';
class test_filter0 extends php_user_filter {
- function filter($in, $out, &$consumed, $closing) {
- return PSFS_ERR_FATAL;
- }
+ function filter($in, $out, &$consumed, $closing) {
+ return PSFS_ERR_FATAL;
+ }
}
class test_filter1 extends php_user_filter {
- function filter($in, $out, &$consumed, $closing) {
- $bucket = stream_bucket_make_writeable($in);
- return PSFS_ERR_FATAL;
- }
+ function filter($in, $out, &$consumed, $closing) {
+ $bucket = stream_bucket_make_writeable($in);
+ return PSFS_ERR_FATAL;
+ }
}
class test_filter2 extends php_user_filter {
- function filter($in, $out, &$consumed, $closing) {
- while ($bucket = stream_bucket_make_writeable($in)) {
- $consumed += $bucket->datalen;
- stream_bucket_append($out, $bucket);
- }
- return PSFS_ERR_FATAL;
- }
+ function filter($in, $out, &$consumed, $closing) {
+ while ($bucket = stream_bucket_make_writeable($in)) {
+ $consumed += $bucket->datalen;
+ stream_bucket_append($out, $bucket);
+ }
+ return PSFS_ERR_FATAL;
+ }
}
class test_filter3 extends php_user_filter {
- function filter($in, $out, &$consumed, $closing) {
- if (!$closing) {
- $bucket = stream_bucket_new($this->stream, "42");
- stream_bucket_append($out, $bucket);
- }
- return PSFS_ERR_FATAL;
- }
+ function filter($in, $out, &$consumed, $closing) {
+ if (!$closing) {
+ $bucket = stream_bucket_new($this->stream, "42");
+ stream_bucket_append($out, $bucket);
+ }
+ return PSFS_ERR_FATAL;
+ }
}
class test_filter4 extends php_user_filter {
- function filter($in, $out, &$consumed, $closing) {
- if (!$closing) {
- $bucket = stream_bucket_new($this->stream, "42");
- }
- return PSFS_ERR_FATAL;
- }
+ function filter($in, $out, &$consumed, $closing) {
+ if (!$closing) {
+ $bucket = stream_bucket_new($this->stream, "42");
+ }
+ return PSFS_ERR_FATAL;
+ }
}
for($i = 0; $i < 5; ++$i) {
- echo "test_filter$i\n";
- var_dump(stream_filter_register("test_filter$i", "test_filter$i"));
- filter_errors_test("test_filter$i", "42");
+ echo "test_filter$i\n";
+ var_dump(stream_filter_register("test_filter$i", "test_filter$i"));
+ filter_errors_test("test_filter$i", "42");
}
echo "test append / read / remove\n";
for($i = 0; $i < 5; ++$i) {
- echo "test_filter$i\n";
- $stream = fopen('php://memory', 'wb+');
- fwrite($stream, "42");
- fseek($stream, 0, SEEK_SET);
- $f = stream_filter_append($stream, "test_filter$i");
- stream_get_contents($stream);
- stream_filter_remove($f);
+ echo "test_filter$i\n";
+ $stream = fopen('php://memory', 'wb+');
+ fwrite($stream, "42");
+ fseek($stream, 0, SEEK_SET);
+ $f = stream_filter_append($stream, "test_filter$i");
+ stream_get_contents($stream);
+ stream_filter_remove($f);
}
echo "test append all / read / remove all\n";
@@ -65,12 +65,12 @@ fwrite($stream, "42");
fseek($stream, 0, SEEK_SET);
$filters = array();
for($i = 0; $i < 5; ++$i) {
- echo "test_filter$i\n";
- $filters[] = stream_filter_append($stream, "test_filter$i");
+ echo "test_filter$i\n";
+ $filters[] = stream_filter_append($stream, "test_filter$i");
}
stream_get_contents($stream);
foreach($filters as $filter) {
- stream_filter_remove($filter);
+ stream_filter_remove($filter);
}
echo "test append all / read / close\n";
@@ -79,8 +79,8 @@ fwrite($stream, "42");
fseek($stream, 0, SEEK_SET);
$filters = array();
for($i = 0; $i < 5; ++$i) {
- echo "test_filter$i\n";
- $filters[] = stream_filter_append($stream, "test_filter$i");
+ echo "test_filter$i\n";
+ $filters[] = stream_filter_append($stream, "test_filter$i");
}
stream_get_contents($stream);
fclose($stream);
diff --git a/ext/standard/tests/filters/object_init_failure.phpt b/ext/standard/tests/filters/object_init_failure.phpt
index 8175bbe44b..6375969e03 100644
--- a/ext/standard/tests/filters/object_init_failure.phpt
+++ b/ext/standard/tests/filters/object_init_failure.phpt
@@ -13,7 +13,7 @@ try {
}
?>
--EXPECTF--
-Warning: file_get_contents(): unable to create or locate filter "sample.filter" in %s on line %d
+Warning: file_get_contents(): Unable to create or locate filter "sample.filter" in %s on line %d
Warning: file_get_contents(): Unable to create filter (sample.filter) in %s on line %d
Undefined constant 'FOO'
diff --git a/ext/standard/tests/filters/object_init_failure_2.phpt b/ext/standard/tests/filters/object_init_failure_2.phpt
index a3ff299520..251ebf519c 100644
--- a/ext/standard/tests/filters/object_init_failure_2.phpt
+++ b/ext/standard/tests/filters/object_init_failure_2.phpt
@@ -13,7 +13,7 @@ try {
}
?>
--EXPECTF--
-Warning: main(): unable to create or locate filter "sample.filter" in %s on line %d
+Warning: main(): Unable to create or locate filter "sample.filter" in %s on line %d
Warning: main(): Unable to create filter (sample.filter) in %s on line %d
Undefined constant 'FOO'
diff --git a/ext/standard/tests/filters/php_user_filter_01.phpt b/ext/standard/tests/filters/php_user_filter_01.phpt
index ff5a51f5be..fb47177f4c 100644
--- a/ext/standard/tests/filters/php_user_filter_01.phpt
+++ b/ext/standard/tests/filters/php_user_filter_01.phpt
@@ -14,4 +14,4 @@ class bar extends php_user_filter {
}
?>
--EXPECTF--
-Warning: Declaration of bar::filter($in, $out, &$consumed) should be compatible with php_user_filter::filter($in, $out, &$consumed, $closing) in %s on line %d
+Fatal error: Declaration of bar::filter($in, $out, &$consumed) must be compatible with php_user_filter::filter($in, $out, &$consumed, $closing) in %s on line %d
diff --git a/ext/standard/tests/filters/php_user_filter_02.phpt b/ext/standard/tests/filters/php_user_filter_02.phpt
index bdd73c01a8..fd0822153b 100644
--- a/ext/standard/tests/filters/php_user_filter_02.phpt
+++ b/ext/standard/tests/filters/php_user_filter_02.phpt
@@ -9,4 +9,4 @@ class foo extends php_user_filter {
}
?>
--EXPECTF--
-Warning: Declaration of foo::filter($in, $out, $consumed, $closing) should be compatible with php_user_filter::filter($in, $out, &$consumed, $closing) in %s on line %d
+Fatal error: Declaration of foo::filter($in, $out, $consumed, $closing) must be compatible with php_user_filter::filter($in, $out, &$consumed, $closing) in %s on line %d
diff --git a/ext/standard/tests/filters/php_user_filter_03.phpt b/ext/standard/tests/filters/php_user_filter_03.phpt
index 867b74eb89..a89637d4cc 100644
--- a/ext/standard/tests/filters/php_user_filter_03.phpt
+++ b/ext/standard/tests/filters/php_user_filter_03.phpt
@@ -9,4 +9,4 @@ class foo extends php_user_filter {
}
?>
--EXPECTF--
-Warning: Declaration of foo::onCreate($var) should be compatible with php_user_filter::onCreate() in %s on line %d
+Fatal error: Declaration of foo::onCreate($var) must be compatible with php_user_filter::onCreate() in %s on line %d
diff --git a/ext/standard/tests/filters/stream_filter_remove_basic.phpt b/ext/standard/tests/filters/stream_filter_remove_basic.phpt
index a264a0e4f6..65fc021c13 100644
--- a/ext/standard/tests/filters/stream_filter_remove_basic.phpt
+++ b/ext/standard/tests/filters/stream_filter_remove_basic.phpt
@@ -31,7 +31,6 @@ fpassthru( $fp );
fclose( $fp );
?>
-===DONE===
--CLEAN--
<?php
@@ -44,4 +43,3 @@ unlink( $file );
bool(true)
Grfgvat gur ebg13 svygre juvpu fuvsgf fbzr guvatf nebhaq.
add some more un-filtered foobar
-===DONE===
diff --git a/ext/standard/tests/filters/stream_filter_remove_error.phpt b/ext/standard/tests/filters/stream_filter_remove_error.phpt
index 9513319f57..ff93358b31 100644
--- a/ext/standard/tests/filters/stream_filter_remove_error.phpt
+++ b/ext/standard/tests/filters/stream_filter_remove_error.phpt
@@ -20,28 +20,25 @@ $filter = stream_filter_append( $fp, "string.rot13", STREAM_FILTER_WRITE );
echo "*** Testing stream_filter_remove() : error conditions ***\n";
-echo "\n-- Testing stream_filter_remove() function with Zero arguments --\n";
-var_dump( stream_filter_remove() );
-
-echo "\n-- Testing stream_filter_remove() function with more than expected no. of arguments --\n";
-$arg = 'bogus arg';
-var_dump( stream_filter_remove( $filter, $arg ) );
-
-echo "\n-- Testing stream_filter_remove() function with unexisting stream filter --\n";
-var_dump( stream_filter_remove( "fakefilter" ) );
-
echo "\n-- Testing stream_filter_remove() function with bad resource --\n";
-var_dump( stream_filter_remove( $fp ) );
+try {
+ stream_filter_remove($fp);
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
echo "\n-- Testing stream_filter_remove() function with an already removed filter --\n";
// Double remove it
-var_dump( stream_filter_remove( $filter ) );
-var_dump( stream_filter_remove( $filter ) );
+var_dump(stream_filter_remove( $filter ));
+try {
+ stream_filter_remove($filter);
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
fclose( $fp );
?>
-===DONE===
--CLEAN--
<?php
@@ -49,32 +46,12 @@ $file = __DIR__ . DIRECTORY_SEPARATOR . 'streamfilterTest.txt';
unlink( $file );
?>
---EXPECTF--
+--EXPECT--
*** Testing stream_filter_remove() : error conditions ***
--- Testing stream_filter_remove() function with Zero arguments --
-
-Warning: stream_filter_remove() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
--- Testing stream_filter_remove() function with more than expected no. of arguments --
-
-Warning: stream_filter_remove() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
-
--- Testing stream_filter_remove() function with unexisting stream filter --
-
-Warning: stream_filter_remove() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
-
-- Testing stream_filter_remove() function with bad resource --
-
-Warning: stream_filter_remove(): Invalid resource given, not a stream filter in %s on line %d
-bool(false)
+stream_filter_remove(): supplied resource is not a valid stream filter resource
-- Testing stream_filter_remove() function with an already removed filter --
bool(true)
-
-Warning: stream_filter_remove(): Invalid resource given, not a stream filter in %s on line %d
-bool(false)
-===DONE===
+stream_filter_remove(): supplied resource is not a valid stream filter resource
diff --git a/ext/standard/tests/filters/strip_tags_filter.phpt b/ext/standard/tests/filters/strip_tags_filter.phpt
deleted file mode 100644
index f353e79a9a..0000000000
--- a/ext/standard/tests/filters/strip_tags_filter.phpt
+++ /dev/null
@@ -1,29 +0,0 @@
---TEST--
-string.strip_tags filter
---FILE--
-<?php
-$fp = fopen('php://output', 'w');
-stream_filter_append($fp, 'string.strip_tags');
-fwrite($fp, "test <b>bold</b> <i>italic</i> test\n");
-fclose($fp);
-
-$fp = fopen('php://output', 'w');
-stream_filter_append($fp, 'string.strip_tags', STREAM_FILTER_WRITE, "<b>");
-fwrite($fp, "test <b>bold</b> <i>italic</i> test\n");
-fclose($fp);
-
-$fp = fopen('php://output', 'w');
-stream_filter_append($fp, 'string.strip_tags', STREAM_FILTER_WRITE, ["b"]);
-fwrite($fp, "test <b>bold</b> <i>italic</i> test\n");
-fclose($fp);
-
-?>
---EXPECTF--
-Deprecated: stream_filter_append(): The string.strip_tags filter is deprecated in %s on line %d
-test bold italic test
-
-Deprecated: stream_filter_append(): The string.strip_tags filter is deprecated in %s on line %d
-test <b>bold</b> italic test
-
-Deprecated: stream_filter_append(): The string.strip_tags filter is deprecated in %s on line %d
-test <b>bold</b> italic test
diff --git a/ext/standard/tests/general_functions/001.phpt b/ext/standard/tests/general_functions/001.phpt
index 307122e1cb..a43215c2c7 100644
--- a/ext/standard/tests/general_functions/001.phpt
+++ b/ext/standard/tests/general_functions/001.phpt
@@ -7,41 +7,41 @@ $agent = sprintf("%.5s", "James Bond, 007");
echo("sprintf string truncate test: ");
if ($agent == "James") {
- echo("passed\n");
+ echo("passed\n");
} else {
- echo("failed!\n");
+ echo("failed!\n");
}
echo("sprintf padding and align test: ");
$test = sprintf("abc%04d %-20s%c", 20, "fisketur", 33);
if ($test == "abc0020 fisketur !") {
- echo("passed\n");
+ echo("passed\n");
} else {
- echo("failed!\n");
+ echo("failed!\n");
}
echo("sprintf octal and hex test: ");
$test = sprintf("%4o %4x %4X %0"."8x", 128, 1024, 49151, 3457925);
if ($test == " 200 400 BFFF 0034c385") {
- echo("passed\n");
+ echo("passed\n");
} else {
- echo("failed!\n");
+ echo("failed!\n");
}
echo("sprintf octal binary test: ");
$test = sprintf("%b", 3457925);
if ($test == "1101001100001110000101") {
- echo("passed\n");
+ echo("passed\n");
} else {
- echo("failed!\n");
+ echo("failed!\n");
}
echo("sprintf float test: ");
$test = sprintf("%0"."06.2f", 10000/3.0);
if ($test == "003333.33") {
- echo("passed\n");
+ echo("passed\n");
} else {
- echo("failed!\n");
+ echo("failed!\n");
}
echo sprintf("%.2f\n", "99.00");
diff --git a/ext/standard/tests/general_functions/002.phpt b/ext/standard/tests/general_functions/002.phpt
index 58528da13a..43c67ec07b 100644
--- a/ext/standard/tests/general_functions/002.phpt
+++ b/ext/standard/tests/general_functions/002.phpt
@@ -1,9 +1,9 @@
--TEST--
quoted_printable_decode() function test
--FILE--
-<?php echo quoted_printable_decode("=FAwow-factor=C1=d0=D5=DD=C5=CE=CE=D9=C5=0A=
-=20=D4=cf=D2=C7=CF=D7=D9=C5=
-=20=
+<?php echo quoted_printable_decode("=FAwow-factor=C1=d0=D5=DD=C5=CE=CE=D9=C5=0A=
+=20=D4=cf=D2=C7=CF=D7=D9=C5=
+=20=
=D0=
=D2=CF=C5=CB=D4=D9"); ?>
--EXPECT--
diff --git a/ext/standard/tests/general_functions/003.phpt b/ext/standard/tests/general_functions/003.phpt
index 0388cf95b0..573491b8a2 100644
--- a/ext/standard/tests/general_functions/003.phpt
+++ b/ext/standard/tests/general_functions/003.phpt
@@ -6,18 +6,18 @@ levenshtein() function test
function test_me($title,$expect,$text1,$text2,$cost1=0,$cost2=0,$cost3=0) {
if($cost1==0)
- $result=levenshtein($text1,$text2);
- else
+ $result=levenshtein($text1,$text2);
+ else
$result=levenshtein($text1,$text2,$cost1,$cost2,$cost3);
- if($result==$expect) return 0;
+ if($result==$expect) return 0;
- echo "$title: result is $result instead of $expect ";
- echo "for '$text1'/'$text2' ";
- if($cost1) echo "($cost1:$cost2:$cost3)";
- echo "\n";
+ echo "$title: result is $result instead of $expect ";
+ echo "for '$text1'/'$text2' ";
+ if($cost1) echo "($cost1:$cost2:$cost3)";
+ echo "\n";
- return 1;
+ return 1;
}
$n=0;
diff --git a/ext/standard/tests/general_functions/004.phpt b/ext/standard/tests/general_functions/004.phpt
index fa83c7c220..80a7216939 100644
--- a/ext/standard/tests/general_functions/004.phpt
+++ b/ext/standard/tests/general_functions/004.phpt
@@ -5,7 +5,7 @@ fgetcsv() with tab delimited fields (BUG #8258)
chdir(__DIR__);
$fp=fopen("004.data","r");
while($a=fgetcsv($fp,100,"\t")) {
- echo join(",",$a)."\n";
+ echo join(",",$a)."\n";
}
fclose($fp);
?>
diff --git a/ext/standard/tests/general_functions/006.phpt b/ext/standard/tests/general_functions/006.phpt
index 6852286c5e..80a8fd4168 100644
--- a/ext/standard/tests/general_functions/006.phpt
+++ b/ext/standard/tests/general_functions/006.phpt
@@ -1,9 +1,9 @@
--TEST--
quoted_printable_decode() function test with CR/LF
--FILE--
-<?php echo quoted_printable_decode("=FAwow-factor=C1=D0=D5=DD=C5=CE=CE=D9=C5=0A=
-=20=D4=CF=D2=C7=CF=D7=D9=C5=
-=20=
+<?php echo quoted_printable_decode("=FAwow-factor=C1=D0=D5=DD=C5=CE=CE=D9=C5=0A=
+=20=D4=CF=D2=C7=CF=D7=D9=C5=
+=20=
=D0=
=D2=CF=C5=CB=D4=D9"); ?>
--EXPECT--
diff --git a/ext/standard/tests/general_functions/007.phpt b/ext/standard/tests/general_functions/007.phpt
index 02fc6c6480..e5775bb742 100644
--- a/ext/standard/tests/general_functions/007.phpt
+++ b/ext/standard/tests/general_functions/007.phpt
@@ -3,8 +3,8 @@ MD5 / Base64
--FILE--
<?php
function test($str) {
- $res = md5(base64_decode(base64_encode($str)))."\n";
- return $res;
+ $res = md5(base64_decode(base64_encode($str)))."\n";
+ return $res;
}
echo test("");
echo test("a");
diff --git a/ext/standard/tests/general_functions/009.phpt b/ext/standard/tests/general_functions/009.phpt
index 39dc2189b3..254572f612 100644
--- a/ext/standard/tests/general_functions/009.phpt
+++ b/ext/standard/tests/general_functions/009.phpt
@@ -3,8 +3,8 @@ SHA1
--FILE--
<?php
function test($str) {
- $res = sha1($str)."\n";
- return $res;
+ $res = sha1($str)."\n";
+ return $res;
}
echo test("");
echo test("a");
diff --git a/ext/standard/tests/general_functions/010.phpt b/ext/standard/tests/general_functions/010.phpt
index 51132c6a15..99971616d2 100644
--- a/ext/standard/tests/general_functions/010.phpt
+++ b/ext/standard/tests/general_functions/010.phpt
@@ -3,24 +3,19 @@ register_shutdown_function() & __call
--FILE--
<?php
class test {
- function _foo() {
- throw new Exception('test');
- }
- function __call($name=null, $args=null) {
- return test::_foo();
- }
+ function _foo() {
+ throw new Exception('test');
+ }
+ function __call($name=null, $args=null) {
+ return test::_foo();
+ }
}
-try {
- var_dump(register_shutdown_function(array("test","__call")));
-} catch (Error $e) {
- echo "\nException: " . $e->getMessage() . "\n";
-}
+var_dump(register_shutdown_function(array("test","__call")));
echo "Done\n";
?>
--EXPECTF--
-Exception: Non-static method test::__call() cannot be called statically
+Warning: register_shutdown_function(): Invalid shutdown callback 'test::__call' passed in %s on line %d
+bool(false)
Done
-
-Fatal error: Non-static method test::__call() cannot be called statically in %s on line %d
diff --git a/ext/standard/tests/general_functions/boolval.phpt b/ext/standard/tests/general_functions/boolval.phpt
index 3c998520ff..fbe66264c3 100644
--- a/ext/standard/tests/general_functions/boolval.phpt
+++ b/ext/standard/tests/general_functions/boolval.phpt
@@ -2,18 +2,18 @@
Testing boolval()
--FILE--
<?php
- var_dump(boolval(false));
- var_dump(boolval(NULL));
- var_dump(boolval(""));
- var_dump(boolval(0));
- var_dump(boolval(array()));
+ var_dump(boolval(false));
+ var_dump(boolval(NULL));
+ var_dump(boolval(""));
+ var_dump(boolval(0));
+ var_dump(boolval(array()));
- var_dump(boolval(true));
- var_dump(boolval("abc"));
- var_dump(boolval(0.5));
- var_dump(boolval(100));
- var_dump(boolval(new stdClass()));
- var_dump(boolval(STDIN));
+ var_dump(boolval(true));
+ var_dump(boolval("abc"));
+ var_dump(boolval(0.5));
+ var_dump(boolval(100));
+ var_dump(boolval(new stdClass()));
+ var_dump(boolval(STDIN));
?>
--EXPECT--
bool(false)
diff --git a/ext/standard/tests/general_functions/bug25038.phpt b/ext/standard/tests/general_functions/bug25038.phpt
index 52fe032056..58acf1c977 100644
--- a/ext/standard/tests/general_functions/bug25038.phpt
+++ b/ext/standard/tests/general_functions/bug25038.phpt
@@ -9,24 +9,22 @@ function bar($x='no argument')
}
try
{
- bar('first try');
+ bar('first try');
}
catch (Exception $e)
{
- print $e->getMessage()."\n";
+ print $e->getMessage()."\n";
}
try
{
- call_user_func('bar','second try');
+ call_user_func('bar','second try');
}
catch (Exception $e)
{
- print $e->getMessage()."\n";
+ print $e->getMessage()."\n";
}
?>
-===DONE===
--EXPECT--
This is an exception from bar(first try).
This is an exception from bar(second try).
-===DONE===
diff --git a/ext/standard/tests/general_functions/bug29038.phpt b/ext/standard/tests/general_functions/bug29038.phpt
index d0c87fb199..5502ecf61a 100644
--- a/ext/standard/tests/general_functions/bug29038.phpt
+++ b/ext/standard/tests/general_functions/bug29038.phpt
@@ -3,8 +3,8 @@ Bug #29038 (extract(), EXTR_PREFIX_SAME option prefixes empty strings)
--FILE--
<?php
function my_print_r($a) {
- ksort($a);
- print_r($a);
+ ksort($a);
+ print_r($a);
}
function f1() {
$c = extract(array("" => 1),EXTR_PREFIX_SAME,"prefix");
diff --git a/ext/standard/tests/general_functions/bug32647.phpt b/ext/standard/tests/general_functions/bug32647.phpt
index c6ff94833d..4f5697a0d4 100644
--- a/ext/standard/tests/general_functions/bug32647.phpt
+++ b/ext/standard/tests/general_functions/bug32647.phpt
@@ -10,8 +10,8 @@ function foo()
class bar
{
- function barfoo ()
- { echo "bar!\n"; }
+ function barfoo ()
+ { echo "bar!\n"; }
}
unset($obj);
@@ -30,11 +30,11 @@ register_shutdown_function(array($obj,'barfoo')); // Valid
?>
--EXPECTF--
-Notice: Undefined variable: obj in %s on line %d
+Warning: Undefined variable: obj in %s on line %d
Warning: register_shutdown_function(): Invalid shutdown callback 'Array' passed in %s on line %d
-Notice: Undefined variable: obj in %s on line %d
+Warning: Undefined variable: obj in %s on line %d
Warning: register_shutdown_function(): Invalid shutdown callback 'Array' passed in %s on line %d
@@ -46,13 +46,8 @@ Warning: register_shutdown_function(): Invalid shutdown callback 'Array' passed
Warning: register_shutdown_function(): Invalid shutdown callback 'bar' passed in %s on line %d
-Deprecated: Non-static method bar::barfoo() should not be called statically in %sbug32647.php on line %d
+Warning: register_shutdown_function(): Invalid shutdown callback 'bar::barfoo' passed in %sbug32647.php on line %d
Warning: register_shutdown_function(): Invalid shutdown callback 'bar::foobar' passed in %sbug32647.php on line %d
foo!
-
-Deprecated: Non-static method bar::barfoo() should not be called statically in Unknown on line 0
-
-Deprecated: Non-static method bar::barfoo() should not be called statically in Unknown on line 0
-bar!
bar!
diff --git a/ext/standard/tests/general_functions/bug35229.phpt b/ext/standard/tests/general_functions/bug35229.phpt
index 8e8895dd59..c0b3614f6e 100644
--- a/ext/standard/tests/general_functions/bug35229.phpt
+++ b/ext/standard/tests/general_functions/bug35229.phpt
@@ -9,9 +9,9 @@ class test2 {
}
spl_autoload_register(function ($class) {
- eval('class test1 extends test2 {}');
+ eval('class test1 extends test2 {}');
- test1::use_stack(
+ test1::use_stack(
1,2,3,4,5,6,7,8,9,10,
11,12,13,14,15,16,17,18,19,20,
21,22,23,24,25,26,27,28,29,30
diff --git a/ext/standard/tests/general_functions/bug36011.phpt b/ext/standard/tests/general_functions/bug36011.phpt
index 00530bf846..3fe4e774b4 100644
--- a/ext/standard/tests/general_functions/bug36011.phpt
+++ b/ext/standard/tests/general_functions/bug36011.phpt
@@ -5,25 +5,25 @@ Bug #36011 (Strict errormsg wrong for call_user_func() and the likes)
class TestClass
{
- static function test()
- {
- echo __METHOD__ . "()\n";
- }
-
- function whee()
- {
- array_map(array('TestClass', 'test'), array('array_value'));
- }
-
- function whee4()
- {
- call_user_func(array('TestClass', 'test'));
- }
-
- static function whee5()
- {
- call_user_func(array('TestClass', 'test'));
- }
+ static function test()
+ {
+ echo __METHOD__ . "()\n";
+ }
+
+ function whee()
+ {
+ array_map(array('TestClass', 'test'), array('array_value'));
+ }
+
+ function whee4()
+ {
+ call_user_func(array('TestClass', 'test'));
+ }
+
+ static function whee5()
+ {
+ call_user_func(array('TestClass', 'test'));
+ }
}
TestClass::test();
@@ -36,11 +36,9 @@ $a->whee5();
TestClass::whee5();
?>
-===DONE===
--EXPECT--
TestClass::test()
TestClass::test()
TestClass::test()
TestClass::test()
TestClass::test()
-===DONE===
diff --git a/ext/standard/tests/general_functions/bug40398.phpt b/ext/standard/tests/general_functions/bug40398.phpt
index e92be5bedc..274faf8308 100644
--- a/ext/standard/tests/general_functions/bug40398.phpt
+++ b/ext/standard/tests/general_functions/bug40398.phpt
@@ -5,64 +5,64 @@ Bug #40398 (parent and self callback functions erroneously called statically)
class Base
{
- function __construct($msg)
- {
- echo __METHOD__ . "($msg)\n";
- }
+ function __construct($msg)
+ {
+ echo __METHOD__ . "($msg)\n";
+ }
}
class Derived_1 extends Base
{
- public function __construct()
- {
- $args = func_get_args();
- call_user_func_array(array($this, 'Base::__construct'), $args);
- }
+ public function __construct()
+ {
+ $args = func_get_args();
+ call_user_func_array(array($this, 'Base::__construct'), $args);
+ }
}
class Derived_2 extends Base
{
- public function __construct()
- {
- $args = func_get_args();
- call_user_func_array(array($this, 'parent::__construct'), $args);
- }
+ public function __construct()
+ {
+ $args = func_get_args();
+ call_user_func_array(array($this, 'parent::__construct'), $args);
+ }
}
class Derived_3 extends Base
{
- public function __construct()
- {
- $args = func_get_args();
- call_user_func_array('Base::__construct', $args);
- }
+ public function __construct()
+ {
+ $args = func_get_args();
+ call_user_func_array('Base::__construct', $args);
+ }
}
class Derived_4 extends Base
{
- public function __construct()
- {
- $args = func_get_args();
- call_user_func_array('parent::__construct', $args);
- }
+ public function __construct()
+ {
+ $args = func_get_args();
+ call_user_func_array('parent::__construct', $args);
+ }
}
class Derived_5 extends Base
{
- public function __construct()
- {
- $args = func_get_args();
- call_user_func_array(array('Base', '__construct'), $args);
- }
+ public function __construct()
+ {
+ $args = func_get_args();
+ call_user_func_array(array('Base', '__construct'), $args);
+ }
}
class Derived_6 extends Base
{
- public function __construct()
- {
- $args = func_get_args();
- call_user_func_array(array('parent', '__construct'), $args);
- }
+ public function __construct()
+ {
+ $args = func_get_args();
+ call_user_func_array(array('parent', '__construct'), $args);
+ }
}
new Derived_1('1');
@@ -73,7 +73,6 @@ new Derived_5('5');
new Derived_6('6');
?>
-===DONE===
--EXPECT--
Base::__construct(1)
Base::__construct(2)
@@ -81,4 +80,3 @@ Base::__construct(3)
Base::__construct(4)
Base::__construct(5)
Base::__construct(6)
-===DONE===
diff --git a/ext/standard/tests/general_functions/bug41037.phpt b/ext/standard/tests/general_functions/bug41037.phpt
index b9bb5856d8..c8d0a668d0 100644
--- a/ext/standard/tests/general_functions/bug41037.phpt
+++ b/ext/standard/tests/general_functions/bug41037.phpt
@@ -4,8 +4,8 @@ Bug #41037 (unregister_tick_function() inside the tick function crash PHP)
<?php
function a() {
- echo "hello";
- unregister_tick_function('a');
+ echo "hello";
+ unregister_tick_function('a');
}
declare (ticks=1) {
diff --git a/ext/standard/tests/general_functions/bug41970.phpt b/ext/standard/tests/general_functions/bug41970.phpt
index 6f05137afc..f43bf64380 100644
--- a/ext/standard/tests/general_functions/bug41970.phpt
+++ b/ext/standard/tests/general_functions/bug41970.phpt
@@ -6,22 +6,26 @@ Bug #41970 (call_user_func_*() leaks on failure)
$a = array(4,3,2);
var_dump(call_user_func_array("sort", array($a)));
-var_dump(call_user_func_array("strlen", array($a)));
+try {
+ var_dump(call_user_func_array("strlen", array($a)));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump(call_user_func("sort", $a));
-var_dump(call_user_func("strlen", $a));
+try {
+ var_dump(call_user_func("strlen", $a));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done\n";
?>
--EXPECTF--
-Warning: Parameter 1 to sort() expected to be a reference, value given in %sbug41970.php on line 5
+Warning: Parameter 1 to sort() expected to be a reference, value given in %sbug41970.php on line %d
bool(true)
+strlen() expects parameter 1 to be string, array given
-Warning: strlen() expects parameter 1 to be string, array given in %sbug41970.php on line 6
-NULL
-
-Warning: Parameter 1 to sort() expected to be a reference, value given in %sbug41970.php on line 7
+Warning: Parameter 1 to sort() expected to be a reference, value given in %sbug41970.php on line %d
bool(true)
-
-Warning: strlen() expects parameter 1 to be string, array given in %sbug41970.php on line 8
-NULL
+strlen() expects parameter 1 to be string, array given
Done
diff --git a/ext/standard/tests/general_functions/bug44295.phpt b/ext/standard/tests/general_functions/bug44295.phpt
index c9744e64dd..12cfb819a4 100644
--- a/ext/standard/tests/general_functions/bug44295.phpt
+++ b/ext/standard/tests/general_functions/bug44295.phpt
@@ -25,5 +25,5 @@ try {
<?php exit(0); ?>
--EXPECT--
before
-in catch: DirectoryIterator::__construct(/this/path/does/not/exist): failed to open dir: No such file or directory
+in catch: DirectoryIterator::__construct(/this/path/does/not/exist): Failed to open directory: No such file or directory
==DONE==
diff --git a/ext/standard/tests/general_functions/bug44667.phpt b/ext/standard/tests/general_functions/bug44667.phpt
index d4d7b94b4b..00c8224416 100644
--- a/ext/standard/tests/general_functions/bug44667.phpt
+++ b/ext/standard/tests/general_functions/bug44667.phpt
@@ -8,8 +8,8 @@ Bug #44667 (proc_open() does not handle pipes with the mode 'wb' correctly)
$pipes = array();
$descriptor_spec = array(
- 0 => array('pipe', 'rb'),
- 1 => array('pipe', 'wb'),
+ 0 => array('pipe', 'rb'),
+ 1 => array('pipe', 'wb'),
);
$proc = proc_open('cat', $descriptor_spec, $pipes);
diff --git a/ext/standard/tests/general_functions/bug46587.phpt b/ext/standard/tests/general_functions/bug46587.phpt
index becbde9648..ee59feb444 100644
--- a/ext/standard/tests/general_functions/bug46587.phpt
+++ b/ext/standard/tests/general_functions/bug46587.phpt
@@ -4,13 +4,15 @@ Bug #46587 (mt_rand() does not check that max is greater than min).
<?php
var_dump(mt_rand(3,8));
-var_dump(mt_rand(8,3));
+try {
+ var_dump(mt_rand(8,3));
+} catch (ValueError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done.\n";
?>
--EXPECTF--
int(%d)
-
-Warning: mt_rand(): max(3) is smaller than min(8) in %s on line %d
-bool(false)
+max (3) is smaller than min (8)
Done.
diff --git a/ext/standard/tests/general_functions/bug47857.phpt b/ext/standard/tests/general_functions/bug47857.phpt
index d19eca7248..0d2b35b09f 100644
--- a/ext/standard/tests/general_functions/bug47857.phpt
+++ b/ext/standard/tests/general_functions/bug47857.phpt
@@ -3,23 +3,25 @@ Bug #47851 (is_callable throws fatal error)
--FILE--
<?php
class foo {
- function bar() {
- echo "ok\n";
- }
+ function bar() {
+ echo "ok\n";
+ }
}
var_dump(is_callable(array('foo','bar')));
-foo::bar();
+try {
+ foo::bar();
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump(is_callable(array('Exception','getMessage')));
-Exception::getMessage();
+try {
+ Exception::getMessage();
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-bool(true)
-
-Deprecated: Non-static method foo::bar() should not be called statically in %sbug47857.php on line %d
-ok
+--EXPECT--
+bool(false)
+Non-static method foo::bar() cannot be called statically
bool(false)
-
-Fatal error: Uncaught Error: Non-static method Exception::getMessage() cannot be called statically in %sbug47857.php:%d
-Stack trace:
-#0 {main}
- thrown in %sbug47857.php on line %d
+Non-static method Exception::getMessage() cannot be called statically
diff --git a/ext/standard/tests/general_functions/bug49847.phpt b/ext/standard/tests/general_functions/bug49847.phpt
index a35477d00c..1a09c364d8 100644
--- a/ext/standard/tests/general_functions/bug49847.phpt
+++ b/ext/standard/tests/general_functions/bug49847.phpt
@@ -5,17 +5,17 @@ Bug #49847 (exec() fails on lines larger then 4095 bytes)
$iswin = substr(PHP_OS, 0, 3) == "WIN";
if ($iswin) {
- $f = __DIR__ . '\\bug49847.tmp';
- $s = str_repeat(' ', 4097);
- $s .= '1';
- file_put_contents($f, $s);
- exec('type ' . $f, $output);
+ $f = __DIR__ . '\\bug49847.tmp';
+ $s = str_repeat(' ', 4097);
+ $s .= '1';
+ file_put_contents($f, $s);
+ exec('type ' . $f, $output);
} else {
- exec("printf %4098d 1", $output);
+ exec("printf %4098d 1", $output);
}
var_dump($output);
if ($iswin) {
- unlink($f);
+ unlink($f);
}
?>
--EXPECTF--
diff --git a/ext/standard/tests/general_functions/bug55371.phpt b/ext/standard/tests/general_functions/bug55371.phpt
deleted file mode 100644
index 5b324db599..0000000000
--- a/ext/standard/tests/general_functions/bug55371.phpt
+++ /dev/null
@@ -1,16 +0,0 @@
---TEST--
-Bug #55371 (get_magic_quotes_gpc() and get_magic_quotes_runtime() throw deprecated warning)
---FILE--
-<?php
-
-get_magic_quotes_gpc();
-get_magic_quotes_runtime();
-
-echo 'done';
-
-?>
---EXPECTF--
-Deprecated: Function get_magic_quotes_gpc() is deprecated in %s on line %d
-
-Deprecated: Function get_magic_quotes_runtime() is deprecated in %s on line %d
-done
diff --git a/ext/standard/tests/general_functions/bug60723.phpt b/ext/standard/tests/general_functions/bug60723.phpt
index 504de7afbf..93381d246c 100644
--- a/ext/standard/tests/general_functions/bug60723.phpt
+++ b/ext/standard/tests/general_functions/bug60723.phpt
@@ -14,6 +14,6 @@ readfile($log);
unlink($log);
?>
--EXPECTF--
-Notice: Undefined variable: aa in %sbug60723.php on line %d
-[%s ASIA/Chongqing] PHP Notice: Undefined variable: aa in %sbug60723.php on line %d
+Warning: Undefined variable: aa in %s on line %d
+[%s ASIA/Chongqing] PHP Warning: Undefined variable: aa in %s on line %d
[%s ASIA/Chongqing] dummy
diff --git a/ext/standard/tests/general_functions/bug67498.phpt b/ext/standard/tests/general_functions/bug67498.phpt
index 5b5951b0f8..dd1ef11ef5 100644
--- a/ext/standard/tests/general_functions/bug67498.phpt
+++ b/ext/standard/tests/general_functions/bug67498.phpt
@@ -6,10 +6,8 @@ $PHP_SELF = 1;
phpinfo(INFO_VARIABLES);
?>
-==DONE==
--EXPECTF--
phpinfo()
PHP Variables
%A
-==DONE==
diff --git a/ext/standard/tests/general_functions/bug70018.phpt b/ext/standard/tests/general_functions/bug70018.phpt
index f7aefcc03f..77df0417a6 100644
--- a/ext/standard/tests/general_functions/bug70018.phpt
+++ b/ext/standard/tests/general_functions/bug70018.phpt
@@ -1,11 +1,5 @@
--TEST--
Bug #70018 (exec does not strip all whitespace)
---SKIPIF--
-<?php
-if ("cli" != php_sapi_name()) {
- die("skip.. CLI only test");
-}
-?>
--FILE--
<?php
$output = array();
diff --git a/ext/standard/tests/general_functions/bug71891.phpt b/ext/standard/tests/general_functions/bug71891.phpt
index b1f7e200d8..4de58f2c29 100644
--- a/ext/standard/tests/general_functions/bug71891.phpt
+++ b/ext/standard/tests/general_functions/bug71891.phpt
@@ -4,10 +4,10 @@ Bug #71891 (header_register_callback() and register_shutdown_function())
<?php
header_register_callback(function () {
- echo 'header';
- register_shutdown_function(function () {
- echo 'shutdown';
- });
+ echo 'header';
+ register_shutdown_function(function () {
+ echo 'shutdown';
+ });
});
?>
--EXPECT--
diff --git a/ext/standard/tests/general_functions/bug72306.phpt b/ext/standard/tests/general_functions/bug72306.phpt
index 05c25e6f1e..761a6454b3 100644
--- a/ext/standard/tests/general_functions/bug72306.phpt
+++ b/ext/standard/tests/general_functions/bug72306.phpt
@@ -3,8 +3,8 @@ Bug #72306 (Heap overflow through proc_open and $env parameter)
--FILE--
<?php
class moo {
- function __construct() { $this->a = 0; }
- function __toString() { return $this->a++ ? str_repeat("a", 0x8000) : "a"; }
+ function __construct() { $this->a = 0; }
+ function __toString() { return $this->a++ ? str_repeat("a", 0x8000) : "a"; }
}
$env = array('some_option' => new moo());
diff --git a/ext/standard/tests/general_functions/bug72920.phpt b/ext/standard/tests/general_functions/bug72920.phpt
index 8ba4d26713..24a8724904 100644
--- a/ext/standard/tests/general_functions/bug72920.phpt
+++ b/ext/standard/tests/general_functions/bug72920.phpt
@@ -3,10 +3,14 @@ Bug #72920 (Accessing a private constant using constant() creates an exception A
--FILE--
<?php
class Foo {
- private const C1 = "a";
+ private const C1 = "a";
}
-var_dump(constant('Foo::C1'));
---EXPECTF--
-Warning: constant(): Couldn't find constant Foo::C1 in %s on line %d
-NULL
+try {
+ var_dump(constant('Foo::C1'));
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+?>
+--EXPECT--
+Cannot access private const Foo::C1
diff --git a/ext/standard/tests/general_functions/bug76643.phpt b/ext/standard/tests/general_functions/bug76643.phpt
index 47b5345860..07f789f464 100644
--- a/ext/standard/tests/general_functions/bug76643.phpt
+++ b/ext/standard/tests/general_functions/bug76643.phpt
@@ -6,7 +6,5 @@ $_SERVER = 'foo';
output_add_rewrite_var('bar', 'baz');
?>
<form action="http://example.com/"></form>
-===DONE===
--EXPECT--
<form action="http://example.com/"></form>
-===DONE===
diff --git a/ext/standard/tests/general_functions/call_user_func_array_variation_001.phpt b/ext/standard/tests/general_functions/call_user_func_array_variation_001.phpt
index c05a329342..a5b61d9971 100644
--- a/ext/standard/tests/general_functions/call_user_func_array_variation_001.phpt
+++ b/ext/standard/tests/general_functions/call_user_func_array_variation_001.phpt
@@ -4,11 +4,11 @@ call_user_func_array() passes by reference if the array element is referenced, r
<?php
function by_val($arg) {
- $arg = 'changed';
+ $arg = 'changed';
}
function by_ref(&$arg) {
- $arg = 'changed';
+ $arg = 'changed';
}
echo "------ Calling by_val() with unreferenced argument ------\n";
diff --git a/ext/standard/tests/general_functions/call_user_func_return.phpt b/ext/standard/tests/general_functions/call_user_func_return.phpt
index cb0f6998dc..4719587ffc 100644
--- a/ext/standard/tests/general_functions/call_user_func_return.phpt
+++ b/ext/standard/tests/general_functions/call_user_func_return.phpt
@@ -7,31 +7,30 @@ $t1 = 'test1';
function test1($arg1, $arg2)
{
- global $t1;
- echo "$arg1 $arg2\n";
- return $t1;
+ global $t1;
+ echo "$arg1 $arg2\n";
+ return $t1;
}
$t2 = 'test2';
function & test2($arg1, $arg2)
{
- global $t2;
- echo "$arg1 $arg2\n";
- return $t2;
+ global $t2;
+ echo "$arg1 $arg2\n";
+ return $t2;
}
function test($func)
{
- debug_zval_dump($func('Direct', 'Call'));
- debug_zval_dump(call_user_func_array($func, array('User', 'Func')));
+ debug_zval_dump($func('Direct', 'Call'));
+ debug_zval_dump(call_user_func_array($func, array('User', 'Func')));
}
test('test1');
test('test2');
?>
-===DONE===
--EXPECTF--
Direct Call
string(5) "test1" refcount(%d)
@@ -41,4 +40,3 @@ Direct Call
string(5) "test2" refcount(%d)
User Func
string(5) "test2" refcount(%d)
-===DONE===
diff --git a/ext/standard/tests/general_functions/callbacks_001.phpt b/ext/standard/tests/general_functions/callbacks_001.phpt
index a58f19d932..827f5c0182 100644
--- a/ext/standard/tests/general_functions/callbacks_001.phpt
+++ b/ext/standard/tests/general_functions/callbacks_001.phpt
@@ -69,7 +69,11 @@ class P extends O {
$this->call(array('parent', 'who'));
$this->call(array('P', 'parent::who'));
$this->call(array($this, 'O::who'));
- $this->call(array($this, 'B::who'));
+ try {
+ $this->call(array($this, 'B::who'));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
}
}
@@ -79,7 +83,6 @@ $o = new P;
$o->test();
?>
-===DONE===
--EXPECTF--
parent|who
B
@@ -103,6 +106,4 @@ O
$this|O::who
O
$this|B::who
-
-Warning: call_user_func() expects parameter 1 to be a valid callback, class 'P' is not a subclass of 'B' in %s on line %d
-===DONE===
+call_user_func() expects parameter 1 to be a valid callback, class 'P' is not a subclass of 'B'
diff --git a/ext/standard/tests/general_functions/callbacks_002.phpt b/ext/standard/tests/general_functions/callbacks_002.phpt
index 22130c524a..0d44035e0e 100644
--- a/ext/standard/tests/general_functions/callbacks_002.phpt
+++ b/ext/standard/tests/general_functions/callbacks_002.phpt
@@ -3,14 +3,24 @@ call_user_func(): Wrong parameters
--FILE--
<?php
-call_user_func(array('Foo', 'bar'));
-call_user_func(array(NULL, 'bar'));
-call_user_func(array('stdclass', NULL));
+try {
+ call_user_func(array('Foo', 'bar'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ call_user_func(array(NULL, 'bar'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ call_user_func(array('stdclass', NULL));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
--EXPECTF--
-Warning: call_user_func() expects parameter 1 to be a valid callback, class 'Foo' not found in %s on line %d
-
-Warning: call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in %s on line %d
-
-Warning: call_user_func() expects parameter 1 to be a valid callback, second array member is not a valid method in %s on line %d
+call_user_func() expects parameter 1 to be a valid callback, class 'Foo' not found
+call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object
+call_user_func() expects parameter 1 to be a valid callback, second array member is not a valid method
diff --git a/ext/standard/tests/general_functions/debug_zval_dump_o.phpt b/ext/standard/tests/general_functions/debug_zval_dump_o.phpt
index 64352105db..ac4149f61c 100644
--- a/ext/standard/tests/general_functions/debug_zval_dump_o.phpt
+++ b/ext/standard/tests/general_functions/debug_zval_dump_o.phpt
@@ -29,13 +29,13 @@ class object_class {
public $value4 = 30;
private function foo1() {
- echo "function foo1\n";
+ echo "function foo1\n";
}
protected function foo2() {
- echo "function foo2\n";
+ echo "function foo2\n";
}
public function foo3() {
- echo "function foo3\n";
+ echo "function foo3\n";
}
public $array_var = array( "key1" => 1, "key2 " => 3);
diff --git a/ext/standard/tests/general_functions/debug_zval_dump_v.phpt b/ext/standard/tests/general_functions/debug_zval_dump_v.phpt
index 6cb413dc26..1b0a919e03 100644
--- a/ext/standard/tests/general_functions/debug_zval_dump_v.phpt
+++ b/ext/standard/tests/general_functions/debug_zval_dump_v.phpt
@@ -85,7 +85,7 @@ debug_zval_dump($var_1);
echo "\n-- Value of \$var_2: --\n";
debug_zval_dump($var_2);
-echo "\n*** Testing debug_zval_dump() on miscelleneous input arguments ***\n";
+echo "\n*** Testing debug_zval_dump() on miscellaneous input arguments ***\n";
/* unset a variable */
$unset_var = 10.5;
unset($unset_var);
@@ -147,7 +147,7 @@ int(10)
-- Value of $ref_first_var --
-Notice: Undefined variable: ref_first_var in %s on line %d
+Warning: Undefined variable: ref_first_var in %s on line %d
NULL
-- Value of $first_var --
@@ -166,7 +166,7 @@ int(10)
-- Value of $var_3: (after unsetting var_3) --
-Notice: Undefined variable: var_3 in %s on line %d
+Warning: Undefined variable: var_3 in %s on line %d
NULL
-- Value of $var_2: --
@@ -177,13 +177,13 @@ int(10)
-- Value of $var_1: (after unsetting variable_1) --
-Notice: Undefined variable: var_1 in %s on line %d
+Warning: Undefined variable: var_1 in %s on line %d
NULL
-- Value of $var_2: --
int(10)
-*** Testing debug_zval_dump() on miscelleneous input arguments ***
+*** Testing debug_zval_dump() on miscellaneous input arguments ***
-- Iteration 1 --
NULL
-- Iteration 2 --
diff --git a/ext/standard/tests/general_functions/error_clear_last.phpt b/ext/standard/tests/general_functions/error_clear_last.phpt
index 675affb625..2cfd17793a 100644
--- a/ext/standard/tests/general_functions/error_clear_last.phpt
+++ b/ext/standard/tests/general_functions/error_clear_last.phpt
@@ -20,7 +20,7 @@ NULL
NULL
array(4) {
["type"]=>
- int(8)
+ int(2)
["message"]=>
string(21) "Undefined variable: b"
["file"]=>
diff --git a/ext/standard/tests/general_functions/error_get_last.phpt b/ext/standard/tests/general_functions/error_get_last.phpt
index 71f068f104..a4cae412b5 100644
--- a/ext/standard/tests/general_functions/error_get_last.phpt
+++ b/ext/standard/tests/general_functions/error_get_last.phpt
@@ -4,7 +4,11 @@ error_get_last() tests
<?php
var_dump(error_get_last());
-var_dump(error_get_last(true));
+try {
+ var_dump(error_get_last(true));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump(error_get_last());
$a = $b;
@@ -15,29 +19,18 @@ echo "Done\n";
?>
--EXPECTF--
NULL
-
-Warning: error_get_last() expects exactly 0 parameters, 1 given in %s on line %d
+error_get_last() expects exactly 0 parameters, 1 given
NULL
-array(4) {
- ["type"]=>
- int(2)
- ["message"]=>
- string(54) "error_get_last() expects exactly 0 parameters, 1 given"
- ["file"]=>
- string(%i) "%s"
- ["line"]=>
- int(4)
-}
-Notice: Undefined variable: b in %s on line %d
+Warning: Undefined variable: b in %s on line %d
array(4) {
["type"]=>
- int(8)
+ int(2)
["message"]=>
string(21) "Undefined variable: b"
["file"]=>
- string(%i) "%s"
+ string(%d) "%s"
["line"]=>
- int(7)
+ int(11)
}
Done
diff --git a/ext/standard/tests/general_functions/escapeshellarg_bug71039.phpt b/ext/standard/tests/general_functions/escapeshellarg_bug71039.phpt
index cbb3f6fcc4..b6bc828a87 100644
--- a/ext/standard/tests/general_functions/escapeshellarg_bug71039.phpt
+++ b/ext/standard/tests/general_functions/escapeshellarg_bug71039.phpt
@@ -7,4 +7,8 @@ escapeshellarg("hello\0world");
?>
===DONE===
--EXPECTF--
-Fatal error: escapeshellarg(): Input string contains NULL bytes in %s on line %d
+Fatal error: Uncaught TypeError: Input string contains NULL bytes in %s:%d
+Stack trace:
+#0 %s(%d): escapeshellarg('hello\x00world')
+#1 {main}
+ thrown in %s on line %d
diff --git a/ext/standard/tests/general_functions/escapeshellarg_variation1-win32.phpt b/ext/standard/tests/general_functions/escapeshellarg_variation1-win32.phpt
index aa264cce37..309eca316e 100644
--- a/ext/standard/tests/general_functions/escapeshellarg_variation1-win32.phpt
+++ b/ext/standard/tests/general_functions/escapeshellarg_variation1-win32.phpt
@@ -69,12 +69,11 @@ $inputs = array(
// loop through each element of $inputs to check the behaviour of escapeshellarg()
$iterator = 1;
foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump(escapeshellarg($input));
- $iterator++;
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(escapeshellarg($input));
+ $iterator++;
};
?>
-===Done===
--EXPECT--
*** Testing escapeshellarg() : usage variations ***
@@ -137,4 +136,3 @@ string(2) """"
-- Iteration 20 --
string(2) """"
-===Done===
diff --git a/ext/standard/tests/general_functions/escapeshellarg_variation1.phpt b/ext/standard/tests/general_functions/escapeshellarg_variation1.phpt
index 6f3b6a9f32..e2aec56c27 100644
--- a/ext/standard/tests/general_functions/escapeshellarg_variation1.phpt
+++ b/ext/standard/tests/general_functions/escapeshellarg_variation1.phpt
@@ -69,12 +69,11 @@ $inputs = array(
// loop through each element of $inputs to check the behaviour of escapeshellarg()
$iterator = 1;
foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump(escapeshellarg($input));
- $iterator++;
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(escapeshellarg($input));
+ $iterator++;
};
?>
-===Done===
--EXPECT--
*** Testing escapeshellarg() : usage variations ***
@@ -137,4 +136,3 @@ string(2) "''"
-- Iteration 20 --
string(2) "''"
-===Done===
diff --git a/ext/standard/tests/general_functions/escapeshellcmd-win32.phpt b/ext/standard/tests/general_functions/escapeshellcmd-win32.phpt
index 5254e5d57a..3f014fdf81 100644
--- a/ext/standard/tests/general_functions/escapeshellcmd-win32.phpt
+++ b/ext/standard/tests/general_functions/escapeshellcmd-win32.phpt
@@ -10,21 +10,21 @@ if( substr(PHP_OS, 0, 3) != 'WIN' ) {
<?php
echo "*** Testing escapeshellcmd() basic operations ***\n";
$data = array(
- '"abc',
- "'abc",
- '?<>',
- '()[]{}$',
- '%^',
- '#&;`|*?',
- '~<>\\',
- '%NOENV%',
- '!NOENV!'
+ '"abc',
+ "'abc",
+ '?<>',
+ '()[]{}$',
+ '%^',
+ '#&;`|*?',
+ '~<>\\',
+ '%NOENV%',
+ '!NOENV!'
);
$count = 1;
foreach ($data AS $value) {
- echo "-- Test " . $count++ . " --\n";
- var_dump(escapeshellcmd($value));
+ echo "-- Test " . $count++ . " --\n";
+ var_dump(escapeshellcmd($value));
}
echo "Done\n";
diff --git a/ext/standard/tests/general_functions/escapeshellcmd_bug71039.phpt b/ext/standard/tests/general_functions/escapeshellcmd_bug71039.phpt
index 0a4d7eacff..7ce31fb8dd 100644
--- a/ext/standard/tests/general_functions/escapeshellcmd_bug71039.phpt
+++ b/ext/standard/tests/general_functions/escapeshellcmd_bug71039.phpt
@@ -7,4 +7,8 @@ escapeshellcmd("hello\0world");
?>
===DONE===
--EXPECTF--
-Fatal error: escapeshellcmd(): Input string contains NULL bytes in %s on line %d
+Fatal error: Uncaught TypeError: Input string contains NULL bytes in %s:%d
+Stack trace:
+#0 %s(%d): escapeshellcmd('hello\x00world')
+#1 {main}
+ thrown in %s on line %d
diff --git a/ext/standard/tests/general_functions/floatval.phpt b/ext/standard/tests/general_functions/floatval.phpt
index a01e01dbf1..a409f92a75 100644
--- a/ext/standard/tests/general_functions/floatval.phpt
+++ b/ext/standard/tests/general_functions/floatval.phpt
@@ -13,23 +13,23 @@ $valid_floats = array(
1.0,
-1.0,
1.234,
- -1.234,
+ -1.234,
1.2e3,
- -1.2e3,
- 10.0000000000000000005,
- 10.5e+5,
+ -1.2e3,
+ 10.0000000000000000005,
+ 10.5e+5,
1e5,
- -1e5,
+ -1e5,
1e-5,
- -1e-1,
- 1e+5,
- -1e+5,
- 1E5,
- -1E5,
- 1E+5,
- -1E+5,
- .5e+7,
- -.5e+7
+ -1e-1,
+ 1e+5,
+ -1e+5,
+ 1E5,
+ -1E5,
+ 1E+5,
+ -1E+5,
+ .5e+7,
+ -.5e+7
);
/* loop to check that floatval() recognizes different
@@ -65,12 +65,12 @@ $not_float_types = array (
$dfp,
"0.0", // string
"1.0",
- "-1.3e3",
- "bob-1.3e3",
+ "-1.3e3",
+ "bob-1.3e3",
"10 Some dollars",
- "10.2 Some Dollars",
- "10.0 dollar" + 1,
- "10.0 dollar" + 1.0,
+ "10.2 Some Dollars",
+ "10.0 dollar" + 1,
+ "10.0 dollar" + 1.0,
"",
true,
NULL,
@@ -91,18 +91,6 @@ foreach ($not_float_types as $type ) {
var_dump( doubleval($type) );
}
-
-
-
-echo "\n*** Testing error conditions ***\n";
-//Zero argument
-var_dump( floatval() );
-var_dump( doubleval() );
-
-//arguments more than expected
-var_dump( floatval(TRUE, FALSE) );
-var_dump( doubleval(TRUE, FALSE) );
-
echo "\nDone\n";
@@ -194,18 +182,4 @@ float(1)
float(0)
float(0)
-*** Testing error conditions ***
-
-Warning: floatval() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: doubleval() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: floatval() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: doubleval() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
Done
diff --git a/ext/standard/tests/general_functions/floatval_basic.phpt b/ext/standard/tests/general_functions/floatval_basic.phpt
index 8ad628b4f0..d6a3b72a19 100644
--- a/ext/standard/tests/general_functions/floatval_basic.phpt
+++ b/ext/standard/tests/general_functions/floatval_basic.phpt
@@ -14,23 +14,23 @@ $valid_floats = array(
"1.0" => 1.0,
"-1.0" => -1.0,
"1.234" => 1.234,
- "-1.234" => -1.234,
+ "-1.234" => -1.234,
"1.2e3" => 1.2e3,
- "-1.2e3" => -1.2e3,
- "10.0000000000000000005" => 10.0000000000000000005,
- "10.5e+5" => 10.5e+5,
+ "-1.2e3" => -1.2e3,
+ "10.0000000000000000005" => 10.0000000000000000005,
+ "10.5e+5" => 10.5e+5,
"1e5" => 1e5,
- "-1e5" => -1e5,
+ "-1e5" => -1e5,
"1e5" => 1e-5,
- "-1e-1" => -1e-1,
- "1e+5" => 1e+5,
- "-1e+5" =>-1e+5,
- "1E5" => 1E5,
- "-1E5" => -1E5,
- "1E+5" => 1E+5,
- "-1E5" => -1E+5,
- ".5e+7" => .5e+7,
- "-.5e+7" =>-.5e+7
+ "-1e-1" => -1e-1,
+ "1e+5" => 1e+5,
+ "-1e+5" =>-1e+5,
+ "1E5" => 1E5,
+ "-1E5" => -1E5,
+ "1E+5" => 1E+5,
+ "-1E5" => -1E+5,
+ ".5e+7" => .5e+7,
+ "-.5e+7" =>-.5e+7
);
/* loop to check that floatval() recognizes different
@@ -50,7 +50,6 @@ foreach ($valid_floats as $key => $value ) {
}
?>
-===DONE===
--EXPECT--
*** Testing floatval() with valid float values ***
@@ -169,4 +168,3 @@ float(5000000)
-- Iteration : -.5e+7 --
float(-5000000)
-===DONE===
diff --git a/ext/standard/tests/general_functions/floatval_variation1.phpt b/ext/standard/tests/general_functions/floatval_variation1.phpt
index 2b49cd195b..e688253e3f 100644
--- a/ext/standard/tests/general_functions/floatval_variation1.phpt
+++ b/ext/standard/tests/general_functions/floatval_variation1.phpt
@@ -22,12 +22,12 @@ $not_float_types = array (
"directory resource" => $dfp,
"\"0.0\"" => "0.0", // string
"\"1.0\"" => "1.0",
- "\"-1.3e3\"" => "-1.3e3",
- "\"bob-1.3e3\"" => "bob-1.3e3",
+ "\"-1.3e3\"" => "-1.3e3",
+ "\"bob-1.3e3\"" => "bob-1.3e3",
"\"10 Some dollars\"" => "10 Some dollars",
- "\"10.2 Some Dollars\"" => "10.2 Some Dollars",
- "\"10.0 dollar\" + 1" => "10.0 dollar" + 1,
- "\"10.0 dollar\" + 1.0" => "10.0 dollar" + 1.0,
+ "\"10.2 Some Dollars\"" => "10.2 Some Dollars",
+ "\"10.0 dollar\" + 1" => "10.0 dollar" + 1,
+ "\"10.0 dollar\" + 1.0" => "10.0 dollar" + 1.0,
"\"\"" => "",
"true" => true,
"NULL" => NULL,
@@ -50,7 +50,6 @@ foreach ($not_float_types as $key => $type ) {
var_dump( doubleval($type) );
}
?>
-===DONE===
--EXPECTF--
Notice: A non well formed numeric value encountered in %s on line %d
@@ -155,4 +154,3 @@ float(0)
-- Iteration : null --
float(0)
-===DONE===
diff --git a/ext/standard/tests/general_functions/get_defined_constants_basic.phpt b/ext/standard/tests/general_functions/get_defined_constants_basic.phpt
index 1d9ca4a277..7876540e8a 100644
--- a/ext/standard/tests/general_functions/get_defined_constants_basic.phpt
+++ b/ext/standard/tests/general_functions/get_defined_constants_basic.phpt
@@ -22,13 +22,12 @@ $arr2 = get_defined_constants();
$n2 = count($arr2);
if ($n2 == $n1 + 1 && array_key_exists("USER_CONSTANT", $arr2)) {
- echo "TEST PASSED\n";
+ echo "TEST PASSED\n";
} else {
- echo "TEST FAILED\n";
+ echo "TEST FAILED\n";
}
?>
-===DONE===
--EXPECT--
*** Testing get_defined_constants() : basic functionality ***
string(5) "array"
@@ -36,4 +35,3 @@ string(5) "array"
array(0) {
}
TEST PASSED
-===DONE===
diff --git a/ext/standard/tests/general_functions/get_defined_vars_basic.phpt b/ext/standard/tests/general_functions/get_defined_vars_basic.phpt
index 6e9494509a..19b59fea96 100644
--- a/ext/standard/tests/general_functions/get_defined_vars_basic.phpt
+++ b/ext/standard/tests/general_functions/get_defined_vars_basic.phpt
@@ -15,7 +15,7 @@ function f1() {
$vars = get_defined_vars();
if (count($vars) != 0) {
- echo "TEST FAILED\n";
+ echo "TEST FAILED\n";
}
echo "\n-- ..define some local variables --\n";
@@ -33,7 +33,7 @@ function f2() {
$vars= get_defined_vars();
if (count($vars) != 0) {
- echo "TEST FAILED\n";
+ echo "TEST FAILED\n";
}
echo "\n-- ...define some variables --\n";
@@ -63,7 +63,6 @@ if (count($vars) == 0) {
f1();
?>
-===DONE===
--EXPECT--
Simple testcase for get_defined_vars() function
@@ -149,4 +148,3 @@ array(9) {
["b1"]=>
bool(true)
}
-===DONE===
diff --git a/ext/standard/tests/general_functions/get_extension_funcs_basic.phpt b/ext/standard/tests/general_functions/get_extension_funcs_basic.phpt
index 33d4af03d2..cb4b84c99d 100644
--- a/ext/standard/tests/general_functions/get_extension_funcs_basic.phpt
+++ b/ext/standard/tests/general_functions/get_extension_funcs_basic.phpt
@@ -14,10 +14,12 @@ $result = get_extension_funcs("standard");
var_dump(gettype($result));
var_dump(in_array("cos", $result));
+// Unknown extension
+var_dump(get_extension_funcs("foo"));
+
?>
-===DONE===
--EXPECT--
Simple testcase for get_extension_funcs() function
string(5) "array"
bool(true)
-===DONE===
+bool(false)
diff --git a/ext/standard/tests/general_functions/get_extension_funcs_error.phpt b/ext/standard/tests/general_functions/get_extension_funcs_error.phpt
deleted file mode 100644
index 44bd822d12..0000000000
--- a/ext/standard/tests/general_functions/get_extension_funcs_error.phpt
+++ /dev/null
@@ -1,40 +0,0 @@
---TEST--
-Test get_extension_funcs() function : error conditions
---FILE--
-<?php
-/* Prototype : array get_extension_funcs ( string $module_name )
- * Description: Returns an array with the names of the functions of a module.
- * Source code: Zend/zend_builtin_functions.c
- * Alias to functions:
- */
-
-echo "*** Testing get_extension_funcs() : error conditions ***\n";
-
-echo "\n-- Too few arguments --\n";
-var_dump(get_extension_funcs());
-
-$extra_arg = 1;
-echo "\n-- Too many arguments --\n";
-var_dump(get_extension_funcs("standard", $extra_arg));
-
-echo "\n-- Invalid extension name --\n";
-var_dump(get_extension_funcs("foo"));
-
-?>
-===DONE===
---EXPECTF--
-*** Testing get_extension_funcs() : error conditions ***
-
--- Too few arguments --
-
-Warning: get_extension_funcs() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
--- Too many arguments --
-
-Warning: get_extension_funcs() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
--- Invalid extension name --
-bool(false)
-===DONE===
diff --git a/ext/standard/tests/general_functions/get_include_path_basic.phpt b/ext/standard/tests/general_functions/get_include_path_basic.phpt
index 2017bf697a..bb7ccf542b 100644
--- a/ext/standard/tests/general_functions/get_include_path_basic.phpt
+++ b/ext/standard/tests/general_functions/get_include_path_basic.phpt
@@ -14,24 +14,13 @@ echo "*** Testing get_include_path()\n";
var_dump(get_include_path());
if (ini_get("include_path") == get_include_path()) {
- echo "PASSED\n";
+ echo "PASSED\n";
} else {
- echo "FAILED\n";
+ echo "FAILED\n";
}
-echo "\nError cases:\n";
-var_dump(get_include_path(TRUE));
-
-
?>
-===DONE===
--EXPECTF--
*** Testing get_include_path()
string(1) "."
PASSED
-
-Error cases:
-
-Warning: get_include_path() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-===DONE===
diff --git a/ext/standard/tests/general_functions/get_included_files.phpt b/ext/standard/tests/general_functions/get_included_files.phpt
index df41ec8513..d81c72e3ea 100644
--- a/ext/standard/tests/general_functions/get_included_files.phpt
+++ b/ext/standard/tests/general_functions/get_included_files.phpt
@@ -22,11 +22,7 @@ include(__DIR__."/get_included_files_inc2.inc");
echo "\n-- List included files atfter including inc2 which will include inc3 which includes inc1 --\n";
var_dump(get_included_files());
-echo "\n-- Error cases --\n";
-var_dump(get_included_files(true));
-
?>
-===DONE===
--EXPECTF--
*** Testing get_included_files()
@@ -55,9 +51,3 @@ array(4) {
[3]=>
string(%d) "%sget_included_files_inc3.inc"
}
-
--- Error cases --
-
-Warning: get_included_files() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-===DONE===
diff --git a/ext/standard/tests/general_functions/get_loaded_extensions_basic.phpt b/ext/standard/tests/general_functions/get_loaded_extensions_basic.phpt
index c72a88de13..3be43caecb 100644
--- a/ext/standard/tests/general_functions/get_loaded_extensions_basic.phpt
+++ b/ext/standard/tests/general_functions/get_loaded_extensions_basic.phpt
@@ -13,11 +13,9 @@ echo "Get loaded extensions\n";
var_dump(get_loaded_extensions());
?>
-===DONE===
--EXPECTF--
*** Testing get_loaded_extensions() : basic functionality ***
Get loaded extensions
array(%d) {
%a
}
-===DONE===
diff --git a/ext/standard/tests/general_functions/get_resource_type_basic.phpt b/ext/standard/tests/general_functions/get_resource_type_basic.phpt
index 58a49e713f..dcad549c7b 100644
--- a/ext/standard/tests/general_functions/get_resource_type_basic.phpt
+++ b/ext/standard/tests/general_functions/get_resource_type_basic.phpt
@@ -13,8 +13,6 @@ $res = fopen(__FILE__, "r");
var_dump(get_resource_type($res));
?>
-===DONE===
--EXPECT--
*** Testing get_resource_type() : basic functionality ***
string(6) "stream"
-===DONE===
diff --git a/ext/standard/tests/general_functions/getopt.phpt b/ext/standard/tests/general_functions/getopt.phpt
index 67864e9a96..4424072d1a 100644
--- a/ext/standard/tests/general_functions/getopt.phpt
+++ b/ext/standard/tests/general_functions/getopt.phpt
@@ -7,7 +7,7 @@ register_argc_argv=On
variables_order=GPS
--FILE--
<?php
- var_dump(getopt("d:m:j:vht"));
+ var_dump(getopt("d:m:j:vht"));
?>
--EXPECT--
array(5) {
diff --git a/ext/standard/tests/general_functions/getopt_002.phpt b/ext/standard/tests/general_functions/getopt_002.phpt
index 1bf65e70ab..6ae2d3cb3d 100644
--- a/ext/standard/tests/general_functions/getopt_002.phpt
+++ b/ext/standard/tests/general_functions/getopt_002.phpt
@@ -7,7 +7,7 @@ register_argc_argv=On
variables_order=GPS
--FILE--
<?php
- var_dump(getopt("2a:vcd1"));
+ var_dump(getopt("2a:vcd1"));
?>
--EXPECT--
array(4) {
diff --git a/ext/standard/tests/general_functions/getopt_003.phpt b/ext/standard/tests/general_functions/getopt_003.phpt
index e1a5146065..e40de84674 100644
--- a/ext/standard/tests/general_functions/getopt_003.phpt
+++ b/ext/standard/tests/general_functions/getopt_003.phpt
@@ -7,7 +7,7 @@ register_argc_argv=On
variables_order=GPS
--FILE--
<?php
- var_dump(getopt("2a:vcd1", array("another:", 12, 0, 1, "v")));
+ var_dump(getopt("2a:vcd1", array("another:", 12, 0, 1, "v")));
?>
--EXPECT--
array(7) {
diff --git a/ext/standard/tests/general_functions/getopt_004.phpt b/ext/standard/tests/general_functions/getopt_004.phpt
index ac0aafe27b..5e8e810d38 100644
--- a/ext/standard/tests/general_functions/getopt_004.phpt
+++ b/ext/standard/tests/general_functions/getopt_004.phpt
@@ -7,7 +7,7 @@ register_argc_argv=On
variables_order=GPS
--FILE--
<?php
- var_dump(getopt("v::", array("v::")));
+ var_dump(getopt("v::", array("v::")));
?>
--EXPECT--
array(1) {
diff --git a/ext/standard/tests/general_functions/getopt_005.phpt b/ext/standard/tests/general_functions/getopt_005.phpt
index 3fa1791eab..d75c4709ea 100644
--- a/ext/standard/tests/general_functions/getopt_005.phpt
+++ b/ext/standard/tests/general_functions/getopt_005.phpt
@@ -7,7 +7,7 @@ register_argc_argv=On
variables_order=GPS
--FILE--
<?php
- var_dump(getopt("a:", array("arg:")));
+ var_dump(getopt("a:", array("arg:")));
?>
--EXPECT--
array(2) {
diff --git a/ext/standard/tests/general_functions/getrusage.phpt b/ext/standard/tests/general_functions/getrusage.phpt
index 4caca88e1b..8ec131809f 100644
--- a/ext/standard/tests/general_functions/getrusage.phpt
+++ b/ext/standard/tests/general_functions/getrusage.phpt
@@ -8,16 +8,12 @@ getrusage() tests
var_dump(gettype(getrusage()));
var_dump(gettype(getrusage(1)));
var_dump(gettype(getrusage(-1)));
-var_dump(getrusage(array()));
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
string(5) "array"
string(5) "array"
string(5) "array"
-
-Warning: getrusage() expects parameter 1 to be int, array given in %s on line %d
-NULL
Done
diff --git a/ext/standard/tests/general_functions/getrusage_basic.phpt b/ext/standard/tests/general_functions/getrusage_basic.phpt
index a2b03ee07a..b057b57fae 100644
--- a/ext/standard/tests/general_functions/getrusage_basic.phpt
+++ b/ext/standard/tests/general_functions/getrusage_basic.phpt
@@ -15,16 +15,14 @@ echo "Simple testcase for getrusage() function\n";
$dat = getrusage();
if (!is_array($dat)) {
- echo "TEST FAILED : getrusage should return an array\n";
+ echo "TEST FAILED : getrusage should return an array\n";
}
// echo the fields which are common to all platforms
echo "User time used (seconds) " . $dat["ru_utime.tv_sec"] . "\n";
echo "User time used (microseconds) " . $dat["ru_utime.tv_usec"] . "\n";
?>
-===DONE===
--EXPECTF--
Simple testcase for getrusage() function
User time used (seconds) %d
User time used (microseconds) %d
-===DONE===
diff --git a/ext/standard/tests/general_functions/getservbyname_basic.phpt b/ext/standard/tests/general_functions/getservbyname_basic.phpt
index adaa7afb43..edc210fc39 100644
--- a/ext/standard/tests/general_functions/getservbyname_basic.phpt
+++ b/ext/standard/tests/general_functions/getservbyname_basic.phpt
@@ -8,12 +8,12 @@ Simone Gentili (sensorario@gmail.com)
--FILE--
<?php
- $services = array('http', 'ftp', 'ssh', 'telnet', 'imap', 'smtp', 'nicname', 'gopher', 'finger', 'pop3', 'www');
+ $services = array('http', 'ftp', 'ssh', 'telnet', 'imap', 'smtp', 'nicname', 'gopher', 'finger', 'pop3', 'www');
- foreach ($services as $service) {
- $port = getservbyname($service, 'tcp');
- var_dump($port);
- }
+ foreach ($services as $service) {
+ $port = getservbyname($service, 'tcp');
+ var_dump($port);
+ }
?>
diff --git a/ext/standard/tests/general_functions/getservbyport_basic.phpt b/ext/standard/tests/general_functions/getservbyport_basic.phpt
index b9e0f83c98..cc02a4508e 100644
--- a/ext/standard/tests/general_functions/getservbyport_basic.phpt
+++ b/ext/standard/tests/general_functions/getservbyport_basic.phpt
@@ -7,21 +7,21 @@ Michele Orselli (mo@ideato.it)
Simone Gentili (sensorario@gmail.com)
--FILE--
<?php
- if (file_exists("/etc/services")) {
- $file = "/etc/services";
- }
- elseif(substr(PHP_OS,0,3) == "WIN") $file = "C:/WINDOWS/system32/drivers/etc/services";
- else die(PHP_OS. " unsupported");
+ if (file_exists("/etc/services")) {
+ $file = "/etc/services";
+ }
+ elseif(substr(PHP_OS,0,3) == "WIN") $file = "C:/WINDOWS/system32/drivers/etc/services";
+ else die(PHP_OS. " unsupported");
- if(file_exists($file)){
- $services = file_get_contents($file);
+ if(file_exists($file)){
+ $services = file_get_contents($file);
$service = getservbyport( 80, "tcp" );
if(preg_match("/$service\s+80\/tcp/", $services)) {
- echo "PASS\n";
- }
- }else{
- echo "Services file not found in expected location\n";
- }
+ echo "PASS\n";
+ }
+ }else{
+ echo "Services file not found in expected location\n";
+ }
?>
--EXPECT--
PASS
diff --git a/ext/standard/tests/general_functions/getservbyport_variation1.phpt b/ext/standard/tests/general_functions/getservbyport_variation1.phpt
index a876ac1fea..349fe16a94 100644
--- a/ext/standard/tests/general_functions/getservbyport_variation1.phpt
+++ b/ext/standard/tests/general_functions/getservbyport_variation1.phpt
@@ -9,32 +9,16 @@ Michele Orselli (mo@ideato.it)
Simone Gentili (sensorario@gmail.com)
--FILE--
<?php
- var_dump(getservbyport( -1, "tcp" ));
- var_dump(getservbyport( 80, "ppp" ));
- var_dump(getservbyport( null, null));
- var_dump(getservbyport( array(), array()));
- var_dump(getservbyport( array(80), array("tcp")));
- var_dump(getservbyport( array(2, 3), array("one"=>1, "two"=>2)));
- var_dump(getservbyport( 2, 2));
- var_dump(getservbyport( "80", "tcp"));
- var_dump(getservbyport( new stdClass(), new stdClass()));
+ var_dump(getservbyport( -1, "tcp" ));
+ var_dump(getservbyport( 80, "ppp" ));
+ var_dump(getservbyport( null, null));
+ var_dump(getservbyport( 2, 2));
+ var_dump(getservbyport( "80", "tcp"));
?>
--EXPECTF--
bool(false)
bool(false)
bool(false)
-
-Warning: getservbyport() expects parameter 1 to be int, array given in %s on line %d
-NULL
-
-Warning: getservbyport() expects parameter 1 to be int, array given in %s on line %d
-NULL
-
-Warning: getservbyport() expects parameter 1 to be int, array given in %s on line %d
-NULL
bool(false)
string(%d) "%s"
-
-Warning: getservbyport() expects parameter 1 to be int, object given in %s on line %d
-NULL
diff --git a/ext/standard/tests/general_functions/gettype_settype_basic.phpt b/ext/standard/tests/general_functions/gettype_settype_basic.phpt
index f8ff6c4460..80d12588e1 100644
--- a/ext/standard/tests/general_functions/gettype_settype_basic.phpt
+++ b/ext/standard/tests/general_functions/gettype_settype_basic.phpt
@@ -93,14 +93,19 @@ foreach ($types as $type) {
$loop_count = 1;
foreach ($values as $var) {
echo "-- Iteration $loop_count --\n"; $loop_count ++;
- // set to new type
- var_dump( settype($var, $type) );
- // dump the var
- var_dump( $var );
+ try {
+ // set to new type
+ var_dump( settype($var, $type) );
- // check the new type
- var_dump( gettype($var) );
+ // dump the var
+ var_dump( $var );
+
+ // check the new type
+ var_dump( gettype($var) );
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
}
}
@@ -539,94 +544,33 @@ string(7) "boolean"
-- Setting type of data to resource --
-- Iteration 1 --
-2: settype(): Cannot convert to resource type
-bool(false)
-array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- int(3)
-}
-string(5) "array"
+Cannot convert to resource type
-- Iteration 2 --
-2: settype(): Cannot convert to resource type
-bool(false)
-string(14) "another string"
-string(6) "string"
+Cannot convert to resource type
-- Iteration 3 --
-2: settype(): Cannot convert to resource type
-bool(false)
-array(3) {
- [0]=>
- int(2)
- [1]=>
- int(3)
- [2]=>
- int(4)
-}
-string(5) "array"
+Cannot convert to resource type
-- Iteration 4 --
-2: settype(): Cannot convert to resource type
-bool(false)
-int(1)
-string(7) "integer"
+Cannot convert to resource type
-- Iteration 5 --
-2: settype(): Cannot convert to resource type
-bool(false)
-int(-20)
-string(7) "integer"
+Cannot convert to resource type
-- Iteration 6 --
-2: settype(): Cannot convert to resource type
-bool(false)
-float(2.54)
-string(6) "double"
+Cannot convert to resource type
-- Iteration 7 --
-2: settype(): Cannot convert to resource type
-bool(false)
-float(-2.54)
-string(6) "double"
+Cannot convert to resource type
-- Iteration 8 --
-2: settype(): Cannot convert to resource type
-bool(false)
-NULL
-string(4) "NULL"
+Cannot convert to resource type
-- Iteration 9 --
-2: settype(): Cannot convert to resource type
-bool(false)
-bool(false)
-string(7) "boolean"
+Cannot convert to resource type
-- Iteration 10 --
-2: settype(): Cannot convert to resource type
-bool(false)
-string(11) "some string"
-string(6) "string"
+Cannot convert to resource type
-- Iteration 11 --
-2: settype(): Cannot convert to resource type
-bool(false)
-string(6) "string"
-string(6) "string"
+Cannot convert to resource type
-- Iteration 12 --
-2: settype(): Cannot convert to resource type
-bool(false)
-resource(%d) of type (stream)
-string(8) "resource"
+Cannot convert to resource type
-- Iteration 13 --
-2: settype(): Cannot convert to resource type
-bool(false)
-resource(%d) of type (stream)
-string(8) "resource"
+Cannot convert to resource type
-- Iteration 14 --
-2: settype(): Cannot convert to resource type
-bool(false)
-object(point)#1 (2) {
- ["x"]=>
- int(10)
- ["y"]=>
- int(20)
-}
-string(6) "object"
+Cannot convert to resource type
-- Setting type of data to array --
-- Iteration 1 --
@@ -846,7 +790,7 @@ string(6) "object"
-- Setting type of data to string --
-- Iteration 1 --
-8: Array to string conversion
+2: Array to string conversion
bool(true)
string(5) "Array"
string(6) "string"
@@ -855,7 +799,7 @@ bool(true)
string(14) "another string"
string(6) "string"
-- Iteration 3 --
-8: Array to string conversion
+2: Array to string conversion
bool(true)
string(5) "Array"
string(6) "string"
diff --git a/ext/standard/tests/general_functions/gettype_settype_error.phpt b/ext/standard/tests/general_functions/gettype_settype_error.phpt
index 325e91e47f..e310f9e0ac 100644
--- a/ext/standard/tests/general_functions/gettype_settype_error.phpt
+++ b/ext/standard/tests/general_functions/gettype_settype_error.phpt
@@ -13,44 +13,20 @@ Test gettype() & settype() functions : error conditions
echo "**** Testing gettype() and settype() functions ****\n";
-echo "\n*** Testing gettype(): error conditions ***\n";
-//Zero arguments
-var_dump( gettype() );
-// args more than expected
-var_dump( gettype( "1", "2" ) );
-
echo "\n*** Testing settype(): error conditions ***\n";
-//Zero arguments
-var_dump( settype() );
-
-// args more than expected
-$var = 10.5;
-var_dump( settype( $var, $var, "int" ) );
// passing an invalid type to set
-var_dump( settype( $var, "unknown" ) );
+try {
+ settype( $var, "unknown" );
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
**** Testing gettype() and settype() functions ****
-*** Testing gettype(): error conditions ***
-
-Warning: gettype() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: gettype() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
*** Testing settype(): error conditions ***
-
-Warning: settype() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: settype() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-Warning: settype(): Invalid type in %s on line %d
-bool(false)
+Invalid type
Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_variation1.phpt b/ext/standard/tests/general_functions/gettype_settype_variation1.phpt
index 7fb8789ff3..93e69a2149 100644
--- a/ext/standard/tests/general_functions/gettype_settype_variation1.phpt
+++ b/ext/standard/tests/general_functions/gettype_settype_variation1.phpt
@@ -1,5 +1,5 @@
--TEST--
-Test gettype() & settype() functions : usage variatoins
+Test gettype() & settype() functions : usage variations
--SKIPIF--
<?php
if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
@@ -38,10 +38,6 @@ set_error_handler("foo");
$var1 = "another string";
$var2 = array(2,3,4);
-// a variable which is unset
-$unset_var = 10.5;
-unset( $unset_var );
-
class point
{
var $x;
@@ -149,10 +145,6 @@ $var_values = array (
new point(NULL, NULL),
new point(2.5, 40.5),
new point(0, 0),
-
- /* undefined/unset vars */
- $unset_var,
- $undef_var
);
/* test conversion to null type */
@@ -180,9 +172,6 @@ foreach ($var_values as $var) {
echo "Done\n";
?>
--EXPECT--
-8: Undefined variable: unset_var
-8: Undefined variable: undef_var
-
*** Testing gettype() & settype() functions : usage variations ***
-- Setting type of data to null --
@@ -576,14 +565,4 @@ string(6) "object"
bool(true)
NULL
string(4) "NULL"
--- Iteration 79 --
-string(4) "NULL"
-bool(true)
-NULL
-string(4) "NULL"
--- Iteration 80 --
-string(4) "NULL"
-bool(true)
-NULL
-string(4) "NULL"
Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_variation2.phpt b/ext/standard/tests/general_functions/gettype_settype_variation2.phpt
index d44c04e5dd..36b0e75485 100644
--- a/ext/standard/tests/general_functions/gettype_settype_variation2.phpt
+++ b/ext/standard/tests/general_functions/gettype_settype_variation2.phpt
@@ -24,7 +24,7 @@ precision=14
Set type of the data to "int"/"integer" and verify using gettype
Following are performed in the listed sequence:
get the current type of the variable
- set the type of the variable to interger/int type
+ set the type of the variable to integer/int type
dump the variable to see its new data
get the new type of the variable
*/
@@ -42,10 +42,6 @@ set_error_handler("foo");
$var1 = "another string";
$var2 = array(2,3,4);
-// a variable which is unset
-$unset_var = 10.5;
-unset( $unset_var );
-
class point
{
var $x;
@@ -153,10 +149,6 @@ $var_values = array (
new point(NULL, NULL),
new point(2.5, 40.5),
new point(0, 0),
-
- /* undefined/unset vars */
- $unset_var,
- $undef_var
);
// test conversion to these types
@@ -189,9 +181,6 @@ foreach ($types as $type) {
echo "Done\n";
?>
--EXPECT--
-8: Undefined variable: unset_var
-8: Undefined variable: undef_var
-
*** Testing settype() & gettype() : usage variations ***
-- Setting type of data to integer --
@@ -588,16 +577,6 @@ string(6) "object"
bool(true)
int(1)
string(7) "integer"
--- Iteration 79 --
-string(4) "NULL"
-bool(true)
-int(0)
-string(7) "integer"
--- Iteration 80 --
-string(4) "NULL"
-bool(true)
-int(0)
-string(7) "integer"
-- Setting type of data to int --
-- Iteration 1 --
@@ -993,14 +972,4 @@ string(6) "object"
bool(true)
int(1)
string(7) "integer"
--- Iteration 79 --
-string(4) "NULL"
-bool(true)
-int(0)
-string(7) "integer"
--- Iteration 80 --
-string(4) "NULL"
-bool(true)
-int(0)
-string(7) "integer"
Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_variation3.phpt b/ext/standard/tests/general_functions/gettype_settype_variation3.phpt
index 71b03461eb..f17b261437 100644
--- a/ext/standard/tests/general_functions/gettype_settype_variation3.phpt
+++ b/ext/standard/tests/general_functions/gettype_settype_variation3.phpt
@@ -38,10 +38,6 @@ set_error_handler("foo");
$var1 = "another string";
$var2 = array(2,3,4);
-// a variable which is unset
-$unset_var = 10.5;
-unset( $unset_var );
-
class point
{
var $x;
@@ -149,10 +145,6 @@ $var_values = array (
new point(NULL, NULL),
new point(2.5, 40.5),
new point(0, 0),
-
- /* undefined/unset vars */
- $unset_var,
- $undef_var
);
// test conversion to these types
@@ -185,9 +177,6 @@ foreach ($types as $type) {
echo "Done\n";
?>
--EXPECT--
-8: Undefined variable: unset_var
-8: Undefined variable: undef_var
-
*** Testing settype() & gettype() : usage variations ***
-- Setting type of data to float --
@@ -584,16 +573,6 @@ string(6) "object"
bool(true)
float(1)
string(6) "double"
--- Iteration 79 --
-string(4) "NULL"
-bool(true)
-float(0)
-string(6) "double"
--- Iteration 80 --
-string(4) "NULL"
-bool(true)
-float(0)
-string(6) "double"
-- Setting type of data to double --
-- Iteration 1 --
@@ -989,14 +968,4 @@ string(6) "object"
bool(true)
float(1)
string(6) "double"
--- Iteration 79 --
-string(4) "NULL"
-bool(true)
-float(0)
-string(6) "double"
--- Iteration 80 --
-string(4) "NULL"
-bool(true)
-float(0)
-string(6) "double"
Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_variation4.phpt b/ext/standard/tests/general_functions/gettype_settype_variation4.phpt
index a14cb73dbb..00da4bf4bb 100644
--- a/ext/standard/tests/general_functions/gettype_settype_variation4.phpt
+++ b/ext/standard/tests/general_functions/gettype_settype_variation4.phpt
@@ -38,10 +38,6 @@ set_error_handler("foo");
$var1 = "another string";
$var2 = array(2,3,4);
-// a variable which is unset
-$unset_var = 10.5;
-unset( $unset_var );
-
class point
{
var $x;
@@ -160,10 +156,6 @@ $var_values = array (
new point(0, 0),
new class_with_no_member,
- /* undefined/unset vars */
- $unset_var,
- $undef_var,
-
/* binary strings */
b"0",
b'0',
@@ -210,9 +202,6 @@ foreach ($types as $type) {
echo "Done\n";
?>
--EXPECT--
-8: Undefined variable: unset_var
-8: Undefined variable: undef_var
-
*** Testing settype() & gettype() : usage variations ***
-- Setting type of data to boolean --
@@ -632,24 +621,24 @@ bool(true)
bool(true)
string(7) "boolean"
-- Iteration 84 --
-string(4) "NULL"
+string(6) "string"
bool(true)
bool(false)
string(7) "boolean"
-- Iteration 85 --
-string(4) "NULL"
+string(6) "string"
bool(true)
bool(false)
string(7) "boolean"
-- Iteration 86 --
string(6) "string"
bool(true)
-bool(false)
+bool(true)
string(7) "boolean"
-- Iteration 87 --
string(6) "string"
bool(true)
-bool(false)
+bool(true)
string(7) "boolean"
-- Iteration 88 --
string(6) "string"
@@ -696,16 +685,6 @@ string(6) "string"
bool(true)
bool(true)
string(7) "boolean"
--- Iteration 97 --
-string(6) "string"
-bool(true)
-bool(true)
-string(7) "boolean"
--- Iteration 98 --
-string(6) "string"
-bool(true)
-bool(true)
-string(7) "boolean"
-- Setting type of data to bool --
-- Iteration 1 --
@@ -1124,24 +1103,24 @@ bool(true)
bool(true)
string(7) "boolean"
-- Iteration 84 --
-string(4) "NULL"
+string(6) "string"
bool(true)
bool(false)
string(7) "boolean"
-- Iteration 85 --
-string(4) "NULL"
+string(6) "string"
bool(true)
bool(false)
string(7) "boolean"
-- Iteration 86 --
string(6) "string"
bool(true)
-bool(false)
+bool(true)
string(7) "boolean"
-- Iteration 87 --
string(6) "string"
bool(true)
-bool(false)
+bool(true)
string(7) "boolean"
-- Iteration 88 --
string(6) "string"
@@ -1188,14 +1167,4 @@ string(6) "string"
bool(true)
bool(true)
string(7) "boolean"
--- Iteration 97 --
-string(6) "string"
-bool(true)
-bool(true)
-string(7) "boolean"
--- Iteration 98 --
-string(6) "string"
-bool(true)
-bool(true)
-string(7) "boolean"
Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_variation5.phpt b/ext/standard/tests/general_functions/gettype_settype_variation5.phpt
index c5e2640f9c..f9f0059bfa 100644
--- a/ext/standard/tests/general_functions/gettype_settype_variation5.phpt
+++ b/ext/standard/tests/general_functions/gettype_settype_variation5.phpt
@@ -24,24 +24,9 @@ precision=14
dump the variable to see its new data
get the new type of the variable
*/
-
-/* function to handle catchable errors */
-function foo($errno, $errstr, $errfile, $errline) {
-// var_dump($errstr);
- // print error no and error string
- echo "$errno: $errstr\n";
-}
-//set the error handler, this is required as
-// settype() would fail with catachable fatal error
-set_error_handler("foo");
-
$var1 = "another string";
$var2 = array(2,3,4);
-// a variable which is unset
-$unset_var = 10.5;
-unset( $unset_var );
-
class point
{
var $x;
@@ -67,7 +52,7 @@ $var_values = array (
true,
/* strings */
- "\xFF",
+ "\$",
"\x66",
"\0123",
"",
@@ -149,10 +134,6 @@ $var_values = array (
new point(NULL, NULL),
new point(2.5, 40.5),
new point(0, 0),
-
- /* undefined/unset vars */
- $unset_var,
- $undef_var
);
/* test conversion to resource type */
@@ -167,289 +148,246 @@ foreach ($var_values as $var) {
// get the current data type
var_dump( gettype($var) );
- // convert it to null
- var_dump( settype($var, $type) );
+ // convert it to resource
+ try {
+ var_dump(settype($var, $type));
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
// dump the converted data
- var_dump( $var );
+ var_dump($var);
// check the new type after conversion
- var_dump( gettype($var) );
+ var_dump(gettype($var));
}
echo "Done\n";
?>
--EXPECT--
-8: Undefined variable: unset_var
-8: Undefined variable: undef_var
-
*** Testing gettype() & settype() functions : usage variations ***
-- Setting type of data to resource --
-- Iteration 1 --
string(4) "NULL"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
NULL
string(4) "NULL"
-- Iteration 2 --
string(7) "boolean"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
bool(false)
string(7) "boolean"
-- Iteration 3 --
string(7) "boolean"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
bool(true)
string(7) "boolean"
-- Iteration 4 --
string(7) "boolean"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
bool(true)
string(7) "boolean"
-- Iteration 5 --
string(6) "string"
-2: settype(): Cannot convert to resource type
-bool(false)
-string(1) "ÿ"
+Cannot convert to resource type
+string(1) "$"
string(6) "string"
-- Iteration 6 --
string(6) "string"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
string(1) "f"
string(6) "string"
-- Iteration 7 --
string(6) "string"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
string(2) "
3"
string(6) "string"
-- Iteration 8 --
string(6) "string"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
string(0) ""
string(6) "string"
-- Iteration 9 --
string(6) "string"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
string(0) ""
string(6) "string"
-- Iteration 10 --
string(6) "string"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
string(1) " "
string(6) "string"
-- Iteration 11 --
string(6) "string"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
string(1) " "
string(6) "string"
-- Iteration 12 --
string(6) "string"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
string(2) "10"
string(6) "string"
-- Iteration 13 --
string(6) "string"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
string(2) "10"
string(6) "string"
-- Iteration 14 --
string(6) "string"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
string(8) "10string"
string(6) "string"
-- Iteration 15 --
string(6) "string"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
string(8) "10string"
string(6) "string"
-- Iteration 16 --
string(6) "string"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
string(1) "1"
string(6) "string"
-- Iteration 17 --
string(6) "string"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
string(2) "-1"
string(6) "string"
-- Iteration 18 --
string(6) "string"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
string(3) "1e2"
string(6) "string"
-- Iteration 19 --
string(6) "string"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
string(2) " 1"
string(6) "string"
-- Iteration 20 --
string(6) "string"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
string(22) "2974394749328742328432"
string(6) "string"
-- Iteration 21 --
string(6) "string"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
string(5) "-1e-2"
string(6) "string"
-- Iteration 22 --
string(6) "string"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
string(1) "1"
string(6) "string"
-- Iteration 23 --
string(6) "string"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
string(2) "-1"
string(6) "string"
-- Iteration 24 --
string(6) "string"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
string(3) "1e2"
string(6) "string"
-- Iteration 25 --
string(6) "string"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
string(2) " 1"
string(6) "string"
-- Iteration 26 --
string(6) "string"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
string(22) "2974394749328742328432"
string(6) "string"
-- Iteration 27 --
string(6) "string"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
string(5) "-1e-2"
string(6) "string"
-- Iteration 28 --
string(6) "string"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
string(4) "0xff"
string(6) "string"
-- Iteration 29 --
string(6) "string"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
string(4) "0x55"
string(6) "string"
-- Iteration 30 --
string(6) "string"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
string(5) "0XA55"
string(6) "string"
-- Iteration 31 --
string(6) "string"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
string(5) "0X123"
string(6) "string"
-- Iteration 32 --
string(6) "string"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
string(4) "0123"
string(6) "string"
-- Iteration 33 --
string(6) "string"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
string(4) "0123"
string(6) "string"
-- Iteration 34 --
string(6) "string"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
string(5) "-0123"
string(6) "string"
-- Iteration 35 --
string(6) "string"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
string(5) "+0123"
string(6) "string"
-- Iteration 36 --
string(6) "string"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
string(5) "-0123"
string(6) "string"
-- Iteration 37 --
string(6) "string"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
string(5) "+0123"
string(6) "string"
-- Iteration 38 --
string(6) "string"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
string(8) "-0x80001"
string(6) "string"
-- Iteration 39 --
string(6) "string"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
string(8) "+0x80001"
string(6) "string"
-- Iteration 40 --
string(6) "string"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
string(10) "-0x80001.5"
string(6) "string"
-- Iteration 41 --
string(6) "string"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
string(9) "0x80001.5"
string(6) "string"
-- Iteration 42 --
string(6) "string"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
string(12) "@$%#$%^$%^&^"
string(6) "string"
-- Iteration 43 --
string(5) "array"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
array(0) {
}
string(5) "array"
-- Iteration 44 --
string(5) "array"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
array(1) {
[0]=>
NULL
@@ -457,8 +395,7 @@ array(1) {
string(5) "array"
-- Iteration 45 --
string(5) "array"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
array(4) {
[0]=>
int(1)
@@ -472,8 +409,7 @@ array(4) {
string(5) "array"
-- Iteration 46 --
string(5) "array"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
array(4) {
[1]=>
string(3) "one"
@@ -487,8 +423,7 @@ array(4) {
string(5) "array"
-- Iteration 47 --
string(5) "array"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
array(3) {
[0]=>
float(1.5)
@@ -500,176 +435,147 @@ array(3) {
string(5) "array"
-- Iteration 48 --
string(6) "double"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
float(-2147483648)
string(6) "double"
-- Iteration 49 --
string(7) "integer"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
int(2147483647)
string(7) "integer"
-- Iteration 50 --
string(6) "double"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
float(2147483649)
string(6) "double"
-- Iteration 51 --
string(6) "double"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
float(1232147483649)
string(6) "double"
-- Iteration 52 --
string(7) "integer"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
int(85)
string(7) "integer"
-- Iteration 53 --
string(6) "double"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
float(1058513956921)
string(6) "double"
-- Iteration 54 --
string(7) "integer"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
int(-21903)
string(7) "integer"
-- Iteration 55 --
string(7) "integer"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
int(365)
string(7) "integer"
-- Iteration 56 --
string(7) "integer"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
int(-365)
string(7) "integer"
-- Iteration 57 --
string(6) "double"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
float(80561044571754)
string(6) "double"
-- Iteration 58 --
string(6) "double"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
float(100000)
string(6) "double"
-- Iteration 59 --
string(6) "double"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
float(-100000)
string(6) "double"
-- Iteration 60 --
string(6) "double"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
float(100000)
string(6) "double"
-- Iteration 61 --
string(6) "double"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
float(-100000)
string(6) "double"
-- Iteration 62 --
string(6) "double"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
float(-1.5)
string(6) "double"
-- Iteration 63 --
string(6) "double"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
float(0.5)
string(6) "double"
-- Iteration 64 --
string(6) "double"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
float(-0.5)
string(6) "double"
-- Iteration 65 --
string(6) "double"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
float(500000)
string(6) "double"
-- Iteration 66 --
string(6) "double"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
float(-500000)
string(6) "double"
-- Iteration 67 --
string(6) "double"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
float(-5.0E-7)
string(6) "double"
-- Iteration 68 --
string(6) "double"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
float(500000)
string(6) "double"
-- Iteration 69 --
string(6) "double"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
float(-500000)
string(6) "double"
-- Iteration 70 --
string(6) "double"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
float(512000)
string(6) "double"
-- Iteration 71 --
string(6) "double"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
float(-512000)
string(6) "double"
-- Iteration 72 --
string(6) "double"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
float(5.12E-7)
string(6) "double"
-- Iteration 73 --
string(6) "double"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
float(5.12E-7)
string(6) "double"
-- Iteration 74 --
string(6) "double"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
float(512000)
string(6) "double"
-- Iteration 75 --
string(6) "double"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
float(-512000)
string(6) "double"
-- Iteration 76 --
string(6) "object"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
object(point)#1 (2) {
["x"]=>
NULL
@@ -679,8 +585,7 @@ object(point)#1 (2) {
string(6) "object"
-- Iteration 77 --
string(6) "object"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
object(point)#2 (2) {
["x"]=>
float(2.5)
@@ -690,8 +595,7 @@ object(point)#2 (2) {
string(6) "object"
-- Iteration 78 --
string(6) "object"
-2: settype(): Cannot convert to resource type
-bool(false)
+Cannot convert to resource type
object(point)#3 (2) {
["x"]=>
int(0)
@@ -699,16 +603,4 @@ object(point)#3 (2) {
int(0)
}
string(6) "object"
--- Iteration 79 --
-string(4) "NULL"
-2: settype(): Cannot convert to resource type
-bool(false)
-NULL
-string(4) "NULL"
--- Iteration 80 --
-string(4) "NULL"
-2: settype(): Cannot convert to resource type
-bool(false)
-NULL
-string(4) "NULL"
Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_variation6.phpt b/ext/standard/tests/general_functions/gettype_settype_variation6.phpt
index 27beaa0744..7c5ea5efb6 100644
--- a/ext/standard/tests/general_functions/gettype_settype_variation6.phpt
+++ b/ext/standard/tests/general_functions/gettype_settype_variation6.phpt
@@ -38,10 +38,6 @@ set_error_handler("foo");
$var1 = "another string";
$var2 = array(2,3,4);
-// a variable which is unset
-$unset_var = 10.5;
-unset( $unset_var );
-
class point
{
var $x;
@@ -149,10 +145,6 @@ $var_values = array (
new point(NULL, NULL),
new point(2.5, 40.5),
new point(0, 0),
-
- /* undefined/unset vars */
- $unset_var,
- $undef_var
);
/* test conversion to array type */
@@ -181,10 +173,7 @@ foreach ($var_values as $var) {
echo "Done\n";
?>
---EXPECT--
-8: Undefined variable: unset_var
-8: Undefined variable: undef_var
-
+--EXPECTF--
*** Testing gettype() & settype() functions : usage variations ***
-- Setting type of data to array --
@@ -831,16 +820,4 @@ array(2) {
int(0)
}
string(5) "array"
--- Iteration 79 --
-string(4) "NULL"
-bool(true)
-array(0) {
-}
-string(5) "array"
--- Iteration 80 --
-string(4) "NULL"
-bool(true)
-array(0) {
-}
-string(5) "array"
Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_variation7.phpt b/ext/standard/tests/general_functions/gettype_settype_variation7.phpt
index dae20a1856..b282cbdab1 100644
--- a/ext/standard/tests/general_functions/gettype_settype_variation7.phpt
+++ b/ext/standard/tests/general_functions/gettype_settype_variation7.phpt
@@ -38,10 +38,6 @@ set_error_handler("foo");
$var1 = "another string";
$var2 = array(2,3,4);
-// a variable which is unset
-$unset_var = 10.5;
-unset( $unset_var );
-
class point
{
var $x;
@@ -149,10 +145,6 @@ $var_values = array (
new point(NULL, NULL),
new point(2.5, 40.5),
new point(0, 0),
-
- /* undefined/unset vars */
- $unset_var,
- $undef_var
);
/* test conversion to object type */
@@ -179,10 +171,7 @@ foreach ($var_values as $var) {
echo "Done\n";
?>
---EXPECT--
-8: Undefined variable: unset_var
-8: Undefined variable: undef_var
-
+--EXPECTF--
*** Testing gettype() & settype() functions : usage variations ***
-- Setting type of data to object --
@@ -829,16 +818,4 @@ object(point)#3 (2) {
int(0)
}
string(6) "object"
--- Iteration 79 --
-string(4) "NULL"
-bool(true)
-object(stdClass)#4 (0) {
-}
-string(6) "object"
--- Iteration 80 --
-string(4) "NULL"
-bool(true)
-object(stdClass)#4 (0) {
-}
-string(6) "object"
Done
diff --git a/ext/standard/tests/general_functions/gettype_settype_variation8.phpt b/ext/standard/tests/general_functions/gettype_settype_variation8.phpt
index 97f550e446..7ddfe54ab6 100644
--- a/ext/standard/tests/general_functions/gettype_settype_variation8.phpt
+++ b/ext/standard/tests/general_functions/gettype_settype_variation8.phpt
@@ -38,10 +38,6 @@ set_error_handler("foo");
$var1 = "another string";
$var2 = array(2,3,4);
-// a variable which is unset
-$unset_var = 10.5;
-unset( $unset_var );
-
class point
{
var $x;
@@ -149,10 +145,6 @@ $var_values = array (
new point(NULL, NULL),
new point(2.5, 40.5),
new point(0, 0),
-
- /* undefined/unset vars */
- $unset_var,
- $undef_var
);
/* test conversion to string type */
@@ -179,10 +171,7 @@ foreach ($var_values as $var) {
echo "Done\n";
?>
---EXPECT--
-8: Undefined variable: unset_var
-8: Undefined variable: undef_var
-
+--EXPECTF--
*** Testing gettype() & settype() functions : usage variations ***
-- Setting type of data to string --
@@ -399,31 +388,31 @@ string(12) "@$%#$%^$%^&^"
string(6) "string"
-- Iteration 43 --
string(5) "array"
-8: Array to string conversion
+2: Array to string conversion
bool(true)
string(5) "Array"
string(6) "string"
-- Iteration 44 --
string(5) "array"
-8: Array to string conversion
+2: Array to string conversion
bool(true)
string(5) "Array"
string(6) "string"
-- Iteration 45 --
string(5) "array"
-8: Array to string conversion
+2: Array to string conversion
bool(true)
string(5) "Array"
string(6) "string"
-- Iteration 46 --
string(5) "array"
-8: Array to string conversion
+2: Array to string conversion
bool(true)
string(5) "Array"
string(6) "string"
-- Iteration 47 --
string(5) "array"
-8: Array to string conversion
+2: Array to string conversion
bool(true)
string(5) "Array"
string(6) "string"
@@ -582,14 +571,4 @@ string(6) "object"
bool(true)
string(11) "ObjectPoint"
string(6) "string"
--- Iteration 79 --
-string(4) "NULL"
-bool(true)
-string(0) ""
-string(6) "string"
--- Iteration 80 --
-string(4) "NULL"
-bool(true)
-string(0) ""
-string(6) "string"
Done
diff --git a/ext/standard/tests/general_functions/head.phpt b/ext/standard/tests/general_functions/head.phpt
index 059c56b258..f8d4c28338 100644
--- a/ext/standard/tests/general_functions/head.phpt
+++ b/ext/standard/tests/general_functions/head.phpt
@@ -1,11 +1,5 @@
--TEST--
header() and friends
---SKIPIF--
-<?php
-if (php_sapi_name() != "cli") {
- die("skip this test is for CLI");
-}
-?>
--FILE--
<?php
diff --git a/ext/standard/tests/general_functions/include_path.phpt b/ext/standard/tests/general_functions/include_path.phpt
index 23c5bc45aa..ffadbc280c 100644
--- a/ext/standard/tests/general_functions/include_path.phpt
+++ b/ext/standard/tests/general_functions/include_path.phpt
@@ -6,14 +6,9 @@ include_path=.
<?php
var_dump(get_include_path());
-var_dump(get_include_path("var"));
var_dump(restore_include_path());
-var_dump(restore_include_path(""));
-
-var_dump(set_include_path());
-var_dump(get_include_path());
var_dump(set_include_path("var"));
var_dump(get_include_path());
@@ -32,9 +27,6 @@ var_dump(get_include_path());
var_dump(restore_include_path());
var_dump(get_include_path());
-var_dump(set_include_path(array()));
-var_dump(get_include_path());
-
var_dump(restore_include_path());
var_dump(get_include_path());
@@ -44,21 +36,9 @@ echo "Done\n";
--EXPECTF--
string(1) "."
-Warning: get_include_path() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Deprecated: Function restore_include_path() is deprecated in %s on line %d
-NULL
-
Deprecated: Function restore_include_path() is deprecated in %s on line %d
-
-Warning: restore_include_path() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Warning: set_include_path() expects exactly 1 parameter, 0 given in %s on line %d
NULL
string(1) "."
-string(1) "."
string(3) "var"
Deprecated: Function restore_include_path() is deprecated in %s on line %d
@@ -77,10 +57,6 @@ Deprecated: Function restore_include_path() is deprecated in %s on line %d
NULL
string(1) "."
-Warning: set_include_path() expects parameter 1 to be a valid path, array given in %s on line %d
-NULL
-string(1) "."
-
Deprecated: Function restore_include_path() is deprecated in %s on line %d
NULL
string(1) "."
diff --git a/ext/standard/tests/general_functions/intval.phpt b/ext/standard/tests/general_functions/intval.phpt
index 1650b91c6f..c56bdd7b94 100644
--- a/ext/standard/tests/general_functions/intval.phpt
+++ b/ext/standard/tests/general_functions/intval.phpt
@@ -146,13 +146,6 @@ foreach ($not_int_types as $type ) {
var_dump( intval($type) );
}
-echo "\n*** Testing error conditions ***\n";
-//Zero argument
-var_dump( intval() );
-
-//arguments more than expected
-var_dump( intval(TRUE, FALSE, TRUE) );
-
echo "\n--- Done ---\n";
@@ -295,12 +288,4 @@ int(0)
int(0)
int(0)
-*** Testing error conditions ***
-
-Warning: intval() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: intval() expects at most 2 parameters, 3 given in %s on line %d
-NULL
-
--- Done ---
diff --git a/ext/standard/tests/general_functions/intval_variation1.phpt b/ext/standard/tests/general_functions/intval_variation1.phpt
index e76d7083d4..c968b39a90 100644
--- a/ext/standard/tests/general_functions/intval_variation1.phpt
+++ b/ext/standard/tests/general_functions/intval_variation1.phpt
@@ -11,11 +11,11 @@ Test intval() function : usage variation
echo "*** Testing intval() : usage variation ***\n";
// Define error handler
-function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
- if (error_reporting() != 0) {
- // report non-silenced errors
- echo "Error: $err_no - $err_msg, $filename($linenum)\n";
- }
+function test_error_handler($err_no, $err_msg, $filename, $linenum) {
+ if (error_reporting() & $err_no) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ }
}
set_error_handler('test_error_handler');
@@ -29,9 +29,9 @@ unset ($unset_var);
// define some classes
class classWithToString
{
- public function __toString() {
- return "Class A object";
- }
+ public function __toString() {
+ return "Class A object";
+ }
}
class classWithoutToString
@@ -108,7 +108,6 @@ foreach($inputs as $key =>$value) {
};
?>
-===DONE===
--EXPECTF--
*** Testing intval() : usage variation ***
@@ -200,4 +199,3 @@ int(0)
--unset var--
int(0)
-===DONE===
diff --git a/ext/standard/tests/general_functions/is_array.phpt b/ext/standard/tests/general_functions/is_array.phpt
index 66e5b64934..200ecbd6ac 100644
--- a/ext/standard/tests/general_functions/is_array.phpt
+++ b/ext/standard/tests/general_functions/is_array.phpt
@@ -98,13 +98,6 @@ foreach ($varient_arrays as $type ) {
var_dump( is_array ($type) );
}
-echo "\n*** Testing error conditions ***\n";
-//Zero argument
-var_dump( is_array() );
-
-//arguments more than expected
-var_dump( is_array ($fp, $fp) );
-
echo "Done\n";
/* close resources */
fclose($fp);
@@ -202,12 +195,4 @@ bool(false)
bool(false)
-- Iteration 29 --
bool(false)
-
-*** Testing error conditions ***
-
-Warning: is_array() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: is_array() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
Done
diff --git a/ext/standard/tests/general_functions/is_bool.phpt b/ext/standard/tests/general_functions/is_bool.phpt
index 34d5e0ef6c..7c8d693a1b 100644
--- a/ext/standard/tests/general_functions/is_bool.phpt
+++ b/ext/standard/tests/general_functions/is_bool.phpt
@@ -127,13 +127,6 @@ foreach ($not_bool_types as $type ) {
var_dump( is_bool($type) );
}
-echo "\n*** Testing error conditions ***\n";
-//Zero argument
-var_dump( is_bool() );
-
-//arguments more than expected
-var_dump( is_bool(TRUE, FALSE) );
-
echo "Done\n";
// close resources
@@ -283,12 +276,4 @@ bool(false)
bool(false)
-- Iteration 65 --
bool(false)
-
-*** Testing error conditions ***
-
-Warning: is_bool() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: is_bool() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
Done
diff --git a/ext/standard/tests/general_functions/is_callable_basic1.phpt b/ext/standard/tests/general_functions/is_callable_basic1.phpt
index aa4c9aee23..50eb710e90 100644
--- a/ext/standard/tests/general_functions/is_callable_basic1.phpt
+++ b/ext/standard/tests/general_functions/is_callable_basic1.phpt
@@ -60,7 +60,6 @@ $defined_functions = array (
check_iscallable($defined_functions);
?>
-===DONE===
--EXPECT--
*** Testing is_callable() on defined functions ***
-- Iteration 1 --
@@ -103,4 +102,3 @@ Hello_World
bool(true)
bool(true)
Hello_World
-===DONE===
diff --git a/ext/standard/tests/general_functions/is_callable_basic2.phpt b/ext/standard/tests/general_functions/is_callable_basic2.phpt
index 7657875311..e744350cdb 100644
--- a/ext/standard/tests/general_functions/is_callable_basic2.phpt
+++ b/ext/standard/tests/general_functions/is_callable_basic2.phpt
@@ -124,7 +124,6 @@ foreach($objects as $object) {
}
?>
-===DONE===
--EXPECT--
*** Testing is_callable() on objects ***
@@ -207,12 +206,12 @@ object_class::func
bool(false)
object_class::func
-- Innerloop iteration 10 of Outerloop iteration 1 --
+bool(false)
bool(true)
-bool(true)
-bool(true)
+bool(false)
bool(true)
object_class::foo1
-bool(true)
+bool(false)
object_class::foo1
--- Outerloop iteration 2 ---
-- Innerloop iteration 1 of Outerloop iteration 2 --
@@ -288,12 +287,12 @@ no_member_class::func
bool(false)
no_member_class::func
-- Innerloop iteration 10 of Outerloop iteration 2 --
+bool(false)
bool(true)
-bool(true)
-bool(true)
+bool(false)
bool(true)
object_class::foo1
-bool(true)
+bool(false)
object_class::foo1
--- Outerloop iteration 3 ---
-- Innerloop iteration 1 of Outerloop iteration 3 --
@@ -369,12 +368,12 @@ contains_object_class::func
bool(true)
contains_object_class::func
-- Innerloop iteration 10 of Outerloop iteration 3 --
+bool(false)
bool(true)
-bool(true)
-bool(true)
+bool(false)
bool(true)
object_class::foo1
-bool(true)
+bool(false)
object_class::foo1
--- Outerloop iteration 4 ---
-- Innerloop iteration 1 of Outerloop iteration 4 --
@@ -450,12 +449,12 @@ contains_object_class::func
bool(true)
contains_object_class::func
-- Innerloop iteration 10 of Outerloop iteration 4 --
+bool(false)
bool(true)
-bool(true)
-bool(true)
+bool(false)
bool(true)
object_class::foo1
-bool(true)
+bool(false)
object_class::foo1
--- Outerloop iteration 5 ---
-- Innerloop iteration 1 of Outerloop iteration 5 --
@@ -531,12 +530,12 @@ object_class::func
bool(false)
object_class::func
-- Innerloop iteration 10 of Outerloop iteration 5 --
+bool(false)
bool(true)
-bool(true)
-bool(true)
+bool(false)
bool(true)
object_class::foo1
-bool(true)
+bool(false)
object_class::foo1
--- Outerloop iteration 6 ---
-- Innerloop iteration 1 of Outerloop iteration 6 --
@@ -612,12 +611,12 @@ no_member_class::func
bool(false)
no_member_class::func
-- Innerloop iteration 10 of Outerloop iteration 6 --
+bool(false)
bool(true)
-bool(true)
-bool(true)
+bool(false)
bool(true)
object_class::foo1
-bool(true)
+bool(false)
object_class::foo1
--- Outerloop iteration 7 ---
-- Innerloop iteration 1 of Outerloop iteration 7 --
@@ -693,12 +692,12 @@ object_class::func
bool(false)
object_class::func
-- Innerloop iteration 10 of Outerloop iteration 7 --
+bool(false)
bool(true)
-bool(true)
-bool(true)
+bool(false)
bool(true)
object_class::foo1
-bool(true)
+bool(false)
object_class::foo1
--- Outerloop iteration 8 ---
-- Innerloop iteration 1 of Outerloop iteration 8 --
@@ -774,11 +773,10 @@ Array
bool(false)
Array
-- Innerloop iteration 10 of Outerloop iteration 8 --
+bool(false)
bool(true)
-bool(true)
-bool(true)
+bool(false)
bool(true)
object_class::foo1
-bool(true)
+bool(false)
object_class::foo1
-===DONE===
diff --git a/ext/standard/tests/general_functions/is_callable_variation1.phpt b/ext/standard/tests/general_functions/is_callable_variation1.phpt
index 022c5a4549..4bb7f28a16 100644
--- a/ext/standard/tests/general_functions/is_callable_variation1.phpt
+++ b/ext/standard/tests/general_functions/is_callable_variation1.phpt
@@ -59,7 +59,6 @@ $undef_functions = array (
check_iscallable($undef_functions);
?>
-===DONE===
--EXPECT--
*** Testing is_callable() on undefined functions ***
-- Iteration 1 --
@@ -206,4 +205,3 @@ bool(true)
bool(false)
bool(false)
"echo()"
-===DONE===
diff --git a/ext/standard/tests/general_functions/is_callable_variation2.phpt b/ext/standard/tests/general_functions/is_callable_variation2.phpt
index af562d4ef1..2c53939545 100644
--- a/ext/standard/tests/general_functions/is_callable_variation2.phpt
+++ b/ext/standard/tests/general_functions/is_callable_variation2.phpt
@@ -57,7 +57,6 @@ check_iscallable($variants);
fclose($file_handle);
?>
-===DONE===
--EXPECTF--
*** Testing is_callable() on invalid function names ***
-- Iteration 1 --
@@ -148,4 +147,3 @@ Resource id #%d
bool(false)
bool(false)
Resource id #%d
-===DONE===
diff --git a/ext/standard/tests/general_functions/is_countable_with_variables.phpt b/ext/standard/tests/general_functions/is_countable_with_variables.phpt
index 700077ef17..0cb18769d6 100644
--- a/ext/standard/tests/general_functions/is_countable_with_variables.phpt
+++ b/ext/standard/tests/general_functions/is_countable_with_variables.phpt
@@ -7,7 +7,6 @@ Gabriel Caruso (carusogabriel34@gmail.com)
var_dump(is_countable([1, 2, 3]));
var_dump(is_countable((array) 1));
var_dump(is_countable((object) ['foo', 'bar', 'baz']));
-var_dump(is_countable());
$foo = ['', []];
@@ -24,9 +23,6 @@ if (!is_countable($bar)) {
bool(true)
bool(true)
bool(false)
-
-Warning: is_countable() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
int(2)
Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d
diff --git a/ext/standard/tests/general_functions/is_float.phpt b/ext/standard/tests/general_functions/is_float.phpt
index 6d4ada6701..76cfa80565 100644
--- a/ext/standard/tests/general_functions/is_float.phpt
+++ b/ext/standard/tests/general_functions/is_float.phpt
@@ -127,17 +127,6 @@ foreach ($not_floats as $value ) {
var_dump( @is_real($value) );
}
-echo "\n*** Testing error conditions ***\n";
-//Zero argument
-var_dump( is_float() );
-var_dump( is_double() );
-var_dump( is_real() );
-
-//arguments more than expected
-var_dump( is_float( $floats[0], $floats[1]) );
-var_dump( is_double( $floats[0], $floats[1]) );
-var_dump( is_real( $floats[0], $floats[1]) );
-
echo "Done\n";
// close the resources used
@@ -417,28 +406,4 @@ bool(false)
bool(false)
bool(false)
bool(false)
-
-*** Testing error conditions ***
-
-Warning: is_float() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: is_double() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Deprecated: Function is_real() is deprecated in %s on line %d
-
-Warning: is_real() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: is_float() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
-
-Warning: is_double() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
-
-Deprecated: Function is_real() is deprecated in %s on line %d
-
-Warning: is_real() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
Done
diff --git a/ext/standard/tests/general_functions/is_float_64bit.phpt b/ext/standard/tests/general_functions/is_float_64bit.phpt
index be5843a7d5..dc6df0f109 100644
--- a/ext/standard/tests/general_functions/is_float_64bit.phpt
+++ b/ext/standard/tests/general_functions/is_float_64bit.phpt
@@ -129,17 +129,6 @@ foreach ($not_floats as $value ) {
var_dump( @is_real($value) );
}
-echo "\n*** Testing error conditions ***\n";
-//Zero argument
-var_dump( is_float() );
-var_dump( is_double() );
-var_dump( is_real() );
-
-//arguments more than expected
-var_dump( is_float( $floats[0], $floats[1]) );
-var_dump( is_double( $floats[0], $floats[1]) );
-var_dump( is_real( $floats[0], $floats[1]) );
-
echo "Done\n";
?>
--EXPECTF--
@@ -414,28 +403,4 @@ bool(false)
bool(false)
bool(false)
bool(false)
-
-*** Testing error conditions ***
-
-Warning: is_float() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: is_double() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Deprecated: Function is_real() is deprecated in %s on line %d
-
-Warning: is_real() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: is_float() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
-
-Warning: is_double() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
-
-Deprecated: Function is_real() is deprecated in %s on line %d
-
-Warning: is_real() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
Done
diff --git a/ext/standard/tests/general_functions/is_int.phpt b/ext/standard/tests/general_functions/is_int.phpt
index 4cfbf653be..25e6c2564e 100644
--- a/ext/standard/tests/general_functions/is_int.phpt
+++ b/ext/standard/tests/general_functions/is_int.phpt
@@ -132,17 +132,6 @@ foreach ($not_int_types as $type ) {
var_dump( is_long($type) );
}
-echo "\n*** Testing error conditions ***\n";
-//Zero argument
-var_dump( is_int() );
-var_dump( is_integer() );
-var_dump( is_long() );
-
-//arguments more than expected
-var_dump( is_int(TRUE, FALSE) );
-var_dump( is_integer(TRUE, FALSE) );
-var_dump( is_long(TRUE, FALSE) );
-
echo "Done\n";
// close the resources
@@ -442,24 +431,4 @@ bool(false)
bool(false)
bool(false)
bool(false)
-
-*** Testing error conditions ***
-
-Warning: is_int() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: is_integer() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: is_long() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: is_int() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
-
-Warning: is_integer() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
-
-Warning: is_long() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
Done
diff --git a/ext/standard/tests/general_functions/is_int_64bit.phpt b/ext/standard/tests/general_functions/is_int_64bit.phpt
index dabc7be705..e5c6ce77e0 100644
--- a/ext/standard/tests/general_functions/is_int_64bit.phpt
+++ b/ext/standard/tests/general_functions/is_int_64bit.phpt
@@ -134,17 +134,6 @@ foreach ($not_int_types as $type ) {
var_dump( is_long($type) );
}
-echo "\n*** Testing error conditions ***\n";
-//Zero argument
-var_dump( is_int() );
-var_dump( is_integer() );
-var_dump( is_long() );
-
-//arguments more than expected
-var_dump( is_int(TRUE, FALSE) );
-var_dump( is_integer(TRUE, FALSE) );
-var_dump( is_long(TRUE, FALSE) );
-
echo "Done\n";
?>
--EXPECTF--
@@ -439,24 +428,4 @@ bool(false)
bool(false)
bool(false)
bool(false)
-
-*** Testing error conditions ***
-
-Warning: is_int() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: is_integer() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: is_long() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: is_int() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
-
-Warning: is_integer() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
-
-Warning: is_long() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
Done
diff --git a/ext/standard/tests/general_functions/is_null.phpt b/ext/standard/tests/general_functions/is_null.phpt
index 9082f5fcd1..4fc325c744 100644
--- a/ext/standard/tests/general_functions/is_null.phpt
+++ b/ext/standard/tests/general_functions/is_null.phpt
@@ -127,13 +127,6 @@ foreach ($not_null_types as $type ) {
var_dump( is_null($type) );
}
-echo "\n*** Testing error conditions ***\n";
-//Zero argument
-var_dump( is_null() );
-
-//arguments more than expected
-var_dump( is_null(NULL, null) );
-
echo "Done\n";
// close the resources used
@@ -285,12 +278,4 @@ bool(false)
bool(false)
-- Iteration 59 --
bool(false)
-
-*** Testing error conditions ***
-
-Warning: is_null() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: is_null() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
Done
diff --git a/ext/standard/tests/general_functions/is_numeric.phpt b/ext/standard/tests/general_functions/is_numeric.phpt
index c23e5e3b8c..491aa5d15b 100644
--- a/ext/standard/tests/general_functions/is_numeric.phpt
+++ b/ext/standard/tests/general_functions/is_numeric.phpt
@@ -145,13 +145,6 @@ foreach ($not_numerics as $type ) {
var_dump( is_numeric($type) );
}
-echo "\n*** Testing error conditions ***\n";
-//Zero argument
-var_dump( is_numeric() );
-
-//arguments more than expected
-var_dump( is_numeric("10", "20") );
-
echo "Done\n";
// close the resources used
@@ -373,12 +366,4 @@ bool(false)
bool(false)
-- Iteration 29 --
bool(false)
-
-*** Testing error conditions ***
-
-Warning: is_numeric() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
Done
diff --git a/ext/standard/tests/general_functions/is_object.phpt b/ext/standard/tests/general_functions/is_object.phpt
index 96c515bf65..dd0e7689fd 100644
--- a/ext/standard/tests/general_functions/is_object.phpt
+++ b/ext/standard/tests/general_functions/is_object.phpt
@@ -138,13 +138,6 @@ foreach ($not_objects as $type ) {
var_dump( is_object($type) );
}
-echo "\n*** Testing error conditions ***\n";
-//Zero argument
-var_dump( is_object() );
-
-//arguments more than expected
-var_dump( is_object($myClass_object, $myClass_object) );
-
echo "Done\n";
// close the resources used
@@ -216,12 +209,4 @@ bool(false)
bool(false)
-- Iteration 19 --
bool(false)
-
-*** Testing error conditions ***
-
-Warning: is_object() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: is_object() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
Done
diff --git a/ext/standard/tests/general_functions/is_resource.phpt b/ext/standard/tests/general_functions/is_resource.phpt
index 2717e3fa43..ff6f1fd422 100644
--- a/ext/standard/tests/general_functions/is_resource.phpt
+++ b/ext/standard/tests/general_functions/is_resource.phpt
@@ -2,9 +2,9 @@
Bug #27822 (is_resource() returns TRUE for closed resources)
--FILE--
<?php
- $f = fopen(__FILE__, 'r');
- fclose($f);
- var_dump(is_resource($f));
+ $f = fopen(__FILE__, 'r');
+ fclose($f);
+ var_dump(is_resource($f));
?>
--EXPECT--
bool(false)
diff --git a/ext/standard/tests/general_functions/is_resource_basic.phpt b/ext/standard/tests/general_functions/is_resource_basic.phpt
index 75f4e4a8d8..06988850ee 100644
--- a/ext/standard/tests/general_functions/is_resource_basic.phpt
+++ b/ext/standard/tests/general_functions/is_resource_basic.phpt
@@ -11,39 +11,39 @@ echo "*** Testing is_resource() : basic functionality ***\n";
class Hello {
public function SayHello($arg) {
- echo "Hello\n";
+ echo "Hello\n";
}
}
$vars = array(
- false,
- true,
- 10,
- 10.5,
- "Helo World",
- array(1,2,3,4,5),
- NULL,
- new Hello());
+ false,
+ true,
+ 10,
+ 10.5,
+ "Helo World",
+ array(1,2,3,4,5),
+ NULL,
+ new Hello());
$types = array(
- "bool=false",
- "bool=true",
- "integer",
- "double",
- "string",
- "array",
- "NULL",
- "object");
+ "bool=false",
+ "bool=true",
+ "integer",
+ "double",
+ "string",
+ "array",
+ "NULL",
+ "object");
echo "\nNon-resource type cases\n";
for ($i=0; $i < count($vars); $i++) {
- if (is_resource($vars[$i])) {
- echo $types[$i]. " test returns TRUE\n";
- } else {
- echo $types[$i]. " test returns FALSE\n";
- }
+ if (is_resource($vars[$i])) {
+ echo $types[$i]. " test returns TRUE\n";
+ } else {
+ echo $types[$i]. " test returns FALSE\n";
+ }
}
$res = fopen(__FILE__, "r");
@@ -51,9 +51,9 @@ echo "\nResource type..var_dump after file open returns\n";
var_dump($res);
echo "Resource type..after file open is_resource() returns";
if (is_resource($res)) {
- echo " TRUE\n";
+ echo " TRUE\n";
} else {
- echo " FALSE\n";
+ echo " FALSE\n";
}
fclose($res);
@@ -61,14 +61,13 @@ echo "\nResource type..var_dump after file close returns\n";
var_dump($res);
echo "Resource type..after file close is_resource() returns";
if (is_resource($res)) {
- echo " TRUE\n";
+ echo " TRUE\n";
} else {
- echo " FALSE\n";
+ echo " FALSE\n";
}
?>
-===DONE===
--EXPECTF--
*** Testing is_resource() : basic functionality ***
@@ -89,4 +88,3 @@ Resource type..after file open is_resource() returns TRUE
Resource type..var_dump after file close returns
resource(%d) of type (Unknown)
Resource type..after file close is_resource() returns FALSE
-===DONE===
diff --git a/ext/standard/tests/general_functions/is_scalar.phpt b/ext/standard/tests/general_functions/is_scalar.phpt
index 53620178c4..f7ef3f5317 100644
--- a/ext/standard/tests/general_functions/is_scalar.phpt
+++ b/ext/standard/tests/general_functions/is_scalar.phpt
@@ -105,14 +105,6 @@ foreach( $variation_array as $value ) {
var_dump( is_scalar($value) );
}
-echo "\n*** Testing error conditions ***\n";
-// Zero arguments
-var_dump( is_scalar() );
-
-// Arguments more than expected
-var_dump( is_scalar( $scalar_variables[2], $scalar_variables[2]) );
-var_dump( is_scalar( new stdclass, new stdclass) );
-
echo "Done\n";
// close the resources used
@@ -226,15 +218,4 @@ bool(false)
bool(false)
-- Iteration 18 --
bool(false)
-
-*** Testing error conditions ***
-
-Warning: is_scalar() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: is_scalar() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: is_scalar() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
Done
diff --git a/ext/standard/tests/general_functions/is_string.phpt b/ext/standard/tests/general_functions/is_string.phpt
index ea2fb36a24..7760f79831 100644
--- a/ext/standard/tests/general_functions/is_string.phpt
+++ b/ext/standard/tests/general_functions/is_string.phpt
@@ -17,7 +17,7 @@ EOT;
/* heredoc string with only numerics */
$heredoc_numeric_string = <<<EOT
123456 3993
-4849 string
+4849 string
EOT;
/* null heardoc string */
$heredoc_empty_string = <<<EOT
@@ -140,13 +140,6 @@ foreach ($not_strings as $type ) {
var_dump( is_string($type) );
}
-echo "\n*** Testing error conditions ***\n";
-//Zero argument
-var_dump( is_string() );
-
-//arguments more than expected
-var_dump( is_string("string", "test") );
-
echo "Done\n";
// close the resources used
@@ -292,12 +285,4 @@ bool(false)
bool(false)
-- Iteration 45 --
bool(false)
-
-*** Testing error conditions ***
-
-Warning: is_string() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: is_string() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
Done
diff --git a/ext/standard/tests/general_functions/isset_basic1.phpt b/ext/standard/tests/general_functions/isset_basic1.phpt
index bdaf1eb46d..7990810467 100644
--- a/ext/standard/tests/general_functions/isset_basic1.phpt
+++ b/ext/standard/tests/general_functions/isset_basic1.phpt
@@ -40,7 +40,6 @@ echo "Null test: " . (isset($n) ? "YES": "NO") . "\n";
echo "Object test: " . (isset($obj) ? "YES": "NO") . "\n";
echo "Resource test: " . (isset($res) ? "YES": "NO") . "\n";
?>
-===DONE===
--EXPECT--
*** Testing isset() : basic functionality ***
Integer test: YES
@@ -63,4 +62,3 @@ Boolean test: NO
Null test: NO
Object test: NO
Resource test: NO
-===DONE===
diff --git a/ext/standard/tests/general_functions/isset_basic2.phpt b/ext/standard/tests/general_functions/isset_basic2.phpt
index 925b19a2c0..586203d4ee 100644
--- a/ext/standard/tests/general_functions/isset_basic2.phpt
+++ b/ext/standard/tests/general_functions/isset_basic2.phpt
@@ -38,7 +38,6 @@ var_dump(isset($var[1]));
var_dump(isset($var, $var[1]));
?>
-===DONE===
--EXPECT--
*** Testing isset() : basic functionality ***
Test multiple scalar variables in a group
@@ -57,4 +56,3 @@ bool(false)
bool(true)
bool(true)
bool(true)
-===DONE===
diff --git a/ext/standard/tests/general_functions/ob_get_flush_basic.phpt b/ext/standard/tests/general_functions/ob_get_flush_basic.phpt
index 1c62340970..b724b3c91c 100644
--- a/ext/standard/tests/general_functions/ob_get_flush_basic.phpt
+++ b/ext/standard/tests/general_functions/ob_get_flush_basic.phpt
@@ -27,7 +27,6 @@ $string = ob_get_flush();
var_dump($string)
?>
-===DONE===
--EXPECT--
*** Testing ob_get_flush() : basic functionality ***
testing ob_get_flush() with some
@@ -39,4 +38,3 @@ Newlines too
array(0) {
}
string(0) ""
-===DONE===
diff --git a/ext/standard/tests/general_functions/ob_get_flush_error.phpt b/ext/standard/tests/general_functions/ob_get_flush_error.phpt
index 0664043eba..c45e810841 100644
--- a/ext/standard/tests/general_functions/ob_get_flush_error.phpt
+++ b/ext/standard/tests/general_functions/ob_get_flush_error.phpt
@@ -12,21 +12,12 @@ output_buffering=0
echo "*** Testing ob_get_flush() : error conditions ***\n";
-// One extra argument
-$extra_arg = 10;
-var_dump( ob_get_flush( $extra_arg ) );
-
// No ob_start() executed
var_dump( ob_get_flush() );
?>
-===DONE===
--EXPECTF--
*** Testing ob_get_flush() : error conditions ***
-Warning: ob_get_flush() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-
-Notice: ob_get_flush(): failed to delete and flush buffer. No buffer to delete or flush in %s on line %d
+Notice: ob_get_flush(): Failed to delete and flush buffer. No buffer to delete or flush in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/standard/tests/general_functions/ob_get_length_basic.phpt b/ext/standard/tests/general_functions/ob_get_length_basic.phpt
index b3470bec55..46d5d2d0f6 100644
--- a/ext/standard/tests/general_functions/ob_get_length_basic.phpt
+++ b/ext/standard/tests/general_functions/ob_get_length_basic.phpt
@@ -12,11 +12,11 @@ output_buffering=0
function dump_string_length( $string )
{
- ob_start();
- echo $string;
- $len = ob_get_length();
- ob_end_clean();
- var_dump( $len );
+ ob_start();
+ echo $string;
+ $len = ob_get_length();
+ ob_end_clean();
+ var_dump( $len );
}
echo "*** Testing ob_get_length() : basic functionality ***\n";
@@ -31,11 +31,7 @@ dump_string_length( ' lsf' );
dump_string_length( '' );
dump_string_length( null );
-// Extra argument
-var_dump( ob_get_length( 'foobar' ) );
-
?>
-===DONE===
--EXPECTF--
*** Testing ob_get_length() : basic functionality ***
bool(false)
@@ -45,7 +41,3 @@ int(1)
int(15)
int(0)
int(0)
-
-Warning: ob_get_length() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
-===DONE===
diff --git a/ext/standard/tests/general_functions/ob_start_closures.phpt b/ext/standard/tests/general_functions/ob_start_closures.phpt
index ba730961bd..c4b5fcc50d 100644
--- a/ext/standard/tests/general_functions/ob_start_closures.phpt
+++ b/ext/standard/tests/general_functions/ob_start_closures.phpt
@@ -27,7 +27,6 @@ ob_end_flush();
echo $str1, $str2;
?>
-===DONE===
--EXPECT--
*** Testing ob_start() : closures as output handlers ***
Output (1): Output (2): Test
@@ -36,4 +35,3 @@ Test
With newlines
Output (2): Test
With newlines
-===DONE===
diff --git a/ext/standard/tests/general_functions/output_add_rewrite_var_basic1.phpt b/ext/standard/tests/general_functions/output_add_rewrite_var_basic1.phpt
index 58b6f19f5c..980ae129ef 100644
--- a/ext/standard/tests/general_functions/output_add_rewrite_var_basic1.phpt
+++ b/ext/standard/tests/general_functions/output_add_rewrite_var_basic1.phpt
@@ -7,7 +7,7 @@ session.trans_sid_tags="a=href,area=href,frame=src,form="
url_rewriter.tags="a=href,area=href,frame=src,form="
--FILE--
<?php
- ob_start();
+ ob_start();
// Common setting
ini_set('url_rewriter.hosts', 'php.net,www.php.net');
ini_set('session.trans_sid_hosts', 'php.net,www.php.net');
diff --git a/ext/standard/tests/general_functions/output_add_rewrite_var_basic2.phpt b/ext/standard/tests/general_functions/output_add_rewrite_var_basic2.phpt
index 6b0c4e85a9..e888932a60 100644
--- a/ext/standard/tests/general_functions/output_add_rewrite_var_basic2.phpt
+++ b/ext/standard/tests/general_functions/output_add_rewrite_var_basic2.phpt
@@ -7,7 +7,7 @@ session.trans_sid_tags="a=href,area=href,frame=src,form="
url_rewriter.tags="a=href,area=href,frame=src,form="
--FILE--
<?php
- ob_start();
+ ob_start();
// Common setting
ini_set('url_rewriter.hosts', 'php.net,www.php.net');
ini_set('session.trans_sid_hosts', 'php.net,www.php.net');
diff --git a/ext/standard/tests/general_functions/output_add_rewrite_var_basic3.phpt b/ext/standard/tests/general_functions/output_add_rewrite_var_basic3.phpt
index 9e35f967f0..0cf10f7249 100644
--- a/ext/standard/tests/general_functions/output_add_rewrite_var_basic3.phpt
+++ b/ext/standard/tests/general_functions/output_add_rewrite_var_basic3.phpt
@@ -7,7 +7,7 @@ session.trans_sid_tags="a=href,area=href,frame=src,form="
url_rewriter.tags="a=href,area=href,frame=src,form="
--FILE--
<?php
- ob_start();
+ ob_start();
// Common setting
ini_set('url_rewriter.hosts', 'example.com');
ini_set('session.use_only_cookies', 0);
diff --git a/ext/standard/tests/general_functions/output_add_rewrite_var_basic4.phpt b/ext/standard/tests/general_functions/output_add_rewrite_var_basic4.phpt
index 2dda4e7896..332f7cfdc2 100644
--- a/ext/standard/tests/general_functions/output_add_rewrite_var_basic4.phpt
+++ b/ext/standard/tests/general_functions/output_add_rewrite_var_basic4.phpt
@@ -7,7 +7,7 @@ session.trans_sid_tags="a=href,area=href,frame=src,form="
url_rewriter.tags="a=href,area=href,frame=src,form="
--FILE--
<?php
- ob_start();
+ ob_start();
// Common setting
ini_set('url_rewriter.hosts', 'example.com');
ini_set('session.use_only_cookies', 1);
diff --git a/ext/standard/tests/general_functions/parse_ini_file.phpt b/ext/standard/tests/general_functions/parse_ini_file.phpt
index 368d262a6e..8b0db68a54 100644
--- a/ext/standard/tests/general_functions/parse_ini_file.phpt
+++ b/ext/standard/tests/general_functions/parse_ini_file.phpt
@@ -8,8 +8,6 @@ parse_ini_file() multiple calls
$filename = __DIR__."/parse_ini_file.dat";
@unlink($filename); /* Make sure the file really does not exist! */
-var_dump(parse_ini_file());
-var_dump(parse_ini_file(1,1,1,1));
var_dump(parse_ini_file($filename));
var_dump(parse_ini_file($filename, true));
@@ -121,16 +119,10 @@ var_dump(parse_ini_file($filename, true));
echo "Done\n";
?>
--EXPECTF--
-Warning: parse_ini_file() expects at least 1 parameter, 0 given in %sparse_ini_file.php on line 6
+Warning: parse_ini_file(%sparse_ini_file.dat): Failed to open stream: No such file or directory in %sparse_ini_file.php on line %d
bool(false)
-Warning: parse_ini_file() expects at most 3 parameters, 4 given in %sparse_ini_file.php on line 7
-bool(false)
-
-Warning: parse_ini_file(%sparse_ini_file.dat): failed to open stream: No such file or directory in %sparse_ini_file.php on line 8
-bool(false)
-
-Warning: parse_ini_file(%sparse_ini_file.dat): failed to open stream: No such file or directory in %sparse_ini_file.php on line 9
+Warning: parse_ini_file(%sparse_ini_file.dat): Failed to open stream: No such file or directory in %sparse_ini_file.php on line %d
bool(false)
array(1) {
["test"]=>
@@ -138,11 +130,11 @@ array(1) {
}
Warning: syntax error, unexpected '='%sparse_ini_file.dat on line 2
- in %sparse_ini_file.php on line 20
+ in %sparse_ini_file.php on line %d
bool(false)
Warning: syntax error, unexpected '='%sparse_ini_file.dat on line 2
- in %sparse_ini_file.php on line 26
+ in %sparse_ini_file.php on line %d
bool(false)
array(1) {
["test"]=>
diff --git a/ext/standard/tests/general_functions/parse_ini_string_001.phpt b/ext/standard/tests/general_functions/parse_ini_string_001.phpt
index 1621fe9f16..de1daa7637 100644
--- a/ext/standard/tests/general_functions/parse_ini_string_001.phpt
+++ b/ext/standard/tests/general_functions/parse_ini_string_001.phpt
@@ -23,7 +23,7 @@ PHP_CONSTANT = 1.2345678
HELLO = HELLO
[date]
-date =
+date =
time =
[paths]
@@ -62,7 +62,7 @@ Non_alpha11 = /
Non_alpha12 = \
;These chars have a special meaning when used in the value,
; hence parser throws an error
-;Non_alpha13 = &
+;Non_alpha13 = &
;Non_alpha14 = ^
;Non_alpha15 = {}
;Non_alpha16 = |
@@ -170,7 +170,7 @@ Key16 = Null
Key17 = nuLL
Key18 = null
-[ReservedKeys_as_Keys]
+[ReservedKeys_as_Keys]
; Expected:error, reserved key words must not be used as keys for ini file
;YES = 1
;Yes = 2
diff --git a/ext/standard/tests/general_functions/parse_ini_string_002.phpt b/ext/standard/tests/general_functions/parse_ini_string_002.phpt
index 106cd0c842..384398cdb2 100644
--- a/ext/standard/tests/general_functions/parse_ini_string_002.phpt
+++ b/ext/standard/tests/general_functions/parse_ini_string_002.phpt
@@ -3,9 +3,6 @@ parse_ini_string() multiple calls
--FILE--
<?php
-var_dump(parse_ini_string());
-var_dump(parse_ini_string(1,1,1,1));
-
$ini = "
test =
";
@@ -87,11 +84,6 @@ var_dump(parse_ini_string($ini, true));
echo "Done\n";
?>
--EXPECTF--
-Warning: parse_ini_string() expects at least 1 parameter, 0 given in %s
-bool(false)
-
-Warning: parse_ini_string() expects at most 3 parameters, 4 given in %s
-bool(false)
array(1) {
["test"]=>
string(0) ""
diff --git a/ext/standard/tests/general_functions/parse_ini_string_bug76068.phpt b/ext/standard/tests/general_functions/parse_ini_string_bug76068.phpt
index 8362fb84d1..359e9c3446 100644
--- a/ext/standard/tests/general_functions/parse_ini_string_bug76068.phpt
+++ b/ext/standard/tests/general_functions/parse_ini_string_bug76068.phpt
@@ -16,7 +16,6 @@ $s = parse_ini_string("[foo]\nbar=42|>baz",true, \INI_SCANNER_TYPED);
var_dump($s);
?>
-==DONE==
--EXPECT--
array(1) {
["foo"]=>
@@ -46,4 +45,3 @@ array(1) {
string(2) "42"
}
}
-==DONE==
diff --git a/ext/standard/tests/general_functions/php_uname_basic.phpt b/ext/standard/tests/general_functions/php_uname_basic.phpt
index 629318d725..b4fb78e6ea 100644
--- a/ext/standard/tests/general_functions/php_uname_basic.phpt
+++ b/ext/standard/tests/general_functions/php_uname_basic.phpt
@@ -20,7 +20,6 @@ var_dump(php_uname('v'));
var_dump(php_uname('m'));
?>
-===DONE===
--EXPECTF--
*** Testing php_uname() - basic test
string(%d) "%s"
@@ -32,4 +31,3 @@ string(%d) "%s"
string(%d) "%s"
string(%d) "%s"
string(%d) "%s"
-===DONE===
diff --git a/ext/standard/tests/general_functions/php_uname_error.phpt b/ext/standard/tests/general_functions/php_uname_error.phpt
index 392e1c930e..23859a33ac 100644
--- a/ext/standard/tests/general_functions/php_uname_error.phpt
+++ b/ext/standard/tests/general_functions/php_uname_error.phpt
@@ -8,49 +8,13 @@ Test php_uname() function - error conditions - pass function incorrect argument
echo "*** Testing php_uname() - error test\n";
-echo "\n-- Testing php_uname() function with more than expected no. of arguments --\n";
-var_dump( php_uname('a', true) );
-
echo "\n-- Testing php_uname() function with invalid mode --\n";
// am invalid mode should result in same o/p as mode 'a'
var_dump( php_uname('z') == php_uname('z') );
-class barClass {
-}
-
-$fp = fopen(__FILE__, "r");
-
-echo "\n-- Testing php_uname() function with invalid argument types --\n";
-var_dump(php_uname(array()));
-var_dump(php_uname(array('color' => 'red', 'item' => 'pen')));
-var_dump(php_uname(new barClass()));
-var_dump(php_uname($fp));
-
-fclose($fp);
?>
-===DONE===
--EXPECTF--
*** Testing php_uname() - error test
--- Testing php_uname() function with more than expected no. of arguments --
-
-Warning: php_uname() expects at most 1 parameter, 2 given in %s on line %d
-NULL
-
-- Testing php_uname() function with invalid mode --
bool(true)
-
--- Testing php_uname() function with invalid argument types --
-
-Warning: php_uname() expects parameter 1 to be string, array given in %s on line %d
-NULL
-
-Warning: php_uname() expects parameter 1 to be string, array given in %s on line %d
-NULL
-
-Warning: php_uname() expects parameter 1 to be string, object given in %s on line %d
-NULL
-
-Warning: php_uname() expects parameter 1 to be string, resource given in %s on line %d
-NULL
-===DONE===
diff --git a/ext/standard/tests/general_functions/phpcredits.phpt b/ext/standard/tests/general_functions/phpcredits.phpt
index 044232570e..dfcddc61f3 100644
--- a/ext/standard/tests/general_functions/phpcredits.phpt
+++ b/ext/standard/tests/general_functions/phpcredits.phpt
@@ -4,7 +4,6 @@ phpcredits()
<?php
var_dump(phpcredits());
-var_dump(phpcredits(array()));
echo "--\n";
var_dump(phpcredits(0));
@@ -40,9 +39,6 @@ PHP Quality Assurance Team
%wWebsites and Infrastructure team%w
%a
bool(true)
-
-Warning: phpcredits() expects parameter 1 to be int, array given in %sphpcredits.php on line 4
-NULL
--
PHP Credits
bool(true)
diff --git a/ext/standard/tests/general_functions/phpcredits2.phpt b/ext/standard/tests/general_functions/phpcredits2.phpt
index 9966f23a96..6aa023e919 100644
--- a/ext/standard/tests/general_functions/phpcredits2.phpt
+++ b/ext/standard/tests/general_functions/phpcredits2.phpt
@@ -6,7 +6,6 @@ dummy=x
<?php
var_dump(phpcredits());
-var_dump(phpcredits(array()));
echo "--\n";
var_dump(phpcredits(0));
@@ -18,9 +17,6 @@ var_dump(phpcredits(CREDITS_GROUP));
--EXPECTF--
<!DOCTYPE %a>%s</html>
bool(true)
-
-Warning: phpcredits() expects parameter 1 to be int, array given in %sphpcredits2.php on line 4
-NULL
--
<h1>PHP Credits</h1>
bool(true)
diff --git a/ext/standard/tests/general_functions/phpinfo.phpt b/ext/standard/tests/general_functions/phpinfo.phpt
index a805876aab..5f4d99ffba 100644
--- a/ext/standard/tests/general_functions/phpinfo.phpt
+++ b/ext/standard/tests/general_functions/phpinfo.phpt
@@ -5,9 +5,6 @@ phpinfo()
var_dump(phpinfo());
echo "--\n";
-var_dump(phpinfo(array()));
-
-echo "--\n";
var_dump(phpinfo(0));
echo "--\n";
@@ -62,10 +59,6 @@ PHP License
%A
bool(true)
--
-
-Warning: phpinfo() expects parameter 1 to be int, array given in %sphpinfo.php on line 5
-NULL
---
phpinfo()
bool(true)
--
diff --git a/ext/standard/tests/general_functions/phpinfo2.phpt b/ext/standard/tests/general_functions/phpinfo2.phpt
index f422f923d9..5a36aa9d28 100644
--- a/ext/standard/tests/general_functions/phpinfo2.phpt
+++ b/ext/standard/tests/general_functions/phpinfo2.phpt
@@ -7,9 +7,6 @@ dummy=x
var_dump(phpinfo());
echo "--\n";
-var_dump(phpinfo(array()));
-
-echo "--\n";
var_dump(phpinfo(0));
echo "--\n";
@@ -20,10 +17,6 @@ var_dump(phpinfo(INFO_LICENSE));
<!DOCTYPE %s>
%a</html>bool(true)
--
-
-Warning: phpinfo() expects parameter 1 to be int, array given in %sphpinfo2.php on line 5
-NULL
---
<!DOCTYPE %s>
%a</html>bool(true)
--
diff --git a/ext/standard/tests/general_functions/print_r.phpt b/ext/standard/tests/general_functions/print_r.phpt
index bcf5231144..3f24a5bc9d 100644
--- a/ext/standard/tests/general_functions/print_r.phpt
+++ b/ext/standard/tests/general_functions/print_r.phpt
@@ -101,7 +101,7 @@ $strings = array (
'PHP',
"abcd\x0n1234\x0005678\x0000efgh\xijkl", // strings with hexadecimal NULL
"abcd\0efgh\0ijkl\x00mnop\x000qrst\00uvwx\0000yz", // strings with octal NULL
- "1234\t\n5678\n\t9100\rabcda" // strings with escape characters
+ "1234\t\n5678\n\t9100\"abcda" // strings with escape characters
);
/* calling check_printr() to display contents of strings using print_r() */
check_printr($strings);
@@ -240,8 +240,8 @@ $resources = array (
using print_r() */
check_printr($resources);
-echo "\n*** Testing print_r() on different combinations of scalar
- and non-scalar variables ***\n";
+echo "\n*** Testing print_r() on different combinations of scalar
+ and non-scalar variables ***\n";
/* a variable which is unset */
$unset_var = 10.5;
unset($unset_var);
@@ -261,34 +261,16 @@ $variations = array (
non-scalar variables using print_r() */
check_printr($variations);
-echo "\n*** Testing print_r() on miscelleneous input arguments ***\n";
+echo "\n*** Testing print_r() on miscellaneous input arguments ***\n";
$misc_values = array (
@$unset_var,
NULL, // NULL argument
@$undef_variable, //undefined variable
null
);
-/* calling check_printr() to display miscelleneous data using print_r() */
+/* calling check_printr() to display miscellaneous data using print_r() */
check_printr($misc_values);
-/* checking print_r() on functions */
-echo "\n*** Testing print_r() on anonymous functions ***\n";
-$newfunc = create_function('$a,$b', 'return "$a * $b = " . ($a * $b);');
-echo "New anonymous function: $newfunc\n";
-print_r( $newfunc(2, 3) );
-/* creating anonymous function dynamically */
-print_r( create_function('$a', 'return "$a * $a = " . ($a * $b);') );
-
-echo "\n\n*** Testing error conditions ***\n";
-//passing zero argument
-var_dump( print_r() );
-
-//passing more than required no. of arguments
-var_dump( print_r(123, true, "abc") );
-
-// check when second arg is given other than boolean TRUE
-var_dump( print_r ($value, "string") );
-
/* closing resource handle used */
closedir($dir_handle);
@@ -622,13 +604,13 @@ abcd
-- Iteration 14 --
1234
5678
- 9100 abcda
+ 9100"abcda
1234
5678
- 9100 abcda
+ 9100"abcda
1234
5678
- 9100 abcda
+ 9100"abcda
*** Testing print_r() on boolean variables ***
-- Iteration 1 --
@@ -1480,15 +1462,15 @@ object_class Object
*** Testing print_r() on resources ***
-- Iteration 1 --
-Resource id #%d
-Resource id #%d
-Resource id #%d
+Resource id #5
+Resource id #5
+Resource id #5
-- Iteration 2 --
-Resource id #%d
-Resource id #%d
-Resource id #%d
-*** Testing print_r() on different combinations of scalar
- and non-scalar variables ***
+Resource id #6
+Resource id #6
+Resource id #6
+*** Testing print_r() on different combinations of scalar
+ and non-scalar variables ***
-- Iteration 1 --
Array
@@ -1697,7 +1679,7 @@ Array
[3] => /00\7
)
-*** Testing print_r() on miscelleneous input arguments ***
+*** Testing print_r() on miscellaneous input arguments ***
-- Iteration 1 --
@@ -1714,23 +1696,4 @@ Array
-- Iteration 4 --
-
-*** Testing print_r() on anonymous functions ***
-
-Deprecated: Function create_function() is deprecated in %s on line %d
-New anonymous function:
-2 * 3 = 6
-Deprecated: Function create_function() is deprecated in %s on line %d
-
-
-*** Testing error conditions ***
-
-Warning: print_r() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: print_r() expects at most 2 parameters, 3 given in %s on line %d
-bool(false)
-
-Notice: Undefined variable: value in %s on line %d
-string(0) ""
Done
diff --git a/ext/standard/tests/general_functions/print_r_64bit.phpt b/ext/standard/tests/general_functions/print_r_64bit.phpt
index 8584f08758..a0e9e148c6 100644
--- a/ext/standard/tests/general_functions/print_r_64bit.phpt
+++ b/ext/standard/tests/general_functions/print_r_64bit.phpt
@@ -105,7 +105,7 @@ $strings = array (
'PHP',
"abcd\x0n1234\x0005678\x0000efgh\xijkl", // strings with hexadecimal NULL
"abcd\0efgh\0ijkl\x00mnop\x000qrst\00uvwx\0000yz", // strings with octal NULL
- "1234\t\n5678\n\t9100\rabcda" // strings with escape characters
+ "1234\t\n5678\n\t9100\"abcda" // strings with escape characters
);
/* calling check_printr() to display contents of strings using print_r() */
check_printr($strings);
@@ -244,8 +244,8 @@ $resources = array (
using print_r() */
check_printr($resources);
-echo "\n*** Testing print_r() on different combinations of scalar
- and non-scalar variables ***\n";
+echo "\n*** Testing print_r() on different combinations of scalar
+ and non-scalar variables ***\n";
/* a variable which is unset */
$unset_var = 10.5;
unset($unset_var);
@@ -265,34 +265,16 @@ $variations = array (
non-scalar variables using print_r() */
check_printr($variations);
-echo "\n*** Testing print_r() on miscelleneous input arguments ***\n";
+echo "\n*** Testing print_r() on miscellaneous input arguments ***\n";
$misc_values = array (
@$unset_var,
NULL, // NULL argument
@$undef_variable, //undefined variable
null
);
-/* calling check_printr() to display miscelleneous data using print_r() */
+/* calling check_printr() to display miscellaneous data using print_r() */
check_printr($misc_values);
-/* checking print_r() on functions */
-echo "\n*** Testing print_r() on anonymous functions ***\n";
-$newfunc = create_function('$a,$b', 'return "$a * $b = " . ($a * $b);');
-echo "New anonymous function: $newfunc\n";
-print_r( $newfunc(2, 3) );
-/* creating anonymous function dynamically */
-print_r( create_function('$a', 'return "$a * $a = " . ($a * $b);') );
-
-echo "\n\n*** Testing error conditions ***\n";
-//passing zero argument
-var_dump( print_r() );
-
-//passing more than required no. of arguments
-var_dump( print_r(123, true, "abc") );
-
-// check when second arg is given other than boolean TRUE
-var_dump( print_r ($value, "string") );
-
/* closing resource handle used */
closedir($dir_handle);
@@ -626,13 +608,13 @@ abcd
-- Iteration 14 --
1234
5678
- 9100 abcda
+ 9100"abcda
1234
5678
- 9100 abcda
+ 9100"abcda
1234
5678
- 9100 abcda
+ 9100"abcda
*** Testing print_r() on boolean variables ***
-- Iteration 1 --
@@ -1491,8 +1473,8 @@ Resource id #5
Resource id #6
Resource id #6
Resource id #6
-*** Testing print_r() on different combinations of scalar
- and non-scalar variables ***
+*** Testing print_r() on different combinations of scalar
+ and non-scalar variables ***
-- Iteration 1 --
Array
@@ -1701,7 +1683,7 @@ Array
[3] => /00\7
)
-*** Testing print_r() on miscelleneous input arguments ***
+*** Testing print_r() on miscellaneous input arguments ***
-- Iteration 1 --
@@ -1718,23 +1700,4 @@ Array
-- Iteration 4 --
-
-*** Testing print_r() on anonymous functions ***
-
-Deprecated: Function create_function() is deprecated in %s on line %d
-New anonymous function:
-2 * 3 = 6
-Deprecated: Function create_function() is deprecated in %s on line %d
-
-
-*** Testing error conditions ***
-
-Warning: print_r() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: print_r() expects at most 2 parameters, 3 given in %s on line %d
-bool(false)
-
-Notice: Undefined variable: value in %s on line %d
-string(0) ""
Done
diff --git a/ext/standard/tests/general_functions/proc_nice_basic-win.phpt b/ext/standard/tests/general_functions/proc_nice_basic-win.phpt
index 87a4545501..6bf3b2c0a6 100644
--- a/ext/standard/tests/general_functions/proc_nice_basic-win.phpt
+++ b/ext/standard/tests/general_functions/proc_nice_basic-win.phpt
@@ -8,10 +8,6 @@ if (!defined('PHP_WINDOWS_VERSION_MAJOR')) {
die('skip: Only for Windows');
}
-if (PHP_SAPI != 'cli') {
- die('skip: Only for CLI');
-}
-
if (getenv('SKIP_SLOW_TESTS')) {
doe('skip: Slow test');
}
@@ -19,71 +15,71 @@ if (getenv('SKIP_SLOW_TESTS')) {
--FILE--
<?php
function get_priority_from_wmic() {
- static $bin, $pid;
+ static $bin, $pid;
- if (!$bin) {
- $t = explode('\\', PHP_BINARY);
+ if (!$bin) {
+ $t = explode('\\', PHP_BINARY);
- $bin = end($t);
- $pid = getmypid();
- }
+ $bin = end($t);
+ $pid = getmypid();
+ }
- $t = '';
- $p = popen('wmic process where name="' . $bin . '"', 'r');
+ $t = '';
+ $p = popen('wmic process where name="' . $bin . '"', 'r');
- if (!$p) {
- return false;
- }
+ if (!$p) {
+ return false;
+ }
- while(!feof($p)) {
- $t .= fread($p, 1024);
- }
+ while(!feof($p)) {
+ $t .= fread($p, 1024);
+ }
- pclose($p);
+ pclose($p);
- $t = explode(PHP_EOL, $t);
+ $t = explode(PHP_EOL, $t);
- $f = false;
- $m = [
- strpos($t[0], ' ProcessId' ),
- strpos($t[0], ' Priority ')
- ];
+ $f = false;
+ $m = [
+ strpos($t[0], ' ProcessId' ),
+ strpos($t[0], ' Priority ')
+ ];
- foreach ($t as $n => $l) {
- if (!$n || empty($l)) {
- continue;
- }
+ foreach ($t as $n => $l) {
+ if (!$n || empty($l)) {
+ continue;
+ }
- $d = [];
+ $d = [];
- foreach ($m as $c) {
- $d[] = (int) substr($l, $c + 1, strpos($l, ' ', $c + 2) - ($c + 1));
- }
+ foreach ($m as $c) {
+ $d[] = (int) substr($l, $c + 1, strpos($l, ' ', $c + 2) - ($c + 1));
+ }
- if ($d[0] === $pid) {
- return $d[1];
- }
- }
+ if ($d[0] === $pid) {
+ return $d[1];
+ }
+ }
- return false;
+ return false;
}
$p = [
- /* '<verbose name>' => ['<wmic value>', '<proc_nice value>'] */
+ /* '<verbose name>' => ['<wmic value>', '<proc_nice value>'] */
- 'Idle' => [4, 10],
- 'Below normal' => [6, 5],
- 'Normal' => [8, 0],
- 'Above normal' => [10, -5],
- 'High priority' => [13, -10]
- ];
+ 'Idle' => [4, 10],
+ 'Below normal' => [6, 5],
+ 'Normal' => [8, 0],
+ 'Above normal' => [10, -5],
+ 'High priority' => [13, -10]
+ ];
foreach ($p as $test => $data) {
- printf('Testing \'%s\' (%d): ', $test, $data[1]);
+ printf('Testing \'%s\' (%d): ', $test, $data[1]);
- proc_nice($data[1]);
+ proc_nice($data[1]);
- print (($wp = get_priority_from_wmic()) === $data[0] ? 'Passed' : 'Failed (' . $wp . ')') . PHP_EOL;
+ print (($wp = get_priority_from_wmic()) === $data[0] ? 'Passed' : 'Failed (' . $wp . ')') . PHP_EOL;
}
?>
--EXPECT--
diff --git a/ext/standard/tests/general_functions/proc_nice_basic.phpt b/ext/standard/tests/general_functions/proc_nice_basic.phpt
index d14a5f62a9..687152ee10 100644
--- a/ext/standard/tests/general_functions/proc_nice_basic.phpt
+++ b/ext/standard/tests/general_functions/proc_nice_basic.phpt
@@ -12,21 +12,21 @@ if(substr(strtoupper(PHP_OS), 0, 3) == 'WIN') die('skip. not for Windows');
?>
--FILE--
<?php
- function getNice($id)
- {
- $res = shell_exec('ps -p ' . $id .' -o "pid,nice"');
- preg_match('/^\s*\w+\s+\w+\s*(\d+)\s+(\d+)/m', $res, $matches);
- if (count($matches) > 2)
- return $matches[2];
- else
- return -1;
- }
- $delta = 10;
- $pid = getmypid();
- $niceBefore = getNice($pid);
- proc_nice($delta);
- $niceAfter = getNice($pid);
- var_dump($niceBefore == ($niceAfter - $delta));
+ function getNice($id)
+ {
+ $res = shell_exec('ps -p ' . $id .' -o "pid,nice"');
+ preg_match('/^\s*\w+\s+\w+\s*(\d+)\s+(\d+)/m', $res, $matches);
+ if (count($matches) > 2)
+ return $matches[2];
+ else
+ return -1;
+ }
+ $delta = 10;
+ $pid = getmypid();
+ $niceBefore = getNice($pid);
+ proc_nice($delta);
+ $niceAfter = getNice($pid);
+ var_dump($niceBefore == ($niceAfter - $delta));
?>
--EXPECT--
bool(true)
diff --git a/ext/standard/tests/general_functions/proc_open-mb0.phpt b/ext/standard/tests/general_functions/proc_open-mb0.phpt
index 4ff38267ad..c97ebda970 100644
--- a/ext/standard/tests/general_functions/proc_open-mb0.phpt
+++ b/ext/standard/tests/general_functions/proc_open-mb0.phpt
@@ -2,7 +2,6 @@
proc_open with bypass_shell subprocess parameter passing
--SKIPIF--
<?php
-if (php_sapi_name() != "cli") die('skip CLI only test');
if (!function_exists("proc_open")) echo "skip proc_open() is not available";
?>
--FILE--
@@ -14,24 +13,24 @@ $f = __DIR__ . DIRECTORY_SEPARATOR . "proc_only_mb0.php";
file_put_contents($f,'<?php var_dump($argv); ?>');
$ds = array(
- 0 => array("pipe", "r"),
- 1 => array("pipe", "w"),
- 2 => array("pipe", "w")
- );
+ 0 => array("pipe", "r"),
+ 1 => array("pipe", "w"),
+ 2 => array("pipe", "w")
+ );
$p = proc_open(
- "$php -n $f テストマルãƒãƒã‚¤ãƒˆãƒ»ãƒ‘ス füße карамба",
- $ds,
- $pipes,
- NULL,
- NULL,
- array("bypass_shell" => true)
- );
+ "$php -n $f テストマルãƒãƒã‚¤ãƒˆãƒ»ãƒ‘ス füße карамба",
+ $ds,
+ $pipes,
+ NULL,
+ NULL,
+ array("bypass_shell" => true)
+ );
$out = "";
while (!feof($pipes[1])) {
- $out .= fread($pipes[1], 1024);
+ $out .= fread($pipes[1], 1024);
}
proc_close($p);
@@ -39,7 +38,6 @@ proc_close($p);
echo $out;
?>
-==DONE==
--EXPECTF--
array(4) {
[0]=>
@@ -51,4 +49,3 @@ array(4) {
[3]=>
string(14) "карамба"
}
-==DONE==
diff --git a/ext/standard/tests/general_functions/proc_open-mb1.phpt b/ext/standard/tests/general_functions/proc_open-mb1.phpt
index e7a7a4cbfc..8a735cf306 100644
--- a/ext/standard/tests/general_functions/proc_open-mb1.phpt
+++ b/ext/standard/tests/general_functions/proc_open-mb1.phpt
@@ -2,7 +2,6 @@
proc_open without bypass_shell subprocess parameter passing
--SKIPIF--
<?php
-if (php_sapi_name() != "cli") die('skip CLI only test');
if (!function_exists("proc_open")) echo "skip proc_open() is not available";
?>
--FILE--
@@ -14,21 +13,21 @@ $f = __DIR__ . DIRECTORY_SEPARATOR . "proc_only_mb1.php";
file_put_contents($f,'<?php var_dump($argv); ?>');
$ds = array(
- 0 => array("pipe", "r"),
- 1 => array("pipe", "w"),
- 2 => array("pipe", "w")
- );
+ 0 => array("pipe", "r"),
+ 1 => array("pipe", "w"),
+ 2 => array("pipe", "w")
+ );
$p = proc_open(
- "$php -n $f テストマルãƒãƒã‚¤ãƒˆãƒ»ãƒ‘ス füße карамба",
- $ds,
- $pipes
- );
+ "$php -n $f テストマルãƒãƒã‚¤ãƒˆãƒ»ãƒ‘ス füße карамба",
+ $ds,
+ $pipes
+ );
$out = "";
while (!feof($pipes[1])) {
- $out .= fread($pipes[1], 1024);
+ $out .= fread($pipes[1], 1024);
}
proc_close($p);
@@ -36,7 +35,6 @@ proc_close($p);
echo $out;
?>
-==DONE==
--EXPECTF--
array(4) {
[0]=>
@@ -48,4 +46,3 @@ array(4) {
[3]=>
string(14) "карамба"
}
-==DONE==
diff --git a/ext/standard/tests/general_functions/proc_open.phpt b/ext/standard/tests/general_functions/proc_open.phpt
index 4d0a21d165..cf0bffffb5 100644
--- a/ext/standard/tests/general_functions/proc_open.phpt
+++ b/ext/standard/tests/general_functions/proc_open.phpt
@@ -8,16 +8,16 @@ if (!function_exists("proc_open")) echo "skip proc_open() is not available";
--FILE--
<?php
$ds = array(
- 0 => array("pipe", "r"),
- 1 => array("pipe", "w"),
- 2 => array("pipe", "w")
- );
+ 0 => array("pipe", "r"),
+ 1 => array("pipe", "w"),
+ 2 => array("pipe", "w")
+ );
$cat = proc_open(
- "/bin/cat",
- $ds,
- $pipes
- );
+ "/bin/cat",
+ $ds,
+ $pipes
+ );
proc_close($cat);
diff --git a/ext/standard/tests/general_functions/proc_open02.phpt b/ext/standard/tests/general_functions/proc_open02.phpt
index d5d878ed24..a81ce5934f 100644
--- a/ext/standard/tests/general_functions/proc_open02.phpt
+++ b/ext/standard/tests/general_functions/proc_open02.phpt
@@ -10,9 +10,9 @@ if (getenv('SKIP_SLOW_TESTS')) echo 'skip slow test';
$ds = array(array('pipe', 'r'));
$cat = proc_open(
- '/bin/sleep 2',
- $ds,
- $pipes
+ '/bin/sleep 2',
+ $ds,
+ $pipes
);
usleep(20000); // let the OS run the sleep process before sending the signal
diff --git a/ext/standard/tests/general_functions/proc_open_array.phpt b/ext/standard/tests/general_functions/proc_open_array.phpt
index 8b42a55bac..b2ab4d8c9f 100644
--- a/ext/standard/tests/general_functions/proc_open_array.phpt
+++ b/ext/standard/tests/general_functions/proc_open_array.phpt
@@ -10,14 +10,26 @@ $ds = [
2 => ['pipe', 'w'],
];
-echo "Empty command array:";
-var_dump(proc_open([], $ds, $pipes));
-
-echo "\nNul byte in program name:";
-var_dump(proc_open(["php\0oops"], $ds, $pipes));
-
-echo "\nNul byte in argument:";
-var_dump(proc_open(["php", "arg\0oops"], $ds, $pipes));
+echo "Empty command array:\n";
+try {
+ proc_open([], $ds, $pipes);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+echo "\nNul byte in program name:\n";
+try {
+ proc_open(["php\0oops"], $ds, $pipes);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+echo "\nNul byte in argument:\n";
+try {
+ proc_open(["php", "arg\0oops"], $ds, $pipes);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
echo "\nBasic usage:\n";
$proc = proc_open([$php, '-r', 'echo "Hello World!\n";'], $ds, $pipes);
@@ -54,18 +66,15 @@ fpassthru($pipes[1]);
proc_close($proc);
?>
---EXPECTF--
+--EXPECT--
Empty command array:
-Warning: proc_open(): Command array must have at least one element in %s on line %d
-bool(false)
+Command array must have at least one element
Nul byte in program name:
-Warning: proc_open(): Command array element 1 contains a null byte in %s on line %d
-bool(false)
+Command array element 1 contains a null byte
Nul byte in argument:
-Warning: proc_open(): Command array element 2 contains a null byte in %s on line %d
-bool(false)
+Command array element 2 contains a null byte
Basic usage:
Hello World!
diff --git a/ext/standard/tests/general_functions/proc_open_pipes1.phpt b/ext/standard/tests/general_functions/proc_open_pipes1.phpt
index dd0550f7fd..076b8c941e 100644
--- a/ext/standard/tests/general_functions/proc_open_pipes1.phpt
+++ b/ext/standard/tests/general_functions/proc_open_pipes1.phpt
@@ -4,7 +4,7 @@ proc_open() with > 16 pipes
<?php
for ($i = 3; $i<= 30; $i++) {
- $spec[$i] = array('pipe', 'w');
+ $spec[$i] = array('pipe', 'w');
}
$php = getenv("TEST_PHP_EXECUTABLE");
diff --git a/ext/standard/tests/general_functions/proc_open_pipes3.phpt b/ext/standard/tests/general_functions/proc_open_pipes3.phpt
index 7671b1dce1..848850b327 100644
--- a/ext/standard/tests/general_functions/proc_open_pipes3.phpt
+++ b/ext/standard/tests/general_functions/proc_open_pipes3.phpt
@@ -4,7 +4,7 @@ proc_open() with invalid pipes
<?php
for ($i = 3; $i<= 5; $i++) {
- $spec[$i] = array('pipe', 'w');
+ $spec[$i] = array('pipe', 'w');
}
$php = getenv("TEST_PHP_EXECUTABLE");
@@ -14,7 +14,11 @@ $spec[$i] = array('pi');
proc_open("$php -n $callee", $spec, $pipes);
$spec[$i] = 1;
-proc_open("$php -n $callee", $spec, $pipes);
+try {
+ proc_open("$php -n $callee", $spec, $pipes);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
$spec[$i] = array('pipe', "test");
proc_open("$php -n $callee", $spec, $pipes);
@@ -28,8 +32,7 @@ echo "END\n";
?>
--EXPECTF--
Warning: proc_open(): pi is not a valid descriptor spec/mode in %s on line %d
-
-Warning: proc_open(): Descriptor item must be either an array or a File-Handle in %s on line %d
+Descriptor item must be either an array or a File-Handle
array(4) {
[3]=>
resource(%d) of type (Unknown)
@@ -41,7 +44,7 @@ array(4) {
resource(%d) of type (Unknown)
}
-Warning: proc_open(test): failed to open stream: %s in %s on line %d
+Warning: proc_open(test): Failed to open stream: %s in %s on line %d
array(4) {
[3]=>
resource(%d) of type (Unknown)
diff --git a/ext/standard/tests/general_functions/proc_open_redirect.phpt b/ext/standard/tests/general_functions/proc_open_redirect.phpt
index 92da696ee9..bf0412c0a2 100644
--- a/ext/standard/tests/general_functions/proc_open_redirect.phpt
+++ b/ext/standard/tests/general_functions/proc_open_redirect.phpt
@@ -4,9 +4,23 @@ Redirection support in proc_open
<?php
$php = getenv('TEST_PHP_EXECUTABLE');
-var_dump(proc_open([$php], [['redirect']], $pipes));
-var_dump(proc_open([$php], [['redirect', 'foo']], $pipes));
-var_dump(proc_open([$php], [['redirect', 42]], $pipes));
+try {
+ proc_open([$php], [['redirect']], $pipes);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+try {
+ proc_open([$php], [['redirect', 'foo']], $pipes);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+try {
+ proc_open([$php], [['redirect', 42]], $pipes);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
echo "\nWith pipe:\n";
$cmd = [$php, '-r', 'echo "Test\n"; fprintf(STDERR, "Error");'];
@@ -38,14 +52,10 @@ proc_close($proc);
?>
--EXPECTF--
-Warning: proc_open(): Missing redirection target in %s on line %d
-bool(false)
-
-Warning: proc_open(): Redirection target must be an integer in %s on line %d
-bool(false)
+Missing redirection target
+Redirection target must be an integer
-Warning: proc_open(): Redirection target 42 not found in %s on line %d
-bool(false)
+Warning: proc_open(): Redirection target 42 not found in %s
With pipe:
array(1) {
diff --git a/ext/standard/tests/general_functions/putenv.phpt b/ext/standard/tests/general_functions/putenv.phpt
index ab2c1b41f7..c1f4f98eeb 100644
--- a/ext/standard/tests/general_functions/putenv.phpt
+++ b/ext/standard/tests/general_functions/putenv.phpt
@@ -15,8 +15,17 @@ var_dump(getenv($var_name));
var_dump(putenv($var_name));
var_dump(getenv($var_name));
-var_dump(putenv("=123"));
-var_dump(putenv(""));
+try {
+ putenv("=123");
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+try {
+ putenv("");
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
echo "Done\n";
?>
@@ -28,10 +37,6 @@ bool(true)
string(0) ""
bool(true)
bool(false)
-
-Warning: putenv(): Invalid parameter syntax in %s on line %d
-bool(false)
-
-Warning: putenv(): Invalid parameter syntax in %s on line %d
-bool(false)
+Invalid parameter syntax
+Invalid parameter syntax
Done
diff --git a/ext/standard/tests/general_functions/putenv_bug75574_cp936_win.phpt b/ext/standard/tests/general_functions/putenv_bug75574_cp936_win.phpt
index 69c455d076..9a92bef794 100644
--- a/ext/standard/tests/general_functions/putenv_bug75574_cp936_win.phpt
+++ b/ext/standard/tests/general_functions/putenv_bug75574_cp936_win.phpt
@@ -34,7 +34,6 @@ var_dump(putenv('FOO=°¡a°¡°¡°¡'), getenv("FOO"));
var_dump(putenv('FOO=°¡a°¡°¡°¡°¡'), getenv("FOO"));
?>
-===DONE===
--EXPECT--
bool(true)
string(2) "°¡"
@@ -58,4 +57,3 @@ bool(true)
string(9) "°¡a°¡°¡°¡"
bool(true)
string(11) "°¡a°¡°¡°¡°¡"
-===DONE===
diff --git a/ext/standard/tests/general_functions/putenv_bug75574_utf8.phpt b/ext/standard/tests/general_functions/putenv_bug75574_utf8.phpt
index ea8a0ab119..edf4c72f44 100644
--- a/ext/standard/tests/general_functions/putenv_bug75574_utf8.phpt
+++ b/ext/standard/tests/general_functions/putenv_bug75574_utf8.phpt
@@ -23,7 +23,6 @@ var_dump(putenv('FOO=å•Šaå•Šå•Šå•Š'), getenv("FOO"));
var_dump(putenv('FOO=å•Šaå•Šå•Šå•Šå•Š'), getenv("FOO"));
?>
-===DONE===
--EXPECT--
bool(true)
string(3) "å•Š"
@@ -47,4 +46,3 @@ bool(true)
string(13) "å•Šaå•Šå•Šå•Š"
bool(true)
string(16) "å•Šaå•Šå•Šå•Šå•Š"
-===DONE===
diff --git a/ext/standard/tests/general_functions/rand.phpt b/ext/standard/tests/general_functions/rand.phpt
index e6639a71c7..73dec4eb75 100644
--- a/ext/standard/tests/general_functions/rand.phpt
+++ b/ext/standard/tests/general_functions/rand.phpt
@@ -4,60 +4,36 @@ rand() and mt_rand() tests
<?php
var_dump(mt_rand());
-var_dump(mt_rand(-1));
var_dump(mt_rand(-1,1));
var_dump(mt_rand(0,3));
var_dump(rand());
-var_dump(rand(-1));
var_dump(rand(-1,1));
var_dump(rand(0,3));
var_dump(srand());
var_dump(srand(-1));
-var_dump(srand(array()));
var_dump(mt_srand());
var_dump(mt_srand(-1));
-var_dump(mt_srand(array()));
var_dump(getrandmax());
-var_dump(getrandmax(1));
var_dump(mt_getrandmax());
-var_dump(mt_getrandmax(1));
echo "Done\n";
?>
--EXPECTF--
int(%d)
-
-Warning: mt_rand() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
int(%i)
int(%d)
int(%d)
-
-Warning: rand() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
int(%i)
int(%d)
NULL
NULL
-
-Warning: srand() expects parameter 1 to be int, array given in %s on line %d
-NULL
-NULL
NULL
-
-Warning: mt_srand() expects parameter 1 to be int, array given in %s on line %d
NULL
int(%d)
-
-Warning: getrandmax() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
int(%d)
-
-Warning: mt_getrandmax() expects exactly 0 parameters, 1 given in %s on line %d
-NULL
Done
diff --git a/ext/standard/tests/general_functions/register_tick_function_error.phpt b/ext/standard/tests/general_functions/register_tick_function_error.phpt
new file mode 100644
index 0000000000..b71f1ea5d5
--- /dev/null
+++ b/ext/standard/tests/general_functions/register_tick_function_error.phpt
@@ -0,0 +1,14 @@
+--TEST--
+register_tick_function only accepts a valid callback as parameter
+--FILE--
+<?php
+declare(ticks=1);
+
+try {
+ register_tick_function("a");
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+?>
+--EXPECT--
+Invalid tick callback 'a' passed
diff --git a/ext/standard/tests/general_functions/sleep_basic.phpt b/ext/standard/tests/general_functions/sleep_basic.phpt
index 0ef0e7c213..4371cc99ed 100644
--- a/ext/standard/tests/general_functions/sleep_basic.phpt
+++ b/ext/standard/tests/general_functions/sleep_basic.phpt
@@ -20,7 +20,7 @@ set_time_limit(20);
$time_start = microtime(true);
// Sleep for a while
-sleep($sleeptime);
+$result = sleep($sleeptime);
// Test passes if sleeps for at least 98% of specified time
$sleeplow = $sleeptime - ($sleeptime * 2 /100);
@@ -29,16 +29,16 @@ $time_end = microtime(true);
$time = $time_end - $time_start;
echo "Thread slept for " . $time . " seconds\n";
+echo "Return value: " . $result . "\n";
if ($time >= $sleeplow) {
- echo "TEST PASSED\n";
+ echo "TEST PASSED\n";
} else {
- echo "TEST FAILED - time is ${time} secs and sleep was ${sleeptime} secs\n";
+ echo "TEST FAILED - time is ${time} secs and sleep was ${sleeptime} secs\n";
}
?>
-===DONE===
--EXPECTF--
*** Testing sleep() : basic functionality ***
Thread slept for %f seconds
+Return value: 0
TEST PASSED
-===DONE===
diff --git a/ext/standard/tests/general_functions/sleep_error.phpt b/ext/standard/tests/general_functions/sleep_error.phpt
index c4f069a3d2..4bf3e9fefc 100644
--- a/ext/standard/tests/general_functions/sleep_error.phpt
+++ b/ext/standard/tests/general_functions/sleep_error.phpt
@@ -2,43 +2,13 @@
Test sleep() function : error conditions
--FILE--
<?php
-/* Prototype : int sleep ( int $seconds )
- * Description: Delays the program execution for the given number of seconds .
- * Source code: ext/standard/basic_functions.c
- */
- set_time_limit(20);
-echo "*** Testing sleep() : error conditions ***\n";
-
-echo "\n-- Testing sleep() function with zero arguments --\n";
-var_dump( sleep() );
-
-echo "\n-- Testing sleep() function with more than expected no. of arguments --\n";
-$seconds = 10;
-$extra_arg = 10;
-var_dump( sleep($seconds, $extra_arg) );
-
-echo "\n-- Testing sleep() function with negative interval --\n";
-$seconds = -10;
-var_dump( sleep($seconds) );
+sleep(-10);
?>
-===DONE===
--EXPECTF--
-*** Testing sleep() : error conditions ***
-
--- Testing sleep() function with zero arguments --
-
-Warning: sleep() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
--- Testing sleep() function with more than expected no. of arguments --
-
-Warning: sleep() expects exactly 1 parameter, 2 given in %s on line %d
-bool(false)
-
--- Testing sleep() function with negative interval --
-
-Warning: sleep(): Number of seconds must be greater than or equal to 0 in %s on line %d
-bool(false)
-===DONE===
+Fatal error: Uncaught ValueError: Number of seconds must be greater than or equal to 0 in %s
+Stack trace:
+#0 %s(%d): sleep(-10)
+#1 {main}
+ thrown in %s on line %d
diff --git a/ext/standard/tests/general_functions/strval.phpt b/ext/standard/tests/general_functions/strval.phpt
index e904fdcaa0..a75ac12272 100644
--- a/ext/standard/tests/general_functions/strval.phpt
+++ b/ext/standard/tests/general_functions/strval.phpt
@@ -141,13 +141,6 @@ foreach ($not_scalars as $value ) {
var_dump( strval($value) );
}
-echo "\n*** Testing error conditions ***\n";
-//Zero argument
-var_dump( strval() );
-
-//arguments more than expected
-var_dump( strval( $scalars[0], $scalars[1]) );
-
echo "Done\n";
// close the resources used
@@ -284,19 +277,19 @@ string(14) "Resource id #%d"
string(14) "Resource id #%d"
-- Iteration 4 --
-Notice: Array to string conversion in %sstrval.php on line %d
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
-- Iteration 5 --
-Notice: Array to string conversion in %sstrval.php on line %d
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
-- Iteration 6 --
-Notice: Array to string conversion in %sstrval.php on line %d
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
-- Iteration 7 --
-Notice: Array to string conversion in %sstrval.php on line %d
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
-- Iteration 8 --
string(0) ""
@@ -306,12 +299,4 @@ string(0) ""
string(0) ""
-- Iteration 11 --
string(0) ""
-
-*** Testing error conditions ***
-
-Warning: strval() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: strval() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
Done
diff --git a/ext/standard/tests/general_functions/sys_getloadavg.phpt b/ext/standard/tests/general_functions/sys_getloadavg.phpt
index 5763084f70..1775978a12 100644
--- a/ext/standard/tests/general_functions/sys_getloadavg.phpt
+++ b/ext/standard/tests/general_functions/sys_getloadavg.phpt
@@ -7,14 +7,11 @@ if (!function_exists("sys_getloadavg")) die("skip");
--FILE--
<?php
-var_dump(sys_getloadavg(""));
var_dump(sys_getloadavg());
echo "Done\n";
?>
--EXPECTF--
-Warning: sys_getloadavg() expects exactly 0 parameters, %d given in %s
-NULL
array(3) {
[0]=>
float(%f)
diff --git a/ext/standard/tests/general_functions/type.phpt b/ext/standard/tests/general_functions/type.phpt
index 0b460b08d1..a32e4b44a1 100644
--- a/ext/standard/tests/general_functions/type.phpt
+++ b/ext/standard/tests/general_functions/type.phpt
@@ -4,7 +4,7 @@ gettype(), settype() and friends
<?php
function foo($errno, $errstr, $errfile, $errline) {
- var_dump($errstr);
+ var_dump($errstr);
}
set_error_handler("foo");
@@ -17,43 +17,43 @@ $var1 = "another string";
$var2 = array(2,3,4);
$array = array(
- array(1,2,3),
- $var1,
- $var2,
- 1,
- 2.0,
- NULL,
- false,
- "some string",
- $fp,
- $fp1,
- new stdclass,
+ array(1,2,3),
+ $var1,
+ $var2,
+ 1,
+ 2.0,
+ NULL,
+ false,
+ "some string",
+ $fp,
+ $fp1,
+ new stdclass,
);
$types = array(
- "null",
- "integer",
- "double",
- "boolean",
- "resource",
- "array",
- "object",
- "string"
- );
+ "null",
+ "integer",
+ "double",
+ "boolean",
+ "resource",
+ "array",
+ "object",
+ "string"
+ );
foreach ($array as $var) {
- var_dump(gettype($var));
+ var_dump(gettype($var));
}
foreach ($types as $type) {
- foreach ($array as $var) {
- try {
- var_dump(settype($var, $type));
- } catch (Error $e) {
- echo "Error: ", $e->getMessage(), "\n";
- }
- var_dump($var);
- }
+ foreach ($array as $var) {
+ try {
+ var_dump(settype($var, $type));
+ } catch (Error $e) {
+ echo "Error: ", $e->getMessage(), "\n";
+ }
+ var_dump($var);
+ }
}
echo "Done\n";
@@ -160,8 +160,7 @@ bool(true)
bool(true)
bool(true)
bool(true)
-string(42) "settype(): Cannot convert to resource type"
-bool(false)
+Error: Cannot convert to resource type
array(3) {
[0]=>
int(1)
@@ -170,11 +169,9 @@ array(3) {
[2]=>
int(3)
}
-string(42) "settype(): Cannot convert to resource type"
-bool(false)
+Error: Cannot convert to resource type
string(14) "another string"
-string(42) "settype(): Cannot convert to resource type"
-bool(false)
+Error: Cannot convert to resource type
array(3) {
[0]=>
int(2)
@@ -183,29 +180,21 @@ array(3) {
[2]=>
int(4)
}
-string(42) "settype(): Cannot convert to resource type"
-bool(false)
+Error: Cannot convert to resource type
int(1)
-string(42) "settype(): Cannot convert to resource type"
-bool(false)
+Error: Cannot convert to resource type
float(2)
-string(42) "settype(): Cannot convert to resource type"
-bool(false)
+Error: Cannot convert to resource type
NULL
-string(42) "settype(): Cannot convert to resource type"
-bool(false)
-bool(false)
-string(42) "settype(): Cannot convert to resource type"
+Error: Cannot convert to resource type
bool(false)
+Error: Cannot convert to resource type
string(11) "some string"
-string(42) "settype(): Cannot convert to resource type"
-bool(false)
+Error: Cannot convert to resource type
resource(%d) of type (Unknown)
-string(42) "settype(): Cannot convert to resource type"
-bool(false)
+Error: Cannot convert to resource type
resource(%d) of type (stream)
-string(42) "settype(): Cannot convert to resource type"
-bool(false)
+Error: Cannot convert to resource type
object(stdClass)#%d (0) {
}
bool(true)
diff --git a/ext/standard/tests/general_functions/uniqid_basic.phpt b/ext/standard/tests/general_functions/uniqid_basic.phpt
index 285365ab60..6bfc478fad 100644
--- a/ext/standard/tests/general_functions/uniqid_basic.phpt
+++ b/ext/standard/tests/general_functions/uniqid_basic.phpt
@@ -18,23 +18,22 @@ echo "uniqid() with a prefix\n";
// Use a fixed prefix so we can ensure length of o/p id is fixed
$prefix = array (
- 99999,
- "99999",
- 10.5e2,
- null,
- true,
- false
- );
+ 99999,
+ "99999",
+ 10.5e2,
+ null,
+ true,
+ false
+ );
for ($i = 0; $i < count($prefix); $i++) {
- var_dump(uniqid($prefix[$i]));
- var_dump(uniqid($prefix[$i], true));
- var_dump(uniqid($prefix[$i], false));
- echo "\n";
+ var_dump(uniqid($prefix[$i]));
+ var_dump(uniqid($prefix[$i], true));
+ var_dump(uniqid($prefix[$i], false));
+ echo "\n";
}
?>
-===DONE===
--EXPECTF--
*** Testing uniqid() : basic functionality ***
@@ -69,4 +68,3 @@ string(13) "%s"
string(23) "%s.%s"
string(13) "%s"
-===DONE===
diff --git a/ext/standard/tests/general_functions/usleep_basic.phpt b/ext/standard/tests/general_functions/usleep_basic.phpt
index 776d634ea4..c2af61f8a2 100644
--- a/ext/standard/tests/general_functions/usleep_basic.phpt
+++ b/ext/standard/tests/general_functions/usleep_basic.phpt
@@ -30,13 +30,11 @@ $time = ($time_end - $time_start) * 1000 * 1000;
$summary = "Thread slept for " . $time . " micro-seconds\n";
if ($time >= $sleeplow) {
- echo "TEST PASSED: $summary";
+ echo "TEST PASSED: $summary";
} else {
- echo "TEST FAILED: $summary";
+ echo "TEST FAILED: $summary";
}
?>
-===DONE===
--EXPECTF--
*** Testing usleep() : basic functionality ***
TEST PASSED: Thread slept for %f micro-seconds
-===DONE===
diff --git a/ext/standard/tests/general_functions/usleep_error.phpt b/ext/standard/tests/general_functions/usleep_error.phpt
index 474aab7d5d..25bc0b6866 100644
--- a/ext/standard/tests/general_functions/usleep_error.phpt
+++ b/ext/standard/tests/general_functions/usleep_error.phpt
@@ -2,44 +2,13 @@
Test usleep() function : error conditions
--FILE--
<?php
-/* Prototype : void usleep ( int $micro_seconds )
- * Description: Delays program execution for the given number of micro seconds.
- * Source code: ext/standard/basic_functions.c
- */
-set_time_limit(20);
-
-echo "*** Testing usleep() : error conditions ***\n";
-
-echo "\n-- Testing usleep() function with zero arguments --\n";
-var_dump( usleep() );
-
-echo "\n-- Testing usleep() function with more than expected no. of arguments --\n";
-$seconds = 10;
-$extra_arg = 10;
-var_dump( usleep($seconds, $extra_arg) );
-
-echo "\n-- Testing usleep() function with negative interval --\n";
-$seconds = -10;
-var_dump( usleep($seconds) );
+usleep(-10);
?>
-===DONE===
--EXPECTF--
-*** Testing usleep() : error conditions ***
-
--- Testing usleep() function with zero arguments --
-
-Warning: usleep() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
--- Testing usleep() function with more than expected no. of arguments --
-
-Warning: usleep() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
--- Testing usleep() function with negative interval --
-
-Warning: usleep(): Number of microseconds must be greater than or equal to 0 in %s on line %d
-bool(false)
-===DONE===
+Fatal error: Uncaught ValueError: Number of microseconds must be greater than or equal to 0 in %s
+Stack trace:
+#0 %s(%d): usleep(-10)
+#1 {main}
+ thrown in %s on line %d
diff --git a/ext/standard/tests/general_functions/var_dump.phpt b/ext/standard/tests/general_functions/var_dump.phpt
index 4641051541..476620ff26 100644
--- a/ext/standard/tests/general_functions/var_dump.phpt
+++ b/ext/standard/tests/general_functions/var_dump.phpt
@@ -99,7 +99,7 @@ $strings = array (
'PHP',
"abcd\x0n1234\x0005678\x0000efgh\xijkl", // strings with hexadecimal NULL
"abcd\0efgh\0ijkl\x00mnop\x000qrst\00uvwx\0000yz", // strings with octal NULL
- "1234\t\n5678\n\t9100\rabcda" // strings with escape characters
+ "1234\t\n5678\n\t9100\"abcda" // strings with escape characters
);
/* calling check_vardump() to display contents of strings
using var_dump() */
@@ -239,8 +239,8 @@ $resources = array (
using var_dump() */
check_vardump($resources);
-echo "\n*** Testing var_dump() on different combinations of scalar
- and non-scalar variables ***\n";
+echo "\n*** Testing var_dump() on different combinations of scalar
+ and non-scalar variables ***\n";
/* a variable which is unset */
$unset_var = 10.5;
unset($unset_var);
@@ -260,32 +260,20 @@ $variations = array (
non-scalar variables using var_dump() */
check_vardump($variations);
-echo "\n*** Testing var_dump() on miscelleneous input arguments ***\n";
+echo "\n*** Testing var_dump() on miscellaneous input arguments ***\n";
$misc_values = array (
@$unset_var,
NULL, // NULL argument
@$undef_variable, //undefined variable
null
);
-/* calling check_vardump() to display miscelleneous data using var_dump() */
+/* calling check_vardump() to display miscellaneous data using var_dump() */
check_vardump($misc_values);
echo "\n*** Testing var_dump() on multiple arguments ***\n";
var_dump( $integers, $floats, $strings, $arrays, $booleans, $resources,
$objects, $misc_values, $variations );
-/* checking var_dump() on functions */
-echo "\n*** Testing var_dump() on anonymous functions ***\n";
-$newfunc = create_function('$a,$b', 'return "$a * $b = " . ($a * $b);');
-echo "New anonymous function: $newfunc\n";
-var_dump( $newfunc(2, 3) );
-/* creating anonymous function dynamically */
-var_dump( create_function('$a', 'return "$a * $a = " . ($a * $b);') );
-
-echo "\n*** Testing error conditions ***\n";
-//passing zero argument
-var_dump();
-
/* closing resource handle used */
closedir($dir_handle);
@@ -462,7 +450,7 @@ string(34) "abcd
-- Iteration 14 --
string(22) "1234
5678
- 9100 abcda"
+ 9100"abcda"
*** Testing var_dump() on boolean variables ***
-- Iteration 1 --
@@ -848,8 +836,8 @@ resource(%d) of type (stream)
-- Iteration 2 --
resource(%d) of type (stream)
-*** Testing var_dump() on different combinations of scalar
- and non-scalar variables ***
+*** Testing var_dump() on different combinations of scalar
+ and non-scalar variables ***
-- Iteration 1 --
array(3) {
[0]=>
@@ -935,7 +923,7 @@ array(4) {
string(5) "/00\7"
}
-*** Testing var_dump() on miscelleneous input arguments ***
+*** Testing var_dump() on miscellaneous input arguments ***
-- Iteration 1 --
NULL
-- Iteration 2 --
@@ -1116,7 +1104,7 @@ array(14) {
[13]=>
string(22) "1234
5678
- 9100 abcda"
+ 9100"abcda"
}
array(15) {
[0]=>
@@ -1561,17 +1549,4 @@ array(6) {
string(5) "/00\7"
}
}
-
-*** Testing var_dump() on anonymous functions ***
-
-Deprecated: Function create_function() is deprecated in %s on line %d
-New anonymous function:
-string(9) "2 * 3 = 6"
-
-Deprecated: Function create_function() is deprecated in %s on line %d
-string(9) "
-
-*** Testing error conditions ***
-
-Warning: var_dump() expects at least 1 parameter, 0 given in %s on line %d
Done
diff --git a/ext/standard/tests/general_functions/var_dump_64bit.phpt b/ext/standard/tests/general_functions/var_dump_64bit.phpt
index 738de410e4..0600775f58 100644
--- a/ext/standard/tests/general_functions/var_dump_64bit.phpt
+++ b/ext/standard/tests/general_functions/var_dump_64bit.phpt
@@ -99,7 +99,7 @@ $strings = array (
'PHP',
"abcd\x0n1234\x0005678\x0000efgh\xijkl", // strings with hexadecimal NULL
"abcd\0efgh\0ijkl\x00mnop\x000qrst\00uvwx\0000yz", // strings with octal NULL
- "1234\t\n5678\n\t9100\rabcda" // strings with escape characters
+ "1234\t\n5678\n\t9100\"abcda" // strings with escape characters
);
/* calling check_vardump() to display contents of strings
using var_dump() */
@@ -239,8 +239,8 @@ $resources = array (
using var_dump() */
check_vardump($resources);
-echo "\n*** Testing var_dump() on different combinations of scalar
- and non-scalar variables ***\n";
+echo "\n*** Testing var_dump() on different combinations of scalar
+ and non-scalar variables ***\n";
/* a variable which is unset */
$unset_var = 10.5;
unset($unset_var);
@@ -260,32 +260,20 @@ $variations = array (
non-scalar variables using var_dump() */
check_vardump($variations);
-echo "\n*** Testing var_dump() on miscelleneous input arguments ***\n";
+echo "\n*** Testing var_dump() on miscellaneous input arguments ***\n";
$misc_values = array (
@$unset_var,
NULL, // NULL argument
@$undef_variable, //undefined variable
null
);
-/* calling check_vardump() to display miscelleneous data using var_dump() */
+/* calling check_vardump() to display miscellaneous data using var_dump() */
check_vardump($misc_values);
echo "\n*** Testing var_dump() on multiple arguments ***\n";
var_dump( $integers, $floats, $strings, $arrays, $booleans, $resources,
$objects, $misc_values, $variations );
-/* checking var_dump() on functions */
-echo "\n*** Testing var_dump() on anonymous functions ***\n";
-$newfunc = create_function('$a,$b', 'return "$a * $b = " . ($a * $b);');
-echo "New anonymous function: $newfunc\n";
-var_dump( $newfunc(2, 3) );
-/* creating anonymous function dynamically */
-var_dump( create_function('$a', 'return "$a * $a = " . ($a * $b);') );
-
-echo "\n*** Testing error conditions ***\n";
-//passing zero argument
-var_dump();
-
/* closing resource handle used */
closedir($dir_handle);
@@ -462,7 +450,7 @@ string(34) "abcd
-- Iteration 14 --
string(22) "1234
5678
- 9100 abcda"
+ 9100"abcda"
*** Testing var_dump() on boolean variables ***
-- Iteration 1 --
@@ -848,8 +836,8 @@ resource(5) of type (stream)
-- Iteration 2 --
resource(6) of type (stream)
-*** Testing var_dump() on different combinations of scalar
- and non-scalar variables ***
+*** Testing var_dump() on different combinations of scalar
+ and non-scalar variables ***
-- Iteration 1 --
array(3) {
[0]=>
@@ -935,7 +923,7 @@ array(4) {
string(5) "/00\7"
}
-*** Testing var_dump() on miscelleneous input arguments ***
+*** Testing var_dump() on miscellaneous input arguments ***
-- Iteration 1 --
NULL
-- Iteration 2 --
@@ -1116,7 +1104,7 @@ array(14) {
[13]=>
string(22) "1234
5678
- 9100 abcda"
+ 9100"abcda"
}
array(15) {
[0]=>
@@ -1561,17 +1549,4 @@ array(6) {
string(5) "/00\7"
}
}
-
-*** Testing var_dump() on anonymous functions ***
-
-Deprecated: Function create_function() is deprecated in %s on line %d
-New anonymous function:
-string(9) "2 * 3 = 6"
-
-Deprecated: Function create_function() is deprecated in %s on line %d
-string(9) "
-
-*** Testing error conditions ***
-
-Warning: var_dump() expects at least 1 parameter, 0 given in %s on line %d
Done
diff --git a/ext/standard/tests/general_functions/var_export-locale.phpt b/ext/standard/tests/general_functions/var_export-locale.phpt
index 61d94f83f4..bdc61d9928 100644
--- a/ext/standard/tests/general_functions/var_export-locale.phpt
+++ b/ext/standard/tests/general_functions/var_export-locale.phpt
@@ -58,12 +58,12 @@ $counter++;
echo "*** Testing var_export() with valid boolean values ***\n";
// different valid boolean values
$valid_bool = array(
- 1,
- TRUE,
+ 1,
+ TRUE,
true,
0,
- FALSE,
- false
+ FALSE,
+ false
);
$counter = 1;
/* Loop to check for above boolean values with var_export() */
@@ -303,14 +303,7 @@ echo "\n";
$counter++;
}
-echo "\n*** Testing error conditions ***\n";
-//Zero argument
-var_export( var_export() );
-
-//arguments more than expected
-var_export( var_export(TRUE, FALSE, TRUE) );
-
-echo "\n\nDone";
+echo "\nDone";
?>
@@ -1138,11 +1131,4 @@ NULL
string(4) "NULL"
-*** Testing error conditions ***
-
-Warning: var_export() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-Warning: var_export() expects at most 2 parameters, 3 given in %s on line %d
-NULL
-
Done
diff --git a/ext/standard/tests/general_functions/var_export-locale_32.phpt b/ext/standard/tests/general_functions/var_export-locale_32.phpt
index af9efd9e24..d64fa3b8d7 100644
--- a/ext/standard/tests/general_functions/var_export-locale_32.phpt
+++ b/ext/standard/tests/general_functions/var_export-locale_32.phpt
@@ -20,7 +20,7 @@ setlocale(LC_ALL, "german", "de","de_DE","de_DE.ISO8859-1","de_DE.ISO_8859-1","d
*/
echo "*** Testing var_export() with integer values ***\n";
-// different integer vlaues
+// different integer values
$valid_ints = array(
'0',
'1',
@@ -56,14 +56,14 @@ $counter++;
}
echo "*** Testing var_export() with valid boolean values ***\n";
-// different valid boolean vlaues
+// different valid boolean values
$valid_bool = array(
- 1,
- TRUE,
+ 1,
+ TRUE,
true,
0,
- FALSE,
- false
+ FALSE,
+ false
);
$counter = 1;
/* Loop to check for above boolean values with var_export() */
@@ -80,7 +80,7 @@ $counter++;
}
echo "*** Testing var_export() with valid float values ***\n";
-// different valid float vlaues
+// different valid float values
$valid_floats = array(
(float)-2147483649, // float value
(float)2147483648, // float value
@@ -279,7 +279,7 @@ $counter++;
}
echo "*** Testing var_export() with valid null values ***\n";
-// different valid null vlaues
+// different valid null values
$unset_var = array();
unset ($unset_var); // now a null
$null_var = NULL;
@@ -303,14 +303,7 @@ echo "\n";
$counter++;
}
-echo "\n*** Testing error conditions ***\n";
-//Zero argument
-var_export( var_export() );
-
-//arguments more than expected
-var_export( var_export(TRUE, FALSE, TRUE) );
-
-echo "\n\nDone";
+echo "\nDone";
?>
@@ -1138,11 +1131,4 @@ NULL
string(4) "NULL"
-*** Testing error conditions ***
-
-Warning: var_export() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-Warning: var_export() expects at most 2 parameters, 3 given in %s on line %d
-NULL
-
Done
diff --git a/ext/standard/tests/general_functions/var_export_basic1.phpt b/ext/standard/tests/general_functions/var_export_basic1.phpt
index 18fa404c29..27c56a7b8f 100644
--- a/ext/standard/tests/general_functions/var_export_basic1.phpt
+++ b/ext/standard/tests/general_functions/var_export_basic1.phpt
@@ -40,16 +40,15 @@ $valid_ints = array(
/* Loop to check for above integer values with var_export() */
echo "\n*** Output for integer values ***\n";
foreach($valid_ints as $key => $int_value) {
- echo "\n-- Iteration: $key --\n";
- var_export( $int_value );
- echo "\n";
- var_export( $int_value, FALSE);
- echo "\n";
- var_dump( var_export( $int_value, TRUE) );
+ echo "\n-- Iteration: $key --\n";
+ var_export( $int_value );
+ echo "\n";
+ var_export( $int_value, FALSE);
+ echo "\n";
+ var_dump( var_export( $int_value, TRUE) );
}
?>
-===DONE===
--EXPECT--
*** Testing var_export() with integer values ***
@@ -144,4 +143,3 @@ string(11) "-2147483648"
2147483647
2147483647
string(10) "2147483647"
-===DONE===
diff --git a/ext/standard/tests/general_functions/var_export_basic1_32.phpt b/ext/standard/tests/general_functions/var_export_basic1_32.phpt
index 95596800d6..0eb6ce889f 100644
--- a/ext/standard/tests/general_functions/var_export_basic1_32.phpt
+++ b/ext/standard/tests/general_functions/var_export_basic1_32.phpt
@@ -15,7 +15,7 @@ if (PHP_INT_SIZE > 4) {
*/
echo "*** Testing var_export() with integer values ***\n";
-// different integer vlaues
+// different integer values
$valid_ints = array(
'0' => '0',
'1' => '1',
@@ -40,16 +40,15 @@ $valid_ints = array(
/* Loop to check for above integer values with var_export() */
echo "\n*** Output for integer values ***\n";
foreach($valid_ints as $key => $int_value) {
- echo "\n-- Iteration: $key --\n";
- var_export( $int_value );
- echo "\n";
- var_export( $int_value, FALSE);
- echo "\n";
- var_dump( var_export( $int_value, TRUE) );
+ echo "\n-- Iteration: $key --\n";
+ var_export( $int_value );
+ echo "\n";
+ var_export( $int_value, FALSE);
+ echo "\n";
+ var_dump( var_export( $int_value, TRUE) );
}
?>
-===DONE===
--EXPECT--
*** Testing var_export() with integer values ***
@@ -144,4 +143,3 @@ string(13) "-2147483647-1"
2147483647
2147483647
string(10) "2147483647"
-===DONE===
diff --git a/ext/standard/tests/general_functions/var_export_basic2.phpt b/ext/standard/tests/general_functions/var_export_basic2.phpt
index 29c3a138f9..1698a28001 100644
--- a/ext/standard/tests/general_functions/var_export_basic2.phpt
+++ b/ext/standard/tests/general_functions/var_export_basic2.phpt
@@ -12,27 +12,26 @@ Test var_export() function with valid boolean values
echo "*** Testing var_export() with valid boolean values ***\n";
// different valid boolean values
$valid_bool = array(
- "1" => 1,
- "TRUE" => TRUE,
+ "1" => 1,
+ "TRUE" => TRUE,
"true" => true,
"0" => 0,
- "FALSE" => FALSE,
- "false" => false
+ "FALSE" => FALSE,
+ "false" => false
);
/* Loop to check for above boolean values with var_export() */
echo "\n*** Output for boolean values ***\n";
foreach($valid_bool as $key => $bool_value) {
- echo "\n-- Iteration: $key --\n";
- var_export( $bool_value );
- echo "\n";
- var_export( $bool_value, FALSE);
- echo "\n";
- var_dump( var_export( $bool_value, TRUE) );
- echo "\n";
+ echo "\n-- Iteration: $key --\n";
+ var_export( $bool_value );
+ echo "\n";
+ var_export( $bool_value, FALSE);
+ echo "\n";
+ var_dump( var_export( $bool_value, TRUE) );
+ echo "\n";
}
?>
-===DONE===
--EXPECT--
*** Testing var_export() with valid boolean values ***
@@ -73,4 +72,3 @@ false
false
string(5) "false"
-===DONE===
diff --git a/ext/standard/tests/general_functions/var_export_basic3.phpt b/ext/standard/tests/general_functions/var_export_basic3.phpt
index b66d2c4584..92d5bbbe76 100644
--- a/ext/standard/tests/general_functions/var_export_basic3.phpt
+++ b/ext/standard/tests/general_functions/var_export_basic3.phpt
@@ -13,41 +13,40 @@ serialize_precision=17
echo "*** Testing var_export() with valid float values ***\n";
// different valid float values
$valid_floats = array(
- "-2147483649" => (float)-2147483649, // float value
- "2147483648" => (float)2147483648, // float value
- "-0x80000001" => (float)-0x80000001, // float value, beyond max negative int
- "0x800000001" => (float)0x800000001, // float value, beyond max positive int
- "020000000001" => (float)020000000001, // float value, beyond max positive int
- "-020000000001" => (float)-020000000001, // float value, beyond max negative int
- "0.0" => 0.0,
- "-0.1" => -0.1,
- "10.0000000000000000005" => 10.0000000000000000005,
- "10.5e+5" => 10.5e+5,
- "1e5" => 1e5,
- "1e-5" => 1e-5,
- "1e+5" => 1e+5,
- "1E5" => 1E5,
- "1E+5" => 1E+5,
- "1E-5" => 1E-5,
- ".5e+7" => .5e+7,
- ".6e-19" => .6e-19,
- ".05E+44" => .05E+44,
- ".0034E-30" => .0034E-30
+ "-2147483649" => (float)-2147483649, // float value
+ "2147483648" => (float)2147483648, // float value
+ "-0x80000001" => (float)-0x80000001, // float value, beyond max negative int
+ "0x800000001" => (float)0x800000001, // float value, beyond max positive int
+ "020000000001" => (float)020000000001, // float value, beyond max positive int
+ "-020000000001" => (float)-020000000001, // float value, beyond max negative int
+ "0.0" => 0.0,
+ "-0.1" => -0.1,
+ "10.0000000000000000005" => 10.0000000000000000005,
+ "10.5e+5" => 10.5e+5,
+ "1e5" => 1e5,
+ "1e-5" => 1e-5,
+ "1e+5" => 1e+5,
+ "1E5" => 1E5,
+ "1E+5" => 1E+5,
+ "1E-5" => 1E-5,
+ ".5e+7" => .5e+7,
+ ".6e-19" => .6e-19,
+ ".05E+44" => .05E+44,
+ ".0034E-30" => .0034E-30
);
/* Loop to check for above float values with var_export() */
echo "\n*** Output for float values ***\n";
foreach($valid_floats as $key => $float_value) {
- echo "\n-- Iteration: $key --\n";
- var_export( $float_value );
- echo "\n";
- var_export( $float_value, FALSE);
- echo "\n";
- var_dump( var_export( $float_value, TRUE) );
- echo "\n";
+ echo "\n-- Iteration: $key --\n";
+ var_export( $float_value );
+ echo "\n";
+ var_export( $float_value, FALSE);
+ echo "\n";
+ var_dump( var_export( $float_value, TRUE) );
+ echo "\n";
}
?>
-===DONE===
--EXPECT--
*** Testing var_export() with valid float values ***
@@ -172,4 +171,3 @@ string(22) "5.0000000000000001E+42"
3.4000000000000001E-33
string(22) "3.4000000000000001E-33"
-===DONE===
diff --git a/ext/standard/tests/general_functions/var_export_basic4.phpt b/ext/standard/tests/general_functions/var_export_basic4.phpt
index b99f4584a6..789140d255 100644
--- a/ext/standard/tests/general_functions/var_export_basic4.phpt
+++ b/ext/standard/tests/general_functions/var_export_basic4.phpt
@@ -33,17 +33,16 @@ $valid_strings = array(
/* Loop to check for above strings with var_export() */
echo "\n*** Output for strings ***\n";
foreach($valid_strings as $key => $str) {
- echo "\n-- Iteration: $key --\n";
- var_export( $str );
- echo "\n";
- var_export( $str, FALSE);
- echo "\n";
- var_dump( var_export( $str, TRUE) );
- echo "\n";
+ echo "\n-- Iteration: $key --\n";
+ var_export( $str );
+ echo "\n";
+ var_export( $str, FALSE);
+ echo "\n";
+ var_dump( var_export( $str, TRUE) );
+ echo "\n";
}
?>
-===DONE===
--EXPECT--
*** Testing var_export() with valid strings ***
@@ -144,4 +143,3 @@ string(7) "'\\060'"
'8'
string(3) "'8'"
-===DONE===
diff --git a/ext/standard/tests/general_functions/var_export_basic5.phpt b/ext/standard/tests/general_functions/var_export_basic5.phpt
index ab81fa802e..731e84ff99 100644
--- a/ext/standard/tests/general_functions/var_export_basic5.phpt
+++ b/ext/standard/tests/general_functions/var_export_basic5.phpt
@@ -34,16 +34,15 @@ $valid_arrays = array(
/* Loop to check for above arrays with var_export() */
echo "\n*** Output for arrays ***\n";
foreach($valid_arrays as $key => $arr) {
- echo "\n--Iteration: $key --\n";
- var_export( $arr );
- echo "\n";
- var_export( $arr, FALSE);
- echo "\n";
- var_dump( var_export( $arr, TRUE) );
- echo "\n";
+ echo "\n--Iteration: $key --\n";
+ var_export( $arr );
+ echo "\n";
+ var_export( $arr, FALSE);
+ echo "\n";
+ var_dump( var_export( $arr, TRUE) );
+ echo "\n";
}
?>
-===DONE===
--EXPECT--
*** Testing var_export() with valid arrays ***
@@ -276,4 +275,3 @@ string(41) "array (
1 => 'test',
)"
-===DONE===
diff --git a/ext/standard/tests/general_functions/var_export_basic6.phpt b/ext/standard/tests/general_functions/var_export_basic6.phpt
index 6eff478d70..4d09f0a794 100644
--- a/ext/standard/tests/general_functions/var_export_basic6.phpt
+++ b/ext/standard/tests/general_functions/var_export_basic6.phpt
@@ -92,16 +92,15 @@ $valid_objects = array(
/* Loop to check for above objects with var_export() */
echo "\n*** Output for objects ***\n";
foreach($valid_objects as $key => $obj) {
- echo "\n-- Iteration: $key --\n";
- var_export( $obj );
- echo "\n";
- var_export( $obj, FALSE);
- echo "\n";
- var_dump( var_export( $obj, TRUE) );
- echo "\n";
+ echo "\n-- Iteration: $key --\n";
+ var_export( $obj );
+ echo "\n";
+ var_export( $obj, FALSE);
+ echo "\n";
+ var_dump( var_export( $obj, TRUE) );
+ echo "\n";
}
?>
-===DONE===
--EXPECT--
*** Testing var_export() with valid objects ***
@@ -307,4 +306,3 @@ concreteClass::__set_state(array(
string(36) "concreteClass::__set_state(array(
))"
-===DONE===
diff --git a/ext/standard/tests/general_functions/var_export_basic7.phpt b/ext/standard/tests/general_functions/var_export_basic7.phpt
index 817ffc91f0..f9a68f0f13 100644
--- a/ext/standard/tests/general_functions/var_export_basic7.phpt
+++ b/ext/standard/tests/general_functions/var_export_basic7.phpt
@@ -24,16 +24,15 @@ $valid_nulls = array(
/* Loop to check for above null values with var_export() */
echo "\n*** Output for null values ***\n";
foreach($valid_nulls as $key => $null_value) {
- echo "\n-- Iteration: $key --\n";
- var_export( $null_value );
- echo "\n";
- var_export( $null_value, FALSE);
- echo "\n";
- var_dump( var_export( $null_value, true) );
- echo "\n";
+ echo "\n-- Iteration: $key --\n";
+ var_export( $null_value );
+ echo "\n";
+ var_export( $null_value, FALSE);
+ echo "\n";
+ var_dump( var_export( $null_value, true) );
+ echo "\n";
}
?>
-===DONE===
--EXPECT--
*** Testing var_export() with valid null values ***
@@ -56,4 +55,3 @@ NULL
NULL
string(4) "NULL"
-===DONE===
diff --git a/ext/standard/tests/general_functions/var_export_basic9.phpt b/ext/standard/tests/general_functions/var_export_basic9.phpt
index fd78c18c8e..26815bec1b 100644
--- a/ext/standard/tests/general_functions/var_export_basic9.phpt
+++ b/ext/standard/tests/general_functions/var_export_basic9.phpt
@@ -2,9 +2,9 @@
Bug #55082: var_export() doesn't escape properties properly
--FILE--
<?php
- $x = new stdClass();
- $x->{'\'\\'} = 7;
- echo var_export($x);
+ $x = new stdClass();
+ $x->{'\'\\'} = 7;
+ echo var_export($x);
--EXPECT--
(object) array(
'\'\\' => 7,
diff --git a/ext/standard/tests/general_functions/var_export_error2.phpt b/ext/standard/tests/general_functions/var_export_error2.phpt
index eedb757d20..83dd2aa297 100644
--- a/ext/standard/tests/general_functions/var_export_error2.phpt
+++ b/ext/standard/tests/general_functions/var_export_error2.phpt
@@ -8,11 +8,10 @@ Test var_export() function : error conditions - recursive object
* Alias to functions:
*/
-@$obj->p =& $obj;
+$obj = new stdClass;
+$obj->p =& $obj;
var_export($obj, true);
?>
-===DONE===
--EXPECTF--
-Warning: var_export does not handle circular references in %s on line 9
-===DONE===
+Warning: var_export does not handle circular references in %s on line 10
diff --git a/ext/standard/tests/general_functions/var_export_error3.phpt b/ext/standard/tests/general_functions/var_export_error3.phpt
index 38b5dbc28c..7c2bc54ef3 100644
--- a/ext/standard/tests/general_functions/var_export_error3.phpt
+++ b/ext/standard/tests/general_functions/var_export_error3.phpt
@@ -12,7 +12,5 @@ $a[] =& $a;
var_export($a, true);
?>
-===DONE===
--EXPECTF--
Warning: var_export does not handle circular references in %s on line 9
-===DONE===
diff --git a/ext/standard/tests/hrtime/hrtime.phpt b/ext/standard/tests/hrtime/hrtime.phpt
index bac127bf44..9cd31435b8 100644
--- a/ext/standard/tests/hrtime/hrtime.phpt
+++ b/ext/standard/tests/hrtime/hrtime.phpt
@@ -16,9 +16,9 @@ $d1 = $h1 - $h0;
$d = abs($d0 - $d1)/$d1;
if ($d > 0.05) {
- print "FAIL, $d";
+ print "FAIL, $d";
} else {
- print "OK, $d";
+ print "OK, $d";
}
?>
diff --git a/ext/standard/tests/http/bug38802.phpt b/ext/standard/tests/http/bug38802.phpt
index 5e9fd10273..77fa16b5e4 100644
--- a/ext/standard/tests/http/bug38802.phpt
+++ b/ext/standard/tests/http/bug38802.phpt
@@ -10,31 +10,31 @@ require 'server.inc';
function do_test($context_options) {
- $context = stream_context_create(array('http' => $context_options));
+ $context = stream_context_create(array('http' => $context_options));
- $responses = array(
- "data://text/plain,HTTP/1.0 302 Moved Temporarily\r\nLocation: http://127.0.0.1:12342/foo/bar2\r\n\r\n1",
- "data://text/plain,HTTP/1.0 301 Moved Permanently\r\nLocation: http://127.0.0.1:12342/foo/bar3\r\n\r\n",
- "data://text/plain,HTTP/1.0 302 Moved Temporarily\r\nLocation: http://127.0.0.1:12342/foo/bar4\r\n\r\n3",
- "data://text/plain,HTTP/1.0 200 OK\r\n\r\ndone.",
- );
+ $responses = array(
+ "data://text/plain,HTTP/1.0 302 Moved Temporarily\r\nLocation: http://127.0.0.1:12342/foo/bar2\r\n\r\n1",
+ "data://text/plain,HTTP/1.0 301 Moved Permanently\r\nLocation: http://127.0.0.1:12342/foo/bar3\r\n\r\n",
+ "data://text/plain,HTTP/1.0 302 Moved Temporarily\r\nLocation: http://127.0.0.1:12342/foo/bar4\r\n\r\n3",
+ "data://text/plain,HTTP/1.0 200 OK\r\n\r\ndone.",
+ );
- $pid = http_server("tcp://127.0.0.1:12342", $responses, $output);
+ $pid = http_server("tcp://127.0.0.1:12342", $responses, $output);
- $fd = fopen('http://127.0.0.1:12342/foo/bar', 'rb', false, $context);
- var_dump($fd);
+ $fd = fopen('http://127.0.0.1:12342/foo/bar', 'rb', false, $context);
+ var_dump($fd);
- if ($fd) {
- $meta_data = stream_get_meta_data($fd);
- var_dump($meta_data['wrapper_data']);
+ if ($fd) {
+ $meta_data = stream_get_meta_data($fd);
+ var_dump($meta_data['wrapper_data']);
- var_dump(stream_get_contents($fd));
- }
+ var_dump(stream_get_contents($fd));
+ }
- fseek($output, 0, SEEK_SET);
- var_dump(stream_get_contents($output));
+ fseek($output, 0, SEEK_SET);
+ var_dump(stream_get_contents($output));
- http_server_kill($pid);
+ http_server_kill($pid);
}
echo "-- Test: follow all redirections --\n";
@@ -105,7 +105,7 @@ Connection: close
"
-- Test: fail after 2 redirections --
-Warning: fopen(http://127.0.0.1:12342/foo/bar): failed to open stream: Redirection limit reached, aborting in %s
+Warning: fopen(http://127.0.0.1:12342/foo/bar): Failed to open stream: Redirection limit reached, aborting in %s
bool(false)
string(%d) "GET /foo/bar HTTP/1.0
Host: 127.0.0.1:12342
@@ -118,7 +118,7 @@ Connection: close
"
-- Test: fail at first redirection --
-Warning: fopen(http://127.0.0.1:12342/foo/bar): failed to open stream: Redirection limit reached, aborting in %s
+Warning: fopen(http://127.0.0.1:12342/foo/bar): Failed to open stream: Redirection limit reached, aborting in %s
bool(false)
string(%d) "GET /foo/bar HTTP/1.0
Host: 127.0.0.1:12342
@@ -127,7 +127,7 @@ Connection: close
"
-- Test: fail at first redirection (2) --
-Warning: fopen(http://127.0.0.1:12342/foo/bar): failed to open stream: Redirection limit reached, aborting in %s
+Warning: fopen(http://127.0.0.1:12342/foo/bar): Failed to open stream: Redirection limit reached, aborting in %s
bool(false)
string(%d) "GET /foo/bar HTTP/1.0
Host: 127.0.0.1:12342
diff --git a/ext/standard/tests/http/bug43510.phpt b/ext/standard/tests/http/bug43510.phpt
index d973612372..45ba4fb20f 100644
--- a/ext/standard/tests/http/bug43510.phpt
+++ b/ext/standard/tests/http/bug43510.phpt
@@ -9,17 +9,17 @@ allow_url_fopen=1
require 'server.inc';
$responses = array(
- "data://text/plain,HTTP/1.0 200 OK\r\n\r\n",
- "data://text/plain,HTTP/1.0 200 OK\r\n\r\n",
+ "data://text/plain,HTTP/1.0 200 OK\r\n\r\n",
+ "data://text/plain,HTTP/1.0 200 OK\r\n\r\n",
);
$pid = http_server("tcp://127.0.0.1:12342", $responses, $output);
foreach(array('r', 'rb') as $mode) {
- $fd = fopen('http://127.0.0.1:12342/', $mode, false);
- $meta = stream_get_meta_data($fd);
- var_dump($meta['mode']);
- fclose($fd);
+ $fd = fopen('http://127.0.0.1:12342/', $mode, false);
+ $meta = stream_get_meta_data($fd);
+ var_dump($meta['mode']);
+ fclose($fd);
}
http_server_kill($pid);
diff --git a/ext/standard/tests/http/bug47021.phpt b/ext/standard/tests/http/bug47021.phpt
index f3db3e1be2..b3acd1bc3a 100644
--- a/ext/standard/tests/http/bug47021.phpt
+++ b/ext/standard/tests/http/bug47021.phpt
@@ -13,7 +13,7 @@ function stream_notification_callback($notification_code, $severity, $message, $
switch($notification_code) {
case STREAM_NOTIFY_MIME_TYPE_IS:
echo "Type='$message'\n";
- break;
+ break;
case STREAM_NOTIFY_FILE_SIZE_IS:
echo "Size=$bytes_max\n";
break;
diff --git a/ext/standard/tests/http/bug48929.phpt b/ext/standard/tests/http/bug48929.phpt
index b31ed292be..9a769d8674 100644
--- a/ext/standard/tests/http/bug48929.phpt
+++ b/ext/standard/tests/http/bug48929.phpt
@@ -10,24 +10,24 @@ require 'server.inc';
function do_test($context_options) {
- $context = stream_context_create(array('http' => $context_options));
+ $context = stream_context_create(array('http' => $context_options));
- $responses = array(
- "data://text/plain,HTTP/1.0 200 OK\r\n\r\n",
- );
+ $responses = array(
+ "data://text/plain,HTTP/1.0 200 OK\r\n\r\n",
+ );
- $pid = http_server("tcp://127.0.0.1:12342", $responses, $output);
+ $pid = http_server("tcp://127.0.0.1:12342", $responses, $output);
- foreach($responses as $r) {
+ foreach($responses as $r) {
- $fd = fopen('http://127.0.0.1:12342/', 'rb', false, $context);
+ $fd = fopen('http://127.0.0.1:12342/', 'rb', false, $context);
- fseek($output, 0, SEEK_SET);
- var_dump(stream_get_contents($output));
- fseek($output, 0, SEEK_SET);
- }
+ fseek($output, 0, SEEK_SET);
+ var_dump(stream_get_contents($output));
+ fseek($output, 0, SEEK_SET);
+ }
- http_server_kill($pid);
+ http_server_kill($pid);
}
echo "-- Test: requests with 'header' as array --\n";
diff --git a/ext/standard/tests/http/bug53198.phpt b/ext/standard/tests/http/bug53198.phpt
index 2585c3df6e..add07c3f47 100644
--- a/ext/standard/tests/http/bug53198.phpt
+++ b/ext/standard/tests/http/bug53198.phpt
@@ -11,22 +11,22 @@ require 'server.inc';
function do_test() {
- $responses = array(
- "data://text/plain,HTTP/1.0 200 OK\r\n\r\n",
- );
+ $responses = array(
+ "data://text/plain,HTTP/1.0 200 OK\r\n\r\n",
+ );
- $pid = http_server("tcp://127.0.0.1:12342", $responses, $output);
+ $pid = http_server("tcp://127.0.0.1:12342", $responses, $output);
- foreach($responses as $r) {
+ foreach($responses as $r) {
- $fd = fopen('http://127.0.0.1:12342/', 'rb', false);
+ $fd = fopen('http://127.0.0.1:12342/', 'rb', false);
- fseek($output, 0, SEEK_SET);
- var_dump(stream_get_contents($output));
- fseek($output, 0, SEEK_SET);
- }
+ fseek($output, 0, SEEK_SET);
+ var_dump(stream_get_contents($output));
+ fseek($output, 0, SEEK_SET);
+ }
- http_server_kill($pid);
+ http_server_kill($pid);
}
diff --git a/ext/standard/tests/http/bug60570.phpt b/ext/standard/tests/http/bug60570.phpt
index 5996df369a..3c16d78033 100644
--- a/ext/standard/tests/http/bug60570.phpt
+++ b/ext/standard/tests/http/bug60570.phpt
@@ -10,41 +10,41 @@ require 'server.inc';
function do_test() {
- $responses = array(
- "data://text/plain,HTTP/1.0 404 Not Found\r\n\r\n",
- "data://text/plain,HTTP/1.0 404 Not Found\r\n\r\n",
- "data://text/plain,HTTP/1.0 404 Not Found\r\n\r\n"
- );
+ $responses = array(
+ "data://text/plain,HTTP/1.0 404 Not Found\r\n\r\n",
+ "data://text/plain,HTTP/1.0 404 Not Found\r\n\r\n",
+ "data://text/plain,HTTP/1.0 404 Not Found\r\n\r\n"
+ );
- $pid = http_server("tcp://127.0.0.1:12342", $responses, $output);
+ $pid = http_server("tcp://127.0.0.1:12342", $responses, $output);
- $a = $b = count(get_resources());
+ $a = $b = count(get_resources());
- $i = 3;
- while ($i--) {
- $context = stream_context_create(array('http'=>array('timeout'=>1)));
- file_get_contents('http://127.0.0.1:12342/', 0, $context);
- unset($context);
+ $i = 3;
+ while ($i--) {
+ $context = stream_context_create(array('http'=>array('timeout'=>1)));
+ file_get_contents('http://127.0.0.1:12342/', 0, $context);
+ unset($context);
- $b = $a;
- $a = count(get_resources());
- }
+ $b = $a;
+ $a = count(get_resources());
+ }
- http_server_kill($pid);
+ http_server_kill($pid);
- echo "leak? penultimate iteration: $b, last one: $a\n";
- var_dump($a == $b);
+ echo "leak? penultimate iteration: $b, last one: $a\n";
+ var_dump($a == $b);
}
do_test();
--EXPECTF--
-Warning: file_get_contents(http://127.0.0.1:12342/): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found
+Warning: file_get_contents(http://127.0.0.1:12342/): Failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found
in %s on line %d
-Warning: file_get_contents(http://127.0.0.1:12342/): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found
+Warning: file_get_contents(http://127.0.0.1:12342/): Failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found
in %s on line %d
-Warning: file_get_contents(http://127.0.0.1:12342/): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found
+Warning: file_get_contents(http://127.0.0.1:12342/): Failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found
in %s on line %d
leak? penultimate iteration: %d, last one: %d
bool(true)
diff --git a/ext/standard/tests/http/bug61548.phpt b/ext/standard/tests/http/bug61548.phpt
index 38b2bbf086..04ea55341b 100644
--- a/ext/standard/tests/http/bug61548.phpt
+++ b/ext/standard/tests/http/bug61548.phpt
@@ -11,8 +11,8 @@ require 'server.inc';
function do_test($header) {
$options = [
'http' => [
- 'method' => 'POST',
- 'header' => $header,
+ 'method' => 'POST',
+ 'header' => $header,
'follow_location' => true,
],
];
@@ -20,9 +20,9 @@ function do_test($header) {
$ctx = stream_context_create($options);
$responses = [
- "data://text/plain,HTTP/1.1 201\r\nLocation: /foo\r\n\r\n",
- "data://text/plain,HTTP/1.1 200\r\nConnection: close\r\n\r\n",
- ];
+ "data://text/plain,HTTP/1.1 201\r\nLocation: /foo\r\n\r\n",
+ "data://text/plain,HTTP/1.1 200\r\nConnection: close\r\n\r\n",
+ ];
$pid = http_server('tcp://127.0.0.1:12342', $responses, $output);
$fd = fopen('http://127.0.0.1:12342/', 'rb', false, $ctx);
diff --git a/ext/standard/tests/http/bug69337.phpt b/ext/standard/tests/http/bug69337.phpt
index 8de8187485..7136ff474d 100644
--- a/ext/standard/tests/http/bug69337.phpt
+++ b/ext/standard/tests/http/bug69337.phpt
@@ -10,8 +10,8 @@ require 'server.inc';
function stream_notification_callback($notification_code, $severity, $message, $message_code, $bytes_transferred, $bytes_max)
{
- if($notification_code == STREAM_NOTIFY_REDIRECTED) {
- // $http_response_header is now a string, but will be used as an array
+ if($notification_code == STREAM_NOTIFY_REDIRECTED) {
+ // $http_response_header is now a string, but will be used as an array
// by php_stream_url_wrap_http_ex() later on
$GLOBALS['http_response_header'] = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\0\0\0\0";
}
@@ -21,8 +21,8 @@ $ctx = stream_context_create();
stream_context_set_params($ctx, array("notification" => "stream_notification_callback"));
$responses = array(
- "data://text/plain,HTTP/1.0 302 Found\r\nLocation: http://127.0.0.1:22345/try-again\r\n\r\n",
- "data://text/plain,HTTP/1.0 404 Not Found\r\n\r\n",
+ "data://text/plain,HTTP/1.0 302 Found\r\nLocation: http://127.0.0.1:22345/try-again\r\n\r\n",
+ "data://text/plain,HTTP/1.0 404 Not Found\r\n\r\n",
);
$pid = http_server("tcp://127.0.0.1:22345", $responses, $output);
@@ -32,8 +32,6 @@ $f = file_get_contents('http://127.0.0.1:22345/', 0, $ctx);
http_server_kill($pid);
var_dump($f);
?>
-==DONE==
--EXPECTF--
-Warning: file_get_contents(http://127.0.0.1:22345/): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found%ain %s on line %d
+Warning: file_get_contents(http://127.0.0.1:22345/): Failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found%ain %s on line %d
bool(false)
-==DONE==
diff --git a/ext/standard/tests/http/bug75535.phpt b/ext/standard/tests/http/bug75535.phpt
index 9bf298cc06..236a96820c 100644
--- a/ext/standard/tests/http/bug75535.phpt
+++ b/ext/standard/tests/http/bug75535.phpt
@@ -9,7 +9,7 @@ allow_url_fopen=1
require 'server.inc';
$responses = array(
- "data://text/plain,HTTP/1.0 200 Ok\r\nContent-Length\r\n",
+ "data://text/plain,HTTP/1.0 200 Ok\r\nContent-Length\r\n",
);
$pid = http_server("tcp://127.0.0.1:22351", $responses, $output);
@@ -19,7 +19,6 @@ var_dump($http_response_header);
http_server_kill($pid);
?>
-==DONE==
--EXPECT--
string(0) ""
array(2) {
@@ -28,4 +27,3 @@ array(2) {
[1]=>
string(14) "Content-Length"
}
-==DONE==
diff --git a/ext/standard/tests/http/bug75981.phpt b/ext/standard/tests/http/bug75981.phpt
index d415de66b9..52a560cfbc 100644
--- a/ext/standard/tests/http/bug75981.phpt
+++ b/ext/standard/tests/http/bug75981.phpt
@@ -18,7 +18,7 @@ $options = [
$ctx = stream_context_create($options);
$responses = [
- "data://text/plain,000000000100\xA\xA"
+ "data://text/plain,000000000100\xA\xA"
];
$pid = http_server('tcp://127.0.0.1:12342', $responses);
diff --git a/ext/standard/tests/http/bug76342.phpt b/ext/standard/tests/http/bug76342.phpt
index ee943ca365..10de23fdf3 100644
--- a/ext/standard/tests/http/bug76342.phpt
+++ b/ext/standard/tests/http/bug76342.phpt
@@ -31,5 +31,5 @@ http_server_kill($pid);
?>
DONE
--EXPECTF--
-Warning: file_get_contents(http://127.0.0.1:12342/): failed to open stream: HTTP request failed! in %s on line %d
+Warning: file_get_contents(http://127.0.0.1:12342/): Failed to open stream: HTTP request failed! in %s on line %d
DONE
diff --git a/ext/standard/tests/http/http_response_header_01.phpt b/ext/standard/tests/http/http_response_header_01.phpt
index d364ebd153..05037f24b1 100644
--- a/ext/standard/tests/http/http_response_header_01.phpt
+++ b/ext/standard/tests/http/http_response_header_01.phpt
@@ -9,7 +9,7 @@ allow_url_fopen=1
require 'server.inc';
$responses = array(
- "data://text/plain,HTTP/1.0 200 Ok\r\nSome: Header\r\nSome: Header\r\n\r\nBody",
+ "data://text/plain,HTTP/1.0 200 Ok\r\nSome: Header\r\nSome: Header\r\n\r\nBody",
);
$pid = http_server("tcp://127.0.0.1:22346", $responses, $output);
@@ -23,7 +23,6 @@ test();
http_server_kill($pid);
?>
-==DONE==
--EXPECT--
string(4) "Body"
array(3) {
@@ -34,4 +33,3 @@ array(3) {
[2]=>
string(12) "Some: Header"
}
-==DONE==
diff --git a/ext/standard/tests/http/http_response_header_02.phpt b/ext/standard/tests/http/http_response_header_02.phpt
index 518ae9167b..873a8621a5 100644
--- a/ext/standard/tests/http/http_response_header_02.phpt
+++ b/ext/standard/tests/http/http_response_header_02.phpt
@@ -9,7 +9,7 @@ allow_url_fopen=1
require 'server.inc';
$responses = array(
- "data://text/plain,HTTP/1.0 302 Found\r\n"
+ "data://text/plain,HTTP/1.0 302 Found\r\n"
. "Some: Header\r\nLocation: http://127.0.0.1:22347/try-again\r\n\r\n",
"data://test/plain,HTTP/1.0 200 Ok\r\nSome: Header\r\n\r\nBody",
);
@@ -25,7 +25,6 @@ test();
http_server_kill($pid);
?>
-==DONE==
--EXPECT--
string(4) "Body"
array(5) {
@@ -40,4 +39,3 @@ array(5) {
[4]=>
string(12) "Some: Header"
}
-==DONE==
diff --git a/ext/standard/tests/http/http_response_header_03.phpt b/ext/standard/tests/http/http_response_header_03.phpt
index 907983ac4b..832382de23 100644
--- a/ext/standard/tests/http/http_response_header_03.phpt
+++ b/ext/standard/tests/http/http_response_header_03.phpt
@@ -9,7 +9,7 @@ allow_url_fopen=1
require 'server.inc';
$responses = array(
- "data://text/plain,HTTP/1.0 302 Found\r\n"
+ "data://text/plain,HTTP/1.0 302 Found\r\n"
. "Some: Header\r\nLocation: http://127.0.0.1:22348/try-again\r\n\r\n",
"data://test/plain,HTTP/1.0 404 Not Found\r\nSome: Header\r\n\r\nBody",
);
@@ -25,9 +25,8 @@ test();
http_server_kill($pid);
?>
-==DONE==
--EXPECTF--
-Warning: file_get_contents(http://127.0.0.1:22348/): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found%a
+Warning: file_get_contents(http://127.0.0.1:22348/): Failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found%a
bool(false)
array(5) {
[0]=>
@@ -41,4 +40,3 @@ array(5) {
[4]=>
string(12) "Some: Header"
}
-==DONE==
diff --git a/ext/standard/tests/http/http_response_header_04.phpt b/ext/standard/tests/http/http_response_header_04.phpt
index 98badf9997..89a4d466fd 100644
--- a/ext/standard/tests/http/http_response_header_04.phpt
+++ b/ext/standard/tests/http/http_response_header_04.phpt
@@ -9,7 +9,7 @@ allow_url_fopen=1
require 'server.inc';
$responses = array(
- "data://text/plain,HTTP/1.0 200 Ok\r\nSome: Header \r\n\r\nBody",
+ "data://text/plain,HTTP/1.0 200 Ok\r\nSome: Header \r\n\r\nBody",
);
$pid = http_server("tcp://127.0.0.1:22349", $responses, $output);
@@ -23,7 +23,6 @@ test();
http_server_kill($pid);
?>
-==DONE==
--EXPECT--
string(4) "Body"
array(2) {
@@ -32,4 +31,3 @@ array(2) {
[1]=>
string(14) "Some: Header"
}
-==DONE==
diff --git a/ext/standard/tests/http/http_response_header_05.phpt b/ext/standard/tests/http/http_response_header_05.phpt
index dbdd7b8b1a..372de1163d 100644
--- a/ext/standard/tests/http/http_response_header_05.phpt
+++ b/ext/standard/tests/http/http_response_header_05.phpt
@@ -9,7 +9,7 @@ allow_url_fopen=1
require 'server.inc';
$responses = array(
- "data://text/plain,HTTP/1.0 200 Ok\r\n \r\n\r\nBody",
+ "data://text/plain,HTTP/1.0 200 Ok\r\n \r\n\r\nBody",
);
$pid = http_server("tcp://127.0.0.1:22350", $responses, $output);
@@ -23,7 +23,6 @@ test();
http_server_kill($pid);
?>
-==DONE==
--EXPECT--
string(4) "Body"
array(2) {
@@ -32,4 +31,3 @@ array(2) {
[1]=>
string(0) ""
}
-==DONE==
diff --git a/ext/standard/tests/http/ignore_errors.phpt b/ext/standard/tests/http/ignore_errors.phpt
index 54a0073b5e..38a1cf6985 100644
--- a/ext/standard/tests/http/ignore_errors.phpt
+++ b/ext/standard/tests/http/ignore_errors.phpt
@@ -10,33 +10,33 @@ require 'server.inc';
function do_test($context_options) {
- $context = stream_context_create(array('http' => $context_options));
+ $context = stream_context_create(array('http' => $context_options));
- $responses = array(
- "data://text/plain,HTTP/1.0 200 Ok\r\nX-Foo: bar\r\n\r\n1",
- "data://text/plain,HTTP/1.0 404 Not found\r\nX-bar: baz\r\n\r\n2",
- );
+ $responses = array(
+ "data://text/plain,HTTP/1.0 200 Ok\r\nX-Foo: bar\r\n\r\n1",
+ "data://text/plain,HTTP/1.0 404 Not found\r\nX-bar: baz\r\n\r\n2",
+ );
- $pid = http_server("tcp://127.0.0.1:12342", $responses, $output);
+ $pid = http_server("tcp://127.0.0.1:12342", $responses, $output);
- foreach($responses as $r) {
+ foreach($responses as $r) {
- $fd = fopen('http://127.0.0.1:12342/foo/bar', 'rb', false, $context);
- var_dump($fd);
+ $fd = fopen('http://127.0.0.1:12342/foo/bar', 'rb', false, $context);
+ var_dump($fd);
- if ($fd) {
- $meta_data = stream_get_meta_data($fd);
- var_dump($meta_data['wrapper_data']);
+ if ($fd) {
+ $meta_data = stream_get_meta_data($fd);
+ var_dump($meta_data['wrapper_data']);
- var_dump(stream_get_contents($fd));
- }
+ var_dump(stream_get_contents($fd));
+ }
- fseek($output, 0, SEEK_SET);
- var_dump(stream_get_contents($output));
- fseek($output, 0, SEEK_SET);
- }
+ fseek($output, 0, SEEK_SET);
+ var_dump(stream_get_contents($output));
+ fseek($output, 0, SEEK_SET);
+ }
- http_server_kill($pid);
+ http_server_kill($pid);
}
echo "-- Test: requests without ignore_errors --\n";
@@ -68,7 +68,7 @@ Connection: close
"
-Warning: fopen(http://127.0.0.1:12342/foo/bar): failed to open stream: HTTP request failed! HTTP/1.0 404 Not found
+Warning: fopen(http://127.0.0.1:12342/foo/bar): Failed to open stream: HTTP request failed! HTTP/1.0 404 Not found
in %s on line %d
bool(false)
string(%d) "GET /foo/bar HTTP/1.0
diff --git a/ext/standard/tests/http/server.inc b/ext/standard/tests/http/server.inc
index e580674928..81cc131a8a 100644
--- a/ext/standard/tests/http/server.inc
+++ b/ext/standard/tests/http/server.inc
@@ -2,34 +2,34 @@
function http_server_skipif($socket_string) {
- if (!function_exists('pcntl_fork')) die('skip pcntl_fork() not available');
- if (!function_exists('posix_kill')) die('skip posix_kill() not available');
- if (!stream_socket_server($socket_string)) die('skip stream_socket_server() failed');
+ if (!function_exists('pcntl_fork')) die('skip pcntl_fork() not available');
+ if (!function_exists('posix_kill')) die('skip posix_kill() not available');
+ if (!stream_socket_server($socket_string)) die('skip stream_socket_server() failed');
}
function http_server_init($socket_string, &$output = null) {
- pcntl_alarm(60);
-
- $server = stream_socket_server($socket_string, $errno, $errstr);
- if (!$server) {
- return false;
- }
-
- if ($output === null) {
- $output = tmpfile();
- if ($output === false) {
- return false;
- }
- }
-
- $pid = pcntl_fork();
- if ($pid == -1) {
- die('could not fork');
- } else if ($pid) {
- return $pid;
- }
-
- return $server;
+ pcntl_alarm(60);
+
+ $server = stream_socket_server($socket_string, $errno, $errstr);
+ if (!$server) {
+ return false;
+ }
+
+ if ($output === null) {
+ $output = tmpfile();
+ if ($output === false) {
+ return false;
+ }
+ }
+
+ $pid = pcntl_fork();
+ if ($pid == -1) {
+ die('could not fork');
+ } else if ($pid) {
+ return $pid;
+ }
+
+ return $server;
}
/* Minimal HTTP server with predefined responses.
@@ -40,79 +40,79 @@ function http_server_init($socket_string, &$output = null) {
*/
function http_server($socket_string, array $files, &$output = null) {
- if (!is_resource($server = http_server_init($socket_string, $output))) {
- return $server;
- }
+ if (!is_resource($server = http_server_init($socket_string, $output))) {
+ return $server;
+ }
- foreach($files as $file) {
+ foreach($files as $file) {
- $sock = stream_socket_accept($server);
- if (!$sock) {
- exit(1);
- }
+ $sock = stream_socket_accept($server);
+ if (!$sock) {
+ exit(1);
+ }
- // read headers
+ // read headers
- $content_length = 0;
+ $content_length = 0;
- stream_set_blocking($sock, 0);
- while (!feof($sock)) {
+ stream_set_blocking($sock, 0);
+ while (!feof($sock)) {
- list($r, $w, $e) = array(array($sock), null, null);
- if (!stream_select($r, $w, $e, 1)) continue;
+ list($r, $w, $e) = array(array($sock), null, null);
+ if (!stream_select($r, $w, $e, 1)) continue;
- $line = stream_get_line($sock, 8192, "\r\n");
- if ($line === '') {
- fwrite($output, "\r\n");
- break;
- } else if ($line !== false) {
- fwrite($output, "$line\r\n");
+ $line = stream_get_line($sock, 8192, "\r\n");
+ if ($line === '') {
+ fwrite($output, "\r\n");
+ break;
+ } else if ($line !== false) {
+ fwrite($output, "$line\r\n");
- if (preg_match('#^Content-Length\s*:\s*([[:digit:]]+)\s*$#i', $line, $matches)) {
- $content_length = (int) $matches[1];
- }
- }
- }
- stream_set_blocking($sock, 1);
+ if (preg_match('#^Content-Length\s*:\s*([[:digit:]]+)\s*$#i', $line, $matches)) {
+ $content_length = (int) $matches[1];
+ }
+ }
+ }
+ stream_set_blocking($sock, 1);
- // read content
+ // read content
- if ($content_length > 0) {
- stream_copy_to_stream($sock, $output, $content_length);
- }
+ if ($content_length > 0) {
+ stream_copy_to_stream($sock, $output, $content_length);
+ }
- // send response
+ // send response
- $fd = fopen($file, 'rb');
- stream_copy_to_stream($fd, $sock);
+ $fd = fopen($file, 'rb');
+ stream_copy_to_stream($fd, $sock);
- fclose($sock);
- }
+ fclose($sock);
+ }
- exit(0);
+ exit(0);
}
function http_server_sleep($socket_string, $micro_seconds = 500000)
{
- if (!is_resource($server = http_server_init($socket_string, $output))) {
- return $server;
- }
+ if (!is_resource($server = http_server_init($socket_string, $output))) {
+ return $server;
+ }
- $sock = stream_socket_accept($server);
- if (!$sock) {
- exit(1);
- }
+ $sock = stream_socket_accept($server);
+ if (!$sock) {
+ exit(1);
+ }
- usleep($micro_seconds);
+ usleep($micro_seconds);
- fclose($sock);
+ fclose($sock);
- exit(0);
+ exit(0);
}
function http_server_kill($pid) {
- posix_kill($pid, SIGTERM);
- pcntl_waitpid($pid, $status);
+ posix_kill($pid, SIGTERM);
+ pcntl_waitpid($pid, $status);
}
?>
diff --git a/ext/standard/tests/image/bug13213.phpt b/ext/standard/tests/image/bug13213.phpt
index 7af1549586..61fe245efe 100644
--- a/ext/standard/tests/image/bug13213.phpt
+++ b/ext/standard/tests/image/bug13213.phpt
@@ -5,7 +5,7 @@ Bug #13213 (GetImageSize and wrong JPEG Comments)
var_dump(GetImageSize(__DIR__.'/bug13213.jpg'));
?>
--EXPECTF--
-Warning: getimagesize(): corrupt JPEG data: 2 extraneous bytes before marker in %s%ebug13213.php on line %d
+Warning: getimagesize(): Corrupt JPEG data: 2 extraneous bytes before marker in %s%ebug13213.php on line %d
array(7) {
[0]=>
int(1)
diff --git a/ext/standard/tests/image/bug71848.phpt b/ext/standard/tests/image/bug71848.phpt
index d96ac1c537..25c05689e6 100644
--- a/ext/standard/tests/image/bug71848.phpt
+++ b/ext/standard/tests/image/bug71848.phpt
@@ -5,7 +5,6 @@ Bug #71848 (getimagesize with $imageinfo returns false)
var_dump(getimagesize(__DIR__ . '/bug71848.jpg', $info));
var_dump(array_keys($info));
?>
-===DONE===
--EXPECT--
array(7) {
[0]=>
@@ -29,4 +28,3 @@ array(2) {
[1]=>
string(4) "APP5"
}
-===DONE===
diff --git a/ext/standard/tests/image/bug72278.phpt b/ext/standard/tests/image/bug72278.phpt
index 6c5dfa8777..074338c18a 100644
--- a/ext/standard/tests/image/bug72278.phpt
+++ b/ext/standard/tests/image/bug72278.phpt
@@ -6,9 +6,8 @@ define('FILENAME', __DIR__ . DIRECTORY_SEPARATOR . 'bug72278.jpg');
var_dump(getimagesize(FILENAME));
?>
-===DONE===
--EXPECTF--
-Warning: getimagesize(): corrupt JPEG data: 3 extraneous bytes before marker in %s%ebug72278.php on line %d
+Warning: getimagesize(): Corrupt JPEG data: 3 extraneous bytes before marker in %s%ebug72278.php on line %d
array(7) {
[0]=>
int(300)
@@ -25,4 +24,3 @@ array(7) {
["mime"]=>
string(10) "image/jpeg"
}
-===DONE===
diff --git a/ext/standard/tests/image/getimagesize.phpt b/ext/standard/tests/image/getimagesize.phpt
index db8213b7dc..ed32ac7c0e 100644
--- a/ext/standard/tests/image/getimagesize.phpt
+++ b/ext/standard/tests/image/getimagesize.phpt
@@ -6,21 +6,21 @@ GetImageSize()
?>
--FILE--
<?php
- // Note: SWC requires zlib
- $dir = opendir(__DIR__) or die('cannot open directory: '.__DIR__);
- $result = array();
- $files = array();
- while (($file = readdir($dir)) !== FALSE) {
- if (preg_match('/^test.+pix\./',$file) && $file != "test13pix.swf") {
- $files[] = $file;
- }
- }
- closedir($dir);
- sort($files);
- foreach($files as $file) {
- $result[$file] = getimagesize(__DIR__."/$file");
- }
- var_dump($result);
+ // Note: SWC requires zlib
+ $dir = opendir(__DIR__) or die('cannot open directory: '.__DIR__);
+ $result = array();
+ $files = array();
+ while (($file = readdir($dir)) !== FALSE) {
+ if (preg_match('/^test.+pix\./',$file) && $file != "test13pix.swf") {
+ $files[] = $file;
+ }
+ }
+ closedir($dir);
+ sort($files);
+ foreach($files as $file) {
+ $result[$file] = getimagesize(__DIR__."/$file");
+ }
+ var_dump($result);
?>
--EXPECT--
array(16) {
diff --git a/ext/standard/tests/image/getimagesize_246x247.phpt b/ext/standard/tests/image/getimagesize_246x247.phpt
index 5908671f1c..0e1290fcf2 100644
--- a/ext/standard/tests/image/getimagesize_246x247.phpt
+++ b/ext/standard/tests/image/getimagesize_246x247.phpt
@@ -6,21 +6,21 @@ GetImageSize() with 246x247 pixels
?>
--FILE--
<?php
- // Note: SWC requires zlib
- $dir = opendir(__DIR__) or die('cannot open directory: '.__DIR__);
- $result = array();
- $files = array();
- while (($file = readdir($dir)) !== FALSE) {
- if (preg_match('/^246x247\./',$file)) {
- $files[] = $file;
- }
- }
- closedir($dir);
- sort($files);
- foreach($files as $file) {
- $result[$file] = getimagesize(__DIR__."/$file");
- }
- var_dump($result);
+ // Note: SWC requires zlib
+ $dir = opendir(__DIR__) or die('cannot open directory: '.__DIR__);
+ $result = array();
+ $files = array();
+ while (($file = readdir($dir)) !== FALSE) {
+ if (preg_match('/^246x247\./',$file)) {
+ $files[] = $file;
+ }
+ }
+ closedir($dir);
+ sort($files);
+ foreach($files as $file) {
+ $result[$file] = getimagesize(__DIR__."/$file");
+ }
+ var_dump($result);
?>
--EXPECT--
array(1) {
diff --git a/ext/standard/tests/image/getimagesize_384x385.phpt b/ext/standard/tests/image/getimagesize_384x385.phpt
index 9ed1104220..cef9d73b3f 100644
--- a/ext/standard/tests/image/getimagesize_384x385.phpt
+++ b/ext/standard/tests/image/getimagesize_384x385.phpt
@@ -6,21 +6,21 @@ GetImageSize() with 384x385 pixels
?>
--FILE--
<?php
- // Note: SWC requires zlib
- $dir = opendir(__DIR__) or die('cannot open directory: '.__DIR__);
- $result = array();
- $files = array();
- while (($file = readdir($dir)) !== FALSE) {
- if (preg_match('/^384x385\./',$file)) {
- $files[] = $file;
- }
- }
- closedir($dir);
- sort($files);
- foreach($files as $file) {
- $result[$file] = getimagesize(__DIR__."/$file");
- }
- var_dump($result);
+ // Note: SWC requires zlib
+ $dir = opendir(__DIR__) or die('cannot open directory: '.__DIR__);
+ $result = array();
+ $files = array();
+ while (($file = readdir($dir)) !== FALSE) {
+ if (preg_match('/^384x385\./',$file)) {
+ $files[] = $file;
+ }
+ }
+ closedir($dir);
+ sort($files);
+ foreach($files as $file) {
+ $result[$file] = getimagesize(__DIR__."/$file");
+ }
+ var_dump($result);
?>
--EXPECT--
array(1) {
diff --git a/ext/standard/tests/image/getimagesize_basic.phpt b/ext/standard/tests/image/getimagesize_basic.phpt
index 8e03ff2e53..ad857243d7 100644
--- a/ext/standard/tests/image/getimagesize_basic.phpt
+++ b/ext/standard/tests/image/getimagesize_basic.phpt
@@ -45,7 +45,6 @@ foreach($imagetype_filenames as $key => $filename) {
var_dump( $info );
};
?>
-===DONE===
--EXPECTF--
*** Testing getimagesize() : basic functionality ***
@@ -216,4 +215,3 @@ array(6) {
}
array(0) {
}
-===DONE===
diff --git a/ext/standard/tests/image/getimagesize_jpgapp.phpt b/ext/standard/tests/image/getimagesize_jpgapp.phpt
index 2776c8617a..b4c6413a08 100644
--- a/ext/standard/tests/image/getimagesize_jpgapp.phpt
+++ b/ext/standard/tests/image/getimagesize_jpgapp.phpt
@@ -19,13 +19,11 @@ $arr['APP1'] = "and this too";
getimagesize( __DIR__."/testAPP.jpg", $arr);
foreach ($arr as $key => $value) {
- echo "$key - length: ". strlen($value) ."; md5: " . md5($value) . "\n" ;
+ echo "$key - length: ". strlen($value) ."; md5: " . md5($value) . "\n" ;
}
?>
-===DONE===
--EXPECT--
APP1 - length: 1717; md5: 02cbf4ba6640c131422483138c968516
APP2 - length: 7275; md5: f5036ccca2031e8bf932bcbd4aca4355
APP13 - length: 42; md5: 2202998bd05e78bcb419f08c070d6f61
-===DONE===
diff --git a/ext/standard/tests/image/getimagesize_swc.phpt b/ext/standard/tests/image/getimagesize_swc.phpt
index 5e79a5d0a2..bba67d4f09 100644
--- a/ext/standard/tests/image/getimagesize_swc.phpt
+++ b/ext/standard/tests/image/getimagesize_swc.phpt
@@ -8,7 +8,7 @@ GetImageSize() for compressed swf files
?>
--FILE--
<?php
- var_dump(getimagesize(__DIR__ . "/test13pix.swf"));
+ var_dump(getimagesize(__DIR__ . "/test13pix.swf"));
?>
--EXPECT--
array(5) {
diff --git a/ext/standard/tests/image/getimagesize_tif_mm.phpt b/ext/standard/tests/image/getimagesize_tif_mm.phpt
index 8fb7ceb87a..6d76c2bb06 100644
--- a/ext/standard/tests/image/getimagesize_tif_mm.phpt
+++ b/ext/standard/tests/image/getimagesize_tif_mm.phpt
@@ -13,7 +13,6 @@ var_dump(getimagesize(__DIR__ . "/2x2mm.tiff", $arr));
var_dump($arr);
?>
-===DONE===
--EXPECT--
*** Testing getimagesize() : tiff_mm format ***
array(5) {
@@ -30,4 +29,3 @@ array(5) {
}
array(0) {
}
-===DONE===
diff --git a/ext/standard/tests/image/getimagesize_variation2.phpt b/ext/standard/tests/image/getimagesize_variation2.phpt
index c475a9cb05..7799303c62 100644
--- a/ext/standard/tests/image/getimagesize_variation2.phpt
+++ b/ext/standard/tests/image/getimagesize_variation2.phpt
@@ -8,8 +8,8 @@ Test getimagesize() function : usage variations - unexpected type for arg 2
* Alias to functions:
*/
-function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
- echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+function test_error_handler($err_no, $err_msg, $filename, $linenum) {
+ echo "Error: $err_no - $err_msg\n";
}
set_error_handler('test_error_handler');
@@ -78,11 +78,10 @@ foreach($values as $key => $value) {
};
?>
-===DONE===
---EXPECTF--
+--EXPECT--
*** Testing getimagesize() : usage variations ***
-Error: 8 - Undefined variable: undefined_var, %s(%d)
-Error: 8 - Undefined variable: unset_var, %s(%d)
+Error: 2 - Undefined variable: undefined_var
+Error: 2 - Undefined variable: unset_var
-- Arg value 0 --
string(28) "4a46494600010201006000600000"
@@ -158,4 +157,3 @@ string(28) "4a46494600010201006000600000"
-- Arg value unset_var --
string(28) "4a46494600010201006000600000"
-===DONE===
diff --git a/ext/standard/tests/image/getimagesize_variation3.phpt b/ext/standard/tests/image/getimagesize_variation3.phpt
index a608047707..b50e822d70 100644
--- a/ext/standard/tests/image/getimagesize_variation3.phpt
+++ b/ext/standard/tests/image/getimagesize_variation3.phpt
@@ -10,10 +10,10 @@ Test getimagesize() function : variation - Passing non image files
$file_types_array = array (
//File containing text string
- "File with text data" => "test.txt",
+ "File with text data" => "test.txt",
- //File containing forcibly corrupted bmp image
- "File with corrupted BMP data" => "200x100_unknown.unknown",
+ //File containing forcibly corrupted bmp image
+ "File with corrupted BMP data" => "200x100_unknown.unknown",
//File which doesn't exist
"Non-existent file" => "nofile.ext",
@@ -32,7 +32,6 @@ foreach($file_types_array as $key => $filename) {
var_dump( $info );
};
?>
-===DONE===
--EXPECTF--
*** Testing getimagesize() : variation ***
@@ -50,21 +49,20 @@ array(0) {
-- Non-existent file (nofile.ext) --
-Warning: getimagesize(%snofile.ext): failed to open stream: No such file or directory in %s on line %d
+Warning: getimagesize(%snofile.ext): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-Warning: getimagesize(%snofile.ext): failed to open stream: No such file or directory in %s on line %d
+Warning: getimagesize(%snofile.ext): Failed to open stream: No such file or directory in %s on line %d
bool(false)
array(0) {
}
-- Empty File (blank_file.bmp) --
-Notice: getimagesize(): Read error! in %s on line %d
+Notice: getimagesize(): Error reading from %s! in %s on line %d
bool(false)
-Notice: getimagesize(): Read error! in %s on line %d
+Notice: getimagesize(): Error reading from %s! in %s on line %d
bool(false)
array(0) {
}
-===DONE===
diff --git a/ext/standard/tests/image/getimagesize_variation4.phpt b/ext/standard/tests/image/getimagesize_variation4.phpt
index 526e35c305..d2e2c84554 100644
--- a/ext/standard/tests/image/getimagesize_variation4.phpt
+++ b/ext/standard/tests/image/getimagesize_variation4.phpt
@@ -18,7 +18,6 @@ echo "*** Testing getimagesize() : variation ***\n";
var_dump( getimagesize(__DIR__."/test13pix.swf", $info) );
var_dump( $info );
?>
-===DONE===
--EXPECT--
*** Testing getimagesize() : variation ***
array(5) {
@@ -35,4 +34,3 @@ array(5) {
}
array(0) {
}
-===DONE===
diff --git a/ext/standard/tests/image/getimagesize_variation_005.phpt b/ext/standard/tests/image/getimagesize_variation_005.phpt
index 79d2de03e9..93a8648c11 100644
--- a/ext/standard/tests/image/getimagesize_variation_005.phpt
+++ b/ext/standard/tests/image/getimagesize_variation_005.phpt
@@ -18,7 +18,6 @@ echo "*** Testing getimagesize() : basic functionality ***\n";
var_dump( getimagesize(__DIR__."/test13pix.swf", $info) );
var_dump( $info );
?>
-===DONE===
--EXPECT--
*** Testing getimagesize() : basic functionality ***
array(5) {
@@ -35,4 +34,3 @@ array(5) {
}
array(0) {
}
-===DONE===
diff --git a/ext/standard/tests/image/getimagesize_wbmp.phpt b/ext/standard/tests/image/getimagesize_wbmp.phpt
index 268a7b7b08..d0b0852a26 100644
--- a/ext/standard/tests/image/getimagesize_wbmp.phpt
+++ b/ext/standard/tests/image/getimagesize_wbmp.phpt
@@ -13,7 +13,6 @@ var_dump(getimagesize(__DIR__ . "/75x50.wbmp", $arr));
var_dump($arr);
?>
-===DONE===
--EXPECT--
*** Testing getimagesize() : wbmp format ***
array(5) {
@@ -30,4 +29,3 @@ array(5) {
}
array(0) {
}
-===DONE===
diff --git a/ext/standard/tests/image/getimagesize_xbm.phpt b/ext/standard/tests/image/getimagesize_xbm.phpt
index 6520cdb46e..bf8bdf924d 100644
--- a/ext/standard/tests/image/getimagesize_xbm.phpt
+++ b/ext/standard/tests/image/getimagesize_xbm.phpt
@@ -13,7 +13,6 @@ var_dump(getimagesize(__DIR__ . "/75x50.xbm", $arr));
var_dump($arr);
?>
-===DONE===
--EXPECT--
*** Testing getimagesize() : xbm format ***
array(5) {
@@ -30,4 +29,3 @@ array(5) {
}
array(0) {
}
-===DONE===
diff --git a/ext/standard/tests/image/image_type_to_extension.phpt b/ext/standard/tests/image/image_type_to_extension.phpt
index 8418a4b8c7..249df57943 100644
--- a/ext/standard/tests/image/image_type_to_extension.phpt
+++ b/ext/standard/tests/image/image_type_to_extension.phpt
@@ -29,12 +29,8 @@ image_type_to_extension()
printf("Constant: %s\n\tWith dot: %s\n\tWithout dot: %s\n", $name, image_type_to_extension($constant), image_type_to_extension($constant, false));
}
- var_dump(image_type_to_extension(-1, array()));
- var_dump(image_type_to_extension(new stdclass));
var_dump(image_type_to_extension(1000000, NULL));
- var_dump(image_type_to_extension());
var_dump(image_type_to_extension(0));
- var_dump(image_type_to_extension(0, 0, 0));
?>
Done
--EXPECTF--
@@ -89,18 +85,6 @@ Constant: IMAGETYPE_XBM
Constant: IMAGETYPE_WEBP
With dot: .webp
Without dot: webp
-
-Warning: image_type_to_extension() expects parameter 2 to be bool, array given in %s on line %d
-bool(false)
-
-Warning: image_type_to_extension() expects parameter 1 to be int, object given in %s on line %d
-bool(false)
bool(false)
-
-Warning: image_type_to_extension() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
-bool(false)
-
-Warning: image_type_to_extension() expects at most 2 parameters, 3 given in %s on line %d
bool(false)
Done
diff --git a/ext/standard/tests/image/image_type_to_mime_type.phpt b/ext/standard/tests/image/image_type_to_mime_type.phpt
index b1781aac2b..aff49ae58f 100644
--- a/ext/standard/tests/image/image_type_to_mime_type.phpt
+++ b/ext/standard/tests/image/image_type_to_mime_type.phpt
@@ -6,22 +6,22 @@ image_type_to_mime_type()
?>
--FILE--
<?php
- // Note: SWC requires zlib
- $dir = opendir(__DIR__) or die('cannot open directory: '.__DIR__);
- $result = array();
- $files = array();
- while (($file = readdir($dir)) !== FALSE) {
- if (preg_match('/^test.+pix\./',$file) && $file != "test13pix.swf") {
- $files[] = $file;
- }
- }
- closedir($dir);
- sort($files);
- foreach($files as $file) {
- $result[$file] = getimagesize(__DIR__."/$file");
- $result[$file] = image_type_to_mime_type($result[$file][2]);
- }
- var_dump($result);
+ // Note: SWC requires zlib
+ $dir = opendir(__DIR__) or die('cannot open directory: '.__DIR__);
+ $result = array();
+ $files = array();
+ while (($file = readdir($dir)) !== FALSE) {
+ if (preg_match('/^test.+pix\./',$file) && $file != "test13pix.swf") {
+ $files[] = $file;
+ }
+ }
+ closedir($dir);
+ sort($files);
+ foreach($files as $file) {
+ $result[$file] = getimagesize(__DIR__."/$file");
+ $result[$file] = image_type_to_mime_type($result[$file][2]);
+ }
+ var_dump($result);
?>
--EXPECT--
array(16) {
diff --git a/ext/standard/tests/image/image_type_to_mime_type_basic.phpt b/ext/standard/tests/image/image_type_to_mime_type_basic.phpt
index 40b5a07725..684056459e 100644
--- a/ext/standard/tests/image/image_type_to_mime_type_basic.phpt
+++ b/ext/standard/tests/image/image_type_to_mime_type_basic.phpt
@@ -12,28 +12,28 @@ image_type_to_mime_type()
echo "Starting image_type_to_mime_type() test\n\n";
$image_types = array (
- IMAGETYPE_GIF,
- IMAGETYPE_JPEG,
- IMAGETYPE_PNG,
- IMAGETYPE_SWF,
- IMAGETYPE_PSD,
- IMAGETYPE_BMP,
- IMAGETYPE_TIFF_II,
- IMAGETYPE_TIFF_MM,
- IMAGETYPE_JPC,
- IMAGETYPE_JP2,
- IMAGETYPE_JPX,
- IMAGETYPE_JB2,
- IMAGETYPE_IFF,
- IMAGETYPE_WBMP,
- IMAGETYPE_JPEG2000,
- IMAGETYPE_XBM,
- IMAGETYPE_WEBP
+ IMAGETYPE_GIF,
+ IMAGETYPE_JPEG,
+ IMAGETYPE_PNG,
+ IMAGETYPE_SWF,
+ IMAGETYPE_PSD,
+ IMAGETYPE_BMP,
+ IMAGETYPE_TIFF_II,
+ IMAGETYPE_TIFF_MM,
+ IMAGETYPE_JPC,
+ IMAGETYPE_JP2,
+ IMAGETYPE_JPX,
+ IMAGETYPE_JB2,
+ IMAGETYPE_IFF,
+ IMAGETYPE_WBMP,
+ IMAGETYPE_JPEG2000,
+ IMAGETYPE_XBM,
+ IMAGETYPE_WEBP
);
- foreach($image_types as $image_type) {
- var_dump(image_type_to_mime_type($image_type));
- }
+ foreach($image_types as $image_type) {
+ var_dump(image_type_to_mime_type($image_type));
+ }
echo "\nDone image_type_to_mime_type() test\n";
?>
diff --git a/ext/standard/tests/image/image_type_to_mime_type_variation2.phpt b/ext/standard/tests/image/image_type_to_mime_type_variation2.phpt
index 6043c81180..5123f373a7 100644
--- a/ext/standard/tests/image/image_type_to_mime_type_variation2.phpt
+++ b/ext/standard/tests/image/image_type_to_mime_type_variation2.phpt
@@ -38,7 +38,6 @@ foreach($values as $value) {
$iterator++;
};
?>
-===DONE===
--EXPECT--
*** Testing image_type_to_mime_type() : usage variations ***
@@ -77,4 +76,3 @@ string(24) "application/octet-stream"
-- Iteration 12 --
string(24) "application/octet-stream"
-===DONE===
diff --git a/ext/standard/tests/image/image_type_to_mime_type_variation3.phpt b/ext/standard/tests/image/image_type_to_mime_type_variation3.phpt
index d8366c15e3..ac77faad33 100644
--- a/ext/standard/tests/image/image_type_to_mime_type_variation3.phpt
+++ b/ext/standard/tests/image/image_type_to_mime_type_variation3.phpt
@@ -16,7 +16,6 @@ for($imagetype = 0; $imagetype <= IMAGETYPE_COUNT; ++$imagetype) {
var_dump(image_type_to_mime_type($imagetype));
}
?>
-===DONE===
--EXPECTREGEX--
\*\*\* Testing image_type_to_mime_type\(\) : usage variations \*\*\*
@@ -79,4 +78,3 @@ string\(10\) "image\/webp"
-- Iteration 19 --
string\(24\) "application\/octet-stream"
-===DONE===
diff --git a/ext/standard/tests/image/image_type_to_mime_type_variation4.phpt b/ext/standard/tests/image/image_type_to_mime_type_variation4.phpt
index 8ec2e37ae1..baaca4650a 100644
--- a/ext/standard/tests/image/image_type_to_mime_type_variation4.phpt
+++ b/ext/standard/tests/image/image_type_to_mime_type_variation4.phpt
@@ -21,9 +21,7 @@ error_reporting(E_ALL ^ E_NOTICE);
var_dump( image_type_to_mime_type(IMAGETYPE_ICO) );
var_dump( image_type_to_mime_type(IMAGETYPE_SWC) );
?>
-===DONE===
--EXPECT--
*** Testing image_type_to_mime_type() : usage variations ***
string(24) "image/vnd.microsoft.icon"
string(29) "application/x-shockwave-flash"
-===DONE===
diff --git a/ext/standard/tests/image/iptcembed_002.phpt b/ext/standard/tests/image/iptcembed_002.phpt
index ad0446cf62..e0db48bcd5 100644
--- a/ext/standard/tests/image/iptcembed_002.phpt
+++ b/ext/standard/tests/image/iptcembed_002.phpt
@@ -39,7 +39,7 @@ $base64_1x1_jpeg="/9j/4AAQSkZJRgABAQEAYABgAAD//gA8Q1JFQVRPUjogZ2QtanBlZyB2MS4wIC
#write file
$fd=fopen($file,"wb");
if ($fd) { fputs($fd,base64_decode($base64_1x1_jpeg)); fclose($fd); }
-else { echo "error cant write $file".PHP_EOL;exit(1); }
+else { echo "error can't write $file".PHP_EOL;exit(1); }
#check file md5
$md5=md5_file($file);
if ($md5!="07dd8594450e8c18ab8a79d7cb4573c7") { echo "md5 error".PHP_EOL;exit(1); }
@@ -70,7 +70,7 @@ $content = iptcembed($iptc, $file,0);
if ($content === false) {echo "iptcembed error".PHP_EOL;exit(1); }
$fd=fopen($file2,"wb");
if ($fd) { fputs($fd,$content); fclose($fd); }
-else { echo "error cant write $file2".PHP_EOL;exit(1); }
+else { echo "error can't write $file2".PHP_EOL;exit(1); }
#check jpeg properties for new image with iptc tags
diff --git a/ext/standard/tests/mail/bug51604.phpt b/ext/standard/tests/mail/bug51604.phpt
index 988849c4e1..76890ddeab 100644
--- a/ext/standard/tests/mail/bug51604.phpt
+++ b/ext/standard/tests/mail/bug51604.phpt
@@ -1,13 +1,8 @@
--TEST--
Bug #51604 (newline in end of header is shown in start of message)
--INI--
-sendmail_path=tee mail_bug51604.out >/dev/null
+sendmail_path={MAIL:mail_bug51604.out}
mail.add_x_header = Off
---SKIPIF--
-<?php
-if(substr(PHP_OS, 0, 3) == "WIN")
- die("skip Won't run on Windows");
-?>
--FILE--
<?php
// Initialise all required variables
@@ -24,7 +19,6 @@ echo file_get_contents($outFile);
unlink($outFile);
?>
-===DONE===
--EXPECT--
bool(true)
To: user@example.com
@@ -32,4 +26,3 @@ Subject: Test Subject
KHeaders
A Message
-===DONE===
diff --git a/ext/standard/tests/mail/bug66535.phpt b/ext/standard/tests/mail/bug66535.phpt
index 09dad37ad6..db947e1172 100644
--- a/ext/standard/tests/mail/bug66535.phpt
+++ b/ext/standard/tests/mail/bug66535.phpt
@@ -1,13 +1,8 @@
--TEST--
Bug #66535: Extra newline if add_x_header and no additional headers are used
--INI--
-sendmail_path=tee mailBug66535.out >/dev/null
+sendmail_path={MAIL:mailBug66535.out}
mail.add_x_header = On
---SKIPIF--
-<?php
-if(substr(PHP_OS, 0, 3) == "WIN")
- die("skip Won't run on Windows");
-?>
--FILE--
<?php
/* Prototype : int mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]])
@@ -31,7 +26,6 @@ echo file_get_contents($outFile);
unlink($outFile);
?>
-===DONE===
--EXPECTF--
*** Testing mail() : send email without additional headers ***
bool(true)
@@ -40,4 +34,3 @@ Subject: Test Subject
X-PHP-Originating-Script: %d:bug66535.php
A Message
-===DONE===
diff --git a/ext/standard/tests/mail/bug69115.phpt b/ext/standard/tests/mail/bug69115.phpt
index 98ece49769..dd128a9dc7 100644
--- a/ext/standard/tests/mail/bug69115.phpt
+++ b/ext/standard/tests/mail/bug69115.phpt
@@ -11,7 +11,5 @@ smtp_port =
$message = "Line 1\r\nLine 2\r\nLine 3";
mail('user@example.com', 'My Subject', $message, "From: me@me.me");
?>
-===DONE===
--EXPECTREGEX--
.*
-===DONE===
diff --git a/ext/standard/tests/mail/bug69874.phpt b/ext/standard/tests/mail/bug69874.phpt
index 45cfd0d32f..89c966d085 100644
--- a/ext/standard/tests/mail/bug69874.phpt
+++ b/ext/standard/tests/mail/bug69874.phpt
@@ -1,13 +1,8 @@
--TEST--
Bug #69874: Null addtional_headers does not send mail
--INI--
-sendmail_path=tee mailBug69874.out >/dev/null
+sendmail_path={MAIL:mailBug69874.out}
mail.add_x_header = Off
---SKIPIF--
-<?php
-if(substr(PHP_OS, 0, 3) == "WIN")
- die("skip Won't run on Windows");
-?>
--FILE--
<?php
/* Prototype : int mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]])
@@ -31,7 +26,6 @@ echo file_get_contents($outFile);
unlink($outFile);
?>
-===DONE===
--EXPECT--
*** Testing mail() : send email without additional headers ***
bool(true)
@@ -39,4 +33,3 @@ To: user@company.com
Subject: Test Subject
A Message
-===DONE===
diff --git a/ext/standard/tests/mail/bug69874_2.phpt b/ext/standard/tests/mail/bug69874_2.phpt
index e35d1c367e..9c603a13ea 100644
--- a/ext/standard/tests/mail/bug69874_2.phpt
+++ b/ext/standard/tests/mail/bug69874_2.phpt
@@ -1,13 +1,8 @@
--TEST--
Bug #69874: Null addtional_headers does not send mail
--INI--
-sendmail_path=tee mailBug69874_2.out >/dev/null
+sendmail_path={MAIL:mailBug69874_2.out}
mail.add_x_header = On
---SKIPIF--
-<?php
-if(substr(PHP_OS, 0, 3) == "WIN")
- die("skip Won't run on Windows");
-?>
--FILE--
<?php
/* Prototype : int mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]])
@@ -31,7 +26,6 @@ echo file_get_contents($outFile);
unlink($outFile);
?>
-===DONE===
--EXPECTF--
*** Testing mail() : send email without additional headers ***
bool(true)
@@ -40,4 +34,3 @@ Subject: Test Subject
X-PHP-Originating-Script: %d:bug69874_2.php
A Message
-===DONE===
diff --git a/ext/standard/tests/mail/bug73203.phpt b/ext/standard/tests/mail/bug73203.phpt
index c3f22d36d5..64b299a594 100644
--- a/ext/standard/tests/mail/bug73203.phpt
+++ b/ext/standard/tests/mail/bug73203.phpt
@@ -6,19 +6,17 @@ only function besides mb_send_mail() which allows to call php_escape_shell_cmd()
with an empty string. Therefore we don't check the resulting email, but only
verify that the call succeeds.
--INI--
-sendmail_path=cat >/dev/null
+sendmail_path={MAIL:bug73203.eml}
mail.add_x_header = Off
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) === 'WIN') die('skip won\'t run on Windows');
-?>
--FILE--
<?php
var_dump(
mail('test@example.com', 'subject', 'message', 'From: lala@example.com', '')
);
?>
-===DONE===
--EXPECT--
bool(true)
-===DONE===
+--CLEAN--
+<?php
+unlink('bug73203.eml');
+?>
diff --git a/ext/standard/tests/mail/ezmlm_hash_basic.phpt b/ext/standard/tests/mail/ezmlm_hash_basic.phpt
deleted file mode 100644
index aa1f4c63c9..0000000000
--- a/ext/standard/tests/mail/ezmlm_hash_basic.phpt
+++ /dev/null
@@ -1,25 +0,0 @@
---TEST--
-Test ezmlm_hash() function : basic functionality
---FILE--
-<?php
-/* Prototype : int ezmlm_hash ( string $addr )
- * Description: Calculate the hash value needed by EZMLM.
- * Source code: ext/standard/mail.c
- */
-
-echo "*** Testing ezmlm_hash() : basic functionality ***\n";
-
-var_dump(ezmlm_hash("webmaster@somewhere.com"));
-var_dump(ezmlm_hash("foo@somewhere.com"));
-
-?>
-===Done===
---EXPECTF--
-*** Testing ezmlm_hash() : basic functionality ***
-
-Deprecated: Function ezmlm_hash() is deprecated in %s on line %d
-int(1)
-
-Deprecated: Function ezmlm_hash() is deprecated in %s on line %d
-int(7)
-===Done===
diff --git a/ext/standard/tests/mail/mail_basic.phpt b/ext/standard/tests/mail/mail_basic.phpt
index ddc5571c7e..fb8cb58e84 100644
--- a/ext/standard/tests/mail/mail_basic.phpt
+++ b/ext/standard/tests/mail/mail_basic.phpt
@@ -1,13 +1,8 @@
--TEST--
Test mail() function : basic functionality
--INI--
-sendmail_path=tee mailBasic.out >/dev/null
+sendmail_path={MAIL:mailBasic.out}
mail.add_x_header = Off
---SKIPIF--
-<?php
-if(substr(PHP_OS, 0, 3) == "WIN")
- die("skip Won't run on Windows");
-?>
--FILE--
<?php
/* Prototype : int mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]])
@@ -40,7 +35,6 @@ echo file_get_contents($outFile);
unlink($outFile);
?>
-===DONE===
--EXPECT--
*** Testing mail() : basic functionality ***
-- All Mail Content Parameters --
@@ -57,4 +51,3 @@ To: user@example.com
Subject: Test Subject
A Message
-===DONE===
diff --git a/ext/standard/tests/mail/mail_basic2.phpt b/ext/standard/tests/mail/mail_basic2.phpt
index aa1e0b1ecd..bee44f9f6b 100644
--- a/ext/standard/tests/mail/mail_basic2.phpt
+++ b/ext/standard/tests/mail/mail_basic2.phpt
@@ -35,7 +35,6 @@ var_dump( mail($to, $subject, $message, $additional_headers, $additional_paramet
echo file_get_contents($outFile);
unlink($outFile);
?>
-===DONE===
--EXPECTF--
*** Testing mail() : basic functionality ***
-- extra parameters --
@@ -45,4 +44,3 @@ bool(true)
%w3%wKHeaders
%w4%w
%w5%wA Message
-===DONE===
diff --git a/ext/standard/tests/mail/mail_basic3.phpt b/ext/standard/tests/mail/mail_basic3.phpt
deleted file mode 100644
index 3bab805649..0000000000
--- a/ext/standard/tests/mail/mail_basic3.phpt
+++ /dev/null
@@ -1,35 +0,0 @@
---TEST--
-Test mail() function : basic functionality
---INI--
-sendmail_path="exit 1"
---SKIPIF--
-<?php
-if(substr(PHP_OS, 0, 3) == "WIN")
- die("skip Won't run on Windows");
-?>
---FILE--
-<?php
-/* Prototype : int mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]])
- * Description: Send an email message
- * Source code: ext/standard/mail.c
- * Alias to functions:
- */
-
-echo "*** Testing mail() : basic functionality ***\n";
-
-
-// Initialise all required variables
-$to = 'user@example.com';
-$subject = 'Test Subject';
-$message = 'A Message';
-
-
-echo "-- failure --\n";
-var_dump( mail($to, $subject, $message) );
-?>
-===DONE===
---EXPECT--
-*** Testing mail() : basic functionality ***
--- failure --
-bool(false)
-===DONE===
diff --git a/ext/standard/tests/mail/mail_basic4.phpt b/ext/standard/tests/mail/mail_basic4.phpt
deleted file mode 100644
index c7f8ff9824..0000000000
--- a/ext/standard/tests/mail/mail_basic4.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Test mail() function : basic functionality
---INI--
-sendmail_path="exit 1"
---SKIPIF--
-<?php
-if(substr(PHP_OS, 0, 3) == "WIN")
- die("skip Won't run on Windows");
-?>
---FILE--
-<?php
-/* Prototype : int mail(string to, string subject, string message [, string additional_headers [, string additional_parameters]])
- * Description: Send an email message
- * Source code: ext/standard/mail.c
- * Alias to functions:
- */
-
-echo "*** Testing mail() : basic functionality ***\n";
-
-
-// Initialise all required variables
-$to = 'user@example.com';
-$subject = 'Test Subject';
-$message = 'A Message';
-
-
-echo "-- failure --\n";
-
-var_dump( mail($to, $subject, $message) );
-?>
-===DONE===
---EXPECT--
-*** Testing mail() : basic functionality ***
--- failure --
-bool(false)
-===DONE===
diff --git a/ext/standard/tests/mail/mail_basic5.phpt b/ext/standard/tests/mail/mail_basic5.phpt
index c6cc005dd5..37e0d5ba3d 100644
--- a/ext/standard/tests/mail/mail_basic5.phpt
+++ b/ext/standard/tests/mail/mail_basic5.phpt
@@ -26,9 +26,7 @@ $message = 'A Message';
echo "-- failure --\n";
var_dump( mail($to, $subject, $message) );
?>
-===DONE===
--EXPECT--
*** Testing mail() : basic functionality ***
-- failure --
bool(false)
-===DONE===
diff --git a/ext/standard/tests/mail/mail_basic6.phpt b/ext/standard/tests/mail/mail_basic6.phpt
index f9eab07e61..e7af072ff5 100644
--- a/ext/standard/tests/mail/mail_basic6.phpt
+++ b/ext/standard/tests/mail/mail_basic6.phpt
@@ -220,7 +220,6 @@ echo @file_get_contents($outFile);
@unlink($outFile);
?>
-===DONE===
--EXPECTF--
*** Testing mail() : basic functionality ***
-- Valid Header --
@@ -326,4 +325,3 @@ HEAD1: a
HEAD2: b
A Message
-===DONE===
diff --git a/ext/standard/tests/mail/mail_basic7.phpt b/ext/standard/tests/mail/mail_basic7.phpt
index 0b2cdc2c4f..9c9c61d835 100644
--- a/ext/standard/tests/mail/mail_basic7.phpt
+++ b/ext/standard/tests/mail/mail_basic7.phpt
@@ -1,13 +1,8 @@
--TEST--
Test mail() function : array extra header basic functionality
--INI--
-sendmail_path=tee mailBasic7.out >/dev/null
+sendmail_path={MAIL:mailBasic7.out}
mail.add_x_header = Off
---SKIPIF--
-<?php
-if(substr(PHP_OS, 0, 3) == "WIN")
- die("skip Won't run on Windows");
-?>
--FILE--
<?php
/* Prototype : int mail(string to, string subject, string message [, mixed additional_headers [, string additional_parameters]])
@@ -27,13 +22,13 @@ $to = 'user@example.com';
$subject = 'Test Subject';
$message = 'A Message';
$additional_headers = array(
- 'KHeaders' => 'aaaa',
- 'bcc'=>'foo@bar',
- 'foo'=>
- array(
- "bar\r\n hoge",
- "bar\r\n\t fuga",
- ),
+ 'KHeaders' => 'aaaa',
+ 'bcc'=>'foo@bar',
+ 'foo'=>
+ array(
+ "bar\r\n hoge",
+ "bar\r\n\t fuga",
+ ),
);
$outFile = "mailBasic7.out";
@unlink($outFile);
@@ -53,14 +48,14 @@ $subject = 'Test Subject';
$message = 'A Message';
// Headers should not have array values
$additional_headers = array(
- 'orig-date' => array('foo1'),
- 'from' => array('foo2'),
- 'sender' => array('foo3'),
- 'reply-to' => array('foo4'),
- 'to' => array('foo5'),
- 'bcc' => array('foo6'),
- 'message-id' => array('foo7'),
- 'in-reply-to'=> array('foo8'),
+ 'orig-date' => array('foo1'),
+ 'from' => array('foo2'),
+ 'sender' => array('foo3'),
+ 'reply-to' => array('foo4'),
+ 'to' => array('foo5'),
+ 'bcc' => array('foo6'),
+ 'message-id' => array('foo7'),
+ 'in-reply-to'=> array('foo8'),
);
$outFile = "mailBasic7.out";
@unlink($outFile);
@@ -79,13 +74,13 @@ $to = 'user@example.com';
$subject = 'Test Subject';
$message = 'A Message';
$additional_headers = array(
- 'foo1' => array('foo1'=>'bar1'),
- 'foo2' => array('foo2', array('foo3')),
- 'foo3' => array(123),
- 'foo4' => array(123.456),
- 'foo5' => array(FALSE),
- 'foo6' => array(NULL),
- 'foo7' => array(new StdClass),
+ 'foo1' => array('foo1'=>'bar1'),
+ 'foo2' => array('foo2', array('foo3')),
+ 'foo3' => array(123),
+ 'foo4' => array(123.456),
+ 'foo5' => array(FALSE),
+ 'foo6' => array(NULL),
+ 'foo7' => array(new StdClass),
);
$outFile = "mailBasic7.out";
@unlink($outFile);
@@ -104,16 +99,16 @@ $to = 'user@example.com';
$subject = 'Test Subject';
$message = 'A Message';
$additional_headers = array(
- '*:foo1' => array('bar1'),
- 'foo2:::' => array('bar1'),
- 'foo3()' => array('bar1'),
- 'foo4@' => array('bar1'),
- 'foo5|' => array('bar1'),
- "\0foo6" => array('bar1'),
- "foo7\0" => array('bar1'),
- "foo8" => array(),
- "foo9" => '%&$#!',
- "foo10" => "abc\0\tdef",
+ '*:foo1' => array('bar1'),
+ 'foo2:::' => array('bar1'),
+ 'foo3()' => array('bar1'),
+ 'foo4@' => array('bar1'),
+ 'foo5|' => array('bar1'),
+ "\0foo6" => array('bar1'),
+ "foo7\0" => array('bar1'),
+ "foo8" => array(),
+ "foo9" => '%&$#!',
+ "foo10" => "abc\0\tdef",
);
$outFile = "mailBasic7.out";
@unlink($outFile);
@@ -125,7 +120,6 @@ echo file_get_contents($outFile);
unlink($outFile);
?>
-===DONE===
--EXPECTF--
*** Testing mail() : basic functionality ***
@@ -215,4 +209,3 @@ foo5|: bar1
foo9: %&$#!
A Message
-===DONE===
diff --git a/ext/standard/tests/mail/mail_basic_alt1-win32.phpt b/ext/standard/tests/mail/mail_basic_alt1-win32.phpt
index 9f06e09854..5952a14f59 100644
--- a/ext/standard/tests/mail/mail_basic_alt1-win32.phpt
+++ b/ext/standard/tests/mail/mail_basic_alt1-win32.phpt
@@ -38,57 +38,55 @@ HERE;
$res = mail($to, $subject, $message);
if ($res !== true) {
- exit("TEST FAILED : Unable to send test email\n");
+ exit("TEST FAILED : Unable to send test email\n");
} else {
- echo "Msg sent OK\n";
+ echo "Msg sent OK\n";
}
// Search for email message on the mail server using imap.
$imap_stream = imap_open($default_mailbox, $username, $password);
if ($imap_stream === false) {
- echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n";
- return false;
+ echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n";
+ return false;
}
$found = false;
$repeat_count = 20; // we will repeat a max of 20 times
while (!$found && $repeat_count > 0) {
- // sleep for a while to allow msg to be delivered
- sleep(1);
+ // sleep for a while to allow msg to be delivered
+ sleep(1);
- $current_msg_count = imap_check($imap_stream)->Nmsgs;
+ $current_msg_count = imap_check($imap_stream)->Nmsgs;
- // Iterate over recent msgs to find the one we sent above
- for ($i = 1; $i <= $current_msg_count; $i++) {
- // get hdr details
- $hdr = imap_headerinfo($imap_stream, $i);
+ // Iterate over recent msgs to find the one we sent above
+ for ($i = 1; $i <= $current_msg_count; $i++) {
+ // get hdr details
+ $hdr = imap_headerinfo($imap_stream, $i);
- if (substr($hdr->Subject, 0 , strlen($subject_prefix)) == $subject_prefix) {
- echo "Id of msg just sent is $i\n";
- echo ".. delete it\n";
- imap_delete($imap_stream, $i);
- $found = true;
- break;
- }
- }
+ if (substr($hdr->Subject, 0 , strlen($subject_prefix)) == $subject_prefix) {
+ echo "Id of msg just sent is $i\n";
+ echo ".. delete it\n";
+ imap_delete($imap_stream, $i);
+ $found = true;
+ break;
+ }
+ }
- $repeat_count -= 1;
+ $repeat_count -= 1;
}
if (!$found) {
- echo "TEST FAILED: email not delivered\n";
+ echo "TEST FAILED: email not delivered\n";
} else {
- echo "TEST PASSED: Msgs sent and deleted OK\n";
+ echo "TEST PASSED: Msgs sent and deleted OK\n";
}
imap_close($imap_stream, CL_EXPUNGE);
?>
-===Done===
--EXPECTF--
*** Testing mail() : basic functionality ***
Msg sent OK
Id of msg just sent is %d
.. delete it
TEST PASSED: Msgs sent and deleted OK
-===Done===
diff --git a/ext/standard/tests/mail/mail_basic_alt2-win32.phpt b/ext/standard/tests/mail/mail_basic_alt2-win32.phpt
index 498554f947..8c7a28983c 100644
--- a/ext/standard/tests/mail/mail_basic_alt2-win32.phpt
+++ b/ext/standard/tests/mail/mail_basic_alt2-win32.phpt
@@ -35,57 +35,55 @@ $extra_headers = "from: user@example.com";
$res = mail($to, $subject, $message, $extra_headers);
if ($res !== true) {
- exit("TEST FAILED : Unable to send test email\n");
+ exit("TEST FAILED : Unable to send test email\n");
} else {
- echo "Msg sent OK\n";
+ echo "Msg sent OK\n";
}
// Search for email message on the mail server using imap.
$imap_stream = imap_open($default_mailbox, $username, $password);
if ($imap_stream === false) {
- echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n";
- return false;
+ echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n";
+ return false;
}
$found = false;
$repeat_count = 20; // we will repeat a max of 20 times
while (!$found && $repeat_count > 0) {
- // sleep for a while to allow msg to be delivered
- sleep(1);
+ // sleep for a while to allow msg to be delivered
+ sleep(1);
- $current_msg_count = imap_check($imap_stream)->Nmsgs;
+ $current_msg_count = imap_check($imap_stream)->Nmsgs;
- // Iterate over recent msgs to find the one we sent above
- for ($i = 1; $i <= $current_msg_count; $i++) {
- // get hdr details
- $hdr = imap_headerinfo($imap_stream, $i);
+ // Iterate over recent msgs to find the one we sent above
+ for ($i = 1; $i <= $current_msg_count; $i++) {
+ // get hdr details
+ $hdr = imap_headerinfo($imap_stream, $i);
- if (substr($hdr->Subject, 0 , strlen($subject_prefix)) == $subject_prefix) {
- echo "Id of msg just sent is $i\n";
- echo ".. delete it\n";
- imap_delete($imap_stream, $i);
- $found = true;
- break;
- }
- }
+ if (substr($hdr->Subject, 0 , strlen($subject_prefix)) == $subject_prefix) {
+ echo "Id of msg just sent is $i\n";
+ echo ".. delete it\n";
+ imap_delete($imap_stream, $i);
+ $found = true;
+ break;
+ }
+ }
- $repeat_count -= 1;
+ $repeat_count -= 1;
}
if (!$found) {
- echo "TEST FAILED: email not delivered\n";
+ echo "TEST FAILED: email not delivered\n";
} else {
- echo "TEST PASSED: Msgs sent and deleted OK\n";
+ echo "TEST PASSED: Msgs sent and deleted OK\n";
}
imap_close($imap_stream, CL_EXPUNGE);
?>
-===Done===
--EXPECTF--
*** Testing mail() : basic functionality ***
Msg sent OK
Id of msg just sent is %d
.. delete it
TEST PASSED: Msgs sent and deleted OK
-===Done===
diff --git a/ext/standard/tests/mail/mail_basic_alt3-win32.phpt b/ext/standard/tests/mail/mail_basic_alt3-win32.phpt
index 172474b1d0..15fb701e28 100644
--- a/ext/standard/tests/mail/mail_basic_alt3-win32.phpt
+++ b/ext/standard/tests/mail/mail_basic_alt3-win32.phpt
@@ -35,57 +35,55 @@ $extra_headers = "FRom: user@example.com";
$res = mail($to, $subject, $message, $extra_headers);
if ($res !== true) {
- exit("TEST FAILED : Unable to send test email\n");
+ exit("TEST FAILED : Unable to send test email\n");
} else {
- echo "Msg sent OK\n";
+ echo "Msg sent OK\n";
}
// Search for email message on the mail server using imap.
$imap_stream = imap_open($default_mailbox, $username, $password);
if ($imap_stream === false) {
- echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n";
- return false;
+ echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n";
+ return false;
}
$found = false;
$repeat_count = 20; // we will repeat a max of 20 times
while (!$found && $repeat_count > 0) {
- // sleep for a while to allow msg to be delivered
- sleep(1);
+ // sleep for a while to allow msg to be delivered
+ sleep(1);
- $current_msg_count = imap_check($imap_stream)->Nmsgs;
+ $current_msg_count = imap_check($imap_stream)->Nmsgs;
- // Iterate over recent msgs to find the one we sent above
- for ($i = 1; $i <= $current_msg_count; $i++) {
- // get hdr details
- $hdr = imap_headerinfo($imap_stream, $i);
+ // Iterate over recent msgs to find the one we sent above
+ for ($i = 1; $i <= $current_msg_count; $i++) {
+ // get hdr details
+ $hdr = imap_headerinfo($imap_stream, $i);
- if (substr($hdr->Subject, 0 , strlen($subject_prefix)) == $subject_prefix) {
- echo "Id of msg just sent is $i\n";
- echo ".. delete it\n";
- imap_delete($imap_stream, $i);
- $found = true;
- break;
- }
- }
+ if (substr($hdr->Subject, 0 , strlen($subject_prefix)) == $subject_prefix) {
+ echo "Id of msg just sent is $i\n";
+ echo ".. delete it\n";
+ imap_delete($imap_stream, $i);
+ $found = true;
+ break;
+ }
+ }
- $repeat_count -= 1;
+ $repeat_count -= 1;
}
if (!$found) {
- echo "TEST FAILED: email not delivered\n";
+ echo "TEST FAILED: email not delivered\n";
} else {
- echo "TEST PASSED: Msgs sent and deleted OK\n";
+ echo "TEST PASSED: Msgs sent and deleted OK\n";
}
imap_close($imap_stream, CL_EXPUNGE);
?>
-===Done===
--EXPECTF--
*** Testing mail() : basic functionality ***
Msg sent OK
Id of msg just sent is %d
.. delete it
TEST PASSED: Msgs sent and deleted OK
-===Done===
diff --git a/ext/standard/tests/mail/mail_basic_alt4-win32.phpt b/ext/standard/tests/mail/mail_basic_alt4-win32.phpt
index 9e7cbc5802..96c6fb11f5 100644
--- a/ext/standard/tests/mail/mail_basic_alt4-win32.phpt
+++ b/ext/standard/tests/mail/mail_basic_alt4-win32.phpt
@@ -36,57 +36,55 @@ $extra_parameters = "addons"; // should be ignored
$res = mail($to, $subject, $message, $extra_headers, $extra_parameters);
if ($res !== true) {
- exit("TEST FAILED : Unable to send test email\n");
+ exit("TEST FAILED : Unable to send test email\n");
} else {
- echo "Msg sent OK\n";
+ echo "Msg sent OK\n";
}
// Search for email message on the mail server using imap.
$imap_stream = imap_open($default_mailbox, $username, $password);
if ($imap_stream === false) {
- echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n";
- return false;
+ echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n";
+ return false;
}
$found = false;
$repeat_count = 20; // we will repeat a max of 20 times
while (!$found && $repeat_count > 0) {
- // sleep for a while to allow msg to be delivered
- sleep(1);
+ // sleep for a while to allow msg to be delivered
+ sleep(1);
- $current_msg_count = imap_check($imap_stream)->Nmsgs;
+ $current_msg_count = imap_check($imap_stream)->Nmsgs;
- // Iterate over recent msgs to find the one we sent above
- for ($i = 1; $i <= $current_msg_count; $i++) {
- // get hdr details
- $hdr = imap_headerinfo($imap_stream, $i);
+ // Iterate over recent msgs to find the one we sent above
+ for ($i = 1; $i <= $current_msg_count; $i++) {
+ // get hdr details
+ $hdr = imap_headerinfo($imap_stream, $i);
- if (substr($hdr->Subject, 0 , strlen($subject_prefix)) == $subject_prefix) {
- echo "Id of msg just sent is $i\n";
- echo ".. delete it\n";
- imap_delete($imap_stream, $i);
- $found = true;
- break;
- }
- }
+ if (substr($hdr->Subject, 0 , strlen($subject_prefix)) == $subject_prefix) {
+ echo "Id of msg just sent is $i\n";
+ echo ".. delete it\n";
+ imap_delete($imap_stream, $i);
+ $found = true;
+ break;
+ }
+ }
- $repeat_count -= 1;
+ $repeat_count -= 1;
}
if (!$found) {
- echo "TEST FAILED: email not delivered\n";
+ echo "TEST FAILED: email not delivered\n";
} else {
- echo "TEST PASSED: Msgs sent and deleted OK\n";
+ echo "TEST PASSED: Msgs sent and deleted OK\n";
}
imap_close($imap_stream, CL_EXPUNGE);
?>
-===Done===
--EXPECTF--
*** Testing mail() : basic functionality ***
Msg sent OK
Id of msg just sent is %d
.. delete it
TEST PASSED: Msgs sent and deleted OK
-===Done===
diff --git a/ext/standard/tests/mail/mail_include.inc b/ext/standard/tests/mail/mail_include.inc
index 8d7a8a9a1c..c69d4a7182 100644
--- a/ext/standard/tests/mail/mail_include.inc
+++ b/ext/standard/tests/mail/mail_include.inc
@@ -18,32 +18,32 @@ $mailbox_prefix = "phpttest"; // name used for test mailbox
* @return IMAP stream to new mailbox on success; FALSE on failure
*/
function setup_test_mailbox($mailbox_suffix, $message_count, &$new_mailbox = null, $msg_type = "simple"){
- global $server, $default_mailbox, $username, $password;
+ global $server, $default_mailbox, $username, $password;
- // open a stream to default mailbox
- $imap_stream = imap_open($default_mailbox, $username, $password);
+ // open a stream to default mailbox
+ $imap_stream = imap_open($default_mailbox, $username, $password);
- if ($imap_stream === false) {
- echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n";
- return false;
- }
+ if ($imap_stream === false) {
+ echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n";
+ return false;
+ }
- echo "Create a temporary mailbox and add " . $message_count . " msgs\n";
- $new_mailbox = create_mailbox($imap_stream, $mailbox_suffix, $message_count, $msg_type);
- if ($new_mailbox === false) {
- echo "Cant create a temporary mailbox: " . imap_last_error(). "\n";
- return false;
- }
+ echo "Create a temporary mailbox and add " . $message_count . " msgs\n";
+ $new_mailbox = create_mailbox($imap_stream, $mailbox_suffix, $message_count, $msg_type);
+ if ($new_mailbox === false) {
+ echo "Can't create a temporary mailbox: " . imap_last_error(). "\n";
+ return false;
+ }
- echo ".. mailbox '$new_mailbox' created\n";
+ echo ".. mailbox '$new_mailbox' created\n";
- // reopen stream to new mailbox
- if (imap_reopen($imap_stream, $new_mailbox) === false) {
- echo "cant re-open '$new_mailbox' mailbox: " . imap_last_error() . "\n";
- return false;
- }
+ // reopen stream to new mailbox
+ if (imap_reopen($imap_stream, $new_mailbox) === false) {
+ echo "can't re-open '$new_mailbox' mailbox: " . imap_last_error() . "\n";
+ return false;
+ }
- return $imap_stream;
+ return $imap_stream;
}
/**
@@ -53,30 +53,30 @@ function setup_test_mailbox($mailbox_suffix, $message_count, &$new_mailbox = nul
* @param string $mailbox
*/
function create_mailbox($imap_stream, $mailbox_suffix, $message_count, $msg_type= "simple"){
- global $default_mailbox, $mailbox_prefix;
- $mailbox = $default_mailbox . "." . $mailbox_prefix . $mailbox_suffix;
-
- $mailboxes = imap_getmailboxes($imap_stream, $mailbox, '*');
-
- // check mailbox does not already exist
- if ($mailboxes) {
- foreach($mailboxes as $value) {
- if ($value->name == $mailbox) {
- exit ("TEST FAILED : Mailbox '$mailbox' already exists\n");
- }
- }
- }
-
- if (imap_createmailbox($imap_stream, $mailbox) === false) {
- return false;
- }
-
- // Add number of test msgs requested
- if ($message_count > 0) {
- populate_mailbox($imap_stream, $mailbox, $message_count, $msg_type);
- }
-
- return $mailbox;
+ global $default_mailbox, $mailbox_prefix;
+ $mailbox = $default_mailbox . "." . $mailbox_prefix . $mailbox_suffix;
+
+ $mailboxes = imap_getmailboxes($imap_stream, $mailbox, '*');
+
+ // check mailbox does not already exist
+ if ($mailboxes) {
+ foreach($mailboxes as $value) {
+ if ($value->name == $mailbox) {
+ exit ("TEST FAILED : Mailbox '$mailbox' already exists\n");
+ }
+ }
+ }
+
+ if (imap_createmailbox($imap_stream, $mailbox) === false) {
+ return false;
+ }
+
+ // Add number of test msgs requested
+ if ($message_count > 0) {
+ populate_mailbox($imap_stream, $mailbox, $message_count, $msg_type);
+ }
+
+ return $mailbox;
}
/**
@@ -87,48 +87,48 @@ function create_mailbox($imap_stream, $mailbox_suffix, $message_count, $msg_type
*/
function populate_mailbox($imap_stream, $mailbox, $message_count, $msg_type = "simple"){
- global $users, $domain;
-
- for($i = 1; $i <= $message_count; $i++) {
- if ($msg_type == "simple") {
- $msg = "From: foo@anywhere.com\r\n"
- . "To: $users[0]@$domain\r\n"
- . "Subject: test$i\r\n"
- . "\r\n"
- . "$i: this is a test message, please ignore\r\n";
- } else {
- $envelope["from"]= "foo@anywhere.com";
- $envelope["to"] = "$users[0]@$domain";
- $envelope["subject"] = "Test msg $i";
-
- $part1["type"] = TYPEMULTIPART;
- $part1["subtype"] = "mixed";
-
- $part2["type"] = TYPETEXT;
- $part2["subtype"] = "plain";
- $part2["description"] = "imap_mail_compose() function";
- $part2["contents.data"] = "message 1:xxxxxxxxxxxxxxxxxxxxxxxxxx";
-
- $part3["type"] = TYPETEXT;
- $part3["subtype"] = "plain";
- $part3["description"] = "Example";
- $part3["contents.data"] = "message 2:yyyyyyyyyyyyyyyyyyyyyyyyyy";
-
- $part4["type"] = TYPETEXT;
- $part4["subtype"] = "plain";
- $part4["description"] = "Return Values";
- $part4["contents.data"] = "message 3:zzzzzzzzzzzzzzzzzzzzzzzzzz";
-
- $body[1] = $part1;
- $body[2] = $part2;
- $body[3] = $part3;
- $body[4] = $part4;
-
- $msg = imap_mail_compose($envelope, $body);
- }
-
- imap_append($imap_stream, $mailbox, $msg);
- }
+ global $users, $domain;
+
+ for($i = 1; $i <= $message_count; $i++) {
+ if ($msg_type == "simple") {
+ $msg = "From: foo@anywhere.com\r\n"
+ . "To: $users[0]@$domain\r\n"
+ . "Subject: test$i\r\n"
+ . "\r\n"
+ . "$i: this is a test message, please ignore\r\n";
+ } else {
+ $envelope["from"]= "foo@anywhere.com";
+ $envelope["to"] = "$users[0]@$domain";
+ $envelope["subject"] = "Test msg $i";
+
+ $part1["type"] = TYPEMULTIPART;
+ $part1["subtype"] = "mixed";
+
+ $part2["type"] = TYPETEXT;
+ $part2["subtype"] = "plain";
+ $part2["description"] = "imap_mail_compose() function";
+ $part2["contents.data"] = "message 1:xxxxxxxxxxxxxxxxxxxxxxxxxx";
+
+ $part3["type"] = TYPETEXT;
+ $part3["subtype"] = "plain";
+ $part3["description"] = "Example";
+ $part3["contents.data"] = "message 2:yyyyyyyyyyyyyyyyyyyyyyyyyy";
+
+ $part4["type"] = TYPETEXT;
+ $part4["subtype"] = "plain";
+ $part4["description"] = "Return Values";
+ $part4["contents.data"] = "message 3:zzzzzzzzzzzzzzzzzzzzzzzzzz";
+
+ $body[1] = $part1;
+ $body[2] = $part2;
+ $body[3] = $part3;
+ $body[4] = $part4;
+
+ $msg = imap_mail_compose($envelope, $body);
+ }
+
+ imap_append($imap_stream, $mailbox, $msg);
+ }
}
/**
@@ -139,12 +139,12 @@ function populate_mailbox($imap_stream, $mailbox, $message_count, $msg_type = "s
*/
function get_mailbox_name($mailbox){
- if (preg_match('/\{.*?\}(.*)/', $mailbox, $match) != 1) {
- echo "Unrecpognized mailbox name\n";
- return false;
- }
+ if (preg_match('/\{.*?\}(.*)/', $mailbox, $match) != 1) {
+ echo "Unrecpognized mailbox name\n";
+ return false;
+ }
- return $match[1];
+ return $match[1];
}
?>
diff --git a/ext/standard/tests/mail/mail_log.phpt b/ext/standard/tests/mail/mail_log.phpt
index 8f385d490d..4f9e9423f4 100644
--- a/ext/standard/tests/mail/mail_log.phpt
+++ b/ext/standard/tests/mail/mail_log.phpt
@@ -1,20 +1,15 @@
--TEST--
Test mail() function : mail.log ini setting
--INI--
-sendmail_path=tee /tmp/mail.out >/dev/null
-mail.log = /tmp/mail.log
---SKIPIF--
-<?php
-if(substr(PHP_OS, 0, 3) == "WIN")
- die("skip Won't run on Windows");
-?>
+sendmail_path={MAIL:mail.out}
+mail.log = mail.log
--FILE--
<?php
date_default_timezone_set("UTC");
$logfile = ini_get("mail.log");
if (file_exists($logfile)) {
- unlink($logfile);
+ unlink($logfile);
}
touch($logfile);
clearstatcache();
@@ -37,8 +32,8 @@ echo file_get_contents($logfile);
Done
--CLEAN--
<?php
-unlink("/tmp/mail.log");
-unlink("/tmp/mail.out");
+unlink("mail.log");
+unlink("mail.out");
?>
--EXPECTF--
bool(true)
diff --git a/ext/standard/tests/mail/mail_skipif.inc b/ext/standard/tests/mail/mail_skipif.inc
index fedcfbbe4e..8f2468581d 100644
--- a/ext/standard/tests/mail/mail_skipif.inc
+++ b/ext/standard/tests/mail/mail_skipif.inc
@@ -2,13 +2,13 @@
extension_loaded('imap') or die('skip imap extension not available in this build');
if( substr(PHP_OS, 0, 3) == 'WIN' && extension_loaded('sockets')) {
- // be sure mail server is accessible... on PHP 5.3.13 release build, using test-pack PHP-5.3-r1af8b3f,
- // the code below didn't skip test even though there was no mail server
- // test then failed (no mail server to test against)
- $socket = socket_create(AF_INET, SOCK_RAW, 1);
- socket_set_option($socket, SOL_SOCKET, SO_RCVTIMEO, array('sec' => 10, 'usec' => 10));
- // imap uses tcp port 143
- socket_connect($socket, "localhost", 143) or die ("skip can't socket to mail server");
+ // be sure mail server is accessible... on PHP 5.3.13 release build, using test-pack PHP-5.3-r1af8b3f,
+ // the code below didn't skip test even though there was no mail server
+ // test then failed (no mail server to test against)
+ $socket = socket_create(AF_INET, SOCK_RAW, 1);
+ socket_set_option($socket, SOL_SOCKET, SO_RCVTIMEO, array('sec' => 10, 'usec' => 10));
+ // imap uses tcp port 143
+ socket_connect($socket, "localhost", 143) or die ("skip can't socket to mail server");
}
// Change these to make tests run successfully
@@ -20,7 +20,7 @@ $retries = 0; // don't retry connect on failure
$mbox = imap_open($mailbox, $username, $password, $options, $retries);
if (!$mbox) {
- die("skip could not connect to mailbox $mailbox");
+ die("skip could not connect to mailbox $mailbox");
}
imap_close($mbox);
?>
diff --git a/ext/standard/tests/mail/mail_variation1.phpt b/ext/standard/tests/mail/mail_variation1.phpt
index fd40f97b68..3e4d346b0b 100644
--- a/ext/standard/tests/mail/mail_variation1.phpt
+++ b/ext/standard/tests/mail/mail_variation1.phpt
@@ -23,8 +23,6 @@ $subject = 'Test Subject';
$message = 'A Message';
var_dump( mail($to, $subject, $message) );
?>
-===DONE===
--EXPECT--
*** Testing mail() : variation ***
bool(false)
-===DONE===
diff --git a/ext/standard/tests/mail/mail_variation2.phpt b/ext/standard/tests/mail/mail_variation2.phpt
index 7e78bcfade..9ab8071b4b 100644
--- a/ext/standard/tests/mail/mail_variation2.phpt
+++ b/ext/standard/tests/mail/mail_variation2.phpt
@@ -32,7 +32,6 @@ echo file_get_contents($outFile);
unlink($outFile);
?>
-===DONE===
--EXPECTF--
*** Testing mail() : basic functionality ***
bool(true)
@@ -40,4 +39,3 @@ bool(true)
%w2%wSubject: Test Subject
%w3%w
%w4%wA Message
-===DONE===
diff --git a/ext/standard/tests/mail/mail_variation_alt1-win32.phpt b/ext/standard/tests/mail/mail_variation_alt1-win32.phpt
index bd259667c2..155dc9815a 100644
--- a/ext/standard/tests/mail/mail_variation_alt1-win32.phpt
+++ b/ext/standard/tests/mail/mail_variation_alt1-win32.phpt
@@ -37,53 +37,53 @@ HERE;
$res = mail($to, $subject, $message);
if ($res !== true) {
- exit("TEST COMPLETED : Unable to send test email\n");
+ exit("TEST COMPLETED : Unable to send test email\n");
} else {
- echo "Msg sent OK\n";
+ echo "Msg sent OK\n";
}
// Search for email message on the mail server using imap.
$imap_stream = imap_open($default_mailbox, $username, $password);
if ($imap_stream === false) {
- echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n";
- return false;
+ echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n";
+ return false;
}
$found = false;
$repeat_count = 20; // we will repeat a max of 20 times
while (!$found && $repeat_count > 0) {
- // sleep for a while to allow msg to be delivered
- sleep(1);
+ // sleep for a while to allow msg to be delivered
+ sleep(1);
- $current_msg_count = imap_check($imap_stream)->Nmsgs;
+ $current_msg_count = imap_check($imap_stream)->Nmsgs;
- // Iterate over recent msgs to find the one we sent above
- for ($i = 1; $i <= $current_msg_count; $i++) {
- // get hdr details
- $hdr = imap_headerinfo($imap_stream, $i);
+ // Iterate over recent msgs to find the one we sent above
+ for ($i = 1; $i <= $current_msg_count; $i++) {
+ // get hdr details
+ $hdr = imap_headerinfo($imap_stream, $i);
- if (substr($hdr->Subject, 0 , strlen($subject_prefix)) == $subject_prefix) {
- echo "Id of msg just sent is $i\n";
- echo ".. delete it\n";
- imap_delete($imap_stream, $i);
- $found = true;
- break;
- }
- }
+ if (substr($hdr->Subject, 0 , strlen($subject_prefix)) == $subject_prefix) {
+ echo "Id of msg just sent is $i\n";
+ echo ".. delete it\n";
+ imap_delete($imap_stream, $i);
+ $found = true;
+ break;
+ }
+ }
- $repeat_count -= 1;
+ $repeat_count -= 1;
}
if (!$found) {
- echo "TEST FAILED: email not delivered\n";
+ echo "TEST FAILED: email not delivered\n";
} else {
- echo "TEST PASSED: Msgs sent and deleted OK\n";
+ echo "TEST PASSED: Msgs sent and deleted OK\n";
}
imap_close($imap_stream, CL_EXPUNGE);
?>
-===Done===
+===DONE===
--EXPECTF--
*** Testing mail() : basic functionality ***
diff --git a/ext/standard/tests/mail/mail_variation_alt2-win32.phpt b/ext/standard/tests/mail/mail_variation_alt2-win32.phpt
index c0698076e1..36d971329f 100644
--- a/ext/standard/tests/mail/mail_variation_alt2-win32.phpt
+++ b/ext/standard/tests/mail/mail_variation_alt2-win32.phpt
@@ -37,53 +37,53 @@ HERE;
$res = mail($to, $subject, $message);
if ($res !== true) {
- exit("TEST COMPLETED : Unable to send test email\n");
+ exit("TEST COMPLETED : Unable to send test email\n");
} else {
- echo "Msg sent OK\n";
+ echo "Msg sent OK\n";
}
// Search for email message on the mail server using imap.
$imap_stream = imap_open($default_mailbox, $username, $password);
if ($imap_stream === false) {
- echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n";
- return false;
+ echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n";
+ return false;
}
$found = false;
$repeat_count = 20; // we will repeat a max of 20 times
while (!$found && $repeat_count > 0) {
- // sleep for a while to allow msg to be delivered
- sleep(1);
+ // sleep for a while to allow msg to be delivered
+ sleep(1);
- $current_msg_count = imap_check($imap_stream)->Nmsgs;
+ $current_msg_count = imap_check($imap_stream)->Nmsgs;
- // Iterate over recent msgs to find the one we sent above
- for ($i = 1; $i <= $current_msg_count; $i++) {
- // get hdr details
- $hdr = imap_headerinfo($imap_stream, $i);
+ // Iterate over recent msgs to find the one we sent above
+ for ($i = 1; $i <= $current_msg_count; $i++) {
+ // get hdr details
+ $hdr = imap_headerinfo($imap_stream, $i);
- if (substr($hdr->Subject, 0 , strlen($subject_prefix)) == $subject_prefix) {
- echo "Id of msg just sent is $i\n";
- echo ".. delete it\n";
- imap_delete($imap_stream, $i);
- $found = true;
- break;
- }
- }
+ if (substr($hdr->Subject, 0 , strlen($subject_prefix)) == $subject_prefix) {
+ echo "Id of msg just sent is $i\n";
+ echo ".. delete it\n";
+ imap_delete($imap_stream, $i);
+ $found = true;
+ break;
+ }
+ }
- $repeat_count -= 1;
+ $repeat_count -= 1;
}
if (!$found) {
- echo "TEST FAILED: email not delivered\n";
+ echo "TEST FAILED: email not delivered\n";
} else {
- echo "TEST PASSED: Msgs sent and deleted OK\n";
+ echo "TEST PASSED: Msgs sent and deleted OK\n";
}
imap_close($imap_stream, CL_EXPUNGE);
?>
-===Done===
+===DONE===
--EXPECTF--
*** Testing mail() : basic functionality ***
diff --git a/ext/standard/tests/mail/mail_variation_alt3-win32.phpt b/ext/standard/tests/mail/mail_variation_alt3-win32.phpt
index fe961d3d16..96d5d796bb 100644
--- a/ext/standard/tests/mail/mail_variation_alt3-win32.phpt
+++ b/ext/standard/tests/mail/mail_variation_alt3-win32.phpt
@@ -36,53 +36,53 @@ HERE;
$res = mail($to, $subject, $message);
if ($res !== true) {
- exit("TEST COMPLETED : Unable to send test email\n");
+ exit("TEST COMPLETED : Unable to send test email\n");
} else {
- echo "Msg sent OK\n";
+ echo "Msg sent OK\n";
}
// Search for email message on the mail server using imap.
$imap_stream = imap_open($default_mailbox, $username, $password);
if ($imap_stream === false) {
- echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n";
- return false;
+ echo "Cannot connect to IMAP server $server: " . imap_last_error() . "\n";
+ return false;
}
$found = false;
$repeat_count = 20; // we will repeat a max of 20 times
while (!$found && $repeat_count > 0) {
- // sleep for a while to allow msg to be delivered
- sleep(1);
+ // sleep for a while to allow msg to be delivered
+ sleep(1);
- $current_msg_count = imap_check($imap_stream)->Nmsgs;
+ $current_msg_count = imap_check($imap_stream)->Nmsgs;
- // Iterate over recent msgs to find the one we sent above
- for ($i = 1; $i <= $current_msg_count; $i++) {
- // get hdr details
- $hdr = imap_headerinfo($imap_stream, $i);
+ // Iterate over recent msgs to find the one we sent above
+ for ($i = 1; $i <= $current_msg_count; $i++) {
+ // get hdr details
+ $hdr = imap_headerinfo($imap_stream, $i);
- if (substr($hdr->Subject, 0 , strlen($subject_prefix)) == $subject_prefix) {
- echo "Id of msg just sent is $i\n";
- echo ".. delete it\n";
- imap_delete($imap_stream, $i);
- $found = true;
- break;
- }
- }
+ if (substr($hdr->Subject, 0 , strlen($subject_prefix)) == $subject_prefix) {
+ echo "Id of msg just sent is $i\n";
+ echo ".. delete it\n";
+ imap_delete($imap_stream, $i);
+ $found = true;
+ break;
+ }
+ }
- $repeat_count -= 1;
+ $repeat_count -= 1;
}
if (!$found) {
- echo "TEST FAILED: email not delivered\n";
+ echo "TEST FAILED: email not delivered\n";
} else {
- echo "TEST PASSED: Msgs sent and deleted OK\n";
+ echo "TEST PASSED: Msgs sent and deleted OK\n";
}
imap_close($imap_stream, CL_EXPUNGE);
?>
-===Done===
+===DONE===
--EXPECTF--
*** Testing mail() : basic functionality ***
diff --git a/ext/standard/tests/math/abs.phpt b/ext/standard/tests/math/abs.phpt
index af8732811d..f1ff71b6f2 100644
--- a/ext/standard/tests/math/abs.phpt
+++ b/ext/standard/tests/math/abs.phpt
@@ -6,7 +6,7 @@ Simple math tests
define('LONG_MAX', is_int(5000000000)? 9223372036854775807 : 0x7FFFFFFF);
define('LONG_MIN', -LONG_MAX - 1);
printf("%d,%d,%d,%d\n",is_int(LONG_MIN ),is_int(LONG_MAX ),
- is_int(LONG_MIN-1),is_int(LONG_MAX+1));
+ is_int(LONG_MIN-1),is_int(LONG_MAX+1));
$tests = <<<TESTS
1 === abs(-1)
diff --git a/ext/standard/tests/math/abs_basic.phpt b/ext/standard/tests/math/abs_basic.phpt
index 5c3f8ff8ea..b7da2a49bd 100644
--- a/ext/standard/tests/math/abs_basic.phpt
+++ b/ext/standard/tests/math/abs_basic.phpt
@@ -12,26 +12,25 @@ precision = 14
echo "*** Testing abs() : basic functionality ***\n";
$values = array(23,
- -23,
- 2.345e1,
- -2.345e1,
- 0x17,
- 027,
- "23",
- "-23",
- "23.45",
- "2.345e1",
- "-2.345e1",
- null,
- true,
- false);
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "-23",
+ "23.45",
+ "2.345e1",
+ "-2.345e1",
+ null,
+ true,
+ false);
for ($i = 0; $i < count($values); $i++) {
- $res = abs($values[$i]);
- var_dump($res);
+ $res = abs($values[$i]);
+ var_dump($res);
}
?>
-===Done===
--EXPECT--
*** Testing abs() : basic functionality ***
int(23)
@@ -48,4 +47,3 @@ float(23.45)
int(0)
int(1)
int(0)
-===Done===
diff --git a/ext/standard/tests/math/abs_basiclong_64bit.phpt b/ext/standard/tests/math/abs_basiclong_64bit.phpt
index 0f0cb5d55c..f3e72b062a 100644
--- a/ext/standard/tests/math/abs_basiclong_64bit.phpt
+++ b/ext/standard/tests/math/abs_basiclong_64bit.phpt
@@ -25,7 +25,6 @@ foreach ($longVals as $longVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 ---
int(9223372036854775807)
@@ -57,4 +56,3 @@ float(9.2233720368548E+18)
int(9223372036854775807)
--- testing: -9.2233720368548E+18 ---
float(9.2233720368548E+18)
-===DONE===
diff --git a/ext/standard/tests/math/abs_variation.phpt b/ext/standard/tests/math/abs_variation.phpt
index fd671855e1..854cb71181 100644
--- a/ext/standard/tests/math/abs_variation.phpt
+++ b/ext/standard/tests/math/abs_variation.phpt
@@ -72,15 +72,18 @@ $inputs = array(
// loop through each element of $inputs to check the behavior of abs()
$iterator = 1;
foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump(abs($input) );
- $iterator++;
+ echo "\n-- Iteration $iterator --\n";
+ try {
+ var_dump(abs($input));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ $iterator++;
};
fclose($fp);
?>
-===Done===
---EXPECTF--
+--EXPECT--
*** Testing abs() : usage variations ***
-- Iteration 1 --
@@ -102,27 +105,25 @@ int(1)
int(0)
-- Iteration 7 --
-int(0)
+abs() expects parameter 1 to be int or float, string given
-- Iteration 8 --
-int(0)
+abs() expects parameter 1 to be int or float, string given
-- Iteration 9 --
-bool(false)
+abs() expects parameter 1 to be int or float, array given
-- Iteration 10 --
-int(0)
+abs() expects parameter 1 to be int or float, string given
-- Iteration 11 --
-int(0)
+abs() expects parameter 1 to be int or float, string given
-- Iteration 12 --
-int(0)
+abs() expects parameter 1 to be int or float, string given
-- Iteration 13 --
-
-Notice: Object of class classA could not be converted to number in %s on line %d
-int(1)
+abs() expects parameter 1 to be int or float, object given
-- Iteration 14 --
int(0)
@@ -131,5 +132,4 @@ int(0)
int(0)
-- Iteration 16 --
-int(%d)
-===Done===
+abs() expects parameter 1 to be int or float, resource given
diff --git a/ext/standard/tests/math/acos_basic.phpt b/ext/standard/tests/math/acos_basic.phpt
index 6f73d40f40..4f7962ce5e 100644
--- a/ext/standard/tests/math/acos_basic.phpt
+++ b/ext/standard/tests/math/acos_basic.phpt
@@ -19,20 +19,20 @@ echo "acos .5 = ";
$acosv1 = 360.0 * acos(0.5) / (2.0 * M_PI );
var_dump($acosv1);
if (allowed_rounding_error($acosv1 ,60 )) {
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
echo "acos 0.86602540378444 = ";
$acosv2 = 360.0 * acos(0.86602540378444) / (2.0 * M_PI );
var_dump($acosv2);
if (allowed_rounding_error($acosv2 ,30 )) {
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
@@ -40,10 +40,10 @@ echo "acos 1.0 = ";
$acosv3 = 360.0 * acos(1.0) / (2.0 * M_PI);
var_dump($acosv3);
if (allowed_rounding_error($acosv3 ,0 )) {
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
@@ -51,10 +51,10 @@ echo "acos 0.0 = ";
$acosv4 = 360.0 * acos(0.0) / (2.0 * M_PI );
var_dump($acosv4);
if (allowed_rounding_error($acosv3 ,0 )) {
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
?>
diff --git a/ext/standard/tests/math/acos_basiclong_64bit.phpt b/ext/standard/tests/math/acos_basiclong_64bit.phpt
index a32180cd1b..89cc9763d5 100644
--- a/ext/standard/tests/math/acos_basiclong_64bit.phpt
+++ b/ext/standard/tests/math/acos_basiclong_64bit.phpt
@@ -25,7 +25,6 @@ foreach ($longVals as $longVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 ---
float(NAN)
@@ -57,4 +56,3 @@ float(NAN)
float(NAN)
--- testing: -9.2233720368548E+18 ---
float(NAN)
-===DONE===
diff --git a/ext/standard/tests/math/acos_variation.phpt b/ext/standard/tests/math/acos_variation.phpt
index 5575ec5796..20065d62eb 100644
--- a/ext/standard/tests/math/acos_variation.phpt
+++ b/ext/standard/tests/math/acos_variation.phpt
@@ -13,24 +13,23 @@ precision=10
//Test acos with a different input values
$values = array(23,
- -23,
- 2.345e1,
- -2.345e1,
- 0x17,
- 027,
- "23",
- "23.45",
- "2.345e1",
- "nonsense",
- "1000",
- "1000ABC",
- null,
- true,
- false);
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
for ($i = 0; $i < count($values); $i++) {
- $res = acos($values[$i]);
- var_dump($res);
+ $res = acos($values[$i]);
+ var_dump($res);
}
?>
@@ -44,9 +43,6 @@ float(NAN)
float(NAN)
float(NAN)
float(NAN)
-
-Warning: acos() expects parameter 1 to be float, string given in %s on line %d
-NULL
float(NAN)
Notice: A non well formed numeric value encountered in %s on line %d
diff --git a/ext/standard/tests/math/acosh_basic.phpt b/ext/standard/tests/math/acosh_basic.phpt
index a9ba199df5..aed150cba8 100644
--- a/ext/standard/tests/math/acosh_basic.phpt
+++ b/ext/standard/tests/math/acosh_basic.phpt
@@ -16,20 +16,20 @@ echo "acosh 1.1276259652064= ";
var_dump(acosh(1.1276259652064));
if (allowed_rounding_error(acosh(1.1276259652064), 0.5))
{
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
echo "acosh 10.067661995778= ";
var_dump(acosh(10.067661995778));
if (allowed_rounding_error(acosh(10.067661995778), 3.0))
{
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
diff --git a/ext/standard/tests/math/acosh_basiclong_64bit.phpt b/ext/standard/tests/math/acosh_basiclong_64bit.phpt
index 902c235c32..428ae3e5fb 100644
--- a/ext/standard/tests/math/acosh_basiclong_64bit.phpt
+++ b/ext/standard/tests/math/acosh_basiclong_64bit.phpt
@@ -25,7 +25,6 @@ foreach ($longVals as $longVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 ---
float(44.361419555836)
@@ -57,4 +56,3 @@ float(44.361419555836)
float(NAN)
--- testing: -9.2233720368548E+18 ---
float(NAN)
-===DONE===
diff --git a/ext/standard/tests/math/acosh_variation.phpt b/ext/standard/tests/math/acosh_variation.phpt
index cc89ce3e76..27e1a9ac24 100644
--- a/ext/standard/tests/math/acosh_variation.phpt
+++ b/ext/standard/tests/math/acosh_variation.phpt
@@ -13,24 +13,23 @@ precision = 10
//Test acosh with a different input values
$values = array(23,
- -23,
- 2.345e1,
- -2.345e1,
- 0x17,
- 027,
- "23",
- "23.45",
- "2.345e1",
- "nonsense",
- "1000",
- "1000ABC",
- null,
- true,
- false);
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
for ($i = 0; $i < count($values); $i++) {
- $res = acosh($values[$i]);
- var_dump($res);
+ $res = acosh($values[$i]);
+ var_dump($res);
}
?>
@@ -44,9 +43,6 @@ float(3.828168471)
float(3.828168471)
float(3.847562739)
float(3.847562739)
-
-Warning: acosh() expects parameter 1 to be float, string given in %s on line %d
-NULL
float(7.60090221)
Notice: A non well formed numeric value encountered in %s on line %d
diff --git a/ext/standard/tests/math/allowed_rounding_error.inc b/ext/standard/tests/math/allowed_rounding_error.inc
index 9ba754b582..c4a1cce4bf 100644
--- a/ext/standard/tests/math/allowed_rounding_error.inc
+++ b/ext/standard/tests/math/allowed_rounding_error.inc
@@ -1,18 +1,18 @@
<?php
function allowed_rounding_error ($number, $expected) {
- //different machines may give slightly different floating point numbers
- //This assumes that the results will be the same to + or - 1.0E-10.
+ //different machines may give slightly different floating point numbers
+ //This assumes that the results will be the same to + or - 1.0E-10.
- $small_number = 1.0e-10;
- $min = $expected - $small_number;
- $max = $expected + $small_number;
+ $small_number = 1.0e-10;
+ $min = $expected - $small_number;
+ $max = $expected + $small_number;
- if ($number < $max && $number > $min ) {
- return true;
- }
- else {
- return false;
- }
+ if ($number < $max && $number > $min ) {
+ return true;
+ }
+ else {
+ return false;
+ }
}
?>
diff --git a/ext/standard/tests/math/asin_basic.phpt b/ext/standard/tests/math/asin_basic.phpt
index ec43d50692..419a9ef343 100644
--- a/ext/standard/tests/math/asin_basic.phpt
+++ b/ext/standard/tests/math/asin_basic.phpt
@@ -19,30 +19,30 @@ echo "asin .5 = ";
$asinv1 = 360.0 * asin(0.5) / (2.0 * M_PI );
var_dump($asinv1);
if (allowed_rounding_error($asinv1 ,30 )) {
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
echo "asin 0.86602540378444 = ";
$asinv2 = 360.0 * asin(0.86602540378444) / (2.0 * M_PI );
var_dump($asinv2);
if (allowed_rounding_error($asinv2 ,60 )) {
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
echo "asin 1.0 = ";
$asinv3 = 360.0 * asin(1.0) / (2.0 * M_PI );
var_dump($asinv3);
if (allowed_rounding_error($asinv3 ,90 )) {
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
@@ -50,10 +50,10 @@ echo "asin 0.0 = ";
$asinv4 = 360.0 * asin(0.0) / (2.0 * M_PI );
var_dump($asinv4);
if (allowed_rounding_error($asinv4 ,0 )) {
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
?>
diff --git a/ext/standard/tests/math/asin_basiclong_64bit.phpt b/ext/standard/tests/math/asin_basiclong_64bit.phpt
index 071ad1c39c..7a21ba6167 100644
--- a/ext/standard/tests/math/asin_basiclong_64bit.phpt
+++ b/ext/standard/tests/math/asin_basiclong_64bit.phpt
@@ -25,7 +25,6 @@ foreach ($longVals as $longVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 ---
float(NAN)
@@ -57,4 +56,3 @@ float(NAN)
float(NAN)
--- testing: -9.2233720368548E+18 ---
float(NAN)
-===DONE===
diff --git a/ext/standard/tests/math/asin_variation.phpt b/ext/standard/tests/math/asin_variation.phpt
index c8063849fd..7c0e5a37d6 100644
--- a/ext/standard/tests/math/asin_variation.phpt
+++ b/ext/standard/tests/math/asin_variation.phpt
@@ -13,24 +13,23 @@ precision = 10
//Test asin with a different input values
$values = array(23,
- -23,
- 2.345e1,
- -2.345e1,
- 0x17,
- 027,
- "23",
- "23.45",
- "2.345e1",
- "nonsense",
- "1000",
- "1000ABC",
- null,
- true,
- false);
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
for ($i = 0; $i < count($values); $i++) {
- $res = asin($values[$i]);
- var_dump($res);
+ $res = asin($values[$i]);
+ var_dump($res);
}
?>
@@ -44,9 +43,6 @@ float(NAN)
float(NAN)
float(NAN)
float(NAN)
-
-Warning: asin() expects parameter 1 to be float, string given in %s on line %d
-NULL
float(NAN)
Notice: A non well formed numeric value encountered in %s on line %d
diff --git a/ext/standard/tests/math/asinh_basic.phpt b/ext/standard/tests/math/asinh_basic.phpt
index 8fd189c66a..16380da128 100644
--- a/ext/standard/tests/math/asinh_basic.phpt
+++ b/ext/standard/tests/math/asinh_basic.phpt
@@ -16,20 +16,20 @@ echo "asinh 0.52109530549375= ";
var_dump(asinh(0.52109530549375));
if (allowed_rounding_error(asinh(0.52109530549375), 0.5))
{
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
echo "asinh 10.01787492741= ";
var_dump(asinh(10.01787492741));
if (allowed_rounding_error(asinh(10.01787492741), 3.0))
{
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
?>
diff --git a/ext/standard/tests/math/asinh_basiclong_64bit.phpt b/ext/standard/tests/math/asinh_basiclong_64bit.phpt
index f4ccb0d23b..db8b7ad03e 100644
--- a/ext/standard/tests/math/asinh_basiclong_64bit.phpt
+++ b/ext/standard/tests/math/asinh_basiclong_64bit.phpt
@@ -25,7 +25,6 @@ foreach ($longVals as $longVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 ---
float(44.361419555836)
@@ -57,4 +56,3 @@ float(44.361419555836)
float(-44.361419555836)
--- testing: -9.2233720368548E+18 ---
float(-44.361419555836)
-===DONE===
diff --git a/ext/standard/tests/math/asinh_variation.phpt b/ext/standard/tests/math/asinh_variation.phpt
index 5e41a45900..f4304148cb 100644
--- a/ext/standard/tests/math/asinh_variation.phpt
+++ b/ext/standard/tests/math/asinh_variation.phpt
@@ -13,24 +13,23 @@ precision = 10
//Test asinh with a different input values
$values = array(23,
- -23,
- 2.345e1,
- -2.345e1,
- 0x17,
- 027,
- "23",
- "23.45",
- "2.345e1",
- "nonsense",
- "1000",
- "1000ABC",
- null,
- true,
- false);
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
for ($i = 0; $i < count($values); $i++) {
- $res = asinh($values[$i]);
- var_dump($res);
+ $res = asinh($values[$i]);
+ var_dump($res);
}
?>
@@ -44,9 +43,6 @@ float(3.829113652)
float(3.829113652)
float(3.848471992)
float(3.848471992)
-
-Warning: asinh() expects parameter 1 to be float, string given in %s on line %d
-NULL
float(7.60090271)
Notice: A non well formed numeric value encountered in %s on line %d
diff --git a/ext/standard/tests/math/atan2_basic.phpt b/ext/standard/tests/math/atan2_basic.phpt
index f6dae62900..fe015ac2aa 100644
--- a/ext/standard/tests/math/atan2_basic.phpt
+++ b/ext/standard/tests/math/atan2_basic.phpt
@@ -5,37 +5,37 @@ precision=14
--FILE--
<?php
$valuesy = array(23,
- -23,
- 2.345e1,
- -2.345e1,
- 0x17,
- 027,
- "23",
- "23.45",
- "2.345e1",
- null,
- true,
- false);
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ null,
+ true,
+ false);
$valuesx = array(23,
- -23,
- 2.345e1,
- -2.345e1,
- 0x17,
- 027,
- "23",
- "23.45",
- "2.345e1",
- null,
- true,
- false);
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ null,
+ true,
+ false);
for ($i = 0; $i < count($valuesy); $i++) {
- for ($j = 0; $j < count($valuesx); $j++) {
- $res = atan2($valuesy[$i], $valuesx[$j]);
- echo "Y:$valuesy[$i] X:$valuesx[$j] ";
- var_dump($res);
- }
+ for ($j = 0; $j < count($valuesx); $j++) {
+ $res = atan2($valuesy[$i], $valuesx[$j]);
+ echo "Y:$valuesy[$i] X:$valuesx[$j] ";
+ var_dump($res);
+ }
}
?>
--EXPECT--
diff --git a/ext/standard/tests/math/atan2_basiclong_64bit.phpt b/ext/standard/tests/math/atan2_basiclong_64bit.phpt
index f646585f30..e29501232d 100644
--- a/ext/standard/tests/math/atan2_basiclong_64bit.phpt
+++ b/ext/standard/tests/math/atan2_basiclong_64bit.phpt
@@ -23,13 +23,12 @@ $otherVals = array(0, 1, -1, 7, 9, 65, -44, MAX_32Bit, MIN_32Bit, MAX_64Bit, MIN
foreach ($longVals as $longVal) {
foreach($otherVals as $otherVal) {
- echo "--- testing: $longVal, $otherVal ---\n";
+ echo "--- testing: $longVal, $otherVal ---\n";
var_dump(atan2($longVal, $otherVal));
}
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807, 0 ---
float(1.5707963267949)
@@ -361,4 +360,3 @@ float(-1.5707963270277)
float(-0.78539816339745)
--- testing: -9.2233720368548E+18, -9223372036854775808 ---
float(-2.3561944901923)
-===DONE===
diff --git a/ext/standard/tests/math/atan_basic.phpt b/ext/standard/tests/math/atan_basic.phpt
index 24f1f4b924..9f41e58234 100644
--- a/ext/standard/tests/math/atan_basic.phpt
+++ b/ext/standard/tests/math/atan_basic.phpt
@@ -16,20 +16,20 @@ echo "atan 1.7320508075689 = ";
$atan1 = 360 * atan(1.7320508075689) / (2.0 * M_PI);
var_dump($atan1);
if (allowed_rounding_error($atan1 ,60 )) {
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
echo "atan 0.57735026918963 = ";
$atan2 = 360 * atan(0.57735026918963) / (2.0 * M_PI);
var_dump($atan2);
if (allowed_rounding_error($atan2 ,30 )) {
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
?>
diff --git a/ext/standard/tests/math/atan_basiclong_64bit.phpt b/ext/standard/tests/math/atan_basiclong_64bit.phpt
index 15d9a000ae..2f5945dd2f 100644
--- a/ext/standard/tests/math/atan_basiclong_64bit.phpt
+++ b/ext/standard/tests/math/atan_basiclong_64bit.phpt
@@ -25,7 +25,6 @@ foreach ($longVals as $longVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 ---
float(1.5707963267949)
@@ -57,4 +56,3 @@ float(1.5707963267949)
float(-1.5707963267949)
--- testing: -9.2233720368548E+18 ---
float(-1.5707963267949)
-===DONE===
diff --git a/ext/standard/tests/math/atan_variation.phpt b/ext/standard/tests/math/atan_variation.phpt
index b6a9a9ec32..409f0b1719 100644
--- a/ext/standard/tests/math/atan_variation.phpt
+++ b/ext/standard/tests/math/atan_variation.phpt
@@ -13,24 +13,23 @@ precision = 10
//Test atan with a different input values
$values = array(23,
- -23,
- 2.345e1,
- -2.345e1,
- 0x17,
- 027,
- "23",
- "23.45",
- "2.345e1",
- "nonsense",
- "1000",
- "1000ABC",
- null,
- true,
- false);
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
for ($i = 0; $i < count($values); $i++) {
- $res = atan($values[$i]);
- var_dump($res);
+ $res = atan($values[$i]);
+ var_dump($res);
}
?>
@@ -44,9 +43,6 @@ float(1.527345431)
float(1.527345431)
float(1.528178225)
float(1.528178225)
-
-Warning: atan() expects parameter 1 to be float, string given in %s on line %d
-NULL
float(1.569796327)
Notice: A non well formed numeric value encountered in %s on line %d
diff --git a/ext/standard/tests/math/atanh_basic.phpt b/ext/standard/tests/math/atanh_basic.phpt
index 8b994bc5fd..0a7040360b 100644
--- a/ext/standard/tests/math/atanh_basic.phpt
+++ b/ext/standard/tests/math/atanh_basic.phpt
@@ -16,20 +16,20 @@ echo "atanh 0.46211715726001 = ";
var_dump(atanh(0.46211715726001));
if (allowed_rounding_error(atanh(0.46211715726001), 0.5))
{
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
echo "atanh 0.99505475368673 = ";
var_dump(atanh(0.99505475368673));
if (allowed_rounding_error(atanh(0.99505475368673), 3.0))
{
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
diff --git a/ext/standard/tests/math/atanh_basiclong_64bit.phpt b/ext/standard/tests/math/atanh_basiclong_64bit.phpt
index 426ca51f2a..aa84cbf338 100644
--- a/ext/standard/tests/math/atanh_basiclong_64bit.phpt
+++ b/ext/standard/tests/math/atanh_basiclong_64bit.phpt
@@ -25,7 +25,6 @@ foreach ($longVals as $longVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 ---
float(NAN)
@@ -57,4 +56,3 @@ float(NAN)
float(NAN)
--- testing: -9.2233720368548E+18 ---
float(NAN)
-===DONE===
diff --git a/ext/standard/tests/math/atanh_variation.phpt b/ext/standard/tests/math/atanh_variation.phpt
index 2b0a4b1085..610aaab3fb 100644
--- a/ext/standard/tests/math/atanh_variation.phpt
+++ b/ext/standard/tests/math/atanh_variation.phpt
@@ -13,24 +13,23 @@ precision = 10
//Test atanh with a different input values
$values = array(23,
- -23,
- 2.345e1,
- -2.345e1,
- 0x17,
- 027,
- "23",
- "23.45",
- "2.345e1",
- "nonsense",
- "1000",
- "1000ABC",
- null,
- true,
- false);
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
for ($i = 0; $i < count($values); $i++) {
- $res = atanh($values[$i]);
- var_dump($res);
+ $res = atanh($values[$i]);
+ var_dump($res);
}
?>
@@ -44,9 +43,6 @@ float(NAN)
float(NAN)
float(NAN)
float(NAN)
-
-Warning: atanh() expects parameter 1 to be float, string given in %s on line %d
-NULL
float(NAN)
Notice: A non well formed numeric value encountered in %s on line %d
diff --git a/ext/standard/tests/math/base_convert_basic.phpt b/ext/standard/tests/math/base_convert_basic.phpt
index 14767faeea..bdef339f3b 100644
--- a/ext/standard/tests/math/base_convert_basic.phpt
+++ b/ext/standard/tests/math/base_convert_basic.phpt
@@ -6,26 +6,26 @@ $frombase = array(2,8,10,16,36);
$tobase = array(2,8,10,16,36);
$values = array(10,
- 27,
- 39,
- 03,
- 0x5F,
- "10",
- "27",
- "39",
- "5F",
- "3XYZ"
- );
+ 27,
+ 39,
+ 03,
+ 0x5F,
+ "10",
+ "27",
+ "39",
+ "5F",
+ "3XYZ"
+ );
for ($f= 0; $f < count($frombase); $f++) {
- echo "\n...from base is ", $frombase[$f], "\n";
- for ($t= 0; $t < count($tobase); $t++) {
- echo "......to base is ", $tobase[$t], "\n";
- for ($i =0; $i < count($values); $i++){
- $res = base_convert($values[$i],$frombase[$f],$tobase[$t]);
- echo ".........value= ", $values[$i], " res = ", $res, "\n";
- }
- }
+ echo "\n...from base is ", $frombase[$f], "\n";
+ for ($t= 0; $t < count($tobase); $t++) {
+ echo "......to base is ", $tobase[$t], "\n";
+ for ($i =0; $i < count($values); $i++){
+ $res = base_convert($values[$i],$frombase[$f],$tobase[$t]);
+ echo ".........value= ", $values[$i], " res = ", $res, "\n";
+ }
+ }
}
?>
--EXPECTF--
diff --git a/ext/standard/tests/math/base_convert_error.phpt b/ext/standard/tests/math/base_convert_error.phpt
index 96e774b51f..279cfe7924 100644
--- a/ext/standard/tests/math/base_convert_error.phpt
+++ b/ext/standard/tests/math/base_convert_error.phpt
@@ -14,14 +14,17 @@ class classA
{
}
-echo "Incorrect number of arguments\n";
-base_convert();
-base_convert(35);
-base_convert(35,2);
-base_convert(1234, 1, 10);
-base_convert(1234, 10, 37);
+try {
+ base_convert(1234, 1, 10);
+} catch (ValueError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ base_convert(1234, 10, 37);
+} catch (ValueError $e) {
+ echo $e->getMessage(), "\n";
+}
-echo "Incorrect input\n";
try {
base_convert(new classA(), 8, 10);
} catch (Error $e) {
@@ -29,18 +32,8 @@ try {
}
?>
---EXPECTF--
+--EXPECT--
*** Testing base_convert() : error conditions ***
-Incorrect number of arguments
-
-Warning: base_convert() expects exactly 3 parameters, 0 given in %s on line %d
-
-Warning: base_convert() expects exactly 3 parameters, 1 given in %s on line %d
-
-Warning: base_convert() expects exactly 3 parameters, 2 given in %s on line %d
-
-Warning: base_convert(): Invalid `from base' (1) in %s on line %d
-
-Warning: base_convert(): Invalid `to base' (37) in %s on line %d
-Incorrect input
+Invalid `from base' (1)
+Invalid `to base' (37)
Object of class classA could not be converted to string
diff --git a/ext/standard/tests/math/base_convert_variation1.phpt b/ext/standard/tests/math/base_convert_variation1.phpt
index 9f106bc704..b0dba2b49b 100644
--- a/ext/standard/tests/math/base_convert_variation1.phpt
+++ b/ext/standard/tests/math/base_convert_variation1.phpt
@@ -70,13 +70,12 @@ $inputs = array(
// loop through each element of $inputs to check the behaviour of base_convert()
$iterator = 1;
foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump(base_convert($input, 10, 8));
- $iterator++;
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(base_convert($input, 10, 8));
+ $iterator++;
};
fclose($fp);
?>
-===Done===
--EXPECTF--
*** Testing base_convert() : usage variations ***
@@ -148,7 +147,7 @@ string(1) "0"
-- Iteration 19 --
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
string(1) "0"
@@ -178,4 +177,3 @@ string(1) "0"
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
string(1) "5"
-===Done===
diff --git a/ext/standard/tests/math/bindec_basic.phpt b/ext/standard/tests/math/bindec_basic.phpt
index 70c29b6fd2..03eec8ee30 100644
--- a/ext/standard/tests/math/bindec_basic.phpt
+++ b/ext/standard/tests/math/bindec_basic.phpt
@@ -9,28 +9,28 @@ precision=14
--FILE--
<?php
$values = array(111000111,
- 011100000,
- 1111111111111111111111111111111,
- 10000000000000000000000000000000,
- 100002001,
- '111000111',
- '011100000',
- '1111111111111111111111111111111',
- '10000000000000000000000000000000',
- '100002001',
- 'abcdefg',
- 311015,
- 31101.3,
- 31.1013e5,
- 0x111ABC,
- 011237,
- true,
- false,
- null);
+ 011100000,
+ 1111111111111111111111111111111,
+ 10000000000000000000000000000000,
+ 100002001,
+ '111000111',
+ '011100000',
+ '1111111111111111111111111111111',
+ '10000000000000000000000000000000',
+ '100002001',
+ 'abcdefg',
+ 311015,
+ 31101.3,
+ 31.1013e5,
+ 0x111ABC,
+ 011237,
+ true,
+ false,
+ null);
for ($i = 0; $i < count($values); $i++) {
- $res = bindec($values[$i]);
- var_dump($res);
+ $res = bindec($values[$i]);
+ var_dump($res);
}
?>
--EXPECTF--
diff --git a/ext/standard/tests/math/bindec_basic_64bit.phpt b/ext/standard/tests/math/bindec_basic_64bit.phpt
index 8408944acb..b8f46b6748 100644
--- a/ext/standard/tests/math/bindec_basic_64bit.phpt
+++ b/ext/standard/tests/math/bindec_basic_64bit.phpt
@@ -9,28 +9,28 @@ precision=14
--FILE--
<?php
$values = array(111000111,
- 011100000,
- 1111111111111111111111111111111,
- 10000000000000000000000000000000,
- 100002001,
- '111000111',
- '011100000',
- '1111111111111111111111111111111',
- '10000000000000000000000000000000',
- '100002001',
- 'abcdefg',
- 311015,
- 31101.3,
- 31.1013e5,
- 0x111ABC,
- 011237,
- true,
- false,
- null);
+ 011100000,
+ 1111111111111111111111111111111,
+ 10000000000000000000000000000000,
+ 100002001,
+ '111000111',
+ '011100000',
+ '1111111111111111111111111111111',
+ '10000000000000000000000000000000',
+ '100002001',
+ 'abcdefg',
+ 311015,
+ 31101.3,
+ 31.1013e5,
+ 0x111ABC,
+ 011237,
+ true,
+ false,
+ null);
for ($i = 0; $i < count($values); $i++) {
- $res = bindec($values[$i]);
- var_dump($res);
+ $res = bindec($values[$i]);
+ var_dump($res);
}
?>
--EXPECTF--
diff --git a/ext/standard/tests/math/bindec_basiclong_64bit.phpt b/ext/standard/tests/math/bindec_basiclong_64bit.phpt
index 488ab538ed..8b69d6b4c3 100644
--- a/ext/standard/tests/math/bindec_basiclong_64bit.phpt
+++ b/ext/standard/tests/math/bindec_basiclong_64bit.phpt
@@ -30,7 +30,6 @@ foreach ($binLongStrs as $strVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: 0111111111111111111111111111111111111111111111111111111111111111 ---
int(9223372036854775807)
@@ -48,4 +47,3 @@ float(3.6893488147419E+19)
int(4294967295)
--- testing: 111111111111111111111111111111111 ---
int(8589934591)
-===DONE===
diff --git a/ext/standard/tests/math/bindec_variation1.phpt b/ext/standard/tests/math/bindec_variation1.phpt
index f59cb81bbe..2b166a3edd 100644
--- a/ext/standard/tests/math/bindec_variation1.phpt
+++ b/ext/standard/tests/math/bindec_variation1.phpt
@@ -72,13 +72,16 @@ $inputs = array(
// loop through each element of $inputs to check the behaviour of bindec()
$iterator = 1;
foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump(bindec($input));
- $iterator++;
+ echo "\n-- Iteration $iterator --\n";
+ try {
+ var_dump(bindec($input));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ $iterator++;
};
fclose($fp);
?>
-===Done===
--EXPECTF--
*** Testing bindec() : usage variations ***
@@ -148,11 +151,7 @@ int(0)
int(0)
-- Iteration 18 --
-
-Notice: Array to string conversion in %s on line %d
-
-Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
-int(0)
+bindec() expects parameter 1 to be string, array given
-- Iteration 19 --
@@ -176,7 +175,4 @@ int(0)
int(0)
-- Iteration 24 --
-
-Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
-int(0)
-===Done===
+bindec() expects parameter 1 to be string, resource given
diff --git a/ext/standard/tests/math/bindec_variation1_64bit.phpt b/ext/standard/tests/math/bindec_variation1_64bit.phpt
index 4f96268b37..6784c13601 100644
--- a/ext/standard/tests/math/bindec_variation1_64bit.phpt
+++ b/ext/standard/tests/math/bindec_variation1_64bit.phpt
@@ -72,13 +72,16 @@ $inputs = array(
// loop through each element of $inputs to check the behaviour of bindec()
$iterator = 1;
foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump(bindec($input));
- $iterator++;
+ echo "\n-- Iteration $iterator --\n";
+ try {
+ var_dump(bindec($input));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ $iterator++;
};
fclose($fp);
?>
-===Done===
--EXPECTF--
*** Testing bindec() : usage variations ***
@@ -148,11 +151,7 @@ int(0)
int(0)
-- Iteration 18 --
-
-Notice: Array to string conversion in %s on line %d
-
-Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
-int(0)
+bindec() expects parameter 1 to be string, array given
-- Iteration 19 --
@@ -176,7 +175,4 @@ int(0)
int(0)
-- Iteration 24 --
-
-Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
-int(0)
-===Done===
+bindec() expects parameter 1 to be string, resource given
diff --git a/ext/standard/tests/math/bug24142.phpt b/ext/standard/tests/math/bug24142.phpt
index 3696b6e790..947deaebd6 100644
--- a/ext/standard/tests/math/bug24142.phpt
+++ b/ext/standard/tests/math/bug24142.phpt
@@ -4,8 +4,8 @@ Bug #24142 (round() problems)
<?php
$v = 0.005;
for ($i = 1; $i < 10; $i++) {
- echo "round({$v}, 2) -> ".round($v, 2)."\n";
- $v += 0.01;
+ echo "round({$v}, 2) -> ".round($v, 2)."\n";
+ $v += 0.01;
}
?>
--EXPECT--
diff --git a/ext/standard/tests/math/bug30695.phpt b/ext/standard/tests/math/bug30695.phpt
index 938b0e7fc8..a0034892db 100644
--- a/ext/standard/tests/math/bug30695.phpt
+++ b/ext/standard/tests/math/bug30695.phpt
@@ -2,7 +2,7 @@
Bug #30695 (32 bit issues)
--FILE--
<?php
- function toUTF8( $char_code )
+ function toUTF8( $char_code )
{
switch ( $char_code )
{
@@ -44,7 +44,7 @@ Bug #30695 (32 bit issues)
}
- echo "\n", toUTF8(65), "\n", toUTF8(233), "\n", toUTF8(1252), "\n", toUTF8(20095), "\n";
+ echo "\n", toUTF8(65), "\n", toUTF8(233), "\n", toUTF8(1252), "\n", toUTF8(20095), "\n";
?>
--EXPECT--
A
diff --git a/ext/standard/tests/math/bug75514.phpt b/ext/standard/tests/math/bug75514.phpt
index af97b6d0e1..da77b9bd9b 100644
--- a/ext/standard/tests/math/bug75514.phpt
+++ b/ext/standard/tests/math/bug75514.phpt
@@ -5,8 +5,6 @@ Bug #75514 mt_rand returns value outside [$min,$max]
mt_srand(0, MT_RAND_PHP);
var_dump(mt_rand(0,999999999), mt_rand(0,999));
?>
-===Done===
--EXPECT--
int(448865905)
int(592)
-===Done===
diff --git a/ext/standard/tests/math/ceil_basic.phpt b/ext/standard/tests/math/ceil_basic.phpt
index 275ed485c2..54b91836d1 100644
--- a/ext/standard/tests/math/ceil_basic.phpt
+++ b/ext/standard/tests/math/ceil_basic.phpt
@@ -11,34 +11,33 @@ precision=14
echo "*** Testing ceil() : basic functionality ***\n";
$values = array(0,
- -0,
- 0.5,
- -0.5,
- 1,
- -1,
- 1.5,
- -1.5,
- 2.6,
- -2.6,
- 037,
- 0x5F,
- "10.5",
- "-10.5",
- "3.95E3",
- "-3.95E3",
- "039",
- true,
- false,
- null,
- );
+ -0,
+ 0.5,
+ -0.5,
+ 1,
+ -1,
+ 1.5,
+ -1.5,
+ 2.6,
+ -2.6,
+ 037,
+ 0x5F,
+ "10.5",
+ "-10.5",
+ "3.95E3",
+ "-3.95E3",
+ "039",
+ true,
+ false,
+ null,
+ );
for ($i = 0; $i < count($values); $i++) {
- $res = ceil($values[$i]);
- var_dump($res);
+ $res = ceil($values[$i]);
+ var_dump($res);
}
?>
-===Done===
--EXPECT--
*** Testing ceil() : basic functionality ***
float(0)
@@ -61,4 +60,3 @@ float(39)
float(1)
float(0)
float(0)
-===Done===
diff --git a/ext/standard/tests/math/ceil_basiclong_64bit.phpt b/ext/standard/tests/math/ceil_basiclong_64bit.phpt
index 42d9f6b413..e1cc4b4dc6 100644
--- a/ext/standard/tests/math/ceil_basiclong_64bit.phpt
+++ b/ext/standard/tests/math/ceil_basiclong_64bit.phpt
@@ -25,7 +25,6 @@ foreach ($longVals as $longVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 ---
float(9.2233720368548E+18)
@@ -57,4 +56,3 @@ float(9.2233720368548E+18)
float(-9.2233720368548E+18)
--- testing: -9.2233720368548E+18 ---
float(-9.2233720368548E+18)
-===DONE===
diff --git a/ext/standard/tests/math/ceil_variation1.phpt b/ext/standard/tests/math/ceil_variation1.phpt
index 05f308a4a0..815093ea49 100644
--- a/ext/standard/tests/math/ceil_variation1.phpt
+++ b/ext/standard/tests/math/ceil_variation1.phpt
@@ -66,14 +66,17 @@ $inputs = array(
// loop through each element of $inputs to check the behaviour of ceil()
$iterator = 1;
foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump(ceil($input));
- $iterator++;
+ echo "\n-- Iteration $iterator --\n";
+ try {
+ var_dump(ceil($input));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ $iterator++;
};
fclose($fp);
?>
-===Done===
---EXPECTF--
+--EXPECT--
*** Testing ceil() : usage variations ***
-- Iteration 1 --
@@ -95,27 +98,25 @@ float(1)
float(0)
-- Iteration 7 --
-float(0)
+ceil() expects parameter 1 to be int or float, string given
-- Iteration 8 --
-float(0)
+ceil() expects parameter 1 to be int or float, string given
-- Iteration 9 --
-bool(false)
+ceil() expects parameter 1 to be int or float, array given
-- Iteration 10 --
-float(0)
+ceil() expects parameter 1 to be int or float, string given
-- Iteration 11 --
-float(0)
+ceil() expects parameter 1 to be int or float, string given
-- Iteration 12 --
-float(0)
+ceil() expects parameter 1 to be int or float, string given
-- Iteration 13 --
-
-Notice: Object of class classA could not be converted to number in %s on line %d
-float(1)
+ceil() expects parameter 1 to be int or float, object given
-- Iteration 14 --
float(0)
@@ -124,5 +125,4 @@ float(0)
float(0)
-- Iteration 16 --
-float(%d)
-===Done===
+ceil() expects parameter 1 to be int or float, resource given
diff --git a/ext/standard/tests/math/cos_basic.phpt b/ext/standard/tests/math/cos_basic.phpt
index 863d443830..5e471ae07f 100644
--- a/ext/standard/tests/math/cos_basic.phpt
+++ b/ext/standard/tests/math/cos_basic.phpt
@@ -26,55 +26,55 @@ $threesixty = M_PI * 2.0;
echo "cos 30 = ";
var_dump(cos($thirty));
if (allowed_rounding_error(cos($thirty),0.86602540378444)) {
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
echo "cos 60 = ";
var_dump(cos($sixty));
if (allowed_rounding_error(cos($sixty),0.5)) {
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
echo "cos 90 = ";
var_dump(cos($ninety));
if (allowed_rounding_error(cos($ninety),0.0)) {
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
echo "cos 180 = ";
var_dump(cos($oneeighty));
if (allowed_rounding_error(cos($oneeighty),-1.0)) {
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
echo "cos 270 = ";
var_dump(cos($twoseventy));
if (allowed_rounding_error(cos($twoseventy),0.0)) {
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
echo "cos 360 = ";
var_dump(cos($threesixty));
if (allowed_rounding_error(cos($threesixty),1.0)) {
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
?>
--EXPECTF--
diff --git a/ext/standard/tests/math/cos_basiclong_64bit.phpt b/ext/standard/tests/math/cos_basiclong_64bit.phpt
index 12355a7d86..c575bd7930 100644
--- a/ext/standard/tests/math/cos_basiclong_64bit.phpt
+++ b/ext/standard/tests/math/cos_basiclong_64bit.phpt
@@ -25,7 +25,6 @@ foreach ($longVals as $longVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 ---
float(0.0118000765128)
@@ -57,4 +56,3 @@ float(0.0118000765128)
float(0.0118000765128)
--- testing: -9.2233720368548E+18 ---
float(0.0118000765128)
-===DONE===
diff --git a/ext/standard/tests/math/cos_variation.phpt b/ext/standard/tests/math/cos_variation.phpt
index 6323042dc7..da92b6aafe 100644
--- a/ext/standard/tests/math/cos_variation.phpt
+++ b/ext/standard/tests/math/cos_variation.phpt
@@ -13,24 +13,23 @@ precision = 10
//Test cos with a different input values
$values = array(23,
- -23,
- 2.345e1,
- -2.345e1,
- 0x17,
- 027,
- "23",
- "23.45",
- "2.345e1",
- "nonsense",
- "1000",
- "1000ABC",
- null,
- true,
- false);
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
for ($i = 0; $i < count($values); $i++) {
- $res = cos($values[$i]);
- var_dump($res);
+ $res = cos($values[$i]);
+ var_dump($res);
}
?>
@@ -44,9 +43,6 @@ float(-0.5328330203)
float(-0.5328330203)
float(-0.1117112391)
float(-0.1117112391)
-
-Warning: cos() expects parameter 1 to be float, string given in %s on line %d
-NULL
float(0.5623790763)
Notice: A non well formed numeric value encountered in %s on line %d
diff --git a/ext/standard/tests/math/cosh_basic.phpt b/ext/standard/tests/math/cosh_basic.phpt
index 5b52fb2a63..620bbbebcd 100644
--- a/ext/standard/tests/math/cosh_basic.phpt
+++ b/ext/standard/tests/math/cosh_basic.phpt
@@ -16,37 +16,37 @@ echo "cosh .5 = ";
var_dump(cosh(0.5));
if (allowed_rounding_error(cosh(0.5),1.1276259652064)){
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
echo "cosh -0.5 = ";
var_dump(cosh(-0.5));
if (allowed_rounding_error(cosh(-0.5),1.1276259652064)){
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
echo "cosh 3 = ";
var_dump(cosh(3.0));
if (allowed_rounding_error(cosh(3.0), 10.067661995778)){
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
echo "cosh -3 = ";
var_dump(cosh(-3.0));
if (allowed_rounding_error(cosh(-3.0), 10.067661995778)){
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
?>
diff --git a/ext/standard/tests/math/cosh_basiclong_64bit.phpt b/ext/standard/tests/math/cosh_basiclong_64bit.phpt
index f065b47213..8c805046c5 100644
--- a/ext/standard/tests/math/cosh_basiclong_64bit.phpt
+++ b/ext/standard/tests/math/cosh_basiclong_64bit.phpt
@@ -25,7 +25,6 @@ foreach ($longVals as $longVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 ---
float(INF)
@@ -57,4 +56,3 @@ float(INF)
float(INF)
--- testing: -9.2233720368548E+18 ---
float(INF)
-===DONE===
diff --git a/ext/standard/tests/math/cosh_variation.phpt b/ext/standard/tests/math/cosh_variation.phpt
index cd64670668..a0b3b60f19 100644
--- a/ext/standard/tests/math/cosh_variation.phpt
+++ b/ext/standard/tests/math/cosh_variation.phpt
@@ -13,24 +13,23 @@ precision = 10
//Test cosh with a different input values
$values = array(23,
- -23,
- 2.345e1,
- -2.345e1,
- 0x17,
- 027,
- "23",
- "23.45",
- "2.345e1",
- "nonsense",
- "1000",
- "1000ABC",
- null,
- true,
- false);
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
for ($i = 0; $i < count($values); $i++) {
- $res = cosh($values[$i]);
- var_dump($res);
+ $res = cosh($values[$i]);
+ var_dump($res);
}
?>
@@ -44,9 +43,6 @@ float(4872401723)
float(4872401723)
float(7641446995)
float(7641446995)
-
-Warning: cosh() expects parameter 1 to be float, string given in %s on line %d
-NULL
float(INF)
Notice: A non well formed numeric value encountered in %s on line %d
diff --git a/ext/standard/tests/math/decbin_basic.phpt b/ext/standard/tests/math/decbin_basic.phpt
index b067030a48..da681dfbe8 100644
--- a/ext/standard/tests/math/decbin_basic.phpt
+++ b/ext/standard/tests/math/decbin_basic.phpt
@@ -3,23 +3,23 @@ Test decbin() - basic function test
--FILE--
<?php
$values = array(10,
- 3950.5,
- 3.9505e3,
- 03,
- 0x5F,
- "10",
- "3950.5",
- "3.9505e3",
- "039",
- "0x5F",
- true,
- false,
- null,
- );
+ 3950.5,
+ 3.9505e3,
+ 03,
+ 0x5F,
+ "10",
+ "3950.5",
+ "3.9505e3",
+ "039",
+ "0x5F",
+ true,
+ false,
+ null,
+ );
for ($i = 0; $i < count($values); $i++) {
- $res = decbin($values[$i]);
- var_dump($res);
+ $res = decbin($values[$i]);
+ var_dump($res);
}
?>
--EXPECT--
diff --git a/ext/standard/tests/math/decbin_basiclong_64bit.phpt b/ext/standard/tests/math/decbin_basiclong_64bit.phpt
index a2e9185ab5..d48d729bc9 100644
--- a/ext/standard/tests/math/decbin_basiclong_64bit.phpt
+++ b/ext/standard/tests/math/decbin_basiclong_64bit.phpt
@@ -25,7 +25,6 @@ foreach ($longVals as $longVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 ---
string(63) "111111111111111111111111111111111111111111111111111111111111111"
@@ -57,4 +56,3 @@ string(64) "1000000000000000000000000000000000000000000000000000000000000000"
string(64) "1000000000000000000000000000000000000000000000000000000000000001"
--- testing: -9.2233720368548E+18 ---
string(64) "1000000000000000000000000000000000000000000000000000000000000000"
-===DONE===
diff --git a/ext/standard/tests/math/decbin_variation1.phpt b/ext/standard/tests/math/decbin_variation1.phpt
index 711f1733a2..581e88b283 100644
--- a/ext/standard/tests/math/decbin_variation1.phpt
+++ b/ext/standard/tests/math/decbin_variation1.phpt
@@ -84,13 +84,12 @@ $inputs = array(
// loop through each element of $inputs to check the behaviour of decbin()
$iterator = 1;
foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump(decbin($input));
- $iterator++;
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(decbin($input));
+ $iterator++;
};
fclose($fp);
?>
-===Done===
--EXPECTF--
*** Testing decbin() : usage variations ***
@@ -176,4 +175,3 @@ string(1) "0"
-- Iteration 27 --
string(%d) "%d"
-===Done===
diff --git a/ext/standard/tests/math/decbin_variation1_64bit.phpt b/ext/standard/tests/math/decbin_variation1_64bit.phpt
index ccde29472b..91f79aaecb 100644
--- a/ext/standard/tests/math/decbin_variation1_64bit.phpt
+++ b/ext/standard/tests/math/decbin_variation1_64bit.phpt
@@ -84,13 +84,12 @@ $inputs = array(
// loop through each element of $inputs to check the behaviour of decbin()
$iterator = 1;
foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump(decbin($input));
- $iterator++;
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(decbin($input));
+ $iterator++;
};
fclose($fp);
?>
-===Done===
--EXPECTF--
*** Testing decbin() : usage variations ***
@@ -176,4 +175,3 @@ string(1) "0"
-- Iteration 27 --
string(%d) "%d"
-===Done===
diff --git a/ext/standard/tests/math/dechex_basic.phpt b/ext/standard/tests/math/dechex_basic.phpt
index 9f6328c24a..690e2a9842 100644
--- a/ext/standard/tests/math/dechex_basic.phpt
+++ b/ext/standard/tests/math/dechex_basic.phpt
@@ -3,23 +3,23 @@ Test dechex() - basic function dechex()
--FILE--
<?php
$values = array(10,
- 3950.5,
- 3.9505e3,
- 03,
- 0x5F,
- "10",
- "3950.5",
- "3.9505e3",
- "039",
- "0x5F",
- true,
- false,
- null,
- );
+ 3950.5,
+ 3.9505e3,
+ 03,
+ 0x5F,
+ "10",
+ "3950.5",
+ "3.9505e3",
+ "039",
+ "0x5F",
+ true,
+ false,
+ null,
+ );
for ($i = 0; $i < count($values); $i++) {
- $res = dechex($values[$i]);
- var_dump($res);
+ $res = dechex($values[$i]);
+ var_dump($res);
}
?>
--EXPECT--
diff --git a/ext/standard/tests/math/dechex_basiclong_64bit.phpt b/ext/standard/tests/math/dechex_basiclong_64bit.phpt
index 135a422f66..812bafbfb7 100644
--- a/ext/standard/tests/math/dechex_basiclong_64bit.phpt
+++ b/ext/standard/tests/math/dechex_basiclong_64bit.phpt
@@ -25,7 +25,6 @@ foreach ($longVals as $longVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 ---
string(16) "7fffffffffffffff"
@@ -57,4 +56,3 @@ string(16) "8000000000000000"
string(16) "8000000000000001"
--- testing: -9.2233720368548E+18 ---
string(16) "8000000000000000"
-===DONE===
diff --git a/ext/standard/tests/math/dechex_variation1.phpt b/ext/standard/tests/math/dechex_variation1.phpt
index e77ea9922e..fd1ea6def1 100644
--- a/ext/standard/tests/math/dechex_variation1.phpt
+++ b/ext/standard/tests/math/dechex_variation1.phpt
@@ -84,13 +84,12 @@ $inputs = array(
// loop through each element of $inputs to check the behaviour of dechex()
$iterator = 1;
foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump(dechex($input));
- $iterator++;
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(dechex($input));
+ $iterator++;
};
fclose($fp);
?>
-===Done===
--EXPECTF--
*** Testing dechex() : usage variations ***
@@ -176,4 +175,3 @@ string(1) "0"
-- Iteration 27 --
string(%d) "%s"
-===Done===
diff --git a/ext/standard/tests/math/dechex_variation1_64bit.phpt b/ext/standard/tests/math/dechex_variation1_64bit.phpt
index ff88ec8c79..a566001d62 100644
--- a/ext/standard/tests/math/dechex_variation1_64bit.phpt
+++ b/ext/standard/tests/math/dechex_variation1_64bit.phpt
@@ -84,13 +84,12 @@ $inputs = array(
// loop through each element of $inputs to check the behaviour of dechex()
$iterator = 1;
foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump(dechex($input));
- $iterator++;
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(dechex($input));
+ $iterator++;
};
fclose($fp);
?>
-===Done===
--EXPECTF--
*** Testing dechex() : usage variations ***
@@ -176,4 +175,3 @@ string(1) "0"
-- Iteration 27 --
string(%d) "%s"
-===Done===
diff --git a/ext/standard/tests/math/decoct_basic.phpt b/ext/standard/tests/math/decoct_basic.phpt
index 19bda37bff..46418df67d 100644
--- a/ext/standard/tests/math/decoct_basic.phpt
+++ b/ext/standard/tests/math/decoct_basic.phpt
@@ -3,23 +3,23 @@ Test decoct() - basic function test decoct()
--FILE--
<?php
$values = array(10,
- 3950.5,
- 3.9505e3,
- 03,
- 0x5F,
- "10",
- "3950.5",
- "3.9505e3",
- "039",
- "0x5F",
- true,
- false,
- null,
- );
+ 3950.5,
+ 3.9505e3,
+ 03,
+ 0x5F,
+ "10",
+ "3950.5",
+ "3.9505e3",
+ "039",
+ "0x5F",
+ true,
+ false,
+ null,
+ );
for ($i = 0; $i < count($values); $i++) {
- $res = decoct($values[$i]);
- var_dump($res);
+ $res = decoct($values[$i]);
+ var_dump($res);
}
?>
--EXPECT--
diff --git a/ext/standard/tests/math/decoct_basiclong_64bit.phpt b/ext/standard/tests/math/decoct_basiclong_64bit.phpt
index f1812b9062..8b61aa8cbf 100644
--- a/ext/standard/tests/math/decoct_basiclong_64bit.phpt
+++ b/ext/standard/tests/math/decoct_basiclong_64bit.phpt
@@ -25,7 +25,6 @@ foreach ($longVals as $longVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 ---
string(21) "777777777777777777777"
@@ -57,4 +56,3 @@ string(22) "1000000000000000000000"
string(22) "1000000000000000000001"
--- testing: -9.2233720368548E+18 ---
string(22) "1000000000000000000000"
-===DONE===
diff --git a/ext/standard/tests/math/decoct_variation1.phpt b/ext/standard/tests/math/decoct_variation1.phpt
index 85230df2b3..174fddf470 100644
--- a/ext/standard/tests/math/decoct_variation1.phpt
+++ b/ext/standard/tests/math/decoct_variation1.phpt
@@ -85,13 +85,12 @@ $inputs = array(
// loop through each element of $inputs to check the behaviour of decoct()
$iterator = 1;
foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump(decoct($input));
- $iterator++;
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(decoct($input));
+ $iterator++;
};
fclose($fp);
?>
-===Done===
--EXPECTF--
*** Testing decoct() : usage variations ***
@@ -177,4 +176,3 @@ string(1) "0"
-- Iteration 27 --
string(%d) "%d"
-===Done===
diff --git a/ext/standard/tests/math/decoct_variation1_64bit.phpt b/ext/standard/tests/math/decoct_variation1_64bit.phpt
index 8e76e15c2e..2ff2c4c48e 100644
--- a/ext/standard/tests/math/decoct_variation1_64bit.phpt
+++ b/ext/standard/tests/math/decoct_variation1_64bit.phpt
@@ -85,13 +85,12 @@ $inputs = array(
// loop through each element of $inputs to check the behaviour of decoct()
$iterator = 1;
foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump(decoct($input));
- $iterator++;
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(decoct($input));
+ $iterator++;
};
fclose($fp);
?>
-===Done===
--EXPECTF--
*** Testing decoct() : usage variations ***
@@ -177,4 +176,3 @@ string(1) "0"
-- Iteration 27 --
string(%d) "%d"
-===Done===
diff --git a/ext/standard/tests/math/deg2rad_basic.phpt b/ext/standard/tests/math/deg2rad_basic.phpt
index 6db1be4da8..ea1eba6ddf 100644
--- a/ext/standard/tests/math/deg2rad_basic.phpt
+++ b/ext/standard/tests/math/deg2rad_basic.phpt
@@ -22,38 +22,38 @@ echo "deg2rad $arg_0 = ";
$r0 = deg2rad($arg_0);
var_dump($r0);
if (allowed_rounding_error($r0 ,0 )) {
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
echo "deg2rad $arg_1 = ";
$r1 = deg2rad($arg_1);
var_dump($r1);
if (allowed_rounding_error($r1 ,1.5707963267949 )) {
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
echo "deg2rad $arg_2 = ";
$r2 = deg2rad($arg_2);
var_dump($r2);
if (allowed_rounding_error($r2 ,3.1415926535898 )) {
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
echo "deg2rad $arg_3 = ";
$r3 = deg2rad($arg_3);
var_dump($r3);
if (allowed_rounding_error($r3 ,6.2831853071796 )) {
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
?>
--EXPECTF--
diff --git a/ext/standard/tests/math/deg2rad_basiclong_64bit.phpt b/ext/standard/tests/math/deg2rad_basiclong_64bit.phpt
index 3a14b11825..ae4087eccb 100644
--- a/ext/standard/tests/math/deg2rad_basiclong_64bit.phpt
+++ b/ext/standard/tests/math/deg2rad_basiclong_64bit.phpt
@@ -25,7 +25,6 @@ foreach ($longVals as $longVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 ---
float(1.6097821017949E+17)
@@ -57,4 +56,3 @@ float(1.6097821017949E+17)
float(-1.6097821017949E+17)
--- testing: -9.2233720368548E+18 ---
float(-1.6097821017949E+17)
-===DONE===
diff --git a/ext/standard/tests/math/deg2rad_variation.phpt b/ext/standard/tests/math/deg2rad_variation.phpt
index d5f6920ea7..3e344540a2 100644
--- a/ext/standard/tests/math/deg2rad_variation.phpt
+++ b/ext/standard/tests/math/deg2rad_variation.phpt
@@ -13,24 +13,23 @@ precision = 10
//Test deg2rad with a different input values
$values = array(23,
- -23,
- 2.345e1,
- -2.345e1,
- 0x17,
- 027,
- "23",
- "23.45",
- "2.345e1",
- "nonsense",
- "1000",
- "1000ABC",
- null,
- true,
- false);
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
for ($i = 0; $i < count($values); $i++) {
- $res = deg2rad($values[$i]);
- var_dump($res);
+ $res = deg2rad($values[$i]);
+ var_dump($res);
}
?>
@@ -44,9 +43,6 @@ float(0.401425728)
float(0.401425728)
float(0.4092797096)
float(0.4092797096)
-
-Warning: deg2rad() expects parameter 1 to be float, string given in %s on line %d
-NULL
float(17.45329252)
Notice: A non well formed numeric value encountered in %s on line %d
diff --git a/ext/standard/tests/math/exp_basic.phpt b/ext/standard/tests/math/exp_basic.phpt
index 6d90c9d8a8..b73889153f 100644
--- a/ext/standard/tests/math/exp_basic.phpt
+++ b/ext/standard/tests/math/exp_basic.phpt
@@ -5,28 +5,27 @@ precision=14
--FILE--
<?php
$values = array(10,
- 10.3,
- 3.9505e3,
- 037,
- 0x5F,
- "10",
- "3950.5",
- "3.9505e3",
- "039",
- true,
- false,
- null,
- );
+ 10.3,
+ 3.9505e3,
+ 037,
+ 0x5F,
+ "10",
+ "3950.5",
+ "3.9505e3",
+ "039",
+ true,
+ false,
+ null,
+ );
$iterator = 1;
foreach($values as $value) {
- echo "\n-- Iteration $iterator --\n";
- var_dump(exp($value));
- $iterator++;
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(exp($value));
+ $iterator++;
};
?>
-===Done===
--EXPECT--
-- Iteration 1 --
float(22026.465794807)
@@ -63,4 +62,3 @@ float(1)
-- Iteration 12 --
float(1)
-===Done===
diff --git a/ext/standard/tests/math/exp_basiclong_64bit.phpt b/ext/standard/tests/math/exp_basiclong_64bit.phpt
index 75518548e3..f559b7c576 100644
--- a/ext/standard/tests/math/exp_basiclong_64bit.phpt
+++ b/ext/standard/tests/math/exp_basiclong_64bit.phpt
@@ -25,7 +25,6 @@ foreach ($longVals as $longVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 ---
float(INF)
@@ -57,4 +56,3 @@ float(INF)
float(0)
--- testing: -9.2233720368548E+18 ---
float(0)
-===DONE===
diff --git a/ext/standard/tests/math/expm1_basic.phpt b/ext/standard/tests/math/expm1_basic.phpt
index 5690f4cf6f..296838570c 100644
--- a/ext/standard/tests/math/expm1_basic.phpt
+++ b/ext/standard/tests/math/expm1_basic.phpt
@@ -12,28 +12,27 @@ precision=14
echo "*** Testing expm1() : basic functionality ***\n";
$values = array(10,
- 10.3,
- 3.9505e3,
- 037,
- 0x5F,
- "10",
- "3950.5",
- "3.9505e3",
- "039",
- true,
- false,
- null,
- );
+ 10.3,
+ 3.9505e3,
+ 037,
+ 0x5F,
+ "10",
+ "3950.5",
+ "3.9505e3",
+ "039",
+ true,
+ false,
+ null,
+ );
// loop through each element of $values to check the behaviour of expm1()
$iterator = 1;
foreach($values as $value) {
- echo "\n-- Iteration $iterator --\n";
- var_dump(expm1($value));
- $iterator++;
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(expm1($value));
+ $iterator++;
};
?>
-===Done===
--EXPECT--
*** Testing expm1() : basic functionality ***
@@ -72,4 +71,3 @@ float(0)
-- Iteration 12 --
float(0)
-===Done===
diff --git a/ext/standard/tests/math/expm1_basiclong_64bit.phpt b/ext/standard/tests/math/expm1_basiclong_64bit.phpt
index 9046764d02..835ebc41c1 100644
--- a/ext/standard/tests/math/expm1_basiclong_64bit.phpt
+++ b/ext/standard/tests/math/expm1_basiclong_64bit.phpt
@@ -25,7 +25,6 @@ foreach ($longVals as $longVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 ---
float(INF)
@@ -57,4 +56,3 @@ float(INF)
float(-1)
--- testing: -9.2233720368548E+18 ---
float(-1)
-===DONE===
diff --git a/ext/standard/tests/math/fdiv.phpt b/ext/standard/tests/math/fdiv.phpt
new file mode 100644
index 0000000000..dd50cfdb78
--- /dev/null
+++ b/ext/standard/tests/math/fdiv.phpt
@@ -0,0 +1,78 @@
+--TEST--
+fdiv() function
+--FILE--
+<?php
+
+var_dump(fdiv(10, 3));
+var_dump(fdiv(10., 3.));
+var_dump(fdiv(-10., 2.5));
+var_dump(fdiv(10., -2.5));
+echo "\n";
+var_dump(fdiv(10., 0.));
+var_dump(fdiv(10., -0.));
+var_dump(fdiv(-10., 0.));
+var_dump(fdiv(-10., -0.));
+echo "\n";
+var_dump(fdiv(INF, 0.));
+var_dump(fdiv(INF, -0.));
+var_dump(fdiv(-INF, 0.));
+var_dump(fdiv(-INF, -0.));
+echo "\n";
+var_dump(fdiv(0., 0.));
+var_dump(fdiv(0., -0.));
+var_dump(fdiv(-0., 0.));
+var_dump(fdiv(-0., -0.));
+echo "\n";
+var_dump(fdiv(INF, INF));
+var_dump(fdiv(INF, -INF));
+var_dump(fdiv(-INF, INF));
+var_dump(fdiv(-INF, -INF));
+echo "\n";
+var_dump(fdiv(0., INF));
+var_dump(fdiv(0., -INF));
+var_dump(fdiv(-0., INF));
+var_dump(fdiv(-0., -INF));
+echo "\n";
+var_dump(fdiv(NAN, NAN));
+var_dump(fdiv(INF, NAN));
+var_dump(fdiv(0., NAN));
+var_dump(fdiv(NAN, INF));
+var_dump(fdiv(NAN, 0.));
+
+?>
+--EXPECT--
+float(3.3333333333333)
+float(3.3333333333333)
+float(-4)
+float(-4)
+
+float(INF)
+float(-INF)
+float(-INF)
+float(INF)
+
+float(INF)
+float(-INF)
+float(-INF)
+float(INF)
+
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+
+float(0)
+float(-0)
+float(-0)
+float(0)
+
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
diff --git a/ext/standard/tests/math/floor_basic.phpt b/ext/standard/tests/math/floor_basic.phpt
index 986ee26924..84153af08e 100644
--- a/ext/standard/tests/math/floor_basic.phpt
+++ b/ext/standard/tests/math/floor_basic.phpt
@@ -11,34 +11,33 @@ precision=14
echo "*** Testing floor() : basic functionality ***\n";
$values = array(0,
- -0,
- 0.5,
- -0.5,
- 1,
- -1,
- 1.5,
- -1.5,
- 2.6,
- -2.6,
- 037,
- 0x5F,
- "10.5",
- "-10.5",
- "3.95E3",
- "-3.95E3",
- "039",
- true,
- false,
- null,
- );
+ -0,
+ 0.5,
+ -0.5,
+ 1,
+ -1,
+ 1.5,
+ -1.5,
+ 2.6,
+ -2.6,
+ 037,
+ 0x5F,
+ "10.5",
+ "-10.5",
+ "3.95E3",
+ "-3.95E3",
+ "039",
+ true,
+ false,
+ null,
+ );
foreach($values as $value) {
- echo "\n-- floor $value --\n";
- var_dump(floor($value));
+ echo "\n-- floor $value --\n";
+ var_dump(floor($value));
};
?>
-===Done===
--EXPECT--
*** Testing floor() : basic functionality ***
@@ -101,4 +100,3 @@ float(0)
-- floor --
float(0)
-===Done===
diff --git a/ext/standard/tests/math/floor_basiclong_64bit.phpt b/ext/standard/tests/math/floor_basiclong_64bit.phpt
index 6b768ef90c..3bc4e6393e 100644
--- a/ext/standard/tests/math/floor_basiclong_64bit.phpt
+++ b/ext/standard/tests/math/floor_basiclong_64bit.phpt
@@ -25,7 +25,6 @@ foreach ($longVals as $longVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 ---
float(9.2233720368548E+18)
@@ -57,4 +56,3 @@ float(9.2233720368548E+18)
float(-9.2233720368548E+18)
--- testing: -9.2233720368548E+18 ---
float(-9.2233720368548E+18)
-===DONE===
diff --git a/ext/standard/tests/math/floor_variation1.phpt b/ext/standard/tests/math/floor_variation1.phpt
index aef4c742b9..dd0e70b863 100644
--- a/ext/standard/tests/math/floor_variation1.phpt
+++ b/ext/standard/tests/math/floor_variation1.phpt
@@ -66,14 +66,17 @@ $inputs = array(
// loop through each element of $inputs to check the behaviour of floor()
$iterator = 1;
foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump(floor($input));
- $iterator++;
+ echo "\n-- Iteration $iterator --\n";
+ try {
+ var_dump(floor($input));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ $iterator++;
};
fclose($fp);
?>
-===Done===
---EXPECTF--
+--EXPECT--
*** Testing floor() : usage variations ***
-- Iteration 1 --
@@ -95,27 +98,25 @@ float(1)
float(0)
-- Iteration 7 --
-float(0)
+floor() expects parameter 1 to be int or float, string given
-- Iteration 8 --
-float(0)
+floor() expects parameter 1 to be int or float, string given
-- Iteration 9 --
-bool(false)
+floor() expects parameter 1 to be int or float, array given
-- Iteration 10 --
-float(0)
+floor() expects parameter 1 to be int or float, string given
-- Iteration 11 --
-float(0)
+floor() expects parameter 1 to be int or float, string given
-- Iteration 12 --
-float(0)
+floor() expects parameter 1 to be int or float, string given
-- Iteration 13 --
-
-Notice: Object of class classA could not be converted to number in %s on line %d
-float(1)
+floor() expects parameter 1 to be int or float, object given
-- Iteration 14 --
float(0)
@@ -124,5 +125,4 @@ float(0)
float(0)
-- Iteration 16 --
-float(%f)
-===Done===
+floor() expects parameter 1 to be int or float, resource given
diff --git a/ext/standard/tests/math/fmod_basic.phpt b/ext/standard/tests/math/fmod_basic.phpt
index 875ae8dd05..e7b204f540 100644
--- a/ext/standard/tests/math/fmod_basic.phpt
+++ b/ext/standard/tests/math/fmod_basic.phpt
@@ -5,37 +5,37 @@ precision=14
--FILE--
<?php
$values1 = array(234,
- -234,
- 23.45e1,
- -23.45e1,
- 0xEA,
- 0352,
- "234",
- "234.5",
- "23.45e1",
- null,
- true,
- false);
+ -234,
+ 23.45e1,
+ -23.45e1,
+ 0xEA,
+ 0352,
+ "234",
+ "234.5",
+ "23.45e1",
+ null,
+ true,
+ false);
$values2 = array(2,
- -2,
- 2.3e1,
- -2.3e1,
- 0x2,
- 02,
- "2",
- "2.3",
- "2.3e1",
- null,
- true,
- false);
+ -2,
+ 2.3e1,
+ -2.3e1,
+ 0x2,
+ 02,
+ "2",
+ "2.3",
+ "2.3e1",
+ null,
+ true,
+ false);
for ($i = 0; $i < count($values1); $i++) {
- echo "\niteration ", $i, "\n";
+ echo "\niteration ", $i, "\n";
- for ($j = 0; $j < count($values2); $j++) {
- $res = fmod($values1[$i], $values2[$j]);
- var_dump($res);
- }
+ for ($j = 0; $j < count($values2); $j++) {
+ $res = fmod($values1[$i], $values2[$j]);
+ var_dump($res);
+ }
}
?>
--EXPECT--
diff --git a/ext/standard/tests/math/fmod_basiclong_64bit.phpt b/ext/standard/tests/math/fmod_basiclong_64bit.phpt
index 6513e31159..5ef283689e 100644
--- a/ext/standard/tests/math/fmod_basiclong_64bit.phpt
+++ b/ext/standard/tests/math/fmod_basiclong_64bit.phpt
@@ -23,13 +23,12 @@ $otherVals = array(0, 1, -1, 7, 9, 65, -44, MAX_32Bit, MIN_32Bit, MAX_64Bit, MIN
foreach ($longVals as $longVal) {
foreach($otherVals as $otherVal) {
- echo "--- testing: $longVal, $otherVal ---\n";
+ echo "--- testing: $longVal, $otherVal ---\n";
var_dump(fmod($longVal, $otherVal));
}
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807, 0 ---
float(NAN)
@@ -361,4 +360,3 @@ float(-0)
float(-0)
--- testing: -9.2233720368548E+18, -9223372036854775808 ---
float(-0)
-===DONE===
diff --git a/ext/standard/tests/math/hexdec_basic.phpt b/ext/standard/tests/math/hexdec_basic.phpt
index 0ca2342d81..748c641a1a 100644
--- a/ext/standard/tests/math/hexdec_basic.phpt
+++ b/ext/standard/tests/math/hexdec_basic.phpt
@@ -7,26 +7,26 @@ if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
--FILE--
<?php
$values = array(0x123abc,
- 0x789DEF,
- 0x7FFFFFFF,
- 0x80000000,
- '0x123abc',
- '0x789DEF',
- '0x7FFFFFFF',
- '0x80000000',
- '0x123XYZABC',
- 311015,
- '311015',
- 31101.3,
- 31.1013e5,
- 011237,
- '011237',
- true,
- false,
- null);
+ 0x789DEF,
+ 0x7FFFFFFF,
+ 0x80000000,
+ '0x123abc',
+ '0x789DEF',
+ '0x7FFFFFFF',
+ '0x80000000',
+ '0x123XYZABC',
+ 311015,
+ '311015',
+ 31101.3,
+ 31.1013e5,
+ 011237,
+ '011237',
+ true,
+ false,
+ null);
for ($i = 0; $i < count($values); $i++) {
- $res = hexdec($values[$i]);
- var_dump($res);
+ $res = hexdec($values[$i]);
+ var_dump($res);
}
?>
--EXPECTF--
diff --git a/ext/standard/tests/math/hexdec_basic_64bit.phpt b/ext/standard/tests/math/hexdec_basic_64bit.phpt
index e7b866253f..c7c59451f5 100644
--- a/ext/standard/tests/math/hexdec_basic_64bit.phpt
+++ b/ext/standard/tests/math/hexdec_basic_64bit.phpt
@@ -9,31 +9,30 @@ if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
echo "*** Testing hexdec() : basic functionality ***\n";
$values = array(0x123abc,
- 0x789DEF,
- 0x7FFFFFFF,
- 0x80000000,
- '0x123abc',
- '0x789DEF',
- '0x7FFFFFFF',
- '0x80000000',
- '0x123XYZABC',
- 311015,
- '311015',
- 31101.3,
- 31.1013e5,
- 011237,
- '011237',
- true,
- false,
- null);
+ 0x789DEF,
+ 0x7FFFFFFF,
+ 0x80000000,
+ '0x123abc',
+ '0x789DEF',
+ '0x7FFFFFFF',
+ '0x80000000',
+ '0x123XYZABC',
+ 311015,
+ '311015',
+ 31101.3,
+ 31.1013e5,
+ 011237,
+ '011237',
+ true,
+ false,
+ null);
foreach($values as $value) {
- echo "\n-- hexdec $value --\n";
- var_dump(hexdec($value));
+ echo "\n-- hexdec $value --\n";
+ var_dump(hexdec($value));
};
?>
-===Done===
--EXPECTF--
*** Testing hexdec() : basic functionality ***
@@ -94,4 +93,3 @@ int(0)
-- hexdec --
int(0)
-===Done===
diff --git a/ext/standard/tests/math/hexdec_basiclong_64bit.phpt b/ext/standard/tests/math/hexdec_basiclong_64bit.phpt
index 225e42018b..b378b452eb 100644
--- a/ext/standard/tests/math/hexdec_basiclong_64bit.phpt
+++ b/ext/standard/tests/math/hexdec_basiclong_64bit.phpt
@@ -30,7 +30,6 @@ foreach ($hexLongStrs as $strVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: 7fffffffffffffff ---
int(9223372036854775807)
@@ -48,4 +47,3 @@ float(4.7223664828696E+21)
int(34359738367)
--- testing: fffffffff ---
int(68719476735)
-===DONE===
diff --git a/ext/standard/tests/math/hexdec_variation1.phpt b/ext/standard/tests/math/hexdec_variation1.phpt
index 8f066cb11d..c50c550f61 100644
--- a/ext/standard/tests/math/hexdec_variation1.phpt
+++ b/ext/standard/tests/math/hexdec_variation1.phpt
@@ -76,13 +76,16 @@ $inputs = array(
// loop through each element of $inputs to check the behaviour of hexdec()
$iterator = 1;
foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump(hexdec($input));
- $iterator++;
+ echo "\n-- Iteration $iterator --\n";
+ try {
+ var_dump(hexdec($input));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ $iterator++;
};
fclose($fp);
?>
-===Done===
--EXPECTF--
*** Testing hexdec() : usage variations ***
@@ -154,11 +157,7 @@ int(0)
int(0)
-- Iteration 20 --
-
-Notice: Array to string conversion in %s on line %d
-
-Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
-int(170)
+hexdec() expects parameter 1 to be string, array given
-- Iteration 21 --
@@ -182,7 +181,4 @@ int(0)
int(0)
-- Iteration 26 --
-
-Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
-int(970453)
-===Done===
+hexdec() expects parameter 1 to be string, resource given
diff --git a/ext/standard/tests/math/hexdec_variation1_64bit.phpt b/ext/standard/tests/math/hexdec_variation1_64bit.phpt
index 759997979f..d3b22d8040 100644
--- a/ext/standard/tests/math/hexdec_variation1_64bit.phpt
+++ b/ext/standard/tests/math/hexdec_variation1_64bit.phpt
@@ -76,13 +76,16 @@ $inputs = array(
// loop through each element of $inputs to check the behaviour of hexdec()
$iterator = 1;
foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump(hexdec($input));
- $iterator++;
+ echo "\n-- Iteration $iterator --\n";
+ try {
+ var_dump(hexdec($input));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ $iterator++;
};
fclose($fp);
?>
-===Done===
--EXPECTF--
*** Testing hexdec() : usage variations ***
@@ -154,11 +157,7 @@ int(0)
int(0)
-- Iteration 20 --
-
-Notice: Array to string conversion in %s on line %d
-
-Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
-int(170)
+hexdec() expects parameter 1 to be string, array given
-- Iteration 21 --
@@ -182,7 +181,4 @@ int(0)
int(0)
-- Iteration 26 --
-
-Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
-int(970453)
-===Done===
+hexdec() expects parameter 1 to be string, resource given
diff --git a/ext/standard/tests/math/hypot_basic.phpt b/ext/standard/tests/math/hypot_basic.phpt
index c09dd51da5..f9e5787f40 100644
--- a/ext/standard/tests/math/hypot_basic.phpt
+++ b/ext/standard/tests/math/hypot_basic.phpt
@@ -13,42 +13,41 @@ precision=14
echo "*** Testing hypot() : basic functionality ***\n";
$valuesy = array(23,
- -23,
- 2.345e1,
- -2.345e1,
- 0x17,
- 027,
- "23",
- "23.45",
- "2.345e1",
- "23abc",
- null,
- true,
- false);
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "23abc",
+ null,
+ true,
+ false);
$valuesx = array(33,
- -33,
- 3.345e1,
- -3.345e1,
- 0x27,
- 037,
- "33",
- "43.45",
- "1.345e1",
- "33abc",
- null,
- true,
- false);
+ -33,
+ 3.345e1,
+ -3.345e1,
+ 0x27,
+ 037,
+ "33",
+ "43.45",
+ "1.345e1",
+ "33abc",
+ null,
+ true,
+ false);
for ($i = 0; $i < count($valuesy); $i++) {
- for ($j = 0; $j < count($valuesx); $j++) {
- echo "\nY:$valuesy[$i] X:$valuesx[$j] ";
- $res = hypot($valuesy[$i], $valuesx[$j]);
- var_dump($res);
- }
+ for ($j = 0; $j < count($valuesx); $j++) {
+ echo "\nY:$valuesy[$i] X:$valuesx[$j] ";
+ $res = hypot($valuesy[$i], $valuesx[$j]);
+ var_dump($res);
+ }
}
?>
-===Done===
--EXPECTF--
*** Testing hypot() : basic functionality ***
@@ -441,4 +440,3 @@ Y: X: float(0)
Y: X:1 float(1)
Y: X: float(0)
-===Done===
diff --git a/ext/standard/tests/math/hypot_basiclong_64bit.phpt b/ext/standard/tests/math/hypot_basiclong_64bit.phpt
index 3bbfcb4afc..1e1ca60996 100644
--- a/ext/standard/tests/math/hypot_basiclong_64bit.phpt
+++ b/ext/standard/tests/math/hypot_basiclong_64bit.phpt
@@ -23,13 +23,12 @@ $otherVals = array(0, 1, -1, 7, 9, 65, -44, MAX_32Bit, MIN_32Bit, MAX_64Bit, MIN
foreach ($longVals as $longVal) {
foreach($otherVals as $otherVal) {
- echo "--- testing: $longVal, $otherVal ---\n";
+ echo "--- testing: $longVal, $otherVal ---\n";
var_dump(hypot($longVal, $otherVal));
}
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807, 0 ---
float(9.2233720368548E+18)
@@ -361,4 +360,3 @@ float(9.2233720368548E+18)
float(1.3043817825333E+19)
--- testing: -9.2233720368548E+18, -9223372036854775808 ---
float(1.3043817825333E+19)
-===DONE===
diff --git a/ext/standard/tests/math/is_finite_basic.phpt b/ext/standard/tests/math/is_finite_basic.phpt
index 11db785ae4..9ee9d544e3 100644
--- a/ext/standard/tests/math/is_finite_basic.phpt
+++ b/ext/standard/tests/math/is_finite_basic.phpt
@@ -3,23 +3,23 @@ Test is_finite() - basic function test is_finite()
--FILE--
<?php
$values = array(234,
- -234,
- 23.45e1,
- -23.45e1,
- 0xEA,
- 0352,
- "234",
- "234.5",
- "23.45e1",
- null,
- true,
- false,
- pow(0, -2),
- acos(1.01));
+ -234,
+ 23.45e1,
+ -23.45e1,
+ 0xEA,
+ 0352,
+ "234",
+ "234.5",
+ "23.45e1",
+ null,
+ true,
+ false,
+ pow(0, -2),
+ acos(1.01));
;
for ($i = 0; $i < count($values); $i++) {
- $res = is_finite($values[$i]);
- var_dump($res);
+ $res = is_finite($values[$i]);
+ var_dump($res);
}
?>
--EXPECT--
diff --git a/ext/standard/tests/math/is_finite_basiclong_64bit.phpt b/ext/standard/tests/math/is_finite_basiclong_64bit.phpt
index 201d8473fa..b8e4b63f17 100644
--- a/ext/standard/tests/math/is_finite_basiclong_64bit.phpt
+++ b/ext/standard/tests/math/is_finite_basiclong_64bit.phpt
@@ -25,7 +25,6 @@ foreach ($longVals as $longVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 ---
bool(true)
@@ -57,4 +56,3 @@ bool(true)
bool(true)
--- testing: -9.2233720368548E+18 ---
bool(true)
-===DONE===
diff --git a/ext/standard/tests/math/is_infinite_basic.phpt b/ext/standard/tests/math/is_infinite_basic.phpt
index 4f90340311..076f202c14 100644
--- a/ext/standard/tests/math/is_infinite_basic.phpt
+++ b/ext/standard/tests/math/is_infinite_basic.phpt
@@ -3,23 +3,23 @@ Test is_infinite() - basic function test is_infinite()
--FILE--
<?php
$values = array(234,
- -234,
- 23.45e1,
- -23.45e1,
- 0xEA,
- 0352,
- "234",
- "234.5",
- "23.45e1",
- null,
- true,
- false,
- pow(0, -2),
- acos(1.01));
+ -234,
+ 23.45e1,
+ -23.45e1,
+ 0xEA,
+ 0352,
+ "234",
+ "234.5",
+ "23.45e1",
+ null,
+ true,
+ false,
+ pow(0, -2),
+ acos(1.01));
;
for ($i = 0; $i < count($values); $i++) {
- $res = is_infinite($values[$i]);
- var_dump($res);
+ $res = is_infinite($values[$i]);
+ var_dump($res);
}
?>
--EXPECT--
diff --git a/ext/standard/tests/math/is_infinite_basiclong_64bit.phpt b/ext/standard/tests/math/is_infinite_basiclong_64bit.phpt
index ca53b77f0c..d6bd27c8a3 100644
--- a/ext/standard/tests/math/is_infinite_basiclong_64bit.phpt
+++ b/ext/standard/tests/math/is_infinite_basiclong_64bit.phpt
@@ -25,7 +25,6 @@ foreach ($longVals as $longVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 ---
bool(false)
@@ -57,4 +56,3 @@ bool(false)
bool(false)
--- testing: -9.2233720368548E+18 ---
bool(false)
-===DONE===
diff --git a/ext/standard/tests/math/is_nan_basic.phpt b/ext/standard/tests/math/is_nan_basic.phpt
index 49d2ce4ccf..fabc40b97b 100644
--- a/ext/standard/tests/math/is_nan_basic.phpt
+++ b/ext/standard/tests/math/is_nan_basic.phpt
@@ -3,24 +3,24 @@ Test is_nan() - basic function test is_nan()
--FILE--
<?php
$values = array(234,
- -234,
- 23.45e1,
- -23.45e1,
- 0xEA,
- 0352,
- "234",
- "234.5",
- "23.45e1",
- null,
- true,
- false,
- pow(0, -2),
- acos(1.01));
+ -234,
+ 23.45e1,
+ -23.45e1,
+ 0xEA,
+ 0352,
+ "234",
+ "234.5",
+ "23.45e1",
+ null,
+ true,
+ false,
+ pow(0, -2),
+ acos(1.01));
for ($i = 0; $i < count($values); $i++) {
- $res = is_nan($values[$i]);
- var_dump($res);
+ $res = is_nan($values[$i]);
+ var_dump($res);
}
?>
diff --git a/ext/standard/tests/math/is_nan_basiclong_64bit.phpt b/ext/standard/tests/math/is_nan_basiclong_64bit.phpt
index ca85db1660..2da97f592c 100644
--- a/ext/standard/tests/math/is_nan_basiclong_64bit.phpt
+++ b/ext/standard/tests/math/is_nan_basiclong_64bit.phpt
@@ -25,7 +25,6 @@ foreach ($longVals as $longVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 ---
bool(false)
@@ -57,4 +56,3 @@ bool(false)
bool(false)
--- testing: -9.2233720368548E+18 ---
bool(false)
-===DONE===
diff --git a/ext/standard/tests/math/lcg_value_basic.phpt b/ext/standard/tests/math/lcg_value_basic.phpt
index 44304f2475..95811c6f3c 100644
--- a/ext/standard/tests/math/lcg_value_basic.phpt
+++ b/ext/standard/tests/math/lcg_value_basic.phpt
@@ -8,33 +8,17 @@ echo "MATHS test script started\n";
echo "\n lcg_value tests...\n";
for ($i = 0; $i < 100; $i++) {
- $res = lcg_value();
+ $res = lcg_value();
- if (!is_float($res) || $res < 0 || $res > 1) {
- break;
- }
+ if (!is_float($res) || $res < 0 || $res > 1) {
+ break;
+ }
}
if ($i != 100) {
- echo "FAILED\n";
+ echo "FAILED\n";
} else {
- echo "PASSED\n";
-}
-
-echo "\n lcg_value error cases..\n";
-$res = lcg_value(23);
-
-if (is_null($res)) {
- echo "PASSED\n";
-} else {
- echo "FAILED\n";
-}
-
-$res = lcg_value(10,false);
-if (is_null($res)) {
- echo "PASSED\n";
-} else {
- echo "FAILED\n";
+ echo "PASSED\n";
}
echo "MATHS test script completed\n";
@@ -45,12 +29,4 @@ MATHS test script started
lcg_value tests...
PASSED
-
- lcg_value error cases..
-
-Warning: lcg_value() expects exactly 0 parameters, 1 given in %slcg_value_basic.php on line %d
-PASSED
-
-Warning: lcg_value() expects exactly 0 parameters, 2 given in %slcg_value_basic.php on line %d
-PASSED
MATHS test script completed
diff --git a/ext/standard/tests/math/log10_basic.phpt b/ext/standard/tests/math/log10_basic.phpt
index b81284faf2..0997d3db4b 100644
--- a/ext/standard/tests/math/log10_basic.phpt
+++ b/ext/standard/tests/math/log10_basic.phpt
@@ -20,30 +20,30 @@ echo "log10 $arg_0 = ";
$r0 = log10($arg_0);
var_dump($r0);
if (allowed_rounding_error($r0 ,0.0 )) {
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
echo "log10 $arg_1 = ";
$r1 = log10($arg_1);
var_dump($r1);
if (allowed_rounding_error($r1 ,1.0 )) {
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
echo "log10 $arg_2 = ";
$r2 = log10($arg_2);
var_dump($r2);
if (allowed_rounding_error($r2 ,2.0 )) {
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
?>
--EXPECTF--
diff --git a/ext/standard/tests/math/log10_basiclong_64bit.phpt b/ext/standard/tests/math/log10_basiclong_64bit.phpt
index 2eb2d544b6..ef00d37d02 100644
--- a/ext/standard/tests/math/log10_basiclong_64bit.phpt
+++ b/ext/standard/tests/math/log10_basiclong_64bit.phpt
@@ -25,7 +25,6 @@ foreach ($longVals as $longVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 ---
float(18.964889726831)
@@ -57,4 +56,3 @@ float(18.964889726831)
float(NAN)
--- testing: -9.2233720368548E+18 ---
float(NAN)
-===DONE===
diff --git a/ext/standard/tests/math/log10_variation.phpt b/ext/standard/tests/math/log10_variation.phpt
index 5304325952..e852d82ea9 100644
--- a/ext/standard/tests/math/log10_variation.phpt
+++ b/ext/standard/tests/math/log10_variation.phpt
@@ -13,24 +13,23 @@ precision = 10
//Test log10 with a different input values
$values = array(23,
- -23,
- 2.345e1,
- -2.345e1,
- 0x17,
- 027,
- "23",
- "23.45",
- "2.345e1",
- "nonsense",
- "1000",
- "1000ABC",
- null,
- true,
- false);
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
for ($i = 0; $i < count($values); $i++) {
- $res = log10($values[$i]);
- var_dump($res);
+ $res = log10($values[$i]);
+ var_dump($res);
}
?>
@@ -44,9 +43,6 @@ float(1.361727836)
float(1.361727836)
float(1.370142847)
float(1.370142847)
-
-Warning: log10() expects parameter 1 to be float, string given in %s on line %d
-NULL
float(3)
Notice: A non well formed numeric value encountered in %s on line %d
diff --git a/ext/standard/tests/math/log1p_basic.phpt b/ext/standard/tests/math/log1p_basic.phpt
index 61a0c3d839..115deec1d9 100644
--- a/ext/standard/tests/math/log1p_basic.phpt
+++ b/ext/standard/tests/math/log1p_basic.phpt
@@ -13,28 +13,27 @@ precision=14
echo "*** Testing log1p() : basic functionality ***\n";
$values = array(23,
- -23,
- 2.345e1,
- -2.345e1,
- 0x17,
- 027,
- "23",
- "23.45",
- "2.345e1",
- null,
- true,
- false);
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ null,
+ true,
+ false);
echo "\n LOG1p tests\n";
foreach($values as $value) {
- echo "\n-- log1p $value --\n";
- var_dump(log1p($value));
+ echo "\n-- log1p $value --\n";
+ var_dump(log1p($value));
};
?>
-===Done===
--EXPECT--
*** Testing log1p() : basic functionality ***
@@ -75,4 +74,3 @@ float(0.69314718055995)
-- log1p --
float(0)
-===Done===
diff --git a/ext/standard/tests/math/log1p_basiclong_64bit.phpt b/ext/standard/tests/math/log1p_basiclong_64bit.phpt
index 05580ff731..be6f8aa3a2 100644
--- a/ext/standard/tests/math/log1p_basiclong_64bit.phpt
+++ b/ext/standard/tests/math/log1p_basiclong_64bit.phpt
@@ -25,7 +25,6 @@ foreach ($longVals as $longVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 ---
float(43.668272375277)
@@ -57,4 +56,3 @@ float(43.668272375277)
float(NAN)
--- testing: -9.2233720368548E+18 ---
float(NAN)
-===DONE===
diff --git a/ext/standard/tests/math/log_basic.phpt b/ext/standard/tests/math/log_basic.phpt
index de97ee264b..8ff1c88ccf 100644
--- a/ext/standard/tests/math/log_basic.phpt
+++ b/ext/standard/tests/math/log_basic.phpt
@@ -5,28 +5,28 @@ precision=14
--FILE--
<?php
$values = array(23,
- -23,
- 2.345e1,
- -2.345e1,
- 0x17,
- 027,
- "23",
- "23.45",
- "2.345e1",
- null,
- true,
- false);
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ null,
+ true,
+ false);
echo "\n LOG tests...no base\n";
for ($i = 0; $i < count($values); $i++) {
- $res = log($values[$i]);
- var_dump($res);
+ $res = log($values[$i]);
+ var_dump($res);
}
echo "\n LOG tests...base\n";
for ($i = 0; $i < count($values); $i++) {
- $res = log($values[$i], 4);
- var_dump($res);
+ $res = log($values[$i], 4);
+ var_dump($res);
}
?>
--EXPECT--
diff --git a/ext/standard/tests/math/log_basiclong_64bit.phpt b/ext/standard/tests/math/log_basiclong_64bit.phpt
index 5259899323..c0598fed8b 100644
--- a/ext/standard/tests/math/log_basiclong_64bit.phpt
+++ b/ext/standard/tests/math/log_basiclong_64bit.phpt
@@ -25,7 +25,6 @@ foreach ($longVals as $longVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 ---
float(43.668272375277)
@@ -57,4 +56,3 @@ float(43.668272375277)
float(NAN)
--- testing: -9.2233720368548E+18 ---
float(NAN)
-===DONE===
diff --git a/ext/standard/tests/math/log_error.phpt b/ext/standard/tests/math/log_error.phpt
index 48a23df3c0..b49ccacf6d 100644
--- a/ext/standard/tests/math/log_error.phpt
+++ b/ext/standard/tests/math/log_error.phpt
@@ -4,13 +4,11 @@ Test log() - wrong params test log()
precision=14
--FILE--
<?php
-log();
-log(36,4,true);
-log(36, -4);
+try {
+ log(36, -4);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
?>
---EXPECTF--
-Warning: log() expects at least 1 parameter, 0 given in %s on line %d
-
-Warning: log() expects at most 2 parameters, 3 given in %s on line %d
-
-Warning: log(): base must be greater than 0 in %s on line %d
+--EXPECT--
+Base must be greater than 0
diff --git a/ext/standard/tests/math/mt_rand_basic.phpt b/ext/standard/tests/math/mt_rand_basic.phpt
index 3a1e4406eb..24050bbc8a 100644
--- a/ext/standard/tests/math/mt_rand_basic.phpt
+++ b/ext/standard/tests/math/mt_rand_basic.phpt
@@ -6,77 +6,77 @@ $default_max = mt_getrandmax();
echo "\nmt_rand() tests with default min and max value (i.e 0 thru ", $default_max, ")\n";
for ($i = 0; $i < 100; $i++) {
- $res = mt_rand();
+ $res = mt_rand();
// By default RAND_MAX is 32768 although no constant is defined for it for user space apps
- if (!is_int($res) || $res < 0 || $res > $default_max) {
- break;
- }
+ if (!is_int($res) || $res < 0 || $res > $default_max) {
+ break;
+ }
}
if ($i != 100) {
- echo "FAILED: res = ", $res, " min = 0 max = ", $default_max, "\n";
+ echo "FAILED: res = ", $res, " min = 0 max = ", $default_max, "\n";
} else {
- echo "PASSED: range min = 0 max = ", $default_max, "\n";
+ echo "PASSED: range min = 0 max = ", $default_max, "\n";
}
echo "\nmt_rand() tests with defined min and max value\n";
$min = array(10,
- 100,
- 10.5,
- 10.5e3,
- 0x10,
- 0400);
+ 100,
+ 10.5,
+ 10.5e3,
+ 0x10,
+ 0400);
$max = array(100,
- 1000,
- 19.5,
- 10.5e5,
- 0x10000,
- 0700);
+ 1000,
+ 19.5,
+ 10.5e5,
+ 0x10000,
+ 0700);
for ($x = 0; $x < count($min); $x++) {
- for ($i = 0; $i < 100; $i++) {
- $res = mt_rand($min[$x], $max[$x]);
+ for ($i = 0; $i < 100; $i++) {
+ $res = mt_rand($min[$x], $max[$x]);
- if (!is_int($res) || $res < intval($min[$x]) || $res > intval($max[$x])) {
- echo "FAILED: res = ", $res, " min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n";
- break;
- }
- }
+ if (!is_int($res) || $res < intval($min[$x]) || $res > intval($max[$x])) {
+ echo "FAILED: res = ", $res, " min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n";
+ break;
+ }
+ }
- if ($i == 100) {
- echo "PASSED: range min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n";
- }
+ if ($i == 100) {
+ echo "PASSED: range min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n";
+ }
}
echo "\nNon-numeric cases\n";
$min = array(true,
- false,
- null,
- "10",
- "10.5");
+ false,
+ null,
+ "10",
+ "10.5");
// Expected numerical equivalent of above non-numerics
$minval = array(1,
- 0,
- 0,
- 10,
- 10);
+ 0,
+ 0,
+ 10,
+ 10);
for ($x = 0; $x < count($min); $x++) {
- for ($i = 0; $i < 100; $i++) {
- $res = mt_rand($min[$x], 100);
+ for ($i = 0; $i < 100; $i++) {
+ $res = mt_rand($min[$x], 100);
- if (!is_int($res) || $res < intval($minval[$x]) || $res > 100) {
- echo "FAILED: res = ", $res, " min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n";
- break;
- }
- }
+ if (!is_int($res) || $res < intval($minval[$x]) || $res > 100) {
+ echo "FAILED: res = ", $res, " min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n";
+ break;
+ }
+ }
- if ($i == 100) {
- echo "PASSED range min = ", intval($min[$x]), " max = 100\n";
- }
+ if ($i == 100) {
+ echo "PASSED range min = ", intval($min[$x]), " max = 100\n";
+ }
}
?>
--EXPECT--
diff --git a/ext/standard/tests/math/number_format_basic.phpt b/ext/standard/tests/math/number_format_basic.phpt
index 5a2570126a..b82ad5c753 100644
--- a/ext/standard/tests/math/number_format_basic.phpt
+++ b/ext/standard/tests/math/number_format_basic.phpt
@@ -3,40 +3,40 @@ Test number_format() - basic function test number_format()
--FILE--
<?php
$values = array(1234.5678,
- -1234.5678,
- 1234.6578e4,
- -1234.56789e4,
- 0x1234CDEF,
- 02777777777,
- "123456789",
- "123.456789",
- "12.3456789e1",
- null,
- true,
- false);
+ -1234.5678,
+ 1234.6578e4,
+ -1234.56789e4,
+ 0x1234CDEF,
+ 02777777777,
+ "123456789",
+ "123.456789",
+ "12.3456789e1",
+ null,
+ true,
+ false);
echo "\n number_format tests.....default\n";
for ($i = 0; $i < count($values); $i++) {
- $res = number_format($values[$i]);
- var_dump($res);
+ $res = number_format($values[$i]);
+ var_dump($res);
}
echo "\n number_format tests.....with two dp\n";
for ($i = 0; $i < count($values); $i++) {
- $res = number_format($values[$i], 2);
- var_dump($res);
+ $res = number_format($values[$i], 2);
+ var_dump($res);
}
echo "\n number_format tests.....English format\n";
for ($i = 0; $i < count($values); $i++) {
- $res = number_format($values[$i], 2, '.', ' ');
- var_dump($res);
+ $res = number_format($values[$i], 2, '.', ' ');
+ var_dump($res);
}
echo "\n number_format tests.....French format\n";
for ($i = 0; $i < count($values); $i++) {
- $res = number_format($values[$i], 2, ',' , ' ');
- var_dump($res);
+ $res = number_format($values[$i], 2, ',' , ' ');
+ var_dump($res);
}
?>
--EXPECT--
diff --git a/ext/standard/tests/math/number_format_multichar.phpt b/ext/standard/tests/math/number_format_multichar.phpt
index b12c81c1a2..5648257e03 100644
--- a/ext/standard/tests/math/number_format_multichar.phpt
+++ b/ext/standard/tests/math/number_format_multichar.phpt
@@ -3,34 +3,34 @@ Test number_format() - multiple character separator support
--FILE--
<?php
$values = array(1234.5678,
- -1234.5678,
- 1234.6578e4,
- -1234.56789e4,
- 0x1234CDEF,
- 02777777777,
- "123456789",
- "123.456789",
- "12.3456789e1",
- null,
- true,
- false);
+ -1234.5678,
+ 1234.6578e4,
+ -1234.56789e4,
+ 0x1234CDEF,
+ 02777777777,
+ "123456789",
+ "123.456789",
+ "12.3456789e1",
+ null,
+ true,
+ false);
echo " number_format tests.....multiple character decimal point\n";
for ($i = 0; $i < count($values); $i++) {
- $res = number_format($values[$i], 2, '&#183;', ' ');
- var_dump($res);
+ $res = number_format($values[$i], 2, '&#183;', ' ');
+ var_dump($res);
}
echo "\n number_format tests.....multiple character thousand separator\n";
for ($i = 0; $i < count($values); $i++) {
- $res = number_format($values[$i], 2, '.' , '&thinsp;');
- var_dump($res);
+ $res = number_format($values[$i], 2, '.' , '&thinsp;');
+ var_dump($res);
}
echo "\n number_format tests.....multiple character decimal and thousep\n";
for ($i = 0; $i < count($values); $i++) {
- $res = number_format($values[$i], 2, '&#183;' , '&thinsp;');
- var_dump($res);
+ $res = number_format($values[$i], 2, '&#183;' , '&thinsp;');
+ var_dump($res);
}
?>
--EXPECT--
diff --git a/ext/standard/tests/math/octdec_basic.phpt b/ext/standard/tests/math/octdec_basic.phpt
index c31af55673..1daf9a4338 100644
--- a/ext/standard/tests/math/octdec_basic.phpt
+++ b/ext/standard/tests/math/octdec_basic.phpt
@@ -7,26 +7,26 @@ if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
--FILE--
<?php
$values = array(01234567,
- 0567,
- 017777777777,
- 020000000000,
- 0x1234ABC,
- 12345,
- '01234567',
- '0567',
- '017777777777',
- '020000000000',
- '0x1234ABC',
- '12345',
- 31101.3,
- 31.1013e5,
- true,
- false,
- null);
+ 0567,
+ 017777777777,
+ 020000000000,
+ 0x1234ABC,
+ 12345,
+ '01234567',
+ '0567',
+ '017777777777',
+ '020000000000',
+ '0x1234ABC',
+ '12345',
+ 31101.3,
+ 31.1013e5,
+ true,
+ false,
+ null);
for ($i = 0; $i < count($values); $i++) {
- $res = octdec($values[$i]);
- var_dump($res);
+ $res = octdec($values[$i]);
+ var_dump($res);
}
?>
--EXPECTF--
diff --git a/ext/standard/tests/math/octdec_basic_64bit.phpt b/ext/standard/tests/math/octdec_basic_64bit.phpt
index 6fd0b366b8..bb8f70085d 100644
--- a/ext/standard/tests/math/octdec_basic_64bit.phpt
+++ b/ext/standard/tests/math/octdec_basic_64bit.phpt
@@ -10,29 +10,28 @@ if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
echo "*** Testing octdec() : basic functionality ***\n";
$values = array(01234567,
- 0567,
- 017777777777,
- 020000000000,
- 0x1234ABC,
- 12345,
- '01234567',
- '0567',
- '017777777777',
- '020000000000',
- '0x1234ABC',
- '12345',
- 31101.3,
- 31.1013e5,
- true,
- false,
- null);
+ 0567,
+ 017777777777,
+ 020000000000,
+ 0x1234ABC,
+ 12345,
+ '01234567',
+ '0567',
+ '017777777777',
+ '020000000000',
+ '0x1234ABC',
+ '12345',
+ 31101.3,
+ 31.1013e5,
+ true,
+ false,
+ null);
for ($i = 0; $i < count($values); $i++) {
- $res = octdec($values[$i]);
- var_dump($res);
+ $res = octdec($values[$i]);
+ var_dump($res);
}
?>
-===Done===
--EXPECTF--
*** Testing octdec() : basic functionality ***
@@ -64,4 +63,3 @@ int(823384)
int(1)
int(0)
int(0)
-===Done===
diff --git a/ext/standard/tests/math/octdec_basiclong_64bit.phpt b/ext/standard/tests/math/octdec_basiclong_64bit.phpt
index 4a97a6f414..4e9d88def6 100644
--- a/ext/standard/tests/math/octdec_basiclong_64bit.phpt
+++ b/ext/standard/tests/math/octdec_basiclong_64bit.phpt
@@ -30,7 +30,6 @@ foreach ($octLongStrs as $strVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: 777777777777777777777 ---
int(9223372036854775807)
@@ -48,4 +47,3 @@ float(7.5557863725914E+22)
int(34359738367)
--- testing: 777777777777 ---
int(68719476735)
-===DONE===
diff --git a/ext/standard/tests/math/octdec_variation1.phpt b/ext/standard/tests/math/octdec_variation1.phpt
index 84be45dbb3..48e4faf466 100644
--- a/ext/standard/tests/math/octdec_variation1.phpt
+++ b/ext/standard/tests/math/octdec_variation1.phpt
@@ -72,9 +72,13 @@ $inputs = array(
// loop through each element of $inputs to check the behaviour of octdec()
$iterator = 1;
foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump(octdec($input));
- $iterator++;
+ echo "\n-- Iteration $iterator --\n";
+ try {
+ var_dump(octdec($input));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ $iterator++;
};
fclose($fp);
?>
@@ -156,11 +160,7 @@ int(0)
int(0)
-- Iteration 20 --
-
-Notice: Array to string conversion in %s on line %d
-
-Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
-int(0)
+octdec() expects parameter 1 to be string, array given
-- Iteration 21 --
@@ -184,7 +184,5 @@ int(0)
int(0)
-- Iteration 26 --
-
-Deprecated: Invalid characters passed for attempted conversion, these have been ignored in %s on line %d
-int(5)
+octdec() expects parameter 1 to be string, resource given
---Done---
diff --git a/ext/standard/tests/math/pow.phpt b/ext/standard/tests/math/pow.phpt
index 534ecbd58f..e8ee73135e 100644
--- a/ext/standard/tests/math/pow.phpt
+++ b/ext/standard/tests/math/pow.phpt
@@ -6,7 +6,7 @@ Various pow() tests
define('LONG_MAX', is_int(5000000000)? 9223372036854775807 : 0x7FFFFFFF);
define('LONG_MIN', -LONG_MAX - 1);
printf("%d,%d,%d,%d\n",is_int(LONG_MIN ),is_int(LONG_MAX ),
- is_int(LONG_MIN-1),is_int(LONG_MAX+1));
+ is_int(LONG_MIN-1),is_int(LONG_MAX+1));
$tests = <<<TESTS
0.25 === pow(-2,-2)
diff --git a/ext/standard/tests/math/pow_basic.phpt b/ext/standard/tests/math/pow_basic.phpt
index 3a719ada08..bc594b27c6 100644
--- a/ext/standard/tests/math/pow_basic.phpt
+++ b/ext/standard/tests/math/pow_basic.phpt
@@ -9,18 +9,18 @@ if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
--FILE--
<?php
$bases = array(23,
- -23,
- 23.1,
- -23.1,
- 2.345e1,
- -2.345e1,
- 0x17,
- 027,
- "23",
- "23.45",
- "2.345e1",
- PHP_INT_MAX,
- -PHP_INT_MAX - 1);
+ -23,
+ 23.1,
+ -23.1,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ PHP_INT_MAX,
+ -PHP_INT_MAX - 1);
$exponents = array(0,
1,
@@ -34,19 +34,18 @@ $exponents = array(0,
500,
-500,
2147483647,
- -2147483648);
+ -2147483648);
foreach($bases as $base) {
- echo "\n\nBase = $base";
- foreach($exponents as $exponent) {
- echo "\n..... Exponent = $exponent Result = ";
- $res = pow($base, $exponent);
- echo $res;
- }
- echo "\n\n";
+ echo "\n\nBase = $base";
+ foreach($exponents as $exponent) {
+ echo "\n..... Exponent = $exponent Result = ";
+ $res = pow($base, $exponent);
+ echo $res;
+ }
+ echo "\n\n";
}
?>
-===Done===
--EXPECT--
Base = 23
..... Exponent = 0 Result = 1
@@ -267,4 +266,3 @@ Base = -2147483648
..... Exponent = 2147483647 Result = -INF
..... Exponent = -2147483648 Result = 0
-===Done===
diff --git a/ext/standard/tests/math/pow_basic2.phpt b/ext/standard/tests/math/pow_basic2.phpt
index 8dfb487639..bb5a25520d 100644
--- a/ext/standard/tests/math/pow_basic2.phpt
+++ b/ext/standard/tests/math/pow_basic2.phpt
@@ -26,7 +26,6 @@ var_dump(pow(-24, $large_exp+1));
var_dump(pow(-0.24, -$large_exp+1));
?>
-===Done===
--EXPECTF--
-- The following all result in INF --
float(INF)
@@ -48,4 +47,3 @@ float(%s)
-- The following all result in -INF --
float(-INF)
float(-INF)
-===Done===
diff --git a/ext/standard/tests/math/pow_basic_64bit.phpt b/ext/standard/tests/math/pow_basic_64bit.phpt
index 512efd034c..95ecd8c487 100644
--- a/ext/standard/tests/math/pow_basic_64bit.phpt
+++ b/ext/standard/tests/math/pow_basic_64bit.phpt
@@ -9,18 +9,18 @@ if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
--FILE--
<?php
$bases = array(23,
- -23,
- 23.1,
- -23.1,
- 2.345e1,
- -2.345e1,
- 0x17,
- 027,
- "23",
- "23.45",
- "2.345e1",
- PHP_INT_MAX,
- -PHP_INT_MAX - 1);
+ -23,
+ 23.1,
+ -23.1,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ PHP_INT_MAX,
+ -PHP_INT_MAX - 1);
$exponents = array(0,
1,
@@ -34,19 +34,18 @@ $exponents = array(0,
500,
-500,
2147483647,
- -2147483648);
+ -2147483648);
foreach($bases as $base) {
- echo "\n\nBase = $base";
- foreach($exponents as $exponent) {
- echo "\n..... Exponent = $exponent Result = ";
- $res = pow($base, $exponent);
- echo $res;
- }
- echo "\n\n";
+ echo "\n\nBase = $base";
+ foreach($exponents as $exponent) {
+ echo "\n..... Exponent = $exponent Result = ";
+ $res = pow($base, $exponent);
+ echo $res;
+ }
+ echo "\n\n";
}
?>
-===Done===
--EXPECT--
Base = 23
..... Exponent = 0 Result = 1
@@ -267,4 +266,3 @@ Base = -9223372036854775808
..... Exponent = 2147483647 Result = -INF
..... Exponent = -2147483648 Result = 0
-===Done===
diff --git a/ext/standard/tests/math/pow_basiclong_64bit.phpt b/ext/standard/tests/math/pow_basiclong_64bit.phpt
index 722b01c0c7..d955edfcf3 100644
--- a/ext/standard/tests/math/pow_basiclong_64bit.phpt
+++ b/ext/standard/tests/math/pow_basiclong_64bit.phpt
@@ -23,13 +23,12 @@ $otherVals = array(0, 1, -1, 7, 9, 65, -44, MAX_32Bit, MIN_32Bit, MAX_64Bit, MIN
foreach ($longVals as $longVal) {
foreach($otherVals as $otherVal) {
- echo "--- testing: $longVal, $otherVal ---\n";
+ echo "--- testing: $longVal, $otherVal ---\n";
var_dump(pow($longVal, $otherVal));
}
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807, 0 ---
int(1)
@@ -361,4 +360,3 @@ float(0)
float(INF)
--- testing: -9.2233720368548E+18, -9223372036854775808 ---
float(0)
-===DONE===
diff --git a/ext/standard/tests/math/pow_variation1.phpt b/ext/standard/tests/math/pow_variation1.phpt
index a3e13d861c..e005ced560 100644
--- a/ext/standard/tests/math/pow_variation1.phpt
+++ b/ext/standard/tests/math/pow_variation1.phpt
@@ -84,13 +84,16 @@ $inputs = array(
// loop through each element of $inputs to check the behaviour of pow()
$iterator = 1;
foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump(pow($input, 3));
- $iterator++;
+ echo "\n-- Iteration $iterator --\n";
+ try {
+ var_dump(pow($input, 3));
+ } catch (Error $e) {
+ echo $e->getMessage(), "\n";
+ }
+ $iterator++;
};
fclose($fp);
?>
-===Done===
--EXPECTF--
*** Testing pow() : usage variations ***
@@ -153,7 +156,7 @@ Warning: A non-numeric value encountered in %s on line %d
int(0)
-- Iteration 19 --
-int(0)
+Unsupported operand types
-- Iteration 20 --
@@ -183,4 +186,3 @@ int(0)
-- Iteration 26 --
%s
-===Done===
diff --git a/ext/standard/tests/math/pow_variation1_64bit.phpt b/ext/standard/tests/math/pow_variation1_64bit.phpt
index 0d8b1960be..636c65eabf 100644
--- a/ext/standard/tests/math/pow_variation1_64bit.phpt
+++ b/ext/standard/tests/math/pow_variation1_64bit.phpt
@@ -84,13 +84,16 @@ $inputs = array(
// loop through each element of $inputs to check the behaviour of pow()
$iterator = 1;
foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump(pow($input, 3));
- $iterator++;
+ echo "\n-- Iteration $iterator --\n";
+ try {
+ var_dump(pow($input, 3));
+ } catch (Error $e) {
+ echo $e->getMessage(), "\n";
+ }
+ $iterator++;
};
fclose($fp);
?>
-===Done===
--EXPECTF--
*** Testing pow() : usage variations ***
@@ -153,7 +156,7 @@ Warning: A non-numeric value encountered in %s on line %d
int(0)
-- Iteration 19 --
-int(0)
+Unsupported operand types
-- Iteration 20 --
@@ -183,4 +186,3 @@ int(0)
-- Iteration 26 --
%s
-===Done===
diff --git a/ext/standard/tests/math/pow_variation2.phpt b/ext/standard/tests/math/pow_variation2.phpt
index 4876447da9..ad86e1721e 100644
--- a/ext/standard/tests/math/pow_variation2.phpt
+++ b/ext/standard/tests/math/pow_variation2.phpt
@@ -80,13 +80,16 @@ $inputs = array(
// loop through each element of $inputs to check the behaviour of pow()
$iterator = 1;
foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump(pow(20.3, $input));
- $iterator++;
+ echo "\n-- Iteration $iterator --\n";
+ try {
+ var_dump(pow(20.3, $input));
+ } catch (Error $e) {
+ echo $e->getMessage(), "\n";
+ }
+ $iterator++;
};
fclose($fp);
?>
-===Done===
--EXPECTF--
*** Testing pow() : usage variations ***
@@ -149,7 +152,7 @@ Warning: A non-numeric value encountered in %s on line %d
float(1)
-- Iteration 19 --
-int(1)
+Unsupported operand types
-- Iteration 20 --
@@ -179,4 +182,3 @@ float(1)
-- Iteration 26 --
%s
-===Done===
diff --git a/ext/standard/tests/math/rad2deg_basic.phpt b/ext/standard/tests/math/rad2deg_basic.phpt
index d09f376151..df5f837422 100644
--- a/ext/standard/tests/math/rad2deg_basic.phpt
+++ b/ext/standard/tests/math/rad2deg_basic.phpt
@@ -21,37 +21,37 @@ echo "rad2deg $arg_0= ";
$r0 = rad2deg($arg_0);
var_dump($r0);
if (allowed_rounding_error($r0 ,0 )) {
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
echo "rad2deg $arg_1 = ";
$r1 = rad2deg($arg_1);
var_dump($r1);
if (allowed_rounding_error($r1 ,90.000000011752)) {
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
echo "rad2deg $arg_2 = ";
$r2 = rad2deg($arg_2);
var_dump($r2);
if (allowed_rounding_error($r2 ,180.0000000235 )) {
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
echo "rad2deg $arg_3 = ";
$r3 = rad2deg($arg_3);
var_dump($r3);
if (allowed_rounding_error($r3 ,359.99999998971 )) {
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
?>
--EXPECTF--
diff --git a/ext/standard/tests/math/rad2deg_basiclong_64bit.phpt b/ext/standard/tests/math/rad2deg_basiclong_64bit.phpt
index b3d973387e..fbde4ab585 100644
--- a/ext/standard/tests/math/rad2deg_basiclong_64bit.phpt
+++ b/ext/standard/tests/math/rad2deg_basiclong_64bit.phpt
@@ -25,7 +25,6 @@ foreach ($longVals as $longVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 ---
float(5.2846029059076E+20)
@@ -57,4 +56,3 @@ float(5.2846029059076E+20)
float(-5.2846029059076E+20)
--- testing: -9.2233720368548E+18 ---
float(-5.2846029059076E+20)
-===DONE===
diff --git a/ext/standard/tests/math/rad2deg_variation.phpt b/ext/standard/tests/math/rad2deg_variation.phpt
index 596a1940a4..7144f18b61 100644
--- a/ext/standard/tests/math/rad2deg_variation.phpt
+++ b/ext/standard/tests/math/rad2deg_variation.phpt
@@ -13,24 +13,23 @@ precision = 10
//Test rad2deg with a different input values
$values = array(23,
- -23,
- 2.345e1,
- -2.345e1,
- 0x17,
- 027,
- "23",
- "23.45",
- "2.345e1",
- "nonsense",
- "1000",
- "1000ABC",
- null,
- true,
- false);
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
for ($i = 0; $i < count($values); $i++) {
- $res = rad2deg($values[$i]);
- var_dump($res);
+ $res = rad2deg($values[$i]);
+ var_dump($res);
}
?>
@@ -44,9 +43,6 @@ float(1317.802929)
float(1317.802929)
float(1343.58603)
float(1343.58603)
-
-Warning: rad2deg() expects parameter 1 to be float, string given in %s on line %d
-NULL
float(57295.77951)
Notice: A non well formed numeric value encountered in %s on line %d
diff --git a/ext/standard/tests/math/rand_basic.phpt b/ext/standard/tests/math/rand_basic.phpt
index fbaab3c9af..87e9d7cd42 100644
--- a/ext/standard/tests/math/rand_basic.phpt
+++ b/ext/standard/tests/math/rand_basic.phpt
@@ -6,77 +6,77 @@ $default_max = getrandmax();
echo "\nrand() tests with default min and max value (i.e 0 thru ", $default_max, ")\n";
for ($i = 0; $i < 100; $i++) {
- $res = rand();
+ $res = rand();
// By default RAND_MAX is 32768 although no constant is defined for it for user space apps
- if (!is_int($res) || $res < 0 || $res > $default_max) {
- break;
- }
+ if (!is_int($res) || $res < 0 || $res > $default_max) {
+ break;
+ }
}
if ($i != 100) {
- echo "FAILED: res = ", $res, " min = 0 max = ", $default_max, "\n";
+ echo "FAILED: res = ", $res, " min = 0 max = ", $default_max, "\n";
} else {
- echo "PASSED: range min = 0 max = ", $default_max, "\n";
+ echo "PASSED: range min = 0 max = ", $default_max, "\n";
}
echo "\nrand() tests with defined min and max value\n";
$min = array(10,
- 100,
- 10.5,
- 10.5e3,
- 0x10,
- 0400);
+ 100,
+ 10.5,
+ 10.5e3,
+ 0x10,
+ 0400);
$max = array(100,
- 1000,
- 19.5,
- 10.5e5,
- 0x10000,
- 0700);
+ 1000,
+ 19.5,
+ 10.5e5,
+ 0x10000,
+ 0700);
for ($x = 0; $x < count($min); $x++) {
- for ($i = 0; $i < 100; $i++) {
- $res = rand($min[$x], $max[$x]);
+ for ($i = 0; $i < 100; $i++) {
+ $res = rand($min[$x], $max[$x]);
- if (!is_int($res) || $res < intval($min[$x]) || $res > intval($max[$x])) {
- echo "FAILED: res = ", $res, " min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n";
- break;
- }
- }
+ if (!is_int($res) || $res < intval($min[$x]) || $res > intval($max[$x])) {
+ echo "FAILED: res = ", $res, " min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n";
+ break;
+ }
+ }
- if ($i == 100) {
- echo "PASSED: range min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n";
- }
+ if ($i == 100) {
+ echo "PASSED: range min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n";
+ }
}
echo "\nNon-numeric cases\n";
$min = array(true,
- false,
- null,
- "10",
- "10.5");
+ false,
+ null,
+ "10",
+ "10.5");
// Eexepcted numerical equivalent of above non-numerics
$minval = array(1,
- 0,
- 0,
- 10,
- 10);
+ 0,
+ 0,
+ 10,
+ 10);
for ($x = 0; $x < count($min); $x++) {
- for ($i = 0; $i < 100; $i++) {
- $res = rand($min[$x], 100);
+ for ($i = 0; $i < 100; $i++) {
+ $res = rand($min[$x], 100);
- if (!is_int($res) || $res < intval($minval[$x]) || $res > 100) {
- echo "FAILED: res = ", $res, " min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n";
- break;
- }
- }
+ if (!is_int($res) || $res < intval($minval[$x]) || $res > 100) {
+ echo "FAILED: res = ", $res, " min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n";
+ break;
+ }
+ }
- if ($i == 100) {
- echo "PASSED range min = ", intval($min[$x]), " max = 100\n";
- }
+ if ($i == 100) {
+ echo "PASSED range min = ", intval($min[$x]), " max = 100\n";
+ }
}
?>
--EXPECTF--
diff --git a/ext/standard/tests/math/round.phpt b/ext/standard/tests/math/round.phpt
index 16255c0a30..f78d2757c2 100644
--- a/ext/standard/tests/math/round.phpt
+++ b/ext/standard/tests/math/round.phpt
@@ -6,7 +6,7 @@ Simple math tests
define('LONG_MAX', is_int(5000000000)? 9223372036854775807 : 0x7FFFFFFF);
define('LONG_MIN', -LONG_MAX - 1);
printf("%d,%d,%d,%d\n",is_int(LONG_MIN ),is_int(LONG_MAX ),
- is_int(LONG_MIN-1),is_int(LONG_MAX+1));
+ is_int(LONG_MIN-1),is_int(LONG_MAX+1));
$tests = <<<TESTS
-1 ~== ceil(-1.5)
diff --git a/ext/standard/tests/math/round_basic.phpt b/ext/standard/tests/math/round_basic.phpt
index d6b927f2d5..70d5ae4806 100644
--- a/ext/standard/tests/math/round_basic.phpt
+++ b/ext/standard/tests/math/round_basic.phpt
@@ -13,38 +13,37 @@ precision=14
echo "*** Testing round() : basic functionality ***\n";
$values = array(123456789,
- 123.456789,
- -4.5679123,
- 1.23E4,
- -4.567E3,
- 0x234567,
- 067777777,
- "1.234567",
- "2.3456789e8");
+ 123.456789,
+ -4.5679123,
+ 1.23E4,
+ -4.567E3,
+ 0x234567,
+ 067777777,
+ "1.234567",
+ "2.3456789e8");
$precision = array(2,
- 8,
- 0x3,
- 04,
- 3.6,
- "2",
- "04",
- "3.6",
- "2.1e1",
- null,
- true,
- false);
+ 8,
+ 0x3,
+ 04,
+ 3.6,
+ "2",
+ "04",
+ "3.6",
+ "2.1e1",
+ null,
+ true,
+ false);
for ($i = 0; $i < count($values); $i++) {
- echo "round: $values[$i]\n";
- for ($j = 0; $j < count($precision); $j++) {
- $res = round($values[$i], $precision[$j]);
- echo "...with precision $precision[$j]-> ";
- var_dump($res);
- }
+ echo "round: $values[$i]\n";
+ for ($j = 0; $j < count($precision); $j++) {
+ $res = round($values[$i], $precision[$j]);
+ echo "...with precision $precision[$j]-> ";
+ var_dump($res);
+ }
}
?>
-===Done===
--EXPECT--
*** Testing round() : basic functionality ***
round: 123456789
@@ -164,4 +163,3 @@ round: 2.3456789e8
...with precision -> float(234567890)
...with precision 1-> float(234567890)
...with precision -> float(234567890)
-===Done===
diff --git a/ext/standard/tests/math/round_basiclong_64bit.phpt b/ext/standard/tests/math/round_basiclong_64bit.phpt
index fbae95437f..ee66684494 100644
--- a/ext/standard/tests/math/round_basiclong_64bit.phpt
+++ b/ext/standard/tests/math/round_basiclong_64bit.phpt
@@ -25,7 +25,6 @@ foreach ($longVals as $longVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 ---
float(9.2233720368548E+18)
@@ -57,4 +56,3 @@ float(9.2233720368548E+18)
float(-9.2233720368548E+18)
--- testing: -9.2233720368548E+18 ---
float(-9.2233720368548E+18)
-===DONE===
diff --git a/ext/standard/tests/math/round_bug71201.phpt b/ext/standard/tests/math/round_bug71201.phpt
index 43a5e11263..b02d3b6ef4 100644
--- a/ext/standard/tests/math/round_bug71201.phpt
+++ b/ext/standard/tests/math/round_bug71201.phpt
@@ -4,7 +4,5 @@ Bug #71201 round() segfault on 64-bit builds
<?php
echo round(1.0, -2147483648), "\n";
?>
-===DONE===
--EXPECT--
0
-===DONE===
diff --git a/ext/standard/tests/math/round_variation1.phpt b/ext/standard/tests/math/round_variation1.phpt
index 454a9129f4..b8566e6df7 100644
--- a/ext/standard/tests/math/round_variation1.phpt
+++ b/ext/standard/tests/math/round_variation1.phpt
@@ -81,14 +81,17 @@ $inputs = array(
// loop through each element of $inputs to check the behaviour of round()
$iterator = 1;
foreach($inputs as $input) {
- echo "\n-- Iteration $iterator --\n";
- var_dump(round($input, 14));
- $iterator++;
+ echo "\n-- Iteration $iterator --\n";
+ try {
+ var_dump(round($input, 14));
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
+ $iterator++;
};
fclose($fp);
?>
-===Done===
---EXPECTF--
+--EXPECT--
*** Testing round() : usage variations ***
-- Iteration 1 --
@@ -140,27 +143,25 @@ float(1)
float(0)
-- Iteration 17 --
-float(0)
+round() expects parameter 1 to be int or float, string given
-- Iteration 18 --
-float(0)
+round() expects parameter 1 to be int or float, string given
-- Iteration 19 --
-bool(false)
+round() expects parameter 1 to be int or float, array given
-- Iteration 20 --
-float(0)
+round() expects parameter 1 to be int or float, string given
-- Iteration 21 --
-float(0)
+round() expects parameter 1 to be int or float, string given
-- Iteration 22 --
-float(0)
+round() expects parameter 1 to be int or float, string given
-- Iteration 23 --
-
-Notice: Object of class classA could not be converted to number in %s on line %d
-float(1)
+round() expects parameter 1 to be int or float, object given
-- Iteration 24 --
float(0)
@@ -169,5 +170,4 @@ float(0)
float(0)
-- Iteration 26 --
-float(%f)
-===Done===
+round() expects parameter 1 to be int or float, resource given
diff --git a/ext/standard/tests/math/sin_basic.phpt b/ext/standard/tests/math/sin_basic.phpt
index f9be13bec9..7c5b787a7a 100644
--- a/ext/standard/tests/math/sin_basic.phpt
+++ b/ext/standard/tests/math/sin_basic.phpt
@@ -26,55 +26,55 @@ $threesixty = M_PI * 2.0;
echo "sin 30 = ";
var_dump(sin($thirty));
if (allowed_rounding_error(sin($thirty),0.5)) {
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
echo "sin 60 = ";
var_dump(sin($sixty));
if (allowed_rounding_error(sin($sixty),0.86602540378444)) {
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
echo "sin 90 = ";
var_dump(sin($ninety));
if (allowed_rounding_error(sin($ninety),1.0)) {
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
echo "sin 180 = ";
var_dump(sin($oneeighty));
if (allowed_rounding_error(sin($oneeighty),0.0)) {
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
echo "sin 270 = ";
var_dump(sin($twoseventy));
if (allowed_rounding_error(sin($twoseventy),-1.0)) {
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
echo "sin 360 = ";
var_dump(sin($threesixty));
if (allowed_rounding_error(sin($threesixty),0.0)) {
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
?>
--EXPECTF--
diff --git a/ext/standard/tests/math/sin_basiclong_64bit.phpt b/ext/standard/tests/math/sin_basiclong_64bit.phpt
index f335b3bd62..35775d2f0b 100644
--- a/ext/standard/tests/math/sin_basiclong_64bit.phpt
+++ b/ext/standard/tests/math/sin_basiclong_64bit.phpt
@@ -25,7 +25,6 @@ foreach ($longVals as $longVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 ---
float(0.99993037667344)
@@ -57,4 +56,3 @@ float(0.99993037667344)
float(-0.99993037667344)
--- testing: -9.2233720368548E+18 ---
float(-0.99993037667344)
-===DONE===
diff --git a/ext/standard/tests/math/sin_variation.phpt b/ext/standard/tests/math/sin_variation.phpt
index 5b635dfbdc..bad70c710d 100644
--- a/ext/standard/tests/math/sin_variation.phpt
+++ b/ext/standard/tests/math/sin_variation.phpt
@@ -13,24 +13,23 @@ precision = 10
//Test sin with a different input values
$values = array(23,
- -23,
- 2.345e1,
- -2.345e1,
- 0x17,
- 027,
- "23",
- "23.45",
- "2.345e1",
- "nonsense",
- "1000",
- "1000ABC",
- null,
- true,
- false);
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
for ($i = 0; $i < count($values); $i++) {
- $res = sin($values[$i]);
- var_dump($res);
+ $res = sin($values[$i]);
+ var_dump($res);
}
?>
@@ -44,9 +43,6 @@ float(-0.8462204042)
float(-0.8462204042)
float(-0.9937407102)
float(-0.9937407102)
-
-Warning: sin() expects parameter 1 to be float, string given in %s on line %d
-NULL
float(0.8268795405)
Notice: A non well formed numeric value encountered in %s on line %d
diff --git a/ext/standard/tests/math/sinh_basic.phpt b/ext/standard/tests/math/sinh_basic.phpt
index 8d16e1712e..0cdd8f1179 100644
--- a/ext/standard/tests/math/sinh_basic.phpt
+++ b/ext/standard/tests/math/sinh_basic.phpt
@@ -15,37 +15,37 @@ require($file_path."/allowed_rounding_error.inc");
echo "sinh .5 = ";
var_dump(sinh(0.5));
if (allowed_rounding_error(sinh(0.5),0.52109530549375)){
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
echo "sinh -0.5 = ";
var_dump(sinh(-0.5));
if (allowed_rounding_error(sinh(-0.5), -0.52109530549375)){
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
echo "sinh 3 = ";
var_dump(sinh(3.0));
if (allowed_rounding_error(sinh(3.0), 10.01787492741)){
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
echo "sinh -3 = ";
var_dump(sinh(-3.0));
if (allowed_rounding_error(sinh(-3.0), -10.01787492741)){
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
?>
diff --git a/ext/standard/tests/math/sinh_basiclong_64bit.phpt b/ext/standard/tests/math/sinh_basiclong_64bit.phpt
index a52a48a8db..f192b7a1d6 100644
--- a/ext/standard/tests/math/sinh_basiclong_64bit.phpt
+++ b/ext/standard/tests/math/sinh_basiclong_64bit.phpt
@@ -25,7 +25,6 @@ foreach ($longVals as $longVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 ---
float(INF)
@@ -57,4 +56,3 @@ float(INF)
float(-INF)
--- testing: -9.2233720368548E+18 ---
float(-INF)
-===DONE===
diff --git a/ext/standard/tests/math/sinh_variation.phpt b/ext/standard/tests/math/sinh_variation.phpt
index e47e94d629..5b3a79ca78 100644
--- a/ext/standard/tests/math/sinh_variation.phpt
+++ b/ext/standard/tests/math/sinh_variation.phpt
@@ -13,24 +13,23 @@ precision = 10
//Test sinh with a different input values
$values = array(23,
- -23,
- 2.345e1,
- -2.345e1,
- 0x17,
- 027,
- "23",
- "23.45",
- "2.345e1",
- "nonsense",
- "1000",
- "1000ABC",
- null,
- true,
- false);
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
for ($i = 0; $i < count($values); $i++) {
- $res = sinh($values[$i]);
- var_dump($res);
+ $res = sinh($values[$i]);
+ var_dump($res);
}
?>
@@ -44,9 +43,6 @@ float(4872401723)
float(4872401723)
float(7641446995)
float(7641446995)
-
-Warning: sinh() expects parameter 1 to be float, string given in %s on line %d
-NULL
float(INF)
Notice: A non well formed numeric value encountered in %s on line %d
diff --git a/ext/standard/tests/math/sqrt_basiclong_64bit.phpt b/ext/standard/tests/math/sqrt_basiclong_64bit.phpt
index 44fe578548..a20cccad79 100644
--- a/ext/standard/tests/math/sqrt_basiclong_64bit.phpt
+++ b/ext/standard/tests/math/sqrt_basiclong_64bit.phpt
@@ -25,7 +25,6 @@ foreach ($longVals as $longVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 ---
float(3037000499.976)
@@ -57,4 +56,3 @@ float(3037000499.976)
float(NAN)
--- testing: -9.2233720368548E+18 ---
float(NAN)
-===DONE===
diff --git a/ext/standard/tests/math/sqrt_variation.phpt b/ext/standard/tests/math/sqrt_variation.phpt
index 7369b98dfd..75c460db7a 100644
--- a/ext/standard/tests/math/sqrt_variation.phpt
+++ b/ext/standard/tests/math/sqrt_variation.phpt
@@ -14,28 +14,26 @@ precision = 14
echo "*** Testing sqrt() : usage variations ***\n";
$values = array(23,
- -23,
- 2.345e1,
- -2.345e1,
- 0x17,
- 027,
- "23",
- "23.45",
- "2.345e1",
- "nonsense",
- "1000",
- "1000ABC",
- null,
- true,
- false);
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
for ($i = 0; $i < count($values); $i++) {
- $res = sqrt($values[$i]);
- var_dump($res);
+ $res = sqrt($values[$i]);
+ var_dump($res);
}
?>
-===Done===
--EXPECTF--
*** Testing sqrt() : usage variations ***
float(4.7958315233127)
@@ -47,9 +45,6 @@ float(4.7958315233127)
float(4.7958315233127)
float(4.8425200051213)
float(4.8425200051213)
-
-Warning: sqrt() expects parameter 1 to be float, string given in %s on line %d
-NULL
float(31.622776601684)
Notice: A non well formed numeric value encountered in %s on line %d
@@ -57,4 +52,3 @@ float(31.622776601684)
float(0)
float(1)
float(0)
-===Done===
diff --git a/ext/standard/tests/math/srand_basic.phpt b/ext/standard/tests/math/srand_basic.phpt
index a3788cdf45..663653e485 100644
--- a/ext/standard/tests/math/srand_basic.phpt
+++ b/ext/standard/tests/math/srand_basic.phpt
@@ -20,7 +20,6 @@ var_dump(srand(true));
var_dump(srand(false));
var_dump(srand(NULL));
?>
-===Done===
--EXPECT--
*** Testing srand() : basic functionality ***
NULL
@@ -31,4 +30,3 @@ NULL
NULL
NULL
NULL
-===Done===
diff --git a/ext/standard/tests/math/tan_basic.phpt b/ext/standard/tests/math/tan_basic.phpt
index a4d95d77b0..15e7848c48 100644
--- a/ext/standard/tests/math/tan_basic.phpt
+++ b/ext/standard/tests/math/tan_basic.phpt
@@ -18,19 +18,19 @@ $thirty = M_PI / 6.0;
echo "tan 60 = ";
var_dump(tan($sixty));
if (allowed_rounding_error(tan($sixty),1.7320508075689)) {
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
echo "tan 30 = ";
var_dump(tan($thirty));
if (allowed_rounding_error(tan($thirty),0.57735026918963)) {
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
?>
diff --git a/ext/standard/tests/math/tan_basiclong_64bit.phpt b/ext/standard/tests/math/tan_basiclong_64bit.phpt
index b62f09a69e..29c057ce69 100644
--- a/ext/standard/tests/math/tan_basiclong_64bit.phpt
+++ b/ext/standard/tests/math/tan_basiclong_64bit.phpt
@@ -27,7 +27,6 @@ foreach ($longVals as $longVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 ---
float(84.739)
@@ -59,4 +58,3 @@ float(84.739)
float(-84.739)
--- testing: -9.2234E+18 ---
float(-84.739)
-===DONE===
diff --git a/ext/standard/tests/math/tan_variation.phpt b/ext/standard/tests/math/tan_variation.phpt
index 81546bbf6f..1575e24694 100644
--- a/ext/standard/tests/math/tan_variation.phpt
+++ b/ext/standard/tests/math/tan_variation.phpt
@@ -13,24 +13,23 @@ precision = 10
//Test tan with a different input values
$values = array(23,
- -23,
- 2.345e1,
- -2.345e1,
- 0x17,
- 027,
- "23",
- "23.45",
- "2.345e1",
- "nonsense",
- "1000",
- "1000ABC",
- null,
- true,
- false);
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
for ($i = 0; $i < count($values); $i++) {
- $res = tan($values[$i]);
- var_dump($res);
+ $res = tan($values[$i]);
+ var_dump($res);
}
?>
@@ -44,9 +43,6 @@ float(1.588153083)
float(1.588153083)
float(8.895619796)
float(8.895619796)
-
-Warning: tan() expects parameter 1 to be float, string given in %s on line %d
-NULL
float(1.470324156)
Notice: A non well formed numeric value encountered in %s on line %d
diff --git a/ext/standard/tests/math/tanh_basic.phpt b/ext/standard/tests/math/tanh_basic.phpt
index 472d88b94e..d8288843a1 100644
--- a/ext/standard/tests/math/tanh_basic.phpt
+++ b/ext/standard/tests/math/tanh_basic.phpt
@@ -15,37 +15,37 @@ require($file_path."/allowed_rounding_error.inc");
echo "tanh .5 = ";
var_dump(tanh(0.5));
if (allowed_rounding_error(tanh(0.5), 0.46211715726001)) {
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
echo "tanh -0.5 = ";
var_dump(tanh(-0.5));
if (allowed_rounding_error(tanh(-0.5), -0.46211715726001)) {
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
echo "tanh 3 = ";
var_dump(tanh(3.0));
if (allowed_rounding_error(tanh(3.0),0.99505475368673 )) {
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
echo "tanh -3 = ";
var_dump(tanh(-3.0));
if (allowed_rounding_error(tanh(-3.0),-0.99505475368673 )) {
- echo "Pass\n";
+ echo "Pass\n";
}
else {
- echo "Fail\n";
+ echo "Fail\n";
}
?>
diff --git a/ext/standard/tests/math/tanh_basiclong_64bit.phpt b/ext/standard/tests/math/tanh_basiclong_64bit.phpt
index f3563f81fc..fd034a4cb0 100644
--- a/ext/standard/tests/math/tanh_basiclong_64bit.phpt
+++ b/ext/standard/tests/math/tanh_basiclong_64bit.phpt
@@ -25,7 +25,6 @@ foreach ($longVals as $longVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 ---
float(1)
@@ -57,4 +56,3 @@ float(1)
float(-1)
--- testing: -9.2233720368548E+18 ---
float(-1)
-===DONE===
diff --git a/ext/standard/tests/math/tanh_variation.phpt b/ext/standard/tests/math/tanh_variation.phpt
index b1b477c150..502130c5d4 100644
--- a/ext/standard/tests/math/tanh_variation.phpt
+++ b/ext/standard/tests/math/tanh_variation.phpt
@@ -13,24 +13,23 @@ precision = 10
//Test tanh with a different input values
$values = array(23,
- -23,
- 2.345e1,
- -2.345e1,
- 0x17,
- 027,
- "23",
- "23.45",
- "2.345e1",
- "nonsense",
- "1000",
- "1000ABC",
- null,
- true,
- false);
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
for ($i = 0; $i < count($values); $i++) {
- $res = tanh($values[$i]);
- var_dump($res);
+ $res = tanh($values[$i]);
+ var_dump($res);
}
?>
@@ -44,9 +43,6 @@ float(1)
float(1)
float(1)
float(1)
-
-Warning: tanh() expects parameter 1 to be float, string given in %s on line %d
-NULL
float(1)
Notice: A non well formed numeric value encountered in %s on line %d
diff --git a/ext/standard/tests/misc/browsernames.inc b/ext/standard/tests/misc/browsernames.inc
index cac8f9a782..fe4350e222 100644
--- a/ext/standard/tests/misc/browsernames.inc
+++ b/ext/standard/tests/misc/browsernames.inc
@@ -4,48 +4,48 @@
* Common browser names. Used with: get_browser()
*/
return array(
- "Opera/7.11 (Windows NT 5.1; U) [en]",
- "Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 5.0) Opera 7.02 Bork-edition [en]",
- "Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 4.0) Opera 7.0 [en]",
- "Mozilla/4.0 (compatible; MSIE 5.0; Windows 2000) Opera 6.0 [en]",
- "Mozilla/4.0 (compatible; MSIE 5.0; Mac_PowerPC) Opera 5.0 [en]",
- "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) Opera 8.60 [en]",
- "Opera/9.00 (Windows NT 5.1; U; en)",
- "Opera/9.26 (Macintosh; PPC Mac OS X; U; en)",
+ "Opera/7.11 (Windows NT 5.1; U) [en]",
+ "Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 5.0) Opera 7.02 Bork-edition [en]",
+ "Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 4.0) Opera 7.0 [en]",
+ "Mozilla/4.0 (compatible; MSIE 5.0; Windows 2000) Opera 6.0 [en]",
+ "Mozilla/4.0 (compatible; MSIE 5.0; Mac_PowerPC) Opera 5.0 [en]",
+ "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) Opera 8.60 [en]",
+ "Opera/9.00 (Windows NT 5.1; U; en)",
+ "Opera/9.26 (Macintosh; PPC Mac OS X; U; en)",
- "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Q312461)",
- "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705)",
- "Mozilla/4.0 (compatible; MSIE 5.22; Mac_PowerPC)",
- "Mozilla/4.0 (compatible; MSIE 5.0; Mac_PowerPC; e504460WanadooNL)",
- "Mozilla/4.0 (Mozilla/4.0; MSIE 7.0; Windows NT 5.1; FDM; SV1; .NET CLR 3.0.04506.30)",
- "Mozilla/4.0 (Mozilla/4.0; MSIE 7.0; Windows NT 5.1; FDM; SV1)",
- "Mozilla/4.0 (compatible;MSIE 7.0;Windows NT 6.0)",
+ "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Q312461)",
+ "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705)",
+ "Mozilla/4.0 (compatible; MSIE 5.22; Mac_PowerPC)",
+ "Mozilla/4.0 (compatible; MSIE 5.0; Mac_PowerPC; e504460WanadooNL)",
+ "Mozilla/4.0 (Mozilla/4.0; MSIE 7.0; Windows NT 5.1; FDM; SV1; .NET CLR 3.0.04506.30)",
+ "Mozilla/4.0 (Mozilla/4.0; MSIE 7.0; Windows NT 5.1; FDM; SV1)",
+ "Mozilla/4.0 (compatible;MSIE 7.0;Windows NT 6.0)",
- "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-us) AppleWebKit/74 (KHTML, like Gecko) Safari/74",
- "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/51 (like Gecko) Safari/51",
- "Mozilla/5.0 (Windows; U; Windows NT 6.0; en) AppleWebKit/522.11.3 (KHTML, like Gecko) Version/3.0 Safari/522.11.3",
- "Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1C28 Safari/419.3",
- "Mozilla/5.0 (iPod; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/3A100a Safari/419.3",
- "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_4_11; ru-ru) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.1 Safari/525.18",
- "Mozilla/5.0 (Windows; U; Windows NT 5.1; en) AppleWebKit/526.9 (KHTML, like Gecko) Version/4.0dp1 Safari/526.8",
- "Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en; rv:1.8.1.12) Gecko/20080206 Camino/1.5.5",
+ "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-us) AppleWebKit/74 (KHTML, like Gecko) Safari/74",
+ "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/51 (like Gecko) Safari/51",
+ "Mozilla/5.0 (Windows; U; Windows NT 6.0; en) AppleWebKit/522.11.3 (KHTML, like Gecko) Version/3.0 Safari/522.11.3",
+ "Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1C28 Safari/419.3",
+ "Mozilla/5.0 (iPod; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/3A100a Safari/419.3",
+ "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_4_11; ru-ru) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.1 Safari/525.18",
+ "Mozilla/5.0 (Windows; U; Windows NT 5.1; en) AppleWebKit/526.9 (KHTML, like Gecko) Version/4.0dp1 Safari/526.8",
+ "Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en; rv:1.8.1.12) Gecko/20080206 Camino/1.5.5",
- "Mozilla/5.0 (compatible; Konqueror/3.1; Linux; X11; i686)",
- "Mozilla/5.0 (compatible; Konqueror/3.1; Linux 2.4.19-32mdkenterprise; X11; i686; ar, en_US)",
- "Mozilla/5.0 (compatible; Konqueror/2.1.1; X11)",
+ "Mozilla/5.0 (compatible; Konqueror/3.1; Linux; X11; i686)",
+ "Mozilla/5.0 (compatible; Konqueror/3.1; Linux 2.4.19-32mdkenterprise; X11; i686; ar, en_US)",
+ "Mozilla/5.0 (compatible; Konqueror/2.1.1; X11)",
- "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4b) Gecko/20030504 Mozilla",
- "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.2a) Gecko/20020910",
- "Mozilla/5.0 (X11; U; Linux 2.4.3-20mdk i586; en-US; rv:0.9.1) Gecko/20010611",
- "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.9) Gecko/20050711",
- "Mozilla/5.0 (Windows; U; Windows NT 5.1; cs; rv:1.9) Gecko/2008052906",
+ "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4b) Gecko/20030504 Mozilla",
+ "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.2a) Gecko/20020910",
+ "Mozilla/5.0 (X11; U; Linux 2.4.3-20mdk i586; en-US; rv:0.9.1) Gecko/20010611",
+ "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.9) Gecko/20050711",
+ "Mozilla/5.0 (Windows; U; Windows NT 5.1; cs; rv:1.9) Gecko/2008052906",
- "Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.3a) Gecko/20021207 Phoenix/0.5",
- "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4b) Gecko/20030516 Mozilla Firebird/0.6",
- "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4a) Gecko/20030423 Firebird Browser/0.6",
- "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040206 Firefox/0.8",
- "Mozilla/5.0 (Windows 98; U; en; rv:1.8.0) Gecko/20060728 Firefox/1.5.0",
- "Mozilla/5.0 (Macintosh; PPC Mac OS X; U; en; rv:1.8.0) Gecko/20060728 Firefox/1.5.0",
- "Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.8.1.12) Gecko/20080210 Firefox/2.0.0.12",
- "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.12) Gecko/20080214 Firefox/2.0.0.12",
+ "Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.3a) Gecko/20021207 Phoenix/0.5",
+ "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4b) Gecko/20030516 Mozilla Firebird/0.6",
+ "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4a) Gecko/20030423 Firebird Browser/0.6",
+ "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040206 Firefox/0.8",
+ "Mozilla/5.0 (Windows 98; U; en; rv:1.8.0) Gecko/20060728 Firefox/1.5.0",
+ "Mozilla/5.0 (Macintosh; PPC Mac OS X; U; en; rv:1.8.0) Gecko/20060728 Firefox/1.5.0",
+ "Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.8.1.12) Gecko/20080210 Firefox/2.0.0.12",
+ "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.12) Gecko/20080214 Firefox/2.0.0.12",
);
diff --git a/ext/standard/tests/misc/bug65550.phpt b/ext/standard/tests/misc/bug65550.phpt
index 5ac0389d33..a0340d4727 100644
--- a/ext/standard/tests/misc/bug65550.phpt
+++ b/ext/standard/tests/misc/bug65550.phpt
@@ -8,8 +8,6 @@ $user_agent = 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US) AppleWebKit/522+
$caps = get_browser($user_agent, true);
var_dump($caps['browser'], $caps['version']);
?>
-==DONE==
--EXPECT--
string(7) "OmniWeb"
string(3) "5.6"
-==DONE==
diff --git a/ext/standard/tests/misc/get_browser_basic.phpt b/ext/standard/tests/misc/get_browser_basic.phpt
index 7daf668c50..85ac8e3493 100644
--- a/ext/standard/tests/misc/get_browser_basic.phpt
+++ b/ext/standard/tests/misc/get_browser_basic.phpt
@@ -18,11 +18,10 @@ $browsers = include __DIR__ . DIRECTORY_SEPARATOR . 'browsernames.inc';
echo "*** Testing get_browser() : basic functionality ***\n";
for( $x = 0; $x < 20; $x++) {
- var_dump( get_browser( $browsers[$x], true ) );
+ var_dump( get_browser( $browsers[$x], true ) );
}
?>
-===DONE===
--EXPECT--
*** Testing get_browser() : basic functionality ***
array(35) {
@@ -1455,4 +1454,3 @@ array(35) {
["aolversion"]=>
string(1) "0"
}
-===DONE===
diff --git a/ext/standard/tests/misc/get_browser_error.phpt b/ext/standard/tests/misc/get_browser_error.phpt
index 16e07f9f7d..f1930b71d8 100644
--- a/ext/standard/tests/misc/get_browser_error.phpt
+++ b/ext/standard/tests/misc/get_browser_error.phpt
@@ -20,14 +20,10 @@ echo "*** Testing get_browser() : error functionality ***\n";
/* Unknown browser uses defaults. */
var_dump( get_browser( 'foobar', true ) );
-/* More than expected arguments */
-var_dump( get_browser( 'foobar', true, 15 ) );
-
/* Some wrong parameters, no HTTP_USER_AGENT set */
var_dump( get_browser( null, 'foobar' ) );
?>
-===DONE===
--EXPECTF--
*** Testing get_browser() : error functionality ***
array(34) {
@@ -101,9 +97,5 @@ array(34) {
string(1) "0"
}
-Warning: get_browser() expects at most 2 parameters, 3 given in %s on line %d
-NULL
-
Warning: get_browser(): HTTP_USER_AGENT variable is not set, cannot determine user agent name in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/standard/tests/misc/get_browser_variation1.phpt b/ext/standard/tests/misc/get_browser_variation1.phpt
index dacfdfc8d9..58c3a24267 100644
--- a/ext/standard/tests/misc/get_browser_variation1.phpt
+++ b/ext/standard/tests/misc/get_browser_variation1.phpt
@@ -19,11 +19,10 @@ echo "*** Testing get_browser() : variation functionality: extra browser names *
$count = count( $browsers );
for( $x = 20; $x < $count; $x++) {
- var_dump( get_browser( $browsers[$x], true ) );
+ var_dump( get_browser( $browsers[$x], true ) );
}
?>
-===DONE===
--EXPECT--
*** Testing get_browser() : variation functionality: extra browser names ***
array(35) {
@@ -1386,4 +1385,3 @@ array(35) {
["aolversion"]=>
string(1) "0"
}
-===DONE===
diff --git a/ext/standard/tests/misc/time_nanosleep_error3.phpt b/ext/standard/tests/misc/time_nanosleep_error3.phpt
index a419e82d0c..6aed304f1a 100644
--- a/ext/standard/tests/misc/time_nanosleep_error3.phpt
+++ b/ext/standard/tests/misc/time_nanosleep_error3.phpt
@@ -9,8 +9,12 @@ if (!function_exists('time_nanosleep')) die("skip");
--FILE--
<?php
-$nano = time_nanosleep(-2, 1000);
+time_nanosleep(-2, 1000);
?>
--EXPECTF--
-Warning: time_nanosleep(): The seconds value must be greater than 0 in %stime_nanosleep_error3.php on line %d
+Fatal error: Uncaught ValueError: The seconds value must be greater than 0 in %s:%d
+Stack trace:
+#0 %s(%d): time_nanosleep(-2, 1000)
+#1 {main}
+ thrown in %s on line %d
diff --git a/ext/standard/tests/misc/time_nanosleep_error4.phpt b/ext/standard/tests/misc/time_nanosleep_error4.phpt
index e3e522a944..3d60c516b1 100644
--- a/ext/standard/tests/misc/time_nanosleep_error4.phpt
+++ b/ext/standard/tests/misc/time_nanosleep_error4.phpt
@@ -10,8 +10,12 @@ if (!function_exists('time_nanosleep')) die("skip");
--FILE--
<?php
-$nano = time_nanosleep(0, -10);
+time_nanosleep(0, -10);
?>
--EXPECTF--
-Warning: time_nanosleep(): The nanoseconds value must be greater than 0 in %stime_nanosleep_error4.php on line %d
+Fatal error: Uncaught ValueError: The nanoseconds value must be greater than 0 in %s:%d
+Stack trace:
+#0 %s(%d): time_nanosleep(0, -10)
+#1 {main}
+ thrown in %s on line %d
diff --git a/ext/standard/tests/misc/time_nanosleep_error5.phpt b/ext/standard/tests/misc/time_nanosleep_error5.phpt
index 2f1f3a119d..7116da5519 100644
--- a/ext/standard/tests/misc/time_nanosleep_error5.phpt
+++ b/ext/standard/tests/misc/time_nanosleep_error5.phpt
@@ -7,8 +7,12 @@ time_nanosleep — Delay for a number of seconds and nanoseconds
--FILE--
<?php
-$nano = time_nanosleep(0, 1000000000);
+time_nanosleep(0, 1000000000);
?>
--EXPECTF--
-Warning: time_nanosleep(): nanoseconds was not in the range 0 to 999 999 999 or seconds was negative in %s.php on line %d
+Fatal error: Uncaught ValueError: Nanoseconds was not in the range 0 to 999 999 999 or seconds was negative in %s:%d
+Stack trace:
+#0 %s(%d): time_nanosleep(0, 1000000000)
+#1 {main}
+ thrown in %s on line %d
diff --git a/ext/standard/tests/network/bug20134.phpt b/ext/standard/tests/network/bug20134.phpt
index 260878d474..669f5c74ea 100644
--- a/ext/standard/tests/network/bug20134.phpt
+++ b/ext/standard/tests/network/bug20134.phpt
@@ -5,17 +5,17 @@ Bug #20134 (UDP reads from invalid ports)
$fp = fsockopen("udp://localhost", 65534, $errno, $errstr);
if (!$fp) {
- /* UDP will never cause a connection error, as it is
- * a connection-LESS protocol */
+ /* UDP will never cause a connection error, as it is
+ * a connection-LESS protocol */
echo "ERROR: $errno - $errstr<br>\n";
}
else {
- /* Likewise, writes will always appear to succeed */
+ /* Likewise, writes will always appear to succeed */
$x = fwrite($fp,"\n");
- var_dump($x);
- /* But reads should always fail */
+ var_dump($x);
+ /* But reads should always fail */
$content = fread($fp, 40);
- var_dump($content);
+ var_dump($content);
fclose($fp);
}
?>
diff --git a/ext/standard/tests/network/bug41347.phpt b/ext/standard/tests/network/bug41347.phpt
index 6ece098191..6390327a52 100644
--- a/ext/standard/tests/network/bug41347.phpt
+++ b/ext/standard/tests/network/bug41347.phpt
@@ -2,8 +2,11 @@
dns_check_record() segfault with empty host
--FILE--
<?php
-var_dump(dns_check_record(''));
+try {
+ var_dump(dns_check_record(''));
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
?>
---EXPECTF--
-Warning: dns_check_record(): Host cannot be empty in %s on line %d
-bool(false)
+--EXPECT--
+Host cannot be empty
diff --git a/ext/standard/tests/network/bug64330.phpt b/ext/standard/tests/network/bug64330.phpt
index e5653e7459..311376503a 100644
--- a/ext/standard/tests/network/bug64330.phpt
+++ b/ext/standard/tests/network/bug64330.phpt
@@ -11,11 +11,9 @@ echo "Test\n";
$server = stream_socket_server("unix://\x00/MyBindName");
$client = stream_socket_client("unix://\x00/MyBindName");
if ($client) {
- echo "ok\n";
+ echo "ok\n";
}
?>
-===DONE===
--EXPECT--
Test
ok
-===DONE===
diff --git a/ext/standard/tests/network/bug74764.phpt b/ext/standard/tests/network/bug74764.phpt
index e946167008..7357f1c6f5 100644
--- a/ext/standard/tests/network/bug74764.phpt
+++ b/ext/standard/tests/network/bug74764.phpt
@@ -19,6 +19,6 @@ $context = stream_context_create(
$socket = stream_socket_client('tcp://localhost:1443', $errno, $errstr, 5, STREAM_CLIENT_CONNECT, $context);
?>
--EXPECTF--
-Warning: stream_socket_client(): unable to connect to tcp://localhost:1443 (%s) in %s on line %d
+Warning: stream_socket_client(): Unable to connect to tcp://localhost:1443 (%s) in %s on line %d
-Warning: stream_socket_client(): unable to connect to tcp://localhost:1443 (%s) in %s on line %d
+Warning: stream_socket_client(): Unable to connect to tcp://localhost:1443 (%s) in %s on line %d
diff --git a/ext/standard/tests/network/closelog_basic.phpt b/ext/standard/tests/network/closelog_basic.phpt
index 77c7155ea8..8031da37a5 100644
--- a/ext/standard/tests/network/closelog_basic.phpt
+++ b/ext/standard/tests/network/closelog_basic.phpt
@@ -14,10 +14,8 @@ echo "*** Testing closelog() : basic functionality ***\n";
echo "\n-- Testing closelog() function with Zero arguments --\n";
var_dump( closelog() );
?>
-===DONE===
--EXPECT--
*** Testing closelog() : basic functionality ***
-- Testing closelog() function with Zero arguments --
bool(true)
-===DONE===
diff --git a/ext/standard/tests/network/fsockopen_error.phpt b/ext/standard/tests/network/fsockopen_error.phpt
index 638412b47f..d5b6944192 100644
--- a/ext/standard/tests/network/fsockopen_error.phpt
+++ b/ext/standard/tests/network/fsockopen_error.phpt
@@ -11,21 +11,6 @@ Test fsockopen() function : error conditions
echo "*** Testing fsockopen() : basic error conditions ***\n";
-
-echo "\n-- Testing fsockopen() function with more than expected no. of arguments --\n";
-$hostname = 'string_val';
-$port = 10;
-$errno = 10;
-$errstr = 'string_val';
-$timeout = 10.5;
-$extra_arg = 10;
-var_dump( fsockopen($hostname, $port, $errno, $errstr, $timeout, $extra_arg) );
-var_dump($errstr);
-var_dump($errno);
-
-echo "\n-- Testing fsockopen() function with less than expected no. of arguments --\n";
-var_dump( fsockopen() );
-
echo "\n-- Attempting to connect to a non-existent socket --\n";
$hostname = 'tcp://127.0.0.1'; // loopback address
$port = 31337;
@@ -49,27 +34,15 @@ echo "Done";
--EXPECTF--
*** Testing fsockopen() : basic error conditions ***
--- Testing fsockopen() function with more than expected no. of arguments --
-
-Warning: fsockopen() expects at most 5 parameters, 6 given in %s on line %d
-bool(false)
-string(10) "string_val"
-int(10)
-
--- Testing fsockopen() function with less than expected no. of arguments --
-
-Warning: fsockopen() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
-
-- Attempting to connect to a non-existent socket --
-Warning: fsockopen(): unable to connect to tcp://127.0.0.1:31337 (%a) in %s on line %d
+Warning: fsockopen(): Unable to connect to tcp://127.0.0.1:31337 (%a) in %s on line %d
bool(false)
string(%d) "%a"
-- Attempting to connect using an invalid protocol --
-Warning: fsockopen(): unable to connect to invalid://127.0.0.1:31337 (Unable to find the socket transport "invalid" - did you forget to enable it when you configured PHP?) in %s on line %d
+Warning: fsockopen(): Unable to connect to invalid://127.0.0.1:31337 (Unable to find the socket transport "invalid" - did you forget to enable it when you configured PHP?) in %s on line %d
bool(false)
string(100) "Unable to find the socket transport "invalid" - did you forget to enable it when you configured PHP?"
Done
diff --git a/ext/standard/tests/network/gethostbyaddr_basic1.phpt b/ext/standard/tests/network/gethostbyaddr_basic1.phpt
index 0e65937871..27605e7d2a 100644
--- a/ext/standard/tests/network/gethostbyaddr_basic1.phpt
+++ b/ext/standard/tests/network/gethostbyaddr_basic1.phpt
@@ -11,8 +11,6 @@ echo "*** Testing gethostbyaddr() : basic functionality ***\n";
echo gethostbyaddr("127.0.0.1")."\n";
?>
-===DONE===
--EXPECTF--
*** Testing gethostbyaddr() : basic functionality ***
%rloopback|localhost(\.localdomain)?|%s%r
-===DONE===
diff --git a/ext/standard/tests/network/gethostbyaddr_error.phpt b/ext/standard/tests/network/gethostbyaddr_error.phpt
index f7982d5ca4..a33a71185f 100644
--- a/ext/standard/tests/network/gethostbyaddr_error.phpt
+++ b/ext/standard/tests/network/gethostbyaddr_error.phpt
@@ -11,16 +11,6 @@ Test gethostbyaddr() function : error conditions
echo "Testing gethostbyaddr : error conditions\n";
-// Zero arguments
-echo "\n-- Testing gethostbyaddr function with Zero arguments --\n";
-var_dump( gethostbyaddr() );
-
-//Test gethostbyaddr with one more than the expected number of arguments
-echo "\n-- Testing gethostbyaddr function with more than expected no. of arguments --\n";
-$ip_address = 'string_val';
-$extra_arg = 10;
-var_dump( gethostbyaddr($ip_address, $extra_arg) );
-
echo "\n-- Testing gethostbyaddr function with invalid addresses --\n";
$ip_address = 'invalid';
@@ -37,16 +27,6 @@ echo "Done";
--EXPECTREGEX--
Testing gethostbyaddr : error conditions
--- Testing gethostbyaddr function with Zero arguments --
-
-Warning: gethostbyaddr\(\) expects exactly 1 parameter, 0 given in .* on line \d+
-NULL
-
--- Testing gethostbyaddr function with more than expected no. of arguments --
-
-Warning: gethostbyaddr\(\) expects exactly 1 parameter, 2 given in .* on line \d+
-NULL
-
-- Testing gethostbyaddr function with invalid addresses --
Warning: gethostbyaddr\(\): Address is not (in a.b.c.d form|a valid IPv4 or IPv6 address) in .* on line \d+
diff --git a/ext/standard/tests/network/gethostbyname_basic001.phpt b/ext/standard/tests/network/gethostbyname_basic001.phpt
index e917b59920..d65289ca41 100644
--- a/ext/standard/tests/network/gethostbyname_basic001.phpt
+++ b/ext/standard/tests/network/gethostbyname_basic001.phpt
@@ -8,7 +8,7 @@ if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
?>
--FILE--
<?php
- var_dump(is_string(gethostbyname("www.php.net")));
+ var_dump(is_string(gethostbyname("www.php.net")));
?>
--EXPECT--
bool(true)
diff --git a/ext/standard/tests/network/gethostbyname_basic003.phpt b/ext/standard/tests/network/gethostbyname_basic003.phpt
index 6462126a0d..d7df11ec76 100644
--- a/ext/standard/tests/network/gethostbyname_basic003.phpt
+++ b/ext/standard/tests/network/gethostbyname_basic003.phpt
@@ -11,8 +11,6 @@ echo "*** Testing gethostbyname() : basic functionality ***\n";
echo gethostbyname("localhost")."\n";
?>
-===DONE===
--EXPECT--
*** Testing gethostbyname() : basic functionality ***
127.0.0.1
-===DONE===
diff --git a/ext/standard/tests/network/gethostbyname_error001.phpt b/ext/standard/tests/network/gethostbyname_error001.phpt
index f141be8b4e..87f4571fd3 100644
--- a/ext/standard/tests/network/gethostbyname_error001.phpt
+++ b/ext/standard/tests/network/gethostbyname_error001.phpt
@@ -4,7 +4,7 @@ gethostbyname() function - basic type return error test
"Sylvain R." <sracine@phpquebec.org>
--FILE--
<?php
- var_dump(is_string(gethostbyname("192.168.0.101")));
+ var_dump(is_string(gethostbyname("192.168.0.101")));
?>
--EXPECT--
bool(true)
diff --git a/ext/standard/tests/network/gethostbyname_error002.phpt b/ext/standard/tests/network/gethostbyname_error002.phpt
index 2430a7fcdc..8f586d02ba 100644
--- a/ext/standard/tests/network/gethostbyname_error002.phpt
+++ b/ext/standard/tests/network/gethostbyname_error002.phpt
@@ -4,7 +4,7 @@ gethostbyname() function - basic type return error test
"Sylvain R." <sracine@phpquebec.org>
--FILE--
<?php
- var_dump(is_string(gethostbyname("1234567890")));
+ var_dump(is_string(gethostbyname("1234567890")));
?>
--EXPECT--
bool(true)
diff --git a/ext/standard/tests/network/gethostbyname_error003.phpt b/ext/standard/tests/network/gethostbyname_error003.phpt
index 3d4bb7a55e..ebc8a971cb 100644
--- a/ext/standard/tests/network/gethostbyname_error003.phpt
+++ b/ext/standard/tests/network/gethostbyname_error003.phpt
@@ -4,7 +4,7 @@ gethostbyname() function - basic type return error test
"Sylvain R." <sracine@phpquebec.org>
--FILE--
<?php
- var_dump(is_string(gethostbyname("asdfasdf")));
+ var_dump(is_string(gethostbyname("asdfasdf")));
?>
--EXPECT--
bool(true)
diff --git a/ext/standard/tests/network/gethostbyname_error004.phpt b/ext/standard/tests/network/gethostbyname_error004.phpt
index 274301a236..25ded4bc24 100644
--- a/ext/standard/tests/network/gethostbyname_error004.phpt
+++ b/ext/standard/tests/network/gethostbyname_error004.phpt
@@ -9,8 +9,8 @@ if (getenv("SKIP_ONLINE_TESTS")) die("skip test requiring internet connection");
?>
--FILE--
<?php
- $ip = gethostbyname("www.php.net");
- var_dump((bool) ip2long($ip));
+ $ip = gethostbyname("www.php.net");
+ var_dump((bool) ip2long($ip));
?>
--EXPECT--
bool(true)
diff --git a/ext/standard/tests/network/gethostbyname_error006.phpt b/ext/standard/tests/network/gethostbyname_error006.phpt
index 46247a113d..156ba0e623 100644
--- a/ext/standard/tests/network/gethostbyname_error006.phpt
+++ b/ext/standard/tests/network/gethostbyname_error006.phpt
@@ -4,7 +4,7 @@ gethostbyname() function - basic invalid parameter test
"Sylvain R." <sracine@phpquebec.org>
--FILE--
<?php
- var_dump(gethostbyname(".toto.toto.toto"));
+ var_dump(gethostbyname(".toto.toto.toto"));
?>
--EXPECT--
string(15) ".toto.toto.toto"
diff --git a/ext/standard/tests/network/gethostbynamel_basic1.phpt b/ext/standard/tests/network/gethostbynamel_basic1.phpt
index 94fd2a01ff..85e2ff473d 100644
--- a/ext/standard/tests/network/gethostbynamel_basic1.phpt
+++ b/ext/standard/tests/network/gethostbynamel_basic1.phpt
@@ -10,10 +10,8 @@ Test gethostbynamel() function : basic functionality
echo "*** Testing gethostbynamel() : basic functionality ***\n";
var_dump(gethostbynamel("localhost"));
?>
-===DONE===
--EXPECTF--
*** Testing gethostbynamel() : basic functionality ***
array(%d) {
%a
}
-===DONE===
diff --git a/ext/standard/tests/network/gethostname.phpt b/ext/standard/tests/network/gethostname.phpt
index e7caaf48eb..57f4c498d0 100644
--- a/ext/standard/tests/network/gethostname.phpt
+++ b/ext/standard/tests/network/gethostname.phpt
@@ -5,10 +5,6 @@ marcosptf - <marcosptf@yahoo.com.br> - #phparty7 - @phpsp - novatec/2015 - sao p
--FILE--
<?php
var_dump(gethostname());
-var_dump(gethostname("php-zend-brazil"));
?>
--EXPECTF--
-%s
-
-Warning: gethostname() expects exactly %d parameters, %d given in %s on line %d
-NULL
+string(%d) "%s"
diff --git a/ext/standard/tests/network/getprotobyname_basic.phpt b/ext/standard/tests/network/getprotobyname_basic.phpt
index 37cc26aa2b..ee5e396114 100644
--- a/ext/standard/tests/network/getprotobyname_basic.phpt
+++ b/ext/standard/tests/network/getprotobyname_basic.phpt
@@ -4,7 +4,7 @@ getprotobyname function basic test
edgarsandi - <edgar.r.sandi@gmail.com>
--FILE--
<?php
- var_dump(getprotobyname('tcp'));
+ var_dump(getprotobyname('tcp'));
?>
--EXPECT--
int(6)
diff --git a/ext/standard/tests/network/getprotobyname_error.phpt b/ext/standard/tests/network/getprotobyname_error.phpt
index 7ee366ac7a..52ef3b8ee0 100644
--- a/ext/standard/tests/network/getprotobyname_error.phpt
+++ b/ext/standard/tests/network/getprotobyname_error.phpt
@@ -4,13 +4,8 @@ getprotobyname function errors test
edgarsandi - <edgar.r.sandi@gmail.com>
--FILE--
<?php
- // empty protocol name
- var_dump(getprotobyname());
-
- // invalid protocol name
- var_dump(getprotobyname('abc'));
+// invalid protocol name
+var_dump(getprotobyname('abc'));
?>
---EXPECTF--
-Warning: getprotobyname() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
+--EXPECT--
bool(false)
diff --git a/ext/standard/tests/network/getprotobynumber_basic.phpt b/ext/standard/tests/network/getprotobynumber_basic.phpt
index 7850e60ffd..d781ab92b0 100644
--- a/ext/standard/tests/network/getprotobynumber_basic.phpt
+++ b/ext/standard/tests/network/getprotobynumber_basic.phpt
@@ -4,7 +4,7 @@ getprotobynumber function basic test
edgarsandi - <edgar.r.sandi@gmail.com>
--FILE--
<?php
- var_dump(getprotobynumber(6));
+ var_dump(getprotobynumber(6));
?>
--EXPECT--
string(3) "tcp"
diff --git a/ext/standard/tests/network/getprotobynumber_error.phpt b/ext/standard/tests/network/getprotobynumber_error.phpt
index 7df12e864a..dda2661b5a 100644
--- a/ext/standard/tests/network/getprotobynumber_error.phpt
+++ b/ext/standard/tests/network/getprotobynumber_error.phpt
@@ -4,13 +4,8 @@ getprotobynumber function errors test
edgarsandi - <edgar.r.sandi@gmail.com>
--FILE--
<?php
- // empty protocol number
- var_dump(getprotobynumber());
-
- // invalid protocol number
- var_dump(getprotobynumber(999));
+// invalid protocol number
+var_dump(getprotobynumber(999));
?>
---EXPECTF--
-Warning: getprotobynumber() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
+--EXPECT--
bool(false)
diff --git a/ext/standard/tests/network/inet.phpt b/ext/standard/tests/network/inet.phpt
index a1e70a0020..29b4aa0e6b 100644
--- a/ext/standard/tests/network/inet.phpt
+++ b/ext/standard/tests/network/inet.phpt
@@ -14,25 +14,23 @@ var_dump(inet_ntop($packed));
$packed = chr(255) . chr(255) . chr(255) . chr(0);
var_dump(inet_ntop($packed));
-var_dump(inet_ntop());
var_dump(inet_ntop(-1));
var_dump(inet_ntop(""));
var_dump(inet_ntop("blah-blah"));
-var_dump(inet_pton());
var_dump(inet_pton(""));
var_dump(inet_pton(-1));
var_dump(inet_pton("abra"));
$array = array(
- "127.0.0.1",
- "66.163.161.116",
- "255.255.255.255",
- "0.0.0.0",
- );
+ "127.0.0.1",
+ "66.163.161.116",
+ "255.255.255.255",
+ "0.0.0.0",
+ );
foreach ($array as $val) {
- var_dump(bin2hex($packed = inet_pton($val)));
- var_dump(inet_ntop($packed));
+ var_dump(bin2hex($packed = inet_pton($val)));
+ var_dump(inet_ntop($packed));
}
echo "Done\n";
@@ -40,15 +38,9 @@ echo "Done\n";
--EXPECTF--
string(9) "127.0.0.1"
string(13) "255.255.255.0"
-
-Warning: inet_ntop() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
bool(false)
bool(false)
bool(false)
-
-Warning: inet_pton() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
bool(false)
bool(false)
bool(false)
diff --git a/ext/standard/tests/network/inet_ipv6.phpt b/ext/standard/tests/network/inet_ipv6.phpt
index 55323688de..f78d4be7cc 100644
--- a/ext/standard/tests/network/inet_ipv6.phpt
+++ b/ext/standard/tests/network/inet_ipv6.phpt
@@ -15,20 +15,20 @@ if (stristr(PHP_OS, "darwin") !== false) die("skip MacOS has broken inet_*() fun
<?php
$a = array(
- '::1',
- '::2',
- '::35',
- '::255',
- '::1024',
- '',
- '2001:0db8:85a3:08d3:1319:8a2e:0370:7344',
- '2001:0db8:1234:0000:0000:0000:0000:0000',
- '2001:0db8:1234:FFFF:FFFF:FFFF:FFFF:FFFF',
+ '::1',
+ '::2',
+ '::35',
+ '::255',
+ '::1024',
+ '',
+ '2001:0db8:85a3:08d3:1319:8a2e:0370:7344',
+ '2001:0db8:1234:0000:0000:0000:0000:0000',
+ '2001:0db8:1234:FFFF:FFFF:FFFF:FFFF:FFFF',
);
foreach ($a as $address) {
- $packed = inet_pton($address);
- var_dump(inet_ntop($packed));
+ $packed = inet_pton($address);
+ var_dump(inet_ntop($packed));
}
echo "Done\n";
diff --git a/ext/standard/tests/network/ip.phpt b/ext/standard/tests/network/ip.phpt
index 5237c89776..97e06b3187 100644
--- a/ext/standard/tests/network/ip.phpt
+++ b/ext/standard/tests/network/ip.phpt
@@ -8,29 +8,24 @@ if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
<?php
$array = array(
- "127.0.0.1",
- "10.0.0.1",
- "255.255.255.255",
- "255.255.255.0",
- "0.0.0.0",
- "66.163.161.116",
+ "127.0.0.1",
+ "10.0.0.1",
+ "255.255.255.255",
+ "255.255.255.0",
+ "0.0.0.0",
+ "66.163.161.116",
);
foreach ($array as $ip) {
- var_dump($long = ip2long($ip));
- var_dump(long2ip($long));
+ var_dump($long = ip2long($ip));
+ var_dump(long2ip($long));
}
-var_dump(ip2long());
var_dump(ip2long(""));
var_dump(ip2long("777.777.777.777"));
var_dump(ip2long("111.111.111.111"));
-var_dump(ip2long(array()));
-var_dump(long2ip());
var_dump(long2ip(-110000));
-var_dump(long2ip(""));
-var_dump(long2ip(array()));
echo "Done\n";
?>
@@ -47,23 +42,8 @@ int(0)
string(7) "0.0.0.0"
int(1118019956)
string(14) "66.163.161.116"
-
-Warning: ip2long() expects exactly 1 parameter, 0 given in %sip.php on line %d
-NULL
bool(false)
bool(false)
int(1869573999)
-
-Warning: ip2long() expects parameter 1 to be string, array given in %sip.php on line %d
-NULL
-
-Warning: long2ip() expects exactly 1 parameter, 0 given in %sip.php on line %d
-NULL
string(13) "255.254.82.80"
-
-Warning: long2ip() expects parameter 1 to be int, string given in %sip.php on line %d
-NULL
-
-Warning: long2ip() expects parameter 1 to be int, array given in %sip.php on line %d
-NULL
Done
diff --git a/ext/standard/tests/network/ip2long_variation2.phpt b/ext/standard/tests/network/ip2long_variation2.phpt
index d85b6ba3c9..56c74bb37e 100644
--- a/ext/standard/tests/network/ip2long_variation2.phpt
+++ b/ext/standard/tests/network/ip2long_variation2.phpt
@@ -12,22 +12,21 @@ Test ip2long() function : usage variation 2, 32 bit
*/
$ips = array(
- "1.1.011.011",
- "127.0.0.1",
- "1.1.071.071",
- "0.0.0.0",
- "1.1.081.081",
- "192.168.0.0",
- "256.0.0.1",
- "192.168.0xa.5",
+ "1.1.011.011",
+ "127.0.0.1",
+ "1.1.071.071",
+ "0.0.0.0",
+ "1.1.081.081",
+ "192.168.0.0",
+ "256.0.0.1",
+ "192.168.0xa.5",
);
foreach($ips as $ip) {
- var_dump(ip2long($ip));
+ var_dump(ip2long($ip));
}
?>
-===DONE===
--EXPECT--
bool(false)
int(2130706433)
@@ -37,4 +36,3 @@ bool(false)
int(-1062731776)
bool(false)
bool(false)
-===DONE===
diff --git a/ext/standard/tests/network/ip2long_variation2_x64.phpt b/ext/standard/tests/network/ip2long_variation2_x64.phpt
index a6fde5bdd9..3ee59c9efb 100644
--- a/ext/standard/tests/network/ip2long_variation2_x64.phpt
+++ b/ext/standard/tests/network/ip2long_variation2_x64.phpt
@@ -19,22 +19,21 @@ if(PHP_INT_SIZE != 8) {die('skip 64 bit only');}
*/
$ips = array(
- "1.1.011.011",
- "127.0.0.1",
- "1.1.071.071",
- "0.0.0.0",
- "1.1.081.081",
- "192.168.0.0",
- "256.0.0.1",
- "192.168.0xa.5",
+ "1.1.011.011",
+ "127.0.0.1",
+ "1.1.071.071",
+ "0.0.0.0",
+ "1.1.081.081",
+ "192.168.0.0",
+ "256.0.0.1",
+ "192.168.0xa.5",
);
foreach($ips as $ip) {
- var_dump(ip2long($ip));
+ var_dump(ip2long($ip));
}
?>
-===DONE===
--EXPECT--
bool(false)
int(2130706433)
@@ -44,4 +43,3 @@ bool(false)
int(3232235520)
bool(false)
bool(false)
-===DONE===
diff --git a/ext/standard/tests/network/ip_x86_64.phpt b/ext/standard/tests/network/ip_x86_64.phpt
index 3c530b8371..c659eb70fb 100644
--- a/ext/standard/tests/network/ip_x86_64.phpt
+++ b/ext/standard/tests/network/ip_x86_64.phpt
@@ -8,29 +8,24 @@ if (PHP_INT_SIZE == 4) die("skip this test is for >32bit platform only");
<?php
$array = array(
- "127.0.0.1",
- "10.0.0.1",
- "255.255.255.255",
- "255.255.255.0",
- "0.0.0.0",
- "66.163.161.116",
+ "127.0.0.1",
+ "10.0.0.1",
+ "255.255.255.255",
+ "255.255.255.0",
+ "0.0.0.0",
+ "66.163.161.116",
);
foreach ($array as $ip) {
- var_dump($long = ip2long($ip));
- var_dump(long2ip($long));
+ var_dump($long = ip2long($ip));
+ var_dump(long2ip($long));
}
-var_dump(ip2long());
var_dump(ip2long(""));
var_dump(ip2long("777.777.777.777"));
var_dump(ip2long("111.111.111.111"));
-var_dump(ip2long(array()));
-var_dump(long2ip());
var_dump(long2ip(-110000));
-var_dump(long2ip(""));
-var_dump(long2ip(array()));
echo "Done\n";
?>
@@ -47,23 +42,8 @@ int(0)
string(7) "0.0.0.0"
int(1118019956)
string(14) "66.163.161.116"
-
-Warning: ip2long() expects exactly 1 parameter, 0 given in %sip_x86_64.php on line %d
-NULL
bool(false)
bool(false)
int(1869573999)
-
-Warning: ip2long() expects parameter 1 to be string, array given in %sip_x86_64.php on line %d
-NULL
-
-Warning: long2ip() expects exactly 1 parameter, 0 given in %sip_x86_64.php on line %d
-NULL
string(13) "255.254.82.80"
-
-Warning: long2ip() expects parameter 1 to be int, string given in %sip_x86_64.php on line %d
-NULL
-
-Warning: long2ip() expects parameter 1 to be int, array given in %sip_x86_64.php on line %d
-NULL
Done
diff --git a/ext/standard/tests/network/setcookie.phpt b/ext/standard/tests/network/setcookie.phpt
index 1033b7bbbe..c2806ad8a9 100644
--- a/ext/standard/tests/network/setcookie.phpt
+++ b/ext/standard/tests/network/setcookie.phpt
@@ -21,54 +21,54 @@ setcookie('name', 'value', ['expires' => $tsp]);
setcookie('name', 'value', ['expires' => $tsn, 'path' => '/path/', 'domain' => 'domain.tld', 'secure' => true, 'httponly' => true, 'samesite' => 'Strict']);
$expected = array(
- 'Set-Cookie: name=deleted; expires='.date('D, d-M-Y H:i:s', 1).' GMT; Max-Age=0',
- 'Set-Cookie: name=deleted; expires='.date('D, d-M-Y H:i:s', 1).' GMT; Max-Age=0',
- 'Set-Cookie: name=value',
- 'Set-Cookie: name=space%20value',
- 'Set-Cookie: name=value',
- 'Set-Cookie: name=value; expires='.date('D, d-M-Y H:i:s', $tsp).' GMT; Max-Age=5',
- 'Set-Cookie: name=value; expires='.date('D, d-M-Y H:i:s', $tsn).' GMT; Max-Age=0',
- 'Set-Cookie: name=value; expires='.date('D, d-M-Y H:i:s', $tsc).' GMT; Max-Age=0',
- 'Set-Cookie: name=value; path=/path/',
- 'Set-Cookie: name=value; domain=domain.tld',
- 'Set-Cookie: name=value; secure',
- 'Set-Cookie: name=value; HttpOnly',
- 'Set-Cookie: name=value; expires='.date('D, d-M-Y H:i:s', $tsp).' GMT; Max-Age=5',
- 'Set-Cookie: name=value; expires='.date('D, d-M-Y H:i:s', $tsn).' GMT; Max-Age=0; path=/path/; domain=domain.tld; secure; HttpOnly; SameSite=Strict'
+ 'Set-Cookie: name=deleted; expires='.date('D, d-M-Y H:i:s', 1).' GMT; Max-Age=0',
+ 'Set-Cookie: name=deleted; expires='.date('D, d-M-Y H:i:s', 1).' GMT; Max-Age=0',
+ 'Set-Cookie: name=value',
+ 'Set-Cookie: name=space%20value',
+ 'Set-Cookie: name=value',
+ 'Set-Cookie: name=value; expires='.date('D, d-M-Y H:i:s', $tsp).' GMT; Max-Age=5',
+ 'Set-Cookie: name=value; expires='.date('D, d-M-Y H:i:s', $tsn).' GMT; Max-Age=0',
+ 'Set-Cookie: name=value; expires='.date('D, d-M-Y H:i:s', $tsc).' GMT; Max-Age=0',
+ 'Set-Cookie: name=value; path=/path/',
+ 'Set-Cookie: name=value; domain=domain.tld',
+ 'Set-Cookie: name=value; secure',
+ 'Set-Cookie: name=value; HttpOnly',
+ 'Set-Cookie: name=value; expires='.date('D, d-M-Y H:i:s', $tsp).' GMT; Max-Age=5',
+ 'Set-Cookie: name=value; expires='.date('D, d-M-Y H:i:s', $tsn).' GMT; Max-Age=0; path=/path/; domain=domain.tld; secure; HttpOnly; SameSite=Strict'
);
$headers = headers_list();
if (($i = count($expected)) > count($headers))
{
- echo "Fewer headers are being sent than expected - aborting";
- return;
+ echo "Fewer headers are being sent than expected - aborting";
+ return;
}
do
{
- if (strncmp(current($headers), 'Set-Cookie:', 11) !== 0)
- {
- continue;
- }
+ if (strncmp(current($headers), 'Set-Cookie:', 11) !== 0)
+ {
+ continue;
+ }
- if (current($headers) === current($expected))
- {
- $i--;
- }
- else
- {
- echo "Header mismatch:\n\tExpected: "
- .current($expected)
- ."\n\tReceived: ".current($headers)."\n";
- }
+ if (current($headers) === current($expected))
+ {
+ $i--;
+ }
+ else
+ {
+ echo "Header mismatch:\n\tExpected: "
+ .current($expected)
+ ."\n\tReceived: ".current($headers)."\n";
+ }
- next($expected);
+ next($expected);
}
while (next($headers) !== FALSE);
echo ($i === 0)
- ? 'OK'
- : 'A total of '.$i.' errors found.';
+ ? 'OK'
+ : 'A total of '.$i.' errors found.';
?>
--EXPECTHEADERS--
diff --git a/ext/standard/tests/network/shutdown.phpt b/ext/standard/tests/network/shutdown.phpt
index 1e79b059b1..b8655cc1f4 100644
--- a/ext/standard/tests/network/shutdown.phpt
+++ b/ext/standard/tests/network/shutdown.phpt
@@ -17,56 +17,56 @@ stream_socket_shutdown() test on IPv4 TCP Loopback
}
if (!$server) {
- die('Unable to create AF_INET socket [server]');
- }
+ die('Unable to create AF_INET socket [server]');
+ }
- /* Connect and send request 1 */
- $client1 = stream_socket_client("tcp://127.0.0.1:$port");
- if (!$client1) {
- die('Unable to create AF_INET socket [client]');
- }
- @fwrite($client1, "Client 1\n");
- stream_socket_shutdown($client1, STREAM_SHUT_WR);
- @fwrite($client1, "Error 1\n");
+ /* Connect and send request 1 */
+ $client1 = stream_socket_client("tcp://127.0.0.1:$port");
+ if (!$client1) {
+ die('Unable to create AF_INET socket [client]');
+ }
+ @fwrite($client1, "Client 1\n");
+ stream_socket_shutdown($client1, STREAM_SHUT_WR);
+ @fwrite($client1, "Error 1\n");
- /* Connect and send request 2 */
- $client2 = stream_socket_client("tcp://127.0.0.1:$port");
- if (!$client2) {
- die('Unable to create AF_INET socket [client]');
- }
- @fwrite($client2, "Client 2\n");
- stream_socket_shutdown($client2, STREAM_SHUT_WR);
- @fwrite($client2, "Error 2\n");
+ /* Connect and send request 2 */
+ $client2 = stream_socket_client("tcp://127.0.0.1:$port");
+ if (!$client2) {
+ die('Unable to create AF_INET socket [client]');
+ }
+ @fwrite($client2, "Client 2\n");
+ stream_socket_shutdown($client2, STREAM_SHUT_WR);
+ @fwrite($client2, "Error 2\n");
- /* Accept connection 1 */
- $socket = stream_socket_accept($server);
- if (!$socket) {
- die('Unable to accept connection');
- }
- @fwrite($socket, fgets($socket));
- @fwrite($socket, fgets($socket));
- fclose($socket);
+ /* Accept connection 1 */
+ $socket = stream_socket_accept($server);
+ if (!$socket) {
+ die('Unable to accept connection');
+ }
+ @fwrite($socket, fgets($socket));
+ @fwrite($socket, fgets($socket));
+ fclose($socket);
- /* Read Response 1 */
- echo fgets($client1);
- echo fgets($client1);
+ /* Read Response 1 */
+ echo fgets($client1);
+ echo fgets($client1);
- /* Accept connection 2 */
- $socket = stream_socket_accept($server);
- if (!$socket) {
- die('Unable to accept connection');
- }
- @fwrite($socket, fgets($socket));
- @fwrite($socket, fgets($socket));
- fclose($socket);
+ /* Accept connection 2 */
+ $socket = stream_socket_accept($server);
+ if (!$socket) {
+ die('Unable to accept connection');
+ }
+ @fwrite($socket, fgets($socket));
+ @fwrite($socket, fgets($socket));
+ fclose($socket);
- /* Read Response 2 */
- echo fgets($client2);
- echo fgets($client2);
+ /* Read Response 2 */
+ echo fgets($client2);
+ echo fgets($client2);
- fclose($client1);
- fclose($client2);
- fclose($server);
+ fclose($client1);
+ fclose($client2);
+ fclose($server);
?>
--EXPECT--
Client 1
diff --git a/ext/standard/tests/network/socket_bug74429.phpt b/ext/standard/tests/network/socket_bug74429.phpt
index 2c955bb5be..f72e9e31d7 100644
--- a/ext/standard/tests/network/socket_bug74429.phpt
+++ b/ext/standard/tests/network/socket_bug74429.phpt
@@ -4,8 +4,8 @@ Bug #74429 Remote socket URI with unique persistence identifier broken
<?php
/* This behavior is undocumented, but might be in use. Until there's no officially
- supported alternative, ensure changes doesn't cause BC breach. Otherwise,
- the test should be removed once the undocumented behavior changes. */
+ supported alternative, ensure changes doesn't cause BC breach. Otherwise,
+ the test should be removed once the undocumented behavior changes. */
for ($i=0; $i<100; $i++) {
$port = rand(10000, 65000);
diff --git a/ext/standard/tests/network/syslog_basic.phpt b/ext/standard/tests/network/syslog_basic.phpt
index 47da28f094..196b167f8b 100644
--- a/ext/standard/tests/network/syslog_basic.phpt
+++ b/ext/standard/tests/network/syslog_basic.phpt
@@ -19,8 +19,6 @@ $message = 'A test syslog call invocation';
var_dump( syslog($priority, $message) );
?>
-===DONE===
--EXPECT--
*** Testing syslog() : basic functionality ***
bool(true)
-===DONE===
diff --git a/ext/standard/tests/network/tcp4loop.phpt b/ext/standard/tests/network/tcp4loop.phpt
index a18fa3ba57..1632eba423 100644
--- a/ext/standard/tests/network/tcp4loop.phpt
+++ b/ext/standard/tests/network/tcp4loop.phpt
@@ -11,30 +11,30 @@ Streams Based IPv4 TCP Loopback test
break;
}
}
- if (!$server) {
- die('Unable to create AF_INET socket [server]');
- }
+ if (!$server) {
+ die('Unable to create AF_INET socket [server]');
+ }
- /* Connect to it */
- $client = stream_socket_client("tcp://127.0.0.1:$port");
- if (!$client) {
- die('Unable to create AF_INET socket [client]');
- }
+ /* Connect to it */
+ $client = stream_socket_client("tcp://127.0.0.1:$port");
+ if (!$client) {
+ die('Unable to create AF_INET socket [client]');
+ }
- /* Accept that connection */
- $socket = stream_socket_accept($server);
- if (!$socket) {
- die('Unable to accept connection');
- }
+ /* Accept that connection */
+ $socket = stream_socket_accept($server);
+ if (!$socket) {
+ die('Unable to accept connection');
+ }
- fwrite($client, "ABCdef123\n");
+ fwrite($client, "ABCdef123\n");
- $data = fread($socket, 10);
- var_dump($data);
+ $data = fread($socket, 10);
+ var_dump($data);
- fclose($client);
- fclose($socket);
- fclose($server);
+ fclose($client);
+ fclose($socket);
+ fclose($server);
?>
--EXPECT--
string(10) "ABCdef123
diff --git a/ext/standard/tests/network/tcp6loop.phpt b/ext/standard/tests/network/tcp6loop.phpt
index c8223633ca..6f6e418ffc 100644
--- a/ext/standard/tests/network/tcp6loop.phpt
+++ b/ext/standard/tests/network/tcp6loop.phpt
@@ -20,30 +20,30 @@ Streams Based IPv6 TCP Loopback test
}
}
- if (!$server) {
- die('Unable to create AF_INET6 socket [server]');
- }
+ if (!$server) {
+ die('Unable to create AF_INET6 socket [server]');
+ }
- /* Connect to it */
- $client = stream_socket_client("tcp://[::1]:$port");
- if (!$client) {
- die('Unable to create AF_INET6 socket [client]');
- }
+ /* Connect to it */
+ $client = stream_socket_client("tcp://[::1]:$port");
+ if (!$client) {
+ die('Unable to create AF_INET6 socket [client]');
+ }
- /* Accept that connection */
- $socket = stream_socket_accept($server);
- if (!$socket) {
- die('Unable to accept connection');
- }
+ /* Accept that connection */
+ $socket = stream_socket_accept($server);
+ if (!$socket) {
+ die('Unable to accept connection');
+ }
- fwrite($client, "ABCdef123\n");
+ fwrite($client, "ABCdef123\n");
- $data = fread($socket, 10);
- var_dump($data);
+ $data = fread($socket, 10);
+ var_dump($data);
- fclose($client);
- fclose($socket);
- fclose($server);
+ fclose($client);
+ fclose($socket);
+ fclose($server);
?>
--EXPECT--
string(10) "ABCdef123
diff --git a/ext/standard/tests/network/udgloop.phpt b/ext/standard/tests/network/udgloop.phpt
index 47ecaf042e..3a7e1bf267 100644
--- a/ext/standard/tests/network/udgloop.phpt
+++ b/ext/standard/tests/network/udgloop.phpt
@@ -7,30 +7,30 @@ Streams Based Unix Domain Datagram Loopback test
?>
--FILE--
<?php
- $uniqid = uniqid();
- if (file_exists("/tmp/$uniqid.sock"))
- die('Temporary socket /tmp/$uniqid.sock already exists.');
+ $uniqid = uniqid();
+ if (file_exists("/tmp/$uniqid.sock"))
+ die('Temporary socket /tmp/$uniqid.sock already exists.');
- /* Setup socket server */
- $server = stream_socket_server("udg:///tmp/$uniqid.sock", $errno, $errstr, STREAM_SERVER_BIND);
- if (!$server) {
- die('Unable to create AF_UNIX socket [server]');
- }
+ /* Setup socket server */
+ $server = stream_socket_server("udg:///tmp/$uniqid.sock", $errno, $errstr, STREAM_SERVER_BIND);
+ if (!$server) {
+ die('Unable to create AF_UNIX socket [server]');
+ }
- /* Connect to it */
- $client = stream_socket_client("udg:///tmp/$uniqid.sock");
- if (!$client) {
- die('Unable to create AF_UNIX socket [client]');
- }
+ /* Connect to it */
+ $client = stream_socket_client("udg:///tmp/$uniqid.sock");
+ if (!$client) {
+ die('Unable to create AF_UNIX socket [client]');
+ }
- fwrite($client, "ABCdef123\n");
+ fwrite($client, "ABCdef123\n");
- $data = fread($server, 10);
- var_dump($data);
+ $data = fread($server, 10);
+ var_dump($data);
- fclose($client);
- fclose($server);
- unlink("/tmp/$uniqid.sock");
+ fclose($client);
+ fclose($server);
+ unlink("/tmp/$uniqid.sock");
?>
--EXPECT--
string(10) "ABCdef123
diff --git a/ext/standard/tests/network/udp4loop.phpt b/ext/standard/tests/network/udp4loop.phpt
index 3f78df267a..92709233ba 100644
--- a/ext/standard/tests/network/udp4loop.phpt
+++ b/ext/standard/tests/network/udp4loop.phpt
@@ -2,29 +2,29 @@
Streams Based IPv4 UDP Loopback test
--FILE--
<?php
- /* Setup socket server */
- for ($port = 31338; $port < 31500; ++$port) {
- $uri = "udp://127.0.0.1:$port";
- $server = @stream_socket_server($uri, $errno, $errstr, STREAM_SERVER_BIND);
- if ($server) break;
- }
- if (!$server) {
- die('Unable to create AF_INET socket [server]: ' . $errstr);
- }
+ /* Setup socket server */
+ for ($port = 31338; $port < 31500; ++$port) {
+ $uri = "udp://127.0.0.1:$port";
+ $server = @stream_socket_server($uri, $errno, $errstr, STREAM_SERVER_BIND);
+ if ($server) break;
+ }
+ if (!$server) {
+ die('Unable to create AF_INET socket [server]: ' . $errstr);
+ }
- /* Connect to it */
- $client = stream_socket_client($uri);
- if (!$client) {
- die('Unable to create AF_INET socket [client]');
- }
+ /* Connect to it */
+ $client = stream_socket_client($uri);
+ if (!$client) {
+ die('Unable to create AF_INET socket [client]');
+ }
- fwrite($client, "ABCdef123\n");
+ fwrite($client, "ABCdef123\n");
- $data = fread($server, 10);
- var_dump($data);
+ $data = fread($server, 10);
+ var_dump($data);
- fclose($client);
- fclose($server);
+ fclose($client);
+ fclose($server);
?>
--EXPECT--
string(10) "ABCdef123
diff --git a/ext/standard/tests/network/udp6loop.phpt b/ext/standard/tests/network/udp6loop.phpt
index 3b70f43119..06d9bf4811 100644
--- a/ext/standard/tests/network/udp6loop.phpt
+++ b/ext/standard/tests/network/udp6loop.phpt
@@ -26,23 +26,23 @@ Streams Based IPv6 UDP Loopback test
}
}
- if (!$server) {
- die('Unable to create AF_INET6 socket [server]');
- }
+ if (!$server) {
+ die('Unable to create AF_INET6 socket [server]');
+ }
- /* Connect to it */
- $client = stream_socket_client("udp://[::1]:$port");
- if (!$client) {
- die('Unable to create AF_INET6 socket [client]');
- }
+ /* Connect to it */
+ $client = stream_socket_client("udp://[::1]:$port");
+ if (!$client) {
+ die('Unable to create AF_INET6 socket [client]');
+ }
- fwrite($client, "ABCdef123\n");
+ fwrite($client, "ABCdef123\n");
- $data = fread($server, 10);
- var_dump($data);
+ $data = fread($server, 10);
+ var_dump($data);
- fclose($client);
- fclose($server);
+ fclose($client);
+ fclose($server);
?>
--EXPECT--
string(10) "ABCdef123
diff --git a/ext/standard/tests/network/unixloop.phpt b/ext/standard/tests/network/unixloop.phpt
index 2e95beb9f5..4b5bde2262 100644
--- a/ext/standard/tests/network/unixloop.phpt
+++ b/ext/standard/tests/network/unixloop.phpt
@@ -7,37 +7,37 @@ Streams Based Unix Domain Loopback test
?>
--FILE--
<?php
- $uniqid = uniqid();
- if (file_exists("/tmp/$uniqid.sock"))
- die('Temporary socket already exists.');
+ $uniqid = uniqid();
+ if (file_exists("/tmp/$uniqid.sock"))
+ die('Temporary socket already exists.');
- /* Setup socket server */
- $server = stream_socket_server("unix:///tmp/$uniqid.sock");
- if (!$server) {
- die('Unable to create AF_UNIX socket [server]');
- }
+ /* Setup socket server */
+ $server = stream_socket_server("unix:///tmp/$uniqid.sock");
+ if (!$server) {
+ die('Unable to create AF_UNIX socket [server]');
+ }
- /* Connect to it */
- $client = stream_socket_client("unix:///tmp/$uniqid.sock");
- if (!$client) {
- die('Unable to create AF_UNIX socket [client]');
- }
+ /* Connect to it */
+ $client = stream_socket_client("unix:///tmp/$uniqid.sock");
+ if (!$client) {
+ die('Unable to create AF_UNIX socket [client]');
+ }
- /* Accept that connection */
- $socket = stream_socket_accept($server);
- if (!$socket) {
- die('Unable to accept connection');
- }
+ /* Accept that connection */
+ $socket = stream_socket_accept($server);
+ if (!$socket) {
+ die('Unable to accept connection');
+ }
- fwrite($client, "ABCdef123\n");
+ fwrite($client, "ABCdef123\n");
- $data = fread($socket, 10);
- var_dump($data);
+ $data = fread($socket, 10);
+ var_dump($data);
- fclose($client);
- fclose($socket);
- fclose($server);
- unlink("/tmp/$uniqid.sock");
+ fclose($client);
+ fclose($socket);
+ fclose($server);
+ unlink("/tmp/$uniqid.sock");
?>
--EXPECT--
string(10) "ABCdef123
diff --git a/ext/standard/tests/password/bug75221.phpt b/ext/standard/tests/password/bug75221.phpt
index bd6e386a16..64d8fb14d1 100644
--- a/ext/standard/tests/password/bug75221.phpt
+++ b/ext/standard/tests/password/bug75221.phpt
@@ -13,7 +13,5 @@ $hash = password_hash(
);
var_dump(substr($hash, -1, 1) !== "\0");
?>
-===DONE===
--EXPECT--
bool(true)
-===DONE===
diff --git a/ext/standard/tests/password/password_bcrypt_errors.phpt b/ext/standard/tests/password/password_bcrypt_errors.phpt
index a0826080e6..10c3483f5a 100644
--- a/ext/standard/tests/password/password_bcrypt_errors.phpt
+++ b/ext/standard/tests/password/password_bcrypt_errors.phpt
@@ -3,41 +3,18 @@ Test error operation of password_hash() with bcrypt hashing
--FILE--
<?php
//-=-=-=-
-
-var_dump(password_hash("foo", PASSWORD_BCRYPT, array("cost" => 3)));
-
-var_dump(password_hash("foo", PASSWORD_BCRYPT, array("cost" => 32)));
-
-var_dump(password_hash("foo", PASSWORD_BCRYPT, array("salt" => "foo")));
-
-var_dump(password_hash("foo", PASSWORD_BCRYPT, array("salt" => "123456789012345678901")));
-
-var_dump(password_hash("foo", PASSWORD_BCRYPT, array("salt" => 123)));
-
-var_dump(password_hash("foo", PASSWORD_BCRYPT, array("cost" => "foo")));
-
+try {
+ password_hash("foo", PASSWORD_BCRYPT, array("cost" => 3));
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+try {
+ var_dump(password_hash("foo", PASSWORD_BCRYPT, array("cost" => 32)));
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
?>
---EXPECTF--
-Warning: password_hash(): Invalid bcrypt cost parameter specified: 3 in %s on line %d
-NULL
-
-Warning: password_hash(): Invalid bcrypt cost parameter specified: 32 in %s on line %d
-NULL
-
-Deprecated: password_hash(): Use of the 'salt' option to password_hash is deprecated in %s on line %d
-
-Warning: password_hash(): Provided salt is too short: 3 expecting 22 in %s on line %d
-NULL
-
-Deprecated: password_hash(): Use of the 'salt' option to password_hash is deprecated in %s on line %d
-
-Warning: password_hash(): Provided salt is too short: 21 expecting 22 in %s on line %d
-NULL
-
-Deprecated: password_hash(): Use of the 'salt' option to password_hash is deprecated in %s on line %d
-
-Warning: password_hash(): Provided salt is too short: 3 expecting 22 in %s on line %d
-NULL
-
-Warning: password_hash(): Invalid bcrypt cost parameter specified: 0 in %s on line %d
-NULL
+--EXPECT--
+Invalid bcrypt cost parameter specified: 3
+Invalid bcrypt cost parameter specified: 32
diff --git a/ext/standard/tests/password/password_deprecated_salts.phpt b/ext/standard/tests/password/password_deprecated_salts.phpt
deleted file mode 100644
index c173401067..0000000000
--- a/ext/standard/tests/password/password_deprecated_salts.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-Test deprecated operation of password_hash()
---FILE--
-<?php
-//-=-=-=-
-
-
-var_dump(password_hash("rasmuslerdorf", PASSWORD_BCRYPT, array("cost" => 7, "salt" => "usesomesillystringforsalt")));
-
-var_dump(password_hash("test", PASSWORD_BCRYPT, array("salt" => "123456789012345678901" . chr(0))));
-
-echo "OK!";
-?>
---EXPECTF--
-Deprecated: password_hash(): Use of the 'salt' option to password_hash is deprecated in %s on line %d
-string(60) "$2y$07$usesomesillystringfore2uDLvp1Ii2e./U9C8sBjqp8I90dH6hi"
-
-Deprecated: password_hash(): Use of the 'salt' option to password_hash is deprecated in %s on line %d
-string(60) "$2y$10$MTIzNDU2Nzg5MDEyMzQ1Nej0NmcAWSLR.oP7XOR9HD/vjUuOj100y"
-OK!
diff --git a/ext/standard/tests/password/password_hash_argon2.phpt b/ext/standard/tests/password/password_hash_argon2.phpt
index a7612effa9..399c4cd4bc 100644
--- a/ext/standard/tests/password/password_hash_argon2.phpt
+++ b/ext/standard/tests/password/password_hash_argon2.phpt
@@ -10,12 +10,12 @@ if (!defined('PASSWORD_ARGON2ID')) die('skip password_hash not built with Argon2
$password = "the password for testing 12345!";
$algos = [
- PASSWORD_ARGON2I,
- 'argon2i',
- 2,
- PASSWORD_ARGON2ID,
- 'argon2id',
- 3,
+ PASSWORD_ARGON2I,
+ 'argon2i',
+ 2,
+ PASSWORD_ARGON2ID,
+ 'argon2id',
+ 3,
];
foreach ($algos as $algo) {
$hash = password_hash($password, $algo);
diff --git a/ext/standard/tests/password/password_hash_error.phpt b/ext/standard/tests/password/password_hash_error.phpt
index 6416eca91b..a0d8c6461e 100644
--- a/ext/standard/tests/password/password_hash_error.phpt
+++ b/ext/standard/tests/password/password_hash_error.phpt
@@ -4,51 +4,42 @@ Test error operation of password_hash()
<?php
//-=-=-=-
-var_dump(password_hash());
-
-var_dump(password_hash("foo"));
-
-var_dump(password_hash("foo", array()));
-
-var_dump(password_hash("foo", 19, new StdClass));
-
-var_dump(password_hash("foo", PASSWORD_BCRYPT, "baz"));
-
-var_dump(password_hash(array(), PASSWORD_BCRYPT));
-
-var_dump(password_hash("123", PASSWORD_BCRYPT, array("salt" => array())));
-
-/* Non-string salt, checking for memory leaks */
-var_dump(password_hash('123', PASSWORD_BCRYPT, array('salt' => 1234)));
+try {
+ var_dump(password_hash("foo"));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+
+try {
+ password_hash("foo", array());
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+try {
+ var_dump(password_hash("foo", 19, new StdClass));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+
+try {
+ var_dump(password_hash("foo", PASSWORD_BCRYPT, "baz"));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+
+try {
+ var_dump(password_hash(array(), PASSWORD_BCRYPT));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
--EXPECTF--
-Warning: password_hash() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: password_hash() expects at least 2 parameters, 1 given in %s on line %d
-NULL
-
-Notice: Array to string conversion in %s on line %d
-
-Warning: password_hash(): Unknown password hashing algorithm: Array in %s on line %d
-NULL
-
-Warning: password_hash(): Unknown password hashing algorithm: 19 in %s on line %d
-NULL
-
-Warning: password_hash() expects parameter 3 to be array, string given in %s on line %d
-NULL
-
-Warning: password_hash() expects parameter 1 to be string, array given in %s on line %d
-NULL
-
-Deprecated: password_hash(): Use of the 'salt' option to password_hash is deprecated in %s on line %d
-
-Warning: password_hash(): Non-string salt parameter supplied in %s on line %d
-NULL
-
-Deprecated: password_hash(): Use of the 'salt' option to password_hash is deprecated in %s on line %d
+password_hash() expects at least 2 parameters, 1 given
-Warning: password_hash(): Provided salt is too short: 4 expecting 22 in %s on line %d
-NULL
+Warning: Array to string conversion in %s on line %d
+Unknown password hashing algorithm: Array
+password_hash() expects parameter 3 to be array, object given
+password_hash() expects parameter 3 to be array, string given
+password_hash() expects parameter 1 to be string, array given
diff --git a/ext/standard/tests/password/password_hash_error_argon2.phpt b/ext/standard/tests/password/password_hash_error_argon2.phpt
index 2ea6b93627..96f029aba9 100644
--- a/ext/standard/tests/password/password_hash_error_argon2.phpt
+++ b/ext/standard/tests/password/password_hash_error_argon2.phpt
@@ -7,28 +7,46 @@ if (!defined('PASSWORD_ARGON2ID')) die('skip password_hash not built with Argon2
?>
--FILE--
<?php
-var_dump(password_hash('test', PASSWORD_ARGON2I, ['memory_cost' => 0]));
-var_dump(password_hash('test', PASSWORD_ARGON2I, ['time_cost' => 0]));
-var_dump(password_hash('test', PASSWORD_ARGON2I, ['threads' => 0]));
-var_dump(password_hash('test', PASSWORD_ARGON2ID, ['memory_cost' => 0]));
-var_dump(password_hash('test', PASSWORD_ARGON2ID, ['time_cost' => 0]));
-var_dump(password_hash('test', PASSWORD_ARGON2ID, ['threads' => 0]));
-?>
---EXPECTF--
-Warning: password_hash(): Memory cost is outside of allowed memory range in %s on line %d
-NULL
+try {
+ password_hash('test', PASSWORD_ARGON2I, ['memory_cost' => 0]);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
-Warning: password_hash(): Time cost is outside of allowed time range in %s on line %d
-NULL
+try {
+ password_hash('test', PASSWORD_ARGON2I, ['time_cost' => 0]);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
-Warning: password_hash(): %sthread%s
-NULL
+try {
+ password_hash('test', PASSWORD_ARGON2I, ['threads' => 0]);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
-Warning: password_hash(): Memory cost is outside of allowed memory range in %s on line %d
-NULL
+try {
+ password_hash('test', PASSWORD_ARGON2ID, ['memory_cost' => 0]);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
-Warning: password_hash(): Time cost is outside of allowed time range in %s on line %d
-NULL
+try {
+ password_hash('test', PASSWORD_ARGON2ID, ['time_cost' => 0]);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
-Warning: password_hash(): %sthread%s
-NULL
+try {
+ password_hash('test', PASSWORD_ARGON2ID, ['threads' => 0]);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+?>
+--EXPECT--
+Memory cost is outside of allowed memory range
+Time cost is outside of allowed time range
+Invalid number of threads
+Memory cost is outside of allowed memory range
+Time cost is outside of allowed time range
+Invalid number of threads
diff --git a/ext/standard/tests/password/password_needs_rehash_error.phpt b/ext/standard/tests/password/password_needs_rehash_error.phpt
index 7180d11de7..f64723ee85 100644
--- a/ext/standard/tests/password/password_needs_rehash_error.phpt
+++ b/ext/standard/tests/password/password_needs_rehash_error.phpt
@@ -3,29 +3,32 @@ Test error operation of password_needs_rehash()
--FILE--
<?php
//-=-=-=-
-var_dump(password_needs_rehash());
-var_dump(password_needs_rehash(''));
+try {
+ var_dump(password_needs_rehash(''));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump(password_needs_rehash('', []));
-var_dump(password_needs_rehash(array(), PASSWORD_BCRYPT));
+try {
+ var_dump(password_needs_rehash(array(), PASSWORD_BCRYPT));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
-var_dump(password_needs_rehash("", PASSWORD_BCRYPT, "foo"));
+try {
+ var_dump(password_needs_rehash("", PASSWORD_BCRYPT, "foo"));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "OK!";
?>
--EXPECTF--
-Warning: password_needs_rehash() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: password_needs_rehash() expects at least 2 parameters, 1 given in %s on line %d
-NULL
+password_needs_rehash() expects at least 2 parameters, 1 given
bool(false)
-
-Warning: password_needs_rehash() expects parameter 1 to be string, array given in %s on line %d
-NULL
-
-Warning: password_needs_rehash() expects parameter 3 to be array, string given in %s on line %d
-NULL
+password_needs_rehash() expects parameter 1 to be string, array given
+password_needs_rehash() expects parameter 3 to be array, string given
OK!
diff --git a/ext/standard/tests/password/password_removed_salt_option.phpt b/ext/standard/tests/password/password_removed_salt_option.phpt
new file mode 100644
index 0000000000..356bdec3e8
--- /dev/null
+++ b/ext/standard/tests/password/password_removed_salt_option.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Test removed support for explicit salt option
+--FILE--
+<?php
+//-=-=-=-
+
+
+var_dump(strlen(password_hash("rasmuslerdorf", PASSWORD_BCRYPT, array("cost" => 7, "salt" => "usesomesillystringforsalt"))));
+
+var_dump(strlen(password_hash("test", PASSWORD_BCRYPT, array("salt" => "123456789012345678901" . chr(0)))));
+
+echo "OK!";
+?>
+--EXPECTF--
+Warning: password_hash(): The 'salt' option is no longer supported. The provided salt has been been ignored in %s on line %d
+int(60)
+
+Warning: password_hash(): The 'salt' option is no longer supported. The provided salt has been been ignored in %s on line %d
+int(60)
+OK!
diff --git a/ext/standard/tests/password/password_verify_error.phpt b/ext/standard/tests/password/password_verify_error.phpt
index 7f680af448..192a4ae288 100644
--- a/ext/standard/tests/password/password_verify_error.phpt
+++ b/ext/standard/tests/password/password_verify_error.phpt
@@ -4,14 +4,12 @@ Test error operation of password_verify()
<?php
//-=-=-=-
-var_dump(password_verify());
-
-var_dump(password_verify("foo"));
+try {
+ var_dump(password_verify("foo"));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Warning: password_verify() expects exactly 2 parameters, 0 given in %s on line %d
-bool(false)
-
-Warning: password_verify() expects exactly 2 parameters, 1 given in %s on line %d
-bool(false)
+--EXPECT--
+password_verify() expects exactly 2 parameters, 1 given
diff --git a/ext/standard/tests/php_version_win_const.phpt b/ext/standard/tests/php_version_win_const.phpt
index 12de79b1ae..ea7c11f071 100644
--- a/ext/standard/tests/php_version_win_const.phpt
+++ b/ext/standard/tests/php_version_win_const.phpt
@@ -10,9 +10,7 @@ if (substr(PHP_OS, 0, 3) != 'WIN') {
<?php
var_dump(PHP_WINDOWS_VERSION_MAJOR > 0, PHP_WINDOWS_VERSION_MAJOR, PHP_WINDOWS_VERSION_MINOR);
?>
-==DONE==
--EXPECTF--
bool(true)
int(%d)
int(%d)
-==DONE==
diff --git a/ext/standard/tests/random/reflection.phpt b/ext/standard/tests/random/reflection.phpt
index 2df6a33be7..662b23e8b0 100644
--- a/ext/standard/tests/random/reflection.phpt
+++ b/ext/standard/tests/random/reflection.phpt
@@ -10,10 +10,8 @@ $rf = new ReflectionFunction('random_int');
var_dump($rf->getNumberOfParameters());
var_dump($rf->getNumberOfRequiredParameters());
?>
-===DONE===
--EXPECT--
int(1)
int(1)
int(2)
int(2)
-===DONE===
diff --git a/ext/standard/tests/serialize/001.phpt b/ext/standard/tests/serialize/001.phpt
index 5551956e92..147c355b08 100644
--- a/ext/standard/tests/serialize/001.phpt
+++ b/ext/standard/tests/serialize/001.phpt
@@ -6,36 +6,36 @@ serialize_precision=100
<?php
class t
{
- function __construct()
- {
- $this->a = "hallo";
- }
+ function __construct()
+ {
+ $this->a = "hallo";
+ }
}
class s
{
- public $a;
- public $b;
- public $c;
+ public $a;
+ public $b;
+ public $c;
- function __construct()
- {
- $this->a = "hallo";
- $this->b = "php";
- $this->c = "world";
- $this->d = "!";
- }
+ function __construct()
+ {
+ $this->a = "hallo";
+ $this->b = "php";
+ $this->c = "world";
+ $this->d = "!";
+ }
- function __sleep()
- {
- echo "__sleep called\n";
- return array("a","c");
- }
+ function __sleep()
+ {
+ echo "__sleep called\n";
+ return array("a","c");
+ }
- function __wakeup()
- {
- echo "__wakeup called\n";
- }
+ function __wakeup()
+ {
+ echo "__wakeup called\n";
+ }
}
diff --git a/ext/standard/tests/serialize/002.phpt b/ext/standard/tests/serialize/002.phpt
index 635e728968..9d06f22d41 100644
--- a/ext/standard/tests/serialize/002.phpt
+++ b/ext/standard/tests/serialize/002.phpt
@@ -12,7 +12,6 @@ var_dump(unserialize('a:2:{i:0;a:0:{}i:1;a:0:{}}'));
var_dump(unserialize('a:3:{i:0;s:3:"foo";i:1;s:3:"bar";i:2;s:3:"baz";}'));
var_dump(unserialize('O:8:"stdClass":0:{}'));
?>
-===DONE===
--EXPECTF--
bool(false)
bool(true)
@@ -41,4 +40,3 @@ array(3) {
}
object(stdClass)#%d (0) {
}
-===DONE===
diff --git a/ext/standard/tests/serialize/003.phpt b/ext/standard/tests/serialize/003.phpt
index 5011412809..cf54f40406 100644
--- a/ext/standard/tests/serialize/003.phpt
+++ b/ext/standard/tests/serialize/003.phpt
@@ -6,9 +6,9 @@ serialize_precision=100
--FILE--
<?php
foreach(array(1e2, 5.2e25, 85.29e-23, 9e-9) AS $value) {
- echo ($ser = serialize($value))."\n";
- var_dump(unserialize($ser));
- echo "\n";
+ echo ($ser = serialize($value))."\n";
+ var_dump(unserialize($ser));
+ echo "\n";
}
?>
--EXPECTREGEX--
diff --git a/ext/standard/tests/serialize/005.phpt b/ext/standard/tests/serialize/005.phpt
index c0f5917ec9..fd9fcaac18 100644
--- a/ext/standard/tests/serialize/005.phpt
+++ b/ext/standard/tests/serialize/005.phpt
@@ -7,93 +7,93 @@ serialize()/unserialize() objects
function do_autoload($class_name)
{
- if ($class_name != 'autoload_not_available')
- {
- require_once(__DIR__ . '/' . strtolower($class_name) . '.inc');
- }
- echo __FUNCTION__ . "($class_name)\n";
+ if ($class_name != 'autoload_not_available')
+ {
+ require_once(__DIR__ . '/' . strtolower($class_name) . '.inc');
+ }
+ echo __FUNCTION__ . "($class_name)\n";
}
function unserializer($class_name)
{
- echo __METHOD__ . "($class_name)\n";
- switch($class_name)
- {
- case 'TestNAOld':
- eval("class TestNAOld extends TestOld {}");
- break;
- case 'TestNANew':
- eval("class TestNANew extends TestNew {}");
- break;
- case 'TestNANew2':
- eval("class TestNANew2 extends TestNew {}");
- break;
- default:
- echo "Try autoloader\n";
- if (!spl_autoload_functions()) {
- spl_autoload_register(function ($class_name) { do_autoload($class_name); });
- }
- spl_autoload_call($class_name);
- break;
- }
+ echo __METHOD__ . "($class_name)\n";
+ switch($class_name)
+ {
+ case 'TestNAOld':
+ eval("class TestNAOld extends TestOld {}");
+ break;
+ case 'TestNANew':
+ eval("class TestNANew extends TestNew {}");
+ break;
+ case 'TestNANew2':
+ eval("class TestNANew2 extends TestNew {}");
+ break;
+ default:
+ echo "Try autoloader\n";
+ if (!spl_autoload_functions()) {
+ spl_autoload_register(function ($class_name) { do_autoload($class_name); });
+ }
+ spl_autoload_call($class_name);
+ break;
+ }
}
ini_set('unserialize_callback_func', 'unserializer');
class TestOld
{
- function serialize()
- {
- echo __METHOD__ . "()\n";
- }
-
- function unserialize($serialized)
- {
- echo __METHOD__ . "()\n";
- }
-
- function __wakeup()
- {
- echo __METHOD__ . "()\n";
- }
-
- function __sleep()
- {
- echo __METHOD__ . "()\n";
- return array();
- }
+ function serialize()
+ {
+ echo __METHOD__ . "()\n";
+ }
+
+ function unserialize($serialized)
+ {
+ echo __METHOD__ . "()\n";
+ }
+
+ function __wakeup()
+ {
+ echo __METHOD__ . "()\n";
+ }
+
+ function __sleep()
+ {
+ echo __METHOD__ . "()\n";
+ return array();
+ }
}
class TestNew implements Serializable
{
- protected static $check = 0;
-
- function serialize()
- {
- echo __METHOD__ . "()\n";
- switch(++self::$check)
- {
- case 1:
- return NULL;
- case 2:
- return "2";
- }
- }
-
- function unserialize($serialized)
- {
- echo __METHOD__ . "()\n";
- }
-
- function __wakeup()
- {
- echo __METHOD__ . "()\n";
- }
-
- function __sleep()
- {
- echo __METHOD__ . "()\n";
- }
+ protected static $check = 0;
+
+ function serialize()
+ {
+ echo __METHOD__ . "()\n";
+ switch(++self::$check)
+ {
+ case 1:
+ return NULL;
+ case 2:
+ return "2";
+ }
+ }
+
+ function unserialize($serialized)
+ {
+ echo __METHOD__ . "()\n";
+ }
+
+ function __wakeup()
+ {
+ echo __METHOD__ . "()\n";
+ }
+
+ function __sleep()
+ {
+ echo __METHOD__ . "()\n";
+ }
}
echo "===O1===\n";
@@ -127,8 +127,6 @@ var_dump(unserialize('O:19:"autoload_implements":0:{}'));
echo "===AutoNA===\n";
var_dump(unserialize('O:22:"autoload_not_available":0:{}'));
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
===O1===
TestOld::__sleep()
@@ -182,4 +180,3 @@ object(__PHP_Incomplete_Class)#%d (1) {
["__PHP_Incomplete_Class_Name"]=>
string(22) "autoload_not_available"
}
-===DONE===
diff --git a/ext/standard/tests/serialize/006.phpt b/ext/standard/tests/serialize/006.phpt
index 6ba93f4d23..24b3cbbe2d 100644
--- a/ext/standard/tests/serialize/006.phpt
+++ b/ext/standard/tests/serialize/006.phpt
@@ -2,19 +2,19 @@
serialize()/unserialize() with exotic letters
--FILE--
<?php
- $åäöÅÄÖ = array('åäöÅÄÖ' => 'åäöÅÄÖ');
+ $åäöÅÄÖ = array('åäöÅÄÖ' => 'åäöÅÄÖ');
- class ÜberKööliäå
- {
- public $åäöÅÄÖüÜber = 'åäöÅÄÖ';
- }
+ class ÜberKööliäå
+ {
+ public $åäöÅÄÖüÜber = 'åäöÅÄÖ';
+ }
$foo = new Überkööliäå();
- var_dump(serialize($foo));
- var_dump(unserialize(serialize($foo)));
- var_dump(serialize($åäöÅÄÖ));
- var_dump(unserialize(serialize($åäöÅÄÖ)));
+ var_dump(serialize($foo));
+ var_dump(unserialize(serialize($foo)));
+ var_dump(serialize($åäöÅÄÖ));
+ var_dump(unserialize(serialize($åäöÅÄÖ)));
?>
--EXPECT--
string(55) "O:11:"ÜberKööliäå":1:{s:11:"åäöÅÄÖüÜber";s:6:"åäöÅÄÖ";}"
diff --git a/ext/standard/tests/serialize/autoload_implements.inc b/ext/standard/tests/serialize/autoload_implements.inc
index 55fcc3cd9f..e5f19c0680 100644
--- a/ext/standard/tests/serialize/autoload_implements.inc
+++ b/ext/standard/tests/serialize/autoload_implements.inc
@@ -1,10 +1,10 @@
<?php
class autoload_implements implements autoload_interface {
- function testFunction()
- {
- return true;
- }
+ function testFunction()
+ {
+ return true;
+ }
}
?>
diff --git a/ext/standard/tests/serialize/autoload_interface.inc b/ext/standard/tests/serialize/autoload_interface.inc
index e6a416e721..6e696f36bf 100644
--- a/ext/standard/tests/serialize/autoload_interface.inc
+++ b/ext/standard/tests/serialize/autoload_interface.inc
@@ -1,7 +1,7 @@
<?php
interface autoload_interface {
- function testFunction();
+ function testFunction();
}
?>
diff --git a/ext/standard/tests/serialize/bug14293.phpt b/ext/standard/tests/serialize/bug14293.phpt
index 73636ba56d..875f8b2bc8 100644
--- a/ext/standard/tests/serialize/bug14293.phpt
+++ b/ext/standard/tests/serialize/bug14293.phpt
@@ -4,16 +4,16 @@ Bug #14293 (serialize() and __sleep())
<?php
class t
{
- function __construct()
- {
- $this->a = 'hello';
- }
+ function __construct()
+ {
+ $this->a = 'hello';
+ }
- function __sleep()
- {
- echo "__sleep called\n";
- return array('a','b');
- }
+ function __sleep()
+ {
+ echo "__sleep called\n";
+ return array('a','b');
+ }
}
$t = new t();
diff --git a/ext/standard/tests/serialize/bug21957.phpt b/ext/standard/tests/serialize/bug21957.phpt
index 070eda3f4c..9d761a6699 100644
--- a/ext/standard/tests/serialize/bug21957.phpt
+++ b/ext/standard/tests/serialize/bug21957.phpt
@@ -4,18 +4,18 @@ Bug #21957 (serialize() mangles objects with __sleep)
<?php
class test
{
- public $a, $b;
+ public $a, $b;
- function __construct()
- {
- $this->a = 7;
- $this->b = 2;
- }
+ function __construct()
+ {
+ $this->a = 7;
+ $this->b = 2;
+ }
- function __sleep()
- {
- $this->b = 0;
- }
+ function __sleep()
+ {
+ $this->b = 0;
+ }
}
$t['one'] = 'ABC';
diff --git a/ext/standard/tests/serialize/bug23298.phpt b/ext/standard/tests/serialize/bug23298.phpt
index fe56fccc45..29d09d18e9 100644
--- a/ext/standard/tests/serialize/bug23298.phpt
+++ b/ext/standard/tests/serialize/bug23298.phpt
@@ -4,10 +4,10 @@ Bug #23298 (serialize() and floats/doubles)
serialize_precision=100
--FILE--
<?php
- ini_set('precision', 12);
- $foo = 1.428571428571428647642857142;
- $bar = unserialize(serialize($foo));
- var_dump(($foo === $bar));
+ ini_set('precision', 12);
+ $foo = 1.428571428571428647642857142;
+ $bar = unserialize(serialize($foo));
+ var_dump(($foo === $bar));
?>
--EXPECT--
bool(true)
diff --git a/ext/standard/tests/serialize/bug24063.phpt b/ext/standard/tests/serialize/bug24063.phpt
index 38c9d6ed24..e3102245f8 100644
--- a/ext/standard/tests/serialize/bug24063.phpt
+++ b/ext/standard/tests/serialize/bug24063.phpt
@@ -7,8 +7,8 @@ precision=12
<?php
$v = 1;
for ($i = 1; $i < 10; $i++) {
- $v /= 10;
- echo "{$v} ".unserialize(serialize($v))."\n";
+ $v /= 10;
+ echo "{$v} ".unserialize(serialize($v))."\n";
}
?>
--EXPECT--
diff --git a/ext/standard/tests/serialize/bug25378.phpt b/ext/standard/tests/serialize/bug25378.phpt
index 70bfbb46a3..ab8cd987e5 100644
--- a/ext/standard/tests/serialize/bug25378.phpt
+++ b/ext/standard/tests/serialize/bug25378.phpt
@@ -16,7 +16,6 @@ var_dump(unserialize("s:3000:\"123"));
var_dump(unserialize("s:3:\"123;"));
var_dump(unserialize("s:0:\"123\";"));
?>
-===DONE===
--EXPECTF--
Notice: unserialize(): Error at offset 0 of 8 bytes in %sbug25378.php on line %d
bool(false)
@@ -56,4 +55,3 @@ bool(false)
Notice: unserialize(): Error at offset 5 of 10 bytes in %sbug25378.php on line %d
bool(false)
-===DONE===
diff --git a/ext/standard/tests/serialize/bug26762.phpt b/ext/standard/tests/serialize/bug26762.phpt
index ad6c0e0b41..d4daf34464 100644
--- a/ext/standard/tests/serialize/bug26762.phpt
+++ b/ext/standard/tests/serialize/bug26762.phpt
@@ -10,15 +10,15 @@ Bug #26762 (unserialize() produces lowercase classnames)
ini_set('unserialize_callback_func','check');
function check($name) {
- var_dump($name);
- throw new exception;
+ var_dump($name);
+ throw new exception;
}
try {
- @unserialize('O:3:"FOO":0:{}');
+ @unserialize('O:3:"FOO":0:{}');
}
catch (Exception $e) {
- /* ignore */
+ /* ignore */
}
?>
diff --git a/ext/standard/tests/serialize/bug28325.phpt b/ext/standard/tests/serialize/bug28325.phpt
index ee0e60e1ad..cd909dc07d 100644
--- a/ext/standard/tests/serialize/bug28325.phpt
+++ b/ext/standard/tests/serialize/bug28325.phpt
@@ -3,13 +3,13 @@ Bug #28325 (Problem in serialisation of circular references)
--FILE--
<?php
class a {
- public $b;
+ public $b;
}
class b {
- public $c;
+ public $c;
}
class c {
- public $d;
+ public $d;
}
$a = new a();
$a->b = new b();
diff --git a/ext/standard/tests/serialize/bug30234.phpt b/ext/standard/tests/serialize/bug30234.phpt
index 41ef9dd565..66e5aa3547 100644
--- a/ext/standard/tests/serialize/bug30234.phpt
+++ b/ext/standard/tests/serialize/bug30234.phpt
@@ -8,8 +8,8 @@ Bug #30234 (__autoload() not invoked for interfaces)
<?php
spl_autoload_register(function ($class_name) {
- require_once(__DIR__ . '/' . strtolower($class_name) . '.inc');
- echo __FUNCTION__ . '(' . $class_name . ")\n";
+ require_once(__DIR__ . '/' . strtolower($class_name) . '.inc');
+ echo __FUNCTION__ . '(' . $class_name . ")\n";
});
var_dump(interface_exists('autoload_interface', false));
@@ -25,7 +25,6 @@ var_dump(interface_exists('autoload_interface', false));
var_dump(class_exists('autoload_implements', false));
?>
-===DONE===
--EXPECTF--
bool(false)
bool(false)
@@ -36,4 +35,3 @@ object(autoload_implements)#%d (0) {
bool(true)
bool(true)
bool(true)
-===DONE===
diff --git a/ext/standard/tests/serialize/bug31402.phpt b/ext/standard/tests/serialize/bug31402.phpt
index 566e959554..66ade571fc 100644
--- a/ext/standard/tests/serialize/bug31402.phpt
+++ b/ext/standard/tests/serialize/bug31402.phpt
@@ -33,7 +33,6 @@ $after = unserialize($ser);
var_dump($before, $after);
?>
-===DONE===
--EXPECTF--
object(TestY)#%d (2) {
["A"]=>
@@ -85,4 +84,3 @@ object(TestY)#%d (2) {
int(1)
}
}
-===DONE===
diff --git a/ext/standard/tests/serialize/bug49649.phpt b/ext/standard/tests/serialize/bug49649.phpt
index d6acb80764..455c1e17d4 100644
--- a/ext/standard/tests/serialize/bug49649.phpt
+++ b/ext/standard/tests/serialize/bug49649.phpt
@@ -23,11 +23,11 @@ $serialized = 'TzozOiJGb28iOjQ6e3M6MTI6IgBGb28AcHJpdmF0ZSI7aToxO3M6MTI6IgAqAHByb
class Foo
{
- public $public = null;
+ public $public = null;
- public $protected = null;
+ public $protected = null;
- public $private = null;
+ public $private = null;
}
$class = unserialize(base64_decode($serialized));
diff --git a/ext/standard/tests/serialize/bug49649_1.phpt b/ext/standard/tests/serialize/bug49649_1.phpt
index fb6d6dba52..a2f5427edd 100644
--- a/ext/standard/tests/serialize/bug49649_1.phpt
+++ b/ext/standard/tests/serialize/bug49649_1.phpt
@@ -23,11 +23,11 @@ $serialized = 'TzozOiJGb28iOjQ6e3M6MTI6IgBGb28AcHJpdmF0ZSI7aToxO3M6MTI6IgAqAHByb
class Foo
{
- protected $public = null;
+ protected $public = null;
- protected $protected = null;
+ protected $protected = null;
- protected $private = null;
+ protected $private = null;
}
$class = unserialize(base64_decode($serialized));
diff --git a/ext/standard/tests/serialize/bug49649_2.phpt b/ext/standard/tests/serialize/bug49649_2.phpt
index fe5b43a6ad..18796b21f7 100644
--- a/ext/standard/tests/serialize/bug49649_2.phpt
+++ b/ext/standard/tests/serialize/bug49649_2.phpt
@@ -23,11 +23,11 @@ $serialized = 'TzozOiJGb28iOjQ6e3M6MTI6IgBGb28AcHJpdmF0ZSI7aToxO3M6MTI6IgAqAHByb
class Foo
{
- private $public = null;
+ private $public = null;
- private $protected = null;
+ private $protected = null;
- private $private = null;
+ private $private = null;
}
$class = unserialize(base64_decode($serialized));
diff --git a/ext/standard/tests/serialize/bug65481.phpt b/ext/standard/tests/serialize/bug65481.phpt
index 65634f63ba..ece721b6fe 100644
--- a/ext/standard/tests/serialize/bug65481.phpt
+++ b/ext/standard/tests/serialize/bug65481.phpt
@@ -5,29 +5,29 @@ Bug #65481 (shutdown segfault due to serialize)
echo "Test\n";
class A {
- public $e = array();
+ public $e = array();
}
class Token implements \Serializable {
- public function serialize()
- {
- $c = new A;
+ public function serialize()
+ {
+ $c = new A;
- for ($i = 0; $i < 4; $i++)
- {
- $e = new A;
- $c->e[] = $e;
- $e->e = $c->e;
- }
+ for ($i = 0; $i < 4; $i++)
+ {
+ $e = new A;
+ $c->e[] = $e;
+ $e->e = $c->e;
+ }
- return serialize(array(serialize($c)));
- }
+ return serialize(array(serialize($c)));
+ }
- public function unserialize($str)
- {
- $r = unserialize($str);
- $r = unserialize($r[0]);
- }
+ public function unserialize($str)
+ {
+ $r = unserialize($str);
+ $r = unserialize($r[0]);
+ }
}
$token = new Token;
diff --git a/ext/standard/tests/serialize/bug65806.phpt b/ext/standard/tests/serialize/bug65806.phpt
index cefb923f23..166b694442 100644
--- a/ext/standard/tests/serialize/bug65806.phpt
+++ b/ext/standard/tests/serialize/bug65806.phpt
@@ -33,8 +33,8 @@ class myList {
}
public function __wakeup()
{
- $this->_obj = unserialize($this->_serialized);
- }
+ $this->_obj = unserialize($this->_serialized);
+ }
}
echo "SCRIPT START" . PHP_EOL;
diff --git a/ext/standard/tests/serialize/bug67072.phpt b/ext/standard/tests/serialize/bug67072.phpt
index 951db75a07..df0593180d 100644
--- a/ext/standard/tests/serialize/bug67072.phpt
+++ b/ext/standard/tests/serialize/bug67072.phpt
@@ -2,7 +2,7 @@
Bug #67072 Echoing unserialized "SplFileObject" crash
--FILE--
<?php
- echo unserialize('O:13:"SplFileObject":1:{s:9:"*filename";s:15:"/home/flag/flag";}');
+ echo unserialize('O:13:"SplFileObject":1:{s:9:"*filename";s:15:"/home/flag/flag";}');
?>
===DONE==
--EXPECTF--
diff --git a/ext/standard/tests/serialize/bug68044.phpt b/ext/standard/tests/serialize/bug68044.phpt
index 01ada07ad8..dc6053c501 100644
--- a/ext/standard/tests/serialize/bug68044.phpt
+++ b/ext/standard/tests/serialize/bug68044.phpt
@@ -2,7 +2,7 @@
Bug #68044 Integer overflow in unserialize() (32-bits only)
--FILE--
<?php
- echo unserialize('C:3:"XYZ":18446744075857035259:{}');
+ echo unserialize('C:3:"XYZ":18446744075857035259:{}');
?>
===DONE==
--EXPECTF--
diff --git a/ext/standard/tests/serialize/bug68545.phpt b/ext/standard/tests/serialize/bug68545.phpt
index c33155d269..9c37ab7c4f 100644
--- a/ext/standard/tests/serialize/bug68545.phpt
+++ b/ext/standard/tests/serialize/bug68545.phpt
@@ -4,8 +4,6 @@ Bug #68545 NULL pointer dereference in unserialize.c:var_push_dtor
<?php
var_dump(unserialize('a:6:{a:6:{s:3:"322";s:3:"bar";s:3:"bar";s:3:"foo";a:6:{a:6:{s:3:"322";s:3:"bar";s:3:"bar";s:3:"foo";s:3:"bar";a:6:{a:6:{s:3:"322";s:3:"bar";s:3:"bar";s:3:"foo";a:6:{a:6:{s:3:"322";s:3:"bar";s:3:"b22";s:3:"bar";s:3:"bar";s:3:"foo";s:3:"bar";a:6:{a:6:{s:3:"322";s:3:"bar";s:3:"bar";s:3:"foo";s:3:"bar";s:3:"bar";'));
?>
-===DONE===
--EXPECTF--
Notice: unserialize(): Error at offset %d of %d bytes in %sbug68545.php on line %d
bool(false)
-===DONE===
diff --git a/ext/standard/tests/serialize/bug68594.phpt b/ext/standard/tests/serialize/bug68594.phpt
index fbf9310d0b..69ff9e2bf4 100644
--- a/ext/standard/tests/serialize/bug68594.phpt
+++ b/ext/standard/tests/serialize/bug68594.phpt
@@ -3,19 +3,19 @@ Bug #68545 Use after free vulnerability in unserialize()
--FILE--
<?php
for ($i=4; $i<100; $i++) {
- $m = new StdClass();
+ $m = new StdClass();
- $u = array(1);
+ $u = array(1);
- $m->aaa = array(1,2,&$u,4,5);
- $m->bbb = 1;
- $m->ccc = &$u;
- $m->ddd = str_repeat("A", $i);
+ $m->aaa = array(1,2,&$u,4,5);
+ $m->bbb = 1;
+ $m->ccc = &$u;
+ $m->ddd = str_repeat("A", $i);
- $z = serialize($m);
- $z = str_replace("bbb", "aaa", $z);
- $y = unserialize($z);
- $z = serialize($y);
+ $z = serialize($m);
+ $z = str_replace("bbb", "aaa", $z);
+ $y = unserialize($z);
+ $z = serialize($y);
}
?>
===DONE===
diff --git a/ext/standard/tests/serialize/bug68976.phpt b/ext/standard/tests/serialize/bug68976.phpt
index 4e61e65354..514bd8b453 100644
--- a/ext/standard/tests/serialize/bug68976.phpt
+++ b/ext/standard/tests/serialize/bug68976.phpt
@@ -3,10 +3,10 @@ Bug #68976 Use After Free Vulnerability in unserialize()
--FILE--
<?php
class evilClass {
- public $name;
- function __wakeup() {
- unset($this->name);
- }
+ public $name;
+ function __wakeup() {
+ unset($this->name);
+ }
}
$fakezval = pack(
@@ -25,7 +25,6 @@ for($i = 0; $i < 5; $i++) {
var_dump($data);
?>
-===DONE===
--EXPECT--
array(2) {
[0]=>
@@ -34,4 +33,3 @@ array(2) {
[1]=>
int(1)
}
-===DONE===
diff --git a/ext/standard/tests/serialize/bug69152.phpt b/ext/standard/tests/serialize/bug69152.phpt
index c4dbcd6926..b11591ffc2 100644
--- a/ext/standard/tests/serialize/bug69152.phpt
+++ b/ext/standard/tests/serialize/bug69152.phpt
@@ -9,8 +9,6 @@ $x->test();
?>
--EXPECTF--
-Exception in %s:%d
-Stack trace:
-#0 {main}
-
-Fatal error: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in %s on line %d
+Fatal error: Uncaught TypeError: Trace is not an array in %s:%d
+%a
+ thrown in %s on line %d
diff --git a/ext/standard/tests/serialize/bug69210.phpt b/ext/standard/tests/serialize/bug69210.phpt
index c06fe50e02..610c88f879 100644
--- a/ext/standard/tests/serialize/bug69210.phpt
+++ b/ext/standard/tests/serialize/bug69210.phpt
@@ -4,22 +4,22 @@ serialize() integrity with non string on __sleep
<?php
class testString
{
- public $a = true;
+ public $a = true;
- public function __sleep()
- {
- return array('a', '1');
- }
+ public function __sleep()
+ {
+ return array('a', '1');
+ }
}
class testInteger
{
- public $a = true;
+ public $a = true;
- public function __sleep()
- {
- return array('a', 1);
- }
+ public function __sleep()
+ {
+ return array('a', 1);
+ }
}
$cs = new testString();
diff --git a/ext/standard/tests/serialize/bug69425.phpt b/ext/standard/tests/serialize/bug69425.phpt
index c7f4265789..e080fda7dd 100644
--- a/ext/standard/tests/serialize/bug69425.phpt
+++ b/ext/standard/tests/serialize/bug69425.phpt
@@ -6,12 +6,12 @@ Bug #69425: Use After Free in unserialize()
// POC 1
class test
{
- var $ryat;
+ var $ryat;
- function __wakeup()
- {
- $this->ryat = 1;
- }
+ function __wakeup()
+ {
+ $this->ryat = 1;
+ }
}
$data = unserialize('a:2:{i:0;O:4:"test":1:{s:4:"ryat";R:1;}i:1;i:2;}');
diff --git a/ext/standard/tests/serialize/bug69793.phpt b/ext/standard/tests/serialize/bug69793.phpt
index 8426c1573e..b2d9fbb256 100644
--- a/ext/standard/tests/serialize/bug69793.phpt
+++ b/ext/standard/tests/serialize/bug69793.phpt
@@ -7,11 +7,11 @@ $e = unserialize('O:9:"Exception":7:{s:17:"'."\0".'Exception'."\0".'string";s:1:
var_dump($e."");
?>
--EXPECTF--
-Notice: Undefined property: Exception::$file in %s%ebug69793.php on line %d
+Warning: Undefined property: Exception::$file in %s on line %d
-Notice: Undefined property: Exception::$previous in %s%ebug69793.php on line %d
+Warning: Undefined property: Exception::$previous in %s on line %d
-Notice: Undefined property: Exception::$previous in %s%ebug69793.php on line %d
+Warning: Undefined property: Exception::$previous in %s on line %d
string(41) "Exception in :1337
Stack trace:
#0 {main}"
diff --git a/ext/standard/tests/serialize/bug70172.phpt b/ext/standard/tests/serialize/bug70172.phpt
index a2359d6434..18bc2fe85d 100644
--- a/ext/standard/tests/serialize/bug70172.phpt
+++ b/ext/standard/tests/serialize/bug70172.phpt
@@ -3,13 +3,13 @@ Bug #70172 - Use After Free Vulnerability in unserialize()
--FILE--
<?php
class obj implements Serializable {
- var $data;
- function serialize() {
- return serialize($this->data);
- }
- function unserialize($data) {
- $this->data = unserialize($data);
- }
+ var $data;
+ function serialize() {
+ return serialize($this->data);
+ }
+ function unserialize($data) {
+ $this->data = unserialize($data);
+ }
}
$fakezval = ptr2str(1122334455);
@@ -25,19 +25,19 @@ $exploit = 'a:2:{i:0;i:1;i:1;C:3:"obj":'.strlen($inner).':{'.$inner.'}}';
$data = unserialize($exploit);
for ($i = 0; $i < 5; $i++) {
- $v[$i] = $fakezval.$i;
+ $v[$i] = $fakezval.$i;
}
var_dump($data);
function ptr2str($ptr)
{
- $out = '';
- for ($i = 0; $i < 8; $i++) {
- $out .= chr($ptr & 0xff);
- $ptr >>= 8;
- }
- return $out;
+ $out = '';
+ for ($i = 0; $i < 8; $i++) {
+ $out .= chr($ptr & 0xff);
+ $ptr >>= 8;
+ }
+ return $out;
}
?>
--EXPECTF--
diff --git a/ext/standard/tests/serialize/bug70172_2.phpt b/ext/standard/tests/serialize/bug70172_2.phpt
index 2b12a78edb..771f9ba1d7 100644
--- a/ext/standard/tests/serialize/bug70172_2.phpt
+++ b/ext/standard/tests/serialize/bug70172_2.phpt
@@ -3,20 +3,20 @@ Bug #70172 - Use After Free Vulnerability in unserialize()
--FILE--
<?php
class obj implements Serializable {
- var $data;
- function serialize() {
- return serialize($this->data);
- }
- function unserialize($data) {
- $this->data = unserialize($data);
- }
+ var $data;
+ function serialize() {
+ return serialize($this->data);
+ }
+ function unserialize($data) {
+ $this->data = unserialize($data);
+ }
}
class obj2 {
- var $ryat;
- function __wakeup() {
- $this->ryat = 1;
- }
+ var $ryat;
+ function __wakeup() {
+ $this->ryat = 1;
+ }
}
$fakezval = ptr2str(1122334455);
@@ -32,19 +32,19 @@ $exploit = 'a:2:{i:0;O:4:"obj2":1:{s:4:"ryat";C:3:"obj":'.strlen($inner).':{'.$i
$data = unserialize($exploit);
for ($i = 0; $i < 5; $i++) {
- $v[$i] = $fakezval.$i;
+ $v[$i] = $fakezval.$i;
}
var_dump($data);
function ptr2str($ptr)
{
- $out = '';
- for ($i = 0; $i < 8; $i++) {
- $out .= chr($ptr & 0xff);
- $ptr >>= 8;
- }
- return $out;
+ $out = '';
+ for ($i = 0; $i < 8; $i++) {
+ $out .= chr($ptr & 0xff);
+ $ptr >>= 8;
+ }
+ return $out;
}
?>
--EXPECTF--
diff --git a/ext/standard/tests/serialize/bug70213.phpt b/ext/standard/tests/serialize/bug70213.phpt
index fd7d4001f8..7129fe45f6 100644
--- a/ext/standard/tests/serialize/bug70213.phpt
+++ b/ext/standard/tests/serialize/bug70213.phpt
@@ -6,7 +6,7 @@ Bug #70213: Unserialize context shared on double class lookup
ini_set('unserialize_callback_func', 'evil');
function evil() {
- spl_autoload_register(function ($arg) {
+ spl_autoload_register(function ($arg) {
var_dump(unserialize('R:1;'));
});
}
diff --git a/ext/standard/tests/serialize/bug70436.phpt b/ext/standard/tests/serialize/bug70436.phpt
index 1bbf3b98ab..9cd97a689c 100644
--- a/ext/standard/tests/serialize/bug70436.phpt
+++ b/ext/standard/tests/serialize/bug70436.phpt
@@ -5,17 +5,17 @@ Bug #70436: Use After Free Vulnerability in unserialize()
class obj implements Serializable
{
- var $data;
+ var $data;
- function serialize()
- {
- return serialize($this->data);
- }
+ function serialize()
+ {
+ return serialize($this->data);
+ }
- function unserialize($data)
- {
- $this->data = unserialize($data);
- }
+ function unserialize($data)
+ {
+ $this->data = unserialize($data);
+ }
}
$fakezval = ptr2str(1122334455);
@@ -34,14 +34,14 @@ var_dump($data);
function ptr2str($ptr)
{
- $out = '';
+ $out = '';
- for ($i = 0; $i < 8; $i++) {
- $out .= chr($ptr & 0xff);
- $ptr >>= 8;
- }
+ for ($i = 0; $i < 8; $i++) {
+ $out .= chr($ptr & 0xff);
+ $ptr >>= 8;
+ }
- return $out;
+ return $out;
}
?>
DONE
diff --git a/ext/standard/tests/serialize/bug70513.phpt b/ext/standard/tests/serialize/bug70513.phpt
index cbdbdb8222..4f228b5b7b 100644
--- a/ext/standard/tests/serialize/bug70513.phpt
+++ b/ext/standard/tests/serialize/bug70513.phpt
@@ -7,12 +7,12 @@ Bug #70513: GMP Deserialization Type Confusion Vulnerability
class obj
{
- var $ryat;
+ var $ryat;
- function __wakeup()
- {
- $this->ryat = 1;
- }
+ function __wakeup()
+ {
+ $this->ryat = 1;
+ }
}
$obj = new stdClass;
diff --git a/ext/standard/tests/serialize/bug71995.phpt b/ext/standard/tests/serialize/bug71995.phpt
index 0f7ac98722..f1c45d25cc 100644
--- a/ext/standard/tests/serialize/bug71995.phpt
+++ b/ext/standard/tests/serialize/bug71995.phpt
@@ -4,13 +4,13 @@ Bug #71995 (Returning the same var twice from __sleep() produces broken serializ
<?php
class A {
- public $b;
- public function __construct() {
- $this->b = new StdClass();
- }
- public function __sleep() {
- return array("b", "b");
- }
+ public $b;
+ public function __construct() {
+ $this->b = new StdClass();
+ }
+ public function __sleep() {
+ return array("b", "b");
+ }
}
$a = new A();
$s = serialize($a);
diff --git a/ext/standard/tests/serialize/bug72731.phpt b/ext/standard/tests/serialize/bug72731.phpt
index 020fb3281f..9489928cfb 100644
--- a/ext/standard/tests/serialize/bug72731.phpt
+++ b/ext/standard/tests/serialize/bug72731.phpt
@@ -4,10 +4,10 @@ Bug #72731: Type Confusion in Object Deserialization
<?php
class obj {
- var $ryat;
- function __wakeup() {
- $this->ryat = 0x1122334455;
- }
+ var $ryat;
+ function __wakeup() {
+ $this->ryat = 0x1122334455;
+ }
}
$poc = 'O:8:"stdClass":1:{i:0;O:3:"obj":1:{s:4:"ryat";R:1;}}';
diff --git a/ext/standard/tests/serialize/bug73341.phpt b/ext/standard/tests/serialize/bug73341.phpt
index 86fd457c60..2f38949c1a 100644
--- a/ext/standard/tests/serialize/bug73341.phpt
+++ b/ext/standard/tests/serialize/bug73341.phpt
@@ -6,7 +6,7 @@ try {
$token = 'a:2:{i:0;O:1:"0":2:0s:1:"0";i:0;s:1:"0";a:1:{i:0;C:11:"ArrayObject":7:{x:i:0;r}';
$obj = unserialize($token);
} catch(Exception $e) {
- echo $e->getMessage()."\n";
+ echo $e->getMessage()."\n";
}
try {
@@ -14,7 +14,7 @@ $inner = 'x:i:1;O:8:"stdClass":1:{};m:a:0:{}';
$exploit = 'C:11:"ArrayObject":'.strlen($inner).':{'.$inner.'}';
unserialize($exploit);
} catch(Exception $e) {
- echo $e->getMessage()."\n";
+ echo $e->getMessage()."\n";
}
?>
--EXPECTF--
diff --git a/ext/standard/tests/serialize/bug74300.phpt b/ext/standard/tests/serialize/bug74300.phpt
index d9adda256b..53c6e9a01f 100644
--- a/ext/standard/tests/serialize/bug74300.phpt
+++ b/ext/standard/tests/serialize/bug74300.phpt
@@ -7,10 +7,8 @@ serialize_precision=10
var_dump(unserialize('d:2e+2;'));
var_dump(unserialize('d:2e++2;'));
?>
-===DONE===
--EXPECTF--
float(200)
Notice: unserialize(): Error at offset 0 of 8 bytes in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/standard/tests/serialize/bug76300.phpt b/ext/standard/tests/serialize/bug76300.phpt
index 13e50f0332..156c31a909 100644
--- a/ext/standard/tests/serialize/bug76300.phpt
+++ b/ext/standard/tests/serialize/bug76300.phpt
@@ -3,19 +3,19 @@ Bug #76300: Unserialize of extended protected member broken
--FILE--
<?php
class Base {
- private $id;
- public function __construct($id)
- {
- $this->id = $id;
- }
+ private $id;
+ public function __construct($id)
+ {
+ $this->id = $id;
+ }
}
class Derived extends Base {
- protected $id;
- public function __construct($id)
- {
- parent::__construct($id + 20);
- $this->id = $id;
- }
+ protected $id;
+ public function __construct($id)
+ {
+ parent::__construct($id + 20);
+ $this->id = $id;
+ }
}
$a = new Derived(44);
$s = serialize($a);
diff --git a/ext/standard/tests/serialize/max_depth.phpt b/ext/standard/tests/serialize/max_depth.phpt
index f20d9a7ccd..5e1c869b1d 100644
--- a/ext/standard/tests/serialize/max_depth.phpt
+++ b/ext/standard/tests/serialize/max_depth.phpt
@@ -8,8 +8,17 @@ function create_nested_data($depth, $prefix, $suffix, $inner = 'i:0;') {
}
echo "Invalid max_depth:\n";
-var_dump(unserialize('i:0;', ['max_depth' => 'foo']));
-var_dump(unserialize('i:0;', ['max_depth' => -1]));
+try {
+ unserialize('i:0;', ['max_depth' => 'foo']);
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+try {
+ unserialize('i:0;', ['max_depth' => -1]);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
echo "Array:\n";
var_dump(unserialize(
@@ -59,7 +68,7 @@ class Test implements Serializable {
public function unserialize($str) {
// Should fail, due to combined nesting level
var_dump(unserialize(create_nested_data(129, 'a:1:{i:0;', '}')));
- // Should succeeed, below combined nesting level
+ // Should succeed, below combined nesting level
var_dump(unserialize(create_nested_data(128, 'a:1:{i:0;', '}')) !== false);
}
}
@@ -95,12 +104,8 @@ var_dump(is_array(unserialize(
?>
--EXPECTF--
Invalid max_depth:
-
-Warning: unserialize(): max_depth should be int in %s on line %d
-bool(false)
-
-Warning: unserialize(): max_depth cannot be negative in %s on line %d
-bool(false)
+max_depth should be int
+max_depth cannot be negative
Array:
bool(true)
diff --git a/ext/standard/tests/serialize/precision.phpt b/ext/standard/tests/serialize/precision.phpt
index 229c514e69..ec6d8e3408 100644
--- a/ext/standard/tests/serialize/precision.phpt
+++ b/ext/standard/tests/serialize/precision.phpt
@@ -8,30 +8,30 @@ if (pack('s', 1) != "\x01\x00")
<?php
$numbers = array(
- "0000000000000000", //0
- "2d431cebe2362a3f", //.0002
- "2e431cebe2362a3f", //.0002 + 10^-Accuracy[.0002]*1.01
- "0000000000001000", //2^-1022. (minimum normal double)
- "0100000000001000", //2^-1022. + 10^-Accuracy[2^-1022.]*1.01
- "ffffffffffffef7f", //2^1024. (maximum normal double)
- "feffffffffffef7f", //2^1024. - 10^-Accuracy[2^1024.]
- "0100000000000000", //minimum subnormal double
- "0200000000000000", //2nd minimum subnormal double
- "fffffffffffff000", //maximum subnormal double
- "fefffffffffff000", //2nd maximum subnormal double
- "0000000000000f7f", //+inf
- "0000000000000fff", //-inf
+ "0000000000000000", //0
+ "2d431cebe2362a3f", //.0002
+ "2e431cebe2362a3f", //.0002 + 10^-Accuracy[.0002]*1.01
+ "0000000000001000", //2^-1022. (minimum normal double)
+ "0100000000001000", //2^-1022. + 10^-Accuracy[2^-1022.]*1.01
+ "ffffffffffffef7f", //2^1024. (maximum normal double)
+ "feffffffffffef7f", //2^1024. - 10^-Accuracy[2^1024.]
+ "0100000000000000", //minimum subnormal double
+ "0200000000000000", //2nd minimum subnormal double
+ "fffffffffffff000", //maximum subnormal double
+ "fefffffffffff000", //2nd maximum subnormal double
+ "0000000000000f7f", //+inf
+ "0000000000000fff", //-inf
);
foreach ($numbers as $ns) {
- $num = unpack("d", pack("H*", $ns)); $num = reset($num);
- echo "number: ", sprintf("%.17e", $num), "... ";
- $num2 = unserialize(serialize($num));
- $repr = unpack("H*", pack("d", $num2)); $repr = reset($repr);
- if ($repr == $ns)
- echo "OK\n";
- else
- echo "mismatch\n\twas: $ns\n\tbecame: $repr\n";
+ $num = unpack("d", pack("H*", $ns)); $num = reset($num);
+ echo "number: ", sprintf("%.17e", $num), "... ";
+ $num2 = unserialize(serialize($num));
+ $repr = unpack("H*", pack("d", $num2)); $repr = reset($repr);
+ if ($repr == $ns)
+ echo "OK\n";
+ else
+ echo "mismatch\n\twas: $ns\n\tbecame: $repr\n";
}
--EXPECT--
number: 0.00000000000000000e+0... OK
diff --git a/ext/standard/tests/serialize/serialization_arrays_002.phpt b/ext/standard/tests/serialize/serialization_arrays_002.phpt
index 39212b6455..67ad5b5daa 100644
--- a/ext/standard/tests/serialize/serialization_arrays_002.phpt
+++ b/ext/standard/tests/serialize/serialization_arrays_002.phpt
@@ -1,5 +1,5 @@
--TEST--
-serialization: arrays with references amonst elements
+serialization: arrays with references amongst elements
--FILE--
<?php
/* Prototype : proto string serialize(mixed variable)
@@ -14,18 +14,18 @@ serialization: arrays with references amonst elements
*/
function check(&$a) {
- var_dump($a);
- $ser = serialize($a);
- var_dump($ser);
+ var_dump($a);
+ $ser = serialize($a);
+ var_dump($ser);
- $b = unserialize($ser);
- var_dump($b);
- $b[0] = "b0.changed";
- var_dump($b);
- $b[1] = "b1.changed";
- var_dump($b);
- $b[2] = "b2.changed";
- var_dump($b);
+ $b = unserialize($ser);
+ var_dump($b);
+ $b[0] = "b0.changed";
+ var_dump($b);
+ $b[1] = "b1.changed";
+ var_dump($b);
+ $b[2] = "b2.changed";
+ var_dump($b);
}
echo "\n\n--- No references:\n";
diff --git a/ext/standard/tests/serialize/serialization_arrays_003.phpt b/ext/standard/tests/serialize/serialization_arrays_003.phpt
index 18238d7b1e..8444f812a5 100644
--- a/ext/standard/tests/serialize/serialization_arrays_003.phpt
+++ b/ext/standard/tests/serialize/serialization_arrays_003.phpt
@@ -14,18 +14,18 @@ serialization: arrays with references to an external variable
*/
function check(&$a) {
- var_dump($a);
- $ser = serialize($a);
- var_dump($ser);
+ var_dump($a);
+ $ser = serialize($a);
+ var_dump($ser);
- $b = unserialize($ser);
- var_dump($b);
- $b[0] = "b0.changed";
- var_dump($b);
- $b[1] = "b1.changed";
- var_dump($b);
- $b[2] = "b2.changed";
- var_dump($b);
+ $b = unserialize($ser);
+ var_dump($b);
+ $b[0] = "b0.changed";
+ var_dump($b);
+ $b[1] = "b1.changed";
+ var_dump($b);
+ $b[2] = "b2.changed";
+ var_dump($b);
}
echo "\n\n--- 0 refs external:\n";
diff --git a/ext/standard/tests/serialize/serialization_arrays_004.phpt b/ext/standard/tests/serialize/serialization_arrays_004.phpt
index a6209688ea..b3d630ecf4 100644
--- a/ext/standard/tests/serialize/serialization_arrays_004.phpt
+++ b/ext/standard/tests/serialize/serialization_arrays_004.phpt
@@ -14,18 +14,18 @@ serialization: arrays with references to the containing array
*/
function check(&$a) {
- var_dump($a);
- $ser = serialize($a);
- var_dump($ser);
+ var_dump($a);
+ $ser = serialize($a);
+ var_dump($ser);
- $b = unserialize($ser);
- var_dump($b);
- $b[0] = "b0.changed";
- var_dump($b);
- $b[1] = "b1.changed";
- var_dump($b);
- $b[2] = "b2.changed";
- var_dump($b);
+ $b = unserialize($ser);
+ var_dump($b);
+ $b[0] = "b0.changed";
+ var_dump($b);
+ $b[1] = "b1.changed";
+ var_dump($b);
+ $b[2] = "b2.changed";
+ var_dump($b);
}
echo "\n\n--- 1 refs container:\n";
@@ -55,14 +55,7 @@ echo "Done";
--- 1 refs container:
array(3) {
[0]=>
- &array(3) {
- [0]=>
- *RECURSION*
- [1]=>
- int(1)
- [2]=>
- int(1)
- }
+ *RECURSION*
[1]=>
int(1)
[2]=>
@@ -113,23 +106,9 @@ array(3) {
--- 1,2 ref container:
array(3) {
[0]=>
- &array(3) {
- [0]=>
- *RECURSION*
- [1]=>
- *RECURSION*
- [2]=>
- int(1)
- }
+ *RECURSION*
[1]=>
- &array(3) {
- [0]=>
- *RECURSION*
- [1]=>
- *RECURSION*
- [2]=>
- int(1)
- }
+ *RECURSION*
[2]=>
int(1)
}
@@ -185,32 +164,11 @@ array(3) {
--- 1,2,3 ref container:
array(3) {
[0]=>
- &array(3) {
- [0]=>
- *RECURSION*
- [1]=>
- *RECURSION*
- [2]=>
- *RECURSION*
- }
+ *RECURSION*
[1]=>
- &array(3) {
- [0]=>
- *RECURSION*
- [1]=>
- *RECURSION*
- [2]=>
- *RECURSION*
- }
+ *RECURSION*
[2]=>
- &array(3) {
- [0]=>
- *RECURSION*
- [1]=>
- *RECURSION*
- [2]=>
- *RECURSION*
- }
+ *RECURSION*
}
string(56) "a:3:{i:0;a:3:{i:0;R:2;i:1;R:2;i:2;R:2;}i:1;R:2;i:2;R:2;}"
array(3) {
diff --git a/ext/standard/tests/serialize/serialization_arrays_005.phpt b/ext/standard/tests/serialize/serialization_arrays_005.phpt
index 9d3bbcabea..93e3ae5135 100644
--- a/ext/standard/tests/serialize/serialization_arrays_005.phpt
+++ b/ext/standard/tests/serialize/serialization_arrays_005.phpt
@@ -14,24 +14,24 @@ serialization: arrays with references, nested
*/
function check(&$a) {
- var_dump($a);
- $ser = serialize($a);
- var_dump($ser);
+ var_dump($a);
+ $ser = serialize($a);
+ var_dump($ser);
- $b = unserialize($ser);
+ $b = unserialize($ser);
- // Change each element and dump result.
- foreach($b as $k=>$v) {
- if (is_array($v)){
- foreach($b[$k] as $sk=>$sv) {
- $b[$k][$sk] = "b$k.$sk.changed";
- var_dump($b);
- }
- } else {
- $b[$k] = "b$k.changed";
- var_dump($b);
- }
- }
+ // Change each element and dump result.
+ foreach($b as $k=>$v) {
+ if (is_array($v)){
+ foreach($b[$k] as $sk=>$sv) {
+ $b[$k][$sk] = "b$k.$sk.changed";
+ var_dump($b);
+ }
+ } else {
+ $b[$k] = "b$k.changed";
+ var_dump($b);
+ }
+ }
}
echo "\n\n--- Nested array references 1 element in containing array:\n";
@@ -435,14 +435,7 @@ array(3) {
[0]=>
int(1)
[1]=>
- &array(3) {
- [0]=>
- int(1)
- [1]=>
- int(1)
- [2]=>
- *RECURSION*
- }
+ *RECURSION*
}
}
string(74) "a:3:{i:0;i:1;i:1;i:1;i:2;a:2:{i:0;i:1;i:1;a:3:{i:0;i:1;i:1;i:1;i:2;R:4;}}}"
diff --git a/ext/standard/tests/serialize/serialization_objects_002.phpt b/ext/standard/tests/serialize/serialization_objects_002.phpt
index c7f9e1cbd3..920fd35310 100644
--- a/ext/standard/tests/serialize/serialization_objects_002.phpt
+++ b/ext/standard/tests/serialize/serialization_objects_002.phpt
Binary files differ
diff --git a/ext/standard/tests/serialize/serialization_objects_005.phpt b/ext/standard/tests/serialize/serialization_objects_005.phpt
index 4c631c6a59..48325f4fba 100644
--- a/ext/standard/tests/serialize/serialization_objects_005.phpt
+++ b/ext/standard/tests/serialize/serialization_objects_005.phpt
@@ -77,7 +77,7 @@ string(9) "p.changed"
bool(false)
bool(true)
-Notice: Undefined property: C::$x in %s on line 37
+Warning: Undefined property: C::$x in %s on line %d
NULL
diff --git a/ext/standard/tests/serialize/serialization_objects_007.phpt b/ext/standard/tests/serialize/serialization_objects_007.phpt
index ff584a0919..5082b7ff01 100644
--- a/ext/standard/tests/serialize/serialization_objects_007.phpt
+++ b/ext/standard/tests/serialize/serialization_objects_007.phpt
@@ -14,13 +14,13 @@ Ensure __autoload is called twice if unserialize_callback_func is defined.
*/
spl_autoload_register(function ($name) {
- echo "in autoload($name)\n";
+ echo "in autoload($name)\n";
});
ini_set('unserialize_callback_func','check');
function check($name) {
- echo "in check($name)\n";
+ echo "in check($name)\n";
}
$o = unserialize('O:3:"FOO":0:{}');
diff --git a/ext/standard/tests/serialize/serialization_objects_010.phpt b/ext/standard/tests/serialize/serialization_objects_010.phpt
index 32205209f7..51938710cd 100644
--- a/ext/standard/tests/serialize/serialization_objects_010.phpt
+++ b/ext/standard/tests/serialize/serialization_objects_010.phpt
@@ -14,18 +14,18 @@ Serialize() must return a string or NULL
*/
Class C implements Serializable {
- public function serialize() {
- return $this;
- }
+ public function serialize() {
+ return $this;
+ }
- public function unserialize($blah) {
- }
+ public function unserialize($blah) {
+ }
}
try {
- var_dump(serialize(new C));
+ var_dump(serialize(new C));
} catch (Exception $e) {
- echo $e->getMessage(). "\n";
+ echo $e->getMessage(). "\n";
}
echo "Done";
diff --git a/ext/standard/tests/serialize/serialization_objects_011.phpt b/ext/standard/tests/serialize/serialization_objects_011.phpt
index a224a13d0c..9f360c2cb9 100644
--- a/ext/standard/tests/serialize/serialization_objects_011.phpt
+++ b/ext/standard/tests/serialize/serialization_objects_011.phpt
@@ -14,57 +14,57 @@ Object serialization / unserialization with inherited and hidden properties.
*/
Class A {
- private $APriv = "A.APriv";
- protected $AProt = "A.AProt";
- public $APub = "A.APub";
+ private $APriv = "A.APriv";
+ protected $AProt = "A.AProt";
+ public $APub = "A.APub";
- function audit() {
- return isset($this->APriv, $this->AProt, $this->APub);
- }
+ function audit() {
+ return isset($this->APriv, $this->AProt, $this->APub);
+ }
}
Class B extends A {
- private $BPriv = "B.BPriv";
- protected $BProt = "B.BProt";
- public $BPub = "B.BPub";
-
- function audit() {
- return parent::audit() && isset($this->AProt, $this->APub,
- $this->BPriv, $this->BProt, $this->BPub);
- }
+ private $BPriv = "B.BPriv";
+ protected $BProt = "B.BProt";
+ public $BPub = "B.BPub";
+
+ function audit() {
+ return parent::audit() && isset($this->AProt, $this->APub,
+ $this->BPriv, $this->BProt, $this->BPub);
+ }
}
Class C extends B {
- private $APriv = "C.APriv";
- protected $AProt = "C.AProt";
- public $APub = "C.APub";
-
- private $CPriv = "C.CPriv";
- protected $CProt = "C.BProt";
- public $CPub = "C.CPub";
-
- function audit() {
- return parent::audit() && isset($this->APriv, $this->AProt, $this->APub,
- $this->BProt, $this->BPub,
- $this->CPriv, $this->CProt, $this->CPub);
- }
+ private $APriv = "C.APriv";
+ protected $AProt = "C.AProt";
+ public $APub = "C.APub";
+
+ private $CPriv = "C.CPriv";
+ protected $CProt = "C.BProt";
+ public $CPub = "C.CPub";
+
+ function audit() {
+ return parent::audit() && isset($this->APriv, $this->AProt, $this->APub,
+ $this->BProt, $this->BPub,
+ $this->CPriv, $this->CProt, $this->CPub);
+ }
}
function prettyPrint($obj) {
- echo "\n\nBefore serialization:\n";
- var_dump($obj);
+ echo "\n\nBefore serialization:\n";
+ var_dump($obj);
- echo "Serialized form:\n";
- $ser = serialize($obj);
- $serPrintable = str_replace("\0", '\0', $ser);
- var_dump($serPrintable);
+ echo "Serialized form:\n";
+ $ser = serialize($obj);
+ $serPrintable = str_replace("\0", '\0', $ser);
+ var_dump($serPrintable);
- echo "Unserialized:\n";
- $uobj = unserialize($ser);
- var_dump($uobj);
+ echo "Unserialized:\n";
+ $uobj = unserialize($ser);
+ var_dump($uobj);
- echo "Sanity check: ";
- var_dump($uobj->audit());
+ echo "Sanity check: ";
+ var_dump($uobj->audit());
}
echo "-- Test instance of A --\n";
diff --git a/ext/standard/tests/serialize/serialization_objects_013.phpt b/ext/standard/tests/serialize/serialization_objects_013.phpt
index 3ff2d3cc11..547d7f75e8 100644
--- a/ext/standard/tests/serialize/serialization_objects_013.phpt
+++ b/ext/standard/tests/serialize/serialization_objects_013.phpt
@@ -14,18 +14,18 @@ Object serialization / unserialization: references amongst properties
*/
function check(&$obj) {
- var_dump($obj);
- $ser = serialize($obj);
- var_dump($ser);
+ var_dump($obj);
+ $ser = serialize($obj);
+ var_dump($ser);
- $uobj = unserialize($ser);
- var_dump($uobj);
- $uobj->a = "obj->a.changed";
- var_dump($uobj);
- $uobj->b = "obj->b.changed";
- var_dump($uobj);
- $uobj->c = "obj->c.changed";
- var_dump($uobj);
+ $uobj = unserialize($ser);
+ var_dump($uobj);
+ $uobj->a = "obj->a.changed";
+ var_dump($uobj);
+ $uobj->b = "obj->b.changed";
+ var_dump($uobj);
+ $uobj->c = "obj->c.changed";
+ var_dump($uobj);
}
echo "\n\n--- a refs b:\n";
diff --git a/ext/standard/tests/serialize/serialization_objects_014.phpt b/ext/standard/tests/serialize/serialization_objects_014.phpt
index fa15a577b0..b8bf6fd3bc 100644
--- a/ext/standard/tests/serialize/serialization_objects_014.phpt
+++ b/ext/standard/tests/serialize/serialization_objects_014.phpt
@@ -14,18 +14,18 @@ Object serialization / unserialization: references to external values
*/
function check(&$obj) {
- var_dump($obj);
- $ser = serialize($obj);
- var_dump($ser);
+ var_dump($obj);
+ $ser = serialize($obj);
+ var_dump($ser);
- $uobj = unserialize($ser);
- var_dump($uobj);
- $uobj->a = "obj->a.changed";
- var_dump($uobj);
- $uobj->b = "obj->b.changed";
- var_dump($uobj);
- $uobj->c = "obj->c.changed";
- var_dump($uobj);
+ $uobj = unserialize($ser);
+ var_dump($uobj);
+ $uobj->a = "obj->a.changed";
+ var_dump($uobj);
+ $uobj->b = "obj->b.changed";
+ var_dump($uobj);
+ $uobj->c = "obj->c.changed";
+ var_dump($uobj);
}
echo "\n\n--- a refs external:\n";
diff --git a/ext/standard/tests/serialize/serialization_objects_015.phpt b/ext/standard/tests/serialize/serialization_objects_015.phpt
index c1a6675db4..522450bfc1 100644
--- a/ext/standard/tests/serialize/serialization_objects_015.phpt
+++ b/ext/standard/tests/serialize/serialization_objects_015.phpt
@@ -4,18 +4,18 @@ Object serialization / unserialization: properties reference containing object
<?php
function check(&$obj) {
- var_dump($obj);
- $ser = serialize($obj);
- var_dump($ser);
+ var_dump($obj);
+ $ser = serialize($obj);
+ var_dump($ser);
- $uobj = unserialize($ser);
- var_dump($uobj);
- $uobj->a = "obj->a.changed";
- var_dump($uobj);
- $uobj->b = "obj->b.changed";
- var_dump($uobj);
- $uobj->c = "obj->c.changed";
- var_dump($uobj);
+ $uobj = unserialize($ser);
+ var_dump($uobj);
+ $uobj->a = "obj->a.changed";
+ var_dump($uobj);
+ $uobj->b = "obj->b.changed";
+ var_dump($uobj);
+ $uobj->c = "obj->c.changed";
+ var_dump($uobj);
}
echo "\n\n--- a refs container:\n";
diff --git a/ext/standard/tests/serialize/typed_property_refs.phpt b/ext/standard/tests/serialize/typed_property_refs.phpt
index 9475e8a783..3c8096a392 100644
--- a/ext/standard/tests/serialize/typed_property_refs.phpt
+++ b/ext/standard/tests/serialize/typed_property_refs.phpt
@@ -4,18 +4,18 @@ unserialize with references to typed properties shall skip the references or fai
<?php
class A {
- public int $a;
- public $b;
+ public int $a;
+ public $b;
}
class B {
- public $a;
- public int $b;
+ public $a;
+ public int $b;
}
class C {
- public int $a;
- public string $b;
+ public int $a;
+ public string $b;
}
class D {
@@ -66,8 +66,8 @@ object(B)#1 (2) {
["b"]=>
&int(1)
}
-Typed property A::$a must be int, null used
-Typed property B::$b must be int, null used
-Typed property C::$b must be string, int used
-Typed property C::$a must be int, string used
+Cannot assign null to property A::$a of type int
+Cannot assign null to property B::$b of type int
+Cannot assign int to property C::$b of type string
+Cannot assign string to property C::$a of type int
Reference with value of type int held by property D::$a of type int is not compatible with property D::$b of type float
diff --git a/ext/standard/tests/serialize/unserialize_mem_leak.phpt b/ext/standard/tests/serialize/unserialize_mem_leak.phpt
index 2a295d83b9..ad010df535 100644
--- a/ext/standard/tests/serialize/unserialize_mem_leak.phpt
+++ b/ext/standard/tests/serialize/unserialize_mem_leak.phpt
@@ -5,7 +5,7 @@ report_memleaks=1
--FILE--
<?php
function foo() {
- gc_collect_cycles();
+ gc_collect_cycles();
}
$str = 'a:1:{i:0;R:1;}';
diff --git a/ext/standard/tests/streams/bug40459.phpt b/ext/standard/tests/streams/bug40459.phpt
index ce06a3f804..437e44e3d7 100644
--- a/ext/standard/tests/streams/bug40459.phpt
+++ b/ext/standard/tests/streams/bug40459.phpt
@@ -6,53 +6,53 @@ allow_url_fopen=1
<?php
// Test whether the constructor of the user-space stream wrapper is called when stream functions are called
class testwrapper {
- private $constructorCalled = false;
- function __construct() {
- $this->constructorCalled = true;
- }
-
- function stream_open($path, $mode, $options, &$opened_path)
- {
- echo $this->constructorCalled ? 'yes' : 'no';
- return true;
- }
-
- function url_stat($url, $flags)
- {
- echo $this->constructorCalled ? 'yes' : 'no';
- return array();
- }
-
- function unlink($url)
- {
- echo $this->constructorCalled ? 'yes' : 'no';
- }
-
- function rename($from, $to)
- {
- echo $this->constructorCalled ? 'yes' : 'no';
- }
-
- function mkdir($dir, $mode, $options)
- {
- echo $this->constructorCalled ? 'yes' : 'no';
- }
-
- function rmdir($dir, $options)
- {
- echo $this->constructorCalled ? 'yes' : 'no';
- }
-
- function dir_opendir($url, $options)
- {
- echo $this->constructorCalled ? 'yes' : 'no';
- return TRUE;
- }
- function stream_metadata()
- {
- echo $this->constructorCalled ? 'yes' : 'no';
- return TRUE;
- }
+ private $constructorCalled = false;
+ function __construct() {
+ $this->constructorCalled = true;
+ }
+
+ function stream_open($path, $mode, $options, &$opened_path)
+ {
+ echo $this->constructorCalled ? 'yes' : 'no';
+ return true;
+ }
+
+ function url_stat($url, $flags)
+ {
+ echo $this->constructorCalled ? 'yes' : 'no';
+ return array();
+ }
+
+ function unlink($url)
+ {
+ echo $this->constructorCalled ? 'yes' : 'no';
+ }
+
+ function rename($from, $to)
+ {
+ echo $this->constructorCalled ? 'yes' : 'no';
+ }
+
+ function mkdir($dir, $mode, $options)
+ {
+ echo $this->constructorCalled ? 'yes' : 'no';
+ }
+
+ function rmdir($dir, $options)
+ {
+ echo $this->constructorCalled ? 'yes' : 'no';
+ }
+
+ function dir_opendir($url, $options)
+ {
+ echo $this->constructorCalled ? 'yes' : 'no';
+ return TRUE;
+ }
+ function stream_metadata()
+ {
+ echo $this->constructorCalled ? 'yes' : 'no';
+ return TRUE;
+ }
}
stream_wrapper_register('test', 'testwrapper', STREAM_IS_URL);
@@ -92,7 +92,6 @@ echo "\n";
?>
-==DONE==
--EXPECT--
stream_open: yes
url_stat: yes
@@ -102,4 +101,3 @@ mkdir: yes
rename: yes
unlink: yes
touch: yes
-==DONE==
diff --git a/ext/standard/tests/streams/bug44712.phpt b/ext/standard/tests/streams/bug44712.phpt
index a5a718351f..04b7e5ce40 100644
--- a/ext/standard/tests/streams/bug44712.phpt
+++ b/ext/standard/tests/streams/bug44712.phpt
@@ -3,7 +3,11 @@ bug#44712 (stream_context_set_params segfaults on invalid arguments)
--FILE--
<?php
$ctx = stream_context_get_default();
-stream_context_set_params($ctx, array("options" => 1));
+try {
+ stream_context_set_params($ctx, array("options" => 1));
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
?>
---EXPECTF--
-Warning: stream_context_set_params(): Invalid stream/context parameter in %sbug44712.php on line %d
+--EXPECT--
+Invalid stream/context parameter
diff --git a/ext/standard/tests/streams/bug44818.phpt b/ext/standard/tests/streams/bug44818.phpt
index 0446dfd3be..2fe14bd0f1 100644
--- a/ext/standard/tests/streams/bug44818.phpt
+++ b/ext/standard/tests/streams/bug44818.phpt
@@ -3,11 +3,11 @@ Bug #44818 (php://memory writeable when opened read only)
--FILE--
<?php
function test($url, $mode) {
- echo "$url, $mode\n";
- $fd = fopen($url, $mode);
- var_dump($fd, fwrite($fd, "foo"));
- var_dump(fseek($fd, 0, SEEK_SET), fread($fd, 3));
- fclose($fd);
+ echo "$url, $mode\n";
+ $fd = fopen($url, $mode);
+ var_dump($fd, fwrite($fd, "foo"));
+ var_dump(fseek($fd, 0, SEEK_SET), fread($fd, 3));
+ fclose($fd);
}
test("php://memory","r");
test("php://memory","r+");
diff --git a/ext/standard/tests/streams/bug46024.phpt b/ext/standard/tests/streams/bug46024.phpt
index 4fb0eee402..145e66c1bd 100644
--- a/ext/standard/tests/streams/bug46024.phpt
+++ b/ext/standard/tests/streams/bug46024.phpt
@@ -7,13 +7,13 @@ Bug #46024 stream_select() doesn't return the correct number
$php = realpath(getenv('TEST_PHP_EXECUTABLE'));
$pipes = array();
$proc = proc_open(
- "$php -n -i"
- ,array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'))
- ,$pipes, __DIR__, array(), array()
+ "$php -n -i"
+ ,array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'))
+ ,$pipes, __DIR__, array(), array()
);
var_dump($proc);
if (!$proc) {
- exit(1);
+ exit(1);
}
$r = array($pipes[1]);
$w = array($pipes[0]);
@@ -30,13 +30,13 @@ var_dump($ret === (count($r) + count($w)));
foreach($pipes as $pipe) {
- fclose($pipe);
+ fclose($pipe);
}
proc_terminate($proc);
if (defined('SIGKILL')) {
- proc_terminate($proc, SIGKILL);
+ proc_terminate($proc, SIGKILL);
} else {
- proc_terminate($proc);
+ proc_terminate($proc);
}
proc_close($proc);
?>
diff --git a/ext/standard/tests/streams/bug46426.phpt b/ext/standard/tests/streams/bug46426.phpt
index 8c95ea456e..b69c6c557b 100644
--- a/ext/standard/tests/streams/bug46426.phpt
+++ b/ext/standard/tests/streams/bug46426.phpt
@@ -21,8 +21,6 @@ echo stream_get_contents($tmp, 1, 0);
echo "\n";
echo stream_get_contents($tmp, -1);
-@unlink($tmp);
-
?>
--EXPECT--
23
diff --git a/ext/standard/tests/streams/bug49936.phpt b/ext/standard/tests/streams/bug49936.phpt
index dccf87474c..d38d15624e 100644
--- a/ext/standard/tests/streams/bug49936.phpt
+++ b/ext/standard/tests/streams/bug49936.phpt
@@ -14,8 +14,6 @@ var_dump(@opendir($dir));
var_dump(@opendir($dir));
?>
-===DONE===
--EXPECT--
bool(false)
bool(false)
-===DONE===
diff --git a/ext/standard/tests/streams/bug49936_win32.phpt b/ext/standard/tests/streams/bug49936_win32.phpt
index 594fcae4be..0f0ef4feb1 100644
--- a/ext/standard/tests/streams/bug49936_win32.phpt
+++ b/ext/standard/tests/streams/bug49936_win32.phpt
@@ -20,11 +20,11 @@ var_dump(opendir($dir));
Warning: opendir(): connect() failed: %s
in %s on line %d
-Warning: opendir(ftp://...@localhost/): failed to open dir: operation failed in %s on line %d
+Warning: opendir(ftp://...@localhost/): Failed to open directory: operation failed in %s on line %d
bool(false)
Warning: opendir(): connect() failed: %s
in %s on line %d
-Warning: opendir(ftp://...@localhost/): failed to open dir: operation failed in %s on line %d
+Warning: opendir(ftp://...@localhost/): Failed to open directory: operation failed in %s on line %d
bool(false)
diff --git a/ext/standard/tests/streams/bug53903.phpt b/ext/standard/tests/streams/bug53903.phpt
index fd0b770f6b..d4c3586dd9 100644
--- a/ext/standard/tests/streams/bug53903.phpt
+++ b/ext/standard/tests/streams/bug53903.phpt
@@ -9,11 +9,11 @@ class sw {
return true;
}
- public function stream_stat() {
- return array(
+ public function stream_stat() {
+ return array(
'atime' => $this->undefined,
);
- }
+ }
}
stream_wrapper_register('sx', 'sw') or die('failed');
@@ -24,7 +24,7 @@ $s[] = 1; // Cannot use a scalar value as an array
print_r($s);
--EXPECTF--
-Notice: Undefined property: sw::$undefined in %s on line %d
+Warning: Undefined property: sw::$undefined in %s on line %d
Array
(
[0] => 1
diff --git a/ext/standard/tests/streams/bug54623.phpt b/ext/standard/tests/streams/bug54623.phpt
index c21dc82019..02b1924eea 100644
--- a/ext/standard/tests/streams/bug54623.phpt
+++ b/ext/standard/tests/streams/bug54623.phpt
@@ -9,9 +9,12 @@ $sock2 = pfsockopen('udp://127.0.0.1', '63844');
var_dump((int)$sock2);
@fwrite($sock2, "2");
fclose($sock2);
-fwrite($sock, "3");
+try {
+ fwrite($sock, "3");
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
--EXPECTF--
int(%d)
int(%d)
-
-Warning: fwrite(): supplied resource is not a valid stream resource in %s on line %d
+fwrite(): supplied resource is not a valid stream resource
diff --git a/ext/standard/tests/streams/bug54946.phpt b/ext/standard/tests/streams/bug54946.phpt
index 0f58d19647..3be2a1367b 100644
--- a/ext/standard/tests/streams/bug54946.phpt
+++ b/ext/standard/tests/streams/bug54946.phpt
@@ -30,14 +30,12 @@ var_dump($retval);
fclose($stream);
unlink($filename);
?>
-===DONE===
--EXPECTF--
-Notice: stream_get_contents(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: stream_get_contents(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
string(0) ""
-Notice: stream_get_contents(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: stream_get_contents(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
string(0) ""
-Notice: stream_get_contents(): read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: stream_get_contents(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
string(0) ""
-===DONE===
diff --git a/ext/standard/tests/streams/bug60455_01.phpt b/ext/standard/tests/streams/bug60455_01.phpt
index 466998201a..453be553c3 100644
--- a/ext/standard/tests/streams/bug60455_01.phpt
+++ b/ext/standard/tests/streams/bug60455_01.phpt
@@ -8,7 +8,7 @@ Bug #60455: stream_get_line and 1-line noeol input
$domain = (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN' ? STREAM_PF_INET : STREAM_PF_UNIX);
$sockets = stream_socket_pair($domain, STREAM_SOCK_STREAM, STREAM_IPPROTO_IP)
- or die("stream_socket_pair");
+ or die("stream_socket_pair");
fwrite($sockets[0], "a");
stream_socket_shutdown($sockets[0], STREAM_SHUT_RDWR);
diff --git a/ext/standard/tests/streams/bug60455_02.phpt b/ext/standard/tests/streams/bug60455_02.phpt
index c68a1a07ab..632b12085c 100644
--- a/ext/standard/tests/streams/bug60455_02.phpt
+++ b/ext/standard/tests/streams/bug60455_02.phpt
@@ -3,19 +3,19 @@ Bug #60455: stream_get_line and 1-line followed by eol input
--FILE--
<?php
class TestStream {
- private $s = 0;
- function stream_open($path, $mode, $options, &$opened_path) {
- return true;
- }
- function stream_read($count) {
- if ($this->s++ == 0)
- return "a\n";
+ private $s = 0;
+ function stream_open($path, $mode, $options, &$opened_path) {
+ return true;
+ }
+ function stream_read($count) {
+ if ($this->s++ == 0)
+ return "a\n";
- return "";
- }
- function stream_eof() {
- return $this->s >= 2;
- }
+ return "";
+ }
+ function stream_eof() {
+ return $this->s >= 2;
+ }
}
diff --git a/ext/standard/tests/streams/bug60455_03.phpt b/ext/standard/tests/streams/bug60455_03.phpt
index 4cfc373408..d0a48ea780 100644
--- a/ext/standard/tests/streams/bug60455_03.phpt
+++ b/ext/standard/tests/streams/bug60455_03.phpt
@@ -3,25 +3,25 @@ Bug #60455: stream_get_line and 2 lines, one possibly empty
--FILE--
<?php
class TestStream {
- private $lines = array();
- private $s = 0;
- private $eofth = 3;
- function stream_open($path, $mode, $options, &$opened_path) {
- $this->lines[] = "a\n";
- $this->lines[] = ($path == "test://nonempty2nd" ? "b\n" : "\n");
- if ($path == "test://eofafter2nd")
- $this->eofth = 2;
- return true;
- }
- function stream_read($count) {
- if (key_exists($this->s++, $this->lines))
- return $this->lines[$this->s - 1];
+ private $lines = array();
+ private $s = 0;
+ private $eofth = 3;
+ function stream_open($path, $mode, $options, &$opened_path) {
+ $this->lines[] = "a\n";
+ $this->lines[] = ($path == "test://nonempty2nd" ? "b\n" : "\n");
+ if ($path == "test://eofafter2nd")
+ $this->eofth = 2;
+ return true;
+ }
+ function stream_read($count) {
+ if (key_exists($this->s++, $this->lines))
+ return $this->lines[$this->s - 1];
- return "";
- }
- function stream_eof() {
- return $this->s >= $this->eofth;
- }
+ return "";
+ }
+ function stream_eof() {
+ return $this->s >= $this->eofth;
+ }
}
diff --git a/ext/standard/tests/streams/bug60455_04.phpt b/ext/standard/tests/streams/bug60455_04.phpt
index 123a8653d3..73d2aadf53 100644
--- a/ext/standard/tests/streams/bug60455_04.phpt
+++ b/ext/standard/tests/streams/bug60455_04.phpt
@@ -4,19 +4,19 @@ read with EOL indication
--FILE--
<?php
class TestStream {
- private $s = 0;
- function stream_open($path, $mode, $options, &$opened_path) {
- return true;
- }
- function stream_read($count) {
- if ($this->s++ == 0)
- return "a\n";
+ private $s = 0;
+ function stream_open($path, $mode, $options, &$opened_path) {
+ return true;
+ }
+ function stream_read($count) {
+ if ($this->s++ == 0)
+ return "a\n";
- return "";
- }
- function stream_eof() {
- return $this->s >= 2;
- }
+ return "";
+ }
+ function stream_eof() {
+ return $this->s >= 2;
+ }
}
diff --git a/ext/standard/tests/streams/bug60602.phpt b/ext/standard/tests/streams/bug60602.phpt
index 82917ecbd6..b97f6f877a 100644
--- a/ext/standard/tests/streams/bug60602.phpt
+++ b/ext/standard/tests/streams/bug60602.phpt
@@ -4,9 +4,9 @@ Bug #60602 proc_open() modifies environment if it contains arrays
<?php
$descs = array(
- 0 => array('pipe', 'r'), // stdin
- 1 => array('pipe', 'w'), // stdout
- 2 => array('pipe', 'w'), // strerr
+ 0 => array('pipe', 'r'), // stdin
+ 1 => array('pipe', 'w'), // stdout
+ 2 => array('pipe', 'w'), // strerr
);
$environment = array('test' => array(1, 2, 3));
@@ -15,41 +15,39 @@ $cmd = (substr(PHP_OS, 0, 3) == 'WIN') ? 'dir' : 'ls';
$p = proc_open($cmd, $descs, $pipes, '.', $environment);
if (is_resource($p)) {
- $data = '';
+ $data = '';
- while (1) {
- $w = $e = NULL;
- $n = stream_select($pipes, $w, $e, 300);
+ while (1) {
+ $w = $e = NULL;
+ $n = stream_select($pipes, $w, $e, 300);
- if ($n === false) {
- echo "no streams \n";
- break;
- } else if ($n === 0) {
- echo "process timed out\n";
- proc_terminate($p, 9);
- break;
- } else if ($n > 0) {
- $line = fread($pipes[1], 8192);
- if (strlen($line) == 0) {
- /* EOF */
- break;
- }
- $data .= $line;
- }
- }
- var_dump(strlen($data));
+ if ($n === false) {
+ echo "no streams \n";
+ break;
+ } else if ($n === 0) {
+ echo "process timed out\n";
+ proc_terminate($p, 9);
+ break;
+ } else if ($n > 0) {
+ $line = fread($pipes[1], 8192);
+ if (strlen($line) == 0) {
+ /* EOF */
+ break;
+ }
+ $data .= $line;
+ }
+ }
+ var_dump(strlen($data));
- $ret = proc_close($p);
- var_dump($ret);
- var_dump(is_array($environment['test']));
+ $ret = proc_close($p);
+ var_dump($ret);
+ var_dump(is_array($environment['test']));
} else {
- echo "no process\n";
+ echo "no process\n";
}
?>
-==DONE==
--EXPECTF--
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
int(%d)
int(0)
bool(true)
-==DONE==
diff --git a/ext/standard/tests/streams/bug61019.phpt b/ext/standard/tests/streams/bug61019.phpt
index 7fead5362f..929de1c2af 100644
--- a/ext/standard/tests/streams/bug61019.phpt
+++ b/ext/standard/tests/streams/bug61019.phpt
@@ -6,68 +6,67 @@ Bug #61019 (Out of memory on command stream_get_contents)
echo "Test\n";
$descriptorspec = array(
- 0 => array("pipe", "r"), // stdin is a pipe that the child will read from
- 1 => array("pipe", "w"), // stdout is a pipe that the child will write to
- 2 => array("pipe", "w") // stderr is a pipe that the child will write to
+ 0 => array("pipe", "r"), // stdin is a pipe that the child will read from
+ 1 => array("pipe", "w"), // stdout is a pipe that the child will write to
+ 2 => array("pipe", "w") // stderr is a pipe that the child will write to
);
$process=proc_open("echo testtext",$descriptorspec,$pipes);
if(is_resource($process))
{
- stream_set_blocking($pipes[0],false);
- stream_set_blocking($pipes[1],false);
- stream_set_blocking($pipes[2],false);
- stream_set_write_buffer($pipes[0],0);
- stream_set_read_buffer($pipes[1],0);
- stream_set_read_buffer($pipes[2],0);
- $stdin_stream="";
- $stderr_stream="";
+ stream_set_blocking($pipes[0],false);
+ stream_set_blocking($pipes[1],false);
+ stream_set_blocking($pipes[2],false);
+ stream_set_write_buffer($pipes[0],0);
+ stream_set_read_buffer($pipes[1],0);
+ stream_set_read_buffer($pipes[2],0);
+ $stdin_stream="";
+ $stderr_stream="";
- echo "External command executed\n";
- do
- {
- $process_state=proc_get_status($process);
- $tmp_stdin=stream_get_contents($pipes[1]);
- if($tmp_stdin)
- {
- $stdin_stream=$stdin_stream.$tmp_stdin;
- }
- $tmp_stderr=stream_get_contents($pipes[2]);
- if($tmp_stderr)
- {
- $stderr_stream=$stderr_stream.$tmp_stderr;
- }
- } while($process_state['running']);
+ echo "External command executed\n";
+ do
+ {
+ $process_state=proc_get_status($process);
+ $tmp_stdin=stream_get_contents($pipes[1]);
+ if($tmp_stdin)
+ {
+ $stdin_stream=$stdin_stream.$tmp_stdin;
+ }
+ $tmp_stderr=stream_get_contents($pipes[2]);
+ if($tmp_stderr)
+ {
+ $stderr_stream=$stderr_stream.$tmp_stderr;
+ }
+ } while($process_state['running']);
- echo "External command exit: ".$process_state['exitcode']."\n";
+ echo "External command exit: ".$process_state['exitcode']."\n";
- //read outstanding data
- $tmp_stdin=stream_get_contents($pipes[1]);
- if($tmp_stdin)
- {
- $stdin_stream=$stdin_stream.$tmp_stdin;
- }
- $tmp_stderr=stream_get_contents($pipes[2]);
- if($tmp_stderr)
- {
- $stderr_stream=$stderr_stream.$tmp_stderr;
- }
+ //read outstanding data
+ $tmp_stdin=stream_get_contents($pipes[1]);
+ if($tmp_stdin)
+ {
+ $stdin_stream=$stdin_stream.$tmp_stdin;
+ }
+ $tmp_stderr=stream_get_contents($pipes[2]);
+ if($tmp_stderr)
+ {
+ $stderr_stream=$stderr_stream.$tmp_stderr;
+ }
- fclose ($pipes[0]);
- fclose ($pipes[1]);
- fclose ($pipes[2]);
+ fclose ($pipes[0]);
+ fclose ($pipes[1]);
+ fclose ($pipes[2]);
- proc_close($process);
+ proc_close($process);
- echo "STDOUT: ".$stdin_stream."\n";
- echo "STDERR: ".$stderr_stream."\n";
+ echo "STDOUT: ".$stdin_stream."\n";
+ echo "STDERR: ".$stderr_stream."\n";
}
else
{
- echo "Can't start external command\n";
+ echo "Can't start external command\n";
}
?>
-===DONE===
--EXPECT--
Test
External command executed
@@ -75,4 +74,3 @@ External command exit: 0
STDOUT: testtext
STDERR:
-===DONE===
diff --git a/ext/standard/tests/streams/bug61371-unix.phpt b/ext/standard/tests/streams/bug61371-unix.phpt
index 7c64d1d30f..20361095f6 100644
--- a/ext/standard/tests/streams/bug61371-unix.phpt
+++ b/ext/standard/tests/streams/bug61371-unix.phpt
@@ -11,21 +11,21 @@ function test($doFclose) {
$previous = null;
$current = null;
for($test=1;$test<=3;$test++) {
- $current = memory_get_usage(true);
- if (!is_null($previous)) {
- var_dump($previous == $current);
- }
- $previous = $current;
- echo 'memory: '.round($current / 1024, 0)."kb\n";
- for($i=0;$i<=100;$i++) {
- $context = stream_context_create(array());
- $stream = stream_socket_client('udp://0.0.0.0:80', $errno, $errstr, 10, STREAM_CLIENT_CONNECT, $context);
- if ($doFclose) fclose($stream);
- unset($context);
- unset($stream);
- unset($errno);
- unset($errstr);
- }
+ $current = memory_get_usage(true);
+ if (!is_null($previous)) {
+ var_dump($previous == $current);
+ }
+ $previous = $current;
+ echo 'memory: '.round($current / 1024, 0)."kb\n";
+ for($i=0;$i<=100;$i++) {
+ $context = stream_context_create(array());
+ $stream = stream_socket_client('udp://0.0.0.0:80', $errno, $errstr, 10, STREAM_CLIENT_CONNECT, $context);
+ if ($doFclose) fclose($stream);
+ unset($context);
+ unset($stream);
+ unset($errno);
+ unset($errstr);
+ }
}
}
diff --git a/ext/standard/tests/streams/bug61371.phpt b/ext/standard/tests/streams/bug61371.phpt
index 924219f896..00e6372e85 100644
--- a/ext/standard/tests/streams/bug61371.phpt
+++ b/ext/standard/tests/streams/bug61371.phpt
@@ -6,21 +6,21 @@ function test($doFclose) {
$previous = null;
$current = null;
for($test=1;$test<=3;$test++) {
- $current = memory_get_usage(true);
- if (!is_null($previous)) {
- var_dump($previous == $current);
- }
- $previous = $current;
- echo 'memory: '.round($current / 1024, 0)."kb\n";
- for($i=0;$i<=100;$i++) {
- $context = stream_context_create(array());
- $stream = stream_socket_client('udp://127.0.0.1:80', $errno, $errstr, 10, STREAM_CLIENT_CONNECT, $context);
- if ($doFclose) fclose($stream);
- unset($context);
- unset($stream);
- unset($errno);
- unset($errstr);
- }
+ $current = memory_get_usage(true);
+ if (!is_null($previous)) {
+ var_dump($previous == $current);
+ }
+ $previous = $current;
+ echo 'memory: '.round($current / 1024, 0)."kb\n";
+ for($i=0;$i<=100;$i++) {
+ $context = stream_context_create(array());
+ $stream = stream_socket_client('udp://127.0.0.1:80', $errno, $errstr, 10, STREAM_CLIENT_CONNECT, $context);
+ if ($doFclose) fclose($stream);
+ unset($context);
+ unset($stream);
+ unset($errno);
+ unset($errstr);
+ }
}
}
diff --git a/ext/standard/tests/streams/bug64166.phpt b/ext/standard/tests/streams/bug64166.phpt
index e725a4b698..f03d9c15ac 100644
--- a/ext/standard/tests/streams/bug64166.phpt
+++ b/ext/standard/tests/streams/bug64166.phpt
@@ -9,8 +9,8 @@ function test_64166($data) {
rewind($fd);
$res = stream_filter_append($fd, 'convert.quoted-printable-encode', STREAM_FILTER_READ, array(
- 'line-break-chars' => "\n",
- 'line-length' => 74
+ 'line-break-chars' => "\n",
+ 'line-length' => 74
));
var_dump(stream_get_contents($fd, -1, 0));
@@ -18,8 +18,8 @@ function test_64166($data) {
rewind($fd);
stream_filter_append($fd, 'convert.quoted-printable-encode', STREAM_FILTER_READ, array(
- 'line-break-chars' => "\n",
- 'line-length' => 6
+ 'line-break-chars' => "\n",
+ 'line-length' => 6
));
var_dump(stream_get_contents($fd, -1, 0));
diff --git a/ext/standard/tests/streams/bug64166_2.phpt b/ext/standard/tests/streams/bug64166_2.phpt
index b4224662ee..3321978bba 100644
--- a/ext/standard/tests/streams/bug64166_2.phpt
+++ b/ext/standard/tests/streams/bug64166_2.phpt
@@ -9,8 +9,8 @@ function test_64166($data) {
rewind($fd);
$res = stream_filter_append($fd, 'convert.quoted-printable-encode', STREAM_FILTER_READ, array(
- 'line-break-chars' => "\n",
- 'line-length' => 74
+ 'line-break-chars' => "\n",
+ 'line-length' => 74
));
$str = "";
while(($c = fread($fd, 1))!= "") $str .= $c;
@@ -20,8 +20,8 @@ function test_64166($data) {
rewind($fd);
stream_filter_append($fd, 'convert.quoted-printable-encode', STREAM_FILTER_READ, array(
- 'line-break-chars' => "\n",
- 'line-length' => 6
+ 'line-break-chars' => "\n",
+ 'line-length' => 6
));
$str = "";
while(($c = fread($fd, 1))!= "") $str .= $c;
diff --git a/ext/standard/tests/streams/bug64166_3.phpt b/ext/standard/tests/streams/bug64166_3.phpt
index d896ba800c..5cc0077f79 100644
--- a/ext/standard/tests/streams/bug64166_3.phpt
+++ b/ext/standard/tests/streams/bug64166_3.phpt
@@ -6,8 +6,8 @@ Bug #64166: quoted-printable-encode stream filter incorrectly discarding whitesp
function test_64166($data) {
$fd = fopen('php://temp', 'w+');
$res = stream_filter_append($fd, 'convert.quoted-printable-encode', STREAM_FILTER_WRITE, array(
- 'line-break-chars' => "\n",
- 'line-length' => 74
+ 'line-break-chars' => "\n",
+ 'line-length' => 74
));
fwrite($fd, $data);
rewind($fd);
@@ -18,8 +18,8 @@ function test_64166($data) {
rewind($fd);
stream_filter_append($fd, 'convert.quoted-printable-encode', STREAM_FILTER_WRITE, array(
- 'line-break-chars' => "\n",
- 'line-length' => 6
+ 'line-break-chars' => "\n",
+ 'line-length' => 6
));
fwrite($fd, $data);
rewind($fd);
diff --git a/ext/standard/tests/streams/bug64433.phpt b/ext/standard/tests/streams/bug64433.phpt
index bb22edee55..d1100c5713 100644
--- a/ext/standard/tests/streams/bug64433.phpt
+++ b/ext/standard/tests/streams/bug64433.phpt
@@ -20,7 +20,7 @@ echo file_get_contents("http://".PHP_CLI_SERVER_ADDRESS."/index.php");
echo "default\n";
$codes = array(200, 201, 204, 301, 302, 303, 304, 305, 307, 404, 500);
foreach($codes as $code) {
- echo "$code: ".file_get_contents("http://".PHP_CLI_SERVER_ADDRESS."/index.php?status=$code&loc=1");
+ echo "$code: ".file_get_contents("http://".PHP_CLI_SERVER_ADDRESS."/index.php?status=$code&loc=1");
}
echo "follow=0\n";
$arr = array('http'=>
@@ -30,7 +30,7 @@ $arr = array('http'=>
);
$context = stream_context_create($arr);
foreach($codes as $code) {
- echo "$code: ".file_get_contents("http://".PHP_CLI_SERVER_ADDRESS."/index.php?status=$code&loc=1", false, $context);
+ echo "$code: ".file_get_contents("http://".PHP_CLI_SERVER_ADDRESS."/index.php?status=$code&loc=1", false, $context);
}
echo "follow=1\n";
$arr = array('http'=>
@@ -40,7 +40,7 @@ $arr = array('http'=>
);
$context = stream_context_create($arr);
foreach($codes as $code) {
- echo "$code: ".file_get_contents("http://".PHP_CLI_SERVER_ADDRESS."/index.php?status=$code&loc=1", false, $context);
+ echo "$code: ".file_get_contents("http://".PHP_CLI_SERVER_ADDRESS."/index.php?status=$code&loc=1", false, $context);
}
--EXPECT--
HELLO!
diff --git a/ext/standard/tests/streams/bug64433_srv.inc b/ext/standard/tests/streams/bug64433_srv.inc
index dcdb1bcbaa..035343369c 100644
--- a/ext/standard/tests/streams/bug64433_srv.inc
+++ b/ext/standard/tests/streams/bug64433_srv.inc
@@ -1,14 +1,14 @@
if(!empty($_REQUEST["redir"])) {
- echo "REDIRECTED\n";
- return;
+ echo "REDIRECTED\n";
+ return;
}
if(!empty($_REQUEST["loc"])) {
- header("Location: index.php?redir=1");
+ header("Location: index.php?redir=1");
}
if(!empty($_REQUEST["status"])) {
- http_response_code($_REQUEST["status"]);
+ http_response_code($_REQUEST["status"]);
}
echo "HELLO!\n";
diff --git a/ext/standard/tests/streams/bug64770.phpt b/ext/standard/tests/streams/bug64770.phpt
index bb904d7446..ba39bb5f84 100644
--- a/ext/standard/tests/streams/bug64770.phpt
+++ b/ext/standard/tests/streams/bug64770.phpt
@@ -4,9 +4,9 @@ Bug #64770 stream_select() fails with pipes from proc_open()
<?php
$descs = array(
- 0 => array('pipe', 'r'), // stdin
- 1 => array('pipe', 'w'), // stdout
- 2 => array('pipe', 'w'), // strerr
+ 0 => array('pipe', 'r'), // stdin
+ 1 => array('pipe', 'w'), // stdout
+ 2 => array('pipe', 'w'), // strerr
);
$other_opts = array('suppress_errors' => false);
@@ -15,38 +15,36 @@ $cmd = (substr(PHP_OS, 0, 3) == 'WIN') ? 'dir' : 'ls';
$p = proc_open($cmd, $descs, $pipes, '.', NULL, $other_opts);
if (is_resource($p)) {
- $data = '';
+ $data = '';
- while (1) {
- $w = $e = NULL;
- $n = stream_select($pipes, $w, $e, 300);
+ while (1) {
+ $w = $e = NULL;
+ $n = stream_select($pipes, $w, $e, 300);
- if ($n === false) {
- echo "no streams \n";
- break;
- } else if ($n === 0) {
- echo "process timed out\n";
- proc_terminate($p, 9);
- break;
- } else if ($n > 0) {
- $line = fread($pipes[1], 8192);
- if (strlen($line) == 0) {
- /* EOF */
- break;
- }
- $data .= $line;
- }
- }
- var_dump(strlen($data));
+ if ($n === false) {
+ echo "no streams \n";
+ break;
+ } else if ($n === 0) {
+ echo "process timed out\n";
+ proc_terminate($p, 9);
+ break;
+ } else if ($n > 0) {
+ $line = fread($pipes[1], 8192);
+ if (strlen($line) == 0) {
+ /* EOF */
+ break;
+ }
+ $data .= $line;
+ }
+ }
+ var_dump(strlen($data));
- $ret = proc_close($p);
- var_dump($ret);
+ $ret = proc_close($p);
+ var_dump($ret);
} else {
- echo "no process\n";
+ echo "no process\n";
}
?>
-==DONE==
--EXPECTF--
int(%d)
int(0)
-==DONE==
diff --git a/ext/standard/tests/streams/bug67626.phpt b/ext/standard/tests/streams/bug67626.phpt
index 79aaed55cb..c251a40b92 100644
--- a/ext/standard/tests/streams/bug67626.phpt
+++ b/ext/standard/tests/streams/bug67626.phpt
@@ -4,24 +4,24 @@ Bug #67626: Exceptions not properly handled in user stream handlers
<?php
class MyStream
{
- public function stream_open() { return true; }
+ public function stream_open() { return true; }
- public function stream_read()
- {
- throw new Exception('stream_read_exception');
- return 'read';
- }
+ public function stream_read()
+ {
+ throw new Exception('stream_read_exception');
+ return 'read';
+ }
- public function stream_eof()
- {
- return true;
- }
+ public function stream_eof()
+ {
+ return true;
+ }
- public function stream_write()
- {
- throw new Exception('stream_write_exception');
- return 42;
- }
+ public function stream_write()
+ {
+ throw new Exception('stream_write_exception');
+ return 42;
+ }
}
stream_wrapper_register("my", "MyStream");
@@ -29,15 +29,15 @@ stream_wrapper_register("my", "MyStream");
$fp = fopen('my://foobar', 'r+');
try {
- fread($fp, 42);
+ fread($fp, 42);
} catch (Exception $e) {
- echo $e->getMessage();
+ echo $e->getMessage();
}
echo "\n";
try {
- fwrite($fp, 'foobar');
+ fwrite($fp, 'foobar');
} catch (Exception $e) {
- echo $e->getMessage();
+ echo $e->getMessage();
}
?>
--EXPECT--
diff --git a/ext/standard/tests/streams/bug69521.phpt b/ext/standard/tests/streams/bug69521.phpt
index 75e1cdf99d..9ec244f799 100644
--- a/ext/standard/tests/streams/bug69521.phpt
+++ b/ext/standard/tests/streams/bug69521.phpt
@@ -19,15 +19,15 @@ fclose($link);
while (!feof($fp))
{
- $read = $write = array($fp);
+ $read = $write = array($fp);
- if ($written === strlen($data))
- $write = array();
+ if ($written === strlen($data))
+ $write = array();
- $changed = stream_select($read, $write, $except, 0, 500000);
+ $changed = stream_select($read, $write, $except, 0, 500000);
- if (!empty($read))
- echo fread($fp, 4);
+ if (!empty($read))
+ echo fread($fp, 4);
}
?>
--EXPECT--
diff --git a/ext/standard/tests/streams/bug70198.phpt b/ext/standard/tests/streams/bug70198.phpt
index 83efb9669b..fc9c30f6fe 100644
--- a/ext/standard/tests/streams/bug70198.phpt
+++ b/ext/standard/tests/streams/bug70198.phpt
@@ -10,9 +10,9 @@ server
<?php
/* What is checked here is
- - start a server and listen
- - as soon as client connects, close connection and exit
- - on the client side - sleep(1) and check feof()
+ - start a server and listen
+ - as soon as client connects, close connection and exit
+ - on the client side - sleep(1) and check feof()
*/
$srv_addr = "tcp://127.0.0.1:8964";
@@ -22,15 +22,15 @@ $srv_fl_cont = <<<SRV
\$socket = stream_socket_server('$srv_addr', \$errno, \$errstr);
if (!\$socket) {
- echo "\$errstr (\$errno)\\n";
+ echo "\$errstr (\$errno)\\n";
} else {
- if (\$conn = stream_socket_accept(\$socket, 3)) {
- sleep(1);
- /* just close the connection immediately after accepting,
- the client side will need wait a bit longer to realize it.*/
- fclose(\$conn);
- }
- fclose(\$socket);
+ if (\$conn = stream_socket_accept(\$socket, 3)) {
+ sleep(1);
+ /* just close the connection immediately after accepting,
+ the client side will need wait a bit longer to realize it.*/
+ fclose(\$conn);
+ }
+ fclose(\$socket);
}
SRV;
file_put_contents($srv_fl, $srv_fl_cont);
@@ -42,21 +42,19 @@ $i = 0;
sleep(1);
$fp = stream_socket_client($srv_addr, $errno, $errstr, 2);
if (!$fp) {
- echo "$errstr ($errno)\n";
+ echo "$errstr ($errno)\n";
} else {
- stream_set_blocking($fp, 0);
- sleep(2);
- while (!feof($fp)) {
- ++$i;
- }
- fclose($fp);
- var_dump($i);
+ stream_set_blocking($fp, 0);
+ sleep(2);
+ while (!feof($fp)) {
+ ++$i;
+ }
+ fclose($fp);
+ var_dump($i);
}
proc_close($srv_proc);
unlink($srv_fl);
?>
-==DONE==
--EXPECT--
int(0)
-==DONE==
diff --git a/ext/standard/tests/streams/bug71245.phpt b/ext/standard/tests/streams/bug71245.phpt
index c9cad0c6d7..3dfda8d00a 100644
--- a/ext/standard/tests/streams/bug71245.phpt
+++ b/ext/standard/tests/streams/bug71245.phpt
@@ -4,15 +4,15 @@ Bug #71245 (file_get_contents() ignores "header" context option if it's a refere
<?php
$headers = ['Host: okey.com'];
$httpContext = [
- 'http' => [
- 'protocol_version' => '1.1',
- 'method' => 'GET',
- 'header' => &$headers,
- 'follow_location' => 0,
- 'max_redirects' => 0,
- 'ignore_errors' => true,
- 'timeout' => 60,
- ],
+ 'http' => [
+ 'protocol_version' => '1.1',
+ 'method' => 'GET',
+ 'header' => &$headers,
+ 'follow_location' => 0,
+ 'max_redirects' => 0,
+ 'ignore_errors' => true,
+ 'timeout' => 60,
+ ],
];
$context = stream_context_create($httpContext);
$headers = ["Host: bad.com"];
diff --git a/ext/standard/tests/streams/bug71884.phpt b/ext/standard/tests/streams/bug71884.phpt
index 798c6b6431..3c5f841b3d 100644
--- a/ext/standard/tests/streams/bug71884.phpt
+++ b/ext/standard/tests/streams/bug71884.phpt
@@ -4,7 +4,11 @@ Bug #71884 (Null pointer deref (segfault) in stream_context_get_default)
<?php
$arr=array();
$arr[0]['A']=0;
-stream_context_get_default($arr);
+try {
+ stream_context_get_default($arr);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
?>
---EXPECTF--
-Warning: stream_context_get_default(): options should have the form ["wrappername"]["optionname"] = $value in %sbug71884.php on line %d
+--EXPECT--
+Options should have the form ["wrappername"]["optionname"] = $value
diff --git a/ext/standard/tests/streams/bug72771.phpt b/ext/standard/tests/streams/bug72771.phpt
index ebb358707e..335f7934ce 100644
--- a/ext/standard/tests/streams/bug72771.phpt
+++ b/ext/standard/tests/streams/bug72771.phpt
@@ -16,8 +16,6 @@ $path="ftps://127.0.0.1:" . $port."/";
$ds=opendir($path, $context);
var_dump($ds);
?>
-==DONE==
--EXPECTF--
-Warning: opendir(ftps://127.0.0.1:%d/): failed to open dir: Server doesn't support FTPS. in %s on line %d
+Warning: opendir(ftps://127.0.0.1:%d/): Failed to open directory: Server doesn't support FTPS. in %s on line %d
bool(false)
-==DONE==
diff --git a/ext/standard/tests/streams/bug72853.phpt b/ext/standard/tests/streams/bug72853.phpt
index 8de0264ac0..ab06f81e8c 100644
--- a/ext/standard/tests/streams/bug72853.phpt
+++ b/ext/standard/tests/streams/bug72853.phpt
@@ -10,8 +10,8 @@ if(substr(PHP_OS, 0, 3) == 'WIN' ) {
<?php
$descs = array(
- 0 => array('pipe', 'r'), // stdin
- 1 => array('pipe', 'w'), // stdout
+ 0 => array('pipe', 'r'), // stdin
+ 1 => array('pipe', 'w'), // stdout
);
$p = proc_open("ls", $descs, $pipes, '.', NULL, NULL);
diff --git a/ext/standard/tests/streams/bug72857.phpt b/ext/standard/tests/streams/bug72857.phpt
index 7b71c269f4..f6addb1a63 100644
--- a/ext/standard/tests/streams/bug72857.phpt
+++ b/ext/standard/tests/streams/bug72857.phpt
@@ -2,19 +2,17 @@
Bug #72857 stream_socket_recvfrom read access violation
--FILE--
<?php
- $fname = __DIR__ . DIRECTORY_SEPARATOR . "stream_socket_recvfrom.tmp";
- $fp0 = fopen($fname, 'w');
- $v2=10;
- $v3=STREAM_PEEK;
- $v4="A";
+ $fname = __DIR__ . DIRECTORY_SEPARATOR . "stream_socket_recvfrom.tmp";
+ $fp0 = fopen($fname, 'w');
+ $v2=10;
+ $v3=STREAM_PEEK;
+ $v4="A";
- var_dump(stream_socket_recvfrom($fp0,$v2,$v3,$v4), $v4);
+ var_dump(stream_socket_recvfrom($fp0,$v2,$v3,$v4), $v4);
- fclose($fp0);
- unlink($fname);
+ fclose($fp0);
+ unlink($fname);
?>
-==DONE==
--EXPECT--
bool(false)
NULL
-==DONE==
diff --git a/ext/standard/tests/streams/bug73457.phpt b/ext/standard/tests/streams/bug73457.phpt
index a49a2026b7..f0f709e1aa 100644
--- a/ext/standard/tests/streams/bug73457.phpt
+++ b/ext/standard/tests/streams/bug73457.phpt
@@ -16,8 +16,6 @@ $path="ftp://127.0.0.1:" . $port."/bug73457";
$ds=file_get_contents($path);
var_dump($ds);
?>
-==DONE==
--EXPECTF--
-Warning: file_get_contents(ftp://127.0.0.1:%d/bug73457): failed to open stream: Failed to set up data channel: Connection refused in %s on line %d
+Warning: file_get_contents(ftp://127.0.0.1:%d/bug73457): Failed to open stream: Failed to set up data channel: Connection refused in %s on line %d
bool(false)
-==DONE==
diff --git a/ext/standard/tests/streams/bug74090.phpt b/ext/standard/tests/streams/bug74090.phpt
index 7a0250a124..31a5f8dc10 100644
--- a/ext/standard/tests/streams/bug74090.phpt
+++ b/ext/standard/tests/streams/bug74090.phpt
@@ -28,7 +28,5 @@ var_dump(strlen($ret) > 0);
stream_socket_shutdown($fd, STREAM_SHUT_RDWR);
stream_socket_shutdown($server, STREAM_SHUT_RDWR);
?>
-==DONE==
--EXPECT--
bool(true)
-==DONE==
diff --git a/ext/standard/tests/streams/bug74951.phpt b/ext/standard/tests/streams/bug74951.phpt
index b45bee7c3b..ccfd302a1c 100644
--- a/ext/standard/tests/streams/bug74951.phpt
+++ b/ext/standard/tests/streams/bug74951.phpt
@@ -9,4 +9,4 @@ trait Stream00ploiter{
stream_wrapper_register('e0ploit','Stream00ploiter');
$s=fopen('e0ploit://',0);
--EXPECTF--
-Warning: fopen(e0ploit://): failed to open stream: operation failed in %s%ebug74951.php on line 7
+Warning: fopen(e0ploit://): Failed to open stream: operation failed in %s%ebug74951.php on line 7
diff --git a/ext/standard/tests/streams/bug77664.phpt b/ext/standard/tests/streams/bug77664.phpt
index ff2e317026..01722033b5 100644
--- a/ext/standard/tests/streams/bug77664.phpt
+++ b/ext/standard/tests/streams/bug77664.phpt
@@ -3,8 +3,8 @@ BUG #77664 (Segmentation fault when using undefined constant in custom wrapper)
--FILE--
<?php
class ErrorWrapper {
- public $context;
- public $var = self::INVALID;
+ public $context;
+ public $var = self::INVALID;
}
stream_wrapper_register('error',ErrorWrapper::class);
file_get_contents('error://test');
diff --git a/ext/standard/tests/streams/bug77680.phpt b/ext/standard/tests/streams/bug77680.phpt
index 8537bd4e36..7fe8062e6e 100644
--- a/ext/standard/tests/streams/bug77680.phpt
+++ b/ext/standard/tests/streams/bug77680.phpt
@@ -15,7 +15,6 @@ $path = "ftp://localhost:" . $port."/one/two/three/";
mkdir($path, 0755, true);
?>
-==DONE==
--EXPECTF--
string(20) "CWD /one/two/three
"
@@ -33,4 +32,3 @@ string(14) "MKD /one/two
"
string(20) "MKD /one/two/three
"
-==DONE==
diff --git a/ext/standard/tests/streams/bug77765.phpt b/ext/standard/tests/streams/bug77765.phpt
index fa933ffc0d..e048db53e4 100644
--- a/ext/standard/tests/streams/bug77765.phpt
+++ b/ext/standard/tests/streams/bug77765.phpt
@@ -14,9 +14,7 @@ $path = "ftp://localhost:" . $port."/www";
var_dump(stat($path)['mode']);
?>
-==DONE==
--EXPECTF--
string(11) "SIZE /www
"
int(16877)
-==DONE==
diff --git a/ext/standard/tests/streams/bug78883.phpt b/ext/standard/tests/streams/bug78883.phpt
index ed040e0044..7ce440a042 100644
--- a/ext/standard/tests/streams/bug78883.phpt
+++ b/ext/standard/tests/streams/bug78883.phpt
@@ -20,9 +20,9 @@ $pid = proc_get_status($proc)['pid'];
sleep(3);
$bug_is_present = !proc_get_status($proc)['running'];
if (!$bug_is_present) {
- // if the bug is not present, it will hang waiting for stdin,
- // thus cmd is still running and we should kill it
- shell_exec("taskkill /T /F /PID {$pid} 2>nul");
+ // if the bug is not present, it will hang waiting for stdin,
+ // thus cmd is still running and we should kill it
+ shell_exec("taskkill /T /F /PID {$pid} 2>nul");
}
fclose($pipes[0]);
fclose($pipes[1]);
diff --git a/ext/standard/tests/streams/glob-wrapper.phpt b/ext/standard/tests/streams/glob-wrapper.phpt
index 0e4438fdcc..331ed3e9b6 100644
--- a/ext/standard/tests/streams/glob-wrapper.phpt
+++ b/ext/standard/tests/streams/glob-wrapper.phpt
@@ -25,11 +25,11 @@ foreach ( [ __DIR__, "glob://".__DIR__ ] as $spec) {
Warning: opendir(): open_basedir restriction in effect. File(%s) is not within the allowed path(s): (/does_not_exist) in %s%eglob-wrapper.php on line 5
-Warning: opendir(%s): failed to open dir: Operation not permitted in %s%eglob-wrapper.php on line 5
+Warning: opendir(%s): Failed to open directory: Operation not permitted in %s%eglob-wrapper.php on line 5
Failed to open %s
** Opening glob://%s
Warning: opendir(): open_basedir restriction in effect. File(%s) is not within the allowed path(s): (/does_not_exist) in %s%eglob-wrapper.php on line 5
-Warning: opendir(glob://%s): failed to open dir: operation failed in %s%eglob-wrapper.php on line 5
+Warning: opendir(glob://%s): Failed to open directory: operation failed in %s%eglob-wrapper.php on line 5
Failed to open glob://%s
diff --git a/ext/standard/tests/streams/opendir-001.phpt b/ext/standard/tests/streams/opendir-001.phpt
index d2d2ce8b9c..7fa9bbfd7b 100644
--- a/ext/standard/tests/streams/opendir-001.phpt
+++ b/ext/standard/tests/streams/opendir-001.phpt
@@ -14,9 +14,7 @@ $path="ftp://localhost:" . $port."/bogusdir";
var_dump(opendir($path));
?>
-==DONE==
--EXPECTF--
-Warning: opendir(ftp://localhost:%d/bogusdir): failed to open dir: FTP server reports 250 /bogusdir: No such file or directory
+Warning: opendir(ftp://localhost:%d/bogusdir): Failed to open directory: FTP server reports 250 /bogusdir: No such file or directory
in %s on line %d
bool(false)
-==DONE==
diff --git a/ext/standard/tests/streams/opendir-002.phpt b/ext/standard/tests/streams/opendir-002.phpt
index a995979992..4978c8affa 100644
--- a/ext/standard/tests/streams/opendir-002.phpt
+++ b/ext/standard/tests/streams/opendir-002.phpt
@@ -21,11 +21,9 @@ while ($fn=readdir($ds)) {
closedir($ds);
?>
-==DONE==
--EXPECTF--
resource(%d) of type (stream)
string(5) "file1"
string(5) "file1"
string(3) "fil"
string(4) "b0rk"
-==DONE==
diff --git a/ext/standard/tests/streams/opendir-003.phpt b/ext/standard/tests/streams/opendir-003.phpt
index 2b3aedbf30..ab8f670680 100644
--- a/ext/standard/tests/streams/opendir-003.phpt
+++ b/ext/standard/tests/streams/opendir-003.phpt
@@ -18,9 +18,7 @@ $context = stream_context_create(array('ssl' => array('cafile' => __DIR__ . '/.
var_dump(opendir($path, $context));
?>
-==DONE==
--EXPECTF--
-Warning: opendir(ftps://127.0.0.1:%d/bogusdir): failed to open dir: FTP server reports 250 /bogusdir: No such file or directory
+Warning: opendir(ftps://127.0.0.1:%d/bogusdir): Failed to open directory: FTP server reports 250 /bogusdir: No such file or directory
in %s on line %d
bool(false)
-==DONE==
diff --git a/ext/standard/tests/streams/opendir-004.phpt b/ext/standard/tests/streams/opendir-004.phpt
index 06a3f944be..885a7b96bc 100644
--- a/ext/standard/tests/streams/opendir-004.phpt
+++ b/ext/standard/tests/streams/opendir-004.phpt
@@ -22,11 +22,9 @@ while ($fn=readdir($ds)) {
var_dump($fn);
}
?>
-==DONE==
--EXPECTF--
resource(%d) of type (stream)
string(5) "file1"
string(5) "file1"
string(3) "fil"
string(4) "b0rk"
-==DONE==
diff --git a/ext/standard/tests/streams/proc_open_bug51800.phpt b/ext/standard/tests/streams/proc_open_bug51800.phpt
index 7e7d2c7cb3..7cf502edd8 100644
--- a/ext/standard/tests/streams/proc_open_bug51800.phpt
+++ b/ext/standard/tests/streams/proc_open_bug51800.phpt
@@ -47,7 +47,7 @@ exit(0);
');
if (!$r) {
- die("couldn't create helper script '$callee'");
+ die("couldn't create helper script '$callee'");
}
$process = proc_open($cmd, $descriptors, $pipes);
@@ -56,13 +56,13 @@ if (is_resource($process))
{
fclose($pipes[0]);
- while (!feof($pipes[1]))
- $stdout .= fread($pipes[1], 1024);
- fclose($pipes[1]);
+ while (!feof($pipes[1]))
+ $stdout .= fread($pipes[1], 1024);
+ fclose($pipes[1]);
- while (!feof($pipes[2]))
- $stderr .= fread($pipes[2], 1024);
- fclose($pipes[2]);
+ while (!feof($pipes[2]))
+ $stderr .= fread($pipes[2], 1024);
+ fclose($pipes[2]);
$status = proc_close($process);
}
@@ -74,7 +74,6 @@ var_dump(array(
), strlen($stdout), strlen($stderr));
?>
-===DONE===
--CLEAN--
<?php
$callee = __DIR__ . "/process_proc_open_bug51800.php";
@@ -91,4 +90,3 @@ array(3) {
}
int(10000)
int(10000)
-===DONE===
diff --git a/ext/standard/tests/streams/proc_open_bug51800_right.phpt b/ext/standard/tests/streams/proc_open_bug51800_right.phpt
index 22860f1fc3..c9e517cc65 100644
--- a/ext/standard/tests/streams/proc_open_bug51800_right.phpt
+++ b/ext/standard/tests/streams/proc_open_bug51800_right.phpt
@@ -31,7 +31,7 @@ exit(0);
');
if (!$r) {
- die("couldn't create helper script '$callee'");
+ die("couldn't create helper script '$callee'");
}
$process = proc_open($cmd, $descriptors, $pipes);
@@ -57,7 +57,6 @@ var_dump(array(
), strlen($stdout), strlen($stderr));
?>
-===DONE===
--CLEAN--
<?php
$callee = __DIR__ . "/process_proc_open_bug51800_right.php";
@@ -74,4 +73,3 @@ array(3) {
}
int(10000)
int(10000)
-===DONE===
diff --git a/ext/standard/tests/streams/proc_open_bug51800_right2.phpt b/ext/standard/tests/streams/proc_open_bug51800_right2.phpt
index d183557066..71b2fcc71a 100644
--- a/ext/standard/tests/streams/proc_open_bug51800_right2.phpt
+++ b/ext/standard/tests/streams/proc_open_bug51800_right2.phpt
@@ -27,17 +27,17 @@ $i0 = $i1 = 0;
$step = 1024;
while ($i0 < strlen($data0) && $i1 < strlen($data1)) {
- fwrite(STDOUT, substr($data0, $i0, $step));
- fwrite(STDERR, substr($data1, $i1, $step));
- $i0 += $step;
- $i1 += $step;
+ fwrite(STDOUT, substr($data0, $i0, $step));
+ fwrite(STDERR, substr($data1, $i1, $step));
+ $i0 += $step;
+ $i1 += $step;
}
exit(0);
');
if (!$r) {
- die("couldn't create helper script '$callee'");
+ die("couldn't create helper script '$callee'");
}
$process = proc_open($cmd, $descriptors, $pipes);
@@ -63,7 +63,6 @@ var_dump(array(
), strlen($stdout), strlen($stderr));
?>
-===DONE===
--CLEAN--
<?php
$callee = __DIR__ . "/process_proc_open_bug51800_right2.php";
@@ -80,4 +79,3 @@ array(3) {
}
int(1000000)
int(1000000)
-===DONE===
diff --git a/ext/standard/tests/streams/proc_open_bug60120.phpt b/ext/standard/tests/streams/proc_open_bug60120.phpt
index 053de2ebe0..9cce5a4c94 100644
--- a/ext/standard/tests/streams/proc_open_bug60120.phpt
+++ b/ext/standard/tests/streams/proc_open_bug60120.phpt
@@ -32,14 +32,14 @@ $process = proc_open(
getcwd(),
[],
[
- 'suppress_errors' => true,
+ 'suppress_errors' => true,
'bypass_shell' => false
]
);
if (!is_resource($process)) {
die(sprintf(
- "could not open process \"%s\"",
+ "could not open process \"%s\"",
$command));
}
diff --git a/ext/standard/tests/streams/proc_open_bug64438.phpt b/ext/standard/tests/streams/proc_open_bug64438.phpt
index 2880865e1d..8e4320cae9 100644
--- a/ext/standard/tests/streams/proc_open_bug64438.phpt
+++ b/ext/standard/tests/streams/proc_open_bug64438.phpt
@@ -6,9 +6,9 @@ Bug #64438 proc_open hangs with stdin/out with 4097+ bytes
error_reporting(E_ALL);
if (substr(PHP_OS, 0, 3) == 'WIN') {
- $cmd = PHP_BINARY . ' -n -r "fwrite(STDOUT, $in = file_get_contents(\'php://stdin\')); fwrite(STDERR, $in);"';
+ $cmd = PHP_BINARY . ' -n -r "fwrite(STDOUT, $in = file_get_contents(\'php://stdin\')); fwrite(STDERR, $in);"';
} else {
- $cmd = PHP_BINARY . ' -n -r \'fwrite(STDOUT, $in = file_get_contents("php://stdin")); fwrite(STDERR, $in);\'';
+ $cmd = PHP_BINARY . ' -n -r \'fwrite(STDOUT, $in = file_get_contents("php://stdin")); fwrite(STDERR, $in);\'';
}
$descriptors = array(array('pipe', 'r'), array('pipe', 'w'), array('pipe', 'w'));
$stdin = str_repeat('*', 4097);
@@ -65,7 +65,6 @@ while ($pipes || $writePipes) {
var_dump($pipeEvents);
?>
-===DONE===
--EXPECTF--
array(2) {
[%d]=>
@@ -83,4 +82,3 @@ array(2) {
string(12) "Closing pipe"
}
}
-===DONE===
diff --git a/ext/standard/tests/streams/proc_open_bug69900.phpt b/ext/standard/tests/streams/proc_open_bug69900.phpt
index 61775f72b2..de13d1bfdd 100644
--- a/ext/standard/tests/streams/proc_open_bug69900.phpt
+++ b/ext/standard/tests/streams/proc_open_bug69900.phpt
@@ -14,7 +14,7 @@ $in = fopen("php://stdin", "rb", false, stream_context_create(array("pipe" => ar
while(!feof($in)){
$s = fgets($in);
- fwrite(STDOUT, $s);
+ fwrite(STDOUT, $s);
}
?>';
@@ -27,19 +27,19 @@ $process = proc_open(PHP_BINARY.' -n -f ' . $fl, $descriptorspec, $pipes, NULL,
$moreThanLimit = 0;
for($i = 0; $i < 10; $i++){
- fwrite($pipes[0], "hello$i\r\n");
- fflush($pipes[0]);
+ fwrite($pipes[0], "hello$i\r\n");
+ fflush($pipes[0]);
- $t0 = microtime(1);
- $s = fgets($pipes[1]);
- $t1 = microtime(1);
+ $t0 = microtime(1);
+ $s = fgets($pipes[1]);
+ $t1 = microtime(1);
- echo $s;
+ echo $s;
- $dt_ms = ($t1 - $t0)*1000;
- if ($dt_ms > $max_ms) {
+ $dt_ms = ($t1 - $t0)*1000;
+ if ($dt_ms > $max_ms) {
$moreThanLimit++;
- }
+ }
}
fclose($pipes[0]);
@@ -54,7 +54,6 @@ if ($moreThanLimit > 2) {
}
?>
-===DONE===
--CLEAN--
<?php
$fl = __DIR__ . DIRECTORY_SEPARATOR . "test69900.php";
@@ -71,4 +70,3 @@ hello6
hello7
hello8
hello9
-===DONE===
diff --git a/ext/standard/tests/streams/set_file_buffer.phpt b/ext/standard/tests/streams/set_file_buffer.phpt
index 79df5a441a..5e5051c86e 100644
--- a/ext/standard/tests/streams/set_file_buffer.phpt
+++ b/ext/standard/tests/streams/set_file_buffer.phpt
@@ -43,5 +43,4 @@ option: %d, %d, %d
int(%i)
int(%d)
size: %d
-size: %d
int(%d)
diff --git a/ext/standard/tests/streams/stream_context_tcp_nodelay.phpt b/ext/standard/tests/streams/stream_context_tcp_nodelay.phpt
index 1e5b7e31d8..7af03726e6 100644
--- a/ext/standard/tests/streams/stream_context_tcp_nodelay.phpt
+++ b/ext/standard/tests/streams/stream_context_tcp_nodelay.phpt
@@ -8,16 +8,16 @@ if (!extension_loaded("sockets")) die("skip: need sockets");
--FILE--
<?php
$ctxt = stream_context_create([
- "socket" => [
- "tcp_nodelay" => true
- ]
+ "socket" => [
+ "tcp_nodelay" => true
+ ]
]);
$stream = stream_socket_client(
- "tcp://www.php.net:80", $errno, $errstr, 10, STREAM_CLIENT_CONNECT, $ctxt);
+ "tcp://www.php.net:80", $errno, $errstr, 10, STREAM_CLIENT_CONNECT, $ctxt);
$socket =
- socket_import_stream($stream);
+ socket_import_stream($stream);
var_dump(socket_get_option($socket, SOL_TCP, TCP_NODELAY) > 0);
?>
diff --git a/ext/standard/tests/streams/stream_context_tcp_nodelay_fopen.phpt b/ext/standard/tests/streams/stream_context_tcp_nodelay_fopen.phpt
index 7142dae73b..133b7a94ba 100644
--- a/ext/standard/tests/streams/stream_context_tcp_nodelay_fopen.phpt
+++ b/ext/standard/tests/streams/stream_context_tcp_nodelay_fopen.phpt
@@ -8,18 +8,18 @@ if (!extension_loaded("sockets")) die("skip: need sockets");
--FILE--
<?php
$ctxt = stream_context_create([
- "socket" => [
- "tcp_nodelay" => true
- ],
- "http" => [
- "follow_location" => 0
- ]
+ "socket" => [
+ "tcp_nodelay" => true
+ ],
+ "http" => [
+ "follow_location" => 0
+ ]
]);
$stream = fopen("http://www.php.net", "r", false, $ctxt);
$socket =
- @socket_import_stream($stream);
+ @socket_import_stream($stream);
var_dump(socket_get_option($socket, STREAM_IPPROTO_TCP, TCP_NODELAY) > 0);
?>
diff --git a/ext/standard/tests/streams/stream_context_tcp_nodelay_server.phpt b/ext/standard/tests/streams/stream_context_tcp_nodelay_server.phpt
index 420d5ad490..7d685e16df 100644
--- a/ext/standard/tests/streams/stream_context_tcp_nodelay_server.phpt
+++ b/ext/standard/tests/streams/stream_context_tcp_nodelay_server.phpt
@@ -6,40 +6,40 @@ stream context tcp_nodelay server
<?php
$serverCode = <<<'CODE'
$ctxt = stream_context_create([
- "socket" => [
- "tcp_nodelay" => true
- ]
- ]);
+ "socket" => [
+ "tcp_nodelay" => true
+ ]
+ ]);
- $server = stream_socket_server(
- "tcp://127.0.0.1:9099", $errno, $errstr, STREAM_SERVER_BIND | STREAM_SERVER_LISTEN, $ctxt);
+ $server = stream_socket_server(
+ "tcp://127.0.0.1:9099", $errno, $errstr, STREAM_SERVER_BIND | STREAM_SERVER_LISTEN, $ctxt);
- $client = stream_socket_accept($server);
+ $client = stream_socket_accept($server);
- var_dump(socket_get_option(
- socket_import_stream($server),
- SOL_TCP, TCP_NODELAY) > 0);
+ var_dump(socket_get_option(
+ socket_import_stream($server),
+ SOL_TCP, TCP_NODELAY) > 0);
- var_dump(socket_get_option(
- socket_import_stream($client),
- SOL_TCP, TCP_NODELAY) > 0);
+ var_dump(socket_get_option(
+ socket_import_stream($client),
+ SOL_TCP, TCP_NODELAY) > 0);
- fclose($client);
- fclose($server);
+ fclose($client);
+ fclose($server);
CODE;
$clientCode = <<<'CODE'
$test = stream_socket_client(
- "tcp://127.0.0.1:9099", $errno, $errstr, 10);
+ "tcp://127.0.0.1:9099", $errno, $errstr, 10);
- sleep(1);
+ sleep(1);
- fclose($test);
+ fclose($test);
CODE;
include sprintf(
- "%s/../../../openssl/tests/ServerClientTestCase.inc",
- __DIR__);
+ "%s/../../../openssl/tests/ServerClientTestCase.inc",
+ __DIR__);
ServerClientTestCase::getInstance()->run($serverCode, $clientCode);
?>
--EXPECT--
diff --git a/ext/standard/tests/streams/stream_get_contents_001.phpt b/ext/standard/tests/streams/stream_get_contents_001.phpt
index dc7fcb239c..6f5abcb782 100644
--- a/ext/standard/tests/streams/stream_get_contents_001.phpt
+++ b/ext/standard/tests/streams/stream_get_contents_001.phpt
@@ -12,8 +12,6 @@ echo stream_get_contents($tmp, 2), "--\n";
echo stream_get_contents($tmp, 2, 3), "--\n";
echo stream_get_contents($tmp, 2, -1), "--\n";
-@unlink($tmp);
-
?>
--EXPECT--
--
diff --git a/ext/standard/tests/streams/stream_get_line_NUL_delimiter.phpt b/ext/standard/tests/streams/stream_get_line_NUL_delimiter.phpt
index 8cdd5c1779..79daabd977 100644
--- a/ext/standard/tests/streams/stream_get_line_NUL_delimiter.phpt
+++ b/ext/standard/tests/streams/stream_get_line_NUL_delimiter.phpt
@@ -3,19 +3,19 @@ Bug #60455: stream_get_line and \0 as a delimiter
--FILE--
<?php
class TestStream {
- private $s = 0;
- function stream_open($path, $mode, $options, &$opened_path) {
- return true;
- }
- function stream_read($count) {
- if ($this->s++ == 0)
- return "a\0";
+ private $s = 0;
+ function stream_open($path, $mode, $options, &$opened_path) {
+ return true;
+ }
+ function stream_read($count) {
+ if ($this->s++ == 0)
+ return "a\0";
- return "";
- }
- function stream_eof() {
- return $this->s >= 2;
- }
+ return "";
+ }
+ function stream_eof() {
+ return $this->s >= 2;
+ }
}
diff --git a/ext/standard/tests/streams/stream_get_meta_data_file_error.phpt b/ext/standard/tests/streams/stream_get_meta_data_file_error.phpt
index bb98d7c6e7..7bfa4f0510 100644
--- a/ext/standard/tests/streams/stream_get_meta_data_file_error.phpt
+++ b/ext/standard/tests/streams/stream_get_meta_data_file_error.phpt
@@ -10,48 +10,20 @@ Test stream_get_meta_data() function : error conditions
echo "*** Testing stream_get_meta_data() : error conditions ***\n";
-// Zero arguments
-echo "\n-- Testing stream_get_meta_data() function with Zero arguments --\n";
-var_dump( stream_get_meta_data() );
-
-//Test stream_get_meta_data with one more than the expected number of arguments
-echo "\n-- Testing stream_get_meta_data() function with more than expected no. of arguments --\n";
-
-$fp = null;
-$extra_arg = 10;
-var_dump( stream_get_meta_data($fp, $extra_arg) );
-
-echo "\n-- Testing stream_get_meta_data() function with invalid stream resource --\n";
-$fp = null;
-var_dump(stream_get_meta_data($fp));
-
echo "\n-- Testing stream_get_meta_data() function with closed stream resource --\n";
$fp = fopen(__FILE__, 'r');
fclose($fp);
-var_dump(stream_get_meta_data($fp));
+try {
+ var_dump(stream_get_meta_data($fp));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done";
?>
---EXPECTF--
+--EXPECT--
*** Testing stream_get_meta_data() : error conditions ***
--- Testing stream_get_meta_data() function with Zero arguments --
-
-Warning: stream_get_meta_data() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
--- Testing stream_get_meta_data() function with more than expected no. of arguments --
-
-Warning: stream_get_meta_data() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
--- Testing stream_get_meta_data() function with invalid stream resource --
-
-Warning: stream_get_meta_data() expects parameter 1 to be resource, null given in %s on line %d
-NULL
-
-- Testing stream_get_meta_data() function with closed stream resource --
-
-Warning: stream_get_meta_data(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
+stream_get_meta_data(): supplied resource is not a valid stream resource
Done
diff --git a/ext/standard/tests/streams/stream_get_meta_data_file_variation1.phpt b/ext/standard/tests/streams/stream_get_meta_data_file_variation1.phpt
index f7ccc7783b..9627367c72 100644
--- a/ext/standard/tests/streams/stream_get_meta_data_file_variation1.phpt
+++ b/ext/standard/tests/streams/stream_get_meta_data_file_variation1.phpt
@@ -15,13 +15,13 @@ fclose($fp);
// open file in each access mode and get meta data
foreach ($filemodes as $mode) {
- if (strncmp($mode, 'x', 1) == 0) {
- // x modes require that file does not exist
- unlink($filename);
- }
- $fp = fopen($filename, $mode);
- var_dump(stream_get_meta_data($fp));
- fclose($fp);
+ if (strncmp($mode, 'x', 1) == 0) {
+ // x modes require that file does not exist
+ unlink($filename);
+ }
+ $fp = fopen($filename, $mode);
+ var_dump(stream_get_meta_data($fp));
+ fclose($fp);
}
unlink($filename);
diff --git a/ext/standard/tests/streams/stream_get_meta_data_file_variation2.phpt b/ext/standard/tests/streams/stream_get_meta_data_file_variation2.phpt
index 6b3fde203a..e0ebaab2ee 100644
--- a/ext/standard/tests/streams/stream_get_meta_data_file_variation2.phpt
+++ b/ext/standard/tests/streams/stream_get_meta_data_file_variation2.phpt
@@ -10,7 +10,7 @@ $fp = fopen($filename, "w+");
echo "Write some data to the file:\n";
$i = 0;
while ($i++ < 20) {
- fwrite($fp, "a line of data\n");
+ fwrite($fp, "a line of data\n");
}
var_dump(stream_get_meta_data($fp));
@@ -30,7 +30,7 @@ var_dump(stream_get_meta_data($fp));
echo "\n\nRead entire file:\n";
while(!feof($fp)) {
- fread($fp, 1);
+ fread($fp, 1);
}
var_dump(stream_get_meta_data($fp));
diff --git a/ext/standard/tests/streams/stream_get_meta_data_file_variation5.phpt b/ext/standard/tests/streams/stream_get_meta_data_file_variation5.phpt
index 22fcee4b6f..202fc7a2ec 100644
--- a/ext/standard/tests/streams/stream_get_meta_data_file_variation5.phpt
+++ b/ext/standard/tests/streams/stream_get_meta_data_file_variation5.phpt
@@ -10,7 +10,7 @@ $fp = fopen($filename, "w+");
echo "Write some data to the file:\n";
$i = 0;
while ($i++ < 20) {
- fwrite($fp, "a line of data\n");
+ fwrite($fp, "a line of data\n");
}
var_dump(stream_get_meta_data($fp));
@@ -20,7 +20,7 @@ rewind($fp);
echo "\n\nRead entire file:\n";
while(!feof($fp)) {
- fread($fp, 1);
+ fread($fp, 1);
}
var_dump(stream_get_meta_data($fp));
diff --git a/ext/standard/tests/streams/stream_get_meta_data_socket_variation1.phpt b/ext/standard/tests/streams/stream_get_meta_data_socket_variation1.phpt
index 1c7f1fd256..9db45e8c2f 100644
--- a/ext/standard/tests/streams/stream_get_meta_data_socket_variation1.phpt
+++ b/ext/standard/tests/streams/stream_get_meta_data_socket_variation1.phpt
@@ -9,7 +9,7 @@ $server = stream_socket_server('tcp://127.0.0.1:31331');
/* Connect to it */
$client = fsockopen('tcp://127.0.0.1:31331');
if (!$client) {
- die("Unable to create socket");
+ die("Unable to create socket");
}
/* Accept that connection */
@@ -31,7 +31,7 @@ echo "\n\nClose the server side socket and read the remaining data from the clie
fclose($socket);
fclose($server);
while(!feof($client)) {
- fread($client, 1);
+ fread($client, 1);
}
var_dump(stream_get_meta_data($client));
diff --git a/ext/standard/tests/streams/stream_get_meta_data_socket_variation2.phpt b/ext/standard/tests/streams/stream_get_meta_data_socket_variation2.phpt
index cb713c8525..f6e6504536 100644
--- a/ext/standard/tests/streams/stream_get_meta_data_socket_variation2.phpt
+++ b/ext/standard/tests/streams/stream_get_meta_data_socket_variation2.phpt
@@ -9,7 +9,7 @@ $server = stream_socket_server('tcp://127.0.0.1:31332');
/* Connect to it */
$client = fsockopen('tcp://127.0.0.1:31332');
if (!$client) {
- die("Unable to create socket");
+ die("Unable to create socket");
}
/* Accept that connection */
diff --git a/ext/standard/tests/streams/stream_get_meta_data_socket_variation3.phpt b/ext/standard/tests/streams/stream_get_meta_data_socket_variation3.phpt
index c7f08cbe12..ef1a22a3a1 100644
--- a/ext/standard/tests/streams/stream_get_meta_data_socket_variation3.phpt
+++ b/ext/standard/tests/streams/stream_get_meta_data_socket_variation3.phpt
@@ -9,7 +9,7 @@ $server = stream_socket_server('tcp://127.0.0.1:31333');
/* Connect to it */
$client = fsockopen('tcp://127.0.0.1:31333');
if (!$client) {
- die("Unable to create socket");
+ die("Unable to create socket");
}
/* Accept that connection */
diff --git a/ext/standard/tests/streams/stream_get_meta_data_socket_variation4.phpt b/ext/standard/tests/streams/stream_get_meta_data_socket_variation4.phpt
index e37e991f16..cd83b1342c 100644
--- a/ext/standard/tests/streams/stream_get_meta_data_socket_variation4.phpt
+++ b/ext/standard/tests/streams/stream_get_meta_data_socket_variation4.phpt
@@ -9,7 +9,7 @@ $server = stream_socket_server('tcp://127.0.0.1:31334');
/* Connect to it */
$client = fsockopen('tcp://127.0.0.1:31334');
if (!$client) {
- die("Unable to create socket");
+ die("Unable to create socket");
}
/* Accept that connection */
@@ -27,7 +27,7 @@ echo "\n\nClose the server side socket and read the remaining data from the clie
fclose($socket);
fclose($server);
while(!feof($client)) {
- fread($client, 1);
+ fread($client, 1);
}
var_dump(stream_get_meta_data($client));
diff --git a/ext/standard/tests/streams/stream_multi_filters_close.phpt b/ext/standard/tests/streams/stream_multi_filters_close.phpt
index f1eb18a15c..6b955cf1a7 100644
--- a/ext/standard/tests/streams/stream_multi_filters_close.phpt
+++ b/ext/standard/tests/streams/stream_multi_filters_close.phpt
@@ -4,41 +4,41 @@ Check if multiple filters are closed correctly and never called again after clos
<?php
class FirstFilter extends php_user_filter {
- public function filter($in, $out, &$consumed, $closing) {
- static $closed = 0;
-
- while ($bucket = stream_bucket_make_writeable($in)) {
- stream_bucket_append($out, stream_bucket_new($this->stream, $bucket->data));
- }
-
- if ($closing) {
- $closed++;
- }
-
- if ($closed > 0) {
- var_dump($closed++);
- }
- return PSFS_PASS_ON;
- }
+ public function filter($in, $out, &$consumed, $closing) {
+ static $closed = 0;
+
+ while ($bucket = stream_bucket_make_writeable($in)) {
+ stream_bucket_append($out, stream_bucket_new($this->stream, $bucket->data));
+ }
+
+ if ($closing) {
+ $closed++;
+ }
+
+ if ($closed > 0) {
+ var_dump($closed++);
+ }
+ return PSFS_PASS_ON;
+ }
}
class SecondFilter extends php_user_filter {
- public function filter($in, $out, &$consumed, $closing) {
- static $closed = 0;
-
- while ($bucket = stream_bucket_make_writeable($in)) {
- stream_bucket_append($out, stream_bucket_new($this->stream, $bucket->data));
- }
-
- if ($closing) {
- $closed++;
- }
-
- if ($closed > 0) {
- var_dump($closed++);
- }
- return PSFS_PASS_ON;
- }
+ public function filter($in, $out, &$consumed, $closing) {
+ static $closed = 0;
+
+ while ($bucket = stream_bucket_make_writeable($in)) {
+ stream_bucket_append($out, stream_bucket_new($this->stream, $bucket->data));
+ }
+
+ if ($closing) {
+ $closed++;
+ }
+
+ if ($closed > 0) {
+ var_dump($closed++);
+ }
+ return PSFS_PASS_ON;
+ }
}
$r = fopen("php://stdout", "w+");
diff --git a/ext/standard/tests/streams/stream_resolve_include_path.phpt b/ext/standard/tests/streams/stream_resolve_include_path.phpt
index 4109b5672e..f77c0730f3 100644
--- a/ext/standard/tests/streams/stream_resolve_include_path.phpt
+++ b/ext/standard/tests/streams/stream_resolve_include_path.phpt
@@ -14,8 +14,6 @@ mkdir($include_path_nested);
file_put_contents($include_path_file, 'include_path');
file_put_contents($include_path_nested_file, 'include_path');
-var_dump(stream_resolve_include_path());
-
set_include_path($include_path . PATH_SEPARATOR . $include_path_nested);
var_dump(stream_resolve_include_path('file-does-not-exist'));
@@ -24,13 +22,20 @@ var_dump(stream_resolve_include_path('file'));
set_include_path($include_path_nested . PATH_SEPARATOR . $include_path);
var_dump(stream_resolve_include_path('file'));
+?>
+--CLEAN--
+<?php
+$include_path = __DIR__ . '/test_path';
+$include_path_nested = $include_path . '/nested';
+$include_path_file = $include_path . DIRECTORY_SEPARATOR . 'file';
+$include_path_nested_file = $include_path_nested . DIRECTORY_SEPARATOR . 'file';
+
unlink($include_path_nested_file);
rmdir($include_path_nested);
unlink($include_path_file);
rmdir($include_path);
+?>
--EXPECTF--
-Warning: stream_resolve_include_path() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
bool(false)
string(%d) "%stest_path%sfile"
string(%d) "%stest_path%snested%sfile"
diff --git a/ext/standard/tests/streams/stream_set_chunk_size.phpt b/ext/standard/tests/streams/stream_set_chunk_size.phpt
index 8c2ae9865b..ac50db6867 100644
--- a/ext/standard/tests/streams/stream_set_chunk_size.phpt
+++ b/ext/standard/tests/streams/stream_set_chunk_size.phpt
@@ -3,24 +3,24 @@ stream_set_chunk_size basic tests
--FILE--
<?php
class test_wrapper {
- function stream_open($path, $mode, $openedpath) {
- return true;
- }
- function stream_eof() {
- return false;
- }
- function stream_read($count) {
- echo "read with size: ", $count, "\n";
- return str_repeat('a', $count);
- }
- function stream_write($data) {
- echo "write with size: ", strlen($data), "\n";
- return strlen($data);
- }
- function stream_set_option($option, $arg1, $arg2) {
- echo "option: ", $option, ", ", $arg1, ", ", $arg2, "\n";
- return false;
- }
+ function stream_open($path, $mode, $openedpath) {
+ return true;
+ }
+ function stream_eof() {
+ return false;
+ }
+ function stream_read($count) {
+ echo "read with size: ", $count, "\n";
+ return str_repeat('a', $count);
+ }
+ function stream_write($data) {
+ echo "write with size: ", strlen($data), "\n";
+ return strlen($data);
+ }
+ function stream_set_option($option, $arg1, $arg2) {
+ echo "option: ", $option, ", ", $arg1, ", ", $arg2, "\n";
+ return false;
+ }
}
var_dump(stream_wrapper_register('test', 'test_wrapper'));
@@ -34,7 +34,7 @@ echo "should return previous chunk size (8192)\n";
var_dump(stream_set_chunk_size($f, 1));
echo "should be read without buffer (\$count == 10000)\n";
var_dump(strlen(fread($f, 10000)));
-echo "should elicit 3 writes of size 1 and return 3\n";
+echo "should have no effect on writes\n";
var_dump(fwrite($f, str_repeat('b', 3)));
echo "should return previous chunk size (1)\n";
@@ -45,24 +45,29 @@ echo "should elicit one read of size 100 (chunk size)\n";
var_dump(strlen(fread($f, 50)));
echo "should elicit no read because there is sufficient cached data\n";
var_dump(strlen(fread($f, 50)));
-echo "should elicit 2 writes of size 100 and one of size 50\n";
+echo "should have no effect on writes\n";
var_dump(strlen(fwrite($f, str_repeat('b', 250))));
echo "\nerror conditions\n";
-var_dump(stream_set_chunk_size($f, 0));
-var_dump(stream_set_chunk_size($f, -1));
-var_dump(stream_set_chunk_size($f, array()));
---EXPECTF--
+try {
+ stream_set_chunk_size($f, 0);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+try {
+ stream_set_chunk_size($f, -1);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+--EXPECT--
bool(true)
should return previous chunk size (8192)
int(8192)
should be read without buffer ($count == 10000)
read with size: 10000
int(10000)
-should elicit 3 writes of size 1 and return 3
-write with size: 1
-write with size: 1
-write with size: 1
+should have no effect on writes
+write with size: 3
int(3)
should return previous chunk size (1)
int(1)
@@ -74,19 +79,10 @@ read with size: 100
int(50)
should elicit no read because there is sufficient cached data
int(50)
-should elicit 2 writes of size 100 and one of size 50
-write with size: 100
-write with size: 100
-write with size: 50
+should have no effect on writes
+write with size: 250
int(3)
error conditions
-
-Warning: stream_set_chunk_size(): The chunk size must be a positive integer, given 0 in %s on line %d
-bool(false)
-
-Warning: stream_set_chunk_size(): The chunk size must be a positive integer, given -1 in %s on line %d
-bool(false)
-
-Warning: stream_set_chunk_size() expects parameter 2 to be int, array given in %s on line %d
-bool(false)
+The chunk size must be a positive integer, 0 given
+The chunk size must be a positive integer, -1 given
diff --git a/ext/standard/tests/streams/stream_set_timeout_error.phpt b/ext/standard/tests/streams/stream_set_timeout_error.phpt
index 0334b951e0..7dcc645422 100644
--- a/ext/standard/tests/streams/stream_set_timeout_error.phpt
+++ b/ext/standard/tests/streams/stream_set_timeout_error.phpt
@@ -10,9 +10,6 @@ Test stream_set_timeout() function : error conditions
echo "*** Testing stream_set_timeout() : error conditions ***\n";
-//Test stream_set_timeout with one more than the expected number of arguments
-echo "\n-- Testing stream_set_timeout() function with more than expected no. of arguments --\n";
-
for ($i=0; $i<100; $i++) {
$port = rand(10000, 65000);
/* Setup socket server */
@@ -26,22 +23,14 @@ $client = fsockopen("tcp://127.0.0.1:$port");
$seconds = 10;
$microseconds = 10;
-$extra_arg = 10;
-var_dump( stream_set_timeout($client, $seconds, $microseconds, $extra_arg) );
-
-// Testing stream_set_timeout with one less than the expected number of arguments
-echo "\n-- Testing stream_set_timeout() function with less than expected no. of arguments --\n";
-
-$seconds = 10;
-var_dump( stream_set_timeout($client) );
-
echo "\n-- Testing stream_set_timeout() function with a closed socket --\n";
fclose($client);
-var_dump( stream_set_timeout($client, $seconds) );
-
-echo "\n-- Testing stream_set_timeout() function with an invalid stream --\n";
-var_dump( stream_set_timeout($seconds, $seconds) );
+try {
+ var_dump( stream_set_timeout($client, $seconds) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "\n-- Testing stream_set_timeout() function with a stream that does not support timeouts --\n";
$filestream = fopen(__FILE__, "r");
@@ -55,25 +44,8 @@ echo "Done";
--EXPECTF--
*** Testing stream_set_timeout() : error conditions ***
--- Testing stream_set_timeout() function with more than expected no. of arguments --
-
-Warning: stream_set_timeout() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-
--- Testing stream_set_timeout() function with less than expected no. of arguments --
-
-Warning: stream_set_timeout() expects at least 2 parameters, 1 given in %s on line %d
-NULL
-
-- Testing stream_set_timeout() function with a closed socket --
-
-Warning: stream_set_timeout(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-
--- Testing stream_set_timeout() function with an invalid stream --
-
-Warning: stream_set_timeout() expects parameter 1 to be resource, int given in %s on line %d
-NULL
+stream_set_timeout(): supplied resource is not a valid stream resource
-- Testing stream_set_timeout() function with a stream that does not support timeouts --
bool(false)
diff --git a/ext/standard/tests/strings/006.phpt b/ext/standard/tests/strings/006.phpt
index 7665aa20f5..5f36d9aa8d 100644
--- a/ext/standard/tests/strings/006.phpt
+++ b/ext/standard/tests/strings/006.phpt
@@ -11,11 +11,9 @@ var_dump(highlight_file($file, true));
var_dump(ob_get_contents());
?>
-===DONE===
--EXPECTF--
-Warning: highlight_file(AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA): failed to open stream: %s006.php on line %d
+Warning: highlight_file(AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA): Failed to open stream: %s006.php on line %d
Warning: highlight_file(): Failed opening 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' for highlighting in %s006.php on line %d
bool(false)
bool(false)
-===DONE===
diff --git a/ext/standard/tests/strings/007-win32.phpt b/ext/standard/tests/strings/007-win32.phpt
index 7d06f018a5..4dce8f0e13 100644
--- a/ext/standard/tests/strings/007-win32.phpt
+++ b/ext/standard/tests/strings/007-win32.phpt
@@ -12,9 +12,7 @@ var_dump(php_strip_whitespace($file));
var_dump(ob_get_contents());
?>
-===DONE===
--EXPECTF--
-Warning: php_strip_whitespace(%s): failed to open stream: No such file or directory in %s on line %d
+Warning: php_strip_whitespace(%s): Failed to open stream: No such file or directory in %s on line %d
string(0) ""
bool(false)
-===DONE===
diff --git a/ext/standard/tests/strings/007.phpt b/ext/standard/tests/strings/007.phpt
index a0fd8acdf4..ecbab6d2e6 100644
--- a/ext/standard/tests/strings/007.phpt
+++ b/ext/standard/tests/strings/007.phpt
@@ -12,9 +12,7 @@ var_dump(php_strip_whitespace($file));
var_dump(ob_get_contents());
?>
-===DONE===
--EXPECTF--
-Warning: php_strip_whitespace(%s): failed to open stream: File name too long in %s007.php on line %d
+Warning: php_strip_whitespace(%s): Failed to open stream: File name too long in %s007.php on line %d
string(0) ""
bool(false)
-===DONE===
diff --git a/ext/standard/tests/strings/add-and-stripslashes.phpt b/ext/standard/tests/strings/add-and-stripslashes.phpt
index 6f01176d4e..4855ff02fe 100644
--- a/ext/standard/tests/strings/add-and-stripslashes.phpt
+++ b/ext/standard/tests/strings/add-and-stripslashes.phpt
@@ -5,14 +5,14 @@ addslashes() and stripslashes() functions
$input = '';
for($i=0; $i<512; $i++) {
- $input .= chr($i%256);
+ $input .= chr($i%256);
}
echo "Normal: ";
if($input === stripslashes(addslashes($input))) {
- echo "OK\n";
+ echo "OK\n";
} else {
- echo "FAILED\n";
+ echo "FAILED\n";
}
?>
diff --git a/ext/standard/tests/strings/addcslashes_001.phpt b/ext/standard/tests/strings/addcslashes_001.phpt
index 4080c7214d..5b60f6168d 100644
--- a/ext/standard/tests/strings/addcslashes_001.phpt
+++ b/ext/standard/tests/strings/addcslashes_001.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/addslashes_variation2.phpt b/ext/standard/tests/strings/addslashes_variation2.phpt
index 628980df27..d4c0257b6e 100644
--- a/ext/standard/tests/strings/addslashes_variation2.phpt
+++ b/ext/standard/tests/strings/addslashes_variation2.phpt
@@ -8,7 +8,7 @@ Test addslashes() function : usage variations - strings with characters to be ba
*/
/*
- * Test addslashes() with various strings containing characters thats can be backslashed
+ * Test addslashes() with various strings containing characters that can be backslashed
*/
echo "*** Testing addslashes() : with various strings containing characters to be backslashed ***\n";
@@ -43,7 +43,7 @@ $str_array = array(
"",
"\"",
'"',
- "hello\"",
+ "hello\"",
// string with backslash characters
'Is your name Ram\Krishna?',
@@ -65,7 +65,7 @@ $str_array = array(
'"c:\php\"'.chr(0)."'",
'"hello"'."'world'".chr(0).'//',
- // string with hexadecimal number
+ // string with hexadecimal number
"0xABCDEF0123456789",
"\x00",
'!@#$%&*@$%#&/;:,<>',
diff --git a/ext/standard/tests/strings/basename.phpt b/ext/standard/tests/strings/basename.phpt
index a39a6f9aeb..1f69bf4bce 100644
--- a/ext/standard/tests/strings/basename.phpt
+++ b/ext/standard/tests/strings/basename.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/bin2hex.phpt b/ext/standard/tests/strings/bin2hex.phpt
index 42a4f4c594..dbc440c094 100644
--- a/ext/standard/tests/strings/bin2hex.phpt
+++ b/ext/standard/tests/strings/bin2hex.phpt
@@ -4,7 +4,7 @@ bin2hex() function
<?php
$s = '';
for($i=0; $i<256; $i++) {
- $s .= chr($i);
+ $s .= chr($i);
}
echo bin2hex($s)."\n";
echo bin2hex("abc")."\n";
diff --git a/ext/standard/tests/strings/bin2hex_basic.phpt b/ext/standard/tests/strings/bin2hex_basic.phpt
index 9eb07b573e..8842b8fea8 100644
--- a/ext/standard/tests/strings/bin2hex_basic.phpt
+++ b/ext/standard/tests/strings/bin2hex_basic.phpt
@@ -13,15 +13,15 @@ echo "*** Testing bin2hex() : basic functionality ***\n";
// array with different values for $string
$strings = array (
- //double quoted strings
+ //double quoted strings
/*1*/ "Here is a simple string",
- "\t This String contains \t\t some control characters\r\n",
- "\x90\x91\x00\x93\x94\x90\x91\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f",
+ "\t This String contains \t\t some control characters\r\n",
+ "\x90\x91\x00\x93\x94\x90\x91\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f",
- //single quoted strings
+ //single quoted strings
/*4*/ 'Here is a simple string',
- '\t This String contains \t\t some control characters\r\n',
- '\x90\x91\x00\x93\x94\x90\x91\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f',
+ '\t This String contains \t\t some control characters\r\n',
+ '\x90\x91\x00\x93\x94\x90\x91\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f',
);
// loop through with each element of the $strings array to test bin2hex() function
@@ -32,7 +32,6 @@ foreach($strings as $string) {
$count ++;
}
?>
-===DONE===
--EXPECT--
*** Testing bin2hex() : basic functionality ***
-- Iteration 1 --
@@ -47,4 +46,3 @@ string(46) "4865726520697320612073696d706c6520737472696e67"
string(112) "5c74205468697320537472696e6720636f6e7461696e73205c745c7420736f6d6520636f6e74726f6c20636861726163746572735c725c6e"
-- Iteration 6 --
string(144) "5c7839305c7839315c7830305c7839335c7839345c7839305c7839315c7839355c7839365c7839375c7839385c7839395c7839615c7839625c7839635c7839645c7839655c783966"
-===DONE===
diff --git a/ext/standard/tests/strings/bug20108.phpt b/ext/standard/tests/strings/bug20108.phpt
index 6e2219d990..e0be12b242 100644
--- a/ext/standard/tests/strings/bug20108.phpt
+++ b/ext/standard/tests/strings/bug20108.phpt
@@ -2,9 +2,9 @@
Bug #20108 (Segfault on printf statement)
--FILE--
<?php
- $a = "boo";
- $z = sprintf("%580.58s\n", $a);
- var_dump($z);
+ $a = "boo";
+ $z = sprintf("%580.58s\n", $a);
+ var_dump($z);
?>
--EXPECT--
string(581) " boo
diff --git a/ext/standard/tests/strings/bug20169.phpt b/ext/standard/tests/strings/bug20169.phpt
index c606578677..fd5de0ee88 100644
--- a/ext/standard/tests/strings/bug20169.phpt
+++ b/ext/standard/tests/strings/bug20169.phpt
@@ -2,12 +2,12 @@
Bug #20169 (implode() clobbers first argument)
--FILE--
<?php
- @set_time_limit(5);
- $delimiter = "|";
+ @set_time_limit(5);
+ $delimiter = "|";
- echo "delimiter: $delimiter\n";
- implode($delimiter, array("foo", "bar"));
- echo "delimiter: $delimiter\n";
+ echo "delimiter: $delimiter\n";
+ implode($delimiter, array("foo", "bar"));
+ echo "delimiter: $delimiter\n";
?>
--EXPECT--
delimiter: |
diff --git a/ext/standard/tests/strings/bug21338.phpt b/ext/standard/tests/strings/bug21338.phpt
index c84576563e..c118ee18de 100644
--- a/ext/standard/tests/strings/bug21338.phpt
+++ b/ext/standard/tests/strings/bug21338.phpt
@@ -2,8 +2,8 @@
Bug #20934 (html_entity_decode() crash when "" is passed)
--FILE--
<?php
- var_dump(html_entity_decode(NULL));
- var_dump(html_entity_decode(""));
+ var_dump(html_entity_decode(NULL));
+ var_dump(html_entity_decode(""));
?>
--EXPECT--
string(0) ""
diff --git a/ext/standard/tests/strings/bug21453.phpt b/ext/standard/tests/strings/bug21453.phpt
index 61547c48f3..cf563dfaf3 100644
--- a/ext/standard/tests/strings/bug21453.phpt
+++ b/ext/standard/tests/strings/bug21453.phpt
@@ -4,15 +4,15 @@ Bug #21453 (handling of non-encoded <)
<?php
$test = "
<table>
- <tr><td>first cell before < first cell after</td></tr>
- <tr><td>second cell before < second cell after</td></tr>
+ <tr><td>first cell before < first cell after</td></tr>
+ <tr><td>second cell before < second cell after</td></tr>
</table>";
- var_dump(strip_tags($test));
+var_dump(strip_tags($test));
?>
--EXPECTF--
string(8%d) "
- first cell before < first cell after
- second cell before < second cell after
+ first cell before < first cell after
+ second cell before < second cell after
"
diff --git a/ext/standard/tests/strings/bug22187.phpt b/ext/standard/tests/strings/bug22187.phpt
index dccaccc04d..9b77569b47 100644
--- a/ext/standard/tests/strings/bug22187.phpt
+++ b/ext/standard/tests/strings/bug22187.phpt
@@ -2,8 +2,8 @@
Bug #22187 (possible crash in number_format() function)
--FILE--
<?php
- var_dump(number_format(0.0001, 1));
- var_dump(number_format(0.0001, 0));
+ var_dump(number_format(0.0001, 1));
+ var_dump(number_format(0.0001, 0));
?>
--EXPECT--
string(3) "0.0"
diff --git a/ext/standard/tests/strings/bug22207.phpt b/ext/standard/tests/strings/bug22207.phpt
index 956acd2103..eddfa942e2 100644
--- a/ext/standard/tests/strings/bug22207.phpt
+++ b/ext/standard/tests/strings/bug22207.phpt
@@ -2,8 +2,8 @@
Bug #22207 (missing 0 when using the e notation in *printf functions)
--FILE--
<?php
- printf("%10.5e\n", 1.1);
- var_dump(sprintf("%10.5e\n", 1.1));
+ printf("%10.5e\n", 1.1);
+ var_dump(sprintf("%10.5e\n", 1.1));
?>
--EXPECT--
1.10000e+0
diff --git a/ext/standard/tests/strings/bug22224.phpt b/ext/standard/tests/strings/bug22224.phpt
index 0ab00a6c42..c9a669eb46 100644
--- a/ext/standard/tests/strings/bug22224.phpt
+++ b/ext/standard/tests/strings/bug22224.phpt
@@ -6,10 +6,10 @@ error_reporting=0
<?php
class foo
{
- function __toString()
- {
- return "Object";
- }
+ function __toString()
+ {
+ return "Object";
+ }
}
diff --git a/ext/standard/tests/strings/bug24098.phpt b/ext/standard/tests/strings/bug24098.phpt
index 1998d9ed0a..16d2f7720e 100644
--- a/ext/standard/tests/strings/bug24098.phpt
+++ b/ext/standard/tests/strings/bug24098.phpt
@@ -4,7 +4,7 @@ Bug #24098 (pathinfo() crash)
<?php if (DIRECTORY_SEPARATOR == '\\') die("skip directory separator won't match expected output"); ?>
--FILE--
<?php
- var_dump(pathinfo("/dsds.asa"));
+ var_dump(pathinfo("/dsds.asa"));
?>
--EXPECT--
array(4) {
diff --git a/ext/standard/tests/strings/bug24208.phpt b/ext/standard/tests/strings/bug24208.phpt
deleted file mode 100644
index f85c9c1e54..0000000000
--- a/ext/standard/tests/strings/bug24208.phpt
+++ /dev/null
@@ -1,13 +0,0 @@
---TEST--
-Bug #24208 (parse_str() is not working)
---FILE--
-<?php
-$a = $b = $c = "oops";
-parse_str("a=1&b=2&c=3");
-var_dump($a, $b, $c);
-?>
---EXPECTF--
-Deprecated: parse_str(): Calling parse_str() without the result argument is deprecated in %s on line %d
-string(1) "1"
-string(1) "2"
-string(1) "3"
diff --git a/ext/standard/tests/strings/bug24312.phpt b/ext/standard/tests/strings/bug24312.phpt
index 5ec444dd58..fb1f494b18 100644
--- a/ext/standard/tests/strings/bug24312.phpt
+++ b/ext/standard/tests/strings/bug24312.phpt
@@ -4,8 +4,8 @@ Bug #24208 (base64_decode() not skipping 0xF0 - 0xFF)
<?php
$data = str_repeat("a", 100);
for ($i = 0xF0; $i < 0xFF + 1; $i++) {
- $enc = chunk_split(base64_encode($data), 10, chr($i));
- var_dump(base64_decode($enc));
+ $enc = chunk_split(base64_encode($data), 10, chr($i));
+ var_dump(base64_decode($enc));
}
?>
--EXPECT--
diff --git a/ext/standard/tests/strings/bug25671.phpt b/ext/standard/tests/strings/bug25671.phpt
index ab26ddf772..cd6dec6641 100644
--- a/ext/standard/tests/strings/bug25671.phpt
+++ b/ext/standard/tests/strings/bug25671.phpt
@@ -3,12 +3,12 @@ Bug #25671 (subarrays not copied correctly)
--FILE--
<?php
$arr = array(
- "This is string one.",
- "This is string two.",
- array(
- "This is another string.",
- "This is a last string."),
- "This is a last string.");
+ "This is string one.",
+ "This is string two.",
+ array(
+ "This is another string.",
+ "This is a last string."),
+ "This is a last string.");
echo serialize(str_replace("string", "strung", $arr)) . "\n";
echo serialize(str_replace("string", "strung", $arr)) . "\n";
diff --git a/ext/standard/tests/strings/bug26817.phpt b/ext/standard/tests/strings/bug26817.phpt
index 2e31d30be9..e3b6539a1c 100644
--- a/ext/standard/tests/strings/bug26817.phpt
+++ b/ext/standard/tests/strings/bug26817.phpt
@@ -3,18 +3,18 @@ Bug #26817 (http_build_query() did not handle private & protected object propert
--FILE--
<?php
class test {
- protected $foo;
- private $bar;
- public $test;
+ protected $foo;
+ private $bar;
+ public $test;
- function foo()
- {
- $this->bar = 'meuh';
- $this->foo = 'lala';
- $this->test = 'test';
+ function foo()
+ {
+ $this->bar = 'meuh';
+ $this->foo = 'lala';
+ $this->test = 'test';
- var_dump(http_build_query($this));
- }
+ var_dump(http_build_query($this));
+ }
}
$obj = new test();
diff --git a/ext/standard/tests/strings/bug26878.phpt b/ext/standard/tests/strings/bug26878.phpt
index 602f710c83..da6c0a2aa4 100644
--- a/ext/standard/tests/strings/bug26878.phpt
+++ b/ext/standard/tests/strings/bug26878.phpt
@@ -2,8 +2,8 @@
Bug #26878 (problem with multiple references to the same variable with different types)
--FILE--
<?php
- printf('Int: %1$d and as string: %1$s', 'some string');
- echo "\n";
+ printf('Int: %1$d and as string: %1$s', 'some string');
+ echo "\n";
?>
--EXPECT--
Int: 0 and as string: some string
diff --git a/ext/standard/tests/strings/bug27278.phpt b/ext/standard/tests/strings/bug27278.phpt
index 1a94692d19..f3d8eced90 100644
--- a/ext/standard/tests/strings/bug27278.phpt
+++ b/ext/standard/tests/strings/bug27278.phpt
@@ -5,8 +5,8 @@ Bug #27278 (*printf() functions treat arguments as if passed by reference)
function foo ($a)
{
- $a=sprintf("%02d",$a);
- var_dump($a);
+ $a=sprintf("%02d",$a);
+ var_dump($a);
}
$x="02";
diff --git a/ext/standard/tests/strings/bug27295.phpt b/ext/standard/tests/strings/bug27295.phpt
index d23d27049f..b8c53e4906 100644
--- a/ext/standard/tests/strings/bug27295.phpt
+++ b/ext/standard/tests/strings/bug27295.phpt
@@ -5,8 +5,8 @@ Bug #27295 (memory leak inside sscanf())
$strings = array("foo = bar", "bar = foo");
foreach( $strings as $string )
{
- sscanf( $string, "%s = %[^[]]", $var, $val );
- echo "$var = $val\n";
+ sscanf( $string, "%s = %[^[]]", $var, $val );
+ echo "$var = $val\n";
}
?>
--EXPECT--
diff --git a/ext/standard/tests/strings/bug27457.phpt b/ext/standard/tests/strings/bug27457.phpt
index 6f5ec05f79..e9ac42e031 100644
--- a/ext/standard/tests/strings/bug27457.phpt
+++ b/ext/standard/tests/strings/bug27457.phpt
@@ -2,16 +2,16 @@
Bug #27457 (Problem with strtr() and translation array)
--FILE--
<?php
- $test = "Dot in brackets [.]\n";
- echo $test;
- $test = strtr($test, array('.' => '0'));
- echo $test;
- $test = strtr($test, array('0' => '.'));
- echo $test;
- $test = strtr($test, '.', '0');
- echo $test;
- $test = strtr($test, '0', '.');
- echo $test;
+ $test = "Dot in brackets [.]\n";
+ echo $test;
+ $test = strtr($test, array('.' => '0'));
+ echo $test;
+ $test = strtr($test, array('0' => '.'));
+ echo $test;
+ $test = strtr($test, '.', '0');
+ echo $test;
+ $test = strtr($test, '0', '.');
+ echo $test;
?>
--EXPECT--
Dot in brackets [.]
diff --git a/ext/standard/tests/strings/bug28633.phpt b/ext/standard/tests/strings/bug28633.phpt
index 5a1c2567fa..9dc83a40ad 100644
--- a/ext/standard/tests/strings/bug28633.phpt
+++ b/ext/standard/tests/strings/bug28633.phpt
@@ -2,8 +2,8 @@
Bug #28633 (sprintf incorrectly adding padding to floats)
--FILE--
<?php
- echo sprintf("%05.2f", 0.02) . "\n";
- echo sprintf("%05.2f", 2.02) . "\n";
+ echo sprintf("%05.2f", 0.02) . "\n";
+ echo sprintf("%05.2f", 2.02) . "\n";
?>
--EXPECT--
00.02
diff --git a/ext/standard/tests/strings/bug29075.phpt b/ext/standard/tests/strings/bug29075.phpt
index 7fe7da6c49..63a4fdb074 100644
--- a/ext/standard/tests/strings/bug29075.phpt
+++ b/ext/standard/tests/strings/bug29075.phpt
@@ -2,11 +2,11 @@
Bug #29075 (strnatcmp() incorrectly handles whitespace)
--FILE--
<?php
- var_dump(
- strnatcmp('foo ', 'foo '),
- strnatcmp('foo', 'foo'),
- strnatcmp(' foo', ' foo')
- );
+ var_dump(
+ strnatcmp('foo ', 'foo '),
+ strnatcmp('foo', 'foo'),
+ strnatcmp(' foo', ' foo')
+ );
?>
--EXPECT--
int(0)
diff --git a/ext/standard/tests/strings/bug29538.phpt b/ext/standard/tests/strings/bug29538.phpt
index 6af25fb89a..13065a4e11 100644
--- a/ext/standard/tests/strings/bug29538.phpt
+++ b/ext/standard/tests/strings/bug29538.phpt
@@ -2,8 +2,8 @@
Bug #29538 (number_format and problem with 0)
--FILE--
<?php
- echo number_format(0.25, 2, '', ''), "\n";
- echo number_format(1234, 2, '', ',');
+ echo number_format(0.25, 2, '', ''), "\n";
+ echo number_format(1234, 2, '', ',');
?>
--EXPECT--
025
diff --git a/ext/standard/tests/strings/bug33605.phpt b/ext/standard/tests/strings/bug33605.phpt
index 7ba38f94f5..dd937851ca 100644
--- a/ext/standard/tests/strings/bug33605.phpt
+++ b/ext/standard/tests/strings/bug33605.phpt
@@ -2,10 +2,12 @@
Bug #33605 (substr_compare crashes)
--FILE--
<?php
-$res = substr_compare("aa", "a", -99999999, -1, 0);
-var_dump($res);
+try {
+ substr_compare("aa", "a", -99999999, -1, 0);
+} catch (\ValueError $e) {
+ echo $e->getMessage();
+}
?>
---EXPECTF--
-Warning: substr_compare(): The length must be greater than or equal to zero in %s on line %d
-bool(false)
+--EXPECT--
+The length must be greater than or equal to zero
diff --git a/ext/standard/tests/strings/bug36148.phpt b/ext/standard/tests/strings/bug36148.phpt
index 06caac3334..2e9a81c5ea 100644
--- a/ext/standard/tests/strings/bug36148.phpt
+++ b/ext/standard/tests/strings/bug36148.phpt
@@ -4,10 +4,10 @@ Bug #36148 (unpack("H*hex", $data) is adding an extra character to the end of th
<?php
$values = array("a", "aa", "aaa", "aaaa");
foreach ($values as $value) {
- $a = pack("H*", $value);
- $b = unpack("H*", $a);
- echo $value.": ";
- var_dump($b);
+ $a = pack("H*", $value);
+ $b = unpack("H*", $a);
+ echo $value.": ";
+ var_dump($b);
}
?>
--EXPECT--
diff --git a/ext/standard/tests/strings/bug36392.phpt b/ext/standard/tests/strings/bug36392.phpt
index 8e4cd16c67..b98f7e6293 100644
--- a/ext/standard/tests/strings/bug36392.phpt
+++ b/ext/standard/tests/strings/bug36392.phpt
@@ -2,11 +2,11 @@
Bug #36392 (wrong number of decimal digits with %e specifier in sprintf)
--FILE--
<?php
- echo sprintf("%e\n", 1.123456789);
- echo sprintf("%.10e\n", 1.123456789);
- echo sprintf("%.0e\n", 1.123456789);
- echo sprintf("%.1e\n", 1.123456789);
- echo sprintf("%5.1e\n", 1.123456789);
+ echo sprintf("%e\n", 1.123456789);
+ echo sprintf("%.10e\n", 1.123456789);
+ echo sprintf("%.0e\n", 1.123456789);
+ echo sprintf("%.1e\n", 1.123456789);
+ echo sprintf("%5.1e\n", 1.123456789);
?>
--EXPECT--
1.123457e+0
diff --git a/ext/standard/tests/strings/bug37262.phpt b/ext/standard/tests/strings/bug37262.phpt
index b964c4a659..92abb29206 100644
--- a/ext/standard/tests/strings/bug37262.phpt
+++ b/ext/standard/tests/strings/bug37262.phpt
@@ -2,9 +2,7 @@
Bug #37262 (var_export() does not escape \0 character)
--FILE--
<?php
-$func = create_function('$a', 'return $a;');
-var_export($func);
+var_export("foo\0bar");
?>
---EXPECTF--
-Deprecated: Function create_function() is deprecated in %s on line %d
-'' . "\0" . 'lambda_%d'
+--EXPECT--
+'foo' . "\0" . 'bar'
diff --git a/ext/standard/tests/strings/bug38770.phpt b/ext/standard/tests/strings/bug38770.phpt
index 76ec33572b..a349ebff15 100644
--- a/ext/standard/tests/strings/bug38770.phpt
+++ b/ext/standard/tests/strings/bug38770.phpt
@@ -8,7 +8,7 @@ if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
<?php
foreach (array('N','l') as $v) {
- print_r(unpack($v, pack($v, -30000)));
+ print_r(unpack($v, pack($v, -30000)));
}
echo "Done\n";
diff --git a/ext/standard/tests/strings/bug39873.phpt b/ext/standard/tests/strings/bug39873.phpt
index 527b7d3c92..f264f6bb02 100644
--- a/ext/standard/tests/strings/bug39873.phpt
+++ b/ext/standard/tests/strings/bug39873.phpt
@@ -8,10 +8,10 @@ if (!setlocale(LC_ALL, "ita","it","Italian","it_IT","it_IT.ISO8859-1","it_IT.ISO
?>
--FILE--
<?php
- setlocale(LC_ALL, "ita","it","Italian","it_IT","it_IT.ISO8859-1","it_IT.ISO_8859-1");
- $num = 0+"1234.56";
- echo number_format($num,2);
- echo "\n";
+ setlocale(LC_ALL, "ita","it","Italian","it_IT","it_IT.ISO8859-1","it_IT.ISO_8859-1");
+ $num = 0+"1234.56";
+ echo number_format($num,2);
+ echo "\n";
?>
--EXPECT--
1,234.56
diff --git a/ext/standard/tests/strings/bug40754.phpt b/ext/standard/tests/strings/bug40754.phpt
index 26ea5bc770..9e409bf271 100644
--- a/ext/standard/tests/strings/bug40754.phpt
+++ b/ext/standard/tests/strings/bug40754.phpt
@@ -11,16 +11,52 @@ var_dump(substr_replace("abcde", "x", $v, $v));
var_dump(strspn("abcde", "abc", $v, $v));
var_dump(strcspn("abcde", "abc", $v, $v));
-var_dump(substr_count("abcde", "abc", $v, $v));
+try {
+ var_dump(substr_count("abcde", "abc", $v, $v));
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
var_dump(substr_compare("abcde", "abc", $v, $v));
-var_dump(stripos("abcde", "abc", $v));
-var_dump(substr_count("abcde", "abc", $v, 1));
+try {
+ stripos("abcde", "abc", $v);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+try {
+ substr_count("abcde", "abc", $v, 1);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
var_dump(substr_count("abcde", "abc", 1, $v));
-var_dump(strpos("abcde", "abc", $v));
-var_dump(stripos("abcde", "abc", $v));
-var_dump(strrpos("abcde", "abc", $v));
-var_dump(strripos("abcde", "abc", $v));
+
+try {
+ strpos("abcde", "abc", $v);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+try {
+ stripos("abcde", "abc", $v);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+try {
+ strrpos("abcde", "abc", $v);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+try {
+ strripos("abcde", "abc", $v);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
var_dump(strncmp("abcde", "abc", $v));
var_dump(chunk_split("abcde", $v, "abc"));
var_dump(substr("abcde", $v, $v));
@@ -31,33 +67,19 @@ string(4) "bcde"
string(6) "abcdex"
bool(false)
bool(false)
-
-Warning: substr_count(): Offset not contained in string in %s on line %d
-bool(false)
+Offset not contained in string
Warning: substr_compare(): The start position cannot exceed initial string length in %s on line %d
bool(false)
-
-Warning: stripos(): Offset not contained in string in %s on line %d
-bool(false)
-
-Warning: substr_count(): Offset not contained in string in %s on line %d
-bool(false)
+Offset not contained in string
+Offset not contained in string
Warning: substr_count(): Invalid length value in %s on line %d
bool(false)
-
-Warning: strpos(): Offset not contained in string in %s on line %d
-bool(false)
-
-Warning: stripos(): Offset not contained in string in %s on line %d
-bool(false)
-
-Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
-bool(false)
-
-Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d
-bool(false)
+Offset not contained in string
+Offset not contained in string
+Offset not contained in string
+Offset not contained in string
int(2)
string(8) "abcdeabc"
bool(false)
diff --git a/ext/standard/tests/strings/bug44703.phpt b/ext/standard/tests/strings/bug44703.phpt
index 6171cee923..f9f0e6ea8f 100644
--- a/ext/standard/tests/strings/bug44703.phpt
+++ b/ext/standard/tests/strings/bug44703.phpt
@@ -22,25 +22,25 @@ var_dump(htmlspecialchars("<>", ENT_COMPAT, str_repeat('a', 100)));
?>
--EXPECTF--
-Warning: htmlspecialchars(): charset `1' not supported, assuming utf-8 in %s on line %d
+Warning: htmlspecialchars(): Charset `1' not supported, assuming utf-8 in %s on line %d
string(35) "&lt;a href='test'&gt;Test&lt;/a&gt;"
-Warning: htmlspecialchars(): charset `12' not supported, assuming utf-8 in %s on line %d
+Warning: htmlspecialchars(): Charset `12' not supported, assuming utf-8 in %s on line %d
string(35) "&lt;a href='test'&gt;Test&lt;/a&gt;"
-Warning: htmlspecialchars(): charset `125' not supported, assuming utf-8 in %s on line %d
+Warning: htmlspecialchars(): Charset `125' not supported, assuming utf-8 in %s on line %d
string(35) "&lt;a href='test'&gt;Test&lt;/a&gt;"
string(35) "&lt;a href='test'&gt;Test&lt;/a&gt;"
-Warning: htmlspecialchars(): charset `12526' not supported, assuming utf-8 in %s on line %d
+Warning: htmlspecialchars(): Charset `12526' not supported, assuming utf-8 in %s on line %d
string(35) "&lt;a href='test'&gt;Test&lt;/a&gt;"
string(8) "&lt;&gt;"
-Warning: htmlspecialchars(): charset `8666' not supported, assuming utf-8 in %s on line %d
+Warning: htmlspecialchars(): Charset `8666' not supported, assuming utf-8 in %s on line %d
string(8) "&lt;&gt;"
string(8) "&lt;&gt;"
string(8) "&lt;&gt;"
string(8) "&lt;&gt;"
-Warning: htmlspecialchars(): charset `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' not supported, assuming utf-8 in %s on line %d
+Warning: htmlspecialchars(): Charset `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' not supported, assuming utf-8 in %s on line %d
string(8) "&lt;&gt;"
diff --git a/ext/standard/tests/strings/bug45166.phpt b/ext/standard/tests/strings/bug45166.phpt
index 7140f762ca..2ed07b62f8 100644
--- a/ext/standard/tests/strings/bug45166.phpt
+++ b/ext/standard/tests/strings/bug45166.phpt
@@ -2,9 +2,7 @@
Bug #45166 (substr() )
--FILE--
<?php
- echo substr('cd', -3) . "\n";
+ echo substr('cd', -3) . "\n";
?>
-===DONE===
--EXPECT--
cd
-===DONE===
diff --git a/ext/standard/tests/strings/bug48709.phpt b/ext/standard/tests/strings/bug48709.phpt
index 6a93b8dae4..9e0789a61f 100644
--- a/ext/standard/tests/strings/bug48709.phpt
+++ b/ext/standard/tests/strings/bug48709.phpt
@@ -5,18 +5,18 @@ Bug #48709 (metaphone and 'wh')
/* Initial letter exceptions */
$exceptions = array(
- 'kn', // Drop first letter
- 'gn', // ditto
- 'pn', // ditto
- 'ae', // ditto
- 'wr', // ditto
- 'x', // s
- 'wh', // w
- 'wa' // w
+ 'kn', // Drop first letter
+ 'gn', // ditto
+ 'pn', // ditto
+ 'ae', // ditto
+ 'wr', // ditto
+ 'x', // s
+ 'wh', // w
+ 'wa' // w
);
foreach ($exceptions as $letter) {
- printf("%s => %s\n", $letter, metaphone($letter));
+ printf("%s => %s\n", $letter, metaphone($letter));
}
?>
diff --git a/ext/standard/tests/strings/bug54238.phpt b/ext/standard/tests/strings/bug54238.phpt
index 0f60098ff0..e679bb6928 100644
--- a/ext/standard/tests/strings/bug54238.phpt
+++ b/ext/standard/tests/strings/bug54238.phpt
@@ -1,7 +1,5 @@
--TEST--
Bug #54238 (use-after-free in substr_replace())
---INI--
-error_reporting=E_ALL&~E_NOTICE
--FILE--
<?php
$f = array(array('A', 'A'));
@@ -9,7 +7,10 @@ $f = array(array('A', 'A'));
$z = substr_replace($f, $f, $f, 1);
var_dump($z, $f);
?>
---EXPECT--
+--EXPECTF--
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
array(1) {
[0]=>
string(9) "AArrayray"
diff --git a/ext/standard/tests/strings/bug54322.phpt b/ext/standard/tests/strings/bug54322.phpt
index 6b8d10daa7..f31f94fd84 100644
--- a/ext/standard/tests/strings/bug54322.phpt
+++ b/ext/standard/tests/strings/bug54322.phpt
@@ -2,9 +2,11 @@
Bug #54322: Null pointer deref in get_html_translation_table due to information loss in long-to-int conversion
--FILE--
<?php
-var_dump(
-get_html_translation_table(NAN, 0, "UTF-8") > 0
-);
---EXPECTF--
-Warning: get_html_translation_table() expects parameter 1 to be int, float given in %s on line %d
-bool(false)
+try {
+ var_dump(get_html_translation_table(NAN, 0, "UTF-8") > 0);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+?>
+--EXPECT--
+get_html_translation_table() expects parameter 1 to be int, float given
diff --git a/ext/standard/tests/strings/bug55871.phpt b/ext/standard/tests/strings/bug55871.phpt
index 0c8fd4c6e6..60a857ec67 100644
--- a/ext/standard/tests/strings/bug55871.phpt
+++ b/ext/standard/tests/strings/bug55871.phpt
@@ -3,15 +3,15 @@ Bug #55871 (Interruption in substr_replace()) (PHP7)
--FILE--
<?php
class test1 {
- public function __toString() {
- preg_match('//', '', $GLOBALS['my_var']);
- return '';
- }
+ public function __toString() {
+ preg_match('//', '', $GLOBALS['my_var']);
+ return '';
+ }
}
class test2 {
public function __toString() {
- $GLOBALS['my_var'] += 0x08048000;
+ $GLOBALS['my_var'] += 0x08048000;
return '';
}
}
diff --git a/ext/standard/tests/strings/bug61116.phpt b/ext/standard/tests/strings/bug61116.phpt
index b9b38a7bbb..a21ac519b5 100644
--- a/ext/standard/tests/strings/bug61116.phpt
+++ b/ext/standard/tests/strings/bug61116.phpt
@@ -9,18 +9,20 @@ echo new ReflectionFunction('get_html_translation_table'), "\n";
Function [ <internal:standard> function htmlspecialchars ] {
- Parameters [4] {
- Parameter #0 [ <required> $string ]
- Parameter #1 [ <optional> $quote_style ]
- Parameter #2 [ <optional> $encoding ]
- Parameter #3 [ <optional> $double_encode ]
+ Parameter #0 [ <required> string $string ]
+ Parameter #1 [ <optional> int $quote_style ]
+ Parameter #2 [ <optional> ?string $encoding ]
+ Parameter #3 [ <optional> bool $double_encode ]
}
+ - Return [ string ]
}
Function [ <internal:standard> function get_html_translation_table ] {
- Parameters [3] {
- Parameter #0 [ <optional> $table ]
- Parameter #1 [ <optional> $quote_style ]
- Parameter #2 [ <optional> $encoding ]
+ Parameter #0 [ <optional> int $table ]
+ Parameter #1 [ <optional> int $quote_style ]
+ Parameter #2 [ <optional> string $encoding ]
}
+ - Return [ array ]
}
diff --git a/ext/standard/tests/strings/bug62462.phpt b/ext/standard/tests/strings/bug62462.phpt
index c6eb41a543..5596a42bdd 100644
--- a/ext/standard/tests/strings/bug62462.phpt
+++ b/ext/standard/tests/strings/bug62462.phpt
@@ -5,7 +5,6 @@ Multibyte characters shouldn't be split by soft line break added by quoted_print
echo quoted_printable_encode(str_repeat("\xc4\x85", 77));
?>
-==DONE==
--EXPECT--
=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=
=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=
@@ -14,4 +13,3 @@ echo quoted_printable_encode(str_repeat("\xc4\x85", 77));
=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=
=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=
=C4=85=C4=85=C4=85=C4=85=C4=85
-==DONE==
diff --git a/ext/standard/tests/strings/bug63943.phpt b/ext/standard/tests/strings/bug63943.phpt
deleted file mode 100644
index 6018879b24..0000000000
--- a/ext/standard/tests/strings/bug63943.phpt
+++ /dev/null
@@ -1,8 +0,0 @@
---TEST--
-Bug #63943 (Bad warning text from strpos() on empty needle)
---FILE--
-<?php
-strpos("lllllll", '');
-?>
---EXPECTF--
-Warning: strpos(): Empty needle in %sbug63943.php on line %d
diff --git a/ext/standard/tests/strings/bug65230.phpt b/ext/standard/tests/strings/bug65230.phpt
index 4363462934..1efcc6cf2e 100644
--- a/ext/standard/tests/strings/bug65230.phpt
+++ b/ext/standard/tests/strings/bug65230.phpt
@@ -13,16 +13,16 @@ date.timezone=Europe/Berlin
function test($locale, $value)
{
- $newlocale = setlocale(LC_ALL, $locale);
- $conv = localeconv();
- $sep = $conv['decimal_point'];
+ $newlocale = setlocale(LC_ALL, $locale);
+ $conv = localeconv();
+ $sep = $conv['decimal_point'];
- printf("%s\n--------------------------\n", $newlocale);
- printf(" sep: %s\n", $sep);
- printf(" %%f: %f\n", $value);
- printf(" %%F: %F\n", $value);
- printf("date: %s\n", strftime('%x', mktime(0, 0, 0, 12, 5, 2014)));
- printf("\n");
+ printf("%s\n--------------------------\n", $newlocale);
+ printf(" sep: %s\n", $sep);
+ printf(" %%f: %f\n", $value);
+ printf(" %%F: %F\n", $value);
+ printf("date: %s\n", strftime('%x', mktime(0, 0, 0, 12, 5, 2014)));
+ printf("\n");
}
test('german', 3.41);
diff --git a/ext/standard/tests/strings/bug65769.phpt b/ext/standard/tests/strings/bug65769.phpt
index efe5788ce4..31656ee60f 100644
--- a/ext/standard/tests/strings/bug65769.phpt
+++ b/ext/standard/tests/strings/bug65769.phpt
@@ -15,21 +15,21 @@ if (PHP_WINDOWS_VERSION_MAJOR < 10) {
$locales = array('sve', 'french', 'us', 'ru', 'czech', 'serbian');
foreach ($locales as $locale) {
- $locale = setlocale(LC_ALL, $locale);
- $lconv = localeconv();
- var_dump(
- $locale,
- $lconv['decimal_point'],
- $lconv['thousands_sep'],
- $lconv['int_curr_symbol'],
- $lconv['currency_symbol'],
- $lconv['mon_decimal_point'],
- $lconv['mon_thousands_sep']
- );
- if ($locale === 'Swedish_Sweden.1252') {
- var_dump(in_array($lconv['mon_thousands_sep'], ['.', ' ']));
- }
- echo '++++++++++++++++++++++', "\n";
+ $locale = setlocale(LC_ALL, $locale);
+ $lconv = localeconv();
+ var_dump(
+ $locale,
+ $lconv['decimal_point'],
+ $lconv['thousands_sep'],
+ $lconv['int_curr_symbol'],
+ $lconv['currency_symbol'],
+ $lconv['mon_decimal_point'],
+ $lconv['mon_thousands_sep']
+ );
+ if ($locale === 'Swedish_Sweden.1252') {
+ var_dump(in_array($lconv['mon_thousands_sep'], ['.', ' ']));
+ }
+ echo '++++++++++++++++++++++', "\n";
}
?>
diff --git a/ext/standard/tests/strings/bug65947.phpt b/ext/standard/tests/strings/bug65947.phpt
index ff7dbf4b8c..3ffecf3cac 100644
--- a/ext/standard/tests/strings/bug65947.phpt
+++ b/ext/standard/tests/strings/bug65947.phpt
@@ -8,8 +8,8 @@ $csv = base64_decode('6Q==');
$adata = str_getcsv($csv,";");
$b2 = basename($filename);
if ($filename != $b2)
- print "BUG";
+ print "BUG";
else
- print "OKEY";
+ print "OKEY";
--EXPECT--
OKEY
diff --git a/ext/standard/tests/strings/bug68996.phpt b/ext/standard/tests/strings/bug68996.phpt
index 3f1e6c4929..bd5be022fd 100644
--- a/ext/standard/tests/strings/bug68996.phpt
+++ b/ext/standard/tests/strings/bug68996.phpt
@@ -8,4 +8,4 @@ fopen("\xfc\x63", "r");
?>
--EXPECTF--
<br />
-<b>Warning</b>: : failed to open stream: No such file or directory in <b>%sbug68996.php</b> on line <b>%d</b><br />
+<b>Warning</b>: : Failed to open stream: No such file or directory in <b>%sbug68996.php</b> on line <b>%d</b><br />
diff --git a/ext/standard/tests/strings/bug69522.phpt b/ext/standard/tests/strings/bug69522.phpt
index fc86d409c6..8df13e699c 100644
--- a/ext/standard/tests/strings/bug69522.phpt
+++ b/ext/standard/tests/strings/bug69522.phpt
@@ -5,7 +5,5 @@ Bug #69522 (heap buffer overflow in unpack())
$a = pack("AAAAAAAAAAAA", 1,2,3,4,5,6,7,8,9,10,11,12);
$b = unpack('h2147483648', $a);
?>
-===DONE===
--EXPECTF--
Warning: unpack(): Type h: integer overflow in %s on line %d
-===DONE===
diff --git a/ext/standard/tests/strings/bug70720.phpt b/ext/standard/tests/strings/bug70720.phpt
index d7f64e0874..cdfa4794e6 100644
--- a/ext/standard/tests/strings/bug70720.phpt
+++ b/ext/standard/tests/strings/bug70720.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #70720 (strip_tags() doesnt handle "xml" correctly)
+Bug #70720 (strip_tags() doesn't handle "xml" correctly)
--FILE--
<?php
var_dump(strip_tags('<?php $dom->test(); ?> this is a test'));
diff --git a/ext/standard/tests/strings/bug71969.phpt b/ext/standard/tests/strings/bug71969.phpt
index aafceb09ad..9795186e15 100644
--- a/ext/standard/tests/strings/bug71969.phpt
+++ b/ext/standard/tests/strings/bug71969.phpt
@@ -3,13 +3,13 @@ Bug #71969 (str_replace returns an incorrect resulting array after a foreach by
--FILE--
<?php
$a = array(
- array("one" => array("a"=>"0000", "b"=>"1111")),
+ array("one" => array("a"=>"0000", "b"=>"1111")),
);
//foreach by reference, changing the array value
foreach($a as &$record)
{
- $record["one"]["a"] = "2222";
+ $record["one"]["a"] = "2222";
}
var_dump(str_replace("2", "3", $a));
?>
diff --git a/ext/standard/tests/strings/bug72663_3.phpt b/ext/standard/tests/strings/bug72663_3.phpt
index 3b949b0239..d8be463887 100644
--- a/ext/standard/tests/strings/bug72663_3.phpt
+++ b/ext/standard/tests/strings/bug72663_3.phpt
@@ -3,10 +3,10 @@ Bug #72663: Create an Unexpected Object and Don't Invoke __wakeup() in Deseriali
--FILE--
<?php
class obj {
- var $ryat;
- function __wakeup() {
- $this->ryat = str_repeat('A', 0x112);
- }
+ var $ryat;
+ function __wakeup() {
+ $this->ryat = str_repeat('A', 0x112);
+ }
}
$poc = 'O:8:"stdClass":1:{i:0;O:3:"obj":1:{s:4:"ryat";R:1;';
diff --git a/ext/standard/tests/strings/bug72823.phpt b/ext/standard/tests/strings/bug72823.phpt
index d0aaf0fd35..1571fdc7b5 100644
--- a/ext/standard/tests/strings/bug72823.phpt
+++ b/ext/standard/tests/strings/bug72823.phpt
@@ -6,7 +6,5 @@ var_dump(
strtr(11, array('aaa' => 'bbb'))
);
?>
-===DONE===
--EXPECT--
string(2) "11"
-===DONE===
diff --git a/ext/standard/tests/strings/bug77439.phpt b/ext/standard/tests/strings/bug77439.phpt
index ee8a3d2845..98ae56222b 100644
--- a/ext/standard/tests/strings/bug77439.phpt
+++ b/ext/standard/tests/strings/bug77439.phpt
@@ -2,12 +2,11 @@
Bug #77439: parse_str segfaults when inserting item into existing array
--FILE--
<?php
-$a = [];
-parse_str('a[1]=1');
-var_dump($a);
+$vars = ['a' => []];
+parse_str('a[1]=1', $vars);
+var_dump($vars['a']);
?>
---EXPECTF--
-Deprecated: parse_str(): Calling parse_str() without the result argument is deprecated in %s on line %d
+--EXPECT--
array(1) {
[1]=>
string(1) "1"
diff --git a/ext/standard/tests/strings/bug78003.phpt b/ext/standard/tests/strings/bug78003.phpt
index 4379ca8a71..2420191f98 100644
--- a/ext/standard/tests/strings/bug78003.phpt
+++ b/ext/standard/tests/strings/bug78003.phpt
@@ -8,9 +8,7 @@ var_dump(
strip_tags('<foo<?>bar>')
);
?>
-===DONE===
--EXPECT--
string(0) ""
string(0) ""
string(0) ""
-===DONE===
diff --git a/ext/standard/tests/strings/bug78612.phpt b/ext/standard/tests/strings/bug78612.phpt
index 7dad605e80..13fb324052 100644
--- a/ext/standard/tests/strings/bug78612.phpt
+++ b/ext/standard/tests/strings/bug78612.phpt
@@ -8,7 +8,7 @@ $_a = 7111222333000001;
$_b = 5000001;
for ($j=0; $j<10; $j++) {
- $find_replace[$_a + $j] = $_b + $j;
+ $find_replace[$_a + $j] = $_b + $j;
}
echo strtr('Hello', $find_replace), "\n";
diff --git a/ext/standard/tests/strings/chop_variation3.phpt b/ext/standard/tests/strings/chop_variation3.phpt
index 36f81d34c8..1a4568dc28 100644
--- a/ext/standard/tests/strings/chop_variation3.phpt
+++ b/ext/standard/tests/strings/chop_variation3.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/chop_variation4.phpt b/ext/standard/tests/strings/chop_variation4.phpt
index 628c87cbce..192e07aa3a 100644
--- a/ext/standard/tests/strings/chop_variation4.phpt
+++ b/ext/standard/tests/strings/chop_variation4.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/chr_basic.phpt b/ext/standard/tests/strings/chr_basic.phpt
index e072febcff..ec80d76213 100644
--- a/ext/standard/tests/strings/chr_basic.phpt
+++ b/ext/standard/tests/strings/chr_basic.phpt
@@ -15,9 +15,7 @@ echo chr(10); // "\n"
echo "World";
echo "\n";
?>
-===DONE===
--EXPECT--
*** Testing chr() : basic functionality ***
Hello
World
-===DONE===
diff --git a/ext/standard/tests/strings/chr_error.phpt b/ext/standard/tests/strings/chr_error.phpt
index 4d595543bb..2603b69210 100644
--- a/ext/standard/tests/strings/chr_error.phpt
+++ b/ext/standard/tests/strings/chr_error.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/chr_variation1.phpt b/ext/standard/tests/strings/chr_variation1.phpt
index c962aa0e78..fbf8e21f49 100644
--- a/ext/standard/tests/strings/chr_variation1.phpt
+++ b/ext/standard/tests/strings/chr_variation1.phpt
@@ -27,31 +27,31 @@ $file_handle = fopen(__FILE__, "r");
// array with different values for $input
$inputs = array (
- // integer values
+ // integer values
/*1*/ 0,
- 1,
- 255,
- 256,
+ 1,
+ 255,
+ 256,
- // float values
+ // float values
/*5*/ 10.5,
- -20.5,
- 1.1234e6,
+ -20.5,
+ 1.1234e6,
- // boolean values
+ // boolean values
/*11*/ true,
- false,
- TRUE,
- FALSE,
+ false,
+ TRUE,
+ FALSE,
- // null values
+ // null values
/*15*/ NULL,
- null,
+ null,
- // undefined variable
+ // undefined variable
/*19*/ @$undefined_var,
- // unset variable
+ // unset variable
/*20*/ @$unset_var
);
@@ -66,7 +66,6 @@ foreach($inputs as $input) {
fclose($file_handle); //closing the file handle
?>
-===DONE===
--EXPECT--
*** Testing chr() function: with unexpected inputs for 'ascii' argument ***
-- Iteration 1 --
@@ -99,4 +98,3 @@ string(2) "00"
string(2) "00"
-- Iteration 15 --
string(2) "00"
-===DONE===
diff --git a/ext/standard/tests/strings/chunk_split.phpt b/ext/standard/tests/strings/chunk_split.phpt
index 648388f23a..a2696cd26b 100644
--- a/ext/standard/tests/strings/chunk_split.phpt
+++ b/ext/standard/tests/strings/chunk_split.phpt
@@ -7,17 +7,6 @@ echo chunk_split('foooooooooooooooo', 5)."\n";
echo chunk_split(str_repeat('X', 2*76))."\n";
echo chunk_split("test", 10, "|end") . "\n";
-$a=str_repeat("B", 65535);
-$b=1;
-$c=str_repeat("B", 65535);
-var_dump(chunk_split($a,$b,$c));
-
-$a=str_repeat("B", 65537);
-$b=1;
-$c=str_repeat("B", 65537);
-var_dump(chunk_split($a,$b,$c));
-
-
?>
--EXPECT--
a-b-c-
@@ -30,5 +19,3 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
test|end
-bool(false)
-bool(false)
diff --git a/ext/standard/tests/strings/chunk_split_variation1_32bit.phpt b/ext/standard/tests/strings/chunk_split_variation1_32bit.phpt
new file mode 100644
index 0000000000..f9825eb438
--- /dev/null
+++ b/ext/standard/tests/strings/chunk_split_variation1_32bit.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Test chunk_split() function : usage variations - unexpected large '$end' string argument variation 1
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+if (getenv("USE_ZEND_ALLOC") === "0") die("skip ZMM is disabled");
+?>
+--FILE--
+<?php
+/* Prototype : string chunk_split(string $str [, int $chunklen [, string $ending]])
+ * Description: Returns split line
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+echo "*** Testing chunk_split() : unexpected large 'end' string argument variation 1 ***\n";
+
+$a=str_repeat("B", 65535);
+$b=1;
+$c=str_repeat("B", 65535);
+var_dump(chunk_split($a,$b,$c));
+?>
+--EXPECTF--
+*** Testing chunk_split() : unexpected large 'end' string argument variation 1 ***
+
+Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %s on line %d
diff --git a/ext/standard/tests/strings/chunk_split_variation2_32bit.phpt b/ext/standard/tests/strings/chunk_split_variation2_32bit.phpt
new file mode 100644
index 0000000000..ca0948d999
--- /dev/null
+++ b/ext/standard/tests/strings/chunk_split_variation2_32bit.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Test chunk_split() function : usage variations - unexpected large '$end' string argument variation 2
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string chunk_split(string $str [, int $chunklen [, string $ending]])
+ * Description: Returns split line
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+echo "*** Testing chunk_split() : unexpected large 'end' string argument variation 2 ***\n";
+
+$a=str_repeat("B", 65537);
+$b=1;
+$c=str_repeat("B", 65537);
+var_dump(chunk_split($a,$b,$c));
+?>
+--EXPECTF--
+*** Testing chunk_split() : unexpected large 'end' string argument variation 2 ***
+
+Fatal error: Possible integer overflow in memory allocation (65537 * 65537 + 65556) in %s on line %d
diff --git a/ext/standard/tests/strings/chunk_split_variation3.phpt b/ext/standard/tests/strings/chunk_split_variation3.phpt
new file mode 100644
index 0000000000..3992e212d5
--- /dev/null
+++ b/ext/standard/tests/strings/chunk_split_variation3.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test chunk_split() function : usage variations - unexpected large number of chunks
+--SKIPIF--
+<?php
+if (getenv("USE_ZEND_ALLOC") === "0") die("skip ZMM is disabled");
+?>
+--FILE--
+<?php
+/* Prototype : string chunk_split(string $str [, int $chunklen [, string $ending]])
+ * Description: Returns split line
+ * Source code: ext/standard/string.c
+ * Alias to functions: none
+*/
+
+$chunk_length = 1;
+
+echo "*** Testing chunk_split() : unexpected large 'end' string argument variation 2 ***\n";
+
+echo "Body generation\n";
+$body = str_repeat("Hello", 10000000);
+
+echo "Using chunk_split()\n";
+var_dump(chunk_split($body, $chunk_length));
+?>
+--EXPECTF--
+*** Testing chunk_split() : unexpected large 'end' string argument variation 2 ***
+Body generation
+Using chunk_split()
+
+Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %s on line %d
diff --git a/ext/standard/tests/strings/chunk_split_variation5.phpt b/ext/standard/tests/strings/chunk_split_variation5.phpt
index 8a5a8cd6bb..bfcaa54e26 100644
--- a/ext/standard/tests/strings/chunk_split_variation5.phpt
+++ b/ext/standard/tests/strings/chunk_split_variation5.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/chunk_split_variation8.phpt b/ext/standard/tests/strings/chunk_split_variation8.phpt
index bfafd1af0b..74b41ede03 100644
--- a/ext/standard/tests/strings/chunk_split_variation8.phpt
+++ b/ext/standard/tests/strings/chunk_split_variation8.phpt
@@ -46,26 +46,27 @@ $values = array (
// loop through each element of values for 'chunklen'
for($count = 0; $count < count($values); $count++) {
echo "-- Iteration ".($count+1). " --\n";
- var_dump( chunk_split($heredoc_str, $values[$count], $ending) );
+ try {
+ var_dump( chunk_split($heredoc_str, $values[$count], $ending) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ } catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+ }
}
-echo "Done"
?>
---EXPECTF--
+--EXPECT--
*** Testing chunk_split() : different 'chunklen' with heredoc 'str' ***
-- Iteration 1 --
-
-Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d
-bool(false)
+Chunk length should be greater than zero
-- Iteration 2 --
string(504) "T:::h:::i:::s:::':::s::: :::h:::e:::r:::e:::d:::o:::c::: :::s:::t:::r:::i:::n:::g::: :::w:::i:::t:::h::: ::: ::: :::a:::n:::d::: :::
::: :::w:::h:::i:::t:::e::: :::s:::p:::a:::c:::e::: :::c:::h:::a:::r:::.:::
:::I:::t::: :::h:::a:::s::: :::_:::s:::p:::e:::c:::i:::@:::l::: :::c:::h:::@:::r:::$::: :::2:::2:::2:::2::: :::!:::!:::!:::N:::o:::w::: :::\:::k::: :::a:::s::: :::e:::s:::c:::a:::p:::e::: :::c:::h:::a:::r::: :::t:::o::: :::t:::e:::s:::t:::
:::c:::h:::u:::n:::k:::_:::s:::p:::l:::i:::t:::(:::):::"
-- Iteration 3 --
-
-Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d
-bool(false)
+Chunk length should be greater than zero
-- Iteration 4 --
string(129) "This's heredoc string with and
white space char.
@@ -82,11 +83,6 @@ string(129) "This's heredoc string with and
It has _speci@l ch@r$ 2222 !!!Now \k as escape char to test
chunk_split():::"
-- Iteration 7 --
-
-Warning: chunk_split() expects parameter 2 to be int, float given in %s on line %d
-NULL
+chunk_split() expects parameter 2 to be int, float given
-- Iteration 8 --
-
-Warning: chunk_split(): Chunk length should be greater than zero in %s on line %d
-bool(false)
-Done
+Chunk length should be greater than zero
diff --git a/ext/standard/tests/strings/convert_cyr_string.phpt b/ext/standard/tests/strings/convert_cyr_string.phpt
deleted file mode 100644
index 01bd0f50fc..0000000000
--- a/ext/standard/tests/strings/convert_cyr_string.phpt
+++ /dev/null
@@ -1,56 +0,0 @@
---TEST--
-basic convert_cyr_string() tests
---FILE--
-<?php
-
-var_dump(convert_cyr_string("", "", ""));
-var_dump(convert_cyr_string(array(), array(), array()));
-
-var_dump(convert_cyr_string("[[[[[[", "q", "m"));
-var_dump(convert_cyr_string("[[[[[[", "k", "w"));
-var_dump(convert_cyr_string("[[[[[[", "m", "a"));
-var_dump(convert_cyr_string("[[[[[[", "d", "i"));
-var_dump(convert_cyr_string("[[[[[[", "w", "k"));
-var_dump(convert_cyr_string("[[[[[[", "i", "q"));
-var_dump(convert_cyr_string("", "d", "i"));
-
-echo "Done\n";
-?>
---EXPECTF--
-Deprecated: Function convert_cyr_string() is deprecated in %s on line %d
-
-Warning: convert_cyr_string(): Unknown source charset: in %s on line %d
-
-Warning: convert_cyr_string(): Unknown destination charset: in %s on line %d
-string(0) ""
-
-Deprecated: Function convert_cyr_string() is deprecated in %s on line %d
-
-Warning: convert_cyr_string() expects parameter 1 to be string, array given in %s on line %d
-NULL
-
-Deprecated: Function convert_cyr_string() is deprecated in %s on line %d
-
-Warning: convert_cyr_string(): Unknown source charset: q in %s on line %d
-string(6) "[[[[[["
-
-Deprecated: Function convert_cyr_string() is deprecated in %s on line %d
-string(6) "[[[[[["
-
-Deprecated: Function convert_cyr_string() is deprecated in %s on line %d
-string(6) "[[[[[["
-
-Deprecated: Function convert_cyr_string() is deprecated in %s on line %d
-string(6) "[[[[[["
-
-Deprecated: Function convert_cyr_string() is deprecated in %s on line %d
-string(6) "[[[[[["
-
-Deprecated: Function convert_cyr_string() is deprecated in %s on line %d
-
-Warning: convert_cyr_string(): Unknown destination charset: q in %s on line %d
-string(6) "[[[[[["
-
-Deprecated: Function convert_cyr_string() is deprecated in %s on line %d
-string(0) ""
-Done
diff --git a/ext/standard/tests/strings/convert_cyr_string_basic.phpt b/ext/standard/tests/strings/convert_cyr_string_basic.phpt
deleted file mode 100644
index f4c7f69918..0000000000
--- a/ext/standard/tests/strings/convert_cyr_string_basic.phpt
+++ /dev/null
@@ -1,169 +0,0 @@
---TEST--
-Test convert_cyr_string() function : basic functionality
---FILE--
-<?php
-
-/* Prototype : string convert_cyr_string ( string $str , string $from , string $to )
- * Description: Convert from one Cyrillic character set to another
- * Source code: ext/standard/string.c
-*/
-
-echo "*** Testing convert_cyr_string() : basic functionality ***\n";
-
-$str = "Convert from one Cyrillic character set to another.";
-
-echo "\n-- First try some simple English text --\n";
-var_dump(bin2hex(convert_cyr_string($str, 'w', 'k')));
-var_dump(bin2hex(convert_cyr_string($str, 'w', 'i')));
-
-
-echo "\n-- Now try some of characters in 128-255 range --\n";
-
-for ($i = 128; $i < 256; $i++) {
- $str = chr($i);
- echo "$i: " . bin2hex(@convert_cyr_string($str, 'w', 'k')) . "\n";
-}
-
-?>
-===DONE===
---EXPECTF--
-*** Testing convert_cyr_string() : basic functionality ***
-
--- First try some simple English text --
-
-Deprecated: Function convert_cyr_string() is deprecated in %s on line %d
-string(102) "436f6e766572742066726f6d206f6e6520437972696c6c6963206368617261637465722073657420746f20616e6f746865722e"
-
-Deprecated: Function convert_cyr_string() is deprecated in %s on line %d
-string(102) "436f6e766572742066726f6d206f6e6520437972696c6c6963206368617261637465722073657420746f20616e6f746865722e"
-
--- Now try some of characters in 128-255 range --
-128: 2e
-129: 2e
-130: 2e
-131: 2e
-132: 2e
-133: 2e
-134: 2e
-135: 2e
-136: 2e
-137: 2e
-138: 2e
-139: 2e
-140: 2e
-141: 2e
-142: 2e
-143: 2e
-144: 2e
-145: 2e
-146: 2e
-147: 2e
-148: 2e
-149: 2e
-150: 2e
-151: 2e
-152: 2e
-153: 2e
-154: 2e
-155: 2e
-156: 2e
-157: 2e
-158: 2e
-159: 2e
-160: 9a
-161: ae
-162: be
-163: 2e
-164: 9f
-165: bd
-166: 2e
-167: 2e
-168: b3
-169: bf
-170: b4
-171: 9d
-172: 2e
-173: 2e
-174: 9c
-175: b7
-176: 2e
-177: 2e
-178: b6
-179: a6
-180: ad
-181: 2e
-182: 2e
-183: 9e
-184: a3
-185: 98
-186: a4
-187: 9b
-188: 2e
-189: 2e
-190: 2e
-191: a7
-192: e1
-193: e2
-194: f7
-195: e7
-196: e4
-197: e5
-198: f6
-199: fa
-200: e9
-201: ea
-202: eb
-203: ec
-204: ed
-205: ee
-206: ef
-207: f0
-208: f2
-209: f3
-210: f4
-211: f5
-212: e6
-213: e8
-214: e3
-215: fe
-216: fb
-217: fd
-218: ff
-219: f9
-220: f8
-221: fc
-222: e0
-223: f1
-224: c1
-225: c2
-226: d7
-227: c7
-228: c4
-229: c5
-230: d6
-231: da
-232: c9
-233: ca
-234: cb
-235: cc
-236: cd
-237: ce
-238: cf
-239: d0
-240: d2
-241: d3
-242: d4
-243: d5
-244: c6
-245: c8
-246: c3
-247: de
-248: db
-249: dd
-250: df
-251: d9
-252: d8
-253: dc
-254: c0
-255: d1
-===DONE===
diff --git a/ext/standard/tests/strings/convert_cyr_string_error.phpt b/ext/standard/tests/strings/convert_cyr_string_error.phpt
deleted file mode 100644
index 0444183ba1..0000000000
--- a/ext/standard/tests/strings/convert_cyr_string_error.phpt
+++ /dev/null
@@ -1,54 +0,0 @@
---TEST--
-Test convert_cyr_string() function : error conditions
---FILE--
-<?php
-
-/* Prototype : string convert_cyr_string ( string $str , string $from , string $to )
- * Description: Convert from one Cyrillic character set to another
- * Source code: ext/standard/string.c
-*/
-
-$str = "hello";
-$from = "k";
-$to = "d";
-$extra_arg = 10;
-
-echo "*** Testing convert_cyr_string() : error conditions ***\n";
-
-echo "\n-- Testing convert_cyr_string() function with invalid 'from' character set --\n";
-var_dump(bin2hex( convert_cyr_string($str, "?", $to) ));
-
-echo "\n-- Testing convert_cyr_string() function with invalid 'to' character set --\n";
-var_dump(bin2hex( convert_cyr_string($str, $from, "?")) );
-
-echo "\n-- Testing convert_cyr_string() function with invalid 'from' and 'to' character set --\n";
-var_dump(bin2hex( convert_cyr_string($str, ">", "?")) );
-
-?>
-===DONE===
---EXPECTF--
-*** Testing convert_cyr_string() : error conditions ***
-
--- Testing convert_cyr_string() function with invalid 'from' character set --
-
-Deprecated: Function convert_cyr_string() is deprecated in %s on line %d
-
-Warning: convert_cyr_string(): Unknown source charset: ? in %s on line %d
-string(10) "68656c6c6f"
-
--- Testing convert_cyr_string() function with invalid 'to' character set --
-
-Deprecated: Function convert_cyr_string() is deprecated in %s on line %d
-
-Warning: convert_cyr_string(): Unknown destination charset: ? in %s on line %d
-string(10) "68656c6c6f"
-
--- Testing convert_cyr_string() function with invalid 'from' and 'to' character set --
-
-Deprecated: Function convert_cyr_string() is deprecated in %s on line %d
-
-Warning: convert_cyr_string(): Unknown source charset: > in %s on line %d
-
-Warning: convert_cyr_string(): Unknown destination charset: ? in %s on line %d
-string(10) "68656c6c6f"
-===DONE===
diff --git a/ext/standard/tests/strings/convert_uudecode_basic.phpt b/ext/standard/tests/strings/convert_uudecode_basic.phpt
index 963c163761..0c378bdb22 100644
--- a/ext/standard/tests/strings/convert_uudecode_basic.phpt
+++ b/ext/standard/tests/strings/convert_uudecode_basic.phpt
@@ -37,8 +37,8 @@ foreach($strings as $string) {
$decode = convert_uudecode($encode);
if ($decode != $string) {
- var_dump($encode, $decode, $string);
- exit("TEST FAILED on iteration $count\n");
+ var_dump($encode, $decode, $string);
+ exit("TEST FAILED on iteration $count\n");
}
$count ++;
@@ -47,8 +47,6 @@ foreach($strings as $string) {
echo "TEST PASSED\n";
?>
-===DONE===
--EXPECT--
*** Testing convert_uudecode() : basic functionality ***
TEST PASSED
-===DONE===
diff --git a/ext/standard/tests/strings/convert_uuencode_basic.phpt b/ext/standard/tests/strings/convert_uuencode_basic.phpt
index b8c338a1c6..8a4f57fa87 100644
--- a/ext/standard/tests/strings/convert_uuencode_basic.phpt
+++ b/ext/standard/tests/strings/convert_uuencode_basic.phpt
@@ -39,7 +39,6 @@ foreach($strings as $string) {
?>
-===DONE===
--EXPECTF--
*** Testing convert_uuencode() : basic functionality ***
-- Iteration 1 --
@@ -85,4 +84,3 @@ string(82) "M7'0@5&AI<R!3=')I;F<@8V]N=&%I;G,@7'1<="!S;VUE(&-O;G1R;VP@8VAA
+<F%C=&5R<UQR7&X`
`
"
-===DONE===
diff --git a/ext/standard/tests/strings/count_chars.phpt b/ext/standard/tests/strings/count_chars.phpt
index fe21b656f0..6199461174 100644
--- a/ext/standard/tests/strings/count_chars.phpt
+++ b/ext/standard/tests/strings/count_chars.phpt
@@ -4,7 +4,7 @@ count_chars() function
<?php
$s = "het leven is net erwtensoep - je kunt er geen touw aan vastknopen";
for($i=0; $i<3; $i++) {
- echo implode(count_chars($s, $i))."\n";
+ echo implode(count_chars($s, $i))."\n";
}
echo $a = count_chars($s, 3), "\n";
echo (int) strlen(count_chars($s, 4)) == 256-strlen($a),"\n";
diff --git a/ext/standard/tests/strings/count_chars_basic.phpt b/ext/standard/tests/strings/count_chars_basic.phpt
index c39889be15..c1868714b0 100644
--- a/ext/standard/tests/strings/count_chars_basic.phpt
+++ b/ext/standard/tests/strings/count_chars_basic.phpt
@@ -20,9 +20,13 @@ var_dump(count_chars($string, 2));
var_dump(count_chars($string, 3));
var_dump(bin2hex(count_chars($string, 4)));
+try {
+ count_chars($string, 5);
+} catch (ValueError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
-===DONE===
--EXPECT--
*** Testing count_chars() : basic functionality ***
array(256) {
@@ -1571,4 +1575,4 @@ array(238) {
}
string(18) " Rabcdefghimnorstu"
string(476) "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f2122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f5051535455565758595a5b5c5d5e5f606a6b6c7071767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff"
-===DONE===
+Unknown mode
diff --git a/ext/standard/tests/strings/crc32.phpt b/ext/standard/tests/strings/crc32.phpt
index e1b338f011..2fa8be59d8 100644
--- a/ext/standard/tests/strings/crc32.phpt
+++ b/ext/standard/tests/strings/crc32.phpt
@@ -4,7 +4,7 @@ crc32() function
<?php
$input = array("foo", "bar", "baz", "grldsajkopallkjasd");
foreach($input AS $i) {
- printf("%u\n", crc32($i));
+ printf("%u\n", crc32($i));
}
?>
--EXPECT--
diff --git a/ext/standard/tests/strings/crc32_variation3.phpt b/ext/standard/tests/strings/crc32_variation3.phpt
index 691703103e..bc219c43e9 100644
--- a/ext/standard/tests/strings/crc32_variation3.phpt
+++ b/ext/standard/tests/strings/crc32_variation3.phpt
@@ -77,9 +77,9 @@ echo "Done";
--EXPECTF--
*** Testing crc32() : with different strings in double quotes ***
-Notice: Undefined variable: hello in %s on line %d
+Warning: Undefined variable: hello in %s on line %d
-Notice: Undefined variable: world in %s on line %d
+Warning: Undefined variable: world in %s on line %d
-- Iteration 1 --
int(0)
diff --git a/ext/standard/tests/strings/crc32_variation4.phpt b/ext/standard/tests/strings/crc32_variation4.phpt
index f3f11972fb..6953994a74 100644
--- a/ext/standard/tests/strings/crc32_variation4.phpt
+++ b/ext/standard/tests/strings/crc32_variation4.phpt
@@ -74,7 +74,7 @@ $heredoc_strings = array(
$heredoc_with_alphanumerics,
$heredoc_with_embedded_nulls,
$heredoc_with_hexa_octal,
- $heredoc_with_long_string
+ $heredoc_with_long_string
);
// loop to test the function with each heredoc string in the array
diff --git a/ext/standard/tests/strings/crypt.phpt b/ext/standard/tests/strings/crypt.phpt
index f64b61cb5f..270f0372d1 100644
--- a/ext/standard/tests/strings/crypt.phpt
+++ b/ext/standard/tests/strings/crypt.phpt
@@ -19,8 +19,6 @@ echo (CRYPT_MD5) ? ((crypt($str, $salt3) === $res_3) ? 'MD5' : 'MD5 - ERROR
echo (CRYPT_BLOWFISH) ? ((crypt($str, $salt4) === $res_4) ? 'BLO' : 'BLO - ERROR') : 'BLO', "\n";
var_dump(crypt($str));
-var_dump(crypt());
-var_dump(crypt("", "", ""));
?>
--EXPECTF--
@@ -31,9 +29,3 @@ BLO
Notice: crypt(): No salt parameter was specified. You must use a randomly generated salt and a strong hash function to produce a secure hash. in %s on line %d
string(%d) "%s"
-
-Warning: crypt() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: crypt() expects at most 2 parameters, 3 given in %s on line %d
-NULL
diff --git a/ext/standard/tests/strings/crypt_blowfish.phpt b/ext/standard/tests/strings/crypt_blowfish.phpt
index 3af9cb77eb..a8eda72120 100644
--- a/ext/standard/tests/strings/crypt_blowfish.phpt
+++ b/ext/standard/tests/strings/crypt_blowfish.phpt
@@ -4,44 +4,44 @@ Official blowfish tests (http://cvsweb.openwall.com/cgi/cvsweb.cgi/Owl/packages/
<?php
$tests =array(
- array('$2a$05$CCCCCCCCCCCCCCCCCCCCC.E5YPO9kmyuRGyh0XouQYb4YMJKvyOeW', 'U*U'),
- array('$2a$05$CCCCCCCCCCCCCCCCCCCCC.VGOzA784oUp/Z0DY336zx7pLYAy0lwK', 'U*U*'),
- array('$2a$05$XXXXXXXXXXXXXXXXXXXXXOAcXxm9kjPGEMsLznoKqmqw7tc8WCx4a', 'U*U*U'),
- array('$2a$05$abcdefghijklmnopqrstuu5s2v8.iXieOjg/.AySBTTZIIVFJeBui', '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789chars after 72 are ignored'),
- array('$2x$05$/OK.fbVrR/bpIqNJ5ianF.CE5elHaaO4EbggVDjb8P19RukzXSM3e', "\xa3"),
- array('$2x$05$/OK.fbVrR/bpIqNJ5ianF.CE5elHaaO4EbggVDjb8P19RukzXSM3e', "\xff\xff\xa3"),
- array('$2y$05$/OK.fbVrR/bpIqNJ5ianF.CE5elHaaO4EbggVDjb8P19RukzXSM3e', "\xff\xff\xa3"),
- array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.nqd1wy.pTMdcvrRWxyiGL2eMz.2a85.', "\xff\xff\xa3"),
- array('$2b$05$/OK.fbVrR/bpIqNJ5ianF.CE5elHaaO4EbggVDjb8P19RukzXSM3e', "\xff\xff\xa3"),
- array('$2y$05$/OK.fbVrR/bpIqNJ5ianF.Sa7shbm4.OzKpvFnX1pQLmQW96oUlCq', "\xa3"),
- array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.Sa7shbm4.OzKpvFnX1pQLmQW96oUlCq', "\xa3"),
- array('$2b$05$/OK.fbVrR/bpIqNJ5ianF.Sa7shbm4.OzKpvFnX1pQLmQW96oUlCq', "\xa3"),
- array('$2x$05$/OK.fbVrR/bpIqNJ5ianF.o./n25XVfn6oAPaUvHe.Csk4zRfsYPi', "1\xa3345"),
- array('$2x$05$/OK.fbVrR/bpIqNJ5ianF.o./n25XVfn6oAPaUvHe.Csk4zRfsYPi', "\xff\xa3345"),
- array('$2x$05$/OK.fbVrR/bpIqNJ5ianF.o./n25XVfn6oAPaUvHe.Csk4zRfsYPi', "\xff\xa334\xff\xff\xff\xa3345"),
- array('$2y$05$/OK.fbVrR/bpIqNJ5ianF.o./n25XVfn6oAPaUvHe.Csk4zRfsYPi', "\xff\xa334\xff\xff\xff\xa3345"),
- array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.ZC1JEJ8Z4gPfpe1JOr/oyPXTWl9EFd.', "\xff\xa334\xff\xff\xff\xa3345"),
- array('$2y$05$/OK.fbVrR/bpIqNJ5ianF.nRht2l/HRhr6zmCp9vYUvvsqynflf9e', "\xff\xa3345"),
- array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.nRht2l/HRhr6zmCp9vYUvvsqynflf9e', "\xff\xa3345"),
- array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.6IflQkJytoRVc1yuaNtHfiuq.FRlSIS', "\xa3ab"),
- array('$2x$05$/OK.fbVrR/bpIqNJ5ianF.6IflQkJytoRVc1yuaNtHfiuq.FRlSIS', "\xa3ab"),
- array('$2y$05$/OK.fbVrR/bpIqNJ5ianF.6IflQkJytoRVc1yuaNtHfiuq.FRlSIS', "\xa3ab"),
- array('$2x$05$6bNw2HLQYeqHYyBfLMsv/OiwqTymGIGzFsA4hOTWebfehXHNprcAS', "\xd1\x91"),
- array('$2x$05$6bNw2HLQYeqHYyBfLMsv/O9LIGgn8OMzuDoHfof8AQimSGfcSWxnS', "\xd0\xc1\xd2\xcf\xcc\xd8"),
- array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.swQOIzjOiJ9GHEPuhEkvqrUyvWhEMx6', "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaachars after 72 are ignored as usual"),
- array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.R9xrDjiycxMbQE2bp.vgqlYpW5wx2yy', "\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55"),
- array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.9tQZzcJfm3uj2NvJ/n5xkhpqLrMpWCe', "\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff"),
- array('$2a$05$CCCCCCCCCCCCCCCCCCCCC.7uG0VCzI2bS7j6ymqJi9CdcdxiRTWNy', ''),
+ array('$2a$05$CCCCCCCCCCCCCCCCCCCCC.E5YPO9kmyuRGyh0XouQYb4YMJKvyOeW', 'U*U'),
+ array('$2a$05$CCCCCCCCCCCCCCCCCCCCC.VGOzA784oUp/Z0DY336zx7pLYAy0lwK', 'U*U*'),
+ array('$2a$05$XXXXXXXXXXXXXXXXXXXXXOAcXxm9kjPGEMsLznoKqmqw7tc8WCx4a', 'U*U*U'),
+ array('$2a$05$abcdefghijklmnopqrstuu5s2v8.iXieOjg/.AySBTTZIIVFJeBui', '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789chars after 72 are ignored'),
+ array('$2x$05$/OK.fbVrR/bpIqNJ5ianF.CE5elHaaO4EbggVDjb8P19RukzXSM3e', "\xa3"),
+ array('$2x$05$/OK.fbVrR/bpIqNJ5ianF.CE5elHaaO4EbggVDjb8P19RukzXSM3e', "\xff\xff\xa3"),
+ array('$2y$05$/OK.fbVrR/bpIqNJ5ianF.CE5elHaaO4EbggVDjb8P19RukzXSM3e', "\xff\xff\xa3"),
+ array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.nqd1wy.pTMdcvrRWxyiGL2eMz.2a85.', "\xff\xff\xa3"),
+ array('$2b$05$/OK.fbVrR/bpIqNJ5ianF.CE5elHaaO4EbggVDjb8P19RukzXSM3e', "\xff\xff\xa3"),
+ array('$2y$05$/OK.fbVrR/bpIqNJ5ianF.Sa7shbm4.OzKpvFnX1pQLmQW96oUlCq', "\xa3"),
+ array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.Sa7shbm4.OzKpvFnX1pQLmQW96oUlCq', "\xa3"),
+ array('$2b$05$/OK.fbVrR/bpIqNJ5ianF.Sa7shbm4.OzKpvFnX1pQLmQW96oUlCq', "\xa3"),
+ array('$2x$05$/OK.fbVrR/bpIqNJ5ianF.o./n25XVfn6oAPaUvHe.Csk4zRfsYPi', "1\xa3345"),
+ array('$2x$05$/OK.fbVrR/bpIqNJ5ianF.o./n25XVfn6oAPaUvHe.Csk4zRfsYPi', "\xff\xa3345"),
+ array('$2x$05$/OK.fbVrR/bpIqNJ5ianF.o./n25XVfn6oAPaUvHe.Csk4zRfsYPi', "\xff\xa334\xff\xff\xff\xa3345"),
+ array('$2y$05$/OK.fbVrR/bpIqNJ5ianF.o./n25XVfn6oAPaUvHe.Csk4zRfsYPi', "\xff\xa334\xff\xff\xff\xa3345"),
+ array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.ZC1JEJ8Z4gPfpe1JOr/oyPXTWl9EFd.', "\xff\xa334\xff\xff\xff\xa3345"),
+ array('$2y$05$/OK.fbVrR/bpIqNJ5ianF.nRht2l/HRhr6zmCp9vYUvvsqynflf9e', "\xff\xa3345"),
+ array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.nRht2l/HRhr6zmCp9vYUvvsqynflf9e', "\xff\xa3345"),
+ array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.6IflQkJytoRVc1yuaNtHfiuq.FRlSIS', "\xa3ab"),
+ array('$2x$05$/OK.fbVrR/bpIqNJ5ianF.6IflQkJytoRVc1yuaNtHfiuq.FRlSIS', "\xa3ab"),
+ array('$2y$05$/OK.fbVrR/bpIqNJ5ianF.6IflQkJytoRVc1yuaNtHfiuq.FRlSIS', "\xa3ab"),
+ array('$2x$05$6bNw2HLQYeqHYyBfLMsv/OiwqTymGIGzFsA4hOTWebfehXHNprcAS', "\xd1\x91"),
+ array('$2x$05$6bNw2HLQYeqHYyBfLMsv/O9LIGgn8OMzuDoHfof8AQimSGfcSWxnS', "\xd0\xc1\xd2\xcf\xcc\xd8"),
+ array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.swQOIzjOiJ9GHEPuhEkvqrUyvWhEMx6', "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaachars after 72 are ignored as usual"),
+ array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.R9xrDjiycxMbQE2bp.vgqlYpW5wx2yy', "\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55"),
+ array('$2a$05$/OK.fbVrR/bpIqNJ5ianF.9tQZzcJfm3uj2NvJ/n5xkhpqLrMpWCe', "\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff"),
+ array('$2a$05$CCCCCCCCCCCCCCCCCCCCC.7uG0VCzI2bS7j6ymqJi9CdcdxiRTWNy', ''),
);
$tests2 = array(
- array('$2a$03$CCCCCCCCCCCCCCCCCCCCC.', '*0'),
- array('$2a$32$CCCCCCCCCCCCCCCCCCCCC.', '*0'),
- array('$2c$05$CCCCCCCCCCCCCCCCCCCCC.', '*0'),
- array('$2z$05$CCCCCCCCCCCCCCCCCCCCC.', '*0'),
- array('$2`$05$CCCCCCCCCCCCCCCCCCCCC.', '*0'),
- array('$2{$05$CCCCCCCCCCCCCCCCCCCCC.', '*0'),
- array('*0', '*1'),
+ array('$2a$03$CCCCCCCCCCCCCCCCCCCCC.', '*0'),
+ array('$2a$32$CCCCCCCCCCCCCCCCCCCCC.', '*0'),
+ array('$2c$05$CCCCCCCCCCCCCCCCCCCCC.', '*0'),
+ array('$2z$05$CCCCCCCCCCCCCCCCCCCCC.', '*0'),
+ array('$2`$05$CCCCCCCCCCCCCCCCCCCCC.', '*0'),
+ array('$2{$05$CCCCCCCCCCCCCCCCCCCCC.', '*0'),
+ array('*0', '*1'),
);
$i=0;
diff --git a/ext/standard/tests/strings/crypt_sha256.phpt b/ext/standard/tests/strings/crypt_sha256.phpt
index c361dc48cb..c011984ed9 100644
--- a/ext/standard/tests/strings/crypt_sha256.phpt
+++ b/ext/standard/tests/strings/crypt_sha256.phpt
@@ -4,51 +4,51 @@ crypt() SHA-256
<?php
$tests = array(
- 1 => array(
- '$5$saltstring',
- 'Hello world!',
- '$5$saltstring$5B8vYYiY.CVt1RlTTf8KbXBH3hsxY/GNooZaBBGWEc5'
- ),
- 2 => array(
- '$5$rounds=10000$saltstringsaltstring',
- 'Hello world!',
- '$5$rounds=10000$saltstringsaltst$3xv.VbSHBb41AL9AvLeujZkZRBAwqFMz2.opqey6IcA'
- ),
- 3 => array(
- '$5$rounds=10000$saltstringsaltstring',
- 'Hello world!',
- '$5$rounds=10000$saltstringsaltst$3xv.VbSHBb41AL9AvLeujZkZRBAwqFMz2.opqey6IcA'
- ),
- 4 => array(
- '$5$rounds=5000$toolongsaltstring',
- 'This is just a test',
- '$5$rounds=5000$toolongsaltstrin$Un/5jzAHMgOGZ5.mWJpuVolil07guHPvOW8mGRcvxa5'
- ),
- 5 => array(
- '$5$rounds=1400$anotherlongsaltstring',
- 'a very much longer text to encrypt. This one even stretches over morethan one line.',
- '$5$rounds=1400$anotherlongsalts$Rx.j8H.h8HjEDGomFU8bDkXm3XIUnzyxf12oP84Bnq1'
- ),
- 6 => array(
- '$5$rounds=77777$short',
- 'we have a short salt string but not a short password',
- '$5$rounds=77777$short$JiO1O3ZpDAxGJeaDIuqCoEFysAe1mZNJRs3pw0KQRd/'
- ),
- 7 => array(
- '$5$rounds=123456$asaltof16chars..',
- 'a short string',
- '$5$rounds=123456$asaltof16chars..$gP3VQ/6X7UUEW3HkBn2w1/Ptq2jxPyzV/cZKmF/wJvD'
- ),
- 8 => array(
- '$5$rounds=10$roundstoolow',
- 'the minimum number is still observed',
- '$5$rounds=1000$roundstoolow$yfvwcWrQ8l/K0DAWyuPMDNHpIVlTQebY9l/gL972bIC'
- )
+ 1 => array(
+ '$5$saltstring',
+ 'Hello world!',
+ '$5$saltstring$5B8vYYiY.CVt1RlTTf8KbXBH3hsxY/GNooZaBBGWEc5'
+ ),
+ 2 => array(
+ '$5$rounds=10000$saltstringsaltstring',
+ 'Hello world!',
+ '$5$rounds=10000$saltstringsaltst$3xv.VbSHBb41AL9AvLeujZkZRBAwqFMz2.opqey6IcA'
+ ),
+ 3 => array(
+ '$5$rounds=10000$saltstringsaltstring',
+ 'Hello world!',
+ '$5$rounds=10000$saltstringsaltst$3xv.VbSHBb41AL9AvLeujZkZRBAwqFMz2.opqey6IcA'
+ ),
+ 4 => array(
+ '$5$rounds=5000$toolongsaltstring',
+ 'This is just a test',
+ '$5$rounds=5000$toolongsaltstrin$Un/5jzAHMgOGZ5.mWJpuVolil07guHPvOW8mGRcvxa5'
+ ),
+ 5 => array(
+ '$5$rounds=1400$anotherlongsaltstring',
+ 'a very much longer text to encrypt. This one even stretches over morethan one line.',
+ '$5$rounds=1400$anotherlongsalts$Rx.j8H.h8HjEDGomFU8bDkXm3XIUnzyxf12oP84Bnq1'
+ ),
+ 6 => array(
+ '$5$rounds=77777$short',
+ 'we have a short salt string but not a short password',
+ '$5$rounds=77777$short$JiO1O3ZpDAxGJeaDIuqCoEFysAe1mZNJRs3pw0KQRd/'
+ ),
+ 7 => array(
+ '$5$rounds=123456$asaltof16chars..',
+ 'a short string',
+ '$5$rounds=123456$asaltof16chars..$gP3VQ/6X7UUEW3HkBn2w1/Ptq2jxPyzV/cZKmF/wJvD'
+ ),
+ 8 => array(
+ '$5$rounds=10$roundstoolow',
+ 'the minimum number is still observed',
+ '$5$rounds=1000$roundstoolow$yfvwcWrQ8l/K0DAWyuPMDNHpIVlTQebY9l/gL972bIC'
+ )
);
foreach ($tests as $iter => $t) {
- $res = crypt($t[1], $t[0]);
- if ($res != $t[2]) echo "Iteration $iter failed.
+ $res = crypt($t[1], $t[0]);
+ if ($res != $t[2]) echo "Iteration $iter failed.
Expected: <$t[2]>
Got <$res>\n";
}
diff --git a/ext/standard/tests/strings/crypt_sha512.phpt b/ext/standard/tests/strings/crypt_sha512.phpt
index 408a5a00c7..589a2622de 100644
--- a/ext/standard/tests/strings/crypt_sha512.phpt
+++ b/ext/standard/tests/strings/crypt_sha512.phpt
@@ -4,51 +4,51 @@ crypt() SHA-512
<?php
$tests = array(
- 1 => array(
- '$6$saltstring',
- 'Hello world!',
- '$6$saltstring$svn8UoSVapNtMuq1ukKS4tPQd8iKwSMHWjl/O817G3uBnIFNjnQJuesI68u4OTLiBFdcbYEdFCoEOfaS35inz1'
- ),
- 2 => array(
- '$6$rounds=10000$saltstringsaltstring',
- 'Hello world!',
- '$6$rounds=10000$saltstringsaltst$OW1/O6BYHV6BcXZu8QVeXbDWra3Oeqh0sbHbbMCVNSnCM/UrjmM0Dp8vOuZeHBy/YTBmSK6H9qs/y3RnOaw5v.'
- ),
- 3 => array(
- '$6$rounds=5000$toolongsaltstring',
- 'This is just a test',
- '$6$rounds=5000$toolongsaltstrin$lQ8jolhgVRVhY4b5pZKaysCLi0QBxGoNeKQzQ3glMhwllF7oGDZxUhx1yxdYcz/e1JSbq3y6JMxxl8audkUEm0'
- ),
- 4 => array(
- '$6$rounds=1400$anotherlongsaltstring',
- 'a very much longer text to encrypt. This one even stretches over morethan one line.',
- '$6$rounds=1400$anotherlongsalts$POfYwTEok97VWcjxIiSOjiykti.o/pQs.wPvMxQ6Fm7I6IoYN3CmLs66x9t0oSwbtEW7o7UmJEiDwGqd8p4ur1'
- ),
- 5 => array(
- '$6$rounds=77777$short',
- 'we have a short salt string but not a short password',
- '$6$rounds=77777$short$WuQyW2YR.hBNpjjRhpYD/ifIw05xdfeEyQoMxIXbkvr0gge1a1x3yRULJ5CCaUeOxFmtlcGZelFl5CxtgfiAc0'
- ),
- 6 => array(
- '$6$rounds=123456$asaltof16chars..',
- 'a short string',
- '$6$rounds=123456$asaltof16chars..$BtCwjqMJGx5hrJhZywWvt0RLE8uZ4oPwcelCjmw2kSYu.Ec6ycULevoBK25fs2xXgMNrCzIMVcgEJAstJeonj1'
- ),
- 7 => array(
- '$6$rounds=10$roundstoolow',
- 'the minimum number is still observed',
- '$6$rounds=1000$roundstoolow$kUMsbe306n21p9R.FRkW3IGn.S9NPN0x50YhH1xhLsPuWGsUSklZt58jaTfF4ZEQpyUNGc0dqbpBYYBaHHrsX.'
- ),
- 8 => array(
- '$6$$bar$',
- 'foo',
- '$6$$QMXjqd7rHQZPQ1yHsXkQqC1FBzDiVfTHXL.LaeDAeVV.IzMaV9VU4MQ8kPuZa2SOP1A0RPm772EaFYjpEJtdu.'
- ),
+ 1 => array(
+ '$6$saltstring',
+ 'Hello world!',
+ '$6$saltstring$svn8UoSVapNtMuq1ukKS4tPQd8iKwSMHWjl/O817G3uBnIFNjnQJuesI68u4OTLiBFdcbYEdFCoEOfaS35inz1'
+ ),
+ 2 => array(
+ '$6$rounds=10000$saltstringsaltstring',
+ 'Hello world!',
+ '$6$rounds=10000$saltstringsaltst$OW1/O6BYHV6BcXZu8QVeXbDWra3Oeqh0sbHbbMCVNSnCM/UrjmM0Dp8vOuZeHBy/YTBmSK6H9qs/y3RnOaw5v.'
+ ),
+ 3 => array(
+ '$6$rounds=5000$toolongsaltstring',
+ 'This is just a test',
+ '$6$rounds=5000$toolongsaltstrin$lQ8jolhgVRVhY4b5pZKaysCLi0QBxGoNeKQzQ3glMhwllF7oGDZxUhx1yxdYcz/e1JSbq3y6JMxxl8audkUEm0'
+ ),
+ 4 => array(
+ '$6$rounds=1400$anotherlongsaltstring',
+ 'a very much longer text to encrypt. This one even stretches over morethan one line.',
+ '$6$rounds=1400$anotherlongsalts$POfYwTEok97VWcjxIiSOjiykti.o/pQs.wPvMxQ6Fm7I6IoYN3CmLs66x9t0oSwbtEW7o7UmJEiDwGqd8p4ur1'
+ ),
+ 5 => array(
+ '$6$rounds=77777$short',
+ 'we have a short salt string but not a short password',
+ '$6$rounds=77777$short$WuQyW2YR.hBNpjjRhpYD/ifIw05xdfeEyQoMxIXbkvr0gge1a1x3yRULJ5CCaUeOxFmtlcGZelFl5CxtgfiAc0'
+ ),
+ 6 => array(
+ '$6$rounds=123456$asaltof16chars..',
+ 'a short string',
+ '$6$rounds=123456$asaltof16chars..$BtCwjqMJGx5hrJhZywWvt0RLE8uZ4oPwcelCjmw2kSYu.Ec6ycULevoBK25fs2xXgMNrCzIMVcgEJAstJeonj1'
+ ),
+ 7 => array(
+ '$6$rounds=10$roundstoolow',
+ 'the minimum number is still observed',
+ '$6$rounds=1000$roundstoolow$kUMsbe306n21p9R.FRkW3IGn.S9NPN0x50YhH1xhLsPuWGsUSklZt58jaTfF4ZEQpyUNGc0dqbpBYYBaHHrsX.'
+ ),
+ 8 => array(
+ '$6$$bar$',
+ 'foo',
+ '$6$$QMXjqd7rHQZPQ1yHsXkQqC1FBzDiVfTHXL.LaeDAeVV.IzMaV9VU4MQ8kPuZa2SOP1A0RPm772EaFYjpEJtdu.'
+ ),
);
foreach ($tests as $iter => $t) {
- $res = crypt($t[1], $t[0]);
- if ($res != $t[2]) echo "Iteration $iter failed.
+ $res = crypt($t[1], $t[0]);
+ if ($res != $t[2]) echo "Iteration $iter failed.
Expected: <$t[2]>
Got <$res>\n";
}
diff --git a/ext/standard/tests/strings/default_charset.phpt b/ext/standard/tests/strings/default_charset.phpt
index 3665132413..3a8e2696d1 100644
--- a/ext/standard/tests/strings/default_charset.phpt
+++ b/ext/standard/tests/strings/default_charset.phpt
@@ -9,10 +9,10 @@ output_encoding=
<?php
echo "*** Default php.ini value ***\n";
var_dump(ini_get('default_charset'),
- ini_get('internal_encoding'),
- ini_get('input_encoding'),
- ini_get('output_encoding')
- );
+ ini_get('internal_encoding'),
+ ini_get('input_encoding'),
+ ini_get('output_encoding')
+ );
echo "*** Runtime change of default_charset ***\n";
@@ -20,10 +20,10 @@ var_dump(ini_set('default_charset', 'cp1252'));
echo "*** Test with updated default_charset ***\n";
var_dump(ini_get('default_charset'),
- ini_get('internal_encoding'),
- ini_get('input_encoding'),
- ini_get('output_encoding')
- );
+ ini_get('internal_encoding'),
+ ini_get('input_encoding'),
+ ini_get('output_encoding')
+ );
var_dump(htmlentities("\xA3", ENT_HTML5));
var_dump(htmlentities("\xA3", ENT_HTML5, 'cp1252'));
@@ -35,10 +35,10 @@ var_dump(bin2hex(html_entity_decode("&pound;", ENT_HTML5, 'cp1252')));
echo "*** Change internal_encoding to empty ***\n";
var_dump(ini_set('internal_encoding', ''));
var_dump(ini_get('default_charset'),
- ini_get('internal_encoding'),
- ini_get('input_encoding'),
- ini_get('output_encoding')
- );
+ ini_get('internal_encoding'),
+ ini_get('input_encoding'),
+ ini_get('output_encoding')
+ );
var_dump(htmlentities("\xA3", ENT_HTML5));
var_dump(htmlentities("\xA3", ENT_HTML5, 'cp1252'));
@@ -49,10 +49,10 @@ echo "*** Update input/output_encoding ***\n";
var_dump(ini_set('input_encoding', 'ISO-8859-1'));
var_dump(ini_set('output_encoding', 'ISO-8859-1'));
var_dump(ini_get('default_charset'),
- ini_get('internal_encoding'),
- ini_get('input_encoding'),
- ini_get('output_encoding')
- );
+ ini_get('internal_encoding'),
+ ini_get('input_encoding'),
+ ini_get('output_encoding')
+ );
// Should not be affected
var_dump(htmlentities("\xA3", ENT_HTML5));
diff --git a/ext/standard/tests/strings/dirname_error.phpt b/ext/standard/tests/strings/dirname_error.phpt
index 98a9ea5b45..99d0f28807 100644
--- a/ext/standard/tests/strings/dirname_error.phpt
+++ b/ext/standard/tests/strings/dirname_error.phpt
@@ -6,26 +6,15 @@ Test dirname() function : error conditions
Description: Returns directory name component of path.
*/
echo "*** Testing error conditions ***\n";
-// zero arguments
-var_dump( dirname() );
// Bad arg
-var_dump( dirname("/var/tmp/bar.gz", 0) );
+try {
+ dirname("/var/tmp/bar.gz", 0);
+} catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+}
-// more than expected no. of arguments
-var_dump( dirname("/var/tmp/bar.gz", 1, ".gz") );
-
-echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
*** Testing error conditions ***
-
-Warning: dirname() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: dirname(): Invalid argument, levels must be >= 1 in %s on line %d
-NULL
-
-Warning: dirname() expects at most 2 parameters, 3 given in %s on line %d
-NULL
-Done
+Invalid argument, levels must be >= 1
diff --git a/ext/standard/tests/strings/dirname_multi.phpt b/ext/standard/tests/strings/dirname_multi.phpt
index febbd0c293..62943fe69a 100644
--- a/ext/standard/tests/strings/dirname_multi.phpt
+++ b/ext/standard/tests/strings/dirname_multi.phpt
@@ -11,17 +11,18 @@ if((substr(PHP_OS, 0, 3) == "WIN"))
Description: Returns directory name component of path.
*/
for ($i=0 ; $i<5 ; $i++) {
- var_dump(dirname("/foo/bar/baz", $i));
+ try {
+ var_dump(dirname("/foo/bar/baz", $i));
+ } catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+ }
}
var_dump(dirname("/foo/bar/baz", PHP_INT_MAX));
?>
-Done
---EXPECTF--
-Warning: dirname(): Invalid argument, levels must be >= 1 in %sdirname_multi.php on line %d
-NULL
+--EXPECT--
+Invalid argument, levels must be >= 1
string(8) "/foo/bar"
string(4) "/foo"
string(1) "/"
string(1) "/"
string(1) "/"
-Done
diff --git a/ext/standard/tests/strings/dirname_multi_win.phpt b/ext/standard/tests/strings/dirname_multi_win.phpt
index 4fed5895e6..d63d5e7950 100644
--- a/ext/standard/tests/strings/dirname_multi_win.phpt
+++ b/ext/standard/tests/strings/dirname_multi_win.phpt
@@ -10,17 +10,21 @@ if((substr(PHP_OS, 0, 3) != "WIN"))
/* Prototype: string dirname ( string $path [, int nb]);
Description: Returns directory name component of path.
*/
+
for ($i=0 ; $i<5 ; $i++) {
- var_dump(dirname("/foo/bar/baz", $i));
+ try {
+ var_dump(dirname("/foo/bar/baz", $i));
+ } catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+ }
}
+
var_dump(dirname("/foo/bar/baz", PHP_INT_MAX));
var_dump(dirname("g:/foo/bar/baz", PHP_INT_MAX));
var_dump(dirname("g:foo/bar/baz", PHP_INT_MAX));
?>
-Done
---EXPECTF--
-Warning: dirname(): Invalid argument, levels must be >= 1 in %sdirname_multi_win.php on line %d
-NULL
+--EXPECT--
+Invalid argument, levels must be >= 1
string(8) "/foo/bar"
string(4) "/foo"
string(1) "\"
@@ -28,4 +32,3 @@ string(1) "\"
string(1) "\"
string(3) "g:\"
string(3) "g:."
-Done
diff --git a/ext/standard/tests/strings/explode.phpt b/ext/standard/tests/strings/explode.phpt
index 84cdcb985f..8375364175 100644
--- a/ext/standard/tests/strings/explode.phpt
+++ b/ext/standard/tests/strings/explode.phpt
@@ -8,21 +8,40 @@ error_reporting=2047
<?php
/* From http://bugs.php.net/19865 */
echo var_export(explode("\1", "a". chr(1). "b". chr(0). "d" . chr(1) . "f" . chr(1). "1" . chr(1) . "d"), TRUE);
+echo "\n";
echo md5(var_export(explode("\1", "a". chr(1). "b". chr(0). "d" . chr(1) . "f" . chr(1). "1" . chr(1) . "d"), TRUE));
echo "\n";
-var_dump(@explode("", ""));
-var_dump(@explode("", NULL));
-var_dump(@explode(NULL, ""));
-var_dump(@explode("a", ""));
-var_dump(@explode("a", "a"));
-var_dump(@explode("a", NULL));
-var_dump(@explode(NULL, "a"));
-var_dump(@explode("abc", "acb"));
-var_dump(@explode("somestring", "otherstring"));
-var_dump(@explode("somestring", "otherstring", -1));
-var_dump(@explode("a", "aaaaaa"));
-var_dump(@explode("==", str_repeat("-=".ord(0)."=-", 10)));
-var_dump(@explode("=", str_repeat("-=".ord(0)."=-", 10)));
+
+try {
+ var_dump(explode("", ""));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+}
+try {
+ var_dump(explode("", NULL));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+}
+try {
+ var_dump(explode(NULL, ""));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+}
+
+var_dump(explode("a", ""));
+var_dump(explode("a", "a"));
+var_dump(explode("a", NULL));
+try {
+ var_dump(explode(NULL, "a"));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+}
+var_dump(explode("abc", "acb"));
+var_dump(explode("somestring", "otherstring"));
+var_dump(explode("somestring", "otherstring", -1));
+var_dump(explode("a", "aaaaaa"));
+var_dump(explode("==", str_repeat("-=".ord(0)."=-", 10)));
+var_dump(explode("=", str_repeat("-=".ord(0)."=-", 10)));
//////////////////////////////////////
var_dump(explode(":","a lazy dog:jumps:over:",-1));
var_dump(explode(":","a lazy dog:jumps:over", -1));
@@ -39,10 +58,11 @@ array (
2 => 'f',
3 => '1',
4 => 'd',
-)d6bee42a771449205344c0938ad4f035
-bool(false)
-bool(false)
-bool(false)
+)
+d6bee42a771449205344c0938ad4f035
+Empty delimiter
+Empty delimiter
+Empty delimiter
array(1) {
[0]=>
string(0) ""
@@ -57,7 +77,7 @@ array(1) {
[0]=>
string(0) ""
}
-bool(false)
+Empty delimiter
array(1) {
[0]=>
string(3) "acb"
diff --git a/ext/standard/tests/strings/explode1.phpt b/ext/standard/tests/strings/explode1.phpt
index 6842947605..cfc203b428 100644
--- a/ext/standard/tests/strings/explode1.phpt
+++ b/ext/standard/tests/strings/explode1.phpt
@@ -32,15 +32,32 @@ $string = "1234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND";
*/
$counter = 1;
foreach($delimiters as $delimiter) {
- echo "-- Iteration $counter --\n";
- var_dump( explode($delimiter, $string, -1) );
- var_dump( explode($delimiter, $string, 0) );
- var_dump( explode($delimiter, $string, 1) );
- var_dump( explode($delimiter, $string, 2) );
- $counter++;
-}
-
-echo "\n*** Testing explode() with miscelleneous input arguments ***\n";
+ echo "-- Iteration $counter --\n";
+
+ try {
+ var_dump( explode($delimiter, $string, -1) );
+ } catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+ }
+ try {
+ var_dump( explode($delimiter, $string, 0) );
+ } catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+ }
+ try {
+ var_dump( explode($delimiter, $string, 1) );
+ } catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+ }
+ try {
+ var_dump( explode($delimiter, $string, 2) );
+ } catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+ }
+ $counter++;
+}
+
+echo "\n*** Testing explode() with miscellaneous input arguments ***\n";
echo "\n-- Passing positive values of Limit to explode() --\n";
/* LIMIT=2 */
@@ -77,41 +94,19 @@ class string1 {
$obj = new string1;
var_dump( explode("b", $obj) );
-echo "\n*** Testing error conditions ***\n";
-/* checking for arguments <2 and >3 */
-var_dump( explode(":", "array1:array2:array3", -1, -33) );
-var_dump( explode(":") );
-
-echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
*** Testing explode() for basic operations ***
-- Iteration 1 --
-
-Warning: explode(): Empty delimiter in %s on line %d
-bool(false)
-
-Warning: explode(): Empty delimiter in %s on line %d
-bool(false)
-
-Warning: explode(): Empty delimiter in %s on line %d
-bool(false)
-
-Warning: explode(): Empty delimiter in %s on line %d
-bool(false)
+Empty delimiter
+Empty delimiter
+Empty delimiter
+Empty delimiter
-- Iteration 2 --
-
-Warning: explode(): Empty delimiter in %s on line %d
-bool(false)
-
-Warning: explode(): Empty delimiter in %s on line %d
-bool(false)
-
-Warning: explode(): Empty delimiter in %s on line %d
-bool(false)
-
-Warning: explode(): Empty delimiter in %s on line %d
-bool(false)
+Empty delimiter
+Empty delimiter
+Empty delimiter
+Empty delimiter
-- Iteration 3 --
array(1) {
[0]=>
@@ -213,18 +208,10 @@ array(2) {
string(56) "234NULL23abcd00000TRUEFALSE-11.234444true-11.24%PHP%ZEND"
}
-- Iteration 7 --
-
-Warning: explode(): Empty delimiter in %s on line %d
-bool(false)
-
-Warning: explode(): Empty delimiter in %s on line %d
-bool(false)
-
-Warning: explode(): Empty delimiter in %s on line %d
-bool(false)
-
-Warning: explode(): Empty delimiter in %s on line %d
-bool(false)
+Empty delimiter
+Empty delimiter
+Empty delimiter
+Empty delimiter
-- Iteration 8 --
array(2) {
[0]=>
@@ -316,7 +303,7 @@ array(2) {
string(8) "PHP%ZEND"
}
-*** Testing explode() with miscelleneous input arguments ***
+*** Testing explode() with miscellaneous input arguments ***
-- Passing positive values of Limit to explode() --
array(2) {
@@ -498,12 +485,3 @@ array(2) {
[1]=>
string(4) "ject"
}
-
-*** Testing error conditions ***
-
-Warning: explode() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-
-Warning: explode() expects at least 2 parameters, 1 given in %s on line %d
-NULL
-Done
diff --git a/ext/standard/tests/strings/explode_variation4.phpt b/ext/standard/tests/strings/explode_variation4.phpt
index 080531c6ec..9a6a862f8b 100644
--- a/ext/standard/tests/strings/explode_variation4.phpt
+++ b/ext/standard/tests/strings/explode_variation4.phpt
@@ -14,7 +14,6 @@ $pizza = "piece1 piece2 piece3 piece4 piece5 piece6 p";
$pieces = explode(" p", $pizza);
var_dump($pieces);
?>
-===DONE===
--EXPECT--
*** Testing explode() function: match longer string ***
array(7) {
@@ -33,4 +32,3 @@ array(7) {
[6]=>
string(0) ""
}
-===DONE===
diff --git a/ext/standard/tests/strings/explode_variation5.phpt b/ext/standard/tests/strings/explode_variation5.phpt
index e5e6dd75d9..d5c1938eaf 100644
--- a/ext/standard/tests/strings/explode_variation5.phpt
+++ b/ext/standard/tests/strings/explode_variation5.phpt
@@ -20,7 +20,6 @@ var_dump(explode('||', $str, -1));
echo "\n-- negative limit (since PHP 5.1) with null string -- \n";
var_dump(explode('||', "", -1));
?>
-===DONE===
--EXPECT--
*** Testing explode() function: positive and negative limits ***
@@ -45,4 +44,3 @@ array(3) {
-- negative limit (since PHP 5.1) with null string --
array(0) {
}
-===DONE===
diff --git a/ext/standard/tests/strings/explode_variation6.phpt b/ext/standard/tests/strings/explode_variation6.phpt
index 730e69ba13..0dcce23077 100644
--- a/ext/standard/tests/strings/explode_variation6.phpt
+++ b/ext/standard/tests/strings/explode_variation6.phpt
@@ -32,14 +32,13 @@ $e = test_explode("\x00", $str, 100);
function test_explode($delim, $string, $limit)
{
- $e = explode($delim, $string, $limit);
- foreach ( $e as $v)
- {
- var_dump(bin2hex($v));
- }
+ $e = explode($delim, $string, $limit);
+ foreach ( $e as $v)
+ {
+ var_dump(bin2hex($v));
+ }
}
?>
-===DONE===
--EXPECT--
*** Testing explode() function: misc tests ***
@@ -67,4 +66,3 @@ string(6) "6f6e65"
string(6) "74776f"
string(10) "7468726565"
string(8) "666f7572"
-===DONE===
diff --git a/ext/standard/tests/strings/fprintf_error.phpt b/ext/standard/tests/strings/fprintf_error.phpt
index ccc37407e8..1ffc188051 100644
--- a/ext/standard/tests/strings/fprintf_error.phpt
+++ b/ext/standard/tests/strings/fprintf_error.phpt
@@ -7,25 +7,31 @@ Test fprintf() function (errors)
echo "*** Testing Error Conditions ***\n";
/* zero argument */
-var_dump( fprintf() );
+try {
+ var_dump( fprintf() );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
/* scalar argument */
-var_dump( fprintf(3) );
+try {
+ var_dump( fprintf(3) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
/* NULL argument */
-var_dump( fprintf(NULL) );
+try {
+ var_dump( fprintf(NULL) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done\n";
?>
--EXPECTF--
*** Testing Error Conditions ***
-
-Warning: Wrong parameter count for fprintf() in %sfprintf_error.php on line %d
-NULL
-
-Warning: Wrong parameter count for fprintf() in %sfprintf_error.php on line %d
-NULL
-
-Warning: Wrong parameter count for fprintf() in %sfprintf_error.php on line %d
-NULL
+Wrong parameter count for fprintf()
+Wrong parameter count for fprintf()
+Wrong parameter count for fprintf()
Done
diff --git a/ext/standard/tests/strings/get_meta_tags.phpt b/ext/standard/tests/strings/get_meta_tags.phpt
index 406ceb2590..8752117aea 100644
--- a/ext/standard/tests/strings/get_meta_tags.phpt
+++ b/ext/standard/tests/strings/get_meta_tags.phpt
@@ -47,8 +47,8 @@ DATA;
$array = array($data, $data1, $data2, $data3, $data4, "", "<>", "<meta<<<<<");
foreach ($array as $html) {
- file_put_contents($filename, $html);
- var_dump(get_meta_tags($filename));
+ file_put_contents($filename, $html);
+ var_dump(get_meta_tags($filename));
}
@unlink($filename);
diff --git a/ext/standard/tests/strings/hebrev_basic.phpt b/ext/standard/tests/strings/hebrev_basic.phpt
index cc32d654e8..83e2cc8a8f 100644
--- a/ext/standard/tests/strings/hebrev_basic.phpt
+++ b/ext/standard/tests/strings/hebrev_basic.phpt
@@ -16,7 +16,6 @@ var_dump(hebrev($hebrew_text));
var_dump(hebrev($hebrew_text, 15));
?>
-===DONE===
--EXPECT--
*** Testing hebrev() : basic functionality ***
string(109) ".The hebrev function converts logical Hebrew text to visual text
@@ -32,4 +31,3 @@ breaking words
tries to avoid
.The function
"
-===DONE===
diff --git a/ext/standard/tests/strings/hebrevc_basic.phpt b/ext/standard/tests/strings/hebrevc_basic.phpt
deleted file mode 100644
index 2af6c38f1e..0000000000
--- a/ext/standard/tests/strings/hebrevc_basic.phpt
+++ /dev/null
@@ -1,51 +0,0 @@
---TEST--
-Test hebrevc() function : basic functionality
---FILE--
-<?php
-
-/* Prototype : string hebrevc ( string $hebrew_text [, int $max_chars_per_line ] )
- * Description: Convert logical Hebrew text to visual text
- * Source code: ext/standard/string.c
-*/
-
-echo "*** Testing hebrevc() : basic functionality ***\n";
-
-$hebrew_text = "The hebrevc function converts logical Hebrew text to visual text.\nThis function is similar to hebrev() with the difference that it converts newlines (\n) to '<br>\n'.\nThe function tries to avoid breaking words.\n";
-
-var_dump(hebrevc($hebrew_text));
-var_dump(hebrevc($hebrew_text, 15));
-
-?>
-===DONE===
---EXPECTF--
-*** Testing hebrevc() : basic functionality ***
-
-Deprecated: Function hebrevc() is deprecated in %s on line %d
-string(239) ".The hebrevc function converts logical Hebrew text to visual text<br />
-) This function is similar to hebrev() with the difference that it converts newlines<br />
-<to '<br (<br />
-.'<br />
-.The function tries to avoid breaking words<br />
-"
-
-Deprecated: Function hebrevc() is deprecated in %s on line %d
-string(317) "to visual text<br />
-Hebrew text<br />
-logical<br />
-converts<br />
-function<br />
-.The hebrevc<br />
-newlines<br />
-it converts<br />
-difference that<br />
-with the<br />
-to hebrev()<br />
-is similar<br />
-) This function<br />
-<to '<br (<br />
-.'<br />
-breaking words<br />
-tries to avoid<br />
-.The function<br />
-"
-===DONE===
diff --git a/ext/standard/tests/strings/highlight_file.phpt b/ext/standard/tests/strings/highlight_file.phpt
index 4eba32aebc..28bde64a18 100644
--- a/ext/standard/tests/strings/highlight_file.phpt
+++ b/ext/standard/tests/strings/highlight_file.phpt
@@ -13,7 +13,6 @@ allow_url_fopen=1
$filename = __DIR__."/highlight_file.dat";
-var_dump(highlight_file());
var_dump(highlight_file($filename));
var_dump(highlight_file('data:,<?php echo "test"; ?>'));
@@ -21,12 +20,12 @@ var_dump(highlight_file('data:,<?php echo "test"; ?>'));
var_dump(highlight_file('data:,<?php echo "test ?>'));
$data = '
-<?php
- class test {
- public $var = 1;
- private function foo() { echo "foo"; }
- public function bar() { var_dump(test::foo()); }
- }
+<?php
+class test {
+ public $var = 1;
+ private function foo() { echo "foo"; }
+ public function bar() { var_dump(test::foo()); }
+}
?>';
file_put_contents($filename, $data);
@@ -39,10 +38,7 @@ echo "Done\n";
--EXPECTF--
Deprecated: Directive 'allow_url_include' is deprecated in Unknown on line 0
-Warning: highlight_file() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: highlight_file(%shighlight_file.dat): failed to open stream: No such file or directory in %s on line %d
+Warning: highlight_file(%shighlight_file.dat): Failed to open stream: No such file or directory in %s on line %d
Warning: highlight_file(): Failed opening '%shighlight_file.dat' for highlighting in %s on line %d
bool(false)
@@ -55,7 +51,7 @@ bool(false)
</span>
</code>bool(true)
<code><span style="color: #000000">
-<br /><span style="color: #0000BB">&lt;?php&nbsp;<br />&nbsp;</span><span style="color: #007700">class&nbsp;</span><span style="color: #0000BB">test&nbsp;</span><span style="color: #007700">{&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;</span><span style="color: #0000BB">$var&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private&nbsp;function&nbsp;</span><span style="color: #0000BB">foo</span><span style="color: #007700">()&nbsp;{&nbsp;echo&nbsp;</span><span style="color: #DD0000">"foo"</span><span style="color: #007700">;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;</span><span style="color: #0000BB">bar</span><span style="color: #007700">()&nbsp;{&nbsp;</span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">test</span><span style="color: #007700">::</span><span style="color: #0000BB">foo</span><span style="color: #007700">());&nbsp;}<br />&nbsp;}&nbsp;&nbsp;<br /></span><span style="color: #0000BB">?&gt;</span>
+<br /><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">class&nbsp;</span><span style="color: #0000BB">test&nbsp;</span><span style="color: #007700">{<br />&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;</span><span style="color: #0000BB">$var&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;private&nbsp;function&nbsp;</span><span style="color: #0000BB">foo</span><span style="color: #007700">()&nbsp;{&nbsp;echo&nbsp;</span><span style="color: #DD0000">"foo"</span><span style="color: #007700">;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;</span><span style="color: #0000BB">bar</span><span style="color: #007700">()&nbsp;{&nbsp;</span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">test</span><span style="color: #007700">::</span><span style="color: #0000BB">foo</span><span style="color: #007700">());&nbsp;}<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code>bool(true)
Done
diff --git a/ext/standard/tests/strings/html_entity_decode_html4.phpt b/ext/standard/tests/strings/html_entity_decode_html4.phpt
index 34753396de..dad8a3eb1f 100644
--- a/ext/standard/tests/strings/html_entity_decode_html4.phpt
+++ b/ext/standard/tests/strings/html_entity_decode_html4.phpt
@@ -3,258 +3,258 @@ html_entity_decode() conformance check (HTML 4)
--FILE--
<?php
$map = array(
- "&quot;",
- "&amp;",
- "&lt;",
- "&gt;",
- "&nbsp;",
- "&iexcl;",
- "&cent;",
- "&pound;",
- "&curren;",
- "&yen;",
- "&brvbar;",
- "&sect;",
- "&uml;",
- "&copy;",
- "&ordf;",
- "&laquo;",
- "&not;",
- "&shy;",
- "&reg;",
- "&macr;",
- "&deg;",
- "&plusmn;",
- "&sup2;",
- "&sup3;",
- "&acute;",
- "&micro;",
- "&para;",
- "&middot;",
- "&cedil;",
- "&sup1;",
- "&ordm;",
- "&raquo;",
- "&frac14;",
- "&frac12;",
- "&frac34;",
- "&iquest;",
- "&Agrave;",
- "&Aacute;",
- "&Acirc;",
- "&Atilde;",
- "&Auml;",
- "&Aring;",
- "&AElig;",
- "&Ccedil;",
- "&Egrave;",
- "&Eacute;",
- "&Ecirc;",
- "&Euml;",
- "&Igrave;",
- "&Iacute;",
- "&Icirc;",
- "&Iuml;",
- "&ETH;",
- "&Ntilde;",
- "&Ograve;",
- "&Oacute;",
- "&Ocirc;",
- "&Otilde;",
- "&Ouml;",
- "&times;",
- "&Oslash;",
- "&Ugrave;",
- "&Uacute;",
- "&Ucirc;",
- "&Uuml;",
- "&Yacute;",
- "&THORN;",
- "&szlig;",
- "&agrave;",
- "&aacute;",
- "&acirc;",
- "&atilde;",
- "&auml;",
- "&aring;",
- "&aelig;",
- "&ccedil;",
- "&egrave;",
- "&eacute;",
- "&ecirc;",
- "&euml;",
- "&igrave;",
- "&iacute;",
- "&icirc;",
- "&iuml;",
- "&eth;",
- "&ntilde;",
- "&ograve;",
- "&oacute;",
- "&ocirc;",
- "&otilde;",
- "&ouml;",
- "&divide;",
- "&oslash;",
- "&ugrave;",
- "&uacute;",
- "&ucirc;",
- "&uuml;",
- "&yacute;",
- "&thorn;",
- "&yuml;",
- "&OElig;",
- "&oelig;",
- "&Scaron;",
- "&scaron;",
- "&Yuml;",
- "&fnof;",
- "&circ;",
- "&tilde;",
- "&Alpha;",
- "&Beta;",
- "&Gamma;",
- "&Delta;",
- "&Epsilon;",
- "&Zeta;",
- "&Eta;",
- "&Theta;",
- "&Iota;",
- "&Kappa;",
- "&Lambda;",
- "&Mu;",
- "&Nu;",
- "&Xi;",
- "&Omicron;",
- "&Pi;",
- "&Rho;",
- "&Sigma;",
- "&Tau;",
- "&Upsilon;",
- "&Phi;",
- "&Chi;",
- "&Psi;",
- "&Omega;",
- "&alpha;",
- "&beta;",
- "&gamma;",
- "&delta;",
- "&epsilon;",
- "&zeta;",
- "&eta;",
- "&theta;",
- "&iota;",
- "&kappa;",
- "&lambda;",
- "&mu;",
- "&nu;",
- "&xi;",
- "&omicron;",
- "&pi;",
- "&rho;",
- "&sigmaf;",
- "&sigma;",
- "&tau;",
- "&upsilon;",
- "&phi;",
- "&chi;",
- "&psi;",
- "&omega;",
- "&thetasym;",
- "&upsih;",
- "&piv;",
- "&ensp;",
- "&emsp;",
- "&thinsp;",
- "&zwnj;",
- "&zwj;",
- "&lrm;",
- "&rlm;",
- "&ndash;",
- "&mdash;",
- "&lsquo;",
- "&rsquo;",
- "&sbquo;",
- "&ldquo;",
- "&rdquo;",
- "&bdquo;",
- "&dagger;",
- "&Dagger;",
- "&bull;",
- "&hellip;",
- "&permil;",
- "&prime;",
- "&Prime;",
- "&lsaquo;",
- "&rsaquo;",
- "&oline;",
- "&frasl;",
- "&euro;",
- "&image;",
- "&weierp;",
- "&real;",
- "&trade;",
- "&alefsym;",
- "&larr;",
- "&uarr;",
- "&rarr;",
- "&darr;",
- "&harr;",
- "&crarr;",
- "&lArr;",
- "&uArr;",
- "&rArr;",
- "&dArr;",
- "&hArr;",
- "&forall;",
- "&part;",
- "&exist;",
- "&empty;",
- "&nabla;",
- "&isin;",
- "&notin;",
- "&ni;",
- "&prod;",
- "&sum;",
- "&minus;",
- "&lowast;",
- "&radic;",
- "&prop;",
- "&infin;",
- "&ang;",
- "&and;",
- "&or;",
- "&cap;",
- "&cup;",
- "&int;",
- "&there4;",
- "&sim;",
- "&cong;",
- "&asymp;",
- "&ne;",
- "&equiv;",
- "&le;",
- "&ge;",
- "&sub;",
- "&sup;",
- "&nsub;",
- "&sube;",
- "&supe;",
- "&oplus;",
- "&otimes;",
- "&perp;",
- "&sdot;",
- "&lceil;",
- "&rceil;",
- "&lfloor;",
- "&rfloor;",
- "&lang;",
- "&rang;",
- "&loz;",
- "&spades;",
- "&clubs;",
- "&hearts;",
- "&diams;"
+ "&quot;",
+ "&amp;",
+ "&lt;",
+ "&gt;",
+ "&nbsp;",
+ "&iexcl;",
+ "&cent;",
+ "&pound;",
+ "&curren;",
+ "&yen;",
+ "&brvbar;",
+ "&sect;",
+ "&uml;",
+ "&copy;",
+ "&ordf;",
+ "&laquo;",
+ "&not;",
+ "&shy;",
+ "&reg;",
+ "&macr;",
+ "&deg;",
+ "&plusmn;",
+ "&sup2;",
+ "&sup3;",
+ "&acute;",
+ "&micro;",
+ "&para;",
+ "&middot;",
+ "&cedil;",
+ "&sup1;",
+ "&ordm;",
+ "&raquo;",
+ "&frac14;",
+ "&frac12;",
+ "&frac34;",
+ "&iquest;",
+ "&Agrave;",
+ "&Aacute;",
+ "&Acirc;",
+ "&Atilde;",
+ "&Auml;",
+ "&Aring;",
+ "&AElig;",
+ "&Ccedil;",
+ "&Egrave;",
+ "&Eacute;",
+ "&Ecirc;",
+ "&Euml;",
+ "&Igrave;",
+ "&Iacute;",
+ "&Icirc;",
+ "&Iuml;",
+ "&ETH;",
+ "&Ntilde;",
+ "&Ograve;",
+ "&Oacute;",
+ "&Ocirc;",
+ "&Otilde;",
+ "&Ouml;",
+ "&times;",
+ "&Oslash;",
+ "&Ugrave;",
+ "&Uacute;",
+ "&Ucirc;",
+ "&Uuml;",
+ "&Yacute;",
+ "&THORN;",
+ "&szlig;",
+ "&agrave;",
+ "&aacute;",
+ "&acirc;",
+ "&atilde;",
+ "&auml;",
+ "&aring;",
+ "&aelig;",
+ "&ccedil;",
+ "&egrave;",
+ "&eacute;",
+ "&ecirc;",
+ "&euml;",
+ "&igrave;",
+ "&iacute;",
+ "&icirc;",
+ "&iuml;",
+ "&eth;",
+ "&ntilde;",
+ "&ograve;",
+ "&oacute;",
+ "&ocirc;",
+ "&otilde;",
+ "&ouml;",
+ "&divide;",
+ "&oslash;",
+ "&ugrave;",
+ "&uacute;",
+ "&ucirc;",
+ "&uuml;",
+ "&yacute;",
+ "&thorn;",
+ "&yuml;",
+ "&OElig;",
+ "&oelig;",
+ "&Scaron;",
+ "&scaron;",
+ "&Yuml;",
+ "&fnof;",
+ "&circ;",
+ "&tilde;",
+ "&Alpha;",
+ "&Beta;",
+ "&Gamma;",
+ "&Delta;",
+ "&Epsilon;",
+ "&Zeta;",
+ "&Eta;",
+ "&Theta;",
+ "&Iota;",
+ "&Kappa;",
+ "&Lambda;",
+ "&Mu;",
+ "&Nu;",
+ "&Xi;",
+ "&Omicron;",
+ "&Pi;",
+ "&Rho;",
+ "&Sigma;",
+ "&Tau;",
+ "&Upsilon;",
+ "&Phi;",
+ "&Chi;",
+ "&Psi;",
+ "&Omega;",
+ "&alpha;",
+ "&beta;",
+ "&gamma;",
+ "&delta;",
+ "&epsilon;",
+ "&zeta;",
+ "&eta;",
+ "&theta;",
+ "&iota;",
+ "&kappa;",
+ "&lambda;",
+ "&mu;",
+ "&nu;",
+ "&xi;",
+ "&omicron;",
+ "&pi;",
+ "&rho;",
+ "&sigmaf;",
+ "&sigma;",
+ "&tau;",
+ "&upsilon;",
+ "&phi;",
+ "&chi;",
+ "&psi;",
+ "&omega;",
+ "&thetasym;",
+ "&upsih;",
+ "&piv;",
+ "&ensp;",
+ "&emsp;",
+ "&thinsp;",
+ "&zwnj;",
+ "&zwj;",
+ "&lrm;",
+ "&rlm;",
+ "&ndash;",
+ "&mdash;",
+ "&lsquo;",
+ "&rsquo;",
+ "&sbquo;",
+ "&ldquo;",
+ "&rdquo;",
+ "&bdquo;",
+ "&dagger;",
+ "&Dagger;",
+ "&bull;",
+ "&hellip;",
+ "&permil;",
+ "&prime;",
+ "&Prime;",
+ "&lsaquo;",
+ "&rsaquo;",
+ "&oline;",
+ "&frasl;",
+ "&euro;",
+ "&image;",
+ "&weierp;",
+ "&real;",
+ "&trade;",
+ "&alefsym;",
+ "&larr;",
+ "&uarr;",
+ "&rarr;",
+ "&darr;",
+ "&harr;",
+ "&crarr;",
+ "&lArr;",
+ "&uArr;",
+ "&rArr;",
+ "&dArr;",
+ "&hArr;",
+ "&forall;",
+ "&part;",
+ "&exist;",
+ "&empty;",
+ "&nabla;",
+ "&isin;",
+ "&notin;",
+ "&ni;",
+ "&prod;",
+ "&sum;",
+ "&minus;",
+ "&lowast;",
+ "&radic;",
+ "&prop;",
+ "&infin;",
+ "&ang;",
+ "&and;",
+ "&or;",
+ "&cap;",
+ "&cup;",
+ "&int;",
+ "&there4;",
+ "&sim;",
+ "&cong;",
+ "&asymp;",
+ "&ne;",
+ "&equiv;",
+ "&le;",
+ "&ge;",
+ "&sub;",
+ "&sup;",
+ "&nsub;",
+ "&sube;",
+ "&supe;",
+ "&oplus;",
+ "&otimes;",
+ "&perp;",
+ "&sdot;",
+ "&lceil;",
+ "&rceil;",
+ "&lfloor;",
+ "&rfloor;",
+ "&lang;",
+ "&rang;",
+ "&loz;",
+ "&spades;",
+ "&clubs;",
+ "&hearts;",
+ "&diams;"
);
foreach ($map as $str) {
diff --git a/ext/standard/tests/strings/html_entity_decode_html5.phpt b/ext/standard/tests/strings/html_entity_decode_html5.phpt
index 6e0d4cf167..81f692c5dc 100644
--- a/ext/standard/tests/strings/html_entity_decode_html5.phpt
+++ b/ext/standard/tests/strings/html_entity_decode_html5.phpt
@@ -3,2131 +3,2131 @@ html_entity_decode() conformance check (HTML 5)
--FILE--
<?php
$map = array(
- "&AElig;",
- "&AMP;",
- "&Aacute;",
- "&Abreve;",
- "&Acirc;",
- "&Acy;",
- "&Afr;",
- "&Agrave;",
- "&Alpha;",
- "&Amacr;",
- "&And;",
- "&Aogon;",
- "&Aopf;",
- "&ApplyFunction;",
- "&Aring;",
- "&Ascr;",
- "&Assign;",
- "&Atilde;",
- "&Auml;",
- "&Backslash;",
- "&Barv;",
- "&Barwed;",
- "&Bcy;",
- "&Because;",
- "&Bernoullis;",
- "&Beta;",
- "&Bfr;",
- "&Bopf;",
- "&Breve;",
- "&Bscr;",
- "&Bumpeq;",
- "&CHcy;",
- "&COPY;",
- "&Cacute;",
- "&Cap;",
- "&CapitalDifferentialD;",
- "&Cayleys;",
- "&Ccaron;",
- "&Ccedil;",
- "&Ccirc;",
- "&Cconint;",
- "&Cdot;",
- "&Cedilla;",
- "&CenterDot;",
- "&Cfr;",
- "&Chi;",
- "&CircleDot;",
- "&CircleMinus;",
- "&CirclePlus;",
- "&CircleTimes;",
- "&ClockwiseContourIntegral;",
- "&CloseCurlyDoubleQuote;",
- "&CloseCurlyQuote;",
- "&Colon;",
- "&Colone;",
- "&Congruent;",
- "&Conint;",
- "&ContourIntegral;",
- "&Copf;",
- "&Coproduct;",
- "&CounterClockwiseContourIntegral;",
- "&Cross;",
- "&Cscr;",
- "&Cup;",
- "&CupCap;",
- "&DD;",
- "&DDotrahd;",
- "&DJcy;",
- "&DScy;",
- "&DZcy;",
- "&Dagger;",
- "&Darr;",
- "&Dashv;",
- "&Dcaron;",
- "&Dcy;",
- "&Del;",
- "&Delta;",
- "&Dfr;",
- "&DiacriticalAcute;",
- "&DiacriticalDot;",
- "&DiacriticalDoubleAcute;",
- "&DiacriticalGrave;",
- "&DiacriticalTilde;",
- "&Diamond;",
- "&DifferentialD;",
- "&Dopf;",
- "&Dot;",
- "&DotDot;",
- "&DotEqual;",
- "&DoubleContourIntegral;",
- "&DoubleDot;",
- "&DoubleDownArrow;",
- "&DoubleLeftArrow;",
- "&DoubleLeftRightArrow;",
- "&DoubleLeftTee;",
- "&DoubleLongLeftArrow;",
- "&DoubleLongLeftRightArrow;",
- "&DoubleLongRightArrow;",
- "&DoubleRightArrow;",
- "&DoubleRightTee;",
- "&DoubleUpArrow;",
- "&DoubleUpDownArrow;",
- "&DoubleVerticalBar;",
- "&DownArrow;",
- "&DownArrowBar;",
- "&DownArrowUpArrow;",
- "&DownBreve;",
- "&DownLeftRightVector;",
- "&DownLeftTeeVector;",
- "&DownLeftVector;",
- "&DownLeftVectorBar;",
- "&DownRightTeeVector;",
- "&DownRightVector;",
- "&DownRightVectorBar;",
- "&DownTee;",
- "&DownTeeArrow;",
- "&Downarrow;",
- "&Dscr;",
- "&Dstrok;",
- "&ENG;",
- "&ETH;",
- "&Eacute;",
- "&Ecaron;",
- "&Ecirc;",
- "&Ecy;",
- "&Edot;",
- "&Efr;",
- "&Egrave;",
- "&Element;",
- "&Emacr;",
- "&EmptySmallSquare;",
- "&EmptyVerySmallSquare;",
- "&Eogon;",
- "&Eopf;",
- "&Epsilon;",
- "&Equal;",
- "&EqualTilde;",
- "&Equilibrium;",
- "&Escr;",
- "&Esim;",
- "&Eta;",
- "&Euml;",
- "&Exists;",
- "&ExponentialE;",
- "&Fcy;",
- "&Ffr;",
- "&FilledSmallSquare;",
- "&FilledVerySmallSquare;",
- "&Fopf;",
- "&ForAll;",
- "&Fouriertrf;",
- "&Fscr;",
- "&GJcy;",
- "&GT;",
- "&Gamma;",
- "&Gammad;",
- "&Gbreve;",
- "&Gcedil;",
- "&Gcirc;",
- "&Gcy;",
- "&Gdot;",
- "&Gfr;",
- "&Gg;",
- "&Gopf;",
- "&GreaterEqual;",
- "&GreaterEqualLess;",
- "&GreaterFullEqual;",
- "&GreaterGreater;",
- "&GreaterLess;",
- "&GreaterSlantEqual;",
- "&GreaterTilde;",
- "&Gscr;",
- "&Gt;",
- "&HARDcy;",
- "&Hacek;",
- "&Hat;",
- "&Hcirc;",
- "&Hfr;",
- "&HilbertSpace;",
- "&Hopf;",
- "&HorizontalLine;",
- "&Hscr;",
- "&Hstrok;",
- "&HumpDownHump;",
- "&HumpEqual;",
- "&IEcy;",
- "&IJlig;",
- "&IOcy;",
- "&Iacute;",
- "&Icirc;",
- "&Icy;",
- "&Idot;",
- "&Ifr;",
- "&Igrave;",
- "&Im;",
- "&Imacr;",
- "&ImaginaryI;",
- "&Implies;",
- "&Int;",
- "&Integral;",
- "&Intersection;",
- "&InvisibleComma;",
- "&InvisibleTimes;",
- "&Iogon;",
- "&Iopf;",
- "&Iota;",
- "&Iscr;",
- "&Itilde;",
- "&Iukcy;",
- "&Iuml;",
- "&Jcirc;",
- "&Jcy;",
- "&Jfr;",
- "&Jopf;",
- "&Jscr;",
- "&Jsercy;",
- "&Jukcy;",
- "&KHcy;",
- "&KJcy;",
- "&Kappa;",
- "&Kcedil;",
- "&Kcy;",
- "&Kfr;",
- "&Kopf;",
- "&Kscr;",
- "&LJcy;",
- "&LT;",
- "&Lacute;",
- "&Lambda;",
- "&Lang;",
- "&Laplacetrf;",
- "&Larr;",
- "&Lcaron;",
- "&Lcedil;",
- "&Lcy;",
- "&LeftAngleBracket;",
- "&LeftArrow;",
- "&LeftArrowBar;",
- "&LeftArrowRightArrow;",
- "&LeftCeiling;",
- "&LeftDoubleBracket;",
- "&LeftDownTeeVector;",
- "&LeftDownVector;",
- "&LeftDownVectorBar;",
- "&LeftFloor;",
- "&LeftRightArrow;",
- "&LeftRightVector;",
- "&LeftTee;",
- "&LeftTeeArrow;",
- "&LeftTeeVector;",
- "&LeftTriangle;",
- "&LeftTriangleBar;",
- "&LeftTriangleEqual;",
- "&LeftUpDownVector;",
- "&LeftUpTeeVector;",
- "&LeftUpVector;",
- "&LeftUpVectorBar;",
- "&LeftVector;",
- "&LeftVectorBar;",
- "&Leftarrow;",
- "&Leftrightarrow;",
- "&LessEqualGreater;",
- "&LessFullEqual;",
- "&LessGreater;",
- "&LessLess;",
- "&LessSlantEqual;",
- "&LessTilde;",
- "&Lfr;",
- "&Ll;",
- "&Lleftarrow;",
- "&Lmidot;",
- "&LongLeftArrow;",
- "&LongLeftRightArrow;",
- "&LongRightArrow;",
- "&Longleftarrow;",
- "&Longleftrightarrow;",
- "&Longrightarrow;",
- "&Lopf;",
- "&LowerLeftArrow;",
- "&LowerRightArrow;",
- "&Lscr;",
- "&Lsh;",
- "&Lstrok;",
- "&Lt;",
- "&Map;",
- "&Mcy;",
- "&MediumSpace;",
- "&Mellintrf;",
- "&Mfr;",
- "&MinusPlus;",
- "&Mopf;",
- "&Mscr;",
- "&Mu;",
- "&NJcy;",
- "&Nacute;",
- "&Ncaron;",
- "&Ncedil;",
- "&Ncy;",
- "&NegativeMediumSpace;",
- "&NegativeThickSpace;",
- "&NegativeThinSpace;",
- "&NegativeVeryThinSpace;",
- "&NestedGreaterGreater;",
- "&NestedLessLess;",
- "&NewLine;",
- "&Nfr;",
- "&NoBreak;",
- "&NonBreakingSpace;",
- "&Nopf;",
- "&Not;",
- "&NotCongruent;",
- "&NotCupCap;",
- "&NotDoubleVerticalBar;",
- "&NotElement;",
- "&NotEqual;",
- "&NotEqualTilde;",
- "&NotExists;",
- "&NotGreater;",
- "&NotGreaterEqual;",
- "&NotGreaterFullEqual;",
- "&NotGreaterGreater;",
- "&NotGreaterLess;",
- "&NotGreaterSlantEqual;",
- "&NotGreaterTilde;",
- "&NotHumpDownHump;",
- "&NotHumpEqual;",
- "&NotLeftTriangle;",
- "&NotLeftTriangleBar;",
- "&NotLeftTriangleEqual;",
- "&NotLess;",
- "&NotLessEqual;",
- "&NotLessGreater;",
- "&NotLessLess;",
- "&NotLessSlantEqual;",
- "&NotLessTilde;",
- "&NotNestedGreaterGreater;",
- "&NotNestedLessLess;",
- "&NotPrecedes;",
- "&NotPrecedesEqual;",
- "&NotPrecedesSlantEqual;",
- "&NotReverseElement;",
- "&NotRightTriangle;",
- "&NotRightTriangleBar;",
- "&NotRightTriangleEqual;",
- "&NotSquareSubset;",
- "&NotSquareSubsetEqual;",
- "&NotSquareSuperset;",
- "&NotSquareSupersetEqual;",
- "&NotSubset;",
- "&NotSubsetEqual;",
- "&NotSucceeds;",
- "&NotSucceedsEqual;",
- "&NotSucceedsSlantEqual;",
- "&NotSucceedsTilde;",
- "&NotSuperset;",
- "&NotSupersetEqual;",
- "&NotTilde;",
- "&NotTildeEqual;",
- "&NotTildeFullEqual;",
- "&NotTildeTilde;",
- "&NotVerticalBar;",
- "&Nscr;",
- "&Ntilde;",
- "&Nu;",
- "&OElig;",
- "&Oacute;",
- "&Ocirc;",
- "&Ocy;",
- "&Odblac;",
- "&Ofr;",
- "&Ograve;",
- "&Omacr;",
- "&Omega;",
- "&Omicron;",
- "&Oopf;",
- "&OpenCurlyDoubleQuote;",
- "&OpenCurlyQuote;",
- "&Or;",
- "&Oscr;",
- "&Oslash;",
- "&Otilde;",
- "&Otimes;",
- "&Ouml;",
- "&OverBar;",
- "&OverBrace;",
- "&OverBracket;",
- "&OverParenthesis;",
- "&PartialD;",
- "&Pcy;",
- "&Pfr;",
- "&Phi;",
- "&Pi;",
- "&PlusMinus;",
- "&Poincareplane;",
- "&Popf;",
- "&Pr;",
- "&Precedes;",
- "&PrecedesEqual;",
- "&PrecedesSlantEqual;",
- "&PrecedesTilde;",
- "&Prime;",
- "&Product;",
- "&Proportion;",
- "&Proportional;",
- "&Pscr;",
- "&Psi;",
- "&QUOT;",
- "&Qfr;",
- "&Qopf;",
- "&Qscr;",
- "&RBarr;",
- "&REG;",
- "&Racute;",
- "&Rang;",
- "&Rarr;",
- "&Rarrtl;",
- "&Rcaron;",
- "&Rcedil;",
- "&Rcy;",
- "&Re;",
- "&ReverseElement;",
- "&ReverseEquilibrium;",
- "&ReverseUpEquilibrium;",
- "&Rfr;",
- "&Rho;",
- "&RightAngleBracket;",
- "&RightArrow;",
- "&RightArrowBar;",
- "&RightArrowLeftArrow;",
- "&RightCeiling;",
- "&RightDoubleBracket;",
- "&RightDownTeeVector;",
- "&RightDownVector;",
- "&RightDownVectorBar;",
- "&RightFloor;",
- "&RightTee;",
- "&RightTeeArrow;",
- "&RightTeeVector;",
- "&RightTriangle;",
- "&RightTriangleBar;",
- "&RightTriangleEqual;",
- "&RightUpDownVector;",
- "&RightUpTeeVector;",
- "&RightUpVector;",
- "&RightUpVectorBar;",
- "&RightVector;",
- "&RightVectorBar;",
- "&Rightarrow;",
- "&Ropf;",
- "&RoundImplies;",
- "&Rrightarrow;",
- "&Rscr;",
- "&Rsh;",
- "&RuleDelayed;",
- "&SHCHcy;",
- "&SHcy;",
- "&SOFTcy;",
- "&Sacute;",
- "&Sc;",
- "&Scaron;",
- "&Scedil;",
- "&Scirc;",
- "&Scy;",
- "&Sfr;",
- "&ShortDownArrow;",
- "&ShortLeftArrow;",
- "&ShortRightArrow;",
- "&ShortUpArrow;",
- "&Sigma;",
- "&SmallCircle;",
- "&Sopf;",
- "&Sqrt;",
- "&Square;",
- "&SquareIntersection;",
- "&SquareSubset;",
- "&SquareSubsetEqual;",
- "&SquareSuperset;",
- "&SquareSupersetEqual;",
- "&SquareUnion;",
- "&Sscr;",
- "&Star;",
- "&Sub;",
- "&Subset;",
- "&SubsetEqual;",
- "&Succeeds;",
- "&SucceedsEqual;",
- "&SucceedsSlantEqual;",
- "&SucceedsTilde;",
- "&SuchThat;",
- "&Sum;",
- "&Sup;",
- "&Superset;",
- "&SupersetEqual;",
- "&Supset;",
- "&THORN;",
- "&TRADE;",
- "&TSHcy;",
- "&TScy;",
- "&Tab;",
- "&Tau;",
- "&Tcaron;",
- "&Tcedil;",
- "&Tcy;",
- "&Tfr;",
- "&Therefore;",
- "&Theta;",
- "&ThickSpace;",
- "&ThinSpace;",
- "&Tilde;",
- "&TildeEqual;",
- "&TildeFullEqual;",
- "&TildeTilde;",
- "&Topf;",
- "&TripleDot;",
- "&Tscr;",
- "&Tstrok;",
- "&Uacute;",
- "&Uarr;",
- "&Uarrocir;",
- "&Ubrcy;",
- "&Ubreve;",
- "&Ucirc;",
- "&Ucy;",
- "&Udblac;",
- "&Ufr;",
- "&Ugrave;",
- "&Umacr;",
- "&UnderBar;",
- "&UnderBrace;",
- "&UnderBracket;",
- "&UnderParenthesis;",
- "&Union;",
- "&UnionPlus;",
- "&Uogon;",
- "&Uopf;",
- "&UpArrow;",
- "&UpArrowBar;",
- "&UpArrowDownArrow;",
- "&UpDownArrow;",
- "&UpEquilibrium;",
- "&UpTee;",
- "&UpTeeArrow;",
- "&Uparrow;",
- "&Updownarrow;",
- "&UpperLeftArrow;",
- "&UpperRightArrow;",
- "&Upsi;",
- "&Upsilon;",
- "&Uring;",
- "&Uscr;",
- "&Utilde;",
- "&Uuml;",
- "&VDash;",
- "&Vbar;",
- "&Vcy;",
- "&Vdash;",
- "&Vdashl;",
- "&Vee;",
- "&Verbar;",
- "&Vert;",
- "&VerticalBar;",
- "&VerticalLine;",
- "&VerticalSeparator;",
- "&VerticalTilde;",
- "&VeryThinSpace;",
- "&Vfr;",
- "&Vopf;",
- "&Vscr;",
- "&Vvdash;",
- "&Wcirc;",
- "&Wedge;",
- "&Wfr;",
- "&Wopf;",
- "&Wscr;",
- "&Xfr;",
- "&Xi;",
- "&Xopf;",
- "&Xscr;",
- "&YAcy;",
- "&YIcy;",
- "&YUcy;",
- "&Yacute;",
- "&Ycirc;",
- "&Ycy;",
- "&Yfr;",
- "&Yopf;",
- "&Yscr;",
- "&Yuml;",
- "&ZHcy;",
- "&Zacute;",
- "&Zcaron;",
- "&Zcy;",
- "&Zdot;",
- "&ZeroWidthSpace;",
- "&Zeta;",
- "&Zfr;",
- "&Zopf;",
- "&Zscr;",
- "&aacute;",
- "&abreve;",
- "&ac;",
- "&acE;",
- "&acd;",
- "&acirc;",
- "&acute;",
- "&acy;",
- "&aelig;",
- "&af;",
- "&afr;",
- "&agrave;",
- "&alefsym;",
- "&aleph;",
- "&alpha;",
- "&amacr;",
- "&amalg;",
- "&amp;",
- "&and;",
- "&andand;",
- "&andd;",
- "&andslope;",
- "&andv;",
- "&ang;",
- "&ange;",
- "&angle;",
- "&angmsd;",
- "&angmsdaa;",
- "&angmsdab;",
- "&angmsdac;",
- "&angmsdad;",
- "&angmsdae;",
- "&angmsdaf;",
- "&angmsdag;",
- "&angmsdah;",
- "&angrt;",
- "&angrtvb;",
- "&angrtvbd;",
- "&angsph;",
- "&angst;",
- "&angzarr;",
- "&aogon;",
- "&aopf;",
- "&ap;",
- "&apE;",
- "&apacir;",
- "&ape;",
- "&apid;",
- "&apos;",
- "&approx;",
- "&approxeq;",
- "&aring;",
- "&ascr;",
- "&ast;",
- "&asymp;",
- "&asympeq;",
- "&atilde;",
- "&auml;",
- "&awconint;",
- "&awint;",
- "&bNot;",
- "&backcong;",
- "&backepsilon;",
- "&backprime;",
- "&backsim;",
- "&backsimeq;",
- "&barvee;",
- "&barwed;",
- "&barwedge;",
- "&bbrk;",
- "&bbrktbrk;",
- "&bcong;",
- "&bcy;",
- "&bdquo;",
- "&becaus;",
- "&because;",
- "&bemptyv;",
- "&bepsi;",
- "&bernou;",
- "&beta;",
- "&beth;",
- "&between;",
- "&bfr;",
- "&bigcap;",
- "&bigcirc;",
- "&bigcup;",
- "&bigodot;",
- "&bigoplus;",
- "&bigotimes;",
- "&bigsqcup;",
- "&bigstar;",
- "&bigtriangledown;",
- "&bigtriangleup;",
- "&biguplus;",
- "&bigvee;",
- "&bigwedge;",
- "&bkarow;",
- "&blacklozenge;",
- "&blacksquare;",
- "&blacktriangle;",
- "&blacktriangledown;",
- "&blacktriangleleft;",
- "&blacktriangleright;",
- "&blank;",
- "&blk12;",
- "&blk14;",
- "&blk34;",
- "&block;",
- "&bne;",
- "&bnequiv;",
- "&bnot;",
- "&bopf;",
- "&bot;",
- "&bottom;",
- "&bowtie;",
- "&boxDL;",
- "&boxDR;",
- "&boxDl;",
- "&boxDr;",
- "&boxH;",
- "&boxHD;",
- "&boxHU;",
- "&boxHd;",
- "&boxHu;",
- "&boxUL;",
- "&boxUR;",
- "&boxUl;",
- "&boxUr;",
- "&boxV;",
- "&boxVH;",
- "&boxVL;",
- "&boxVR;",
- "&boxVh;",
- "&boxVl;",
- "&boxVr;",
- "&boxbox;",
- "&boxdL;",
- "&boxdR;",
- "&boxdl;",
- "&boxdr;",
- "&boxh;",
- "&boxhD;",
- "&boxhU;",
- "&boxhd;",
- "&boxhu;",
- "&boxminus;",
- "&boxplus;",
- "&boxtimes;",
- "&boxuL;",
- "&boxuR;",
- "&boxul;",
- "&boxur;",
- "&boxv;",
- "&boxvH;",
- "&boxvL;",
- "&boxvR;",
- "&boxvh;",
- "&boxvl;",
- "&boxvr;",
- "&bprime;",
- "&breve;",
- "&brvbar;",
- "&bscr;",
- "&bsemi;",
- "&bsim;",
- "&bsime;",
- "&bsol;",
- "&bsolb;",
- "&bsolhsub;",
- "&bull;",
- "&bullet;",
- "&bump;",
- "&bumpE;",
- "&bumpe;",
- "&bumpeq;",
- "&cacute;",
- "&cap;",
- "&capand;",
- "&capbrcup;",
- "&capcap;",
- "&capcup;",
- "&capdot;",
- "&caps;",
- "&caret;",
- "&caron;",
- "&ccaps;",
- "&ccaron;",
- "&ccedil;",
- "&ccirc;",
- "&ccups;",
- "&ccupssm;",
- "&cdot;",
- "&cedil;",
- "&cemptyv;",
- "&cent;",
- "&centerdot;",
- "&cfr;",
- "&chcy;",
- "&check;",
- "&checkmark;",
- "&chi;",
- "&cir;",
- "&cirE;",
- "&circ;",
- "&circeq;",
- "&circlearrowleft;",
- "&circlearrowright;",
- "&circledR;",
- "&circledS;",
- "&circledast;",
- "&circledcirc;",
- "&circleddash;",
- "&cire;",
- "&cirfnint;",
- "&cirmid;",
- "&cirscir;",
- "&clubs;",
- "&clubsuit;",
- "&colon;",
- "&colone;",
- "&coloneq;",
- "&comma;",
- "&commat;",
- "&comp;",
- "&compfn;",
- "&complement;",
- "&complexes;",
- "&cong;",
- "&congdot;",
- "&conint;",
- "&copf;",
- "&coprod;",
- "&copy;",
- "&copysr;",
- "&crarr;",
- "&cross;",
- "&cscr;",
- "&csub;",
- "&csube;",
- "&csup;",
- "&csupe;",
- "&ctdot;",
- "&cudarrl;",
- "&cudarrr;",
- "&cuepr;",
- "&cuesc;",
- "&cularr;",
- "&cularrp;",
- "&cup;",
- "&cupbrcap;",
- "&cupcap;",
- "&cupcup;",
- "&cupdot;",
- "&cupor;",
- "&cups;",
- "&curarr;",
- "&curarrm;",
- "&curlyeqprec;",
- "&curlyeqsucc;",
- "&curlyvee;",
- "&curlywedge;",
- "&curren;",
- "&curvearrowleft;",
- "&curvearrowright;",
- "&cuvee;",
- "&cuwed;",
- "&cwconint;",
- "&cwint;",
- "&cylcty;",
- "&dArr;",
- "&dHar;",
- "&dagger;",
- "&daleth;",
- "&darr;",
- "&dash;",
- "&dashv;",
- "&dbkarow;",
- "&dblac;",
- "&dcaron;",
- "&dcy;",
- "&dd;",
- "&ddagger;",
- "&ddarr;",
- "&ddotseq;",
- "&deg;",
- "&delta;",
- "&demptyv;",
- "&dfisht;",
- "&dfr;",
- "&dharl;",
- "&dharr;",
- "&diam;",
- "&diamond;",
- "&diamondsuit;",
- "&diams;",
- "&die;",
- "&digamma;",
- "&disin;",
- "&div;",
- "&divide;",
- "&divideontimes;",
- "&divonx;",
- "&djcy;",
- "&dlcorn;",
- "&dlcrop;",
- "&dollar;",
- "&dopf;",
- "&dot;",
- "&doteq;",
- "&doteqdot;",
- "&dotminus;",
- "&dotplus;",
- "&dotsquare;",
- "&doublebarwedge;",
- "&downarrow;",
- "&downdownarrows;",
- "&downharpoonleft;",
- "&downharpoonright;",
- "&drbkarow;",
- "&drcorn;",
- "&drcrop;",
- "&dscr;",
- "&dscy;",
- "&dsol;",
- "&dstrok;",
- "&dtdot;",
- "&dtri;",
- "&dtrif;",
- "&duarr;",
- "&duhar;",
- "&dwangle;",
- "&dzcy;",
- "&dzigrarr;",
- "&eDDot;",
- "&eDot;",
- "&eacute;",
- "&easter;",
- "&ecaron;",
- "&ecir;",
- "&ecirc;",
- "&ecolon;",
- "&ecy;",
- "&edot;",
- "&ee;",
- "&efDot;",
- "&efr;",
- "&eg;",
- "&egrave;",
- "&egs;",
- "&egsdot;",
- "&el;",
- "&elinters;",
- "&ell;",
- "&els;",
- "&elsdot;",
- "&emacr;",
- "&empty;",
- "&emptyset;",
- "&emptyv;",
- "&emsp;",
- "&emsp13;",
- "&emsp14;",
- "&eng;",
- "&ensp;",
- "&eogon;",
- "&eopf;",
- "&epar;",
- "&eparsl;",
- "&eplus;",
- "&epsi;",
- "&epsilon;",
- "&epsiv;",
- "&eqcirc;",
- "&eqcolon;",
- "&eqsim;",
- "&eqslantgtr;",
- "&eqslantless;",
- "&equals;",
- "&equest;",
- "&equiv;",
- "&equivDD;",
- "&eqvparsl;",
- "&erDot;",
- "&erarr;",
- "&escr;",
- "&esdot;",
- "&esim;",
- "&eta;",
- "&eth;",
- "&euml;",
- "&euro;",
- "&excl;",
- "&exist;",
- "&expectation;",
- "&exponentiale;",
- "&fallingdotseq;",
- "&fcy;",
- "&female;",
- "&ffilig;",
- "&fflig;",
- "&ffllig;",
- "&ffr;",
- "&filig;",
- "&fjlig;",
- "&flat;",
- "&fllig;",
- "&fltns;",
- "&fnof;",
- "&fopf;",
- "&forall;",
- "&fork;",
- "&forkv;",
- "&fpartint;",
- "&frac12;",
- "&frac13;",
- "&frac14;",
- "&frac15;",
- "&frac16;",
- "&frac18;",
- "&frac23;",
- "&frac25;",
- "&frac34;",
- "&frac35;",
- "&frac38;",
- "&frac45;",
- "&frac56;",
- "&frac58;",
- "&frac78;",
- "&frasl;",
- "&frown;",
- "&fscr;",
- "&gE;",
- "&gEl;",
- "&gacute;",
- "&gamma;",
- "&gammad;",
- "&gap;",
- "&gbreve;",
- "&gcirc;",
- "&gcy;",
- "&gdot;",
- "&ge;",
- "&gel;",
- "&geq;",
- "&geqq;",
- "&geqslant;",
- "&ges;",
- "&gescc;",
- "&gesdot;",
- "&gesdoto;",
- "&gesdotol;",
- "&gesl;",
- "&gesles;",
- "&gfr;",
- "&gg;",
- "&ggg;",
- "&gimel;",
- "&gjcy;",
- "&gl;",
- "&glE;",
- "&gla;",
- "&glj;",
- "&gnE;",
- "&gnap;",
- "&gnapprox;",
- "&gne;",
- "&gneq;",
- "&gneqq;",
- "&gnsim;",
- "&gopf;",
- "&grave;",
- "&gscr;",
- "&gsim;",
- "&gsime;",
- "&gsiml;",
- "&gt;",
- "&gtcc;",
- "&gtcir;",
- "&gtdot;",
- "&gtlPar;",
- "&gtquest;",
- "&gtrapprox;",
- "&gtrarr;",
- "&gtrdot;",
- "&gtreqless;",
- "&gtreqqless;",
- "&gtrless;",
- "&gtrsim;",
- "&gvertneqq;",
- "&gvnE;",
- "&hArr;",
- "&hairsp;",
- "&half;",
- "&hamilt;",
- "&hardcy;",
- "&harr;",
- "&harrcir;",
- "&harrw;",
- "&hbar;",
- "&hcirc;",
- "&hearts;",
- "&heartsuit;",
- "&hellip;",
- "&hercon;",
- "&hfr;",
- "&hksearow;",
- "&hkswarow;",
- "&hoarr;",
- "&homtht;",
- "&hookleftarrow;",
- "&hookrightarrow;",
- "&hopf;",
- "&horbar;",
- "&hscr;",
- "&hslash;",
- "&hstrok;",
- "&hybull;",
- "&hyphen;",
- "&iacute;",
- "&ic;",
- "&icirc;",
- "&icy;",
- "&iecy;",
- "&iexcl;",
- "&iff;",
- "&ifr;",
- "&igrave;",
- "&ii;",
- "&iiiint;",
- "&iiint;",
- "&iinfin;",
- "&iiota;",
- "&ijlig;",
- "&imacr;",
- "&image;",
- "&imagline;",
- "&imagpart;",
- "&imath;",
- "&imof;",
- "&imped;",
- "&in;",
- "&incare;",
- "&infin;",
- "&infintie;",
- "&inodot;",
- "&int;",
- "&intcal;",
- "&integers;",
- "&intercal;",
- "&intlarhk;",
- "&intprod;",
- "&iocy;",
- "&iogon;",
- "&iopf;",
- "&iota;",
- "&iprod;",
- "&iquest;",
- "&iscr;",
- "&isin;",
- "&isinE;",
- "&isindot;",
- "&isins;",
- "&isinsv;",
- "&isinv;",
- "&it;",
- "&itilde;",
- "&iukcy;",
- "&iuml;",
- "&jcirc;",
- "&jcy;",
- "&jfr;",
- "&jmath;",
- "&jopf;",
- "&jscr;",
- "&jsercy;",
- "&jukcy;",
- "&kappa;",
- "&kappav;",
- "&kcedil;",
- "&kcy;",
- "&kfr;",
- "&kgreen;",
- "&khcy;",
- "&kjcy;",
- "&kopf;",
- "&kscr;",
- "&lAarr;",
- "&lArr;",
- "&lAtail;",
- "&lBarr;",
- "&lE;",
- "&lEg;",
- "&lHar;",
- "&lacute;",
- "&laemptyv;",
- "&lagran;",
- "&lambda;",
- "&lang;",
- "&langd;",
- "&langle;",
- "&lap;",
- "&laquo;",
- "&larr;",
- "&larrb;",
- "&larrbfs;",
- "&larrfs;",
- "&larrhk;",
- "&larrlp;",
- "&larrpl;",
- "&larrsim;",
- "&larrtl;",
- "&lat;",
- "&latail;",
- "&late;",
- "&lates;",
- "&lbarr;",
- "&lbbrk;",
- "&lbrace;",
- "&lbrack;",
- "&lbrke;",
- "&lbrksld;",
- "&lbrkslu;",
- "&lcaron;",
- "&lcedil;",
- "&lceil;",
- "&lcub;",
- "&lcy;",
- "&ldca;",
- "&ldquo;",
- "&ldquor;",
- "&ldrdhar;",
- "&ldrushar;",
- "&ldsh;",
- "&le;",
- "&leftarrow;",
- "&leftarrowtail;",
- "&leftharpoondown;",
- "&leftharpoonup;",
- "&leftleftarrows;",
- "&leftrightarrow;",
- "&leftrightarrows;",
- "&leftrightharpoons;",
- "&leftrightsquigarrow;",
- "&leftthreetimes;",
- "&leg;",
- "&leq;",
- "&leqq;",
- "&leqslant;",
- "&les;",
- "&lescc;",
- "&lesdot;",
- "&lesdoto;",
- "&lesdotor;",
- "&lesg;",
- "&lesges;",
- "&lessapprox;",
- "&lessdot;",
- "&lesseqgtr;",
- "&lesseqqgtr;",
- "&lessgtr;",
- "&lesssim;",
- "&lfisht;",
- "&lfloor;",
- "&lfr;",
- "&lg;",
- "&lgE;",
- "&lhard;",
- "&lharu;",
- "&lharul;",
- "&lhblk;",
- "&ljcy;",
- "&ll;",
- "&llarr;",
- "&llcorner;",
- "&llhard;",
- "&lltri;",
- "&lmidot;",
- "&lmoust;",
- "&lmoustache;",
- "&lnE;",
- "&lnap;",
- "&lnapprox;",
- "&lne;",
- "&lneq;",
- "&lneqq;",
- "&lnsim;",
- "&loang;",
- "&loarr;",
- "&lobrk;",
- "&longleftarrow;",
- "&longleftrightarrow;",
- "&longmapsto;",
- "&longrightarrow;",
- "&looparrowleft;",
- "&looparrowright;",
- "&lopar;",
- "&lopf;",
- "&loplus;",
- "&lotimes;",
- "&lowast;",
- "&lowbar;",
- "&loz;",
- "&lozenge;",
- "&lozf;",
- "&lpar;",
- "&lparlt;",
- "&lrarr;",
- "&lrcorner;",
- "&lrhar;",
- "&lrhard;",
- "&lrm;",
- "&lrtri;",
- "&lsaquo;",
- "&lscr;",
- "&lsh;",
- "&lsim;",
- "&lsime;",
- "&lsimg;",
- "&lsqb;",
- "&lsquo;",
- "&lsquor;",
- "&lstrok;",
- "&lt;",
- "&ltcc;",
- "&ltcir;",
- "&ltdot;",
- "&lthree;",
- "&ltimes;",
- "&ltlarr;",
- "&ltquest;",
- "&ltrPar;",
- "&ltri;",
- "&ltrie;",
- "&ltrif;",
- "&lurdshar;",
- "&luruhar;",
- "&lvertneqq;",
- "&lvnE;",
- "&mDDot;",
- "&macr;",
- "&male;",
- "&malt;",
- "&maltese;",
- "&map;",
- "&mapsto;",
- "&mapstodown;",
- "&mapstoleft;",
- "&mapstoup;",
- "&marker;",
- "&mcomma;",
- "&mcy;",
- "&mdash;",
- "&measuredangle;",
- "&mfr;",
- "&mho;",
- "&micro;",
- "&mid;",
- "&midast;",
- "&midcir;",
- "&middot;",
- "&minus;",
- "&minusb;",
- "&minusd;",
- "&minusdu;",
- "&mlcp;",
- "&mldr;",
- "&mnplus;",
- "&models;",
- "&mopf;",
- "&mp;",
- "&mscr;",
- "&mstpos;",
- "&mu;",
- "&multimap;",
- "&mumap;",
- "&nGg;",
- "&nGt;",
- "&nGtv;",
- "&nLeftarrow;",
- "&nLeftrightarrow;",
- "&nLl;",
- "&nLt;",
- "&nLtv;",
- "&nRightarrow;",
- "&nVDash;",
- "&nVdash;",
- "&nabla;",
- "&nacute;",
- "&nang;",
- "&nap;",
- "&napE;",
- "&napid;",
- "&napos;",
- "&napprox;",
- "&natur;",
- "&natural;",
- "&naturals;",
- "&nbsp;",
- "&nbump;",
- "&nbumpe;",
- "&ncap;",
- "&ncaron;",
- "&ncedil;",
- "&ncong;",
- "&ncongdot;",
- "&ncup;",
- "&ncy;",
- "&ndash;",
- "&ne;",
- "&neArr;",
- "&nearhk;",
- "&nearr;",
- "&nearrow;",
- "&nedot;",
- "&nequiv;",
- "&nesear;",
- "&nesim;",
- "&nexist;",
- "&nexists;",
- "&nfr;",
- "&ngE;",
- "&nge;",
- "&ngeq;",
- "&ngeqq;",
- "&ngeqslant;",
- "&nges;",
- "&ngsim;",
- "&ngt;",
- "&ngtr;",
- "&nhArr;",
- "&nharr;",
- "&nhpar;",
- "&ni;",
- "&nis;",
- "&nisd;",
- "&niv;",
- "&njcy;",
- "&nlArr;",
- "&nlE;",
- "&nlarr;",
- "&nldr;",
- "&nle;",
- "&nleftarrow;",
- "&nleftrightarrow;",
- "&nleq;",
- "&nleqq;",
- "&nleqslant;",
- "&nles;",
- "&nless;",
- "&nlsim;",
- "&nlt;",
- "&nltri;",
- "&nltrie;",
- "&nmid;",
- "&nopf;",
- "&not;",
- "&notin;",
- "&notinE;",
- "&notindot;",
- "&notinva;",
- "&notinvb;",
- "&notinvc;",
- "&notni;",
- "&notniva;",
- "&notnivb;",
- "&notnivc;",
- "&npar;",
- "&nparallel;",
- "&nparsl;",
- "&npart;",
- "&npolint;",
- "&npr;",
- "&nprcue;",
- "&npre;",
- "&nprec;",
- "&npreceq;",
- "&nrArr;",
- "&nrarr;",
- "&nrarrc;",
- "&nrarrw;",
- "&nrightarrow;",
- "&nrtri;",
- "&nrtrie;",
- "&nsc;",
- "&nsccue;",
- "&nsce;",
- "&nscr;",
- "&nshortmid;",
- "&nshortparallel;",
- "&nsim;",
- "&nsime;",
- "&nsimeq;",
- "&nsmid;",
- "&nspar;",
- "&nsqsube;",
- "&nsqsupe;",
- "&nsub;",
- "&nsubE;",
- "&nsube;",
- "&nsubset;",
- "&nsubseteq;",
- "&nsubseteqq;",
- "&nsucc;",
- "&nsucceq;",
- "&nsup;",
- "&nsupE;",
- "&nsupe;",
- "&nsupset;",
- "&nsupseteq;",
- "&nsupseteqq;",
- "&ntgl;",
- "&ntilde;",
- "&ntlg;",
- "&ntriangleleft;",
- "&ntrianglelefteq;",
- "&ntriangleright;",
- "&ntrianglerighteq;",
- "&nu;",
- "&num;",
- "&numero;",
- "&numsp;",
- "&nvDash;",
- "&nvHarr;",
- "&nvap;",
- "&nvdash;",
- "&nvge;",
- "&nvgt;",
- "&nvinfin;",
- "&nvlArr;",
- "&nvle;",
- "&nvlt;",
- "&nvltrie;",
- "&nvrArr;",
- "&nvrtrie;",
- "&nvsim;",
- "&nwArr;",
- "&nwarhk;",
- "&nwarr;",
- "&nwarrow;",
- "&nwnear;",
- "&oS;",
- "&oacute;",
- "&oast;",
- "&ocir;",
- "&ocirc;",
- "&ocy;",
- "&odash;",
- "&odblac;",
- "&odiv;",
- "&odot;",
- "&odsold;",
- "&oelig;",
- "&ofcir;",
- "&ofr;",
- "&ogon;",
- "&ograve;",
- "&ogt;",
- "&ohbar;",
- "&ohm;",
- "&oint;",
- "&olarr;",
- "&olcir;",
- "&olcross;",
- "&oline;",
- "&olt;",
- "&omacr;",
- "&omega;",
- "&omicron;",
- "&omid;",
- "&ominus;",
- "&oopf;",
- "&opar;",
- "&operp;",
- "&oplus;",
- "&or;",
- "&orarr;",
- "&ord;",
- "&order;",
- "&orderof;",
- "&ordf;",
- "&ordm;",
- "&origof;",
- "&oror;",
- "&orslope;",
- "&orv;",
- "&oscr;",
- "&oslash;",
- "&osol;",
- "&otilde;",
- "&otimes;",
- "&otimesas;",
- "&ouml;",
- "&ovbar;",
- "&par;",
- "&para;",
- "&parallel;",
- "&parsim;",
- "&parsl;",
- "&part;",
- "&pcy;",
- "&percnt;",
- "&period;",
- "&permil;",
- "&perp;",
- "&pertenk;",
- "&pfr;",
- "&phi;",
- "&phiv;",
- "&phmmat;",
- "&phone;",
- "&pi;",
- "&pitchfork;",
- "&piv;",
- "&planck;",
- "&planckh;",
- "&plankv;",
- "&plus;",
- "&plusacir;",
- "&plusb;",
- "&pluscir;",
- "&plusdo;",
- "&plusdu;",
- "&pluse;",
- "&plusmn;",
- "&plussim;",
- "&plustwo;",
- "&pm;",
- "&pointint;",
- "&popf;",
- "&pound;",
- "&pr;",
- "&prE;",
- "&prap;",
- "&prcue;",
- "&pre;",
- "&prec;",
- "&precapprox;",
- "&preccurlyeq;",
- "&preceq;",
- "&precnapprox;",
- "&precneqq;",
- "&precnsim;",
- "&precsim;",
- "&prime;",
- "&primes;",
- "&prnE;",
- "&prnap;",
- "&prnsim;",
- "&prod;",
- "&profalar;",
- "&profline;",
- "&profsurf;",
- "&prop;",
- "&propto;",
- "&prsim;",
- "&prurel;",
- "&pscr;",
- "&psi;",
- "&puncsp;",
- "&qfr;",
- "&qint;",
- "&qopf;",
- "&qprime;",
- "&qscr;",
- "&quaternions;",
- "&quatint;",
- "&quest;",
- "&questeq;",
- "&quot;",
- "&rAarr;",
- "&rArr;",
- "&rAtail;",
- "&rBarr;",
- "&rHar;",
- "&race;",
- "&racute;",
- "&radic;",
- "&raemptyv;",
- "&rang;",
- "&rangd;",
- "&range;",
- "&rangle;",
- "&raquo;",
- "&rarr;",
- "&rarrap;",
- "&rarrb;",
- "&rarrbfs;",
- "&rarrc;",
- "&rarrfs;",
- "&rarrhk;",
- "&rarrlp;",
- "&rarrpl;",
- "&rarrsim;",
- "&rarrtl;",
- "&rarrw;",
- "&ratail;",
- "&ratio;",
- "&rationals;",
- "&rbarr;",
- "&rbbrk;",
- "&rbrace;",
- "&rbrack;",
- "&rbrke;",
- "&rbrksld;",
- "&rbrkslu;",
- "&rcaron;",
- "&rcedil;",
- "&rceil;",
- "&rcub;",
- "&rcy;",
- "&rdca;",
- "&rdldhar;",
- "&rdquo;",
- "&rdquor;",
- "&rdsh;",
- "&real;",
- "&realine;",
- "&realpart;",
- "&reals;",
- "&rect;",
- "&reg;",
- "&rfisht;",
- "&rfloor;",
- "&rfr;",
- "&rhard;",
- "&rharu;",
- "&rharul;",
- "&rho;",
- "&rhov;",
- "&rightarrow;",
- "&rightarrowtail;",
- "&rightharpoondown;",
- "&rightharpoonup;",
- "&rightleftarrows;",
- "&rightleftharpoons;",
- "&rightrightarrows;",
- "&rightsquigarrow;",
- "&rightthreetimes;",
- "&ring;",
- "&risingdotseq;",
- "&rlarr;",
- "&rlhar;",
- "&rlm;",
- "&rmoust;",
- "&rmoustache;",
- "&rnmid;",
- "&roang;",
- "&roarr;",
- "&robrk;",
- "&ropar;",
- "&ropf;",
- "&roplus;",
- "&rotimes;",
- "&rpar;",
- "&rpargt;",
- "&rppolint;",
- "&rrarr;",
- "&rsaquo;",
- "&rscr;",
- "&rsh;",
- "&rsqb;",
- "&rsquo;",
- "&rsquor;",
- "&rthree;",
- "&rtimes;",
- "&rtri;",
- "&rtrie;",
- "&rtrif;",
- "&rtriltri;",
- "&ruluhar;",
- "&rx;",
- "&sacute;",
- "&sbquo;",
- "&sc;",
- "&scE;",
- "&scap;",
- "&scaron;",
- "&sccue;",
- "&sce;",
- "&scedil;",
- "&scirc;",
- "&scnE;",
- "&scnap;",
- "&scnsim;",
- "&scpolint;",
- "&scsim;",
- "&scy;",
- "&sdot;",
- "&sdotb;",
- "&sdote;",
- "&seArr;",
- "&searhk;",
- "&searr;",
- "&searrow;",
- "&sect;",
- "&semi;",
- "&seswar;",
- "&setminus;",
- "&setmn;",
- "&sext;",
- "&sfr;",
- "&sfrown;",
- "&sharp;",
- "&shchcy;",
- "&shcy;",
- "&shortmid;",
- "&shortparallel;",
- "&shy;",
- "&sigma;",
- "&sigmaf;",
- "&sigmav;",
- "&sim;",
- "&simdot;",
- "&sime;",
- "&simeq;",
- "&simg;",
- "&simgE;",
- "&siml;",
- "&simlE;",
- "&simne;",
- "&simplus;",
- "&simrarr;",
- "&slarr;",
- "&smallsetminus;",
- "&smashp;",
- "&smeparsl;",
- "&smid;",
- "&smile;",
- "&smt;",
- "&smte;",
- "&smtes;",
- "&softcy;",
- "&sol;",
- "&solb;",
- "&solbar;",
- "&sopf;",
- "&spades;",
- "&spadesuit;",
- "&spar;",
- "&sqcap;",
- "&sqcaps;",
- "&sqcup;",
- "&sqcups;",
- "&sqsub;",
- "&sqsube;",
- "&sqsubset;",
- "&sqsubseteq;",
- "&sqsup;",
- "&sqsupe;",
- "&sqsupset;",
- "&sqsupseteq;",
- "&squ;",
- "&square;",
- "&squarf;",
- "&squf;",
- "&srarr;",
- "&sscr;",
- "&ssetmn;",
- "&ssmile;",
- "&sstarf;",
- "&star;",
- "&starf;",
- "&straightepsilon;",
- "&straightphi;",
- "&strns;",
- "&sub;",
- "&subE;",
- "&subdot;",
- "&sube;",
- "&subedot;",
- "&submult;",
- "&subnE;",
- "&subne;",
- "&subplus;",
- "&subrarr;",
- "&subset;",
- "&subseteq;",
- "&subseteqq;",
- "&subsetneq;",
- "&subsetneqq;",
- "&subsim;",
- "&subsub;",
- "&subsup;",
- "&succ;",
- "&succapprox;",
- "&succcurlyeq;",
- "&succeq;",
- "&succnapprox;",
- "&succneqq;",
- "&succnsim;",
- "&succsim;",
- "&sum;",
- "&sung;",
- "&sup;",
- "&sup1;",
- "&sup2;",
- "&sup3;",
- "&supE;",
- "&supdot;",
- "&supdsub;",
- "&supe;",
- "&supedot;",
- "&suphsol;",
- "&suphsub;",
- "&suplarr;",
- "&supmult;",
- "&supnE;",
- "&supne;",
- "&supplus;",
- "&supset;",
- "&supseteq;",
- "&supseteqq;",
- "&supsetneq;",
- "&supsetneqq;",
- "&supsim;",
- "&supsub;",
- "&supsup;",
- "&swArr;",
- "&swarhk;",
- "&swarr;",
- "&swarrow;",
- "&swnwar;",
- "&szlig;",
- "&target;",
- "&tau;",
- "&tbrk;",
- "&tcaron;",
- "&tcedil;",
- "&tcy;",
- "&tdot;",
- "&telrec;",
- "&tfr;",
- "&there4;",
- "&therefore;",
- "&theta;",
- "&thetasym;",
- "&thetav;",
- "&thickapprox;",
- "&thicksim;",
- "&thinsp;",
- "&thkap;",
- "&thksim;",
- "&thorn;",
- "&tilde;",
- "&times;",
- "&timesb;",
- "&timesbar;",
- "&timesd;",
- "&tint;",
- "&toea;",
- "&top;",
- "&topbot;",
- "&topcir;",
- "&topf;",
- "&topfork;",
- "&tosa;",
- "&tprime;",
- "&trade;",
- "&triangle;",
- "&triangledown;",
- "&triangleleft;",
- "&trianglelefteq;",
- "&triangleq;",
- "&triangleright;",
- "&trianglerighteq;",
- "&tridot;",
- "&trie;",
- "&triminus;",
- "&triplus;",
- "&trisb;",
- "&tritime;",
- "&trpezium;",
- "&tscr;",
- "&tscy;",
- "&tshcy;",
- "&tstrok;",
- "&twixt;",
- "&twoheadleftarrow;",
- "&twoheadrightarrow;",
- "&uArr;",
- "&uHar;",
- "&uacute;",
- "&uarr;",
- "&ubrcy;",
- "&ubreve;",
- "&ucirc;",
- "&ucy;",
- "&udarr;",
- "&udblac;",
- "&udhar;",
- "&ufisht;",
- "&ufr;",
- "&ugrave;",
- "&uharl;",
- "&uharr;",
- "&uhblk;",
- "&ulcorn;",
- "&ulcorner;",
- "&ulcrop;",
- "&ultri;",
- "&umacr;",
- "&uml;",
- "&uogon;",
- "&uopf;",
- "&uparrow;",
- "&updownarrow;",
- "&upharpoonleft;",
- "&upharpoonright;",
- "&uplus;",
- "&upsi;",
- "&upsih;",
- "&upsilon;",
- "&upuparrows;",
- "&urcorn;",
- "&urcorner;",
- "&urcrop;",
- "&uring;",
- "&urtri;",
- "&uscr;",
- "&utdot;",
- "&utilde;",
- "&utri;",
- "&utrif;",
- "&uuarr;",
- "&uuml;",
- "&uwangle;",
- "&vArr;",
- "&vBar;",
- "&vBarv;",
- "&vDash;",
- "&vangrt;",
- "&varepsilon;",
- "&varkappa;",
- "&varnothing;",
- "&varphi;",
- "&varpi;",
- "&varpropto;",
- "&varr;",
- "&varrho;",
- "&varsigma;",
- "&varsubsetneq;",
- "&varsubsetneqq;",
- "&varsupsetneq;",
- "&varsupsetneqq;",
- "&vartheta;",
- "&vartriangleleft;",
- "&vartriangleright;",
- "&vcy;",
- "&vdash;",
- "&vee;",
- "&veebar;",
- "&veeeq;",
- "&vellip;",
- "&verbar;",
- "&vert;",
- "&vfr;",
- "&vltri;",
- "&vnsub;",
- "&vnsup;",
- "&vopf;",
- "&vprop;",
- "&vrtri;",
- "&vscr;",
- "&vsubnE;",
- "&vsubne;",
- "&vsupnE;",
- "&vsupne;",
- "&vzigzag;",
- "&wcirc;",
- "&wedbar;",
- "&wedge;",
- "&wedgeq;",
- "&weierp;",
- "&wfr;",
- "&wopf;",
- "&wp;",
- "&wr;",
- "&wreath;",
- "&wscr;",
- "&xcap;",
- "&xcirc;",
- "&xcup;",
- "&xdtri;",
- "&xfr;",
- "&xhArr;",
- "&xharr;",
- "&xi;",
- "&xlArr;",
- "&xlarr;",
- "&xmap;",
- "&xnis;",
- "&xodot;",
- "&xopf;",
- "&xoplus;",
- "&xotime;",
- "&xrArr;",
- "&xrarr;",
- "&xscr;",
- "&xsqcup;",
- "&xuplus;",
- "&xutri;",
- "&xvee;",
- "&xwedge;",
- "&yacute;",
- "&yacy;",
- "&ycirc;",
- "&ycy;",
- "&yen;",
- "&yfr;",
- "&yicy;",
- "&yopf;",
- "&yscr;",
- "&yucy;",
- "&yuml;",
- "&zacute;",
- "&zcaron;",
- "&zcy;",
- "&zdot;",
- "&zeetrf;",
- "&zeta;",
- "&zfr;",
- "&zhcy;",
- "&zigrarr;",
- "&zopf;",
- "&zscr;",
- "&zwj;",
- "&zwnj;",
+ "&AElig;",
+ "&AMP;",
+ "&Aacute;",
+ "&Abreve;",
+ "&Acirc;",
+ "&Acy;",
+ "&Afr;",
+ "&Agrave;",
+ "&Alpha;",
+ "&Amacr;",
+ "&And;",
+ "&Aogon;",
+ "&Aopf;",
+ "&ApplyFunction;",
+ "&Aring;",
+ "&Ascr;",
+ "&Assign;",
+ "&Atilde;",
+ "&Auml;",
+ "&Backslash;",
+ "&Barv;",
+ "&Barwed;",
+ "&Bcy;",
+ "&Because;",
+ "&Bernoullis;",
+ "&Beta;",
+ "&Bfr;",
+ "&Bopf;",
+ "&Breve;",
+ "&Bscr;",
+ "&Bumpeq;",
+ "&CHcy;",
+ "&COPY;",
+ "&Cacute;",
+ "&Cap;",
+ "&CapitalDifferentialD;",
+ "&Cayleys;",
+ "&Ccaron;",
+ "&Ccedil;",
+ "&Ccirc;",
+ "&Cconint;",
+ "&Cdot;",
+ "&Cedilla;",
+ "&CenterDot;",
+ "&Cfr;",
+ "&Chi;",
+ "&CircleDot;",
+ "&CircleMinus;",
+ "&CirclePlus;",
+ "&CircleTimes;",
+ "&ClockwiseContourIntegral;",
+ "&CloseCurlyDoubleQuote;",
+ "&CloseCurlyQuote;",
+ "&Colon;",
+ "&Colone;",
+ "&Congruent;",
+ "&Conint;",
+ "&ContourIntegral;",
+ "&Copf;",
+ "&Coproduct;",
+ "&CounterClockwiseContourIntegral;",
+ "&Cross;",
+ "&Cscr;",
+ "&Cup;",
+ "&CupCap;",
+ "&DD;",
+ "&DDotrahd;",
+ "&DJcy;",
+ "&DScy;",
+ "&DZcy;",
+ "&Dagger;",
+ "&Darr;",
+ "&Dashv;",
+ "&Dcaron;",
+ "&Dcy;",
+ "&Del;",
+ "&Delta;",
+ "&Dfr;",
+ "&DiacriticalAcute;",
+ "&DiacriticalDot;",
+ "&DiacriticalDoubleAcute;",
+ "&DiacriticalGrave;",
+ "&DiacriticalTilde;",
+ "&Diamond;",
+ "&DifferentialD;",
+ "&Dopf;",
+ "&Dot;",
+ "&DotDot;",
+ "&DotEqual;",
+ "&DoubleContourIntegral;",
+ "&DoubleDot;",
+ "&DoubleDownArrow;",
+ "&DoubleLeftArrow;",
+ "&DoubleLeftRightArrow;",
+ "&DoubleLeftTee;",
+ "&DoubleLongLeftArrow;",
+ "&DoubleLongLeftRightArrow;",
+ "&DoubleLongRightArrow;",
+ "&DoubleRightArrow;",
+ "&DoubleRightTee;",
+ "&DoubleUpArrow;",
+ "&DoubleUpDownArrow;",
+ "&DoubleVerticalBar;",
+ "&DownArrow;",
+ "&DownArrowBar;",
+ "&DownArrowUpArrow;",
+ "&DownBreve;",
+ "&DownLeftRightVector;",
+ "&DownLeftTeeVector;",
+ "&DownLeftVector;",
+ "&DownLeftVectorBar;",
+ "&DownRightTeeVector;",
+ "&DownRightVector;",
+ "&DownRightVectorBar;",
+ "&DownTee;",
+ "&DownTeeArrow;",
+ "&Downarrow;",
+ "&Dscr;",
+ "&Dstrok;",
+ "&ENG;",
+ "&ETH;",
+ "&Eacute;",
+ "&Ecaron;",
+ "&Ecirc;",
+ "&Ecy;",
+ "&Edot;",
+ "&Efr;",
+ "&Egrave;",
+ "&Element;",
+ "&Emacr;",
+ "&EmptySmallSquare;",
+ "&EmptyVerySmallSquare;",
+ "&Eogon;",
+ "&Eopf;",
+ "&Epsilon;",
+ "&Equal;",
+ "&EqualTilde;",
+ "&Equilibrium;",
+ "&Escr;",
+ "&Esim;",
+ "&Eta;",
+ "&Euml;",
+ "&Exists;",
+ "&ExponentialE;",
+ "&Fcy;",
+ "&Ffr;",
+ "&FilledSmallSquare;",
+ "&FilledVerySmallSquare;",
+ "&Fopf;",
+ "&ForAll;",
+ "&Fouriertrf;",
+ "&Fscr;",
+ "&GJcy;",
+ "&GT;",
+ "&Gamma;",
+ "&Gammad;",
+ "&Gbreve;",
+ "&Gcedil;",
+ "&Gcirc;",
+ "&Gcy;",
+ "&Gdot;",
+ "&Gfr;",
+ "&Gg;",
+ "&Gopf;",
+ "&GreaterEqual;",
+ "&GreaterEqualLess;",
+ "&GreaterFullEqual;",
+ "&GreaterGreater;",
+ "&GreaterLess;",
+ "&GreaterSlantEqual;",
+ "&GreaterTilde;",
+ "&Gscr;",
+ "&Gt;",
+ "&HARDcy;",
+ "&Hacek;",
+ "&Hat;",
+ "&Hcirc;",
+ "&Hfr;",
+ "&HilbertSpace;",
+ "&Hopf;",
+ "&HorizontalLine;",
+ "&Hscr;",
+ "&Hstrok;",
+ "&HumpDownHump;",
+ "&HumpEqual;",
+ "&IEcy;",
+ "&IJlig;",
+ "&IOcy;",
+ "&Iacute;",
+ "&Icirc;",
+ "&Icy;",
+ "&Idot;",
+ "&Ifr;",
+ "&Igrave;",
+ "&Im;",
+ "&Imacr;",
+ "&ImaginaryI;",
+ "&Implies;",
+ "&Int;",
+ "&Integral;",
+ "&Intersection;",
+ "&InvisibleComma;",
+ "&InvisibleTimes;",
+ "&Iogon;",
+ "&Iopf;",
+ "&Iota;",
+ "&Iscr;",
+ "&Itilde;",
+ "&Iukcy;",
+ "&Iuml;",
+ "&Jcirc;",
+ "&Jcy;",
+ "&Jfr;",
+ "&Jopf;",
+ "&Jscr;",
+ "&Jsercy;",
+ "&Jukcy;",
+ "&KHcy;",
+ "&KJcy;",
+ "&Kappa;",
+ "&Kcedil;",
+ "&Kcy;",
+ "&Kfr;",
+ "&Kopf;",
+ "&Kscr;",
+ "&LJcy;",
+ "&LT;",
+ "&Lacute;",
+ "&Lambda;",
+ "&Lang;",
+ "&Laplacetrf;",
+ "&Larr;",
+ "&Lcaron;",
+ "&Lcedil;",
+ "&Lcy;",
+ "&LeftAngleBracket;",
+ "&LeftArrow;",
+ "&LeftArrowBar;",
+ "&LeftArrowRightArrow;",
+ "&LeftCeiling;",
+ "&LeftDoubleBracket;",
+ "&LeftDownTeeVector;",
+ "&LeftDownVector;",
+ "&LeftDownVectorBar;",
+ "&LeftFloor;",
+ "&LeftRightArrow;",
+ "&LeftRightVector;",
+ "&LeftTee;",
+ "&LeftTeeArrow;",
+ "&LeftTeeVector;",
+ "&LeftTriangle;",
+ "&LeftTriangleBar;",
+ "&LeftTriangleEqual;",
+ "&LeftUpDownVector;",
+ "&LeftUpTeeVector;",
+ "&LeftUpVector;",
+ "&LeftUpVectorBar;",
+ "&LeftVector;",
+ "&LeftVectorBar;",
+ "&Leftarrow;",
+ "&Leftrightarrow;",
+ "&LessEqualGreater;",
+ "&LessFullEqual;",
+ "&LessGreater;",
+ "&LessLess;",
+ "&LessSlantEqual;",
+ "&LessTilde;",
+ "&Lfr;",
+ "&Ll;",
+ "&Lleftarrow;",
+ "&Lmidot;",
+ "&LongLeftArrow;",
+ "&LongLeftRightArrow;",
+ "&LongRightArrow;",
+ "&Longleftarrow;",
+ "&Longleftrightarrow;",
+ "&Longrightarrow;",
+ "&Lopf;",
+ "&LowerLeftArrow;",
+ "&LowerRightArrow;",
+ "&Lscr;",
+ "&Lsh;",
+ "&Lstrok;",
+ "&Lt;",
+ "&Map;",
+ "&Mcy;",
+ "&MediumSpace;",
+ "&Mellintrf;",
+ "&Mfr;",
+ "&MinusPlus;",
+ "&Mopf;",
+ "&Mscr;",
+ "&Mu;",
+ "&NJcy;",
+ "&Nacute;",
+ "&Ncaron;",
+ "&Ncedil;",
+ "&Ncy;",
+ "&NegativeMediumSpace;",
+ "&NegativeThickSpace;",
+ "&NegativeThinSpace;",
+ "&NegativeVeryThinSpace;",
+ "&NestedGreaterGreater;",
+ "&NestedLessLess;",
+ "&NewLine;",
+ "&Nfr;",
+ "&NoBreak;",
+ "&NonBreakingSpace;",
+ "&Nopf;",
+ "&Not;",
+ "&NotCongruent;",
+ "&NotCupCap;",
+ "&NotDoubleVerticalBar;",
+ "&NotElement;",
+ "&NotEqual;",
+ "&NotEqualTilde;",
+ "&NotExists;",
+ "&NotGreater;",
+ "&NotGreaterEqual;",
+ "&NotGreaterFullEqual;",
+ "&NotGreaterGreater;",
+ "&NotGreaterLess;",
+ "&NotGreaterSlantEqual;",
+ "&NotGreaterTilde;",
+ "&NotHumpDownHump;",
+ "&NotHumpEqual;",
+ "&NotLeftTriangle;",
+ "&NotLeftTriangleBar;",
+ "&NotLeftTriangleEqual;",
+ "&NotLess;",
+ "&NotLessEqual;",
+ "&NotLessGreater;",
+ "&NotLessLess;",
+ "&NotLessSlantEqual;",
+ "&NotLessTilde;",
+ "&NotNestedGreaterGreater;",
+ "&NotNestedLessLess;",
+ "&NotPrecedes;",
+ "&NotPrecedesEqual;",
+ "&NotPrecedesSlantEqual;",
+ "&NotReverseElement;",
+ "&NotRightTriangle;",
+ "&NotRightTriangleBar;",
+ "&NotRightTriangleEqual;",
+ "&NotSquareSubset;",
+ "&NotSquareSubsetEqual;",
+ "&NotSquareSuperset;",
+ "&NotSquareSupersetEqual;",
+ "&NotSubset;",
+ "&NotSubsetEqual;",
+ "&NotSucceeds;",
+ "&NotSucceedsEqual;",
+ "&NotSucceedsSlantEqual;",
+ "&NotSucceedsTilde;",
+ "&NotSuperset;",
+ "&NotSupersetEqual;",
+ "&NotTilde;",
+ "&NotTildeEqual;",
+ "&NotTildeFullEqual;",
+ "&NotTildeTilde;",
+ "&NotVerticalBar;",
+ "&Nscr;",
+ "&Ntilde;",
+ "&Nu;",
+ "&OElig;",
+ "&Oacute;",
+ "&Ocirc;",
+ "&Ocy;",
+ "&Odblac;",
+ "&Ofr;",
+ "&Ograve;",
+ "&Omacr;",
+ "&Omega;",
+ "&Omicron;",
+ "&Oopf;",
+ "&OpenCurlyDoubleQuote;",
+ "&OpenCurlyQuote;",
+ "&Or;",
+ "&Oscr;",
+ "&Oslash;",
+ "&Otilde;",
+ "&Otimes;",
+ "&Ouml;",
+ "&OverBar;",
+ "&OverBrace;",
+ "&OverBracket;",
+ "&OverParenthesis;",
+ "&PartialD;",
+ "&Pcy;",
+ "&Pfr;",
+ "&Phi;",
+ "&Pi;",
+ "&PlusMinus;",
+ "&Poincareplane;",
+ "&Popf;",
+ "&Pr;",
+ "&Precedes;",
+ "&PrecedesEqual;",
+ "&PrecedesSlantEqual;",
+ "&PrecedesTilde;",
+ "&Prime;",
+ "&Product;",
+ "&Proportion;",
+ "&Proportional;",
+ "&Pscr;",
+ "&Psi;",
+ "&QUOT;",
+ "&Qfr;",
+ "&Qopf;",
+ "&Qscr;",
+ "&RBarr;",
+ "&REG;",
+ "&Racute;",
+ "&Rang;",
+ "&Rarr;",
+ "&Rarrtl;",
+ "&Rcaron;",
+ "&Rcedil;",
+ "&Rcy;",
+ "&Re;",
+ "&ReverseElement;",
+ "&ReverseEquilibrium;",
+ "&ReverseUpEquilibrium;",
+ "&Rfr;",
+ "&Rho;",
+ "&RightAngleBracket;",
+ "&RightArrow;",
+ "&RightArrowBar;",
+ "&RightArrowLeftArrow;",
+ "&RightCeiling;",
+ "&RightDoubleBracket;",
+ "&RightDownTeeVector;",
+ "&RightDownVector;",
+ "&RightDownVectorBar;",
+ "&RightFloor;",
+ "&RightTee;",
+ "&RightTeeArrow;",
+ "&RightTeeVector;",
+ "&RightTriangle;",
+ "&RightTriangleBar;",
+ "&RightTriangleEqual;",
+ "&RightUpDownVector;",
+ "&RightUpTeeVector;",
+ "&RightUpVector;",
+ "&RightUpVectorBar;",
+ "&RightVector;",
+ "&RightVectorBar;",
+ "&Rightarrow;",
+ "&Ropf;",
+ "&RoundImplies;",
+ "&Rrightarrow;",
+ "&Rscr;",
+ "&Rsh;",
+ "&RuleDelayed;",
+ "&SHCHcy;",
+ "&SHcy;",
+ "&SOFTcy;",
+ "&Sacute;",
+ "&Sc;",
+ "&Scaron;",
+ "&Scedil;",
+ "&Scirc;",
+ "&Scy;",
+ "&Sfr;",
+ "&ShortDownArrow;",
+ "&ShortLeftArrow;",
+ "&ShortRightArrow;",
+ "&ShortUpArrow;",
+ "&Sigma;",
+ "&SmallCircle;",
+ "&Sopf;",
+ "&Sqrt;",
+ "&Square;",
+ "&SquareIntersection;",
+ "&SquareSubset;",
+ "&SquareSubsetEqual;",
+ "&SquareSuperset;",
+ "&SquareSupersetEqual;",
+ "&SquareUnion;",
+ "&Sscr;",
+ "&Star;",
+ "&Sub;",
+ "&Subset;",
+ "&SubsetEqual;",
+ "&Succeeds;",
+ "&SucceedsEqual;",
+ "&SucceedsSlantEqual;",
+ "&SucceedsTilde;",
+ "&SuchThat;",
+ "&Sum;",
+ "&Sup;",
+ "&Superset;",
+ "&SupersetEqual;",
+ "&Supset;",
+ "&THORN;",
+ "&TRADE;",
+ "&TSHcy;",
+ "&TScy;",
+ "&Tab;",
+ "&Tau;",
+ "&Tcaron;",
+ "&Tcedil;",
+ "&Tcy;",
+ "&Tfr;",
+ "&Therefore;",
+ "&Theta;",
+ "&ThickSpace;",
+ "&ThinSpace;",
+ "&Tilde;",
+ "&TildeEqual;",
+ "&TildeFullEqual;",
+ "&TildeTilde;",
+ "&Topf;",
+ "&TripleDot;",
+ "&Tscr;",
+ "&Tstrok;",
+ "&Uacute;",
+ "&Uarr;",
+ "&Uarrocir;",
+ "&Ubrcy;",
+ "&Ubreve;",
+ "&Ucirc;",
+ "&Ucy;",
+ "&Udblac;",
+ "&Ufr;",
+ "&Ugrave;",
+ "&Umacr;",
+ "&UnderBar;",
+ "&UnderBrace;",
+ "&UnderBracket;",
+ "&UnderParenthesis;",
+ "&Union;",
+ "&UnionPlus;",
+ "&Uogon;",
+ "&Uopf;",
+ "&UpArrow;",
+ "&UpArrowBar;",
+ "&UpArrowDownArrow;",
+ "&UpDownArrow;",
+ "&UpEquilibrium;",
+ "&UpTee;",
+ "&UpTeeArrow;",
+ "&Uparrow;",
+ "&Updownarrow;",
+ "&UpperLeftArrow;",
+ "&UpperRightArrow;",
+ "&Upsi;",
+ "&Upsilon;",
+ "&Uring;",
+ "&Uscr;",
+ "&Utilde;",
+ "&Uuml;",
+ "&VDash;",
+ "&Vbar;",
+ "&Vcy;",
+ "&Vdash;",
+ "&Vdashl;",
+ "&Vee;",
+ "&Verbar;",
+ "&Vert;",
+ "&VerticalBar;",
+ "&VerticalLine;",
+ "&VerticalSeparator;",
+ "&VerticalTilde;",
+ "&VeryThinSpace;",
+ "&Vfr;",
+ "&Vopf;",
+ "&Vscr;",
+ "&Vvdash;",
+ "&Wcirc;",
+ "&Wedge;",
+ "&Wfr;",
+ "&Wopf;",
+ "&Wscr;",
+ "&Xfr;",
+ "&Xi;",
+ "&Xopf;",
+ "&Xscr;",
+ "&YAcy;",
+ "&YIcy;",
+ "&YUcy;",
+ "&Yacute;",
+ "&Ycirc;",
+ "&Ycy;",
+ "&Yfr;",
+ "&Yopf;",
+ "&Yscr;",
+ "&Yuml;",
+ "&ZHcy;",
+ "&Zacute;",
+ "&Zcaron;",
+ "&Zcy;",
+ "&Zdot;",
+ "&ZeroWidthSpace;",
+ "&Zeta;",
+ "&Zfr;",
+ "&Zopf;",
+ "&Zscr;",
+ "&aacute;",
+ "&abreve;",
+ "&ac;",
+ "&acE;",
+ "&acd;",
+ "&acirc;",
+ "&acute;",
+ "&acy;",
+ "&aelig;",
+ "&af;",
+ "&afr;",
+ "&agrave;",
+ "&alefsym;",
+ "&aleph;",
+ "&alpha;",
+ "&amacr;",
+ "&amalg;",
+ "&amp;",
+ "&and;",
+ "&andand;",
+ "&andd;",
+ "&andslope;",
+ "&andv;",
+ "&ang;",
+ "&ange;",
+ "&angle;",
+ "&angmsd;",
+ "&angmsdaa;",
+ "&angmsdab;",
+ "&angmsdac;",
+ "&angmsdad;",
+ "&angmsdae;",
+ "&angmsdaf;",
+ "&angmsdag;",
+ "&angmsdah;",
+ "&angrt;",
+ "&angrtvb;",
+ "&angrtvbd;",
+ "&angsph;",
+ "&angst;",
+ "&angzarr;",
+ "&aogon;",
+ "&aopf;",
+ "&ap;",
+ "&apE;",
+ "&apacir;",
+ "&ape;",
+ "&apid;",
+ "&apos;",
+ "&approx;",
+ "&approxeq;",
+ "&aring;",
+ "&ascr;",
+ "&ast;",
+ "&asymp;",
+ "&asympeq;",
+ "&atilde;",
+ "&auml;",
+ "&awconint;",
+ "&awint;",
+ "&bNot;",
+ "&backcong;",
+ "&backepsilon;",
+ "&backprime;",
+ "&backsim;",
+ "&backsimeq;",
+ "&barvee;",
+ "&barwed;",
+ "&barwedge;",
+ "&bbrk;",
+ "&bbrktbrk;",
+ "&bcong;",
+ "&bcy;",
+ "&bdquo;",
+ "&becaus;",
+ "&because;",
+ "&bemptyv;",
+ "&bepsi;",
+ "&bernou;",
+ "&beta;",
+ "&beth;",
+ "&between;",
+ "&bfr;",
+ "&bigcap;",
+ "&bigcirc;",
+ "&bigcup;",
+ "&bigodot;",
+ "&bigoplus;",
+ "&bigotimes;",
+ "&bigsqcup;",
+ "&bigstar;",
+ "&bigtriangledown;",
+ "&bigtriangleup;",
+ "&biguplus;",
+ "&bigvee;",
+ "&bigwedge;",
+ "&bkarow;",
+ "&blacklozenge;",
+ "&blacksquare;",
+ "&blacktriangle;",
+ "&blacktriangledown;",
+ "&blacktriangleleft;",
+ "&blacktriangleright;",
+ "&blank;",
+ "&blk12;",
+ "&blk14;",
+ "&blk34;",
+ "&block;",
+ "&bne;",
+ "&bnequiv;",
+ "&bnot;",
+ "&bopf;",
+ "&bot;",
+ "&bottom;",
+ "&bowtie;",
+ "&boxDL;",
+ "&boxDR;",
+ "&boxDl;",
+ "&boxDr;",
+ "&boxH;",
+ "&boxHD;",
+ "&boxHU;",
+ "&boxHd;",
+ "&boxHu;",
+ "&boxUL;",
+ "&boxUR;",
+ "&boxUl;",
+ "&boxUr;",
+ "&boxV;",
+ "&boxVH;",
+ "&boxVL;",
+ "&boxVR;",
+ "&boxVh;",
+ "&boxVl;",
+ "&boxVr;",
+ "&boxbox;",
+ "&boxdL;",
+ "&boxdR;",
+ "&boxdl;",
+ "&boxdr;",
+ "&boxh;",
+ "&boxhD;",
+ "&boxhU;",
+ "&boxhd;",
+ "&boxhu;",
+ "&boxminus;",
+ "&boxplus;",
+ "&boxtimes;",
+ "&boxuL;",
+ "&boxuR;",
+ "&boxul;",
+ "&boxur;",
+ "&boxv;",
+ "&boxvH;",
+ "&boxvL;",
+ "&boxvR;",
+ "&boxvh;",
+ "&boxvl;",
+ "&boxvr;",
+ "&bprime;",
+ "&breve;",
+ "&brvbar;",
+ "&bscr;",
+ "&bsemi;",
+ "&bsim;",
+ "&bsime;",
+ "&bsol;",
+ "&bsolb;",
+ "&bsolhsub;",
+ "&bull;",
+ "&bullet;",
+ "&bump;",
+ "&bumpE;",
+ "&bumpe;",
+ "&bumpeq;",
+ "&cacute;",
+ "&cap;",
+ "&capand;",
+ "&capbrcup;",
+ "&capcap;",
+ "&capcup;",
+ "&capdot;",
+ "&caps;",
+ "&caret;",
+ "&caron;",
+ "&ccaps;",
+ "&ccaron;",
+ "&ccedil;",
+ "&ccirc;",
+ "&ccups;",
+ "&ccupssm;",
+ "&cdot;",
+ "&cedil;",
+ "&cemptyv;",
+ "&cent;",
+ "&centerdot;",
+ "&cfr;",
+ "&chcy;",
+ "&check;",
+ "&checkmark;",
+ "&chi;",
+ "&cir;",
+ "&cirE;",
+ "&circ;",
+ "&circeq;",
+ "&circlearrowleft;",
+ "&circlearrowright;",
+ "&circledR;",
+ "&circledS;",
+ "&circledast;",
+ "&circledcirc;",
+ "&circleddash;",
+ "&cire;",
+ "&cirfnint;",
+ "&cirmid;",
+ "&cirscir;",
+ "&clubs;",
+ "&clubsuit;",
+ "&colon;",
+ "&colone;",
+ "&coloneq;",
+ "&comma;",
+ "&commat;",
+ "&comp;",
+ "&compfn;",
+ "&complement;",
+ "&complexes;",
+ "&cong;",
+ "&congdot;",
+ "&conint;",
+ "&copf;",
+ "&coprod;",
+ "&copy;",
+ "&copysr;",
+ "&crarr;",
+ "&cross;",
+ "&cscr;",
+ "&csub;",
+ "&csube;",
+ "&csup;",
+ "&csupe;",
+ "&ctdot;",
+ "&cudarrl;",
+ "&cudarrr;",
+ "&cuepr;",
+ "&cuesc;",
+ "&cularr;",
+ "&cularrp;",
+ "&cup;",
+ "&cupbrcap;",
+ "&cupcap;",
+ "&cupcup;",
+ "&cupdot;",
+ "&cupor;",
+ "&cups;",
+ "&curarr;",
+ "&curarrm;",
+ "&curlyeqprec;",
+ "&curlyeqsucc;",
+ "&curlyvee;",
+ "&curlywedge;",
+ "&curren;",
+ "&curvearrowleft;",
+ "&curvearrowright;",
+ "&cuvee;",
+ "&cuwed;",
+ "&cwconint;",
+ "&cwint;",
+ "&cylcty;",
+ "&dArr;",
+ "&dHar;",
+ "&dagger;",
+ "&daleth;",
+ "&darr;",
+ "&dash;",
+ "&dashv;",
+ "&dbkarow;",
+ "&dblac;",
+ "&dcaron;",
+ "&dcy;",
+ "&dd;",
+ "&ddagger;",
+ "&ddarr;",
+ "&ddotseq;",
+ "&deg;",
+ "&delta;",
+ "&demptyv;",
+ "&dfisht;",
+ "&dfr;",
+ "&dharl;",
+ "&dharr;",
+ "&diam;",
+ "&diamond;",
+ "&diamondsuit;",
+ "&diams;",
+ "&die;",
+ "&digamma;",
+ "&disin;",
+ "&div;",
+ "&divide;",
+ "&divideontimes;",
+ "&divonx;",
+ "&djcy;",
+ "&dlcorn;",
+ "&dlcrop;",
+ "&dollar;",
+ "&dopf;",
+ "&dot;",
+ "&doteq;",
+ "&doteqdot;",
+ "&dotminus;",
+ "&dotplus;",
+ "&dotsquare;",
+ "&doublebarwedge;",
+ "&downarrow;",
+ "&downdownarrows;",
+ "&downharpoonleft;",
+ "&downharpoonright;",
+ "&drbkarow;",
+ "&drcorn;",
+ "&drcrop;",
+ "&dscr;",
+ "&dscy;",
+ "&dsol;",
+ "&dstrok;",
+ "&dtdot;",
+ "&dtri;",
+ "&dtrif;",
+ "&duarr;",
+ "&duhar;",
+ "&dwangle;",
+ "&dzcy;",
+ "&dzigrarr;",
+ "&eDDot;",
+ "&eDot;",
+ "&eacute;",
+ "&easter;",
+ "&ecaron;",
+ "&ecir;",
+ "&ecirc;",
+ "&ecolon;",
+ "&ecy;",
+ "&edot;",
+ "&ee;",
+ "&efDot;",
+ "&efr;",
+ "&eg;",
+ "&egrave;",
+ "&egs;",
+ "&egsdot;",
+ "&el;",
+ "&elinters;",
+ "&ell;",
+ "&els;",
+ "&elsdot;",
+ "&emacr;",
+ "&empty;",
+ "&emptyset;",
+ "&emptyv;",
+ "&emsp;",
+ "&emsp13;",
+ "&emsp14;",
+ "&eng;",
+ "&ensp;",
+ "&eogon;",
+ "&eopf;",
+ "&epar;",
+ "&eparsl;",
+ "&eplus;",
+ "&epsi;",
+ "&epsilon;",
+ "&epsiv;",
+ "&eqcirc;",
+ "&eqcolon;",
+ "&eqsim;",
+ "&eqslantgtr;",
+ "&eqslantless;",
+ "&equals;",
+ "&equest;",
+ "&equiv;",
+ "&equivDD;",
+ "&eqvparsl;",
+ "&erDot;",
+ "&erarr;",
+ "&escr;",
+ "&esdot;",
+ "&esim;",
+ "&eta;",
+ "&eth;",
+ "&euml;",
+ "&euro;",
+ "&excl;",
+ "&exist;",
+ "&expectation;",
+ "&exponentiale;",
+ "&fallingdotseq;",
+ "&fcy;",
+ "&female;",
+ "&ffilig;",
+ "&fflig;",
+ "&ffllig;",
+ "&ffr;",
+ "&filig;",
+ "&fjlig;",
+ "&flat;",
+ "&fllig;",
+ "&fltns;",
+ "&fnof;",
+ "&fopf;",
+ "&forall;",
+ "&fork;",
+ "&forkv;",
+ "&fpartint;",
+ "&frac12;",
+ "&frac13;",
+ "&frac14;",
+ "&frac15;",
+ "&frac16;",
+ "&frac18;",
+ "&frac23;",
+ "&frac25;",
+ "&frac34;",
+ "&frac35;",
+ "&frac38;",
+ "&frac45;",
+ "&frac56;",
+ "&frac58;",
+ "&frac78;",
+ "&frasl;",
+ "&frown;",
+ "&fscr;",
+ "&gE;",
+ "&gEl;",
+ "&gacute;",
+ "&gamma;",
+ "&gammad;",
+ "&gap;",
+ "&gbreve;",
+ "&gcirc;",
+ "&gcy;",
+ "&gdot;",
+ "&ge;",
+ "&gel;",
+ "&geq;",
+ "&geqq;",
+ "&geqslant;",
+ "&ges;",
+ "&gescc;",
+ "&gesdot;",
+ "&gesdoto;",
+ "&gesdotol;",
+ "&gesl;",
+ "&gesles;",
+ "&gfr;",
+ "&gg;",
+ "&ggg;",
+ "&gimel;",
+ "&gjcy;",
+ "&gl;",
+ "&glE;",
+ "&gla;",
+ "&glj;",
+ "&gnE;",
+ "&gnap;",
+ "&gnapprox;",
+ "&gne;",
+ "&gneq;",
+ "&gneqq;",
+ "&gnsim;",
+ "&gopf;",
+ "&grave;",
+ "&gscr;",
+ "&gsim;",
+ "&gsime;",
+ "&gsiml;",
+ "&gt;",
+ "&gtcc;",
+ "&gtcir;",
+ "&gtdot;",
+ "&gtlPar;",
+ "&gtquest;",
+ "&gtrapprox;",
+ "&gtrarr;",
+ "&gtrdot;",
+ "&gtreqless;",
+ "&gtreqqless;",
+ "&gtrless;",
+ "&gtrsim;",
+ "&gvertneqq;",
+ "&gvnE;",
+ "&hArr;",
+ "&hairsp;",
+ "&half;",
+ "&hamilt;",
+ "&hardcy;",
+ "&harr;",
+ "&harrcir;",
+ "&harrw;",
+ "&hbar;",
+ "&hcirc;",
+ "&hearts;",
+ "&heartsuit;",
+ "&hellip;",
+ "&hercon;",
+ "&hfr;",
+ "&hksearow;",
+ "&hkswarow;",
+ "&hoarr;",
+ "&homtht;",
+ "&hookleftarrow;",
+ "&hookrightarrow;",
+ "&hopf;",
+ "&horbar;",
+ "&hscr;",
+ "&hslash;",
+ "&hstrok;",
+ "&hybull;",
+ "&hyphen;",
+ "&iacute;",
+ "&ic;",
+ "&icirc;",
+ "&icy;",
+ "&iecy;",
+ "&iexcl;",
+ "&iff;",
+ "&ifr;",
+ "&igrave;",
+ "&ii;",
+ "&iiiint;",
+ "&iiint;",
+ "&iinfin;",
+ "&iiota;",
+ "&ijlig;",
+ "&imacr;",
+ "&image;",
+ "&imagline;",
+ "&imagpart;",
+ "&imath;",
+ "&imof;",
+ "&imped;",
+ "&in;",
+ "&incare;",
+ "&infin;",
+ "&infintie;",
+ "&inodot;",
+ "&int;",
+ "&intcal;",
+ "&integers;",
+ "&intercal;",
+ "&intlarhk;",
+ "&intprod;",
+ "&iocy;",
+ "&iogon;",
+ "&iopf;",
+ "&iota;",
+ "&iprod;",
+ "&iquest;",
+ "&iscr;",
+ "&isin;",
+ "&isinE;",
+ "&isindot;",
+ "&isins;",
+ "&isinsv;",
+ "&isinv;",
+ "&it;",
+ "&itilde;",
+ "&iukcy;",
+ "&iuml;",
+ "&jcirc;",
+ "&jcy;",
+ "&jfr;",
+ "&jmath;",
+ "&jopf;",
+ "&jscr;",
+ "&jsercy;",
+ "&jukcy;",
+ "&kappa;",
+ "&kappav;",
+ "&kcedil;",
+ "&kcy;",
+ "&kfr;",
+ "&kgreen;",
+ "&khcy;",
+ "&kjcy;",
+ "&kopf;",
+ "&kscr;",
+ "&lAarr;",
+ "&lArr;",
+ "&lAtail;",
+ "&lBarr;",
+ "&lE;",
+ "&lEg;",
+ "&lHar;",
+ "&lacute;",
+ "&laemptyv;",
+ "&lagran;",
+ "&lambda;",
+ "&lang;",
+ "&langd;",
+ "&langle;",
+ "&lap;",
+ "&laquo;",
+ "&larr;",
+ "&larrb;",
+ "&larrbfs;",
+ "&larrfs;",
+ "&larrhk;",
+ "&larrlp;",
+ "&larrpl;",
+ "&larrsim;",
+ "&larrtl;",
+ "&lat;",
+ "&latail;",
+ "&late;",
+ "&lates;",
+ "&lbarr;",
+ "&lbbrk;",
+ "&lbrace;",
+ "&lbrack;",
+ "&lbrke;",
+ "&lbrksld;",
+ "&lbrkslu;",
+ "&lcaron;",
+ "&lcedil;",
+ "&lceil;",
+ "&lcub;",
+ "&lcy;",
+ "&ldca;",
+ "&ldquo;",
+ "&ldquor;",
+ "&ldrdhar;",
+ "&ldrushar;",
+ "&ldsh;",
+ "&le;",
+ "&leftarrow;",
+ "&leftarrowtail;",
+ "&leftharpoondown;",
+ "&leftharpoonup;",
+ "&leftleftarrows;",
+ "&leftrightarrow;",
+ "&leftrightarrows;",
+ "&leftrightharpoons;",
+ "&leftrightsquigarrow;",
+ "&leftthreetimes;",
+ "&leg;",
+ "&leq;",
+ "&leqq;",
+ "&leqslant;",
+ "&les;",
+ "&lescc;",
+ "&lesdot;",
+ "&lesdoto;",
+ "&lesdotor;",
+ "&lesg;",
+ "&lesges;",
+ "&lessapprox;",
+ "&lessdot;",
+ "&lesseqgtr;",
+ "&lesseqqgtr;",
+ "&lessgtr;",
+ "&lesssim;",
+ "&lfisht;",
+ "&lfloor;",
+ "&lfr;",
+ "&lg;",
+ "&lgE;",
+ "&lhard;",
+ "&lharu;",
+ "&lharul;",
+ "&lhblk;",
+ "&ljcy;",
+ "&ll;",
+ "&llarr;",
+ "&llcorner;",
+ "&llhard;",
+ "&lltri;",
+ "&lmidot;",
+ "&lmoust;",
+ "&lmoustache;",
+ "&lnE;",
+ "&lnap;",
+ "&lnapprox;",
+ "&lne;",
+ "&lneq;",
+ "&lneqq;",
+ "&lnsim;",
+ "&loang;",
+ "&loarr;",
+ "&lobrk;",
+ "&longleftarrow;",
+ "&longleftrightarrow;",
+ "&longmapsto;",
+ "&longrightarrow;",
+ "&looparrowleft;",
+ "&looparrowright;",
+ "&lopar;",
+ "&lopf;",
+ "&loplus;",
+ "&lotimes;",
+ "&lowast;",
+ "&lowbar;",
+ "&loz;",
+ "&lozenge;",
+ "&lozf;",
+ "&lpar;",
+ "&lparlt;",
+ "&lrarr;",
+ "&lrcorner;",
+ "&lrhar;",
+ "&lrhard;",
+ "&lrm;",
+ "&lrtri;",
+ "&lsaquo;",
+ "&lscr;",
+ "&lsh;",
+ "&lsim;",
+ "&lsime;",
+ "&lsimg;",
+ "&lsqb;",
+ "&lsquo;",
+ "&lsquor;",
+ "&lstrok;",
+ "&lt;",
+ "&ltcc;",
+ "&ltcir;",
+ "&ltdot;",
+ "&lthree;",
+ "&ltimes;",
+ "&ltlarr;",
+ "&ltquest;",
+ "&ltrPar;",
+ "&ltri;",
+ "&ltrie;",
+ "&ltrif;",
+ "&lurdshar;",
+ "&luruhar;",
+ "&lvertneqq;",
+ "&lvnE;",
+ "&mDDot;",
+ "&macr;",
+ "&male;",
+ "&malt;",
+ "&maltese;",
+ "&map;",
+ "&mapsto;",
+ "&mapstodown;",
+ "&mapstoleft;",
+ "&mapstoup;",
+ "&marker;",
+ "&mcomma;",
+ "&mcy;",
+ "&mdash;",
+ "&measuredangle;",
+ "&mfr;",
+ "&mho;",
+ "&micro;",
+ "&mid;",
+ "&midast;",
+ "&midcir;",
+ "&middot;",
+ "&minus;",
+ "&minusb;",
+ "&minusd;",
+ "&minusdu;",
+ "&mlcp;",
+ "&mldr;",
+ "&mnplus;",
+ "&models;",
+ "&mopf;",
+ "&mp;",
+ "&mscr;",
+ "&mstpos;",
+ "&mu;",
+ "&multimap;",
+ "&mumap;",
+ "&nGg;",
+ "&nGt;",
+ "&nGtv;",
+ "&nLeftarrow;",
+ "&nLeftrightarrow;",
+ "&nLl;",
+ "&nLt;",
+ "&nLtv;",
+ "&nRightarrow;",
+ "&nVDash;",
+ "&nVdash;",
+ "&nabla;",
+ "&nacute;",
+ "&nang;",
+ "&nap;",
+ "&napE;",
+ "&napid;",
+ "&napos;",
+ "&napprox;",
+ "&natur;",
+ "&natural;",
+ "&naturals;",
+ "&nbsp;",
+ "&nbump;",
+ "&nbumpe;",
+ "&ncap;",
+ "&ncaron;",
+ "&ncedil;",
+ "&ncong;",
+ "&ncongdot;",
+ "&ncup;",
+ "&ncy;",
+ "&ndash;",
+ "&ne;",
+ "&neArr;",
+ "&nearhk;",
+ "&nearr;",
+ "&nearrow;",
+ "&nedot;",
+ "&nequiv;",
+ "&nesear;",
+ "&nesim;",
+ "&nexist;",
+ "&nexists;",
+ "&nfr;",
+ "&ngE;",
+ "&nge;",
+ "&ngeq;",
+ "&ngeqq;",
+ "&ngeqslant;",
+ "&nges;",
+ "&ngsim;",
+ "&ngt;",
+ "&ngtr;",
+ "&nhArr;",
+ "&nharr;",
+ "&nhpar;",
+ "&ni;",
+ "&nis;",
+ "&nisd;",
+ "&niv;",
+ "&njcy;",
+ "&nlArr;",
+ "&nlE;",
+ "&nlarr;",
+ "&nldr;",
+ "&nle;",
+ "&nleftarrow;",
+ "&nleftrightarrow;",
+ "&nleq;",
+ "&nleqq;",
+ "&nleqslant;",
+ "&nles;",
+ "&nless;",
+ "&nlsim;",
+ "&nlt;",
+ "&nltri;",
+ "&nltrie;",
+ "&nmid;",
+ "&nopf;",
+ "&not;",
+ "&notin;",
+ "&notinE;",
+ "&notindot;",
+ "&notinva;",
+ "&notinvb;",
+ "&notinvc;",
+ "&notni;",
+ "&notniva;",
+ "&notnivb;",
+ "&notnivc;",
+ "&npar;",
+ "&nparallel;",
+ "&nparsl;",
+ "&npart;",
+ "&npolint;",
+ "&npr;",
+ "&nprcue;",
+ "&npre;",
+ "&nprec;",
+ "&npreceq;",
+ "&nrArr;",
+ "&nrarr;",
+ "&nrarrc;",
+ "&nrarrw;",
+ "&nrightarrow;",
+ "&nrtri;",
+ "&nrtrie;",
+ "&nsc;",
+ "&nsccue;",
+ "&nsce;",
+ "&nscr;",
+ "&nshortmid;",
+ "&nshortparallel;",
+ "&nsim;",
+ "&nsime;",
+ "&nsimeq;",
+ "&nsmid;",
+ "&nspar;",
+ "&nsqsube;",
+ "&nsqsupe;",
+ "&nsub;",
+ "&nsubE;",
+ "&nsube;",
+ "&nsubset;",
+ "&nsubseteq;",
+ "&nsubseteqq;",
+ "&nsucc;",
+ "&nsucceq;",
+ "&nsup;",
+ "&nsupE;",
+ "&nsupe;",
+ "&nsupset;",
+ "&nsupseteq;",
+ "&nsupseteqq;",
+ "&ntgl;",
+ "&ntilde;",
+ "&ntlg;",
+ "&ntriangleleft;",
+ "&ntrianglelefteq;",
+ "&ntriangleright;",
+ "&ntrianglerighteq;",
+ "&nu;",
+ "&num;",
+ "&numero;",
+ "&numsp;",
+ "&nvDash;",
+ "&nvHarr;",
+ "&nvap;",
+ "&nvdash;",
+ "&nvge;",
+ "&nvgt;",
+ "&nvinfin;",
+ "&nvlArr;",
+ "&nvle;",
+ "&nvlt;",
+ "&nvltrie;",
+ "&nvrArr;",
+ "&nvrtrie;",
+ "&nvsim;",
+ "&nwArr;",
+ "&nwarhk;",
+ "&nwarr;",
+ "&nwarrow;",
+ "&nwnear;",
+ "&oS;",
+ "&oacute;",
+ "&oast;",
+ "&ocir;",
+ "&ocirc;",
+ "&ocy;",
+ "&odash;",
+ "&odblac;",
+ "&odiv;",
+ "&odot;",
+ "&odsold;",
+ "&oelig;",
+ "&ofcir;",
+ "&ofr;",
+ "&ogon;",
+ "&ograve;",
+ "&ogt;",
+ "&ohbar;",
+ "&ohm;",
+ "&oint;",
+ "&olarr;",
+ "&olcir;",
+ "&olcross;",
+ "&oline;",
+ "&olt;",
+ "&omacr;",
+ "&omega;",
+ "&omicron;",
+ "&omid;",
+ "&ominus;",
+ "&oopf;",
+ "&opar;",
+ "&operp;",
+ "&oplus;",
+ "&or;",
+ "&orarr;",
+ "&ord;",
+ "&order;",
+ "&orderof;",
+ "&ordf;",
+ "&ordm;",
+ "&origof;",
+ "&oror;",
+ "&orslope;",
+ "&orv;",
+ "&oscr;",
+ "&oslash;",
+ "&osol;",
+ "&otilde;",
+ "&otimes;",
+ "&otimesas;",
+ "&ouml;",
+ "&ovbar;",
+ "&par;",
+ "&para;",
+ "&parallel;",
+ "&parsim;",
+ "&parsl;",
+ "&part;",
+ "&pcy;",
+ "&percnt;",
+ "&period;",
+ "&permil;",
+ "&perp;",
+ "&pertenk;",
+ "&pfr;",
+ "&phi;",
+ "&phiv;",
+ "&phmmat;",
+ "&phone;",
+ "&pi;",
+ "&pitchfork;",
+ "&piv;",
+ "&planck;",
+ "&planckh;",
+ "&plankv;",
+ "&plus;",
+ "&plusacir;",
+ "&plusb;",
+ "&pluscir;",
+ "&plusdo;",
+ "&plusdu;",
+ "&pluse;",
+ "&plusmn;",
+ "&plussim;",
+ "&plustwo;",
+ "&pm;",
+ "&pointint;",
+ "&popf;",
+ "&pound;",
+ "&pr;",
+ "&prE;",
+ "&prap;",
+ "&prcue;",
+ "&pre;",
+ "&prec;",
+ "&precapprox;",
+ "&preccurlyeq;",
+ "&preceq;",
+ "&precnapprox;",
+ "&precneqq;",
+ "&precnsim;",
+ "&precsim;",
+ "&prime;",
+ "&primes;",
+ "&prnE;",
+ "&prnap;",
+ "&prnsim;",
+ "&prod;",
+ "&profalar;",
+ "&profline;",
+ "&profsurf;",
+ "&prop;",
+ "&propto;",
+ "&prsim;",
+ "&prurel;",
+ "&pscr;",
+ "&psi;",
+ "&puncsp;",
+ "&qfr;",
+ "&qint;",
+ "&qopf;",
+ "&qprime;",
+ "&qscr;",
+ "&quaternions;",
+ "&quatint;",
+ "&quest;",
+ "&questeq;",
+ "&quot;",
+ "&rAarr;",
+ "&rArr;",
+ "&rAtail;",
+ "&rBarr;",
+ "&rHar;",
+ "&race;",
+ "&racute;",
+ "&radic;",
+ "&raemptyv;",
+ "&rang;",
+ "&rangd;",
+ "&range;",
+ "&rangle;",
+ "&raquo;",
+ "&rarr;",
+ "&rarrap;",
+ "&rarrb;",
+ "&rarrbfs;",
+ "&rarrc;",
+ "&rarrfs;",
+ "&rarrhk;",
+ "&rarrlp;",
+ "&rarrpl;",
+ "&rarrsim;",
+ "&rarrtl;",
+ "&rarrw;",
+ "&ratail;",
+ "&ratio;",
+ "&rationals;",
+ "&rbarr;",
+ "&rbbrk;",
+ "&rbrace;",
+ "&rbrack;",
+ "&rbrke;",
+ "&rbrksld;",
+ "&rbrkslu;",
+ "&rcaron;",
+ "&rcedil;",
+ "&rceil;",
+ "&rcub;",
+ "&rcy;",
+ "&rdca;",
+ "&rdldhar;",
+ "&rdquo;",
+ "&rdquor;",
+ "&rdsh;",
+ "&real;",
+ "&realine;",
+ "&realpart;",
+ "&reals;",
+ "&rect;",
+ "&reg;",
+ "&rfisht;",
+ "&rfloor;",
+ "&rfr;",
+ "&rhard;",
+ "&rharu;",
+ "&rharul;",
+ "&rho;",
+ "&rhov;",
+ "&rightarrow;",
+ "&rightarrowtail;",
+ "&rightharpoondown;",
+ "&rightharpoonup;",
+ "&rightleftarrows;",
+ "&rightleftharpoons;",
+ "&rightrightarrows;",
+ "&rightsquigarrow;",
+ "&rightthreetimes;",
+ "&ring;",
+ "&risingdotseq;",
+ "&rlarr;",
+ "&rlhar;",
+ "&rlm;",
+ "&rmoust;",
+ "&rmoustache;",
+ "&rnmid;",
+ "&roang;",
+ "&roarr;",
+ "&robrk;",
+ "&ropar;",
+ "&ropf;",
+ "&roplus;",
+ "&rotimes;",
+ "&rpar;",
+ "&rpargt;",
+ "&rppolint;",
+ "&rrarr;",
+ "&rsaquo;",
+ "&rscr;",
+ "&rsh;",
+ "&rsqb;",
+ "&rsquo;",
+ "&rsquor;",
+ "&rthree;",
+ "&rtimes;",
+ "&rtri;",
+ "&rtrie;",
+ "&rtrif;",
+ "&rtriltri;",
+ "&ruluhar;",
+ "&rx;",
+ "&sacute;",
+ "&sbquo;",
+ "&sc;",
+ "&scE;",
+ "&scap;",
+ "&scaron;",
+ "&sccue;",
+ "&sce;",
+ "&scedil;",
+ "&scirc;",
+ "&scnE;",
+ "&scnap;",
+ "&scnsim;",
+ "&scpolint;",
+ "&scsim;",
+ "&scy;",
+ "&sdot;",
+ "&sdotb;",
+ "&sdote;",
+ "&seArr;",
+ "&searhk;",
+ "&searr;",
+ "&searrow;",
+ "&sect;",
+ "&semi;",
+ "&seswar;",
+ "&setminus;",
+ "&setmn;",
+ "&sext;",
+ "&sfr;",
+ "&sfrown;",
+ "&sharp;",
+ "&shchcy;",
+ "&shcy;",
+ "&shortmid;",
+ "&shortparallel;",
+ "&shy;",
+ "&sigma;",
+ "&sigmaf;",
+ "&sigmav;",
+ "&sim;",
+ "&simdot;",
+ "&sime;",
+ "&simeq;",
+ "&simg;",
+ "&simgE;",
+ "&siml;",
+ "&simlE;",
+ "&simne;",
+ "&simplus;",
+ "&simrarr;",
+ "&slarr;",
+ "&smallsetminus;",
+ "&smashp;",
+ "&smeparsl;",
+ "&smid;",
+ "&smile;",
+ "&smt;",
+ "&smte;",
+ "&smtes;",
+ "&softcy;",
+ "&sol;",
+ "&solb;",
+ "&solbar;",
+ "&sopf;",
+ "&spades;",
+ "&spadesuit;",
+ "&spar;",
+ "&sqcap;",
+ "&sqcaps;",
+ "&sqcup;",
+ "&sqcups;",
+ "&sqsub;",
+ "&sqsube;",
+ "&sqsubset;",
+ "&sqsubseteq;",
+ "&sqsup;",
+ "&sqsupe;",
+ "&sqsupset;",
+ "&sqsupseteq;",
+ "&squ;",
+ "&square;",
+ "&squarf;",
+ "&squf;",
+ "&srarr;",
+ "&sscr;",
+ "&ssetmn;",
+ "&ssmile;",
+ "&sstarf;",
+ "&star;",
+ "&starf;",
+ "&straightepsilon;",
+ "&straightphi;",
+ "&strns;",
+ "&sub;",
+ "&subE;",
+ "&subdot;",
+ "&sube;",
+ "&subedot;",
+ "&submult;",
+ "&subnE;",
+ "&subne;",
+ "&subplus;",
+ "&subrarr;",
+ "&subset;",
+ "&subseteq;",
+ "&subseteqq;",
+ "&subsetneq;",
+ "&subsetneqq;",
+ "&subsim;",
+ "&subsub;",
+ "&subsup;",
+ "&succ;",
+ "&succapprox;",
+ "&succcurlyeq;",
+ "&succeq;",
+ "&succnapprox;",
+ "&succneqq;",
+ "&succnsim;",
+ "&succsim;",
+ "&sum;",
+ "&sung;",
+ "&sup;",
+ "&sup1;",
+ "&sup2;",
+ "&sup3;",
+ "&supE;",
+ "&supdot;",
+ "&supdsub;",
+ "&supe;",
+ "&supedot;",
+ "&suphsol;",
+ "&suphsub;",
+ "&suplarr;",
+ "&supmult;",
+ "&supnE;",
+ "&supne;",
+ "&supplus;",
+ "&supset;",
+ "&supseteq;",
+ "&supseteqq;",
+ "&supsetneq;",
+ "&supsetneqq;",
+ "&supsim;",
+ "&supsub;",
+ "&supsup;",
+ "&swArr;",
+ "&swarhk;",
+ "&swarr;",
+ "&swarrow;",
+ "&swnwar;",
+ "&szlig;",
+ "&target;",
+ "&tau;",
+ "&tbrk;",
+ "&tcaron;",
+ "&tcedil;",
+ "&tcy;",
+ "&tdot;",
+ "&telrec;",
+ "&tfr;",
+ "&there4;",
+ "&therefore;",
+ "&theta;",
+ "&thetasym;",
+ "&thetav;",
+ "&thickapprox;",
+ "&thicksim;",
+ "&thinsp;",
+ "&thkap;",
+ "&thksim;",
+ "&thorn;",
+ "&tilde;",
+ "&times;",
+ "&timesb;",
+ "&timesbar;",
+ "&timesd;",
+ "&tint;",
+ "&toea;",
+ "&top;",
+ "&topbot;",
+ "&topcir;",
+ "&topf;",
+ "&topfork;",
+ "&tosa;",
+ "&tprime;",
+ "&trade;",
+ "&triangle;",
+ "&triangledown;",
+ "&triangleleft;",
+ "&trianglelefteq;",
+ "&triangleq;",
+ "&triangleright;",
+ "&trianglerighteq;",
+ "&tridot;",
+ "&trie;",
+ "&triminus;",
+ "&triplus;",
+ "&trisb;",
+ "&tritime;",
+ "&trpezium;",
+ "&tscr;",
+ "&tscy;",
+ "&tshcy;",
+ "&tstrok;",
+ "&twixt;",
+ "&twoheadleftarrow;",
+ "&twoheadrightarrow;",
+ "&uArr;",
+ "&uHar;",
+ "&uacute;",
+ "&uarr;",
+ "&ubrcy;",
+ "&ubreve;",
+ "&ucirc;",
+ "&ucy;",
+ "&udarr;",
+ "&udblac;",
+ "&udhar;",
+ "&ufisht;",
+ "&ufr;",
+ "&ugrave;",
+ "&uharl;",
+ "&uharr;",
+ "&uhblk;",
+ "&ulcorn;",
+ "&ulcorner;",
+ "&ulcrop;",
+ "&ultri;",
+ "&umacr;",
+ "&uml;",
+ "&uogon;",
+ "&uopf;",
+ "&uparrow;",
+ "&updownarrow;",
+ "&upharpoonleft;",
+ "&upharpoonright;",
+ "&uplus;",
+ "&upsi;",
+ "&upsih;",
+ "&upsilon;",
+ "&upuparrows;",
+ "&urcorn;",
+ "&urcorner;",
+ "&urcrop;",
+ "&uring;",
+ "&urtri;",
+ "&uscr;",
+ "&utdot;",
+ "&utilde;",
+ "&utri;",
+ "&utrif;",
+ "&uuarr;",
+ "&uuml;",
+ "&uwangle;",
+ "&vArr;",
+ "&vBar;",
+ "&vBarv;",
+ "&vDash;",
+ "&vangrt;",
+ "&varepsilon;",
+ "&varkappa;",
+ "&varnothing;",
+ "&varphi;",
+ "&varpi;",
+ "&varpropto;",
+ "&varr;",
+ "&varrho;",
+ "&varsigma;",
+ "&varsubsetneq;",
+ "&varsubsetneqq;",
+ "&varsupsetneq;",
+ "&varsupsetneqq;",
+ "&vartheta;",
+ "&vartriangleleft;",
+ "&vartriangleright;",
+ "&vcy;",
+ "&vdash;",
+ "&vee;",
+ "&veebar;",
+ "&veeeq;",
+ "&vellip;",
+ "&verbar;",
+ "&vert;",
+ "&vfr;",
+ "&vltri;",
+ "&vnsub;",
+ "&vnsup;",
+ "&vopf;",
+ "&vprop;",
+ "&vrtri;",
+ "&vscr;",
+ "&vsubnE;",
+ "&vsubne;",
+ "&vsupnE;",
+ "&vsupne;",
+ "&vzigzag;",
+ "&wcirc;",
+ "&wedbar;",
+ "&wedge;",
+ "&wedgeq;",
+ "&weierp;",
+ "&wfr;",
+ "&wopf;",
+ "&wp;",
+ "&wr;",
+ "&wreath;",
+ "&wscr;",
+ "&xcap;",
+ "&xcirc;",
+ "&xcup;",
+ "&xdtri;",
+ "&xfr;",
+ "&xhArr;",
+ "&xharr;",
+ "&xi;",
+ "&xlArr;",
+ "&xlarr;",
+ "&xmap;",
+ "&xnis;",
+ "&xodot;",
+ "&xopf;",
+ "&xoplus;",
+ "&xotime;",
+ "&xrArr;",
+ "&xrarr;",
+ "&xscr;",
+ "&xsqcup;",
+ "&xuplus;",
+ "&xutri;",
+ "&xvee;",
+ "&xwedge;",
+ "&yacute;",
+ "&yacy;",
+ "&ycirc;",
+ "&ycy;",
+ "&yen;",
+ "&yfr;",
+ "&yicy;",
+ "&yopf;",
+ "&yscr;",
+ "&yucy;",
+ "&yuml;",
+ "&zacute;",
+ "&zcaron;",
+ "&zcy;",
+ "&zdot;",
+ "&zeetrf;",
+ "&zeta;",
+ "&zfr;",
+ "&zhcy;",
+ "&zigrarr;",
+ "&zopf;",
+ "&zscr;",
+ "&zwj;",
+ "&zwnj;",
);
foreach ($map as $str) {
diff --git a/ext/standard/tests/strings/htmlentities-utf-2.phpt b/ext/standard/tests/strings/htmlentities-utf-2.phpt
index 3c0b9dde71..1fdd05e271 100644
--- a/ext/standard/tests/strings/htmlentities-utf-2.phpt
+++ b/ext/standard/tests/strings/htmlentities-utf-2.phpt
@@ -6,15 +6,15 @@ output_handler=
<?php
@setlocale (LC_CTYPE, "C");
$strings = array("<", "\xD0", "\xD0\x90", "\xD0\x90\xD0", "\xD0\x90\xD0\xB0", "\xE0", "A\xE0", "\xE0\x80", "\xE0\x79", "\xE0\x80\xBE",
- "Voil\xE0", "Clich\xE9s",
- "\xFE", "\xFE\x41", "\xC3\xA9", "\xC3\x79", "\xF7\xBF\xBF\xBF", "\xFB\xBF\xBF\xBF\xBF", "\xFD\xBF\xBF\xBF\xBF\xBF",
- "\x41\xF7\xF7\x42", "\x42\xFB\xFB\x42", "\x43\xFD\xFD\x42", "\x44\xF7\xF7", "\x45\xFB\xFB", "\x46\xFD\xFD"
- );
+ "Voil\xE0", "Clich\xE9s",
+ "\xFE", "\xFE\x41", "\xC3\xA9", "\xC3\x79", "\xF7\xBF\xBF\xBF", "\xFB\xBF\xBF\xBF\xBF", "\xFD\xBF\xBF\xBF\xBF\xBF",
+ "\x41\xF7\xF7\x42", "\x42\xFB\xFB\x42", "\x43\xFD\xFD\x42", "\x44\xF7\xF7", "\x45\xFB\xFB", "\x46\xFD\xFD"
+ );
foreach($strings as $string) {
- $sc_encoded = htmlspecialchars ($string, ENT_QUOTES | ENT_IGNORE, "utf-8");
- var_dump(bin2hex($sc_encoded));
- $ent_encoded = htmlentities ($string, ENT_QUOTES | ENT_IGNORE, "utf-8");
- var_dump(bin2hex($ent_encoded));
+ $sc_encoded = htmlspecialchars ($string, ENT_QUOTES | ENT_IGNORE, "utf-8");
+ var_dump(bin2hex($sc_encoded));
+ $ent_encoded = htmlentities ($string, ENT_QUOTES | ENT_IGNORE, "utf-8");
+ var_dump(bin2hex($ent_encoded));
}
?>
--EXPECT--
diff --git a/ext/standard/tests/strings/htmlentities-utf-3.phpt b/ext/standard/tests/strings/htmlentities-utf-3.phpt
index 82693056ef..56d4cdc2f8 100644
--- a/ext/standard/tests/strings/htmlentities-utf-3.phpt
+++ b/ext/standard/tests/strings/htmlentities-utf-3.phpt
@@ -6,77 +6,77 @@ Test get_next_char(), used by htmlentities()/htmlspecialchars(): validity of UTF
/* conformance to Unicode 5.2, section 3.9, D92 */
$val_ranges = array(
- array(array(0x00, 0x7F)),
- array(array(0xC2, 0xDF), array(0x80, 0xBF)),
- array(array(0xE0, 0xE0), array(0xA0, 0xBF), array(0x80, 0xBF)),
- array(array(0xE1, 0xEC), array(0x80, 0xBF), array(0x80, 0xBF)),
- array(array(0xED, 0xED), array(0x80, 0x9F), array(0x80, 0xBF)),
- array(array(0xEE, 0xEF), array(0x80, 0xBF), array(0x80, 0xBF)),
- array(array(0xF0, 0xF0), array(0x90, 0xBF), array(0x80, 0xBF), array(0x80, 0xBF)),
- array(array(0xF1, 0xF3), array(0x80, 0xBF), array(0x80, 0xBF), array(0x80, 0xBF)),
- array(array(0xF4, 0xF4), array(0x80, 0x8F), array(0x80, 0xBF), array(0x80, 0xBF)),
+ array(array(0x00, 0x7F)),
+ array(array(0xC2, 0xDF), array(0x80, 0xBF)),
+ array(array(0xE0, 0xE0), array(0xA0, 0xBF), array(0x80, 0xBF)),
+ array(array(0xE1, 0xEC), array(0x80, 0xBF), array(0x80, 0xBF)),
+ array(array(0xED, 0xED), array(0x80, 0x9F), array(0x80, 0xBF)),
+ array(array(0xEE, 0xEF), array(0x80, 0xBF), array(0x80, 0xBF)),
+ array(array(0xF0, 0xF0), array(0x90, 0xBF), array(0x80, 0xBF), array(0x80, 0xBF)),
+ array(array(0xF1, 0xF3), array(0x80, 0xBF), array(0x80, 0xBF), array(0x80, 0xBF)),
+ array(array(0xF4, 0xF4), array(0x80, 0x8F), array(0x80, 0xBF), array(0x80, 0xBF)),
);
function is_valid($seq) {
- global $val_ranges;
- $b = ord($seq[0]);
- foreach ($val_ranges as $l) {
- if ($b >= $l[0][0] && $b <= $l[0][1]) {
- if (count($l) != strlen($seq)) {
- return false;
- }
- for ($n = 1; $n < strlen($seq); $n++) {
- if (ord($seq[$n]) < $l[$n][0] || ord($seq[$n]) > $l[$n][1]) {
- return false;
- }
- }
- return true;
- }
- }
- return false;
+ global $val_ranges;
+ $b = ord($seq[0]);
+ foreach ($val_ranges as $l) {
+ if ($b >= $l[0][0] && $b <= $l[0][1]) {
+ if (count($l) != strlen($seq)) {
+ return false;
+ }
+ for ($n = 1; $n < strlen($seq); $n++) {
+ if (ord($seq[$n]) < $l[$n][0] || ord($seq[$n]) > $l[$n][1]) {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+ return false;
}
function concordance($s) {
- $vhe = strlen(htmlspecialchars($s, ENT_QUOTES, "UTF-8")) > 0;
- $v = is_valid($s);
- return ($vhe === $v);
+ $vhe = strlen(htmlspecialchars($s, ENT_QUOTES, "UTF-8")) > 0;
+ $v = is_valid($s);
+ return ($vhe === $v);
}
for ($b1 = 0xC0; $b1 < 0xE0; $b1++) {
- for ($b2 = 0x80; $b2 < 0xBF; $b2++) {
- $s = chr($b1).chr($b2);
- if (!concordance($s))
- echo "Discordance for ".bin2hex($s),"\n";
- }
+ for ($b2 = 0x80; $b2 < 0xBF; $b2++) {
+ $s = chr($b1).chr($b2);
+ if (!concordance($s))
+ echo "Discordance for ".bin2hex($s),"\n";
+ }
}
for ($b1 = 0xE0; $b1 < 0xEF; $b1++) {
- for ($b2 = 0x80; $b2 < 0xBF; $b2++) {
- $s = chr($b1).chr($b2)."\x80";
- if (!concordance($s))
- echo "Discordance for ".bin2hex($s),"\n";
- $s = chr($b1).chr($b2)."\xBF";
- if (!concordance($s))
- echo "Discordance for ".bin2hex($s),"\n";
- }
+ for ($b2 = 0x80; $b2 < 0xBF; $b2++) {
+ $s = chr($b1).chr($b2)."\x80";
+ if (!concordance($s))
+ echo "Discordance for ".bin2hex($s),"\n";
+ $s = chr($b1).chr($b2)."\xBF";
+ if (!concordance($s))
+ echo "Discordance for ".bin2hex($s),"\n";
+ }
}
for ($b1 = 0xF0; $b1 < 0xFF; $b1++) {
- for ($b2 = 0x80; $b2 < 0xBF; $b2++) {
- $s = chr($b1).chr($b2)."\x80\x80";
- if (!concordance($s))
- echo "Discordance for ".bin2hex($s),"\n";
- $s = chr($b1).chr($b2)."\xBF\x80";
- if (!concordance($s))
- echo "Discordance for ".bin2hex($s),"\n";
- $s = chr($b1).chr($b2)."\x80\xBF";
- if (!concordance($s))
- echo "Discordance for ".bin2hex($s),"\n";
- $s = chr($b1).chr($b2)."\xBF\xBF";
- if (!concordance($s))
- echo "Discordance for ".bin2hex($s),"\n";
- }
+ for ($b2 = 0x80; $b2 < 0xBF; $b2++) {
+ $s = chr($b1).chr($b2)."\x80\x80";
+ if (!concordance($s))
+ echo "Discordance for ".bin2hex($s),"\n";
+ $s = chr($b1).chr($b2)."\xBF\x80";
+ if (!concordance($s))
+ echo "Discordance for ".bin2hex($s),"\n";
+ $s = chr($b1).chr($b2)."\x80\xBF";
+ if (!concordance($s))
+ echo "Discordance for ".bin2hex($s),"\n";
+ $s = chr($b1).chr($b2)."\xBF\xBF";
+ if (!concordance($s))
+ echo "Discordance for ".bin2hex($s),"\n";
+ }
}
echo "Done.\n";
--EXPECT--
diff --git a/ext/standard/tests/strings/htmlentities-utf.phpt b/ext/standard/tests/strings/htmlentities-utf.phpt
index 215f500c91..5325378593 100644
--- a/ext/standard/tests/strings/htmlentities-utf.phpt
+++ b/ext/standard/tests/strings/htmlentities-utf.phpt
@@ -6,15 +6,15 @@ output_handler=
<?php
@setlocale (LC_CTYPE, "C");
$strings = array("<", "\xD0", "\xD0\x90", "\xD0\x90\xD0", "\xD0\x90\xD0\xB0", "\xE0", "A\xE0", "\xE0\x80", "\xE0\x79", "\xE0\x80\xBE",
- "Voil\xE0", "Clich\xE9s",
- "\xFE", "\xFE\x41", "\xC3\xA9", "\xC3\x79", "\xF7\xBF\xBF\xBF", "\xFB\xBF\xBF\xBF\xBF", "\xFD\xBF\xBF\xBF\xBF\xBF",
- "\x41\xF7\xF7\x42", "\x42\xFB\xFB\x42", "\x43\xFD\xFD\x42", "\x44\xF7\xF7", "\x45\xFB\xFB", "\x46\xFD\xFD"
- );
+ "Voil\xE0", "Clich\xE9s",
+ "\xFE", "\xFE\x41", "\xC3\xA9", "\xC3\x79", "\xF7\xBF\xBF\xBF", "\xFB\xBF\xBF\xBF\xBF", "\xFD\xBF\xBF\xBF\xBF\xBF",
+ "\x41\xF7\xF7\x42", "\x42\xFB\xFB\x42", "\x43\xFD\xFD\x42", "\x44\xF7\xF7", "\x45\xFB\xFB", "\x46\xFD\xFD"
+ );
foreach($strings as $string) {
- $sc_encoded = htmlspecialchars ($string, ENT_QUOTES, "utf-8");
- var_dump(bin2hex($sc_encoded));
- $ent_encoded = htmlentities ($string, ENT_QUOTES, "utf-8");
- var_dump(bin2hex($ent_encoded));
+ $sc_encoded = htmlspecialchars ($string, ENT_QUOTES, "utf-8");
+ var_dump(bin2hex($sc_encoded));
+ $ent_encoded = htmlentities ($string, ENT_QUOTES, "utf-8");
+ var_dump(bin2hex($ent_encoded));
}
?>
--EXPECT--
diff --git a/ext/standard/tests/strings/htmlentities01.phpt b/ext/standard/tests/strings/htmlentities01.phpt
index 092027a7a4..269bd467b9 100644
--- a/ext/standard/tests/strings/htmlentities01.phpt
+++ b/ext/standard/tests/strings/htmlentities01.phpt
@@ -5,8 +5,8 @@ output_handler=
internal_encoding=pass
--FILE--
<?php
- var_dump(htmlentities("\x82\x86\x99\x9f", ENT_QUOTES, 'cp1252'));
- var_dump(htmlentities("\x80\xa2\xa3\xa4\xa5", ENT_QUOTES, 'cp1252'));
+ var_dump(htmlentities("\x82\x86\x99\x9f", ENT_QUOTES, 'cp1252'));
+ var_dump(htmlentities("\x80\xa2\xa3\xa4\xa5", ENT_QUOTES, 'cp1252'));
?>
--EXPECT--
string(28) "&sbquo;&dagger;&trade;&Yuml;"
diff --git a/ext/standard/tests/strings/htmlentities02.phpt b/ext/standard/tests/strings/htmlentities02.phpt
index ad75766ee6..6dcc4de483 100644
--- a/ext/standard/tests/strings/htmlentities02.phpt
+++ b/ext/standard/tests/strings/htmlentities02.phpt
@@ -13,8 +13,8 @@ default_charset=
internal_encoding=pass
--FILE--
<?php
- setlocale(LC_CTYPE, "fr_FR.ISO-8859-15", "fr_FR.ISO8859-15", 'fr_FR@euro');
- var_dump(htmlentities("\xbc\xbd\xbe", ENT_QUOTES, ''));
+ setlocale(LC_CTYPE, "fr_FR.ISO-8859-15", "fr_FR.ISO8859-15", 'fr_FR@euro');
+ var_dump(htmlentities("\xbc\xbd\xbe", ENT_QUOTES, ''));
?>
--EXPECT--
string(20) "&OElig;&oelig;&Yuml;"
diff --git a/ext/standard/tests/strings/htmlentities03.phpt b/ext/standard/tests/strings/htmlentities03.phpt
index 6b00e8b48c..b7e07fb375 100644
--- a/ext/standard/tests/strings/htmlentities03.phpt
+++ b/ext/standard/tests/strings/htmlentities03.phpt
@@ -13,8 +13,8 @@ default_charset=
internal_encoding=pass
--FILE--
<?php
- setlocale( LC_CTYPE, "de_DE.ISO-8859-1", "de_DE.ISO8859-1");
- var_dump(htmlentities("\xe4\xf6\xfc", ENT_QUOTES, ''));
+ setlocale( LC_CTYPE, "de_DE.ISO-8859-1", "de_DE.ISO8859-1");
+ var_dump(htmlentities("\xe4\xf6\xfc", ENT_QUOTES, ''));
?>
--EXPECT--
string(18) "&auml;&ouml;&uuml;"
diff --git a/ext/standard/tests/strings/htmlentities04.phpt b/ext/standard/tests/strings/htmlentities04.phpt
index 33f38682da..7e47d8d4fc 100644
--- a/ext/standard/tests/strings/htmlentities04.phpt
+++ b/ext/standard/tests/strings/htmlentities04.phpt
@@ -13,8 +13,8 @@ default_charset=
internal_encoding=pass
--FILE--
<?php
- setlocale( LC_CTYPE, "ja_JP.EUC-JP", "ja_JP.eucJP" );
- var_dump(htmlentities("\xa1\xa2\xa1\xa3\xa1\xa4", ENT_QUOTES, ''));
+ setlocale( LC_CTYPE, "ja_JP.EUC-JP", "ja_JP.eucJP" );
+ var_dump(htmlentities("\xa1\xa2\xa1\xa3\xa1\xa4", ENT_QUOTES, ''));
?>
--EXPECTF--
Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
diff --git a/ext/standard/tests/strings/htmlentities05.phpt b/ext/standard/tests/strings/htmlentities05.phpt
index f65a1a435a..04bf4deb00 100644
--- a/ext/standard/tests/strings/htmlentities05.phpt
+++ b/ext/standard/tests/strings/htmlentities05.phpt
@@ -8,9 +8,9 @@ internal_encoding=cp1252
extension_loaded("mbstring") or die("skip mbstring not available\n");
--FILE--
<?php
- print mb_internal_encoding()."\n";
- var_dump(htmlentities("\x82\x86\x99\x9f", ENT_QUOTES, ''));
- var_dump(htmlentities("\x80\xa2\xa3\xa4\xa5", ENT_QUOTES, ''));
+ print mb_internal_encoding()."\n";
+ var_dump(htmlentities("\x82\x86\x99\x9f", ENT_QUOTES, ''));
+ var_dump(htmlentities("\x80\xa2\xa3\xa4\xa5", ENT_QUOTES, ''));
?>
--EXPECT--
Windows-1252
diff --git a/ext/standard/tests/strings/htmlentities06.phpt b/ext/standard/tests/strings/htmlentities06.phpt
index 5027c0c193..487b5d33ff 100644
--- a/ext/standard/tests/strings/htmlentities06.phpt
+++ b/ext/standard/tests/strings/htmlentities06.phpt
@@ -8,9 +8,9 @@ internal_encoding=ISO-8859-15
extension_loaded("mbstring") or die("skip mbstring not available\n");
--FILE--
<?php
- mb_internal_encoding('ISO-8859-15');
- print mb_internal_encoding()."\n";
- var_dump(htmlentities("\xbc\xbd\xbe", ENT_QUOTES, ''));
+ mb_internal_encoding('ISO-8859-15');
+ print mb_internal_encoding()."\n";
+ var_dump(htmlentities("\xbc\xbd\xbe", ENT_QUOTES, ''));
?>
--EXPECT--
ISO-8859-15
diff --git a/ext/standard/tests/strings/htmlentities07.phpt b/ext/standard/tests/strings/htmlentities07.phpt
index fe43d32d49..04e138e0c7 100644
--- a/ext/standard/tests/strings/htmlentities07.phpt
+++ b/ext/standard/tests/strings/htmlentities07.phpt
@@ -8,9 +8,9 @@ internal_encoding=ISO-8859-1
extension_loaded("mbstring") or die("skip mbstring not available\n");
--FILE--
<?php
- mb_internal_encoding('ISO-8859-1');
- print mb_internal_encoding()."\n";
- var_dump(htmlentities("\xe4\xf6\xfc", ENT_QUOTES, ''));
+ mb_internal_encoding('ISO-8859-1');
+ print mb_internal_encoding()."\n";
+ var_dump(htmlentities("\xe4\xf6\xfc", ENT_QUOTES, ''));
?>
--EXPECT--
ISO-8859-1
diff --git a/ext/standard/tests/strings/htmlentities08.phpt b/ext/standard/tests/strings/htmlentities08.phpt
index b44796ec80..fdba4ede80 100644
--- a/ext/standard/tests/strings/htmlentities08.phpt
+++ b/ext/standard/tests/strings/htmlentities08.phpt
@@ -8,9 +8,9 @@ internal_encoding=EUC-JP
extension_loaded("mbstring") or die("skip mbstring not available\n");
--FILE--
<?php
- mb_internal_encoding('EUC-JP');
- print mb_internal_encoding()."\n";
- var_dump(htmlentities("\xa1\xa2\xa1\xa3\xa1\xa4", ENT_QUOTES, ''));
+ mb_internal_encoding('EUC-JP');
+ print mb_internal_encoding()."\n";
+ var_dump(htmlentities("\xa1\xa2\xa1\xa3\xa1\xa4", ENT_QUOTES, ''));
?>
--EXPECTF--
EUC-JP
diff --git a/ext/standard/tests/strings/htmlentities09.phpt b/ext/standard/tests/strings/htmlentities09.phpt
index 655c6d7a26..6ca0a1e39e 100644
--- a/ext/standard/tests/strings/htmlentities09.phpt
+++ b/ext/standard/tests/strings/htmlentities09.phpt
@@ -8,14 +8,12 @@ internal_encoding=Shift_JIS
extension_loaded("mbstring") or die("skip mbstring not available\n");
--FILE--
<?php
- mb_internal_encoding('Shift_JIS');
- print mb_internal_encoding()."\n";
- var_dump(bin2hex(htmlentities("\x81\x41\x81\x42\x81\x43", ENT_QUOTES, '')));
+ mb_internal_encoding('Shift_JIS');
+ print mb_internal_encoding()."\n";
+ var_dump(bin2hex(htmlentities("\x81\x41\x81\x42\x81\x43", ENT_QUOTES, '')));
?>
-===DONE===
--EXPECTF--
SJIS
Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in %s line %d
string(12) "814181428143"
-===DONE===
diff --git a/ext/standard/tests/strings/htmlentities10.phpt b/ext/standard/tests/strings/htmlentities10.phpt
index 5f6d8ffc57..2f8c42b7e5 100644
--- a/ext/standard/tests/strings/htmlentities10.phpt
+++ b/ext/standard/tests/strings/htmlentities10.phpt
@@ -6,9 +6,9 @@ internal_encoding=pass
default_charset=cp1252
--FILE--
<?php
- print ini_get('default_charset')."\n";
- var_dump(htmlentities("\x82\x86\x99\x9f", ENT_QUOTES, ''));
- var_dump(htmlentities("\x80\xa2\xa3\xa4\xa5", ENT_QUOTES, ''));
+ print ini_get('default_charset')."\n";
+ var_dump(htmlentities("\x82\x86\x99\x9f", ENT_QUOTES, ''));
+ var_dump(htmlentities("\x80\xa2\xa3\xa4\xa5", ENT_QUOTES, ''));
?>
--EXPECT--
cp1252
diff --git a/ext/standard/tests/strings/htmlentities11.phpt b/ext/standard/tests/strings/htmlentities11.phpt
index 0ee1044c13..c803f76a53 100644
--- a/ext/standard/tests/strings/htmlentities11.phpt
+++ b/ext/standard/tests/strings/htmlentities11.phpt
@@ -6,8 +6,8 @@ internal_encoding=pass
default_charset=ISO-8859-15
--FILE--
<?php
- print ini_get('default_charset')."\n";
- var_dump(htmlentities("\xbc\xbd\xbe", ENT_QUOTES, ''));
+ print ini_get('default_charset')."\n";
+ var_dump(htmlentities("\xbc\xbd\xbe", ENT_QUOTES, ''));
?>
--EXPECT--
ISO-8859-15
diff --git a/ext/standard/tests/strings/htmlentities12.phpt b/ext/standard/tests/strings/htmlentities12.phpt
index c3cb7b6440..c2963f1c86 100644
--- a/ext/standard/tests/strings/htmlentities12.phpt
+++ b/ext/standard/tests/strings/htmlentities12.phpt
@@ -6,8 +6,8 @@ internal_encoding=pass
default_charset=ISO-8859-1
--FILE--
<?php
- print ini_get('default_charset')."\n";
- var_dump(htmlentities("\xe4\xf6\xfc", ENT_QUOTES, ''));
+ print ini_get('default_charset')."\n";
+ var_dump(htmlentities("\xe4\xf6\xfc", ENT_QUOTES, ''));
?>
--EXPECT--
ISO-8859-1
diff --git a/ext/standard/tests/strings/htmlentities13.phpt b/ext/standard/tests/strings/htmlentities13.phpt
index bdea7a30ee..ac2c8cd4b0 100644
--- a/ext/standard/tests/strings/htmlentities13.phpt
+++ b/ext/standard/tests/strings/htmlentities13.phpt
@@ -7,8 +7,8 @@ default_charset=EUC-JP
filter.default=unsafe_raw
--FILE--
<?php
- print ini_get('default_charset')."\n";
- var_dump(htmlentities("\xa1\xa2\xa1\xa3\xa1\xa4", ENT_QUOTES, ''));
+ print ini_get('default_charset')."\n";
+ var_dump(htmlentities("\xa1\xa2\xa1\xa3\xa1\xa4", ENT_QUOTES, ''));
?>
--EXPECTF--
EUC-JP
diff --git a/ext/standard/tests/strings/htmlentities14.phpt b/ext/standard/tests/strings/htmlentities14.phpt
index e39a003726..60226cbe10 100644
--- a/ext/standard/tests/strings/htmlentities14.phpt
+++ b/ext/standard/tests/strings/htmlentities14.phpt
@@ -7,8 +7,8 @@ default_charset=Shift_JIS
filter.default=unsafe_raw
--FILE--
<?php
- print ini_get('default_charset')."\n";
- var_dump(htmlentities("\x81\x41\x81\x42\x81\x43", ENT_QUOTES, ''));
+ print ini_get('default_charset')."\n";
+ var_dump(htmlentities("\x81\x41\x81\x42\x81\x43", ENT_QUOTES, ''));
?>
--EXPECTF--
Shift_JIS
diff --git a/ext/standard/tests/strings/htmlentities16.phpt b/ext/standard/tests/strings/htmlentities16.phpt
index b253f4b1b2..1971f8340d 100644
--- a/ext/standard/tests/strings/htmlentities16.phpt
+++ b/ext/standard/tests/strings/htmlentities16.phpt
@@ -13,9 +13,7 @@ $str = "\x88\xa9\xf0\xee\xf1\xea\xee\xf8\xed\xfb\xe9";
var_dump(bin2hex($str), bin2hex(htmlentities($str, ENT_QUOTES, '')));
var_dump(htmlentities($str, ENT_QUOTES | ENT_HTML5, ''));
?>
-===DONE===
--EXPECT--
string(22) "88a9f0eef1eaeef8edfbe9"
string(42) "266575726f3b26636f70793bf0eef1eaeef8edfbe9"
string(58) "&euro;&copy;&rcy;&ocy;&scy;&kcy;&ocy;&shcy;&ncy;&ycy;&jcy;"
-===DONE===
diff --git a/ext/standard/tests/strings/htmlentities17.phpt b/ext/standard/tests/strings/htmlentities17.phpt
index d9e67a9b87..5e29de5d8e 100644
--- a/ext/standard/tests/strings/htmlentities17.phpt
+++ b/ext/standard/tests/strings/htmlentities17.phpt
@@ -3,25 +3,25 @@ htmlentities() / html_entity_decode() #8592 - #9002 table test
--FILE--
<?php
$tests = array(
- array(8853, '&oplus;', "e28a95"),
- array(8855, '&otimes;', "e28a97"),
- array(8869, '&perp;', "e28aa5"),
- array(8901, '&sdot;', "e28b85"),
- array(8968, '&lceil;', "e28c88"),
- array(8969, '&rceil;', "e28c89"),
- array(8970, '&lfloor;', "e28c8a"),
- array(8971, '&rfloor;', "e28c8b"),
- array(9001, '&lang;', "e28ca9"),
- array(9002, '&rang;', "e28caa")
+ array(8853, '&oplus;', "e28a95"),
+ array(8855, '&otimes;', "e28a97"),
+ array(8869, '&perp;', "e28aa5"),
+ array(8901, '&sdot;', "e28b85"),
+ array(8968, '&lceil;', "e28c88"),
+ array(8969, '&rceil;', "e28c89"),
+ array(8970, '&lfloor;', "e28c8a"),
+ array(8971, '&rfloor;', "e28c8b"),
+ array(9001, '&lang;', "e28ca9"),
+ array(9002, '&rang;', "e28caa")
);
foreach ($tests as $test) {
- var_dump(htmlentities(pack('H*', $test[2]), ENT_QUOTES, 'UTF-8'));
+ var_dump(htmlentities(pack('H*', $test[2]), ENT_QUOTES, 'UTF-8'));
}
foreach ($tests as $test) {
- list(,$result) = unpack('H6', html_entity_decode($test[1], ENT_QUOTES, 'UTF-8'));
- var_dump($result);
+ list(,$result) = unpack('H6', html_entity_decode($test[1], ENT_QUOTES, 'UTF-8'));
+ var_dump($result);
}
?>
--EXPECT--
diff --git a/ext/standard/tests/strings/htmlentities18.phpt b/ext/standard/tests/strings/htmlentities18.phpt
index d7bd2302c1..d9582e7dbc 100644
--- a/ext/standard/tests/strings/htmlentities18.phpt
+++ b/ext/standard/tests/strings/htmlentities18.phpt
@@ -3,21 +3,21 @@ htmlentities() / htmlspecialchars() "don't double encode" flag support
--FILE--
<?php
$tests = array(
- "abc",
- "abc&amp;sfdsa",
- "test&#043;s &amp; some more &#68;",
- "test&#x2b;s &amp; some more &#X44;",
- "&; &amp &#a; &9; &#xyz;",
- "&kffjadfdhsjfhjasdhffasdfas;",
- "&#8787978789",
- "&",
- "&&amp;&",
- "&ab&amp;&",
+ "abc",
+ "abc&amp;sfdsa",
+ "test&#043;s &amp; some more &#68;",
+ "test&#x2b;s &amp; some more &#X44;",
+ "&; &amp &#a; &9; &#xyz;",
+ "&kffjadfdhsjfhjasdhffasdfas;",
+ "&#8787978789",
+ "&",
+ "&&amp;&",
+ "&ab&amp;&",
);
foreach ($tests as $test) {
- var_dump(htmlentities($test, ENT_QUOTES, NULL, FALSE));
- var_dump(htmlspecialchars($test, ENT_QUOTES, NULL, FALSE));
+ var_dump(htmlentities($test, ENT_QUOTES, NULL, FALSE));
+ var_dump(htmlspecialchars($test, ENT_QUOTES, NULL, FALSE));
}
?>
--EXPECT--
diff --git a/ext/standard/tests/strings/htmlentities19.phpt b/ext/standard/tests/strings/htmlentities19.phpt
index a90358c613..bc607ad240 100644
--- a/ext/standard/tests/strings/htmlentities19.phpt
+++ b/ext/standard/tests/strings/htmlentities19.phpt
@@ -3,16 +3,16 @@ htmlentities() / htmlspecialchars() ENT_SUBSTITUTE
--FILE--
<?php
$tests = array(
- "\x41\xC2\x3E\x42", // Unicode TR #36, 3.1.1; do not consume valid successor bytes
- "\xE3\x80\x22", // Unicode TR #36, 3.6.1; use strategy #2
+ "\x41\xC2\x3E\x42", // Unicode TR #36, 3.1.1; do not consume valid successor bytes
+ "\xE3\x80\x22", // Unicode TR #36, 3.6.1; use strategy #2
"\x41\x98\xBA\x42\xE2\x98\x43\xE2\x98\xBA\xE2\x98", // example from HTML5, section 2.4
);
foreach ($tests as $test) {
$a = htmlentities($test, ENT_QUOTES | ENT_SUBSTITUTE, "UTF-8");
- var_dump($a, bin2hex($a));
+ var_dump($a, bin2hex($a));
$a = htmlspecialchars($test, ENT_QUOTES | ENT_SUBSTITUTE, "UTF-8");
- var_dump($a, bin2hex($a));
+ var_dump($a, bin2hex($a));
}
?>
--EXPECT--
diff --git a/ext/standard/tests/strings/htmlentities20.phpt b/ext/standard/tests/strings/htmlentities20.phpt
index ff52aca07a..956ecfc1b9 100644
--- a/ext/standard/tests/strings/htmlentities20.phpt
+++ b/ext/standard/tests/strings/htmlentities20.phpt
@@ -3,25 +3,25 @@ htmlentities() / htmlspecialchars() ENT_DISALLOWED
--FILE--
<?php
function codepoint_to_utf8($k) {
- if ($k < 0x80) {
- $retval = pack('C', $k);
- } else if ($k < 0x800) {
- $retval = pack('C2',
+ if ($k < 0x80) {
+ $retval = pack('C', $k);
+ } else if ($k < 0x800) {
+ $retval = pack('C2',
0xc0 | ($k >> 6),
0x80 | ($k & 0x3f));
- } else if ($k < 0x10000) {
+ } else if ($k < 0x10000) {
$retval = pack('C3',
0xe0 | ($k >> 12),
0x80 | (($k >> 6) & 0x3f),
0x80 | ($k & 0x3f));
- } else {
+ } else {
$retval = pack('C4',
0xf0 | ($k >> 18),
0x80 | (($k >> 12) & 0x3f),
0x80 | (($k >> 6) & 0x3f),
0x80 | ($k & 0x3f));
- }
- return $retval;
+ }
+ return $retval;
}
$tests = array(
diff --git a/ext/standard/tests/strings/htmlentities23.phpt b/ext/standard/tests/strings/htmlentities23.phpt
index 68e6e9439e..3b33e382e5 100644
--- a/ext/standard/tests/strings/htmlentities23.phpt
+++ b/ext/standard/tests/strings/htmlentities23.phpt
@@ -20,9 +20,9 @@ $tests = array(
foreach ($tests as $test) {
$a = htmlentities($test, ENT_QUOTES | ENT_SUBSTITUTE, "EUC-JP");
- var_dump($a, bin2hex($a));
+ var_dump($a, bin2hex($a));
$a = htmlspecialchars($test, ENT_QUOTES | ENT_SUBSTITUTE, "EUC-JP");
- var_dump($a, bin2hex($a));
+ var_dump($a, bin2hex($a));
echo "\n";
}
?>
diff --git a/ext/standard/tests/strings/htmlentities24.phpt b/ext/standard/tests/strings/htmlentities24.phpt
index 5a023df701..f2abfd5ba8 100644
--- a/ext/standard/tests/strings/htmlentities24.phpt
+++ b/ext/standard/tests/strings/htmlentities24.phpt
@@ -35,12 +35,6 @@ var_dump( htmlentities($str, ENT_QUOTES) );
var_dump( htmlentities($str, ENT_NOQUOTES) );
var_dump( htmlentities($str, ENT_COMPAT) );
-echo "\n*** Testing error conditions ***\n";
-/* zero argument */
-var_dump( htmlentities() );
-/* arguments more than expected */
-var_dump( htmlentities("\x84\x91",ENT_QUOTES, 'cp1252', "test1") );
-
echo "Done\n";
?>
--EXPECTF--
@@ -320,10 +314,4 @@ string(36) "A 'quote' is &lt;b&gt;bold&lt;/b&gt;"
string(46) "A &#039;quote&#039; is &lt;b&gt;bold&lt;/b&gt;"
string(36) "A 'quote' is &lt;b&gt;bold&lt;/b&gt;"
string(36) "A 'quote' is &lt;b&gt;bold&lt;/b&gt;"
-
-*** Testing error conditions ***
-
-Warning: htmlentities() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-string(14) "&bdquo;&lsquo;"
Done
diff --git a/ext/standard/tests/strings/htmlentities_html4.phpt b/ext/standard/tests/strings/htmlentities_html4.phpt
index 5d784c2af5..8e23fbaeca 100644
--- a/ext/standard/tests/strings/htmlentities_html4.phpt
+++ b/ext/standard/tests/strings/htmlentities_html4.phpt
@@ -3,31 +3,31 @@ htmlentities() conformance check (HTML 4)
--FILE--
<?php
function utf32_utf8($k) {
- if ($k < 0x80) {
- $retval = pack('C', $k);
- } else if ($k < 0x800) {
- $retval = pack('C2',
+ if ($k < 0x80) {
+ $retval = pack('C', $k);
+ } else if ($k < 0x800) {
+ $retval = pack('C2',
0xc0 | ($k >> 6),
0x80 | ($k & 0x3f));
- } else if ($k < 0x10000) {
+ } else if ($k < 0x10000) {
$retval = pack('C3',
0xe0 | ($k >> 12),
0x80 | (($k >> 6) & 0x3f),
0x80 | ($k & 0x3f));
- } else if ($k < 0x200000) {
+ } else if ($k < 0x200000) {
$retval = pack('C4',
0xf0 | ($k >> 18),
0x80 | (($k >> 12) & 0x3f),
0x80 | (($k >> 6) & 0x3f),
0x80 | ($k & 0x3f));
- } else if ($k < 0x4000000) {
+ } else if ($k < 0x4000000) {
$retval = pack('C5',
0xf8 | ($k >> 24),
0x80 | (($k >> 18) & 0x3f),
0x80 | (($k >> 12) & 0x3f),
0x80 | (($k >> 6) & 0x3f),
0x80 | ($k & 0x3f));
- } else {
+ } else {
$retval = pack('C6',
0xfc | ($k >> 30),
0x80 | (($k >> 24) & 0x3f),
@@ -35,8 +35,8 @@ function utf32_utf8($k) {
0x80 | (($k >> 12) & 0x3f),
0x80 | (($k >> 6) & 0x3f),
0x80 | ($k & 0x3f));
- }
- return $retval;
+ }
+ return $retval;
}
$table = get_html_translation_table(HTML_ENTITIES, ENT_QUOTES, 'UTF-8');
@@ -45,15 +45,15 @@ for ($i = 0; $i < 0x2710; $i++) {
if ($i >= 0xd800 && $i < 0xe000)
continue;
$str = utf32_utf8($i);
- if (isset($table[$str])) {
- printf("%s\tU+%05X\n", $table[$str], $i);
- unset($table[$str]);
- }
+ if (isset($table[$str])) {
+ printf("%s\tU+%05X\n", $table[$str], $i);
+ unset($table[$str]);
+ }
}
if (!empty($table)) {
- echo "Not matched entities: ";
- var_dump($table);
+ echo "Not matched entities: ";
+ var_dump($table);
}
?>
diff --git a/ext/standard/tests/strings/htmlentities_html5.phpt b/ext/standard/tests/strings/htmlentities_html5.phpt
index 4a91012bd7..d3e94d5dba 100644
--- a/ext/standard/tests/strings/htmlentities_html5.phpt
+++ b/ext/standard/tests/strings/htmlentities_html5.phpt
@@ -3,25 +3,25 @@ htmlentities() conformance check (HTML 5)
--FILE--
<?php
function utf32_utf8($k) {
- if ($k < 0x80) {
- $retval = pack('C', $k);
- } else if ($k < 0x800) {
- $retval = pack('C2',
+ if ($k < 0x80) {
+ $retval = pack('C', $k);
+ } else if ($k < 0x800) {
+ $retval = pack('C2',
0xc0 | ($k >> 6),
0x80 | ($k & 0x3f));
- } else if ($k < 0x10000) {
+ } else if ($k < 0x10000) {
$retval = pack('C3',
0xe0 | ($k >> 12),
0x80 | (($k >> 6) & 0x3f),
0x80 | ($k & 0x3f));
- } else {
+ } else {
$retval = pack('C4',
0xf0 | ($k >> 18),
0x80 | (($k >> 12) & 0x3f),
0x80 | (($k >> 6) & 0x3f),
0x80 | ($k & 0x3f));
- }
- return $retval;
+ }
+ return $retval;
}
for ($i = 0; $i < 0x1DFFF; $i++) {
diff --git a/ext/standard/tests/strings/htmlspecialchars.phpt b/ext/standard/tests/strings/htmlspecialchars.phpt
index 8506c73e72..6e5c5fac36 100644
--- a/ext/standard/tests/strings/htmlspecialchars.phpt
+++ b/ext/standard/tests/strings/htmlspecialchars.phpt
@@ -35,13 +35,6 @@ var_dump( htmlspecialchars($str, ENT_QUOTES) );
var_dump( htmlspecialchars($str, ENT_NOQUOTES) );
var_dump( htmlspecialchars($str, ENT_COMPAT) );
-echo "\n*** Testing error conditions ***\n";
-/* zero argument */
-var_dump( htmlspecialchars() );
-
-/* giving arguments more than expected */
-var_dump( htmlspecialchars("<br>",ENT_QUOTES,'iso-8859-1', "test2") );
-
echo "Done\n"
?>
--EXPECTF--
@@ -321,10 +314,4 @@ string(36) "A 'quote' is &lt;b&gt;bold&lt;/b&gt;"
string(46) "A &#039;quote&#039; is &lt;b&gt;bold&lt;/b&gt;"
string(36) "A 'quote' is &lt;b&gt;bold&lt;/b&gt;"
string(36) "A 'quote' is &lt;b&gt;bold&lt;/b&gt;"
-
-*** Testing error conditions ***
-
-Warning: htmlspecialchars() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-string(10) "&lt;br&gt;"
Done
diff --git a/ext/standard/tests/strings/htmlspecialchars_basic.phpt b/ext/standard/tests/strings/htmlspecialchars_basic.phpt
index 4ac7733702..9bb4e4f82c 100644
--- a/ext/standard/tests/strings/htmlspecialchars_basic.phpt
+++ b/ext/standard/tests/strings/htmlspecialchars_basic.phpt
@@ -55,7 +55,6 @@ echo "Test 28: " . htmlspecialchars ($s1, ENT_NOQUOTES, "ISO-8859-1", true);
echo "Test 29: " . htmlspecialchars ($s2, ENT_NOQUOTES, "ISO-8859-1", true);
?>
-===DONE===
--EXPECT--
*** Testing htmlspecialchars() : basic functionality ***
Basic tests
@@ -94,4 +93,3 @@ Test 27: "300 &lt; 400"
Try with double decode TRUE
Test 28: &amp;quot;&amp;amp;xyz&amp;gt;abc&amp;quot;
Test 29: &amp;quot;&amp;amp;123&amp;lt;456&amp;quot;
-===DONE===
diff --git a/ext/standard/tests/strings/htmlspecialchars_decode_variation6.phpt b/ext/standard/tests/strings/htmlspecialchars_decode_variation6.phpt
index 596a883be2..8a6100ac45 100644
--- a/ext/standard/tests/strings/htmlspecialchars_decode_variation6.phpt
+++ b/ext/standard/tests/strings/htmlspecialchars_decode_variation6.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/implode.phpt b/ext/standard/tests/strings/implode.phpt
index 330ba2ff30..ec685586ef 100644
--- a/ext/standard/tests/strings/implode.phpt
+++ b/ext/standard/tests/strings/implode.phpt
@@ -12,5 +12,5 @@ echo implode(':', array('foo', array('bar', 'baz'), 'burp'))."\n";
foobarbaz
foo:bar:baz
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
foo:Array:burp
diff --git a/ext/standard/tests/strings/implode1.phpt b/ext/standard/tests/strings/implode1.phpt
index 629f4ce60c..ae460d6037 100644
--- a/ext/standard/tests/strings/implode1.phpt
+++ b/ext/standard/tests/strings/implode1.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/join_basic.phpt b/ext/standard/tests/strings/join_basic.phpt
index 483976d942..0429fe0b49 100644
--- a/ext/standard/tests/strings/join_basic.phpt
+++ b/ext/standard/tests/strings/join_basic.phpt
@@ -14,7 +14,7 @@ echo "*** Testing join() : basic functionality ***\n";
$glue = ',';
$pieces = array(1, 2, 3, 4);
-// pieces as arry with numeric values
+// pieces as array with numeric values
var_dump( join($glue, $pieces) );
// pieces as array with strings values
diff --git a/ext/standard/tests/strings/join_error.phpt b/ext/standard/tests/strings/join_error.phpt
index 36ee9d7ba6..fa15b75da5 100644
--- a/ext/standard/tests/strings/join_error.phpt
+++ b/ext/standard/tests/strings/join_error.phpt
@@ -10,41 +10,21 @@ Test join() function: error conditions
echo "*** Testing join() : error conditions ***\n";
-// Zero argument
-echo "\n-- Testing join() function with Zero arguments --\n";
-var_dump( join() );
-
-// More than expected number of arguments
-echo "\n-- Testing join() function with more than expected no. of arguments --\n";
-$glue = 'string_val';
-$pieces = array(1, 2);
-$extra_arg = 10;
-
-var_dump( join($glue, $pieces, $extra_arg) );
-
// Less than expected number of arguments
echo "\n-- Testing join() with less than expected no. of arguments --\n";
$glue = 'string_val';
-var_dump( join($glue));
+try {
+ var_dump(join($glue));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
*** Testing join() : error conditions ***
--- Testing join() function with Zero arguments --
-
-Warning: join() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
--- Testing join() function with more than expected no. of arguments --
-
-Warning: join() expects at most 2 parameters, 3 given in %s on line %d
-NULL
-
-- Testing join() with less than expected no. of arguments --
-
-Warning: join(): Argument must be an array in %s on line %d
-NULL
+Argument must be an array
Done
diff --git a/ext/standard/tests/strings/join_variation1.phpt b/ext/standard/tests/strings/join_variation1.phpt
index 695ee2ddca..c3035fb57f 100644
--- a/ext/standard/tests/strings/join_variation1.phpt
+++ b/ext/standard/tests/strings/join_variation1.phpt
@@ -91,9 +91,13 @@ for($index = 0; $index < count($values); $index ++) {
echo "-- Iteration $counter --\n";
$glue = $values [$index];
- var_dump( join($glue, $pieces) );
+ try {
+ var_dump(join($glue, $pieces));
+ } catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
- $counter ++;
+ $counter++;
}
echo "Done\n";
@@ -121,35 +125,15 @@ string(29) "element11.07654321E-9element2"
-- Iteration 9 --
string(19) "element10.5element2"
-- Iteration 10 --
-
-Notice: Array to string conversion in %s on line %d
-
-Deprecated: join(): Passing glue string after array is deprecated. Swap the parameters in %s on line %d
-string(0) ""
+The first argument must be a string
-- Iteration 11 --
-
-Notice: Array to string conversion in %s on line %d
-
-Deprecated: join(): Passing glue string after array is deprecated. Swap the parameters in %s on line %d
-string(1) "0"
+The first argument must be a string
-- Iteration 12 --
-
-Notice: Array to string conversion in %s on line %d
-
-Deprecated: join(): Passing glue string after array is deprecated. Swap the parameters in %s on line %d
-string(1) "1"
+The first argument must be a string
-- Iteration 13 --
-
-Notice: Array to string conversion in %s on line %d
-
-Deprecated: join(): Passing glue string after array is deprecated. Swap the parameters in %s on line %d
-string(7) "1Array2"
+The first argument must be a string
-- Iteration 14 --
-
-Notice: Array to string conversion in %s on line %d
-
-Deprecated: join(): Passing glue string after array is deprecated. Swap the parameters in %s on line %d
-string(11) "redArraypen"
+The first argument must be a string
-- Iteration 15 --
string(17) "element11element2"
-- Iteration 16 --
@@ -169,7 +153,7 @@ string(16) "element1element2"
-- Iteration 23 --
string(16) "element1element2"
-- Iteration 24 --
-string(%d) "element1Resource id #%delement2"
+join() expects parameter 1 to be string or array, resource given
-- Iteration 25 --
string(16) "element1element2"
-- Iteration 26 --
diff --git a/ext/standard/tests/strings/join_variation2.phpt b/ext/standard/tests/strings/join_variation2.phpt
index 03b3250b40..d44ff90921 100644
--- a/ext/standard/tests/strings/join_variation2.phpt
+++ b/ext/standard/tests/strings/join_variation2.phpt
@@ -20,7 +20,7 @@ $glue = '::';
$unset_var = array(1, 2);
unset($unset_var);
-// get a resouce variable
+// get a resource variable
$fp = fopen(__FILE__, "r");
// define a class
@@ -86,12 +86,16 @@ $values = array (
echo "\n--- Testing join() by supplying different values for 'pieces' argument ---\n";
$counter = 1;
for($index = 0; $index < count($values); $index ++) {
- echo "-- Iteration $counter --\n";
- $pieces = $values [$index];
+ echo "-- Iteration $counter --\n";
+ $pieces = $values [$index];
- var_dump( join($glue, $pieces) );
+ try {
+ var_dump( join($glue, $pieces) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
- $counter ++;
+ $counter ++;
}
// close the resources used
@@ -99,100 +103,54 @@ fclose($fp);
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
*** Testing join() : usage variations ***
--- Testing join() by supplying different values for 'pieces' argument ---
-- Iteration 1 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+join() expects parameter 2 to be array, int given
-- Iteration 2 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+join() expects parameter 2 to be array, int given
-- Iteration 3 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+join() expects parameter 2 to be array, int given
-- Iteration 4 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+join() expects parameter 2 to be array, int given
-- Iteration 5 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+join() expects parameter 2 to be array, float given
-- Iteration 6 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+join() expects parameter 2 to be array, float given
-- Iteration 7 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+join() expects parameter 2 to be array, float given
-- Iteration 8 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+join() expects parameter 2 to be array, float given
-- Iteration 9 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+join() expects parameter 2 to be array, float given
-- Iteration 10 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+join() expects parameter 2 to be array, bool given
-- Iteration 11 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+join() expects parameter 2 to be array, bool given
-- Iteration 12 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+join() expects parameter 2 to be array, bool given
-- Iteration 13 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+join() expects parameter 2 to be array, bool given
-- Iteration 14 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+join() expects parameter 2 to be array, string given
-- Iteration 15 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+join() expects parameter 2 to be array, string given
-- Iteration 16 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+join() expects parameter 2 to be array, object given
-- Iteration 17 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+join() expects parameter 2 to be array, string given
-- Iteration 18 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+join() expects parameter 2 to be array, string given
-- Iteration 19 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+join() expects parameter 2 to be array, null given
-- Iteration 20 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+join() expects parameter 2 to be array, null given
-- Iteration 21 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+join() expects parameter 2 to be array, resource given
-- Iteration 22 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+join() expects parameter 2 to be array, null given
-- Iteration 23 --
-
-Warning: join(): Invalid arguments passed in %s on line %d
-NULL
+join() expects parameter 2 to be array, null given
Done
diff --git a/ext/standard/tests/strings/join_variation3.phpt b/ext/standard/tests/strings/join_variation3.phpt
index c3799cc01a..4e3b50a1fd 100644
--- a/ext/standard/tests/strings/join_variation3.phpt
+++ b/ext/standard/tests/strings/join_variation3.phpt
@@ -37,7 +37,7 @@ $pieces_arrays = array (
array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true),
array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6),
- // array with repetative keys
+ // array with repetitive keys
array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3)
);
@@ -62,9 +62,9 @@ string(6) "1], [2"
string(10) "1.1], [2.2"
-- Iteration 3 --
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
string(14) "Array], [Array"
-- Iteration 4 --
string(5) "], [1"
diff --git a/ext/standard/tests/strings/join_variation4.phpt b/ext/standard/tests/strings/join_variation4.phpt
index f6154f1e4d..e1739facc5 100644
--- a/ext/standard/tests/strings/join_variation4.phpt
+++ b/ext/standard/tests/strings/join_variation4.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/join_variation5.phpt b/ext/standard/tests/strings/join_variation5.phpt
index e3f3e7ec08..4e8ad88d14 100644
--- a/ext/standard/tests/strings/join_variation5.phpt
+++ b/ext/standard/tests/strings/join_variation5.phpt
@@ -16,36 +16,36 @@ echo "*** Testing implode() : usage variations - sub arrays ***\n";
$sub_array = array(array(1,2,3,4), array(1 => "one", 2 => "two"), "PHP", 50);
// pieces as array containing sub array
-var_dump( join("TEST", $sub_array) );
+var_dump(join("TEST", $sub_array));
// glue as array & pieces as array containing sub array
-var_dump( join(array(1, 2, 3, 4), $sub_array) );
+try {
+ var_dump(join(array(1, 2, 3, 4), $sub_array));
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
-// numeric value as glue, pieces as array containg sub array
-var_dump( join(2, $sub_array) );
+// numeric value as glue, pieces as array containing sub array
+var_dump(join(2, $sub_array));
// using directly the sub_array as pieces
-var_dump( join(", ", $sub_array[0]) );
-var_dump( join(", ", $sub_array[1]) );
+var_dump(join(", ", $sub_array[0]));
+var_dump(join(", ", $sub_array[1]));
echo "Done\n";
?>
--EXPECTF--
*** Testing implode() : usage variations - sub arrays ***
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
string(27) "ArrayTESTArrayTESTPHPTEST50"
+The first argument must be a string
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
-Deprecated: join(): Passing glue string after array is deprecated. Swap the parameters in %s on line %d
-string(19) "1Array2Array3Array4"
-
-Notice: Array to string conversion in %s on line %d
-
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
string(18) "Array2Array2PHP250"
string(10) "1, 2, 3, 4"
string(8) "one, two"
diff --git a/ext/standard/tests/strings/lcfirst.phpt b/ext/standard/tests/strings/lcfirst.phpt
index 8178fa2eb5..5f754d7b2b 100644
--- a/ext/standard/tests/strings/lcfirst.phpt
+++ b/ext/standard/tests/strings/lcfirst.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/levenshtein.phpt b/ext/standard/tests/strings/levenshtein.phpt
index 1ac05cf2ae..b4b7c03e7f 100644
--- a/ext/standard/tests/strings/levenshtein.phpt
+++ b/ext/standard/tests/strings/levenshtein.phpt
@@ -63,10 +63,8 @@ $n += test_me("gt maxlength2", -1, "A", "AbcdefghijklmnopqrstuvwxyzAbcdefghijkl
echo ($n==0)?"all passed\n":"$n failed\n";
-var_dump(levenshtein(array(), array()));
var_dump(levenshtein("", "", -1, -1, -1));
var_dump(levenshtein("", "", 10, 10, 10));
-var_dump(levenshtein(""));
?>
--EXPECTF--
@@ -76,11 +74,5 @@ Warning: levenshtein(): Argument string(s) too long in %s on line %d
Warning: levenshtein(): Argument string(s) too long in %s on line %d
all passed
-
-Warning: levenshtein() expects parameter 1 to be string, array given in %s on line %d
-NULL
int(0)
int(0)
-
-Warning: Wrong parameter count for levenshtein() in %s on line %d
-NULL
diff --git a/ext/standard/tests/strings/ltrim.phpt b/ext/standard/tests/strings/ltrim.phpt
index 638c93557f..51287e04d7 100644
--- a/ext/standard/tests/strings/ltrim.phpt
+++ b/ext/standard/tests/strings/ltrim.phpt
@@ -9,12 +9,6 @@ Test ltrim() function
echo "\n *** Output for Error Conditions ***\n";
- echo "\n *** Output for zero argument ***\n";
- var_dump( ltrim() );
-
- echo "\n *** Output for more than valid number of arguments (Valid are 1 or 2 arguments) ***\n";
- var_dump( ltrim("", " ", 1) );
-
/* heredoc string */
$str = <<<EOD
us
@@ -50,16 +44,6 @@ echo "\nDone\n";
--EXPECTF--
*** Output for Error Conditions ***
- *** Output for zero argument ***
-
-Warning: ltrim() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
- *** Output for more than valid number of arguments (Valid are 1 or 2 arguments) ***
-
-Warning: ltrim() expects at most 2 parameters, 3 given in %s on line %d
-NULL
-
*** Using heredoc string ***
string(17) "ng heredoc string"
diff --git a/ext/standard/tests/strings/ltrim_basic.phpt b/ext/standard/tests/strings/ltrim_basic.phpt
index 45967fa24b..61994364a8 100644
--- a/ext/standard/tests/strings/ltrim_basic.phpt
+++ b/ext/standard/tests/strings/ltrim_basic.phpt
@@ -32,7 +32,6 @@ echo "\n-- Trim the ASCII control characters at the beginning of a string --\n";
var_dump(ltrim($binary, "\x00..\x1F"));
?>
-===DONE===
--EXPECT--
*** Testing ltrim() : basic functionality ***
@@ -50,4 +49,3 @@ string(10) "0123456789"
-- Trim the ASCII control characters at the beginning of a string --
string(14) "Example string"
-===DONE===
diff --git a/ext/standard/tests/strings/ltrim_error.phpt b/ext/standard/tests/strings/ltrim_error.phpt
index 694d9fea18..9da128c890 100644
--- a/ext/standard/tests/strings/ltrim_error.phpt
+++ b/ext/standard/tests/strings/ltrim_error.phpt
@@ -11,14 +11,6 @@ Test ltrim() function : error conditions
echo "*** Testing ltrim() : error conditions ***\n";
-echo "\n-- Testing ltrim() function with no arguments --\n";
-var_dump( ltrim() );
-
-echo "\n-- Testing ltrim() function with more than expected no. of arguments --\n";
-$extra_arg = 10;
-var_dump( ltrim("Hello World", "Heo", $extra_arg) );
-
-
$hello = " Hello World\n";
echo "\n-- Test ltrim function with various invalid charlists\n";
var_dump(ltrim($hello, "..a"));
@@ -27,20 +19,9 @@ var_dump(ltrim($hello, "z..a"));
var_dump(ltrim($hello, "a..b..c"));
?>
-===DONE===
--EXPECTF--
*** Testing ltrim() : error conditions ***
--- Testing ltrim() function with no arguments --
-
-Warning: ltrim() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
--- Testing ltrim() function with more than expected no. of arguments --
-
-Warning: ltrim() expects at most 2 parameters, 3 given in %s on line %d
-NULL
-
-- Test ltrim function with various invalid charlists
Warning: ltrim(): Invalid '..'-range, no character to the left of '..' in %s on line %d
@@ -58,4 +39,3 @@ string(14) " Hello World
Warning: ltrim(): Invalid '..'-range in %s on line %d
string(14) " Hello World
"
-===DONE===
diff --git a/ext/standard/tests/strings/md5_basic1.phpt b/ext/standard/tests/strings/md5_basic1.phpt
index e9898cd0c0..6e8dfe7fde 100644
--- a/ext/standard/tests/strings/md5_basic1.phpt
+++ b/ext/standard/tests/strings/md5_basic1.phpt
@@ -10,8 +10,6 @@ Test md5() function : basic functionality
echo "*** Testing md5() : basic functionality ***\n";
var_dump(md5("apple"));
?>
-===DONE===
--EXPECT--
*** Testing md5() : basic functionality ***
string(32) "1f3870be274f6c49b3e31a0c6728957f"
-===DONE===
diff --git a/ext/standard/tests/strings/md5_basic2.phpt b/ext/standard/tests/strings/md5_basic2.phpt
index e72fd40077..0e2db58e95 100644
--- a/ext/standard/tests/strings/md5_basic2.phpt
+++ b/ext/standard/tests/strings/md5_basic2.phpt
@@ -15,16 +15,14 @@ var_dump(bin2hex($md5_raw));
$md5 = md5($str, false);
if (strcmp(bin2hex($md5_raw), $md5) == 0 ) {
- echo "TEST PASSED\n";
+ echo "TEST PASSED\n";
} else {
- echo "TEST FAILED\n";
- var_dump($md5_raw, $md5);
+ echo "TEST FAILED\n";
+ var_dump($md5_raw, $md5);
}
?>
-===DONE===
--EXPECT--
*** Testing md5() : basic functionality - with raw output***
string(32) "b10a8db164e0754105b7a99be72e3fe5"
TEST PASSED
-===DONE===
diff --git a/ext/standard/tests/strings/md5_file.phpt b/ext/standard/tests/strings/md5_file.phpt
index 45009669f4..200bb3b739 100644
--- a/ext/standard/tests/strings/md5_file.phpt
+++ b/ext/standard/tests/strings/md5_file.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/metaphone.phpt b/ext/standard/tests/strings/metaphone.phpt
index ef1d23d89a..2bc16b3248 100644
--- a/ext/standard/tests/strings/metaphone.phpt
+++ b/ext/standard/tests/strings/metaphone.phpt
@@ -3,7 +3,6 @@ metaphone() tests
--FILE--
<?php
-var_dump(metaphone());
var_dump(metaphone(""));
var_dump(metaphone(-1));
var_dump(metaphone(-1, -1));
@@ -20,14 +19,12 @@ $array = array(
);
foreach($array as $str) {
- var_dump(metaphone($str));
+ var_dump(metaphone($str));
}
echo "Done\n";
?>
--EXPECTF--
-Warning: metaphone() expects at least 1 parameter, 0 given in %s on line %d
-NULL
string(0) ""
string(0) ""
bool(false)
diff --git a/ext/standard/tests/strings/money_format_basic1.phpt b/ext/standard/tests/strings/money_format_basic1.phpt
deleted file mode 100644
index a9e8f70818..0000000000
--- a/ext/standard/tests/strings/money_format_basic1.phpt
+++ /dev/null
@@ -1,103 +0,0 @@
---TEST--
-Test money_format() function : basic functionality using national currency symbols
---SKIPIF--
-<?php
- if (!function_exists('money_format')) {
- die("SKIP money_format - not supported\n");
- }
-?>
---FILE--
-<?php
-/* Prototype : string money_format ( string $format , float $number )
- * Description: Formats a number as a currency string
- * Source code: ext/standard/string.c
-*/
-
-// ===========================================================================================
-// = We do not test for exact return-values, as those might be different between OS-versions =
-// ===========================================================================================
-
-echo "*** Testing money_format() : basic functionality***\n";
-
-$value = 1234.5678;
-$negative_value = -1234.5678;
-
-// Format with 14 positions of width, 8 digits of
-// left precision, 2 of right precision using national
-// format for en_US
-echo "Format values with 14 positions, 8 digits to left, 2 to right using national format\n";
-echo gettype(money_format('%14#8.2n', $value))."\n";
-echo gettype(money_format('%14#8.2n', $negative_value))."\n";
-
-// Same again but use '(' for negative values
-echo "Format again but with ( for negative values\n";
-echo gettype(money_format('%(14#8.2n', $value))."\n";
-echo gettype(money_format('%(14#8.2n', $negative_value))."\n";
-
-// Same again but use a '0' for padding character
-echo "Format with 0 for padding character\n";
-echo gettype(money_format('%=014#8.2n', $value))."\n";
-echo gettype(money_format('%=014#8.2n', $negative_value))."\n";
-
-// Same again but use a '*' for padding character
-echo "Format again with * for padding character\n";
-echo gettype(money_format('%=*14#8.2n', $value))."\n";
-echo gettype(money_format('%=*14#8.2n', $negative_value))."\n";
-
-// Same again but disable grouping character
-echo "Format again but disable grouping character\n";
-echo gettype(money_format('%=*^14#8.2n', $value))."\n";
-echo gettype(money_format('%=*^14#8.2n', $negative_value))."\n";
-
-// Same again but suppress currency symbol
-echo "Format again suppress currency symbol\n";
-echo gettype(money_format('%=*!14#8.2n', $value))."\n";
-echo gettype(money_format('%=*!14#8.2n', $negative_value))."\n";
-
-?>
-===DONE===
---EXPECTF--
-*** Testing money_format() : basic functionality***
-Format values with 14 positions, 8 digits to left, 2 to right using national format
-
-Deprecated: Function money_format() is deprecated in %s on line %d
-string
-
-Deprecated: Function money_format() is deprecated in %s on line %d
-string
-Format again but with ( for negative values
-
-Deprecated: Function money_format() is deprecated in %s on line %d
-string
-
-Deprecated: Function money_format() is deprecated in %s on line %d
-string
-Format with 0 for padding character
-
-Deprecated: Function money_format() is deprecated in %s on line %d
-string
-
-Deprecated: Function money_format() is deprecated in %s on line %d
-string
-Format again with * for padding character
-
-Deprecated: Function money_format() is deprecated in %s on line %d
-string
-
-Deprecated: Function money_format() is deprecated in %s on line %d
-string
-Format again but disable grouping character
-
-Deprecated: Function money_format() is deprecated in %s on line %d
-string
-
-Deprecated: Function money_format() is deprecated in %s on line %d
-string
-Format again suppress currency symbol
-
-Deprecated: Function money_format() is deprecated in %s on line %d
-string
-
-Deprecated: Function money_format() is deprecated in %s on line %d
-string
-===DONE===
diff --git a/ext/standard/tests/strings/money_format_error.phpt b/ext/standard/tests/strings/money_format_error.phpt
deleted file mode 100644
index da725a4131..0000000000
--- a/ext/standard/tests/strings/money_format_error.phpt
+++ /dev/null
@@ -1,69 +0,0 @@
---TEST--
-Test money_format() function : error conditions
---SKIPIF--
-<?php
- if (!function_exists('money_format')) {
- die("SKIP money_format - not supported\n");
- }
-?>
---FILE--
-<?php
-/* Prototype : string money_format ( string $format , float $number )
- * Description: Formats a number as a currency string
- * Source code: ext/standard/string.c
-*/
-
-// ===========================================================================================
-// = We do not test for exact return-values, as those might be different between OS-versions =
-// ===========================================================================================
-
-$string = '%14#8.2n';
-$value = 1234.56;
-$extra_arg = 10;
-
-echo "*** Testing money_format() : error conditions ***\n";
-
-echo "\n-- Testing money_format() function with no arguments --\n";
-var_dump( money_format() );
-
-echo "\n-- Testing money_format() function with insufficient arguments --\n";
-var_dump( money_format($string) );
-
-echo "\n-- Testing money_format() function with more than expected no. of arguments --\n";
-var_dump( money_format($string, $value, $extra_arg) );
-
-echo "\n-- Testing money_format() function with more than one token --\n";
-var_dump( money_format($string . $string, $value) );
-?>
-===DONE===
---EXPECTF--
-*** Testing money_format() : error conditions ***
-
--- Testing money_format() function with no arguments --
-
-Deprecated: Function money_format() is deprecated in %s on line %d
-
-Warning: money_format() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
--- Testing money_format() function with insufficient arguments --
-
-Deprecated: Function money_format() is deprecated in %s on line %d
-
-Warning: money_format() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
--- Testing money_format() function with more than expected no. of arguments --
-
-Deprecated: Function money_format() is deprecated in %s on line %d
-
-Warning: money_format() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
--- Testing money_format() function with more than one token --
-
-Deprecated: Function money_format() is deprecated in %s on line %d
-
-Warning: money_format(): Only a single %ci or %cn token can be used in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/standard/tests/strings/moneyformat.phpt b/ext/standard/tests/strings/moneyformat.phpt
deleted file mode 100644
index 9c10148f7d..0000000000
--- a/ext/standard/tests/strings/moneyformat.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-money_format test
---SKIPIF--
-<?php
- if (!function_exists('money_format')) {
- die("SKIP money_format - not supported\n");
- }
-
-if (setlocale(LC_MONETARY, 'en_US') === false) {
- die('skip en_US locale not available');
-}
-?>
---FILE--
-<?php
-setlocale(LC_MONETARY, 'en_US');
-var_dump( money_format("X%nY", 3.1415));
-?>
---EXPECTF--
-Deprecated: Function money_format() is deprecated in %s on line %d
-string(7) "X$3.14Y"
diff --git a/ext/standard/tests/strings/nl2br.phpt b/ext/standard/tests/strings/nl2br.phpt
index 728f3339a0..b2ff9cf090 100644
--- a/ext/standard/tests/strings/nl2br.phpt
+++ b/ext/standard/tests/strings/nl2br.phpt
@@ -2,17 +2,17 @@
nl2br() function
--FILE--
<?php
- var_dump(nl2br("test"));
- var_dump(nl2br(""));
- var_dump(nl2br(NULL));
- var_dump(nl2br("\r\n"));
- var_dump(nl2br("\n"));
- var_dump(nl2br("\r"));
- var_dump(nl2br("\n\r"));
+ var_dump(nl2br("test"));
+ var_dump(nl2br(""));
+ var_dump(nl2br(NULL));
+ var_dump(nl2br("\r\n"));
+ var_dump(nl2br("\n"));
+ var_dump(nl2br("\r"));
+ var_dump(nl2br("\n\r"));
- var_dump(nl2br("\n\r\r\n\r\r\r\r"));
- var_dump(nl2br("\n\r\n\n\r\n\r\r\n\r\n"));
- var_dump(nl2br("\n\r\n\n\n\n\r\r\r\r\n\r"));
+ var_dump(nl2br("\n\r\r\n\r\r\r\r"));
+ var_dump(nl2br("\n\r\n\n\r\n\r\r\n\r\n"));
+ var_dump(nl2br("\n\r\n\n\n\n\r\r\r\r\n\r"));
?>
--EXPECT--
diff --git a/ext/standard/tests/strings/nl_langinfo_basic.phpt b/ext/standard/tests/strings/nl_langinfo_basic.phpt
index c940479065..c686caf25d 100644
--- a/ext/standard/tests/strings/nl_langinfo_basic.phpt
+++ b/ext/standard/tests/strings/nl_langinfo_basic.phpt
@@ -26,7 +26,6 @@ var_dump(nl_langinfo(RADIXCHAR));
setlocale(LC_ALL, $original);
?>
-===DONE===
--EXPECT--
*** Testing nl_langinfo() : basic functionality ***
string(3) "Mon"
@@ -34,4 +33,3 @@ string(9) "Wednesday"
string(3) "Jul"
string(5) "April"
string(1) "."
-===DONE===
diff --git a/ext/standard/tests/strings/number_format_basic.phpt b/ext/standard/tests/strings/number_format_basic.phpt
index 79ec7b85ac..f06a55cb63 100644
--- a/ext/standard/tests/strings/number_format_basic.phpt
+++ b/ext/standard/tests/strings/number_format_basic.phpt
@@ -11,43 +11,42 @@ Test number_format() - basic function test number_format()
echo "*** Testing number_format() : basic functionality ***\n";
$values = array(1234.5678,
- -1234.5678,
- 1234.6578e4,
- -1234.56789e4,
- 0x1234CDEF,
- 02777777777,
- "123456789",
- "123.456789",
- "12.3456789e1",
- null,
- true,
- false);
+ -1234.5678,
+ 1234.6578e4,
+ -1234.56789e4,
+ 0x1234CDEF,
+ 02777777777,
+ "123456789",
+ "123.456789",
+ "12.3456789e1",
+ null,
+ true,
+ false);
echo "\n-- number_format tests.....default --\n";
for ($i = 0; $i < count($values); $i++) {
- $res = number_format($values[$i]);
- var_dump($res);
+ $res = number_format($values[$i]);
+ var_dump($res);
}
echo "\n-- number_format tests.....with two dp --\n";
for ($i = 0; $i < count($values); $i++) {
- $res = number_format($values[$i], 2);
- var_dump($res);
+ $res = number_format($values[$i], 2);
+ var_dump($res);
}
echo "\n-- number_format tests.....English format --\n";
for ($i = 0; $i < count($values); $i++) {
- $res = number_format($values[$i], 2, '.', ' ');
- var_dump($res);
+ $res = number_format($values[$i], 2, '.', ' ');
+ var_dump($res);
}
echo "\n-- number_format tests.....French format --\n";
for ($i = 0; $i < count($values); $i++) {
- $res = number_format($values[$i], 2, ',' , ' ');
- var_dump($res);
+ $res = number_format($values[$i], 2, ',' , ' ');
+ var_dump($res);
}
?>
-===DONE===
--EXPECT--
*** Testing number_format() : basic functionality ***
@@ -106,4 +105,3 @@ string(6) "123,46"
string(4) "0,00"
string(4) "1,00"
string(4) "0,00"
-===DONE===
diff --git a/ext/standard/tests/strings/ord_basic.phpt b/ext/standard/tests/strings/ord_basic.phpt
index f49948206a..c7d6891a09 100644
--- a/ext/standard/tests/strings/ord_basic.phpt
+++ b/ext/standard/tests/strings/ord_basic.phpt
@@ -24,13 +24,12 @@ var_dump(ord("Hello"));
// Make sure all valid ascii chars round trip
for ($i = 0; $i < 255; $i++) {
- if (ord(chr($i)) != $i) {
- exit("TEST FAILED: $i does not round trip\n");
- }
+ if (ord(chr($i)) != $i) {
+ exit("TEST FAILED: $i does not round trip\n");
+ }
}
?>
-===DONE===
--EXPECT--
*** Testing ord() : basic functionality ***
int(97)
@@ -44,4 +43,3 @@ int(10)
int(10)
int(255)
int(72)
-===DONE===
diff --git a/ext/standard/tests/strings/pack_A.phpt b/ext/standard/tests/strings/pack_A.phpt
index b5a7b97fc3..abc12ac1b1 100644
--- a/ext/standard/tests/strings/pack_A.phpt
+++ b/ext/standard/tests/strings/pack_A.phpt
@@ -3,11 +3,11 @@ pack()/unpack(): "A" modifier
--FILE--
<?php
var_dump(
- pack("A5", "foo "),
- pack("A4", "fooo"),
- pack("A4", "foo"),
- unpack("A*", "foo\0\rbar\0 \t\r\n"),
- unpack("A4", "foo\0\rbar\0 \t\r\n")
+ pack("A5", "foo "),
+ pack("A4", "fooo"),
+ pack("A4", "foo"),
+ unpack("A*", "foo\0\rbar\0 \t\r\n"),
+ unpack("A4", "foo\0\rbar\0 \t\r\n")
);
?>
--EXPECTF--
diff --git a/ext/standard/tests/strings/pack_Z.phpt b/ext/standard/tests/strings/pack_Z.phpt
index 4fd007ae0f..5a7c5d95a6 100644
--- a/ext/standard/tests/strings/pack_Z.phpt
+++ b/ext/standard/tests/strings/pack_Z.phpt
@@ -3,11 +3,11 @@ pack()/unpack(): "Z" format
--FILE--
<?php
var_dump(
- pack("Z0", "f"),
+ pack("Z0", "f"),
pack("Z5", "foo\0"),
pack("Z4", "fooo"),
pack("Z4", "foo"),
- pack("Z*", "foo"),
+ pack("Z*", "foo"),
unpack("Z*", "foo\0\rbar\0 \t\r\n"),
unpack("Z9", "foo\0\rbar\0 \t\r\n"),
unpack("Z2", "\0"),
diff --git a/ext/standard/tests/strings/parse_str_basic1.phpt b/ext/standard/tests/strings/parse_str_basic1.phpt
index b3f2fe5cfc..60277fa184 100644
--- a/ext/standard/tests/strings/parse_str_basic1.phpt
+++ b/ext/standard/tests/strings/parse_str_basic1.phpt
@@ -3,18 +3,13 @@ Test parse_str() function : basic functionality
--FILE--
<?php
-/* Prototype : void parse_str ( string $str [, array &$arr ] )
+/* Prototype : void parse_str ( string $str , array &$arr )
* Description: Parses the string into variables
* Source code: ext/standard/string.c
*/
echo "*** Testing parse_str() : basic functionality ***\n";
-echo "Basic test WITHOUT result arg\n";
-$s1 = "first=val1&second=val2&third=val3";
-var_dump(parse_str($s1));
-var_dump($first, $second, $third);
-
echo "\nBasic test WITH undefined var for result arg\n";
$s1 = "first=val1&second=val2&third=val3";
var_dump(parse_str($s1, $res1));
@@ -32,16 +27,8 @@ var_dump(parse_str($s1, $res3_array));
var_dump($res3_array);
?>
-===DONE===
--EXPECTF--
*** Testing parse_str() : basic functionality ***
-Basic test WITHOUT result arg
-
-Deprecated: parse_str(): Calling parse_str() without the result argument is deprecated in %s on line %d
-NULL
-string(4) "val1"
-string(4) "val2"
-string(4) "val3"
Basic test WITH undefined var for result arg
NULL
@@ -75,4 +62,3 @@ array(3) {
["third"]=>
string(4) "val3"
}
-===DONE===
diff --git a/ext/standard/tests/strings/parse_str_basic2.phpt b/ext/standard/tests/strings/parse_str_basic2.phpt
index 32a8fcd3fc..15bd3024d6 100644
--- a/ext/standard/tests/strings/parse_str_basic2.phpt
+++ b/ext/standard/tests/strings/parse_str_basic2.phpt
@@ -16,7 +16,6 @@ var_dump(parse_str($s1, $result));
var_dump($result);
?>
-===DONE===
--EXPECT--
*** Testing parse_str() : non-default arg_separator.input specified ***
NULL
@@ -28,4 +27,3 @@ array(3) {
["third"]=>
string(4) "val3"
}
-===DONE===
diff --git a/ext/standard/tests/strings/parse_str_basic3.phpt b/ext/standard/tests/strings/parse_str_basic3.phpt
index 0368dea5f9..25b5f8745d 100644
--- a/ext/standard/tests/strings/parse_str_basic3.phpt
+++ b/ext/standard/tests/strings/parse_str_basic3.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/parse_str_basic4.phpt b/ext/standard/tests/strings/parse_str_basic4.phpt
index b6126e974b..5b128c7cfc 100644
--- a/ext/standard/tests/strings/parse_str_basic4.phpt
+++ b/ext/standard/tests/strings/parse_str_basic4.phpt
@@ -30,7 +30,6 @@ $str = "arr.test[1]=sid&arr test[4][two]=fred";
var_dump(parse_str($str, $res));
var_dump($res);
?>
-===DONE===
--EXPECTF--
Test string with badly formed strings
NULL
@@ -89,4 +88,3 @@ array(1) {
}
}
}
-===DONE===
diff --git a/ext/standard/tests/strings/pathinfo.phpt b/ext/standard/tests/strings/pathinfo.phpt
index a3d735069d..2bbea73588 100644
--- a/ext/standard/tests/strings/pathinfo.phpt
+++ b/ext/standard/tests/strings/pathinfo.phpt
@@ -3,7 +3,6 @@ pathinfo() tests
--FILE--
<?php
-var_dump(pathinfo());
var_dump(pathinfo(""));
var_dump(pathinfo("."));
var_dump(pathinfo(".."));
@@ -27,8 +26,6 @@ var_dump(pathinfo(__FILE__, PATHINFO_DIRNAME|PATHINFO_BASENAME));
echo "Done\n";
?>
--EXPECTF--
-Warning: pathinfo() expects at least 1 parameter, 0 given in %s on line %d
-NULL
array(2) {
["basename"]=>
string(0) ""
diff --git a/ext/standard/tests/strings/php_strip_whitespace.phpt b/ext/standard/tests/strings/php_strip_whitespace.phpt
index 442672c6aa..9f22daa9eb 100644
--- a/ext/standard/tests/strings/php_strip_whitespace.phpt
+++ b/ext/standard/tests/strings/php_strip_whitespace.phpt
@@ -5,7 +5,6 @@ php_strip_whitespace() tests
$filename = __DIR__."/php_strip_whitespace.dat";
-var_dump(php_strip_whitespace());
var_dump(php_strip_whitespace($filename));
$data = '/* test comment */';
@@ -20,15 +19,15 @@ $data = '<?php
/* test class */
class test {
- /* function foo () */
+ /* function foo () */
- function foo () /* {{{ */
- {
+ function foo () /* {{{ */
+ {
- echo $var; //does not exist
- }
- /* }}} */
+ echo $var; //does not exist
+ }
+ /* }}} */
}
?>';
@@ -40,10 +39,7 @@ var_dump(php_strip_whitespace($filename));
echo "Done\n";
?>
--EXPECTF--
-Warning: php_strip_whitespace() expects exactly 1 parameter, 0 given in %s on line %d
-bool(false)
-
-Warning: php_strip_whitespace(%sphp_strip_whitespace.dat): failed to open stream: No such file or directory in %s on line %d
+Warning: php_strip_whitespace(%sphp_strip_whitespace.dat): Failed to open stream: No such file or directory in %s on line %d
string(0) ""
string(18) "/* test comment */"
string(9) "<?php ?>"
diff --git a/ext/standard/tests/strings/print_basic.phpt b/ext/standard/tests/strings/print_basic.phpt
index 0b75641991..9d8c8a618c 100644
--- a/ext/standard/tests/strings/print_basic.phpt
+++ b/ext/standard/tests/strings/print_basic.phpt
@@ -58,7 +58,6 @@ that the here document terminator must appear on a
line with just a semicolon no extra whitespace!\n
END;
?>
-===DONE===
--EXPECT--
*** Testing print() : basic functionality ***
@@ -89,4 +88,3 @@ This uses the "here document" syntax to output
multiple lines with VARIABLE interpolation. Note
that the here document terminator must appear on a
line with just a semicolon no extra whitespace!
-===DONE===
diff --git a/ext/standard/tests/strings/print_variation1.phpt b/ext/standard/tests/strings/print_variation1.phpt
index 19a28678f2..e5849ecfdf 100644
--- a/ext/standard/tests/strings/print_variation1.phpt
+++ b/ext/standard/tests/strings/print_variation1.phpt
@@ -28,43 +28,43 @@ $file_handle = fopen(__FILE__, "r");
// array with different values for $input
$inputs = array (
- // integer values
+ // integer values
/*1*/ 0,
- 1,
- -2,
- 2147483647,
- -2147483648,
+ 1,
+ -2,
+ 2147483647,
+ -2147483648,
- // float values
+ // float values
/*6*/ 10.5,
- -20.5,
- 10.1234567e10,
+ -20.5,
+ 10.1234567e10,
- // array values
+ // array values
/*9*/ array(),
- array(0),
- array(1, 2),
+ array(0),
+ array(1, 2),
- // boolean values
+ // boolean values
/*12*/ true,
- false,
- TRUE,
- FALSE,
+ false,
+ TRUE,
+ FALSE,
- // null values
+ // null values
/*16*/ NULL,
- null,
+ null,
- // objects
+ // objects
/*18*/ new sample(),
- // resource
+ // resource
/*19*/ $file_handle,
- // undefined variable
+ // undefined variable
/*20*/ @$undefined_var,
- // unset variable
+ // unset variable
/*21*/ @$unset_var
);
@@ -81,7 +81,6 @@ foreach($inputs as $input) {
fclose($file_handle); //closing the file handle
?>
-===DONE===
--EXPECTF--
*** Testing print() function: with unexpected inputs for 'arg' argument ***
-- Iteration 1 --
@@ -110,17 +109,17 @@ int(1)
int(1)
-- Iteration 9 --
-Notice: Array to string conversion in %sprint_variation1.php on line %d
+Warning: Array to string conversion in %s on line %d
Array
int(1)
-- Iteration 10 --
-Notice: Array to string conversion in %sprint_variation1.php on line %d
+Warning: Array to string conversion in %s on line %d
Array
int(1)
-- Iteration 11 --
-Notice: Array to string conversion in %sprint_variation1.php on line %d
+Warning: Array to string conversion in %s on line %d
Array
int(1)
-- Iteration 12 --
@@ -153,4 +152,3 @@ int(1)
-- Iteration 21 --
int(1)
-===DONE===
diff --git a/ext/standard/tests/strings/printf.phpt b/ext/standard/tests/strings/printf.phpt
index eab44a4a65..c409d1a8f9 100644
--- a/ext/standard/tests/strings/printf.phpt
+++ b/ext/standard/tests/strings/printf.phpt
@@ -28,14 +28,22 @@ $strings = array( NULL, "abc", 'aaa' );
/* Zero argument */
echo "\n*** Output for zero argument ***\n";
-printf();
+try {
+ printf();
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
/* Number of arguments not matching as specified in format field */
echo "\n*** Output for insufficient number of arguments ***\n";
$string = "dingy%sflem%dwombat";
$nbr = 5;
$name = "voudras";
-printf("%d $string %s", $nbr, $name);
+try {
+ printf("%d $string %s", $nbr, $name);
+} catch (\ArgumentCountError $e) {
+ print('Error found: '.$e->getMessage());
+}
/* Scalar argument */
@@ -226,13 +234,10 @@ printf("%d", $tempstring);
?>
--EXPECTF--
*** Output for zero argument ***
-
-Warning: printf() expects at least %d parameter, %d given in %s on line %d
+printf() expects at least %d parameter, %d given
*** Output for insufficient number of arguments ***
-
-Warning: printf(): Too few arguments in %s on line %d
-
+Error found: 5 parameters are required, 3 given
*** Output for scalar argument ***
3
*** Output for NULL as argument ***
diff --git a/ext/standard/tests/strings/printf_64bit.phpt b/ext/standard/tests/strings/printf_64bit.phpt
index 1a90970371..9d3b448495 100644
--- a/ext/standard/tests/strings/printf_64bit.phpt
+++ b/ext/standard/tests/strings/printf_64bit.phpt
@@ -28,14 +28,22 @@ $strings = array( NULL, "abc", 'aaa' );
/* Zero argument */
echo "\n*** Output for zero argument ***\n";
-printf();
+try {
+ printf();
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
/* Number of arguments not matching as specified in format field */
echo "\n*** Output for insufficient number of arguments ***\n";
$string = "dingy%sflem%dwombat";
$nbr = 5;
$name = "voudras";
-printf("%d $string %s", $nbr, $name);
+try {
+ printf("%d $string %s", $nbr, $name);
+} catch (\ArgumentCountError $e) {
+ print('Error found: '.$e->getMessage());
+}
/* Scalar argument */
@@ -226,13 +234,10 @@ printf("%d", $tempstring);
?>
--EXPECTF--
*** Output for zero argument ***
-
-Warning: printf() expects at least 1 parameter, 0 given in %s on line %d
+printf() expects at least 1 parameter, 0 given
*** Output for insufficient number of arguments ***
-
-Warning: printf(): Too few arguments in %s on line %d
-
+Error found: 5 parameters are required, 3 given
*** Output for scalar argument ***
3
*** Output for NULL as argument ***
diff --git a/ext/standard/tests/strings/printf_basic1.phpt b/ext/standard/tests/strings/printf_basic1.phpt
index db6edf6374..b2cbe22375 100644
--- a/ext/standard/tests/strings/printf_basic1.phpt
+++ b/ext/standard/tests/strings/printf_basic1.phpt
@@ -40,7 +40,6 @@ echo "\n";
var_dump($result);
?>
-===DONE===
--EXPECT--
*** Testing printf() : basic functionality - using string format ***
@@ -59,4 +58,3 @@ int(27)
-- Calling printf() with string three arguments --
arg1 argument arg2 argument arg3 argument
int(41)
-===DONE===
diff --git a/ext/standard/tests/strings/printf_basic2.phpt b/ext/standard/tests/strings/printf_basic2.phpt
index 6448fe6609..d7ed15e29e 100644
--- a/ext/standard/tests/strings/printf_basic2.phpt
+++ b/ext/standard/tests/strings/printf_basic2.phpt
@@ -40,7 +40,6 @@ echo "\n";
var_dump($result);
?>
-===DONE===
--EXPECT--
*** Testing printf() : basic functionality - using integer format ***
@@ -59,4 +58,3 @@ int(7)
-- Calling printf() with three arguments--
111 222 333
int(11)
-===DONE===
diff --git a/ext/standard/tests/strings/printf_basic3.phpt b/ext/standard/tests/strings/printf_basic3.phpt
index 711327cd6d..b5ee1b82b0 100644
--- a/ext/standard/tests/strings/printf_basic3.phpt
+++ b/ext/standard/tests/strings/printf_basic3.phpt
@@ -54,7 +54,6 @@ echo "\n";
var_dump($result);
?>
-===DONE===
--EXPECT--
*** Testing printf() : basic functionality - using float format ***
@@ -79,4 +78,3 @@ int(19)
int(29)
11.110000 22.220000 33.330000
int(29)
-===DONE===
diff --git a/ext/standard/tests/strings/printf_basic4.phpt b/ext/standard/tests/strings/printf_basic4.phpt
index e5c07fd03c..cc1b533db6 100644
--- a/ext/standard/tests/strings/printf_basic4.phpt
+++ b/ext/standard/tests/strings/printf_basic4.phpt
@@ -39,7 +39,6 @@ $result = printf($format3, $arg1, $arg2, $arg3);
echo "\n";
var_dump($result);
?>
-===DONE===
--EXPECT--
*** Testing printf() : basic functionality - using bool format ***
@@ -58,4 +57,3 @@ int(3)
-- Calling printf() with three arguments--
1 0 1
int(5)
-===DONE===
diff --git a/ext/standard/tests/strings/printf_basic5.phpt b/ext/standard/tests/strings/printf_basic5.phpt
index e7bebd6df7..e50e9d58b8 100644
--- a/ext/standard/tests/strings/printf_basic5.phpt
+++ b/ext/standard/tests/strings/printf_basic5.phpt
@@ -39,7 +39,6 @@ $result = printf($format3, $arg1, $arg2, $arg3);
echo "\n";
var_dump($result);
?>
-===DONE===
--EXPECT--
*** Testing printf() : basic functionality - using char format ***
@@ -58,4 +57,3 @@ int(3)
-- Calling printf() with three arguments --
A B C
int(5)
-===DONE===
diff --git a/ext/standard/tests/strings/printf_basic6.phpt b/ext/standard/tests/strings/printf_basic6.phpt
index b3872efdd0..f84d703089 100644
--- a/ext/standard/tests/strings/printf_basic6.phpt
+++ b/ext/standard/tests/strings/printf_basic6.phpt
@@ -38,7 +38,6 @@ $result = printf($format3, $arg1, $arg2, $arg3);
echo "\n";
var_dump($result);
?>
-===DONE===
--EXPECT--
*** Testing printf() : basic functionality - using exponential format ***
@@ -57,4 +56,3 @@ int(23)
-- Calling printf() with three arguments --
1.000000e+3 2.000000E+3 3.000000e+3
int(35)
-===DONE===
diff --git a/ext/standard/tests/strings/printf_basic7.phpt b/ext/standard/tests/strings/printf_basic7.phpt
index 6675ddb29e..1a7c24d895 100644
--- a/ext/standard/tests/strings/printf_basic7.phpt
+++ b/ext/standard/tests/strings/printf_basic7.phpt
@@ -46,7 +46,6 @@ echo "\n";
var_dump($result);
?>
-===DONE===
--EXPECT--
*** Testing printf() : basic functionality - using unsigned format ***
@@ -65,4 +64,3 @@ int(21)
-- Calling printf() with three arguments --
4294966185 4293732729 2345432
int(29)
-===DONE===
diff --git a/ext/standard/tests/strings/printf_basic8.phpt b/ext/standard/tests/strings/printf_basic8.phpt
index 3ec0eda5ec..5df156a553 100644
--- a/ext/standard/tests/strings/printf_basic8.phpt
+++ b/ext/standard/tests/strings/printf_basic8.phpt
@@ -45,7 +45,6 @@ echo "\n";
var_dump($result);
?>
-===DONE===
--EXPECT--
*** Testing printf() : basic functionality - using octal format ***
@@ -64,4 +63,3 @@ int(14)
-- Calling printf() with three arguments --
21 37777777431 567
int(18)
-===DONE===
diff --git a/ext/standard/tests/strings/printf_basic9.phpt b/ext/standard/tests/strings/printf_basic9.phpt
index cb9513d975..b86da032e8 100644
--- a/ext/standard/tests/strings/printf_basic9.phpt
+++ b/ext/standard/tests/strings/printf_basic9.phpt
@@ -55,7 +55,6 @@ echo "\n";
var_dump($result);
?>
-===DONE===
--EXPECT--
*** Testing printf() : basic functionality - using hexadecimal format ***
@@ -80,4 +79,3 @@ b 84 b1
int(7)
B 84 B1
int(7)
-===DONE===
diff --git a/ext/standard/tests/strings/printf_error.phpt b/ext/standard/tests/strings/printf_error.phpt
index a88390bc04..62591e9e6f 100644
--- a/ext/standard/tests/strings/printf_error.phpt
+++ b/ext/standard/tests/strings/printf_error.phpt
@@ -11,7 +11,11 @@ echo "*** Testing printf() : error conditions ***\n";
// Zero arguments
echo "\n-- Testing printf() function with Zero arguments --\n";
-var_dump( printf() );
+try {
+ var_dump( printf() );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "\n-- Testing printf() function with less than expected no. of arguments --\n";
$format1 = '%s';
@@ -21,50 +25,58 @@ $arg1 = 'one';
$arg2 = 'two';
echo "\n-- Call printf with one argument less than expected --\n";
-var_dump( printf($format1) );
-var_dump( printf($format2,$arg1) );
-var_dump( printf($format3,$arg1,$arg2) );
+try {
+ var_dump( printf($format1) );
+} catch (\ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump( printf($format2,$arg1) );
+} catch (\ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump( printf($format3,$arg1,$arg2) );
+} catch (\ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "\n-- Call printf with two argument less than expected --\n";
-var_dump( printf($format2) );
-var_dump( printf($format3,$arg1) );
+try {
+ var_dump( printf($format2) );
+} catch (\ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump( printf($format3,$arg1) );
+} catch (\ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "\n-- Call printf with three argument less than expected --\n";
-var_dump( printf($format3) );
+try {
+ var_dump( printf($format3) );
+} catch (\ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
-===DONE===
--EXPECTF--
*** Testing printf() : error conditions ***
-- Testing printf() function with Zero arguments --
-
-Warning: printf() expects at least 1 parameter, 0 given in %s on line %d
-bool(false)
+printf() expects at least 1 parameter, 0 given
-- Testing printf() function with less than expected no. of arguments --
-- Call printf with one argument less than expected --
-
-Warning: printf(): Too few arguments in %s on line %d
-bool(false)
-
-Warning: printf(): Too few arguments in %s on line %d
-bool(false)
-
-Warning: printf(): Too few arguments in %s on line %d
-bool(false)
+2 parameters are required, 1 given
+3 parameters are required, 2 given
+4 parameters are required, 3 given
-- Call printf with two argument less than expected --
-
-Warning: printf(): Too few arguments in %s on line %d
-bool(false)
-
-Warning: printf(): Too few arguments in %s on line %d
-bool(false)
+3 parameters are required, 1 given
+4 parameters are required, 2 given
-- Call printf with three argument less than expected --
-
-Warning: printf(): Too few arguments in %s on line %d
-bool(false)
-===DONE===
+4 parameters are required, 1 given
diff --git a/ext/standard/tests/strings/printf_variation1.phpt b/ext/standard/tests/strings/printf_variation1.phpt
index fcf69ebaa7..d6fad7e97a 100644
--- a/ext/standard/tests/strings/printf_variation1.phpt
+++ b/ext/standard/tests/strings/printf_variation1.phpt
@@ -35,50 +35,50 @@ $file_handle = fopen(__FILE__, 'r');
//array of values to iterate over
$values = array(
- // int data
+ // int data
/*1*/ 0,
- 1,
- 12345,
- -2345,
+ 1,
+ 12345,
+ -2345,
- // float data
+ // float data
/*5*/ 10.5,
- -10.5,
- 10.1234567e10,
- 10.7654321E-10,
- .5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
- // array data
+ // array data
/*10*/ array(),
- array(0),
- array(1),
- array(1, 2),
- array('color' => 'red', 'item' => 'pen'),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
- // null data
+ // null data
/*15*/ NULL,
- null,
+ null,
- // boolean data
+ // boolean data
/*17*/ true,
- false,
- TRUE,
- FALSE,
+ false,
+ TRUE,
+ FALSE,
- // empty data
+ // empty data
/*21*/ "",
- '',
+ '',
- // object data
+ // object data
/*23*/ new sample(),
- // undefined data
+ // undefined data
/*24*/ @$undefined_var,
- // unset data
+ // unset data
/*25*/ @$unset_var,
- // resource data
+ // resource data
/*26*/ $file_handle
);
@@ -89,19 +89,31 @@ foreach($values as $value) {
echo "\n-- Iteration $count --\n";
// with default argument
- $result = printf($value);
- echo "\n";
- var_dump($result);
+ try {
+ $result = printf($value);
+ echo "\n";
+ var_dump($result);
+ } catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
// with two arguments
- $result = printf($value, $arg1);
- echo "\n";
- var_dump($result);
+ try {
+ $result = printf($value, $arg1);
+ echo "\n";
+ var_dump($result);
+ } catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
// with three arguments
- $result = printf($value, $arg1, $arg2);
- echo "\n";
- var_dump($result);
+ try {
+ $result = printf($value, $arg1, $arg2);
+ echo "\n";
+ var_dump($result);
+ } catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
$count++;
};
@@ -110,7 +122,6 @@ foreach($values as $value) {
fclose($file_handle);
?>
-===DONE===
--EXPECTF--
*** Testing printf() : with unexpected values for format argument ***
@@ -187,74 +198,29 @@ int(3)
int(3)
-- Iteration 10 --
-
-Notice: Array to string conversion in %s on line %d
-Array
-int(5)
-
-Notice: Array to string conversion in %s on line %d
-Array
-int(5)
-
-Notice: Array to string conversion in %s on line %d
-Array
-int(5)
+printf() expects parameter 1 to be string, array given
+printf() expects parameter 1 to be string, array given
+printf() expects parameter 1 to be string, array given
-- Iteration 11 --
-
-Notice: Array to string conversion in %s on line %d
-Array
-int(5)
-
-Notice: Array to string conversion in %s on line %d
-Array
-int(5)
-
-Notice: Array to string conversion in %s on line %d
-Array
-int(5)
+printf() expects parameter 1 to be string, array given
+printf() expects parameter 1 to be string, array given
+printf() expects parameter 1 to be string, array given
-- Iteration 12 --
-
-Notice: Array to string conversion in %s on line %d
-Array
-int(5)
-
-Notice: Array to string conversion in %s on line %d
-Array
-int(5)
-
-Notice: Array to string conversion in %s on line %d
-Array
-int(5)
+printf() expects parameter 1 to be string, array given
+printf() expects parameter 1 to be string, array given
+printf() expects parameter 1 to be string, array given
-- Iteration 13 --
-
-Notice: Array to string conversion in %s on line %d
-Array
-int(5)
-
-Notice: Array to string conversion in %s on line %d
-Array
-int(5)
-
-Notice: Array to string conversion in %s on line %d
-Array
-int(5)
+printf() expects parameter 1 to be string, array given
+printf() expects parameter 1 to be string, array given
+printf() expects parameter 1 to be string, array given
-- Iteration 14 --
-
-Notice: Array to string conversion in %s on line %d
-Array
-int(5)
-
-Notice: Array to string conversion in %s on line %d
-Array
-int(5)
-
-Notice: Array to string conversion in %s on line %d
-Array
-int(5)
+printf() expects parameter 1 to be string, array given
+printf() expects parameter 1 to be string, array given
+printf() expects parameter 1 to be string, array given
-- Iteration 15 --
@@ -345,10 +311,6 @@ int(0)
int(0)
-- Iteration 26 --
-Resource id #%d
-int(%d)
-Resource id #%d
-int(%d)
-Resource id #%d
-int(%d)
-===DONE===
+printf() expects parameter 1 to be string, resource given
+printf() expects parameter 1 to be string, resource given
+printf() expects parameter 1 to be string, resource given
diff --git a/ext/standard/tests/strings/printf_variation2.phpt b/ext/standard/tests/strings/printf_variation2.phpt
index 8e7d5ec910..d0335b455e 100644
--- a/ext/standard/tests/strings/printf_variation2.phpt
+++ b/ext/standard/tests/strings/printf_variation2.phpt
@@ -7,8 +7,6 @@ Test printf() function : usage variations - with all types of values for arg1 ar
* Source code: ext/standard/formatted_print.c
*/
-error_reporting(E_ALL & ~E_NOTICE);
-
echo "*** Testing printf() : with different types of values passed for arg1 argument ***\n";
// initialing required variables
@@ -33,54 +31,54 @@ $file_handle = fopen(__FILE__, 'r');
//array of values to iterate over
$values = array(
- // int data
+ // int data
/*1*/ 0,
- 1,
- 12345,
- -2345,
+ 1,
+ 12345,
+ -2345,
- // float data
+ // float data
/*5*/ 10.5,
- -10.5,
- 10.1234567e10,
- 10.7654321E-10,
- .5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
- // array data
+ // array data
/*10*/ array(),
- array(0),
- array(1),
- array(1, 2),
- array('color' => 'red', 'item' => 'pen'),
+ array(0),
+ array(1),
+ array(1, 2),
+ array('color' => 'red', 'item' => 'pen'),
- // null data
+ // null data
/*15*/ NULL,
- null,
+ null,
- // boolean data
+ // boolean data
/*17*/ true,
- false,
- TRUE,
- FALSE,
+ false,
+ TRUE,
+ FALSE,
- // empty data
+ // empty data
/*21*/ "",
- '',
+ '',
- // string data
+ // string data
/*23*/ "string",
- 'string',
+ 'string',
- // object data
+ // object data
/*25*/ new sample(),
- // undefined data
+ // undefined data
/*26*/ @$undefined_var,
- // unset data
+ // unset data
/*27*/ @$unset_var,
- // resource data
+ // resource data
/*28*/ $file_handle
);
@@ -107,7 +105,6 @@ foreach($values as $value) {
fclose($file_handle);
?>
-===DONE===
--EXPECTF--
*** Testing printf() : with different types of values passed for arg1 argument ***
@@ -166,32 +163,52 @@ int(3)
int(3)
-- Iteration 10 --
+
+Warning: Array to string conversion in %s on line %d
Array
int(5)
+
+Warning: Array to string conversion in %s on line %d
Array
int(5)
-- Iteration 11 --
+
+Warning: Array to string conversion in %s on line %d
Array
int(5)
+
+Warning: Array to string conversion in %s on line %d
Array
int(5)
-- Iteration 12 --
+
+Warning: Array to string conversion in %s on line %d
Array
int(5)
+
+Warning: Array to string conversion in %s on line %d
Array
int(5)
-- Iteration 13 --
+
+Warning: Array to string conversion in %s on line %d
Array
int(5)
+
+Warning: Array to string conversion in %s on line %d
Array
int(5)
-- Iteration 14 --
+
+Warning: Array to string conversion in %s on line %d
Array
int(5)
+
+Warning: Array to string conversion in %s on line %d
Array
int(5)
@@ -278,4 +295,3 @@ Resource id #%d
int(%d)
Resource id #%d
int(%d)
-===DONE===
diff --git a/ext/standard/tests/strings/quoted_printable_decode_basic.phpt b/ext/standard/tests/strings/quoted_printable_decode_basic.phpt
index 654c418dc4..b40080cdf3 100644
--- a/ext/standard/tests/strings/quoted_printable_decode_basic.phpt
+++ b/ext/standard/tests/strings/quoted_printable_decode_basic.phpt
@@ -9,17 +9,15 @@ Test quoted_printable_decode() function : basic functionality
echo "*** Testing quoted_printable_decode() : basic functionality ***\n";
-$str = "=FAwow-factor=C1=d0=D5=DD=C5=CE=CE=D9=C5=0A=
-=20=D4=cf=D2=C7=CF=D7=D9=C5=
-=20=
+$str = "=FAwow-factor=C1=d0=D5=DD=C5=CE=CE=D9=C5=0A=
+=20=D4=cf=D2=C7=CF=D7=D9=C5=
+=20=
=D0=
=D2=CF=C5=CB=D4=D9";
var_dump(bin2hex(quoted_printable_decode($str)));
?>
-===DONE===
--EXPECT--
*** Testing quoted_printable_decode() : basic functionality ***
string(76) "fa776f772d666163746f72c1d0d5ddc5ceced9c50a20d4cfd2c7cfd7d9c520d0d2cfc5cbd4d9"
-===DONE===
diff --git a/ext/standard/tests/strings/quoted_printable_encode_001.phpt b/ext/standard/tests/strings/quoted_printable_encode_001.phpt
index 1ce7d791dc..df26d5cf4b 100644
--- a/ext/standard/tests/strings/quoted_printable_encode_001.phpt
+++ b/ext/standard/tests/strings/quoted_printable_encode_001.phpt
@@ -3,30 +3,18 @@ quoted_printable_encode() tests - 1
--FILE--
<?php
-var_dump(quoted_printable_encode());
var_dump(quoted_printable_encode(""));
var_dump(quoted_printable_encode("test"));
-var_dump(quoted_printable_encode("test", "more"));
-$a = array("str");
-var_dump(quoted_printable_encode($a));
var_dump(quoted_printable_encode(1));
var_dump(quoted_printable_encode(NULL));
var_dump(quoted_printable_encode(false));
echo "Done\n";
?>
---EXPECTF--
-Warning: quoted_printable_encode() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
+--EXPECT--
string(0) ""
string(4) "test"
-
-Warning: quoted_printable_encode() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
-Warning: quoted_printable_encode() expects parameter 1 to be string, array given in %s on line %d
-NULL
string(1) "1"
string(0) ""
string(0) ""
diff --git a/ext/standard/tests/strings/quoted_printable_encode_002.phpt b/ext/standard/tests/strings/quoted_printable_encode_002.phpt
index aaf5608f33..b01b6957c9 100644
--- a/ext/standard/tests/strings/quoted_printable_encode_002.phpt
+++ b/ext/standard/tests/strings/quoted_printable_encode_002.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/quotemeta_basic.phpt b/ext/standard/tests/strings/quotemeta_basic.phpt
index d2694db6b6..87b0718bd3 100644
--- a/ext/standard/tests/strings/quotemeta_basic.phpt
+++ b/ext/standard/tests/strings/quotemeta_basic.phpt
@@ -14,10 +14,8 @@ var_dump(quotemeta("Hello how are you ?"));
var_dump(quotemeta("(100 + 50) * 10"));
var_dump(quotemeta("\+*?[^]($)"));
?>
-===DONE===
--EXPECT--
*** Testing quotemeta() : basic functionality ***
string(20) "Hello how are you \?"
string(19) "\(100 \+ 50\) \* 10"
string(20) "\\\+\*\?\[\^\]\(\$\)"
-===DONE===
diff --git a/ext/standard/tests/strings/quotemeta_basic_1.phpt b/ext/standard/tests/strings/quotemeta_basic_1.phpt
index 4b479a9a60..4d1feb5ae1 100644
--- a/ext/standard/tests/strings/quotemeta_basic_1.phpt
+++ b/ext/standard/tests/strings/quotemeta_basic_1.phpt
@@ -1,5 +1,5 @@
--TEST--
-Test function quotemeta() - using an empty string is given as str.
+Test function quotemeta() - using an empty string is given as str
--CREDITS--
Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
User Group: PHPSP #PHPTestFestBrasil
@@ -9,4 +9,4 @@ $str = "";
var_dump(quotemeta($str));
?>
--EXPECT--
-bool(false)
+string(0) ""
diff --git a/ext/standard/tests/strings/rtrim.phpt b/ext/standard/tests/strings/rtrim.phpt
index 5f57b0e850..223a839f58 100644
--- a/ext/standard/tests/strings/rtrim.phpt
+++ b/ext/standard/tests/strings/rtrim.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/rtrim_basic.phpt b/ext/standard/tests/strings/rtrim_basic.phpt
index 9946f90c6e..d58a9e4a95 100644
--- a/ext/standard/tests/strings/rtrim_basic.phpt
+++ b/ext/standard/tests/strings/rtrim_basic.phpt
@@ -33,7 +33,6 @@ echo "\n-- Trim the ASCII control characters at the beginning of a string --\n";
var_dump(rtrim($binary, "\x00..\x1F"));
?>
-===DONE===
--EXPECT--
*** Testing rtrim() : basic functionality ***
@@ -51,4 +50,3 @@ string(10) "0123456789"
-- Trim the ASCII control characters at the beginning of a string --
string(14) "Example string"
-===DONE===
diff --git a/ext/standard/tests/strings/rtrim_error.phpt b/ext/standard/tests/strings/rtrim_error.phpt
index 108f96a1f0..ef45f723f3 100644
--- a/ext/standard/tests/strings/rtrim_error.phpt
+++ b/ext/standard/tests/strings/rtrim_error.phpt
@@ -11,14 +11,6 @@ Test rtrim() function : error conditions
echo "*** Testing rtrim() : error conditions ***\n";
-echo "\n-- Testing rtrim() function with no arguments --\n";
-var_dump( rtrim() );
-
-echo "\n-- Testing rtrim() function with more than expected no. of arguments --\n";
-$extra_arg = 10;
-var_dump( rtrim("Hello World", "Heo", $extra_arg) );
-
-
$hello = " Hello World\n";
echo "\n-- Test rtrim function with various invalid charlists\n";
var_dump(rtrim($hello, "..a"));
@@ -27,20 +19,9 @@ var_dump(rtrim($hello, "z..a"));
var_dump(rtrim($hello, "a..b..c"));
?>
-===DONE===
--EXPECTF--
*** Testing rtrim() : error conditions ***
--- Testing rtrim() function with no arguments --
-
-Warning: rtrim() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
--- Testing rtrim() function with more than expected no. of arguments --
-
-Warning: rtrim() expects at most 2 parameters, 3 given in %s on line %d
-NULL
-
-- Test rtrim function with various invalid charlists
Warning: rtrim(): Invalid '..'-range, no character to the left of '..' in %s on line %d
@@ -58,4 +39,3 @@ string(14) " Hello World
Warning: rtrim(): Invalid '..'-range in %s on line %d
string(14) " Hello World
"
-===DONE===
diff --git a/ext/standard/tests/strings/setlocale-win32.phpt b/ext/standard/tests/strings/setlocale-win32.phpt
index fcfbce3579..e6aeda5f1c 100644
--- a/ext/standard/tests/strings/setlocale-win32.phpt
+++ b/ext/standard/tests/strings/setlocale-win32.phpt
@@ -14,7 +14,6 @@ var_dump(setlocale(LC_ALL, 'uk_US'));
var_dump(setlocale(LC_ALL, 'us_UK'));
var_dump(setlocale(LC_ALL, 'us_US'));
?>
-===DONE===
--EXPECT--
bool(false)
bool(false)
@@ -22,4 +21,3 @@ string(27) "English_United Kingdom.1252"
string(26) "English_United States.1252"
string(27) "English_United Kingdom.1252"
string(26) "English_United States.1252"
-===DONE===
diff --git a/ext/standard/tests/strings/setlocale_error.phpt b/ext/standard/tests/strings/setlocale_error.phpt
index 14bb7d7ed5..c2b18b1992 100644
--- a/ext/standard/tests/strings/setlocale_error.phpt
+++ b/ext/standard/tests/strings/setlocale_error.phpt
@@ -18,14 +18,6 @@ if (substr(PHP_OS, 0, 3) == 'WIN') {
echo "*** Testing setlocale() : error conditions ***\n";
-// Zero argument
-echo "\n-- Testing setlocale() function with Zero arguments --";
-var_dump( setlocale());
-
-// One argument
-echo "\n-- Testing setlocale() function with One argument, 'category' = LC_ALL --";
-var_dump( setlocale(LC_ALL) );
-
echo "\n-- Testing setlocale() function with invalid locale array, 'category' = LC_ALL --\n";
//Invalid array of locales
$invalid_locales = array("en_US.invalid", "en_AU.invalid", "ko_KR.invalid");
@@ -44,14 +36,6 @@ echo "\nDone";
--EXPECTF--
*** Testing setlocale() : error conditions ***
--- Testing setlocale() function with Zero arguments --
-Warning: setlocale() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
--- Testing setlocale() function with One argument, 'category' = LC_ALL --
-Warning: setlocale() expects at least 2 parameters, 1 given in %s on line %d
-NULL
-
-- Testing setlocale() function with invalid locale array, 'category' = LC_ALL --
bool(false)
diff --git a/ext/standard/tests/strings/setlocale_variation1.phpt b/ext/standard/tests/strings/setlocale_variation1.phpt
index 6dc4179baf..a44dbc7e9e 100644
--- a/ext/standard/tests/strings/setlocale_variation1.phpt
+++ b/ext/standard/tests/strings/setlocale_variation1.phpt
@@ -1,5 +1,5 @@
--TEST--
-Test setlocale() function : usage variations - passing multiple valid/invlaid locales as argument
+Test setlocale() function : usage variations - passing multiple valid/invalid locales as argument
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) == 'WIN') {
diff --git a/ext/standard/tests/strings/setlocale_variation2.phpt b/ext/standard/tests/strings/setlocale_variation2.phpt
index fad3298cc7..41a706c8bf 100644
--- a/ext/standard/tests/strings/setlocale_variation2.phpt
+++ b/ext/standard/tests/strings/setlocale_variation2.phpt
@@ -22,7 +22,7 @@ function good_locale($locale) {
/**
* Note: no_NO is a bogus locale and should not be used, see https://bugzilla.redhat.com/971416
**/
- return $locale !== 'tt_RU@iqtelif.UTF-8' && $locale !== 'no_NO.ISO-8859-1';
+ return $locale !== 'tt_RU@iqtelif.UTF-8' && $locale !== 'no_NO.ISO-8859-1';
}
/* Prototype : array list_system_locales( void )
diff --git a/ext/standard/tests/strings/sha1.phpt b/ext/standard/tests/strings/sha1.phpt
index 1dc73881ef..1fea3566b5 100644
--- a/ext/standard/tests/strings/sha1.phpt
+++ b/ext/standard/tests/strings/sha1.phpt
@@ -5,18 +5,18 @@ sha1() with ASCII output
$filename = __DIR__."/sha1.dat";
$a = array(
- "abc",
- "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
- "a",
- "0123456701234567012345670123456701234567012345670123456701234567",
- ""
+ "abc",
+ "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
+ "a",
+ "0123456701234567012345670123456701234567012345670123456701234567",
+ ""
);
foreach ($a as $str) {
- var_dump($val1 = sha1($str));
- file_put_contents($filename, $str);
- var_dump($val2 = sha1_file($filename));
- var_dump($val1 === $val2);
+ var_dump($val1 = sha1($str));
+ file_put_contents($filename, $str);
+ var_dump($val2 = sha1_file($filename));
+ var_dump($val1 === $val2);
}
var_dump(sha1($str, true));
@@ -47,5 +47,5 @@ bool(true)
string(20) "%a"
string(20) "%a"
-Warning: sha1_file(%ssha1.dat): failed to open stream: No such file or directory in %s on line %d
+Warning: sha1_file(%ssha1.dat): Failed to open stream: No such file or directory in %s on line %d
Done
diff --git a/ext/standard/tests/strings/sha1_basic.phpt b/ext/standard/tests/strings/sha1_basic.phpt
index 0761fe4cfd..1c179da202 100644
--- a/ext/standard/tests/strings/sha1_basic.phpt
+++ b/ext/standard/tests/strings/sha1_basic.phpt
@@ -37,7 +37,6 @@ var_dump(bin2hex(sha1("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234
var_dump(bin2hex(sha1("12345678901234567890123456789012345678901234567890123456789012345678901234567890", true)));
?>
-===DONE===
--EXPECT--
*** Testing sha1() : basic functionality ***
@@ -67,4 +66,3 @@ string(40) "c12252ceda8be8994d5fa0290a47231c1d16aae3"
string(40) "32d10c7b8cf96570ca04ce37f2a19d84240d3a89"
string(40) "761c457bf73b14d27e9e9265c46f4b4dda11f940"
string(40) "50abf5706a150990a08b2c5ea40fa0e585554732"
-===DONE===
diff --git a/ext/standard/tests/strings/sha1_file.phpt b/ext/standard/tests/strings/sha1_file.phpt
index 102dab75ff..7a55cedee6 100644
--- a/ext/standard/tests/strings/sha1_file.phpt
+++ b/ext/standard/tests/strings/sha1_file.phpt
@@ -46,12 +46,6 @@ var_dump( sha1_file(12) );
echo "\n-- NULL as filename --\n";
var_dump( sha1_file(NULL) );
-echo "\n-- Zero arguments --\n";
- var_dump ( sha1_file() );
-
-echo "\n-- More than valid number of arguments ( valid is 2) --\n";
-var_dump ( sha1_file("EmptyFileSHA1.txt", true, NULL) );
-
echo "\n-- Hexadecimal Output for Empty file as Argument --\n";
var_dump( sha1_file("EmptyFileSHA1.txt") );
@@ -69,7 +63,6 @@ unlink("DataFileSHA1.txt");
unlink("EmptyFileSHA1.txt");
?>
-===DONE===
--EXPECTF--
*** Testing sha1_file() : basic functionality ***
@@ -82,12 +75,12 @@ bool(false)
-- invalid filename --
-Warning: sha1_file(rewncwYcn89q): failed to open stream: No such file or directory in %s on line %d
+Warning: sha1_file(rewncwYcn89q): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-- Scalar value as filename --
-Warning: sha1_file(12): failed to open stream: No such file or directory in %s on line %d
+Warning: sha1_file(12): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-- NULL as filename --
@@ -95,16 +88,6 @@ bool(false)
Warning: sha1_file(): Filename cannot be empty in %s on line %d
bool(false)
--- Zero arguments --
-
-Warning: sha1_file() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
--- More than valid number of arguments ( valid is 2) --
-
-Warning: sha1_file() expects at most 2 parameters, 3 given in %s on line %d
-NULL
-
-- Hexadecimal Output for Empty file as Argument --
string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709"
@@ -116,4 +99,3 @@ string(40) "d16a568ab98233deff7ec8b1668eb4b3d9e53fee"
-- Raw Binary Output for a valid file with some contents --
string(40) "d16a568ab98233deff7ec8b1668eb4b3d9e53fee"
-===DONE===
diff --git a/ext/standard/tests/strings/similar_text_basic.phpt b/ext/standard/tests/strings/similar_text_basic.phpt
index ad8807f102..20ae4854ce 100644
--- a/ext/standard/tests/strings/similar_text_basic.phpt
+++ b/ext/standard/tests/strings/similar_text_basic.phpt
@@ -26,7 +26,6 @@ var_dump($percent);
similar_text("abcdefghabcdef", "zzzzabcdefggg", $percent);
var_dump($percent);
?>
-===DONE===
--EXPECT--
int(3)
int(0)
@@ -36,4 +35,3 @@ float(54.545454545455)
float(0)
float(18.181818181818)
float(51.851851851852)
-===DONE===
diff --git a/ext/standard/tests/strings/soundex.phpt b/ext/standard/tests/strings/soundex.phpt
index 650236c2e5..ef61ac495e 100644
--- a/ext/standard/tests/strings/soundex.phpt
+++ b/ext/standard/tests/strings/soundex.phpt
@@ -5,7 +5,6 @@ soundex() tests
var_dump(soundex(""));
var_dump(soundex(-1));
-var_dump(soundex(array()));
$array = array(
"From",
@@ -26,7 +25,7 @@ $array = array(
);
foreach ($array as $str) {
- var_dump(soundex($str));
+ var_dump(soundex($str));
}
echo "Done\n";
@@ -34,9 +33,6 @@ echo "Done\n";
--EXPECTF--
bool(false)
string(4) "0000"
-
-Warning: soundex() expects parameter 1 to be string, array given in %s on line %d
-NULL
string(4) "F650"
string(4) "T300"
string(4) "T500"
diff --git a/ext/standard/tests/strings/soundex_basic.phpt b/ext/standard/tests/strings/soundex_basic.phpt
index 401eb67460..7c536f1d34 100644
--- a/ext/standard/tests/strings/soundex_basic.phpt
+++ b/ext/standard/tests/strings/soundex_basic.phpt
@@ -25,7 +25,6 @@ var_dump(soundex("Lukasiewicz") == soundex("Lissajous")); // L222
var_dump(soundex("Lukasiewicz") == soundex("Ghosh"));
var_dump(soundex("Hilbert") == soundex("Ladd"));
?>
-===DONE===
--EXPECT--
*** Testing soundex() : basic functionality ***
string(4) "E460"
@@ -42,4 +41,3 @@ bool(true)
bool(true)
bool(false)
bool(false)
-===DONE===
diff --git a/ext/standard/tests/strings/sprintf_error.phpt b/ext/standard/tests/strings/sprintf_error.phpt
index 1c12cd3168..4ba7a539fe 100644
--- a/ext/standard/tests/strings/sprintf_error.phpt
+++ b/ext/standard/tests/strings/sprintf_error.phpt
@@ -11,7 +11,11 @@ echo "*** Testing sprintf() : error conditions ***\n";
// Zero arguments
echo "\n-- Testing sprintf() function with Zero arguments --\n";
-var_dump( sprintf() );
+try {
+ var_dump( sprintf() );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "\n-- Testing sprintf() function with less than expected no. of arguments --\n";
$format1 = '%s';
@@ -21,16 +25,40 @@ $arg1 = 'one';
$arg2 = 'two';
// with one argument less than expected
-var_dump( sprintf($format1) );
-var_dump( sprintf($format2,$arg1) );
-var_dump( sprintf($format3,$arg1,$arg2) );
+try {
+ var_dump( sprintf($format1) );
+} catch (\ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump( sprintf($format2,$arg1) );
+} catch (\ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump( sprintf($format3,$arg1,$arg2) );
+} catch (\ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
// with two argument less than expected
-var_dump( sprintf($format2) );
-var_dump( sprintf($format3,$arg1) );
+try {
+ var_dump( sprintf($format2) );
+} catch (\ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump( sprintf($format3,$arg1) );
+} catch (\ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
// with three argument less than expected
-var_dump( sprintf($format3) );
+try {
+ var_dump( sprintf($format3) );
+} catch (\ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done";
?>
@@ -38,27 +66,13 @@ echo "Done";
*** Testing sprintf() : error conditions ***
-- Testing sprintf() function with Zero arguments --
-
-Warning: sprintf() expects at least %d parameter, %d given in %s on line %d
-bool(false)
+sprintf() expects at least %d parameter, %d given
-- Testing sprintf() function with less than expected no. of arguments --
-
-Warning: sprintf(): Too few arguments in %s on line %d
-bool(false)
-
-Warning: sprintf(): Too few arguments in %s on line %d
-bool(false)
-
-Warning: sprintf(): Too few arguments in %s on line %d
-bool(false)
-
-Warning: sprintf(): Too few arguments in %s on line %d
-bool(false)
-
-Warning: sprintf(): Too few arguments in %s on line %d
-bool(false)
-
-Warning: sprintf(): Too few arguments in %s on line %d
-bool(false)
+2 parameters are required, 1 given
+3 parameters are required, 2 given
+4 parameters are required, 3 given
+3 parameters are required, 1 given
+4 parameters are required, 2 given
+4 parameters are required, 1 given
Done
diff --git a/ext/standard/tests/strings/sprintf_variation1.phpt b/ext/standard/tests/strings/sprintf_variation1.phpt
index bf77e3bc06..f30cf5182e 100644
--- a/ext/standard/tests/strings/sprintf_variation1.phpt
+++ b/ext/standard/tests/strings/sprintf_variation1.phpt
@@ -89,16 +89,28 @@ foreach($values as $value) {
echo "\n-- Iteration $count --\n";
// with default argument
- var_dump( sprintf($value) );
+ try {
+ var_dump(sprintf($value));
+ } catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
// with two arguments
- var_dump( sprintf($value, $arg1) );
+ try {
+ var_dump(sprintf($value, $arg1));
+ } catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
// with three arguments
- var_dump( sprintf($value, $arg1, $arg2) );
+ try {
+ var_dump(sprintf($value, $arg1, $arg2));
+ } catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
$count++;
-};
+}
// close the resource
fclose($file_handle);
@@ -154,59 +166,29 @@ string(3) "0.5"
string(3) "0.5"
-- Iteration 10 --
-
-Notice: Array to string conversion in %s on line %d
-string(5) "Array"
-
-Notice: Array to string conversion in %s on line %d
-string(5) "Array"
-
-Notice: Array to string conversion in %s on line %d
-string(5) "Array"
+sprintf() expects parameter 1 to be string, array given
+sprintf() expects parameter 1 to be string, array given
+sprintf() expects parameter 1 to be string, array given
-- Iteration 11 --
-
-Notice: Array to string conversion in %s on line %d
-string(5) "Array"
-
-Notice: Array to string conversion in %s on line %d
-string(5) "Array"
-
-Notice: Array to string conversion in %s on line %d
-string(5) "Array"
+sprintf() expects parameter 1 to be string, array given
+sprintf() expects parameter 1 to be string, array given
+sprintf() expects parameter 1 to be string, array given
-- Iteration 12 --
-
-Notice: Array to string conversion in %s on line %d
-string(5) "Array"
-
-Notice: Array to string conversion in %s on line %d
-string(5) "Array"
-
-Notice: Array to string conversion in %s on line %d
-string(5) "Array"
+sprintf() expects parameter 1 to be string, array given
+sprintf() expects parameter 1 to be string, array given
+sprintf() expects parameter 1 to be string, array given
-- Iteration 13 --
-
-Notice: Array to string conversion in %s on line %d
-string(5) "Array"
-
-Notice: Array to string conversion in %s on line %d
-string(5) "Array"
-
-Notice: Array to string conversion in %s on line %d
-string(5) "Array"
+sprintf() expects parameter 1 to be string, array given
+sprintf() expects parameter 1 to be string, array given
+sprintf() expects parameter 1 to be string, array given
-- Iteration 14 --
-
-Notice: Array to string conversion in %s on line %d
-string(5) "Array"
-
-Notice: Array to string conversion in %s on line %d
-string(5) "Array"
-
-Notice: Array to string conversion in %s on line %d
-string(5) "Array"
+sprintf() expects parameter 1 to be string, array given
+sprintf() expects parameter 1 to be string, array given
+sprintf() expects parameter 1 to be string, array given
-- Iteration 15 --
string(0) ""
@@ -264,7 +246,7 @@ string(0) ""
string(0) ""
-- Iteration 26 --
-string(%d) "Resource id #%d"
-string(%d) "Resource id #%d"
-string(%d) "Resource id #%d"
+sprintf() expects parameter 1 to be string, resource given
+sprintf() expects parameter 1 to be string, resource given
+sprintf() expects parameter 1 to be string, resource given
Done
diff --git a/ext/standard/tests/strings/sprintf_variation18.phpt b/ext/standard/tests/strings/sprintf_variation18.phpt
index 2bf9322c83..74547cf53e 100644
--- a/ext/standard/tests/strings/sprintf_variation18.phpt
+++ b/ext/standard/tests/strings/sprintf_variation18.phpt
@@ -7,8 +7,6 @@ Test sprintf() function : usage variations - string formats with array values
* Source code: ext/standard/formatted_print.c
*/
-error_reporting(E_ALL & ~E_NOTICE);
-
echo "*** Testing sprintf() : string formats with array values ***\n";
// different arrays used to test he function
@@ -47,185 +45,377 @@ foreach($array_values as $array_value) {
echo "Done";
?>
---EXPECT--
+--EXPECTF--
*** Testing sprintf() : string formats with array values ***
-- Iteration 1 --
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "Array "
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "
Array"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
+
+Warning: Array to string conversion in %s on line %d
string(30) " Array"
string(10) "a-zA-Z0-9]"
string(1) "s"
-- Iteration 2 --
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "Array "
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "
Array"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
+
+Warning: Array to string conversion in %s on line %d
string(30) " Array"
string(10) "a-zA-Z0-9]"
string(1) "s"
-- Iteration 3 --
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "Array "
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "
Array"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
+
+Warning: Array to string conversion in %s on line %d
string(30) " Array"
string(10) "a-zA-Z0-9]"
string(1) "s"
-- Iteration 4 --
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "Array "
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "
Array"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
+
+Warning: Array to string conversion in %s on line %d
string(30) " Array"
string(10) "a-zA-Z0-9]"
string(1) "s"
-- Iteration 5 --
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "Array "
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "
Array"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
+
+Warning: Array to string conversion in %s on line %d
string(30) " Array"
string(10) "a-zA-Z0-9]"
string(1) "s"
-- Iteration 6 --
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "Array "
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "
Array"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
+
+Warning: Array to string conversion in %s on line %d
string(30) " Array"
string(10) "a-zA-Z0-9]"
string(1) "s"
-- Iteration 7 --
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "Array "
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "
Array"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
+
+Warning: Array to string conversion in %s on line %d
string(30) " Array"
string(10) "a-zA-Z0-9]"
string(1) "s"
-- Iteration 8 --
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "Array "
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "
Array"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
+
+Warning: Array to string conversion in %s on line %d
string(30) " Array"
string(10) "a-zA-Z0-9]"
string(1) "s"
-- Iteration 9 --
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "Array "
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "
Array"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
+
+Warning: Array to string conversion in %s on line %d
string(30) " Array"
string(10) "a-zA-Z0-9]"
string(1) "s"
-- Iteration 10 --
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "Array "
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "
Array"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
+
+Warning: Array to string conversion in %s on line %d
string(30) " Array"
string(10) "a-zA-Z0-9]"
string(1) "s"
-- Iteration 11 --
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "Array "
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "
Array"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
+
+Warning: Array to string conversion in %s on line %d
string(30) " Array"
string(10) "a-zA-Z0-9]"
string(1) "s"
-- Iteration 12 --
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
string(1) "s"
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "Array "
+
+Warning: Array to string conversion in %s on line %d
string(6) " Array"
+
+Warning: Array to string conversion in %s on line %d
string(6) "
Array"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
+
+Warning: Array to string conversion in %s on line %d
string(30) " Array"
string(10) "a-zA-Z0-9]"
string(1) "s"
diff --git a/ext/standard/tests/strings/sprintf_variation2.phpt b/ext/standard/tests/strings/sprintf_variation2.phpt
index 1bab5dc862..0f8290a9a7 100644
--- a/ext/standard/tests/strings/sprintf_variation2.phpt
+++ b/ext/standard/tests/strings/sprintf_variation2.phpt
@@ -7,8 +7,6 @@ Test sprintf() function : usage variations - with all types of values for arg1 a
* Source code: ext/standard/formatted_print.c
*/
-error_reporting(E_ALL & ~E_NOTICE);
-
echo "*** Testing sprintf() : with different types of values passed for arg1 argument ***\n";
// initialing required variables
@@ -144,23 +142,43 @@ string(3) "0.5"
string(3) "0.5"
-- Iteration 10 --
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
-- Iteration 11 --
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
-- Iteration 12 --
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
-- Iteration 13 --
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
-- Iteration 14 --
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
-- Iteration 15 --
diff --git a/ext/standard/tests/strings/sprintf_variation23.phpt b/ext/standard/tests/strings/sprintf_variation23.phpt
index 8a7a45e57a..b35d5cc849 100644
--- a/ext/standard/tests/strings/sprintf_variation23.phpt
+++ b/ext/standard/tests/strings/sprintf_variation23.phpt
@@ -42,7 +42,6 @@ fclose($fp);
closedir($dfp);
?>
-===DONE===
--EXPECTF--
*** Testing sprintf() : char formats with resource values ***
@@ -75,4 +74,3 @@ string(1) "%a"
string(1) "%a"
string(11) "a-bA-B@#$&]"
string(1) "c"
-===DONE===
diff --git a/ext/standard/tests/strings/sprintf_variation36.phpt b/ext/standard/tests/strings/sprintf_variation36.phpt
index b465e0cf9e..17869f0ade 100644
--- a/ext/standard/tests/strings/sprintf_variation36.phpt
+++ b/ext/standard/tests/strings/sprintf_variation36.phpt
@@ -42,7 +42,6 @@ fclose($fp);
closedir($dfp);
?>
-===DONE===
--EXPECTF--
*** Testing sprintf() : hexa formats with resource values ***
@@ -75,4 +74,3 @@ string(4) "%a"
string(30) "%a"
string(10) "0-9A-Fa-f]"
string(1) "x"
-===DONE===
diff --git a/ext/standard/tests/strings/sprintf_variation48.phpt b/ext/standard/tests/strings/sprintf_variation48.phpt
index 1f5504af4b..73dc5950a9 100644
--- a/ext/standard/tests/strings/sprintf_variation48.phpt
+++ b/ext/standard/tests/strings/sprintf_variation48.phpt
@@ -42,7 +42,6 @@ fclose($fp);
closedir($dfp);
?>
-===DONE===
--EXPECTF--
*** Testing sprintf() : scientific formats with resource values ***
@@ -75,4 +74,3 @@ string(%d) "%f"
string(30) "%s%f"
string(%d) "0-1]"
string(1) "e"
-===DONE===
diff --git a/ext/standard/tests/strings/sscanf_basic1.phpt b/ext/standard/tests/strings/sscanf_basic1.phpt
index 8a38f9d19e..388d80ea73 100644
--- a/ext/standard/tests/strings/sscanf_basic1.phpt
+++ b/ext/standard/tests/strings/sscanf_basic1.phpt
@@ -27,7 +27,6 @@ $res = sscanf($str, $format, $part, $number, $stock);
var_dump($res, $part, $number, $stock);
?>
-===DONE===
--EXPECT--
*** Testing sscanf() : basic functionality - using string format ***
@@ -41,4 +40,3 @@ int(3)
string(6) "Widget"
string(7) "1234789"
string(2) "25"
-===DONE===
diff --git a/ext/standard/tests/strings/sscanf_basic2.phpt b/ext/standard/tests/strings/sscanf_basic2.phpt
index 92f4d1051e..2c29bcacce 100644
--- a/ext/standard/tests/strings/sscanf_basic2.phpt
+++ b/ext/standard/tests/strings/sscanf_basic2.phpt
@@ -27,7 +27,6 @@ $res = sscanf($str, $format, $part, $number, $stock);
var_dump($res, $part, $number, $stock);
?>
-===DONE===
--EXPECT--
*** Testing sscanf() : basic functionality - using integer format ***
@@ -41,4 +40,3 @@ int(3)
string(6) "Widget"
int(1234789)
int(25)
-===DONE===
diff --git a/ext/standard/tests/strings/sscanf_basic3.phpt b/ext/standard/tests/strings/sscanf_basic3.phpt
index b728dea34d..e30f67aa44 100644
--- a/ext/standard/tests/strings/sscanf_basic3.phpt
+++ b/ext/standard/tests/strings/sscanf_basic3.phpt
@@ -24,7 +24,6 @@ $res = sscanf($str, $format, $part, $length, $width, $depth);
var_dump($res, $part, $length, $width, $depth);
?>
-===DONE===
--EXPECT--
*** Testing sscanf() : basic functionality -- using float format ***
@@ -40,4 +39,3 @@ string(6) "Widget"
float(111.53)
float(22.345)
float(12.4)
-===DONE===
diff --git a/ext/standard/tests/strings/sscanf_basic4.phpt b/ext/standard/tests/strings/sscanf_basic4.phpt
index 726bc08a10..2cf05383d5 100644
--- a/ext/standard/tests/strings/sscanf_basic4.phpt
+++ b/ext/standard/tests/strings/sscanf_basic4.phpt
@@ -24,7 +24,6 @@ $res = sscanf($str, $format, $arg1, $arg2, $arg3, $arg4);
var_dump($res, $arg1, $arg2, $arg3, $arg4);
?>
-===DONE===
--EXPECT--
*** Testing sscanf() : basic functionality - using char format ***
@@ -40,4 +39,3 @@ string(1) "X"
string(1) "A"
string(1) "B"
string(1) "C"
-===DONE===
diff --git a/ext/standard/tests/strings/sscanf_basic5.phpt b/ext/standard/tests/strings/sscanf_basic5.phpt
index 36c2feba9d..16012f26cf 100644
--- a/ext/standard/tests/strings/sscanf_basic5.phpt
+++ b/ext/standard/tests/strings/sscanf_basic5.phpt
@@ -30,7 +30,6 @@ var_dump($res, $arg1, $arg2, $arg3, $arg4);
?>
-===DONE===
--EXPECT--
*** Testing sscanf() : basic functionality -using exponential format ***
@@ -55,4 +54,3 @@ float(10.12345)
float(10123.45)
float(10123.45)
float(-101234.5)
-===DONE===
diff --git a/ext/standard/tests/strings/sscanf_basic6.phpt b/ext/standard/tests/strings/sscanf_basic6.phpt
index 381ccc12c2..4b109b9584 100644
--- a/ext/standard/tests/strings/sscanf_basic6.phpt
+++ b/ext/standard/tests/strings/sscanf_basic6.phpt
@@ -30,7 +30,6 @@ $res = sscanf($str, $format, $arg1, $arg2, $arg3, $arg4, $arg5, $arg6);
var_dump($res, $arg1, $arg2, $arg3, $arg4, $arg5, $arg6);
?>
-===DONE===
--EXPECT--
*** Testing sscanf() : basic functionality - using unsigned format ***
@@ -50,4 +49,3 @@ int(11)
string(10) "4294967285"
NULL
NULL
-===DONE===
diff --git a/ext/standard/tests/strings/sscanf_basic7.phpt b/ext/standard/tests/strings/sscanf_basic7.phpt
index 253dd1ba53..daa93715d6 100644
--- a/ext/standard/tests/strings/sscanf_basic7.phpt
+++ b/ext/standard/tests/strings/sscanf_basic7.phpt
@@ -24,7 +24,6 @@ $res = sscanf($str, $format, $arg1, $arg2, $arg3, $arg4, $arg5, $arg6);
var_dump($res, $arg1, $arg2, $arg3, $arg4, $arg5, $arg6);
?>
-===DONE===
--EXPECT--
*** Testing sscanf() : basic functionality - using octal format ***
@@ -44,4 +43,3 @@ int(83)
int(10)
NULL
NULL
-===DONE===
diff --git a/ext/standard/tests/strings/sscanf_basic8.phpt b/ext/standard/tests/strings/sscanf_basic8.phpt
index f4f237fec4..0adcb3d516 100644
--- a/ext/standard/tests/strings/sscanf_basic8.phpt
+++ b/ext/standard/tests/strings/sscanf_basic8.phpt
@@ -29,7 +29,6 @@ $res = sscanf($str, $format2, $arg1, $arg2, $arg3, $arg4, $arg5, $arg6);
var_dump($res, $arg1, $arg2, $arg3, $arg4, $arg5, $arg6);
?>
-===DONE===
--EXPECT--
*** Testing sscanf() : basic functionality - - using hexadecimal format ***
@@ -62,4 +61,3 @@ int(4667)
int(-4667)
int(6844)
int(1)
-===DONE===
diff --git a/ext/standard/tests/strings/sscanf_error.phpt b/ext/standard/tests/strings/sscanf_error.phpt
index ca967758ab..ffaefb8418 100644
--- a/ext/standard/tests/strings/sscanf_error.phpt
+++ b/ext/standard/tests/strings/sscanf_error.phpt
@@ -12,33 +12,16 @@ echo "*** Testing sscanf() : error conditions ***\n";
$str = "Hello World";
$format = "%s %s";
-echo "\n-- Testing sscanf() function with no arguments --\n";
-var_dump( sscanf() );
-
-echo "\n-- Testing sscanf() function with one argument --\n";
-var_dump( sscanf($str) );
-
echo "\n-- Testing sscanf() function with more than expected no. of arguments --\n";
-var_dump( sscanf($str, $format, $str1, $str2, $extra_str) );
-
+try {
+ sscanf($str, $format, $str1, $str2, $extra_str);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
?>
-===DONE===
--EXPECTF--
*** Testing sscanf() : error conditions ***
--- Testing sscanf() function with no arguments --
-
-Warning: sscanf() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
--- Testing sscanf() function with one argument --
-
-Warning: sscanf() expects at least 2 parameters, 1 given in %s on line %d
-NULL
-
-- Testing sscanf() function with more than expected no. of arguments --
-
-Warning: sscanf(): Variable is not assigned by any conversion specifiers in %s on line %d
-int(-1)
-===DONE===
+Variable is not assigned by any conversion specifiers
diff --git a/ext/standard/tests/strings/str_getcsv_002.phpt b/ext/standard/tests/strings/str_getcsv_002.phpt
index a4ff87c206..de96e73913 100644
--- a/ext/standard/tests/strings/str_getcsv_002.phpt
+++ b/ext/standard/tests/strings/str_getcsv_002.phpt
@@ -7,7 +7,6 @@ $contents = <<<EOS
EOS;
print_r(str_getcsv($contents, ',', '"', ''));
?>
-===DONE===
--EXPECT--
Array
(
@@ -16,4 +15,3 @@ Array
[2] => cell3
[3] => cell4
)
-===DONE===
diff --git a/ext/standard/tests/strings/str_ireplace.phpt b/ext/standard/tests/strings/str_ireplace.phpt
index 526b8ac723..a5a35769e4 100644
--- a/ext/standard/tests/strings/str_ireplace.phpt
+++ b/ext/standard/tests/strings/str_ireplace.phpt
@@ -3,9 +3,6 @@ str_ireplace() tests
--FILE--
<?php
-var_dump(str_ireplace());
-var_dump(str_ireplace(""));
-var_dump(str_ireplace("", ""));
var_dump(str_ireplace("", "", ""));
var_dump(str_ireplace("tt", "a", "ttttTttttttttTT"));
@@ -39,8 +36,8 @@ var_dump(str_ireplace(array("t"=>"tt", "y"=>"y"), array("a"=>"aaa", "b"=>"bbb"),
/* separate testcase for str_ireplace() off-by-one */
$Data = "Change tracking and management software designed to watch
- for abnormal system behavior.\nSuggest features, report bugs, or ask
- questions here.";
+ for abnormal system behavior.\nSuggest features, report bugs, or ask
+ questions here.";
var_dump($Data = str_ireplace("\r\n", "<br>", $Data));
var_dump($Data = str_ireplace("\n", "<br>", $Data));
@@ -48,14 +45,6 @@ var_dump($Data = str_ireplace("\n", "<br>", $Data));
echo "Done\n";
?>
--EXPECTF--
-Warning: str_ireplace() expects at least 3 parameters, 0 given in %s on line %d
-NULL
-
-Warning: str_ireplace() expects at least 3 parameters, 1 given in %s on line %d
-NULL
-
-Warning: str_ireplace() expects at least 3 parameters, 2 given in %s on line %d
-NULL
string(0) ""
string(8) "aaaaaaaT"
string(8) "aaaaaaaT"
@@ -93,9 +82,9 @@ array(2) {
["test"]=>
string(36) "aabbbbbbaabbbasdabbbbbbahsdbbbbbbbbb"
}
-string(143) "Change tracking and management software designed to watch
- for abnormal system behavior.
+string(149) "Change tracking and management software designed to watch
+ for abnormal system behavior.
Suggest features, report bugs, or ask
- questions here."
-string(152) "Change tracking and management software designed to watch<br> for abnormal system behavior.<br>Suggest features, report bugs, or ask<br> questions here."
+ questions here."
+string(158) "Change tracking and management software designed to watch<br> for abnormal system behavior.<br>Suggest features, report bugs, or ask<br> questions here."
Done
diff --git a/ext/standard/tests/strings/str_pad.phpt b/ext/standard/tests/strings/str_pad.phpt
index b44a9517ab..42b6383a5e 100644
--- a/ext/standard/tests/strings/str_pad.phpt
+++ b/ext/standard/tests/strings/str_pad.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/str_pad_variation1.phpt b/ext/standard/tests/strings/str_pad_variation1.phpt
new file mode 100644
index 0000000000..6123bc60c9
--- /dev/null
+++ b/ext/standard/tests/strings/str_pad_variation1.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test str_pad() function : usage variations - large values for '$pad_length' argument
+--SKIPIF--
+<?php
+if (getenv("USE_ZEND_ALLOC") === "0") {
+ die("skip Zend MM disabled");
+}
+?>
+--FILE--
+<?php
+/* Prototype : string str_pad ( string $input , int $pad_length [, string $pad_string [, int $pad_type ]] )
+ * Description: Pad a string to a certain length with another string
+ * Source code: ext/standard/string.c
+*/
+
+/* Test str_pad() function: with unexpected inputs for '$pad_length'
+ * and expected type for '$input'
+*/
+
+echo "*** Testing str_pad() function: with large value for for 'pad_length' argument ***\n";
+
+//defining '$input' argument
+$input = "Test string";
+
+$extra_large_pad_length = PHP_INT_MAX*5;
+try {
+ var_dump( str_pad($input, $extra_large_pad_length) );
+} catch (\TypeError $e) {
+ echo $e->getMessage() . "\n";
+}
+
+$php_int_max_pad_length = PHP_INT_MAX;
+var_dump( str_pad($input, $php_int_max_pad_length) );
+
+
+?>
+--EXPECTF--
+*** Testing str_pad() function: with large value for for 'pad_length' argument ***
+str_pad() expects parameter 2 to be int, float given
+
+Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %s on line %d
+
diff --git a/ext/standard/tests/strings/str_pad_variation2.phpt b/ext/standard/tests/strings/str_pad_variation2.phpt
new file mode 100644
index 0000000000..0bf8ad3ad8
--- /dev/null
+++ b/ext/standard/tests/strings/str_pad_variation2.phpt
@@ -0,0 +1,70 @@
+--TEST--
+str_pad() function: usage variations - Non printable chars
+--INI--
+precision=14
+--FILE--
+<?php
+// Split from str_pad for NUL Bytes
+// 7-bit ASCII
+$string = chr(0).chr(255).chr(128).chr(234).chr(143);
+
+/* different pad_lengths */
+$pad_lengths = [
+ -PHP_INT_MAX, // huge negative value
+ -1, // negative value
+ 0, // pad_length < sizeof(input_string)
+ 9, // pad_length <= sizeof(input_string)
+ 10, // pad_length > sizeof(input_string)
+ 16, // pad_length > sizeof(input_string)
+];
+
+$pad_string = "=";
+
+/*loop through to use each variant of $pad_length on
+ each element of $input_strings array */
+foreach ($pad_lengths as $pad_length ) {
+ // default pad_string & pad_type
+ var_dump( bin2hex( str_pad($string, $pad_length) ) );
+ // default pad_type
+ var_dump( bin2hex( str_pad($string, $pad_length, $pad_string) ) );
+ var_dump( bin2hex( str_pad($string, $pad_length, $pad_string, STR_PAD_LEFT) ) );
+ var_dump( bin2hex( str_pad($string, $pad_length, $pad_string, STR_PAD_RIGHT) ) );
+ var_dump( bin2hex( str_pad($string, $pad_length, $pad_string, STR_PAD_BOTH) ) );
+}
+
+?>
+
+DONE
+--EXPECT--
+string(10) "00ff80ea8f"
+string(10) "00ff80ea8f"
+string(10) "00ff80ea8f"
+string(10) "00ff80ea8f"
+string(10) "00ff80ea8f"
+string(10) "00ff80ea8f"
+string(10) "00ff80ea8f"
+string(10) "00ff80ea8f"
+string(10) "00ff80ea8f"
+string(10) "00ff80ea8f"
+string(10) "00ff80ea8f"
+string(10) "00ff80ea8f"
+string(10) "00ff80ea8f"
+string(10) "00ff80ea8f"
+string(10) "00ff80ea8f"
+string(18) "00ff80ea8f20202020"
+string(18) "00ff80ea8f3d3d3d3d"
+string(18) "3d3d3d3d00ff80ea8f"
+string(18) "00ff80ea8f3d3d3d3d"
+string(18) "3d3d00ff80ea8f3d3d"
+string(20) "00ff80ea8f2020202020"
+string(20) "00ff80ea8f3d3d3d3d3d"
+string(20) "3d3d3d3d3d00ff80ea8f"
+string(20) "00ff80ea8f3d3d3d3d3d"
+string(20) "3d3d00ff80ea8f3d3d3d"
+string(32) "00ff80ea8f2020202020202020202020"
+string(32) "00ff80ea8f3d3d3d3d3d3d3d3d3d3d3d"
+string(32) "3d3d3d3d3d3d3d3d3d3d3d00ff80ea8f"
+string(32) "00ff80ea8f3d3d3d3d3d3d3d3d3d3d3d"
+string(32) "3d3d3d3d3d00ff80ea8f3d3d3d3d3d3d"
+
+DONE
diff --git a/ext/standard/tests/strings/str_pad_variation5.phpt b/ext/standard/tests/strings/str_pad_variation5.phpt
index 8eade37df3..41a70e675a 100644
--- a/ext/standard/tests/strings/str_pad_variation5.phpt
+++ b/ext/standard/tests/strings/str_pad_variation5.phpt
@@ -31,4 +31,4 @@ var_dump( str_pad($input, $pad_length) );
--EXPECTF--
*** Testing str_pad() function: with large value for for 'pad_length' argument ***
-Fatal error: Allowed memory size of 134217728 bytes exhausted%s(tried to allocate %d bytes) in %s on line %d
+Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %s on line %d
diff --git a/ext/standard/tests/strings/str_repeat.phpt b/ext/standard/tests/strings/str_repeat.phpt
index 306b7d381a..4751dc783f 100644
--- a/ext/standard/tests/strings/str_repeat.phpt
+++ b/ext/standard/tests/strings/str_repeat.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/str_repeat_variation1.phpt b/ext/standard/tests/strings/str_repeat_variation1.phpt
new file mode 100644
index 0000000000..4740f7c5b8
--- /dev/null
+++ b/ext/standard/tests/strings/str_repeat_variation1.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Test str_repeat() function: usage variations - complex strings containing other than 7-bit chars
+--INI--
+precision=14
+--FILE--
+<?php
+$str = chr(0).chr(128).chr(129).chr(234).chr(235).chr(254).chr(255);
+
+$withCodePoint = str_repeat($str, chr(51)); // ASCII value of '3' given
+$explicit = str_repeat($str, 3);
+
+var_dump($withCodePoint === $explicit);
+var_dump( bin2hex( $withCodePoint ) );
+var_dump( bin2hex( $explicit ) );
+
+?>
+DONE
+--EXPECT--
+bool(true)
+string(42) "008081eaebfeff008081eaebfeff008081eaebfeff"
+string(42) "008081eaebfeff008081eaebfeff008081eaebfeff"
+DONE
diff --git a/ext/standard/tests/strings/str_replace.phpt b/ext/standard/tests/strings/str_replace.phpt
deleted file mode 100644
index 7b411abac5..0000000000
--- a/ext/standard/tests/strings/str_replace.phpt
+++ /dev/null
@@ -1,957 +0,0 @@
---TEST--
-Test str_replace() function
---INI--
-precision=14
---FILE--
-<?php
-/*
- Prototype: mixed str_replace(mixed $search, mixed $replace,
- mixed $subject [, int &$count]);
- Description: Replace all occurrences of the search string with
- the replacement string
-*/
-
-echo "\n*** Testing str_replace() on basic operations ***\n";
-
-var_dump( str_replace("", "", "") );
-
-var_dump( str_replace("e", "b", "test") );
-
-var_dump( str_replace("", "", "", $count) );
-var_dump( $count );
-
-var_dump( str_replace("q", "q", "q", $count) );
-var_dump( $count );
-
-var_dump( str_replace("long string here", "", "", $count) );
-var_dump( $count );
-
-$fp = fopen( __FILE__, "r" );
-$fp_copy = $fp;
-var_dump( str_replace($fp_copy, $fp_copy, $fp_copy, $fp_copy) );
-var_dump( $fp_copy );
-fclose($fp);
-
-echo "\n*** Testing str_replace() with various search values ***";
-$search_arr = array( TRUE, FALSE, 1, 0, -1, "1", "0", "-1", NULL,
- array(), "php", "");
-
-$i = 0;
-/* loop through to replace the matched elements in the array */
-foreach( $search_arr as $value ) {
- echo "\n-- Iteration $i --\n";
- /* replace the string in array */
- var_dump( str_replace($value, "FOUND", $search_arr, $count) );
- var_dump( $count );
- $i++;
-}
-
-echo "\n*** Testing str_replace() with various subjects ***";
-$subject = "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE\000
- \x000\xABCD\0abcd \xXYZ\tabcd $$@#%^&*!~,.:;?: !!Hello, World
- ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)";
-
-/* needles in an array to be compared in the string $string */
-$search_str = array (
- "Hello, World",
- 'Hello, World',
- '!!Hello, World',
- "??Hello, World",
- "$@#%^&*!~,.:;?",
- "123",
- 123,
- "-1.2345",
- -1.2344,
- "abcd",
- 'XYZ',
- NULL,
- "NULL",
- "0",
- 0,
- "",
- " ",
- "\0",
- "\x000",
- "\xABC",
- "\0000",
- ".3",
- TRUE,
- "TRUE",
- "1",
- 1,
- FALSE,
- "FALSE",
- " ",
- " ",
- 'b',
- '\t',
- "\t",
- chr(128).chr(234).chr(65).chr(255).chr(256),
- $subject
-);
-
-/* loop through to get the $string */
-for( $i = 0; $i < count($search_str); $i++ ) {
- echo "\n--- Iteration $i ---";
- echo "\n-- String after replacing the search value is => --\n";
- var_dump( str_replace($search_str[$i], "FOUND", $subject, $count) );
- echo "-- search string has found '$count' times\n";
-}
-
-
-echo "\n*** Testing Miscelleneous input data ***\n";
-/* If replace has fewer values than search, then an empty
- string is used for the rest of replacement values */
-var_dump( str_replace(array("a", "a", "b"),
- array("q", "q"),
- "aaabb", $count
- )
- );
-var_dump($count);
-var_dump( str_replace(array("a", "a", "b"),
- array("q", "q"),
- array("aaa", "bbb", "ccc"),
- $count
- )
- );
-var_dump($count);
-
-
-echo "\n-- Testing objects --\n";
-/* we get "Recoverable fatal error: saying Object of class could not be converted
- to string" by default, when an object is passed instead of string:
-The error can be avoided by choosing the __toString magix method as follows: */
-
-class subject
-{
- function __toString() {
- return "Hello, world";
- }
-}
-$obj_subject = new subject;
-
-class search
-{
- function __toString() {
- return "Hello, world";
- }
-}
-$obj_search = new search;
-
-class replace
-{
- function __toString() {
- return "Hello, world";
- }
-}
-$obj_replace = new replace;
-
-var_dump(str_replace("$obj_search", "$obj_replace", "$obj_subject", $count));
-var_dump($count);
-
-
-echo "\n-- Testing arrays --\n";
-var_dump(str_replace(array("a", "a", "b"), "multi", "aaa", $count));
-var_dump($count);
-
-var_dump(str_replace( array("a", "a", "b"),
- array("q", "q", "c"),
- "aaa", $count
- )
-);
-var_dump($count);
-
-var_dump(str_replace( array("a", "a", "b"),
- array("q", "q", "c"),
- array("aaa", "bbb"),
- $count
- )
-);
-var_dump($count);
-
-var_dump(str_replace("a", array("q", "q", "c"), array("aaa", "bbb"), $count));
-var_dump($count);
-
-var_dump(str_replace("a", 1, array("aaa", "bbb"), $count));
-var_dump($count);
-
-var_dump(str_replace(1, 3, array("aaa1", "2bbb"), $count));
-var_dump($count);
-
-
-echo "\n-- Testing Resources --\n";
-$resource1 = fopen( __FILE__, "r" );
-$resource2 = opendir( "." );
-var_dump(str_replace("stream", "FOUND", $resource1, $count));
-var_dump($count);
-var_dump(str_replace("stream", "FOUND", $resource2, $count));
-var_dump($count);
-
-
-echo "\n-- Testing a longer and heredoc string --\n";
-$string = <<<EOD
-abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
-abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
-abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
-abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
-abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
-abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
-abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
-@#$%^&**&^%$#@!~:())))((((&&&**%$###@@@!!!~~~~@###$%^&*
-abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789
-EOD;
-
-var_dump( str_replace("abcdef", "FOUND", $string, $count) );
-var_dump( $count );
-
-echo "\n-- Testing a heredoc null string --\n";
-$str = <<<EOD
-EOD;
-var_dump( str_replace("", "FOUND", $str, $count) );
-var_dump( $count );
-
-
-echo "\n-- Testing simple and complex syntax strings --\n";
-$str = 'world';
-
-/* Simple syntax */
-var_dump( str_replace("world", "FOUND", "$str") );
-var_dump( str_replace("world'S", "FOUND", "$str'S") );
-var_dump( str_replace("worldS", "FOUND", "$strS") );
-
-/* String with curly braces, complex syntax */
-var_dump( str_replace("worldS", "FOUND", "${str}S") );
-var_dump( str_replace("worldS", "FOUND", "{$str}S") );
-
-
-echo "\n*** Testing error conditions ***";
-/* Invalid arguments */
-var_dump( str_replace() );
-var_dump( str_replace("") );
-var_dump( str_replace(NULL) );
-var_dump( str_replace(1, 2) );
-var_dump( str_replace(1,2,3,$var,5) );
-
-fclose($resource1);
-closedir($resource2);
-echo "Done\n";
-
-?>
---EXPECTF--
-*** Testing str_replace() on basic operations ***
-string(0) ""
-string(4) "tbst"
-string(0) ""
-int(0)
-string(1) "q"
-int(1)
-string(0) ""
-int(0)
-string(%d) "Resource id #%d"
-int(1)
-
-*** Testing str_replace() with various search values ***
--- Iteration 0 --
-array(12) {
- [0]=>
- string(5) "FOUND"
- [1]=>
- string(0) ""
- [2]=>
- string(5) "FOUND"
- [3]=>
- string(1) "0"
- [4]=>
- string(6) "-FOUND"
- [5]=>
- string(5) "FOUND"
- [6]=>
- string(1) "0"
- [7]=>
- string(6) "-FOUND"
- [8]=>
- string(0) ""
- [9]=>
- array(0) {
- }
- [10]=>
- string(3) "php"
- [11]=>
- string(0) ""
-}
-int(5)
-
--- Iteration 1 --
-array(12) {
- [0]=>
- string(1) "1"
- [1]=>
- string(0) ""
- [2]=>
- string(1) "1"
- [3]=>
- string(1) "0"
- [4]=>
- string(2) "-1"
- [5]=>
- string(1) "1"
- [6]=>
- string(1) "0"
- [7]=>
- string(2) "-1"
- [8]=>
- string(0) ""
- [9]=>
- array(0) {
- }
- [10]=>
- string(3) "php"
- [11]=>
- string(0) ""
-}
-int(0)
-
--- Iteration 2 --
-array(12) {
- [0]=>
- string(5) "FOUND"
- [1]=>
- string(0) ""
- [2]=>
- string(5) "FOUND"
- [3]=>
- string(1) "0"
- [4]=>
- string(6) "-FOUND"
- [5]=>
- string(5) "FOUND"
- [6]=>
- string(1) "0"
- [7]=>
- string(6) "-FOUND"
- [8]=>
- string(0) ""
- [9]=>
- array(0) {
- }
- [10]=>
- string(3) "php"
- [11]=>
- string(0) ""
-}
-int(5)
-
--- Iteration 3 --
-array(12) {
- [0]=>
- string(1) "1"
- [1]=>
- string(0) ""
- [2]=>
- string(1) "1"
- [3]=>
- string(5) "FOUND"
- [4]=>
- string(2) "-1"
- [5]=>
- string(1) "1"
- [6]=>
- string(5) "FOUND"
- [7]=>
- string(2) "-1"
- [8]=>
- string(0) ""
- [9]=>
- array(0) {
- }
- [10]=>
- string(3) "php"
- [11]=>
- string(0) ""
-}
-int(2)
-
--- Iteration 4 --
-array(12) {
- [0]=>
- string(1) "1"
- [1]=>
- string(0) ""
- [2]=>
- string(1) "1"
- [3]=>
- string(1) "0"
- [4]=>
- string(5) "FOUND"
- [5]=>
- string(1) "1"
- [6]=>
- string(1) "0"
- [7]=>
- string(5) "FOUND"
- [8]=>
- string(0) ""
- [9]=>
- array(0) {
- }
- [10]=>
- string(3) "php"
- [11]=>
- string(0) ""
-}
-int(2)
-
--- Iteration 5 --
-array(12) {
- [0]=>
- string(5) "FOUND"
- [1]=>
- string(0) ""
- [2]=>
- string(5) "FOUND"
- [3]=>
- string(1) "0"
- [4]=>
- string(6) "-FOUND"
- [5]=>
- string(5) "FOUND"
- [6]=>
- string(1) "0"
- [7]=>
- string(6) "-FOUND"
- [8]=>
- string(0) ""
- [9]=>
- array(0) {
- }
- [10]=>
- string(3) "php"
- [11]=>
- string(0) ""
-}
-int(5)
-
--- Iteration 6 --
-array(12) {
- [0]=>
- string(1) "1"
- [1]=>
- string(0) ""
- [2]=>
- string(1) "1"
- [3]=>
- string(5) "FOUND"
- [4]=>
- string(2) "-1"
- [5]=>
- string(1) "1"
- [6]=>
- string(5) "FOUND"
- [7]=>
- string(2) "-1"
- [8]=>
- string(0) ""
- [9]=>
- array(0) {
- }
- [10]=>
- string(3) "php"
- [11]=>
- string(0) ""
-}
-int(2)
-
--- Iteration 7 --
-array(12) {
- [0]=>
- string(1) "1"
- [1]=>
- string(0) ""
- [2]=>
- string(1) "1"
- [3]=>
- string(1) "0"
- [4]=>
- string(5) "FOUND"
- [5]=>
- string(1) "1"
- [6]=>
- string(1) "0"
- [7]=>
- string(5) "FOUND"
- [8]=>
- string(0) ""
- [9]=>
- array(0) {
- }
- [10]=>
- string(3) "php"
- [11]=>
- string(0) ""
-}
-int(2)
-
--- Iteration 8 --
-array(12) {
- [0]=>
- string(1) "1"
- [1]=>
- string(0) ""
- [2]=>
- string(1) "1"
- [3]=>
- string(1) "0"
- [4]=>
- string(2) "-1"
- [5]=>
- string(1) "1"
- [6]=>
- string(1) "0"
- [7]=>
- string(2) "-1"
- [8]=>
- string(0) ""
- [9]=>
- array(0) {
- }
- [10]=>
- string(3) "php"
- [11]=>
- string(0) ""
-}
-int(0)
-
--- Iteration 9 --
-array(12) {
- [0]=>
- string(1) "1"
- [1]=>
- string(0) ""
- [2]=>
- string(1) "1"
- [3]=>
- string(1) "0"
- [4]=>
- string(2) "-1"
- [5]=>
- string(1) "1"
- [6]=>
- string(1) "0"
- [7]=>
- string(2) "-1"
- [8]=>
- string(0) ""
- [9]=>
- array(0) {
- }
- [10]=>
- string(3) "php"
- [11]=>
- string(0) ""
-}
-int(0)
-
--- Iteration 10 --
-array(12) {
- [0]=>
- string(1) "1"
- [1]=>
- string(0) ""
- [2]=>
- string(1) "1"
- [3]=>
- string(1) "0"
- [4]=>
- string(2) "-1"
- [5]=>
- string(1) "1"
- [6]=>
- string(1) "0"
- [7]=>
- string(2) "-1"
- [8]=>
- string(0) ""
- [9]=>
- array(0) {
- }
- [10]=>
- string(5) "FOUND"
- [11]=>
- string(0) ""
-}
-int(1)
-
--- Iteration 11 --
-array(12) {
- [0]=>
- string(1) "1"
- [1]=>
- string(0) ""
- [2]=>
- string(1) "1"
- [3]=>
- string(1) "0"
- [4]=>
- string(2) "-1"
- [5]=>
- string(1) "1"
- [6]=>
- string(1) "0"
- [7]=>
- string(2) "-1"
- [8]=>
- string(0) ""
- [9]=>
- array(0) {
- }
- [10]=>
- string(3) "php"
- [11]=>
- string(0) ""
-}
-int(0)
-
-*** Testing str_replace() with various subjects ***
---- Iteration 0 ---
--- String after replacing the search value is => --
-string(177) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
-
- ?FOUND chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
--- search string has found '2' times
-
---- Iteration 1 ---
--- String after replacing the search value is => --
-string(177) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
-
- ?FOUND chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
--- search string has found '2' times
-
---- Iteration 2 ---
--- String after replacing the search value is => --
-string(182) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
-
- ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
--- search string has found '1' times
-
---- Iteration 3 ---
--- String after replacing the search value is => --
-string(191) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
-
- ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
--- search string has found '0' times
-
---- Iteration 4 ---
--- String after replacing the search value is => --
-string(182) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
-
- ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
--- search string has found '1' times
-
---- Iteration 5 ---
--- String after replacing the search value is => --
-string(191) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
-
- ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
--- search string has found '0' times
-
---- Iteration 6 ---
--- String after replacing the search value is => --
-string(191) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
-
- ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
--- search string has found '0' times
-
---- Iteration 7 ---
--- String after replacing the search value is => --
-string(189) "Hello, world,0120333.3445FOUND67 NULL TRUE FALSE
-
- ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
--- search string has found '1' times
-
---- Iteration 8 ---
--- String after replacing the search value is => --
-string(191) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
-
- ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
--- search string has found '0' times
-
---- Iteration 9 ---
--- String after replacing the search value is => --
-string(193) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
-
- ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
--- search string has found '2' times
-
---- Iteration 10 ---
--- String after replacing the search value is => --
-string(193) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
-
- ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
--- search string has found '1' times
-
---- Iteration 11 ---
--- String after replacing the search value is => --
-string(191) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
-
- ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
--- search string has found '0' times
-
---- Iteration 12 ---
--- String after replacing the search value is => --
-string(192) "Hello, world,0120333.3445-1.234567 FOUND TRUE FALSE
-
- ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
--- search string has found '1' times
-
---- Iteration 13 ---
--- String after replacing the search value is => --
-string(207) "Hello, world,FOUND12FOUND333.3445-1.234567 NULL TRUE FALSE
-
- ?Hello, World chr(FOUND).chr(128).chr(234).chr(65).chr(255).chr(256)"
--- search string has found '4' times
-
---- Iteration 14 ---
--- String after replacing the search value is => --
-string(207) "Hello, world,FOUND12FOUND333.3445-1.234567 NULL TRUE FALSE
-
- ?Hello, World chr(FOUND).chr(128).chr(234).chr(65).chr(255).chr(256)"
--- search string has found '4' times
-
---- Iteration 15 ---
--- String after replacing the search value is => --
-string(191) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
-
- ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
--- search string has found '0' times
-
---- Iteration 16 ---
--- String after replacing the search value is => --
-string(307) "Hello,FOUNDworld,0120333.3445-1.234567FOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDNULLFOUNDTRUEFOUNDFALSE
-FOUND FOUNDFOUNDFOUNDFOUND
- FOUNDFOUNDFOUNDFOUND?Hello,FOUNDWorldFOUNDchr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
--- search string has found '29' times
-
---- Iteration 17 ---
--- String after replacing the search value is => --
-string(203) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSEFOUND
- FOUND0«CDFOUNDabcd \xXYZ abcd $$@#%^&*!~,.:;?: !!Hello, World
- ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
--- search string has found '3' times
-
---- Iteration 18 ---
--- String after replacing the search value is => --
-string(194) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
- FOUND«CD
- ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
--- search string has found '1' times
-
---- Iteration 19 ---
--- String after replacing the search value is => --
-string(194) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
-
- ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
--- search string has found '1' times
-
---- Iteration 20 ---
--- String after replacing the search value is => --
-string(194) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
- FOUND«CD
- ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
--- search string has found '1' times
-
---- Iteration 21 ---
--- String after replacing the search value is => --
-string(194) "Hello, world,0120333FOUND445-1.234567 NULL TRUE FALSE
-
- ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
--- search string has found '1' times
-
---- Iteration 22 ---
--- String after replacing the search value is => --
-string(203) "Hello, world,0FOUND20333.3445-FOUND.234567 NULL TRUE FALSE
-
- ?Hello, World chr(0).chr(FOUND28).chr(234).chr(65).chr(255).chr(256)"
--- search string has found '3' times
-
---- Iteration 23 ---
--- String after replacing the search value is => --
-string(192) "Hello, world,0120333.3445-1.234567 NULL FOUND FALSE
-
- ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
--- search string has found '1' times
-
---- Iteration 24 ---
--- String after replacing the search value is => --
-string(203) "Hello, world,0FOUND20333.3445-FOUND.234567 NULL TRUE FALSE
-
- ?Hello, World chr(0).chr(FOUND28).chr(234).chr(65).chr(255).chr(256)"
--- search string has found '3' times
-
---- Iteration 25 ---
--- String after replacing the search value is => --
-string(203) "Hello, world,0FOUND20333.3445-FOUND.234567 NULL TRUE FALSE
-
- ?Hello, World chr(0).chr(FOUND28).chr(234).chr(65).chr(255).chr(256)"
--- search string has found '3' times
-
---- Iteration 26 ---
--- String after replacing the search value is => --
-string(191) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
-
- ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
--- search string has found '0' times
-
---- Iteration 27 ---
--- String after replacing the search value is => --
-string(191) "Hello, world,0120333.3445-1.234567 NULL TRUE FOUND
-
- ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
--- search string has found '1' times
-
---- Iteration 28 ---
--- String after replacing the search value is => --
-string(307) "Hello,FOUNDworld,0120333.3445-1.234567FOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDFOUNDNULLFOUNDTRUEFOUNDFALSE
-FOUND FOUNDFOUNDFOUNDFOUND
- FOUNDFOUNDFOUNDFOUND?Hello,FOUNDWorldFOUNDchr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
--- search string has found '29' times
-
---- Iteration 29 ---
--- String after replacing the search value is => --
-string(186) "Hello, world,0120333.3445-1.234567FOUNDNULL TRUE FALSE
-
- ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
--- search string has found '1' times
-
---- Iteration 30 ---
--- String after replacing the search value is => --
-string(199) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
-
- ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
--- search string has found '2' times
-
---- Iteration 31 ---
--- String after replacing the search value is => --
-string(191) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
-
- ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
--- search string has found '0' times
-
---- Iteration 32 ---
--- String after replacing the search value is => --
-string(203) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
- FOUND
-FOUND ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
--- search string has found '3' times
-
---- Iteration 33 ---
--- String after replacing the search value is => --
-string(191) "Hello, world,0120333.3445-1.234567 NULL TRUE FALSE
-
- ?Hello, World chr(0).chr(128).chr(234).chr(65).chr(255).chr(256)"
--- search string has found '0' times
-
---- Iteration 34 ---
--- String after replacing the search value is => --
-string(5) "FOUND"
--- search string has found '1' times
-
-*** Testing Miscelleneous input data ***
-string(3) "qqq"
-int(5)
-array(3) {
- [0]=>
- string(3) "qqq"
- [1]=>
- string(0) ""
- [2]=>
- string(3) "ccc"
-}
-int(6)
-
--- Testing objects --
-string(12) "Hello, world"
-int(1)
-
--- Testing arrays --
-string(15) "multimultimulti"
-int(3)
-string(3) "qqq"
-int(3)
-array(2) {
- [0]=>
- string(3) "qqq"
- [1]=>
- string(3) "ccc"
-}
-int(6)
-
-Notice: Array to string conversion in %s on line %d
-array(2) {
- [0]=>
- string(15) "ArrayArrayArray"
- [1]=>
- string(3) "bbb"
-}
-int(3)
-array(2) {
- [0]=>
- string(3) "111"
- [1]=>
- string(3) "bbb"
-}
-int(3)
-array(2) {
- [0]=>
- string(4) "aaa3"
- [1]=>
- string(4) "2bbb"
-}
-int(1)
-
--- Testing Resources --
-string(%d) "Resource id #%d"
-int(0)
-string(%d) "Resource id #%d"
-int(0)
-
--- Testing a longer and heredoc string --
-string(623) "FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789
-FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789
-FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789
-FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789
-FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789
-FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789
-FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789
-@#$%^&**&^%$#@!~:())))((((&&&**%$###@@@!!!~~~~@###$%^&*
-FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789"
-int(16)
-
--- Testing a heredoc null string --
-string(0) ""
-int(0)
-
--- Testing simple and complex syntax strings --
-string(5) "FOUND"
-string(5) "FOUND"
-
-Notice: Undefined variable: strS in %s on line %d
-string(0) ""
-string(5) "FOUND"
-string(5) "FOUND"
-
-*** Testing error conditions ***
-Warning: str_replace() expects at least 3 parameters, 0 given in %s on line %d
-NULL
-
-Warning: str_replace() expects at least 3 parameters, 1 given in %s on line %d
-NULL
-
-Warning: str_replace() expects at least 3 parameters, 1 given in %s on line %d
-NULL
-
-Warning: str_replace() expects at least 3 parameters, 2 given in %s on line %d
-NULL
-
-Warning: str_replace() expects at most 4 parameters, 5 given in %s on line %d
-NULL
-Done
diff --git a/ext/standard/tests/strings/str_replace_basic.phpt b/ext/standard/tests/strings/str_replace_basic.phpt
index 790a32fffd..fa39b24e3a 100644
--- a/ext/standard/tests/strings/str_replace_basic.phpt
+++ b/ext/standard/tests/strings/str_replace_basic.phpt
@@ -28,12 +28,15 @@ var_dump( $count );
$fp = fopen( __FILE__, "r" );
$fp_copy = $fp;
-var_dump( str_replace($fp_copy, $fp_copy, $fp_copy, $fp_copy) );
+try {
+ var_dump( str_replace($fp_copy, $fp_copy, $fp_copy, $fp_copy) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump( $fp_copy );
fclose($fp);
?>
-===DONE===
--EXPECTF--
*** Testing str_replace() on basic operations ***
string(0) ""
@@ -44,6 +47,5 @@ string(1) "q"
int(1)
string(0) ""
int(0)
-string(%d) "Resource id #%d"
-int(1)
-===DONE===
+str_replace() expects parameter 3 to be string or array, resource given
+resource(%d) of type (stream)
diff --git a/ext/standard/tests/strings/str_replace_variation1.phpt b/ext/standard/tests/strings/str_replace_variation1.phpt
index 067e26307d..2e6dd18b94 100644
--- a/ext/standard/tests/strings/str_replace_variation1.phpt
+++ b/ext/standard/tests/strings/str_replace_variation1.phpt
@@ -27,7 +27,6 @@ foreach( $search_arr as $value ) {
}
?>
-===DONE===
--EXPECT--
*** Testing str_replace() with various search values ***
-- Iteration 0 --
@@ -389,4 +388,3 @@ array(12) {
string(0) ""
}
int(0)
-===DONE===
diff --git a/ext/standard/tests/strings/str_replace_variation2.phpt b/ext/standard/tests/strings/str_replace_variation2.phpt
index cbb2e0e5ed..92a1e8a975 100644
--- a/ext/standard/tests/strings/str_replace_variation2.phpt
+++ b/ext/standard/tests/strings/str_replace_variation2.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/str_replace_variation3.phpt b/ext/standard/tests/strings/str_replace_variation3.phpt
index 8ae709745f..f1bbf89b9f 100644
--- a/ext/standard/tests/strings/str_replace_variation3.phpt
+++ b/ext/standard/tests/strings/str_replace_variation3.phpt
@@ -12,14 +12,14 @@ precision=14
*/
-echo "\n*** Testing Miscelleneous input data ***\n";
+echo "\n*** Testing Miscellaneous input data ***\n";
/* If replace has fewer values than search, then an empty
string is used for the rest of replacement values */
var_dump( str_replace(array("a", "a", "b"),
- array("q", "q"),
- "aaabb", $count
- )
- );
+ array("q", "q"),
+ "aaabb", $count
+ )
+ );
var_dump($count);
var_dump( str_replace(array("a", "a", "b"),
array("q", "q"),
@@ -95,10 +95,16 @@ var_dump($count);
echo "\n-- Testing Resources --\n";
$resource1 = fopen( __FILE__, "r" );
$resource2 = opendir( "." );
-var_dump(str_replace("stream", "FOUND", $resource1, $count));
-var_dump($count);
-var_dump(str_replace("stream", "FOUND", $resource2, $count));
-var_dump($count);
+try {
+ var_dump(str_replace("stream", "FOUND", $resource1, $count));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(str_replace("stream", "FOUND", $resource2, $count));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "\n-- Testing a longer and heredoc string --\n";
@@ -141,9 +147,8 @@ fclose($resource1);
closedir($resource2);
?>
-===DONE===
--EXPECTF--
-*** Testing Miscelleneous input data ***
+*** Testing Miscellaneous input data ***
string(3) "qqq"
int(5)
array(3) {
@@ -173,7 +178,7 @@ array(2) {
}
int(6)
-Notice: Array to string conversion in %s on line %d
+Warning: Array to string conversion in %s on line %d
array(1) {
[0]=>
string(15) "ArrayArrayArray"
@@ -195,10 +200,8 @@ array(2) {
int(1)
-- Testing Resources --
-string(%d) "Resource id #%d"
-int(0)
-string(%d) "Resource id #%d"
-int(0)
+str_replace() expects parameter 3 to be string or array, resource given
+str_replace() expects parameter 3 to be string or array, resource given
-- Testing a longer and heredoc string --
string(623) "FOUNDghijklmnopqrstuvwxyz0123456789FOUNDghijklmnopqrstuvwxyz0123456789
@@ -220,8 +223,7 @@ int(0)
string(5) "FOUND"
string(5) "FOUND"
-Notice: Undefined variable: strS in %s on line %d
+Warning: Undefined variable: strS in %s on line %d
string(0) ""
string(5) "FOUND"
string(5) "FOUND"
-===DONE===
diff --git a/ext/standard/tests/strings/str_rot13_basic.phpt b/ext/standard/tests/strings/str_rot13_basic.phpt
index 7f5fc1405c..bc071be2b4 100644
--- a/ext/standard/tests/strings/str_rot13_basic.phpt
+++ b/ext/standard/tests/strings/str_rot13_basic.phpt
@@ -14,16 +14,16 @@ var_dump(str_rot13("abcdefghijklmnopqrstuvwxyz"));
echo "\nEnsure numeric characters are left untouched\n";
if (strcmp(str_rot13("0123456789"), "0123456789") == 0) {
- echo "Strings equal : TEST PASSED\n";
+ echo "Strings equal : TEST PASSED\n";
} else {
- echo "Strings unequal : TEST FAILED\n";
+ echo "Strings unequal : TEST FAILED\n";
}
echo "\nEnsure non-alphabetic characters are left untouched\n";
if (strcmp(str_rot13("!%^&*()_-+={}[]:;@~#<,>.?"), "!%^&*()_-+={}[]:;@~#<,>.?")) {
- echo "Strings equal : TEST PASSED\n";
+ echo "Strings equal : TEST PASSED\n";
} else {
- echo "Strings unequal : TEST FAILED\n";
+ echo "Strings unequal : TEST FAILED\n";
}
echo "\nEnsure strings round trip\n";
@@ -31,12 +31,11 @@ $str = "str_rot13() tests starting";
$encode = str_rot13($str);
$decode = str_rot13($encode);
if (strcmp($str, $decode) == 0) {
- echo "Strings equal : TEST PASSED\n";
+ echo "Strings equal : TEST PASSED\n";
} else {
- echo "Strings unequal : TEST FAILED\n";
+ echo "Strings unequal : TEST FAILED\n";
}
?>
-===DONE===
--EXPECT--
*** Testing str_rot13() : basic functionality ***
@@ -52,4 +51,3 @@ Strings unequal : TEST FAILED
Ensure strings round trip
Strings equal : TEST PASSED
-===DONE===
diff --git a/ext/standard/tests/strings/str_shuffle_basic.phpt b/ext/standard/tests/strings/str_shuffle_basic.phpt
index 350600891b..8e857ff4ec 100644
--- a/ext/standard/tests/strings/str_shuffle_basic.phpt
+++ b/ext/standard/tests/strings/str_shuffle_basic.phpt
@@ -29,13 +29,13 @@ for ($i = 0; $i < $trys; $i++) {
$op = str_shuffle($ip);
if (!is_string($op) || strlen($op) != $len_ip) {
- echo "TEST FAILED\n";
+ echo "TEST FAILED\n";
}
// Combination already hit ?
if (empty($a[$op])) {
- // No first time init
- $a[$op] = 0;
+ // No first time init
+ $a[$op] = 0;
}
// Increment count for this combination
@@ -45,15 +45,13 @@ for ($i = 0; $i < $trys; $i++) {
$combinations = count($a);
if ($combinations != 24) {
- echo "TEST FAILED.. Only $combinations out of a possible 24 combinations used\n";
+ echo "TEST FAILED.. Only $combinations out of a possible 24 combinations used\n";
} else {
- echo "TEST PASSED\n";
+ echo "TEST PASSED\n";
}
?>
-===DONE===
--EXPECTF--
*** Testing str_shuffle() : basic functionality ***
string(47) "%s"
TEST PASSED
-===DONE===
diff --git a/ext/standard/tests/strings/str_split_variation6.phpt b/ext/standard/tests/strings/str_split_variation6.phpt
index a477800a26..270fcad05a 100644
--- a/ext/standard/tests/strings/str_split_variation6.phpt
+++ b/ext/standard/tests/strings/str_split_variation6.phpt
@@ -18,7 +18,7 @@ if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
* passing different integer values for 'split_length' argument to str_split()
*/
-echo "*** Testing str_split() : different intger values for 'split_length' ***\n";
+echo "*** Testing str_split() : different integer values for 'split_length' ***\n";
//Initialise variables
$str = 'This is a string with 123 & escape char \t';
@@ -30,23 +30,24 @@ $values = array (
0234, //octal number
0x1A, //hexadecimal number
2147483647, //max positive integer number
- 2147483648, //max positive integer+1
-2147483648, //min negative integer
);
//loop through each element of $values for 'split_length'
for($count = 0; $count < count($values); $count++) {
- echo "-- Iteration ".($count + 1)." --\n";
- var_dump( str_split($str, $values[$count]) );
+ echo "-- Iteration ".($count + 1)." --\n";
+
+ try {
+ var_dump( str_split($str, $values[$count]) );
+ } catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+ }
}
-echo "Done"
?>
---EXPECTF--
-*** Testing str_split() : different intger values for 'split_length' ***
+--EXPECT--
+*** Testing str_split() : different integer values for 'split_length' ***
-- Iteration 1 --
-
-Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
-bool(false)
+The length of each segment must be greater than zero
-- Iteration 2 --
array(42) {
[0]=>
@@ -135,9 +136,7 @@ array(42) {
string(1) "t"
}
-- Iteration 3 --
-
-Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
-bool(false)
+The length of each segment must be greater than zero
-- Iteration 4 --
array(1) {
[0]=>
@@ -156,11 +155,4 @@ array(1) {
string(42) "This is a string with 123 & escape char \t"
}
-- Iteration 7 --
-
-Warning: str_split() expects parameter 2 to be int, float given in %s line %d
-NULL
--- Iteration 8 --
-
-Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
-bool(false)
-Done
+The length of each segment must be greater than zero
diff --git a/ext/standard/tests/strings/str_split_variation6_64bit.phpt b/ext/standard/tests/strings/str_split_variation6_64bit.phpt
index 583c7db3cf..f9cd29cef3 100644
--- a/ext/standard/tests/strings/str_split_variation6_64bit.phpt
+++ b/ext/standard/tests/strings/str_split_variation6_64bit.phpt
@@ -18,7 +18,7 @@ if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
* passing different integer values for 'split_length' argument to str_split()
*/
-echo "*** Testing str_split() : different intger values for 'split_length' ***\n";
+echo "*** Testing str_split() : different integer values for 'split_length' ***\n";
//Initialise variables
$str = 'This is a string with 123 & escape char \t';
@@ -36,17 +36,18 @@ $values = array (
//loop through each element of $values for 'split_length'
for($count = 0; $count < count($values); $count++) {
- echo "-- Iteration ".($count + 1)." --\n";
- var_dump( str_split($str, $values[$count]) );
+ echo "-- Iteration ".($count + 1)." --\n";
+ try {
+ var_dump( str_split($str, $values[$count]) );
+ } catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+ }
}
-echo "Done"
?>
---EXPECTF--
-*** Testing str_split() : different intger values for 'split_length' ***
+--EXPECT--
+*** Testing str_split() : different integer values for 'split_length' ***
-- Iteration 1 --
-
-Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
-bool(false)
+The length of each segment must be greater than zero
-- Iteration 2 --
array(42) {
[0]=>
@@ -135,9 +136,7 @@ array(42) {
string(1) "t"
}
-- Iteration 3 --
-
-Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
-bool(false)
+The length of each segment must be greater than zero
-- Iteration 4 --
array(1) {
[0]=>
@@ -161,7 +160,4 @@ array(1) {
string(42) "This is a string with 123 & escape char \t"
}
-- Iteration 8 --
-
-Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
-bool(false)
-Done
+The length of each segment must be greater than zero
diff --git a/ext/standard/tests/strings/str_split_variation7.phpt b/ext/standard/tests/strings/str_split_variation7.phpt
index 5082c7ba2f..097607bf8b 100644
--- a/ext/standard/tests/strings/str_split_variation7.phpt
+++ b/ext/standard/tests/strings/str_split_variation7.phpt
@@ -18,7 +18,7 @@ if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
* passing different integer values for 'split_length' and heredoc string as 'str' argument to str_split()
*/
-echo "*** Testing str_split() : different intger values for 'split_length' with heredoc 'str' ***\n";
+echo "*** Testing str_split() : different integer values for 'split_length' with heredoc 'str' ***\n";
//Initialise variables
$str = <<<EOT
string with 123,escape char \t.
@@ -32,23 +32,24 @@ $values = array (
0234, //octal number
0x1A, //hexadecimal number
2147483647, //max positive integer number
- 2147483648, //max positive integer+1
-2147483648, //min negative integer
);
//loop through each element of $values for 'split_length'
for($count = 0; $count < count($values); $count++) {
- echo "-- Iteration ".($count + 1)." --\n";
- var_dump( str_split($str, $values[$count]) );
+ echo "-- Iteration ".($count + 1)." --\n";
+
+ try {
+ var_dump( str_split($str, $values[$count]) );
+ } catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+ }
}
-echo "Done"
?>
---EXPECTF--
-*** Testing str_split() : different intger values for 'split_length' with heredoc 'str' ***
+--EXPECT--
+*** Testing str_split() : different integer values for 'split_length' with heredoc 'str' ***
-- Iteration 1 --
-
-Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
-bool(false)
+The length of each segment must be greater than zero
-- Iteration 2 --
array(30) {
[0]=>
@@ -113,9 +114,7 @@ array(30) {
string(1) "."
}
-- Iteration 3 --
-
-Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
-bool(false)
+The length of each segment must be greater than zero
-- Iteration 4 --
array(1) {
[0]=>
@@ -134,11 +133,4 @@ array(1) {
string(30) "string with 123,escape char ."
}
-- Iteration 7 --
-
-Warning: str_split() expects parameter 2 to be int, float given in %s on line %d
-NULL
--- Iteration 8 --
-
-Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
-bool(false)
-Done
+The length of each segment must be greater than zero
diff --git a/ext/standard/tests/strings/str_split_variation7_64bit.phpt b/ext/standard/tests/strings/str_split_variation7_64bit.phpt
index bff61adb30..d1771e6e2d 100644
--- a/ext/standard/tests/strings/str_split_variation7_64bit.phpt
+++ b/ext/standard/tests/strings/str_split_variation7_64bit.phpt
@@ -18,7 +18,7 @@ if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
* passing different integer values for 'split_length' and heredoc string as 'str' argument to str_split()
*/
-echo "*** Testing str_split() : different intger values for 'split_length' with heredoc 'str' ***\n";
+echo "*** Testing str_split() : different integer values for 'split_length' with heredoc 'str' ***\n";
//Initialise variables
$str = <<<EOT
string with 123,escape char \t.
@@ -38,17 +38,18 @@ $values = array (
//loop through each element of $values for 'split_length'
for($count = 0; $count < count($values); $count++) {
- echo "-- Iteration ".($count + 1)." --\n";
- var_dump( str_split($str, $values[$count]) );
+ echo "-- Iteration ".($count + 1)." --\n";
+ try {
+ var_dump( str_split($str, $values[$count]) );
+ } catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+ }
}
-echo "Done"
?>
---EXPECTF--
-*** Testing str_split() : different intger values for 'split_length' with heredoc 'str' ***
+--EXPECT--
+*** Testing str_split() : different integer values for 'split_length' with heredoc 'str' ***
-- Iteration 1 --
-
-Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
-bool(false)
+The length of each segment must be greater than zero
-- Iteration 2 --
array(30) {
[0]=>
@@ -113,9 +114,7 @@ array(30) {
string(1) "."
}
-- Iteration 3 --
-
-Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
-bool(false)
+The length of each segment must be greater than zero
-- Iteration 4 --
array(1) {
[0]=>
@@ -139,7 +138,4 @@ array(1) {
string(30) "string with 123,escape char ."
}
-- Iteration 8 --
-
-Warning: str_split(): The length of each segment must be greater than zero in %s on line %d
-bool(false)
-Done
+The length of each segment must be greater than zero
diff --git a/ext/standard/tests/strings/str_word_count.phpt b/ext/standard/tests/strings/str_word_count.phpt
index f88646370b..fda1678daa 100644
--- a/ext/standard/tests/strings/str_word_count.phpt
+++ b/ext/standard/tests/strings/str_word_count.phpt
@@ -2,39 +2,51 @@
str_word_count()
--FILE--
<?php
-error_reporting(E_ALL);
-$str = "Hello friend, you're
+$str = "Hello friend, you're
looking good today!";
$b =& $str;
var_dump(str_word_count($str, 1));
var_dump(str_word_count($str, 2));
var_dump(str_word_count($str));
-var_dump(str_word_count($str, 3));
-var_dump(str_word_count($str, 123));
-var_dump(str_word_count($str, -1));
-var_dump(str_word_count($str, 999999999));
-var_dump(str_word_count($str, array()));
-var_dump(str_word_count($str, $b));
+
+try {
+ var_dump(str_word_count($str, 3));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+}
+
+try {
+ var_dump(str_word_count($str, 123));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+}
+
+try {
+ var_dump(str_word_count($str, -1));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+}
+
+try {
+ var_dump(str_word_count($str, 999999999));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+}
+
var_dump($str);
$str2 = "F0o B4r 1s bar foo";
var_dump(str_word_count($str2, NULL, "04"));
var_dump(str_word_count($str2, NULL, "01"));
var_dump(str_word_count($str2, NULL, "014"));
-var_dump(str_word_count($str2, NULL, array()));
-var_dump(str_word_count($str2, NULL, new stdClass));
var_dump(str_word_count($str2, NULL, ""));
var_dump(str_word_count($str2, 1, "04"));
var_dump(str_word_count($str2, 1, "01"));
var_dump(str_word_count($str2, 1, "014"));
-var_dump(str_word_count($str2, 1, array()));
-var_dump(str_word_count($str2, 1, new stdClass));
var_dump(str_word_count($str2, 1, ""));
var_dump(str_word_count($str2, 2, "04"));
var_dump(str_word_count($str2, 2, "01"));
var_dump(str_word_count($str2, 2, "014"));
-var_dump(str_word_count($str2, 2, array()));
-var_dump(str_word_count($str2, 2, new stdClass));
var_dump(str_word_count($str2, 2, ""));
var_dump(str_word_count("foo'0 bar-0var", 2, "0"));
var_dump(str_word_count("'foo'", 2));
@@ -42,9 +54,10 @@ var_dump(str_word_count("'foo'", 2, "'"));
var_dump(str_word_count("-foo-", 2));
var_dump(str_word_count("-foo-", 2, "-"));
-echo "Done\n";
?>
---EXPECTF--
+
+DONE
+--EXPECT--
array(6) {
[0]=>
string(5) "Hello"
@@ -66,43 +79,23 @@ array(6) {
string(6) "friend"
[14]=>
string(6) "you're"
- [27]=>
+ [25]=>
string(7) "looking"
- [44]=>
+ [42]=>
string(4) "good"
- [49]=>
+ [47]=>
string(5) "today"
}
int(6)
-
-Warning: str_word_count(): Invalid format value 3 in %s on line %d
-bool(false)
-
-Warning: str_word_count(): Invalid format value 123 in %s on line %d
-bool(false)
-
-Warning: str_word_count(): Invalid format value -1 in %s on line %d
-bool(false)
-
-Warning: str_word_count(): Invalid format value 999999999 in %s on line %d
-bool(false)
-
-Warning: str_word_count() expects parameter 2 to be int, array given in %s on line %d
-NULL
-
-Warning: str_word_count() expects parameter 2 to be int, string given in %s on line %d
-NULL
-string(55) "Hello friend, you're
+Invalid format value 3
+Invalid format value 123
+Invalid format value -1
+Invalid format value 999999999
+string(53) "Hello friend, you're
looking good today!"
int(5)
int(6)
int(5)
-
-Warning: str_word_count() expects parameter 3 to be string, array given in %s on line %d
-NULL
-
-Warning: str_word_count() expects parameter 3 to be string, object given in %s on line %d
-NULL
int(7)
array(5) {
[0]=>
@@ -142,12 +135,6 @@ array(5) {
[4]=>
string(3) "foo"
}
-
-Warning: str_word_count() expects parameter 3 to be string, array given in %s on line %d
-NULL
-
-Warning: str_word_count() expects parameter 3 to be string, object given in %s on line %d
-NULL
array(7) {
[0]=>
string(1) "F"
@@ -202,12 +189,6 @@ array(5) {
[15]=>
string(3) "foo"
}
-
-Warning: str_word_count() expects parameter 3 to be string, array given in %s on line %d
-NULL
-
-Warning: str_word_count() expects parameter 3 to be string, object given in %s on line %d
-NULL
array(7) {
[0]=>
string(1) "F"
@@ -246,4 +227,5 @@ array(1) {
[0]=>
string(5) "-foo-"
}
-Done
+
+DONE
diff --git a/ext/standard/tests/strings/str_word_count1.phpt b/ext/standard/tests/strings/str_word_count1.phpt
index e942a17385..9eab1afcbc 100644
--- a/ext/standard/tests/strings/str_word_count1.phpt
+++ b/ext/standard/tests/strings/str_word_count1.phpt
@@ -4,23 +4,27 @@ str_word_count() and invalid arguments
<?php
var_dump(str_word_count(""));
-var_dump(str_word_count("", -1));
-var_dump(str_word_count("", -1, $a));
-var_dump($a);
-echo "Done\n";
+try {
+ var_dump(str_word_count("", -1));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+}
+
+try {
+ var_dump(str_word_count("", -1, $a));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+}
+
+var_dump($a);
?>
--EXPECTF--
int(0)
+Invalid format value -1
-Warning: str_word_count(): Invalid format value -1 in %s on line %d
-bool(false)
-
-Notice: Undefined variable: a in %s on line %d
-
-Warning: str_word_count(): Invalid format value -1 in %s on line %d
-bool(false)
+Warning: Undefined variable: a in %s on line %d
+Invalid format value -1
-Notice: Undefined variable: a in %s on line %d
+Warning: Undefined variable: a in %s on line %d
NULL
-Done
diff --git a/ext/standard/tests/strings/strcasecmp.phpt b/ext/standard/tests/strings/strcasecmp.phpt
index 3086c2be92..4258f11ee3 100644
--- a/ext/standard/tests/strings/strcasecmp.phpt
+++ b/ext/standard/tests/strings/strcasecmp.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strcmp.phpt b/ext/standard/tests/strings/strcmp.phpt
index 397e072c52..d4110601af 100644
--- a/ext/standard/tests/strings/strcmp.phpt
+++ b/ext/standard/tests/strings/strcmp.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strcmp_unterminated.phpt b/ext/standard/tests/strings/strcmp_unterminated.phpt
index 215193567b..afc082a221 100644
--- a/ext/standard/tests/strings/strcmp_unterminated.phpt
+++ b/ext/standard/tests/strings/strcmp_unterminated.phpt
@@ -15,8 +15,6 @@ var_dump(
zend_terminate_string($a);
zend_terminate_string($b);
?>
-===DONE===
--EXPECT--
int(-1)
int(1)
-===DONE===
diff --git a/ext/standard/tests/strings/strcoll.phpt b/ext/standard/tests/strings/strcoll.phpt
index 37fe251b66..d1d3df11fc 100644
--- a/ext/standard/tests/strings/strcoll.phpt
+++ b/ext/standard/tests/strings/strcoll.phpt
@@ -13,7 +13,7 @@ Testfest 2009 Munich
setlocale (LC_COLLATE, 'C');
$result = strcoll($a, $b);
if($result > 0) {
- echo "Pass\n";
+ echo "Pass\n";
}
?>
--EXPECT--
diff --git a/ext/standard/tests/strings/strcspn_variation10.phpt b/ext/standard/tests/strings/strcspn_variation10.phpt
index 1ad369f5dd..0b933b8049 100644
--- a/ext/standard/tests/strings/strcspn_variation10.phpt
+++ b/ext/standard/tests/strings/strcspn_variation10.phpt
@@ -18,35 +18,35 @@ echo "*** Testing strcspn() : with different mask strings and default start and
// initialing required variables
$strings = array(
"",
- '',
- "\n",
- '\n',
- "hello\tworld\nhello\nworld\n",
- 'hello\tworld\nhello\nworld\n',
- "1234hello45world\t123",
- '1234hello45world\t123',
- "hello\0world\012",
- 'hello\0world\012',
- chr(0).chr(0),
- chr(0)."hello\0world".chr(0),
- chr(0).'hello\0world'.chr(0),
- "hello".chr(0)."world",
- 'hello'.chr(0).'world',
- "hello\0\100\xaaaworld",
- 'hello\0\100\xaaaworld'
+ '',
+ "\n",
+ '\n',
+ "hello\tworld\nhello\nworld\n",
+ 'hello\tworld\nhello\nworld\n',
+ "1234hello45world\t123",
+ '1234hello45world\t123',
+ "hello\0world\012",
+ 'hello\0world\012',
+ chr(0).chr(0),
+ chr(0)."hello\0world".chr(0),
+ chr(0).'hello\0world'.chr(0),
+ "hello".chr(0)."world",
+ 'hello'.chr(0).'world',
+ "hello\0\100\xaaaworld",
+ 'hello\0\100\xaaaworld'
);
// defining array of mask strings
$mask_array = array(
- "",
- '',
- "\n\trsti \l",
- '\n\trsti \l',
- "\t",
- "t\ ",
- '\t',
- "\t\ ",
- " \t",
+ "",
+ '',
+ "\n\trsti \l",
+ '\n\trsti \l',
+ "\t",
+ "t\ ",
+ '\t',
+ "\t\ ",
+ " \t",
"\t\i\100\xa"
);
diff --git a/ext/standard/tests/strings/strcspn_variation12.phpt b/ext/standard/tests/strings/strcspn_variation12.phpt
index 4495e7c26d..83530aee71 100644
--- a/ext/standard/tests/strings/strcspn_variation12.phpt
+++ b/ext/standard/tests/strings/strcspn_variation12.phpt
@@ -43,22 +43,22 @@ $mask_array = array(
//defining array of start values
$start_array = array(
- 0,
- 1,
- 2,
- -1,
- 2147483647, // max positive integer
- -2147483648 // min negative integer
+ 0,
+ 1,
+ 2,
+ -1,
+ 2147483647, // max positive integer
+ -2147483648 // min negative integer
);
//defining array of len values
$len_array = array(
- 0,
- 1,
- 2,
- -1,
- 2147483647, // max positive integer
- -2147483648 // min negative integer
+ 0,
+ 1,
+ 2,
+ -1,
+ 2147483647, // max positive integer
+ -2147483648 // min negative integer
);
diff --git a/ext/standard/tests/strings/strcspn_variation6.phpt b/ext/standard/tests/strings/strcspn_variation6.phpt
index 4d6c81d0fb..dc8ceb6ddf 100644
--- a/ext/standard/tests/strings/strcspn_variation6.phpt
+++ b/ext/standard/tests/strings/strcspn_variation6.phpt
@@ -62,15 +62,15 @@ $heredoc_strings = array(
// defining array of mask strings
$mask_array = array(
- "",
- '',
- "\n\trsti \l",
- '\n\trsti \l',
- "\t",
- "t\ ",
- '\t',
- "\t\ ",
- " \t",
+ "",
+ '',
+ "\n\trsti \l",
+ '\n\trsti \l',
+ "\t",
+ "t\ ",
+ '\t',
+ "\t\ ",
+ " \t",
"\t\i\100\xaa"
);
diff --git a/ext/standard/tests/strings/strcspn_variation7.phpt b/ext/standard/tests/strings/strcspn_variation7.phpt
index 1f53e20d6f..6c88b45f28 100644
--- a/ext/standard/tests/strings/strcspn_variation7.phpt
+++ b/ext/standard/tests/strings/strcspn_variation7.phpt
@@ -57,34 +57,34 @@ $heredoc_strings = array(
$heredoc_with_newline_and_tabs,
$heredoc_with_alphanumerics,
$heredoc_with_embedded_nulls,
- $heredoc_with_hexa_octal
- );
+ $heredoc_with_hexa_octal
+ );
// defining array of mask strings
$mask_array = array(
- "",
- '',
- "\n\trsti \l",
- '\n\trsti \l',
- "\t",
- "t\ ",
- '\t',
- "\t\ ",
- " \t",
+ "",
+ '',
+ "\n\trsti \l",
+ '\n\trsti \l',
+ "\t",
+ "t\ ",
+ '\t',
+ "\t\ ",
+ " \t",
"\t\i\100\xaa"
);
// definig array of start values
$start_array = array(
- 0,
- 1,
- 2,
- -1,
- -2,
- 2147483647, // max positive integer
- -2147483648, // min negative integer
+ 0,
+ 1,
+ 2,
+ -1,
+ -2,
+ 2147483647, // max positive integer
+ -2147483648, // min negative integer
);
diff --git a/ext/standard/tests/strings/strcspn_variation8.phpt b/ext/standard/tests/strings/strcspn_variation8.phpt
index 10c42731e7..388d9156a5 100644
--- a/ext/standard/tests/strings/strcspn_variation8.phpt
+++ b/ext/standard/tests/strings/strcspn_variation8.phpt
@@ -57,38 +57,38 @@ $heredoc_strings = array(
$heredoc_with_newline_and_tabs,
$heredoc_with_alphanumerics,
$heredoc_with_embedded_nulls,
- $heredoc_with_hexa_octal
- );
+ $heredoc_with_hexa_octal
+ );
// defining array of mask strings
$mask_array = array(
- "",
- '',
- "\n\trsti \l",
- "\t",
- "t\ ",
- " \t",
+ "",
+ '',
+ "\n\trsti \l",
+ "\t",
+ "t\ ",
+ " \t",
"\t\i\100\xaa"
);
// definig array of start values
$start_array = array(
- 0,
- 1,
- 2,
- -1,
- 2147483647, // max positive integer
- -2147483648, // min negative integer
+ 0,
+ 1,
+ 2,
+ -1,
+ 2147483647, // max positive integer
+ -2147483648, // min negative integer
);
// defining array of len values
$len_array = array(
- 0,
- 1,
- 2,
- -1,
- 2147483647, // max positive integer
- -2147483648, // min negative integer
+ 0,
+ 1,
+ 2,
+ -1,
+ 2147483647, // max positive integer
+ -2147483648, // min negative integer
);
diff --git a/ext/standard/tests/strings/strcspn_variation9.phpt b/ext/standard/tests/strings/strcspn_variation9.phpt
index 632aaa4b5d..6fd70827a5 100644
--- a/ext/standard/tests/strings/strcspn_variation9.phpt
+++ b/ext/standard/tests/strings/strcspn_variation9.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strip_tags.phpt b/ext/standard/tests/strings/strip_tags.phpt
index 7beebf1b0c..e594e1793c 100644
--- a/ext/standard/tests/strings/strip_tags.phpt
+++ b/ext/standard/tests/strings/strip_tags.phpt
@@ -2,20 +2,20 @@
strip_tags() function
--FILE--
<?php
- echo strip_tags('NEAT <? cool < blah ?> STUFF');
- echo "\n";
- echo strip_tags('NEAT <? cool > blah ?> STUFF');
- echo "\n";
- echo strip_tags('NEAT <!-- cool < blah --> STUFF');
- echo "\n";
- echo strip_tags('NEAT <!-- cool > blah --> STUFF');
- echo "\n";
- echo strip_tags('NEAT <? echo \"\\\"\"?> STUFF');
- echo "\n";
- echo strip_tags('NEAT <? echo \'\\\'\'?> STUFF');
- echo "\n";
- echo strip_tags('TESTS ?!!?!?!!!?!!');
- echo "\n";
+ echo strip_tags('NEAT <? cool < blah ?> STUFF');
+ echo "\n";
+ echo strip_tags('NEAT <? cool > blah ?> STUFF');
+ echo "\n";
+ echo strip_tags('NEAT <!-- cool < blah --> STUFF');
+ echo "\n";
+ echo strip_tags('NEAT <!-- cool > blah --> STUFF');
+ echo "\n";
+ echo strip_tags('NEAT <? echo \"\\\"\"?> STUFF');
+ echo "\n";
+ echo strip_tags('NEAT <? echo \'\\\'\'?> STUFF');
+ echo "\n";
+ echo strip_tags('TESTS ?!!?!?!!!?!!');
+ echo "\n";
?>
--EXPECT--
NEAT STUFF
diff --git a/ext/standard/tests/strings/stripcslashes_basic.phpt b/ext/standard/tests/strings/stripcslashes_basic.phpt
index 493e669131..70538b75b0 100644
--- a/ext/standard/tests/strings/stripcslashes_basic.phpt
+++ b/ext/standard/tests/strings/stripcslashes_basic.phpt
@@ -22,7 +22,6 @@ var_dump(bin2hex(stripcslashes('\\f')));
var_dump(bin2hex(stripcslashes('\\t')));
var_dump(bin2hex(stripcslashes('\\v')));
?>
-===DONE===
--EXPECT--
*** Testing stripcslashes() : basic functionality ***
string(11) "Hello World"
@@ -36,4 +35,3 @@ string(2) "08"
string(2) "0c"
string(2) "09"
string(2) "0b"
-===DONE===
diff --git a/ext/standard/tests/strings/stripos.phpt b/ext/standard/tests/strings/stripos.phpt
index 057b8ca494..f56d38d3de 100644
--- a/ext/standard/tests/strings/stripos.phpt
+++ b/ext/standard/tests/strings/stripos.phpt
@@ -2,33 +2,33 @@
stripos() function test
--FILE--
<?php
- var_dump(stripos("test string", "TEST"));
- var_dump(stripos("test string", "strIng"));
- var_dump(stripos("test string", "stRin"));
- var_dump(stripos("test string", "t S"));
- var_dump(stripos("test string", "G"));
- var_dump(stripos("te".chr(0)."st", chr(0)));
- var_dump(stripos("tEst", "test"));
- var_dump(stripos("teSt", "test"));
- var_dump(stripos("", ""));
- var_dump(stripos("a", ""));
- var_dump(stripos("", "a"));
- var_dump(stripos("a", " "));
- var_dump(stripos("a", "a"));
- var_dump(stripos("", 1));
- var_dump(stripos("", false));
- var_dump(stripos("", true));
- var_dump(stripos("a", 1));
- var_dump(stripos("a", false));
- var_dump(stripos("a", true));
- var_dump(stripos("1", 1));
- var_dump(stripos("0", false));
- var_dump(stripos("1", true));
- var_dump(stripos("\\\\a", "\\a"));
-
- echo "Done\n";
+ var_dump(stripos("test string", "TEST"));
+ var_dump(stripos("test string", "strIng"));
+ var_dump(stripos("test string", "stRin"));
+ var_dump(stripos("test string", "t S"));
+ var_dump(stripos("test string", "G"));
+ var_dump(stripos("te".chr(0)."st", chr(0)));
+ var_dump(stripos("tEst", "test"));
+ var_dump(stripos("teSt", "test"));
+ var_dump(stripos("", ""));
+ var_dump(stripos("a", ""));
+ var_dump(stripos("", "a"));
+ var_dump(stripos("a", " "));
+ var_dump(stripos("a", "a"));
+ var_dump(stripos("", 1));
+ var_dump(stripos("", false));
+ var_dump(stripos("", true));
+ var_dump(stripos("a", 1));
+ var_dump(stripos("a", false));
+ var_dump(stripos("a", true));
+ var_dump(stripos("1", 1));
+ var_dump(stripos("0", false));
+ var_dump(stripos("1", true));
+ var_dump(stripos("\\\\a", "\\a"));
?>
---EXPECTF--
+
+DONE
+--EXPECT--
int(0)
int(5)
int(5)
@@ -37,31 +37,20 @@ int(10)
int(2)
int(0)
int(0)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
+int(0)
int(0)
bool(false)
bool(false)
+int(0)
bool(false)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
+int(0)
bool(false)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
bool(false)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
+int(0)
bool(false)
+int(0)
+int(0)
+int(0)
int(1)
-Done
+
+DONE
diff --git a/ext/standard/tests/strings/stripos_error.phpt b/ext/standard/tests/strings/stripos_error.phpt
index 324014cf6d..caa9329874 100644
--- a/ext/standard/tests/strings/stripos_error.phpt
+++ b/ext/standard/tests/strings/stripos_error.phpt
@@ -8,43 +8,29 @@ Test stripos() function : error conditions
*/
echo "*** Testing stripos() function: error conditions ***\n";
-echo "\n-- With Zero arguments --";
-var_dump( stripos() );
-echo "\n-- With less than expected number of arguments --";
-var_dump( stripos("String") );
+echo "\n-- Offset beyond the end of the string --\n";
+try {
+ stripos("Hello World", "o", 12);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
-echo "\n-- With more than expected number of arguments --";
-var_dump( stripos("string", "String", 1, 'extra_arg') );
-
-echo "\n-- Offset beyond the end of the string --";
-var_dump( stripos("Hello World", "o", 12) );
-
-echo "\n-- Offset before the start of the string --";
-var_dump( stripos("Hello World", "o", -12) );
+echo "\n-- Offset before the start of the string --\n";
+try {
+ stripos("Hello World", "o", -12);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
echo "*** Done ***";
?>
---EXPECTF--
+--EXPECT--
*** Testing stripos() function: error conditions ***
--- With Zero arguments --
-Warning: stripos() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
--- With less than expected number of arguments --
-Warning: stripos() expects at least 2 parameters, 1 given in %s on line %d
-NULL
-
--- With more than expected number of arguments --
-Warning: stripos() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-
-- Offset beyond the end of the string --
-Warning: stripos(): Offset not contained in string in %s on line %d
-bool(false)
+Offset not contained in string
-- Offset before the start of the string --
-Warning: stripos(): Offset not contained in string in %s on line %d
-bool(false)
+Offset not contained in string
*** Done ***
diff --git a/ext/standard/tests/strings/stripos_variation1.phpt b/ext/standard/tests/strings/stripos_variation1.phpt
index a3fc324dd7..c34917ffce 100644
--- a/ext/standard/tests/strings/stripos_variation1.phpt
+++ b/ext/standard/tests/strings/stripos_variation1.phpt
@@ -81,7 +81,7 @@ for($index=0; $index<count($needle); $index++) {
}
echo "*** Done ***";
?>
---EXPECTF--
+--EXPECT--
*** Testing stripos() function: with double quoted strings ***
-- Iteration 1 --
int(2)
@@ -117,36 +117,20 @@ int(9)
int(8)
bool(false)
-- Iteration 12 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-int(8)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(0)
+int(11)
-- Iteration 13 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-int(8)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(0)
+int(12)
-- Iteration 14 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-int(8)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(0)
+int(13)
-- Iteration 15 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-int(8)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(0)
+int(14)
-- Iteration 16 --
-bool(false)
-bool(false)
+int(0)
+int(15)
-- Iteration 17 --
int(10)
int(47)
diff --git a/ext/standard/tests/strings/stripos_variation10.phpt b/ext/standard/tests/strings/stripos_variation10.phpt
index 81b8f5adb1..879da88aa7 100644
--- a/ext/standard/tests/strings/stripos_variation10.phpt
+++ b/ext/standard/tests/strings/stripos_variation10.phpt
@@ -83,7 +83,11 @@ $needles = array (
$counter = 1;
for($index = 0; $index < count($needles); $index ++) {
echo "\n-- Iteration $counter --\n";
- var_dump( stripos($haystack, $needles[$index]) );
+ try {
+ var_dump( stripos($haystack, $needles[$index]) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$counter ++;
}
@@ -91,134 +95,84 @@ fclose($file_handle); //closing the file handle
echo "*** Done ***";
?>
---EXPECTF--
+--EXPECT--
*** Testing stripos() function with unexpected values for needle ***
-- Iteration 1 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(7)
-- Iteration 2 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(9)
-- Iteration 3 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
bool(false)
-- Iteration 4 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
bool(false)
-- Iteration 5 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(16)
-- Iteration 6 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(21)
-- Iteration 7 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
bool(false)
-- Iteration 8 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
bool(false)
-- Iteration 9 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(17)
-- Iteration 10 --
-
-Warning: stripos(): needle is not a string or an integer in %s on line %d
-bool(false)
+stripos() expects parameter 2 to be string, array given
-- Iteration 11 --
-
-Warning: stripos(): needle is not a string or an integer in %s on line %d
-bool(false)
+stripos() expects parameter 2 to be string, array given
-- Iteration 12 --
-
-Warning: stripos(): needle is not a string or an integer in %s on line %d
-bool(false)
+stripos() expects parameter 2 to be string, array given
-- Iteration 13 --
-
-Warning: stripos(): needle is not a string or an integer in %s on line %d
-bool(false)
+stripos() expects parameter 2 to be string, array given
-- Iteration 14 --
-
-Warning: stripos(): needle is not a string or an integer in %s on line %d
-bool(false)
+stripos() expects parameter 2 to be string, array given
-- Iteration 15 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(9)
-- Iteration 16 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(0)
-- Iteration 17 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(9)
-- Iteration 18 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(0)
-- Iteration 19 --
-
-Notice: Object of class sample could not be converted to int in %s on line %d
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(64)
-- Iteration 20 --
-bool(false)
+int(0)
-- Iteration 21 --
-bool(false)
+int(0)
-- Iteration 22 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(0)
-- Iteration 23 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(0)
-- Iteration 24 --
-
-Warning: stripos(): needle is not a string or an integer in %s on line %d
-%s
+stripos() expects parameter 2 to be string, resource given
-- Iteration 25 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(0)
-- Iteration 26 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(0)
*** Done ***
diff --git a/ext/standard/tests/strings/stripos_variation11.phpt b/ext/standard/tests/strings/stripos_variation11.phpt
index b4b83a1641..7a9c9ff9a0 100644
--- a/ext/standard/tests/strings/stripos_variation11.phpt
+++ b/ext/standard/tests/strings/stripos_variation11.phpt
@@ -81,8 +81,16 @@ $counter = 1;
for($index = 0; $index < count($values); $index ++) {
echo "-- Iteration $counter --\n";
$haystack = $values[$index];
- var_dump( stripos($values[$index], $values[$index]) );
- var_dump( stripos($values[$index], $values[$index], 1) );
+ try {
+ var_dump( stripos($values[$index], $values[$index]) );
+ } catch (Error $e) {
+ echo get_class($e) . ": " . $e->getMessage(), "\n";
+ }
+ try {
+ var_dump( stripos($values[$index], $values[$index], 1) );
+ } catch (Error $e) {
+ echo get_class($e) . ": " . $e->getMessage(), "\n";
+ }
$counter ++;
}
@@ -91,173 +99,81 @@ echo "*** Done ***";
--EXPECTF--
*** Testing stripos() function with unexpected values for haystack and needle ***
-- Iteration 1 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
+int(0)
bool(false)
-- Iteration 2 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
+int(0)
bool(false)
-- Iteration 3 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
+int(0)
bool(false)
-- Iteration 4 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
+int(0)
bool(false)
-- Iteration 5 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
+int(0)
bool(false)
-- Iteration 6 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
+int(0)
bool(false)
-- Iteration 7 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
+int(0)
bool(false)
-- Iteration 8 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
+int(0)
bool(false)
-- Iteration 9 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
+int(0)
bool(false)
-- Iteration 10 --
-
-Warning: stripos() expects parameter 1 to be string, array given in %s on line %d
-NULL
-
-Warning: stripos() expects parameter 1 to be string, array given in %s on line %d
-NULL
+TypeError: stripos() expects parameter 1 to be string, array given
+TypeError: stripos() expects parameter 1 to be string, array given
-- Iteration 11 --
-
-Warning: stripos() expects parameter 1 to be string, array given in %s on line %d
-NULL
-
-Warning: stripos() expects parameter 1 to be string, array given in %s on line %d
-NULL
+TypeError: stripos() expects parameter 1 to be string, array given
+TypeError: stripos() expects parameter 1 to be string, array given
-- Iteration 12 --
-
-Warning: stripos() expects parameter 1 to be string, array given in %s on line %d
-NULL
-
-Warning: stripos() expects parameter 1 to be string, array given in %s on line %d
-NULL
+TypeError: stripos() expects parameter 1 to be string, array given
+TypeError: stripos() expects parameter 1 to be string, array given
-- Iteration 13 --
-
-Warning: stripos() expects parameter 1 to be string, array given in %s on line %d
-NULL
-
-Warning: stripos() expects parameter 1 to be string, array given in %s on line %d
-NULL
+TypeError: stripos() expects parameter 1 to be string, array given
+TypeError: stripos() expects parameter 1 to be string, array given
-- Iteration 14 --
-
-Warning: stripos() expects parameter 1 to be string, array given in %s on line %d
-NULL
-
-Warning: stripos() expects parameter 1 to be string, array given in %s on line %d
-NULL
+TypeError: stripos() expects parameter 1 to be string, array given
+TypeError: stripos() expects parameter 1 to be string, array given
-- Iteration 15 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
+int(0)
bool(false)
-- Iteration 16 --
-bool(false)
-
-Warning: stripos(): Offset not contained in string in %s on line %d
-bool(false)
+int(0)
+ValueError: Offset not contained in string
-- Iteration 17 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
+int(0)
bool(false)
-- Iteration 18 --
-bool(false)
-
-Warning: stripos(): Offset not contained in string in %s on line %d
-bool(false)
+int(0)
+ValueError: Offset not contained in string
-- Iteration 19 --
-
-Notice: Object of class sample could not be converted to int in %s on line %d
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
-
-Notice: Object of class sample could not be converted to int in %s on line %d
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
+int(0)
bool(false)
-- Iteration 20 --
-bool(false)
-
-Warning: stripos(): Offset not contained in string in %s on line %d
-bool(false)
+int(0)
+ValueError: Offset not contained in string
-- Iteration 21 --
-bool(false)
-
-Warning: stripos(): Offset not contained in string in %s on line %d
-bool(false)
+int(0)
+ValueError: Offset not contained in string
-- Iteration 22 --
-bool(false)
-
-Warning: stripos(): Offset not contained in string in %s on line %d
-bool(false)
+int(0)
+ValueError: Offset not contained in string
-- Iteration 23 --
-bool(false)
-
-Warning: stripos(): Offset not contained in string in %s on line %d
-bool(false)
+int(0)
+ValueError: Offset not contained in string
-- Iteration 24 --
-
-Warning: stripos() expects parameter 1 to be string, resource given in %s on line %d
-NULL
-
-Warning: stripos() expects parameter 1 to be string, resource given in %s on line %d
-NULL
+TypeError: stripos() expects parameter 1 to be string, resource given
+TypeError: stripos() expects parameter 1 to be string, resource given
-- Iteration 25 --
-bool(false)
-
-Warning: stripos(): Offset not contained in string in %s on line %d
-bool(false)
+int(0)
+ValueError: Offset not contained in string
-- Iteration 26 --
-bool(false)
-
-Warning: stripos(): Offset not contained in string in %s on line %d
-bool(false)
+int(0)
+ValueError: Offset not contained in string
*** Done ***
diff --git a/ext/standard/tests/strings/stripos_variation2.phpt b/ext/standard/tests/strings/stripos_variation2.phpt
index bb77d1becb..294b088d02 100644
--- a/ext/standard/tests/strings/stripos_variation2.phpt
+++ b/ext/standard/tests/strings/stripos_variation2.phpt
@@ -83,7 +83,7 @@ for($index=0; $index<count($needle); $index++) {
}
echo "*** Done ***";
?>
---EXPECTF--
+--EXPECT--
*** Testing stripos() function: with single quoted strings ***
-- Iteration 1 --
int(2)
@@ -119,36 +119,20 @@ bool(false)
int(10)
int(10)
-- Iteration 12 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(0)
+int(11)
-- Iteration 13 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(0)
+int(12)
-- Iteration 14 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(0)
+int(13)
-- Iteration 15 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+int(0)
+int(14)
-- Iteration 16 --
-bool(false)
-bool(false)
+int(0)
+int(15)
-- Iteration 17 --
int(14)
int(51)
@@ -234,11 +218,7 @@ bool(false)
bool(false)
bool(false)
-- Iteration 45 --
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-int(26)
-
-Deprecated: stripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
+bool(false)
bool(false)
-- Iteration 46 --
int(0)
diff --git a/ext/standard/tests/strings/stripos_variation3.phpt b/ext/standard/tests/strings/stripos_variation3.phpt
index 936f870579..32faf63871 100644
--- a/ext/standard/tests/strings/stripos_variation3.phpt
+++ b/ext/standard/tests/strings/stripos_variation3.phpt
@@ -32,6 +32,6 @@ echo "*** Done ***";
int(14)
int(23)
int(23)
-bool(false)
+int(0)
int(7)
*** Done ***
diff --git a/ext/standard/tests/strings/stripos_variation4.phpt b/ext/standard/tests/strings/stripos_variation4.phpt
index 98e2d25c44..f9b43e15ba 100644
--- a/ext/standard/tests/strings/stripos_variation4.phpt
+++ b/ext/standard/tests/strings/stripos_variation4.phpt
@@ -8,7 +8,7 @@ Test stripos() function : usage variations - heredoc string containing special c
*/
/* Test stripos() function by passing heredoc string containing special chars for haystack
- * and with various needles & offets
+ * and with various needles & offsets
*/
echo "*** Testing stripos() function: with heredoc strings ***\n";
diff --git a/ext/standard/tests/strings/stripos_variation7.phpt b/ext/standard/tests/strings/stripos_variation7.phpt
index 04c636365f..d2ac6551db 100644
--- a/ext/standard/tests/strings/stripos_variation7.phpt
+++ b/ext/standard/tests/strings/stripos_variation7.phpt
@@ -16,19 +16,22 @@ echo "-- With empty heredoc string --\n";
$empty_string = <<<EOD
EOD;
var_dump( stripos($empty_string, "") );
-var_dump( stripos($empty_string, "", 1) );
+
+try {
+ stripos($empty_string, "", 1);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
var_dump( stripos($empty_string, FALSE) );
var_dump( stripos($empty_string, NULL) );
echo "*** Done ***";
?>
---EXPECTF--
+--EXPECT--
*** Testing stripos() function: with heredoc strings ***
-- With empty heredoc string --
-bool(false)
-
-Warning: stripos(): Offset not contained in string in %s on line %d
-bool(false)
-bool(false)
-bool(false)
+int(0)
+Offset not contained in string
+int(0)
+int(0)
*** Done ***
diff --git a/ext/standard/tests/strings/stripslashes_variation2.phpt b/ext/standard/tests/strings/stripslashes_variation2.phpt
index e8edf4cd4b..fdca660c4d 100644
--- a/ext/standard/tests/strings/stripslashes_variation2.phpt
+++ b/ext/standard/tests/strings/stripslashes_variation2.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/stripslashes_variation3.phpt b/ext/standard/tests/strings/stripslashes_variation3.phpt
index 61af9db836..54a8b3d02e 100644
--- a/ext/standard/tests/strings/stripslashes_variation3.phpt
+++ b/ext/standard/tests/strings/stripslashes_variation3.phpt
@@ -28,22 +28,22 @@ EOT;
$str_array = array(
// string with newline character
"\n",
- "\\n",
+ "\\n",
"Hello \nworld",
"Hello \\nworld",
'\n',
- '\\n',
+ '\\n',
'Hello \nworld',
'Hello \\nworld',
$heredoc_string_with_newline,
// string with tab character
- "\t",
- "\\t",
+ "\t",
+ "\\t",
"Hello \tworld",
"Hello \\tworld",
- '\t',
- '\\t',
+ '\t',
+ '\\t',
'Hello \tworld',
'Hello \\tworld',
$heredoc_string_with_tab
diff --git a/ext/standard/tests/strings/stristr.phpt b/ext/standard/tests/strings/stristr.phpt
index 8fca54b082..7b1b5312a1 100644
--- a/ext/standard/tests/strings/stristr.phpt
+++ b/ext/standard/tests/strings/stristr.phpt
@@ -2,42 +2,27 @@
stristr() function
--FILE--
<?php
- var_dump(stristr());
- var_dump(stristr(array(), ""));
- var_dump(stristr("", array()));
- var_dump(stristr(array(), array()));
- var_dump(stristr("tEsT sTrInG", "tEsT"));
- var_dump(stristr("tEsT sTrInG", "stRiNg"));
- var_dump(stristr("tEsT sTrInG", "stRiN"));
- var_dump(stristr("tEsT sTrInG", "t S"));
- var_dump(stristr("tEsT sTrInG", "g"));
- var_dump(md5(stristr("te".chr(0)."st", chr(0))));
- var_dump(@stristr("", ""));
- var_dump(@stristr("a", ""));
- var_dump(@stristr("", "a"));
- var_dump(md5(@stristr("\\\\a\\", "\\a")));
- var_dump(stristr("tEsT sTrInG", " "));
+ var_dump(stristr("tEsT sTrInG", "tEsT"));
+ var_dump(stristr("tEsT sTrInG", "stRiNg"));
+ var_dump(stristr("tEsT sTrInG", "stRiN"));
+ var_dump(stristr("tEsT sTrInG", "t S"));
+ var_dump(stristr("tEsT sTrInG", "g"));
+ var_dump(md5(stristr("te".chr(0)."st", chr(0))));
+ var_dump(stristr("", ""));
+ var_dump(stristr("a", ""));
+ var_dump(stristr("", "a"));
+ var_dump(md5(stristr("\\\\a\\", "\\a")));
+ var_dump(stristr("tEsT sTrInG", " "));
?>
--EXPECTF--
-Warning: stristr() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: stristr() expects parameter 1 to be string, array given in %s on line %d
-NULL
-
-Warning: stristr(): needle is not a string or an integer in %s on line %d
-bool(false)
-
-Warning: stristr() expects parameter 1 to be string, array given in %s on line %d
-NULL
string(11) "tEsT sTrInG"
string(6) "sTrInG"
string(6) "sTrInG"
string(8) "T sTrInG"
string(1) "G"
string(32) "7272696018bdeb2c9a3f8d01fc2a9273"
-bool(false)
-bool(false)
+string(0) ""
+string(1) "a"
bool(false)
string(32) "6ec19f52f0766c463f3bb240f4396913"
string(7) " sTrInG"
diff --git a/ext/standard/tests/strings/stristr2.phpt b/ext/standard/tests/strings/stristr2.phpt
index b899b4739d..ae2c8e93cf 100644
--- a/ext/standard/tests/strings/stristr2.phpt
+++ b/ext/standard/tests/strings/stristr2.phpt
@@ -16,14 +16,10 @@ var_dump(stristr($email, 97));
var_dump(stristr($email, 97, 1));
?>
---EXPECTF--
+--EXPECT--
string(7) "cCdEfGh"
string(2) "Ab"
string(5) "eEfGh"
string(4) "AbCd"
-
-Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-string(11) "azAbCdeEfGh"
-
-Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-string(1) "w"
+bool(false)
+bool(false)
diff --git a/ext/standard/tests/strings/stristr_basic.phpt b/ext/standard/tests/strings/stristr_basic.phpt
index 73cbbbe17d..f95f9d2b1e 100644
--- a/ext/standard/tests/strings/stristr_basic.phpt
+++ b/ext/standard/tests/strings/stristr_basic.phpt
@@ -20,7 +20,6 @@ var_dump( stristr("teSt", "test") );
var_dump( stristr("Test String", "String", false) );
var_dump( stristr("Test String", "String", true) );
?>
-===DONE===
--EXPECT--
*** Testing stristr() : basic functionality ***
string(11) "Test string"
@@ -33,4 +32,3 @@ string(4) "tEst"
string(4) "teSt"
string(6) "String"
string(5) "Test "
-===DONE===
diff --git a/ext/standard/tests/strings/stristr_error.phpt b/ext/standard/tests/strings/stristr_error.phpt
deleted file mode 100644
index a0057574f9..0000000000
--- a/ext/standard/tests/strings/stristr_error.phpt
+++ /dev/null
@@ -1,60 +0,0 @@
---TEST--
-Test stristr() function : error conditions
---FILE--
-<?php
-
-/* Prototype: string stristr ( string $haystack , mixed $needle [, bool $before_needle ] )
- Description: Case-insensitive strstr()
-*/
-echo "*** Testing stristr() : error conditions ***\n";
-
-echo "\n-- Testing stristr() function with no arguments --\n";
-var_dump( stristr() );
-var_dump( stristr("") );
-
-echo "\n-- Testing stristr() function with no needle --\n";
-var_dump( stristr("Hello World") ); // without "needle"
-
-echo "\n-- Testing stristr() function with more than expected no. of arguments --\n";
-$extra_arg = 10;
-var_dump( stristr("Hello World", "World", true, $extra_arg) );
-
-echo "\n-- Testing stristr() function with empty haystack --\n";
-var_dump( stristr(NULL, "") );
-
-echo "\n-- Testing stristr() function with empty needle --\n";
-var_dump( stristr("Hello World", "") );
-
-?>
-===DONE===
---EXPECTF--
-*** Testing stristr() : error conditions ***
-
--- Testing stristr() function with no arguments --
-
-Warning: stristr() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: stristr() expects at least 2 parameters, 1 given in %s on line %d
-NULL
-
--- Testing stristr() function with no needle --
-
-Warning: stristr() expects at least 2 parameters, 1 given in %s on line %d
-NULL
-
--- Testing stristr() function with more than expected no. of arguments --
-
-Warning: stristr() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-
--- Testing stristr() function with empty haystack --
-
-Warning: stristr(): Empty needle in %s on line %d
-bool(false)
-
--- Testing stristr() function with empty needle --
-
-Warning: stristr(): Empty needle in %s on line %d
-bool(false)
-===DONE===
diff --git a/ext/standard/tests/strings/stristr_variation2.phpt b/ext/standard/tests/strings/stristr_variation2.phpt
index 4a0b62f261..8448292802 100644
--- a/ext/standard/tests/strings/stristr_variation2.phpt
+++ b/ext/standard/tests/strings/stristr_variation2.phpt
@@ -26,42 +26,42 @@ $file_handle = fopen(__FILE__, "r");
// array with different values for $input
$inputs = array (
- // integer values
+ // integer values
/*1*/ 0,
- 1,
- -2,
- -PHP_INT_MAX,
+ 1,
+ -2,
+ -PHP_INT_MAX,
- // float values
+ // float values
/*5*/ 10.5,
- -20.5,
- 10.1234567e10,
+ -20.5,
+ 10.1234567e10,
- // array values
+ // array values
/*8*/ array(),
- array(0),
- array(1, 2),
+ array(0),
+ array(1, 2),
- // boolean values
+ // boolean values
/*11*/ true,
- false,
- TRUE,
- FALSE,
+ false,
+ TRUE,
+ FALSE,
- // null values
+ // null values
/*15*/ NULL,
- null,
+ null,
- // objects
+ // objects
/*17*/ new sample(),
- // resource
+ // resource
/*18*/ $file_handle,
- // undefined variable
+ // undefined variable
/*19*/ @$undefined_var,
- // unset variable
+ // unset variable
/*20*/ @$unset_var
);
@@ -72,96 +72,56 @@ $pad_length = "20";
$count = 1;
foreach($inputs as $input) {
echo "-- Iteration $count --\n";
- var_dump( stristr("Hello World", $input) );
+ try {
+ var_dump( stristr("Hello World", $input) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$count ++;
}
fclose($file_handle); //closing the file handle
?>
-===DONE===
---EXPECTF--
+--EXPECT--
*** Testing stristr() function: with unexpected inputs for 'needle' argument ***
-- Iteration 1 --
-
-Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
bool(false)
-- Iteration 2 --
-
-Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
bool(false)
-- Iteration 3 --
-
-Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
bool(false)
-- Iteration 4 --
-
-Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
bool(false)
-- Iteration 5 --
-
-Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
bool(false)
-- Iteration 6 --
-
-Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
bool(false)
-- Iteration 7 --
-
-Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
bool(false)
-- Iteration 8 --
-
-Warning: stristr(): needle is not a string or an integer in %s on line %d
-bool(false)
+stristr() expects parameter 2 to be string, array given
-- Iteration 9 --
-
-Warning: stristr(): needle is not a string or an integer in %s on line %d
-bool(false)
+stristr() expects parameter 2 to be string, array given
-- Iteration 10 --
-
-Warning: stristr(): needle is not a string or an integer in %s on line %d
-bool(false)
+stristr() expects parameter 2 to be string, array given
-- Iteration 11 --
-
-Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
bool(false)
-- Iteration 12 --
-
-Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+string(11) "Hello World"
-- Iteration 13 --
-
-Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
bool(false)
-- Iteration 14 --
-
-Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+string(11) "Hello World"
-- Iteration 15 --
-
-Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+string(11) "Hello World"
-- Iteration 16 --
-
-Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+string(11) "Hello World"
-- Iteration 17 --
-
-Notice: Object of class sample could not be converted to int in %s on line %d
-
-Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
bool(false)
-- Iteration 18 --
-
-Warning: stristr(): needle is not a string or an integer in %s on line %d
-bool(false)
+stristr() expects parameter 2 to be string, resource given
-- Iteration 19 --
-
-Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
+string(11) "Hello World"
-- Iteration 20 --
-
-Deprecated: stristr(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
-===DONE===
+string(11) "Hello World"
diff --git a/ext/standard/tests/strings/strlen.phpt b/ext/standard/tests/strings/strlen.phpt
index a546bdb8d2..6be163d8fe 100644
--- a/ext/standard/tests/strings/strlen.phpt
+++ b/ext/standard/tests/strings/strlen.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strlen_basic.phpt b/ext/standard/tests/strings/strlen_basic.phpt
index 721e4f1d26..fce6d70da0 100644
--- a/ext/standard/tests/strings/strlen_basic.phpt
+++ b/ext/standard/tests/strings/strlen_basic.phpt
@@ -14,11 +14,9 @@ var_dump(strlen(" ab de "));
var_dump(strlen(""));
var_dump(strlen("\x90\x91\x00\x93\x94\x90\x91\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"));
?>
-===DONE===
--EXPECT--
*** Testing strlen() : basic functionality ***
int(6)
int(7)
int(0)
int(18)
-===DONE===
diff --git a/ext/standard/tests/strings/strnatcasecmp_basic.phpt b/ext/standard/tests/strings/strnatcasecmp_basic.phpt
index 5b58e2331e..5968980642 100644
--- a/ext/standard/tests/strings/strnatcasecmp_basic.phpt
+++ b/ext/standard/tests/strings/strnatcasecmp_basic.phpt
@@ -11,7 +11,7 @@ Felix De Vliegher <felix.devliegher@gmail.com>
*/
function str_dump($one, $two) {
- var_dump(strnatcasecmp($one, $two));
+ var_dump(strnatcasecmp($one, $two));
}
echo "*** Testing strnatcasecmp() : basic functionality ***\n";
@@ -32,7 +32,6 @@ str_dump('pIc 6', 'pic 7');
str_dump(0xFFF, 0Xfff);
?>
-===DONE===
--EXPECT--
*** Testing strnatcasecmp() : basic functionality ***
int(0)
@@ -48,4 +47,3 @@ int(-1)
int(0)
int(-1)
int(0)
-===DONE===
diff --git a/ext/standard/tests/strings/strnatcasecmp_variation1.phpt b/ext/standard/tests/strings/strnatcasecmp_variation1.phpt
index ac2cbb69f9..44d2a09c5a 100644
--- a/ext/standard/tests/strings/strnatcasecmp_variation1.phpt
+++ b/ext/standard/tests/strings/strnatcasecmp_variation1.phpt
@@ -13,25 +13,25 @@ Felix De Vliegher <felix.devliegher@gmail.com>
/* Preparation */
class a
{
- function __toString()
- {
- return "Hello WORLD";
- }
+ function __toString()
+ {
+ return "Hello WORLD";
+ }
}
class b
{
- function __toString()
- {
- return "HELLO world";
- }
+ function __toString()
+ {
+ return "HELLO world";
+ }
}
$a = new a();
$b = new b();
function str_dump($a, $b) {
- var_dump(strnatcasecmp($a, $b));
+ var_dump(strnatcasecmp($a, $b));
}
echo "*** Testing strnatcasecmp() : variation ***\n";
@@ -44,7 +44,6 @@ str_dump("\x0", "\0");
str_dump($a, $b);
?>
-===DONE===
--EXPECT--
*** Testing strnatcasecmp() : variation ***
int(1)
@@ -53,4 +52,3 @@ int(-1)
int(-1)
int(0)
int(0)
-===DONE===
diff --git a/ext/standard/tests/strings/strnatcmp_basic.phpt b/ext/standard/tests/strings/strnatcmp_basic.phpt
index 734e5f57da..8f303e7395 100644
--- a/ext/standard/tests/strings/strnatcmp_basic.phpt
+++ b/ext/standard/tests/strings/strnatcmp_basic.phpt
@@ -49,7 +49,6 @@ var_dump(strnatcmp($d1, $a2));
var_dump(strnatcmp($c1, $b2));
var_dump(strnatcmp($c1, $d2));
?>
-===DONE===
--EXPECT--
*** Testing strnatcmp() : basic functionality ***
Less than tests
@@ -77,4 +76,3 @@ int(1)
int(1)
int(1)
int(1)
-===DONE===
diff --git a/ext/standard/tests/strings/strncasecmp_error.phpt b/ext/standard/tests/strings/strncasecmp_error.phpt
index d443f8113b..00ddfaed9b 100644
--- a/ext/standard/tests/strings/strncasecmp_error.phpt
+++ b/ext/standard/tests/strings/strncasecmp_error.phpt
@@ -10,18 +10,6 @@ Test strncasecmp() function : error conditions
echo "*** Testing strncasecmp() function: error conditions ***\n";
$str1 = 'string_val';
$str2 = 'string_val';
-$len = 10;
-$extra_arg = 10;
-
-echo "\n-- Testing strncasecmp() function with Zero arguments --";
-var_dump( strncasecmp() );
-
-echo "\n-- Testing strncasecmp() function with less than expected number of arguments --";
-var_dump( strncasecmp($str1) );
-var_dump( strncasecmp($str1, $str2) );
-
-echo "\n-- Testing strncasecmp() function with more than expected number of arguments --";
-var_dump( strncasecmp($str1, $str2, $len, $extra_arg) );
echo "\n-- Testing strncasecmp() function with invalid argument --";
$len = -10;
@@ -31,21 +19,6 @@ echo "*** Done ***\n";
--EXPECTF--
*** Testing strncasecmp() function: error conditions ***
--- Testing strncasecmp() function with Zero arguments --
-Warning: strncasecmp() expects exactly 3 parameters, 0 given in %s on line %d
-NULL
-
--- Testing strncasecmp() function with less than expected number of arguments --
-Warning: strncasecmp() expects exactly 3 parameters, 1 given in %s on line %d
-NULL
-
-Warning: strncasecmp() expects exactly 3 parameters, 2 given in %s on line %d
-NULL
-
--- Testing strncasecmp() function with more than expected number of arguments --
-Warning: strncasecmp() expects exactly 3 parameters, 4 given in %s on line %d
-NULL
-
-- Testing strncasecmp() function with invalid argument --
Warning: Length must be greater than or equal to 0 in %s on line %d
bool(false)
diff --git a/ext/standard/tests/strings/strncasecmp_variation9.phpt b/ext/standard/tests/strings/strncasecmp_variation9.phpt
index 9841bb4e47..caa2deccf2 100644
--- a/ext/standard/tests/strings/strncasecmp_variation9.phpt
+++ b/ext/standard/tests/strings/strncasecmp_variation9.phpt
@@ -22,7 +22,7 @@ EOD;
$identifier_str1 = <<<identifier_str1
Example of heredoc
string, whose identifier
-having underscore("_")
+having underscore("_")
& numeric value.
identifier_str1;
@@ -78,7 +78,7 @@ echo "*** Done ***\n";
int(0)
int(63)
int(0)
-int(84)
+int(83)
int(0)
int(-1)
int(0)
diff --git a/ext/standard/tests/strings/strncmp_error.phpt b/ext/standard/tests/strings/strncmp_error.phpt
index 4eb73eb318..13a4cb0350 100644
--- a/ext/standard/tests/strings/strncmp_error.phpt
+++ b/ext/standard/tests/strings/strncmp_error.phpt
@@ -12,13 +12,6 @@ Test strncmp() function : error conditions
echo "*** Testing strncmp() function: error conditions ***\n";
$str1 = 'string_val';
$str2 = 'string_val';
-$len = 10;
-$extra_arg = 10;
-
-var_dump( strncmp() ); //Zero argument
-var_dump( strncmp($str1) ); //One argument, less than expected no. of args
-var_dump( strncmp($str1, $str2) ); //Two arguments, less than expected no. of args
-var_dump( strncmp($str1, $str2, $len, $extra_arg) ); //Four arguments, greater than expected no. of args
/* Invalid argument for $len */
$len = -10;
@@ -28,18 +21,6 @@ echo "*** Done ***\n";
--EXPECTF--
*** Testing strncmp() function: error conditions ***
-Warning: strncmp() expects exactly 3 parameters, 0 given in %s on line %d
-NULL
-
-Warning: strncmp() expects exactly 3 parameters, 1 given in %s on line %d
-NULL
-
-Warning: strncmp() expects exactly 3 parameters, 2 given in %s on line %d
-NULL
-
-Warning: strncmp() expects exactly 3 parameters, 4 given in %s on line %d
-NULL
-
Warning: Length must be greater than or equal to 0 in %s on line %d
bool(false)
*** Done ***
diff --git a/ext/standard/tests/strings/strpbrk_basic.phpt b/ext/standard/tests/strings/strpbrk_basic.phpt
index 9a92b8b4b5..f5a0306eaf 100644
--- a/ext/standard/tests/strings/strpbrk_basic.phpt
+++ b/ext/standard/tests/strings/strpbrk_basic.phpt
@@ -27,7 +27,6 @@ var_dump( strpbrk(5, 5) );
var_dump( strpbrk(5, "5") );
?>
-===DONE===
--EXPECT--
*** Testing strpbrk() : basic functionality ***
string(20) "is is a Simple text."
@@ -38,4 +37,3 @@ bool(false)
string(12) " aaa aaaSLR"
string(1) "5"
string(1) "5"
-===DONE===
diff --git a/ext/standard/tests/strings/strpbrk_error.phpt b/ext/standard/tests/strings/strpbrk_error.phpt
index 658e2f429e..93f1ac4295 100644
--- a/ext/standard/tests/strings/strpbrk_error.phpt
+++ b/ext/standard/tests/strings/strpbrk_error.phpt
@@ -8,50 +8,16 @@ Test strpbrk() function : error conditions
* Alias to functions:
*/
-echo "*** Testing strpbrk() : error conditions ***\n";
-
$haystack = 'This is a Simple text.';
-$char_list = 'string_val';
-$extra_arg = 10;
-
-echo "\n-- Testing strpbrk() function with more than expected no. of arguments --\n";
-var_dump( strpbrk($haystack, $char_list, $extra_arg) );
-
-echo "\n-- Testing strpbrk() function with less than expected no. of arguments --\n";
-var_dump( strpbrk($haystack) );
-
-echo "\n-- Testing strpbrk() function with empty second argument --\n";
-var_dump( strpbrk($haystack, '') );
-echo "\n-- Testing strpbrk() function with arrays --\n";
-var_dump( strpbrk($haystack, array('a', 'b', 'c') ) );
-var_dump( strpbrk(array('foo', 'bar'), 'b') );
+echo "-- Testing strpbrk() function with empty second argument --\n";
+try {
+ strpbrk($haystack, '');
+} catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+}
?>
-===DONE===
---EXPECTF--
-*** Testing strpbrk() : error conditions ***
-
--- Testing strpbrk() function with more than expected no. of arguments --
-
-Warning: strpbrk() expects exactly 2 parameters, 3 given in %s on line %d
-bool(false)
-
--- Testing strpbrk() function with less than expected no. of arguments --
-
-Warning: strpbrk() expects exactly 2 parameters, 1 given in %s on line %d
-bool(false)
-
+--EXPECT--
-- Testing strpbrk() function with empty second argument --
-
-Warning: strpbrk(): The character list cannot be empty in %s on line %d
-bool(false)
-
--- Testing strpbrk() function with arrays --
-
-Warning: strpbrk() expects parameter 2 to be string, array given in %s on line %d
-bool(false)
-
-Warning: strpbrk() expects parameter 1 to be string, array given in %s on line %d
-bool(false)
-===DONE===
+The character list cannot be empty
diff --git a/ext/standard/tests/strings/strpos.phpt b/ext/standard/tests/strings/strpos.phpt
index 578539804d..27b87cb99a 100644
--- a/ext/standard/tests/strings/strpos.phpt
+++ b/ext/standard/tests/strings/strpos.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strpos_number.phpt b/ext/standard/tests/strings/strpos_number.phpt
index fd045c64d3..76cf8e59ef 100644
--- a/ext/standard/tests/strings/strpos_number.phpt
+++ b/ext/standard/tests/strings/strpos_number.phpt
@@ -9,10 +9,7 @@ var_dump(strpos("foo bar", 111));
// string("11") is contained
var_dump(strpos("foo 11", "11"));
?>
---EXPECTF--
-Deprecated: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
+--EXPECT--
+int(4)
bool(false)
-
-Deprecated: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-int(1)
int(4)
diff --git a/ext/standard/tests/strings/strpos_variation1.phpt b/ext/standard/tests/strings/strpos_variation1.phpt
new file mode 100644
index 0000000000..f28517316d
--- /dev/null
+++ b/ext/standard/tests/strings/strpos_variation1.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Test strpos() function : usage variations - complex strings containing other than 7-bit chars
+--FILE--
+<?php
+$string = chr(0).chr(128).chr(129).chr(234).chr(235).chr(254).chr(255);
+$stringAsHex = bin2hex($string);
+echo "-- Positions of some chars in the string '$stringAsHex' are as follows --\n";
+echo bin2hex( chr(128) ) ." => ";
+var_dump( strpos($string, chr(128)) );
+echo bin2hex( chr(255) ) ." => ";
+var_dump( strpos($string, chr(255), 3) );
+echo bin2hex( chr(256) ) ." => ";
+var_dump( strpos($string, chr(256)) );
+?>
+
+DONE
+--EXPECT--
+-- Positions of some chars in the string '008081eaebfeff' are as follows --
+80 => int(1)
+ff => int(6)
+00 => int(0)
+
+DONE
diff --git a/ext/standard/tests/strings/strrchr_variation1.phpt b/ext/standard/tests/strings/strrchr_variation1.phpt
index 5043128945..a75dd96bbf 100644
--- a/ext/standard/tests/strings/strrchr_variation1.phpt
+++ b/ext/standard/tests/strings/strrchr_variation1.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strrchr_variation10.phpt b/ext/standard/tests/strings/strrchr_variation10.phpt
index 3b06b20be1..1004a3d915 100644
--- a/ext/standard/tests/strings/strrchr_variation10.phpt
+++ b/ext/standard/tests/strings/strrchr_variation10.phpt
@@ -121,7 +121,11 @@ $needles = array (
$count = 1;
for($index = 0; $index < count($haystacks); $index++) {
echo "-- Iteration $count --\n";
- var_dump( strrchr($haystacks[$index], $needles[$index]) );
+ try {
+ var_dump( strrchr($haystacks[$index], $needles[$index]) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$count ++;
}
@@ -129,108 +133,58 @@ fclose($file_handle); //closing the file handle
echo "*** Done ***";
?>
---EXPECTF--
+--EXPECT--
*** Testing strrchr() function with unexpected inputs for needle ***
-- Iteration 1 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+string(1) "0"
-- Iteration 2 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+string(1) "1"
-- Iteration 3 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 4 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+string(2) "-2"
-- Iteration 5 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+string(4) "10.5"
-- Iteration 6 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+string(5) "-10.5"
-- Iteration 7 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+string(2) "10"
-- Iteration 8 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+string(2) "10"
-- Iteration 9 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 10 --
-
-Warning: strrchr(): needle is not a string or an integer in %s on line %d
-bool(false)
+strrchr() expects parameter 2 to be string, array given
-- Iteration 11 --
-
-Warning: strrchr(): needle is not a string or an integer in %s on line %d
-bool(false)
+strrchr() expects parameter 2 to be string, array given
-- Iteration 12 --
-
-Warning: strrchr(): needle is not a string or an integer in %s on line %d
-bool(false)
+strrchr() expects parameter 2 to be string, array given
-- Iteration 13 --
-
-Warning: strrchr(): needle is not a string or an integer in %s on line %d
-bool(false)
+strrchr() expects parameter 2 to be string, array given
-- Iteration 14 --
-
-Warning: strrchr(): needle is not a string or an integer in %s on line %d
-bool(false)
+strrchr() expects parameter 2 to be string, array given
-- Iteration 15 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 16 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 17 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 18 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 19 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 20 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 21 --
-
-Notice: Object of class sample could not be converted to int in %s on line %d
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+string(6) "object"
-- Iteration 22 --
bool(false)
-- Iteration 23 --
bool(false)
-- Iteration 24 --
-
-Warning: strrchr(): needle is not a string or an integer in %s on line %d
-bool(false)
+strrchr() expects parameter 2 to be string, resource given
-- Iteration 25 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 26 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
*** Done ***
diff --git a/ext/standard/tests/strings/strrchr_variation11.phpt b/ext/standard/tests/strings/strrchr_variation11.phpt
index 108ba2e0f2..79ffe4c2ec 100644
--- a/ext/standard/tests/strings/strrchr_variation11.phpt
+++ b/ext/standard/tests/strings/strrchr_variation11.phpt
@@ -80,7 +80,11 @@ $values = array (
$counter = 1;
for($index = 0; $index < count($values); $index ++) {
echo "-- Iteration $counter --\n";
- var_dump( strrchr($values[$index], $values[$index]) );
+ try {
+ var_dump( strrchr($values[$index], $values[$index]) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$counter ++;
}
@@ -88,108 +92,58 @@ fclose($file_handle); //closing the file handle
echo "*** Done ***";
?>
---EXPECTF--
+--EXPECT--
*** Testing strrchr() function: with unexpected inputs for haystack and needle ***
-- Iteration 1 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+string(1) "0"
-- Iteration 2 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+string(1) "1"
-- Iteration 3 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+string(5) "12345"
-- Iteration 4 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+string(5) "-2345"
-- Iteration 5 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+string(4) "10.5"
-- Iteration 6 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+string(5) "-10.5"
-- Iteration 7 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+string(10) "1234567000"
-- Iteration 8 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+string(4) "1E-9"
-- Iteration 9 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+string(3) "0.5"
-- Iteration 10 --
-
-Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d
-NULL
+strrchr() expects parameter 1 to be string, array given
-- Iteration 11 --
-
-Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d
-NULL
+strrchr() expects parameter 1 to be string, array given
-- Iteration 12 --
-
-Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d
-NULL
+strrchr() expects parameter 1 to be string, array given
-- Iteration 13 --
-
-Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d
-NULL
+strrchr() expects parameter 1 to be string, array given
-- Iteration 14 --
-
-Warning: strrchr() expects parameter 1 to be string, array given in %s on line %d
-NULL
+strrchr() expects parameter 1 to be string, array given
-- Iteration 15 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+string(1) "1"
-- Iteration 16 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 17 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+string(1) "1"
-- Iteration 18 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 19 --
-
-Notice: Object of class sample could not be converted to int in %s on line %d
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+string(6) "object"
-- Iteration 20 --
bool(false)
-- Iteration 21 --
bool(false)
-- Iteration 22 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 23 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 24 --
-
-Warning: strrchr() expects parameter 1 to be string, resource given in %s on line %d
-NULL
+strrchr() expects parameter 1 to be string, resource given
-- Iteration 25 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 26 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
*** Done ***
diff --git a/ext/standard/tests/strings/strrchr_variation12.phpt b/ext/standard/tests/strings/strrchr_variation12.phpt
index 730811ea47..a17902604a 100644
--- a/ext/standard/tests/strings/strrchr_variation12.phpt
+++ b/ext/standard/tests/strings/strrchr_variation12.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strrchr_variation2.phpt b/ext/standard/tests/strings/strrchr_variation2.phpt
index ddce2c2ccb..2ff6720fb9 100644
--- a/ext/standard/tests/strings/strrchr_variation2.phpt
+++ b/ext/standard/tests/strings/strrchr_variation2.phpt
@@ -117,23 +117,15 @@ bool(false)
string(5) "\101 "
-- Iteration 12 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 13 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 14 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 15 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 16 --
@@ -221,9 +213,7 @@ bool(false)
string(7) "4 \101 "
-- Iteration 44 --
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
-string(37) "*+-./:;<=>?@hello123456he \x234 \101 "
+string(7) "4 \101 "
-- Iteration 45 --
string(63) "Hello,\t\n\0\n $&!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 "
diff --git a/ext/standard/tests/strings/strrchr_variation8.phpt b/ext/standard/tests/strings/strrchr_variation8.phpt
index 6b49b698f4..31a727ed6f 100644
--- a/ext/standard/tests/strings/strrchr_variation8.phpt
+++ b/ext/standard/tests/strings/strrchr_variation8.phpt
@@ -30,15 +30,11 @@ foreach($needles as $needle) {
}
echo "*** Done ***";
?>
---EXPECTF--
+--EXPECT--
*** Testing strrchr() function: with heredoc strings ***
bool(false)
bool(false)
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-
-Deprecated: strrchr(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
bool(false)
bool(false)
diff --git a/ext/standard/tests/strings/strrev.phpt b/ext/standard/tests/strings/strrev.phpt
index 92c66817d9..6303fccc20 100644
--- a/ext/standard/tests/strings/strrev.phpt
+++ b/ext/standard/tests/strings/strrev.phpt
@@ -2,16 +2,16 @@
strrev() function
--FILE--
<?php
- $i = 0;
- $str = '';
+ $i = 0;
+ $str = '';
- while ($i<256) {
- $str .= chr($i++);
- }
+ while ($i<256) {
+ $str .= chr($i++);
+ }
- var_dump(md5(strrev($str)));
- var_dump(strrev(NULL));
- var_dump(strrev(""));
+ var_dump(md5(strrev($str)));
+ var_dump(strrev(NULL));
+ var_dump(strrev(""));
?>
--EXPECT--
string(32) "ec6df70f2569891eae50321a9179eb82"
diff --git a/ext/standard/tests/strings/strripos.phpt b/ext/standard/tests/strings/strripos.phpt
index 291ff78cd7..81881c3796 100644
--- a/ext/standard/tests/strings/strripos.phpt
+++ b/ext/standard/tests/strings/strripos.phpt
@@ -2,22 +2,19 @@
strripos() function
--FILE--
<?php
- var_dump(strripos("test test string", "test"));
- var_dump(strripos("test string sTring", "string"));
- var_dump(strripos("test strip string strand", "str"));
- var_dump(strripos("I am what I am and that's all what I am", "am", -3));
- var_dump(strripos("test string", "g"));
- var_dump(strripos("te".chr(0)."st", chr(0)));
- var_dump(strripos("tEst", "test"));
- var_dump(strripos("teSt", "test"));
- var_dump(@strripos("foo", "f", 1));
- var_dump(@strripos("", ""));
- var_dump(@strripos("a", ""));
- var_dump(@strripos("", "a"));
- var_dump(@strripos("\\\\a", "\\a"));
-
- $fp = fopen(__FILE__, "r");
- var_dump(@strripos("", $fp));
+ var_dump(strripos("test test string", "test"));
+ var_dump(strripos("test string sTring", "string"));
+ var_dump(strripos("test strip string strand", "str"));
+ var_dump(strripos("I am what I am and that's all what I am", "am", -3));
+ var_dump(strripos("test string", "g"));
+ var_dump(strripos("te".chr(0)."st", chr(0)));
+ var_dump(strripos("tEst", "test"));
+ var_dump(strripos("teSt", "test"));
+ var_dump(strripos("foo", "f", 1));
+ var_dump(strripos("", ""));
+ var_dump(strripos("a", ""));
+ var_dump(strripos("", "a"));
+ var_dump(strripos("\\\\a", "\\a"));
?>
--EXPECT--
int(5)
@@ -29,8 +26,7 @@ int(2)
int(0)
int(0)
bool(false)
-bool(false)
-bool(false)
-bool(false)
+int(0)
int(1)
bool(false)
+int(1)
diff --git a/ext/standard/tests/strings/strripos_basic1.phpt b/ext/standard/tests/strings/strripos_basic1.phpt
index 70bbdf94e5..4f8f8e8451 100644
--- a/ext/standard/tests/strings/strripos_basic1.phpt
+++ b/ext/standard/tests/strings/strripos_basic1.phpt
@@ -29,7 +29,6 @@ var_dump( strripos($heredoc_str, 'HelLO') );
var_dump( strripos($heredoc_str, $heredoc_str) );
?>
-===DONE===
--EXPECT--
*** Testing strripos() function: basic functionality ***
@@ -48,4 +47,3 @@ int(5)
int(0)
int(0)
int(0)
-===DONE===
diff --git a/ext/standard/tests/strings/strripos_basic2.phpt b/ext/standard/tests/strings/strripos_basic2.phpt
index 72d02d5c80..e13a8e5747 100644
--- a/ext/standard/tests/strings/strripos_basic2.phpt
+++ b/ext/standard/tests/strings/strripos_basic2.phpt
@@ -35,7 +35,6 @@ var_dump( strripos("Hello, World", "O", -1) );
var_dump( strripos("Hello, World", "O", -5) );
var_dump( strripos("Hello, World", "O", -9) );
?>
-===DONE===
--EXPECT--
*** Testing strripos() function: basic functionality ***
@@ -61,4 +60,3 @@ bool(false)
int(8)
int(4)
bool(false)
-===DONE===
diff --git a/ext/standard/tests/strings/strripos_offset.phpt b/ext/standard/tests/strings/strripos_offset.phpt
index 70a9534ebd..4f4ab2bea4 100644
--- a/ext/standard/tests/strings/strripos_offset.phpt
+++ b/ext/standard/tests/strings/strripos_offset.phpt
@@ -3,47 +3,42 @@ strripos() offset integer overflow
--FILE--
<?php
-var_dump(strripos("t", "t", PHP_INT_MAX+1));
-var_dump(strripos("tttt", "tt", PHP_INT_MAX+1));
-var_dump(strripos(100, 101, PHP_INT_MAX+1));
-var_dump(strripos(1024, 1024, PHP_INT_MAX+1));
-var_dump(strripos(array(), array(), PHP_INT_MAX+1));
-var_dump(strripos(1024, 1024, -PHP_INT_MAX));
-var_dump(strripos(1024, "te", -PHP_INT_MAX));
-var_dump(strripos(1024, 1024, -PHP_INT_MAX-1));
-var_dump(strripos(1024, "te", -PHP_INT_MAX-1));
+try {
+ var_dump(strripos("t", "t", PHP_INT_MAX+1));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+
+try {
+ strripos(1024, 1024, -PHP_INT_MAX);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+try {
+ strripos(1024, "te", -PHP_INT_MAX);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+try {
+ strripos(1024, 1024, -PHP_INT_MAX-1);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+try {
+ strripos(1024, "te", -PHP_INT_MAX-1);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
echo "Done\n";
?>
---EXPECTF--
-Warning: strripos() expects parameter 3 to be int, float given in %s on line %d
-bool(false)
-
-Warning: strripos() expects parameter 3 to be int, float given in %s on line %d
-bool(false)
-
-Warning: strripos() expects parameter 3 to be int, float given in %s on line %d
-bool(false)
-
-Warning: strripos() expects parameter 3 to be int, float given in %s on line %d
-bool(false)
-
-Warning: strripos() expects parameter 1 to be string, array given in %s on line %d
-bool(false)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-
-Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d
-bool(false)
-
-Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d
-bool(false)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-
-Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d
-bool(false)
-
-Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d
-bool(false)
+--EXPECT--
+strripos() expects parameter 3 to be int, float given
+Offset not contained in string
+Offset not contained in string
+Offset not contained in string
+Offset not contained in string
Done
diff --git a/ext/standard/tests/strings/strripos_variation1.phpt b/ext/standard/tests/strings/strripos_variation1.phpt
index 59d7a64686..d8188bdd87 100644
--- a/ext/standard/tests/strings/strripos_variation1.phpt
+++ b/ext/standard/tests/strings/strripos_variation1.phpt
@@ -12,54 +12,54 @@ Test strripos() function : usage variations - double quoted strings for 'haystac
echo "*** Testing strripos() function: with double quoted strings ***\n";
$haystack = "Hello,\t\n\0\n $&!#%()*<=>?@hello123456he \x234 \101 ";
$needles = array(
- //regular strings
+ //regular strings
/*1*/ "l",
- "L",
- "HELLO",
- "hEllo",
+ "L",
+ "HELLO",
+ "hEllo",
- //escape characters
+ //escape characters
/*5*/ "\t",
- "\T", //invalid input
- " ",
- "\n",
- "\N", //invalid input
- "
+ "\T", //invalid input
+ " ",
+ "\n",
+ "\N", //invalid input
+ "
", //new line
- //nulls
+ //nulls
/*11*/ "\0",
- NULL,
- null,
+ NULL,
+ null,
- //boolean false
+ //boolean false
/*14*/ FALSE,
- false,
+ false,
- //empty string
+ //empty string
/*16*/ "",
- //special chars
+ //special chars
/*17*/ " ",
- "$",
- " $",
- "&",
- "!#",
- "()",
- "<=>",
- ">",
- "=>",
- "?",
- "@",
- "@hEllo",
+ "$",
+ " $",
+ "&",
+ "!#",
+ "()",
+ "<=>",
+ ">",
+ "=>",
+ "?",
+ "@",
+ "@hEllo",
/*29*/ "12345", //decimal numeric string
- "\x23", //hexadecimal numeric string
- "#", //respective ASCII char of \x23
- "\101", //octal numeric string
- "A", //respective ASCII char of \101
- "456HEE", //numerics + chars
- $haystack //haystack as needle
+ "\x23", //hexadecimal numeric string
+ "#", //respective ASCII char of \x23
+ "\101", //octal numeric string
+ "A", //respective ASCII char of \101
+ "456HEE", //numerics + chars
+ $haystack //haystack as needle
);
/* loop through to get the position of the needle in haystack string */
@@ -73,8 +73,7 @@ foreach ($needles as $needle) {
$count++;
}
?>
-===DONE===
---EXPECTF--
+--EXPECT--
*** Testing strripos() function: with double quoted strings ***
-- Iteration 1 --
int(28)
@@ -132,62 +131,30 @@ int(8)
bool(false)
int(8)
-- Iteration 12 --
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-int(8)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-int(8)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-int(8)
+int(44)
+int(44)
+int(44)
+int(43)
-- Iteration 13 --
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-int(8)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-int(8)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-int(8)
+int(44)
+int(44)
+int(44)
+int(43)
-- Iteration 14 --
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-int(8)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-int(8)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-int(8)
+int(44)
+int(44)
+int(44)
+int(43)
-- Iteration 15 --
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-int(8)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-int(8)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-int(8)
+int(44)
+int(44)
+int(44)
+int(43)
-- Iteration 16 --
-bool(false)
-bool(false)
-bool(false)
-bool(false)
+int(44)
+int(44)
+int(44)
+int(43)
-- Iteration 17 --
int(43)
int(43)
@@ -283,4 +250,3 @@ int(0)
bool(false)
bool(false)
int(0)
-===DONE===
diff --git a/ext/standard/tests/strings/strripos_variation2.phpt b/ext/standard/tests/strings/strripos_variation2.phpt
index 7b47b787be..55753c5c9b 100644
--- a/ext/standard/tests/strings/strripos_variation2.phpt
+++ b/ext/standard/tests/strings/strripos_variation2.phpt
@@ -12,55 +12,55 @@ Test strripos() function : usage variations - single quoted strings for 'haystac
echo "*** Testing strripos() function: with single quoted strings ***\n";
$haystack = 'Hello,\t\n\0\n $&!#%()*<=>?@hello123456he \x234 \101 ';
$needles = array(
- //regular strings
+ //regular strings
/*1*/ 'l',
- 'L',
- 'HELLO',
- 'hEllo',
+ 'L',
+ 'HELLO',
+ 'hEllo',
- //escape characters
+ //escape characters
/*5*/ '\t',
- '\T',
- ' ',
- '\n',
- '\N',
- '
- ', //new line
+ '\T',
+ ' ',
+ '\n',
+ '\N',
+ '
+ ', //new line
- //nulls
+ //nulls
/*11*/ '\0',
- NULL,
- null,
+ NULL,
+ null,
- //boolean false
+ //boolean false
/*14*/ FALSE,
- false,
+ false,
- //empty string
+ //empty string
/*16*/ '',
- //special chars
+ //special chars
/*17*/ ' ',
- '$',
- ' $',
- '&',
- '!#',
- '()',
- '<=>',
- '>',
- '=>',
- '?',
- '@',
- '@hEllo',
+ '$',
+ ' $',
+ '&',
+ '!#',
+ '()',
+ '<=>',
+ '>',
+ '=>',
+ '?',
+ '@',
+ '@hEllo',
/*29*/ '12345', //decimal numeric string
- '\x23', //hexadecimal numeric string
- '#', //respective ASCII char of \x23
- '\101', //octal numeric string
- 'A', // respective ASCII char for \101
- '456HEE', //numerics + chars
- 42, //needle as int(ASCII value of '*')
- $haystack //haystack as needle
+ '\x23', //hexadecimal numeric string
+ '#', //respective ASCII char of \x23
+ '\101', //octal numeric string
+ 'A', // respective ASCII char for \101
+ '456HEE', //numerics + chars
+ 42, //needle as int(ASCII value of '*')
+ $haystack //haystack as needle
);
/* loop through to get the position of the needle in haystack string */
@@ -74,8 +74,7 @@ foreach ($needles as $needle) {
$count++;
}
?>
-===DONE===
---EXPECTF--
+--EXPECT--
*** Testing strripos() function: with single quoted strings ***
-- Iteration 1 --
int(32)
@@ -133,62 +132,30 @@ int(10)
bool(false)
int(10)
-- Iteration 12 --
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(54)
+int(54)
+int(54)
+int(53)
-- Iteration 13 --
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(54)
+int(54)
+int(54)
+int(53)
-- Iteration 14 --
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(54)
+int(54)
+int(54)
+int(53)
-- Iteration 15 --
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(54)
+int(54)
+int(54)
+int(53)
-- Iteration 16 --
-bool(false)
-bool(false)
-bool(false)
-bool(false)
+int(54)
+int(54)
+int(54)
+int(53)
-- Iteration 17 --
int(53)
int(53)
@@ -280,21 +247,12 @@ bool(false)
bool(false)
bool(false)
-- Iteration 35 --
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-int(23)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-int(23)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-int(23)
-
-Deprecated: strripos(): Non-string needles will be interpreted as strings in %s on line %d
-int(23)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
-- Iteration 36 --
int(0)
bool(false)
bool(false)
int(0)
-===DONE===
diff --git a/ext/standard/tests/strings/strripos_variation3.phpt b/ext/standard/tests/strings/strripos_variation3.phpt
index 4fccaeb47e..f7a1f0ab20 100644
--- a/ext/standard/tests/strings/strripos_variation3.phpt
+++ b/ext/standard/tests/strings/strripos_variation3.phpt
@@ -36,7 +36,6 @@ var_dump( strripos($multi_line_str, "") );
var_dump( strripos($multi_line_str, " ") );
?>
-===DONE===
--EXPECT--
*** Testing strripos() function: with heredoc strings ***
-- With heredoc string containing multi lines --
@@ -54,6 +53,5 @@ bool(false)
-- Multi line strings with no offset --
int(18)
int(31)
-bool(false)
+int(63)
int(55)
-===DONE===
diff --git a/ext/standard/tests/strings/strripos_variation4.phpt b/ext/standard/tests/strings/strripos_variation4.phpt
index 3583f3646c..4c8e6a44dc 100644
--- a/ext/standard/tests/strings/strripos_variation4.phpt
+++ b/ext/standard/tests/strings/strripos_variation4.phpt
@@ -8,7 +8,7 @@ Test strripos() function : usage variations - heredoc string containing special
*/
/* Test strripos() function by passing heredoc string containing special chars for haystack
- * and with various needles & offets
+ * and with various needles & offsets
*/
echo "*** Testing strripos() function: with heredoc strings ***\n";
@@ -27,7 +27,6 @@ var_dump( strripos($special_chars_str, "$*", 10) );
var_dump( strripos($special_chars_str, "(speCIal)") );
?>
-===DONE===
--EXPECT--
*** Testing strripos() function: with heredoc strings ***
-- With heredoc string containing special chars --
@@ -38,4 +37,3 @@ int(39)
int(55)
int(55)
int(57)
-===DONE===
diff --git a/ext/standard/tests/strings/strripos_variation5.phpt b/ext/standard/tests/strings/strripos_variation5.phpt
index 677e108e33..18572cc8d1 100644
--- a/ext/standard/tests/strings/strripos_variation5.phpt
+++ b/ext/standard/tests/strings/strripos_variation5.phpt
@@ -23,7 +23,6 @@ var_dump( strripos($control_char_str, "\n", 12) );
var_dump( strripos($control_char_str, "\t", 15) );
?>
-===DONE===
--EXPECT--
*** Testing strripos() function: with heredoc strings ***
-- With heredoc string containing escape characters --
@@ -31,4 +30,3 @@ int(13)
int(19)
int(13)
int(19)
-===DONE===
diff --git a/ext/standard/tests/strings/strripos_variation6.phpt b/ext/standard/tests/strings/strripos_variation6.phpt
new file mode 100644
index 0000000000..92bb70440a
--- /dev/null
+++ b/ext/standard/tests/strings/strripos_variation6.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Test strrpos() function : usage variations - negative offset with empty needle
+--FILE--
+<?php
+$haystack = "Hello,\t\n\0\n $&!#%()*<=>?@hello123456he \x234 \101 ";
+
+var_dump(strlen($haystack));
+
+var_dump( strripos($haystack, "", -1) );
+var_dump( strripos($haystack, "", -10) );
+var_dump( strripos($haystack, "", -26) );
+var_dump( strripos($haystack, "", -44) );
+?>
+
+DONE
+--EXPECT--
+int(44)
+int(43)
+int(34)
+int(18)
+int(0)
+
+DONE
diff --git a/ext/standard/tests/strings/strrpos.phpt b/ext/standard/tests/strings/strrpos.phpt
index 691f67e599..d374175b5a 100644
--- a/ext/standard/tests/strings/strrpos.phpt
+++ b/ext/standard/tests/strings/strrpos.phpt
@@ -2,19 +2,19 @@
strrpos() function
--FILE--
<?php
- var_dump(strrpos("test test string", "test"));
- var_dump(strrpos("test string sTring", "string"));
- var_dump(strrpos("test strip string strand", "str"));
- var_dump(strrpos("I am what I am and that's all what I am", "am", -3));
- var_dump(strrpos("test string", "g"));
- var_dump(strrpos("te".chr(0)."st", chr(0)));
- var_dump(strrpos("tEst", "test"));
- var_dump(strrpos("teSt", "test"));
- var_dump(@strrpos("foo", "f", 1));
- var_dump(@strrpos("", ""));
- var_dump(@strrpos("a", ""));
- var_dump(@strrpos("", "a"));
- var_dump(@strrpos("\\\\a", "\\a"));
+ var_dump(strrpos("test test string", "test"));
+ var_dump(strrpos("test string sTring", "string"));
+ var_dump(strrpos("test strip string strand", "str"));
+ var_dump(strrpos("I am what I am and that's all what I am", "am", -3));
+ var_dump(strrpos("test string", "g"));
+ var_dump(strrpos("te".chr(0)."st", chr(0)));
+ var_dump(strrpos("tEst", "test"));
+ var_dump(strrpos("teSt", "test"));
+ var_dump(strrpos("foo", "f", 1));
+ var_dump(strrpos("", ""));
+ var_dump(strrpos("a", ""));
+ var_dump(strrpos("", "a"));
+ var_dump(strrpos("\\\\a", "\\a"));
?>
--EXPECT--
int(5)
@@ -26,7 +26,7 @@ int(2)
bool(false)
bool(false)
bool(false)
-bool(false)
-bool(false)
+int(0)
+int(1)
bool(false)
int(1)
diff --git a/ext/standard/tests/strings/strrpos_negative_offset.phpt b/ext/standard/tests/strings/strrpos_negative_offset.phpt
index 940c2274f4..41b2b16b56 100644
--- a/ext/standard/tests/strings/strrpos_negative_offset.phpt
+++ b/ext/standard/tests/strings/strrpos_negative_offset.phpt
@@ -2,21 +2,28 @@
strr[i]pos() function with negative offset
--FILE--
<?php
- var_dump(strrpos("haysthack", 'ha', -9));
- var_dump(strrpos("haystack", 'h', -8));
- var_dump(strrpos("haystack", 'k', -1));
- var_dump(strrpos("haystack", "ka", -1));
- var_dump(strrpos("haystack", 'a', -3));
- var_dump(strrpos("haystack", 'a', -4));
- var_dump(@strrpos("haystack", 'h', -9));
-
- var_dump(strripos("HAYSTHACk", 'ha', -9));
- var_dump(strripos("HAYSTACK", 'h', -8));
- var_dump(strripos("HAYSTACK", 'k', -1));
- var_dump(strripos("HAYSTACK", "ka", -1));
- var_dump(strripos("HAYSTACK", 'a', -3));
- var_dump(strripos("HAYSTACK", 'a', -4));
- var_dump(@strripos("HAYSTACK", 'h', -9));
+ var_dump(strrpos("haysthack", 'ha', -9));
+ var_dump(strrpos("haystack", 'h', -8));
+ var_dump(strrpos("haystack", 'k', -1));
+ var_dump(strrpos("haystack", "ka", -1));
+ var_dump(strrpos("haystack", 'a', -3));
+ var_dump(strrpos("haystack", 'a', -4));
+ try {
+ strrpos("haystack", 'h', -9);
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+ var_dump(strripos("HAYSTHACk", 'ha', -9));
+ var_dump(strripos("HAYSTACK", 'h', -8));
+ var_dump(strripos("HAYSTACK", 'k', -1));
+ var_dump(strripos("HAYSTACK", "ka", -1));
+ var_dump(strripos("HAYSTACK", 'a', -3));
+ var_dump(strripos("HAYSTACK", 'a', -4));
+ try {
+ strripos("HAYSTACK", 'h', -9);
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
?>
--EXPECT--
int(0)
@@ -25,11 +32,11 @@ int(7)
bool(false)
int(5)
int(1)
-bool(false)
+Offset not contained in string
int(0)
int(0)
int(7)
bool(false)
int(5)
int(1)
-bool(false)
+Offset not contained in string
diff --git a/ext/standard/tests/strings/strrpos_offset.phpt b/ext/standard/tests/strings/strrpos_offset.phpt
index 9ef4f42d18..213cd24c6f 100644
--- a/ext/standard/tests/strings/strrpos_offset.phpt
+++ b/ext/standard/tests/strings/strrpos_offset.phpt
@@ -3,43 +3,42 @@ strrpos() offset integer overflow
--FILE--
<?php
-var_dump(strrpos("t", "t", PHP_INT_MAX+1));
-var_dump(strrpos("tttt", "tt", PHP_INT_MAX+1));
-var_dump(strrpos(100, 101, PHP_INT_MAX+1));
-var_dump(strrpos(1024, 1024, PHP_INT_MAX+1));
-var_dump(strrpos(1024, 1024, -PHP_INT_MAX));
-var_dump(strrpos(1024, "te", -PHP_INT_MAX));
-var_dump(strrpos(1024, 1024, -PHP_INT_MAX-1));
-var_dump(strrpos(1024, "te", -PHP_INT_MAX-1));
+try {
+ var_dump(strrpos("t", "t", PHP_INT_MAX+1));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+
+try {
+ strrpos(1024, 1024, -PHP_INT_MAX);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+try {
+ strrpos(1024, "te", -PHP_INT_MAX);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+try {
+ strrpos(1024, 1024, -PHP_INT_MAX-1);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
+
+try {
+ strrpos(1024, "te", -PHP_INT_MAX-1);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
echo "Done\n";
?>
---EXPECTF--
-Warning: strrpos() expects parameter 3 to be int, float given in %s on line %d
-bool(false)
-
-Warning: strrpos() expects parameter 3 to be int, float given in %s on line %d
-bool(false)
-
-Warning: strrpos() expects parameter 3 to be int, float given in %s on line %d
-bool(false)
-
-Warning: strrpos() expects parameter 3 to be int, float given in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-
-Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
-bool(false)
-
-Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-
-Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
-bool(false)
-
-Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
-bool(false)
+--EXPECT--
+strrpos() expects parameter 3 to be int, float given
+Offset not contained in string
+Offset not contained in string
+Offset not contained in string
+Offset not contained in string
Done
diff --git a/ext/standard/tests/strings/strrpos_variation1.phpt b/ext/standard/tests/strings/strrpos_variation1.phpt
index fd236d04d4..d54adaec73 100644
--- a/ext/standard/tests/strings/strrpos_variation1.phpt
+++ b/ext/standard/tests/strings/strrpos_variation1.phpt
@@ -72,7 +72,7 @@ for($index=0; $index<count($needle); $index++) {
}
echo "*** Done ***";
?>
---EXPECTF--
+--EXPECT--
*** Testing strrpos() function: with double quoted strings ***
-- Iteration 1 --
int(28)
@@ -108,36 +108,20 @@ int(9)
int(8)
bool(false)
-- Iteration 12 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-int(8)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(44)
+int(44)
-- Iteration 13 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-int(8)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(44)
+int(44)
-- Iteration 14 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-int(8)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(44)
+int(44)
-- Iteration 15 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-int(8)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(44)
+int(44)
-- Iteration 16 --
-bool(false)
-bool(false)
+int(44)
+int(44)
-- Iteration 17 --
int(43)
int(43)
diff --git a/ext/standard/tests/strings/strrpos_variation10.phpt b/ext/standard/tests/strings/strrpos_variation10.phpt
index b9b24b9cb1..2a6b84337c 100644
--- a/ext/standard/tests/strings/strrpos_variation10.phpt
+++ b/ext/standard/tests/strings/strrpos_variation10.phpt
@@ -83,7 +83,11 @@ $needles = array (
$counter = 1;
for($index = 0; $index < count($needles); $index ++) {
echo "-- Iteration $counter --\n";
- var_dump( strrpos($haystack, $needles[$index]) );
+ try {
+ var_dump( strrpos($haystack, $needles[$index]) );
+ } catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+ }
$counter ++;
}
@@ -91,108 +95,58 @@ fclose($file_handle); //closing the file handle
echo "*** Done ***";
?>
---EXPECTF--
+--EXPECT--
*** Testing strrpos() function with unexpected values for needle ***
-- Iteration 1 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(42)
-- Iteration 2 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(41)
-- Iteration 3 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 4 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 5 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(27)
-- Iteration 6 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(21)
-- Iteration 7 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 8 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
bool(false)
-- Iteration 9 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(28)
-- Iteration 10 --
-
-Warning: strrpos(): needle is not a string or an integer in %s on line %d
-bool(false)
+strrpos() expects parameter 2 to be string, array given
-- Iteration 11 --
-
-Warning: strrpos(): needle is not a string or an integer in %s on line %d
-bool(false)
+strrpos() expects parameter 2 to be string, array given
-- Iteration 12 --
-
-Warning: strrpos(): needle is not a string or an integer in %s on line %d
-bool(false)
+strrpos() expects parameter 2 to be string, array given
-- Iteration 13 --
-
-Warning: strrpos(): needle is not a string or an integer in %s on line %d
-bool(false)
+strrpos() expects parameter 2 to be string, array given
-- Iteration 14 --
-
-Warning: strrpos(): needle is not a string or an integer in %s on line %d
-bool(false)
+strrpos() expects parameter 2 to be string, array given
-- Iteration 15 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(41)
-- Iteration 16 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(87)
-- Iteration 17 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(41)
-- Iteration 18 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(87)
-- Iteration 19 --
-
-Notice: Object of class sample could not be converted to int in %s on line %d
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(64)
-- Iteration 20 --
-bool(false)
+int(87)
-- Iteration 21 --
-bool(false)
+int(87)
-- Iteration 22 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(87)
-- Iteration 23 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(87)
-- Iteration 24 --
-
-Warning: strrpos(): needle is not a string or an integer in %s on line %d
-bool(false)
+strrpos() expects parameter 2 to be string, resource given
-- Iteration 25 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(87)
-- Iteration 26 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(87)
*** Done ***
diff --git a/ext/standard/tests/strings/strrpos_variation11.phpt b/ext/standard/tests/strings/strrpos_variation11.phpt
index 94c1b9d96d..2f8627d5ad 100644
--- a/ext/standard/tests/strings/strrpos_variation11.phpt
+++ b/ext/standard/tests/strings/strrpos_variation11.phpt
@@ -81,8 +81,17 @@ $counter = 1;
for($index = 0; $index < count($values); $index ++) {
echo "-- Iteration $counter --\n";
$haystack = $values[$index];
- var_dump( strrpos($values[$index], $values[$index]) );
- var_dump( strrpos($values[$index], $values[$index], 1) );
+ try {
+ var_dump( strrpos($values[$index], $values[$index]) );
+ } catch (Error $e) {
+ echo get_class($e) . ": " . $e->getMessage(), "\n";
+ }
+
+ try {
+ var_dump( strrpos($values[$index], $values[$index], 1) );
+ } catch (Error $e) {
+ echo get_class($e) . ": " . $e->getMessage(), "\n";
+ }
$counter ++;
}
@@ -91,181 +100,81 @@ echo "*** Done ***";
--EXPECTF--
*** Testing strrpos() function with unexpected values for haystack and needle ***
-- Iteration 1 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
+int(0)
bool(false)
-- Iteration 2 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
+int(0)
bool(false)
-- Iteration 3 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
+int(0)
bool(false)
-- Iteration 4 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
+int(0)
bool(false)
-- Iteration 5 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
+int(0)
bool(false)
-- Iteration 6 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
+int(0)
bool(false)
-- Iteration 7 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
+int(0)
bool(false)
-- Iteration 8 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
+int(0)
bool(false)
-- Iteration 9 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
+int(0)
bool(false)
-- Iteration 10 --
-
-Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
-bool(false)
-
-Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
-bool(false)
+TypeError: strrpos() expects parameter 1 to be string, array given
+TypeError: strrpos() expects parameter 1 to be string, array given
-- Iteration 11 --
-
-Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
-bool(false)
-
-Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
-bool(false)
+TypeError: strrpos() expects parameter 1 to be string, array given
+TypeError: strrpos() expects parameter 1 to be string, array given
-- Iteration 12 --
-
-Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
-bool(false)
-
-Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
-bool(false)
+TypeError: strrpos() expects parameter 1 to be string, array given
+TypeError: strrpos() expects parameter 1 to be string, array given
-- Iteration 13 --
-
-Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
-bool(false)
-
-Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
-bool(false)
+TypeError: strrpos() expects parameter 1 to be string, array given
+TypeError: strrpos() expects parameter 1 to be string, array given
-- Iteration 14 --
-
-Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
-bool(false)
-
-Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
-bool(false)
+TypeError: strrpos() expects parameter 1 to be string, array given
+TypeError: strrpos() expects parameter 1 to be string, array given
-- Iteration 15 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
+int(0)
bool(false)
-- Iteration 16 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(0)
+ValueError: Offset not contained in string
-- Iteration 17 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
+int(0)
bool(false)
-- Iteration 18 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(0)
+ValueError: Offset not contained in string
-- Iteration 19 --
-
-Notice: Object of class sample could not be converted to int in %s on line %d
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Notice: Object of class sample could not be converted to int in %s on line %d
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
+int(0)
bool(false)
-- Iteration 20 --
-bool(false)
-bool(false)
+int(0)
+ValueError: Offset not contained in string
-- Iteration 21 --
-bool(false)
-bool(false)
+int(0)
+ValueError: Offset not contained in string
-- Iteration 22 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(0)
+ValueError: Offset not contained in string
-- Iteration 23 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(0)
+ValueError: Offset not contained in string
-- Iteration 24 --
-
-Warning: strrpos() expects parameter 1 to be string, resource given in %s on line %d
-bool(false)
-
-Warning: strrpos() expects parameter 1 to be string, resource given in %s on line %d
-bool(false)
+TypeError: strrpos() expects parameter 1 to be string, resource given
+TypeError: strrpos() expects parameter 1 to be string, resource given
-- Iteration 25 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(0)
+ValueError: Offset not contained in string
-- Iteration 26 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(0)
+ValueError: Offset not contained in string
*** Done ***
diff --git a/ext/standard/tests/strings/strrpos_variation14.phpt b/ext/standard/tests/strings/strrpos_variation14.phpt
new file mode 100644
index 0000000000..d244a19e47
--- /dev/null
+++ b/ext/standard/tests/strings/strrpos_variation14.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Test strrpos() function : usage variations - negative offset with empty needle
+--FILE--
+<?php
+$haystack = "Hello,\t\n\0\n $&!#%()*<=>?@hello123456he \x234 \101 ";
+
+var_dump(strlen($haystack));
+
+var_dump( strrpos($haystack, "", -1) );
+var_dump( strrpos($haystack, "", -10) );
+var_dump( strrpos($haystack, "", -26) );
+var_dump( strrpos($haystack, "", -44) );
+?>
+
+DONE
+--EXPECT--
+int(44)
+int(43)
+int(34)
+int(18)
+int(0)
+
+DONE
diff --git a/ext/standard/tests/strings/strrpos_variation15.phpt b/ext/standard/tests/strings/strrpos_variation15.phpt
deleted file mode 100644
index 798a6877e4..0000000000
--- a/ext/standard/tests/strings/strrpos_variation15.phpt
+++ /dev/null
@@ -1,205 +0,0 @@
---TEST--
-Test strrpos() function : usage variations - unexpected inputs for 'haystack', 'needle' & 'offset' arguments
---SKIPIF--
-<?php if (PHP_INT_SIZE !== 4) die("skip this test is for 32-bit only");
---FILE--
-<?php
-/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] );
- * Description: Find position of last occurrence of 'needle' in 'haystack'.
- * Source code: ext/standard/string.c
-*/
-
-/* Test strrpos() function with unexpected inputs for 'haystack', 'needle' & 'offset' arguments */
-
-echo "*** Testing strrpos() function: with unexpected values for haystack, needle & offset ***\n";
-
-// get an unset variable
-$unset_var = 'string_val';
-unset($unset_var);
-
-// defining a class
-class sample {
- public function __toString() {
- return "object";
- }
-}
-
-//getting the resource
-$file_handle = fopen(__FILE__, "r");
-
-// array with different values
-$values = array (
-
- // integer values
- 0,
- 1,
- 12345,
- -2345,
-
- // float values
- 10.5,
- -10.5,
- 10.5e10,
- 10.6E-10,
- .5,
-
- // array values
- array(),
- array(0),
- array(1),
- array(1, 2),
- array('color' => 'red', 'item' => 'pen'),
-
- // boolean values
- true,
- false,
- TRUE,
- FALSE,
-
- // objects
- new sample(),
-
- // empty string
- "",
- '',
-
- // null values
- NULL,
- null,
-
- //resource
- $file_handle,
-
- // undefined variable
- @$undefined_var,
-
- // unset variable
- @$unset_var
-);
-
-
-// loop through each element of the array and check the working of strrpos()
-$counter = 1;
-for($index = 0; $index < count($values); $index ++) {
- echo "-- Iteration $counter --\n";
- var_dump( strrpos($values[$index], $values[$index], $values[$index]) );
- $counter ++;
-}
-
-echo "*** Done ***";
-?>
---EXPECTF--
-*** Testing strrpos() function: with unexpected values for haystack, needle & offset ***
--- Iteration 1 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
--- Iteration 2 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
--- Iteration 3 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-
-Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
-bool(false)
--- Iteration 4 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-
-Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
-bool(false)
--- Iteration 5 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-
-Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
-bool(false)
--- Iteration 6 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-
-Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
-bool(false)
--- Iteration 7 --
-
-Warning: strrpos() expects parameter 3 to be int, float given in %s on line %d
-bool(false)
--- Iteration 8 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
--- Iteration 9 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
--- Iteration 10 --
-
-Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
-bool(false)
--- Iteration 11 --
-
-Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
-bool(false)
--- Iteration 12 --
-
-Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
-bool(false)
--- Iteration 13 --
-
-Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
-bool(false)
--- Iteration 14 --
-
-Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
-bool(false)
--- Iteration 15 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
--- Iteration 16 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
--- Iteration 17 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
--- Iteration 18 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
--- Iteration 19 --
-
-Warning: strrpos() expects parameter 3 to be int, object given in %s on line %d
-bool(false)
--- Iteration 20 --
-
-Warning: strrpos() expects parameter 3 to be int, string given in %s on line %d
-bool(false)
--- Iteration 21 --
-
-Warning: strrpos() expects parameter 3 to be int, string given in %s on line %d
-bool(false)
--- Iteration 22 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
--- Iteration 23 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
--- Iteration 24 --
-
-Warning: strrpos() expects parameter 1 to be string, resource given in %s on line %d
-bool(false)
--- Iteration 25 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
--- Iteration 26 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
-bool(false)
-*** Done ***
diff --git a/ext/standard/tests/strings/strrpos_variation2.phpt b/ext/standard/tests/strings/strrpos_variation2.phpt
index 9c0a320785..3accd165bb 100644
--- a/ext/standard/tests/strings/strrpos_variation2.phpt
+++ b/ext/standard/tests/strings/strrpos_variation2.phpt
@@ -73,7 +73,7 @@ for($index=0; $index<count($needle); $index++) {
}
echo "*** Done ***";
?>
---EXPECTF--
+--EXPECT--
*** Testing strrpos() function: with single quoted strings ***
-- Iteration 1 --
int(32)
@@ -109,36 +109,20 @@ bool(false)
int(10)
int(10)
-- Iteration 12 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(54)
+int(54)
-- Iteration 13 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(54)
+int(54)
-- Iteration 14 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(54)
+int(54)
-- Iteration 15 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(54)
+int(54)
-- Iteration 16 --
-bool(false)
-bool(false)
+int(54)
+int(54)
-- Iteration 17 --
int(53)
int(53)
@@ -194,11 +178,7 @@ bool(false)
bool(false)
bool(false)
-- Iteration 35 --
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-int(23)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
+bool(false)
bool(false)
-- Iteration 36 --
int(0)
diff --git a/ext/standard/tests/strings/strrpos_variation3.phpt b/ext/standard/tests/strings/strrpos_variation3.phpt
index 460f18cca5..1ebe9e7a21 100644
--- a/ext/standard/tests/strings/strrpos_variation3.phpt
+++ b/ext/standard/tests/strings/strrpos_variation3.phpt
@@ -32,6 +32,6 @@ echo "*** Done ***";
int(44)
int(44)
int(44)
-bool(false)
+int(63)
int(55)
*** Done ***
diff --git a/ext/standard/tests/strings/strrpos_variation4.phpt b/ext/standard/tests/strings/strrpos_variation4.phpt
index 1d9184d787..e885c7dfae 100644
--- a/ext/standard/tests/strings/strrpos_variation4.phpt
+++ b/ext/standard/tests/strings/strrpos_variation4.phpt
@@ -8,7 +8,7 @@ Test strrpos() function : usage variations - heredoc string containing special c
*/
/* Test strrpos() function by passing heredoc string containing special chars for haystack
- * and with various needles & offets
+ * and with various needles & offsets
*/
echo "*** Testing strrpos() function: with heredoc strings ***\n";
diff --git a/ext/standard/tests/strings/strrpos_variation7.phpt b/ext/standard/tests/strings/strrpos_variation7.phpt
index 54db4b372e..9a02a4a0ec 100644
--- a/ext/standard/tests/strings/strrpos_variation7.phpt
+++ b/ext/standard/tests/strings/strrpos_variation7.phpt
@@ -16,21 +16,21 @@ echo "-- With empty heredoc string --\n";
$empty_string = <<<EOD
EOD;
var_dump( strrpos($empty_string, "") );
-var_dump( strrpos($empty_string, "", 1) );
+try {
+ strrpos($empty_string, "", 1);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
var_dump( strrpos($empty_string, FALSE) );
var_dump( strrpos($empty_string, NULL) );
echo "*** Done ***";
?>
---EXPECTF--
+--EXPECT--
*** Testing strrpos() function: with heredoc strings ***
-- With empty heredoc string --
-bool(false)
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
-
-Deprecated: strrpos(): Non-string needles will be interpreted as strings in %s on line %d
-bool(false)
+int(0)
+Offset not contained in string
+int(0)
+int(0)
*** Done ***
diff --git a/ext/standard/tests/strings/strspn_variation10.phpt b/ext/standard/tests/strings/strspn_variation10.phpt
index d8eb52aa6f..952110880f 100644
--- a/ext/standard/tests/strings/strspn_variation10.phpt
+++ b/ext/standard/tests/strings/strspn_variation10.phpt
@@ -19,35 +19,35 @@ echo "*** Testing strspn() : with different mask strings and default start and l
// defining different strings
$strings = array(
"",
- '',
- "\n",
- '\n',
- "hello\tworld\nhello\nworld\n",
- 'hello\tworld\nhello\nworld\n',
- "1234hello45world\t123",
- '1234hello45world\t123',
- "hello\0world\012",
- 'hello\0world\012',
- chr(0).chr(0),
- chr(0)."hello\0world".chr(0),
- chr(0).'hello\0world'.chr(0),
- "hello".chr(0)."world",
- 'hello'.chr(0).'world',
- "hello\0\100\xaaaworld",
- 'hello\0\100\xaaaworld'
+ '',
+ "\n",
+ '\n',
+ "hello\tworld\nhello\nworld\n",
+ 'hello\tworld\nhello\nworld\n',
+ "1234hello45world\t123",
+ '1234hello45world\t123',
+ "hello\0world\012",
+ 'hello\0world\012',
+ chr(0).chr(0),
+ chr(0)."hello\0world".chr(0),
+ chr(0).'hello\0world'.chr(0),
+ "hello".chr(0)."world",
+ 'hello'.chr(0).'world',
+ "hello\0\100\xaaaworld",
+ 'hello\0\100\xaaaworld'
);
// define the array of mask strings
$mask_array = array(
- "",
- '',
- "f\n\trelshti \l",
- 'f\n\trelsthi \l',
- "\telh",
- "t\ ",
- '\telh',
- "felh\t\ ",
- " \t",
+ "",
+ '',
+ "f\n\trelshti \l",
+ 'f\n\trelsthi \l',
+ "\telh",
+ "t\ ",
+ '\telh',
+ "felh\t\ ",
+ " \t",
"fhel\t\i\100\xa"
);
diff --git a/ext/standard/tests/strings/strspn_variation11.phpt b/ext/standard/tests/strings/strspn_variation11.phpt
index ecbe6a4967..1737155a7a 100644
--- a/ext/standard/tests/strings/strspn_variation11.phpt
+++ b/ext/standard/tests/strings/strspn_variation11.phpt
@@ -19,47 +19,47 @@ echo "*** Testing strspn() : with different start and default len values ***\n";
// defining different strings
$strings = array(
"",
- '',
- "\n",
- '\n',
- "hello\tworld\nhello\nworld\n",
- 'hello\tworld\nhello\nworld\n',
- "1234hello45world\t123",
- '1234hello45world\t123',
- "hello\0world\012",
- 'hello\0world\012',
- chr(0).chr(0),
- chr(0)."hello\0world".chr(0),
- chr(0).'hello\0world'.chr(0),
- "hello".chr(0)."world",
- 'hello'.chr(0).'world',
- "hello\0\100\xaaaworld",
- 'hello\0\100\xaaaworld'
+ '',
+ "\n",
+ '\n',
+ "hello\tworld\nhello\nworld\n",
+ 'hello\tworld\nhello\nworld\n',
+ "1234hello45world\t123",
+ '1234hello45world\t123',
+ "hello\0world\012",
+ 'hello\0world\012',
+ chr(0).chr(0),
+ chr(0)."hello\0world".chr(0),
+ chr(0).'hello\0world'.chr(0),
+ "hello".chr(0)."world",
+ 'hello'.chr(0).'world',
+ "hello\0\100\xaaaworld",
+ 'hello\0\100\xaaaworld'
);
// define the array of mask strings
$mask_array = array(
- "",
- '',
- "f\n\trelshti \l",
- 'f\n\trelsthi \l',
- "\telh",
- "t\ ",
- '\telh',
- "felh\t\ ",
- " \t",
+ "",
+ '',
+ "f\n\trelshti \l",
+ 'f\n\trelsthi \l',
+ "\telh",
+ "t\ ",
+ '\telh',
+ "felh\t\ ",
+ " \t",
"fhel\t\i\100\xa"
);
// defining the array for start values
$start_array = array(
- 0,
- 1,
+ 0,
+ 1,
2,
- -1,
- -2,
- 2147483647, // max positive integer
- -2147483648, // min negative integer
+ -1,
+ -2,
+ 2147483647, // max positive integer
+ -2147483648, // min negative integer
);
diff --git a/ext/standard/tests/strings/strspn_variation12.phpt b/ext/standard/tests/strings/strspn_variation12.phpt
index 1c404c1914..e5615c9532 100644
--- a/ext/standard/tests/strings/strspn_variation12.phpt
+++ b/ext/standard/tests/strings/strspn_variation12.phpt
@@ -19,47 +19,47 @@ echo "*** Testing strspn() : with different start and len values ***\n";
// defining different strings
$strings = array(
"",
- '',
- "\n",
- '\n',
- "hello\tworld\nhello\nworld\n",
- "1234hello45world\t123",
- "hello\0world\012",
- chr(0).chr(0),
- chr(0)."hello\0world".chr(0),
- "hello".chr(0)."world",
- "hello\0\100\xaaaworld",
+ '',
+ "\n",
+ '\n',
+ "hello\tworld\nhello\nworld\n",
+ "1234hello45world\t123",
+ "hello\0world\012",
+ chr(0).chr(0),
+ chr(0)."hello\0world".chr(0),
+ "hello".chr(0)."world",
+ "hello\0\100\xaaaworld",
);
// define the array of mask strings
$mask_array = array(
- "",
- '',
- "f\n\trelshti \l",
- 'f\n\trelsthi \l',
- "\telh",
- "felh\t\ ",
+ "",
+ '',
+ "f\n\trelshti \l",
+ 'f\n\trelsthi \l',
+ "\telh",
+ "felh\t\ ",
"fhel\t\i\100\xa"
);
// defining the array for start values
$start_array = array(
- 0,
- 1,
- 2,
- -1,
- 2147483647, // max positive integer
- -2147483648, // min negative integer
+ 0,
+ 1,
+ 2,
+ -1,
+ 2147483647, // max positive integer
+ -2147483648, // min negative integer
);
// defining an array of len values
$len_array = array(
- 0,
- 1,
- 2,
- -1,
- 2147483647, // max positive integer
- -2147483648, // min negative integer
+ 0,
+ 1,
+ 2,
+ -1,
+ 2147483647, // max positive integer
+ -2147483648, // min negative integer
);
diff --git a/ext/standard/tests/strings/strspn_variation6.phpt b/ext/standard/tests/strings/strspn_variation6.phpt
index b202bb8234..8c75e89775 100644
--- a/ext/standard/tests/strings/strspn_variation6.phpt
+++ b/ext/standard/tests/strings/strspn_variation6.phpt
@@ -63,15 +63,15 @@ $heredoc_strings = array(
// defining array of different mask strings
$mask_array = array(
- "",
- '',
- "fh\ne\trlsti \l",
- 'fieh\n\trlsti \l',
- "\t",
- "lt\ ",
- 'l\t',
- "fl\t\eh ",
- "l \te",
+ "",
+ '',
+ "fh\ne\trlsti \l",
+ 'fieh\n\trlsti \l',
+ "\t",
+ "lt\ ",
+ 'l\t',
+ "fl\t\eh ",
+ "l \te",
"lf\the\i\100\xaa"
);
diff --git a/ext/standard/tests/strings/strspn_variation7.phpt b/ext/standard/tests/strings/strspn_variation7.phpt
index bbfe5d4868..962c180c40 100644
--- a/ext/standard/tests/strings/strspn_variation7.phpt
+++ b/ext/standard/tests/strings/strspn_variation7.phpt
@@ -63,27 +63,27 @@ $heredoc_strings = array(
// defining array of different mask strings
$mask_array = array(
- "",
- '',
- "f\nh\trstie \l",
- 'f\n\thrstei \l',
- "\t",
- "t\ e",
- '\t',
- "f\te\h ",
- " \t",
+ "",
+ '',
+ "f\nh\trstie \l",
+ 'f\n\thrstei \l',
+ "\t",
+ "t\ e",
+ '\t',
+ "f\te\h ",
+ " \t",
"f\t\ih\100e\xa"
);
// defining array of different start values
$start_array = array(
- 0,
- 1,
- 2,
- -1,
- -2,
- 2147483647, // max positive integer
- -2147483648, // min negative integer
+ 0,
+ 1,
+ 2,
+ -1,
+ -2,
+ 2147483647, // max positive integer
+ -2147483648, // min negative integer
);
diff --git a/ext/standard/tests/strings/strspn_variation8.phpt b/ext/standard/tests/strings/strspn_variation8.phpt
index 0ff0000132..a3486908b7 100644
--- a/ext/standard/tests/strings/strspn_variation8.phpt
+++ b/ext/standard/tests/strings/strspn_variation8.phpt
@@ -63,33 +63,33 @@ $heredoc_strings = array(
// defining array of different mask strings
$mask_array = array(
- "",
- '',
- "f\n\\0htersti \l",
- "\t",
- "het\ ",
- "fel\th\ ",
+ "",
+ '',
+ "f\n\\0htersti \l",
+ "\t",
+ "het\ ",
+ "fel\th\ ",
"f\t\hiel\100\xaa"
);
// defining array of different start values
$start_array = array(
- 0,
- 1,
- 2,
- -1,
- 2147483647, // max positive integer
- -2147483648, // min negative integer
+ 0,
+ 1,
+ 2,
+ -1,
+ 2147483647, // max positive integer
+ -2147483648, // min negative integer
);
// defining array of different len values
$len_array = array(
- 0,
- 1,
- 2,
- -1,
- 2147483647, // max positive integer
- -2147483648, // min negative integer
+ 0,
+ 1,
+ 2,
+ -1,
+ 2147483647, // max positive integer
+ -2147483648, // min negative integer
);
diff --git a/ext/standard/tests/strings/strspn_variation9.phpt b/ext/standard/tests/strings/strspn_variation9.phpt
index 0835047ff5..49d590bee8 100644
--- a/ext/standard/tests/strings/strspn_variation9.phpt
+++ b/ext/standard/tests/strings/strspn_variation9.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strstr.phpt b/ext/standard/tests/strings/strstr.phpt
index 2908de7a27..4fa6165d97 100644
--- a/ext/standard/tests/strings/strstr.phpt
+++ b/ext/standard/tests/strings/strstr.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strstr_variation1.phpt b/ext/standard/tests/strings/strstr_variation1.phpt
new file mode 100644
index 0000000000..aade1fd5f8
--- /dev/null
+++ b/ext/standard/tests/strings/strstr_variation1.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Test strstr() function : usage variations - complex strings containing other than 7-bit chars
+--FILE--
+<?php
+$string = chr(0).chr(128).chr(129).chr(234).chr(235).chr(254).chr(255);
+$stringAsHex = bin2hex($string);
+echo "-- Positions of some chars in the string '$stringAsHex' are as follows --\n";
+echo bin2hex( chr(128) ) ." => ";
+var_dump( bin2hex( strstr($string, chr(128) ) ) );
+echo bin2hex( chr(255) ) ." => ";
+var_dump( bin2hex( strstr($string, chr(255) ) ) );
+echo bin2hex( chr(256) ) ." => ";
+var_dump( bin2hex( strstr($string, chr(256) ) ) );
+?>
+
+DONE
+--EXPECT--
+-- Positions of some chars in the string '008081eaebfeff' are as follows --
+80 => string(12) "8081eaebfeff"
+ff => string(2) "ff"
+00 => string(14) "008081eaebfeff"
+
+DONE
diff --git a/ext/standard/tests/strings/strtok_variation4.phpt b/ext/standard/tests/strings/strtok_variation4.phpt
index 5db1d39650..fb34639f48 100644
--- a/ext/standard/tests/strings/strtok_variation4.phpt
+++ b/ext/standard/tests/strings/strtok_variation4.phpt
@@ -15,8 +15,8 @@ echo "*** Testing strtok() : with embedded nulls in the strings ***\n";
// defining varous strings with embedded nulls
$strings_with_nulls = array(
- "\0",
- '\0',
+ "\0",
+ '\0',
"hello\0world",
"\0hel\0lo",
"hello\0",
diff --git a/ext/standard/tests/strings/strtok_variation5.phpt b/ext/standard/tests/strings/strtok_variation5.phpt
index a99d13eb7a..e844f97eef 100644
--- a/ext/standard/tests/strings/strtok_variation5.phpt
+++ b/ext/standard/tests/strings/strtok_variation5.phpt
@@ -15,31 +15,31 @@ echo "*** Testing strtok() : with miscellaneous inputs ***\n";
// defining arrays for input strings and tokens
$string_array = array(
- "HELLO WORLD",
- "hello world",
- "_HELLO_WORLD_",
- "/thello/t/wor/ttld",
- "hel/lo/t/world",
+ "HELLO WORLD",
+ "hello world",
+ "_HELLO_WORLD_",
+ "/thello/t/wor/ttld",
+ "hel/lo/t/world",
"one:$:two:!:three:#:four",
- "\rhello/r/wor\rrld",
- chr(0),
+ "\rhello/r/wor\rrld",
+ chr(0),
chr(0).chr(0),
chr(0).'hello'.chr(0),
'hello'.chr(0).'world'
- );
+ );
$token_array = array(
- "wr",
- "hello world",
- "__",
+ "wr",
+ "hello world",
+ "__",
"t/",
- '/t',
- ":",
- "\r",
- "\0",
- "\0",
- "\0",
- "\0",
- );
+ '/t',
+ ":",
+ "\r",
+ "\0",
+ "\0",
+ "\0",
+ "\0",
+ );
// loop through each element of the array and check the working of strtok()
// when supplied with different string and token values
diff --git a/ext/standard/tests/strings/strtok_variation6.phpt b/ext/standard/tests/strings/strtok_variation6.phpt
index cd7f3b3041..4d435dcef4 100644
--- a/ext/standard/tests/strings/strtok_variation6.phpt
+++ b/ext/standard/tests/strings/strtok_variation6.phpt
@@ -15,18 +15,18 @@ echo "*** Testing strtok() : with invalid escape sequences in token ***\n";
// defining arrays for input strings and tokens
$string_array = array(
- "khellok worldk",
- "\khello\k world\k",
- "/khello\k world/k",
- "/hellok/ world"
- );
+ "khellok worldk",
+ "\khello\k world\k",
+ "/khello\k world/k",
+ "/hellok/ world"
+ );
$token_array = array(
- "k",
- "/ ",
- "/k",
- "\k",
- "\\\\\\\k\h\\e\l\o\w\r\l\d"
- );
+ "k",
+ "/ ",
+ "/k",
+ "\k",
+ "\\\\\\\k\h\\e\l\o\w\r\l\d"
+ );
// loop through each element of the array and check the working of strtok()
// when supplied with different string and token values
diff --git a/ext/standard/tests/strings/strtolower-win32.phpt b/ext/standard/tests/strings/strtolower-win32.phpt
index c0ad1d0115..ff631754df 100644
--- a/ext/standard/tests/strings/strtolower-win32.phpt
+++ b/ext/standard/tests/strings/strtolower-win32.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strtolower.phpt b/ext/standard/tests/strings/strtolower.phpt
index 47dfe09762..7c7e2bb4c7 100644
--- a/ext/standard/tests/strings/strtolower.phpt
+++ b/ext/standard/tests/strings/strtolower.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strtoupper1-win32.phpt b/ext/standard/tests/strings/strtoupper1-win32.phpt
index 60701652e1..7240e5c021 100644
--- a/ext/standard/tests/strings/strtoupper1-win32.phpt
+++ b/ext/standard/tests/strings/strtoupper1-win32.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strtoupper1.phpt b/ext/standard/tests/strings/strtoupper1.phpt
index e0ebf42ea7..c243ff10c7 100644
--- a/ext/standard/tests/strings/strtoupper1.phpt
+++ b/ext/standard/tests/strings/strtoupper1.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/strtr_empty_search_string.phpt b/ext/standard/tests/strings/strtr_empty_search_string.phpt
new file mode 100644
index 0000000000..3c861600ff
--- /dev/null
+++ b/ext/standard/tests/strings/strtr_empty_search_string.phpt
@@ -0,0 +1,15 @@
+--TEST--
+strtr() trying to replace an empty string
+--FILE--
+<?php
+
+var_dump(strtr("foo", ["" => "bar"]));
+var_dump(strtr("foo", ["" => "bar", "x" => "y"]));
+
+?>
+--EXPECTF--
+Warning: strtr(): Ignoring replacement of empty string in %s on line %d
+string(3) "foo"
+
+Warning: strtr(): Ignoring replacement of empty string in %s on line %d
+string(3) "foo"
diff --git a/ext/standard/tests/strings/strtr_variation6.phpt b/ext/standard/tests/strings/strtr_variation6.phpt
index 5e06da6178..9956acaca8 100644
--- a/ext/standard/tests/strings/strtr_variation6.phpt
+++ b/ext/standard/tests/strings/strtr_variation6.phpt
@@ -34,41 +34,41 @@ $str = "012atm";
// array of values for 'from'
$from_arr = array (
- // integer values
+ // integer values
/*1*/ 0,
- 1,
- -2,
+ 1,
+ -2,
- // float values
+ // float values
/*4*/ 10.5,
- -20.5,
- 10.1234567e10,
+ -20.5,
+ 10.1234567e10,
- // array values
+ // array values
/*7*/ array(),
- array(0),
- array(1, 2),
+ array(0),
+ array(1, 2),
- // boolean values
+ // boolean values
/*10*/ true,
- false,
- TRUE,
- FALSE,
+ false,
+ TRUE,
+ FALSE,
- // null values
+ // null values
/*14*/ NULL,
- null,
+ null,
- // objects
+ // objects
/*16*/ new sample(),
- // resource
+ // resource
/*17*/ $file_handle,
- // undefined variable
+ // undefined variable
/*18*/ @$undefined_var,
- // unset variable
+ // unset variable
/*19*/ @$unset_var
);
@@ -80,13 +80,16 @@ $count = 1;
for($index = 0; $index < count($from_arr); $index++) {
echo "-- Iteration $count --\n";
$from = $from_arr[$index];
- var_dump( strtr($str, $from, $to) );
- $count ++;
+ try {
+ var_dump(strtr($str, $from, $to));
+ } catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+ $count++;
}
fclose($file_handle); //closing the file handle
?>
-===DONE===
--EXPECTF--
*** Testing strtr() function: with unexpected inputs for 'from' ***
-- Iteration 1 --
@@ -102,17 +105,11 @@ string(6) "m1tatm"
-- Iteration 6 --
string(6) "tm0atm"
-- Iteration 7 --
-
-Notice: Array to string conversion in %s on line %d
-string(6) "0120tm"
+If three arguments are passed, the second argument must be a string
-- Iteration 8 --
-
-Notice: Array to string conversion in %s on line %d
-string(6) "0120tm"
+If three arguments are passed, the second argument must be a string
-- Iteration 9 --
-
-Notice: Array to string conversion in %s on line %d
-string(6) "0120tm"
+If three arguments are passed, the second argument must be a string
-- Iteration 10 --
string(6) "0a2atm"
-- Iteration 11 --
@@ -128,9 +125,8 @@ string(6) "012atm"
-- Iteration 16 --
string(6) "012ttm"
-- Iteration 17 --
-string(6) "012atm"
+strtr() expects parameter 2 to be string or array, resource given
-- Iteration 18 --
string(6) "012atm"
-- Iteration 19 --
string(6) "012atm"
-===DONE===
diff --git a/ext/standard/tests/strings/strtr_variation8.phpt b/ext/standard/tests/strings/strtr_variation8.phpt
index 8d29db1cc3..97d3163e21 100644
--- a/ext/standard/tests/strings/strtr_variation8.phpt
+++ b/ext/standard/tests/strings/strtr_variation8.phpt
@@ -75,10 +75,15 @@ $replace_pairs_arr = array (
// loop through with each element of the $replace_pairs array to test strtr() function
$count = 1;
for($index = 0; $index < count($replace_pairs_arr); $index++) {
- echo "\n-- Iteration $count --\n";
- $replace_pairs = $replace_pairs_arr[$index];
- var_dump( strtr($str, $replace_pairs) );
- $count ++;
+ echo "\n-- Iteration $count --\n";
+ $replace_pairs = $replace_pairs_arr[$index];
+ try {
+ var_dump(strtr($str, $replace_pairs));
+ } catch (TypeError $e) {
+ echo $e->getMessage() . "\n";
+ }
+
+ $count ++;
}
fclose($file_handle); //closing the file handle
@@ -89,34 +94,22 @@ echo "*** Done ***";
*** Testing strtr() function: with unexpected inputs for 'replace_pairs' ***
-- Iteration 1 --
-
-Warning: strtr(): The second argument is not an array in %s on line %d
-bool(false)
+If two arguments are passed, the second argument must be an array
-- Iteration 2 --
-
-Warning: strtr(): The second argument is not an array in %s on line %d
-bool(false)
+If two arguments are passed, the second argument must be an array
-- Iteration 3 --
-
-Warning: strtr(): The second argument is not an array in %s on line %d
-bool(false)
+If two arguments are passed, the second argument must be an array
-- Iteration 4 --
-
-Warning: strtr(): The second argument is not an array in %s on line %d
-bool(false)
+If two arguments are passed, the second argument must be an array
-- Iteration 5 --
-
-Warning: strtr(): The second argument is not an array in %s on line %d
-bool(false)
+If two arguments are passed, the second argument must be an array
-- Iteration 6 --
-
-Warning: strtr(): The second argument is not an array in %s on line %d
-bool(false)
+If two arguments are passed, the second argument must be an array
-- Iteration 7 --
string(6) "012atm"
@@ -128,52 +121,32 @@ string(6) "012atm"
string(6) "122atm"
-- Iteration 10 --
-
-Warning: strtr(): The second argument is not an array in %s on line %d
-bool(false)
+If two arguments are passed, the second argument must be an array
-- Iteration 11 --
-
-Warning: strtr(): The second argument is not an array in %s on line %d
-bool(false)
+If two arguments are passed, the second argument must be an array
-- Iteration 12 --
-
-Warning: strtr(): The second argument is not an array in %s on line %d
-bool(false)
+If two arguments are passed, the second argument must be an array
-- Iteration 13 --
-
-Warning: strtr(): The second argument is not an array in %s on line %d
-bool(false)
+If two arguments are passed, the second argument must be an array
-- Iteration 14 --
-
-Warning: strtr(): The second argument is not an array in %s on line %d
-bool(false)
+If two arguments are passed, the second argument must be an array
-- Iteration 15 --
-
-Warning: strtr(): The second argument is not an array in %s on line %d
-bool(false)
+If two arguments are passed, the second argument must be an array
-- Iteration 16 --
-
-Warning: strtr(): The second argument is not an array in %s on line %d
-bool(false)
+If two arguments are passed, the second argument must be an array
-- Iteration 17 --
-
-Warning: strtr(): The second argument is not an array in %s on line %d
-bool(false)
+strtr() expects parameter 2 to be string or array, resource given
-- Iteration 18 --
-
-Warning: strtr(): The second argument is not an array in %s on line %d
-bool(false)
+If two arguments are passed, the second argument must be an array
-- Iteration 19 --
-
-Warning: strtr(): The second argument is not an array in %s on line %d
-bool(false)
+If two arguments are passed, the second argument must be an array
*** Done ***
diff --git a/ext/standard/tests/strings/strval.phpt b/ext/standard/tests/strings/strval.phpt
index b837a079d4..8f01cbfc0b 100644
--- a/ext/standard/tests/strings/strval.phpt
+++ b/ext/standard/tests/strings/strval.phpt
@@ -22,5 +22,5 @@ string(3) "1.1"
string(1) "1"
string(0) ""
-Notice: Array to string conversion in %sstrval.php on line %d
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
diff --git a/ext/standard/tests/strings/strval_basic.phpt b/ext/standard/tests/strings/strval_basic.phpt
index 65f1c98366..9e26446c4c 100644
--- a/ext/standard/tests/strings/strval_basic.phpt
+++ b/ext/standard/tests/strings/strval_basic.phpt
@@ -18,23 +18,23 @@ EOT;
//array of values to iterate over
$values = array(
- // Simple strings
+ // Simple strings
/*1*/ "Hello World",
- 'Hello World',
+ 'Hello World',
- // String with control chars
+ // String with control chars
/*3*/ "String\nwith\ncontrol\ncharacters\r\n",
- // String with quotes
+ // String with quotes
/*4*/ "String with \"quotes\"",
- //Numeric String
+ //Numeric String
/*5*/ "123456",
- // Hexadecimal string
+ // Hexadecimal string
/*6*/ "0xABC",
- //Heredoc String
+ //Heredoc String
/*7*/ $simple_heredoc
);
@@ -46,7 +46,6 @@ foreach($values as $value) {
$iterator++;
};
?>
-===DONE===
--EXPECT--
*** Testing strval() : basic variations ***
@@ -74,4 +73,3 @@ string(5) "0xABC"
-- Iteration 7 --
string(21) "Simple HEREDOC string"
-===DONE===
diff --git a/ext/standard/tests/strings/strval_error.phpt b/ext/standard/tests/strings/strval_error.phpt
index 4e1ece6016..a363e26f24 100644
--- a/ext/standard/tests/strings/strval_error.phpt
+++ b/ext/standard/tests/strings/strval_error.phpt
@@ -13,20 +13,9 @@ error_reporting(E_ALL ^ E_NOTICE);
class MyClass
{
- // no toString() method defined
+ // no toString() method defined
}
-$string = "Hello";
-$extra_arg = 10;
-
-//Test strval with one more than the expected number of arguments
-echo "\n-- Testing strval() function with more than expected no. of arguments --\n";
-var_dump( strval($string, $extra_arg) );
-
-// Testing strval with one less than the expected number of arguments
-echo "\n-- Testing strval() function with less than expected no. of arguments --\n";
-var_dump( strval() );
-
// Testing strval with a object which has no toString() method
echo "\n-- Testing strval() function with object which has not toString() method --\n";
try {
@@ -36,20 +25,8 @@ try {
}
?>
-===DONE===
--EXPECTF--
*** Testing strval() : error conditions ***
--- Testing strval() function with more than expected no. of arguments --
-
-Warning: strval() expects exactly 1 parameter, 2 given in %s on line %d
-NULL
-
--- Testing strval() function with less than expected no. of arguments --
-
-Warning: strval() expects exactly 1 parameter, 0 given in %s on line %d
-NULL
-
-- Testing strval() function with object which has not toString() method --
Object of class MyClass could not be converted to string
-===DONE===
diff --git a/ext/standard/tests/strings/strval_variation1.phpt b/ext/standard/tests/strings/strval_variation1.phpt
index 5918c286e2..d64a7c4ab0 100644
--- a/ext/standard/tests/strings/strval_variation1.phpt
+++ b/ext/standard/tests/strings/strval_variation1.phpt
@@ -9,8 +9,6 @@ Test strval() function : usage variations - Pass different data types as strval
echo "*** Testing strval() : usage variations ***\n";
-error_reporting(E_ALL ^ E_NOTICE);
-
//get an unset variable
$unset_var = 10;
unset ($unset_var);
@@ -27,59 +25,59 @@ class MyClass
//array of values to iterate over
$values = array(
- //Decimal values
+ //Decimal values
/*1*/ 0,
- 1,
- 12345,
- -12345,
+ 1,
+ 12345,
+ -12345,
- //Octal values
+ //Octal values
/*5*/ 02,
- 010,
- 030071,
- -030071,
+ 010,
+ 030071,
+ -030071,
- //Hexadecimal values
+ //Hexadecimal values
/*9*/ 0x0,
- 0x1,
- 0xABCD,
- -0xABCD,
+ 0x1,
+ 0xABCD,
+ -0xABCD,
- // float data
+ // float data
/*13*/ 100.5,
- -100.5,
- 100.1234567e10,
- 100.7654321E-10,
- .5,
+ -100.5,
+ 100.1234567e10,
+ 100.7654321E-10,
+ .5,
- // array data
+ // array data
/*18*/ array(),
- array('color' => 'red', 'item' => 'pen'),
+ array('color' => 'red', 'item' => 'pen'),
- // null data
+ // null data
/*20*/ NULL,
- null,
+ null,
- // boolean data
+ // boolean data
/*22*/ true,
- false,
- TRUE,
- FALSE,
+ false,
+ TRUE,
+ FALSE,
- // empty data
+ // empty data
/*26*/ "",
- '',
+ '',
- // object data
+ // object data
/*28*/ new MyClass(),
- // resource
+ // resource
/*29*/ $file_handle,
- // undefined data
+ // undefined data
/*30*/ @$undefined_var,
- // unset data
+ // unset data
/*31*/ @$unset_var,
);
@@ -91,7 +89,6 @@ foreach($values as $value) {
$iterator++;
};
?>
-===DONE===
--EXPECTF--
*** Testing strval() : usage variations ***
@@ -147,9 +144,13 @@ string(14) "1.007654321E-8"
string(3) "0.5"
-- Iteration 18 --
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
-- Iteration 19 --
+
+Warning: Array to string conversion in %s on line %d
string(5) "Array"
-- Iteration 20 --
@@ -187,4 +188,3 @@ string(0) ""
-- Iteration 31 --
string(0) ""
-===DONE===
diff --git a/ext/standard/tests/strings/strval_variation2.phpt b/ext/standard/tests/strings/strval_variation2.phpt
index 3fa99f7718..cf635294d0 100644
--- a/ext/standard/tests/strings/strval_variation2.phpt
+++ b/ext/standard/tests/strings/strval_variation2.phpt
@@ -60,7 +60,6 @@ echo bin2hex(strval($sf));
echo "\n";
?>
-===DONE===
--EXPECT--
*** Testing strval() : usage variations - Pass all valid char codes ***
000102030405060708090a0b0c0d0e0f
@@ -79,4 +78,3 @@ c0c1c2c3c4c5c6c7c8c9cacbcccdcecf
d0d1d2d3d4d5d6d7d8d9dadbdcdddedf
e0e1e2e3e4e5e6e7e8e9eaebecedeeef
f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
-===DONE===
diff --git a/ext/standard/tests/strings/substr.phpt b/ext/standard/tests/strings/substr.phpt
index 0901d2082e..fe687ed1ae 100644
--- a/ext/standard/tests/strings/substr.phpt
+++ b/ext/standard/tests/strings/substr.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/substr_compare.phpt b/ext/standard/tests/strings/substr_compare.phpt
index f1edf0afdf..52de7fe394 100644
--- a/ext/standard/tests/strings/substr_compare.phpt
+++ b/ext/standard/tests/strings/substr_compare.phpt
@@ -4,6 +4,7 @@ substr_compare()
<?php
var_dump(substr_compare("abcde", "df", -2) < 0);
+var_dump(substr_compare("abcde", "df", -2, null) < 0);
var_dump(substr_compare("abcde", "bc", 1, 2));
var_dump(substr_compare("abcde", "bcg", 1, 2));
var_dump(substr_compare("abcde", "BC", 1, 2, true));
@@ -12,15 +13,17 @@ var_dump(substr_compare("abcde", "cd", 1, 2) < 0);
var_dump(substr_compare("abcde", "abc", 5, 1));
var_dump(substr_compare("abcde", "abcdef", -10, 10) < 0);
var_dump(substr_compare("abcde", "abc", 0, 0));
-var_dump(substr_compare("abcde", -1, 0, NULL, new stdClass));
echo "Test\n";
-var_dump(substr_compare("abcde", "abc", 0, -1));
-var_dump(substr_compare("abcde", "abc", -1, NULL, -5) > 0);
-var_dump(substr_compare("abcde", -1, 0, "str", new stdClass));
-echo "Done\n";
+try {
+ substr_compare("abcde", "abc", 0, -1);
+} catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+}
+var_dump(substr_compare("abcde", "abc", -1, NULL, -5) > 0);
?>
---EXPECTF--
+--EXPECT--
+bool(true)
bool(true)
int(0)
int(0)
@@ -30,15 +33,6 @@ bool(true)
int(-1)
bool(true)
int(0)
-
-Warning: substr_compare() expects parameter 5 to be bool, object given in %s on line %d
-bool(false)
Test
-
-Warning: substr_compare(): The length must be greater than or equal to zero in %s on line %d
-bool(false)
+The length must be greater than or equal to zero
bool(true)
-
-Warning: substr_compare() expects parameter 4 to be int, string given in %s on line %d
-bool(false)
-Done
diff --git a/ext/standard/tests/strings/substr_count_basic.phpt b/ext/standard/tests/strings/substr_count_basic.phpt
index 4023a774d8..df77bfd721 100644
--- a/ext/standard/tests/strings/substr_count_basic.phpt
+++ b/ext/standard/tests/strings/substr_count_basic.phpt
@@ -4,38 +4,47 @@ Test substr_count() function (basic)
<?php
echo "***Testing basic operations ***\n";
-var_dump(@substr_count("", ""));
-var_dump(@substr_count("a", ""));
-var_dump(@substr_count("", "a"));
-var_dump(@substr_count("", "a"));
-var_dump(@substr_count("", chr(0)));
+try {
+ substr_count("", "");
+} catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+}
+try {
+ substr_count("a", "");
+} catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+}
+var_dump(substr_count("", "a"));
+var_dump(substr_count("", "a"));
+var_dump(substr_count("", chr(0)));
$a = str_repeat("abcacba", 100);
-var_dump(@substr_count($a, "bca"));
+var_dump(substr_count($a, "bca"));
$a = str_repeat("abcacbabca", 100);
-var_dump(@substr_count($a, "bca"));
+var_dump(substr_count($a, "bca"));
var_dump(substr_count($a, "bca", 200));
+var_dump(substr_count($a, "bca", 200, null));
var_dump(substr_count($a, "bca", 200, 50));
var_dump(substr_count($a, "bca", -200));
+var_dump(substr_count($a, "bca", -200, null));
var_dump(substr_count($a, "bca", -200, 50));
var_dump(substr_count($a, "bca", -200, -50));
-echo "Done\n";
-
?>
--EXPECT--
***Testing basic operations ***
-bool(false)
-bool(false)
+Empty substring
+Empty substring
int(0)
int(0)
int(0)
int(100)
int(200)
int(160)
+int(160)
int(10)
int(40)
+int(40)
int(10)
int(30)
-Done
diff --git a/ext/standard/tests/strings/substr_count_error.phpt b/ext/standard/tests/strings/substr_count_error.phpt
index eecc251e6c..9bdb3843eb 100644
--- a/ext/standard/tests/strings/substr_count_error.phpt
+++ b/ext/standard/tests/strings/substr_count_error.phpt
@@ -6,25 +6,24 @@ Test substr_count() function (error conditions)
echo "\n*** Testing error conditions ***\n";
$str = 'abcdefghik';
-/* Zero argument */
-var_dump( substr_count() );
-
-/* more than expected no. of args */
-var_dump( substr_count($str, "t", 0, 15, 30) );
-
/* offset before start */
-var_dump(substr_count($str, "t", -20));
+try {
+ substr_count($str, "t", -20);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
/* offset > size of the string */
-var_dump(substr_count($str, "t", 25));
+try {
+ substr_count($str, "t", 25);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
/* Using offset and length to go beyond the size of the string:
Warning message expected, as length+offset > length of string */
var_dump( substr_count($str, "i", 5, 7) );
-/* Invalid offset argument */
-var_dump( substr_count($str, "t", "") );
-
/* length too small */
var_dump( substr_count($str, "t", 2, -20) );
@@ -33,25 +32,12 @@ echo "Done\n";
?>
--EXPECTF--
*** Testing error conditions ***
-
-Warning: substr_count() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: substr_count() expects at most 4 parameters, 5 given in %s on line %d
-NULL
-
-Warning: substr_count(): Offset not contained in string in %s on line %d
-bool(false)
-
-Warning: substr_count(): Offset not contained in string in %s on line %d
-bool(false)
+Offset not contained in string
+Offset not contained in string
Warning: substr_count(): Invalid length value in %s on line %d
bool(false)
-Warning: substr_count() expects parameter 3 to be int, string given in %s on line %d
-NULL
-
Warning: substr_count(): Invalid length value in %s on line %d
bool(false)
Done
diff --git a/ext/standard/tests/strings/substr_count_variation_001.phpt b/ext/standard/tests/strings/substr_count_variation_001.phpt
index 71f2d223e1..19a9a0310d 100644
--- a/ext/standard/tests/strings/substr_count_variation_001.phpt
+++ b/ext/standard/tests/strings/substr_count_variation_001.phpt
@@ -12,9 +12,6 @@ var_dump( substr_count($str, "i", "5t") );
var_dump( substr_count($str, "i", "5t", "10t") );
echo "\n-- 3rd or 4th arg as NULL --\n";
-var_dump( substr_count($str, "t", "") );
-var_dump( substr_count($str, "T", "") );
-var_dump( substr_count($str, "t", "", 15) );
var_dump( substr_count($str, "I", NULL) );
var_dump( substr_count($str, "i", NULL, 10) );
@@ -67,15 +64,6 @@ Notice: A non well formed numeric value encountered in %s on line %d
int(2)
-- 3rd or 4th arg as NULL --
-
-Warning: substr_count() expects parameter 3 to be int, string given %s on line %d
-NULL
-
-Warning: substr_count() expects parameter 3 to be int, string given %s on line %d
-NULL
-
-Warning: substr_count() expects parameter 3 to be int, string given %s on line %d
-NULL
int(0)
int(2)
diff --git a/ext/standard/tests/strings/substr_replace_error.phpt b/ext/standard/tests/strings/substr_replace_error.phpt
index ac945349fe..5e22fccb88 100644
--- a/ext/standard/tests/strings/substr_replace_error.phpt
+++ b/ext/standard/tests/strings/substr_replace_error.phpt
@@ -15,13 +15,6 @@ echo "*** Testing substr_replace() : error conditions ***\n";
$s1 = "Good morning";
-echo "\n-- Testing substr_replace() function with less than expected no. of arguments --\n";
-var_dump(substr_replace());
-var_dump(substr_replace($s1, "evening"));
-
-echo "\n-- Testing substr_replace() function with more than expected no. of arguments --\n";
-var_dump(substr_replace($s1, "evening", 5, 7, true));
-
echo "\n-- Testing substr_replace() function with start and length different types --\n";
var_dump(substr_replace($s1, "evening", array(5)));
var_dump(substr_replace($s1, "evening", 5, array(8)));
@@ -33,23 +26,9 @@ echo "\n-- Testing substr_replace() function with start and length as arrays but
var_dump(substr_replace($s1, "evening", array(5), array(8)));
?>
-===DONE===
--EXPECTF--
*** Testing substr_replace() : error conditions ***
--- Testing substr_replace() function with less than expected no. of arguments --
-
-Warning: substr_replace() expects at least 3 parameters, 0 given in %s on line %d
-NULL
-
-Warning: substr_replace() expects at least 3 parameters, 2 given in %s on line %d
-NULL
-
--- Testing substr_replace() function with more than expected no. of arguments --
-
-Warning: substr_replace() expects at most 4 parameters, 5 given in %s on line %d
-NULL
-
-- Testing substr_replace() function with start and length different types --
Warning: substr_replace(): 'start' and 'length' should be of same type - numerical or array in %s on line %d
@@ -67,4 +46,3 @@ string(12) "Good morning"
Warning: substr_replace(): Functionality of 'start' and 'length' as arrays is not implemented in %s on line %d
string(12) "Good morning"
-===DONE===
diff --git a/ext/standard/tests/strings/trim1.phpt b/ext/standard/tests/strings/trim1.phpt
index d0e4070d80..1ad504c61d 100644
--- a/ext/standard/tests/strings/trim1.phpt
+++ b/ext/standard/tests/strings/trim1.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/trim_basic.phpt b/ext/standard/tests/strings/trim_basic.phpt
index 08f75846a5..53fd4c7cc3 100644
--- a/ext/standard/tests/strings/trim_basic.phpt
+++ b/ext/standard/tests/strings/trim_basic.phpt
@@ -27,7 +27,6 @@ echo "\n-- Trim the ASCII control characters at the beginning of a string --\n";
var_dump(trim($binary, "\x00..\x1F"));
?>
-===DONE===
--EXPECT--
*** Testing trim() : basic functionality ***
@@ -42,4 +41,3 @@ string(19) "!===Hello World===!"
-- Trim the ASCII control characters at the beginning of a string --
string(14) "Example string"
-===DONE===
diff --git a/ext/standard/tests/strings/trim_error.phpt b/ext/standard/tests/strings/trim_error.phpt
index b845cee1ac..c9b92bc5c9 100644
--- a/ext/standard/tests/strings/trim_error.phpt
+++ b/ext/standard/tests/strings/trim_error.phpt
@@ -11,14 +11,6 @@ Test trim() function : error conditions
echo "*** Testing trim() : error conditions ***\n";
-echo "\n-- Testing trim() function with no arguments --\n";
-var_dump( trim() );
-
-echo "\n-- Testing trim() function with more than expected no. of arguments --\n";
-$extra_arg = 10;
-var_dump( trim("Hello World", "Heo", $extra_arg) );
-
-
$hello = " Hello World\n";
echo "\n-- Test trim function with various invalid charlists --\n";
var_dump(trim($hello, "..a"));
@@ -27,20 +19,9 @@ var_dump(trim($hello, "z..a"));
var_dump(trim($hello, "a..b..c"));
?>
-===DONE===
--EXPECTF--
*** Testing trim() : error conditions ***
--- Testing trim() function with no arguments --
-
-Warning: trim() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
--- Testing trim() function with more than expected no. of arguments --
-
-Warning: trim() expects at most 2 parameters, 3 given in %s on line %d
-NULL
-
-- Test trim function with various invalid charlists --
Warning: trim(): Invalid '..'-range, no character to the left of '..' in %s on line %d
@@ -58,4 +39,3 @@ string(14) " Hello World
Warning: trim(): Invalid '..'-range in %s on line %d
string(14) " Hello World
"
-===DONE===
diff --git a/ext/standard/tests/strings/ucfirst.phpt b/ext/standard/tests/strings/ucfirst.phpt
index b524b45e59..e7c0373a3c 100644
--- a/ext/standard/tests/strings/ucfirst.phpt
+++ b/ext/standard/tests/strings/ucfirst.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/ucwords_basic.phpt b/ext/standard/tests/strings/ucwords_basic.phpt
index e35a2c5cb4..4567c3b499 100644
--- a/ext/standard/tests/strings/ucwords_basic.phpt
+++ b/ext/standard/tests/strings/ucwords_basic.phpt
@@ -9,7 +9,7 @@ Test ucwords() function : basic functionality
echo "*** Testing ucwords() : basic functionality ***\n";
-// lines with different whitespace charecter
+// lines with different whitespace character
$str_array = array(
"testing ucwords",
'testing ucwords',
diff --git a/ext/standard/tests/strings/unpack.phpt b/ext/standard/tests/strings/unpack.phpt
index 3a6068be71..435361cca5 100644
--- a/ext/standard/tests/strings/unpack.phpt
+++ b/ext/standard/tests/strings/unpack.phpt
@@ -2,8 +2,8 @@
Invalid format type validation
--FILE--
<?php
- var_dump(unpack("-2222", 1));
- echo "Done\n";
+ var_dump(unpack("-2222", 1));
+ echo "Done\n";
?>
--EXPECTF--
Warning: unpack(): Invalid format type - in %sunpack.php on line %d
diff --git a/ext/standard/tests/strings/unpack_bug68225.phpt b/ext/standard/tests/strings/unpack_bug68225.phpt
index b02b0383bf..c3d1692c37 100644
--- a/ext/standard/tests/strings/unpack_bug68225.phpt
+++ b/ext/standard/tests/strings/unpack_bug68225.phpt
@@ -15,7 +15,6 @@ $result = unpack('V1a/X4/V1b/V1c/X4/V1d', $data);
var_dump($result);
?>
-===DONE===
--EXPECT--
array(1) {
["a"]=>
@@ -35,4 +34,3 @@ array(4) {
["d"]=>
int(2)
}
-===DONE===
diff --git a/ext/standard/tests/strings/unpack_error.phpt b/ext/standard/tests/strings/unpack_error.phpt
index f04e493772..9308eef25e 100644
--- a/ext/standard/tests/strings/unpack_error.phpt
+++ b/ext/standard/tests/strings/unpack_error.phpt
@@ -10,33 +10,14 @@ Test unpack() function : error conditions
echo "*** Testing unpack() : error conditions ***\n";
-echo "\n-- Testing unpack() function with no arguments --\n";
-var_dump( unpack() );
-
-echo "\n-- Testing unpack() function with more than expected no. of arguments --\n";
-$extra_arg = 10;
-var_dump(unpack("I", pack("I", 65534), 0, $extra_arg));
-
echo "\n-- Testing unpack() function with invalid format character --\n";
$extra_arg = 10;
var_dump(unpack("B", pack("I", 65534)));
?>
-===DONE===
--EXPECTF--
*** Testing unpack() : error conditions ***
--- Testing unpack() function with no arguments --
-
-Warning: unpack() expects at least 2 parameters, 0 given in %s on line %d
-NULL
-
--- Testing unpack() function with more than expected no. of arguments --
-
-Warning: unpack() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-
-- Testing unpack() function with invalid format character --
Warning: unpack(): Invalid format type B in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/standard/tests/strings/unpack_offset.phpt b/ext/standard/tests/strings/unpack_offset.phpt
index 64cb089bc3..451dd36724 100644
--- a/ext/standard/tests/strings/unpack_offset.phpt
+++ b/ext/standard/tests/strings/unpack_offset.phpt
@@ -8,8 +8,8 @@ $a = unpack("l2", $data, 3);
printf("0x%08x 0x%08x\n", $a[1], $a[2]);
printf("0x%08x 0x%08x\n",
- unpack("l", $data, 3)[1],
- unpack("@4/l", $data, 3)[1]);
+ unpack("l", $data, 3)[1],
+ unpack("@4/l", $data, 3)[1]);
?>
--EXPECT--
0x01020304 0x05060708
diff --git a/ext/standard/tests/strings/url_t.phpt b/ext/standard/tests/strings/url_t.phpt
index 79ff3bc4a8..caa93cb9cf 100644
--- a/ext/standard/tests/strings/url_t.phpt
+++ b/ext/standard/tests/strings/url_t.phpt
@@ -81,7 +81,7 @@ $sample_urls = array (
$url = 'http://secret:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123';
foreach (array(PHP_URL_SCHEME,PHP_URL_HOST,PHP_URL_PORT,PHP_URL_USER,PHP_URL_PASS,PHP_URL_PATH,PHP_URL_QUERY,PHP_URL_FRAGMENT) as $v) {
- var_dump(parse_url($url, $v));
+ var_dump(parse_url($url, $v));
}
?>
--EXPECT--
@@ -213,30 +213,36 @@ $sample_urls = array (
string(10) "/index.php"
}
---> www.php.net/?: array(1) {
+--> www.php.net/?: array(2) {
["path"]=>
string(12) "www.php.net/"
+ ["query"]=>
+ string(0) ""
}
---> www.php.net:80/?: array(3) {
+--> www.php.net:80/?: array(4) {
["host"]=>
string(11) "www.php.net"
["port"]=>
int(80)
["path"]=>
string(1) "/"
+ ["query"]=>
+ string(0) ""
}
---> http://www.php.net/?: array(3) {
+--> http://www.php.net/?: array(4) {
["scheme"]=>
string(4) "http"
["host"]=>
string(11) "www.php.net"
["path"]=>
string(1) "/"
+ ["query"]=>
+ string(0) ""
}
---> http://www.php.net:80/?: array(4) {
+--> http://www.php.net:80/?: array(5) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -245,6 +251,8 @@ $sample_urls = array (
int(80)
["path"]=>
string(1) "/"
+ ["query"]=>
+ string(0) ""
}
--> http://www.php.net:80/index.php: array(4) {
@@ -359,7 +367,7 @@ $sample_urls = array (
string(10) "/index.php"
}
---> http://www.php.net:80/index.php?: array(4) {
+--> http://www.php.net:80/index.php?: array(5) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -368,6 +376,8 @@ $sample_urls = array (
int(80)
["path"]=>
string(10) "/index.php"
+ ["query"]=>
+ string(0) ""
}
--> http://www.php.net:80/#foo: array(5) {
@@ -383,7 +393,7 @@ $sample_urls = array (
string(3) "foo"
}
---> http://www.php.net:80/?#: array(4) {
+--> http://www.php.net:80/?#: array(6) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -392,6 +402,10 @@ $sample_urls = array (
int(80)
["path"]=>
string(1) "/"
+ ["query"]=>
+ string(0) ""
+ ["fragment"]=>
+ string(0) ""
}
--> http://www.php.net:80/?test=1: array(5) {
diff --git a/ext/standard/tests/strings/uuencode.phpt b/ext/standard/tests/strings/uuencode.phpt
index 5a1f3d2a24..8199a2ed05 100644
--- a/ext/standard/tests/strings/uuencode.phpt
+++ b/ext/standard/tests/strings/uuencode.phpt
@@ -3,9 +3,6 @@ uuencode family tests
--FILE--
<?php
-var_dump(convert_uuencode(array()));
-var_dump(convert_uudecode(array()));
-
var_dump(convert_uuencode(""));
var_dump(convert_uudecode(""));
var_dump($enc = convert_uuencode("~!@#$%^&*()_}{POIUYTREWQQSDFGHJKL:<MNBVCXZ"));
@@ -18,11 +15,6 @@ var_dump(convert_uudecode(substr($enc, 0, -10)));
echo "Done\n";
?>
--EXPECTF--
-Warning: convert_uuencode() expects parameter 1 to be string, array given in %s on line %d
-bool(false)
-
-Warning: convert_uudecode() expects parameter 1 to be string, array given in %s on line %d
-bool(false)
bool(false)
bool(false)
string(60) "J?B%`(R0E7B8J*"E??7M03TE5651215=145-$1D=(2DM,.CQ-3D)60UA:
diff --git a/ext/standard/tests/strings/vfprintf_basic.phpt b/ext/standard/tests/strings/vfprintf_basic.phpt
index 30cd5348bf..3219371594 100644
--- a/ext/standard/tests/strings/vfprintf_basic.phpt
+++ b/ext/standard/tests/strings/vfprintf_basic.phpt
@@ -14,12 +14,12 @@ precision=14
function writeAndDump($fp, $format, $args)
{
- ftruncate( $fp, 0 );
- $length = vfprintf( $fp, $format, $args );
- rewind( $fp );
- $content = stream_get_contents( $fp );
- var_dump( $content );
- var_dump( $length );
+ ftruncate( $fp, 0 );
+ $length = vfprintf( $fp, $format, $args );
+ rewind( $fp );
+ $content = stream_get_contents( $fp );
+ var_dump( $content );
+ var_dump( $length );
}
echo "*** Testing vfprintf() : basic functionality ***\n";
@@ -42,7 +42,6 @@ writeAndDump( $fp, "Testing %b %d %f %s %x %X", array( 9, 6, 2.5502, "foobar", 1
fclose( $fp );
?>
-===DONE===
--CLEAN--
<?php
@@ -68,4 +67,3 @@ string(2) "50"
int(2)
string(35) "Testing 1001 6 2.550200 foobar f 41"
int(35)
-===DONE===
diff --git a/ext/standard/tests/strings/vfprintf_basic1.phpt b/ext/standard/tests/strings/vfprintf_basic1.phpt
index aa8d2eb850..0c64784bc4 100644
--- a/ext/standard/tests/strings/vfprintf_basic1.phpt
+++ b/ext/standard/tests/strings/vfprintf_basic1.phpt
@@ -37,7 +37,6 @@ print_r(file_get_contents($data_file));
unlink($data_file);
?>
-===DONE===
--EXPECT--
*** Testing vfprintf() : basic functionality - using string format ***
int(4)
@@ -46,4 +45,3 @@ int(14)
one
one two
one two three
-===DONE===
diff --git a/ext/standard/tests/strings/vfprintf_basic2.phpt b/ext/standard/tests/strings/vfprintf_basic2.phpt
index 4593dbb1b6..770b41b5bc 100644
--- a/ext/standard/tests/strings/vfprintf_basic2.phpt
+++ b/ext/standard/tests/strings/vfprintf_basic2.phpt
@@ -42,10 +42,8 @@ print_r(file_get_contents($data_file));
unlink($data_file);
?>
-===DONE===
--EXPECT--
*** Testing vfprintf() : basic functionality - using integer format ***
111
111 222
111 222 333
-===DONE===
diff --git a/ext/standard/tests/strings/vfprintf_basic3.phpt b/ext/standard/tests/strings/vfprintf_basic3.phpt
index b303f196f8..142a7fdaa7 100644
--- a/ext/standard/tests/strings/vfprintf_basic3.phpt
+++ b/ext/standard/tests/strings/vfprintf_basic3.phpt
@@ -51,7 +51,6 @@ print_r(file_get_contents($data_file));
unlink($data_file);
?>
-===DONE===
--EXPECT--
*** Testing vfprintf() : basic functionality - using float format ***
11.110000
@@ -60,4 +59,3 @@ unlink($data_file);
11.110000 22.220000
11.110000 22.220000 33.330000
11.110000 22.220000 33.330000
-===DONE===
diff --git a/ext/standard/tests/strings/vfprintf_basic4.phpt b/ext/standard/tests/strings/vfprintf_basic4.phpt
index a0780c160b..c698c9776d 100644
--- a/ext/standard/tests/strings/vfprintf_basic4.phpt
+++ b/ext/standard/tests/strings/vfprintf_basic4.phpt
@@ -37,10 +37,8 @@ print_r(file_get_contents($data_file));
unlink($data_file);
?>
-===DONE===
--EXPECT--
*** Testing vfprintf() : basic functionality - using bool format ***
1
1 0
1 0 1
-===DONE===
diff --git a/ext/standard/tests/strings/vfprintf_basic5.phpt b/ext/standard/tests/strings/vfprintf_basic5.phpt
index 56dd2c67fc..be35af7809 100644
--- a/ext/standard/tests/strings/vfprintf_basic5.phpt
+++ b/ext/standard/tests/strings/vfprintf_basic5.phpt
@@ -37,10 +37,8 @@ print_r(file_get_contents($data_file));
unlink($data_file);
?>
-===DONE===
--EXPECT--
*** Testing vfprintf() : basic functionality - using char format ***
A
A B
A B C
-===DONE===
diff --git a/ext/standard/tests/strings/vfprintf_basic6.phpt b/ext/standard/tests/strings/vfprintf_basic6.phpt
index 0590810e31..9cc0bc6a7a 100644
--- a/ext/standard/tests/strings/vfprintf_basic6.phpt
+++ b/ext/standard/tests/strings/vfprintf_basic6.phpt
@@ -39,10 +39,8 @@ print_r(file_get_contents($data_file));
unlink($data_file);
?>
-===DONE===
--EXPECT--
*** Testing vfprintf() : basic functionality - using exponential format ***
1.000000e+3
1.000000e+3 2.000000e+3
1.000000e+3 2.000000e+3 3.000000e+3
-===DONE===
diff --git a/ext/standard/tests/strings/vfprintf_basic7.phpt b/ext/standard/tests/strings/vfprintf_basic7.phpt
index f7cc0ed0b3..f1c36768e0 100644
--- a/ext/standard/tests/strings/vfprintf_basic7.phpt
+++ b/ext/standard/tests/strings/vfprintf_basic7.phpt
@@ -42,10 +42,8 @@ print_r(file_get_contents($data_file));
unlink($data_file);
?>
-===DONE===
--EXPECT--
*** Testing vfprintf() : basic functionality - using unsigned format ***
4294966185
4294966185 4293732729
4294966185 4293732729 4292621864
-===DONE===
diff --git a/ext/standard/tests/strings/vfprintf_basic7_64bit.phpt b/ext/standard/tests/strings/vfprintf_basic7_64bit.phpt
index 3587792d81..54df744ff8 100644
--- a/ext/standard/tests/strings/vfprintf_basic7_64bit.phpt
+++ b/ext/standard/tests/strings/vfprintf_basic7_64bit.phpt
@@ -42,10 +42,8 @@ print_r(file_get_contents($data_file));
unlink($data_file);
?>
-===DONE===
--EXPECT--
*** Testing vfprintf() : basic functionality - using unsigned format ***
18446744073709550505
18446744073709550505 18446744073708317049
18446744073709550505 18446744073708317049 18446744073707206184
-===DONE===
diff --git a/ext/standard/tests/strings/vfprintf_basic8.phpt b/ext/standard/tests/strings/vfprintf_basic8.phpt
index ced87284f8..a5ac35600e 100644
--- a/ext/standard/tests/strings/vfprintf_basic8.phpt
+++ b/ext/standard/tests/strings/vfprintf_basic8.phpt
@@ -37,10 +37,8 @@ print_r(file_get_contents($data_file));
unlink($data_file);
?>
-===DONE===
--EXPECT--
*** Testing vfprintf() : basic functionality - using octal format ***
21
21 347
21 347 567
-===DONE===
diff --git a/ext/standard/tests/strings/vfprintf_basic9.phpt b/ext/standard/tests/strings/vfprintf_basic9.phpt
index db98c442e8..81cc8e0d9a 100644
--- a/ext/standard/tests/strings/vfprintf_basic9.phpt
+++ b/ext/standard/tests/strings/vfprintf_basic9.phpt
@@ -48,7 +48,6 @@ print_r(file_get_contents($data_file));
unlink($data_file);
?>
-===DONE===
--EXPECT--
*** Testing vfprintf) : basic functionality - using hexadecimal format ***
b
@@ -57,4 +56,3 @@ b 84
B 84
b 84 b1
B 84 B1
-===DONE===
diff --git a/ext/standard/tests/strings/vfprintf_error1.phpt b/ext/standard/tests/strings/vfprintf_error1.phpt
index c56631ecd7..f2057ea388 100644
--- a/ext/standard/tests/strings/vfprintf_error1.phpt
+++ b/ext/standard/tests/strings/vfprintf_error1.phpt
@@ -20,14 +20,21 @@ echo "\n-- Testing vfprintf() function with more than expected no. of arguments
$format = 'string_val';
$args = array( 1, 2 );
$extra_arg = 10;
-var_dump( vfprintf( $fp, $format, $args, $extra_arg ) );
-var_dump( vfprintf( $fp, "Foo %d", array(6), "bar" ) );
+try {
+ var_dump( vfprintf( $fp, $format, $args, $extra_arg ) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump( vfprintf( $fp, "Foo %d", array(6), "bar" ) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
// Close handle
fclose($fp);
?>
-===DONE===
--CLEAN--
<?php
@@ -37,10 +44,5 @@ unlink( $file );
?>
--EXPECTF--
-- Testing vfprintf() function with more than expected no. of arguments --
-
-Warning: Wrong parameter count for vfprintf() in %s on line %d
-NULL
-
-Warning: Wrong parameter count for vfprintf() in %s on line %d
-NULL
-===DONE===
+Wrong parameter count for vfprintf()
+Wrong parameter count for vfprintf()
diff --git a/ext/standard/tests/strings/vfprintf_error3.phpt b/ext/standard/tests/strings/vfprintf_error3.phpt
index 8be51e1798..0496d9b19c 100644
--- a/ext/standard/tests/strings/vfprintf_error3.phpt
+++ b/ext/standard/tests/strings/vfprintf_error3.phpt
@@ -17,12 +17,11 @@ $file = 'vfprintf_error3.txt';
$fp = fopen( $file, "a+" );
echo "\n-- Testing vfprintf() function with wrong variable types as argument --\n";
-var_dump( vfprintf( $fp, array( 'foo %d', 'bar %s' ), 3.55552 ) );
-
-rewind( $fp );
-var_dump( stream_get_contents( $fp ) );
-ftruncate( $fp, 0 );
-rewind( $fp );
+try {
+ vfprintf($fp, array( 'foo %d', 'bar %s' ), 3.55552);
+} catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+}
var_dump( vfprintf( $fp, "Foo %y fake", "not available" ) );
@@ -35,7 +34,6 @@ rewind( $fp );
fclose( $fp );
?>
-===DONE===
--CLEAN--
<?php
@@ -43,12 +41,8 @@ $file = 'vfprintf_error3.txt';
unlink( $file );
?>
---EXPECTF--
+--EXPECT--
-- Testing vfprintf() function with wrong variable types as argument --
-
-Notice: Array to string conversion in %s on line %d
-int(5)
-string(5) "Array"
+vfprintf() expects parameter 2 to be string, array given
int(9)
string(9) "Foo fake"
-===DONE===
diff --git a/ext/standard/tests/strings/vfprintf_error4.phpt b/ext/standard/tests/strings/vfprintf_error4.phpt
index 2865d42a9e..53eba8f415 100644
--- a/ext/standard/tests/strings/vfprintf_error4.phpt
+++ b/ext/standard/tests/strings/vfprintf_error4.phpt
@@ -17,14 +17,20 @@ $file = 'vfprintf_error4.txt';
$fp = fopen( $file, "a+" );
echo "\n-- Testing vfprintf() function with other strangeties --\n";
-var_dump( vfprintf( 'foo', 'bar', array( 'baz' ) ) );
-var_dump( vfprintf( $fp, 'Foo %$c-0202Sd', array( 2 ) ) );
-
+try {
+ var_dump( vfprintf( 'foo', 'bar', array( 'baz' ) ) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump( vfprintf( $fp, 'Foo %$c-0202Sd', array( 2 ) ) );
+} catch(\ValueError $e) {
+ print('Error found: '.$e->getMessage().".\n");
+}
// Close handle
fclose( $fp );
?>
-===DONE===
--CLEAN--
<?php
@@ -34,10 +40,5 @@ unlink( $file );
?>
--EXPECTF--
-- Testing vfprintf() function with other strangeties --
-
-Warning: vfprintf() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
-
-Warning: vfprintf(): Argument number must be greater than zero in %s on line %d
-bool(false)
-===DONE===
+vfprintf() expects parameter 1 to be resource, string given
+Error found: Argument number must be greater than zero.
diff --git a/ext/standard/tests/strings/vfprintf_variation1.phpt b/ext/standard/tests/strings/vfprintf_variation1.phpt
index 76422011c2..d7120e41c0 100644
--- a/ext/standard/tests/strings/vfprintf_variation1.phpt
+++ b/ext/standard/tests/strings/vfprintf_variation1.phpt
@@ -23,21 +23,21 @@ unset( $funset );
class FooClass
{
- public function __toString()
- {
- return "Object";
- }
+ public function __toString()
+ {
+ return "Object";
+ }
}
// Output facilitating function
function writeAndDump($fp, $format, $args)
{
- ftruncate( $fp, 0 );
- $length = vfprintf( $fp, $format, $args );
- rewind( $fp );
- $content = stream_get_contents( $fp );
- var_dump( $content );
- var_dump( $length );
+ ftruncate( $fp, 0 );
+ $length = vfprintf( $fp, $format, $args );
+ rewind( $fp );
+ $content = stream_get_contents( $fp );
+ var_dump( $content );
+ var_dump( $length );
}
// Test vfprintf()
@@ -48,14 +48,11 @@ writeAndDump( $fp, "%s %s %s", array( 'bar', 'bar', 'bar' ) );
writeAndDump( $fp, "%02d", array( 50 ) );
writeAndDump( $fp, "", array() );
writeAndDump( $fp, "Testing %b %d %f %o %s %x %X", array( 9, 6, 2.5502, 24, "foobar", 15, 65 ) );
-@writeAndDump( $funset, "Foo with %s", array( 'string' ) );
-@writeAndDump( new FooClass(), "Foo with %s", array( 'string' ) );
// Close handle
fclose( $fp );
?>
-===DONE===
--CLEAN--
<?php
@@ -79,8 +76,3 @@ string(0) ""
int(0)
string(38) "Testing 1001 6 2.550200 30 foobar f 41"
int(38)
-bool(false)
-bool(false)
-bool(false)
-bool(false)
-===DONE===
diff --git a/ext/standard/tests/strings/vfprintf_variation10.phpt b/ext/standard/tests/strings/vfprintf_variation10.phpt
index ed9b53def6..e3e6a51880 100644
--- a/ext/standard/tests/strings/vfprintf_variation10.phpt
+++ b/ext/standard/tests/strings/vfprintf_variation10.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/vfprintf_variation11.phpt b/ext/standard/tests/strings/vfprintf_variation11.phpt
index 6c93875c75..2c4134f3b7 100644
--- a/ext/standard/tests/strings/vfprintf_variation11.phpt
+++ b/ext/standard/tests/strings/vfprintf_variation11.phpt
@@ -65,7 +65,6 @@ echo "\n";
unlink($data_file);
?>
-===DONE===
--EXPECT--
*** Testing vfprintf() : octal formats with octal values ***
@@ -85,4 +84,3 @@ unlink($data_file);
% %o o
-- Iteration 8 --
1 2 3 4
-===DONE===
diff --git a/ext/standard/tests/strings/vfprintf_variation11_64bit.phpt b/ext/standard/tests/strings/vfprintf_variation11_64bit.phpt
index 5217442ff9..355d14d185 100644
--- a/ext/standard/tests/strings/vfprintf_variation11_64bit.phpt
+++ b/ext/standard/tests/strings/vfprintf_variation11_64bit.phpt
@@ -65,7 +65,6 @@ echo "\n";
unlink($data_file);
?>
-===DONE===
--EXPECT--
*** Testing vfprintf() : octal formats with octal values ***
@@ -85,4 +84,3 @@ unlink($data_file);
% %o o
-- Iteration 8 --
1 2 3 4
-===DONE===
diff --git a/ext/standard/tests/strings/vfprintf_variation12.phpt b/ext/standard/tests/strings/vfprintf_variation12.phpt
index a655da5367..02fe5ac6f8 100644
--- a/ext/standard/tests/strings/vfprintf_variation12.phpt
+++ b/ext/standard/tests/strings/vfprintf_variation12.phpt
@@ -20,9 +20,9 @@ echo "*** Testing vfprintf() : octal formats and non-octal values ***\n";
// defining array of octal formats
$formats =
- '%o %+o %-o
+ '%o %+o %-o
%lo %Lo %4o %-4o
- %10.4o %-10.4o %.4o
+ %10.4o %-10.4o %.4o
%\'#2o %\'2o %\'$2o %\'_2o
%3$o %4$o %1$o %2$o';
@@ -88,38 +88,36 @@ echo "\n";
unlink($data_file);
?>
-===DONE===
--EXPECT--
*** Testing vfprintf() : octal formats and non-octal values ***
-- Iteration 1 --
-2 0 12
+2 0 12
361100 o 37777775456 2322
-
+
30071 14 37777777764 37777416700
12 361100 2 0
-- Iteration 2 --
-2 37777777776 2
+2 37777777776 2
361100 o 37720715133 57062645
-
+
57060664 4475347 37721631371 37720717336
2 361100 2 37777777776
-- Iteration 3 --
-0 0 0
+0 0 0
173 o 37777777605 173
-
+
2322 0 $0 _0
0 173 0 0
-- Iteration 4 --
-1 1 1
+1 1 1
1 o 1 1
-
+
#1 1 $1 _1
1 1 1 1
-- Iteration 5 --
-1 1 0
+1 1 0
1 o 0 1
-
+
#0 1 $1 _0
0 1 1 1
-===DONE===
diff --git a/ext/standard/tests/strings/vfprintf_variation12_64bit.phpt b/ext/standard/tests/strings/vfprintf_variation12_64bit.phpt
index af286b7912..d6c28bc78e 100644
--- a/ext/standard/tests/strings/vfprintf_variation12_64bit.phpt
+++ b/ext/standard/tests/strings/vfprintf_variation12_64bit.phpt
@@ -20,11 +20,11 @@ echo "*** Testing vfprintf() : octal formats and non-octal values ***\n";
// defining array of octal formats
$formats =
- '%o %+o %-o
- %lo %Lo %4o %-4o
- %10.4o %-10.4o %.4o
- %\'#2o %\'2o %\'$2o %\'_2o
- %3$o %4$o %1$o %2$o';
+ '%o %+o %-o
+ %lo %Lo %4o %-4o
+ %10.4o %-10.4o %.4o
+ %\'#2o %\'2o %\'$2o %\'_2o
+ %3$o %4$o %1$o %2$o';
// Arrays of non octal values for the format defined in $format.
// Each sub array contains non octal values which correspond to each format in $format
@@ -88,38 +88,36 @@ echo "\n";
unlink($data_file);
?>
-===DONE===
--EXPECT--
*** Testing vfprintf() : octal formats and non-octal values ***
-- Iteration 1 --
2 0 12
- 361100 o 1777777777777777775456 2322
+ 361100 o 1777777777777777775456 2322
- 30071 14 1777777777777777777764 1777777777777777416700
- 12 361100 2 0
+ 30071 14 1777777777777777777764 1777777777777777416700
+ 12 361100 2 0
-- Iteration 2 --
2 1777777777777777777776 2
- 361100 o 1777777777777720715133 57062645
+ 361100 o 1777777777777720715133 57062645
- 57060664 4475347 1777777777777721631371 1777777777777720717336
- 2 361100 2 1777777777777777777776
+ 57060664 4475347 1777777777777721631371 1777777777777720717336
+ 2 361100 2 1777777777777777777776
-- Iteration 3 --
0 0 0
- 173 o 1777777777777777777605 173
+ 173 o 1777777777777777777605 173
- 2322 0 $0 _0
- 0 173 0 0
+ 2322 0 $0 _0
+ 0 173 0 0
-- Iteration 4 --
1 1 1
- 1 o 1 1
+ 1 o 1 1
- #1 1 $1 _1
- 1 1 1 1
+ #1 1 $1 _1
+ 1 1 1 1
-- Iteration 5 --
1 1 0
- 1 o 0 1
+ 1 o 0 1
- #0 1 $1 _0
- 0 1 1 1
-===DONE===
+ #0 1 $1 _0
+ 0 1 1 1
diff --git a/ext/standard/tests/strings/vfprintf_variation13.phpt b/ext/standard/tests/strings/vfprintf_variation13.phpt
index dca1d4c169..6331172a0d 100644
--- a/ext/standard/tests/strings/vfprintf_variation13.phpt
+++ b/ext/standard/tests/strings/vfprintf_variation13.phpt
@@ -65,7 +65,6 @@ echo "\n";
unlink($data_file);
?>
-===DONE===
--EXPECT--
*** Testing vfprintf() : hexa formats with hexa values ***
@@ -85,4 +84,3 @@ ffffffff 1 22
%34 x
-- Iteration 8 --
1 2 3 4
-===DONE===
diff --git a/ext/standard/tests/strings/vfprintf_variation13_64bit.phpt b/ext/standard/tests/strings/vfprintf_variation13_64bit.phpt
index 7288abc485..aaad2512a4 100644
--- a/ext/standard/tests/strings/vfprintf_variation13_64bit.phpt
+++ b/ext/standard/tests/strings/vfprintf_variation13_64bit.phpt
@@ -65,7 +65,6 @@ echo "\n";
unlink($data_file);
?>
-===DONE===
--EXPECT--
*** Testing vfprintf() : hexa formats with hexa values ***
@@ -85,4 +84,3 @@ ffffffffffffffff 1 22
%34 x
-- Iteration 8 --
1 2 3 4
-===DONE===
diff --git a/ext/standard/tests/strings/vfprintf_variation14.phpt b/ext/standard/tests/strings/vfprintf_variation14.phpt
index 7e0ab0193f..c22b290c07 100644
--- a/ext/standard/tests/strings/vfprintf_variation14.phpt
+++ b/ext/standard/tests/strings/vfprintf_variation14.phpt
@@ -20,9 +20,9 @@ echo "*** Testing vfprintf() : hexa formats and non-hexa values ***\n";
// defining array of different hexa formats
$formats =
- '%x %+x %-x
+ '%x %+x %-x
%lx %Lx %4x %-4x
- %10.4x %-10.4x %.4x
+ %10.4x %-10.4x %.4x
%\'#2x %\'2x %\'$2x %\'_2x
%3$x %4$x %1$x %2$x';
@@ -88,38 +88,36 @@ echo "\n";
unlink($data_file);
?>
-===DONE===
--EXPECT--
*** Testing vfprintf() : hexa formats and non-hexa values ***
-- Iteration 1 --
-2 0 a
+2 0 a
1e240 x fffffb2e 4d2
-
+
3039 c fffffff4 fffe1dc0
a 1e240 2 0
-- Iteration 2 --
-2 fffffffe 2
+2 fffffffe 2
1e240 x ff439a5b bc65a5
-
+
bc61b4 127ae7 ff4732f9 ff439ede
2 1e240 2 fffffffe
-- Iteration 3 --
-0 0 0
+0 0 0
7b x ffffff85 7b
-
+
4d2 0 $0 _0
0 7b 0 0
-- Iteration 4 --
-1 1 1
+1 1 1
1 x 1 1
-
+
#1 1 $1 _1
1 1 1 1
-- Iteration 5 --
-1 1 0
+1 1 0
1 x 0 1
-
+
#0 1 $1 _0
0 1 1 1
-===DONE===
diff --git a/ext/standard/tests/strings/vfprintf_variation14_64bit.phpt b/ext/standard/tests/strings/vfprintf_variation14_64bit.phpt
index 63994a314a..c7443a1544 100644
--- a/ext/standard/tests/strings/vfprintf_variation14_64bit.phpt
+++ b/ext/standard/tests/strings/vfprintf_variation14_64bit.phpt
@@ -20,11 +20,11 @@ echo "*** Testing vfprintf() : hexa formats and non-hexa values ***\n";
// defining array of different hexa formats
$formats =
- '%x %+x %-x
- %lx %Lx %4x %-4x
- %10.4x %-10.4x %.4x
- %\'#2x %\'2x %\'$2x %\'_2x
- %3$x %4$x %1$x %2$x';
+ '%x %+x %-x
+ %lx %Lx %4x %-4x
+ %10.4x %-10.4x %.4x
+ %\'#2x %\'2x %\'$2x %\'_2x
+ %3$x %4$x %1$x %2$x';
// Arrays of non hexa values for the format defined in $format.
// Each sub array contains non hexa values which correspond to each format in $format
@@ -88,38 +88,36 @@ echo "\n";
unlink($data_file);
?>
-===DONE===
--EXPECT--
*** Testing vfprintf() : hexa formats and non-hexa values ***
-- Iteration 1 --
2 0 a
- 1e240 x fffffffffffffb2e 4d2
+ 1e240 x fffffffffffffb2e 4d2
- 3039 c fffffffffffffff4 fffffffffffe1dc0
- a 1e240 2 0
+ 3039 c fffffffffffffff4 fffffffffffe1dc0
+ a 1e240 2 0
-- Iteration 2 --
2 fffffffffffffffe 2
- 1e240 x ffffffffff439a5b bc65a5
+ 1e240 x ffffffffff439a5b bc65a5
- bc61b4 127ae7 ffffffffff4732f9 ffffffffff439ede
- 2 1e240 2 fffffffffffffffe
+ bc61b4 127ae7 ffffffffff4732f9 ffffffffff439ede
+ 2 1e240 2 fffffffffffffffe
-- Iteration 3 --
0 0 0
- 7b x ffffffffffffff85 7b
+ 7b x ffffffffffffff85 7b
- 4d2 0 $0 _0
- 0 7b 0 0
+ 4d2 0 $0 _0
+ 0 7b 0 0
-- Iteration 4 --
1 1 1
- 1 x 1 1
+ 1 x 1 1
- #1 1 $1 _1
- 1 1 1 1
+ #1 1 $1 _1
+ 1 1 1 1
-- Iteration 5 --
1 1 0
- 1 x 0 1
+ 1 x 0 1
- #0 1 $1 _0
- 0 1 1 1
-===DONE===
+ #0 1 $1 _0
+ 0 1 1 1
diff --git a/ext/standard/tests/strings/vfprintf_variation15.phpt b/ext/standard/tests/strings/vfprintf_variation15.phpt
index b0d7091c09..6ffcf7323c 100644
--- a/ext/standard/tests/strings/vfprintf_variation15.phpt
+++ b/ext/standard/tests/strings/vfprintf_variation15.phpt
@@ -58,7 +58,6 @@ echo "\n";
unlink($data_file);
?>
-===DONE===
--EXPECT--
*** Testing vfprintf() : unsigned formats and unsigned values ***
@@ -72,4 +71,3 @@ unlink($data_file);
#1 0 $0 10
-- Iteration 5 --
1 2 3 4
-===DONE===
diff --git a/ext/standard/tests/strings/vfprintf_variation15_64bit.phpt b/ext/standard/tests/strings/vfprintf_variation15_64bit.phpt
index 53dd105123..15332b7b32 100644
--- a/ext/standard/tests/strings/vfprintf_variation15_64bit.phpt
+++ b/ext/standard/tests/strings/vfprintf_variation15_64bit.phpt
@@ -58,7 +58,6 @@ echo "\n";
unlink($data_file);
?>
-===DONE===
--EXPECT--
*** Testing vfprintf() : unsigned formats and unsigned values ***
@@ -72,4 +71,3 @@ unlink($data_file);
#1 0 $0 10
-- Iteration 5 --
1 2 3 4
-===DONE===
diff --git a/ext/standard/tests/strings/vfprintf_variation16.phpt b/ext/standard/tests/strings/vfprintf_variation16.phpt
index 1d2858cbab..3cd509478e 100644
--- a/ext/standard/tests/strings/vfprintf_variation16.phpt
+++ b/ext/standard/tests/strings/vfprintf_variation16.phpt
@@ -20,9 +20,9 @@ echo "*** Testing vfprintf() : unsigned formats and signed & other types of valu
// defining array of unsigned formats
$formats =
- '%u %+u %-u
+ '%u %+u %-u
%lu %Lu %4u %-4u
- %10.4u %-10.4u %.4u
+ %10.4u %-10.4u %.4u
%\'#2u %\'2u %\'$2u %\'_2u
%3$u %4$u %1$u %2$u';
@@ -81,32 +81,30 @@ echo "\n";
unlink($data_file);
?>
-===DONE===
--EXPECT--
*** Testing vfprintf() : unsigned formats and signed & other types of values ***
-- Iteration 1 --
-2 0 10
+2 0 10
123456 u 1234 2820130816
- 2840207360 1177509888 12345
+ 2840207360 1177509888 12345
12 4294967284 4294843840 _3
10 123456 2 0
-- Iteration 2 --
-0 0 0
+0 0 0
123 u 4294967173 123
- 0 0 0
+ 0 0 0
1234 0 $0 _0
0 123 0 0
-- Iteration 3 --
-1 1 1
+1 1 1
1 u 1 1
- 1 1 1
+ 1 1 1
#1 1 $1 _1
1 1 1 1
-- Iteration 4 --
-1 1 0
+1 1 0
1 u 0 1
- 1 1 0
+ 1 1 0
#0 1 $1 _0
0 1 1 1
-===DONE===
diff --git a/ext/standard/tests/strings/vfprintf_variation16_64bit.phpt b/ext/standard/tests/strings/vfprintf_variation16_64bit.phpt
index 5baecdeb84..49586c8027 100644
--- a/ext/standard/tests/strings/vfprintf_variation16_64bit.phpt
+++ b/ext/standard/tests/strings/vfprintf_variation16_64bit.phpt
@@ -20,11 +20,11 @@ echo "*** Testing vfprintf() : unsigned formats and signed & other types of valu
// defining array of unsigned formats
$formats =
- '%u %+u %-u
- %lu %Lu %4u %-4u
- %10.4u %-10.4u %.4u
- %\'#2u %\'2u %\'$2u %\'_2u
- %3$u %4$u %1$u %2$u';
+ '%u %+u %-u
+ %lu %Lu %4u %-4u
+ %10.4u %-10.4u %.4u
+ %\'#2u %\'2u %\'$2u %\'_2u
+ %3$u %4$u %1$u %2$u';
// Arrays of signed and other type of values for the format defined in $format.
// Each sub array contains signed values which correspond to each format in $format
@@ -81,32 +81,30 @@ echo "\n";
unlink($data_file);
?>
-===DONE===
--EXPECT--
*** Testing vfprintf() : unsigned formats and signed & other types of values ***
-- Iteration 1 --
2 0 10
- 123456 u 1234 20000000000
- 2000000000000 22000000000000 12345
- 12 18446744073709551604 18446744073709428160 _3
- 10 123456 2 0
+ 123456 u 1234 20000000000
+ 2000000000000 22000000000000 12345
+ 12 18446744073709551604 18446744073709428160 _3
+ 10 123456 2 0
-- Iteration 2 --
0 0 0
- 123 u 18446744073709551493 123
- 0 0 0
- 1234 0 $0 _0
- 0 123 0 0
+ 123 u 18446744073709551493 123
+ 0 0 0
+ 1234 0 $0 _0
+ 0 123 0 0
-- Iteration 3 --
1 1 1
- 1 u 1 1
- 1 1 1
- #1 1 $1 _1
- 1 1 1 1
+ 1 u 1 1
+ 1 1 1
+ #1 1 $1 _1
+ 1 1 1 1
-- Iteration 4 --
1 1 0
- 1 u 0 1
- 1 1 0
- #0 1 $1 _0
- 0 1 1 1
-===DONE===
+ 1 u 0 1
+ 1 1 0
+ #0 1 $1 _0
+ 0 1 1 1
diff --git a/ext/standard/tests/strings/vfprintf_variation17.phpt b/ext/standard/tests/strings/vfprintf_variation17.phpt
index 3c9d82025f..060b8c3e6b 100644
--- a/ext/standard/tests/strings/vfprintf_variation17.phpt
+++ b/ext/standard/tests/strings/vfprintf_variation17.phpt
@@ -53,7 +53,6 @@ echo "\n";
unlink($data_file);
?>
-===DONE===
--EXPECT--
*** Testing vfprintf() : scientific formats and scientific values ***
@@ -67,4 +66,3 @@ unlink($data_file);
#########1.000000e+1 1.000000e+2 $$$$$$$$-1.000000e+3 _________1.000000e+2
-- Iteration 5 --
1.000000e+3 2.000000e+3 3.000000e+3 4.000000e+3
-===DONE===
diff --git a/ext/standard/tests/strings/vfprintf_variation18.phpt b/ext/standard/tests/strings/vfprintf_variation18.phpt
index 97961e78a4..6ca775b641 100644
--- a/ext/standard/tests/strings/vfprintf_variation18.phpt
+++ b/ext/standard/tests/strings/vfprintf_variation18.phpt
@@ -76,7 +76,6 @@ echo "\n";
unlink($data_file);
?>
-===DONE===
--EXPECT--
*** Testing vfprintf() : scientific formats and non-scientific values ***
@@ -104,4 +103,3 @@ unlink($data_file);
1.0000e+0 0.0000e+0 1.000000e+0 0.0000e+0
0.000000e+0 1.000000e+0 1.000000e+0 0.000000e+0
0.000000e+0 1.000000e+0 1.000000e+0 1.000000e+0
-===DONE===
diff --git a/ext/standard/tests/strings/vfprintf_variation19.phpt b/ext/standard/tests/strings/vfprintf_variation19.phpt
index b3d5eed82b..f8ce7ec55d 100644
--- a/ext/standard/tests/strings/vfprintf_variation19.phpt
+++ b/ext/standard/tests/strings/vfprintf_variation19.phpt
@@ -65,7 +65,6 @@ echo "\n";
unlink($data_file);
?>
-===DONE===
--EXPECT--
*** Testing vfprintf() : with white spaces in format strings ***
@@ -91,4 +90,3 @@ A B C
11 FFFFFFDE 33
-- Iteration 11 --
2.000000E+1 2.000000E-1 -2.000000E+1
-===DONE===
diff --git a/ext/standard/tests/strings/vfprintf_variation19_64bit.phpt b/ext/standard/tests/strings/vfprintf_variation19_64bit.phpt
index 0ae053ac98..4f7e0ee53b 100644
--- a/ext/standard/tests/strings/vfprintf_variation19_64bit.phpt
+++ b/ext/standard/tests/strings/vfprintf_variation19_64bit.phpt
@@ -65,7 +65,6 @@ echo "\n";
unlink($data_file);
?>
-===DONE===
--EXPECT--
*** Testing vfprintf() : with white spaces in format strings ***
@@ -91,4 +90,3 @@ A B C
11 FFFFFFFFFFFFFFDE 33
-- Iteration 11 --
2.000000E+1 2.000000E-1 -2.000000E+1
-===DONE===
diff --git a/ext/standard/tests/strings/vfprintf_variation20.phpt b/ext/standard/tests/strings/vfprintf_variation20.phpt
index 1f8dfefca4..95477f6c25 100644
--- a/ext/standard/tests/strings/vfprintf_variation20.phpt
+++ b/ext/standard/tests/strings/vfprintf_variation20.phpt
@@ -36,50 +36,50 @@ $file_handle = fopen(__FILE__, 'r');
//array of values to iterate over
$values = array(
- // int data
+ // int data
/*1*/ 0,
- 1,
- 12345,
- -2345,
+ 1,
+ 12345,
+ -2345,
- // float data
+ // float data
/*5*/ 10.5,
- -10.5,
- 10.1234567e10,
- 10.7654321E-10,
- .5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
- // array data
+ // array data
/*10*/ array(),
- array(0),
- array(1),
- array(1,2),
- array('color' => 'red', 'item' => 'pen'),
+ array(0),
+ array(1),
+ array(1,2),
+ array('color' => 'red', 'item' => 'pen'),
- // null data
+ // null data
/*15*/ NULL,
- null,
+ null,
- // boolean data
+ // boolean data
/*17*/ true,
- false,
- TRUE,
- FALSE,
+ false,
+ TRUE,
+ FALSE,
- // empty data
+ // empty data
/*21*/ "",
- '',
+ '',
- // object data
+ // object data
/*23*/ new sample(),
- // undefined data
+ // undefined data
/*24*/ @$undefined_var,
- // unset data
+ // unset data
/*25*/ @$unset_var,
- // resource data
+ // resource data
/*26*/ $file_handle
);
@@ -92,8 +92,13 @@ fprintf($fp, "\n*** Testing vprintf() with with unexpected values for format arg
$counter = 1;
foreach( $values as $value ) {
- fprintf( $fp, "\n-- Iteration %d --\n",$counter);
- vfprintf($fp, $value, $args);
+ fprintf($fp, "\n-- Iteration %d --\n", $counter);
+
+ try {
+ vfprintf($fp, $value, $args);
+ } catch (TypeError $exception) {
+ fprintf($fp, "%s\n", $exception->getMessage());
+ }
$counter++;
}
@@ -104,20 +109,9 @@ echo "\n";
unlink($data_file);
?>
-===DONE===
--EXPECTF--
*** Testing vfprintf() : with unexpected values for format argument ***
-Notice: Array to string conversion in %s on line %d
-
-Notice: Array to string conversion in %s on line %d
-
-Notice: Array to string conversion in %s on line %d
-
-Notice: Array to string conversion in %s on line %d
-
-Notice: Array to string conversion in %s on line %d
-
*** Testing vprintf() with with unexpected values for format argument ***
-- Iteration 1 --
@@ -139,15 +133,20 @@ Notice: Array to string conversion in %s on line %d
-- Iteration 9 --
0.5
-- Iteration 10 --
-Array
+vfprintf() expects parameter 2 to be string, array given
+
-- Iteration 11 --
-Array
+vfprintf() expects parameter 2 to be string, array given
+
-- Iteration 12 --
-Array
+vfprintf() expects parameter 2 to be string, array given
+
-- Iteration 13 --
-Array
+vfprintf() expects parameter 2 to be string, array given
+
-- Iteration 14 --
-Array
+vfprintf() expects parameter 2 to be string, array given
+
-- Iteration 15 --
-- Iteration 16 --
@@ -171,5 +170,4 @@ object
-- Iteration 25 --
-- Iteration 26 --
-Resource id #%d
-===DONE===
+vfprintf() expects parameter 2 to be string, resource given
diff --git a/ext/standard/tests/strings/vfprintf_variation21.phpt b/ext/standard/tests/strings/vfprintf_variation21.phpt
index 11f29e87ac..f44cc36a2c 100644
--- a/ext/standard/tests/strings/vfprintf_variation21.phpt
+++ b/ext/standard/tests/strings/vfprintf_variation21.phpt
@@ -36,47 +36,47 @@ $file_handle = fopen(__FILE__, 'r');
//array of values to iterate over
$values = array(
- // int data
+ // int data
/*1*/ 0,
- 1,
- 12345,
- -2345,
+ 1,
+ 12345,
+ -2345,
- // float data
+ // float data
/*5*/ 10.5,
- -10.5,
- 10.1234567e10,
- 10.7654321E-10,
- .5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
- // null data
+ // null data
/*10*/ NULL,
- null,
+ null,
- // boolean data
+ // boolean data
/*12*/ true,
- false,
- TRUE,
- FALSE,
+ false,
+ TRUE,
+ FALSE,
- // empty data
+ // empty data
/*16*/ "",
- '',
+ '',
- // string data
+ // string data
/*18*/ "string",
- 'string',
+ 'string',
- // object data
+ // object data
/*20*/ new sample(),
- // undefined data
+ // undefined data
/*21*/ @$undefined_var,
- // unset data
+ // unset data
/*22*/ @$unset_var,
- // resource data
+ // resource data
/*23*/ $file_handle
);
@@ -90,7 +90,11 @@ fprintf($fp, "\n*** Testing vprintf() with unexpected values for args argument *
$counter = 1;
foreach( $values as $value ) {
fprintf($fp, "\n-- Iteration %d --\n",$counter);
- vfprintf($fp, $format, $value);
+ try {
+ vfprintf($fp, $format, $value);
+ } catch (\ValueError $e) {
+ fwrite($fp, $e->getMessage() . "\n");
+ }
$counter++;
}
@@ -102,20 +106,9 @@ unlink($data_file);
?>
-===DONE===
--EXPECTF--
*** Testing vfprintf() : with unexpected values for args argument ***
-Warning: vfprintf(): Too few arguments in %s on line %d
-
-Warning: vfprintf(): Too few arguments in %s on line %d
-
-Warning: vfprintf(): Too few arguments in %s on line %d
-
-Warning: vfprintf(): Too few arguments in %s on line %d
-
-Warning: vfprintf(): Too few arguments in %s on line %d
-
*** Testing vprintf() with unexpected values for args argument ***
-- Iteration 1 --
@@ -137,8 +130,10 @@ Warning: vfprintf(): Too few arguments in %s on line %d
-- Iteration 9 --
0.5
-- Iteration 10 --
+The arguments array must contain 1 items, 0 given
-- Iteration 11 --
+The arguments array must contain 1 items, 0 given
-- Iteration 12 --
1
@@ -157,11 +152,13 @@ string
-- Iteration 19 --
string
-- Iteration 20 --
+The arguments array must contain 1 items, 0 given
-- Iteration 21 --
+The arguments array must contain 1 items, 0 given
-- Iteration 22 --
+The arguments array must contain 1 items, 0 given
-- Iteration 23 --
Resource id #%d
-===DONE===
diff --git a/ext/standard/tests/strings/vfprintf_variation3.phpt b/ext/standard/tests/strings/vfprintf_variation3.phpt
index 7cb8e83d0d..3f43709b4e 100644
--- a/ext/standard/tests/strings/vfprintf_variation3.phpt
+++ b/ext/standard/tests/strings/vfprintf_variation3.phpt
@@ -63,7 +63,6 @@ echo "\n";
unlink($data_file);
?>
-===DONE===
--EXPECT--
*** Testing vfprintf() : int formats with int values ***
@@ -83,4 +82,3 @@ unlink($data_file);
%-5678 d
-- Iteration 8 --
1 2 3 4
-===DONE===
diff --git a/ext/standard/tests/strings/vfprintf_variation4.phpt b/ext/standard/tests/strings/vfprintf_variation4.phpt
index 0480fd87a3..d034bbffa0 100644
--- a/ext/standard/tests/strings/vfprintf_variation4.phpt
+++ b/ext/standard/tests/strings/vfprintf_variation4.phpt
@@ -82,7 +82,6 @@ echo "\n";
unlink($data_file);
?>
-===DONE===
--EXPECT--
*** Testing vfprintf() : int formats and non-integer values ***
@@ -110,4 +109,3 @@ unlink($data_file);
1 0 1 0000
#0 1 $1 _0
0 1 1 1
-===DONE===
diff --git a/ext/standard/tests/strings/vfprintf_variation4_64bit.phpt b/ext/standard/tests/strings/vfprintf_variation4_64bit.phpt
index 690e2633f2..c03e38e40c 100644
--- a/ext/standard/tests/strings/vfprintf_variation4_64bit.phpt
+++ b/ext/standard/tests/strings/vfprintf_variation4_64bit.phpt
@@ -20,11 +20,11 @@ echo "*** Testing vfprintf() : int formats and non-integer values ***\n";
// defining array of int formats
$formats =
- '%d %+d %-d
- %ld %Ld %4d %-4d
- %10.4d %-10.4d %.4d %04.4d
- %\'#2d %\'2d %\'$2d %\'_2d
- %3$d %4$d %1$d %2$d';
+ '%d %+d %-d
+ %ld %Ld %4d %-4d
+ %10.4d %-10.4d %.4d %04.4d
+ %\'#2d %\'2d %\'$2d %\'_2d
+ %3$d %4$d %1$d %2$d';
// Arrays of non int values for the format defined in $format.
// Each sub array contains non int values which correspond to each format in $format
@@ -35,7 +35,8 @@ $args_array = array(
123456.234, 123456.234, -1234.6789, +1234.6789,
2e10, +2e5, 4e3, 22e+6,
12345.780, 12.000000011111, -12.00000111111, -123456.234,
- 3.33, +4.44, 1.11,-2.22 ),
+ 3.33, +4.44, 1.11,-2.22
+ ),
// array of strings
array(" ", ' ', 'hello',
@@ -82,32 +83,30 @@ echo "\n";
unlink($data_file);
?>
-===DONE===
--EXPECT--
*** Testing vfprintf() : int formats and non-integer values ***
-- Iteration 1 --
-2 +0 10
- 123456 d -1234 1234
- 20000000000 200000 4000 22000000
- 12345 12 -12 -123456
- 10 123456 2 0
+2 +0 10
+ 123456 d -1234 1234
+ 20000000000 200000 4000 22000000
+ 12345 12 -12 -123456
+ 10 123456 2 0
-- Iteration 2 --
-0 +0 0
- 123 d -123 123
- 0 0 123456 0000
- 1234 0 $0 _0
- 0 123 0 0
+0 +0 0
+ 123 d -123 123
+ 0 0 123456 0000
+ 1234 0 $0 _0
+ 0 123 0 0
-- Iteration 3 --
-1 +1 1
- 1 d 1 1
- 1 1 1 0001
- #1 1 $1 _1
- 1 1 1 1
+1 +1 1
+ 1 d 1 1
+ 1 1 1 0001
+ #1 1 $1 _1
+ 1 1 1 1
-- Iteration 4 --
-1 +1 0
- 1 d 0 1
- 1 0 1 0000
- #0 1 $1 _0
- 0 1 1 1
-===DONE===
+1 +1 0
+ 1 d 0 1
+ 1 0 1 0000
+ #0 1 $1 _0
+ 0 1 1 1
diff --git a/ext/standard/tests/strings/vfprintf_variation5.phpt b/ext/standard/tests/strings/vfprintf_variation5.phpt
index a9139ce6af..71f9b78fbf 100644
--- a/ext/standard/tests/strings/vfprintf_variation5.phpt
+++ b/ext/standard/tests/strings/vfprintf_variation5.phpt
@@ -62,7 +62,6 @@ echo "\n";
unlink($data_file);
?>
-===DONE===
--EXPECT--
*** Testing vfprintf() : int formats with float values ***
@@ -82,4 +81,3 @@ unlink($data_file);
%-5678.567800 f
-- Iteration 8 --
1.110000 2.220000 3.330000 4.440000
-===DONE===
diff --git a/ext/standard/tests/strings/vfprintf_variation6.phpt b/ext/standard/tests/strings/vfprintf_variation6.phpt
index 0d7941f5b7..d220b8a81f 100644
--- a/ext/standard/tests/strings/vfprintf_variation6.phpt
+++ b/ext/standard/tests/strings/vfprintf_variation6.phpt
@@ -77,7 +77,6 @@ echo "\n";
unlink($data_file);
?>
-===DONE===
--EXPECT--
*** Testing vfprintf() : float formats and non-float values ***
@@ -105,4 +104,3 @@ unlink($data_file);
1.0000 0.0000 1.000000 0.0000
0.000000 1.000000 1.000000 0.000000
0.000000 1.000000 1.000000 1.000000
-===DONE===
diff --git a/ext/standard/tests/strings/vfprintf_variation7.phpt b/ext/standard/tests/strings/vfprintf_variation7.phpt
index 54b4ef4505..d6becb602d 100644
--- a/ext/standard/tests/strings/vfprintf_variation7.phpt
+++ b/ext/standard/tests/strings/vfprintf_variation7.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/vfprintf_variation8.phpt b/ext/standard/tests/strings/vfprintf_variation8.phpt
index 0005ed2e60..ebf894f5e6 100644
--- a/ext/standard/tests/strings/vfprintf_variation8.phpt
+++ b/ext/standard/tests/strings/vfprintf_variation8.phpt
@@ -12,8 +12,6 @@ Test vfprintf() function : usage variations - string formats with non-string val
* the '$format' and '$args' arguments of the function
*/
-error_reporting(E_ALL & ~E_NOTICE);
-
echo "*** Testing vfprintf() : string formats and non-string values ***\n";
// defining array of string formats
@@ -80,10 +78,45 @@ echo "\n";
unlink($data_file);
?>
-===DONE===
---EXPECT--
+--EXPECTF--
*** Testing vfprintf() : string formats and non-string values ***
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
-- Iteration 1 --
2.2 0.2 10.2
123456.234 s -1234.6789 1234.6789
@@ -108,4 +141,3 @@ Array Array Array
1 0001 0000
#0 1 $1 _0
1 1 1
-===DONE===
diff --git a/ext/standard/tests/strings/vfprintf_variation9.phpt b/ext/standard/tests/strings/vfprintf_variation9.phpt
index 30509d9119..cd5a2653bc 100644
--- a/ext/standard/tests/strings/vfprintf_variation9.phpt
+++ b/ext/standard/tests/strings/vfprintf_variation9.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/vprintf_basic1.phpt b/ext/standard/tests/strings/vprintf_basic1.phpt
index 280649f70d..bfe287052c 100644
--- a/ext/standard/tests/strings/vprintf_basic1.phpt
+++ b/ext/standard/tests/strings/vprintf_basic1.phpt
@@ -30,7 +30,6 @@ echo "\n";
var_dump($result);
?>
-===DONE===
--EXPECT--
*** Testing vprintf() : basic functionality - using string format ***
one
@@ -39,4 +38,3 @@ one two
int(7)
one two three
int(13)
-===DONE===
diff --git a/ext/standard/tests/strings/vprintf_basic2.phpt b/ext/standard/tests/strings/vprintf_basic2.phpt
index 854d6eaeee..e8bdb80738 100644
--- a/ext/standard/tests/strings/vprintf_basic2.phpt
+++ b/ext/standard/tests/strings/vprintf_basic2.phpt
@@ -35,7 +35,6 @@ echo "\n";
var_dump($result);
?>
-===DONE===
--EXPECT--
*** Testing vprintf() : basic functionality - using integer format ***
111
@@ -44,4 +43,3 @@ int(3)
int(7)
111 222 333
int(11)
-===DONE===
diff --git a/ext/standard/tests/strings/vprintf_basic3.phpt b/ext/standard/tests/strings/vprintf_basic3.phpt
index 616399eed7..c052008666 100644
--- a/ext/standard/tests/strings/vprintf_basic3.phpt
+++ b/ext/standard/tests/strings/vprintf_basic3.phpt
@@ -48,7 +48,6 @@ echo "\n";
var_dump($result);
?>
-===DONE===
--EXPECT--
*** Testing vprintf() : basic functionality - using float format ***
11.110000
@@ -63,4 +62,3 @@ int(19)
int(29)
11.110000 22.220000 33.330000
int(29)
-===DONE===
diff --git a/ext/standard/tests/strings/vprintf_basic4.phpt b/ext/standard/tests/strings/vprintf_basic4.phpt
index d8cfa80452..c884e9c3eb 100644
--- a/ext/standard/tests/strings/vprintf_basic4.phpt
+++ b/ext/standard/tests/strings/vprintf_basic4.phpt
@@ -31,7 +31,6 @@ echo "\n";
var_dump($result);
?>
-===DONE===
--EXPECT--
*** Testing vprintf() : basic functionality - using bool format ***
1
@@ -40,4 +39,3 @@ int(1)
int(3)
1 0 1
int(5)
-===DONE===
diff --git a/ext/standard/tests/strings/vprintf_basic5.phpt b/ext/standard/tests/strings/vprintf_basic5.phpt
index 67922eaa5e..94a71bedba 100644
--- a/ext/standard/tests/strings/vprintf_basic5.phpt
+++ b/ext/standard/tests/strings/vprintf_basic5.phpt
@@ -31,7 +31,6 @@ echo "\n";
var_dump($result);
?>
-===DONE===
--EXPECT--
*** Testing vprintf() : basic functionality - using char format ***
A
@@ -40,4 +39,3 @@ A B
int(3)
A B C
int(5)
-===DONE===
diff --git a/ext/standard/tests/strings/vprintf_basic6.phpt b/ext/standard/tests/strings/vprintf_basic6.phpt
index 9ddead58c4..29189ce944 100644
--- a/ext/standard/tests/strings/vprintf_basic6.phpt
+++ b/ext/standard/tests/strings/vprintf_basic6.phpt
@@ -31,7 +31,6 @@ echo "\n";
var_dump($result);
?>
-===DONE===
--EXPECT--
*** Testing vprintf() : basic functionality - using exponential format ***
1.000000e+3
@@ -40,4 +39,3 @@ int(11)
int(23)
1.000000e+3 2.000000e+3 3.000000e+3
int(35)
-===DONE===
diff --git a/ext/standard/tests/strings/vprintf_basic7.phpt b/ext/standard/tests/strings/vprintf_basic7.phpt
index 7633e08f51..14f00a8b2d 100644
--- a/ext/standard/tests/strings/vprintf_basic7.phpt
+++ b/ext/standard/tests/strings/vprintf_basic7.phpt
@@ -35,7 +35,6 @@ echo "\n";
var_dump($result);
?>
-===DONE===
--EXPECT--
*** Testing vprintf() : basic functionality - using unsigned format ***
4294966185
@@ -44,4 +43,3 @@ int(10)
int(21)
4294966185 4293732729 4292621864
int(32)
-===DONE===
diff --git a/ext/standard/tests/strings/vprintf_basic7_64bit.phpt b/ext/standard/tests/strings/vprintf_basic7_64bit.phpt
index 564e6f1168..2d4424b2df 100644
--- a/ext/standard/tests/strings/vprintf_basic7_64bit.phpt
+++ b/ext/standard/tests/strings/vprintf_basic7_64bit.phpt
@@ -34,7 +34,6 @@ $result = vprintf($format3,$arg3);
echo "\n";
var_dump($result);
?>
-===DONE===
--EXPECT--
*** Testing vprintf() : basic functionality - using unsigned format ***
18446744073709550505
@@ -43,4 +42,3 @@ int(20)
int(41)
18446744073709550505 18446744073708317049 18446744073707206184
int(62)
-===DONE===
diff --git a/ext/standard/tests/strings/vprintf_basic8.phpt b/ext/standard/tests/strings/vprintf_basic8.phpt
index 6fa89a1ea2..873feb1a8f 100644
--- a/ext/standard/tests/strings/vprintf_basic8.phpt
+++ b/ext/standard/tests/strings/vprintf_basic8.phpt
@@ -31,7 +31,6 @@ echo "\n";
var_dump($result);
?>
-===DONE===
--EXPECT--
*** Testing vprintf() : basic functionality - using octal format ***
21
@@ -40,4 +39,3 @@ int(2)
int(6)
21 347 567
int(10)
-===DONE===
diff --git a/ext/standard/tests/strings/vprintf_basic9.phpt b/ext/standard/tests/strings/vprintf_basic9.phpt
index 8521d82ec4..46b9cb94b8 100644
--- a/ext/standard/tests/strings/vprintf_basic9.phpt
+++ b/ext/standard/tests/strings/vprintf_basic9.phpt
@@ -44,7 +44,6 @@ echo "\n";
var_dump($result);
?>
-===DONE===
--EXPECT--
*** Testing vprintf() : basic functionality - using hexadecimal format ***
b
@@ -59,4 +58,3 @@ b 84 b1
int(7)
B 84 B1
int(7)
-===DONE===
diff --git a/ext/standard/tests/strings/vprintf_variation1.phpt b/ext/standard/tests/strings/vprintf_variation1.phpt
index 5cf50105ab..fd479274ef 100644
--- a/ext/standard/tests/strings/vprintf_variation1.phpt
+++ b/ext/standard/tests/strings/vprintf_variation1.phpt
@@ -36,50 +36,50 @@ $file_handle = fopen(__FILE__, 'r');
//array of values to iterate over
$values = array(
- // int data
+ // int data
/*1*/ 0,
- 1,
- 12345,
- -2345,
+ 1,
+ 12345,
+ -2345,
- // float data
+ // float data
/*5*/ 10.5,
- -10.5,
- 10.1234567e10,
- 10.7654321E-10,
- .5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
- // array data
+ // array data
/*10*/ array(),
- array(0),
- array(1),
- array(1,2),
- array('color' => 'red', 'item' => 'pen'),
+ array(0),
+ array(1),
+ array(1,2),
+ array('color' => 'red', 'item' => 'pen'),
- // null data
+ // null data
/*15*/ NULL,
- null,
+ null,
- // boolean data
+ // boolean data
/*17*/ true,
- false,
- TRUE,
- FALSE,
+ false,
+ TRUE,
+ FALSE,
- // empty data
+ // empty data
/*21*/ "",
- '',
+ '',
- // object data
+ // object data
/*23*/ new sample(),
- // undefined data
+ // undefined data
/*24*/ @$undefined_var,
- // unset data
+ // unset data
/*25*/ @$unset_var,
- // resource data
+ // resource data
/*26*/ $file_handle
);
@@ -88,18 +88,21 @@ $values = array(
$counter = 1;
foreach($values as $value) {
echo "\n -- Iteration $counter --\n";
- $result = vprintf($value,$args);
- echo "\n";
- var_dump($result);
- $counter++;
+ try {
+ $result = vprintf($value, $args);
+ echo "\n";
+ var_dump($result);
+ } catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
-};
+ $counter++;
+}
// closing the resource
fclose($file_handle);
?>
-===DONE===
--EXPECTF--
*** Testing vprintf() : with unexpected values for format argument ***
@@ -140,34 +143,19 @@ int(13)
int(3)
-- Iteration 10 --
-
-Notice: Array to string conversion in %s on line %d
-Array
-int(5)
+vprintf() expects parameter 1 to be string, array given
-- Iteration 11 --
-
-Notice: Array to string conversion in %s on line %d
-Array
-int(5)
+vprintf() expects parameter 1 to be string, array given
-- Iteration 12 --
-
-Notice: Array to string conversion in %s on line %d
-Array
-int(5)
+vprintf() expects parameter 1 to be string, array given
-- Iteration 13 --
-
-Notice: Array to string conversion in %s on line %d
-Array
-int(5)
+vprintf() expects parameter 1 to be string, array given
-- Iteration 14 --
-
-Notice: Array to string conversion in %s on line %d
-Array
-int(5)
+vprintf() expects parameter 1 to be string, array given
-- Iteration 15 --
@@ -214,6 +202,4 @@ int(0)
int(0)
-- Iteration 26 --
-Resource id #%d
-int(%d)
-===DONE===
+vprintf() expects parameter 1 to be string, resource given
diff --git a/ext/standard/tests/strings/vprintf_variation10.phpt b/ext/standard/tests/strings/vprintf_variation10.phpt
index 747b8c40c5..a69a8b27b5 100644
--- a/ext/standard/tests/strings/vprintf_variation10.phpt
+++ b/ext/standard/tests/strings/vprintf_variation10.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/vprintf_variation11.phpt b/ext/standard/tests/strings/vprintf_variation11.phpt
index 99f5c80386..21b6a27a55 100644
--- a/ext/standard/tests/strings/vprintf_variation11.phpt
+++ b/ext/standard/tests/strings/vprintf_variation11.phpt
@@ -56,7 +56,6 @@ foreach($formats as $format) {
}
?>
-===DONE===
--EXPECT--
*** Testing vprintf() : octal formats with octal values ***
@@ -91,4 +90,3 @@ int(6)
-- Iteration 8 --
1 2 3 4
int(7)
-===DONE===
diff --git a/ext/standard/tests/strings/vprintf_variation11_64bit.phpt b/ext/standard/tests/strings/vprintf_variation11_64bit.phpt
index 22e1d83840..e2ffb93ac4 100644
--- a/ext/standard/tests/strings/vprintf_variation11_64bit.phpt
+++ b/ext/standard/tests/strings/vprintf_variation11_64bit.phpt
@@ -56,7 +56,6 @@ foreach($formats as $format) {
}
?>
-===DONE===
--EXPECT--
*** Testing vprintf() : octal formats with octal values ***
@@ -91,4 +90,3 @@ int(6)
-- Iteration 8 --
1 2 3 4
int(7)
-===DONE===
diff --git a/ext/standard/tests/strings/vprintf_variation12.phpt b/ext/standard/tests/strings/vprintf_variation12.phpt
index a4c6139144..4f8a9b05a7 100644
--- a/ext/standard/tests/strings/vprintf_variation12.phpt
+++ b/ext/standard/tests/strings/vprintf_variation12.phpt
@@ -20,9 +20,9 @@ echo "*** Testing vprintf() : octal formats and non-octal values ***\n";
// defining array of octal formats
$formats =
- '%o %+o %-o
+ '%o %+o %-o
%lo %Lo %4o %-4o
- %10.4o %-10.4o %.4o
+ %10.4o %-10.4o %.4o
%\'#2o %\'2o %\'$2o %\'_2o
%3$o %4$o %1$o %2$o';
@@ -79,47 +79,45 @@ foreach($args_array as $args) {
}
?>
-===DONE===
--EXPECT--
*** Testing vprintf() : octal formats and non-octal values ***
-- Iteration 1 --
-2 0 12
+2 0 12
361100 o 37777775456 2322
-
+
30071 14 37777777764 37777416700
12 361100 2 0
-int(116)
+int(114)
-- Iteration 2 --
-2 37777777776 2
+2 37777777776 2
361100 o 37720715133 57062645
-
+
57060664 4475347 37721631371 37720717336
2 361100 2 37777777776
-int(146)
+int(144)
-- Iteration 3 --
-0 0 0
+0 0 0
173 o 37777777605 173
-
+
2322 0 $0 _0
0 173 0 0
-int(88)
+int(86)
-- Iteration 4 --
-1 1 1
+1 1 1
1 o 1 1
-
+
#1 1 $1 _1
1 1 1 1
-int(75)
+int(73)
-- Iteration 5 --
-1 1 0
+1 1 0
1 o 0 1
-
+
#0 1 $1 _0
0 1 1 1
-int(75)
-===DONE===
+int(73)
diff --git a/ext/standard/tests/strings/vprintf_variation12_64bit.phpt b/ext/standard/tests/strings/vprintf_variation12_64bit.phpt
index 27b420a7b0..9e63f1a0df 100644
--- a/ext/standard/tests/strings/vprintf_variation12_64bit.phpt
+++ b/ext/standard/tests/strings/vprintf_variation12_64bit.phpt
@@ -20,11 +20,11 @@ echo "*** Testing vprintf() : octal formats and non-octal values ***\n";
// defining array of octal formats
$formats =
- '%o %+o %-o
- %lo %Lo %4o %-4o
- %10.4o %-10.4o %.4o
- %\'#2o %\'2o %\'$2o %\'_2o
- %3$o %4$o %1$o %2$o';
+ '%o %+o %-o
+ %lo %Lo %4o %-4o
+ %10.4o %-10.4o %.4o
+ %\'#2o %\'2o %\'$2o %\'_2o
+ %3$o %4$o %1$o %2$o';
// Arrays of non octal values for the format defined in $format.
// Each sub array contains non octal values which correspond to each format in $format
@@ -79,47 +79,45 @@ foreach($args_array as $args) {
}
?>
-===DONE===
--EXPECT--
*** Testing vprintf() : octal formats and non-octal values ***
-- Iteration 1 --
-2 0 12
- 361100 o 1777777777777777775456 2322
+2 0 12
+ 361100 o 1777777777777777775456 2322
- 30071 14 1777777777777777777764 1777777777777777416700
- 12 361100 2 0
-int(149)
+ 30071 14 1777777777777777777764 1777777777777777416700
+ 12 361100 2 0
+int(151)
-- Iteration 2 --
-2 1777777777777777777776 2
- 361100 o 1777777777777720715133 57062645
+2 1777777777777777777776 2
+ 361100 o 1777777777777720715133 57062645
- 57060664 4475347 1777777777777721631371 1777777777777720717336
- 2 361100 2 1777777777777777777776
-int(201)
+ 57060664 4475347 1777777777777721631371 1777777777777720717336
+ 2 361100 2 1777777777777777777776
+int(203)
-- Iteration 3 --
-0 0 0
- 173 o 1777777777777777777605 173
+0 0 0
+ 173 o 1777777777777777777605 173
- 2322 0 $0 _0
- 0 173 0 0
-int(99)
+ 2322 0 $0 _0
+ 0 173 0 0
+int(101)
-- Iteration 4 --
-1 1 1
- 1 o 1 1
+1 1 1
+ 1 o 1 1
- #1 1 $1 _1
- 1 1 1 1
-int(75)
+ #1 1 $1 _1
+ 1 1 1 1
+int(77)
-- Iteration 5 --
-1 1 0
- 1 o 0 1
+1 1 0
+ 1 o 0 1
- #0 1 $1 _0
- 0 1 1 1
-int(75)
-===DONE===
+ #0 1 $1 _0
+ 0 1 1 1
+int(77)
diff --git a/ext/standard/tests/strings/vprintf_variation13.phpt b/ext/standard/tests/strings/vprintf_variation13.phpt
index 6f9ab49b98..c598118285 100644
--- a/ext/standard/tests/strings/vprintf_variation13.phpt
+++ b/ext/standard/tests/strings/vprintf_variation13.phpt
@@ -56,7 +56,6 @@ foreach($formats as $format) {
}
?>
-===DONE===
--EXPECT--
*** Testing vprintf() : hexa formats with hexa values ***
@@ -91,4 +90,3 @@ int(5)
-- Iteration 8 --
1 2 3 4
int(7)
-===DONE===
diff --git a/ext/standard/tests/strings/vprintf_variation13_64bit.phpt b/ext/standard/tests/strings/vprintf_variation13_64bit.phpt
index af5a76eded..b5b750b542 100644
--- a/ext/standard/tests/strings/vprintf_variation13_64bit.phpt
+++ b/ext/standard/tests/strings/vprintf_variation13_64bit.phpt
@@ -56,7 +56,6 @@ foreach($formats as $format) {
}
?>
-===DONE===
--EXPECT--
*** Testing vprintf() : hexa formats with hexa values ***
@@ -91,4 +90,3 @@ int(5)
-- Iteration 8 --
1 2 3 4
int(7)
-===DONE===
diff --git a/ext/standard/tests/strings/vprintf_variation14.phpt b/ext/standard/tests/strings/vprintf_variation14.phpt
index 830b7f8e15..04a90a00d3 100644
--- a/ext/standard/tests/strings/vprintf_variation14.phpt
+++ b/ext/standard/tests/strings/vprintf_variation14.phpt
@@ -20,9 +20,9 @@ echo "*** Testing vprintf() : hexa formats and non-hexa values ***\n";
// defining array of different hexa formats
$formats =
- '%x %+x %-x
+ '%x %+x %-x
%lx %Lx %4x %-4x
- %10.4x %-10.4x %.4x
+ %10.4x %-10.4x %.4x
%\'#2x %\'2x %\'$2x %\'_2x
%3$x %4$x %1$x %2$x';
@@ -80,47 +80,45 @@ foreach($args_array as $args) {
}
?>
-===DONE===
--EXPECT--
*** Testing vprintf() : hexa formats and non-hexa values ***
-- Iteration 1 --
-2 0 a
+2 0 a
1e240 x fffffb2e 4d2
-
+
3039 c fffffff4 fffe1dc0
a 1e240 2 0
-int(101)
+int(99)
-- Iteration 2 --
-2 fffffffe 2
+2 fffffffe 2
1e240 x ff439a5b bc65a5
-
+
bc61b4 127ae7 ff4732f9 ff439ede
2 1e240 2 fffffffe
-int(124)
+int(122)
-- Iteration 3 --
-0 0 0
+0 0 0
7b x ffffff85 7b
-
+
4d2 0 $0 _0
0 7b 0 0
-int(82)
+int(80)
-- Iteration 4 --
-1 1 1
+1 1 1
1 x 1 1
-
+
#1 1 $1 _1
1 1 1 1
-int(75)
+int(73)
-- Iteration 5 --
-1 1 0
+1 1 0
1 x 0 1
-
+
#0 1 $1 _0
0 1 1 1
-int(75)
-===DONE===
+int(73)
diff --git a/ext/standard/tests/strings/vprintf_variation14_64bit.phpt b/ext/standard/tests/strings/vprintf_variation14_64bit.phpt
index 74b57f4ae8..387663167a 100644
--- a/ext/standard/tests/strings/vprintf_variation14_64bit.phpt
+++ b/ext/standard/tests/strings/vprintf_variation14_64bit.phpt
@@ -20,11 +20,11 @@ echo "*** Testing vprintf() : hexa formats and non-hexa values ***\n";
// defining array of different hexa formats
$formats =
- '%x %+x %-x
- %lx %Lx %4x %-4x
- %10.4x %-10.4x %.4x
- %\'#2x %\'2x %\'$2x %\'_2x
- %3$x %4$x %1$x %2$x';
+ '%x %+x %-x
+ %lx %Lx %4x %-4x
+ %10.4x %-10.4x %.4x
+ %\'#2x %\'2x %\'$2x %\'_2x
+ %3$x %4$x %1$x %2$x';
// Arrays of non hexa values for the format defined in $format.
// Each sub array contains non hexa values which correspond to each format in $format
@@ -80,47 +80,45 @@ foreach($args_array as $args) {
}
?>
-===DONE===
--EXPECT--
*** Testing vprintf() : hexa formats and non-hexa values ***
-- Iteration 1 --
-2 0 a
- 1e240 x fffffffffffffb2e 4d2
+2 0 a
+ 1e240 x fffffffffffffb2e 4d2
- 3039 c fffffffffffffff4 fffffffffffe1dc0
- a 1e240 2 0
-int(125)
+ 3039 c fffffffffffffff4 fffffffffffe1dc0
+ a 1e240 2 0
+int(127)
-- Iteration 2 --
-2 fffffffffffffffe 2
- 1e240 x ffffffffff439a5b bc65a5
+2 fffffffffffffffe 2
+ 1e240 x ffffffffff439a5b bc65a5
- bc61b4 127ae7 ffffffffff4732f9 ffffffffff439ede
- 2 1e240 2 fffffffffffffffe
-int(164)
+ bc61b4 127ae7 ffffffffff4732f9 ffffffffff439ede
+ 2 1e240 2 fffffffffffffffe
+int(166)
-- Iteration 3 --
-0 0 0
- 7b x ffffffffffffff85 7b
+0 0 0
+ 7b x ffffffffffffff85 7b
- 4d2 0 $0 _0
- 0 7b 0 0
-int(90)
+ 4d2 0 $0 _0
+ 0 7b 0 0
+int(92)
-- Iteration 4 --
-1 1 1
- 1 x 1 1
+1 1 1
+ 1 x 1 1
- #1 1 $1 _1
- 1 1 1 1
-int(75)
+ #1 1 $1 _1
+ 1 1 1 1
+int(77)
-- Iteration 5 --
-1 1 0
- 1 x 0 1
+1 1 0
+ 1 x 0 1
- #0 1 $1 _0
- 0 1 1 1
-int(75)
-===DONE===
+ #0 1 $1 _0
+ 0 1 1 1
+int(77)
diff --git a/ext/standard/tests/strings/vprintf_variation15.phpt b/ext/standard/tests/strings/vprintf_variation15.phpt
index d27bb6270a..751dc5f6cb 100644
--- a/ext/standard/tests/strings/vprintf_variation15.phpt
+++ b/ext/standard/tests/strings/vprintf_variation15.phpt
@@ -49,7 +49,6 @@ foreach($formats as $format) {
}
?>
-===DONE===
--EXPECT--
*** Testing vprintf() : unsigned formats and unsigned values ***
@@ -72,4 +71,3 @@ int(10)
-- Iteration 5 --
1 2 3 4
int(7)
-===DONE===
diff --git a/ext/standard/tests/strings/vprintf_variation15_64bit.phpt b/ext/standard/tests/strings/vprintf_variation15_64bit.phpt
index 6e27b55dd3..3bf70f4cf1 100644
--- a/ext/standard/tests/strings/vprintf_variation15_64bit.phpt
+++ b/ext/standard/tests/strings/vprintf_variation15_64bit.phpt
@@ -49,7 +49,6 @@ foreach($formats as $format) {
}
?>
-===DONE===
--EXPECT--
*** Testing vprintf() : unsigned formats and unsigned values ***
@@ -72,4 +71,3 @@ int(10)
-- Iteration 5 --
1 2 3 4
int(7)
-===DONE===
diff --git a/ext/standard/tests/strings/vprintf_variation16.phpt b/ext/standard/tests/strings/vprintf_variation16.phpt
index 78e03644cc..16139a2e65 100644
--- a/ext/standard/tests/strings/vprintf_variation16.phpt
+++ b/ext/standard/tests/strings/vprintf_variation16.phpt
@@ -20,9 +20,9 @@ echo "*** Testing vprintf() : unsigned formats and signed & other types of value
// defining array of unsigned formats
$formats =
- '%u %+u %-u
+ '%u %+u %-u
%lu %Lu %4u %-4u
- %10.4u %-10.4u %.4u
+ %10.4u %-10.4u %.4u
%\'#2u %\'2u %\'$2u %\'_2u
%3$u %4$u %1$u %2$u';
@@ -71,39 +71,37 @@ foreach($args_array as $args) {
$counter++;
}
?>
-===DONE===
--EXPECT--
*** Testing vprintf() : unsigned formats and signed & other types of values ***
-- Iteration 1 --
-2 0 10
+2 0 10
123456 u 1234 2820130816
- 2840207360 1177509888 12345
+ 2840207360 1177509888 12345
12 4294967284 4294843840 _3
10 123456 2 0
-int(115)
+int(113)
-- Iteration 2 --
-0 0 0
+0 0 0
123 u 4294967173 123
- 0 0 0
+ 0 0 0
1234 0 $0 _0
0 123 0 0
-int(88)
+int(86)
-- Iteration 3 --
-1 1 1
+1 1 1
1 u 1 1
- 1 1 1
+ 1 1 1
#1 1 $1 _1
1 1 1 1
-int(76)
+int(74)
-- Iteration 4 --
-1 1 0
+1 1 0
1 u 0 1
- 1 1 0
+ 1 1 0
#0 1 $1 _0
0 1 1 1
-int(76)
-===DONE===
+int(74)
diff --git a/ext/standard/tests/strings/vprintf_variation16_64bit.phpt b/ext/standard/tests/strings/vprintf_variation16_64bit.phpt
index 5189d58abc..735e9c5af1 100644
--- a/ext/standard/tests/strings/vprintf_variation16_64bit.phpt
+++ b/ext/standard/tests/strings/vprintf_variation16_64bit.phpt
@@ -20,11 +20,11 @@ echo "*** Testing vprintf() : unsigned formats and signed & other types of value
// defining array of unsigned formats
$formats =
- '%u %+u %-u
- %lu %Lu %4u %-4u
- %10.4u %-10.4u %.4u
- %\'#2u %\'2u %\'$2u %\'_2u
- %3$u %4$u %1$u %2$u';
+ '%u %+u %-u
+ %lu %Lu %4u %-4u
+ %10.4u %-10.4u %.4u
+ %\'#2u %\'2u %\'$2u %\'_2u
+ %3$u %4$u %1$u %2$u';
// Arrays of signed and other type of values for the format defined in $format.
// Each sub array contains signed values which correspond to each format in $format
@@ -72,39 +72,37 @@ foreach($args_array as $args) {
}
?>
-===DONE===
--EXPECT--
*** Testing vprintf() : unsigned formats and signed & other types of values ***
-- Iteration 1 --
-2 0 10
- 123456 u 1234 20000000000
- 2000000000000 22000000000000 12345
- 12 18446744073709551604 18446744073709428160 _3
- 10 123456 2 0
-int(143)
+2 0 10
+ 123456 u 1234 20000000000
+ 2000000000000 22000000000000 12345
+ 12 18446744073709551604 18446744073709428160 _3
+ 10 123456 2 0
+int(145)
-- Iteration 2 --
-0 0 0
- 123 u 18446744073709551493 123
- 0 0 0
- 1234 0 $0 _0
- 0 123 0 0
-int(98)
+0 0 0
+ 123 u 18446744073709551493 123
+ 0 0 0
+ 1234 0 $0 _0
+ 0 123 0 0
+int(100)
-- Iteration 3 --
-1 1 1
- 1 u 1 1
- 1 1 1
- #1 1 $1 _1
- 1 1 1 1
-int(76)
+1 1 1
+ 1 u 1 1
+ 1 1 1
+ #1 1 $1 _1
+ 1 1 1 1
+int(78)
-- Iteration 4 --
-1 1 0
- 1 u 0 1
- 1 1 0
- #0 1 $1 _0
- 0 1 1 1
-int(76)
-===DONE===
+1 1 0
+ 1 u 0 1
+ 1 1 0
+ #0 1 $1 _0
+ 0 1 1 1
+int(78)
diff --git a/ext/standard/tests/strings/vprintf_variation17.phpt b/ext/standard/tests/strings/vprintf_variation17.phpt
index e86f80551c..d8b69c5b75 100644
--- a/ext/standard/tests/strings/vprintf_variation17.phpt
+++ b/ext/standard/tests/strings/vprintf_variation17.phpt
@@ -45,7 +45,6 @@ foreach($formats as $format) {
}
?>
-===DONE===
--EXPECT--
*** Testing vprintf() : scientific formats and scientific values ***
@@ -68,4 +67,3 @@ int(74)
-- Iteration 5 --
1.000000e+3 2.000000e+3 3.000000e+3 4.000000e+3
int(47)
-===DONE===
diff --git a/ext/standard/tests/strings/vprintf_variation18.phpt b/ext/standard/tests/strings/vprintf_variation18.phpt
index 91f5d13694..98bc65794f 100644
--- a/ext/standard/tests/strings/vprintf_variation18.phpt
+++ b/ext/standard/tests/strings/vprintf_variation18.phpt
@@ -16,11 +16,11 @@ echo "*** Testing vprintf() : scientific formats and non-scientific values ***\n
// defining array of non-scientific formats
$formats =
- '%e %+e %-e
- %le %Le %4e %-4e
- %10.4e %-10.4e %04e %04.4e
- %\'#2e %\'2e %\'$2e %\'_2e
- %3$e %4$e %1$e %2$e';
+ '%e %+e %-e
+ %le %Le %4e %-4e
+ %10.4e %-10.4e %04e %04.4e
+ %\'#2e %\'2e %\'$2e %\'_2e
+ %3$e %4$e %1$e %2$e';
// Arrays of non scientific values for the format defined in $format.
// Each sub array contains non scientific values which correspond to each format in $format
@@ -68,39 +68,37 @@ foreach($args_array as $args) {
}
?>
-===DONE===
--EXPECT--
*** Testing vprintf() : scientific formats and non-scientific values ***
-- Iteration 1 --
-2.200000e+0 +2.000000e-1 1.020000e+1
- 1.234562e+5 e -1.234679e+3 1.234679e+3
- 2.0000e+1 2.1220e+2 -4.110000e+11 2.2120e+3
- 1.234578e+4 1.200000e+1 -1.200000e+1 -1.234562e+5
- 1.020000e+1 1.234562e+5 2.200000e+0 2.000000e-1
-int(232)
+2.200000e+0 +2.000000e-1 1.020000e+1
+ 1.234562e+5 e -1.234679e+3 1.234679e+3
+ 2.0000e+1 2.1220e+2 -4.110000e+11 2.2120e+3
+ 1.234578e+4 1.200000e+1 -1.200000e+1 -1.234562e+5
+ 1.020000e+1 1.234562e+5 2.200000e+0 2.000000e-1
+int(235)
-- Iteration 2 --
-0.000000e+0 +0.000000e+0 0.000000e+0
- 1.230000e+2 e -1.230000e+2 1.230000e+2
- 0.0000e+0 0.0000e+0 1.234560e+5 0.0000e+0
- 1.234000e+3 0.000000e+0 0.000000e+0 0.000000e+0
- 0.000000e+0 1.230000e+2 0.000000e+0 0.000000e+0
-int(228)
+0.000000e+0 +0.000000e+0 0.000000e+0
+ 1.230000e+2 e -1.230000e+2 1.230000e+2
+ 0.0000e+0 0.0000e+0 1.234560e+5 0.0000e+0
+ 1.234000e+3 0.000000e+0 0.000000e+0 0.000000e+0
+ 0.000000e+0 1.230000e+2 0.000000e+0 0.000000e+0
+int(231)
-- Iteration 3 --
-1.000000e+0 +1.000000e+0 1.000000e+0
- 1.000000e+0 e 1.000000e+0 1.000000e+0
- 1.0000e+0 1.0000e+0 1.000000e+0 1.0000e+0
- 1.000000e+0 1.000000e+0 1.000000e+0 1.000000e+0
- 1.000000e+0 1.000000e+0 1.000000e+0 1.000000e+0
-int(227)
+1.000000e+0 +1.000000e+0 1.000000e+0
+ 1.000000e+0 e 1.000000e+0 1.000000e+0
+ 1.0000e+0 1.0000e+0 1.000000e+0 1.0000e+0
+ 1.000000e+0 1.000000e+0 1.000000e+0 1.000000e+0
+ 1.000000e+0 1.000000e+0 1.000000e+0 1.000000e+0
+int(230)
-- Iteration 4 --
-1.000000e+0 +1.000000e+0 0.000000e+0
- 1.000000e+0 e 0.000000e+0 1.000000e+0
- 1.0000e+0 0.0000e+0 1.000000e+0 0.0000e+0
- 0.000000e+0 1.000000e+0 1.000000e+0 0.000000e+0
- 0.000000e+0 1.000000e+0 1.000000e+0 1.000000e+0
-int(227)
-===DONE===
+1.000000e+0 +1.000000e+0 0.000000e+0
+ 1.000000e+0 e 0.000000e+0 1.000000e+0
+ 1.0000e+0 0.0000e+0 1.000000e+0 0.0000e+0
+ 0.000000e+0 1.000000e+0 1.000000e+0 0.000000e+0
+ 0.000000e+0 1.000000e+0 1.000000e+0 1.000000e+0
+int(230)
diff --git a/ext/standard/tests/strings/vprintf_variation19.phpt b/ext/standard/tests/strings/vprintf_variation19.phpt
index 6ceda77022..446eb43383 100644
--- a/ext/standard/tests/strings/vprintf_variation19.phpt
+++ b/ext/standard/tests/strings/vprintf_variation19.phpt
@@ -54,7 +54,6 @@ foreach($formats as $format) {
}
?>
-===DONE===
--EXPECT--
*** Testing vprintf() : with white spaces in format strings ***
@@ -101,4 +100,3 @@ int(16)
-- Iteration 11 --
2.000000E+1 2.000000E-1 -2.000000E+1
int(38)
-===DONE===
diff --git a/ext/standard/tests/strings/vprintf_variation19_64bit.phpt b/ext/standard/tests/strings/vprintf_variation19_64bit.phpt
index 9d059569f2..779ed87740 100644
--- a/ext/standard/tests/strings/vprintf_variation19_64bit.phpt
+++ b/ext/standard/tests/strings/vprintf_variation19_64bit.phpt
@@ -54,7 +54,6 @@ foreach($formats as $format) {
}
?>
-===DONE===
--EXPECT--
*** Testing vprintf() : with white spaces in format strings ***
@@ -101,4 +100,3 @@ int(24)
-- Iteration 11 --
2.000000E+1 2.000000E-1 -2.000000E+1
int(38)
-===DONE===
diff --git a/ext/standard/tests/strings/vprintf_variation2.phpt b/ext/standard/tests/strings/vprintf_variation2.phpt
index 69e17d21a7..12ffb6dd1f 100644
--- a/ext/standard/tests/strings/vprintf_variation2.phpt
+++ b/ext/standard/tests/strings/vprintf_variation2.phpt
@@ -36,47 +36,47 @@ $file_handle = fopen(__FILE__, 'r');
//array of values to iterate over
$values = array(
- // int data
+ // int data
/*1*/ 0,
- 1,
- 12345,
- -2345,
+ 1,
+ 12345,
+ -2345,
- // float data
+ // float data
/*5*/ 10.5,
- -10.5,
- 10.1234567e10,
- 10.7654321E-10,
- .5,
+ -10.5,
+ 10.1234567e10,
+ 10.7654321E-10,
+ .5,
- // null data
+ // null data
/*10*/ NULL,
- null,
+ null,
- // boolean data
+ // boolean data
/*12*/ true,
- false,
- TRUE,
- FALSE,
+ false,
+ TRUE,
+ FALSE,
- // empty data
+ // empty data
/*16*/ "",
- '',
+ '',
- // string data
+ // string data
/*18*/ "string",
- 'string',
+ 'string',
- // object data
+ // object data
/*20*/ new sample(),
- // undefined data
+ // undefined data
/*21*/ @$undefined_var,
- // unset data
+ // unset data
/*22*/ @$unset_var,
- // resource data
+ // resource data
/*23*/ $file_handle
);
@@ -84,9 +84,13 @@ $values = array(
$counter = 1;
foreach($values as $value) {
echo "\n-- Iteration $counter --\n";
- $result = vprintf($format,$value);
- echo "\n";
- var_dump($result);
+ try {
+ $result = vprintf($format,$value);
+ echo "\n";
+ var_dump($result);
+ } catch (\ValueError $e) {
+ echo $e->getMessage(), "\n";
+ }
$counter++;
};
@@ -94,7 +98,6 @@ foreach($values as $value) {
fclose($file_handle);
?>
-===DONE===
--EXPECTF--
*** Testing vprintf() : with unexpected values for args argument ***
@@ -135,16 +138,10 @@ int(13)
int(3)
-- Iteration 10 --
-
-Warning: vprintf(): Too few arguments in %s on line %d
-
-bool(false)
+The arguments array must contain 1 items, 0 given
-- Iteration 11 --
-
-Warning: vprintf(): Too few arguments in %s on line %d
-
-bool(false)
+The arguments array must contain 1 items, 0 given
-- Iteration 12 --
1
@@ -179,24 +176,14 @@ string
int(6)
-- Iteration 20 --
-
-Warning: vprintf(): Too few arguments in %s on line %d
-
-bool(false)
+The arguments array must contain 1 items, 0 given
-- Iteration 21 --
-
-Warning: vprintf(): Too few arguments in %s on line %d
-
-bool(false)
+The arguments array must contain 1 items, 0 given
-- Iteration 22 --
-
-Warning: vprintf(): Too few arguments in %s on line %d
-
-bool(false)
+The arguments array must contain 1 items, 0 given
-- Iteration 23 --
Resource id #%d
int(%d)
-===DONE===
diff --git a/ext/standard/tests/strings/vprintf_variation3.phpt b/ext/standard/tests/strings/vprintf_variation3.phpt
index 6967679715..035b81a799 100644
--- a/ext/standard/tests/strings/vprintf_variation3.phpt
+++ b/ext/standard/tests/strings/vprintf_variation3.phpt
@@ -53,7 +53,6 @@ foreach($formats as $format) {
}
?>
-===DONE===
--EXPECT--
*** Testing vprintf() : int formats with int values ***
@@ -88,4 +87,3 @@ int(8)
-- Iteration 8 --
1 2 3 4
int(7)
-===DONE===
diff --git a/ext/standard/tests/strings/vprintf_variation4.phpt b/ext/standard/tests/strings/vprintf_variation4.phpt
index aab27337d9..93adbb79ff 100644
--- a/ext/standard/tests/strings/vprintf_variation4.phpt
+++ b/ext/standard/tests/strings/vprintf_variation4.phpt
@@ -20,7 +20,7 @@ echo "*** Testing vprintf() : int formats and non-integer values ***\n";
// defining array of int formats
$formats =
- '%d %+d %-d
+ '%d %+d %-d
%ld %Ld %4d %-4d
%10.4d %-10.4d %.4d %04.4d
%\'#2d %\'2d %\'$2d %\'_2d
@@ -72,39 +72,37 @@ foreach($args_array as $args) {
}
?>
-===DONE===
--EXPECT--
*** Testing vprintf() : int formats and non-integer values ***
-- Iteration 1 --
-2 +0 10
+2 +0 10
123456 d -1234 1234
-1474836480 200000 4000 22000000
12345 12 -12 -123456
10 123456 2 0
-int(112)
+int(111)
-- Iteration 2 --
-0 +0 0
+0 +0 0
123 d -123 123
0 0 123456 0000
1234 0 $0 _0
0 123 0 0
-int(92)
+int(91)
-- Iteration 3 --
-1 +1 1
+1 +1 1
1 d 1 1
1 1 1 0001
#1 1 $1 _1
1 1 1 1
-int(81)
+int(80)
-- Iteration 4 --
-1 +1 0
+1 +1 0
1 d 0 1
1 0 1 0000
#0 1 $1 _0
0 1 1 1
-int(81)
-===DONE===
+int(80)
diff --git a/ext/standard/tests/strings/vprintf_variation4_64bit.phpt b/ext/standard/tests/strings/vprintf_variation4_64bit.phpt
index 76c079d69a..35f0663b52 100644
--- a/ext/standard/tests/strings/vprintf_variation4_64bit.phpt
+++ b/ext/standard/tests/strings/vprintf_variation4_64bit.phpt
@@ -20,11 +20,11 @@ echo "*** Testing vprintf() : int formats and non-integer values ***\n";
// defining array of int formats
$formats =
- '%d %+d %-d
- %ld %Ld %4d %-4d
- %10.4d %-10.4d %.4d %04.4d
- %\'#2d %\'2d %\'$2d %\'_2d
- %3$d %4$d %1$d %2$d';
+ '%d %+d %-d
+ %ld %Ld %4d %-4d
+ %10.4d %-10.4d %.4d %04.4d
+ %\'#2d %\'2d %\'$2d %\'_2d
+ %3$d %4$d %1$d %2$d';
// Arrays of non int values for the format defined in $format.
// Each sub array contains non int values which correspond to each format in $format
@@ -72,39 +72,37 @@ foreach($args_array as $args) {
}
?>
-===DONE===
--EXPECT--
*** Testing vprintf() : int formats and non-integer values ***
-- Iteration 1 --
-2 +0 10
- 123456 d -1234 1234
- 20000000000 200000 4000 22000000
- 12345 12 -12 -123456
- 10 123456 2 0
-int(112)
+2 +0 10
+ 123456 d -1234 1234
+ 20000000000 200000 4000 22000000
+ 12345 12 -12 -123456
+ 10 123456 2 0
+int(115)
-- Iteration 2 --
-0 +0 0
- 123 d -123 123
- 0 0 123456 0000
- 1234 0 $0 _0
- 0 123 0 0
-int(92)
+0 +0 0
+ 123 d -123 123
+ 0 0 123456 0000
+ 1234 0 $0 _0
+ 0 123 0 0
+int(95)
-- Iteration 3 --
-1 +1 1
- 1 d 1 1
- 1 1 1 0001
- #1 1 $1 _1
- 1 1 1 1
-int(81)
+1 +1 1
+ 1 d 1 1
+ 1 1 1 0001
+ #1 1 $1 _1
+ 1 1 1 1
+int(84)
-- Iteration 4 --
-1 +1 0
- 1 d 0 1
- 1 0 1 0000
- #0 1 $1 _0
- 0 1 1 1
-int(81)
-===DONE===
+1 +1 0
+ 1 d 0 1
+ 1 0 1 0000
+ #0 1 $1 _0
+ 0 1 1 1
+int(84)
diff --git a/ext/standard/tests/strings/vprintf_variation5.phpt b/ext/standard/tests/strings/vprintf_variation5.phpt
index dde6170e9f..44e2d23607 100644
--- a/ext/standard/tests/strings/vprintf_variation5.phpt
+++ b/ext/standard/tests/strings/vprintf_variation5.phpt
@@ -53,7 +53,6 @@ foreach($formats as $format) {
}
?>
-===DONE===
--EXPECT--
*** Testing vprintf() : int formats with float values ***
@@ -88,4 +87,3 @@ int(15)
-- Iteration 8 --
1.110000 2.220000 3.330000 4.440000
int(35)
-===DONE===
diff --git a/ext/standard/tests/strings/vprintf_variation6.phpt b/ext/standard/tests/strings/vprintf_variation6.phpt
index 0283bc4541..6bae1cdb33 100644
--- a/ext/standard/tests/strings/vprintf_variation6.phpt
+++ b/ext/standard/tests/strings/vprintf_variation6.phpt
@@ -16,11 +16,11 @@ echo "*** Testing vprintf() : float formats and non-float values ***\n";
// defining array of float formats
$formats =
- '%f %+f %-f
- %lf %Lf %4f %-4f
- %10.4f %-10.4f %04f %04.4f
- %\'#2f %\'2f %\'$2f %\'_2f
- %3$f %4$f %1$f %2$f';
+ '%f %+f %-f
+ %lf %Lf %4f %-4f
+ %10.4f %-10.4f %04f %04.4f
+ %\'#2f %\'2f %\'$2f %\'_2f
+ %3$f %4$f %1$f %2$f';
// Arrays of non float values for the format defined in $format.
// Each sub array contains non float values which correspond to each format in $format
@@ -68,39 +68,37 @@ foreach($args_array as $args) {
}
?>
-===DONE===
--EXPECT--
*** Testing vprintf() : float formats and non-float values ***
-- Iteration 1 --
-2.000000 -2.000000 2.000000
- 123456.000000 f -12346789.000000 12346789.000000
- 123200.0000 20000.0000 -40000.000000 22212.0000
- 12345780.000000 1211111.000000 -12111111.000000 -12345634.000000
- 2.000000 123456.000000 2.000000 -2.000000
-int(244)
+2.000000 -2.000000 2.000000
+ 123456.000000 f -12346789.000000 12346789.000000
+ 123200.0000 20000.0000 -40000.000000 22212.0000
+ 12345780.000000 1211111.000000 -12111111.000000 -12345634.000000
+ 2.000000 123456.000000 2.000000 -2.000000
+int(247)
-- Iteration 2 --
-0.000000 +0.000000 0.000000
- 123.000000 f -123.000000 123.000000
- 0.0000 0.0000 123456.000000 0.0000
- 1234.000000 0.000000 0.000000 0.000000
- 0.000000 123.000000 0.000000 0.000000
-int(196)
+0.000000 +0.000000 0.000000
+ 123.000000 f -123.000000 123.000000
+ 0.0000 0.0000 123456.000000 0.0000
+ 1234.000000 0.000000 0.000000 0.000000
+ 0.000000 123.000000 0.000000 0.000000
+int(199)
-- Iteration 3 --
-1.000000 +1.000000 1.000000
- 1.000000 f 1.000000 1.000000
- 1.0000 1.0000 1.000000 1.0000
- 1.000000 1.000000 1.000000 1.000000
- 1.000000 1.000000 1.000000 1.000000
-int(179)
+1.000000 +1.000000 1.000000
+ 1.000000 f 1.000000 1.000000
+ 1.0000 1.0000 1.000000 1.0000
+ 1.000000 1.000000 1.000000 1.000000
+ 1.000000 1.000000 1.000000 1.000000
+int(182)
-- Iteration 4 --
-1.000000 +1.000000 0.000000
- 1.000000 f 0.000000 1.000000
- 1.0000 0.0000 1.000000 0.0000
- 0.000000 1.000000 1.000000 0.000000
- 0.000000 1.000000 1.000000 1.000000
-int(179)
-===DONE===
+1.000000 +1.000000 0.000000
+ 1.000000 f 0.000000 1.000000
+ 1.0000 0.0000 1.000000 0.0000
+ 0.000000 1.000000 1.000000 0.000000
+ 0.000000 1.000000 1.000000 1.000000
+int(182)
diff --git a/ext/standard/tests/strings/vprintf_variation7.phpt b/ext/standard/tests/strings/vprintf_variation7.phpt
index d7c81fca14..ef17df59c2 100644
--- a/ext/standard/tests/strings/vprintf_variation7.phpt
+++ b/ext/standard/tests/strings/vprintf_variation7.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/vprintf_variation8.phpt b/ext/standard/tests/strings/vprintf_variation8.phpt
index f635b1d4c0..7b03c79441 100644
--- a/ext/standard/tests/strings/vprintf_variation8.phpt
+++ b/ext/standard/tests/strings/vprintf_variation8.phpt
@@ -12,17 +12,15 @@ Test vprintf() function : usage variations - string formats with non-string valu
* the '$format' and '$args' arguments of the function
*/
-error_reporting(E_ALL & ~E_NOTICE);
-
echo "*** Testing vprintf() : string formats and non-string values ***\n";
// defining array of string formats
$formats =
- '%s %+s %-s
- %ls %Ls %4s %-4s
- %10.4s %-10.4s %04s %04.4s
- %\'#2s %\'2s %\'$2s %\'_2s
- %3$s %4$s %1$s %2$s';
+ '%s %+s %-s
+ %ls %Ls %4s %-4s
+ %10.4s %-10.4s %04s %04.4s
+ %\'#2s %\'2s %\'$2s %\'_2s
+ %3$s %4$s %1$s %2$s';
// Arrays of non string values for the format defined in $format.
// Each sub array contains non string values which correspond to each format in $format
@@ -71,39 +69,73 @@ foreach($args_array as $args) {
}
?>
-===DONE===
---EXPECT--
+--EXPECTF--
*** Testing vprintf() : string formats and non-string values ***
-- Iteration 1 --
-2.2 0.2 10.2
- 123456.234 s -1234.6789 1234.6789
- 2123 2765 -27654321000 1234
- 12.000000011111 -12.00000111111 -123456.234 3.33
- 10.2 123456.234 2.2 0.2
-int(172)
+2.2 0.2 10.2
+ 123456.234 s -1234.6789 1234.6789
+ 2123 2765 -27654321000 1234
+ 12.000000011111 -12.00000111111 -123456.234 3.33
+ 10.2 123456.234 2.2 0.2
+int(175)
-- Iteration 2 --
-2 -2 2
- 123456 s -12346789 12346789
- 1232 2000 -40000 2221
- 12345780 1211111 -12111111 -12345634
- 2 123456 2 -2
-int(132)
+2 -2 2
+ 123456 s -12346789 12346789
+ 1232 2000 -40000 2221
+ 12345780 1211111 -12111111 -12345634
+ 2 123456 2 -2
+int(135)
-- Iteration 3 --
-Array Array Array
- Array s Array Array
- Arra Arra Array Arra
- Array Array Array Array
- Array Array Array Array
-int(131)
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+Array Array Array
+ Array s Array Array
+ Arra Arra Array Arra
+ Array Array Array Array
+ Array Array Array Array
+int(134)
-- Iteration 4 --
-1 1
- 1 s 1
- 1 0001 0000
- #0 1 $1 _0
- 1 1 1
-int(81)
-===DONE===
+1 1
+ 1 s 1
+ 1 0001 0000
+ #0 1 $1 _0
+ 1 1 1
+int(84)
diff --git a/ext/standard/tests/strings/vprintf_variation9.phpt b/ext/standard/tests/strings/vprintf_variation9.phpt
index 128af1a692..a1c99a9098 100644
--- a/ext/standard/tests/strings/vprintf_variation9.phpt
+++ b/ext/standard/tests/strings/vprintf_variation9.phpt
Binary files differ
diff --git a/ext/standard/tests/strings/vsprintf_variation1.phpt b/ext/standard/tests/strings/vsprintf_variation1.phpt
index 15c749d3f8..4b2da4b551 100644
--- a/ext/standard/tests/strings/vsprintf_variation1.phpt
+++ b/ext/standard/tests/strings/vsprintf_variation1.phpt
@@ -88,10 +88,13 @@ $values = array(
$counter = 1;
foreach($values as $value) {
echo "\n -- Iteration $counter --\n";
- var_dump( vsprintf($value,$args) );
+ try {
+ var_dump(vsprintf($value, $args));
+ } catch (TypeError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
$counter++;
-
-};
+}
// closing the resource
fclose($file_handle);
@@ -129,29 +132,19 @@ string(13) "1.07654321E-9"
string(3) "0.5"
-- Iteration 10 --
-
-Notice: Array to string conversion in %s on line %d
-string(5) "Array"
+vsprintf() expects parameter 1 to be string, array given
-- Iteration 11 --
-
-Notice: Array to string conversion in %s on line %d
-string(5) "Array"
+vsprintf() expects parameter 1 to be string, array given
-- Iteration 12 --
-
-Notice: Array to string conversion in %s on line %d
-string(5) "Array"
+vsprintf() expects parameter 1 to be string, array given
-- Iteration 13 --
-
-Notice: Array to string conversion in %s on line %d
-string(5) "Array"
+vsprintf() expects parameter 1 to be string, array given
-- Iteration 14 --
-
-Notice: Array to string conversion in %s on line %d
-string(5) "Array"
+vsprintf() expects parameter 1 to be string, array given
-- Iteration 15 --
string(0) ""
@@ -187,5 +180,5 @@ string(0) ""
string(0) ""
-- Iteration 26 --
-string(%d) "Resource id #%d"
+vsprintf() expects parameter 1 to be string, resource given
Done
diff --git a/ext/standard/tests/strings/vsprintf_variation12.phpt b/ext/standard/tests/strings/vsprintf_variation12.phpt
index 4385cdfe39..8ef03b3acd 100644
--- a/ext/standard/tests/strings/vsprintf_variation12.phpt
+++ b/ext/standard/tests/strings/vsprintf_variation12.phpt
@@ -20,9 +20,9 @@ echo "*** Testing vsprintf() : octal formats and non-octal values ***\n";
// defining array of octal formats
$formats =
- '%o %+o %-o
+ '%o %+o %-o
%lo %Lo %4o %-4o
- %10.4o %-10.4o %.4o
+ %10.4o %-10.4o %.4o
%\'#2o %\'2o %\'$2o %\'_2o
%3$o %4$o %1$o %2$o';
@@ -82,37 +82,37 @@ echo "Done";
*** Testing vsprintf() : octal formats and non-octal values ***
-- Iteration 1 --
-string(116) "2 0 12
+string(114) "2 0 12
361100 o 37777775456 2322
-
+
30071 14 37777777764 37777416700
12 361100 2 0"
-- Iteration 2 --
-string(146) "2 37777777776 2
+string(144) "2 37777777776 2
361100 o 37720715133 57062645
-
+
57060664 4475347 37721631371 37720717336
2 361100 2 37777777776"
-- Iteration 3 --
-string(88) "0 0 0
+string(86) "0 0 0
173 o 37777777605 173
-
+
2322 0 $0 _0
0 173 0 0"
-- Iteration 4 --
-string(75) "1 1 1
+string(73) "1 1 1
1 o 1 1
-
+
#1 1 $1 _1
1 1 1 1"
-- Iteration 5 --
-string(75) "1 1 0
+string(73) "1 1 0
1 o 0 1
-
+
#0 1 $1 _0
0 1 1 1"
Done
diff --git a/ext/standard/tests/strings/vsprintf_variation12_64bit.phpt b/ext/standard/tests/strings/vsprintf_variation12_64bit.phpt
index 7f49818d04..b786bfe21e 100644
--- a/ext/standard/tests/strings/vsprintf_variation12_64bit.phpt
+++ b/ext/standard/tests/strings/vsprintf_variation12_64bit.phpt
@@ -20,11 +20,11 @@ echo "*** Testing vsprintf() : octal formats and non-octal values ***\n";
// defining array of octal formats
$formats =
- '%o %+o %-o
- %lo %Lo %4o %-4o
- %10.4o %-10.4o %.4o
- %\'#2o %\'2o %\'$2o %\'_2o
- %3$o %4$o %1$o %2$o';
+ '%o %+o %-o
+ %lo %Lo %4o %-4o
+ %10.4o %-10.4o %.4o
+ %\'#2o %\'2o %\'$2o %\'_2o
+ %3$o %4$o %1$o %2$o';
// Arrays of non octal values for the format defined in $format.
// Each sub array contains non octal values which correspond to each format in $format
@@ -82,37 +82,37 @@ echo "Done";
*** Testing vsprintf() : octal formats and non-octal values ***
-- Iteration 1 --
-string(148) "2 0 12
- 361100 o 1777777777777777775456 2322
+string(151) "2 0 12
+ 361100 o 1777777777777777775456 2322
- 30071 14 1777777777777777777764 1777777777777777416700
- 12 361100 2 0"
+ 30071 14 1777777777777777777764 1777777777777777416700
+ 12 361100 2 0"
-- Iteration 2 --
-string(200) "2 1777777777777777777776 2
- 361100 o 1777777777777720715133 57062645
+string(203) "2 1777777777777777777776 2
+ 361100 o 1777777777777720715133 57062645
- 57060664 4475347 1777777777777721631371 1777777777777720717336
- 2 361100 2 1777777777777777777776"
+ 57060664 4475347 1777777777777721631371 1777777777777720717336
+ 2 361100 2 1777777777777777777776"
-- Iteration 3 --
-string(98) "0 0 0
- 173 o 1777777777777777777605 173
+string(101) "0 0 0
+ 173 o 1777777777777777777605 173
- 2322 0 $0 _0
- 0 173 0 0"
+ 2322 0 $0 _0
+ 0 173 0 0"
-- Iteration 4 --
-string(74) "1 1 1
- 1 o 1 1
+string(77) "1 1 1
+ 1 o 1 1
- #1 1 $1 _1
- 1 1 1 1"
+ #1 1 $1 _1
+ 1 1 1 1"
-- Iteration 5 --
-string(74) "1 1 0
- 1 o 0 1
+string(77) "1 1 0
+ 1 o 0 1
- #0 1 $1 _0
- 0 1 1 1"
+ #0 1 $1 _0
+ 0 1 1 1"
Done
diff --git a/ext/standard/tests/strings/vsprintf_variation14.phpt b/ext/standard/tests/strings/vsprintf_variation14.phpt
index 749d8fa2df..ede83de3c1 100644
--- a/ext/standard/tests/strings/vsprintf_variation14.phpt
+++ b/ext/standard/tests/strings/vsprintf_variation14.phpt
@@ -20,9 +20,9 @@ echo "*** Testing vsprintf() : hexa formats and non-hexa values ***\n";
// defining array of different hexa formats
$formats =
- '%x %+x %-x
+ '%x %+x %-x
%lx %Lx %4x %-4x
- %10.4x %-10.4x %.4x
+ %10.4x %-10.4x %.4x
%\'#2x %\'2x %\'$2x %\'_2x
%3$x %4$x %1$x %2$x';
@@ -83,37 +83,37 @@ echo "Done";
*** Testing vsprintf() : hexa formats and non-hexa values ***
-- Iteration 1 --
-string(101) "2 0 a
+string(99) "2 0 a
1e240 x fffffb2e 4d2
-
+
3039 c fffffff4 fffe1dc0
a 1e240 2 0"
-- Iteration 2 --
-string(124) "2 fffffffe 2
+string(122) "2 fffffffe 2
1e240 x ff439a5b bc65a5
-
+
bc61b4 127ae7 ff4732f9 ff439ede
2 1e240 2 fffffffe"
-- Iteration 3 --
-string(82) "0 0 0
+string(80) "0 0 0
7b x ffffff85 7b
-
+
4d2 0 $0 _0
0 7b 0 0"
-- Iteration 4 --
-string(75) "1 1 1
+string(73) "1 1 1
1 x 1 1
-
+
#1 1 $1 _1
1 1 1 1"
-- Iteration 5 --
-string(75) "1 1 0
+string(73) "1 1 0
1 x 0 1
-
+
#0 1 $1 _0
0 1 1 1"
Done
diff --git a/ext/standard/tests/strings/vsprintf_variation14_64bit.phpt b/ext/standard/tests/strings/vsprintf_variation14_64bit.phpt
index 85c7d30a49..971a7ae3b2 100644
--- a/ext/standard/tests/strings/vsprintf_variation14_64bit.phpt
+++ b/ext/standard/tests/strings/vsprintf_variation14_64bit.phpt
@@ -20,11 +20,11 @@ echo "*** Testing vsprintf() : hexa formats and non-hexa values ***\n";
// defining array of different hexa formats
$formats =
- '%x %+x %-x
- %lx %Lx %4x %-4x
- %10.4x %-10.4x %.4x
- %\'#2x %\'2x %\'$2x %\'_2x
- %3$x %4$x %1$x %2$x';
+ '%x %+x %-x
+ %lx %Lx %4x %-4x
+ %10.4x %-10.4x %.4x
+ %\'#2x %\'2x %\'$2x %\'_2x
+ %3$x %4$x %1$x %2$x';
// Arrays of non hexa values for the format defined in $format.
// Each sub array contains non hexa values which correspond to each format in $format
@@ -83,37 +83,37 @@ echo "Done";
*** Testing vsprintf() : hexa formats and non-hexa values ***
-- Iteration 1 --
-string(124) "2 0 a
- 1e240 x fffffffffffffb2e 4d2
+string(127) "2 0 a
+ 1e240 x fffffffffffffb2e 4d2
- 3039 c fffffffffffffff4 fffffffffffe1dc0
- a 1e240 2 0"
+ 3039 c fffffffffffffff4 fffffffffffe1dc0
+ a 1e240 2 0"
-- Iteration 2 --
-string(163) "2 fffffffffffffffe 2
- 1e240 x ffffffffff439a5b bc65a5
+string(166) "2 fffffffffffffffe 2
+ 1e240 x ffffffffff439a5b bc65a5
- bc61b4 127ae7 ffffffffff4732f9 ffffffffff439ede
- 2 1e240 2 fffffffffffffffe"
+ bc61b4 127ae7 ffffffffff4732f9 ffffffffff439ede
+ 2 1e240 2 fffffffffffffffe"
-- Iteration 3 --
-string(89) "0 0 0
- 7b x ffffffffffffff85 7b
+string(92) "0 0 0
+ 7b x ffffffffffffff85 7b
- 4d2 0 $0 _0
- 0 7b 0 0"
+ 4d2 0 $0 _0
+ 0 7b 0 0"
-- Iteration 4 --
-string(74) "1 1 1
- 1 x 1 1
+string(77) "1 1 1
+ 1 x 1 1
- #1 1 $1 _1
- 1 1 1 1"
+ #1 1 $1 _1
+ 1 1 1 1"
-- Iteration 5 --
-string(74) "1 1 0
- 1 x 0 1
+string(77) "1 1 0
+ 1 x 0 1
- #0 1 $1 _0
- 0 1 1 1"
+ #0 1 $1 _0
+ 0 1 1 1"
Done
diff --git a/ext/standard/tests/strings/vsprintf_variation15.phpt b/ext/standard/tests/strings/vsprintf_variation15.phpt
index 62688be727..f31aadfb46 100644
--- a/ext/standard/tests/strings/vsprintf_variation15.phpt
+++ b/ext/standard/tests/strings/vsprintf_variation15.phpt
@@ -47,7 +47,6 @@ foreach($formats as $format) {
}
?>
-===Done===
--EXPECT--
*** Testing vsprintf() : unsigned formats and unsigned values ***
@@ -65,4 +64,3 @@ string(10) "#1 0 $0 10"
-- Iteration 5 --
string(7) "1 2 3 4"
-===Done===
diff --git a/ext/standard/tests/strings/vsprintf_variation16.phpt b/ext/standard/tests/strings/vsprintf_variation16.phpt
index 7e86f2890e..862828d5ad 100644
--- a/ext/standard/tests/strings/vsprintf_variation16.phpt
+++ b/ext/standard/tests/strings/vsprintf_variation16.phpt
@@ -20,9 +20,9 @@ echo "*** Testing vsprintf() : unsigned formats and signed & other types of valu
// defining array of unsigned formats
$formats =
- '%u %+u %-u
+ '%u %+u %-u
%lu %Lu %4u %-4u
- %10.4u %-10.4u %.4u
+ %10.4u %-10.4u %.4u
%\'#2u %\'2u %\'$2u %\'_2u
%3$u %4$u %1$u %2$u';
@@ -75,30 +75,30 @@ echo "Done";
*** Testing vsprintf() : unsigned formats and signed & other types of values ***
-- Iteration 1 --
-string(115) "2 0 10
+string(113) "2 0 10
123456 u 1234 2820130816
- 2840207360 1177509888 12345
+ 2840207360 1177509888 12345
12 4294967284 4294843840 _3
10 123456 2 0"
-- Iteration 2 --
-string(88) "0 0 0
+string(86) "0 0 0
123 u 4294967173 123
- 0 0 0
+ 0 0 0
1234 0 $0 _0
0 123 0 0"
-- Iteration 3 --
-string(76) "1 1 1
+string(74) "1 1 1
1 u 1 1
- 1 1 1
+ 1 1 1
#1 1 $1 _1
1 1 1 1"
-- Iteration 4 --
-string(76) "1 1 0
+string(74) "1 1 0
1 u 0 1
- 1 1 0
+ 1 1 0
#0 1 $1 _0
0 1 1 1"
Done
diff --git a/ext/standard/tests/strings/vsprintf_variation16_64bit.phpt b/ext/standard/tests/strings/vsprintf_variation16_64bit.phpt
index 112276654c..e6cbd84484 100644
--- a/ext/standard/tests/strings/vsprintf_variation16_64bit.phpt
+++ b/ext/standard/tests/strings/vsprintf_variation16_64bit.phpt
@@ -20,11 +20,11 @@ echo "*** Testing vsprintf() : unsigned formats and signed & other types of valu
// defining array of unsigned formats
$formats =
- '%u %+u %-u
- %lu %Lu %4u %-4u
- %10.4u %-10.4u %.4u
- %\'#2u %\'2u %\'$2u %\'_2u
- %3$u %4$u %1$u %2$u';
+ '%u %+u %-u
+ %lu %Lu %4u %-4u
+ %10.4u %-10.4u %.4u
+ %\'#2u %\'2u %\'$2u %\'_2u
+ %3$u %4$u %1$u %2$u';
// Arrays of signed and other type of values for the format defined in $format.
// Each sub array contains signed values which correspond to each format in $format
@@ -75,30 +75,30 @@ echo "Done";
*** Testing vsprintf() : unsigned formats and signed & other types of values ***
-- Iteration 1 --
-string(142) "2 0 10
- 123456 u 1234 20000000000
- 2000000000000 22000000000000 12345
- 12 18446744073709551604 18446744073709428160 _3
- 10 123456 2 0"
+string(145) "2 0 10
+ 123456 u 1234 20000000000
+ 2000000000000 22000000000000 12345
+ 12 18446744073709551604 18446744073709428160 _3
+ 10 123456 2 0"
-- Iteration 2 --
-string(97) "0 0 0
- 123 u 18446744073709551493 123
- 0 0 0
- 1234 0 $0 _0
- 0 123 0 0"
+string(100) "0 0 0
+ 123 u 18446744073709551493 123
+ 0 0 0
+ 1234 0 $0 _0
+ 0 123 0 0"
-- Iteration 3 --
-string(75) "1 1 1
- 1 u 1 1
- 1 1 1
- #1 1 $1 _1
- 1 1 1 1"
+string(78) "1 1 1
+ 1 u 1 1
+ 1 1 1
+ #1 1 $1 _1
+ 1 1 1 1"
-- Iteration 4 --
-string(75) "1 1 0
- 1 u 0 1
- 1 1 0
- #0 1 $1 _0
- 0 1 1 1"
+string(78) "1 1 0
+ 1 u 0 1
+ 1 1 0
+ #0 1 $1 _0
+ 0 1 1 1"
Done
diff --git a/ext/standard/tests/strings/vsprintf_variation2.phpt b/ext/standard/tests/strings/vsprintf_variation2.phpt
index 838093cdb1..3af9b854fe 100644
--- a/ext/standard/tests/strings/vsprintf_variation2.phpt
+++ b/ext/standard/tests/strings/vsprintf_variation2.phpt
@@ -84,7 +84,11 @@ $values = array(
$counter = 1;
foreach($values as $value) {
echo "\n-- Iteration $counter --\n";
- var_dump( vsprintf($format,$value) );
+ try {
+ var_dump( vsprintf($format,$value) );
+ } catch (\ValueError $e) {
+ echo $e->getMessage(), "\n";
+ }
$counter++;
};
@@ -124,14 +128,10 @@ string(13) "1.07654321E-9"
string(3) "0.5"
-- Iteration 10 --
-
-Warning: vsprintf(): Too few arguments in %s on line %d
-bool(false)
+The arguments array must contain 1 items, 0 given
-- Iteration 11 --
-
-Warning: vsprintf(): Too few arguments in %s on line %d
-bool(false)
+The arguments array must contain 1 items, 0 given
-- Iteration 12 --
string(1) "1"
@@ -158,19 +158,13 @@ string(6) "string"
string(6) "string"
-- Iteration 20 --
-
-Warning: vsprintf(): Too few arguments in %s on line %d
-bool(false)
+The arguments array must contain 1 items, 0 given
-- Iteration 21 --
-
-Warning: vsprintf(): Too few arguments in %s on line %d
-bool(false)
+The arguments array must contain 1 items, 0 given
-- Iteration 22 --
-
-Warning: vsprintf(): Too few arguments in %s on line %d
-bool(false)
+The arguments array must contain 1 items, 0 given
-- Iteration 23 --
string(%d) "Resource id #%d"
diff --git a/ext/standard/tests/strings/vsprintf_variation4.phpt b/ext/standard/tests/strings/vsprintf_variation4.phpt
index 8fe8aba5cd..69b6c913ea 100644
--- a/ext/standard/tests/strings/vsprintf_variation4.phpt
+++ b/ext/standard/tests/strings/vsprintf_variation4.phpt
@@ -20,7 +20,7 @@ echo "*** Testing vsprintf() : int formats and non-integer values ***\n";
// defining array of int formats
$formats =
- '%d %+d %-d
+ '%d %+d %-d
%ld %Ld %4d %-4d
%10.4d %-10.4d %.4d %04.4d
%\'#2d %\'2d %\'$2d %\'_2d
@@ -75,28 +75,28 @@ echo "Done";
*** Testing vsprintf() : int formats and non-integer values ***
-- Iteration 1 --
-string(112) "2 +0 10
+string(111) "2 +0 10
123456 d -1234 1234
-1474836480 200000 4000 22000000
12345 12 -12 -123456
10 123456 2 0"
-- Iteration 2 --
-string(92) "0 +0 0
+string(91) "0 +0 0
123 d -123 123
0 0 123456 0000
1234 0 $0 _0
0 123 0 0"
-- Iteration 3 --
-string(81) "1 +1 1
+string(80) "1 +1 1
1 d 1 1
1 1 1 0001
#1 1 $1 _1
1 1 1 1"
-- Iteration 4 --
-string(81) "1 +1 0
+string(80) "1 +1 0
1 d 0 1
1 0 1 0000
#0 1 $1 _0
diff --git a/ext/standard/tests/strings/vsprintf_variation8.phpt b/ext/standard/tests/strings/vsprintf_variation8.phpt
index a3856bc38b..061e628c02 100644
--- a/ext/standard/tests/strings/vsprintf_variation8.phpt
+++ b/ext/standard/tests/strings/vsprintf_variation8.phpt
@@ -12,17 +12,15 @@ Test vsprintf() function : usage variations - string formats with non-string val
* the '$format' and '$args' arguments of the function
*/
-error_reporting(E_ALL & ~E_NOTICE);
-
echo "*** Testing vsprintf() : string formats and non-string values ***\n";
// defining array of string formats
$formats =
- '%s %+s %-s
- %ls %4s %-4s
- %10.4s %-10.4s %04s %04.4s
- %\'#2s %\'2s %\'$2s %\'_2s
- %3$s %4$s %1$s %2$s';
+ '%s %+s %-s
+ %ls %4s %-4s
+ %10.4s %-10.4s %04s %04.4s
+ %\'#2s %\'2s %\'$2s %\'_2s
+ %3$s %4$s %1$s %2$s';
// Arrays of non string values for the format defined in $format.
// Each sub array contains non string values which correspond to each format in $format
@@ -69,35 +67,69 @@ foreach($args_array as $args) {
}
?>
-===DONE===
---EXPECT--
+--EXPECTF--
*** Testing vsprintf() : string formats and non-string values ***
-- Iteration 1 --
-string(173) "2.2 0.2 10.2
- 123456.234 -1234.6789 1234.6789
- 2123 2765 -27654321000 2123
- 12345.78 12.000000011111 -12.00000111111 -123456.234
- 10.2 123456.234 2.2 0.2"
+string(177) "2.2 0.2 10.2
+ 123456.234 -1234.6789 1234.6789
+ 2123 2765 -27654321000 2123
+ 12345.78 12.000000011111 -12.00000111111 -123456.234
+ 10.2 123456.234 2.2 0.2"
-- Iteration 2 --
-string(129) "2 -2 2
- 123456 -12346789 12346789
- 1232 2000 -40000 2221
- 12345780 1211111 -12111111 -12345634
- 2 123456 2 -2"
+string(133) "2 -2 2
+ 123456 -12346789 12346789
+ 1232 2000 -40000 2221
+ 12345780 1211111 -12111111 -12345634
+ 2 123456 2 -2"
-- Iteration 3 --
-string(128) "Array Array Array
- Array Array Array
- Arra Arra Array Arra
- Array Array Array Array
- Array Array Array Array"
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+
+Warning: Array to string conversion in %s on line %d
+string(132) "Array Array Array
+ Array Array Array
+ Arra Arra Array Arra
+ Array Array Array Array
+ Array Array Array Array"
-- Iteration 4 --
-string(78) "1 1
- 1 1
- 1 0001 0000
- #0 1 $1 _0
- 1 1 1"
-===DONE===
+string(82) "1 1
+ 1 1
+ 1 0001 0000
+ #0 1 $1 _0
+ 1 1 1"
diff --git a/ext/standard/tests/strings/wordwrap.phpt b/ext/standard/tests/strings/wordwrap.phpt
index 543c41fdd9..0563b2e77f 100644
--- a/ext/standard/tests/strings/wordwrap.phpt
+++ b/ext/standard/tests/strings/wordwrap.phpt
@@ -27,10 +27,17 @@ $tests = <<<TESTS
"123|==1234567890|==123" === wordwrap("123 1234567890 123", 10, "|==", 1)
-FALSE === @wordwrap(chr(0), 0, "")
-
TESTS;
include(__DIR__ . '/../../../../tests/quicktester.inc');
+
+echo "\n";
+
+try {
+ wordwrap(chr(0), 0, "");
+} catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+}
--EXPECT--
OK
+Break string cannot be empty
diff --git a/ext/standard/tests/strings/wordwrap_error.phpt b/ext/standard/tests/strings/wordwrap_error.phpt
index 41c5cbdb69..af0f8eb61b 100644
--- a/ext/standard/tests/strings/wordwrap_error.phpt
+++ b/ext/standard/tests/strings/wordwrap_error.phpt
@@ -9,19 +9,10 @@ Test wordwrap() function : error conditions
echo "*** Testing wordwrap() : error conditions ***\n";
-// Zero argument
-echo "\n-- Testing wordwrap() function with Zero arguments --\n";
-var_dump( wordwrap() );
-
-// More than expected number of arguments
-echo "\n-- Testing wordwrap() function with more than expected no. of arguments --\n";
$str = 'testing wordwrap function';
$width = 10;
$break = '<br />\n';
$cut = true;
-$extra_arg = "extra_arg";
-
-var_dump( wordwrap($str, $width, $break, $cut, $extra_arg) );
// $width arg as negative value
echo "\n-- Testing wordwrap() function with negative/zero value for width argument --\n";
@@ -35,7 +26,12 @@ echo "-- width = 0 & cut = true --\n";
// width as zero and cut as true
$width = 0;
$cut = true;
-var_dump( wordwrap($str, $width, $break, $cut) );
+
+try {
+ wordwrap($str, $width, $break, $cut);
+} catch (\ValueError $e) {
+ echo $e->getMessage() . "\n";
+}
echo "-- width = -10 & cut = false --\n";
// width as -ne and cut as false
@@ -48,31 +44,16 @@ echo "-- width = -10 & cut = true --\n";
$width = -10;
$cut = true;
var_dump( wordwrap($str, $width, $break, $cut) );
-
-echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
*** Testing wordwrap() : error conditions ***
--- Testing wordwrap() function with Zero arguments --
-
-Warning: wordwrap() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
--- Testing wordwrap() function with more than expected no. of arguments --
-
-Warning: wordwrap() expects at most 4 parameters, 5 given in %s on line %d
-NULL
-
-- Testing wordwrap() function with negative/zero value for width argument --
-- width = 0 & cut = false --
string(39) "testing<br />\nwordwrap<br />\nfunction"
-- width = 0 & cut = true --
-
-Warning: wordwrap(): Can't force cut when width is zero in %s on line %d
-bool(false)
+Can't force cut when width is zero
-- width = -10 & cut = false --
string(39) "testing<br />\nwordwrap<br />\nfunction"
-- width = -10 & cut = true --
string(223) "<br />\nt<br />\ne<br />\ns<br />\nt<br />\ni<br />\nn<br />\ng<br />\n<br />\nw<br />\no<br />\nr<br />\nd<br />\nw<br />\nr<br />\na<br />\np<br />\n<br />\nf<br />\nu<br />\nn<br />\nc<br />\nt<br />\ni<br />\no<br />\nn"
-Done
diff --git a/ext/standard/tests/time/001.phpt b/ext/standard/tests/time/001.phpt
index b8498850f1..34b87157f2 100644
--- a/ext/standard/tests/time/001.phpt
+++ b/ext/standard/tests/time/001.phpt
@@ -15,14 +15,14 @@ $result = '';
set_time_limit(0);
for ($i=1;$i<=100000;$i++) {
- list($micro,$time)=explode(" ",microtime());
- if ($time > $last_t || ($time == $last_t && $micro >= $last_m)) {
- $passed++;
- } else if ($failed++ <=10) {
- $result .= sprintf('%06d', $i).": $time $micro < $last_t $last_m\n";
- }
- $last_m = $micro;
- $last_t = $time;
+ list($micro,$time)=explode(" ",microtime());
+ if ($time > $last_t || ($time == $last_t && $micro >= $last_m)) {
+ $passed++;
+ } else if ($failed++ <=10) {
+ $result .= sprintf('%06d', $i).": $time $micro < $last_t $last_m\n";
+ }
+ $last_m = $micro;
+ $last_t = $time;
}
echo "Passed: $passed\n";
echo "Failed: $failed\n";
diff --git a/ext/standard/tests/time/bug38524.phpt b/ext/standard/tests/time/bug38524.phpt
index 77d0f4f234..22ff9e4d76 100644
--- a/ext/standard/tests/time/bug38524.phpt
+++ b/ext/standard/tests/time/bug38524.phpt
@@ -4,9 +4,8 @@ Bug #38524 (strptime() does not initialize the internal date storage structure)
<?php if (!function_exists('strptime')) echo "SKIP"; ?>
--FILE--
<?php
- var_dump(strptime('2006-08-20', '%Y-%m-%d'));
+ var_dump(strptime('2006-08-20', '%Y-%m-%d'));
?>
-===DONE===
--EXPECTF--
array(9) {
["tm_sec"]=>
@@ -28,4 +27,3 @@ array(9) {
["unparsed"]=>
string(0) ""
}
-===DONE===
diff --git a/ext/standard/tests/time/bug60222.phpt b/ext/standard/tests/time/bug60222.phpt
index 8053a81dea..c74d27d53b 100644
--- a/ext/standard/tests/time/bug60222.phpt
+++ b/ext/standard/tests/time/bug60222.phpt
@@ -2,14 +2,18 @@
Bug #60222 (time_nanosleep() does validate input params)
--FILE--
<?php
- var_dump(time_nanosleep(-1, 0));
- var_dump(time_nanosleep(0, -1));
+ try {
+ time_nanosleep(-1, 0);
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
+
+ try {
+ time_nanosleep(0, -1);
+ } catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+ }
?>
-===DONE===
--EXPECTF--
-Warning: time_nanosleep(): The seconds value must be greater than 0 in %s on line %d
-bool(false)
-
-Warning: time_nanosleep(): The nanoseconds value must be greater than 0 in %s on line %d
-bool(false)
-===DONE===
+The seconds value must be greater than 0
+The nanoseconds value must be greater than 0
diff --git a/ext/standard/tests/time/idate.phpt b/ext/standard/tests/time/idate.phpt
index 0b54405499..1a06070b45 100644
--- a/ext/standard/tests/time/idate.phpt
+++ b/ext/standard/tests/time/idate.phpt
@@ -5,7 +5,7 @@ idate() function
date_default_timezone_set('GMT0');
$tmp = "UYzymndjHGhgistwLBIW";
for($a = 0;$a < strlen($tmp); $a++){
- echo $tmp[$a], ': ', idate($tmp[$a], 1043324459)."\n";
+ echo $tmp[$a], ': ', idate($tmp[$a], 1043324459)."\n";
}
?>
--EXPECT--
diff --git a/ext/standard/tests/time/strptime_basic.phpt b/ext/standard/tests/time/strptime_basic.phpt
index f352e9d06a..666cbcd0e3 100644
--- a/ext/standard/tests/time/strptime_basic.phpt
+++ b/ext/standard/tests/time/strptime_basic.phpt
@@ -33,7 +33,6 @@ var_dump(strptime($str, '%A %B %e %R'));
setlocale(LC_ALL, $orig);
?>
-===DONE===
--EXPECT--
*** Testing strptime() : basic functionality ***
array(9) {
@@ -96,4 +95,3 @@ array(9) {
["unparsed"]=>
string(0) ""
}
-===DONE===
diff --git a/ext/standard/tests/time/strptime_error.phpt b/ext/standard/tests/time/strptime_error.phpt
index f49025be44..d7eb11fc55 100644
--- a/ext/standard/tests/time/strptime_error.phpt
+++ b/ext/standard/tests/time/strptime_error.phpt
@@ -19,42 +19,13 @@ date_default_timezone_set("Europe/London");
echo "*** Testing strptime() : error conditions ***\n";
-echo "\n-- Testing strptime() function with Zero arguments --\n";
-var_dump( strptime() );
-
-echo "\n-- Testing strptime() function with less than expected no. of arguments --\n";
-$format = '%b %d %Y %H:%M:%S';
-$timestamp = mktime(8, 8, 8, 8, 8, 2008);
-$date = strftime($format, $timestamp);
-var_dump( strptime($date) );
-
-echo "\n-- Testing strptime() function with more than expected no. of arguments --\n";
-$extra_arg = 10;
-var_dump( strptime($date, $format, $extra_arg) );
-
echo "\n-- Testing strptime() function on failure --\n";
+$format = '%b %d %Y %H:%M:%S';
var_dump( strptime('foo', $format) );
?>
-===DONE===
--EXPECTF--
*** Testing strptime() : error conditions ***
--- Testing strptime() function with Zero arguments --
-
-Warning: strptime() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
--- Testing strptime() function with less than expected no. of arguments --
-
-Warning: strptime() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
--- Testing strptime() function with more than expected no. of arguments --
-
-Warning: strptime() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
-- Testing strptime() function on failure --
bool(false)
-===DONE===
diff --git a/ext/standard/tests/time/strptime_parts.phpt b/ext/standard/tests/time/strptime_parts.phpt
index 085b0e600f..bf7b8310f3 100644
--- a/ext/standard/tests/time/strptime_parts.phpt
+++ b/ext/standard/tests/time/strptime_parts.phpt
@@ -51,7 +51,6 @@ var_dump($res["tm_year"]);
setlocale(LC_ALL, $orig);
?>
-===DONE===
--EXPECT--
*** Testing strptime() : basic functionality ***
int(20)
@@ -72,4 +71,3 @@ int(10)
int(2)
int(6)
int(0)
-===DONE===
diff --git a/ext/standard/tests/url/base64_decode_basic_002.phpt b/ext/standard/tests/url/base64_decode_basic_002.phpt
index c538d15997..647fbd3b5c 100644
--- a/ext/standard/tests/url/base64_decode_basic_002.phpt
+++ b/ext/standard/tests/url/base64_decode_basic_002.phpt
@@ -16,7 +16,7 @@ var_dump(base64_decode($noWhiteSpace, true));
echo "\nWhitespace does not affect base64_decode, even with \$strict===true:\n";
$withWhiteSpace = "a GVs bG8gd2
- 9ybGQh";
+ 9ybGQh";
var_dump(base64_decode($withWhiteSpace));
var_dump(base64_decode($withWhiteSpace, false));
var_dump(base64_decode($withWhiteSpace, true));
diff --git a/ext/standard/tests/url/base64_decode_basic_003.phpt b/ext/standard/tests/url/base64_decode_basic_003.phpt
index 3bcd51e192..13c0f449d8 100644
--- a/ext/standard/tests/url/base64_decode_basic_003.phpt
+++ b/ext/standard/tests/url/base64_decode_basic_003.phpt
@@ -12,29 +12,29 @@ Test base64_decode() function : basic functionality - padding and whitespace
echo "Test base64_decode (output as JSON):\n";
$data = [
- "", "=", "==", "===", "====",
- "V", "V=", "V==", "V===", "V====",
- "VV", "VV=", "VV==", "VV===", "VV====",
- "VVV", "VVV=", "VVV==", "VVV===", "VVV====",
- "VVVV", "VVVV=", "VVVV==", "VVVV===", "VVVV====",
- "=V", "=VV", "=VVV",
- "==V", "==VV", "==VVV",
- "===V", "===VV", "===VVV",
- "====V", "====VV", "====VVV",
- "=VVV", "V=VV", "VV=V", "VVV=",
- "=VVVV", "V=VVV", "VV=VV", "VVV=V", "VVVV=",
- "=VVV=", "V=VV=", "VV=V=", "VVV==",
- "\nVV", "V\nV", "VV\n",
- "\nVV==", "V\nV==", "VV\n==", "VV=\n=", "VV==\n",
- "*VV", "V*V", "VV*",
- "*VV==", "V*V==", "VV*==", "VV=*=", "VV==*",
- "\0VV==", "V\0V==", "VV\0==", "VV=\0=", "VV==\0",
- "\0VVV==", "V\0VV==", "VV\0V==", "VVV\0==", "VVV=\0=", "VVV==\0",
+ "", "=", "==", "===", "====",
+ "V", "V=", "V==", "V===", "V====",
+ "VV", "VV=", "VV==", "VV===", "VV====",
+ "VVV", "VVV=", "VVV==", "VVV===", "VVV====",
+ "VVVV", "VVVV=", "VVVV==", "VVVV===", "VVVV====",
+ "=V", "=VV", "=VVV",
+ "==V", "==VV", "==VVV",
+ "===V", "===VV", "===VVV",
+ "====V", "====VV", "====VVV",
+ "=VVV", "V=VV", "VV=V", "VVV=",
+ "=VVVV", "V=VVV", "VV=VV", "VVV=V", "VVVV=",
+ "=VVV=", "V=VV=", "VV=V=", "VVV==",
+ "\nVV", "V\nV", "VV\n",
+ "\nVV==", "V\nV==", "VV\n==", "VV=\n=", "VV==\n",
+ "*VV", "V*V", "VV*",
+ "*VV==", "V*V==", "VV*==", "VV=*=", "VV==*",
+ "\0VV==", "V\0V==", "VV\0==", "VV=\0=", "VV==\0",
+ "\0VVV==", "V\0VV==", "VV\0V==", "VVV\0==", "VVV=\0=", "VVV==\0",
];
foreach ($data as $a) {
- $b = base64_decode($a, false);
- $c = base64_decode($a, true);
- printf("base64 %-16s non-strict %-8s strict %s\n", json_encode($a), json_encode($b), json_encode($c));
+ $b = base64_decode($a, false);
+ $c = base64_decode($a, true);
+ printf("base64 %-16s non-strict %-8s strict %s\n", json_encode($a), json_encode($b), json_encode($c));
}
echo "Done\n";
?>
diff --git a/ext/standard/tests/url/base64_encode_basic_001.phpt b/ext/standard/tests/url/base64_encode_basic_001.phpt
index 764e15f377..ff8c20e1b5 100644
--- a/ext/standard/tests/url/base64_encode_basic_001.phpt
+++ b/ext/standard/tests/url/base64_encode_basic_001.phpt
@@ -15,9 +15,9 @@ Test base64_encode() function : basic functionality
echo "*** Testing base64_encode() : basic functionality ***\n";
for ($i=0; $i<256; $i++) {
- $str = pack("c", $i);
- $enc = base64_encode($str);
- printf("0x%X: %s\n", $i, $enc);
+ $str = pack("c", $i);
+ $enc = base64_encode($str);
+ printf("0x%X: %s\n", $i, $enc);
}
echo "Done";
diff --git a/ext/standard/tests/url/base64_encode_basic_002.phpt b/ext/standard/tests/url/base64_encode_basic_002.phpt
index 2bcb7519ab..94af3c93bd 100644
--- a/ext/standard/tests/url/base64_encode_basic_002.phpt
+++ b/ext/standard/tests/url/base64_encode_basic_002.phpt
@@ -15,33 +15,32 @@ Test base64_encode() function : basic functionality - check algorithm round trip
echo "*** Testing base64_encode() : basic functionality ***\n";
$values = array(
- "Hello World",
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!%^&*(){}[]",
- "\n\t Line with control characters\r\n",
- "\xC1\xC2\xC3\xC4\xC5\xC6",
- "\75\76\77\78\79\80"
+ "Hello World",
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!%^&*(){}[]",
+ "\n\t Line with control characters\r\n",
+ "\xC1\xC2\xC3\xC4\xC5\xC6",
+ "\75\76\77\78\79\80"
);
echo "\n--- Testing base64_encode() with binary string input ---\n";
$counter = 1;
foreach($values as $str) {
- echo "-- Iteration $counter --\n";
+ echo "-- Iteration $counter --\n";
- $enc = base64_encode($str);
- $dec = base64_decode($enc);
+ $enc = base64_encode($str);
+ $dec = base64_decode($enc);
- if ($dec != $str) {
- echo "TEST FAILED\n";
- } else {
- echo "TEST PASSED\n";
- }
+ if ($dec != $str) {
+ echo "TEST FAILED\n";
+ } else {
+ echo "TEST PASSED\n";
+ }
- $counter ++;
+ $counter ++;
}
?>
-===Done===
--EXPECT--
*** Testing base64_encode() : basic functionality ***
@@ -56,4 +55,3 @@ TEST PASSED
TEST PASSED
-- Iteration 5 --
TEST PASSED
-===Done===
diff --git a/ext/standard/tests/url/bug47174.phpt b/ext/standard/tests/url/bug47174.phpt
index 6d08063253..a47b0e9666 100644
--- a/ext/standard/tests/url/bug47174.phpt
+++ b/ext/standard/tests/url/bug47174.phpt
@@ -3,7 +3,7 @@ Bug #47174 (base64_decode() interprets pad char in mid string as terminator)
--FILE--
<?php
if (base64_decode("dGVzdA==") == base64_decode("dGVzdA==CRAP")) {
- echo "Same octect data - Signature Valid\n";
+ echo "Same octet data - Signature Valid\n";
} else {
echo "Invalid Signature\n";
}
diff --git a/ext/standard/tests/url/bug52327.phpt b/ext/standard/tests/url/bug52327.phpt
index fb2e0fa25b..3450abcc4b 100644
--- a/ext/standard/tests/url/bug52327.phpt
+++ b/ext/standard/tests/url/bug52327.phpt
@@ -3,8 +3,8 @@ Bug #52327 (base64_decode() improper handling of leading padding)
--FILE--
<?php
var_dump(
- base64_decode('=VGhl=ICc9=JyBz=eW1i=b2xz=IGFy=ZW4n=dCBh=bGxv=d2Vk=IHdo=ZXJl=IGkg=cHV0=IHRo=ZW0g=by5P'),
- base64_decode('=VGhl=ICc9=JyBz=eW1i=b2xz=IGFy=ZW4n=dCBh=bGxv=d2Vk=IHdo=ZXJl=IGkg=cHV0=IHRo=ZW0g=by5P', true)
+ base64_decode('=VGhl=ICc9=JyBz=eW1i=b2xz=IGFy=ZW4n=dCBh=bGxv=d2Vk=IHdo=ZXJl=IGkg=cHV0=IHRo=ZW0g=by5P'),
+ base64_decode('=VGhl=ICc9=JyBz=eW1i=b2xz=IGFy=ZW4n=dCBh=bGxv=d2Vk=IHdo=ZXJl=IGkg=cHV0=IHRo=ZW0g=by5P', true)
);
?>
--EXPECT--
diff --git a/ext/standard/tests/url/bug55273.phpt b/ext/standard/tests/url/bug55273.phpt
index 1408506b42..e5c8fca70c 100644
--- a/ext/standard/tests/url/bug55273.phpt
+++ b/ext/standard/tests/url/bug55273.phpt
@@ -3,9 +3,9 @@ Bug #55273 (base64_decode() with strict rejects whitespace after pad)
--FILE--
<?php
function test($s) {
- $v = chunk_split(base64_encode($s));
- $r = base64_decode($v, True);
- var_dump($v, $r);
+ $v = chunk_split(base64_encode($s));
+ $r = base64_decode($v, True);
+ var_dump($v, $r);
}
test('PHP');
diff --git a/ext/standard/tests/url/parse_url_basic_001.phpt b/ext/standard/tests/url/parse_url_basic_001.phpt
index d59f080fbf..89a63010b9 100644
--- a/ext/standard/tests/url/parse_url_basic_001.phpt
+++ b/ext/standard/tests/url/parse_url_basic_001.phpt
@@ -14,8 +14,8 @@ Test parse_url() function: Parse a load of URLs without specifying the component
include_once(__DIR__ . '/urls.inc');
foreach ($urls as $url) {
- echo "\n--> $url: ";
- var_dump(parse_url($url));
+ echo "\n--> $url: ";
+ var_dump(parse_url($url));
}
echo "Done";
@@ -144,30 +144,36 @@ echo "Done";
string(10) "/index.php"
}
---> www.php.net/?: array(1) {
+--> www.php.net/?: array(2) {
["path"]=>
string(12) "www.php.net/"
+ ["query"]=>
+ string(0) ""
}
---> www.php.net:80/?: array(3) {
+--> www.php.net:80/?: array(4) {
["host"]=>
string(11) "www.php.net"
["port"]=>
int(80)
["path"]=>
string(1) "/"
+ ["query"]=>
+ string(0) ""
}
---> http://www.php.net/?: array(3) {
+--> http://www.php.net/?: array(4) {
["scheme"]=>
string(4) "http"
["host"]=>
string(11) "www.php.net"
["path"]=>
string(1) "/"
+ ["query"]=>
+ string(0) ""
}
---> http://www.php.net:80/?: array(4) {
+--> http://www.php.net:80/?: array(5) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -176,6 +182,8 @@ echo "Done";
int(80)
["path"]=>
string(1) "/"
+ ["query"]=>
+ string(0) ""
}
--> http://www.php.net:80/index.php: array(4) {
@@ -290,7 +298,7 @@ echo "Done";
string(10) "/index.php"
}
---> http://www.php.net:80/index.php?: array(4) {
+--> http://www.php.net:80/index.php?: array(5) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -299,6 +307,8 @@ echo "Done";
int(80)
["path"]=>
string(10) "/index.php"
+ ["query"]=>
+ string(0) ""
}
--> http://www.php.net:80/#foo: array(5) {
@@ -314,7 +324,7 @@ echo "Done";
string(3) "foo"
}
---> http://www.php.net:80/?#: array(4) {
+--> http://www.php.net:80/?#: array(6) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -323,6 +333,10 @@ echo "Done";
int(80)
["path"]=>
string(1) "/"
+ ["query"]=>
+ string(0) ""
+ ["fragment"]=>
+ string(0) ""
}
--> http://www.php.net:80/?test=1: array(5) {
@@ -731,11 +745,13 @@ echo "Done";
string(4) "/:80"
}
---> http://x:?: array(2) {
+--> http://x:?: array(3) {
["scheme"]=>
string(4) "http"
["host"]=>
string(1) "x"
+ ["query"]=>
+ string(0) ""
}
--> x:blah.com: array(2) {
@@ -754,18 +770,22 @@ echo "Done";
--> x://::abc/?: bool(false)
---> http://::?: array(2) {
+--> http://::?: array(3) {
["scheme"]=>
string(4) "http"
["host"]=>
string(1) ":"
+ ["query"]=>
+ string(0) ""
}
---> http://::#: array(2) {
+--> http://::#: array(3) {
["scheme"]=>
string(4) "http"
["host"]=>
string(1) ":"
+ ["fragment"]=>
+ string(0) ""
}
--> x://::6.5: array(3) {
diff --git a/ext/standard/tests/url/parse_url_basic_002.phpt b/ext/standard/tests/url/parse_url_basic_002.phpt
index c8b94dec1c..9616278fc6 100644
--- a/ext/standard/tests/url/parse_url_basic_002.phpt
+++ b/ext/standard/tests/url/parse_url_basic_002.phpt
@@ -14,8 +14,8 @@ Test parse_url() function: Parse a load of URLs without specifying PHP_URL_SCHEM
include_once(__DIR__ . '/urls.inc');
foreach ($urls as $url) {
- echo "--> $url : ";
- var_dump(parse_url($url, PHP_URL_SCHEME));
+ echo "--> $url : ";
+ var_dump(parse_url($url, PHP_URL_SCHEME));
}
diff --git a/ext/standard/tests/url/parse_url_basic_003.phpt b/ext/standard/tests/url/parse_url_basic_003.phpt
index f917b77b97..668ee5aab2 100644
--- a/ext/standard/tests/url/parse_url_basic_003.phpt
+++ b/ext/standard/tests/url/parse_url_basic_003.phpt
@@ -14,8 +14,8 @@ Test parse_url() function: Parse a load of URLs without specifying PHP_URL_HOST
include_once(__DIR__ . '/urls.inc');
foreach ($urls as $url) {
- echo "--> $url : ";
- var_dump(parse_url($url, PHP_URL_HOST));
+ echo "--> $url : ";
+ var_dump(parse_url($url, PHP_URL_HOST));
}
echo "Done";
diff --git a/ext/standard/tests/url/parse_url_basic_004.phpt b/ext/standard/tests/url/parse_url_basic_004.phpt
index 29d4655243..464ed20d42 100644
--- a/ext/standard/tests/url/parse_url_basic_004.phpt
+++ b/ext/standard/tests/url/parse_url_basic_004.phpt
@@ -14,8 +14,8 @@ Test parse_url() function: Parse a load of URLs without specifying PHP_URL_PORT
include_once(__DIR__ . '/urls.inc');
foreach ($urls as $url) {
- echo "--> $url : ";
- var_dump(parse_url($url, PHP_URL_PORT));
+ echo "--> $url : ";
+ var_dump(parse_url($url, PHP_URL_PORT));
}
echo "Done";
diff --git a/ext/standard/tests/url/parse_url_basic_005.phpt b/ext/standard/tests/url/parse_url_basic_005.phpt
index 716d8d1dfa..f776181987 100644
--- a/ext/standard/tests/url/parse_url_basic_005.phpt
+++ b/ext/standard/tests/url/parse_url_basic_005.phpt
@@ -14,8 +14,8 @@ Test parse_url() function: Parse a load of URLs without specifying PHP_URL_USER
include_once(__DIR__ . '/urls.inc');
foreach ($urls as $url) {
- echo "--> $url : ";
- var_dump(parse_url($url, PHP_URL_USER));
+ echo "--> $url : ";
+ var_dump(parse_url($url, PHP_URL_USER));
}
echo "Done";
diff --git a/ext/standard/tests/url/parse_url_basic_006.phpt b/ext/standard/tests/url/parse_url_basic_006.phpt
index 3ae94ca626..fc6378106b 100644
--- a/ext/standard/tests/url/parse_url_basic_006.phpt
+++ b/ext/standard/tests/url/parse_url_basic_006.phpt
@@ -14,8 +14,8 @@ Test parse_url() function: Parse a load of URLs without specifying PHP_URL_PASS
include_once(__DIR__ . '/urls.inc');
foreach ($urls as $url) {
- echo "--> $url : ";
- var_dump(parse_url($url, PHP_URL_PASS));
+ echo "--> $url : ";
+ var_dump(parse_url($url, PHP_URL_PASS));
}
echo "Done";
diff --git a/ext/standard/tests/url/parse_url_basic_007.phpt b/ext/standard/tests/url/parse_url_basic_007.phpt
index 8cad27e958..ebcd968879 100644
--- a/ext/standard/tests/url/parse_url_basic_007.phpt
+++ b/ext/standard/tests/url/parse_url_basic_007.phpt
@@ -14,8 +14,8 @@ Test parse_url() function: Parse a load of URLs without specifying PHP_URL_PATH
include_once(__DIR__ . '/urls.inc');
foreach ($urls as $url) {
- echo "--> $url : ";
- var_dump(parse_url($url, PHP_URL_PATH));
+ echo "--> $url : ";
+ var_dump(parse_url($url, PHP_URL_PATH));
}
echo "Done";
diff --git a/ext/standard/tests/url/parse_url_basic_008.phpt b/ext/standard/tests/url/parse_url_basic_008.phpt
index 761eb61179..033a4489d0 100644
--- a/ext/standard/tests/url/parse_url_basic_008.phpt
+++ b/ext/standard/tests/url/parse_url_basic_008.phpt
@@ -14,8 +14,8 @@ Test parse_url() function: Parse a load of URLs without specifying PHP_URL_QUERY
include_once(__DIR__ . '/urls.inc');
foreach ($urls as $url) {
- echo "--> $url : ";
- var_dump(parse_url($url, PHP_URL_QUERY));
+ echo "--> $url : ";
+ var_dump(parse_url($url, PHP_URL_QUERY));
}
echo "Done";
@@ -38,10 +38,10 @@ echo "Done";
--> http://www.php.net:80 : NULL
--> http://www.php.net:80/ : NULL
--> http://www.php.net/index.php : NULL
---> www.php.net/? : NULL
---> www.php.net:80/? : NULL
---> http://www.php.net/? : NULL
---> http://www.php.net:80/? : NULL
+--> www.php.net/? : string(0) ""
+--> www.php.net:80/? : string(0) ""
+--> http://www.php.net/? : string(0) ""
+--> http://www.php.net:80/? : string(0) ""
--> http://www.php.net:80/index.php : NULL
--> http://www.php.net:80/foo/bar/index.php : NULL
--> http://www.php.net:80/this/is/a/very/deep/directory/structure/and/file.php : NULL
@@ -52,9 +52,9 @@ echo "Done";
--> http://www.php.net:80/this/../a/../deep/directory/ : NULL
--> http://www.php.net:80/this/is/a/very/deep/directory/../file.php : NULL
--> http://www.php.net:80/index.php : NULL
---> http://www.php.net:80/index.php? : NULL
+--> http://www.php.net:80/index.php? : string(0) ""
--> http://www.php.net:80/#foo : NULL
---> http://www.php.net:80/?# : NULL
+--> http://www.php.net:80/?# : string(0) ""
--> http://www.php.net:80/?test=1 : string(6) "test=1"
--> http://www.php.net/?test=1& : string(7) "test=1&"
--> http://www.php.net:80/?& : string(1) "&"
@@ -91,11 +91,11 @@ echo "Done";
--> gg:9130731 : NULL
--> http://user:@pass@host/path?argument?value#etc : string(14) "argument?value"
--> http://10.10.10.10/:80 : NULL
---> http://x:? : NULL
+--> http://x:? : string(0) ""
--> x:blah.com : NULL
--> x:/blah.com : NULL
--> x://::abc/? : bool(false)
---> http://::? : NULL
+--> http://::? : string(0) ""
--> http://::# : NULL
--> x://::6.5 : NULL
--> http://?:/ : bool(false)
diff --git a/ext/standard/tests/url/parse_url_basic_009.phpt b/ext/standard/tests/url/parse_url_basic_009.phpt
index f08787761d..539d05bbd7 100644
--- a/ext/standard/tests/url/parse_url_basic_009.phpt
+++ b/ext/standard/tests/url/parse_url_basic_009.phpt
@@ -14,8 +14,8 @@ Test parse_url() function: Parse a load of URLs without specifying PHP_URL_FRAGM
include_once(__DIR__ . '/urls.inc');
foreach ($urls as $url) {
- echo "--> $url : ";
- var_dump(parse_url($url, PHP_URL_FRAGMENT));
+ echo "--> $url : ";
+ var_dump(parse_url($url, PHP_URL_FRAGMENT));
}
echo "Done";
@@ -54,7 +54,7 @@ echo "Done";
--> http://www.php.net:80/index.php : NULL
--> http://www.php.net:80/index.php? : NULL
--> http://www.php.net:80/#foo : string(3) "foo"
---> http://www.php.net:80/?# : NULL
+--> http://www.php.net:80/?# : string(0) ""
--> http://www.php.net:80/?test=1 : NULL
--> http://www.php.net/?test=1& : NULL
--> http://www.php.net:80/?& : NULL
@@ -96,7 +96,7 @@ echo "Done";
--> x:/blah.com : NULL
--> x://::abc/? : bool(false)
--> http://::? : NULL
---> http://::# : NULL
+--> http://::# : string(0) ""
--> x://::6.5 : NULL
--> http://?:/ : bool(false)
--> http://@?:/ : bool(false)
diff --git a/ext/standard/tests/url/parse_url_basic_010.phpt b/ext/standard/tests/url/parse_url_basic_010.phpt
index 8fecb9d8eb..bf1835fbf8 100644
--- a/ext/standard/tests/url/parse_url_basic_010.phpt
+++ b/ext/standard/tests/url/parse_url_basic_010.phpt
@@ -12,9 +12,9 @@ Test parse_url() function : check values of URL related constants
* check values of URL related constants
*/
foreach(get_defined_constants() as $constantName => $constantValue) {
- if (strpos($constantName, 'PHP_URL')===0) {
- echo "$constantName: $constantValue \n";
- }
+ if (strpos($constantName, 'PHP_URL')===0) {
+ echo "$constantName: $constantValue \n";
+ }
}
echo "Done";
diff --git a/ext/standard/tests/url/parse_url_error_002.phpt b/ext/standard/tests/url/parse_url_error_002.phpt
index 5af4232e0c..07188c57c7 100644
--- a/ext/standard/tests/url/parse_url_error_002.phpt
+++ b/ext/standard/tests/url/parse_url_error_002.phpt
@@ -14,8 +14,12 @@ $url = 'http://secret:hideout@www.php.net:80/index.php?test=1&test2=char&test3=m
echo "--> Below range:";
var_dump(parse_url($url, -1));
-echo "\n\n--> Above range:";
-var_dump(parse_url($url, 99));
+echo "\n\n--> Above range:\n";
+try {
+ parse_url($url, 99);
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
echo "Done"
?>
@@ -42,6 +46,5 @@ echo "Done"
--> Above range:
-Warning: parse_url(): Invalid URL component identifier 99 in %s on line 15
-bool(false)
+Invalid URL component identifier: 99
Done
diff --git a/ext/standard/tests/url/parse_url_unterminated.phpt b/ext/standard/tests/url/parse_url_unterminated.phpt
index 94975ee889..f7d5cca896 100644
--- a/ext/standard/tests/url/parse_url_unterminated.phpt
+++ b/ext/standard/tests/url/parse_url_unterminated.phpt
@@ -14,9 +14,9 @@ if (!function_exists('zend_create_unterminated_string')) die('skip ext/test requ
include_once(__DIR__ . '/urls.inc');
foreach ($urls as $url) {
- echo "\n--> $url: ";
- $str = zend_create_unterminated_string($url);
- var_dump(parse_url($str));
+ echo "\n--> $url: ";
+ $str = zend_create_unterminated_string($url);
+ var_dump(parse_url($str));
zend_terminate_string($str);
}
@@ -146,30 +146,36 @@ echo "Done";
string(10) "/index.php"
}
---> www.php.net/?: array(1) {
+--> www.php.net/?: array(2) {
["path"]=>
string(12) "www.php.net/"
+ ["query"]=>
+ string(0) ""
}
---> www.php.net:80/?: array(3) {
+--> www.php.net:80/?: array(4) {
["host"]=>
string(11) "www.php.net"
["port"]=>
int(80)
["path"]=>
string(1) "/"
+ ["query"]=>
+ string(0) ""
}
---> http://www.php.net/?: array(3) {
+--> http://www.php.net/?: array(4) {
["scheme"]=>
string(4) "http"
["host"]=>
string(11) "www.php.net"
["path"]=>
string(1) "/"
+ ["query"]=>
+ string(0) ""
}
---> http://www.php.net:80/?: array(4) {
+--> http://www.php.net:80/?: array(5) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -178,6 +184,8 @@ echo "Done";
int(80)
["path"]=>
string(1) "/"
+ ["query"]=>
+ string(0) ""
}
--> http://www.php.net:80/index.php: array(4) {
@@ -292,7 +300,7 @@ echo "Done";
string(10) "/index.php"
}
---> http://www.php.net:80/index.php?: array(4) {
+--> http://www.php.net:80/index.php?: array(5) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -301,6 +309,8 @@ echo "Done";
int(80)
["path"]=>
string(10) "/index.php"
+ ["query"]=>
+ string(0) ""
}
--> http://www.php.net:80/#foo: array(5) {
@@ -316,7 +326,7 @@ echo "Done";
string(3) "foo"
}
---> http://www.php.net:80/?#: array(4) {
+--> http://www.php.net:80/?#: array(6) {
["scheme"]=>
string(4) "http"
["host"]=>
@@ -325,6 +335,10 @@ echo "Done";
int(80)
["path"]=>
string(1) "/"
+ ["query"]=>
+ string(0) ""
+ ["fragment"]=>
+ string(0) ""
}
--> http://www.php.net:80/?test=1: array(5) {
@@ -733,11 +747,13 @@ echo "Done";
string(4) "/:80"
}
---> http://x:?: array(2) {
+--> http://x:?: array(3) {
["scheme"]=>
string(4) "http"
["host"]=>
string(1) "x"
+ ["query"]=>
+ string(0) ""
}
--> x:blah.com: array(2) {
@@ -756,18 +772,22 @@ echo "Done";
--> x://::abc/?: bool(false)
---> http://::?: array(2) {
+--> http://::?: array(3) {
["scheme"]=>
string(4) "http"
["host"]=>
string(1) ":"
+ ["query"]=>
+ string(0) ""
}
---> http://::#: array(2) {
+--> http://::#: array(3) {
["scheme"]=>
string(4) "http"
["host"]=>
string(1) ":"
+ ["fragment"]=>
+ string(0) ""
}
--> x://::6.5: array(3) {
diff --git a/ext/standard/tests/versioning/version_compare.phpt b/ext/standard/tests/versioning/version_compare.phpt
index 17574e9737..07550dd410 100644
--- a/ext/standard/tests/versioning/version_compare.phpt
+++ b/ext/standard/tests/versioning/version_compare.phpt
@@ -19,7 +19,7 @@ test("1.0", "1.1");
test("1.2", "1.0.1");
foreach ($special_forms as $f1) {
foreach ($special_forms as $f2) {
- test("1.0$f1", "1.0$f2");
+ test("1.0$f1", "1.0$f2");
}
}
print "TESTING OPERATORS\n";
@@ -37,16 +37,16 @@ foreach ($special_forms as $f1) {
function test($v1, $v2) {
$compare = version_compare($v1, $v2);
switch ($compare) {
- case -1:
- print "$v1 < $v2\n";
- break;
- case 1:
- print "$v1 > $v2\n";
- break;
- case 0:
- default:
- print "$v1 = $v2\n";
- break;
+ case -1:
+ print "$v1 < $v2\n";
+ break;
+ case 1:
+ print "$v1 > $v2\n";
+ break;
+ case 0:
+ default:
+ print "$v1 = $v2\n";
+ break;
}
}
diff --git a/ext/standard/tests/versioning/version_compare_invalid_operator.phpt b/ext/standard/tests/versioning/version_compare_invalid_operator.phpt
index d759422954..eb1973924a 100644
--- a/ext/standard/tests/versioning/version_compare_invalid_operator.phpt
+++ b/ext/standard/tests/versioning/version_compare_invalid_operator.phpt
@@ -1,10 +1,14 @@
--TEST--
-Ensures null is returned if versions are compared with invalid operator
+Ensures an exception is thrown if versions are compared with an invalid operator
--CREDITS--
David Stockton - <dave@davidstockton.com> - i3logix PHP Testfest 2017
--FILE--
<?php
-var_dump(version_compare('1.2', '2.1', '??'));
+try {
+ version_compare('1.2', '2.1', '??');
+} catch (ValueError $exception) {
+ echo $exception->getMessage() . "\n";
+}
?>
--EXPECT--
-NULL
+Invalid comparison operator
diff --git a/ext/standard/type.c b/ext/standard/type.c
index d2e267bb3f..f9dc981842 100644
--- a/ext/standard/type.c
+++ b/ext/standard/type.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -84,11 +82,11 @@ PHP_FUNCTION(settype)
zval_ptr_dtor(&tmp);
}
if (zend_string_equals_literal_ci(type, "resource")) {
- php_error_docref(NULL, E_WARNING, "Cannot convert to resource type");
+ zend_value_error("Cannot convert to resource type");
} else {
- php_error_docref(NULL, E_WARNING, "Invalid type");
+ zend_value_error("Invalid type");
}
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (ptr == &tmp) {
@@ -172,31 +170,31 @@ PHP_FUNCTION(floatval)
}
/* }}} */
-/* {{{ proto bool boolval(mixed var)
+/* {{{ proto bool boolval(mixed value)
Get the boolean value of a variable */
PHP_FUNCTION(boolval)
{
- zval *val;
+ zval *value;
ZEND_PARSE_PARAMETERS_START(1, 1)
- Z_PARAM_ZVAL(val)
+ Z_PARAM_ZVAL(value)
ZEND_PARSE_PARAMETERS_END();
- RETURN_BOOL(zend_is_true(val));
+ RETURN_BOOL(zend_is_true(value));
}
/* }}} */
-/* {{{ proto string strval(mixed var)
+/* {{{ proto string strval(mixed value)
Get the string value of a variable */
PHP_FUNCTION(strval)
{
- zval *num;
+ zval *value;
ZEND_PARSE_PARAMETERS_START(1, 1)
- Z_PARAM_ZVAL(num)
+ Z_PARAM_ZVAL(value)
ZEND_PARSE_PARAMETERS_END();
- RETVAL_STR(zval_get_string(num));
+ RETVAL_STR(zval_get_string(value));
}
/* }}} */
@@ -206,7 +204,7 @@ static inline void php_is_type(INTERNAL_FUNCTION_PARAMETERS, int type)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_ZVAL(arg)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (Z_TYPE_P(arg) == type) {
if (type == IS_RESOURCE) {
@@ -249,7 +247,7 @@ PHP_FUNCTION(is_bool)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_ZVAL(arg)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
RETURN_BOOL(Z_TYPE_P(arg) == IS_FALSE || Z_TYPE_P(arg) == IS_TRUE);
}
diff --git a/ext/standard/uniqid.c b/ext/standard/uniqid.c
index 97a886c592..08a315edbe 100644
--- a/ext/standard/uniqid.c
+++ b/ext/standard/uniqid.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/uniqid.h b/ext/standard/uniqid.h
index ed6528e5b2..ed1472ff06 100644
--- a/ext/standard/uniqid.h
+++ b/ext/standard/uniqid.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/url.c b/ext/standard/url.c
index a04d941498..c73818f08e 100644
--- a/ext/standard/url.c
+++ b/ext/standard/url.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -293,6 +291,8 @@ PHPAPI php_url *php_url_parse_ex(char const *str, size_t length)
if (p < e) {
ret->fragment = zend_string_init(p, (e - p), 0);
php_replace_controlchars_ex(ZSTR_VAL(ret->fragment), ZSTR_LEN(ret->fragment));
+ } else {
+ ret->fragment = ZSTR_EMPTY_ALLOC();
}
e = p-1;
}
@@ -303,6 +303,8 @@ PHPAPI php_url *php_url_parse_ex(char const *str, size_t length)
if (p < e) {
ret->query = zend_string_init(p, (e - p), 0);
php_replace_controlchars_ex(ZSTR_VAL(ret->query), ZSTR_LEN(ret->query));
+ } else {
+ ret->query = ZSTR_EMPTY_ALLOC();
}
e = p-1;
}
@@ -365,8 +367,8 @@ PHP_FUNCTION(parse_url)
if (resource->fragment != NULL) RETVAL_STR_COPY(resource->fragment);
break;
default:
- php_error_docref(NULL, E_WARNING, "Invalid URL component identifier " ZEND_LONG_FMT, key);
- RETVAL_FALSE;
+ zend_value_error("Invalid URL component identifier: " ZEND_LONG_FMT, key);
+ break;
}
goto done;
}
@@ -654,7 +656,7 @@ PHPAPI size_t php_raw_url_decode(char *str, size_t len)
}
/* }}} */
-/* {{{ proto array get_headers(string url[, int format[, resource context]])
+/* {{{ proto array|false get_headers(string url[, int format[, resource context]])
fetches all the headers sent by the server in response to a HTTP request */
PHP_FUNCTION(get_headers)
{
diff --git a/ext/standard/url.h b/ext/standard/url.h
index 782fe65e6a..d242518a08 100644
--- a/ext/standard/url.h
+++ b/ext/standard/url.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/url_scanner_ex.h b/ext/standard/url_scanner_ex.h
index 6a8b8fdbb1..a756db6586 100644
--- a/ext/standard/url_scanner_ex.h
+++ b/ext/standard/url_scanner_ex.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/url_scanner_ex.re b/ext/standard/url_scanner_ex.re
index 1877e68918..a83a91b534 100644
--- a/ext/standard/url_scanner_ex.re
+++ b/ext/standard/url_scanner_ex.re
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/standard/user_filters.c b/ext/standard/user_filters.c
index 6aff083a06..0d98ffa824 100644
--- a/ext/standard/user_filters.c
+++ b/ext/standard/user_filters.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -22,6 +20,7 @@
#include "php_globals.h"
#include "ext/standard/basic_functions.h"
#include "ext/standard/file.h"
+#include "ext/standard/basic_functions_arginfo.h"
#define PHP_STREAM_BRIGADE_RES_NAME "userfilter.bucket brigade"
#define PHP_STREAM_BUCKET_RES_NAME "userfilter.bucket"
@@ -43,23 +42,11 @@ static int le_bucket;
PHP_FUNCTION(user_filter_nop)
{
}
-ZEND_BEGIN_ARG_INFO(arginfo_php_user_filter_filter, 0)
- ZEND_ARG_INFO(0, in)
- ZEND_ARG_INFO(0, out)
- ZEND_ARG_INFO(1, consumed)
- ZEND_ARG_INFO(0, closing)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_php_user_filter_onCreate, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_php_user_filter_onClose, 0)
-ZEND_END_ARG_INFO()
static const zend_function_entry user_filter_class_funcs[] = {
- PHP_NAMED_FE(filter, PHP_FN(user_filter_nop), arginfo_php_user_filter_filter)
- PHP_NAMED_FE(onCreate, PHP_FN(user_filter_nop), arginfo_php_user_filter_onCreate)
- PHP_NAMED_FE(onClose, PHP_FN(user_filter_nop), arginfo_php_user_filter_onClose)
+ PHP_NAMED_FE(filter, PHP_FN(user_filter_nop), arginfo_class_php_user_filter_filter)
+ PHP_NAMED_FE(onCreate, PHP_FN(user_filter_nop), arginfo_class_php_user_filter_onCreate)
+ PHP_NAMED_FE(onClose, PHP_FN(user_filter_nop), arginfo_class_php_user_filter_onClose)
PHP_FE_END
};
@@ -164,7 +151,7 @@ php_stream_filter_status_t userfilter_filter(
zval func_name;
zval retval;
zval args[4];
- zval zpropname;
+ zend_string *propname;
int call_result;
/* the userfilter object probably doesn't exist anymore */
@@ -210,7 +197,7 @@ php_stream_filter_status_t userfilter_filter(
convert_to_long(&retval);
ret = (int)Z_LVAL(retval);
} else if (call_result == FAILURE) {
- php_error_docref(NULL, E_WARNING, "failed to call filter function");
+ php_error_docref(NULL, E_WARNING, "Failed to call filter function");
}
if (bytes_consumed) {
@@ -239,9 +226,9 @@ php_stream_filter_status_t userfilter_filter(
/* filter resources are cleaned up by the stream destructor,
* keeping a reference to the stream resource here would prevent it
* from being destroyed properly */
- ZVAL_STRINGL(&zpropname, "stream", sizeof("stream")-1);
- Z_OBJ_HANDLER_P(obj, unset_property)(obj, &zpropname, NULL);
- zval_ptr_dtor(&zpropname);
+ propname = zend_string_init("stream", sizeof("stream")-1, 0);
+ Z_OBJ_HANDLER_P(obj, unset_property)(Z_OBJ_P(obj), propname, NULL);
+ zend_string_release_ex(propname, 0);
zval_ptr_dtor(&args[3]);
zval_ptr_dtor(&args[2]);
@@ -270,7 +257,7 @@ static php_stream_filter *user_filter_factory_create(const char *filtername,
/* some sanity checks */
if (persistent) {
php_error_docref(NULL, E_WARNING,
- "cannot use a user-space filter with a persistent stream");
+ "Cannot use a user-space filter with a persistent stream");
return NULL;
}
@@ -315,7 +302,7 @@ static php_stream_filter *user_filter_factory_create(const char *filtername,
if (fdat->ce == NULL) {
if (NULL == (fdat->ce = zend_lookup_class(fdat->classname))) {
php_error_docref(NULL, E_WARNING,
- "user-filter \"%s\" requires class \"%s\", but that class is not defined",
+ "User-filter \"%s\" requires class \"%s\", but that class is not defined",
filtername, ZSTR_VAL(fdat->classname));
return NULL;
}
@@ -391,7 +378,7 @@ static void filter_item_dtor(zval *zv)
efree(fdat);
}
-/* {{{ proto object stream_bucket_make_writeable(resource brigade)
+/* {{{ proto object|null stream_bucket_make_writeable(resource brigade)
Return a bucket object from the brigade for operating on */
PHP_FUNCTION(stream_bucket_make_writeable)
{
@@ -401,11 +388,11 @@ PHP_FUNCTION(stream_bucket_make_writeable)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_RESOURCE(zbrigade)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if ((brigade = (php_stream_bucket_brigade*)zend_fetch_resource(
Z_RES_P(zbrigade), PHP_STREAM_BRIGADE_RES_NAME, le_bucket_brigade)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
ZVAL_NULL(return_value);
@@ -433,20 +420,20 @@ static void php_stream_bucket_attach(int append, INTERNAL_FUNCTION_PARAMETERS)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_RESOURCE(zbrigade)
Z_PARAM_OBJECT(zobject)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (NULL == (pzbucket = zend_hash_str_find(Z_OBJPROP_P(zobject), "bucket", sizeof("bucket")-1))) {
- php_error_docref(NULL, E_WARNING, "Object has no bucket property");
- RETURN_FALSE;
+ zend_value_error("Object has no bucket property");
+ RETURN_THROWS();
}
if ((brigade = (php_stream_bucket_brigade*)zend_fetch_resource(
Z_RES_P(zbrigade), PHP_STREAM_BRIGADE_RES_NAME, le_bucket_brigade)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ((bucket = (php_stream_bucket *)zend_fetch_resource_ex(pzbucket, PHP_STREAM_BUCKET_RES_NAME, le_bucket)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (NULL != (pzdata = zend_hash_str_find(Z_OBJPROP_P(zobject), "data", sizeof("data")-1)) && Z_TYPE_P(pzdata) == IS_STRING) {
@@ -504,10 +491,9 @@ PHP_FUNCTION(stream_bucket_new)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_ZVAL(zstream)
Z_PARAM_STRING(buffer, buffer_len)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, zstream);
-
pbuffer = pemalloc(buffer_len, php_stream_is_persistent(stream));
memcpy(pbuffer, buffer, buffer_len);
@@ -535,9 +521,7 @@ PHP_FUNCTION(stream_get_filters)
zend_string *filter_name;
HashTable *filters_hash;
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_NONE();
array_init(return_value);
@@ -564,18 +548,16 @@ PHP_FUNCTION(stream_filter_register)
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_STR(filtername)
Z_PARAM_STR(classname)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
-
- RETVAL_FALSE;
+ ZEND_PARSE_PARAMETERS_END();
if (!ZSTR_LEN(filtername)) {
- php_error_docref(NULL, E_WARNING, "Filter name cannot be empty");
- return;
+ zend_value_error("Filter name cannot be empty");
+ RETURN_THROWS();
}
if (!ZSTR_LEN(classname)) {
- php_error_docref(NULL, E_WARNING, "Class name cannot be empty");
- return;
+ zend_value_error("Class name cannot be empty");
+ RETURN_THROWS();
}
if (!BG(user_filter_map)) {
@@ -592,6 +574,7 @@ PHP_FUNCTION(stream_filter_register)
} else {
zend_string_release_ex(classname, 0);
efree(fdat);
+ RETVAL_FALSE;
}
}
/* }}} */
diff --git a/ext/standard/uuencode.c b/ext/standard/uuencode.c
index dbc99a9634..036e190f24 100644
--- a/ext/standard/uuencode.c
+++ b/ext/standard/uuencode.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -196,7 +194,7 @@ err:
}
/* }}} */
-/* {{{ proto string convert_uuencode(string data)
+/* {{{ proto string|false convert_uuencode(string data)
uuencode a string */
PHP_FUNCTION(convert_uuencode)
{
@@ -204,14 +202,14 @@ PHP_FUNCTION(convert_uuencode)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_STR(src)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (ZSTR_LEN(src) < 1) { RETURN_FALSE; }
RETURN_STR(php_uuencode(ZSTR_VAL(src), ZSTR_LEN(src)));
}
/* }}} */
-/* {{{ proto string convert_uudecode(string data)
+/* {{{ proto string|false convert_uudecode(string data)
decode a uuencoded string */
PHP_FUNCTION(convert_uudecode)
{
@@ -220,7 +218,7 @@ PHP_FUNCTION(convert_uudecode)
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_STR(src)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (ZSTR_LEN(src) < 1) { RETURN_FALSE; }
if ((dest = php_uudecode(ZSTR_VAL(src), ZSTR_LEN(src))) == NULL) {
diff --git a/ext/standard/var.c b/ext/standard/var.c
index 3fa1afcb72..3f7db8faaf 100644
--- a/ext/standard/var.c
+++ b/ext/standard/var.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -76,13 +74,11 @@ static void php_object_property_dump(zend_property_info *prop_info, zval *zv, ze
}
if (Z_TYPE_P(zv) == IS_UNDEF) {
- ZEND_ASSERT(prop_info->type);
- php_printf("%*cuninitialized(%s%s)\n",
- level + 1, ' ',
- ZEND_TYPE_ALLOW_NULL(prop_info->type) ? "?" : "",
- ZEND_TYPE_IS_CLASS(prop_info->type) ?
- ZSTR_VAL(ZEND_TYPE_IS_CE(prop_info->type) ? ZEND_TYPE_CE(prop_info->type)->name : ZEND_TYPE_NAME(prop_info->type)) :
- zend_get_type_by_const(ZEND_TYPE_CODE(prop_info->type)));
+ ZEND_ASSERT(ZEND_TYPE_IS_SET(prop_info->type));
+ zend_string *type_str = zend_type_to_string(prop_info->type);
+ php_printf("%*cuninitialized(%s)\n",
+ level + 1, ' ', ZSTR_VAL(type_str));
+ zend_string_release(type_str);
} else {
php_var_dump(zv, level + 2);
}
@@ -127,7 +123,7 @@ again:
break;
case IS_ARRAY:
myht = Z_ARRVAL_P(struc);
- if (level > 1 && !(GC_FLAGS(myht) & GC_IMMUTABLE)) {
+ if (!(GC_FLAGS(myht) & GC_IMMUTABLE)) {
if (GC_IS_RECURSIVE(myht)) {
PUTS("*RECURSION*\n");
return;
@@ -140,7 +136,7 @@ again:
ZEND_HASH_FOREACH_KEY_VAL_IND(myht, num, key, val) {
php_array_element_dump(val, num, key, level);
} ZEND_HASH_FOREACH_END();
- if (level > 1 && !(GC_FLAGS(myht) & GC_IMMUTABLE)) {
+ if (!(GC_FLAGS(myht) & GC_IMMUTABLE)) {
GC_UNPROTECT_RECURSION(myht);
}
if (level > 1) {
@@ -260,13 +256,10 @@ static void zval_object_property_dump(zend_property_info *prop_info, zval *zv, z
ZEND_PUTS("]=>\n");
}
if (prop_info && Z_TYPE_P(zv) == IS_UNDEF) {
- ZEND_ASSERT(prop_info->type);
- php_printf("%*cuninitialized(%s%s)\n",
- level + 1, ' ',
- ZEND_TYPE_ALLOW_NULL(prop_info->type) ? "?" : "",
- ZEND_TYPE_IS_CLASS(prop_info->type) ?
- ZSTR_VAL(ZEND_TYPE_IS_CE(prop_info->type) ? ZEND_TYPE_CE(prop_info->type)->name : ZEND_TYPE_NAME(prop_info->type)) :
- zend_get_type_by_const(ZEND_TYPE_CODE(prop_info->type)));
+ zend_string *type_str = zend_type_to_string(prop_info->type);
+ php_printf("%*cuninitialized(%s)\n",
+ level + 1, ' ', ZSTR_VAL(type_str));
+ zend_string_release(type_str);
} else {
php_debug_zval_dump(zv, level + 2);
}
@@ -1172,13 +1165,13 @@ PHP_FUNCTION(serialize)
if (EG(exception)) {
smart_str_free(&buf);
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (buf.s) {
RETURN_NEW_STR(buf.s);
} else {
- RETURN_NULL();
+ RETURN_EMPTY_STRING();
}
}
/* }}} */
@@ -1200,7 +1193,7 @@ PHP_FUNCTION(unserialize)
Z_PARAM_STRING(buf, buf_len)
Z_PARAM_OPTIONAL
Z_PARAM_ARRAY(options)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
if (buf_len == 0) {
RETURN_FALSE;
@@ -1247,13 +1240,11 @@ PHP_FUNCTION(unserialize)
max_depth = zend_hash_str_find_deref(Z_ARRVAL_P(options), "max_depth", sizeof("max_depth") - 1);
if (max_depth) {
if (Z_TYPE_P(max_depth) != IS_LONG) {
- php_error_docref(NULL, E_WARNING, "max_depth should be int");
- RETVAL_FALSE;
+ zend_type_error("max_depth should be int");
goto cleanup;
}
if (Z_LVAL_P(max_depth) < 0) {
- php_error_docref(NULL, E_WARNING, "max_depth cannot be negative");
- RETVAL_FALSE;
+ zend_value_error("max_depth cannot be negative");
goto cleanup;
}
@@ -1314,7 +1305,7 @@ PHP_FUNCTION(memory_get_usage) {
ZEND_PARSE_PARAMETERS_START(0, 1)
Z_PARAM_OPTIONAL
Z_PARAM_BOOL(real_usage)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
RETURN_LONG(zend_memory_usage(real_usage));
}
@@ -1328,7 +1319,7 @@ PHP_FUNCTION(memory_get_peak_usage) {
ZEND_PARSE_PARAMETERS_START(0, 1)
Z_PARAM_OPTIONAL
Z_PARAM_BOOL(real_usage)
- ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
+ ZEND_PARSE_PARAMETERS_END();
RETURN_LONG(zend_memory_peak_usage(real_usage));
}
diff --git a/ext/standard/var_unserializer.re b/ext/standard/var_unserializer.re
index a444cdef5b..c395f3cb5c 100644
--- a/ext/standard/var_unserializer.re
+++ b/ext/standard/var_unserializer.re
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -561,10 +559,13 @@ string_key:
if ((old_data = zend_hash_find(ht, Z_STR(key))) != NULL) {
if (Z_TYPE_P(old_data) == IS_INDIRECT) {
+ /* This is a property with a declaration */
old_data = Z_INDIRECT_P(old_data);
info = zend_get_typed_property_info_for_slot(obj, old_data);
var_push_dtor(var_hash, old_data);
- data = zend_hash_update_ind(ht, Z_STR(key), &d);
+ Z_TRY_DELREF_P(old_data);
+ ZVAL_COPY_VALUE(old_data, &d);
+ data = old_data;
if (UNEXPECTED(info)) {
/* Remember to which property this slot belongs, so we can add a
@@ -1001,7 +1002,7 @@ use_double:
if (elements) {
array_init_size(rval, elements);
/* we can't convert from packed to hash during unserialization, because
- reference to some zvals might be keept in var_hash (to support references) */
+ reference to some zvals might be kept in var_hash (to support references) */
zend_hash_real_init_mixed(Z_ARRVAL_P(rval));
} else {
ZVAL_EMPTY_ARRAY(rval);
diff --git a/ext/standard/versioning.c b/ext/standard/versioning.c
index e4353130d6..c736c8241f 100644
--- a/ext/standard/versioning.c
+++ b/ext/standard/versioning.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -201,7 +199,7 @@ php_version_compare(const char *orig_ver1, const char *orig_ver2)
}
/* }}} */
-/* {{{ proto int version_compare(string ver1, string ver2 [, string oper])
+/* {{{ proto int|bool|null version_compare(string ver1, string ver2 [, string oper])
Compares two "PHP-standardized" version number strings */
PHP_FUNCTION(version_compare)
@@ -239,7 +237,8 @@ PHP_FUNCTION(version_compare)
if (!strncmp(op, "!=", op_len) || !strncmp(op, "<>", op_len) || !strncmp(op, "ne", op_len)) {
RETURN_BOOL(compare != 0);
}
- RETURN_NULL();
+
+ zend_value_error("Invalid comparison operator");
}
/* }}} */
diff --git a/ext/sysvmsg/php_sysvmsg.h b/ext/sysvmsg/php_sysvmsg.h
index af5e1da9ab..5aa075f741 100644
--- a/ext/sysvmsg/php_sysvmsg.h
+++ b/ext/sysvmsg/php_sysvmsg.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/sysvmsg/sysvmsg.c b/ext/sysvmsg/sysvmsg.c
index d113ef56d5..b9bedfa9de 100644
--- a/ext/sysvmsg/sysvmsg.c
+++ b/ext/sysvmsg/sysvmsg.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -24,6 +22,7 @@
#include "php_globals.h"
#include "ext/standard/info.h"
#include "php_sysvmsg.h"
+#include "sysvmsg_arginfo.h"
#include "ext/standard/php_var.h"
#include "zend_smart_str.h"
@@ -62,50 +61,6 @@ struct php_msgbuf {
/* True global resources - no need for thread safety here */
static int le_sysvmsg;
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_msg_get_queue, 0, 0, 1)
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, perms)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_msg_send, 0, 0, 3)
- ZEND_ARG_INFO(0, queue)
- ZEND_ARG_INFO(0, msgtype)
- ZEND_ARG_INFO(0, message)
- ZEND_ARG_INFO(0, serialize)
- ZEND_ARG_INFO(0, blocking)
- ZEND_ARG_INFO(1, errorcode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_msg_receive, 0, 0, 5)
- ZEND_ARG_INFO(0, queue)
- ZEND_ARG_INFO(0, desiredmsgtype)
- ZEND_ARG_INFO(1, msgtype)
- ZEND_ARG_INFO(0, maxsize)
- ZEND_ARG_INFO(1, message)
- ZEND_ARG_INFO(0, unserialize)
- ZEND_ARG_INFO(0, flags)
- ZEND_ARG_INFO(1, errorcode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_msg_remove_queue, 0, 0, 1)
- ZEND_ARG_INFO(0, queue)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_msg_stat_queue, 0, 0, 1)
- ZEND_ARG_INFO(0, queue)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_msg_set_queue, 0, 0, 2)
- ZEND_ARG_INFO(0, queue)
- ZEND_ARG_INFO(0, data)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_msg_queue_exists, 0, 0, 1)
- ZEND_ARG_INFO(0, key)
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ sysvmsg_functions[]
*
* Every user visible function must have an entry in sysvmsg_functions[].
@@ -183,11 +138,11 @@ PHP_FUNCTION(msg_set_queue)
RETVAL_FALSE;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ra", &queue, &data) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((mq = (sysvmsg_queue_t *)zend_fetch_resource(Z_RES_P(queue), "sysvmsg queue", le_sysvmsg)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (msgctl(mq->id, IPC_STAT, &stat) == 0) {
@@ -224,11 +179,11 @@ PHP_FUNCTION(msg_stat_queue)
RETVAL_FALSE;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &queue) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((mq = (sysvmsg_queue_t *)zend_fetch_resource(Z_RES_P(queue), "sysvmsg queue", le_sysvmsg)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (msgctl(mq->id, IPC_STAT, &stat) == 0) {
@@ -255,7 +210,7 @@ PHP_FUNCTION(msg_queue_exists)
zend_long key;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &key) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (msgget(key, 0) < 0) {
@@ -275,7 +230,7 @@ PHP_FUNCTION(msg_get_queue)
sysvmsg_queue_t *mq;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l", &key, &perms) == FAILURE) {
- return;
+ RETURN_THROWS();
}
mq = (sysvmsg_queue_t *) emalloc(sizeof(sysvmsg_queue_t));
@@ -286,7 +241,7 @@ PHP_FUNCTION(msg_get_queue)
/* doesn't already exist; create it */
mq->id = msgget(key, IPC_CREAT | IPC_EXCL | perms);
if (mq->id < 0) {
- php_error_docref(NULL, E_WARNING, "failed for key 0x" ZEND_XLONG_FMT ": %s", key, strerror(errno));
+ php_error_docref(NULL, E_WARNING, "Failed for key 0x" ZEND_XLONG_FMT ": %s", key, strerror(errno));
efree(mq);
RETURN_FALSE;
}
@@ -303,11 +258,11 @@ PHP_FUNCTION(msg_remove_queue)
sysvmsg_queue_t *mq = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &queue) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((mq = (sysvmsg_queue_t *)zend_fetch_resource(Z_RES_P(queue), "sysvmsg queue", le_sysvmsg)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (msgctl(mq->id, IPC_RMID, NULL) == 0) {
@@ -335,11 +290,11 @@ PHP_FUNCTION(msg_receive)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlzlz|blz",
&queue, &desiredmsgtype, &out_msgtype, &maxsize,
&out_message, &do_unserialize, &flags, &zerrcode) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (maxsize <= 0) {
- php_error_docref(NULL, E_WARNING, "maximum size of the message has to be greater than zero");
+ php_error_docref(NULL, E_WARNING, "Maximum size of the message has to be greater than zero");
return;
}
@@ -361,7 +316,7 @@ PHP_FUNCTION(msg_receive)
}
if ((mq = (sysvmsg_queue_t *)zend_fetch_resource(Z_RES_P(queue), "sysvmsg queue", le_sysvmsg)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
messagebuffer = (struct php_msgbuf *) safe_emalloc(maxsize, 1, sizeof(struct php_msgbuf));
@@ -383,7 +338,7 @@ PHP_FUNCTION(msg_receive)
PHP_VAR_UNSERIALIZE_INIT(var_hash);
if (!php_var_unserialize(&tmp, &p, p + result, &var_hash)) {
- php_error_docref(NULL, E_WARNING, "message corrupted");
+ php_error_docref(NULL, E_WARNING, "Message corrupted");
ZEND_TRY_ASSIGN_REF_FALSE(out_message);
RETVAL_FALSE;
} else {
@@ -420,11 +375,11 @@ PHP_FUNCTION(msg_send)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlz|bbz",
&queue, &msgtype, &message, &do_serialize, &blocking, &zerror) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((mq = (sysvmsg_queue_t *)zend_fetch_resource(Z_RES_P(queue), "sysvmsg queue", le_sysvmsg)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (do_serialize) {
diff --git a/ext/sysvmsg/sysvmsg.stub.php b/ext/sysvmsg/sysvmsg.stub.php
new file mode 100644
index 0000000000..27b59d950a
--- /dev/null
+++ b/ext/sysvmsg/sysvmsg.stub.php
@@ -0,0 +1,29 @@
+<?php
+
+/** @return resource|false */
+function msg_get_queue(int $key, int $perms = 0666) {}
+
+/**
+ * @param resource $queue
+ */
+function msg_send($queue, int $msgtype, $message, bool $serialize = true, bool $blocking = true, &$errorcode = null): bool {}
+
+/**
+ * @param resource $queue
+ */
+function msg_receive($queue, int $desiredmsgtype, &$msgtype, int $maxsize, &$message, bool $unserialize = true, int $flags = 0, &$errorcode = null): bool {}
+
+/**
+ * @param resource $queue
+ */
+function msg_remove_queue($queue): bool {}
+
+/** @param resource $queue */
+function msg_stat_queue($queue): array|false {}
+
+/**
+ * @param resource $queue
+ */
+function msg_set_queue($queue, array $data): bool {}
+
+function msg_queue_exists(int $key): bool {}
diff --git a/ext/sysvmsg/sysvmsg_arginfo.h b/ext/sysvmsg/sysvmsg_arginfo.h
new file mode 100644
index 0000000000..87a4e17358
--- /dev/null
+++ b/ext/sysvmsg/sysvmsg_arginfo.h
@@ -0,0 +1,43 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_msg_get_queue, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, key, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, perms, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_msg_send, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, queue)
+ ZEND_ARG_TYPE_INFO(0, msgtype, IS_LONG, 0)
+ ZEND_ARG_INFO(0, message)
+ ZEND_ARG_TYPE_INFO(0, serialize, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, blocking, _IS_BOOL, 0)
+ ZEND_ARG_INFO(1, errorcode)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_msg_receive, 0, 5, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, queue)
+ ZEND_ARG_TYPE_INFO(0, desiredmsgtype, IS_LONG, 0)
+ ZEND_ARG_INFO(1, msgtype)
+ ZEND_ARG_TYPE_INFO(0, maxsize, IS_LONG, 0)
+ ZEND_ARG_INFO(1, message)
+ ZEND_ARG_TYPE_INFO(0, unserialize, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ ZEND_ARG_INFO(1, errorcode)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_msg_remove_queue, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, queue)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_msg_stat_queue, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, queue)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_msg_set_queue, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, queue)
+ ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_msg_queue_exists, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, key, IS_LONG, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/sysvmsg/tests/001.phpt b/ext/sysvmsg/tests/001.phpt
index 1e53f38f20..3dc95f00b3 100644
--- a/ext/sysvmsg/tests/001.phpt
+++ b/ext/sysvmsg/tests/001.phpt
@@ -10,11 +10,11 @@ $q = msg_get_queue($key);
msg_send($q, 1, "hello") or print "FAIL\n";
$type = null;
if (msg_receive($q, 0, $type, 1024, $message)) {
- echo "TYPE: $type\n";
- echo "DATA: $message\n";
+ echo "TYPE: $type\n";
+ echo "DATA: $message\n";
}
if (!msg_remove_queue($q)) {
- echo "BAD: queue removal failed\n";
+ echo "BAD: queue removal failed\n";
}
?>
--EXPECT--
diff --git a/ext/sysvmsg/tests/002.phpt b/ext/sysvmsg/tests/002.phpt
index 76f966caa6..ae85b4431a 100644
--- a/ext/sysvmsg/tests/002.phpt
+++ b/ext/sysvmsg/tests/002.phpt
@@ -1,23 +1,23 @@
--TEST--
msg_receive() should return false when unserialize() failed
--SKIPIF--
-<?php if (!extension_loaded("sysvmsg")) die("skip sysvmsg extenions is not available")?>
+<?php if (!extension_loaded("sysvmsg")) die("skip sysvmsg extensions is not available")?>
--FILE--
<?php
$queue = msg_get_queue (ftok(__FILE__, 'r'), 0600);
if (!msg_send ($queue, 1, 'Hi', false /* ! no_ser*/, true/*block*/, $msg_err)) {
- die("error\n");
+ die("error\n");
}
var_dump($res = msg_receive ($queue, 1, $msg_type, 16384, $msg, true, 0, $msg_error));
if (!msg_remove_queue($queue)) {
- echo "BAD: queue removal failed\n";
+ echo "BAD: queue removal failed\n";
}
echo "Done\n";
?>
--EXPECTF--
-Warning: msg_receive(): message corrupted in %s002.php on line %d
+Warning: msg_receive(): Message corrupted in %s002.php on line %d
bool(false)
Done
diff --git a/ext/sysvmsg/tests/005.phpt b/ext/sysvmsg/tests/005.phpt
index a2680c21c0..68323e9a30 100644
--- a/ext/sysvmsg/tests/005.phpt
+++ b/ext/sysvmsg/tests/005.phpt
@@ -10,14 +10,13 @@ $tests = array(null, 'foo');
foreach ($tests as $q) {
if ($q === null) {
- do {
- $id = ftok(__FILE__, chr(mt_rand(0, 255)));
- } while (msg_queue_exists($id));
-
- $q = msg_get_queue($id) or die("Failed to create queue");
- msg_remove_queue($q) or die("Failed to close queue");
+ do {
+ $id = ftok(__FILE__, chr(mt_rand(0, 255))); } while (msg_queue_exists($id));
}
+ $q = msg_get_queue($id) or die("Failed to create queue");
+ msg_remove_queue($q) or die("Failed to close queue");
+
echo "Using '$q' as queue resource:\n";
$errno = 0;
@@ -44,28 +43,22 @@ bool(false)
bool(false)
bool(true)
-Warning: msg_receive(): maximum size of the message has to be greater than zero in %s on line %d
+Warning: msg_receive(): Maximum size of the message has to be greater than zero in %s on line %d
bool(false)
Warning: msg_send(): msgsnd failed: Invalid argument in %s on line %d
bool(false)
bool(true)
-Using 'foo' as queue resource:
-
-Warning: msg_set_queue() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
-
-Warning: msg_stat_queue() expects parameter 1 to be resource, string given in %s on line %d
+Using 'Resource id #5' as queue resource:
bool(false)
-
-Warning: msg_receive() expects parameter 1 to be resource, string given in %s on line %d
bool(false)
bool(false)
+bool(true)
-Warning: msg_receive() expects parameter 1 to be resource, string given in %s on line %d
+Warning: msg_receive(): Maximum size of the message has to be greater than zero in %s on line %d
bool(false)
-Warning: msg_send() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
+Warning: msg_send(): msgsnd failed: Invalid argument in %s on line %d
bool(false)
+bool(true)
Done
diff --git a/ext/sysvmsg/tests/006.phpt b/ext/sysvmsg/tests/006.phpt
index 2d4976033c..fffb684221 100644
--- a/ext/sysvmsg/tests/006.phpt
+++ b/ext/sysvmsg/tests/006.phpt
@@ -1,7 +1,7 @@
--TEST--
msg_send() data types when not serializing
--SKIPIF--
-<?php if (!extension_loaded("sysvmsg")) die("skip sysvmsg extenions is not available")?>
+<?php if (!extension_loaded("sysvmsg")) die("skip sysvmsg extensions is not available")?>
--FILE--
<?php
@@ -21,7 +21,7 @@ foreach ($tests as $elem) {
}
if (!msg_remove_queue($queue)) {
- echo "BAD: queue removal failed\n";
+ echo "BAD: queue removal failed\n";
}
echo "Done\n";
diff --git a/ext/sysvsem/php_sysvsem.h b/ext/sysvsem/php_sysvsem.h
index a78a49b350..980ddbe021 100644
--- a/ext/sysvsem/php_sysvsem.h
+++ b/ext/sysvsem/php_sysvsem.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/sysvsem/sysvsem.c b/ext/sysvsem/sysvsem.c
index 6086d1f066..b936dfe7aa 100644
--- a/ext/sysvsem/sysvsem.c
+++ b/ext/sysvsem/sysvsem.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -38,6 +36,7 @@
#include <sys/sem.h>
#include <errno.h>
+#include "sysvsem_arginfo.h"
#include "php_sysvsem.h"
#include "ext/standard/info.h"
@@ -55,28 +54,6 @@ union semun {
#endif
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sem_get, 0, 0, 1)
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, max_acquire)
- ZEND_ARG_INFO(0, perm)
- ZEND_ARG_INFO(0, auto_release)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sem_acquire, 0, 0, 1)
- ZEND_ARG_INFO(0, sem_identifier)
- ZEND_ARG_INFO(0, nowait)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sem_release, 0, 0, 1)
- ZEND_ARG_INFO(0, sem_identifier)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sem_remove, 0, 0, 1)
- ZEND_ARG_INFO(0, sem_identifier)
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ sysvsem_functions[]
*/
static const zend_function_entry sysvsem_functions[] = {
@@ -204,7 +181,7 @@ PHP_FUNCTION(sem_get)
sysvsem_sem *sem_ptr;
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "l|lll", &key, &max_acquire, &perm, &auto_release)) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* Get/create the semaphore. Note that we rely on the semaphores
@@ -215,7 +192,7 @@ PHP_FUNCTION(sem_get)
semid = semget(key, 3, perm|IPC_CREAT);
if (semid == -1) {
- php_error_docref(NULL, E_WARNING, "failed for key 0x" ZEND_XLONG_FMT ": %s", key, strerror(errno));
+ php_error_docref(NULL, E_WARNING, "Failed for key 0x" ZEND_XLONG_FMT ": %s", key, strerror(errno));
RETURN_FALSE;
}
@@ -247,7 +224,7 @@ PHP_FUNCTION(sem_get)
sop[2].sem_flg = SEM_UNDO;
while (semop(semid, sop, 3) == -1) {
if (errno != EINTR) {
- php_error_docref(NULL, E_WARNING, "failed acquiring SYSVSEM_SETVAL for key 0x" ZEND_XLONG_FMT ": %s", key, strerror(errno));
+ php_error_docref(NULL, E_WARNING, "Failed acquiring SYSVSEM_SETVAL for key 0x" ZEND_XLONG_FMT ": %s", key, strerror(errno));
break;
}
}
@@ -255,7 +232,7 @@ PHP_FUNCTION(sem_get)
/* Get the usage count. */
count = semctl(semid, SYSVSEM_USAGE, GETVAL, NULL);
if (count == -1) {
- php_error_docref(NULL, E_WARNING, "failed for key 0x" ZEND_XLONG_FMT ": %s", key, strerror(errno));
+ php_error_docref(NULL, E_WARNING, "Failed for key 0x" ZEND_XLONG_FMT ": %s", key, strerror(errno));
}
/* If we are the only user, then take this opportunity to set the max. */
@@ -266,17 +243,17 @@ PHP_FUNCTION(sem_get)
union semun semarg;
semarg.val = max_acquire;
if (semctl(semid, SYSVSEM_SEM, SETVAL, semarg) == -1) {
- php_error_docref(NULL, E_WARNING, "failed for key 0x" ZEND_XLONG_FMT ": %s", key, strerror(errno));
+ php_error_docref(NULL, E_WARNING, "Failed for key 0x" ZEND_XLONG_FMT ": %s", key, strerror(errno));
}
#elif defined(SETVAL_WANTS_PTR)
/* This is correct for Solaris 2.6 which does not have union semun. */
if (semctl(semid, SYSVSEM_SEM, SETVAL, &max_acquire) == -1) {
- php_error_docref(NULL, E_WARNING, "failed for key 0x%lx: %s", key, strerror(errno));
+ php_error_docref(NULL, E_WARNING, "Failed for key 0x%lx: %s", key, strerror(errno));
}
#else
/* This works for i.e. AIX */
if (semctl(semid, SYSVSEM_SEM, SETVAL, max_acquire) == -1) {
- php_error_docref(NULL, E_WARNING, "failed for key 0x%lx: %s", key, strerror(errno));
+ php_error_docref(NULL, E_WARNING, "Failed for key 0x%lx: %s", key, strerror(errno));
}
#endif
}
@@ -288,7 +265,7 @@ PHP_FUNCTION(sem_get)
sop[0].sem_flg = SEM_UNDO;
while (semop(semid, sop, 1) == -1) {
if (errno != EINTR) {
- php_error_docref(NULL, E_WARNING, "failed releasing SYSVSEM_SETVAL for key 0x" ZEND_XLONG_FMT ": %s", key, strerror(errno));
+ php_error_docref(NULL, E_WARNING, "Failed releasing SYSVSEM_SETVAL for key 0x" ZEND_XLONG_FMT ": %s", key, strerror(errno));
break;
}
}
@@ -315,16 +292,16 @@ static void php_sysvsem_semop(INTERNAL_FUNCTION_PARAMETERS, int acquire)
if (acquire) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|b", &arg_id, &nowait) == FAILURE) {
- return;
+ RETURN_THROWS();
}
} else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &arg_id) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
if ((sem_ptr = (sysvsem_sem *)zend_fetch_resource(Z_RES_P(arg_id), "SysV semaphore", php_sysvsem_module.le_sem)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (!acquire && sem_ptr->count == 0) {
@@ -339,7 +316,7 @@ static void php_sysvsem_semop(INTERNAL_FUNCTION_PARAMETERS, int acquire)
while (semop(sem_ptr->semid, &sop, 1) == -1) {
if (errno != EINTR) {
if (errno != EAGAIN) {
- php_error_docref(NULL, E_WARNING, "failed to %s key 0x%x: %s", acquire ? "acquire" : "release", sem_ptr->key, strerror(errno));
+ php_error_docref(NULL, E_WARNING, "Failed to %s key 0x%x: %s", acquire ? "acquire" : "release", sem_ptr->key, strerror(errno));
}
RETURN_FALSE;
}
@@ -384,11 +361,11 @@ PHP_FUNCTION(sem_remove)
#endif
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &arg_id) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((sem_ptr = (sysvsem_sem *)zend_fetch_resource(Z_RES_P(arg_id), "SysV semaphore", php_sysvsem_module.le_sem)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
#if HAVE_SEMUN
@@ -406,7 +383,7 @@ PHP_FUNCTION(sem_remove)
#else
if (semctl(sem_ptr->semid, 0, IPC_RMID, NULL) < 0) {
#endif
- php_error_docref(NULL, E_WARNING, "failed for SysV semaphore " ZEND_LONG_FMT ": %s", Z_LVAL_P(arg_id), strerror(errno));
+ php_error_docref(NULL, E_WARNING, "Failed for SysV semaphore " ZEND_LONG_FMT ": %s", Z_LVAL_P(arg_id), strerror(errno));
RETURN_FALSE;
}
diff --git a/ext/sysvsem/sysvsem.stub.php b/ext/sysvsem/sysvsem.stub.php
new file mode 100644
index 0000000000..cb64eec3a5
--- /dev/null
+++ b/ext/sysvsem/sysvsem.stub.php
@@ -0,0 +1,22 @@
+<?php
+
+/**
+ * @todo use bool for $auto_release
+ * @return resource|false
+ */
+function sem_get(int $key, int $max_acquire = 1, int $perm = 0666, int $auto_release = 1) {}
+
+/**
+ * @param resource $sem_identifier
+ */
+function sem_acquire($sem_identifier, bool $nowait = false): bool {}
+
+/**
+ * @param resource $sem_identifier
+ */
+function sem_release($sem_identifier): bool {}
+
+/**
+ * @param resource $sem_identifier
+ */
+function sem_remove($sem_identifier): bool {}
diff --git a/ext/sysvsem/sysvsem_arginfo.h b/ext/sysvsem/sysvsem_arginfo.h
new file mode 100644
index 0000000000..f45cae2498
--- /dev/null
+++ b/ext/sysvsem/sysvsem_arginfo.h
@@ -0,0 +1,19 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_sem_get, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, key, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, max_acquire, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, perm, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, auto_release, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sem_acquire, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, sem_identifier)
+ ZEND_ARG_TYPE_INFO(0, nowait, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sem_release, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, sem_identifier)
+ZEND_END_ARG_INFO()
+
+#define arginfo_sem_remove arginfo_sem_release
diff --git a/ext/sysvsem/tests/nowait.phpt b/ext/sysvsem/tests/nowait.phpt
index 13f965ee21..147b8da335 100644
--- a/ext/sysvsem/tests/nowait.phpt
+++ b/ext/sysvsem/tests/nowait.phpt
@@ -18,8 +18,8 @@ pcntl_signal(SIGCHLD, SIG_IGN);
// Get semaphore for parent
$p_sem_id = sem_get($P_SEMKEY, 1);
if ($p_sem_id === FALSE) {
- echo "P: failed to parent get semaphore\n";
- exit;
+ echo "P: failed to parent get semaphore\n";
+ exit;
}
echo "P: got semaphore $p_sem_id.\n";
@@ -27,24 +27,24 @@ echo "P: got semaphore $p_sem_id.\n";
// Get semaphore for child
$c_sem_id = sem_get($C_SEMKEY, 1);
if ($c_sem_id === FALSE) {
- echo "P: failed to child get semaphore\n";
- exit;
+ echo "P: failed to child get semaphore\n";
+ exit;
}
// Acquire semaphore for parent
if (!sem_acquire($p_sem_id)) {
- echo "P: fail to acquire semaphore $p_sem_id.\n";
- sem_remove($p_sem_id);
- exit;
+ echo "P: fail to acquire semaphore $p_sem_id.\n";
+ sem_remove($p_sem_id);
+ exit;
}
echo "P: acquired semaphore $p_sem_id.\n";
// Acquire semaphore for child
if (!sem_acquire($c_sem_id)) {
- echo "P: fail to acquire semaphore $c_sem_id.\n";
- sem_remove($c_sem_id);
- exit;
+ echo "P: fail to acquire semaphore $c_sem_id.\n";
+ sem_remove($c_sem_id);
+ exit;
}
echo "P: acquired semaphore $c_sem_id\n";
// Fork process
@@ -52,69 +52,69 @@ $pid = pcntl_fork();
if ($pid) {
- register_shutdown_function(function () use ($p_sem_id) {
- echo "P: removing semaphore $p_sem_id.\n";
- sem_remove($p_sem_id);
- });
+ register_shutdown_function(function () use ($p_sem_id) {
+ echo "P: removing semaphore $p_sem_id.\n";
+ sem_remove($p_sem_id);
+ });
- // Release semaphore after 50ms
- usleep(50000);
+ // Release semaphore after 50ms
+ usleep(50000);
- /* Wait for the child semaphore to be released to
- to release the parent semaphore */
- if (!sem_acquire($c_sem_id)) {
- echo "P: failed to acquire semaphore $c_sem_id.\n";
- exit;
- }
+ /* Wait for the child semaphore to be released to
+ to release the parent semaphore */
+ if (!sem_acquire($c_sem_id)) {
+ echo "P: failed to acquire semaphore $c_sem_id.\n";
+ exit;
+ }
- /* Release the child semahpore before releasing
- the releasing the parent semaphore and letting
- the child continue execution */
- sem_release($c_sem_id);
+ /* Release the child semahpore before releasing
+ the releasing the parent semaphore and letting
+ the child continue execution */
+ sem_release($c_sem_id);
- echo "P: releasing semaphore $p_sem_id.\n";
- if (!sem_release($p_sem_id)) {
- echo "P: failed to release semaphore\n";
- }
+ echo "P: releasing semaphore $p_sem_id.\n";
+ if (!sem_release($p_sem_id)) {
+ echo "P: failed to release semaphore\n";
+ }
- $status = null;
- pcntl_waitpid($pid, $status);
+ $status = null;
+ pcntl_waitpid($pid, $status);
} else {
- register_shutdown_function(function () use ($c_sem_id) {
- echo "C: removing semaphore $c_sem_id.\n";
- sem_remove($c_sem_id);
- });
+ register_shutdown_function(function () use ($c_sem_id) {
+ echo "C: removing semaphore $c_sem_id.\n";
+ sem_remove($c_sem_id);
+ });
- echo "C: child process running.\n";
+ echo "C: child process running.\n";
- // Have the semaphore after process forked
- echo "C: got semaphore $p_sem_id and $c_sem_id.\n";
+ // Have the semaphore after process forked
+ echo "C: got semaphore $p_sem_id and $c_sem_id.\n";
- // This should fail to get to the semaphore and not wait
- if (sem_acquire($p_sem_id, true)) {
- echo "C: test failed, Child was able to acquire semaphore $p_sem_id.\n";
- exit;
- }
+ // This should fail to get to the semaphore and not wait
+ if (sem_acquire($p_sem_id, true)) {
+ echo "C: test failed, Child was able to acquire semaphore $p_sem_id.\n";
+ exit;
+ }
- // The child process did not wait to acquire the semaphore
- echo "C: failed to acquire semaphore $p_sem_id.\n";
+ // The child process did not wait to acquire the semaphore
+ echo "C: failed to acquire semaphore $p_sem_id.\n";
- echo "C: releasing semaphore $c_sem_id\n";
- if (!sem_release($c_sem_id)) {
- echo "C: Failed to release semaphore\n";
- }
+ echo "C: releasing semaphore $c_sem_id\n";
+ if (!sem_release($c_sem_id)) {
+ echo "C: Failed to release semaphore\n";
+ }
- // Acquire semaphore with waiting
- if (!sem_acquire($p_sem_id)) {
- echo "C: fail to acquire semaphore $p_sem_id.\n";
- exit;
- }
- echo "C: success acquired semaphore $p_sem_id.\n";
+ // Acquire semaphore with waiting
+ if (!sem_acquire($p_sem_id)) {
+ echo "C: fail to acquire semaphore $p_sem_id.\n";
+ exit;
+ }
+ echo "C: success acquired semaphore $p_sem_id.\n";
- echo "C: releasing semaphore $p_sem_id.\n";
- sem_release($p_sem_id);
+ echo "C: releasing semaphore $p_sem_id.\n";
+ sem_release($p_sem_id);
}
?>
diff --git a/ext/sysvsem/tests/sysv.phpt b/ext/sysvsem/tests/sysv.phpt
index 3f485e2c08..08cb63f839 100644
--- a/ext/sysvsem/tests/sysv.phpt
+++ b/ext/sysvsem/tests/sysv.phpt
@@ -16,79 +16,79 @@ echo "Start.\n";
// Get semaphore
$sem_id = sem_get($SEMKEY, 1);
if ($sem_id === FALSE) {
- echo "Fail to get semaphore";
- exit;
+ echo "Fail to get semaphore";
+ exit;
}
echo "Got semaphore $sem_id.\n";
// Accuire semaphore
if (! sem_acquire($sem_id)) {
- echo "Fail to acquire semaphore $sem_id.\n";
- sem_remove($sem_id);
- exit;
+ echo "Fail to acquire semaphore $sem_id.\n";
+ sem_remove($sem_id);
+ exit;
}
echo "Success acquire semaphore $sem_id.\n";
$shm_id = shm_attach($SHMKEY, $MEMSIZE);
if ($shm_id === FALSE) {
- echo "Fail to attach shared memory.\n";
- sem_remove($sem_id);
- exit;
+ echo "Fail to attach shared memory.\n";
+ sem_remove($sem_id);
+ exit;
}
echo "Success to attach shared memory : $shm_id.\n";
// Write variable 1
if (!shm_put_var($shm_id, 1, "Variable 1")) {
- echo "Fail to put var 1 on shared memory $shm_id.\n";
- sem_remove($sem_id);
- shm_remove ($shm_id);
- exit;
+ echo "Fail to put var 1 on shared memory $shm_id.\n";
+ sem_remove($sem_id);
+ shm_remove ($shm_id);
+ exit;
}
echo "Write var1 to shared memory.\n";
// Write variable 2
if (!shm_put_var($shm_id, 2, "Variable 2")) {
- echo "Fail to put var 2 on shared memory $shm_id.\n";
- sem_remove($sem_id);
- shm_remove ($shm_id);
- exit;
+ echo "Fail to put var 2 on shared memory $shm_id.\n";
+ sem_remove($sem_id);
+ shm_remove ($shm_id);
+ exit;
}
echo "Write var2 to shared memory.\n";
// Read variable 1
$var1 = shm_get_var ($shm_id, 1);
if ($var1 === FALSE) {
- echo "Fail to retrieve Var 1 from Shared memory $shm_id, return value=$var1.\n";
+ echo "Fail to retrieve Var 1 from Shared memory $shm_id, return value=$var1.\n";
} else {
- echo "Read var1=$var1.\n";
+ echo "Read var1=$var1.\n";
}
// Read variable 1
$var2 = shm_get_var ($shm_id, 2);
if ($var1 === FALSE) {
- echo "Fail to retrieve Var 2 from Shared memory $shm_id, return value=$var2.\n";
+ echo "Fail to retrieve Var 2 from Shared memory $shm_id, return value=$var2.\n";
} else {
- echo "Read var2=$var2.\n";
+ echo "Read var2=$var2.\n";
}
// Release semaphore
if (!sem_release($sem_id)) {
- echo "Fail to release $sem_id semaphore.\n";
+ echo "Fail to release $sem_id semaphore.\n";
} else {
- echo "Semaphore $sem_id released.\n";
+ echo "Semaphore $sem_id released.\n";
}
// remove shared memory segmant from SysV
if (shm_remove ($shm_id)) {
- echo "Shared memory successfully removed from SysV.\n";
+ echo "Shared memory successfully removed from SysV.\n";
} else {
- echo "Fail to remove $shm_id shared memory from SysV.\n";
+ echo "Fail to remove $shm_id shared memory from SysV.\n";
}
// Remove semaphore
if (sem_remove($sem_id)) {
- echo "semaphore removed successfully from SysV.\n";
+ echo "semaphore removed successfully from SysV.\n";
} else {
- echo "Fail to remove $sem_id semaphore from SysV.\n";
+ echo "Fail to remove $sem_id semaphore from SysV.\n";
}
echo "End.\n";
/* NOTE: assigned semids differ depending on the kernel, since
diff --git a/ext/sysvshm/php_sysvshm.h b/ext/sysvshm/php_sysvshm.h
index c2c5036245..8ff2e26b37 100644
--- a/ext/sysvshm/php_sysvshm.h
+++ b/ext/sysvshm/php_sysvshm.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/sysvshm/sysvshm.c b/ext/sysvshm/sysvshm.c
index 6526efa250..29a4298a5d 100644
--- a/ext/sysvshm/sysvshm.c
+++ b/ext/sysvshm/sysvshm.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -33,48 +31,12 @@
#include <errno.h>
#include "php_sysvshm.h"
+#include "sysvshm_arginfo.h"
#include "ext/standard/info.h"
#include "ext/standard/php_var.h"
#include "zend_smart_str.h"
#include "php_ini.h"
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_shm_attach, 0, 0, 1)
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, memsize)
- ZEND_ARG_INFO(0, perm)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_shm_detach, 0, 0, 1)
- ZEND_ARG_INFO(0, shm_identifier)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_shm_has_var, 0, 0, 2)
- ZEND_ARG_INFO(0, id)
- ZEND_ARG_INFO(0, variable_key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_shm_remove, 0, 0, 1)
- ZEND_ARG_INFO(0, shm_identifier)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_shm_put_var, 0, 0, 3)
- ZEND_ARG_INFO(0, shm_identifier)
- ZEND_ARG_INFO(0, variable_key)
- ZEND_ARG_INFO(0, variable)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_shm_get_var, 0, 0, 2)
- ZEND_ARG_INFO(0, id)
- ZEND_ARG_INFO(0, variable_key)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_shm_remove_var, 0, 0, 2)
- ZEND_ARG_INFO(0, id)
- ZEND_ARG_INFO(0, variable_key)
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ sysvshm_functions[]
*/
static const zend_function_entry sysvshm_functions[] = {
@@ -113,7 +75,7 @@ ZEND_GET_MODULE(sysvshm)
#define SHM_FETCH_RESOURCE(shm_ptr, z_ptr) do { \
if ((shm_ptr = (sysvshm_shm *)zend_fetch_resource(Z_RES_P(z_ptr), PHP_SHM_RSRC_NAME, php_sysvshm.le_shm)) == NULL) { \
- RETURN_FALSE; \
+ RETURN_THROWS(); \
} \
} while (0)
@@ -166,7 +128,7 @@ PHP_FUNCTION(shm_attach)
zend_long shm_key, shm_id, shm_size = php_sysvshm.init_mem, shm_flag = 0666;
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "l|ll", &shm_key, &shm_size, &shm_flag)) {
- return;
+ RETURN_THROWS();
}
if (shm_size < 1) {
@@ -179,19 +141,19 @@ PHP_FUNCTION(shm_attach)
/* get the id from a specified key or create new shared memory */
if ((shm_id = shmget(shm_key, 0, 0)) < 0) {
if (shm_size < (zend_long)sizeof(sysvshm_chunk_head)) {
- php_error_docref(NULL, E_WARNING, "failed for key 0x" ZEND_XLONG_FMT ": memorysize too small", shm_key);
+ php_error_docref(NULL, E_WARNING, "Failed for key 0x" ZEND_XLONG_FMT ": memorysize too small", shm_key);
efree(shm_list_ptr);
RETURN_FALSE;
}
if ((shm_id = shmget(shm_key, shm_size, shm_flag | IPC_CREAT | IPC_EXCL)) < 0) {
- php_error_docref(NULL, E_WARNING, "failed for key 0x" ZEND_XLONG_FMT ": %s", shm_key, strerror(errno));
+ php_error_docref(NULL, E_WARNING, "Failed for key 0x" ZEND_XLONG_FMT ": %s", shm_key, strerror(errno));
efree(shm_list_ptr);
RETURN_FALSE;
}
}
if ((shm_ptr = shmat(shm_id, NULL, 0)) == (void *) -1) {
- php_error_docref(NULL, E_WARNING, "failed for key 0x" ZEND_XLONG_FMT ": %s", shm_key, strerror(errno));
+ php_error_docref(NULL, E_WARNING, "Failed for key 0x" ZEND_XLONG_FMT ": %s", shm_key, strerror(errno));
efree(shm_list_ptr);
RETURN_FALSE;
}
@@ -222,7 +184,7 @@ PHP_FUNCTION(shm_detach)
sysvshm_shm *shm_list_ptr;
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "r", &shm_id)) {
- return;
+ RETURN_THROWS();
}
SHM_FETCH_RESOURCE(shm_list_ptr, shm_id);
RETURN_BOOL(SUCCESS == zend_list_close(Z_RES_P(shm_id)));
@@ -237,12 +199,12 @@ PHP_FUNCTION(shm_remove)
sysvshm_shm *shm_list_ptr;
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "r", &shm_id)) {
- return;
+ RETURN_THROWS();
}
SHM_FETCH_RESOURCE(shm_list_ptr, shm_id);
if (shmctl(shm_list_ptr->id, IPC_RMID, NULL) < 0) {
- php_error_docref(NULL, E_WARNING, "failed for key 0x%x, id " ZEND_LONG_FMT ": %s", shm_list_ptr->key, Z_LVAL_P(shm_id), strerror(errno));
+ php_error_docref(NULL, E_WARNING, "Failed for key 0x%x, id " ZEND_LONG_FMT ": %s", shm_list_ptr->key, Z_LVAL_P(shm_id), strerror(errno));
RETURN_FALSE;
}
@@ -262,7 +224,7 @@ PHP_FUNCTION(shm_put_var)
php_serialize_data_t var_hash;
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "rlz", &shm_id, &shm_key, &arg_var)) {
- return;
+ RETURN_THROWS();
}
/* setup string-variable and serialize */
@@ -273,7 +235,7 @@ PHP_FUNCTION(shm_put_var)
shm_list_ptr = zend_fetch_resource(Z_RES_P(shm_id), PHP_SHM_RSRC_NAME, php_sysvshm.le_shm);
if (!shm_list_ptr) {
smart_str_free(&shm_var);
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* insert serialized variable into shared memory */
@@ -283,7 +245,7 @@ PHP_FUNCTION(shm_put_var)
smart_str_free(&shm_var);
if (ret == -1) {
- php_error_docref(NULL, E_WARNING, "not enough shared memory left");
+ php_error_docref(NULL, E_WARNING, "Not enough shared memory left");
RETURN_FALSE;
}
RETURN_TRUE;
@@ -303,7 +265,7 @@ PHP_FUNCTION(shm_get_var)
php_unserialize_data_t var_hash;
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &shm_id, &shm_key)) {
- return;
+ RETURN_THROWS();
}
SHM_FETCH_RESOURCE(shm_list_ptr, shm_id);
@@ -312,7 +274,7 @@ PHP_FUNCTION(shm_get_var)
shm_varpos = php_check_shm_data((shm_list_ptr->ptr), shm_key);
if (shm_varpos < 0) {
- php_error_docref(NULL, E_WARNING, "variable key " ZEND_LONG_FMT " doesn't exist", shm_key);
+ php_error_docref(NULL, E_WARNING, "Variable key " ZEND_LONG_FMT " doesn't exist", shm_key);
RETURN_FALSE;
}
shm_var = (sysvshm_chunk*) ((char *)shm_list_ptr->ptr + shm_varpos);
@@ -320,7 +282,7 @@ PHP_FUNCTION(shm_get_var)
PHP_VAR_UNSERIALIZE_INIT(var_hash);
if (php_var_unserialize(return_value, (const unsigned char **) &shm_data, (unsigned char *) shm_data + shm_var->length, &var_hash) != 1) {
- php_error_docref(NULL, E_WARNING, "variable data in shared memory is corrupted");
+ php_error_docref(NULL, E_WARNING, "Variable data in shared memory is corrupted");
RETVAL_FALSE;
}
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
@@ -336,7 +298,7 @@ PHP_FUNCTION(shm_has_var)
sysvshm_shm *shm_list_ptr;
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &shm_id, &shm_key)) {
- return;
+ RETURN_THROWS();
}
SHM_FETCH_RESOURCE(shm_list_ptr, shm_id);
RETURN_BOOL(php_check_shm_data(shm_list_ptr->ptr, shm_key) >= 0);
@@ -352,14 +314,14 @@ PHP_FUNCTION(shm_remove_var)
sysvshm_shm *shm_list_ptr;
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &shm_id, &shm_key)) {
- return;
+ RETURN_THROWS();
}
SHM_FETCH_RESOURCE(shm_list_ptr, shm_id);
shm_varpos = php_check_shm_data((shm_list_ptr->ptr), shm_key);
if (shm_varpos < 0) {
- php_error_docref(NULL, E_WARNING, "variable key " ZEND_LONG_FMT " doesn't exist", shm_key);
+ php_error_docref(NULL, E_WARNING, "Variable key " ZEND_LONG_FMT " doesn't exist", shm_key);
RETURN_FALSE;
}
php_remove_shm_data((shm_list_ptr->ptr), shm_varpos);
diff --git a/ext/sysvshm/sysvshm.stub.php b/ext/sysvshm/sysvshm.stub.php
new file mode 100644
index 0000000000..673f9c6f04
--- /dev/null
+++ b/ext/sysvshm/sysvshm.stub.php
@@ -0,0 +1,35 @@
+<?php
+
+/** @return resource|false */
+function shm_attach(int $key, int $memsize = UNKNOWN, int $perm = 0666) {}
+
+/**
+ * @param resource $shm_identifier
+ */
+function shm_detach($shm_identifier): bool {}
+
+/**
+ * @param resource $id
+ */
+function shm_has_var($id, int $variable_key): bool {}
+
+/**
+ * @param resource $shm_identifier
+ */
+function shm_remove($shm_identifier): bool {}
+
+/**
+ * @param resource $shm_identifier
+ */
+function shm_put_var($shm_identifier, int $variable_key, $variable): bool {}
+
+/**
+ * @param resource $id
+ * @return mixed
+ */
+function shm_get_var($id, int $variable_key) {}
+
+/**
+ * @param resource $id
+ */
+function shm_remove_var($id, int $variable_key): bool {}
diff --git a/ext/sysvshm/sysvshm_arginfo.h b/ext/sysvshm/sysvshm_arginfo.h
new file mode 100644
index 0000000000..dd00aa6349
--- /dev/null
+++ b/ext/sysvshm/sysvshm_arginfo.h
@@ -0,0 +1,31 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_shm_attach, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, key, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, memsize, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, perm, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_shm_detach, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, shm_identifier)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_shm_has_var, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, id)
+ ZEND_ARG_TYPE_INFO(0, variable_key, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_shm_remove arginfo_shm_detach
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_shm_put_var, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, shm_identifier)
+ ZEND_ARG_TYPE_INFO(0, variable_key, IS_LONG, 0)
+ ZEND_ARG_INFO(0, variable)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_shm_get_var, 0, 0, 2)
+ ZEND_ARG_INFO(0, id)
+ ZEND_ARG_TYPE_INFO(0, variable_key, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_shm_remove_var arginfo_shm_has_var
diff --git a/ext/sysvshm/tests/001.phpt b/ext/sysvshm/tests/001.phpt
index 55fd8eec1d..55d5444b98 100644
--- a/ext/sysvshm/tests/001.phpt
+++ b/ext/sysvshm/tests/001.phpt
@@ -8,10 +8,6 @@ if (!function_exists('ftok')){ print 'skip'; }
--FILE--
<?php
-var_dump(ftok());
-var_dump(ftok(1));
-var_dump(ftok(1,1,1));
-
var_dump(ftok("",""));
var_dump(ftok(-1, -1));
var_dump(ftok("qwertyu","qwertyu"));
@@ -23,15 +19,6 @@ var_dump(ftok(__FILE__,"q"));
echo "Done\n";
?>
--EXPECTF--
-Warning: ftok() expects exactly 2 parameters, 0 given in %s on line %d
-NULL
-
-Warning: ftok() expects exactly 2 parameters, 1 given in %s on line %d
-NULL
-
-Warning: ftok() expects exactly 2 parameters, 3 given in %s on line %d
-NULL
-
Warning: ftok(): Pathname is invalid in %s on line %d
int(-1)
diff --git a/ext/sysvshm/tests/002.phpt b/ext/sysvshm/tests/002.phpt
index 3bfb28e5c6..d558623242 100644
--- a/ext/sysvshm/tests/002.phpt
+++ b/ext/sysvshm/tests/002.phpt
@@ -10,19 +10,14 @@ if (!function_exists('ftok')){ print 'skip'; }
$key = ftok(__FILE__, 't');
-var_dump(shm_attach());
-var_dump(shm_attach(1,2,3,4));
-
var_dump(shm_attach(-1, 0));
var_dump(shm_attach(0, -1));
var_dump(shm_attach(123, -1));
-var_dump($s = shm_attach($key, -1));
-shm_remove($s);
-var_dump($s = shm_attach($key, 0));
-shm_remove($s);
+var_dump(shm_attach($key, -1));
+var_dump(shm_attach($key, 0));
var_dump($s = shm_attach($key, 1024));
-shm_remove($key);
+shm_remove($s);
var_dump($s = shm_attach($key, 1024));
shm_remove($s);
var_dump($s = shm_attach($key, 1024, 0666));
@@ -36,12 +31,6 @@ shm_remove($s);
echo "Done\n";
?>
--EXPECTF--
-Warning: shm_attach() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: shm_attach() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-
Warning: shm_attach(): Segment size must be greater than zero in %s on line %d
bool(false)
@@ -54,15 +43,9 @@ bool(false)
Warning: shm_attach(): Segment size must be greater than zero in %s on line %d
bool(false)
-Warning: shm_remove() expects parameter 1 to be resource, bool given in %s on line %d
-
Warning: shm_attach(): Segment size must be greater than zero in %s on line %d
bool(false)
-
-Warning: shm_remove() expects parameter 1 to be resource, bool given in %s on line %d
resource(%d) of type (sysvshm)
-
-Warning: shm_remove() expects parameter 1 to be resource, int given in %s on line %d
resource(%d) of type (sysvshm)
resource(%d) of type (sysvshm)
resource(%d) of type (sysvshm)
diff --git a/ext/sysvshm/tests/003.phpt b/ext/sysvshm/tests/003.phpt
index e141353dec..a7fe128aa5 100644
--- a/ext/sysvshm/tests/003.phpt
+++ b/ext/sysvshm/tests/003.phpt
@@ -10,18 +10,19 @@ if (!function_exists('ftok')){ print 'skip'; }
$key = ftok(__DIR__."/003.phpt", 'q');
-var_dump(shm_detach());
-var_dump(shm_detach(1,1));
-
$s = shm_attach($key);
var_dump(shm_detach($s));
-var_dump(shm_detach($s));
-shm_remove($s);
-
-var_dump(shm_detach(0));
-var_dump(shm_detach(1));
-var_dump(shm_detach(-1));
+try {
+ var_dump(shm_detach($s));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ shm_remove($s);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done\n";
?>
@@ -33,25 +34,8 @@ $s = shm_attach($key);
shm_remove($s);
?>
---EXPECTF--
-Warning: shm_detach() expects exactly 1 parameter, 0 given in %s003.php on line %d
-NULL
-
-Warning: shm_detach() expects exactly 1 parameter, 2 given in %s003.php on line %d
-NULL
+--EXPECT--
bool(true)
-
-Warning: shm_detach(): supplied resource is not a valid sysvshm resource in %s003.php on line %d
-bool(false)
-
-Warning: shm_remove(): supplied resource is not a valid sysvshm resource in %s003.php on line %d
-
-Warning: shm_detach() expects parameter 1 to be resource, int given in %s003.php on line %d
-NULL
-
-Warning: shm_detach() expects parameter 1 to be resource, int given in %s003.php on line %d
-NULL
-
-Warning: shm_detach() expects parameter 1 to be resource, int given in %s003.php on line %d
-NULL
+shm_detach(): supplied resource is not a valid sysvshm resource
+shm_remove(): supplied resource is not a valid sysvshm resource
Done
diff --git a/ext/sysvshm/tests/004.phpt b/ext/sysvshm/tests/004.phpt
index ee64491840..40ab751ea7 100644
--- a/ext/sysvshm/tests/004.phpt
+++ b/ext/sysvshm/tests/004.phpt
@@ -11,9 +11,6 @@ if (!function_exists('ftok')){ print 'skip'; }
$key = ftok(__FILE__, 't');
$s = shm_attach($key, 1024);
-var_dump(shm_put_var());
-var_dump(shm_put_var(-1, -1, -1));
-var_dump(shm_put_var(-1, 10, "qwerty"));
var_dump(shm_put_var($s, -1, "qwerty"));
var_dump(shm_put_var($s, 10, "qwerty"));
var_dump(shm_put_var($s, 10, "qwerty"));
@@ -26,18 +23,10 @@ shm_remove($s);
echo "Done\n";
?>
--EXPECTF--
-Warning: shm_put_var() expects exactly 3 parameters, 0 given in %s004.php on line %d
-NULL
-
-Warning: shm_put_var() expects parameter 1 to be resource, int given in %s004.php on line %d
-NULL
-
-Warning: shm_put_var() expects parameter 1 to be resource, int given in %s004.php on line %d
-NULL
bool(true)
bool(true)
bool(true)
-Warning: shm_put_var(): not enough shared memory left in %s004.php on line 14
+Warning: shm_put_var(): Not enough shared memory left in %s004.php on line %d
bool(false)
Done
diff --git a/ext/sysvshm/tests/005.phpt b/ext/sysvshm/tests/005.phpt
index 0a3d3422e8..0670002700 100644
--- a/ext/sysvshm/tests/005.phpt
+++ b/ext/sysvshm/tests/005.phpt
@@ -17,14 +17,9 @@ shm_put_var($s, 1, array(1,2,3));
shm_put_var($s, 2, false);
shm_put_var($s, 3, null);
-var_dump(shm_get_var());
-
-var_dump(shm_get_var(-1, -1));
-
var_dump(shm_get_var($s, 1000));
var_dump(shm_get_var($s, -10000));
-var_dump(shm_get_var($s, array()));
var_dump(shm_get_var($s, -1));
var_dump(shm_get_var($s, 0));
var_dump(shm_get_var($s, 1));
@@ -41,20 +36,11 @@ shm_remove($s);
echo "Done\n";
?>
--EXPECTF--
-Warning: shm_get_var() expects exactly 2 parameters, 0 given in %s005.php on line %d
-NULL
-
-Warning: shm_get_var() expects parameter 1 to be resource, int given in %s005.php on line %d
-NULL
-
-Warning: shm_get_var(): variable key 1000 doesn't exist in %s005.php on line %d
+Warning: shm_get_var(): Variable key 1000 doesn't exist in %s005.php on line %d
bool(false)
-Warning: shm_get_var(): variable key -10000 doesn't exist in %s005.php on line %d
+Warning: shm_get_var(): Variable key -10000 doesn't exist in %s005.php on line %d
bool(false)
-
-Warning: shm_get_var() expects parameter 2 to be int, array given in %s005.php on line %d
-NULL
string(11) "test string"
object(stdClass)#%d (0) {
}
diff --git a/ext/sysvshm/tests/006.phpt b/ext/sysvshm/tests/006.phpt
index b38aee02a1..a3e38e2c5c 100644
--- a/ext/sysvshm/tests/006.phpt
+++ b/ext/sysvshm/tests/006.phpt
@@ -13,8 +13,6 @@ $s = shm_attach($key, 1024);
shm_put_var($s, 1, "test string");
-var_dump(shm_remove_var());
-var_dump(shm_remove_var(-1, -1));
var_dump(shm_remove_var($s, -10));
var_dump(shm_get_var($s, 1));
@@ -29,23 +27,17 @@ shm_remove($s);
echo "Done\n";
?>
--EXPECTF--
-Warning: shm_remove_var() expects exactly 2 parameters, 0 given in %s006.php on line %d
-NULL
-
-Warning: shm_remove_var() expects parameter 1 to be resource, int given in %s006.php on line %d
-NULL
-
-Warning: shm_remove_var(): variable key -10 doesn't exist in %s006.php on line %d
+Warning: shm_remove_var(): Variable key -10 doesn't exist in %s006.php on line %d
bool(false)
string(11) "test string"
bool(true)
-Warning: shm_get_var(): variable key 1 doesn't exist in %s006.php on line %d
+Warning: shm_get_var(): Variable key 1 doesn't exist in %s006.php on line %d
bool(false)
-Warning: shm_remove_var(): variable key 1 doesn't exist in %s006.php on line %d
+Warning: shm_remove_var(): Variable key 1 doesn't exist in %s006.php on line %d
bool(false)
-Warning: shm_get_var(): variable key 1 doesn't exist in %s006.php on line %d
+Warning: shm_get_var(): Variable key 1 doesn't exist in %s006.php on line %d
bool(false)
Done
diff --git a/ext/sysvshm/tests/007.phpt b/ext/sysvshm/tests/007.phpt
index a165a8bfbf..730e9a3fbd 100644
--- a/ext/sysvshm/tests/007.phpt
+++ b/ext/sysvshm/tests/007.phpt
@@ -11,32 +11,18 @@ if (!function_exists('ftok')){ print 'skip'; }
$key = ftok(__FILE__, 't');
$s = shm_attach($key, 1024);
-var_dump(shm_remove());
-var_dump(shm_remove(-1));
-var_dump(shm_remove(0));
-var_dump(shm_remove(""));
-
var_dump(shm_remove($s));
shm_detach($s);
-var_dump(shm_remove($s));
+try {
+ var_dump(shm_remove($s));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Done\n";
?>
---EXPECTF--
-Warning: shm_remove() expects exactly 1 parameter, 0 given in %s007.php on line %d
-NULL
-
-Warning: shm_remove() expects parameter 1 to be resource, int given in %s007.php on line %d
-NULL
-
-Warning: shm_remove() expects parameter 1 to be resource, int given in %s007.php on line %d
-NULL
-
-Warning: shm_remove() expects parameter 1 to be resource, string given in %s007.php on line %d
-NULL
+--EXPECT--
bool(true)
-
-Warning: shm_remove(): supplied resource is not a valid sysvshm resource in %s007.php on line %d
-bool(false)
+shm_remove(): supplied resource is not a valid sysvshm resource
Done
diff --git a/ext/sysvshm/tests/bug72858.phpt b/ext/sysvshm/tests/bug72858.phpt
index 079c899993..efa72edb5b 100644
--- a/ext/sysvshm/tests/bug72858.phpt
+++ b/ext/sysvshm/tests/bug72858.phpt
@@ -14,7 +14,5 @@ $v2=0xffffffff / 4 + 0x1337;
shm_attach($v1,$v2);
?>
-==DONE==
--EXPECTF--
-Warning: shm_attach(): failed for key 0x64: Not enough space in %s on line %d
-==DONE==
+Warning: shm_attach(): Failed for key 0x64: Not enough space in %s on line %d
diff --git a/ext/tidy/php_tidy.h b/ext/tidy/php_tidy.h
index 3be6bf4388..3318497c98 100644
--- a/ext/tidy/php_tidy.h
+++ b/ext/tidy/php_tidy.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/tidy/tests/002.phpt b/ext/tidy/tests/002.phpt
index c6092c7b94..d276cfabed 100644
--- a/ext/tidy/tests/002.phpt
+++ b/ext/tidy/tests/002.phpt
@@ -4,8 +4,8 @@ tidy_parse_string()
<?php if (!extension_loaded("tidy")) print "skip"; ?>
--FILE--
<?php
- $a = tidy_parse_string("<HTML></HTML>");
- echo tidy_get_output($a);
+ $a = tidy_parse_string("<HTML></HTML>");
+ echo tidy_get_output($a);
?>
--EXPECT--
diff --git a/ext/tidy/tests/003.phpt b/ext/tidy/tests/003.phpt
index df4cd18f5f..43bd6729d7 100644
--- a/ext/tidy/tests/003.phpt
+++ b/ext/tidy/tests/003.phpt
@@ -5,9 +5,9 @@ tidy_clean_repair()
--FILE--
<?php
- $a = tidy_parse_string("<HTML></HTML>");
- tidy_clean_repair($a);
- echo tidy_get_output($a);
+ $a = tidy_parse_string("<HTML></HTML>");
+ tidy_clean_repair($a);
+ echo tidy_get_output($a);
?>
--EXPECTF--
diff --git a/ext/tidy/tests/005-mb.phpt b/ext/tidy/tests/005-mb.phpt
index c7b8e20676..7fc43d9f27 100644
--- a/ext/tidy/tests/005-mb.phpt
+++ b/ext/tidy/tests/005-mb.phpt
@@ -4,8 +4,8 @@ tidy_parse_file()
<?php if (!extension_loaded("tidy")) print "skip"; ?>
--FILE--
<?php
- $a = tidy_parse_file(__DIR__."/005ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.html");
- echo tidy_get_output($a);
+ $a = tidy_parse_file(__DIR__."/005ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.html");
+ echo tidy_get_output($a);
?>
--EXPECT--
diff --git a/ext/tidy/tests/005.phpt b/ext/tidy/tests/005.phpt
index 49b0a2ad4d..88d906e896 100644
--- a/ext/tidy/tests/005.phpt
+++ b/ext/tidy/tests/005.phpt
@@ -4,8 +4,8 @@ tidy_parse_file()
<?php if (!extension_loaded("tidy")) print "skip"; ?>
--FILE--
<?php
- $a = tidy_parse_file(__DIR__."/005.html");
- echo tidy_get_output($a);
+ $a = tidy_parse_file(__DIR__."/005.html");
+ echo tidy_get_output($a);
?>
--EXPECT--
diff --git a/ext/tidy/tests/006.phpt b/ext/tidy/tests/006.phpt
index a36006f346..5ca856075d 100644
--- a/ext/tidy/tests/006.phpt
+++ b/ext/tidy/tests/006.phpt
@@ -4,8 +4,8 @@ Verbose tidy_get_error_buffer()
<?php if (!extension_loaded("tidy")) print "skip"; ?>
--FILE--
<?php
- $a = tidy_parse_string("<HTML><asd asdf></HTML>");
- echo tidy_get_error_buffer($a);
+ $a = tidy_parse_string("<HTML><asd asdf></HTML>");
+ echo tidy_get_error_buffer($a);
?>
--EXPECT--
diff --git a/ext/tidy/tests/007.phpt b/ext/tidy/tests/007.phpt
index bae8918625..127dcdf472 100644
--- a/ext/tidy/tests/007.phpt
+++ b/ext/tidy/tests/007.phpt
@@ -6,16 +6,16 @@ Verbose tidy_getopt()
tidy.default_config=
--FILE--
<?php
- $a = new tidy(__DIR__."/007.html");
- echo "Current Value of 'tidy-mark': ";
- var_dump($a->getopt("tidy-mark"));
- echo "Current Value of 'error-file': ";
- var_dump($a->getopt("error-file"));
- echo "Current Value of 'tab-size': ";
- var_dump($a->getopt("tab-size"));
+ $a = new tidy(__DIR__."/007.html");
+ echo "Current Value of 'tidy-mark': ";
+ var_dump($a->getopt("tidy-mark"));
+ echo "Current Value of 'error-file': ";
+ var_dump($a->getopt("error-file"));
+ echo "Current Value of 'tab-size': ";
+ var_dump($a->getopt("tab-size"));
- var_dump($a->getopt('bogus-opt'));
- var_dump(tidy_getopt($a, 'non-ASCII string àáç'));
+ var_dump($a->getopt('bogus-opt'));
+ var_dump(tidy_getopt($a, 'non-ASCII string àáç'));
?>
--EXPECTF--
Current Value of 'tidy-mark': bool(false)
diff --git a/ext/tidy/tests/008.phpt b/ext/tidy/tests/008.phpt
index 303a2f9d8a..f98f79954e 100644
--- a/ext/tidy/tests/008.phpt
+++ b/ext/tidy/tests/008.phpt
@@ -4,8 +4,8 @@ Accessing the error buffer via $obj->error_buf...
<?php if (!extension_loaded("tidy")) print "skip"; ?>
--FILE--
<?php
- $a = tidy_parse_string("<HTML><asd asdf></HTML>");
- echo $a->errorBuffer;
+ $a = tidy_parse_string("<HTML><asd asdf></HTML>");
+ echo $a->errorBuffer;
?>
--EXPECT--
line 1 column 1 - Warning: missing <!DOCTYPE> declaration
diff --git a/ext/tidy/tests/009.phpt b/ext/tidy/tests/009.phpt
index c2bbfb9760..b3e04d805f 100644
--- a/ext/tidy/tests/009.phpt
+++ b/ext/tidy/tests/009.phpt
@@ -6,7 +6,7 @@ tidy_doc object overloading
<?php
$a = tidy_parse_string("<HTML></HTML>");
- echo $a;
+ echo $a;
?>
--EXPECT--
diff --git a/ext/tidy/tests/011.phpt b/ext/tidy/tests/011.phpt
index 56cb0aa893..f664f69ebf 100644
--- a/ext/tidy/tests/011.phpt
+++ b/ext/tidy/tests/011.phpt
@@ -4,7 +4,7 @@ Accessing attributes of a node
<?php if (!extension_loaded("tidy")) print "skip"; ?>
--FILE--
<?php
- $a = tidy_parse_string("<HTML><BODY BGCOLOR=#FFFFFF ALINK=#000000></BODY></HTML>");
+ $a = tidy_parse_string("<HTML><BODY BGCOLOR=#FFFFFF ALINK=#000000></BODY></HTML>");
$body = $a->body();
var_dump($body->attribute);
foreach($body->attribute as $key=>$val) {
diff --git a/ext/tidy/tests/012.phpt b/ext/tidy/tests/012.phpt
index eae6eca44c..0cfa3ef8c6 100644
--- a/ext/tidy/tests/012.phpt
+++ b/ext/tidy/tests/012.phpt
@@ -25,7 +25,7 @@ Accessing children nodes
}
- $a = tidy_parse_string("<HTML><BODY BGCOLOR=#FFFFFF ALINK=#000000><B>Hi</B><I>Bye<U>Test</U></I></BODY></HTML>", array('newline' => 'LF'));
+ $a = tidy_parse_string("<HTML><BODY BGCOLOR=#FFFFFF ALINK=#000000><B>Hi</B><I>Bye<U>Test</U></I></BODY></HTML>", array('newline' => 'LF'));
$html = $a->html();
dump_nodes($html);
diff --git a/ext/tidy/tests/014.phpt b/ext/tidy/tests/014.phpt
index fd0d55b1fb..70f85eae37 100644
--- a/ext/tidy/tests/014.phpt
+++ b/ext/tidy/tests/014.phpt
@@ -5,9 +5,9 @@ Passing configuration options through tidy_parse_string().
--FILE--
<?php
$text = "<B>testing</I>";
- $tidy = tidy_parse_string($text, array('show-body-only'=>true));
- tidy_clean_repair($tidy);
- echo tidy_get_output($tidy);
+ $tidy = tidy_parse_string($text, array('show-body-only'=>true));
+ tidy_clean_repair($tidy);
+ echo tidy_get_output($tidy);
?>
--EXPECT--
diff --git a/ext/tidy/tests/015.phpt b/ext/tidy/tests/015.phpt
index c5bc1dc4d3..ca00b5cb4d 100644
--- a/ext/tidy/tests/015.phpt
+++ b/ext/tidy/tests/015.phpt
@@ -5,8 +5,8 @@ Passing configuration options through tidy_parse_file().
--FILE--
<?php
$tidy = tidy_parse_file(__DIR__."/015.html", array('show-body-only'=>true));
- tidy_clean_repair($tidy);
- echo tidy_get_output($tidy);
+ tidy_clean_repair($tidy);
+ echo tidy_get_output($tidy);
?>
--EXPECT--
diff --git a/ext/tidy/tests/018.phpt b/ext/tidy/tests/018.phpt
index d2f1d1e0f3..761257e720 100644
--- a/ext/tidy/tests/018.phpt
+++ b/ext/tidy/tests/018.phpt
@@ -5,10 +5,10 @@ binary safety
--FILE--
<?php
$x = tidy_repair_string("<p>abra\0cadabra</p>",
- array( 'show-body-only' => true,
- 'clean' => false,
- 'newline' => "\n")
- );
+ array( 'show-body-only' => true,
+ 'clean' => false,
+ 'newline' => "\n")
+ );
var_dump($x);
?>
--EXPECT--
diff --git a/ext/tidy/tests/019.phpt b/ext/tidy/tests/019.phpt
index 188b8cd4e9..425b42889d 100644
--- a/ext/tidy/tests/019.phpt
+++ b/ext/tidy/tests/019.phpt
@@ -7,17 +7,14 @@ tidy_repair_*() and invalid parameters
$l = 1;
$s = "";
-$a = array();
-tidy_repair_string($s, $l, $l, $l);
-tidy_repair_string($s, $s, $s, $s);
-tidy_repair_string($l, $l, $l ,$l);
-tidy_repair_string($a, $a, $a, $a);
+tidy_repair_string($s, $l, $l);
+tidy_repair_string($s, $s, $s);
+tidy_repair_string($l, $l, $l);
tidy_repair_file($s, $l, $l, $l);
tidy_repair_file($s, $s, $s, $s);
tidy_repair_file($l, $l, $l ,$l);
-tidy_repair_file($a, $a, $a, $a);
echo "Done\n";
?>
@@ -32,11 +29,7 @@ Warning: tidy_repair_string(): Could not load configuration file '1' in %s on li
Warning: tidy_repair_string(): Could not set encoding '1' in %s on line %d
-Warning: tidy_repair_string() expects parameter 1 to be string, array given in %s on line %d
-
Warning: tidy_repair_file(): Filename cannot be empty in %s on line %d
Warning: tidy_repair_file(): Filename cannot be empty in %s on line %d
-
-Warning: tidy_repair_file() expects parameter 1 to be a valid path, array given in %s on line %d
Done
diff --git a/ext/tidy/tests/029.phpt b/ext/tidy/tests/029.phpt
index e46181f005..f28f52fba8 100644
--- a/ext/tidy/tests/029.phpt
+++ b/ext/tidy/tests/029.phpt
@@ -8,16 +8,16 @@ tidy_get_body() crash
// bug report taken from http://news.php.net/php.notes/130628
$inputs = array(
- '<frameset > </frameset>',
- '<html><frameset> </frameset> </html',
+ '<frameset > </frameset>',
+ '<html><frameset> </frameset> </html',
);
foreach ($inputs as $input) {
- $t = tidy_parse_string($input);
- $t->cleanRepair();
- var_dump(tidy_get_body($t));
+ $t = tidy_parse_string($input);
+ $t->cleanRepair();
+ var_dump(tidy_get_body($t));
}
echo "Done\n";
diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c
index 295ca8d8f0..252b97ffb4 100644
--- a/ext/tidy/tidy.c
+++ b/ext/tidy/tidy.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -40,6 +38,8 @@
#include "buffio.h"
#endif
+#include "tidy_arginfo.h"
+
/* compatibility with older versions of libtidy */
#ifndef TIDY_CALL
#define TIDY_CALL
@@ -54,15 +54,9 @@
#define TIDY_FETCH_OBJECT \
PHPTidyObj *obj; \
- TIDY_SET_CONTEXT; \
- if (object) { \
- if (zend_parse_parameters_none() == FAILURE) { \
- return; \
- } \
- } else { \
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), NULL, "O", &object, tidy_ce_doc) == FAILURE) { \
- RETURN_FALSE; \
- } \
+ zval *object; \
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &object, tidy_ce_doc) == FAILURE) { \
+ RETURN_THROWS(); \
} \
obj = Z_TIDY_P(object); \
@@ -70,7 +64,7 @@
PHPTidyObj *obj; \
TIDY_SET_CONTEXT; \
if (zend_parse_parameters_none() == FAILURE) { \
- return; \
+ RETURN_THROWS(); \
} \
obj = Z_TIDY_P(object); \
@@ -215,8 +209,8 @@ static void tidy_object_free_storage(zend_object *);
static zend_object *tidy_object_new_node(zend_class_entry *);
static zend_object *tidy_object_new_doc(zend_class_entry *);
static zval * tidy_instanciate(zend_class_entry *, zval *);
-static int tidy_doc_cast_handler(zval *, zval *, int);
-static int tidy_node_cast_handler(zval *, zval *, int);
+static int tidy_doc_cast_handler(zend_object *, zval *, int);
+static int tidy_node_cast_handler(zend_object *, zval *, int);
static void tidy_doc_update_properties(PHPTidyObj *);
static void tidy_add_default_properties(PHPTidyObj *, tidy_obj_type);
static void *php_tidy_get_opt_val(PHPTidyDoc *, TidyOption, TidyOptionType *);
@@ -286,132 +280,6 @@ STD_PHP_INI_ENTRY("tidy.default_config", "", PHP_INI_SYSTEM, OnUpdateString,
STD_PHP_INI_ENTRY("tidy.clean_output", "0", PHP_INI_USER, php_tidy_set_clean_output, clean_output, zend_tidy_globals, tidy_globals)
PHP_INI_END()
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_parse_string, 0, 0, 1)
- ZEND_ARG_INFO(0, input)
- ZEND_ARG_INFO(0, config_options)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_get_error_buffer, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_get_output, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_parse_file, 0, 0, 1)
- ZEND_ARG_INFO(0, file)
- ZEND_ARG_INFO(0, config_options)
- ZEND_ARG_INFO(0, encoding)
- ZEND_ARG_INFO(0, use_include_path)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_clean_repair, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_repair_string, 0, 0, 1)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, config_file)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_repair_file, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, config_file)
- ZEND_ARG_INFO(0, encoding)
- ZEND_ARG_INFO(0, use_include_path)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_diagnose, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_tidy_get_release, 0)
-ZEND_END_ARG_INFO()
-
-#if HAVE_TIDYOPTGETDOC
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_get_opt_doc, 0, 0, 2)
- ZEND_ARG_INFO(0, resource)
- ZEND_ARG_INFO(0, optname)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_get_opt_doc_method, 0, 0, 1)
- ZEND_ARG_INFO(0, optname)
-ZEND_END_ARG_INFO()
-#endif
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_get_config, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_get_status, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_get_html_ver, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_is_xhtml, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_is_xml, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_error_count, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_warning_count, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_access_count, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_config_count, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_getopt_method, 0, 0, 1)
- ZEND_ARG_INFO(0, option)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_getopt, 0, 0, 2)
- ZEND_ARG_INFO(0, object)
- ZEND_ARG_INFO(0, option)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_get_root, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_get_html, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_get_head, 0, 0, 1)
- ZEND_ARG_INFO(0, object)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_get_body, 0, 0, 1)
- ZEND_ARG_INFO(0, tidy)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_tidy_construct, 0, 0, 0)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, config_file)
- ZEND_ARG_INFO(0, encoding)
- ZEND_ARG_INFO(0, use_include_path)
-ZEND_END_ARG_INFO()
-/* }}} */
-
static const zend_function_entry tidy_functions[] = {
PHP_FE(tidy_getopt, arginfo_tidy_getopt)
PHP_FE(tidy_parse_string, arginfo_tidy_parse_string)
@@ -443,41 +311,41 @@ static const zend_function_entry tidy_functions[] = {
};
static const zend_function_entry tidy_funcs_doc[] = {
- TIDY_METHOD_MAP(getOpt, tidy_getopt, arginfo_tidy_getopt_method)
- TIDY_METHOD_MAP(cleanRepair, tidy_clean_repair, NULL)
- TIDY_DOC_ME(parseFile, arginfo_tidy_parse_file)
- TIDY_DOC_ME(parseString, arginfo_tidy_parse_string)
- TIDY_METHOD_MAP(repairString, tidy_repair_string, arginfo_tidy_repair_string)
- TIDY_METHOD_MAP(repairFile, tidy_repair_file, arginfo_tidy_repair_file)
- TIDY_METHOD_MAP(diagnose, tidy_diagnose, NULL)
- TIDY_METHOD_MAP(getRelease, tidy_get_release, NULL)
- TIDY_METHOD_MAP(getConfig, tidy_get_config, NULL)
- TIDY_METHOD_MAP(getStatus, tidy_get_status, NULL)
- TIDY_METHOD_MAP(getHtmlVer, tidy_get_html_ver, NULL)
+ TIDY_METHOD_MAP(getOpt, tidy_getopt, arginfo_class_tidy_getOpt)
+ TIDY_METHOD_MAP(cleanRepair, tidy_clean_repair, arginfo_class_tidy_cleanRepair)
+ TIDY_DOC_ME(parseFile, arginfo_class_tidy_parseFile)
+ TIDY_DOC_ME(parseString, arginfo_class_tidy_parseString)
+ TIDY_METHOD_MAP(repairString, tidy_repair_string, arginfo_class_tidy_repairString)
+ TIDY_METHOD_MAP(repairFile, tidy_repair_file, arginfo_class_tidy_repairFile)
+ TIDY_METHOD_MAP(diagnose, tidy_diagnose, arginfo_class_tidy_diagnose)
+ TIDY_METHOD_MAP(getRelease, tidy_get_release, arginfo_class_tidy_getRelease)
+ TIDY_METHOD_MAP(getConfig, tidy_get_config, arginfo_class_tidy_getConfig)
+ TIDY_METHOD_MAP(getStatus, tidy_get_status, arginfo_class_tidy_getStatus)
+ TIDY_METHOD_MAP(getHtmlVer, tidy_get_html_ver, arginfo_class_tidy_getHtmlVer)
#if HAVE_TIDYOPTGETDOC
- TIDY_METHOD_MAP(getOptDoc, tidy_get_opt_doc, arginfo_tidy_get_opt_doc_method)
+ TIDY_METHOD_MAP(getOptDoc, tidy_get_opt_doc, arginfo_class_tidy_getOptDoc)
#endif
- TIDY_METHOD_MAP(isXhtml, tidy_is_xhtml, NULL)
- TIDY_METHOD_MAP(isXml, tidy_is_xml, NULL)
- TIDY_METHOD_MAP(root, tidy_get_root, NULL)
- TIDY_METHOD_MAP(head, tidy_get_head, NULL)
- TIDY_METHOD_MAP(html, tidy_get_html, NULL)
- TIDY_METHOD_MAP(body, tidy_get_body, NULL)
- TIDY_DOC_ME(__construct, arginfo_tidy_construct)
+ TIDY_METHOD_MAP(isXhtml, tidy_is_xhtml, arginfo_class_tidy_isXhtml)
+ TIDY_METHOD_MAP(isXml, tidy_is_xml, arginfo_class_tidy_isXml)
+ TIDY_METHOD_MAP(root, tidy_get_root, arginfo_class_tidy_root)
+ TIDY_METHOD_MAP(head, tidy_get_head, arginfo_class_tidy_head)
+ TIDY_METHOD_MAP(html, tidy_get_html, arginfo_class_tidy_html)
+ TIDY_METHOD_MAP(body, tidy_get_body, arginfo_class_tidy_body)
+ TIDY_DOC_ME(__construct, arginfo_class_tidy___construct)
PHP_FE_END
};
static const zend_function_entry tidy_funcs_node[] = {
- TIDY_NODE_ME(hasChildren, NULL)
- TIDY_NODE_ME(hasSiblings, NULL)
- TIDY_NODE_ME(isComment, NULL)
- TIDY_NODE_ME(isHtml, NULL)
- TIDY_NODE_ME(isText, NULL)
- TIDY_NODE_ME(isJste, NULL)
- TIDY_NODE_ME(isAsp, NULL)
- TIDY_NODE_ME(isPhp, NULL)
- TIDY_NODE_ME(getParent, NULL)
- TIDY_NODE_PRIVATE_ME(__construct, NULL)
+ TIDY_NODE_ME(hasChildren, arginfo_class_tidyNode_hasChildren)
+ TIDY_NODE_ME(hasSiblings, arginfo_class_tidyNode_hasSiblings)
+ TIDY_NODE_ME(isComment, arginfo_class_tidyNode_isComment)
+ TIDY_NODE_ME(isHtml, arginfo_class_tidyNode_isHtml)
+ TIDY_NODE_ME(isText, arginfo_class_tidyNode_isText)
+ TIDY_NODE_ME(isJste, arginfo_class_tidyNode_isJste)
+ TIDY_NODE_ME(isAsp, arginfo_class_tidyNode_isAsp)
+ TIDY_NODE_ME(isPhp, arginfo_class_tidyNode_isPhp)
+ TIDY_NODE_ME(getParent, arginfo_class_tidyNode_getParent)
+ TIDY_NODE_PRIVATE_ME(__construct, arginfo_class_tidyNode___construct)
PHP_FE_END
};
@@ -582,22 +450,23 @@ static void php_tidy_quick_repair(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_fil
{
char *enc = NULL;
size_t enc_len = 0;
- zend_bool use_include_path = 0;
TidyDoc doc;
TidyBuffer *errbuf;
zend_string *data, *arg1;
zval *config = NULL;
if (is_file) {
+ zend_bool use_include_path = 0;
+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "P|zsb", &arg1, &config, &enc, &enc_len, &use_include_path) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (!(data = php_tidy_file_to_mem(ZSTR_VAL(arg1), use_include_path))) {
RETURN_FALSE;
}
} else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|zsb", &arg1, &config, &enc, &enc_len, &use_include_path) == FAILURE) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|zs", &arg1, &config, &enc, &enc_len) == FAILURE) {
+ RETURN_THROWS();
}
data = arg1;
}
@@ -760,7 +629,7 @@ static zval * tidy_instanciate(zend_class_entry *pce, zval *object)
return object;
}
-static int tidy_doc_cast_handler(zval *in, zval *out, int type)
+static int tidy_doc_cast_handler(zend_object *in, zval *out, int type)
{
TidyBuffer output;
PHPTidyObj *obj;
@@ -780,7 +649,7 @@ static int tidy_doc_cast_handler(zval *in, zval *out, int type)
break;
case IS_STRING:
- obj = Z_TIDY_P(in);
+ obj = php_tidy_fetch_object(in);
tidyBufInit(&output);
tidySaveBuffer (obj->ptdoc->doc, &output);
if (output.size) {
@@ -798,7 +667,7 @@ static int tidy_doc_cast_handler(zval *in, zval *out, int type)
return SUCCESS;
}
-static int tidy_node_cast_handler(zval *in, zval *out, int type)
+static int tidy_node_cast_handler(zend_object *in, zval *out, int type)
{
TidyBuffer buf;
PHPTidyObj *obj;
@@ -818,7 +687,7 @@ static int tidy_node_cast_handler(zval *in, zval *out, int type)
break;
case IS_STRING:
- obj = Z_TIDY_P(in);
+ obj = php_tidy_fetch_object(in);
tidyBufInit(&buf);
if (obj->ptdoc) {
tidyNodeGetText(obj->ptdoc->doc, obj->node, &buf);
@@ -1239,7 +1108,7 @@ static PHP_FUNCTION(tidy_parse_string)
PHPTidyObj *obj;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|zs", &input, &options, &enc, &enc_len) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (ZEND_SIZE_T_UINT_OVFL(ZSTR_LEN(input))) {
@@ -1302,7 +1171,7 @@ static PHP_FUNCTION(tidy_parse_file)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "P|zsb", &inputfile,
&options, &enc, &enc_len, &use_include_path) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
tidy_instanciate(tidy_ce_doc, return_value);
@@ -1380,7 +1249,7 @@ static PHP_FUNCTION(tidy_diagnose)
static PHP_FUNCTION(tidy_get_release)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
#if HAVE_TIDYRELEASEDATE
@@ -1401,17 +1270,10 @@ static PHP_FUNCTION(tidy_get_opt_doc)
char *optval, *optname;
size_t optname_len;
TidyOption opt;
+ zval *object;
- TIDY_SET_CONTEXT;
-
- if (object) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &optname, &optname_len) == FAILURE) {
- RETURN_FALSE;
- }
- } else {
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), NULL, "Os", &object, tidy_ce_doc, &optname, &optname_len) == FAILURE) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os", &object, tidy_ce_doc, &optname, &optname_len) == FAILURE) {
+ RETURN_THROWS();
}
obj = Z_TIDY_P(object);
@@ -1562,17 +1424,10 @@ static PHP_FUNCTION(tidy_getopt)
size_t optname_len;
TidyOption opt;
TidyOptionType optt;
+ zval *object;
- TIDY_SET_CONTEXT;
-
- if (object) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &optname, &optname_len) == FAILURE) {
- RETURN_FALSE;
- }
- } else {
- if (zend_parse_method_parameters(ZEND_NUM_ARGS(), NULL, "Os", &object, tidy_ce_doc, &optname, &optname_len) == FAILURE) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os", &object, tidy_ce_doc, &optname, &optname_len) == FAILURE) {
+ RETURN_THROWS();
}
obj = Z_TIDY_P(object);
@@ -1624,7 +1479,7 @@ static TIDY_DOC_METHOD(__construct)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|Pzsb", &inputfile,
&options, &enc, &enc_len, &use_include_path) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
obj = Z_TIDY_P(object);
@@ -1663,7 +1518,7 @@ static TIDY_DOC_METHOD(parseFile)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "P|zsb", &inputfile,
&options, &enc, &enc_len, &use_include_path) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (!(contents = php_tidy_file_to_mem(ZSTR_VAL(inputfile), use_include_path))) {
@@ -1698,7 +1553,7 @@ static TIDY_DOC_METHOD(parseString)
TIDY_SET_CONTEXT;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|zs", &input, &options, &enc, &enc_len) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (ZEND_SIZE_T_UINT_OVFL(ZSTR_LEN(input))) {
diff --git a/ext/tidy/tidy.stub.php b/ext/tidy/tidy.stub.php
new file mode 100644
index 0000000000..423fecb090
--- /dev/null
+++ b/ext/tidy/tidy.stub.php
@@ -0,0 +1,128 @@
+<?php
+
+/** @param array|string $config_options */
+function tidy_parse_string(string $input, $config_options = UNKNOWN, string $encoding = UNKNOWN): tidy|false {}
+
+function tidy_get_error_buffer(tidy $object): string|false {}
+
+function tidy_get_output(tidy $object): string {}
+
+/** @param array|string $config_options */
+function tidy_parse_file(string $file, $config_options = UNKNOWN, string $encoding = UNKNOWN, bool $use_include_path = false): tidy|false {}
+
+function tidy_clean_repair(tidy $object): bool {}
+
+/** @param array|string $config_options */
+function tidy_repair_string(string $data, $config_options = UNKNOWN, string $encoding = UNKNOWN): string|false {}
+
+/** @param array|string $config_options */
+function tidy_repair_file(string $filename, $config_options = UNKNOWN, string $encoding = UNKNOWN, bool $use_include_path = false): string|false {}
+
+function tidy_diagnose(tidy $object): bool {}
+
+function tidy_get_release(): string {}
+
+#if HAVE_TIDYOPTGETDOC
+function tidy_get_opt_doc(tidy $object, string $optname): string|false {}
+#endif
+
+function tidy_get_config(tidy $object): array {}
+
+function tidy_get_status(tidy $object): int {}
+
+function tidy_get_html_ver(tidy $object): int {}
+
+function tidy_is_xhtml(tidy $object): bool {}
+
+function tidy_is_xml(tidy $object): bool {}
+
+function tidy_error_count(tidy $object): int {}
+
+function tidy_warning_count(tidy $object): int {}
+
+function tidy_access_count(tidy $object): int {}
+
+function tidy_config_count(tidy $object): int {}
+
+function tidy_getopt(tidy $object, string $option): string|int|bool {}
+
+function tidy_get_root(tidy $object): ?tidyNode {}
+
+function tidy_get_html(tidy $object): ?tidyNode {}
+
+function tidy_get_head(tidy $object): ?tidyNode {}
+
+function tidy_get_body(tidy $tidy): ?tidyNode {}
+
+class tidy
+{
+ /** @param array|string $config_options */
+ public function __construct(string $filename = UNKNOWN, $config_options = UNKNOWN, string $encoding = UNKNOWN, bool $use_include_path = false) {}
+
+ /** @return string|int|bool */
+ public function getOpt(string $option) {}
+
+ public function cleanRepair(): bool {}
+
+ /** @param array|string $config_options */
+ public function parseFile(string $file, $config_options = UNKNOWN, string $encoding = UNKNOWN, bool $use_include_path = false): bool {}
+
+ /** @param array|string $config_options */
+ public function parseString(string $input, $config_options = UNKNOWN, string $encoding = UNKNOWN): bool {}
+
+ /** @param array|string $config_options */
+ public function repairString(string $data, $config_options = UNKNOWN, string $encoding = UNKNOWN): bool {}
+
+ /** @param array|string $config_options */
+ public function repairFile(string $filename, $config_options = UNKNOWN, string $encoding = UNKNOWN, bool $use_include_path = false): bool {}
+
+ public function diagnose(): bool {}
+
+ public function getRelease(): string {}
+
+ public function getConfig(): array {}
+
+ public function getStatus(): int {}
+
+ public function getHtmlVer(): int {}
+
+#if HAVE_TIDYOPTGETDOC
+ /** @return string|false */
+ public function getOptDoc(string $optname) {}
+#endif
+
+ public function isXhtml(): bool {}
+
+ public function isXml(): bool {}
+
+ public function root(): ?tidyNode {}
+
+ public function head(): ?tidyNode {}
+
+ public function html(): ?tidyNode {}
+
+ public function body(): ?tidyNode {}
+}
+
+class tidyNode
+{
+ private function __construct() {}
+
+ public function hasChildren(): bool {}
+
+ public function hasSiblings(): bool {}
+
+ public function isComment(): bool {}
+
+ public function isHtml(): bool {}
+
+ public function isText(): bool {}
+
+ public function isJste(): bool {}
+
+ public function isAsp(): bool {}
+
+ public function isPhp(): bool {}
+
+ public function getParent(): ?tidyNode {}
+}
diff --git a/ext/tidy/tidy_arginfo.h b/ext/tidy/tidy_arginfo.h
new file mode 100644
index 0000000000..7c2d8148d5
--- /dev/null
+++ b/ext/tidy/tidy_arginfo.h
@@ -0,0 +1,182 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_tidy_parse_string, 0, 1, tidy, MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, input, IS_STRING, 0)
+ ZEND_ARG_INFO(0, config_options)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_tidy_get_error_buffer, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, object, tidy, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_tidy_get_output, 0, 1, IS_STRING, 0)
+ ZEND_ARG_OBJ_INFO(0, object, tidy, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_tidy_parse_file, 0, 1, tidy, MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, file, IS_STRING, 0)
+ ZEND_ARG_INFO(0, config_options)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, use_include_path, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_tidy_clean_repair, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, object, tidy, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_tidy_repair_string, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ ZEND_ARG_INFO(0, config_options)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_tidy_repair_file, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_INFO(0, config_options)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, use_include_path, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_tidy_diagnose arginfo_tidy_clean_repair
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_tidy_get_release, 0, 0, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#if HAVE_TIDYOPTGETDOC
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_tidy_get_opt_doc, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_OBJ_INFO(0, object, tidy, 0)
+ ZEND_ARG_TYPE_INFO(0, optname, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_tidy_get_config, 0, 1, IS_ARRAY, 0)
+ ZEND_ARG_OBJ_INFO(0, object, tidy, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_tidy_get_status, 0, 1, IS_LONG, 0)
+ ZEND_ARG_OBJ_INFO(0, object, tidy, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_tidy_get_html_ver arginfo_tidy_get_status
+
+#define arginfo_tidy_is_xhtml arginfo_tidy_clean_repair
+
+#define arginfo_tidy_is_xml arginfo_tidy_clean_repair
+
+#define arginfo_tidy_error_count arginfo_tidy_get_status
+
+#define arginfo_tidy_warning_count arginfo_tidy_get_status
+
+#define arginfo_tidy_access_count arginfo_tidy_get_status
+
+#define arginfo_tidy_config_count arginfo_tidy_get_status
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_tidy_getopt, 0, 2, MAY_BE_STRING|MAY_BE_LONG|MAY_BE_BOOL)
+ ZEND_ARG_OBJ_INFO(0, object, tidy, 0)
+ ZEND_ARG_TYPE_INFO(0, option, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_tidy_get_root, 0, 1, tidyNode, 1)
+ ZEND_ARG_OBJ_INFO(0, object, tidy, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_tidy_get_html arginfo_tidy_get_root
+
+#define arginfo_tidy_get_head arginfo_tidy_get_root
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_tidy_get_body, 0, 1, tidyNode, 1)
+ ZEND_ARG_OBJ_INFO(0, tidy, tidy, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_tidy___construct, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_INFO(0, config_options)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, use_include_path, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_tidy_getOpt, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, option, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_tidy_cleanRepair, 0, 0, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_tidy_parseFile, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, file, IS_STRING, 0)
+ ZEND_ARG_INFO(0, config_options)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, use_include_path, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_tidy_parseString, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, input, IS_STRING, 0)
+ ZEND_ARG_INFO(0, config_options)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_tidy_repairString, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ ZEND_ARG_INFO(0, config_options)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_tidy_repairFile, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_INFO(0, config_options)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, use_include_path, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_tidy_diagnose arginfo_class_tidy_cleanRepair
+
+#define arginfo_class_tidy_getRelease arginfo_tidy_get_release
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_tidy_getConfig, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_tidy_getStatus, 0, 0, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_tidy_getHtmlVer arginfo_class_tidy_getStatus
+
+#if HAVE_TIDYOPTGETDOC
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_tidy_getOptDoc, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, optname, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#define arginfo_class_tidy_isXhtml arginfo_class_tidy_cleanRepair
+
+#define arginfo_class_tidy_isXml arginfo_class_tidy_cleanRepair
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_tidy_root, 0, 0, tidyNode, 1)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_tidy_head arginfo_class_tidy_root
+
+#define arginfo_class_tidy_html arginfo_class_tidy_root
+
+#define arginfo_class_tidy_body arginfo_class_tidy_root
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_tidyNode___construct, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_tidyNode_hasChildren arginfo_class_tidy_cleanRepair
+
+#define arginfo_class_tidyNode_hasSiblings arginfo_class_tidy_cleanRepair
+
+#define arginfo_class_tidyNode_isComment arginfo_class_tidy_cleanRepair
+
+#define arginfo_class_tidyNode_isHtml arginfo_class_tidy_cleanRepair
+
+#define arginfo_class_tidyNode_isText arginfo_class_tidy_cleanRepair
+
+#define arginfo_class_tidyNode_isJste arginfo_class_tidy_cleanRepair
+
+#define arginfo_class_tidyNode_isAsp arginfo_class_tidy_cleanRepair
+
+#define arginfo_class_tidyNode_isPhp arginfo_class_tidy_cleanRepair
+
+#define arginfo_class_tidyNode_getParent arginfo_class_tidy_root
diff --git a/ext/tokenizer/php_tokenizer.h b/ext/tokenizer/php_tokenizer.h
index f6b431d038..32a6203276 100644
--- a/ext/tokenizer/php_tokenizer.h
+++ b/ext/tokenizer/php_tokenizer.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/tokenizer/tests/001.phpt b/ext/tokenizer/tests/001.phpt
index 4c6295cdf8..8e58c81891 100644
--- a/ext/tokenizer/tests/001.phpt
+++ b/ext/tokenizer/tests/001.phpt
@@ -126,8 +126,6 @@ echo token_name(T_HALT_COMPILER), "\n";
echo token_name(-1), "\n";
echo token_name(0x8000000F), "\n";
-echo token_name("string"), "\n";
-echo token_name(array()), "\n";
echo "Done\n";
?>
@@ -251,10 +249,4 @@ T_CLONE
T_HALT_COMPILER
UNKNOWN
UNKNOWN
-
-Warning: token_name() expects parameter 1 to be int, string given in %s on line %d
-
-
-Warning: token_name() expects parameter 1 to be int, array given in %s on line %d
-
Done
diff --git a/ext/tokenizer/tests/002.phpt b/ext/tokenizer/tests/002.phpt
index 11b6d9f78e..e711023eef 100644
--- a/ext/tokenizer/tests/002.phpt
+++ b/ext/tokenizer/tests/002.phpt
@@ -6,15 +6,15 @@ token_get_all()
<?php
$strings = array(
- '<?php echo 1; if (isset($a)) print $a+1; $a++; $a--; $a == 2; $a === 2; endif; ?>',
- '<?php switch($a) { case 1: break; default: break; } while($a) { exit; } ?>',
- '<?php /* comment */ if (1 || 2) { } $a = 2 | 1; $b = 3^2; $c = 4&2; ?>',
- /* feel free to add more yourself */
- 'wrong syntax here'
+ '<?php echo 1; if (isset($a)) print $a+1; $a++; $a--; $a == 2; $a === 2; endif; ?>',
+ '<?php switch($a) { case 1: break; default: break; } while($a) { exit; } ?>',
+ '<?php /* comment */ if (1 || 2) { } $a = 2 | 1; $b = 3^2; $c = 4&2; ?>',
+ /* feel free to add more yourself */
+ 'wrong syntax here'
);
foreach ($strings as $s) {
- var_dump(token_get_all($s));
+ var_dump(token_get_all($s));
}
echo "Done\n";
diff --git a/ext/tokenizer/tests/003.phpt b/ext/tokenizer/tests/003.phpt
index 3ba6d594df..6c3cc4c559 100644
--- a/ext/tokenizer/tests/003.phpt
+++ b/ext/tokenizer/tests/003.phpt
@@ -5,8 +5,6 @@ token_get_all() and wrong parameters
--FILE--
<?php
-var_dump(token_get_all(array()));
-var_dump(token_get_all(new stdClass));
var_dump(token_get_all(""));
var_dump(token_get_all(0));
var_dump(token_get_all(-1));
@@ -14,11 +12,6 @@ var_dump(token_get_all(-1));
echo "Done\n";
?>
--EXPECTF--
-Warning: token_get_all() expects parameter 1 to be string, array given in %s on line %d
-NULL
-
-Warning: token_get_all() expects parameter 1 to be string, object given in %s on line %d
-NULL
array(0) {
}
array(1) {
diff --git a/ext/tokenizer/tests/bad_character.phpt b/ext/tokenizer/tests/bad_character.phpt
index 87f0179004..5456530ca3 100644
--- a/ext/tokenizer/tests/bad_character.phpt
+++ b/ext/tokenizer/tests/bad_character.phpt
@@ -19,27 +19,21 @@ foreach ($codes as $code) {
echo $token, "\n";
}
}
+ echo "\n";
}
?>
---EXPECTF--
-Warning: Unexpected character in input: ' in %s on line %d
+--EXPECT--
T_OPEN_TAG 6
T_BAD_CHARACTER 1
T_WHITESPACE 1
T_STRING 3
-Warning: Unexpected character in input: '%s' (ASCII=1) state=0 in %s on line %d
T_OPEN_TAG 6
T_BAD_CHARACTER 1
T_WHITESPACE 1
T_STRING 3
-Warning: Unexpected character in input: '%s' (ASCII=1) state=0 in %s on line %d
-
-Warning: Unexpected character in input: '%s' (ASCII=2) state=0 in %s on line %d
-
-Warning: Unexpected character in input: '%s' (ASCII=3) state=0 in %s on line %d
T_OPEN_TAG 6
T_BAD_CHARACTER 1
T_BAD_CHARACTER 1
diff --git a/ext/tokenizer/tests/bug54089.phpt b/ext/tokenizer/tests/bug54089.phpt
index ff461ecb78..d3dc834616 100644
--- a/ext/tokenizer/tests/bug54089.phpt
+++ b/ext/tokenizer/tests/bug54089.phpt
@@ -5,23 +5,23 @@ Bug #54089 (token_get_all() does not stop after __halt_compiler)
--FILE--
<?php
$codes = array(
- "<?php __halt_compiler",
- "<?php __halt_compiler(",
- "<?php __halt_compiler();",
- "<?php __halt_compiler();ABC",
- "<?php __halt_compiler\n(\n)\n;ABC",
- "<?php __halt_compiler\nabc\ndef\nghi ABC",
+ "<?php __halt_compiler",
+ "<?php __halt_compiler(",
+ "<?php __halt_compiler();",
+ "<?php __halt_compiler();ABC",
+ "<?php __halt_compiler\n(\n)\n;ABC",
+ "<?php __halt_compiler\nabc\ndef\nghi ABC",
);
foreach ($codes as $code) {
- $tokens = token_get_all($code);
- var_dump($tokens);
+ $tokens = token_get_all($code);
+ var_dump($tokens);
- $code = '';
- foreach ($tokens as $t)
- {
- $code .= isset($t[1]) ? $t[1] : $t;
- }
- var_dump($code);
+ $code = '';
+ foreach ($tokens as $t)
+ {
+ $code .= isset($t[1]) ? $t[1] : $t;
+ }
+ var_dump($code);
}
?>
diff --git a/ext/tokenizer/tests/token_get_all_basic.phpt b/ext/tokenizer/tests/token_get_all_basic.phpt
index 7d3b4ff4e7..f9bc28c6f2 100644
--- a/ext/tokenizer/tests/token_get_all_basic.phpt
+++ b/ext/tokenizer/tests/token_get_all_basic.phpt
@@ -5,7 +5,7 @@ Test token_get_all() function : basic functionality
--FILE--
<?php
/* Prototype : array token_get_all(string $source)
- * Description : splits the given source into an array of PHP languange tokens
+ * Description : splits the given source into an array of PHP language tokens
* Source code: ext/tokenizer/tokenizer.c
*/
diff --git a/ext/tokenizer/tests/token_get_all_variation10.phpt b/ext/tokenizer/tests/token_get_all_variation10.phpt
index af2e413d38..e81643fd61 100644
--- a/ext/tokenizer/tests/token_get_all_variation10.phpt
+++ b/ext/tokenizer/tests/token_get_all_variation10.phpt
@@ -5,7 +5,7 @@ Test token_get_all() function : usage variations - with constant tokens
--FILE--
<?php
/* Prototype : array token_get_all(string $source)
- * Description: splits the given source into an array of PHP languange tokens
+ * Description: splits the given source into an array of PHP language tokens
* Source code: ext/tokenizer/tokenizer.c
*/
diff --git a/ext/tokenizer/tests/token_get_all_variation11.phpt b/ext/tokenizer/tests/token_get_all_variation11.phpt
index 146e433e12..3a22a194b7 100644
--- a/ext/tokenizer/tests/token_get_all_variation11.phpt
+++ b/ext/tokenizer/tests/token_get_all_variation11.phpt
@@ -5,7 +5,7 @@ Test token_get_all() function : usage variations - with control structure tokens
--FILE--
<?php
/* Prototype : array token_get_all(string $source)
- * Description: splits the given source into an array of PHP languange tokens
+ * Description: splits the given source into an array of PHP language tokens
* Source code: ext/tokenizer/tokenizer.c
*/
@@ -26,7 +26,7 @@ echo "*** Testing token_get_all() : for control structure tokens ***\n";
// if..elseif....else
echo "-- with if..elseif..else..tokens --\n";
-$source = '<?php
+$source = '<?php
if($a == true) {
echo "$a = true";
}
@@ -78,27 +78,18 @@ echo "Done"
--EXPECTF--
*** Testing token_get_all() : for control structure tokens ***
-- with if..elseif..else..tokens --
-array(49) {
+array(48) {
[0]=>
array(3) {
[0]=>
int(%d)
[1]=>
- string(6) "<?php "
- [2]=>
- int(1)
- }
- [1]=>
- array(3) {
- [0]=>
- int(%d)
- [1]=>
- string(1) "
+ string(6) "<?php
"
[2]=>
int(1)
}
- [2]=>
+ [1]=>
array(3) {
[0]=>
int(%d)
@@ -107,9 +98,9 @@ array(49) {
[2]=>
int(2)
}
- [3]=>
+ [2]=>
string(1) "("
- [4]=>
+ [3]=>
array(3) {
[0]=>
int(%d)
@@ -118,7 +109,7 @@ array(49) {
[2]=>
int(2)
}
- [5]=>
+ [4]=>
array(3) {
[0]=>
int(%d)
@@ -127,7 +118,7 @@ array(49) {
[2]=>
int(2)
}
- [6]=>
+ [5]=>
array(3) {
[0]=>
int(%d)
@@ -136,7 +127,7 @@ array(49) {
[2]=>
int(2)
}
- [7]=>
+ [6]=>
array(3) {
[0]=>
int(%d)
@@ -145,7 +136,7 @@ array(49) {
[2]=>
int(2)
}
- [8]=>
+ [7]=>
array(3) {
[0]=>
int(%d)
@@ -154,9 +145,9 @@ array(49) {
[2]=>
int(2)
}
- [9]=>
+ [8]=>
string(1) ")"
- [10]=>
+ [9]=>
array(3) {
[0]=>
int(%d)
@@ -165,9 +156,9 @@ array(49) {
[2]=>
int(2)
}
- [11]=>
+ [10]=>
string(1) "{"
- [12]=>
+ [11]=>
array(3) {
[0]=>
int(%d)
@@ -177,7 +168,7 @@ array(49) {
[2]=>
int(2)
}
- [13]=>
+ [12]=>
array(3) {
[0]=>
int(%d)
@@ -186,7 +177,7 @@ array(49) {
[2]=>
int(%d)
}
- [14]=>
+ [13]=>
array(3) {
[0]=>
int(%d)
@@ -195,9 +186,9 @@ array(49) {
[2]=>
int(%d)
}
- [15]=>
+ [14]=>
string(1) """
- [16]=>
+ [15]=>
array(3) {
[0]=>
int(%d)
@@ -206,7 +197,7 @@ array(49) {
[2]=>
int(%d)
}
- [17]=>
+ [16]=>
array(3) {
[0]=>
int(%d)
@@ -215,11 +206,11 @@ array(49) {
[2]=>
int(%d)
}
- [18]=>
+ [17]=>
string(1) """
- [19]=>
+ [18]=>
string(1) ";"
- [20]=>
+ [19]=>
array(3) {
[0]=>
int(%d)
@@ -229,9 +220,9 @@ array(49) {
[2]=>
int(%d)
}
- [21]=>
+ [20]=>
string(1) "}"
- [22]=>
+ [21]=>
array(3) {
[0]=>
int(%d)
@@ -241,7 +232,7 @@ array(49) {
[2]=>
int(4)
}
- [23]=>
+ [22]=>
array(3) {
[0]=>
int(%d)
@@ -250,9 +241,9 @@ array(49) {
[2]=>
int(5)
}
- [24]=>
+ [23]=>
string(1) "("
- [25]=>
+ [24]=>
array(3) {
[0]=>
int(%d)
@@ -261,7 +252,7 @@ array(49) {
[2]=>
int(5)
}
- [26]=>
+ [25]=>
array(3) {
[0]=>
int(%d)
@@ -270,7 +261,7 @@ array(49) {
[2]=>
int(5)
}
- [27]=>
+ [26]=>
array(3) {
[0]=>
int(%d)
@@ -279,7 +270,7 @@ array(49) {
[2]=>
int(5)
}
- [28]=>
+ [27]=>
array(3) {
[0]=>
int(%d)
@@ -288,7 +279,7 @@ array(49) {
[2]=>
int(5)
}
- [29]=>
+ [28]=>
array(3) {
[0]=>
int(%d)
@@ -297,9 +288,9 @@ array(49) {
[2]=>
int(5)
}
- [30]=>
+ [29]=>
string(1) ")"
- [31]=>
+ [30]=>
array(3) {
[0]=>
int(%d)
@@ -308,9 +299,9 @@ array(49) {
[2]=>
int(5)
}
- [32]=>
+ [31]=>
string(1) "{"
- [33]=>
+ [32]=>
array(3) {
[0]=>
int(%d)
@@ -320,7 +311,7 @@ array(49) {
[2]=>
int(5)
}
- [34]=>
+ [33]=>
array(3) {
[0]=>
int(%d)
@@ -329,7 +320,7 @@ array(49) {
[2]=>
int(6)
}
- [35]=>
+ [34]=>
array(3) {
[0]=>
int(%d)
@@ -338,7 +329,7 @@ array(49) {
[2]=>
int(6)
}
- [36]=>
+ [35]=>
array(3) {
[0]=>
int(%d)
@@ -347,9 +338,9 @@ array(49) {
[2]=>
int(6)
}
- [37]=>
+ [36]=>
string(1) ";"
- [38]=>
+ [37]=>
array(3) {
[0]=>
int(%d)
@@ -359,9 +350,9 @@ array(49) {
[2]=>
int(6)
}
- [39]=>
+ [38]=>
string(1) "}"
- [40]=>
+ [39]=>
array(3) {
[0]=>
int(%d)
@@ -371,7 +362,7 @@ array(49) {
[2]=>
int(7)
}
- [41]=>
+ [40]=>
array(3) {
[0]=>
int(%d)
@@ -380,7 +371,7 @@ array(49) {
[2]=>
int(8)
}
- [42]=>
+ [41]=>
array(3) {
[0]=>
int(%d)
@@ -390,7 +381,7 @@ array(49) {
[2]=>
int(8)
}
- [43]=>
+ [42]=>
array(3) {
[0]=>
int(%d)
@@ -399,7 +390,7 @@ array(49) {
[2]=>
int(9)
}
- [44]=>
+ [43]=>
array(3) {
[0]=>
int(%d)
@@ -408,7 +399,7 @@ array(49) {
[2]=>
int(9)
}
- [45]=>
+ [44]=>
array(3) {
[0]=>
int(%d)
@@ -417,9 +408,9 @@ array(49) {
[2]=>
int(9)
}
- [46]=>
+ [45]=>
string(1) ";"
- [47]=>
+ [46]=>
array(3) {
[0]=>
int(%d)
@@ -429,7 +420,7 @@ array(49) {
[2]=>
int(9)
}
- [48]=>
+ [47]=>
array(3) {
[0]=>
int(%d)
diff --git a/ext/tokenizer/tests/token_get_all_variation12.phpt b/ext/tokenizer/tests/token_get_all_variation12.phpt
index 368fb0867c..4684edf7f7 100644
--- a/ext/tokenizer/tests/token_get_all_variation12.phpt
+++ b/ext/tokenizer/tests/token_get_all_variation12.phpt
@@ -23,7 +23,7 @@ echo "*** Testing token_get_all() : with language constants ***\n";
// parsing __FILE__ token
echo "-- with FILE --\n";
-$source = "<?php
+$source = "<?php
\$fp = fopen(__FILE__, 'r');
?>";
var_dump( token_get_all($source));
@@ -54,27 +54,18 @@ echo "Done"
--EXPECTF--
*** Testing token_get_all() : with language constants ***
-- with FILE --
-array(16) {
+array(15) {
[0]=>
array(3) {
[0]=>
int(%d)
[1]=>
- string(6) "<?php "
- [2]=>
- int(1)
- }
- [1]=>
- array(3) {
- [0]=>
- int(%d)
- [1]=>
- string(1) "
+ string(6) "<?php
"
[2]=>
int(1)
}
- [2]=>
+ [1]=>
array(3) {
[0]=>
int(%d)
@@ -83,7 +74,7 @@ array(16) {
[2]=>
int(2)
}
- [3]=>
+ [2]=>
array(3) {
[0]=>
int(%d)
@@ -92,9 +83,9 @@ array(16) {
[2]=>
int(2)
}
- [4]=>
+ [3]=>
string(1) "="
- [5]=>
+ [4]=>
array(3) {
[0]=>
int(%d)
@@ -103,7 +94,7 @@ array(16) {
[2]=>
int(2)
}
- [6]=>
+ [5]=>
array(3) {
[0]=>
int(%d)
@@ -112,9 +103,9 @@ array(16) {
[2]=>
int(2)
}
- [7]=>
+ [6]=>
string(1) "("
- [8]=>
+ [7]=>
array(3) {
[0]=>
int(%d)
@@ -123,9 +114,9 @@ array(16) {
[2]=>
int(2)
}
- [9]=>
+ [8]=>
string(1) ","
- [10]=>
+ [9]=>
array(3) {
[0]=>
int(%d)
@@ -134,7 +125,7 @@ array(16) {
[2]=>
int(2)
}
- [11]=>
+ [10]=>
array(3) {
[0]=>
int(%d)
@@ -143,11 +134,11 @@ array(16) {
[2]=>
int(2)
}
- [12]=>
+ [11]=>
string(1) ")"
- [13]=>
+ [12]=>
string(1) ";"
- [14]=>
+ [13]=>
array(3) {
[0]=>
int(%d)
@@ -157,7 +148,7 @@ array(16) {
[2]=>
int(2)
}
- [15]=>
+ [14]=>
array(3) {
[0]=>
int(%d)
diff --git a/ext/tokenizer/tests/token_get_all_variation13.phpt b/ext/tokenizer/tests/token_get_all_variation13.phpt
index 4c792d59a9..6779048cf0 100644
--- a/ext/tokenizer/tests/token_get_all_variation13.phpt
+++ b/ext/tokenizer/tests/token_get_all_variation13.phpt
@@ -5,7 +5,7 @@ Test token_get_all() function : usage variations - with class/object constructs
--FILE--
<?php
/* Prototype : array token_get_all(string $source)
- * Description: splits the given source into an array of PHP languange tokens
+ * Description: splits the given source into an array of PHP language tokens
* Source code: ext/tokenizer/tokenizer.c
*/
@@ -35,7 +35,7 @@ abstract class MyClass
protected var $c;
static $d;
final $e = 10;
-
+
abstract public function myFunction($a);
}
class ChildClass extends MyClass implements MyInterface
@@ -573,8 +573,8 @@ array(145) {
[0]=>
int(%d)
[1]=>
- string(6) "
-
+ string(4) "
+
"
[2]=>
int(12)
diff --git a/ext/tokenizer/tests/token_get_all_variation14.phpt b/ext/tokenizer/tests/token_get_all_variation14.phpt
index 52d29198c7..aa41f066fd 100644
--- a/ext/tokenizer/tests/token_get_all_variation14.phpt
+++ b/ext/tokenizer/tests/token_get_all_variation14.phpt
@@ -5,7 +5,7 @@ Test token_get_all() function : usage variations - invalid token values
--FILE--
<?php
/* Prototype : array token_get_all(string $source)
- * Description: splits the given source into an array of PHP languange tokens
+ * Description: splits the given source into an array of PHP language tokens
* Source code: ext/tokenizer/tokenizer.c
*/
@@ -18,7 +18,7 @@ echo "*** Testing token_get_all() : with invalid/unknown tokens ***\n";
// with valid php tags and invalid tokens
echo "-- with valid PHP tags & invlid tokens --\n";
-$source = '<?php
+$source = '<?php
struct myStruct {
variable $a;
method() { display $a; }
@@ -28,7 +28,7 @@ var_dump( token_get_all($source));
// with invalid open tag for testing entire source to be unknown token
echo "-- with invlalid PHP open tag & valid tokens --\n";
-$source = '<pli
+$source = '<pli
echo "hello world"; ?>';
var_dump( token_get_all($source));
@@ -42,27 +42,18 @@ echo "Done"
--EXPECTF--
*** Testing token_get_all() : with invalid/unknown tokens ***
-- with valid PHP tags & invlid tokens --
-array(29) {
+array(28) {
[0]=>
array(3) {
[0]=>
int(%d)
[1]=>
- string(6) "<?php "
- [2]=>
- int(1)
- }
- [1]=>
- array(3) {
- [0]=>
- int(%d)
- [1]=>
- string(1) "
+ string(6) "<?php
"
[2]=>
int(1)
}
- [2]=>
+ [1]=>
array(3) {
[0]=>
int(%d)
@@ -71,7 +62,7 @@ array(29) {
[2]=>
int(2)
}
- [3]=>
+ [2]=>
array(3) {
[0]=>
int(%d)
@@ -80,7 +71,7 @@ array(29) {
[2]=>
int(2)
}
- [4]=>
+ [3]=>
array(3) {
[0]=>
int(%d)
@@ -89,7 +80,7 @@ array(29) {
[2]=>
int(2)
}
- [5]=>
+ [4]=>
array(3) {
[0]=>
int(%d)
@@ -98,9 +89,9 @@ array(29) {
[2]=>
int(2)
}
- [6]=>
+ [5]=>
string(1) "{"
- [7]=>
+ [6]=>
array(3) {
[0]=>
int(%d)
@@ -110,7 +101,7 @@ array(29) {
[2]=>
int(2)
}
- [8]=>
+ [7]=>
array(3) {
[0]=>
int(%d)
@@ -119,7 +110,7 @@ array(29) {
[2]=>
int(%d)
}
- [9]=>
+ [8]=>
array(3) {
[0]=>
int(%d)
@@ -128,7 +119,7 @@ array(29) {
[2]=>
int(%d)
}
- [10]=>
+ [9]=>
array(3) {
[0]=>
int(%d)
@@ -137,9 +128,9 @@ array(29) {
[2]=>
int(%d)
}
- [11]=>
+ [10]=>
string(1) ";"
- [12]=>
+ [11]=>
array(3) {
[0]=>
int(%d)
@@ -149,7 +140,7 @@ array(29) {
[2]=>
int(%d)
}
- [13]=>
+ [12]=>
array(3) {
[0]=>
int(%d)
@@ -158,11 +149,11 @@ array(29) {
[2]=>
int(4)
}
- [14]=>
+ [13]=>
string(1) "("
- [15]=>
+ [14]=>
string(1) ")"
- [16]=>
+ [15]=>
array(3) {
[0]=>
int(%d)
@@ -171,9 +162,9 @@ array(29) {
[2]=>
int(4)
}
- [17]=>
+ [16]=>
string(1) "{"
- [18]=>
+ [17]=>
array(3) {
[0]=>
int(%d)
@@ -182,7 +173,7 @@ array(29) {
[2]=>
int(4)
}
- [19]=>
+ [18]=>
array(3) {
[0]=>
int(%d)
@@ -191,7 +182,7 @@ array(29) {
[2]=>
int(4)
}
- [20]=>
+ [19]=>
array(3) {
[0]=>
int(%d)
@@ -200,7 +191,7 @@ array(29) {
[2]=>
int(4)
}
- [21]=>
+ [20]=>
array(3) {
[0]=>
int(%d)
@@ -209,9 +200,9 @@ array(29) {
[2]=>
int(4)
}
- [22]=>
+ [21]=>
string(1) ";"
- [23]=>
+ [22]=>
array(3) {
[0]=>
int(%d)
@@ -220,9 +211,9 @@ array(29) {
[2]=>
int(4)
}
- [24]=>
+ [23]=>
string(1) "}"
- [25]=>
+ [24]=>
array(3) {
[0]=>
int(%d)
@@ -232,9 +223,9 @@ array(29) {
[2]=>
int(4)
}
- [26]=>
+ [25]=>
string(1) "}"
- [27]=>
+ [26]=>
array(3) {
[0]=>
int(%d)
@@ -244,7 +235,7 @@ array(29) {
[2]=>
int(5)
}
- [28]=>
+ [27]=>
array(3) {
[0]=>
int(%d)
@@ -261,7 +252,7 @@ array(1) {
[0]=>
int(%d)
[1]=>
- string(28) "<pli
+ string(27) "<pli
echo "hello world"; ?>"
[2]=>
int(1)
diff --git a/ext/tokenizer/tests/token_get_all_variation15.phpt b/ext/tokenizer/tests/token_get_all_variation15.phpt
index b9e6c1fd9f..c72bbe41b9 100644
--- a/ext/tokenizer/tests/token_get_all_variation15.phpt
+++ b/ext/tokenizer/tests/token_get_all_variation15.phpt
@@ -5,7 +5,7 @@ Test token_get_all() function : usage variations - heredoc string for 'source'
--FILE--
<?php
/* Prototype : array token_get_all(string $source)
- * Description: splits the given source into an array of PHP languange tokens
+ * Description: splits the given source into an array of PHP language tokens
* Source code: ext/tokenizer/tokenizer.c
*/
@@ -18,11 +18,11 @@ Test token_get_all() function : usage variations - heredoc string for 'source'
echo "*** Testing token_get_all() : with heredoc source string ***\n";
$source = <<<EOT
-<?=
+<?=
\$a = 2;
\$b = 1;
\$c = <<<EOS
- This is to test
+ This is to test
heredoc string
EOS;
echo \$a + \$b;
@@ -63,7 +63,7 @@ array(103) {
[0]=>
int(%d)
[1]=>
- string(4) "
+ string(3) "
"
[2]=>
int(1)
@@ -212,7 +212,7 @@ array(103) {
[0]=>
int(%d)
[1]=>
- string(36) " This is to test
+ string(35) " This is to test
heredoc string
"
[2]=>
diff --git a/ext/tokenizer/tests/token_get_all_variation16.phpt b/ext/tokenizer/tests/token_get_all_variation16.phpt
index 88fa59760f..f93ec870fc 100644
--- a/ext/tokenizer/tests/token_get_all_variation16.phpt
+++ b/ext/tokenizer/tests/token_get_all_variation16.phpt
@@ -5,7 +5,7 @@ Test token_get_all() function : usage variations - with function constructs
--FILE--
<?php
/* Prototype : array token_get_all(string $source)
- * Description: splits the given source into an array of PHP languange tokens
+ * Description: splits the given source into an array of PHP language tokens
* Source code: ext/tokenizer/tokenizer.c
*/
diff --git a/ext/tokenizer/tests/token_get_all_variation17.phpt b/ext/tokenizer/tests/token_get_all_variation17.phpt
index bc9f3df65b..dcbabccc76 100644
--- a/ext/tokenizer/tests/token_get_all_variation17.phpt
+++ b/ext/tokenizer/tests/token_get_all_variation17.phpt
@@ -5,7 +5,7 @@ Test token_get_all() function : usage variations - with exception keywords
--FILE--
<?php
/* Prototype : array token_get_all(string $source)
- * Description: splits the given source into an array of PHP languange tokens
+ * Description: splits the given source into an array of PHP language tokens
* Source code: ext/tokenizer/tokenizer.c
*/
diff --git a/ext/tokenizer/tests/token_get_all_variation18.phpt b/ext/tokenizer/tests/token_get_all_variation18.phpt
index 7da1eaac81..b057856950 100644
--- a/ext/tokenizer/tests/token_get_all_variation18.phpt
+++ b/ext/tokenizer/tests/token_get_all_variation18.phpt
@@ -5,7 +5,7 @@ Test token_get_all() function : usage variations - with HTML code
--FILE--
<?php
/* Prototype : array token_get_all(string $source)
- * Description: splits the given source into an array of PHP languange tokens
+ * Description: splits the given source into an array of PHP language tokens
* Source code: ext/tokenizer/tokenizer.c
*/
@@ -19,12 +19,12 @@ echo "*** Testing token_get_all() : 'source' string with HTML tags ***\n";
$source = '
<html>
<body>
- Testing HTML
+ Testing HTML
</body>
</html>"
-<?php
- echo "php code with HTML";
+<?php
+ echo "php code with HTML";
?>';
var_dump( token_get_all($source));
@@ -38,10 +38,10 @@ array(9) {
[0]=>
int(%d)
[1]=>
- string(48) "
+ string(50) "
<html>
<body>
- Testing HTML
+ Testing HTML
</body>
</html>"
@@ -54,7 +54,8 @@ array(9) {
[0]=>
int(%d)
[1]=>
- string(6) "<?php "
+ string(6) "<?php
+"
[2]=>
int(8)
}
@@ -63,10 +64,9 @@ array(9) {
[0]=>
int(%d)
[1]=>
- string(3) "
- "
+ string(4) " "
[2]=>
- int(8)
+ int(9)
}
[3]=>
array(3) {
diff --git a/ext/tokenizer/tests/token_get_all_variation19.phpt b/ext/tokenizer/tests/token_get_all_variation19.phpt
index 6f4f7b68b3..3190b3fd16 100644
--- a/ext/tokenizer/tests/token_get_all_variation19.phpt
+++ b/ext/tokenizer/tests/token_get_all_variation19.phpt
@@ -16,16 +16,16 @@ comment */
// a class
class TestClass {
- public function foo() {
- echo "Called foo()\n";
- }
+ public function foo() {
+ echo "Called foo()\n";
+ }
}
$a = new TestClass();
$a->foo();
for ($i = 0; $i < 10; $i++) {
- echo "Loop iteration $i\n";
+ echo "Loop iteration $i\n";
}
?>';
@@ -35,17 +35,17 @@ $token_array = token_get_all($phpstr);
$script = "";
// reconstruct a script (without open/close tags) from the token array
foreach ($token_array as $token) {
- if (is_array($token)) {
- if (strncmp($token[1], '<?php', 5) == 0) {
- continue;
- }
- if (strncmp($token[1], '?>', 2) == 0) {
- continue;
- }
- $script .= $token[1];
- } else {
- $script .= $token;
- }
+ if (is_array($token)) {
+ if (strncmp($token[1], '<?php', 5) == 0) {
+ continue;
+ }
+ if (strncmp($token[1], '?>', 2) == 0) {
+ continue;
+ }
+ $script .= $token[1];
+ } else {
+ $script .= $token;
+ }
}
var_dump($script);
@@ -54,7 +54,7 @@ eval($script);
?>
--EXPECT--
-string(259) "
+string(274) "
// A php script to test token_get_all()
@@ -64,16 +64,16 @@ comment */
// a class
class TestClass {
- public function foo() {
- echo "Called foo()\n";
- }
+ public function foo() {
+ echo "Called foo()\n";
+ }
}
$a = new TestClass();
$a->foo();
for ($i = 0; $i < 10; $i++) {
- echo "Loop iteration $i\n";
+ echo "Loop iteration $i\n";
}
"
diff --git a/ext/tokenizer/tests/token_get_all_variation2.phpt b/ext/tokenizer/tests/token_get_all_variation2.phpt
index 401fb7d095..866a67c6b6 100644
--- a/ext/tokenizer/tests/token_get_all_variation2.phpt
+++ b/ext/tokenizer/tests/token_get_all_variation2.phpt
@@ -5,7 +5,7 @@ Test token_get_all() function : usage variations - with different arithmetic ope
--FILE--
<?php
/* Prototype : array token_get_all(string $source)
- * Description: splits the given source into an array of PHP languange tokens
+ * Description: splits the given source into an array of PHP language tokens
* Source code: ext/tokenizer/tokenizer.c
*/
diff --git a/ext/tokenizer/tests/token_get_all_variation3.phpt b/ext/tokenizer/tests/token_get_all_variation3.phpt
index f00ed7966f..fc995918bd 100644
--- a/ext/tokenizer/tests/token_get_all_variation3.phpt
+++ b/ext/tokenizer/tests/token_get_all_variation3.phpt
@@ -5,7 +5,7 @@ Test token_get_all() function : usage variations - with logical operators
--FILE--
<?php
/* Prototype : array token_get_all(string $source)
- * Description: splits the given source into an array of PHP languange tokens
+ * Description: splits the given source into an array of PHP language tokens
* Source code: ext/tokenizer/tokenizer.c
*/
diff --git a/ext/tokenizer/tests/token_get_all_variation4.phpt b/ext/tokenizer/tests/token_get_all_variation4.phpt
index 1ebafaec3a..66e3cb413d 100644
--- a/ext/tokenizer/tests/token_get_all_variation4.phpt
+++ b/ext/tokenizer/tests/token_get_all_variation4.phpt
@@ -5,7 +5,7 @@ Test token_get_all() function : usage variations - with comparison operators
--FILE--
<?php
/* Prototype : array token_get_all(string $source)
- * Description: splits the given source into an array of PHP languange tokens
+ * Description: splits the given source into an array of PHP language tokens
* Source code: ext/tokenizer/tokenizer.c
*/
@@ -19,8 +19,8 @@ Test token_get_all() function : usage variations - with comparison operators
echo "*** Testing token_get_all() : 'source' string with different comparison operators ***\n";
// comparison operators : '==', '===', '>=', '<=', '!=', '!==', '<>'
-$source = '<?php
-if($a == 0)
+$source = '<?php
+if($a == 0)
echo "== 0";
elseif($a === 2)
echo "=== 2";
@@ -37,27 +37,18 @@ echo "Done"
?>
--EXPECTF--
*** Testing token_get_all() : 'source' string with different comparison operators ***
-array(89) {
+array(88) {
[0]=>
array(3) {
[0]=>
int(%d)
[1]=>
- string(6) "<?php "
- [2]=>
- int(1)
- }
- [1]=>
- array(3) {
- [0]=>
- int(%d)
- [1]=>
- string(1) "
+ string(6) "<?php
"
[2]=>
int(1)
}
- [2]=>
+ [1]=>
array(3) {
[0]=>
int(%d)
@@ -66,9 +57,9 @@ array(89) {
[2]=>
int(2)
}
- [3]=>
+ [2]=>
string(1) "("
- [4]=>
+ [3]=>
array(3) {
[0]=>
int(%d)
@@ -77,7 +68,7 @@ array(89) {
[2]=>
int(2)
}
- [5]=>
+ [4]=>
array(3) {
[0]=>
int(%d)
@@ -86,16 +77,16 @@ array(89) {
[2]=>
int(2)
}
- [6]=>
+ [5]=>
array(3) {
[0]=>
- int(%d)
+ int(286)
[1]=>
string(2) "=="
[2]=>
int(2)
}
- [7]=>
+ [6]=>
array(3) {
[0]=>
int(%d)
@@ -104,7 +95,7 @@ array(89) {
[2]=>
int(2)
}
- [8]=>
+ [7]=>
array(3) {
[0]=>
int(%d)
@@ -113,19 +104,19 @@ array(89) {
[2]=>
int(2)
}
- [9]=>
+ [8]=>
string(1) ")"
- [10]=>
+ [9]=>
array(3) {
[0]=>
int(%d)
[1]=>
- string(4) "
+ string(3) "
"
[2]=>
int(2)
}
- [11]=>
+ [10]=>
array(3) {
[0]=>
int(%d)
@@ -134,7 +125,7 @@ array(89) {
[2]=>
int(%d)
}
- [12]=>
+ [11]=>
array(3) {
[0]=>
int(%d)
@@ -143,7 +134,7 @@ array(89) {
[2]=>
int(%d)
}
- [13]=>
+ [12]=>
array(3) {
[0]=>
int(%d)
@@ -152,9 +143,9 @@ array(89) {
[2]=>
int(%d)
}
- [14]=>
+ [13]=>
string(1) ";"
- [15]=>
+ [14]=>
array(3) {
[0]=>
int(%d)
@@ -164,7 +155,7 @@ array(89) {
[2]=>
int(%d)
}
- [16]=>
+ [15]=>
array(3) {
[0]=>
int(%d)
@@ -173,9 +164,9 @@ array(89) {
[2]=>
int(4)
}
- [17]=>
+ [16]=>
string(1) "("
- [18]=>
+ [17]=>
array(3) {
[0]=>
int(%d)
@@ -184,7 +175,7 @@ array(89) {
[2]=>
int(4)
}
- [19]=>
+ [18]=>
array(3) {
[0]=>
int(%d)
@@ -193,7 +184,7 @@ array(89) {
[2]=>
int(4)
}
- [20]=>
+ [19]=>
array(3) {
[0]=>
int(%d)
@@ -202,7 +193,7 @@ array(89) {
[2]=>
int(4)
}
- [21]=>
+ [20]=>
array(3) {
[0]=>
int(%d)
@@ -211,7 +202,7 @@ array(89) {
[2]=>
int(4)
}
- [22]=>
+ [21]=>
array(3) {
[0]=>
int(%d)
@@ -220,9 +211,9 @@ array(89) {
[2]=>
int(4)
}
- [23]=>
+ [22]=>
string(1) ")"
- [24]=>
+ [23]=>
array(3) {
[0]=>
int(%d)
@@ -232,7 +223,7 @@ array(89) {
[2]=>
int(4)
}
- [25]=>
+ [24]=>
array(3) {
[0]=>
int(%d)
@@ -241,7 +232,7 @@ array(89) {
[2]=>
int(5)
}
- [26]=>
+ [25]=>
array(3) {
[0]=>
int(%d)
@@ -250,7 +241,7 @@ array(89) {
[2]=>
int(5)
}
- [27]=>
+ [26]=>
array(3) {
[0]=>
int(%d)
@@ -259,9 +250,9 @@ array(89) {
[2]=>
int(5)
}
- [28]=>
+ [27]=>
string(1) ";"
- [29]=>
+ [28]=>
array(3) {
[0]=>
int(%d)
@@ -271,7 +262,7 @@ array(89) {
[2]=>
int(5)
}
- [30]=>
+ [29]=>
array(3) {
[0]=>
int(%d)
@@ -280,9 +271,9 @@ array(89) {
[2]=>
int(6)
}
- [31]=>
+ [30]=>
string(1) "("
- [32]=>
+ [31]=>
array(3) {
[0]=>
int(%d)
@@ -291,7 +282,7 @@ array(89) {
[2]=>
int(6)
}
- [33]=>
+ [32]=>
array(3) {
[0]=>
int(%d)
@@ -300,7 +291,7 @@ array(89) {
[2]=>
int(6)
}
- [34]=>
+ [33]=>
array(3) {
[0]=>
int(%d)
@@ -309,7 +300,7 @@ array(89) {
[2]=>
int(6)
}
- [35]=>
+ [34]=>
array(3) {
[0]=>
int(%d)
@@ -318,7 +309,7 @@ array(89) {
[2]=>
int(6)
}
- [36]=>
+ [35]=>
array(3) {
[0]=>
int(%d)
@@ -327,7 +318,7 @@ array(89) {
[2]=>
int(6)
}
- [37]=>
+ [36]=>
array(3) {
[0]=>
int(%d)
@@ -336,7 +327,7 @@ array(89) {
[2]=>
int(6)
}
- [38]=>
+ [37]=>
array(3) {
[0]=>
int(%d)
@@ -345,7 +336,7 @@ array(89) {
[2]=>
int(6)
}
- [39]=>
+ [38]=>
array(3) {
[0]=>
int(%d)
@@ -354,7 +345,7 @@ array(89) {
[2]=>
int(6)
}
- [40]=>
+ [39]=>
array(3) {
[0]=>
int(%d)
@@ -363,7 +354,7 @@ array(89) {
[2]=>
int(6)
}
- [41]=>
+ [40]=>
array(3) {
[0]=>
int(%d)
@@ -372,7 +363,7 @@ array(89) {
[2]=>
int(6)
}
- [42]=>
+ [41]=>
array(3) {
[0]=>
int(%d)
@@ -381,7 +372,7 @@ array(89) {
[2]=>
int(6)
}
- [43]=>
+ [42]=>
array(3) {
[0]=>
int(%d)
@@ -390,7 +381,7 @@ array(89) {
[2]=>
int(6)
}
- [44]=>
+ [43]=>
array(3) {
[0]=>
int(%d)
@@ -399,9 +390,9 @@ array(89) {
[2]=>
int(6)
}
- [45]=>
+ [44]=>
string(1) ")"
- [46]=>
+ [45]=>
array(3) {
[0]=>
int(%d)
@@ -411,7 +402,7 @@ array(89) {
[2]=>
int(6)
}
- [47]=>
+ [46]=>
array(3) {
[0]=>
int(%d)
@@ -420,7 +411,7 @@ array(89) {
[2]=>
int(7)
}
- [48]=>
+ [47]=>
array(3) {
[0]=>
int(%d)
@@ -429,7 +420,7 @@ array(89) {
[2]=>
int(7)
}
- [49]=>
+ [48]=>
array(3) {
[0]=>
int(%d)
@@ -438,9 +429,9 @@ array(89) {
[2]=>
int(7)
}
- [50]=>
+ [49]=>
string(1) ";"
- [51]=>
+ [50]=>
array(3) {
[0]=>
int(%d)
@@ -450,7 +441,7 @@ array(89) {
[2]=>
int(7)
}
- [52]=>
+ [51]=>
array(3) {
[0]=>
int(%d)
@@ -459,9 +450,9 @@ array(89) {
[2]=>
int(8)
}
- [53]=>
+ [52]=>
string(1) "("
- [54]=>
+ [53]=>
array(3) {
[0]=>
int(%d)
@@ -470,7 +461,7 @@ array(89) {
[2]=>
int(8)
}
- [55]=>
+ [54]=>
array(3) {
[0]=>
int(%d)
@@ -479,7 +470,7 @@ array(89) {
[2]=>
int(8)
}
- [56]=>
+ [55]=>
array(3) {
[0]=>
int(%d)
@@ -488,7 +479,7 @@ array(89) {
[2]=>
int(8)
}
- [57]=>
+ [56]=>
array(3) {
[0]=>
int(%d)
@@ -497,7 +488,7 @@ array(89) {
[2]=>
int(8)
}
- [58]=>
+ [57]=>
array(3) {
[0]=>
int(%d)
@@ -506,7 +497,7 @@ array(89) {
[2]=>
int(8)
}
- [59]=>
+ [58]=>
array(3) {
[0]=>
int(%d)
@@ -515,7 +506,7 @@ array(89) {
[2]=>
int(8)
}
- [60]=>
+ [59]=>
array(3) {
[0]=>
int(%d)
@@ -524,7 +515,7 @@ array(89) {
[2]=>
int(8)
}
- [61]=>
+ [60]=>
array(3) {
[0]=>
int(%d)
@@ -533,7 +524,7 @@ array(89) {
[2]=>
int(8)
}
- [62]=>
+ [61]=>
array(3) {
[0]=>
int(%d)
@@ -542,7 +533,7 @@ array(89) {
[2]=>
int(8)
}
- [63]=>
+ [62]=>
array(3) {
[0]=>
int(%d)
@@ -551,7 +542,7 @@ array(89) {
[2]=>
int(8)
}
- [64]=>
+ [63]=>
array(3) {
[0]=>
int(%d)
@@ -560,7 +551,7 @@ array(89) {
[2]=>
int(8)
}
- [65]=>
+ [64]=>
array(3) {
[0]=>
int(%d)
@@ -569,7 +560,7 @@ array(89) {
[2]=>
int(8)
}
- [66]=>
+ [65]=>
array(3) {
[0]=>
int(%d)
@@ -578,9 +569,9 @@ array(89) {
[2]=>
int(8)
}
- [67]=>
+ [66]=>
string(1) ")"
- [68]=>
+ [67]=>
array(3) {
[0]=>
int(%d)
@@ -590,7 +581,7 @@ array(89) {
[2]=>
int(8)
}
- [69]=>
+ [68]=>
array(3) {
[0]=>
int(%d)
@@ -599,7 +590,7 @@ array(89) {
[2]=>
int(9)
}
- [70]=>
+ [69]=>
array(3) {
[0]=>
int(%d)
@@ -608,7 +599,7 @@ array(89) {
[2]=>
int(9)
}
- [71]=>
+ [70]=>
array(3) {
[0]=>
int(%d)
@@ -617,9 +608,9 @@ array(89) {
[2]=>
int(9)
}
- [72]=>
+ [71]=>
string(1) ";"
- [73]=>
+ [72]=>
array(3) {
[0]=>
int(%d)
@@ -629,7 +620,7 @@ array(89) {
[2]=>
int(9)
}
- [74]=>
+ [73]=>
array(3) {
[0]=>
int(%d)
@@ -638,9 +629,9 @@ array(89) {
[2]=>
int(10)
}
- [75]=>
+ [74]=>
string(1) "("
- [76]=>
+ [75]=>
array(3) {
[0]=>
int(%d)
@@ -649,7 +640,7 @@ array(89) {
[2]=>
int(10)
}
- [77]=>
+ [76]=>
array(3) {
[0]=>
int(%d)
@@ -658,7 +649,7 @@ array(89) {
[2]=>
int(10)
}
- [78]=>
+ [77]=>
array(3) {
[0]=>
int(%d)
@@ -667,7 +658,7 @@ array(89) {
[2]=>
int(10)
}
- [79]=>
+ [78]=>
array(3) {
[0]=>
int(%d)
@@ -676,7 +667,7 @@ array(89) {
[2]=>
int(10)
}
- [80]=>
+ [79]=>
array(3) {
[0]=>
int(%d)
@@ -685,9 +676,9 @@ array(89) {
[2]=>
int(10)
}
- [81]=>
+ [80]=>
string(1) ")"
- [82]=>
+ [81]=>
array(3) {
[0]=>
int(%d)
@@ -697,7 +688,7 @@ array(89) {
[2]=>
int(10)
}
- [83]=>
+ [82]=>
array(3) {
[0]=>
int(%d)
@@ -706,7 +697,7 @@ array(89) {
[2]=>
int(11)
}
- [84]=>
+ [83]=>
array(3) {
[0]=>
int(%d)
@@ -715,7 +706,7 @@ array(89) {
[2]=>
int(11)
}
- [85]=>
+ [84]=>
array(3) {
[0]=>
int(%d)
@@ -724,9 +715,9 @@ array(89) {
[2]=>
int(11)
}
- [86]=>
+ [85]=>
string(1) ";"
- [87]=>
+ [86]=>
array(3) {
[0]=>
int(%d)
@@ -736,7 +727,7 @@ array(89) {
[2]=>
int(11)
}
- [88]=>
+ [87]=>
array(3) {
[0]=>
int(%d)
diff --git a/ext/tokenizer/tests/token_get_all_variation5.phpt b/ext/tokenizer/tests/token_get_all_variation5.phpt
index 2d8121fd80..3eed767665 100644
--- a/ext/tokenizer/tests/token_get_all_variation5.phpt
+++ b/ext/tokenizer/tests/token_get_all_variation5.phpt
@@ -5,7 +5,7 @@ Test token_get_all() function : usage variations - with assignment operators
--FILE--
<?php
/* Prototype : array token_get_all(string $source)
- * Description: splits the given source into an array of PHP languange tokens
+ * Description: splits the given source into an array of PHP language tokens
* Source code: ext/tokenizer/tokenizer.c
*/
@@ -21,7 +21,7 @@ Test token_get_all() function : usage variations - with assignment operators
echo "*** Testing token_get_all() : 'source' string with different assignment operators ***\n";
// assignment operators : '+=', '-=', '*=', '/=', '%=', '&=', '|=', '^=', '>>=', '<<=', '.='
-$source = '<?php
+$source = '<?php
$a = 1, $b = 2;
$c += $b;
$b -= $a;
@@ -41,27 +41,18 @@ echo "Done"
?>
--EXPECTF--
*** Testing token_get_all() : 'source' string with different assignment operators ***
-array(94) {
+array(93) {
[0]=>
array(3) {
[0]=>
int(%d)
[1]=>
- string(6) "<?php "
- [2]=>
- int(1)
- }
- [1]=>
- array(3) {
- [0]=>
- int(%d)
- [1]=>
- string(1) "
+ string(6) "<?php
"
[2]=>
int(1)
}
- [2]=>
+ [1]=>
array(3) {
[0]=>
int(%d)
@@ -70,7 +61,7 @@ array(94) {
[2]=>
int(2)
}
- [3]=>
+ [2]=>
array(3) {
[0]=>
int(%d)
@@ -79,9 +70,9 @@ array(94) {
[2]=>
int(2)
}
- [4]=>
+ [3]=>
string(1) "="
- [5]=>
+ [4]=>
array(3) {
[0]=>
int(%d)
@@ -90,7 +81,7 @@ array(94) {
[2]=>
int(2)
}
- [6]=>
+ [5]=>
array(3) {
[0]=>
int(%d)
@@ -99,9 +90,9 @@ array(94) {
[2]=>
int(2)
}
- [7]=>
+ [6]=>
string(1) ","
- [8]=>
+ [7]=>
array(3) {
[0]=>
int(%d)
@@ -110,7 +101,7 @@ array(94) {
[2]=>
int(2)
}
- [9]=>
+ [8]=>
array(3) {
[0]=>
int(%d)
@@ -119,7 +110,7 @@ array(94) {
[2]=>
int(2)
}
- [10]=>
+ [9]=>
array(3) {
[0]=>
int(%d)
@@ -128,9 +119,9 @@ array(94) {
[2]=>
int(2)
}
- [11]=>
+ [10]=>
string(1) "="
- [12]=>
+ [11]=>
array(3) {
[0]=>
int(%d)
@@ -139,7 +130,7 @@ array(94) {
[2]=>
int(2)
}
- [13]=>
+ [12]=>
array(3) {
[0]=>
int(%d)
@@ -148,9 +139,9 @@ array(94) {
[2]=>
int(2)
}
- [14]=>
+ [13]=>
string(1) ";"
- [15]=>
+ [14]=>
array(3) {
[0]=>
int(%d)
@@ -160,7 +151,7 @@ array(94) {
[2]=>
int(2)
}
- [16]=>
+ [15]=>
array(3) {
[0]=>
int(%d)
@@ -169,7 +160,7 @@ array(94) {
[2]=>
int(%d)
}
- [17]=>
+ [16]=>
array(3) {
[0]=>
int(%d)
@@ -178,7 +169,7 @@ array(94) {
[2]=>
int(%d)
}
- [18]=>
+ [17]=>
array(3) {
[0]=>
int(%d)
@@ -187,7 +178,7 @@ array(94) {
[2]=>
int(%d)
}
- [19]=>
+ [18]=>
array(3) {
[0]=>
int(%d)
@@ -196,7 +187,7 @@ array(94) {
[2]=>
int(%d)
}
- [20]=>
+ [19]=>
array(3) {
[0]=>
int(%d)
@@ -205,9 +196,9 @@ array(94) {
[2]=>
int(%d)
}
- [21]=>
+ [20]=>
string(1) ";"
- [22]=>
+ [21]=>
array(3) {
[0]=>
int(%d)
@@ -217,7 +208,7 @@ array(94) {
[2]=>
int(%d)
}
- [23]=>
+ [22]=>
array(3) {
[0]=>
int(%d)
@@ -226,7 +217,7 @@ array(94) {
[2]=>
int(4)
}
- [24]=>
+ [23]=>
array(3) {
[0]=>
int(%d)
@@ -235,7 +226,7 @@ array(94) {
[2]=>
int(4)
}
- [25]=>
+ [24]=>
array(3) {
[0]=>
int(%d)
@@ -244,7 +235,7 @@ array(94) {
[2]=>
int(4)
}
- [26]=>
+ [25]=>
array(3) {
[0]=>
int(%d)
@@ -253,7 +244,7 @@ array(94) {
[2]=>
int(4)
}
- [27]=>
+ [26]=>
array(3) {
[0]=>
int(%d)
@@ -262,9 +253,9 @@ array(94) {
[2]=>
int(4)
}
- [28]=>
+ [27]=>
string(1) ";"
- [29]=>
+ [28]=>
array(3) {
[0]=>
int(%d)
@@ -274,7 +265,7 @@ array(94) {
[2]=>
int(4)
}
- [30]=>
+ [29]=>
array(3) {
[0]=>
int(%d)
@@ -283,7 +274,7 @@ array(94) {
[2]=>
int(5)
}
- [31]=>
+ [30]=>
array(3) {
[0]=>
int(%d)
@@ -292,7 +283,7 @@ array(94) {
[2]=>
int(5)
}
- [32]=>
+ [31]=>
array(3) {
[0]=>
int(%d)
@@ -301,7 +292,7 @@ array(94) {
[2]=>
int(5)
}
- [33]=>
+ [32]=>
array(3) {
[0]=>
int(%d)
@@ -310,7 +301,7 @@ array(94) {
[2]=>
int(5)
}
- [34]=>
+ [33]=>
array(3) {
[0]=>
int(%d)
@@ -319,9 +310,9 @@ array(94) {
[2]=>
int(5)
}
- [35]=>
+ [34]=>
string(1) ";"
- [36]=>
+ [35]=>
array(3) {
[0]=>
int(%d)
@@ -331,7 +322,7 @@ array(94) {
[2]=>
int(5)
}
- [37]=>
+ [36]=>
array(3) {
[0]=>
int(%d)
@@ -340,7 +331,7 @@ array(94) {
[2]=>
int(6)
}
- [38]=>
+ [37]=>
array(3) {
[0]=>
int(%d)
@@ -349,7 +340,7 @@ array(94) {
[2]=>
int(6)
}
- [39]=>
+ [38]=>
array(3) {
[0]=>
int(%d)
@@ -358,7 +349,7 @@ array(94) {
[2]=>
int(6)
}
- [40]=>
+ [39]=>
array(3) {
[0]=>
int(%d)
@@ -367,7 +358,7 @@ array(94) {
[2]=>
int(6)
}
- [41]=>
+ [40]=>
array(3) {
[0]=>
int(%d)
@@ -376,9 +367,9 @@ array(94) {
[2]=>
int(6)
}
- [42]=>
+ [41]=>
string(1) ";"
- [43]=>
+ [42]=>
array(3) {
[0]=>
int(%d)
@@ -388,7 +379,7 @@ array(94) {
[2]=>
int(6)
}
- [44]=>
+ [43]=>
array(3) {
[0]=>
int(%d)
@@ -397,7 +388,7 @@ array(94) {
[2]=>
int(7)
}
- [45]=>
+ [44]=>
array(3) {
[0]=>
int(%d)
@@ -406,7 +397,7 @@ array(94) {
[2]=>
int(7)
}
- [46]=>
+ [45]=>
array(3) {
[0]=>
int(%d)
@@ -415,7 +406,7 @@ array(94) {
[2]=>
int(7)
}
- [47]=>
+ [46]=>
array(3) {
[0]=>
int(%d)
@@ -424,7 +415,7 @@ array(94) {
[2]=>
int(7)
}
- [48]=>
+ [47]=>
array(3) {
[0]=>
int(%d)
@@ -433,9 +424,9 @@ array(94) {
[2]=>
int(7)
}
- [49]=>
+ [48]=>
string(1) ";"
- [50]=>
+ [49]=>
array(3) {
[0]=>
int(%d)
@@ -445,7 +436,7 @@ array(94) {
[2]=>
int(7)
}
- [51]=>
+ [50]=>
array(3) {
[0]=>
int(%d)
@@ -454,7 +445,7 @@ array(94) {
[2]=>
int(8)
}
- [52]=>
+ [51]=>
array(3) {
[0]=>
int(%d)
@@ -463,7 +454,7 @@ array(94) {
[2]=>
int(8)
}
- [53]=>
+ [52]=>
array(3) {
[0]=>
int(%d)
@@ -472,7 +463,7 @@ array(94) {
[2]=>
int(8)
}
- [54]=>
+ [53]=>
array(3) {
[0]=>
int(%d)
@@ -481,7 +472,7 @@ array(94) {
[2]=>
int(8)
}
- [55]=>
+ [54]=>
array(3) {
[0]=>
int(%d)
@@ -490,9 +481,9 @@ array(94) {
[2]=>
int(8)
}
- [56]=>
+ [55]=>
string(1) ";"
- [57]=>
+ [56]=>
array(3) {
[0]=>
int(%d)
@@ -502,7 +493,7 @@ array(94) {
[2]=>
int(8)
}
- [58]=>
+ [57]=>
array(3) {
[0]=>
int(%d)
@@ -511,7 +502,7 @@ array(94) {
[2]=>
int(9)
}
- [59]=>
+ [58]=>
array(3) {
[0]=>
int(%d)
@@ -520,7 +511,7 @@ array(94) {
[2]=>
int(9)
}
- [60]=>
+ [59]=>
array(3) {
[0]=>
int(%d)
@@ -529,7 +520,7 @@ array(94) {
[2]=>
int(9)
}
- [61]=>
+ [60]=>
array(3) {
[0]=>
int(%d)
@@ -538,7 +529,7 @@ array(94) {
[2]=>
int(9)
}
- [62]=>
+ [61]=>
array(3) {
[0]=>
int(%d)
@@ -547,9 +538,9 @@ array(94) {
[2]=>
int(9)
}
- [63]=>
+ [62]=>
string(1) ";"
- [64]=>
+ [63]=>
array(3) {
[0]=>
int(%d)
@@ -559,7 +550,7 @@ array(94) {
[2]=>
int(9)
}
- [65]=>
+ [64]=>
array(3) {
[0]=>
int(%d)
@@ -568,7 +559,7 @@ array(94) {
[2]=>
int(10)
}
- [66]=>
+ [65]=>
array(3) {
[0]=>
int(%d)
@@ -577,7 +568,7 @@ array(94) {
[2]=>
int(10)
}
- [67]=>
+ [66]=>
array(3) {
[0]=>
int(%d)
@@ -586,7 +577,7 @@ array(94) {
[2]=>
int(10)
}
- [68]=>
+ [67]=>
array(3) {
[0]=>
int(%d)
@@ -595,7 +586,7 @@ array(94) {
[2]=>
int(10)
}
- [69]=>
+ [68]=>
array(3) {
[0]=>
int(%d)
@@ -604,9 +595,9 @@ array(94) {
[2]=>
int(10)
}
- [70]=>
+ [69]=>
string(1) ";"
- [71]=>
+ [70]=>
array(3) {
[0]=>
int(%d)
@@ -616,7 +607,7 @@ array(94) {
[2]=>
int(10)
}
- [72]=>
+ [71]=>
array(3) {
[0]=>
int(%d)
@@ -625,7 +616,7 @@ array(94) {
[2]=>
int(11)
}
- [73]=>
+ [72]=>
array(3) {
[0]=>
int(%d)
@@ -634,7 +625,7 @@ array(94) {
[2]=>
int(11)
}
- [74]=>
+ [73]=>
array(3) {
[0]=>
int(%d)
@@ -643,7 +634,7 @@ array(94) {
[2]=>
int(11)
}
- [75]=>
+ [74]=>
array(3) {
[0]=>
int(%d)
@@ -652,7 +643,7 @@ array(94) {
[2]=>
int(11)
}
- [76]=>
+ [75]=>
array(3) {
[0]=>
int(%d)
@@ -661,9 +652,9 @@ array(94) {
[2]=>
int(11)
}
- [77]=>
+ [76]=>
string(1) ";"
- [78]=>
+ [77]=>
array(3) {
[0]=>
int(%d)
@@ -673,7 +664,7 @@ array(94) {
[2]=>
int(11)
}
- [79]=>
+ [78]=>
array(3) {
[0]=>
int(%d)
@@ -682,7 +673,7 @@ array(94) {
[2]=>
int(12)
}
- [80]=>
+ [79]=>
array(3) {
[0]=>
int(%d)
@@ -691,7 +682,7 @@ array(94) {
[2]=>
int(12)
}
- [81]=>
+ [80]=>
array(3) {
[0]=>
int(%d)
@@ -700,7 +691,7 @@ array(94) {
[2]=>
int(12)
}
- [82]=>
+ [81]=>
array(3) {
[0]=>
int(%d)
@@ -709,7 +700,7 @@ array(94) {
[2]=>
int(12)
}
- [83]=>
+ [82]=>
array(3) {
[0]=>
int(%d)
@@ -718,9 +709,9 @@ array(94) {
[2]=>
int(12)
}
- [84]=>
+ [83]=>
string(1) ";"
- [85]=>
+ [84]=>
array(3) {
[0]=>
int(%d)
@@ -730,7 +721,7 @@ array(94) {
[2]=>
int(12)
}
- [86]=>
+ [85]=>
array(3) {
[0]=>
int(%d)
@@ -739,7 +730,7 @@ array(94) {
[2]=>
int(13)
}
- [87]=>
+ [86]=>
array(3) {
[0]=>
int(%d)
@@ -748,7 +739,7 @@ array(94) {
[2]=>
int(13)
}
- [88]=>
+ [87]=>
array(3) {
[0]=>
int(%d)
@@ -757,7 +748,7 @@ array(94) {
[2]=>
int(13)
}
- [89]=>
+ [88]=>
array(3) {
[0]=>
int(%d)
@@ -766,7 +757,7 @@ array(94) {
[2]=>
int(13)
}
- [90]=>
+ [89]=>
array(3) {
[0]=>
int(%d)
@@ -775,9 +766,9 @@ array(94) {
[2]=>
int(13)
}
- [91]=>
+ [90]=>
string(1) ";"
- [92]=>
+ [91]=>
array(3) {
[0]=>
int(%d)
@@ -787,7 +778,7 @@ array(94) {
[2]=>
int(13)
}
- [93]=>
+ [92]=>
array(3) {
[0]=>
int(%d)
diff --git a/ext/tokenizer/tests/token_get_all_variation6.phpt b/ext/tokenizer/tests/token_get_all_variation6.phpt
index 6213dab9d0..06c13bd32c 100644
--- a/ext/tokenizer/tests/token_get_all_variation6.phpt
+++ b/ext/tokenizer/tests/token_get_all_variation6.phpt
@@ -5,7 +5,7 @@ Test token_get_all() function : usage variations - with bitwise operators
--FILE--
<?php
/* Prototype : array token_get_all(string $source)
- * Description: splits the given source into an array of PHP languange tokens
+ * Description: splits the given source into an array of PHP language tokens
* Source code: ext/tokenizer/tokenizer.c
*/
diff --git a/ext/tokenizer/tests/token_get_all_variation7.phpt b/ext/tokenizer/tests/token_get_all_variation7.phpt
index 36fda3298c..6d976a4054 100644
--- a/ext/tokenizer/tests/token_get_all_variation7.phpt
+++ b/ext/tokenizer/tests/token_get_all_variation7.phpt
@@ -5,7 +5,7 @@ Test token_get_all() function : usage variations - with increment/decrement oper
--FILE--
<?php
/* Prototype : array token_get_all(string $source)
- * Description: splits the given source into an array of PHP languange tokens
+ * Description: splits the given source into an array of PHP language tokens
* Source code: ext/tokenizer/tokenizer.c
*/
@@ -18,39 +18,30 @@ Test token_get_all() function : usage variations - with increment/decrement oper
echo "*** Testing token_get_all() : 'source' string with different increment/decrement operators ***\n";
// increment/decrement operators : '++' , '--'
-$source = '<?php
+$source = '<?php
$a = 10, $b = 5;
$a++;
$b--;
echo $a;
?>';
-var_dump( token_get_all($source));
+var_dump(token_get_all($source));
echo "Done"
?>
--EXPECTF--
*** Testing token_get_all() : 'source' string with different increment/decrement operators ***
-array(30) {
+array(29) {
[0]=>
array(3) {
[0]=>
int(%d)
[1]=>
- string(6) "<?php "
- [2]=>
- int(1)
- }
- [1]=>
- array(3) {
- [0]=>
- int(%d)
- [1]=>
- string(1) "
+ string(6) "<?php
"
[2]=>
int(1)
}
- [2]=>
+ [1]=>
array(3) {
[0]=>
int(%d)
@@ -59,7 +50,7 @@ array(30) {
[2]=>
int(2)
}
- [3]=>
+ [2]=>
array(3) {
[0]=>
int(%d)
@@ -68,9 +59,9 @@ array(30) {
[2]=>
int(2)
}
- [4]=>
+ [3]=>
string(1) "="
- [5]=>
+ [4]=>
array(3) {
[0]=>
int(%d)
@@ -79,7 +70,7 @@ array(30) {
[2]=>
int(2)
}
- [6]=>
+ [5]=>
array(3) {
[0]=>
int(%d)
@@ -88,9 +79,9 @@ array(30) {
[2]=>
int(2)
}
- [7]=>
+ [6]=>
string(1) ","
- [8]=>
+ [7]=>
array(3) {
[0]=>
int(%d)
@@ -99,7 +90,7 @@ array(30) {
[2]=>
int(2)
}
- [9]=>
+ [8]=>
array(3) {
[0]=>
int(%d)
@@ -108,7 +99,7 @@ array(30) {
[2]=>
int(2)
}
- [10]=>
+ [9]=>
array(3) {
[0]=>
int(%d)
@@ -117,9 +108,9 @@ array(30) {
[2]=>
int(2)
}
- [11]=>
+ [10]=>
string(1) "="
- [12]=>
+ [11]=>
array(3) {
[0]=>
int(%d)
@@ -128,7 +119,7 @@ array(30) {
[2]=>
int(2)
}
- [13]=>
+ [12]=>
array(3) {
[0]=>
int(%d)
@@ -137,9 +128,9 @@ array(30) {
[2]=>
int(2)
}
- [14]=>
+ [13]=>
string(1) ";"
- [15]=>
+ [14]=>
array(3) {
[0]=>
int(%d)
@@ -149,7 +140,7 @@ array(30) {
[2]=>
int(2)
}
- [16]=>
+ [15]=>
array(3) {
[0]=>
int(%d)
@@ -158,7 +149,7 @@ array(30) {
[2]=>
int(%d)
}
- [17]=>
+ [16]=>
array(3) {
[0]=>
int(%d)
@@ -167,9 +158,9 @@ array(30) {
[2]=>
int(%d)
}
- [18]=>
+ [17]=>
string(1) ";"
- [19]=>
+ [18]=>
array(3) {
[0]=>
int(%d)
@@ -179,7 +170,7 @@ array(30) {
[2]=>
int(%d)
}
- [20]=>
+ [19]=>
array(3) {
[0]=>
int(%d)
@@ -188,7 +179,7 @@ array(30) {
[2]=>
int(4)
}
- [21]=>
+ [20]=>
array(3) {
[0]=>
int(%d)
@@ -197,9 +188,9 @@ array(30) {
[2]=>
int(4)
}
- [22]=>
+ [21]=>
string(1) ";"
- [23]=>
+ [22]=>
array(3) {
[0]=>
int(%d)
@@ -209,7 +200,7 @@ array(30) {
[2]=>
int(4)
}
- [24]=>
+ [23]=>
array(3) {
[0]=>
int(%d)
@@ -218,7 +209,7 @@ array(30) {
[2]=>
int(5)
}
- [25]=>
+ [24]=>
array(3) {
[0]=>
int(%d)
@@ -227,7 +218,7 @@ array(30) {
[2]=>
int(5)
}
- [26]=>
+ [25]=>
array(3) {
[0]=>
int(%d)
@@ -236,9 +227,9 @@ array(30) {
[2]=>
int(5)
}
- [27]=>
+ [26]=>
string(1) ";"
- [28]=>
+ [27]=>
array(3) {
[0]=>
int(%d)
@@ -248,7 +239,7 @@ array(30) {
[2]=>
int(5)
}
- [29]=>
+ [28]=>
array(3) {
[0]=>
int(%d)
diff --git a/ext/tokenizer/tests/token_get_all_variation8.phpt b/ext/tokenizer/tests/token_get_all_variation8.phpt
index c80a5d0f04..015e60d6e3 100644
--- a/ext/tokenizer/tests/token_get_all_variation8.phpt
+++ b/ext/tokenizer/tests/token_get_all_variation8.phpt
@@ -5,7 +5,7 @@ Test token_get_all() function : usage variations - with type casting operators
--FILE--
<?php
/* Prototype : array token_get_all(string $source)
- * Description: splits the given source into an array of PHP languange tokens
+ * Description: splits the given source into an array of PHP language tokens
* Source code: ext/tokenizer/tokenizer.c
*/
@@ -19,7 +19,7 @@ Test token_get_all() function : usage variations - with type casting operators
echo "*** Testing token_get_all() : 'source' string with different type casting operators ***\n";
// type casting operators : (int), (integer), (float), (real), (double), (string), (array), (object), (bool), (boolean),(unset)
-$source = '<?php
+$source = '<?php
$a = 1, $b = 10.5
$c = (int)$b + $a;
$d = (float)$a + $b;
@@ -36,27 +36,18 @@ echo "Done"
?>
--EXPECTF--
*** Testing token_get_all() : 'source' string with different type casting operators ***
-array(108) {
+array(107) {
[0]=>
array(3) {
[0]=>
int(%d)
[1]=>
- string(6) "<?php "
- [2]=>
- int(1)
- }
- [1]=>
- array(3) {
- [0]=>
- int(%d)
- [1]=>
- string(1) "
+ string(6) "<?php
"
[2]=>
int(1)
}
- [2]=>
+ [1]=>
array(3) {
[0]=>
int(%d)
@@ -65,7 +56,7 @@ array(108) {
[2]=>
int(2)
}
- [3]=>
+ [2]=>
array(3) {
[0]=>
int(%d)
@@ -74,9 +65,9 @@ array(108) {
[2]=>
int(2)
}
- [4]=>
+ [3]=>
string(1) "="
- [5]=>
+ [4]=>
array(3) {
[0]=>
int(%d)
@@ -85,7 +76,7 @@ array(108) {
[2]=>
int(2)
}
- [6]=>
+ [5]=>
array(3) {
[0]=>
int(%d)
@@ -94,9 +85,9 @@ array(108) {
[2]=>
int(2)
}
- [7]=>
+ [6]=>
string(1) ","
- [8]=>
+ [7]=>
array(3) {
[0]=>
int(%d)
@@ -105,7 +96,7 @@ array(108) {
[2]=>
int(2)
}
- [9]=>
+ [8]=>
array(3) {
[0]=>
int(%d)
@@ -114,7 +105,7 @@ array(108) {
[2]=>
int(2)
}
- [10]=>
+ [9]=>
array(3) {
[0]=>
int(%d)
@@ -123,9 +114,9 @@ array(108) {
[2]=>
int(2)
}
- [11]=>
+ [10]=>
string(1) "="
- [12]=>
+ [11]=>
array(3) {
[0]=>
int(%d)
@@ -134,7 +125,7 @@ array(108) {
[2]=>
int(2)
}
- [13]=>
+ [12]=>
array(3) {
[0]=>
int(%d)
@@ -143,7 +134,7 @@ array(108) {
[2]=>
int(2)
}
- [14]=>
+ [13]=>
array(3) {
[0]=>
int(%d)
@@ -153,7 +144,7 @@ array(108) {
[2]=>
int(2)
}
- [15]=>
+ [14]=>
array(3) {
[0]=>
int(%d)
@@ -162,7 +153,7 @@ array(108) {
[2]=>
int(%d)
}
- [16]=>
+ [15]=>
array(3) {
[0]=>
int(%d)
@@ -171,9 +162,9 @@ array(108) {
[2]=>
int(%d)
}
- [17]=>
+ [16]=>
string(1) "="
- [18]=>
+ [17]=>
array(3) {
[0]=>
int(%d)
@@ -182,7 +173,7 @@ array(108) {
[2]=>
int(%d)
}
- [19]=>
+ [18]=>
array(3) {
[0]=>
int(%d)
@@ -191,7 +182,7 @@ array(108) {
[2]=>
int(%d)
}
- [20]=>
+ [19]=>
array(3) {
[0]=>
int(%d)
@@ -200,7 +191,7 @@ array(108) {
[2]=>
int(%d)
}
- [21]=>
+ [20]=>
array(3) {
[0]=>
int(%d)
@@ -209,9 +200,9 @@ array(108) {
[2]=>
int(%d)
}
- [22]=>
+ [21]=>
string(1) "+"
- [23]=>
+ [22]=>
array(3) {
[0]=>
int(%d)
@@ -220,7 +211,7 @@ array(108) {
[2]=>
int(%d)
}
- [24]=>
+ [23]=>
array(3) {
[0]=>
int(%d)
@@ -229,9 +220,9 @@ array(108) {
[2]=>
int(%d)
}
- [25]=>
+ [24]=>
string(1) ";"
- [26]=>
+ [25]=>
array(3) {
[0]=>
int(%d)
@@ -241,7 +232,7 @@ array(108) {
[2]=>
int(%d)
}
- [27]=>
+ [26]=>
array(3) {
[0]=>
int(%d)
@@ -250,7 +241,7 @@ array(108) {
[2]=>
int(4)
}
- [28]=>
+ [27]=>
array(3) {
[0]=>
int(%d)
@@ -259,9 +250,9 @@ array(108) {
[2]=>
int(4)
}
- [29]=>
+ [28]=>
string(1) "="
- [30]=>
+ [29]=>
array(3) {
[0]=>
int(%d)
@@ -270,7 +261,7 @@ array(108) {
[2]=>
int(4)
}
- [31]=>
+ [30]=>
array(3) {
[0]=>
int(%d)
@@ -279,7 +270,7 @@ array(108) {
[2]=>
int(4)
}
- [32]=>
+ [31]=>
array(3) {
[0]=>
int(%d)
@@ -288,7 +279,7 @@ array(108) {
[2]=>
int(4)
}
- [33]=>
+ [32]=>
array(3) {
[0]=>
int(%d)
@@ -297,9 +288,9 @@ array(108) {
[2]=>
int(4)
}
- [34]=>
+ [33]=>
string(1) "+"
- [35]=>
+ [34]=>
array(3) {
[0]=>
int(%d)
@@ -308,7 +299,7 @@ array(108) {
[2]=>
int(4)
}
- [36]=>
+ [35]=>
array(3) {
[0]=>
int(%d)
@@ -317,9 +308,9 @@ array(108) {
[2]=>
int(4)
}
- [37]=>
+ [36]=>
string(1) ";"
- [38]=>
+ [37]=>
array(3) {
[0]=>
int(%d)
@@ -329,7 +320,7 @@ array(108) {
[2]=>
int(4)
}
- [39]=>
+ [38]=>
array(3) {
[0]=>
int(%d)
@@ -338,7 +329,7 @@ array(108) {
[2]=>
int(5)
}
- [40]=>
+ [39]=>
array(3) {
[0]=>
int(%d)
@@ -347,9 +338,9 @@ array(108) {
[2]=>
int(5)
}
- [41]=>
+ [40]=>
string(1) "="
- [42]=>
+ [41]=>
array(3) {
[0]=>
int(%d)
@@ -358,7 +349,7 @@ array(108) {
[2]=>
int(5)
}
- [43]=>
+ [42]=>
array(3) {
[0]=>
int(%d)
@@ -367,7 +358,7 @@ array(108) {
[2]=>
int(5)
}
- [44]=>
+ [43]=>
array(3) {
[0]=>
int(%d)
@@ -376,9 +367,9 @@ array(108) {
[2]=>
int(5)
}
- [45]=>
+ [44]=>
string(1) "."
- [46]=>
+ [45]=>
array(3) {
[0]=>
int(%d)
@@ -387,7 +378,7 @@ array(108) {
[2]=>
int(5)
}
- [47]=>
+ [46]=>
array(3) {
[0]=>
int(%d)
@@ -396,9 +387,9 @@ array(108) {
[2]=>
int(5)
}
- [48]=>
+ [47]=>
string(1) ";"
- [49]=>
+ [48]=>
array(3) {
[0]=>
int(%d)
@@ -408,7 +399,7 @@ array(108) {
[2]=>
int(5)
}
- [50]=>
+ [49]=>
array(3) {
[0]=>
int(%d)
@@ -417,9 +408,9 @@ array(108) {
[2]=>
int(6)
}
- [51]=>
+ [50]=>
string(1) "("
- [52]=>
+ [51]=>
array(3) {
[0]=>
int(%d)
@@ -428,7 +419,7 @@ array(108) {
[2]=>
int(6)
}
- [53]=>
+ [52]=>
array(3) {
[0]=>
int(%d)
@@ -437,9 +428,9 @@ array(108) {
[2]=>
int(6)
}
- [54]=>
+ [53]=>
string(1) ")"
- [55]=>
+ [54]=>
array(3) {
[0]=>
int(%d)
@@ -448,7 +439,7 @@ array(108) {
[2]=>
int(6)
}
- [56]=>
+ [55]=>
array(3) {
[0]=>
int(%d)
@@ -457,7 +448,7 @@ array(108) {
[2]=>
int(6)
}
- [57]=>
+ [56]=>
array(3) {
[0]=>
int(%d)
@@ -466,7 +457,7 @@ array(108) {
[2]=>
int(6)
}
- [58]=>
+ [57]=>
array(3) {
[0]=>
int(%d)
@@ -475,9 +466,9 @@ array(108) {
[2]=>
int(6)
}
- [59]=>
+ [58]=>
string(1) ";"
- [60]=>
+ [59]=>
array(3) {
[0]=>
int(%d)
@@ -487,7 +478,7 @@ array(108) {
[2]=>
int(6)
}
- [61]=>
+ [60]=>
array(3) {
[0]=>
int(%d)
@@ -496,11 +487,11 @@ array(108) {
[2]=>
int(7)
}
- [62]=>
+ [61]=>
string(1) "("
- [63]=>
+ [62]=>
string(1) "!"
- [64]=>
+ [63]=>
array(3) {
[0]=>
int(%d)
@@ -509,7 +500,7 @@ array(108) {
[2]=>
int(7)
}
- [65]=>
+ [64]=>
array(3) {
[0]=>
int(%d)
@@ -518,9 +509,9 @@ array(108) {
[2]=>
int(7)
}
- [66]=>
+ [65]=>
string(1) ")"
- [67]=>
+ [66]=>
array(3) {
[0]=>
int(%d)
@@ -529,7 +520,7 @@ array(108) {
[2]=>
int(7)
}
- [68]=>
+ [67]=>
array(3) {
[0]=>
int(%d)
@@ -538,7 +529,7 @@ array(108) {
[2]=>
int(7)
}
- [69]=>
+ [68]=>
array(3) {
[0]=>
int(%d)
@@ -547,7 +538,7 @@ array(108) {
[2]=>
int(7)
}
- [70]=>
+ [69]=>
array(3) {
[0]=>
int(%d)
@@ -556,9 +547,9 @@ array(108) {
[2]=>
int(7)
}
- [71]=>
+ [70]=>
string(1) ";"
- [72]=>
+ [71]=>
array(3) {
[0]=>
int(%d)
@@ -568,7 +559,7 @@ array(108) {
[2]=>
int(7)
}
- [73]=>
+ [72]=>
array(3) {
[0]=>
int(%d)
@@ -577,7 +568,7 @@ array(108) {
[2]=>
int(8)
}
- [74]=>
+ [73]=>
array(3) {
[0]=>
int(%d)
@@ -586,9 +577,9 @@ array(108) {
[2]=>
int(8)
}
- [75]=>
+ [74]=>
string(1) "="
- [76]=>
+ [75]=>
array(3) {
[0]=>
int(%d)
@@ -597,7 +588,7 @@ array(108) {
[2]=>
int(8)
}
- [77]=>
+ [76]=>
array(3) {
[0]=>
int(%d)
@@ -606,7 +597,7 @@ array(108) {
[2]=>
int(8)
}
- [78]=>
+ [77]=>
array(3) {
[0]=>
int(%d)
@@ -615,9 +606,9 @@ array(108) {
[2]=>
int(8)
}
- [79]=>
+ [78]=>
string(1) "+"
- [80]=>
+ [79]=>
array(3) {
[0]=>
int(%d)
@@ -626,7 +617,7 @@ array(108) {
[2]=>
int(8)
}
- [81]=>
+ [80]=>
array(3) {
[0]=>
int(%d)
@@ -635,7 +626,7 @@ array(108) {
[2]=>
int(8)
}
- [82]=>
+ [81]=>
array(3) {
[0]=>
int(%d)
@@ -644,7 +635,7 @@ array(108) {
[2]=>
int(8)
}
- [83]=>
+ [82]=>
array(3) {
[0]=>
int(%d)
@@ -653,9 +644,9 @@ array(108) {
[2]=>
int(8)
}
- [84]=>
+ [83]=>
string(1) ";"
- [85]=>
+ [84]=>
array(3) {
[0]=>
int(%d)
@@ -665,7 +656,7 @@ array(108) {
[2]=>
int(8)
}
- [86]=>
+ [85]=>
array(3) {
[0]=>
int(%d)
@@ -674,7 +665,7 @@ array(108) {
[2]=>
int(9)
}
- [87]=>
+ [86]=>
array(3) {
[0]=>
int(%d)
@@ -683,9 +674,9 @@ array(108) {
[2]=>
int(9)
}
- [88]=>
+ [87]=>
string(1) "="
- [89]=>
+ [88]=>
array(3) {
[0]=>
int(%d)
@@ -694,7 +685,7 @@ array(108) {
[2]=>
int(9)
}
- [90]=>
+ [89]=>
array(3) {
[0]=>
int(%d)
@@ -703,7 +694,7 @@ array(108) {
[2]=>
int(9)
}
- [91]=>
+ [90]=>
array(3) {
[0]=>
int(%d)
@@ -712,9 +703,9 @@ array(108) {
[2]=>
int(9)
}
- [92]=>
+ [91]=>
string(1) "-"
- [93]=>
+ [92]=>
array(3) {
[0]=>
int(%d)
@@ -723,7 +714,7 @@ array(108) {
[2]=>
int(9)
}
- [94]=>
+ [93]=>
array(3) {
[0]=>
int(%d)
@@ -732,7 +723,7 @@ array(108) {
[2]=>
int(9)
}
- [95]=>
+ [94]=>
array(3) {
[0]=>
int(%d)
@@ -741,7 +732,7 @@ array(108) {
[2]=>
int(9)
}
- [96]=>
+ [95]=>
array(3) {
[0]=>
int(%d)
@@ -750,9 +741,9 @@ array(108) {
[2]=>
int(9)
}
- [97]=>
+ [96]=>
string(1) ";"
- [98]=>
+ [97]=>
array(3) {
[0]=>
int(%d)
@@ -762,7 +753,7 @@ array(108) {
[2]=>
int(9)
}
- [99]=>
+ [98]=>
array(3) {
[0]=>
int(%d)
@@ -771,7 +762,7 @@ array(108) {
[2]=>
int(10)
}
- [100]=>
+ [99]=>
array(3) {
[0]=>
int(%d)
@@ -780,9 +771,9 @@ array(108) {
[2]=>
int(10)
}
- [101]=>
+ [100]=>
string(1) "="
- [102]=>
+ [101]=>
array(3) {
[0]=>
int(%d)
@@ -791,7 +782,7 @@ array(108) {
[2]=>
int(10)
}
- [103]=>
+ [102]=>
array(3) {
[0]=>
int(%d)
@@ -800,7 +791,7 @@ array(108) {
[2]=>
int(10)
}
- [104]=>
+ [103]=>
array(3) {
[0]=>
int(%d)
@@ -809,9 +800,9 @@ array(108) {
[2]=>
int(10)
}
- [105]=>
+ [104]=>
string(1) ";"
- [106]=>
+ [105]=>
array(3) {
[0]=>
int(%d)
@@ -821,7 +812,7 @@ array(108) {
[2]=>
int(10)
}
- [107]=>
+ [106]=>
array(3) {
[0]=>
int(%d)
diff --git a/ext/tokenizer/tests/token_get_all_variation9.phpt b/ext/tokenizer/tests/token_get_all_variation9.phpt
index 1662fb27f3..45660e984c 100644
--- a/ext/tokenizer/tests/token_get_all_variation9.phpt
+++ b/ext/tokenizer/tests/token_get_all_variation9.phpt
@@ -5,7 +5,7 @@ Test token_get_all() function : usage variations - with different types of comme
--FILE--
<?php
/* Prototype : array token_get_all(string $source)
- * Description: splits the given source into an array of PHP languange tokens
+ * Description: splits the given source into an array of PHP language tokens
* Source code: ext/tokenizer/tokenizer.c
*/
@@ -20,7 +20,7 @@ echo "*** Testing token_get_all() : 'source' string with different comments ***\
// types of comments: '//', '/* */', '#' & /** */
-$source = '<?php
+$source = '<?php
/** Performing addition operation on given values :
* a, b
*/
@@ -30,8 +30,8 @@ $a = 10;
$b = 20;
$c = true; // bool value
-/*
- * Performing operation on $a,$b
+/*
+ * Performing operation on $a,$b
* display result
*/
$c = $a + $b;
@@ -45,27 +45,18 @@ echo "Done"
?>
--EXPECTF--
*** Testing token_get_all() : 'source' string with different comments ***
-array(51) {
+array(50) {
[0]=>
array(3) {
[0]=>
int(%d)
[1]=>
- string(6) "<?php "
- [2]=>
- int(1)
- }
- [1]=>
- array(3) {
- [0]=>
- int(%d)
- [1]=>
- string(1) "
+ string(6) "<?php
"
[2]=>
int(1)
}
- [2]=>
+ [1]=>
array(3) {
[0]=>
int(%d)
@@ -76,7 +67,7 @@ array(51) {
[2]=>
int(2)
}
- [3]=>
+ [2]=>
array(3) {
[0]=>
int(%d)
@@ -87,7 +78,7 @@ array(51) {
[2]=>
int(4)
}
- [4]=>
+ [3]=>
array(3) {
[0]=>
int(%d)
@@ -97,7 +88,7 @@ array(51) {
[2]=>
int(6)
}
- [5]=>
+ [4]=>
array(3) {
[0]=>
int(%d)
@@ -106,7 +97,7 @@ array(51) {
[2]=>
int(7)
}
- [6]=>
+ [5]=>
array(3) {
[0]=>
int(%d)
@@ -115,9 +106,9 @@ array(51) {
[2]=>
int(7)
}
- [7]=>
+ [6]=>
string(1) "="
- [8]=>
+ [7]=>
array(3) {
[0]=>
int(%d)
@@ -126,7 +117,7 @@ array(51) {
[2]=>
int(7)
}
- [9]=>
+ [8]=>
array(3) {
[0]=>
int(%d)
@@ -135,9 +126,9 @@ array(51) {
[2]=>
int(7)
}
- [10]=>
+ [9]=>
string(1) ";"
- [11]=>
+ [10]=>
array(3) {
[0]=>
int(%d)
@@ -147,7 +138,7 @@ array(51) {
[2]=>
int(7)
}
- [12]=>
+ [11]=>
array(3) {
[0]=>
int(%d)
@@ -156,7 +147,7 @@ array(51) {
[2]=>
int(8)
}
- [13]=>
+ [12]=>
array(3) {
[0]=>
int(%d)
@@ -165,9 +156,9 @@ array(51) {
[2]=>
int(8)
}
- [14]=>
+ [13]=>
string(1) "="
- [15]=>
+ [14]=>
array(3) {
[0]=>
int(%d)
@@ -176,7 +167,7 @@ array(51) {
[2]=>
int(8)
}
- [16]=>
+ [15]=>
array(3) {
[0]=>
int(%d)
@@ -185,9 +176,9 @@ array(51) {
[2]=>
int(8)
}
- [17]=>
+ [16]=>
string(1) ";"
- [18]=>
+ [17]=>
array(3) {
[0]=>
int(%d)
@@ -197,7 +188,7 @@ array(51) {
[2]=>
int(8)
}
- [19]=>
+ [18]=>
array(3) {
[0]=>
int(%d)
@@ -206,7 +197,7 @@ array(51) {
[2]=>
int(9)
}
- [20]=>
+ [19]=>
array(3) {
[0]=>
int(%d)
@@ -215,9 +206,9 @@ array(51) {
[2]=>
int(9)
}
- [21]=>
+ [20]=>
string(1) "="
- [22]=>
+ [21]=>
array(3) {
[0]=>
int(%d)
@@ -226,7 +217,7 @@ array(51) {
[2]=>
int(9)
}
- [23]=>
+ [22]=>
array(3) {
[0]=>
int(%d)
@@ -235,9 +226,9 @@ array(51) {
[2]=>
int(9)
}
- [24]=>
+ [23]=>
string(1) ";"
- [25]=>
+ [24]=>
array(3) {
[0]=>
int(%d)
@@ -246,7 +237,7 @@ array(51) {
[2]=>
int(9)
}
- [26]=>
+ [25]=>
array(3) {
[0]=>
int(%d)
@@ -256,7 +247,7 @@ array(51) {
[2]=>
int(9)
}
- [27]=>
+ [26]=>
array(3) {
[0]=>
int(%d)
@@ -266,19 +257,19 @@ array(51) {
[2]=>
int(10)
}
- [28]=>
+ [27]=>
array(3) {
[0]=>
int(%d)
[1]=>
- string(59) "/*
- * Performing operation on $a,$b
+ string(57) "/*
+ * Performing operation on $a,$b
* display result
*/"
[2]=>
int(11)
}
- [29]=>
+ [28]=>
array(3) {
[0]=>
int(%d)
@@ -288,7 +279,7 @@ array(51) {
[2]=>
int(14)
}
- [30]=>
+ [29]=>
array(3) {
[0]=>
int(%d)
@@ -297,7 +288,7 @@ array(51) {
[2]=>
int(15)
}
- [31]=>
+ [30]=>
array(3) {
[0]=>
int(%d)
@@ -306,9 +297,9 @@ array(51) {
[2]=>
int(15)
}
- [32]=>
+ [31]=>
string(1) "="
- [33]=>
+ [32]=>
array(3) {
[0]=>
int(%d)
@@ -317,7 +308,7 @@ array(51) {
[2]=>
int(15)
}
- [34]=>
+ [33]=>
array(3) {
[0]=>
int(%d)
@@ -326,7 +317,7 @@ array(51) {
[2]=>
int(15)
}
- [35]=>
+ [34]=>
array(3) {
[0]=>
int(%d)
@@ -335,9 +326,9 @@ array(51) {
[2]=>
int(15)
}
- [36]=>
+ [35]=>
string(1) "+"
- [37]=>
+ [36]=>
array(3) {
[0]=>
int(%d)
@@ -346,7 +337,7 @@ array(51) {
[2]=>
int(15)
}
- [38]=>
+ [37]=>
array(3) {
[0]=>
int(%d)
@@ -355,9 +346,9 @@ array(51) {
[2]=>
int(15)
}
- [39]=>
+ [38]=>
string(1) ";"
- [40]=>
+ [39]=>
array(3) {
[0]=>
int(%d)
@@ -367,7 +358,7 @@ array(51) {
[2]=>
int(15)
}
- [41]=>
+ [40]=>
array(3) {
[0]=>
int(%d)
@@ -376,9 +367,9 @@ array(51) {
[2]=>
int(16)
}
- [42]=>
+ [41]=>
string(1) "("
- [43]=>
+ [42]=>
array(3) {
[0]=>
int(%d)
@@ -387,11 +378,11 @@ array(51) {
[2]=>
int(16)
}
- [44]=>
+ [43]=>
string(1) ")"
- [45]=>
+ [44]=>
string(1) ";"
- [46]=>
+ [45]=>
array(3) {
[0]=>
int(%d)
@@ -400,7 +391,7 @@ array(51) {
[2]=>
int(16)
}
- [47]=>
+ [46]=>
array(3) {
[0]=>
int(%d)
@@ -410,7 +401,7 @@ array(51) {
[2]=>
int(16)
}
- [48]=>
+ [47]=>
array(3) {
[0]=>
int(%d)
@@ -420,7 +411,7 @@ array(51) {
[2]=>
int(17)
}
- [49]=>
+ [48]=>
array(3) {
[0]=>
int(%d)
@@ -430,7 +421,7 @@ array(51) {
[2]=>
int(18)
}
- [50]=>
+ [49]=>
array(3) {
[0]=>
int(%d)
diff --git a/ext/tokenizer/tokenizer.c b/ext/tokenizer/tokenizer.c
index 3d343fec4d..cf5be94226 100644
--- a/ext/tokenizer/tokenizer.c
+++ b/ext/tokenizer/tokenizer.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -24,6 +22,7 @@
#include "php_ini.h"
#include "ext/standard/info.h"
#include "php_tokenizer.h"
+#include "tokenizer_arginfo.h"
#include "zend.h"
#include "zend_exceptions.h"
@@ -42,17 +41,6 @@ void tokenizer_token_get_all_register_constants(INIT_FUNC_ARGS) {
REGISTER_LONG_CONSTANT("TOKEN_PARSE", TOKEN_PARSE, CONST_CS|CONST_PERSISTENT);
}
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_token_get_all, 0, 0, 1)
- ZEND_ARG_INFO(0, source)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_token_name, 0, 0, 1)
- ZEND_ARG_INFO(0, token)
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ tokenizer_functions[]
*
* Every user visible function must have an entry in tokenizer_functions[].
diff --git a/ext/tokenizer/tokenizer.stub.php b/ext/tokenizer/tokenizer.stub.php
new file mode 100644
index 0000000000..f42825d7dc
--- /dev/null
+++ b/ext/tokenizer/tokenizer.stub.php
@@ -0,0 +1,5 @@
+<?php
+
+function token_get_all(string $source, int $flags = 0): array|false {}
+
+function token_name(int $token): string {}
diff --git a/ext/tokenizer/tokenizer_arginfo.h b/ext/tokenizer/tokenizer_arginfo.h
new file mode 100644
index 0000000000..4cf8c65fe3
--- /dev/null
+++ b/ext/tokenizer/tokenizer_arginfo.h
@@ -0,0 +1,10 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_token_get_all, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, source, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_token_name, 0, 1, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, token, IS_LONG, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/tokenizer/tokenizer_data.c b/ext/tokenizer/tokenizer_data.c
index cc3a1f939f..414202ff3b 100644
--- a/ext/tokenizer/tokenizer_data.c
+++ b/ext/tokenizer/tokenizer_data.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/tokenizer/tokenizer_data_gen.sh b/ext/tokenizer/tokenizer_data_gen.sh
index 979ecb983c..4d5e97ddde 100755
--- a/ext/tokenizer/tokenizer_data_gen.sh
+++ b/ext/tokenizer/tokenizer_data_gen.sh
@@ -18,8 +18,6 @@ fi
echo '/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/xml/compat.c b/ext/xml/compat.c
index be988a822f..aaef302ef2 100644
--- a/ext/xml/compat.c
+++ b/ext/xml/compat.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/xml/expat_compat.h b/ext/xml/expat_compat.h
index 350d42f0c6..e5673be779 100644
--- a/ext/xml/expat_compat.h
+++ b/ext/xml/expat_compat.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/xml/php_xml.h b/ext/xml/php_xml.h
index f8bb415f32..56d983b451 100644
--- a/ext/xml/php_xml.h
+++ b/ext/xml/php_xml.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/xml/tests/bug25666.phpt b/ext/xml/tests/bug25666.phpt
index e162d5a2bd..ca4b15f405 100644
--- a/ext/xml/tests/bug25666.phpt
+++ b/ext/xml/tests/bug25666.phpt
@@ -8,7 +8,7 @@ if (! @xml_parser_create_ns('ISO-8859-1')) { die("skip xml_parser_create_ns is n
--FILE--
<?php
function start_elem($parser,$name,$attribs) {
- var_dump($name);
+ var_dump($name);
}
function end_elem()
{
@@ -17,7 +17,7 @@ function end_elem()
$xml = <<<HERE
<foo:a xmlns:foo="http://example.com/foo"
xmlns:bar="http://example.com/bar"
- xmlns:baz="http://example.com/baz">
+ xmlns:baz="http://example.com/baz">
<bar:b />
<baz:c />
</foo>
diff --git a/ext/xml/tests/bug26528.phpt b/ext/xml/tests/bug26528.phpt
index 96da841004..152a18540d 100644
--- a/ext/xml/tests/bug26528.phpt
+++ b/ext/xml/tests/bug26528.phpt
@@ -6,11 +6,11 @@ require_once("skipif.inc");
?>
--FILE--
<?php
- $sample = "<?xml version=\"1.0\"?><test attr=\"angle&lt;bracket\"/>";
- $parser = xml_parser_create();
- $res = xml_parse_into_struct($parser,$sample,$vals,$index);
- xml_parser_free($parser);
- var_dump($vals);
+ $sample = "<?xml version=\"1.0\"?><test attr=\"angle&lt;bracket\"/>";
+ $parser = xml_parser_create();
+ $res = xml_parse_into_struct($parser,$sample,$vals,$index);
+ xml_parser_free($parser);
+ var_dump($vals);
?>
--EXPECT--
array(1) {
diff --git a/ext/xml/tests/bug26614.phpt b/ext/xml/tests/bug26614.phpt
index c95997a8a6..ed42bc1fbf 100644
--- a/ext/xml/tests/bug26614.phpt
+++ b/ext/xml/tests/bug26614.phpt
@@ -25,7 +25,7 @@ $xmls["CDATA"] ='<?xml version="1.0" encoding="iso-8859-1" ?>
<data>
<![CDATA[
multi
-line
+line
CDATA
block
]]>
@@ -36,7 +36,7 @@ $xmls["Comment"] ='<?xml version="1.0" encoding="iso-8859-1" ?>
<data>
<!-- ATA[
multi
-line
+line
CDATA
block
-->
@@ -47,7 +47,7 @@ $xmls["Text"] ='<?xml version="1.0" encoding="iso-8859-1" ?>
<data>
-!-- ATA[
multi
-line
+line
CDATA
block
---
@@ -55,16 +55,16 @@ block
function startElement($parser, $name, $attrs) {
printf("<$name> at line %d, col %d (byte %d)\n",
- xml_get_current_line_number($parser),
- xml_get_current_column_number($parser),
- xml_get_current_byte_index($parser));
+ xml_get_current_line_number($parser),
+ xml_get_current_column_number($parser),
+ xml_get_current_byte_index($parser));
}
function endElement($parser, $name) {
printf("</$name> at line %d, col %d (byte %d)\n",
- xml_get_current_line_number($parser),
- xml_get_current_column_number($parser),
- xml_get_current_byte_index($parser));
+ xml_get_current_line_number($parser),
+ xml_get_current_column_number($parser),
+ xml_get_current_byte_index($parser));
}
function characterData($parser, $data) {
@@ -73,12 +73,12 @@ function characterData($parser, $data) {
foreach ($xmls as $desc => $xml) {
echo "$desc\n";
- $xml_parser = xml_parser_create();
- xml_set_element_handler($xml_parser, "startElement", "endElement");
- xml_set_character_data_handler($xml_parser, "characterData");
- if (!xml_parse($xml_parser, $xml, true))
- echo "Error: ".xml_error_string(xml_get_error_code($xml_parser))."\n";
- xml_parser_free($xml_parser);
+ $xml_parser = xml_parser_create();
+ xml_set_element_handler($xml_parser, "startElement", "endElement");
+ xml_set_character_data_handler($xml_parser, "characterData");
+ if (!xml_parse($xml_parser, $xml, true))
+ echo "Error: ".xml_error_string(xml_get_error_code($xml_parser))."\n";
+ xml_parser_free($xml_parser);
}
?>
--EXPECT--
diff --git a/ext/xml/tests/bug26614_libxml.phpt b/ext/xml/tests/bug26614_libxml.phpt
index 3ddd35ed0e..b6c0b87581 100644
--- a/ext/xml/tests/bug26614_libxml.phpt
+++ b/ext/xml/tests/bug26614_libxml.phpt
@@ -12,7 +12,7 @@ this test works fine with Expat but fails with libxml
which we now use as default
further investigation has shown that not only line count
-is skippet on CDATA sections but that libxml does also
+is skipped on CDATA sections but that libxml does also
show different column numbers and byte positions depending
on context and in opposition to what one would expect to
see and what good old Expat reported just fine ...
@@ -25,7 +25,7 @@ $xmls["CDATA"] ='<?xml version="1.0" encoding="iso-8859-1" ?>
<data>
<![CDATA[
multi
-line
+line
CDATA
block
]]>
@@ -36,7 +36,7 @@ $xmls["Comment"] ='<?xml version="1.0" encoding="iso-8859-1" ?>
<data>
<!-- ATA[
multi
-line
+line
CDATA
block
-->
@@ -47,7 +47,7 @@ $xmls["Text"] ='<?xml version="1.0" encoding="iso-8859-1" ?>
<data>
-!-- ATA[
multi
-line
+line
CDATA
block
---
@@ -55,16 +55,16 @@ block
function startElement($parser, $name, $attrs) {
printf("<$name> at line %d, col %d (byte %d)\n",
- xml_get_current_line_number($parser),
- xml_get_current_column_number($parser),
- xml_get_current_byte_index($parser));
+ xml_get_current_line_number($parser),
+ xml_get_current_column_number($parser),
+ xml_get_current_byte_index($parser));
}
function endElement($parser, $name) {
printf("</$name> at line %d, col %d (byte %d)\n",
- xml_get_current_line_number($parser),
- xml_get_current_column_number($parser),
- xml_get_current_byte_index($parser));
+ xml_get_current_line_number($parser),
+ xml_get_current_column_number($parser),
+ xml_get_current_byte_index($parser));
}
function characterData($parser, $data) {
@@ -73,21 +73,21 @@ function characterData($parser, $data) {
foreach ($xmls as $desc => $xml) {
echo "$desc\n";
- $xml_parser = xml_parser_create();
- xml_set_element_handler($xml_parser, "startElement", "endElement");
- xml_set_character_data_handler($xml_parser, "characterData");
- if (!xml_parse($xml_parser, $xml, true))
- echo "Error: ".xml_error_string(xml_get_error_code($xml_parser))."\n";
- xml_parser_free($xml_parser);
+ $xml_parser = xml_parser_create();
+ xml_set_element_handler($xml_parser, "startElement", "endElement");
+ xml_set_character_data_handler($xml_parser, "characterData");
+ if (!xml_parse($xml_parser, $xml, true))
+ echo "Error: ".xml_error_string(xml_get_error_code($xml_parser))."\n";
+ xml_parser_free($xml_parser);
}
?>
--EXPECTF--
CDATA
<DATA> at line 2, col %d (byte 9)
-</DATA> at line 9, col %d (byte 56)
+</DATA> at line 9, col %d (byte 55)
Comment
<DATA> at line 2, col %d (byte 9)
-</DATA> at line 9, col %d (byte 56)
+</DATA> at line 9, col %d (byte 55)
Text
<DATA> at line 2, col %d (byte 9)
-</DATA> at line 9, col %d (byte 56)
+</DATA> at line 9, col %d (byte 55)
diff --git a/ext/xml/tests/bug30266.phpt b/ext/xml/tests/bug30266.phpt
index 2cf0a68cde..a7fe7592fe 100644
--- a/ext/xml/tests/bug30266.phpt
+++ b/ext/xml/tests/bug30266.phpt
@@ -33,7 +33,7 @@ class XML_Parser
function startHandler($XmlParser, $tag, $attr)
{
$this->dummy = "b";
- throw new Exception("ex");
+ throw new Exception("ex");
}
function endHandler($XmlParser, $tag)
@@ -45,7 +45,7 @@ $p1 = new Xml_Parser();
try {
$p1->parse('<tag1><tag2></tag2></tag1>');
} catch (Exception $e) {
- echo "OK\n";
+ echo "OK\n";
}
?>
--EXPECT--
diff --git a/ext/xml/tests/bug30875.phpt b/ext/xml/tests/bug30875.phpt
index c5254e9668..c7983c45da 100644
--- a/ext/xml/tests/bug30875.phpt
+++ b/ext/xml/tests/bug30875.phpt
@@ -19,7 +19,6 @@ xml_parse_into_struct($parser, $xml, $vals);
xml_parser_free($parser);
var_dump($vals);
?>
-===DONE===
--EXPECT--
array(1) {
[0]=>
@@ -39,4 +38,3 @@ array(1) {
string(4) "aent"
}
}
-===DONE===
diff --git a/ext/xml/tests/bug32001.phpt b/ext/xml/tests/bug32001.phpt
index 2e2f4643d5..5ced128940 100644
--- a/ext/xml/tests/bug32001.phpt
+++ b/ext/xml/tests/bug32001.phpt
@@ -10,146 +10,146 @@ if (ICONV_IMPL == 'glibc' && version_compare(ICONV_VERSION, '2.12', '<='))
--FILE--
<?php
class testcase {
- private $encoding;
- private $bom;
- private $prologue;
- private $tags;
- private $chunk_size;
+ private $encoding;
+ private $bom;
+ private $prologue;
+ private $tags;
+ private $chunk_size;
- function __construct($enc, $chunk_size = 0, $bom = 0, $omit_prologue = 0) {
- $this->encoding = $enc;
- $this->chunk_size = $chunk_size;
- $this->bom = $bom;
- $this->prologue = !$omit_prologue;
- $this->tags = array();
- }
+ function __construct($enc, $chunk_size = 0, $bom = 0, $omit_prologue = 0) {
+ $this->encoding = $enc;
+ $this->chunk_size = $chunk_size;
+ $this->bom = $bom;
+ $this->prologue = !$omit_prologue;
+ $this->tags = array();
+ }
- function start_element($parser, $name, $attrs) {
- $attrs = array_map('bin2hex', $attrs);
- $this->tags[] = bin2hex($name).": ".implode(', ', $attrs);
- }
+ function start_element($parser, $name, $attrs) {
+ $attrs = array_map('bin2hex', $attrs);
+ $this->tags[] = bin2hex($name).": ".implode(', ', $attrs);
+ }
- function end_element($parser, $name) {
- }
+ function end_element($parser, $name) {
+ }
- function run() {
- $data = '';
+ function run() {
+ $data = '';
- if ($this->prologue) {
- $canonical_name = preg_replace('/BE|LE/i', '', $this->encoding);
- $data .= "<?xml version=\"1.0\" encoding=\"$canonical_name\" ?>\n";
- }
+ if ($this->prologue) {
+ $canonical_name = preg_replace('/BE|LE/i', '', $this->encoding);
+ $data .= "<?xml version=\"1.0\" encoding=\"$canonical_name\" ?>\n";
+ }
- $data .= <<<HERE
+ $data .= <<<HERE
<テスト:テスト1 xmlns:テスト="http://www.example.com/テスト/" テスト="テスト">
<テスト:テスト2 テスト="テスト">
- <テスト:テスト3>
- test!
- </テスト:テスト3>
+ <テスト:テスト3>
+ test!
+ </テスト:テスト3>
</テスト:テスト2>
</テスト:テスト1>
HERE;
- $data = iconv("UTF-8", $this->encoding, $data);
+ $data = iconv("UTF-8", $this->encoding, $data);
- if ($this->bom) {
- switch (strtoupper($this->encoding)) {
- case 'UTF-8':
- case 'UTF8':
- $data = "\xef\xbb\xbf".$data;
- break;
+ if ($this->bom) {
+ switch (strtoupper($this->encoding)) {
+ case 'UTF-8':
+ case 'UTF8':
+ $data = "\xef\xbb\xbf".$data;
+ break;
- case 'UTF-16':
- case 'UTF16':
- case 'UTF-16BE':
- case 'UTF16BE':
- case 'UCS-2':
- case 'UCS2':
- case 'UCS-2BE':
- case 'UCS2BE':
- $data = "\xfe\xff".$data;
- break;
+ case 'UTF-16':
+ case 'UTF16':
+ case 'UTF-16BE':
+ case 'UTF16BE':
+ case 'UCS-2':
+ case 'UCS2':
+ case 'UCS-2BE':
+ case 'UCS2BE':
+ $data = "\xfe\xff".$data;
+ break;
- case 'UTF-16LE':
- case 'UTF16LE':
- case 'UCS-2LE':
- case 'UCS2LE':
- $data = "\xff\xfe".$data;
- break;
+ case 'UTF-16LE':
+ case 'UTF16LE':
+ case 'UCS-2LE':
+ case 'UCS2LE':
+ $data = "\xff\xfe".$data;
+ break;
- case 'UTF-32':
- case 'UTF32':
- case 'UTF-32BE':
- case 'UTF32BE':
- case 'UCS-4':
- case 'UCS4':
- case 'UCS-4BE':
- case 'UCS4BE':
- $data = "\x00\x00\xfe\xff".$data;
- break;
+ case 'UTF-32':
+ case 'UTF32':
+ case 'UTF-32BE':
+ case 'UTF32BE':
+ case 'UCS-4':
+ case 'UCS4':
+ case 'UCS-4BE':
+ case 'UCS4BE':
+ $data = "\x00\x00\xfe\xff".$data;
+ break;
- case 'UTF-32LE':
- case 'UTF32LE':
- case 'UCS-4LE':
- case 'UCS4LE':
- $data = "\xff\xfe\x00\x00".$data;
- break;
- }
- }
+ case 'UTF-32LE':
+ case 'UTF32LE':
+ case 'UCS-4LE':
+ case 'UCS4LE':
+ $data = "\xff\xfe\x00\x00".$data;
+ break;
+ }
+ }
- $parser = xml_parser_create(NULL);
- xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
- xml_set_element_handler($parser, "start_element", "end_element");
- xml_set_object($parser, $this);
+ $parser = xml_parser_create(NULL);
+ xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
+ xml_set_element_handler($parser, "start_element", "end_element");
+ xml_set_object($parser, $this);
- if ($this->chunk_size == 0) {
- $success = @xml_parse($parser, $data, true);
- } else {
- for ($offset = 0; $offset < strlen($data);
- $offset += $this->chunk_size) {
- $success = @xml_parse($parser, substr($data, $offset, $this->chunk_size), false);
- if (!$success) {
- break;
- }
- }
- if ($success) {
- $success = @xml_parse($parser, "", true);
- }
- }
+ if ($this->chunk_size == 0) {
+ $success = @xml_parse($parser, $data, true);
+ } else {
+ for ($offset = 0; $offset < strlen($data);
+ $offset += $this->chunk_size) {
+ $success = @xml_parse($parser, substr($data, $offset, $this->chunk_size), false);
+ if (!$success) {
+ break;
+ }
+ }
+ if ($success) {
+ $success = @xml_parse($parser, "", true);
+ }
+ }
- echo "Encoding: $this->encoding\n";
- echo "XML Prologue: ".($this->prologue ? 'present': 'not present'), "\n";
- echo "Chunk size: ".($this->chunk_size ? "$this->chunk_size byte(s)\n": "all data at once\n");
- echo "BOM: ".($this->bom ? 'prepended': 'not prepended'), "\n";
+ echo "Encoding: $this->encoding\n";
+ echo "XML Prologue: ".($this->prologue ? 'present': 'not present'), "\n";
+ echo "Chunk size: ".($this->chunk_size ? "$this->chunk_size byte(s)\n": "all data at once\n");
+ echo "BOM: ".($this->bom ? 'prepended': 'not prepended'), "\n";
- if ($success) {
- var_dump($this->tags);
- } else {
- echo "[Error] ", xml_error_string(xml_get_error_code($parser)), "\n";
- }
- }
+ if ($success) {
+ var_dump($this->tags);
+ } else {
+ echo "[Error] ", xml_error_string(xml_get_error_code($parser)), "\n";
+ }
+ }
}
$suite = array(
- new testcase("UTF-8", 0, 0, 0),
- new testcase("UTF-8", 0, 0, 1),
- new testcase("UTF-8", 0, 1, 0),
- new testcase("UTF-8", 0, 1, 1),
- new testcase("UTF-16BE", 0, 0, 0),
- new testcase("UTF-16BE", 0, 1, 0),
- new testcase("UTF-16BE", 0, 1, 1),
- new testcase("UTF-16LE", 0, 0, 0),
- new testcase("UTF-16LE", 0, 1, 0),
- new testcase("UTF-16LE", 0, 1, 1),
- new testcase("UTF-8", 1, 0, 0),
- new testcase("UTF-8", 1, 0, 1),
- new testcase("UTF-8", 1, 1, 0),
- new testcase("UTF-8", 1, 1, 1),
- new testcase("UTF-16BE", 1, 0, 0),
- new testcase("UTF-16BE", 1, 1, 0),
- new testcase("UTF-16BE", 1, 1, 1),
- new testcase("UTF-16LE", 1, 0, 0),
- new testcase("UTF-16LE", 1, 1, 0),
- new testcase("UTF-16LE", 1, 1, 1),
+ new testcase("UTF-8", 0, 0, 0),
+ new testcase("UTF-8", 0, 0, 1),
+ new testcase("UTF-8", 0, 1, 0),
+ new testcase("UTF-8", 0, 1, 1),
+ new testcase("UTF-16BE", 0, 0, 0),
+ new testcase("UTF-16BE", 0, 1, 0),
+ new testcase("UTF-16BE", 0, 1, 1),
+ new testcase("UTF-16LE", 0, 0, 0),
+ new testcase("UTF-16LE", 0, 1, 0),
+ new testcase("UTF-16LE", 0, 1, 1),
+ new testcase("UTF-8", 1, 0, 0),
+ new testcase("UTF-8", 1, 0, 1),
+ new testcase("UTF-8", 1, 1, 0),
+ new testcase("UTF-8", 1, 1, 1),
+ new testcase("UTF-16BE", 1, 0, 0),
+ new testcase("UTF-16BE", 1, 1, 0),
+ new testcase("UTF-16BE", 1, 1, 1),
+ new testcase("UTF-16LE", 1, 0, 0),
+ new testcase("UTF-16LE", 1, 1, 0),
+ new testcase("UTF-16LE", 1, 1, 1),
);
if (XML_SAX_IMPL == 'libxml') {
@@ -159,7 +159,7 @@ if (XML_SAX_IMPL == 'libxml') {
}
foreach ($suite as $testcase) {
- $testcase->run();
+ $testcase->run();
}
?>
diff --git a/ext/xml/tests/bug32001b.phpt b/ext/xml/tests/bug32001b.phpt
index 3a3c11a3ba..a7762fffca 100644
--- a/ext/xml/tests/bug32001b.phpt
+++ b/ext/xml/tests/bug32001b.phpt
@@ -11,87 +11,87 @@ foreach(array('EUC-JP', 'Shift_JISP', 'GB2312') as $encoding) {
--FILE--
<?php
class testcase {
- private $encoding;
- private $bom;
- private $prologue;
- private $tags;
- private $chunk_size;
+ private $encoding;
+ private $bom;
+ private $prologue;
+ private $tags;
+ private $chunk_size;
- function testcase($enc, $chunk_size = 0, $bom = 0, $omit_prologue = 0) {
- $this->encoding = $enc;
- $this->chunk_size = $chunk_size;
- $this->bom = $bom;
- $this->prologue = !$omit_prologue;
- $this->tags = array();
- }
+ function testcase($enc, $chunk_size = 0, $bom = 0, $omit_prologue = 0) {
+ $this->encoding = $enc;
+ $this->chunk_size = $chunk_size;
+ $this->bom = $bom;
+ $this->prologue = !$omit_prologue;
+ $this->tags = array();
+ }
- function start_element($parser, $name, $attrs) {
- $attrs = array_map('bin2hex', $attrs);
- $this->tags[] = bin2hex($name).": ".implode(', ', $attrs);
- }
+ function start_element($parser, $name, $attrs) {
+ $attrs = array_map('bin2hex', $attrs);
+ $this->tags[] = bin2hex($name).": ".implode(', ', $attrs);
+ }
- function end_element($parser, $name) {
- }
+ function end_element($parser, $name) {
+ }
- function run() {
- $data = '';
+ function run() {
+ $data = '';
- if ($this->prologue) {
- $canonical_name = preg_replace('/BE|LE/i', '', $this->encoding);
- $data .= "<?xml version=\"1.0\" encoding=\"$canonical_name\" ?>\n";
- }
+ if ($this->prologue) {
+ $canonical_name = preg_replace('/BE|LE/i', '', $this->encoding);
+ $data .= "<?xml version=\"1.0\" encoding=\"$canonical_name\" ?>\n";
+ }
- $data .= <<<HERE
+ $data .= <<<HERE
<テスト:テスト1 xmlns:テスト="http://www.example.com/テスト/" テスト="テスト">
<テスト:テスト2 テスト="テスト">
- <テスト:テスト3>
- test!
- </テスト:テスト3>
+ <テスト:テスト3>
+ test!
+ </テスト:テスト3>
</テスト:テスト2>
</テスト:テスト1>
HERE;
- $data = iconv("UTF-8", $this->encoding, $data);
+ $data = iconv("UTF-8", $this->encoding, $data);
- $parser = xml_parser_create(NULL);
- xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
- xml_set_element_handler($parser, "start_element", "end_element");
- xml_set_object($parser, $this);
+ $parser = xml_parser_create(NULL);
+ xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
+ xml_set_element_handler($parser, "start_element", "end_element");
+ xml_set_object($parser, $this);
- if ($this->chunk_size == 0) {
- $success = @xml_parse($parser, $data, true);
- } else {
- for ($offset = 0; $offset < strlen($data);
- $offset += $this->chunk_size) {
- $success = @xml_parse($parser, substr($data, $offset, $this->chunk_size), false);
- if (!$success) {
- break;
- }
- }
- if ($success) {
- $success = @xml_parse($parser, "", true);
- }
- }
+ if ($this->chunk_size == 0) {
+ $success = @xml_parse($parser, $data, true);
+ } else {
+ for ($offset = 0; $offset < strlen($data);
+ $offset += $this->chunk_size) {
+ $success = @xml_parse($parser, substr($data, $offset, $this->chunk_size), false);
+ if (!$success) {
+ break;
+ }
+ }
+ if ($success) {
+ $success = @xml_parse($parser, "", true);
+ }
+ }
- echo "Encoding: $this->encoding\n";
- echo "XML Prologue: ".($this->prologue ? 'present': 'not present'), "\n";
- echo "Chunk size: ".($this->chunk_size ? "$this->chunk_size byte(s)\n": "all data at once\n");
- echo "BOM: ".($this->bom ? 'prepended': 'not prepended'), "\n";
+ echo "Encoding: $this->encoding\n";
+ echo "XML Prologue: ".($this->prologue ? 'present': 'not present'), "\n";
+ echo "Chunk size: ".($this->chunk_size ? "$this->chunk_size byte(s)\n": "all data at once\n");
+ echo "BOM: ".($this->bom ? 'prepended': 'not prepended'), "\n";
- if ($success) {
- var_dump($this->tags);
- } else {
- echo "[Error] ", xml_error_string(xml_get_error_code($parser)), "\n";
- }
- }
+ if ($success) {
+ var_dump($this->tags);
+ } else {
+ echo "[Error] ", xml_error_string(xml_get_error_code($parser)), "\n";
+ }
+ }
}
$suite = array(
- new testcase("EUC-JP" , 0),
- new testcase("EUC-JP" , 1),
- new testcase("Shift_JIS", 0),
- new testcase("Shift_JIS", 1),
- new testcase("GB2312", 0),
- new testcase("GB2312", 1),
+ new testcase("EUC-JP" , 0),
+ new testcase("EUC-JP" , 1),
+ new testcase("Shift_JIS", 0),
+ new testcase("Shift_JIS", 1),
+ new testcase("GB2312", 0),
+ new testcase("GB2312", 1),
);
if (XML_SAX_IMPL == 'libxml') {
@@ -101,7 +101,7 @@ if (XML_SAX_IMPL == 'libxml') {
}
foreach ($suite as $testcase) {
- $testcase->run();
+ $testcase->run();
}
?>
diff --git a/ext/xml/tests/bug35447.phpt b/ext/xml/tests/bug35447.phpt
index 8cbb5e5193..0f5f5581d0 100644
--- a/ext/xml/tests/bug35447.phpt
+++ b/ext/xml/tests/bug35447.phpt
@@ -3,7 +3,7 @@ Bug #35447 (xml_parse_into_struct() chokes on the UTF-8 BOM)
--SKIPIF--
<?php
require_once("skipif.inc");
-if (! @xml_parser_create_ns('ISO-8859-1')) { die("skip xml_parser_create_ns is not supported on this plattform");}
+if (! @xml_parser_create_ns('ISO-8859-1')) { die("skip xml_parser_create_ns is not supported on this platform");}
?>
--FILE--
<?php
diff --git a/ext/xml/tests/bug71592.phpt b/ext/xml/tests/bug71592.phpt
index e76e7b4ef6..260ea989d9 100644
--- a/ext/xml/tests/bug71592.phpt
+++ b/ext/xml/tests/bug71592.phpt
@@ -26,7 +26,5 @@ xml_set_external_entity_ref_handler($parser, function () {
xml_parse($parser, $xml);
var_dump(xml_get_error_code($parser) === XML_ERROR_EXTERNAL_ENTITY_HANDLING);
?>
-===DONE===
--EXPECT--
bool(true)
-===DONE===
diff --git a/ext/xml/tests/bug72085.phpt b/ext/xml/tests/bug72085.phpt
index 44ae1f1cde..078210f569 100644
--- a/ext/xml/tests/bug72085.phpt
+++ b/ext/xml/tests/bug72085.phpt
@@ -10,7 +10,6 @@ $var1 = xml_parser_create_ns();
xml_set_element_handler($var1, new Exception(""), 4096);
xml_parse($var1, str_repeat("<a>", 10));
?>
-===DONE===
--EXPECTF--
Warning: Invalid callback Exception in %s%ebug72085.php:%d
Stack trace:
@@ -71,4 +70,3 @@ Stack trace:
#0 {main}, no array or string given in %s%ebug72085.php on line %d
Warning: xml_parse(): Unable to call handler in %s%ebug72085.php on line %d
-===DONE===
diff --git a/ext/xml/tests/bug72714.phpt b/ext/xml/tests/bug72714.phpt
index 7b44e1fd11..53b9239045 100644
--- a/ext/xml/tests/bug72714.phpt
+++ b/ext/xml/tests/bug72714.phpt
@@ -27,9 +27,7 @@ function parse($tagstart) {
parse(3015809298423721);
parse(20);
?>
-===DONE===
--EXPECTF--
Notice: xml_parser_set_option(): tagstart ignored, because it is out of range in %s%ebug72714.php on line %d
string(9) "NS1:TOTAL"
string(0) ""
-===DONE===
diff --git a/ext/xml/tests/bug72793.phpt b/ext/xml/tests/bug72793.phpt
new file mode 100644
index 0000000000..edbbaed884
--- /dev/null
+++ b/ext/xml/tests/bug72793.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Bug #72793: xml_parser_free leaks mem when execute xml_set_object
+--SKIPIF--
+<?php include("skipif.inc"); ?>
+--FILE--
+<?php
+
+class xml {
+ var $parser;
+
+ function __construct()
+ {
+ $this->parser = xml_parser_create();
+ xml_set_object($this->parser, $this);
+ }
+
+ function parse($data)
+ {
+ xml_parse($this->parser, $data);
+ }
+
+ function free(){
+ xml_parser_free($this->parser);
+ }
+}
+
+$xml_test = '<?xml version="1.0" encoding="utf-8"?><test></test>';
+$xml_parser = new xml();
+$xml_parser->parse($xml_test);
+$xml_parser->free();
+
+?>
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/ext/xml/tests/bug76874.phpt b/ext/xml/tests/bug76874.phpt
new file mode 100644
index 0000000000..ec0caae706
--- /dev/null
+++ b/ext/xml/tests/bug76874.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Bug #76874: xml_parser_free() should never leak memory
+--SKIPIF--
+<?php include("skipif.inc"); ?>
+--FILE--
+<?php
+
+class c
+{
+ private $xml;
+ private $test;
+
+ public function test()
+ {
+ $this->xml = xml_parser_create();
+ xml_set_character_data_handler($this->xml, array(&$this, 'handle_cdata'));
+ xml_parser_free($this->xml);
+ }
+
+ public function handle_cdata(&$parser, $data)
+ {
+ }
+}
+
+$object = new c();
+$object->test();
+
+?>
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/ext/xml/tests/bug78563.phpt b/ext/xml/tests/bug78563.phpt
new file mode 100644
index 0000000000..3203bbddc6
--- /dev/null
+++ b/ext/xml/tests/bug78563.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Bug #78563: parsers should not be clonable
+--SKIPIF--
+<?php include("skipif.inc"); ?>
+--FILE--
+<?php
+
+$parser = xml_parser_create();
+clone $parser;
+
+?>
+===DONE===
+--EXPECTF--
+Fatal error: Uncaught Error: Trying to clone an uncloneable object of class XmlParser in %s:%d
+Stack trace:
+#0 {main}
+ thrown in %s on line %d
diff --git a/ext/xml/tests/bug78563_final.phpt b/ext/xml/tests/bug78563_final.phpt
new file mode 100644
index 0000000000..23fac0d9bf
--- /dev/null
+++ b/ext/xml/tests/bug78563_final.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Bug #78563: parsers should not be extendable
+--SKIPIF--
+<?php include("skipif.inc"); ?>
+--FILE--
+<?php
+
+class Dummy extends Xmlparser {
+
+}
+
+?>
+===DONE===
+--EXPECTF--
+Fatal error: Class Dummy may not inherit from final class (XmlParser) in %s on line %d
diff --git a/ext/xml/tests/bug78563_serialize.phpt b/ext/xml/tests/bug78563_serialize.phpt
new file mode 100644
index 0000000000..d480446d24
--- /dev/null
+++ b/ext/xml/tests/bug78563_serialize.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Bug #78563: parsers should not be serializable
+--SKIPIF--
+<?php include("skipif.inc"); ?>
+--FILE--
+<?php
+
+$parser = xml_parser_create();
+serialize($parser);
+
+?>
+===DONE===
+--EXPECTF--
+Fatal error: Uncaught Exception: Serialization of 'XmlParser' is not allowed in %s:%d
+Stack trace:
+#0 %s(%d): serialize(Object(XmlParser))
+#1 {main}
+ thrown in %s on line %d
diff --git a/ext/xml/tests/xml001.phpt b/ext/xml/tests/xml001.phpt
index e859a4bbcb..2d8fe54041 100644
--- a/ext/xml/tests/xml001.phpt
+++ b/ext/xml/tests/xml001.phpt
@@ -22,54 +22,54 @@ if (!($fp = @fopen("xmltest.xml", "r"))) {
}
while ($data = fread($fp, 4096)) {
- if (!xml_parse($xml_parser, $data, feof($fp))) {
- die(sprintf("XML error: %s at line %d\n",
- xml_error_string(xml_get_error_code($xml_parser)),
- xml_get_current_line_number($xml_parser)));
- }
+ if (!xml_parse($xml_parser, $data, feof($fp))) {
+ die(sprintf("XML error: %s at line %d\n",
+ xml_error_string(xml_get_error_code($xml_parser)),
+ xml_get_current_line_number($xml_parser)));
+ }
}
print "parse complete\n";
xml_parser_free($xml_parser);
function startElement($parser, $name, $attribs)
{
- print '{'.$name;
- if (sizeof($attribs)) {
+ print '{'.$name;
+ if (sizeof($attribs)) {
foreach ($attribs as $k => $v) {
- print " $k=\"$v\"";
- }
- }
- print '}';
+ print " $k=\"$v\"";
+ }
+ }
+ print '}';
}
function endElement($parser, $name)
{
- print '{/'.$name.'}';
+ print '{/'.$name.'}';
}
function characterData($parser, $data)
{
- print '{CDATA['.$data.']}';
+ print '{CDATA['.$data.']}';
}
function PIHandler($parser, $target, $data)
{
- print '{PI['.$target.','.$data.']}';
+ print '{PI['.$target.','.$data.']}';
}
function defaultHandler($parser, $data)
{
- if (substr($data, 0, 1) == "&" && substr($data, -1, 1) == ";") {
- print '{ENTREF['.$data.']}';
- } else {
- print '{?['.$data.']}';
- }
+ if (substr($data, 0, 1) == "&" && substr($data, -1, 1) == ";") {
+ print '{ENTREF['.$data.']}';
+ } else {
+ print '{?['.$data.']}';
+ }
}
function externalEntityRefHandler($parser, $openEntityNames, $base, $systemId, $publicId)
{
- print '{EXTENTREF['.$openEntityNames.','.$base.','.$systemId.','.$publicId."]}\n";
- return true;
+ print '{EXTENTREF['.$openEntityNames.','.$base.','.$systemId.','.$publicId."]}\n";
+ return true;
}
?>
diff --git a/ext/xml/tests/xml002.phpt b/ext/xml/tests/xml002.phpt
index e183fa4ae3..27a920cedd 100644
--- a/ext/xml/tests/xml002.phpt
+++ b/ext/xml/tests/xml002.phpt
@@ -11,41 +11,41 @@ chdir(__DIR__);
class myclass
{
- function startElement($parser, $name, $attribs)
- {
- print '{'.$name;
- if (sizeof($attribs)) {
+ function startElement($parser, $name, $attribs)
+ {
+ print '{'.$name;
+ if (sizeof($attribs)) {
foreach ($attribs as $k => $v) {
- print " $k=\"$v\"";
- }
- }
- print '}';
- }
- function endElement($parser, $name)
- {
- print '{/'.$name.'}';
- }
- function characterData($parser, $data)
- {
- print '{CDATA['.$data.']}';
- }
- function PIHandler($parser, $target, $data)
- {
- print '{PI['.$target.','.$data.']}';
- }
- function defaultHandler($parser, $data)
- {
- if (substr($data, 0, 1) == "&" && substr($data, -1, 1) == ";") {
- print '{ENTREF['.$data.']}';
- } else {
- print '{?['.$data.']}';
- }
- }
- function externalEntityRefHandler($parser, $openEntityNames, $base, $systemId, $publicId)
- {
- print '{EXTENTREF['.$openEntityNames.','.$base.','.$systemId.','.$publicId."]}\n";
- return true;
- }
+ print " $k=\"$v\"";
+ }
+ }
+ print '}';
+ }
+ function endElement($parser, $name)
+ {
+ print '{/'.$name.'}';
+ }
+ function characterData($parser, $data)
+ {
+ print '{CDATA['.$data.']}';
+ }
+ function PIHandler($parser, $target, $data)
+ {
+ print '{PI['.$target.','.$data.']}';
+ }
+ function defaultHandler($parser, $data)
+ {
+ if (substr($data, 0, 1) == "&" && substr($data, -1, 1) == ";") {
+ print '{ENTREF['.$data.']}';
+ } else {
+ print '{?['.$data.']}';
+ }
+ }
+ function externalEntityRefHandler($parser, $openEntityNames, $base, $systemId, $publicId)
+ {
+ print '{EXTENTREF['.$openEntityNames.','.$base.','.$systemId.','.$publicId."]}\n";
+ return true;
+ }
}
$xml_parser = xml_parser_create();
@@ -60,15 +60,15 @@ xml_set_external_entity_ref_handler($xml_parser,
array($obj, "externalEntityRefHandler"));
if (!($fp = @fopen("xmltest.xml", "r"))) {
- die("could not open XML input");
+ die("could not open XML input");
}
while ($data = fread($fp, 4096)) {
- if (!xml_parse($xml_parser, $data, feof($fp))) {
- die(sprintf("XML error: %s at line %d\n",
- xml_error_string(xml_get_error_code($xml_parser)),
- xml_get_current_line_number($xml_parser)));
- }
+ if (!xml_parse($xml_parser, $data, feof($fp))) {
+ die(sprintf("XML error: %s at line %d\n",
+ xml_error_string(xml_get_error_code($xml_parser)),
+ xml_get_current_line_number($xml_parser)));
+ }
}
print "parse complete\n";
xml_parser_free($xml_parser);
diff --git a/ext/xml/tests/xml003.phpt b/ext/xml/tests/xml003.phpt
index fb4cbbd29e..08db287c18 100644
--- a/ext/xml/tests/xml003.phpt
+++ b/ext/xml/tests/xml003.phpt
@@ -11,41 +11,41 @@ chdir(__DIR__);
class myclass
{
- function startElement($parser, $name, $attribs)
- {
- print '{'.$name;
- if (sizeof($attribs)) {
+ function startElement($parser, $name, $attribs)
+ {
+ print '{'.$name;
+ if (sizeof($attribs)) {
foreach ($attribs as $k => $v) {
- print " $k=\"$v\"";
- }
- }
- print '}';
- }
- function endElement($parser, $name)
- {
- print '{/'.$name.'}';
- }
- function characterData($parser, $data)
- {
- print '{CDATA['.$data.']}';
- }
- function PIHandler($parser, $target, $data)
- {
- print '{PI['.$target.','.$data.']}';
- }
- function defaultHandler($parser, $data)
- {
- if (substr($data, 0, 1) == "&" && substr($data, -1, 1) == ";") {
- print '{ENTREF['.$data.']}';
- } else {
- print '{?['.$data.']}';
- }
- }
- function externalEntityRefHandler($parser, $openEntityNames, $base, $systemId, $publicId)
- {
- print '{EXTENTREF['.$openEntityNames.','.$base.','.$systemId.','.$publicId."]}\n";
- return true;
- }
+ print " $k=\"$v\"";
+ }
+ }
+ print '}';
+ }
+ function endElement($parser, $name)
+ {
+ print '{/'.$name.'}';
+ }
+ function characterData($parser, $data)
+ {
+ print '{CDATA['.$data.']}';
+ }
+ function PIHandler($parser, $target, $data)
+ {
+ print '{PI['.$target.','.$data.']}';
+ }
+ function defaultHandler($parser, $data)
+ {
+ if (substr($data, 0, 1) == "&" && substr($data, -1, 1) == ";") {
+ print '{ENTREF['.$data.']}';
+ } else {
+ print '{?['.$data.']}';
+ }
+ }
+ function externalEntityRefHandler($parser, $openEntityNames, $base, $systemId, $publicId)
+ {
+ print '{EXTENTREF['.$openEntityNames.','.$base.','.$systemId.','.$publicId."]}\n";
+ return true;
+ }
}
$xml_parser = xml_parser_create();
@@ -59,15 +59,15 @@ xml_set_default_handler($xml_parser, "defaultHandler");
xml_set_external_entity_ref_handler($xml_parser, "externalEntityRefHandler");
if (!($fp = @fopen("xmltest.xml", "r"))) {
- die("could not open XML input");
+ die("could not open XML input");
}
while ($data = fread($fp, 4096)) {
- if (!xml_parse($xml_parser, $data, feof($fp))) {
- die(sprintf("XML error: %s at line %d\n",
- xml_error_string(xml_get_error_code($xml_parser)),
- xml_get_current_line_number($xml_parser)));
- }
+ if (!xml_parse($xml_parser, $data, feof($fp))) {
+ die(sprintf("XML error: %s at line %d\n",
+ xml_error_string(xml_get_error_code($xml_parser)),
+ xml_get_current_line_number($xml_parser)));
+ }
}
print "parse complete\n";
xml_parser_free($xml_parser);
diff --git a/ext/xml/tests/xml004.phpt b/ext/xml/tests/xml004.phpt
index 1e545db2a1..3d5adaa56b 100644
--- a/ext/xml/tests/xml004.phpt
+++ b/ext/xml/tests/xml004.phpt
@@ -11,7 +11,7 @@ xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, false);
xml_set_element_handler($xp, "start_element", "end_element");
$fp = fopen("xmltest.xml", "r");
while ($data = fread($fp, 4096)) {
- xml_parse($xp, $data, feof($fp));
+ xml_parse($xp, $data, feof($fp));
}
xml_parser_free($xp);
$xp = xml_parser_create();
@@ -19,24 +19,24 @@ xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, true);
xml_set_element_handler($xp, "start_element", "end_element");
$fp = fopen("xmltest.xml", "r");
while ($data = fread($fp, 4096)) {
- xml_parse($xp, $data, feof($fp));
+ xml_parse($xp, $data, feof($fp));
}
xml_parser_free($xp);
function start_element($xp, $elem, $attribs)
{
- print "<$elem";
- if (sizeof($attribs)) {
+ print "<$elem";
+ if (sizeof($attribs)) {
foreach ($attribs as $k => $v) {
- print " $k=\"$v\"";
- }
- }
- print ">\n";
+ print " $k=\"$v\"";
+ }
+ }
+ print ">\n";
}
function end_element($xp, $elem)
{
- print "</$elem>\n";
+ print "</$elem>\n";
}
?>
--EXPECT--
diff --git a/ext/xml/tests/xml007.phpt b/ext/xml/tests/xml007.phpt
index f19f0389b6..5b76dfc848 100644
--- a/ext/xml/tests/xml007.phpt
+++ b/ext/xml/tests/xml007.phpt
@@ -12,12 +12,12 @@ if(strtoupper("äöüß") != "ÄÖÜß")
<?php
function startHandler($parser,$tag,$attr)
{
- var_dump($tag,$attr);
+ var_dump($tag,$attr);
}
function endHandler($parser,$tag)
{
- var_dump($tag);
+ var_dump($tag);
}
$xmldata = '<?xml version="1.0" encoding="ISO-8859-1"?><äöü üäß="Üäß">ÄÖÜ</äöü>';
diff --git a/ext/xml/tests/xml009.phpt b/ext/xml/tests/xml009.phpt
index 84b89bb488..8a33a4e715 100644
--- a/ext/xml/tests/xml009.phpt
+++ b/ext/xml/tests/xml009.phpt
@@ -3,12 +3,12 @@ XML parser test, default namespaces
--SKIPIF--
<?php
require_once("skipif.inc");
-if (! @xml_parser_create_ns('ISO-8859-1')) { die("skip xml_parser_create_ns is not supported on this plattform");}
+if (! @xml_parser_create_ns('ISO-8859-1')) { die("skip xml_parser_create_ns is not supported on this platform");}
?>
--FILE--
<?php
function start_elem($parser,$name,$attribs) {
- var_dump($name);
+ var_dump($name);
}
function end_elem()
{
@@ -17,7 +17,7 @@ function end_elem()
$xml = <<<HERE
<a xmlns="http://example.com/foo"
xmlns:bar="http://example.com/bar"
- xmlns:baz="http://example.com/baz">
+ xmlns:baz="http://example.com/baz">
<bar:b />
<bar:c xmlns:bar="http://example.com/foo"/>
</a>
diff --git a/ext/xml/tests/xml010.phpt b/ext/xml/tests/xml010.phpt
index 511129c699..69e8469fa6 100644
--- a/ext/xml/tests/xml010.phpt
+++ b/ext/xml/tests/xml010.phpt
@@ -3,12 +3,12 @@ XML parser test, attributes
--SKIPIF--
<?php
require_once("skipif.inc");
-if (! @xml_parser_create_ns('ISO-8859-1')) { die("skip xml_parser_create_ns is not supported on this plattform");}
+if (! @xml_parser_create_ns('ISO-8859-1')) { die("skip xml_parser_create_ns is not supported on this platform");}
?>
--FILE--
<?php
function start_elem($parser,$name,$attribs) {
- print "$name ";
+ print "$name ";
foreach($attribs as $key => $value) {
print "$key = $value ";
diff --git a/ext/xml/tests/xml_closures_001.phpt b/ext/xml/tests/xml_closures_001.phpt
index da9d849da5..c1f91d50d5 100644
--- a/ext/xml/tests/xml_closures_001.phpt
+++ b/ext/xml/tests/xml_closures_001.phpt
@@ -8,18 +8,18 @@ chdir(__DIR__);
$start_element = function ($xp, $elem, $attribs)
{
- print "<$elem";
- if (sizeof($attribs)) {
+ print "<$elem";
+ if (sizeof($attribs)) {
foreach ($attribs as $k => $v) {
- print " $k=\"$v\"";
- }
- }
- print ">\n";
+ print " $k=\"$v\"";
+ }
+ }
+ print ">\n";
};
$end_element = function ($xp, $elem)
{
- print "</$elem>\n";
+ print "</$elem>\n";
};
$xp = xml_parser_create();
@@ -27,7 +27,7 @@ xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, false);
xml_set_element_handler($xp, $start_element, $end_element);
$fp = fopen("xmltest.xml", "r");
while ($data = fread($fp, 4096)) {
- xml_parse($xp, $data, feof($fp));
+ xml_parse($xp, $data, feof($fp));
}
xml_parser_free($xp);
diff --git a/ext/xml/tests/xml_parser_set_option_variation3.phpt b/ext/xml/tests/xml_parser_set_option_variation3.phpt
index 836ee7a469..4187ddf068 100644
--- a/ext/xml/tests/xml_parser_set_option_variation3.phpt
+++ b/ext/xml/tests/xml_parser_set_option_variation3.phpt
@@ -15,7 +15,6 @@ if (!extension_loaded("xml")) {
*/
echo "*** Testing xml_parser_set_option() : usage variations ***\n";
-error_reporting(E_ALL & ~E_NOTICE);
class aClass {
function __toString() {
@@ -79,12 +78,6 @@ $values = array(
// resource data
$fp,
-
- // undefined data
- $undefined_var,
-
- // unset data
- $unset_var,
);
// loop through each element of the array for value
@@ -174,14 +167,10 @@ Arg value string
bool(true)
Arg value Some Ascii Data
-bool(true)
-Arg value Resource id %s
+Notice: Object of class aClass could not be converted to int in %s on line %d
bool(true)
-Arg value
-bool(true)
-
-Arg value
+Arg value Resource id %s
bool(true)
Done
diff --git a/ext/xml/tests/xml_set_notation_decl_handler_basic.phpt b/ext/xml/tests/xml_set_notation_decl_handler_basic.phpt
index a4ea86375e..c7b8b09049 100644
--- a/ext/xml/tests/xml_set_notation_decl_handler_basic.phpt
+++ b/ext/xml/tests/xml_set_notation_decl_handler_basic.phpt
@@ -18,23 +18,23 @@ class XML_Parser
{
function unparsed_entity_decl_handler($parser, $entity_name, $base, $system_ID, $public_ID, $notation_name)
- {
- echo "unparsed_entity_decl_handler called\n";
- echo "...Entity name=" . $entity_name . "\n";
- echo "...Base=" . $base . "\n";
- echo "...System ID=" . $system_ID . "\n";
- echo "...Public ID=" . $public_ID . "\n";
- echo "...Notation name=" . $notation_name . "\n";
- }
+ {
+ echo "unparsed_entity_decl_handler called\n";
+ echo "...Entity name=" . $entity_name . "\n";
+ echo "...Base=" . $base . "\n";
+ echo "...System ID=" . $system_ID . "\n";
+ echo "...Public ID=" . $public_ID . "\n";
+ echo "...Notation name=" . $notation_name . "\n";
+ }
- function notation_decl_handler($parser, $name, $base, $system_ID,$public_ID)
- {
- echo "notation_decl_handler called\n";
- echo "...Name=" . $name . "\n";
- echo "...Base=" . $base . "\n";
- echo "...System ID=" . $system_ID . "\n";
- echo "...Public ID=" . $public_ID . "\n";
- }
+ function notation_decl_handler($parser, $name, $base, $system_ID,$public_ID)
+ {
+ echo "notation_decl_handler called\n";
+ echo "...Name=" . $name . "\n";
+ echo "...Base=" . $base . "\n";
+ echo "...System ID=" . $system_ID . "\n";
+ echo "...Public ID=" . $public_ID . "\n";
+ }
function parse($data)
{
@@ -54,8 +54,8 @@ $xml = <<<HERE
<!NOTATION AUSDATE SYSTEM "http://www.schema.net/ausdate.not">
<!NOTATION ISODATE SYSTEM "http://www.schema.net/isodate.not">
<!ENTITY testUS SYSTEM "test_usdate.xml" NDATA USDATE>
- <!ENTITY testAUS SYSTEM "test_ausdate.xml" NDATA AUSDATE>
- <!ENTITY testISO SYSTEM "test_isodate_xml" NDATA ISODATE>]>
+ <!ENTITY testAUS SYSTEM "test_ausdate.xml" NDATA AUSDATE>
+ <!ENTITY testISO SYSTEM "test_isodate_xml" NDATA ISODATE>]>
]>
HERE;
diff --git a/ext/xml/tests/xml_set_processing_instruction_handler_basic.phpt b/ext/xml/tests/xml_set_processing_instruction_handler_basic.phpt
index cd5dda7763..f13c52517f 100644
--- a/ext/xml/tests/xml_set_processing_instruction_handler_basic.phpt
+++ b/ext/xml/tests/xml_set_processing_instruction_handler_basic.phpt
@@ -18,10 +18,10 @@ class XML_Parser
{
function PIHandler($parser, $target, $data)
- {
- echo "Target: " . $target. "\n";
- echo "Data: " . $data . "\n";
- }
+ {
+ echo "Target: " . $target. "\n";
+ echo "Data: " . $data . "\n";
+ }
function parse($data)
{
diff --git a/ext/xml/tests/xml_set_start_namespace_decl_handler_basic.phpt b/ext/xml/tests/xml_set_start_namespace_decl_handler_basic.phpt
index 8ee12e77cd..8d75d2099c 100644
--- a/ext/xml/tests/xml_set_start_namespace_decl_handler_basic.phpt
+++ b/ext/xml/tests/xml_set_start_namespace_decl_handler_basic.phpt
@@ -34,14 +34,14 @@ xml_parser_free( $parser );
echo "Done\n";
function Namespace_Start_Handler( $parser, $prefix, $uri ) {
- echo "Namespace_Start_Handler called\n";
- echo "...Prefix: ". $prefix . "\n";
- echo "...Uri: ". $uri . "\n";
+ echo "Namespace_Start_Handler called\n";
+ echo "...Prefix: ". $prefix . "\n";
+ echo "...Uri: ". $uri . "\n";
}
function Namespace_End_Handler($parser, $prefix) {
- echo "Namespace_End_Handler called\n";
- echo "...Prefix: ". $prefix . "\n\n";
+ echo "Namespace_End_Handler called\n";
+ echo "...Prefix: ". $prefix . "\n\n";
}
function DefaultHandler( $parser, $data ) {
diff --git a/ext/xml/xml.c b/ext/xml/xml.c
index fb60883226..e46dce1783 100644
--- a/ext/xml/xml.c
+++ b/ext/xml/xml.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -28,6 +26,7 @@
#include "ext/standard/php_string.h"
#include "ext/standard/info.h"
#include "ext/standard/html.h"
+#include "zend_interfaces.h"
#if HAVE_XML
@@ -37,6 +36,8 @@
#include "ext/libxml/php_libxml.h"
#endif
+#include "xml_arginfo.h"
+
/* Short-term TODO list:
* - Implement XML_ExternalEntityParserCreate()
* - XML_SetCommentHandler
@@ -66,7 +67,15 @@ typedef struct {
XML_Parser parser;
XML_Char *target_encoding;
+ /* Reference to the object itself, for convenience.
+ * It is not owned, do not release it. */
zval index;
+
+ /* We return a pointer to these zvals in get_gc(), so it's
+ * important that a) they are adjacent b) object is the first
+ * and c) the number of zvals is kept up to date. */
+#define XML_PARSER_NUM_ZVALS 12
+ zval object;
zval startElementHandler;
zval endElementHandler;
zval characterDataHandler;
@@ -91,8 +100,6 @@ typedef struct {
zend_function *startNamespaceDeclPtr;
zend_function *endNamespaceDeclPtr;
- zval object;
-
zval data;
zval info;
int level;
@@ -105,6 +112,8 @@ typedef struct {
int isparsing;
XML_Char *baseURI;
+
+ zend_object std;
} xml_parser;
@@ -135,6 +144,8 @@ ZEND_GET_MODULE(xml)
#define SKIP_TAGSTART(str) ((str) + (parser->toffset > (int)strlen(str) ? strlen(str) : parser->toffset))
+static zend_class_entry *xml_parser_ce;
+static zend_object_handlers xml_parser_object_handlers;
/* {{{ function prototypes */
PHP_MINIT_FUNCTION(xml);
@@ -164,8 +175,12 @@ PHP_FUNCTION(xml_parser_set_option);
PHP_FUNCTION(xml_parser_get_option);
PHP_FUNCTION(xml_parse_into_struct);
+static zend_object *xml_parser_create_object(zend_class_entry *class_type);
+static void xml_parser_free_obj(zend_object *object);
+static HashTable *xml_parser_get_gc(zend_object *object, zval **table, int *n);
+static zend_function *xml_parser_get_constructor(zend_object *object);
+
static zend_string *xml_utf8_decode(const XML_Char *, size_t, const XML_Char *);
-static void xml_parser_dtor(zend_resource *rsrc);
static void xml_set_handler(zval *, zval *);
inline static unsigned short xml_encode_iso_8859_1(unsigned char);
inline static char xml_decode_iso_8859_1(unsigned short);
@@ -191,114 +206,6 @@ void _xml_endNamespaceDeclHandler(void *, const XML_Char *);
/* }}} */
/* {{{ extension definition structures */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_parser_create, 0, 0, 0)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_parser_create_ns, 0, 0, 0)
- ZEND_ARG_INFO(0, encoding)
- ZEND_ARG_INFO(0, sep)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_set_object, 0, 0, 2)
- ZEND_ARG_INFO(0, parser)
- ZEND_ARG_INFO(0, obj)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_set_element_handler, 0, 0, 3)
- ZEND_ARG_INFO(0, parser)
- ZEND_ARG_INFO(0, shdl)
- ZEND_ARG_INFO(0, ehdl)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_set_character_data_handler, 0, 0, 2)
- ZEND_ARG_INFO(0, parser)
- ZEND_ARG_INFO(0, hdl)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_set_processing_instruction_handler, 0, 0, 2)
- ZEND_ARG_INFO(0, parser)
- ZEND_ARG_INFO(0, hdl)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_set_default_handler, 0, 0, 2)
- ZEND_ARG_INFO(0, parser)
- ZEND_ARG_INFO(0, hdl)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_set_unparsed_entity_decl_handler, 0, 0, 2)
- ZEND_ARG_INFO(0, parser)
- ZEND_ARG_INFO(0, hdl)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_set_notation_decl_handler, 0, 0, 2)
- ZEND_ARG_INFO(0, parser)
- ZEND_ARG_INFO(0, hdl)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_set_external_entity_ref_handler, 0, 0, 2)
- ZEND_ARG_INFO(0, parser)
- ZEND_ARG_INFO(0, hdl)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_set_start_namespace_decl_handler, 0, 0, 2)
- ZEND_ARG_INFO(0, parser)
- ZEND_ARG_INFO(0, hdl)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_set_end_namespace_decl_handler, 0, 0, 2)
- ZEND_ARG_INFO(0, parser)
- ZEND_ARG_INFO(0, hdl)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_parse, 0, 0, 2)
- ZEND_ARG_INFO(0, parser)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, isfinal)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_parse_into_struct, 0, 0, 3)
- ZEND_ARG_INFO(0, parser)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(1, values)
- ZEND_ARG_INFO(1, index)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_get_error_code, 0, 0, 1)
- ZEND_ARG_INFO(0, parser)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_error_string, 0, 0, 1)
- ZEND_ARG_INFO(0, code)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_get_current_line_number, 0, 0, 1)
- ZEND_ARG_INFO(0, parser)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_get_current_column_number, 0, 0, 1)
- ZEND_ARG_INFO(0, parser)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_get_current_byte_index, 0, 0, 1)
- ZEND_ARG_INFO(0, parser)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_parser_free, 0, 0, 1)
- ZEND_ARG_INFO(0, parser)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_parser_set_option, 0, 0, 3)
- ZEND_ARG_INFO(0, parser)
- ZEND_ARG_INFO(0, option)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_parser_get_option, 0, 0, 2)
- ZEND_ARG_INFO(0, parser)
- ZEND_ARG_INFO(0, option)
-ZEND_END_ARG_INFO()
-
static const zend_function_entry xml_functions[] = {
PHP_FE(xml_parser_create, arginfo_xml_parser_create)
PHP_FE(xml_parser_create_ns, arginfo_xml_parser_create_ns)
@@ -366,9 +273,6 @@ const xml_encoding xml_encodings[] = {
static XML_Memory_Handling_Suite php_xml_mem_hdlrs;
-/* True globals, no need for thread safety */
-static int le_xml_parser;
-
/* }}} */
/* {{{ startup, shutdown and info functions */
@@ -397,9 +301,26 @@ static void php_xml_free_wrapper(void *ptr)
}
}
+static const zend_function_entry xml_parser_methods[] = {
+ PHP_FE_END
+};
+
PHP_MINIT_FUNCTION(xml)
{
- le_xml_parser = zend_register_list_destructors_ex(xml_parser_dtor, NULL, "xml", module_number);
+ zend_class_entry ce;
+ INIT_CLASS_ENTRY(ce, "XmlParser", xml_parser_methods);
+ xml_parser_ce = zend_register_internal_class(&ce);
+ xml_parser_ce->create_object = xml_parser_create_object;
+ xml_parser_ce->ce_flags |= ZEND_ACC_FINAL;
+ xml_parser_ce->serialize = zend_class_serialize_deny;
+ xml_parser_ce->unserialize = zend_class_unserialize_deny;
+
+ memcpy(&xml_parser_object_handlers, &std_object_handlers, sizeof(zend_object_handlers));
+ xml_parser_object_handlers.offset = XtOffsetOf(xml_parser, std);
+ xml_parser_object_handlers.free_obj = xml_parser_free_obj;
+ xml_parser_object_handlers.get_gc = xml_parser_get_gc;
+ xml_parser_object_handlers.get_constructor = xml_parser_get_constructor;
+ xml_parser_object_handlers.clone_obj = NULL;
REGISTER_LONG_CONSTANT("XML_ERROR_NONE", XML_ERROR_NONE, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("XML_ERROR_NO_MEMORY", XML_ERROR_NO_MEMORY, CONST_CS|CONST_PERSISTENT);
@@ -474,10 +395,26 @@ static void _xml_xmlchar_zval(const XML_Char *s, int len, const XML_Char *encodi
}
/* }}} */
-/* {{{ xml_parser_dtor() */
-static void xml_parser_dtor(zend_resource *rsrc)
+static inline xml_parser *xml_parser_from_obj(zend_object *obj) {
+ return (xml_parser *)((char *)(obj) - XtOffsetOf(xml_parser, std));
+}
+
+#define Z_XMLPARSER_P(zv) xml_parser_from_obj(Z_OBJ_P(zv))
+
+static zend_object *xml_parser_create_object(zend_class_entry *class_type) {
+ xml_parser *intern = zend_object_alloc(sizeof(xml_parser), class_type);
+ memset(intern, 0, sizeof(xml_parser) - sizeof(zend_object));
+
+ zend_object_std_init(&intern->std, class_type);
+ object_properties_init(&intern->std, class_type);
+ intern->std.handlers = &xml_parser_object_handlers;
+
+ return &intern->std;
+}
+
+static void xml_parser_free_obj(zend_object *object)
{
- xml_parser *parser = (xml_parser *)rsrc->ptr;
+ xml_parser *parser = xml_parser_from_obj(object);
if (parser->parser) {
XML_ParserFree(parser->parser);
@@ -528,9 +465,21 @@ static void xml_parser_dtor(zend_resource *rsrc)
zval_ptr_dtor(&parser->object);
}
- efree(parser);
+ zend_object_std_dtor(&parser->std);
+}
+
+static HashTable *xml_parser_get_gc(zend_object *object, zval **table, int *n)
+{
+ xml_parser *parser = xml_parser_from_obj(object);
+ *table = &parser->object;
+ *n = XML_PARSER_NUM_ZVALS;
+ return zend_std_get_properties(object);
+}
+
+static zend_function *xml_parser_get_constructor(zend_object *object) {
+ zend_throw_error(NULL, "Cannot directly construct XmlParser, use xml_parser_create() or xml_parser_create_ns() instead");
+ return NULL;
}
-/* }}} */
/* {{{ xml_set_handler() */
static void xml_set_handler(zval *handler, zval *data)
@@ -1118,7 +1067,7 @@ static void php_xml_parser_create_impl(INTERNAL_FUNCTION_PARAMETERS, int ns_supp
XML_Char *encoding;
if (zend_parse_parameters(ZEND_NUM_ARGS(), (ns_support ? "|ss": "|s"), &encoding_param, &encoding_param_len, &ns_param, &ns_param_len) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (encoding_param != NULL) {
@@ -1135,7 +1084,7 @@ static void php_xml_parser_create_impl(INTERNAL_FUNCTION_PARAMETERS, int ns_supp
} else if (strcasecmp(encoding_param, "US-ASCII") == 0) {
encoding = (XML_Char*)"US-ASCII";
} else {
- php_error_docref(NULL, E_WARNING, "unsupported source encoding \"%s\"", encoding_param);
+ php_error_docref(NULL, E_WARNING, "Unsupported source encoding \"%s\"", encoding_param);
RETURN_FALSE;
}
} else {
@@ -1146,7 +1095,8 @@ static void php_xml_parser_create_impl(INTERNAL_FUNCTION_PARAMETERS, int ns_supp
ns_param = ":";
}
- parser = ecalloc(1, sizeof(xml_parser));
+ object_init_ex(return_value, xml_parser_ce);
+ parser = Z_XMLPARSER_P(return_value);
parser->parser = XML_ParserCreate_MM((auto_detect ? NULL : encoding),
&php_xml_mem_hdlrs, (XML_Char*)ns_param);
@@ -1155,9 +1105,7 @@ static void php_xml_parser_create_impl(INTERNAL_FUNCTION_PARAMETERS, int ns_supp
parser->isparsing = 0;
XML_SetUserData(parser->parser, parser);
-
- RETVAL_RES(zend_register_resource(parser, le_xml_parser));
- ZVAL_COPY(&parser->index, return_value);
+ ZVAL_COPY_VALUE(&parser->index, return_value);
}
/* }}} */
@@ -1184,22 +1132,13 @@ PHP_FUNCTION(xml_set_object)
xml_parser *parser;
zval *pind, *mythis;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ro", &pind, &mythis) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Oo", &pind, xml_parser_ce, &mythis) == FAILURE) {
+ RETURN_THROWS();
}
- if ((parser = (xml_parser *)zend_fetch_resource(Z_RES_P(pind), "XML Parser", le_xml_parser)) == NULL) {
- RETURN_FALSE;
- }
-
- /* please leave this commented - or ask thies@thieso.net before doing it (again) */
- if (!Z_ISUNDEF(parser->object)) {
- zval_ptr_dtor(&parser->object);
- }
-
- /* please leave this commented - or ask thies@thieso.net before doing it (again) */
- /* zval_add_ref(&parser->object); */
+ parser = Z_XMLPARSER_P(pind);
+ zval_ptr_dtor(&parser->object);
Z_ADDREF_P(mythis);
ZVAL_OBJ(&parser->object, Z_OBJ_P(mythis));
@@ -1214,14 +1153,11 @@ PHP_FUNCTION(xml_set_element_handler)
xml_parser *parser;
zval *pind, *shdl, *ehdl;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rzz", &pind, &shdl, &ehdl) == FAILURE) {
- return;
- }
-
- if ((parser = (xml_parser *)zend_fetch_resource(Z_RES_P(pind), "XML Parser", le_xml_parser)) == NULL) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ozz", &pind, xml_parser_ce, &shdl, &ehdl) == FAILURE) {
+ RETURN_THROWS();
}
+ parser = Z_XMLPARSER_P(pind);
xml_set_handler(&parser->startElementHandler, shdl);
xml_set_handler(&parser->endElementHandler, ehdl);
XML_SetElementHandler(parser->parser, _xml_startElementHandler, _xml_endElementHandler);
@@ -1236,14 +1172,11 @@ PHP_FUNCTION(xml_set_character_data_handler)
xml_parser *parser;
zval *pind, *hdl;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz", &pind, &hdl) == FAILURE) {
- return;
- }
-
- if ((parser = (xml_parser *)zend_fetch_resource(Z_RES_P(pind), "XML Parser", le_xml_parser)) == NULL) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Oz", &pind, xml_parser_ce, &hdl) == FAILURE) {
+ RETURN_THROWS();
}
+ parser = Z_XMLPARSER_P(pind);
xml_set_handler(&parser->characterDataHandler, hdl);
XML_SetCharacterDataHandler(parser->parser, _xml_characterDataHandler);
RETVAL_TRUE;
@@ -1257,14 +1190,11 @@ PHP_FUNCTION(xml_set_processing_instruction_handler)
xml_parser *parser;
zval *pind, *hdl;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz", &pind, &hdl) == FAILURE) {
- return;
- }
-
- if ((parser = (xml_parser *)zend_fetch_resource(Z_RES_P(pind), "XML Parser", le_xml_parser)) == NULL) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Oz", &pind, xml_parser_ce, &hdl) == FAILURE) {
+ RETURN_THROWS();
}
+ parser = Z_XMLPARSER_P(pind);
xml_set_handler(&parser->processingInstructionHandler, hdl);
XML_SetProcessingInstructionHandler(parser->parser, _xml_processingInstructionHandler);
RETVAL_TRUE;
@@ -1278,14 +1208,11 @@ PHP_FUNCTION(xml_set_default_handler)
xml_parser *parser;
zval *pind, *hdl;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz", &pind, &hdl) == FAILURE) {
- return;
- }
-
- if ((parser = (xml_parser *)zend_fetch_resource(Z_RES_P(pind), "XML Parser", le_xml_parser)) == NULL) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Oz", &pind, xml_parser_ce, &hdl) == FAILURE) {
+ RETURN_THROWS();
}
+ parser = Z_XMLPARSER_P(pind);
xml_set_handler(&parser->defaultHandler, hdl);
XML_SetDefaultHandler(parser->parser, _xml_defaultHandler);
RETVAL_TRUE;
@@ -1299,14 +1226,11 @@ PHP_FUNCTION(xml_set_unparsed_entity_decl_handler)
xml_parser *parser;
zval *pind, *hdl;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz", &pind, &hdl) == FAILURE) {
- return;
- }
-
- if ((parser = (xml_parser *)zend_fetch_resource(Z_RES_P(pind), "XML Parser", le_xml_parser)) == NULL) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Oz", &pind, xml_parser_ce, &hdl) == FAILURE) {
+ RETURN_THROWS();
}
+ parser = Z_XMLPARSER_P(pind);
xml_set_handler(&parser->unparsedEntityDeclHandler, hdl);
XML_SetUnparsedEntityDeclHandler(parser->parser, _xml_unparsedEntityDeclHandler);
RETVAL_TRUE;
@@ -1320,14 +1244,11 @@ PHP_FUNCTION(xml_set_notation_decl_handler)
xml_parser *parser;
zval *pind, *hdl;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz", &pind, &hdl) == FAILURE) {
- return;
- }
-
- if ((parser = (xml_parser *)zend_fetch_resource(Z_RES_P(pind), "XML Parser", le_xml_parser)) == NULL) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Oz", &pind, xml_parser_ce, &hdl) == FAILURE) {
+ RETURN_THROWS();
}
+ parser = Z_XMLPARSER_P(pind);
xml_set_handler(&parser->notationDeclHandler, hdl);
XML_SetNotationDeclHandler(parser->parser, _xml_notationDeclHandler);
RETVAL_TRUE;
@@ -1341,14 +1262,11 @@ PHP_FUNCTION(xml_set_external_entity_ref_handler)
xml_parser *parser;
zval *pind, *hdl;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz", &pind, &hdl) == FAILURE) {
- return;
- }
-
- if ((parser = (xml_parser *)zend_fetch_resource(Z_RES_P(pind), "XML Parser", le_xml_parser)) == NULL) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Oz", &pind, xml_parser_ce, &hdl) == FAILURE) {
+ RETURN_THROWS();
}
+ parser = Z_XMLPARSER_P(pind);
xml_set_handler(&parser->externalEntityRefHandler, hdl);
XML_SetExternalEntityRefHandler(parser->parser, (void *) _xml_externalEntityRefHandler);
RETVAL_TRUE;
@@ -1362,14 +1280,11 @@ PHP_FUNCTION(xml_set_start_namespace_decl_handler)
xml_parser *parser;
zval *pind, *hdl;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz", &pind, &hdl) == FAILURE) {
- return;
- }
-
- if ((parser = (xml_parser *)zend_fetch_resource(Z_RES_P(pind), "XML Parser", le_xml_parser)) == NULL) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Oz", &pind, xml_parser_ce, &hdl) == FAILURE) {
+ RETURN_THROWS();
}
+ parser = Z_XMLPARSER_P(pind);
xml_set_handler(&parser->startNamespaceDeclHandler, hdl);
XML_SetStartNamespaceDeclHandler(parser->parser, _xml_startNamespaceDeclHandler);
RETVAL_TRUE;
@@ -1383,14 +1298,11 @@ PHP_FUNCTION(xml_set_end_namespace_decl_handler)
xml_parser *parser;
zval *pind, *hdl;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz", &pind, &hdl) == FAILURE) {
- return;
- }
-
- if ((parser = (xml_parser *)zend_fetch_resource(Z_RES_P(pind), "XML Parser", le_xml_parser)) == NULL) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Oz", &pind, xml_parser_ce, &hdl) == FAILURE) {
+ RETURN_THROWS();
}
+ parser = Z_XMLPARSER_P(pind);
xml_set_handler(&parser->endNamespaceDeclHandler, hdl);
XML_SetEndNamespaceDeclHandler(parser->parser, _xml_endNamespaceDeclHandler);
RETVAL_TRUE;
@@ -1408,14 +1320,11 @@ PHP_FUNCTION(xml_parse)
int ret;
zend_bool isFinal = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|b", &pind, &data, &data_len, &isFinal) == FAILURE) {
- return;
- }
-
- if ((parser = (xml_parser *)zend_fetch_resource(Z_RES_P(pind), "XML Parser", le_xml_parser)) == NULL) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Os|b", &pind, xml_parser_ce, &data, &data_len, &isFinal) == FAILURE) {
+ RETURN_THROWS();
}
+ parser = Z_XMLPARSER_P(pind);
parser->isparsing = 1;
ret = XML_Parse(parser->parser, (XML_Char*)data, data_len, isFinal);
parser->isparsing = 0;
@@ -1426,7 +1335,6 @@ PHP_FUNCTION(xml_parse)
/* {{{ proto int xml_parse_into_struct(resource parser, string data, array &values [, array &index ])
Parsing a XML document */
-
PHP_FUNCTION(xml_parse_into_struct)
{
xml_parser *parser;
@@ -1435,24 +1343,22 @@ PHP_FUNCTION(xml_parse_into_struct)
size_t data_len;
int ret;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsz|z", &pind, &data, &data_len, &xdata, &info) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Osz|z", &pind, xml_parser_ce, &data, &data_len, &xdata, &info) == FAILURE) {
+ RETURN_THROWS();
}
+ parser = Z_XMLPARSER_P(pind);
+
if (info) {
info = zend_try_array_init(info);
if (!info) {
- return;
+ RETURN_THROWS();
}
}
- if ((parser = (xml_parser *)zend_fetch_resource(Z_RES_P(pind), "XML Parser", le_xml_parser)) == NULL) {
- RETURN_FALSE;
- }
-
xdata = zend_try_array_init(xdata);
if (!xdata) {
- return;
+ RETURN_THROWS();
}
ZVAL_COPY_VALUE(&parser->data, xdata);
@@ -1482,14 +1388,11 @@ PHP_FUNCTION(xml_get_error_code)
xml_parser *parser;
zval *pind;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pind) == FAILURE) {
- return;
- }
-
- if ((parser = (xml_parser *)zend_fetch_resource(Z_RES_P(pind), "XML Parser", le_xml_parser)) == NULL) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &pind, xml_parser_ce) == FAILURE) {
+ RETURN_THROWS();
}
+ parser = Z_XMLPARSER_P(pind);
RETURN_LONG((zend_long)XML_GetErrorCode(parser->parser));
}
/* }}} */
@@ -1502,7 +1405,7 @@ PHP_FUNCTION(xml_error_string)
char *str;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &code) == FAILURE) {
- return;
+ RETURN_THROWS();
}
str = (char *)XML_ErrorString((int)code);
@@ -1519,14 +1422,11 @@ PHP_FUNCTION(xml_get_current_line_number)
xml_parser *parser;
zval *pind;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pind) == FAILURE) {
- return;
- }
-
- if ((parser = (xml_parser *)zend_fetch_resource(Z_RES_P(pind), "XML Parser", le_xml_parser)) == NULL) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &pind, xml_parser_ce) == FAILURE) {
+ RETURN_THROWS();
}
+ parser = Z_XMLPARSER_P(pind);
RETVAL_LONG(XML_GetCurrentLineNumber(parser->parser));
}
/* }}} */
@@ -1538,14 +1438,11 @@ PHP_FUNCTION(xml_get_current_column_number)
xml_parser *parser;
zval *pind;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pind) == FAILURE) {
- return;
- }
-
- if ((parser = (xml_parser *)zend_fetch_resource(Z_RES_P(pind), "XML Parser", le_xml_parser)) == NULL) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &pind, xml_parser_ce) == FAILURE) {
+ RETURN_THROWS();
}
+ parser = Z_XMLPARSER_P(pind);
RETVAL_LONG(XML_GetCurrentColumnNumber(parser->parser));
}
/* }}} */
@@ -1557,14 +1454,11 @@ PHP_FUNCTION(xml_get_current_byte_index)
xml_parser *parser;
zval *pind;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pind) == FAILURE) {
- return;
- }
-
- if ((parser = (xml_parser *)zend_fetch_resource(Z_RES_P(pind), "XML Parser", le_xml_parser)) == NULL) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &pind, xml_parser_ce) == FAILURE) {
+ RETURN_THROWS();
}
+ parser = Z_XMLPARSER_P(pind);
RETVAL_LONG(XML_GetCurrentByteIndex(parser->parser));
}
/* }}} */
@@ -1576,23 +1470,16 @@ PHP_FUNCTION(xml_parser_free)
zval *pind;
xml_parser *parser;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pind) == FAILURE) {
- return;
- }
-
- if ((parser = (xml_parser *)zend_fetch_resource(Z_RES_P(pind), "XML Parser", le_xml_parser)) == NULL) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &pind, xml_parser_ce) == FAILURE) {
+ RETURN_THROWS();
}
+ parser = Z_XMLPARSER_P(pind);
if (parser->isparsing == 1) {
php_error_docref(NULL, E_WARNING, "Parser cannot be freed while it is parsing.");
RETURN_FALSE;
}
- if (zend_list_delete(Z_RES(parser->index)) == FAILURE) {
- RETURN_FALSE;
- }
-
RETURN_TRUE;
}
/* }}} */
@@ -1605,14 +1492,11 @@ PHP_FUNCTION(xml_parser_set_option)
zval *pind, *val;
zend_long opt;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlz", &pind, &opt, &val) == FAILURE) {
- return;
- }
-
- if ((parser = (xml_parser *)zend_fetch_resource(Z_RES_P(pind), "XML Parser", le_xml_parser)) == NULL) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Olz", &pind, xml_parser_ce, &opt, &val) == FAILURE) {
+ RETURN_THROWS();
}
+ parser = Z_XMLPARSER_P(pind);
switch (opt) {
case PHP_XML_OPTION_CASE_FOLDING:
parser->case_folding = zval_get_long(val);
@@ -1630,7 +1514,7 @@ PHP_FUNCTION(xml_parser_set_option)
case PHP_XML_OPTION_TARGET_ENCODING: {
const xml_encoding *enc;
if (!try_convert_to_string(val)) {
- return;
+ RETURN_THROWS();
}
enc = xml_get_encoding((XML_Char*)Z_STRVAL_P(val));
@@ -1658,14 +1542,11 @@ PHP_FUNCTION(xml_parser_get_option)
zval *pind;
zend_long opt;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &pind, &opt) == FAILURE) {
- return;
- }
-
- if ((parser = (xml_parser *)zend_fetch_resource(Z_RES_P(pind), "XML Parser", le_xml_parser)) == NULL) {
- RETURN_FALSE;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ol", &pind, xml_parser_ce, &opt) == FAILURE) {
+ RETURN_THROWS();
}
+ parser = Z_XMLPARSER_P(pind);
switch (opt) {
case PHP_XML_OPTION_CASE_FOLDING:
RETURN_LONG(parser->case_folding);
diff --git a/ext/xml/xml.stub.php b/ext/xml/xml.stub.php
new file mode 100644
index 0000000000..0f6ed6b24c
--- /dev/null
+++ b/ext/xml/xml.stub.php
@@ -0,0 +1,57 @@
+<?php
+
+function xml_parser_create(string $encoding = UNKNOWN): XmlParser|false {}
+
+function xml_parser_create_ns(string $encoding = UNKNOWN, string $sep = ':'): XmlParser|false {}
+
+function xml_set_object(XmlParser $parser, object $obj): bool {}
+
+/**
+ * @param callable $shdl
+ * @param callable $ehdl
+ */
+function xml_set_element_handler(XmlParser $parser, $shdl, $ehdl): bool {}
+
+/** @param callable $hdl */
+function xml_set_character_data_handler(XmlParser $parser, $hdl): bool {}
+
+/** @param callable $hdl */
+function xml_set_processing_instruction_handler(XmlParser $parser, $hdl): bool {}
+
+/** @param callable $hdl */
+function xml_set_default_handler(XmlParser $parser, $hdl): bool {}
+
+/** @param callable $hdl */
+function xml_set_unparsed_entity_decl_handler(XmlParser $parser, $hdl): bool {}
+
+/** @param callable $hdl */
+function xml_set_notation_decl_handler(XmlParser $parser, $hdl): bool {}
+
+/** @param callable $hdl */
+function xml_set_external_entity_ref_handler(XmlParser $parser, $hdl): bool {}
+
+/** @param callable $hdl */
+function xml_set_start_namespace_decl_handler(XmlParser $parser, $hdl): bool {}
+
+/** @param callable $hdl */
+function xml_set_end_namespace_decl_handler(XmlParser $parser, $hdl): bool {}
+
+function xml_parse(XmlParser $parser, string $data, bool $isfinal = false): int {}
+
+function xml_parse_into_struct(XmlParser $parser, string $data, &$values, &$index = UNKNOWN): int {}
+
+function xml_get_error_code(XmlParser $parser): int {}
+
+function xml_error_string(int $code): ?string {}
+
+function xml_get_current_line_number(XmlParser $parser): int {}
+
+function xml_get_current_column_number(XmlParser $parser): int {}
+
+function xml_get_current_byte_index(XmlParser $parser): int {}
+
+function xml_parser_free(XmlParser $parser): bool {}
+
+function xml_parser_set_option(XmlParser $parser, int $option, $value): bool {}
+
+function xml_parser_get_option(XmlParser $parser, int $option) {}
diff --git a/ext/xml/xml_arginfo.h b/ext/xml/xml_arginfo.h
new file mode 100644
index 0000000000..06f6fde985
--- /dev/null
+++ b/ext/xml/xml_arginfo.h
@@ -0,0 +1,82 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_xml_parser_create, 0, 0, XmlParser, MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_xml_parser_create_ns, 0, 0, XmlParser, MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, sep, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xml_set_object, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, parser, XmlParser, 0)
+ ZEND_ARG_TYPE_INFO(0, obj, IS_OBJECT, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xml_set_element_handler, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, parser, XmlParser, 0)
+ ZEND_ARG_INFO(0, shdl)
+ ZEND_ARG_INFO(0, ehdl)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xml_set_character_data_handler, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, parser, XmlParser, 0)
+ ZEND_ARG_INFO(0, hdl)
+ZEND_END_ARG_INFO()
+
+#define arginfo_xml_set_processing_instruction_handler arginfo_xml_set_character_data_handler
+
+#define arginfo_xml_set_default_handler arginfo_xml_set_character_data_handler
+
+#define arginfo_xml_set_unparsed_entity_decl_handler arginfo_xml_set_character_data_handler
+
+#define arginfo_xml_set_notation_decl_handler arginfo_xml_set_character_data_handler
+
+#define arginfo_xml_set_external_entity_ref_handler arginfo_xml_set_character_data_handler
+
+#define arginfo_xml_set_start_namespace_decl_handler arginfo_xml_set_character_data_handler
+
+#define arginfo_xml_set_end_namespace_decl_handler arginfo_xml_set_character_data_handler
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xml_parse, 0, 2, IS_LONG, 0)
+ ZEND_ARG_OBJ_INFO(0, parser, XmlParser, 0)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, isfinal, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xml_parse_into_struct, 0, 3, IS_LONG, 0)
+ ZEND_ARG_OBJ_INFO(0, parser, XmlParser, 0)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ ZEND_ARG_INFO(1, values)
+ ZEND_ARG_INFO(1, index)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xml_get_error_code, 0, 1, IS_LONG, 0)
+ ZEND_ARG_OBJ_INFO(0, parser, XmlParser, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xml_error_string, 0, 1, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, code, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_xml_get_current_line_number arginfo_xml_get_error_code
+
+#define arginfo_xml_get_current_column_number arginfo_xml_get_error_code
+
+#define arginfo_xml_get_current_byte_index arginfo_xml_get_error_code
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xml_parser_free, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, parser, XmlParser, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xml_parser_set_option, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, parser, XmlParser, 0)
+ ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_parser_get_option, 0, 0, 2)
+ ZEND_ARG_OBJ_INFO(0, parser, XmlParser, 0)
+ ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/xmlreader/php_xmlreader.c b/ext/xmlreader/php_xmlreader.c
index 20960d96d5..8ba87763c1 100644
--- a/ext/xmlreader/php_xmlreader.c
+++ b/ext/xmlreader/php_xmlreader.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -31,6 +29,7 @@
#endif
#include <libxml/xmlreader.h>
#include <libxml/uri.h>
+#include "xmlreader_arginfo.h"
zend_class_entry *xmlreader_class_entry;
@@ -38,6 +37,9 @@ static zend_object_handlers xmlreader_object_handlers;
static HashTable xmlreader_prop_handlers;
+static zend_internal_function xmlreader_open_fn;
+static zend_internal_function xmlreader_xml_fn;
+
typedef int (*xmlreader_read_int_t)(xmlTextReaderPtr reader);
typedef unsigned char *(*xmlreader_read_char_t)(xmlTextReaderPtr reader);
typedef const unsigned char *(*xmlreader_read_const_char_t)(xmlTextReaderPtr reader);
@@ -114,34 +116,20 @@ static int xmlreader_property_reader(xmlreader_object *obj, xmlreader_prop_handl
/* }}} */
/* {{{ xmlreader_get_property_ptr_ptr */
-zval *xmlreader_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot)
+zval *xmlreader_get_property_ptr_ptr(zend_object *object, zend_string *name, int type, void **cache_slot)
{
xmlreader_object *obj;
- zval tmp_member;
zval *retval = NULL;
xmlreader_prop_handler *hnd = NULL;
- if (Z_TYPE_P(member) != IS_STRING) {
- zend_string *str = zval_try_get_string_func(member);
- if (UNEXPECTED(!str)) {
- return NULL;
- }
- ZVAL_STR(&tmp_member, str);
- member = &tmp_member;
- }
-
- obj = Z_XMLREADER_P(object);
+ obj = php_xmlreader_fetch_object(object);
if (obj->prop_handler != NULL) {
- hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member));
+ hnd = zend_hash_find_ptr(obj->prop_handler, name);
}
if (hnd == NULL) {
- retval = zend_std_get_property_ptr_ptr(object, member, type, cache_slot);
- }
-
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
+ retval = zend_std_get_property_ptr_ptr(object, name, type, cache_slot);
}
return retval;
@@ -149,26 +137,16 @@ zval *xmlreader_get_property_ptr_ptr(zval *object, zval *member, int type, void
/* }}} */
/* {{{ xmlreader_read_property */
-zval *xmlreader_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv)
+zval *xmlreader_read_property(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv)
{
xmlreader_object *obj;
- zval tmp_member;
zval *retval = NULL;
xmlreader_prop_handler *hnd = NULL;
- if (Z_TYPE_P(member) != IS_STRING) {
- zend_string *str = zval_try_get_string_func(member);
- if (UNEXPECTED(!str)) {
- return &EG(uninitialized_zval);
- }
- ZVAL_STR(&tmp_member, str);
- member = &tmp_member;
- }
-
- obj = Z_XMLREADER_P(object);
+ obj = php_xmlreader_fetch_object(object);
if (obj->prop_handler != NULL) {
- hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member));
+ hnd = zend_hash_find_ptr(obj->prop_handler, name);
}
if (hnd != NULL) {
@@ -178,51 +156,53 @@ zval *xmlreader_read_property(zval *object, zval *member, int type, void **cache
retval = rv;
}
} else {
- retval = zend_std_read_property(object, member, type, cache_slot, rv);
+ retval = zend_std_read_property(object, name, type, cache_slot, rv);
}
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
- }
return retval;
}
/* }}} */
/* {{{ xmlreader_write_property */
-zval *xmlreader_write_property(zval *object, zval *member, zval *value, void **cache_slot)
+zval *xmlreader_write_property(zend_object *object, zend_string *name, zval *value, void **cache_slot)
{
xmlreader_object *obj;
- zval tmp_member;
xmlreader_prop_handler *hnd = NULL;
- if (Z_TYPE_P(member) != IS_STRING) {
- zend_string *str = zval_try_get_string_func(member);
- if (UNEXPECTED(!str)) {
- return value;
- }
- ZVAL_STR(&tmp_member, str);
- member = &tmp_member;
- }
-
- obj = Z_XMLREADER_P(object);
+ obj = php_xmlreader_fetch_object(object);
if (obj->prop_handler != NULL) {
- hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member));
+ hnd = zend_hash_find_ptr(obj->prop_handler, name);
}
if (hnd != NULL) {
php_error_docref(NULL, E_WARNING, "Cannot write to read-only property");
} else {
- value = zend_std_write_property(object, member, value, cache_slot);
- }
-
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
+ value = zend_std_write_property(object, name, value, cache_slot);
}
return value;
}
/* }}} */
+/* {{{ */
+static zend_function *xmlreader_get_method(zend_object **obj, zend_string *name, const zval *key)
+{
+ if (ZSTR_LEN(name) == sizeof("open") - 1
+ && (ZSTR_VAL(name)[0] == 'o' || ZSTR_VAL(name)[0] == 'O')
+ && (ZSTR_VAL(name)[1] == 'p' || ZSTR_VAL(name)[1] == 'P')
+ && (ZSTR_VAL(name)[2] == 'e' || ZSTR_VAL(name)[2] == 'E')
+ && (ZSTR_VAL(name)[3] == 'n' || ZSTR_VAL(name)[3] == 'N')) {
+ return (zend_function*)&xmlreader_open_fn;
+ } else if (ZSTR_LEN(name) == sizeof("xml") - 1
+ && (ZSTR_VAL(name)[0] == 'x' || ZSTR_VAL(name)[0] == 'X')
+ && (ZSTR_VAL(name)[1] == 'm' || ZSTR_VAL(name)[1] == 'M')
+ && (ZSTR_VAL(name)[2] == 'l' || ZSTR_VAL(name)[2] == 'L')) {
+ return (zend_function*)&xmlreader_xml_fn;
+ }
+ return zend_std_get_method(obj, name, key);;
+}
+/* }}} */
+
/* {{{ _xmlreader_get_valid_file_path */
/* _xmlreader_get_valid_file_path and _xmlreader_get_relaxNG should be made a
common function in libxml extension as code is common to a few xml extensions */
@@ -408,7 +388,7 @@ static void php_xmlreader_string_arg(INTERNAL_FUNCTION_PARAMETERS, xmlreader_rea
char *name;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!name_len) {
@@ -438,6 +418,10 @@ static void php_xmlreader_no_arg(INTERNAL_FUNCTION_PARAMETERS, xmlreader_read_in
int retval;
xmlreader_object *intern;
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
id = ZEND_THIS;
intern = Z_XMLREADER_P(id);
@@ -462,6 +446,10 @@ static void php_xmlreader_no_arg_string(INTERNAL_FUNCTION_PARAMETERS, xmlreader_
char *retchar = NULL;
xmlreader_object *intern;
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
id = ZEND_THIS;
intern = Z_XMLREADER_P(id);
@@ -489,7 +477,7 @@ static void php_xmlreader_set_relaxng_schema(INTERNAL_FUNCTION_PARAMETERS, int t
char *source;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p!", &source, &source_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (source != NULL && !source_len) {
@@ -540,6 +528,10 @@ PHP_METHOD(xmlreader, close)
zval *id;
xmlreader_object *intern;
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
id = ZEND_THIS;
intern = Z_XMLREADER_P(id);
/* libxml is segfaulting in versions up to 2.6.8 using xmlTextReaderClose so for
@@ -569,7 +561,7 @@ PHP_METHOD(xmlreader, getAttributeNo)
xmlreader_object *intern;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &attr_pos) == FAILURE) {
- return;
+ RETURN_THROWS();
}
id = ZEND_THIS;
@@ -595,7 +587,7 @@ PHP_METHOD(xmlreader, getAttributeNs)
char *name, *ns_uri, *retchar = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &name, &name_len, &ns_uri, &ns_uri_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (name_len == 0 || ns_uri_len == 0) {
@@ -626,7 +618,7 @@ PHP_METHOD(xmlreader, getParserProperty)
xmlreader_object *intern;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &property) == FAILURE) {
- return;
+ RETURN_THROWS();
}
id = ZEND_THIS;
@@ -673,7 +665,7 @@ PHP_METHOD(xmlreader, moveToAttribute)
char *name;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (name_len == 0) {
@@ -706,7 +698,7 @@ PHP_METHOD(xmlreader, moveToAttributeNo)
xmlreader_object *intern;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &attr_pos) == FAILURE) {
- return;
+ RETURN_THROWS();
}
id = ZEND_THIS;
@@ -735,7 +727,7 @@ PHP_METHOD(xmlreader, moveToAttributeNs)
char *name, *ns_uri;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &name, &name_len, &ns_uri, &ns_uri_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (name_len == 0 || ns_uri_len == 0) {
@@ -789,6 +781,10 @@ PHP_METHOD(xmlreader, read)
int retval;
xmlreader_object *intern;
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
id = ZEND_THIS;
intern = Z_XMLREADER_P(id);
if (intern != NULL && intern->ptr != NULL) {
@@ -816,7 +812,7 @@ PHP_METHOD(xmlreader, next)
char *name = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &name, &name_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
id = ZEND_THIS;
@@ -855,7 +851,7 @@ PHP_METHOD(xmlreader, open)
xmlTextReaderPtr reader = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|s!l", &source, &source_len, &encoding, &encoding_len, &options) == FAILURE) {
- return;
+ RETURN_THROWS();
}
id = getThis();
@@ -941,7 +937,7 @@ PHP_METHOD(xmlreader, setSchema)
char *source;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p!", &source, &source_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (source != NULL && !source_len) {
@@ -983,7 +979,7 @@ PHP_METHOD(xmlreader, setParserProperty)
xmlreader_object *intern;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lb", &property, &value) == FAILURE) {
- return;
+ RETURN_THROWS();
}
id = ZEND_THIS;
@@ -1038,7 +1034,7 @@ PHP_METHOD(xmlreader, XML)
xmlTextReaderPtr reader;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s!l", &source, &source_len, &encoding, &encoding_len, &options) == FAILURE) {
- return;
+ RETURN_THROWS();
}
id = getThis();
@@ -1121,7 +1117,7 @@ PHP_METHOD(xmlreader, expand)
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|O!", &basenode, dom_node_class_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (basenode != NULL) {
@@ -1157,135 +1153,35 @@ PHP_METHOD(xmlreader, expand)
}
/* }}} */
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO(arginfo_xmlreader_close, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_xmlreader_getAttribute, 0)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_xmlreader_getAttributeNo, 0)
- ZEND_ARG_INFO(0, index)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_xmlreader_getAttributeNs, 0)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, namespaceURI)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_xmlreader_getParserProperty, 0)
- ZEND_ARG_INFO(0, property)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_xmlreader_isValid, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_xmlreader_lookupNamespace, 0)
-ZEND_ARG_INFO(0, prefix)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_xmlreader_moveToAttribute, 0)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_xmlreader_moveToAttributeNo, 0)
- ZEND_ARG_INFO(0, index)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_xmlreader_moveToAttributeNs, 0)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, namespaceURI)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_xmlreader_moveToElement, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_xmlreader_moveToFirstAttribute, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_xmlreader_moveToNextAttribute, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_xmlreader_read, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlreader_next, 0, 0, 0)
- ZEND_ARG_INFO(0, localname)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlreader_open, 0, 0, 1)
- ZEND_ARG_INFO(0, URI)
- ZEND_ARG_INFO(0, encoding)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_xmlreader_readInnerXml, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_xmlreader_readOuterXml, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_xmlreader_readString, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_xmlreader_setSchema, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_xmlreader_setParserProperty, 0)
- ZEND_ARG_INFO(0, property)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_xmlreader_setRelaxNGSchema, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_xmlreader_setRelaxNGSchemaSource, 0)
- ZEND_ARG_INFO(0, source)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlreader_XML, 0, 0, 1)
- ZEND_ARG_INFO(0, source)
- ZEND_ARG_INFO(0, encoding)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlreader_expand, 0, 0, 0)
- ZEND_ARG_INFO(0, basenode)
-ZEND_END_ARG_INFO()
-/* }}} */
-
static const zend_function_entry xmlreader_functions[] /* {{{ */ = {
- PHP_ME(xmlreader, close, arginfo_xmlreader_close, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, getAttribute, arginfo_xmlreader_getAttribute, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, getAttributeNo, arginfo_xmlreader_getAttributeNo, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, getAttributeNs, arginfo_xmlreader_getAttributeNs, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, getParserProperty, arginfo_xmlreader_getParserProperty, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, isValid, arginfo_xmlreader_isValid, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, lookupNamespace, arginfo_xmlreader_lookupNamespace, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, moveToAttributeNo, arginfo_xmlreader_moveToAttributeNo, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, moveToAttribute, arginfo_xmlreader_moveToAttribute, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, moveToAttributeNs, arginfo_xmlreader_moveToAttributeNs, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, moveToElement, arginfo_xmlreader_moveToElement, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, moveToFirstAttribute, arginfo_xmlreader_moveToFirstAttribute, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, moveToNextAttribute, arginfo_xmlreader_moveToNextAttribute, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, open, arginfo_xmlreader_open, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC)
- PHP_ME(xmlreader, read, arginfo_xmlreader_read, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, next, arginfo_xmlreader_next, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, readInnerXml, arginfo_xmlreader_readInnerXml, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, readOuterXml, arginfo_xmlreader_readOuterXml, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, readString, arginfo_xmlreader_readString, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, setSchema, arginfo_xmlreader_setSchema, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, close, arginfo_class_XMLReader_close, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, getAttribute, arginfo_class_XMLReader_getAttribute, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, getAttributeNo, arginfo_class_XMLReader_getAttributeNo, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, getAttributeNs, arginfo_class_XMLReader_getAttributeNs, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, getParserProperty, arginfo_class_XMLReader_getParserProperty, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, isValid, arginfo_class_XMLReader_isValid, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, lookupNamespace, arginfo_class_XMLReader_lookupNamespace, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, moveToAttributeNo, arginfo_class_XMLReader_moveToAttributeNo, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, moveToAttribute, arginfo_class_XMLReader_moveToAttribute, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, moveToAttributeNs, arginfo_class_XMLReader_moveToAttributeNs, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, moveToElement, arginfo_class_XMLReader_moveToElement, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, moveToFirstAttribute, arginfo_class_XMLReader_moveToFirstAttribute, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, moveToNextAttribute, arginfo_class_XMLReader_moveToNextAttribute, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, open, arginfo_class_XMLReader_open, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME(xmlreader, read, arginfo_class_XMLReader_read, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, next, arginfo_class_XMLReader_next, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, readInnerXml, arginfo_class_XMLReader_readInnerXml, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, readOuterXml, arginfo_class_XMLReader_readOuterXml, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, readString, arginfo_class_XMLReader_readString, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, setSchema, arginfo_class_XMLReader_setSchema, ZEND_ACC_PUBLIC)
/* Not Yet Implemented though defined in libxml as of 2.6.9dev
PHP_ME(xmlreader, resetState, NULL, ZEND_ACC_PUBLIC)
*/
- PHP_ME(xmlreader, setParserProperty, arginfo_xmlreader_setParserProperty, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, setRelaxNGSchema, arginfo_xmlreader_setRelaxNGSchema, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, setRelaxNGSchemaSource, arginfo_xmlreader_setRelaxNGSchemaSource, ZEND_ACC_PUBLIC)
- PHP_ME(xmlreader, XML, arginfo_xmlreader_XML, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC)
- PHP_ME(xmlreader, expand, arginfo_xmlreader_expand, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, setParserProperty, arginfo_class_XMLReader_setParserProperty, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, setRelaxNGSchema, arginfo_class_XMLReader_setRelaxNGSchema, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, setRelaxNGSchemaSource, arginfo_class_XMLReader_setRelaxNGSchemaSource, ZEND_ACC_PUBLIC)
+ PHP_ME(xmlreader, XML, arginfo_class_XMLReader_XML, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME(xmlreader, expand, arginfo_class_XMLReader_expand, ZEND_ACC_PUBLIC)
PHP_FE_END
}; /* }}} */
@@ -1303,12 +1199,18 @@ PHP_MINIT_FUNCTION(xmlreader)
xmlreader_object_handlers.read_property = xmlreader_read_property;
xmlreader_object_handlers.write_property = xmlreader_write_property;
xmlreader_object_handlers.get_property_ptr_ptr = xmlreader_get_property_ptr_ptr;
+ xmlreader_object_handlers.get_method = xmlreader_get_method;
xmlreader_object_handlers.clone_obj = NULL;
INIT_CLASS_ENTRY(ce, "XMLReader", xmlreader_functions);
ce.create_object = xmlreader_objects_new;
xmlreader_class_entry = zend_register_internal_class(&ce);
+ memcpy(&xmlreader_open_fn, zend_hash_str_find_ptr(&xmlreader_class_entry->function_table, "open", sizeof("open")-1), sizeof(zend_internal_function));
+ xmlreader_open_fn.fn_flags &= ~ZEND_ACC_STATIC;
+ memcpy(&xmlreader_xml_fn, zend_hash_str_find_ptr(&xmlreader_class_entry->function_table, "xml", sizeof("xml")-1), sizeof(zend_internal_function));
+ xmlreader_xml_fn.fn_flags &= ~ZEND_ACC_STATIC;
+
zend_hash_init(&xmlreader_prop_handlers, 0, NULL, php_xmlreader_free_prop_handler, 1);
xmlreader_register_prop_handler(&xmlreader_prop_handlers, "attributeCount", xmlTextReaderAttributeCount, NULL, IS_LONG);
xmlreader_register_prop_handler(&xmlreader_prop_handlers, "baseURI", NULL, xmlTextReaderConstBaseUri, IS_STRING);
diff --git a/ext/xmlreader/php_xmlreader.h b/ext/xmlreader/php_xmlreader.h
index 6c7802224a..f9499c8423 100644
--- a/ext/xmlreader/php_xmlreader.h
+++ b/ext/xmlreader/php_xmlreader.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/xmlreader/tests/001.phpt b/ext/xmlreader/tests/001.phpt
index fa87eba8b4..c10c1a5163 100644
--- a/ext/xmlreader/tests/001.phpt
+++ b/ext/xmlreader/tests/001.phpt
@@ -13,16 +13,14 @@ $reader->XML($xmlstring);
// Only go through
while ($reader->read()) {
- echo $reader->name."\n";
+ echo $reader->name."\n";
}
$xmlstring = '';
$reader = new XMLReader();
$reader->XML($xmlstring);
?>
-===DONE===
--EXPECTF--
books
books
Warning: XMLReader::XML(): Empty string supplied as input in %s on line %d
-===DONE===
diff --git a/ext/xmlreader/tests/002.phpt b/ext/xmlreader/tests/002.phpt
index b2d50731ee..6d12f02204 100644
--- a/ext/xmlreader/tests/002.phpt
+++ b/ext/xmlreader/tests/002.phpt
@@ -14,13 +14,13 @@ if ($reader->open('')) exit();
$reader = new XMLReader();
if (!$reader->open($filename)) {
- $reader->close();
- exit();
+ $reader->close();
+ exit();
}
// Only go through
while ($reader->read()) {
- echo $reader->name."\n";
+ echo $reader->name."\n";
}
$reader->close();
unlink($filename);
@@ -31,9 +31,7 @@ $reader->close();
unlink($filename);
?>
-===DONE===
--EXPECTF--
Warning: XMLReader::open(): Empty string supplied as input in %s on line %d
books
books
-===DONE===
diff --git a/ext/xmlreader/tests/003-get-errors.phpt b/ext/xmlreader/tests/003-get-errors.phpt
index 9e5aa7e38f..a10529118f 100644
--- a/ext/xmlreader/tests/003-get-errors.phpt
+++ b/ext/xmlreader/tests/003-get-errors.phpt
@@ -57,7 +57,6 @@ while ($reader->read()) {
// clean up
$reader->close();
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__.'/003-get-errors.xml');
@@ -74,4 +73,3 @@ NULL
num: 1
NULL
num: 1
-===DONE===
diff --git a/ext/xmlreader/tests/003-mb.phpt b/ext/xmlreader/tests/003-mb.phpt
index 6d3282e6a5..5d0ec4de46 100644
--- a/ext/xmlreader/tests/003-mb.phpt
+++ b/ext/xmlreader/tests/003-mb.phpt
@@ -12,67 +12,66 @@ file_put_contents($filename, $xmlstring);
$reader = new XMLReader();
if (!$reader->open($filename)) {
- exit();
+ exit();
}
// Only go through
while ($reader->read()) {
- if ($reader->nodeType != XMLREADER::END_ELEMENT) {
- if ($reader->nodeType == XMLREADER::ELEMENT && $reader->hasAttributes) {
- $attr = $reader->moveToFirstAttribute();
- echo $reader->name . ": ";
- echo $reader->value . "\n";
+ if ($reader->nodeType != XMLREADER::END_ELEMENT) {
+ if ($reader->nodeType == XMLREADER::ELEMENT && $reader->hasAttributes) {
+ $attr = $reader->moveToFirstAttribute();
+ echo $reader->name . ": ";
+ echo $reader->value . "\n";
- if ($reader->getAttribute($reader->name) == $reader->value) {
- echo "1st attr (num) failed\n";
- }
+ if ($reader->getAttribute($reader->name) == $reader->value) {
+ echo "1st attr (num) failed\n";
+ }
- $attr = $reader->moveToNextAttribute();
- echo $reader->name . ": ";
- echo $reader->value . "\n";
+ $attr = $reader->moveToNextAttribute();
+ echo $reader->name . ": ";
+ echo $reader->value . "\n";
- if ($reader->getAttribute($reader->name) == $reader->value) {
- echo "2nd attr (idx) failed\n";
- }
+ if ($reader->getAttribute($reader->name) == $reader->value) {
+ echo "2nd attr (idx) failed\n";
+ }
- // Named attribute
- $attr = $reader->moveToAttribute('num');
- echo $reader->name . ": ";
- echo $reader->value . "\n";
+ // Named attribute
+ $attr = $reader->moveToAttribute('num');
+ echo $reader->name . ": ";
+ echo $reader->value . "\n";
- if ($reader->getAttribute('num') == $reader->value) {
- echo "attr num failed\n";
- }
+ if ($reader->getAttribute('num') == $reader->value) {
+ echo "attr num failed\n";
+ }
- $attr = $reader->moveToAttribute('idx');
- echo $reader->name . ": ";
- echo $reader->value . "\n";
+ $attr = $reader->moveToAttribute('idx');
+ echo $reader->name . ": ";
+ echo $reader->value . "\n";
- if ($reader->getAttribute('idx') == $reader->value) {
- echo "attr idx failed\n";
- }
+ if ($reader->getAttribute('idx') == $reader->value) {
+ echo "attr idx failed\n";
+ }
- // Numeric positions of attributes
- $attr = $reader->moveToAttributeNo(0);
- echo $reader->name . ": ";
- echo $reader->value . "\n";
+ // Numeric positions of attributes
+ $attr = $reader->moveToAttributeNo(0);
+ echo $reader->name . ": ";
+ echo $reader->value . "\n";
- if ($reader->getAttributeNo(0) == $reader->value) {
- echo "attr 0 failed\n";
- }
+ if ($reader->getAttributeNo(0) == $reader->value) {
+ echo "attr 0 failed\n";
+ }
- $attr = $reader->moveToAttributeNo(1);
- echo $reader->name . ": ";
- echo $reader->value . "\n";
+ $attr = $reader->moveToAttributeNo(1);
+ echo $reader->name . ": ";
+ echo $reader->value . "\n";
- }
- }
+ }
+ }
}
$reader->close();
unlink($filename);
?>
-===DONE===
--EXPECT--
num: 1
idx: 2
@@ -80,4 +79,3 @@ num: 1
idx: 2
num: 1
idx: 2
-===DONE===
diff --git a/ext/xmlreader/tests/003-move-errors.phpt b/ext/xmlreader/tests/003-move-errors.phpt
index 0f21a2747b..a00dbaf524 100644
--- a/ext/xmlreader/tests/003-move-errors.phpt
+++ b/ext/xmlreader/tests/003-move-errors.phpt
@@ -56,7 +56,6 @@ while ($reader->read()) {
// clean up
$reader->close();
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__.'/003-move-errors.xml');
@@ -73,4 +72,3 @@ bool(false)
num: 1
bool(false)
book
-===DONE===
diff --git a/ext/xmlreader/tests/003.phpt b/ext/xmlreader/tests/003.phpt
index ae255220b3..c52c932c97 100644
--- a/ext/xmlreader/tests/003.phpt
+++ b/ext/xmlreader/tests/003.phpt
@@ -12,70 +12,69 @@ file_put_contents($filename, $xmlstring);
$reader = new XMLReader();
if (!$reader->open($filename)) {
- exit();
+ exit();
}
// Only go through
while ($reader->read()) {
- if ($reader->nodeType != XMLREADER::END_ELEMENT) {
- if ($reader->nodeType == XMLREADER::ELEMENT && $reader->hasAttributes) {
- $attr = $reader->moveToFirstAttribute();
- echo $reader->name . ": ";
- echo $reader->value . "\n";
-
- if ($reader->getAttribute($reader->name) == $reader->value) {
- echo "1st attr (num) failed\n";
- }
-
-
- $attr = $reader->moveToNextAttribute();
- echo $reader->name . ": ";
- echo $reader->value . "\n";
-
- if ($reader->getAttribute($reader->name) == $reader->value) {
- echo "2nd attr (idx) failed\n";
- }
-
- // Named attribute
- $attr = $reader->moveToAttribute('num');
- echo $reader->name . ": ";
- echo $reader->value . "\n";
-
- if ($reader->getAttribute('num') == $reader->value) {
- echo "attr num failed\n";
- }
-
- $attr = $reader->moveToAttribute('idx');
- echo $reader->name . ": ";
- echo $reader->value . "\n";
-
- if ($reader->getAttribute('idx') == $reader->value) {
- echo "attr idx failed\n";
- }
-
- // Numeric positions of attributes
- $attr = $reader->moveToAttributeNo(0);
- echo $reader->name . ": ";
- echo $reader->value . "\n";
-
- if ($reader->getAttributeNo(0) == $reader->value) {
- echo "attr 0 failed\n";
- }
-
- $attr = $reader->moveToAttributeNo(1);
- echo $reader->name . ": ";
- echo $reader->value . "\n";
-
- var_dump($reader->moveToAttributeNo(20));
- var_dump($reader->moveToAttribute('missing-attribute'));
- var_dump($reader->moveToAttribute(''));
- }
- }
+ if ($reader->nodeType != XMLREADER::END_ELEMENT) {
+ if ($reader->nodeType == XMLREADER::ELEMENT && $reader->hasAttributes) {
+ $attr = $reader->moveToFirstAttribute();
+ echo $reader->name . ": ";
+ echo $reader->value . "\n";
+
+ if ($reader->getAttribute($reader->name) == $reader->value) {
+ echo "1st attr (num) failed\n";
+ }
+
+
+ $attr = $reader->moveToNextAttribute();
+ echo $reader->name . ": ";
+ echo $reader->value . "\n";
+
+ if ($reader->getAttribute($reader->name) == $reader->value) {
+ echo "2nd attr (idx) failed\n";
+ }
+
+ // Named attribute
+ $attr = $reader->moveToAttribute('num');
+ echo $reader->name . ": ";
+ echo $reader->value . "\n";
+
+ if ($reader->getAttribute('num') == $reader->value) {
+ echo "attr num failed\n";
+ }
+
+ $attr = $reader->moveToAttribute('idx');
+ echo $reader->name . ": ";
+ echo $reader->value . "\n";
+
+ if ($reader->getAttribute('idx') == $reader->value) {
+ echo "attr idx failed\n";
+ }
+
+ // Numeric positions of attributes
+ $attr = $reader->moveToAttributeNo(0);
+ echo $reader->name . ": ";
+ echo $reader->value . "\n";
+
+ if ($reader->getAttributeNo(0) == $reader->value) {
+ echo "attr 0 failed\n";
+ }
+
+ $attr = $reader->moveToAttributeNo(1);
+ echo $reader->name . ": ";
+ echo $reader->value . "\n";
+
+ var_dump($reader->moveToAttributeNo(20));
+ var_dump($reader->moveToAttribute('missing-attribute'));
+ var_dump($reader->moveToAttribute(''));
+ }
+ }
}
$reader->close();
unlink($filename);
?>
-===DONE===
--EXPECTF--
num: 1
idx: 2
@@ -88,4 +87,3 @@ bool(false)
Warning: XMLReader::moveToAttribute(): Attribute Name is required in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/xmlreader/tests/004.phpt b/ext/xmlreader/tests/004.phpt
index 915a14bccf..9362c2b1a1 100644
--- a/ext/xmlreader/tests/004.phpt
+++ b/ext/xmlreader/tests/004.phpt
@@ -12,26 +12,25 @@ file_put_contents($filename, $xmlstring);
$reader = new XMLReader();
if (!$reader->open($filename)) {
- exit();
+ exit();
}
while ($reader->read()) {
- if ($reader->nodeType != XMLREADER::END_ELEMENT) {
- echo $reader->name."\n";
- if ($reader->nodeType == XMLREADER::ELEMENT && $reader->hasAttributes) {
- $attr = $reader->moveToFirstAttribute();
- while ($attr) {
- echo " Attribute Name: ".$reader->name."\n";
- echo " Attribute Value: ".$reader->value."\n";
- $attr = $reader->moveToNextAttribute();
- }
- }
- }
+ if ($reader->nodeType != XMLREADER::END_ELEMENT) {
+ echo $reader->name."\n";
+ if ($reader->nodeType == XMLREADER::ELEMENT && $reader->hasAttributes) {
+ $attr = $reader->moveToFirstAttribute();
+ while ($attr) {
+ echo " Attribute Name: ".$reader->name."\n";
+ echo " Attribute Value: ".$reader->value."\n";
+ $attr = $reader->moveToNextAttribute();
+ }
+ }
+ }
}
$reader->close();
unlink($filename);
?>
-===DONE===
--EXPECT--
books
book
@@ -40,4 +39,3 @@ book
Attribute Name: idx
Attribute Value: 2
#text
-===DONE===
diff --git a/ext/xmlreader/tests/005.phpt b/ext/xmlreader/tests/005.phpt
index ea34f89108..e50b840ef5 100644
--- a/ext/xmlreader/tests/005.phpt
+++ b/ext/xmlreader/tests/005.phpt
@@ -17,20 +17,18 @@ $a = $reader->setParserProperty(XMLReader::LOADDTD, false);
$b = $reader->getParserProperty(XMLReader::LOADDTD);
if (!$a && !$b) {
- echo "ok\n";
+ echo "ok\n";
}
$a = $reader->setParserProperty(XMLReader::SUBST_ENTITIES, true);
$b = $reader->getParserProperty(XMLReader::SUBST_ENTITIES);
if ($a && $b) {
- echo "ok\n";
+ echo "ok\n";
}
// Only go through
while ($reader->read());
$reader->close();
?>
-===DONE===
--EXPECT--
ok
-===DONE===
diff --git a/ext/xmlreader/tests/006.phpt b/ext/xmlreader/tests/006.phpt
index fce705c262..9702e28270 100644
--- a/ext/xmlreader/tests/006.phpt
+++ b/ext/xmlreader/tests/006.phpt
@@ -17,19 +17,17 @@ $reader->read();
$reader->read();
if ($reader->nodeType != XMLREADER::END_ELEMENT) {
- if ($reader->nodeType == XMLREADER::ELEMENT && $reader->hasAttributes) {
- $attr = $reader->moveToFirstAttribute();
- if ($reader->moveToElement()) {
- if ($reader->name == 'book') {
- echo "ok\n";
- }
- }
- }
+ if ($reader->nodeType == XMLREADER::ELEMENT && $reader->hasAttributes) {
+ $attr = $reader->moveToFirstAttribute();
+ if ($reader->moveToElement()) {
+ if ($reader->name == 'book') {
+ echo "ok\n";
+ }
+ }
+ }
}
$reader->close();
?>
-===DONE===
--EXPECT--
ok
-===DONE===
diff --git a/ext/xmlreader/tests/007.phpt b/ext/xmlreader/tests/007.phpt
index 88e8800054..796b9fa05c 100644
--- a/ext/xmlreader/tests/007.phpt
+++ b/ext/xmlreader/tests/007.phpt
@@ -43,14 +43,12 @@ $reader = new XMLReader();
$reader->XML($xmlstring);
if ($reader->setRelaxNGSchema('')) {
- echo 'failed';
+ echo 'failed';
}
$reader->close();
?>
-===DONE===
--EXPECTF--
file relaxNG: ok
string relaxNG: ok
Warning: XMLReader::setRelaxNGSchema(): Schema data source is required in %s on line %d
-===DONE===
diff --git a/ext/xmlreader/tests/008.phpt b/ext/xmlreader/tests/008.phpt
index ceb0972376..12361a0efc 100644
--- a/ext/xmlreader/tests/008.phpt
+++ b/ext/xmlreader/tests/008.phpt
@@ -32,7 +32,7 @@ $reader->setParserProperty(XMLREADER::LOADDTD, TRUE);
$reader->setParserProperty(XMLREADER::VALIDATE, TRUE);
while($reader->read());
if ($reader->isValid()) {
- echo "file DTD: ok\n";
+ echo "file DTD: ok\n";
}
$reader->close();
unlink($file);
@@ -60,11 +60,9 @@ $reader->setParserProperty(XMLREADER::LOADDTD, TRUE);
$reader->setParserProperty(XMLREADER::VALIDATE, TRUE);
while($reader->read());
if ($reader->isValid()) {
- echo "string DTD: ok\n";
+ echo "string DTD: ok\n";
}
?>
-===DONE===
--EXPECT--
file DTD: ok
string DTD: ok
-===DONE===
diff --git a/ext/xmlreader/tests/009.phpt b/ext/xmlreader/tests/009.phpt
index e988563b42..d626ea6f35 100644
--- a/ext/xmlreader/tests/009.phpt
+++ b/ext/xmlreader/tests/009.phpt
@@ -21,7 +21,5 @@ echo " ";
echo $reader->getAttribute('num');
echo "\n";
?>
-===DONE===
--EXPECT--
book 2
-===DONE===
diff --git a/ext/xmlreader/tests/010.phpt b/ext/xmlreader/tests/010.phpt
index 4a1ebe174e..1ad864b59c 100644
--- a/ext/xmlreader/tests/010.phpt
+++ b/ext/xmlreader/tests/010.phpt
@@ -20,7 +20,5 @@ echo " ";
echo $reader->getAttributeNs('isbn', 'uri');
echo "\n";
?>
-===DONE===
--EXPECT--
prefix:books 12isbn
-===DONE===
diff --git a/ext/xmlreader/tests/011.phpt b/ext/xmlreader/tests/011.phpt
index 658c37f03b..3cf704b234 100644
--- a/ext/xmlreader/tests/011.phpt
+++ b/ext/xmlreader/tests/011.phpt
@@ -26,8 +26,6 @@ echo $reader->readOuterXml();
echo "\n";
$reader->close();
?>
-===DONE===
--EXPECT--
<book>test</book>
<books><book>test</book></books>
-===DONE===
diff --git a/ext/xmlreader/tests/012.phpt b/ext/xmlreader/tests/012.phpt
index ba4455ade7..20d26eaa4b 100644
--- a/ext/xmlreader/tests/012.phpt
+++ b/ext/xmlreader/tests/012.phpt
@@ -25,7 +25,7 @@ EOF;
$xmlstring = str_replace('012.dtd', __DIR__.'/012.dtd', $xmlstring);
if (DIRECTORY_SEPARATOR == '\\') {
- $xmlstring = str_replace('\\',"/", $xmlstring);
+ $xmlstring = str_replace('\\',"/", $xmlstring);
}
$reader = new XMLReader();
$reader->XML($xmlstring);
@@ -39,7 +39,7 @@ echo "\nUsing URI:\n";
$reader = new XMLReader();
$file = __DIR__ . '/012.xml';
if (DIRECTORY_SEPARATOR == '\\') {
- $file = str_replace('\\',"/", $file);
+ $file = str_replace('\\',"/", $file);
}
$reader->open($file);
@@ -59,7 +59,6 @@ var_dump($reader->getAttribute('baz'));
$reader->close();
?>
-===DONE===
--EXPECT--
string(0) ""
NULL
@@ -71,4 +70,3 @@ string(0) ""
NULL
string(0) ""
string(0) ""
-===DONE===
diff --git a/ext/xmlreader/tests/013.phpt b/ext/xmlreader/tests/013.phpt
index bceccced6b..1396485e9a 100644
--- a/ext/xmlreader/tests/013.phpt
+++ b/ext/xmlreader/tests/013.phpt
@@ -18,10 +18,10 @@ $reader = new XMLReader();
$reader->XML($xml);
$reader->setSchema(__DIR__ . '/013.xsd');
while($reader->read()) {
- if ($reader->nodeType == XMLReader::ELEMENT && $reader->name == 'item') {
- $reader->read();
- var_dump($reader->value);
- }
+ if ($reader->nodeType == XMLReader::ELEMENT && $reader->name == 'item') {
+ $reader->read();
+ var_dump($reader->value);
+ }
}
$reader->close();
@@ -41,11 +41,9 @@ while($reader->read() && $reader->nodeType != XMLReader::ELEMENT);
$reader->close();
?>
-===DONE===
--EXPECTF--
string(3) "123"
string(3) "456"
===FAIL===
Warning: XMLReader::read(): Element 'foo': %s
-===DONE===
diff --git a/ext/xmlreader/tests/014.phpt b/ext/xmlreader/tests/014.phpt
index 5969da62f2..fca94d2b1f 100644
--- a/ext/xmlreader/tests/014.phpt
+++ b/ext/xmlreader/tests/014.phpt
@@ -37,7 +37,6 @@ while ($reader->read()) {
// clean up
$reader->close();
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__.'/_014.xml');
@@ -48,4 +47,3 @@ Warning: main(): Cannot write to read-only property in %s on line %d
Warning: main(): Cannot write to read-only property in %s on line %d
Warning: main(): Cannot write to read-only property in %s on line %d
-===DONE===
diff --git a/ext/xmlreader/tests/015-get-errors.phpt b/ext/xmlreader/tests/015-get-errors.phpt
index 06f7eef53b..5f17326b1b 100644
--- a/ext/xmlreader/tests/015-get-errors.phpt
+++ b/ext/xmlreader/tests/015-get-errors.phpt
@@ -37,7 +37,6 @@ while ($reader->read()) {
// clean up
$reader->close();
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__.'/015-get-errors.xml');
@@ -46,4 +45,3 @@ unlink(__DIR__.'/015-get-errors.xml');
Warning: XMLReader::getAttributeNs(): Attribute Name and Namespace URI cannot be empty in %s on line %d
bool(false)
ns1:num: 1
-===DONE===
diff --git a/ext/xmlreader/tests/015-move-errors.phpt b/ext/xmlreader/tests/015-move-errors.phpt
index ab2472258f..5263b555b6 100644
--- a/ext/xmlreader/tests/015-move-errors.phpt
+++ b/ext/xmlreader/tests/015-move-errors.phpt
@@ -32,11 +32,9 @@ while ($reader->read()) {
// clean up
$reader->close();
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__.'/015-move-errors.xml');
?>
--EXPECTF--
Warning: XMLReader::moveToAttributeNs(): Attribute Name and Namespace URI cannot be empty in %s on line %d
-===DONE===
diff --git a/ext/xmlreader/tests/015.phpt b/ext/xmlreader/tests/015.phpt
index b60d1395c8..a11da78fe5 100644
--- a/ext/xmlreader/tests/015.phpt
+++ b/ext/xmlreader/tests/015.phpt
@@ -52,7 +52,6 @@ while ($reader->read()) {
// clean up
$reader->close();
?>
-===DONE===
--CLEAN--
<?php
unlink(__DIR__.'/015.xml');
@@ -63,4 +62,3 @@ ns2:idx: 2
ns2:isbn: 4
Attribute does not exist
ns2:isbn: 4
-===DONE===
diff --git a/ext/xmlreader/tests/bug64230.phpt b/ext/xmlreader/tests/bug64230.phpt
index fb1ab4932f..b584d8f7cf 100644
--- a/ext/xmlreader/tests/bug64230.phpt
+++ b/ext/xmlreader/tests/bug64230.phpt
@@ -9,10 +9,10 @@ extension_loaded("xmlreader") or die("skip requires xmlreader");
echo "Test\n";
function show_internal_errors() {
- foreach (libxml_get_errors() as $error) {
- printf("Internal: %s\n", $error->message);
- }
- libxml_clear_errors();
+ foreach (libxml_get_errors() as $error) {
+ printf("Internal: %s\n", $error->message);
+ }
+ libxml_clear_errors();
}
echo "Internal errors TRUE\n";
diff --git a/ext/xmlreader/tests/bug71805.phpt b/ext/xmlreader/tests/bug71805.phpt
index 6f54b1347a..9fc66ea2a4 100644
--- a/ext/xmlreader/tests/bug71805.phpt
+++ b/ext/xmlreader/tests/bug71805.phpt
@@ -9,31 +9,29 @@ TestXML(__DIR__ . DIRECTORY_SEPARATOR . 'XMLReaderGood_bug71805.xml');
TestXML(__DIR__ . DIRECTORY_SEPARATOR . 'XMLReaderBad_bug71805.xml');
function TestXML($file) {
- $XR = new XMLReader;
- $XR->open($file, null, LIBXML_NOBLANKS);
+ $XR = new XMLReader;
+ $XR->open($file, null, LIBXML_NOBLANKS);
- while (($lastRead = $XR->read()) && ($XR->name !== 'records'));
- while (($lastRead = $XR->read()) && ($XR->name !== 'record'));
- while ($lastRead) {
- $xml = $XR->readOuterXML();
- if ($xml === '') {
- $err = '';
- if ($e = libxml_get_last_error()) { $err = $e->message.' (line: '.$e->line.')'; }
- $XR->close();
- echo $file.' : Problem with file'.($err ? ' — '.$err : '').'.';
- echo "\n";
- return;
- }
- while (($lastRead = $XR->next()) && ($XR->name !== 'record'));
- }
- $XR->close();
- echo $file.' : Good!';
- echo "\n";
- return;
+ while (($lastRead = $XR->read()) && ($XR->name !== 'records'));
+ while (($lastRead = $XR->read()) && ($XR->name !== 'record'));
+ while ($lastRead) {
+ $xml = $XR->readOuterXML();
+ if ($xml === '') {
+ $err = '';
+ if ($e = libxml_get_last_error()) { $err = $e->message.' (line: '.$e->line.')'; }
+ $XR->close();
+ echo $file.' : Problem with file'.($err ? ' — '.$err : '').'.';
+ echo "\n";
+ return;
+ }
+ while (($lastRead = $XR->next()) && ($XR->name !== 'record'));
+ }
+ $XR->close();
+ echo $file.' : Good!';
+ echo "\n";
+ return;
}
?>
-===DONE===
--EXPECTF--
%sXMLReaderGood_bug71805.xml : Good!
%sXMLReaderBad_bug71805.xml : Good!
-===DONE===
diff --git a/ext/xmlreader/tests/bug73053.phpt b/ext/xmlreader/tests/bug73053.phpt
index 4a7ace50eb..b22afb7afa 100644
--- a/ext/xmlreader/tests/bug73053.phpt
+++ b/ext/xmlreader/tests/bug73053.phpt
@@ -15,7 +15,5 @@ var_dump($xml->open($xmlfile, null, LIBXML_PARSEHUGE));
$xml->setSchema($xsdfile);
while($xml->read());
?>
-===DONE===
--EXPECT--
bool(true)
-===DONE===
diff --git a/ext/xmlreader/tests/bug74457.phpt b/ext/xmlreader/tests/bug74457.phpt
index 17ed5c5c69..1217021ff5 100644
--- a/ext/xmlreader/tests/bug74457.phpt
+++ b/ext/xmlreader/tests/bug74457.phpt
@@ -8,8 +8,6 @@ $rm = new ReflectionMethod(XMLReader::class, 'expand');
var_dump($rm->getNumberOfParameters());
var_dump($rm->getNumberOfRequiredParameters());
?>
-===DONE===
--EXPECT--
int(1)
int(0)
-===DONE===
diff --git a/ext/xmlreader/tests/expand.phpt b/ext/xmlreader/tests/expand.phpt
index 3d9b0a53c3..d63e6e0d6d 100644
--- a/ext/xmlreader/tests/expand.phpt
+++ b/ext/xmlreader/tests/expand.phpt
@@ -31,7 +31,5 @@ while ($reader->read()) {
}
$reader->close();
?>
-===DONE===
--EXPECT--
base book
-===DONE===
diff --git a/ext/xmlreader/tests/static.phpt b/ext/xmlreader/tests/static.phpt
new file mode 100644
index 0000000000..1c6cb5b870
--- /dev/null
+++ b/ext/xmlreader/tests/static.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Calling XMLReader::open() and ::XML() statically
+--SKIPIF--
+<?php
+if (!extension_loaded("xmlreader")) die('skip xmlreader extension not available');
+?>
+--FILE--
+<?php
+$filename = __DIR__ . '/static.xml';
+
+$xmlstring = '<?xml version="1.0" encoding="UTF-8"?>
+<books></books>';
+file_put_contents($filename, $xmlstring);
+
+$reader = XMLReader::open($filename);
+while ($reader->read()) {
+ echo $reader->name, "\n";
+}
+
+$reader = XMLReader::XML($xmlstring);
+while ($reader->read()) {
+ echo $reader->name, "\n";
+}
+?>
+--EXPECTF--
+books
+books
+books
+books
+--CLEAN--
+<?php
+unlink(__DIR__ . '/static.xml');
+?>
diff --git a/ext/xmlreader/xmlreader.stub.php b/ext/xmlreader/xmlreader.stub.php
new file mode 100644
index 0000000000..6608e60768
--- /dev/null
+++ b/ext/xmlreader/xmlreader.stub.php
@@ -0,0 +1,79 @@
+<?php
+
+class XMLReader
+{
+ /** @return bool */
+ function close() {}
+
+ /** @return string|null|false */
+ function getAttribute(string $name) {}
+
+ /** @return ?string */
+ function getAttributeNo(int $index) {}
+
+ /** @return string|null|false */
+ function getAttributeNs(string $name, string $namespaceURI) {}
+
+ /** @return bool */
+ function getParserProperty(int $property) {}
+
+ /** @return bool */
+ function isValid() {}
+
+ /** @return string|null|false */
+ function lookupNamespace(string $prefix) {}
+
+ /** @return bool */
+ function moveToAttribute(string $name) {}
+
+ /** @return bool */
+ function moveToAttributeNo(int $index) {}
+
+ /** @return bool */
+ function moveToAttributeNs(string $name, string $namespaceURI) {}
+
+ /** @return bool */
+ function moveToElement() {}
+
+ /** @return bool */
+ function moveToFirstAttribute() {}
+
+ /** @return bool */
+ function moveToNextAttribute() {}
+
+ /** @return bool */
+ function read() {}
+
+ /** @return bool */
+ function next(string $localname = UNKNOWN) {}
+
+ /** @return bool|XMLReader */
+ function open(string $URI, ?string $encoding = null, int $options = 0) {}
+
+ /** @return string */
+ function readInnerXml() {}
+
+ /** @return string */
+ function readOuterXml() {}
+
+ /** @return string */
+ function readString() {}
+
+ /** @return bool */
+ function setSchema(?string $filename) {}
+
+ /** @return bool */
+ function setParserProperty(int $property, bool $value) {}
+
+ /** @return bool */
+ function setRelaxNGSchema(?string $filename) {}
+
+ /** @return bool */
+ function setRelaxNGSchemaSource(?string $source) {}
+
+ /** @return bool|XMLReader */
+ function XML(string $source, ?string $encoding = null, int $options = 0) {}
+
+ /** @return DOMNode|bool */
+ function expand(?DOMNode $basenode = null) {}
+}
diff --git a/ext/xmlreader/xmlreader_arginfo.h b/ext/xmlreader/xmlreader_arginfo.h
new file mode 100644
index 0000000000..2c93edeee6
--- /dev/null
+++ b/ext/xmlreader/xmlreader_arginfo.h
@@ -0,0 +1,82 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_close, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_getAttribute, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_getAttributeNo, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_getAttributeNs, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, namespaceURI, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_getParserProperty, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, property, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_XMLReader_isValid arginfo_class_XMLReader_close
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_lookupNamespace, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, prefix, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_XMLReader_moveToAttribute arginfo_class_XMLReader_getAttribute
+
+#define arginfo_class_XMLReader_moveToAttributeNo arginfo_class_XMLReader_getAttributeNo
+
+#define arginfo_class_XMLReader_moveToAttributeNs arginfo_class_XMLReader_getAttributeNs
+
+#define arginfo_class_XMLReader_moveToElement arginfo_class_XMLReader_close
+
+#define arginfo_class_XMLReader_moveToFirstAttribute arginfo_class_XMLReader_close
+
+#define arginfo_class_XMLReader_moveToNextAttribute arginfo_class_XMLReader_close
+
+#define arginfo_class_XMLReader_read arginfo_class_XMLReader_close
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_next, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, localname, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_open, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, URI, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_XMLReader_readInnerXml arginfo_class_XMLReader_close
+
+#define arginfo_class_XMLReader_readOuterXml arginfo_class_XMLReader_close
+
+#define arginfo_class_XMLReader_readString arginfo_class_XMLReader_close
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_setSchema, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_setParserProperty, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, property, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, value, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_XMLReader_setRelaxNGSchema arginfo_class_XMLReader_setSchema
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_setRelaxNGSchemaSource, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, source, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_XML, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, source, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_XMLReader_expand, 0, 0, 0)
+ ZEND_ARG_OBJ_INFO(0, basenode, DOMNode, 1)
+ZEND_END_ARG_INFO()
diff --git a/ext/xmlrpc/libxmlrpc/xml_element.h b/ext/xmlrpc/libxmlrpc/xml_element.h
index 7ff87af445..73ae029ffb 100644
--- a/ext/xmlrpc/libxmlrpc/xml_element.h
+++ b/ext/xmlrpc/libxmlrpc/xml_element.h
@@ -55,7 +55,7 @@ extern "C" {
typedef enum _xml_elem_verbosity {
xml_elem_no_white_space, /* compact xml with no white space */
xml_elem_newlines_only, /* add newlines for enhanced readability */
- xml_elem_pretty /* add newlines and indent accordint to depth */
+ xml_elem_pretty /* add newlines and indent accordind to depth */
} XML_ELEM_VERBOSITY;
/******/
diff --git a/ext/xmlrpc/php_xmlrpc.h b/ext/xmlrpc/php_xmlrpc.h
index fbc29485ec..419784a55c 100644
--- a/ext/xmlrpc/php_xmlrpc.h
+++ b/ext/xmlrpc/php_xmlrpc.h
@@ -35,8 +35,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/xmlrpc/tests/001.phpt b/ext/xmlrpc/tests/001.phpt
index 49dfba8f10..af41530ab2 100644
--- a/ext/xmlrpc/tests/001.phpt
+++ b/ext/xmlrpc/tests/001.phpt
@@ -7,7 +7,6 @@ xmlrpc_encode_request() with wrong arguments
var_dump(xmlrpc_encode_request(-1, 1));
var_dump(xmlrpc_encode_request("", 1));
-var_dump(xmlrpc_encode_request(array(), 1));
var_dump(xmlrpc_encode_request(3.4, 1));
echo "Done\n";
@@ -37,9 +36,6 @@ string(160) "<?xml version="1.0" encoding="iso-8859-1"?>
</params>
</methodCall>
"
-
-Warning: xmlrpc_encode_request() expects parameter 1 to be string, array given in %s on line %d
-NULL
string(175) "<?xml version="1.0" encoding="iso-8859-1"?>
<methodCall>
<methodName>3.4</methodName>
diff --git a/ext/xmlrpc/tests/002.phpt b/ext/xmlrpc/tests/002.phpt
index cb4b4aa818..a791082337 100644
--- a/ext/xmlrpc/tests/002.phpt
+++ b/ext/xmlrpc/tests/002.phpt
@@ -21,10 +21,6 @@ $r = xmlrpc_encode_request(-1, "");
var_dump(xmlrpc_decode_request($r, $method));
var_dump($method);
-$r = xmlrpc_encode_request(array(), 1);
-var_dump(xmlrpc_decode_request($r, $method));
-var_dump($method);
-
echo "Done\n";
?>
--EXPECTF--
@@ -46,8 +42,4 @@ array(1) {
string(0) ""
}
string(2) "-1"
-
-Warning: xmlrpc_encode_request() expects parameter 1 to be string, array given in %s on line %d
-NULL
-string(2) "-1"
Done
diff --git a/ext/xmlrpc/tests/003.phpt b/ext/xmlrpc/tests/003.phpt
index 1125ff2b9c..f164a377da 100644
--- a/ext/xmlrpc/tests/003.phpt
+++ b/ext/xmlrpc/tests/003.phpt
@@ -6,27 +6,27 @@ xmlrpc_encode() Simple test encode array
<?php
$params = array(
- "one" => "red",
- "two" => "blue",
- "three" => "green"
+ "one" => "red",
+ "two" => "blue",
+ "three" => "green"
);
$response = xmlrpc_encode($params);
echo $response;
$params = array(
- "red",
- "blue",
- "green"
+ "red",
+ "blue",
+ "green"
);
$response = xmlrpc_encode($params);
echo $response;
$params = array(
- 0 => "red",
- 1 => "blue",
- 3 => "green"
+ 0 => "red",
+ 1 => "blue",
+ 3 => "green"
);
$response = xmlrpc_encode($params);
diff --git a/ext/xmlrpc/tests/bug42736.phpt b/ext/xmlrpc/tests/bug42736.phpt
index 9ab2818169..bb6b787295 100644
--- a/ext/xmlrpc/tests/bug42736.phpt
+++ b/ext/xmlrpc/tests/bug42736.phpt
@@ -6,9 +6,9 @@ Bug #42736 (xmlrpc_server_call_method() crashes)
<?php
class SOAP_Array {
- public function get($id){
- return $this->add($id);
- }
+ public function get($id){
+ return $this->add($id);
+ }
}
$xml = xmlrpc_server_create();
@@ -16,9 +16,9 @@ $xml = xmlrpc_server_create();
$Myrequest = '<?xml version="1.0" encoding="UTF-8"?><methodCall><methodName>GetProducts</methodName><params><param><value><dateTime.iso8601>20060922T14:26:19</dateTime.iso8601></value></param></params></methodCall>';
class MyClass {
- function GetProducts($dummy, $time){
- return array('faultString' => $time);
- }
+ function GetProducts($dummy, $time){
+ return array('faultString' => $time);
+ }
}
$myclass = new MyClass();
xmlrpc_server_register_method($xml, 'GetProducts', array($myclass, 'GetProducts'));
diff --git a/ext/xmlrpc/tests/bug45556.phpt b/ext/xmlrpc/tests/bug45556.phpt
index 34897d8c9b..485f2c12de 100644
--- a/ext/xmlrpc/tests/bug45556.phpt
+++ b/ext/xmlrpc/tests/bug45556.phpt
@@ -13,9 +13,9 @@ $server = xmlrpc_server_create ();
function foo() { return 11111; }
class bar {
- static public function test() {
- return 'foo';
- }
+ static public function test() {
+ return 'foo';
+ }
}
xmlrpc_server_register_introspection_callback($server, 'foobar');
@@ -29,6 +29,6 @@ xmlrpc_server_call_method ($server, $request, NULL, $options);
--EXPECTF--
Warning: xmlrpc_server_call_method(): Invalid callback 'foobar' passed in %s on line %d
-Warning: xmlrpc_server_call_method(): xml parse error: [line 1, column 1, message: Invalid document end] Unable to add introspection data returned from bar::test() in %s on line %d
+Warning: xmlrpc_server_call_method(): XML parse error: [line 1, column 1, message: Invalid document end] Unable to add introspection data returned from bar::test() in %s on line %d
Warning: xmlrpc_server_call_method(): Invalid callback 'foo::bar' passed in %s on line %d
diff --git a/ext/xmlrpc/tests/bug72155.phpt b/ext/xmlrpc/tests/bug72155.phpt
index 40c6c56237..6e05a5113c 100644
--- a/ext/xmlrpc/tests/bug72155.phpt
+++ b/ext/xmlrpc/tests/bug72155.phpt
@@ -7,9 +7,9 @@ if (!extension_loaded("xmlrpc")) print "skip";
--FILE--
<?php
if (false !== strpos(PHP_OS, "WIN")) {
- $fl = "c:\\windows\\explorer.exe";
+ $fl = "c:\\windows\\explorer.exe";
} else {
- $fl = "/etc/passwd";
+ $fl = "/etc/passwd";
}
$var0 = fopen($fl,"r");
$var1 = xmlrpc_encode($var0);
diff --git a/ext/xmlrpc/xmlrpc-epi-php.c b/ext/xmlrpc/xmlrpc-epi-php.c
index 64ae65eec8..28515f6cd7 100644
--- a/ext/xmlrpc/xmlrpc-epi-php.c
+++ b/ext/xmlrpc/xmlrpc-epi-php.c
@@ -35,8 +35,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -70,75 +68,10 @@
#include "php_ini.h"
#include "php_xmlrpc.h"
#include "xmlrpc.h"
+#include "xmlrpc_arginfo.h"
static int le_xmlrpc_server;
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_encode, 0, 0, 1)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_decode, 0, 0, 1)
- ZEND_ARG_INFO(0, value)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_decode_request, 0, 0, 2)
- ZEND_ARG_INFO(0, xml)
- ZEND_ARG_INFO(1, method)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_encode_request, 0, 0, 2)
- ZEND_ARG_INFO(0, method)
- ZEND_ARG_INFO(0, params)
- ZEND_ARG_INFO(0, output_options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_set_type, 0, 0, 2)
- ZEND_ARG_INFO(1, value)
- ZEND_ARG_INFO(0, type)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_is_fault, 0, 0, 1)
- ZEND_ARG_INFO(0, arg)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_xmlrpc_server_create, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_server_destroy, 0, 0, 1)
- ZEND_ARG_INFO(0, server)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_server_register_method, 0, 0, 3)
- ZEND_ARG_INFO(0, server)
- ZEND_ARG_INFO(0, method_name)
- ZEND_ARG_INFO(0, function)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_server_call_method, 0, 0, 3)
- ZEND_ARG_INFO(0, server)
- ZEND_ARG_INFO(0, xml)
- ZEND_ARG_INFO(0, user_data)
- ZEND_ARG_INFO(0, output_options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_parse_method_descriptions, 0, 0, 1)
- ZEND_ARG_INFO(0, xml)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_server_add_introspection_data, 0, 0, 2)
- ZEND_ARG_INFO(0, server)
- ZEND_ARG_INFO(0, desc)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_server_register_introspection_callback, 0, 0, 2)
- ZEND_ARG_INFO(0, server)
- ZEND_ARG_INFO(0, function)
-ZEND_END_ARG_INFO()
-/* }}} */
-
static const zend_function_entry xmlrpc_functions[] = {
PHP_FE(xmlrpc_encode, arginfo_xmlrpc_encode)
PHP_FE(xmlrpc_decode, arginfo_xmlrpc_decode)
@@ -463,7 +396,7 @@ static void set_output_options(php_output_options* options, zval* output_opts)
/* php arrays have no distinction between array and struct types.
* they even allow mixed. Thus, we determine the type by iterating
* through the entire array and figuring out each element.
- * room for some optimation here if we stop after a specific # of elements.
+ * room for some optimisation here if we stop after a specific # of elements.
*/
static XMLRPC_VECTOR_TYPE determine_vector_type (HashTable *ht)
{
@@ -676,7 +609,7 @@ PHP_FUNCTION(xmlrpc_encode_request)
php_output_options out;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s!z|a", &method, &method_len, &vals, &out_opts) == FAILURE) {
- return;
+ RETURN_THROWS();
}
set_output_options(&out, out_opts ? out_opts : 0);
@@ -724,7 +657,7 @@ PHP_FUNCTION(xmlrpc_encode)
char *outBuf;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &arg1) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (USED_RET()) {
@@ -790,7 +723,7 @@ PHP_FUNCTION(xmlrpc_decode_request)
size_t xml_len, encoding_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sz|s", &xml, &xml_len, &method, &encoding, &encoding_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (USED_RET()) {
@@ -807,7 +740,7 @@ PHP_FUNCTION(xmlrpc_decode)
size_t arg1_len, arg2_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", &arg1, &arg1_len, &arg2, &arg2_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (USED_RET()) {
@@ -825,7 +758,7 @@ PHP_FUNCTION(xmlrpc_decode)
PHP_FUNCTION(xmlrpc_server_create)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (USED_RET()) {
@@ -853,11 +786,11 @@ PHP_FUNCTION(xmlrpc_server_destroy)
xmlrpc_server_data *server;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &arg1) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((server = (xmlrpc_server_data *)zend_fetch_resource(Z_RES_P(arg1), "xmlrpc server", le_xmlrpc_server)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
bSuccess = zend_list_close(Z_RES_P(arg1));
@@ -944,7 +877,7 @@ static void php_xmlrpc_introspection_callback(XMLRPC_SERVER server, void* data)
} else {
/* could not create description */
if (err.xml_elem_error.parser_code) {
- php_error_docref(NULL, E_WARNING, "xml parse error: [line %ld, column %ld, message: %s] Unable to add introspection data returned from %s()",
+ php_error_docref(NULL, E_WARNING, "XML parse error: [line %ld, column %ld, message: %s] Unable to add introspection data returned from %s()",
err.xml_elem_error.column, err.xml_elem_error.line, err.xml_elem_error.parser_error, ZSTR_VAL(php_function_name));
} else {
php_error_docref(NULL, E_WARNING, "Unable to add introspection data returned from %s()", ZSTR_VAL(php_function_name));
@@ -976,11 +909,11 @@ PHP_FUNCTION(xmlrpc_server_register_method)
xmlrpc_server_data* server;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsz", &handle, &method_key, &method_key_len, &method_name) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((server = (xmlrpc_server_data *)zend_fetch_resource(Z_RES_P(handle), "xmlrpc server", le_xmlrpc_server)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* register with C engine. every method just calls our standard callback,
@@ -1006,11 +939,11 @@ PHP_FUNCTION(xmlrpc_server_register_introspection_callback)
xmlrpc_server_data* server;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz", &handle, &method_name) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((server = (xmlrpc_server_data *)zend_fetch_resource(Z_RES_P(handle), "xmlrpc server", le_xmlrpc_server)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
Z_TRY_ADDREF_P(method_name);
@@ -1038,7 +971,7 @@ PHP_FUNCTION(xmlrpc_server_call_method)
int argc = ZEND_NUM_ARGS();
if (zend_parse_parameters(argc, "rsz|a", &handle, &rawxml, &rawxml_len, &caller_params, &output_opts) != SUCCESS) {
- return;
+ RETURN_THROWS();
}
/* user output options */
if (argc == 3) {
@@ -1048,7 +981,7 @@ PHP_FUNCTION(xmlrpc_server_call_method)
}
if ((server = (xmlrpc_server_data *)zend_fetch_resource(Z_RES_P(handle), "xmlrpc server", le_xmlrpc_server)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* HACK: use output encoding for now */
@@ -1140,11 +1073,11 @@ PHP_FUNCTION(xmlrpc_server_add_introspection_data)
XMLRPC_VALUE xDesc;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ra", &handle, &desc) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((server = (xmlrpc_server_data *)zend_fetch_resource(Z_RES_P(handle), "xmlrpc server", le_xmlrpc_server)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
xDesc = PHP_to_XMLRPC(desc);
@@ -1165,7 +1098,7 @@ PHP_FUNCTION(xmlrpc_parse_method_descriptions)
size_t arg1_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &arg1, &arg1_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (USED_RET()) {
@@ -1178,13 +1111,13 @@ PHP_FUNCTION(xmlrpc_parse_method_descriptions)
} else {
/* could not create description */
if (err.xml_elem_error.parser_code) {
- php_error_docref(NULL, E_WARNING, "xml parse error: [line %ld, column %ld, message: %s] Unable to create introspection data",
+ php_error_docref(NULL, E_WARNING, "XML parse error: [line %ld, column %ld, message: %s] Unable to create introspection data",
err.xml_elem_error.column, err.xml_elem_error.line, err.xml_elem_error.parser_error);
} else {
php_error_docref(NULL, E_WARNING, "Invalid xml structure. Unable to create introspection data");
}
- php_error_docref(NULL, E_WARNING, "xml parse error. no method description created");
+ php_error_docref(NULL, E_WARNING, "XML parse error. no method description created");
}
}
}
@@ -1395,7 +1328,7 @@ PHP_FUNCTION(xmlrpc_set_type)
XMLRPC_VALUE_TYPE vtype;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zs", &arg, &type, &type_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
vtype = xmlrpc_str_as_type(type);
@@ -1423,7 +1356,7 @@ PHP_FUNCTION(xmlrpc_get_type)
XMLRPC_VECTOR_TYPE vtype = xmlrpc_vector_none;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &arg) == FAILURE) {
- return;
+ RETURN_THROWS();
}
type = get_zval_xmlrpc_type(arg, 0);
@@ -1442,7 +1375,7 @@ PHP_FUNCTION(xmlrpc_is_fault)
zval *arg;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &arg) == FAILURE) {
- return;
+ RETURN_THROWS();
}
/* The "correct" way to do this would be to call the xmlrpc
diff --git a/ext/xmlrpc/xmlrpc.stub.php b/ext/xmlrpc/xmlrpc.stub.php
new file mode 100644
index 0000000000..751aa7c325
--- /dev/null
+++ b/ext/xmlrpc/xmlrpc.stub.php
@@ -0,0 +1,33 @@
+<?php
+
+function xmlrpc_encode($value): ?string {}
+
+function xmlrpc_decode(string $xml, string $encoding = "iso-8859-1") {}
+
+function xmlrpc_decode_request(string $xml, &$method, string $encoding = "iso-8859-1") {}
+
+function xmlrpc_encode_request(?string $method, $params, array $output_options = UNKNOWN): ?string {}
+
+function xmlrpc_set_type(&$value, string $type): bool {}
+
+function xmlrpc_is_fault(array $arg): bool {}
+
+/** @return resource */
+function xmlrpc_server_create() {}
+
+/** @param resource $server */
+function xmlrpc_server_destroy($server): bool {}
+
+/** @param resource $server */
+function xmlrpc_server_register_method($server, string $method_name, $function): bool {}
+
+/** @param resource $server */
+function xmlrpc_server_call_method($server, string $xml, $user_data, array $output_options = UNKNOWN) {}
+
+function xmlrpc_parse_method_descriptions(string $xml) {}
+
+/** @param resource $server */
+function xmlrpc_server_add_introspection_data($server, array $desc): int {}
+
+/** @param resource $server */
+function xmlrpc_server_register_introspection_callback($server, $function): bool {}
diff --git a/ext/xmlrpc/xmlrpc_arginfo.h b/ext/xmlrpc/xmlrpc_arginfo.h
new file mode 100644
index 0000000000..5beecc99e6
--- /dev/null
+++ b/ext/xmlrpc/xmlrpc_arginfo.h
@@ -0,0 +1,65 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlrpc_encode, 0, 1, IS_STRING, 1)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_decode, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, xml, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_decode_request, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, xml, IS_STRING, 0)
+ ZEND_ARG_INFO(1, method)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlrpc_encode_request, 0, 2, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, method, IS_STRING, 1)
+ ZEND_ARG_INFO(0, params)
+ ZEND_ARG_TYPE_INFO(0, output_options, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlrpc_set_type, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(1, value)
+ ZEND_ARG_TYPE_INFO(0, type, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlrpc_is_fault, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, arg, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_server_create, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlrpc_server_destroy, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, server)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlrpc_server_register_method, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, server)
+ ZEND_ARG_TYPE_INFO(0, method_name, IS_STRING, 0)
+ ZEND_ARG_INFO(0, function)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_server_call_method, 0, 0, 3)
+ ZEND_ARG_INFO(0, server)
+ ZEND_ARG_TYPE_INFO(0, xml, IS_STRING, 0)
+ ZEND_ARG_INFO(0, user_data)
+ ZEND_ARG_TYPE_INFO(0, output_options, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlrpc_parse_method_descriptions, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, xml, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlrpc_server_add_introspection_data, 0, 2, IS_LONG, 0)
+ ZEND_ARG_INFO(0, server)
+ ZEND_ARG_TYPE_INFO(0, desc, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlrpc_server_register_introspection_callback, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, server)
+ ZEND_ARG_INFO(0, function)
+ZEND_END_ARG_INFO()
diff --git a/ext/xmlwriter/php_xmlwriter.c b/ext/xmlwriter/php_xmlwriter.c
index 5cb141dad3..a2e3acacaf 100644
--- a/ext/xmlwriter/php_xmlwriter.c
+++ b/ext/xmlwriter/php_xmlwriter.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -27,6 +25,7 @@
#include "ext/standard/info.h"
#include "php_xmlwriter.h"
#include "ext/standard/php_string.h"
+#include "xmlwriter_arginfo.h"
static PHP_FUNCTION(xmlwriter_set_indent);
static PHP_FUNCTION(xmlwriter_set_indent_string);
@@ -73,35 +72,15 @@ static PHP_FUNCTION(xmlwriter_flush);
static zend_class_entry *xmlwriter_class_entry_ce;
-static void xmlwriter_free_resource_ptr(xmlwriter_object *intern);
-static void xmlwriter_dtor(zend_resource *rsrc);
-
typedef int (*xmlwriter_read_one_char_t)(xmlTextWriterPtr writer, const xmlChar *content);
typedef int (*xmlwriter_read_int_t)(xmlTextWriterPtr writer);
-/* {{{ xmlwriter_object_free_storage */
-static void xmlwriter_free_resource_ptr(xmlwriter_object *intern)
-{
- if (intern) {
- if (intern->ptr) {
- xmlFreeTextWriter(intern->ptr);
- intern->ptr = NULL;
- }
- if (intern->output) {
- xmlBufferFree(intern->output);
- intern->output = NULL;
- }
- efree(intern);
- }
-}
-/* }}} */
-
/* {{{ XMLWRITER_FROM_OBJECT */
-#define XMLWRITER_FROM_OBJECT(intern, object) \
+#define XMLWRITER_FROM_OBJECT(ptr, object) \
{ \
ze_xmlwriter_object *obj = Z_XMLWRITER_P(object); \
- intern = obj->xmlwriter_ptr; \
- if (!intern) { \
+ ptr = obj->ptr; \
+ if (!ptr) { \
php_error_docref(NULL, E_WARNING, "Invalid or uninitialized XMLWriter object"); \
RETURN_FALSE; \
} \
@@ -116,10 +95,14 @@ static void xmlwriter_object_dtor(zend_object *object)
ze_xmlwriter_object *intern = php_xmlwriter_fetch_object(object);
/* freeing the resource here may leak, but otherwise we may use it after it has been freed */
- if (intern->xmlwriter_ptr) {
- xmlwriter_free_resource_ptr(intern->xmlwriter_ptr);
+ if (intern->ptr) {
+ xmlFreeTextWriter(intern->ptr);
+ intern->ptr = NULL;
+ }
+ if (intern->output) {
+ xmlBufferFree(intern->output);
+ intern->output = NULL;
}
- intern->xmlwriter_ptr = NULL;
zend_objects_destroy_object(object);
}
/* }}} */
@@ -154,351 +137,47 @@ static zend_object *xmlwriter_object_new(zend_class_entry *class_type)
RETURN_FALSE; \
} \
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO(arginfo_xmlwriter_void, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_resource, 0, 0, 1)
- ZEND_ARG_INFO(0, xmlwriter)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_open_uri, 0, 0, 1)
- ZEND_ARG_INFO(0, uri)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_set_indent, 0, 0, 2)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, indent)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_set_indent, 0, 0, 1)
- ZEND_ARG_INFO(0, indent)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_set_indent_string, 0, 0, 2)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, indentString)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_set_indent_string, 0, 0, 1)
- ZEND_ARG_INFO(0, indentString)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_start_attribute, 0, 0, 2)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_start_attribute, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_start_attribute_ns, 0, 0, 4)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, prefix)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, uri)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_start_attribute_ns, 0, 0, 3)
- ZEND_ARG_INFO(0, prefix)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, uri)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_write_attribute_ns, 0, 0, 5)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, prefix)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, uri)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_write_attribute_ns, 0, 0, 4)
- ZEND_ARG_INFO(0, prefix)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, uri)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_write_attribute, 0, 0, 3)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_write_attribute, 0, 0, 2)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_start_element, 0, 0, 2)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_start_element, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_start_element_ns, 0, 0, 4)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, prefix)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, uri)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_start_element_ns, 0, 0, 3)
- ZEND_ARG_INFO(0, prefix)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, uri)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_write_element, 0, 0, 2)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_write_element, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_write_element_ns, 0, 0, 4)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, prefix)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, uri)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_write_element_ns, 0, 0, 3)
- ZEND_ARG_INFO(0, prefix)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, uri)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_start_pi, 0, 0, 2)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, target)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_start_pi, 0, 0, 1)
- ZEND_ARG_INFO(0, target)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_write_pi, 0, 0, 3)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, target)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_write_pi, 0, 0, 2)
- ZEND_ARG_INFO(0, target)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_write_cdata, 0, 0, 2)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_write_cdata, 0, 0, 1)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_text, 0, 0, 2)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_text, 0, 0, 1)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_write_raw, 0, 0, 2)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_write_raw, 0, 0, 1)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_start_document, 0, 0, 1)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, version)
- ZEND_ARG_INFO(0, encoding)
- ZEND_ARG_INFO(0, standalone)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_start_document, 0, 0, 0)
- ZEND_ARG_INFO(0, version)
- ZEND_ARG_INFO(0, encoding)
- ZEND_ARG_INFO(0, standalone)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_write_comment, 0, 0, 2)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_write_comment, 0, 0, 1)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_start_dtd, 0, 0, 2)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, qualifiedName)
- ZEND_ARG_INFO(0, publicId)
- ZEND_ARG_INFO(0, systemId)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_start_dtd, 0, 0, 1)
- ZEND_ARG_INFO(0, qualifiedName)
- ZEND_ARG_INFO(0, publicId)
- ZEND_ARG_INFO(0, systemId)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_write_dtd, 0, 0, 2)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, publicId)
- ZEND_ARG_INFO(0, systemId)
- ZEND_ARG_INFO(0, subset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_write_dtd, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, publicId)
- ZEND_ARG_INFO(0, systemId)
- ZEND_ARG_INFO(0, subset)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_start_dtd_element, 0, 0, 2)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, qualifiedName)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_start_dtd_element, 0, 0, 1)
- ZEND_ARG_INFO(0, qualifiedName)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_write_dtd_element, 0, 0, 3)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_write_dtd_element, 0, 0, 2)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_start_dtd_attlist, 0, 0, 2)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_start_dtd_attlist, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_write_dtd_attlist, 0, 0, 3)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_write_dtd_attlist, 0, 0, 2)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_start_dtd_entity, 0, 0, 3)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, isparam)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_start_dtd_entity, 0, 0, 2)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, isparam)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_write_dtd_entity, 0, 0, 3)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_write_dtd_entity, 0, 0, 2)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_output_memory, 0, 0, 1)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, flush)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_output_memory, 0, 0, 0)
- ZEND_ARG_INFO(0, flush)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_flush, 0, 0, 1)
- ZEND_ARG_INFO(0, xmlwriter)
- ZEND_ARG_INFO(0, empty)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_method_flush, 0, 0, 0)
- ZEND_ARG_INFO(0, empty)
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ xmlwriter_functions */
static const zend_function_entry xmlwriter_functions[] = {
PHP_FE(xmlwriter_open_uri, arginfo_xmlwriter_open_uri)
- PHP_FE(xmlwriter_open_memory, arginfo_xmlwriter_void)
+ PHP_FE(xmlwriter_open_memory, arginfo_xmlwriter_open_memory)
PHP_FE(xmlwriter_set_indent, arginfo_xmlwriter_set_indent)
PHP_FE(xmlwriter_set_indent_string, arginfo_xmlwriter_set_indent_string)
- PHP_FE(xmlwriter_start_comment, arginfo_xmlwriter_resource)
- PHP_FE(xmlwriter_end_comment, arginfo_xmlwriter_resource)
+ PHP_FE(xmlwriter_start_comment, arginfo_xmlwriter_start_comment)
+ PHP_FE(xmlwriter_end_comment, arginfo_xmlwriter_end_comment)
PHP_FE(xmlwriter_start_attribute, arginfo_xmlwriter_start_attribute)
- PHP_FE(xmlwriter_end_attribute, arginfo_xmlwriter_resource)
+ PHP_FE(xmlwriter_end_attribute, arginfo_xmlwriter_end_attribute)
PHP_FE(xmlwriter_write_attribute, arginfo_xmlwriter_write_attribute)
PHP_FE(xmlwriter_start_attribute_ns,arginfo_xmlwriter_start_attribute_ns)
PHP_FE(xmlwriter_write_attribute_ns,arginfo_xmlwriter_write_attribute_ns)
PHP_FE(xmlwriter_start_element, arginfo_xmlwriter_start_element)
- PHP_FE(xmlwriter_end_element, arginfo_xmlwriter_resource)
- PHP_FE(xmlwriter_full_end_element, arginfo_xmlwriter_resource)
+ PHP_FE(xmlwriter_end_element, arginfo_xmlwriter_end_element)
+ PHP_FE(xmlwriter_full_end_element, arginfo_xmlwriter_full_end_element)
PHP_FE(xmlwriter_start_element_ns, arginfo_xmlwriter_start_element_ns)
PHP_FE(xmlwriter_write_element, arginfo_xmlwriter_write_element)
PHP_FE(xmlwriter_write_element_ns, arginfo_xmlwriter_write_element_ns)
PHP_FE(xmlwriter_start_pi, arginfo_xmlwriter_start_pi)
- PHP_FE(xmlwriter_end_pi, arginfo_xmlwriter_resource)
+ PHP_FE(xmlwriter_end_pi, arginfo_xmlwriter_end_pi)
PHP_FE(xmlwriter_write_pi, arginfo_xmlwriter_write_pi)
- PHP_FE(xmlwriter_start_cdata, arginfo_xmlwriter_resource)
- PHP_FE(xmlwriter_end_cdata, arginfo_xmlwriter_resource)
+ PHP_FE(xmlwriter_start_cdata, arginfo_xmlwriter_start_cdata)
+ PHP_FE(xmlwriter_end_cdata, arginfo_xmlwriter_end_cdata)
PHP_FE(xmlwriter_write_cdata, arginfo_xmlwriter_write_cdata)
PHP_FE(xmlwriter_text, arginfo_xmlwriter_text)
PHP_FE(xmlwriter_write_raw, arginfo_xmlwriter_write_raw)
PHP_FE(xmlwriter_start_document, arginfo_xmlwriter_start_document)
- PHP_FE(xmlwriter_end_document, arginfo_xmlwriter_resource)
+ PHP_FE(xmlwriter_end_document, arginfo_xmlwriter_end_document)
PHP_FE(xmlwriter_write_comment, arginfo_xmlwriter_write_comment)
PHP_FE(xmlwriter_start_dtd, arginfo_xmlwriter_start_dtd)
- PHP_FE(xmlwriter_end_dtd, arginfo_xmlwriter_resource)
+ PHP_FE(xmlwriter_end_dtd, arginfo_xmlwriter_end_dtd)
PHP_FE(xmlwriter_write_dtd, arginfo_xmlwriter_write_dtd)
PHP_FE(xmlwriter_start_dtd_element, arginfo_xmlwriter_start_dtd_element)
- PHP_FE(xmlwriter_end_dtd_element, arginfo_xmlwriter_resource)
+ PHP_FE(xmlwriter_end_dtd_element, arginfo_xmlwriter_end_dtd_element)
PHP_FE(xmlwriter_write_dtd_element, arginfo_xmlwriter_write_dtd_element)
PHP_FE(xmlwriter_start_dtd_attlist, arginfo_xmlwriter_start_dtd_attlist)
- PHP_FE(xmlwriter_end_dtd_attlist, arginfo_xmlwriter_resource)
+ PHP_FE(xmlwriter_end_dtd_attlist, arginfo_xmlwriter_end_dtd_attlist)
PHP_FE(xmlwriter_write_dtd_attlist, arginfo_xmlwriter_write_dtd_attlist)
PHP_FE(xmlwriter_start_dtd_entity, arginfo_xmlwriter_start_dtd_entity)
- PHP_FE(xmlwriter_end_dtd_entity, arginfo_xmlwriter_resource)
+ PHP_FE(xmlwriter_end_dtd_entity, arginfo_xmlwriter_end_dtd_entity)
PHP_FE(xmlwriter_write_dtd_entity, arginfo_xmlwriter_write_dtd_entity)
PHP_FE(xmlwriter_output_memory, arginfo_xmlwriter_output_memory)
PHP_FE(xmlwriter_flush, arginfo_xmlwriter_flush)
@@ -508,48 +187,48 @@ static const zend_function_entry xmlwriter_functions[] = {
/* {{{ xmlwriter_class_functions */
static const zend_function_entry xmlwriter_class_functions[] = {
- PHP_ME_MAPPING(openUri, xmlwriter_open_uri, arginfo_xmlwriter_open_uri, 0)
- PHP_ME_MAPPING(openMemory, xmlwriter_open_memory, arginfo_xmlwriter_void, 0)
- PHP_ME_MAPPING(setIndent, xmlwriter_set_indent, arginfo_xmlwriter_method_set_indent, 0)
- PHP_ME_MAPPING(setIndentString, xmlwriter_set_indent_string, arginfo_xmlwriter_method_set_indent_string, 0)
- PHP_ME_MAPPING(startComment, xmlwriter_start_comment, arginfo_xmlwriter_void, 0)
- PHP_ME_MAPPING(endComment, xmlwriter_end_comment, arginfo_xmlwriter_void, 0)
- PHP_ME_MAPPING(startAttribute, xmlwriter_start_attribute, arginfo_xmlwriter_method_start_attribute, 0)
- PHP_ME_MAPPING(endAttribute, xmlwriter_end_attribute, arginfo_xmlwriter_void, 0)
- PHP_ME_MAPPING(writeAttribute, xmlwriter_write_attribute, arginfo_xmlwriter_method_write_attribute, 0)
- PHP_ME_MAPPING(startAttributeNs, xmlwriter_start_attribute_ns,arginfo_xmlwriter_method_start_attribute_ns, 0)
- PHP_ME_MAPPING(writeAttributeNs, xmlwriter_write_attribute_ns,arginfo_xmlwriter_method_write_attribute_ns, 0)
- PHP_ME_MAPPING(startElement, xmlwriter_start_element, arginfo_xmlwriter_method_start_element, 0)
- PHP_ME_MAPPING(endElement, xmlwriter_end_element, arginfo_xmlwriter_void, 0)
- PHP_ME_MAPPING(fullEndElement, xmlwriter_full_end_element, arginfo_xmlwriter_void, 0)
- PHP_ME_MAPPING(startElementNs, xmlwriter_start_element_ns, arginfo_xmlwriter_method_start_element_ns, 0)
- PHP_ME_MAPPING(writeElement, xmlwriter_write_element, arginfo_xmlwriter_method_write_element, 0)
- PHP_ME_MAPPING(writeElementNs, xmlwriter_write_element_ns, arginfo_xmlwriter_method_write_element_ns, 0)
- PHP_ME_MAPPING(startPi, xmlwriter_start_pi, arginfo_xmlwriter_method_start_pi, 0)
- PHP_ME_MAPPING(endPi, xmlwriter_end_pi, arginfo_xmlwriter_void, 0)
- PHP_ME_MAPPING(writePi, xmlwriter_write_pi, arginfo_xmlwriter_method_write_pi, 0)
- PHP_ME_MAPPING(startCdata, xmlwriter_start_cdata, arginfo_xmlwriter_void, 0)
- PHP_ME_MAPPING(endCdata, xmlwriter_end_cdata, arginfo_xmlwriter_void, 0)
- PHP_ME_MAPPING(writeCdata, xmlwriter_write_cdata, arginfo_xmlwriter_method_write_cdata, 0)
- PHP_ME_MAPPING(text, xmlwriter_text, arginfo_xmlwriter_method_text, 0)
- PHP_ME_MAPPING(writeRaw, xmlwriter_write_raw, arginfo_xmlwriter_method_write_raw, 0)
- PHP_ME_MAPPING(startDocument, xmlwriter_start_document, arginfo_xmlwriter_method_start_document, 0)
- PHP_ME_MAPPING(endDocument, xmlwriter_end_document, arginfo_xmlwriter_void, 0)
- PHP_ME_MAPPING(writeComment, xmlwriter_write_comment, arginfo_xmlwriter_method_write_comment, 0)
- PHP_ME_MAPPING(startDtd, xmlwriter_start_dtd, arginfo_xmlwriter_method_start_dtd, 0)
- PHP_ME_MAPPING(endDtd, xmlwriter_end_dtd, arginfo_xmlwriter_void, 0)
- PHP_ME_MAPPING(writeDtd, xmlwriter_write_dtd, arginfo_xmlwriter_method_write_dtd, 0)
- PHP_ME_MAPPING(startDtdElement, xmlwriter_start_dtd_element,arginfo_xmlwriter_method_start_dtd_element, 0)
- PHP_ME_MAPPING(endDtdElement, xmlwriter_end_dtd_element, arginfo_xmlwriter_void, 0)
- PHP_ME_MAPPING(writeDtdElement, xmlwriter_write_dtd_element, arginfo_xmlwriter_method_write_dtd_element, 0)
- PHP_ME_MAPPING(startDtdAttlist, xmlwriter_start_dtd_attlist, arginfo_xmlwriter_method_start_dtd_attlist, 0)
- PHP_ME_MAPPING(endDtdAttlist, xmlwriter_end_dtd_attlist, arginfo_xmlwriter_void, 0)
- PHP_ME_MAPPING(writeDtdAttlist, xmlwriter_write_dtd_attlist, arginfo_xmlwriter_method_write_dtd_attlist, 0)
- PHP_ME_MAPPING(startDtdEntity, xmlwriter_start_dtd_entity, arginfo_xmlwriter_method_start_dtd_entity, 0)
- PHP_ME_MAPPING(endDtdEntity, xmlwriter_end_dtd_entity, arginfo_xmlwriter_void, 0)
- PHP_ME_MAPPING(writeDtdEntity, xmlwriter_write_dtd_entity, arginfo_xmlwriter_method_write_dtd_entity, 0)
- PHP_ME_MAPPING(outputMemory, xmlwriter_output_memory, arginfo_xmlwriter_method_output_memory, 0)
- PHP_ME_MAPPING(flush, xmlwriter_flush, arginfo_xmlwriter_method_flush, 0)
+ PHP_ME_MAPPING(openUri, xmlwriter_open_uri, arginfo_class_XMLWriter_openUri, 0)
+ PHP_ME_MAPPING(openMemory, xmlwriter_open_memory, arginfo_class_XMLWriter_openMemory, 0)
+ PHP_ME_MAPPING(setIndent, xmlwriter_set_indent, arginfo_class_XMLWriter_setIndent, 0)
+ PHP_ME_MAPPING(setIndentString, xmlwriter_set_indent_string, arginfo_class_XMLWriter_setIdentString, 0)
+ PHP_ME_MAPPING(startComment, xmlwriter_start_comment, arginfo_class_XMLWriter_startComment, 0)
+ PHP_ME_MAPPING(endComment, xmlwriter_end_comment, arginfo_class_XMLWriter_endComment, 0)
+ PHP_ME_MAPPING(startAttribute, xmlwriter_start_attribute, arginfo_class_XMLWriter_startAttribute, 0)
+ PHP_ME_MAPPING(endAttribute, xmlwriter_end_attribute, arginfo_class_XMLWriter_endAttribute, 0)
+ PHP_ME_MAPPING(writeAttribute, xmlwriter_write_attribute, arginfo_class_XMLWriter_writeAttribute, 0)
+ PHP_ME_MAPPING(startAttributeNs, xmlwriter_start_attribute_ns,arginfo_class_XMLWriter_startAttributeNs, 0)
+ PHP_ME_MAPPING(writeAttributeNs, xmlwriter_write_attribute_ns,arginfo_class_XMLWriter_writeAttributeNs, 0)
+ PHP_ME_MAPPING(startElement, xmlwriter_start_element, arginfo_class_XMLWriter_startElement, 0)
+ PHP_ME_MAPPING(endElement, xmlwriter_end_element, arginfo_class_XMLWriter_endElement, 0)
+ PHP_ME_MAPPING(fullEndElement, xmlwriter_full_end_element, arginfo_class_XMLWriter_fullEndElement, 0)
+ PHP_ME_MAPPING(startElementNs, xmlwriter_start_element_ns, arginfo_class_XMLWriter_startElementNs, 0)
+ PHP_ME_MAPPING(writeElement, xmlwriter_write_element, arginfo_class_XMLWriter_writeElement, 0)
+ PHP_ME_MAPPING(writeElementNs, xmlwriter_write_element_ns, arginfo_class_XMLWriter_writeElementNs, 0)
+ PHP_ME_MAPPING(startPi, xmlwriter_start_pi, arginfo_class_XMLWriter_startPi, 0)
+ PHP_ME_MAPPING(endPi, xmlwriter_end_pi, arginfo_class_XMLWriter_endPi, 0)
+ PHP_ME_MAPPING(writePi, xmlwriter_write_pi, arginfo_class_XMLWriter_writePi, 0)
+ PHP_ME_MAPPING(startCdata, xmlwriter_start_cdata, arginfo_class_XMLWriter_startCdata, 0)
+ PHP_ME_MAPPING(endCdata, xmlwriter_end_cdata, arginfo_class_XMLWriter_endCdata, 0)
+ PHP_ME_MAPPING(writeCdata, xmlwriter_write_cdata, arginfo_class_XMLWriter_writeCdata, 0)
+ PHP_ME_MAPPING(text, xmlwriter_text, arginfo_class_XMLWriter_text, 0)
+ PHP_ME_MAPPING(writeRaw, xmlwriter_write_raw, arginfo_class_XMLWriter_writeRaw, 0)
+ PHP_ME_MAPPING(startDocument, xmlwriter_start_document, arginfo_class_XMLWriter_startDocument, 0)
+ PHP_ME_MAPPING(endDocument, xmlwriter_end_document, arginfo_class_XMLWriter_endDocument, 0)
+ PHP_ME_MAPPING(writeComment, xmlwriter_write_comment, arginfo_class_XMLWriter_writeComment, 0)
+ PHP_ME_MAPPING(startDtd, xmlwriter_start_dtd, arginfo_class_XMLWriter_startDtd, 0)
+ PHP_ME_MAPPING(endDtd, xmlwriter_end_dtd, arginfo_class_XMLWriter_endDtd, 0)
+ PHP_ME_MAPPING(writeDtd, xmlwriter_write_dtd, arginfo_class_XMLWriter_writeDtd, 0)
+ PHP_ME_MAPPING(startDtdElement, xmlwriter_start_dtd_element,arginfo_class_XMLWriter_startDtdElement, 0)
+ PHP_ME_MAPPING(endDtdElement, xmlwriter_end_dtd_element, arginfo_class_XMLWriter_endDtdElement, 0)
+ PHP_ME_MAPPING(writeDtdElement, xmlwriter_write_dtd_element, arginfo_class_XMLWriter_writeDtdElement, 0)
+ PHP_ME_MAPPING(startDtdAttlist, xmlwriter_start_dtd_attlist, arginfo_class_XMLWriter_startDtdAttlist, 0)
+ PHP_ME_MAPPING(endDtdAttlist, xmlwriter_end_dtd_attlist, arginfo_class_XMLWriter_endDtdAttlist, 0)
+ PHP_ME_MAPPING(writeDtdAttlist, xmlwriter_write_dtd_attlist, arginfo_class_XMLWriter_writeDtdAttlist, 0)
+ PHP_ME_MAPPING(startDtdEntity, xmlwriter_start_dtd_entity, arginfo_class_XMLWriter_startDtdEntity, 0)
+ PHP_ME_MAPPING(endDtdEntity, xmlwriter_end_dtd_entity, arginfo_class_XMLWriter_endDtdEntity, 0)
+ PHP_ME_MAPPING(writeDtdEntity, xmlwriter_write_dtd_entity, arginfo_class_XMLWriter_writeDtdEntity, 0)
+ PHP_ME_MAPPING(outputMemory, xmlwriter_output_memory, arginfo_class_XMLWriter_outputMemory, 0)
+ PHP_ME_MAPPING(flush, xmlwriter_flush, arginfo_class_XMLWriter_flush, 0)
PHP_FE_END
};
/* }}} */
@@ -558,8 +237,6 @@ static const zend_function_entry xmlwriter_class_functions[] = {
static PHP_MINIT_FUNCTION(xmlwriter);
static PHP_MSHUTDOWN_FUNCTION(xmlwriter);
static PHP_MINFO_FUNCTION(xmlwriter);
-
-static int le_xmlwriter;
/* }}} */
/* _xmlwriter_get_valid_file_path should be made a
@@ -662,47 +339,23 @@ static void xmlwriter_objects_clone(void *object, void **object_clone)
}
}}} */
-/* {{{ xmlwriter_dtor */
-static void xmlwriter_dtor(zend_resource *rsrc) {
- xmlwriter_object *intern;
-
- intern = (xmlwriter_object *) rsrc->ptr;
- xmlwriter_free_resource_ptr(intern);
-}
-/* }}} */
-
static void php_xmlwriter_string_arg(INTERNAL_FUNCTION_PARAMETERS, xmlwriter_read_one_char_t internal_function, char *err_string)
{
- zval *pind;
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *name;
size_t name_len;
int retval;
+ zval *self;
- zval *self = getThis();
-
- if (self) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) {
- return;
- }
- XMLWRITER_FROM_OBJECT(intern, self);
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &pind, &name, &name_len) == FAILURE) {
- return;
- }
-
- if ((intern = (xmlwriter_object *)zend_fetch_resource(Z_RES_P(pind), "XMLWriter", le_xmlwriter)) == NULL) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os", &self, xmlwriter_class_entry_ce, &name, &name_len) == FAILURE) {
+ RETURN_THROWS();
}
+ XMLWRITER_FROM_OBJECT(ptr, self);
if (err_string != NULL) {
XMLW_NAME_CHK(err_string);
}
- ptr = intern->ptr;
-
if (ptr) {
retval = internal_function(ptr, (xmlChar *) name);
if (retval != -1) {
@@ -715,27 +368,14 @@ static void php_xmlwriter_string_arg(INTERNAL_FUNCTION_PARAMETERS, xmlwriter_rea
static void php_xmlwriter_end(INTERNAL_FUNCTION_PARAMETERS, xmlwriter_read_int_t internal_function)
{
- zval *pind;
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
int retval;
- zval *self = getThis();
+ zval *self;
- if (self) {
- XMLWRITER_FROM_OBJECT(intern, self);
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pind) == FAILURE) {
- return;
- }
- if ((intern = (xmlwriter_object *)zend_fetch_resource(Z_RES_P(pind), "XMLWriter", le_xmlwriter)) == NULL) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &self, xmlwriter_class_entry_ce) == FAILURE) {
+ RETURN_THROWS();
}
-
- ptr = intern->ptr;
+ XMLWRITER_FROM_OBJECT(ptr, self);
if (ptr) {
retval = internal_function(ptr);
@@ -747,34 +387,20 @@ static void php_xmlwriter_end(INTERNAL_FUNCTION_PARAMETERS, xmlwriter_read_int_t
RETURN_FALSE;
}
-/* {{{ proto bool xmlwriter_set_indent(resource xmlwriter, bool indent)
+/* {{{ proto bool xmlwriter_set_indent(XMLWriter xmlwriter, bool indent)
Toggle indentation on/off - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_set_indent)
{
- zval *pind;
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
int retval;
zend_bool indent;
+ zval *self;
- zval *self = getThis();
-
- if (self) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "b", &indent) == FAILURE) {
- return;
- }
- XMLWRITER_FROM_OBJECT(intern, self);
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rb", &pind, &indent) == FAILURE) {
- return;
- }
- if ((intern = (xmlwriter_object *)zend_fetch_resource(Z_RES_P(pind), "XMLWriter", le_xmlwriter)) == NULL) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Ob", &self, xmlwriter_class_entry_ce, &indent) == FAILURE) {
+ RETURN_THROWS();
}
+ XMLWRITER_FROM_OBJECT(ptr, self);
-
- ptr = intern->ptr;
if (ptr) {
retval = xmlTextWriterSetIndent(ptr, indent);
if (retval == 0) {
@@ -786,7 +412,7 @@ static PHP_FUNCTION(xmlwriter_set_indent)
}
/* }}} */
-/* {{{ proto bool xmlwriter_set_indent_string(resource xmlwriter, string indentString)
+/* {{{ proto bool xmlwriter_set_indent_string(XMLWriter xmlwriter, string indentString)
Set string used for indenting - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_set_indent_string)
{
@@ -794,7 +420,7 @@ static PHP_FUNCTION(xmlwriter_set_indent_string)
}
/* }}} */
-/* {{{ proto bool xmlwriter_start_attribute(resource xmlwriter, string name)
+/* {{{ proto bool xmlwriter_start_attribute(XMLWriter xmlwriter, string name)
Create start attribute - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_start_attribute)
{
@@ -802,7 +428,7 @@ static PHP_FUNCTION(xmlwriter_start_attribute)
}
/* }}} */
-/* {{{ proto bool xmlwriter_end_attribute(resource xmlwriter)
+/* {{{ proto bool xmlwriter_end_attribute(XMLWriter xmlwriter)
End attribute - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_end_attribute)
{
@@ -810,38 +436,24 @@ static PHP_FUNCTION(xmlwriter_end_attribute)
}
/* }}} */
-/* {{{ proto bool xmlwriter_start_attribute_ns(resource xmlwriter, string prefix, string name, string uri)
+/* {{{ proto bool xmlwriter_start_attribute_ns(XMLWriter xmlwriter, string prefix, string name, string uri)
Create start namespaced attribute - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_start_attribute_ns)
{
- zval *pind;
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *name, *prefix, *uri;
size_t name_len, prefix_len, uri_len;
int retval;
- zval *self = getThis();
+ zval *self;
- if (self) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "sss!",
- &prefix, &prefix_len, &name, &name_len, &uri, &uri_len) == FAILURE) {
- return;
- }
- XMLWRITER_FROM_OBJECT(intern, self);
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsss!", &pind,
- &prefix, &prefix_len, &name, &name_len, &uri, &uri_len) == FAILURE) {
- return;
- }
- if ((intern = (xmlwriter_object *)zend_fetch_resource(Z_RES_P(pind), "XMLWriter", le_xmlwriter)) == NULL) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Osss!", &self, xmlwriter_class_entry_ce,
+ &prefix, &prefix_len, &name, &name_len, &uri, &uri_len) == FAILURE) {
+ RETURN_THROWS();
}
+ XMLWRITER_FROM_OBJECT(ptr, self);
XMLW_NAME_CHK("Invalid Attribute Name");
- ptr = intern->ptr;
-
if (ptr) {
retval = xmlTextWriterStartAttributeNS(ptr, (xmlChar *)prefix, (xmlChar *)name, (xmlChar *)uri);
if (retval != -1) {
@@ -853,38 +465,24 @@ static PHP_FUNCTION(xmlwriter_start_attribute_ns)
}
/* }}} */
-/* {{{ proto bool xmlwriter_write_attribute(resource xmlwriter, string name, string content)
+/* {{{ proto bool xmlwriter_write_attribute(XMLWriter xmlwriter, string name, string content)
Write full attribute - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_write_attribute)
{
- zval *pind;
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *name, *content;
size_t name_len, content_len;
int retval;
- zval *self = getThis();
+ zval *self;
- if (self) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss",
- &name, &name_len, &content, &content_len) == FAILURE) {
- return;
- }
- XMLWRITER_FROM_OBJECT(intern, self);
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rss", &pind,
- &name, &name_len, &content, &content_len) == FAILURE) {
- return;
- }
- if ((intern = (xmlwriter_object *)zend_fetch_resource(Z_RES_P(pind), "XMLWriter", le_xmlwriter)) == NULL) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oss", &self, xmlwriter_class_entry_ce,
+ &name, &name_len, &content, &content_len) == FAILURE) {
+ RETURN_THROWS();
}
+ XMLWRITER_FROM_OBJECT(ptr, self);
XMLW_NAME_CHK("Invalid Attribute Name");
- ptr = intern->ptr;
-
if (ptr) {
retval = xmlTextWriterWriteAttribute(ptr, (xmlChar *)name, (xmlChar *)content);
if (retval != -1) {
@@ -896,39 +494,24 @@ static PHP_FUNCTION(xmlwriter_write_attribute)
}
/* }}} */
-/* {{{ proto bool xmlwriter_write_attribute_ns(resource xmlwriter, string prefix, string name, string uri, string content)
+/* {{{ proto bool xmlwriter_write_attribute_ns(XMLWriter xmlwriter, string prefix, string name, string uri, string content)
Write full namespaced attribute - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_write_attribute_ns)
{
- zval *pind;
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *name, *prefix, *uri, *content;
size_t name_len, prefix_len, uri_len, content_len;
int retval;
+ zval *self;
- zval *self = getThis();
-
- if (self) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "sss!s",
- &prefix, &prefix_len, &name, &name_len, &uri, &uri_len, &content, &content_len) == FAILURE) {
- return;
- }
- XMLWRITER_FROM_OBJECT(intern, self);
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsss!s", &pind,
- &prefix, &prefix_len, &name, &name_len, &uri, &uri_len, &content, &content_len) == FAILURE) {
- return;
- }
- if ((intern = (xmlwriter_object *)zend_fetch_resource(Z_RES_P(pind), "XMLWriter", le_xmlwriter)) == NULL) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Osss!s", &self, xmlwriter_class_entry_ce,
+ &prefix, &prefix_len, &name, &name_len, &uri, &uri_len, &content, &content_len) == FAILURE) {
+ RETURN_THROWS();
}
+ XMLWRITER_FROM_OBJECT(ptr, self);
XMLW_NAME_CHK("Invalid Attribute Name");
- ptr = intern->ptr;
-
if (ptr) {
retval = xmlTextWriterWriteAttributeNS(ptr, (xmlChar *)prefix, (xmlChar *)name, (xmlChar *)uri, (xmlChar *)content);
if (retval != -1) {
@@ -940,7 +523,7 @@ static PHP_FUNCTION(xmlwriter_write_attribute_ns)
}
/* }}} */
-/* {{{ proto bool xmlwriter_start_element(resource xmlwriter, string name)
+/* {{{ proto bool xmlwriter_start_element(XMLWriter xmlwriter, string name)
Create start element tag - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_start_element)
{
@@ -948,38 +531,24 @@ static PHP_FUNCTION(xmlwriter_start_element)
}
/* }}} */
-/* {{{ proto bool xmlwriter_start_element_ns(resource xmlwriter, string prefix, string name, string uri)
+/* {{{ proto bool xmlwriter_start_element_ns(XMLWriter xmlwriter, string prefix, string name, string uri)
Create start namespaced element tag - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_start_element_ns)
{
- zval *pind;
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *name, *prefix, *uri;
size_t name_len, prefix_len, uri_len;
int retval;
- zval *self = getThis();
+ zval *self;
- if (self) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s!ss!",
- &prefix, &prefix_len, &name, &name_len, &uri, &uri_len) == FAILURE) {
- return;
- }
- XMLWRITER_FROM_OBJECT(intern, self);
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs!ss!", &pind,
- &prefix, &prefix_len, &name, &name_len, &uri, &uri_len) == FAILURE) {
- return;
- }
- if ((intern = (xmlwriter_object *)zend_fetch_resource(Z_RES_P(pind), "XMLWriter", le_xmlwriter)) == NULL) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os!ss!", &self, xmlwriter_class_entry_ce,
+ &prefix, &prefix_len, &name, &name_len, &uri, &uri_len) == FAILURE) {
+ RETURN_THROWS();
}
+ XMLWRITER_FROM_OBJECT(ptr, self);
XMLW_NAME_CHK("Invalid Element Name");
- ptr = intern->ptr;
-
if (ptr) {
retval = xmlTextWriterStartElementNS(ptr, (xmlChar *)prefix, (xmlChar *)name, (xmlChar *)uri);
if (retval != -1) {
@@ -992,7 +561,7 @@ static PHP_FUNCTION(xmlwriter_start_element_ns)
}
/* }}} */
-/* {{{ proto bool xmlwriter_end_element(resource xmlwriter)
+/* {{{ proto bool xmlwriter_end_element(XMLWriter xmlwriter)
End current element - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_end_element)
{
@@ -1000,7 +569,7 @@ static PHP_FUNCTION(xmlwriter_end_element)
}
/* }}} */
-/* {{{ proto bool xmlwriter_full_end_element(resource xmlwriter)
+/* {{{ proto bool xmlwriter_full_end_element(XMLWriter xmlwriter)
End current element - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_full_end_element)
{
@@ -1008,38 +577,24 @@ static PHP_FUNCTION(xmlwriter_full_end_element)
}
/* }}} */
-/* {{{ proto bool xmlwriter_write_element(resource xmlwriter, string name[, string content])
+/* {{{ proto bool xmlwriter_write_element(XMLWriter xmlwriter, string name[, string content])
Write full element tag - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_write_element)
{
- zval *pind;
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *name, *content = NULL;
size_t name_len, content_len;
int retval;
- zval *self = getThis();
+ zval *self;
- if (self) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s!",
- &name, &name_len, &content, &content_len) == FAILURE) {
- return;
- }
- XMLWRITER_FROM_OBJECT(intern, self);
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|s!", &pind,
- &name, &name_len, &content, &content_len) == FAILURE) {
- return;
- }
- if ((intern = (xmlwriter_object *)zend_fetch_resource(Z_RES_P(pind), "XMLWriter", le_xmlwriter)) == NULL) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os|s!", &self, xmlwriter_class_entry_ce,
+ &name, &name_len, &content, &content_len) == FAILURE) {
+ RETURN_THROWS();
}
+ XMLWRITER_FROM_OBJECT(ptr, self);
XMLW_NAME_CHK("Invalid Element Name");
- ptr = intern->ptr;
-
if (ptr) {
if (!content) {
retval = xmlTextWriterStartElement(ptr, (xmlChar *)name);
@@ -1062,38 +617,24 @@ static PHP_FUNCTION(xmlwriter_write_element)
}
/* }}} */
-/* {{{ proto bool xmlwriter_write_element_ns(resource xmlwriter, string prefix, string name, string uri[, string content])
+/* {{{ proto bool xmlwriter_write_element_ns(XMLWriter xmlwriter, string prefix, string name, string uri[, string content])
Write full namesapced element tag - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_write_element_ns)
{
- zval *pind;
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *name, *prefix, *uri, *content = NULL;
size_t name_len, prefix_len, uri_len, content_len;
int retval;
- zval *self = getThis();
+ zval *self;
- if (self) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s!ss!|s!",
- &prefix, &prefix_len, &name, &name_len, &uri, &uri_len, &content, &content_len) == FAILURE) {
- return;
- }
- XMLWRITER_FROM_OBJECT(intern, self);
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs!ss!|s!", &pind,
- &prefix, &prefix_len, &name, &name_len, &uri, &uri_len, &content, &content_len) == FAILURE) {
- return;
- }
- if ((intern = (xmlwriter_object *)zend_fetch_resource(Z_RES_P(pind), "XMLWriter", le_xmlwriter)) == NULL) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os!ss!|s!", &self, xmlwriter_class_entry_ce,
+ &prefix, &prefix_len, &name, &name_len, &uri, &uri_len, &content, &content_len) == FAILURE) {
+ RETURN_THROWS();
}
+ XMLWRITER_FROM_OBJECT(ptr, self);
XMLW_NAME_CHK("Invalid Element Name");
- ptr = intern->ptr;
-
if (ptr) {
if (!content) {
retval = xmlTextWriterStartElementNS(ptr,(xmlChar *)prefix, (xmlChar *)name, (xmlChar *)uri);
@@ -1116,7 +657,7 @@ static PHP_FUNCTION(xmlwriter_write_element_ns)
}
/* }}} */
-/* {{{ proto bool xmlwriter_start_pi(resource xmlwriter, string target)
+/* {{{ proto bool xmlwriter_start_pi(XMLWriter xmlwriter, string target)
Create start PI tag - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_start_pi)
{
@@ -1124,7 +665,7 @@ static PHP_FUNCTION(xmlwriter_start_pi)
}
/* }}} */
-/* {{{ proto bool xmlwriter_end_pi(resource xmlwriter)
+/* {{{ proto bool xmlwriter_end_pi(XMLWriter xmlwriter)
End current PI - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_end_pi)
{
@@ -1132,39 +673,24 @@ static PHP_FUNCTION(xmlwriter_end_pi)
}
/* }}} */
-/* {{{ proto bool xmlwriter_write_pi(resource xmlwriter, string target, string content)
+/* {{{ proto bool xmlwriter_write_pi(XMLWriter xmlwriter, string target, string content)
Write full PI tag - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_write_pi)
{
- zval *pind;
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *name, *content;
size_t name_len, content_len;
int retval;
+ zval *self;
- zval *self = getThis();
-
- if (self) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss",
- &name, &name_len, &content, &content_len) == FAILURE) {
- return;
- }
- XMLWRITER_FROM_OBJECT(intern, self);
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rss", &pind,
- &name, &name_len, &content, &content_len) == FAILURE) {
- return;
- }
- if ((intern = (xmlwriter_object *)zend_fetch_resource(Z_RES_P(pind), "XMLWriter", le_xmlwriter)) == NULL) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oss", &self, xmlwriter_class_entry_ce,
+ &name, &name_len, &content, &content_len) == FAILURE) {
+ RETURN_THROWS();
}
+ XMLWRITER_FROM_OBJECT(ptr, self);
XMLW_NAME_CHK("Invalid PI Target");
- ptr = intern->ptr;
-
if (ptr) {
retval = xmlTextWriterWritePI(ptr, (xmlChar *)name, (xmlChar *)content);
if (retval != -1) {
@@ -1176,31 +702,18 @@ static PHP_FUNCTION(xmlwriter_write_pi)
}
/* }}} */
-/* {{{ proto bool xmlwriter_start_cdata(resource xmlwriter)
+/* {{{ proto bool xmlwriter_start_cdata(XMLWriter xmlwriter)
Create start CDATA tag - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_start_cdata)
{
- zval *pind;
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
int retval;
- zval *self = getThis();
+ zval *self;
- if (self) {
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
- XMLWRITER_FROM_OBJECT(intern, self);
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pind) == FAILURE) {
- return;
- }
- if ((intern = (xmlwriter_object *)zend_fetch_resource(Z_RES_P(pind), "XMLWriter", le_xmlwriter)) == NULL) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &self, xmlwriter_class_entry_ce) == FAILURE) {
+ RETURN_THROWS();
}
-
- ptr = intern->ptr;
+ XMLWRITER_FROM_OBJECT(ptr, self);
if (ptr) {
retval = xmlTextWriterStartCDATA(ptr);
@@ -1213,7 +726,7 @@ static PHP_FUNCTION(xmlwriter_start_cdata)
}
/* }}} */
-/* {{{ proto bool xmlwriter_end_cdata(resource xmlwriter)
+/* {{{ proto bool xmlwriter_end_cdata(XMLWriter xmlwriter)
End current CDATA - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_end_cdata)
{
@@ -1221,7 +734,7 @@ static PHP_FUNCTION(xmlwriter_end_cdata)
}
/* }}} */
-/* {{{ proto bool xmlwriter_write_cdata(resource xmlwriter, string content)
+/* {{{ proto bool xmlwriter_write_cdata(XMLWriter xmlwriter, string content)
Write full CDATA tag - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_write_cdata)
{
@@ -1229,7 +742,7 @@ static PHP_FUNCTION(xmlwriter_write_cdata)
}
/* }}} */
-/* {{{ proto bool xmlwriter_write_raw(resource xmlwriter, string content)
+/* {{{ proto bool xmlwriter_write_raw(XMLWriter xmlwriter, string content)
Write text - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_write_raw)
{
@@ -1237,7 +750,7 @@ static PHP_FUNCTION(xmlwriter_write_raw)
}
/* }}} */
-/* {{{ proto bool xmlwriter_text(resource xmlwriter, string content)
+/* {{{ proto bool xmlwriter_text(XMLWriter xmlwriter, string content)
Write text - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_text)
{
@@ -1245,31 +758,18 @@ static PHP_FUNCTION(xmlwriter_text)
}
/* }}} */
-/* {{{ proto bool xmlwriter_start_comment(resource xmlwriter)
+/* {{{ proto bool xmlwriter_start_comment(XMLWriter xmlwriter)
Create start comment - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_start_comment)
{
- zval *pind;
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
int retval;
- zval *self = getThis();
+ zval *self;
- if (self) {
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
- XMLWRITER_FROM_OBJECT(intern, self);
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pind) == FAILURE) {
- return;
- }
- if ((intern = (xmlwriter_object *)zend_fetch_resource(Z_RES_P(pind), "XMLWriter", le_xmlwriter)) == NULL) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &self, xmlwriter_class_entry_ce) == FAILURE) {
+ RETURN_THROWS();
}
-
- ptr = intern->ptr;
+ XMLWRITER_FROM_OBJECT(ptr, self);
if (ptr) {
retval = xmlTextWriterStartComment(ptr);
@@ -1282,7 +782,7 @@ static PHP_FUNCTION(xmlwriter_start_comment)
}
/* }}} */
-/* {{{ proto bool xmlwriter_end_comment(resource xmlwriter)
+/* {{{ proto bool xmlwriter_end_comment(XMLWriter xmlwriter)
Create end comment - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_end_comment)
{
@@ -1290,7 +790,7 @@ static PHP_FUNCTION(xmlwriter_end_comment)
}
/* }}} */
-/* {{{ proto bool xmlwriter_write_comment(resource xmlwriter, string content)
+/* {{{ proto bool xmlwriter_write_comment(XMLWriter xmlwriter, string content)
Write full comment tag - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_write_comment)
{
@@ -1298,34 +798,20 @@ static PHP_FUNCTION(xmlwriter_write_comment)
}
/* }}} */
-/* {{{ proto bool xmlwriter_start_document(resource xmlwriter, string version, string encoding, string standalone)
+/* {{{ proto bool xmlwriter_start_document(XMLWriter xmlwriter, string version, string encoding, string standalone)
Create document tag - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_start_document)
{
- zval *pind;
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *version = NULL, *enc = NULL, *alone = NULL;
size_t version_len, enc_len, alone_len;
int retval;
+ zval *self;
- zval *self = getThis();
-
- if (self) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!s!s!", &version, &version_len, &enc, &enc_len, &alone, &alone_len) == FAILURE) {
- return;
- }
- XMLWRITER_FROM_OBJECT(intern, self);
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|s!s!s!", &pind, &version, &version_len, &enc, &enc_len, &alone, &alone_len) == FAILURE) {
- return;
- }
- if ((intern = (xmlwriter_object *)zend_fetch_resource(Z_RES_P(pind), "XMLWriter", le_xmlwriter)) == NULL) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O|s!s!s!", &self, xmlwriter_class_entry_ce, &version, &version_len, &enc, &enc_len, &alone, &alone_len) == FAILURE) {
+ RETURN_THROWS();
}
-
- ptr = intern->ptr;
+ XMLWRITER_FROM_OBJECT(ptr, self);
if (ptr) {
retval = xmlTextWriterStartDocument(ptr, version, enc, alone);
@@ -1338,7 +824,7 @@ static PHP_FUNCTION(xmlwriter_start_document)
}
/* }}} */
-/* {{{ proto bool xmlwriter_end_document(resource xmlwriter)
+/* {{{ proto bool xmlwriter_end_document(XMLWriter xmlwriter)
End current document - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_end_document)
{
@@ -1346,33 +832,20 @@ static PHP_FUNCTION(xmlwriter_end_document)
}
/* }}} */
-/* {{{ proto bool xmlwriter_start_dtd(resource xmlwriter, string name, string pubid, string sysid)
+/* {{{ proto bool xmlwriter_start_dtd(XMLWriter xmlwriter, string name, string pubid, string sysid)
Create start DTD tag - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_start_dtd)
{
- zval *pind;
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *name, *pubid = NULL, *sysid = NULL;
size_t name_len, pubid_len, sysid_len;
int retval;
- zval *self = getThis();
+ zval *self;
- if (self) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s!s!", &name, &name_len, &pubid, &pubid_len, &sysid, &sysid_len) == FAILURE) {
- return;
- }
-
- XMLWRITER_FROM_OBJECT(intern, self);
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|s!s!", &pind, &name, &name_len, &pubid, &pubid_len, &sysid, &sysid_len) == FAILURE) {
- return;
- }
- if ((intern = (xmlwriter_object *)zend_fetch_resource(Z_RES_P(pind), "XMLWriter", le_xmlwriter)) == NULL) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os|s!s!", &self, xmlwriter_class_entry_ce, &name, &name_len, &pubid, &pubid_len, &sysid, &sysid_len) == FAILURE) {
+ RETURN_THROWS();
}
- ptr = intern->ptr;
+ XMLWRITER_FROM_OBJECT(ptr, self);
if (ptr) {
retval = xmlTextWriterStartDTD(ptr, (xmlChar *)name, (xmlChar *)pubid, (xmlChar *)sysid);
@@ -1385,7 +858,7 @@ static PHP_FUNCTION(xmlwriter_start_dtd)
}
/* }}} */
-/* {{{ proto bool xmlwriter_end_dtd(resource xmlwriter)
+/* {{{ proto bool xmlwriter_end_dtd(XMLWriter xmlwriter)
End current DTD - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_end_dtd)
{
@@ -1393,35 +866,20 @@ static PHP_FUNCTION(xmlwriter_end_dtd)
}
/* }}} */
-/* {{{ proto bool xmlwriter_write_dtd(resource xmlwriter, string name, string pubid, string sysid, string subset)
+/* {{{ proto bool xmlwriter_write_dtd(XMLWriter xmlwriter, string name, string pubid, string sysid, string subset)
Write full DTD tag - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_write_dtd)
{
- zval *pind;
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *name, *pubid = NULL, *sysid = NULL, *subset = NULL;
size_t name_len, pubid_len, sysid_len, subset_len;
int retval;
- zval *self = getThis();
+ zval *self;
- if (self) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s!s!s!", &name, &name_len, &pubid, &pubid_len, &sysid, &sysid_len, &subset, &subset_len) == FAILURE) {
- return;
- }
-
- XMLWRITER_FROM_OBJECT(intern, self);
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|s!s!s!", &pind, &name, &name_len, &pubid, &pubid_len, &sysid, &sysid_len, &subset, &subset_len) == FAILURE) {
- return;
- }
-
- if ((intern = (xmlwriter_object *)zend_fetch_resource(Z_RES_P(pind), "XMLWriter", le_xmlwriter)) == NULL) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os|s!s!s!", &self, xmlwriter_class_entry_ce, &name, &name_len, &pubid, &pubid_len, &sysid, &sysid_len, &subset, &subset_len) == FAILURE) {
+ RETURN_THROWS();
}
-
- ptr = intern->ptr;
+ XMLWRITER_FROM_OBJECT(ptr, self);
if (ptr) {
retval = xmlTextWriterWriteDTD(ptr, (xmlChar *)name, (xmlChar *)pubid, (xmlChar *)sysid, (xmlChar *)subset);
@@ -1434,7 +892,7 @@ static PHP_FUNCTION(xmlwriter_write_dtd)
}
/* }}} */
-/* {{{ proto bool xmlwriter_start_dtd_element(resource xmlwriter, string name)
+/* {{{ proto bool xmlwriter_start_dtd_element(XMLWriter xmlwriter, string name)
Create start DTD element - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_start_dtd_element)
{
@@ -1442,7 +900,7 @@ static PHP_FUNCTION(xmlwriter_start_dtd_element)
}
/* }}} */
-/* {{{ proto bool xmlwriter_end_dtd_element(resource xmlwriter)
+/* {{{ proto bool xmlwriter_end_dtd_element(XMLWriter xmlwriter)
End current DTD element - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_end_dtd_element)
{
@@ -1450,37 +908,24 @@ static PHP_FUNCTION(xmlwriter_end_dtd_element)
}
/* }}} */
-/* {{{ proto bool xmlwriter_write_dtd_element(resource xmlwriter, string name, string content)
+/* {{{ proto bool xmlwriter_write_dtd_element(XMLWriter xmlwriter, string name, string content)
Write full DTD element tag - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_write_dtd_element)
{
- zval *pind;
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *name, *content;
size_t name_len, content_len;
int retval;
- zval *self = getThis();
+ zval *self;
- if (self) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &name, &name_len, &content, &content_len) == FAILURE) {
- return;
- }
- XMLWRITER_FROM_OBJECT(intern, self);
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rss", &pind,
- &name, &name_len, &content, &content_len) == FAILURE) {
- return;
- }
- if ((intern = (xmlwriter_object *)zend_fetch_resource(Z_RES_P(pind), "XMLWriter", le_xmlwriter)) == NULL) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oss", &self, xmlwriter_class_entry_ce,
+ &name, &name_len, &content, &content_len) == FAILURE) {
+ RETURN_THROWS();
}
+ XMLWRITER_FROM_OBJECT(ptr, self);
XMLW_NAME_CHK("Invalid Element Name");
- ptr = intern->ptr;
-
if (ptr) {
retval = xmlTextWriterWriteDTDElement(ptr, (xmlChar *)name, (xmlChar *)content);
if (retval != -1) {
@@ -1492,7 +937,7 @@ static PHP_FUNCTION(xmlwriter_write_dtd_element)
}
/* }}} */
-/* {{{ proto bool xmlwriter_start_dtd_attlist(resource xmlwriter, string name)
+/* {{{ proto bool xmlwriter_start_dtd_attlist(XMLWriter xmlwriter, string name)
Create start DTD AttList - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_start_dtd_attlist)
{
@@ -1500,7 +945,7 @@ static PHP_FUNCTION(xmlwriter_start_dtd_attlist)
}
/* }}} */
-/* {{{ proto bool xmlwriter_end_dtd_attlist(resource xmlwriter)
+/* {{{ proto bool xmlwriter_end_dtd_attlist(XMLWriter xmlwriter)
End current DTD AttList - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_end_dtd_attlist)
{
@@ -1508,38 +953,24 @@ static PHP_FUNCTION(xmlwriter_end_dtd_attlist)
}
/* }}} */
-/* {{{ proto bool xmlwriter_write_dtd_attlist(resource xmlwriter, string name, string content)
+/* {{{ proto bool xmlwriter_write_dtd_attlist(XMLWriter xmlwriter, string name, string content)
Write full DTD AttList tag - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_write_dtd_attlist)
{
- zval *pind;
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *name, *content;
size_t name_len, content_len;
int retval;
- zval *self = getThis();
+ zval *self;
- if (self) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss",
- &name, &name_len, &content, &content_len) == FAILURE) {
- return;
- }
- XMLWRITER_FROM_OBJECT(intern, self);
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rss", &pind,
- &name, &name_len, &content, &content_len) == FAILURE) {
- return;
- }
- if ((intern = (xmlwriter_object *)zend_fetch_resource(Z_RES_P(pind), "XMLWriter", le_xmlwriter)) == NULL) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oss", &self, xmlwriter_class_entry_ce,
+ &name, &name_len, &content, &content_len) == FAILURE) {
+ RETURN_THROWS();
}
+ XMLWRITER_FROM_OBJECT(ptr, self);
XMLW_NAME_CHK("Invalid Element Name");
- ptr = intern->ptr;
-
if (ptr) {
retval = xmlTextWriterWriteDTDAttlist(ptr, (xmlChar *)name, (xmlChar *)content);
if (retval != -1) {
@@ -1551,37 +982,24 @@ static PHP_FUNCTION(xmlwriter_write_dtd_attlist)
}
/* }}} */
-/* {{{ proto bool xmlwriter_start_dtd_entity(resource xmlwriter, string name, bool isparam)
+/* {{{ proto bool xmlwriter_start_dtd_entity(XMLWriter xmlwriter, string name, bool isparam)
Create start DTD Entity - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_start_dtd_entity)
{
- zval *pind;
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *name;
size_t name_len;
int retval;
zend_bool isparm;
- zval *self = getThis();
+ zval *self;
- if (self) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "sb", &name, &name_len, &isparm) == FAILURE) {
- return;
- }
- XMLWRITER_FROM_OBJECT(intern, self);
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsb", &pind, &name, &name_len, &isparm) == FAILURE) {
- return;
- }
- if ((intern = (xmlwriter_object *)zend_fetch_resource(Z_RES_P(pind), "XMLWriter", le_xmlwriter)) == NULL) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Osb", &self, xmlwriter_class_entry_ce, &name, &name_len, &isparm) == FAILURE) {
+ RETURN_THROWS();
}
+ XMLWRITER_FROM_OBJECT(ptr, self);
XMLW_NAME_CHK("Invalid Attribute Name");
- ptr = intern->ptr;
-
if (ptr) {
retval = xmlTextWriterStartDTDEntity(ptr, isparm, (xmlChar *)name);
if (retval != -1) {
@@ -1593,7 +1011,7 @@ static PHP_FUNCTION(xmlwriter_start_dtd_entity)
}
/* }}} */
-/* {{{ proto bool xmlwriter_end_dtd_entity(resource xmlwriter)
+/* {{{ proto bool xmlwriter_end_dtd_entity(XMLWriter xmlwriter)
End current DTD Entity - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_end_dtd_entity)
{
@@ -1601,12 +1019,10 @@ static PHP_FUNCTION(xmlwriter_end_dtd_entity)
}
/* }}} */
-/* {{{ proto bool xmlwriter_write_dtd_entity(resource xmlwriter, string name, string content [, bool pe [, string pubid [, string sysid [, string ndataid]]]])
+/* {{{ proto bool xmlwriter_write_dtd_entity(XMLWriter xmlwriter, string name, string content [, bool pe [, string pubid [, string sysid [, string ndataid]]]])
Write full DTD Entity tag - returns FALSE on error */
static PHP_FUNCTION(xmlwriter_write_dtd_entity)
{
- zval *pind;
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *name, *content;
size_t name_len, content_len;
@@ -1615,30 +1031,17 @@ static PHP_FUNCTION(xmlwriter_write_dtd_entity)
char *pubid = NULL, *sysid = NULL, *ndataid = NULL;
zend_bool pe = 0;
size_t pubid_len, sysid_len, ndataid_len;
- zval *self = getThis();
+ zval *self;
- if (self) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|bsss",
- &name, &name_len, &content, &content_len, &pe, &pubid, &pubid_len,
- &sysid, &sysid_len, &ndataid, &ndataid_len) == FAILURE) {
- return;
- }
- XMLWRITER_FROM_OBJECT(intern, self);
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rss|bsss", &pind,
- &name, &name_len, &content, &content_len, &pe, &pubid, &pubid_len,
- &sysid, &sysid_len, &ndataid, &ndataid_len) == FAILURE) {
- return;
- }
- if ((intern = (xmlwriter_object *)zend_fetch_resource(Z_RES_P(pind), "XMLWriter", le_xmlwriter)) == NULL) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oss|bsss", &self, xmlwriter_class_entry_ce,
+ &name, &name_len, &content, &content_len, &pe, &pubid, &pubid_len,
+ &sysid, &sysid_len, &ndataid, &ndataid_len) == FAILURE) {
+ RETURN_THROWS();
}
+ XMLWRITER_FROM_OBJECT(ptr, self);
XMLW_NAME_CHK("Invalid Element Name");
- ptr = intern->ptr;
-
if (ptr) {
retval = xmlTextWriterWriteDTDEntity(ptr, pe, (xmlChar *)name, (xmlChar *)pubid, (xmlChar *)sysid, (xmlChar *)ndataid, (xmlChar *)content);
if (retval != -1) {
@@ -1650,12 +1053,11 @@ static PHP_FUNCTION(xmlwriter_write_dtd_entity)
}
/* }}} */
-/* {{{ proto resource xmlwriter_open_uri(string source)
+/* {{{ proto XMLWriter xmlwriter_open_uri(string source)
Create new xmlwriter using source uri for output */
static PHP_FUNCTION(xmlwriter_open_uri)
{
char *valid_file = NULL;
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
char *source;
char resolved_path[MAXPATHLEN + 1];
@@ -1664,7 +1066,7 @@ static PHP_FUNCTION(xmlwriter_open_uri)
ze_xmlwriter_object *ze_obj = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &source, &source_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (self) {
@@ -1689,33 +1091,36 @@ static PHP_FUNCTION(xmlwriter_open_uri)
RETURN_FALSE;
}
- intern = emalloc(sizeof(xmlwriter_object));
- intern->ptr = ptr;
- intern->output = NULL;
if (self) {
- if (ze_obj->xmlwriter_ptr) {
- xmlwriter_free_resource_ptr(ze_obj->xmlwriter_ptr);
+ if (ze_obj->ptr) {
+ xmlFreeTextWriter(ze_obj->ptr);
}
- ze_obj->xmlwriter_ptr = intern;
+ if (ze_obj->output) {
+ xmlBufferFree(ze_obj->output);
+ }
+ ze_obj->ptr = ptr;
+ ze_obj->output = NULL;
RETURN_TRUE;
} else {
- RETURN_RES(zend_register_resource(intern, le_xmlwriter));
+ ze_obj = php_xmlwriter_fetch_object(xmlwriter_object_new(xmlwriter_class_entry_ce));
+ ze_obj->ptr = ptr;
+ ze_obj->output = NULL;
+ RETURN_OBJ(&ze_obj->std);
}
}
/* }}} */
-/* {{{ proto resource xmlwriter_open_memory()
+/* {{{ proto XMLWriter xmlwriter_open_memory()
Create new xmlwriter using memory for string output */
static PHP_FUNCTION(xmlwriter_open_memory)
{
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
xmlBufferPtr buffer;
zval *self = getThis();
ze_xmlwriter_object *ze_obj = NULL;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (self) {
@@ -1736,17 +1141,21 @@ static PHP_FUNCTION(xmlwriter_open_memory)
RETURN_FALSE;
}
- intern = emalloc(sizeof(xmlwriter_object));
- intern->ptr = ptr;
- intern->output = buffer;
if (self) {
- if (ze_obj->xmlwriter_ptr) {
- xmlwriter_free_resource_ptr(ze_obj->xmlwriter_ptr);
+ if (ze_obj->ptr) {
+ xmlFreeTextWriter(ze_obj->ptr);
+ }
+ if (ze_obj->output) {
+ xmlBufferFree(ze_obj->output);
}
- ze_obj->xmlwriter_ptr = intern;
+ ze_obj->ptr = ptr;
+ ze_obj->output = buffer;
RETURN_TRUE;
} else {
- RETURN_RES(zend_register_resource(intern, le_xmlwriter));
+ ze_obj = php_xmlwriter_fetch_object(xmlwriter_object_new(xmlwriter_class_entry_ce));
+ ze_obj->ptr = ptr;
+ ze_obj->output = buffer;
+ RETURN_OBJ(&ze_obj->std);
}
}
@@ -1754,32 +1163,19 @@ static PHP_FUNCTION(xmlwriter_open_memory)
/* {{{ php_xmlwriter_flush */
static void php_xmlwriter_flush(INTERNAL_FUNCTION_PARAMETERS, int force_string) {
- zval *pind;
- xmlwriter_object *intern;
xmlTextWriterPtr ptr;
xmlBufferPtr buffer;
zend_bool empty = 1;
int output_bytes;
- zval *self = getThis();
-
- if (self) {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &empty) == FAILURE) {
- return;
- }
- XMLWRITER_FROM_OBJECT(intern, self);
- } else {
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|b", &pind, &empty) == FAILURE) {
- return;
- }
+ zval *self;
- if ((intern = (xmlwriter_object *)zend_fetch_resource(Z_RES_P(pind), "XMLWriter", le_xmlwriter)) == NULL) {
- RETURN_FALSE;
- }
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O|b", &self, xmlwriter_class_entry_ce, &empty) == FAILURE) {
+ RETURN_THROWS();
}
- ptr = intern->ptr;
+ XMLWRITER_FROM_OBJECT(ptr, self);
if (ptr) {
- buffer = intern->output;
+ buffer = Z_XMLWRITER_P(self)->output;
if (force_string == 1 && buffer == NULL) {
RETURN_EMPTY_STRING();
}
@@ -1799,7 +1195,7 @@ static void php_xmlwriter_flush(INTERNAL_FUNCTION_PARAMETERS, int force_string)
}
/* }}} */
-/* {{{ proto string xmlwriter_output_memory(resource xmlwriter [,bool flush])
+/* {{{ proto string xmlwriter_output_memory(XMLWriter xmlwriter [,bool flush])
Output current buffer as string */
static PHP_FUNCTION(xmlwriter_output_memory)
{
@@ -1807,7 +1203,7 @@ static PHP_FUNCTION(xmlwriter_output_memory)
}
/* }}} */
-/* {{{ proto mixed xmlwriter_flush(resource xmlwriter [,bool empty])
+/* {{{ proto mixed xmlwriter_flush(XMLWriter xmlwriter [,bool empty])
Output current buffer */
static PHP_FUNCTION(xmlwriter_flush)
{
@@ -1820,7 +1216,6 @@ static PHP_FUNCTION(xmlwriter_flush)
static PHP_MINIT_FUNCTION(xmlwriter)
{
zend_class_entry ce;
- le_xmlwriter = zend_register_list_destructors_ex(xmlwriter_dtor, NULL, "xmlwriter", module_number);
memcpy(&xmlwriter_object_handlers, &std_object_handlers, sizeof(zend_object_handlers));
xmlwriter_object_handlers.offset = XtOffsetOf(ze_xmlwriter_object, std);
diff --git a/ext/xmlwriter/php_xmlwriter.h b/ext/xmlwriter/php_xmlwriter.h
index 0413d3031e..c65678ab3f 100644
--- a/ext/xmlwriter/php_xmlwriter.h
+++ b/ext/xmlwriter/php_xmlwriter.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -34,16 +32,10 @@ extern zend_module_entry xmlwriter_module_entry;
#include <libxml/xmlwriter.h>
#include <libxml/uri.h>
-/* Resource struct, not the object :) */
-typedef struct _xmlwriter_object {
- xmlTextWriterPtr ptr;
- xmlBufferPtr output;
-} xmlwriter_object;
-
-
/* Extends zend object */
typedef struct _ze_xmlwriter_object {
- xmlwriter_object *xmlwriter_ptr;
+ xmlTextWriterPtr ptr;
+ xmlBufferPtr output;
zend_object std;
} ze_xmlwriter_object;
diff --git a/ext/xmlwriter/tests/001.phpt b/ext/xmlwriter/tests/001.phpt
index fd2e075e21..8aa3f665d5 100644
--- a/ext/xmlwriter/tests/001.phpt
+++ b/ext/xmlwriter/tests/001.phpt
@@ -17,8 +17,6 @@ echo file_get_contents($doc_dest);
unset($xw);
unlink($doc_dest);
?>
-===DONE===
--EXPECT--
<?xml version="1.0" encoding="UTF-8"?>
<tag1/>
-===DONE===
diff --git a/ext/xmlwriter/tests/002.phpt b/ext/xmlwriter/tests/002.phpt
index d8c822b1a5..212f224d4a 100644
--- a/ext/xmlwriter/tests/002.phpt
+++ b/ext/xmlwriter/tests/002.phpt
@@ -13,8 +13,6 @@ xmlwriter_end_document($xw);
// Force to write and empty the buffer
echo xmlwriter_flush($xw, true);
?>
-===DONE===
--EXPECT--
<?xml version="1.0" encoding="UTF-8"?>
<tag1/>
-===DONE===
diff --git a/ext/xmlwriter/tests/003.phpt b/ext/xmlwriter/tests/003.phpt
index f7dcdfaa6c..4f2003fe35 100644
--- a/ext/xmlwriter/tests/003.phpt
+++ b/ext/xmlwriter/tests/003.phpt
@@ -18,16 +18,14 @@ xmlwriter_write_attribute($xw, "att2", "att2_value");
xmlwriter_text($xw, "Test text for tag1");
$res = xmlwriter_start_element($xw, 'tag2');
if ($res < 1) {
- echo "StartElement context validation failed\n";
- exit();
+ echo "StartElement context validation failed\n";
+ exit();
}
xmlwriter_end_document($xw);
// Force to write and empty the buffer
echo xmlwriter_flush($xw, true);
?>
-===DONE===
--EXPECT--
<?xml version="1.0" encoding="UTF-8"?>
<tag1 attr1="attr1_value" att2="att2_value">Test text for tag1<tag2/></tag1>
-===DONE===
diff --git a/ext/xmlwriter/tests/004.phpt b/ext/xmlwriter/tests/004.phpt
index 73c4642fb3..72766bb0e9 100644
--- a/ext/xmlwriter/tests/004.phpt
+++ b/ext/xmlwriter/tests/004.phpt
@@ -24,12 +24,10 @@ $md5_res = md5('<?xml version="1.0" encoding="UTF-8"?>
unset($xw);
unlink($doc_dest);
if ($md5_out != $md5_res) {
- echo "failed: $md5_res != $md5_out\n";
+ echo "failed: $md5_res != $md5_out\n";
} else {
- echo "ok.\n";
+ echo "ok.\n";
}
?>
-===DONE===
--EXPECT--
ok.
-===DONE===
diff --git a/ext/xmlwriter/tests/005-mb.phpt b/ext/xmlwriter/tests/005-mb.phpt
index 41c86f857d..1726b5e329 100644
--- a/ext/xmlwriter/tests/005-mb.phpt
+++ b/ext/xmlwriter/tests/005-mb.phpt
@@ -25,8 +25,6 @@ echo file_get_contents($doc_dest);
unset($xw);
unlink($doc_dest);
?>
-===DONE===
--EXPECT--
<?xml version="1.0" encoding="UTF-8"?>
<tag1><!--comment--><!--comment #2--></tag1>
-===DONE===
diff --git a/ext/xmlwriter/tests/005.phpt b/ext/xmlwriter/tests/005.phpt
index aca59e4b1f..7412408c7f 100644
--- a/ext/xmlwriter/tests/005.phpt
+++ b/ext/xmlwriter/tests/005.phpt
@@ -25,8 +25,6 @@ echo file_get_contents($doc_dest);
unset($xw);
unlink($doc_dest);
?>
-===DONE===
--EXPECT--
<?xml version="1.0" encoding="UTF-8"?>
<tag1><!--comment--><!--comment #2--></tag1>
-===DONE===
diff --git a/ext/xmlwriter/tests/OO_001.phpt b/ext/xmlwriter/tests/OO_001.phpt
index bd5edf08d8..4ed1abb5aa 100644
--- a/ext/xmlwriter/tests/OO_001.phpt
+++ b/ext/xmlwriter/tests/OO_001.phpt
@@ -18,8 +18,6 @@ echo file_get_contents($doc_dest);
unset($xw);
unlink($doc_dest);
?>
-===DONE===
--EXPECT--
<?xml version="1.0" encoding="UTF-8" standalone="standalonearg"?>
<tag1/>
-===DONE===
diff --git a/ext/xmlwriter/tests/OO_002.phpt b/ext/xmlwriter/tests/OO_002.phpt
index 2f606cca7c..84fef5c349 100644
--- a/ext/xmlwriter/tests/OO_002.phpt
+++ b/ext/xmlwriter/tests/OO_002.phpt
@@ -14,8 +14,6 @@ $xw->endDocument();
// Force to write and empty the buffer
echo $xw->flush(true);
?>
-===DONE===
--EXPECT--
<?xml version="1.0" encoding="UTF-8" standalone="standalone"?>
<tag1/>
-===DONE===
diff --git a/ext/xmlwriter/tests/OO_003.phpt b/ext/xmlwriter/tests/OO_003.phpt
index aa64b63e5f..ba1e7e177d 100644
--- a/ext/xmlwriter/tests/OO_003.phpt
+++ b/ext/xmlwriter/tests/OO_003.phpt
@@ -21,16 +21,14 @@ $xw->endAttribute();
$xw->text("Test text for tag1");
$res = $xw->startElement('tag2');
if ($res < 1) {
- echo "StartElement context validation failed\n";
- exit();
+ echo "StartElement context validation failed\n";
+ exit();
}
$xw->endDocument();
// Force to write and empty the buffer
echo $xw->flush(true);
?>
-===DONE===
--EXPECT--
<?xml version="1.0" encoding="UTF-8"?>
<tag1 attr1="attr1_value" attr2="attr2_value">Test text for tag1<tag2/></tag1>
-===DONE===
diff --git a/ext/xmlwriter/tests/OO_004.phpt b/ext/xmlwriter/tests/OO_004.phpt
index ecda7a1b03..17dbee9d28 100644
--- a/ext/xmlwriter/tests/OO_004.phpt
+++ b/ext/xmlwriter/tests/OO_004.phpt
@@ -25,12 +25,10 @@ $md5_res = md5('<?xml version="1.0" encoding="UTF-8"?>
unset($xw);
unlink($doc_dest);
if ($md5_out != $md5_res) {
- echo "failed: $md5_res != $md5_out\n";
+ echo "failed: $md5_res != $md5_out\n";
} else {
- echo "ok.\n";
+ echo "ok.\n";
}
?>
-===DONE===
--EXPECT--
ok.
-===DONE===
diff --git a/ext/xmlwriter/tests/OO_005.phpt b/ext/xmlwriter/tests/OO_005.phpt
index 7478ac71ed..98e6b253b4 100644
--- a/ext/xmlwriter/tests/OO_005.phpt
+++ b/ext/xmlwriter/tests/OO_005.phpt
@@ -25,8 +25,6 @@ echo file_get_contents($doc_dest);
unset($xw);
unlink($doc_dest);
?>
-===DONE===
--EXPECT--
<?xml version="1.0" encoding="UTF-8"?>
<tag1><!--comment--><!--comment #2--></tag1>
-===DONE===
diff --git a/ext/xmlwriter/tests/bug41326.phpt b/ext/xmlwriter/tests/bug41326.phpt
index c87af84722..886e149261 100644
--- a/ext/xmlwriter/tests/bug41326.phpt
+++ b/ext/xmlwriter/tests/bug41326.phpt
@@ -15,7 +15,6 @@ $xml->writeElement('foo', null);
$xml->writeElement('foo2', "");
$xml->writeElement('foo3');
$xml->startElement('bar');
-$xml->endElement('bar');
$xml->endElement();
$xml->endElement();
print $xml->flush(true);
@@ -37,7 +36,6 @@ $xw->endDocument();
print $xw->flush(true);
?>
--EXPECTF--
-Warning: XMLWriter::endElement() expects exactly 0 parameters, 1 given in %s on line %d
<?xml version="1.0"?>
<test>
<foo/>
diff --git a/ext/xmlwriter/tests/xmlwriter_set_indent_string_basic_001.phpt b/ext/xmlwriter/tests/xmlwriter_set_indent_string_basic_001.phpt
index d887008256..26f243dfef 100644
--- a/ext/xmlwriter/tests/xmlwriter_set_indent_string_basic_001.phpt
+++ b/ext/xmlwriter/tests/xmlwriter_set_indent_string_basic_001.phpt
@@ -5,9 +5,9 @@ xmlwriter_set_indent_string passing xmlwriter resource
--FILE--
<?php
$temp_filename = __DIR__."/xmlwriter_set_indent_string.tmp";
- $fp = fopen($temp_filename, "w");
- fwrite ($fp, "Hi");
- fclose($fp);
+ $fp = fopen($temp_filename, "w");
+ fwrite ($fp, "Hi");
+ fclose($fp);
$resource = xmlwriter_open_uri($temp_filename);
var_dump(xmlwriter_set_indent_string($resource, ' '));
?>
diff --git a/ext/xmlwriter/xmlwriter.stub.php b/ext/xmlwriter/xmlwriter.stub.php
new file mode 100644
index 0000000000..ce476c0705
--- /dev/null
+++ b/ext/xmlwriter/xmlwriter.stub.php
@@ -0,0 +1,172 @@
+<?php
+
+function xmlwriter_open_uri(string $uri): XMLWriter|false {}
+
+function xmlwriter_open_memory(): XMLWriter|false {}
+
+function xmlwriter_set_indent(XMLWriter $xmlwriter, bool $indent): bool {}
+
+function xmlwriter_set_indent_string(XMLWriter $xmlwriter, string $indentString): bool {}
+
+function xmlwriter_start_comment(XMLWriter $xmlwriter): bool {}
+
+function xmlwriter_end_comment(XMLWriter $xmlwriter): bool {}
+
+function xmlwriter_start_attribute(XMLWriter $xmlwriter, string $name): bool {}
+
+function xmlwriter_end_attribute(XMLWriter $xmlwriter): bool {}
+
+function xmlwriter_write_attribute(XMLWriter $xmlwriter, string $name, string $value): bool {}
+
+function xmlwriter_start_attribute_ns(XMLWriter $xmlwriter, string $prefix, string $name, ?string $uri): bool {}
+
+function xmlwriter_write_attribute_ns(XMLWriter $xmlwriter, string $prefix, string $name, ?string $uri, string $content): bool {}
+
+function xmlwriter_start_element(XMLWriter $xmlwriter, string $name): bool {}
+
+function xmlwriter_end_element(XMLWriter $xmlwriter): bool {}
+
+function xmlwriter_full_end_element(XMLWriter $xmlwriter): bool {}
+
+function xmlwriter_start_element_ns(XMLWriter $xmlwriter, ?string $prefix, string $name, ?string $uri): bool {}
+
+function xmlwriter_write_element(XMLWriter $xmlwriter, string $name, ?string $content = null): bool {}
+
+function xmlwriter_write_element_ns(XMLWriter $xmlwriter, ?string $prefix, string $name, ?string $uri, ?string $content = null): bool {}
+
+function xmlwriter_start_pi(XMLWriter $xmlwriter, string $target): bool {}
+
+function xmlwriter_end_pi(XMLWriter $xmlwriter): bool {}
+
+function xmlwriter_write_pi(XMLWriter $xmlwriter, string $target, string $content): bool {}
+
+function xmlwriter_start_cdata(XMLWriter $xmlwriter): bool {}
+
+function xmlwriter_end_cdata(XMLWriter $xmlwriter): bool {}
+
+function xmlwriter_write_cdata(XMLWriter $xmlwriter, string $content): bool {}
+
+function xmlwriter_text(XMLWriter $xmlwriter, string $content): bool {}
+
+function xmlwriter_write_raw(XMLWriter $xmlwriter, string $content): bool {}
+
+function xmlwriter_start_document(XMLWriter $xmlwriter, ?string $version = '1.0', ?string $encoding = null, ?string $standalone = null) {}
+
+function xmlwriter_end_document(XMLWriter $xmlwriter): bool {}
+
+function xmlwriter_write_comment(XMLWriter $xmlwriter, string $content): bool {}
+
+function xmlwriter_start_dtd(XMLWriter $xmlwriter, string $qualifiedName, ?string $publicId = null, ?string $systemId = null): bool {}
+
+function xmlwriter_end_dtd(XMLWriter $xmlwriter): bool {}
+
+function xmlwriter_write_dtd(XMLWriter $xmlwriter, string $name, ?string $publicId = null, ?string $systemId = null, ?string $subset = null): bool {}
+
+function xmlwriter_start_dtd_element(XMLWriter $xmlwriter, string $qualifiedName): bool {}
+
+function xmlwriter_end_dtd_element(XMLWriter $xmlwriter): bool {}
+
+function xmlwriter_write_dtd_element(XMLWriter $xmlwriter, string $name, string $content): bool {}
+
+function xmlwriter_start_dtd_attlist(XMLWriter $xmlwriter, string $name): bool {}
+
+function xmlwriter_end_dtd_attlist(XMLWriter $xmlwriter): bool {}
+
+function xmlwriter_write_dtd_attlist(XMLWriter $xmlwriter, string $name, string $content): bool {}
+
+function xmlwriter_start_dtd_entity(XMLWriter $xmlwriter, string $name, bool $isparam): bool {}
+
+function xmlwriter_end_dtd_entity(XMLWriter $xmlwriter): bool {}
+
+function xmlwriter_write_dtd_entity(XMLWriter $xmlwriter, string $name, string $content, bool $isparam = false, string $publicId = UNKNOWN, string $systemId = UNKNOWN, string $ndataid = UNKNOWN): bool {}
+
+function xmlwriter_output_memory(XMLWriter $xmlwriter, bool $flush = true): string {}
+
+function xmlwriter_flush(XMLWriter $xmlwriter, bool $empty = true): string|int {}
+
+class XMLWriter
+{
+ function openUri(string $uri): bool {}
+
+ function openMemory(): bool {}
+
+ function setIndent(bool $indent): bool {}
+
+ function setIdentString(string $indentString): bool {}
+
+ function startComment(): bool {}
+
+ function endComment(): bool {}
+
+ function startAttribute(string $name): bool {}
+
+ function endAttribute(): bool {}
+
+ function writeAttribute(string $name, string $value): bool {}
+
+ function startAttributeNs(string $prefix, string $name, ?string $uri): bool {}
+
+ function writeAttributeNs(string $prefix, string $name, ?string $uri, string $content): bool {}
+
+ function startElement(string $name): bool {}
+
+ function endElement(): bool {}
+
+ function fullEndElement(): bool {}
+
+ function startElementNs(?string $prefix, string $name, ?string $uri): bool {}
+
+ function writeElement(string $name, ?string $content = null): bool {}
+
+ function writeElementNs(?string $prefix, string $name, ?string $uri, ?string $content = null): bool {}
+
+ function startPi(string $target): bool {}
+
+ function endPi(): bool {}
+
+ function writePi(string $target, string $content): bool {}
+
+ function startCdata(): bool {}
+
+ function endCdata(): bool {}
+
+ function writeCdata(string $content): bool {}
+
+ function text(string $content): bool {}
+
+ function writeRaw(string $content): bool {}
+
+ function startDocument(?string $version = '1.0', ?string $encoding = null, ?string $standalone = null): bool {}
+
+ function endDocument(): bool {}
+
+ function writeComment(string $content): bool {}
+
+ function startDtd(string $qualifiedName, ?string $publicId = null, ?string $systemId = null): bool {}
+
+ function endDtd(): bool {}
+
+ function writeDtd(string $name, ?string $publicId = null, ?string $systemId = null, ?string $subset = null): bool {}
+
+ function startDtdElement(string $qualifiedName): bool {}
+
+ function endDtdElement(): bool {}
+
+ function writeDtdElement(string $name, string $content): bool {}
+
+ function startDtdAttlist(string $name): bool {}
+
+ function endDtdAttlist(): bool {}
+
+ function writeDtdAttlist(string $name, string $content): bool {}
+
+ function startDtdEntity(string $name, bool $isparam): bool {}
+
+ function endDtdEntity(): bool {}
+
+ function writeDtdEntity(string $name, string $content, bool $isparam, string $publicId = UNKNOWN, string $systemId = UNKNOWN, string $ndataid = UNKNOWN): bool {}
+
+ function outputMemory(bool $flush = true): string {}
+
+ function flush(bool $empty = true): string|int {}
+}
diff --git a/ext/xmlwriter/xmlwriter_arginfo.h b/ext/xmlwriter/xmlwriter_arginfo.h
new file mode 100644
index 0000000000..54f571cb34
--- /dev/null
+++ b/ext/xmlwriter/xmlwriter_arginfo.h
@@ -0,0 +1,336 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_xmlwriter_open_uri, 0, 1, XMLWriter, MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, uri, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_xmlwriter_open_memory, 0, 0, XMLWriter, MAY_BE_FALSE)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlwriter_set_indent, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ ZEND_ARG_TYPE_INFO(0, indent, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlwriter_set_indent_string, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ ZEND_ARG_TYPE_INFO(0, indentString, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlwriter_start_comment, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_xmlwriter_end_comment arginfo_xmlwriter_start_comment
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlwriter_start_attribute, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_xmlwriter_end_attribute arginfo_xmlwriter_start_comment
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlwriter_write_attribute, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlwriter_start_attribute_ns, 0, 4, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ ZEND_ARG_TYPE_INFO(0, prefix, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, uri, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlwriter_write_attribute_ns, 0, 5, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ ZEND_ARG_TYPE_INFO(0, prefix, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, uri, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, content, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_xmlwriter_start_element arginfo_xmlwriter_start_attribute
+
+#define arginfo_xmlwriter_end_element arginfo_xmlwriter_start_comment
+
+#define arginfo_xmlwriter_full_end_element arginfo_xmlwriter_start_comment
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlwriter_start_element_ns, 0, 4, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ ZEND_ARG_TYPE_INFO(0, prefix, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, uri, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlwriter_write_element, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, content, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlwriter_write_element_ns, 0, 4, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ ZEND_ARG_TYPE_INFO(0, prefix, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, uri, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, content, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlwriter_start_pi, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ ZEND_ARG_TYPE_INFO(0, target, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_xmlwriter_end_pi arginfo_xmlwriter_start_comment
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlwriter_write_pi, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ ZEND_ARG_TYPE_INFO(0, target, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, content, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_xmlwriter_start_cdata arginfo_xmlwriter_start_comment
+
+#define arginfo_xmlwriter_end_cdata arginfo_xmlwriter_start_comment
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlwriter_write_cdata, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ ZEND_ARG_TYPE_INFO(0, content, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_xmlwriter_text arginfo_xmlwriter_write_cdata
+
+#define arginfo_xmlwriter_write_raw arginfo_xmlwriter_write_cdata
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xmlwriter_start_document, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ ZEND_ARG_TYPE_INFO(0, version, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, standalone, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+#define arginfo_xmlwriter_end_document arginfo_xmlwriter_start_comment
+
+#define arginfo_xmlwriter_write_comment arginfo_xmlwriter_write_cdata
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlwriter_start_dtd, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ ZEND_ARG_TYPE_INFO(0, qualifiedName, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, publicId, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, systemId, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+#define arginfo_xmlwriter_end_dtd arginfo_xmlwriter_start_comment
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlwriter_write_dtd, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, publicId, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, systemId, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, subset, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlwriter_start_dtd_element, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ ZEND_ARG_TYPE_INFO(0, qualifiedName, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_xmlwriter_end_dtd_element arginfo_xmlwriter_start_comment
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlwriter_write_dtd_element, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, content, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_xmlwriter_start_dtd_attlist arginfo_xmlwriter_start_attribute
+
+#define arginfo_xmlwriter_end_dtd_attlist arginfo_xmlwriter_start_comment
+
+#define arginfo_xmlwriter_write_dtd_attlist arginfo_xmlwriter_write_dtd_element
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlwriter_start_dtd_entity, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, isparam, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_xmlwriter_end_dtd_entity arginfo_xmlwriter_start_comment
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlwriter_write_dtd_entity, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, content, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, isparam, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, publicId, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, systemId, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, ndataid, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_xmlwriter_output_memory, 0, 1, IS_STRING, 0)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ ZEND_ARG_TYPE_INFO(0, flush, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_xmlwriter_flush, 0, 1, MAY_BE_STRING|MAY_BE_LONG)
+ ZEND_ARG_OBJ_INFO(0, xmlwriter, XMLWriter, 0)
+ ZEND_ARG_TYPE_INFO(0, empty, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_openUri, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, uri, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_openMemory, 0, 0, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_setIndent, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, indent, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_setIdentString, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, indentString, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_XMLWriter_startComment arginfo_class_XMLWriter_openMemory
+
+#define arginfo_class_XMLWriter_endComment arginfo_class_XMLWriter_openMemory
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_startAttribute, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_XMLWriter_endAttribute arginfo_class_XMLWriter_openMemory
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_writeAttribute, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_startAttributeNs, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, prefix, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, uri, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_writeAttributeNs, 0, 4, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, prefix, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, uri, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, content, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_XMLWriter_startElement arginfo_class_XMLWriter_startAttribute
+
+#define arginfo_class_XMLWriter_endElement arginfo_class_XMLWriter_openMemory
+
+#define arginfo_class_XMLWriter_fullEndElement arginfo_class_XMLWriter_openMemory
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_startElementNs, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, prefix, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, uri, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_writeElement, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, content, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_writeElementNs, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, prefix, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, uri, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, content, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_startPi, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, target, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_XMLWriter_endPi arginfo_class_XMLWriter_openMemory
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_writePi, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, target, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, content, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_XMLWriter_startCdata arginfo_class_XMLWriter_openMemory
+
+#define arginfo_class_XMLWriter_endCdata arginfo_class_XMLWriter_openMemory
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_writeCdata, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, content, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_XMLWriter_text arginfo_class_XMLWriter_writeCdata
+
+#define arginfo_class_XMLWriter_writeRaw arginfo_class_XMLWriter_writeCdata
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_startDocument, 0, 0, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, version, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, standalone, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_XMLWriter_endDocument arginfo_class_XMLWriter_openMemory
+
+#define arginfo_class_XMLWriter_writeComment arginfo_class_XMLWriter_writeCdata
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_startDtd, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, qualifiedName, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, publicId, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, systemId, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_XMLWriter_endDtd arginfo_class_XMLWriter_openMemory
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_writeDtd, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, publicId, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, systemId, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, subset, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_startDtdElement, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, qualifiedName, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_XMLWriter_endDtdElement arginfo_class_XMLWriter_openMemory
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_writeDtdElement, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, content, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_XMLWriter_startDtdAttlist arginfo_class_XMLWriter_startAttribute
+
+#define arginfo_class_XMLWriter_endDtdAttlist arginfo_class_XMLWriter_openMemory
+
+#define arginfo_class_XMLWriter_writeDtdAttlist arginfo_class_XMLWriter_writeDtdElement
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_startDtdEntity, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, isparam, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_XMLWriter_endDtdEntity arginfo_class_XMLWriter_openMemory
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_writeDtdEntity, 0, 3, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, content, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, isparam, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, publicId, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, systemId, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, ndataid, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_XMLWriter_outputMemory, 0, 0, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, flush, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_class_XMLWriter_flush, 0, 0, MAY_BE_STRING|MAY_BE_LONG)
+ ZEND_ARG_TYPE_INFO(0, empty, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
diff --git a/ext/xsl/php_xsl.c b/ext/xsl/php_xsl.c
index 9202c8a03a..da67e9ea64 100644
--- a/ext/xsl/php_xsl.c
+++ b/ext/xsl/php_xsl.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/xsl/php_xsl.h b/ext/xsl/php_xsl.h
index 6cbf2872b3..0d105ce2a0 100644
--- a/ext/xsl/php_xsl.h
+++ b/ext/xsl/php_xsl.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/xsl/tests/bug49634.phpt b/ext/xsl/tests/bug49634.phpt
index 61c39b488d..86c11b1884 100644
--- a/ext/xsl/tests/bug49634.phpt
+++ b/ext/xsl/tests/bug49634.phpt
@@ -10,7 +10,7 @@ extension_loaded("xsl") or die("skip need ext/xsl");
$sXml = <<<XML
<?xml version="1.0" encoding="UTF-8" ?>
<root>
- test
+ test
</root>
XML;
@@ -21,16 +21,16 @@ $sXsl = <<<XSL
xmlns:ext="http://php.net/xsl"
xsl:extension-element-prefixes="ext"
exclude-result-prefixes="ext">
- <xsl:output encoding="UTF-8" indent="yes" method="xml" />
- <xsl:template match="/">
- <xsl:value-of select="ext:function('testFunction', document('$cDIR/bug49634.xml')/root)"/>
- </xsl:template>
+ <xsl:output encoding="UTF-8" indent="yes" method="xml" />
+ <xsl:template match="/">
+ <xsl:value-of select="ext:function('testFunction', document('$cDIR/bug49634.xml')/root)"/>
+ </xsl:template>
</xsl:stylesheet>
XSL;
function testFunction($a)
{
- throw new Exception('Test exception.');
+ throw new Exception('Test exception.');
}
$domXml = new DOMDocument;
@@ -40,17 +40,16 @@ $domXsl->loadXML($sXsl);
for ($i = 0; $i < 10; $i++)
{
- $xsltProcessor = new XSLTProcessor();
- $xsltProcessor->registerPHPFunctions(array('testFunction'));
- $xsltProcessor->importStyleSheet($domXsl);
- try {
- @$xsltProcessor->transformToDoc($domXml);
- } catch (Exception $e) {
- echo $e,"\n";
- }
+ $xsltProcessor = new XSLTProcessor();
+ $xsltProcessor->registerPHPFunctions(array('testFunction'));
+ $xsltProcessor->importStyleSheet($domXsl);
+ try {
+ @$xsltProcessor->transformToDoc($domXml);
+ } catch (Exception $e) {
+ echo $e,"\n";
+ }
}
?>
-===DONE===
--EXPECTF--
Exception: Test exception. in %s:%d
Stack trace:
@@ -102,4 +101,3 @@ Stack trace:
#0 [internal function]: testFunction(Array)
#1 %s(%d): XSLTProcessor->transformToDoc(Object(DOMDocument))
#2 {main}
-===DONE===
diff --git a/ext/xsl/tests/bug54446.phpt b/ext/xsl/tests/bug54446.phpt
index b9af5581eb..1e518f4977 100644
--- a/ext/xsl/tests/bug54446.phpt
+++ b/ext/xsl/tests/bug54446.phpt
@@ -15,15 +15,15 @@ if (file_exists($outputfile)) {
$sXsl = <<<EOT
<xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:sax="http://icl.com/saxon"
- extension-element-prefixes="sax">
-
- <xsl:template match="/">
- <sax:output href="$outputfile" method="text">
- <xsl:value-of select="'0wn3d via PHP and libxslt ...'"/>
- </sax:output>
- </xsl:template>
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:sax="http://icl.com/saxon"
+ extension-element-prefixes="sax">
+
+ <xsl:template match="/">
+ <sax:output href="$outputfile" method="text">
+ <xsl:value-of select="'0wn3d via PHP and libxslt ...'"/>
+ </sax:output>
+ </xsl:template>
</xsl:stylesheet>
EOT;
diff --git a/ext/xsl/tests/bug54446_with_ini.phpt b/ext/xsl/tests/bug54446_with_ini.phpt
index 5327d6d397..9232295358 100644
--- a/ext/xsl/tests/bug54446_with_ini.phpt
+++ b/ext/xsl/tests/bug54446_with_ini.phpt
@@ -15,15 +15,15 @@ if (file_exists($outputfile)) {
$sXsl = <<<EOT
<xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:sax="http://icl.com/saxon"
- extension-element-prefixes="sax">
-
- <xsl:template match="/">
- <sax:output href="$outputfile" method="text">
- <xsl:value-of select="'0wn3d via PHP and libxslt ...'"/>
- </sax:output>
- </xsl:template>
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:sax="http://icl.com/saxon"
+ extension-element-prefixes="sax">
+
+ <xsl:template match="/">
+ <sax:output href="$outputfile" method="text">
+ <xsl:value-of select="'0wn3d via PHP and libxslt ...'"/>
+ </sax:output>
+ </xsl:template>
</xsl:stylesheet>
EOT;
diff --git a/ext/xsl/tests/bug71540.phpt b/ext/xsl/tests/bug71540.phpt
index ba034824fe..367ba49c15 100644
--- a/ext/xsl/tests/bug71540.phpt
+++ b/ext/xsl/tests/bug71540.phpt
@@ -16,7 +16,7 @@ $xml = <<<EOB
EOB;
$xsl = <<<EOB
<?xml version="1.0" encoding="UTF-8"?>
-<xsl:stylesheet version="1.0"
+<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:php="http://php.net/xsl">
<xsl:output method="html" encoding="utf-8" indent="yes"/>
@@ -52,9 +52,9 @@ Warning: XSLTProcessor::transformToXml(): xmlXPathCompOpEval: function test not
Warning: XSLTProcessor::transformToXml(): Unregistered function in %sbug71540.php on line %d
-Warning: XSLTProcessor::transformToXml(): Stack usage errror in %sbug71540.php on line %d
+Warning: XSLTProcessor::transformToXml(): Stack usage error in %sbug71540.php on line %d
-Warning: XSLTProcessor::transformToXml(): Stack usage errror in %sbug71540.php on line %d
+Warning: XSLTProcessor::transformToXml(): Stack usage error in %sbug71540.php on line %d
Warning: XSLTProcessor::transformToXml(): Handler name must be a string in %sbug71540.php on line %d
diff --git a/ext/xsl/tests/xslt012.phpt b/ext/xsl/tests/xslt012.phpt
index a24a0d2a7f..737512bbe9 100644
--- a/ext/xsl/tests/xslt012.phpt
+++ b/ext/xsl/tests/xslt012.phpt
@@ -30,9 +30,9 @@ if(!$proc) {
$proc->importStylesheet($xsl);
$parameters = Array(
- 'foo' => 'barbar',
- 'foo1' => 'test',
- );
+ 'foo' => 'barbar',
+ 'foo1' => 'test',
+ );
$proc->setParameter( "", $parameters);
diff --git a/ext/xsl/xsl_fe.h b/ext/xsl/xsl_fe.h
index f48a126789..fbb0186619 100644
--- a/ext/xsl/xsl_fe.h
+++ b/ext/xsl/xsl_fe.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/xsl/xsltprocessor.c b/ext/xsl/xsltprocessor.c
index 079920d0ff..c64fd668a1 100644
--- a/ext/xsl/xsltprocessor.c
+++ b/ext/xsl/xsltprocessor.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -400,11 +398,12 @@ PHP_FUNCTION(xsl_xsltprocessor_import_stylesheet)
xsl_object *intern;
int prevSubstValue, prevExtDtdValue, clone_docu = 0;
xmlNode *nodep = NULL;
- zval *cloneDocu, member, rv;
+ zval *cloneDocu, rv;
+ zend_string *member;
id = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &docp) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
nodep = php_libxml_import_node(docp);
@@ -436,13 +435,13 @@ PHP_FUNCTION(xsl_xsltprocessor_import_stylesheet)
intern = Z_XSL_P(id);
- ZVAL_STRING(&member, "cloneDocument");
- cloneDocu = zend_std_read_property(id, &member, BP_VAR_IS, NULL, &rv);
+ member = zend_string_init("cloneDocument", sizeof("cloneDocument")-1, 0);
+ cloneDocu = zend_std_read_property(Z_OBJ_P(id), member, BP_VAR_IS, NULL, &rv);
if (Z_TYPE_P(cloneDocu) != IS_NULL) {
convert_to_long(cloneDocu);
clone_docu = Z_LVAL_P(cloneDocu);
}
- zval_ptr_dtor(&member);
+ zend_string_release_ex(member, 0);
if (clone_docu == 0) {
/* check if the stylesheet is using xsl:key, if yes, we have to clone the document _always_ before a transformation */
nodep = xmlDocGetRootElement(sheetp->doc);
@@ -482,7 +481,8 @@ static xmlDocPtr php_xsl_apply_stylesheet(zval *id, xsl_object *intern, xsltStyl
php_libxml_node_object *object;
char **params = NULL;
int clone;
- zval *doXInclude, member, rv;
+ zval *doXInclude, rv;
+ zend_string *member;
FILE *f;
int secPrefsError = 0;
int secPrefsValue;
@@ -532,13 +532,13 @@ static xmlDocPtr php_xsl_apply_stylesheet(zval *id, xsl_object *intern, xsltStyl
ctxt = xsltNewTransformContext(style, doc);
ctxt->_private = (void *) intern;
- ZVAL_STRING(&member, "doXInclude");
- doXInclude = zend_std_read_property(id, &member, BP_VAR_IS, NULL, &rv);
+ member = zend_string_init("doXInclude", sizeof("doXInclude")-1, 0);
+ doXInclude = zend_std_read_property(Z_OBJ_P(id), member, BP_VAR_IS, NULL, &rv);
if (Z_TYPE_P(doXInclude) != IS_NULL) {
convert_to_long(doXInclude);
ctxt->xinclude = Z_LVAL_P(doXInclude);
}
- zval_ptr_dtor(&member);
+ zend_string_release_ex(member, 0);
secPrefsValue = intern->securityPrefs;
@@ -630,7 +630,7 @@ PHP_FUNCTION(xsl_xsltprocessor_transform_to_doc)
sheetp = (xsltStylesheetPtr) intern->ptr;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "o|S!", &docp, &ret_class) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
newdocp = php_xsl_apply_stylesheet(id, intern, sheetp, docp);
@@ -687,7 +687,7 @@ PHP_FUNCTION(xsl_xsltprocessor_transform_to_uri)
sheetp = (xsltStylesheetPtr) intern->ptr;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "op", &docp, &uri, &uri_len) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
newdocp = php_xsl_apply_stylesheet(id, intern, sheetp, docp);
@@ -719,7 +719,7 @@ PHP_FUNCTION(xsl_xsltprocessor_transform_to_xml)
sheetp = (xsltStylesheetPtr) intern->ptr;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &docp) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
newdocp = php_xsl_apply_stylesheet(id, intern, sheetp, docp);
@@ -800,7 +800,7 @@ PHP_FUNCTION(xsl_xsltprocessor_get_parameter)
DOM_GET_THIS(id);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sS", &namespace, &namespace_len, &name) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
intern = Z_XSL_P(id);
if ((value = zend_hash_find(intern->parameter, name)) != NULL) {
@@ -824,7 +824,7 @@ PHP_FUNCTION(xsl_xsltprocessor_remove_parameter)
DOM_GET_THIS(id);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sS", &namespace, &namespace_len, &name) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
intern = Z_XSL_P(id);
if (zend_hash_del(intern->parameter, name) == SUCCESS) {
@@ -910,7 +910,7 @@ PHP_FUNCTION(xsl_xsltprocessor_set_security_prefs)
DOM_GET_THIS(id);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &securityPrefs) == FAILURE) {
- return;
+ RETURN_THROWS();
}
intern = Z_XSL_P(id);
oldSecurityPrefs = intern->securityPrefs;
diff --git a/ext/zend_test/php_test.h b/ext/zend_test/php_test.h
index 325484c434..6da0a6d94a 100644
--- a/ext/zend_test/php_test.h
+++ b/ext/zend_test/php_test.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/zend_test/test.c b/ext/zend_test/test.c
index b097a2412b..64db2a380e 100644
--- a/ext/zend_test/test.c
+++ b/ext/zend_test/test.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -40,6 +38,10 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_zend_test_void_return, IS_VOID, 0)
ZEND_END_ARG_INFO()
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_zend_test_deprecated, IS_VOID, 0)
+ ZEND_ARG_INFO(0, arg1)
+ZEND_END_ARG_INFO()
+
ZEND_BEGIN_ARG_INFO_EX(arginfo_zend_terminate_string, 0, 0, 1)
ZEND_ARG_INFO(1, str)
ZEND_END_ARG_INFO()
@@ -50,7 +52,13 @@ ZEND_END_ARG_INFO()
ZEND_FUNCTION(zend_test_func)
{
- /* dummy */
+ RETVAL_STR_COPY(EX(func)->common.function_name);
+
+ /* Cleanup trampoline */
+ ZEND_ASSERT(EX(func)->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE);
+ zend_string_release(EX(func)->common.function_name);
+ zend_free_trampoline(EX(func));
+ EX(func) = NULL;
}
ZEND_FUNCTION(zend_test_array_return)
@@ -72,7 +80,14 @@ ZEND_FUNCTION(zend_test_void_return)
/* dummy */
}
-/* Create a string without terminating null byte. Must be termined with
+ZEND_FUNCTION(zend_test_deprecated)
+{
+ zval *arg1;
+
+ zend_parse_parameters(ZEND_NUM_ARGS(), "|z", &arg1);
+}
+
+/* Create a string without terminating null byte. Must be terminated with
* zend_terminate_string() before destruction, otherwise a warning is issued
* in debug builds. */
ZEND_FUNCTION(zend_create_unterminated_string)
@@ -80,7 +95,7 @@ ZEND_FUNCTION(zend_create_unterminated_string)
zend_string *str, *res;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &str) == FAILURE) {
- return;
+ RETURN_THROWS();
}
res = zend_string_alloc(ZSTR_LEN(str), 0);
@@ -96,7 +111,7 @@ ZEND_FUNCTION(zend_terminate_string)
zend_string *str;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &str) == FAILURE) {
- return;
+ RETURN_THROWS();
}
ZSTR_VAL(str)[ZSTR_LEN(str)] = '\0';
@@ -109,7 +124,7 @@ ZEND_FUNCTION(zend_leak_bytes)
zend_long leakbytes = 3;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &leakbytes) == FAILURE) {
- return;
+ RETURN_THROWS();
}
emalloc(leakbytes);
@@ -123,7 +138,7 @@ ZEND_FUNCTION(zend_leak_variable)
zval *zv;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &zv) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!Z_REFCOUNTED_P(zv)) {
@@ -144,15 +159,20 @@ static zend_object *zend_test_class_new(zend_class_entry *class_type) /* {{{ */
/* }}} */
static zend_function *zend_test_class_method_get(zend_object **object, zend_string *name, const zval *key) /* {{{ */ {
- zend_internal_function *fptr = emalloc(sizeof(zend_internal_function));
- fptr->type = ZEND_OVERLOADED_FUNCTION_TEMPORARY;
+ zend_internal_function *fptr;
+
+ if (EXPECTED(EG(trampoline).common.function_name == NULL)) {
+ fptr = (zend_internal_function *) &EG(trampoline);
+ } else {
+ fptr = emalloc(sizeof(zend_internal_function));
+ }
+ memset(fptr, 0, sizeof(zend_internal_function));
+ fptr->type = ZEND_INTERNAL_FUNCTION;
fptr->num_args = 1;
- fptr->arg_info = NULL;
fptr->scope = (*object)->ce;
fptr->fn_flags = ZEND_ACC_CALL_VIA_HANDLER;
fptr->function_name = zend_string_copy(name);
fptr->handler = ZEND_FN(zend_test_func);
- zend_set_function_arg_flags((zend_function*)fptr);
return (zend_function*)fptr;
}
@@ -160,15 +180,20 @@ static zend_function *zend_test_class_method_get(zend_object **object, zend_stri
static zend_function *zend_test_class_static_method_get(zend_class_entry *ce, zend_string *name) /* {{{ */ {
if (zend_string_equals_literal_ci(name, "test")) {
- zend_internal_function *fptr = emalloc(sizeof(zend_internal_function));
- fptr->type = ZEND_OVERLOADED_FUNCTION;
+ zend_internal_function *fptr;
+
+ if (EXPECTED(EG(trampoline).common.function_name == NULL)) {
+ fptr = (zend_internal_function *) &EG(trampoline);
+ } else {
+ fptr = emalloc(sizeof(zend_internal_function));
+ }
+ memset(fptr, 0, sizeof(zend_internal_function));
+ fptr->type = ZEND_INTERNAL_FUNCTION;
fptr->num_args = 1;
- fptr->arg_info = NULL;
fptr->scope = ce;
fptr->fn_flags = ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_STATIC;
- fptr->function_name = name;
+ fptr->function_name = zend_string_copy(name);
fptr->handler = ZEND_FN(zend_test_func);
- zend_set_function_arg_flags((zend_function*)fptr);
return (zend_function*)fptr;
}
@@ -176,9 +201,8 @@ static zend_function *zend_test_class_static_method_get(zend_class_entry *ce, ze
}
/* }}} */
-static int zend_test_class_call_method(zend_string *method, zend_object *object, INTERNAL_FUNCTION_PARAMETERS) /* {{{ */ {
- RETVAL_STR(zend_string_copy(method));
- return 0;
+static ZEND_METHOD(_ZendTestClass, __toString) /* {{{ */ {
+ RETURN_EMPTY_STRING();
}
/* }}} */
@@ -195,6 +219,7 @@ static ZEND_METHOD(_ZendTestTrait, testMethod) /* {{{ */ {
static const zend_function_entry zend_test_class_methods[] = {
ZEND_ME(_ZendTestClass, is_object, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_ME(_ZendTestClass, __toString, NULL, ZEND_ACC_DEPRECATED)
ZEND_FE_END
};
@@ -211,7 +236,7 @@ PHP_MINIT_FUNCTION(zend_test)
zend_test_interface = zend_register_internal_interface(&class_entry);
zend_declare_class_constant_long(zend_test_interface, ZEND_STRL("DUMMY"), 0);
INIT_CLASS_ENTRY(class_entry, "_ZendTestClass", zend_test_class_methods);
- zend_test_class = zend_register_internal_class_ex(&class_entry, NULL);
+ zend_test_class = zend_register_internal_class(&class_entry);
zend_class_implements(zend_test_class, 1, zend_test_interface);
zend_test_class->create_object = zend_test_class_new;
zend_test_class->get_static_method = zend_test_class_static_method_get;
@@ -223,7 +248,8 @@ PHP_MINIT_FUNCTION(zend_test)
zval val;
ZVAL_LONG(&val, 123);
zend_declare_typed_property(
- zend_test_class, name, &val, ZEND_ACC_PUBLIC, NULL, ZEND_TYPE_ENCODE(IS_LONG, 0));
+ zend_test_class, name, &val, ZEND_ACC_PUBLIC, NULL,
+ (zend_type) ZEND_TYPE_INIT_CODE(IS_LONG, 0, 0));
zend_string_release(name);
}
@@ -234,7 +260,22 @@ PHP_MINIT_FUNCTION(zend_test)
ZVAL_NULL(&val);
zend_declare_typed_property(
zend_test_class, name, &val, ZEND_ACC_PUBLIC, NULL,
- ZEND_TYPE_ENCODE_CLASS(class_name, 1));
+ (zend_type) ZEND_TYPE_INIT_CLASS(class_name, 1, 0));
+ zend_string_release(name);
+ }
+
+ {
+ zend_string *name = zend_string_init("classUnionProp", sizeof("classUnionProp") - 1, 1);
+ zend_string *class_name1 = zend_string_init("stdClass", sizeof("stdClass") - 1, 1);
+ zend_string *class_name2 = zend_string_init("Iterator", sizeof("Iterator") - 1, 1);
+ zend_type_list *type_list = malloc(ZEND_TYPE_LIST_SIZE(2));
+ type_list->num_types = 2;
+ type_list->types[0] = (zend_type) ZEND_TYPE_INIT_CLASS(class_name1, 0, 0);
+ type_list->types[1] = (zend_type) ZEND_TYPE_INIT_CLASS(class_name2, 0, 0);
+ zend_type type = ZEND_TYPE_INIT_PTR(type_list, _ZEND_TYPE_LIST_BIT, 1, 0);
+ zval val;
+ ZVAL_NULL(&val);
+ zend_declare_typed_property(zend_test_class, name, &val, ZEND_ACC_PUBLIC, NULL, type);
zend_string_release(name);
}
@@ -244,7 +285,7 @@ PHP_MINIT_FUNCTION(zend_test)
ZVAL_LONG(&val, 123);
zend_declare_typed_property(
zend_test_class, name, &val, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC, NULL,
- ZEND_TYPE_ENCODE(IS_LONG, 0));
+ (zend_type) ZEND_TYPE_INIT_CODE(IS_LONG, 0, 0));
zend_string_release(name);
}
@@ -253,7 +294,6 @@ PHP_MINIT_FUNCTION(zend_test)
memcpy(&zend_test_class_handlers, &std_object_handlers, sizeof(zend_object_handlers));
zend_test_class_handlers.get_method = zend_test_class_method_get;
- zend_test_class_handlers.call_method = zend_test_class_call_method;
INIT_CLASS_ENTRY(class_entry, "_ZendTestTrait", zend_test_trait_methods);
zend_test_trait = zend_register_internal_class(&class_entry);
@@ -261,6 +301,8 @@ PHP_MINIT_FUNCTION(zend_test)
zend_declare_property_null(zend_test_trait, "testProp", sizeof("testProp")-1, ZEND_ACC_PUBLIC);
zend_register_class_alias("_ZendTestClassAlias", zend_test_class);
+
+ REGISTER_LONG_CONSTANT("ZEND_TEST_DEPRECATED", 42, CONST_PERSISTENT | CONST_DEPRECATED);
return SUCCESS;
}
@@ -293,6 +335,7 @@ static const zend_function_entry zend_test_functions[] = {
ZEND_FE(zend_test_array_return, arginfo_zend_test_array_return)
ZEND_FE(zend_test_nullable_array_return, arginfo_zend_test_nullable_array_return)
ZEND_FE(zend_test_void_return, arginfo_zend_test_void_return)
+ ZEND_DEP_FE(zend_test_deprecated, arginfo_zend_test_deprecated)
ZEND_FE(zend_create_unterminated_string, NULL)
ZEND_FE(zend_terminate_string, arginfo_zend_terminate_string)
ZEND_FE(zend_leak_bytes, NULL)
diff --git a/ext/zip/config.m4 b/ext/zip/config.m4
index 0b151b7f2a..abd84ff51d 100644
--- a/ext/zip/config.m4
+++ b/ext/zip/config.m4
@@ -9,6 +9,15 @@ if test "$PHP_ZIP" != "no"; then
PHP_EVAL_INCLINE($LIBZIP_CFLAGS)
PHP_EVAL_LIBLINE($LIBZIP_LIBS, ZIP_SHARED_LIBADD)
+ PHP_CHECK_LIBRARY(zip, zip_file_set_mtime,
+ [
+ AC_DEFINE(HAVE_SET_MTIME, 1, [Libzip >= 1.0.0 with zip_file_set_mtime])
+ ], [
+ AC_MSG_WARN(Libzip >= 1.0.0 needed for setting mtime)
+ ], [
+ $LIBZIP_LIBS
+ ])
+
PHP_CHECK_LIBRARY(zip, zip_file_set_encryption,
[
AC_DEFINE(HAVE_ENCRYPTION, 1, [Libzip >= 1.2.0 with encryption support])
@@ -26,6 +35,22 @@ if test "$PHP_ZIP" != "no"; then
$LIBZIP_LIBS
])
+ PHP_CHECK_LIBRARY(zip, zip_register_progress_callback_with_state,
+ [
+ AC_DEFINE(HAVE_PROGRESS_CALLBACK, 1, [Libzip >= 1.3.0 with zip_register_progress_callback_with_state function])
+ ], [
+ ], [
+ $LIBZIP_LIBS
+ ])
+
+ PHP_CHECK_LIBRARY(zip, zip_register_cancel_callback_with_state,
+ [
+ AC_DEFINE(HAVE_CANCEL_CALLBACK, 1, [Libzip >= 1.6.0 with zip_register_cancel_callback_with_state function])
+ ], [
+ ], [
+ $LIBZIP_LIBS
+ ])
+
AC_DEFINE(HAVE_ZIP,1,[ ])
PHP_ZIP_SOURCES="php_zip.c zip_stream.c"
diff --git a/ext/zip/config.w32 b/ext/zip/config.w32
index 034543fabd..ab7742e227 100644
--- a/ext/zip/config.w32
+++ b/ext/zip/config.w32
@@ -15,7 +15,7 @@ if (PHP_ZIP != "no") {
}
AC_DEFINE('HAVE_ZIP', 1);
- ADD_FLAG("CFLAGS_ZIP", "/D _WIN32 /D HAVE_ENCRYPTION /D HAVE_LIBZIP_VERSION");
+ ADD_FLAG("CFLAGS_ZIP", "/D _WIN32 /D HAVE_SET_MTIME /D HAVE_ENCRYPTION /D HAVE_LIBZIP_VERSION /D HAVE_PROGRESS_CALLBACK");
} else {
WARNING("zip not enabled; libraries and headers not found");
}
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c
index 22f9895ad8..eadbd0e76e 100644
--- a/ext/zip/php_zip.c
+++ b/ext/zip/php_zip.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -30,6 +28,7 @@
#include "ext/standard/php_filestat.h"
#include "zend_interfaces.h"
#include "php_zip.h"
+#include "php_zip_arginfo.h"
/* zip_open is a macro for renaming libzip zipopen, so we need to use PHP_NAMED_FUNCTION */
static PHP_NAMED_FUNCTION(zif_zip_open);
@@ -373,8 +372,8 @@ static int php_zip_parse_options(zval *options, zend_long *remove_all_path, char
ze_zip_object *obj = Z_ZIP_P(object); \
intern = obj->za; \
if (!intern) { \
- php_error_docref(NULL, E_WARNING, "Invalid or uninitialized Zip object"); \
- RETURN_FALSE; \
+ zend_value_error("Invalid or uninitialized Zip object"); \
+ RETURN_THROWS(); \
} \
}
/* }}} */
@@ -713,51 +712,6 @@ int php_zip_pcre(zend_string *regexp, char *path, int path_len, zval *return_val
}
/* }}} */
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_zip_open, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_zip_close, 0, 0, 1)
- ZEND_ARG_INFO(0, zip)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_zip_read, 0, 0, 1)
- ZEND_ARG_INFO(0, zip)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_zip_entry_open, 0, 0, 2)
- ZEND_ARG_INFO(0, zip_dp)
- ZEND_ARG_INFO(0, zip_entry)
- ZEND_ARG_INFO(0, mode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_zip_entry_close, 0, 0, 1)
- ZEND_ARG_INFO(0, zip_ent)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_zip_entry_read, 0, 0, 1)
- ZEND_ARG_INFO(0, zip_entry)
- ZEND_ARG_INFO(0, len)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_zip_entry_name, 0, 0, 1)
- ZEND_ARG_INFO(0, zip_entry)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_zip_entry_compressedsize, 0, 0, 1)
- ZEND_ARG_INFO(0, zip_entry)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_zip_entry_filesize, 0, 0, 1)
- ZEND_ARG_INFO(0, zip_entry)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_zip_entry_compressionmethod, 0, 0, 1)
- ZEND_ARG_INFO(0, zip_entry)
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ zend_function_entry */
static const zend_function_entry zip_functions[] = {
ZEND_RAW_FENTRY("zip_open", zif_zip_open, arginfo_zip_open, 0)
@@ -865,62 +819,36 @@ static zval *php_zip_property_reader(ze_zip_object *obj, zip_prop_handler *hnd,
}
/* }}} */
-static zval *php_zip_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) /* {{{ */
+static zval *php_zip_get_property_ptr_ptr(zend_object *object, zend_string *name, int type, void **cache_slot) /* {{{ */
{
ze_zip_object *obj;
- zval tmp_member;
zval *retval = NULL;
zip_prop_handler *hnd = NULL;
- if (Z_TYPE_P(member) != IS_STRING) {
- zend_string *str = zval_try_get_string_func(member);
- if (UNEXPECTED(!str)) {
- return NULL;
- }
- ZVAL_STR(&tmp_member, str);
- member = &tmp_member;
- cache_slot = NULL;
- }
-
- obj = Z_ZIP_P(object);
+ obj = php_zip_fetch_object(object);
if (obj->prop_handler != NULL) {
- hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member));
+ hnd = zend_hash_find_ptr(obj->prop_handler, name);
}
if (hnd == NULL) {
- retval = zend_std_get_property_ptr_ptr(object, member, type, cache_slot);
- }
-
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
+ retval = zend_std_get_property_ptr_ptr(object, name, type, cache_slot);
}
return retval;
}
/* }}} */
-static zval *php_zip_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) /* {{{ */
+static zval *php_zip_read_property(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv) /* {{{ */
{
ze_zip_object *obj;
- zval tmp_member;
zval *retval = NULL;
zip_prop_handler *hnd = NULL;
- if (Z_TYPE_P(member) != IS_STRING) {
- zend_string *str = zval_try_get_string_func(member);
- if (UNEXPECTED(!str)) {
- return &EG(uninitialized_zval);
- }
- ZVAL_STR(&tmp_member, str);
- member = &tmp_member;
- cache_slot = NULL;
- }
-
- obj = Z_ZIP_P(object);
+ obj = php_zip_fetch_object(object);
if (obj->prop_handler != NULL) {
- hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member));
+ hnd = zend_hash_find_ptr(obj->prop_handler, name);
}
if (hnd != NULL) {
@@ -929,38 +857,23 @@ static zval *php_zip_read_property(zval *object, zval *member, int type, void **
retval = &EG(uninitialized_zval);
}
} else {
- retval = zend_std_read_property(object, member, type, cache_slot, rv);
- }
-
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
+ retval = zend_std_read_property(object, name, type, cache_slot, rv);
}
return retval;
}
/* }}} */
-static int php_zip_has_property(zval *object, zval *member, int type, void **cache_slot) /* {{{ */
+static int php_zip_has_property(zend_object *object, zend_string *name, int type, void **cache_slot) /* {{{ */
{
ze_zip_object *obj;
- zval tmp_member;
zip_prop_handler *hnd = NULL;
int retval = 0;
- if (Z_TYPE_P(member) != IS_STRING) {
- zend_string *str = zval_try_get_string_func(member);
- if (UNEXPECTED(!str)) {
- return 0;
- }
- ZVAL_STR(&tmp_member, str);
- member = &tmp_member;
- cache_slot = NULL;
- }
-
- obj = Z_ZIP_P(object);
+ obj = php_zip_fetch_object(object);
if (obj->prop_handler != NULL) {
- hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member));
+ hnd = zend_hash_find_ptr(obj->prop_handler, name);
}
if (hnd != NULL) {
@@ -978,18 +891,14 @@ static int php_zip_has_property(zval *object, zval *member, int type, void **cac
zval_ptr_dtor(&tmp);
} else {
- retval = zend_std_has_property(object, member, type, cache_slot);
- }
-
- if (member == &tmp_member) {
- zval_ptr_dtor_str(&tmp_member);
+ retval = zend_std_has_property(object, name, type, cache_slot);
}
return retval;
}
/* }}} */
-static HashTable *php_zip_get_gc(zval *object, zval **gc_data, int *gc_data_count) /* {{{ */
+static HashTable *php_zip_get_gc(zend_object *object, zval **gc_data, int *gc_data_count) /* {{{ */
{
*gc_data = NULL;
*gc_data_count = 0;
@@ -997,14 +906,14 @@ static HashTable *php_zip_get_gc(zval *object, zval **gc_data, int *gc_data_coun
}
/* }}} */
-static HashTable *php_zip_get_properties(zval *object)/* {{{ */
+static HashTable *php_zip_get_properties(zend_object *object)/* {{{ */
{
ze_zip_object *obj;
HashTable *props;
zip_prop_handler *hnd;
zend_string *key;
- obj = Z_ZIP_P(object);
+ obj = php_zip_fetch_object(object);
props = zend_std_get_properties(object);
if (obj->prop_handler == NULL) {
@@ -1024,6 +933,30 @@ static HashTable *php_zip_get_properties(zval *object)/* {{{ */
}
/* }}} */
+#ifdef HAVE_PROGRESS_CALLBACK
+static void _php_zip_progress_callback_free(void *ptr)
+{
+ ze_zip_object *obj = ptr;
+
+ if (!Z_ISUNDEF(obj->progress_callback)) {
+ zval_ptr_dtor(&obj->progress_callback);
+ ZVAL_UNDEF(&obj->progress_callback);
+ }
+}
+#endif
+
+#ifdef HAVE_CANCEL_CALLBACK
+static void _php_zip_cancel_callback_free(void *ptr)
+{
+ ze_zip_object *obj = ptr;
+
+ if (!Z_ISUNDEF(obj->cancel_callback)) {
+ zval_ptr_dtor(&obj->cancel_callback);
+ ZVAL_UNDEF(&obj->cancel_callback);
+ }
+}
+#endif
+
static void php_zip_object_free_storage(zend_object *object) /* {{{ */
{
ze_zip_object * intern = php_zip_fetch_object(object);
@@ -1050,6 +983,16 @@ static void php_zip_object_free_storage(zend_object *object) /* {{{ */
efree(intern->buffers);
}
+#ifdef HAVE_PROGRESS_CALLBACK
+ /* if not properly called by libzip */
+ _php_zip_progress_callback_free(intern);
+#endif
+
+#ifdef HAVE_CANCEL_CALLBACK
+ /* if not properly called by libzip */
+ _php_zip_cancel_callback_free(intern);
+#endif
+
intern->za = NULL;
zend_object_std_dtor(&intern->zo);
@@ -1152,7 +1095,7 @@ static PHP_NAMED_FUNCTION(zif_zip_open)
zend_string *filename;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "P", &filename) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (ZSTR_LEN(filename) == 0) {
@@ -1191,11 +1134,11 @@ static PHP_NAMED_FUNCTION(zif_zip_close)
zip_rsrc *z_rsrc = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zip) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((z_rsrc = (zip_rsrc *)zend_fetch_resource(Z_RES_P(zip), le_zip_dir_name, le_zip_dir)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* really close the zip will break BC :-D */
@@ -1213,11 +1156,11 @@ static PHP_NAMED_FUNCTION(zif_zip_read)
zip_rsrc *rsrc_int;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zip_dp) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((rsrc_int = (zip_rsrc *)zend_fetch_resource(Z_RES_P(zip_dp), le_zip_dir_name, le_zip_dir)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (rsrc_int && rsrc_int->za) {
@@ -1262,15 +1205,15 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_open)
zip_rsrc *z_rsrc;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rr|s", &zip, &zip_entry, &mode, &mode_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((zr_rsrc = (zip_read_rsrc *)zend_fetch_resource(Z_RES_P(zip_entry), le_zip_entry_name, le_zip_entry)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if ((z_rsrc = (zip_rsrc *)zend_fetch_resource(Z_RES_P(zip), le_zip_dir_name, le_zip_dir)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (zr_rsrc->zf != NULL) {
@@ -1289,11 +1232,11 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_close)
zip_read_rsrc * zr_rsrc;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zip_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((zr_rsrc = (zip_read_rsrc *)zend_fetch_resource(Z_RES_P(zip_entry), le_zip_entry_name, le_zip_entry)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
RETURN_BOOL(SUCCESS == zend_list_close(Z_RES_P(zip_entry)));
@@ -1311,11 +1254,11 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
int n = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|l", &zip_entry, &len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((zr_rsrc = (zip_read_rsrc *)zend_fetch_resource(Z_RES_P(zip_entry), le_zip_entry_name, le_zip_entry)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (len <= 0) {
@@ -1331,7 +1274,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
RETURN_NEW_STR(buffer);
} else {
zend_string_efree(buffer);
- RETURN_EMPTY_STRING()
+ RETURN_EMPTY_STRING();
}
} else {
RETURN_FALSE;
@@ -1345,11 +1288,11 @@ static void php_zip_entry_get_info(INTERNAL_FUNCTION_PARAMETERS, int opt) /* {{{
zip_read_rsrc * zr_rsrc;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zip_entry) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if ((zr_rsrc = (zip_read_rsrc *)zend_fetch_resource(Z_RES_P(zip_entry), le_zip_entry_name, le_zip_entry)) == NULL) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (!zr_rsrc->zf) {
@@ -1439,7 +1382,7 @@ static ZIPARCHIVE_METHOD(open)
ze_zip_object *ze_obj;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "P|l", &filename, &flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
/* We do not use ZIP_FROM_OBJECT, zip init function here */
@@ -1496,7 +1439,7 @@ static ZIPARCHIVE_METHOD(setPassword)
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &password, &password_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (password_len < 1) {
@@ -1521,6 +1464,10 @@ static ZIPARCHIVE_METHOD(close)
ze_zip_object *ze_obj;
int err;
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
ZIP_FROM_OBJECT(intern, self);
ze_obj = Z_ZIP_P(self);
@@ -1555,6 +1502,10 @@ static ZIPARCHIVE_METHOD(count)
zval *self = ZEND_THIS;
zip_int64_t num;
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
ZIP_FROM_OBJECT(intern, self);
num = zip_get_num_entries(intern, 0);
@@ -1575,6 +1526,10 @@ static ZIPARCHIVE_METHOD(getStatusString)
zip_error_t *err;
#endif
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
ZIP_FROM_OBJECT(intern, self);
#if LIBZIP_VERSION_MAJOR < 1
@@ -1606,7 +1561,7 @@ static ZIPARCHIVE_METHOD(addEmptyDir)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",
&dirname, &dirname_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (dirname_len<1) {
@@ -1659,12 +1614,12 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /*
if (type == 1) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "P|la",
&pattern, &flags, &options) == FAILURE) {
- return;
+ RETURN_THROWS();
}
} else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "P|sa",
&pattern, &path, &path_len, &options) == FAILURE) {
- return;
+ RETURN_THROWS();
}
}
@@ -1682,6 +1637,7 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /*
size_t real_len = strlen(remove_path);
if ((real_len > 1) && ((remove_path[real_len - 1] == '/') || (remove_path[real_len - 1] == '\\'))) {
remove_path = estrndup(remove_path, real_len - 1);
+ remove_path_len -= 1;
}
}
@@ -1707,8 +1663,8 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /*
file_stripped = ZSTR_VAL(basename);
file_stripped_len = ZSTR_LEN(basename);
} else if (remove_path && strstr(Z_STRVAL_P(zval_file), remove_path) != NULL) {
- file_stripped = Z_STRVAL_P(zval_file) + remove_path_len + 1;
- file_stripped_len = Z_STRLEN_P(zval_file) - remove_path_len - 1;
+ file_stripped = Z_STRVAL_P(zval_file) + remove_path_len;
+ file_stripped_len = Z_STRLEN_P(zval_file) - remove_path_len;
} else {
file_stripped = Z_STRVAL_P(zval_file);
file_stripped_len = Z_STRLEN_P(zval_file);
@@ -1778,7 +1734,7 @@ static ZIPARCHIVE_METHOD(addFile)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "P|sll",
&filename, &entry_name, &entry_name_len, &offset_start, &offset_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (ZSTR_LEN(filename) == 0) {
@@ -1817,7 +1773,7 @@ static ZIPARCHIVE_METHOD(addFromString)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sS",
&name, &name_len, &buffer) == FAILURE) {
- return;
+ RETURN_THROWS();
}
ze_obj = Z_ZIP_P(self);
@@ -1870,7 +1826,7 @@ static ZIPARCHIVE_METHOD(statName)
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "P|l", &name, &flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
PHP_ZIP_STAT_PATH(intern, ZSTR_VAL(name), ZSTR_LEN(name), flags, sb);
@@ -1893,7 +1849,7 @@ static ZIPARCHIVE_METHOD(statIndex)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l",
&index, &flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (zip_stat_index(intern, index, flags, &sb) != 0) {
@@ -1916,7 +1872,7 @@ static ZIPARCHIVE_METHOD(locateName)
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "P|l", &name, &flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (ZSTR_LEN(name) < 1) {
@@ -1946,7 +1902,7 @@ static ZIPARCHIVE_METHOD(getNameIndex)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l",
&index, &flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
name = zip_get_name(intern, (int) index, flags);
@@ -1971,7 +1927,7 @@ static ZIPARCHIVE_METHOD(setArchiveComment)
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &comment, &comment_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (comment_len > 0xffff) {
@@ -2000,7 +1956,7 @@ static ZIPARCHIVE_METHOD(getArchiveComment)
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
comment = zip_get_archive_comment(intern, &comment_len, (int)flags);
@@ -2025,7 +1981,7 @@ static ZIPARCHIVE_METHOD(setCommentName)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss",
&name, &name_len, &comment, &comment_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (name_len < 1) {
@@ -2060,7 +2016,7 @@ static ZIPARCHIVE_METHOD(setCommentIndex)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls",
&index, &comment, &comment_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (comment_len > 0xffff) {
@@ -2091,7 +2047,7 @@ static ZIPARCHIVE_METHOD(setExternalAttributesName)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sll|l",
&name, &name_len, &opsys, &attr, &flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (name_len < 1) {
@@ -2123,7 +2079,7 @@ static ZIPARCHIVE_METHOD(setExternalAttributesIndex)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lll|l",
&index, &opsys, &attr, &flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
PHP_ZIP_STAT_INDEX(intern, index, 0, sb);
@@ -2152,7 +2108,7 @@ static ZIPARCHIVE_METHOD(getExternalAttributesName)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "szz|l",
&name, &name_len, &z_opsys, &z_attr, &flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (name_len < 1) {
@@ -2188,7 +2144,7 @@ static ZIPARCHIVE_METHOD(getExternalAttributesIndex)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lzz|l",
&index, &z_opsys, &z_attr, &flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
PHP_ZIP_STAT_INDEX(intern, index, 0, sb);
@@ -2219,7 +2175,7 @@ static ZIPARCHIVE_METHOD(setEncryptionName)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl|s",
&name, &name_len, &method, &password, &password_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (name_len < 1) {
@@ -2252,7 +2208,7 @@ static ZIPARCHIVE_METHOD(setEncryptionIndex)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll|s",
&index, &method, &password, &password_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (zip_file_set_encryption(intern, index, (zip_uint16_t)method, password)) {
@@ -2280,7 +2236,7 @@ static ZIPARCHIVE_METHOD(getCommentName)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|l",
&name, &name_len, &flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (name_len < 1) {
php_error_docref(NULL, E_NOTICE, "Empty string as entry name");
@@ -2312,7 +2268,7 @@ static ZIPARCHIVE_METHOD(getCommentIndex)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l",
&index, &flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
PHP_ZIP_STAT_INDEX(intern, index, 0, sb);
@@ -2336,7 +2292,7 @@ static ZIPARCHIVE_METHOD(setCompressionName)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl|l",
&name, &name_len, &comp_method, &comp_flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (name_len < 1) {
@@ -2369,7 +2325,7 @@ static ZIPARCHIVE_METHOD(setCompressionIndex)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll|l",
&index, &comp_method, &comp_flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (zip_set_file_compression(intern, (zip_uint64_t)index,
@@ -2380,6 +2336,67 @@ static ZIPARCHIVE_METHOD(setCompressionIndex)
}
/* }}} */
+#ifdef HAVE_SET_MTIME
+/* {{{ proto bool ZipArchive::setMtimeName(string name, int timestamp[, int flags])
+Set the modification time of a file in zip, using its name */
+static ZIPARCHIVE_METHOD(setMtimeName)
+ {
+ struct zip *intern;
+ zval *this = ZEND_THIS;
+ size_t name_len;
+ char *name;
+ zip_int64_t idx;
+ zend_long mtime, flags = 0;
+
+ ZIP_FROM_OBJECT(intern, this);
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl|l",
+ &name, &name_len, &mtime, &flags) == FAILURE) {
+ return;
+ }
+
+ if (name_len < 1) {
+ php_error_docref(NULL, E_NOTICE, "Empty string as entry name");
+ }
+
+ idx = zip_name_locate(intern, name, 0);
+ if (idx < 0) {
+ RETURN_FALSE;
+ }
+
+ if (zip_file_set_mtime(intern, (zip_uint64_t)idx,
+ (time_t)mtime, (zip_uint32_t)flags) != 0) {
+ RETURN_FALSE;
+ }
+ RETURN_TRUE;
+}
+/* }}} */
+
+/* {{{ proto bool ZipArchive::setMtimeIndex(int index, int timestamp[, int flags])
+Set the modification time of a file in zip, using its index */
+static ZIPARCHIVE_METHOD(setMtimeIndex)
+{
+ struct zip *intern;
+ zval *this = ZEND_THIS;
+ zend_long index;
+ zend_long mtime, flags = 0;
+
+ ZIP_FROM_OBJECT(intern, this);
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll|l",
+ &index, &mtime, &flags) == FAILURE) {
+ return;
+ }
+
+ if (zip_file_set_mtime(intern, (zip_uint64_t)index,
+ (time_t)mtime, (zip_uint32_t)flags) != 0) {
+ RETURN_FALSE;
+ }
+ RETURN_TRUE;
+}
+/* }}} */
+#endif
+
/* {{{ proto bool ZipArchive::deleteIndex(int index)
Delete a file using its index */
static ZIPARCHIVE_METHOD(deleteIndex)
@@ -2391,7 +2408,7 @@ static ZIPARCHIVE_METHOD(deleteIndex)
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &index) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (index < 0) {
@@ -2419,7 +2436,7 @@ static ZIPARCHIVE_METHOD(deleteName)
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (name_len < 1) {
RETURN_FALSE;
@@ -2447,7 +2464,7 @@ static ZIPARCHIVE_METHOD(renameIndex)
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &index, &new_name, &new_name_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (index < 0) {
@@ -2478,7 +2495,7 @@ static ZIPARCHIVE_METHOD(renameName)
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &name, &name_len, &new_name, &new_name_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (new_name_len < 1) {
@@ -2506,7 +2523,7 @@ static ZIPARCHIVE_METHOD(unchangeIndex)
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &index) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (index < 0) {
@@ -2534,7 +2551,7 @@ static ZIPARCHIVE_METHOD(unchangeName)
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (name_len < 1) {
@@ -2558,6 +2575,10 @@ static ZIPARCHIVE_METHOD(unchangeAll)
struct zip *intern;
zval *self = ZEND_THIS;
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
ZIP_FROM_OBJECT(intern, self);
if (zip_unchange_all(intern) != 0) {
@@ -2575,6 +2596,10 @@ static ZIPARCHIVE_METHOD(unchangeArchive)
struct zip *intern;
zval *self = ZEND_THIS;
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
ZIP_FROM_OBJECT(intern, self);
if (zip_unchange_archive(intern) != 0) {
@@ -2605,7 +2630,7 @@ static ZIPARCHIVE_METHOD(extractTo)
int ret;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|z", &pathto, &pathto_len, &zval_files) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (pathto_len < 1) {
@@ -2694,12 +2719,12 @@ static void php_zip_get_from(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */
if (type == 1) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "P|ll", &filename, &len, &flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
PHP_ZIP_STAT_PATH(intern, ZSTR_VAL(filename), ZSTR_LEN(filename), flags, sb);
} else {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|ll", &index, &len, &flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
PHP_ZIP_STAT_INDEX(intern, index, 0, sb);
}
@@ -2766,7 +2791,7 @@ static ZIPARCHIVE_METHOD(getStream)
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "P", &filename) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (zip_stat(intern, ZSTR_VAL(filename), 0, &sb) != 0) {
@@ -2784,227 +2809,178 @@ static ZIPARCHIVE_METHOD(getStream)
}
/* }}} */
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_open, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_setpassword, 0, 0, 1)
- ZEND_ARG_INFO(0, password)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_ziparchive__void, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_addemptydir, 0, 0, 1)
- ZEND_ARG_INFO(0, dirname)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_addglob, 0, 0, 1)
- ZEND_ARG_INFO(0, pattern)
- ZEND_ARG_INFO(0, flags)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_addpattern, 0, 0, 1)
- ZEND_ARG_INFO(0, pattern)
- ZEND_ARG_INFO(0, path)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_addfile, 0, 0, 1)
- ZEND_ARG_INFO(0, filepath)
- ZEND_ARG_INFO(0, entryname)
- ZEND_ARG_INFO(0, start)
- ZEND_ARG_INFO(0, length)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_addfromstring, 0, 0, 2)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, content)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_statname, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_statindex, 0, 0, 1)
- ZEND_ARG_INFO(0, index)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_setarchivecomment, 0, 0, 1)
- ZEND_ARG_INFO(0, comment)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_setcommentindex, 0, 0, 2)
- ZEND_ARG_INFO(0, index)
- ZEND_ARG_INFO(0, comment)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_getcommentname, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_getcommentindex, 0, 0, 1)
- ZEND_ARG_INFO(0, index)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_renameindex, 0, 0, 2)
- ZEND_ARG_INFO(0, index)
- ZEND_ARG_INFO(0, new_name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_renamename, 0, 0, 2)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, new_name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_unchangeindex, 0, 0, 1)
- ZEND_ARG_INFO(0, index)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_unchangename, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_extractto, 0, 0, 1)
- ZEND_ARG_INFO(0, pathto)
- ZEND_ARG_INFO(0, files)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_getfromname, 0, 0, 1)
- ZEND_ARG_INFO(0, entryname)
- ZEND_ARG_INFO(0, len)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_getfromindex, 0, 0, 1)
- ZEND_ARG_INFO(0, index)
- ZEND_ARG_INFO(0, len)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_getarchivecomment, 0, 0, 0)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_setcommentname, 0, 0, 2)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, comment)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_getstream, 0, 0, 1)
- ZEND_ARG_INFO(0, entryname)
-ZEND_END_ARG_INFO()
+#ifdef HAVE_PROGRESS_CALLBACK
+static void _php_zip_progress_callback(zip_t *arch, double state, void *ptr)
+{
+ zval cb_args[1];
+ zval cb_retval;
+ ze_zip_object *obj = ptr;
+
+ ZVAL_DOUBLE(&cb_args[0], state);
+ if (call_user_function_ex(EG(function_table), NULL, &obj->progress_callback, &cb_retval, 1, cb_args, 0, NULL) == SUCCESS && !Z_ISUNDEF(cb_retval)) {
+ zval_ptr_dtor(&cb_retval);
+ }
+}
-#ifdef ZIP_OPSYS_DEFAULT
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_setextattrname, 0, 0, 3)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, opsys)
- ZEND_ARG_INFO(0, attr)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_setextattrindex, 0, 0, 3)
- ZEND_ARG_INFO(0, index)
- ZEND_ARG_INFO(0, opsys)
- ZEND_ARG_INFO(0, attr)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_getextattrname, 0, 0, 3)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(1, opsys)
- ZEND_ARG_INFO(1, attr)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_getextattrindex, 0, 0, 3)
- ZEND_ARG_INFO(0, index)
- ZEND_ARG_INFO(1, opsys)
- ZEND_ARG_INFO(1, attr)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-#endif /* ifdef ZIP_OPSYS_DEFAULT */
-/* }}} */
+/* {{{ proto bool ZipArchive::registerProgressCallback(double rate, callable callback)
+register a progression callback: void callback(double state); */
+static ZIPARCHIVE_METHOD(registerProgressCallback)
+{
+ struct zip *intern;
+ zval *self = getThis();
+ double rate;
+ zval *callback;
+ ze_zip_object *obj;
-#ifdef HAVE_ENCRYPTION
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_setencryption_name, 0, 0, 2)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, method)
- ZEND_ARG_INFO(0, password)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_setencryption_index, 0, 0, 2)
- ZEND_ARG_INFO(0, index)
- ZEND_ARG_INFO(0, method)
- ZEND_ARG_INFO(0, password)
-ZEND_END_ARG_INFO()
+ if (!self) {
+ RETURN_FALSE;
+ }
+
+ ZIP_FROM_OBJECT(intern, self);
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "dz", &rate, &callback) == FAILURE) {
+ return;
+ }
+
+ /* callable? */
+ if (!zend_is_callable(callback, 0, NULL)) {
+ zend_string *callback_name = zend_get_callable_name(callback);
+ php_error_docref(NULL, E_WARNING, "Invalid callback '%s'", ZSTR_VAL(callback_name));
+ zend_string_release_ex(callback_name, 0);
+ RETURN_FALSE;
+ }
+
+ obj = Z_ZIP_P(self);
+
+ /* free if called twice */
+ _php_zip_progress_callback_free(obj);
+
+ /* register */
+ ZVAL_COPY(&obj->progress_callback, callback);
+ if (zip_register_progress_callback_with_state(intern, rate, _php_zip_progress_callback, _php_zip_progress_callback_free, obj)) {
+ RETURN_FALSE;
+ }
+
+ RETURN_TRUE;
+}
+/* }}} */
#endif
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_setcompname, 0, 0, 2)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, method)
- ZEND_ARG_INFO(0, compflags)
-ZEND_END_ARG_INFO()
+#ifdef HAVE_CANCEL_CALLBACK
+static int _php_zip_cancel_callback(zip_t *arch, void *ptr)
+{
+ zval cb_retval;
+ int retval = 0;
+ ze_zip_object *obj = ptr;
+
+ if (call_user_function_ex(EG(function_table), NULL, &obj->cancel_callback, &cb_retval, 0, NULL, 0, NULL) == SUCCESS && !Z_ISUNDEF(cb_retval)) {
+ retval = zval_get_long(&cb_retval);
+ zval_ptr_dtor(&cb_retval);
+ }
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ziparchive_setcompindex, 0, 0, 2)
- ZEND_ARG_INFO(0, index)
- ZEND_ARG_INFO(0, method)
- ZEND_ARG_INFO(0, compflags)
-ZEND_END_ARG_INFO()
+ return retval;
+}
+
+/* {{{ proto bool ZipArchive::registerCancelCallback(callable callback)
+register a progression callback: int callback(double state); */
+static ZIPARCHIVE_METHOD(registerCancelCallback)
+{
+ struct zip *intern;
+ zval *self = getThis();
+ zval *callback;
+ ze_zip_object *obj;
+
+ if (!self) {
+ RETURN_FALSE;
+ }
+
+ ZIP_FROM_OBJECT(intern, self);
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &callback) == FAILURE) {
+ return;
+ }
+
+ /* callable? */
+ if (!zend_is_callable(callback, 0, NULL)) {
+ zend_string *callback_name = zend_get_callable_name(callback);
+ php_error_docref(NULL, E_WARNING, "Invalid callback '%s'", ZSTR_VAL(callback_name));
+ zend_string_release_ex(callback_name, 0);
+ RETURN_FALSE;
+ }
+
+ obj = Z_ZIP_P(self);
+
+ /* free if called twice */
+ _php_zip_cancel_callback_free(obj);
+
+ /* register */
+ ZVAL_COPY(&obj->cancel_callback, callback);
+ if (zip_register_cancel_callback_with_state(intern, _php_zip_cancel_callback, _php_zip_cancel_callback_free, obj)) {
+ RETURN_FALSE;
+ }
+
+ RETURN_TRUE;
+}
+/* }}} */
+#endif
/* {{{ ze_zip_object_class_functions */
static const zend_function_entry zip_class_functions[] = {
- ZIPARCHIVE_ME(open, arginfo_ziparchive_open, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(setPassword, arginfo_ziparchive_setpassword, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(close, arginfo_ziparchive__void, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(count, arginfo_ziparchive__void, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(getStatusString, arginfo_ziparchive__void, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(addEmptyDir, arginfo_ziparchive_addemptydir, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(addFromString, arginfo_ziparchive_addfromstring, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(addFile, arginfo_ziparchive_addfile, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(addGlob, arginfo_ziparchive_addglob, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(addPattern, arginfo_ziparchive_addpattern, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(renameIndex, arginfo_ziparchive_renameindex, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(renameName, arginfo_ziparchive_renamename, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(setArchiveComment, arginfo_ziparchive_setarchivecomment, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(getArchiveComment, arginfo_ziparchive_getarchivecomment, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(setCommentIndex, arginfo_ziparchive_setcommentindex, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(setCommentName, arginfo_ziparchive_setcommentname, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(getCommentIndex, arginfo_ziparchive_getcommentindex, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(getCommentName, arginfo_ziparchive_getcommentname, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(deleteIndex, arginfo_ziparchive_unchangeindex, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(deleteName, arginfo_ziparchive_unchangename, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(statName, arginfo_ziparchive_statname, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(statIndex, arginfo_ziparchive_statindex, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(locateName, arginfo_ziparchive_statname, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(getNameIndex, arginfo_ziparchive_statindex, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(unchangeArchive, arginfo_ziparchive__void, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(unchangeAll, arginfo_ziparchive__void, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(unchangeIndex, arginfo_ziparchive_unchangeindex, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(unchangeName, arginfo_ziparchive_unchangename, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(extractTo, arginfo_ziparchive_extractto, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(getFromName, arginfo_ziparchive_getfromname, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(getFromIndex, arginfo_ziparchive_getfromindex, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(getStream, arginfo_ziparchive_getstream, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(open, arginfo_class_ZipArchive_open, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(setPassword, arginfo_class_ZipArchive_setPassword, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(close, arginfo_class_ZipArchive_close, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(count, arginfo_class_ZipArchive_count, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(getStatusString, arginfo_class_ZipArchive_getStatusString, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(addEmptyDir, arginfo_class_ZipArchive_addEmptyDir, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(addFromString, arginfo_class_ZipArchive_addFromString, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(addFile, arginfo_class_ZipArchive_addFile, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(addGlob, arginfo_class_ZipArchive_addGlob, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(addPattern, arginfo_class_ZipArchive_addPattern, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(renameIndex, arginfo_class_ZipArchive_renameIndex, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(renameName, arginfo_class_ZipArchive_renameName, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(setArchiveComment, arginfo_class_ZipArchive_setArchiveComment, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(getArchiveComment, arginfo_class_ZipArchive_getArchiveComment, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(setCommentIndex, arginfo_class_ZipArchive_setCommentIndex, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(setCommentName, arginfo_class_ZipArchive_setCommentName, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(getCommentIndex, arginfo_class_ZipArchive_getCommentIndex, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(getCommentName, arginfo_class_ZipArchive_getCommentName, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(deleteIndex, arginfo_class_ZipArchive_deleteIndex, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(deleteName, arginfo_class_ZipArchive_deleteName, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(statName, arginfo_class_ZipArchive_statName, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(statIndex, arginfo_class_ZipArchive_statIndex, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(locateName, arginfo_class_ZipArchive_locateName, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(getNameIndex, arginfo_class_ZipArchive_getNameIndex, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(unchangeArchive, arginfo_class_ZipArchive_unchangeArchive, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(unchangeAll, arginfo_class_ZipArchive_unchangeAll, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(unchangeIndex, arginfo_class_ZipArchive_unchangeIndex, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(unchangeName, arginfo_class_ZipArchive_unchangeName, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(extractTo, arginfo_class_ZipArchive_extractTo, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(getFromName, arginfo_class_ZipArchive_getFromName, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(getFromIndex, arginfo_class_ZipArchive_getFromIndex, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(getStream, arginfo_class_ZipArchive_getStream, ZEND_ACC_PUBLIC)
#ifdef ZIP_OPSYS_DEFAULT
- ZIPARCHIVE_ME(setExternalAttributesName, arginfo_ziparchive_setextattrname, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(setExternalAttributesIndex, arginfo_ziparchive_setextattrindex, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(getExternalAttributesName, arginfo_ziparchive_getextattrname, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(getExternalAttributesIndex, arginfo_ziparchive_getextattrindex, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(setExternalAttributesName, arginfo_class_ZipArchive_setExternalAttributesName, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(setExternalAttributesIndex, arginfo_class_ZipArchive_setExternalAttributesIndex, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(getExternalAttributesName, arginfo_class_ZipArchive_getExternalAttributesName, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(getExternalAttributesIndex, arginfo_class_ZipArchive_getExternalAttributesIndex, ZEND_ACC_PUBLIC)
+#endif
+ ZIPARCHIVE_ME(setCompressionName, arginfo_class_ZipArchive_setCompressionName, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(setCompressionIndex, arginfo_class_ZipArchive_setCompressionIndex, ZEND_ACC_PUBLIC)
+#ifdef HAVE_SET_MTIME
+ ZIPARCHIVE_ME(setMtimeName, arginfo_class_ZipArchive_setMtimeName, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(setMtimeIndex, arginfo_class_ZipArchive_setMtimeIndex, ZEND_ACC_PUBLIC)
#endif
- ZIPARCHIVE_ME(setCompressionName, arginfo_ziparchive_setcompname, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(setCompressionIndex, arginfo_ziparchive_setcompindex, ZEND_ACC_PUBLIC)
#ifdef HAVE_ENCRYPTION
- ZIPARCHIVE_ME(setEncryptionName, arginfo_ziparchive_setencryption_name, ZEND_ACC_PUBLIC)
- ZIPARCHIVE_ME(setEncryptionIndex, arginfo_ziparchive_setencryption_index, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(setEncryptionName, arginfo_class_ZipArchive_setEncryptionName, ZEND_ACC_PUBLIC)
+ ZIPARCHIVE_ME(setEncryptionIndex, arginfo_class_ZipArchive_setEncryptionIndex, ZEND_ACC_PUBLIC)
#endif
+#ifdef HAVE_PROGRESS_CALLBACK
+ ZIPARCHIVE_ME(registerProgressCallback, arginfo_class_ZipArchive_registerProgressCallback, ZEND_ACC_PUBLIC)
+#endif
+#ifdef HAVE_CANCEL_CALLBACK
+ ZIPARCHIVE_ME(registerCancelCallback, arginfo_class_ZipArchive_registerCancelCallback, ZEND_ACC_PUBLIC)
+#endif
+
PHP_FE_END
};
/* }}} */
diff --git a/ext/zip/php_zip.h b/ext/zip/php_zip.h
index 7caf65f006..654d6d2a32 100644
--- a/ext/zip/php_zip.h
+++ b/ext/zip/php_zip.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -33,7 +31,7 @@ extern zend_module_entry zip_module_entry;
#define ZIP_OVERWRITE ZIP_TRUNCATE
#endif
-#define PHP_ZIP_VERSION "1.15.6"
+#define PHP_ZIP_VERSION "1.17.1"
#define ZIP_OPENBASEDIR_CHECKPATH(filename) php_check_open_basedir(filename)
@@ -62,6 +60,12 @@ typedef struct _ze_zip_object {
int filename_len;
int buffers_cnt;
zend_object zo;
+#ifdef HAVE_PROGRESS_CALLBACK
+ zval progress_callback;
+#endif
+#ifdef HAVE_CANCEL_CALLBACK
+ zval cancel_callback;
+#endif
} ze_zip_object;
static inline ze_zip_object *php_zip_fetch_object(zend_object *obj) {
diff --git a/ext/zip/php_zip.stub.php b/ext/zip/php_zip.stub.php
new file mode 100644
index 0000000000..3e49c46413
--- /dev/null
+++ b/ext/zip/php_zip.stub.php
@@ -0,0 +1,186 @@
+<?php
+
+/** @return resource|int|false */
+function zip_open(string $filename) {}
+
+/**
+ * @param resource $zip
+ */
+function zip_close($zip): void {}
+
+/**
+ * @param resource $zip
+ * @return resource|false
+ */
+function zip_read($zip) {}
+
+/**
+ * @param resource $zip_dp
+ * @param resource $zip_entry
+ */
+function zip_entry_open($zip_dp, $zip_entry, string $mode = 'rb'): bool {}
+
+/**
+ * @param resource $zip_ent
+ */
+function zip_entry_close($zip_ent): bool {}
+
+/** @param resource $zip_entry */
+function zip_entry_read($zip_entry, int $len = 1024): string|false {}
+
+/** @param resource $zip_entry */
+function zip_entry_name($zip_entry): string|false {}
+
+/** @param resource $zip_entry */
+function zip_entry_compressedsize($zip_entry): int|false {}
+
+/** @param resource $zip_entry */
+function zip_entry_filesize($zip_entry): int|false {}
+
+/** @param resource $zip_entry */
+function zip_entry_compressionmethod($zip_entry): string|false {}
+
+class ZipArchive
+{
+ /** @return bool|int */
+ public function open(string $filename, int $flags = 0) {}
+
+ /** @return bool */
+ public function setPassword(string $password) {}
+
+ /** @return bool */
+ public function close() {}
+
+ /** @return int */
+ public function count() {}
+
+ /** @return string */
+ public function getStatusString() {}
+
+ /** @return bool */
+ public function addEmptyDir(string $dirname) {}
+
+ /** @return bool */
+ public function addFromString(string $name, string $content) {}
+
+ /** @return bool */
+ public function addFile(string $filepath, string $entryname = UNKNOWN, int $start = 0, int $length = 0) {}
+
+ /** @return array|false */
+ public function addGlob(string $pattern, int $flags = 0, $options = UNKNOWN) {}
+
+ /** @return array|false */
+ public function addPattern(string $pattern, string $path = UNKNOWN, $options = UNKNOWN) {}
+
+ /** @return bool */
+ public function renameIndex(int $index, string $new_name) {}
+
+ /** @return bool */
+ public function renameName(string $name, string $new_name) {}
+
+ /** @return bool */
+ public function setArchiveComment(string $comment) {}
+
+ /** @return string|false */
+ public function getArchiveComment(int $flags = 0) {}
+
+ /** @return null|false */
+ public function setCommentIndex(int $index, string $comment) {}
+
+ /** @return null|false */
+ public function setCommentName(string $name, string $comment) {}
+
+#ifdef HAVE_SET_MTIME
+ /** @return null|false */
+ public function setMtimeIndex(int $index, int $timestamp, int $flags = 0) {}
+
+ /** @return null|false */
+ public function setMtimeName(string $name, int $timestamp, int $flags = 0) {}
+#endif
+
+ /** @return string|false */
+ public function getCommentIndex(int $index, int $flags = 0) {}
+
+ /** @return string|false */
+ public function getCommentName(string $name, int $flags = 0) {}
+
+ /** @return bool */
+ public function deleteIndex(int $index) {}
+
+ /** @return bool */
+ public function deleteName(string $name) {}
+
+ /** @return array|false */
+ public function statName(string $filename, int $flags = 0) {}
+
+ /** @return array|false */
+ public function statIndex(int $index, int $flags = 0) {}
+
+ /** @return int|false */
+ public function locateName(string $filename, int $flags = 0) {}
+
+ /** @return string|false */
+ public function getNameIndex(int $index, int $flags = 0) {}
+
+ /** @return bool */
+ public function unchangeArchive() {}
+
+ /** @return bool */
+ public function unchangeAll() {}
+
+ /** @return bool */
+ public function unchangeIndex(int $index) {}
+
+ /** @return bool */
+ public function unchangeName(string $name) {}
+
+ /** @return bool */
+ public function extractTo(string $pathto, $files = UNKNOWN) {}
+
+ /** @return string|false */
+ public function getFromName(string $entryname, int $len = 0, int $flags = 0) {}
+
+ /** @return string|false */
+ public function getFromIndex(int $index, int $len = 0, int $flags = 0) {}
+
+ /** @return resource|false */
+ public function getStream(string $entryname) {}
+
+#ifdef ZIP_OPSYS_DEFAULT
+ /** @return bool */
+ public function setExternalAttributesName(string $name, int $opsys, int $attr, int $flags = 0) {}
+
+ /** @return bool */
+ public function setExternalAttributesIndex(int $index, int $opsys, int $attr, int $flags = 0) {}
+
+ /** @return bool */
+ public function getExternalAttributesName(string $name, &$opsys, &$attr, int $flags = 0) {}
+
+ /** @return bool */
+ public function getExternalAttributesIndex(int $index, &$opsys, &$attr, int $flags = 0) {}
+#endif
+
+ /** @return bool */
+ public function setCompressionName(string $name, int $method, int $compflags = 0) {}
+
+ /** @return bool */
+ public function setCompressionIndex(int $index, int $method, int $compflags = 0) {}
+
+#ifdef HAVE_ENCRYPTION
+ /** @return bool */
+ public function setEncryptionName(string $name, int $method, string $password = UNKNOWN) {}
+
+ /** @return bool */
+ public function setEncryptionIndex(int $index, int $method, string $password = UNKNOWN) {}
+#endif
+
+#ifdef HAVE_PROGRESS_CALLBACK
+ /** @return bool */
+ public function registerProgressCallback(float $rate, callable $callback) {}
+#endif
+
+#ifdef HAVE_CANCEL_CALLBACK
+ /** @return bool */
+ public function registerCancelCallback(callable $callback) {}
+#endif
+}
diff --git a/ext/zip/php_zip_arginfo.h b/ext/zip/php_zip_arginfo.h
new file mode 100644
index 0000000000..2f788d8c30
--- /dev/null
+++ b/ext/zip/php_zip_arginfo.h
@@ -0,0 +1,260 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_zip_open, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zip_close, 0, 1, IS_VOID, 0)
+ ZEND_ARG_INFO(0, zip)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_zip_read, 0, 0, 1)
+ ZEND_ARG_INFO(0, zip)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zip_entry_open, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, zip_dp)
+ ZEND_ARG_INFO(0, zip_entry)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zip_entry_close, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, zip_ent)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_zip_entry_read, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, zip_entry)
+ ZEND_ARG_TYPE_INFO(0, len, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_zip_entry_name, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, zip_entry)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_zip_entry_compressedsize, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, zip_entry)
+ZEND_END_ARG_INFO()
+
+#define arginfo_zip_entry_filesize arginfo_zip_entry_compressedsize
+
+#define arginfo_zip_entry_compressionmethod arginfo_zip_entry_name
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_open, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_setPassword, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_close, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ZipArchive_count arginfo_class_ZipArchive_close
+
+#define arginfo_class_ZipArchive_getStatusString arginfo_class_ZipArchive_close
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_addEmptyDir, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, dirname, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_addFromString, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, content, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_addFile, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, filepath, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, entryname, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, start, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_addGlob, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ ZEND_ARG_INFO(0, options)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_addPattern, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
+ ZEND_ARG_INFO(0, options)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_renameIndex, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, new_name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_renameName, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, new_name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_setArchiveComment, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, comment, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_getArchiveComment, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_setCommentIndex, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, comment, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_setCommentName, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, comment, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_SET_MTIME)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_setMtimeIndex, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, timestamp, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_SET_MTIME)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_setMtimeName, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, timestamp, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_getCommentIndex, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_getCommentName, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_deleteIndex, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_deleteName, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_ZipArchive_statName arginfo_class_ZipArchive_open
+
+#define arginfo_class_ZipArchive_statIndex arginfo_class_ZipArchive_getCommentIndex
+
+#define arginfo_class_ZipArchive_locateName arginfo_class_ZipArchive_open
+
+#define arginfo_class_ZipArchive_getNameIndex arginfo_class_ZipArchive_getCommentIndex
+
+#define arginfo_class_ZipArchive_unchangeArchive arginfo_class_ZipArchive_close
+
+#define arginfo_class_ZipArchive_unchangeAll arginfo_class_ZipArchive_close
+
+#define arginfo_class_ZipArchive_unchangeIndex arginfo_class_ZipArchive_deleteIndex
+
+#define arginfo_class_ZipArchive_unchangeName arginfo_class_ZipArchive_deleteName
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_extractTo, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, pathto, IS_STRING, 0)
+ ZEND_ARG_INFO(0, files)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_getFromName, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, entryname, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, len, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_getFromIndex, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, len, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_getStream, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, entryname, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(ZIP_OPSYS_DEFAULT)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_setExternalAttributesName, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, opsys, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, attr, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(ZIP_OPSYS_DEFAULT)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_setExternalAttributesIndex, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, opsys, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, attr, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(ZIP_OPSYS_DEFAULT)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_getExternalAttributesName, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_INFO(1, opsys)
+ ZEND_ARG_INFO(1, attr)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(ZIP_OPSYS_DEFAULT)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_getExternalAttributesIndex, 0, 0, 3)
+ ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
+ ZEND_ARG_INFO(1, opsys)
+ ZEND_ARG_INFO(1, attr)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_setCompressionName, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, method, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, compflags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_setCompressionIndex, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, method, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, compflags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#if defined(HAVE_ENCRYPTION)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_setEncryptionName, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, method, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_ENCRYPTION)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_setEncryptionIndex, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, method, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_PROGRESS_CALLBACK)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_registerProgressCallback, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, rate, IS_DOUBLE, 0)
+ ZEND_ARG_TYPE_INFO(0, callback, IS_CALLABLE, 0)
+ZEND_END_ARG_INFO()
+#endif
+
+#if defined(HAVE_CANCEL_CALLBACK)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_registerCancelCallback, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, callback, IS_CALLABLE, 0)
+ZEND_END_ARG_INFO()
+#endif
diff --git a/ext/zip/tests/bug14962.phpt b/ext/zip/tests/bug14962.phpt
index 06a2ce5e6a..fbebfc7275 100644
--- a/ext/zip/tests/bug14962.phpt
+++ b/ext/zip/tests/bug14962.phpt
@@ -16,7 +16,7 @@ $za->addFromString($file, '1234');
$za->close();
if (!is_file($dir . "/__14962.zip")) {
- die('failed to create the archive');
+ die('failed to create the archive');
}
$za = new ZipArchive;
$za->open($dir . '/__14962.zip');
@@ -24,8 +24,8 @@ $za->extractTo($dir, NULL);
$za->close();
if (is_file($fullpath)) {
- unlink($fullpath);
- echo "Ok";
+ unlink($fullpath);
+ echo "Ok";
}
unlink($dir . '/' . '__14962.zip');
?>
diff --git a/ext/zip/tests/bug38943.inc b/ext/zip/tests/bug38943.inc
index b439939e64..b04049a172 100644
--- a/ext/zip/tests/bug38943.inc
+++ b/ext/zip/tests/bug38943.inc
@@ -1,13 +1,13 @@
<?php
class myZip extends ZipArchive {
- private $test = 0;
- public $testp = 1;
- private $testarray = array();
+ private $test = 0;
+ public $testp = 1;
+ private $testarray = array();
- public function __construct() {
- $this->testarray[] = 1;
- var_dump($this->testarray);
- }
+ public function __construct() {
+ $this->testarray[] = 1;
+ var_dump($this->testarray);
+ }
}
$z = new myZip;
diff --git a/ext/zip/tests/bug38943.phpt b/ext/zip/tests/bug38943.phpt
index c5e2284719..ffd0f8dc16 100644
--- a/ext/zip/tests/bug38943.phpt
+++ b/ext/zip/tests/bug38943.phpt
@@ -7,14 +7,14 @@ if(!extension_loaded('zip')) die('skip');
--FILE--
<?php
class myZip extends ZipArchive {
- private $test = 0;
- public $testp = 1;
- private $testarray = array();
+ private $test = 0;
+ public $testp = 1;
+ private $testarray = array();
- public function __construct() {
- $this->testarray[] = 1;
- var_dump($this->testarray);
- }
+ public function __construct() {
+ $this->testarray[] = 1;
+ var_dump($this->testarray);
+ }
}
$z = new myZip;
diff --git a/ext/zip/tests/bug40228-mb.phpt b/ext/zip/tests/bug40228-mb.phpt
index b7095dda68..fddfb65f29 100644
--- a/ext/zip/tests/bug40228-mb.phpt
+++ b/ext/zip/tests/bug40228-mb.phpt
@@ -10,11 +10,11 @@ $zip = new ZipArchive;
$zip->open($arc_name, ZIPARCHIVE::CREATE);
$zip->extractTo($dest);
if (is_dir($dest . '/test/empty')) {
- echo "Ok\n";
- rmdir($dest . '/test/empty');
- rmdir($dest . '/test');
+ echo "Ok\n";
+ rmdir($dest . '/test/empty');
+ rmdir($dest . '/test');
} else {
- echo "Failed.\n";
+ echo "Failed.\n";
}
echo "Done\n";
?>
diff --git a/ext/zip/tests/bug40228.phpt b/ext/zip/tests/bug40228.phpt
index ce5f1e6afe..49e202c576 100644
--- a/ext/zip/tests/bug40228.phpt
+++ b/ext/zip/tests/bug40228.phpt
@@ -10,11 +10,11 @@ $zip = new ZipArchive;
$zip->open($arc_name, ZIPARCHIVE::CREATE);
$zip->extractTo($dest);
if (is_dir($dest . '/test/empty')) {
- echo "Ok\n";
- rmdir($dest . '/test/empty');
- rmdir($dest . '/test');
+ echo "Ok\n";
+ rmdir($dest . '/test/empty');
+ rmdir($dest . '/test');
} else {
- echo "Failed.\n";
+ echo "Failed.\n";
}
echo "Done\n";
?>
diff --git a/ext/zip/tests/bug47667.phpt b/ext/zip/tests/bug47667.phpt
index 085fb1b87f..ab93202801 100644
--- a/ext/zip/tests/bug47667.phpt
+++ b/ext/zip/tests/bug47667.phpt
@@ -11,24 +11,24 @@ $filename = $thisdir . "/bug47667.zip";
$zip = new ZipArchive();
if ($zip->open($filename, ZipArchive::CREATE) !== true) {
- exit("Unable to open the zip file");
+ exit("Unable to open the zip file");
} else {
- $zip->addFromString('foo.txt', 'foo bar foobar');
- $zip->close();
+ $zip->addFromString('foo.txt', 'foo bar foobar');
+ $zip->close();
}
for ($i = 0; $i < 10; $i++) {
- $zip = new ZipArchive();
- if ($zip->open($filename, ZipArchive::OVERWRITE) !== true) {
- exit("Unable to open the zip file");
- }
- $zip->addFromString("foo_{$i}.txt", 'foo bar foobar');
- $zip->close();
+ $zip = new ZipArchive();
+ if ($zip->open($filename, ZipArchive::OVERWRITE) !== true) {
+ exit("Unable to open the zip file");
+ }
+ $zip->addFromString("foo_{$i}.txt", 'foo bar foobar');
+ $zip->close();
}
$zip = new ZipArchive();
if ($zip->open($filename, ZipArchive::CREATE) !== true) {
- exit("Unable to open the zip file");
+ exit("Unable to open the zip file");
}
echo "files: " , $zip->numFiles;
diff --git a/ext/zip/tests/bug49072.phpt b/ext/zip/tests/bug49072.phpt
index b918fba01b..dfe593d01b 100644
--- a/ext/zip/tests/bug49072.phpt
+++ b/ext/zip/tests/bug49072.phpt
@@ -9,13 +9,13 @@ if(!extension_loaded('zip')) die('skip');
$f = __DIR__ . '/bug49072.zip';
$o = new ZipArchive();
if (! $o->open($f, ZipArchive::CHECKCONS)) {
- exit ('error can\'t open');
+ exit ('error can\'t open');
}
$r = $o->getStream('file1'); // this file has a wrong crc
if (!$r)die('failed to open a stream for file1');
$s = '';
while (! feof($r)) {
- $s .= fread($r,1024);
+ $s .= fread($r,1024);
}
?>
--EXPECTF--
diff --git a/ext/zip/tests/bug51353.phpt b/ext/zip/tests/bug51353.phpt
index d84de38f5b..896375dda3 100644
--- a/ext/zip/tests/bug51353.phpt
+++ b/ext/zip/tests/bug51353.phpt
@@ -13,28 +13,28 @@ set_time_limit(0);
$base_path = __DIR__;
/* Either we ship a file with 100000 entries which would be >12M big,
- or create it dynamically. */
+ or create it dynamically. */
$zip = new ZipArchive;
$r = $zip->open("$base_path/51353.zip", ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE);
if ($r) {
- for ($i = 0; $i < 100000; $i++) {
- $zip->addFromString("$i.txt", '1');
- }
- $zip->close();
+ for ($i = 0; $i < 100000; $i++) {
+ $zip->addFromString("$i.txt", '1');
+ }
+ $zip->close();
} else {
- die("failed");
+ die("failed");
}
$zip = new ZipArchive;
$r = $zip->open("$base_path/51353.zip");
if ($r) {
- $zip->extractTo("$base_path/51353_unpack");
- $zip->close();
+ $zip->extractTo("$base_path/51353_unpack");
+ $zip->close();
- $a = glob("$base_path/51353_unpack/*.txt");
- echo count($a) . "\n";
+ $a = glob("$base_path/51353_unpack/*.txt");
+ echo count($a) . "\n";
} else {
- die("failed");
+ die("failed");
}
echo "OK";
diff --git a/ext/zip/tests/bug53579.phpt b/ext/zip/tests/bug53579.phpt
index 371dc31e4f..d0ec350824 100644
--- a/ext/zip/tests/bug53579.phpt
+++ b/ext/zip/tests/bug53579.phpt
@@ -11,7 +11,7 @@ $file = $dirname . 'test_with_comment.zip';
include $dirname . 'utils.inc';
$zip = new ZipArchive;
if (!$zip->open($file)) {
- exit('failed');
+ exit('failed');
}
$fp = $zip->getStream('foo');
diff --git a/ext/zip/tests/bug53603.phpt b/ext/zip/tests/bug53603.phpt
index 0a501071e5..1d1703d590 100644
--- a/ext/zip/tests/bug53603.phpt
+++ b/ext/zip/tests/bug53603.phpt
@@ -8,11 +8,11 @@ if(!extension_loaded('zip')) die('skip');
<?php
class TestStream {
- function url_stat($path, $flags) {
- if (!($flags & STREAM_URL_STAT_QUIET))
- trigger_error("not quiet");
- return array();
- }
+ function url_stat($path, $flags) {
+ if (!($flags & STREAM_URL_STAT_QUIET))
+ trigger_error("not quiet");
+ return array();
+ }
}
stream_wrapper_register("teststream", "TestStream");
@@ -21,12 +21,12 @@ $dirname = __DIR__ . '/';
$file = $dirname . 'test_with_comment.zip';
$zip = new ZipArchive;
if ($zip->open($file) !== TRUE) {
- echo "open failed.\n";
- exit('failed');
+ echo "open failed.\n";
+ exit('failed');
}
$a = $zip->extractTo('teststream://test');
var_dump($a);
--EXPECTF--
-Warning: ZipArchive::extractTo(teststream://test/foo): failed to open stream: "TestStream::stream_open" call failed in %s on line %d
+Warning: ZipArchive::extractTo(teststream://test/foo): Failed to open stream: "TestStream::stream_open" call failed in %s on line %d
bool(false)
diff --git a/ext/zip/tests/bug64342_0.phpt b/ext/zip/tests/bug64342_0.phpt
index 96e9667dda..f9cde3afed 100644
--- a/ext/zip/tests/bug64342_0.phpt
+++ b/ext/zip/tests/bug64342_0.phpt
@@ -10,22 +10,22 @@ Bug #64342 ZipArchive::addFile() has to check file existence (variation 1)
$zip = new ZipArchive;
$res = $zip->open(__DIR__ . '/bug64342.zip', ZipArchive::CREATE);
if ($res === TRUE) {
- $f = md5(uniqid()) . '.txt';
- echo "$f\n";
- $res = $zip->addFile($f);
- if (true == $res) {
- echo "add ok\n";
- } else {
- echo "add failed\n";
- }
- $res = $zip->close();
- if (true == $res) {
- echo "close ok\n";
- } else {
- echo "close failed\n";
- }
+ $f = md5(uniqid()) . '.txt';
+ echo "$f\n";
+ $res = $zip->addFile($f);
+ if (true == $res) {
+ echo "add ok\n";
+ } else {
+ echo "add failed\n";
+ }
+ $res = $zip->close();
+ if (true == $res) {
+ echo "close ok\n";
+ } else {
+ echo "close failed\n";
+ }
} else {
- echo "open failed\n";
+ echo "open failed\n";
}
diff --git a/ext/zip/tests/bug64342_1-mb.phpt b/ext/zip/tests/bug64342_1-mb.phpt
index 6b14c7fb5d..4884c9fe5f 100644
--- a/ext/zip/tests/bug64342_1-mb.phpt
+++ b/ext/zip/tests/bug64342_1-mb.phpt
@@ -15,25 +15,25 @@ copy($dirname . 'test.zip', $file);
$zip = new ZipArchive;
if (!$zip->open($file)) {
- exit('failed');
+ exit('failed');
}
if (!$zip->addFile($dirname . 'cant_find_me.txt', 'test.php')) {
- echo "failed\n";
+ echo "failed\n";
}
if ($zip->status == ZIPARCHIVE::ER_OK) {
- if (!verify_entries($zip, [
- "bar",
- "foobar/",
- "foobar/baz",
- "entry1.txt"
- ])) {
- echo "failed\n";
- } else {
- echo "OK";
- }
- $zip->close();
+ if (!verify_entries($zip, [
+ "bar",
+ "foobar/",
+ "foobar/baz",
+ "entry1.txt"
+ ])) {
+ echo "failed\n";
+ } else {
+ echo "OK";
+ }
+ $zip->close();
} else {
- echo "failed\n";
+ echo "failed\n";
}
@unlink($file);
?>
diff --git a/ext/zip/tests/bug64342_1.phpt b/ext/zip/tests/bug64342_1.phpt
index 13d8a6d388..6b923d3ef1 100644
--- a/ext/zip/tests/bug64342_1.phpt
+++ b/ext/zip/tests/bug64342_1.phpt
@@ -15,25 +15,25 @@ copy($dirname . 'test.zip', $file);
$zip = new ZipArchive;
if (!$zip->open($file)) {
- exit('failed');
+ exit('failed');
}
if (!$zip->addFile($dirname . 'cant_find_me.txt', 'test.php')) {
- echo "failed\n";
+ echo "failed\n";
}
if ($zip->status == ZIPARCHIVE::ER_OK) {
- if (!verify_entries($zip, [
- "bar",
- "foobar/",
- "foobar/baz",
- "entry1.txt"
- ])) {
- echo "failed\n";
- } else {
- echo "OK";
- }
- $zip->close();
+ if (!verify_entries($zip, [
+ "bar",
+ "foobar/",
+ "foobar/baz",
+ "entry1.txt"
+ ])) {
+ echo "failed\n";
+ } else {
+ echo "OK";
+ }
+ $zip->close();
} else {
- echo "failed\n";
+ echo "failed\n";
}
@unlink($file);
?>
diff --git a/ext/zip/tests/bug70752.phpt b/ext/zip/tests/bug70752.phpt
index f006fbee9a..8fbe3a6a54 100644
--- a/ext/zip/tests/bug70752.phpt
+++ b/ext/zip/tests/bug70752.phpt
@@ -19,11 +19,9 @@ $zip->close();
var_dump(file_exists($filename));
?>
-===DONE===
--EXPECT--
bool(false)
bool(false)
-===DONE===
--CLEAN--
<?php
$filename = __DIR__ . DIRECTORY_SEPARATOR . 'bug70752.txt';
diff --git a/ext/zip/tests/bug7214.phpt b/ext/zip/tests/bug7214.phpt
index d36f0f4b42..b36bb2759f 100644
--- a/ext/zip/tests/bug7214.phpt
+++ b/ext/zip/tests/bug7214.phpt
@@ -12,9 +12,9 @@ $entries = 0;
$entry = zip_read($zip);
$contents = zip_entry_read($entry, zip_entry_filesize($entry));
if (strlen($contents) == zip_entry_filesize($entry)) {
- echo "Ok";
+ echo "Ok";
} else {
- echo "failed";
+ echo "failed";
}
?>
diff --git a/ext/zip/tests/bug72258.phpt b/ext/zip/tests/bug72258.phpt
index 208a810c33..4612cc26f0 100644
--- a/ext/zip/tests/bug72258.phpt
+++ b/ext/zip/tests/bug72258.phpt
@@ -12,13 +12,13 @@ $fn = __DIR__ . DIRECTORY_SEPARATOR . "bug72258.zip";
$zip = new \ZipArchive();
$res = $zip->open($fn);
if ($res !== true) {
- echo 'Error opening: ' . $res;
- die();
+ echo 'Error opening: ' . $res;
+ die();
}
for ($i = 0; $i < $zip->numFiles; $i++) {
- $fnInArc = $zip->getNameIndex($i, ZipArchive::FL_ENC_RAW);
- var_dump($fnInArc);
+ $fnInArc = $zip->getNameIndex($i, ZipArchive::FL_ENC_RAW);
+ var_dump($fnInArc);
}
?>
--EXPECT--
diff --git a/ext/zip/tests/bug72374.phpt b/ext/zip/tests/bug72374.phpt
new file mode 100644
index 0000000000..b214be3eaf
--- /dev/null
+++ b/ext/zip/tests/bug72374.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Bug #72374 (ZipArchive::addGlob remove_path option strips first char of filename)
+--SKIPIF--
+<?php
+if(!extension_loaded('zip')) die('skip');
+?>
+--FILE--
+<?php
+$dirname = dirname(__FILE__) . '/';
+include $dirname . 'utils.inc';
+
+$dirname = $dirname . 'bug72374/';
+mkdir($dirname);
+$file = $dirname . 'some-foo.txt';
+touch($file);
+
+$zip = new ZipArchive();
+$zip->open($dirname . 'test.zip', ZipArchive::CREATE | ZipArchive::OVERWRITE);
+$zip->addGlob($file, 0, array('remove_path' => $dirname . 'some-'));
+$zip->addGlob($file, 0, array('remove_path' => $dirname));
+verify_entries($zip, ['foo.txt', '/some-foo.txt']);
+$zip->close();
+?>
+--CLEAN--
+<?php
+$dirname = dirname(__FILE__) . '/';
+include $dirname . 'utils.inc';
+
+$dirname = $dirname . 'bug72374/';
+rmdir_rf($dirname);
+?>
+--EXPECT--
diff --git a/ext/zip/tests/bug76524.phpt b/ext/zip/tests/bug76524.phpt
index e087015c3c..5fd66c1535 100644
--- a/ext/zip/tests/bug76524.phpt
+++ b/ext/zip/tests/bug76524.phpt
@@ -9,7 +9,7 @@ if(!extension_loaded('zip')) die('skip');
$i = 0;
do {
- $filename = __DIR__ . "/nonexistent" . ($i++) . ".zip";
+ $filename = __DIR__ . "/nonexistent" . ($i++) . ".zip";
} while (file_exists($filename));
$zip = new ZipArchive();
diff --git a/ext/zip/tests/bug7658.phpt b/ext/zip/tests/bug7658.phpt
index 9253b01c3f..e2a70aac14 100644
--- a/ext/zip/tests/bug7658.phpt
+++ b/ext/zip/tests/bug7658.phpt
@@ -7,21 +7,21 @@ if(!extension_loaded('zip')) die('skip');
--FILE--
<?php
$expect = array(
- "mimetype",
- "Configurations2/statusbar/",
- "Configurations2/accelerator/current.xml",
- "Configurations2/floater/",
- "Configurations2/popupmenu/",
- "Configurations2/progressbar/",
- "Configurations2/menubar/",
- "Configurations2/toolbar/",
- "Configurations2/images/Bitmaps/",
- "content.xml",
- "styles.xml",
- "meta.xml",
- "Thumbnails/thumbnail.png",
- "settings.xml",
- "META-INF/manifest.xml",
+ "mimetype",
+ "Configurations2/statusbar/",
+ "Configurations2/accelerator/current.xml",
+ "Configurations2/floater/",
+ "Configurations2/popupmenu/",
+ "Configurations2/progressbar/",
+ "Configurations2/menubar/",
+ "Configurations2/toolbar/",
+ "Configurations2/images/Bitmaps/",
+ "content.xml",
+ "styles.xml",
+ "meta.xml",
+ "Thumbnails/thumbnail.png",
+ "settings.xml",
+ "META-INF/manifest.xml",
);
$dirname = __DIR__ . '/';
include $dirname . 'utils.inc';
@@ -29,7 +29,7 @@ $file = $dirname . '__tmp_bug7658.odt';
$zip = new ZipArchive();
copy($dirname . 'bug7658.odt', $file);
if(!$zip->open($file)) {
- echo 'failed';
+ echo 'failed';
}
@@ -40,8 +40,8 @@ echo "\n";
$zip->open($file);
for($i=0; $i < $zip->numFiles; $i++) {
- $sb = $zip->statIndex($i);
- $found[] = $sb['name'];
+ $sb = $zip->statIndex($i);
+ $found[] = $sb['name'];
}
$ar = array_diff($found, $expect);
diff --git a/ext/zip/tests/bug8700.phpt b/ext/zip/tests/bug8700.phpt
index 67bd265f9a..ad5d91b7c2 100644
--- a/ext/zip/tests/bug8700.phpt
+++ b/ext/zip/tests/bug8700.phpt
@@ -17,8 +17,8 @@ if ($zip->open($filename) === FALSE) {
$contents_from_idx = $zip->getFromIndex(0);
$contents_from_name = $zip->getFromName('1.txt');
if ($contents_from_idx != $contents_from_name) {
- echo "failed:";
- var_dump($content_from_idx, $content_from_name);
+ echo "failed:";
+ var_dump($content_from_idx, $content_from_name);
}
$zip->close();
diff --git a/ext/zip/tests/doubleclose.phpt b/ext/zip/tests/doubleclose.phpt
index 48547e3c72..905dc60f0c 100644
--- a/ext/zip/tests/doubleclose.phpt
+++ b/ext/zip/tests/doubleclose.phpt
@@ -10,21 +10,29 @@ if(!extension_loaded('zip')) die('skip');
echo "Procedural\n";
$zip = zip_open(__DIR__ . '/test.zip');
if (!is_resource($zip)) {
- die("Failure");
- }
-var_dump(zip_close($zip));
+ die("Failure");
+}
var_dump(zip_close($zip));
+try {
+ var_dump(zip_close($zip));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
echo "Object\n";
$zip = new ZipArchive();
if (!$zip->open(__DIR__ . '/test.zip')) {
- die('Failure');
+ die('Failure');
}
if ($zip->status == ZIPARCHIVE::ER_OK) {
- var_dump($zip->close());
- var_dump($zip->close());
+ var_dump($zip->close());
+ try {
+ $zip->close();
+ } catch (ValueError $err) {
+ echo $err->getMessage(), PHP_EOL;
+ }
} else {
- die("Failure");
+ die("Failure");
}
?>
@@ -32,12 +40,8 @@ Done
--EXPECTF--
Procedural
NULL
-
-Warning: zip_close(): supplied resource is not a valid Zip Directory resource in %s
-bool(false)
+zip_close(): supplied resource is not a valid Zip Directory resource
Object
bool(true)
-
-Warning: ZipArchive::close(): Invalid or uninitialized Zip object in %s
-bool(false)
+Invalid or uninitialized Zip object
Done
diff --git a/ext/zip/tests/oo_addemptydir.phpt b/ext/zip/tests/oo_addemptydir.phpt
index 4ad424ce19..1a95662b15 100644
--- a/ext/zip/tests/oo_addemptydir.phpt
+++ b/ext/zip/tests/oo_addemptydir.phpt
@@ -15,25 +15,25 @@ copy($dirname . 'test.zip', $file);
$zip = new ZipArchive;
if (!$zip->open($file)) {
- exit('failed');
+ exit('failed');
}
$zip->addEmptyDir('emptydir');
if ($zip->status == ZIPARCHIVE::ER_OK) {
- if (!verify_entries($zip, [
- "bar",
- "foobar/",
- "foobar/baz",
- "entry1.txt",
- "emptydir/"
- ])) {
- echo "failed\n";
- } else {
- echo "OK";
- }
- $zip->close();
+ if (!verify_entries($zip, [
+ "bar",
+ "foobar/",
+ "foobar/baz",
+ "entry1.txt",
+ "emptydir/"
+ ])) {
+ echo "failed\n";
+ } else {
+ echo "OK";
+ }
+ $zip->close();
} else {
- echo "failed3\n";
+ echo "failed3\n";
}
@unlink($file);
?>
diff --git a/ext/zip/tests/oo_addemptydir_error.phpt b/ext/zip/tests/oo_addemptydir_error.phpt
index a1b083ca50..92c220066f 100644
--- a/ext/zip/tests/oo_addemptydir_error.phpt
+++ b/ext/zip/tests/oo_addemptydir_error.phpt
@@ -12,16 +12,16 @@ include __DIR__ . '/utils.inc';
$zip = new ZipArchive;
if (!$zip->open(__DIR__ . '/test.zip', ZipArchive::RDONLY)) {
- exit('failed');
+ exit('failed');
}
var_dump($zip->addEmptyDir('emptydir'));
if ($zip->status == ZipArchive::ER_RDONLY) {
- echo "OK\n";
+ echo "OK\n";
} else if ($zip->status == ZipArchive::ER_OK) {
- dump_entries_name($zip);
+ dump_entries_name($zip);
} else {
- echo "Lost\n";
+ echo "Lost\n";
}
$zip->close();
?>
diff --git a/ext/zip/tests/oo_addfile.phpt b/ext/zip/tests/oo_addfile.phpt
index 254f2b7620..5dd99faa0b 100644
--- a/ext/zip/tests/oo_addfile.phpt
+++ b/ext/zip/tests/oo_addfile.phpt
@@ -15,26 +15,26 @@ copy($dirname . 'test.zip', $file);
$zip = new ZipArchive;
if (!$zip->open($file)) {
- exit('failed');
+ exit('failed');
}
if (!$zip->addFile($dirname . 'utils.inc', 'test.php')) {
- echo "failed\n";
+ echo "failed\n";
}
if ($zip->status == ZIPARCHIVE::ER_OK) {
- if (!verify_entries($zip, [
- "bar",
- "foobar/",
- "foobar/baz",
- "entry1.txt",
- "test.php"
- ])) {
- echo "failed\n";
- } else {
- echo "OK";
- }
- $zip->close();
+ if (!verify_entries($zip, [
+ "bar",
+ "foobar/",
+ "foobar/baz",
+ "entry1.txt",
+ "test.php"
+ ])) {
+ echo "failed\n";
+ } else {
+ echo "OK";
+ }
+ $zip->close();
} else {
- echo "failed\n";
+ echo "failed\n";
}
@unlink($file);
?>
diff --git a/ext/zip/tests/oo_addpattern.phpt b/ext/zip/tests/oo_addpattern.phpt
index fe1a57368d..19453bee49 100644
--- a/ext/zip/tests/oo_addpattern.phpt
+++ b/ext/zip/tests/oo_addpattern.phpt
@@ -25,7 +25,7 @@ if (!$zip->open($file)) {
exit('failed');
}
$dir = realpath($dirname);
-$options = array('add_path' => 'baz/', 'remove_path' => $dir);
+$options = array('add_path' => 'baz', 'remove_path' => $dir);
if (!$zip->addPattern('/\.txt$/', $dir, $options)) {
echo "failed\n";
}
@@ -35,8 +35,8 @@ if ($zip->status == ZIPARCHIVE::ER_OK) {
"foobar/",
"foobar/baz",
"entry1.txt",
- "baz/foo.txt",
- "baz/bar.txt"
+ "baz" . DIRECTORY_SEPARATOR . "foo.txt",
+ "baz" . DIRECTORY_SEPARATOR . "bar.txt"
])) {
echo "failed\n";
} else {
diff --git a/ext/zip/tests/oo_cancel.phpt b/ext/zip/tests/oo_cancel.phpt
new file mode 100644
index 0000000000..4c487072c0
--- /dev/null
+++ b/ext/zip/tests/oo_cancel.phpt
@@ -0,0 +1,39 @@
+--TEST--
+registerCancelCallback
+--SKIPIF--
+<?php
+/* $Id$ */
+if(!extension_loaded('zip')) die('skip');
+if (!method_exists('ZipArchive', 'registerCancelCallback')) die('skip libzip too old');
+?>
+--INI--
+date.timezone=UTC
+--FILE--
+<?php
+$dirname = dirname(__FILE__) . '/';
+$file = $dirname . '__tmp_oo_progress.zip';
+
+@unlink($file);
+
+$zip = new ZipArchive;
+if (!$zip->open($file, ZIPARCHIVE::CREATE)) {
+ exit('failed');
+}
+
+var_dump($zip->registerCancelCallback(function () {
+ // Always cancel
+ return -1;
+}));
+var_dump($zip->addFromString(PHP_BINARY, 'entry #1'));
+
+var_dump($zip->close());
+@unlink($file);
+?>
+Done
+--EXPECTF--
+bool(true)
+bool(true)
+
+Warning: ZipArchive::close(): Operation cancelled in %s
+bool(false)
+Done
diff --git a/ext/zip/tests/oo_close.phpt b/ext/zip/tests/oo_close.phpt
index 60a7f364d1..962ce183e7 100644
--- a/ext/zip/tests/oo_close.phpt
+++ b/ext/zip/tests/oo_close.phpt
@@ -10,14 +10,14 @@ if(!extension_loaded('zip')) die('skip');
$dirname = __DIR__ . '/';
$zip = new ZipArchive;
if (!$zip->open($dirname . 'test.zip')) {
- exit('failed');
+ exit('failed');
}
if ($zip->status == ZIPARCHIVE::ER_OK) {
- $zip->close();
- echo "ok\n";
+ $zip->close();
+ echo "ok\n";
} else {
- echo "failed\n";
+ echo "failed\n";
}
?>
--EXPECT--
diff --git a/ext/zip/tests/oo_count.phpt b/ext/zip/tests/oo_count.phpt
index a5771fa298..426d456a29 100644
--- a/ext/zip/tests/oo_count.phpt
+++ b/ext/zip/tests/oo_count.phpt
@@ -12,7 +12,7 @@ $file = $dirname . 'test.zip';
$zip = new ZipArchive;
if (!$zip->open($file)) {
- exit('failed');
+ exit('failed');
}
var_dump($zip->numFiles, count($zip), $zip->numFiles == count($zip));
diff --git a/ext/zip/tests/oo_delete.phpt b/ext/zip/tests/oo_delete.phpt
index 385b943893..033662be3e 100644
--- a/ext/zip/tests/oo_delete.phpt
+++ b/ext/zip/tests/oo_delete.phpt
@@ -9,50 +9,50 @@ if(!extension_loaded('zip')) die('skip');
$dirname = __DIR__ . '/';
$file = $dirname . 'oo_delete.zip';
if (file_exists($file)) {
- unlink($file);
+ unlink($file);
}
$zip = new ZipArchive;
if (!$zip->open($file, ZIPARCHIVE::CREATE)) {
- exit('failed');
+ exit('failed');
}
$zip->addFromString('entry1.txt', 'entry #1');
$zip->addFromString('entry2.txt', 'entry #2');
$zip->addFromString('dir/entry2.txt', 'entry #2');
if ($zip->status == ZIPARCHIVE::ER_OK) {
- $zip->close();
- echo "ok\n";
+ $zip->close();
+ echo "ok\n";
} else {
- var_dump($zip);
- echo "failed\n";
+ var_dump($zip);
+ echo "failed\n";
}
if (!$zip->open($file, ZIPARCHIVE::CREATE)) {
- exit('failed');
+ exit('failed');
}
if ($zip->deleteIndex(0)) {
- echo "ok\n";
+ echo "ok\n";
}
if ($zip->deleteName('entry2.txt')) {
- echo "ok\n";
+ echo "ok\n";
} else {
- echo "failed 3\n";
+ echo "failed 3\n";
}
if ($zip->deleteName('dir/entry2.txt')) {
- echo "ok\n";
+ echo "ok\n";
} else {
- echo "failed 3\n";
+ echo "failed 3\n";
}
if (!$zip->deleteIndex(123)) {
- echo "ok\n";
+ echo "ok\n";
} else {
- print_r($zip);
- echo "failed\n";
+ print_r($zip);
+ echo "failed\n";
}
@@ -67,7 +67,7 @@ var_dump($sb);
unset($zip);
if (file_exists($file)) {
- unlink($file);
+ unlink($file);
}
?>
--EXPECT--
diff --git a/ext/zip/tests/oo_encryption.phpt b/ext/zip/tests/oo_encryption.phpt
index 7567111dbb..79ad18a041 100644
--- a/ext/zip/tests/oo_encryption.phpt
+++ b/ext/zip/tests/oo_encryption.phpt
@@ -3,7 +3,7 @@ ZipArchive::setEncryption*() functions
--SKIPIF--
<?php
if (!extension_loaded('zip')) die('skip');
-if (!method_exists('ZipArchive', 'setEncryptionName')) die('skip encrytion not supported');
+if (!method_exists('ZipArchive', 'setEncryptionName')) die('skip encryption not supported');
?>
--FILE--
<?php
@@ -59,7 +59,7 @@ string(3) "bar"
== Stream
string(3) "foo"
-Warning: file_get_contents(%s): failed to open stream: operation failed in %s on line %d
+Warning: file_get_contents(%s): Failed to open stream: operation failed in %s on line %d
bool(false)
string(3) "bar"
== Done
diff --git a/ext/zip/tests/oo_ext_zip.phpt b/ext/zip/tests/oo_ext_zip.phpt
index d35094daeb..70c595a03a 100644
--- a/ext/zip/tests/oo_ext_zip.phpt
+++ b/ext/zip/tests/oo_ext_zip.phpt
@@ -7,14 +7,14 @@ if(!extension_loaded('zip')) die('skip');
--FILE--
<?php
class myZip extends ZipArchive {
- private $test = 0;
- public $testp = 1;
- private $testarray = array();
+ private $test = 0;
+ public $testp = 1;
+ private $testarray = array();
- public function __construct() {
- $this->testarray[] = 1;
- var_dump($this->testarray);
- }
+ public function __construct() {
+ $this->testarray[] = 1;
+ var_dump($this->testarray);
+ }
}
$z = new myZip;
diff --git a/ext/zip/tests/oo_extract.phpt b/ext/zip/tests/oo_extract.phpt
index d2ae2b5a43..f654ea8c95 100644
--- a/ext/zip/tests/oo_extract.phpt
+++ b/ext/zip/tests/oo_extract.phpt
@@ -11,57 +11,57 @@ $file = $dirname . 'test_with_comment.zip';
include $dirname . 'utils.inc';
$zip = new ZipArchive;
if ($zip->open($file) !== TRUE) {
- echo "open failed.\n";
- exit('failed');
+ echo "open failed.\n";
+ exit('failed');
}
$zip->extractTo($dirname . '__oo_extract_tmp');
if (!is_dir($dirname . '__oo_extract_tmp')) {
- echo "failed. mkdir\n";
+ echo "failed. mkdir\n";
}
if (!is_dir($dirname .'__oo_extract_tmp/foobar')) {
- echo "failed. mkdir foobar\n";
+ echo "failed. mkdir foobar\n";
}
if (!file_exists($dirname . '__oo_extract_tmp/foobar/baz')) {
- echo "failed. extract foobar/baz\n";
+ echo "failed. extract foobar/baz\n";
} else {
- echo file_get_contents($dirname . '__oo_extract_tmp/foobar/baz') . "\n";
+ echo file_get_contents($dirname . '__oo_extract_tmp/foobar/baz') . "\n";
}
if (!file_exists($dirname . '__oo_extract_tmp/bar')) {
- echo "failed. bar file\n";
+ echo "failed. bar file\n";
} else {
- echo file_get_contents($dirname . '__oo_extract_tmp/bar') . "\n";
+ echo file_get_contents($dirname . '__oo_extract_tmp/bar') . "\n";
}
if (!file_exists($dirname . '__oo_extract_tmp/foo')) {
- echo "failed. foo file\n";
+ echo "failed. foo file\n";
} else {
- echo file_get_contents($dirname . '__oo_extract_tmp/foo') . "\n";
+ echo file_get_contents($dirname . '__oo_extract_tmp/foo') . "\n";
}
/* extract one file */
$zip->extractTo($dirname . '__oo_extract_tmp', 'bar');
if (!file_exists($dirname . '__oo_extract_tmp/bar')) {
- echo "failed. extract bar file\n";
+ echo "failed. extract bar file\n";
} else {
- echo file_get_contents($dirname . '__oo_extract_tmp/bar') . "\n";
+ echo file_get_contents($dirname . '__oo_extract_tmp/bar') . "\n";
}
/* extract two files */
$zip->extractTo($dirname . '__oo_extract_tmp', array('bar','foo'));
if (!file_exists($dirname . '__oo_extract_tmp/bar')) {
- echo "failed. extract bar file\n";
+ echo "failed. extract bar file\n";
} else {
- echo file_get_contents($dirname . '__oo_extract_tmp/bar') . "\n";
+ echo file_get_contents($dirname . '__oo_extract_tmp/bar') . "\n";
}
if (!file_exists($dirname . '__oo_extract_tmp/foo')) {
- echo "failed. extract foo file\n";
+ echo "failed. extract foo file\n";
} else {
- echo file_get_contents($dirname . '__oo_extract_tmp/foo') . "\n";
+ echo file_get_contents($dirname . '__oo_extract_tmp/foo') . "\n";
}
rmdir_rf($dirname . '__oo_extract_tmp');
diff --git a/ext/zip/tests/oo_getcomment.phpt b/ext/zip/tests/oo_getcomment.phpt
index 4301a8aa34..6f54105cc8 100644
--- a/ext/zip/tests/oo_getcomment.phpt
+++ b/ext/zip/tests/oo_getcomment.phpt
@@ -11,7 +11,7 @@ $file = $dirname . 'test_with_comment.zip';
include $dirname . 'utils.inc';
$zip = new ZipArchive;
if (!$zip->open($file)) {
- exit('failed');
+ exit('failed');
}
echo $zip->getArchiveComment() . "\n";
@@ -20,7 +20,6 @@ echo $zip->getCommentName('foo') . "\n";
echo $zip->getCommentIndex($idx);
echo $zip->getCommentName('') . "\n";
-echo $zip->getCommentName() . "\n";
$zip->close();
@@ -30,6 +29,3 @@ Zip archive comment
foo comment
foo comment
Notice: ZipArchive::getCommentName(): Empty string as entry name in %s on line %d
-
-
-Warning: ZipArchive::getCommentName() expects at least 1 parameter, 0 given in %s on line %d
diff --git a/ext/zip/tests/oo_getnameindex.phpt b/ext/zip/tests/oo_getnameindex.phpt
index 91793b2d1d..0ed563f447 100644
--- a/ext/zip/tests/oo_getnameindex.phpt
+++ b/ext/zip/tests/oo_getnameindex.phpt
@@ -14,7 +14,7 @@ $file = $dirname . 'oo_getnameindex.zip';
$zip = new ZipArchive;
if (!$zip->open($file, ZIPARCHIVE::CREATE)) {
- exit('failed');
+ exit('failed');
}
$zip->addFromString('entry1.txt', 'entry #1');
@@ -22,12 +22,12 @@ $zip->addFromString('entry2.txt', 'entry #2');
$zip->addFromString('dir/entry2d.txt', 'entry #2');
if (!$zip->status == ZIPARCHIVE::ER_OK) {
- echo "failed to write zip\n";
+ echo "failed to write zip\n";
}
$zip->close();
if (!$zip->open($file)) {
- exit('failed');
+ exit('failed');
}
@@ -44,3 +44,7 @@ string(10) "entry1.txt"
string(10) "entry2.txt"
string(15) "dir/entry2d.txt"
bool(false)
+--CLEAN--
+<?php
+unlink(__DIR__ . '/oo_getnameindex.zip');
+?>
diff --git a/ext/zip/tests/oo_namelocate.phpt b/ext/zip/tests/oo_namelocate.phpt
index 714346aba4..5b4c6dbf89 100644
--- a/ext/zip/tests/oo_namelocate.phpt
+++ b/ext/zip/tests/oo_namelocate.phpt
@@ -14,7 +14,7 @@ $file = $dirname . 'oo_namelocate.zip';
$zip = new ZipArchive;
if (!$zip->open($file, ZIPARCHIVE::CREATE)) {
- exit('failed');
+ exit('failed');
}
$zip->addFromString('entry1.txt', 'entry #1');
@@ -22,12 +22,12 @@ $zip->addFromString('entry2.txt', 'entry #2');
$zip->addFromString('dir/entry2d.txt', 'entry #2');
if (!$zip->status == ZIPARCHIVE::ER_OK) {
- echo "failed to write zip\n";
+ echo "failed to write zip\n";
}
$zip->close();
if (!$zip->open($file)) {
- exit('failed');
+ exit('failed');
}
@@ -43,3 +43,7 @@ int(0)
bool(false)
int(1)
int(2)
+--CLEAN--
+<?php
+unlink(__DIR__ . '/oo_namelocate.zip');
+?>
diff --git a/ext/zip/tests/oo_open.phpt b/ext/zip/tests/oo_open.phpt
index 10ebad9441..2dffdc0d88 100644
--- a/ext/zip/tests/oo_open.phpt
+++ b/ext/zip/tests/oo_open.phpt
@@ -11,16 +11,16 @@ $dirname = __DIR__ . '/';
$zip = new ZipArchive;
$r = $zip->open($dirname . 'nofile');
if ($r !== TRUE) {
- echo "ER_OPEN: ok\n";
+ echo "ER_OPEN: ok\n";
} else {
- echo "ER_OPEN: FAILED\n";
+ echo "ER_OPEN: FAILED\n";
}
$r = $zip->open($dirname . 'nofile', ZIPARCHIVE::CREATE);
if (!$r) {
- echo "create: failed\n";
+ echo "create: failed\n";
} else {
- echo "create: ok\n";
+ echo "create: ok\n";
}
@unlink($dirname . 'nofile');
@@ -28,13 +28,13 @@ $zip = new ZipArchive;
$zip->open('');
if (!$zip->open($dirname . 'test.zip')) {
- exit("failed 1\n");
+ exit("failed 1\n");
}
if ($zip->status == ZIPARCHIVE::ER_OK) {
- echo "OK\n";
+ echo "OK\n";
} else {
- echo "failed\n";
+ echo "failed\n";
}
?>
--EXPECTF--
diff --git a/ext/zip/tests/oo_progress.phpt b/ext/zip/tests/oo_progress.phpt
new file mode 100644
index 0000000000..c4641653ed
--- /dev/null
+++ b/ext/zip/tests/oo_progress.phpt
@@ -0,0 +1,40 @@
+--TEST--
+registerProgressCallback
+--SKIPIF--
+<?php
+/* $Id$ */
+if(!extension_loaded('zip')) die('skip');
+if (!method_exists('ZipArchive', 'registerProgressCallback')) die('skip libzip too old');
+?>
+--INI--
+date.timezone=UTC
+--FILE--
+<?php
+$dirname = dirname(__FILE__) . '/';
+$file = $dirname . '__tmp_oo_progress.zip';
+
+@unlink($file);
+
+$zip = new ZipArchive;
+if (!$zip->open($file, ZIPARCHIVE::CREATE)) {
+ exit('failed');
+}
+
+var_dump($zip->registerProgressCallback(0.5, function ($r) {
+ // Only check start/end as intermediate is not reliable
+ if ($r == 0.0) echo "start\n";
+ if ($r == 1.0) echo "end\n";
+}));
+var_dump($zip->addFromString('foo', 'entry #1'));
+
+var_dump($zip->close());
+unlink($file);
+?>
+Done
+--EXPECTF--
+bool(true)
+bool(true)
+start
+end
+bool(true)
+Done
diff --git a/ext/zip/tests/oo_properties.phpt b/ext/zip/tests/oo_properties.phpt
index b435d6c159..13482f3541 100644
--- a/ext/zip/tests/oo_properties.phpt
+++ b/ext/zip/tests/oo_properties.phpt
@@ -14,7 +14,7 @@ copy($dirname . 'test_with_comment.zip', $file);
$zip = new ZipArchive;
if (!$zip->open($file)) {
- exit('failed');
+ exit('failed');
}
printf("zip->status (%d):\n\tempty(): %d\n\tisset(): %d\n", $zip->status, empty($zip->status), isset($zip->status));
@@ -40,7 +40,7 @@ zip->numFiles (4):
empty(): 0
isset(): 1
-Notice: Undefined property: ZipArchive::$bogus in %s on line %d
+Warning: Undefined property: ZipArchive::$bogus in %s on line %d
zip->bogus (0):
empty(): 1
isset(): 0
diff --git a/ext/zip/tests/oo_rename.phpt b/ext/zip/tests/oo_rename.phpt
index cdac489084..9cd9341406 100644
--- a/ext/zip/tests/oo_rename.phpt
+++ b/ext/zip/tests/oo_rename.phpt
@@ -14,7 +14,7 @@ $file = $dirname . 'oo_rename.zip';
$zip = new ZipArchive;
if (!$zip->open($file, ZIPARCHIVE::CREATE)) {
- exit('failed');
+ exit('failed');
}
$zip->addFromString('entry1.txt', 'entry #1');
@@ -22,42 +22,42 @@ $zip->addFromString('entry2.txt', 'entry #2');
$zip->addFromString('dir/entry2.txt', 'entry #2');
if (!$zip->status == ZIPARCHIVE::ER_OK) {
- var_dump($zip);
- echo "failed2\n";
+ var_dump($zip);
+ echo "failed2\n";
}
$zip->close();
if (!$zip->open($file)) {
- exit('failed3');
+ exit('failed3');
}
if (!verify_entries($zip, [
- "entry1.txt",
+ "entry1.txt",
"entry2.txt",
"dir/entry2.txt"
])) {
- exit("failed4");
+ exit("failed4");
} else {
- echo "OK\n";
+ echo "OK\n";
}
if (!$zip->renameIndex(0, 'ren_entry1.txt')) {
- echo "failed index 0\n";
+ echo "failed index 0\n";
}
if (!$zip->renameName('dir/entry2.txt', 'dir3/ren_entry2.txt')) {
- echo "failed name dir/entry2.txt\n";
+ echo "failed name dir/entry2.txt\n";
}
if (!verify_entries($zip, [
- "ren_entry1.txt",
+ "ren_entry1.txt",
"entry2.txt",
"dir3/ren_entry2.txt"
])) {
- exit("failed5");
+ exit("failed5");
} else {
- echo "OK\n";
+ echo "OK\n";
}
$zip->close();
diff --git a/ext/zip/tests/oo_setcomment.phpt b/ext/zip/tests/oo_setcomment.phpt
index a4e10bfce5..4518e68647 100644
--- a/ext/zip/tests/oo_setcomment.phpt
+++ b/ext/zip/tests/oo_setcomment.phpt
@@ -14,7 +14,7 @@ $file = $dirname . 'oo_setcomment.zip';
$zip = new ZipArchive;
if (!$zip->open($file, ZIPARCHIVE::CREATE)) {
- exit('failed');
+ exit('failed');
}
$zip->addFromString('entry1.txt', 'entry #1');
@@ -34,13 +34,13 @@ var_dump($zip->setCommentIndex(4, 'entry5.txt'));
var_dump($zip->setArchiveComment('archive'));
if (!$zip->status == ZIPARCHIVE::ER_OK) {
- echo "failed to write zip\n";
+ echo "failed to write zip\n";
}
$zip->close();
if (!$zip->open($file)) {
- @unlink($file);
- exit('failed');
+ @unlink($file);
+ exit('failed');
}
var_dump($zip->getCommentIndex(0));
diff --git a/ext/zip/tests/oo_setcomment_error.phpt b/ext/zip/tests/oo_setcomment_error.phpt
index a8f1e47ab9..78d8d3dc35 100644
--- a/ext/zip/tests/oo_setcomment_error.phpt
+++ b/ext/zip/tests/oo_setcomment_error.phpt
@@ -12,7 +12,7 @@ $file = __DIR__ . '/__tmp_oo_set_comment_error.zip';
$zip = new ZipArchive;
if (!$zip->open($file, ZIPARCHIVE::CREATE)) {
- exit('failed');
+ exit('failed');
}
$zip->addFromString('entry1.txt', 'entry #1');
@@ -26,7 +26,6 @@ var_dump($zip->setCommentIndex(1, $longComment));
$zip->close();
?>
-===DONE===
--EXPECTF--
Warning: ZipArchive::setArchiveComment(): Comment must not exceed 65535 bytes in %s on line %d
bool(false)
@@ -36,7 +35,6 @@ bool(false)
Warning: ZipArchive::setCommentIndex(): Comment must not exceed 65535 bytes in %s on line %d
bool(false)
-===DONE===
--CLEAN--
<?php
@unlink(__DIR__ . '/__tmp_oo_set_comment_error.zip');
diff --git a/ext/zip/tests/oo_setcompression.phpt b/ext/zip/tests/oo_setcompression.phpt
index 0cdcd791b8..b8519b6834 100644
--- a/ext/zip/tests/oo_setcompression.phpt
+++ b/ext/zip/tests/oo_setcompression.phpt
@@ -9,13 +9,13 @@ if (!extension_loaded('zip')) die('skip');
$tmpfile = __DIR__ . '/oo_setcompression.zip';
if (file_exists($tmpfile)) {
- unlink($tmpfile);
+ unlink($tmpfile);
}
// generate the ZIP file
$zip = new ZipArchive;
if ($zip->open($tmpfile, ZipArchive::CREATE) !== TRUE) {
- exit('failed');
+ exit('failed');
}
$txt = file_get_contents(__FILE__);
$zip->addFromString('entry1.txt', $txt);
@@ -35,18 +35,18 @@ var_dump($zip->setCompressionIndex(5, ZipArchive::CM_DEFLATE));
var_dump($zip->setCompressionIndex(6, ZipArchive::CM_DEFAULT));
if (!$zip->close()) {
- exit('failed');
+ exit('failed');
}
// check the ZIP file
$zip = zip_open($tmpfile);
if (!is_resource($zip)) {
- exit('failed');
+ exit('failed');
}
while ($e = zip_read($zip)) {
- echo zip_entry_name($e) . ': ' . zip_entry_compressionmethod($e) . "\n";
+ echo zip_entry_name($e) . ': ' . zip_entry_compressionmethod($e) . "\n";
}
zip_close($zip);
?>
diff --git a/ext/zip/tests/oo_setmtime.phpt b/ext/zip/tests/oo_setmtime.phpt
new file mode 100644
index 0000000000..628f5ac8bb
--- /dev/null
+++ b/ext/zip/tests/oo_setmtime.phpt
@@ -0,0 +1,76 @@
+--TEST--
+setMtime
+--SKIPIF--
+<?php
+/* $Id$ */
+if(!extension_loaded('zip')) die('skip');
+if (!method_exists('ZipArchive', 'setMtimeName')) die('skip libzip too old');
+?>
+--INI--
+date.timezone=UTC
+--FILE--
+<?php
+$dirname = dirname(__FILE__) . '/';
+include $dirname . 'utils.inc';
+$file = $dirname . '__tmp_oo_set_mtime.zip';
+
+@unlink($file);
+
+$zip = new ZipArchive;
+if (!$zip->open($file, ZIPARCHIVE::CREATE)) {
+ exit('failed');
+}
+
+$zip->addFromString('foo', 'entry #1');
+$zip->addFromString('bar', 'entry #2');
+
+$t1 = mktime(0,0,0,12,25,2019);
+$t2 = mktime(0,0,0,14,7,2018);
+
+echo "Set 1\n";
+$s = $zip->statName('foo');
+var_dump($s['mtime'] > $t1);
+var_dump($zip->setMtimeName('foo', $t1));
+$s = $zip->statName('foo');
+// ONLY with 1.6.0 - var_dump($s['mtime'] == $t1);
+
+echo "Set 2\n";
+$s = $zip->statIndex(1);
+var_dump($s['mtime'] > $t2);
+var_dump($zip->setMtimeIndex(1, $t2));
+$s = $zip->statIndex(1);
+// ONLY with 1.6.0 - var_dump($s['mtime'] == $t2);
+
+if (!$zip->status == ZIPARCHIVE::ER_OK) {
+ echo "failed to write zip\n";
+}
+$zip->close();
+
+if (!$zip->open($file)) {
+ @unlink($file);
+ exit('failed');
+}
+
+echo "Get 1\n";
+$s = $zip->statIndex(0);
+var_dump($s['mtime'] == $t1);
+
+echo "Get 2\n";
+$s = $zip->statName('bar');
+var_dump($s['mtime'] == $t2);
+
+$zip->close();
+@unlink($file);
+
+?>
+--EXPECTF--
+Set 1
+bool(true)
+bool(true)
+Set 2
+bool(true)
+bool(true)
+Get 1
+bool(true)
+Get 2
+bool(true)
diff --git a/ext/zip/tests/oo_stream.phpt b/ext/zip/tests/oo_stream.phpt
index 89a2711666..d5e58a49a0 100644
--- a/ext/zip/tests/oo_stream.phpt
+++ b/ext/zip/tests/oo_stream.phpt
@@ -11,7 +11,7 @@ $file = $dirname . 'test_with_comment.zip';
include $dirname . 'utils.inc';
$zip = new ZipArchive;
if (!$zip->open($file)) {
- exit('failed');
+ exit('failed');
}
$fp = $zip->getStream('foo');
@@ -19,7 +19,7 @@ var_dump($fp);
if(!$fp) exit("\n");
$contents = '';
while (!feof($fp)) {
- $contents .= fread($fp, 255);
+ $contents .= fread($fp, 255);
}
fclose($fp);
diff --git a/ext/zip/tests/pecl12414.phpt b/ext/zip/tests/pecl12414.phpt
index 1b728c0ebc..738ed6dd10 100644
--- a/ext/zip/tests/pecl12414.phpt
+++ b/ext/zip/tests/pecl12414.phpt
@@ -12,24 +12,24 @@ $zipname = __DIR__ . "/pecl12414.zip";
$za = new ZipArchive();
$res =$za->open($zipname);
if ($res === TRUE) {
- $finfo=$za->statName($filename);
- $file_size=$finfo['size'];
+ $finfo=$za->statName($filename);
+ $file_size=$finfo['size'];
- if($file_size>0) {
- $contents=$za->getFromName($filename);
+ if($file_size>0) {
+ $contents=$za->getFromName($filename);
- echo "ZIP contents size: " . strlen($contents) . "\n";
- if(strlen($contents)!=$file_size) {
- echo "zip_readfile recorded data does not match unpacked size: " . $zipname . " : " . $filename;
- }
- } else {
- $contents=false;
- echo "zip_readfile could not open stream from zero length file " . $zipname . " : " .$filename;
- }
+ echo "ZIP contents size: " . strlen($contents) . "\n";
+ if(strlen($contents)!=$file_size) {
+ echo "zip_readfile recorded data does not match unpacked size: " . $zipname . " : " . $filename;
+ }
+ } else {
+ $contents=false;
+ echo "zip_readfile could not open stream from zero length file " . $zipname . " : " .$filename;
+ }
- $za->close();
+ $za->close();
} else {
- echo "zip_readfile could not read from " . $zipname . " : " . $filename;
+ echo "zip_readfile could not read from " . $zipname . " : " . $filename;
}
?>
diff --git a/ext/zip/tests/stream_meta_data.phpt b/ext/zip/tests/stream_meta_data.phpt
index 26453af134..735a2e0d7b 100644
--- a/ext/zip/tests/stream_meta_data.phpt
+++ b/ext/zip/tests/stream_meta_data.phpt
@@ -11,7 +11,7 @@ $file = $dirname . 'test_with_comment.zip';
include $dirname . 'utils.inc';
$zip = new ZipArchive;
if (!$zip->open($file)) {
- exit('failed');
+ exit('failed');
}
$fp = $zip->getStream('foo');
diff --git a/ext/zip/tests/utils.inc b/ext/zip/tests/utils.inc
index f44ab3af32..6d5049e558 100644
--- a/ext/zip/tests/utils.inc
+++ b/ext/zip/tests/utils.inc
@@ -9,7 +9,7 @@ function verify_entries($zip, $entries = []) {
if (!in_array($stat["name"], $entries)) {
$verified = false;
}
-
+
$found[] = $stat["name"];
}
@@ -22,17 +22,17 @@ function verify_entries($zip, $entries = []) {
/* recursively remove a directoryy */
function rmdir_rf($dir) {
- if ($handle = opendir($dir)) {
- while (false !== ($item = readdir($handle))) {
- if ($item != "." && $item != "..") {
- if (is_dir($dir . '/' . $item)) {
- rmdir_rf($dir . '/' . $item);
- } else {
- unlink($dir . '/' . $item);
- }
- }
- }
- closedir($handle);
- rmdir($dir);
- }
+ if ($handle = opendir($dir)) {
+ while (false !== ($item = readdir($handle))) {
+ if ($item != "." && $item != "..") {
+ if (is_dir($dir . '/' . $item)) {
+ rmdir_rf($dir . '/' . $item);
+ } else {
+ unlink($dir . '/' . $item);
+ }
+ }
+ }
+ closedir($handle);
+ rmdir($dir);
+ }
}
diff --git a/ext/zip/tests/zip_entry_close.phpt b/ext/zip/tests/zip_entry_close.phpt
index 2f2581b2d0..f11f3112a9 100644
--- a/ext/zip/tests/zip_entry_close.phpt
+++ b/ext/zip/tests/zip_entry_close.phpt
@@ -10,14 +10,16 @@ $zip = zip_open(__DIR__."/test_procedural.zip");
$entry = zip_read($zip);
echo "entry_open: "; var_dump(zip_entry_open($zip, $entry, "r"));
echo "entry_close: "; var_dump(zip_entry_close($entry));
-echo "entry_close: "; var_dump(zip_entry_close($entry));
+try {
+ echo "entry_close: "; var_dump(zip_entry_close($entry));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
zip_close($zip);
?>
Done
---EXPECTF--
+--EXPECT--
entry_open: bool(true)
entry_close: bool(true)
-entry_close:
-Warning: zip_entry_close(): supplied resource is not a valid Zip Entry resource in %s
-bool(false)
+entry_close: zip_entry_close(): supplied resource is not a valid Zip Entry resource
Done
diff --git a/ext/zip/tests/zip_open_error.phpt b/ext/zip/tests/zip_open_error.phpt
index eaa1d9731e..068956b81f 100644
--- a/ext/zip/tests/zip_open_error.phpt
+++ b/ext/zip/tests/zip_open_error.phpt
@@ -12,10 +12,7 @@ if(!extension_loaded('zip')) die('skip');
echo "Test case 1:";
$zip = zip_open("");
-echo "Test case 2:";
-$zip = zip_open("i_dont_care_about_this_parameter", "this_is_one_to_many");
-
-echo "Test case 3:\n";
+echo "Test case 2:\n";
$zip = zip_open("/non_exisitng_directory/test_procedural.zip");
echo is_resource($zip) ? "OK" : "Failure";
?>
@@ -23,6 +20,4 @@ echo is_resource($zip) ? "OK" : "Failure";
Test case 1:
Warning: zip_open(): Empty string as source in %s on line %d
Test case 2:
-Warning: zip_open() expects exactly 1 parameter, 2 given in %s on line %d
-Test case 3:
Failure
diff --git a/ext/zip/zip_stream.c b/ext/zip/zip_stream.c
index bce62f5614..58fcb0322b 100644
--- a/ext/zip/zip_stream.c
+++ b/ext/zip/zip_stream.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/zlib/php_zlib.h b/ext/zlib/php_zlib.h
index 8e77ee62b2..b8f25015ae 100644
--- a/ext/zlib/php_zlib.h
+++ b/ext/zlib/php_zlib.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/zlib/tests/004-mb.phpt b/ext/zlib/tests/004-mb.phpt
index 07a26e5294..84e40d3013 100644
--- a/ext/zlib/tests/004-mb.phpt
+++ b/ext/zlib/tests/004-mb.phpt
@@ -5,9 +5,7 @@ gzfile() with various invalid params
--FILE--
<?php
-var_dump(gzfile());
var_dump(gzfile("nonexistent_file_gzfile",1));
-var_dump(gzfile(1,1,1));
var_dump(gzfile(__DIR__."/004ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.txt.gz"));
var_dump(gzfile(__DIR__."/004ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.txt.gz", 1));
@@ -15,14 +13,8 @@ var_dump(gzfile(__DIR__."/004ç§ã¯ã‚¬ãƒ©ã‚¹ã‚’食ã¹ã‚‰ã‚Œã¾ã™.txt.gz", 1));
echo "Done\n";
?>
--EXPECTF--
-Warning: gzfile() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: gzfile(nonexistent_file_gzfile): failed to open stream: No such file or directory in %s on line %d
+Warning: gzfile(nonexistent_file_gzfile): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-
-Warning: gzfile() expects at most 2 parameters, 3 given in %s on line %d
-NULL
array(6) {
[0]=>
string(36) "When you're taught through feelings
diff --git a/ext/zlib/tests/004.phpt b/ext/zlib/tests/004.phpt
index 7689ad0cf1..4921ad496c 100644
--- a/ext/zlib/tests/004.phpt
+++ b/ext/zlib/tests/004.phpt
@@ -5,9 +5,7 @@ gzfile() with various invalid params
--FILE--
<?php
-var_dump(gzfile());
var_dump(gzfile("nonexistent_file_gzfile",1));
-var_dump(gzfile(1,1,1));
var_dump(gzfile(__DIR__."/004.txt.gz"));
var_dump(gzfile(__DIR__."/004.txt.gz", 1));
@@ -15,14 +13,8 @@ var_dump(gzfile(__DIR__."/004.txt.gz", 1));
echo "Done\n";
?>
--EXPECTF--
-Warning: gzfile() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: gzfile(nonexistent_file_gzfile): failed to open stream: No such file or directory in %s on line %d
+Warning: gzfile(nonexistent_file_gzfile): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-
-Warning: gzfile() expects at most 2 parameters, 3 given in %s on line %d
-NULL
array(6) {
[0]=>
string(36) "When you're taught through feelings
diff --git a/ext/zlib/tests/005.phpt b/ext/zlib/tests/005.phpt
index daa178ec69..da81c48c73 100644
--- a/ext/zlib/tests/005.phpt
+++ b/ext/zlib/tests/005.phpt
@@ -5,10 +5,13 @@ gzcompress()/gzuncompress() and invalid params
--FILE--
<?php
-var_dump(gzcompress());
-var_dump(gzcompress("", 1000));
-var_dump(gzcompress("", -1));
+try {
+ var_dump(gzcompress("", 1000));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+var_dump(gzcompress("", -1));
var_dump(gzcompress(""));
var_dump(gzcompress("", 9));
@@ -19,9 +22,17 @@ Desolation, grief and agony";
var_dump($data1 = gzcompress($string));
var_dump($data2 = gzcompress($string, 9));
-var_dump(gzuncompress());
-var_dump(gzuncompress("", 1000));
-var_dump(gzuncompress("", -1));
+try {
+ var_dump(gzuncompress("", 1000));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+try {
+ var_dump(gzuncompress("", -1));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
var_dump(gzuncompress(""));
var_dump(gzuncompress("", 9));
@@ -31,28 +42,18 @@ var_dump(gzuncompress($data2));
$data2[4] = 0;
var_dump(gzuncompress($data2));
-echo "Done\n";
?>
--EXPECTF--
-Warning: gzcompress() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: gzcompress(): compression level (1000) must be within -1..9 in %s on line %d
-bool(false)
+Compression level (1000) must be within -1..9
string(%d) "%a"
string(%d) "%a"
string(%d) "%a"
string(%d) "%a"
string(%d) "%a"
-Warning: gzuncompress() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
Warning: gzuncompress(): %s error in %s on line %d
bool(false)
-
-Warning: gzuncompress(): length (-1) must be greater or equal zero in %s on line %d
-bool(false)
+Length (-1) must be greater or equal zero
Warning: gzuncompress(): %s error in %s on line %d
bool(false)
@@ -68,4 +69,3 @@ Desolation, grief and agony"
Warning: gzuncompress(): %s error in %s on line %d
bool(false)
-Done
diff --git a/ext/zlib/tests/006.phpt b/ext/zlib/tests/006.phpt
index 1caebd7a62..32965ea65a 100644
--- a/ext/zlib/tests/006.phpt
+++ b/ext/zlib/tests/006.phpt
@@ -5,8 +5,12 @@ gzdeflate()/gzinflate() and invalid params
--FILE--
<?php
-var_dump(gzdeflate());
-var_dump(gzdeflate("", 1000));
+try {
+ var_dump(gzcompress("", 1000));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
var_dump(gzdeflate("", -1));
var_dump(gzdeflate(""));
@@ -19,10 +23,14 @@ Desolation, grief and agony";
var_dump($data1 = gzdeflate($string));
var_dump($data2 = gzdeflate($string, 9));
-var_dump(gzinflate());
var_dump(gzinflate(""));
var_dump(gzinflate("asfwe", 1000));
-var_dump(gzinflate("asdf", -1));
+
+try {
+ var_dump(gzinflate("asdf", -1));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
var_dump(gzinflate("asdf"));
var_dump(gzinflate("asdf", 9));
@@ -32,31 +40,21 @@ var_dump(gzinflate($data2));
$data2[4] = 0;
var_dump(gzinflate($data2));
-echo "Done\n";
?>
--EXPECTF--
-Warning: gzdeflate() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: gzdeflate(): compression level (1000) must be within -1..9 in %s on line %d
-bool(false)
+Compression level (1000) must be within -1..9
string(%d) "%a"
string(%d) "%a"
string(%d) "%a"
string(%d) "%a"
string(%d) "%a"
-Warning: gzinflate() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
Warning: gzinflate(): data error in %s on line %d
bool(false)
Warning: gzinflate(): data error in %s on line %d
bool(false)
-
-Warning: gzinflate(): length (-1) must be greater or equal zero in %s on line %d
-bool(false)
+Length (-1) must be greater or equal zero
Warning: gzinflate(): data error in %s on line %d
bool(false)
@@ -72,4 +70,3 @@ Desolation, grief and agony"
Warning: gzinflate(): data error in %s on line %d
bool(false)
-Done
diff --git a/ext/zlib/tests/007.phpt b/ext/zlib/tests/007.phpt
index 6c42bf67db..f51d0d3fc5 100644
--- a/ext/zlib/tests/007.phpt
+++ b/ext/zlib/tests/007.phpt
@@ -5,11 +5,21 @@ gzencode() and invalid params
--FILE--
<?php
-var_dump(gzencode());
-var_dump(gzencode(1,1,1,1));
-var_dump(gzencode("", -10));
-var_dump(gzencode("", 100));
-var_dump(gzencode("", 1, 100));
+try {
+ var_dump(gzencode("", -10));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ var_dump(gzencode("", 100));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+try {
+ var_dump(gzencode("", 1, 100));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
var_dump(gzencode("", -1, ZLIB_ENCODING_GZIP));
var_dump(gzencode("", 9, ZLIB_ENCODING_DEFLATE));
@@ -19,33 +29,22 @@ Light in this temple
Light in my truth
Lies in the darkness";
-var_dump(gzencode($string, 9, 3));
+try {
+ var_dump(gzencode($string, 9, 3));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
var_dump(gzencode($string, -1, ZLIB_ENCODING_GZIP));
var_dump(gzencode($string, 9, ZLIB_ENCODING_DEFLATE));
-echo "Done\n";
?>
--EXPECTF--
-Warning: gzencode() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
-Warning: gzencode() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-
-Warning: gzencode(): compression level (-10) must be within -1..9 in %s on line %d
-bool(false)
-
-Warning: gzencode(): compression level (100) must be within -1..9 in %s on line %d
-bool(false)
-
-Warning: gzencode(): encoding mode must be either ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or ZLIB_ENCODING_DEFLATE in %s on line %d
-bool(false)
+Compression level (-10) must be within -1..9
+Compression level (100) must be within -1..9
+Encoding mode must be either ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or ZLIB_ENCODING_DEFLATE
string(%d) "%a"
string(%d) "%a"
-
-Warning: gzencode(): encoding mode must be either ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or ZLIB_ENCODING_DEFLATE in %s on line %d
-bool(false)
+Encoding mode must be either ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or ZLIB_ENCODING_DEFLATE
string(%d) "%a"
string(%d) "%a"
-Done
diff --git a/ext/zlib/tests/bug60761.phpt b/ext/zlib/tests/bug60761.phpt
index 04763be504..37191c2739 100644
--- a/ext/zlib/tests/bug60761.phpt
+++ b/ext/zlib/tests/bug60761.phpt
@@ -19,14 +19,14 @@ $lens = array();
for ( $i=0 ; $i < 100 ; $i++ ) {
- // can't use ob_gzhandler with zlib.output_compression
- ob_start();//"ob_gzhandler");
- phpinfo();
- $html = ob_get_clean();
+ // can't use ob_gzhandler with zlib.output_compression
+ ob_start();//"ob_gzhandler");
+ phpinfo();
+ $html = ob_get_clean();
- $len = strlen($html);
+ $len = strlen($html);
- $lens[$len] = $len;
+ $lens[$len] = $len;
}
$lens = array_values($lens);
diff --git a/ext/zlib/tests/bug67724.phpt b/ext/zlib/tests/bug67724.phpt
index 1e5026f650..3edbb2ba2c 100644
--- a/ext/zlib/tests/bug67724.phpt
+++ b/ext/zlib/tests/bug67724.phpt
@@ -9,11 +9,11 @@ extension_loaded("zlib") or die("skip need ext/zlib");
echo "Test\n";
$f = fopen(__DIR__."/bug67724.gz.gz", "rb")
- or die(current(error_get_last()));
+ or die(current(error_get_last()));
stream_filter_append($f, "zlib.inflate", STREAM_FILTER_READ, ["window" => 30]);
stream_filter_append($f, "zlib.inflate", STREAM_FILTER_READ, ["window" => 30]);
for ($i = 0; !feof($f); $i += strlen(fread($f, 0x1000)))
- ;
+ ;
fclose($f);
var_dump($i);
diff --git a/ext/zlib/tests/bug71417.phpt b/ext/zlib/tests/bug71417.phpt
index ae1390134e..cadd1e6735 100644
--- a/ext/zlib/tests/bug71417.phpt
+++ b/ext/zlib/tests/bug71417.phpt
@@ -6,10 +6,10 @@ Bug #71417: fread() does not detect decoding errors from filter zlib.inflate
<?php
function test($case) {
- $plain = "The quick brown fox jumps over the lazy dog.";
- $fn = "bug71417.gz";
- $compressed = (string) gzencode($plain);
-
+ $plain = "The quick brown fox jumps over the lazy dog.";
+ $fn = "bug71417.gz";
+ $compressed = (string) gzencode($plain);
+
if ($case == 1) {
// 1. Set a random byte in the middle of the compressed data.
// $ php test-zlib-inflate.php
@@ -37,26 +37,26 @@ function test($case) {
// 4. Corrupted final length.
// $ php test-zlib-inflate.phpread: string(0) ""
// read: string(44) "The quick brown fox jumps over the lazy dog."
- // $ gunzip test-zlib-inflate.gz
+ // $ gunzip test-zlib-inflate.gz
// gzip: test-zlib-inflate.gz: invalid compressed data--length error
$compressed[strlen($compressed)-2] = 'X';
}
-
- // The gzdecode() function applied to the corrupted compressed data always
- // detects the error:
- // --> gzdecode(): PHP Fatal error: Uncaught ErrorException: gzdecode(): data error in ...
- echo "gzdecode(): ", rawurldecode(gzdecode($compressed)), "\n";
- file_put_contents($fn, $compressed);
-
- $r = fopen($fn, "r");
- stream_filter_append($r, 'zlib.inflate', STREAM_FILTER_READ, array('window' => 15+16));
- while (!feof($r)) {
- $s = fread($r, 100);
- echo "read: "; var_dump($s);
- }
- fclose($r);
- unlink($fn);
+ // The gzdecode() function applied to the corrupted compressed data always
+ // detects the error:
+ // --> gzdecode(): PHP Fatal error: Uncaught ErrorException: gzdecode(): data error in ...
+ echo "gzdecode(): ", rawurldecode(gzdecode($compressed)), "\n";
+
+ file_put_contents($fn, $compressed);
+
+ $r = fopen($fn, "r");
+ stream_filter_append($r, 'zlib.inflate', STREAM_FILTER_READ, array('window' => 15+16));
+ while (!feof($r)) {
+ $s = fread($r, 100);
+ echo "read: "; var_dump($s);
+ }
+ fclose($r);
+ unlink($fn);
}
test(1);
diff --git a/ext/zlib/tests/bug75273.phpt b/ext/zlib/tests/bug75273.phpt
index 66ec81edff..f3309546bd 100644
--- a/ext/zlib/tests/bug75273.phpt
+++ b/ext/zlib/tests/bug75273.phpt
@@ -7,22 +7,22 @@ if (!extension_loaded('zlib')) die('skip zlib extension not available');
--FILE--
<?php
function non_repeating_str($len = 8192) {
- $ret = '';
- mt_srand(1);
- $iterations = (int) ($len / 256) + 1;
- for ($i = 0; $i < $iterations; $i++) {
- $haves = array();
- $cnt = 0;
- while ($cnt < 256) {
- $j = mt_rand(0, 255);
- if (!isset($haves[$j])) {
- $haves[$j] = $j;
- $cnt++;
- $ret .= chr($j);
- }
- }
- }
- return substr($ret, 0, $len);
+ $ret = '';
+ mt_srand(1);
+ $iterations = (int) ($len / 256) + 1;
+ for ($i = 0; $i < $iterations; $i++) {
+ $haves = array();
+ $cnt = 0;
+ while ($cnt < 256) {
+ $j = mt_rand(0, 255);
+ if (!isset($haves[$j])) {
+ $haves[$j] = $j;
+ $cnt++;
+ $ret .= chr($j);
+ }
+ }
+ }
+ return substr($ret, 0, $len);
}
$base_len = 32768 - 23 /*overhead*/;
@@ -30,25 +30,25 @@ $base_len = 32768 - 23 /*overhead*/;
$stream = fopen('php://memory', 'rb+');
for ($i = 1; $i <= 8; $i++) {
- $in_data = non_repeating_str($base_len + $i);
+ $in_data = non_repeating_str($base_len + $i);
- $deflate_filter = stream_filter_append($stream, 'zlib.deflate', STREAM_FILTER_WRITE, ['window' => 16 + 15]);
- rewind($stream);
- fwrite($stream, $in_data);
- stream_filter_remove($deflate_filter);
+ $deflate_filter = stream_filter_append($stream, 'zlib.deflate', STREAM_FILTER_WRITE, ['window' => 16 + 15]);
+ rewind($stream);
+ fwrite($stream, $in_data);
+ stream_filter_remove($deflate_filter);
- rewind($stream);
- $out_data = stream_get_contents($stream);
- $out_data_len = strlen($out_data);
+ rewind($stream);
+ $out_data = stream_get_contents($stream);
+ $out_data_len = strlen($out_data);
- $inflate_filter = stream_filter_prepend($stream, 'zlib.inflate', STREAM_FILTER_WRITE, ['window' => 16 + 15]);
- rewind($stream);
- $fwrite_len = fwrite($stream, $out_data);
- stream_filter_remove($inflate_filter);
+ $inflate_filter = stream_filter_prepend($stream, 'zlib.inflate', STREAM_FILTER_WRITE, ['window' => 16 + 15]);
+ rewind($stream);
+ $fwrite_len = fwrite($stream, $out_data);
+ stream_filter_remove($inflate_filter);
- if ($out_data_len !== $fwrite_len) {
- echo "bug i=$i out_data_len=$out_data_len fwrite_len=$fwrite_len\n";
- }
+ if ($out_data_len !== $fwrite_len) {
+ echo "bug i=$i out_data_len=$out_data_len fwrite_len=$fwrite_len\n";
+ }
}
fclose($stream);
diff --git a/ext/zlib/tests/bug75299.phpt b/ext/zlib/tests/bug75299.phpt
index b9a9439f2e..9f07aa095a 100644
--- a/ext/zlib/tests/bug75299.phpt
+++ b/ext/zlib/tests/bug75299.phpt
@@ -11,10 +11,8 @@ $r = new ReflectionFunction('inflate_add');
var_dump($r->getNumberOfRequiredParameters());
var_dump($r->getNumberOfParameters());
?>
-===DONE===
--EXPECT--
int(1)
int(2)
int(2)
int(3)
-===DONE===
diff --git a/ext/zlib/tests/bug_34821.phpt b/ext/zlib/tests/bug_34821.phpt
index 53ef4d229e..8095bab23a 100644
--- a/ext/zlib/tests/bug_34821.phpt
+++ b/ext/zlib/tests/bug_34821.phpt
@@ -7,10 +7,10 @@ Bug #34821 (zlib encoders fail on widely varying binary data)
// test 50 bytes to 50k
$b = array(
- 50,
- 500,
- 5000,
- 50000,
+ 50,
+ 500,
+ 5000,
+ 50000,
// 1000000, // works, but test would take too long
);
@@ -18,12 +18,12 @@ $s = '';
$i = 0;
foreach ($b as $size) {
- do {
- $s .= chr(rand(0,255));
- } while (++$i < $size);
- var_dump($s === gzinflate(gzdeflate($s)));
- var_dump($s === gzuncompress(gzcompress($s)));
- var_dump($s === gzinflate(substr(gzencode($s), 10, -8)));
+ do {
+ $s .= chr(rand(0,255));
+ } while (++$i < $size);
+ var_dump($s === gzinflate(gzdeflate($s)));
+ var_dump($s === gzuncompress(gzcompress($s)));
+ var_dump($s === gzinflate(substr(gzencode($s), 10, -8)));
}
?>
--EXPECT--
diff --git a/ext/zlib/tests/deflate_add_block_v123.phpt b/ext/zlib/tests/deflate_add_block_v123.phpt
index c103dcb07d..6789e4496f 100644
--- a/ext/zlib/tests/deflate_add_block_v123.phpt
+++ b/ext/zlib/tests/deflate_add_block_v123.phpt
@@ -16,8 +16,6 @@ $resource = deflate_init(ZLIB_ENCODING_GZIP);
var_dump(deflate_add($resource, "aaaaaaaaaaaaaaaaaaaaaa", ZLIB_BLOCK));
?>
-===DONE===
--EXPECTF--
Warning: deflate_add(): zlib >= 1.2.4 required for BLOCK deflate; current version: %s in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/zlib/tests/deflate_add_buffer_full.phpt b/ext/zlib/tests/deflate_add_buffer_full.phpt
index dc6012dc13..95669fa1a3 100644
--- a/ext/zlib/tests/deflate_add_buffer_full.phpt
+++ b/ext/zlib/tests/deflate_add_buffer_full.phpt
@@ -45,9 +45,7 @@ $deflated = deflate_add(
echo bin2hex(substr($deflated, strlen($deflated) - 4)) . "\n";
?>
-===DONE===
--EXPECT--
0000ffff
0000ffff
0000ffff
-===DONE===
diff --git a/ext/zlib/tests/deflate_add_error.phpt b/ext/zlib/tests/deflate_add_error.phpt
index 060a005779..b2b7d7917c 100644
--- a/ext/zlib/tests/deflate_add_error.phpt
+++ b/ext/zlib/tests/deflate_add_error.phpt
@@ -9,15 +9,23 @@ if (!extension_loaded("zlib")) {
--FILE--
<?php
$badResource = fopen("php://memory", "r+");
-var_dump(deflate_add($badResource, "test"));
+
+try {
+ var_dump(deflate_add($badResource, "test"));
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
$resource = deflate_init(ZLIB_ENCODING_DEFLATE);
$badFlushType = 6789;
-var_dump(deflate_add($resource, "test", $badFlushType));
-?>
---EXPECTF--
-Warning: deflate_add(): Invalid deflate resource in %s on line %d
-bool(false)
-Warning: deflate_add(): flush mode must be ZLIB_NO_FLUSH, ZLIB_PARTIAL_FLUSH, ZLIB_SYNC_FLUSH, ZLIB_FULL_FLUSH, ZLIB_BLOCK or ZLIB_FINISH in %s on line %d
-bool(false)
+try {
+ var_dump(deflate_add($resource, "test", $badFlushType));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+?>
+--EXPECT--
+deflate_add(): supplied resource is not a valid zlib deflate resource
+Flush mode must be ZLIB_NO_FLUSH, ZLIB_PARTIAL_FLUSH, ZLIB_SYNC_FLUSH, ZLIB_FULL_FLUSH, ZLIB_BLOCK or ZLIB_FINISH
diff --git a/ext/zlib/tests/deflate_init_error.phpt b/ext/zlib/tests/deflate_init_error.phpt
index 340a3f1062..be3f0974d6 100644
--- a/ext/zlib/tests/deflate_init_error.phpt
+++ b/ext/zlib/tests/deflate_init_error.phpt
@@ -8,24 +8,41 @@ if (!extension_loaded("zlib")) {
?>
--FILE--
<?php
-var_dump(deflate_init(42));
-var_dump(deflate_init(ZLIB_ENCODING_DEFLATE, ['level' => 42]));
-var_dump(deflate_init(ZLIB_ENCODING_DEFLATE, ['level' => -2]));
-var_dump(deflate_init(ZLIB_ENCODING_DEFLATE, ['memory' => 0]));
-var_dump(deflate_init(ZLIB_ENCODING_DEFLATE, ['memory' => 10]));
-?>
---EXPECTF--
-Warning: deflate_init(): encoding mode must be ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or ZLIB_ENCODING_DEFLATE in %s on line %d
-bool(false)
-Warning: deflate_init(): compression level (42) must be within -1..9 in %s on line %d
-bool(false)
+try {
+ var_dump(deflate_init(42));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
-Warning: deflate_init(): compression level (-2) must be within -1..9 in %s on line %d
-bool(false)
+try {
+ var_dump(deflate_init(ZLIB_ENCODING_DEFLATE, ['level' => 42]));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
-Warning: deflate_init(): compression memory level (0) must be within 1..9 in %s on line %d
-bool(false)
+try {
+ var_dump(deflate_init(ZLIB_ENCODING_DEFLATE, ['level' => -2]));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
-Warning: deflate_init(): compression memory level (10) must be within 1..9 in %s on line %d
-bool(false)
+try {
+ var_dump(deflate_init(ZLIB_ENCODING_DEFLATE, ['memory' => 0]));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+try {
+ var_dump(deflate_init(ZLIB_ENCODING_DEFLATE, ['memory' => 10]));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+?>
+--EXPECT--
+Encoding mode must be ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or ZLIB_ENCODING_DEFLATE
+Compression level (42) must be within -1..9
+Compression level (-2) must be within -1..9
+Compression memory level (0) must be within 1..9
+Compression memory level (10) must be within 1..9
diff --git a/ext/zlib/tests/dictionary_usage.phpt b/ext/zlib/tests/dictionary_usage.phpt
index 0823b3ca94..195e9b216d 100644
--- a/ext/zlib/tests/dictionary_usage.phpt
+++ b/ext/zlib/tests/dictionary_usage.phpt
@@ -28,5 +28,5 @@ string(%d) "%s"
bool(true)
string(6) "abdcde"
-Warning: inflate_add(): dictionary does not match expected dictionary (incorrect adler32 hash) in %s on line %d
+Warning: inflate_add(): Dictionary does not match expected dictionary (incorrect adler32 hash) in %s on line %d
bool(false)
diff --git a/ext/zlib/tests/func.inc b/ext/zlib/tests/func.inc
index 7556f81e6a..73cfc4e06f 100644
--- a/ext/zlib/tests/func.inc
+++ b/ext/zlib/tests/func.inc
@@ -2,17 +2,17 @@
function get_zlib_version()
{
- $version = NULL;
+ $version = NULL;
- ob_start();
- phpinfo();
- $info = ob_get_contents();
- ob_end_clean();
- //if (preg_match(',zlib.*Compiled Version => (\d+\.\d+\.\d+),s', $info, $match)) {
- // $version = $match[1];
- if (preg_match(',zlib(?!.*libXML).*Compiled Version (=> |</).*(\d+\.\d+\.\d+?),sU', $info, $match)) {
- $version = $match[2];
- }
+ ob_start();
+ phpinfo();
+ $info = ob_get_contents();
+ ob_end_clean();
+ //if (preg_match(',zlib.*Compiled Version => (\d+\.\d+\.\d+),s', $info, $match)) {
+ // $version = $match[1];
+ if (preg_match(',zlib(?!.*libXML).*Compiled Version (=> |</).*(\d+\.\d+\.\d+?),sU', $info, $match)) {
+ $version = $match[2];
+ }
- return $version;
+ return $version;
}
diff --git a/ext/zlib/tests/gzclose_basic.phpt b/ext/zlib/tests/gzclose_basic.phpt
index 0393db2c57..f3387de09c 100644
--- a/ext/zlib/tests/gzclose_basic.phpt
+++ b/ext/zlib/tests/gzclose_basic.phpt
@@ -17,23 +17,27 @@ gzread($h, 20);
var_dump(gzclose($h));
//should fail.
-gzread($h, 20);
+try {
+ gzread($h, 20);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
$h = gzopen($f, 'r');
gzread($h, 20);
var_dump(fclose($h));
//should fail.
-gzread($h, 20);
+try {
+ gzread($h, 20);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
-===DONE===
---EXPECTF--
+--EXPECT--
bool(true)
-
-Warning: gzread(): supplied resource is not a valid stream resource in %s on line %d
+gzread(): supplied resource is not a valid stream resource
bool(true)
-
-Warning: gzread(): supplied resource is not a valid stream resource in %s on line %d
-===DONE===
+gzread(): supplied resource is not a valid stream resource
diff --git a/ext/zlib/tests/gzcompress_basic1.phpt b/ext/zlib/tests/gzcompress_basic1.phpt
index 882fd87fad..66231a3f98 100644
--- a/ext/zlib/tests/gzcompress_basic1.phpt
+++ b/ext/zlib/tests/gzcompress_basic1.phpt
@@ -34,7 +34,7 @@ for($i = -1; $i < 10; $i++) {
echo "-- Compression level $i --\n";
$output = gzcompress($data, $i);
var_dump(md5($output));
- var_dump(strcmp(gzuncompress($output), $data));
+ var_dump(strcmp(gzuncompress($output), $data));
}
// Compressing a smaller string
@@ -42,7 +42,7 @@ for($i = -1; $i < 10; $i++) {
echo "-- Compression level $i --\n";
$output = gzcompress($smallstring, $i);
var_dump(bin2hex($output));
- var_dump(strcmp(gzuncompress($output), $smallstring));
+ var_dump(strcmp(gzuncompress($output), $smallstring));
}
// Calling gzcompress() with mandatory arguments
@@ -50,7 +50,6 @@ echo "\n-- Testing with no specified compression level --\n";
var_dump( bin2hex(gzcompress($smallstring) ));
?>
-===Done===
--EXPECT--
*** Testing gzcompress() : basic functionality ***
-- Compression level -1 --
@@ -122,4 +121,3 @@ int(0)
-- Testing with no specified compression level --
string(70) "789c735428ce4dccc951282e29cacc4b5728c95748cecf2d284a2d2ee6020087a509cb"
-===Done===
diff --git a/ext/zlib/tests/gzcompress_error1.phpt b/ext/zlib/tests/gzcompress_error1.phpt
index 3f742a4dca..81fe35b27d 100644
--- a/ext/zlib/tests/gzcompress_error1.phpt
+++ b/ext/zlib/tests/gzcompress_error1.phpt
@@ -20,65 +20,31 @@ if (!extension_loaded("zlib")) {
echo "*** Testing gzcompress() : error conditions ***\n";
-// Zero arguments
-echo "\n-- Testing gzcompress() function with Zero arguments --\n";
-var_dump( gzcompress() );
-
-//Test gzcompress with one more than the expected number of arguments
-echo "\n-- Testing gzcompress() function with more than expected no. of arguments --\n";
-$data = 'string_val';
-$level = 2;
-$encoding = ZLIB_ENCODING_RAW;
-$extra_arg = 10;
-var_dump( gzcompress($data, $level, $encoding, $extra_arg) );
-
echo "\n-- Testing with incorrect compression level --\n";
+$data = 'string_val';
$bad_level = 99;
-var_dump(gzcompress($data, $bad_level));
+try {
+ var_dump(gzcompress($data, $bad_level));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "\n-- Testing with invalid encoding --\n";
$data = 'string_val';
+$level = 2;
$encoding = 99;
-var_dump(gzcompress($data, $level, $encoding));
-
-echo "\n-- Testing with incorrect parameters --\n";
-
-class Tester {
- function Hello() {
- echo "Hello\n";
- }
+try {
+ var_dump(gzcompress($data, $level, $encoding));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
}
-$testclass = new Tester();
-var_dump(gzcompress($testclass));
-
?>
-===Done===
---EXPECTF--
+--EXPECT--
*** Testing gzcompress() : error conditions ***
--- Testing gzcompress() function with Zero arguments --
-
-Warning: gzcompress() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
--- Testing gzcompress() function with more than expected no. of arguments --
-
-Warning: gzcompress() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-
-- Testing with incorrect compression level --
-
-Warning: gzcompress(): compression level (99) must be within -1..9 in %s on line %d
-bool(false)
+Compression level (99) must be within -1..9
-- Testing with invalid encoding --
-
-Warning: gzcompress(): encoding mode must be either ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or ZLIB_ENCODING_DEFLATE in %s on line %d
-bool(false)
-
--- Testing with incorrect parameters --
-
-Warning: gzcompress() expects parameter 1 to be string, object given in %s on line %d
-NULL
-===Done===
+Encoding mode must be either ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or ZLIB_ENCODING_DEFLATE
diff --git a/ext/zlib/tests/gzcompress_variation1.phpt b/ext/zlib/tests/gzcompress_variation1.phpt
index c4bc0a1ff5..df7f84a66e 100644
--- a/ext/zlib/tests/gzcompress_variation1.phpt
+++ b/ext/zlib/tests/gzcompress_variation1.phpt
@@ -24,11 +24,9 @@ var_dump( md5($output));
var_dump(md5(gzcompress($output)));
?>
-===Done===
--EXPECT--
*** Testing gzcompress() : variation ***
-- Testing multiple compression --
string(32) "764809aef15bb34cb73ad49ecb600d99"
string(32) "eba942bc2061f23ea8688cc5101872a4"
-===Done===
diff --git a/ext/zlib/tests/gzdeflate_basic1.phpt b/ext/zlib/tests/gzdeflate_basic1.phpt
index 8ab0ee6243..004637902e 100644
--- a/ext/zlib/tests/gzdeflate_basic1.phpt
+++ b/ext/zlib/tests/gzdeflate_basic1.phpt
@@ -34,7 +34,7 @@ for($i = -1; $i < 10; $i++) {
echo "-- Compression level $i --\n";
$output = gzdeflate($data, $i);
var_dump(md5($output));
- var_dump(strcmp(gzinflate($output), $data));
+ var_dump(strcmp(gzinflate($output), $data));
}
// Compressing a smaller string
@@ -42,7 +42,7 @@ for($i = -1; $i < 10; $i++) {
echo "-- Compression level $i --\n";
$output = gzdeflate($smallstring, $i);
var_dump(bin2hex($output));
- var_dump(strcmp(gzinflate($output), $smallstring));
+ var_dump(strcmp(gzinflate($output), $smallstring));
}
// Calling gzdeflate() with just mandatory arguments
@@ -50,7 +50,6 @@ echo "\n-- Testing with no specified compression level --\n";
var_dump( bin2hex(gzdeflate($smallstring) ));
?>
-===Done===
--EXPECT--
*** Testing gzdeflate() : basic functionality ***
-- Compression level -1 --
@@ -122,4 +121,3 @@ int(0)
-- Testing with no specified compression level --
string(58) "735428ce4dccc951282e29cacc4b5728c95748cecf2d284a2d2ee60200"
-===Done===
diff --git a/ext/zlib/tests/gzdeflate_error1.phpt b/ext/zlib/tests/gzdeflate_error1.phpt
index 93f8c03b4c..9cee96259e 100644
--- a/ext/zlib/tests/gzdeflate_error1.phpt
+++ b/ext/zlib/tests/gzdeflate_error1.phpt
@@ -20,67 +20,31 @@ if (!extension_loaded("zlib")) {
echo "*** Testing gzdeflate() : error conditions ***\n";
-// Zero arguments
-echo "\n-- Testing gzdeflate() function with Zero arguments --\n";
-var_dump( gzdeflate() );
-
-//Test gzdeflate with one more than the expected number of arguments
-echo "\n-- Testing gzdeflate() function with more than expected no. of arguments --\n";
$data = 'string_val';
-$level = 2;
-$encoding = ZLIB_ENCODING_RAW;
-$extra_arg = 10;
-var_dump( gzdeflate($data, $level, $encoding, $extra_arg) );
echo "\n-- Testing with incorrect compression level --\n";
$bad_level = 99;
-var_dump(gzdeflate($data, $bad_level));
+try {
+ var_dump(gzdeflate($data, $bad_level));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "\n-- Testing with incorrect encoding --\n";
+$level = 2;
$bad_encoding = 99;
-var_dump(gzdeflate($data, $level, $bad_encoding));
-
-class Tester {
- function Hello() {
- echo "Hello\n";
- }
+try {
+ var_dump(gzdeflate($data, $level, $bad_encoding));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
}
-echo "\n-- Testing with incorrect parameters --\n";
-$testclass = new Tester();
-var_dump(gzdeflate($testclass));
-var_dump(gzdeflate($data, $testclass));
-
?>
-===Done===
---EXPECTF--
+--EXPECT--
*** Testing gzdeflate() : error conditions ***
--- Testing gzdeflate() function with Zero arguments --
-
-Warning: gzdeflate() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
--- Testing gzdeflate() function with more than expected no. of arguments --
-
-Warning: gzdeflate() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-
-- Testing with incorrect compression level --
-
-Warning: gzdeflate(): compression level (99) must be within -1..9 in %s on line %d
-bool(false)
+Compression level (99) must be within -1..9
-- Testing with incorrect encoding --
-
-Warning: gzdeflate(): encoding mode must be either ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or ZLIB_ENCODING_DEFLATE in %s on line %d
-bool(false)
-
--- Testing with incorrect parameters --
-
-Warning: gzdeflate() expects parameter 1 to be string, object given in %s on line %d
-NULL
-
-Warning: gzdeflate() expects parameter 2 to be int, object given in %s on line %d
-NULL
-===Done===
+Encoding mode must be either ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or ZLIB_ENCODING_DEFLATE
diff --git a/ext/zlib/tests/gzdeflate_variation1.phpt b/ext/zlib/tests/gzdeflate_variation1.phpt
index 7993abb529..de632e8f7d 100644
--- a/ext/zlib/tests/gzdeflate_variation1.phpt
+++ b/ext/zlib/tests/gzdeflate_variation1.phpt
@@ -26,11 +26,9 @@ var_dump( md5($output));
var_dump(md5(gzdeflate($output)));
?>
-===Done===
--EXPECT--
*** Testing gzdeflate() : variation ***
-- Testing multiple compression --
string(32) "078554fe65e06f6ff01eab51cfc7ae9b"
string(32) "86b9f895ef1377da5269ec3cb2729f71"
-===Done===
diff --git a/ext/zlib/tests/gzencode_basic1.phpt b/ext/zlib/tests/gzencode_basic1.phpt
index dfb09cc2ed..bd23ad77e2 100644
--- a/ext/zlib/tests/gzencode_basic1.phpt
+++ b/ext/zlib/tests/gzencode_basic1.phpt
@@ -35,7 +35,7 @@ for($i = -1; $i < 10; $i++) {
$output = gzencode($data, $i);
// Clear OS byte before encode
- $output[9] = "\x00";
+ $output[9] = "\x00";
var_dump(md5($output));
}
@@ -46,7 +46,7 @@ for($i = -1; $i < 10; $i++) {
$output = gzencode($smallstring, $i);
// Clear OS byte before encode
- $output[9] = "\x00";
+ $output[9] = "\x00";
var_dump(md5($output));
}
@@ -59,7 +59,6 @@ echo "\n-- Testing gzencode with mode specified --\n";
var_dump(bin2hex(gzencode($smallstring, -1, FORCE_GZIP)));
?>
-===Done===
--EXPECTF--
*** Testing gzencode() : basic functionality ***
-- Compression level -1 --
@@ -112,4 +111,3 @@ string(94) "1f8b08000000000000%c%c735428ce4dccc951282e29cacc4b5728c95748cecf2d28
-- Testing gzencode with mode specified --
string(94) "1f8b08000000000000%c%c735428ce4dccc951282e29cacc4b5728c95748cecf2d284a2d2ee60200edc4e40b1b000000"
-===Done===
diff --git a/ext/zlib/tests/gzencode_error1.phpt b/ext/zlib/tests/gzencode_error1.phpt
index ac846866c5..6c0974a6f6 100644
--- a/ext/zlib/tests/gzencode_error1.phpt
+++ b/ext/zlib/tests/gzencode_error1.phpt
@@ -20,79 +20,32 @@ if (!extension_loaded("zlib")) {
echo "*** Testing gzencode() : error conditions ***\n";
-// Zero arguments
-echo "\n-- Testing gzencode() function with Zero arguments --\n";
-var_dump( gzencode() );
-
-//Test gzencode with one more than the expected number of arguments
-echo "\n-- Testing gzencode() function with more than expected no. of arguments --\n";
$data = 'string_val';
$level = 2;
$encoding_mode = FORCE_DEFLATE;
-$extra_arg = 10;
-var_dump( gzencode($data, $level, $encoding_mode, $extra_arg) );
echo "\n-- Testing with incorrect compression level --\n";
$bad_level = 99;
-var_dump(gzencode($data, $bad_level));
+try {
+ var_dump(gzencode($data, $bad_level));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
echo "\n-- Testing with incorrect encoding_mode --\n";
$bad_mode = 99;
-var_dump(gzencode($data, $level, $bad_mode));
-
-class Tester {
- function Hello() {
- echo "Hello\n";
- }
+try {
+ var_dump(gzencode($data, $level, $bad_mode));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
}
-echo "\n-- Testing with incorrect parameters --\n";
-$testclass = new Tester();
-var_dump(gzencode($testclass));
-var_dump(gzencode($data, $testclass));
-var_dump(gzencode($data, -1, 99.99));
-var_dump(gzencode($data, -1, $testclass));
-var_dump(gzencode($data, "a very none numeric string\n"));
-
?>
-===Done===
---EXPECTF--
+--EXPECT--
*** Testing gzencode() : error conditions ***
--- Testing gzencode() function with Zero arguments --
-
-Warning: gzencode() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
--- Testing gzencode() function with more than expected no. of arguments --
-
-Warning: gzencode() expects at most 3 parameters, 4 given in %s on line %d
-NULL
-
-- Testing with incorrect compression level --
-
-Warning: gzencode(): compression level (99) must be within -1..9 in %s on line %d
-bool(false)
+Compression level (99) must be within -1..9
-- Testing with incorrect encoding_mode --
-
-Warning: gzencode(): encoding mode must be either ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or ZLIB_ENCODING_DEFLATE in %s on line %d
-bool(false)
-
--- Testing with incorrect parameters --
-
-Warning: gzencode() expects parameter 1 to be string, object given in %s on line %d
-NULL
-
-Warning: gzencode() expects parameter 2 to be int, object given in %s on line %d
-NULL
-
-Warning: gzencode(): encoding mode must be either ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or ZLIB_ENCODING_DEFLATE in %s on line %d
-bool(false)
-
-Warning: gzencode() expects parameter 3 to be int, object given in %s on line %d
-NULL
-
-Warning: gzencode() expects parameter 2 to be int, string given in %s on line %d
-NULL
-===Done===
+Encoding mode must be either ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or ZLIB_ENCODING_DEFLATE
diff --git a/ext/zlib/tests/gzencode_variation1-win32.phpt b/ext/zlib/tests/gzencode_variation1-win32.phpt
index 798924f9fe..140ac6286b 100644
--- a/ext/zlib/tests/gzencode_variation1-win32.phpt
+++ b/ext/zlib/tests/gzencode_variation1-win32.phpt
@@ -20,10 +20,10 @@ if (!extension_loaded("zlib")) {
*/
if(!function_exists("gzdecode")) {
- function gzdecode($data)
- {
- return gzinflate(substr($data,10,-8));
- }
+ function gzdecode($data)
+ {
+ return gzinflate(substr($data,10,-8));
+ }
}
@@ -37,10 +37,8 @@ $output = gzencode(gzencode($data));
$back = gzdecode(gzdecode($output));
var_dump($data === $back);
?>
-===Done===
--EXPECT--
*** Testing gzencode() : variation ***
-- Testing multiple compression --
bool(true)
-===Done===
diff --git a/ext/zlib/tests/gzencode_variation1.phpt b/ext/zlib/tests/gzencode_variation1.phpt
index 2f953168fa..3c49e635cf 100644
--- a/ext/zlib/tests/gzencode_variation1.phpt
+++ b/ext/zlib/tests/gzencode_variation1.phpt
@@ -32,10 +32,8 @@ $output = gzencode($data);
var_dump(bin2hex(gzencode($output)));
?>
-===Done===
--EXPECT--
*** Testing gzencode() : variation ***
-- Testing multiple compression --
string(3658) "1f8b0800000000000003010e07f1f81f8b08000000000000036d574d6fe4c80dbdeb57d4ad2f3dfe01eb83e1ec22980e309b4562c067b64449159754dafab0b6e7d7e73d96da1e4c72184c4b2ab2c8f7c847fa25baabba98dc1a8b2b7c38bb324b713ee37f757f56cdc5c7f5b17b9d152f923b157c5ae335e0b75fedd0e2d781c6b98ea3a6ee05affe1dfc3a6527f8f09c52dcb38ba38bb5249934d6ecfe1e53a9ab76ff4c342cf2a64ed2028349fc9a8b139755685352acb82b9fbb67f8bade5cdcb698e1fcec94b7ceba3cb897e806cfc8114350dd1ebbdfa35b62d2478b0056d23ed809b9b95d696d91ce2aa97c911e3fa539c43f84c887554a4d125c9e63ff96711cc08c0866263cb37a0bbe2122ae8f6baecb2284abfb4ddf916db8354cddeef37c1afe5fa02fc7afb3db34f5b3acbdf2eb905490d8f38d7468d253a323d5ebb903760d7944d3b2024e834a99ddce77669bdd823cfbb8e899d4ad4c799677452e6029e80023a03b2374005590641f7d3877df2ad09f3c0e82a54d6a5644fd63049a37ed4bc362016fd9f51264f1e5c630727421ae930b7ed416e93e47b7c71a400390361ffbecb7561bb98f69b5da289e91becc27f08b3b724cb8704f9144d366431d0cb870c56b205deaa2e17636063761a911039fb7e4bf9f06c4f0aecd2ec80e8b41831ca7515e31286166458ea3ef71f2ce7cde2ae269c96d60525724a9c9170b713ed5750758f3cd2a361fc8b288fc92358ce884692e8ea0fe59bd969a0da2eed5831b715749eaae7178f3ebd30fb88c92105f367cce2c882955dc6bf8eca0d5d57540b3092894743ba0fd5b2dad021836191f1afc0bba14dde1642cb0b1aa6879c38907dcefa0720082b801bec61417469219175267dfa047df35b0bd1332001c28cdfafd3bcabe91e74368cdd8d8478e494c190e7ee90c67f2bde288e68ab6b15e883c995be4f8feb6c6dda4278e4f38578ddbdc7be36788daf0c3cb1d1819c73822f7000a0d1813fa94153b572315e51343b536bc64977dff163cebfd8418773261f524017e251fccc60ae29a5770ae097594d52e9c1229d87ce967a36401c46b69945afb249d101c9d420ffa9a123e232c20e76467d5d169202a2dd4c582949e013e745df7958d4b0cc4fd4377a737cd4feea7974070000f314d423e0634cb9a618fdf5dc64fd422181fd59c9230c9f6f9d18dc8fc23e9cccbc7188733b04aa57de83ebea0be3633cff5fa1ff83269be7f44f5a8d84550cc703255fd345dd402034d0b3e11a73ec6e3d4a77f4f685b614329f1b3132ae7af33d02e1e55e291fa6574b758d1f0200e7423dbc852211818043a7c9ce80aa9d59fce0401959f5ea2cf71fde90824f8c9192dbe9d329db143794675ddcf257dd7755273b67340414e3ccad12e3f661f8aad9cf9957dc1275d10a51d3934fa81e68dc6768fb8ee23e373936c8e13feab8b0f50d227f7af76f561fb0950f3d099bbc316c3892a42fb36806d8660e800fa4f43fd4b962d2097d71933a54b77ff948677848eb17bb3a88b621682cfb3bbb49cf42fed6b3944124ad8358ca688aa44dd5f2144c7c9ab16f25b9aca9654ef357ec9ad55c40d324d6cc3d9e3920b863c231d31a95d937fb5520f9c816c79b7dcecc593fb9593cc05a51ebb1eeddd5b49eb437769738d0f64adc579d372b8b7f7c0208487ee3915ebf5766e148ebd77cf4e01f3ec285047011e55838968b6494d517fe29224777b24dd3ddf933101695b102e87db805eef291b74dcfd91628fb2a53f93dbd2968ef2e598746c9204f89fba1f0246fc671610a0591806e46a1346f77c40d910a47c5e20ffb23f003c04b648327a4ed98032c1965bd35bb0044f5344248f56fdb99aa61d6451d68e33489a83bffbe6573541b2da5f64681ea12090f778b2075374778810f73965fa3626a9d41f4df2f83f7c34658cec921b5a9bde49dd5007ec882b02adc514f81aa85898b5cc98e1b137733c0a8789b7f5648d2d231b80bf74978f25d61ce08a8abd11801fd8f995e066676307192ff7641f1cc6e0dee68565b8b22ac3889cd067bf732754a6b270af1044c6a8776811a4f6d8bd0477a9f516064201b920b92d7cd4dc7eee13e6b3eb3528a82f9abb3f388ebe6a8f871393461b73816ec54c99d604174bc5a6801de13908f86aea6a7d0fea107d682bcf1ec348b83872e6b8a316ecd02eb8f8dc86a609bf59a2dd03f1dfa4079436d55e24617be1a2854d008b2b2b1705e2078a7f3946318df1c24f6bf70d4b456eca286ec2b585b28262cc048a098c3e2d5f325a92bb36f691afdc14c822da1b116c9c1c07bb362eb0a04b78834c812134230ebf2044ac2e3c0e3ad00f848dc5010f3bf917ec2fc700b7bf26dacea8440620e04f90f4d97d6dd77cfde8a05c7d3930f1e5811fb8ec5c70964dcc8187ec90e32fdd6b64eec7586413b7d55bed65c4cce39a9b6c15e70e9da94e53fc904e6286f01f5b5562c94211befbc23507e01b2a3865e2f45b5d7b591f290087a5605b82495b4e393f31aa5b37211ec40241a746d903c5eebf117a4d3ddb0d00007b64cbc70e070000"
-===Done===
diff --git a/ext/zlib/tests/gzencode_variation2-win32.phpt b/ext/zlib/tests/gzencode_variation2-win32.phpt
index 9936ec8d3b..e2a379ed13 100644
--- a/ext/zlib/tests/gzencode_variation2-win32.phpt
+++ b/ext/zlib/tests/gzencode_variation2-win32.phpt
@@ -34,7 +34,6 @@ var_dump(bin2hex(gzencode($data, -1, FORCE_GZIP)));
var_dump(bin2hex(gzencode($data, -1, FORCE_DEFLATE)));
?>
-===DONE===
--EXPECT--
*** Testing gzencode() : variation ***
@@ -42,4 +41,3 @@ var_dump(bin2hex(gzencode($data, -1, FORCE_DEFLATE)));
string(90) "1f8b080000000000000a735428ce4dccc951282e29cacc4b5728c95748cd4bce4f49e50200d7739de519000000"
string(90) "1f8b080000000000000a735428ce4dccc951282e29cacc4b5728c95748cd4bce4f49e50200d7739de519000000"
string(66) "789c735428ce4dccc951282e29cacc4b5728c95748cd4bce4f49e50200735808cd"
-===DONE===
diff --git a/ext/zlib/tests/gzencode_variation2.phpt b/ext/zlib/tests/gzencode_variation2.phpt
index 9160cf5197..a290796848 100644
--- a/ext/zlib/tests/gzencode_variation2.phpt
+++ b/ext/zlib/tests/gzencode_variation2.phpt
@@ -33,7 +33,6 @@ var_dump(bin2hex(gzencode($data, -1, FORCE_GZIP)));
var_dump(bin2hex(gzencode($data, -1, FORCE_DEFLATE)));
?>
-===DONE===
--EXPECT--
*** Testing gzencode() : variation ***
@@ -41,4 +40,3 @@ var_dump(bin2hex(gzencode($data, -1, FORCE_DEFLATE)));
string(90) "1f8b0800000000000003735428ce4dccc951282e29cacc4b5728c95748cd4bce4f49e50200d7739de519000000"
string(90) "1f8b0800000000000003735428ce4dccc951282e29cacc4b5728c95748cd4bce4f49e50200d7739de519000000"
string(66) "789c735428ce4dccc951282e29cacc4b5728c95748cd4bce4f49e50200735808cd"
-===DONE===
diff --git a/ext/zlib/tests/gzeof_basic.phpt b/ext/zlib/tests/gzeof_basic.phpt
index 33d46599c3..c159819d76 100644
--- a/ext/zlib/tests/gzeof_basic.phpt
+++ b/ext/zlib/tests/gzeof_basic.phpt
@@ -36,7 +36,6 @@ gzclose($h);
?>
-===DONE===
--EXPECT--
-- test 1 --
bool(false)
@@ -55,4 +54,3 @@ reading 250 characters. eof should be true
bool(true)
reading 20 characters. eof should be true still
bool(true)
-===DONE===
diff --git a/ext/zlib/tests/gzeof_variation1.phpt b/ext/zlib/tests/gzeof_variation1.phpt
index 4a845917af..2dded2ca1a 100644
--- a/ext/zlib/tests/gzeof_variation1.phpt
+++ b/ext/zlib/tests/gzeof_variation1.phpt
@@ -18,14 +18,14 @@ var_dump(gzeof($h));
gzwrite( $h, $str, $length);
var_dump(gzeof($h));
gzclose($h);
-var_dump(gzeof($h));
+try {
+ var_dump(gzeof($h));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
unlink($filename);
?>
-===DONE===
---EXPECTF--
+--EXPECT--
bool(false)
bool(false)
-
-Warning: gzeof(): supplied resource is not a valid stream resource in %s on line %d
-bool(false)
-===DONE===
+gzeof(): supplied resource is not a valid stream resource
diff --git a/ext/zlib/tests/gzfile_basic.phpt b/ext/zlib/tests/gzfile_basic.phpt
index 56bc8b2d7a..249e225714 100644
--- a/ext/zlib/tests/gzfile_basic.phpt
+++ b/ext/zlib/tests/gzfile_basic.phpt
@@ -24,7 +24,6 @@ var_dump(gzfile( $filename ) );
unlink($filename);
rmdir($dirname);
?>
-===DONE===
--EXPECT--
array(3) {
[0]=>
@@ -36,4 +35,3 @@ array(3) {
[2]=>
string(17) "for all languages"
}
-===DONE===
diff --git a/ext/zlib/tests/gzfile_basic2.phpt b/ext/zlib/tests/gzfile_basic2.phpt
index 0a968ce394..7507164304 100644
--- a/ext/zlib/tests/gzfile_basic2.phpt
+++ b/ext/zlib/tests/gzfile_basic2.phpt
@@ -24,7 +24,6 @@ var_dump(gzfile( $filename ) );
unlink($filename);
rmdir($dirname);
?>
-===DONE===
--EXPECT--
array(3) {
[0]=>
@@ -36,4 +35,3 @@ array(3) {
[2]=>
string(17) "for all languages"
}
-===DONE===
diff --git a/ext/zlib/tests/gzfile_variation11.phpt b/ext/zlib/tests/gzfile_variation11.phpt
index 76f0a537b5..2d0c73e647 100644
--- a/ext/zlib/tests/gzfile_variation11.phpt
+++ b/ext/zlib/tests/gzfile_variation11.phpt
@@ -25,7 +25,6 @@ foreach ( $variation as $var ) {
var_dump(gzfile( $filename, $var ) );
}
?>
-===DONE===
--EXPECT--
array(6) {
[0]=>
@@ -127,4 +126,3 @@ array(6) {
string(39) "and I know that it descends down on me
"
}
-===DONE===
diff --git a/ext/zlib/tests/gzfile_variation12.phpt b/ext/zlib/tests/gzfile_variation12.phpt
index 6b9aec5334..d63d444097 100644
--- a/ext/zlib/tests/gzfile_variation12.phpt
+++ b/ext/zlib/tests/gzfile_variation12.phpt
@@ -23,7 +23,6 @@ foreach ( $variation as $var ) {
var_dump(gzfile( $filename, $var ) );
}
?>
-===DONE===
--EXPECT--
array(6) {
[0]=>
@@ -105,4 +104,3 @@ array(6) {
string(39) "and I know that it descends down on me
"
}
-===DONE===
diff --git a/ext/zlib/tests/gzfile_variation15.phpt b/ext/zlib/tests/gzfile_variation15.phpt
index 77028fbd09..01958214bc 100644
--- a/ext/zlib/tests/gzfile_variation15.phpt
+++ b/ext/zlib/tests/gzfile_variation15.phpt
@@ -78,7 +78,6 @@ function test_gzfile() {
}
?>
-===DONE===
--EXPECT--
array(1) {
[0]=>
@@ -105,4 +104,3 @@ array(1) {
string(28) "This is a file in script dir"
}
-===DONE===
diff --git a/ext/zlib/tests/gzfile_variation3.phpt b/ext/zlib/tests/gzfile_variation3.phpt
index 5871b34f78..bd6e7a5086 100644
--- a/ext/zlib/tests/gzfile_variation3.phpt
+++ b/ext/zlib/tests/gzfile_variation3.phpt
@@ -28,7 +28,6 @@ foreach ( $variation as $var ) {
var_dump(gzfile( $var , $use_include_path ) );
}
?>
-===DONE===
--EXPECTF--
Warning: gzfile(): Filename cannot be empty in %s on line %d
bool(false)
@@ -47,4 +46,3 @@ bool(false)
Warning: gzfile(): Filename cannot be empty in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/zlib/tests/gzfile_variation4.phpt b/ext/zlib/tests/gzfile_variation4.phpt
index 9b3128125a..e3a90207a0 100644
--- a/ext/zlib/tests/gzfile_variation4.phpt
+++ b/ext/zlib/tests/gzfile_variation4.phpt
@@ -24,20 +24,18 @@ foreach ( $variation as $var ) {
var_dump(gzfile( $var , $use_include_path ) );
}
?>
-===DONE===
--EXPECTF--
-Warning: gzfile(10.5): failed to open stream: No such file or directory in %s on line %d
+Warning: gzfile(10.5): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-Warning: gzfile(-10.5): failed to open stream: No such file or directory in %s on line %d
+Warning: gzfile(-10.5): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-Warning: gzfile(123456789000): failed to open stream: No such file or directory in %s on line %d
+Warning: gzfile(123456789000): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-Warning: gzfile(-123456789000): failed to open stream: No such file or directory in %s on line %d
+Warning: gzfile(-123456789000): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-Warning: gzfile(0.5): failed to open stream: No such file or directory in %s on line %d
+Warning: gzfile(0.5): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/zlib/tests/gzfile_variation5.phpt b/ext/zlib/tests/gzfile_variation5.phpt
index 1627d2eb11..be3a95f600 100644
--- a/ext/zlib/tests/gzfile_variation5.phpt
+++ b/ext/zlib/tests/gzfile_variation5.phpt
@@ -23,17 +23,15 @@ foreach ( $variation as $var ) {
var_dump(gzfile( $var , $use_include_path ) );
}
?>
-===DONE===
--EXPECTF--
-Warning: gzfile(0): failed to open stream: No such file or directory in %s on line %d
+Warning: gzfile(0): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-Warning: gzfile(1): failed to open stream: No such file or directory in %s on line %d
+Warning: gzfile(1): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-Warning: gzfile(12345): failed to open stream: No such file or directory in %s on line %d
+Warning: gzfile(12345): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-Warning: gzfile(-2345): failed to open stream: No such file or directory in %s on line %d
+Warning: gzfile(-2345): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/zlib/tests/gzfile_variation7.phpt b/ext/zlib/tests/gzfile_variation7.phpt
index 04fa2e666b..6c9807b733 100644
--- a/ext/zlib/tests/gzfile_variation7.phpt
+++ b/ext/zlib/tests/gzfile_variation7.phpt
@@ -27,17 +27,15 @@ foreach ( $variation_array as $var ) {
var_dump(gzfile( $var , $use_include_path ) );
}
?>
-===DONE===
--EXPECTF--
-Warning: gzfile(string): failed to open stream: No such file or directory in %s on line %d
+Warning: gzfile(string): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-Warning: gzfile(string): failed to open stream: No such file or directory in %s on line %d
+Warning: gzfile(string): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-Warning: gzfile(sTrInG): failed to open stream: No such file or directory in %s on line %d
+Warning: gzfile(sTrInG): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-Warning: gzfile(hello world): failed to open stream: No such file or directory in %s on line %d
+Warning: gzfile(hello world): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/zlib/tests/gzfile_variation9.phpt b/ext/zlib/tests/gzfile_variation9.phpt
index 8fa994026f..4b848b4037 100644
--- a/ext/zlib/tests/gzfile_variation9.phpt
+++ b/ext/zlib/tests/gzfile_variation9.phpt
@@ -22,7 +22,6 @@ foreach ( $variation as $var ) {
var_dump(gzfile( $filename, $var ) );
}
?>
-===DONE===
--EXPECT--
array(6) {
[0]=>
@@ -104,4 +103,3 @@ array(6) {
string(39) "and I know that it descends down on me
"
}
-===DONE===
diff --git a/ext/zlib/tests/gzgetc_basic.phpt b/ext/zlib/tests/gzgetc_basic.phpt
index 73dc128bf2..c9b7fcf615 100644
--- a/ext/zlib/tests/gzgetc_basic.phpt
+++ b/ext/zlib/tests/gzgetc_basic.phpt
@@ -29,7 +29,6 @@ echo "\ncharacters counted=$count\n";
gzclose($h);
?>
-===DONE===
--EXPECT--
When you're taught through feelings
Destiny flying high above
@@ -39,4 +38,3 @@ as it turns around
and I know that it descends down on me
characters counted=176
-===DONE===
diff --git a/ext/zlib/tests/gzgetc_basic_1.phpt b/ext/zlib/tests/gzgetc_basic_1.phpt
index b555877c8c..b2a1a056af 100644
--- a/ext/zlib/tests/gzgetc_basic_1.phpt
+++ b/ext/zlib/tests/gzgetc_basic_1.phpt
@@ -19,18 +19,17 @@ if (version_compare(get_zlib_version(), '1.2.7') < 0) {
$f = __DIR__."/004.txt.gz";
$h = gzopen($f, 'r');
if ($h) {
- $count = 0;
- while (($c = fgetc( $h )) !== false) {
- $count++;
- echo $c;
- }
+ $count = 0;
+ while (($c = fgetc( $h )) !== false) {
+ $count++;
+ echo $c;
+ }
- echo "\ncharacters counted=$count\n";
- gzclose($h);
+ echo "\ncharacters counted=$count\n";
+ gzclose($h);
}
?>
-===DONE===
--EXPECT--
When you're taught through feelings
Destiny flying high above
@@ -40,4 +39,3 @@ as it turns around
and I know that it descends down on me
characters counted=176
-===DONE===
diff --git a/ext/zlib/tests/gzgets_basic.phpt b/ext/zlib/tests/gzgets_basic.phpt
index 8f2e1c0a20..80ef741423 100644
--- a/ext/zlib/tests/gzgets_basic.phpt
+++ b/ext/zlib/tests/gzgets_basic.phpt
@@ -26,7 +26,6 @@ gzclose($h);
?>
-===DONE===
--EXPECT--
string(9) "When you'"
string(13) "re taught thr"
@@ -43,4 +42,3 @@ string(19) "as it turns around
"
string(39) "and I know that it descends down on me
"
-===DONE===
diff --git a/ext/zlib/tests/gzgetss.phpt b/ext/zlib/tests/gzgetss.phpt
deleted file mode 100644
index 58d13ab733..0000000000
--- a/ext/zlib/tests/gzgetss.phpt
+++ /dev/null
@@ -1,32 +0,0 @@
---TEST--
-gzgetss — Get line from gz-file pointer and strip HTML tags - function
---CREDITS--
-marcosptf - <marcosptf@yahoo.com.br>
---SKIPIF--
-<?php
-if(!extension_loaded("zlib")){die("skip - ZLIB extension not loaded");}
-?>
---FILE--
-<?php
-$handle = gzopen(__DIR__ . '/gzgetss.gz', 'r');
-
-while (!gzeof($handle)){
- $buffer = gzgetss($handle, 4096, "<code>");
- print($buffer);
-}
-gzclose($handle);
-?>
---EXPECTF--
-Deprecated: Function gzgetss() is deprecated in %s on line %d
-
-
-Deprecated: Function gzgetss() is deprecated in %s on line %d
-
-
-Deprecated: Function gzgetss() is deprecated in %s on line %d
- <code>stringgzgetss(resource $zp, int $length [, string $allowable_tags ]);<code/>
-
-Deprecated: Function gzgetss() is deprecated in %s on line %d
-
-
-Deprecated: Function gzgetss() is deprecated in %s on line %d
diff --git a/ext/zlib/tests/gzinflate_error1.phpt b/ext/zlib/tests/gzinflate_error1.phpt
index fd65f54e55..870a2c2265 100644
--- a/ext/zlib/tests/gzinflate_error1.phpt
+++ b/ext/zlib/tests/gzinflate_error1.phpt
@@ -18,58 +18,18 @@ include(__DIR__ . '/data.inc');
echo "*** Testing gzinflate() : error conditions ***\n";
-echo "\n-- Testing gzcompress() function with Zero arguments --\n";
-var_dump( gzinflate() );
-
-echo "\n-- Testing gzcompress() function with more than expected no. of arguments --\n";
-$data = 'string_val';
-$length = 10;
-$extra_arg = 10;
-var_dump( gzinflate($data, $length, $extra_arg) );
-
echo "\n-- Testing with a buffer that is too small --\n";
+$data = 'string_val';
$short_len = strlen($data) - 1;
$compressed = gzcompress($data);
var_dump(gzinflate($compressed, $short_len));
-echo "\n-- Testing with incorrect parameters --\n";
-
-class Tester {
- function Hello() {
- echo "Hello\n";
- }
-}
-
-$testclass = new Tester();
-var_dump(gzinflate($testclass));
-var_dump(gzinflate($data, $testclass));
-
?>
-===DONE===
--EXPECTF--
*** Testing gzinflate() : error conditions ***
--- Testing gzcompress() function with Zero arguments --
-
-Warning: gzinflate() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
--- Testing gzcompress() function with more than expected no. of arguments --
-
-Warning: gzinflate() expects at most 2 parameters, 3 given in %s on line %d
-NULL
-
-- Testing with a buffer that is too small --
Warning: gzinflate(): data error in %s on line %d
bool(false)
-
--- Testing with incorrect parameters --
-
-Warning: gzinflate() expects parameter 1 to be string, object given in %s on line %d
-NULL
-
-Warning: gzinflate() expects parameter 2 to be int, object given in %s on line %d
-NULL
-===DONE===
diff --git a/ext/zlib/tests/gzopen_basic.phpt b/ext/zlib/tests/gzopen_basic.phpt
index 4ef34aea68..d6a2ab9b5c 100644
--- a/ext/zlib/tests/gzopen_basic.phpt
+++ b/ext/zlib/tests/gzopen_basic.phpt
@@ -33,7 +33,6 @@ gzpassthru($h);
gzclose($h);
?>
-===DONE===
--EXPECT--
*** Testing gzopen() : basic functionality ***
When you're taught through feelings
@@ -48,4 +47,3 @@ all I know is that you can realize it
Destiny who cares
as it turns around
and I know that it descends down on me
-===DONE===
diff --git a/ext/zlib/tests/gzopen_basic2.phpt b/ext/zlib/tests/gzopen_basic2.phpt
index dd3ba18235..5893270bb5 100644
--- a/ext/zlib/tests/gzopen_basic2.phpt
+++ b/ext/zlib/tests/gzopen_basic2.phpt
@@ -40,13 +40,11 @@ foreach($modes as $mode) {
}
?>
-===DONE===
--EXPECTF--
*** Testing gzopen() : basic functionality ***
testing mode -- w --
This was the information that was written
testing mode -- w+ --
-Warning: gzopen(): cannot open a zlib stream for reading and writing at the same time! in %s on line %d
+Warning: gzopen(): Cannot open a zlib stream for reading and writing at the same time! in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/zlib/tests/gzopen_include_path.inc b/ext/zlib/tests/gzopen_include_path.inc
index add04f74de..ca3da43489 100644
--- a/ext/zlib/tests/gzopen_include_path.inc
+++ b/ext/zlib/tests/gzopen_include_path.inc
@@ -11,82 +11,82 @@ $newdirs = array($dir1, $dir2, $dir3);
$reldirs = array("dir1", "dir2", "dir3");
function generate_next_rel_path() {
- global $reldirs;
- //create the include directory structure
- $pathSep = ":";
- $newIncludePath = "";
- if(substr(PHP_OS, 0, 3) == 'WIN' ) {
- $pathSep = ";";
- }
- foreach($reldirs as $newdir) {
- $newIncludePath .= $newdir.$pathSep;
- }
- return "dir4".$pathSep . $newIncludePath;
+ global $reldirs;
+ //create the include directory structure
+ $pathSep = ":";
+ $newIncludePath = "";
+ if(substr(PHP_OS, 0, 3) == 'WIN' ) {
+ $pathSep = ";";
+ }
+ foreach($reldirs as $newdir) {
+ $newIncludePath .= $newdir.$pathSep;
+ }
+ return "dir4".$pathSep . $newIncludePath;
}
function generate_next_path() {
- global $newdirs, $dir4;
- //create the include directory structure
- $pathSep = ":";
- $newIncludePath = "";
- if(substr(PHP_OS, 0, 3) == 'WIN' ) {
- $pathSep = ";";
- }
- foreach($newdirs as $newdir) {
- $newIncludePath .= $newdir.$pathSep;
- }
- return $dir4.$pathSep . $newIncludePath;
+ global $newdirs, $dir4;
+ //create the include directory structure
+ $pathSep = ":";
+ $newIncludePath = "";
+ if(substr(PHP_OS, 0, 3) == 'WIN' ) {
+ $pathSep = ";";
+ }
+ foreach($newdirs as $newdir) {
+ $newIncludePath .= $newdir.$pathSep;
+ }
+ return $dir4.$pathSep . $newIncludePath;
}
function create_include_path() {
- global $newdirs;
- //create the include directory structure
- $pathSep = ":";
- $newIncludePath = "";
- if(substr(PHP_OS, 0, 3) == 'WIN' ) {
- $pathSep = ";";
- }
- foreach($newdirs as $newdir) {
- mkdir($newdir);
- $newIncludePath .= $newdir.$pathSep;
- }
- return $newIncludePath;
+ global $newdirs;
+ //create the include directory structure
+ $pathSep = ":";
+ $newIncludePath = "";
+ if(substr(PHP_OS, 0, 3) == 'WIN' ) {
+ $pathSep = ";";
+ }
+ foreach($newdirs as $newdir) {
+ mkdir($newdir);
+ $newIncludePath .= $newdir.$pathSep;
+ }
+ return $newIncludePath;
}
function relative_include_path() {
- global $reldirs;
- //create the include directory structure
- $pathSep = ":";
- $newIncludePath = "";
- if(substr(PHP_OS, 0, 3) == 'WIN' ) {
- $pathSep = ";";
- }
- foreach($reldirs as $newdir) {
- mkdir($newdir);
- $newIncludePath .= $newdir.$pathSep;
- }
- return $newIncludePath;
+ global $reldirs;
+ //create the include directory structure
+ $pathSep = ":";
+ $newIncludePath = "";
+ if(substr(PHP_OS, 0, 3) == 'WIN' ) {
+ $pathSep = ";";
+ }
+ foreach($reldirs as $newdir) {
+ mkdir($newdir);
+ $newIncludePath .= $newdir.$pathSep;
+ }
+ return $newIncludePath;
}
function teardown_include_path() {
- global $newdirs;
- // remove the directory structure
- foreach($newdirs as $newdir) {
- rmdir($newdir);
- }
+ global $newdirs;
+ // remove the directory structure
+ foreach($newdirs as $newdir) {
+ rmdir($newdir);
+ }
}
function teardown_relative_path() {
- global $reldirs;
- // remove the directory structure
- foreach($reldirs as $newdir) {
- rmdir($newdir);
- }
+ global $reldirs;
+ // remove the directory structure
+ foreach($reldirs as $newdir) {
+ rmdir($newdir);
+ }
}
?>
diff --git a/ext/zlib/tests/gzopen_variation4.phpt b/ext/zlib/tests/gzopen_variation4.phpt
index 6a00c30670..2c9214ff43 100644
--- a/ext/zlib/tests/gzopen_variation4.phpt
+++ b/ext/zlib/tests/gzopen_variation4.phpt
@@ -31,77 +31,85 @@ foreach($modes as $mode) {
chdir($baseDir);
rmdir($workingDir);
foreach($newdirs as $newdir) {
- rmdir($newdir);
+ rmdir($newdir);
}
chdir("..");
rmdir($thisTestDir);
function test_gzopen($mode) {
- global $scriptFile, $secondFile, $firstFile, $filename;
-
- // create a file in the middle directory
- $h = gzopen($secondFile, "w");
- gzwrite($h, "This is a file in dir2");
- gzclose($h);
-
- echo "\n** testing with mode=$mode **\n";
- // should read dir2 file
- $h = gzopen($filename, $mode, true);
- gzpassthru($h);
- gzclose($h);
- echo "\n";
-
- //create a file in dir1
- $h = gzopen($firstFile, "w");
- gzwrite($h, "This is a file in dir1");
- gzclose($h);
-
- //should now read dir1 file
- $h = gzopen($filename, $mode, true);
- gzpassthru($h);
- gzclose($h);
- echo "\n";
-
- // create a file in working directory
- $h = gzopen($filename, "w");
- gzwrite($h, "This is a file in working dir");
- gzclose($h);
-
- //should still read dir1 file
- $h = gzopen($filename, $mode, true);
- gzpassthru($h);
- gzclose($h);
- echo "\n";
-
- unlink($firstFile);
- unlink($secondFile);
-
- //should read the file in working dir
- $h = gzopen($filename, $mode, true);
- gzpassthru($h);
- gzclose($h);
- echo "\n";
-
- // create a file in the script directory
- $h = gzopen($scriptFile, "w");
- gzwrite($h, "This is a file in script dir");
- gzclose($h);
-
- //should read the file in script dir
- $h = gzopen($filename, $mode, true);
- gzpassthru($h);
- gzclose($h);
- echo "\n";
-
- //cleanup
- unlink($filename);
- unlink($scriptFile);
-
+ global $scriptFile, $secondFile, $firstFile, $filename;
+
+ // create a file in the middle directory
+ $h = gzopen($secondFile, "w");
+ gzwrite($h, "This is a file in dir2");
+ gzclose($h);
+
+ echo "\n** testing with mode=$mode **\n";
+ // should read dir2 file
+ $h = gzopen($filename, $mode, true);
+ if ($h) {
+ gzpassthru($h);
+ gzclose($h);
+ echo "\n";
+ }
+
+ //create a file in dir1
+ $h = gzopen($firstFile, "w");
+ gzwrite($h, "This is a file in dir1");
+ gzclose($h);
+
+ //should now read dir1 file
+ $h = gzopen($filename, $mode, true);
+ if ($h) {
+ gzpassthru($h);
+ gzclose($h);
+ echo "\n";
+ }
+
+ // create a file in working directory
+ $h = gzopen($filename, "w");
+ gzwrite($h, "This is a file in working dir");
+ gzclose($h);
+
+ //should still read dir1 file
+ $h = gzopen($filename, $mode, true);
+ if ($h) {
+ gzpassthru($h);
+ gzclose($h);
+ echo "\n";
+ }
+
+ unlink($firstFile);
+ unlink($secondFile);
+
+ //should read the file in working dir
+ $h = gzopen($filename, $mode, true);
+ if ($h) {
+ gzpassthru($h);
+ gzclose($h);
+ echo "\n";
+ }
+
+ // create a file in the script directory
+ $h = gzopen($scriptFile, "w");
+ gzwrite($h, "This is a file in script dir");
+ gzclose($h);
+
+ //should read the file in script dir
+ $h = gzopen($filename, $mode, true);
+ if ($h) {
+ gzpassthru($h);
+ gzclose($h);
+ echo "\n";
+ }
+
+ //cleanup
+ unlink($filename);
+ unlink($scriptFile);
}
?>
-===DONE===
--EXPECTF--
*** Testing gzopen() : usage variation ***
@@ -116,40 +124,15 @@ This is a file in script dir
** testing with mode=r+ **
-Warning: gzopen(): cannot open a zlib stream for reading and writing at the same time! in %s on line %d
-
-Warning: gzpassthru() expects parameter 1 to be resource, bool given in %s on line %d
-
-Warning: gzclose() expects parameter 1 to be resource, bool given in %s on line %d
-
-
-Warning: gzopen(): cannot open a zlib stream for reading and writing at the same time! in %s on line %d
-
-Warning: gzpassthru() expects parameter 1 to be resource, bool given in %s on line %d
-
-Warning: gzclose() expects parameter 1 to be resource, bool given in %s on line %d
-
-
-Warning: gzopen(): cannot open a zlib stream for reading and writing at the same time! in %s on line %d
-
-Warning: gzpassthru() expects parameter 1 to be resource, bool given in %s on line %d
-
-Warning: gzclose() expects parameter 1 to be resource, bool given in %s on line %d
-
-
-Warning: gzopen(): cannot open a zlib stream for reading and writing at the same time! in %s on line %d
-
-Warning: gzpassthru() expects parameter 1 to be resource, bool given in %s on line %d
-
-Warning: gzclose() expects parameter 1 to be resource, bool given in %s on line %d
-
+Warning: gzopen(): Cannot open a zlib stream for reading and writing at the same time! in %s on line %d
-Warning: gzopen(): cannot open a zlib stream for reading and writing at the same time! in %s on line %d
+Warning: gzopen(): Cannot open a zlib stream for reading and writing at the same time! in %s on line %d
-Warning: gzpassthru() expects parameter 1 to be resource, bool given in %s on line %d
+Warning: gzopen(): Cannot open a zlib stream for reading and writing at the same time! in %s on line %d
-Warning: gzclose() expects parameter 1 to be resource, bool given in %s on line %d
+Warning: gzopen(): Cannot open a zlib stream for reading and writing at the same time! in %s on line %d
+Warning: gzopen(): Cannot open a zlib stream for reading and writing at the same time! in %s on line %d
** testing with mode=rt **
This is a file in dir2
@@ -157,4 +140,3 @@ This is a file in dir1
This is a file in dir1
This is a file in working dir
This is a file in script dir
-===DONE===
diff --git a/ext/zlib/tests/gzopen_variation5.phpt b/ext/zlib/tests/gzopen_variation5.phpt
index 99ba6a0b96..661ffe8759 100644
--- a/ext/zlib/tests/gzopen_variation5.phpt
+++ b/ext/zlib/tests/gzopen_variation5.phpt
@@ -33,38 +33,36 @@ chdir("..");
rmdir($thisTestDir);
function runtest() {
- $tmpfile = 'gzopen_variation5.tmp';
- $h = gzopen($tmpfile, "w", true);
- fwrite($h, "This is the test file");
- fclose($h);
+ $tmpfile = 'gzopen_variation5.tmp';
+ $h = gzopen($tmpfile, "w", true);
+ fwrite($h, "This is the test file");
+ fclose($h);
- $h = @gzopen($tmpfile, "r");
- if ($h === false) {
- echo "Not created in working dir\n";
- }
- else {
- echo "created in working dir\n";
- gzclose($h);
- unlink($tmpfile);
- }
+ $h = @gzopen($tmpfile, "r");
+ if ($h === false) {
+ echo "Not created in working dir\n";
+ }
+ else {
+ echo "created in working dir\n";
+ gzclose($h);
+ unlink($tmpfile);
+ }
- $h = @gzopen('dir1/'.$tmpfile, "r");
- if ($h === false) {
- echo "Not created in dir1\n";
- }
- else {
- echo "created in dir1\n";
- gzclose($h);
- unlink('dir1/'.$tmpfile);
- }
+ $h = @gzopen('dir1/'.$tmpfile, "r");
+ if ($h === false) {
+ echo "Not created in dir1\n";
+ }
+ else {
+ echo "created in dir1\n";
+ gzclose($h);
+ unlink('dir1/'.$tmpfile);
+ }
}
?>
-===DONE===
--EXPECT--
*** Testing gzopen() : variation ***
created in working dir
Not created in dir1
created in working dir
Not created in dir1
-===DONE===
diff --git a/ext/zlib/tests/gzopen_variation6.phpt b/ext/zlib/tests/gzopen_variation6.phpt
index 07f873a8dd..08007bcc24 100644
--- a/ext/zlib/tests/gzopen_variation6.phpt
+++ b/ext/zlib/tests/gzopen_variation6.phpt
@@ -39,9 +39,7 @@ echo "\n";
unlink($absfile);
unlink($relfile);
?>
-===DONE===
--EXPECT--
*** Testing gzopen() : variation ***
This is an absolute file
This is a relative file
-===DONE===
diff --git a/ext/zlib/tests/gzopen_variation7.phpt b/ext/zlib/tests/gzopen_variation7.phpt
index 0e499e0d37..f3ba9a4fbc 100644
--- a/ext/zlib/tests/gzopen_variation7.phpt
+++ b/ext/zlib/tests/gzopen_variation7.phpt
@@ -20,7 +20,6 @@ gzclose($h1);
var_dump(gzread($h2, 50));
// deliberately do not close $h2
?>
-===DONE===
--EXPECT--
string(30) "When you're taught through fee"
string(10) "When you'r"
@@ -28,4 +27,3 @@ string(15) "lings
Destiny f"
string(50) "e taught through feelings
Destiny flying high abov"
-===DONE===
diff --git a/ext/zlib/tests/gzopen_variation8.phpt b/ext/zlib/tests/gzopen_variation8.phpt
index bb64ecab16..ed6c55ff1c 100644
--- a/ext/zlib/tests/gzopen_variation8.phpt
+++ b/ext/zlib/tests/gzopen_variation8.phpt
@@ -33,10 +33,8 @@ gzclose($h);
echo "\n";
unlink($file);
?>
-===DONE===
--EXPECT--
*** Testing gzopen() : variation ***
Here is some plain
text to be read
and displayed.
-===DONE===
diff --git a/ext/zlib/tests/gzopen_variation9.phpt b/ext/zlib/tests/gzopen_variation9.phpt
index d948b435ca..d2148973db 100644
--- a/ext/zlib/tests/gzopen_variation9.phpt
+++ b/ext/zlib/tests/gzopen_variation9.phpt
@@ -31,12 +31,11 @@ foreach ($modes as $mode) {
echo "\n";
}
?>
-===DONE===
--EXPECTF--
*** Testing gzopen() : variation ***
mode=r+
-Warning: gzopen(): cannot open a zlib stream for reading and writing at the same time! in %s on line %d
+Warning: gzopen(): Cannot open a zlib stream for reading and writing at the same time! in %s on line %d
gzopen=bool(false)
mode=rf
@@ -44,12 +43,11 @@ gzopen=resource(%d) of type (stream)
mode=w+
-Warning: gzopen(): cannot open a zlib stream for reading and writing at the same time! in %s on line %d
+Warning: gzopen(): Cannot open a zlib stream for reading and writing at the same time! in %s on line %d
gzopen=bool(false)
mode=e
-Warning: gzopen(%s/004.txt.gz): failed to open stream: %s in %s on line %d
+Warning: gzopen(%s/004.txt.gz): Failed to open stream: %s in %s on line %d
gzopen=bool(false)
-===DONE===
diff --git a/ext/zlib/tests/gzpassthru_basic.phpt b/ext/zlib/tests/gzpassthru_basic.phpt
index 2747edc786..5606114bc3 100644
--- a/ext/zlib/tests/gzpassthru_basic.phpt
+++ b/ext/zlib/tests/gzpassthru_basic.phpt
@@ -19,7 +19,6 @@ var_dump(gzpassthru($h));
gzclose($h);
?>
-===DONE===
--EXPECT--
When you're taught through feelings
Destiny flying high above
@@ -29,4 +28,3 @@ as it turns around
and I know that it descends down on me
int(176)
int(0)
-===DONE===
diff --git a/ext/zlib/tests/gzputs_basic.phpt b/ext/zlib/tests/gzputs_basic.phpt
index a9bd682c14..e1414d2504 100644
--- a/ext/zlib/tests/gzputs_basic.phpt
+++ b/ext/zlib/tests/gzputs_basic.phpt
@@ -23,9 +23,7 @@ gzclose($h);
echo "\n";
unlink($filename);
?>
-===DONE===
--EXPECT--
int(34)
int(10)
Here is the string to be written. Here is th
-===DONE===
diff --git a/ext/zlib/tests/gzread_basic.phpt b/ext/zlib/tests/gzread_basic.phpt
index 813fcd8616..1b66d85fc1 100644
--- a/ext/zlib/tests/gzread_basic.phpt
+++ b/ext/zlib/tests/gzread_basic.phpt
@@ -21,7 +21,6 @@ foreach ($lengths as $length) {
gzclose($h);
?>
-===DONE===
--EXPECT--
string(10) "When you'r"
string(14) "e taught throu"
@@ -34,4 +33,3 @@ as it turns "
string(46) "around
and I know that it descends down on me
"
-===DONE===
diff --git a/ext/zlib/tests/gzread_error2.phpt b/ext/zlib/tests/gzread_error2.phpt
index a419f96640..1c3cce3e87 100644
--- a/ext/zlib/tests/gzread_error2.phpt
+++ b/ext/zlib/tests/gzread_error2.phpt
@@ -11,22 +11,24 @@ if (!extension_loaded("zlib")) {
$f = __DIR__."/004.txt.gz";
$h = gzopen($f, 'r');
var_dump(gzread($h, 10));
-var_dump(gzread($h, 0));
+try {
+ var_dump(gzread($h, 0));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
var_dump(gzread($h, 5));
-var_dump(gzread($h, -1));
+try {
+ var_dump(gzread($h, -1));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
var_dump(gzread($h, 8));
gzclose($h);
?>
-===DONE===
---EXPECTF--
+--EXPECT--
string(10) "When you'r"
-
-Warning: gzread(): Length parameter must be greater than 0 in %s on line %d
-bool(false)
+Length parameter must be greater than 0
string(5) "e tau"
-
-Warning: gzread(): Length parameter must be greater than 0 in %s on line %d
-bool(false)
+Length parameter must be greater than 0
string(8) "ght thro"
-===DONE===
diff --git a/ext/zlib/tests/gzread_variation1.phpt b/ext/zlib/tests/gzread_variation1.phpt
index 9cf4b9c739..bc9eee4f94 100644
--- a/ext/zlib/tests/gzread_variation1.phpt
+++ b/ext/zlib/tests/gzread_variation1.phpt
@@ -25,10 +25,8 @@ gzclose($h);
echo "\n";
unlink($filename);
?>
-===DONE===
--EXPECT--
bool(false)
bool(false)
bool(false)
Here is the string to be written.
-===DONE===
diff --git a/ext/zlib/tests/gzreadgzwrite.phpt b/ext/zlib/tests/gzreadgzwrite.phpt
index 87b55e673f..f2f2370f36 100644
--- a/ext/zlib/tests/gzreadgzwrite.phpt
+++ b/ext/zlib/tests/gzreadgzwrite.phpt
@@ -18,14 +18,14 @@ $fp = gzopen($filename, "rb");
$data = '';
while ($buf = gzread($fp, 8092)) {
- $data .= $buf;
+ $data .= $buf;
}
if ($data == $original) {
- echo "Strings are equal\n";
+ echo "Strings are equal\n";
} else {
- echo "Strings are not equal\n";
- var_dump($data);
+ echo "Strings are not equal\n";
+ var_dump($data);
}
gzclose($fp);
unlink($filename);
diff --git a/ext/zlib/tests/gzreadgzwriteplain.phpt b/ext/zlib/tests/gzreadgzwriteplain.phpt
index 0d73f022aa..8898cebb93 100644
--- a/ext/zlib/tests/gzreadgzwriteplain.phpt
+++ b/ext/zlib/tests/gzreadgzwriteplain.phpt
@@ -18,29 +18,29 @@ $fp = gzopen($filename, "rb");
$data = '';
while ($buf = gzread($fp, 8192)) {
- $data .= $buf;
+ $data .= $buf;
}
if ($data == $original) {
- echo "Strings are equal\n";
+ echo "Strings are equal\n";
} else {
- echo "Strings are not equal\n";
- var_dump($data);
+ echo "Strings are not equal\n";
+ var_dump($data);
}
gzseek($fp, strlen($original) / 2);
$data = '';
while ($buf = gzread($fp, 8192)) {
- $data .= $buf;
+ $data .= $buf;
}
var_dump(strlen($data));
if ($data == substr($original, strlen($original) / 2)) {
- echo "Strings are equal\n";
+ echo "Strings are equal\n";
} else {
- echo "Strings are not equal\n";
- var_dump($data);
+ echo "Strings are not equal\n";
+ var_dump($data);
}
gzclose($fp);
diff --git a/ext/zlib/tests/gzrewind_basic.phpt b/ext/zlib/tests/gzrewind_basic.phpt
index 3a34f49797..988e10a366 100644
--- a/ext/zlib/tests/gzrewind_basic.phpt
+++ b/ext/zlib/tests/gzrewind_basic.phpt
@@ -22,7 +22,6 @@ gzrewind($h);
echo "first 20 characters=".gzread($h, 20)."\n";
gzclose($h);
?>
-===DONE===
--EXPECT--
test rewind before doing anything
bool(true)
@@ -33,4 +32,3 @@ int(30)
int(0)
first 10 characters=When you'r
first 20 characters=When you're taught t
-===DONE===
diff --git a/ext/zlib/tests/gzrewind_basic2.phpt b/ext/zlib/tests/gzrewind_basic2.phpt
index 2648966b7d..d1a2d296fc 100644
--- a/ext/zlib/tests/gzrewind_basic2.phpt
+++ b/ext/zlib/tests/gzrewind_basic2.phpt
@@ -23,7 +23,6 @@ echo "first 20 characters=".gzread($h,20)."\n";
gzclose($h);
?>
-===DONE===
--EXPECT--
read to the end of the file, then rewind
bool(true)
@@ -31,4 +30,3 @@ int(176)
bool(false)
int(0)
first 20 characters=When you're taught t
-===DONE===
diff --git a/ext/zlib/tests/gzrewind_variation1.phpt b/ext/zlib/tests/gzrewind_variation1.phpt
index 09acb55d80..1704771679 100644
--- a/ext/zlib/tests/gzrewind_variation1.phpt
+++ b/ext/zlib/tests/gzrewind_variation1.phpt
@@ -21,8 +21,6 @@ gzclose($h);
unlink($f);
echo "\n";
?>
-===DONE===
--EXPECT--
bool(false)
The first string.The second string.
-===DONE===
diff --git a/ext/zlib/tests/gzseek_basic.phpt b/ext/zlib/tests/gzseek_basic.phpt
index e31e25f380..2cc1359559 100644
--- a/ext/zlib/tests/gzseek_basic.phpt
+++ b/ext/zlib/tests/gzseek_basic.phpt
@@ -30,7 +30,6 @@ echo "tell=".gztell($h)."\n";
var_dump(gzread($h, 10));
gzclose($h);
?>
-===DONE===
--EXPECT--
move to the 50th byte
int(0)
@@ -46,4 +45,3 @@ move backward to the 20th byte
int(0)
tell=20
string(10) "hrough fee"
-===DONE===
diff --git a/ext/zlib/tests/gzseek_basic2.phpt b/ext/zlib/tests/gzseek_basic2.phpt
index 70b0d1f046..a463d607f1 100644
--- a/ext/zlib/tests/gzseek_basic2.phpt
+++ b/ext/zlib/tests/gzseek_basic2.phpt
@@ -29,7 +29,6 @@ echo gzread($h, strlen($str2))."\n";
gzclose($h);
unlink($f);
?>
-===DONE===
--EXPECT--
tell=23
tell=43
@@ -39,4 +38,3 @@ reading the output file
This is the first line.
string(40) "0000000000000000000000000000000000000000"
This is the second line.
-===DONE===
diff --git a/ext/zlib/tests/gzseek_variation1.phpt b/ext/zlib/tests/gzseek_variation1.phpt
index 28eff866f9..81fe035987 100644
--- a/ext/zlib/tests/gzseek_variation1.phpt
+++ b/ext/zlib/tests/gzseek_variation1.phpt
@@ -25,9 +25,7 @@ echo gzread($h, strlen($str2))."\n";
gzclose($h);
unlink($f);
?>
-===DONE===
--EXPECT--
This is the first line.
string(40) "0000000000000000000000000000000000000000"
This is the second line.
-===DONE===
diff --git a/ext/zlib/tests/gzseek_variation2.phpt b/ext/zlib/tests/gzseek_variation2.phpt
index 14ae30a09a..56b4fa9ec1 100644
--- a/ext/zlib/tests/gzseek_variation2.phpt
+++ b/ext/zlib/tests/gzseek_variation2.phpt
@@ -30,7 +30,6 @@ echo "tell=".gztell($h)."\n";
var_dump(gzread($h, 10));
gzclose($h);
?>
-===DONE===
--EXPECT--
move to the 50th byte
int(0)
@@ -46,4 +45,3 @@ move backward to the 20th byte
int(0)
tell=20
string(10) "hrough fee"
-===DONE===
diff --git a/ext/zlib/tests/gzseek_variation3.phpt b/ext/zlib/tests/gzseek_variation3.phpt
index d238fe96bd..77e0e33e01 100644
--- a/ext/zlib/tests/gzseek_variation3.phpt
+++ b/ext/zlib/tests/gzseek_variation3.phpt
@@ -30,7 +30,6 @@ echo "tell=".gztell($h)."\n";
var_dump(gzread($h, 10));
gzclose($h);
?>
-===DONE===
--EXPECT--
move to the 50th byte
int(0)
@@ -47,4 +46,3 @@ move backward to the 77th byte
int(0)
tell=77
string(10) "hat you ca"
-===DONE===
diff --git a/ext/zlib/tests/gzseek_variation4.phpt b/ext/zlib/tests/gzseek_variation4.phpt
index 2270ccc5f9..bb7a822add 100644
--- a/ext/zlib/tests/gzseek_variation4.phpt
+++ b/ext/zlib/tests/gzseek_variation4.phpt
@@ -29,7 +29,6 @@ echo gzread($h, strlen($str2))."\n";
gzclose($h);
unlink($f);
?>
-===DONE===
--EXPECT--
tell=23
tell=43
@@ -39,4 +38,3 @@ reading the output file
This is the first line.
string(40) "0000000000000000000000000000000000000000"
This is the second line.
-===DONE===
diff --git a/ext/zlib/tests/gzseek_variation5.phpt b/ext/zlib/tests/gzseek_variation5.phpt
index b38b46558e..e59a3fb88d 100644
--- a/ext/zlib/tests/gzseek_variation5.phpt
+++ b/ext/zlib/tests/gzseek_variation5.phpt
@@ -29,7 +29,6 @@ echo gzread($h, strlen($str2))."\n";
gzclose($h);
unlink($f);
?>
-===DONE===
--EXPECT--
tell=23
tell=43
@@ -39,4 +38,3 @@ reading the output file
This is the first line.
string(40) "0000000000000000000000000000000000000000"
This is the second line.
-===DONE===
diff --git a/ext/zlib/tests/gzseek_variation6.phpt b/ext/zlib/tests/gzseek_variation6.phpt
index 54a52dce3c..e7f49f5fd7 100644
--- a/ext/zlib/tests/gzseek_variation6.phpt
+++ b/ext/zlib/tests/gzseek_variation6.phpt
@@ -25,7 +25,6 @@ var_dump(gzeof($h));
var_dump(gzread($h, 10));
gzclose($h);
?>
-===DONE===
--EXPECTF--
move 40 bytes
tell=int(40)
@@ -36,4 +35,3 @@ int(-1)
tell=int(40)
eof=bool(false)
string(10) "iny flying"
-===DONE===
diff --git a/ext/zlib/tests/gzseek_variation7.phpt b/ext/zlib/tests/gzseek_variation7.phpt
index a1976b2b16..67c0ecf074 100644
--- a/ext/zlib/tests/gzseek_variation7.phpt
+++ b/ext/zlib/tests/gzseek_variation7.phpt
@@ -32,7 +32,6 @@ gzclose($h);
echo "\n";
unlink($f);
?>
-===DONE===
--EXPECTF--
tell=int(23)
move to the end of the file
@@ -44,4 +43,3 @@ tell=int(47)
reading the output file
This is the first line.This is the second line.
-===DONE===
diff --git a/ext/zlib/tests/gztell_basic.phpt b/ext/zlib/tests/gztell_basic.phpt
index 181295c097..acd0829360 100644
--- a/ext/zlib/tests/gztell_basic.phpt
+++ b/ext/zlib/tests/gztell_basic.phpt
@@ -21,7 +21,6 @@ foreach ($intervals as $interval) {
gzclose($h);
?>
-===DONE===
--EXPECT--
int(0)
int(7)
@@ -31,4 +30,3 @@ int(100)
int(127)
int(142)
int(176)
-===DONE===
diff --git a/ext/zlib/tests/gztell_basic2.phpt b/ext/zlib/tests/gztell_basic2.phpt
index 59808d7596..13ac183d46 100644
--- a/ext/zlib/tests/gztell_basic2.phpt
+++ b/ext/zlib/tests/gztell_basic2.phpt
@@ -22,7 +22,6 @@ foreach ($sizes as $size) {
gzclose($h);
unlink($f);
?>
-===DONE===
--EXPECT--
int(0)
bytes written=7
@@ -39,4 +38,3 @@ bytes written=15
tell=142
bytes written=1000
tell=1142
-===DONE===
diff --git a/ext/zlib/tests/gzuncompress_basic1.phpt b/ext/zlib/tests/gzuncompress_basic1.phpt
index 6107a59e4f..f572c704a8 100644
--- a/ext/zlib/tests/gzuncompress_basic1.phpt
+++ b/ext/zlib/tests/gzuncompress_basic1.phpt
@@ -31,7 +31,6 @@ echo "\n-- Calling gzuncompress() with max length of $length --\n";
echo "Result length is ". strlen(gzuncompress($compressed, $length)) . "\n";
?>
-===DONE===
--EXPECT--
*** Testing gzuncompress() : basic functionality ***
@@ -40,4 +39,3 @@ int(0)
-- Calling gzuncompress() with max length of 3547 --
Result length is 3547
-===DONE===
diff --git a/ext/zlib/tests/gzuncompress_error1.phpt b/ext/zlib/tests/gzuncompress_error1.phpt
index f200951d4c..2f9b6d9e45 100644
--- a/ext/zlib/tests/gzuncompress_error1.phpt
+++ b/ext/zlib/tests/gzuncompress_error1.phpt
@@ -16,18 +16,8 @@ if (!extension_loaded("zlib")) {
echo "*** Testing gzuncompress() : error conditions ***\n";
-// Zero arguments
-echo "\n-- Testing gzuncompress() function with Zero arguments --\n";
-var_dump( gzuncompress() );
-
-//Test gzuncompress with one more than the expected number of arguments
-echo "\n-- Testing gzuncompress() function with more than expected no. of arguments --\n";
-$data = 'string_val';
-$length = 10;
-$extra_arg = 10;
-var_dump( gzuncompress($data, $length, $extra_arg) );
-
echo "\n-- Testing with a buffer that is too small --\n";
+$data = 'string_val';
$short_len = strlen($data) - 1;
$compressed = gzcompress($data);
@@ -36,32 +26,10 @@ var_dump(gzuncompress($compressed, $short_len));
echo "\n-- Testing with incorrect arguments --\n";
var_dump(gzuncompress(123));
-class Tester {
- function Hello() {
- echo "Hello\n";
- }
-}
-
-$testclass = new Tester();
-var_dump(gzuncompress($testclass));
-
-var_dump(gzuncompress($compressed, "this is not a number\n"));
-
?>
-===DONE===
--EXPECTF--
*** Testing gzuncompress() : error conditions ***
--- Testing gzuncompress() function with Zero arguments --
-
-Warning: gzuncompress() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-
--- Testing gzuncompress() function with more than expected no. of arguments --
-
-Warning: gzuncompress() expects at most 2 parameters, 3 given in %s on line %d
-NULL
-
-- Testing with a buffer that is too small --
Warning: gzuncompress(): insufficient memory in %s on line %d
@@ -71,10 +39,3 @@ bool(false)
Warning: gzuncompress(): data error in %s on line %d
bool(false)
-
-Warning: gzuncompress() expects parameter 1 to be string, object given in %s on line %d
-NULL
-
-Warning: gzuncompress() expects parameter 2 to be int, string given in %s on line %d
-NULL
-===DONE===
diff --git a/ext/zlib/tests/gzwrite_basic.phpt b/ext/zlib/tests/gzwrite_basic.phpt
index 7d3700b8cf..bdea57deff 100644
--- a/ext/zlib/tests/gzwrite_basic.phpt
+++ b/ext/zlib/tests/gzwrite_basic.phpt
@@ -23,9 +23,7 @@ gzclose($h);
echo "\n";
unlink($filename);
?>
-===DONE===
--EXPECT--
int(34)
int(10)
Here is the string to be written. Here is th
-===DONE===
diff --git a/ext/zlib/tests/gzwrite_error2.phpt b/ext/zlib/tests/gzwrite_error2.phpt
index 0cd0baa14e..a4e4fa4958 100644
--- a/ext/zlib/tests/gzwrite_error2.phpt
+++ b/ext/zlib/tests/gzwrite_error2.phpt
@@ -22,9 +22,7 @@ gzclose($h);
echo "\n";
unlink($filename);
?>
-===DONE===
--EXPECT--
int(0)
int(0)
-===DONE===
diff --git a/ext/zlib/tests/gzwrite_variation1.phpt b/ext/zlib/tests/gzwrite_variation1.phpt
index 6061ef1a0f..563702e4bd 100644
--- a/ext/zlib/tests/gzwrite_variation1.phpt
+++ b/ext/zlib/tests/gzwrite_variation1.phpt
@@ -19,9 +19,7 @@ var_dump(gzwrite( $h, $str, $length ) );
gzclose($h);
?>
-===DONE===
--EXPECT--
int(0)
string(10) "When you'r"
int(0)
-===DONE===
diff --git a/ext/zlib/tests/inflate_add_error.phpt b/ext/zlib/tests/inflate_add_error.phpt
index 3bc04a0b7c..9622e5a4c4 100644
--- a/ext/zlib/tests/inflate_add_error.phpt
+++ b/ext/zlib/tests/inflate_add_error.phpt
@@ -8,15 +8,23 @@ if (!extension_loaded("zlib")) {
?>
--FILE--
<?php
+
$badResource = fopen("php://memory", "r+");
-var_dump(inflate_add($badResource, "test"));
+try {
+ var_dump(inflate_add($badResource, "test"));
+} catch (\TypeError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
$resource = inflate_init(ZLIB_ENCODING_DEFLATE);
$badFlushType = 6789;
-var_dump(inflate_add($resource, "test", $badFlushType));
-?>
---EXPECTF--
-Warning: inflate_add(): Invalid zlib.inflate resource in %s on line %d
-bool(false)
+try {
+ var_dump(inflate_add($resource, "test", $badFlushType));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
-Warning: inflate_add(): flush mode must be ZLIB_NO_FLUSH, ZLIB_PARTIAL_FLUSH, ZLIB_SYNC_FLUSH, ZLIB_FULL_FLUSH, ZLIB_BLOCK or ZLIB_FINISH in %s on line %d
-bool(false)
+?>
+--EXPECT--
+inflate_add(): supplied resource is not a valid zlib inflate resource
+Flush mode must be ZLIB_NO_FLUSH, ZLIB_PARTIAL_FLUSH, ZLIB_SYNC_FLUSH, ZLIB_FULL_FLUSH, ZLIB_BLOCK or ZLIB_FINISH
diff --git a/ext/zlib/tests/inflate_init_error.phpt b/ext/zlib/tests/inflate_init_error.phpt
index 58773e61d3..1aae9b792b 100644
--- a/ext/zlib/tests/inflate_init_error.phpt
+++ b/ext/zlib/tests/inflate_init_error.phpt
@@ -8,12 +8,13 @@ if (!extension_loaded("zlib")) {
?>
--FILE--
<?php
-var_dump(inflate_init());
-var_dump(inflate_init(42));
-?>
---EXPECTF--
-Warning: inflate_init() expects at least 1 parameter, 0 given in %s on line %d
-NULL
-Warning: inflate_init(): encoding mode must be ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or ZLIB_ENCODING_DEFLATE in %s on line %d
-bool(false)
+try {
+ var_dump(inflate_init(42));
+} catch (\ValueError $e) {
+ echo $e->getMessage() . \PHP_EOL;
+}
+
+?>
+--EXPECT--
+Encoding mode must be ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or ZLIB_ENCODING_DEFLATE
diff --git a/ext/zlib/tests/ob_gzhandler_legacy_002.phpt b/ext/zlib/tests/ob_gzhandler_legacy_002.phpt
index 217a0d2e35..5e940b6187 100644
--- a/ext/zlib/tests/ob_gzhandler_legacy_002.phpt
+++ b/ext/zlib/tests/ob_gzhandler_legacy_002.phpt
@@ -14,8 +14,8 @@ dummy=42
--FILE--
<?php
if (false !== ob_gzhandler("", PHP_OUTPUT_HANDLER_START)) {
- ini_set("zlib.output_compression", 0);
- ob_start("ob_gzhandler");
+ ini_set("zlib.output_compression", 0);
+ ob_start("ob_gzhandler");
}
echo "hi\n";
?>
diff --git a/ext/zlib/tests/readgzfile_basic.phpt b/ext/zlib/tests/readgzfile_basic.phpt
index 09bcc4c534..ca3908c16e 100644
--- a/ext/zlib/tests/readgzfile_basic.phpt
+++ b/ext/zlib/tests/readgzfile_basic.phpt
@@ -25,10 +25,8 @@ var_dump(readgzfile( $filename ) );
unlink($filename);
rmdir($dirname);
?>
-===DONE===
--EXPECT--
hello world
is a very common test
for all languages
int(52)
-===DONE===
diff --git a/ext/zlib/tests/readgzfile_basic2.phpt b/ext/zlib/tests/readgzfile_basic2.phpt
index a835883aaa..fe9192e221 100644
--- a/ext/zlib/tests/readgzfile_basic2.phpt
+++ b/ext/zlib/tests/readgzfile_basic2.phpt
@@ -25,10 +25,8 @@ var_dump(readgzfile( $filename ) );
unlink($filename);
rmdir($dirname);
?>
-===DONE===
--EXPECT--
hello world
is a very common test
for all languages
int(52)
-===DONE===
diff --git a/ext/zlib/tests/readgzfile_variation10.phpt b/ext/zlib/tests/readgzfile_variation10.phpt
deleted file mode 100644
index 731445dbf0..0000000000
--- a/ext/zlib/tests/readgzfile_variation10.phpt
+++ /dev/null
@@ -1,67 +0,0 @@
---TEST--
-Test function readgzfile() by substituting argument 2 with emptyUnsetUndefNull values.
---SKIPIF--
-<?php
-if (!extension_loaded('zlib')) die ('skip zlib extension not available in this build');
-?>
---FILE--
-<?php
-
-
-$filename = __DIR__."/004.txt.gz";
-
-
-$unset_var = 10;
-unset($unset_var);
-
-$variation = array(
- 'unset var' => @$unset_var,
- 'undefined var' => @$undefined_var,
- 'empty string DQ' => "",
- 'empty string SQ' => '',
- 'uppercase NULL' => NULL,
- 'lowercase null' => null,
- );
-
-
-foreach ( $variation as $var ) {
- var_dump(readgzfile( $filename, $var ) );
-}
-?>
-===DONE===
---EXPECTF--
-When you're taught through feelings
-Destiny flying high above
-all I know is that you can realize it
-Destiny who cares
-as it turns around
-and I know that it descends down on me
-int(176)
-When you're taught through feelings
-Destiny flying high above
-all I know is that you can realize it
-Destiny who cares
-as it turns around
-and I know that it descends down on me
-int(176)
-
-Warning: readgzfile() expects parameter 2 to be int, string given in %s on line %d
-NULL
-
-Warning: readgzfile() expects parameter 2 to be int, string given in %s on line %d
-NULL
-When you're taught through feelings
-Destiny flying high above
-all I know is that you can realize it
-Destiny who cares
-as it turns around
-and I know that it descends down on me
-int(176)
-When you're taught through feelings
-Destiny flying high above
-all I know is that you can realize it
-Destiny who cares
-as it turns around
-and I know that it descends down on me
-int(176)
-===DONE===
diff --git a/ext/zlib/tests/readgzfile_variation11.phpt b/ext/zlib/tests/readgzfile_variation11.phpt
index 87eb8ac7c8..15807926a9 100644
--- a/ext/zlib/tests/readgzfile_variation11.phpt
+++ b/ext/zlib/tests/readgzfile_variation11.phpt
@@ -25,7 +25,6 @@ foreach ( $variation as $var ) {
var_dump(readgzfile( $filename, $var ) );
}
?>
-===DONE===
--EXPECT--
When you're taught through feelings
Destiny flying high above
@@ -62,4 +61,3 @@ Destiny who cares
as it turns around
and I know that it descends down on me
int(176)
-===DONE===
diff --git a/ext/zlib/tests/readgzfile_variation12.phpt b/ext/zlib/tests/readgzfile_variation12.phpt
index af22ce6f6c..0f72050939 100644
--- a/ext/zlib/tests/readgzfile_variation12.phpt
+++ b/ext/zlib/tests/readgzfile_variation12.phpt
@@ -23,7 +23,6 @@ foreach ( $variation as $var ) {
var_dump(readgzfile( $filename, $var ) );
}
?>
-===DONE===
--EXPECT--
When you're taught through feelings
Destiny flying high above
@@ -53,4 +52,3 @@ Destiny who cares
as it turns around
and I know that it descends down on me
int(176)
-===DONE===
diff --git a/ext/zlib/tests/readgzfile_variation15.phpt b/ext/zlib/tests/readgzfile_variation15.phpt
index 70f566446e..1a96fdb429 100644
--- a/ext/zlib/tests/readgzfile_variation15.phpt
+++ b/ext/zlib/tests/readgzfile_variation15.phpt
@@ -83,11 +83,9 @@ function test_readgzfile() {
}
?>
-===DONE===
--EXPECT--
file content:This is a file in dir2
file content:This is a file in dir1
file content:This is a file in dir1
file content:This is a file in working dir
file content:This is a file in script dir
-===DONE===
diff --git a/ext/zlib/tests/readgzfile_variation3.phpt b/ext/zlib/tests/readgzfile_variation3.phpt
index 9b8c142781..11c5933d52 100644
--- a/ext/zlib/tests/readgzfile_variation3.phpt
+++ b/ext/zlib/tests/readgzfile_variation3.phpt
@@ -28,7 +28,6 @@ foreach ( $variation as $var ) {
var_dump(readgzfile( $var , $use_include_path ) );
}
?>
-===DONE===
--EXPECTF--
Warning: readgzfile(): Filename cannot be empty in %s on line %d
bool(false)
@@ -47,4 +46,3 @@ bool(false)
Warning: readgzfile(): Filename cannot be empty in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/zlib/tests/readgzfile_variation4.phpt b/ext/zlib/tests/readgzfile_variation4.phpt
index 32f434cba2..8d86085010 100644
--- a/ext/zlib/tests/readgzfile_variation4.phpt
+++ b/ext/zlib/tests/readgzfile_variation4.phpt
@@ -24,20 +24,18 @@ foreach ( $variation as $var ) {
var_dump(readgzfile( $var , $use_include_path ) );
}
?>
-===DONE===
--EXPECTF--
-Warning: readgzfile(10.5): failed to open stream: No such file or directory in %s on line %d
+Warning: readgzfile(10.5): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-Warning: readgzfile(-10.5): failed to open stream: No such file or directory in %s on line %d
+Warning: readgzfile(-10.5): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-Warning: readgzfile(123456789000): failed to open stream: No such file or directory in %s on line %d
+Warning: readgzfile(123456789000): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-Warning: readgzfile(-123456789000): failed to open stream: No such file or directory in %s on line %d
+Warning: readgzfile(-123456789000): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-Warning: readgzfile(0.5): failed to open stream: No such file or directory in %s on line %d
+Warning: readgzfile(0.5): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/zlib/tests/readgzfile_variation5.phpt b/ext/zlib/tests/readgzfile_variation5.phpt
index 2aa83fde3b..fe95bb4dbc 100644
--- a/ext/zlib/tests/readgzfile_variation5.phpt
+++ b/ext/zlib/tests/readgzfile_variation5.phpt
@@ -23,17 +23,15 @@ foreach ( $variation as $var ) {
var_dump(readgzfile( $var , $use_include_path ) );
}
?>
-===DONE===
--EXPECTF--
-Warning: readgzfile(0): failed to open stream: No such file or directory in %s on line %d
+Warning: readgzfile(0): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-Warning: readgzfile(1): failed to open stream: No such file or directory in %s on line %d
+Warning: readgzfile(1): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-Warning: readgzfile(12345): failed to open stream: No such file or directory in %s on line %d
+Warning: readgzfile(12345): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-Warning: readgzfile(-2345): failed to open stream: No such file or directory in %s on line %d
+Warning: readgzfile(-2345): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/zlib/tests/readgzfile_variation7.phpt b/ext/zlib/tests/readgzfile_variation7.phpt
index f4abdac9b5..e60c01cb79 100644
--- a/ext/zlib/tests/readgzfile_variation7.phpt
+++ b/ext/zlib/tests/readgzfile_variation7.phpt
@@ -27,17 +27,15 @@ foreach ( $variation_array as $var ) {
var_dump(readgzfile( $var , $use_include_path ) );
}
?>
-===DONE===
--EXPECTF--
-Warning: readgzfile(string): failed to open stream: No such file or directory in %s on line %d
+Warning: readgzfile(string): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-Warning: readgzfile(string): failed to open stream: No such file or directory in %s on line %d
+Warning: readgzfile(string): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-Warning: readgzfile(sTrInG): failed to open stream: No such file or directory in %s on line %d
+Warning: readgzfile(sTrInG): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-Warning: readgzfile(hello world): failed to open stream: No such file or directory in %s on line %d
+Warning: readgzfile(hello world): Failed to open stream: No such file or directory in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/zlib/tests/readgzfile_variation9.phpt b/ext/zlib/tests/readgzfile_variation9.phpt
index 4f7b7d30c0..6a91b292da 100644
--- a/ext/zlib/tests/readgzfile_variation9.phpt
+++ b/ext/zlib/tests/readgzfile_variation9.phpt
@@ -22,7 +22,6 @@ foreach ( $variation as $var ) {
var_dump(readgzfile( $filename, $var ) );
}
?>
-===DONE===
--EXPECT--
When you're taught through feelings
Destiny flying high above
@@ -52,4 +51,3 @@ Destiny who cares
as it turns around
and I know that it descends down on me
int(176)
-===DONE===
diff --git a/ext/zlib/tests/zlib_scheme_copy_basic.phpt b/ext/zlib/tests/zlib_scheme_copy_basic.phpt
index a295c84bc5..5a35164cf1 100644
--- a/ext/zlib/tests/zlib_scheme_copy_basic.phpt
+++ b/ext/zlib/tests/zlib_scheme_copy_basic.phpt
@@ -31,7 +31,5 @@ else {
}
unlink($outputFileName);
?>
-===DONE===
--EXPECT--
OK: Copy identical
-===DONE===
diff --git a/ext/zlib/tests/zlib_scheme_copy_variation1.phpt b/ext/zlib/tests/zlib_scheme_copy_variation1.phpt
index 4130aa4508..a5e145faa3 100644
--- a/ext/zlib/tests/zlib_scheme_copy_variation1.phpt
+++ b/ext/zlib/tests/zlib_scheme_copy_variation1.phpt
@@ -32,7 +32,5 @@ else {
}
unlink($outputFileName);
?>
-===DONE===
--EXPECT--
OK: Copy identical
-===DONE===
diff --git a/ext/zlib/tests/zlib_scheme_copy_variation2.phpt b/ext/zlib/tests/zlib_scheme_copy_variation2.phpt
index 02fae273bc..8492862892 100644
--- a/ext/zlib/tests/zlib_scheme_copy_variation2.phpt
+++ b/ext/zlib/tests/zlib_scheme_copy_variation2.phpt
@@ -47,7 +47,5 @@ else {
unlink($inputFileName);
unlink($outputFileName);
?>
-===DONE===
--EXPECT--
OK: Copy identical
-===DONE===
diff --git a/ext/zlib/tests/zlib_scheme_dir_basic.phpt b/ext/zlib/tests/zlib_scheme_dir_basic.phpt
index 768cdb23a1..f0e155e899 100644
--- a/ext/zlib/tests/zlib_scheme_dir_basic.phpt
+++ b/ext/zlib/tests/zlib_scheme_dir_basic.phpt
@@ -15,12 +15,10 @@ var_dump(is_dir($srcFile));
var_dump(opendir($srcFile));
var_dump(rmdir($srcFile));
?>
-===DONE===
--EXPECTF--
bool(false)
bool(false)
-Warning: opendir(compress.zlib://%s/dir.gz): failed to open dir: not implemented in %s on line %d
+Warning: opendir(compress.zlib://%s/dir.gz): Failed to open directory: not implemented in %s on line %d
bool(false)
bool(false)
-===DONE===
diff --git a/ext/zlib/tests/zlib_scheme_file_basic.phpt b/ext/zlib/tests/zlib_scheme_file_basic.phpt
index b978e35915..5d73cf16c2 100644
--- a/ext/zlib/tests/zlib_scheme_file_basic.phpt
+++ b/ext/zlib/tests/zlib_scheme_file_basic.phpt
@@ -13,7 +13,6 @@ $srcFile = "compress.zlib://$inputFileName";
$contents = file($srcFile);
var_dump($contents);
?>
-===DONE===
--EXPECT--
array(6) {
[0]=>
@@ -35,4 +34,3 @@ array(6) {
string(39) "and I know that it descends down on me
"
}
-===DONE===
diff --git a/ext/zlib/tests/zlib_scheme_file_get_contents_basic.phpt b/ext/zlib/tests/zlib_scheme_file_get_contents_basic.phpt
index e98e4e8ca6..b02a1bffe9 100644
--- a/ext/zlib/tests/zlib_scheme_file_get_contents_basic.phpt
+++ b/ext/zlib/tests/zlib_scheme_file_get_contents_basic.phpt
@@ -13,7 +13,6 @@ $srcFile = "compress.zlib://$inputFileName";
$contents = file_get_contents($srcFile);
echo $contents;
?>
-===DONE===
--EXPECT--
When you're taught through feelings
Destiny flying high above
@@ -21,4 +20,3 @@ all I know is that you can realize it
Destiny who cares
as it turns around
and I know that it descends down on me
-===DONE===
diff --git a/ext/zlib/tests/zlib_scheme_file_put_contents_basic.phpt b/ext/zlib/tests/zlib_scheme_file_put_contents_basic.phpt
index cadaeae532..51a52c9808 100644
--- a/ext/zlib/tests/zlib_scheme_file_put_contents_basic.phpt
+++ b/ext/zlib/tests/zlib_scheme_file_put_contents_basic.phpt
@@ -23,9 +23,7 @@ gzclose($h);
echo "\n";
unlink($outputFileName);
?>
-===DONE===
--EXPECT--
Here is some plain
text to be read
and displayed.
-===DONE===
diff --git a/ext/zlib/tests/zlib_scheme_file_read_file_basic.phpt b/ext/zlib/tests/zlib_scheme_file_read_file_basic.phpt
index c0862d31a9..007a4a5022 100644
--- a/ext/zlib/tests/zlib_scheme_file_read_file_basic.phpt
+++ b/ext/zlib/tests/zlib_scheme_file_read_file_basic.phpt
@@ -12,7 +12,6 @@ $inputFileName = __DIR__."/004.txt.gz";
$srcFile = "compress.zlib://$inputFileName";
readfile($srcFile);
?>
-===DONE===
--EXPECT--
When you're taught through feelings
Destiny flying high above
@@ -20,4 +19,3 @@ all I know is that you can realize it
Destiny who cares
as it turns around
and I know that it descends down on me
-===DONE===
diff --git a/ext/zlib/tests/zlib_scheme_fopen_basic.phpt b/ext/zlib/tests/zlib_scheme_fopen_basic.phpt
index d06276a5f4..c6508deaa0 100644
--- a/ext/zlib/tests/zlib_scheme_fopen_basic.phpt
+++ b/ext/zlib/tests/zlib_scheme_fopen_basic.phpt
@@ -14,7 +14,6 @@ $h = fopen($srcFile, 'r');
fpassthru($h);
fclose($h);
?>
-===DONE===
--EXPECT--
When you're taught through feelings
Destiny flying high above
@@ -22,4 +21,3 @@ all I know is that you can realize it
Destiny who cares
as it turns around
and I know that it descends down on me
-===DONE===
diff --git a/ext/zlib/tests/zlib_scheme_fopen_variation1.phpt b/ext/zlib/tests/zlib_scheme_fopen_variation1.phpt
index a57d52f567..8bed54ebaa 100644
--- a/ext/zlib/tests/zlib_scheme_fopen_variation1.phpt
+++ b/ext/zlib/tests/zlib_scheme_fopen_variation1.phpt
@@ -17,7 +17,6 @@ $h = fopen($compressedFile, 'r');
fpassthru($h);
fclose($h);
?>
-===DONE===
--EXPECTF--
file=compress.zlib://file://%s/004.txt.gz
@@ -27,4 +26,3 @@ all I know is that you can realize it
Destiny who cares
as it turns around
and I know that it descends down on me
-===DONE===
diff --git a/ext/zlib/tests/zlib_scheme_rename_basic.phpt b/ext/zlib/tests/zlib_scheme_rename_basic.phpt
index e7225b6d81..b58a09f89e 100644
--- a/ext/zlib/tests/zlib_scheme_rename_basic.phpt
+++ b/ext/zlib/tests/zlib_scheme_rename_basic.phpt
@@ -13,8 +13,6 @@ $srcFile = "compress.zlib://$inputFileName";
rename($srcFile, 'something.tmp');
var_dump(file_exists($inputFileName));
?>
-===DONE===
--EXPECTF--
Warning: rename(): ZLIB wrapper does not support renaming in %s on line %d
bool(true)
-===DONE===
diff --git a/ext/zlib/tests/zlib_scheme_stat_basic.phpt b/ext/zlib/tests/zlib_scheme_stat_basic.phpt
index d7997e2ebd..31d08866ba 100644
--- a/ext/zlib/tests/zlib_scheme_stat_basic.phpt
+++ b/ext/zlib/tests/zlib_scheme_stat_basic.phpt
@@ -13,9 +13,7 @@ $srcFile = "compress.zlib://$inputFileName";
stat($srcFile);
lstat($srcFile);
?>
-===DONE===
--EXPECTF--
Warning: stat(): stat failed for compress.zlib://%s/004.txt.gz in %s on line %d
Warning: lstat(): Lstat failed for compress.zlib://%s/004.txt.gz in %s on line %d
-===DONE===
diff --git a/ext/zlib/tests/zlib_scheme_stat_basic2.phpt b/ext/zlib/tests/zlib_scheme_stat_basic2.phpt
index e74504939e..23c59f8ff3 100644
--- a/ext/zlib/tests/zlib_scheme_stat_basic2.phpt
+++ b/ext/zlib/tests/zlib_scheme_stat_basic2.phpt
@@ -27,7 +27,6 @@ echo "fileatime=";
var_dump(fileatime($srcFile));
?>
-===DONE===
--EXPECTF--
file_exists=bool(false)
is_file=bool(false)
@@ -43,4 +42,3 @@ bool(false)
fileatime=
Warning: fileatime(): stat failed for compress.zlib://%s004.txt.gz in %s on line %d
bool(false)
-===DONE===
diff --git a/ext/zlib/tests/zlib_scheme_unlink_basic.phpt b/ext/zlib/tests/zlib_scheme_unlink_basic.phpt
index cb2734d905..ca21637ed1 100644
--- a/ext/zlib/tests/zlib_scheme_unlink_basic.phpt
+++ b/ext/zlib/tests/zlib_scheme_unlink_basic.phpt
@@ -13,8 +13,6 @@ $srcFile = "compress.zlib://$inputFileName";
unlink($srcFile);
var_dump(file_exists($inputFileName));
?>
-===DONE===
--EXPECTF--
Warning: unlink(): ZLIB does not allow unlinking in %s on line %d
bool(true)
-===DONE===
diff --git a/ext/zlib/tests/zlib_wrapper_fflush_basic.phpt b/ext/zlib/tests/zlib_wrapper_fflush_basic.phpt
index d4e7214937..6911aabe69 100644
--- a/ext/zlib/tests/zlib_wrapper_fflush_basic.phpt
+++ b/ext/zlib/tests/zlib_wrapper_fflush_basic.phpt
@@ -25,9 +25,7 @@ gzclose($h);
echo "\n";
unlink($filename);
?>
-===DONE===
--EXPECT--
bool(true)
bool(true)
Here is the string to be written.Here is the string to be written.
-===DONE===
diff --git a/ext/zlib/tests/zlib_wrapper_flock_basic.phpt b/ext/zlib/tests/zlib_wrapper_flock_basic.phpt
index e32f116420..41c651c50f 100644
--- a/ext/zlib/tests/zlib_wrapper_flock_basic.phpt
+++ b/ext/zlib/tests/zlib_wrapper_flock_basic.phpt
@@ -13,7 +13,5 @@ $h = gzopen($f,'r');
var_dump(flock($h, LOCK_SH));
gzclose($h);
?>
-===DONE===
--EXPECT--
bool(false)
-===DONE===
diff --git a/ext/zlib/tests/zlib_wrapper_fstat_basic.phpt b/ext/zlib/tests/zlib_wrapper_fstat_basic.phpt
index cb7cf915ff..20af263e5a 100644
--- a/ext/zlib/tests/zlib_wrapper_fstat_basic.phpt
+++ b/ext/zlib/tests/zlib_wrapper_fstat_basic.phpt
@@ -13,7 +13,5 @@ $h = gzopen($f, "r");
var_dump(fstat($h));
fclose($h);
?>
-===DONE===
--EXPECT--
bool(false)
-===DONE===
diff --git a/ext/zlib/tests/zlib_wrapper_ftruncate_basic.phpt b/ext/zlib/tests/zlib_wrapper_ftruncate_basic.phpt
index 674243ab5c..2ace80d21c 100644
--- a/ext/zlib/tests/zlib_wrapper_ftruncate_basic.phpt
+++ b/ext/zlib/tests/zlib_wrapper_ftruncate_basic.phpt
@@ -23,9 +23,7 @@ fclose($h);
unlink($f2);
?>
-===DONE===
--EXPECTF--
Warning: ftruncate(): Can't truncate this stream! in %s on line %d
Warning: ftruncate(): Can't truncate this stream! in %s on line %d
-===DONE===
diff --git a/ext/zlib/tests/zlib_wrapper_meta_data_basic.phpt b/ext/zlib/tests/zlib_wrapper_meta_data_basic.phpt
index 591b93d075..8476b2923a 100644
--- a/ext/zlib/tests/zlib_wrapper_meta_data_basic.phpt
+++ b/ext/zlib/tests/zlib_wrapper_meta_data_basic.phpt
@@ -21,7 +21,6 @@ gzclose($h);
?>
-===DONE===
--EXPECTF--
no wrapper
array(7) {
@@ -62,4 +61,3 @@ array(9) {
["uri"]=>
string(%d) "compress.zlib://%s/004.txt.gz"
}
-===DONE===
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index 9060dcb2e2..abc855c752 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -31,6 +29,7 @@
#include "ext/standard/file.h"
#include "ext/standard/php_string.h"
#include "php_zlib.h"
+#include "zlib_arginfo.h"
/*
* zlib include files can define the following preprocessor defines which rename
@@ -45,7 +44,9 @@
#undef gztell
int le_deflate;
+#define le_deflate_name "zlib deflate"
int le_inflate;
+#define le_inflate_name "zlib inflate"
ZEND_DECLARE_MODULE_GLOBALS(zlib);
@@ -66,14 +67,14 @@ static void php_zlib_free(voidpf opaque, voidpf address)
void deflate_rsrc_dtor(zend_resource *res)
{
- z_stream *ctx = zend_fetch_resource(res, NULL, le_deflate);
+ z_stream *ctx = zend_fetch_resource(res, le_deflate_name, le_deflate);
deflateEnd(ctx);
efree(ctx);
}
void inflate_rsrc_dtor(zend_resource *res)
{
- z_stream *ctx = zend_fetch_resource(res, NULL, le_inflate);
+ z_stream *ctx = zend_fetch_resource(res, le_inflate_name, le_inflate);
if (((php_zlib_context *) ctx)->inflateDict) {
efree(((php_zlib_context *) ctx)->inflateDict);
}
@@ -490,7 +491,7 @@ static PHP_FUNCTION(ob_gzhandler)
* - we have to mess around with php_output_context */
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "sl", &in_str, &in_len, &flags)) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (!(encoding = php_zlib_output_encoding())) {
@@ -543,7 +544,7 @@ static PHP_FUNCTION(ob_gzhandler)
static PHP_FUNCTION(zlib_get_coding_type)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
switch (ZLIBG(compression_coding)) {
case PHP_ZLIB_ENCODING_GZIP:
@@ -569,7 +570,7 @@ static PHP_FUNCTION(gzfile)
php_stream *stream;
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "p|l", &filename, &filename_len, &use_include_path)) {
- return;
+ RETURN_THROWS();
}
if (use_include_path) {
@@ -609,7 +610,7 @@ static PHP_FUNCTION(gzopen)
zend_long use_include_path = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ps|l", &filename, &filename_len, &mode, &mode_len, &use_include_path) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (use_include_path) {
@@ -637,7 +638,7 @@ static PHP_FUNCTION(readgzfile)
zend_long use_include_path = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|l", &filename, &filename_len, &use_include_path) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (use_include_path) {
@@ -663,16 +664,16 @@ static PHP_FUNCTION(name) \
zend_long encoding = default_encoding; \
if (default_encoding) { \
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "S|ll", &in, &level, &encoding)) { \
- return; \
+ RETURN_THROWS(); \
} \
} else { \
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "Sl|l", &in, &encoding, &level)) { \
- return; \
+ RETURN_THROWS(); \
} \
} \
if (level < -1 || level > 9) { \
- php_error_docref(NULL, E_WARNING, "compression level (" ZEND_LONG_FMT ") must be within -1..9", level); \
- RETURN_FALSE; \
+ zend_value_error("Compression level (" ZEND_LONG_FMT ") must be within -1..9", level); \
+ RETURN_THROWS(); \
} \
switch (encoding) { \
case PHP_ZLIB_ENCODING_RAW: \
@@ -680,8 +681,8 @@ static PHP_FUNCTION(name) \
case PHP_ZLIB_ENCODING_DEFLATE: \
break; \
default: \
- php_error_docref(NULL, E_WARNING, "encoding mode must be either ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or ZLIB_ENCODING_DEFLATE"); \
- RETURN_FALSE; \
+ zend_value_error("Encoding mode must be either ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or ZLIB_ENCODING_DEFLATE"); \
+ RETURN_THROWS(); \
} \
if ((out = php_zlib_encode(ZSTR_VAL(in), ZSTR_LEN(in), encoding, level)) == NULL) { \
RETURN_FALSE; \
@@ -697,11 +698,11 @@ static PHP_FUNCTION(name) \
size_t out_len; \
zend_long max_len = 0; \
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "s|l", &in_buf, &in_len, &max_len)) { \
- return; \
+ RETURN_THROWS(); \
} \
if (max_len < 0) { \
- php_error_docref(NULL, E_WARNING, "length (" ZEND_LONG_FMT ") must be greater or equal zero", max_len); \
- RETURN_FALSE; \
+ zend_value_error("Length (" ZEND_LONG_FMT ") must be greater or equal zero", max_len); \
+ RETURN_THROWS(); \
} \
if (SUCCESS != php_zlib_decode(in_buf, in_len, &out_buf, &out_len, encoding, max_len)) { \
RETURN_FALSE; \
@@ -786,7 +787,7 @@ static zend_bool zlib_create_dictionary_string(HashTable *options, char **dict,
}
efree(strings);
if (!EG(exception)) {
- php_error_docref(NULL, E_WARNING, "dictionary entries must be non-empty strings");
+ zend_value_error("Dictionary entries must be non-empty strings");
}
return 0;
}
@@ -796,7 +797,7 @@ static zend_bool zlib_create_dictionary_string(HashTable *options, char **dict,
efree(ptr);
} while (--ptr >= strings);
efree(strings);
- php_error_docref(NULL, E_WARNING, "dictionary entries must not contain a NULL-byte");
+ zend_value_error("Dictionary entries must not contain a NULL-byte");
return 0;
}
}
@@ -818,7 +819,7 @@ static zend_bool zlib_create_dictionary_string(HashTable *options, char **dict,
} break;
default:
- php_error_docref(NULL, E_WARNING, "dictionary must be of type zero-terminated string or array, got %s", zend_get_type_by_const(Z_TYPE_P(option_buffer)));
+ zend_type_error("Dictionary must be of type zero-terminated string or array, got %s", zend_get_type_by_const(Z_TYPE_P(option_buffer)));
return 0;
}
}
@@ -838,15 +839,15 @@ PHP_FUNCTION(inflate_init)
zval *option_buffer;
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "l|H", &encoding, &options)) {
- return;
+ RETURN_THROWS();
}
if (options && (option_buffer = zend_hash_str_find(options, ZEND_STRL("window"))) != NULL) {
window = zval_get_long(option_buffer);
}
if (window < 8 || window > 15) {
- php_error_docref(NULL, E_WARNING, "zlib window size (lograithm) (" ZEND_LONG_FMT ") must be within 8..15", window);
- RETURN_FALSE;
+ zend_value_error("zlib window size (logarithm) (" ZEND_LONG_FMT ") must be within 8..15", window);
+ RETURN_THROWS();
}
if (!zlib_create_dictionary_string(options, &dict, &dictlen)) {
@@ -859,8 +860,8 @@ PHP_FUNCTION(inflate_init)
case PHP_ZLIB_ENCODING_DEFLATE:
break;
default:
- php_error_docref(NULL, E_WARNING, "encoding mode must be ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or ZLIB_ENCODING_DEFLATE");
- RETURN_FALSE;
+ zend_value_error("Encoding mode must be ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or ZLIB_ENCODING_DEFLATE");
+ RETURN_THROWS();
}
ctx = ecalloc(1, sizeof(php_zlib_context));
@@ -885,17 +886,16 @@ PHP_FUNCTION(inflate_init)
php_ctx->inflateDict = NULL;
break;
case Z_DATA_ERROR:
- php_error_docref(NULL, E_WARNING, "dictionary does not match expected dictionary (incorrect adler32 hash)");
+ php_error_docref(NULL, E_WARNING, "Dictionary does not match expected dictionary (incorrect adler32 hash)");
efree(php_ctx->inflateDict);
php_ctx->inflateDict = NULL;
- RETURN_FALSE;
EMPTY_SWITCH_DEFAULT_CASE()
}
}
RETURN_RES(zend_register_resource(ctx, le_inflate));
} else {
efree(ctx);
- php_error_docref(NULL, E_WARNING, "failed allocating zlib.inflate context");
+ php_error_docref(NULL, E_WARNING, "Failed allocating zlib.inflate context");
RETURN_FALSE;
}
}
@@ -914,12 +914,11 @@ PHP_FUNCTION(inflate_add)
int status;
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "rs|l", &res, &in_buf, &in_len, &flush_type)) {
- return;
+ RETURN_THROWS();
}
- if (!(ctx = zend_fetch_resource_ex(res, NULL, le_inflate))) {
- php_error_docref(NULL, E_WARNING, "Invalid zlib.inflate resource");
- RETURN_FALSE;
+ if ((ctx = zend_fetch_resource(Z_RES_P(res), le_inflate_name, le_inflate)) == NULL) {
+ RETURN_THROWS();
}
switch (flush_type) {
@@ -932,9 +931,9 @@ PHP_FUNCTION(inflate_add)
break;
default:
- php_error_docref(NULL, E_WARNING,
- "flush mode must be ZLIB_NO_FLUSH, ZLIB_PARTIAL_FLUSH, ZLIB_SYNC_FLUSH, ZLIB_FULL_FLUSH, ZLIB_BLOCK or ZLIB_FINISH");
- RETURN_FALSE;
+ zend_value_error(
+ "Flush mode must be ZLIB_NO_FLUSH, ZLIB_PARTIAL_FLUSH, ZLIB_SYNC_FLUSH, ZLIB_FULL_FLUSH, ZLIB_BLOCK or ZLIB_FINISH");
+ RETURN_THROWS();
}
/* Lazy-resetting the zlib stream so ctx->total_in remains available until the next inflate_add() call. */
@@ -993,7 +992,7 @@ PHP_FUNCTION(inflate_add)
php_ctx->inflateDict = NULL;
break;
case Z_DATA_ERROR:
- php_error_docref(NULL, E_WARNING, "dictionary does not match expected dictionary (incorrect adler32 hash)");
+ php_error_docref(NULL, E_WARNING, "Dictionary does not match expected dictionary (incorrect adler32 hash)");
efree(php_ctx->inflateDict);
zend_string_release_ex(out, 0);
php_ctx->inflateDict = NULL;
@@ -1002,7 +1001,7 @@ PHP_FUNCTION(inflate_add)
}
break;
} else {
- php_error_docref(NULL, E_WARNING, "inflating this data requires a preset dictionary, please specify it in the options array of inflate_init()");
+ php_error_docref(NULL, E_WARNING, "Inflating this data requires a preset dictionary, please specify it in the options array of inflate_init()");
RETURN_FALSE;
}
default:
@@ -1029,12 +1028,11 @@ PHP_FUNCTION(inflate_get_status)
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "r", &res))
{
- RETURN_NULL();
+ RETURN_THROWS();
}
- if (!(ctx = zend_fetch_resource_ex(res, NULL, le_inflate))) {
- php_error_docref(NULL, E_WARNING, "Invalid zlib.inflate resource");
- RETURN_FALSE;
+ if ((ctx = zend_fetch_resource(Z_RES_P(res), le_inflate_name, le_inflate)) == NULL) {
+ RETURN_THROWS();
}
RETURN_LONG(((php_zlib_context *) ctx)->status);
@@ -1050,12 +1048,11 @@ PHP_FUNCTION(inflate_get_read_len)
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "r", &res))
{
- RETURN_NULL();
+ RETURN_THROWS();
}
- if (!(ctx = zend_fetch_resource_ex(res, NULL, le_inflate))) {
- php_error_docref(NULL, E_WARNING, "Invalid zlib.inflate resource");
- RETURN_FALSE;
+ if ((ctx = zend_fetch_resource(Z_RES_P(res), le_inflate_name, le_inflate)) == NULL) {
+ RETURN_THROWS();
}
RETURN_LONG(ctx->total_in);
@@ -1074,31 +1071,31 @@ PHP_FUNCTION(deflate_init)
zval *option_buffer;
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "l|H", &encoding, &options)) {
- return;
+ RETURN_THROWS();
}
if (options && (option_buffer = zend_hash_str_find(options, ZEND_STRL("level"))) != NULL) {
level = zval_get_long(option_buffer);
}
if (level < -1 || level > 9) {
- php_error_docref(NULL, E_WARNING, "compression level (" ZEND_LONG_FMT ") must be within -1..9", level);
- RETURN_FALSE;
+ zend_value_error("Compression level (" ZEND_LONG_FMT ") must be within -1..9", level);
+ RETURN_THROWS();
}
if (options && (option_buffer = zend_hash_str_find(options, ZEND_STRL("memory"))) != NULL) {
memory = zval_get_long(option_buffer);
}
if (memory < 1 || memory > 9) {
- php_error_docref(NULL, E_WARNING, "compression memory level (" ZEND_LONG_FMT ") must be within 1..9", memory);
- RETURN_FALSE;
+ zend_value_error("Compression memory level (" ZEND_LONG_FMT ") must be within 1..9", memory);
+ RETURN_THROWS();
}
if (options && (option_buffer = zend_hash_str_find(options, ZEND_STRL("window"))) != NULL) {
window = zval_get_long(option_buffer);
}
if (window < 8 || window > 15) {
- php_error_docref(NULL, E_WARNING, "zlib window size (logarithm) (" ZEND_LONG_FMT ") must be within 8..15", window);
- RETURN_FALSE;
+ zend_value_error("zlib window size (logarithm) (" ZEND_LONG_FMT ") must be within 8..15", window);
+ RETURN_THROWS();
}
if (options && (option_buffer = zend_hash_str_find(options, ZEND_STRL("strategy"))) != NULL) {
@@ -1112,8 +1109,8 @@ PHP_FUNCTION(deflate_init)
case Z_DEFAULT_STRATEGY:
break;
default:
- php_error_docref(NULL, E_WARNING, "strategy must be one of ZLIB_FILTERED, ZLIB_HUFFMAN_ONLY, ZLIB_RLE, ZLIB_FIXED or ZLIB_DEFAULT_STRATEGY");
- RETURN_FALSE;
+ zend_value_error("Strategy must be one of ZLIB_FILTERED, ZLIB_HUFFMAN_ONLY, ZLIB_RLE, ZLIB_FIXED or ZLIB_DEFAULT_STRATEGY");
+ RETURN_THROWS();
}
if (!zlib_create_dictionary_string(options, &dict, &dictlen)) {
@@ -1126,9 +1123,8 @@ PHP_FUNCTION(deflate_init)
case PHP_ZLIB_ENCODING_DEFLATE:
break;
default:
- php_error_docref(NULL, E_WARNING,
- "encoding mode must be ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or ZLIB_ENCODING_DEFLATE");
- RETURN_FALSE;
+ zend_value_error("Encoding mode must be ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or ZLIB_ENCODING_DEFLATE");
+ RETURN_THROWS();
}
ctx = ecalloc(1, sizeof(php_zlib_context));
@@ -1151,7 +1147,7 @@ PHP_FUNCTION(deflate_init)
RETURN_RES(zend_register_resource(ctx, le_deflate));
} else {
efree(ctx);
- php_error_docref(NULL, E_WARNING, "failed allocating zlib.deflate context");
+ php_error_docref(NULL, E_WARNING, "Failed allocating zlib.deflate context");
RETURN_FALSE;
}
}
@@ -1170,20 +1166,18 @@ PHP_FUNCTION(deflate_add)
int status;
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "rs|l", &res, &in_buf, &in_len, &flush_type)) {
- return;
+ RETURN_THROWS();
}
- if (!(ctx = zend_fetch_resource_ex(res, NULL, le_deflate))) {
- php_error_docref(NULL, E_WARNING, "Invalid deflate resource");
- RETURN_FALSE;
+ if ((ctx = zend_fetch_resource(Z_RES_P(res), le_deflate_name, le_deflate)) == NULL) {
+ RETURN_THROWS();
}
switch (flush_type) {
case Z_BLOCK:
#if ZLIB_VERNUM < 0x1240L
- php_error_docref(NULL, E_WARNING,
- "zlib >= 1.2.4 required for BLOCK deflate; current version: %s", ZLIB_VERSION);
- RETURN_FALSE;
+ zend_throw_error(NULL, "zlib >= 1.2.4 required for BLOCK deflate; current version: %s", ZLIB_VERSION);
+ RETURN_THROWS();
#endif
case Z_NO_FLUSH:
case Z_PARTIAL_FLUSH:
@@ -1193,9 +1187,9 @@ PHP_FUNCTION(deflate_add)
break;
default:
- php_error_docref(NULL, E_WARNING,
- "flush mode must be ZLIB_NO_FLUSH, ZLIB_PARTIAL_FLUSH, ZLIB_SYNC_FLUSH, ZLIB_FULL_FLUSH, ZLIB_BLOCK or ZLIB_FINISH");
- RETURN_FALSE;
+ zend_value_error(
+ "Flush mode must be ZLIB_NO_FLUSH, ZLIB_PARTIAL_FLUSH, ZLIB_SYNC_FLUSH, ZLIB_FULL_FLUSH, ZLIB_BLOCK or ZLIB_FINISH");
+ RETURN_THROWS();
}
if (in_len <= 0 && flush_type != Z_FINISH) {
@@ -1252,154 +1246,20 @@ ZEND_TSRMLS_CACHE_DEFINE()
ZEND_GET_MODULE(php_zlib)
#endif
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_ob_gzhandler, 0, 0, 2)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_zlib_get_coding_type, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gzfile, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, use_include_path)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gzopen, 0, 0, 2)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, mode)
- ZEND_ARG_INFO(0, use_include_path)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_readgzfile, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, use_include_path)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_zlib_encode, 0, 0, 2)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, encoding)
- ZEND_ARG_INFO(0, level)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_zlib_decode, 0, 0, 1)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, max_decoded_len)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gzdeflate, 0, 0, 1)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, level)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gzencode, 0, 0, 1)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, level)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gzcompress, 0, 0, 1)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, level)
- ZEND_ARG_INFO(0, encoding)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gzinflate, 0, 0, 1)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, max_decoded_len)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gzdecode, 0, 0, 1)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, max_decoded_len)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gzuncompress, 0, 0, 1)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, max_decoded_len)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gzputs, 0, 0, 2)
- ZEND_ARG_INFO(0, fp)
- ZEND_ARG_INFO(0, str)
- ZEND_ARG_INFO(0, length)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_gzpassthru, 0)
- ZEND_ARG_INFO(0, fp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gzseek, 0, 0, 2)
- ZEND_ARG_INFO(0, fp)
- ZEND_ARG_INFO(0, offset)
- ZEND_ARG_INFO(0, whence)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_gzread, 0)
- ZEND_ARG_INFO(0, fp)
- ZEND_ARG_INFO(0, length)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gzgetss, 0, 0, 1)
- ZEND_ARG_INFO(0, fp)
- ZEND_ARG_INFO(0, length)
- ZEND_ARG_INFO(0, allowable_tags)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_gzgets, 0, 0, 1)
- ZEND_ARG_INFO(0, fp)
- ZEND_ARG_INFO(0, length)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_deflate_init, 0, 0, 1)
- ZEND_ARG_INFO(0, encoding)
- ZEND_ARG_INFO(0, level)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_deflate_add, 0, 0, 2)
- ZEND_ARG_INFO(0, resource)
- ZEND_ARG_INFO(0, add)
- ZEND_ARG_INFO(0, flush_behavior)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_inflate_init, 0, 0, 1)
- ZEND_ARG_INFO(0, encoding)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_inflate_add, 0, 0, 2)
- ZEND_ARG_INFO(0, context)
- ZEND_ARG_INFO(0, encoded_data)
- ZEND_ARG_INFO(0, flush_mode)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_inflate_get_status, 0, 0, 1)
- ZEND_ARG_INFO(0, resource)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_inflate_get_read_len, 0, 0, 1)
- ZEND_ARG_INFO(0, resource)
-ZEND_END_ARG_INFO()
-
-/* }}} */
-
/* {{{ php_zlib_functions[] */
static const zend_function_entry php_zlib_functions[] = {
PHP_FE(readgzfile, arginfo_readgzfile)
- PHP_FALIAS(gzrewind, rewind, arginfo_gzpassthru)
- PHP_FALIAS(gzclose, fclose, arginfo_gzpassthru)
- PHP_FALIAS(gzeof, feof, arginfo_gzpassthru)
- PHP_FALIAS(gzgetc, fgetc, arginfo_gzpassthru)
+ PHP_FALIAS(gzrewind, rewind, arginfo_gzrewind)
+ PHP_FALIAS(gzclose, fclose, arginfo_gzclose)
+ PHP_FALIAS(gzeof, feof, arginfo_gzeof)
+ PHP_FALIAS(gzgetc, fgetc, arginfo_gzgetc)
PHP_FALIAS(gzgets, fgets, arginfo_gzgets)
- PHP_DEP_FALIAS(gzgetss, fgetss, arginfo_gzgetss)
PHP_FALIAS(gzread, fread, arginfo_gzread)
PHP_FE(gzopen, arginfo_gzopen)
PHP_FALIAS(gzpassthru, fpassthru, arginfo_gzpassthru)
PHP_FALIAS(gzseek, fseek, arginfo_gzseek)
- PHP_FALIAS(gztell, ftell, arginfo_gzpassthru)
- PHP_FALIAS(gzwrite, fwrite, arginfo_gzputs)
+ PHP_FALIAS(gztell, ftell, arginfo_gztell)
+ PHP_FALIAS(gzwrite, fwrite, arginfo_gzwrite)
PHP_FALIAS(gzputs, fwrite, arginfo_gzputs)
PHP_FE(gzfile, arginfo_gzfile)
PHP_FE(gzcompress, arginfo_gzcompress)
diff --git a/ext/zlib/zlib.stub.php b/ext/zlib/zlib.stub.php
new file mode 100644
index 0000000000..a4c02bd0cc
--- /dev/null
+++ b/ext/zlib/zlib.stub.php
@@ -0,0 +1,79 @@
+<?php
+
+function ob_gzhandler(string $data, int $flags): string|false {}
+
+function zlib_get_coding_type(): string|false {}
+
+function gzfile(string $filename, int $use_include_path = 0): array|false {}
+
+/** @return resource|false */
+function gzopen(string $filename, string $mode, int $use_include_path = 0) {}
+
+function readgzfile(string $filename, int $use_include_path = 0): int|false {}
+
+function zlib_encode(string $data, int $encoding, int $level = -1): string|false {}
+
+function zlib_decode(string $data, int $max_decoded_len = 0): string|false {}
+
+function gzdeflate(string $data, int $level = -1, int $encoding = ZLIB_ENCODING_RAW): string|false {}
+
+function gzencode(string $data, int $level = -1, int $encoding = ZLIB_ENCODING_GZIP): string|false {}
+
+function gzcompress(string $data, int $level = -1, int $encoding = ZLIB_ENCODING_DEFLATE): string|false {}
+
+function gzinflate(string $data, int $max_decoded_len = 0): string|false {}
+
+function gzdecode(string $data, int $max_decoded_len = 0): string|false {}
+
+function gzuncompress(string $data, int $max_decoded_len = 0): string|false {}
+
+/** @param resource $fp */
+function gzwrite($fp, string $str, int $length = UNKNOWN): int|false {}
+
+/** @param resource $fp */
+function gzputs($fp, string $str, int $length = UNKNOWN): int|false {}
+
+/** @param resource $fp */
+function gzrewind($fp): bool {}
+
+/** @param resource $fp */
+function gzclose($fp): bool {}
+
+/** @param resource $fp */
+function gzeof($fp): bool {}
+
+/** @param resource $fp */
+function gzgetc($fp): string|false {}
+
+/** @param resource $fp */
+function gzpassthru($fp): int {}
+
+/** @param resource $fp */
+function gzseek($fp, int $offset, int $whence = SEEK_SET): int {}
+
+/** @param resource $fp */
+function gztell($fp): int|false {}
+
+/** @param resource $fp */
+function gzread($fp, int $length): string|false {}
+
+/** @param resource $fp */
+function gzgets($fp, int $length = 1024): string|false {}
+
+/** @return resource|false */
+function deflate_init(int $encoding, array $options = []) {}
+
+/** @param resource $resource */
+function deflate_add($resource, string $add, int $flush_behavior = ZLIB_SYNC_FLUSH): string|false {}
+
+/** @return resource|false */
+function inflate_init(int $encoding, array $options = []) {}
+
+/** @param resource $context */
+function inflate_add($context, string $encoded_data, int $flush_mode = ZLIB_SYNC_FLUSH): string|false {}
+
+/** @param resource $resource */
+function inflate_get_status($resource): int {}
+
+/** @param resource $resource */
+function inflate_get_read_len($resource): int {}
diff --git a/ext/zlib/zlib_arginfo.h b/ext/zlib/zlib_arginfo.h
new file mode 100644
index 0000000000..fc5c81b465
--- /dev/null
+++ b/ext/zlib/zlib_arginfo.h
@@ -0,0 +1,121 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ob_gzhandler, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_zlib_get_coding_type, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_gzfile, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, use_include_path, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_gzopen, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, mode, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, use_include_path, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_readgzfile, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, use_include_path, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_zlib_encode, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, level, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_zlib_decode, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, max_decoded_len, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_gzdeflate, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, level, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_gzencode arginfo_gzdeflate
+
+#define arginfo_gzcompress arginfo_gzdeflate
+
+#define arginfo_gzinflate arginfo_zlib_decode
+
+#define arginfo_gzdecode arginfo_zlib_decode
+
+#define arginfo_gzuncompress arginfo_zlib_decode
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_gzwrite, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, fp)
+ ZEND_ARG_TYPE_INFO(0, str, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_gzputs arginfo_gzwrite
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_gzrewind, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, fp)
+ZEND_END_ARG_INFO()
+
+#define arginfo_gzclose arginfo_gzrewind
+
+#define arginfo_gzeof arginfo_gzrewind
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_gzgetc, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, fp)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_gzpassthru, 0, 1, IS_LONG, 0)
+ ZEND_ARG_INFO(0, fp)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_gzseek, 0, 2, IS_LONG, 0)
+ ZEND_ARG_INFO(0, fp)
+ ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, whence, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_gztell, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, fp)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_gzread, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, fp)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_gzgets, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, fp)
+ ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_deflate_init, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, encoding, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_deflate_add, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, resource)
+ ZEND_ARG_TYPE_INFO(0, add, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, flush_behavior, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_inflate_init arginfo_deflate_init
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_inflate_add, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_INFO(0, context)
+ ZEND_ARG_TYPE_INFO(0, encoded_data, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, flush_mode, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_inflate_get_status, 0, 1, IS_LONG, 0)
+ ZEND_ARG_INFO(0, resource)
+ZEND_END_ARG_INFO()
+
+#define arginfo_inflate_get_read_len arginfo_inflate_get_status
diff --git a/ext/zlib/zlib_filter.c b/ext/zlib/zlib_filter.c
index 3654a140fd..9026fcfedf 100644
--- a/ext/zlib/zlib_filter.c
+++ b/ext/zlib/zlib_filter.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/ext/zlib/zlib_fopen_wrapper.c b/ext/zlib/zlib_fopen_wrapper.c
index 514773f2b0..ef26aaf787 100644
--- a/ext/zlib/zlib_fopen_wrapper.c
+++ b/ext/zlib/zlib_fopen_wrapper.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -114,7 +112,7 @@ php_stream *php_stream_gzopen(php_stream_wrapper *wrapper, const char *path, con
/* sanity check the stream: it can be either read-only or write-only */
if (strchr(mode, '+')) {
if (options & REPORT_ERRORS) {
- php_error_docref(NULL, E_WARNING, "cannot open a zlib stream for reading and writing at the same time!");
+ php_error_docref(NULL, E_WARNING, "Cannot open a zlib stream for reading and writing at the same time!");
}
return NULL;
}
diff --git a/main/SAPI.c b/main/SAPI.c
index a5a68f8c68..5ad40eec1e 100644
--- a/main/SAPI.c
+++ b/main/SAPI.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -118,7 +116,7 @@ PHP_FUNCTION(header_register_callback)
zval *callback_func;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &callback_func) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!zend_is_callable(callback_func, 0, NULL)) {
diff --git a/main/SAPI.h b/main/SAPI.h
index fe8bfd6244..dcb4c13845 100644
--- a/main/SAPI.h
+++ b/main/SAPI.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/build-defs.h.in b/main/build-defs.h.in
index f007526846..374996c64a 100644
--- a/main/build-defs.h.in
+++ b/main/build-defs.h.in
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/explicit_bzero.c b/main/explicit_bzero.c
index 57d12080c6..b3c59813d7 100644
--- a/main/explicit_bzero.c
+++ b/main/explicit_bzero.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/fastcgi.c b/main/fastcgi.c
index f8044ffce3..dacb06bcfe 100644
--- a/main/fastcgi.c
+++ b/main/fastcgi.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/fastcgi.h b/main/fastcgi.h
index 95aae11e41..5e15c14d4b 100644
--- a/main/fastcgi.h
+++ b/main/fastcgi.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c
index 11d31366d7..b2d698e7b0 100644
--- a/main/fopen_wrappers.c
+++ b/main/fopen_wrappers.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/fopen_wrappers.h b/main/fopen_wrappers.h
index 17e15b7df0..0f70bb4231 100644
--- a/main/fopen_wrappers.h
+++ b/main/fopen_wrappers.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/getopt.c b/main/getopt.c
index 9123cee0f2..2160a6f4fe 100644
--- a/main/getopt.c
+++ b/main/getopt.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/http_status_codes.h b/main/http_status_codes.h
index 5d5cfb08c3..cf66eabad7 100644
--- a/main/http_status_codes.h
+++ b/main/http_status_codes.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/internal_functions.c.in b/main/internal_functions.c.in
index 59557c9651..41458fb366 100644
--- a/main/internal_functions.c.in
+++ b/main/internal_functions.c.in
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/internal_functions_win32.c b/main/internal_functions_win32.c
index 4a3301e49b..bbee5fd0e7 100644
--- a/main/internal_functions_win32.c
+++ b/main/internal_functions_win32.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/main.c b/main/main.c
index e1491db1fd..8e41ec9f49 100644
--- a/main/main.c
+++ b/main/main.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -731,7 +729,7 @@ PHP_INI_BEGIN()
PHP_INI_ENTRY_EX("highlight.string", HL_STRING_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb)
STD_PHP_INI_ENTRY_EX("display_errors", "1", PHP_INI_ALL, OnUpdateDisplayErrors, display_errors, php_core_globals, core_globals, display_errors_mode)
- STD_PHP_INI_BOOLEAN("display_startup_errors", "0", PHP_INI_ALL, OnUpdateBool, display_startup_errors, php_core_globals, core_globals)
+ STD_PHP_INI_BOOLEAN("display_startup_errors", "1", PHP_INI_ALL, OnUpdateBool, display_startup_errors, php_core_globals, core_globals)
STD_PHP_INI_BOOLEAN("enable_dl", "1", PHP_INI_SYSTEM, OnUpdateBool, enable_dl, php_core_globals, core_globals)
STD_PHP_INI_BOOLEAN("expose_php", "1", PHP_INI_SYSTEM, OnUpdateBool, expose_php, php_core_globals, core_globals)
STD_PHP_INI_ENTRY("docref_root", "", PHP_INI_ALL, OnUpdateString, docref_root, php_core_globals, core_globals)
@@ -753,7 +751,6 @@ PHP_INI_BEGIN()
STD_PHP_INI_BOOLEAN("register_argc_argv", "1", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateBool, register_argc_argv, php_core_globals, core_globals)
STD_PHP_INI_BOOLEAN("auto_globals_jit", "1", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateBool, auto_globals_jit, php_core_globals, core_globals)
STD_PHP_INI_BOOLEAN("short_open_tag", DEFAULT_SHORT_OPEN_TAG, PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, short_tags, zend_compiler_globals, compiler_globals)
- STD_PHP_INI_BOOLEAN("track_errors", "0", PHP_INI_ALL, OnUpdateBool, track_errors, php_core_globals, core_globals)
STD_PHP_INI_ENTRY("unserialize_callback_func", NULL, PHP_INI_ALL, OnUpdateString, unserialize_callback_func, php_core_globals, core_globals)
STD_PHP_INI_ENTRY("serialize_precision", "-1", PHP_INI_ALL, OnSetSerializePrecision, serialize_precision, php_core_globals, core_globals)
@@ -1117,18 +1114,6 @@ PHPAPI ZEND_COLD void php_verror(const char *docref, const char *params, int typ
efree(docref_buf);
}
- if (PG(track_errors) && module_initialized && EG(active) &&
- (Z_TYPE(EG(user_error_handler)) == IS_UNDEF || !(EG(user_error_handler_error_reporting) & type))) {
- zval tmp;
- ZVAL_STRINGL(&tmp, buffer, buffer_len);
- if (EG(current_execute_data)) {
- if (zend_set_local_var_str("php_errormsg", sizeof("php_errormsg")-1, &tmp, 0) == FAILURE) {
- zval_ptr_dtor(&tmp);
- }
- } else {
- zend_hash_str_update_ind(&EG(symbol_table), "php_errormsg", sizeof("php_errormsg")-1, &tmp);
- }
- }
if (replace_buffer) {
zend_string_free(replace_buffer);
} else {
@@ -1205,10 +1190,11 @@ PHPAPI void php_html_puts(const char *str, size_t size)
/* {{{ php_error_cb
extended error handling function */
-static ZEND_COLD void php_error_cb(int type, const char *error_filename, const uint32_t error_lineno, const char *format, va_list args)
+static ZEND_COLD void php_error_cb(int orig_type, const char *error_filename, const uint32_t error_lineno, const char *format, va_list args)
{
char *buffer;
int buffer_len, display;
+ int type = orig_type & E_ALL;
buffer_len = (int)vspprintf(&buffer, PG(log_errors_max_len), format, args);
@@ -1416,7 +1402,7 @@ static ZEND_COLD void php_error_cb(int type, const char *error_filename, const u
sapi_header_op(SAPI_HEADER_REPLACE, &ctr);
}
/* the parser would return 1 (failure), we can bail out nicely */
- if (type != E_PARSE) {
+ if (!(orig_type & E_DONT_BAIL)) {
/* restore memory limit */
zend_set_memory_limit(PG(memory_limit));
efree(buffer);
@@ -1428,25 +1414,6 @@ static ZEND_COLD void php_error_cb(int type, const char *error_filename, const u
break;
}
- /* Log if necessary */
- if (!display) {
- efree(buffer);
- return;
- }
-
- if (PG(track_errors) && module_initialized && EG(active)) {
- zval tmp;
-
- ZVAL_STRINGL(&tmp, buffer, buffer_len);
- if (EG(current_execute_data)) {
- if (zend_set_local_var_str("php_errormsg", sizeof("php_errormsg")-1, &tmp, 0) == FAILURE) {
- zval_ptr_dtor(&tmp);
- }
- } else {
- zend_hash_str_update_ind(&EG(symbol_table), "php_errormsg", sizeof("php_errormsg")-1, &tmp);
- }
- }
-
efree(buffer);
}
/* }}} */
@@ -1530,7 +1497,7 @@ PHP_FUNCTION(set_time_limit)
zend_string *key;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &new_timeout) == FAILURE) {
- return;
+ RETURN_THROWS();
}
new_timeout_strlen = (int)zend_spprintf(&new_timeout_str, 0, ZEND_LONG_FMT, new_timeout);
@@ -2363,13 +2330,12 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
struct {
const long error_level;
const char *phrase;
- const char *directives[17]; /* Remember to change this if the number of directives change */
+ const char *directives[18]; /* Remember to change this if the number of directives change */
} directives[2] = {
{
E_DEPRECATED,
"Directive '%s' is deprecated",
{
- "track_errors",
"allow_url_include",
NULL
}
@@ -2394,6 +2360,7 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
"safe_mode_allowed_env_vars",
"safe_mode_protected_env_vars",
"zend.ze1_compatibility_mode",
+ "track_errors",
NULL
}
}
diff --git a/main/network.c b/main/network.c
index 29b98ae69e..d8bc83614e 100644
--- a/main/network.c
+++ b/main/network.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -875,7 +873,7 @@ php_socket_t php_network_connect_socket_to_host(const char *host, unsigned short
#endif
if (!local_address || bind(sock, local_address, local_address_len)) {
- php_error_docref(NULL, E_WARNING, "failed to bind to '%s:%d', system said: %s", bindto, bindport, strerror(errno));
+ php_error_docref(NULL, E_WARNING, "Failed to bind to '%s:%d', system said: %s", bindto, bindport, strerror(errno));
}
skip_bind:
if (local_address) {
@@ -1173,16 +1171,18 @@ PHPAPI void _php_emit_fd_setsize_warning(int max_fd)
PHPAPI int php_poll2(php_pollfd *ufds, unsigned int nfds, int timeout)
{
fd_set rset, wset, eset;
- php_socket_t max_fd = SOCK_ERR;
+ php_socket_t max_fd = SOCK_ERR; /* effectively unused on Windows */
unsigned int i;
int n;
struct timeval tv;
+#ifndef PHP_WIN32
/* check the highest numbered descriptor */
for (i = 0; i < nfds; i++) {
if (ufds[i].fd > max_fd)
max_fd = ufds[i].fd;
}
+#endif
PHP_SAFE_MAX_FD(max_fd, nfds + 1);
@@ -1206,7 +1206,7 @@ PHPAPI int php_poll2(php_pollfd *ufds, unsigned int nfds, int timeout)
tv.tv_sec = timeout / 1000;
tv.tv_usec = (timeout - (tv.tv_sec * 1000)) * 1000;
}
-/* Reseting/initializing */
+/* Resetting/initializing */
#ifdef PHP_WIN32
WSASetLastError(0);
#else
diff --git a/main/output.c b/main/output.c
index 7751586dbc..3bc8c278e4 100644
--- a/main/output.c
+++ b/main/output.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -592,9 +590,9 @@ PHPAPI int php_output_handler_conflict(const char *handler_new, size_t handler_n
{
if (php_output_handler_started(handler_set, handler_set_len)) {
if (handler_new_len != handler_set_len || memcmp(handler_new, handler_set, handler_set_len)) {
- php_error_docref("ref.outcontrol", E_WARNING, "output handler '%s' conflicts with '%s'", handler_new, handler_set);
+ php_error_docref("ref.outcontrol", E_WARNING, "Output handler '%s' conflicts with '%s'", handler_new, handler_set);
} else {
- php_error_docref("ref.outcontrol", E_WARNING, "output handler '%s' cannot be used twice", handler_new);
+ php_error_docref("ref.outcontrol", E_WARNING, "Output handler '%s' cannot be used twice", handler_new);
}
return 1;
}
@@ -1199,12 +1197,12 @@ static int php_output_stack_pop(int flags)
if (!orphan) {
if (!(flags & PHP_OUTPUT_POP_SILENT)) {
- php_error_docref("ref.outcontrol", E_NOTICE, "failed to %s buffer. No buffer to %s", (flags&PHP_OUTPUT_POP_DISCARD)?"discard":"send", (flags&PHP_OUTPUT_POP_DISCARD)?"discard":"send");
+ php_error_docref("ref.outcontrol", E_NOTICE, "Failed to %s buffer. No buffer to %s", (flags&PHP_OUTPUT_POP_DISCARD)?"discard":"send", (flags&PHP_OUTPUT_POP_DISCARD)?"discard":"send");
}
return 0;
} else if (!(flags & PHP_OUTPUT_POP_FORCE) && !(orphan->flags & PHP_OUTPUT_HANDLER_REMOVABLE)) {
if (!(flags & PHP_OUTPUT_POP_SILENT)) {
- php_error_docref("ref.outcontrol", E_NOTICE, "failed to %s buffer of %s (%d)", (flags&PHP_OUTPUT_POP_DISCARD)?"discard":"send", ZSTR_VAL(orphan->name), orphan->level);
+ php_error_docref("ref.outcontrol", E_NOTICE, "Failed to %s buffer of %s (%d)", (flags&PHP_OUTPUT_POP_DISCARD)?"discard":"send", ZSTR_VAL(orphan->name), orphan->level);
}
return 0;
} else {
@@ -1301,7 +1299,7 @@ PHP_FUNCTION(ob_start)
zend_long flags = PHP_OUTPUT_HANDLER_STDFLAGS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|zll", &output_handler, &chunk_size, &flags) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (chunk_size < 0) {
@@ -1309,7 +1307,7 @@ PHP_FUNCTION(ob_start)
}
if (php_output_start_user(output_handler, chunk_size, flags) == FAILURE) {
- php_error_docref("ref.outcontrol", E_NOTICE, "failed to create buffer");
+ php_error_docref("ref.outcontrol", E_NOTICE, "Failed to create buffer");
RETURN_FALSE;
}
RETURN_TRUE;
@@ -1321,16 +1319,16 @@ PHP_FUNCTION(ob_start)
PHP_FUNCTION(ob_flush)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!OG(active)) {
- php_error_docref("ref.outcontrol", E_NOTICE, "failed to flush buffer. No buffer to flush");
+ php_error_docref("ref.outcontrol", E_NOTICE, "Failed to flush buffer. No buffer to flush");
RETURN_FALSE;
}
if (SUCCESS != php_output_flush()) {
- php_error_docref("ref.outcontrol", E_NOTICE, "failed to flush buffer of %s (%d)", ZSTR_VAL(OG(active)->name), OG(active)->level);
+ php_error_docref("ref.outcontrol", E_NOTICE, "Failed to flush buffer of %s (%d)", ZSTR_VAL(OG(active)->name), OG(active)->level);
RETURN_FALSE;
}
RETURN_TRUE;
@@ -1342,16 +1340,16 @@ PHP_FUNCTION(ob_flush)
PHP_FUNCTION(ob_clean)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!OG(active)) {
- php_error_docref("ref.outcontrol", E_NOTICE, "failed to delete buffer. No buffer to delete");
+ php_error_docref("ref.outcontrol", E_NOTICE, "Failed to delete buffer. No buffer to delete");
RETURN_FALSE;
}
if (SUCCESS != php_output_clean()) {
- php_error_docref("ref.outcontrol", E_NOTICE, "failed to delete buffer of %s (%d)", ZSTR_VAL(OG(active)->name), OG(active)->level);
+ php_error_docref("ref.outcontrol", E_NOTICE, "Failed to delete buffer of %s (%d)", ZSTR_VAL(OG(active)->name), OG(active)->level);
RETURN_FALSE;
}
RETURN_TRUE;
@@ -1363,11 +1361,11 @@ PHP_FUNCTION(ob_clean)
PHP_FUNCTION(ob_end_flush)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!OG(active)) {
- php_error_docref("ref.outcontrol", E_NOTICE, "failed to delete and flush buffer. No buffer to delete or flush");
+ php_error_docref("ref.outcontrol", E_NOTICE, "Failed to delete and flush buffer. No buffer to delete or flush");
RETURN_FALSE;
}
@@ -1380,11 +1378,11 @@ PHP_FUNCTION(ob_end_flush)
PHP_FUNCTION(ob_end_clean)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!OG(active)) {
- php_error_docref("ref.outcontrol", E_NOTICE, "failed to delete buffer. No buffer to delete");
+ php_error_docref("ref.outcontrol", E_NOTICE, "Failed to delete buffer. No buffer to delete");
RETURN_FALSE;
}
@@ -1392,31 +1390,31 @@ PHP_FUNCTION(ob_end_clean)
}
/* }}} */
-/* {{{ proto bool ob_get_flush(void)
+/* {{{ proto string|false ob_get_flush(void)
Get current buffer contents, flush (send) the output buffer, and delete current output buffer */
PHP_FUNCTION(ob_get_flush)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (php_output_get_contents(return_value) == FAILURE) {
- php_error_docref("ref.outcontrol", E_NOTICE, "failed to delete and flush buffer. No buffer to delete or flush");
+ php_error_docref("ref.outcontrol", E_NOTICE, "Failed to delete and flush buffer. No buffer to delete or flush");
RETURN_FALSE;
}
if (SUCCESS != php_output_end()) {
- php_error_docref("ref.outcontrol", E_NOTICE, "failed to delete buffer of %s (%d)", ZSTR_VAL(OG(active)->name), OG(active)->level);
+ php_error_docref("ref.outcontrol", E_NOTICE, "Failed to delete buffer of %s (%d)", ZSTR_VAL(OG(active)->name), OG(active)->level);
}
}
/* }}} */
-/* {{{ proto bool ob_get_clean(void)
+/* {{{ proto string|false ob_get_clean(void)
Get current buffer contents and delete current output buffer */
PHP_FUNCTION(ob_get_clean)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if(!OG(active)) {
@@ -1424,22 +1422,22 @@ PHP_FUNCTION(ob_get_clean)
}
if (php_output_get_contents(return_value) == FAILURE) {
- php_error_docref("ref.outcontrol", E_NOTICE, "failed to delete buffer. No buffer to delete");
+ php_error_docref("ref.outcontrol", E_NOTICE, "Failed to delete buffer. No buffer to delete");
RETURN_FALSE;
}
if (SUCCESS != php_output_discard()) {
- php_error_docref("ref.outcontrol", E_NOTICE, "failed to delete buffer of %s (%d)", ZSTR_VAL(OG(active)->name), OG(active)->level);
+ php_error_docref("ref.outcontrol", E_NOTICE, "Failed to delete buffer of %s (%d)", ZSTR_VAL(OG(active)->name), OG(active)->level);
}
}
/* }}} */
-/* {{{ proto string ob_get_contents(void)
+/* {{{ proto string|false ob_get_contents(void)
Return the contents of the output buffer */
PHP_FUNCTION(ob_get_contents)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (php_output_get_contents(return_value) == FAILURE) {
@@ -1453,19 +1451,19 @@ PHP_FUNCTION(ob_get_contents)
PHP_FUNCTION(ob_get_level)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_LONG(php_output_get_level());
}
/* }}} */
-/* {{{ proto int ob_get_length(void)
+/* {{{ proto int|false ob_get_length(void)
Return the length of the output buffer */
PHP_FUNCTION(ob_get_length)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (php_output_get_length(return_value) == FAILURE) {
@@ -1474,12 +1472,12 @@ PHP_FUNCTION(ob_get_length)
}
/* }}} */
-/* {{{ proto false|array ob_list_handlers()
+/* {{{ proto null|array ob_list_handlers()
List all output_buffers in an array */
PHP_FUNCTION(ob_list_handlers)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
array_init(return_value);
@@ -1499,7 +1497,7 @@ PHP_FUNCTION(ob_get_status)
zend_bool full_status = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &full_status) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!OG(active)) {
@@ -1523,7 +1521,7 @@ PHP_FUNCTION(ob_implicit_flush)
zend_long flag = 1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &flag) == FAILURE) {
- return;
+ RETURN_THROWS();
}
php_output_set_implicit_flush(flag);
@@ -1535,7 +1533,7 @@ PHP_FUNCTION(ob_implicit_flush)
PHP_FUNCTION(output_reset_rewrite_vars)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (php_url_scanner_reset_vars() == SUCCESS) {
@@ -1554,7 +1552,7 @@ PHP_FUNCTION(output_add_rewrite_var)
size_t name_len, value_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &name, &name_len, &value, &value_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (php_url_scanner_add_var(name, name_len, value, value_len, 1) == SUCCESS) {
diff --git a/main/php.h b/main/php.h
index dbd7673643..48c78291d7 100644
--- a/main/php.h
+++ b/main/php.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -24,7 +22,7 @@
#include <dmalloc.h>
#endif
-#define PHP_API_VERSION 20190902
+#define PHP_API_VERSION 20190128
#define PHP_HAVE_STREAMS
#define YYDEBUG 0
#define PHP_DEFAULT_CHARSET "UTF-8"
@@ -296,7 +294,6 @@ END_EXTERN_C()
/* global variables */
#if !defined(PHP_WIN32)
-#define PHP_SLEEP_NON_VOID
#define php_sleep sleep
extern char **environ;
#endif /* !defined(PHP_WIN32) */
diff --git a/main/php_compat.h b/main/php_compat.h
index 01d3e326c5..4dcf39dc22 100644
--- a/main/php_compat.h
+++ b/main/php_compat.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/php_content_types.c b/main/php_content_types.c
index b53ee1ab84..d953afcec6 100644
--- a/main/php_content_types.c
+++ b/main/php_content_types.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/php_content_types.h b/main/php_content_types.h
index 145e8d4c5e..b1bae1dd0c 100644
--- a/main/php_content_types.h
+++ b/main/php_content_types.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/php_getopt.h b/main/php_getopt.h
index c368aa7fa9..c68d3969c4 100644
--- a/main/php_getopt.h
+++ b/main/php_getopt.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/php_globals.h b/main/php_globals.h
index 6b31d9eaa6..e5709ddc67 100644
--- a/main/php_globals.h
+++ b/main/php_globals.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -67,7 +65,6 @@ struct _php_core_globals {
zend_long memory_limit;
zend_long max_input_time;
- zend_bool track_errors;
zend_bool display_errors;
zend_bool display_startup_errors;
zend_bool log_errors;
diff --git a/main/php_ini.c b/main/php_ini.c
index cc2cf16cf8..ec847af409 100644
--- a/main/php_ini.c
+++ b/main/php_ini.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/php_ini.h b/main/php_ini.h
index a4fad6c689..9d977c1bac 100644
--- a/main/php_ini.h
+++ b/main/php_ini.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/php_main.h b/main/php_main.h
index 44eeb974d6..ee27209fbe 100644
--- a/main/php_main.h
+++ b/main/php_main.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/php_memory_streams.h b/main/php_memory_streams.h
index 7db25dd1dd..17bc509a19 100644
--- a/main/php_memory_streams.h
+++ b/main/php_memory_streams.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/php_network.h b/main/php_network.h
index 241ca94e27..e96cbd37d3 100644
--- a/main/php_network.h
+++ b/main/php_network.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/php_open_temporary_file.c b/main/php_open_temporary_file.c
index 6fca7e4cab..a65b91e84e 100644
--- a/main/php_open_temporary_file.c
+++ b/main/php_open_temporary_file.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/php_open_temporary_file.h b/main/php_open_temporary_file.h
index 0195056e31..deb8e240e5 100644
--- a/main/php_open_temporary_file.h
+++ b/main/php_open_temporary_file.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/php_output.h b/main/php_output.h
index f76d61d841..60f389b2b5 100644
--- a/main/php_output.h
+++ b/main/php_output.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/php_reentrancy.h b/main/php_reentrancy.h
index bbc772b5db..c7a7c2f92e 100644
--- a/main/php_reentrancy.h
+++ b/main/php_reentrancy.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/php_scandir.c b/main/php_scandir.c
index 7fdb49b77a..91bfabc73c 100644
--- a/main/php_scandir.c
+++ b/main/php_scandir.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/php_scandir.h b/main/php_scandir.h
index 04bf29f2c9..834d0b7f1e 100644
--- a/main/php_scandir.h
+++ b/main/php_scandir.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/php_stdint.h b/main/php_stdint.h
index 3e5fd0016c..f439b9f308 100644
--- a/main/php_stdint.h
+++ b/main/php_stdint.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/php_streams.h b/main/php_streams.h
index 11e7c2aae7..73740a7a79 100644
--- a/main/php_streams.h
+++ b/main/php_streams.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -260,13 +258,13 @@ END_EXTERN_C()
#define php_stream_from_zval(xstr, pzval) do { \
if (((xstr) = (php_stream*)zend_fetch_resource2_ex((pzval), \
"stream", php_file_le_stream(), php_file_le_pstream())) == NULL) { \
- RETURN_FALSE; \
+ return; \
} \
} while (0)
#define php_stream_from_res(xstr, res) do { \
if (((xstr) = (php_stream*)zend_fetch_resource2((res), \
"stream", php_file_le_stream(), php_file_le_pstream())) == NULL) { \
- RETURN_FALSE; \
+ return; \
} \
} while (0)
#define php_stream_from_res_no_verify(xstr, pzval) (xstr) = (php_stream*)zend_fetch_resource2((res), "stream", php_file_le_stream(), php_file_le_pstream())
diff --git a/main/php_syslog.c b/main/php_syslog.c
index 987ef9cc0c..37bf5a7fb6 100644
--- a/main/php_syslog.c
+++ b/main/php_syslog.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/php_syslog.h b/main/php_syslog.h
index 2c499269a4..227baa8b16 100644
--- a/main/php_syslog.h
+++ b/main/php_syslog.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/php_ticks.c b/main/php_ticks.c
index f5b0dd0c58..0fd0dde6fe 100644
--- a/main/php_ticks.c
+++ b/main/php_ticks.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/php_ticks.h b/main/php_ticks.h
index 5b2bb057e6..cc92eae8fc 100644
--- a/main/php_ticks.h
+++ b/main/php_ticks.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/php_variables.c b/main/php_variables.c
index 1a40c2a19f..6fb6ca000d 100644
--- a/main/php_variables.c
+++ b/main/php_variables.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -573,21 +571,15 @@ static zend_always_inline void import_environment_variable(HashTable *ht, char *
void _php_import_environment_variables(zval *array_ptr)
{
-#ifndef PHP_WIN32
- char **env;
-#else
- char *environment, *env;
-#endif
-
tsrm_env_lock();
#ifndef PHP_WIN32
- for (env = environ; env != NULL && *env != NULL; env++) {
+ for (char **env = environ; env != NULL && *env != NULL; env++) {
import_environment_variable(Z_ARRVAL_P(array_ptr), *env);
}
#else
- environment = GetEnvironmentStringsA();
- for (env = environment; env != NULL && *env; env += strlen(env) + 1) {
+ char *environment = GetEnvironmentStringsA();
+ for (char *env = environment; env != NULL && *env; env += strlen(env) + 1) {
import_environment_variable(Z_ARRVAL_P(array_ptr), env);
}
FreeEnvironmentStringsA(environment);
diff --git a/main/php_variables.h b/main/php_variables.h
index 7dc33d328a..dc052def89 100644
--- a/main/php_variables.h
+++ b/main/php_variables.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/php_version.h b/main/php_version.h
index 27e342e367..24765617cb 100644
--- a/main/php_version.h
+++ b/main/php_version.h
@@ -1,8 +1,8 @@
/* automatically generated by configure */
/* edit configure.ac to change version number */
-#define PHP_MAJOR_VERSION 7
-#define PHP_MINOR_VERSION 4
-#define PHP_RELEASE_VERSION 3
+#define PHP_MAJOR_VERSION 8
+#define PHP_MINOR_VERSION 0
+#define PHP_RELEASE_VERSION 0
#define PHP_EXTRA_VERSION "-dev"
-#define PHP_VERSION "7.4.3-dev"
-#define PHP_VERSION_ID 70403
+#define PHP_VERSION "8.0.0-dev"
+#define PHP_VERSION_ID 80000
diff --git a/main/reentrancy.c b/main/reentrancy.c
index 08f03e76dd..fa4e3e57ee 100644
--- a/main/reentrancy.c
+++ b/main/reentrancy.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/rfc1867.c b/main/rfc1867.c
index 1ee7b925a1..ba734c9646 100644
--- a/main/rfc1867.c
+++ b/main/rfc1867.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -1199,7 +1197,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
{
/* store temp_filename as-is (in case upload_tmp_dir
- * contains escapeable characters. escape only the variable name.) */
+ * contains escapable characters. escape only the variable name.) */
zval zfilename;
/* Initialize variables */
diff --git a/main/rfc1867.h b/main/rfc1867.h
index bfb9bb51c6..2fb396b40c 100644
--- a/main/rfc1867.h
+++ b/main/rfc1867.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/snprintf.c b/main/snprintf.c
index 61a5dfffce..4c20367ea3 100644
--- a/main/snprintf.c
+++ b/main/snprintf.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -714,25 +712,6 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) /
fmt++;
modifier = LM_LONG_DOUBLE;
break;
- case 'I':
- fmt++;
-#if SIZEOF_LONG_LONG
- if (*fmt == '6' && *(fmt+1) == '4') {
- fmt += 2;
- modifier = LM_LONG_LONG;
- } else
-#endif
- if (*fmt == '3' && *(fmt+1) == '2') {
- fmt += 2;
- modifier = LM_LONG;
- } else {
-#ifdef _WIN64
- modifier = LM_LONG_LONG;
-#else
- modifier = LM_LONG;
-#endif
- }
- break;
case 'l':
fmt++;
#if SIZEOF_LONG_LONG
@@ -982,7 +961,6 @@ static int format_converter(register buffy * odp, const char *fmt, va_list ap) /
case 's':
- case 'v':
s = va_arg(ap, char *);
if (s != NULL) {
s_len = strlen(s);
diff --git a/main/snprintf.h b/main/snprintf.h
index 93d2034bb6..8a36562127 100644
--- a/main/snprintf.h
+++ b/main/snprintf.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/spprintf.c b/main/spprintf.c
index a20705016a..cae2e12c5e 100644
--- a/main/spprintf.c
+++ b/main/spprintf.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -314,25 +312,6 @@ static void xbuf_format_converter(void *xbuf, zend_bool is_char, const char *fmt
fmt++;
modifier = LM_LONG_DOUBLE;
break;
- case 'I':
- fmt++;
-#if SIZEOF_LONG_LONG
- if (*fmt == '6' && *(fmt+1) == '4') {
- fmt += 2;
- modifier = LM_LONG_LONG;
- } else
-#endif
- if (*fmt == '3' && *(fmt+1) == '2') {
- fmt += 2;
- modifier = LM_LONG;
- } else {
-#ifdef _WIN64
- modifier = LM_LONG_LONG;
-#else
- modifier = LM_LONG;
-#endif
- }
- break;
case 'l':
fmt++;
#if SIZEOF_LONG_LONG
@@ -589,7 +568,6 @@ static void xbuf_format_converter(void *xbuf, zend_bool is_char, const char *fmt
case 's':
- case 'v':
s = va_arg(ap, char *);
if (s != NULL) {
if (!adjust_precision) {
diff --git a/main/spprintf.h b/main/spprintf.h
index bbb7add25c..afb3b505b8 100644
--- a/main/spprintf.h
+++ b/main/spprintf.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/streams/cast.c b/main/streams/cast.c
index 262ec5e38f..76d4aa2263 100644
--- a/main/streams/cast.c
+++ b/main/streams/cast.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -295,7 +293,7 @@ PHPAPI int _php_stream_cast(php_stream *stream, int castas, void **ret, int show
}
if (php_stream_is_filtered(stream)) {
- php_error_docref(NULL, E_WARNING, "cannot cast a filtered stream on this system");
+ php_error_docref(NULL, E_WARNING, "Cannot cast a filtered stream on this system");
return FAILURE;
} else if (stream->ops->cast && stream->ops->cast(stream, castas, ret) == SUCCESS) {
goto exit_success;
@@ -310,7 +308,7 @@ PHPAPI int _php_stream_cast(php_stream *stream, int castas, void **ret, int show
"select()able descriptor"
};
- php_error_docref(NULL, E_WARNING, "cannot represent a stream of type %s as a %s", stream->ops->label, cast_names[castas]);
+ php_error_docref(NULL, E_WARNING, "Cannot represent a stream of type %s as a %s", stream->ops->label, cast_names[castas]);
}
return FAILURE;
diff --git a/main/streams/filter.c b/main/streams/filter.c
index f536b92a02..e14925c1d7 100644
--- a/main/streams/filter.c
+++ b/main/streams/filter.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -255,9 +253,9 @@ PHPAPI php_stream_filter *php_stream_filter_create(const char *filtername, zval
if (filter == NULL) {
/* TODO: these need correct docrefs */
if (factory == NULL)
- php_error_docref(NULL, E_WARNING, "unable to locate filter \"%s\"", filtername);
+ php_error_docref(NULL, E_WARNING, "Unable to locate filter \"%s\"", filtername);
else
- php_error_docref(NULL, E_WARNING, "unable to create or locate filter \"%s\"", filtername);
+ php_error_docref(NULL, E_WARNING, "Unable to create or locate filter \"%s\"", filtername);
}
return filter;
diff --git a/main/streams/glob_wrapper.c b/main/streams/glob_wrapper.c
index 0e72558a2a..212d905e16 100644
--- a/main/streams/glob_wrapper.c
+++ b/main/streams/glob_wrapper.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/streams/memory.c b/main/streams/memory.c
index 4b92fc2ffd..6929ee480d 100644
--- a/main/streams/memory.c
+++ b/main/streams/memory.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/streams/mmap.c b/main/streams/mmap.c
index 63bae87505..c99c63f065 100644
--- a/main/streams/mmap.c
+++ b/main/streams/mmap.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/streams/php_stream_context.h b/main/streams/php_stream_context.h
index c477dda4ac..98daa114a5 100644
--- a/main/streams/php_stream_context.h
+++ b/main/streams/php_stream_context.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/streams/php_stream_filter_api.h b/main/streams/php_stream_filter_api.h
index 4d5760e2cf..9df312152a 100644
--- a/main/streams/php_stream_filter_api.h
+++ b/main/streams/php_stream_filter_api.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/streams/php_stream_glob_wrapper.h b/main/streams/php_stream_glob_wrapper.h
index 644e5ab7e4..f4c8e05b7e 100644
--- a/main/streams/php_stream_glob_wrapper.h
+++ b/main/streams/php_stream_glob_wrapper.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/streams/php_stream_mmap.h b/main/streams/php_stream_mmap.h
index 132f3214c1..aae9097b41 100644
--- a/main/streams/php_stream_mmap.h
+++ b/main/streams/php_stream_mmap.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/streams/php_stream_plain_wrapper.h b/main/streams/php_stream_plain_wrapper.h
index 4af8b86cdd..44910bf320 100644
--- a/main/streams/php_stream_plain_wrapper.h
+++ b/main/streams/php_stream_plain_wrapper.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/streams/php_stream_transport.h b/main/streams/php_stream_transport.h
index f49d9c787d..69d2b9a774 100644
--- a/main/streams/php_stream_transport.h
+++ b/main/streams/php_stream_transport.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/streams/php_stream_userspace.h b/main/streams/php_stream_userspace.h
index 389d591921..4171a0d953 100644
--- a/main/streams/php_stream_userspace.h
+++ b/main/streams/php_stream_userspace.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/streams/php_streams_int.h b/main/streams/php_streams_int.h
index 1bc6fdc89c..ab00549a6e 100644
--- a/main/streams/php_streams_int.h
+++ b/main/streams/php_streams_int.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c
index 8f7774a30e..2e9a17f040 100644
--- a/main/streams/plain_wrapper.c
+++ b/main/streams/plain_wrapper.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -233,7 +231,7 @@ PHPAPI php_stream *_php_stream_fopen_temporary_file(const char *dir, const char
}
close(fd);
- php_error_docref(NULL, E_WARNING, "unable to allocate stream");
+ php_error_docref(NULL, E_WARNING, "Unable to allocate stream");
return NULL;
}
@@ -355,7 +353,7 @@ static ssize_t php_stdiop_write(php_stream *stream, const char *buf, size_t coun
/* TODO: Should this be treated as a proper error or not? */
return bytes_written;
}
- php_error_docref(NULL, E_NOTICE, "write of %zu bytes failed with errno=%d %s", count, errno, strerror(errno));
+ php_error_docref(NULL, E_NOTICE, "Write of %zu bytes failed with errno=%d %s", count, errno, strerror(errno));
}
return bytes_written;
} else {
@@ -423,7 +421,7 @@ static ssize_t php_stdiop_read(php_stream *stream, char *buf, size_t count)
} else if (errno == EINTR) {
/* TODO: Should this be treated as a proper error or not? */
} else {
- php_error_docref(NULL, E_NOTICE, "read of %zu bytes failed with errno=%d %s", count, errno, strerror(errno));
+ php_error_docref(NULL, E_NOTICE, "Read of %zu bytes failed with errno=%d %s", count, errno, strerror(errno));
/* TODO: Remove this special-case? */
if (errno != EBADF) {
@@ -538,7 +536,7 @@ static int php_stdiop_seek(php_stream *stream, zend_off_t offset, int whence, ze
assert(data != NULL);
if (!data->is_seekable) {
- php_error_docref(NULL, E_WARNING, "cannot seek on this stream");
+ php_error_docref(NULL, E_WARNING, "Cannot seek on this stream");
return -1;
}
@@ -1031,7 +1029,7 @@ PHPAPI php_stream *_php_stream_fopen(const char *filename, const char *mode, zen
if (FAILURE == php_stream_parse_fopen_modes(mode, &open_flags)) {
if (options & REPORT_ERRORS) {
- php_error_docref(NULL, E_WARNING, "`%s' is not a valid mode for fopen", mode);
+ zend_value_error("`%s' is not a valid mode for fopen", mode);
}
return NULL;
}
@@ -1295,7 +1293,7 @@ static int php_plain_files_mkdir(php_stream_wrapper *wrapper, const char *dir, i
if (!recursive) {
ret = php_mkdir(dir, mode);
} else {
- /* we look for directory separator from the end of string, thus hopefuly reducing our work load */
+ /* we look for directory separator from the end of string, thus hopefully reducing our work load */
char *e;
zend_stat_t sb;
size_t dir_len = strlen(dir), offset = 0;
@@ -1466,7 +1464,7 @@ static int php_plain_files_metadata(php_stream_wrapper *wrapper, const char *url
ret = VCWD_CHMOD(url, mode);
break;
default:
- php_error_docref1(NULL, url, E_WARNING, "Unknown option %d for stream_metadata", option);
+ zend_value_error("Unknown option %d for stream_metadata", option);
return 0;
}
if (ret == -1) {
diff --git a/main/streams/streams.c b/main/streams/streams.c
index f269f06f3e..8bce4a7db2 100644
--- a/main/streams/streams.c
+++ b/main/streams/streams.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -26,7 +24,7 @@
#include "php_network.h"
#include "php_open_temporary_file.h"
#include "ext/standard/file.h"
-#include "ext/standard/basic_functions.h" /* for BG(mmap_file) (not strictly required) */
+#include "ext/standard/basic_functions.h" /* for BG(CurrentStatFile) */
#include "ext/standard/php_string.h" /* for php_memnstr, used by php_stream_get_record() */
#include <stddef.h>
#include <fcntl.h>
@@ -1114,7 +1112,7 @@ PHPAPI zend_string *php_stream_get_record(php_stream *stream, size_t maxlen, con
/* Writes a buffer directly to a stream, using multiple of the chunk size */
static ssize_t _php_stream_write_buffer(php_stream *stream, const char *buf, size_t count)
{
- ssize_t didwrite = 0, justwrote;
+ ssize_t didwrite = 0;
/* if we have a seekable stream we need to ensure that data is written at the
* current stream->position. This means invalidating the read buffer and then
@@ -1125,13 +1123,8 @@ static ssize_t _php_stream_write_buffer(php_stream *stream, const char *buf, siz
stream->ops->seek(stream, stream->position, SEEK_SET, &stream->position);
}
-
while (count > 0) {
- size_t towrite = count;
- if (towrite > stream->chunk_size)
- towrite = stream->chunk_size;
-
- justwrote = stream->ops->write(stream, buf, towrite);
+ ssize_t justwrote = stream->ops->write(stream, buf, count);
if (justwrote <= 0) {
/* If we already successfully wrote some bytes and a write error occurred
* later, report the successfully written bytes. */
@@ -1367,7 +1360,7 @@ PHPAPI int _php_stream_seek(php_stream *stream, zend_off_t offset, int whence)
return 0;
}
- php_error_docref(NULL, E_WARNING, "stream does not support seeking");
+ php_error_docref(NULL, E_WARNING, "Stream does not support seeking");
return -1;
}
@@ -1856,7 +1849,7 @@ PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, const
if (localhost == 0 && path[n+3] != '\0' && path[n+3] != '/') {
#endif
if (options & REPORT_ERRORS) {
- php_error_docref(NULL, E_WARNING, "remote host file access not supported, %s", path);
+ php_error_docref(NULL, E_WARNING, "Remote host file access not supported, %s", path);
}
return NULL;
}
@@ -2033,7 +2026,7 @@ PHPAPI php_stream *_php_stream_opendir(const char *path, int options,
php_stream_wrapper_log_error(wrapper, options ^ REPORT_ERRORS, "not implemented");
}
if (stream == NULL && (options & REPORT_ERRORS)) {
- php_stream_display_wrapper_errors(wrapper, path, "failed to open dir");
+ php_stream_display_wrapper_errors(wrapper, path, "Failed to open directory");
}
php_stream_tidy_wrapper_error_log(wrapper);
@@ -2182,7 +2175,7 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(const char *path, const char *mod
}
if (stream == NULL && (options & REPORT_ERRORS)) {
- php_stream_display_wrapper_errors(wrapper, path, "failed to open stream");
+ php_stream_display_wrapper_errors(wrapper, path, "Failed to open stream");
if (opened_path && *opened_path) {
zend_string_release_ex(*opened_path, 0);
*opened_path = NULL;
diff --git a/main/streams/transports.c b/main/streams/transports.c
index 74fbef58d8..fcc3f29330 100644
--- a/main/streams/transports.c
+++ b/main/streams/transports.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -359,7 +357,7 @@ PHPAPI int php_stream_xport_crypto_setup(php_stream *stream, php_stream_xport_cr
return param.outputs.returncode;
}
- php_error_docref("streams.crypto", E_WARNING, "this stream does not support SSL/crypto");
+ php_error_docref("streams.crypto", E_WARNING, "This stream does not support SSL/crypto");
return ret;
}
@@ -379,7 +377,7 @@ PHPAPI int php_stream_xport_crypto_enable(php_stream *stream, int activate)
return param.outputs.returncode;
}
- php_error_docref("streams.crypto", E_WARNING, "this stream does not support SSL/crypto");
+ php_error_docref("streams.crypto", E_WARNING, "This stream does not support SSL/crypto");
return ret;
}
@@ -401,7 +399,7 @@ PHPAPI int php_stream_xport_recvfrom(php_stream *stream, char *buf, size_t bufle
}
if (stream->readfilters.head) {
- php_error_docref(NULL, E_WARNING, "cannot peek or fetch OOB data from a filtered stream");
+ php_error_docref(NULL, E_WARNING, "Cannot peek or fetch OOB data from a filtered stream");
return -1;
}
@@ -471,7 +469,7 @@ PHPAPI int php_stream_xport_sendto(php_stream *stream, const char *buf, size_t b
oob = (flags & STREAM_OOB) == STREAM_OOB;
if ((oob || addr) && stream->writefilters.head) {
- php_error_docref(NULL, E_WARNING, "cannot write OOB data, or data to a targeted address on a filtered stream");
+ php_error_docref(NULL, E_WARNING, "Cannot write OOB data, or data to a targeted address on a filtered stream");
return -1;
}
diff --git a/main/streams/userspace.c b/main/streams/userspace.c
index 9cf1580a35..dd6806d35f 100644
--- a/main/streams/userspace.c
+++ b/main/streams/userspace.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -500,7 +498,7 @@ PHP_FUNCTION(stream_wrapper_register)
zend_long flags = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS|l", &protocol, &classname, &flags) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
uwrap = (struct php_user_stream_wrapper *)ecalloc(1, sizeof(*uwrap));
@@ -525,7 +523,7 @@ PHP_FUNCTION(stream_wrapper_register)
}
}
} else {
- php_error_docref(NULL, E_WARNING, "class '%s' is undefined", ZSTR_VAL(classname));
+ php_error_docref(NULL, E_WARNING, "Class '%s' is undefined", ZSTR_VAL(classname));
}
zend_list_delete(rsrc);
@@ -540,7 +538,7 @@ PHP_FUNCTION(stream_wrapper_unregister)
zend_string *protocol;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &protocol) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
if (php_unregister_url_stream_wrapper_volatile(protocol) == FAILURE) {
@@ -562,7 +560,7 @@ PHP_FUNCTION(stream_wrapper_restore)
HashTable *global_wrapper_hash;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &protocol) == FAILURE) {
- RETURN_FALSE;
+ RETURN_THROWS();
}
global_wrapper_hash = php_stream_get_url_stream_wrappers_hash_global();
diff --git a/main/streams/xp_socket.c b/main/streams/xp_socket.c
index 56fc4fcd4f..d37b2c30b3 100644
--- a/main/streams/xp_socket.c
+++ b/main/streams/xp_socket.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -106,7 +104,7 @@ retry:
}
estr = php_socket_strerror(err, NULL, 0);
- php_error_docref(NULL, E_NOTICE, "send of " ZEND_LONG_FMT " bytes failed with errno=%d %s",
+ php_error_docref(NULL, E_NOTICE, "Send of " ZEND_LONG_FMT " bytes failed with errno=%d %s",
(zend_long)count, err, estr);
efree(estr);
}
diff --git a/main/strlcat.c b/main/strlcat.c
index 6ef5644568..3c18360e96 100644
--- a/main/strlcat.c
+++ b/main/strlcat.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/main/strlcpy.c b/main/strlcpy.c
index 31e13489d8..55959b2f3a 100644
--- a/main/strlcpy.c
+++ b/main/strlcpy.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/php.ini-development b/php.ini-development
index 66d2f0eefd..b6e1fac5f4 100644
--- a/php.ini-development
+++ b/php.ini-development
@@ -99,12 +99,12 @@
; Production Value: Off
; display_startup_errors
-; Default Value: Off
+; Default Value: On
; Development Value: On
; Production Value: Off
; error_reporting
-; Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
+; Default Value: E_ALL
; Development Value: E_ALL
; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT
@@ -456,7 +456,7 @@ memory_limit = 128M
; E_ALL & ~E_NOTICE (Show all errors, except for notices)
; E_ALL & ~E_NOTICE & ~E_STRICT (Show all errors, except for notices and coding standards warnings.)
; E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR (Show only errors)
-; Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
+; Default Value: E_ALL
; Development Value: E_ALL
; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT
; http://php.net/error-reporting
@@ -480,11 +480,9 @@ error_reporting = E_ALL
display_errors = On
; The display of errors which occur during PHP's startup sequence are handled
-; separately from display_errors. PHP's default behavior is to suppress those
-; errors from clients. Turning the display of startup errors on can be useful in
-; debugging configuration problems. We strongly recommend you
-; set this to 'off' for production servers.
-; Default Value: Off
+; separately from display_errors. We strongly recommend you set this to 'off'
+; for production servers to avoid leaking configuration details.
+; Default Value: On
; Development Value: On
; Production Value: Off
; http://php.net/display-startup-errors
@@ -525,14 +523,6 @@ report_memleaks = On
; This setting is on by default.
;report_zend_debug = 0
-; Store the last error/warning message in $php_errormsg (boolean).
-; This directive is DEPRECATED.
-; Default Value: Off
-; Development Value: Off
-; Production Value: Off
-; http://php.net/track-errors
-;track_errors = Off
-
; Turn off normal error reporting and emit XML-RPC error XML
; http://php.net/xmlrpc-errors
;xmlrpc_errors = 0
@@ -944,6 +934,8 @@ default_socket_timeout = 60
;extension=xmlrpc
;extension=xsl
+;zend_extension=opcache
+
;;;;;;;;;;;;;;;;;;;
; Module Settings ;
;;;;;;;;;;;;;;;;;;;
@@ -964,10 +956,10 @@ cli_server.color = On
;date.default_longitude = 35.2333
; http://php.net/date.sunrise-zenith
-;date.sunrise_zenith = 90.583333
+;date.sunrise_zenith = 90.833333
; http://php.net/date.sunset-zenith
-;date.sunset_zenith = 90.583333
+;date.sunset_zenith = 90.833333
[filter]
; http://php.net/filter.default
@@ -1044,8 +1036,6 @@ cli_server.color = On
; http://php.net/pdo-odbc.connection-pooling
;pdo_odbc.connection_pooling=strict
-;pdo_odbc.db2_instance_name
-
[Pdo_mysql]
; Default socket name for local MySQL connects. If empty, uses the built-in
; MySQL defaults.
@@ -1580,13 +1570,6 @@ zend.assertions = 1
; http://php.net/assert.callback
;assert.callback = 0
-; Eval the expression with current error_reporting(). Set to true if you want
-; error_reporting(0) around the eval().
-; http://php.net/assert.quiet-eval
-;assert.quiet_eval = 0
-
-
-
[COM]
; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs
; http://php.net/com.typelib-file
@@ -1661,17 +1644,6 @@ zend.assertions = 1
; http://php.net/mbstring.substitute-character
;mbstring.substitute_character = none
-; overload(replace) single byte functions by mbstring functions.
-; mail(), ereg(), etc are overloaded by mb_send_mail(), mb_ereg(),
-; etc. Possible values are 0,1,2,4 or combination of them.
-; For example, 7 for overload everything.
-; 0: No overload
-; 1: Overload mail() function
-; 2: Overload str*() functions
-; 4: Overload ereg*() functions
-; http://php.net/mbstring.func-overload
-;mbstring.func_overload = 0
-
; enable strict encoding detection.
; Default: Off
;mbstring.strict_detection = On
diff --git a/php.ini-production b/php.ini-production
index 7925a4f52e..f66ae6598b 100644
--- a/php.ini-production
+++ b/php.ini-production
@@ -99,12 +99,12 @@
; Production Value: Off
; display_startup_errors
-; Default Value: Off
+; Default Value: On
; Development Value: On
; Production Value: Off
; error_reporting
-; Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
+; Default Value: E_ALL
; Development Value: E_ALL
; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT
@@ -458,7 +458,7 @@ memory_limit = 128M
; E_ALL & ~E_NOTICE (Show all errors, except for notices)
; E_ALL & ~E_NOTICE & ~E_STRICT (Show all errors, except for notices and coding standards warnings.)
; E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR (Show only errors)
-; Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
+; Default Value: E_ALL
; Development Value: E_ALL
; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT
; http://php.net/error-reporting
@@ -482,11 +482,9 @@ error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
display_errors = Off
; The display of errors which occur during PHP's startup sequence are handled
-; separately from display_errors. PHP's default behavior is to suppress those
-; errors from clients. Turning the display of startup errors on can be useful in
-; debugging configuration problems. We strongly recommend you
-; set this to 'off' for production servers.
-; Default Value: Off
+; separately from display_errors. We strongly recommend you set this to 'off'
+; for production servers to avoid leaking configuration details.
+; Default Value: On
; Development Value: On
; Production Value: Off
; http://php.net/display-startup-errors
@@ -527,16 +525,6 @@ report_memleaks = On
; This setting is on by default.
;report_zend_debug = 0
-; Store the last error/warning message in $php_errormsg (boolean). Setting this value
-; to On can assist in debugging and is appropriate for development servers. It should
-; however be disabled on production servers.
-; This directive is DEPRECATED.
-; Default Value: Off
-; Development Value: Off
-; Production Value: Off
-; http://php.net/track-errors
-;track_errors = Off
-
; Turn off normal error reporting and emit XML-RPC error XML
; http://php.net/xmlrpc-errors
;xmlrpc_errors = 0
@@ -948,6 +936,8 @@ default_socket_timeout = 60
;extension=xmlrpc
;extension=xsl
+;zend_extension=opcache
+
;;;;;;;;;;;;;;;;;;;
; Module Settings ;
;;;;;;;;;;;;;;;;;;;
@@ -968,10 +958,10 @@ cli_server.color = On
;date.default_longitude = 35.2333
; http://php.net/date.sunrise-zenith
-;date.sunrise_zenith = 90.583333
+;date.sunrise_zenith = 90.833333
; http://php.net/date.sunset-zenith
-;date.sunset_zenith = 90.583333
+;date.sunset_zenith = 90.833333
[filter]
; http://php.net/filter.default
@@ -1048,8 +1038,6 @@ cli_server.color = On
; http://php.net/pdo-odbc.connection-pooling
;pdo_odbc.connection_pooling=strict
-;pdo_odbc.db2_instance_name
-
[Pdo_mysql]
; Default socket name for local MySQL connects. If empty, uses the built-in
; MySQL defaults.
@@ -1584,11 +1572,6 @@ zend.assertions = -1
; http://php.net/assert.callback
;assert.callback = 0
-; Eval the expression with current error_reporting(). Set to true if you want
-; error_reporting(0) around the eval().
-; http://php.net/assert.quiet-eval
-;assert.quiet_eval = 0
-
[COM]
; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs
; http://php.net/com.typelib-file
@@ -1663,17 +1646,6 @@ zend.assertions = -1
; http://php.net/mbstring.substitute-character
;mbstring.substitute_character = none
-; overload(replace) single byte functions by mbstring functions.
-; mail(), ereg(), etc are overloaded by mb_send_mail(), mb_ereg(),
-; etc. Possible values are 0,1,2,4 or combination of them.
-; For example, 7 for overload everything.
-; 0: No overload
-; 1: Overload mail() function
-; 2: Overload str*() functions
-; 4: Overload ereg*() functions
-; http://php.net/mbstring.func-overload
-;mbstring.func_overload = 0
-
; enable strict encoding detection.
; Default: Off
;mbstring.strict_detection = On
diff --git a/run-tests.php b/run-tests.php
index 1b17354111..1a59ca5f8e 100755
--- a/run-tests.php
+++ b/run-tests.php
@@ -2,8 +2,6 @@
<?php
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -59,6 +57,8 @@ function main()
// Parallel testing
global $workers, $workerID;
+ define('IS_WINDOWS', substr(PHP_OS, 0, 3) == "WIN");
+
$workerID = 0;
if (getenv("TEST_PHP_WORKER")) {
$workerID = intval(getenv("TEST_PHP_WORKER"));
@@ -137,7 +137,7 @@ NO_PROC_OPEN_ERROR;
}
}
//
- if ((substr(PHP_OS, 0, 3) == "WIN") && empty($environment["SystemRoot"])) {
+ if (IS_WINDOWS && empty($environment["SystemRoot"])) {
$environment["SystemRoot"] = getenv("SystemRoot");
}
@@ -177,7 +177,7 @@ NO_PROC_OPEN_ERROR;
}
if (!getenv('TEST_PHPDBG_EXECUTABLE')) {
- if (!strncasecmp(PHP_OS, "win", 3) && file_exists(dirname($php) . "/phpdbg.exe")) {
+ if (IS_WINDOWS && file_exists(dirname($php) . "/phpdbg.exe")) {
$phpdbg = realpath(dirname($php) . "/phpdbg.exe");
} elseif (file_exists(dirname($php) . "/../../sapi/phpdbg/phpdbg")) {
$phpdbg = realpath(dirname($php) . "/../../sapi/phpdbg/phpdbg");
@@ -534,7 +534,7 @@ Synopsis:
php run-tests.php [options] [files] [directories]
Options:
- -j<workers> Run <workers> simultaneous testing processes in parallel for
+ -j<workers> Run up to <workers> simultaneous testing processes in parallel for
quicker testing on systems with multiple logical processors.
Note that this is experimental feature.
@@ -660,7 +660,7 @@ HELP;
}
if (strlen($conf_passed)) {
- if (substr(PHP_OS, 0, 3) == "WIN") {
+ if (IS_WINDOWS) {
$pass_options .= " -c " . escapeshellarg($conf_passed);
} else {
$pass_options .= " -c '" . realpath($conf_passed) . "'";
@@ -977,7 +977,7 @@ function save_or_mail_results()
$failed_tests_data .= "OS:\n" . PHP_OS . " - " . php_uname() . "\n\n";
$ldd = $autoconf = $sys_libtool = $libtool = $compiler = 'N/A';
- if (substr(PHP_OS, 0, 3) != "WIN") {
+ if (!IS_WINDOWS) {
/* If PHP_AUTOCONF is set, use it; otherwise, use 'autoconf'. */
if (getenv('PHP_AUTOCONF')) {
$autoconf = shell_exec(getenv('PHP_AUTOCONF') . ' --version');
@@ -1285,7 +1285,8 @@ function run_all_tests($test_files, $env, $redir_tested = null)
// Parallel testing
global $PHP_FAILED_TESTS, $workers, $workerID, $workerSock;
- if ($workers !== null && !$workerID) {
+ /* Ignore -jN if there is only one file to analyze. */
+ if ($workers !== null && count($test_files) > 1 && !$workerID) {
run_all_tests_parallel($test_files, $env, $redir_tested);
return;
}
@@ -1340,7 +1341,7 @@ function run_all_tests($test_files, $env, $redir_tested = null)
/** The heart of parallel testing. */
function run_all_tests_parallel($test_files, $env, $redir_tested) {
- global $workers, $test_idx, $test_cnt, $test_results, $failed_tests_file, $result_tests_file, $PHP_FAILED_TESTS, $shuffle, $SHOW_ONLY_GROUPS;
+ global $workers, $test_idx, $test_cnt, $test_results, $failed_tests_file, $result_tests_file, $PHP_FAILED_TESTS, $shuffle, $SHOW_ONLY_GROUPS, $valgrind;
// The PHP binary running run-tests.php, and run-tests.php itself
// This PHP executable is *not* necessarily the same as the tested version
@@ -1397,6 +1398,8 @@ function run_all_tests_parallel($test_files, $env, $redir_tested) {
if ($shuffle) {
shuffle($test_files);
}
+ /* Don't start more workers than test files */
+ $workers = max(1, min($workers, count($test_files)));
echo "Spawning workers… ";
@@ -1412,6 +1415,7 @@ function run_all_tests_parallel($test_files, $env, $redir_tested) {
}
$sockPort = substr($sockName, $portPos + 1);
$sockUri = "tcp://$sockHost:$sockPort";
+ $totalFileCount = count($test_files);
for ($i = 1; $i <= $workers; $i++) {
$proc = proc_open(
@@ -1545,8 +1549,14 @@ escape:
$sequentialTests = [];
}
// Batch multiple tests to reduce communication overhead.
+ // - When valgrind is used, communication overhead is relatively small,
+ // so just use a batch size of 1.
+ // - If this is running a small enough number of tests,
+ // reduce the batch size to give batches to more workers.
$files = [];
- $batchSize = $shuffle ? 4 : 32;
+ $maxBatchSize = $valgrind ? 1 : ($shuffle ? 4 : 32);
+ $averageFilesPerWorker = max(1, (int)ceil($totalFileCount / count($workerProcs)));
+ $batchSize = min($maxBatchSize, $averageFilesPerWorker);
while (count($files) <= $batchSize && $file = array_pop($test_files)) {
foreach ($fileConflictsWith[$file] as $conflictKey) {
if (isset($activeConflicts[$conflictKey])) {
@@ -1930,7 +1940,7 @@ TEST $file
if (array_key_exists('CGI', $section_text) || !empty($section_text['GET']) || !empty($section_text['POST']) || !empty($section_text['GZIP_POST']) || !empty($section_text['DEFLATE_POST']) || !empty($section_text['POST_RAW']) || !empty($section_text['PUT']) || !empty($section_text['COOKIE']) || !empty($section_text['EXPECTHEADERS'])) {
if (isset($php_cgi)) {
$php = $php_cgi . ' -C ';
- } else if (!strncasecmp(PHP_OS, "win", 3) && file_exists(dirname($php) . "/php-cgi.exe")) {
+ } else if (IS_WINDOWS && file_exists(dirname($php) . "/php-cgi.exe")) {
$php = realpath(dirname($php) . "/php-cgi.exe") . ' -C ';
} else {
if (file_exists(dirname($php) . "/../../sapi/cgi/php-cgi")) {
@@ -2086,7 +2096,7 @@ TEST $file
$ext_dir = `$php $pass_options $extra_options $ext_params -d display_errors=0 -r "echo ini_get('extension_dir');"`;
$extensions = preg_split("/[\n\r]+/", trim($section_text['EXTENSIONS']));
$loaded = explode(",", `$php $pass_options $extra_options $ext_params -d display_errors=0 -r "echo implode(',', get_loaded_extensions());"`);
- $ext_prefix = substr(PHP_OS, 0, 3) === "WIN" ? "php_" : "";
+ $ext_prefix = IS_WINDOWS ? "php_" : "";
foreach ($extensions as $req_ext) {
if (!in_array($req_ext, $loaded)) {
if ($req_ext == 'opcache') {
@@ -2109,6 +2119,8 @@ TEST $file
if (array_key_exists('INI', $section_text)) {
$section_text['INI'] = str_replace('{PWD}', dirname($file), $section_text['INI']);
$section_text['INI'] = str_replace('{TMP}', sys_get_temp_dir(), $section_text['INI']);
+ $replacement = IS_WINDOWS ? '"' . PHP_BINARY . ' -r \"while ($in = fgets(STDIN)) echo $in;\" > $1"' : 'tee $1 >/dev/null';
+ $section_text['INI'] = preg_replace('/{MAIL:(\S+)}/', $replacement, $section_text['INI']);
settings2array(preg_split("/[\n\r]+/", $section_text['INI']), $ini_settings);
}
@@ -2125,7 +2137,7 @@ TEST $file
if (trim($section_text['SKIPIF'])) {
show_file_block('skip', $section_text['SKIPIF']);
save_text($test_skipif, $section_text['SKIPIF'], $temp_skipif);
- $extra = substr(PHP_OS, 0, 3) !== "WIN" ?
+ $extra = !IS_WINDOWS ?
"unset REQUEST_METHOD; unset QUERY_STRING; unset PATH_TRANSLATED; unset SCRIPT_FILENAME; unset REQUEST_METHOD;" : "";
if ($valgrind) {
@@ -2135,7 +2147,8 @@ TEST $file
junit_start_timer($shortname);
- $output = system_with_timeout("$extra $php $pass_options $extra_options -q $orig_ini_settings $no_file_cache -d display_errors=0 \"$test_skipif\"", $env);
+ $output = system_with_timeout("$extra $php $pass_options $extra_options -q $orig_ini_settings $no_file_cache -d display_errors=1 -d display_startup_errors=0 \"$test_skipif\"", $env);
+ $output = trim($output);
junit_finish_timer($shortname);
@@ -2143,9 +2156,9 @@ TEST $file
@unlink($test_skipif);
}
- if (!strncasecmp('skip', ltrim($output), 4)) {
+ if (!strncasecmp('skip', $output, 4)) {
- if (preg_match('/^\s*skip\s*(.+)\s*/i', $output, $m)) {
+ if (preg_match('/^skip\s*(.+)/i', $output, $m)) {
show_result('SKIP', $tested, $tested_file, "reason: $m[1]", $temp_filenames);
} else {
show_result('SKIP', $tested, $tested_file, '', $temp_filenames);
@@ -2160,22 +2173,26 @@ TEST $file
return 'SKIPPED';
}
- if (!strncasecmp('info', ltrim($output), 4)) {
- if (preg_match('/^\s*info\s*(.+)\s*/i', $output, $m)) {
- $info = " (info: $m[1])";
- }
- }
-
- if (!strncasecmp('warn', ltrim($output), 4)) {
- if (preg_match('/^\s*warn\s*(.+)\s*/i', $output, $m)) {
- $warn = true; /* only if there is a reason */
- $info = " (warn: $m[1])";
- }
- }
-
- if (!strncasecmp('xfail', ltrim($output), 5)) {
+ if (!strncasecmp('info', $output, 4) && preg_match('/^info\s*(.+)/i', $output, $m)) {
+ $info = " (info: $m[1])";
+ } elseif (!strncasecmp('warn', $output, 4) && preg_match('/^warn\s+(.+)/i', $output, $m)) {
+ $warn = true; /* only if there is a reason */
+ $info = " (warn: $m[1])";
+ } elseif (!strncasecmp('xfail', $output, 5)) {
// Pretend we have an XFAIL section
- $section_text['XFAIL'] = trim(substr(ltrim($output), 5));
+ $section_text['XFAIL'] = ltrim(substr($output, 5));
+ } elseif ($output !== '') {
+ show_result("BORK", $output, $tested_file, 'reason: invalid output from SKIPIF', $temp_filenames);
+ $PHP_FAILED_TESTS['BORKED'][] = array(
+ 'name' => $file,
+ 'test_name' => '',
+ 'output' => '',
+ 'diff' => '',
+ 'info' => "$output [$file]",
+ );
+
+ junit_mark_test_as('BORK', $shortname, $tested, null, $output);
+ return 'BORKED';
}
}
}
@@ -2232,7 +2249,7 @@ TEST $file
} else {
$bork_info = "Redirect info must contain exactly one TEST string to be used as redirect directory.";
- show_result("BORK", $bork_info, '', $temp_filenames);
+ show_result("BORK", $bork_info, '', '', $temp_filenames);
$PHP_FAILED_TESTS['BORKED'][] = array(
'name' => $file,
'test_name' => '',
@@ -2250,7 +2267,7 @@ TEST $file
}
$bork_info = "Redirected test did not contain redirection info";
- show_result("BORK", $bork_info, '', $temp_filenames);
+ show_result("BORK", $bork_info, '', '', $temp_filenames);
$PHP_FAILED_TESTS['BORKED'][] = array(
'name' => $file,
'test_name' => '',
@@ -2475,7 +2492,7 @@ COMMAND $cmd
$clean_params = array();
settings2array($ini_overwrites, $clean_params);
$clean_params = settings2params($clean_params);
- $extra = substr(PHP_OS, 0, 3) !== "WIN" ?
+ $extra = !IS_WINDOWS ?
"unset REQUEST_METHOD; unset QUERY_STRING; unset PATH_TRANSLATED; unset SCRIPT_FILENAME; unset REQUEST_METHOD;" : "";
system_with_timeout("$extra $php $pass_options $extra_options -q $clean_params $no_file_cache \"$test_clean\"", $env);
}
@@ -2946,7 +2963,7 @@ function settings2params($ini_settings)
$settings .= " -d \"$name=$val\"";
}
} else {
- if (substr(PHP_OS, 0, 3) == "WIN" && !empty($value) && $value[0] == '"') {
+ if (IS_WINDOWS && !empty($value) && $value[0] == '"') {
$len = strlen($value);
if ($value[$len - 1] == '"') {
diff --git a/sapi/apache2handler/apache_config.c b/sapi/apache2handler/apache_config.c
index d0913c250e..b7e0077d2d 100644
--- a/sapi/apache2handler/apache_config.c
+++ b/sapi/apache2handler/apache_config.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/apache2handler/config.m4 b/sapi/apache2handler/config.m4
index 55c16179b8..67c6d9beea 100644
--- a/sapi/apache2handler/config.m4
+++ b/sapi/apache2handler/config.m4
@@ -67,20 +67,20 @@ if test "$PHP_APXS2" != "no"; then
if test -z `$APXS -q SYSCONFDIR`; then
INSTALL_IT="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \
$APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \
- -i -n php7"
+ -i -n php"
else
APXS_SYSCONFDIR='$(INSTALL_ROOT)'`$APXS -q SYSCONFDIR`
INSTALL_IT="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \
\$(mkinstalldirs) '$APXS_SYSCONFDIR' && \
$APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \
-S SYSCONFDIR='$APXS_SYSCONFDIR' \
- -i -a -n php7"
+ -i -a -n php"
fi
case $host_alias in
*aix*)
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-brtl -Wl,-bI:$APXS_LIBEXECDIR/httpd.exp"
- PHP_SELECT_SAPI(apache2handler, shared, mod_php7.c sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS)
+ PHP_SELECT_SAPI(apache2handler, shared, mod_php.c sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS)
INSTALL_IT="$INSTALL_IT $SAPI_LIBTOOL"
;;
*darwin*)
@@ -95,12 +95,12 @@ if test "$PHP_APXS2" != "no"; then
fi
MH_BUNDLE_FLAGS="-bundle -bundle_loader $APXS_HTTPD $MH_BUNDLE_FLAGS"
PHP_SUBST(MH_BUNDLE_FLAGS)
- PHP_SELECT_SAPI(apache2handler, bundle, mod_php7.c sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS)
- SAPI_SHARED=libs/libphp7.so
+ PHP_SELECT_SAPI(apache2handler, bundle, mod_php.c sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS)
+ SAPI_SHARED=libs/libphp.so
INSTALL_IT="$INSTALL_IT $SAPI_SHARED"
;;
*)
- PHP_SELECT_SAPI(apache2handler, shared, mod_php7.c sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS)
+ PHP_SELECT_SAPI(apache2handler, shared, mod_php.c sapi_apache2.c apache_config.c php_functions.c, $APACHE_CFLAGS)
INSTALL_IT="$INSTALL_IT $SAPI_LIBTOOL"
;;
esac
diff --git a/sapi/apache2handler/config.w32 b/sapi/apache2handler/config.w32
index 45d6353d28..12dd50332a 100644
--- a/sapi/apache2handler/config.w32
+++ b/sapi/apache2handler/config.w32
@@ -10,7 +10,7 @@ if (PHP_APACHE2HANDLER != "no") {
CHECK_LIB("libapr.lib", "apache2handler", PHP_PHP_BUILD + "\\lib\\apache2") &&
CHECK_LIB("libaprutil.lib", "apache2handler", PHP_PHP_BUILD + "\\lib\\apache2")
) {
- SAPI('apache2handler', 'mod_php7.c sapi_apache2.c apache_config.c php_functions.c',
+ SAPI('apache2handler', 'mod_php.c sapi_apache2.c apache_config.c php_functions.c',
'php' + PHP_VERSION + 'apache2.dll',
'/D PHP_APACHE2_EXPORTS /I win32 /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1');
} else {
@@ -28,7 +28,7 @@ if (PHP_APACHE2_2HANDLER != "no") {
CHECK_LIB("libapr-1.lib", "apache2_2handler", PHP_PHP_BUILD + "\\lib\\apache2_2") &&
CHECK_LIB("libaprutil-1.lib", "apache2_2handler", PHP_PHP_BUILD + "\\lib\\apache2_2")
) {
- SAPI('apache2_2handler', 'mod_php7.c sapi_apache2.c apache_config.c php_functions.c',
+ SAPI('apache2_2handler', 'mod_php.c sapi_apache2.c apache_config.c php_functions.c',
'php' + PHP_VERSION + 'apache2_2.dll',
'/D PHP_APACHE2_EXPORTS /I win32 /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1',
'sapi\\apache2_2handler');
@@ -46,7 +46,7 @@ if (PHP_APACHE2_4HANDLER != "no") {
CHECK_LIB("libapr-1.lib", "apache2_4handler", PHP_PHP_BUILD + "\\lib\\apache2_4") &&
CHECK_LIB("libaprutil-1.lib", "apache2_4handler", PHP_PHP_BUILD + "\\lib\\apache2_4")
) {
- SAPI('apache2_4handler', 'mod_php7.c sapi_apache2.c apache_config.c php_functions.c',
+ SAPI('apache2_4handler', 'mod_php.c sapi_apache2.c apache_config.c php_functions.c',
'php' + PHP_VERSION + 'apache2_4.dll',
'/D PHP_APACHE2_EXPORTS /I win32 /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1',
'sapi\\apache2handler');
diff --git a/sapi/apache2handler/mod_php.c b/sapi/apache2handler/mod_php.c
new file mode 100644
index 0000000000..835c5f5c90
--- /dev/null
+++ b/sapi/apache2handler/mod_php.c
@@ -0,0 +1,32 @@
+/*
+ +----------------------------------------------------------------------+
+ | Copyright (c) The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Sascha Schumann <sascha@schumann.cx> |
+ | Parts based on Apache 1.3 SAPI module by |
+ | Rasmus Lerdorf and Zeev Suraski |
+ +----------------------------------------------------------------------+
+ */
+
+#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
+
+#include "php.h"
+#include "php_apache.h"
+
+AP_MODULE_DECLARE_DATA module php_module = {
+ STANDARD20_MODULE_STUFF,
+ create_php_config, /* create per-directory config structure */
+ merge_php_config, /* merge per-directory config structures */
+ NULL, /* create per-server config structure */
+ NULL, /* merge per-server config structures */
+ php_dir_cmds, /* command apr_table_t */
+ php_ap2_register_hook /* register hooks */
+};
diff --git a/sapi/apache2handler/mod_php7.c b/sapi/apache2handler/mod_php7.c
deleted file mode 100644
index 6c44dbaa2c..0000000000
--- a/sapi/apache2handler/mod_php7.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
- | Copyright (c) The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Sascha Schumann <sascha@schumann.cx> |
- | Parts based on Apache 1.3 SAPI module by |
- | Rasmus Lerdorf and Zeev Suraski |
- +----------------------------------------------------------------------+
- */
-
-#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
-
-#include "php.h"
-#include "php_apache.h"
-
-AP_MODULE_DECLARE_DATA module php7_module = {
- STANDARD20_MODULE_STUFF,
- create_php_config, /* create per-directory config structure */
- merge_php_config, /* merge per-directory config structures */
- NULL, /* create per-server config structure */
- NULL, /* merge per-server config structures */
- php_dir_cmds, /* command apr_table_t */
- php_ap2_register_hook /* register hooks */
-};
diff --git a/sapi/apache2handler/php.sym b/sapi/apache2handler/php.sym
index 1469b0314d..571f27e01c 100644
--- a/sapi/apache2handler/php.sym
+++ b/sapi/apache2handler/php.sym
@@ -1 +1 @@
-php7_module
+php_module
diff --git a/sapi/apache2handler/php_apache.h b/sapi/apache2handler/php_apache.h
index 423ada1f9b..d6c67c8a8d 100644
--- a/sapi/apache2handler/php_apache.h
+++ b/sapi/apache2handler/php_apache.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -29,11 +27,11 @@
/* Enable per-module logging in Apache 2.4+ */
#ifdef APLOG_USE_MODULE
-APLOG_USE_MODULE(php7);
+APLOG_USE_MODULE(php);
#endif
/* Declare this so we can get to it from outside the sapi_apache2.c file */
-extern module AP_MODULE_DECLARE_DATA php7_module;
+extern module AP_MODULE_DECLARE_DATA php_module;
/* A way to specify the location of the php.ini dir in an apache directive */
extern char *apache2_php_ini_path_override;
diff --git a/sapi/apache2handler/php_functions.c b/sapi/apache2handler/php_functions.c
index c82b93f965..d1aa2d587c 100644
--- a/sapi/apache2handler/php_functions.c
+++ b/sapi/apache2handler/php_functions.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -45,6 +43,7 @@
#endif
#include "php_apache.h"
+#include "php_functions_arginfo.h"
#ifdef ZTS
int php_apache2_info_id;
@@ -74,7 +73,7 @@ PHP_FUNCTION(virtual)
request_rec *rr;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &filename, &filename_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!(rr = php_apache_lookup_uri(filename))) {
@@ -120,7 +119,7 @@ PHP_FUNCTION(apache_lookup_uri)
size_t filename_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &filename, &filename_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!(rr = php_apache_lookup_uri(filename))) {
@@ -175,7 +174,7 @@ PHP_FUNCTION(apache_request_headers)
char *key, *val;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
array_init(return_value);
@@ -199,7 +198,7 @@ PHP_FUNCTION(apache_response_headers)
char *key, *val;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
array_init(return_value);
@@ -224,7 +223,7 @@ PHP_FUNCTION(apache_note)
char *old_note_val=NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", &note_name, &note_name_len, &note_val, &note_val_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
ctx = SG(server_context);
@@ -258,7 +257,7 @@ PHP_FUNCTION(apache_setenv)
request_rec *r;
if (zend_parse_parameters(arg_count, "ss|b", &variable, &variable_len, &string_val, &string_val_len, &walk_to_top) == FAILURE) {
- return;
+ RETURN_THROWS();
}
ctx = SG(server_context);
@@ -294,7 +293,7 @@ PHP_FUNCTION(apache_getenv)
request_rec *r;
if (zend_parse_parameters(arg_count, "s|b", &variable, &variable_len, &walk_to_top) == FAILURE) {
- return;
+ RETURN_THROWS();
}
ctx = SG(server_context);
@@ -477,55 +476,17 @@ PHP_MINFO_FUNCTION(apache)
}
}
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_apache2handler_lookup_uri, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_apache2handler_virtual, 0, 0, 1)
- ZEND_ARG_INFO(0, uri)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_apache2handler_response_headers, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_apache2handler_getallheaders, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_apache2handler_note, 0, 0, 1)
- ZEND_ARG_INFO(0, note_name)
- ZEND_ARG_INFO(0, note_value)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_apache2handler_setenv, 0, 0, 2)
- ZEND_ARG_INFO(0, variable)
- ZEND_ARG_INFO(0, value)
- ZEND_ARG_INFO(0, walk_to_top)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_apache2handler_getenv, 0, 0, 1)
- ZEND_ARG_INFO(0, variable)
- ZEND_ARG_INFO(0, walk_to_top)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_apache2handler_get_version, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_apache2handler_get_modules, 0)
-ZEND_END_ARG_INFO()
-/* }}} */
-
static const zend_function_entry apache_functions[] = {
- PHP_FE(apache_lookup_uri, arginfo_apache2handler_lookup_uri)
- PHP_FE(virtual, arginfo_apache2handler_virtual)
- PHP_FE(apache_request_headers, arginfo_apache2handler_getallheaders)
- PHP_FE(apache_response_headers, arginfo_apache2handler_response_headers)
- PHP_FE(apache_setenv, arginfo_apache2handler_setenv)
- PHP_FE(apache_getenv, arginfo_apache2handler_getenv)
- PHP_FE(apache_note, arginfo_apache2handler_note)
- PHP_FE(apache_get_version, arginfo_apache2handler_get_version)
- PHP_FE(apache_get_modules, arginfo_apache2handler_get_modules)
- PHP_FALIAS(getallheaders, apache_request_headers, arginfo_apache2handler_getallheaders)
+ PHP_FE(apache_lookup_uri, arginfo_apache_lookup_uri)
+ PHP_FE(virtual, arginfo_virtual)
+ PHP_FE(apache_request_headers, arginfo_apache_request_headers)
+ PHP_FE(apache_response_headers, arginfo_apache_response_headers)
+ PHP_FE(apache_setenv, arginfo_apache_setenv)
+ PHP_FE(apache_getenv, arginfo_apache_getenv)
+ PHP_FE(apache_note, arginfo_apache_note)
+ PHP_FE(apache_get_version, arginfo_apache_get_version)
+ PHP_FE(apache_get_modules, arginfo_apache_get_modules)
+ PHP_FALIAS(getallheaders, apache_request_headers, arginfo_getallheaders)
{NULL, NULL, NULL}
};
diff --git a/sapi/apache2handler/php_functions.stub.php b/sapi/apache2handler/php_functions.stub.php
new file mode 100644
index 0000000000..5b2835ac3a
--- /dev/null
+++ b/sapi/apache2handler/php_functions.stub.php
@@ -0,0 +1,21 @@
+<?php
+
+function apache_lookup_uri(string $filename): object|false {}
+
+function virtual(string $uri): bool {}
+
+function apache_request_headers(): array {}
+
+function getallheaders(): array {}
+
+function apache_response_headers(): array {}
+
+function apache_note(string $note_name, string $note_value = UNKNOWN): string|false {}
+
+function apache_setenv(string $variable, string $value, bool $walk_to_top = false): bool {}
+
+function apache_getenv(string $variable, bool $walk_to_top = false): string|false {}
+
+function apache_get_version(): string|false {}
+
+function apache_get_modules(): array {}
diff --git a/sapi/apache2handler/php_functions_arginfo.h b/sapi/apache2handler/php_functions_arginfo.h
new file mode 100644
index 0000000000..f5ac0e4c28
--- /dev/null
+++ b/sapi/apache2handler/php_functions_arginfo.h
@@ -0,0 +1,37 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_apache_lookup_uri, 0, 1, MAY_BE_OBJECT|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_virtual, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, uri, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_apache_request_headers, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_getallheaders arginfo_apache_request_headers
+
+#define arginfo_apache_response_headers arginfo_apache_request_headers
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_apache_note, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, note_name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, note_value, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_apache_setenv, 0, 2, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, variable, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, walk_to_top, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_apache_getenv, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
+ ZEND_ARG_TYPE_INFO(0, variable, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, walk_to_top, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_apache_get_version, 0, 0, MAY_BE_STRING|MAY_BE_FALSE)
+ZEND_END_ARG_INFO()
+
+#define arginfo_apache_get_modules arginfo_apache_request_headers
diff --git a/sapi/apache2handler/sapi_apache2.c b/sapi/apache2handler/sapi_apache2.c
index 1cc5670eaa..b2f32ce49a 100644
--- a/sapi/apache2handler/sapi_apache2.c
+++ b/sapi/apache2handler/sapi_apache2.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -55,7 +53,7 @@
#define PHP_MAGIC_TYPE "application/x-httpd-php"
#define PHP_SOURCE_MAGIC_TYPE "application/x-httpd-php-source"
-#define PHP_SCRIPT "php7-script"
+#define PHP_SCRIPT "php-script"
/* A way to specify the location of the php.ini dir in an apache directive */
char *apache2_php_ini_path_override = NULL;
@@ -551,7 +549,7 @@ typedef struct {
HashTable config;
} php_conf_rec;
zend_string *str;
- php_conf_rec *c = ap_get_module_config(r->per_dir_config, &php7_module);
+ php_conf_rec *c = ap_get_module_config(r->per_dir_config, &php_module);
ZEND_HASH_FOREACH_STR_KEY(&c->config, str) {
zend_restore_ini_entry(str, ZEND_INI_STAGE_SHUTDOWN);
@@ -582,7 +580,7 @@ static int php_handler(request_rec *r)
#define PHPAP_INI_OFF php_apache_ini_dtor(r, parent_req);
- conf = ap_get_module_config(r->per_dir_config, &php7_module);
+ conf = ap_get_module_config(r->per_dir_config, &php_module);
/* apply_config() needs r in some cases, so allocate server_context early */
ctx = SG(server_context);
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
index 29c61e9a18..2cff48fc61 100644
--- a/sapi/cgi/cgi_main.c
+++ b/sapi/cgi/cgi_main.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -915,9 +913,12 @@ static int sapi_cgi_activate(void)
if (fcgi_is_fastcgi()) {
fcgi_request *request = (fcgi_request*) SG(server_context);
- doc_root = FCGI_GETENV(request, "DOCUMENT_ROOT");
+ /* Prefer CONTEXT_DOCUMENT_ROOT if set */
+ doc_root = FCGI_GETENV(request, "CONTEXT_DOCUMENT_ROOT");
+ doc_root = doc_root ? doc_root : FCGI_GETENV(request, "DOCUMENT_ROOT");
} else {
- doc_root = getenv("DOCUMENT_ROOT");
+ doc_root = getenv("CONTEXT_DOCUMENT_ROOT");
+ doc_root = doc_root ? doc_root : getenv("DOCUMENT_ROOT");
}
/* DOCUMENT_ROOT should also be defined at this stage..but better check it anyway */
if (doc_root) {
@@ -1103,7 +1104,7 @@ static int is_valid_path(const char *path)
initializes request_info structure
- specificly in this section we handle proper translations
+ specifically in this section we handle proper translations
for:
PATH_INFO
@@ -1577,7 +1578,7 @@ static PHP_MINFO_FUNCTION(cgi)
PHP_FUNCTION(apache_child_terminate) /* {{{ */
{
if (zend_parse_parameters_none()) {
- return;
+ RETURN_THROWS();
}
if (fcgi_is_fastcgi()) {
fcgi_terminate();
@@ -1589,7 +1590,7 @@ PHP_FUNCTION(apache_child_terminate) /* {{{ */
PHP_FUNCTION(apache_request_headers) /* {{{ */
{
if (zend_parse_parameters_none()) {
- return;
+ RETURN_THROWS();
}
array_init(return_value);
if (fcgi_is_fastcgi()) {
@@ -1702,7 +1703,7 @@ static void add_response_header(sapi_header_struct *h, zval *return_value) /* {{
PHP_FUNCTION(apache_response_headers) /* {{{ */
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
array_init(return_value);
diff --git a/sapi/cgi/config9.m4 b/sapi/cgi/config9.m4
index ae927cd5f8..04bd70b269 100644
--- a/sapi/cgi/config9.m4
+++ b/sapi/cgi/config9.m4
@@ -55,7 +55,7 @@ if test "$PHP_CGI" != "no"; then
BUILD_CGI="\$(CC) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(NATIVE_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_BINARY_OBJS:.lo=.o) \$(PHP_FASTCGI_OBJS:.lo=.o) \$(PHP_CGI_OBJS:.lo=.o) \$(PHP_FRAMEWORKS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)"
;;
*)
- BUILD_CGI="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) \$(PHP_BINARY_OBJS) \$(PHP_FASTCGI_OBJS) \$(PHP_CGI_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)"
+ BUILD_CGI="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_BINARY_OBJS:.lo=.o) \$(PHP_FASTCGI_OBJS:.lo=.o) \$(PHP_CGI_OBJS:.lo=.o) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)"
;;
esac
diff --git a/sapi/cgi/tests/003.phpt b/sapi/cgi/tests/003.phpt
index 4b4d29267d..00c59c7278 100644
--- a/sapi/cgi/tests/003.phpt
+++ b/sapi/cgi/tests/003.phpt
@@ -23,12 +23,12 @@ $code ='
/* some test script */
class test { /* {{{ */
- public $var = "test"; //test var
-#perl style comment
- private $pri; /* private attr */
+ public $var = "test"; //test var
+#perl style comment
+ private $pri; /* private attr */
- function foo(/* void */) {
- }
+ function foo(/* void */) {
+ }
}
/* }}} */
diff --git a/sapi/cgi/tests/004.phpt b/sapi/cgi/tests/004.phpt
index b46dce7052..1de856e346 100644
--- a/sapi/cgi/tests/004.phpt
+++ b/sapi/cgi/tests/004.phpt
@@ -17,7 +17,7 @@ $code ='
<?php
class test {
- private $pri;
+ private $pri;
}
var_dump(test::$pri);
@@ -27,9 +27,9 @@ var_dump(test::$pri);
file_put_contents($filename, $code);
if (defined("PHP_WINDOWS_VERSION_MAJOR")) {
- var_dump(`$php -n -f "$filename"`);
+ var_dump(`$php -n -f "$filename"`);
} else {
- var_dump(`$php -n -f "$filename" 2>/dev/null`);
+ var_dump(`$php -n -f "$filename" 2>/dev/null`);
}
var_dump(`$php -n -f "wrong"`);
diff --git a/sapi/cgi/tests/006.phpt b/sapi/cgi/tests/006.phpt
index c78229880c..479d4a9441 100644
--- a/sapi/cgi/tests/006.phpt
+++ b/sapi/cgi/tests/006.phpt
@@ -19,7 +19,7 @@ $code = '
$test = "var";
class test {
- private $var;
+ private $var;
}
echo test::$var;
@@ -35,8 +35,8 @@ var_dump(`"$php" -n -l some.unknown`);
$code = '
<?php
-class test
- private $var;
+class test
+ private $var;
}
?>
@@ -45,9 +45,9 @@ class test
file_put_contents($filename, $code);
if (defined("PHP_WINDOWS_VERSION_MAJOR")) {
- var_dump(`"$php" -n -l "$filename"`);
+ var_dump(`"$php" -n -l "$filename"`);
} else {
- var_dump(`"$php" -n -l "$filename" 2>/dev/null`);
+ var_dump(`"$php" -n -l "$filename" 2>/dev/null`);
}
@unlink($filename);
diff --git a/sapi/cgi/tests/007.phpt b/sapi/cgi/tests/007.phpt
index 950f451083..96062486e0 100644
--- a/sapi/cgi/tests/007.phpt
+++ b/sapi/cgi/tests/007.phpt
@@ -13,10 +13,8 @@ var_dump(`"$php" -n -f some.php -f some.php`);
var_dump(`"$php" -n -s -w -l`);
?>
-===DONE===
--EXPECT--
string(25) "No input file specified.
"
string(49) "No syntax errors detected in Standard input code
"
-===DONE===
diff --git a/sapi/cgi/tests/008.phpt b/sapi/cgi/tests/008.phpt
index be2fd578e7..05d9d8c190 100644
--- a/sapi/cgi/tests/008.phpt
+++ b/sapi/cgi/tests/008.phpt
@@ -16,12 +16,12 @@ $code = '
$test = "var"; //var
/* test class */
class test {
- private $var = array();
+ private $var = array();
- public static function foo(Test $arg) {
- echo "hello";
- var_dump($this);
- }
+ public static function foo(Test $arg) {
+ echo "hello";
+ var_dump($this);
+ }
}
$o = new test;
diff --git a/sapi/cgi/tests/011.phpt b/sapi/cgi/tests/011.phpt
index 6d4a6ed7f9..263c2e61ef 100644
--- a/sapi/cgi/tests/011.phpt
+++ b/sapi/cgi/tests/011.phpt
@@ -13,13 +13,13 @@ reset_env_vars();
$f = tempnam(sys_get_temp_dir(), 'cgitest');
function test($script) {
- file_put_contents($GLOBALS['f'], $script);
- $cmd = escapeshellcmd($GLOBALS['php']);
- $cmd .= ' -n -dreport_zend_debug=0 -dhtml_errors=0 ' . escapeshellarg($GLOBALS['f']);
- echo "----------\n";
- echo rtrim($script) . "\n";
- echo "----------\n";
- passthru($cmd);
+ file_put_contents($GLOBALS['f'], $script);
+ $cmd = escapeshellcmd($GLOBALS['php']);
+ $cmd .= ' -n -dreport_zend_debug=0 -dhtml_errors=0 ' . escapeshellarg($GLOBALS['f']);
+ echo "----------\n";
+ echo rtrim($script) . "\n";
+ echo "----------\n";
+ passthru($cmd);
}
test('<?php ?>');
diff --git a/sapi/cgi/tests/apache_request_headers.phpt b/sapi/cgi/tests/apache_request_headers.phpt
index bda9ef8b70..647508a64a 100644
--- a/sapi/cgi/tests/apache_request_headers.phpt
+++ b/sapi/cgi/tests/apache_request_headers.phpt
@@ -21,9 +21,9 @@ passthru("$php -n $file");
$names = array('HTTP_X_TEST', 'HTTP_X__TEST', 'HTTP_X_');
foreach ($names as $name) {
- putenv($name."=".str_repeat("A", 256));
- passthru("$php -n -q $file");
- putenv($name);
+ putenv($name."=".str_repeat("A", 256));
+ passthru("$php -n -q $file");
+ putenv($name);
}
unlink($file);
diff --git a/sapi/cgi/tests/apache_response_headers.phpt b/sapi/cgi/tests/apache_response_headers.phpt
index 99b1352680..bb8b3032ad 100644
--- a/sapi/cgi/tests/apache_response_headers.phpt
+++ b/sapi/cgi/tests/apache_response_headers.phpt
@@ -31,7 +31,6 @@ file_put_contents( $test_file, $code );
passthru( "$php -n -q " . escapeshellarg( $test_file ) );
?>
-===DONE===
--CLEAN--
<?php
@unlink( __DIR__ . DIRECTORY_SEPARATOR ."apache_response_headers.test.php" );
@@ -45,4 +44,3 @@ array(3) {
["Content-type"]=>
string(24) "text/html; charset=UTF-8"
}
-===DONE===
diff --git a/sapi/cgi/tests/bug75574_utf8.phpt b/sapi/cgi/tests/bug75574_utf8.phpt
index d7f0e3e5ee..9cbd51abfb 100644
--- a/sapi/cgi/tests/bug75574_utf8.phpt
+++ b/sapi/cgi/tests/bug75574_utf8.phpt
@@ -24,8 +24,6 @@ echo shell_exec("$php -n -f $fn");
unlink($fn);
?>
-===DONE===
--EXPECT--
bool(true)
string(3) "å•Š"
-===DONE===
diff --git a/sapi/cgi/tests/include.inc b/sapi/cgi/tests/include.inc
index 61b339e49f..cd9236f116 100644
--- a/sapi/cgi/tests/include.inc
+++ b/sapi/cgi/tests/include.inc
@@ -2,64 +2,64 @@
function get_cgi_path() /* {{{ */
{
- $php = getenv("TEST_PHP_EXECUTABLE");
+ $php = getenv("TEST_PHP_EXECUTABLE");
- $cli = false;
- $cgi = false;
+ $cli = false;
+ $cgi = false;
- if (file_exists($php) && is_executable($php)) {
- $version = `$php -n -v`;
- if (strstr($version, "(cli)")) {
- /* that's cli */
- $cli = true;
- } else if (strpos($version, "(cgi")) {
- /* that's cgi */
- return $php;
- }
- }
+ if (file_exists($php) && is_executable($php)) {
+ $version = `$php -n -v`;
+ if (strstr($version, "(cli)")) {
+ /* that's cli */
+ $cli = true;
+ } else if (strpos($version, "(cgi")) {
+ /* that's cgi */
+ return $php;
+ }
+ }
- if ($cli) {
- /* trying to guess ... */
- $php_path = $php;
- if (defined("PHP_WINDOWS_VERSION_MAJOR")) {
- /* On Windows it should be in the same dir as php.exe in most of the cases. */
- $php_path = dirname($php);
+ if ($cli) {
+ /* trying to guess ... */
+ $php_path = $php;
+ if (defined("PHP_WINDOWS_VERSION_MAJOR")) {
+ /* On Windows it should be in the same dir as php.exe in most of the cases. */
+ $php_path = dirname($php);
- if (is_dir($php_path) && file_exists("$php_path/php-cgi.exe") && is_executable("$php_path/php-cgi.exe")) {
- return "$php_path/php-cgi.exe";
- }
- } else {
- for ($i = 0; $i < 2; $i++) {
- $slash_pos = strrpos($php_path, "/");
- if ($slash_pos) {
- $php_path = substr($php_path, 0, $slash_pos);
- } else {
- return FALSE;
- }
- }
+ if (is_dir($php_path) && file_exists("$php_path/php-cgi.exe") && is_executable("$php_path/php-cgi.exe")) {
+ return "$php_path/php-cgi.exe";
+ }
+ } else {
+ for ($i = 0; $i < 2; $i++) {
+ $slash_pos = strrpos($php_path, "/");
+ if ($slash_pos) {
+ $php_path = substr($php_path, 0, $slash_pos);
+ } else {
+ return FALSE;
+ }
+ }
- if ($php_path && is_dir($php_path) && file_exists($php_path."/cgi/php-cgi") && is_executable($php_path."/cgi/php-cgi")) {
- /* gotcha */
- return $php_path."/cgi/php-cgi";
- }
- }
- return false;
- }
- /* uhm? what's that then? */
- return false;
+ if ($php_path && is_dir($php_path) && file_exists($php_path."/cgi/php-cgi") && is_executable($php_path."/cgi/php-cgi")) {
+ /* gotcha */
+ return $php_path."/cgi/php-cgi";
+ }
+ }
+ return false;
+ }
+ /* uhm? what's that then? */
+ return false;
}
/* }}} */
function reset_env_vars() /* {{{ */
{
- putenv("REDIRECT_STATUS");
- putenv("QUERY_STRING");
- putenv("PATH_TRANSLATED");
- putenv("SCRIPT_FILENAME");
- putenv("SERVER_SOFTWARE");
- putenv("SERVER_NAME");
- putenv("GATEWAY_INTERFACE");
- putenv("REQUEST_METHOD");
+ putenv("REDIRECT_STATUS");
+ putenv("QUERY_STRING");
+ putenv("PATH_TRANSLATED");
+ putenv("SCRIPT_FILENAME");
+ putenv("SERVER_SOFTWARE");
+ putenv("SERVER_NAME");
+ putenv("GATEWAY_INTERFACE");
+ putenv("REQUEST_METHOD");
}
/* }}} */
diff --git a/sapi/cgi/tests/skipif.inc b/sapi/cgi/tests/skipif.inc
index d2cef23589..2145a9e410 100644
--- a/sapi/cgi/tests/skipif.inc
+++ b/sapi/cgi/tests/skipif.inc
@@ -1,13 +1,13 @@
<?php
if (substr(php_sapi_name(), 0, 3) == "cgi") {
- exit;
+ exit;
}
include dirname(__FILE__)."/include.inc";
if (!get_cgi_path()) {
- die("skip CGI not found");
+ die("skip CGI not found");
}
?>
diff --git a/sapi/cli/cli.h b/sapi/cli/cli.h
index b4c2851791..694de0d9e9 100644
--- a/sapi/cli/cli.h
+++ b/sapi/cli/cli.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/cli/config.m4 b/sapi/cli/config.m4
index 917d45fad1..d17d531683 100644
--- a/sapi/cli/config.m4
+++ b/sapi/cli/config.m4
@@ -42,7 +42,7 @@ if test "$PHP_CLI" != "no"; then
BUILD_CLI="\$(CC) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(NATIVE_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_BINARY_OBJS:.lo=.o) \$(PHP_CLI_OBJS:.lo=.o) \$(PHP_FRAMEWORKS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CLI_PATH)"
;;
*)
- BUILD_CLI="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) \$(PHP_BINARY_OBJS) \$(PHP_CLI_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CLI_PATH)"
+ BUILD_CLI="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_BINARY_OBJS:.lo=.o) \$(PHP_CLI_OBJS:.lo=.o) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CLI_PATH)"
;;
esac
diff --git a/sapi/cli/generate_mime_type_map.php b/sapi/cli/generate_mime_type_map.php
index 40f546ef83..c4c83679c2 100755
--- a/sapi/cli/generate_mime_type_map.php
+++ b/sapi/cli/generate_mime_type_map.php
@@ -43,8 +43,6 @@ foreach($additional_mime_maps as $ext => $mime) {
?>
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/cli/mime_type_map.h b/sapi/cli/mime_type_map.h
index 0c559d635f..66d62dfa2b 100644
--- a/sapi/cli/mime_type_map.h
+++ b/sapi/cli/mime_type_map.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c
index 1b14b7586b..8cc570f132 100644
--- a/sapi/cli/php_cli.c
+++ b/sapi/cli/php_cli.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -413,7 +411,7 @@ static int php_cli_startup(sapi_module_struct *sapi_module) /* {{{ */
/* {{{ sapi_cli_ini_defaults */
-/* overwriteable ini defaults must be set in sapi_cli_ini_defaults() */
+/* overwritable ini defaults must be set in sapi_cli_ini_defaults() */
#define INI_DEFAULT(name,value)\
ZVAL_NEW_STR(&tmp, zend_string_init(value, sizeof(value)-1, 1));\
zend_hash_str_update(configuration_hash, name, sizeof(name)-1, &tmp);\
@@ -908,7 +906,7 @@ static int do_cli(int argc, char **argv) /* {{{ */
} else {
/* We could handle PHP_MODE_PROCESS_STDIN in a different manner */
/* here but this would make things only more complicated. And it */
- /* is consitent with the way -R works where the stdin file handle*/
+ /* is consistent with the way -R works where the stdin file handle*/
/* is also accessible. */
zend_stream_init_fp(&file_handle, stdin, "Standard input code");
}
@@ -1073,7 +1071,7 @@ static int do_cli(int argc, char **argv) /* {{{ */
memset(&execute_data, 0, sizeof(zend_execute_data));
EG(current_execute_data) = &execute_data;
- zend_call_method_with_1_params(&ref, pce, &pce->constructor, "__construct", NULL, &arg);
+ zend_call_method_with_1_params(Z_OBJ(ref), pce, &pce->constructor, "__construct", NULL, &arg);
if (EG(exception)) {
zval tmp, *msg, rv;
diff --git a/sapi/cli/php_cli_process_title.c b/sapi/cli/php_cli_process_title.c
index 1b82104ca6..4437fdd46b 100644
--- a/sapi/cli/php_cli_process_title.c
+++ b/sapi/cli/php_cli_process_title.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -33,7 +31,7 @@ PHP_FUNCTION(cli_set_process_title)
int rc;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &title, &title_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
rc = set_ps_title(title);
@@ -55,7 +53,7 @@ PHP_FUNCTION(cli_get_process_title)
int rc;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
rc = get_ps_title(&length, &title);
diff --git a/sapi/cli/php_cli_process_title.h b/sapi/cli/php_cli_process_title.h
index c2fed7b817..74766491d7 100644
--- a/sapi/cli/php_cli_process_title.h
+++ b/sapi/cli/php_cli_process_title.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c
index bd48afb1f7..dd26b5c971 100644
--- a/sapi/cli/php_cli_server.c
+++ b/sapi/cli/php_cli_server.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -263,7 +261,7 @@ int php_cli_server_get_system_time(char *buf) {
gettimeofday(&tv, NULL);
- /* TODO: should be checked for NULL tm/return vaue */
+ /* TODO: should be checked for NULL tm/return value */
php_localtime_r(&tv.tv_sec, &tm);
php_asctime_r(&tm, buf);
return 0;
@@ -384,7 +382,7 @@ PHP_FUNCTION(apache_request_headers) /* {{{ */
zval tmp;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
client = SG(server_context);
@@ -430,7 +428,7 @@ static void add_response_header(sapi_header_struct *h, zval *return_value) /* {{
PHP_FUNCTION(apache_response_headers) /* {{{ */
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
array_init(return_value);
@@ -2204,8 +2202,6 @@ static int php_cli_server_dispatch_router(php_cli_server *server, php_cli_server
decline = Z_TYPE(retval) == IS_FALSE;
zval_ptr_dtor(&retval);
}
- } else {
- decline = 1;
}
} zend_end_try();
diff --git a/sapi/cli/php_cli_server.h b/sapi/cli/php_cli_server.h
index 4d57f1b922..d78211a8fd 100644
--- a/sapi/cli/php_cli_server.h
+++ b/sapi/cli/php_cli_server.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/cli/php_http_parser.h b/sapi/cli/php_http_parser.h
index d2fa69b757..8e97013d07 100644
--- a/sapi/cli/php_http_parser.h
+++ b/sapi/cli/php_http_parser.h
@@ -46,7 +46,7 @@ extern "C" {
#endif
-/* Maximium header size allowed */
+/* Maximum header size allowed */
#define PHP_HTTP_MAX_HEADER_SIZE (80*1024)
diff --git a/sapi/cli/ps_title.h b/sapi/cli/ps_title.h
index 540609c85d..e8da2a936b 100644
--- a/sapi/cli/ps_title.h
+++ b/sapi/cli/ps_title.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/cli/tests/003-2.phpt b/sapi/cli/tests/003-2.phpt
index 6b8957e644..71ef7163be 100644
--- a/sapi/cli/tests/003-2.phpt
+++ b/sapi/cli/tests/003-2.phpt
@@ -16,10 +16,8 @@ var_dump(`"$php" -nd max_execution_time=111 -r 'var_dump(ini_get("max_execution_
var_dump(`"$php" -nd max_execution_time=500 -r 'var_dump(ini_get("max_execution_time"));'`);
?>
-===DONE===
--EXPECT--
string(16) "string(3) "111"
"
string(16) "string(3) "500"
"
-===DONE===
diff --git a/sapi/cli/tests/004.phpt b/sapi/cli/tests/004.phpt
index 78158ba70a..f00f7b4fd9 100644
--- a/sapi/cli/tests/004.phpt
+++ b/sapi/cli/tests/004.phpt
@@ -20,11 +20,12 @@ string(45) "Exception: Function unknown() does not exist
"
string(42) "Exception: Function echo() does not exist
"
-string(119) "Function [ <internal:standard> function phpinfo ] {
+string(143) "Function [ <internal:standard> function phpinfo ] {
- Parameters [1] {
- Parameter #0 [ <optional> $what ]
+ Parameter #0 [ <optional> int $what ]
}
+ - Return [ bool ]
}
"
diff --git a/sapi/cli/tests/005.phpt b/sapi/cli/tests/005.phpt
index 0a366b6975..d268104606 100644
--- a/sapi/cli/tests/005.phpt
+++ b/sapi/cli/tests/005.phpt
@@ -37,7 +37,7 @@ string(183) "Class [ <internal:Core> class stdClass ] {
}
"
-string(1607) "Class [ <internal:Core> class Exception implements Throwable ] {
+string(1969) "Class [ <internal:Core> class Exception implements Throwable ] {
- Constants [0] {
}
@@ -60,42 +60,72 @@ string(1607) "Class [ <internal:Core> class Exception implements Throwable ] {
- Methods [11] {
Method [ <internal:Core> final private method __clone ] {
+
+ - Parameters [0] {
+ }
}
Method [ <internal:Core, ctor> public method __construct ] {
- Parameters [3] {
- Parameter #0 [ <optional> $message ]
- Parameter #1 [ <optional> $code ]
- Parameter #2 [ <optional> $previous ]
+ Parameter #0 [ <optional> string $message ]
+ Parameter #1 [ <optional> int $code ]
+ Parameter #2 [ <optional> ?Throwable $previous ]
}
}
Method [ <internal:Core> public method __wakeup ] {
+
+ - Parameters [0] {
+ }
}
Method [ <internal:Core, prototype Throwable> final public method getMessage ] {
+
+ - Parameters [0] {
+ }
}
Method [ <internal:Core, prototype Throwable> final public method getCode ] {
+
+ - Parameters [0] {
+ }
}
Method [ <internal:Core, prototype Throwable> final public method getFile ] {
+
+ - Parameters [0] {
+ }
}
Method [ <internal:Core, prototype Throwable> final public method getLine ] {
+
+ - Parameters [0] {
+ }
}
Method [ <internal:Core, prototype Throwable> final public method getTrace ] {
+
+ - Parameters [0] {
+ }
}
Method [ <internal:Core, prototype Throwable> final public method getPrevious ] {
+
+ - Parameters [0] {
+ }
}
Method [ <internal:Core, prototype Throwable> final public method getTraceAsString ] {
+
+ - Parameters [0] {
+ }
}
Method [ <internal:Core, prototype Throwable> public method __toString ] {
+
+ - Parameters [0] {
+ }
}
}
}
diff --git a/sapi/cli/tests/006.phpt b/sapi/cli/tests/006.phpt
index 54d1a96a88..b1f756d17f 100644
--- a/sapi/cli/tests/006.phpt
+++ b/sapi/cli/tests/006.phpt
@@ -68,22 +68,24 @@ string(%d) "Extension [ <persistent> extension #%d pcre version %s ] {
Function [ <internal:pcre> function preg_match ] {
- Parameters [5] {
- Parameter #0 [ <required> $pattern ]
- Parameter #1 [ <required> $subject ]
+ Parameter #0 [ <required> string $pattern ]
+ Parameter #1 [ <required> string $subject ]
Parameter #2 [ <optional> &$subpatterns ]
- Parameter #3 [ <optional> $flags ]
- Parameter #4 [ <optional> $offset ]
+ Parameter #3 [ <optional> int $flags ]
+ Parameter #4 [ <optional> int $offset ]
}
+ - Return [ int|false ]
}
Function [ <internal:pcre> function preg_match_all ] {
- Parameters [5] {
- Parameter #0 [ <required> $pattern ]
- Parameter #1 [ <required> $subject ]
+ Parameter #0 [ <required> string $pattern ]
+ Parameter #1 [ <required> string $subject ]
Parameter #2 [ <optional> &$subpatterns ]
- Parameter #3 [ <optional> $flags ]
- Parameter #4 [ <optional> $offset ]
+ Parameter #3 [ <optional> int $flags ]
+ Parameter #4 [ <optional> int $offset ]
}
+ - Return [ int|false|null ]
}
Function [ <internal:pcre> function preg_replace ] {
@@ -91,9 +93,10 @@ string(%d) "Extension [ <persistent> extension #%d pcre version %s ] {
Parameter #0 [ <required> $regex ]
Parameter #1 [ <required> $replace ]
Parameter #2 [ <required> $subject ]
- Parameter #3 [ <optional> $limit ]
+ Parameter #3 [ <optional> int $limit ]
Parameter #4 [ <optional> &$count ]
}
+ - Return [ array|string|null ]
}
Function [ <internal:pcre> function preg_replace_callback ] {
@@ -101,20 +104,22 @@ string(%d) "Extension [ <persistent> extension #%d pcre version %s ] {
Parameter #0 [ <required> $regex ]
Parameter #1 [ <required> $callback ]
Parameter #2 [ <required> $subject ]
- Parameter #3 [ <optional> $limit ]
+ Parameter #3 [ <optional> int $limit ]
Parameter #4 [ <optional> &$count ]
- Parameter #5 [ <optional> $flags ]
+ Parameter #5 [ <optional> int $flags ]
}
+ - Return [ array|string|null ]
}
Function [ <internal:pcre> function preg_replace_callback_array ] {
- Parameters [5] {
- Parameter #0 [ <required> $pattern ]
+ Parameter #0 [ <required> array $pattern ]
Parameter #1 [ <required> $subject ]
- Parameter #2 [ <optional> $limit ]
+ Parameter #2 [ <optional> int $limit ]
Parameter #3 [ <optional> &$count ]
- Parameter #4 [ <optional> $flags ]
+ Parameter #4 [ <optional> int $flags ]
}
+ - Return [ array|string|null ]
}
Function [ <internal:pcre> function preg_filter ] {
@@ -122,38 +127,43 @@ string(%d) "Extension [ <persistent> extension #%d pcre version %s ] {
Parameter #0 [ <required> $regex ]
Parameter #1 [ <required> $replace ]
Parameter #2 [ <required> $subject ]
- Parameter #3 [ <optional> $limit ]
+ Parameter #3 [ <optional> int $limit ]
Parameter #4 [ <optional> &$count ]
}
+ - Return [ array|string|null ]
}
Function [ <internal:pcre> function preg_split ] {
- Parameters [4] {
- Parameter #0 [ <required> $pattern ]
- Parameter #1 [ <required> $subject ]
- Parameter #2 [ <optional> $limit ]
- Parameter #3 [ <optional> $flags ]
+ Parameter #0 [ <required> string $pattern ]
+ Parameter #1 [ <required> string $subject ]
+ Parameter #2 [ <optional> int $limit ]
+ Parameter #3 [ <optional> int $flags ]
}
+ - Return [ array|false ]
}
Function [ <internal:pcre> function preg_quote ] {
- Parameters [2] {
- Parameter #0 [ <required> $str ]
- Parameter #1 [ <optional> $delim_char ]
+ Parameter #0 [ <required> string $str ]
+ Parameter #1 [ <optional> ?string $delim_char ]
}
+ - Return [ string ]
}
Function [ <internal:pcre> function preg_grep ] {
- Parameters [3] {
- Parameter #0 [ <required> $regex ]
- Parameter #1 [ <required> $input ]
- Parameter #2 [ <optional> $flags ]
+ Parameter #0 [ <required> string $regex ]
+ Parameter #1 [ <required> array $input ]
+ Parameter #2 [ <optional> int $flags ]
}
+ - Return [ array|false ]
}
Function [ <internal:pcre> function preg_last_error ] {
- Parameters [0] {
}
+ - Return [ int ]
}
}
}
diff --git a/sapi/cli/tests/007.phpt b/sapi/cli/tests/007.phpt
index 51858bae48..94ea6fd247 100644
--- a/sapi/cli/tests/007.phpt
+++ b/sapi/cli/tests/007.phpt
@@ -18,12 +18,12 @@ $code ='
/* some test script */
class test { /* {{{ */
- public $var = "test"; //test var
-#perl style comment
- private $pri; /* private attr */
+ public $var = "test"; //test var
+#perl style comment
+ private $pri; /* private attr */
- function foo(/* void */) {
- }
+ function foo(/* void */) {
+ }
}
/* }}} */
diff --git a/sapi/cli/tests/008.phpt b/sapi/cli/tests/008.phpt
index fb8518535a..c96170d497 100644
--- a/sapi/cli/tests/008.phpt
+++ b/sapi/cli/tests/008.phpt
@@ -17,7 +17,7 @@ $code ='
<?php
class test {
- private $pri;
+ private $pri;
}
var_dump(test::$pri);
diff --git a/sapi/cli/tests/010.phpt b/sapi/cli/tests/010.phpt
index c316e213e3..01b3599136 100644
--- a/sapi/cli/tests/010.phpt
+++ b/sapi/cli/tests/010.phpt
@@ -32,7 +32,6 @@ file_put_contents($filename_txt, $txt);
var_dump(`cat "$filename_txt" | "$php" -n -F "$filename"`);
?>
-===DONE===
--CLEAN--
<?php
@unlink(__DIR__."/010.test.php");
@@ -43,4 +42,3 @@ string(25) "
string(10) "test
hello"
"
-===DONE===
diff --git a/sapi/cli/tests/011.phpt b/sapi/cli/tests/011.phpt
index 3ada7c53bf..24eb9fc2df 100644
--- a/sapi/cli/tests/011.phpt
+++ b/sapi/cli/tests/011.phpt
@@ -15,7 +15,7 @@ $code = '
$test = "var";
class test {
- private $var;
+ private $var;
}
echo test::$var;
@@ -31,8 +31,8 @@ var_dump(`"$php" -n -l some.unknown`);
$code = '
<?php
-class test
- private $var;
+class test
+ private $var;
}
?>
diff --git a/sapi/cli/tests/014.phpt b/sapi/cli/tests/014.phpt
index 1ee72e05f6..4a458d2ae7 100644
--- a/sapi/cli/tests/014.phpt
+++ b/sapi/cli/tests/014.phpt
@@ -13,12 +13,12 @@ $code = '
$test = "var"; //var
/* test class */
class test {
- private $var = array();
+ private $var = array();
- public static function foo(Test $arg) {
- echo "hello";
- var_dump($this);
- }
+ public static function foo(Test $arg) {
+ echo "hello";
+ var_dump($this);
+ }
}
$o = new test;
diff --git a/sapi/cli/tests/016.phpt b/sapi/cli/tests/016.phpt
index ea735d8d6e..bbba579ec2 100644
--- a/sapi/cli/tests/016.phpt
+++ b/sapi/cli/tests/016.phpt
@@ -52,9 +52,9 @@ a_function_w );
EOT;
foreach ($codes as $key => $code) {
- echo "\n--------------\nSnippet no. $key:\n--------------\n";
- $code = escapeshellarg($code);
- echo `echo $code | "$php" -a`, "\n";
+ echo "\n--------------\nSnippet no. $key:\n--------------\n";
+ $code = escapeshellarg($code);
+ echo `echo $code | "$php" -a`, "\n";
}
echo "\nDone\n";
diff --git a/sapi/cli/tests/017.phpt b/sapi/cli/tests/017.phpt
index 684e41691e..4cc80a4b0a 100644
--- a/sapi/cli/tests/017.phpt
+++ b/sapi/cli/tests/017.phpt
@@ -52,9 +52,9 @@ a_function_w );
EOT;
foreach ($codes as $key => $code) {
- echo "\n--------------\nSnippet no. $key:\n--------------\n";
- $code = escapeshellarg($code);
- echo `echo $code | "$php" -a`, "\n";
+ echo "\n--------------\nSnippet no. $key:\n--------------\n";
+ $code = escapeshellarg($code);
+ echo `echo $code | "$php" -a`, "\n";
}
echo "\nDone\n";
diff --git a/sapi/cli/tests/022.phpt b/sapi/cli/tests/022.phpt
index 3b97016b58..40c2265351 100644
--- a/sapi/cli/tests/022.phpt
+++ b/sapi/cli/tests/022.phpt
@@ -11,23 +11,23 @@ $php = getenv("TEST_PHP_EXECUTABLE");
$socket_file = tempnam(sys_get_temp_dir(), pathinfo(__FILE__, PATHINFO_FILENAME) . '.sock');
$test_file = __DIR__ . '/' . pathinfo(__FILE__, PATHINFO_FILENAME) . '.inc';
if (file_exists($socket_file)) {
- unlink($socket_file);
+ unlink($socket_file);
}
$socket = stream_socket_server('unix://' . $socket_file);
var_dump($socket);
if (!$socket) {
- exit(1);
+ exit(1);
}
$desc = array(
- 0 => $socket,
- 1 => STDOUT,
- 2 => STDERR,
+ 0 => $socket,
+ 1 => STDOUT,
+ 2 => STDERR,
);
$pipes = array();
$proc = proc_open("$php -n " . escapeshellarg($test_file), $desc, $pipes);
var_dump($proc);
if (!$proc) {
- exit(1);
+ exit(1);
}
$client_socket = stream_socket_client('unix://' . $socket_file);
diff --git a/sapi/cli/tests/023.phpt b/sapi/cli/tests/023.phpt
index 09b256a9af..4f827ff387 100644
--- a/sapi/cli/tests/023.phpt
+++ b/sapi/cli/tests/023.phpt
@@ -22,14 +22,14 @@ memory_limit = 70M
INI
);
$desc = array(
- 0 => array("pipe", "r"),
- 1 => array("pipe", "w"),
- 2 => array("pipe", "w"),
+ 0 => array("pipe", "r"),
+ 1 => array("pipe", "w"),
+ 2 => array("pipe", "w"),
);
$pipes = array();
$proc = proc_open("$php -c $ini_file -r 'echo ini_get(\"memory_limit\");'", $desc, $pipes);
if (!$proc) {
- exit(1);
+ exit(1);
}
var_dump(stream_get_contents($pipes[1]));
var_dump(stream_get_contents($pipes[2]));
diff --git a/sapi/cli/tests/argv_mb.phpt b/sapi/cli/tests/argv_mb.phpt
index 868b1a857f..5ed5cef343 100644
--- a/sapi/cli/tests/argv_mb.phpt
+++ b/sapi/cli/tests/argv_mb.phpt
@@ -17,7 +17,6 @@ var_dump(`$php -n $argv_fl 多字节字符串 マルãƒãƒã‚¤ãƒˆæ–‡å­—列 мно
@unlink($argv_fl);
?>
-==DONE==
--EXPECTF--
string(%d) "array(%d) {
[0]=>
@@ -32,4 +31,3 @@ string(%d) "array(%d) {
string(15) "flerbytesträng"
}
"
-==DONE==
diff --git a/sapi/cli/tests/argv_mb_bug77111.phpt b/sapi/cli/tests/argv_mb_bug77111.phpt
index 45913b841f..986e5f4923 100644
--- a/sapi/cli/tests/argv_mb_bug77111.phpt
+++ b/sapi/cli/tests/argv_mb_bug77111.phpt
@@ -28,7 +28,6 @@ file_put_contents($argv_fl, "<?php file_put_contents('$out_fl', implode(' ', arr
var_dump(file_get_contents($out_fl));
?>
-==DONE==
--CLEAN--
<?php
$out_fl = __DIR__ . "\\argv_bug77111.txt";
@@ -38,5 +37,4 @@ unlink($out_fl);
?>
--EXPECTF--
string(57) "Ästhetik Æstetik Esthétique Estética ЭÑтетика"
-==DONE==
diff --git a/sapi/cli/tests/bug43177.phpt b/sapi/cli/tests/bug43177.phpt
index 87dc8927ff..f36019ba6b 100644
--- a/sapi/cli/tests/bug43177.phpt
+++ b/sapi/cli/tests/bug43177.phpt
@@ -8,30 +8,30 @@ include "skipif.inc";
<?php
include "php_cli_server.inc";
php_cli_server_start(<<<'SCRIPT'
- ini_set('display_errors', 0);
- switch($_SERVER["REQUEST_URI"]) {
- case "/parse":
- try {
+ ini_set('display_errors', 0);
+ switch($_SERVER["REQUEST_URI"]) {
+ case "/parse":
+ try {
eval("this is a parse error");
} catch (ParseError $e) {
}
- echo "OK\n";
- break;
- case "/fatal":
- eval("foo();");
- echo "OK\n";
- break;
- case "/compile":
- eval("class foo { final private final function bar() {} }");
- echo "OK\n";
- break;
- case "/fatal2":
- foo();
- echo "OK\n";
- break;
- default:
- return false;
- }
+ echo "OK\n";
+ break;
+ case "/fatal":
+ eval("foo();");
+ echo "OK\n";
+ break;
+ case "/compile":
+ eval("class foo { final private final function bar() {} }");
+ echo "OK\n";
+ break;
+ case "/fatal2":
+ foo();
+ echo "OK\n";
+ break;
+ default:
+ return false;
+ }
SCRIPT
);
@@ -39,12 +39,12 @@ list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
$port = intval($port)?:80;
foreach(array("parse", "fatal", "fatal2", "compile") as $url) {
- $fp = fsockopen($host, $port, $errno, $errstr, 0.5);
- if (!$fp) {
- die("connect failed");
- }
+ $fp = fsockopen($host, $port, $errno, $errstr, 0.5);
+ if (!$fp) {
+ die("connect failed");
+ }
- if(fwrite($fp, <<<HEADER
+ if(fwrite($fp, <<<HEADER
GET /$url HTTP/1.1
Host: {$host}
@@ -54,7 +54,7 @@ HEADER
while (!feof($fp)) {
echo fgets($fp);
}
- }
+ }
}
?>
diff --git a/sapi/cli/tests/bug64529.phpt b/sapi/cli/tests/bug64529.phpt
index 7331b8303e..ff3e3029e6 100644
--- a/sapi/cli/tests/bug64529.phpt
+++ b/sapi/cli/tests/bug64529.phpt
@@ -20,7 +20,7 @@ $php_executable = getenv('TEST_PHP_EXECUTABLE');
$script = __DIR__ . "/expect.sh";
if (extension_loaded("readline")) {
- $expect_script = <<<SCRIPT
+ $expect_script = <<<SCRIPT
set php_executable [lindex \$argv 0]
@@ -38,7 +38,7 @@ exit
SCRIPT;
} else {
- $expect_script = <<<SCRIPT
+ $expect_script = <<<SCRIPT
set php_executable [lindex \$argv 0]
diff --git a/sapi/cli/tests/bug65066_100.phpt b/sapi/cli/tests/bug65066_100.phpt
index 4203b7444c..0d211c5f83 100644
--- a/sapi/cli/tests/bug65066_100.phpt
+++ b/sapi/cli/tests/bug65066_100.phpt
@@ -26,9 +26,9 @@ Host: {$host}
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
- }
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
}
?>
--EXPECTF--
diff --git a/sapi/cli/tests/bug65066_422.phpt b/sapi/cli/tests/bug65066_422.phpt
index e8b497e923..0ecaf6e527 100644
--- a/sapi/cli/tests/bug65066_422.phpt
+++ b/sapi/cli/tests/bug65066_422.phpt
@@ -26,9 +26,9 @@ Host: {$host}
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
- }
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
}
?>
--EXPECTF--
diff --git a/sapi/cli/tests/bug65066_511.phpt b/sapi/cli/tests/bug65066_511.phpt
index 7e5548aadc..69d4473027 100644
--- a/sapi/cli/tests/bug65066_511.phpt
+++ b/sapi/cli/tests/bug65066_511.phpt
@@ -26,9 +26,9 @@ Host: {$host}
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
- }
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
}
?>
--EXPECTF--
diff --git a/sapi/cli/tests/bug66606_2.phpt b/sapi/cli/tests/bug66606_2.phpt
index d8bd6162a4..cba0c76e76 100644
--- a/sapi/cli/tests/bug66606_2.phpt
+++ b/sapi/cli/tests/bug66606_2.phpt
@@ -28,9 +28,9 @@ Content-Length: 3
a=b
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
- }
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
}
fclose($fp);
diff --git a/sapi/cli/tests/bug69655.phpt b/sapi/cli/tests/bug69655.phpt
index 73791c95d5..dbb9a6af40 100644
--- a/sapi/cli/tests/bug69655.phpt
+++ b/sapi/cli/tests/bug69655.phpt
@@ -17,11 +17,11 @@ foreach (['MKCO', 'MKCOLL', 'M'] as $method) {
}
?>
--EXPECTF--
-Warning: file_get_contents(http://localhost:8964): failed to open stream: HTTP request failed! HTTP/1.0 501 Not Implemented
+Warning: file_get_contents(http://localhost:8964): Failed to open stream: HTTP request failed! HTTP/1.0 501 Not Implemented
in %s on line %d
-Warning: file_get_contents(http://localhost:8964): failed to open stream: HTTP request failed! HTTP/1.0 501 Not Implemented
+Warning: file_get_contents(http://localhost:8964): Failed to open stream: HTTP request failed! HTTP/1.0 501 Not Implemented
in %s on line %d
-Warning: file_get_contents(http://localhost:8964): failed to open stream: HTTP request failed! HTTP/1.0 501 Not Implemented
+Warning: file_get_contents(http://localhost:8964): Failed to open stream: HTTP request failed! HTTP/1.0 501 Not Implemented
in %s on line %d
diff --git a/sapi/cli/tests/bug70264.phpt b/sapi/cli/tests/bug70264.phpt
index 877b1194f2..6d4ee15273 100644
--- a/sapi/cli/tests/bug70264.phpt
+++ b/sapi/cli/tests/bug70264.phpt
@@ -14,8 +14,8 @@ echo file_get_contents("http://" . PHP_CLI_SERVER_ADDRESS . "/..\\CREDITS");
echo file_get_contents("http://" . PHP_CLI_SERVER_ADDRESS . "/..%5CCREDITS");
?>
--EXPECTF--
-Warning: file_get_contents(http://%s/..\CREDITS): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found
+Warning: file_get_contents(http://%s/..\CREDITS): Failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found
in %sbug70264.php on line %d
-Warning: file_get_contents(http://%s/..%5CCREDITS): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found
+Warning: file_get_contents(http://%s/..%5CCREDITS): Failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found
in %sbug70264.php on line %d
diff --git a/sapi/cli/tests/bug70470.phpt b/sapi/cli/tests/bug70470.phpt
index 1e05f184b4..0c5fc56591 100644
--- a/sapi/cli/tests/bug70470.phpt
+++ b/sapi/cli/tests/bug70470.phpt
@@ -12,7 +12,7 @@ php_cli_server_start("var_dump(getAllheaders());");
$fp = fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT, $errno, $errmsg, 0.5);
if (!$fp) {
- die("connect failed: " . $errmsg);
+ die("connect failed: " . $errmsg);
}
fwrite($fp, "GET / HTTP/1.1\r\n");
@@ -26,7 +26,7 @@ fflush($fp);
usleep(200000);
fwrite($fp, "se\r\n\r\n");
while (!feof($fp)) {
- echo fgets($fp);
+ echo fgets($fp);
}
fclose($fp);
?>
diff --git a/sapi/cli/tests/bug71005.phpt b/sapi/cli/tests/bug71005.phpt
index 6a163d4639..8341f0c94a 100644
--- a/sapi/cli/tests/bug71005.phpt
+++ b/sapi/cli/tests/bug71005.phpt
@@ -30,9 +30,9 @@ Host: {$host}
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
- }
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
}
?>
diff --git a/sapi/cli/tests/bug71624.phpt b/sapi/cli/tests/bug71624.phpt
index 67e3e8f343..8b82ebab58 100644
--- a/sapi/cli/tests/bug71624.phpt
+++ b/sapi/cli/tests/bug71624.phpt
@@ -20,11 +20,11 @@ file_put_contents($filename_txt, $txt);
$test_args = ['$argi', '$argn'];
foreach ($test_args as $test_arg) {
- if (substr(PHP_OS, 0, 3) == 'WIN') {
- var_dump(`type "$filename_txt" | "$php" -n -R "echo $test_arg . PHP_EOL;"`);
- } else {
- var_dump(`cat "$filename_txt" | "$php" -n -R 'echo $test_arg . PHP_EOL;'`);
- }
+ if (substr(PHP_OS, 0, 3) == 'WIN') {
+ var_dump(`type "$filename_txt" | "$php" -n -R "echo $test_arg . PHP_EOL;"`);
+ } else {
+ var_dump(`cat "$filename_txt" | "$php" -n -R 'echo $test_arg . PHP_EOL;'`);
+ }
}
@unlink($filename_txt);
diff --git a/sapi/cli/tests/bug74600.phpt b/sapi/cli/tests/bug74600.phpt
index eee222aaa3..3520982df0 100644
--- a/sapi/cli/tests/bug74600.phpt
+++ b/sapi/cli/tests/bug74600.phpt
@@ -14,14 +14,14 @@ file_put_contents($ini_file, <<<INI
INI
);
$desc = array(
- 0 => array("pipe", "r"),
- 1 => array("pipe", "w"),
- 2 => array("pipe", "w"),
+ 0 => array("pipe", "r"),
+ 1 => array("pipe", "w"),
+ 2 => array("pipe", "w"),
);
$pipes = array();
$proc = proc_open("$php -c $ini_file -r 'echo \"okey\";'", $desc, $pipes);
if (!$proc) {
- exit(1);
+ exit(1);
}
var_dump(stream_get_contents($pipes[1]));
var_dump(stream_get_contents($pipes[2]));
diff --git a/sapi/cli/tests/emptyheader.phpt b/sapi/cli/tests/emptyheader.phpt
index 9529730e8b..cf6b4cc694 100644
--- a/sapi/cli/tests/emptyheader.phpt
+++ b/sapi/cli/tests/emptyheader.phpt
@@ -12,13 +12,13 @@ php_cli_server_start("var_dump(getAllheaders());");
$fp = fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT, $errno, $errmsg, 0.5);
if (!$fp) {
- die("connect failed: " . $errmsg);
+ die("connect failed: " . $errmsg);
}
fwrite($fp, "GET / HTTP/1.1\r\nUser-Agent\r\nAccept: */*\r\nReferer:\r\nHi\r\n\r\n");
fflush($fp);
while (!feof($fp)) {
- echo fgets($fp);
+ echo fgets($fp);
}
fclose($fp);
?>
diff --git a/sapi/cli/tests/php_cli_server.inc b/sapi/cli/tests/php_cli_server.inc
index 679a55eed4..5767e114ca 100644
--- a/sapi/cli/tests/php_cli_server.inc
+++ b/sapi/cli/tests/php_cli_server.inc
@@ -4,29 +4,29 @@ define ("PHP_CLI_SERVER_PORT", 8964);
define ("PHP_CLI_SERVER_ADDRESS", PHP_CLI_SERVER_HOSTNAME.":".PHP_CLI_SERVER_PORT);
function php_cli_server_start(
- ?string $code = 'echo "Hello world";',
- ?string $router = 'index.php',
- array $cmd_args = []
+ ?string $code = 'echo "Hello world";',
+ ?string $router = 'index.php',
+ array $cmd_args = []
) {
- $php_executable = getenv('TEST_PHP_EXECUTABLE');
- $doc_root = __DIR__;
+ $php_executable = getenv('TEST_PHP_EXECUTABLE');
+ $doc_root = __DIR__;
$error = null;
- if ($code) {
- file_put_contents($doc_root . '/' . ($router ?: 'index.php'), '<?php ' . $code . ' ?>');
- }
-
- $cmd = [$php_executable, '-t', $doc_root, '-n', ...$cmd_args, '-S', PHP_CLI_SERVER_ADDRESS];
- if (!is_null($router)) {
- $cmd[] = $router;
- }
-
- $descriptorspec = array(
- 0 => STDIN,
- 1 => STDOUT,
- 2 => array("null"),
- );
- $handle = proc_open($cmd, $descriptorspec, $pipes, $doc_root, null, array("suppress_errors" => true));
+ if ($code) {
+ file_put_contents($doc_root . '/' . ($router ?: 'index.php'), '<?php ' . $code . ' ?>');
+ }
+
+ $cmd = [$php_executable, '-t', $doc_root, '-n', ...$cmd_args, '-S', PHP_CLI_SERVER_ADDRESS];
+ if (!is_null($router)) {
+ $cmd[] = $router;
+ }
+
+ $descriptorspec = array(
+ 0 => STDIN,
+ 1 => STDOUT,
+ 2 => array("null"),
+ );
+ $handle = proc_open($cmd, $descriptorspec, $pipes, $doc_root, null, array("suppress_errors" => true));
// note: here we check the process is running
for ($i=0; $i < 120; $i++) {
diff --git a/sapi/cli/tests/php_cli_server_004.phpt b/sapi/cli/tests/php_cli_server_004.phpt
index 9c93de3f92..0391836829 100644
--- a/sapi/cli/tests/php_cli_server_004.phpt
+++ b/sapi/cli/tests/php_cli_server_004.phpt
@@ -29,9 +29,9 @@ Referer:http://www.php.net/
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
- }
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
}
?>
diff --git a/sapi/cli/tests/php_cli_server_005.phpt b/sapi/cli/tests/php_cli_server_005.phpt
index f89245df11..852df3fcb1 100644
--- a/sapi/cli/tests/php_cli_server_005.phpt
+++ b/sapi/cli/tests/php_cli_server_005.phpt
@@ -41,9 +41,9 @@ Content-Length: {$post_len}
{$post_data}
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
- }
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
}
?>
diff --git a/sapi/cli/tests/php_cli_server_006.phpt b/sapi/cli/tests/php_cli_server_006.phpt
index ee851b0edd..87a6fd85c9 100644
--- a/sapi/cli/tests/php_cli_server_006.phpt
+++ b/sapi/cli/tests/php_cli_server_006.phpt
@@ -25,9 +25,9 @@ Authorization: Basic Zm9vOmJhcg==
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
- }
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
}
?>
diff --git a/sapi/cli/tests/php_cli_server_007.phpt b/sapi/cli/tests/php_cli_server_007.phpt
index 3e8fc5f48d..bc32d47845 100644
--- a/sapi/cli/tests/php_cli_server_007.phpt
+++ b/sapi/cli/tests/php_cli_server_007.phpt
@@ -25,9 +25,9 @@ Authorization: Basic Zm9vOmJhcg==
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
- }
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
}
?>
diff --git a/sapi/cli/tests/php_cli_server_008.phpt b/sapi/cli/tests/php_cli_server_008.phpt
index 2d9955c031..bd5f4f016a 100644
--- a/sapi/cli/tests/php_cli_server_008.phpt
+++ b/sapi/cli/tests/php_cli_server_008.phpt
@@ -24,9 +24,9 @@ Host: {$host}
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
- }
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
}
fclose($fp);
@@ -44,9 +44,9 @@ Host: {$host}
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
- }
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
}
fclose($fp);
diff --git a/sapi/cli/tests/php_cli_server_009.phpt b/sapi/cli/tests/php_cli_server_009.phpt
index cb4a14cb08..87a7b2db4a 100644
--- a/sapi/cli/tests/php_cli_server_009.phpt
+++ b/sapi/cli/tests/php_cli_server_009.phpt
@@ -27,9 +27,9 @@ Host: {$host}
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
- }
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
}
fclose($fp);
@@ -47,9 +47,9 @@ Host: {$host}
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
- }
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
}
fclose($fp);
@@ -67,10 +67,10 @@ Host: {$host}
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
- break;
- }
+ while (!feof($fp)) {
+ echo fgets($fp);
+ break;
+ }
}
fclose($fp);
diff --git a/sapi/cli/tests/php_cli_server_010.phpt b/sapi/cli/tests/php_cli_server_010.phpt
index 22cf3de344..d0cf52a082 100644
--- a/sapi/cli/tests/php_cli_server_010.phpt
+++ b/sapi/cli/tests/php_cli_server_010.phpt
@@ -24,9 +24,9 @@ Host: {$host}
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
- }
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
}
fclose($fp);
@@ -44,9 +44,9 @@ Host: {$host}
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
- }
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
}
fclose($fp);
diff --git a/sapi/cli/tests/php_cli_server_012.phpt b/sapi/cli/tests/php_cli_server_012.phpt
index d60d71b02a..55ecf38146 100644
--- a/sapi/cli/tests/php_cli_server_012.phpt
+++ b/sapi/cli/tests/php_cli_server_012.phpt
@@ -28,9 +28,9 @@ Content-Length: 3
a=b
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
- }
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
}
fclose($fp);
diff --git a/sapi/cli/tests/php_cli_server_013.phpt b/sapi/cli/tests/php_cli_server_013.phpt
index ec8957c8d1..9587bf0687 100644
--- a/sapi/cli/tests/php_cli_server_013.phpt
+++ b/sapi/cli/tests/php_cli_server_013.phpt
@@ -28,9 +28,9 @@ Content-Length: 3
a=b
HEADER
)) {
- while (!feof($fp)) {
- $output .= fgets($fp);
- }
+ while (!feof($fp)) {
+ $output .= fgets($fp);
+ }
}
echo preg_replace("/<style>(.*?)<\/style>/s", "<style>AAA</style>", $output), "\n";
@@ -50,9 +50,9 @@ Host: {$host}
HEADER
)) {
- while (!feof($fp)) {
- $output .= fgets($fp);
- }
+ while (!feof($fp)) {
+ $output .= fgets($fp);
+ }
}
echo preg_replace("/<style>(.*?)<\/style>/s", "<style>AAA</style>", $output), "\n";
@@ -71,9 +71,9 @@ Host: {$host}
HEADER
)) {
- while (!feof($fp)) {
- $output .= fgets($fp);
- }
+ while (!feof($fp)) {
+ $output .= fgets($fp);
+ }
}
echo preg_replace("/<style>(.*?)<\/style>/s", "<style>AAA</style>", $output), "\n";
diff --git a/sapi/cli/tests/php_cli_server_014.phpt b/sapi/cli/tests/php_cli_server_014.phpt
index 11db82ce90..8a244009e1 100644
--- a/sapi/cli/tests/php_cli_server_014.phpt
+++ b/sapi/cli/tests/php_cli_server_014.phpt
@@ -33,9 +33,9 @@ Content-Type: application/x-www-form-urlencoded
a=b
HEADER
)) {
- while (!feof($fp)) {
- $output .= fgets($fp);
- }
+ while (!feof($fp)) {
+ $output .= fgets($fp);
+ }
}
fclose($fp);
@@ -52,9 +52,9 @@ Content-Type: application/x-www-form-urlencoded
a=b
HEADER
)) {
- while (!feof($fp)) {
- $output .= fgets($fp);
- }
+ while (!feof($fp)) {
+ $output .= fgets($fp);
+ }
}
echo preg_replace("/<style>(.*?)<\/style>/s", "<style>AAA</style>", $output), "\n";
diff --git a/sapi/cli/tests/php_cli_server_015.phpt b/sapi/cli/tests/php_cli_server_015.phpt
index 990a3db97e..b9e4589f87 100644
--- a/sapi/cli/tests/php_cli_server_015.phpt
+++ b/sapi/cli/tests/php_cli_server_015.phpt
@@ -30,9 +30,9 @@ Host: {$host}
HEADER
)) {
- while (!feof($fp)) {
- $output .= fgets($fp);
- }
+ while (!feof($fp)) {
+ $output .= fgets($fp);
+ }
}
echo $output;
@unlink($dir . "/syntax_error.php");
diff --git a/sapi/cli/tests/php_cli_server_016.phpt b/sapi/cli/tests/php_cli_server_016.phpt
index ae1d3f272a..269eea66d8 100644
--- a/sapi/cli/tests/php_cli_server_016.phpt
+++ b/sapi/cli/tests/php_cli_server_016.phpt
@@ -34,10 +34,10 @@ Host: {$host}
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
+ while (!feof($fp)) {
+ echo fgets($fp);
break;
- }
+ }
}
fclose($fp);
diff --git a/sapi/cli/tests/php_cli_server_017.phpt b/sapi/cli/tests/php_cli_server_017.phpt
index 067d504800..6a36ec62d1 100644
--- a/sapi/cli/tests/php_cli_server_017.phpt
+++ b/sapi/cli/tests/php_cli_server_017.phpt
@@ -27,9 +27,9 @@ Host: {$host}
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
- }
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
}
fclose($fp);
diff --git a/sapi/cli/tests/php_cli_server_020.phpt b/sapi/cli/tests/php_cli_server_020.phpt
index 23a8bc40e1..ea4f3f9eff 100644
--- a/sapi/cli/tests/php_cli_server_020.phpt
+++ b/sapi/cli/tests/php_cli_server_020.phpt
@@ -24,9 +24,9 @@ Host: {$host}
HEADER
)) {
- while (!feof($fp)) {
- echo fgets($fp);
- }
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
}
?>
diff --git a/sapi/cli/tests/sapi_windows_set_ctrl_handler.phpt b/sapi/cli/tests/sapi_windows_set_ctrl_handler.phpt
index 9028b6902b..c09e04b5a1 100644
--- a/sapi/cli/tests/sapi_windows_set_ctrl_handler.phpt
+++ b/sapi/cli/tests/sapi_windows_set_ctrl_handler.phpt
@@ -15,63 +15,63 @@ $is_child = isset($argv[1]);
if ($is_child) {
- function handler($evt)
- {
- exit(3);
- }
+ function handler($evt)
+ {
+ exit(3);
+ }
- sapi_windows_set_ctrl_handler('handler');
+ sapi_windows_set_ctrl_handler('handler');
- while(1) usleep(100);
+ while(1) usleep(100);
} else {
- $cmd = PHP_BINARY . " -n " . $argv[0] . " 1";
- $spec = [0 => ["pipe", "r"], 1 => ["pipe", "w"]];
+ $cmd = PHP_BINARY . " -n " . $argv[0] . " 1";
+ $spec = [0 => ["pipe", "r"], 1 => ["pipe", "w"]];
- $proc = proc_open($cmd, $spec, $pipes, NULL, NULL, ["bypass_shell" => true, "create_process_group" => true]);
+ $proc = proc_open($cmd, $spec, $pipes, NULL, NULL, ["bypass_shell" => true, "create_process_group" => true]);
- if (!is_resource($proc)) {
- die("Failed to start child. ");
- }
+ if (!is_resource($proc)) {
+ die("Failed to start child. ");
+ }
- $child_pid = proc_get_status($proc)["pid"];
- echo "Started child $child_pid\n";
- usleep(300);
+ $child_pid = proc_get_status($proc)["pid"];
+ echo "Started child $child_pid\n";
+ usleep(300);
- $cmd = "tasklist /FI \"PID eq $child_pid\" /NH";
- echo "Running `$cmd` to check the process indeed exists:\n";
- echo trim(shell_exec($cmd)) . "\n";
+ $cmd = "tasklist /FI \"PID eq $child_pid\" /NH";
+ echo "Running `$cmd` to check the process indeed exists:\n";
+ echo trim(shell_exec($cmd)) . "\n";
- $evt = PHP_WINDOWS_EVENT_CTRL_C;
- echo "Sending ", get_evt_name($evt), " to child $child_pid\n";
- $ret = sapi_windows_generate_ctrl_event($evt, $child_pid);
+ $evt = PHP_WINDOWS_EVENT_CTRL_C;
+ echo "Sending ", get_evt_name($evt), " to child $child_pid\n";
+ $ret = sapi_windows_generate_ctrl_event($evt, $child_pid);
- echo ($ret ? "Successfully" : "Unsuccessfuly"), " sent ", get_evt_name($evt), " to child $child_pid\n";
+ echo ($ret ? "Successfully" : "Unsuccessfuly"), " sent ", get_evt_name($evt), " to child $child_pid\n";
- $max = 5000; $total = 0; $step = 100;
- while(proc_get_status($proc)["running"] && $max > $total) {
- usleep($step);
- $total += $step;
- }
+ $max = 5000; $total = 0; $step = 100;
+ while(proc_get_status($proc)["running"] && $max > $total) {
+ usleep($step);
+ $total += $step;
+ }
- $status = proc_get_status($proc);
- if ($status["running"]) {
- echo "Child $child_pid didn't exit after ${max}us\n";
- } else {
- echo "Child $child_pid exit with status ", $status["exitcode"], " after ${total}us\n";
- }
+ $status = proc_get_status($proc);
+ if ($status["running"]) {
+ echo "Child $child_pid didn't exit after ${max}us\n";
+ } else {
+ echo "Child $child_pid exit with status ", $status["exitcode"], " after ${total}us\n";
+ }
- proc_close($proc);
+ proc_close($proc);
}
function get_evt_name(int $evt) : ?string
{
- if (PHP_WINDOWS_EVENT_CTRL_C == $evt) {
- return "CTRL+C";
- } if (PHP_WINDOWS_EVENT_CTRL_BREAK == $evt) {
- return "CTRL+BREAK";
- }
+ if (PHP_WINDOWS_EVENT_CTRL_C == $evt) {
+ return "CTRL+C";
+ } if (PHP_WINDOWS_EVENT_CTRL_BREAK == $evt) {
+ return "CTRL+BREAK";
+ }
- return NULL;
+ return NULL;
}
?>
diff --git a/sapi/cli/tests/skipif.inc b/sapi/cli/tests/skipif.inc
index 79e6c91004..0500d0bb75 100644
--- a/sapi/cli/tests/skipif.inc
+++ b/sapi/cli/tests/skipif.inc
@@ -1,7 +1,7 @@
<?php
if (php_sapi_name() != "cli") {
- die("skip CLI only");
+ die("skip CLI only");
}
?>
diff --git a/sapi/cli/tests/upload_2G.phpt b/sapi/cli/tests/upload_2G.phpt
index 82bbbca481..5012d05bc4 100644
--- a/sapi/cli/tests/upload_2G.phpt
+++ b/sapi/cli/tests/upload_2G.phpt
@@ -44,7 +44,7 @@ echo "Test\n";
include "php_cli_server.inc";
php_cli_server_start("var_dump(\$_FILES);", null,
- ["-d", "post_max_size=3G", "-d", "upload_max_filesize=3G"]);
+ ["-d", "post_max_size=3G", "-d", "upload_max_filesize=3G"]);
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
$port = intval($port)?:80;
@@ -74,13 +74,13 @@ EOF
$data = str_repeat("0123456789", 10000);
for ($i = 0; $i < $length; $i += 10000 * 10) {
- fwrite($fp, $data) or die("write failed @ ($i)");
+ fwrite($fp, $data) or die("write failed @ ($i)");
}
fwrite($fp, $post) or die("write post failed");
while (!feof($fp)) {
- $output .= fgets($fp);
+ $output .= fgets($fp);
}
echo $output;
fclose($fp);
diff --git a/sapi/embed/php_embed.c b/sapi/embed/php_embed.c
index 4c7dec6dd0..1713534a23 100644
--- a/sapi/embed/php_embed.c
+++ b/sapi/embed/php_embed.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/embed/php_embed.h b/sapi/embed/php_embed.h
index 855872fed8..6280e4e8f8 100644
--- a/sapi/embed/php_embed.h
+++ b/sapi/embed/php_embed.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/fpm/config.m4 b/sapi/fpm/config.m4
index ad89c1bb52..f71fa710dd 100644
--- a/sapi/fpm/config.m4
+++ b/sapi/fpm/config.m4
@@ -660,7 +660,7 @@ if test "$PHP_FPM" != "no"; then
BUILD_FPM="\$(CC) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(NATIVE_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_BINARY_OBJS:.lo=.o) \$(PHP_FASTCGI_OBJS:.lo=.o) \$(PHP_FPM_OBJS:.lo=.o) \$(PHP_FRAMEWORKS) \$(EXTRA_LIBS) \$(FPM_EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_FPM_PATH)"
;;
*)
- BUILD_FPM="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) \$(PHP_BINARY_OBJS) \$(PHP_FASTCGI_OBJS) \$(PHP_FPM_OBJS) \$(EXTRA_LIBS) \$(FPM_EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_FPM_PATH)"
+ BUILD_FPM="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_BINARY_OBJS:.lo=.o) \$(PHP_FASTCGI_OBJS:.lo=.o) \$(PHP_FPM_OBJS:.lo=.o) \$(EXTRA_LIBS) \$(FPM_EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_FPM_PATH)"
;;
esac
diff --git a/sapi/fpm/fpm/events/devpoll.c b/sapi/fpm/fpm/events/devpoll.c
index 68cc8dd615..15afb2beda 100644
--- a/sapi/fpm/fpm/events/devpoll.c
+++ b/sapi/fpm/fpm/events/devpoll.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/fpm/fpm/events/devpoll.h b/sapi/fpm/fpm/events/devpoll.h
index d8ff66bf95..b05a456924 100644
--- a/sapi/fpm/fpm/events/devpoll.h
+++ b/sapi/fpm/fpm/events/devpoll.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/fpm/fpm/events/epoll.c b/sapi/fpm/fpm/events/epoll.c
index 4701339e78..b81c7fa59c 100644
--- a/sapi/fpm/fpm/events/epoll.c
+++ b/sapi/fpm/fpm/events/epoll.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/fpm/fpm/events/epoll.h b/sapi/fpm/fpm/events/epoll.h
index 783a2d25af..2469cbeaee 100644
--- a/sapi/fpm/fpm/events/epoll.h
+++ b/sapi/fpm/fpm/events/epoll.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/fpm/fpm/events/kqueue.c b/sapi/fpm/fpm/events/kqueue.c
index c5d1b4f003..42d70ecd6c 100644
--- a/sapi/fpm/fpm/events/kqueue.c
+++ b/sapi/fpm/fpm/events/kqueue.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/fpm/fpm/events/kqueue.h b/sapi/fpm/fpm/events/kqueue.h
index a09651b3b3..93db17fd7c 100644
--- a/sapi/fpm/fpm/events/kqueue.h
+++ b/sapi/fpm/fpm/events/kqueue.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/fpm/fpm/events/poll.c b/sapi/fpm/fpm/events/poll.c
index ced32d0215..ad18d0bdea 100644
--- a/sapi/fpm/fpm/events/poll.c
+++ b/sapi/fpm/fpm/events/poll.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -218,7 +216,7 @@ static int fpm_event_poll_add(struct fpm_event_s *ev) /* {{{ */
return 0;
}
- zlog(ZLOG_ERROR, "poll: not enought space to add event (fd=%d)", ev->fd);
+ zlog(ZLOG_ERROR, "poll: not enough space to add event (fd=%d)", ev->fd);
return -1;
}
/* }}} */
diff --git a/sapi/fpm/fpm/events/poll.h b/sapi/fpm/fpm/events/poll.h
index 1a89f31102..371ecf1604 100644
--- a/sapi/fpm/fpm/events/poll.h
+++ b/sapi/fpm/fpm/events/poll.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/fpm/fpm/events/port.c b/sapi/fpm/fpm/events/port.c
index 1ffcd20a0d..7887c8e61a 100644
--- a/sapi/fpm/fpm/events/port.c
+++ b/sapi/fpm/fpm/events/port.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/fpm/fpm/events/port.h b/sapi/fpm/fpm/events/port.h
index 7329b2dff5..ced1d05c82 100644
--- a/sapi/fpm/fpm/events/port.h
+++ b/sapi/fpm/fpm/events/port.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/fpm/fpm/events/select.c b/sapi/fpm/fpm/events/select.c
index d69ac7f5dd..23a5bb6d28 100644
--- a/sapi/fpm/fpm/events/select.c
+++ b/sapi/fpm/fpm/events/select.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/fpm/fpm/events/select.h b/sapi/fpm/fpm/events/select.h
index 3b8445537f..7fc6d017a3 100644
--- a/sapi/fpm/fpm/events/select.h
+++ b/sapi/fpm/fpm/events/select.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c
index 7a05286309..116b07fdff 100644
--- a/sapi/fpm/fpm/fpm_conf.c
+++ b/sapi/fpm/fpm/fpm_conf.c
@@ -899,7 +899,7 @@ static int fpm_conf_process_all_pools() /* {{{ */
for (i = 0; i < strlen(ping); i++) {
if (!isalnum(ping[i]) && ping[i] != '/' && ping[i] != '-' && ping[i] != '_' && ping[i] != '.' && ping[i] != '~') {
- zlog(ZLOG_ERROR, "[pool %s] the ping path '%s' must containt only the following characters '[alphanum]/_-.~'", wp->config->name, ping);
+ zlog(ZLOG_ERROR, "[pool %s] the ping path '%s' must contain only the following characters '[alphanum]/_-.~'", wp->config->name, ping);
return -1;
}
}
@@ -1538,7 +1538,7 @@ int fpm_conf_load_ini_file(char *filename) /* {{{ */
}
if (ini_recursion++ > 4) {
- zlog(ZLOG_ERROR, "failed to include more than 5 files recusively");
+ zlog(ZLOG_ERROR, "failed to include more than 5 files recursively");
close(fd);
return -1;
}
diff --git a/sapi/fpm/fpm/fpm_events.c b/sapi/fpm/fpm/fpm_events.c
index 86592050c6..35b0ef8bb0 100644
--- a/sapi/fpm/fpm/fpm_events.c
+++ b/sapi/fpm/fpm/fpm_events.c
@@ -83,7 +83,7 @@ static void fpm_got_signal(struct fpm_event_s *ev, short which, void *arg) /* {{
/* epoll_wait() may report signal fd before read events for a finished child
* in the same bunch of events. Prevent immediate free of the child structure
* and so the fpm_event_s instance. Otherwise use after free happens during
- * attemp to process following read event. */
+ * attempt to process following read event. */
fpm_event_set_timer(&children_bury_timer, 0, &fpm_postponed_children_bury, NULL);
fpm_event_add(&children_bury_timer, 0);
break;
diff --git a/sapi/fpm/fpm/fpm_log.c b/sapi/fpm/fpm/fpm_log.c
index a09e80a490..6f1e517a9f 100644
--- a/sapi/fpm/fpm/fpm_log.c
+++ b/sapi/fpm/fpm/fpm_log.c
@@ -310,7 +310,7 @@ int fpm_log_write(char *log_format) /* {{{ */
continue;
}
- /* test if enought char after the header name + ': ' */
+ /* test if enough char after the header name + ': ' */
if (h->header_len <= format_len + 2) {
h = (sapi_header_struct*)zend_llist_get_next_ex(&sapi_headers->headers, &pos);
continue;
diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c
index bc3c145ca0..3f1981ada2 100644
--- a/sapi/fpm/fpm/fpm_main.c
+++ b/sapi/fpm/fpm/fpm_main.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -245,7 +243,7 @@ static inline size_t sapi_cgibin_single_write(const char *str, uint32_t str_leng
{
ssize_t ret;
- /* sapi has started which means everyhting must be send through fcgi */
+ /* sapi has started which means everything must be send through fcgi */
if (fpm_is_running) {
fcgi_request *request = (fcgi_request*) SG(server_context);
ret = fcgi_write(request, FCGI_STDOUT, str, str_length);
@@ -735,7 +733,10 @@ static int sapi_cgi_activate(void) /* {{{ */
/* Load and activate user ini files in path starting from DOCUMENT_ROOT */
if (PG(user_ini_filename) && *PG(user_ini_filename)) {
- doc_root = FCGI_GETENV(request, "DOCUMENT_ROOT");
+ /* Prefer CONTEXT_DOCUMENT_ROOT if set */
+ doc_root = FCGI_GETENV(request, "CONTEXT_DOCUMENT_ROOT");
+ doc_root = doc_root ? doc_root : FCGI_GETENV(request, "DOCUMENT_ROOT");
+
/* DOCUMENT_ROOT should also be defined at this stage..but better check it anyway */
if (doc_root) {
doc_root_len = strlen(doc_root);
@@ -892,7 +893,7 @@ static int is_valid_path(const char *path)
initializes request_info structure
- specificly in this section we handle proper translations
+ specifically in this section we handle proper translations
for:
PATH_INFO
@@ -1467,7 +1468,7 @@ PHP_FUNCTION(fastcgi_finish_request) /* {{{ */
fcgi_request *request = (fcgi_request*) SG(server_context);
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!fcgi_is_closed(request)) {
@@ -1489,7 +1490,7 @@ PHP_FUNCTION(apache_request_headers) /* {{{ */
fcgi_request *request;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
array_init(return_value);
@@ -1503,7 +1504,7 @@ PHP_FUNCTION(apache_request_headers) /* {{{ */
PHP_FUNCTION(fpm_get_status) /* {{{ */
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (fpm_status_export_to_zval(return_value)) {
@@ -1911,7 +1912,7 @@ consult the installation file that came with this distribution, or visit \n\
}
/*
- * have to duplicate SG(request_info).path_translated to be able to log errrors
+ * have to duplicate SG(request_info).path_translated to be able to log errors
* php_fopen_primary_script seems to delete SG(request_info).path_translated on failure
*/
primary_script = estrdup(SG(request_info).path_translated);
diff --git a/sapi/fpm/fpm/fpm_signals.c b/sapi/fpm/fpm/fpm_signals.c
index d3214b3d16..f5a5ae5ec1 100644
--- a/sapi/fpm/fpm/fpm_signals.c
+++ b/sapi/fpm/fpm/fpm_signals.c
@@ -197,7 +197,7 @@ int fpm_signals_init_main() /* {{{ */
}
if (0 > fcntl(sp[0], F_SETFD, FD_CLOEXEC) || 0 > fcntl(sp[1], F_SETFD, FD_CLOEXEC)) {
- zlog(ZLOG_SYSERROR, "falied to init signals: fcntl(F_SETFD, FD_CLOEXEC)");
+ zlog(ZLOG_SYSERROR, "failed to init signals: fcntl(F_SETFD, FD_CLOEXEC)");
return -1;
}
diff --git a/sapi/fpm/tests/bug76601-reload-child-signals.phpt b/sapi/fpm/tests/bug76601-reload-child-signals.phpt
index b4e99b7e4a..f095ed667c 100644
--- a/sapi/fpm/tests/bug76601-reload-child-signals.phpt
+++ b/sapi/fpm/tests/bug76601-reload-child-signals.phpt
@@ -31,14 +31,14 @@ EOT;
/*
* If a child miss SIGQUIT then reload process should stuck
* for at least process_control_timeout that is set greater
- * than timout in log reading functions.
+ * than timeout in log reading functions.
*
* Alternative way is to set log_level=debug and filter result of
* $tester->getLogLines(2000) for lines containing SIGKILL
- *
+ *
* [22-Oct-2019 03:28:19.532703] DEBUG: pid 21315, fpm_pctl_kill_all(), line 161: [pool unconfined] sending signal 9 SIGKILL to child 21337
* [22-Oct-2019 03:28:19.533471] DEBUG: pid 21315, fpm_children_bury(), line 259: [pool unconfined] child 21337 exited on signal 9 (SIGKILL) after 1.003055 seconds from start
- *
+ *
* but it has less probability of failure detection. Additionally it requires more
* $tester->expectLogNotice() around last reload due to presence of debug messages.
*/
diff --git a/sapi/fpm/tests/fcgi.inc b/sapi/fpm/tests/fcgi.inc
index 721b94b504..0d16e5ba0b 100644
--- a/sapi/fpm/tests/fcgi.inc
+++ b/sapi/fpm/tests/fcgi.inc
@@ -485,7 +485,7 @@ class Client
}
/**
- * Execute a request to the FastCGI application asyncronously
+ * Execute a request to the FastCGI application asynchronously
*
* This sends request to application and returns the assigned ID for that request.
*
@@ -508,7 +508,7 @@ class Client
// Pick random number between 1 and max 16 bit unsigned int 65535
$id = mt_rand(1, (1 << 16) - 1);
- // Using persistent sockets implies you want them keept alive by server!
+ // Using persistent sockets implies you want them kept alive by server!
$keepAlive = intval($this->_keepAlive || $this->_persistentSocket);
$request = $this->buildPacket(
diff --git a/sapi/fpm/tests/getallheaders.phpt b/sapi/fpm/tests/getallheaders.phpt
index b1f9683788..90ecae3e44 100644
--- a/sapi/fpm/tests/getallheaders.phpt
+++ b/sapi/fpm/tests/getallheaders.phpt
@@ -31,27 +31,27 @@ $tester = new FPM\Tester($cfg, $code);
$tester->start();
$tester->expectLogStartNotices();
$tester->request(
- '',
- [
- 'HTTP_X_FOO' => 'BAR',
- 'HTTP_FOO' => 'foo'
- ]
- )->expectBody(
- [
- 'Test Start',
- 'array(4) {',
- ' ["Foo"]=>',
- ' string(3) "foo"',
- ' ["X-Foo"]=>',
- ' string(3) "BAR"',
- ' ["Content-Length"]=>',
- ' string(1) "0"',
- ' ["Content-Type"]=>',
- ' string(0) ""',
- '}',
- 'Test End',
- ]
- );
+ '',
+ [
+ 'HTTP_X_FOO' => 'BAR',
+ 'HTTP_FOO' => 'foo'
+ ]
+ )->expectBody(
+ [
+ 'Test Start',
+ 'array(4) {',
+ ' ["Foo"]=>',
+ ' string(3) "foo"',
+ ' ["X-Foo"]=>',
+ ' string(3) "BAR"',
+ ' ["Content-Length"]=>',
+ ' string(1) "0"',
+ ' ["Content-Type"]=>',
+ ' string(0) ""',
+ '}',
+ 'Test End',
+ ]
+ );
$tester->terminate();
$tester->expectLogTerminatingNotices();
$tester->close();
diff --git a/sapi/fpm/tests/response.inc b/sapi/fpm/tests/response.inc
index 54f85bcfb6..d6ee6c7afb 100644
--- a/sapi/fpm/tests/response.inc
+++ b/sapi/fpm/tests/response.inc
@@ -174,7 +174,7 @@ class Response
{
// check default headers
return (
- $this->checkHeader('X-Powered-By', '|^PHP/7|', true) &&
+ $this->checkHeader('X-Powered-By', '|^PHP/8|', true) &&
$this->checkHeader('Content-type', '|^' . $contentType . '(;\s?charset=\w+)?|', true)
);
}
diff --git a/sapi/fpm/tests/status-basic.phpt b/sapi/fpm/tests/status-basic.phpt
index 323592262f..245fc425ca 100644
--- a/sapi/fpm/tests/status-basic.phpt
+++ b/sapi/fpm/tests/status-basic.phpt
@@ -12,7 +12,7 @@ $cfg = <<<EOT
error_log = {{FILE:LOG}}
[unconfined]
listen = {{ADDR}}
-pm = static
+pm = static
pm.max_children = 1
pm.status_path = /status
EOT;
diff --git a/sapi/fpm/www.conf.in b/sapi/fpm/www.conf.in
index 169d19568c..815618c65d 100644
--- a/sapi/fpm/www.conf.in
+++ b/sapi/fpm/www.conf.in
@@ -70,7 +70,7 @@ listen = 127.0.0.1:9000
; process.priority = -19
; Set the process dumpable flag (PR_SET_DUMPABLE prctl) even if the process user
-; or group is differrent than the master process user. It allows to create process
+; or group is different than the master process user. It allows to create process
; core dump and ptrace the process for the pool user.
; Default Value: no
; process.dumpable = yes
@@ -139,7 +139,7 @@ pm.max_spare_servers = 3
;pm.max_requests = 500
; The URI to view the FPM status page. If this value is not set, no URI will be
-; recognized as a status page. It shows the following informations:
+; recognized as a status page. It shows the following information:
; pool - the name of the pool;
; process manager - static, dynamic or ondemand;
; start time - the date and time FPM has started;
@@ -269,13 +269,13 @@ pm.max_spare_servers = 3
; %d: time taken to serve the request
; it can accept the following format:
; - %{seconds}d (default)
-; - %{miliseconds}d
+; - %{milliseconds}d
; - %{mili}d
; - %{microseconds}d
; - %{micro}d
; %e: an environment variable (same as $_ENV or $_SERVER)
; it must be associated with embraces to specify the name of the env
-; variable. Some exemples:
+; variable. Some examples:
; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e
; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e
; %f: script filename
@@ -374,7 +374,7 @@ pm.max_spare_servers = 3
; Redirect worker stdout and stderr into main error log. If not set, stdout and
; stderr will be redirected to /dev/null according to FastCGI specs.
-; Note: on highloaded environement, this can cause some delay in the page
+; Note: on highloaded environment, this can cause some delay in the page
; process time (several ms).
; Default Value: no
;catch_workers_output = yes
diff --git a/sapi/fuzzer/Makefile.frag b/sapi/fuzzer/Makefile.frag
new file mode 100644
index 0000000000..57952a8ff4
--- /dev/null
+++ b/sapi/fuzzer/Makefile.frag
@@ -0,0 +1,18 @@
+fuzzer: $(PHP_FUZZER_BINARIES)
+
+FUZZER_BUILD = $(LIBTOOL) --mode=link $(FUZZING_CC) -export-dynamic $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(EXTRA_LDFLAGS_PROGRAM) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) $(PHP_BINARY_OBJS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) $(FUZZING_LIB) -rpath /ORIGIN/lib
+
+$(SAPI_FUZZER_PATH)/php-fuzz-parser: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(PHP_FUZZER_PARSER_OBJS)
+ $(FUZZER_BUILD) $(PHP_FUZZER_PARSER_OBJS) -o $@
+
+$(SAPI_FUZZER_PATH)/php-fuzz-unserialize: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(PHP_FUZZER_UNSERIALIZE_OBJS)
+ $(FUZZER_BUILD) $(PHP_FUZZER_UNSERIALIZE_OBJS) -o $@
+
+$(SAPI_FUZZER_PATH)/php-fuzz-json: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(PHP_FUZZER_JSON_OBJS)
+ $(FUZZER_BUILD) $(PHP_FUZZER_JSON_OBJS) -o $@
+
+$(SAPI_FUZZER_PATH)/php-fuzz-exif: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(PHP_FUZZER_EXIF_OBJS)
+ $(FUZZER_BUILD) $(PHP_FUZZER_EXIF_OBJS) -o $@
+
+$(SAPI_FUZZER_PATH)/php-fuzz-mbstring: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(PHP_FUZZER_MBSTRING_OBJS)
+ $(FUZZER_BUILD) $(PHP_FUZZER_MBSTRING_OBJS) -o $@
diff --git a/sapi/fuzzer/README.md b/sapi/fuzzer/README.md
new file mode 100644
index 0000000000..c753c23c30
--- /dev/null
+++ b/sapi/fuzzer/README.md
@@ -0,0 +1,66 @@
+Fuzzing SAPI for PHP
+--------------------
+
+The following `./configure` options can be used to enable the fuzzing SAPI, as well as all availablefuzzers. If you don't build the exif/json/mbstring extensions, fuzzers for these extensions will not be built.
+
+```sh
+./configure \
+ --enable-fuzzer \
+ --with-pic \
+ --enable-debug-assertions \
+ --enable-exif \
+ --enable-json \
+ --enable-mbstring
+```
+
+The `--with-pic` option is required to avoid a linking failure. The `--enable-debug-assertions` option can be used to enable debug assertions despite the use of a release build.
+
+You will need a recent version of clang that supports the `-fsanitize=fuzzer-no-link` option.
+
+When running `make` it creates these binaries in `sapi/fuzzer/`:
+
+* `php-fuzz-parser`: Fuzzing language parser and compiler
+* `php-fuzz-unserialize`: Fuzzing unserialize() function
+* `php-fuzz-json`: Fuzzing JSON parser (requires --enable-json)
+* `php-fuzz-exif`: Fuzzing `exif_read_data()` function (requires --enable-exif)
+* `php-fuzz-mbstring`: fuzzing `mb_ereg[i]()` (requires --enable-mbstring)
+
+Some fuzzers have a seed corpus in `sapi/fuzzer/corpus`. You can use it as follows:
+
+```sh
+cp -r sapi/fuzzer/corpus/exif ./my-exif-corpus
+sapi/fuzzer/php-fuzz-exif ./my-exif-corpus
+```
+
+For the unserialize fuzzer, a dictionary of internal classes should be generated first:
+
+```sh
+sapi/cli/php sapi/fuzzer/generate_unserialize_dict.php
+cp -r sapi/fuzzer/corpus/unserialize ./my-unserialize-corpus
+sapi/fuzzer/php-fuzz-unserialize -dict=$PWD/sapi/fuzzer/dict/unserialize ./my-unserialize-corpus
+```
+
+For the parser fuzzer, a corpus may be generated from Zend test files:
+
+```sh
+sapi/cli/php sapi/fuzzer/generate_parser_corpus.php
+mkdir ./my-parser-corpus
+sapi/fuzzer/php-fuzz-parser -merge=1 ./my-parser-corpus sapi/fuzzer/corpus/parser
+sapi/fuzzer/php-fuzz-parser -only_ascii=1 ./my-parser-corpus
+```
+
+For the mbstring fuzzer, you may want to build the libonig dependency with instrumentation. At this time, libonig is not clean under ubsan, so only the fuzzer and address sanitizers may be used.
+
+```sh
+git clone https://github.com/kkos/oniguruma.git
+pushd oniguruma
+autoreconf -vfi
+./configure CC=clang CFLAGS="-fsanitize=fuzzer-no-link,address -O2 -g"
+make
+popd
+
+export ONIG_CFLAGS="-I$PWD/oniguruma/src"
+export ONIG_LIBS="-L$PWD/oniguruma/src/.libs -l:libonig.a"
+```
+
+This will link an instrumented libonig statically into the PHP binary.
diff --git a/sapi/fuzzer/config.m4 b/sapi/fuzzer/config.m4
new file mode 100644
index 0000000000..37945b8e9e
--- /dev/null
+++ b/sapi/fuzzer/config.m4
@@ -0,0 +1,94 @@
+AC_MSG_CHECKING(for clang fuzzer SAPI)
+
+PHP_ARG_ENABLE([fuzzer],,
+ [AS_HELP_STRING([--enable-fuzzer],
+ [Build PHP as clang fuzzing test module (for developers)])],
+ [no],
+ [no])
+
+PHP_ARG_ENABLE([fuzzer-msan],,
+ [AS_HELP_STRING([--enable-fuzzer-msan],
+ [Enable msan instead of asan/ubsan when fuzzing])],
+ [no],
+ [no])
+
+dnl For newer clang versions see https://llvm.org/docs/LibFuzzer.html#fuzzer-usage
+dnl for relevant flags.
+
+dnl Macro to define fuzzing target
+dnl PHP_FUZZER_TARGET(name, target-var)
+dnl
+AC_DEFUN([PHP_FUZZER_TARGET], [
+ PHP_FUZZER_BINARIES="$PHP_FUZZER_BINARIES $SAPI_FUZZER_PATH/php-fuzz-$1"
+ PHP_SUBST($2)
+ PHP_ADD_SOURCES_X([sapi/fuzzer],[fuzzer-$1.c],[],$2)
+ $2="[$]$2 $FUZZER_COMMON_OBJS"
+])
+
+if test "$PHP_FUZZER" != "no"; then
+ AC_MSG_RESULT([yes])
+ dnl Don't use PHP_REQUIRE_CXX() to avoid unnecessarily pulling in -lstdc++
+ AC_PROG_CXX
+ AC_PROG_CXXCPP
+ PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/sapi/fuzzer/Makefile.frag)
+ SAPI_FUZZER_PATH=sapi/fuzzer
+ PHP_SUBST(SAPI_FUZZER_PATH)
+ if test -z "$LIB_FUZZING_ENGINE"; then
+ FUZZING_LIB="-fsanitize=fuzzer"
+ FUZZING_CC="$CC"
+ AX_CHECK_COMPILE_FLAG([-fsanitize=fuzzer-no-link], [
+ CFLAGS="$CFLAGS -fsanitize=fuzzer-no-link"
+ CXXFLAGS="$CXXFLAGS -fsanitize=fuzzer-no-link"
+
+ if test "$PHP_FUZZER_MSAN" = "yes"; then
+ CFLAGS="$CFLAGS -fsanitize=memory -fsanitize-memory-track-origins"
+ CXXFLAGS="$CXXFLAGS -fsanitize=memory -fsanitize-memory-track-origins"
+ else
+ CFLAGS="$CFLAGS -fsanitize=address"
+ CXXFLAGS="$CXXFLAGS -fsanitize=address"
+
+ dnl Don't include -fundefined in CXXFLAGS, because that would also require linking
+ dnl with a C++ compiler.
+ dnl Disable object-size sanitizer, because it is incompatible with our zend_function
+ dnl union, and this can't be easily fixed.
+ dnl We need to specify -fno-sanitize-recover=undefined here, otherwise ubsan warnings
+ dnl will not be considered failures by the fuzzer.
+ CFLAGS="$CFLAGS -fsanitize=undefined -fno-sanitize=object-size -fno-sanitize-recover=undefined"
+ fi
+ ],[
+ AC_MSG_ERROR(Compiler doesn't support -fsanitize=fuzzer-no-link)
+ ])
+ else
+ FUZZING_LIB="$LIB_FUZZING_ENGINE"
+ FUZZING_CC="$CXX -stdlib=libc++"
+ fi
+ PHP_SUBST(FUZZING_LIB)
+ PHP_SUBST(FUZZING_CC)
+
+ dnl PHP_SELECT_SAPI(fuzzer-parser, program, $FUZZER_SOURCES, , '$(SAPI_FUZZER_PATH)')
+
+ PHP_ADD_BUILD_DIR([sapi/fuzzer])
+ PHP_FUZZER_BINARIES=""
+ PHP_BINARIES="$PHP_BINARIES fuzzer"
+ PHP_INSTALLED_SAPIS="$PHP_INSTALLED_SAPIS fuzzer"
+
+ PHP_ADD_SOURCES_X([sapi/fuzzer], [fuzzer-sapi.c], [], FUZZER_COMMON_OBJS)
+
+ PHP_FUZZER_TARGET([parser], PHP_FUZZER_PARSER_OBJS)
+ PHP_FUZZER_TARGET([unserialize], PHP_FUZZER_UNSERIALIZE_OBJS)
+
+ dnl json extension is enabled by default
+ if (test -n "$enable_json" && test "$enable_json" != "no") || test -z "$PHP_ENABLE_ALL"; then
+ PHP_FUZZER_TARGET([json], PHP_FUZZER_JSON_OBJS)
+ fi
+ if test -n "$enable_exif" && test "$enable_exif" != "no"; then
+ PHP_FUZZER_TARGET([exif], PHP_FUZZER_EXIF_OBJS)
+ fi
+ if test -n "$enable_mbstring" && test "$enable_mbstring" != "no"; then
+ PHP_FUZZER_TARGET([mbstring], PHP_FUZZER_MBSTRING_OBJS)
+ fi
+
+ PHP_SUBST(PHP_FUZZER_BINARIES)
+fi
+
+AC_MSG_RESULT($PHP_FUZZER)
diff --git a/sapi/fuzzer/corpus/exif/bug34704.jpg b/sapi/fuzzer/corpus/exif/bug34704.jpg
new file mode 100644
index 0000000000..42b14c1908
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug34704.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug34704_2.jpg b/sapi/fuzzer/corpus/exif/bug34704_2.jpg
new file mode 100644
index 0000000000..42b14c1908
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug34704_2.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug48378.jpeg b/sapi/fuzzer/corpus/exif/bug48378.jpeg
new file mode 100644
index 0000000000..759d805709
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug48378.jpeg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug54002_1.jpeg b/sapi/fuzzer/corpus/exif/bug54002_1.jpeg
new file mode 100644
index 0000000000..a622d6d213
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug54002_1.jpeg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug54002_2.jpeg b/sapi/fuzzer/corpus/exif/bug54002_2.jpeg
new file mode 100644
index 0000000000..a622d6d213
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug54002_2.jpeg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug62523_1.jpg b/sapi/fuzzer/corpus/exif/bug62523_1.jpg
new file mode 100644
index 0000000000..9a63d1e84d
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug62523_1.jpg
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
+<html><head>
+<title>301 Moved Permanently</title>
+</head><body>
+<h1>Moved Permanently</h1>
+<p>The document has moved <a href="http://www.getid3.org/temp/62523.jpg">here</a>.</p>
+<hr>
+<address>Apache Server at getid3.org Port 80</address>
+</body></html>
diff --git a/sapi/fuzzer/corpus/exif/bug62523_3.jpg b/sapi/fuzzer/corpus/exif/bug62523_3.jpg
new file mode 100644
index 0000000000..3ee91368ce
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug62523_3.jpg
@@ -0,0 +1,12 @@
+<html>
+ <head><title>Found</title></head>
+ <body>
+ <h1>Found</h1>
+ <p>The resource was found at <a href="http://dl.dropboxusercontent.com/u/7562584/Bugs/Php/bad_exif.jpeg">http://dl.dropboxusercontent.com/u/7562584/Bugs/Php/bad_exif.jpeg</a>;
+you should be redirected automatically.
+
+<!-- --></p>
+ <hr noshade>
+ <div align="right">WSGI Server</div>
+ </body>
+</html>
diff --git a/sapi/fuzzer/corpus/exif/bug68113.jpg b/sapi/fuzzer/corpus/exif/bug68113.jpg
new file mode 100644
index 0000000000..3ce7a620fb
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug68113.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug68113_2.jpg b/sapi/fuzzer/corpus/exif/bug68113_2.jpg
new file mode 100644
index 0000000000..3ce7a620fb
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug68113_2.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug68799.jpg b/sapi/fuzzer/corpus/exif/bug68799.jpg
new file mode 100644
index 0000000000..acc326dbbf
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug68799.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug72094_1.jpg b/sapi/fuzzer/corpus/exif/bug72094_1.jpg
new file mode 100644
index 0000000000..d21382b44b
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug72094_1.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug72094_2.jpg b/sapi/fuzzer/corpus/exif/bug72094_2.jpg
new file mode 100644
index 0000000000..ec414ce02b
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug72094_2.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug72094_3.jpg b/sapi/fuzzer/corpus/exif/bug72094_3.jpg
new file mode 100644
index 0000000000..8b05314b67
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug72094_3.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug72094_4.jpg b/sapi/fuzzer/corpus/exif/bug72094_4.jpg
new file mode 100644
index 0000000000..ca6d453c2c
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug72094_4.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug72603.jpeg b/sapi/fuzzer/corpus/exif/bug72603.jpeg
new file mode 100644
index 0000000000..1764c805fb
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug72603.jpeg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug72618.jpg b/sapi/fuzzer/corpus/exif/bug72618.jpg
new file mode 100644
index 0000000000..0a61ae2e02
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug72618.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug72627.tiff b/sapi/fuzzer/corpus/exif/bug72627.tiff
new file mode 100644
index 0000000000..229190a604
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug72627.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug73737.tiff b/sapi/fuzzer/corpus/exif/bug73737.tiff
new file mode 100644
index 0000000000..2cb036fc47
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug73737.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug76130_1.jpg b/sapi/fuzzer/corpus/exif/bug76130_1.jpg
new file mode 100644
index 0000000000..e063e46d22
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug76130_1.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug76130_2.jpg b/sapi/fuzzer/corpus/exif/bug76130_2.jpg
new file mode 100644
index 0000000000..a9e79dca5c
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug76130_2.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug76423.jpg b/sapi/fuzzer/corpus/exif/bug76423.jpg
new file mode 100644
index 0000000000..08fe2bbc57
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug76423.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug76557.jpg b/sapi/fuzzer/corpus/exif/bug76557.jpg
new file mode 100644
index 0000000000..d678f07c0f
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug76557.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug77540.jpg b/sapi/fuzzer/corpus/exif/bug77540.jpg
new file mode 100644
index 0000000000..559022db0e
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug77540.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug77563.jpg b/sapi/fuzzer/corpus/exif/bug77563.jpg
new file mode 100644
index 0000000000..d6280151f0
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug77563.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug77753.tiff b/sapi/fuzzer/corpus/exif/bug77753.tiff
new file mode 100644
index 0000000000..b237f39e2b
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug77753.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug77831.tiff b/sapi/fuzzer/corpus/exif/bug77831.tiff
new file mode 100644
index 0000000000..c7e9f4472b
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug77831.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug77950.tiff b/sapi/fuzzer/corpus/exif/bug77950.tiff
new file mode 100644
index 0000000000..5c8250ab04
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug77950.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/bug77988.jpg b/sapi/fuzzer/corpus/exif/bug77988.jpg
new file mode 100644
index 0000000000..120ff8565a
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/bug77988.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/duplicate_copyright_tag_leak.tiff b/sapi/fuzzer/corpus/exif/duplicate_copyright_tag_leak.tiff
new file mode 100644
index 0000000000..48c7fe61ff
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/duplicate_copyright_tag_leak.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/exif_encoding_crash.jpg b/sapi/fuzzer/corpus/exif/exif_encoding_crash.jpg
new file mode 100644
index 0000000000..55138abe55
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/exif_encoding_crash.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image007.jpg b/sapi/fuzzer/corpus/exif/image007.jpg
new file mode 100644
index 0000000000..852654075a
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image007.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image008.jpg b/sapi/fuzzer/corpus/exif/image008.jpg
new file mode 100644
index 0000000000..3e8bfe4512
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image008.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image009.jpg b/sapi/fuzzer/corpus/exif/image009.jpg
new file mode 100644
index 0000000000..8803ddccd4
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image009.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image010.jpg b/sapi/fuzzer/corpus/exif/image010.jpg
new file mode 100644
index 0000000000..31ed6d678d
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image010.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image011.jpg b/sapi/fuzzer/corpus/exif/image011.jpg
new file mode 100644
index 0000000000..fcd5783ec7
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image011.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image012.jpg b/sapi/fuzzer/corpus/exif/image012.jpg
new file mode 100644
index 0000000000..dd25e06181
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image012.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image013.jpg b/sapi/fuzzer/corpus/exif/image013.jpg
new file mode 100644
index 0000000000..93ded26667
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image013.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image014.jpg b/sapi/fuzzer/corpus/exif/image014.jpg
new file mode 100644
index 0000000000..7657a0a4c7
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image014.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image015.jpg b/sapi/fuzzer/corpus/exif/image015.jpg
new file mode 100644
index 0000000000..6f52dec4d7
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image015.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image016.tiff b/sapi/fuzzer/corpus/exif/image016.tiff
new file mode 100644
index 0000000000..1712113933
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image016.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image017.tiff b/sapi/fuzzer/corpus/exif/image017.tiff
new file mode 100644
index 0000000000..89800d8796
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image017.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image018.tiff b/sapi/fuzzer/corpus/exif/image018.tiff
new file mode 100644
index 0000000000..6b4492f7cd
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image018.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image020.tiff b/sapi/fuzzer/corpus/exif/image020.tiff
new file mode 100644
index 0000000000..87f187821a
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image020.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image021.tiff b/sapi/fuzzer/corpus/exif/image021.tiff
new file mode 100644
index 0000000000..190f30b93a
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image021.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image022.tiff b/sapi/fuzzer/corpus/exif/image022.tiff
new file mode 100644
index 0000000000..88f4373341
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image022.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image023.tiff b/sapi/fuzzer/corpus/exif/image023.tiff
new file mode 100644
index 0000000000..dc33f6ed90
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image023.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image024.jpg b/sapi/fuzzer/corpus/exif/image024.jpg
new file mode 100644
index 0000000000..0b5a42e894
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image024.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image025.jpg b/sapi/fuzzer/corpus/exif/image025.jpg
new file mode 100644
index 0000000000..a5c0e17c7a
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image025.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image026.tiff b/sapi/fuzzer/corpus/exif/image026.tiff
new file mode 100644
index 0000000000..8fdafc738f
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image026.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/image027.tiff b/sapi/fuzzer/corpus/exif/image027.tiff
new file mode 100644
index 0000000000..7c3a37a90a
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/image027.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/tag_with_illegal_zero_components.jpeg b/sapi/fuzzer/corpus/exif/tag_with_illegal_zero_components.jpeg
new file mode 100644
index 0000000000..c000b938df
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/tag_with_illegal_zero_components.jpeg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/temporary_buffer_leak.jpg b/sapi/fuzzer/corpus/exif/temporary_buffer_leak.jpg
new file mode 100644
index 0000000000..c9f7ce821f
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/temporary_buffer_leak.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/test1.jpg b/sapi/fuzzer/corpus/exif/test1.jpg
new file mode 100644
index 0000000000..121decb65a
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/test1.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/test2.jpg b/sapi/fuzzer/corpus/exif/test2.jpg
new file mode 100644
index 0000000000..f60ecded6f
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/test2.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/test22.jpg b/sapi/fuzzer/corpus/exif/test22.jpg
new file mode 100644
index 0000000000..f60ecded6f
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/test22.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/test3.jpg b/sapi/fuzzer/corpus/exif/test3.jpg
new file mode 100644
index 0000000000..7547a16630
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/test3.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/test4.jpg b/sapi/fuzzer/corpus/exif/test4.jpg
new file mode 100644
index 0000000000..8a23a7b658
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/test4.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/test5.jpg b/sapi/fuzzer/corpus/exif/test5.jpg
new file mode 100644
index 0000000000..d03cac18a3
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/test5.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/test6.jpg b/sapi/fuzzer/corpus/exif/test6.jpg
new file mode 100644
index 0000000000..073cefdfe0
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/test6.jpg
Binary files differ
diff --git a/sapi/fuzzer/corpus/exif/zero_length_makernote_leak.tiff b/sapi/fuzzer/corpus/exif/zero_length_makernote_leak.tiff
new file mode 100644
index 0000000000..f1541b39b6
--- /dev/null
+++ b/sapi/fuzzer/corpus/exif/zero_length_makernote_leak.tiff
Binary files differ
diff --git a/sapi/fuzzer/corpus/json/1.json b/sapi/fuzzer/corpus/json/1.json
new file mode 100644
index 0000000000..8161287aab
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/1.json
@@ -0,0 +1 @@
+{"prop":{"prop":null}}
diff --git a/sapi/fuzzer/corpus/json/10.json b/sapi/fuzzer/corpus/json/10.json
new file mode 100644
index 0000000000..59483c2539
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/10.json
@@ -0,0 +1 @@
+{"a":100.1,"b":"foo"}
diff --git a/sapi/fuzzer/corpus/json/11.json b/sapi/fuzzer/corpus/json/11.json
new file mode 100644
index 0000000000..e3907a414c
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/11.json
@@ -0,0 +1 @@
+[100.1,"bar"]
diff --git a/sapi/fuzzer/corpus/json/12.json b/sapi/fuzzer/corpus/json/12.json
new file mode 100644
index 0000000000..222a6678f9
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/12.json
@@ -0,0 +1,2 @@
+{"0":0,"\u0000ab":1,"1":"\u0000null-prefixed value"}
+
diff --git a/sapi/fuzzer/corpus/json/13.json b/sapi/fuzzer/corpus/json/13.json
new file mode 100644
index 0000000000..b9c504cdbe
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/13.json
@@ -0,0 +1 @@
+{ "test": { "foo": "bar" } }
diff --git a/sapi/fuzzer/corpus/json/14.json b/sapi/fuzzer/corpus/json/14.json
new file mode 100644
index 0000000000..0014681471
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/14.json
@@ -0,0 +1,2 @@
+"aa\udbff\udffdzz"
+
diff --git a/sapi/fuzzer/corpus/json/15.json b/sapi/fuzzer/corpus/json/15.json
new file mode 100644
index 0000000000..92591f81a3
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/15.json
@@ -0,0 +1 @@
+"latin 1234 -\/ russian мама мыла раму specialchars \u0002 \b \n U+1D11E >ð„ž<"
diff --git a/sapi/fuzzer/corpus/json/16.json b/sapi/fuzzer/corpus/json/16.json
new file mode 100644
index 0000000000..2129292029
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/16.json
@@ -0,0 +1 @@
+{"test":"123343e871700"}
diff --git a/sapi/fuzzer/corpus/json/17.json b/sapi/fuzzer/corpus/json/17.json
new file mode 100644
index 0000000000..4e4676b299
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/17.json
@@ -0,0 +1 @@
+[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
diff --git a/sapi/fuzzer/corpus/json/18.json b/sapi/fuzzer/corpus/json/18.json
new file mode 100644
index 0000000000..81873afdec
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/18.json
@@ -0,0 +1 @@
+{"myInt":99,"myFloat":123.45,"myNull":null,"myBool":true,"myString":"Hello World"}
diff --git a/sapi/fuzzer/corpus/json/19.json b/sapi/fuzzer/corpus/json/19.json
new file mode 100644
index 0000000000..cc33c95a71
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/19.json
@@ -0,0 +1 @@
+"\u65e5\u672c\u8a9e\u30c6\u30ad\u30b9\u30c8\u3067\u3059\u300201234\uff15\uff16\uff17\uff18\uff19\u3002"
diff --git a/sapi/fuzzer/corpus/json/2.json b/sapi/fuzzer/corpus/json/2.json
new file mode 100644
index 0000000000..3a9a9722e2
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/2.json
@@ -0,0 +1 @@
+{"largenum":123456789012345678901234567890}
diff --git a/sapi/fuzzer/corpus/json/3.json b/sapi/fuzzer/corpus/json/3.json
new file mode 100644
index 0000000000..b004f2079d
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/3.json
@@ -0,0 +1 @@
+["<foo>","'bar'","\"baz\"","&blong&"]
diff --git a/sapi/fuzzer/corpus/json/4.json b/sapi/fuzzer/corpus/json/4.json
new file mode 100644
index 0000000000..8e73a26dab
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/4.json
@@ -0,0 +1 @@
+["\u003Cfoo\u003E","\u0027bar\u0027","\u0022baz\u0022","\u0026blong\u0026"]
diff --git a/sapi/fuzzer/corpus/json/5.json b/sapi/fuzzer/corpus/json/5.json
new file mode 100644
index 0000000000..5c7912450d
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/5.json
@@ -0,0 +1,5 @@
+[
+{"":"value"},
+{"":"value", "key":"value"},
+{"key":"value", "":"value"}
+]
diff --git a/sapi/fuzzer/corpus/json/6.json b/sapi/fuzzer/corpus/json/6.json
new file mode 100644
index 0000000000..2d852843f1
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/6.json
@@ -0,0 +1 @@
+[123,13452345,123.13452345]
diff --git a/sapi/fuzzer/corpus/json/7.json b/sapi/fuzzer/corpus/json/7.json
new file mode 100644
index 0000000000..6e74debaf0
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/7.json
@@ -0,0 +1,2 @@
+["\ud834\udd00"]
+
diff --git a/sapi/fuzzer/corpus/json/8.json b/sapi/fuzzer/corpus/json/8.json
new file mode 100644
index 0000000000..7ea60c3af9
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/8.json
@@ -0,0 +1 @@
+{"zero": 0e0}
diff --git a/sapi/fuzzer/corpus/json/9.json b/sapi/fuzzer/corpus/json/9.json
new file mode 100644
index 0000000000..49e7327986
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/9.json
@@ -0,0 +1 @@
+[null,null,"abc"]
diff --git a/sapi/fuzzer/corpus/json/fail1.json b/sapi/fuzzer/corpus/json/fail1.json
new file mode 100644
index 0000000000..6216b865f1
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail1.json
@@ -0,0 +1 @@
+"A JSON payload should be an object or array, not a string." \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail10.json b/sapi/fuzzer/corpus/json/fail10.json
new file mode 100644
index 0000000000..5d8c0047bd
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail10.json
@@ -0,0 +1 @@
+{"Extra value after close": true} "misplaced quoted value" \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail11.json b/sapi/fuzzer/corpus/json/fail11.json
new file mode 100644
index 0000000000..76eb95b458
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail11.json
@@ -0,0 +1 @@
+{"Illegal expression": 1 + 2} \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail12.json b/sapi/fuzzer/corpus/json/fail12.json
new file mode 100644
index 0000000000..77580a4522
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail12.json
@@ -0,0 +1 @@
+{"Illegal invocation": alert()} \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail13.json b/sapi/fuzzer/corpus/json/fail13.json
new file mode 100644
index 0000000000..379406b59b
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail13.json
@@ -0,0 +1 @@
+{"Numbers cannot have leading zeroes": 013} \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail14.json b/sapi/fuzzer/corpus/json/fail14.json
new file mode 100644
index 0000000000..0ed366b38a
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail14.json
@@ -0,0 +1 @@
+{"Numbers cannot be hex": 0x14} \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail15.json b/sapi/fuzzer/corpus/json/fail15.json
new file mode 100644
index 0000000000..fc8376b605
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail15.json
@@ -0,0 +1 @@
+["Illegal backslash escape: \x15"] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail16.json b/sapi/fuzzer/corpus/json/fail16.json
new file mode 100644
index 0000000000..3fe21d4b53
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail16.json
@@ -0,0 +1 @@
+[\naked] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail17.json b/sapi/fuzzer/corpus/json/fail17.json
new file mode 100644
index 0000000000..62b9214aed
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail17.json
@@ -0,0 +1 @@
+["Illegal backslash escape: \017"] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail18.json b/sapi/fuzzer/corpus/json/fail18.json
new file mode 100644
index 0000000000..edac92716f
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail18.json
@@ -0,0 +1 @@
+[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail19.json b/sapi/fuzzer/corpus/json/fail19.json
new file mode 100644
index 0000000000..3b9c46fa9a
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail19.json
@@ -0,0 +1 @@
+{"Missing colon" null} \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail2.json b/sapi/fuzzer/corpus/json/fail2.json
new file mode 100644
index 0000000000..6b7c11e5a5
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail2.json
@@ -0,0 +1 @@
+["Unclosed array" \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail20.json b/sapi/fuzzer/corpus/json/fail20.json
new file mode 100644
index 0000000000..27c1af3e72
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail20.json
@@ -0,0 +1 @@
+{"Double colon":: null} \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail21.json b/sapi/fuzzer/corpus/json/fail21.json
new file mode 100644
index 0000000000..62474573b2
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail21.json
@@ -0,0 +1 @@
+{"Comma instead of colon", null} \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail22.json b/sapi/fuzzer/corpus/json/fail22.json
new file mode 100644
index 0000000000..a7752581bc
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail22.json
@@ -0,0 +1 @@
+["Colon instead of comma": false] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail23.json b/sapi/fuzzer/corpus/json/fail23.json
new file mode 100644
index 0000000000..494add1ca1
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail23.json
@@ -0,0 +1 @@
+["Bad value", truth] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail24.json b/sapi/fuzzer/corpus/json/fail24.json
new file mode 100644
index 0000000000..caff239bfc
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail24.json
@@ -0,0 +1 @@
+['single quote'] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail25.json b/sapi/fuzzer/corpus/json/fail25.json
new file mode 100644
index 0000000000..8b7ad23e01
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail25.json
@@ -0,0 +1 @@
+[" tab character in string "] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail26.json b/sapi/fuzzer/corpus/json/fail26.json
new file mode 100644
index 0000000000..845d26a6a5
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail26.json
@@ -0,0 +1 @@
+["tab\ character\ in\ string\ "] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail27.json b/sapi/fuzzer/corpus/json/fail27.json
new file mode 100644
index 0000000000..6b01a2ca4a
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail27.json
@@ -0,0 +1,2 @@
+["line
+break"] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail28.json b/sapi/fuzzer/corpus/json/fail28.json
new file mode 100644
index 0000000000..621a0101c6
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail28.json
@@ -0,0 +1,2 @@
+["line\
+break"] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail29.json b/sapi/fuzzer/corpus/json/fail29.json
new file mode 100644
index 0000000000..47ec421bb6
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail29.json
@@ -0,0 +1 @@
+[0e] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail3.json b/sapi/fuzzer/corpus/json/fail3.json
new file mode 100644
index 0000000000..168c81eb78
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail3.json
@@ -0,0 +1 @@
+{unquoted_key: "keys must be quoted"} \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail30.json b/sapi/fuzzer/corpus/json/fail30.json
new file mode 100644
index 0000000000..8ab0bc4b8b
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail30.json
@@ -0,0 +1 @@
+[0e+] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail31.json b/sapi/fuzzer/corpus/json/fail31.json
new file mode 100644
index 0000000000..1cce602b51
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail31.json
@@ -0,0 +1 @@
+[0e+-1] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail32.json b/sapi/fuzzer/corpus/json/fail32.json
new file mode 100644
index 0000000000..45cba7396f
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail32.json
@@ -0,0 +1 @@
+{"Comma instead if closing brace": true, \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail33.json b/sapi/fuzzer/corpus/json/fail33.json
new file mode 100644
index 0000000000..ca5eb19dc9
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail33.json
@@ -0,0 +1 @@
+["mismatch"} \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail4.json b/sapi/fuzzer/corpus/json/fail4.json
new file mode 100644
index 0000000000..9de168bf34
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail4.json
@@ -0,0 +1 @@
+["extra comma",] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail5.json b/sapi/fuzzer/corpus/json/fail5.json
new file mode 100644
index 0000000000..ddf3ce3d24
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail5.json
@@ -0,0 +1 @@
+["double extra comma",,] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail6.json b/sapi/fuzzer/corpus/json/fail6.json
new file mode 100644
index 0000000000..ed91580e1b
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail6.json
@@ -0,0 +1 @@
+[ , "<-- missing value"] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail7.json b/sapi/fuzzer/corpus/json/fail7.json
new file mode 100644
index 0000000000..8a96af3e4e
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail7.json
@@ -0,0 +1 @@
+["Comma after the close"], \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail8.json b/sapi/fuzzer/corpus/json/fail8.json
new file mode 100644
index 0000000000..b28479c6ec
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail8.json
@@ -0,0 +1 @@
+["Extra close"]] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/fail9.json b/sapi/fuzzer/corpus/json/fail9.json
new file mode 100644
index 0000000000..5815574f36
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/fail9.json
@@ -0,0 +1 @@
+{"Extra comma": true,} \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/pass1.json b/sapi/fuzzer/corpus/json/pass1.json
new file mode 100644
index 0000000000..70e2685436
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/pass1.json
@@ -0,0 +1,58 @@
+[
+ "JSON Test Pattern pass1",
+ {"object with 1 member":["array with 1 element"]},
+ {},
+ [],
+ -42,
+ true,
+ false,
+ null,
+ {
+ "integer": 1234567890,
+ "real": -9876.543210,
+ "e": 0.123456789e-12,
+ "E": 1.234567890E+34,
+ "": 23456789012E66,
+ "zero": 0,
+ "one": 1,
+ "space": " ",
+ "quote": "\"",
+ "backslash": "\\",
+ "controls": "\b\f\n\r\t",
+ "slash": "/ & \/",
+ "alpha": "abcdefghijklmnopqrstuvwyz",
+ "ALPHA": "ABCDEFGHIJKLMNOPQRSTUVWYZ",
+ "digit": "0123456789",
+ "0123456789": "digit",
+ "special": "`1~!@#$%^&*()_+-={':[,]}|;.</>?",
+ "hex": "\u0123\u4567\u89AB\uCDEF\uabcd\uef4A",
+ "true": true,
+ "false": false,
+ "null": null,
+ "array":[ ],
+ "object":{ },
+ "address": "50 St. James Street",
+ "url": "http://www.JSON.org/",
+ "comment": "// /* <!-- --",
+ "# -- --> */": " ",
+ " s p a c e d " :[1,2 , 3
+
+,
+
+4 , 5 , 6 ,7 ],"compact":[1,2,3,4,5,6,7],
+ "jsontext": "{\"object with 1 member\":[\"array with 1 element\"]}",
+ "quotes": "&#34; \u0022 %22 0x22 034 &#x22;",
+ "\/\\\"\uCAFE\uBABE\uAB98\uFCDE\ubcda\uef4A\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',./<>?"
+: "A key can be any string"
+ },
+ 0.5 ,98.6
+,
+99.44
+,
+
+1066,
+1e1,
+0.1e1,
+1e-1,
+1e00,2e+00,2e-00
+,"rosebud"] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/pass2.json b/sapi/fuzzer/corpus/json/pass2.json
new file mode 100644
index 0000000000..d3c63c7ad8
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/pass2.json
@@ -0,0 +1 @@
+[[[[[[[[[[[[[[[[[[["Not too deep"]]]]]]]]]]]]]]]]]]] \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/json/pass3.json b/sapi/fuzzer/corpus/json/pass3.json
new file mode 100644
index 0000000000..4528d51f1a
--- /dev/null
+++ b/sapi/fuzzer/corpus/json/pass3.json
@@ -0,0 +1,6 @@
+{
+ "JSON Test Pattern pass3": {
+ "The outermost value": "must be an object or array.",
+ "In this test": "It is an object."
+ }
+}
diff --git a/sapi/fuzzer/corpus/unserialize/__serialize_007 b/sapi/fuzzer/corpus/unserialize/__serialize_007
new file mode 100644
index 0000000000..6709aca303
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/__serialize_007
@@ -0,0 +1 @@
+O:13:"ArrayIterator":2:{i:0;i:0;s:1:"x";R:2;}
diff --git a/sapi/fuzzer/corpus/unserialize/bug7131 b/sapi/fuzzer/corpus/unserialize/bug7131
new file mode 100644
index 0000000000..1ba49d8da1
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/bug7131
@@ -0,0 +1 @@
+C:11:"ArrayObject":11:{x:i:0;r:3;X} \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/unserialize/bug71313 b/sapi/fuzzer/corpus/unserialize/bug71313
new file mode 100644
index 0000000000..4163b0350a
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/bug71313
@@ -0,0 +1 @@
+C:16:"SplObjectStorage":113:{x:i:2;O:8:"stdClass":0:{},a:2:{s:4:"prev";i:2;s:4:"next";O:8:"stdClass":0:{}};r:7;,R:2;s:4:"next";;r:3;};m:a:0:{}} \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/unserialize/bug73144_1 b/sapi/fuzzer/corpus/unserialize/bug73144_1
new file mode 100644
index 0000000000..0d6d600520
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/bug73144_1
@@ -0,0 +1 @@
+a:2:{i:0;O:1:"0":2:0s:1:"0";i:0;s:1:"0";a:1:{i:0;C:11:"ArrayObject":7:{x:i:0;r}
diff --git a/sapi/fuzzer/corpus/unserialize/bug73144_2 b/sapi/fuzzer/corpus/unserialize/bug73144_2
new file mode 100644
index 0000000000..d1145066c5
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/bug73144_2
@@ -0,0 +1 @@
+C:11:"ArrayObject":34:{x:i:1;O:8:"stdClass":1:{};m:a:0:{}} \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/unserialize/bug73825 b/sapi/fuzzer/corpus/unserialize/bug73825
new file mode 100644
index 0000000000..dc9b0e4334
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/bug73825
@@ -0,0 +1 @@
+O:8:"00000000":
diff --git a/sapi/fuzzer/corpus/unserialize/bug74101 b/sapi/fuzzer/corpus/unserialize/bug74101
new file mode 100644
index 0000000000..b8d2fd2308
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/bug74101
@@ -0,0 +1 @@
+O:9:"Exception":799999999999999999999999999997:0i:0;a:0:{}i:2;i:0;i:0;R:2;
diff --git a/sapi/fuzzer/corpus/unserialize/bug74103 b/sapi/fuzzer/corpus/unserialize/bug74103
new file mode 100644
index 0000000000..ab2f70239c
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/bug74103
@@ -0,0 +1 @@
+a:7:{i:0;i:04;s:1:"a";i:2;i:9617006;i:4;s:1:"a";i:4;s:1:"a";R:5;s:1:"7";R:3;s:1:"a";R:5;;s:18;}}
diff --git a/sapi/fuzzer/corpus/unserialize/bug74111 b/sapi/fuzzer/corpus/unserialize/bug74111
new file mode 100644
index 0000000000..c1196ee7de
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/bug74111
@@ -0,0 +1 @@
+O:8:"stdClass":00000000
diff --git a/sapi/fuzzer/corpus/unserialize/bug74614 b/sapi/fuzzer/corpus/unserialize/bug74614
new file mode 100644
index 0000000000..c7174893fe
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/bug74614
@@ -0,0 +1 @@
+a:3020000000000000000000000000000001:{i:0;a:0:{}i:1;i:2;i:2;i:3;i:3;i:4;i:4;i:5;i:5;i:6;i:6;i:7;i:7;i:8;i:8;R:2;}
diff --git a/sapi/fuzzer/corpus/unserialize/bug75054 b/sapi/fuzzer/corpus/unserialize/bug75054
new file mode 100644
index 0000000000..866e5b8fca
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/bug75054
@@ -0,0 +1 @@
+a:9:{i:0;s:4:"0000";i:0;s:4:"0000";i:0;R:2;s:4:"5003";R:2;s:4:"0000";R:2;s:4:"0000";R:2;s:4:"000";R:2;s:4:"0000";d:0;s:4:"0000";a:9:{s:4:"0000"; \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/unserialize/int_min_iv b/sapi/fuzzer/corpus/unserialize/int_min_iv
new file mode 100644
index 0000000000..6900dce088
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/int_min_iv
@@ -0,0 +1 @@
+i:-9223372036854775808;
diff --git a/sapi/fuzzer/corpus/unserialize/leak_17628 b/sapi/fuzzer/corpus/unserialize/leak_17628
new file mode 100644
index 0000000000..45fd8644db
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/leak_17628
@@ -0,0 +1 @@
+a:2:{i:0;O:19:"SplDoublyLinkedList":8:i:0;i:04;i:965556;a:6:{i:0;R:04;S:1:"a";i:2;i:961;a:8:{i:0;i:04;i:0;i:0026;i:0;a:2:{i:0;O:13:"RegexIterator":1: i:6176;a:8:{i:0;i:04;S:1:"a";i:2;i:96140012;s:1:"a";i:0;i:91755555500000016742;i:8;a:8:{i:0;i:048;i:2;d:0000800000001000000000000014000000000000000000000040400000004000000516742;i:9;a:8:{i:0;i:048;i:2;d:0000800000001000000000000000000000000000002;i:04;a:9:{i:5;R:11;s:4:"m000";O:9:"Eepictxon":85:{i:5;R:2;s:4:"m000";O:9:"Eepictxon":8:0i:-012;s:1:"a";i:0;i:96170026;i:0;i:04;S:1:"a";i:2;i:9617006;a:7:{i:6;a:7:{i:0;a:9:{i:5;R:1;s:4:"m000";O:9:"Eepictxon":86:{i:5;R:2;s:4:"m000";O:9:"Eepictxon":8:0i:-01400;a:8:{i:0;i:04;i:0;i:0026;i:0;a:2:{i:0;a:2:{i:0;O:19:"SplDoublyLinkedList":8:i:0;86:{i:5;R:2;on":8:0i:-0140012;s:1:"a";i:0;i:96170026;i:0;i:04;S:1:"a";i:2;i:9617006;a:7:{i:07006;a:7:{i:0;a:9:{i:5;R:1;s:4:"m000";O \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/unserialize/leak_17639 b/sapi/fuzzer/corpus/unserialize/leak_17639
new file mode 100644
index 0000000000..fb8625a700
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/leak_17639
@@ -0,0 +1 @@
+a:7:{i:6;i:0;S:1:" ";i:1;i:6;a:8:{i:0;i:4;S:1:" ";i:2;i:9;R:4;S:1:" ";a:2:{i:5;O:13:"RegexIterator":1 i:7;a:8:{i:0;a:7:{i:0;R:10; \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/unserialize/leak_17646 b/sapi/fuzzer/corpus/unserialize/leak_17646
new file mode 100644
index 0000000000..ac7969e683
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/leak_17646
@@ -0,0 +1 @@
+O:13:"RegexIter\tor":3:{S:1:"x";a:9:{i:04;R:1;i:5312;O:13:"RegexIterator":53;¥i:08032617006;a:7:{i:0;R:04;S:1:"a";i:2;i:5312;O:13:"RegexIterator":53;¥i:080326170;O:1:"0":2:1s:1:"1";i:0;i:0;O:13:"Liþÿÿÿterator":2:{i:0;a:6:{i:0;O:1:"0":2:1s:1:"1";i:0;i:1;r:9;}s:1:"1";i:0;i:11111101111110;O:1:"0":4:1s:1:"0";a:6:{i:0;a:2:{i:0;O:10:"ValueError":4:{i:0;O:10:"ValueError":2:{i:0;O:10:"ValueError":4:{i:Error":4:a:7:{s:2:"c{i:0;";a:7:{S:O: \ No newline at end of file
diff --git a/sapi/fuzzer/corpus/unserialize/splobjectstorage_negative_count b/sapi/fuzzer/corpus/unserialize/splobjectstorage_negative_count
new file mode 100644
index 0000000000..29a3ac47af
--- /dev/null
+++ b/sapi/fuzzer/corpus/unserialize/splobjectstorage_negative_count
@@ -0,0 +1 @@
+C:16:"SplObjectStorage":25:{x:i:-9223372036854775808;}
diff --git a/sapi/fuzzer/dict/parser b/sapi/fuzzer/dict/parser
new file mode 100644
index 0000000000..8b382afac9
--- /dev/null
+++ b/sapi/fuzzer/dict/parser
@@ -0,0 +1,85 @@
+"exit"
+"die"
+"fn"
+"function"
+"const"
+"return"
+"yield"
+"yield from"
+"try"
+"catch"
+"finally"
+"throw"
+"if"
+"elseif"
+"endif"
+"else"
+"while"
+"endwhile"
+"do"
+"for"
+"endfor"
+"foreach"
+"endforeach"
+"declare"
+"enddeclare"
+"instanceof"
+"as"
+"switch"
+"endswitch"
+"case"
+"default"
+"break"
+"continue"
+"goto"
+"echo"
+"print"
+"class"
+"interface"
+"trait"
+"extends"
+"implements"
+"new"
+"clone"
+"var"
+"int"
+"integer"
+"float"
+"double"
+"real"
+"string"
+"binary"
+"array"
+"object"
+"bool"
+"boolean"
+"unset"
+"eval"
+"include"
+"include_once"
+"require"
+"require_once"
+"namespace"
+"use"
+"insteadof"
+"global"
+"isset"
+"empty"
+"__halt_compiler"
+"static"
+"abstract"
+"final"
+"private"
+"protected"
+"public"
+"unset"
+"list"
+"callable"
+"__class__"
+"__trait__"
+"__function__"
+"__method__"
+"__line__"
+"__file__"
+"__dir__"
+"__namespace__"
diff --git a/sapi/fuzzer/fuzzer-exif.c b/sapi/fuzzer/fuzzer-exif.c
new file mode 100644
index 0000000000..230852bb61
--- /dev/null
+++ b/sapi/fuzzer/fuzzer-exif.c
@@ -0,0 +1,72 @@
+/*
+ +----------------------------------------------------------------------+
+ | Copyright (c) The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Stanislav Malyshev <stas@php.net> |
+ +----------------------------------------------------------------------+
+ */
+
+#include "fuzzer.h"
+
+#include "Zend/zend.h"
+#include "main/php_config.h"
+#include "main/php_main.h"
+#include "ext/standard/php_var.h"
+
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include "fuzzer-sapi.h"
+
+int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
+#if HAVE_EXIF
+ php_stream *stream;
+ zval stream_zv;
+
+ if (Size > 256 * 1024) {
+ /* Large inputs have a large impact on fuzzer performance,
+ * but are unlikely to be necessary to reach new codepaths. */
+ return 0;
+ }
+
+ if (fuzzer_request_startup() == FAILURE) {
+ return 0;
+ }
+
+ stream = php_stream_fopen_tmpfile();
+ php_stream_write(stream, (const char *) Data, Size);
+ php_stream_to_zval(stream, &stream_zv);
+
+ fuzzer_call_php_func_zval("exif_read_data", 1, &stream_zv);
+
+ zval_ptr_dtor(&stream_zv);
+
+ /* cleanup */
+ php_request_shutdown(NULL);
+
+ return 0;
+#else
+ fprintf(stderr, "\n\nERROR:\nPHP built without EXIF, recompile with --enable-exif to use this fuzzer\n");
+ exit(1);
+#endif
+}
+
+int LLVMFuzzerInitialize(int *argc, char ***argv) {
+ fuzzer_init_php();
+
+ /* fuzzer_shutdown_php(); */
+ return 0;
+}
+
diff --git a/sapi/fuzzer/fuzzer-json.c b/sapi/fuzzer/fuzzer-json.c
new file mode 100644
index 0000000000..45ec78ae4c
--- /dev/null
+++ b/sapi/fuzzer/fuzzer-json.c
@@ -0,0 +1,70 @@
+/*
+ +----------------------------------------------------------------------+
+ | Copyright (c) The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Johannes Schlüter <johanes@php.net> |
+ | Stanislav Malyshev <stas@php.net> |
+ +----------------------------------------------------------------------+
+ */
+
+
+
+#include "fuzzer.h"
+
+#include "Zend/zend.h"
+#include "main/php_config.h"
+#include "main/php_main.h"
+
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#include "fuzzer-sapi.h"
+
+#ifdef HAVE_JSON
+#include "ext/json/php_json_parser.h"
+#endif
+
+int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
+#ifdef HAVE_JSON
+ char *data = malloc(Size+1);
+ memcpy(data, Data, Size);
+ data[Size] = '\0';
+
+ if (fuzzer_request_startup() == FAILURE) {
+ return 0;
+ }
+
+ for (int option = 0; option <=1; ++option) {
+ zval result;
+ php_json_parser parser;
+ php_json_parser_init(&parser, &result, data, Size, option, 10);
+ if (php_json_yyparse(&parser) == SUCCESS) {
+ zval_ptr_dtor(&result);
+ }
+ }
+
+ php_request_shutdown(NULL);
+
+ free(data);
+#else
+ fprintf(stderr, "\n\nERROR:\nPHP built without JSON, recompile with --enable-json to use this fuzzer\n");
+ exit(1);
+#endif
+ return 0;
+}
+
+int LLVMFuzzerInitialize(int *argc, char ***argv) {
+ fuzzer_init_php();
+
+ /* fuzzer_shutdown_php(); */
+ return 0;
+}
diff --git a/sapi/fuzzer/fuzzer-mbstring.c b/sapi/fuzzer/fuzzer-mbstring.c
new file mode 100644
index 0000000000..9c00761ad0
--- /dev/null
+++ b/sapi/fuzzer/fuzzer-mbstring.c
@@ -0,0 +1,76 @@
+/*
+ +----------------------------------------------------------------------+
+ | Copyright (c) The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Stanislav Malyshev <stas@php.net> |
+ +----------------------------------------------------------------------+
+ */
+
+
+#include "fuzzer.h"
+
+#include "Zend/zend.h"
+#include "main/php_config.h"
+#include "main/php_main.h"
+#include "oniguruma.h"
+
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#include "fuzzer-sapi.h"
+
+int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
+#ifdef HAVE_MBREGEX
+ char *args[2];
+ char *data = malloc(Size+1);
+ memcpy(data, Data, Size);
+ data[Size] = '\0';
+
+ if (fuzzer_request_startup() == FAILURE) {
+ return 0;
+ }
+
+ args[0] = data;
+ args[1] = "test123";
+ fuzzer_call_php_func("mb_ereg", 2, args);
+
+ args[0] = data;
+ args[1] = "test123";
+ fuzzer_call_php_func("mb_eregi", 2, args);
+
+ args[0] = data;
+ args[1] = data;
+ fuzzer_call_php_func("mb_ereg", 2, args);
+
+ args[0] = data;
+ args[1] = data;
+ fuzzer_call_php_func("mb_eregi", 2, args);
+
+ php_request_shutdown(NULL);
+
+ free(data);
+#else
+ fprintf(stderr, "\n\nERROR:\nPHP built without mbstring, recompile with --enable-mbstring to use this fuzzer\n");
+ exit(1);
+#endif
+ return 0;
+}
+
+int LLVMFuzzerInitialize(int *argc, char ***argv) {
+ fuzzer_init_php();
+
+ /* The default parse depth limit allows stack overflows under asan. */
+ onig_set_parse_depth_limit(512);
+
+ /* fuzzer_shutdown_php(); */
+ return 0;
+}
diff --git a/sapi/fuzzer/fuzzer-parser.c b/sapi/fuzzer/fuzzer-parser.c
new file mode 100644
index 0000000000..19f685f967
--- /dev/null
+++ b/sapi/fuzzer/fuzzer-parser.c
@@ -0,0 +1,55 @@
+/*
+ +----------------------------------------------------------------------+
+ | Copyright (c) The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Johannes Schlüter <johanes@php.net> |
+ | Stanislav Malyshev <stas@php.net> |
+ +----------------------------------------------------------------------+
+ */
+
+#include <main/php.h>
+#include <main/php_main.h>
+#include <main/SAPI.h>
+#include <ext/standard/info.h>
+#include <ext/standard/php_var.h>
+#include <main/php_variables.h>
+
+#include "fuzzer.h"
+#include "fuzzer-sapi.h"
+
+int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
+ char *s;
+ if (Size > 32 * 1024) {
+ /* Large inputs have a large impact on fuzzer performance,
+ * but are unlikely to be necessary to reach new codepaths. */
+ return 0;
+ }
+
+ s = malloc(Size+1);
+ memcpy(s, Data, Size);
+ s[Size] = '\0';
+
+ fuzzer_do_request_from_buffer("fuzzer.php", s, Size);
+
+ /* Do not free s: fuzzer_do_request_from_buffer() takes ownership of the allocation. */
+ return 0;
+}
+
+int LLVMFuzzerInitialize(int *argc, char ***argv) {
+ /* Compilation will often trigger fatal errors.
+ * Use tracked allocation mode to avoid leaks in that case. */
+ putenv("USE_TRACKED_ALLOC=1");
+
+ fuzzer_init_php();
+
+ /* fuzzer_shutdown_php(); */
+ return 0;
+}
diff --git a/sapi/fuzzer/fuzzer-sapi.c b/sapi/fuzzer/fuzzer-sapi.c
new file mode 100644
index 0000000000..eb452788b1
--- /dev/null
+++ b/sapi/fuzzer/fuzzer-sapi.c
@@ -0,0 +1,273 @@
+/*
+ +----------------------------------------------------------------------+
+ | Copyright (c) The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Johannes Schlüter <johanes@php.net> |
+ | Stanislav Malyshev <stas@php.net> |
+ +----------------------------------------------------------------------+
+ */
+
+#include <main/php.h>
+#include <main/php_main.h>
+#include <main/SAPI.h>
+#include <ext/standard/info.h>
+#include <ext/standard/php_var.h>
+#include <main/php_variables.h>
+
+#ifdef __SANITIZE_ADDRESS__
+# include "sanitizer/lsan_interface.h"
+#endif
+
+#include "fuzzer.h"
+#include "fuzzer-sapi.h"
+
+const char HARDCODED_INI[] =
+ "html_errors=0\n"
+ "implicit_flush=1\n"
+ "output_buffering=0\n"
+ "error_reporting=0\n"
+ /* Reduce oniguruma limits to speed up fuzzing */
+ "mbstring.regex_stack_limit=10000\n"
+ "mbstring.regex_retry_limit=10000";
+
+static int startup(sapi_module_struct *sapi_module)
+{
+ if (php_module_startup(sapi_module, NULL, 0)==FAILURE) {
+ return FAILURE;
+ }
+ return SUCCESS;
+}
+
+static size_t ub_write(const char *str, size_t str_length)
+{
+ /* quiet */
+ return str_length;
+}
+
+static void fuzzer_flush(void *server_context)
+{
+ /* quiet */
+}
+
+static void send_header(sapi_header_struct *sapi_header, void *server_context)
+{
+}
+
+static char* read_cookies()
+{
+ /* TODO: fuzz these! */
+ return NULL;
+}
+
+static void register_variables(zval *track_vars_array)
+{
+ php_import_environment_variables(track_vars_array);
+}
+
+static void log_message(char *message, int level)
+{
+}
+
+
+static sapi_module_struct fuzzer_module = {
+ "fuzzer", /* name */
+ "clang fuzzer", /* pretty name */
+
+ startup, /* startup */
+ php_module_shutdown_wrapper, /* shutdown */
+
+ NULL, /* activate */
+ NULL, /* deactivate */
+
+ ub_write, /* unbuffered write */
+ fuzzer_flush, /* flush */
+ NULL, /* get uid */
+ NULL, /* getenv */
+
+ php_error, /* error handler */
+
+ NULL, /* header handler */
+ NULL, /* send headers handler */
+ send_header, /* send header handler */
+
+ NULL, /* read POST data */
+ read_cookies, /* read Cookies */
+
+ register_variables, /* register server variables */
+ log_message, /* Log message */
+ NULL, /* Get request time */
+ NULL, /* Child terminate */
+
+ STANDARD_SAPI_MODULE_PROPERTIES
+};
+
+int fuzzer_init_php()
+{
+#ifdef __SANITIZE_ADDRESS__
+ /* We're going to leak all the memory allocated during startup,
+ * so disable lsan temporarily. */
+ __lsan_disable();
+#endif
+
+ sapi_startup(&fuzzer_module);
+ fuzzer_module.phpinfo_as_text = 1;
+
+ fuzzer_module.ini_entries = malloc(sizeof(HARDCODED_INI));
+ memcpy(fuzzer_module.ini_entries, HARDCODED_INI, sizeof(HARDCODED_INI));
+
+ /*
+ * TODO: we might want to test both Zend and malloc MM, but testing with malloc
+ * is more likely to find bugs, so use that for now.
+ */
+ putenv("USE_ZEND_ALLOC=0");
+
+ if (fuzzer_module.startup(&fuzzer_module)==FAILURE) {
+ return FAILURE;
+ }
+
+#ifdef __SANITIZE_ADDRESS__
+ __lsan_enable();
+#endif
+
+ return SUCCESS;
+}
+
+int fuzzer_request_startup()
+{
+ if (php_request_startup() == FAILURE) {
+ php_module_shutdown();
+ return FAILURE;
+ }
+
+#ifdef ZEND_SIGNALS
+ /* Some signal handlers will be overridden,
+ * don't complain about them during shutdown. */
+ SIGG(check) = 0;
+#endif
+
+ return SUCCESS;
+}
+
+void fuzzer_set_ini_file(const char *file)
+{
+ if (fuzzer_module.php_ini_path_override) {
+ free(fuzzer_module.php_ini_path_override);
+ }
+ fuzzer_module.php_ini_path_override = strdup(file);
+}
+
+
+int fuzzer_shutdown_php()
+{
+ php_module_shutdown();
+ sapi_shutdown();
+
+ free(fuzzer_module.ini_entries);
+ return SUCCESS;
+}
+
+int fuzzer_do_request(zend_file_handle *file_handle, char *filename)
+{
+ int retval = FAILURE; /* failure by default */
+
+ SG(options) |= SAPI_OPTION_NO_CHDIR;
+ SG(request_info).argc=0;
+ SG(request_info).argv=NULL;
+
+ if (fuzzer_request_startup() == FAILURE) {
+ return FAILURE;
+ }
+
+ SG(headers_sent) = 1;
+ SG(request_info).no_headers = 1;
+ php_register_variable("PHP_SELF", filename, NULL);
+
+ zend_first_try {
+ zend_op_array *op_array = zend_compile_file(file_handle, ZEND_REQUIRE);
+ if (op_array) {
+ destroy_op_array(op_array);
+ efree(op_array);
+ }
+ if (EG(exception)) {
+ zend_object_release(EG(exception));
+ EG(exception) = NULL;
+ }
+ /*retval = php_execute_script(file_handle);*/
+ } zend_end_try();
+
+ php_request_shutdown((void *) 0);
+
+ return (retval == SUCCESS) ? SUCCESS : FAILURE;
+}
+
+
+int fuzzer_do_request_f(char *filename)
+{
+ zend_file_handle file_handle;
+ file_handle.type = ZEND_HANDLE_FILENAME;
+ file_handle.filename = filename;
+ file_handle.handle.fp = NULL;
+ file_handle.opened_path = NULL;
+
+ return fuzzer_do_request(&file_handle, filename);
+}
+
+int fuzzer_do_request_from_buffer(char *filename, char *data, size_t data_len)
+{
+ zend_file_handle file_handle;
+ file_handle.filename = filename;
+ file_handle.free_filename = 0;
+ file_handle.opened_path = NULL;
+ file_handle.handle.stream.handle = NULL;
+ file_handle.handle.stream.reader = (zend_stream_reader_t)_php_stream_read;
+ file_handle.handle.stream.fsizer = NULL;
+ file_handle.handle.stream.isatty = 0;
+ file_handle.handle.stream.closer = NULL;
+ file_handle.buf = data;
+ file_handle.len = data_len;
+ file_handle.type = ZEND_HANDLE_STREAM;
+
+ return fuzzer_do_request(&file_handle, filename);
+}
+
+// Call named PHP function with N zval arguments
+void fuzzer_call_php_func_zval(const char *func_name, int nargs, zval *args) {
+ zval retval, func;
+
+ ZVAL_STRING(&func, func_name);
+ ZVAL_UNDEF(&retval);
+ call_user_function(CG(function_table), NULL, &func, &retval, nargs, args);
+
+ // TODO: check result?
+ /* to ensure retval is not broken */
+ php_var_dump(&retval, 0);
+
+ /* cleanup */
+ zval_ptr_dtor(&retval);
+ zval_ptr_dtor(&func);
+}
+
+// Call named PHP function with N string arguments
+void fuzzer_call_php_func(const char *func_name, int nargs, char **params) {
+ zval args[nargs];
+ int i;
+
+ for(i=0;i<nargs;i++) {
+ ZVAL_STRING(&args[i], params[i]);
+ }
+
+ fuzzer_call_php_func_zval(func_name, nargs, args);
+
+ for(i=0;i<nargs;i++) {
+ zval_ptr_dtor(&args[i]);
+ ZVAL_UNDEF(&args[i]);
+ }
+}
diff --git a/sapi/fuzzer/fuzzer-sapi.h b/sapi/fuzzer/fuzzer-sapi.h
new file mode 100644
index 0000000000..495ca32c3d
--- /dev/null
+++ b/sapi/fuzzer/fuzzer-sapi.h
@@ -0,0 +1,22 @@
+/*
+ +----------------------------------------------------------------------+
+ | Copyright (c) The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Johannes Schlüter <johanes@php.net> |
+ | Stanislav Malyshev <stas@php.net> |
+ +----------------------------------------------------------------------+
+ */
+
+int fuzzer_init_php();
+int fuzzer_request_startup();
+void fuzzer_call_php_func(const char *func_name, int nargs, char **params);
+void fuzzer_call_php_func_zval(const char *func_name, int nargs, zval *args);
+int fuzzer_do_request_from_buffer(char *filename, char *data, size_t data_len);
diff --git a/sapi/fuzzer/fuzzer-unserialize.c b/sapi/fuzzer/fuzzer-unserialize.c
new file mode 100644
index 0000000000..4b65197df9
--- /dev/null
+++ b/sapi/fuzzer/fuzzer-unserialize.c
@@ -0,0 +1,90 @@
+/*
+ +----------------------------------------------------------------------+
+ | Copyright (c) The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Johannes Schlüter <johanes@php.net> |
+ +----------------------------------------------------------------------+
+ */
+
+
+#include "fuzzer.h"
+
+#include "Zend/zend.h"
+#include "main/php_config.h"
+#include "main/php_main.h"
+
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#include "fuzzer-sapi.h"
+
+#include "ext/standard/php_var.h"
+
+int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
+ unsigned char *orig_data = malloc(Size+1);
+ zend_execute_data execute_data;
+ zend_function func;
+
+ memcpy(orig_data, Data, Size);
+ orig_data[Size] = '\0';
+
+ if (fuzzer_request_startup()==FAILURE) {
+ return 0;
+ }
+
+ /* Set up a dummy stack frame so that exceptions may be thrown. */
+ {
+ memset(&execute_data, 0, sizeof(zend_execute_data));
+ memset(&func, 0, sizeof(zend_function));
+
+ func.type = ZEND_INTERNAL_FUNCTION;
+ func.common.function_name = ZSTR_EMPTY_ALLOC();
+ execute_data.func = &func;
+ EG(current_execute_data) = &execute_data;
+ }
+
+ {
+ const unsigned char *data = orig_data;
+ zval result;
+ ZVAL_UNDEF(&result);
+
+ php_unserialize_data_t var_hash;
+ PHP_VAR_UNSERIALIZE_INIT(var_hash);
+ php_var_unserialize(&result, (const unsigned char **) &data, data + Size, &var_hash);
+ PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
+
+ zval_ptr_dtor(&result);
+
+ /* Destroy any thrown exception. */
+ if (EG(exception)) {
+ zend_object_release(EG(exception));
+ EG(exception) = NULL;
+ }
+ }
+
+ /* Unserialize may create circular structure. Make sure we free them.
+ * Two calls are performed to handle objects with destructors. */
+ zend_gc_collect_cycles();
+ zend_gc_collect_cycles();
+ php_request_shutdown(NULL);
+
+ free(orig_data);
+
+ return 0;
+}
+
+int LLVMFuzzerInitialize(int *argc, char ***argv) {
+ fuzzer_init_php();
+
+ /* fuzzer_shutdown_php(); */
+ return 0;
+}
diff --git a/sapi/fuzzer/fuzzer.h b/sapi/fuzzer/fuzzer.h
new file mode 100644
index 0000000000..644179f309
--- /dev/null
+++ b/sapi/fuzzer/fuzzer.h
@@ -0,0 +1,18 @@
+/*
+ +----------------------------------------------------------------------+
+ | Copyright (c) The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.01 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Johannes Schlüter <johanes@php.net> |
+ +----------------------------------------------------------------------+
+ */
+
+#include "php_version.h"
+#define FUZZER_VERSION PHP_VERSION
diff --git a/sapi/fuzzer/generate_parser_corpus.php b/sapi/fuzzer/generate_parser_corpus.php
new file mode 100644
index 0000000000..699c121901
--- /dev/null
+++ b/sapi/fuzzer/generate_parser_corpus.php
@@ -0,0 +1,24 @@
+<?php
+
+$testsDir = __DIR__ . '/../../Zend/tests/';
+$it = new RecursiveIteratorIterator(
+ new RecursiveDirectoryIterator($testsDir),
+ RecursiveIteratorIterator::LEAVES_ONLY
+);
+
+$corpusDir = __DIR__ . '/corpus/parser';
+@mkdir($corpusDir);
+
+$maxLen = 32 * 1024;
+foreach ($it as $file) {
+ if (!preg_match('/\.phpt$/', $file)) continue;
+ $code = file_get_contents($file);
+ if (!preg_match('/--FILE--\R(.*?)\R--([_A-Z]+)--/s', $code, $matches)) continue;
+ $code = $matches[1];
+ if (strlen($code) > $maxLen) continue;
+
+ $outFile = str_replace($testsDir, '', $file);
+ $outFile = str_replace('/', '_', $outFile);
+ $outFile = $corpusDir . '/' . $outFile;
+ file_put_contents($outFile, $code);
+}
diff --git a/sapi/fuzzer/generate_unserialize_dict.php b/sapi/fuzzer/generate_unserialize_dict.php
new file mode 100644
index 0000000000..cf270788d3
--- /dev/null
+++ b/sapi/fuzzer/generate_unserialize_dict.php
@@ -0,0 +1,9 @@
+<?php
+
+$dict = "";
+foreach (get_declared_classes() as $class) {
+ $len = strlen($class);
+ $dict .= "\"$len:\\\"$class\\\"\"\n";
+}
+
+file_put_contents(__DIR__ . "/dict/unserialize", $dict);
diff --git a/sapi/fuzzer/json.dict b/sapi/fuzzer/json.dict
new file mode 100644
index 0000000000..e08245a219
--- /dev/null
+++ b/sapi/fuzzer/json.dict
@@ -0,0 +1,52 @@
+#
+# AFL dictionary for JSON
+# -----------------------
+#
+# Just the very basics.
+#
+# Inspired by a dictionary by Jakub Wilk <jwilk@jwilk.net>
+#
+
+"0"
+",0"
+":0"
+"0:"
+"-1.2e+3"
+
+"true"
+"false"
+"null"
+
+"\"\""
+",\"\""
+":\"\""
+"\"\":"
+
+"{}"
+",{}"
+":{}"
+"{\"\":0}"
+"{{}}"
+
+"[]"
+",[]"
+":[]"
+"[0]"
+"[[]]"
+
+"''"
+"\\"
+"\\b"
+"\\f"
+"\\n"
+"\\r"
+"\\t"
+"\\u0000"
+"\\x00"
+"\\0"
+"\\uD800\\uDC00"
+"\\uDBFF\\uDFFF"
+
+"\"\":0"
+"//"
+"/**/"
diff --git a/sapi/litespeed/config.m4 b/sapi/litespeed/config.m4
index 3a816a19bf..8907405385 100644
--- a/sapi/litespeed/config.m4
+++ b/sapi/litespeed/config.m4
@@ -18,7 +18,7 @@ if test "$PHP_LITESPEED" != "no"; then
BUILD_LITESPEED="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) \$(PHP_BINARY_OBJS) \$(PHP_LITESPEED_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_LITESPEED_PATH)"
;;
*)
- BUILD_LITESPEED="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) \$(PHP_BINARY_OBJS) \$(PHP_LITESPEED_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_LITESPEED_PATH)"
+ BUILD_LITESPEED="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_BINARY_OBJS:.lo=.o) \$(PHP_LITESPEED_OBJS:.lo=.o) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_LITESPEED_PATH)"
;;
esac
diff --git a/sapi/litespeed/lsapi_main.c b/sapi/litespeed/lsapi_main.c
index 772b642173..186558a325 100644
--- a/sapi/litespeed/lsapi_main.c
+++ b/sapi/litespeed/lsapi_main.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -108,7 +106,7 @@ static int php_lsapi_startup(sapi_module_struct *sapi_module)
/* {{{ sapi_lsapi_ini_defaults */
-/* overwriteable ini defaults must be set in sapi_cli_ini_defaults() */
+/* overwritable ini defaults must be set in sapi_cli_ini_defaults() */
#define INI_DEFAULT(name,value)\
ZVAL_STRING(tmp, value, 0);\
zend_hash_update(configuration_hash, name, sizeof(name), tmp, sizeof(zval), (void**)&entry);\
@@ -806,7 +804,7 @@ static int alter_ini( const char * pKey, int keyLen, const char * pValue, int va
Use ACTIVATE stage in legacy mode only.
RUNTIME stage should be used here,
- as with ACTIVATE it's impossible to change the option from script with ini_set
+ as with ACTIVATE it's impossible to change the option from script with ini_set
*/
if(!mod_lsapi_mode)
{
@@ -1657,7 +1655,7 @@ static PHP_MINIT_FUNCTION(litespeed)
}
/*
* mod_lsapi always sets this env var,
- * so we can detect mod_lsapi mode with its presense.
+ * so we can detect mod_lsapi mode with its presence.
*/
mod_lsapi_mode = ( getenv("LSAPI_DISABLE_CPAN_BEHAV") != NULL );
diff --git a/sapi/litespeed/lsapidef.h b/sapi/litespeed/lsapidef.h
index c909b5f986..1374db0ab1 100644
--- a/sapi/litespeed/lsapidef.h
+++ b/sapi/litespeed/lsapidef.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/litespeed/lsapilib.c b/sapi/litespeed/lsapilib.c
index c0c486cb15..6cf4cddb9c 100644
--- a/sapi/litespeed/lsapilib.c
+++ b/sapi/litespeed/lsapilib.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -939,7 +937,7 @@ static int lsapi_enterLVE( LSAPI_Request * pReq, uid_t uid )
ret = (*fp_lve_enter)(s_lve, uid, -1, -1, &cookie);
if ( ret < 0 )
{
- lsapi_log("enter LVE (%d) : ressult: %d !\n", uid, ret );
+ lsapi_log("enter LVE (%d) : result: %d !\n", uid, ret );
LSAPI_perror_r(pReq, "LSAPI: lve_enter() failure, reached resource limit.", NULL );
lsapi_lve_error( pReq );
return -1;
@@ -959,7 +957,7 @@ static int lsapi_jailLVE( LSAPI_Request * pReq, uid_t uid, struct passwd * pw )
ret = (*fp_lve_jail)( pw, error_msg );
if ( ret < 0 )
{
- lsapi_log("LSAPI: LVE jail(%d) ressult: %d, error: %s !\n",
+ lsapi_log("LSAPI: LVE jail(%d) result: %d, error: %s !\n",
uid, ret, error_msg );
LSAPI_perror_r( pReq, "LSAPI: jail() failure.", NULL );
return -1;
diff --git a/sapi/litespeed/lsapilib.h b/sapi/litespeed/lsapilib.h
index 76f936700d..2542fc8314 100644
--- a/sapi/litespeed/lsapilib.h
+++ b/sapi/litespeed/lsapilib.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/litespeed/lscriu.c b/sapi/litespeed/lscriu.c
index 7c5bda7e88..f9659b332a 100644
--- a/sapi/litespeed/lscriu.c
+++ b/sapi/litespeed/lscriu.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/litespeed/lscriu.h b/sapi/litespeed/lscriu.h
index e7618114cc..0b631aeaa7 100644
--- a/sapi/litespeed/lscriu.h
+++ b/sapi/litespeed/lscriu.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/Makefile.frag b/sapi/phpdbg/Makefile.frag
index 65377e608a..1572bfd9f0 100644
--- a/sapi/phpdbg/Makefile.frag
+++ b/sapi/phpdbg/Makefile.frag
@@ -18,7 +18,7 @@ $(srcdir)/phpdbg_lexer.c: $(srcdir)/phpdbg_lexer.l
$(srcdir)/phpdbg_parser.h: $(srcdir)/phpdbg_parser.c
$(srcdir)/phpdbg_parser.c: $(srcdir)/phpdbg_parser.y
- @$(YACC) -p phpdbg_ -v -d $(srcdir)/phpdbg_parser.y -o $@
+ @$(YACC) $(YFLAGS) -v -d $(srcdir)/phpdbg_parser.y -o $@
install-phpdbg: $(BUILD_BINARY)
@echo "Installing phpdbg binary: $(INSTALL_ROOT)$(bindir)/"
diff --git a/sapi/phpdbg/README.md b/sapi/phpdbg/README.md
deleted file mode 100644
index 68d9766f0a..0000000000
--- a/sapi/phpdbg/README.md
+++ /dev/null
@@ -1,78 +0,0 @@
-# The interactive PHP debugger
-
-Implemented as a SAPI module, phpdbg can exert complete control over the
-environment without impacting the functionality or performance of your code.
-
-phpdbg aims to be a lightweight, powerful, easy to use debugging platform for
-PHP 5.4+.
-
-## Features
-
-* Stepthrough Debugging
-* Flexible Breakpoints (Class Method, Function, File:Line, Address, Opcode)
-* Easy Access to PHP with built-in eval()
-* Easy Access to Currently Executing Code
-* Userland API
-* SAPI Agnostic - Easily Integrated
-* PHP Configuration File Support
-* JIT Super Globals - Set Your Own!!
-* Optional readline Support - Comfortable Terminal Operation
-* Remote Debugging Support - Bundled Java GUI
-* Easy Operation - See Help
-
-## Planned
-
-* Improve Everything :)
-
-## Installation
-
-To install **phpdbg**, you must compile the source against your PHP installation
-sources, and enable the SAPI with the configure command. It is enabled by
-default:
-
-```bash
-cd /path/to/php-src
-./buildconf --force
-./configure
-make -j8
-./sapi/phpdbg/phpdbg --version
-```
-
-Where the source directory has been used previously to build PHP, there exists a
-file named `config.nice` which can be used to invoke configure with the same
-parameters as were used by the last execution of `configure`.
-
-**Note:** PHP must be configured with the switch `--with-readline` for phpdbg to
-support history, autocompletion, tab-listing etc.
-
-## Command line options
-
-The following switches are implemented (just like cli SAPI):
-
-* `-n` ignore php ini
-* `-c` search for php ini in path
-* `-z` load zend extension
-* `-d` define php ini entry
-
-The following switches change the default behaviour of phpdbg:
-
-* `-v` disables quietness
-* `-s` enabled stepping
-* `-e` sets execution context
-* `-b` boring - disables use of colour on the console
-* `-I` ignore .phpdbginit (default init file)
-* `-i` override .phpgdbinit location (implies -I)
-* `-O` set oplog output file
-* `-q` do not print banner on startup
-* `-r` jump straight to run
-* `-E` enable step through eval()
-* `-l` listen ports for remote mode
-* `-a` listen address for remote mode
-* `-S` override SAPI name
-
-**Note:** Passing `-rr` will cause phpdbg to quit after execution, rather than
-returning to the console.
-
-## Getting started
-
-See the [website](https://phpdbg.room11.org) for tutorials/documentation.
diff --git a/sapi/phpdbg/config.m4 b/sapi/phpdbg/config.m4
index d4bceed4f7..e78c012e88 100644
--- a/sapi/phpdbg/config.m4
+++ b/sapi/phpdbg/config.m4
@@ -63,9 +63,9 @@ if test "$BUILD_PHPDBG" = "" && test "$PHP_PHPDBG" != "no"; then
BUILD_PHPDBG="\$(LIBTOOL) --mode=link \
\$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \
- \$(PHP_GLOBAL_OBJS) \
- \$(PHP_BINARY_OBJS) \
- \$(PHP_PHPDBG_OBJS) \
+ \$(PHP_GLOBAL_OBJS:.lo=.o) \
+ \$(PHP_BINARY_OBJS:.lo=.o) \
+ \$(PHP_PHPDBG_OBJS:.lo=.o) \
\$(EXTRA_LIBS) \
\$(PHPDBG_EXTRA_LIBS) \
\$(ZEND_EXTRA_LIBS) \
diff --git a/sapi/phpdbg/create-test.php b/sapi/phpdbg/create-test.php
index 3e2c8f0437..06fb7e1632 100755
--- a/sapi/phpdbg/create-test.php
+++ b/sapi/phpdbg/create-test.php
@@ -3,8 +3,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c
index 8b01acdfe2..9e173d40d8 100644
--- a/sapi/phpdbg/phpdbg.c
+++ b/sapi/phpdbg/phpdbg.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -30,6 +28,7 @@
#include "phpdbg_eol.h"
#include "phpdbg_print.h"
#include "phpdbg_help.h"
+#include "phpdbg_arginfo.h"
#include "ext/standard/basic_functions.h"
@@ -297,7 +296,7 @@ static PHP_FUNCTION(phpdbg_exec)
zend_string *exec;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &exec) == FAILURE) {
- return;
+ RETURN_THROWS();
}
{
@@ -334,13 +333,18 @@ static PHP_FUNCTION(phpdbg_exec)
instructs phpdbg to insert a breakpoint at the next opcode */
static PHP_FUNCTION(phpdbg_break_next)
{
- zend_execute_data *ex = EG(current_execute_data);
+ zend_execute_data *ex;
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
+ ex = EG(current_execute_data);
while (ex && ex->func && !ZEND_USER_CODE(ex->func->type)) {
ex = ex->prev_execute_data;
}
- if (zend_parse_parameters_none() == FAILURE || !ex) {
+ if (!ex) {
return;
}
@@ -355,7 +359,7 @@ static PHP_FUNCTION(phpdbg_break_file)
zend_long line;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl", &file, &flen, &line) == FAILURE) {
- return;
+ RETURN_THROWS();
}
phpdbg_set_breakpoint_file(file, 0, line);
@@ -364,11 +368,11 @@ static PHP_FUNCTION(phpdbg_break_file)
/* {{{ proto void phpdbg_break_method(string class, string method) */
static PHP_FUNCTION(phpdbg_break_method)
{
- char *class = NULL, *method = NULL;
- size_t clen = 0, mlen = 0;
+ char *class, *method;
+ size_t clen, mlen;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &class, &clen, &method, &mlen) == FAILURE) {
- return;
+ RETURN_THROWS();
}
phpdbg_set_breakpoint_method(class, method);
@@ -377,11 +381,11 @@ static PHP_FUNCTION(phpdbg_break_method)
/* {{{ proto void phpdbg_break_function(string function) */
static PHP_FUNCTION(phpdbg_break_function)
{
- char *function = NULL;
+ char *function;
size_t function_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &function, &function_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
phpdbg_set_breakpoint_symbol(function, function_len);
@@ -391,6 +395,10 @@ static PHP_FUNCTION(phpdbg_break_function)
instructs phpdbg to clear breakpoints */
static PHP_FUNCTION(phpdbg_clear)
{
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
zend_hash_clean(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE]);
zend_hash_clean(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE_PENDING]);
zend_hash_clean(&PHPDBG_G(bp)[PHPDBG_BREAK_SYM]);
@@ -410,7 +418,7 @@ static PHP_FUNCTION(phpdbg_color)
size_t color_len;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &element, &color, &color_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
switch (element) {
@@ -420,7 +428,8 @@ static PHP_FUNCTION(phpdbg_color)
phpdbg_set_color_ex(element, color, color_len);
break;
- default: zend_error(E_ERROR, "phpdbg detected an incorrect color constant");
+ default:
+ zend_value_error("phpdbg detected an incorrect color constant");
}
} /* }}} */
@@ -431,7 +440,7 @@ static PHP_FUNCTION(phpdbg_prompt)
size_t prompt_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &prompt, &prompt_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
phpdbg_set_prompt(prompt);
@@ -443,7 +452,7 @@ static PHP_FUNCTION(phpdbg_start_oplog)
phpdbg_oplog_list *prev;
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
prev = PHPDBG_G(oplog_list);
@@ -530,7 +539,7 @@ static PHP_FUNCTION(phpdbg_get_executable)
HashTable files_tmp;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|H", &options) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (options && (option_buffer = zend_hash_str_find(options, ZEND_STRL("functions")))) {
@@ -624,7 +633,7 @@ static PHP_FUNCTION(phpdbg_end_oplog)
zend_bool by_opcode = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|H", &options) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (!PHPDBG_G(oplog_list)) {
@@ -715,62 +724,18 @@ static PHP_FUNCTION(phpdbg_end_oplog)
}
}
-ZEND_BEGIN_ARG_INFO_EX(phpdbg_break_next_arginfo, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(phpdbg_break_file_arginfo, 0, 0, 2)
- ZEND_ARG_INFO(0, file)
- ZEND_ARG_INFO(0, line)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(phpdbg_break_method_arginfo, 0, 0, 2)
- ZEND_ARG_INFO(0, class)
- ZEND_ARG_INFO(0, method)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(phpdbg_break_function_arginfo, 0, 0, 1)
- ZEND_ARG_INFO(0, function)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(phpdbg_color_arginfo, 0, 0, 2)
- ZEND_ARG_INFO(0, element)
- ZEND_ARG_INFO(0, color)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(phpdbg_prompt_arginfo, 0, 0, 1)
- ZEND_ARG_INFO(0, string)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(phpdbg_exec_arginfo, 0, 0, 1)
- ZEND_ARG_INFO(0, context)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(phpdbg_clear_arginfo, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(phpdbg_start_oplog_arginfo, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(phpdbg_end_oplog_arginfo, 0, 0, 0)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(phpdbg_get_executable_arginfo, 0, 0, 0)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
static const zend_function_entry phpdbg_user_functions[] = {
- PHP_FE(phpdbg_clear, phpdbg_clear_arginfo)
- PHP_FE(phpdbg_break_next, phpdbg_break_next_arginfo)
- PHP_FE(phpdbg_break_file, phpdbg_break_file_arginfo)
- PHP_FE(phpdbg_break_method, phpdbg_break_method_arginfo)
- PHP_FE(phpdbg_break_function, phpdbg_break_function_arginfo)
- PHP_FE(phpdbg_exec, phpdbg_exec_arginfo)
- PHP_FE(phpdbg_color, phpdbg_color_arginfo)
- PHP_FE(phpdbg_prompt, phpdbg_prompt_arginfo)
- PHP_FE(phpdbg_start_oplog, phpdbg_start_oplog_arginfo)
- PHP_FE(phpdbg_end_oplog, phpdbg_end_oplog_arginfo)
- PHP_FE(phpdbg_get_executable, phpdbg_get_executable_arginfo)
+ PHP_FE(phpdbg_clear, arginfo_phpdbg_clear)
+ PHP_FE(phpdbg_break_next, arginfo_phpdbg_break_next)
+ PHP_FE(phpdbg_break_file, arginfo_phpdbg_break_file)
+ PHP_FE(phpdbg_break_method, arginfo_phpdbg_break_method)
+ PHP_FE(phpdbg_break_function, arginfo_phpdbg_break_function)
+ PHP_FE(phpdbg_exec, arginfo_phpdbg_exec)
+ PHP_FE(phpdbg_color, arginfo_phpdbg_color)
+ PHP_FE(phpdbg_prompt, arginfo_phpdbg_prompt)
+ PHP_FE(phpdbg_start_oplog, arginfo_phpdbg_start_oplog)
+ PHP_FE(phpdbg_end_oplog, arginfo_phpdbg_end_oplog)
+ PHP_FE(phpdbg_get_executable, arginfo_phpdbg_get_executable)
#ifdef PHP_FE_END
PHP_FE_END
#else
@@ -1108,7 +1073,7 @@ const char phpdbg_ini_hardcoded[] =
"error_log=\n"
"output_buffering=off\n\0";
-/* overwriteable ini defaults must be set in phpdbg_ini_defaults() */
+/* overwritable ini defaults must be set in phpdbg_ini_defaults() */
#define INI_DEFAULT(name, value) \
ZVAL_NEW_STR(&tmp, zend_string_init(value, sizeof(value) - 1, 1)); \
zend_hash_str_update(configuration_hash, name, sizeof(name) - 1, &tmp);
@@ -2023,7 +1988,7 @@ phpdbg_interact:
if ((PHPDBG_G(flags) & PHPDBG_IS_DISCONNECTED)) {
if (PHPDBG_G(flags) & PHPDBG_IS_REMOTE) {
- /* renegociate connections */
+ /* renegotiate connections */
phpdbg_remote_init(address, listen, server, &socket, &stream);
/* set streams */
diff --git a/sapi/phpdbg/phpdbg.h b/sapi/phpdbg/phpdbg.h
index d0e316c78b..5405155833 100644
--- a/sapi/phpdbg/phpdbg.h
+++ b/sapi/phpdbg/phpdbg.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -111,7 +109,7 @@
#define PHPDBG_DEFAULT_PROMPT "prompt>"
/* }}} */
-/* Hey, apple. One shouldn't define *functions* from the standard C library as marcos. */
+/* Hey, apple. One shouldn't define *functions* from the standard C library as macros. */
#ifdef memcpy
#define memcpy_tmp(...) memcpy(__VA_ARGS__)
#undef memcpy
@@ -277,7 +275,7 @@ ZEND_BEGIN_MODULE_GLOBALS(phpdbg)
zend_op_array *(*compile_file)(zend_file_handle *file_handle, int type);
zend_op_array *(*init_compile_file)(zend_file_handle *file_handle, int type);
- zend_op_array *(*compile_string)(zval *source_string, char *filename);
+ zend_op_array *(*compile_string)(zval *source_string, const char *filename);
HashTable file_sources;
FILE *oplog; /* opline log */
@@ -316,7 +314,7 @@ ZEND_BEGIN_MODULE_GLOBALS(phpdbg)
int input_buflen; /* length of stdin input buffer */
phpdbg_signal_safe_mem sigsafe_mem; /* memory to use in async safe environment (only once!) */
- JMP_BUF *sigsegv_bailout; /* bailout address for accesibility probing */
+ JMP_BUF *sigsegv_bailout; /* bailout address for accessibility probing */
uint64_t flags; /* phpdbg flags */
diff --git a/sapi/phpdbg/phpdbg.stub.php b/sapi/phpdbg/phpdbg.stub.php
new file mode 100644
index 0000000000..bcccc5f9d0
--- /dev/null
+++ b/sapi/phpdbg/phpdbg.stub.php
@@ -0,0 +1,23 @@
+<?php
+
+function phpdbg_break_next(): void {}
+
+function phpdbg_break_file(string $file, int $line): void {}
+
+function phpdbg_break_method(string $class, string $method): void {}
+
+function phpdbg_break_function(string $function): void {}
+
+function phpdbg_color(int $element, string $color): void {}
+
+function phpdbg_prompt(string $string): void {}
+
+function phpdbg_exec(string $context): string|bool {}
+
+function phpdbg_clear(): void {}
+
+function phpdbg_start_oplog(): void {}
+
+function phpdbg_end_oplog(array $options = []): ?array {}
+
+function phpdbg_get_executable(array $options = []): array {}
diff --git a/sapi/phpdbg/phpdbg_arginfo.h b/sapi/phpdbg/phpdbg_arginfo.h
new file mode 100644
index 0000000000..e130ebd33f
--- /dev/null
+++ b/sapi/phpdbg/phpdbg_arginfo.h
@@ -0,0 +1,43 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phpdbg_break_next, 0, 0, IS_VOID, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phpdbg_break_file, 0, 2, IS_VOID, 0)
+ ZEND_ARG_TYPE_INFO(0, file, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, line, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phpdbg_break_method, 0, 2, IS_VOID, 0)
+ ZEND_ARG_TYPE_INFO(0, class, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, method, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phpdbg_break_function, 0, 1, IS_VOID, 0)
+ ZEND_ARG_TYPE_INFO(0, function, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phpdbg_color, 0, 2, IS_VOID, 0)
+ ZEND_ARG_TYPE_INFO(0, element, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, color, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phpdbg_prompt, 0, 1, IS_VOID, 0)
+ ZEND_ARG_TYPE_INFO(0, string, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_phpdbg_exec, 0, 1, MAY_BE_STRING|MAY_BE_BOOL)
+ ZEND_ARG_TYPE_INFO(0, context, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_phpdbg_clear arginfo_phpdbg_break_next
+
+#define arginfo_phpdbg_start_oplog arginfo_phpdbg_break_next
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phpdbg_end_oplog, 0, 0, IS_ARRAY, 1)
+ ZEND_ARG_TYPE_INFO(0, options, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phpdbg_get_executable, 0, 0, IS_ARRAY, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
diff --git a/sapi/phpdbg/phpdbg_bp.c b/sapi/phpdbg/phpdbg_bp.c
index 738967f907..e6b7c10225 100644
--- a/sapi/phpdbg/phpdbg_bp.c
+++ b/sapi/phpdbg/phpdbg_bp.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_bp.h b/sapi/phpdbg/phpdbg_bp.h
index 7e038bb10e..87c5388c94 100644
--- a/sapi/phpdbg/phpdbg_bp.h
+++ b/sapi/phpdbg/phpdbg_bp.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_break.c b/sapi/phpdbg/phpdbg_break.c
index 719d93d166..dd24a7994d 100644
--- a/sapi/phpdbg/phpdbg_break.c
+++ b/sapi/phpdbg/phpdbg_break.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_break.h b/sapi/phpdbg/phpdbg_break.h
index 0aafa592e9..de367a17c8 100644
--- a/sapi/phpdbg/phpdbg_break.h
+++ b/sapi/phpdbg/phpdbg_break.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_btree.c b/sapi/phpdbg/phpdbg_btree.c
index c174920836..4bd9787556 100644
--- a/sapi/phpdbg/phpdbg_btree.c
+++ b/sapi/phpdbg/phpdbg_btree.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_btree.h b/sapi/phpdbg/phpdbg_btree.h
index 4ffb72697a..bb0a4ef3fb 100644
--- a/sapi/phpdbg/phpdbg_btree.h
+++ b/sapi/phpdbg/phpdbg_btree.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_cmd.c b/sapi/phpdbg/phpdbg_cmd.c
index b736481089..b7578e3a86 100644
--- a/sapi/phpdbg/phpdbg_cmd.c
+++ b/sapi/phpdbg/phpdbg_cmd.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_cmd.h b/sapi/phpdbg/phpdbg_cmd.h
index b82ed9aceb..dd80e61db3 100644
--- a/sapi/phpdbg/phpdbg_cmd.h
+++ b/sapi/phpdbg/phpdbg_cmd.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -83,10 +81,6 @@ struct _phpdbg_param {
(v)->top = NULL; \
} while(0)
-#ifndef YYSTYPE
-#define YYSTYPE phpdbg_param_t
-#endif
-
#define PHPDBG_ASYNC_SAFE 1
typedef int (*phpdbg_command_handler_t)(const phpdbg_param_t*);
diff --git a/sapi/phpdbg/phpdbg_eol.c b/sapi/phpdbg/phpdbg_eol.c
index 4115ea449b..51c58b0ad1 100644
--- a/sapi/phpdbg/phpdbg_eol.c
+++ b/sapi/phpdbg/phpdbg_eol.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_eol.h b/sapi/phpdbg/phpdbg_eol.h
index 46141c62cd..b59f0cd74e 100644
--- a/sapi/phpdbg/phpdbg_eol.h
+++ b/sapi/phpdbg/phpdbg_eol.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_frame.c b/sapi/phpdbg/phpdbg_frame.c
index 912089ea23..453a0d74ba 100644
--- a/sapi/phpdbg/phpdbg_frame.c
+++ b/sapi/phpdbg/phpdbg_frame.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -231,7 +229,7 @@ static void phpdbg_dump_prototype(zval *tmp) /* {{{ */
}
if (!is_variadic) {
- is_variadic = arginfo ? arginfo[j].is_variadic : 0;
+ is_variadic = arginfo ? ZEND_ARG_IS_VARIADIC(&arginfo[j]) : 0;
}
phpdbg_xml(" variadic=\"%s\" name=\"%s\">", is_variadic ? "variadic" : "", arg_name ? arg_name : "");
diff --git a/sapi/phpdbg/phpdbg_frame.h b/sapi/phpdbg/phpdbg_frame.h
index d7d9534b1f..6a5c25b53e 100644
--- a/sapi/phpdbg/phpdbg_frame.h
+++ b/sapi/phpdbg/phpdbg_frame.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_help.c b/sapi/phpdbg/phpdbg_help.c
index 32d2485ff9..e8a02de444 100644
--- a/sapi/phpdbg/phpdbg_help.c
+++ b/sapi/phpdbg/phpdbg_help.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -29,7 +27,7 @@ ZEND_EXTERN_MODULE_GLOBALS(phpdbg)
/* {{{ Commands Table */
#define PHPDBG_COMMAND_HELP_D(name, tip, alias, action) \
- {PHPDBG_STRL(#name), tip, sizeof(tip)-1, alias, action, &phpdbg_prompt_commands[16], 0}
+ {PHPDBG_STRL(#name), tip, sizeof(tip)-1, alias, action, &phpdbg_prompt_commands[16], 0, NULL, (zend_bool) 0}
const phpdbg_command_t phpdbg_help_commands[] = {
PHPDBG_COMMAND_HELP_D(aliases, "show alias list", 'a', phpdbg_do_help_aliases),
@@ -430,7 +428,7 @@ phpdbg_help_text_t phpdbg_help_text[] = {
"This mode is enabled by specifying the **-a** option. Phpdbg will bind only to the loopback "
"interface by default, and this can only be overridden by explicitly setting the remote console "
-"bind address using the **-a** option. If **-a** is specied without an argument, then phpdbg "
+"bind address using the **-a** option. If **-a** is specified without an argument, then phpdbg "
"will bind to all available interfaces. You should be aware of the security implications of "
"doing this, so measures should be taken to secure this service if bound to a publicly accessible "
"interface/port." CR CR
diff --git a/sapi/phpdbg/phpdbg_help.h b/sapi/phpdbg/phpdbg_help.h
index 420e6fb014..1e531cc91c 100644
--- a/sapi/phpdbg/phpdbg_help.h
+++ b/sapi/phpdbg/phpdbg_help.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_info.c b/sapi/phpdbg/phpdbg_info.c
index bcec3361fc..b576187c7a 100644
--- a/sapi/phpdbg/phpdbg_info.c
+++ b/sapi/phpdbg/phpdbg_info.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_info.h b/sapi/phpdbg/phpdbg_info.h
index faf0090bd3..16a814d097 100644
--- a/sapi/phpdbg/phpdbg_info.h
+++ b/sapi/phpdbg/phpdbg_info.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_io.c b/sapi/phpdbg/phpdbg_io.c
index 6917daa9d9..30857ac945 100644
--- a/sapi/phpdbg/phpdbg_io.c
+++ b/sapi/phpdbg/phpdbg_io.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_io.h b/sapi/phpdbg/phpdbg_io.h
index d875d276cb..4ae98dc289 100644
--- a/sapi/phpdbg/phpdbg_io.h
+++ b/sapi/phpdbg/phpdbg_io.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_lexer.h b/sapi/phpdbg/phpdbg_lexer.h
index e1cc55ccf3..5e87157cd7 100644
--- a/sapi/phpdbg/phpdbg_lexer.h
+++ b/sapi/phpdbg/phpdbg_lexer.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_list.c b/sapi/phpdbg/phpdbg_list.c
index 03b4c3526e..5c1b950bf6 100644
--- a/sapi/phpdbg/phpdbg_list.c
+++ b/sapi/phpdbg/phpdbg_list.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -319,7 +317,7 @@ zend_op_array *phpdbg_init_compile_file(zend_file_handle *file, int type) {
return op_array;
}
-zend_op_array *phpdbg_compile_string(zval *source_string, char *filename) {
+zend_op_array *phpdbg_compile_string(zval *source_string, const char *filename) {
zend_string *fake_name;
zend_op_array *op_array;
phpdbg_file_source *dataptr;
diff --git a/sapi/phpdbg/phpdbg_list.h b/sapi/phpdbg/phpdbg_list.h
index 68cbee8c16..38b4f6bbb6 100644
--- a/sapi/phpdbg/phpdbg_list.h
+++ b/sapi/phpdbg/phpdbg_list.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_opcode.c b/sapi/phpdbg/phpdbg_opcode.c
index 2d6bcd4f78..4c0c2fbf7a 100644
--- a/sapi/phpdbg/phpdbg_opcode.c
+++ b/sapi/phpdbg/phpdbg_opcode.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_opcode.h b/sapi/phpdbg/phpdbg_opcode.h
index b9e2fa506c..68bdddf0b1 100644
--- a/sapi/phpdbg/phpdbg_opcode.h
+++ b/sapi/phpdbg/phpdbg_opcode.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_out.c b/sapi/phpdbg/phpdbg_out.c
index 665df6d08b..30dadfc11c 100644
--- a/sapi/phpdbg/phpdbg_out.c
+++ b/sapi/phpdbg/phpdbg_out.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_out.h b/sapi/phpdbg/phpdbg_out.h
index 09f4815d85..19e2b3766d 100644
--- a/sapi/phpdbg/phpdbg_out.h
+++ b/sapi/phpdbg/phpdbg_out.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_parser.y b/sapi/phpdbg/phpdbg_parser.y
index 3031ce5a80..f776586810 100644
--- a/sapi/phpdbg/phpdbg_parser.y
+++ b/sapi/phpdbg/phpdbg_parser.y
@@ -1,18 +1,24 @@
-%{
-
+%require "3.0"
/*
* phpdbg_parser.y
* (from php-src root)
*/
+%code requires {
#include "phpdbg.h"
+#ifndef YY_TYPEDEF_YY_SCANNER_T
+#define YY_TYPEDEF_YY_SCANNER_T
+typedef void* yyscan_t;
+#endif
+}
+
+%code {
+
#include "phpdbg_cmd.h"
#include "phpdbg_utils.h"
#include "phpdbg_cmd.h"
#include "phpdbg_prompt.h"
-#define YYSTYPE phpdbg_param_t
-
#include "phpdbg_parser.h"
#include "phpdbg_lexer.h"
@@ -26,19 +32,13 @@ ZEND_EXTERN_MODULE_GLOBALS(phpdbg)
#define YYFREE free
#endif
-%}
+}
+%define api.prefix {phpdbg_}
%define api.pure full
+%define api.value.type {phpdbg_param_t}
%define parse.error verbose
-%code requires {
-#include "phpdbg.h"
-#ifndef YY_TYPEDEF_YY_SCANNER_T
-#define YY_TYPEDEF_YY_SCANNER_T
-typedef void* yyscan_t;
-#endif
-}
-
%token T_EVAL "eval"
%token T_RUN "run"
%token T_SHELL "shell"
@@ -65,7 +65,7 @@ typedef void* yyscan_t;
input
: command { $$ = $1; }
| input T_SEPARATOR command { phpdbg_stack_separate($1.top); $$ = $3; }
- | /* empty */
+ | %empty
;
command
@@ -143,7 +143,7 @@ parameter
req_id
: T_REQ_ID { PHPDBG_G(req_id) = $1.num; }
- | /* empty */
+ | %empty
;
full_expression
diff --git a/sapi/phpdbg/phpdbg_print.c b/sapi/phpdbg/phpdbg_print.c
index 5f48bd6a59..7cc84b72dc 100644
--- a/sapi/phpdbg/phpdbg_print.c
+++ b/sapi/phpdbg/phpdbg_print.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_print.h b/sapi/phpdbg/phpdbg_print.h
index 66eae7bceb..79a77ad2a6 100644
--- a/sapi/phpdbg/phpdbg_print.h
+++ b/sapi/phpdbg/phpdbg_print.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_prompt.c b/sapi/phpdbg/phpdbg_prompt.c
index 24155a7860..a441d4d6ae 100644
--- a/sapi/phpdbg/phpdbg_prompt.c
+++ b/sapi/phpdbg/phpdbg_prompt.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -728,7 +726,7 @@ static inline void phpdbg_handle_exception(void) /* {{{ */
EG(exception) = NULL;
ZVAL_OBJ(&zv, ex);
- zend_call_method_with_0_params(&zv, ex->ce, &ex->ce->__tostring, "__tostring", &tmp);
+ zend_call_method_with_0_params(ex, ex->ce, &ex->ce->__tostring, "__tostring", &tmp);
file = zval_get_string(zend_read_property(zend_get_exception_base(&zv), &zv, ZEND_STRL("file"), 1, &rv));
line = zval_get_long(zend_read_property(zend_get_exception_base(&zv), &zv, ZEND_STRL("line"), 1, &rv));
diff --git a/sapi/phpdbg/phpdbg_prompt.h b/sapi/phpdbg/phpdbg_prompt.h
index 142581783a..2c2c3d2047 100644
--- a/sapi/phpdbg/phpdbg_prompt.h
+++ b/sapi/phpdbg/phpdbg_prompt.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_rinit_hook.c b/sapi/phpdbg/phpdbg_rinit_hook.c
index 2bc1c59b90..92013f5499 100644
--- a/sapi/phpdbg/phpdbg_rinit_hook.c
+++ b/sapi/phpdbg/phpdbg_rinit_hook.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_rinit_hook.h b/sapi/phpdbg/phpdbg_rinit_hook.h
index a350ddec54..58b59d1947 100644
--- a/sapi/phpdbg/phpdbg_rinit_hook.h
+++ b/sapi/phpdbg/phpdbg_rinit_hook.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_set.c b/sapi/phpdbg/phpdbg_set.c
index da3ec4cf19..e994ee3fa4 100644
--- a/sapi/phpdbg/phpdbg_set.c
+++ b/sapi/phpdbg/phpdbg_set.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_set.h b/sapi/phpdbg/phpdbg_set.h
index 7f89d9182d..ffc55142ed 100644
--- a/sapi/phpdbg/phpdbg_set.h
+++ b/sapi/phpdbg/phpdbg_set.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_sigio_win32.c b/sapi/phpdbg/phpdbg_sigio_win32.c
index f3221d09cb..fb3254ac4b 100644
--- a/sapi/phpdbg/phpdbg_sigio_win32.c
+++ b/sapi/phpdbg/phpdbg_sigio_win32.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_sigio_win32.h b/sapi/phpdbg/phpdbg_sigio_win32.h
index af7b9f10cb..62c7dd606e 100644
--- a/sapi/phpdbg/phpdbg_sigio_win32.h
+++ b/sapi/phpdbg/phpdbg_sigio_win32.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_utils.c b/sapi/phpdbg/phpdbg_utils.c
index 857b5e3311..1efad03a79 100644
--- a/sapi/phpdbg/phpdbg_utils.c
+++ b/sapi/phpdbg/phpdbg_utils.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -41,7 +39,7 @@
ZEND_EXTERN_MODULE_GLOBALS(phpdbg)
/* {{{ color structures */
-const static phpdbg_color_t colors[] = {
+static const phpdbg_color_t colors[] = {
PHPDBG_COLOR_D("none", "0;0"),
PHPDBG_COLOR_D("white", "0;64"),
@@ -72,7 +70,7 @@ const static phpdbg_color_t colors[] = {
}; /* }}} */
/* {{{ */
-const static phpdbg_element_t elements[] = {
+static const phpdbg_element_t elements[] = {
PHPDBG_ELEMENT_D("prompt", PHPDBG_COLOR_PROMPT),
PHPDBG_ELEMENT_D("error", PHPDBG_COLOR_ERROR),
PHPDBG_ELEMENT_D("notice", PHPDBG_COLOR_NOTICE),
diff --git a/sapi/phpdbg/phpdbg_utils.h b/sapi/phpdbg/phpdbg_utils.h
index c212056670..508bb89c80 100644
--- a/sapi/phpdbg/phpdbg_utils.h
+++ b/sapi/phpdbg/phpdbg_utils.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_wait.c b/sapi/phpdbg/phpdbg_wait.c
index 69be24a953..593b795b66 100644
--- a/sapi/phpdbg/phpdbg_wait.c
+++ b/sapi/phpdbg/phpdbg_wait.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_wait.h b/sapi/phpdbg/phpdbg_wait.h
index b748e162bb..5d5ea0450c 100644
--- a/sapi/phpdbg/phpdbg_wait.h
+++ b/sapi/phpdbg/phpdbg_wait.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_watch.c b/sapi/phpdbg/phpdbg_watch.c
index d9f9f8673f..69dff94eb6 100644
--- a/sapi/phpdbg/phpdbg_watch.c
+++ b/sapi/phpdbg/phpdbg_watch.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -1073,7 +1071,7 @@ void phpdbg_reenable_memory_watches(void) {
phpdbg_watchpoint_t *watch;
ZEND_HASH_FOREACH_NUM_KEY(PHPDBG_G(watchlist_mem), page) {
- /* Disble writing again if there are any watchers on that page */
+ /* Disable writing again if there are any watchers on that page */
res = phpdbg_btree_find_closest(&PHPDBG_G(watchpoint_tree), page + phpdbg_pagesize - 1);
if (res) {
watch = res->ptr;
diff --git a/sapi/phpdbg/phpdbg_watch.h b/sapi/phpdbg/phpdbg_watch.h
index 313df624ea..f7b3fddcc2 100644
--- a/sapi/phpdbg/phpdbg_watch.h
+++ b/sapi/phpdbg/phpdbg_watch.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_webdata_transfer.c b/sapi/phpdbg/phpdbg_webdata_transfer.c
index 36d327f56f..85e4c25a61 100644
--- a/sapi/phpdbg/phpdbg_webdata_transfer.c
+++ b/sapi/phpdbg/phpdbg_webdata_transfer.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_webdata_transfer.h b/sapi/phpdbg/phpdbg_webdata_transfer.h
index c08c6e8f93..e840030eac 100644
--- a/sapi/phpdbg/phpdbg_webdata_transfer.h
+++ b/sapi/phpdbg/phpdbg_webdata_transfer.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_win.c b/sapi/phpdbg/phpdbg_win.c
index 6bf79981e0..1b1787526f 100644
--- a/sapi/phpdbg/phpdbg_win.c
+++ b/sapi/phpdbg/phpdbg_win.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/phpdbg_win.h b/sapi/phpdbg/phpdbg_win.h
index ba83062301..44874a50a5 100644
--- a/sapi/phpdbg/phpdbg_win.h
+++ b/sapi/phpdbg/phpdbg_win.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/sapi/phpdbg/tests/bug78297.phpt b/sapi/phpdbg/tests/bug78297.phpt
index 47b13ad605..7fa904b03a 100644
--- a/sapi/phpdbg/tests/bug78297.phpt
+++ b/sapi/phpdbg/tests/bug78297.phpt
@@ -9,8 +9,8 @@ include "does_not_exist.php";
--EXPECTF--
[Successful compilation of %s]
prompt>
-Warning: include(%s): failed to open stream: No such file or directory in %s on line %d
+Warning: include(%s): Failed to open stream: No such file or directory in %s on line %d
Warning: include(): Failed opening 'does_not_exist.php' for inclusion (include_path=%s) in %s on line %d
[Script ended normally]
-prompt>
+prompt>
diff --git a/scripts/dev/bless_tests.php b/scripts/dev/bless_tests.php
index fbbfe505c9..b772f00cc1 100755
--- a/scripts/dev/bless_tests.php
+++ b/scripts/dev/bless_tests.php
@@ -19,13 +19,26 @@ foreach ($files as $path) {
}
$phpt = file_get_contents($path);
+ $out = file_get_contents($outPath);
+
if (false !== strpos($phpt, '--XFAIL--')) {
// Don't modify expected output of XFAIL tests
continue;
}
- $out = file_get_contents($outPath);
- $out = normalizeOutput($out);
+ // Don't update EXPECTREGEX tests
+ if (!preg_match('/--EXPECT(F?)--(.*)$/s', $phpt, $matches)) {
+ continue;
+ }
+
+ $oldExpect = trim($matches[2]);
+ $isFormat = $matches[1] == 'F';
+ if ($isFormat) {
+ $out = generateMinimallyDifferingOutput($out, $oldExpect);
+ } else {
+ $out = normalizeOutput($out);
+ }
+
$phpt = insertOutput($phpt, $out);
file_put_contents($path, $phpt);
}
@@ -62,9 +75,160 @@ function normalizeOutput(string $out): string {
return $out;
}
+function formatToRegex(string $format): string {
+ $result = preg_quote($format, '/');
+ $result = str_replace('%d', '\d+', $result);
+ $result = str_replace('%s', '[^\r\n]+', $result);
+ return "/^$result$/s";
+}
+
+function generateMinimallyDifferingOutput(string $out, string $oldExpect) {
+ $outLines = explode("\n", $out);
+ $oldExpectLines = explode("\n", $oldExpect);
+ $differ = new Differ(function($oldExpect, $new) {
+ if (strpos($oldExpect, '%') === false) {
+ return $oldExpect === $new;
+ }
+ return preg_match(formatToRegex($oldExpect), $new);
+ });
+ $diff = $differ->diff($oldExpectLines, $outLines);
+
+ $result = [];
+ foreach ($diff as $elem) {
+ if ($elem->type == DiffElem::TYPE_KEEP) {
+ $result[] = $elem->old;
+ } else if ($elem->type == DiffElem::TYPE_ADD) {
+ $result[] = normalizeOutput($elem->new);
+ }
+ }
+ return implode("\n", $result);
+}
+
function insertOutput(string $phpt, string $out): string {
return preg_replace_callback('/--EXPECTF?--.*$/s', function($matches) use($out) {
$F = strpos($out, '%') !== false ? 'F' : '';
return "--EXPECT$F--\n" . $out . "\n";
}, $phpt);
}
+
+/**
+ * Implementation of the the Myers diff algorithm.
+ *
+ * Myers, Eugene W. "An O (ND) difference algorithm and its variations."
+ * Algorithmica 1.1 (1986): 251-266.
+ */
+
+class DiffElem
+{
+ const TYPE_KEEP = 0;
+ const TYPE_REMOVE = 1;
+ const TYPE_ADD = 2;
+
+ /** @var int One of the TYPE_* constants */
+ public $type;
+ /** @var mixed Is null for add operations */
+ public $old;
+ /** @var mixed Is null for remove operations */
+ public $new;
+
+ public function __construct(int $type, $old, $new) {
+ $this->type = $type;
+ $this->old = $old;
+ $this->new = $new;
+ }
+}
+
+class Differ
+{
+ private $isEqual;
+
+ /**
+ * Create differ over the given equality relation.
+ *
+ * @param callable $isEqual Equality relation with signature function($a, $b) : bool
+ */
+ public function __construct(callable $isEqual) {
+ $this->isEqual = $isEqual;
+ }
+
+ /**
+ * Calculate diff (edit script) from $old to $new.
+ *
+ * @param array $old Original array
+ * @param array $new New array
+ *
+ * @return DiffElem[] Diff (edit script)
+ */
+ public function diff(array $old, array $new) {
+ list($trace, $x, $y) = $this->calculateTrace($old, $new);
+ return $this->extractDiff($trace, $x, $y, $old, $new);
+ }
+
+ private function calculateTrace(array $a, array $b) {
+ $n = \count($a);
+ $m = \count($b);
+ $max = $n + $m;
+ $v = [1 => 0];
+ $trace = [];
+ for ($d = 0; $d <= $max; $d++) {
+ $trace[] = $v;
+ for ($k = -$d; $k <= $d; $k += 2) {
+ if ($k === -$d || ($k !== $d && $v[$k-1] < $v[$k+1])) {
+ $x = $v[$k+1];
+ } else {
+ $x = $v[$k-1] + 1;
+ }
+
+ $y = $x - $k;
+ while ($x < $n && $y < $m && ($this->isEqual)($a[$x], $b[$y])) {
+ $x++;
+ $y++;
+ }
+
+ $v[$k] = $x;
+ if ($x >= $n && $y >= $m) {
+ return [$trace, $x, $y];
+ }
+ }
+ }
+ throw new \Exception('Should not happen');
+ }
+
+ private function extractDiff(array $trace, int $x, int $y, array $a, array $b) {
+ $result = [];
+ for ($d = \count($trace) - 1; $d >= 0; $d--) {
+ $v = $trace[$d];
+ $k = $x - $y;
+
+ if ($k === -$d || ($k !== $d && $v[$k-1] < $v[$k+1])) {
+ $prevK = $k + 1;
+ } else {
+ $prevK = $k - 1;
+ }
+
+ $prevX = $v[$prevK];
+ $prevY = $prevX - $prevK;
+
+ while ($x > $prevX && $y > $prevY) {
+ $result[] = new DiffElem(DiffElem::TYPE_KEEP, $a[$x-1], $b[$y-1]);
+ $x--;
+ $y--;
+ }
+
+ if ($d === 0) {
+ break;
+ }
+
+ while ($x > $prevX) {
+ $result[] = new DiffElem(DiffElem::TYPE_REMOVE, $a[$x-1], null);
+ $x--;
+ }
+
+ while ($y > $prevY) {
+ $result[] = new DiffElem(DiffElem::TYPE_ADD, null, $b[$y-1]);
+ $y--;
+ }
+ }
+ return array_reverse($result);
+ }
+}
diff --git a/scripts/dev/check_parameters.php b/scripts/dev/check_parameters.php
index e779d3daee..52424def1e 100755
--- a/scripts/dev/check_parameters.php
+++ b/scripts/dev/check_parameters.php
@@ -2,8 +2,6 @@
<?php
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/scripts/dev/gen_stub.php b/scripts/dev/gen_stub.php
new file mode 100755
index 0000000000..253c188b2a
--- /dev/null
+++ b/scripts/dev/gen_stub.php
@@ -0,0 +1,640 @@
+#!/usr/bin/env php
+<?php declare(strict_types=1);
+
+use PhpParser\Node;
+use PhpParser\Node\Expr;
+use PhpParser\Node\Stmt;
+
+error_reporting(E_ALL);
+
+try {
+ initPhpParser();
+} catch (Exception $e) {
+ echo "{$e->getMessage()}\n";
+ exit(1);
+}
+
+if ($argc >= 2) {
+ if (is_file($argv[1])) {
+ // Generate single file.
+ processStubFile($argv[1]);
+ } else if (is_dir($argv[1])) {
+ processDirectory($argv[1]);
+ } else {
+ echo "$argv[1] is neither a file nor a directory.\n";
+ exit(1);
+ }
+} else {
+ // Regenerate all stub files we can find.
+ processDirectory('.');
+}
+
+function processDirectory(string $dir) {
+ $it = new RecursiveIteratorIterator(
+ new RecursiveDirectoryIterator($dir),
+ RecursiveIteratorIterator::LEAVES_ONLY
+ );
+ foreach ($it as $file) {
+ $pathName = $file->getPathName();
+ if (preg_match('/\.stub\.php$/', $pathName)) {
+ processStubFile($pathName);
+ }
+ }
+}
+
+function processStubFile(string $stubFile) {
+ $arginfoFile = str_replace('.stub.php', '', $stubFile) . '_arginfo.h';
+
+ try {
+ $funcInfos = parseStubFile($stubFile);
+ $arginfoCode = generateArgInfoCode($funcInfos);
+ file_put_contents($arginfoFile, $arginfoCode);
+ } catch (Exception $e) {
+ echo "In $stubFile:\n{$e->getMessage()}\n";
+ exit(1);
+ }
+}
+
+class SimpleType {
+ /** @var string */
+ public $name;
+ /** @var bool */
+ public $isBuiltin;
+
+ public function __construct(string $name, bool $isBuiltin) {
+ $this->name = $name;
+ $this->isBuiltin = $isBuiltin;
+ }
+
+ public static function fromNode(Node $node) {
+ if ($node instanceof Node\Name) {
+ assert($node->isFullyQualified());
+ return new SimpleType($node->toString(), false);
+ }
+ if ($node instanceof Node\Identifier) {
+ return new SimpleType($node->toString(), true);
+ }
+ throw new Exception("Unexpected node type");
+ }
+
+ public function isNull() {
+ return $this->isBuiltin && $this->name === 'null';
+ }
+
+ public function toTypeCode() {
+ assert($this->isBuiltin);
+ switch (strtolower($this->name)) {
+ case "bool":
+ return "_IS_BOOL";
+ case "int":
+ return "IS_LONG";
+ case "float":
+ return "IS_DOUBLE";
+ case "string":
+ return "IS_STRING";
+ case "array":
+ return "IS_ARRAY";
+ case "object":
+ return "IS_OBJECT";
+ case "void":
+ return "IS_VOID";
+ case "callable":
+ return "IS_CALLABLE";
+ default:
+ throw new Exception("Not implemented: $this->name");
+ }
+ }
+
+ public function toTypeMask() {
+ assert($this->isBuiltin);
+ switch (strtolower($this->name)) {
+ case "null":
+ return "MAY_BE_NULL";
+ case "false":
+ return "MAY_BE_FALSE";
+ case "bool":
+ return "MAY_BE_BOOL";
+ case "int":
+ return "MAY_BE_LONG";
+ case "float":
+ return "MAY_BE_DOUBLE";
+ case "string":
+ return "MAY_BE_STRING";
+ case "array":
+ return "MAY_BE_ARRAY";
+ case "object":
+ return "MAY_BE_OBJECT";
+ case "callable":
+ return "MAY_BE_CALLABLE";
+ default:
+ throw new Exception("Not implemented: $this->name");
+ }
+ }
+
+ public function toEscapedName(): string {
+ return str_replace('\\', '\\\\', $this->name);
+ }
+
+ public function equals(SimpleType $other) {
+ return $this->name === $other->name
+ && $this->isBuiltin === $other->isBuiltin;
+ }
+}
+
+class Type {
+ /** @var SimpleType[] $types */
+ public $types;
+
+ public function __construct(array $types) {
+ $this->types = $types;
+ }
+
+ public static function fromNode(Node $node) {
+ if ($node instanceof Node\UnionType) {
+ return new Type(array_map(['SimpleType', 'fromNode'], $node->types));
+ }
+ if ($node instanceof Node\NullableType) {
+ return new Type([
+ SimpleType::fromNode($node->type),
+ new SimpleType('null', true),
+ ]);
+ }
+ return new Type([SimpleType::fromNode($node)]);
+ }
+
+ public function isNullable(): bool {
+ foreach ($this->types as $type) {
+ if ($type->isNull()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public function getWithoutNull(): Type {
+ return new Type(array_filter($this->types, function(SimpleType $type) {
+ return !$type->isNull();
+ }));
+ }
+
+ public function tryToSimpleType(): ?SimpleType {
+ $withoutNull = $this->getWithoutNull();
+ if (count($withoutNull->types) === 1) {
+ return $withoutNull->types[0];
+ }
+ return null;
+ }
+
+ public function tryToRepresentableType(): ?RepresentableType {
+ $classType = null;
+ $builtinTypes = [];
+ foreach ($this->types as $type) {
+ if ($type->isBuiltin) {
+ $builtinTypes[] = $type;
+ } else if ($classType === null) {
+ $classType = $type;
+ } else {
+ // We can only represent a single class type.
+ return false;
+ }
+ }
+ return new RepresentableType($classType, $builtinTypes);
+ }
+
+ public static function equals(?Type $a, ?Type $b): bool {
+ if ($a === null || $b === null) {
+ return $a === $b;
+ }
+
+ if (count($a->types) !== count($b->types)) {
+ return false;
+ }
+
+ for ($i = 0; $i < count($a->types); $i++) {
+ if (!$a->types[$i]->equals($b->types[$i])) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+}
+
+class RepresentableType {
+ /** @var ?SimpleType $classType */
+ public $classType;
+ /** @var SimpleType[] $builtinTypes */
+ public $builtinTypes;
+
+ public function __construct(?SimpleType $classType, array $builtinTypes) {
+ $this->classType = $classType;
+ $this->builtinTypes = $builtinTypes;
+ }
+
+ public function toTypeMask(): string {
+ return implode('|', array_map(function(SimpleType $type) {
+ return $type->toTypeMask();
+ }, $this->builtinTypes));
+ }
+}
+
+class ArgInfo {
+ const SEND_BY_VAL = 0;
+ const SEND_BY_REF = 1;
+ const SEND_PREFER_REF = 2;
+
+ /** @var string */
+ public $name;
+ /** @var int */
+ public $sendBy;
+ /** @var bool */
+ public $isVariadic;
+ /** @var Type|null */
+ public $type;
+
+ public function __construct(string $name, int $sendBy, bool $isVariadic, ?Type $type) {
+ $this->name = $name;
+ $this->sendBy = $sendBy;
+ $this->isVariadic = $isVariadic;
+ $this->type = $type;
+ }
+
+ public function equals(ArgInfo $other): bool {
+ return $this->name === $other->name
+ && $this->sendBy === $other->sendBy
+ && $this->isVariadic === $other->isVariadic
+ && Type::equals($this->type, $other->type);
+ }
+
+ public function getSendByString(): string {
+ switch ($this->sendBy) {
+ case self::SEND_BY_VAL:
+ return "0";
+ case self::SEND_BY_REF:
+ return "1";
+ case self::SEND_PREFER_REF:
+ return "ZEND_SEND_PREFER_REF";
+ }
+ throw new Exception("Invalid sendBy value");
+ }
+}
+
+class ReturnInfo {
+ /** @var bool */
+ public $byRef;
+ /** @var Type|null */
+ public $type;
+
+ public function __construct(bool $byRef, ?Type $type) {
+ $this->byRef = $byRef;
+ $this->type = $type;
+ }
+
+ public function equals(ReturnInfo $other): bool {
+ return $this->byRef === $other->byRef
+ && Type::equals($this->type, $other->type);
+ }
+}
+
+class FuncInfo {
+ /** @var string */
+ public $name;
+ /** @var ArgInfo[] */
+ public $args;
+ /** @var ReturnInfo */
+ public $return;
+ /** @var int */
+ public $numRequiredArgs;
+ /** @var string|null */
+ public $cond;
+
+ public function __construct(
+ string $name, array $args, ReturnInfo $return, int $numRequiredArgs, ?string $cond
+ ) {
+ $this->name = $name;
+ $this->args = $args;
+ $this->return = $return;
+ $this->numRequiredArgs = $numRequiredArgs;
+ $this->cond = $cond;
+ }
+
+ public function equalsApartFromName(FuncInfo $other): bool {
+ if (count($this->args) !== count($other->args)) {
+ return false;
+ }
+
+ for ($i = 0; $i < count($this->args); $i++) {
+ if (!$this->args[$i]->equals($other->args[$i])) {
+ return false;
+ }
+ }
+
+ return $this->return->equals($other->return)
+ && $this->numRequiredArgs === $other->numRequiredArgs
+ && $this->cond === $other->cond;
+ }
+}
+
+function parseFunctionLike(string $name, Node\FunctionLike $func, ?string $cond): FuncInfo {
+ $comment = $func->getDocComment();
+ $paramMeta = [];
+
+ if ($comment) {
+ $commentText = substr($comment->getText(), 2, -2);
+
+ foreach (explode("\n", $commentText) as $commentLine) {
+ if (preg_match('/^\*\s*@prefer-ref\s+\$(.+)$/', trim($commentLine), $matches)) {
+ $varName = $matches[1];
+ if (!isset($paramMeta[$varName])) {
+ $paramMeta[$varName] = [];
+ }
+ $paramMeta[$varName]['preferRef'] = true;
+ }
+ }
+ }
+
+ $args = [];
+ $numRequiredArgs = 0;
+ $foundVariadic = false;
+ foreach ($func->getParams() as $i => $param) {
+ $varName = $param->var->name;
+ $preferRef = !empty($paramMeta[$varName]['preferRef']);
+ unset($paramMeta[$varName]);
+
+ if ($preferRef) {
+ $sendBy = ArgInfo::SEND_PREFER_REF;
+ } else if ($param->byRef) {
+ $sendBy = ArgInfo::SEND_BY_REF;
+ } else {
+ $sendBy = ArgInfo::SEND_BY_VAL;
+ }
+
+ if ($foundVariadic) {
+ throw new Exception("Error in function $name: only the last parameter can be variadic");
+ }
+
+ if ($param->default instanceof Expr\ConstFetch &&
+ $param->default->name->toLowerString() === "null" &&
+ $param->type && !($param->type instanceof Node\NullableType)
+ ) {
+ throw new Exception(
+ "Parameter $varName of function $name has null default, but is not nullable");
+ }
+
+ $foundVariadic = $param->variadic;
+
+ $args[] = new ArgInfo(
+ $varName,
+ $sendBy,
+ $param->variadic,
+ $param->type ? Type::fromNode($param->type) : null
+ );
+ if (!$param->default && !$param->variadic) {
+ $numRequiredArgs = $i + 1;
+ }
+ }
+
+ foreach (array_keys($paramMeta) as $var) {
+ throw new Exception("Found metadata for invalid param $var of function $name");
+ }
+
+ $returnType = $func->getReturnType();
+ $return = new ReturnInfo(
+ $func->returnsByRef(),
+ $returnType ? Type::fromNode($returnType) : null);
+ return new FuncInfo($name, $args, $return, $numRequiredArgs, $cond);
+}
+
+function handlePreprocessorConditions(array &$conds, Stmt $stmt): ?string {
+ foreach ($stmt->getComments() as $comment) {
+ $text = trim($comment->getText());
+ if (preg_match('/^#\s*if\s+(.+)$/', $text, $matches)) {
+ $conds[] = $matches[1];
+ } else if (preg_match('/^#\s*ifdef\s+(.+)$/', $text, $matches)) {
+ $conds[] = "defined($matches[1])";
+ } else if (preg_match('/^#\s*ifndef\s+(.+)$/', $text, $matches)) {
+ $conds[] = "!defined($matches[1])";
+ } else if (preg_match('/^#\s*else$/', $text)) {
+ if (empty($conds)) {
+ throw new Exception("Encountered else without corresponding #if");
+ }
+ $cond = array_pop($conds);
+ $conds[] = "!($cond)";
+ } else if (preg_match('/^#\s*endif$/', $text)) {
+ if (empty($conds)) {
+ throw new Exception("Encountered #endif without corresponding #if");
+ }
+ array_pop($conds);
+ } else if ($text[0] === '#') {
+ throw new Exception("Unrecognized preprocessor directive \"$text\"");
+ }
+ }
+
+ return empty($conds) ? null : implode(' && ', $conds);
+}
+
+/** @return FuncInfo[] */
+function parseStubFile(string $fileName) {
+ if (!file_exists($fileName)) {
+ throw new Exception("File $fileName does not exist");
+ }
+
+ $code = file_get_contents($fileName);
+
+ $lexer = new PhpParser\Lexer();
+ $parser = new PhpParser\Parser\Php7($lexer);
+ $nodeTraverser = new PhpParser\NodeTraverser;
+ $nodeTraverser->addVisitor(new PhpParser\NodeVisitor\NameResolver);
+
+ $stmts = $parser->parse($code);
+ $nodeTraverser->traverse($stmts);
+
+ $funcInfos = [];
+ $conds = [];
+ foreach ($stmts as $stmt) {
+ $cond = handlePreprocessorConditions($conds, $stmt);
+ if ($stmt instanceof Stmt\Nop) {
+ continue;
+ }
+
+ if ($stmt instanceof Stmt\Function_) {
+ $funcInfos[] = parseFunctionLike($stmt->name->toString(), $stmt, $cond);
+ continue;
+ }
+
+ if ($stmt instanceof Stmt\ClassLike) {
+ $className = $stmt->name->toString();
+ foreach ($stmt->stmts as $classStmt) {
+ $cond = handlePreprocessorConditions($conds, $classStmt);
+ if ($classStmt instanceof Stmt\Nop) {
+ continue;
+ }
+
+ if (!$classStmt instanceof Stmt\ClassMethod) {
+ throw new Exception("Not implemented {$classStmt->getType()}");
+ }
+
+ $funcInfos[] = parseFunctionLike(
+ 'class_' . $className . '_' . $classStmt->name->toString(), $classStmt, $cond);
+ }
+ continue;
+ }
+
+ throw new Exception("Unexpected node {$stmt->getType()}");
+ }
+
+ return $funcInfos;
+}
+
+function funcInfoToCode(FuncInfo $funcInfo): string {
+ $code = '';
+ $returnType = $funcInfo->return->type;
+ if ($returnType !== null) {
+ if (null !== $simpleReturnType = $returnType->tryToSimpleType()) {
+ if ($simpleReturnType->isBuiltin) {
+ $code .= sprintf(
+ "ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_%s, %d, %d, %s, %d)\n",
+ $funcInfo->name, $funcInfo->return->byRef, $funcInfo->numRequiredArgs,
+ $simpleReturnType->toTypeCode(), $returnType->isNullable()
+ );
+ } else {
+ $code .= sprintf(
+ "ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_%s, %d, %d, %s, %d)\n",
+ $funcInfo->name, $funcInfo->return->byRef, $funcInfo->numRequiredArgs,
+ $simpleReturnType->toEscapedName(), $returnType->isNullable()
+ );
+ }
+ } else if (null !== $representableType = $returnType->tryToRepresentableType()) {
+ if ($representableType->classType !== null) {
+ $code .= sprintf(
+ "ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_%s, %d, %d, %s, %s)\n",
+ $funcInfo->name, $funcInfo->return->byRef, $funcInfo->numRequiredArgs,
+ $representableType->classType->toEscapedName(), $representableType->toTypeMask()
+ );
+ } else {
+ $code .= sprintf(
+ "ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_%s, %d, %d, %s)\n",
+ $funcInfo->name, $funcInfo->return->byRef, $funcInfo->numRequiredArgs,
+ $representableType->toTypeMask()
+ );
+ }
+ } else {
+ throw new Exception('Unimplemented');
+ }
+ } else {
+ $code .= sprintf(
+ "ZEND_BEGIN_ARG_INFO_EX(arginfo_%s, 0, %d, %d)\n",
+ $funcInfo->name, $funcInfo->return->byRef, $funcInfo->numRequiredArgs
+ );
+ }
+
+ foreach ($funcInfo->args as $argInfo) {
+ $argKind = $argInfo->isVariadic ? "ARG_VARIADIC" : "ARG";
+ $argType = $argInfo->type;
+ if ($argType !== null) {
+ if (null !== $simpleArgType = $argType->tryToSimpleType()) {
+ if ($simpleArgType->isBuiltin) {
+ $code .= sprintf(
+ "\tZEND_%s_TYPE_INFO(%s, %s, %s, %d)\n",
+ $argKind, $argInfo->getSendByString(), $argInfo->name,
+ $simpleArgType->toTypeCode(), $argType->isNullable()
+ );
+ } else {
+ $code .= sprintf(
+ "\tZEND_%s_OBJ_INFO(%s, %s, %s, %d)\n",
+ $argKind, $argInfo->getSendByString(), $argInfo->name,
+ $simpleArgType->toEscapedName(), $argType->isNullable()
+ );
+ }
+ } else if (null !== $representableType = $argType->tryToRepresentableType()) {
+ if ($representableType->classType !== null) {
+ throw new Exception('Unimplemented');
+ }
+ $code .= sprintf(
+ "\tZEND_%s_TYPE_MASK(%s, %s, %s)\n",
+ $argKind, $argInfo->getSendByString(), $argInfo->name,
+ $representableType->toTypeMask()
+ );
+ } else {
+ throw new Exception('Unimplemented');
+ }
+ } else {
+ $code .= sprintf(
+ "\tZEND_%s_INFO(%s, %s)\n", $argKind, $argInfo->getSendByString(), $argInfo->name);
+ }
+ }
+
+ $code .= "ZEND_END_ARG_INFO()";
+ return $code;
+}
+
+function findEquivalentFuncInfo(array $generatedFuncInfos, $funcInfo): ?FuncInfo {
+ foreach ($generatedFuncInfos as $generatedFuncInfo) {
+ if ($generatedFuncInfo->equalsApartFromName($funcInfo)) {
+ return $generatedFuncInfo;
+ }
+ }
+ return null;
+}
+
+/** @param FuncInfo[] $funcInfos */
+function generateArginfoCode(array $funcInfos): string {
+ $code = "/* This is a generated file, edit the .stub.php file instead. */";
+ $generatedFuncInfos = [];
+ foreach ($funcInfos as $funcInfo) {
+ $code .= "\n\n";
+ if ($funcInfo->cond) {
+ $code .= "#if {$funcInfo->cond}\n";
+ }
+
+ /* If there already is an equivalent arginfo structure, only emit a #define */
+ if ($generatedFuncInfo = findEquivalentFuncInfo($generatedFuncInfos, $funcInfo)) {
+ $code .= sprintf(
+ "#define arginfo_%s arginfo_%s",
+ $funcInfo->name, $generatedFuncInfo->name
+ );
+ } else {
+ $code .= funcInfoToCode($funcInfo);
+ }
+
+ if ($funcInfo->cond) {
+ $code .= "\n#endif";
+ }
+
+ $generatedFuncInfos[] = $funcInfo;
+ }
+ return $code . "\n";
+}
+
+function initPhpParser() {
+ $version = "4.3.0";
+ $phpParserDir = __DIR__ . "/PHP-Parser-$version";
+ if (!is_dir($phpParserDir)) {
+ $cwd = getcwd();
+ chdir(__DIR__);
+
+ passthru("wget https://github.com/nikic/PHP-Parser/archive/v$version.tar.gz", $exit);
+ if ($exit !== 0) {
+ passthru("curl -LO https://github.com/nikic/PHP-Parser/archive/v$version.tar.gz", $exit);
+ }
+ if ($exit !== 0) {
+ throw new Exception("Failed to download PHP-Parser tarball");
+ }
+ if (!mkdir($phpParserDir)) {
+ throw new Exception("Failed to create directory $phpParserDir");
+ }
+ passthru("tar xvzf v$version.tar.gz -C PHP-Parser-$version --strip-components 1", $exit);
+ if ($exit !== 0) {
+ throw new Exception("Failed to extract PHP-Parser tarball");
+ }
+ unlink(__DIR__ . "/v$version.tar.gz");
+ chdir($cwd);
+ }
+
+ spl_autoload_register(function(string $class) use($phpParserDir) {
+ if (strpos($class, "PhpParser\\") === 0) {
+ $fileName = $phpParserDir . "/lib/" . str_replace("\\", "/", $class) . ".php";
+ require $fileName;
+ }
+ });
+}
diff --git a/scripts/dev/genfiles b/scripts/dev/genfiles
index d29c0d778a..ffdfcdc3ca 100755
--- a/scripts/dev/genfiles
+++ b/scripts/dev/genfiles
@@ -1,8 +1,6 @@
#!/bin/sh
#
# +----------------------------------------------------------------------+
-# | PHP Version 7 |
-# +----------------------------------------------------------------------+
# | Copyright (c) The PHP Group |
# +----------------------------------------------------------------------+
# | This source file is subject to version 3.01 of the PHP license, |
diff --git a/scripts/dev/search_underscores.php b/scripts/dev/search_underscores.php
index ff766bcf1f..bd74ea2af7 100755
--- a/scripts/dev/search_underscores.php
+++ b/scripts/dev/search_underscores.php
@@ -3,8 +3,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/scripts/dev/tidy.php b/scripts/dev/tidy.php
index 267f838a61..cf153ead55 100644
--- a/scripts/dev/tidy.php
+++ b/scripts/dev/tidy.php
@@ -22,6 +22,9 @@ $excludes = [
'ext/hash/php_hash_whirlpool_tables.h',
'ext/mbstring/libmbfl/',
'ext/mbstring/unicode_data.h',
+ 'ext/opcache/jit/dynasm',
+ 'ext/opcache/jit/libudis86',
+ 'ext/opcache/jit/vtune',
'ext/pcre/pcre2lib/',
'ext/standard/html_tables/html_table_gen.php',
'ext/xmlrpc/libxmlrpc/',
@@ -62,12 +65,11 @@ foreach ($it as $file) {
$code = stripTrailingWhitespace($code);
$code = reindentToSpaces($code);
} else if ($lang === 'phpt') {
- // TODO: Don't reformat .phpt on PHP-7.4.
- /*$code = transformTestCode($code, function(string $code) {
+ $code = transformTestCode($code, function(string $code) {
$code = stripTrailingWhitespace($code);
$code = reindentToSpaces($code);
return $code;
- });*/
+ });
}
if ($origCode !== $code) {
@@ -134,8 +136,7 @@ function getLanguageFromExtension(string $ext): ?string {
case 're':
return 'c';
case 'php':
- // TODO: Reformat .inc files.
- //case 'inc':
+ case 'inc':
return 'php';
case 'phpt':
return 'phpt';
diff --git a/tests/basic/011.phpt b/tests/basic/011.phpt
index b5c769d9bd..03fccaa9b7 100644
--- a/tests/basic/011.phpt
+++ b/tests/basic/011.phpt
@@ -10,7 +10,7 @@ $argc = $_SERVER['argc'];
$argv = $_SERVER['argv'];
for ($i=0; $i<$argc; $i++) {
- echo "$i: ".$argv[$i]."\n";
+ echo "$i: ".$argv[$i]."\n";
}
?>
diff --git a/tests/basic/012.phpt b/tests/basic/012.phpt
index 038d4beff9..37e5ecd809 100644
--- a/tests/basic/012.phpt
+++ b/tests/basic/012.phpt
@@ -1,7 +1,5 @@
--TEST--
Testing $argc and $argv handling (cli)
---SKIPIF--
-<?php if(php_sapi_name()!='cli') echo 'skip'; ?>
--INI--
register_argc_argv=1
variables_order=GPS
@@ -13,7 +11,7 @@ $argc = $_SERVER['argc'];
$argv = $_SERVER['argv'];
for ($i=1; $i<$argc; $i++) {
- echo ($i-1).": ".$argv[$i]."\n";
+ echo ($i-1).": ".$argv[$i]."\n";
}
?>
diff --git a/tests/basic/025.phpt b/tests/basic/025.phpt
index 37561a2a2e..30d50c805d 100644
--- a/tests/basic/025.phpt
+++ b/tests/basic/025.phpt
@@ -15,7 +15,7 @@ Warning: Unknown: POST Content-Length of 2050 bytes exceeds the limit of 1024 by
Warning: Cannot modify header information - headers already sent in Unknown on line 0
-Notice: Undefined variable: HTTP_RAW_POST_DATA in %s on line %d
+Warning: Undefined variable: HTTP_RAW_POST_DATA in %s on line %d
array(0) {
}
NULL
diff --git a/tests/basic/027.phpt b/tests/basic/027.phpt
deleted file mode 100644
index 0528e835a1..0000000000
--- a/tests/basic/027.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-Handling of max_input_nesting_level being reached
---INI--
-always_populate_raw_post_data=0
-display_errors=0
-max_input_nesting_level=10
-max_input_vars=1000
-track_errors=1
-log_errors=0
---POST--
-a=1&b=ZYX&c[][][][][][][][][][][][][][][][][][][][][][]=123&d=123&e[][]][]=3
---FILE--
-<?php
-var_dump($_POST, $php_errormsg);
-?>
---EXPECT--
-array(4) {
- ["a"]=>
- string(1) "1"
- ["b"]=>
- string(3) "ZYX"
- ["d"]=>
- string(3) "123"
- ["e"]=>
- array(1) {
- [0]=>
- array(1) {
- [0]=>
- string(1) "3"
- }
- }
-}
-string(115) "Unknown: Input variable nesting level exceeded 10. To increase the limit change max_input_nesting_level in php.ini."
diff --git a/tests/basic/bug20539.phpt b/tests/basic/bug20539.phpt
index 2b84d14189..99a88f66b5 100644
--- a/tests/basic/bug20539.phpt
+++ b/tests/basic/bug20539.phpt
@@ -9,10 +9,10 @@ session.save_handler=files
session.save_path=./tests/basic/
--FILE--
<?php
- print "good :)\n";
- $filename = __DIR__ . '/sess_' . session_id();
- var_dump(file_exists($filename));
- @unlink($filename);
+ print "good :)\n";
+ $filename = __DIR__ . '/sess_' . session_id();
+ var_dump(file_exists($filename));
+ @unlink($filename);
?>
--EXPECT--
good :)
diff --git a/tests/basic/bug54514.phpt b/tests/basic/bug54514.phpt
index 0c5595e3f7..6133ee2caf 100644
--- a/tests/basic/bug54514.phpt
+++ b/tests/basic/bug54514.phpt
@@ -3,10 +3,10 @@ Req #54514 (Get php binary path during script execution)
--FILE--
<?php
if(realpath(getenv('TEST_PHP_EXECUTABLE')) === realpath(PHP_BINARY)) {
- echo "done";
+ echo "done";
} else {
- var_dump(getenv('TEST_PHP_EXECUTABLE'));
- var_dump(PHP_BINARY);
+ var_dump(getenv('TEST_PHP_EXECUTABLE'));
+ var_dump(PHP_BINARY);
}
--EXPECT--
done
diff --git a/tests/basic/bug71273.phpt b/tests/basic/bug71273.phpt
index 3db4454605..7634d432d0 100644
--- a/tests/basic/bug71273.phpt
+++ b/tests/basic/bug71273.phpt
@@ -1,21 +1,13 @@
--TEST--
Bug #71273 A wrong ext directory setup in php.ini leads to crash
---SKIPIF--
-<?php
- if ("cli" != php_sapi_name()) {
- die("skip CLI only");
- }
-?>
--FILE--
<?php
- /* NOTE this file is required to be encoded in iso-8859-1 */
+ /* NOTE this file is required to be encoded in iso-8859-1 */
- $cmd = getenv('TEST_PHP_EXECUTABLE') . " -n -d html_errors=on -d extension_dir=a/é/w -d extension=php_kartoffelbrei.dll -v 2>&1";
- $out = shell_exec($cmd);
+ $cmd = getenv('TEST_PHP_EXECUTABLE') . " -n -d html_errors=on -d extension_dir=a/é/w -d extension=php_kartoffelbrei.dll -v 2>&1";
+ $out = shell_exec($cmd);
- var_dump(preg_match(",.+a[\\/].+[\\/]w.php_kartoffelbrei.dll.+,s", $out));
+ var_dump(preg_match(",.+a[\\/].+[\\/]w.php_kartoffelbrei.dll.+,s", $out));
?>
-==DONE==
--EXPECT--
int(1)
-==DONE==
diff --git a/tests/basic/enable_post_data_reading_01.phpt b/tests/basic/enable_post_data_reading_01.phpt
index 19ee5d583f..d717b2b0b0 100644
--- a/tests/basic/enable_post_data_reading_01.phpt
+++ b/tests/basic/enable_post_data_reading_01.phpt
@@ -18,7 +18,7 @@ array(0) {
array(0) {
}
-Notice: Undefined variable: HTTP_RAW_POST_DATA in %s on line %d
+Warning: Undefined variable: HTTP_RAW_POST_DATA in %s on line %d
NULL
string(9) "a=1&b=ZYX"
string(9) "a=1&b=ZYX"
diff --git a/tests/basic/enable_post_data_reading_03.phpt b/tests/basic/enable_post_data_reading_03.phpt
index 6a62282ea2..5982f61c91 100644
--- a/tests/basic/enable_post_data_reading_03.phpt
+++ b/tests/basic/enable_post_data_reading_03.phpt
@@ -19,7 +19,7 @@ array(0) {
array(0) {
}
-Notice: Undefined variable: HTTP_RAW_POST_DATA in %s on line %d
+Warning: Undefined variable: HTTP_RAW_POST_DATA in %s on line %d
NULL
string(9) "a=1&b=ZYX"
string(9) "a=1&b=ZYX"
diff --git a/tests/basic/enable_post_data_reading_04.phpt b/tests/basic/enable_post_data_reading_04.phpt
index a7c7e496d8..17432e9298 100644
--- a/tests/basic/enable_post_data_reading_04.phpt
+++ b/tests/basic/enable_post_data_reading_04.phpt
@@ -19,7 +19,7 @@ array(0) {
array(0) {
}
-Notice: Undefined variable: HTTP_RAW_POST_DATA in %s on line %d
+Warning: Undefined variable: HTTP_RAW_POST_DATA in %s on line %d
NULL
string(9) "a=1&b=ZYX"
string(9) "a=1&b=ZYX"
diff --git a/tests/basic/enable_post_data_reading_05.phpt b/tests/basic/enable_post_data_reading_05.phpt
index d8efa0129e..f6695f84c4 100644
--- a/tests/basic/enable_post_data_reading_05.phpt
+++ b/tests/basic/enable_post_data_reading_05.phpt
@@ -14,7 +14,7 @@ $f1 = fopen("php://input", "r");
$f2 = fopen("php://input", "r");
while (!feof($f1) && !feof($f2)) {
- echo fgetc($f1), fgetc($f2);
+ echo fgetc($f1), fgetc($f2);
}
?>
diff --git a/tests/basic/enable_post_data_reading_06.phpt b/tests/basic/enable_post_data_reading_06.phpt
index fbed195c03..8e9db3a1d8 100644
--- a/tests/basic/enable_post_data_reading_06.phpt
+++ b/tests/basic/enable_post_data_reading_06.phpt
@@ -95,7 +95,7 @@ $f1 = fopen("php://input", "r");
$f2 = fopen("php://input", "r");
while (!feof($f1) && !feof($f2)) {
- echo fgets($f1), fgets($f2);
+ echo fgets($f1), fgets($f2);
}
?>
diff --git a/tests/basic/rfc1867_empty_upload.phpt b/tests/basic/rfc1867_empty_upload.phpt
index 77fe53ea58..2b89ca8888 100644
--- a/tests/basic/rfc1867_empty_upload.phpt
+++ b/tests/basic/rfc1867_empty_upload.phpt
@@ -31,10 +31,10 @@ Content-Type: text/plain-file3
var_dump($_FILES);
var_dump($_POST);
if (is_uploaded_file($_FILES["file1"]["tmp_name"])) {
- var_dump(file_get_contents($_FILES["file1"]["tmp_name"]));
+ var_dump(file_get_contents($_FILES["file1"]["tmp_name"]));
}
if (is_uploaded_file($_FILES["file3"]["tmp_name"])) {
- var_dump(file_get_contents($_FILES["file3"]["tmp_name"]));
+ var_dump(file_get_contents($_FILES["file3"]["tmp_name"]));
}
?>
--EXPECTF--
diff --git a/tests/basic/rfc1867_max_file_size.phpt b/tests/basic/rfc1867_max_file_size.phpt
index 89406a407f..8d585f7503 100644
--- a/tests/basic/rfc1867_max_file_size.phpt
+++ b/tests/basic/rfc1867_max_file_size.phpt
@@ -31,10 +31,10 @@ Content-Type: text/plain-file3;
var_dump($_FILES);
var_dump($_POST);
if (is_uploaded_file($_FILES["file1"]["tmp_name"])) {
- var_dump(file_get_contents($_FILES["file1"]["tmp_name"]));
+ var_dump(file_get_contents($_FILES["file1"]["tmp_name"]));
}
if (is_uploaded_file($_FILES["file3"]["tmp_name"])) {
- var_dump(file_get_contents($_FILES["file3"]["tmp_name"]));
+ var_dump(file_get_contents($_FILES["file3"]["tmp_name"]));
}
?>
--EXPECTF--
diff --git a/tests/basic/rfc1867_max_file_uploads_empty_files.phpt b/tests/basic/rfc1867_max_file_uploads_empty_files.phpt
index 6ea7915c25..b85ed20971 100644
--- a/tests/basic/rfc1867_max_file_uploads_empty_files.phpt
+++ b/tests/basic/rfc1867_max_file_uploads_empty_files.phpt
@@ -31,10 +31,10 @@ Content-Type: text/plain-file
var_dump($_FILES);
var_dump($_POST);
if (is_uploaded_file($_FILES["file1"]["tmp_name"])) {
- var_dump(file_get_contents($_FILES["file1"]["tmp_name"]));
+ var_dump(file_get_contents($_FILES["file1"]["tmp_name"]));
}
if (is_uploaded_file($_FILES["file4"]["tmp_name"])) {
- var_dump(file_get_contents($_FILES["file4"]["tmp_name"]));
+ var_dump(file_get_contents($_FILES["file4"]["tmp_name"]));
}
?>
--EXPECTF--
diff --git a/tests/basic/rfc1867_post_max_filesize.phpt b/tests/basic/rfc1867_post_max_filesize.phpt
index 58e05319a1..b03220e915 100644
--- a/tests/basic/rfc1867_post_max_filesize.phpt
+++ b/tests/basic/rfc1867_post_max_filesize.phpt
@@ -27,10 +27,10 @@ Content-Type: text/plain-file3
var_dump($_FILES);
var_dump($_POST);
if (is_uploaded_file($_FILES["file1"]["tmp_name"])) {
- var_dump(file_get_contents($_FILES["file1"]["tmp_name"]));
+ var_dump(file_get_contents($_FILES["file1"]["tmp_name"]));
}
if (is_uploaded_file($_FILES["file3"]["tmp_name"])) {
- var_dump(file_get_contents($_FILES["file3"]["tmp_name"]));
+ var_dump(file_get_contents($_FILES["file3"]["tmp_name"]));
}
?>
--EXPECTF--
diff --git a/tests/classes/__call_001.phpt b/tests/classes/__call_001.phpt
index a70041ae16..654a020339 100644
--- a/tests/classes/__call_001.phpt
+++ b/tests/classes/__call_001.phpt
@@ -4,13 +4,13 @@ ZE2 __call()
<?php
class Caller {
- public $x = array(1, 2, 3);
+ public $x = array(1, 2, 3);
- function __call($m, $a) {
- echo "Method $m called:\n";
- var_dump($a);
- return $this->x;
- }
+ function __call($m, $a) {
+ echo "Method $m called:\n";
+ var_dump($a);
+ return $this->x;
+ }
}
$foo = new Caller();
diff --git a/tests/classes/__call_002.phpt b/tests/classes/__call_002.phpt
index f58ec47dcb..a0df5a2390 100644
--- a/tests/classes/__call_002.phpt
+++ b/tests/classes/__call_002.phpt
@@ -4,8 +4,8 @@ ZE2 __call() signature check
<?php
class Test {
- function __call() {
- }
+ function __call() {
+ }
}
?>
diff --git a/tests/classes/__call_004.phpt b/tests/classes/__call_004.phpt
index ca980c65f0..f8168cedab 100644
--- a/tests/classes/__call_004.phpt
+++ b/tests/classes/__call_004.phpt
@@ -3,24 +3,24 @@ When __call() is invoked via ::, ensure current scope's __call() is favoured ove
--FILE--
<?php
class A {
- function __call($strMethod, $arrArgs) {
- echo "In " . __METHOD__ . "($strMethod, array(" . implode(',',$arrArgs) . "))\n";
- var_dump($this);
- }
+ function __call($strMethod, $arrArgs) {
+ echo "In " . __METHOD__ . "($strMethod, array(" . implode(',',$arrArgs) . "))\n";
+ var_dump($this);
+ }
}
class B extends A {
- function __call($strMethod, $arrArgs) {
- echo "In " . __METHOD__ . "($strMethod, array(" . implode(',',$arrArgs) . "))\n";
- var_dump($this);
- }
+ function __call($strMethod, $arrArgs) {
+ echo "In " . __METHOD__ . "($strMethod, array(" . implode(',',$arrArgs) . "))\n";
+ var_dump($this);
+ }
- function test() {
- A::test1(1,'a');
- B::test2(1,'a');
- self::test3(1,'a');
- parent::test4(1,'a');
- }
+ function test() {
+ A::test1(1,'a');
+ B::test2(1,'a');
+ self::test3(1,'a');
+ parent::test4(1,'a');
+ }
}
$b = new B();
diff --git a/tests/classes/__call_005.phpt b/tests/classes/__call_005.phpt
index 33c4df8e49..8c4d52efa7 100644
--- a/tests/classes/__call_005.phpt
+++ b/tests/classes/__call_005.phpt
@@ -3,19 +3,19 @@ When __call() is invoked via ::, ensure private implementation of __call() in su
--FILE--
<?php
class A {
- private function __call($strMethod, $arrArgs) {
- echo "In " . __METHOD__ . "($strMethod, array(" . implode(',',$arrArgs) . "))\n";
- var_dump($this);
- }
+ private function __call($strMethod, $arrArgs) {
+ echo "In " . __METHOD__ . "($strMethod, array(" . implode(',',$arrArgs) . "))\n";
+ var_dump($this);
+ }
}
class B extends A {
- function test() {
- A::test1(1,'a');
- B::test2(1,'a');
- self::test3(1,'a');
- parent::test4(1,'a');
- }
+ function test() {
+ A::test1(1,'a');
+ B::test2(1,'a');
+ self::test3(1,'a');
+ parent::test4(1,'a');
+ }
}
$b = new B();
diff --git a/tests/classes/__call_006.phpt b/tests/classes/__call_006.phpt
index e6efdefe9e..6ffc75358f 100644
--- a/tests/classes/__call_006.phpt
+++ b/tests/classes/__call_006.phpt
@@ -3,54 +3,53 @@ Ensure exceptions are handled properly when thrown in __call.
--FILE--
<?php
class A {
- function __call($strMethod, $arrArgs) {
- var_dump($this);
- throw new Exception;
- echo "You should not see this";
- }
- function test() {
- A::unknownCalledWithSRO(1,2,3);
- }
+ function __call($strMethod, $arrArgs) {
+ var_dump($this);
+ throw new Exception;
+ echo "You should not see this";
+ }
+ function test() {
+ A::unknownCalledWithSRO(1,2,3);
+ }
}
class B extends A {
- function test() {
- B::unknownCalledWithSROFromChild(1,2,3);
- }
+ function test() {
+ B::unknownCalledWithSROFromChild(1,2,3);
+ }
}
$a = new A();
echo "---> Invoke __call via simple method call.\n";
try {
- $a->unknown();
+ $a->unknown();
} catch (Exception $e) {
- echo "Exception caught OK; continuing.\n";
+ echo "Exception caught OK; continuing.\n";
}
echo "\n\n---> Invoke __call via scope resolution operator within instance.\n";
try {
- $a->test();
+ $a->test();
} catch (Exception $e) {
- echo "Exception caught OK; continuing.\n";
+ echo "Exception caught OK; continuing.\n";
}
echo "\n\n---> Invoke __call via scope resolution operator within child instance.\n";
$b = new B();
try {
- $b->test();
+ $b->test();
} catch (Exception $e) {
- echo "Exception caught OK; continuing.\n";
+ echo "Exception caught OK; continuing.\n";
}
echo "\n\n---> Invoke __call via callback.\n";
try {
- call_user_func(array($b, 'unknownCallback'), 1,2,3);
+ call_user_func(array($b, 'unknownCallback'), 1,2,3);
} catch (Exception $e) {
- echo "Exception caught OK; continuing.\n";
+ echo "Exception caught OK; continuing.\n";
}
?>
-==DONE==
--EXPECTF--
---> Invoke __call via simple method call.
object(A)#%d (0) {
@@ -74,4 +73,3 @@ Exception caught OK; continuing.
object(B)#%d (0) {
}
Exception caught OK; continuing.
-==DONE==
diff --git a/tests/classes/__call_007.phpt b/tests/classes/__call_007.phpt
index a1dd4594e9..26dd8e29b6 100644
--- a/tests/classes/__call_007.phpt
+++ b/tests/classes/__call_007.phpt
@@ -3,54 +3,53 @@ Ensure exceptions are handled properly when thrown in a statically declared __ca
--FILE--
<?php
class A {
- static function __call($strMethod, $arrArgs) {
- @var_dump($this);
- throw new Exception;
- echo "You should not see this";
- }
- function test() {
- A::unknownCalledWithSRO(1,2,3);
- }
+ static function __call($strMethod, $arrArgs) {
+ @var_dump($this);
+ throw new Exception;
+ echo "You should not see this";
+ }
+ function test() {
+ A::unknownCalledWithSRO(1,2,3);
+ }
}
class B extends A {
- function test() {
- B::unknownCalledWithSROFromChild(1,2,3);
- }
+ function test() {
+ B::unknownCalledWithSROFromChild(1,2,3);
+ }
}
$a = new A();
echo "---> Invoke __call via simple method call.\n";
try {
- $a->unknown();
+ $a->unknown();
} catch (Exception $e) {
- echo "Exception caught OK; continuing.\n";
+ echo "Exception caught OK; continuing.\n";
}
echo "\n\n---> Invoke __call via scope resolution operator within instance.\n";
try {
- $a->test();
+ $a->test();
} catch (Exception $e) {
- echo "Exception caught OK; continuing.\n";
+ echo "Exception caught OK; continuing.\n";
}
echo "\n\n---> Invoke __call via scope resolution operator within child instance.\n";
$b = new B();
try {
- $b->test();
+ $b->test();
} catch (Exception $e) {
- echo "Exception caught OK; continuing.\n";
+ echo "Exception caught OK; continuing.\n";
}
echo "\n\n---> Invoke __call via callback.\n";
try {
- call_user_func(array($b, 'unknownCallback'), 1,2,3);
+ call_user_func(array($b, 'unknownCallback'), 1,2,3);
} catch (Exception $e) {
- echo "Exception caught OK; continuing.\n";
+ echo "Exception caught OK; continuing.\n";
}
?>
-==DONE==
--EXPECTF--
Warning: The magic method __call() must have public visibility and cannot be static in %s on line 3
---> Invoke __call via simple method call.
@@ -75,4 +74,3 @@ Exception caught OK; continuing.
object(B)#2 (0) {
}
Exception caught OK; continuing.
-==DONE==
diff --git a/tests/classes/__set__get_001.phpt b/tests/classes/__set__get_001.phpt
index 244119a2d0..f240817f4a 100644
--- a/tests/classes/__set__get_001.phpt
+++ b/tests/classes/__set__get_001.phpt
@@ -3,33 +3,33 @@ ZE2 __set() and __get()
--FILE--
<?php
class setter {
- public $n;
- public $x = array('a' => 1, 'b' => 2, 'c' => 3);
+ public $n;
+ public $x = array('a' => 1, 'b' => 2, 'c' => 3);
- function __get($nm) {
- echo "Getting [$nm]\n";
+ function __get($nm) {
+ echo "Getting [$nm]\n";
- if (isset($this->x[$nm])) {
- $r = $this->x[$nm];
- echo "Returning: $r\n";
- return $r;
- }
- else {
- echo "Nothing!\n";
- }
- }
+ if (isset($this->x[$nm])) {
+ $r = $this->x[$nm];
+ echo "Returning: $r\n";
+ return $r;
+ }
+ else {
+ echo "Nothing!\n";
+ }
+ }
- function __set($nm, $val) {
- echo "Setting [$nm] to $val\n";
+ function __set($nm, $val) {
+ echo "Setting [$nm] to $val\n";
- if (isset($this->x[$nm])) {
- $this->x[$nm] = $val;
- echo "OK!\n";
- }
- else {
- echo "Not OK!\n";
- }
- }
+ if (isset($this->x[$nm])) {
+ $this->x[$nm] = $val;
+ echo "OK!\n";
+ }
+ else {
+ echo "Not OK!\n";
+ }
+ }
}
$foo = new Setter();
diff --git a/tests/classes/__set__get_002.phpt b/tests/classes/__set__get_002.phpt
index 5d3b5db543..5fb72e2106 100644
--- a/tests/classes/__set__get_002.phpt
+++ b/tests/classes/__set__get_002.phpt
@@ -3,8 +3,8 @@ ZE2 __get() signature check
--FILE--
<?php
class Test {
- function __get($x,$y) {
- }
+ function __get($x,$y) {
+ }
}
?>
diff --git a/tests/classes/__set__get_003.phpt b/tests/classes/__set__get_003.phpt
index 16b09b76b1..0ebac3bccc 100644
--- a/tests/classes/__set__get_003.phpt
+++ b/tests/classes/__set__get_003.phpt
@@ -3,8 +3,8 @@ ZE2 __set() signature check
--FILE--
<?php
class Test {
- function __set() {
- }
+ function __set() {
+ }
}
?>
diff --git a/tests/classes/__set__get_004.phpt b/tests/classes/__set__get_004.phpt
index 004edc973a..2818d9700f 100644
--- a/tests/classes/__set__get_004.phpt
+++ b/tests/classes/__set__get_004.phpt
@@ -3,21 +3,21 @@ ZE2 __set() and __get()
--FILE--
<?php
class Test {
- protected $x;
+ protected $x;
- function __get($name) {
- if (isset($this->x[$name])) {
- return $this->x[$name];
- }
- else
- {
- return NULL;
- }
- }
+ function __get($name) {
+ if (isset($this->x[$name])) {
+ return $this->x[$name];
+ }
+ else
+ {
+ return NULL;
+ }
+ }
- function __set($name, $val) {
- $this->x[$name] = $val;
- }
+ function __set($name, $val) {
+ $this->x[$name] = $val;
+ }
}
$foo = new Test();
@@ -30,8 +30,6 @@ var_dump($bar->baz);
var_dump($foo->bar->baz);
?>
-===DONE===
--EXPECT--
string(5) "Check"
string(5) "Check"
-===DONE===
diff --git a/tests/classes/__set__get_005.phpt b/tests/classes/__set__get_005.phpt
index 68cfb39df3..298c8b1e11 100644
--- a/tests/classes/__set__get_005.phpt
+++ b/tests/classes/__set__get_005.phpt
@@ -4,41 +4,41 @@ ZE2 __set() and __get()
<?php
class Test
{
- protected $x;
+ protected $x;
- function __get($name) {
- echo __METHOD__ . "\n";
- if (isset($this->x[$name])) {
- return $this->x[$name];
- }
- else
- {
- return NULL;
- }
- }
+ function __get($name) {
+ echo __METHOD__ . "\n";
+ if (isset($this->x[$name])) {
+ return $this->x[$name];
+ }
+ else
+ {
+ return NULL;
+ }
+ }
- function __set($name, $val) {
- echo __METHOD__ . "\n";
- $this->x[$name] = $val;
- }
+ function __set($name, $val) {
+ echo __METHOD__ . "\n";
+ $this->x[$name] = $val;
+ }
}
class AutoGen
{
- protected $x;
+ protected $x;
- function __get($name) {
- echo __METHOD__ . "\n";
- if (!isset($this->x[$name])) {
- $this->x[$name] = new Test();
- }
- return $this->x[$name];
- }
+ function __get($name) {
+ echo __METHOD__ . "\n";
+ if (!isset($this->x[$name])) {
+ $this->x[$name] = new Test();
+ }
+ return $this->x[$name];
+ }
- function __set($name, $val) {
- echo __METHOD__ . "\n";
- $this->x[$name] = $val;
- }
+ function __set($name, $val) {
+ echo __METHOD__ . "\n";
+ $this->x[$name] = $val;
+ }
}
$foo = new AutoGen();
@@ -48,7 +48,6 @@ var_dump($foo->bar);
var_dump($foo->bar->baz);
?>
-===DONE===
--EXPECTF--
AutoGen::__get
Test::__set
@@ -63,4 +62,3 @@ object(Test)#%d (1) {
AutoGen::__get
Test::__get
string(5) "Check"
-===DONE===
diff --git a/tests/classes/abstract.phpt b/tests/classes/abstract.phpt
index f46e5130a7..8286d6b6aa 100644
--- a/tests/classes/abstract.phpt
+++ b/tests/classes/abstract.phpt
@@ -4,16 +4,16 @@ ZE2 An abstract method may not be called
<?php
abstract class fail {
- abstract function show();
+ abstract function show();
}
class pass extends fail {
- function show() {
- echo "Call to function show()\n";
- }
- function error() {
- parent::show();
- }
+ function show() {
+ echo "Call to function show()\n";
+ }
+ function error() {
+ parent::show();
+ }
}
$t = new pass();
diff --git a/tests/classes/abstract_by_interface_001.phpt b/tests/classes/abstract_by_interface_001.phpt
index 4a746d0d22..a8a6ad31da 100644
--- a/tests/classes/abstract_by_interface_001.phpt
+++ b/tests/classes/abstract_by_interface_001.phpt
@@ -8,7 +8,7 @@ class Root {
interface MyInterface
{
- function MyInterfaceFunc();
+ function MyInterfaceFunc();
}
abstract class Derived extends Root implements MyInterface {
@@ -16,7 +16,7 @@ abstract class Derived extends Root implements MyInterface {
class Leaf extends Derived
{
- function MyInterfaceFunc() {}
+ function MyInterfaceFunc() {}
}
var_dump(new Leaf);
diff --git a/tests/classes/abstract_by_interface_002.phpt b/tests/classes/abstract_by_interface_002.phpt
index a05660b5b9..83fc18ad95 100644
--- a/tests/classes/abstract_by_interface_002.phpt
+++ b/tests/classes/abstract_by_interface_002.phpt
@@ -8,7 +8,7 @@ class Root {
interface MyInterface
{
- static function MyInterfaceFunc();
+ static function MyInterfaceFunc();
}
abstract class Derived extends Root implements MyInterface {
@@ -16,7 +16,7 @@ abstract class Derived extends Root implements MyInterface {
class Leaf extends Derived
{
- static function MyInterfaceFunc() {}
+ static function MyInterfaceFunc() {}
}
var_dump(new Leaf);
diff --git a/tests/classes/abstract_class.phpt b/tests/classes/abstract_class.phpt
index fabe890eae..2ede69805c 100644
--- a/tests/classes/abstract_class.phpt
+++ b/tests/classes/abstract_class.phpt
@@ -4,13 +4,13 @@ ZE2 An abstract class cannot be instantiated
<?php
abstract class fail {
- abstract function show();
+ abstract function show();
}
class pass extends fail {
- function show() {
- echo "Call to function show()\n";
- }
+ function show() {
+ echo "Call to function show()\n";
+ }
}
$t2 = new pass();
diff --git a/tests/classes/abstract_derived.phpt b/tests/classes/abstract_derived.phpt
index a23205f9a5..db040e1342 100644
--- a/tests/classes/abstract_derived.phpt
+++ b/tests/classes/abstract_derived.phpt
@@ -7,11 +7,10 @@ class base {
}
class derived extends base {
- abstract function show();
+ abstract function show();
}
?>
===DONE===
-<?php exit(0); ?>
--EXPECTF--
Fatal error: Class derived contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (derived::show) in %sabstract_derived.php on line %d
diff --git a/tests/classes/abstract_final.phpt b/tests/classes/abstract_final.phpt
index a82bfff227..70aece06fd 100644
--- a/tests/classes/abstract_final.phpt
+++ b/tests/classes/abstract_final.phpt
@@ -4,7 +4,7 @@ ZE2 A final method cannot be abstract
<?php
class fail {
- abstract final function show();
+ abstract final function show();
}
echo "Done\n"; // Shouldn't be displayed
diff --git a/tests/classes/abstract_inherit.phpt b/tests/classes/abstract_inherit.phpt
index 8e9e118e08..6664fd3e90 100644
--- a/tests/classes/abstract_inherit.phpt
+++ b/tests/classes/abstract_inherit.phpt
@@ -4,7 +4,7 @@ ZE2 A class that inherits an abstract method is abstract
<?php
abstract class pass {
- abstract function show();
+ abstract function show();
}
abstract class fail extends pass {
diff --git a/tests/classes/abstract_not_declared.phpt b/tests/classes/abstract_not_declared.phpt
index 8c2d880150..611cb3cc94 100644
--- a/tests/classes/abstract_not_declared.phpt
+++ b/tests/classes/abstract_not_declared.phpt
@@ -4,7 +4,7 @@ ZE2 An abstract class must be declared abstract
<?php
class fail {
- abstract function show();
+ abstract function show();
}
echo "Done\n"; // shouldn't be displayed
diff --git a/tests/classes/abstract_redeclare.phpt b/tests/classes/abstract_redeclare.phpt
index 5643cb7a61..843570ba2e 100644
--- a/tests/classes/abstract_redeclare.phpt
+++ b/tests/classes/abstract_redeclare.phpt
@@ -4,13 +4,13 @@ ZE2 A method cannot be redeclared abstract
<?php
class pass {
- function show() {
- echo "Call to function show()\n";
- }
+ function show() {
+ echo "Call to function show()\n";
+ }
}
class fail extends pass {
- abstract function show();
+ abstract function show();
}
echo "Done\n"; // Shouldn't be displayed
diff --git a/tests/classes/abstract_static.phpt b/tests/classes/abstract_static.phpt
index 9b9205af3e..60ff284784 100644
--- a/tests/classes/abstract_static.phpt
+++ b/tests/classes/abstract_static.phpt
@@ -5,14 +5,14 @@ ZE2 A static abstract methods
interface showable
{
- static function show();
+ static function show();
}
class pass implements showable
{
- static function show() {
- echo "Call to function show()\n";
- }
+ static function show() {
+ echo "Call to function show()\n";
+ }
}
pass::show();
@@ -20,7 +20,7 @@ pass::show();
eval('
class fail
{
- abstract static function func();
+ abstract static function func();
}
');
diff --git a/tests/classes/abstract_user_call.phpt b/tests/classes/abstract_user_call.phpt
index 6ce810c836..0a61d477b6 100644
--- a/tests/classes/abstract_user_call.phpt
+++ b/tests/classes/abstract_user_call.phpt
@@ -5,27 +5,28 @@ ZE2 An abstrcat method cannot be called indirectly
abstract class test_base
{
- abstract function func();
+ abstract function func();
}
class test extends test_base
{
- function func()
- {
- echo __METHOD__ . "()\n";
- }
+ function func()
+ {
+ echo __METHOD__ . "()\n";
+ }
}
$o = new test;
$o->func();
-call_user_func(array($o, 'test_base::func'));
+try {
+ call_user_func(array($o, 'test_base::func'));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
-===DONE===
---EXPECTF--
+--EXPECT--
test::func()
-
-Warning: call_user_func() expects parameter 1 to be a valid callback, cannot call abstract method test_base::func() in %s on line %d
-===DONE===
+call_user_func() expects parameter 1 to be a valid callback, cannot call abstract method test_base::func()
diff --git a/tests/classes/array_access_001.phpt b/tests/classes/array_access_001.phpt
index 784a886126..ae2669b670 100644
--- a/tests/classes/array_access_001.phpt
+++ b/tests/classes/array_access_001.phpt
@@ -4,24 +4,24 @@ ZE2 ArrayAccess
<?php
class ObjectOne implements ArrayAccess {
- public $a = array('1st', 1, 2=>'3rd', '4th'=>4);
+ public $a = array('1st', 1, 2=>'3rd', '4th'=>4);
- function offsetExists($index) {
- echo __METHOD__ . "($index)\n";
- return array_key_exists($index, $this->a);
- }
- function offsetGet($index) {
- echo __METHOD__ . "($index)\n";
- return $this->a[$index];
- }
- function offsetSet($index, $newval) {
- echo __METHOD__ . "($index,$newval)\n";
- return $this->a[$index] = $newval;
- }
- function offsetUnset($index) {
- echo __METHOD__ . "($index)\n";
- unset($this->a[$index]);
- }
+ function offsetExists($index) {
+ echo __METHOD__ . "($index)\n";
+ return array_key_exists($index, $this->a);
+ }
+ function offsetGet($index) {
+ echo __METHOD__ . "($index)\n";
+ return $this->a[$index];
+ }
+ function offsetSet($index, $newval) {
+ echo __METHOD__ . "($index,$newval)\n";
+ return $this->a[$index] = $newval;
+ }
+ function offsetUnset($index) {
+ echo __METHOD__ . "($index)\n";
+ unset($this->a[$index]);
+ }
}
$obj = new ObjectOne;
@@ -82,7 +82,6 @@ unset($obj['8th']);
var_dump($obj->a);
?>
-===DONE===
--EXPECTF--
array(4) {
[0]=>
@@ -195,4 +194,3 @@ array(4) {
[6]=>
string(9) "changed 6"
}
-===DONE===
diff --git a/tests/classes/array_access_002.phpt b/tests/classes/array_access_002.phpt
index 5e101914c0..79f4a52853 100644
--- a/tests/classes/array_access_002.phpt
+++ b/tests/classes/array_access_002.phpt
@@ -4,24 +4,24 @@ ZE2 ArrayAccess::offsetSet without return
<?php
class ObjectOne implements ArrayAccess {
- public $a = array('1st', 1, 2=>'3rd', '4th'=>4);
+ public $a = array('1st', 1, 2=>'3rd', '4th'=>4);
- function offsetExists($index) {
- echo __METHOD__ . "($index)\n";
- return array_key_exists($index, $this->a);
- }
- function offsetGet($index) {
- echo __METHOD__ . "($index)\n";
- return $this->a[$index];
- }
- function offsetSet($index, $newval) {
- echo __METHOD__ . "($index,$newval)\n";
- /*return*/ $this->a[$index] = $newval;
- }
- function offsetUnset($index) {
- echo __METHOD__ . "($index)\n";
- unset($this->a[$index]);
- }
+ function offsetExists($index) {
+ echo __METHOD__ . "($index)\n";
+ return array_key_exists($index, $this->a);
+ }
+ function offsetGet($index) {
+ echo __METHOD__ . "($index)\n";
+ return $this->a[$index];
+ }
+ function offsetSet($index, $newval) {
+ echo __METHOD__ . "($index,$newval)\n";
+ /*return*/ $this->a[$index] = $newval;
+ }
+ function offsetUnset($index) {
+ echo __METHOD__ . "($index)\n";
+ unset($this->a[$index]);
+ }
}
$obj = new ObjectOne;
@@ -82,7 +82,6 @@ unset($obj['8th']);
var_dump($obj->a);
?>
-===DONE===
--EXPECTF--
array(4) {
[0]=>
@@ -195,4 +194,3 @@ array(4) {
[6]=>
string(9) "changed 6"
}
-===DONE===
diff --git a/tests/classes/array_access_003.phpt b/tests/classes/array_access_003.phpt
index 8924d1575f..dbaaa6b192 100644
--- a/tests/classes/array_access_003.phpt
+++ b/tests/classes/array_access_003.phpt
@@ -6,35 +6,35 @@ error_reporting=4095
<?php
class ObjectOne implements ArrayAccess {
- public $a = array('1st', 1, 2=>'3rd', '4th'=>4);
+ public $a = array('1st', 1, 2=>'3rd', '4th'=>4);
- function offsetExists($index) {
- echo __METHOD__ . "($index)\n";
- return array_key_exists($index, $this->a);
- }
- function offsetGet($index) {
- echo __METHOD__ . "($index)\n";
- switch($index) {
- case 1:
- $a = 'foo';
- return $a . 'Bar';
- case 2:
- static $a=1;
- return $a;
- }
- return $this->a[$index];
- }
- function offsetSet($index, $newval) {
- echo __METHOD__ . "($index,$newval)\n";
- if ($index==3) {
- $this->cnt = $newval;
- }
- return $this->a[$index] = $newval;
- }
- function offsetUnset($index) {
- echo __METHOD__ . "($index)\n";
- unset($this->a[$index]);
- }
+ function offsetExists($index) {
+ echo __METHOD__ . "($index)\n";
+ return array_key_exists($index, $this->a);
+ }
+ function offsetGet($index) {
+ echo __METHOD__ . "($index)\n";
+ switch($index) {
+ case 1:
+ $a = 'foo';
+ return $a . 'Bar';
+ case 2:
+ static $a=1;
+ return $a;
+ }
+ return $this->a[$index];
+ }
+ function offsetSet($index, $newval) {
+ echo __METHOD__ . "($index,$newval)\n";
+ if ($index==3) {
+ $this->cnt = $newval;
+ }
+ return $this->a[$index] = $newval;
+ }
+ function offsetUnset($index) {
+ echo __METHOD__ . "($index)\n";
+ unset($this->a[$index]);
+ }
}
$obj = new ObjectOne;
@@ -45,7 +45,6 @@ $obj[2]++;
var_dump($obj[2]);
?>
-===DONE===
--EXPECTF--
ObjectOne::offsetGet(1)
string(6) "fooBar"
@@ -56,4 +55,3 @@ ObjectOne::offsetGet(2)
Notice: Indirect modification of overloaded element of ObjectOne has no effect in %sarray_access_003.php on line 39
ObjectOne::offsetGet(2)
int(1)
-===DONE===
diff --git a/tests/classes/array_access_004.phpt b/tests/classes/array_access_004.phpt
index 22566937f2..882ca43762 100644
--- a/tests/classes/array_access_004.phpt
+++ b/tests/classes/array_access_004.phpt
@@ -4,35 +4,35 @@ ZE2 ArrayAccess::offsetGet ambiguties
<?php
class ObjectOne implements ArrayAccess {
- public $a = array('1st', 1, 2=>'3rd', '4th'=>4);
+ public $a = array('1st', 1, 2=>'3rd', '4th'=>4);
- function offsetExists($index) {
- echo __METHOD__ . "($index)\n";
- return array_key_exists($index, $this->a);
- }
- function offsetGet($index) {
- echo __METHOD__ . "($index)\n";
- switch($index) {
- case 1:
- $a = 'foo';
- return $a . 'Bar';
- case 2:
- static $a=1;
- return $a;
- }
- return $this->a[$index];
- }
- function offsetSet($index, $newval) {
- echo __METHOD__ . "($index,$newval)\n";
- if ($index==3) {
- $this->cnt = $newval;
- }
- return $this->a[$index] = $newval;
- }
- function offsetUnset($index) {
- echo __METHOD__ . "($index)\n";
- unset($this->a[$index]);
- }
+ function offsetExists($index) {
+ echo __METHOD__ . "($index)\n";
+ return array_key_exists($index, $this->a);
+ }
+ function offsetGet($index) {
+ echo __METHOD__ . "($index)\n";
+ switch($index) {
+ case 1:
+ $a = 'foo';
+ return $a . 'Bar';
+ case 2:
+ static $a=1;
+ return $a;
+ }
+ return $this->a[$index];
+ }
+ function offsetSet($index, $newval) {
+ echo __METHOD__ . "($index,$newval)\n";
+ if ($index==3) {
+ $this->cnt = $newval;
+ }
+ return $this->a[$index] = $newval;
+ }
+ function offsetUnset($index) {
+ echo __METHOD__ . "($index)\n";
+ unset($this->a[$index]);
+ }
}
$obj = new ObjectOne;
@@ -43,7 +43,6 @@ $obj[2]++;
var_dump($obj[2]);
?>
-===DONE===
--EXPECTF--
ObjectOne::offsetGet(1)
string(6) "fooBar"
@@ -54,4 +53,3 @@ ObjectOne::offsetGet(2)
Notice: Indirect modification of overloaded element of ObjectOne has no effect in %sarray_access_004.php on line 39
ObjectOne::offsetGet(2)
int(1)
-===DONE===
diff --git a/tests/classes/array_access_005.phpt b/tests/classes/array_access_005.phpt
index 92ddeccaf2..7db50f2cb9 100644
--- a/tests/classes/array_access_005.phpt
+++ b/tests/classes/array_access_005.phpt
@@ -4,27 +4,27 @@ ZE2 ArrayAccess and sub Arrays
<?php
class Peoples implements ArrayAccess {
- public $person;
+ public $person;
- function __construct() {
- $this->person = array(array('name'=>'Joe'));
- }
+ function __construct() {
+ $this->person = array(array('name'=>'Joe'));
+ }
- function offsetExists($index) {
- return array_key_exists($this->person, $index);
- }
+ function offsetExists($index) {
+ return array_key_exists($this->person, $index);
+ }
- function offsetGet($index) {
- return $this->person[$index];
- }
+ function offsetGet($index) {
+ return $this->person[$index];
+ }
- function offsetSet($index, $value) {
- $this->person[$index] = $value;
- }
+ function offsetSet($index, $value) {
+ $this->person[$index] = $value;
+ }
- function offsetUnset($index) {
- unset($this->person[$index]);
- }
+ function offsetUnset($index) {
+ unset($this->person[$index]);
+ }
}
$people = new Peoples;
@@ -52,7 +52,6 @@ $people[0]['name'] = 'JoeFooBar';
var_dump($people[0]['name']);
?>
-===DONE===
--EXPECTF--
string(3) "Joe"
string(6) "JoeFoo"
@@ -74,4 +73,3 @@ string(6) "JoeFoo"
Notice: Indirect modification of overloaded element of Peoples has no effect in %sarray_access_005.php on line 48
string(6) "JoeFoo"
-===DONE===
diff --git a/tests/classes/array_access_006.phpt b/tests/classes/array_access_006.phpt
index babc808cb4..7891d2aca4 100644
--- a/tests/classes/array_access_006.phpt
+++ b/tests/classes/array_access_006.phpt
@@ -4,27 +4,27 @@ ZE2 ArrayAccess and ASSIGN_OP operators (+=)
<?php
class OverloadedArray implements ArrayAccess {
- public $realArray;
+ public $realArray;
- function __construct() {
- $this->realArray = array(1,2,3);
- }
+ function __construct() {
+ $this->realArray = array(1,2,3);
+ }
- function offsetExists($index) {
- return array_key_exists($this->realArray, $index);
- }
+ function offsetExists($index) {
+ return array_key_exists($this->realArray, $index);
+ }
- function offsetGet($index) {
- return $this->realArray[$index];
- }
+ function offsetGet($index) {
+ return $this->realArray[$index];
+ }
- function offsetSet($index, $value) {
- $this->realArray[$index] = $value;
- }
+ function offsetSet($index, $value) {
+ $this->realArray[$index] = $value;
+ }
- function offsetUnset($index) {
- unset($this->realArray[$index]);
- }
+ function offsetUnset($index) {
+ unset($this->realArray[$index]);
+ }
}
$a = new OverloadedArray;
diff --git a/tests/classes/array_access_007.phpt b/tests/classes/array_access_007.phpt
index 801c8e846c..37a3255d6f 100644
--- a/tests/classes/array_access_007.phpt
+++ b/tests/classes/array_access_007.phpt
@@ -4,35 +4,35 @@ ZE2 ArrayAccess and [] assignment
<?php
class OverloadedArray implements ArrayAccess {
- public $realArray;
-
- function __construct() {
- $this->realArray = array();
- }
-
- function offsetExists($index) {
- return array_key_exists($this->realArray, $index);
- }
-
- function offsetGet($index) {
- return $this->realArray[$index];
- }
-
- function offsetSet($index, $value) {
- if (is_null($index)) {
- $this->realArray[] = $value;
- } else {
- $this->realArray[$index] = $value;
- }
- }
-
- function offsetUnset($index) {
- unset($this->realArray[$index]);
- }
-
- function dump() {
- var_dump($this->realArray);
- }
+ public $realArray;
+
+ function __construct() {
+ $this->realArray = array();
+ }
+
+ function offsetExists($index) {
+ return array_key_exists($this->realArray, $index);
+ }
+
+ function offsetGet($index) {
+ return $this->realArray[$index];
+ }
+
+ function offsetSet($index, $value) {
+ if (is_null($index)) {
+ $this->realArray[] = $value;
+ } else {
+ $this->realArray[$index] = $value;
+ }
+ }
+
+ function offsetUnset($index) {
+ unset($this->realArray[$index]);
+ }
+
+ function dump() {
+ var_dump($this->realArray);
+ }
}
$a = new OverloadedArray;
@@ -42,7 +42,6 @@ $a[2] = 3;
$a[] = 4;
$a->dump();
?>
-===DONE===
--EXPECT--
array(4) {
[0]=>
@@ -54,4 +53,3 @@ array(4) {
[3]=>
int(4)
}
-===DONE===
diff --git a/tests/classes/array_access_008.phpt b/tests/classes/array_access_008.phpt
index 0bb793b2b3..a6f485eb79 100644
--- a/tests/classes/array_access_008.phpt
+++ b/tests/classes/array_access_008.phpt
@@ -4,27 +4,27 @@ ZE2 ArrayAccess and ASSIGN_OP operators (.=)
<?php
class Peoples implements ArrayAccess {
- public $person;
+ public $person;
- function __construct() {
- $this->person = array(array('name'=>'Foo'));
- }
+ function __construct() {
+ $this->person = array(array('name'=>'Foo'));
+ }
- function offsetExists($index) {
- return array_key_exists($this->person, $index);
- }
+ function offsetExists($index) {
+ return array_key_exists($this->person, $index);
+ }
- function offsetGet($index) {
- return $this->person[$index];
- }
+ function offsetGet($index) {
+ return $this->person[$index];
+ }
- function offsetSet($index, $value) {
- $this->person[$index] = $value;
- }
+ function offsetSet($index, $value) {
+ $this->person[$index] = $value;
+ }
- function offsetUnset($index) {
- unset($this->person[$index]);
- }
+ function offsetUnset($index) {
+ unset($this->person[$index]);
+ }
}
$people = new Peoples;
@@ -48,7 +48,6 @@ $people[0]['name'] .= 'Baz';
var_dump($people[0]['name']);
?>
-===DONE===
--EXPECTF--
string(3) "Foo"
string(6) "FooBar"
@@ -64,4 +63,3 @@ string(3) "Foo"
Notice: Indirect modification of overloaded element of Peoples has no effect in %sarray_access_008.php on line 44
string(3) "Foo"
-===DONE===
diff --git a/tests/classes/array_access_009.phpt b/tests/classes/array_access_009.phpt
index 7da9084d24..a4aeaea56a 100644
--- a/tests/classes/array_access_009.phpt
+++ b/tests/classes/array_access_009.phpt
@@ -7,92 +7,92 @@ ZE2 ArrayAccess and ArrayProxyAccess, ArrayProxy
interface ArrayProxyAccess extends ArrayAccess
{
- function proxyGet($element);
- function proxySet($element, $index, $value);
- function proxyUnset($element, $index);
+ function proxyGet($element);
+ function proxySet($element, $index, $value);
+ function proxyUnset($element, $index);
}
class ArrayProxy implements ArrayAccess
{
- private $object;
- private $element;
-
- function __construct(ArrayProxyAccess $object, $element)
- {
- echo __METHOD__ . "($element)\n";
- if (!$object->offsetExists($element))
- {
- $object[$element] = array();
- }
- $this->object = $object;
- $this->element = $element;
- }
-
- function offsetExists($index) {
- echo __METHOD__ . "($this->element, $index)\n";
- return array_key_exists($index, $this->object->proxyGet($this->element));
- }
-
- function offsetGet($index) {
- echo __METHOD__ . "($this->element, $index)\n";
- $tmp = $this->object->proxyGet($this->element);
- return isset($tmp[$index]) ? $tmp[$index] : NULL;
- }
-
- function offsetSet($index, $value) {
- echo __METHOD__ . "($this->element, $index, $value)\n";
- $this->object->proxySet($this->element, $index, $value);
- }
-
- function offsetUnset($index) {
- echo __METHOD__ . "($this->element, $index)\n";
- $this->object->proxyUnset($this->element, $index);
- }
+ private $object;
+ private $element;
+
+ function __construct(ArrayProxyAccess $object, $element)
+ {
+ echo __METHOD__ . "($element)\n";
+ if (!$object->offsetExists($element))
+ {
+ $object[$element] = array();
+ }
+ $this->object = $object;
+ $this->element = $element;
+ }
+
+ function offsetExists($index) {
+ echo __METHOD__ . "($this->element, $index)\n";
+ return array_key_exists($index, $this->object->proxyGet($this->element));
+ }
+
+ function offsetGet($index) {
+ echo __METHOD__ . "($this->element, $index)\n";
+ $tmp = $this->object->proxyGet($this->element);
+ return isset($tmp[$index]) ? $tmp[$index] : NULL;
+ }
+
+ function offsetSet($index, $value) {
+ echo __METHOD__ . "($this->element, $index, $value)\n";
+ $this->object->proxySet($this->element, $index, $value);
+ }
+
+ function offsetUnset($index) {
+ echo __METHOD__ . "($this->element, $index)\n";
+ $this->object->proxyUnset($this->element, $index);
+ }
}
class Peoples implements ArrayProxyAccess
{
- public $person;
-
- function __construct()
- {
- $this->person = array(array('name'=>'Foo'));
- }
-
- function offsetExists($index)
- {
- return array_key_exists($index, $this->person);
- }
-
- function offsetGet($index)
- {
- return new ArrayProxy($this, $index);
- }
-
- function offsetSet($index, $value)
- {
- $this->person[$index] = $value;
- }
-
- function offsetUnset($index)
- {
- unset($this->person[$index]);
- }
-
- function proxyGet($element)
- {
- return $this->person[$element];
- }
-
- function proxySet($element, $index, $value)
- {
- $this->person[$element][$index] = $value;
- }
-
- function proxyUnset($element, $index)
- {
- unset($this->person[$element][$index]);
- }
+ public $person;
+
+ function __construct()
+ {
+ $this->person = array(array('name'=>'Foo'));
+ }
+
+ function offsetExists($index)
+ {
+ return array_key_exists($index, $this->person);
+ }
+
+ function offsetGet($index)
+ {
+ return new ArrayProxy($this, $index);
+ }
+
+ function offsetSet($index, $value)
+ {
+ $this->person[$index] = $value;
+ }
+
+ function offsetUnset($index)
+ {
+ unset($this->person[$index]);
+ }
+
+ function proxyGet($element)
+ {
+ return $this->person[$element];
+ }
+
+ function proxySet($element, $index, $value)
+ {
+ $this->person[$element][$index] = $value;
+ }
+
+ function proxyUnset($element, $index)
+ {
+ unset($this->person[$element][$index]);
+ }
}
$people = new Peoples;
@@ -122,7 +122,6 @@ $people[0]['name'] = 'BlaBla';
var_dump($people[0]['name']);
?>
-===DONE===
--EXPECTF--
string(3) "Foo"
string(6) "FooBar"
@@ -187,4 +186,3 @@ ArrayProxy::offsetSet(0, name, BlaBla)
ArrayProxy::__construct(0)
ArrayProxy::offsetGet(0, name)
string(6) "BlaBla"
-===DONE===
diff --git a/tests/classes/array_access_010.phpt b/tests/classes/array_access_010.phpt
index 3df64fcc7e..f91096c713 100644
--- a/tests/classes/array_access_010.phpt
+++ b/tests/classes/array_access_010.phpt
@@ -7,65 +7,65 @@ ZE2 ArrayAccess and ArrayReferenceProxy with references
class ArrayReferenceProxy implements ArrayAccess
{
- private $object;
- private $element;
-
- function __construct(ArrayAccess $object, array &$element)
- {
- echo __METHOD__ . "(Array)\n";
- $this->object = $object;
- $this->element = &$element;
- }
-
- function offsetExists($index) {
- echo __METHOD__ . "($this->element, $index)\n";
- return array_key_exists($index, $this->element);
- }
-
- function offsetGet($index) {
- echo __METHOD__ . "(Array, $index)\n";
- return isset($this->element[$index]) ? $this->element[$index] : NULL;
- }
-
- function offsetSet($index, $value) {
- echo __METHOD__ . "(Array, $index, $value)\n";
- $this->element[$index] = $value;
- }
-
- function offsetUnset($index) {
- echo __METHOD__ . "(Array, $index)\n";
- unset($this->element[$index]);
- }
+ private $object;
+ private $element;
+
+ function __construct(ArrayAccess $object, array &$element)
+ {
+ echo __METHOD__ . "(Array)\n";
+ $this->object = $object;
+ $this->element = &$element;
+ }
+
+ function offsetExists($index) {
+ echo __METHOD__ . "($this->element, $index)\n";
+ return array_key_exists($index, $this->element);
+ }
+
+ function offsetGet($index) {
+ echo __METHOD__ . "(Array, $index)\n";
+ return isset($this->element[$index]) ? $this->element[$index] : NULL;
+ }
+
+ function offsetSet($index, $value) {
+ echo __METHOD__ . "(Array, $index, $value)\n";
+ $this->element[$index] = $value;
+ }
+
+ function offsetUnset($index) {
+ echo __METHOD__ . "(Array, $index)\n";
+ unset($this->element[$index]);
+ }
}
class Peoples implements ArrayAccess
{
- public $person;
-
- function __construct()
- {
- $this->person = array(array('name'=>'Foo'));
- }
-
- function offsetExists($index)
- {
- return array_key_exists($index, $this->person);
- }
-
- function offsetGet($index)
- {
- return new ArrayReferenceProxy($this, $this->person[$index]);
- }
-
- function offsetSet($index, $value)
- {
- $this->person[$index] = $value;
- }
-
- function offsetUnset($index)
- {
- unset($this->person[$index]);
- }
+ public $person;
+
+ function __construct()
+ {
+ $this->person = array(array('name'=>'Foo'));
+ }
+
+ function offsetExists($index)
+ {
+ return array_key_exists($index, $this->person);
+ }
+
+ function offsetGet($index)
+ {
+ return new ArrayReferenceProxy($this, $this->person[$index]);
+ }
+
+ function offsetSet($index, $value)
+ {
+ $this->person[$index] = $value;
+ }
+
+ function offsetUnset($index)
+ {
+ unset($this->person[$index]);
+ }
}
$people = new Peoples;
@@ -95,8 +95,6 @@ $people[0]['name'] = 'BlaBla';
var_dump($people[0]['name']);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
string(3) "Foo"
string(6) "FooBar"
@@ -165,4 +163,3 @@ ArrayReferenceProxy::offsetSet(Array, name, BlaBla)
ArrayReferenceProxy::__construct(Array)
ArrayReferenceProxy::offsetGet(Array, name)
string(6) "BlaBla"
-===DONE===
diff --git a/tests/classes/array_access_011.phpt b/tests/classes/array_access_011.phpt
index 36269c0b41..3250d64deb 100644
--- a/tests/classes/array_access_011.phpt
+++ b/tests/classes/array_access_011.phpt
@@ -7,74 +7,74 @@ ZE2 ArrayAccess and ArrayAccessReferenceProxy with references to main array
class ArrayAccessReferenceProxy implements ArrayAccess
{
- private $object;
- private $oarray;
- private $element;
-
- function __construct(ArrayAccess $object, array &$array, $element)
- {
- echo __METHOD__ . "($element)\n";
- $this->object = $object;
- $this->oarray = &$array;
- $this->element = $element;
- }
-
- function offsetExists($index) {
- echo __METHOD__ . "($this->element, $index)\n";
- return array_key_exists($index, $this->oarray[$this->element]);
- }
-
- function offsetGet($index) {
- echo __METHOD__ . "($this->element, $index)\n";
- return isset($this->oarray[$this->element][$index]) ? $this->oarray[$this->element][$index] : NULL;
- }
-
- function offsetSet($index, $value) {
- echo __METHOD__ . "($this->element, $index, $value)\n";
- $this->oarray[$this->element][$index] = $value;
- }
-
- function offsetUnset($index) {
- echo __METHOD__ . "($this->element, $index)\n";
- unset($this->oarray[$this->element][$index]);
- }
+ private $object;
+ private $oarray;
+ private $element;
+
+ function __construct(ArrayAccess $object, array &$array, $element)
+ {
+ echo __METHOD__ . "($element)\n";
+ $this->object = $object;
+ $this->oarray = &$array;
+ $this->element = $element;
+ }
+
+ function offsetExists($index) {
+ echo __METHOD__ . "($this->element, $index)\n";
+ return array_key_exists($index, $this->oarray[$this->element]);
+ }
+
+ function offsetGet($index) {
+ echo __METHOD__ . "($this->element, $index)\n";
+ return isset($this->oarray[$this->element][$index]) ? $this->oarray[$this->element][$index] : NULL;
+ }
+
+ function offsetSet($index, $value) {
+ echo __METHOD__ . "($this->element, $index, $value)\n";
+ $this->oarray[$this->element][$index] = $value;
+ }
+
+ function offsetUnset($index) {
+ echo __METHOD__ . "($this->element, $index)\n";
+ unset($this->oarray[$this->element][$index]);
+ }
}
class Peoples implements ArrayAccess
{
- public $person;
-
- function __construct()
- {
- $this->person = array(array('name'=>'Foo'));
- }
-
- function offsetExists($index)
- {
- return array_key_exists($index, $this->person);
- }
-
- function offsetGet($index)
- {
- if (is_array($this->person[$index]))
- {
- return new ArrayAccessReferenceProxy($this, $this->person, $index);
- }
- else
- {
- return $this->person[$index];
- }
- }
-
- function offsetSet($index, $value)
- {
- $this->person[$index] = $value;
- }
-
- function offsetUnset($index)
- {
- unset($this->person[$index]);
- }
+ public $person;
+
+ function __construct()
+ {
+ $this->person = array(array('name'=>'Foo'));
+ }
+
+ function offsetExists($index)
+ {
+ return array_key_exists($index, $this->person);
+ }
+
+ function offsetGet($index)
+ {
+ if (is_array($this->person[$index]))
+ {
+ return new ArrayAccessReferenceProxy($this, $this->person, $index);
+ }
+ else
+ {
+ return $this->person[$index];
+ }
+ }
+
+ function offsetSet($index, $value)
+ {
+ $this->person[$index] = $value;
+ }
+
+ function offsetUnset($index)
+ {
+ unset($this->person[$index]);
+ }
}
$people = new Peoples;
@@ -104,8 +104,6 @@ $people[0]['name'] = 'BlaBla';
var_dump($people[0]['name']);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
string(3) "Foo"
string(6) "FooBar"
@@ -184,4 +182,3 @@ ArrayAccessReferenceProxy::offsetSet(0, name, BlaBla)
ArrayAccessReferenceProxy::__construct(0)
ArrayAccessReferenceProxy::offsetGet(0, name)
string(6) "BlaBla"
-===DONE===
diff --git a/tests/classes/array_access_012.phpt b/tests/classes/array_access_012.phpt
index 3cd3dceb8a..e2fba54781 100644
--- a/tests/classes/array_access_012.phpt
+++ b/tests/classes/array_access_012.phpt
@@ -4,21 +4,21 @@ ZE2 ArrayAccess cannot assign by reference
<?php
class ArrayAccessImpl implements ArrayAccess {
- private $data = array();
+ private $data = array();
- public function offsetUnset($index) {}
+ public function offsetUnset($index) {}
- public function offsetSet($index, $value) {
- $this->data[$index] = $value;
- }
+ public function offsetSet($index, $value) {
+ $this->data[$index] = $value;
+ }
- public function offsetGet($index) {
- return $this->data[$index];
- }
+ public function offsetGet($index) {
+ return $this->data[$index];
+ }
- public function offsetExists($index) {
- return isset($this->data[$index]);
- }
+ public function offsetExists($index) {
+ return isset($this->data[$index]);
+ }
}
$data = new ArrayAccessImpl();
@@ -28,7 +28,6 @@ $data['element'] = &$test;
?>
===DONE===
-<?php exit(0); ?>
--EXPECTF--
Notice: Indirect modification of overloaded element of ArrayAccessImpl has no effect in %sarray_access_012.php on line 24
diff --git a/tests/classes/array_access_013.phpt b/tests/classes/array_access_013.phpt
index 206d9d5403..bcb6a5e00b 100644
--- a/tests/classes/array_access_013.phpt
+++ b/tests/classes/array_access_013.phpt
@@ -15,7 +15,7 @@ $t = new Test;
try
{
- echo isset($t[0]);
+ echo isset($t[0]);
}
catch(Exception $e)
{
@@ -24,7 +24,7 @@ catch(Exception $e)
try
{
- echo $t[0];
+ echo $t[0];
}
catch(Exception $e)
{
@@ -33,7 +33,7 @@ catch(Exception $e)
try
{
- $t[0] = 1;
+ $t[0] = 1;
}
catch(Exception $e)
{
@@ -42,17 +42,15 @@ catch(Exception $e)
try
{
- unset($t[0]);
+ unset($t[0]);
}
catch(Exception $e)
{
echo "Caught in " . $e->getMessage() . "()\n";
}
?>
-===DONE===
--EXPECT--
Caught in Test::offsetExists()
Caught in Test::offsetGet()
Caught in Test::offsetSet()
Caught in Test::offsetUnset()
-===DONE===
diff --git a/tests/classes/array_conversion_keys.phpt b/tests/classes/array_conversion_keys.phpt
index 6c642f1f85..2267de06d0 100644
--- a/tests/classes/array_conversion_keys.phpt
+++ b/tests/classes/array_conversion_keys.phpt
@@ -4,9 +4,9 @@ Verifies the correct conversion of objects to arrays
<?php
class foo
{
- private $private = 'private';
- protected $protected = 'protected';
- public $public = 'public';
+ private $private = 'private';
+ protected $protected = 'protected';
+ public $public = 'public';
}
var_export((array) new foo);
?>
diff --git a/tests/classes/assign_op_property_001.phpt b/tests/classes/assign_op_property_001.phpt
index cd5fcff469..71f75d2c71 100644
--- a/tests/classes/assign_op_property_001.phpt
+++ b/tests/classes/assign_op_property_001.phpt
@@ -4,19 +4,19 @@ ZE2 assign_op property of overloaded object
<?php
class Test {
- private $real_a = 2;
+ private $real_a = 2;
- function __set($property, $value) {
- if ($property == "a") {
- $this->real_a = $value;
- }
- }
+ function __set($property, $value) {
+ if ($property == "a") {
+ $this->real_a = $value;
+ }
+ }
- function __get($property) {
- if ($property == "a") {
- return $this->real_a;
- }
- }
+ function __get($property) {
+ if ($property == "a") {
+ return $this->real_a;
+ }
+ }
}
$obj = new Test;
diff --git a/tests/classes/autoload_001.phpt b/tests/classes/autoload_001.phpt
index 350e1e0f12..cdea16f689 100644
--- a/tests/classes/autoload_001.phpt
+++ b/tests/classes/autoload_001.phpt
@@ -8,15 +8,13 @@ ZE2 Autoload and class_exists
<?php
spl_autoload_register(function ($class_name) {
- require_once(__DIR__ . '/' . $class_name . '.inc');
- echo 'autoload(' . $class_name . ")\n";
+ require_once(__DIR__ . '/' . $class_name . '.inc');
+ echo 'autoload(' . $class_name . ")\n";
});
var_dump(class_exists('autoload_root'));
?>
-===DONE===
--EXPECT--
autoload(autoload_root)
bool(true)
-===DONE===
diff --git a/tests/classes/autoload_002.phpt b/tests/classes/autoload_002.phpt
index 1b049c3414..752a9928af 100644
--- a/tests/classes/autoload_002.phpt
+++ b/tests/classes/autoload_002.phpt
@@ -8,18 +8,16 @@ ZE2 Autoload and get_class_methods
<?php
spl_autoload_register(function ($class_name) {
- require_once(__DIR__ . '/' . $class_name . '.inc');
- echo 'autoload(' . $class_name . ")\n";
+ require_once(__DIR__ . '/' . $class_name . '.inc');
+ echo 'autoload(' . $class_name . ")\n";
});
var_dump(get_class_methods('autoload_root'));
?>
-===DONE===
--EXPECT--
autoload(autoload_root)
array(1) {
[0]=>
string(12) "testFunction"
}
-===DONE===
diff --git a/tests/classes/autoload_003.phpt b/tests/classes/autoload_003.phpt
index 52fd264d46..05887433c3 100644
--- a/tests/classes/autoload_003.phpt
+++ b/tests/classes/autoload_003.phpt
@@ -8,16 +8,14 @@ ZE2 Autoload and derived classes
<?php
spl_autoload_register(function ($class_name) {
- require_once(__DIR__ . '/' . $class_name . '.inc');
- echo 'autoload(' . $class_name . ")\n";
+ require_once(__DIR__ . '/' . $class_name . '.inc');
+ echo 'autoload(' . $class_name . ")\n";
});
var_dump(class_exists('autoload_derived'));
?>
-===DONE===
--EXPECT--
autoload(autoload_root)
autoload(autoload_derived)
bool(true)
-===DONE===
diff --git a/tests/classes/autoload_004.phpt b/tests/classes/autoload_004.phpt
index 6f24f157d2..8539e07433 100644
--- a/tests/classes/autoload_004.phpt
+++ b/tests/classes/autoload_004.phpt
@@ -8,19 +8,17 @@ ZE2 Autoload and recursion
<?php
spl_autoload_register(function ($class_name) {
- var_dump(class_exists($class_name));
- require_once(__DIR__ . '/' . $class_name . '.inc');
- echo 'autoload(' . $class_name . ")\n";
+ var_dump(class_exists($class_name));
+ require_once(__DIR__ . '/' . $class_name . '.inc');
+ echo 'autoload(' . $class_name . ")\n";
});
var_dump(class_exists('autoload_derived'));
?>
-===DONE===
--EXPECT--
bool(false)
bool(false)
autoload(autoload_root)
autoload(autoload_derived)
bool(true)
-===DONE===
diff --git a/tests/classes/autoload_005.phpt b/tests/classes/autoload_005.phpt
index 67dd23daf7..72d83b88f6 100644
--- a/tests/classes/autoload_005.phpt
+++ b/tests/classes/autoload_005.phpt
@@ -8,9 +8,9 @@ ZE2 Autoload from destructor
<?php
spl_autoload_register(function ($class_name) {
- var_dump(class_exists($class_name, false));
- require_once(__DIR__ . '/' . $class_name . '.inc');
- echo 'autoload(' . $class_name . ")\n";
+ var_dump(class_exists($class_name, false));
+ require_once(__DIR__ . '/' . $class_name . '.inc');
+ echo 'autoload(' . $class_name . ")\n";
});
var_dump(class_exists('autoload_derived', false));
@@ -29,7 +29,6 @@ $o = new Test;
unset($o);
?>
-===DONE===
--EXPECTF--
bool(false)
bool(false)
@@ -40,4 +39,3 @@ autoload(autoload_root)
autoload(autoload_derived)
object(autoload_derived)#%d (0) {
}
-===DONE===
diff --git a/tests/classes/autoload_006.phpt b/tests/classes/autoload_006.phpt
index 746cbee3f6..f17011ca5e 100644
--- a/tests/classes/autoload_006.phpt
+++ b/tests/classes/autoload_006.phpt
@@ -8,8 +8,8 @@ ZE2 Autoload from destructor
<?php
spl_autoload_register(function ($class_name) {
- require_once(__DIR__ . '/' . strtolower($class_name) . '.inc');
- echo 'autoload(' . $class_name . ")\n";
+ require_once(__DIR__ . '/' . strtolower($class_name) . '.inc');
+ echo 'autoload(' . $class_name . ")\n";
});
var_dump(interface_exists('autoload_interface', false));
@@ -24,7 +24,6 @@ var_dump(interface_exists('autoload_interface', false));
var_dump(class_exists('autoload_implements', false));
?>
-===DONE===
--EXPECTF--
bool(false)
bool(false)
@@ -35,4 +34,3 @@ object(autoload_implements)#%d (0) {
bool(true)
bool(true)
bool(true)
-===DONE===
diff --git a/tests/classes/autoload_012.phpt b/tests/classes/autoload_012.phpt
index 4fc41c85f5..c5b32debae 100644
--- a/tests/classes/autoload_012.phpt
+++ b/tests/classes/autoload_012.phpt
@@ -3,12 +3,15 @@ Ensure callback methods in unknown classes trigger autoload.
--FILE--
<?php
spl_autoload_register(function ($name) {
- echo "In autoload: ";
- var_dump($name);
+ echo "In autoload: ";
+ var_dump($name);
});
-call_user_func("UndefC::test");
+try {
+ call_user_func("UndefC::test");
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
+--EXPECT--
In autoload: string(6) "UndefC"
-
-Warning: call_user_func() expects parameter 1 to be a valid callback, class 'UndefC' not found in %s on line %d
+call_user_func() expects parameter 1 to be a valid callback, class 'UndefC' not found
diff --git a/tests/classes/autoload_021.phpt b/tests/classes/autoload_021.phpt
index f3dd8ff26d..673813cb2e 100644
--- a/tests/classes/autoload_021.phpt
+++ b/tests/classes/autoload_021.phpt
@@ -3,7 +3,7 @@ Validation of class names in the autoload process
--FILE--
<?php
spl_autoload_register(function ($name) {
- echo "$name\n";
+ echo "$name\n";
});
$a = "../BUG";
$x = new $a;
diff --git a/tests/classes/autoload_implements.inc b/tests/classes/autoload_implements.inc
index 55fcc3cd9f..e5f19c0680 100644
--- a/tests/classes/autoload_implements.inc
+++ b/tests/classes/autoload_implements.inc
@@ -1,10 +1,10 @@
<?php
class autoload_implements implements autoload_interface {
- function testFunction()
- {
- return true;
- }
+ function testFunction()
+ {
+ return true;
+ }
}
?>
diff --git a/tests/classes/autoload_interface.inc b/tests/classes/autoload_interface.inc
index e6a416e721..6e696f36bf 100644
--- a/tests/classes/autoload_interface.inc
+++ b/tests/classes/autoload_interface.inc
@@ -1,7 +1,7 @@
<?php
interface autoload_interface {
- function testFunction();
+ function testFunction();
}
?>
diff --git a/tests/classes/autoload_root.inc b/tests/classes/autoload_root.inc
index 98149c59b5..44200a8d8e 100644
--- a/tests/classes/autoload_root.inc
+++ b/tests/classes/autoload_root.inc
@@ -1,10 +1,10 @@
<?php
class autoload_root {
- function testFunction()
- {
- return true;
- }
+ function testFunction()
+ {
+ return true;
+ }
}
?>
diff --git a/tests/classes/bug26737.phpt b/tests/classes/bug26737.phpt
index e190318ffd..ac7b67f5c7 100644
--- a/tests/classes/bug26737.phpt
+++ b/tests/classes/bug26737.phpt
@@ -4,14 +4,14 @@ Bug #26737 (Protected and private variables are not saved on serialization when
<?php
class foo
{
- private $private = 'private';
- protected $protected = 'protected';
- public $public = 'public';
+ private $private = 'private';
+ protected $protected = 'protected';
+ public $public = 'public';
- public function __sleep()
- {
- return array('private', 'protected', 'public', 'no_such');
- }
+ public function __sleep()
+ {
+ return array('private', 'protected', 'public', 'no_such');
+ }
}
$foo = new foo();
$data = serialize($foo);
diff --git a/tests/classes/bug27468.phpt b/tests/classes/bug27468.phpt
index 58a7b6cb16..4ef8d44a61 100644
--- a/tests/classes/bug27468.phpt
+++ b/tests/classes/bug27468.phpt
@@ -3,15 +3,15 @@ Bug #27468 (foreach in __destruct() causes segfault)
--FILE--
<?php
class foo {
- function __destruct() {
- foreach ($this->x as $x);
- }
+ function __destruct() {
+ foreach ($this->x as $x);
+ }
}
new foo();
echo 'OK';
?>
--EXPECTF--
-Notice: Undefined property: foo::$x in %sbug27468.php on line 4
+Warning: Undefined property: foo::$x in %s on line %d
Warning: Invalid argument supplied for foreach() in %sbug27468.php on line 4
OK
diff --git a/tests/classes/bug27504.phpt b/tests/classes/bug27504.phpt
index ba44806bfe..4e227a1075 100644
--- a/tests/classes/bug27504.phpt
+++ b/tests/classes/bug27504.phpt
@@ -2,27 +2,30 @@
Bug #27504 (call_user_func_array allows calling of private/protected methods)
--FILE--
<?php
- class foo {
- function __construct () {
- $this->bar('1');
- }
- private function bar ( $param ) {
- echo 'Called function foo:bar('.$param.')'."\n";
- }
- }
+class foo {
+ function __construct () {
+ $this->bar('1');
+ }
+ private function bar ( $param ) {
+ echo 'Called function foo:bar('.$param.')'."\n";
+ }
+}
- $foo = new foo();
+$foo = new foo();
- call_user_func_array( array( $foo , 'bar' ) , array( '2' ) );
+try {
+ call_user_func_array( array( $foo , 'bar' ) , array( '2' ) );
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $foo->bar('3');
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
- $foo->bar('3');
?>
---EXPECTF--
+--EXPECT--
Called function foo:bar(1)
-
-Warning: call_user_func_array() expects parameter 1 to be a valid callback, cannot access private method foo::bar() in %s on line %d
-
-Fatal error: Uncaught Error: Call to private method foo::bar() from context '' in %s:%d
-Stack trace:
-#0 {main}
- thrown in %s on line %d
+call_user_func_array() expects parameter 1 to be a valid callback, cannot access private method foo::bar()
+Call to private method foo::bar() from context ''
diff --git a/tests/classes/bug75765.phpt b/tests/classes/bug75765.phpt
index 650ca65e96..b3c8a17f6f 100644
--- a/tests/classes/bug75765.phpt
+++ b/tests/classes/bug75765.phpt
@@ -4,11 +4,11 @@ Ensure that extending of undefined class throws the exception
<?php
try {
- class A extends B {}
+ class A extends B {}
} catch (Error $e) {
- var_dump(class_exists('A'));
- var_dump(class_exists('B'));
- throw $e;
+ var_dump(class_exists('A'));
+ var_dump(class_exists('B'));
+ throw $e;
}
?>
diff --git a/tests/classes/class_abstract.phpt b/tests/classes/class_abstract.phpt
index d852884d52..2d5b4630c4 100644
--- a/tests/classes/class_abstract.phpt
+++ b/tests/classes/class_abstract.phpt
@@ -4,9 +4,9 @@ ZE2 An abstract class cannot be instantiated
<?php
abstract class base {
- function show() {
- echo "base\n";
- }
+ function show() {
+ echo "base\n";
+ }
}
class derived extends base {
diff --git a/tests/classes/class_final.phpt b/tests/classes/class_final.phpt
index 45cbc72751..885b565952 100644
--- a/tests/classes/class_final.phpt
+++ b/tests/classes/class_final.phpt
@@ -4,9 +4,9 @@ ZE2 A final class cannot be inherited
<?php
final class base {
- function show() {
- echo "base\n";
- }
+ function show() {
+ echo "base\n";
+ }
}
$t = new base();
diff --git a/tests/classes/clone_001.phpt b/tests/classes/clone_001.phpt
index e1d200be26..ac026e551a 100644
--- a/tests/classes/clone_001.phpt
+++ b/tests/classes/clone_001.phpt
@@ -3,9 +3,9 @@ ZE2 object cloning, 1
--FILE--
<?php
class test {
- public $p1 = 1;
- public $p2 = 2;
- public $p3;
+ public $p1 = 1;
+ public $p2 = 2;
+ public $p3;
};
$obj = new test;
diff --git a/tests/classes/clone_002.phpt b/tests/classes/clone_002.phpt
index b2f73b4b80..7bca4392b7 100644
--- a/tests/classes/clone_002.phpt
+++ b/tests/classes/clone_002.phpt
@@ -3,11 +3,11 @@ ZE2 object cloning, 2
--FILE--
<?php
class test {
- public $p1 = 1;
- public $p2 = 2;
- public $p3;
- public function __clone() {
- }
+ public $p1 = 1;
+ public $p2 = 2;
+ public $p3;
+ public function __clone() {
+ }
};
$obj = new test;
diff --git a/tests/classes/clone_003.phpt b/tests/classes/clone_003.phpt
index e595a59066..30d4cc549a 100644
--- a/tests/classes/clone_003.phpt
+++ b/tests/classes/clone_003.phpt
@@ -3,24 +3,24 @@ ZE2 object cloning, 3
--FILE--
<?php
class base {
- protected $p1 = 'base:1';
- public $p2 = 'base:2';
- public $p3 = 'base:3';
- public $p4 = 'base:4';
- public $p5 = 'base:5';
- private $p6 = 'base:6';
- public function __clone() {
- }
+ protected $p1 = 'base:1';
+ public $p2 = 'base:2';
+ public $p3 = 'base:3';
+ public $p4 = 'base:4';
+ public $p5 = 'base:5';
+ private $p6 = 'base:6';
+ public function __clone() {
+ }
};
class test extends base {
- public $p1 = 'test:1';
- public $p3 = 'test:3';
- public $p4 = 'test:4';
- public $p5 = 'test:5';
- public function __clone() {
- $this->p5 = 'clone:5';
- }
+ public $p1 = 'test:1';
+ public $p3 = 'test:3';
+ public $p4 = 'test:4';
+ public $p5 = 'test:5';
+ public function __clone() {
+ $this->p5 = 'clone:5';
+ }
}
$obj = new test;
diff --git a/tests/classes/clone_004.phpt b/tests/classes/clone_004.phpt
index 88ad916bb4..610a00e702 100644
--- a/tests/classes/clone_004.phpt
+++ b/tests/classes/clone_004.phpt
@@ -16,7 +16,7 @@ class test extends base {
public function __clone() {}
public function show() {
- var_dump($this);
+ var_dump($this);
}
}
diff --git a/tests/classes/clone_006.phpt b/tests/classes/clone_006.phpt
index d8a6140358..16f6bfe508 100644
--- a/tests/classes/clone_006.phpt
+++ b/tests/classes/clone_006.phpt
@@ -6,16 +6,16 @@ error_reporting=2047
<?php
class MyCloneable {
- static $id = 0;
+ static $id = 0;
- function __construct() {
- $this->id = self::$id++;
- }
+ function __construct() {
+ $this->id = self::$id++;
+ }
- function __clone() {
- $this->address = "New York";
- $this->id = self::$id++;
- }
+ function __clone() {
+ $this->address = "New York";
+ $this->id = self::$id++;
+ }
}
$original = new MyCloneable();
diff --git a/tests/classes/constants_basic_001.phpt b/tests/classes/constants_basic_001.phpt
index 6a281e7d32..796c8d559e 100644
--- a/tests/classes/constants_basic_001.phpt
+++ b/tests/classes/constants_basic_001.phpt
@@ -9,8 +9,6 @@ Class constant declarations
class C
{
- const c0 = UNDEFINED;
-
const c1 = 1, c2 = 1.5;
const c3 = + 1, c4 = + 1.5;
const c5 = -1, c6 = -1.5;
@@ -32,7 +30,6 @@ Class constant declarations
}
echo "\nAttempt to access various kinds of class constants:\n";
- var_dump(C::c0);
var_dump(C::c1);
var_dump(C::c2);
var_dump(C::c3);
@@ -58,19 +55,16 @@ Class constant declarations
echo "\nYou should not see this.";
?>
--EXPECTF--
-Notice: Undefined variable: undef in %s on line 5
+Warning: Undefined variable: undef in %s on line %d
Attempt to access various kinds of class constants:
-
-Warning: Use of undefined constant UNDEFINED - assumed 'UNDEFINED' (this will throw an Error in a future version of PHP) in %s on line %d
-string(9) "UNDEFINED"
int(1)
float(1.5)
int(1)
float(1.5)
int(-1)
float(-1.5)
-int(15)
+int(13)
string(%d) "%s"
string(1) "C"
string(0) ""
@@ -85,7 +79,7 @@ string(6) "hello2"
Expecting fatal error:
-Fatal error: Uncaught Error: Undefined class constant 'c19' in %s:53
+Fatal error: Uncaught Error: Undefined class constant 'C::c19' in %s:%d
Stack trace:
#0 {main}
- thrown in %s on line 53
+ thrown in %s on line %d
diff --git a/tests/classes/constants_basic_002.phpt b/tests/classes/constants_basic_002.phpt
index def661ec45..88c66aaee8 100644
--- a/tests/classes/constants_basic_002.phpt
+++ b/tests/classes/constants_basic_002.phpt
@@ -23,7 +23,7 @@ string(5) "hello"
Fail to read class constant from instance.
-Notice: Undefined property: aclass::$myConst in %s on line 12
+Warning: Undefined property: aclass::$myConst in %s on line %d
NULL
Class constant not visible in object var_dump.
diff --git a/tests/classes/constants_basic_003.inc b/tests/classes/constants_basic_003.inc
index 17e067b534..c7439f460a 100644
--- a/tests/classes/constants_basic_003.inc
+++ b/tests/classes/constants_basic_003.inc
@@ -1,5 +1,5 @@
<?php
class A {
- const MY_CONST = "hello from A";
+ const MY_CONST = "hello from A";
}
?>
diff --git a/tests/classes/constants_comments_001.phpt b/tests/classes/constants_comments_001.phpt
index 297ad9f956..46bf4fafff 100644
--- a/tests/classes/constants_comments_001.phpt
+++ b/tests/classes/constants_comments_001.phpt
@@ -5,22 +5,22 @@ opcache.save_comments=1
--FILE--
<?php
class X {
- /** comment X1 */
- const X1 = 1;
- const X2 = 2;
- /** comment X3 */
- const X3 = 3;
+ /** comment X1 */
+ const X1 = 1;
+ const X2 = 2;
+ /** comment X3 */
+ const X3 = 3;
}
class Y extends X {
- /** comment Y1 */
- const Y1 = 1;
- const Y2 = 2;
- /** comment Y3 */
- const Y3 = 3;
+ /** comment Y1 */
+ const Y1 = 1;
+ const Y2 = 2;
+ /** comment Y3 */
+ const Y3 = 3;
}
$r = new ReflectionClass('Y');
foreach ($r->getReflectionConstants() as $rc) {
- echo $rc->getName() . " : " . $rc->getDocComment() . "\n";
+ echo $rc->getName() . " : " . $rc->getDocComment() . "\n";
}
diff --git a/tests/classes/constants_error_003.phpt b/tests/classes/constants_error_003.phpt
index fa7984f06e..a0ee23506b 100644
--- a/tests/classes/constants_error_003.phpt
+++ b/tests/classes/constants_error_003.phpt
@@ -16,4 +16,7 @@ Basic class support - attempting to pass a class constant by reference.
var_dump(aclass::myConst);
?>
--EXPECTF--
-Fatal error: Only variables can be passed by reference in %s on line 12
+Fatal error: Uncaught Error: Cannot pass parameter 1 by reference in %s:%d
+Stack trace:
+#0 {main}
+ thrown in %s on line %d
diff --git a/tests/classes/constants_scope_001.phpt b/tests/classes/constants_scope_001.phpt
index 7adf3f8681..54fc8c4a00 100644
--- a/tests/classes/constants_scope_001.phpt
+++ b/tests/classes/constants_scope_001.phpt
@@ -4,21 +4,20 @@ ZE2 class constants and scope
<?php
class ErrorCodes {
- const FATAL = "Fatal error\n";
- const WARNING = "Warning\n";
- const INFO = "Informational message\n";
+ const FATAL = "Fatal error\n";
+ const WARNING = "Warning\n";
+ const INFO = "Informational message\n";
- static function print_fatal_error_codes() {
- echo "FATAL = " . FATAL . "\n";
- echo "self::FATAL = " . self::FATAL;
+ static function print_fatal_error_codes() {
+ echo "self::FATAL = " . self::FATAL;
}
}
class ErrorCodesDerived extends ErrorCodes {
- const FATAL = "Worst error\n";
- static function print_fatal_error_codes() {
- echo "self::FATAL = " . self::FATAL;
- echo "parent::FATAL = " . parent::FATAL;
+ const FATAL = "Worst error\n";
+ static function print_fatal_error_codes() {
+ echo "self::FATAL = " . self::FATAL;
+ echo "parent::FATAL = " . parent::FATAL;
}
}
@@ -27,9 +26,7 @@ ErrorCodes::print_fatal_error_codes();
ErrorCodesDerived::print_fatal_error_codes();
?>
---EXPECTF--
-Warning: Use of undefined constant FATAL - assumed 'FATAL' (this will throw an Error in a future version of PHP) in %sconstants_scope_001.php on line %d
-FATAL = FATAL
+--EXPECT--
self::FATAL = Fatal error
self::FATAL = Worst error
parent::FATAL = Fatal error
diff --git a/tests/classes/constants_visibility_001.phpt b/tests/classes/constants_visibility_001.phpt
index a5eeb47f37..b57fd82127 100644
--- a/tests/classes/constants_visibility_001.phpt
+++ b/tests/classes/constants_visibility_001.phpt
@@ -3,13 +3,13 @@ Class public constant visibility
--FILE--
<?php
class A {
- public const publicConst = 'publicConst';
- static function staticConstDump() {
- var_dump(self::publicConst);
- }
- function constDump() {
- var_dump(self::publicConst);
- }
+ public const publicConst = 'publicConst';
+ static function staticConstDump() {
+ var_dump(self::publicConst);
+ }
+ function constDump() {
+ var_dump(self::publicConst);
+ }
}
var_dump(A::publicConst);
diff --git a/tests/classes/constants_visibility_002.phpt b/tests/classes/constants_visibility_002.phpt
index 4e0ecb1aa2..58c35b7a4a 100644
--- a/tests/classes/constants_visibility_002.phpt
+++ b/tests/classes/constants_visibility_002.phpt
@@ -3,22 +3,25 @@ Class protected constant visibility
--FILE--
<?php
class A {
- protected const protectedConst = 'protectedConst';
- static function staticConstDump() {
- var_dump(self::protectedConst);
- }
- function constDump() {
- var_dump(self::protectedConst);
- }
+ protected const protectedConst = 'protectedConst';
+ static function staticConstDump() {
+ var_dump(self::protectedConst);
+ }
+ function constDump() {
+ var_dump(self::protectedConst);
+ }
}
A::staticConstDump();
(new A())->constDump();
-constant('A::protectedConst');
+try {
+ constant('A::protectedConst');
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
+--EXPECT--
string(14) "protectedConst"
string(14) "protectedConst"
-
-Warning: constant(): Couldn't find constant A::protectedConst in %s on line %d
+Cannot access protected const A::protectedConst
diff --git a/tests/classes/constants_visibility_003.phpt b/tests/classes/constants_visibility_003.phpt
index 7c961695ed..7492af90df 100644
--- a/tests/classes/constants_visibility_003.phpt
+++ b/tests/classes/constants_visibility_003.phpt
@@ -3,22 +3,25 @@ Class private constant visibility
--FILE--
<?php
class A {
- private const privateConst = 'privateConst';
- static function staticConstDump() {
- var_dump(self::privateConst);
- }
- function constDump() {
- var_dump(self::privateConst);
- }
+ private const privateConst = 'privateConst';
+ static function staticConstDump() {
+ var_dump(self::privateConst);
+ }
+ function constDump() {
+ var_dump(self::privateConst);
+ }
}
A::staticConstDump();
(new A())->constDump();
-constant('A::privateConst');
+try {
+ constant('A::privateConst');
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
+--EXPECT--
string(12) "privateConst"
string(12) "privateConst"
-
-Warning: constant(): Couldn't find constant A::privateConst in %s on line %d
+Cannot access private const A::privateConst
diff --git a/tests/classes/constants_visibility_004.phpt b/tests/classes/constants_visibility_004.phpt
index 93acacf3c9..d35597b365 100644
--- a/tests/classes/constants_visibility_004.phpt
+++ b/tests/classes/constants_visibility_004.phpt
@@ -3,16 +3,16 @@ Only public and protected class constants should be inherited
--FILE--
<?php
class A {
- public const X = 1;
- protected const Y = 2;
- private const Z = 3;
+ public const X = 1;
+ protected const Y = 2;
+ private const Z = 3;
}
class B extends A {
- static public function checkConstants() {
- var_dump(self::X);
- var_dump(self::Y);
- var_dump(self::Z);
- }
+ static public function checkConstants() {
+ var_dump(self::X);
+ var_dump(self::Y);
+ var_dump(self::Z);
+ }
}
B::checkConstants();
@@ -21,7 +21,7 @@ B::checkConstants();
int(1)
int(2)
-Fatal error: Uncaught Error: Undefined class constant 'Z' in %s:11
+Fatal error: Uncaught Error: Undefined class constant 'B::Z' in %s:11
Stack trace:
#0 %s(15): B::checkConstants()
#1 {main}
diff --git a/tests/classes/constants_visibility_005.phpt b/tests/classes/constants_visibility_005.phpt
index 813009c675..ff5c10ca13 100644
--- a/tests/classes/constants_visibility_005.phpt
+++ b/tests/classes/constants_visibility_005.phpt
@@ -3,7 +3,7 @@ Static constants are not allowed
--FILE--
<?php
class A {
- static const X = 1;
+ static const X = 1;
}
?>
--EXPECTF--
diff --git a/tests/classes/constants_visibility_006.phpt b/tests/classes/constants_visibility_006.phpt
index a3317cca8a..46300abf40 100644
--- a/tests/classes/constants_visibility_006.phpt
+++ b/tests/classes/constants_visibility_006.phpt
@@ -3,7 +3,7 @@ Abstract constants are not allowed
--FILE--
<?php
class A {
- abstract const X = 1;
+ abstract const X = 1;
}
?>
--EXPECTF--
diff --git a/tests/classes/constants_visibility_007.phpt b/tests/classes/constants_visibility_007.phpt
index f1b040c5c3..37b5285586 100644
--- a/tests/classes/constants_visibility_007.phpt
+++ b/tests/classes/constants_visibility_007.phpt
@@ -3,7 +3,7 @@ Final constants are not allowed
--FILE--
<?php
class A {
- final const X = 1;
+ final const X = 1;
}
?>
--EXPECTF--
diff --git a/tests/classes/constants_visibility_error_001.phpt b/tests/classes/constants_visibility_error_001.phpt
index 397dd24882..35ccf1e83d 100644
--- a/tests/classes/constants_visibility_error_001.phpt
+++ b/tests/classes/constants_visibility_error_001.phpt
@@ -3,7 +3,7 @@ Class private constant visibility error
--FILE--
<?php
class A {
- private const privateConst = 'privateConst';
+ private const privateConst = 'privateConst';
}
var_dump(A::privateConst);
diff --git a/tests/classes/constants_visibility_error_002.phpt b/tests/classes/constants_visibility_error_002.phpt
index 2980b52c37..2068862942 100644
--- a/tests/classes/constants_visibility_error_002.phpt
+++ b/tests/classes/constants_visibility_error_002.phpt
@@ -3,7 +3,7 @@ Class protected constant visibility error
--FILE--
<?php
class A {
- protected const protectedConst = 'protectedConst';
+ protected const protectedConst = 'protectedConst';
}
var_dump(A::protectedConst);
diff --git a/tests/classes/constants_visibility_error_003.phpt b/tests/classes/constants_visibility_error_003.phpt
index 6f62069c2e..c7a8b3139f 100644
--- a/tests/classes/constants_visibility_error_003.phpt
+++ b/tests/classes/constants_visibility_error_003.phpt
@@ -4,11 +4,11 @@ A redeclared class constant must have the same or higher visibility
<?php
class A {
- public const publicConst = 0;
+ public const publicConst = 0;
}
class B extends A {
- protected const publicConst = 1;
+ protected const publicConst = 1;
}
--EXPECTF--
Fatal error: Access level to B::publicConst must be public (as in class A) in %s on line 9
diff --git a/tests/classes/constants_visibility_error_004.phpt b/tests/classes/constants_visibility_error_004.phpt
index 65bfbd3c2b..6fde322cdd 100644
--- a/tests/classes/constants_visibility_error_004.phpt
+++ b/tests/classes/constants_visibility_error_004.phpt
@@ -4,11 +4,11 @@ A redeclared class constant must have the same or higher visibility
<?php
class A {
- protected const protectedConst = 0;
+ protected const protectedConst = 0;
}
class B extends A {
- private const protectedConst = 1;
+ private const protectedConst = 1;
}
--EXPECTF--
Fatal error: Access level to B::protectedConst must be protected (as in class A) or weaker in %s on line 9
diff --git a/tests/classes/ctor_dtor.phpt b/tests/classes/ctor_dtor.phpt
index bcac143025..3a40f7f568 100644
--- a/tests/classes/ctor_dtor.phpt
+++ b/tests/classes/ctor_dtor.phpt
@@ -4,21 +4,21 @@ ZE2 The new constructor/destructor is called
<?php
class early {
- function __construct() {
- echo __CLASS__ . "::" . __FUNCTION__ . "\n";
- }
- function __destruct() {
- echo __CLASS__ . "::" . __FUNCTION__ . "\n";
- }
+ function __construct() {
+ echo __CLASS__ . "::" . __FUNCTION__ . "\n";
+ }
+ function __destruct() {
+ echo __CLASS__ . "::" . __FUNCTION__ . "\n";
+ }
}
class late {
- function __construct() {
- echo __CLASS__ . "::" . __FUNCTION__ . "\n";
- }
- function __destruct() {
- echo __CLASS__ . "::" . __FUNCTION__ . "\n";
- }
+ function __construct() {
+ echo __CLASS__ . "::" . __FUNCTION__ . "\n";
+ }
+ function __destruct() {
+ echo __CLASS__ . "::" . __FUNCTION__ . "\n";
+ }
}
$t = new early();
diff --git a/tests/classes/ctor_dtor_inheritance.phpt b/tests/classes/ctor_dtor_inheritance.phpt
index 1f3d3483d0..bd1414c8b8 100644
--- a/tests/classes/ctor_dtor_inheritance.phpt
+++ b/tests/classes/ctor_dtor_inheritance.phpt
@@ -9,38 +9,38 @@ ZE2 A derived class can use the inherited constructor/destructor
// - base class constructors/destructors know the instantiated class name
class base {
- public $name;
+ public $name;
- function __construct() {
- echo __CLASS__ . "::" . __FUNCTION__ . "\n";
- $this->name = 'base';
- print_r($this);
- }
+ function __construct() {
+ echo __CLASS__ . "::" . __FUNCTION__ . "\n";
+ $this->name = 'base';
+ print_r($this);
+ }
- function __destruct() {
- echo __CLASS__ . "::" . __FUNCTION__ . "\n";
- print_r($this);
- }
+ function __destruct() {
+ echo __CLASS__ . "::" . __FUNCTION__ . "\n";
+ print_r($this);
+ }
}
class derived extends base {
- public $other;
+ public $other;
- function __construct() {
- $this->name = 'init';
- $this->other = 'other';
- print_r($this);
- parent::__construct();
- echo __CLASS__ . "::" . __FUNCTION__ . "\n";
- $this->name = 'derived';
- print_r($this);
- }
+ function __construct() {
+ $this->name = 'init';
+ $this->other = 'other';
+ print_r($this);
+ parent::__construct();
+ echo __CLASS__ . "::" . __FUNCTION__ . "\n";
+ $this->name = 'derived';
+ print_r($this);
+ }
- function __destruct() {
- parent::__destruct();
- echo __CLASS__ . "::" . __FUNCTION__ . "\n";
- print_r($this);
- }
+ function __destruct() {
+ parent::__destruct();
+ echo __CLASS__ . "::" . __FUNCTION__ . "\n";
+ print_r($this);
+ }
}
echo "Testing class base\n";
diff --git a/tests/classes/ctor_failure.phpt b/tests/classes/ctor_failure.phpt
index f86b0cc5f8..9497482892 100644
--- a/tests/classes/ctor_failure.phpt
+++ b/tests/classes/ctor_failure.phpt
@@ -26,8 +26,6 @@ catch (Exception $e)
}
?>
-===DONE===
--EXPECT--
Test::__construct(Hello)
Caught Exception(Hello)
-===DONE===
diff --git a/tests/classes/ctor_in_interface_01.phpt b/tests/classes/ctor_in_interface_01.phpt
index fc97371f6f..e1ef717f90 100644
--- a/tests/classes/ctor_in_interface_01.phpt
+++ b/tests/classes/ctor_in_interface_01.phpt
@@ -4,14 +4,14 @@ ZE2 A class constructor must keep the signature of an interface
<?php
interface constr
{
- function __construct();
+ function __construct();
}
class implem implements constr
{
- function __construct($a)
- {
- }
+ function __construct($a)
+ {
+ }
}
?>
diff --git a/tests/classes/ctor_in_interface_02.phpt b/tests/classes/ctor_in_interface_02.phpt
index 08e6f36e0e..3484432eae 100644
--- a/tests/classes/ctor_in_interface_02.phpt
+++ b/tests/classes/ctor_in_interface_02.phpt
@@ -4,7 +4,7 @@ ZE2 A class constructor must keep the signature of all interfaces
<?php
interface constr1
{
- function __construct();
+ function __construct();
}
interface constr2 extends constr1
@@ -13,21 +13,21 @@ interface constr2 extends constr1
class implem12 implements constr2
{
- function __construct()
- {
- }
+ function __construct()
+ {
+ }
}
interface constr3
{
- function __construct($a);
+ function __construct($a);
}
class implem13 implements constr1, constr3
{
- function __construct()
- {
- }
+ function __construct()
+ {
+ }
}
?>
--EXPECTF--
diff --git a/tests/classes/ctor_in_interface_03.phpt b/tests/classes/ctor_in_interface_03.phpt
index 25d7f9dc82..42c70764b9 100644
--- a/tests/classes/ctor_in_interface_03.phpt
+++ b/tests/classes/ctor_in_interface_03.phpt
@@ -4,7 +4,7 @@ ZE2 A class constructor must keep the signature of base class interfaces
<?php
interface constr
{
- function __construct();
+ function __construct();
}
abstract class implem implements constr
@@ -13,9 +13,9 @@ abstract class implem implements constr
class derived extends implem
{
- function __construct($a)
- {
- }
+ function __construct($a)
+ {
+ }
}
?>
diff --git a/tests/classes/ctor_in_interface_04.phpt b/tests/classes/ctor_in_interface_04.phpt
index 0b07f9a1ca..2bc532f434 100644
--- a/tests/classes/ctor_in_interface_04.phpt
+++ b/tests/classes/ctor_in_interface_04.phpt
@@ -4,21 +4,21 @@ ZE2 A class constructor must keep the signature of base class interfaces
<?php
interface constr
{
- function __construct();
+ function __construct();
}
class implem implements constr
{
- function __construct()
- {
- }
+ function __construct()
+ {
+ }
}
class derived extends implem
{
- function __construct($a)
- {
- }
+ function __construct($a)
+ {
+ }
}
?>
diff --git a/tests/classes/ctor_name_clash.phpt b/tests/classes/ctor_name_clash.phpt
deleted file mode 100644
index e6518775ff..0000000000
--- a/tests/classes/ctor_name_clash.phpt
+++ /dev/null
@@ -1,23 +0,0 @@
---TEST--
-ZE2 The child class can re-use the parent class name for a function member
---FILE--
-<?php
-class base {
- function base() {
- echo __CLASS__."::".__FUNCTION__."\n";
- }
-}
-
-class derived extends base {
- function base() {
- echo __CLASS__."::".__FUNCTION__."\n";
- }
-}
-
-$obj = new derived();
-$obj->base();
-?>
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; base has a deprecated constructor in %s on line %d
-base::base
-derived::base
diff --git a/tests/classes/ctor_visibility.phpt b/tests/classes/ctor_visibility.phpt
index 685c7dbe41..6316ed5e12 100644
--- a/tests/classes/ctor_visibility.phpt
+++ b/tests/classes/ctor_visibility.phpt
@@ -13,16 +13,16 @@ class Test
class Derived extends Test
{
- function __construct()
- {
+ function __construct()
+ {
echo __METHOD__ . "()\n";
- parent::__construct();
- }
+ parent::__construct();
+ }
- static function f()
- {
- new Derived;
- }
+ static function f()
+ {
+ new Derived;
+ }
}
Derived::f();
@@ -34,26 +34,26 @@ class TestPriv
echo __METHOD__ . "()\n";
}
- static function f()
- {
- new TestPriv;
- }
+ static function f()
+ {
+ new TestPriv;
+ }
}
TestPriv::f();
class DerivedPriv extends TestPriv
{
- function __construct()
- {
+ function __construct()
+ {
echo __METHOD__ . "()\n";
- parent::__construct();
- }
+ parent::__construct();
+ }
- static function f()
- {
- new DerivedPriv;
- }
+ static function f()
+ {
+ new DerivedPriv;
+ }
}
DerivedPriv::f();
diff --git a/tests/classes/dereferencing_001.phpt b/tests/classes/dereferencing_001.phpt
index e7e90cf5e3..4ec2a87659 100644
--- a/tests/classes/dereferencing_001.phpt
+++ b/tests/classes/dereferencing_001.phpt
@@ -4,25 +4,25 @@ ZE2 dereferencing of objects from methods
<?php
class Name {
- function __construct($_name) {
- $this->name = $_name;
- }
+ function __construct($_name) {
+ $this->name = $_name;
+ }
- function display() {
- echo $this->name . "\n";
- }
+ function display() {
+ echo $this->name . "\n";
+ }
}
class Person {
- private $name;
+ private $name;
- function __construct($_name, $_address) {
- $this->name = new Name($_name);
- }
+ function __construct($_name, $_address) {
+ $this->name = new Name($_name);
+ }
- function getName() {
- return $this->name;
- }
+ function getName() {
+ return $this->name;
+ }
}
$person = new Person("John", "New York");
diff --git a/tests/classes/destructor_and_exceptions.phpt b/tests/classes/destructor_and_exceptions.phpt
index 0da6e642af..0f51a21a09 100644
--- a/tests/classes/destructor_and_exceptions.phpt
+++ b/tests/classes/destructor_and_exceptions.phpt
@@ -5,56 +5,54 @@ ZE2 catch exception thrown in destructor
class FailClass
{
- public $fatal;
+ public $fatal;
- function __destruct()
- {
- echo __METHOD__ . "\n";
- throw new exception("FailClass");
- echo "Done: " . __METHOD__ . "\n";
- }
+ function __destruct()
+ {
+ echo __METHOD__ . "\n";
+ throw new exception("FailClass");
+ echo "Done: " . __METHOD__ . "\n";
+ }
}
try
{
- $a = new FailClass;
- unset($a);
+ $a = new FailClass;
+ unset($a);
}
catch(Exception $e)
{
- echo "Caught: " . $e->getMessage() . "\n";
+ echo "Caught: " . $e->getMessage() . "\n";
}
class FatalException extends Exception
{
- function __construct($what)
- {
- echo __METHOD__ . "\n";
- $o = new FailClass;
- unset($o);
- echo "Done: " . __METHOD__ . "\n";
- }
+ function __construct($what)
+ {
+ echo __METHOD__ . "\n";
+ $o = new FailClass;
+ unset($o);
+ echo "Done: " . __METHOD__ . "\n";
+ }
}
try
{
- throw new FatalException("Damn");
+ throw new FatalException("Damn");
}
catch(Exception $e)
{
- echo "Caught Exception: " . $e->getMessage() . "\n";
+ echo "Caught Exception: " . $e->getMessage() . "\n";
}
catch(FatalException $e)
{
- echo "Caught FatalException: " . $e->getMessage() . "\n";
+ echo "Caught FatalException: " . $e->getMessage() . "\n";
}
?>
-===DONE===
--EXPECT--
FailClass::__destruct
Caught: FailClass
FatalException::__construct
FailClass::__destruct
Caught Exception: FailClass
-===DONE===
diff --git a/tests/classes/destructor_and_globals.phpt b/tests/classes/destructor_and_globals.phpt
index 1276d28348..5e0773b00c 100644
--- a/tests/classes/destructor_and_globals.phpt
+++ b/tests/classes/destructor_and_globals.phpt
@@ -30,8 +30,8 @@ class counter {
}
static public function destroy(&$obj) {
- $obj = NULL;
- }
+ $obj = NULL;
+ }
}
Show();
$obj1 = new counter;
diff --git a/tests/classes/destructor_visibility_001.phpt b/tests/classes/destructor_visibility_001.phpt
index b48d000f91..41def0e525 100644
--- a/tests/classes/destructor_visibility_001.phpt
+++ b/tests/classes/destructor_visibility_001.phpt
@@ -4,9 +4,9 @@ ZE2 Ensuring destructor visibility
<?php
class Base {
- private function __destruct() {
- echo __METHOD__ . "\n";
- }
+ private function __destruct() {
+ echo __METHOD__ . "\n";
+ }
}
class Derived extends Base {
diff --git a/tests/classes/destructor_visibility_002.phpt b/tests/classes/destructor_visibility_002.phpt
index 96cf275a7c..227cc1aff0 100644
--- a/tests/classes/destructor_visibility_002.phpt
+++ b/tests/classes/destructor_visibility_002.phpt
@@ -4,9 +4,9 @@ ZE2 Ensuring destructor visibility
<?php
class Base {
- private function __destruct() {
- echo __METHOD__ . "\n";
- }
+ private function __destruct() {
+ echo __METHOD__ . "\n";
+ }
}
class Derived extends Base {
diff --git a/tests/classes/destructor_visibility_003.phpt b/tests/classes/destructor_visibility_003.phpt
index c0235cd1e3..78551a7e01 100644
--- a/tests/classes/destructor_visibility_003.phpt
+++ b/tests/classes/destructor_visibility_003.phpt
@@ -4,15 +4,15 @@ ZE2 Ensuring destructor visibility
<?php
class Base {
- private function __destruct() {
- echo __METHOD__ . "\n";
- }
+ private function __destruct() {
+ echo __METHOD__ . "\n";
+ }
}
class Derived extends Base {
- public function __destruct() {
- echo __METHOD__ . "\n";
- }
+ public function __destruct() {
+ echo __METHOD__ . "\n";
+ }
}
$obj = new Derived;
@@ -20,7 +20,5 @@ $obj = new Derived;
unset($obj); // Derived::__destruct is being called not Base::__destruct
?>
-===DONE===
--EXPECT--
Derived::__destruct
-===DONE===
diff --git a/tests/classes/factory_001.phpt b/tests/classes/factory_001.phpt
index 45f97331a5..96af2acef7 100644
--- a/tests/classes/factory_001.phpt
+++ b/tests/classes/factory_001.phpt
@@ -4,24 +4,24 @@ ZE2 factory objects
<?php
class Circle {
- function draw() {
- echo "Circle\n";
- }
+ function draw() {
+ echo "Circle\n";
+ }
}
class Square {
- function draw() {
- print "Square\n";
- }
+ function draw() {
+ print "Square\n";
+ }
}
function ShapeFactoryMethod($shape) {
- switch ($shape) {
- case "Circle":
- return new Circle();
- case "Square":
- return new Square();
- }
+ switch ($shape) {
+ case "Circle":
+ return new Circle();
+ case "Square":
+ return new Square();
+ }
}
ShapeFactoryMethod("Circle")->draw();
diff --git a/tests/classes/factory_and_singleton_001.phpt b/tests/classes/factory_and_singleton_001.phpt
index dbbf07cfad..ead7d480cd 100644
--- a/tests/classes/factory_and_singleton_001.phpt
+++ b/tests/classes/factory_and_singleton_001.phpt
@@ -27,7 +27,7 @@ class test {
}
protected function __destruct() {
- test::$cnt--;
+ test::$cnt--;
}
public function get() {
diff --git a/tests/classes/factory_and_singleton_002.phpt b/tests/classes/factory_and_singleton_002.phpt
index 6748321242..c4132f9d38 100644
--- a/tests/classes/factory_and_singleton_002.phpt
+++ b/tests/classes/factory_and_singleton_002.phpt
@@ -27,7 +27,7 @@ class test {
}
protected function __destruct() {
- test::$cnt--;
+ test::$cnt--;
}
public function get() {
diff --git a/tests/classes/factory_and_singleton_009.phpt b/tests/classes/factory_and_singleton_009.phpt
index c1cfcbdcdf..7795ea4a79 100644
--- a/tests/classes/factory_and_singleton_009.phpt
+++ b/tests/classes/factory_and_singleton_009.phpt
@@ -5,7 +5,7 @@ ZE2 factory and singleton, test 9
class test {
protected function __destruct() {
- echo __METHOD__ . "\n";
+ echo __METHOD__ . "\n";
}
}
diff --git a/tests/classes/factory_and_singleton_010.phpt b/tests/classes/factory_and_singleton_010.phpt
index 9466fe55e4..a816b3f60f 100644
--- a/tests/classes/factory_and_singleton_010.phpt
+++ b/tests/classes/factory_and_singleton_010.phpt
@@ -5,7 +5,7 @@ ZE2 factory and singleton, test 10
class test {
private function __destruct() {
- echo __METHOD__ . "\n";
+ echo __METHOD__ . "\n";
}
}
diff --git a/tests/classes/final.phpt b/tests/classes/final.phpt
index 0e100d2304..75be8ec2f4 100644
--- a/tests/classes/final.phpt
+++ b/tests/classes/final.phpt
@@ -4,18 +4,18 @@ ZE2 A method may be redeclared final
<?php
class first {
- function show() {
- echo "Call to function first::show()\n";
- }
+ function show() {
+ echo "Call to function first::show()\n";
+ }
}
$t = new first();
$t->show();
class second extends first {
- final function show() {
- echo "Call to function second::show()\n";
- }
+ final function show() {
+ echo "Call to function second::show()\n";
+ }
}
$t2 = new second();
diff --git a/tests/classes/final_abstract.phpt b/tests/classes/final_abstract.phpt
index 229ae896b0..66f5c87a6f 100644
--- a/tests/classes/final_abstract.phpt
+++ b/tests/classes/final_abstract.phpt
@@ -4,7 +4,7 @@ ZE2 A final method cannot be abstract
<?php
class fail {
- final abstract function show();
+ final abstract function show();
}
echo "Done\n"; // Shouldn't be displayed
diff --git a/tests/classes/final_ctor1.phpt b/tests/classes/final_ctor1.phpt
index acf20918fd..092dd146d4 100644
--- a/tests/classes/final_ctor1.phpt
+++ b/tests/classes/final_ctor1.phpt
@@ -5,9 +5,9 @@ ZE2 cannot override final __construct
class Base
{
- public final function __construct()
- {
- }
+ public final function __construct()
+ {
+ }
}
class Works extends Base
@@ -16,15 +16,11 @@ class Works extends Base
class Extended extends Base
{
- public function Extended()
- {
- }
+ public function __construct()
+ {
+ }
}
-ReflectionClass::export('Extended');
-
?>
--EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Extended has a deprecated constructor in %s on line %d
-
-Fatal error: Cannot override final Base::__construct() with Extended::Extended() in %sfinal_ctor1.php on line %d
+Fatal error: Cannot override final method Base::__construct() in %s on line %d
diff --git a/tests/classes/final_ctor2.phpt b/tests/classes/final_ctor2.phpt
deleted file mode 100644
index 37fcac29a9..0000000000
--- a/tests/classes/final_ctor2.phpt
+++ /dev/null
@@ -1,30 +0,0 @@
---TEST--
-ZE2 cannot override final old style ctor
---FILE--
-<?php
-
-class Base
-{
- public final function Base()
- {
- }
-}
-
-class Works extends Base
-{
-}
-
-class Extended extends Base
-{
- public function __construct()
- {
- }
-}
-
-ReflectionClass::export('Extended');
-
-?>
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Base has a deprecated constructor in %s on line %d
-
-Fatal error: Cannot override final Base::Base() with Extended::__construct() in %sfinal_ctor2.php on line %d
diff --git a/tests/classes/final_ctor3.phpt b/tests/classes/final_ctor3.phpt
deleted file mode 100644
index b0156ef294..0000000000
--- a/tests/classes/final_ctor3.phpt
+++ /dev/null
@@ -1,15 +0,0 @@
---TEST--
-Ensure implicit final inherited old-style constructor cannot be overridden.
---FILE--
-<?php
- class A {
- final function A() { }
- }
- class B extends A {
- function A() { }
- }
-?>
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in %s on line %d
-
-Fatal error: Cannot override final method A::A() in %s on line 6
diff --git a/tests/classes/final_redeclare.phpt b/tests/classes/final_redeclare.phpt
index d3d53c5dc7..e6dc38b908 100644
--- a/tests/classes/final_redeclare.phpt
+++ b/tests/classes/final_redeclare.phpt
@@ -4,17 +4,17 @@ ZE2 A final method may not be overwritten
<?php
class pass {
- final function show() {
- echo "Call to function pass::show()\n";
- }
+ final function show() {
+ echo "Call to function pass::show()\n";
+ }
}
$t = new pass();
class fail extends pass {
- function show() {
- echo "Call to function fail::show()\n";
- }
+ function show() {
+ echo "Call to function fail::show()\n";
+ }
}
echo "Done\n"; // Shouldn't be displayed
diff --git a/tests/classes/implicit_instantiation_001.phpt b/tests/classes/implicit_instantiation_001.phpt
deleted file mode 100644
index 495a8a1e35..0000000000
--- a/tests/classes/implicit_instantiation_001.phpt
+++ /dev/null
@@ -1,156 +0,0 @@
---TEST--
-Implicit object instantiation when accessing properties of non-object.
---FILE--
-<?php
-class C {
- // These values get implicitly converted to objects
- public $boolFalse = false;
- public $emptyString = '';
- public $null = null;
-
- // These values do not get implicitly converted to objects
- public $boolTrue = true;
- public $nonEmptyString = 'hello';
- public $intZero = 0;
-}
-
-$c = new C;
-foreach($c as $name => $value) {
- echo "\n\n---( \$c->$name )---";
- echo "\n --> Attempting implicit conversion to object using increment...\n";
- $c->$name->prop++;
- $c->$name = $value; // reset value in case implicit conversion was successful
-
- echo "\n --> Attempting implicit conversion to object using assignment...\n";
- $c->$name->prop = "Implicit instantiation!";
- $c->$name = $value; // reset value in case implicit conversion was successful
-
- echo "\n --> Attempting implicit conversion to object using combined assignment...\n";
- $c->$name->prop .= " Implicit instantiation!";
-}
-
-echo "\n\n\n --> Resulting object:";
-var_dump($c);
-
-?>
---EXPECTF--
----( $c->boolFalse )---
- --> Attempting implicit conversion to object using increment...
-
-Warning: Creating default object from empty value in %s on line 18
-
-Notice: Undefined property: stdClass::$prop in %s on line 18
-
- --> Attempting implicit conversion to object using assignment...
-
-Warning: Creating default object from empty value in %s on line 22
-
- --> Attempting implicit conversion to object using combined assignment...
-
-Warning: Creating default object from empty value in %s on line 26
-
-Notice: Undefined property: stdClass::$prop in %s on line 26
-
-
----( $c->emptyString )---
- --> Attempting implicit conversion to object using increment...
-
-Warning: Creating default object from empty value in %s on line 18
-
-Notice: Undefined property: stdClass::$prop in %s on line 18
-
- --> Attempting implicit conversion to object using assignment...
-
-Warning: Creating default object from empty value in %s on line 22
-
- --> Attempting implicit conversion to object using combined assignment...
-
-Warning: Creating default object from empty value in %s on line 26
-
-Notice: Undefined property: stdClass::$prop in %s on line 26
-
-
----( $c->null )---
- --> Attempting implicit conversion to object using increment...
-
-Warning: Creating default object from empty value in %s on line 18
-
-Notice: Undefined property: stdClass::$prop in %s on line 18
-
- --> Attempting implicit conversion to object using assignment...
-
-Warning: Creating default object from empty value in %s on line 22
-
- --> Attempting implicit conversion to object using combined assignment...
-
-Warning: Creating default object from empty value in %s on line 26
-
-Notice: Undefined property: stdClass::$prop in %s on line 26
-
-
----( $c->boolTrue )---
- --> Attempting implicit conversion to object using increment...
-
-Warning: Attempt to %s property 'prop' of non-object in %s on line 18
-
- --> Attempting implicit conversion to object using assignment...
-
-Warning: Attempt to assign property 'prop' of non-object in %s on line 22
-
- --> Attempting implicit conversion to object using combined assignment...
-
-Warning: Attempt to assign property 'prop' of non-object in %s on line 26
-
-
----( $c->nonEmptyString )---
- --> Attempting implicit conversion to object using increment...
-
-Warning: Attempt to %s property 'prop' of non-object in %s on line 18
-
- --> Attempting implicit conversion to object using assignment...
-
-Warning: Attempt to assign property 'prop' of non-object in %s on line 22
-
- --> Attempting implicit conversion to object using combined assignment...
-
-Warning: Attempt to assign property 'prop' of non-object in %s on line 26
-
-
----( $c->intZero )---
- --> Attempting implicit conversion to object using increment...
-
-Warning: Attempt to %s property 'prop' of non-object in %s on line 18
-
- --> Attempting implicit conversion to object using assignment...
-
-Warning: Attempt to assign property 'prop' of non-object in %s on line 22
-
- --> Attempting implicit conversion to object using combined assignment...
-
-Warning: Attempt to assign property 'prop' of non-object in %s on line 26
-
-
-
- --> Resulting object:object(C)#%d (6) {
- ["boolFalse"]=>
- object(stdClass)#%d (1) {
- ["prop"]=>
- string(24) " Implicit instantiation!"
- }
- ["emptyString"]=>
- object(stdClass)#%d (1) {
- ["prop"]=>
- string(24) " Implicit instantiation!"
- }
- ["null"]=>
- object(stdClass)#%d (1) {
- ["prop"]=>
- string(24) " Implicit instantiation!"
- }
- ["boolTrue"]=>
- bool(true)
- ["nonEmptyString"]=>
- string(5) "hello"
- ["intZero"]=>
- int(0)
-}
diff --git a/tests/classes/incdec_property_001.phpt b/tests/classes/incdec_property_001.phpt
index 8517a9fc4d..664c474097 100644
--- a/tests/classes/incdec_property_001.phpt
+++ b/tests/classes/incdec_property_001.phpt
@@ -4,19 +4,19 @@ ZE2 post increment/decrement property of overloaded object
<?php
class Test {
- private $real_a = 2;
+ private $real_a = 2;
- function __set($property, $value) {
- if ($property == "a") {
- $this->real_a = $value;
- }
- }
+ function __set($property, $value) {
+ if ($property == "a") {
+ $this->real_a = $value;
+ }
+ }
- function __get($property) {
- if ($property == "a") {
- return $this->real_a;
- }
- }
+ function __get($property) {
+ if ($property == "a") {
+ return $this->real_a;
+ }
+ }
}
$obj = new Test;
diff --git a/tests/classes/incdec_property_002.phpt b/tests/classes/incdec_property_002.phpt
index 930a58dc07..5e853c63e9 100644
--- a/tests/classes/incdec_property_002.phpt
+++ b/tests/classes/incdec_property_002.phpt
@@ -4,19 +4,19 @@ ZE2 post increment/decrement property of overloaded object with assignment
<?php
class Test {
- private $real_a = 2;
+ private $real_a = 2;
- function __set($property, $value) {
- if ($property == "a") {
- $this->real_a = $value;
- }
- }
+ function __set($property, $value) {
+ if ($property == "a") {
+ $this->real_a = $value;
+ }
+ }
- function __get($property) {
- if ($property == "a") {
- return $this->real_a;
- }
- }
+ function __get($property) {
+ if ($property == "a") {
+ return $this->real_a;
+ }
+ }
}
$obj = new Test;
diff --git a/tests/classes/incdec_property_003.phpt b/tests/classes/incdec_property_003.phpt
index edf3c00963..f2a696f7ea 100644
--- a/tests/classes/incdec_property_003.phpt
+++ b/tests/classes/incdec_property_003.phpt
@@ -4,19 +4,19 @@ ZE2 pre increment/decrement property of overloaded object
<?php
class Test {
- private $real_a = 2;
+ private $real_a = 2;
- function __set($property, $value) {
- if ($property == "a") {
- $this->real_a = $value;
- }
- }
+ function __set($property, $value) {
+ if ($property == "a") {
+ $this->real_a = $value;
+ }
+ }
- function __get($property) {
- if ($property == "a") {
- return $this->real_a;
- }
- }
+ function __get($property) {
+ if ($property == "a") {
+ return $this->real_a;
+ }
+ }
}
$obj = new Test;
diff --git a/tests/classes/incdec_property_004.phpt b/tests/classes/incdec_property_004.phpt
index 2267d568af..7a686bdf59 100644
--- a/tests/classes/incdec_property_004.phpt
+++ b/tests/classes/incdec_property_004.phpt
@@ -4,19 +4,19 @@ ZE2 pre increment/decrement property of overloaded object with assignment
<?php
class Test {
- private $real_a = 2;
+ private $real_a = 2;
- function __set($property, $value) {
- if ($property == "a") {
- $this->real_a = $value;
- }
- }
+ function __set($property, $value) {
+ if ($property == "a") {
+ $this->real_a = $value;
+ }
+ }
- function __get($property) {
- if ($property == "a") {
- return $this->real_a;
- }
- }
+ function __get($property) {
+ if ($property == "a") {
+ return $this->real_a;
+ }
+ }
}
$obj = new Test;
diff --git a/tests/classes/inheritance.phpt b/tests/classes/inheritance.phpt
index 3f7e38b9ef..44b3cbc5bf 100644
--- a/tests/classes/inheritance.phpt
+++ b/tests/classes/inheritance.phpt
@@ -9,7 +9,7 @@ class foo {
public $a;
public $b;
function display() {
- echo "This is class foo\n";
+ echo "This is class foo\n";
echo "a = ".$this->a."\n";
echo "b = ".$this->b."\n";
}
diff --git a/tests/classes/inheritance_002.phpt b/tests/classes/inheritance_002.phpt
deleted file mode 100644
index f88c0996bd..0000000000
--- a/tests/classes/inheritance_002.phpt
+++ /dev/null
@@ -1,74 +0,0 @@
---TEST--
-ZE2 Constructor precedence
---FILE--
-<?php
-class Base_php4 {
- function Base_php4() {
- var_dump('Base constructor');
- }
-}
-
-class Child_php4 extends Base_php4 {
- function Child_php4() {
- var_dump('Child constructor');
- parent::Base_php4();
- }
-}
-
-class Base_php5 {
- function __construct() {
- var_dump('Base constructor');
- }
- }
-
-class Child_php5 extends Base_php5 {
- function __construct() {
- var_dump('Child constructor');
- parent::__construct();
- }
- }
-
-class Child_mx1 extends Base_php4 {
- function __construct() {
- var_dump('Child constructor');
- parent::Base_php4();
- }
-}
-
-class Child_mx2 extends Base_php5 {
- function Child_mx2() {
- var_dump('Child constructor');
- parent::__construct();
- }
-}
-
-echo "### PHP 4 style\n";
-$c4= new Child_php4();
-
-echo "### PHP 5 style\n";
-$c5= new Child_php5();
-
-echo "### Mixed style 1\n";
-$cm= new Child_mx1();
-
-echo "### Mixed style 2\n";
-$cm= new Child_mx2();
-?>
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Base_php4 has a deprecated constructor in %s on line %d
-
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Child_php4 has a deprecated constructor in %s on line %d
-
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Child_mx2 has a deprecated constructor in %s on line %d
-### PHP 4 style
-string(17) "Child constructor"
-string(16) "Base constructor"
-### PHP 5 style
-string(17) "Child constructor"
-string(16) "Base constructor"
-### Mixed style 1
-string(17) "Child constructor"
-string(16) "Base constructor"
-### Mixed style 2
-string(17) "Child constructor"
-string(16) "Base constructor"
diff --git a/tests/classes/inheritance_003.phpt b/tests/classes/inheritance_003.phpt
index bcbead1be7..224c8299aa 100644
--- a/tests/classes/inheritance_003.phpt
+++ b/tests/classes/inheritance_003.phpt
@@ -5,16 +5,14 @@ ZE2 method inheritance without interfaces
class A
{
- function f($x) {}
+ function f($x) {}
}
class B extends A
{
- function f() {}
+ function f() {}
}
?>
-===DONE===
--EXPECTF--
-Warning: Declaration of B::f() should be compatible with A::f($x) in %sinheritance_003.php on line %d
-===DONE===
+Fatal error: Declaration of B::f() must be compatible with A::f($x) in %sinheritance_003.php on line %d
diff --git a/tests/classes/inheritance_004.phpt b/tests/classes/inheritance_004.phpt
index 7eb57b2770..5ea656febb 100644
--- a/tests/classes/inheritance_004.phpt
+++ b/tests/classes/inheritance_004.phpt
@@ -5,16 +5,14 @@ ZE2 method inheritance without interfaces
class A
{
- function f() {}
+function f() {}
}
class B extends A
{
- function f($x) {}
+ function f($x) {}
}
?>
-===DONE===
--EXPECTF--
-Warning: Declaration of B::f($x) should be compatible with A::f() in %sinheritance_004.php on line %d
-===DONE===
+Fatal error: Declaration of B::f($x) must be compatible with A::f() in %sinheritance_004.php on line %d
diff --git a/tests/classes/inheritance_005.phpt b/tests/classes/inheritance_005.phpt
deleted file mode 100644
index 8c5167f4bf..0000000000
--- a/tests/classes/inheritance_005.phpt
+++ /dev/null
@@ -1,58 +0,0 @@
---TEST--
-Check for inherited old-style constructor.
---FILE--
-<?php
- class A
- {
- function A()
- {
- echo "In " . __METHOD__ . "\n";
- }
- }
-
- class B extends A
- {
- }
-
- class C extends B
- {
- }
-
-
- echo "About to construct new B: \n";
- $b = new B;
-
- echo "Is B::B() callable?\n";
- var_dump(is_callable(array($b, "B")));
-
- echo "Is B::A() callable?\n";
- var_dump(is_callable(array($b, "A")));
-
- echo "About to construct new C: \n";
- $c = new C;
-
- echo "Is C::A() callable?\n";
- var_dump(is_callable(array($c, "A")));
-
- echo "Is C::B() callable?\n";
- var_dump(is_callable(array($c, "B")));
-
- echo "Is C::C() callable?\n";
- var_dump(is_callable(array($c, "C")));
-?>
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in %s on line %d
-About to construct new B:
-In A::A
-Is B::B() callable?
-bool(false)
-Is B::A() callable?
-bool(true)
-About to construct new C:
-In A::A
-Is C::A() callable?
-bool(true)
-Is C::B() callable?
-bool(false)
-Is C::C() callable?
-bool(false)
diff --git a/tests/classes/inheritance_006.phpt b/tests/classes/inheritance_006.phpt
index 3d5c275011..6009c35ffc 100644
--- a/tests/classes/inheritance_006.phpt
+++ b/tests/classes/inheritance_006.phpt
@@ -3,11 +3,11 @@ Private property inheritance check
--FILE--
<?php
Class A {
- private $c;
+ private $c;
}
Class B extends A {
- private $c;
+ private $c;
}
Class C extends B {
diff --git a/tests/classes/inheritance_007.phpt b/tests/classes/inheritance_007.phpt
deleted file mode 100644
index c87fbde344..0000000000
--- a/tests/classes/inheritance_007.phpt
+++ /dev/null
@@ -1,40 +0,0 @@
---TEST--
-Ensure inherited old-style constructor doesn't block other methods
---FILE--
-<?php
-class A {
- public function B () { echo "In " . __METHOD__ . "\n"; }
- public function A () { echo "In " . __METHOD__ . "\n"; }
-}
-class B extends A { }
-
-$rc = new ReflectionClass('B');
-var_dump($rc->getMethods());
-
-
-$b = new B();
-$b->a();
-$b->b();
-
-?>
---EXPECTF--
-Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in %s on line %d
-array(2) {
- [0]=>
- object(ReflectionMethod)#%d (2) {
- ["name"]=>
- string(1) "B"
- ["class"]=>
- string(1) "A"
- }
- [1]=>
- object(ReflectionMethod)#%d (2) {
- ["name"]=>
- string(1) "A"
- ["class"]=>
- string(1) "A"
- }
-}
-In A::A
-In A::A
-In A::B
diff --git a/tests/classes/interface_and_extends.phpt b/tests/classes/interface_and_extends.phpt
index 8bb1ec05f1..080ba24da9 100644
--- a/tests/classes/interface_and_extends.phpt
+++ b/tests/classes/interface_and_extends.phpt
@@ -5,14 +5,14 @@ ZE2 a class cannot extend an interface
interface Test
{
- function show();
+ function show();
}
class Tester extends Test
{
- function show() {
- echo __METHOD__ . "\n";
- }
+ function show() {
+ echo __METHOD__ . "\n";
+ }
}
$o = new Tester;
diff --git a/tests/classes/interface_constant_inheritance_001.phpt b/tests/classes/interface_constant_inheritance_001.phpt
index 9f5e76d297..a925097cdb 100644
--- a/tests/classes/interface_constant_inheritance_001.phpt
+++ b/tests/classes/interface_constant_inheritance_001.phpt
@@ -3,11 +3,11 @@ Ensure an interface may not shadow an inherited constant.
--FILE--
<?php
interface I1 {
- const FOO = 10;
+ const FOO = 10;
}
interface I2 extends I1 {
- const FOO = 10;
+ const FOO = 10;
}
echo "Done\n";
diff --git a/tests/classes/interface_constant_inheritance_002.phpt b/tests/classes/interface_constant_inheritance_002.phpt
index 681de11cbf..8840f7caf4 100644
--- a/tests/classes/interface_constant_inheritance_002.phpt
+++ b/tests/classes/interface_constant_inheritance_002.phpt
@@ -3,11 +3,11 @@ Ensure a class may not shadow a constant inherited from an interface.
--FILE--
<?php
interface I {
- const FOO = 10;
+ const FOO = 10;
}
class C implements I {
- const FOO = 10;
+ const FOO = 10;
}
echo "Done\n";
diff --git a/tests/classes/interface_constant_inheritance_003.phpt b/tests/classes/interface_constant_inheritance_003.phpt
index b4902f7306..de867f5dfc 100644
--- a/tests/classes/interface_constant_inheritance_003.phpt
+++ b/tests/classes/interface_constant_inheritance_003.phpt
@@ -3,11 +3,11 @@ Ensure a class may not inherit two constants with the same name from two separat
--FILE--
<?php
interface I1 {
- const FOO = 10;
+ const FOO = 10;
}
interface I2 {
- const FOO = 10;
+ const FOO = 10;
}
class C implements I1,I2 {
diff --git a/tests/classes/interface_constant_inheritance_004.phpt b/tests/classes/interface_constant_inheritance_004.phpt
index aca9865eb1..359ce58b38 100644
--- a/tests/classes/interface_constant_inheritance_004.phpt
+++ b/tests/classes/interface_constant_inheritance_004.phpt
@@ -3,7 +3,7 @@ Ensure a class may implement two interfaces which include the same constant (due
--FILE--
<?php
interface IA {
- const FOO = 10;
+ const FOO = 10;
}
interface IB extends IA {
diff --git a/tests/classes/interface_constant_inheritance_005.phpt b/tests/classes/interface_constant_inheritance_005.phpt
index 1abb85751e..3d728ae46a 100644
--- a/tests/classes/interface_constant_inheritance_005.phpt
+++ b/tests/classes/interface_constant_inheritance_005.phpt
@@ -3,7 +3,7 @@ Ensure a interface can have public constants
--FILE--
<?php
interface IA {
- public const FOO = 10;
+ public const FOO = 10;
}
echo "Done\n";
diff --git a/tests/classes/interface_constant_inheritance_006.phpt b/tests/classes/interface_constant_inheritance_006.phpt
index 7e303bb152..82ffa7c314 100644
--- a/tests/classes/interface_constant_inheritance_006.phpt
+++ b/tests/classes/interface_constant_inheritance_006.phpt
@@ -3,7 +3,7 @@ Ensure a interface can not have protected constants
--FILE--
<?php
interface A {
- protected const FOO = 10;
+ protected const FOO = 10;
}
--EXPECTF--
Fatal error: Access type for interface constant A::FOO must be public in %s on line 3
diff --git a/tests/classes/interface_constant_inheritance_007.phpt b/tests/classes/interface_constant_inheritance_007.phpt
index 766f89b95d..e072e65e63 100644
--- a/tests/classes/interface_constant_inheritance_007.phpt
+++ b/tests/classes/interface_constant_inheritance_007.phpt
@@ -3,7 +3,7 @@ Ensure a interface can not have private constants
--FILE--
<?php
interface A {
- private const FOO = 10;
+ private const FOO = 10;
}
--EXPECTF--
Fatal error: Access type for interface constant A::FOO must be public in %s on line 3
diff --git a/tests/classes/interface_doubled.phpt b/tests/classes/interface_doubled.phpt
index 8fbfcba7ff..4a176892db 100644
--- a/tests/classes/interface_doubled.phpt
+++ b/tests/classes/interface_doubled.phpt
@@ -4,42 +4,42 @@ ZE2 An interface extends base interfaces
<?php
interface if_a {
- function f_a();
+ function f_a();
}
interface if_b {
- function f_b();
+ function f_b();
}
interface if_c extends if_a, if_b {
- function f_c();
+ function f_c();
}
interface if_d extends if_a, if_b {
- function f_d();
+ function f_d();
}
interface if_e {
- function f_d();
+ function f_d();
}
interface if_f extends /*if_e,*/ if_a, if_b, if_c, if_d /*, if_e*/ {
}
class base {
- function test($class) {
- echo "is_a(" . get_class($this) . ", $class) ". (($this instanceof $class) ? "yes\n" : "no\n");
- }
+ function test($class) {
+ echo "is_a(" . get_class($this) . ", $class) ". (($this instanceof $class) ? "yes\n" : "no\n");
+ }
}
echo "class_a\n";
class class_a extends base implements if_a {
- function f_a() {}
- function f_b() {}
- function f_c() {}
- function f_d() {}
- function f_e() {}
+ function f_a() {}
+ function f_b() {}
+ function f_c() {}
+ function f_d() {}
+ function f_e() {}
}
$t = new class_a();
@@ -52,11 +52,11 @@ echo $t->test('if_e');
echo "class_b\n";
class class_b extends base implements if_a, if_b {
- function f_a() {}
- function f_b() {}
- function f_c() {}
- function f_d() {}
- function f_e() {}
+ function f_a() {}
+ function f_b() {}
+ function f_c() {}
+ function f_d() {}
+ function f_e() {}
}
$t = new class_b();
@@ -69,11 +69,11 @@ echo $t->test('if_e');
echo "class_c\n";
class class_c extends base implements if_c {
- function f_a() {}
- function f_b() {}
- function f_c() {}
- function f_d() {}
- function f_e() {}
+ function f_a() {}
+ function f_b() {}
+ function f_c() {}
+ function f_d() {}
+ function f_e() {}
}
$t = new class_c();
@@ -86,11 +86,11 @@ echo $t->test('if_e');
echo "class_d\n";
class class_d extends base implements if_d{
- function f_a() {}
- function f_b() {}
- function f_c() {}
- function f_d() {}
- function f_e() {}
+ function f_a() {}
+ function f_b() {}
+ function f_c() {}
+ function f_d() {}
+ function f_e() {}
}
$t = new class_d();
@@ -103,11 +103,11 @@ echo $t->test('if_e');
echo "class_e\n";
class class_e extends base implements if_a, if_b, if_c, if_d {
- function f_a() {}
- function f_b() {}
- function f_c() {}
- function f_d() {}
- function f_e() {}
+ function f_a() {}
+ function f_b() {}
+ function f_c() {}
+ function f_d() {}
+ function f_e() {}
}
$t = new class_e();
@@ -120,11 +120,11 @@ echo $t->test('if_e');
echo "class_f\n";
class class_f extends base implements if_e {
- function f_a() {}
- function f_b() {}
- function f_c() {}
- function f_d() {}
- function f_e() {}
+ function f_a() {}
+ function f_b() {}
+ function f_c() {}
+ function f_d() {}
+ function f_e() {}
}
$t = new class_f();
@@ -137,11 +137,11 @@ echo $t->test('if_e');
echo "class_g\n";
class class_g extends base implements if_f {
- function f_a() {}
- function f_b() {}
- function f_c() {}
- function f_d() {}
- function f_e() {}
+ function f_a() {}
+ function f_b() {}
+ function f_c() {}
+ function f_d() {}
+ function f_e() {}
}
$t = new class_g();
@@ -152,7 +152,6 @@ echo $t->test('if_d');
echo $t->test('if_e');
?>
-===DONE===
--EXPECT--
class_a
is_a(class_a, if_a) yes
@@ -196,4 +195,3 @@ is_a(class_g, if_b) yes
is_a(class_g, if_c) yes
is_a(class_g, if_d) yes
is_a(class_g, if_e) no
-===DONE===
diff --git a/tests/classes/interface_implemented.phpt b/tests/classes/interface_implemented.phpt
index e224c5bd23..52bb7de02d 100644
--- a/tests/classes/interface_implemented.phpt
+++ b/tests/classes/interface_implemented.phpt
@@ -4,40 +4,40 @@ ZE2 An interface is inherited
<?php
interface if_a {
- function f_a();
+ function f_a();
}
interface if_b extends if_a {
- function f_b();
+ function f_b();
}
class base {
- function _is_a($sub) {
- echo 'is_a('.get_class($this).', '.$sub.') = '.(($this instanceof $sub) ? 'yes' : 'no')."\n";
- }
- function test() {
- echo $this->_is_a('base');
- echo $this->_is_a('derived_a');
- echo $this->_is_a('derived_b');
- echo $this->_is_a('derived_c');
- echo $this->_is_a('derived_d');
- echo $this->_is_a('if_a');
- echo $this->_is_a('if_b');
- echo "\n";
- }
+ function _is_a($sub) {
+ echo 'is_a('.get_class($this).', '.$sub.') = '.(($this instanceof $sub) ? 'yes' : 'no')."\n";
+ }
+ function test() {
+ echo $this->_is_a('base');
+ echo $this->_is_a('derived_a');
+ echo $this->_is_a('derived_b');
+ echo $this->_is_a('derived_c');
+ echo $this->_is_a('derived_d');
+ echo $this->_is_a('if_a');
+ echo $this->_is_a('if_b');
+ echo "\n";
+ }
}
class derived_a extends base implements if_a {
- function f_a() {}
+ function f_a() {}
}
class derived_b extends base implements if_a, if_b {
- function f_a() {}
- function f_b() {}
+ function f_a() {}
+ function f_b() {}
}
class derived_c extends derived_a implements if_b {
- function f_b() {}
+ function f_b() {}
}
class derived_d extends derived_c {
diff --git a/tests/classes/interface_instantiate.phpt b/tests/classes/interface_instantiate.phpt
index 04b0e29701..2fab5fd3da 100644
--- a/tests/classes/interface_instantiate.phpt
+++ b/tests/classes/interface_instantiate.phpt
@@ -4,7 +4,7 @@ ZE2 An interface cannot be instantiated
<?php
interface if_a {
- function f_a();
+ function f_a();
}
$t = new if_a();
diff --git a/tests/classes/interface_member.phpt b/tests/classes/interface_member.phpt
index 3b50b30ffe..d44b497ca4 100644
--- a/tests/classes/interface_member.phpt
+++ b/tests/classes/interface_member.phpt
@@ -4,7 +4,7 @@ ZE2 An interface cannot have properties
<?php
interface if_a {
- public $member;
+ public $member;
}
?>
--EXPECTF--
diff --git a/tests/classes/interface_method.phpt b/tests/classes/interface_method.phpt
index 491b4c21d6..04e2953676 100644
--- a/tests/classes/interface_method.phpt
+++ b/tests/classes/interface_method.phpt
@@ -4,7 +4,7 @@ ZE2 An interface method must be abstract
<?php
interface if_a {
- function err() {}
+ function err() {}
}
?>
diff --git a/tests/classes/interface_method_final.phpt b/tests/classes/interface_method_final.phpt
index e936b5a03a..42783c6f12 100644
--- a/tests/classes/interface_method_final.phpt
+++ b/tests/classes/interface_method_final.phpt
@@ -4,7 +4,7 @@ ZE2 An interface method cannot be final
<?php
class if_a {
- abstract final function err();
+ abstract final function err();
}
?>
diff --git a/tests/classes/interface_method_private.phpt b/tests/classes/interface_method_private.phpt
index 11f8bf648f..4661a86375 100644
--- a/tests/classes/interface_method_private.phpt
+++ b/tests/classes/interface_method_private.phpt
@@ -4,7 +4,7 @@ ZE2 An interface method cannot be private
<?php
interface if_a {
- abstract private function err();
+ abstract private function err();
}
?>
diff --git a/tests/classes/interface_must_be_implemented.phpt b/tests/classes/interface_must_be_implemented.phpt
index 7dc39436e9..300ace23e3 100644
--- a/tests/classes/interface_must_be_implemented.phpt
+++ b/tests/classes/interface_must_be_implemented.phpt
@@ -4,7 +4,7 @@ ZE2 An interface must be implemented
<?php
interface if_a {
- function f_a();
+ function f_a();
}
class derived_a implements if_a {
diff --git a/tests/classes/interface_optional_arg.phpt b/tests/classes/interface_optional_arg.phpt
index 6fc97f55fb..ab377e1c76 100644
--- a/tests/classes/interface_optional_arg.phpt
+++ b/tests/classes/interface_optional_arg.phpt
@@ -6,14 +6,14 @@ ZE2 An interface method allows additional default arguments
error_reporting(4095);
interface test {
- public function bar();
+ public function bar();
}
class foo implements test {
- public function bar($foo = NULL) {
- echo "foo\n";
- }
+ public function bar($foo = NULL) {
+ echo "foo\n";
+ }
}
$foo = new foo;
diff --git a/tests/classes/interface_optional_arg_002.phpt b/tests/classes/interface_optional_arg_002.phpt
index 67e6785883..190b47aa4f 100644
--- a/tests/classes/interface_optional_arg_002.phpt
+++ b/tests/classes/interface_optional_arg_002.phpt
@@ -4,14 +4,14 @@ default argument value in interface implementation
<?php
interface test {
- public function bar();
+ public function bar();
}
class foo implements test {
- public function bar($arg = 2) {
- var_dump($arg);
- }
+ public function bar($arg = 2) {
+ var_dump($arg);
+ }
}
$foo = new foo;
diff --git a/tests/classes/interface_optional_arg_003.phpt b/tests/classes/interface_optional_arg_003.phpt
index cf583fe204..7a972c728b 100644
--- a/tests/classes/interface_optional_arg_003.phpt
+++ b/tests/classes/interface_optional_arg_003.phpt
@@ -6,7 +6,7 @@ include 'interface_optional_arg_003.inc';
class C implements I {
function f($a = 2) {
- var_dump($a);
+ var_dump($a);
}
}
diff --git a/tests/classes/interfaces_001.phpt b/tests/classes/interfaces_001.phpt
index 97b48aa03d..3b1aabb6a7 100644
--- a/tests/classes/interfaces_001.phpt
+++ b/tests/classes/interfaces_001.phpt
@@ -4,15 +4,15 @@ ZE2 interfaces
<?php
interface ThrowableInterface {
- public function getMessage();
+ public function getMessage();
}
class Exception_foo implements ThrowableInterface {
- public $foo = "foo";
+ public $foo = "foo";
- public function getMessage() {
- return $this->foo;
- }
+ public function getMessage() {
+ return $this->foo;
+ }
}
$foo = new Exception_foo;
diff --git a/tests/classes/interfaces_002.phpt b/tests/classes/interfaces_002.phpt
index 6cc899bf1d..14ac1f0ffc 100644
--- a/tests/classes/interfaces_002.phpt
+++ b/tests/classes/interfaces_002.phpt
@@ -4,16 +4,16 @@ ZE2 interface with an unimplemented method
<?php
interface ThrowableInterface {
- public function getMessage();
- public function getErrno();
+ public function getMessage();
+ public function getErrno();
}
class Exception_foo implements ThrowableInterface {
- public $foo = "foo";
+ public $foo = "foo";
- public function getMessage() {
- return $this->foo;
- }
+ public function getMessage() {
+ return $this->foo;
+ }
}
// this should die -- Exception class must be abstract...
diff --git a/tests/classes/interfaces_003.phpt b/tests/classes/interfaces_003.phpt
index 97b5f7dde5..349dc66bd8 100644
--- a/tests/classes/interfaces_003.phpt
+++ b/tests/classes/interfaces_003.phpt
@@ -7,14 +7,14 @@ class MyObject {}
interface MyInterface
{
- public function __construct(MyObject $o);
+ public function __construct(MyObject $o);
}
class MyTestClass implements MyInterface
{
- public function __construct(MyObject $o)
- {
- }
+ public function __construct(MyObject $o)
+ {
+ }
}
$obj = new MyTestClass;
diff --git a/tests/classes/iterators_001.phpt b/tests/classes/iterators_001.phpt
index e4060e375f..17588bc8cd 100644
--- a/tests/classes/iterators_001.phpt
+++ b/tests/classes/iterators_001.phpt
@@ -4,78 +4,78 @@ ZE2 iterators and foreach
<?php
class c_iter implements Iterator {
- private $obj;
- private $num = 0;
+ private $obj;
+ private $num = 0;
- function __construct($obj) {
- echo __METHOD__ . "\n";
- $this->num = 0;
- $this->obj = $obj;
- }
- function rewind() {
- }
- function valid() {
- $more = $this->num < $this->obj->max;
- echo __METHOD__ . ' = ' .($more ? 'true' : 'false') . "\n";
- return $more;
- }
- function current() {
- echo __METHOD__ . "\n";
- return $this->num;
- }
- function next() {
- echo __METHOD__ . "\n";
- $this->num++;
- }
- function key() {
- echo __METHOD__ . "\n";
- switch($this->num) {
- case 0: return "1st";
- case 1: return "2nd";
- case 2: return "3rd";
- default: return "???";
- }
- }
+ function __construct($obj) {
+ echo __METHOD__ . "\n";
+ $this->num = 0;
+ $this->obj = $obj;
+ }
+ function rewind() {
+ }
+ function valid() {
+ $more = $this->num < $this->obj->max;
+ echo __METHOD__ . ' = ' .($more ? 'true' : 'false') . "\n";
+ return $more;
+ }
+ function current() {
+ echo __METHOD__ . "\n";
+ return $this->num;
+ }
+ function next() {
+ echo __METHOD__ . "\n";
+ $this->num++;
+ }
+ function key() {
+ echo __METHOD__ . "\n";
+ switch($this->num) {
+ case 0: return "1st";
+ case 1: return "2nd";
+ case 2: return "3rd";
+ default: return "???";
+ }
+ }
}
class c implements IteratorAggregate {
- public $max = 3;
+ public $max = 3;
- function getIterator() {
- echo __METHOD__ . "\n";
- return new c_iter($this);
- }
+ function getIterator() {
+ echo __METHOD__ . "\n";
+ return new c_iter($this);
+ }
}
echo "===Array===\n";
$a = array(0,1,2);
foreach($a as $v) {
- echo "array:$v\n";
+ echo "array:$v\n";
}
echo "===Manual===\n";
$t = new c();
for ($iter = $t->getIterator(); $iter->valid(); $iter->next()) {
- echo $iter->current() . "\n";
+ echo $iter->current() . "\n";
}
echo "===foreach/std===\n";
foreach($t as $v) {
- echo "object:$v\n";
+ echo "object:$v\n";
}
echo "===foreach/rec===\n";
foreach($t as $v) {
- foreach($t as $w) {
- echo "double:$v:$w\n";
- }
+ foreach($t as $w) {
+ echo "double:$v:$w\n";
+ }
}
echo "===foreach/key===\n";
foreach($t as $i => $v) {
- echo "object:$i=>$v\n";
+ echo "object:$i=>$v\n";
}
print "Done\n";
diff --git a/tests/classes/iterators_002.phpt b/tests/classes/iterators_002.phpt
index 5e1ceb6208..4035f7c4f4 100644
--- a/tests/classes/iterators_002.phpt
+++ b/tests/classes/iterators_002.phpt
@@ -4,64 +4,64 @@ ZE2 iterators and break
<?php
class c_iter implements Iterator {
- private $obj;
- private $num = 0;
+ private $obj;
+ private $num = 0;
- function __construct($obj) {
- echo __METHOD__ . "\n";
- $this->obj = $obj;
- }
- function rewind() {
- echo __METHOD__ . "\n";
- $this->num = 0;
- }
- function valid() {
- $more = $this->num < $this->obj->max;
- echo __METHOD__ . ' = ' .($more ? 'true' : 'false') . "\n";
- return $more;
- }
- function current() {
- echo __METHOD__ . "\n";
- return $this->num;
- }
- function next() {
- echo __METHOD__ . "\n";
- $this->num++;
- }
- function key() {
- echo __METHOD__ . "\n";
- switch($this->num) {
- case 0: return "1st";
- case 1: return "2nd";
- case 2: return "3rd";
- default: return "???";
- }
- }
- function __destruct() {
- echo __METHOD__ . "\n";
- }
+ function __construct($obj) {
+ echo __METHOD__ . "\n";
+ $this->obj = $obj;
+ }
+ function rewind() {
+ echo __METHOD__ . "\n";
+ $this->num = 0;
+ }
+ function valid() {
+ $more = $this->num < $this->obj->max;
+ echo __METHOD__ . ' = ' .($more ? 'true' : 'false') . "\n";
+ return $more;
+ }
+ function current() {
+ echo __METHOD__ . "\n";
+ return $this->num;
+ }
+ function next() {
+ echo __METHOD__ . "\n";
+ $this->num++;
+ }
+ function key() {
+ echo __METHOD__ . "\n";
+ switch($this->num) {
+ case 0: return "1st";
+ case 1: return "2nd";
+ case 2: return "3rd";
+ default: return "???";
+ }
+ }
+ function __destruct() {
+ echo __METHOD__ . "\n";
+ }
}
class c implements IteratorAggregate {
- public $max = 3;
+ public $max = 3;
- function getIterator() {
- echo __METHOD__ . "\n";
- return new c_iter($this);
- }
- function __destruct() {
- echo __METHOD__ . "\n";
- }
+ function getIterator() {
+ echo __METHOD__ . "\n";
+ return new c_iter($this);
+ }
+ function __destruct() {
+ echo __METHOD__ . "\n";
+ }
}
$t = new c();
foreach($t as $k => $v) {
- foreach($t as $w) {
- echo "double:$v:$w\n";
- break;
- }
+ foreach($t as $w) {
+ echo "double:$v:$w\n";
+ break;
+ }
}
unset($t);
diff --git a/tests/classes/iterators_003.phpt b/tests/classes/iterators_003.phpt
index f417478d49..5557402d8d 100644
--- a/tests/classes/iterators_003.phpt
+++ b/tests/classes/iterators_003.phpt
@@ -4,66 +4,66 @@ ZE2 iterators and break
<?php
class c_iter implements Iterator {
- private $obj;
- private $num = 0;
+ private $obj;
+ private $num = 0;
- function __construct($obj) {
- echo __METHOD__ . "\n";
- $this->obj = $obj;
- }
- function rewind() {
- echo __METHOD__ . "\n";
- }
- function valid() {
- $more = $this->num < $this->obj->max;
- echo __METHOD__ . ' = ' .($more ? 'true' : 'false') . "\n";
- return $more;
- }
- function current() {
- echo __METHOD__ . "\n";
- return $this->num;
- }
- function next() {
- echo __METHOD__ . "\n";
- $this->num++;
- }
- function key() {
- return $this->num;
- }
+ function __construct($obj) {
+ echo __METHOD__ . "\n";
+ $this->obj = $obj;
+ }
+ function rewind() {
+ echo __METHOD__ . "\n";
+ }
+ function valid() {
+ $more = $this->num < $this->obj->max;
+ echo __METHOD__ . ' = ' .($more ? 'true' : 'false') . "\n";
+ return $more;
+ }
+ function current() {
+ echo __METHOD__ . "\n";
+ return $this->num;
+ }
+ function next() {
+ echo __METHOD__ . "\n";
+ $this->num++;
+ }
+ function key() {
+ return $this->num;
+ }
}
class c implements IteratorAggregate {
- public $max = 4;
+ public $max = 4;
- function getIterator() {
- echo __METHOD__ . "\n";
- return new c_iter($this);
- }
+ function getIterator() {
+ echo __METHOD__ . "\n";
+ return new c_iter($this);
+ }
}
$t = new c();
foreach($t as $v) {
- if ($v == 0) {
- echo "continue outer\n";
- continue;
- }
- foreach($t as $w) {
- if ($w == 1) {
- echo "continue inner\n";
- continue;
- }
- if ($w == 2) {
- echo "break inner\n";
- break;
- }
- echo "double:$v:$w\n";
- }
- if ($v == 2) {
- echo "break outer\n";
- break;
- }
+ if ($v == 0) {
+ echo "continue outer\n";
+ continue;
+ }
+ foreach($t as $w) {
+ if ($w == 1) {
+ echo "continue inner\n";
+ continue;
+ }
+ if ($w == 2) {
+ echo "break inner\n";
+ break;
+ }
+ echo "double:$v:$w\n";
+ }
+ if ($v == 2) {
+ echo "break outer\n";
+ break;
+ }
}
print "Done\n";
diff --git a/tests/classes/iterators_004.phpt b/tests/classes/iterators_004.phpt
index dc5a07a603..77d036a075 100644
--- a/tests/classes/iterators_004.phpt
+++ b/tests/classes/iterators_004.phpt
@@ -10,43 +10,43 @@ class c1 {}
$obj = new c1();
foreach($obj as $w) {
- echo "object:$w\n";
+ echo "object:$w\n";
}
echo "2nd try\n";
class c2 {
- public $max = 3;
- public $num = 0;
-
- function current() {
- echo __METHOD__ . "\n";
- return $this->num;
- }
- function next() {
- echo __METHOD__ . "\n";
- $this->num++;
- }
- function valid() {
- echo __METHOD__ . "\n";
- return $this->num < $this->max;
- }
- function key() {
- echo __METHOD__ . "\n";
- switch($this->num) {
- case 0: return "1st";
- case 1: return "2nd";
- case 2: return "3rd";
- default: return "???";
- }
- }
+ public $max = 3;
+ public $num = 0;
+
+ function current() {
+ echo __METHOD__ . "\n";
+ return $this->num;
+ }
+ function next() {
+ echo __METHOD__ . "\n";
+ $this->num++;
+ }
+ function valid() {
+ echo __METHOD__ . "\n";
+ return $this->num < $this->max;
+ }
+ function key() {
+ echo __METHOD__ . "\n";
+ switch($this->num) {
+ case 0: return "1st";
+ case 1: return "2nd";
+ case 2: return "3rd";
+ default: return "???";
+ }
+ }
}
$obj = new c2();
foreach($obj as $v => $w) {
- echo "object:$v=>$w\n";
+ echo "object:$v=>$w\n";
}
print "Done\n";
diff --git a/tests/classes/iterators_006.phpt b/tests/classes/iterators_006.phpt
index 7baa077f2b..8bc8516723 100644
--- a/tests/classes/iterators_006.phpt
+++ b/tests/classes/iterators_006.phpt
@@ -5,47 +5,47 @@ ZE2 iterators and array wrapping
class ai implements Iterator {
- private $array;
+ private $array;
- function __construct() {
- $this->array = array('foo', 'bar', 'baz');
- }
+ function __construct() {
+ $this->array = array('foo', 'bar', 'baz');
+ }
- function rewind() {
- reset($this->array);
- $this->next();
- }
+ function rewind() {
+ reset($this->array);
+ $this->next();
+ }
- function valid() {
- return $this->key !== NULL;
- }
+ function valid() {
+ return $this->key !== NULL;
+ }
- function key() {
- return $this->key;
- }
+ function key() {
+ return $this->key;
+ }
- function current() {
- return $this->current;
- }
+ function current() {
+ return $this->current;
+ }
- function next() {
+ function next() {
$this->key = key($this->array);
$this->current = current($this->array);
next($this->array);
- }
+ }
}
class a implements IteratorAggregate {
- public function getIterator() {
- return new ai();
- }
+ public function getIterator() {
+ return new ai();
+ }
}
$array = new a();
foreach ($array as $property => $value) {
- print "$property: $value\n";
+ print "$property: $value\n";
}
#$array = $array->getIterator();
@@ -58,17 +58,16 @@ echo "===2nd===\n";
$array = new ai();
foreach ($array as $property => $value) {
- print "$property: $value\n";
+ print "$property: $value\n";
}
echo "===3rd===\n";
foreach ($array as $property => $value) {
- print "$property: $value\n";
+ print "$property: $value\n";
}
?>
-===DONE===
--EXPECT--
0: foo
1: bar
@@ -81,4 +80,3 @@ foreach ($array as $property => $value) {
0: foo
1: bar
2: baz
-===DONE===
diff --git a/tests/classes/iterators_007.phpt b/tests/classes/iterators_007.phpt
index 87b7e5318b..db1c868e0d 100644
--- a/tests/classes/iterators_007.phpt
+++ b/tests/classes/iterators_007.phpt
@@ -4,35 +4,34 @@ ZE2 iterators and exceptions
<?php
class Test implements Iterator
{
- public $arr = array(1, 2, 3);
- public $x = 0;
+ public $arr = array(1, 2, 3);
+ public $x = 0;
- public function rewind() { if ($this->x == 0) throw new Exception(__METHOD__); reset($this->arr); }
- public function current() { if ($this->x == 1) throw new Exception(__METHOD__); return current($this->arr); }
- public function key() { if ($this->x == 2) throw new Exception(__METHOD__); return key($this->arr); }
- public function next() { if ($this->x == 3) throw new Exception(__METHOD__); next($this->arr); }
- public function valid() { if ($this->x == 4) throw new Exception(__METHOD__); return (key($this->arr) !== NULL); }
+ public function rewind() { if ($this->x == 0) throw new Exception(__METHOD__); reset($this->arr); }
+ public function current() { if ($this->x == 1) throw new Exception(__METHOD__); return current($this->arr); }
+ public function key() { if ($this->x == 2) throw new Exception(__METHOD__); return key($this->arr); }
+ public function next() { if ($this->x == 3) throw new Exception(__METHOD__); next($this->arr); }
+ public function valid() { if ($this->x == 4) throw new Exception(__METHOD__); return (key($this->arr) !== NULL); }
}
$t = new Test();
while($t->x < 5)
{
- try
- {
- foreach($t as $k => $v)
- {
- echo "Current\n";
- }
- }
- catch(Exception $e)
- {
- echo "Caught in " . $e->getMessage() . "()\n";
- }
- $t->x++;
+ try
+ {
+ foreach($t as $k => $v)
+ {
+ echo "Current\n";
+ }
+ }
+ catch(Exception $e)
+ {
+ echo "Caught in " . $e->getMessage() . "()\n";
+ }
+ $t->x++;
}
?>
-===DONE===
--EXPECT--
Caught in Test::rewind()
Caught in Test::current()
@@ -40,4 +39,3 @@ Caught in Test::key()
Current
Caught in Test::next()
Caught in Test::valid()
-===DONE===
diff --git a/tests/classes/method_override_optional_arg_001.phpt b/tests/classes/method_override_optional_arg_001.phpt
index 897a2c2b93..3d9b0f5ff9 100644
--- a/tests/classes/method_override_optional_arg_001.phpt
+++ b/tests/classes/method_override_optional_arg_001.phpt
@@ -4,20 +4,20 @@ Method override allows optional default argument
<?php
class A {
- function foo($arg1 = 1) {
- }
+ function foo($arg1 = 1) {
+ }
}
class B extends A {
- function foo($arg1 = 2, $arg2 = 3) {
- var_dump($arg1);
- var_dump($arg2);
- }
+ function foo($arg1 = 2, $arg2 = 3) {
+ var_dump($arg1);
+ var_dump($arg2);
+ }
}
class C extends A {
- function foo() {
- }
+ function foo() {
+ }
}
$b = new B();
@@ -26,6 +26,4 @@ $b->foo(1);
?>
--EXPECTF--
-Warning: Declaration of C::foo() should be compatible with A::foo($arg1 = 1) in %s on line %d
-int(1)
-int(3)
+Fatal error: Declaration of C::foo() must be compatible with A::foo($arg1 = 1) in %s on line %d
diff --git a/tests/classes/method_override_optional_arg_002.phpt b/tests/classes/method_override_optional_arg_002.phpt
index 254392718b..ee94469e51 100644
--- a/tests/classes/method_override_optional_arg_002.phpt
+++ b/tests/classes/method_override_optional_arg_002.phpt
@@ -4,13 +4,13 @@ Omitting optional arg in method inherited from abstract class
<?php
abstract class A {
- function foo($arg = 1) {}
+ function foo($arg = 1) {}
}
class B extends A {
- function foo() {
- echo "foo\n";
- }
+ function foo() {
+ echo "foo\n";
+ }
}
$b = new B();
@@ -18,5 +18,4 @@ $b->foo();
?>
--EXPECTF--
-Warning: Declaration of B::foo() should be compatible with A::foo($arg = 1) in %s on line %d
-foo
+Fatal error: Declaration of B::foo() must be compatible with A::foo($arg = 1) in %s on line %d
diff --git a/tests/classes/object_reference_001.phpt b/tests/classes/object_reference_001.phpt
index 9842ac00f5..a98802d07a 100644
--- a/tests/classes/object_reference_001.phpt
+++ b/tests/classes/object_reference_001.phpt
@@ -4,11 +4,11 @@ ZE2 object references
<?php
class Foo {
- public $name;
+ public $name;
- function __construct() {
- $this->name = "I'm Foo!\n";
- }
+ function __construct() {
+ $this->name = "I'm Foo!\n";
+ }
}
$foo = new Foo;
diff --git a/tests/classes/private_001.phpt b/tests/classes/private_001.phpt
index 79b94c4f9a..34e716e334 100644
--- a/tests/classes/private_001.phpt
+++ b/tests/classes/private_001.phpt
@@ -4,13 +4,13 @@ ZE2 A private method can only be called inside the class
<?php
class pass {
- private static function show() {
- echo "Call show()\n";
- }
+ private static function show() {
+ echo "Call show()\n";
+ }
- public static function do_show() {
- pass::show();
- }
+ public static function do_show() {
+ pass::show();
+ }
}
pass::do_show();
diff --git a/tests/classes/private_002.phpt b/tests/classes/private_002.phpt
index 892580f36d..7f85324503 100644
--- a/tests/classes/private_002.phpt
+++ b/tests/classes/private_002.phpt
@@ -4,22 +4,22 @@ ZE2 A private method cannot be called in another class
<?php
class pass {
- private static function show() {
- echo "Call pass::show()\n";
- }
+ private static function show() {
+ echo "Call pass::show()\n";
+ }
- public static function do_show() {
- pass::show();
- }
+ public static function do_show() {
+ pass::show();
+ }
}
pass::do_show();
class fail {
- public static function show() {
- echo "Call fail::show()\n";
- pass::show();
- }
+ public static function show() {
+ echo "Call fail::show()\n";
+ pass::show();
+ }
}
fail::show();
diff --git a/tests/classes/private_003.phpt b/tests/classes/private_003.phpt
index 0843c5ef63..c142ad5cc7 100644
--- a/tests/classes/private_003.phpt
+++ b/tests/classes/private_003.phpt
@@ -4,23 +4,23 @@ ZE2 A private method cannot be called in a derived class
<?php
ini_set("error_reporting",2039);
class pass {
- private static function show() {
- echo "Call show()\n";
- }
+ private static function show() {
+ echo "Call show()\n";
+ }
- protected static function good() {
- pass::show();
- }
+ protected static function good() {
+ pass::show();
+ }
}
class fail extends pass {
- static function ok() {
- pass::good();
- }
+ static function ok() {
+ pass::good();
+ }
- static function not_ok() {
- pass::show();
- }
+ static function not_ok() {
+ pass::show();
+ }
}
fail::ok();
diff --git a/tests/classes/private_003b.phpt b/tests/classes/private_003b.phpt
index fe2f464ee8..9c5e5cbb9a 100644
--- a/tests/classes/private_003b.phpt
+++ b/tests/classes/private_003b.phpt
@@ -4,23 +4,23 @@ ZE2 A private method cannot be called in a derived class
<?php
class pass {
- private function show() {
- echo "Call show()\n";
- }
+ private function show() {
+ echo "Call show()\n";
+ }
- protected function good() {
- $this->show();
- }
+ protected function good() {
+ $this->show();
+ }
}
class fail extends pass {
- public function ok() {
- $this->good();
- }
+ public function ok() {
+ $this->good();
+ }
- public function not_ok() {
- $this->show();
- }
+ public function not_ok() {
+ $this->show();
+ }
}
$t = new fail();
diff --git a/tests/classes/private_004.phpt b/tests/classes/private_004.phpt
index 13a4e90535..bfecff55b9 100644
--- a/tests/classes/private_004.phpt
+++ b/tests/classes/private_004.phpt
@@ -4,19 +4,19 @@ ZE2 A private method cannot be called in a derived class
<?php
class pass {
- private static function show() {
- echo "Call show()\n";
- }
+ private static function show() {
+ echo "Call show()\n";
+ }
- public static function do_show() {
- pass::show();
- }
+ public static function do_show() {
+ pass::show();
+ }
}
class fail extends pass {
- static function do_show() {
- fail::show();
- }
+ static function do_show() {
+ fail::show();
+ }
}
pass::do_show();
diff --git a/tests/classes/private_004b.phpt b/tests/classes/private_004b.phpt
index db139f65b7..302c617a5f 100644
--- a/tests/classes/private_004b.phpt
+++ b/tests/classes/private_004b.phpt
@@ -4,19 +4,19 @@ ZE2 A private method cannot be called in a derived class
<?php
class pass {
- private function show() {
- echo "Call show()\n";
- }
+ private function show() {
+ echo "Call show()\n";
+ }
- public function do_show() {
- $this->show();
- }
+ public function do_show() {
+ $this->show();
+ }
}
class fail extends pass {
- function do_show() {
- $this->show();
- }
+ function do_show() {
+ $this->show();
+ }
}
$t = new pass();
diff --git a/tests/classes/private_005.phpt b/tests/classes/private_005.phpt
index 0c6d978f79..1fb0e3e9fa 100644
--- a/tests/classes/private_005.phpt
+++ b/tests/classes/private_005.phpt
@@ -4,19 +4,19 @@ ZE2 A private method cannot be called in a derived class
<?php
class pass {
- private static function show() {
- echo "Call show()\n";
- }
+ private static function show() {
+ echo "Call show()\n";
+ }
- public static function do_show() {
- pass::show();
- }
+ public static function do_show() {
+ pass::show();
+ }
}
class fail extends pass {
- static function do_show() {
- pass::show();
- }
+ static function do_show() {
+ pass::show();
+ }
}
pass::do_show();
diff --git a/tests/classes/private_006.phpt b/tests/classes/private_006.phpt
index 895affac75..9f755abf8e 100644
--- a/tests/classes/private_006.phpt
+++ b/tests/classes/private_006.phpt
@@ -3,13 +3,13 @@ ZE2 A private method can be overwritten in a second derived class
--FILE--
<?php
class first {
- private static function show() {
- echo "Call show()\n";
- }
+ private static function show() {
+ echo "Call show()\n";
+ }
- public static function do_show() {
- first::show();
- }
+ public static function do_show() {
+ first::show();
+ }
}
first::do_show();
@@ -25,9 +25,9 @@ class third extends second {
third::do_show();
class fail extends third {
- static function show() { // cannot be redeclared
- echo "Call show()\n";
- }
+ static function show() { // cannot be redeclared
+ echo "Call show()\n";
+ }
}
echo "Done\n";
diff --git a/tests/classes/private_006b.phpt b/tests/classes/private_006b.phpt
index 1c678601b6..cdb7f2166e 100644
--- a/tests/classes/private_006b.phpt
+++ b/tests/classes/private_006b.phpt
@@ -4,13 +4,13 @@ ZE2 A private method can be overwritten in a second derived class
<?php
class first {
- private function show() {
- echo "Call show()\n";
- }
+ private function show() {
+ echo "Call show()\n";
+ }
- public function do_show() {
- $this->show();
- }
+ public function do_show() {
+ $this->show();
+ }
}
$t1 = new first();
@@ -23,9 +23,9 @@ class second extends first {
//$t2->do_show();
class third extends second {
- private function show() {
- echo "Call show()\n";
- }
+ private function show() {
+ echo "Call show()\n";
+ }
}
$t3 = new third();
diff --git a/tests/classes/private_007.phpt b/tests/classes/private_007.phpt
index abc2258bc2..84cdb137b8 100644
--- a/tests/classes/private_007.phpt
+++ b/tests/classes/private_007.phpt
@@ -4,17 +4,17 @@ ZE2 A derived class does not know about privates of ancestors
<?php
class Bar {
- public static function pub() {
- Bar::priv();
- }
- private static function priv() {
- echo "Bar::priv()\n";
- }
+ public static function pub() {
+ Bar::priv();
+ }
+ private static function priv() {
+ echo "Bar::priv()\n";
+ }
}
class Foo extends Bar {
- public static function priv() {
- echo "Foo::priv()\n";
- }
+ public static function priv() {
+ echo "Foo::priv()\n";
+ }
}
Foo::pub();
diff --git a/tests/classes/private_007b.phpt b/tests/classes/private_007b.phpt
index 3272d0c8a0..305048055f 100644
--- a/tests/classes/private_007b.phpt
+++ b/tests/classes/private_007b.phpt
@@ -4,17 +4,17 @@ ZE2 A derived class does not know about privates of ancestors
<?php
class Bar {
- public function pub() {
- $this->priv();
- }
- private function priv() {
- echo "Bar::priv()\n";
- }
+ public function pub() {
+ $this->priv();
+ }
+ private function priv() {
+ echo "Bar::priv()\n";
+ }
}
class Foo extends Bar {
- public function priv() {
- echo "Foo::priv()\n";
- }
+ public function priv() {
+ echo "Foo::priv()\n";
+ }
}
$obj = new Foo();
diff --git a/tests/classes/private_members.phpt b/tests/classes/private_members.phpt
index 4d8fd9eeb0..1b48722dbb 100644
--- a/tests/classes/private_members.phpt
+++ b/tests/classes/private_members.phpt
@@ -9,15 +9,15 @@ class base
function __construct()
{
- echo __METHOD__ . "(begin)\n";
+ echo __METHOD__ . "(begin)\n";
$this->member = 'base::member';
$this->test();
- echo __METHOD__ . "(end)\n";
+ echo __METHOD__ . "(end)\n";
}
function test()
{
- echo __METHOD__ . "\n";
+ echo __METHOD__ . "\n";
print_r($this);
}
}
@@ -28,18 +28,18 @@ class derived extends base
function __construct()
{
- echo __METHOD__ . "(begin)\n";
- parent::__construct();
- parent::test();
- $this->test();
+ echo __METHOD__ . "(begin)\n";
+ parent::__construct();
+ parent::test();
+ $this->test();
$this->member = 'derived::member';
- echo __METHOD__ . "(end)\n";
+ echo __METHOD__ . "(end)\n";
}
function test()
{
- parent::test();
- echo __METHOD__ . "\n";
+ parent::test();
+ echo __METHOD__ . "\n";
print_r($this);
}
}
diff --git a/tests/classes/private_members_serialization.phpt b/tests/classes/private_members_serialization.phpt
index c196f7d8f9..1b04b6f59c 100644
--- a/tests/classes/private_members_serialization.phpt
+++ b/tests/classes/private_members_serialization.phpt
@@ -4,17 +4,17 @@ Verifies that it is possible to return private member names of parent classes in
<?php
class foo
{
- private $private = 'private';
- protected $protected = 'protected';
- public $public = 'public';
+ private $private = 'private';
+ protected $protected = 'protected';
+ public $public = 'public';
}
class bar extends foo
{
- public function __sleep()
- {
- return array("\0foo\0private", 'protected', 'public');
- }
+ public function __sleep()
+ {
+ return array("\0foo\0private", 'protected', 'public');
+ }
}
var_dump(str_replace("\0", '\0', serialize(new bar())));
diff --git a/tests/classes/private_redeclare.phpt b/tests/classes/private_redeclare.phpt
index b42cc7d7fe..cee59985c1 100644
--- a/tests/classes/private_redeclare.phpt
+++ b/tests/classes/private_redeclare.phpt
@@ -3,27 +3,27 @@ ZE2 A derived class does not know anything about inherited private methods
--FILE--
<?php
class base {
- private function show() {
- echo "base\n";
- }
- function test() {
- $this->show();
- }
+ private function show() {
+ echo "base\n";
+ }
+ function test() {
+ $this->show();
+ }
}
$t = new base();
$t->test();
class derived extends base {
- function show() {
- echo "derived\n";
- }
- function test() {
- echo "test\n";
- $this->show();
- parent::test();
- parent::show();
- }
+ function show() {
+ echo "derived\n";
+ }
+ function test() {
+ echo "test\n";
+ $this->show();
+ parent::test();
+ parent::show();
+ }
}
$t = new derived();
diff --git a/tests/classes/property_recreate_private.phpt b/tests/classes/property_recreate_private.phpt
index 6d25d71912..8dc3e18eb0 100644
--- a/tests/classes/property_recreate_private.phpt
+++ b/tests/classes/property_recreate_private.phpt
@@ -3,19 +3,19 @@ Unsetting and recreating private properties.
--FILE--
<?php
class C {
- private $p = 'test';
- function unsetPrivate() {
- unset($this->p);
- }
- function setPrivate() {
- $this->p = 'changed';
- }
+ private $p = 'test';
+ function unsetPrivate() {
+ unset($this->p);
+ }
+ function setPrivate() {
+ $this->p = 'changed';
+ }
}
class D extends C {
- function setP() {
- $this->p = 'changed in D';
- }
+ function setP() {
+ $this->p = 'changed in D';
+ }
}
echo "Unset and recreate a superclass's private property:\n";
@@ -49,7 +49,7 @@ $c->unsetPrivate();
$c->p = 'this will fail';
var_dump($c);
?>
-==Done==
+===DONE===
--EXPECTF--
Unset and recreate a superclass's private property:
object(D)#%d (1) {
diff --git a/tests/classes/property_recreate_protected.phpt b/tests/classes/property_recreate_protected.phpt
index ddbbb71fc9..11c3c7f900 100644
--- a/tests/classes/property_recreate_protected.phpt
+++ b/tests/classes/property_recreate_protected.phpt
@@ -3,19 +3,19 @@ Unsetting and recreating protected properties.
--FILE--
<?php
class C {
- protected $p = 'test';
- function unsetProtected() {
- unset($this->p);
- }
- function setProtected() {
- $this->p = 'changed';
- }
+ protected $p = 'test';
+ function unsetProtected() {
+ unset($this->p);
+ }
+ function setProtected() {
+ $this->p = 'changed';
+ }
}
class D extends C {
- function setP() {
- $this->p = 'changed in D';
- }
+ function setP() {
+ $this->p = 'changed in D';
+ }
}
$d = new D;
diff --git a/tests/classes/protected_001.phpt b/tests/classes/protected_001.phpt
index 44099b18fa..026a0f424b 100644
--- a/tests/classes/protected_001.phpt
+++ b/tests/classes/protected_001.phpt
@@ -4,13 +4,13 @@ ZE2 A protected method can only be called inside the class
<?php
class pass {
- protected static function fail() {
- echo "Call fail()\n";
- }
+ protected static function fail() {
+ echo "Call fail()\n";
+ }
- public static function good() {
- pass::fail();
- }
+ public static function good() {
+ pass::fail();
+ }
}
pass::good();
diff --git a/tests/classes/protected_001b.phpt b/tests/classes/protected_001b.phpt
index 6f00ffc1b3..971436c844 100644
--- a/tests/classes/protected_001b.phpt
+++ b/tests/classes/protected_001b.phpt
@@ -4,13 +4,13 @@ ZE2 A protected method can only be called inside the class
<?php
class pass {
- protected function fail() {
- echo "Call fail()\n";
- }
+ protected function fail() {
+ echo "Call fail()\n";
+ }
- public function good() {
- $this->fail();
- }
+ public function good() {
+ $this->fail();
+ }
}
$t = new pass();
diff --git a/tests/classes/protected_002.phpt b/tests/classes/protected_002.phpt
index da87200b6e..f3ddc15db9 100644
--- a/tests/classes/protected_002.phpt
+++ b/tests/classes/protected_002.phpt
@@ -4,22 +4,22 @@ ZE2 A protected method cannot be called in another class
<?php
class pass {
- protected static function show() {
- echo "Call pass::show()\n";
- }
+ protected static function show() {
+ echo "Call pass::show()\n";
+ }
- public static function do_show() {
- pass::show();
- }
+ public static function do_show() {
+ pass::show();
+ }
}
pass::do_show();
class fail {
- public static function show() {
- echo "Call fail::show()\n";
- pass::show();
- }
+ public static function show() {
+ echo "Call fail::show()\n";
+ pass::show();
+ }
}
fail::show();
diff --git a/tests/classes/serialize_001.phpt b/tests/classes/serialize_001.phpt
index c228e714e9..e0f7973cd7 100644
--- a/tests/classes/serialize_001.phpt
+++ b/tests/classes/serialize_001.phpt
@@ -5,48 +5,46 @@ ZE2 Serializable
class Test implements Serializable
{
- public $data;
+ public $data;
- function __construct($data)
- {
- echo __METHOD__ . "($data)\n";
- $this->data = $data;
- }
+ function __construct($data)
+ {
+ echo __METHOD__ . "($data)\n";
+ $this->data = $data;
+ }
- function serialize()
- {
- echo __METHOD__ . "({$this->data})\n";
- return $this->data;
- }
+ function serialize()
+ {
+ echo __METHOD__ . "({$this->data})\n";
+ return $this->data;
+ }
- function unserialize($serialized)
- {
- echo __METHOD__ . "($serialized)\n";
- $this->data = $serialized;
- var_dump($this);
- }
+ function unserialize($serialized)
+ {
+ echo __METHOD__ . "($serialized)\n";
+ $this->data = $serialized;
+ var_dump($this);
+ }
}
$tests = array('String', NULL, 42, false);
foreach($tests as $data)
{
- try
- {
- echo "==========\n";
- var_dump($data);
- $ser = serialize(new Test($data));
- var_dump(unserialize($ser));
- }
- catch(Exception $e)
- {
- echo 'Exception: ' . $e->getMessage() . "\n";
- }
+ try
+ {
+ echo "==========\n";
+ var_dump($data);
+ $ser = serialize(new Test($data));
+ var_dump(unserialize($ser));
+ }
+ catch(Exception $e)
+ {
+ echo 'Exception: ' . $e->getMessage() . "\n";
+ }
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
==========
string(6) "String"
@@ -76,4 +74,3 @@ bool(false)
Test::__construct()
Test::serialize()
Exception: Test::serialize() must return a string or NULL
-===DONE===
diff --git a/tests/classes/singleton_001.phpt b/tests/classes/singleton_001.phpt
index 45174158be..27d74122e2 100644
--- a/tests/classes/singleton_001.phpt
+++ b/tests/classes/singleton_001.phpt
@@ -4,24 +4,24 @@ ZE2 singleton
<?php
class Counter {
- private $counter = 0;
+ private $counter = 0;
- function increment_and_print() {
- echo ++$this->counter;
- echo "\n";
+ function increment_and_print() {
+ echo ++$this->counter;
+ echo "\n";
}
}
class SingletonCounter {
- private static $m_instance = NULL;
+ private static $m_instance = NULL;
- static function Instance() {
- if (self::$m_instance == NULL) {
- self::$m_instance = new Counter();
- }
- return self::$m_instance;
- }
+ static function Instance() {
+ if (self::$m_instance == NULL) {
+ self::$m_instance = new Counter();
+ }
+ return self::$m_instance;
+ }
}
SingletonCounter::Instance()->increment_and_print();
diff --git a/tests/classes/static_mix_1.phpt b/tests/classes/static_mix_1.phpt
index 8dead36856..01704193cd 100644
--- a/tests/classes/static_mix_1.phpt
+++ b/tests/classes/static_mix_1.phpt
@@ -4,15 +4,15 @@ ZE2 You cannot overload a static method with a non static method
<?php
class pass {
- static function show() {
- echo "Call to function pass::show()\n";
- }
+ static function show() {
+ echo "Call to function pass::show()\n";
+ }
}
class fail extends pass {
- function show() {
- echo "Call to function fail::show()\n";
- }
+ function show() {
+ echo "Call to function fail::show()\n";
+ }
}
pass::show();
diff --git a/tests/classes/static_mix_2.phpt b/tests/classes/static_mix_2.phpt
index bbf6f9c1dd..7f89ba3987 100644
--- a/tests/classes/static_mix_2.phpt
+++ b/tests/classes/static_mix_2.phpt
@@ -4,15 +4,15 @@ ZE2 You cannot overload a non static method with a static method
<?php
class pass {
- function show() {
- echo "Call to function pass::show()\n";
- }
+ function show() {
+ echo "Call to function pass::show()\n";
+ }
}
class fail extends pass {
- static function show() {
- echo "Call to function fail::show()\n";
- }
+ static function show() {
+ echo "Call to function fail::show()\n";
+ }
}
$t = new pass();
diff --git a/tests/classes/static_properties_001.phpt b/tests/classes/static_properties_001.phpt
index e5e545fa22..5772a0dbcc 100644
--- a/tests/classes/static_properties_001.phpt
+++ b/tests/classes/static_properties_001.phpt
@@ -4,7 +4,7 @@ ZE2 Initializing static properties to arrays
<?php
class test {
- static public $ar = array();
+ static public $ar = array();
}
var_dump(test::$ar);
diff --git a/tests/classes/static_properties_003.phpt b/tests/classes/static_properties_003.phpt
index 89c26d3dd3..30a6e2a510 100644
--- a/tests/classes/static_properties_003.phpt
+++ b/tests/classes/static_properties_003.phpt
@@ -25,7 +25,6 @@ var_dump(isset($c->y));
//$c->y = 1; // Fatal error, tested in static_properties_003_error3.phpt
//$c->y =& $ref; // Fatal error, tested in static_properties_003_error4.phpt
?>
-==Done==
--EXPECTF--
--> Access visible static prop like instance prop:
bool(false)
@@ -34,7 +33,7 @@ Notice: Accessing static property C::$x as non static in %s on line 11
Notice: Accessing static property C::$x as non static in %s on line 12
-Notice: Undefined property: C::$x in %s on line 12
+Warning: Undefined property: C::$x in %s on line %d
Notice: Accessing static property C::$x as non static in %s on line 13
@@ -46,4 +45,3 @@ string(5) "C::$x"
--> Access non-visible static prop like instance prop:
bool(false)
-==Done==
diff --git a/tests/classes/static_properties_003_error1.phpt b/tests/classes/static_properties_003_error1.phpt
index 08a89568e4..fdb91b3e0c 100644
--- a/tests/classes/static_properties_003_error1.phpt
+++ b/tests/classes/static_properties_003_error1.phpt
@@ -10,7 +10,7 @@ $c = new C;
echo "\n--> Access non-visible static prop like instance prop:\n";
unset($c->y);
?>
-==Done==
+===DONE===
--EXPECTF--
--> Access non-visible static prop like instance prop:
diff --git a/tests/classes/static_properties_003_error2.phpt b/tests/classes/static_properties_003_error2.phpt
index 45ccff11b6..80e9c0d0c9 100644
--- a/tests/classes/static_properties_003_error2.phpt
+++ b/tests/classes/static_properties_003_error2.phpt
@@ -10,7 +10,7 @@ $c = new C;
echo "\n--> Access non-visible static prop like instance prop:\n";
echo $c->y;
?>
-==Done==
+===DONE===
--EXPECTF--
--> Access non-visible static prop like instance prop:
diff --git a/tests/classes/static_properties_003_error3.phpt b/tests/classes/static_properties_003_error3.phpt
index e8588a1160..b35307d814 100644
--- a/tests/classes/static_properties_003_error3.phpt
+++ b/tests/classes/static_properties_003_error3.phpt
@@ -10,7 +10,7 @@ $c = new C;
echo "\n--> Access non-visible static prop like instance prop:\n";
$c->y = 1;
?>
-==Done==
+===DONE===
--EXPECTF--
--> Access non-visible static prop like instance prop:
diff --git a/tests/classes/static_properties_003_error4.phpt b/tests/classes/static_properties_003_error4.phpt
index a96ffb2977..ab7c316239 100644
--- a/tests/classes/static_properties_003_error4.phpt
+++ b/tests/classes/static_properties_003_error4.phpt
@@ -14,10 +14,8 @@ try {
echo $e, "\n";
}
?>
-==Done==
--EXPECTF--
--> Access non-visible static prop like instance prop:
Error: Cannot access protected property C::$y in %s:%d
Stack trace:
#0 {main}
-==Done==
diff --git a/tests/classes/static_properties_004.phpt b/tests/classes/static_properties_004.phpt
index 42860c3301..956b49885d 100644
--- a/tests/classes/static_properties_004.phpt
+++ b/tests/classes/static_properties_004.phpt
@@ -18,7 +18,6 @@ $ref = 'changed.one';
D::$p =& $ref;
var_dump(C::$p, D::$p, E::$p);
?>
-==Done==
--EXPECT--
Inherited static properties refer to the same value across classes:
string(8) "original"
@@ -34,4 +33,3 @@ References cannot be used to split the properties:
string(11) "changed.one"
string(11) "changed.one"
string(11) "changed.one"
-==Done==
diff --git a/tests/classes/static_this.phpt b/tests/classes/static_this.phpt
index f7a11f5481..a945d76c9d 100644
--- a/tests/classes/static_this.phpt
+++ b/tests/classes/static_this.phpt
@@ -5,21 +5,21 @@ ZE2 $this can be an argument to a static function
class TestClass
{
- function __construct()
- {
- self::Test1();
- $this->Test1();
- }
+ function __construct()
+ {
+ self::Test1();
+ $this->Test1();
+ }
- static function Test1()
- {
- var_dump($this);
- }
+ static function Test1()
+ {
+ var_dump($this);
+ }
- static function Test2($this)
- {
- var_dump($this);
- }
+ static function Test2($this)
+ {
+ var_dump($this);
+ }
}
$obj = new TestClass;
diff --git a/tests/classes/this.phpt b/tests/classes/this.phpt
index 30ea83e285..418ea63912 100644
--- a/tests/classes/this.phpt
+++ b/tests/classes/this.phpt
@@ -10,7 +10,7 @@ class Foo
{
function replace($other)
{
- echo __METHOD__ . "\n";
+ echo __METHOD__ . "\n";
$this = $other;
print $this->prop;
print $other->prop;
@@ -18,7 +18,7 @@ class Foo
function indirect($other)
{
- echo __METHOD__ . "\n";
+ echo __METHOD__ . "\n";
$this = $other;
$result = $this = $other;
print $result->prop;
@@ -27,8 +27,8 @@ class Foo
function retrieve(&$other)
{
- echo __METHOD__ . "\n";
- $other = $this;
+ echo __METHOD__ . "\n";
+ $other = $this;
}
}
diff --git a/tests/classes/tostring_001.phpt b/tests/classes/tostring_001.phpt
index 418aa1fc25..3053da9140 100644
--- a/tests/classes/tostring_001.phpt
+++ b/tests/classes/tostring_001.phpt
@@ -11,7 +11,7 @@ class test2
{
function __toString()
{
- echo __METHOD__ . "()\n";
+ echo __METHOD__ . "()\n";
return "Converted\n";
}
}
@@ -20,7 +20,7 @@ class test3
{
function __toString()
{
- echo __METHOD__ . "()\n";
+ echo __METHOD__ . "()\n";
return 42;
}
}
@@ -56,7 +56,11 @@ echo $o , $o;
echo "====test7====\n";
$ar = array();
$ar[$o->__toString()] = "ERROR";
-echo $ar[$o];
+try {
+ echo $ar[$o];
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
echo "====test8====\n";
var_dump(trim($o));
@@ -76,7 +80,7 @@ try {
?>
====DONE====
---EXPECTF--
+--EXPECT--
====test1====
test1 Object
(
@@ -114,8 +118,7 @@ test2::__toString()
Converted
====test7====
test2::__toString()
-
-Warning: Illegal offset type in %s on line %d
+Illegal offset type
====test8====
test2::__toString()
string(9) "Converted"
@@ -125,7 +128,7 @@ string(9) "Converted"
test2::__toString()
Converted
====test10====
-object(test3)#1 (0) {
+object(test3)#2 (0) {
}
test3::__toString()
Method test3::__toString() must return a string value
diff --git a/tests/classes/tostring_002.phpt b/tests/classes/tostring_002.phpt
index 7dda92339e..3977ad883f 100644
--- a/tests/classes/tostring_002.phpt
+++ b/tests/classes/tostring_002.phpt
@@ -5,15 +5,15 @@ ZE2 __toString() in __destruct
class Test
{
- function __toString()
- {
- return "Hello\n";
- }
+ function __toString()
+ {
+ return "Hello\n";
+ }
- function __destruct()
- {
- echo $this;
- }
+ function __destruct()
+ {
+ echo $this;
+ }
}
$o = new Test;
diff --git a/tests/classes/tostring_003.phpt b/tests/classes/tostring_003.phpt
index 4dad51f2cf..87a5fe42e1 100644
--- a/tests/classes/tostring_003.phpt
+++ b/tests/classes/tostring_003.phpt
@@ -5,26 +5,26 @@ ZE2 __toString() in __destruct/exception
class Test
{
- function __toString()
- {
- throw new Exception("Damn!");
- return "Hello\n";
- }
+ function __toString()
+ {
+ throw new Exception("Damn!");
+ return "Hello\n";
+ }
- function __destruct()
- {
- echo $this;
- }
+ function __destruct()
+ {
+ echo $this;
+ }
}
try
{
- $o = new Test;
- $o = NULL;
+ $o = new Test;
+ $o = NULL;
}
catch(Exception $e)
{
- var_dump($e->getMessage());
+ var_dump($e->getMessage());
}
?>
diff --git a/tests/classes/tostring_004.phpt b/tests/classes/tostring_004.phpt
index 4134c702b6..8cde860d56 100644
--- a/tests/classes/tostring_004.phpt
+++ b/tests/classes/tostring_004.phpt
@@ -2,7 +2,7 @@
Object to string conversion: error cases and behaviour variations.
--FILE--
<?php
-function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+function test_error_handler($err_no, $err_msg, $filename, $linenum) {
echo "Error: $err_no - $err_msg\n";
}
set_error_handler('test_error_handler');
@@ -28,9 +28,9 @@ try {
echo "\n\nObject with bad __toString():\n";
class badToString {
- function __toString() {
- return 0;
- }
+ function __toString() {
+ return 0;
+ }
}
$obj = new badToString;
@@ -53,7 +53,7 @@ try {
--EXPECT--
Object with no __toString():
Try 1:
-Object of class stdClass could not be converted to string
+printf() expects parameter 1 to be string, object given
Try 2:
diff --git a/tests/classes/type_hinting_001.phpt b/tests/classes/type_hinting_001.phpt
index 35356581f4..fdc74a3194 100644
--- a/tests/classes/type_hinting_001.phpt
+++ b/tests/classes/type_hinting_001.phpt
@@ -4,21 +4,21 @@ ZE2 class type hinting
<?php
interface Foo {
- function a(Foo $foo);
+ function a(Foo $foo);
}
interface Bar {
- function b(Bar $bar);
+ function b(Bar $bar);
}
class FooBar implements Foo, Bar {
- function a(Foo $foo) {
- // ...
- }
+ function a(Foo $foo) {
+ // ...
+ }
- function b(Bar $bar) {
- // ...
- }
+ function b(Bar $bar) {
+ // ...
+ }
}
class Blort {
diff --git a/tests/classes/type_hinting_002.phpt b/tests/classes/type_hinting_002.phpt
index b65bc85c93..23d201a51a 100644
--- a/tests/classes/type_hinting_002.phpt
+++ b/tests/classes/type_hinting_002.phpt
@@ -4,7 +4,7 @@ ZE2 class type hinting non existing class
<?php
class Foo {
- function a(NonExisting $foo) {}
+ function a(NonExisting $foo) {}
}
$o = new Foo;
diff --git a/tests/classes/type_hinting_003.phpt b/tests/classes/type_hinting_003.phpt
index fb788e3d9c..9dfbd7c3b8 100644
--- a/tests/classes/type_hinting_003.phpt
+++ b/tests/classes/type_hinting_003.phpt
@@ -5,29 +5,29 @@ ZE2 class type hinting with arrays
class Test
{
- static function f1(array $ar)
- {
- echo __METHOD__ . "()\n";
- var_dump($ar);
- }
+ static function f1(array $ar)
+ {
+ echo __METHOD__ . "()\n";
+ var_dump($ar);
+ }
- static function f2(array $ar = NULL)
- {
- echo __METHOD__ . "()\n";
- var_dump($ar);
- }
+ static function f2(array $ar = NULL)
+ {
+ echo __METHOD__ . "()\n";
+ var_dump($ar);
+ }
- static function f3(array $ar = array())
- {
- echo __METHOD__ . "()\n";
- var_dump($ar);
- }
+ static function f3(array $ar = array())
+ {
+ echo __METHOD__ . "()\n";
+ var_dump($ar);
+ }
- static function f4(array $ar = array(25))
- {
- echo __METHOD__ . "()\n";
- var_dump($ar);
- }
+ static function f4(array $ar = array(25))
+ {
+ echo __METHOD__ . "()\n";
+ var_dump($ar);
+ }
}
Test::f1(array(42));
diff --git a/tests/classes/type_hinting_005a.phpt b/tests/classes/type_hinting_005a.phpt
index 54af0e8c96..065ba70e8a 100644
--- a/tests/classes/type_hinting_005a.phpt
+++ b/tests/classes/type_hinting_005a.phpt
@@ -4,15 +4,11 @@ Check type hint compatibility in overrides with array hints.
<?php
Class C { function f(array $a) {} }
-echo "Compatible hint.\n";
+// Compatible hint.
Class D1 extends C { function f(array $a) {} }
-echo "Class hint, should be array.\n";
+// Class hint, should be array.
Class D2 extends C { function f(SomeClass $a) {} }
?>
-==DONE==
--EXPECTF--
-Warning: Declaration of D2::f(SomeClass $a) should be compatible with C::f(array $a) in %s on line 8
-Compatible hint.
-Class hint, should be array.
-==DONE==
+Fatal error: Declaration of D2::f(SomeClass $a) must be compatible with C::f(array $a) in %s on line 8
diff --git a/tests/classes/type_hinting_005c.phpt b/tests/classes/type_hinting_005c.phpt
index 00048c3ef9..6cc3e3e369 100644
--- a/tests/classes/type_hinting_005c.phpt
+++ b/tests/classes/type_hinting_005c.phpt
@@ -4,11 +4,8 @@ Check type hint compatibility in overrides with array hints.
<?php
Class C { function f(SomeClass $a) {} }
-echo "Array hint, should be class.\n";
+// Array hint, should be class.
Class D extends C { function f(array $a) {} }
?>
-==DONE==
--EXPECTF--
-Warning: Declaration of D::f(array $a) should be compatible with C::f(SomeClass $a) in %s on line 5
-Array hint, should be class.
-==DONE==
+Fatal error: Declaration of D::f(array $a) must be compatible with C::f(SomeClass $a) in %s on line 5
diff --git a/tests/classes/type_hinting_005d.phpt b/tests/classes/type_hinting_005d.phpt
index a1ce30950c..51c2a5a995 100644
--- a/tests/classes/type_hinting_005d.phpt
+++ b/tests/classes/type_hinting_005d.phpt
@@ -4,11 +4,8 @@ Check type hint compatibility in overrides with array hints.
<?php
Class C { function f($a) {} }
-echo "Array hint, should be nothing.\n";
+// Array hint, should be nothing.
Class D extends C { function f(array $a) {} }
?>
-==DONE==
--EXPECTF--
-Warning: Declaration of D::f(array $a) should be compatible with C::f($a) in %s on line 5
-Array hint, should be nothing.
-==DONE==
+Fatal error: Declaration of D::f(array $a) must be compatible with C::f($a) in %s on line 5
diff --git a/tests/classes/unset_properties.phpt b/tests/classes/unset_properties.phpt
index 417542ddea..fa576713d5 100644
--- a/tests/classes/unset_properties.phpt
+++ b/tests/classes/unset_properties.phpt
@@ -6,68 +6,68 @@ methods themselves.
class Test
{
- public $publicProperty = 'publicProperty set';
-
- protected $protectedProperty = 'protectedProperty set';
-
- private $privateProperty = 'privateProperty set';
-
- public function __get($name)
- {
- return '__get "' . $name . '"';
- }
-
- public function __set($name, $value)
- {
- $this->$name = $value;
- echo '__set "' . $name . '" to "' . $value . '"';
- }
-
- public function __isset($name)
- {
- echo '__isset "' . $name . '"';
- return isset($this->$name);
- }
-
- public function getPublicProperty()
- {
- return $this->publicProperty;
- }
-
- public function setPublicProperty($publicProperty)
- {
- $this->publicProperty = $publicProperty;
- }
-
- public function unsetProtectedProperty()
- {
- unset($this->protectedProperty);
- }
-
- public function getProtectedProperty()
- {
- return $this->protectedProperty;
- }
-
- public function setProtectedProperty($protectedProperty)
- {
- $this->protectedProperty = $protectedProperty;
- }
-
- public function unsetPrivateProperty()
- {
- unset($this->privateProperty);
- }
-
- public function getPrivateProperty()
- {
- return $this->privateProperty;
- }
-
- public function setPrivateProperty($privateProperty)
- {
- $this->privateProperty = $privateProperty;
- }
+ public $publicProperty = 'publicProperty set';
+
+ protected $protectedProperty = 'protectedProperty set';
+
+ private $privateProperty = 'privateProperty set';
+
+ public function __get($name)
+ {
+ return '__get "' . $name . '"';
+ }
+
+ public function __set($name, $value)
+ {
+ $this->$name = $value;
+ echo '__set "' . $name . '" to "' . $value . '"';
+ }
+
+ public function __isset($name)
+ {
+ echo '__isset "' . $name . '"';
+ return isset($this->$name);
+ }
+
+ public function getPublicProperty()
+ {
+ return $this->publicProperty;
+ }
+
+ public function setPublicProperty($publicProperty)
+ {
+ $this->publicProperty = $publicProperty;
+ }
+
+ public function unsetProtectedProperty()
+ {
+ unset($this->protectedProperty);
+ }
+
+ public function getProtectedProperty()
+ {
+ return $this->protectedProperty;
+ }
+
+ public function setProtectedProperty($protectedProperty)
+ {
+ $this->protectedProperty = $protectedProperty;
+ }
+
+ public function unsetPrivateProperty()
+ {
+ unset($this->privateProperty);
+ }
+
+ public function getPrivateProperty()
+ {
+ return $this->privateProperty;
+ }
+
+ public function setPrivateProperty($privateProperty)
+ {
+ $this->privateProperty = $privateProperty;
+ }
}
// verifying public property
diff --git a/tests/classes/visibility_000a.phpt b/tests/classes/visibility_000a.phpt
index 00e918ad30..276e7a9f79 100644
--- a/tests/classes/visibility_000a.phpt
+++ b/tests/classes/visibility_000a.phpt
@@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility
<?php
class father {
- function f0() {}
- function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
+ function f0() {}
+ function f1() {}
+ public function f2() {}
+ protected function f3() {}
+ private function f4() {}
}
class same extends father {
- // overload fn with same visibility
- function f0() {}
- public function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
+ // overload fn with same visibility
+ function f0() {}
+ public function f1() {}
+ public function f2() {}
+ protected function f3() {}
+ private function f4() {}
}
class fail extends same {
- protected function f0() {}
+ protected function f0() {}
}
echo "Done\n"; // shouldn't be displayed
diff --git a/tests/classes/visibility_000b.phpt b/tests/classes/visibility_000b.phpt
index aeb3078b72..56e5fd9c27 100644
--- a/tests/classes/visibility_000b.phpt
+++ b/tests/classes/visibility_000b.phpt
@@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility
<?php
class father {
- function f0() {}
- function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
+ function f0() {}
+ function f1() {}
+ public function f2() {}
+ protected function f3() {}
+ private function f4() {}
}
class same extends father {
- // overload fn with same visibility
- function f0() {}
- public function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
+ // overload fn with same visibility
+ function f0() {}
+ public function f1() {}
+ public function f2() {}
+ protected function f3() {}
+ private function f4() {}
}
class fail extends same {
- private function f0() {}
+ private function f0() {}
}
echo "Done\n"; // shouldn't be displayed
diff --git a/tests/classes/visibility_000c.phpt b/tests/classes/visibility_000c.phpt
index d1a7c9f1e1..c56311d72b 100644
--- a/tests/classes/visibility_000c.phpt
+++ b/tests/classes/visibility_000c.phpt
@@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility
<?php
class father {
- function f0() {}
- function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
+ function f0() {}
+ function f1() {}
+ public function f2() {}
+ protected function f3() {}
+ private function f4() {}
}
class same extends father {
- // overload fn with same visibility
- function f0() {}
- public function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
+ // overload fn with same visibility
+ function f0() {}
+ public function f1() {}
+ public function f2() {}
+ protected function f3() {}
+ private function f4() {}
}
class fail extends same {
- function f0() {}
+ function f0() {}
}
echo "Done\n"; // shouldn't be displayed
diff --git a/tests/classes/visibility_001a.phpt b/tests/classes/visibility_001a.phpt
index 50baf64d67..bb1a7c2714 100644
--- a/tests/classes/visibility_001a.phpt
+++ b/tests/classes/visibility_001a.phpt
@@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility
<?php
class father {
- function f0() {}
- function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
+ function f0() {}
+ function f1() {}
+ public function f2() {}
+ protected function f3() {}
+ private function f4() {}
}
class same extends father {
- // overload fn with same visibility
- function f0() {}
- public function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
+ // overload fn with same visibility
+ function f0() {}
+ public function f1() {}
+ public function f2() {}
+ protected function f3() {}
+ private function f4() {}
}
class fail extends same {
- protected function f1() {}
+ protected function f1() {}
}
echo "Done\n"; // shouldn't be displayed
diff --git a/tests/classes/visibility_001b.phpt b/tests/classes/visibility_001b.phpt
index 626b5303f8..666a530f36 100644
--- a/tests/classes/visibility_001b.phpt
+++ b/tests/classes/visibility_001b.phpt
@@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility
<?php
class father {
- function f0() {}
- function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
+ function f0() {}
+ function f1() {}
+ public function f2() {}
+ protected function f3() {}
+ private function f4() {}
}
class same extends father {
- // overload fn with same visibility
- function f0() {}
- public function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
+ // overload fn with same visibility
+ function f0() {}
+ public function f1() {}
+ public function f2() {}
+ protected function f3() {}
+ private function f4() {}
}
class fail extends same {
- private function f1() {}
+ private function f1() {}
}
echo "Done\n"; // shouldn't be displayed
diff --git a/tests/classes/visibility_001c.phpt b/tests/classes/visibility_001c.phpt
index 956c6762df..8185beddc2 100644
--- a/tests/classes/visibility_001c.phpt
+++ b/tests/classes/visibility_001c.phpt
@@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility
<?php
class father {
- function f0() {}
- function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
+ function f0() {}
+ function f1() {}
+ public function f2() {}
+ protected function f3() {}
+ private function f4() {}
}
class same extends father {
- // overload fn with same visibility
- function f0() {}
- public function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
+ // overload fn with same visibility
+ function f0() {}
+ public function f1() {}
+ public function f2() {}
+ protected function f3() {}
+ private function f4() {}
}
class fail extends same {
- function f1() {}
+ function f1() {}
}
echo "Done\n"; // shouldn't be displayed
diff --git a/tests/classes/visibility_002a.phpt b/tests/classes/visibility_002a.phpt
index 2fd402070d..c1a93482a5 100644
--- a/tests/classes/visibility_002a.phpt
+++ b/tests/classes/visibility_002a.phpt
@@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility
<?php
class father {
- function f0() {}
- function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
+ function f0() {}
+ function f1() {}
+ public function f2() {}
+ protected function f3() {}
+ private function f4() {}
}
class same extends father {
- // overload fn with same visibility
- function f0() {}
- public function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
+ // overload fn with same visibility
+ function f0() {}
+ public function f1() {}
+ public function f2() {}
+ protected function f3() {}
+ private function f4() {}
}
class fail extends same {
- protected function f2() {}
+ protected function f2() {}
}
echo "Done\n"; // shouldn't be displayed
diff --git a/tests/classes/visibility_002b.phpt b/tests/classes/visibility_002b.phpt
index a8b1c5e79e..a46386d19c 100644
--- a/tests/classes/visibility_002b.phpt
+++ b/tests/classes/visibility_002b.phpt
@@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility
<?php
class father {
- function f0() {}
- function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
+ function f0() {}
+ function f1() {}
+ public function f2() {}
+ protected function f3() {}
+ private function f4() {}
}
class same extends father {
- // overload fn with same visibility
- function f0() {}
- public function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
+ // overload fn with same visibility
+ function f0() {}
+ public function f1() {}
+ public function f2() {}
+ protected function f3() {}
+ private function f4() {}
}
class fail extends same {
- private function f2() {}
+ private function f2() {}
}
echo "Done\n"; // shouldn't be displayed
diff --git a/tests/classes/visibility_002c.phpt b/tests/classes/visibility_002c.phpt
index 64560171cc..406a16dd20 100644
--- a/tests/classes/visibility_002c.phpt
+++ b/tests/classes/visibility_002c.phpt
@@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility
<?php
class father {
- function f0() {}
- function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
+ function f0() {}
+ function f1() {}
+ public function f2() {}
+ protected function f3() {}
+ private function f4() {}
}
class same extends father {
- // overload fn with same visibility
- function f0() {}
- public function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
+ // overload fn with same visibility
+ function f0() {}
+ public function f1() {}
+ public function f2() {}
+ protected function f3() {}
+ private function f4() {}
}
class fail extends same {
- function f2() {}
+ function f2() {}
}
echo "Done\n"; // shouldn't be displayed
diff --git a/tests/classes/visibility_003a.phpt b/tests/classes/visibility_003a.phpt
index 17f5b49eb9..4a9bb97f9c 100644
--- a/tests/classes/visibility_003a.phpt
+++ b/tests/classes/visibility_003a.phpt
@@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility
<?php
class father {
- function f0() {}
- function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
+ function f0() {}
+ function f1() {}
+ public function f2() {}
+ protected function f3() {}
+ private function f4() {}
}
class same extends father {
- // overload fn with same visibility
- function f0() {}
- public function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
+ // overload fn with same visibility
+ function f0() {}
+ public function f1() {}
+ public function f2() {}
+ protected function f3() {}
+ private function f4() {}
}
class fail extends same {
- public function f3() {}
+ public function f3() {}
}
echo "Done\n";
diff --git a/tests/classes/visibility_003b.phpt b/tests/classes/visibility_003b.phpt
index 474e0df235..504408e68f 100644
--- a/tests/classes/visibility_003b.phpt
+++ b/tests/classes/visibility_003b.phpt
@@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility
<?php
class father {
- function f0() {}
- function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
+ function f0() {}
+ function f1() {}
+ public function f2() {}
+ protected function f3() {}
+ private function f4() {}
}
class same extends father {
- // overload fn with same visibility
- function f0() {}
- public function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
+ // overload fn with same visibility
+ function f0() {}
+ public function f1() {}
+ public function f2() {}
+ protected function f3() {}
+ private function f4() {}
}
class fail extends same {
- private function f3() {}
+ private function f3() {}
}
echo "Done\n"; // shouldn't be displayed
diff --git a/tests/classes/visibility_003c.phpt b/tests/classes/visibility_003c.phpt
index 7ac3239f59..e396331110 100644
--- a/tests/classes/visibility_003c.phpt
+++ b/tests/classes/visibility_003c.phpt
@@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility
<?php
class father {
- function f0() {}
- function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
+ function f0() {}
+ function f1() {}
+ public function f2() {}
+ protected function f3() {}
+ private function f4() {}
}
class same extends father {
- // overload fn with same visibility
- function f0() {}
- public function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
+ // overload fn with same visibility
+ function f0() {}
+ public function f1() {}
+ public function f2() {}
+ protected function f3() {}
+ private function f4() {}
}
class fail extends same {
- function f3() {}
+ function f3() {}
}
echo "Done\n";
diff --git a/tests/classes/visibility_004a.phpt b/tests/classes/visibility_004a.phpt
index a6acb40569..115d5d743e 100644
--- a/tests/classes/visibility_004a.phpt
+++ b/tests/classes/visibility_004a.phpt
@@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility
<?php
class father {
- function f0() {}
- function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
+ function f0() {}
+ function f1() {}
+ public function f2() {}
+ protected function f3() {}
+ private function f4() {}
}
class same extends father {
- // overload fn with same visibility
- function f0() {}
- public function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
+ // overload fn with same visibility
+ function f0() {}
+ public function f1() {}
+ public function f2() {}
+ protected function f3() {}
+ private function f4() {}
}
class fail extends same {
- public function f4() {}
+ public function f4() {}
}
echo "Done\n";
diff --git a/tests/classes/visibility_004b.phpt b/tests/classes/visibility_004b.phpt
index 9e416fc6ae..203ae878ff 100644
--- a/tests/classes/visibility_004b.phpt
+++ b/tests/classes/visibility_004b.phpt
@@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility
<?php
class father {
- function f0() {}
- function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
+ function f0() {}
+ function f1() {}
+ public function f2() {}
+ protected function f3() {}
+ private function f4() {}
}
class same extends father {
- // overload fn with same visibility
- function f0() {}
- public function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
+ // overload fn with same visibility
+ function f0() {}
+ public function f1() {}
+ public function f2() {}
+ protected function f3() {}
+ private function f4() {}
}
class fail extends same {
- protected function f4() {}
+ protected function f4() {}
}
echo "Done\n"; // shouldn't be displayed
diff --git a/tests/classes/visibility_004c.phpt b/tests/classes/visibility_004c.phpt
index abe25b1b39..b2d0939bb9 100644
--- a/tests/classes/visibility_004c.phpt
+++ b/tests/classes/visibility_004c.phpt
@@ -4,25 +4,25 @@ ZE2 A redeclared method must have the same or higher visibility
<?php
class father {
- function f0() {}
- function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
+ function f0() {}
+ function f1() {}
+ public function f2() {}
+ protected function f3() {}
+ private function f4() {}
}
class same extends father {
- // overload fn with same visibility
- function f0() {}
- public function f1() {}
- public function f2() {}
- protected function f3() {}
- private function f4() {}
+ // overload fn with same visibility
+ function f0() {}
+ public function f1() {}
+ public function f2() {}
+ protected function f3() {}
+ private function f4() {}
}
class fail extends same {
- function f4() {}
+ function f4() {}
}
echo "Done\n";
diff --git a/tests/classes/visibility_005.phpt b/tests/classes/visibility_005.phpt
index 859a5f7b6c..ac7a2dd35a 100644
--- a/tests/classes/visibility_005.phpt
+++ b/tests/classes/visibility_005.phpt
@@ -5,16 +5,16 @@ ZE2 foreach and property visibility
class base
{
- public $a=1;
- protected $b=2;
- private $c=3;
+ public $a=1;
+ protected $b=2;
+ private $c=3;
- function f()
- {
- foreach($this as $k=>$v) {
- echo "$k=>$v\n";
- }
- }
+ function f()
+ {
+ foreach($this as $k=>$v) {
+ echo "$k=>$v\n";
+ }
+ }
}
class derived extends base
@@ -27,7 +27,7 @@ echo "===base::function===\n";
$o->f();
echo "===base,foreach===\n";
foreach($o as $k=>$v) {
- echo "$k=>$v\n";
+ echo "$k=>$v\n";
}
$o = new derived;
@@ -36,7 +36,7 @@ echo "===derived::function===\n";
$o->f();
echo "===derived,foreach===\n";
foreach($o as $k=>$v) {
- echo "$k=>$v\n";
+ echo "$k=>$v\n";
}
?>
diff --git a/tests/func/003.phpt b/tests/func/003.phpt
index 8234af2e17..2333947249 100644
--- a/tests/func/003.phpt
+++ b/tests/func/003.phpt
@@ -89,10 +89,10 @@ echo "$result\n";
function andi($i, $j)
{
- for ($k=$i ; $k<=$j ; $k++) {
- if ($k >5) continue;
- echo "$k\n";
- }
+ for ($k=$i ; $k<=$j ; $k++) {
+ if ($k >5) continue;
+ echo "$k\n";
+ }
}
andi (3,10);
diff --git a/tests/func/005.phpt b/tests/func/005.phpt
index 1ba45123c4..6373d2e550 100644
--- a/tests/func/005.phpt
+++ b/tests/func/005.phpt
@@ -5,7 +5,7 @@ Testing register_shutdown_function()
function foo()
{
- print "foo";
+ print "foo";
}
register_shutdown_function("foo");
diff --git a/tests/func/005a.phpt b/tests/func/005a.phpt
index 8cd0d211ab..a7ed5dbfdd 100644
--- a/tests/func/005a.phpt
+++ b/tests/func/005a.phpt
@@ -13,7 +13,7 @@ echo "Start\n";
function boo()
{
- echo "Shutdown\n";
+ echo "Shutdown\n";
}
register_shutdown_function("boo");
diff --git a/tests/func/010.phpt b/tests/func/010.phpt
index 4c28dea1b7..8b21df31ea 100644
--- a/tests/func/010.phpt
+++ b/tests/func/010.phpt
@@ -14,15 +14,15 @@ $limit = $boundary+42;
function test($a,$b)
{
- var_dump($a === $b);
- test2($a,$b);
+ var_dump($a === $b);
+ test2($a,$b);
}
function test2($a, $b)
{
- if ($a !== $b) {
- var_dump("something went wrong: $a !== $b");
- }
+ if ($a !== $b) {
+ var_dump("something went wrong: $a !== $b");
+ }
}
@@ -30,25 +30,25 @@ function test2($a, $b)
$str = "<?php\nfunction x(";
for($i=0; $i < $limit; ++$i) {
- $str .= '$v'.dechex($i).($i===($limit-1) ? '' : ',');
+ $str .= '$v'.dechex($i).($i===($limit-1) ? '' : ',');
}
$str .= ') {
- test($v42, \'42\');
- test(\'4000\', $v4000);
- test2($v300, \'300\');
- test($v0, \'0\'); // first
- test($v'.dechex($limit-1).", '".dechex($limit-1).'\'); // last
- test($v'.dechex($boundary).", '".dechex($boundary).'\'); //boundary
- test($v'.dechex($boundary+1).", '".dechex($boundary+1).'\'); //boundary+1
- test($v'.dechex($boundary-1).", '".dechex($boundary-1).'\'); //boundary-1
+ test($v42, \'42\');
+ test(\'4000\', $v4000);
+ test2($v300, \'300\');
+ test($v0, \'0\'); // first
+ test($v'.dechex($limit-1).", '".dechex($limit-1).'\'); // last
+ test($v'.dechex($boundary).", '".dechex($boundary).'\'); //boundary
+ test($v'.dechex($boundary+1).", '".dechex($boundary+1).'\'); //boundary+1
+ test($v'.dechex($boundary-1).", '".dechex($boundary-1).'\'); //boundary-1
}';
// generate the function call
$str .= "\n\nx(";
for($i=0; $i< $limit; ++$i) {
- $str .= "'".dechex($i)."'".($i===($limit-1) ? '' : ',');
+ $str .= "'".dechex($i)."'".($i===($limit-1) ? '' : ',');
}
$str .= ");\n";
diff --git a/tests/lang/002.phpt b/tests/lang/002.phpt
index 251f90b0a2..b1b4b0849d 100644
--- a/tests/lang/002.phpt
+++ b/tests/lang/002.phpt
@@ -4,8 +4,8 @@ Simple While Loop Test
<?php
$a=1;
while ($a<10) {
- echo $a;
- $a++;
+ echo $a;
+ $a++;
}
?>
--EXPECT--
diff --git a/tests/lang/003.phpt b/tests/lang/003.phpt
index a580fc60cd..d6f85e0ad0 100644
--- a/tests/lang/003.phpt
+++ b/tests/lang/003.phpt
@@ -4,15 +4,15 @@ Simple Switch Test
<?php
$a=1;
switch($a) {
- case 0:
- echo "bad";
- break;
- case 1:
- echo "good";
- break;
- default:
- echo "bad";
- break;
+ case 0:
+ echo "bad";
+ break;
+ case 1:
+ echo "good";
+ break;
+ default:
+ echo "bad";
+ break;
}
?>
--EXPECT--
diff --git a/tests/lang/004.phpt b/tests/lang/004.phpt
index 9ca3492cde..5a4ed8797c 100644
--- a/tests/lang/004.phpt
+++ b/tests/lang/004.phpt
@@ -4,9 +4,9 @@ Simple If/Else Test
<?php
$a=1;
if($a==0) {
- echo "bad";
+ echo "bad";
} else {
- echo "good";
+ echo "good";
}
?>
--EXPECT--
diff --git a/tests/lang/005.phpt b/tests/lang/005.phpt
index fe3633b58b..cb8de72e09 100644
--- a/tests/lang/005.phpt
+++ b/tests/lang/005.phpt
@@ -5,11 +5,11 @@ Simple If/ElseIf/Else Test
$a=1;
if($a==0) {
- echo "bad";
+ echo "bad";
} elseif($a==3) {
- echo "bad";
+ echo "bad";
} else {
- echo "good";
+ echo "good";
}
?>
--EXPECT--
diff --git a/tests/lang/006.phpt b/tests/lang/006.phpt
index 5056b8a4ee..c8ca378d46 100644
--- a/tests/lang/006.phpt
+++ b/tests/lang/006.phpt
@@ -6,17 +6,17 @@ $a=1;
$b=2;
if($a==0) {
- echo "bad";
+ echo "bad";
} elseif($a==3) {
- echo "bad";
+ echo "bad";
} else {
- if($b==1) {
- echo "bad";
- } elseif($b==2) {
- echo "good";
- } else {
- echo "bad";
- }
+ if($b==1) {
+ echo "bad";
+ } elseif($b==2) {
+ echo "good";
+ } else {
+ echo "bad";
+ }
}
?>
--EXPECT--
diff --git a/tests/lang/007.phpt b/tests/lang/007.phpt
index 946ae9babb..735de94974 100644
--- a/tests/lang/007.phpt
+++ b/tests/lang/007.phpt
@@ -7,14 +7,14 @@ $a = 10;
function Test()
{
- static $a=1;
- global $b;
- $c = 1;
- $b = 5;
- echo "$a $b ";
- $a++;
- $c++;
- echo "$a $c ";
+ static $a=1;
+ global $b;
+ $c = 1;
+ $b = 5;
+ echo "$a $b ";
+ $a++;
+ $c++;
+ echo "$a $c ";
}
Test();
diff --git a/tests/lang/008.phpt b/tests/lang/008.phpt
index 8633b6049a..6b5ae75d2d 100644
--- a/tests/lang/008.phpt
+++ b/tests/lang/008.phpt
@@ -5,10 +5,10 @@ Testing recursive function
function Test()
{
- static $a=1;
- echo "$a ";
- $a++;
- if($a<10): Test(); endif;
+ static $a=1;
+ echo "$a ";
+ $a++;
+ if($a<10): Test(); endif;
}
Test();
diff --git a/tests/lang/009.phpt b/tests/lang/009.phpt
index 8621a73e50..a5403d696a 100644
--- a/tests/lang/009.phpt
+++ b/tests/lang/009.phpt
@@ -3,7 +3,7 @@ Testing function parameter passing
--FILE--
<?php
function test ($a,$b) {
- echo $a+$b;
+ echo $a+$b;
}
test(1,2);
?>
diff --git a/tests/lang/010.phpt b/tests/lang/010.phpt
index 603abe34d5..707c2bfae6 100644
--- a/tests/lang/010.phpt
+++ b/tests/lang/010.phpt
@@ -3,8 +3,8 @@ Testing function parameter passing with a return value
--FILE--
<?php
function test ($b) {
- $b++;
- return($b);
+ $b++;
+ return($b);
}
$a = test(1);
echo $a;
diff --git a/tests/lang/011.phpt b/tests/lang/011.phpt
index b7946b7460..99a2d1c6a8 100644
--- a/tests/lang/011.phpt
+++ b/tests/lang/011.phpt
@@ -4,8 +4,8 @@ Testing nested functions
<?php
function F()
{
- $a = "Hello ";
- return($a);
+ $a = "Hello ";
+ return($a);
}
function G()
diff --git a/tests/lang/012.phpt b/tests/lang/012.phpt
index 203d7cebe3..0f88fe21d7 100644
--- a/tests/lang/012.phpt
+++ b/tests/lang/012.phpt
@@ -3,15 +3,15 @@ Testing stack after early function return
--FILE--
<?php
function F () {
- if(1) {
- return("Hello");
- }
+ if(1) {
+ return("Hello");
+ }
}
$i=0;
while ($i<2) {
- echo F();
- $i++;
+ echo F();
+ $i++;
}
?>
--EXPECT--
diff --git a/tests/lang/014.phpt b/tests/lang/014.phpt
index fe6f86e22a..b2d605c8ea 100644
--- a/tests/lang/014.phpt
+++ b/tests/lang/014.phpt
@@ -3,7 +3,7 @@ Testing eval function inside user-defined function
--FILE--
<?php
function F ($a) {
- eval($a);
+ eval($a);
}
error_reporting(0);
diff --git a/tests/lang/015.inc b/tests/lang/015.inc
index fae56c4810..a528d8cd9f 100644
--- a/tests/lang/015.inc
+++ b/tests/lang/015.inc
@@ -1,3 +1,3 @@
<?php
- echo "Hello";
+ echo "Hello";
?>
diff --git a/tests/lang/016.inc b/tests/lang/016.inc
index 56aa85d65b..453755d870 100644
--- a/tests/lang/016.inc
+++ b/tests/lang/016.inc
@@ -1,5 +1,5 @@
<?php
function MyFunc ($a) {
- echo $a;
+ echo $a;
}
?>
diff --git a/tests/lang/017.phpt b/tests/lang/017.phpt
index fb90964820..264b3906fe 100644
--- a/tests/lang/017.phpt
+++ b/tests/lang/017.phpt
@@ -4,14 +4,14 @@ Testing user-defined function falling out of an If into another
<?php
$a = 1;
function Test ($a) {
- if ($a<3) {
- return(3);
- }
+ if ($a<3) {
+ return(3);
+ }
}
if ($a < Test($a)) {
- echo "$a\n";
- $a++;
+ echo "$a\n";
+ $a++;
}
?>
--EXPECT--
diff --git a/tests/lang/020.phpt b/tests/lang/020.phpt
index 9428ec5e6f..97c928d200 100644
--- a/tests/lang/020.phpt
+++ b/tests/lang/020.phpt
@@ -8,38 +8,38 @@ $i="abc";
for ($j=0; $j<10; $j++) {
switch (1) {
case 1:
- echo "In branch 1\n";
- switch ($i) {
- case "ab":
- echo "This doesn't work... :(\n";
- break;
- case "abcd":
- echo "This works!\n";
- break;
- case "blah":
- echo "Hmmm, no worki\n";
- break;
- default:
- echo "Inner default...\n";
- }
- for ($blah=0; $blah<200; $blah++) {
- if ($blah==100) {
- echo "blah=$blah\n";
- }
- }
- break;
+ echo "In branch 1\n";
+ switch ($i) {
+ case "ab":
+ echo "This doesn't work... :(\n";
+ break;
+ case "abcd":
+ echo "This works!\n";
+ break;
+ case "blah":
+ echo "Hmmm, no worki\n";
+ break;
+ default:
+ echo "Inner default...\n";
+ }
+ for ($blah=0; $blah<200; $blah++) {
+ if ($blah==100) {
+ echo "blah=$blah\n";
+ }
+ }
+ break;
case 2:
- echo "In branch 2\n";
- break;
+ echo "In branch 2\n";
+ break;
case $i:
- echo "In branch \$i\n";
- break;
+ echo "In branch \$i\n";
+ break;
case 4:
- echo "In branch 4\n";
- break;
+ echo "In branch 4\n";
+ break;
default:
- echo "Hi, I'm default\n";
- break;
+ echo "Hi, I'm default\n";
+ break;
}
}
?>
diff --git a/tests/lang/022.phpt b/tests/lang/022.phpt
index 9660530bc7..74c4e290a8 100644
--- a/tests/lang/022.phpt
+++ b/tests/lang/022.phpt
@@ -5,24 +5,24 @@ Switch test 3
function switchtest ($i, $j)
{
- switch ($i) {
- case 0:
- switch($j) {
- case 0:
- echo "zero";
- break;
- case 1:
- echo "one";
- break;
- default:
- echo $j;
- break;
- }
- echo "\n";
- break;
- default:
- echo "Default taken\n";
- }
+ switch ($i) {
+ case 0:
+ switch($j) {
+ case 0:
+ echo "zero";
+ break;
+ case 1:
+ echo "one";
+ break;
+ default:
+ echo $j;
+ break;
+ }
+ echo "\n";
+ break;
+ default:
+ echo "Default taken\n";
+ }
}
for ($i=0; $i<3; $i++) {
for ($k=0; $k<10; $k++) {
diff --git a/tests/lang/023-1.inc b/tests/lang/023-1.inc
index 153f5d7668..e4c480c730 100644
--- a/tests/lang/023-1.inc
+++ b/tests/lang/023-1.inc
@@ -59,31 +59,31 @@ Correct result - 3: <?php echo $j%$i; ?><br>
/* sick if/elseif/else test by Andi :) */
$a = 5;
if ($a == "4") {
- echo "This "." does "." not "." work<br>\n";
+ echo "This "." does "." not "." work<br>\n";
} elseif ($a == "5") {
- echo "This "." works<br>\n";
- $a = 6;
- if ("andi" == ($test = "andi")) {
- echo "this_still_works<br>\n";
- } elseif (1) {
- echo "should_not_print<br>\n";
- } else {
- echo "should_not_print<br>\n";
- }
+ echo "This "." works<br>\n";
+ $a = 6;
+ if ("andi" == ($test = "andi")) {
+ echo "this_still_works<br>\n";
+ } elseif (1) {
+ echo "should_not_print<br>\n";
+ } else {
+ echo "should_not_print<br>\n";
+ }
if (44 == 43) {
- echo "should_not_print<br>\n";
- } else {
- echo "should_print<br>\n";
- }
+ echo "should_not_print<br>\n";
+ } else {
+ echo "should_print<br>\n";
+ }
} elseif ($a == 6) {
- echo "this "."broken<br>\n";
- if (0) {
- echo "this_should_not_print<br>\n";
- } else {
- echo "TestingDanglingElse_This_Should_not_print<br>\n";
- }
+ echo "this "."broken<br>\n";
+ if (0) {
+ echo "this_should_not_print<br>\n";
+ } else {
+ echo "TestingDanglingElse_This_Should_not_print<br>\n";
+ }
} else {
- echo "This "."does "." not"." work<br>\n";
+ echo "This "."does "." not"." work<br>\n";
}
?>
@@ -277,18 +277,18 @@ echo "commented out...";
$i = 10;
$a = 'b';
while ($i > 0) {
- $a = $a . 'a';
- echo "$a<br>\n";
- $resize[$a] = $i;
- $i--;
+ $a = $a . 'a';
+ echo "$a<br>\n";
+ $resize[$a] = $i;
+ $i--;
}
$i = 10;
$a = 'b';
while ($i > 0) {
- $a = $a . 'a';
- echo "$a<br>\n";
- echo $resize[$a]."<br>\n";
- $i--;
+ $a = $a . 'a';
+ echo "$a<br>\n";
+ echo $resize[$a]."<br>\n";
+ $i--;
}
?>
**************************<br>
diff --git a/tests/lang/024.phpt b/tests/lang/024.phpt
index 357846555a..1e2fd76f0b 100644
--- a/tests/lang/024.phpt
+++ b/tests/lang/024.phpt
@@ -76,31 +76,31 @@ Correct result - 3: <?php echo $j%$i; ?>
/* sick if/elseif/else test by Andi :) */
$a = 5;
if ($a == "4") {
- echo "This "." does "." not "." work\n";
+ echo "This "." does "." not "." work\n";
} elseif ($a == "5") {
- echo "This "." works\n";
- $a = 6;
- if ("andi" == ($test = "andi")) {
- echo "this_still_works\n";
- } elseif (1) {
- echo "should_not_print\n";
- } else {
- echo "should_not_print\n";
- }
+ echo "This "." works\n";
+ $a = 6;
+ if ("andi" == ($test = "andi")) {
+ echo "this_still_works\n";
+ } elseif (1) {
+ echo "should_not_print\n";
+ } else {
+ echo "should_not_print\n";
+ }
if (44 == 43) {
- echo "should_not_print\n";
- } else {
- echo "should_print\n";
- }
+ echo "should_not_print\n";
+ } else {
+ echo "should_print\n";
+ }
} elseif ($a == 6) {
- echo "this "."broken\n";
- if (0) {
- echo "this_should_not_print\n";
- } else {
- echo "TestingDanglingElse_This_Should_not_print\n";
- }
+ echo "this "."broken\n";
+ if (0) {
+ echo "this_should_not_print\n";
+ } else {
+ echo "TestingDanglingElse_This_Should_not_print\n";
+ }
} else {
- echo "This "."does "." not"." work\n";
+ echo "This "."does "." not"." work\n";
}
?>
@@ -292,18 +292,18 @@ echo "commented out...";
$i = 10;
$a = "b";
while ($i > 0) {
- $a = $a . "a";
- echo "$a\n";
- $resize[$a] = $i;
- $i--;
+ $a = $a . "a";
+ echo "$a\n";
+ $resize[$a] = $i;
+ $i--;
}
$i = 10;
$a = "b";
while ($i > 0) {
- $a = $a . "a";
- echo "$a\n";
- echo $resize[$a]."\n";
- $i--;
+ $a = $a . "a";
+ echo "$a\n";
+ echo $resize[$a]."\n";
+ $i--;
}
?>
**************************
diff --git a/tests/lang/025.phpt b/tests/lang/025.phpt
index 13c02d31d4..a49b8abb5a 100644
--- a/tests/lang/025.phpt
+++ b/tests/lang/025.phpt
@@ -3,15 +3,15 @@ Mean recursion test
--FILE--
<?php
function RekTest ($nr) {
- echo " $nr ";
- $j=$nr+1;
- while ($j < 10) {
- echo " a ";
- RekTest($j);
- $j++;
- echo " b $j ";
- }
- echo "\n";
+ echo " $nr ";
+ $j=$nr+1;
+ while ($j < 10) {
+ echo " a ";
+ RekTest($j);
+ $j++;
+ echo " b $j ";
+ }
+ echo "\n";
}
RekTest(0);
diff --git a/tests/lang/027.phpt b/tests/lang/027.phpt
index 9c826cfe93..3bcbe3ae4b 100644
--- a/tests/lang/027.phpt
+++ b/tests/lang/027.phpt
@@ -4,8 +4,8 @@ Testing do-while loop
<?php
$i=3;
do {
- echo $i;
- $i--;
+ echo $i;
+ $i--;
} while($i>0);
?>
--EXPECT--
diff --git a/tests/lang/028.phpt b/tests/lang/028.phpt
index e455c3b446..746101cefe 100644
--- a/tests/lang/028.phpt
+++ b/tests/lang/028.phpt
@@ -7,43 +7,43 @@ error_reporting(1023);
function print_stuff($stuff)
{
- print $stuff;
+ print $stuff;
}
function still_working()
{
- return "I'm still alive";
+ return "I'm still alive";
}
function dafna()
{
- static $foo = 0;
+ static $foo = 0;
- print "Dafna!\n";
- print call_user_func("still_working")."\n";
- $foo++;
- return (string) $foo;
+ print "Dafna!\n";
+ print call_user_func("still_working")."\n";
+ $foo++;
+ return (string) $foo;
}
class dafna_class {
- function __construct() {
- $this->myname = "Dafna";
- }
- function GetMyName() {
- return $this->myname;
- }
- function SetMyName($name) {
- $this->myname = $name;
- }
+ function __construct() {
+ $this->myname = "Dafna";
+ }
+ function GetMyName() {
+ return $this->myname;
+ }
+ function SetMyName($name) {
+ $this->myname = $name;
+ }
};
for ($i=0; $i<200; $i++):
- print "$i\n";
- call_user_func("dafna");
- call_user_func("print_stuff","Hey there!!\n");
- print "$i\n";
+ print "$i\n";
+ call_user_func("dafna");
+ call_user_func("print_stuff","Hey there!!\n");
+ print "$i\n";
endfor;
diff --git a/tests/lang/030.phpt b/tests/lang/030.phpt
index 7f94b2eb74..1d88fa9d69 100644
--- a/tests/lang/030.phpt
+++ b/tests/lang/030.phpt
@@ -3,19 +3,19 @@ $this in constructor test
--FILE--
<?php
class foo {
- function __construct($name) {
- $GLOBALS['List']= &$this;
- $this->Name = $name;
- $GLOBALS['List']->echoName();
- }
+ function __construct($name) {
+ $GLOBALS['List']= &$this;
+ $this->Name = $name;
+ $GLOBALS['List']->echoName();
+ }
- function echoName() {
- $GLOBALS['names'][]=$this->Name;
- }
+ function echoName() {
+ $GLOBALS['names'][]=$this->Name;
+ }
}
function &foo2(&$foo) {
- return $foo;
+ return $foo;
}
diff --git a/tests/lang/031.phpt b/tests/lang/031.phpt
deleted file mode 100644
index 134df03684..0000000000
--- a/tests/lang/031.phpt
+++ /dev/null
@@ -1,72 +0,0 @@
---TEST--
-Bug #16227 (Internal hash position bug on assignment)
---FILE--
-<?php
-// reported by php.net@alienbill.com
-$arrayOuter = array("key1","key2");
-$arrayInner = array("0","1");
-
-print "Correct - with inner loop reset.\n";
-
-while(list(,$o) = each($arrayOuter)){
- reset($arrayInner);
- while(list(,$i) = each($arrayInner)){
- print "inloop $i for $o\n";
- }
-}
-reset($arrayOuter);
-reset($arrayInner);
-
-print "What happens without inner loop reset.\n";
-
-while(list(,$o) = each($arrayOuter)){
- while(list(,$i) = each($arrayInner)){
- print "inloop $i for $o\n";
- }
-}
-reset($arrayOuter);
-reset($arrayInner);
-
-print "What happens without inner loop reset but copy.\n";
-
-while(list(,$o) = each($arrayOuter)){
- $placeholder = $arrayInner;
- while(list(,$i) = each($arrayInner)){
- print "inloop $i for $o\n";
- }
-}
-reset($arrayOuter);
-reset($arrayInner);
-
-print "What happens with inner loop reset over copy.\n";
-
-while(list(,$o) = each($arrayOuter)){
- $placeholder = $arrayInner;
- while(list(,$i) = each($placeholder)){
- print "inloop $i for $o\n";
- }
-}
-reset($arrayOuter);
-reset($arrayInner);
-?>
---EXPECTF--
-Correct - with inner loop reset.
-
-Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d
-inloop 0 for key1
-inloop 1 for key1
-inloop 0 for key2
-inloop 1 for key2
-What happens without inner loop reset.
-inloop 0 for key1
-inloop 1 for key1
-What happens without inner loop reset but copy.
-inloop 0 for key1
-inloop 1 for key1
-inloop 0 for key2
-inloop 1 for key2
-What happens with inner loop reset over copy.
-inloop 0 for key1
-inloop 1 for key1
-inloop 0 for key2
-inloop 1 for key2
diff --git a/tests/lang/032.phpt b/tests/lang/032.phpt
index abc98f752d..86d70abbe5 100644
--- a/tests/lang/032.phpt
+++ b/tests/lang/032.phpt
@@ -3,29 +3,29 @@ Class method registration
--FILE--
<?php
class A {
- function foo() {}
+ function foo() {}
}
class B extends A {
- function foo() {}
+ function foo() {}
}
class C extends B {
- function foo() {}
+ function foo() {}
}
class D extends A {
}
class F extends D {
- function foo() {}
+ function foo() {}
}
// Following class definition should fail, but cannot test
/*
class X {
- function foo() {}
- function foo() {}
+ function foo() {}
+ function foo() {}
}
*/
diff --git a/tests/lang/033.phpt b/tests/lang/033.phpt
index 21e3768e1b..4bba5e8783 100644
--- a/tests/lang/033.phpt
+++ b/tests/lang/033.phpt
@@ -7,41 +7,39 @@ $a = 1;
echo "If: ";
if ($a) echo 1; else echo 0;
if ($a):
- echo 1;
+ echo 1;
else:
- echo 0;
+ echo 0;
endif;
echo "\nWhile: ";
while ($a<5) echo $a++;
while ($a<9):
- echo ++$a;
+ echo ++$a;
endwhile;
echo "\nFor: ";
for($a=0;$a<5;$a++) echo $a;
for($a=0;$a<5;$a++):
- echo $a;
+ echo $a;
endfor;
echo "\nSwitch: ";
switch ($a):
- case 0;
- echo 0;
- break;
- case 5:
- echo 1;
- break;
- default;
- echo 0;
- break;
+ case 0;
+ echo 0;
+ break;
+ case 5:
+ echo 1;
+ break;
+ default;
+ echo 0;
+ break;
endswitch;
?>
-===DONE===
--EXPECT--
If: 11
While: 12346789
For: 0123401234
Switch: 1
-===DONE===
diff --git a/tests/lang/035.phpt b/tests/lang/035.phpt
index bc49af99a5..0292868d7f 100644
--- a/tests/lang/035.phpt
+++ b/tests/lang/035.phpt
@@ -3,33 +3,33 @@ ZE2: set_exception_handler()
--FILE--
<?php
class MyException extends Exception {
- function __construct($_error) {
- $this->error = $_error;
- }
+ function __construct($_error) {
+ $this->error = $_error;
+ }
- function getException()
- {
- return $this->error;
- }
+ function getException()
+ {
+ return $this->error;
+ }
}
function ThrowException()
{
- throw new MyException("'This is an exception!'");
+ throw new MyException("'This is an exception!'");
}
try {
} catch (MyException $exception) {
- print "There shouldn't be an exception: " . $exception->getException();
- print "\n";
+ print "There shouldn't be an exception: " . $exception->getException();
+ print "\n";
}
try {
- ThrowException();
+ ThrowException();
} catch (MyException $exception) {
- print "There was an exception: " . $exception->getException();
- print "\n";
+ print "There was an exception: " . $exception->getException();
+ print "\n";
}
?>
--EXPECT--
diff --git a/tests/lang/036.phpt b/tests/lang/036.phpt
index 474316e363..973deb6a0a 100644
--- a/tests/lang/036.phpt
+++ b/tests/lang/036.phpt
@@ -3,20 +3,20 @@ Child public element should not override parent private element in parent method
--FILE--
<?php
class par {
- private $id = "foo";
+ private $id = "foo";
- function displayMe()
- {
- print $this->id;
- }
+ function displayMe()
+ {
+ print $this->id;
+ }
};
class chld extends par {
- public $id = "bar";
- function displayHim()
- {
- parent::displayMe();
- }
+ public $id = "bar";
+ function displayHim()
+ {
+ parent::displayMe();
+ }
};
diff --git a/tests/lang/037.phpt b/tests/lang/037.phpt
index c2a1ee312f..3d316f571c 100644
--- a/tests/lang/037.phpt
+++ b/tests/lang/037.phpt
@@ -4,21 +4,21 @@
<?php
class par {
- private $id="foo";
+ private $id="foo";
- function displayMe()
- {
- $this->displayChild();
- }
+ function displayMe()
+ {
+ $this->displayChild();
+ }
};
class chld extends par {
- private $id = "bar";
+ private $id = "bar";
- function displayChild()
- {
- print $this->id;
- }
+ function displayChild()
+ {
+ print $this->id;
+ }
};
diff --git a/tests/lang/038.phpt b/tests/lang/038.phpt
index 8e06bdd354..677c11be9c 100644
--- a/tests/lang/038.phpt
+++ b/tests/lang/038.phpt
@@ -5,17 +5,17 @@ Convert warnings to exceptions
class MyException extends Exception
{
- function __construct($errstr, $errno=0, $errfile='', $errline='')
- {
- parent::__construct($errstr, $errno);
- $this->file = $errfile;
- $this->line = $errline;
- }
+ function __construct($errstr, $errno=0, $errfile='', $errline='')
+ {
+ parent::__construct($errstr, $errno);
+ $this->file = $errfile;
+ $this->line = $errline;
+ }
}
function Error2Exception($errno, $errstr, $errfile, $errline)
{
- throw new MyException($errstr, $errno);//, $errfile, $errline);
+ throw new MyException($errstr, $errno);//, $errfile, $errline);
}
$err_msg = 'no exception';
@@ -23,19 +23,16 @@ set_error_handler('Error2Exception');
try
{
- $con = fopen("/tmp/a_file_that_does_not_exist",'r');
+ $con = fopen("/tmp/a_file_that_does_not_exist",'r');
}
catch (Exception $e)
{
- $trace = $e->getTrace();
- var_dump($trace[0]['function']);
- var_dump($trace[1]['function']);
+ $trace = $e->getTrace();
+ var_dump($trace[0]['function']);
+ var_dump($trace[1]['function']);
}
?>
-===DONE===
-<?php exit(0); ?>
--EXPECT--
string(15) "Error2Exception"
string(5) "fopen"
-===DONE===
diff --git a/tests/lang/039.phpt b/tests/lang/039.phpt
index b353e0fa4b..98d0902f53 100644
--- a/tests/lang/039.phpt
+++ b/tests/lang/039.phpt
@@ -9,17 +9,17 @@ interface Catchable
class MyException extends Exception implements Catchable
{
- function __construct($errstr, $errno, $errfile, $errline)
- {
- parent::__construct($errstr, $errno);
- $this->file = $errfile;
- $this->line = $errline;
- }
+ function __construct($errstr, $errno, $errfile, $errline)
+ {
+ parent::__construct($errstr, $errno);
+ $this->file = $errfile;
+ $this->line = $errline;
+ }
}
function Error2Exception($errno, $errstr, $errfile, $errline)
{
- throw new MyException($errstr, $errno, $errfile, $errline);
+ throw new MyException($errstr, $errno, $errfile, $errline);
}
$err_msg = 'no exception';
@@ -27,19 +27,17 @@ set_error_handler('Error2Exception');
try
{
- $con = fopen('/tmp/a_file_that_does_not_exist','r');
+ $con = fopen('/tmp/a_file_that_does_not_exist','r');
}
catch (Catchable $e)
{
- echo "Catchable\n";
+ echo "Catchable\n";
}
catch (Exception $e)
{
- echo "Exception\n";
+ echo "Exception\n";
}
?>
-===DONE===
--EXPECT--
Catchable
-===DONE===
diff --git a/tests/lang/040.phpt b/tests/lang/040.phpt
index 6d8ece9679..fa2d9b8b70 100644
--- a/tests/lang/040.phpt
+++ b/tests/lang/040.phpt
@@ -8,8 +8,6 @@ foreach($a as $b[0]) {
echo $b[0]."\n";
}
?>
-===DONE===
--EXPECT--
0
1
-===DONE===
diff --git a/tests/lang/bison1.phpt b/tests/lang/bison1.phpt
index 3571576fb8..f77cce0055 100644
--- a/tests/lang/bison1.phpt
+++ b/tests/lang/bison1.phpt
@@ -2,8 +2,8 @@
Bison weirdness
--FILE--
<?php
-error_reporting(E_ALL & ~E_NOTICE);
echo "blah-$foo\n";
?>
---EXPECT--
+--EXPECTF--
+Warning: Undefined variable: foo in %s on line %d
blah-
diff --git a/tests/lang/bug17115.phpt b/tests/lang/bug17115.phpt
deleted file mode 100644
index 9500352799..0000000000
--- a/tests/lang/bug17115.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-Bug #17115 (lambda functions produce segfault with static vars)
---FILE--
-<?php
-$func = create_function('','
- static $foo = 0;
- return $foo++;
-');
-var_dump($func());
-var_dump($func());
-var_dump($func());
-?>
---EXPECTF--
-Deprecated: Function create_function() is deprecated in %s on line %d
-int(0)
-int(1)
-int(2)
diff --git a/tests/lang/bug18872.phpt b/tests/lang/bug18872.phpt
index 5e5333879d..1b4dd64ea1 100644
--- a/tests/lang/bug18872.phpt
+++ b/tests/lang/bug18872.phpt
@@ -3,11 +3,11 @@ Bug #18872 (class constant used as default parameter)
--FILE--
<?php
class FooBar {
- const BIFF = 3;
+ const BIFF = 3;
}
function foo($biff = FooBar::BIFF) {
- echo $biff . "\n";
+ echo $biff . "\n";
}
foo();
diff --git a/tests/lang/bug19943.phpt b/tests/lang/bug19943.phpt
index c951190511..2266e09165 100644
--- a/tests/lang/bug19943.phpt
+++ b/tests/lang/bug19943.phpt
@@ -2,18 +2,18 @@
Bug #19943 (memleaks)
--FILE--
<?php
- $ar = array();
- for ($count = 0; $count < 10; $count++) {
- $ar[$count] = "$count";
- @$ar[$count]['idx'] = "$count";
- }
+ $ar = array();
+ for ($count = 0; $count < 10; $count++) {
+ $ar[$count] = "$count";
+ @$ar[$count]['idx'] = "$count";
+ }
- for ($count = 0; $count < 10; $count++) {
- echo $ar[$count]." -- ".@$ar[$count]['idx']."\n";
- }
- $a = "0123456789";
- $a[9] = $a[0];
- var_dump($a);
+ for ($count = 0; $count < 10; $count++) {
+ echo $ar[$count]." -- ".@$ar[$count]['idx']."\n";
+ }
+ $a = "0123456789";
+ $a[9] = $a[0];
+ var_dump($a);
?>
--EXPECT--
0 -- 0
diff --git a/tests/lang/bug20175.phpt b/tests/lang/bug20175.phpt
index 0d040c82d9..5ab5677dd6 100644
--- a/tests/lang/bug20175.phpt
+++ b/tests/lang/bug20175.phpt
@@ -16,18 +16,18 @@ print zend_version()."\n";
$foo_count = 0;
function foo_global() {
- global $foo_count;
- echo "foo_global()\n";
- return 'foo:' . ++$foo_count;
+ global $foo_count;
+ echo "foo_global()\n";
+ return 'foo:' . ++$foo_count;
}
function foo_static() {
- static $foo_value;
- echo "foo_static()\n";
- if (!isset($foo_value)) {
- $foo_value = foo_global();
- }
- return $foo_value;
+ static $foo_value;
+ echo "foo_static()\n";
+ if (!isset($foo_value)) {
+ $foo_value = foo_global();
+ }
+ return $foo_value;
}
/* Part 2:
@@ -40,18 +40,18 @@ function foo_static() {
$bar_count = 0;
function bar_global() {
- global $bar_count;
- echo "bar_global()\n";
- return 'bar:' . ++$bar_count;
+ global $bar_count;
+ echo "bar_global()\n";
+ return 'bar:' . ++$bar_count;
}
function bar_static() {
- static $bar_value;
- echo "bar_static()\n";
- if (!isset($bar_value)) {
- $bar_value = &bar_global();
- }
- return $bar_value;
+ static $bar_value;
+ echo "bar_static()\n";
+ if (!isset($bar_value)) {
+ $bar_value = &bar_global();
+ }
+ return $bar_value;
}
/* Part 3: TO BE DISCUSSED
@@ -66,19 +66,19 @@ $wow_count = 0;
$wow_name = '';
function &wow_global() {
- global $wow_count, $wow_name;
- echo "wow_global()\n";
- $wow_name = 'wow:' . ++$wow_count;
- return $wow_name;
+ global $wow_count, $wow_name;
+ echo "wow_global()\n";
+ $wow_name = 'wow:' . ++$wow_count;
+ return $wow_name;
}
function wow_static() {
- static $wow_value;
- echo "wow_static()\n";
- if (!isset($wow_value)) {
- $wow_value = &wow_global();
- }
- return $wow_value;
+ static $wow_value;
+ echo "wow_static()\n";
+ if (!isset($wow_value)) {
+ $wow_value = &wow_global();
+ }
+ return $wow_value;
}*/
/* Part 4:
@@ -93,29 +93,29 @@ function wow_static() {
*/
$oop_global = 0;
class oop_class {
- var $oop_name;
+ var $oop_name;
- function __construct() {
- global $oop_global;
- echo "oop_class()\n";
- $this->oop_name = 'oop:' . ++$oop_global;
- }
+ function __construct() {
+ global $oop_global;
+ echo "oop_class()\n";
+ $this->oop_name = 'oop:' . ++$oop_global;
+ }
}
class oop_test {
- static $oop_value;
-
- function __construct() {
- echo "oop_test()\n";
- }
-
- function oop_static() {
- echo "oop_static()\n";
- if (!isset(self::$oop_value)) {
- self::$oop_value = new oop_class;
- }
- echo self::$oop_value->oop_name;
- }
+ static $oop_value;
+
+ function __construct() {
+ echo "oop_test()\n";
+ }
+
+ function oop_static() {
+ echo "oop_static()\n";
+ if (!isset(self::$oop_value)) {
+ self::$oop_value = new oop_class;
+ }
+ echo self::$oop_value->oop_name;
+ }
}
print foo_static()."\n";
diff --git a/tests/lang/bug21094.phpt b/tests/lang/bug21094.phpt
index 346185ba83..68928e9155 100644
--- a/tests/lang/bug21094.phpt
+++ b/tests/lang/bug21094.phpt
@@ -3,9 +3,9 @@ Bug #21094 (set_error_handler not accepting methods)
--FILE--
<?php
class test {
- function hdlr($errno, $errstr, $errfile, $errline) {
- printf("[%d] errstr: %s, errfile: %s, errline: %d\n", $errno, $errstr, $errfile, $errline, $errstr);
- }
+ function hdlr($errno, $errstr, $errfile, $errline) {
+ printf("[%d] errstr: %s, errfile: %s, errline: %d\n", $errno, $errstr, $errfile, $errline, $errstr);
+ }
}
set_error_handler(array(new test(), "hdlr"));
diff --git a/tests/lang/bug21669.phpt b/tests/lang/bug21669.phpt
index 643b0695ee..17db108157 100644
--- a/tests/lang/bug21669.phpt
+++ b/tests/lang/bug21669.phpt
@@ -3,17 +3,17 @@ Bug #21669 ("$obj = new $this->var;" doesn't work)
--FILE--
<?php
class Test {
- function say_hello() {
- echo "Hello world";
- }
+ function say_hello() {
+ echo "Hello world";
+ }
}
class Factory {
- public $name = "Test";
- function create() {
- $obj = new $this->name; /* Parse error */
- return $obj;
- }
+ public $name = "Test";
+ function create() {
+ $obj = new $this->name; /* Parse error */
+ return $obj;
+ }
}
$factory = new Factory;
$test = $factory->create();
diff --git a/tests/lang/bug21849.phpt b/tests/lang/bug21849.phpt
index def754a3a6..3b7f664f86 100644
--- a/tests/lang/bug21849.phpt
+++ b/tests/lang/bug21849.phpt
@@ -3,11 +3,11 @@ Bug #21849 (self::constant doesn't work as method's default parameter)
--FILE--
<?php
class foo {
- const bar = "fubar\n";
+ const bar = "fubar\n";
- function __construct($arg = self::bar) {
- echo $arg;
- }
+ function __construct($arg = self::bar) {
+ echo $arg;
+ }
}
new foo();
diff --git a/tests/lang/bug21961.phpt b/tests/lang/bug21961.phpt
index 93e4374220..a03c382eb3 100644
--- a/tests/lang/bug21961.phpt
+++ b/tests/lang/bug21961.phpt
@@ -5,47 +5,47 @@ Bug #21961 (get_parent_class() segfault)
class man
{
- public $name, $bars;
- function __construct()
- {
- $this->name = 'Mr. X';
- $this->bars = array();
- }
-
- function getdrunk($where)
- {
- $this->bars[] = new bar($where);
- }
-
- function getName()
- {
- return $this->name;
- }
+ public $name, $bars;
+ function __construct()
+ {
+ $this->name = 'Mr. X';
+ $this->bars = array();
+ }
+
+ function getdrunk($where)
+ {
+ $this->bars[] = new bar($where);
+ }
+
+ function getName()
+ {
+ return $this->name;
+ }
}
class bar extends man
{
- public $name;
-
- function __construct($w)
- {
- $this->name = $w;
- }
-
- function getName()
- {
- return $this->name;
- }
-
- function whosdrunk()
- {
- $who = get_parent_class($this);
- if($who == NULL)
- {
- return 'nobody';
- }
- return eval("return ".$who.'::getName();');
- }
+ public $name;
+
+ function __construct($w)
+ {
+ $this->name = $w;
+ }
+
+ function getName()
+ {
+ return $this->name;
+ }
+
+ function whosdrunk()
+ {
+ $who = get_parent_class($this);
+ if($who == NULL)
+ {
+ return 'nobody';
+ }
+ return eval("return ".$who.'::getName();');
+ }
}
$x = new man;
diff --git a/tests/lang/bug22510.phpt b/tests/lang/bug22510.phpt
index dbf7756daa..e79972d29e 100644
--- a/tests/lang/bug22510.phpt
+++ b/tests/lang/bug22510.phpt
@@ -1,79 +1,77 @@
--TEST--
Bug #22510 (segfault among complex references)
---INI--
-error_reporting=E_ALL | E_DEPRECATED
--FILE--
<?php
class foo
{
- public $list = array();
-
- function finalize() {
- print __CLASS__."::".__FUNCTION__."\n";
- $cl = &$this->list;
- }
-
- function &method1() {
- print __CLASS__."::".__FUNCTION__."\n";
- return @$this->foo;
- }
-
- function &method2() {
- print __CLASS__."::".__FUNCTION__."\n";
- return $this->foo;
- }
-
- function method3() {
- print __CLASS__."::".__FUNCTION__."\n";
- return @$this->foo;
- }
+ public $list = array();
+
+ function finalize() {
+ print __CLASS__."::".__FUNCTION__."\n";
+ $cl = &$this->list;
+ }
+
+ function &method1() {
+ print __CLASS__."::".__FUNCTION__."\n";
+ return @$this->foo;
+ }
+
+ function &method2() {
+ print __CLASS__."::".__FUNCTION__."\n";
+ return $this->foo;
+ }
+
+ function method3() {
+ print __CLASS__."::".__FUNCTION__."\n";
+ return @$this->foo;
+ }
}
class bar
{
- function run1() {
- print __CLASS__."::".__FUNCTION__."\n";
- $this->instance = new foo();
- $this->instance->method1($this);
- $this->instance->method1($this);
- }
-
- function run2() {
- print __CLASS__."::".__FUNCTION__."\n";
- $this->instance = new foo();
- $this->instance->method2($this);
- $this->instance->method2($this);
- }
-
- function run3() {
- print __CLASS__."::".__FUNCTION__."\n";
- $this->instance = new foo();
- $this->instance->method3($this);
- $this->instance->method3($this);
- }
+ function run1() {
+ print __CLASS__."::".__FUNCTION__."\n";
+ $this->instance = new foo();
+ $this->instance->method1($this);
+ $this->instance->method1($this);
+ }
+
+ function run2() {
+ print __CLASS__."::".__FUNCTION__."\n";
+ $this->instance = new foo();
+ $this->instance->method2($this);
+ $this->instance->method2($this);
+ }
+
+ function run3() {
+ print __CLASS__."::".__FUNCTION__."\n";
+ $this->instance = new foo();
+ $this->instance->method3($this);
+ $this->instance->method3($this);
+ }
}
function ouch(&$bar) {
- print __FUNCTION__."\n";
- @$a = $a;
- $bar->run1();
+ print __FUNCTION__."\n";
+ @$a = $a;
+ $bar->run1();
}
function ok1(&$bar) {
- print __FUNCTION__."\n";
- $bar->run1();
+ print __FUNCTION__."\n";
+ $bar->run1();
}
function ok2(&$bar) {
- print __FUNCTION__."\n";
- @$a = $a;
- $bar->run2();
+ print __FUNCTION__."\n";
+ @$a = $a;
+ $bar->run2();
}
function ok3(&$bar) {
- print __FUNCTION__."\n";
- @$a = $a;
- $bar->run3();
+ print __FUNCTION__."\n";
+ @$a = $a;
+ $bar->run3();
}
$foo = new bar();
diff --git a/tests/lang/bug22592.phpt b/tests/lang/bug22592.phpt
index 4614efc169..24b5f50fdf 100644
--- a/tests/lang/bug22592.phpt
+++ b/tests/lang/bug22592.phpt
@@ -3,7 +3,7 @@ Bug #22592 (cascading assignments to strings with curly braces broken)
--FILE--
<?php
function error_hdlr($errno, $errstr) {
- echo "[$errstr]\n";
+ echo "[$errstr]\n";
}
set_error_handler('error_hdlr');
@@ -39,9 +39,11 @@ var_dump($result);
string(5) "* *-*"
string(7) "* *-* *"
string(7) "*4*-* *"
+[Only the first byte will be assigned to the string offset]
string(7) "*4*s* *"
string(8) "*4*s* *0"
string(8) "*-*-* *0"
+[Only the first byte will be assigned to the string offset]
string(8) "*-*s*s*0"
string(8) "4-4s4s*0"
string(9) "4-4s4s505"
diff --git a/tests/lang/bug22690.phpt b/tests/lang/bug22690.phpt
deleted file mode 100644
index 85ddcd3487..0000000000
--- a/tests/lang/bug22690.phpt
+++ /dev/null
@@ -1,13 +0,0 @@
---TEST--
-Bug #22690 (ob_start() is broken with create_function() callbacks)
---FILE--
-<?php
- $foo = create_function('$s', 'return strtoupper($s);');
- ob_start($foo);
- echo $foo("bar\n");
-?>
-bar
---EXPECTF--
-Deprecated: Function create_function() is deprecated in %s on line %d
-BAR
-BAR
diff --git a/tests/lang/bug23384.phpt b/tests/lang/bug23384.phpt
index 2dc3f2308b..220cf9f654 100644
--- a/tests/lang/bug23384.phpt
+++ b/tests/lang/bug23384.phpt
@@ -5,7 +5,7 @@ Bug #23384 (use of class constants in statics)
define('TEN', 10);
class Foo {
const HUN = 100;
- function test($x = Foo::HUN) {
+ static function test($x = Foo::HUN) {
static $arr2 = array(TEN => 'ten');
static $arr = array(Foo::HUN => 'ten');
@@ -18,8 +18,7 @@ class Foo {
Foo::test();
echo Foo::HUN."\n";
?>
---EXPECTF--
-Deprecated: Non-static method Foo::test() should not be called statically in %sbug23384.php on line %d
+--EXPECT--
Array
(
[100] => ten
diff --git a/tests/lang/bug23584.phpt b/tests/lang/bug23584.phpt
index 417cfb0856..b9dc10ac67 100644
--- a/tests/lang/bug23584.phpt
+++ b/tests/lang/bug23584.phpt
@@ -9,5 +9,5 @@ error_reporting(E_ALL);
echo $foo;
?>
---EXPECTREGEX--
-Notice: Undefined variable:.*foo in .* on line 6
+--EXPECTF--
+Warning: Undefined variable: foo in %s on line 6
diff --git a/tests/lang/bug23922.phpt b/tests/lang/bug23922.phpt
deleted file mode 100644
index 22c4aaa7d4..0000000000
--- a/tests/lang/bug23922.phpt
+++ /dev/null
@@ -1,21 +0,0 @@
---TEST--
-Bug #23922 (scope doesn't properly propagate into internal functions)
---FILE--
-<?php
- class foo
- {
- public $foo = 1;
-
- function as_string()
- { assert('$this->foo == 1'); }
-
- function as_expr()
- { assert($this->foo == 1); }
- }
-
- $foo = new foo();
- $foo->as_expr();
- $foo->as_string();
-?>
---EXPECTF--
-Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d
diff --git a/tests/lang/bug24054.phpt b/tests/lang/bug24054.phpt
index 4ee5d631e6..267057f165 100644
--- a/tests/lang/bug24054.phpt
+++ b/tests/lang/bug24054.phpt
@@ -6,12 +6,12 @@ Bug #24054 (Assignment operator *= broken)
define('LONG_MAX', is_int(5000000000)? 9223372036854775807 : 0x7FFFFFFF);
define('LONG_MIN', -LONG_MAX - 1);
printf("%d,%d,%d,%d\n",is_int(LONG_MIN ),is_int(LONG_MAX ),
- is_int(LONG_MIN-1),is_int(LONG_MAX+1));
+ is_int(LONG_MIN-1),is_int(LONG_MAX+1));
- $i = LONG_MAX;
+ $i = LONG_MAX;
- $j = $i * 1001;
- $i *= 1001;
+ $j = $i * 1001;
+ $i *= 1001;
$tests = <<<TESTS
$i === $j
diff --git a/tests/lang/bug24436.phpt b/tests/lang/bug24436.phpt
index b0cfbe0931..cb14d29919 100644
--- a/tests/lang/bug24436.phpt
+++ b/tests/lang/bug24436.phpt
@@ -3,10 +3,10 @@ Bug #24436 (isset() and empty() produce errors with non-existent variables in ob
--FILE--
<?php
class test {
- function __construct() {
- if (empty($this->test[0][0])) { print "test1";}
- if (!isset($this->test[0][0])) { print "test2";}
- }
+ function __construct() {
+ if (empty($this->test[0][0])) { print "test1";}
+ if (!isset($this->test[0][0])) { print "test2";}
+ }
}
$test1 = new test();
diff --git a/tests/lang/bug24499.phpt b/tests/lang/bug24499.phpt
index 6ce56dbad7..b7a35115ae 100644
--- a/tests/lang/bug24499.phpt
+++ b/tests/lang/bug24499.phpt
@@ -7,12 +7,13 @@ class Id {
public function tester($obj)
{
- $obj->id = "bar";
+ $obj->id = "bar";
}
}
$id = new Id();
-@$obj->foo = "bar";
+$obj = new stdClass;
+$obj->foo = "bar";
$id->tester($obj);
print_r($obj);
?>
diff --git a/tests/lang/bug24640.phpt b/tests/lang/bug24640.phpt
index ac3d78d06c..7095fed1fe 100644
--- a/tests/lang/bug24640.phpt
+++ b/tests/lang/bug24640.phpt
@@ -7,11 +7,11 @@ serialize_precision=17
<?php
function test($v)
{
- echo var_export($v, true) . "\n";
- var_dump($v);
- echo "$v\n";
- print_r($v);
- echo "\n------\n";
+ echo var_export($v, true) . "\n";
+ var_dump($v);
+ echo "$v\n";
+ print_r($v);
+ echo "\n------\n";
}
test(1.7e+300);
@@ -34,8 +34,6 @@ test(1.7e+1000);
test(1.7e-1000);
?>
-===DONE===
-<?php exit(0); ?>
--EXPECTF--
1.7000000000000001E+300
float(1.7E+300)
@@ -127,4 +125,3 @@ float(0)
0
0
------
-===DONE===
diff --git a/tests/lang/bug24658.phpt b/tests/lang/bug24658.phpt
index a53457d5d9..4baa195242 100644
--- a/tests/lang/bug24658.phpt
+++ b/tests/lang/bug24658.phpt
@@ -4,16 +4,16 @@ Bug #24658 (combo of typehint / reference causes crash)
<?php
class foo {}
function no_typehint($a) {
- var_dump($a);
+ var_dump($a);
}
function typehint(foo $a) {
- var_dump($a);
+ var_dump($a);
}
function no_typehint_ref(&$a) {
- var_dump($a);
+ var_dump($a);
}
function typehint_ref(foo &$a) {
- var_dump($a);
+ var_dump($a);
}
$v = new foo();
$a = array(new foo(), 1, 2);
diff --git a/tests/lang/bug24783.phpt b/tests/lang/bug24783.phpt
index 8c8cd6ee01..74885f149e 100644
--- a/tests/lang/bug24783.phpt
+++ b/tests/lang/bug24783.phpt
@@ -3,11 +3,11 @@ Bug #24783 ($key not binary safe in "foreach($arr as $key => $val)")
--FILE--
<?php
error_reporting(E_ALL);
- $arr = array ("foo\0bar" => "foo\0bar");
- foreach ($arr as $key => $val) {
- echo strlen($key), ': ';
- echo urlencode($key), ' => ', urlencode($val), "\n";
- }
+ $arr = array ("foo\0bar" => "foo\0bar");
+ foreach ($arr as $key => $val) {
+ echo strlen($key), ': ';
+ echo urlencode($key), ' => ', urlencode($val), "\n";
+ }
?>
--EXPECT--
7: foo%00bar => foo%00bar
diff --git a/tests/lang/bug24908.phpt b/tests/lang/bug24908.phpt
index 910b715a05..4c40a9fd81 100644
--- a/tests/lang/bug24908.phpt
+++ b/tests/lang/bug24908.phpt
@@ -5,12 +5,12 @@ variables_order=GPS
--FILE--
<?php
class test {
- function __construct() {
- if (count($_SERVER)) echo "O";
- }
- function __destruct() {
- if (count($_SERVER)) echo "K\n";
- }
+ function __construct() {
+ if (count($_SERVER)) echo "O";
+ }
+ function __destruct() {
+ if (count($_SERVER)) echo "K\n";
+ }
}
$test = new test();
?>
diff --git a/tests/lang/bug24926.phpt b/tests/lang/bug24926.phpt
deleted file mode 100644
index f73d265f38..0000000000
--- a/tests/lang/bug24926.phpt
+++ /dev/null
@@ -1,29 +0,0 @@
---TEST--
-Bug #24926 (lambda function (create_function()) cannot be stored in a class property)
---FILE--
-<?php
-
-error_reporting (E_ALL);
-
-class foo {
-
- public $functions = array();
-
- function __construct()
- {
- $function = create_function('', 'return "FOO\n";');
- print($function());
-
- $this->functions['test'] = $function;
- print($this->functions['test']()); // werkt al niet meer
-
- }
-}
-
-$a = new foo ();
-
-?>
---EXPECTF--
-Deprecated: Function create_function() is deprecated in %s on line %d
-FOO
-FOO
diff --git a/tests/lang/bug24951.phpt b/tests/lang/bug24951.phpt
index 5538e13815..7d5df2030f 100644
--- a/tests/lang/bug24951.phpt
+++ b/tests/lang/bug24951.phpt
@@ -4,26 +4,26 @@ Bug #24951 (ob_flush() destroys output handler)
<?php
function test($s, $mode)
{
- return (($mode & PHP_OUTPUT_HANDLER_START)?"[":"") . $s . (($mode & PHP_OUTPUT_HANDLER_END)?"]\n":"");
+ return (($mode & PHP_OUTPUT_HANDLER_START)?"[":"") . $s . (($mode & PHP_OUTPUT_HANDLER_END)?"]\n":"");
}
function t1()
{
- ob_start("test");
- echo "Hello from t1 1 ";
+ ob_start("test");
+ echo "Hello from t1 1 ";
echo "Hello from t1 2 ";
ob_end_flush();
}
function t2()
{
- ob_start("test");
- echo "Hello from t2 1 ";
+ ob_start("test");
+ echo "Hello from t2 1 ";
ob_flush();
echo "Hello from t2 2 ";
ob_end_flush();
}
function t3()
{
- ob_start("test");
+ ob_start("test");
echo "Hello from t3 1 ";
ob_clean();
echo "Hello from t3 2 ";
diff --git a/tests/lang/bug25547.phpt b/tests/lang/bug25547.phpt
index b54f467ea8..238757592e 100644
--- a/tests/lang/bug25547.phpt
+++ b/tests/lang/bug25547.phpt
@@ -3,15 +3,15 @@ Bug #25547 (error_handler and array index with function call)
--FILE--
<?php
-function handler($errno, $errstr, $errfile, $errline, $context)
+function handler($errno, $errstr, $errfile, $errline)
{
- echo __FUNCTION__ . "($errstr)\n";
+ echo __FUNCTION__ . "($errstr)\n";
}
set_error_handler('handler');
function foo($x) {
- return "foo";
+ return "foo";
}
$output = array();
diff --git a/tests/lang/bug25652.phpt b/tests/lang/bug25652.phpt
index b0125de085..037caf3a80 100644
--- a/tests/lang/bug25652.phpt
+++ b/tests/lang/bug25652.phpt
@@ -3,19 +3,19 @@ Bug #25652 (Calling Global functions dynamically fails from Class scope)
--FILE--
<?php
- function testfunc ($var) {
- echo "testfunc $var\n";
- }
+ function testfunc ($var) {
+ echo "testfunc $var\n";
+ }
- class foo {
- public $arr = array('testfunc');
- function bar () {
- $this->arr[0]('testvalue');
- }
- }
+ class foo {
+ public $arr = array('testfunc');
+ function bar () {
+ $this->arr[0]('testvalue');
+ }
+ }
- $a = new foo ();
- $a->bar ();
+ $a = new foo ();
+ $a->bar ();
?>
--EXPECT--
diff --git a/tests/lang/bug25922.phpt b/tests/lang/bug25922.phpt
index 796ef6df82..96e8f596f1 100644
--- a/tests/lang/bug25922.phpt
+++ b/tests/lang/bug25922.phpt
@@ -6,15 +6,15 @@ error_reporting=2047
<?php
function my_error_handler($error, $errmsg='', $errfile='', $errline=0, $errcontext='')
{
- echo "$errmsg\n";
- $errcontext = '';
+ echo "$errmsg\n";
+ $errcontext = '';
}
set_error_handler('my_error_handler');
function test()
{
- echo "Undefined index here: '{$data['HTTP_HEADER']}'\n";
+ echo "Undefined index here: '{$data['HTTP_HEADER']}'\n";
}
test();
?>
diff --git a/tests/lang/bug26696.phpt b/tests/lang/bug26696.phpt
index a73694c95a..1d10297b12 100644
--- a/tests/lang/bug26696.phpt
+++ b/tests/lang/bug26696.phpt
@@ -6,20 +6,20 @@ Bug #26696 (string index in a switch() crashes with multiple matches)
$str = 'asdd/?';
$len = strlen($str);
for ($i = 0; $i < $len; $i++) {
- switch ($str[$i]) {
- case '?':
- echo "OK\n";
- break;
- }
+ switch ($str[$i]) {
+ case '?':
+ echo "OK\n";
+ break;
+ }
}
$str = '*';
switch ($str[0]) {
- case '*';
- echo "OK\n";
- break;
- default:
- echo 'Default RAN!';
+ case '*';
+ echo "OK\n";
+ break;
+ default:
+ echo 'Default RAN!';
}
?>
diff --git a/tests/lang/bug26866.phpt b/tests/lang/bug26866.phpt
index abb99c34fd..7761b65d8a 100644
--- a/tests/lang/bug26866.phpt
+++ b/tests/lang/bug26866.phpt
@@ -3,22 +3,22 @@ Bug #26866 (segfault when exception raised in __get)
--FILE--
<?php
class bar {
- function get_name() {
- return 'bar';
- }
+ function get_name() {
+ return 'bar';
+ }
}
class foo {
- function __get($sName) {
- throw new Exception('Exception!');
- return new bar();
- }
+ function __get($sName) {
+ throw new Exception('Exception!');
+ return new bar();
+ }
}
$foo = new foo();
try {
- echo $foo->bar->get_name();
+ echo $foo->bar->get_name();
}
catch (Exception $E) {
- echo "Exception raised!\n";
+ echo "Exception raised!\n";
}
?>
--EXPECT--
diff --git a/tests/lang/bug26869.phpt b/tests/lang/bug26869.phpt
index 77dd2592ed..065cf1dd67 100644
--- a/tests/lang/bug26869.phpt
+++ b/tests/lang/bug26869.phpt
@@ -2,10 +2,10 @@
Bug #26869 (constant as the key of static array)
--FILE--
<?php
- define("A", "1");
- static $a=array(A => 1);
- var_dump($a);
- var_dump(isset($a[A]));
+ define("A", "1");
+ static $a=array(A => 1);
+ var_dump($a);
+ var_dump(isset($a[A]));
?>
--EXPECT--
array(1) {
diff --git a/tests/lang/bug27354.phpt b/tests/lang/bug27354.phpt
index e10ad9c924..c6ce9804fd 100644
--- a/tests/lang/bug27354.phpt
+++ b/tests/lang/bug27354.phpt
@@ -2,10 +2,10 @@
Bug #27354 (Modulus operator crashes PHP)
--FILE--
<?php
- var_dump(-2147483647 % -1);
- var_dump(-2147483649 % -1);
- var_dump(-2147483648 % -1);
- var_dump(-2147483648 % -2);
+ var_dump(-2147483647 % -1);
+ var_dump(-2147483649 % -1);
+ var_dump(-2147483648 % -1);
+ var_dump(-2147483648 % -2);
?>
--EXPECTF--
int(%i)
diff --git a/tests/lang/bug27439.phpt b/tests/lang/bug27439.phpt
index 4bcadb78fd..ceb714d81b 100644
--- a/tests/lang/bug27439.phpt
+++ b/tests/lang/bug27439.phpt
@@ -4,54 +4,54 @@ Bug #27439 (foreach() with $this segfaults)
<?php
class test_props {
- public $a = 1;
- public $b = 2;
- public $c = 3;
+ public $a = 1;
+ public $b = 2;
+ public $c = 3;
}
class test {
- public $array = array(1,2,3);
- public $string = "string";
+ public $array = array(1,2,3);
+ public $string = "string";
- public function __construct() {
- $this->object = new test_props;
- }
+ public function __construct() {
+ $this->object = new test_props;
+ }
- public function getArray() {
- return $this->array;
- }
+ public function getArray() {
+ return $this->array;
+ }
- public function getString() {
- return $this->string;
- }
+ public function getString() {
+ return $this->string;
+ }
- public function case1() {
- foreach ($this->array as $foo) {
- echo $foo;
- }
- }
+ public function case1() {
+ foreach ($this->array as $foo) {
+ echo $foo;
+ }
+ }
- public function case2() {
- foreach ($this->foobar as $foo);
- }
+ public function case2() {
+ foreach ($this->foobar as $foo);
+ }
- public function case3() {
- foreach ($this->string as $foo);
- }
+ public function case3() {
+ foreach ($this->string as $foo);
+ }
- public function case4() {
- foreach ($this->getArray() as $foo);
- }
+ public function case4() {
+ foreach ($this->getArray() as $foo);
+ }
- public function case5() {
- foreach ($this->getString() as $foo);
- }
+ public function case5() {
+ foreach ($this->getString() as $foo);
+ }
- public function case6() {
- foreach ($this->object as $foo) {
- echo $foo;
- }
- }
+ public function case6() {
+ foreach ($this->object as $foo) {
+ echo $foo;
+ }
+ }
}
$test = new test();
$test->case1();
@@ -65,7 +65,7 @@ echo "===DONE===";
?>
--EXPECTF--
123
-Notice: Undefined property: test::$foobar in %s on line %d
+Warning: Undefined property: test::$foobar in %s on line %d
Warning: Invalid argument supplied for foreach() in %s on line %d
diff --git a/tests/lang/bug27535.phpt b/tests/lang/bug27535.phpt
index 604b2d3d04..a8294e0f09 100644
--- a/tests/lang/bug27535.phpt
+++ b/tests/lang/bug27535.phpt
@@ -5,19 +5,19 @@ Bug #27535 (Objects pointing to each other cause Apache to crash)
class Class1
{
- public $_Class2_obj;
+ public $_Class2_obj;
}
class Class2
{
- public $storage = '';
+ public $storage = '';
- function __construct()
- {
- $this->storage = new Class1();
+ function __construct()
+ {
+ $this->storage = new Class1();
- $this->storage->_Class2_obj = $this;
- }
+ $this->storage->_Class2_obj = $this;
+ }
}
$foo = new Class2();
diff --git a/tests/lang/bug28800.phpt b/tests/lang/bug28800.phpt
index 1b84cd6d0d..2845ca7c88 100644
--- a/tests/lang/bug28800.phpt
+++ b/tests/lang/bug28800.phpt
@@ -2,10 +2,10 @@
Bug #28800 (Incorrect string to number conversion for strings starting with 'inf')
--FILE--
<?php
- $strings = array('into', 'info', 'inf', 'infinity', 'infin', 'inflammable');
- foreach ($strings as $v) {
- echo ($v+0)."\n";
- }
+ $strings = array('into', 'info', 'inf', 'infinity', 'infin', 'inflammable');
+ foreach ($strings as $v) {
+ echo ($v+0)."\n";
+ }
?>
--EXPECTF--
Warning: A non-numeric value encountered in %s on line %d
diff --git a/tests/lang/bug29566.phpt b/tests/lang/bug29566.phpt
index 16aec8fc73..9c9a466388 100644
--- a/tests/lang/bug29566.phpt
+++ b/tests/lang/bug29566.phpt
@@ -10,9 +10,7 @@ unset($dummy);
foreach($var['nosuchkey'] as $v) {
}
?>
-===DONE===
--EXPECTF--
Warning: Illegal string offset 'nosuchkey' in %sbug29566.php on line %d
Warning: Invalid argument supplied for foreach() in %sbug29566.php on line %d
-===DONE===
diff --git a/tests/lang/bug29893.phpt b/tests/lang/bug29893.phpt
index 25679893d2..d9af914191 100644
--- a/tests/lang/bug29893.phpt
+++ b/tests/lang/bug29893.phpt
@@ -3,9 +3,11 @@ Bug #29893 (segfault when using array as index)
--FILE--
<?php
$base = 50;
-$base[$base] -= 0;
+try {
+ $base[$base] -= 0;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
?>
-===DONE===
---EXPECTF--
-Warning: Cannot use a scalar value as an array in %sbug29893.php on line %d
-===DONE===
+--EXPECT--
+Cannot use a scalar value as an array
diff --git a/tests/lang/bug29944.phpt b/tests/lang/bug29944.phpt
index 80a76f132e..d0f2dd2943 100644
--- a/tests/lang/bug29944.phpt
+++ b/tests/lang/bug29944.phpt
@@ -5,16 +5,14 @@ Bug #29944 (function defined in switch crashes PHP)
$a = 1;
$b = "1";
switch ($a) {
- case 1:
- function foo($bar) {
- if (preg_match('/\d/', $bar)) return true;
- return false;
- }
- echo foo($b);
+ case 1:
+ function foo($bar) {
+ if (preg_match('/\d/', $bar)) return true;
+ return false;
+ }
+ echo foo($b);
}
?>
-===DONE===
--EXPECT--
1
-===DONE===
diff --git a/tests/lang/bug30862.phpt b/tests/lang/bug30862.phpt
index 7f2d3ed4ae..531dc0b482 100644
--- a/tests/lang/bug30862.phpt
+++ b/tests/lang/bug30862.phpt
@@ -3,7 +3,7 @@ Bug #30862 (Static array with boolean indexes)
--FILE--
<?php
class T {
- static $a = array(false=>"false", true=>"true");
+ static $a = array(false=>"false", true=>"true");
}
print_r(T::$a);
?>
@@ -12,7 +12,7 @@ print_r(T::$a);
define("X",0);
define("Y",1);
class T2 {
- static $a = array(X=>"false", Y=>"true");
+ static $a = array(X=>"false", Y=>"true");
}
print_r(T2::$a);
?>
diff --git a/tests/lang/bug32828.phpt b/tests/lang/bug32828.phpt
index b5772afc52..fc168971e6 100644
--- a/tests/lang/bug32828.phpt
+++ b/tests/lang/bug32828.phpt
@@ -5,7 +5,7 @@ Bug #32828 (Throwing exception in output_callback function with ob_start and ob_
function output_handler($buffer)
{
- throw new Exception;
+ throw new Exception;
}
ob_start('output_handler');
diff --git a/tests/lang/bug35176.phpt b/tests/lang/bug35176.phpt
index 2928f7ec45..cbba52055d 100644
--- a/tests/lang/bug35176.phpt
+++ b/tests/lang/bug35176.phpt
@@ -10,6 +10,6 @@ require_once('nonexisiting.php');
?>
--EXPECTF--
<br />
-<b>Warning</b>: require_once(nonexisiting.php) [<a href='/function.require-once.html'>function.require-once.html</a>]: failed to open stream: No such file or directory in <b>%sbug35176.php</b> on line <b>2</b><br />
+<b>Warning</b>: require_once(nonexisiting.php) [<a href='/function.require-once.html'>function.require-once.html</a>]: Failed to open stream: No such file or directory in <b>%sbug35176.php</b> on line <b>2</b><br />
<br />
<b>Fatal error</b>: require_once() [<a href='/function.require.html'>function.require.html</a>]: Failed opening required 'nonexisiting.php' (%s) in <b>%sbug35176.php</b> on line <b>2</b><br />
diff --git a/tests/lang/bug43958.phpt b/tests/lang/bug43958.phpt
index c1fca9d633..10a083a3f2 100644
--- a/tests/lang/bug43958.phpt
+++ b/tests/lang/bug43958.phpt
@@ -4,13 +4,13 @@ Bug #43958 (class name added into the error message)
<?php
class MyClass
{
- static public function loadCode($p) {
- return include $p;
- }
+ static public function loadCode($p) {
+ return include $p;
+ }
}
MyClass::loadCode('file-which-does-not-exist-on-purpose.php');
--EXPECTF--
-Warning: include(file-which-does-not-exist-on-purpose.php): failed to open stream: No such file or directory in %sbug43958.php on line 5
+Warning: include(file-which-does-not-exist-on-purpose.php): Failed to open stream: No such file or directory in %sbug43958.php on line 5
Warning: include(): Failed opening 'file-which-does-not-exist-on-purpose.php' for inclusion (include_path='%s') in %sbug43958.php on line 5
diff --git a/tests/lang/bug44827.phpt b/tests/lang/bug44827.phpt
index d871cfd2a8..9cb8c132e7 100644
--- a/tests/lang/bug44827.phpt
+++ b/tests/lang/bug44827.phpt
@@ -7,10 +7,13 @@ Testfest Munich 2009
--FILE--
<?php
define('::', true);
-var_dump(constant('::'));
+try {
+ var_dump(constant('::'));
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
?>
--EXPECTF--
Warning: Class constants cannot be defined or redefined in %s on line %d
-Warning: constant(): Couldn't find constant :: in %s on line %d
-NULL
+Fatal error: Class '' not found in %s on line %d
diff --git a/tests/lang/bug71897.phpt b/tests/lang/bug71897.phpt
index 5864b1dece..b2c41a359f 100644
--- a/tests/lang/bug71897.phpt
+++ b/tests/lang/bug71897.phpt
@@ -10,6 +10,4 @@ eval("
?>
--EXPECTF--
-Warning: Unexpected character in input: '%s' (ASCII=127) state=0 in %s(%d) : eval()'d code on line %d
-
-Parse error: syntax error, unexpected 'b' (T_STRING) in %s(%d) : eval()'d code on line %d
+Parse error: syntax error, unexpected '%s' (T_BAD_CHARACTER) in %s on line %d
diff --git a/tests/lang/bug73329.phpt b/tests/lang/bug73329.phpt
index 938f8bac24..a4f7a53fa7 100644
--- a/tests/lang/bug73329.phpt
+++ b/tests/lang/bug73329.phpt
@@ -2,17 +2,15 @@
Bug #73329 (Float)"Nano" == NAN
--FILE--
<?php
- var_dump(
- (float)"nanite",
- (float)"nan",
- (float)"inf",
- (float)"infusorian"
- );
+ var_dump(
+ (float)"nanite",
+ (float)"nan",
+ (float)"inf",
+ (float)"infusorian"
+ );
?>
-==DONE==
--EXPECT--
float(0)
float(0)
float(0)
float(0)
-==DONE==
diff --git a/tests/lang/bug7515.phpt b/tests/lang/bug7515.phpt
index 5c7756c6a1..6c8632c0fa 100644
--- a/tests/lang/bug7515.phpt
+++ b/tests/lang/bug7515.phpt
@@ -1,14 +1,13 @@
--TEST--
Bug #7515 (weird & invisible referencing of objects)
---INI--
-error_reporting=2039
--FILE--
<?php
class obj {
- function method() {}
+ function method() {}
}
-$o->root=new obj();
+$o = new stdClass;
+$o->root = new obj();
ob_start();
var_dump($o);
@@ -30,6 +29,5 @@ y=$y
";
}
?>
---EXPECTF--
-Warning: Creating default object from empty value in %s on line %d
+--EXPECT--
success
diff --git a/tests/lang/catchable_error_001.phpt b/tests/lang/catchable_error_001.phpt
index b11a7c8d96..499ac14430 100644
--- a/tests/lang/catchable_error_001.phpt
+++ b/tests/lang/catchable_error_001.phpt
@@ -2,21 +2,21 @@
Catchable fatal error [1]
--FILE--
<?php
- class Foo {
- }
+ class Foo {
+ }
- function blah (Foo $a)
- {
- }
+ function blah (Foo $a)
+ {
+ }
- function error()
- {
- $a = func_get_args();
- var_dump($a);
- }
+ function error()
+ {
+ $a = func_get_args();
+ var_dump($a);
+ }
- blah (new StdClass);
- echo "ALIVE!\n";
+ blah (new StdClass);
+ echo "ALIVE!\n";
?>
--EXPECTF--
Fatal error: Uncaught TypeError: Argument 1 passed to blah() must be an instance of Foo, instance of stdClass given, called in %scatchable_error_001.php on line 15 and defined in %scatchable_error_001.php:5
diff --git a/tests/lang/catchable_error_002.phpt b/tests/lang/catchable_error_002.phpt
index 10312533c1..7cdc02c899 100644
--- a/tests/lang/catchable_error_002.phpt
+++ b/tests/lang/catchable_error_002.phpt
@@ -2,27 +2,27 @@
Catchable fatal error [2]
--FILE--
<?php
- class Foo {
- }
+ class Foo {
+ }
- function blah (Foo $a)
- {
- }
+ function blah (Foo $a)
+ {
+ }
- function error()
- {
- $a = func_get_args();
- var_dump($a);
- }
+ function error()
+ {
+ $a = func_get_args();
+ var_dump($a);
+ }
- set_error_handler('error');
+ set_error_handler('error');
- try {
- blah (new StdClass);
- } catch (Error $ex) {
- echo $ex->getMessage(), "\n";
- }
- echo "ALIVE!\n";
+ try {
+ blah (new StdClass);
+ } catch (Error $ex) {
+ echo $ex->getMessage(), "\n";
+ }
+ echo "ALIVE!\n";
?>
--EXPECTF--
Argument 1 passed to blah() must be an instance of Foo, instance of stdClass given, called in %scatchable_error_002.php on line %d
diff --git a/tests/lang/compare_objects_basic1.phpt b/tests/lang/compare_objects_basic1.phpt
index 90eb9a0581..7df64e95c7 100644
--- a/tests/lang/compare_objects_basic1.phpt
+++ b/tests/lang/compare_objects_basic1.phpt
@@ -10,17 +10,17 @@ class class1{}
class class2{}
class class3{
- public $aaa;
- private $bbb;
- protected $ccc;
+ public $aaa;
+ private $bbb;
+ protected $ccc;
}
class class4 extends class3{
}
class class5 extends class3{
- public $ddd;
- private $eee;
+ public $ddd;
+ private $eee;
}
// Define a bunch of objects all of which will use standard compare object handler
@@ -42,7 +42,6 @@ var_dump($obj4 == $obj3);
var_dump($obj5 == $obj3);
?>
-===DONE===
--EXPECT--
Simple test for standard compare object handler
@@ -56,4 +55,3 @@ bool(false)
bool(false)
bool(false)
bool(false)
-===DONE===
diff --git a/tests/lang/compare_objects_basic2.phpt b/tests/lang/compare_objects_basic2.phpt
index ccd3a001fc..9f5820c3ee 100644
--- a/tests/lang/compare_objects_basic2.phpt
+++ b/tests/lang/compare_objects_basic2.phpt
@@ -16,8 +16,6 @@ $obj2 = new DateTime(("2009-02-12 12:47:41 GMT"));
var_dump($obj1 == $obj2);
?>
-===DONE===
--EXPECT--
Simple test comparing two objects with different compare callback handler
bool(false)
-===DONE===
diff --git a/tests/lang/each_binary_safety.phpt b/tests/lang/each_binary_safety.phpt
deleted file mode 100644
index ce175495aa..0000000000
--- a/tests/lang/each_binary_safety.phpt
+++ /dev/null
@@ -1,14 +0,0 @@
---TEST--
-Binary safety of each() for both keys and values
---FILE--
-<?php
-error_reporting(E_ALL);
-$arr = array ("foo\0bar" => "foo\0bar");
-while (list($key, $val) = each($arr)) {
- echo strlen($key), ': ';
- echo urlencode($key), ' => ', urlencode($val), "\n";
-}
-?>
---EXPECTF--
-Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d
-7: foo%00bar => foo%00bar
diff --git a/tests/lang/engine_assignExecutionOrder_001.phpt b/tests/lang/engine_assignExecutionOrder_001.phpt
index a70e3eee93..e50daa7d17 100644
--- a/tests/lang/engine_assignExecutionOrder_001.phpt
+++ b/tests/lang/engine_assignExecutionOrder_001.phpt
@@ -4,13 +4,13 @@ Evaluation order during assignments.
<?php
function f() {
- echo "in f()\n";
- return "name";
+ echo "in f()\n";
+ return "name";
}
function g() {
- echo "in g()\n";
- return "assigned value";
+ echo "in g()\n";
+ return "assigned value";
}
@@ -41,9 +41,9 @@ var_dump($oc);
class C {
- public static $name = "original";
- public static $a = array();
- public static $string = "hello";
+ public static $name = "original";
+ public static $a = array();
+ public static $string = "hello";
}
echo "\n\nOrder with static property assignment:\n";
C::${f()} = g();
@@ -56,12 +56,12 @@ var_dump(C::$a);
echo "\n\nOrder with indexed string assignment:\n";
$string = "hello";
function getOffset() {
- echo "in getOffset()\n";
- return 0;
+ echo "in getOffset()\n";
+ return 0;
}
function newChar() {
- echo "in newChar()\n";
- return 'j';
+ echo "in newChar()\n";
+ return 'j';
}
$string[getOffset()] = newChar();
var_dump($string);
diff --git a/tests/lang/engine_assignExecutionOrder_002.phpt b/tests/lang/engine_assignExecutionOrder_002.phpt
index dbb0c0aba4..a8ab0beb10 100644
--- a/tests/lang/engine_assignExecutionOrder_002.phpt
+++ b/tests/lang/engine_assignExecutionOrder_002.phpt
@@ -10,7 +10,11 @@ echo "A=$a B=$b\n";
// Warning: Cannot use a scalar value as an array in %s on line %d
-$c[$c=1] = 1;
+try {
+ $c[$c=1] = 1;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
// i++ evaluated first, so $d[0] is 10
$d = array(0,10);
@@ -90,8 +94,7 @@ print_r($ee);
?>
--EXPECTF--
A=hello B=bye
-
-Warning: Cannot use a scalar value as an array in %s on line %d
+Cannot use a scalar value as an array
array(2) {
[0]=>
int(10)
diff --git a/tests/lang/engine_assignExecutionOrder_008.phpt b/tests/lang/engine_assignExecutionOrder_008.phpt
index 310e0d9964..4b2aeb3451 100644
--- a/tests/lang/engine_assignExecutionOrder_008.phpt
+++ b/tests/lang/engine_assignExecutionOrder_008.phpt
@@ -29,23 +29,29 @@ echo $a[$i[0][0]=f()][++$i[0][0]];
unset($i);
echo "\n" . '$i->p=f(): ';
+$i = new stdClass;
echo $a[$i->p=f()][++$i->p];
unset($i);
echo "\n" . '$i->p->q=f(): ';
+$i = new stdClass;
+$i->p = new stdClass;
echo $a[$i->p->q=f()][++$i->p->q];
unset($i);
echo "\n" . '$i->p[0]=f(): ';
+$i = new stdClass;
echo $a[$i->p[0]=f()][++$i->p[0]];
unset($i);
echo "\n" . '$i->p[0]->p=f(): ';
+$i = new stdClass;
+$i->p[0] = new stdClass;
echo $a[$i->p[0]->p=f()][++$i->p[0]->p];
unset($i);
Class C {
- static $p;
+ static $p;
}
echo "\n" . 'C::$p=f(): ';
@@ -59,28 +65,16 @@ echo "\n" . 'C::$p->q=f(): ';
C::$p = new stdclass;
echo $a[C::$p->q=f()][++C::$p->q];
?>
---EXPECTF--
+--EXPECT--
$i=f(): good
$$x=f(): good
${'i'}=f(): good
$i[0]=f(): good
$i[0][0]=f(): good
-$i->p=f():
-Warning: Creating default object from empty value in %s on line %d
-good
-$i->p->q=f():
-Warning: Creating default object from empty value in %s on line %d
-
-Warning: Creating default object from empty value in %s on line %d
-good
-$i->p[0]=f():
-Warning: Creating default object from empty value in %s on line %d
-good
-$i->p[0]->p=f():
-Warning: Creating default object from empty value in %s on line %d
-
-Warning: Creating default object from empty value in %s on line %d
-good
+$i->p=f(): good
+$i->p->q=f(): good
+$i->p[0]=f(): good
+$i->p[0]->p=f(): good
C::$p=f(): good
C::$p[0]=f(): good
C::$p->q=f(): good
diff --git a/tests/lang/engine_assignExecutionOrder_009.phpt b/tests/lang/engine_assignExecutionOrder_009.phpt
index 5401ecc287..b7086237ed 100644
--- a/tests/lang/engine_assignExecutionOrder_009.phpt
+++ b/tests/lang/engine_assignExecutionOrder_009.phpt
@@ -3,8 +3,8 @@ Execution ordering with comparison operators.
--FILE--
<?php
function f($x) {
- echo "f($x) ";
- return $x;
+ echo "f($x) ";
+ return $x;
}
echo "Function call args:\n";
diff --git a/tests/lang/error_2_exception_001.phpt b/tests/lang/error_2_exception_001.phpt
index 6ef3a52676..32d85bf1cb 100644
--- a/tests/lang/error_2_exception_001.phpt
+++ b/tests/lang/error_2_exception_001.phpt
@@ -4,22 +4,22 @@ ZE2 errors caught as exceptions
<?php
class MyException extends Exception {
- function __construct($_errno, $_errmsg) {
- $this->errno = $_errno;
- $this->errmsg = $_errmsg;
- }
-
- function getErrno() {
- return $this->errno;
- }
-
- function getErrmsg() {
- return $this->errmsg;
- }
+ function __construct($_errno, $_errmsg) {
+ $this->errno = $_errno;
+ $this->errmsg = $_errmsg;
+ }
+
+ function getErrno() {
+ return $this->errno;
+ }
+
+ function getErrmsg() {
+ return $this->errmsg;
+ }
}
function ErrorsToExceptions($errno, $errmsg) {
- throw new MyException($errno, $errmsg);
+ throw new MyException($errno, $errmsg);
}
set_error_handler("ErrorsToExceptions");
@@ -29,13 +29,13 @@ set_error_handler("ErrorsToExceptions");
try {
} catch (MyException $exception) {
- echo "There was an exception: " . $exception->getErrno() . ", '" . $exception->getErrmsg() . "'\n";
+ echo "There was an exception: " . $exception->getErrno() . ", '" . $exception->getErrmsg() . "'\n";
}
try {
- trigger_error("I will become an exception", E_USER_ERROR);
+ trigger_error("I will become an exception", E_USER_ERROR);
} catch (MyException $exception) {
- echo "There was an exception: " . $exception->getErrno() . ", '" . $exception->getErrmsg() . "'\n";
+ echo "There was an exception: " . $exception->getErrno() . ", '" . $exception->getErrmsg() . "'\n";
}
?>
diff --git a/tests/lang/foreachLoop.001.phpt b/tests/lang/foreachLoop.001.phpt
index a7ec701fd1..a3315ade9d 100644
--- a/tests/lang/foreachLoop.001.phpt
+++ b/tests/lang/foreachLoop.001.phpt
@@ -6,10 +6,10 @@ Foreach loop tests - basic loop with just value and key => value.
$a = array("a","b","c");
foreach ($a as $v) {
- var_dump($v);
+ var_dump($v);
}
foreach ($a as $k => $v) {
- var_dump($k, $v);
+ var_dump($k, $v);
}
//check key and value after the loop.
var_dump($k, $v);
@@ -17,10 +17,10 @@ var_dump($k, $v);
echo "\n";
//Dynamic array
foreach (array("d","e","f") as $v) {
- var_dump($v);
+ var_dump($v);
}
foreach (array("d","e","f") as $k => $v) {
- var_dump($k, $v);
+ var_dump($k, $v);
}
//check key and value after the loop.
var_dump($k, $v);
diff --git a/tests/lang/foreachLoop.002.phpt b/tests/lang/foreachLoop.002.phpt
index e0426e810f..fe2434fbe4 100644
--- a/tests/lang/foreachLoop.002.phpt
+++ b/tests/lang/foreachLoop.002.phpt
@@ -6,15 +6,15 @@ Foreach loop tests - modifying the array during the loop.
echo "\nDirectly changing array values.\n";
$a = array("original.1","original.2","original.3");
foreach ($a as $k=>$v) {
- $a[$k]="changed.$k";
- var_dump($v);
+ $a[$k]="changed.$k";
+ var_dump($v);
}
var_dump($a);
echo "\nModifying the foreach \$value.\n";
$a = array("original.1","original.2","original.3");
foreach ($a as $k=>$v) {
- $v="changed.$k";
+ $v="changed.$k";
}
var_dump($a);
@@ -22,7 +22,7 @@ var_dump($a);
echo "\nModifying the foreach &\$value.\n";
$a = array("original.1","original.2","original.3");
foreach ($a as $k=>&$v) {
- $v="changed.$k";
+ $v="changed.$k";
}
var_dump($a);
@@ -30,12 +30,12 @@ echo "\nPushing elements onto an unreferenced array.\n";
$a = array("original.1","original.2","original.3");
$counter=0;
foreach ($a as $v) {
- array_push($a, "new.$counter");
+ array_push($a, "new.$counter");
- //avoid infinite loop if test is failing
+ //avoid infinite loop if test is failing
if ($counter++>10) {
- echo "Loop detected\n";
- break;
+ echo "Loop detected\n";
+ break;
}
}
var_dump($a);
@@ -44,12 +44,12 @@ echo "\nPushing elements onto an unreferenced array, using &\$value.\n";
$a = array("original.1","original.2","original.3");
$counter=0;
foreach ($a as &$v) {
- array_push($a, "new.$counter");
+ array_push($a, "new.$counter");
- //avoid infinite loop if test is failing
+ //avoid infinite loop if test is failing
if ($counter++>10) {
- echo "Loop detected\n";
- break;
+ echo "Loop detected\n";
+ break;
}
}
var_dump($a);
@@ -57,16 +57,16 @@ var_dump($a);
echo "\nPopping elements off an unreferenced array.\n";
$a = array("original.1","original.2","original.3");
foreach ($a as $v) {
- array_pop($a);
- var_dump($v);
+ array_pop($a);
+ var_dump($v);
}
var_dump($a);
echo "\nPopping elements off an unreferenced array, using &\$value.\n";
$a = array("original.1","original.2","original.3");
foreach ($a as &$v) {
- array_pop($a);
- var_dump($v);
+ array_pop($a);
+ var_dump($v);
}
var_dump($a);
diff --git a/tests/lang/foreachLoop.003.phpt b/tests/lang/foreachLoop.003.phpt
index 3f20021a7b..352ac335b7 100644
--- a/tests/lang/foreachLoop.003.phpt
+++ b/tests/lang/foreachLoop.003.phpt
@@ -5,27 +5,27 @@ Foreach loop tests - error case: not an array.
echo "\nNot an array.\n";
$a = TRUE;
foreach ($a as $v) {
- var_dump($v);
+ var_dump($v);
}
$a = null;
foreach ($a as $v) {
- var_dump($v);
+ var_dump($v);
}
$a = 1;
foreach ($a as $v) {
- var_dump($v);
+ var_dump($v);
}
$a = 1.5;
foreach ($a as $v) {
- var_dump($v);
+ var_dump($v);
}
$a = "hello";
foreach ($a as $v) {
- var_dump($v);
+ var_dump($v);
}
echo "done.\n";
diff --git a/tests/lang/foreachLoop.004.phpt b/tests/lang/foreachLoop.004.phpt
index 3cc1960ca1..21283c9c8c 100644
--- a/tests/lang/foreachLoop.004.phpt
+++ b/tests/lang/foreachLoop.004.phpt
@@ -6,7 +6,7 @@ Foreach loop tests - using an array element as the $value
$a=array("a", "b", "c");
$v=array();
foreach($a as $v[0]) {
- var_dump($v);
+ var_dump($v);
}
var_dump($a);
var_dump($v);
@@ -15,7 +15,7 @@ echo "\n";
$a=array("a", "b", "c");
$v=array();
foreach($a as $k=>$v[0]) {
- var_dump($k, $v);
+ var_dump($k, $v);
}
var_dump($a);
var_dump($k, $v);
diff --git a/tests/lang/foreachLoop.009.phpt b/tests/lang/foreachLoop.009.phpt
index 9bf2957e12..a7ab6f49ed 100644
--- a/tests/lang/foreachLoop.009.phpt
+++ b/tests/lang/foreachLoop.009.phpt
@@ -9,16 +9,16 @@ echo "\nRemove elements from a referenced array during loop\n";
$refedArray=array("original.0", "original.1", "original.2");
$ref=&$refedArray;
foreach ($refedArray as $k=>$v1) {
- array_pop($refedArray);
- echo "key: $k; value: $v1\n";
+ array_pop($refedArray);
+ echo "key: $k; value: $v1\n";
}
echo "\nRemove elements from a referenced array during loop, using &\$value\n";
$refedArray=array("original.0", "original.1", "original.2");
$ref=&$refedArray;
foreach ($refedArray as $k=>&$v2) {
- array_pop($refedArray);
- echo "key: $k; value: $v2\n";
+ array_pop($refedArray);
+ echo "key: $k; value: $v2\n";
}
echo "\nAdd elements to a referenced array during loop\n";
@@ -26,13 +26,13 @@ $refedArray=array("original.0", "original.1", "original.2");
$ref=&$refedArray;
$count=0;
foreach ($refedArray as $k=>$v3) {
- array_push($refedArray, "new.$k");
- echo "key: $k; value: $v3\n";
+ array_push($refedArray, "new.$k");
+ echo "key: $k; value: $v3\n";
- if ($count++>5) {
- echo "Loop detected, as expected.\n";
- break;
- }
+ if ($count++>5) {
+ echo "Loop detected, as expected.\n";
+ break;
+ }
}
echo "\nAdd elements to a referenced array during loop, using &\$value\n";
@@ -40,13 +40,13 @@ $refedArray=array("original.0", "original.1", "original.2");
$ref=&$refedArray;
$count=0;
foreach ($refedArray as $k=>&$v4) {
- array_push($refedArray, "new.$k");
- echo "key: $k; value: $v4\n";
+ array_push($refedArray, "new.$k");
+ echo "key: $k; value: $v4\n";
- if ($count++>5) {
- echo "Loop detected, as expected.\n";
- break;
- }
+ if ($count++>5) {
+ echo "Loop detected, as expected.\n";
+ break;
+ }
}
?>
diff --git a/tests/lang/foreachLoop.010.phpt b/tests/lang/foreachLoop.010.phpt
index e114e839b9..17b4db85e4 100644
--- a/tests/lang/foreachLoop.010.phpt
+++ b/tests/lang/foreachLoop.010.phpt
@@ -24,13 +24,13 @@ $container = null;
$i=0;
foreach ($a as $v) {
- array_push($a, 'new');
- var_dump($v);
+ array_push($a, 'new');
+ var_dump($v);
- if (++$i>10) {
- echo "Infinite loop detected\n";
- break;
- }
+ if (++$i>10) {
+ echo "Infinite loop detected\n";
+ break;
+ }
}
?>
diff --git a/tests/lang/foreachLoop.011.phpt b/tests/lang/foreachLoop.011.phpt
index b1048fa9a2..ee7066dc35 100644
--- a/tests/lang/foreachLoop.011.phpt
+++ b/tests/lang/foreachLoop.011.phpt
@@ -6,8 +6,8 @@ echo "\nChange from array to non iterable:\n";
$a = array(1,2,3);
$b=&$a;
foreach ($a as $v) {
- var_dump($v);
- $b=1;
+ var_dump($v);
+ $b=1;
}
echo "\nChange from object to non iterable:\n";
@@ -16,8 +16,8 @@ $a->a=1;
$a->b=2;
$b=&$a;
foreach ($a as $v) {
- var_dump($v);
- $b='x';
+ var_dump($v);
+ $b='x';
}
?>
diff --git a/tests/lang/foreachLoop.012.phpt b/tests/lang/foreachLoop.012.phpt
index 4d7beeba4f..04908f6c84 100644
--- a/tests/lang/foreachLoop.012.phpt
+++ b/tests/lang/foreachLoop.012.phpt
@@ -6,29 +6,29 @@ Directly modifying an unreferenced array when foreach'ing over it.
define('MAX_LOOPS',5);
function withRefValue($elements, $transform) {
- echo "\n---( Array with $elements element(s): )---\n";
- //Build array:
- for ($i=0; $i<$elements; $i++) {
- $a[] = "v.$i";
- }
- $counter=0;
-
- echo "--> State of array before loop:\n";
- var_dump($a);
-
- echo "--> Do loop:\n";
- foreach ($a as $k=>$v) {
- echo " iteration $counter: \$k=$k; \$v=$v\n";
- eval($transform);
- $counter++;
- if ($counter>MAX_LOOPS) {
- echo " ** Stuck in a loop! **\n";
- break;
- }
- }
-
- echo "--> State of array after loop:\n";
- var_dump($a);
+ echo "\n---( Array with $elements element(s): )---\n";
+ //Build array:
+ for ($i=0; $i<$elements; $i++) {
+ $a[] = "v.$i";
+ }
+ $counter=0;
+
+ echo "--> State of array before loop:\n";
+ var_dump($a);
+
+ echo "--> Do loop:\n";
+ foreach ($a as $k=>$v) {
+ echo " iteration $counter: \$k=$k; \$v=$v\n";
+ eval($transform);
+ $counter++;
+ if ($counter>MAX_LOOPS) {
+ echo " ** Stuck in a loop! **\n";
+ break;
+ }
+ }
+
+ echo "--> State of array after loop:\n";
+ var_dump($a);
}
diff --git a/tests/lang/foreachLoop.013.phpt b/tests/lang/foreachLoop.013.phpt
index acc197f86f..3a87007f50 100644
--- a/tests/lang/foreachLoop.013.phpt
+++ b/tests/lang/foreachLoop.013.phpt
@@ -6,29 +6,29 @@ Directly modifying an unreferenced array when foreach'ing over it while using &$
define('MAX_LOOPS',5);
function withRefValue($elements, $transform) {
- echo "\n---( Array with $elements element(s): )---\n";
- //Build array:
- for ($i=0; $i<$elements; $i++) {
- $a[] = "v.$i";
- }
- $counter=0;
-
- echo "--> State of array before loop:\n";
- var_dump($a);
-
- echo "--> Do loop:\n";
- foreach ($a as $k=>&$v) {
- echo " iteration $counter: \$k=$k; \$v=$v\n";
- eval($transform);
- $counter++;
- if ($counter>MAX_LOOPS) {
- echo " ** Stuck in a loop! **\n";
- break;
- }
- }
-
- echo "--> State of array after loop:\n";
- var_dump($a);
+ echo "\n---( Array with $elements element(s): )---\n";
+ //Build array:
+ for ($i=0; $i<$elements; $i++) {
+ $a[] = "v.$i";
+ }
+ $counter=0;
+
+ echo "--> State of array before loop:\n";
+ var_dump($a);
+
+ echo "--> Do loop:\n";
+ foreach ($a as $k=>&$v) {
+ echo " iteration $counter: \$k=$k; \$v=$v\n";
+ eval($transform);
+ $counter++;
+ if ($counter>MAX_LOOPS) {
+ echo " ** Stuck in a loop! **\n";
+ break;
+ }
+ }
+
+ echo "--> State of array after loop:\n";
+ var_dump($a);
}
diff --git a/tests/lang/foreachLoop.014.phpt b/tests/lang/foreachLoop.014.phpt
index 9db3470e9c..10bf6fba03 100644
--- a/tests/lang/foreachLoop.014.phpt
+++ b/tests/lang/foreachLoop.014.phpt
@@ -6,31 +6,31 @@ Directly modifying a REFERENCED array when foreach'ing over it.
define('MAX_LOOPS',5);
function withRefValue($elements, $transform) {
- echo "\n---( Array with $elements element(s): )---\n";
- //Build array:
- for ($i=0; $i<$elements; $i++) {
- $a[] = "v.$i";
- }
- $counter=0;
-
- $ref = &$a;
-
- echo "--> State of referenced array before loop:\n";
- var_dump($a);
-
- echo "--> Do loop:\n";
- foreach ($a as $k=>$v) {
- echo " iteration $counter: \$k=$k; \$v=$v\n";
- eval($transform);
- $counter++;
- if ($counter>MAX_LOOPS) {
- echo " ** Stuck in a loop! **\n";
- break;
- }
- }
-
- echo "--> State of array after loop:\n";
- var_dump($a);
+ echo "\n---( Array with $elements element(s): )---\n";
+ //Build array:
+ for ($i=0; $i<$elements; $i++) {
+ $a[] = "v.$i";
+ }
+ $counter=0;
+
+ $ref = &$a;
+
+ echo "--> State of referenced array before loop:\n";
+ var_dump($a);
+
+ echo "--> Do loop:\n";
+ foreach ($a as $k=>$v) {
+ echo " iteration $counter: \$k=$k; \$v=$v\n";
+ eval($transform);
+ $counter++;
+ if ($counter>MAX_LOOPS) {
+ echo " ** Stuck in a loop! **\n";
+ break;
+ }
+ }
+
+ echo "--> State of array after loop:\n";
+ var_dump($a);
}
diff --git a/tests/lang/foreachLoop.015.phpt b/tests/lang/foreachLoop.015.phpt
index ef5d030cd0..04cd570212 100644
--- a/tests/lang/foreachLoop.015.phpt
+++ b/tests/lang/foreachLoop.015.phpt
@@ -6,31 +6,31 @@ Directly modifying a REFERENCED array when foreach'ing over it while using &$val
define('MAX_LOOPS',5);
function withRefValue($elements, $transform) {
- echo "\n---( Array with $elements element(s): )---\n";
- //Build array:
- for ($i=0; $i<$elements; $i++) {
- $a[] = "v.$i";
- }
- $counter=0;
-
- $ref = &$a;
-
- echo "--> State of referenced array before loop:\n";
- var_dump($a);
-
- echo "--> Do loop:\n";
- foreach ($a as $k=>&$v) {
- echo " iteration $counter: \$k=$k; \$v=$v\n";
- eval($transform);
- $counter++;
- if ($counter>MAX_LOOPS) {
- echo " ** Stuck in a loop! **\n";
- break;
- }
- }
-
- echo "--> State of array after loop:\n";
- var_dump($a);
+ echo "\n---( Array with $elements element(s): )---\n";
+ //Build array:
+ for ($i=0; $i<$elements; $i++) {
+ $a[] = "v.$i";
+ }
+ $counter=0;
+
+ $ref = &$a;
+
+ echo "--> State of referenced array before loop:\n";
+ var_dump($a);
+
+ echo "--> Do loop:\n";
+ foreach ($a as $k=>&$v) {
+ echo " iteration $counter: \$k=$k; \$v=$v\n";
+ eval($transform);
+ $counter++;
+ if ($counter>MAX_LOOPS) {
+ echo " ** Stuck in a loop! **\n";
+ break;
+ }
+ }
+
+ echo "--> State of array after loop:\n";
+ var_dump($a);
}
diff --git a/tests/lang/foreachLoop.016.phpt b/tests/lang/foreachLoop.016.phpt
index fa1267fa8d..a4aa5c13be 100644
--- a/tests/lang/foreachLoop.016.phpt
+++ b/tests/lang/foreachLoop.016.phpt
@@ -6,7 +6,7 @@ Ensure foreach splits the iterated entity from its cow reference set, for all so
echo "\n" . '$a' . "\n";
$b = $a = array('original');
foreach($a as $k=>&$v) {
- $v = 'changed';
+ $v = 'changed';
}
var_dump($b);
unset($a, $b);
@@ -14,7 +14,7 @@ Ensure foreach splits the iterated entity from its cow reference set, for all so
echo "\n" . '${\'a\'}' . "\n";
$b = $a = array('original');
foreach(${'a'} as $k=>&$v) {
- $v = 'changed';
+ $v = 'changed';
}
var_dump($b);
unset($a, $b);
@@ -24,7 +24,7 @@ Ensure foreach splits the iterated entity from its cow reference set, for all so
$$a = array('original');
$b = $$a;
foreach($$a as $k=>&$v) {
- $v = 'changed';
+ $v = 'changed';
}
var_dump($b);
unset($a, $b);
@@ -32,7 +32,7 @@ Ensure foreach splits the iterated entity from its cow reference set, for all so
echo "\n" . '$a[0]' . "\n";
$b = $a[0] = array('original');
foreach($a[0] as $k=>&$v) {
- $v = 'changed';
+ $v = 'changed';
}
var_dump($b);
unset($a, $b);
@@ -40,60 +40,67 @@ Ensure foreach splits the iterated entity from its cow reference set, for all so
echo "\n" . '$a[0][0]' . "\n";
$b = $a[0][0] = array('original');
foreach($a[0][0] as $k=>&$v) {
- $v = 'changed';
+ $v = 'changed';
}
var_dump($b);
unset($a, $b);
echo "\n" . '$a->b' . "\n";
+ $a = new stdClass;
$b = $a->b = array('original');
foreach($a->b as $k=>&$v) {
- $v = 'changed';
+ $v = 'changed';
}
var_dump($b);
unset($a, $b);
echo "\n" . '$a->b->c' . "\n";
+ $a = new stdClass;
+ $a->b = new stdClass;
$b = $a->b->c = array('original');
foreach($a->b as $k=>&$v) {
- $v = 'changed';
+ $v = 'changed';
}
var_dump($b);
unset($a, $b);
echo "\n" . '$a->b[0]' . "\n";
+ $a = new stdClass;
$b = $a->b[0] = array('original');
foreach($a->b[0] as $k=>&$v) {
- $v = 'changed';
+ $v = 'changed';
}
var_dump($b);
unset($a, $b);
echo "\n" . '$a->b[0][0]' . "\n";
+ $a = new stdClass;
$b = $a->b[0][0] = array('original');
foreach($a->b[0][0] as $k=>&$v) {
- $v = 'changed';
+ $v = 'changed';
}
var_dump($b);
unset($a, $b);
echo "\n" . '$a->b[0]->c' . "\n";
+ $a = new stdClass;
+ $a->b[0] = new stdClass;
$b = $a->b[0]->c = array('original');
foreach($a->b[0]->c as $k=>&$v) {
- $v = 'changed';
+ $v = 'changed';
}
var_dump($b);
unset($a, $b);
class C {
- public static $a;
+ public static $a;
}
echo "\n" . 'C::$a' . "\n";
C::$a = array('original');
$b = C::$a;
foreach(C::$a as $k=>&$v) {
- $v = 'changed';
+ $v = 'changed';
}
var_dump($b);
unset($a, $b);
@@ -102,21 +109,22 @@ Ensure foreach splits the iterated entity from its cow reference set, for all so
C::$a[0] = array('original');
$b = C::$a[0];
foreach(C::$a[0] as $k=>&$v) {
- $v = 'changed';
+ $v = 'changed';
}
var_dump($b);
unset(C::$a[0], $b);
echo "\n" . 'C::$a[0]->b' . "\n";
+ C::$a[0] = new stdClass;
C::$a[0]->b = array('original');
$b = C::$a[0]->b;
foreach(C::$a[0]->b as $k=>&$v) {
- $v = 'changed';
+ $v = 'changed';
}
var_dump($b);
unset(C::$a[0]->b, $b);
?>
---EXPECTF--
+--EXPECT--
$a
array(1) {
[0]=>
@@ -148,44 +156,30 @@ array(1) {
}
$a->b
-
-Warning: Creating default object from empty value in %s on line %d
array(1) {
[0]=>
string(8) "original"
}
$a->b->c
-
-Warning: Creating default object from empty value in %s on line %d
-
-Warning: Creating default object from empty value in %s on line %d
array(1) {
[0]=>
string(8) "original"
}
$a->b[0]
-
-Warning: Creating default object from empty value in %s on line %d
array(1) {
[0]=>
string(8) "original"
}
$a->b[0][0]
-
-Warning: Creating default object from empty value in %s on line %d
array(1) {
[0]=>
string(8) "original"
}
$a->b[0]->c
-
-Warning: Creating default object from empty value in %s on line %d
-
-Warning: Creating default object from empty value in %s on line %d
array(1) {
[0]=>
string(8) "original"
@@ -204,8 +198,6 @@ array(1) {
}
C::$a[0]->b
-
-Warning: Creating default object from empty value in %s on line %d
array(1) {
[0]=>
string(8) "original"
diff --git a/tests/lang/foreachLoopIterator.001.phpt b/tests/lang/foreachLoopIterator.001.phpt
index 61fffc617a..88254558ca 100644
--- a/tests/lang/foreachLoopIterator.001.phpt
+++ b/tests/lang/foreachLoopIterator.001.phpt
@@ -4,38 +4,38 @@ foreach with Iterator.
<?php
class MealIterator implements Iterator {
- private $pos=0;
- private $myContent=array("breakfast", "lunch", "dinner");
-
- public function valid() {
- global $indent;
- echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
- return $this->pos<3;
- }
-
- public function next() {
- global $indent;
- echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
- return $this->myContent[$this->pos++];
- }
-
- public function rewind() {
- global $indent;
- echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
- $this->pos=0;
- }
-
- public function current() {
- global $indent;
- echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
- return $this->myContent[$this->pos];
- }
-
- public function key() {
- global $indent;
- echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
- return "meal " . $this->pos;
- }
+ private $pos=0;
+ private $myContent=array("breakfast", "lunch", "dinner");
+
+ public function valid() {
+ global $indent;
+ echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
+ return $this->pos<3;
+ }
+
+ public function next() {
+ global $indent;
+ echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
+ return $this->myContent[$this->pos++];
+ }
+
+ public function rewind() {
+ global $indent;
+ echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
+ $this->pos=0;
+ }
+
+ public function current() {
+ global $indent;
+ echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
+ return $this->myContent[$this->pos];
+ }
+
+ public function key() {
+ global $indent;
+ echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
+ return "meal " . $this->pos;
+ }
}
@@ -44,7 +44,7 @@ var_dump($f);
echo "-----( Simple iteration: )-----\n";
foreach ($f as $k=>$v) {
- echo "$k => $v\n";
+ echo "$k => $v\n";
}
$f->rewind();
@@ -54,18 +54,17 @@ $indent = " ";
echo "\n\n\n-----( Nested iteration: )-----\n";
$count=1;
foreach ($f as $k=>$v) {
- echo "\nTop level " . $count++ . ": \n";
- echo "$k => $v\n";
- $indent = " ";
- foreach ($f as $k=>$v) {
- echo " $k => $v\n";
- }
- $indent = " ";
+ echo "\nTop level " . $count++ . ": \n";
+ echo "$k => $v\n";
+ $indent = " ";
+ foreach ($f as $k=>$v) {
+ echo " $k => $v\n";
+ }
+ $indent = " ";
}
?>
-===DONE===
--EXPECTF--
object(MealIterator)#%d (2) {
["pos":"MealIterator":private]=>
@@ -131,4 +130,3 @@ meal 0 => breakfast
Notice: Undefined offset: 3 in %s on line %d
--> MealIterator::valid (4)
-===DONE===
diff --git a/tests/lang/foreachLoopIterator.002.phpt b/tests/lang/foreachLoopIterator.002.phpt
index fe38145c3b..dc0533be05 100644
--- a/tests/lang/foreachLoopIterator.002.phpt
+++ b/tests/lang/foreachLoopIterator.002.phpt
@@ -4,17 +4,17 @@ foreach with iterator and &$value reference
<?php
class MyIterator implements Iterator {
- public function valid() { return true; }
- public function next() { }
- public function rewind() { }
- public function current() { }
- public function key() { }
+ public function valid() { return true; }
+ public function next() { }
+ public function rewind() { }
+ public function current() { }
+ public function key() { }
}
$f = new MyIterator;
echo "-----( Try to iterate with &\$value: )-----\n";
foreach ($f as $k=>&$v) {
- echo "$k => $v\n";
+ echo "$k => $v\n";
}
?>
diff --git a/tests/lang/foreachLoopIteratorAggregate.001.phpt b/tests/lang/foreachLoopIteratorAggregate.001.phpt
index 47baeab42c..2920d0aaca 100644
--- a/tests/lang/foreachLoopIteratorAggregate.001.phpt
+++ b/tests/lang/foreachLoopIteratorAggregate.001.phpt
@@ -3,100 +3,100 @@ foreach with iteratorAggregate
--FILE--
<?php
class EnglishMealIterator implements Iterator {
- private $pos=0;
- private $myContent=array("breakfast", "dinner", "tea");
+ private $pos=0;
+ private $myContent=array("breakfast", "dinner", "tea");
- public function valid() {
- global $indent;
- echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
- return $this->pos < count($this->myContent);
- }
+ public function valid() {
+ global $indent;
+ echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
+ return $this->pos < count($this->myContent);
+ }
- public function next() {
- global $indent;
- echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
- $this->pos++;
- }
+ public function next() {
+ global $indent;
+ echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
+ $this->pos++;
+ }
- public function rewind() {
- global $indent;
- echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
- $this->pos=0;
- }
+ public function rewind() {
+ global $indent;
+ echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
+ $this->pos=0;
+ }
- public function current() {
- global $indent;
- echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
- return $this->myContent[$this->pos];
- }
+ public function current() {
+ global $indent;
+ echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
+ return $this->myContent[$this->pos];
+ }
- public function key() {
- global $indent;
- echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
- return "meal " . $this->pos;
- }
+ public function key() {
+ global $indent;
+ echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
+ return "meal " . $this->pos;
+ }
}
class FrenchMealIterator implements Iterator {
- private $pos=0;
- private $myContent=array("petit dejeuner", "dejeuner", "gouter", "dinner");
+ private $pos=0;
+ private $myContent=array("petit dejeuner", "dejeuner", "gouter", "dinner");
- public function valid() {
- global $indent;
- echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
- return $this->pos < count($this->myContent);
- }
+ public function valid() {
+ global $indent;
+ echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
+ return $this->pos < count($this->myContent);
+ }
- public function next() {
- global $indent;
- echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
- $this->pos++;
- }
+ public function next() {
+ global $indent;
+ echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
+ $this->pos++;
+ }
- public function rewind() {
- global $indent;
- echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
- $this->pos=0;
- }
+ public function rewind() {
+ global $indent;
+ echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
+ $this->pos=0;
+ }
- public function current() {
- global $indent;
- echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
- return $this->myContent[$this->pos];
- }
+ public function current() {
+ global $indent;
+ echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
+ return $this->myContent[$this->pos];
+ }
- public function key() {
- global $indent;
- echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
- return "meal " . $this->pos;
- }
+ public function key() {
+ global $indent;
+ echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
+ return "meal " . $this->pos;
+ }
}
Class EuropeanMeals implements IteratorAggregate {
- private $storedEnglishMealIterator;
- private $storedFrenchMealIterator;
+ private $storedEnglishMealIterator;
+ private $storedFrenchMealIterator;
- public function __construct() {
- $this->storedEnglishMealIterator = new EnglishMealIterator;
- $this->storedFrenchMealIterator = new FrenchMealIterator;
- }
+ public function __construct() {
+ $this->storedEnglishMealIterator = new EnglishMealIterator;
+ $this->storedFrenchMealIterator = new FrenchMealIterator;
+ }
- public function getIterator() {
- global $indent;
- echo "$indent--> " . __METHOD__ . "\n";
+ public function getIterator() {
+ global $indent;
+ echo "$indent--> " . __METHOD__ . "\n";
- //Alternate between English and French meals
- static $i = 0;
- if ($i++%2 == 0) {
- return $this->storedEnglishMealIterator;
- } else {
- return $this->storedFrenchMealIterator;
- }
- }
+ //Alternate between English and French meals
+ static $i = 0;
+ if ($i++%2 == 0) {
+ return $this->storedEnglishMealIterator;
+ } else {
+ return $this->storedFrenchMealIterator;
+ }
+ }
}
@@ -105,11 +105,11 @@ var_dump($f);
echo "-----( Simple iteration 1: )-----\n";
foreach ($f as $k=>$v) {
- echo "$k => $v\n";
+ echo "$k => $v\n";
}
echo "-----( Simple iteration 2: )-----\n";
foreach ($f as $k=>$v) {
- echo "$k => $v\n";
+ echo "$k => $v\n";
}
@@ -117,18 +117,17 @@ $indent = " ";
echo "\n\n\n-----( Nested iteration: )-----\n";
$count=1;
foreach ($f as $k=>$v) {
- echo "\nTop level " . $count++ . ": \n";
- echo "$k => $v\n";
- $indent = " ";
- foreach ($f as $k=>$v) {
- echo " $k => $v\n";
- }
- $indent = " ";
+ echo "\nTop level " . $count++ . ": \n";
+ echo "$k => $v\n";
+ $indent = " ";
+ foreach ($f as $k=>$v) {
+ echo " $k => $v\n";
+ }
+ $indent = " ";
}
?>
-===DONE===
--EXPECTF--
object(EuropeanMeals)#%d (2) {
["storedEnglishMealIterator":"EuropeanMeals":private]=>
@@ -267,4 +266,3 @@ meal 1 => dinner
--> EnglishMealIterator::valid (3)
--> EnglishMealIterator::next (3)
--> EnglishMealIterator::valid (4)
-===DONE===
diff --git a/tests/lang/foreachLoopIteratorAggregate.002.phpt b/tests/lang/foreachLoopIteratorAggregate.002.phpt
index d4b8d2f2da..382adbe2d5 100644
--- a/tests/lang/foreachLoopIteratorAggregate.002.phpt
+++ b/tests/lang/foreachLoopIteratorAggregate.002.phpt
@@ -4,38 +4,38 @@ IteratorAggregate::getIterator bad return type
<?php
class bad1 implements IteratorAggregate {
- function getIterator() {
- return null;
- }
+ function getIterator() {
+ return null;
+ }
}
class bad2 implements IteratorAggregate {
- function getIterator() {
- return new stdClass;
- }
+ function getIterator() {
+ return new stdClass;
+ }
}
class bad3 implements IteratorAggregate {
- function getIterator() {
- return 1;
- }
+ function getIterator() {
+ return 1;
+ }
}
class bad4 implements IteratorAggregate {
- function getIterator() {
- return array(1,2,3);
- }
+ function getIterator() {
+ return array(1,2,3);
+ }
}
function f($className) {
- try {
- foreach (new $className as $k=>$v) {
- echo "$k => $v\n";
- }
- } catch (Exception $e) {
- echo $e->getLine() . ": " . $e->getMessage() ."\n";
- }
+ try {
+ foreach (new $className as $k=>$v) {
+ echo "$k => $v\n";
+ }
+ } catch (Exception $e) {
+ echo $e->getLine() . ": " . $e->getMessage() ."\n";
+ }
}
f("bad1");
@@ -44,10 +44,8 @@ f("bad3");
f("bad4");
?>
-===DONE===
--EXPECT--
30: Objects returned by bad1::getIterator() must be traversable or implement interface Iterator
30: Objects returned by bad2::getIterator() must be traversable or implement interface Iterator
30: Objects returned by bad3::getIterator() must be traversable or implement interface Iterator
30: Objects returned by bad4::getIterator() must be traversable or implement interface Iterator
-===DONE===
diff --git a/tests/lang/foreachLoopIteratorAggregate.003.phpt b/tests/lang/foreachLoopIteratorAggregate.003.phpt
index adc8fe5351..cf9d2f73f4 100644
--- a/tests/lang/foreachLoopIteratorAggregate.003.phpt
+++ b/tests/lang/foreachLoopIteratorAggregate.003.phpt
@@ -3,76 +3,75 @@ foreach with nested iteratorAggregates
--FILE--
<?php
class EnglishMealIterator implements Iterator {
- private $pos=0;
- private $myContent=array("breakfast", "dinner", "tea");
+ private $pos=0;
+ private $myContent=array("breakfast", "dinner", "tea");
- public function valid() {
- global $indent;
- echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
- return $this->pos<3;
- }
+ public function valid() {
+ global $indent;
+ echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
+ return $this->pos<3;
+ }
- public function next() {
- global $indent;
- echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
- return $this->myContent[$this->pos++];
- }
+ public function next() {
+ global $indent;
+ echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
+ return $this->myContent[$this->pos++];
+ }
- public function rewind() {
- global $indent;
- echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
- $this->pos=0;
- }
+ public function rewind() {
+ global $indent;
+ echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
+ $this->pos=0;
+ }
- public function current() {
- global $indent;
- echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
- return $this->myContent[$this->pos];
- }
+ public function current() {
+ global $indent;
+ echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
+ return $this->myContent[$this->pos];
+ }
- public function key() {
- global $indent;
- echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
- return "meal " . $this->pos;
- }
+ public function key() {
+ global $indent;
+ echo "$indent--> " . __METHOD__ . " ($this->pos)\n";
+ return "meal " . $this->pos;
+ }
}
class A1 implements IteratorAggregate {
- function getIterator() {
- return new EnglishMealIterator;
- }
+ function getIterator() {
+ return new EnglishMealIterator;
+ }
}
class A2 implements IteratorAggregate {
- function getIterator() {
- return new A1;
- }
+ function getIterator() {
+ return new A1;
+ }
}
class A3 implements IteratorAggregate {
- function getIterator() {
- return new A2;
- }
+ function getIterator() {
+ return new A2;
+ }
}
echo "\n-----( A1: )-----\n";
foreach (new A1 as $k=>$v) {
- echo "$k => $v\n";
+ echo "$k => $v\n";
}
echo "\n-----( A2: )-----\n";
foreach (new A2 as $k=>$v) {
- echo "$k => $v\n";
+ echo "$k => $v\n";
}
echo "\n-----( A3: )-----\n";
foreach (new A3 as $k=>$v) {
- echo "$k => $v\n";
+ echo "$k => $v\n";
}
?>
-===DONE===
--EXPECT--
-----( A1: )-----
--> EnglishMealIterator::rewind (0)
@@ -130,4 +129,3 @@ meal 1 => dinner
meal 2 => tea
--> EnglishMealIterator::next (2)
--> EnglishMealIterator::valid (3)
-===DONE===
diff --git a/tests/lang/foreachLoopIteratorAggregate.004.phpt b/tests/lang/foreachLoopIteratorAggregate.004.phpt
index 30c422b2c8..0e46fec7f0 100644
--- a/tests/lang/foreachLoopIteratorAggregate.004.phpt
+++ b/tests/lang/foreachLoopIteratorAggregate.004.phpt
@@ -4,68 +4,67 @@ Duplicate of zend test tests/classes/iterators_002.phpt without expected output
<?php
class c_iter implements Iterator {
- private $obj;
- private $num = 0;
+ private $obj;
+ private $num = 0;
- function __construct($obj) {
- echo __METHOD__ . "\n";
- $this->obj = $obj;
- }
- function rewind() {
- echo __METHOD__ . "\n";
- $this->num = 0;
- }
- function valid() {
- $more = $this->num < $this->obj->max;
- echo __METHOD__ . ' = ' .($more ? 'true' : 'false') . "\n";
- return $more;
- }
- function current() {
- echo __METHOD__ . "\n";
- return $this->num;
- }
- function next() {
- echo __METHOD__ . "\n";
- $this->num++;
- }
- function key() {
- echo __METHOD__ . "\n";
- switch($this->num) {
- case 0: return "1st";
- case 1: return "2nd";
- case 2: return "3rd";
- default: return "???";
- }
- }
- function __destruct() {
- }
+ function __construct($obj) {
+ echo __METHOD__ . "\n";
+ $this->obj = $obj;
+ }
+ function rewind() {
+ echo __METHOD__ . "\n";
+ $this->num = 0;
+ }
+ function valid() {
+ $more = $this->num < $this->obj->max;
+ echo __METHOD__ . ' = ' .($more ? 'true' : 'false') . "\n";
+ return $more;
+ }
+ function current() {
+ echo __METHOD__ . "\n";
+ return $this->num;
+ }
+ function next() {
+ echo __METHOD__ . "\n";
+ $this->num++;
+ }
+ function key() {
+ echo __METHOD__ . "\n";
+ switch($this->num) {
+ case 0: return "1st";
+ case 1: return "2nd";
+ case 2: return "3rd";
+ default: return "???";
+ }
+ }
+ function __destruct() {
+ }
}
class c implements IteratorAggregate {
- public $max = 3;
+ public $max = 3;
- function getIterator() {
- echo __METHOD__ . "\n";
- return new c_iter($this);
- }
- function __destruct() {
- }
+ function getIterator() {
+ echo __METHOD__ . "\n";
+ return new c_iter($this);
+ }
+ function __destruct() {
+ }
}
$t = new c();
foreach($t as $k => $v) {
- foreach($t as $w) {
- echo "double:$v:$w\n";
- break;
- }
+ foreach($t as $w) {
+ echo "double:$v:$w\n";
+ break;
+ }
}
unset($t);
?>
-===DONE===
--EXPECT--
c::getIterator
c_iter::__construct
@@ -101,4 +100,3 @@ c_iter::current
double:2:0
c_iter::next
c_iter::valid = false
-===DONE===
diff --git a/tests/lang/foreachLoopObjects.001.phpt b/tests/lang/foreachLoopObjects.001.phpt
index 7e8a40438e..5526d498a3 100644
--- a/tests/lang/foreachLoopObjects.001.phpt
+++ b/tests/lang/foreachLoopObjects.001.phpt
@@ -4,21 +4,21 @@ Foreach loop on objects - basic loop with just value and key => value.
<?php
class C {
- public $a = "Original a";
- public $b = "Original b";
- public $c = "Original c";
- protected $d = "Original d";
- private $e = "Original e";
+ public $a = "Original a";
+ public $b = "Original b";
+ public $c = "Original c";
+ protected $d = "Original d";
+ private $e = "Original e";
}
echo "\n\nSimple loop.\n";
$obj = new C;
foreach ($obj as $v) {
- var_dump($v);
+ var_dump($v);
}
foreach ($obj as $k => $v) {
- var_dump($k, $v);
+ var_dump($k, $v);
}
echo "\nCheck key and value after the loop.\n";
var_dump($k, $v);
@@ -26,10 +26,10 @@ var_dump($k, $v);
echo "\n\nObject instantiated inside loop.\n";
foreach (new C as $v) {
- var_dump($v);
+ var_dump($v);
}
foreach (new C as $k => $v) {
- var_dump($k, $v);
+ var_dump($k, $v);
}
echo "\nCheck key and value after the loop.\n";
var_dump($k, $v);
diff --git a/tests/lang/foreachLoopObjects.002.phpt b/tests/lang/foreachLoopObjects.002.phpt
index e1e96c86f0..46bd6f8a37 100644
--- a/tests/lang/foreachLoopObjects.002.phpt
+++ b/tests/lang/foreachLoopObjects.002.phpt
@@ -4,82 +4,82 @@ Foreach loop tests - visibility.
<?php
class C {
- public $a = "Original a";
- public $b = "Original b";
- public $c = "Original c";
- protected $d = "Original d";
- private $e = "Original e";
-
- function doForEachC() {
- echo "in C::doForEachC\n";
- foreach ($this as $k=>&$v) {
- var_dump($v);
- $v="changed.$k";
- }
- }
-
- static function doForEach($obj) {
- echo "in C::doForEach\n";
- foreach ($obj as $k=>&$v) {
- var_dump($v);
- $v="changed.$k";
- }
- }
-
- function doForEachOnThis() {
- echo "in C::doForEachOnThis\n";
- foreach ($this as $k=>&$v) {
- var_dump($v);
- $v="changed.$k";
- }
- }
+ public $a = "Original a";
+ public $b = "Original b";
+ public $c = "Original c";
+ protected $d = "Original d";
+ private $e = "Original e";
+
+ function doForEachC() {
+ echo "in C::doForEachC\n";
+ foreach ($this as $k=>&$v) {
+ var_dump($v);
+ $v="changed.$k";
+ }
+ }
+
+ static function doForEach($obj) {
+ echo "in C::doForEach\n";
+ foreach ($obj as $k=>&$v) {
+ var_dump($v);
+ $v="changed.$k";
+ }
+ }
+
+ function doForEachOnThis() {
+ echo "in C::doForEachOnThis\n";
+ foreach ($this as $k=>&$v) {
+ var_dump($v);
+ $v="changed.$k";
+ }
+ }
}
class D extends C {
- private $f = "Original f";
- protected $g = "Original g";
-
- static function doForEach($obj) {
- echo "in D::doForEach\n";
- foreach ($obj as $k=>&$v) {
- var_dump($v);
- $v="changed.$k";
- }
- }
-
- function doForEachOnThis() {
- echo "in D::doForEachOnThis\n";
- foreach ($this as $k=>&$v) {
- var_dump($v);
- $v="changed.$k";
- }
- }
+ private $f = "Original f";
+ protected $g = "Original g";
+
+ static function doForEach($obj) {
+ echo "in D::doForEach\n";
+ foreach ($obj as $k=>&$v) {
+ var_dump($v);
+ $v="changed.$k";
+ }
+ }
+
+ function doForEachOnThis() {
+ echo "in D::doForEachOnThis\n";
+ foreach ($this as $k=>&$v) {
+ var_dump($v);
+ $v="changed.$k";
+ }
+ }
}
class E extends D {
- public $a = "Overridden a";
- public $b = "Overridden b";
- public $c = "Overridden c";
- protected $d = "Overridden d";
- private $e = "Overridden e";
-
- static function doForEach($obj) {
- echo "in E::doForEach\n";
- foreach ($obj as $k=>&$v) {
- var_dump($v);
- $v="changed.$k";
- }
- }
-
- function doForEachOnThis() {
- echo "in E::doForEachOnThis\n";
- foreach ($this as $k=>&$v) {
- var_dump($v);
- $v="changed.$k";
- }
- }
+ public $a = "Overridden a";
+ public $b = "Overridden b";
+ public $c = "Overridden c";
+ protected $d = "Overridden d";
+ private $e = "Overridden e";
+
+ static function doForEach($obj) {
+ echo "in E::doForEach\n";
+ foreach ($obj as $k=>&$v) {
+ var_dump($v);
+ $v="changed.$k";
+ }
+ }
+
+ function doForEachOnThis() {
+ echo "in E::doForEachOnThis\n";
+ foreach ($this as $k=>&$v) {
+ var_dump($v);
+ $v="changed.$k";
+ }
+ }
}
echo "\n\nIterate over various generations from within overridden methods:\n";
@@ -147,26 +147,25 @@ echo "\n\nIterate over various generations from outside the object:\n";
echo "\n--> Using instance of C:\n";
$myC = new C;
foreach ($myC as $k=>&$v) {
- var_dump($v);
- $v="changed.$k";
+ var_dump($v);
+ $v="changed.$k";
}
var_dump($myC);
echo "\n--> Using instance of D:\n";
$myD = new D;
foreach ($myD as $k=>&$v) {
- var_dump($v);
- $v="changed.$k";
+ var_dump($v);
+ $v="changed.$k";
}
var_dump($myD);
echo "\n--> Using instance of E:\n";
$myE = new E;
foreach ($myE as $k=>&$v) {
- var_dump($v);
- $v="changed.$k";
+ var_dump($v);
+ $v="changed.$k";
}
var_dump($myE);
?>
-===DONE===
--EXPECTF--
Iterate over various generations from within overridden methods:
@@ -584,4 +583,3 @@ object(E)#%d (8) {
["e":"C":private]=>
string(10) "Original e"
}
-===DONE===
diff --git a/tests/lang/foreachLoopObjects.003.phpt b/tests/lang/foreachLoopObjects.003.phpt
index 0d0e073eb6..e70d6a386d 100644
--- a/tests/lang/foreachLoopObjects.003.phpt
+++ b/tests/lang/foreachLoopObjects.003.phpt
@@ -4,25 +4,25 @@ Foreach loop tests - modifying the object during the loop.
<?php
class C {
- public $a = "Original a";
- public $b = "Original b";
- public $c = "Original c";
- protected $d = "Original d";
- private $e = "Original e";
+ public $a = "Original a";
+ public $b = "Original b";
+ public $c = "Original c";
+ protected $d = "Original d";
+ private $e = "Original e";
}
echo "\nDirectly changing object values.\n";
$obj = new C;
foreach ($obj as $k=>$v) {
- $obj->$k="changed.$k";
- var_dump($v);
+ $obj->$k="changed.$k";
+ var_dump($v);
}
var_dump($obj);
echo "\nModifying the foreach \$value.\n";
$obj = new C;
foreach ($obj as $k=>$v) {
- $v="changed.$k";
+ $v="changed.$k";
}
var_dump($obj);
@@ -30,7 +30,7 @@ var_dump($obj);
echo "\nModifying the foreach &\$value.\n";
$obj = new C;
foreach ($obj as $k=>&$v) {
- $v="changed.$k";
+ $v="changed.$k";
}
var_dump($obj);
@@ -38,13 +38,13 @@ echo "\nAdding properties to an an object.\n";
$obj = new C;
$counter=0;
foreach ($obj as $v) {
- $newPropName = "new$counter";
- $obj->$newPropName = "Added property $counter";
+ $newPropName = "new$counter";
+ $obj->$newPropName = "Added property $counter";
if ($counter++>10) {
- echo "Loop detected\n";
- break;
+ echo "Loop detected\n";
+ break;
}
- var_dump($v);
+ var_dump($v);
}
var_dump($obj);
@@ -52,38 +52,37 @@ echo "\nAdding properties to an an object, using &\$value.\n";
$obj = new C;
$counter=0;
foreach ($obj as &$v) {
- $newPropName = "new$counter";
- $obj->$newPropName = "Added property $counter";
+ $newPropName = "new$counter";
+ $obj->$newPropName = "Added property $counter";
if ($counter++>10) {
- echo "Loop detected\n";
- break;
+ echo "Loop detected\n";
+ break;
}
- var_dump($v);
+ var_dump($v);
}
var_dump($obj);
echo "\nRemoving properties from an object.\n";
$obj = new C;
foreach ($obj as $v) {
- unset($obj->a);
- unset($obj->b);
- unset($obj->c);
- var_dump($v);
+ unset($obj->a);
+ unset($obj->b);
+ unset($obj->c);
+ var_dump($v);
}
var_dump($obj);
echo "\nRemoving properties from an object, using &\$value.\n";
$obj = new C;
foreach ($obj as &$v) {
- unset($obj->a);
- unset($obj->b);
- unset($obj->c);
- var_dump($v);
+ unset($obj->a);
+ unset($obj->b);
+ unset($obj->c);
+ var_dump($v);
}
var_dump($obj);
?>
-===DONE===
--EXPECTF--
Directly changing object values.
string(10) "Original a"
@@ -247,4 +246,3 @@ object(C)#%d (2) {
["e":"C":private]=>
string(10) "Original e"
}
-===DONE===
diff --git a/tests/lang/foreachLoopObjects.004.phpt b/tests/lang/foreachLoopObjects.004.phpt
index 01e4e9fd9a..613037f2ca 100644
--- a/tests/lang/foreachLoopObjects.004.phpt
+++ b/tests/lang/foreachLoopObjects.004.phpt
@@ -4,43 +4,42 @@ Foreach loop tests - Removing the current element from an iterated object.
<?php
class C {
- public $a = "Original a";
- public $b = "Original b";
- public $c = "Original c";
- public $d = "Original d";
- public $e = "Original e";
+ public $a = "Original a";
+ public $b = "Original b";
+ public $c = "Original c";
+ public $d = "Original d";
+ public $e = "Original e";
}
echo "\nRemoving the current element from an iterated object.\n";
$obj = new C;
$count=0;
foreach ($obj as $v) {
- if ($v==$obj->b) {
- unset($obj->b);
- }
- var_dump($v);
- if (++$count>10) {
- echo "Loop detected.\n";
- break;
- }
+ if ($v==$obj->b) {
+ unset($obj->b);
+ }
+ var_dump($v);
+ if (++$count>10) {
+ echo "Loop detected.\n";
+ break;
+ }
}
var_dump($obj);
?>
-===DONE===
--EXPECTF--
Removing the current element from an iterated object.
string(10) "Original a"
string(10) "Original b"
-Notice: Undefined property: C::$b in %s on line %d
+Warning: Undefined property: C::$b in %s on line %d
string(10) "Original c"
-Notice: Undefined property: C::$b in %s on line %d
+Warning: Undefined property: C::$b in %s on line %d
string(10) "Original d"
-Notice: Undefined property: C::$b in %s on line %d
+Warning: Undefined property: C::$b in %s on line %d
string(10) "Original e"
object(C)#%d (4) {
["a"]=>
@@ -52,4 +51,3 @@ object(C)#%d (4) {
["e"]=>
string(10) "Original e"
}
-===DONE===
diff --git a/tests/lang/foreachLoopObjects.005.phpt b/tests/lang/foreachLoopObjects.005.phpt
index 8d6a4d5dc3..cc7f64b855 100644
--- a/tests/lang/foreachLoopObjects.005.phpt
+++ b/tests/lang/foreachLoopObjects.005.phpt
@@ -4,39 +4,39 @@ Foreach loop tests - removing properties before and after the current property d
<?php
class C {
- public $a = "Original a";
- public $b = "Original b";
- public $c = "Original c";
- public $d = "Original d";
- public $e = "Original e";
+ public $a = "Original a";
+ public $b = "Original b";
+ public $c = "Original c";
+ public $d = "Original d";
+ public $e = "Original e";
}
echo "\nRemoving properties before the current element from an iterated object.\n";
$obj = new C;
$count=0;
foreach ($obj as $v) {
- if ($v==$obj->a) {
- unset($obj->c);
- }
- var_dump($v);
- if (++$count>10) {
- echo "Loop detected.\n";
- break;
- }
+ if ($v==$obj->a) {
+ unset($obj->c);
+ }
+ var_dump($v);
+ if (++$count>10) {
+ echo "Loop detected.\n";
+ break;
+ }
}
var_dump($obj);
echo "\nRemoving properties before the current element from an iterated object.\n";
$obj = new C;
foreach ($obj as $v) {
- if ($v==$obj->b) {
- unset($obj->a);
- }
- var_dump($v);
- if (++$count>10) {
- echo "Loop detected.\n";
- break;
- }
+ if ($v==$obj->b) {
+ unset($obj->a);
+ }
+ var_dump($v);
+ if (++$count>10) {
+ echo "Loop detected.\n";
+ break;
+ }
}
var_dump($obj);
diff --git a/tests/lang/foreachLoopObjects.006.phpt b/tests/lang/foreachLoopObjects.006.phpt
index 3e9b73542a..0d8c3f96a9 100644
--- a/tests/lang/foreachLoopObjects.006.phpt
+++ b/tests/lang/foreachLoopObjects.006.phpt
@@ -4,11 +4,11 @@ Foreach loop tests - substituting the entire iterated entity during the loop.
<?php
class C {
- public $a = "Original a";
- public $b = "Original b";
- public $c = "Original c";
- public $d = "Original d";
- public $e = "Original e";
+ public $a = "Original a";
+ public $b = "Original b";
+ public $c = "Original c";
+ public $d = "Original d";
+ public $e = "Original e";
}
echo "\nSubstituting the iterated object for a different object.\n";
@@ -23,14 +23,14 @@ $obj2->f = "new f";
$ref = &$obj;
$count=0;
foreach ($obj as $v) {
- var_dump($v);
- if ($v==$obj->b) {
- $ref=$obj2;
- }
- if (++$count>10) {
- echo "Loop detected.\n";
- break;
- }
+ var_dump($v);
+ if ($v==$obj->b) {
+ $ref=$obj2;
+ }
+ if (++$count>10) {
+ echo "Loop detected.\n";
+ break;
+ }
}
var_dump($obj);
@@ -40,14 +40,14 @@ $a = array(1,2,3,4,5,6,7,8);
$ref = &$obj;
$count=0;
foreach ($obj as $v) {
- var_dump($v);
- if ($v==="Original b") {
- $ref=$a;
- }
- if (++$count>10) {
- echo "Loop detected.\n";
- break;
- }
+ var_dump($v);
+ if ($v==="Original b") {
+ $ref=$a;
+ }
+ if (++$count>10) {
+ echo "Loop detected.\n";
+ break;
+ }
}
var_dump($obj);
@@ -57,14 +57,14 @@ $obj = new C;
$ref = &$a;
$count=0;
foreach ($a as $v) {
- var_dump($v);
- if ($v===2) {
- $ref=$obj;
- }
- if (++$count>10) {
- echo "Loop detected.\n";
- break;
- }
+ var_dump($v);
+ if ($v===2) {
+ $ref=$obj;
+ }
+ if (++$count>10) {
+ echo "Loop detected.\n";
+ break;
+ }
}
var_dump($obj);
diff --git a/tests/lang/foreach_with_object_001.phpt b/tests/lang/foreach_with_object_001.phpt
index 598b844fb7..98a8f19339 100644
--- a/tests/lang/foreach_with_object_001.phpt
+++ b/tests/lang/foreach_with_object_001.phpt
@@ -15,11 +15,9 @@ foreach ($obj->c()->a as $value) {
}
?>
-===DONE===
--EXPECT--
1
2
3
4
5
-===DONE===
diff --git a/tests/lang/foreach_with_references_001.phpt b/tests/lang/foreach_with_references_001.phpt
index a1f7c33600..0a7df06502 100644
--- a/tests/lang/foreach_with_references_001.phpt
+++ b/tests/lang/foreach_with_references_001.phpt
@@ -6,13 +6,13 @@ foreach() with references
$arr = array(1 => "one", 2 => "two", 3 => "three");
foreach($arr as $key => $val) {
- $val = $key;
+ $val = $key;
}
print_r($arr);
foreach($arr as $key => &$val) {
- $val = $key;
+ $val = $key;
}
print_r($arr);
diff --git a/tests/lang/func_get_arg.002.phpt b/tests/lang/func_get_arg.002.phpt
index 5b80ec1773..3375f3e3c9 100644
--- a/tests/lang/func_get_arg.002.phpt
+++ b/tests/lang/func_get_arg.002.phpt
@@ -5,10 +5,10 @@ func_get_arg with variable number of args
function foo($a)
{
- $b = func_get_arg(1);
- var_dump($b);
- $b++;
- var_dump(func_get_arg(1));
+ $b = func_get_arg(1);
+ var_dump($b);
+ $b++;
+ var_dump(func_get_arg(1));
}
foo(2, 3);
diff --git a/tests/lang/func_get_arg.004.phpt b/tests/lang/func_get_arg.004.phpt
index 0a4547ec18..6d0ab20a4e 100644
--- a/tests/lang/func_get_arg.004.phpt
+++ b/tests/lang/func_get_arg.004.phpt
@@ -5,7 +5,7 @@ func_get_arg on non-existent arg
function foo($a)
{
- var_dump(func_get_arg(2));
+ var_dump(func_get_arg(2));
}
foo(2, 3);
echo "\n";
diff --git a/tests/lang/func_get_arg.005.phpt b/tests/lang/func_get_arg.005.phpt
index 5dd5468721..4c4b1792f4 100644
--- a/tests/lang/func_get_arg.005.phpt
+++ b/tests/lang/func_get_arg.005.phpt
@@ -4,10 +4,10 @@ During the call, the original variable is updated. This should not affect func_g
--FILE--
<?php
function refVal($x) {
- global $a;
- $a = 'changed.a';
- var_dump($x);
- var_dump(func_get_arg(0));
+ global $a;
+ $a = 'changed.a';
+ var_dump($x);
+ var_dump(func_get_arg(0));
}
$a = "original.a";
diff --git a/tests/lang/func_get_arg_variation.phpt b/tests/lang/func_get_arg_variation.phpt
index 741b6604c0..bd1fa5b4c5 100644
--- a/tests/lang/func_get_arg_variation.phpt
+++ b/tests/lang/func_get_arg_variation.phpt
@@ -6,9 +6,6 @@ func_get_arg test
function foo($a)
{
$a=5;
- echo func_get_arg();
- echo func_get_arg(2,2);
- echo func_get_arg("hello");
echo func_get_arg(-1);
echo func_get_arg(2);
}
@@ -16,12 +13,6 @@ foo(2);
echo "\n";
?>
--EXPECTF--
-Warning: func_get_arg() expects exactly 1 parameter, 0 given in %s on line %d
-
-Warning: func_get_arg() expects exactly 1 parameter, 2 given in %s on line %d
-
-Warning: func_get_arg() expects parameter 1 to be int, string given in %s on line %d
-
Warning: func_get_arg(): The argument number should be >= 0 in %s on line %d
Warning: func_get_arg(): Argument 2 not passed to function in %s on line %d
diff --git a/tests/lang/func_get_args.001.phpt b/tests/lang/func_get_args.001.phpt
index a17cfb3d19..9e64921af5 100644
--- a/tests/lang/func_get_args.001.phpt
+++ b/tests/lang/func_get_args.001.phpt
@@ -5,7 +5,7 @@ func_get_args with no args
function foo()
{
- var_dump(func_get_args());
+ var_dump(func_get_args());
}
foo();
diff --git a/tests/lang/func_get_args.002.phpt b/tests/lang/func_get_args.002.phpt
index f516893418..60bbb9a40f 100644
--- a/tests/lang/func_get_args.002.phpt
+++ b/tests/lang/func_get_args.002.phpt
@@ -5,7 +5,7 @@ func_get_args with variable number of args
function foo($a)
{
- var_dump(func_get_args());
+ var_dump(func_get_args());
}
foo(1, 2, 3);
diff --git a/tests/lang/func_get_args.004.phpt b/tests/lang/func_get_args.004.phpt
index 6e98c763b2..9e72e519f9 100644
--- a/tests/lang/func_get_args.004.phpt
+++ b/tests/lang/func_get_args.004.phpt
@@ -3,19 +3,19 @@ Pass same variable by ref and by value (PHP7).
--FILE--
<?php
function valRef($x, &$y) {
- var_dump($x, $y);
- var_dump(func_get_args());
- $x = 'changed.x';
- $y = 'changed.y';
- var_dump(func_get_args());
+ var_dump($x, $y);
+ var_dump(func_get_args());
+ $x = 'changed.x';
+ $y = 'changed.y';
+ var_dump(func_get_args());
}
function refVal(&$x, $y) {
- var_dump($x, $y);
- var_dump(func_get_args());
- $x = 'changed.x';
- $y = 'changed.y';
- var_dump(func_get_args());
+ var_dump($x, $y);
+ var_dump(func_get_args());
+ $x = 'changed.x';
+ $y = 'changed.y';
+ var_dump(func_get_args());
}
diff --git a/tests/lang/func_num_args.001.phpt b/tests/lang/func_num_args.001.phpt
index 5d7a91d25e..dd7f13681f 100644
--- a/tests/lang/func_num_args.001.phpt
+++ b/tests/lang/func_num_args.001.phpt
@@ -5,7 +5,7 @@ func_num_args with no args
function foo()
{
- var_dump(func_num_args());
+ var_dump(func_num_args());
}
foo();
diff --git a/tests/lang/func_num_args.002.phpt b/tests/lang/func_num_args.002.phpt
index 8586fad735..9b00efa535 100644
--- a/tests/lang/func_num_args.002.phpt
+++ b/tests/lang/func_num_args.002.phpt
@@ -5,7 +5,7 @@ func_num_args with variable number of args
function foo($a)
{
- var_dump(func_num_args());
+ var_dump(func_num_args());
}
foo(1, 2, 3);
diff --git a/tests/lang/func_num_args.004.phpt b/tests/lang/func_num_args.004.phpt
index 7924a85a68..dd8b7047fb 100644
--- a/tests/lang/func_num_args.004.phpt
+++ b/tests/lang/func_num_args.004.phpt
@@ -3,19 +3,19 @@ Pass same variable by ref and by value.
--FILE--
<?php
function valRef($x, &$y) {
- var_dump($x, $y);
- var_dump(func_num_args());
- $x = 'changed.x';
- $y = 'changed.y';
- var_dump(func_num_args());
+ var_dump($x, $y);
+ var_dump(func_num_args());
+ $x = 'changed.x';
+ $y = 'changed.y';
+ var_dump(func_num_args());
}
function refVal(&$x, $y) {
- var_dump($x, $y);
- var_dump(func_num_args());
- $x = 'changed.x';
- $y = 'changed.y';
- var_dump(func_num_args());
+ var_dump($x, $y);
+ var_dump(func_num_args());
+ $x = 'changed.x';
+ $y = 'changed.y';
+ var_dump(func_num_args());
}
diff --git a/tests/lang/operators/add_basiclong_64bit.phpt b/tests/lang/operators/add_basiclong_64bit.phpt
index 0168843494..6e09f49eb9 100644
--- a/tests/lang/operators/add_basiclong_64bit.phpt
+++ b/tests/lang/operators/add_basiclong_64bit.phpt
@@ -24,20 +24,19 @@ error_reporting(E_ERROR);
foreach ($longVals as $longVal) {
foreach($otherVals as $otherVal) {
- echo "--- testing: $longVal + $otherVal ---\n";
+ echo "--- testing: $longVal + $otherVal ---\n";
var_dump($longVal+$otherVal);
}
}
foreach ($otherVals as $otherVal) {
foreach($longVals as $longVal) {
- echo "--- testing: $otherVal + $longVal ---\n";
+ echo "--- testing: $otherVal + $longVal ---\n";
var_dump($otherVal+$longVal);
}
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 + 0 ---
int(9223372036854775807)
@@ -579,4 +578,3 @@ float(1.844674407371E+19)
int(0)
--- testing: 9223372036854775807 + -9.2233720368548E+18 ---
float(0)
-===DONE===
diff --git a/tests/lang/operators/add_variationStr.phpt b/tests/lang/operators/add_variationStr.phpt
index cc5834c578..cea37a0a26 100644
--- a/tests/lang/operators/add_variationStr.phpt
+++ b/tests/lang/operators/add_variationStr.phpt
@@ -12,14 +12,13 @@ error_reporting(E_ERROR);
foreach ($strVals as $strVal) {
foreach($strVals as $otherVal) {
- echo "--- testing: '$strVal' + '$otherVal' ---\n";
+ echo "--- testing: '$strVal' + '$otherVal' ---\n";
var_dump($strVal+$otherVal);
}
}
?>
-===DONE===
--EXPECT--
--- testing: '0' + '0' ---
int(0)
@@ -413,4 +412,3 @@ int(123)
float(3.4)
--- testing: 'a5.9' + 'a5.9' ---
int(0)
-===DONE===
diff --git a/tests/lang/operators/bitwiseAnd_basiclong_64bit.phpt b/tests/lang/operators/bitwiseAnd_basiclong_64bit.phpt
index 30bdcf4c60..22982c7bc3 100644
--- a/tests/lang/operators/bitwiseAnd_basiclong_64bit.phpt
+++ b/tests/lang/operators/bitwiseAnd_basiclong_64bit.phpt
@@ -24,20 +24,19 @@ error_reporting(E_ERROR);
foreach ($longVals as $longVal) {
foreach($otherVals as $otherVal) {
- echo "--- testing: $longVal & $otherVal ---\n";
+ echo "--- testing: $longVal & $otherVal ---\n";
var_dump($longVal&$otherVal);
}
}
foreach ($otherVals as $otherVal) {
foreach($longVals as $longVal) {
- echo "--- testing: $otherVal & $longVal ---\n";
+ echo "--- testing: $otherVal & $longVal ---\n";
var_dump($otherVal&$longVal);
}
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 & 0 ---
int(0)
@@ -579,4 +578,3 @@ int(0)
int(1)
--- testing: 9223372036854775807 & -9.2233720368548E+18 ---
int(0)
-===DONE===
diff --git a/tests/lang/operators/bitwiseAnd_variationStr.phpt b/tests/lang/operators/bitwiseAnd_variationStr.phpt
index 50ddb9ddb5..ed3d55f714 100644
--- a/tests/lang/operators/bitwiseAnd_variationStr.phpt
+++ b/tests/lang/operators/bitwiseAnd_variationStr.phpt
@@ -12,14 +12,13 @@ error_reporting(E_ERROR);
foreach ($strVals as $strVal) {
foreach($strVals as $otherVal) {
- echo "--- testing: '$strVal' & '$otherVal' ---\n";
+ echo "--- testing: '$strVal' & '$otherVal' ---\n";
var_dump(bin2hex($strVal&$otherVal));
}
}
?>
-===DONE===
--EXPECT--
--- testing: '0' & '0' ---
string(2) "30"
@@ -413,4 +412,3 @@ string(8) "21302221"
string(8) "21242421"
--- testing: 'a5.9' & 'a5.9' ---
string(8) "61352e39"
-===DONE===
diff --git a/tests/lang/operators/bitwiseNot_basiclong_64bit.phpt b/tests/lang/operators/bitwiseNot_basiclong_64bit.phpt
index 5b8d7c9c48..72db6d5728 100644
--- a/tests/lang/operators/bitwiseNot_basiclong_64bit.phpt
+++ b/tests/lang/operators/bitwiseNot_basiclong_64bit.phpt
@@ -25,7 +25,6 @@ foreach ($longVals as $longVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 ---
int(-9223372036854775808)
@@ -57,4 +56,3 @@ int(9223372036854775807)
int(9223372036854775806)
--- testing: -9.2233720368548E+18 ---
int(9223372036854775807)
-===DONE===
diff --git a/tests/lang/operators/bitwiseNot_variationStr.phpt b/tests/lang/operators/bitwiseNot_variationStr.phpt
index d0f8a75933..5319390164 100644
--- a/tests/lang/operators/bitwiseNot_variationStr.phpt
+++ b/tests/lang/operators/bitwiseNot_variationStr.phpt
@@ -15,7 +15,6 @@ foreach ($strVals as $strVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: '0' ---
string(2) "cf"
@@ -45,4 +44,3 @@ string(14) "cecdcc9e9d9cdf"
string(8) "ccd1cb9e"
--- testing: 'a5.9' ---
string(8) "9ecad1c6"
-===DONE===
diff --git a/tests/lang/operators/bitwiseOr_basiclong_64bit.phpt b/tests/lang/operators/bitwiseOr_basiclong_64bit.phpt
index 16d7dba40f..50b39181b1 100644
--- a/tests/lang/operators/bitwiseOr_basiclong_64bit.phpt
+++ b/tests/lang/operators/bitwiseOr_basiclong_64bit.phpt
@@ -24,20 +24,19 @@ error_reporting(E_ERROR);
foreach ($longVals as $longVal) {
foreach($otherVals as $otherVal) {
- echo "--- testing: $longVal | $otherVal ---\n";
+ echo "--- testing: $longVal | $otherVal ---\n";
var_dump($longVal|$otherVal);
}
}
foreach ($otherVals as $otherVal) {
foreach($longVals as $longVal) {
- echo "--- testing: $otherVal | $longVal ---\n";
+ echo "--- testing: $otherVal | $longVal ---\n";
var_dump($otherVal|$longVal);
}
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 | 0 ---
int(9223372036854775807)
@@ -579,4 +578,3 @@ int(-1)
int(-1)
--- testing: 9223372036854775807 | -9.2233720368548E+18 ---
int(-1)
-===DONE===
diff --git a/tests/lang/operators/bitwiseOr_variationStr.phpt b/tests/lang/operators/bitwiseOr_variationStr.phpt
index a883c4687a..f11b8d8df6 100644
--- a/tests/lang/operators/bitwiseOr_variationStr.phpt
+++ b/tests/lang/operators/bitwiseOr_variationStr.phpt
@@ -12,14 +12,13 @@ error_reporting(E_ERROR);
foreach ($strVals as $strVal) {
foreach($strVals as $otherVal) {
- echo "--- testing: '$strVal' | '$otherVal' ---\n";
+ echo "--- testing: '$strVal' | '$otherVal' ---\n";
var_dump(bin2hex($strVal|$otherVal));
}
}
?>
-===DONE===
--EXPECT--
--- testing: '0' | '0' ---
string(2) "30"
@@ -413,4 +412,3 @@ string(14) "71373f79626320"
string(8) "733f3e79"
--- testing: 'a5.9' | 'a5.9' ---
string(8) "61352e39"
-===DONE===
diff --git a/tests/lang/operators/bitwiseShiftLeft_basiclong_64bit.phpt b/tests/lang/operators/bitwiseShiftLeft_basiclong_64bit.phpt
index 218abf9d7a..250813fca3 100644
--- a/tests/lang/operators/bitwiseShiftLeft_basiclong_64bit.phpt
+++ b/tests/lang/operators/bitwiseShiftLeft_basiclong_64bit.phpt
@@ -24,8 +24,8 @@ error_reporting(E_ERROR);
foreach ($longVals as $longVal) {
foreach($otherVals as $otherVal) {
- echo "--- testing: $longVal << $otherVal ---\n";
- try {
+ echo "--- testing: $longVal << $otherVal ---\n";
+ try {
var_dump($longVal<<$otherVal);
} catch (ArithmeticError $e) {
echo "Exception: " . $e->getMessage() . "\n";
@@ -35,8 +35,8 @@ foreach ($longVals as $longVal) {
foreach ($otherVals as $otherVal) {
foreach($longVals as $longVal) {
- echo "--- testing: $otherVal << $longVal ---\n";
- try {
+ echo "--- testing: $otherVal << $longVal ---\n";
+ try {
var_dump($otherVal<<$longVal);
} catch (ArithmeticError $e) {
echo "Exception: " . $e->getMessage() . "\n";
@@ -45,7 +45,6 @@ foreach ($otherVals as $otherVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 << 0 ---
int(9223372036854775807)
@@ -587,4 +586,3 @@ Exception: Bit shift by negative number
Exception: Bit shift by negative number
--- testing: 9223372036854775807 << -9.2233720368548E+18 ---
Exception: Bit shift by negative number
-===DONE===
diff --git a/tests/lang/operators/bitwiseShiftLeft_variationStr.phpt b/tests/lang/operators/bitwiseShiftLeft_variationStr.phpt
index db9c5be060..49de21f64b 100644
--- a/tests/lang/operators/bitwiseShiftLeft_variationStr.phpt
+++ b/tests/lang/operators/bitwiseShiftLeft_variationStr.phpt
@@ -12,7 +12,7 @@ error_reporting(E_ERROR);
foreach ($strVals as $strVal) {
foreach($strVals as $otherVal) {
- echo "--- testing: '$strVal' << '$otherVal' ---\n";
+ echo "--- testing: '$strVal' << '$otherVal' ---\n";
try {
var_dump($strVal<<$otherVal);
} catch (Throwable $e) {
@@ -22,7 +22,6 @@ foreach ($strVals as $strVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: '0' << '0' ---
int(0)
@@ -416,4 +415,3 @@ int(0)
int(0)
--- testing: 'a5.9' << 'a5.9' ---
int(0)
-===DONE===
diff --git a/tests/lang/operators/bitwiseShiftLeft_variationStr2.phpt b/tests/lang/operators/bitwiseShiftLeft_variationStr2.phpt
index 09949c56b0..904181e47c 100644
--- a/tests/lang/operators/bitwiseShiftLeft_variationStr2.phpt
+++ b/tests/lang/operators/bitwiseShiftLeft_variationStr2.phpt
@@ -10,9 +10,7 @@ var_dump("34" << "1");
var_dump("56" << "2");
?>
-===DONE===
--EXPECT--
int(12)
int(68)
int(224)
-===DONE===
diff --git a/tests/lang/operators/bitwiseShiftLeft_variationStr_64bit.phpt b/tests/lang/operators/bitwiseShiftLeft_variationStr_64bit.phpt
index c36e22fef4..b3ca624abb 100644
--- a/tests/lang/operators/bitwiseShiftLeft_variationStr_64bit.phpt
+++ b/tests/lang/operators/bitwiseShiftLeft_variationStr_64bit.phpt
@@ -16,7 +16,7 @@ error_reporting(E_ERROR);
foreach ($strVals as $strVal) {
foreach($strVals as $otherVal) {
- echo "--- testing: '$strVal' << '$otherVal' ---\n";
+ echo "--- testing: '$strVal' << '$otherVal' ---\n";
try {
var_dump($strVal<<$otherVal);
} catch (ArithmeticError $e) {
@@ -27,7 +27,6 @@ foreach ($strVals as $strVal) {
?>
-===DONE===
--EXPECT--
--- testing: '0' << '0' ---
int(0)
@@ -421,4 +420,3 @@ int(0)
int(0)
--- testing: 'a5.9' << 'a5.9' ---
int(0)
-===DONE===
diff --git a/tests/lang/operators/bitwiseShiftRight_basiclong_64bit.phpt b/tests/lang/operators/bitwiseShiftRight_basiclong_64bit.phpt
index 7a08ed09da..75be6afae2 100644
--- a/tests/lang/operators/bitwiseShiftRight_basiclong_64bit.phpt
+++ b/tests/lang/operators/bitwiseShiftRight_basiclong_64bit.phpt
@@ -24,7 +24,7 @@ error_reporting(E_ERROR);
foreach ($longVals as $longVal) {
foreach($otherVals as $otherVal) {
- echo "--- testing: $longVal >> $otherVal ---\n";
+ echo "--- testing: $longVal >> $otherVal ---\n";
try {
var_dump($longVal>>$otherVal);
} catch (ArithmeticError $e) {
@@ -35,8 +35,8 @@ foreach ($longVals as $longVal) {
foreach ($otherVals as $otherVal) {
foreach($longVals as $longVal) {
- echo "--- testing: $otherVal >> $longVal ---\n";
- try {
+ echo "--- testing: $otherVal >> $longVal ---\n";
+ try {
var_dump($otherVal>>$longVal);
} catch (ArithmeticError $e) {
echo "Exception: " . $e->getMessage() . "\n";
@@ -45,7 +45,6 @@ foreach ($otherVals as $otherVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 >> 0 ---
int(9223372036854775807)
@@ -587,4 +586,3 @@ Exception: Bit shift by negative number
Exception: Bit shift by negative number
--- testing: 9223372036854775807 >> -9.2233720368548E+18 ---
Exception: Bit shift by negative number
-===DONE===
diff --git a/tests/lang/operators/bitwiseShiftRight_variationStr.phpt b/tests/lang/operators/bitwiseShiftRight_variationStr.phpt
index e3c9c8962d..525f951a51 100644
--- a/tests/lang/operators/bitwiseShiftRight_variationStr.phpt
+++ b/tests/lang/operators/bitwiseShiftRight_variationStr.phpt
@@ -12,8 +12,8 @@ error_reporting(E_ERROR);
foreach ($strVals as $strVal) {
foreach($strVals as $otherVal) {
- echo "--- testing: '$strVal' >> '$otherVal' ---\n";
- try {
+ echo "--- testing: '$strVal' >> '$otherVal' ---\n";
+ try {
var_dump($strVal>>$otherVal);
} catch (ArithmeticError $e) {
echo "Exception: " . $e->getMessage() . "\n";
@@ -23,7 +23,6 @@ foreach ($strVals as $strVal) {
?>
-===DONE===
--EXPECT--
--- testing: '0' >> '0' ---
int(0)
@@ -417,4 +416,3 @@ int(0)
int(0)
--- testing: 'a5.9' >> 'a5.9' ---
int(0)
-===DONE===
diff --git a/tests/lang/operators/bitwiseShiftRight_variationStr2.phpt b/tests/lang/operators/bitwiseShiftRight_variationStr2.phpt
index db90e1b338..eaa905f271 100644
--- a/tests/lang/operators/bitwiseShiftRight_variationStr2.phpt
+++ b/tests/lang/operators/bitwiseShiftRight_variationStr2.phpt
@@ -10,9 +10,7 @@ var_dump("34" >> "1");
var_dump("56" >> "2");
?>
-===DONE===
--EXPECT--
int(12)
int(17)
int(14)
-===DONE===
diff --git a/tests/lang/operators/bitwiseXor_basiclong_64bit.phpt b/tests/lang/operators/bitwiseXor_basiclong_64bit.phpt
index 1ed750cca9..0b40e9feed 100644
--- a/tests/lang/operators/bitwiseXor_basiclong_64bit.phpt
+++ b/tests/lang/operators/bitwiseXor_basiclong_64bit.phpt
@@ -24,20 +24,19 @@ error_reporting(E_ERROR);
foreach ($longVals as $longVal) {
foreach($otherVals as $otherVal) {
- echo "--- testing: $longVal ^ $otherVal ---\n";
+ echo "--- testing: $longVal ^ $otherVal ---\n";
var_dump($longVal^$otherVal);
}
}
foreach ($otherVals as $otherVal) {
foreach($longVals as $longVal) {
- echo "--- testing: $otherVal ^ $longVal ---\n";
+ echo "--- testing: $otherVal ^ $longVal ---\n";
var_dump($otherVal^$longVal);
}
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 ^ 0 ---
int(9223372036854775807)
@@ -579,4 +578,3 @@ int(-1)
int(-2)
--- testing: 9223372036854775807 ^ -9.2233720368548E+18 ---
int(-1)
-===DONE===
diff --git a/tests/lang/operators/bitwiseXor_variationStr.phpt b/tests/lang/operators/bitwiseXor_variationStr.phpt
index dced933ee4..5a74d124ff 100644
--- a/tests/lang/operators/bitwiseXor_variationStr.phpt
+++ b/tests/lang/operators/bitwiseXor_variationStr.phpt
@@ -12,14 +12,13 @@ error_reporting(E_ERROR);
foreach ($strVals as $strVal) {
foreach($strVals as $otherVal) {
- echo "--- testing: '$strVal' ^ '$otherVal' ---\n";
+ echo "--- testing: '$strVal' ^ '$otherVal' ---\n";
var_dump(bin2hex($strVal^$otherVal));
}
}
?>
-===DONE===
--EXPECT--
--- testing: '0' ^ '0' ---
string(2) "00"
@@ -413,4 +412,3 @@ string(8) "50071d58"
string(8) "521b1a58"
--- testing: 'a5.9' ^ 'a5.9' ---
string(8) "00000000"
-===DONE===
diff --git a/tests/lang/operators/coalesce.phpt b/tests/lang/operators/coalesce.phpt
index b48d20bab1..7035eac84c 100644
--- a/tests/lang/operators/coalesce.phpt
+++ b/tests/lang/operators/coalesce.phpt
@@ -10,18 +10,18 @@ $obj = new StdClass;
$obj->boo = 7;
$arr = [
- 2 => 7,
- "foo" => "bar",
- "foobar" => NULL,
- "qux" => $obj,
- "bing" => [
- "bang"
- ]
+ 2 => 7,
+ "foo" => "bar",
+ "foobar" => NULL,
+ "qux" => $obj,
+ "bing" => [
+ "bang"
+ ]
];
function foobar() {
- echo "called\n";
- return ['a'];
+ echo "called\n";
+ return ['a'];
}
var_dump($nonexistent_variable ?? 3);
diff --git a/tests/lang/operators/divide_basiclong_64bit.phpt b/tests/lang/operators/divide_basiclong_64bit.phpt
index 4349ae0025..d8c0e60ded 100644
--- a/tests/lang/operators/divide_basiclong_64bit.phpt
+++ b/tests/lang/operators/divide_basiclong_64bit.phpt
@@ -24,20 +24,19 @@ error_reporting(E_ERROR);
foreach ($longVals as $longVal) {
foreach($otherVals as $otherVal) {
- echo "--- testing: $longVal / $otherVal ---\n";
+ echo "--- testing: $longVal / $otherVal ---\n";
var_dump($longVal/$otherVal);
}
}
foreach ($otherVals as $otherVal) {
foreach($longVals as $longVal) {
- echo "--- testing: $otherVal / $longVal ---\n";
+ echo "--- testing: $otherVal / $longVal ---\n";
var_dump($otherVal/$longVal);
}
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 / 0 ---
float(INF)
@@ -579,4 +578,3 @@ float(1)
int(-1)
--- testing: 9223372036854775807 / -9.2233720368548E+18 ---
float(-1)
-===DONE===
diff --git a/tests/lang/operators/divide_variationStr.phpt b/tests/lang/operators/divide_variationStr.phpt
index f908642765..3db09e4e95 100644
--- a/tests/lang/operators/divide_variationStr.phpt
+++ b/tests/lang/operators/divide_variationStr.phpt
@@ -12,14 +12,13 @@ error_reporting(E_ERROR);
foreach ($strVals as $strVal) {
foreach($strVals as $otherVal) {
- echo "--- testing: '$strVal' / '$otherVal' ---\n";
+ echo "--- testing: '$strVal' / '$otherVal' ---\n";
var_dump($strVal/$otherVal);
}
}
?>
-===DONE===
--EXPECT--
--- testing: '0' / '0' ---
float(NAN)
@@ -413,4 +412,3 @@ int(0)
float(0)
--- testing: 'a5.9' / 'a5.9' ---
float(NAN)
-===DONE===
diff --git a/tests/lang/operators/modulus_basiclong_64bit.phpt b/tests/lang/operators/modulus_basiclong_64bit.phpt
index 155649d203..34792c2b54 100644
--- a/tests/lang/operators/modulus_basiclong_64bit.phpt
+++ b/tests/lang/operators/modulus_basiclong_64bit.phpt
@@ -24,9 +24,9 @@ error_reporting(E_ERROR);
foreach ($longVals as $longVal) {
foreach($otherVals as $otherVal) {
- echo "--- testing: $longVal % $otherVal ---\n";
- try {
- var_dump($longVal%$otherVal);
+ echo "--- testing: $longVal % $otherVal ---\n";
+ try {
+ var_dump($longVal%$otherVal);
} catch (DivisionByZeroError $e) {
echo "Exception: " . $e->getMessage() . "\n";
}
@@ -35,8 +35,8 @@ foreach ($longVals as $longVal) {
foreach ($otherVals as $otherVal) {
foreach($longVals as $longVal) {
- echo "--- testing: $otherVal % $longVal ---\n";
- try {
+ echo "--- testing: $otherVal % $longVal ---\n";
+ try {
var_dump($otherVal%$longVal);
} catch (DivisionByZeroError $e) {
echo "Exception: " . $e->getMessage() . "\n";
@@ -45,7 +45,6 @@ foreach ($otherVals as $otherVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 % 0 ---
Exception: Modulo by zero
@@ -587,4 +586,3 @@ int(9223372036854775807)
int(0)
--- testing: 9223372036854775807 % -9.2233720368548E+18 ---
int(9223372036854775807)
-===DONE===
diff --git a/tests/lang/operators/modulus_variationStr.phpt b/tests/lang/operators/modulus_variationStr.phpt
index 21765ecb7c..8d31c3ec91 100644
--- a/tests/lang/operators/modulus_variationStr.phpt
+++ b/tests/lang/operators/modulus_variationStr.phpt
@@ -12,7 +12,7 @@ error_reporting(E_ERROR);
foreach ($strVals as $strVal) {
foreach($strVals as $otherVal) {
- echo "--- testing: '$strVal' % '$otherVal' ---\n";
+ echo "--- testing: '$strVal' % '$otherVal' ---\n";
try {
var_dump($strVal%$otherVal);
} catch (DivisionByZeroError $e) {
@@ -23,7 +23,6 @@ foreach ($strVals as $strVal) {
?>
-===DONE===
--EXPECT--
--- testing: '0' % '0' ---
Exception: Modulo by zero
@@ -417,4 +416,3 @@ int(0)
int(0)
--- testing: 'a5.9' % 'a5.9' ---
Exception: Modulo by zero
-===DONE===
diff --git a/tests/lang/operators/multiply_basiclong_64bit.phpt b/tests/lang/operators/multiply_basiclong_64bit.phpt
index 512c3fbc18..2fbe530bdc 100644
--- a/tests/lang/operators/multiply_basiclong_64bit.phpt
+++ b/tests/lang/operators/multiply_basiclong_64bit.phpt
@@ -24,20 +24,19 @@ error_reporting(E_ERROR);
foreach ($longVals as $longVal) {
foreach($otherVals as $otherVal) {
- echo "--- testing: $longVal * $otherVal ---\n";
+ echo "--- testing: $longVal * $otherVal ---\n";
var_dump($longVal*$otherVal);
}
}
foreach ($otherVals as $otherVal) {
foreach($longVals as $longVal) {
- echo "--- testing: $otherVal * $longVal ---\n";
+ echo "--- testing: $otherVal * $longVal ---\n";
var_dump($otherVal*$longVal);
}
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 * 0 ---
int(0)
@@ -579,4 +578,3 @@ float(8.5070591730235E+37)
float(-8.5070591730235E+37)
--- testing: 9223372036854775807 * -9.2233720368548E+18 ---
float(-8.5070591730235E+37)
-===DONE===
diff --git a/tests/lang/operators/multiply_variationStr.phpt b/tests/lang/operators/multiply_variationStr.phpt
index 50735e2548..8f33aa2f00 100644
--- a/tests/lang/operators/multiply_variationStr.phpt
+++ b/tests/lang/operators/multiply_variationStr.phpt
@@ -12,14 +12,13 @@ error_reporting(E_ERROR);
foreach ($strVals as $strVal) {
foreach($strVals as $otherVal) {
- echo "--- testing: '$strVal' * '$otherVal' ---\n";
+ echo "--- testing: '$strVal' * '$otherVal' ---\n";
var_dump($strVal*$otherVal);
}
}
?>
-===DONE===
--EXPECT--
--- testing: '0' * '0' ---
int(0)
@@ -413,4 +412,3 @@ int(0)
float(0)
--- testing: 'a5.9' * 'a5.9' ---
int(0)
-===DONE===
diff --git a/tests/lang/operators/negate_basiclong_64bit.phpt b/tests/lang/operators/negate_basiclong_64bit.phpt
index bce8982126..4f60cbbd09 100644
--- a/tests/lang/operators/negate_basiclong_64bit.phpt
+++ b/tests/lang/operators/negate_basiclong_64bit.phpt
@@ -25,7 +25,6 @@ foreach ($longVals as $longVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 ---
int(-9223372036854775807)
@@ -57,4 +56,3 @@ float(-9.2233720368548E+18)
int(9223372036854775807)
--- testing: -9.2233720368548E+18 ---
float(9.2233720368548E+18)
-===DONE===
diff --git a/tests/lang/operators/negate_variationStr.phpt b/tests/lang/operators/negate_variationStr.phpt
index 7956ef4a1c..3b70349026 100644
--- a/tests/lang/operators/negate_variationStr.phpt
+++ b/tests/lang/operators/negate_variationStr.phpt
@@ -15,7 +15,6 @@ foreach ($strVals as $strVal) {
}
?>
-===DONE===
--EXPECTF--
--- testing: '0' ---
int(0)
@@ -61,4 +60,3 @@ float(-3.4)
Warning: A non-numeric value encountered in %s on line %d
int(0)
-===DONE===
diff --git a/tests/lang/operators/operator_equals_basic.phpt b/tests/lang/operators/operator_equals_basic.phpt
index 1f83a48180..08bb9accbe 100644
--- a/tests/lang/operators/operator_equals_basic.phpt
+++ b/tests/lang/operators/operator_equals_basic.phpt
@@ -59,7 +59,5 @@ if ($failed == false) {
}
?>
-===DONE===
--EXPECT--
Test Passed
-===DONE===
diff --git a/tests/lang/operators/operator_equals_variation.phpt b/tests/lang/operators/operator_equals_variation.phpt
index ad561454ae..65fe4a9aae 100644
--- a/tests/lang/operators/operator_equals_variation.phpt
+++ b/tests/lang/operators/operator_equals_variation.phpt
@@ -57,7 +57,5 @@ if ($failed == false) {
}
?>
-===DONE===
--EXPECT--
Test Passed
-===DONE===
diff --git a/tests/lang/operators/operator_equals_variation_64bit.phpt b/tests/lang/operators/operator_equals_variation_64bit.phpt
index 15d440978e..7a04e244a4 100644
--- a/tests/lang/operators/operator_equals_variation_64bit.phpt
+++ b/tests/lang/operators/operator_equals_variation_64bit.phpt
@@ -59,7 +59,5 @@ if ($failed == false) {
}
?>
-===DONE===
--EXPECT--
Test Passed
-===DONE===
diff --git a/tests/lang/operators/operator_gt_basic.phpt b/tests/lang/operators/operator_gt_basic.phpt
index 66c457f0b1..10e711a5a5 100644
--- a/tests/lang/operators/operator_gt_basic.phpt
+++ b/tests/lang/operators/operator_gt_basic.phpt
@@ -59,7 +59,5 @@ if ($failed == false) {
echo "Test Passed\n";
}
?>
-===DONE===
--EXPECT--
Test Passed
-===DONE===
diff --git a/tests/lang/operators/operator_gt_or_equal_basic.phpt b/tests/lang/operators/operator_gt_or_equal_basic.phpt
index 006c22baeb..98f7aa543a 100644
--- a/tests/lang/operators/operator_gt_or_equal_basic.phpt
+++ b/tests/lang/operators/operator_gt_or_equal_basic.phpt
@@ -46,12 +46,12 @@ for ($i = 0; $i < count($toCompare); $i +=3) {
}
if ($invalid_compares != NULL) {
- foreach($invalid_compares as $compareVal) {
- if ($typeToTest >= $compareVal) {
- echo "FAILED: '$typeToTest' >= '$compareVal'\n";
- $failed = true;
- }
- }
+ foreach($invalid_compares as $compareVal) {
+ if ($typeToTest >= $compareVal) {
+ echo "FAILED: '$typeToTest' >= '$compareVal'\n";
+ $failed = true;
+ }
+ }
}
}
@@ -59,7 +59,5 @@ if ($failed == false) {
echo "Test Passed\n";
}
?>
-===DONE===
--EXPECT--
Test Passed
-===DONE===
diff --git a/tests/lang/operators/operator_gt_or_equal_variation.phpt b/tests/lang/operators/operator_gt_or_equal_variation.phpt
index 1e3a338e73..eb0bd91b76 100644
--- a/tests/lang/operators/operator_gt_or_equal_variation.phpt
+++ b/tests/lang/operators/operator_gt_or_equal_variation.phpt
@@ -57,7 +57,5 @@ if ($failed == false) {
}
?>
-===DONE===
--EXPECT--
Test Passed
-===DONE===
diff --git a/tests/lang/operators/operator_gt_or_equal_variation_64bit.phpt b/tests/lang/operators/operator_gt_or_equal_variation_64bit.phpt
index d6245abbfc..71dd554e34 100644
--- a/tests/lang/operators/operator_gt_or_equal_variation_64bit.phpt
+++ b/tests/lang/operators/operator_gt_or_equal_variation_64bit.phpt
@@ -57,7 +57,5 @@ if ($failed == false) {
}
?>
-===DONE===
--EXPECT--
Test Passed
-===DONE===
diff --git a/tests/lang/operators/operator_gt_variation.phpt b/tests/lang/operators/operator_gt_variation.phpt
index 4c56ec5e6a..9c85b1848a 100644
--- a/tests/lang/operators/operator_gt_variation.phpt
+++ b/tests/lang/operators/operator_gt_variation.phpt
@@ -52,7 +52,5 @@ if ($failed == false) {
}
?>
-===DONE===
--EXPECT--
Test Passed
-===DONE===
diff --git a/tests/lang/operators/operator_gt_variation_64bit.phpt b/tests/lang/operators/operator_gt_variation_64bit.phpt
index 60a34c8986..fb3947f3e5 100644
--- a/tests/lang/operators/operator_gt_variation_64bit.phpt
+++ b/tests/lang/operators/operator_gt_variation_64bit.phpt
@@ -56,7 +56,5 @@ if ($failed == false) {
}
?>
-===DONE===
--EXPECT--
Test Passed
-===DONE===
diff --git a/tests/lang/operators/operator_identical_basic.phpt b/tests/lang/operators/operator_identical_basic.phpt
index cddba995a6..8f566523d0 100644
--- a/tests/lang/operators/operator_identical_basic.phpt
+++ b/tests/lang/operators/operator_identical_basic.phpt
@@ -59,7 +59,5 @@ if ($failed == false) {
}
?>
-===DONE===
--EXPECT--
Test Passed
-===DONE===
diff --git a/tests/lang/operators/operator_identical_variation.phpt b/tests/lang/operators/operator_identical_variation.phpt
index 8b8e1dc7ea..0bc3329f59 100644
--- a/tests/lang/operators/operator_identical_variation.phpt
+++ b/tests/lang/operators/operator_identical_variation.phpt
@@ -57,7 +57,5 @@ if ($failed == false) {
}
?>
-===DONE===
--EXPECT--
Test Passed
-===DONE===
diff --git a/tests/lang/operators/operator_identical_variation_64bit.phpt b/tests/lang/operators/operator_identical_variation_64bit.phpt
index cd098699f2..13dd3e8442 100644
--- a/tests/lang/operators/operator_identical_variation_64bit.phpt
+++ b/tests/lang/operators/operator_identical_variation_64bit.phpt
@@ -59,7 +59,5 @@ if ($failed == false) {
}
?>
-===DONE===
--EXPECT--
Test Passed
-===DONE===
diff --git a/tests/lang/operators/operator_lt_basic.phpt b/tests/lang/operators/operator_lt_basic.phpt
index 4574fb7d1d..3893a4c152 100644
--- a/tests/lang/operators/operator_lt_basic.phpt
+++ b/tests/lang/operators/operator_lt_basic.phpt
@@ -56,7 +56,5 @@ if ($failed == false) {
echo "Test Passed\n";
}
?>
-===DONE===
--EXPECT--
Test Passed
-===DONE===
diff --git a/tests/lang/operators/operator_lt_or_equal_basic.phpt b/tests/lang/operators/operator_lt_or_equal_basic.phpt
index 5439fd7d75..db09d38776 100644
--- a/tests/lang/operators/operator_lt_or_equal_basic.phpt
+++ b/tests/lang/operators/operator_lt_or_equal_basic.phpt
@@ -45,12 +45,12 @@ for ($i = 0; $i < count($toCompare); $i +=3) {
}
if ($invalid_compares != NULL) {
- foreach($invalid_compares as $compareVal) {
- if ($typeToTest <= $compareVal) {
- echo "FAILED: '$typeToTest' <= '$compareVal'\n";
- $failed = true;
- }
- }
+ foreach($invalid_compares as $compareVal) {
+ if ($typeToTest <= $compareVal) {
+ echo "FAILED: '$typeToTest' <= '$compareVal'\n";
+ $failed = true;
+ }
+ }
}
}
@@ -58,7 +58,5 @@ if ($failed == false) {
echo "Test Passed\n";
}
?>
-===DONE===
--EXPECT--
Test Passed
-===DONE===
diff --git a/tests/lang/operators/operator_lt_or_equal_variation.phpt b/tests/lang/operators/operator_lt_or_equal_variation.phpt
index a003138ceb..27d45142a2 100644
--- a/tests/lang/operators/operator_lt_or_equal_variation.phpt
+++ b/tests/lang/operators/operator_lt_or_equal_variation.phpt
@@ -57,7 +57,5 @@ if ($failed == false) {
}
?>
-===DONE===
--EXPECT--
Test Passed
-===DONE===
diff --git a/tests/lang/operators/operator_lt_or_equal_variation_64bit.phpt b/tests/lang/operators/operator_lt_or_equal_variation_64bit.phpt
index 50afd9b3e5..293d429c05 100644
--- a/tests/lang/operators/operator_lt_or_equal_variation_64bit.phpt
+++ b/tests/lang/operators/operator_lt_or_equal_variation_64bit.phpt
@@ -57,7 +57,5 @@ if ($failed == false) {
}
?>
-===DONE===
--EXPECT--
Test Passed
-===DONE===
diff --git a/tests/lang/operators/operator_lt_variation.phpt b/tests/lang/operators/operator_lt_variation.phpt
index 18a6631665..a4886c257b 100644
--- a/tests/lang/operators/operator_lt_variation.phpt
+++ b/tests/lang/operators/operator_lt_variation.phpt
@@ -50,7 +50,5 @@ if ($failed == false) {
}
?>
-===DONE===
--EXPECT--
Test Passed
-===DONE===
diff --git a/tests/lang/operators/operator_lt_variation_64bit.phpt b/tests/lang/operators/operator_lt_variation_64bit.phpt
index 663b840e61..84156669cd 100644
--- a/tests/lang/operators/operator_lt_variation_64bit.phpt
+++ b/tests/lang/operators/operator_lt_variation_64bit.phpt
@@ -54,7 +54,5 @@ if ($failed == false) {
}
?>
-===DONE===
--EXPECT--
Test Passed
-===DONE===
diff --git a/tests/lang/operators/operator_notequals_basic.phpt b/tests/lang/operators/operator_notequals_basic.phpt
index 35bd83e445..b1202d0938 100644
--- a/tests/lang/operators/operator_notequals_basic.phpt
+++ b/tests/lang/operators/operator_notequals_basic.phpt
@@ -59,7 +59,5 @@ if ($failed == false) {
}
?>
-===DONE===
--EXPECT--
Test Passed
-===DONE===
diff --git a/tests/lang/operators/operator_notequals_variation.phpt b/tests/lang/operators/operator_notequals_variation.phpt
index 137888506f..a6eea6701d 100644
--- a/tests/lang/operators/operator_notequals_variation.phpt
+++ b/tests/lang/operators/operator_notequals_variation.phpt
@@ -57,7 +57,5 @@ if ($failed == false) {
}
?>
-===DONE===
--EXPECT--
Test Passed
-===DONE===
diff --git a/tests/lang/operators/operator_notequals_variation_64bit.phpt b/tests/lang/operators/operator_notequals_variation_64bit.phpt
index ea06b49264..1a5491c760 100644
--- a/tests/lang/operators/operator_notequals_variation_64bit.phpt
+++ b/tests/lang/operators/operator_notequals_variation_64bit.phpt
@@ -59,7 +59,5 @@ if ($failed == false) {
}
?>
-===DONE===
--EXPECT--
Test Passed
-===DONE===
diff --git a/tests/lang/operators/operator_notidentical_basic.phpt b/tests/lang/operators/operator_notidentical_basic.phpt
index d24c936119..79c4ad7798 100644
--- a/tests/lang/operators/operator_notidentical_basic.phpt
+++ b/tests/lang/operators/operator_notidentical_basic.phpt
@@ -59,7 +59,5 @@ if ($failed == false) {
}
?>
-===DONE===
--EXPECT--
Test Passed
-===DONE===
diff --git a/tests/lang/operators/operator_notidentical_variation.phpt b/tests/lang/operators/operator_notidentical_variation.phpt
index bae03f85b7..09d492be21 100644
--- a/tests/lang/operators/operator_notidentical_variation.phpt
+++ b/tests/lang/operators/operator_notidentical_variation.phpt
@@ -58,7 +58,5 @@ if ($failed == false) {
}
?>
-===DONE===
--EXPECT--
Test Passed
-===DONE===
diff --git a/tests/lang/operators/operator_notidentical_variation_64bit.phpt b/tests/lang/operators/operator_notidentical_variation_64bit.phpt
index d24f8b6234..03dfa1fca1 100644
--- a/tests/lang/operators/operator_notidentical_variation_64bit.phpt
+++ b/tests/lang/operators/operator_notidentical_variation_64bit.phpt
@@ -59,7 +59,5 @@ if ($failed == false) {
}
?>
-===DONE===
--EXPECT--
Test Passed
-===DONE===
diff --git a/tests/lang/operators/operator_spaceship_basic.phpt b/tests/lang/operators/operator_spaceship_basic.phpt
index 13b80612dc..650cf97482 100644
--- a/tests/lang/operators/operator_spaceship_basic.phpt
+++ b/tests/lang/operators/operator_spaceship_basic.phpt
@@ -88,7 +88,5 @@ if ($failed == false) {
echo "Test Passed\n";
}
?>
-===DONE===
--EXPECT--
Test Passed
-===DONE===
diff --git a/tests/lang/operators/overloaded_property_ref.phpt b/tests/lang/operators/overloaded_property_ref.phpt
index 7561fc9916..8a158fc0fd 100644
--- a/tests/lang/operators/overloaded_property_ref.phpt
+++ b/tests/lang/operators/overloaded_property_ref.phpt
@@ -3,9 +3,9 @@ Operators on overlaoded property reference
--FILE--
<?php
class C {
- function __construct() { $this->bar = str_repeat("1", 2); }
- function &__get($x) { return $this->bar; }
- function __set($x, $v) { $this->bar = $v; }
+ function __construct() { $this->bar = str_repeat("1", 2); }
+ function &__get($x) { return $this->bar; }
+ function __set($x, $v) { $this->bar = $v; }
}
$x = new C;
var_dump(++$x->foo);
diff --git a/tests/lang/operators/postdec_basiclong_64bit.phpt b/tests/lang/operators/postdec_basiclong_64bit.phpt
index 5d0af4d553..066b7eb2f3 100644
--- a/tests/lang/operators/postdec_basiclong_64bit.phpt
+++ b/tests/lang/operators/postdec_basiclong_64bit.phpt
@@ -26,7 +26,6 @@ foreach ($longVals as $longVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 ---
int(9223372036854775806)
@@ -58,4 +57,3 @@ float(9.2233720368548E+18)
int(-9223372036854775808)
--- testing: -9.2233720368548E+18 ---
float(-9.2233720368548E+18)
-===DONE===
diff --git a/tests/lang/operators/postdec_variationStr.phpt b/tests/lang/operators/postdec_variationStr.phpt
index da88951e46..5d7e8c6246 100644
--- a/tests/lang/operators/postdec_variationStr.phpt
+++ b/tests/lang/operators/postdec_variationStr.phpt
@@ -16,7 +16,6 @@ foreach ($strVals as $strVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: '0' ---
int(-1)
@@ -46,4 +45,3 @@ string(7) "123abc "
string(4) "3.4a"
--- testing: 'a5.9' ---
string(4) "a5.9"
-===DONE===
diff --git a/tests/lang/operators/postinc_basiclong_64bit.phpt b/tests/lang/operators/postinc_basiclong_64bit.phpt
index d1003e22a5..78a803de17 100644
--- a/tests/lang/operators/postinc_basiclong_64bit.phpt
+++ b/tests/lang/operators/postinc_basiclong_64bit.phpt
@@ -26,7 +26,6 @@ foreach ($longVals as $longVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 ---
float(9.2233720368548E+18)
@@ -58,4 +57,3 @@ float(9.2233720368548E+18)
int(-9223372036854775806)
--- testing: -9.2233720368548E+18 ---
float(-9.2233720368548E+18)
-===DONE===
diff --git a/tests/lang/operators/postinc_variationStr.phpt b/tests/lang/operators/postinc_variationStr.phpt
index c83d598fb7..800b5c2455 100644
--- a/tests/lang/operators/postinc_variationStr.phpt
+++ b/tests/lang/operators/postinc_variationStr.phpt
@@ -16,7 +16,6 @@ foreach ($strVals as $strVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: '0' ---
int(1)
@@ -46,4 +45,3 @@ string(7) "123abc "
string(4) "3.4b"
--- testing: 'a5.9' ---
string(4) "a5.0"
-===DONE===
diff --git a/tests/lang/operators/predec_basiclong_64bit.phpt b/tests/lang/operators/predec_basiclong_64bit.phpt
index 1f460a06e0..353755b3d4 100644
--- a/tests/lang/operators/predec_basiclong_64bit.phpt
+++ b/tests/lang/operators/predec_basiclong_64bit.phpt
@@ -25,7 +25,6 @@ foreach ($longVals as $longVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 ---
int(9223372036854775806)
@@ -57,4 +56,3 @@ float(9.2233720368548E+18)
int(-9223372036854775808)
--- testing: -9.2233720368548E+18 ---
float(-9.2233720368548E+18)
-===DONE===
diff --git a/tests/lang/operators/predec_variationStr.phpt b/tests/lang/operators/predec_variationStr.phpt
index 8fb1bffac8..aa4b2dcc85 100644
--- a/tests/lang/operators/predec_variationStr.phpt
+++ b/tests/lang/operators/predec_variationStr.phpt
@@ -15,7 +15,6 @@ foreach ($strVals as $strVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: '0' ---
int(-1)
@@ -45,4 +44,3 @@ string(7) "123abc "
string(4) "3.4a"
--- testing: 'a5.9' ---
string(4) "a5.9"
-===DONE===
diff --git a/tests/lang/operators/preinc_basiclong_64bit.phpt b/tests/lang/operators/preinc_basiclong_64bit.phpt
index 40a03f9d7a..ca562a64f6 100644
--- a/tests/lang/operators/preinc_basiclong_64bit.phpt
+++ b/tests/lang/operators/preinc_basiclong_64bit.phpt
@@ -25,7 +25,6 @@ foreach ($longVals as $longVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 ---
float(9.2233720368548E+18)
@@ -57,4 +56,3 @@ float(9.2233720368548E+18)
int(-9223372036854775806)
--- testing: -9.2233720368548E+18 ---
float(-9.2233720368548E+18)
-===DONE===
diff --git a/tests/lang/operators/preinc_variationStr.phpt b/tests/lang/operators/preinc_variationStr.phpt
index 4e607057f7..abb3663889 100644
--- a/tests/lang/operators/preinc_variationStr.phpt
+++ b/tests/lang/operators/preinc_variationStr.phpt
@@ -16,7 +16,6 @@ foreach ($strVals as $strVal) {
}
?>
-===DONE===
--EXPECT--
--- testing: '0' ---
int(1)
@@ -64,4 +63,3 @@ string(3) "10a"
string(3) "20a"
--- testing: '99z' ---
string(4) "100a"
-===DONE===
diff --git a/tests/lang/operators/subtract_basiclong_64bit.phpt b/tests/lang/operators/subtract_basiclong_64bit.phpt
index 0c403f343e..0685371737 100644
--- a/tests/lang/operators/subtract_basiclong_64bit.phpt
+++ b/tests/lang/operators/subtract_basiclong_64bit.phpt
@@ -24,20 +24,19 @@ error_reporting(E_ERROR);
foreach ($longVals as $longVal) {
foreach($otherVals as $otherVal) {
- echo "--- testing: $longVal - $otherVal ---\n";
+ echo "--- testing: $longVal - $otherVal ---\n";
var_dump($longVal-$otherVal);
}
}
foreach ($otherVals as $otherVal) {
foreach($longVals as $longVal) {
- echo "--- testing: $otherVal - $longVal ---\n";
+ echo "--- testing: $otherVal - $longVal ---\n";
var_dump($otherVal-$longVal);
}
}
?>
-===DONE===
--EXPECT--
--- testing: 9223372036854775807 - 0 ---
int(9223372036854775807)
@@ -579,4 +578,3 @@ float(0)
float(1.844674407371E+19)
--- testing: 9223372036854775807 - -9.2233720368548E+18 ---
float(1.844674407371E+19)
-===DONE===
diff --git a/tests/lang/operators/subtract_variationStr.phpt b/tests/lang/operators/subtract_variationStr.phpt
index 393b172fb1..2c4667c114 100644
--- a/tests/lang/operators/subtract_variationStr.phpt
+++ b/tests/lang/operators/subtract_variationStr.phpt
@@ -12,14 +12,13 @@ error_reporting(E_ERROR);
foreach ($strVals as $strVal) {
foreach($strVals as $otherVal) {
- echo "--- testing: '$strVal' - '$otherVal' ---\n";
+ echo "--- testing: '$strVal' - '$otherVal' ---\n";
var_dump($strVal-$otherVal);
}
}
?>
-===DONE===
--EXPECT--
--- testing: '0' - '0' ---
int(0)
@@ -413,4 +412,3 @@ int(-123)
float(-3.4)
--- testing: 'a5.9' - 'a5.9' ---
int(0)
-===DONE===
diff --git a/tests/lang/passByReference_001.phpt b/tests/lang/passByReference_001.phpt
index 277f6d4a39..fd05182e68 100644
--- a/tests/lang/passByReference_001.phpt
+++ b/tests/lang/passByReference_001.phpt
@@ -4,14 +4,14 @@ passing of function parameters by reference
<?php
function f($arg1, &$arg2)
{
- var_dump($arg1++);
- var_dump($arg2++);
+ var_dump($arg1++);
+ var_dump($arg2++);
}
function g (&$arg1, &$arg2)
{
- var_dump($arg1);
- var_dump($arg2);
+ var_dump($arg1);
+ var_dump($arg2);
}
$a = 7;
$b = 15;
diff --git a/tests/lang/passByReference_002.phpt b/tests/lang/passByReference_002.phpt
index d1968a3528..2c3de8879a 100644
--- a/tests/lang/passByReference_002.phpt
+++ b/tests/lang/passByReference_002.phpt
@@ -5,11 +5,14 @@ Attempt to pass a constant by reference
function f(&$arg1)
{
- var_dump($arg1++);
+ var_dump($arg1++);
}
f(2);
?>
--EXPECTF--
-Fatal error: Only variables can be passed by reference in %s on line 8
+Fatal error: Uncaught Error: Cannot pass parameter 1 by reference in %s:%d
+Stack trace:
+#0 {main}
+ thrown in %s on line %d
diff --git a/tests/lang/passByReference_003.phpt b/tests/lang/passByReference_003.phpt
index ad9e1e39de..cfbc1b02de 100644
--- a/tests/lang/passByReference_003.phpt
+++ b/tests/lang/passByReference_003.phpt
@@ -3,13 +3,13 @@ Implicit initialisation when passing by reference
--FILE--
<?php
function passbyVal($val) {
- echo "\nInside passbyVal call:\n";
- var_dump($val);
+ echo "\nInside passbyVal call:\n";
+ var_dump($val);
}
function passbyRef(&$ref) {
- echo "\nInside passbyRef call:\n";
- var_dump($ref);
+ echo "\nInside passbyRef call:\n";
+ var_dump($ref);
}
echo "\nPassing undefined by value\n";
@@ -25,16 +25,16 @@ var_dump($undef2)
--EXPECTF--
Passing undefined by value
-Notice: Undefined variable: undef1 in %s on line %d
+Warning: Undefined variable: undef1 in %s on line %d
-Notice: Trying to access array offset on value of type null in %s on line %d
+Warning: Trying to access array offset on value of type null in %s on line %d
Inside passbyVal call:
NULL
After call
-Notice: Undefined variable: undef1 in %s on line %d
+Warning: Undefined variable: undef1 in %s on line %d
NULL
Passing undefined by reference
diff --git a/tests/lang/passByReference_004.phpt b/tests/lang/passByReference_004.phpt
index a890411b71..e5688a230f 100644
--- a/tests/lang/passByReference_004.phpt
+++ b/tests/lang/passByReference_004.phpt
@@ -5,12 +5,12 @@ passing the return value from a function by reference
function foo(&$ref)
{
- var_dump($ref);
+ var_dump($ref);
}
function bar($value)
{
- return $value;
+ return $value;
}
foo(bar(5));
diff --git a/tests/lang/passByReference_005.phpt b/tests/lang/passByReference_005.phpt
index dc32962d67..82b79b684f 100644
--- a/tests/lang/passByReference_005.phpt
+++ b/tests/lang/passByReference_005.phpt
@@ -4,70 +4,95 @@ Pass uninitialised variables by reference and by value to test implicit initiali
<?php
function v($val) {
- $val = "Val changed";
+ $val = "Val changed";
}
function r(&$ref) {
- $ref = "Ref changed";
+ $ref = "Ref changed";
}
-
function vv($val1, $val2) {
- $val1 = "Val1 changed";
- $val2 = "Val2 changed";
+ $val1 = "Val1 changed";
+ $val2 = "Val2 changed";
}
function vr($val, &$ref) {
- $val = "Val changed";
- $ref = "Ref changed";
+ $val = "Val changed";
+ $ref = "Ref changed";
}
function rv(&$ref, $val) {
- $val = "Val changed";
- $ref = "Ref changed";
+ $val = "Val changed";
+ $ref = "Ref changed";
}
function rr(&$ref1, &$ref2) {
- $ref1 = "Ref1 changed";
- $ref2 = "Ref2 changed";
+ $ref1 = "Ref1 changed";
+ $ref2 = "Ref2 changed";
}
class C {
-
- function __construct($val, &$ref) {
- $val = "Val changed";
- $ref = "Ref changed";
- }
-
- function v($val) {
- $val = "Val changed";
- }
-
- function r(&$ref) {
- $ref = "Ref changed";
- }
-
- function vv($val1, $val2) {
- $val1 = "Val1 changed";
- $val2 = "Val2 changed";
- }
-
- function vr($val, &$ref) {
- $val = "Val changed";
- $ref = "Ref changed";
- }
-
- function rv(&$ref, $val) {
- $val = "Val changed";
- $ref = "Ref changed";
- }
-
- function rr(&$ref1, &$ref2) {
- $ref1 = "Ref1 changed";
- $ref2 = "Ref2 changed";
- }
-
+ function __construct($val, &$ref) {
+ $val = "Val changed";
+ $ref = "Ref changed";
+ }
+
+ function v($val) {
+ $val = "Val changed";
+ }
+
+ function r(&$ref) {
+ $ref = "Ref changed";
+ }
+
+ function vv($val1, $val2) {
+ $val1 = "Val1 changed";
+ $val2 = "Val2 changed";
+ }
+
+ function vr($val, &$ref) {
+ $val = "Val changed";
+ $ref = "Ref changed";
+ }
+
+ function rv(&$ref, $val) {
+ $val = "Val changed";
+ $ref = "Ref changed";
+ }
+
+ function rr(&$ref1, &$ref2) {
+ $ref1 = "Ref1 changed";
+ $ref2 = "Ref2 changed";
+ }
+
+ static function static_v($val) {
+ $val = "Val changed";
+ }
+
+ static function static_r(&$ref) {
+ $ref = "Ref changed";
+ }
+
+ static function static_vv($val1, $val2) {
+ $val1 = "Val1 changed";
+ $val2 = "Val2 changed";
+ }
+
+ static function static_vr($val, &$ref) {
+ $val = "Val changed";
+ $ref = "Ref changed";
+ }
+
+ static function static_rv(&$ref, $val) {
+ $val = "Val changed";
+ $ref = "Ref changed";
+ }
+
+ static function static_rr(&$ref1, &$ref2) {
+ $ref1 = "Ref1 changed";
+ $ref2 = "Ref2 changed";
+ }
}
echo "\n ---- Pass by ref / pass by val: functions ----\n";
@@ -95,24 +120,24 @@ var_dump($u1, $u2);
echo "\n\n ---- Pass by ref / pass by val: static method calls ----\n";
unset($u1, $u2);
-C::v($u1);
-C::r($u2);
+C::static_v($u1);
+C::static_r($u2);
var_dump($u1, $u2);
unset($u1, $u2);
-C::vv($u1, $u2);
+C::static_vv($u1, $u2);
var_dump($u1, $u2);
unset($u1, $u2);
-C::vr($u1, $u2);
+C::static_vr($u1, $u2);
var_dump($u1, $u2);
unset($u1, $u2);
-C::rv($u1, $u2);
+C::static_rv($u1, $u2);
var_dump($u1, $u2);
unset($u1, $u2);
-C::rr($u1, $u2);
+C::static_rr($u1, $u2);
var_dump($u1, $u2);
echo "\n\n ---- Pass by ref / pass by val: instance method calls ----\n";
@@ -145,31 +170,31 @@ var_dump($u1, $u2);
--EXPECTF--
---- Pass by ref / pass by val: functions ----
-Notice: Undefined variable: u1 in %s on line 72
+Warning: Undefined variable: u1 in %s on line %d
-Notice: Undefined variable: u1 in %s on line 74
+Warning: Undefined variable: u1 in %s on line %d
NULL
string(11) "Ref changed"
-Notice: Undefined variable: u1 in %s on line 77
+Warning: Undefined variable: u1 in %s on line %d
-Notice: Undefined variable: u2 in %s on line 77
+Warning: Undefined variable: u2 in %s on line %d
-Notice: Undefined variable: u1 in %s on line 78
+Warning: Undefined variable: u1 in %s on line %d
-Notice: Undefined variable: u2 in %s on line 78
+Warning: Undefined variable: u2 in %s on line %d
NULL
NULL
-Notice: Undefined variable: u1 in %s on line 81
+Warning: Undefined variable: u1 in %s on line %d
-Notice: Undefined variable: u1 in %s on line 82
+Warning: Undefined variable: u1 in %s on line %d
NULL
string(11) "Ref changed"
-Notice: Undefined variable: u2 in %s on line 85
+Warning: Undefined variable: u2 in %s on line %d
-Notice: Undefined variable: u2 in %s on line 86
+Warning: Undefined variable: u2 in %s on line %d
string(11) "Ref changed"
NULL
string(12) "Ref1 changed"
@@ -178,82 +203,70 @@ string(12) "Ref2 changed"
---- Pass by ref / pass by val: static method calls ----
-Deprecated: Non-static method C::v() should not be called statically in %s on line 95
-
-Notice: Undefined variable: u1 in %s on line 95
+Warning: Undefined variable: u1 in %s on line %d
-Deprecated: Non-static method C::r() should not be called statically in %s on line 96
-
-Notice: Undefined variable: u1 in %s on line 97
+Warning: Undefined variable: u1 in %s on line %d
NULL
string(11) "Ref changed"
-Deprecated: Non-static method C::vv() should not be called statically in %s on line 100
-
-Notice: Undefined variable: u1 in %s on line 100
+Warning: Undefined variable: u1 in %s on line %d
-Notice: Undefined variable: u2 in %s on line 100
+Warning: Undefined variable: u2 in %s on line %d
-Notice: Undefined variable: u1 in %s on line 101
+Warning: Undefined variable: u1 in %s on line %d
-Notice: Undefined variable: u2 in %s on line 101
+Warning: Undefined variable: u2 in %s on line %d
NULL
NULL
-Deprecated: Non-static method C::vr() should not be called statically in %s on line 104
+Warning: Undefined variable: u1 in %s on line %d
-Notice: Undefined variable: u1 in %s on line 104
-
-Notice: Undefined variable: u1 in %s on line 105
+Warning: Undefined variable: u1 in %s on line %d
NULL
string(11) "Ref changed"
-Deprecated: Non-static method C::rv() should not be called statically in %s on line 108
-
-Notice: Undefined variable: u2 in %s on line 108
+Warning: Undefined variable: u2 in %s on line %d
-Notice: Undefined variable: u2 in %s on line 109
+Warning: Undefined variable: u2 in %s on line %d
string(11) "Ref changed"
NULL
-
-Deprecated: Non-static method C::rr() should not be called statically in %s on line 112
string(12) "Ref1 changed"
string(12) "Ref2 changed"
---- Pass by ref / pass by val: instance method calls ----
-Notice: Undefined variable: u1 in %s on line 117
+Warning: Undefined variable: u1 in %s on line %d
-Notice: Undefined variable: u1 in %s on line 118
+Warning: Undefined variable: u1 in %s on line %d
NULL
string(11) "Ref changed"
-Notice: Undefined variable: u1 in %s on line 121
+Warning: Undefined variable: u1 in %s on line %d
-Notice: Undefined variable: u1 in %s on line 123
+Warning: Undefined variable: u1 in %s on line %d
NULL
string(11) "Ref changed"
-Notice: Undefined variable: u1 in %s on line 126
+Warning: Undefined variable: u1 in %s on line %d
-Notice: Undefined variable: u2 in %s on line 126
+Warning: Undefined variable: u2 in %s on line %d
-Notice: Undefined variable: u1 in %s on line 127
+Warning: Undefined variable: u1 in %s on line %d
-Notice: Undefined variable: u2 in %s on line 127
+Warning: Undefined variable: u2 in %s on line %d
NULL
NULL
-Notice: Undefined variable: u1 in %s on line 130
+Warning: Undefined variable: u1 in %s on line %d
-Notice: Undefined variable: u1 in %s on line 131
+Warning: Undefined variable: u1 in %s on line %d
NULL
string(11) "Ref changed"
-Notice: Undefined variable: u2 in %s on line 134
+Warning: Undefined variable: u2 in %s on line %d
-Notice: Undefined variable: u2 in %s on line 135
+Warning: Undefined variable: u2 in %s on line %d
string(11) "Ref changed"
NULL
string(12) "Ref1 changed"
diff --git a/tests/lang/passByReference_006.phpt b/tests/lang/passByReference_006.phpt
index c1478663ca..4c098acff3 100644
--- a/tests/lang/passByReference_006.phpt
+++ b/tests/lang/passByReference_006.phpt
@@ -3,70 +3,54 @@ Pass uninitialised objects and arrays by reference to test implicit initialisati
--FILE--
<?php
-function refs(&$ref1, &$ref2, &$ref3, &$ref4, &$ref5) {
+function refs(&$ref1, &$ref2) {
$ref1 = "Ref1 changed";
$ref2 = "Ref2 changed";
- $ref3 = "Ref3 changed";
- $ref4 = "Ref4 changed";
- $ref5 = "Ref5 changed";
}
class C {
- function __construct(&$ref1, &$ref2, &$ref3, &$ref4, &$ref5) {
- $ref1 = "Ref1 changed";
- $ref2 = "Ref2 changed";
- $ref3 = "Ref3 changed";
- $ref4 = "Ref4 changed";
- $ref5 = "Ref5 changed";
- }
-
- function refs(&$ref1, &$ref2, &$ref3, &$ref4, &$ref5) {
- $ref1 = "Ref1 changed";
- $ref2 = "Ref2 changed";
- $ref3 = "Ref3 changed";
- $ref4 = "Ref4 changed";
- $ref5 = "Ref5 changed";
- }
+ function __construct(&$ref1, &$ref2) {
+ $ref1 = "Ref1 changed";
+ $ref2 = "Ref2 changed";
+ }
+
+ function refs(&$ref1, &$ref2) {
+ $ref1 = "Ref1 changed";
+ $ref2 = "Ref2 changed";
+ }
+
+ static function static_refs(&$ref1, &$ref2) {
+ $ref1 = "Ref1 changed";
+ $ref2 = "Ref2 changed";
+ }
}
echo "\n ---- Pass uninitialised array & object by ref: function call ---\n";
-unset($u1, $u2, $u3, $u4, $u5);
-refs($u1[0], $u2[0][1], $u3->a, $u4->a->b, $u5->a->b->c);
-var_dump($u1, $u2, $u3, $u4, $u5);
+unset($u1, $u2);
+refs($u1[0], $u2[0][1]);
+var_dump($u1, $u2);
echo "\n ---- Pass uninitialised arrays & objects by ref: static method call ---\n";
-unset($u1, $u2, $u3, $u4, $u5);
-C::refs($u1[0], $u2[0][1], $u3->a, $u4->a->b, $u5->a->b->c);
-var_dump($u1, $u2, $u3, $u4, $u5);
+unset($u1, $u2);
+C::static_refs($u1[0], $u2[0][1]);
+var_dump($u1, $u2);
echo "\n\n---- Pass uninitialised arrays & objects by ref: constructor ---\n";
-unset($u1, $u2, $u3, $u4, $u5);
-$c = new C($u1[0], $u2[0][1], $u3->a, $u4->a->b, $u5->a->b->c);
-var_dump($u1, $u2, $u3, $u4, $u5);
+unset($u1, $u2);
+$c = new C($u1[0], $u2[0][1]);
+var_dump($u1, $u2);
echo "\n ---- Pass uninitialised arrays & objects by ref: instance method call ---\n";
-unset($u1, $u2, $u3, $u4, $u5);
-$c->refs($u1[0], $u2[0][1], $u3->a, $u4->a->b, $u5->a->b->c);
-var_dump($u1, $u2, $u3, $u4, $u5);
+unset($u1, $u2);
+$c->refs($u1[0], $u2[0][1]);
+var_dump($u1, $u2);
?>
---EXPECTF--
- ---- Pass uninitialised array & object by ref: function call ---
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
+--EXPECT--
+---- Pass uninitialised array & object by ref: function call ---
array(1) {
[0]=>
string(12) "Ref1 changed"
@@ -78,43 +62,8 @@ array(1) {
string(12) "Ref2 changed"
}
}
-object(stdClass)#%d (1) {
- ["a"]=>
- string(12) "Ref3 changed"
-}
-object(stdClass)#%d (1) {
- ["a"]=>
- object(stdClass)#%d (1) {
- ["b"]=>
- string(12) "Ref4 changed"
- }
-}
-object(stdClass)#%d (1) {
- ["a"]=>
- object(stdClass)#%d (1) {
- ["b"]=>
- object(stdClass)#%d (1) {
- ["c"]=>
- string(12) "Ref5 changed"
- }
- }
-}
---- Pass uninitialised arrays & objects by ref: static method call ---
-
-Deprecated: Non-static method C::refs() should not be called statically in %s on line 39
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
array(1) {
[0]=>
string(12) "Ref1 changed"
@@ -126,42 +75,9 @@ array(1) {
string(12) "Ref2 changed"
}
}
-object(stdClass)#%d (1) {
- ["a"]=>
- string(12) "Ref3 changed"
-}
-object(stdClass)#%d (1) {
- ["a"]=>
- object(stdClass)#%d (1) {
- ["b"]=>
- string(12) "Ref4 changed"
- }
-}
-object(stdClass)#%d (1) {
- ["a"]=>
- object(stdClass)#%d (1) {
- ["b"]=>
- object(stdClass)#%d (1) {
- ["c"]=>
- string(12) "Ref5 changed"
- }
- }
-}
---- Pass uninitialised arrays & objects by ref: constructor ---
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
array(1) {
[0]=>
string(12) "Ref1 changed"
@@ -173,41 +89,8 @@ array(1) {
string(12) "Ref2 changed"
}
}
-object(stdClass)#%d (1) {
- ["a"]=>
- string(12) "Ref3 changed"
-}
-object(stdClass)#%d (1) {
- ["a"]=>
- object(stdClass)#%d (1) {
- ["b"]=>
- string(12) "Ref4 changed"
- }
-}
-object(stdClass)#%d (1) {
- ["a"]=>
- object(stdClass)#%d (1) {
- ["b"]=>
- object(stdClass)#%d (1) {
- ["c"]=>
- string(12) "Ref5 changed"
- }
- }
-}
---- Pass uninitialised arrays & objects by ref: instance method call ---
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
-
-Warning: Creating default object from empty value in %spassByReference_006.php on line %d
array(1) {
[0]=>
string(12) "Ref1 changed"
@@ -219,24 +102,3 @@ array(1) {
string(12) "Ref2 changed"
}
}
-object(stdClass)#%d (1) {
- ["a"]=>
- string(12) "Ref3 changed"
-}
-object(stdClass)#%d (1) {
- ["a"]=>
- object(stdClass)#%d (1) {
- ["b"]=>
- string(12) "Ref4 changed"
- }
-}
-object(stdClass)#%d (1) {
- ["a"]=>
- object(stdClass)#%d (1) {
- ["b"]=>
- object(stdClass)#%d (1) {
- ["c"]=>
- string(12) "Ref5 changed"
- }
- }
-}
diff --git a/tests/lang/passByReference_007.phpt b/tests/lang/passByReference_007.phpt
index 51594da0f3..9de00d26fd 100644
--- a/tests/lang/passByReference_007.phpt
+++ b/tests/lang/passByReference_007.phpt
@@ -3,42 +3,42 @@ Pass function and method calls by reference and by value.
--FILE--
<?php
class C {
- static function sreturnVal() {
- global $a;
- return $a;
- }
-
- static function &sreturnReference() {
- global $a;
- return $a;
- }
-
- function returnVal() {
- global $a;
- return $a;
- }
-
- function &returnReference() {
- global $a;
- return $a;
- }
+ static function sreturnVal() {
+ global $a;
+ return $a;
+ }
+
+ static function &sreturnReference() {
+ global $a;
+ return $a;
+ }
+
+ function returnVal() {
+ global $a;
+ return $a;
+ }
+
+ function &returnReference() {
+ global $a;
+ return $a;
+ }
}
function returnVal() {
- global $a;
- return $a;
+ global $a;
+ return $a;
}
function &returnReference() {
- global $a;
- return $a;
+ global $a;
+ return $a;
}
function foo(&$ref) {
- var_dump($ref);
- $ref = "changed";
+ var_dump($ref);
+ $ref = "changed";
}
diff --git a/tests/lang/passByReference_008.phpt b/tests/lang/passByReference_008.phpt
index 5042b72e4b..ec5f161b40 100644
--- a/tests/lang/passByReference_008.phpt
+++ b/tests/lang/passByReference_008.phpt
@@ -3,15 +3,15 @@ Pass same variable by ref and by value.
--FILE--
<?php
function valRef($x, &$y) {
- var_dump($x, $y);
- $x = 'changed.x';
- $y = 'changed.y';
+ var_dump($x, $y);
+ $x = 'changed.x';
+ $y = 'changed.y';
}
function refVal(&$x, $y) {
- var_dump($x, $y);
- $x = 'changed.x';
- $y = 'changed.y';
+ var_dump($x, $y);
+ $x = 'changed.x';
+ $y = 'changed.y';
}
diff --git a/tests/lang/passByReference_009.phpt b/tests/lang/passByReference_009.phpt
index 7b723d552e..d51cf9a2cb 100644
--- a/tests/lang/passByReference_009.phpt
+++ b/tests/lang/passByReference_009.phpt
@@ -1,5 +1,5 @@
--TEST--
-Assignement as argument
+Assignment as argument
--FILE--
<?php
function foo(&$x, &$y) { $x = 1; echo $y ; }
diff --git a/tests/lang/passByReference_010.phpt b/tests/lang/passByReference_010.phpt
index f996073c0f..9606d4f842 100644
--- a/tests/lang/passByReference_010.phpt
+++ b/tests/lang/passByReference_010.phpt
@@ -9,42 +9,52 @@ function f(&$a) {
}
echo "\n\n---> Pass constant assignment by reference:\n";
-f($a="a.original");
-var_dump($a);
+try {
+ f($a="a.original");
+ var_dump($a);
+} catch (Throwable $e) {
+ echo "Exception: " . $e->getMessage() ."\n";
+}
echo "\n\n---> Pass variable assignment by reference:\n";
-unset($a);
-$a = "a.original";
-f($b = $a);
-var_dump($a);
+try {
+ unset($a);
+ $a = "a.original";
+ f($b = $a);
+ var_dump($a);
+} catch (Throwable $e) {
+ echo "Exception: " . $e->getMessage() ."\n";
+}
echo "\n\n---> Pass reference assignment by reference:\n";
-unset($a, $b);
-$a = "a.original";
-f($b =& $a);
-var_dump($a);
+try {
+ unset($a, $b);
+ $a = "a.original";
+ f($b =& $a);
+ var_dump($a);
+} catch (Throwable $e) {
+ echo "Exception: " . $e->getMessage() ."\n";
+}
echo "\n\n---> Pass concat assignment by reference:\n";
-unset($a, $b);
-$b = "b.original";
-$a = "a.original";
-f($b .= $a);
-var_dump($a);
+try {
+ unset($a, $b);
+ $b = "b.original";
+ $a = "a.original";
+ f($b .= $a);
+ var_dump($a);
+} catch (Throwable $e) {
+ echo "Exception: " . $e->getMessage() ."\n";
+}
?>
---EXPECTF--
+--EXPECT--
---> Pass constant assignment by reference:
-
-Notice: Only variables should be passed by reference in %s on line 9
-string(10) "a.original"
-string(10) "a.original"
+Exception: Cannot pass parameter 1 by reference
---> Pass variable assignment by reference:
-
-Notice: Only variables should be passed by reference in %s on line 15
-string(10) "a.original"
-string(10) "a.original"
+Exception: Cannot pass parameter 1 by reference
---> Pass reference assignment by reference:
@@ -53,7 +63,4 @@ string(9) "a.changed"
---> Pass concat assignment by reference:
-
-Notice: Only variables should be passed by reference in %s on line 28
-string(20) "b.originala.original"
-string(10) "a.original"
+Exception: Cannot pass parameter 1 by reference
diff --git a/tests/lang/passByReference_012.phpt b/tests/lang/passByReference_012.phpt
index 3bc60a484e..cbc9dcf8f9 100644
--- a/tests/lang/passByReference_012.phpt
+++ b/tests/lang/passByReference_012.phpt
@@ -13,11 +13,9 @@ $original = array ( array ( 'one' ));
$stack = $original;
var_dump(array_shift(array_shift($stack)));
?>
-===DONE===
--EXPECTF--
Notice: Only variables should be passed by reference in %s on line %d
string(3) "two"
Notice: Only variables should be passed by reference in %s on line %d
string(3) "one"
-===DONE===
diff --git a/tests/lang/returnByReference.001.phpt b/tests/lang/returnByReference.001.phpt
index 1feccd4a97..5278289f46 100644
--- a/tests/lang/returnByReference.001.phpt
+++ b/tests/lang/returnByReference.001.phpt
@@ -5,7 +5,7 @@ Returning a reference from a function
function &returnByRef(&$arg1)
{
- return $arg1;
+ return $arg1;
}
$a = 7;
diff --git a/tests/lang/returnByReference.002.phpt b/tests/lang/returnByReference.002.phpt
index 67061048b3..1469e95a49 100644
--- a/tests/lang/returnByReference.002.phpt
+++ b/tests/lang/returnByReference.002.phpt
@@ -3,13 +3,13 @@ Returning a reference from a function.
--FILE--
<?php
function &returnRef() {
- global $a;
- return $a;
+ global $a;
+ return $a;
}
function returnVal() {
- global $a;
- return $a;
+ global $a;
+ return $a;
}
$a = "original";
diff --git a/tests/lang/returnByReference.003.phpt b/tests/lang/returnByReference.003.phpt
index 44b5f7825b..11b91c547c 100644
--- a/tests/lang/returnByReference.003.phpt
+++ b/tests/lang/returnByReference.003.phpt
@@ -3,15 +3,15 @@ Returning a reference from a function
--FILE--
<?php
function returnConstantByValue() {
- return 100;
+ return 100;
}
function &returnConstantByRef() {
- return 100;
+ return 100;
}
function &returnVariableByRef() {
- return $GLOBALS['a'];
+ return $GLOBALS['a'];
}
echo "\n---> 1. Trying to assign by reference the return value of a function that returns by value:\n";
diff --git a/tests/lang/returnByReference.004.phpt b/tests/lang/returnByReference.004.phpt
index 63d4c709a3..d7e768cb82 100644
--- a/tests/lang/returnByReference.004.phpt
+++ b/tests/lang/returnByReference.004.phpt
@@ -3,17 +3,17 @@ Returning a reference from a static method
--FILE--
<?php
Class C {
- static function returnConstantByValue() {
- return 100;
- }
+ static function returnConstantByValue() {
+ return 100;
+ }
- static function &returnConstantByRef() {
- return 100;
- }
+ static function &returnConstantByRef() {
+ return 100;
+ }
- static function &returnVariableByRef() {
- return $GLOBALS['a'];
- }
+ static function &returnVariableByRef() {
+ return $GLOBALS['a'];
+ }
}
echo "\n---> 1. Trying to assign by reference the return value of a function that returns by value:\n";
diff --git a/tests/lang/returnByReference.005.phpt b/tests/lang/returnByReference.005.phpt
index 1d7a390b15..100bfe9ed8 100644
--- a/tests/lang/returnByReference.005.phpt
+++ b/tests/lang/returnByReference.005.phpt
@@ -3,17 +3,17 @@ Returning a reference from a method
--FILE--
<?php
Class C {
- function returnConstantByValue() {
- return 100;
- }
+ function returnConstantByValue() {
+ return 100;
+ }
- function &returnConstantByRef() {
- return 100;
- }
+ function &returnConstantByRef() {
+ return 100;
+ }
- static function &returnVariableByRef() {
- return $GLOBALS['a'];
- }
+ static function &returnVariableByRef() {
+ return $GLOBALS['a'];
+ }
}
$c = new C;
diff --git a/tests/lang/returnByReference.006.phpt b/tests/lang/returnByReference.006.phpt
index d7a6c580a0..ff1749aa13 100644
--- a/tests/lang/returnByReference.006.phpt
+++ b/tests/lang/returnByReference.006.phpt
@@ -3,19 +3,19 @@ Returning a reference from a function via another function
--FILE--
<?php
function returnConstantByValue() {
- return 100;
+ return 100;
}
function &returnConstantByRef() {
- return 100;
+ return 100;
}
function &returnVariableByRef() {
- return $GLOBALS['a'];
+ return $GLOBALS['a'];
}
function &returnFunctionCallByRef($functionToCall) {
- return $functionToCall();
+ return $functionToCall();
}
echo "\n---> 1. Via a return by ref function call, assign by reference the return value of a function that returns by value:\n";
diff --git a/tests/lang/returnByReference.007.phpt b/tests/lang/returnByReference.007.phpt
index b38dfa0cb1..f3f1e5c8a8 100644
--- a/tests/lang/returnByReference.007.phpt
+++ b/tests/lang/returnByReference.007.phpt
@@ -3,21 +3,21 @@ Returning a reference from a static method via another static method
--FILE--
<?php
class C {
- static function returnConstantByValue() {
- return 100;
- }
+ static function returnConstantByValue() {
+ return 100;
+ }
- static function &returnConstantByRef() {
- return 100;
- }
+ static function &returnConstantByRef() {
+ return 100;
+ }
- static function &returnVariableByRef() {
- return $GLOBALS['a'];
- }
+ static function &returnVariableByRef() {
+ return $GLOBALS['a'];
+ }
- static function &returnFunctionCallByRef($functionToCall) {
- return C::$functionToCall();
- }
+ static function &returnFunctionCallByRef($functionToCall) {
+ return C::$functionToCall();
+ }
}
echo "\n---> 1. Via a return by ref function call, assign by reference the return value of a function that returns by value:\n";
diff --git a/tests/lang/returnByReference.008.phpt b/tests/lang/returnByReference.008.phpt
index 360df577c2..27a305a0ef 100644
--- a/tests/lang/returnByReference.008.phpt
+++ b/tests/lang/returnByReference.008.phpt
@@ -3,21 +3,21 @@ Returning a reference from a non-static method via another non-static method
--FILE--
<?php
class C {
- function returnConstantByValue() {
- return 100;
- }
+ function returnConstantByValue() {
+ return 100;
+ }
- function &returnConstantByRef() {
- return 100;
- }
+ function &returnConstantByRef() {
+ return 100;
+ }
- function &returnVariableByRef() {
- return $GLOBALS['a'];
- }
+ function &returnVariableByRef() {
+ return $GLOBALS['a'];
+ }
- function &returnFunctionCallByRef($functionToCall) {
- return $this->$functionToCall();
- }
+ function &returnFunctionCallByRef($functionToCall) {
+ return $this->$functionToCall();
+ }
}
$c = new C;
diff --git a/tests/lang/returnByReference.009.phpt b/tests/lang/returnByReference.009.phpt
index 68662f53eb..194f78bd84 100644
--- a/tests/lang/returnByReference.009.phpt
+++ b/tests/lang/returnByReference.009.phpt
@@ -6,11 +6,11 @@ Returning a references returned by another function
function &returnVarByRef () {
$b=1;
- return $b;
+ return $b;
}
function &testReturnVarByRef() {
- return returnVarByRef();
+ return returnVarByRef();
}
function returnVal () {
@@ -18,7 +18,7 @@ return 1;
}
function &testReturnValByRef() {
- return returnVal();
+ return returnVal();
}
echo "\n---> 1. Return a variable by reference -> No warning:\n";
diff --git a/tests/lang/short_tags.004.phpt b/tests/lang/short_tags.004.phpt
index 6df8af1c2a..9bf73b064b 100644
--- a/tests/lang/short_tags.004.phpt
+++ b/tests/lang/short_tags.004.phpt
@@ -29,6 +29,6 @@ This gets echoed twice
<? $b=3; ?>
-Notice: Undefined variable: b in %s on line %d
+Warning: Undefined variable: b in %s on line %d
-Notice: Undefined variable: b in %s on line %d
+Warning: Undefined variable: b in %s on line %d
diff --git a/tests/lang/static_basic_001.phpt b/tests/lang/static_basic_001.phpt
index 302d2cf131..6a3ea1aa68 100644
--- a/tests/lang/static_basic_001.phpt
+++ b/tests/lang/static_basic_001.phpt
@@ -5,12 +5,12 @@ Static keyword - basic tests
echo "\nSame variable used as static and non static.\n";
function staticNonStatic() {
- echo "---------\n";
- $a=0;
- echo "$a\n";
- static $a=10;
- echo "$a\n";
- $a++;
+ echo "---------\n";
+ $a=0;
+ echo "$a\n";
+ static $a=10;
+ echo "$a\n";
+ $a++;
}
staticNonStatic();
staticNonStatic();
@@ -18,20 +18,20 @@ staticNonStatic();
echo "\nLots of initialisations in the same statement.\n";
function manyInits() {
- static $counter=0;
- echo "------------- Call $counter --------------\n";
- static $a, $b=10, $c=20, $d, $e=30;
- echo "Unitialised : $a\n";
- echo "Initialised to 10: $b\n";
- echo "Initialised to 20: $c\n";
- echo "Unitialised : $d\n";
- echo "Initialised to 30: $e\n";
- $a++;
- $b++;
- $c++;
- $d++;
- $e++;
- $counter++;
+ static $counter=0;
+ echo "------------- Call $counter --------------\n";
+ static $a, $b=10, $c=20, $d, $e=30;
+ echo "Unitialised : $a\n";
+ echo "Initialised to 10: $b\n";
+ echo "Initialised to 20: $c\n";
+ echo "Unitialised : $d\n";
+ echo "Initialised to 30: $e\n";
+ $a++;
+ $b++;
+ $c++;
+ $d++;
+ $e++;
+ $counter++;
}
manyInits();
manyInits();
diff --git a/tests/lang/static_basic_002.phpt b/tests/lang/static_basic_002.phpt
index 7e4e0bc3f4..b6e9856e82 100644
--- a/tests/lang/static_basic_002.phpt
+++ b/tests/lang/static_basic_002.phpt
@@ -13,10 +13,10 @@ static $a = 11;
var_dump($a);
function foo() {
- static $a = 13;
- static $a = 14;
+ static $a = 13;
+ static $a = 14;
- var_dump($a);
+ var_dump($a);
}
foo();
diff --git a/tests/lang/static_variation_001.phpt b/tests/lang/static_variation_001.phpt
index d8ebfd2ea1..13c3395f94 100644
--- a/tests/lang/static_variation_001.phpt
+++ b/tests/lang/static_variation_001.phpt
@@ -6,14 +6,14 @@ Statics in nested functions & evals.
static $a = array(7,8,9);
function f1() {
- static $a = array(1,2,3);
+ static $a = array(1,2,3);
- function g1() {
- static $a = array(4,5,6);
- var_dump($a);
- }
+ function g1() {
+ static $a = array(4,5,6);
+ var_dump($a);
+ }
- var_dump($a);
+ var_dump($a);
}
@@ -24,15 +24,15 @@ var_dump($a);
eval(' static $b = array(10,11,12); ');
function f2() {
- eval(' static $b = array(1,2,3); ');
+ eval(' static $b = array(1,2,3); ');
- function g2a() {
- eval(' static $b = array(4,5,6); ');
- var_dump($b);
- }
+ function g2a() {
+ eval(' static $b = array(4,5,6); ');
+ var_dump($b);
+ }
- eval('function g2b() { static $b = array(7, 8, 9); var_dump($b); } ');
- var_dump($b);
+ eval('function g2b() { static $b = array(7, 8, 9); var_dump($b); } ');
+ var_dump($b);
}
f2();
diff --git a/tests/lang/static_variation_002.phpt b/tests/lang/static_variation_002.phpt
index abb359c1d4..d1e2345ba1 100644
--- a/tests/lang/static_variation_002.phpt
+++ b/tests/lang/static_variation_002.phpt
@@ -4,26 +4,26 @@ Static variables in methods & nested functions & evals.
<?php
Class C {
- function f() {
- static $a = array(1,2,3);
- eval(' static $k = array(4,5,6); ');
+ function f() {
+ static $a = array(1,2,3);
+ eval(' static $k = array(4,5,6); ');
- function cfg() {
- static $a = array(7,8,9);
- eval(' static $k = array(10,11,12); ');
- var_dump($a, $k);
- }
- var_dump($a, $k);
- }
+ function cfg() {
+ static $a = array(7,8,9);
+ eval(' static $k = array(10,11,12); ');
+ var_dump($a, $k);
+ }
+ var_dump($a, $k);
+ }
}
$c = new C;
$c->f();
cfg();
Class D {
- static function f() {
- eval('function dfg() { static $b = array(1,2,3); var_dump($b); } ');
- }
+ static function f() {
+ eval('function dfg() { static $b = array(1,2,3); var_dump($b); } ');
+ }
}
D::f();
dfg();
diff --git a/tests/lang/string_decimals_001.phpt b/tests/lang/string_decimals_001.phpt
index 2bd3ef62a2..c82e1e8ee9 100644
--- a/tests/lang/string_decimals_001.phpt
+++ b/tests/lang/string_decimals_001.phpt
@@ -15,7 +15,6 @@ test("9..");
test("9.9.");
test("9.9.9");
?>
-===DONE===
--EXPECT--
--> Testing ..9:
int(0)
@@ -41,4 +40,3 @@ bool(true)
int(9)
float(9.9)
bool(true)
-===DONE===
diff --git a/tests/lang/this_assignment.phpt b/tests/lang/this_assignment.phpt
index a7c76174a5..995c326d4f 100644
--- a/tests/lang/this_assignment.phpt
+++ b/tests/lang/this_assignment.phpt
@@ -37,7 +37,5 @@ $b->who();
echo "\n";
?>
-===DONE===
--EXPECT--
firstfirstfirstfirstsecondsecondsecondsecondsecond
-===DONE===
diff --git a/tests/lang/throw_variation_001.phpt b/tests/lang/throw_variation_001.phpt
index d942a87930..f71ef41ec7 100644
--- a/tests/lang/throw_variation_001.phpt
+++ b/tests/lang/throw_variation_001.phpt
@@ -4,9 +4,9 @@ Catching an exception thrown from an included file
<?php
try {
- include "inc_throw.inc";
+ include "inc_throw.inc";
} catch (Exception $e) {
- echo "caught exception\n";
+ echo "caught exception\n";
}
?>
diff --git a/tests/lang/type_hints_002.phpt b/tests/lang/type_hints_002.phpt
index cd348ebfb2..36fe56ad4b 100644
--- a/tests/lang/type_hints_002.phpt
+++ b/tests/lang/type_hints_002.phpt
@@ -4,10 +4,10 @@ ZE2 type hinting
<?php
class P { }
class T {
- function f(P $p = NULL) {
- var_dump($p);
- echo "-\n";
- }
+ function f(P $p = NULL) {
+ var_dump($p);
+ echo "-\n";
+ }
}
$o=new T();
diff --git a/tests/lang/type_hints_003.phpt b/tests/lang/type_hints_003.phpt
index f6b04dabff..1a90940f42 100644
--- a/tests/lang/type_hints_003.phpt
+++ b/tests/lang/type_hints_003.phpt
@@ -3,9 +3,9 @@ ZE2 type
--FILE--
<?php
class T {
- function f(P $p = 42) {
- }
+ function f(P $p = 42) {
+ }
}
?>
--EXPECTF--
-Fatal error: Default value for parameters with a class type can only be NULL in %stype_hints_003.php on line 3
+Fatal error: Cannot use int as default value for parameter $p of type P in %s on line %d
diff --git a/tests/output/bug46897.phpt b/tests/output/bug46897.phpt
index 8fe80bcb65..0e77938e47 100644
--- a/tests/output/bug46897.phpt
+++ b/tests/output/bug46897.phpt
@@ -18,10 +18,10 @@ echo 'Done';
?>
--EXPECTF--
[callback:1]Attempt to flush unerasable buffer - should fail...
-Notice: ob_flush(): failed to flush buffer of callback (0) in %s on line %d
+Notice: ob_flush(): Failed to flush buffer of callback (0) in %s on line %d
bool(false)
string(%d) "Attempt to flush unerasable buffer - should fail...
-Notice: ob_flush(): failed to flush buffer of callback (0) in %s on line %d
+Notice: ob_flush(): Failed to flush buffer of callback (0) in %s on line %d
bool(false)
"
Done
diff --git a/tests/output/bug70970.phpt b/tests/output/bug70970.phpt
index f87e6f6977..902d872b9a 100644
--- a/tests/output/bug70970.phpt
+++ b/tests/output/bug70970.phpt
@@ -4,20 +4,20 @@ Bug #70970 (Segfault when combining error handler with output buffering)
<?php
function exception_error_handler($severity, $message, $file, $line)
{
- throw new Exception($message, 0);
+ throw new Exception($message, 0);
}
set_error_handler('exception_error_handler');
function obHandler($buffer, $phase = null)
{
- try {
- ob_start();
- } catch (Exception $e) {
- return (string) $e;
- }
+ try {
+ ob_start();
+ } catch (Exception $e) {
+ return (string) $e;
+ }
- return $buffer;
+ return $buffer;
}
ob_start('obHandler');
diff --git a/tests/output/bug74815.phpt b/tests/output/bug74815.phpt
deleted file mode 100644
index 1d9c825999..0000000000
--- a/tests/output/bug74815.phpt
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-Bug #74815 crash with a combination of INI entries at startup
---FILE--
-<?php
-
-$php = getenv("TEST_PHP_EXECUTABLE");
-
-echo shell_exec("$php -n -d error_log=".__DIR__."/error_log.tmp -d error_reporting=E_ALL -d log_errors=On -d track_errors=On -v");
-
-?>
-==DONE==
---CLEAN--
-<?php
-unlink(__DIR__.'/error_log.tmp');
-?>
---EXPECTF--
-Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0
-%A
-==DONE==
diff --git a/tests/output/bug75236.phpt b/tests/output/bug75236.phpt
index f6c7a51aa3..bee4732cb2 100644
--- a/tests/output/bug75236.phpt
+++ b/tests/output/bug75236.phpt
@@ -14,5 +14,5 @@ Bug #75236: infinite loop when printing an error-message
--EXPECTF--
before getfilecontent
<br />
-<b>Warning</b>: file_get_contents(no/suchfile): failed to open stream: No such file or directory in <b>%s</b> on line <b>7</b><br />
+<b>Warning</b>: file_get_contents(no/suchfile): Failed to open stream: No such file or directory in <b>%s</b> on line <b>7</b><br />
after getfilecontent
diff --git a/tests/output/ob_010.phpt b/tests/output/ob_010.phpt
index c5581a860e..b73ba1eecb 100644
--- a/tests/output/ob_010.phpt
+++ b/tests/output/ob_010.phpt
@@ -4,7 +4,7 @@ output buffering - fatalism
<?php
function obh($s)
{
- return print_r($s, 1);
+ return print_r($s, 1);
}
ob_start("obh");
echo "foo\n";
diff --git a/tests/output/ob_011.phpt b/tests/output/ob_011.phpt
index 35b0388339..cd48cc3880 100644
--- a/tests/output/ob_011.phpt
+++ b/tests/output/ob_011.phpt
@@ -4,7 +4,7 @@ output buffering - fatalism
<?php
function obh($s)
{
- return ob_get_flush();
+ return ob_get_flush();
}
ob_start("obh");
echo "foo\n";
diff --git a/tests/output/ob_012.phpt b/tests/output/ob_012.phpt
index 9e6e885abf..b24138bdbf 100644
--- a/tests/output/ob_012.phpt
+++ b/tests/output/ob_012.phpt
@@ -3,19 +3,19 @@ output buffering - multiple
--FILE--
<?php
echo 0;
- ob_start();
- ob_start();
- ob_start();
- ob_start();
- echo 1;
- ob_end_flush();
- echo 2;
- $ob = ob_get_clean();
- echo 3;
- ob_flush();
- ob_end_clean();
- echo 4;
- ob_end_flush();
+ ob_start();
+ ob_start();
+ ob_start();
+ ob_start();
+ echo 1;
+ ob_end_flush();
+ echo 2;
+ $ob = ob_get_clean();
+ echo 3;
+ ob_flush();
+ ob_end_clean();
+ echo 4;
+ ob_end_flush();
echo $ob;
?>
--EXPECT--
diff --git a/tests/output/ob_014.phpt b/tests/output/ob_014.phpt
index 09534270f3..bc46f2ae58 100644
--- a/tests/output/ob_014.phpt
+++ b/tests/output/ob_014.phpt
@@ -4,19 +4,12 @@ output buffering - failure
<?php
ob_start("str_rot13");
echo "foo\n";
-// str_rot13 expects 1 param and returns NULL when passed 2 params.
-// It is invoked with 2 params when used as an OB callback.
-// Therefore, there will be no data in the buffer. This is expected: see bug 46900.
-ob_end_flush();
-
-// Show the error.
-print_r(error_get_last());
+try {
+ ob_end_flush();
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Array
-(
- [type] => 2
- [message] => str_rot13() expects exactly 1 parameter, 2 given
- [file] => %s
- [line] => 7
-)
+--EXPECT--
+foo
+str_rot13() expects exactly 1 parameter, 2 given
diff --git a/tests/output/ob_015.phpt b/tests/output/ob_015.phpt
index 2acdb40d0a..2bc08687d7 100644
--- a/tests/output/ob_015.phpt
+++ b/tests/output/ob_015.phpt
@@ -3,20 +3,13 @@ output buffering - failure
--FILE--
<?php
ob_start("str_rot13", 1);
-echo "foo\n";
-// str_rot13 expects 1 param and returns NULL when passed 2 params.
-// It is invoked with 2 params when used as an OB callback.
-// Therefore, there will be no data in the buffer. This is expected: see bug 46900.
+try {
+ echo "foo\n";
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
ob_end_flush();
-
-// Show the error.
-print_r(error_get_last());
?>
---EXPECTF--
-Array
-(
- [type] => 2
- [message] => str_rot13() expects exactly 1 parameter, 2 given
- [file] => %s
- [line] => 7
-)
+--EXPECT--
+foo
+str_rot13() expects exactly 1 parameter, 2 given
diff --git a/tests/output/ob_017.phpt b/tests/output/ob_017.phpt
index 1dc5fc59be..a214d40f18 100644
--- a/tests/output/ob_017.phpt
+++ b/tests/output/ob_017.phpt
@@ -1,14 +1,14 @@
--TEST--
-output buffering - stati
+output buffering - statuses
--INI--
opcache.optimization_level=0
--FILE--
<?php
-$stati = array();
+$statuses = array();
function oh($str, $flags) {
- global $stati;
- $stati[] = "$flags: $str";
- return $str;
+ global $statuses;
+ $statuses[] = "$flags: $str";
+ return $str;
}
ob_start("oh", 3);
echo "yes";
@@ -19,7 +19,7 @@ ob_clean();
echo "yes!\n";
echo "no";
ob_end_clean();
-print_r($stati);
+print_r($statuses);
?>
--EXPECT--
yes!
diff --git a/tests/output/ob_clean_basic_001.phpt b/tests/output/ob_clean_basic_001.phpt
index bd91676b12..584df6b81c 100644
--- a/tests/output/ob_clean_basic_001.phpt
+++ b/tests/output/ob_clean_basic_001.phpt
@@ -29,7 +29,7 @@ echo "Done";
-- Testing ob_clean() function with Zero arguments --
-Notice: ob_clean(): failed to delete buffer. No buffer to delete in %s on line 12
+Notice: ob_clean(): Failed to delete buffer. No buffer to delete in %s on line 12
bool(false)
string(61) "bool(true)
Ensure the buffer is still active after the clean."
diff --git a/tests/output/ob_end_clean_basic_001.phpt b/tests/output/ob_end_clean_basic_001.phpt
index 6824857675..491618ddbf 100644
--- a/tests/output/ob_end_clean_basic_001.phpt
+++ b/tests/output/ob_end_clean_basic_001.phpt
@@ -20,10 +20,10 @@ var_dump(ob_end_clean());
?>
--EXPECTF--
-Notice: ob_end_clean(): failed to delete buffer. No buffer to delete in %s on line 7
+Notice: ob_end_clean(): Failed to delete buffer. No buffer to delete in %s on line 7
bool(false)
bool(true)
bool(true)
-Notice: ob_end_clean(): failed to delete buffer. No buffer to delete in %s on line 16
+Notice: ob_end_clean(): Failed to delete buffer. No buffer to delete in %s on line 16
bool(false)
diff --git a/tests/output/ob_end_flush_basic_001.phpt b/tests/output/ob_end_flush_basic_001.phpt
index 811d6a0761..00e70b3b92 100644
--- a/tests/output/ob_end_flush_basic_001.phpt
+++ b/tests/output/ob_end_flush_basic_001.phpt
@@ -30,12 +30,12 @@ echo "Done";
-- Testing ob_end_flush() function with Zero arguments --
-Notice: ob_end_flush(): failed to delete and flush buffer. No buffer to delete or flush in %s on line 12
+Notice: ob_end_flush(): Failed to delete and flush buffer. No buffer to delete or flush in %s on line 12
bool(false)
bool(true)
Hello
bool(true)
-Notice: ob_end_flush(): failed to delete and flush buffer. No buffer to delete or flush in %s on line 21
+Notice: ob_end_flush(): Failed to delete and flush buffer. No buffer to delete or flush in %s on line 21
bool(false)
Done
diff --git a/tests/output/ob_flush_basic_001.phpt b/tests/output/ob_flush_basic_001.phpt
index e53c7e5a23..6c98738d47 100644
--- a/tests/output/ob_flush_basic_001.phpt
+++ b/tests/output/ob_flush_basic_001.phpt
@@ -30,7 +30,7 @@ echo "Done";
-- Testing ob_flush() function with Zero arguments --
-Notice: ob_flush(): failed to flush buffer. No buffer to flush in %s on line 12
+Notice: ob_flush(): Failed to flush buffer. No buffer to flush in %s on line 12
bool(false)
This should get flushed.
bool(true)
diff --git a/tests/output/ob_get_level_basic_001.phpt b/tests/output/ob_get_level_basic_001.phpt
index 4a6c84785b..f9b009ac8e 100644
--- a/tests/output/ob_get_level_basic_001.phpt
+++ b/tests/output/ob_get_level_basic_001.phpt
@@ -42,6 +42,6 @@ int(2)
int(1)
int(0)
-Notice: ob_end_flush(): failed to delete and flush buffer. No buffer to delete or flush in %s on line 26
+Notice: ob_end_flush(): Failed to delete and flush buffer. No buffer to delete or flush in %s on line 26
int(0)
Done
diff --git a/tests/output/ob_start_basic_002.phpt b/tests/output/ob_start_basic_002.phpt
index 2412ae57f0..700dab5d3c 100644
--- a/tests/output/ob_start_basic_002.phpt
+++ b/tests/output/ob_start_basic_002.phpt
@@ -3,23 +3,23 @@ ob_start(): Check behaviour with various callback return values.
--FILE--
<?php
function return_empty_string($string) {
- return "";
+ return "";
}
function return_false($string) {
- return false;
+ return false;
}
function return_null($string) {
- return null;
+ return null;
}
function return_string($string) {
- return "I stole your output.";
+ return "I stole your output.";
}
function return_zero($string) {
- return 0;
+ return 0;
}
// Use each of the above functions as an output buffering callback:
@@ -35,7 +35,6 @@ foreach ($callbacks as $callback) {
}
?>
-==DONE==
--EXPECT--
--> Use callback 'return_empty_string':
@@ -52,4 +51,3 @@ I stole your output.
--> Use callback 'return_zero':
0
-==DONE==
diff --git a/tests/output/ob_start_basic_003.phpt b/tests/output/ob_start_basic_003.phpt
index 23f0bfb274..4ea17132da 100644
--- a/tests/output/ob_start_basic_003.phpt
+++ b/tests/output/ob_start_basic_003.phpt
@@ -4,7 +4,7 @@ ob_start(): ensure even fatal error test is affected by output buffering.
<?php
function f() {
- return "I have stolen your output";
+ return "I have stolen your output";
}
ob_start('f');
diff --git a/tests/output/ob_start_basic_004.phpt b/tests/output/ob_start_basic_004.phpt
index ba75c16de9..f072a31f13 100644
--- a/tests/output/ob_start_basic_004.phpt
+++ b/tests/output/ob_start_basic_004.phpt
@@ -10,10 +10,10 @@ opcache.optimization_level=0
*/
// In HEAD, $chunk_size value of 1 should not have any special behaviour (http://marc.info/?l=php-internals&m=123476465621346&w=2).
function callback($string) {
- global $callback_invocations;
- $callback_invocations++;
- $len = strlen($string);
- return "f[call:$callback_invocations; len:$len]$string\n";
+ global $callback_invocations;
+ $callback_invocations++;
+ $len = strlen($string);
+ return "f[call:$callback_invocations; len:$len]$string\n";
}
for ($cs=-1; $cs<10; $cs++) {
diff --git a/tests/output/ob_start_basic_005.phpt b/tests/output/ob_start_basic_005.phpt
index 7cab6ed35f..4c3aa9c7eb 100644
--- a/tests/output/ob_start_basic_005.phpt
+++ b/tests/output/ob_start_basic_005.phpt
@@ -8,9 +8,9 @@ ob_start(): non-static method as static callbacks.
*/
Class C {
- function h($string) {
- return $string;
- }
+ function h($string) {
+ return $string;
+ }
}
function checkAndClean() {
@@ -25,9 +25,10 @@ checkAndClean();
?>
--EXPECTF--
-Warning: ob_start(): non-static method C::h() should not be called statically in %s on line 20
-bool(true)
+Warning: ob_start(): non-static method C::h() cannot be called statically in %s on line %d
+
+Notice: ob_start(): Failed to create buffer in %s on line %d
+bool(false)
Array
(
- [0] => C::h
)
diff --git a/tests/output/ob_start_basic_006.phpt b/tests/output/ob_start_basic_006.phpt
index d4d0fcc149..6df545ea22 100644
--- a/tests/output/ob_start_basic_006.phpt
+++ b/tests/output/ob_start_basic_006.phpt
@@ -8,32 +8,32 @@ ob_start(): ensure multiple buffer initialization with a single call using array
*/
function f($string) {
- static $i=0;
- $i++;
- $len = strlen($string);
- return "f[call:$i; len:$len] - $string\n";
+ static $i=0;
+ $i++;
+ $len = strlen($string);
+ return "f[call:$i; len:$len] - $string\n";
}
Class C {
- public $id = 'none';
-
- function __construct($id) {
- $this->id = $id;
- }
-
- static function g($string) {
- static $i=0;
- $i++;
- $len = strlen($string);
- return "C::g[call:$i; len:$len] - $string\n";
- }
-
- function h($string) {
- static $i=0;
- $i++;
- $len = strlen($string);
- return "C::h[call:$i; len:$len; id:$this->id] - $string\n";
- }
+ public $id = 'none';
+
+ function __construct($id) {
+ $this->id = $id;
+ }
+
+ static function g($string) {
+ static $i=0;
+ $i++;
+ $len = strlen($string);
+ return "C::g[call:$i; len:$len] - $string\n";
+ }
+
+ function h($string) {
+ static $i=0;
+ $i++;
+ $len = strlen($string);
+ return "C::h[call:$i; len:$len; id:$this->id] - $string\n";
+ }
}
function checkAndClean() {
@@ -43,7 +43,7 @@ function checkAndClean() {
}
}
-echo "\n ---> Test arrays: \n";
+echo "\n ---> Test arrays:\n";
var_dump(ob_start(array("f")));
checkAndClean();
@@ -72,11 +72,11 @@ var_dump(ob_start(array('f', 'C::g', array(array($c, "g"), array($c, "h")))));
checkAndClean();
?>
--EXPECTF--
- ---> Test arrays:
+ ---> Test arrays:
Warning: ob_start(): array must have exactly two members in %s on line 44
-Notice: ob_start(): failed to create buffer in %s on line 44
+Notice: ob_start(): Failed to create buffer in %s on line 44
bool(false)
Array
(
@@ -84,7 +84,7 @@ Array
Warning: ob_start(): class 'f' not found in %s on line 47
-Notice: ob_start(): failed to create buffer in %s on line 47
+Notice: ob_start(): Failed to create buffer in %s on line 47
bool(false)
Array
(
@@ -92,7 +92,7 @@ Array
Warning: ob_start(): array must have exactly two members in %s on line 50
-Notice: ob_start(): failed to create buffer in %s on line 50
+Notice: ob_start(): Failed to create buffer in %s on line 50
bool(false)
Array
(
@@ -100,7 +100,7 @@ Array
Warning: ob_start(): array must have exactly two members in %s on line 53
-Notice: ob_start(): failed to create buffer in %s on line 53
+Notice: ob_start(): Failed to create buffer in %s on line 53
bool(false)
Array
(
@@ -108,7 +108,7 @@ Array
Warning: ob_start(): array must have exactly two members in %s on line 56
-Notice: ob_start(): failed to create buffer in %s on line 56
+Notice: ob_start(): Failed to create buffer in %s on line 56
bool(false)
Array
(
@@ -128,7 +128,7 @@ Array
Warning: ob_start(): array must have exactly two members in %s on line 68
-Notice: ob_start(): failed to create buffer in %s on line 68
+Notice: ob_start(): Failed to create buffer in %s on line 68
bool(false)
Array
(
diff --git a/tests/output/ob_start_basic_unerasable_001.phpt b/tests/output/ob_start_basic_unerasable_001.phpt
index e97fd45420..658bee2163 100644
--- a/tests/output/ob_start_basic_unerasable_001.phpt
+++ b/tests/output/ob_start_basic_unerasable_001.phpt
@@ -3,9 +3,9 @@ ob_start(): Ensure content of unerasable buffer can be accessed by ob_get_conten
--FILE--
<?php
function callback($string) {
- static $callback_invocations;
- $callback_invocations++;
- return "[callback:$callback_invocations]$string\n";
+ static $callback_invocations;
+ $callback_invocations++;
+ return "[callback:$callback_invocations]$string\n";
}
ob_start('callback', 0, false);
@@ -14,9 +14,7 @@ echo "This call will obtain the content:\n";
$str = ob_get_contents();
var_dump($str);
?>
-==DONE==
--EXPECT--
[callback:1]This call will obtain the content:
string(35) "This call will obtain the content:
"
-==DONE==
diff --git a/tests/output/ob_start_basic_unerasable_002.phpt b/tests/output/ob_start_basic_unerasable_002.phpt
index 4fc1f53635..1afe3efbc5 100644
--- a/tests/output/ob_start_basic_unerasable_002.phpt
+++ b/tests/output/ob_start_basic_unerasable_002.phpt
@@ -3,9 +3,9 @@ ob_start(): Ensure unerasable buffer cannot be erased by ob_clean(), ob_end_clea
--FILE--
<?php
function callback($string) {
- static $callback_invocations;
- $callback_invocations++;
- return "[callback:$callback_invocations]$string\n";
+ static $callback_invocations;
+ $callback_invocations++;
+ return "[callback:$callback_invocations]$string\n";
}
ob_start('callback', 0, false);
@@ -21,13 +21,13 @@ var_dump(ob_get_level());
--EXPECTF--
[callback:1]All of the following calls will fail to clean/remove the topmost buffer:
-Notice: ob_clean(): failed to delete buffer of callback (0) in %s on line 11
+Notice: ob_clean(): Failed to delete buffer of callback (0) in %s on line 11
bool(false)
-Notice: ob_end_clean(): failed to discard buffer of callback (0) in %s on line 12
+Notice: ob_end_clean(): Failed to discard buffer of callback (0) in %s on line 12
bool(false)
-Notice: ob_end_flush(): failed to send buffer of callback (0) in %s on line 13
+Notice: ob_end_flush(): Failed to send buffer of callback (0) in %s on line 13
bool(false)
The OB nesting will still be 1 level deep:
int(1)
diff --git a/tests/output/ob_start_basic_unerasable_003.phpt b/tests/output/ob_start_basic_unerasable_003.phpt
index 9c09bd5e5f..b3b76da650 100644
--- a/tests/output/ob_start_basic_unerasable_003.phpt
+++ b/tests/output/ob_start_basic_unerasable_003.phpt
@@ -3,9 +3,9 @@ ob_start(): Ensure unerasable buffer cannot be accessed or erased by ob_get_clea
--FILE--
<?php
function callback($string) {
- static $callback_invocations;
- $callback_invocations++;
- return "[callback:$callback_invocations]$string\n";
+ static $callback_invocations;
+ $callback_invocations++;
+ return "[callback:$callback_invocations]$string\n";
}
ob_start('callback', 0, false);
@@ -16,7 +16,7 @@ var_dump($str);
?>
--EXPECTF--
[callback:1]This call will obtain the content, but will not clean the buffer.
-Notice: ob_get_clean(): failed to discard buffer of callback (0) in %s on line 11
+Notice: ob_get_clean(): Failed to discard buffer of callback (0) in %s on line 11
-Notice: ob_get_clean(): failed to delete buffer of callback (0) in %s on line 11
+Notice: ob_get_clean(): Failed to delete buffer of callback (0) in %s on line 11
string(65) "This call will obtain the content, but will not clean the buffer."
diff --git a/tests/output/ob_start_basic_unerasable_004.phpt b/tests/output/ob_start_basic_unerasable_004.phpt
index 02308b3ef4..442462462c 100644
--- a/tests/output/ob_start_basic_unerasable_004.phpt
+++ b/tests/output/ob_start_basic_unerasable_004.phpt
@@ -3,9 +3,9 @@ ob_start(): Ensure unerasable buffer cannot be accessed or flushed by ob_get_flu
--FILE--
<?php
function callback($string) {
- static $callback_invocations;
- $callback_invocations++;
- return "[callback:$callback_invocations]$string\n";
+ static $callback_invocations;
+ $callback_invocations++;
+ return "[callback:$callback_invocations]$string\n";
}
ob_start('callback', 0, false);
@@ -16,7 +16,7 @@ var_dump($str);
?>
--EXPECTF--
[callback:1]This call will obtain the content, but will not flush the buffer.
-Notice: ob_get_flush(): failed to send buffer of callback (0) in %s on line 11
+Notice: ob_get_flush(): Failed to send buffer of callback (0) in %s on line 11
-Notice: ob_get_flush(): failed to delete buffer of callback (0) in %s on line 11
+Notice: ob_get_flush(): Failed to delete buffer of callback (0) in %s on line 11
string(65) "This call will obtain the content, but will not flush the buffer."
diff --git a/tests/output/ob_start_basic_unerasable_005.phpt b/tests/output/ob_start_basic_unerasable_005.phpt
index 2c52f00c24..7f99b72dd1 100644
--- a/tests/output/ob_start_basic_unerasable_005.phpt
+++ b/tests/output/ob_start_basic_unerasable_005.phpt
@@ -3,23 +3,23 @@ ob_start(): Ensure unerasable buffer cannot be flushed by ob_flush()
--FILE--
<?php
function callback($string) {
- static $callback_invocations;
- $callback_invocations++;
- return "[callback:$callback_invocations]$string\n";
+ static $callback_invocations;
+ $callback_invocations++;
+ return "[callback:$callback_invocations]$string\n";
}
ob_start('callback', 0, false);
-echo "Attempt to flush unerasable buffer - should fail... ";
+echo "Attempt to flush unerasable buffer - should fail...";
var_dump(ob_flush());
// Check content of buffer after flush - if flush failed it should still contain the string above.
var_dump(ob_get_contents());
?>
--EXPECTF--
-[callback:1]Attempt to flush unerasable buffer - should fail...
-Notice: ob_flush(): failed to flush buffer of callback (0) in %s on line 11
+[callback:1]Attempt to flush unerasable buffer - should fail...
+Notice: ob_flush(): Failed to flush buffer of callback (0) in %s on line 11
bool(false)
-string(%d) "Attempt to flush unerasable buffer - should fail...
-Notice: ob_flush(): failed to flush buffer of callback (0) in %s on line 11
+string(%d) "Attempt to flush unerasable buffer - should fail...
+Notice: ob_flush(): Failed to flush buffer of callback (0) in %s on line 11
bool(false)
"
diff --git a/tests/output/ob_start_callbacks.phpt b/tests/output/ob_start_callbacks.phpt
index 6815bccd63..ea6e409534 100644
--- a/tests/output/ob_start_callbacks.phpt
+++ b/tests/output/ob_start_callbacks.phpt
@@ -11,9 +11,9 @@ ob_end_flush();
// Object (array) in variable
class foo {
- static function out($foo) {
- return strtoupper($foo);
- }
+ static function out($foo) {
+ return strtoupper($foo);
+ }
}
$a = array('foo', 'out');
ob_start($a);
@@ -26,7 +26,7 @@ echo 'object via static array', "\n";
ob_end_flush();
function my_strtoupper($foo, $bar) {
- return strtoupper($foo);
+ return strtoupper($foo);
}
$a = 'my_strtoupper';
ob_start($a);
diff --git a/tests/output/ob_start_error_001.phpt b/tests/output/ob_start_error_001.phpt
index 29288e2028..36efb124a7 100644
--- a/tests/output/ob_start_error_001.phpt
+++ b/tests/output/ob_start_error_001.phpt
@@ -8,7 +8,7 @@ Test wrong number of arguments and wrong arg types for ob_start()
*/
function justPrint($str) {
- return $str;
+ return $str;
}
$arg_1 = "justPrint";
@@ -16,38 +16,14 @@ $arg_2 = 0;
$arg_3 = false;
$extra_arg = 1;
-echo "\n- Too many arguments\n";
-var_dump(ob_start($arg_1, $arg_2, $arg_3, $extra_arg));
-
-echo "\n- Arg 1 wrong type\n";
+echo "\nArg 1 wrong type\n";
var_dump(ob_start(1.5));
-echo "\n- Arg 2 wrong type\n";
-var_dump(ob_start("justPrint", "this should be an int"));
-
-echo "\n- Arg 3 wrong type\n";
-var_dump(ob_start("justPrint", 0, "this should be a bool"));
-
?>
--EXPECTF--
-- Too many arguments
-
-Warning: ob_start() expects at most 3 parameters, 4 given in %s on line 17
-NULL
-
-- Arg 1 wrong type
+Arg 1 wrong type
-Warning: ob_start(): no array or string given in %s on line 20
+Warning: ob_start(): no array or string given in %s on line 17
-Notice: ob_start(): failed to create buffer in %s on line 20
+Notice: ob_start(): Failed to create buffer in %s on line 17
bool(false)
-
-- Arg 2 wrong type
-
-Warning: ob_start() expects parameter 2 to be int, string given in %s on line 23
-NULL
-
-- Arg 3 wrong type
-
-Warning: ob_start() expects parameter 3 to be int, string given in %s on line 26
-NULL
diff --git a/tests/output/ob_start_error_002.phpt b/tests/output/ob_start_error_002.phpt
index 7cac3ee4b3..447547182b 100644
--- a/tests/output/ob_start_error_002.phpt
+++ b/tests/output/ob_start_error_002.phpt
@@ -8,9 +8,9 @@ Test wrong number of arguments and wrong arg types for ob_start()
*/
Class C {
- static function f($str) {
- return $str;
- }
+ static function f($str) {
+ return $str;
+ }
}
var_dump(ob_start(array("nonExistent","f")));
@@ -22,21 +22,21 @@ echo "done"
--EXPECTF--
Warning: ob_start(): class 'nonExistent' not found in %s on line 13
-Notice: ob_start(): failed to create buffer in %s on line 13
+Notice: ob_start(): Failed to create buffer in %s on line 13
bool(false)
Warning: ob_start(): class 'C' does not have a method 'nonExistent' in %s on line 14
-Notice: ob_start(): failed to create buffer in %s on line 14
+Notice: ob_start(): Failed to create buffer in %s on line 14
bool(false)
Warning: ob_start(): class 'C' does not have a method 'no' in %s on line 15
-Notice: ob_start(): failed to create buffer in %s on line 15
+Notice: ob_start(): Failed to create buffer in %s on line 15
bool(false)
Warning: ob_start(): function 'no' not found or invalid function name in %s on line 16
-Notice: ob_start(): failed to create buffer in %s on line 16
+Notice: ob_start(): Failed to create buffer in %s on line 16
bool(false)
done
diff --git a/tests/output/ob_start_error_003.phpt b/tests/output/ob_start_error_003.phpt
index 3af56f7a2b..30b030daf7 100644
--- a/tests/output/ob_start_error_003.phpt
+++ b/tests/output/ob_start_error_003.phpt
@@ -17,6 +17,6 @@ echo "done"
--EXPECTF--
Warning: ob_start(): array must have exactly two members in %s on line %d
-Notice: ob_start(): failed to create buffer in %s on line 11
+Notice: ob_start(): Failed to create buffer in %s on line 11
bool(false)
done
diff --git a/tests/output/ob_start_error_004.phpt b/tests/output/ob_start_error_004.phpt
index 83f5dc8d1c..ecbb40e7fc 100644
--- a/tests/output/ob_start_error_004.phpt
+++ b/tests/output/ob_start_error_004.phpt
@@ -17,6 +17,6 @@ echo "done"
--EXPECTF--
Warning: ob_start(): class 'C' does not have a method 'f' in %s on line %d
-Notice: ob_start(): failed to create buffer in %s on line 11
+Notice: ob_start(): Failed to create buffer in %s on line 11
bool(false)
done
diff --git a/tests/output/ob_start_error_005.phpt b/tests/output/ob_start_error_005.phpt
index d6f9dc4c10..e11fc3ad89 100644
--- a/tests/output/ob_start_error_005.phpt
+++ b/tests/output/ob_start_error_005.phpt
@@ -9,10 +9,10 @@ ob_start(): ensure buffers can't be added from within callback.
*/
function f($str) {
- ob_start();
- echo "hello";
- ob_end_flush();
- return $str;
+ ob_start();
+ echo "hello";
+ ob_end_flush();
+ return $str;
}
diff --git a/tests/output/stream_isatty.inc b/tests/output/stream_isatty.inc
index 4b7f39986f..9700fd98f1 100644
--- a/tests/output/stream_isatty.inc
+++ b/tests/output/stream_isatty.inc
@@ -12,7 +12,6 @@ function testToStdOut()
'STDERR (constant)' => STDERR,
'STDERR (fopen)' => fopen('php://stderr', 'wb'),
'STDERR (php://fd/2)' => fopen('php://fd/2', 'wb'),
- 'Not a stream' => 'foo',
'Invalid stream (php://temp)' => fopen('php://temp', 'wb'),
'Invalid stream (php://input)' => fopen('php://input', 'wb'),
'Invalid stream (php://memory)' => fopen('php://memory', 'wb'),
diff --git a/tests/output/stream_isatty_err.phpt b/tests/output/stream_isatty_err.phpt
index 5513781a09..55a25f1c9f 100644
--- a/tests/output/stream_isatty_err.phpt
+++ b/tests/output/stream_isatty_err.phpt
@@ -23,9 +23,6 @@ STDOUT (php://fd/1): bool(true)
STDERR (constant): bool(false)
STDERR (fopen): bool(false)
STDERR (php://fd/2): bool(false)
-Not a stream:
-Warning: stream_isatty() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
Invalid stream (php://temp): bool(false)
Invalid stream (php://input): bool(false)
Invalid stream (php://memory): bool(false)
diff --git a/tests/output/stream_isatty_in-err.phpt b/tests/output/stream_isatty_in-err.phpt
index de2348a5b5..2554eb4689 100644
--- a/tests/output/stream_isatty_in-err.phpt
+++ b/tests/output/stream_isatty_in-err.phpt
@@ -23,9 +23,6 @@ STDOUT (php://fd/1): bool(true)
STDERR (constant): bool(false)
STDERR (fopen): bool(false)
STDERR (php://fd/2): bool(false)
-Not a stream:
-Warning: stream_isatty() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
Invalid stream (php://temp): bool(false)
Invalid stream (php://input): bool(false)
Invalid stream (php://memory): bool(false)
diff --git a/tests/output/stream_isatty_in-out-err.phpt b/tests/output/stream_isatty_in-out-err.phpt
index fea7bc64d7..496bdd100e 100644
--- a/tests/output/stream_isatty_in-out-err.phpt
+++ b/tests/output/stream_isatty_in-out-err.phpt
@@ -23,9 +23,6 @@ STDOUT (php://fd/1): bool(false)
STDERR (constant): bool(false)
STDERR (fopen): bool(false)
STDERR (php://fd/2): bool(false)
-Not a stream:
-Warning: stream_isatty() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
Invalid stream (php://temp): bool(false)
Invalid stream (php://input): bool(false)
Invalid stream (php://memory): bool(false)
diff --git a/tests/output/stream_isatty_in-out.phpt b/tests/output/stream_isatty_in-out.phpt
index 6ad7a03fc3..d58e9aa05c 100644
--- a/tests/output/stream_isatty_in-out.phpt
+++ b/tests/output/stream_isatty_in-out.phpt
@@ -23,9 +23,6 @@ STDOUT (php://fd/1): bool(false)
STDERR (constant): bool(true)
STDERR (fopen): bool(true)
STDERR (php://fd/2): bool(true)
-Not a stream:
-Warning: stream_isatty() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
Invalid stream (php://temp): bool(false)
Invalid stream (php://input): bool(false)
Invalid stream (php://memory): bool(false)
diff --git a/tests/output/stream_isatty_out-err.phpt b/tests/output/stream_isatty_out-err.phpt
index ae3af3a300..e3ec1237bc 100644
--- a/tests/output/stream_isatty_out-err.phpt
+++ b/tests/output/stream_isatty_out-err.phpt
@@ -23,9 +23,6 @@ STDOUT (php://fd/1): bool(false)
STDERR (constant): bool(false)
STDERR (fopen): bool(false)
STDERR (php://fd/2): bool(false)
-Not a stream:
-Warning: stream_isatty() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
Invalid stream (php://temp): bool(false)
Invalid stream (php://input): bool(false)
Invalid stream (php://memory): bool(false)
diff --git a/tests/output/stream_isatty_out.phpt b/tests/output/stream_isatty_out.phpt
index dc81577446..3ea4996ac4 100644
--- a/tests/output/stream_isatty_out.phpt
+++ b/tests/output/stream_isatty_out.phpt
@@ -23,9 +23,6 @@ STDOUT (php://fd/1): bool(false)
STDERR (constant): bool(true)
STDERR (fopen): bool(true)
STDERR (php://fd/2): bool(true)
-Not a stream:
-Warning: stream_isatty() expects parameter 1 to be resource, string given in %s on line %d
-bool(false)
Invalid stream (php://temp): bool(false)
Invalid stream (php://input): bool(false)
Invalid stream (php://memory): bool(false)
diff --git a/tests/quicktester.inc b/tests/quicktester.inc
index ba60e74a51..ba243beba0 100644
--- a/tests/quicktester.inc
+++ b/tests/quicktester.inc
@@ -20,55 +20,55 @@ $tests = explode("\n",$tests);
$success = TRUE;
foreach ($tests as $n=>$test)
{
- // ignore empty lines
- if (!$test) continue;
+ // ignore empty lines
+ if (!$test) continue;
- // warn for trailing ;
- if (substr(trim($test), -1, 1) === ';') {
- echo "WARNING: trailing ';' found in test ".($n+1)."\n";
- exit;
- }
+ // warn for trailing ;
+ if (substr(trim($test), -1, 1) === ';') {
+ echo "WARNING: trailing ';' found in test ".($n+1)."\n";
+ exit;
+ }
- // try for operators
- $operators = array('===', '~==');
- $operator = NULL;
- foreach ($operators as $a_operator) {
- if (strpos($test, $a_operator)!== FALSE) {
- $operator = $a_operator;
- list($left,$right) = explode($operator, $test);
- break;
- }
- }
- if (!$operator) {
- echo "WARNING: unknown operator in '$test' (1)\n";
- exit;
- }
+ // try for operators
+ $operators = array('===', '~==');
+ $operator = NULL;
+ foreach ($operators as $a_operator) {
+ if (strpos($test, $a_operator)!== FALSE) {
+ $operator = $a_operator;
+ list($left,$right) = explode($operator, $test);
+ break;
+ }
+ }
+ if (!$operator) {
+ echo "WARNING: unknown operator in '$test' (1)\n";
+ exit;
+ }
- $left = eval("return ($left );");
- $right = eval("return ($right);");
- switch (@$operator) {
- case '===': // exact match
- $result = $left === $right;
- break;
- case '~==': // may differ after 12th significant number
- if ( !is_float($left ) && !is_int($left )
- || !is_float($right) && !is_int($right)) {
- $result = FALSE;
- break;
- }
- $result = abs(($left-$right) / $left) < 1e-12;
- break;
- default:
- echo "WARNING: unknown operator in '$test' (2)\n";
- exit;
- }
+ $left = eval("return ($left );");
+ $right = eval("return ($right);");
+ switch (@$operator) {
+ case '===': // exact match
+ $result = $left === $right;
+ break;
+ case '~==': // may differ after 12th significant number
+ if ( !is_float($left ) && !is_int($left )
+ || !is_float($right) && !is_int($right)) {
+ $result = FALSE;
+ break;
+ }
+ $result = abs(($left-$right) / $left) < 1e-12;
+ break;
+ default:
+ echo "WARNING: unknown operator in '$test' (2)\n";
+ exit;
+ }
- $success = $success && $result;
- if (!$result) {
- echo "\nAssert failed:\n";
- echo "$test\n";
- echo "Left: ";var_dump($left );
- echo "Right: ";var_dump($right);
- }
+ $success = $success && $result;
+ if (!$result) {
+ echo "\nAssert failed:\n";
+ echo "$test\n";
+ echo "Left: ";var_dump($left );
+ echo "Right: ";var_dump($right);
+ }
}
if ($success) echo "OK";
diff --git a/tests/run-test/test005.phpt b/tests/run-test/test005.phpt
deleted file mode 100644
index a95281fc13..0000000000
--- a/tests/run-test/test005.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Error message handling (with ZendOpcache)
---SKIPIF--
-<?php
-extension_loaded("Zend Opcache") or die("skip Zend Opcache is not loaded");
-?>
---INI--
-track_errors=1
---FILE--
-<?php
-// If this test fails ask the developers of run-test.php
-//
-// We check the general ini settings which affect error handling
-// and than verify if a message is given by a division by zero.
-// EXPECTF is used here since the error format may change but ut
-// should always contain 'Division by zero'.
-var_dump(ini_get('display_errors'));
-var_dump(ini_get('error_reporting'));
-var_dump(ini_get('log_errors'));
-var_dump(ini_get('track_errors'));
-ini_set('display_errors', 0);
-var_dump(ini_get('display_errors'));
-var_dump($php_errormsg);
-$zero = 0;
-$error = 1 / $zero;
-var_dump($php_errormsg);
-?>
---EXPECTF--
-Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0
-string(1) "1"
-string(5) "32767"
-string(1) "0"
-string(1) "1"
-string(1) "0"
-NULL
-string(%d) "%sivision by zer%s"
diff --git a/tests/run-test/test008.phpt b/tests/run-test/test008.phpt
deleted file mode 100644
index c289e7a696..0000000000
--- a/tests/run-test/test008.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-Error message handling (without ZendOpcache)
---SKIPIF--
-<?php
-!extension_loaded("Zend Opcache") or die("skip Zend Opcache is loaded");
-?>
---INI--
-track_errors=1
---FILE--
-<?php
-// If this test fails ask the developers of run-test.php
-//
-// We check the general ini settings which affect error handling
-// and than verify if a message is given by a division by zero.
-// EXPECTF is used here since the error format may change but ut
-// should always contain 'Division by zero'.
-var_dump(ini_get('display_errors'));
-var_dump(ini_get('error_reporting'));
-var_dump(ini_get('log_errors'));
-var_dump(ini_get('track_errors'));
-ini_set('display_errors', "0");
-var_dump(ini_get('display_errors'));
-$error = 1 / 0;
-var_dump($php_errormsg);
-?>
---EXPECTF--
-Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0
-string(1) "1"
-string(5) "32767"
-string(1) "0"
-string(1) "1"
-string(1) "0"
-string(%d) "%sivision by zer%s"
diff --git a/tests/run-test/test008a.phpt b/tests/run-test/test008a.phpt
deleted file mode 100644
index d247eb36c2..0000000000
--- a/tests/run-test/test008a.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Error message handling (with ZendOpcache)
---SKIPIF--
-<?php
-if (!extension_loaded("Zend Opcache")) die("skip Zend Opcache is not loaded");
-?>
---INI--
-track_errors=1
---FILE--
-<?php
-// If this test fails ask the developers of run-test.php
-//
-// We check the general ini settings which affect error handling
-// and than verify if a message is given by a division by zero.
-// EXPECTF is used here since the error format may change but ut
-// should always contain 'Division by zero'.
-var_dump(ini_get('display_errors'));
-var_dump(ini_get('error_reporting'));
-var_dump(ini_get('log_errors'));
-var_dump(ini_get('track_errors'));
-ini_set('display_errors', 0);
-var_dump(ini_get('display_errors'));
-var_dump($php_errormsg);
-$zero = 0;
-$error = 1 / $zero;
-var_dump($php_errormsg);
-?>
---EXPECTF--
-Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0
-string(1) "1"
-string(5) "32767"
-string(1) "0"
-string(1) "1"
-string(1) "0"
-NULL
-string(%d) "%sivision by zer%s"
diff --git a/tests/security/open_basedir.inc b/tests/security/open_basedir.inc
index d30f2f8384..b97071bfbd 100644
--- a/tests/security/open_basedir.inc
+++ b/tests/security/open_basedir.inc
@@ -43,7 +43,7 @@ function recursive_delete_directory($directory) {
if (is_dir($path) == TRUE) {
recursive_delete_directory($path);
} else {
- @chmod($path, 0777);
+ @chmod($path, 0777);
unlink($path);
}
}
@@ -51,7 +51,7 @@ function recursive_delete_directory($directory) {
}
closedir($handle);
- @chmod($directory, 0777);
+ @chmod($directory, 0777);
rmdir($directory);
return TRUE;
diff --git a/tests/security/open_basedir_copy.phpt b/tests/security/open_basedir_copy.phpt
index 989570d640..82806b8fb8 100644
--- a/tests/security/open_basedir_copy.phpt
+++ b/tests/security/open_basedir_copy.phpt
@@ -35,42 +35,42 @@ bool(true)
Warning: copy(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
-Warning: copy(../bad): failed to open stream: %s in %s on line %d
+Warning: copy(../bad): Failed to open stream: %s in %s on line %d
bool(false)
Warning: copy(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
-Warning: copy(../bad/bad.txt): failed to open stream: %s in %s on line %d
+Warning: copy(../bad/bad.txt): Failed to open stream: %s in %s on line %d
bool(false)
Warning: copy(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
-Warning: copy(..): failed to open stream: %s in %s on line %d
+Warning: copy(..): Failed to open stream: %s in %s on line %d
bool(false)
Warning: copy(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
-Warning: copy(../): failed to open stream: %s in %s on line %d
+Warning: copy(../): Failed to open stream: %s in %s on line %d
bool(false)
Warning: copy(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
-Warning: copy(/): failed to open stream: %s in %s on line %d
+Warning: copy(/): Failed to open stream: %s in %s on line %d
bool(false)
Warning: copy(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
-Warning: copy(../bad/.): failed to open stream: %s in %s on line %d
+Warning: copy(../bad/.): Failed to open stream: %s in %s on line %d
bool(false)
Warning: copy(): open_basedir restriction in effect. File(../bad/./bad.txt) is not within the allowed path(s): (.) in %s on line %d
-Warning: copy(../bad/./bad.txt): failed to open stream: %s in %s on line %d
+Warning: copy(../bad/./bad.txt): Failed to open stream: %s in %s on line %d
bool(false)
Warning: copy(): open_basedir restriction in effect. File(./../.) is not within the allowed path(s): (.) in %s on line %d
-Warning: copy(./../.): failed to open stream: %s in %s on line %d
+Warning: copy(./../.): Failed to open stream: %s in %s on line %d
bool(false)
bool(true)
bool(true)
diff --git a/tests/security/open_basedir_dir.phpt b/tests/security/open_basedir_dir.phpt
index 90f55e5a95..10181c3efa 100644
--- a/tests/security/open_basedir_dir.phpt
+++ b/tests/security/open_basedir_dir.phpt
@@ -30,42 +30,42 @@ bool(true)
Warning: dir(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
-Warning: dir(../bad): failed to open dir: %s in %s on line %d
+Warning: dir(../bad): Failed to open directory: %s in %s on line %d
bool(false)
Warning: dir(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
-Warning: dir(../bad/bad.txt): failed to open dir: %s in %s on line %d
+Warning: dir(../bad/bad.txt): Failed to open directory: %s in %s on line %d
bool(false)
Warning: dir(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
-Warning: dir(..): failed to open dir: %s in %s on line %d
+Warning: dir(..): Failed to open directory: %s in %s on line %d
bool(false)
Warning: dir(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
-Warning: dir(../): failed to open dir: %s in %s on line %d
+Warning: dir(../): Failed to open directory: %s in %s on line %d
bool(false)
Warning: dir(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
-Warning: dir(/): failed to open dir: %s in %s on line %d
+Warning: dir(/): Failed to open directory: %s in %s on line %d
bool(false)
Warning: dir(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
-Warning: dir(../bad/.): failed to open dir: %s in %s on line %d
+Warning: dir(../bad/.): Failed to open directory: %s in %s on line %d
bool(false)
Warning: dir(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
-Warning: dir(%s/test/bad/bad.txt): failed to open dir: %s in %s on line %d
+Warning: dir(%s/test/bad/bad.txt): Failed to open directory: %s in %s on line %d
bool(false)
Warning: dir(): open_basedir restriction in effect. File(%s/test/bad/../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
-Warning: dir(%s/test/bad/../bad/bad.txt): failed to open dir: %s in %s on line %d
+Warning: dir(%s/test/bad/../bad/bad.txt): Failed to open directory: %s in %s on line %d
bool(false)
object(Directory)#%d (2) {
["path"]=>
diff --git a/tests/security/open_basedir_error_log_variation.phpt b/tests/security/open_basedir_error_log_variation.phpt
index e3cb15d258..4a7b14b004 100644
--- a/tests/security/open_basedir_error_log_variation.phpt
+++ b/tests/security/open_basedir_error_log_variation.phpt
@@ -32,17 +32,17 @@ bool(true)
Warning: error_log(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
-Warning: error_log(%s/test/bad/bad.txt): failed to open stream: %s in %s on line %d
+Warning: error_log(%s/test/bad/bad.txt): Failed to open stream: %s in %s on line %d
bool(false)
Warning: error_log(): open_basedir restriction in effect. File(%s/test/bad.txt) is not within the allowed path(s): (.) in %s on line %d
-Warning: error_log(%s/test/bad.txt): failed to open stream: %s in %s on line %d
+Warning: error_log(%s/test/bad.txt): Failed to open stream: %s in %s on line %d
bool(false)
Warning: error_log(): open_basedir restriction in effect. File(%s/bad.txt) is not within the allowed path(s): (.) in %s on line %d
-Warning: error_log(%s/bad.txt): failed to open stream: %s in %s on line %d
+Warning: error_log(%s/bad.txt): Failed to open stream: %s in %s on line %d
bool(false)
bool(true)
*** Finished testing open_basedir configuration [error_log] ***
diff --git a/tests/security/open_basedir_file.phpt b/tests/security/open_basedir_file.phpt
index 3382ae865d..e3d2a5d8a6 100644
--- a/tests/security/open_basedir_file.phpt
+++ b/tests/security/open_basedir_file.phpt
@@ -31,42 +31,42 @@ bool(true)
Warning: file(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
-Warning: file(../bad): failed to open stream: %s in %s on line %d
+Warning: file(../bad): Failed to open stream: %s in %s on line %d
bool(false)
Warning: file(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
-Warning: file(../bad/bad.txt): failed to open stream: %s in %s on line %d
+Warning: file(../bad/bad.txt): Failed to open stream: %s in %s on line %d
bool(false)
Warning: file(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
-Warning: file(..): failed to open stream: %s in %s on line %d
+Warning: file(..): Failed to open stream: %s in %s on line %d
bool(false)
Warning: file(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
-Warning: file(../): failed to open stream: %s in %s on line %d
+Warning: file(../): Failed to open stream: %s in %s on line %d
bool(false)
Warning: file(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
-Warning: file(/): failed to open stream: %s in %s on line %d
+Warning: file(/): Failed to open stream: %s in %s on line %d
bool(false)
Warning: file(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
-Warning: file(../bad/.): failed to open stream: %s in %s on line %d
+Warning: file(../bad/.): Failed to open stream: %s in %s on line %d
bool(false)
Warning: file(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
-Warning: file(%s/test/bad/bad.txt): failed to open stream: %s in %s on line %d
+Warning: file(%s/test/bad/bad.txt): Failed to open stream: %s in %s on line %d
bool(false)
Warning: file(): open_basedir restriction in effect. File(%s/test/bad/../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
-Warning: file(%s/test/bad/../bad/bad.txt): failed to open stream: %s in %s on line %d
+Warning: file(%s/test/bad/../bad/bad.txt): Failed to open stream: %s in %s on line %d
bool(false)
array(1) {
[0]=>
diff --git a/tests/security/open_basedir_file_get_contents.phpt b/tests/security/open_basedir_file_get_contents.phpt
index b5a34de074..91a3eb0980 100644
--- a/tests/security/open_basedir_file_get_contents.phpt
+++ b/tests/security/open_basedir_file_get_contents.phpt
@@ -31,42 +31,42 @@ bool(true)
Warning: file_get_contents(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
-Warning: file_get_contents(../bad): failed to open stream: %s in %s on line %d
+Warning: file_get_contents(../bad): Failed to open stream: %s in %s on line %d
bool(false)
Warning: file_get_contents(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
-Warning: file_get_contents(../bad/bad.txt): failed to open stream: %s in %s on line %d
+Warning: file_get_contents(../bad/bad.txt): Failed to open stream: %s in %s on line %d
bool(false)
Warning: file_get_contents(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
-Warning: file_get_contents(..): failed to open stream: %s in %s on line %d
+Warning: file_get_contents(..): Failed to open stream: %s in %s on line %d
bool(false)
Warning: file_get_contents(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
-Warning: file_get_contents(../): failed to open stream: %s in %s on line %d
+Warning: file_get_contents(../): Failed to open stream: %s in %s on line %d
bool(false)
Warning: file_get_contents(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
-Warning: file_get_contents(/): failed to open stream: %s in %s on line %d
+Warning: file_get_contents(/): Failed to open stream: %s in %s on line %d
bool(false)
Warning: file_get_contents(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
-Warning: file_get_contents(../bad/.): failed to open stream: %s in %s on line %d
+Warning: file_get_contents(../bad/.): Failed to open stream: %s in %s on line %d
bool(false)
Warning: file_get_contents(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
-Warning: file_get_contents(%s/test/bad/bad.txt): failed to open stream: %s in %s on line %d
+Warning: file_get_contents(%s/test/bad/bad.txt): Failed to open stream: %s in %s on line %d
bool(false)
Warning: file_get_contents(): open_basedir restriction in effect. File(%s/test/bad/../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
-Warning: file_get_contents(%s/test/bad/../bad/bad.txt): failed to open stream: %s in %s on line %d
+Warning: file_get_contents(%s/test/bad/../bad/bad.txt): Failed to open stream: %s in %s on line %d
bool(false)
string(12) "Hello World!"
string(12) "Hello World!"
diff --git a/tests/security/open_basedir_file_put_contents.phpt b/tests/security/open_basedir_file_put_contents.phpt
index 9f1f3bf13b..b7536d973a 100644
--- a/tests/security/open_basedir_file_put_contents.phpt
+++ b/tests/security/open_basedir_file_put_contents.phpt
@@ -31,26 +31,26 @@ bool(true)
Warning: file_put_contents(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
-Warning: file_put_contents(../bad/bad.txt): failed to open stream: %s in %s on line %d
+Warning: file_put_contents(../bad/bad.txt): Failed to open stream: %s in %s on line %d
bool(false)
Warning: file_put_contents(): open_basedir restriction in effect. File(.././bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
-Warning: file_put_contents(.././bad/bad.txt): failed to open stream: %s in %s on line %d
+Warning: file_put_contents(.././bad/bad.txt): Failed to open stream: %s in %s on line %d
bool(false)
Warning: file_put_contents(): open_basedir restriction in effect. File(../bad/../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
-Warning: file_put_contents(../bad/../bad/bad.txt): failed to open stream: %s in %s on line %d
+Warning: file_put_contents(../bad/../bad/bad.txt): Failed to open stream: %s in %s on line %d
bool(false)
Warning: file_put_contents(): open_basedir restriction in effect. File(./.././bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
-Warning: file_put_contents(./.././bad/bad.txt): failed to open stream: %s in %s on line %d
+Warning: file_put_contents(./.././bad/bad.txt): Failed to open stream: %s in %s on line %d
bool(false)
Warning: file_put_contents(): open_basedir restriction in effect. File%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
-Warning: file_put_contents%s/test/bad/bad.txt): failed to open stream: %s in %s on line %d
+Warning: file_put_contents%s/test/bad/bad.txt): Failed to open stream: %s in %s on line %d
bool(false)
*** Finished testing open_basedir configuration [file_put_contents] ***
diff --git a/tests/security/open_basedir_fopen.phpt b/tests/security/open_basedir_fopen.phpt
index e0fee66f0c..cd4a644edc 100644
--- a/tests/security/open_basedir_fopen.phpt
+++ b/tests/security/open_basedir_fopen.phpt
@@ -40,42 +40,42 @@ bool(true)
Warning: fopen(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
-Warning: fopen(../bad): failed to open stream: %s in %s on line %d
+Warning: fopen(../bad): Failed to open stream: %s in %s on line %d
bool(false)
Warning: fopen(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
-Warning: fopen(../bad/bad.txt): failed to open stream: %s in %s on line %d
+Warning: fopen(../bad/bad.txt): Failed to open stream: %s in %s on line %d
bool(false)
Warning: fopen(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
-Warning: fopen(..): failed to open stream: %s in %s on line %d
+Warning: fopen(..): Failed to open stream: %s in %s on line %d
bool(false)
Warning: fopen(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
-Warning: fopen(../): failed to open stream: %s in %s on line %d
+Warning: fopen(../): Failed to open stream: %s in %s on line %d
bool(false)
Warning: fopen(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
-Warning: fopen(/): failed to open stream: %s in %s on line %d
+Warning: fopen(/): Failed to open stream: %s in %s on line %d
bool(false)
Warning: fopen(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
-Warning: fopen(../bad/.): failed to open stream: %s in %s on line %d
+Warning: fopen(../bad/.): Failed to open stream: %s in %s on line %d
bool(false)
Warning: fopen(): open_basedir restriction in effect. File(../bad/./bad.txt) is not within the allowed path(s): (.) in %s on line %d
-Warning: fopen(../bad/./bad.txt): failed to open stream: %s in %s on line 12
+Warning: fopen(../bad/./bad.txt): Failed to open stream: %s in %s on line 12
bool(false)
Warning: fopen(): open_basedir restriction in effect. File(./../.) is not within the allowed path(s): (.) in %s on line %d
-Warning: fopen(./../.): failed to open stream: %s in %s on line %d
+Warning: fopen(./../.): Failed to open stream: %s in %s on line %d
bool(false)
resource(%d) of type (stream)
resource(%d) of type (stream)
diff --git a/tests/security/open_basedir_opendir.phpt b/tests/security/open_basedir_opendir.phpt
index 6b88e13080..caf5a71bec 100644
--- a/tests/security/open_basedir_opendir.phpt
+++ b/tests/security/open_basedir_opendir.phpt
@@ -29,42 +29,42 @@ bool(true)
Warning: opendir(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
-Warning: opendir(../bad): failed to open dir: %s in %s on line %d
+Warning: opendir(../bad): Failed to open directory: %s in %s on line %d
bool(false)
Warning: opendir(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
-Warning: opendir(../bad/bad.txt): failed to open dir: %s in %s on line %d
+Warning: opendir(../bad/bad.txt): Failed to open directory: %s in %s on line %d
bool(false)
Warning: opendir(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
-Warning: opendir(..): failed to open dir: %s in %s on line %d
+Warning: opendir(..): Failed to open directory: %s in %s on line %d
bool(false)
Warning: opendir(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
-Warning: opendir(../): failed to open dir: %s in %s on line %d
+Warning: opendir(../): Failed to open directory: %s in %s on line %d
bool(false)
Warning: opendir(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
-Warning: opendir(/): failed to open dir: %s in %s on line %d
+Warning: opendir(/): Failed to open directory: %s in %s on line %d
bool(false)
Warning: opendir(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
-Warning: opendir(../bad/.): failed to open dir: %s in %s on line %d
+Warning: opendir(../bad/.): Failed to open directory: %s in %s on line %d
bool(false)
Warning: opendir(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
-Warning: opendir(%s/test/bad/bad.txt): failed to open dir: %s in %s on line %d
+Warning: opendir(%s/test/bad/bad.txt): Failed to open directory: %s in %s on line %d
bool(false)
Warning: opendir(): open_basedir restriction in effect. File(%s/test/bad/../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
-Warning: opendir(%s/test/bad/../bad/bad.txt): failed to open dir: %s in %s on line %d
+Warning: opendir(%s/test/bad/../bad/bad.txt): Failed to open directory: %s in %s on line %d
bool(false)
resource(%d) of type (stream)
resource(%d) of type (stream)
diff --git a/tests/security/open_basedir_parse_ini_file.phpt b/tests/security/open_basedir_parse_ini_file.phpt
index 11db63fa50..7c9cbd8d12 100644
--- a/tests/security/open_basedir_parse_ini_file.phpt
+++ b/tests/security/open_basedir_parse_ini_file.phpt
@@ -39,36 +39,36 @@ bool(true)
Warning: parse_ini_file(): open_basedir restriction in effect. File(%stest\bad) is not within the allowed path(s): (.) in %sopen_basedir_parse_ini_file.php on line 6
-Warning: parse_ini_file(%stest\bad): failed to open stream: Operation not permitted in %sopen_basedir_parse_ini_file.php on line 6
+Warning: parse_ini_file(%stest\bad): Failed to open stream: Operation not permitted in %sopen_basedir_parse_ini_file.php on line 6
bool(false)
Warning: parse_ini_file(): open_basedir restriction in effect. File(%stest\bad\bad.txt) is not within the allowed path(s): (.) in %sopen_basedir_parse_ini_file.php on line 7
-Warning: parse_ini_file(%stest\bad\bad.txt): failed to open stream: Operation not permitted in %sopen_basedir_parse_ini_file.php on line 7
+Warning: parse_ini_file(%stest\bad\bad.txt): Failed to open stream: Operation not permitted in %sopen_basedir_parse_ini_file.php on line 7
bool(false)
Warning: parse_ini_file(): open_basedir restriction in effect. File(%stest) is not within the allowed path(s): (.) in %sopen_basedir_parse_ini_file.php on line 8
-Warning: parse_ini_file(%stest): failed to open stream: Operation not permitted in %sopen_basedir_parse_ini_file.php on line 8
+Warning: parse_ini_file(%stest): Failed to open stream: Operation not permitted in %sopen_basedir_parse_ini_file.php on line 8
bool(false)
Warning: parse_ini_file(): open_basedir restriction in effect. File(%stest) is not within the allowed path(s): (.) in %sopen_basedir_parse_ini_file.php on line 9
-Warning: parse_ini_file(%stest): failed to open stream: Operation not permitted in %sopen_basedir_parse_ini_file.php on line 9
+Warning: parse_ini_file(%stest): Failed to open stream: Operation not permitted in %sopen_basedir_parse_ini_file.php on line 9
bool(false)
Warning: parse_ini_file(): open_basedir restriction in effect. File(%stest\bad) is not within the allowed path(s): (.) in %sopen_basedir_parse_ini_file.php on line 10
-Warning: parse_ini_file(%stest\bad): failed to open stream: Operation not permitted in %sopen_basedir_parse_ini_file.php on line 10
+Warning: parse_ini_file(%stest\bad): Failed to open stream: Operation not permitted in %sopen_basedir_parse_ini_file.php on line 10
bool(false)
Warning: parse_ini_file(): open_basedir restriction in effect. File(%stest\bad\bad.txt) is not within the allowed path(s): (.) in %sopen_basedir_parse_ini_file.php on line 11
-Warning: parse_ini_file(%stest\bad\bad.txt): failed to open stream: Operation not permitted in %sopen_basedir_parse_ini_file.php on line 11
+Warning: parse_ini_file(%stest\bad\bad.txt): Failed to open stream: Operation not permitted in %sopen_basedir_parse_ini_file.php on line 11
bool(false)
Warning: parse_ini_file(): open_basedir restriction in effect. File(%stest) is not within the allowed path(s): (.) in %sopen_basedir_parse_ini_file.php on line 12
-Warning: parse_ini_file(%stest): failed to open stream: Operation not permitted in %sopen_basedir_parse_ini_file.php on line 12
+Warning: parse_ini_file(%stest): Failed to open stream: Operation not permitted in %sopen_basedir_parse_ini_file.php on line 12
bool(false)
*** Finished testing open_basedir configuration [parse_ini_file] ***
diff --git a/tests/security/open_basedir_scandir.phpt b/tests/security/open_basedir_scandir.phpt
index 46ea790610..0a629cb9e7 100644
--- a/tests/security/open_basedir_scandir.phpt
+++ b/tests/security/open_basedir_scandir.phpt
@@ -29,56 +29,56 @@ bool(true)
Warning: scandir(): open_basedir restriction in effect. File(../bad) is not within the allowed path(s): (.) in %s on line %d
-Warning: scandir(../bad): failed to open dir: %s in %s on line %d
+Warning: scandir(../bad): Failed to open directory: %s in %s on line %d
Warning: scandir(): (errno 1): %s in %s on line %d
bool(false)
Warning: scandir(): open_basedir restriction in effect. File(../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
-Warning: scandir(../bad/bad.txt): failed to open dir: %s in %s on line %d
+Warning: scandir(../bad/bad.txt): Failed to open directory: %s in %s on line %d
Warning: scandir(): (errno 1): %s in %s on line %d
bool(false)
Warning: scandir(): open_basedir restriction in effect. File(..) is not within the allowed path(s): (.) in %s on line %d
-Warning: scandir(..): failed to open dir: %s in %s on line %d
+Warning: scandir(..): Failed to open directory: %s in %s on line %d
Warning: scandir(): (errno 1): %s in %s on line %d
bool(false)
Warning: scandir(): open_basedir restriction in effect. File(../) is not within the allowed path(s): (.) in %s on line %d
-Warning: scandir(../): failed to open dir: %s in %s on line %d
+Warning: scandir(../): Failed to open directory: %s in %s on line %d
Warning: scandir(): (errno 1): %s in %s on line %d
bool(false)
Warning: scandir(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (.) in %s on line %d
-Warning: scandir(/): failed to open dir: %s in %s on line %d
+Warning: scandir(/): Failed to open directory: %s in %s on line %d
Warning: scandir(): (errno 1): %s in %s on line %d
bool(false)
Warning: scandir(): open_basedir restriction in effect. File(../bad/.) is not within the allowed path(s): (.) in %s on line %d
-Warning: scandir(../bad/.): failed to open dir: %s in %s on line %d
+Warning: scandir(../bad/.): Failed to open directory: %s in %s on line %d
Warning: scandir(): (errno 1): %s in %s on line %d
bool(false)
Warning: scandir(): open_basedir restriction in effect. File(%s/test/bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
-Warning: scandir(%s/test/bad/bad.txt): failed to open dir: %s in %s on line %d
+Warning: scandir(%s/test/bad/bad.txt): Failed to open directory: %s in %s on line %d
Warning: scandir(): (errno 1): %s in %s on line %d
bool(false)
Warning: scandir(): open_basedir restriction in effect. File(%s/test/bad/../bad/bad.txt) is not within the allowed path(s): (.) in %s on line %d
-Warning: scandir(%s/test/bad/../bad/bad.txt): failed to open dir: %s in %s on line %d
+Warning: scandir(%s/test/bad/../bad/bad.txt): Failed to open directory: %s in %s on line %d
Warning: scandir(): (errno 1): %s in %s on line %d
bool(false)
diff --git a/tests/strings/001.phpt b/tests/strings/001.phpt
index bf1fb67711..0f1f749459 100644
--- a/tests/strings/001.phpt
+++ b/tests/strings/001.phpt
@@ -3,8 +3,6 @@ String functions
--FILE--
<?php
-error_reporting(0);
-
echo "Testing strtok: ";
$str = "testing 1/2\\3";
@@ -13,58 +11,58 @@ $tok2 = strtok("/");
$tok3 = strtok("\\");
$tok4 = strtok(".");
if ($tok1 != "testing") {
- echo("failed 1\n");
+ echo("failed 1\n");
} elseif ($tok2 != "1") {
- echo("failed 2\n");
+ echo("failed 2\n");
} elseif ($tok3 != "2") {
- echo("failed 3\n");
+ echo("failed 3\n");
} elseif ($tok4 != "3") {
- echo("failed 4\n");
+ echo("failed 4\n");
} else {
- echo("passed\n");
+ echo("passed\n");
}
echo "Testing strstr: ";
$test = "This is a test";
-$found1 = strstr($test, 32);
+$found1 = strstr($test, chr(32));
$found2 = strstr($test, "a ");
if ($found1 != " is a test") {
- echo("failed 1\n");
+ echo("failed 1\n");
} elseif ($found2 != "a test") {
- echo("failed 2\n");
+ echo("failed 2\n");
} else {
- echo("passed\n");
+ echo("passed\n");
}
echo "Testing strrchr: ";
$test = "fola fola blakken";
$found1 = strrchr($test, "b");
-$found2 = strrchr($test, 102);
+$found2 = strrchr($test, chr(102));
if ($found1 != "blakken") {
- echo("failed 1\n");
+ echo("failed 1\n");
} elseif ($found2 != "fola blakken") {
- echo("failed 2\n");
+ echo("failed 2\n");
}
else {
- echo("passed\n");
+ echo("passed\n");
}
echo "Testing strtoupper: ";
$test = "abCdEfg";
$upper = strtoupper($test);
if ($upper == "ABCDEFG") {
- echo("passed\n");
+ echo("passed\n");
} else {
- echo("failed!\n");
+ echo("failed!\n");
}
echo "Testing strtolower: ";
$test = "ABcDeFG";
$lower = strtolower($test);
if ($lower == "abcdefg") {
- echo("passed\n");
+ echo("passed\n");
} else {
- echo("failed!\n");
+ echo("failed!\n");
}
echo "Testing substr: ";
@@ -81,9 +79,9 @@ $tests++; if (substr($string, -1, -2) == "") { $ok++; }
$tests++; if (substr($string, -3, -2) == "3") { $ok++; }
if ($tests == $ok) {
- echo("passed\n");
+ echo("passed\n");
} else {
- echo("failed!\n");
+ echo("failed!\n");
}
$raw = ' !"#$%&\'()*+,-./0123456789:;<=>?'
@@ -98,17 +96,17 @@ $correct = '%20%21%22%23%24%25%26%27%28%29%2A%2B%2C-.%2F0123456789%3A%3B%3C%3D%3
. '%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D~'
. '%00';
if ($encoded == $correct) {
- echo("passed\n");
+ echo("passed\n");
} else {
- echo("failed!\n");
+ echo("failed!\n");
}
echo "Testing rawurldecode: ";
$decoded = rawurldecode($correct);
if ($decoded == $raw) {
- echo("passed\n");
+ echo("passed\n");
} else {
- echo("failed!\n");
+ echo("failed!\n");
}
echo "Testing urlencode: ";
@@ -118,62 +116,62 @@ $correct = '+%21%22%23%24%25%26%27%28%29%2A%2B%2C-.%2F0123456789%3A%3B%3C%3D%3E%
. '%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D%7E'
. '%00';
if ($encoded == $correct) {
- echo("passed\n");
+ echo("passed\n");
} else {
- echo("failed!\n");
+ echo("failed!\n");
}
echo "Testing urldecode: ";
$decoded = urldecode($correct);
if ($decoded == $raw) {
- echo("passed\n");
+ echo("passed\n");
} else {
- echo("failed!\n");
+ echo("failed!\n");
}
echo "Testing quotemeta: ";
$raw = "a.\\+*?" . chr(91) . "^" . chr(93) . "b\$c";
$quoted = quotemeta($raw);
if ($quoted == "a\\.\\\\\\+\\*\\?\\[\\^\\]b\\\$c") {
- echo("passed\n");
+ echo("passed\n");
} else {
- echo("failed!\n");
+ echo("failed!\n");
}
echo "Testing ufirst: ";
$str = "fahrvergnuegen";
$uc = ucfirst($str);
if ($uc == "Fahrvergnuegen") {
- echo("passed\n");
+ echo("passed\n");
} else {
- echo("failed!\n");
+ echo("failed!\n");
}
echo "Testing strtr: ";
$str = "test abcdefgh";
$tr = strtr($str, "def", "456");
if ($tr == "t5st abc456gh") {
- echo("passed\n");
+ echo("passed\n");
} else {
- echo("failed!\n");
+ echo("failed!\n");
}
echo "Testing addslashes: ";
$str = "\"\\'";
$as = addslashes($str);
if ($as == "\\\"\\\\\\'") {
- echo("passed\n");
+ echo("passed\n");
} else {
- echo("failed!\n");
+ echo("failed!\n");
}
echo "Testing stripslashes: ";
$str = "\$\\'";
$ss = stripslashes($str);
if ($ss == "\$'") {
- echo("passed\n");
+ echo("passed\n");
} else {
- echo("failed!\n");
+ echo("failed!\n");
}
@@ -185,9 +183,9 @@ $ui2 = uniqid($str, true);
$len = 29;
if (strlen($ui1) == strlen($ui2) && strlen($ui1) == $len && $ui1 != $ui2) {
- echo("passed\n");
+ echo("passed\n");
} else {
- echo("failed!\n");
+ echo("failed!\n");
}
echo "Testing uniqid(false): ";
@@ -199,9 +197,9 @@ $ui2 = uniqid($str);
$len = strncasecmp(PHP_OS, 'CYGWIN', 6) ? 19 : 29;
if (strlen($ui1) == strlen($ui2) && strlen($ui1) == $len && $ui1 != $ui2) {
- echo("passed\n");
+ echo("passed\n");
} else {
- echo("failed!\n");
+ echo("failed!\n");
}
?>
diff --git a/tests/strings/002.phpt b/tests/strings/002.phpt
index 5e82091088..a43a68c88b 100644
--- a/tests/strings/002.phpt
+++ b/tests/strings/002.phpt
@@ -2,7 +2,6 @@
Formatted print functions
--FILE--
<?php
-error_reporting(0);
$fp = fopen("php://stdout", "w") or die("Arrggsgg!!");
$x = fprintf($fp, "fprintf test 1:%.5s", "abcdefghij");
@@ -40,7 +39,11 @@ printf("printf test 26:%2\$d %1\$d\n", 1, 2);
printf("printf test 27:%3\$d %d %d\n", 1, 2, 3);
printf("printf test 28:%2\$02d %1\$2d\n", 1, 2);
printf("printf test 29:%2\$-2d %1\$2d\n", 1, 2);
-print("printf test 30:"); printf("%0\$s", 1); print("x\n");
+try {
+ print("printf test 30:"); printf("%0\$s", 1); print("x\n");
+} catch(\ValueError $e) {
+ print('Error found: '.$e->getMessage()."\n");
+}
vprintf("vprintf test 1:%2\$-2d %1\$2d\n", array(1, 2));
@@ -79,5 +82,5 @@ printf test 26:2 1
printf test 27:3 1 2
printf test 28:02 1
printf test 29:2 1
-printf test 30:x
+printf test 30:Error found: Argument number must be greater than zero
vprintf test 1:2 1
diff --git a/tests/strings/bug26703.phpt b/tests/strings/bug26703.phpt
index bea8fb1214..4e48845fdf 100644
--- a/tests/strings/bug26703.phpt
+++ b/tests/strings/bug26703.phpt
@@ -8,7 +8,7 @@ highlight.default=#0000BB
highlight.html=#000000
--FILE--
<?php
- highlight_string('<?php echo "foo[] $a \n"; ?>');
+ highlight_string('<?php echo "foo[] $a \n"; ?>');
?>
--EXPECT--
<code><span style="color: #000000">
diff --git a/tests/strings/offsets_chaining_1.phpt b/tests/strings/offsets_chaining_1.phpt
index 0c3c0074b1..18b6fa2f9d 100644
--- a/tests/strings/offsets_chaining_1.phpt
+++ b/tests/strings/offsets_chaining_1.phpt
@@ -1,7 +1,5 @@
--TEST--
testing the behavior of string offset chaining
---INI--
-error_reporting=E_ALL | E_DEPRECATED
--FILE--
<?php
$string = "foobar";
diff --git a/tests/strings/offsets_chaining_2.phpt b/tests/strings/offsets_chaining_2.phpt
index 0c3c0074b1..18b6fa2f9d 100644
--- a/tests/strings/offsets_chaining_2.phpt
+++ b/tests/strings/offsets_chaining_2.phpt
@@ -1,7 +1,5 @@
--TEST--
testing the behavior of string offset chaining
---INI--
-error_reporting=E_ALL | E_DEPRECATED
--FILE--
<?php
$string = "foobar";
diff --git a/tests/strings/offsets_chaining_3.phpt b/tests/strings/offsets_chaining_3.phpt
index fc11b8d797..12cac5917f 100644
--- a/tests/strings/offsets_chaining_3.phpt
+++ b/tests/strings/offsets_chaining_3.phpt
@@ -1,7 +1,5 @@
--TEST--
testing the behavior of string offset chaining
---INI--
-error_reporting=E_ALL | E_DEPRECATED
--FILE--
<?php
$string = "foobar";
diff --git a/tests/strings/offsets_chaining_4.phpt b/tests/strings/offsets_chaining_4.phpt
index fc11b8d797..12cac5917f 100644
--- a/tests/strings/offsets_chaining_4.phpt
+++ b/tests/strings/offsets_chaining_4.phpt
@@ -1,7 +1,5 @@
--TEST--
testing the behavior of string offset chaining
---INI--
-error_reporting=E_ALL | E_DEPRECATED
--FILE--
<?php
$string = "foobar";
diff --git a/tests/strings/offsets_chaining_5.phpt b/tests/strings/offsets_chaining_5.phpt
index efcf2f3074..1c9da47af3 100644
--- a/tests/strings/offsets_chaining_5.phpt
+++ b/tests/strings/offsets_chaining_5.phpt
@@ -1,7 +1,5 @@
--TEST--
testing the behavior of string offset chaining
---INI--
-error_reporting=E_ALL | E_DEPRECATED
--FILE--
<?php
$array = array('expected_array' => "foobar");
diff --git a/travis/compile.sh b/travis/compile.sh
index d14309a0dd..a3d3e62578 100755
--- a/travis/compile.sh
+++ b/travis/compile.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-if [[ "$ENABLE_MAINTAINER_ZTS" == 1 ]]; then
- TS="--enable-maintainer-zts";
+if [[ "$ENABLE_ZTS" == 1 ]]; then
+ TS="--enable-zts";
else
TS="";
fi
diff --git a/win32/build/Makefile b/win32/build/Makefile
index 9435df5c46..d0315f41c4 100644
--- a/win32/build/Makefile
+++ b/win32/build/Makefile
@@ -1,6 +1,4 @@
# +----------------------------------------------------------------------+
-# | PHP Version 7 |
-# +----------------------------------------------------------------------+
# | Copyright (c) The PHP Group |
# +----------------------------------------------------------------------+
# | This source file is subject to version 3.01 of the PHP license, |
@@ -77,16 +75,16 @@ $(BUILD_DIR)\$(PHPDLL).def: $(PHP_DLL_DEF_SOURCES)
type $(PHP_DLL_DEF_SOURCES) > $(BUILD_DIR)\$(PHPDLL).def
Zend\zend_ini_parser.c Zend\zend_ini_parser.h: Zend\zend_ini_parser.y
- $(BISON) --output=Zend/zend_ini_parser.c -v -d -p ini_ Zend/zend_ini_parser.y
+ $(BISON) --output=Zend/zend_ini_parser.c -v -d Zend/zend_ini_parser.y
Zend\zend_language_parser.c Zend\zend_language_parser.h: Zend\zend_language_parser.y
- $(BISON) --output=Zend/zend_language_parser.c -v -d -p zend Zend/zend_language_parser.y
+ $(BISON) --output=Zend/zend_language_parser.c -v -d Zend/zend_language_parser.y
@if "$(SED)" neq "" $(SED) -i "s,^int zendparse\(.*\),ZEND_API int zendparse\1,g" Zend/zend_language_parser.c
@if "$(SED)" neq "" $(SED) -i "s,^int zendparse\(.*\),ZEND_API int zendparse\1,g" Zend/zend_language_parser.h
@if "$(SED)" neq "" $(SED) -i "s,^#ifndef YYTOKENTYPE,#include \"zend.h\"\n#ifndef YYTOKENTYPE,g" Zend/zend_language_parser.h
sapi\phpdbg\phpdbg_parser.c sapi\phpdbg\phpdbg_parser.h: sapi\phpdbg\phpdbg_parser.y
- $(BISON) --output=sapi/phpdbg/phpdbg_parser.c -v -d -p phpdbg_ sapi/phpdbg/phpdbg_parser.y
+ $(BISON) --output=sapi/phpdbg/phpdbg_parser.c -v -d sapi/phpdbg/phpdbg_parser.y
!if $(RE2C) != ""
Zend\zend_ini_scanner.c: Zend\zend_ini_scanner.l
diff --git a/win32/build/buildconf.js b/win32/build/buildconf.js
index 5a45e481fc..a758c65d40 100644
--- a/win32/build/buildconf.js
+++ b/win32/build/buildconf.js
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/win32/build/config.w32.h.in b/win32/build/config.w32.h.in
index 864bc882ff..7cd6392078 100644
--- a/win32/build/config.w32.h.in
+++ b/win32/build/config.w32.h.in
@@ -44,7 +44,6 @@
/* its in win32/time.c */
#define HAVE_USLEEP 1
#define HAVE_NANOSLEEP 1
-#define PHP_SLEEP_NON_VOID 1
#define HAVE_GETCWD 1
#define NEED_ISBLANK 1
@@ -67,7 +66,6 @@
#define HAVE_GETLOGIN 1
#define HAVE_MEMMOVE 1
#define HAVE_REGCOMP 1
-#define HAVE_LOCALE_H 1
#define HAVE_SHUTDOWN 1
#define HAVE_STRCASECMP 1
#define HAVE_UTIME 1
@@ -120,10 +118,6 @@
#define HAVE_MBLEN
-#undef HAVE_ATOF_ACCEPTS_NAN
-#undef HAVE_ATOF_ACCEPTS_INF
-#define HAVE_HUGE_VAL_NAN 0
-
/* vs.net 2005 has a 64-bit time_t. This will likely break
* 3rdParty libs that were built with older compilers; switch
* back to 32-bit */
@@ -135,8 +129,6 @@
#define HAVE_MBRLEN 1
#define HAVE_MBSTATE_T 1
-#define HAVE_HUGE_VAL_INF 1
-
#define HAVE_GETRUSAGE
#define HAVE_FTOK 1
diff --git a/win32/build/confutils.js b/win32/build/confutils.js
index 2fe2039afe..9166cdeab6 100644
--- a/win32/build/confutils.js
+++ b/win32/build/confutils.js
@@ -1,8 +1,6 @@
// Utils for configure script
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -95,11 +93,11 @@ if (typeof(CWD) == "undefined") {
}
/* defaults; we pick up the precise versions from configure.ac */
-var PHP_VERSION = 7;
-var PHP_MINOR_VERSION = 4;
+var PHP_VERSION = 8;
+var PHP_MINOR_VERSION = 0;
var PHP_RELEASE_VERSION = 0;
var PHP_EXTRA_VERSION = "";
-var PHP_VERSION_STRING = "7.4.0";
+var PHP_VERSION_STRING = "8.0.0";
/* Get version numbers and DEFINE as a string */
function get_version_numbers()
@@ -444,7 +442,8 @@ can be built that way. \
'pcre-regex', 'fastcgi', 'force-cgi-redirect',
'path-info-check', 'zts', 'ipv6', 'memory-limit',
'zend-multibyte', 'fd-setsize', 'memory-manager',
- 'pgi', 'pgo', 'all-shared', 'config-profile'
+ 'pgi', 'pgo', 'all-shared', 'config-profile',
+ 'sanitizer'
);
var force;
@@ -2302,19 +2301,6 @@ function generate_config_h()
outfile.WriteLine("#define " + keys[i] + " " + pieces);
}
- if (VS_TOOLSET) {
- if (VCVERS >= 1800) {
- outfile.WriteLine("");
- outfile.WriteLine("#define HAVE_ACOSH 1");
- outfile.WriteLine("#define HAVE_ASINH 1");
- outfile.WriteLine("#define HAVE_ATANH 1");
- }
- if (VCVERS >= 1900) {
- outfile.WriteLine("#define HAVE_LOG1P 1");
- }
- }
-
-
outfile.Close();
}
@@ -2341,7 +2327,7 @@ function generate_phpize()
MF.WriteLine("var PHP_MINOR_VERSION=" + PHP_MINOR_VERSION);
MF.WriteLine("var PHP_RELEASE_VERSION=" + PHP_RELEASE_VERSION);
MF.WriteBlankLines(1);
- MF.WriteLine("/* Genereted extensions list with mode (static/shared) */");
+ MF.WriteLine("/* Generated extensions list with mode (static/shared) */");
var count = extensions_enabled.length;
for (i in extensions_enabled) {
@@ -2352,7 +2338,7 @@ function generate_phpize()
}
MF.WriteBlankLines(2);
- MF.WriteLine("/* Genereted win32/build/phpize.js.in */");
+ MF.WriteLine("/* Generated win32/build/phpize.js.in */");
MF.WriteBlankLines(1);
MF.Write(file_get_contents("win32/build/phpize.js.in"));
MF.Close();
@@ -2436,7 +2422,7 @@ function handle_analyzer_makefile_flags(fd, key, val)
{
var relevant = false;
- /* VS integrates /analyze with the bulid process,
+ /* VS integrates /analyze with the build process,
no further action is required. */
if ("no" == PHP_ANALYZER || "vs" == PHP_ANALYZER) {
return;
@@ -3102,8 +3088,8 @@ function toolset_get_compiler_name(short)
return name;
} if (version >= 1920) {
/* NOTE - VS is intentional. Due to changes in recent Visual Studio
- versioning scheme refering to the exact VC++ version is
- hardly predictable. From this version on, it refers to
+ versioning scheme referring to the exact VC++ version is
+ hardly predictable. From this version on, it refers to
Visual Studio version and implies the default toolset.
When new versions are introduced, adapt also checks in
php_win32_image_compatible(), if needed. */
@@ -3669,7 +3655,7 @@ function get_clang_lib_dir()
if (COMPILER_NAME_LONG.match(/clang version ([\d\.]+) \((.*)\)/)) {
ver = RegExp.$1;
} else {
- ERROR("Faled to determine clang lib path");
+ ERROR("Failed to determine clang lib path");
}
if (X64) {
@@ -3702,7 +3688,7 @@ function add_asan_opts(cflags_name, libs_name, ldflags_name)
if (COMPILER_NAME_LONG.match(/clang version ([\d\.]+) \((.*)\)/)) {
ver = RegExp.$1;
} else {
- ERROR("Faled to determine clang lib path");
+ ERROR("Failed to determine clang lib path");
}
if (!!cflags_name) {
diff --git a/win32/build/deplister.c b/win32/build/deplister.c
index b5dd059c98..f211f8add9 100644
--- a/win32/build/deplister.c
+++ b/win32/build/deplister.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/win32/build/mkdist.php b/win32/build/mkdist.php
index d5fb9d1e7b..be8b7a5642 100644
--- a/win32/build/mkdist.php
+++ b/win32/build/mkdist.php
@@ -284,7 +284,7 @@ Build: $build_dir
EOT
);
-/* list build-in extensions */
+/* list built-in extensions */
$exts = get_loaded_extensions();
fprintf($fp, "\r\nBuilt-in Extensions\r\n");
fwrite($fp, "===========================\r\n");
@@ -496,7 +496,7 @@ $dirs = array(
foreach ($dirs as $dir) {
copy_test_dir($dir, $test_dir);
}
-copy('run-tests.php', $test_dir . '/run-test.php');
+copy('run-tests.php', $test_dir . '/run-tests.php');
/* change this next line to true to use good-old
* hand-assembled go-pear-bundle from the snapshot template */
diff --git a/win32/build/phpize.js.in b/win32/build/phpize.js.in
index 5a4a973e19..d12820403e 100644
--- a/win32/build/phpize.js.in
+++ b/win32/build/phpize.js.in
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/win32/codepage.c b/win32/codepage.c
index 0543a057a5..0f90c534b8 100644
--- a/win32/codepage.c
+++ b/win32/codepage.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -179,16 +177,12 @@ PW32CP wchar_t *php_win32_cp_conv_ascii_to_w(const char* in, size_t in_len, size
while (end - idx > 15) {
const __m128i block = _mm_load_si128((__m128i *)idx);
- {
- const __m128i lo = _mm_unpacklo_epi8(block, mask);
- _mm_storeu_si128((__m128i *)ret_idx, lo);
- }
+ const __m128i lo = _mm_unpacklo_epi8(block, mask);
+ _mm_storeu_si128((__m128i *)ret_idx, lo);
ret_idx += 8;
- {
- const __m128i hi = _mm_unpackhi_epi8(block, mask);
- _mm_storeu_si128((__m128i *)ret_idx, hi);
- }
+ const __m128i hi = _mm_unpackhi_epi8(block, mask);
+ _mm_storeu_si128((__m128i *)ret_idx, hi);
idx += 16;
ret_idx += 8;
@@ -569,7 +563,7 @@ PHP_FUNCTION(sapi_windows_cp_set)
const struct php_win32_cp *cp;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &id) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (ZEND_LONG_UINT_OVFL(id)) {
@@ -599,7 +593,7 @@ PHP_FUNCTION(sapi_windows_cp_get)
size_t kind_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &kind, &kind_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (kind_len == sizeof("ansi")-1 && !strncasecmp(kind, "ansi", kind_len)) {
@@ -619,7 +613,7 @@ PHP_FUNCTION(sapi_windows_cp_get)
PHP_FUNCTION(sapi_windows_cp_is_utf8)
{
if (zend_parse_parameters_none() == FAILURE) {
- return;
+ RETURN_THROWS();
}
RETURN_BOOL(php_win32_cp_use_unicode());
@@ -637,7 +631,7 @@ PHP_FUNCTION(sapi_windows_cp_conv)
zval *z_in_cp, *z_out_cp;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zzs", &z_in_cp, &z_out_cp, &subj, &subj_len) == FAILURE) {
- return;
+ RETURN_THROWS();
}
if (ZEND_SIZE_T_INT_OVFL(subj_len)) {
diff --git a/win32/codepage.h b/win32/codepage.h
index 0dd72562b6..8f8fbcbaa1 100644
--- a/win32/codepage.h
+++ b/win32/codepage.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/win32/console.c b/win32/console.c
index 0b1bb0eff9..7833dd97d3 100644
--- a/win32/console.c
+++ b/win32/console.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/win32/console.h b/win32/console.h
index 2d36d85508..47336a0a7b 100644
--- a/win32/console.h
+++ b/win32/console.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/win32/dllmain.c b/win32/dllmain.c
index 4743f732e9..7850a79699 100644
--- a/win32/dllmain.c
+++ b/win32/dllmain.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/win32/ftok.c b/win32/ftok.c
index db789f8b70..3e379e82ef 100644
--- a/win32/ftok.c
+++ b/win32/ftok.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/win32/getrusage.c b/win32/getrusage.c
index de67f7f8d2..c956613c69 100644
--- a/win32/getrusage.c
+++ b/win32/getrusage.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/win32/getrusage.h b/win32/getrusage.h
index c41c026aa2..c5a95c436b 100644
--- a/win32/getrusage.h
+++ b/win32/getrusage.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/win32/globals.c b/win32/globals.c
index 9bb392f42a..e9ba61761a 100644
--- a/win32/globals.c
+++ b/win32/globals.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/win32/grp.h b/win32/grp.h
index 301babed4e..f8cc8fe206 100644
--- a/win32/grp.h
+++ b/win32/grp.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/win32/inet.c b/win32/inet.c
index 7361b89bc2..4a835ca7a3 100644
--- a/win32/inet.c
+++ b/win32/inet.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/win32/inet.h b/win32/inet.h
index b57d78903d..06b646bd57 100644
--- a/win32/inet.h
+++ b/win32/inet.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/win32/ioutil.c b/win32/ioutil.c
index 48e65d918f..8cd704c662 100644
--- a/win32/ioutil.c
+++ b/win32/ioutil.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/win32/ioutil.h b/win32/ioutil.h
index 93dea15967..1c2f1a213e 100644
--- a/win32/ioutil.h
+++ b/win32/ioutil.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/win32/ipc.h b/win32/ipc.h
index c7cb476353..bbefb48703 100644
--- a/win32/ipc.h
+++ b/win32/ipc.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/win32/nice.c b/win32/nice.c
index 05aae465ed..4b2d388362 100644
--- a/win32/nice.c
+++ b/win32/nice.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -56,7 +54,7 @@
* . PROCESS_MODE_BACKGROUND_BEGIN
* . PROCESS_MODE_BACKGROUND_END
* Process mode is not covered because it can easily forgotten to be changed
- * back and can cause unforseen side effects that is hard to debug. Besides
+ * back and can cause unforeseen side effects that is hard to debug. Besides
* that, these do generally not really fit into making a Windows somewhat
* compatible nice() function.
*/
diff --git a/win32/nice.h b/win32/nice.h
index 385855c2ea..dc082035d9 100644
--- a/win32/nice.h
+++ b/win32/nice.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/win32/php_registry.h b/win32/php_registry.h
index f46c482085..9effd01d4e 100644
--- a/win32/php_registry.h
+++ b/win32/php_registry.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/win32/php_win32_globals.h b/win32/php_win32_globals.h
index bb91f08c50..05da08104b 100644
--- a/win32/php_win32_globals.h
+++ b/win32/php_win32_globals.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/win32/registry.c b/win32/registry.c
index 99c3ce365f..09d9c98868 100644
--- a/win32/registry.c
+++ b/win32/registry.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/win32/select.c b/win32/select.c
index b02766e4f3..865c3e44b9 100644
--- a/win32/select.c
+++ b/win32/select.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/win32/select.h b/win32/select.h
index c23eb87ddb..f6f9af99c1 100644
--- a/win32/select.h
+++ b/win32/select.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/win32/sendmail.c b/win32/sendmail.c
index 9e31028d58..281c343533 100644
--- a/win32/sendmail.c
+++ b/win32/sendmail.c
@@ -1,7 +1,7 @@
/*
* PHP Sendmail for Windows.
*
- * This file is rewritten specificly for PHPFI. Some functionality
+ * This file is rewritten specifically for PHPFI. Some functionality
* has been removed (MIME and file attachments). This code was
* modified from code based on code written by Jarle Aase.
*
@@ -91,7 +91,7 @@ static char *ErrorMessages[] =
};
/* This pattern converts all single occurrences of \n (Unix)
- * withour a leading \r to \r\n and all occurrences of \r (Mac)
+ * without a leading \r to \r\n and all occurrences of \r (Mac)
* without a trailing \n to \r\n
* Thx to Nibbler from ircnet/#linuxger
*/
@@ -114,7 +114,7 @@ static char *ErrorMessages[] =
/* This function is meant to unify the headers passed to to mail()
* This means, use PCRE to transform single occurrences of \n or \r in \r\n
- * As a second step we also eleminate all \r\n occurrences which are:
+ * As a second step we also eliminate all \r\n occurrences which are:
* 1) At the start of the header
* 2) At the end of the header
* 3) Two or more occurrences in the header are removed so only one is left
@@ -270,7 +270,7 @@ PHPAPI int TSendMail(char *host, int *error, char **error_message,
/* 128 is safe here, the specifier in snprintf isn't longer than that */
*error_message = ecalloc(1, HOST_NAME_LEN + 128);
snprintf(*error_message, HOST_NAME_LEN + 128,
- "Failed to connect to mailserver at \"%s\" port %d, verify your \"SMTP\" "
+ "Failed to connect to mailserver at \"%s\" port " ZEND_ULONG_FMT ", verify your \"SMTP\" "
"and \"smtp_port\" setting in php.ini or use ini_set()",
PW32G(mail_host), !INI_INT("smtp_port") ? 25 : INI_INT("smtp_port"));
return FAILURE;
@@ -887,7 +887,7 @@ again:
/* Check for newline */
Index += rlen;
- /* SMPT RFC says \r\n is the only valid line ending, who are we to argue ;)
+ /* SMTP RFC says \r\n is the only valid line ending, who are we to argue ;)
* The response code must contain at least 5 characters ex. 220\r\n */
if (Received < 5 || buf[Received - 1] != '\n' || buf[Received - 2] != '\r') {
goto again;
@@ -958,7 +958,7 @@ static unsigned long GetAddr(LPSTR szHost)
// Name: int FormatEmailAddress
// Input:
// Output:
-// Description: Formats the email address to remove any content ouside
+// Description: Formats the email address to remove any content outside
// of the angle brackets < > as per RFC 2821.
//
// Returns the invalidly formatted mail address if the < > are
diff --git a/win32/signal.c b/win32/signal.c
index bdfd7033f3..27ebf835c9 100644
--- a/win32/signal.c
+++ b/win32/signal.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -93,21 +91,22 @@ PHP_FUNCTION(sapi_windows_set_ctrl_handler)
zval *handler = NULL;
zend_bool add = 1;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|b", &handler, &add) == FAILURE) {
+ RETURN_THROWS();
+ }
+
#if ZTS
if (!tsrm_is_main_thread()) {
- php_error_docref(NULL, E_WARNING, "CTRL events can only be received on the main thread");
+ zend_throw_error(NULL, "CTRL events can only be received on the main thread");
return;
}
#endif
if (!php_win32_console_is_cli_sapi()) {
- php_error_docref(NULL, E_WARNING, "CTRL events trapping is only supported on console");
+ zend_throw_error(NULL, "CTRL events trapping is only supported on console");
return;
}
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|b", &handler, &add) == FAILURE) {
- return;
- }
if (IS_NULL == Z_TYPE_P(handler)) {
zval_dtor(&ctrl_handler);
@@ -120,9 +119,9 @@ PHP_FUNCTION(sapi_windows_set_ctrl_handler)
if (!zend_is_callable(handler, 0, NULL)) {
zend_string *func_name = zend_get_callable_name(handler);
- php_error_docref(NULL, E_WARNING, "%s is not a callable function name error", ZSTR_VAL(func_name));
+ zend_type_error("%s is not a callable function name error", ZSTR_VAL(func_name));
zend_string_release_ex(func_name, 0);
- RETURN_FALSE;
+ return;
}
if (!SetConsoleCtrlHandler(NULL, FALSE) || !SetConsoleCtrlHandler(php_win32_signal_system_ctrl_handler, add)) {
@@ -143,12 +142,12 @@ PHP_FUNCTION(sapi_windows_generate_ctrl_event)
zend_long evt, pid = 0;
zend_bool ret = 0;
- if (!php_win32_console_is_cli_sapi()) {
- php_error_docref(NULL, E_WARNING, "CTRL events trapping is only supported on console");
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l", &evt, &pid) == FAILURE) {
+ RETURN_THROWS();
}
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l", &evt, &pid) == FAILURE) {
+ if (!php_win32_console_is_cli_sapi()) {
+ zend_throw_error(NULL, "CTRL events trapping is only supported on console");
return;
}
diff --git a/win32/sockets.c b/win32/sockets.c
index 461ce69888..c38d2bccbc 100644
--- a/win32/sockets.c
+++ b/win32/sockets.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/win32/sockets.h b/win32/sockets.h
index 2e693f8840..f254133cc8 100644
--- a/win32/sockets.h
+++ b/win32/sockets.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/win32/syslog.h b/win32/syslog.h
index 5ea75d8486..560e8864fd 100644
--- a/win32/syslog.h
+++ b/win32/syslog.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/win32/winutil.c b/win32/winutil.c
index c04664bab3..7da505b1b4 100644
--- a/win32/winutil.c
+++ b/win32/winutil.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
diff --git a/win32/winutil.h b/win32/winutil.h
index f2faa95fa8..8acf87e671 100644
--- a/win32/winutil.h
+++ b/win32/winutil.h
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |